summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEgbert Eich <eich@freedesktop.org>2004-04-23 18:42:09 +0000
committerEgbert Eich <eich@freedesktop.org>2004-04-23 18:42:09 +0000
commitc6349f43193b74a3c09945f3093a871b0157ba47 (patch)
treeaea173c19da6fa57e24eb4633ff815feb7ae3fa0 /src
parentc3c4ddc682950a01b80825021f3e2503ab01ea7f (diff)
downloadxorg-lib-libX11-c6349f43193b74a3c09945f3093a871b0157ba47.tar.gz
Merging XORG-CURRENT into trunk
Diffstat (limited to 'src')
-rw-r--r--src/AllPlanes.c3
-rw-r--r--src/AllowEv.c2
-rw-r--r--src/AutoRep.c3
-rw-r--r--src/Backgnd.c2
-rw-r--r--src/BdrWidth.c2
-rw-r--r--src/Bell.c2
-rw-r--r--src/Border.c2
-rw-r--r--src/ChAccCon.c4
-rw-r--r--src/ChActPGb.c2
-rw-r--r--src/ChClMode.c2
-rw-r--r--src/ChCmap.c2
-rw-r--r--src/ChGC.c3
-rw-r--r--src/ChKeyCon.c2
-rw-r--r--src/ChPntCon.c2
-rw-r--r--src/ChProp.c13
-rw-r--r--src/ChSaveSet.c4
-rw-r--r--src/ChWAttrs.c3
-rw-r--r--src/ChWindow.c2
-rw-r--r--src/ChkIfEv.c3
-rw-r--r--src/ChkMaskEv.c10
-rw-r--r--src/ChkTypEv.c3
-rw-r--r--src/ChkTypWEv.c3
-rw-r--r--src/ChkWinEv.c10
-rw-r--r--src/CirWin.c2
-rw-r--r--src/CirWinDn.c2
-rw-r--r--src/CirWinUp.c2
-rw-r--r--src/ClDisplay.c11
-rw-r--r--src/Clear.c2
-rw-r--r--src/ClearArea.c2
-rw-r--r--src/Cmap.h2
-rw-r--r--src/ConfWind.c2
-rw-r--r--src/ConnDis.c185
-rw-r--r--src/Context.c15
-rw-r--r--src/ConvSel.c2
-rw-r--r--src/CopyArea.c2
-rw-r--r--src/CopyCmap.c7
-rw-r--r--src/CopyGC.c2
-rw-r--r--src/CopyPlane.c2
-rw-r--r--src/Cr.h2
-rw-r--r--src/CrBFData.c9
-rw-r--r--src/CrCmap.c3
-rw-r--r--src/CrCursor.c18
-rw-r--r--src/CrGC.c24
-rw-r--r--src/CrGlCur.c198
-rw-r--r--src/CrPixmap.c13
-rw-r--r--src/Cursor.c5
-rw-r--r--src/DefCursor.c2
-rw-r--r--src/DelProp.c2
-rw-r--r--src/DestSubs.c2
-rw-r--r--src/DestWind.c2
-rw-r--r--src/DisName.c11
-rw-r--r--src/DrArc.c2
-rw-r--r--src/DrArcs.c2
-rw-r--r--src/DrLine.c2
-rw-r--r--src/DrLines.c2
-rw-r--r--src/DrPoint.c2
-rw-r--r--src/DrPoints.c2
-rw-r--r--src/DrRect.c2
-rw-r--r--src/DrRects.c2
-rw-r--r--src/DrSegs.c2
-rw-r--r--src/ErrDes.c39
-rw-r--r--src/ErrHndlr.c24
-rw-r--r--src/EvToWire.c9
-rw-r--r--src/FSSaver.c4
-rw-r--r--src/FSWrap.c30
-rw-r--r--src/FillArc.c2
-rw-r--r--src/FillArcs.c2
-rw-r--r--src/FillPoly.c2
-rw-r--r--src/FillRct.c2
-rw-r--r--src/FillRcts.c2
-rw-r--r--src/FilterEv.c8
-rw-r--r--src/Flush.c2
-rw-r--r--src/Font.c544
-rw-r--r--src/FontInfo.c29
-rw-r--r--src/FontNames.c14
-rw-r--r--src/FreeCmap.c12
-rw-r--r--src/FreeCols.c2
-rw-r--r--src/FreeCurs.c2
-rw-r--r--src/FreeEData.c2
-rw-r--r--src/FreeGC.c2
-rw-r--r--src/FreePix.c2
-rw-r--r--src/GCMisc.c6
-rw-r--r--src/Geom.c16
-rw-r--r--src/GetAtomNm.c37
-rw-r--r--src/GetColor.c36
-rw-r--r--src/GetDflt.c49
-rw-r--r--src/GetFPath.c2
-rw-r--r--src/GetHints.c1
-rw-r--r--src/GetIFocus.c2
-rw-r--r--src/GetImage.c6
-rw-r--r--src/GetKCnt.c2
-rw-r--r--src/GetPCnt.c2
-rw-r--r--src/GetPntMap.c16
-rw-r--r--src/GetProp.c12
-rw-r--r--src/GetSSaver.c2
-rw-r--r--src/GetWAttrs.c13
-rw-r--r--src/GrButton.c2
-rw-r--r--src/GrKey.c2
-rw-r--r--src/GrServer.c2
-rw-r--r--src/Host.c135
-rw-r--r--src/IfEvent.c4
-rw-r--r--src/ImText.c12
-rw-r--r--src/ImText16.c12
-rw-r--r--src/ImUtil.c84
-rw-r--r--src/InitExt.c145
-rw-r--r--src/InsCmap.c2
-rw-r--r--src/IntAtom.c65
-rw-r--r--src/Key.h2
-rw-r--r--src/KeyBind.c547
-rw-r--r--src/KeysymStr.c53
-rw-r--r--src/KillCl.c2
-rw-r--r--src/LiHosts.c95
-rw-r--r--src/LiICmaps.c3
-rw-r--r--src/LiProps.c3
-rw-r--r--src/ListExt.c2
-rw-r--r--src/LoadFont.c14
-rw-r--r--src/LockDis.c17
-rw-r--r--src/LookupCol.c36
-rw-r--r--src/LowerWin.c2
-rw-r--r--src/Macros.c38
-rw-r--r--src/MapRaised.c2
-rw-r--r--src/MapSubs.c2
-rw-r--r--src/MapWindow.c2
-rw-r--r--src/MaskEvent.c12
-rw-r--r--src/Misc.c2
-rw-r--r--src/ModMap.c18
-rw-r--r--src/MoveWin.c2
-rw-r--r--src/NextEvent.c2
-rw-r--r--src/OCWrap.c34
-rw-r--r--src/OMWrap.c31
-rw-r--r--src/OpenDis.c166
-rw-r--r--src/ParseCmd.c22
-rw-r--r--src/ParseCol.c33
-rw-r--r--src/ParseGeom.c19
-rw-r--r--src/PeekEvent.c2
-rw-r--r--src/PeekIfEv.c4
-rw-r--r--src/PmapBgnd.c2
-rw-r--r--src/PmapBord.c2
-rw-r--r--src/PolyReg.c55
-rw-r--r--src/PolyTxt.c4
-rw-r--r--src/PolyTxt16.c4
-rw-r--r--src/PropAlloc.c3
-rw-r--r--src/PutBEvent.c2
-rw-r--r--src/PutImage.c253
-rw-r--r--src/QuColor.c2
-rw-r--r--src/QuColors.c2
-rw-r--r--src/QuExt.c13
-rw-r--r--src/QuKeybd.c2
-rw-r--r--src/QuTextE16.c14
-rw-r--r--src/QuTextExt.c14
-rw-r--r--src/QuTree.c3
-rw-r--r--src/Quarks.c45
-rw-r--r--src/RaiseWin.c2
-rw-r--r--src/RdBitF.c35
-rw-r--r--src/RecolorC.c2
-rw-r--r--src/ReconfWin.c2
-rw-r--r--src/Region.c340
-rw-r--r--src/RegstFlt.c48
-rw-r--r--src/RepWindow.c2
-rw-r--r--src/RestackWs.c2
-rw-r--r--src/RotProp.c2
-rw-r--r--src/SelInput.c2
-rw-r--r--src/SendEvent.c7
-rw-r--r--src/SetBack.c2
-rw-r--r--src/SetCRects.c17
-rw-r--r--src/SetClMask.c2
-rw-r--r--src/SetClOrig.c2
-rw-r--r--src/SetDashes.c11
-rw-r--r--src/SetFPath.c1
-rw-r--r--src/SetFont.c2
-rw-r--r--src/SetFore.c2
-rw-r--r--src/SetFunc.c2
-rw-r--r--src/SetHints.c22
-rw-r--r--src/SetIFocus.c2
-rw-r--r--src/SetLStyle.c2
-rw-r--r--src/SetLocale.c164
-rw-r--r--src/SetPMask.c2
-rw-r--r--src/SetPntMap.c12
-rw-r--r--src/SetSOwner.c2
-rw-r--r--src/SetSSaver.c2
-rw-r--r--src/SetState.c2
-rw-r--r--src/SetStip.c2
-rw-r--r--src/SetTSOrig.c2
-rw-r--r--src/SetTile.c2
-rw-r--r--src/StBytes.c19
-rw-r--r--src/StColor.c2
-rw-r--r--src/StColors.c2
-rw-r--r--src/StNColor.c12
-rw-r--r--src/StName.c17
-rw-r--r--src/StrKeysym.c51
-rw-r--r--src/Sync.c2
-rw-r--r--src/Synchro.c32
-rw-r--r--src/Text.c12
-rw-r--r--src/Text16.c16
-rw-r--r--src/TextExt.c31
-rw-r--r--src/TextExt16.c31
-rw-r--r--src/TextToStr.c3
-rw-r--r--src/UIThrStubs.c2
-rw-r--r--src/UndefCurs.c2
-rw-r--r--src/UngrabBut.c2
-rw-r--r--src/UngrabKbd.c2
-rw-r--r--src/UngrabKey.c2
-rw-r--r--src/UngrabPtr.c2
-rw-r--r--src/UngrabSvr.c2
-rw-r--r--src/UninsCmap.c2
-rw-r--r--src/UnldFont.c4
-rw-r--r--src/UnmapSubs.c2
-rw-r--r--src/UnmapWin.c2
-rw-r--r--src/WMGeom.c27
-rw-r--r--src/WMProps.c20
-rw-r--r--src/WarpPtr.c2
-rw-r--r--src/WinEvent.c12
-rw-r--r--src/Window.c13
-rw-r--r--src/WrBitF.c22
-rw-r--r--src/XErrorDB156
-rw-r--r--src/XKeysymDB148
-rw-r--r--src/Xintatom.h2
-rw-r--r--src/Xintconn.h9
-rw-r--r--src/XlibInt.c658
-rw-r--r--src/XomGeneric.h151
-rw-r--r--src/Xresinternal.h2
-rw-r--r--src/Xrm.c565
-rw-r--r--src/evtomask.c9
-rw-r--r--src/globals.c4
-rw-r--r--src/imConv.c951
-rw-r--r--src/locking.c108
-rw-r--r--src/locking.h27
-rw-r--r--src/os2Stubs.c2
-rw-r--r--src/udcInf.c16
-rw-r--r--src/util/makekeys.c17
-rw-r--r--src/xcms/AddDIC.c11
-rw-r--r--src/xcms/AddSF.c14
-rw-r--r--src/xcms/CCC.c4
-rw-r--r--src/xcms/Cv.h2
-rw-r--r--src/xcms/CvColW.c17
-rw-r--r--src/xcms/CvCols.c111
-rw-r--r--src/xcms/HVC.c37
-rw-r--r--src/xcms/HVCGcC.c9
-rw-r--r--src/xcms/HVCGcV.c10
-rw-r--r--src/xcms/HVCGcVC.c10
-rw-r--r--src/xcms/HVCMnV.c9
-rw-r--r--src/xcms/HVCMxC.c11
-rw-r--r--src/xcms/HVCMxV.c10
-rw-r--r--src/xcms/HVCMxVC.c24
-rw-r--r--src/xcms/HVCMxVs.c10
-rw-r--r--src/xcms/HVCWpAj.c8
-rw-r--r--src/xcms/IdOfPr.c9
-rw-r--r--src/xcms/LRGB.c534
-rw-r--r--src/xcms/Lab.c23
-rw-r--r--src/xcms/LabGcC.c2
-rw-r--r--src/xcms/LabGcL.c7
-rw-r--r--src/xcms/LabGcLC.c7
-rw-r--r--src/xcms/LabMnL.c7
-rw-r--r--src/xcms/LabMxC.c7
-rw-r--r--src/xcms/LabMxL.c7
-rw-r--r--src/xcms/LabMxLC.c23
-rw-r--r--src/xcms/LabWpAj.c4
-rw-r--r--src/xcms/Luv.c22
-rw-r--r--src/xcms/LuvGcC.c2
-rw-r--r--src/xcms/LuvGcL.c7
-rw-r--r--src/xcms/LuvGcLC.c7
-rw-r--r--src/xcms/LuvMnL.c7
-rw-r--r--src/xcms/LuvMxC.c6
-rw-r--r--src/xcms/LuvMxL.c7
-rw-r--r--src/xcms/LuvMxLC.c23
-rw-r--r--src/xcms/LuvWpAj.c8
-rw-r--r--src/xcms/PrOfId.c8
-rw-r--r--src/xcms/QuCol.c7
-rw-r--r--src/xcms/QuCols.c4
-rw-r--r--src/xcms/SetCCC.c15
-rw-r--r--src/xcms/SetGetCols.c181
-rw-r--r--src/xcms/StCol.c6
-rw-r--r--src/xcms/StCols.c2
-rw-r--r--src/xcms/UNDEFINED.c42
-rw-r--r--src/xcms/XRGB.c46
-rw-r--r--src/xcms/XYZ.c25
-rw-r--r--src/xcms/Xcms.txt24
-rw-r--r--src/xcms/Xcmsint.h36
-rw-r--r--src/xcms/cmsAllCol.c4
-rw-r--r--src/xcms/cmsAllNCol.c20
-rw-r--r--src/xcms/cmsCmap.c30
-rw-r--r--src/xcms/cmsColNm.c118
-rw-r--r--src/xcms/cmsGlobls.c73
-rw-r--r--src/xcms/cmsInt.c56
-rw-r--r--src/xcms/cmsLkCol.c24
-rw-r--r--src/xcms/cmsMath.c3
-rw-r--r--src/xcms/cmsProp.c26
-rw-r--r--src/xcms/cmsTrig.c70
-rw-r--r--src/xcms/uvY.c22
-rw-r--r--src/xcms/xyY.c22
-rw-r--r--src/xkb/XKB.c184
-rw-r--r--src/xkb/XKBAlloc.c91
-rw-r--r--src/xkb/XKBBell.c54
-rw-r--r--src/xkb/XKBBind.c259
-rw-r--r--src/xkb/XKBCompat.c31
-rw-r--r--src/xkb/XKBCtrls.c85
-rw-r--r--src/xkb/XKBCvt.c368
-rw-r--r--src/xkb/XKBExtDev.c149
-rw-r--r--src/xkb/XKBGAlloc.c364
-rw-r--r--src/xkb/XKBGeom.c120
-rw-r--r--src/xkb/XKBGetByName.c18
-rw-r--r--src/xkb/XKBGetMap.c169
-rw-r--r--src/xkb/XKBList.c27
-rw-r--r--src/xkb/XKBMAlloc.c91
-rw-r--r--src/xkb/XKBMisc.c114
-rw-r--r--src/xkb/XKBNames.c79
-rw-r--r--src/xkb/XKBRdBuf.c95
-rw-r--r--src/xkb/XKBSetGeom.c97
-rw-r--r--src/xkb/XKBSetMap.c126
-rw-r--r--src/xkb/XKBUse.c189
-rw-r--r--src/xkb/XKBleds.c82
-rw-r--r--src/xkb/XKBlibint.h71
-rw-r--r--src/xlibi18n/ICWrap.c137
-rw-r--r--src/xlibi18n/IMWrap.c36
-rw-r--r--src/xlibi18n/XDefaultIMIF.c116
-rw-r--r--src/xlibi18n/XDefaultOMIF.c260
-rw-r--r--src/xlibi18n/XimImSw.h7
-rw-r--r--src/xlibi18n/XimThai.h93
-rw-r--r--src/xlibi18n/XimTrInt.h9
-rw-r--r--src/xlibi18n/XimTrX.h3
-rw-r--r--src/xlibi18n/XimTrans.h36
-rw-r--r--src/xlibi18n/Ximint.h374
-rw-r--r--src/xlibi18n/XimintL.h18
-rw-r--r--src/xlibi18n/XimintP.h30
-rw-r--r--src/xlibi18n/XlcDL.c478
-rw-r--r--src/xlibi18n/XlcGeneric.h22
-rw-r--r--src/xlibi18n/XlcPubI.h223
-rw-r--r--src/xlibi18n/XlcPublic.h291
-rw-r--r--src/xlibi18n/XlcSL.c5
-rw-r--r--src/xlibi18n/Xlcint.h463
-rw-r--r--src/xlibi18n/imKStoUCS.c14
-rw-r--r--src/xlibi18n/lcCT.c1587
-rw-r--r--src/xlibi18n/lcCharSet.c169
-rw-r--r--src/xlibi18n/lcConv.c148
-rw-r--r--src/xlibi18n/lcDB.c604
-rw-r--r--src/xlibi18n/lcDynamic.c31
-rw-r--r--src/xlibi18n/lcFile.c403
-rw-r--r--src/xlibi18n/lcGeneric.c572
-rw-r--r--src/xlibi18n/lcInit.c129
-rw-r--r--src/xlibi18n/lcPrTxt.c135
-rw-r--r--src/xlibi18n/lcPubWrap.c22
-rw-r--r--src/xlibi18n/lcPublic.c92
-rw-r--r--src/xlibi18n/lcRM.c219
-rw-r--r--src/xlibi18n/lcStd.c160
-rw-r--r--src/xlibi18n/lcTxtPr.c84
-rw-r--r--src/xlibi18n/lcUTF8.c10
-rw-r--r--src/xlibi18n/lcUniConv/8bit_tab_to_h.c2
-rw-r--r--src/xlibi18n/lcUniConv/README4
-rw-r--r--src/xlibi18n/lcUniConv/armscii_8.h42
-rw-r--r--src/xlibi18n/lcUniConv/ascii.h2
-rw-r--r--src/xlibi18n/lcUniConv/big5.h4
-rw-r--r--src/xlibi18n/lcUniConv/big5_emacs.h2
-rw-r--r--src/xlibi18n/lcUniConv/cjk_tab_to_h.c2
-rw-r--r--src/xlibi18n/lcUniConv/cp1133.h2
-rw-r--r--src/xlibi18n/lcUniConv/cp1251.h2
-rw-r--r--src/xlibi18n/lcUniConv/cp1255.h2
-rw-r--r--src/xlibi18n/lcUniConv/cp1256.h2
-rw-r--r--src/xlibi18n/lcUniConv/gb2312.h4
-rw-r--r--src/xlibi18n/lcUniConv/georgian_academy.h2
-rw-r--r--src/xlibi18n/lcUniConv/georgian_ps.h2
-rw-r--r--src/xlibi18n/lcUniConv/iso8859_1.h2
-rw-r--r--src/xlibi18n/lcUniConv/iso8859_10.h2
-rw-r--r--src/xlibi18n/lcUniConv/iso8859_11.h2
-rw-r--r--src/xlibi18n/lcUniConv/iso8859_13.h2
-rw-r--r--src/xlibi18n/lcUniConv/iso8859_14.h2
-rw-r--r--src/xlibi18n/lcUniConv/iso8859_15.h2
-rw-r--r--src/xlibi18n/lcUniConv/iso8859_16.h8
-rw-r--r--src/xlibi18n/lcUniConv/iso8859_2.h2
-rw-r--r--src/xlibi18n/lcUniConv/iso8859_3.h2
-rw-r--r--src/xlibi18n/lcUniConv/iso8859_4.h2
-rw-r--r--src/xlibi18n/lcUniConv/iso8859_5.h2
-rw-r--r--src/xlibi18n/lcUniConv/iso8859_6.h2
-rw-r--r--src/xlibi18n/lcUniConv/iso8859_7.h2
-rw-r--r--src/xlibi18n/lcUniConv/iso8859_8.h2
-rw-r--r--src/xlibi18n/lcUniConv/iso8859_9.h2
-rw-r--r--src/xlibi18n/lcUniConv/iso8859_9e.h2
-rw-r--r--src/xlibi18n/lcUniConv/jisx0201.h2
-rw-r--r--src/xlibi18n/lcUniConv/jisx0208.h4
-rw-r--r--src/xlibi18n/lcUniConv/jisx0212.h4
-rw-r--r--src/xlibi18n/lcUniConv/koi8_c.h2
-rw-r--r--src/xlibi18n/lcUniConv/koi8_r.h2
-rw-r--r--src/xlibi18n/lcUniConv/koi8_u.h2
-rw-r--r--src/xlibi18n/lcUniConv/ksc5601.h4
-rw-r--r--src/xlibi18n/lcUniConv/mulelao.h2
-rw-r--r--src/xlibi18n/lcUniConv/tatar_cyr.h2
-rw-r--r--src/xlibi18n/lcUniConv/tcvn.h2
-rw-r--r--src/xlibi18n/lcUniConv/tis620.h2
-rw-r--r--src/xlibi18n/lcUniConv/ucs2be.h2
-rw-r--r--src/xlibi18n/lcUniConv/utf8.h2
-rw-r--r--src/xlibi18n/lcUniConv/viscii.h2
-rw-r--r--src/xlibi18n/lcUtil.c81
-rw-r--r--src/xlibi18n/lcWrap.c272
-rw-r--r--src/xlibi18n/mbWMProps.c30
-rw-r--r--src/xlibi18n/mbWrap.c78
-rw-r--r--src/xlibi18n/utf8WMProps.c17
-rw-r--r--src/xlibi18n/utf8Wrap.c71
-rw-r--r--src/xlibi18n/wcWrap.c78
397 files changed, 9471 insertions, 10523 deletions
diff --git a/src/AllPlanes.c b/src/AllPlanes.c
index b636159e..5f7e6bcc 100644
--- a/src/AllPlanes.c
+++ b/src/AllPlanes.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/AllPlanes.c,v 1.3 2001/01/17 19:41:32 dawes Exp $ */
#define NEED_REPLIES
#include "Xlibint.h"
@@ -61,7 +62,7 @@ unsigned long *rmask, *gmask, *bmask; /* CARD32 */ /* RETURN */
*bmask = rep.blueMask;
/* sizeof(CARD32) = 4 */
- _XRead32 (dpy, (char *) pixels, (long)(ncolors * 4));
+ _XRead32 (dpy, (long *) pixels, (long)(ncolors * 4));
}
UnlockDisplay(dpy);
diff --git a/src/AllowEv.c b/src/AllowEv.c
index b12e8f61..b87d3bec 100644
--- a/src/AllowEv.c
+++ b/src/AllowEv.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/AllowEv.c,v 1.3 2001/01/17 19:41:32 dawes Exp $ */
#include "Xlibint.h"
+int
XAllowEvents(dpy, mode, time)
register Display *dpy;
int mode;
diff --git a/src/AutoRep.c b/src/AutoRep.c
index beb9a8f1..eb6a3073 100644
--- a/src/AutoRep.c
+++ b/src/AutoRep.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/AutoRep.c,v 1.3 2001/01/17 19:41:32 dawes Exp $ */
#include "Xlibint.h"
+int
XAutoRepeatOn (dpy)
register Display *dpy;
{
@@ -36,6 +38,7 @@ register Display *dpy;
return 1;
}
+int
XAutoRepeatOff (dpy)
register Display *dpy;
{
diff --git a/src/Backgnd.c b/src/Backgnd.c
index e5b67666..76ebb13f 100644
--- a/src/Backgnd.c
+++ b/src/Backgnd.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/Backgnd.c,v 1.3 2001/01/17 19:41:32 dawes Exp $ */
#include "Xlibint.h"
+int
XSetWindowBackground(dpy, w, pixel)
register Display *dpy;
Window w;
diff --git a/src/BdrWidth.c b/src/BdrWidth.c
index 2550fda3..5178032f 100644
--- a/src/BdrWidth.c
+++ b/src/BdrWidth.c
@@ -27,9 +27,11 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/lib/X11/BdrWidth.c,v 1.3 2001/01/17 19:41:32 dawes Exp $ */
#include "Xlibint.h"
+int
XSetWindowBorderWidth(dpy, w, width)
Display *dpy;
Window w;
diff --git a/src/Bell.c b/src/Bell.c
index 7c620206..53b77c81 100644
--- a/src/Bell.c
+++ b/src/Bell.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/Bell.c,v 1.3 2001/01/17 19:41:32 dawes Exp $ */
#include "Xlibint.h"
+int
XBell(dpy, percent)
register Display *dpy;
int percent;
diff --git a/src/Border.c b/src/Border.c
index 5e71ee90..29f55555 100644
--- a/src/Border.c
+++ b/src/Border.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/Border.c,v 1.3 2001/01/17 19:41:32 dawes Exp $ */
#include "Xlibint.h"
+int
XSetWindowBorder(dpy, w, pixel)
register Display *dpy;
Window w;
diff --git a/src/ChAccCon.c b/src/ChAccCon.c
index 4366f695..4d9281db 100644
--- a/src/ChAccCon.c
+++ b/src/ChAccCon.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/ChAccCon.c,v 1.3 2001/01/17 19:41:32 dawes Exp $ */
#include "Xlibint.h"
+int
XEnableAccessControl(dpy)
register Display *dpy;
@@ -34,6 +36,7 @@ XEnableAccessControl(dpy)
return XSetAccessControl(dpy, EnableAccess);
}
+int
XDisableAccessControl(dpy)
register Display *dpy;
@@ -41,6 +44,7 @@ XDisableAccessControl(dpy)
return XSetAccessControl(dpy, DisableAccess);
}
+int
XSetAccessControl(dpy, mode)
register Display *dpy;
int mode;
diff --git a/src/ChActPGb.c b/src/ChActPGb.c
index adc2036e..e1df3431 100644
--- a/src/ChActPGb.c
+++ b/src/ChActPGb.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/ChActPGb.c,v 1.3 2001/01/17 19:41:32 dawes Exp $ */
#include "Xlibint.h"
+int
XChangeActivePointerGrab(dpy, event_mask, curs, time)
register Display *dpy;
unsigned int event_mask; /* CARD16 */
diff --git a/src/ChClMode.c b/src/ChClMode.c
index 0b2657eb..4faa37f5 100644
--- a/src/ChClMode.c
+++ b/src/ChClMode.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/ChClMode.c,v 1.3 2001/01/17 19:41:32 dawes Exp $ */
#include "Xlibint.h"
+int
XSetCloseDownMode(dpy, mode)
register Display *dpy;
int mode;
diff --git a/src/ChCmap.c b/src/ChCmap.c
index d6aaa892..f3c02ded 100644
--- a/src/ChCmap.c
+++ b/src/ChCmap.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/ChCmap.c,v 1.3 2001/01/17 19:41:32 dawes Exp $ */
#include "Xlibint.h"
+int
XSetWindowColormap(dpy, w, colormap)
register Display *dpy;
Window w;
diff --git a/src/ChGC.c b/src/ChGC.c
index d7d536a6..9186dd05 100644
--- a/src/ChGC.c
+++ b/src/ChGC.c
@@ -24,9 +24,12 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/ChGC.c,v 1.4 2001/12/14 19:53:57 dawes Exp $ */
#include "Xlibint.h"
+#include "Cr.h"
+int
XChangeGC (dpy, gc, valuemask, values)
register Display *dpy;
GC gc;
diff --git a/src/ChKeyCon.c b/src/ChKeyCon.c
index c1b3fdce..bc5419f4 100644
--- a/src/ChKeyCon.c
+++ b/src/ChKeyCon.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/ChKeyCon.c,v 1.3 2001/01/17 19:41:32 dawes Exp $ */
#include "Xlibint.h"
+int
XChangeKeyboardControl(dpy, mask, value_list)
register Display *dpy;
unsigned long mask;
diff --git a/src/ChPntCon.c b/src/ChPntCon.c
index ce0776d9..0a0fd6f0 100644
--- a/src/ChPntCon.c
+++ b/src/ChPntCon.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/ChPntCon.c,v 1.3 2001/01/17 19:41:32 dawes Exp $ */
#include "Xlibint.h"
+int
XChangePointerControl(dpy, do_acc, do_thresh, acc_numerator,
acc_denominator, threshold)
register Display *dpy;
diff --git a/src/ChProp.c b/src/ChProp.c
index 4cfbe96d..606277d6 100644
--- a/src/ChProp.c
+++ b/src/ChProp.c
@@ -24,10 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/ChProp.c,v 1.4 2001/12/14 19:53:57 dawes Exp $ */
#include "Xlibint.h"
-#if NeedFunctionPrototypes
+int
XChangeProperty (
register Display *dpy,
Window w,
@@ -37,16 +38,6 @@ XChangeProperty (
int mode, /* PropModeReplace, PropModePrepend, PropModeAppend */
_Xconst unsigned char *data,
int nelements)
-#else
-XChangeProperty (dpy, w, property, type, format, mode, data, nelements)
- register Display *dpy;
- Window w;
- Atom property, type;
- int format; /* 8, 16, or 32 */
- int mode; /* PropModeReplace, PropModePrepend, PropModeAppend */
- unsigned char *data;
- int nelements;
-#endif
{
register xChangePropertyReq *req;
register long len;
diff --git a/src/ChSaveSet.c b/src/ChSaveSet.c
index 7adb08cf..a048b7bb 100644
--- a/src/ChSaveSet.c
+++ b/src/ChSaveSet.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/ChSaveSet.c,v 1.3 2001/01/17 19:41:32 dawes Exp $ */
#include "Xlibint.h"
+int
XChangeSaveSet(dpy, win, mode)
register Display *dpy;
Window win;
@@ -43,6 +45,7 @@ int mode;
return 1;
}
+int
XAddToSaveSet(dpy, win)
register Display *dpy;
Window win;
@@ -50,6 +53,7 @@ XAddToSaveSet(dpy, win)
return XChangeSaveSet(dpy,win,SetModeInsert);
}
+int
XRemoveFromSaveSet (dpy, win)
register Display *dpy;
Window win;
diff --git a/src/ChWAttrs.c b/src/ChWAttrs.c
index 2c05cf55..215980b1 100644
--- a/src/ChWAttrs.c
+++ b/src/ChWAttrs.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/ChWAttrs.c,v 1.4 2001/12/14 19:53:57 dawes Exp $ */
#include "Xlibint.h"
@@ -33,6 +34,7 @@ in this Software without prior written authorization from The Open Group.
CWOverrideRedirect|CWSaveUnder|CWEventMask|\
CWDontPropagate|CWColormap|CWCursor)
+int
XChangeWindowAttributes (dpy, w, valuemask, attributes)
register Display *dpy;
Window w;
@@ -40,7 +42,6 @@ XChangeWindowAttributes (dpy, w, valuemask, attributes)
XSetWindowAttributes *attributes;
{
register xChangeWindowAttributesReq *req;
- extern void _XProcessWindowAttributes();
LockDisplay(dpy);
GetReq(ChangeWindowAttributes,req);
diff --git a/src/ChWindow.c b/src/ChWindow.c
index b0319aa6..41af3bed 100644
--- a/src/ChWindow.c
+++ b/src/ChWindow.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/ChWindow.c,v 1.5 2001/01/17 19:41:32 dawes Exp $ */
#include "Xlibint.h"
+int
XResizeWindow(dpy, w, width, height)
register Display *dpy;
Window w;
diff --git a/src/ChkIfEv.c b/src/ChkIfEv.c
index 24539e82..7c56f52e 100644
--- a/src/ChkIfEv.c
+++ b/src/ChkIfEv.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86$ */
#define NEED_EVENTS
#include "Xlibint.h"
@@ -37,11 +38,9 @@ in this Software without prior written authorization from The Open Group.
Bool XCheckIfEvent (dpy, event, predicate, arg)
register Display *dpy;
Bool (*predicate)(
-#if NeedNestedPrototypes
Display* /* display */,
XEvent* /* event */,
char* /* arg */
-#endif
); /* function to call */
register XEvent *event; /* XEvent to be filled in. */
char *arg;
diff --git a/src/ChkMaskEv.c b/src/ChkMaskEv.c
index cc511720..961dce69 100644
--- a/src/ChkMaskEv.c
+++ b/src/ChkMaskEv.c
@@ -24,16 +24,12 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/ChkMaskEv.c,v 3.5 2001/10/28 03:32:29 tsi Exp $ */
#define NEED_EVENTS
#include "Xlibint.h"
-#ifdef __STDC__
-#define Const const
-#else
-#define Const /**/
-#endif
-extern long Const _Xevent_to_mask[];
+extern long const _Xevent_to_mask[];
#define AllPointers (PointerMotionMask|PointerMotionHintMask|ButtonMotionMask)
#define AllButtons (Button1MotionMask|Button2MotionMask|Button3MotionMask|\
@@ -51,7 +47,7 @@ Bool XCheckMaskEvent (dpy, mask, event)
register XEvent *event; /* XEvent to be filled in. */
{
register _XQEvent *prev, *qelt;
- unsigned long qe_serial;
+ unsigned long qe_serial = 0;
int n; /* time through count */
LockDisplay(dpy);
diff --git a/src/ChkTypEv.c b/src/ChkTypEv.c
index dd45be0b..c1c36d43 100644
--- a/src/ChkTypEv.c
+++ b/src/ChkTypEv.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/ChkTypEv.c,v 1.2 2001/10/28 03:32:29 tsi Exp $ */
#define NEED_EVENTS
#include "Xlibint.h"
@@ -40,7 +41,7 @@ Bool XCheckTypedEvent (dpy, type, event)
register XEvent *event; /* XEvent to be filled in. */
{
register _XQEvent *prev, *qelt;
- unsigned long qe_serial;
+ unsigned long qe_serial = 0;
int n; /* time through count */
LockDisplay(dpy);
diff --git a/src/ChkTypWEv.c b/src/ChkTypWEv.c
index 09b48b5d..c15f2bcf 100644
--- a/src/ChkTypWEv.c
+++ b/src/ChkTypWEv.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/ChkTypWEv.c,v 1.2 2001/10/28 03:32:29 tsi Exp $ */
#define NEED_EVENTS
#include "Xlibint.h"
@@ -41,7 +42,7 @@ Bool XCheckTypedWindowEvent (dpy, w, type, event)
register XEvent *event; /* XEvent to be filled in. */
{
register _XQEvent *prev, *qelt;
- unsigned long qe_serial;
+ unsigned long qe_serial = 0;
int n; /* time through count */
LockDisplay(dpy);
diff --git a/src/ChkWinEv.c b/src/ChkWinEv.c
index 27d4c05e..2fd386d2 100644
--- a/src/ChkWinEv.c
+++ b/src/ChkWinEv.c
@@ -24,16 +24,12 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/ChkWinEv.c,v 3.5 2001/10/28 03:32:30 tsi Exp $ */
#define NEED_EVENTS
#include "Xlibint.h"
-#ifdef __STDC__
-#define Const const
-#else
-#define Const /**/
-#endif
-extern long Const _Xevent_to_mask[];
+extern long const _Xevent_to_mask[];
#define AllPointers (PointerMotionMask|PointerMotionHintMask|ButtonMotionMask)
#define AllButtons (Button1MotionMask|Button2MotionMask|Button3MotionMask|\
Button4MotionMask|Button5MotionMask)
@@ -51,7 +47,7 @@ Bool XCheckWindowEvent (dpy, w, mask, event)
register XEvent *event; /* XEvent to be filled in. */
{
register _XQEvent *prev, *qelt;
- unsigned long qe_serial;
+ unsigned long qe_serial = 0;
int n; /* time through count */
LockDisplay(dpy);
diff --git a/src/CirWin.c b/src/CirWin.c
index 4099900f..53c70440 100644
--- a/src/CirWin.c
+++ b/src/CirWin.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/CirWin.c,v 1.3 2001/01/17 19:41:32 dawes Exp $ */
#include "Xlibint.h"
+int
XCirculateSubwindows(dpy, w, direction)
register Display *dpy;
Window w;
diff --git a/src/CirWinDn.c b/src/CirWinDn.c
index c3dce796..b790f2d7 100644
--- a/src/CirWinDn.c
+++ b/src/CirWinDn.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/CirWinDn.c,v 1.3 2001/01/17 19:41:33 dawes Exp $ */
#include "Xlibint.h"
+int
XCirculateSubwindowsDown(dpy,w)
register Display *dpy;
Window w;
diff --git a/src/CirWinUp.c b/src/CirWinUp.c
index 65ff8645..12756cd3 100644
--- a/src/CirWinUp.c
+++ b/src/CirWinUp.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/CirWinUp.c,v 1.3 2001/01/17 19:41:33 dawes Exp $ */
#include "Xlibint.h"
+int
XCirculateSubwindowsUp(dpy, w)
register Display *dpy;
Window w;
diff --git a/src/ClDisplay.c b/src/ClDisplay.c
index 0ea2fc54..25fac7b1 100644
--- a/src/ClDisplay.c
+++ b/src/ClDisplay.c
@@ -27,10 +27,12 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/lib/X11/ClDisplay.c,v 1.4 2001/12/14 19:53:58 dawes Exp $ */
+#include <X11/Xtrans.h>
+#include "Xlib.h"
#include "Xlibint.h"
-
-extern void _XFreeDisplayStructure();
+#include "Xintconn.h"
/*
* XCloseDisplay - XSync the connection to the X Server, close the connection,
@@ -38,8 +40,9 @@ extern void _XFreeDisplayStructure();
* memory and must be careful about the types of requests they generate.
*/
-XCloseDisplay (dpy)
- register Display *dpy;
+int
+XCloseDisplay (
+ register Display *dpy)
{
register _XExtension *ext;
register int i;
diff --git a/src/Clear.c b/src/Clear.c
index 54fde13e..403943bc 100644
--- a/src/Clear.c
+++ b/src/Clear.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/Clear.c,v 1.3 2001/01/17 19:41:33 dawes Exp $ */
#include "Xlibint.h"
+int
XClearWindow(dpy, w)
register Display *dpy;
Window w;
diff --git a/src/ClearArea.c b/src/ClearArea.c
index 4028ae44..a85eb6ba 100644
--- a/src/ClearArea.c
+++ b/src/ClearArea.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/ClearArea.c,v 1.3 2001/01/17 19:41:33 dawes Exp $ */
#include "Xlibint.h"
+int
XClearArea (dpy, w, x, y, width, height, exposures)
register Display *dpy;
Window w;
diff --git a/src/Cmap.h b/src/Cmap.h
index 709f25cc..b4312be7 100644
--- a/src/Cmap.h
+++ b/src/Cmap.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/Cmap.h,v 1.1 2003/04/13 19:22:14 dawes Exp $ */
+/* $XFree86$ */
#ifndef _CMAP_H_
#define _CMAP_H_
diff --git a/src/ConfWind.c b/src/ConfWind.c
index f4bb4239..1c5813f5 100644
--- a/src/ConfWind.c
+++ b/src/ConfWind.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/ConfWind.c,v 1.3 2001/01/17 19:41:33 dawes Exp $ */
#include "Xlibint.h"
+int
XMoveResizeWindow(dpy, w, x, y, width, height)
register Display *dpy;
Window w;
diff --git a/src/ConnDis.c b/src/ConnDis.c
index 9ee55118..897ef5ab 100644
--- a/src/ConnDis.c
+++ b/src/ConnDis.c
@@ -1,3 +1,4 @@
+/* $XdotOrg: lib/X11/src/ConnDis.c,v 1.2 2004-04-23 18:43:23 eich Exp $ */
/* $Xorg: ConnDis.c,v 1.8 2001/02/09 02:03:31 xorgcvs Exp $ */
/*
@@ -24,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/ConnDis.c,v 3.28 2003/12/02 23:33:17 herrb Exp $ */
/*
* This file contains operating system dependencies.
@@ -34,11 +36,16 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xlibint.h>
#include <X11/Xtrans.h>
#include <X11/Xauth.h>
+#include <X11/Xdmcp.h>
#include <stdio.h>
#include <ctype.h>
-#ifndef WIN32
+#if !defined(WIN32)
+#ifndef Lynx
#include <sys/socket.h>
+#else
+#include <socket.h>
+#endif
#endif
#ifndef X_CONNECTION_RETRIES /* number retries on ECONNREFUSED */
@@ -49,11 +56,22 @@ in this Software without prior written authorization from The Open Group.
#include <sys/utsname.h>
#endif
-static void GetAuthorization();
-
-static char *copystring (src, len)
- char *src;
- int len;
+#include "Xintconn.h"
+
+/* prototyes */
+static void GetAuthorization(
+ XtransConnInfo trans_conn,
+ int family,
+ char *saddr,
+ int saddrlen,
+ int idisplay,
+ char **auth_namep,
+ int *auth_namelenp,
+ char **auth_datap,
+ int *auth_datalenp);
+
+/* functions */
+static char *copystring (char *src, int len)
{
char *dst = Xmalloc (len + 1);
@@ -73,7 +91,16 @@ static char *copystring (src, len)
*
* [protocol/] [hostname] : [:] displaynumber [.screennumber]
*
- * The second colon indicates a DECnet style name. No hostname is interpretted
+ * A string with exactly two colons seperating hostname from the display
+ * indicates a DECnet style name. Colons in the hostname may occur if an
+ * IPv6 numeric address is used as the hostname. An IPv6 numeric address
+ * may also end in a double colon, so three colons in a row indicates an
+ * IPv6 address ending in :: followed by :display. To make it easier for
+ * people to read, an IPv6 numeric address hostname may be surrounded by
+ * [ ] in a similar fashion to the IPv6 numeric address URL syntax defined
+ * by IETF RFC 2732.
+ *
+ * If no hostname and no protocol is specified, the string is interpreted
* as the most efficient local connection to a server on the same machine.
* This is usually:
*
@@ -89,16 +116,15 @@ static char *copystring (src, len)
*
*/
XtransConnInfo
-_X11TransConnectDisplay (display_name, fullnamep, dpynump, screenp,
- auth_namep, auth_namelenp, auth_datap, auth_datalenp)
- char *display_name;
- char **fullnamep; /* RETURN */
- int *dpynump; /* RETURN */
- int *screenp; /* RETURN */
- char **auth_namep; /* RETURN */
- int *auth_namelenp; /* RETURN */
- char **auth_datap; /* RETURN */
- int *auth_datalenp; /* RETURN */
+_X11TransConnectDisplay (
+ char *display_name,
+ char **fullnamep, /* RETURN */
+ int *dpynump, /* RETURN */
+ int *screenp, /* RETURN */
+ char **auth_namep, /* RETURN */
+ int *auth_namelenp, /* RETURN */
+ char **auth_datap, /* RETURN */
+ int *auth_datalenp) /* RETURN */
{
int family;
int saddrlen;
@@ -109,9 +135,9 @@ _X11TransConnectDisplay (display_name, fullnamep, dpynump, screenp,
char *pdpynum = NULL; /* start of dpynum of display */
char *pscrnum = NULL; /* start of screen of display */
Bool dnet = False; /* if true, then DECnet format */
- int idisplay; /* required display number */
+ int idisplay = 0; /* required display number */
int iscreen = 0; /* optional screen number */
- int (*connfunc)(); /* method to create connection */
+ /* int (*connfunc)(); */ /* method to create connection */
int len, hostlen; /* length tmp variable */
int retry; /* retry counter */
char addrbuf[128]; /* final address passed to
@@ -149,7 +175,8 @@ _X11TransConnectDisplay (display_name, fullnamep, dpynump, screenp,
/*
* Step 1, find the hostname. This is delimited by either one colon,
* or two colons in the case of DECnet (DECnet Phase V allows a single
- * colon in the hostname).
+ * colon in the hostname). (See note above regarding IPv6 numeric
+ * addresses with triple colons or [] brackets.)
*/
lastp = p;
@@ -160,7 +187,11 @@ _X11TransConnectDisplay (display_name, fullnamep, dpynump, screenp,
if (!lastc) return NULL; /* must have a colon */
- if ((lastp != lastc) && (*(lastc - 1) == ':')) {
+ if ((lastp != lastc) && (*(lastc - 1) == ':')
+#if defined(IPv6) && defined(AF_INET6)
+ && ( ((lastc - 1) == lastp) || (*(lastc - 2) != ':'))
+#endif
+ ) {
/* DECnet display specified */
#ifndef DNETCONN
@@ -250,18 +281,24 @@ _X11TransConnectDisplay (display_name, fullnamep, dpynump, screenp,
* is "unix", then choose BSD UNIX domain sockets (if configured).
*/
-#if defined(TCPCONN) || defined(UNIXCONN) || defined(LOCALCONN)
+#if defined(TCPCONN) || defined(UNIXCONN) || defined(LOCALCONN) || defined(MNX_TCPCONN) || defined(OS2PIPECONN)
if (!pprotocol) {
if (!phostname)
-#if defined(UNIXCONN) || defined(LOCALCONN)
+#if defined(UNIXCONN) || defined(LOCALCONN) || defined(OS2PIPECONN)
pprotocol = copystring ("local", 5);
else
#endif
pprotocol = copystring ("tcp", 3);
}
+#else
+#if defined(AMRPCCONN)
+ if (!pprotocol) {
+ pprotocol = copystring ("amcon", 5);
+ }
+#endif
#endif
-#if defined(UNIXCONN) || defined(LOCALCONN)
+#if defined(UNIXCONN) || defined(LOCALCONN) || defined(OS2PIPECONN)
/*
* Now that the defaults have been established, see if we have any
* special names that we have to override:
@@ -288,7 +325,9 @@ _X11TransConnectDisplay (display_name, fullnamep, dpynump, screenp,
}
#endif
+#if defined(LOCALCONN) && defined(TCPCONN)
connect:
+#endif
/*
* This seems kind of backwards, but we need to put the protocol,
* host, and port back together to pass to _X11TransOpenCOTSClient().
@@ -301,10 +340,10 @@ _X11TransConnectDisplay (display_name, fullnamep, dpynump, screenp,
if (olen > sizeof addrbuf) address = Xmalloc (olen);
}
- sprintf(address,"%s/%s:%s",
+ sprintf(address,"%s/%s:%d",
pprotocol ? pprotocol : "",
phostname ? phostname : "",
- pdpynum );
+ idisplay );
/*
* Make the connection, also need to get the auth address info for
@@ -425,16 +464,15 @@ _X11TransConnectDisplay (display_name, fullnamep, dpynump, screenp,
*
*/
-int _XConnectDisplay (display_name, fullnamep, dpynump, screenp,
- auth_namep, auth_namelenp, auth_datap, auth_datalenp)
- char *display_name;
- char **fullnamep; /* RETURN */
- int *dpynump; /* RETURN */
- int *screenp; /* RETURN */
- char **auth_namep; /* RETURN */
- int *auth_namelenp; /* RETURN */
- char **auth_datap; /* RETURN */
- int *auth_datalenp; /* RETURN */
+int _XConnectDisplay (
+ char *display_name,
+ char **fullnamep, /* RETURN */
+ int *dpynump, /* RETURN */
+ int *screenp, /* RETURN */
+ char **auth_namep, /* RETURN */
+ int *auth_namelenp, /* RETURN */
+ char **auth_datap, /* RETURN */
+ int *auth_datalenp) /* RETURN */
{
XtransConnInfo trans_conn;
@@ -475,8 +513,6 @@ XtransConnInfo trans_conn;
-static int padlength[4] = {0, 3, 2, 1}; /* make sure auth is multiple of 4 */
-
Bool
_XSendClientPrefix (dpy, client, auth_proto, auth_string, prefix)
Display *dpy;
@@ -486,7 +522,7 @@ _XSendClientPrefix (dpy, client, auth_proto, auth_string, prefix)
{
int auth_length = client->nbytesAuthProto;
int auth_strlen = client->nbytesAuthString;
- char padbuf[3]; /* for padding to 4x bytes */
+ static char padbuf[3]; /* for padding to 4x bytes */
int pad;
struct iovec iovarray[5], *iov = iovarray;
int niov = 0;
@@ -502,12 +538,12 @@ _XSendClientPrefix (dpy, client, auth_proto, auth_string, prefix)
*/
if (auth_length > 0) {
add_to_iov (auth_proto, auth_length);
- pad = padlength [auth_length & 3];
+ pad = -auth_length & 3; /* pad auth_length to a multiple of 4 */
if (pad) add_to_iov (padbuf, pad);
}
if (auth_strlen > 0) {
add_to_iov (auth_string, auth_strlen);
- pad = padlength [auth_strlen & 3];
+ pad = -auth_strlen & 3; /* pad auth_strlen to a multiple of 4 */
if (pad) add_to_iov (padbuf, pad);
}
@@ -544,6 +580,13 @@ _XSendClientPrefix (dpy, client, auth_proto, auth_string, prefix)
#endif
#ifdef SECURE_RPC
+#if defined(sun) && defined(SVR4) /* && ????? */
+/*
+ * I'm aware this is backwards, but #define'ing PORTMAP, as suggested in the
+ * man pages, doesn't work either.
+ */
+#define authdes_seccreate authdes_create
+#endif
#include <rpc/rpc.h>
#ifdef ultrix
#include <time.h>
@@ -552,14 +595,9 @@ _XSendClientPrefix (dpy, client, auth_proto, auth_string, prefix)
#endif
#ifdef HASXDMAUTH
-#ifdef X_NOT_STDC_ENV
-#define Time_t long
-extern Time_t time ();
-#else
#include <time.h>
#define Time_t time_t
#endif
-#endif
/*
* First, a routine for setting authorization data
@@ -588,7 +626,7 @@ static char *default_xauth_names[] = {
"MIT-MAGIC-COOKIE-1"
};
-static int default_xauth_lengths[] = {
+static _Xconst int default_xauth_lengths[] = {
#ifdef K5AUTH
14, /* strlen ("MIT-KERBEROS-5") */
#endif
@@ -604,7 +642,7 @@ static int default_xauth_lengths[] = {
#define NUM_DEFAULT_AUTH (sizeof (default_xauth_names) / sizeof (default_xauth_names[0]))
static char **xauth_names = default_xauth_names;
-static int *xauth_lengths = default_xauth_lengths;
+static _Xconst int *xauth_lengths = default_xauth_lengths;
static int xauth_names_length = NUM_DEFAULT_AUTH;
@@ -679,7 +717,11 @@ auth_ezencode(servername, window, cred_out, len)
AUTH *a;
XDR xdr;
+#if defined(SVR4) && defined(sun)
+ a = authdes_seccreate(servername, window, NULL, NULL);
+#else
a = (AUTH *)authdes_create(servername, window, NULL, NULL);
+#endif
if (a == (AUTH *)NULL) {
perror("auth_create");
return 0;
@@ -953,17 +995,16 @@ static int k5_clientauth(dpy, sprefix)
#endif /* K5AUTH */
static void
-GetAuthorization(trans_conn, family, saddr, saddrlen, idisplay,
- auth_namep, auth_namelenp, auth_datap, auth_datalenp)
- XtransConnInfo trans_conn;
- int family;
- int saddrlen;
- int idisplay;
- char *saddr;
- char **auth_namep; /* RETURN */
- int *auth_namelenp; /* RETURN */
- char **auth_datap; /* RETURN */
- int *auth_datalenp; /* RETURN */
+GetAuthorization(
+ XtransConnInfo trans_conn,
+ int family,
+ char *saddr,
+ int saddrlen,
+ int idisplay,
+ char **auth_namep, /* RETURN */
+ int *auth_namelenp, /* RETURN */
+ char **auth_datap, /* RETURN */
+ int *auth_datalenp) /* RETURN */
{
#ifdef SECURE_RPC
char rpc_cred[MAX_AUTH_BYTES];
@@ -1042,6 +1083,32 @@ GetAuthorization(trans_conn, family, saddr, saddrlen, idisplay,
break;
}
#endif /* AF_INET */
+#if defined(IPv6) && defined(AF_INET6)
+ case AF_INET6:
+ /* XXX This should probably never happen */
+ {
+ unsigned char ipv4mappedprefix[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff };
+
+ /* In the case of v4 mapped addresses send the v4
+ part of the address - addr is already in network byte order */
+ if (memcmp(addr+8, ipv4mappedprefix, 12) == 0) {
+ for (i = 20 ; i < 24; i++)
+ xdmcp_data[j++] = ((char *)addr)[i];
+
+ /* Port number */
+ for (i=2; i<4; i++)
+ xdmcp_data[j++] = ((char *)addr)[i];
+ break;
+ } else {
+ /* Fake data to keep the data aligned. Otherwise the
+ the server will bail about incorrect timing data */
+ for (i = 0; i < 8; i++) {
+ xdmcp_data[j++] = 0;
+ }
+ }
+ }
+#endif /* AF_INET6 */
#ifdef AF_UNIX
case AF_UNIX:
{
diff --git a/src/Context.c b/src/Context.c
index f924c258..fef578ff 100644
--- a/src/Context.c
+++ b/src/Context.c
@@ -50,6 +50,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/lib/X11/Context.c,v 1.5 2001/12/14 19:53:58 dawes Exp $ */
/* This module implements a simple sparse array.
@@ -100,8 +101,7 @@ static DB NullDB = (DB)0;
/* Resize the given db */
-static void ResizeTable(db)
- register DB db;
+static void ResizeTable(DB db)
{
TableEntry *otable;
register TableEntry entry, next, *pold, *head;
@@ -128,8 +128,7 @@ static void ResizeTable(db)
Xfree((char *) otable);
}
-static void _XFreeContextDB(display)
- Display *display;
+static void _XFreeContextDB(Display *display)
{
register DB db;
register int i;
@@ -156,19 +155,11 @@ static void _XFreeContextDB(display)
Possible errors are Out-of-memory.
*/
-#if NeedFunctionPrototypes
int XSaveContext(
Display *display,
register XID rid,
register XContext context,
_Xconst char* data)
-#else
-int XSaveContext(display, rid, context, data)
- Display *display;
- register XID rid;
- register XContext context;
- XPointer data;
-#endif
{
DB *pdb;
register DB db;
diff --git a/src/ConvSel.c b/src/ConvSel.c
index b7148a98..24d4f83b 100644
--- a/src/ConvSel.c
+++ b/src/ConvSel.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/ConvSel.c,v 1.3 2001/01/17 19:41:33 dawes Exp $ */
#include "Xlibint.h"
+int
XConvertSelection(dpy, selection, target, property, requestor, time)
register Display *dpy;
Atom selection, target;
diff --git a/src/CopyArea.c b/src/CopyArea.c
index 5a4c42ba..a2a92a8d 100644
--- a/src/CopyArea.c
+++ b/src/CopyArea.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/CopyArea.c,v 1.3 2001/01/17 19:41:33 dawes Exp $ */
#include "Xlibint.h"
+int
XCopyArea(dpy, src_drawable, dst_drawable, gc,
src_x, src_y, width, height,
dst_x, dst_y)
diff --git a/src/CopyCmap.c b/src/CopyCmap.c
index a6873765..9c7abcec 100644
--- a/src/CopyCmap.c
+++ b/src/CopyCmap.c
@@ -24,8 +24,15 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/CopyCmap.c,v 1.3 2001/01/17 19:41:33 dawes Exp $ */
#include "Xlibint.h"
+#include "Xcmsint.h"
+
+/* cmsCmap.c */
+extern XcmsCmapRec * _XcmsCopyCmapRecAndFree(Display *dpy,
+ Colormap src_cmap,
+ Colormap copy_cmap);
Colormap XCopyColormapAndFree(dpy, src_cmap)
register Display *dpy;
diff --git a/src/CopyGC.c b/src/CopyGC.c
index ec228794..121bf5b8 100644
--- a/src/CopyGC.c
+++ b/src/CopyGC.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/CopyGC.c,v 1.3 2001/01/17 19:41:33 dawes Exp $ */
#include "Xlibint.h"
+int
XCopyGC (dpy, srcGC, mask, destGC)
register Display *dpy;
unsigned long mask; /* which ones to set initially */
diff --git a/src/CopyPlane.c b/src/CopyPlane.c
index 1df2b14a..7adae39f 100644
--- a/src/CopyPlane.c
+++ b/src/CopyPlane.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/CopyPlane.c,v 1.3 2001/01/17 19:41:33 dawes Exp $ */
#include "Xlibint.h"
+int
XCopyPlane(dpy, src_drawable, dst_drawable, gc,
src_x, src_y, width, height,
dst_x, dst_y, bit_plane)
diff --git a/src/Cr.h b/src/Cr.h
index 5ef13bf3..10181717 100644
--- a/src/Cr.h
+++ b/src/Cr.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/Cr.h,v 1.1 2003/04/13 19:22:14 dawes Exp $ */
+/* $XFree86$ */
#ifndef _CR_H_
#define _CR_H_
diff --git a/src/CrBFData.c b/src/CrBFData.c
index 70060a96..6e9aad1b 100644
--- a/src/CrBFData.c
+++ b/src/CrBFData.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86$ */
#include "Xlib.h"
@@ -44,20 +45,12 @@ in this Software without prior written authorization from The Open Group.
* xoffset=0
* no extra bytes per line
*/
-#if NeedFunctionPrototypes
Pixmap XCreateBitmapFromData(
Display *display,
Drawable d,
_Xconst char *data,
unsigned int width,
unsigned int height)
-#else
-Pixmap XCreateBitmapFromData(display, d, data, width, height)
- Display *display;
- Drawable d;
- char *data;
- unsigned int width, height;
-#endif
{
XImage ximage;
GC gc;
diff --git a/src/CrCmap.c b/src/CrCmap.c
index 3c1878df..22a2cffe 100644
--- a/src/CrCmap.c
+++ b/src/CrCmap.c
@@ -24,8 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/CrCmap.c,v 1.4 2001/12/14 19:53:59 dawes Exp $ */
#include "Xlibint.h"
+#include "Xcmsint.h"
+
Colormap XCreateColormap(dpy, w, visual, alloc)
register Display *dpy;
diff --git a/src/CrCursor.c b/src/CrCursor.c
index 93c7a006..c3ce84b3 100644
--- a/src/CrCursor.c
+++ b/src/CrCursor.c
@@ -24,9 +24,21 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86$ */
#include "Xlibint.h"
+#ifdef USE_DYNAMIC_XCURSOR
+Cursor
+_XTryShapeBitmapCursor (Display *dpy,
+ Pixmap source,
+ Pixmap mask,
+ XColor *foreground,
+ XColor *background,
+ unsigned int x,
+ unsigned int y);
+#endif
+
Cursor XCreatePixmapCursor(dpy, source, mask, foreground, background, x, y)
register Display *dpy;
Pixmap source, mask;
@@ -37,6 +49,12 @@ Cursor XCreatePixmapCursor(dpy, source, mask, foreground, background, x, y)
register xCreateCursorReq *req;
Cursor cid;
+#ifdef USE_DYNAMIC_XCURSOR
+ cid = _XTryShapeBitmapCursor (dpy, source, mask,
+ foreground, background, x, y);
+ if (cid)
+ return cid;
+#endif
LockDisplay(dpy);
GetReq(CreateCursor, req);
req->cid = cid = XAllocID(dpy);
diff --git a/src/CrGC.c b/src/CrGC.c
index 969f6d88..b075d96b 100644
--- a/src/CrGC.c
+++ b/src/CrGC.c
@@ -24,16 +24,12 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/CrGC.c,v 3.6 2001/12/14 19:53:59 dawes Exp $ */
#include "Xlibint.h"
+#include "Cr.h"
-#ifdef __STDC__
-#define Const const
-#else
-#define Const /**/
-#endif
-
-static XGCValues Const initial_GC = {
+static XGCValues const initial_GC = {
GXcopy, /* function */
AllPlanes, /* plane_mask */
0L, /* foreground */
@@ -59,7 +55,10 @@ static XGCValues Const initial_GC = {
4 /* dashes (list [4,4]) */
};
-static void _XGenerateGCList();
+static void _XGenerateGCList(
+ register Display *dpy,
+ GC gc,
+ xReq *req);
GC XCreateGC (dpy, d, valuemask, values)
register Display *dpy;
@@ -107,10 +106,10 @@ GC XCreateGC (dpy, d, valuemask, values)
*/
static void
-_XGenerateGCList (dpy, gc, req)
- register Display *dpy;
- xReq *req;
- GC gc;
+_XGenerateGCList (
+ register Display *dpy,
+ GC gc,
+ xReq *req)
{
unsigned long values[32];
register unsigned long *value = values;
@@ -160,6 +159,7 @@ _XGenerateGCList (dpy, gc, req)
}
+int
_XUpdateGCCache (gc, mask, attr)
register unsigned long mask;
register XGCValues *attr;
diff --git a/src/CrGlCur.c b/src/CrGlCur.c
index d6fc4039..4fc63112 100644
--- a/src/CrGlCur.c
+++ b/src/CrGlCur.c
@@ -24,21 +24,217 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/CrGlCur.c,v 1.7 2003/04/13 19:22:15 dawes Exp $ */
#include "Xlibint.h"
+#ifdef USE_DYNAMIC_XCURSOR
+
+#ifdef __UNIXOS2__
+#define RTLD_LAZY 1
+#define LIBXCURSOR "Xcursor.dll"
+#endif
+#include <stdio.h>
+#include <string.h>
+#if defined(hpux)
+#include <dl.h>
+#else
+#include <dlfcn.h>
+#endif
+#include "Cr.h"
+
+#if defined(hpux)
+typedef shl_dt XModuleType;
+#else
+typedef void *XModuleType;
+#endif
+
+#ifndef LIBXCURSOR
+#define LIBXCURSOR "libXcursor.so"
+#endif
+
+static char libraryName[] = LIBXCURSOR;
+
+static XModuleType
+open_library (void)
+{
+ char *library = libraryName;
+ char *dot;
+ XModuleType module;
+ for (;;)
+ {
+#if defined(hpux)
+ module = shl_load(library, BIND_DEFERRED, 0L);
+#else
+ module = dlopen(library, RTLD_LAZY);
+#endif
+ if (module)
+ return module;
+ dot = strrchr (library, '.');
+ if (!dot)
+ break;
+ *dot = '\0';
+ }
+ return 0;
+}
+
+static void *
+fetch_symbol (XModuleType module, char *under_symbol)
+{
+ void *result = NULL;
+ char *symbol = under_symbol + 1;
+#if defined(hpux)
+ int getsyms_cnt, i;
+ struct shl_symbol *symbols;
+
+ getsyms_cnt = shl_getsymbols(module, TYPE_PROCEDURE,
+ EXPORT_SYMBOLS, malloc, &symbols);
+
+ for(i=0; i<getsyms_cnt; i++) {
+ if(!strcmp(symbols[i].name, symbol)) {
+ result = symbols[i].value;
+ break;
+ }
+ }
+
+ if(getsyms_cnt > 0) {
+ free(symbols);
+ }
+#else
+ result = dlsym (module, symbol);
+ if (!result)
+ result = dlsym (module, under_symbol);
+#endif
+ return result;
+}
+
+typedef void (*NoticeCreateBitmapFunc) (Display *dpy,
+ Pixmap pid,
+ unsigned int width,
+ unsigned int height);
+
+typedef void (*NoticePutBitmapFunc) (Display *dpy,
+ Drawable draw,
+ XImage *image);
+
+typedef Cursor (*TryShapeBitmapCursorFunc) (Display *dpy,
+ Pixmap source,
+ Pixmap mask,
+ XColor *foreground,
+ XColor *background,
+ unsigned int x,
+ unsigned int y);
+
+typedef Cursor (*TryShapeCursorFunc) (Display *dpy,
+ Font source_font,
+ Font mask_font,
+ unsigned int source_char,
+ unsigned int mask_char,
+ XColor _Xconst *foreground,
+ XColor _Xconst *background);
+
+static XModuleType _XcursorModule;
+static Bool _XcursorModuleTried;
+
+#define GetFunc(type,name,ret) {\
+ static Bool been_here; \
+ static type staticFunc; \
+ \
+ _XLockMutex (_Xglobal_lock); \
+ if (!been_here) \
+ { \
+ been_here = True; \
+ if (!_XcursorModuleTried) \
+ { \
+ _XcursorModuleTried = True; \
+ _XcursorModule = open_library (); \
+ } \
+ if (_XcursorModule) \
+ staticFunc = (type) fetch_symbol (_XcursorModule, "_" name); \
+ } \
+ ret = staticFunc; \
+ _XUnlockMutex (_Xglobal_lock); \
+}
+
+static Cursor
+_XTryShapeCursor (Display *dpy,
+ Font source_font,
+ Font mask_font,
+ unsigned int source_char,
+ unsigned int mask_char,
+ XColor _Xconst *foreground,
+ XColor _Xconst *background)
+{
+ TryShapeCursorFunc func;
+
+ GetFunc (TryShapeCursorFunc, "XcursorTryShapeCursor", func);
+ if (func)
+ return (*func) (dpy, source_font, mask_font, source_char, mask_char,
+ foreground, background);
+ return None;
+}
+
+void
+_XNoticeCreateBitmap (Display *dpy,
+ Pixmap pid,
+ unsigned int width,
+ unsigned int height)
+{
+ NoticeCreateBitmapFunc func;
+
+ GetFunc (NoticeCreateBitmapFunc, "XcursorNoticeCreateBitmap", func);
+ if (func)
+ (*func) (dpy, pid, width, height);
+}
+
+void
+_XNoticePutBitmap (Display *dpy,
+ Drawable draw,
+ XImage *image)
+{
+ NoticePutBitmapFunc func;
+
+ GetFunc (NoticePutBitmapFunc, "XcursorNoticePutBitmap", func);
+ if (func)
+ (*func) (dpy, draw, image);
+}
+
+Cursor
+_XTryShapeBitmapCursor (Display *dpy,
+ Pixmap source,
+ Pixmap mask,
+ XColor *foreground,
+ XColor *background,
+ unsigned int x,
+ unsigned int y)
+{
+ TryShapeBitmapCursorFunc func;
+
+ GetFunc (TryShapeBitmapCursorFunc, "XcursorTryShapeBitmapCursor", func);
+ if (func)
+ return (*func) (dpy, source, mask, foreground, background, x, y);
+ return None;
+}
+#endif
+
Cursor XCreateGlyphCursor(dpy, source_font, mask_font,
source_char, mask_char,
foreground, background)
register Display *dpy;
Font source_font, mask_font;
unsigned int source_char, mask_char;
- XColor *foreground, *background;
+ XColor _Xconst *foreground, *background;
{
Cursor cid;
register xCreateGlyphCursorReq *req;
+#ifdef USE_DYNAMIC_XCURSOR
+ cid = _XTryShapeCursor (dpy, source_font, mask_font,
+ source_char, mask_char, foreground, background);
+ if (cid)
+ return cid;
+#endif
LockDisplay(dpy);
GetReq(CreateGlyphCursor, req);
cid = req->cid = XAllocID(dpy);
diff --git a/src/CrPixmap.c b/src/CrPixmap.c
index 2505f48a..6b4069c1 100644
--- a/src/CrPixmap.c
+++ b/src/CrPixmap.c
@@ -24,9 +24,18 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86$ */
#include "Xlibint.h"
+#ifdef USE_DYNAMIC_XCURSOR
+void
+_XNoticeCreateBitmap (Display *dpy,
+ Pixmap pid,
+ unsigned int width,
+ unsigned int height);
+#endif
+
Pixmap XCreatePixmap (dpy, d, width, height, depth)
register Display *dpy;
Drawable d;
@@ -44,6 +53,10 @@ Pixmap XCreatePixmap (dpy, d, width, height, depth)
pid = req->pid = XAllocID(dpy);
UnlockDisplay(dpy);
SyncHandle();
+#ifdef USE_DYNAMIC_XCURSOR
+ if (depth == 1)
+ _XNoticeCreateBitmap (dpy, pid, width, height);
+#endif
return (pid);
}
diff --git a/src/Cursor.c b/src/Cursor.c
index 55ff456c..82242eeb 100644
--- a/src/Cursor.c
+++ b/src/Cursor.c
@@ -24,10 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/Cursor.c,v 1.3 2001/01/17 19:41:34 dawes Exp $ */
#include "Xlibint.h"
-static XColor foreground = { 0, 0, 0, 0 }; /* black */
-static XColor background = { 0, 65535, 65535, 65535 }; /* white */
+static XColor _Xconst foreground = { 0, 0, 0, 0 }; /* black */
+static XColor _Xconst background = { 0, 65535, 65535, 65535 }; /* white */
Cursor XCreateFontCursor(dpy, which)
Display *dpy;
diff --git a/src/DefCursor.c b/src/DefCursor.c
index d4eadea2..f8e479ad 100644
--- a/src/DefCursor.c
+++ b/src/DefCursor.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/DefCursor.c,v 1.3 2001/01/17 19:41:34 dawes Exp $ */
#include "Xlibint.h"
+int
XDefineCursor (dpy, w, cursor)
register Display *dpy;
Window w;
diff --git a/src/DelProp.c b/src/DelProp.c
index 11bf3a3d..4b2171aa 100644
--- a/src/DelProp.c
+++ b/src/DelProp.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/DelProp.c,v 1.3 2001/01/17 19:41:34 dawes Exp $ */
#include "Xlibint.h"
+int
XDeleteProperty(dpy, window, property)
register Display *dpy;
Window window;
diff --git a/src/DestSubs.c b/src/DestSubs.c
index 98aadd6b..465fc05d 100644
--- a/src/DestSubs.c
+++ b/src/DestSubs.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/DestSubs.c,v 1.3 2001/01/17 19:41:34 dawes Exp $ */
#include "Xlibint.h"
+int
XDestroySubwindows(dpy, win)
register Display *dpy;
Window win;
diff --git a/src/DestWind.c b/src/DestWind.c
index 319e4ec3..c218bc08 100644
--- a/src/DestWind.c
+++ b/src/DestWind.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/DestWind.c,v 1.3 2001/01/17 19:41:34 dawes Exp $ */
#include "Xlibint.h"
+int
XDestroyWindow (dpy, w)
register Display *dpy;
Window w;
diff --git a/src/DisName.c b/src/DisName.c
index 17ebf356..efae8f31 100644
--- a/src/DisName.c
+++ b/src/DisName.c
@@ -27,6 +27,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86$ */
/* XDisplayName.c */
/*
@@ -46,16 +47,16 @@ from The Open Group.
/* Written at Waterloo - JMSellens */
#include <stdio.h>
-
-extern char *getenv();
+#include <stdlib.h>
+#include "Xlib.h"
char *
-XDisplayName( display )
- char *display;
+XDisplayName(
+ _Xconst char *display)
{
char *d;
if ( display != (char *)NULL && *display != '\0' )
- return( display );
+ return( (char *)display );
if ( (d = getenv( "DISPLAY" )) != (char *)NULL )
return( d );
return( "" );
diff --git a/src/DrArc.c b/src/DrArc.c
index 466e7e15..8b416dd3 100644
--- a/src/DrArc.c
+++ b/src/DrArc.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/DrArc.c,v 1.3 2001/01/17 19:41:34 dawes Exp $ */
/* Note to future maintainers: XDrawArc does NOT batch successive PolyArc
requests into a single request like XDrawLine, XDrawPoint, etc.
@@ -33,6 +34,7 @@ in this Software without prior written authorization from The Open Group.
#include "Xlibint.h"
+int
XDrawArc(dpy, d, gc, x, y, width, height, angle1, angle2)
register Display *dpy;
Drawable d;
diff --git a/src/DrArcs.c b/src/DrArcs.c
index 9f8ef96a..f798b748 100644
--- a/src/DrArcs.c
+++ b/src/DrArcs.c
@@ -24,11 +24,13 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/DrArcs.c,v 1.3 2001/01/17 19:41:34 dawes Exp $ */
#include "Xlibint.h"
#define arc_scale (SIZEOF(xArc) / 4)
+int
XDrawArcs(dpy, d, gc, arcs, n_arcs)
register Display *dpy;
Drawable d;
diff --git a/src/DrLine.c b/src/DrLine.c
index 6b17fbe5..8d9dca21 100644
--- a/src/DrLine.c
+++ b/src/DrLine.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/DrLine.c,v 1.3 2001/01/17 19:41:34 dawes Exp $ */
#include "Xlibint.h"
@@ -32,6 +33,7 @@ in this Software without prior written authorization from The Open Group.
#define wsize (SIZEOF(xPolySegmentReq) + WLNSPERBATCH * SIZEOF(xSegment))
#define zsize (SIZEOF(xPolySegmentReq) + ZLNSPERBATCH * SIZEOF(xSegment))
+int
XDrawLine (dpy, d, gc, x1, y1, x2, y2)
register Display *dpy;
Drawable d;
diff --git a/src/DrLines.c b/src/DrLines.c
index 05b0d5d7..198aae5c 100644
--- a/src/DrLines.c
+++ b/src/DrLines.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/DrLines.c,v 1.3 2001/01/17 19:41:34 dawes Exp $ */
#include "Xlibint.h"
+int
XDrawLines (dpy, d, gc, points, npoints, mode)
register Display *dpy;
Drawable d;
diff --git a/src/DrPoint.c b/src/DrPoint.c
index 390e9dad..c07942e3 100644
--- a/src/DrPoint.c
+++ b/src/DrPoint.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/DrPoint.c,v 1.3 2001/01/17 19:41:34 dawes Exp $ */
#include "Xlibint.h"
@@ -31,6 +32,7 @@ in this Software without prior written authorization from The Open Group.
#define size (SIZEOF(xPolyPointReq) + PTSPERBATCH * SIZEOF(xPoint))
+int
XDrawPoint(dpy, d, gc, x, y)
register Display *dpy;
Drawable d;
diff --git a/src/DrPoints.c b/src/DrPoints.c
index c261be0d..33d3b742 100644
--- a/src/DrPoints.c
+++ b/src/DrPoints.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/DrPoints.c,v 1.3 2001/01/17 19:41:34 dawes Exp $ */
#include "Xlibint.h"
+int
XDrawPoints(dpy, d, gc, points, n_points, mode)
register Display *dpy;
Drawable d;
diff --git a/src/DrRect.c b/src/DrRect.c
index 0c3c48e4..2fa0e466 100644
--- a/src/DrRect.c
+++ b/src/DrRect.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/DrRect.c,v 1.3 2001/01/17 19:41:34 dawes Exp $ */
#include "Xlibint.h"
@@ -32,6 +33,7 @@ in this Software without prior written authorization from The Open Group.
#define wsize (SIZEOF(xPolyRectangleReq) + WRCTSPERBATCH * SIZEOF(xRectangle))
#define zsize (SIZEOF(xPolyRectangleReq) + ZRCTSPERBATCH * SIZEOF(xRectangle))
+int
XDrawRectangle(dpy, d, gc, x, y, width, height)
register Display *dpy;
Drawable d;
diff --git a/src/DrRects.c b/src/DrRects.c
index ac87bd9b..ff674e93 100644
--- a/src/DrRects.c
+++ b/src/DrRects.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/DrRects.c,v 1.3 2001/01/17 19:41:34 dawes Exp $ */
#include "Xlibint.h"
+int
XDrawRectangles(dpy, d, gc, rects, n_rects)
register Display *dpy;
Drawable d;
diff --git a/src/DrSegs.c b/src/DrSegs.c
index 41c4ea4a..dde949da 100644
--- a/src/DrSegs.c
+++ b/src/DrSegs.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/DrSegs.c,v 1.3 2001/01/17 19:41:34 dawes Exp $ */
#include "Xlibint.h"
+int
XDrawSegments (dpy, d, gc, segments, nsegments)
register Display *dpy;
Drawable d;
diff --git a/src/ErrDes.c b/src/ErrDes.c
index a7f82cc7..cd1294a4 100644
--- a/src/ErrDes.c
+++ b/src/ErrDes.c
@@ -48,6 +48,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/lib/X11/ErrDes.c,v 3.11 2003/08/06 14:03:59 eich Exp $ */
#include "Xlibint.h"
#include <X11/Xos.h>
@@ -58,17 +59,11 @@ SOFTWARE.
#define ERRORDB "/usr/lib/X11/XErrorDB"
#endif
-#ifdef __STDC__
-#define Const const
-#else
-#define Const /**/
-#endif
-
/*
* descriptions of errors in Section 4 of Protocol doc (pp. 350-351); more
* verbose descriptions are given in the error database
*/
-static Const char * Const _XErrorList[] = {
+static const char * const _XErrorList[] = {
/* No error */ "no error",
/* BadRequest */ "BadRequest",
/* BadValue */ "BadValue",
@@ -90,6 +85,7 @@ static Const char * Const _XErrorList[] = {
};
+int
XGetErrorText(dpy, code, buffer, nbytes)
register int code;
register Display *dpy;
@@ -125,7 +121,7 @@ XGetErrorText(dpy, code, buffer, nbytes)
return 0;
}
-#if NeedFunctionPrototypes
+int
/*ARGSUSED*/
XGetErrorDatabaseText(
Display *dpy,
@@ -134,15 +130,6 @@ XGetErrorDatabaseText(
_Xconst char *defaultp,
char *buffer,
int nbytes)
-#else
-/*ARGSUSED*/
-XGetErrorDatabaseText(dpy, name, type, defaultp, buffer, nbytes)
- Display *dpy;
- register char *name, *type;
- char *defaultp;
- char *buffer;
- int nbytes;
-#endif
{
static XrmDatabase db = NULL;
@@ -178,11 +165,19 @@ XGetErrorDatabaseText(dpy, name, type, defaultp, buffer, nbytes)
if (db)
{
tlen = strlen (name) + strlen (type) + 2;
- if (tlen <= BUFSIZE) tptr = temp;
- else tptr = Xmalloc (tlen);
- sprintf(tptr, "%s.%s", name, type);
- XrmGetResource(db, tptr, "ErrorType.ErrorNumber", &type_str, &result);
- if (tptr != temp) Xfree (tptr);
+ if (tlen <= BUFSIZE)
+ tptr = temp;
+ else
+ tptr = Xmalloc (tlen);
+ if (tptr) {
+ sprintf(tptr, "%s.%s", name, type);
+ XrmGetResource(db, tptr, "ErrorType.ErrorNumber",
+ &type_str, &result);
+ if (tptr != temp)
+ Xfree (tptr);
+ } else {
+ result.addr = (XPointer) NULL;
+ }
}
else
result.addr = (XPointer)NULL;
diff --git a/src/ErrHndlr.c b/src/ErrHndlr.c
index b7f6418b..941d219c 100644
--- a/src/ErrHndlr.c
+++ b/src/ErrHndlr.c
@@ -24,25 +24,20 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/ErrHndlr.c,v 1.6 2003/04/13 19:22:15 dawes Exp $ */
#include "Xlibint.h"
-extern int _XDefaultError();
-extern int _XDefaultIOError();
/*
* XErrorHandler - This procedure sets the X non-fatal error handler
* (_XErrorFunction) to be the specified routine. If NULL is passed in
* the original error handler is restored.
*/
-#if NeedFunctionPrototypes
-XErrorHandler XSetErrorHandler(XErrorHandler handler)
-#else
-XErrorHandler XSetErrorHandler(handler)
- register XErrorHandler handler;
-#endif
+XErrorHandler
+XSetErrorHandler(XErrorHandler handler)
{
- int (*oldhandler)();
+ int (*oldhandler)(Display *dpy, XErrorEvent *event);
_XLockMutex(_Xglobal_lock);
oldhandler = _XErrorFunction;
@@ -67,15 +62,10 @@ XErrorHandler XSetErrorHandler(handler)
* the original error handler is restored.
*/
-extern int _XIOError();
-#if NeedFunctionPrototypes
-XIOErrorHandler XSetIOErrorHandler(XIOErrorHandler handler)
-#else
-XIOErrorHandler XSetIOErrorHandler(handler)
- register XIOErrorHandler handler;
-#endif
+XIOErrorHandler
+XSetIOErrorHandler(XIOErrorHandler handler)
{
- int (*oldhandler)();
+ int (*oldhandler)(Display *dpy);
_XLockMutex(_Xglobal_lock);
oldhandler = _XIOErrorFunction;
diff --git a/src/EvToWire.c b/src/EvToWire.c
index 361c4e2c..2a84c322 100644
--- a/src/EvToWire.c
+++ b/src/EvToWire.c
@@ -27,6 +27,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/lib/X11/EvToWire.c,v 1.4 2001/08/18 02:41:28 dawes Exp $ */
/*
* XEvToWire.c - Internal support routines for the C subroutine
@@ -41,10 +42,10 @@ from The Open Group.
* reformat a wire event into an XEvent structure of the right type.
*/
Status
-_XEventToWire(dpy, re, event)
-register Display *dpy; /* pointer to display structure */
-register XEvent *re; /* pointer to where event should be reformatted */
-register xEvent *event; /* wire protocol event */
+_XEventToWire(
+register Display *dpy, /* pointer to display structure */
+register XEvent *re, /* pointer to where event should be reformatted */
+register xEvent *event) /* wire protocol event */
{
switch (event->u.u.type = re->type) {
case KeyPress:
diff --git a/src/FSSaver.c b/src/FSSaver.c
index 57cde1aa..0699257a 100644
--- a/src/FSSaver.c
+++ b/src/FSSaver.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/FSSaver.c,v 1.3 2001/01/17 19:41:35 dawes Exp $ */
#include "Xlibint.h"
+int
XActivateScreenSaver(dpy)
register Display *dpy;
@@ -35,6 +37,7 @@ XActivateScreenSaver(dpy)
return 1;
}
+int
XResetScreenSaver(dpy)
register Display *dpy;
@@ -43,6 +46,7 @@ XResetScreenSaver(dpy)
return 1;
}
+int
XForceScreenSaver(dpy, mode)
register Display *dpy;
int mode;
diff --git a/src/FSWrap.c b/src/FSWrap.c
index 14adca02..2bdfa303 100644
--- a/src/FSWrap.c
+++ b/src/FSWrap.c
@@ -56,6 +56,8 @@ from The Open Group.
*/
+/* $XFree86: xc/lib/X11/FSWrap.c,v 1.8 2003/08/22 19:27:24 eich Exp $ */
+
#include "Xlibint.h"
#include "Xlcint.h"
#include <ctype.h>
@@ -65,13 +67,13 @@ from The Open Group.
#define XMAXLIST 256
char **
-_XParseBaseFontNameList(str, num)
- char *str;
- int *num;
+_XParseBaseFontNameList(
+ char *str,
+ int *num)
{
char *plist[XMAXLIST];
char **list;
- char *ptr;
+ char *ptr, *psave;
*num = 0;
if (!str || !*str) {
@@ -87,6 +89,7 @@ _XParseBaseFontNameList(str, num)
}
strcpy(ptr, str);
+ psave = ptr;
/* somebody who specifies more than XMAXLIST basefontnames will lose */
while (*num < (sizeof plist / sizeof plist[0])) {
char *back;
@@ -110,7 +113,7 @@ _XParseBaseFontNameList(str, num)
break;
}
if (!(list = (char **) Xmalloc((unsigned)sizeof(char *) * (*num + 1)))) {
- Xfree(ptr);
+ Xfree(psave);
return (char **)NULL;
}
memcpy((char *)list, (char *)plist, sizeof(char *) * (*num));
@@ -120,9 +123,9 @@ _XParseBaseFontNameList(str, num)
}
static char **
-copy_string_list(string_list, list_count)
- char **string_list;
- int list_count;
+copy_string_list(
+ char **string_list,
+ int list_count)
{
char **string_list_ret, **list_src, **list_dst, *dst;
int length, count;
@@ -157,7 +160,6 @@ copy_string_list(string_list, list_count)
return string_list_ret;
}
-#if NeedFunctionPrototypes
XFontSet
XCreateFontSet (
Display *dpy,
@@ -165,16 +167,6 @@ XCreateFontSet (
char ***missing_charset_list,
int *missing_charset_count,
char **def_string)
-#else
-XFontSet
-XCreateFontSet (dpy, base_font_name_list, missing_charset_list,
- missing_charset_count, def_string)
- Display *dpy;
- char *base_font_name_list;
- char ***missing_charset_list;
- int *missing_charset_count;
- char **def_string;
-#endif
{
XOM om;
XOC oc;
diff --git a/src/FillArc.c b/src/FillArc.c
index 22e41910..3866a891 100644
--- a/src/FillArc.c
+++ b/src/FillArc.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/FillArc.c,v 1.3 2001/01/17 19:41:35 dawes Exp $ */
#include "Xlibint.h"
@@ -31,6 +32,7 @@ in this Software without prior written authorization from The Open Group.
#define size (SIZEOF(xPolyFillArcReq) + FARCSPERBATCH * SIZEOF(xArc))
+int
XFillArc(dpy, d, gc, x, y, width, height, angle1, angle2)
register Display *dpy;
Drawable d;
diff --git a/src/FillArcs.c b/src/FillArcs.c
index 115f25cc..c644f306 100644
--- a/src/FillArcs.c
+++ b/src/FillArcs.c
@@ -24,11 +24,13 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/FillArcs.c,v 1.3 2001/01/17 19:41:35 dawes Exp $ */
#include "Xlibint.h"
#define arc_scale (SIZEOF(xArc) / 4)
+int
XFillArcs(dpy, d, gc, arcs, n_arcs)
register Display *dpy;
Drawable d;
diff --git a/src/FillPoly.c b/src/FillPoly.c
index c8f40c63..a363247f 100644
--- a/src/FillPoly.c
+++ b/src/FillPoly.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/FillPoly.c,v 1.3 2001/01/17 19:41:35 dawes Exp $ */
#include "Xlibint.h"
+int
XFillPolygon(dpy, d, gc, points, n_points, shape, mode)
register Display *dpy;
Drawable d;
diff --git a/src/FillRct.c b/src/FillRct.c
index d2537c7c..79da709f 100644
--- a/src/FillRct.c
+++ b/src/FillRct.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/FillRct.c,v 1.3 2001/01/17 19:41:35 dawes Exp $ */
#include "Xlibint.h"
@@ -31,6 +32,7 @@ in this Software without prior written authorization from The Open Group.
#define size (SIZEOF(xPolyFillRectangleReq) + FRCTSPERBATCH * SIZEOF(xRectangle))
+int
XFillRectangle(dpy, d, gc, x, y, width, height)
register Display *dpy;
Drawable d;
diff --git a/src/FillRcts.c b/src/FillRcts.c
index 4e86fec3..017cd0c3 100644
--- a/src/FillRcts.c
+++ b/src/FillRcts.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/FillRcts.c,v 1.3 2001/01/17 19:41:35 dawes Exp $ */
#include "Xlibint.h"
+int
XFillRectangles(dpy, d, gc, rectangles, n_rects)
register Display *dpy;
Drawable d;
diff --git a/src/FilterEv.c b/src/FilterEv.c
index 2b104839..afc7b444 100644
--- a/src/FilterEv.c
+++ b/src/FilterEv.c
@@ -53,17 +53,13 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/lib/X11/FilterEv.c,v 3.4 2001/07/29 05:01:11 tsi Exp $ */
#define NEED_EVENTS
#include "Xlibint.h"
#include "Xlcint.h"
-#ifdef __STDC__
-#define Const const
-#else
-#define Const /**/
-#endif
-extern long Const _Xevent_to_mask[];
+extern long const _Xevent_to_mask[];
/*
* Look up if there is a specified filter for the event.
diff --git a/src/Flush.c b/src/Flush.c
index fd6b3935..58eb4e6d 100644
--- a/src/Flush.c
+++ b/src/Flush.c
@@ -24,12 +24,14 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/Flush.c,v 1.3 2001/01/17 19:41:35 dawes Exp $ */
#include "Xlibint.h"
/* Flush all buffered output requests. */
/* NOTE: NOT necessary when calling any of the Xlib routines. */
+int
XFlush (dpy)
register Display *dpy;
{
diff --git a/src/Font.c b/src/Font.c
index 2b1eae84..da1937a2 100644
--- a/src/Font.c
+++ b/src/Font.c
@@ -2,6 +2,7 @@
/*
Copyright 1986, 1998 The Open Group
+Copyright (c) 2000 The XFree86 Project, Inc.
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
@@ -15,37 +16,92 @@ all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+X CONSORTIUM OR THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
+Except as contained in this notice, the name of the X Consortium or of the
+XFree86 Project shall not be used in advertising or otherwise to promote the
+sale, use or other dealings in this Software without prior written
+authorization from the X Consortium and the XFree86 Project.
*/
+/* $XFree86: xc/lib/X11/Font.c,v 1.17 2003/04/13 19:22:16 dawes Exp $ */
#define NEED_REPLIES
#include "Xlibint.h"
-static XFontStruct *_XQueryFont();
+#if defined(XF86BIGFONT) && !defined(MUSTCOPY)
+#define USE_XF86BIGFONT
+#endif
+#ifdef USE_XF86BIGFONT
+#include <sys/types.h>
+#ifdef HAS_SHM
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <X11/extensions/xf86bigfstr.h>
+#endif
+
+#include "Xlcint.h"
+#include "XlcPubI.h"
+
+
+static XFontStruct *_XQueryFont(
+ Display* /* dpy */,
+ Font /* fid */,
+ unsigned long /* seq */
+);
+
+#ifdef USE_XF86BIGFONT
+
+/* Private data for this extension. */
+typedef struct {
+ XExtCodes *codes;
+ CARD32 serverSignature;
+ CARD32 serverCapabilities;
+} XF86BigfontCodes;
+
+/* Additional bit masks that can be set in serverCapabilities */
+#define CAP_VerifiedLocal 256
+
+static XF86BigfontCodes *_XF86BigfontCodes(
+ Display* /* dpy */
+);
+
+static XFontStruct *_XF86BigfontQueryFont(
+ Display* /* dpy */,
+ XF86BigfontCodes* /* extcodes */,
+ Font /* fid */,
+ unsigned long /* seq */
+);
+
+void _XF86BigfontFreeFontMetrics(
+ XFontStruct* /* fs */
+);
+
+#endif /* USE_XF86BIGFONT */
+
-#if NeedFunctionPrototypes
XFontStruct *XLoadQueryFont(
register Display *dpy,
_Xconst char *name)
-#else
-XFontStruct *XLoadQueryFont(dpy, name)
- register Display *dpy;
- char *name;
-#endif
{
XFontStruct *font_result;
register long nbytes;
Font fid;
xOpenFontReq *req;
unsigned long seq;
+#ifdef USE_XF86BIGFONT
+ XF86BigfontCodes *extcodes = _XF86BigfontCodes(dpy);
+#endif
+ if (_XF86LoadQueryLocaleFont(dpy, name, &font_result, (Font *)0))
+ return font_result;
LockDisplay(dpy);
GetReq(OpenFont, req);
seq = dpy->request;
@@ -53,12 +109,44 @@ XFontStruct *XLoadQueryFont(dpy, name)
req->fid = fid = XAllocID(dpy);
req->length += (nbytes+3)>>2;
Data (dpy, name, nbytes);
- font_result = _XQueryFont(dpy, fid, seq);
+ font_result = NULL;
+#ifdef USE_XF86BIGFONT
+ if (extcodes) {
+ font_result = _XF86BigfontQueryFont(dpy, extcodes, fid, seq);
+ seq = 0;
+ }
+#endif
+ if (!font_result)
+ font_result = _XQueryFont(dpy, fid, seq);
UnlockDisplay(dpy);
SyncHandle();
return font_result;
}
+XFontStruct *XQueryFont (dpy, fid)
+ register Display *dpy;
+ Font fid;
+{
+ XFontStruct *font_result;
+#ifdef USE_XF86BIGFONT
+ XF86BigfontCodes *extcodes = _XF86BigfontCodes(dpy);
+#endif
+
+ LockDisplay(dpy);
+ font_result = NULL;
+#ifdef USE_XF86BIGFONT
+ if (extcodes) {
+ font_result = _XF86BigfontQueryFont(dpy, extcodes, fid, 0L);
+ }
+#endif
+ if (!font_result)
+ font_result = _XQueryFont(dpy, fid, 0L);
+ UnlockDisplay(dpy);
+ SyncHandle();
+ return font_result;
+}
+
+int
XFreeFont(dpy, fs)
register Display *dpy;
XFontStruct *fs;
@@ -73,15 +161,21 @@ XFreeFont(dpy, fs)
GetResReq (CloseFont, fs->fid, req);
UnlockDisplay(dpy);
SyncHandle();
+ if (fs->per_char) {
+#ifdef USE_XF86BIGFONT
+ _XF86BigfontFreeFontMetrics(fs);
+#else
+ Xfree ((char *) fs->per_char);
+#endif
+ }
_XFreeExtData(fs->ext_data);
- if (fs->per_char)
- Xfree ((char *) fs->per_char);
if (fs->properties)
- Xfree ((char *) fs->properties);
+ Xfree ((char *) fs->properties);
Xfree ((char *) fs);
return 1;
}
+
static XFontStruct *
_XQueryFont (dpy, fid, seq)
register Display *dpy;
@@ -176,7 +270,7 @@ _XQueryFont (dpy, fid, seq)
(nbytes + reply.nCharInfos * SIZEOF(xCharInfo)));
return (XFontStruct *)NULL;
}
- _XRead32 (dpy, (char *)fs->properties, nbytes);
+ _XRead32 (dpy, (long *)fs->properties, nbytes);
}
/*
* If no characters in font, then it is a bad font, but
@@ -223,19 +317,415 @@ _XQueryFont (dpy, fid, seq)
return fs;
}
+#ifdef USE_XF86BIGFONT
-XFontStruct *XQueryFont (dpy, fid)
+/* Magic cookie for finding the right XExtData structure on the display's
+ extension list. */
+static int XF86BigfontNumber = 1040697125;
+
+static int
+_XF86BigfontFreeCodes (
+ XExtData *extension)
+{
+ /* Don't Xfree(extension->private_data) because it is on the same malloc
+ chunk as extension. */
+ /* Don't Xfree(extension->private_data->codes) because this is shared with
+ the display's ext_procs list. */
+ return 0;
+}
+
+static XF86BigfontCodes *
+_XF86BigfontCodes (
+ register Display *dpy)
+{
+ XEDataObject dpy_union;
+ XExtData *pData;
+ XF86BigfontCodes *pCodes;
+ char *envval;
+
+ dpy_union.display = dpy;
+
+ /* If the server is known to support the XF86Bigfont extension,
+ * return the extension codes. If the server is known to not support
+ * the extension, don't bother checking again.
+ */
+ pData = XFindOnExtensionList(XEHeadOfExtensionList(dpy_union),
+ XF86BigfontNumber);
+ if (pData)
+ return (XF86BigfontCodes *) pData->private_data;
+
+ pData = (XExtData *) Xmalloc(sizeof(XExtData) + sizeof(XF86BigfontCodes));
+ if (!pData) {
+ /* Out of luck. */
+ return (XF86BigfontCodes *) NULL;
+ }
+
+ /* See if the server supports the XF86Bigfont extension. */
+ envval = getenv("XF86BIGFONT_DISABLE"); /* Let the user disable it. */
+ if (envval != NULL && envval[0] != '\0')
+ pCodes = NULL;
+ else {
+ XExtCodes *codes = XInitExtension(dpy, XF86BIGFONTNAME);
+ if (codes == NULL)
+ pCodes = NULL;
+ else {
+ pCodes = (XF86BigfontCodes *) &pData[1];
+ pCodes->codes = codes;
+ }
+ }
+ pData->number = XF86BigfontNumber;
+ pData->private_data = (XPointer) pCodes;
+ pData->free_private = _XF86BigfontFreeCodes;
+ XAddToExtensionList(XEHeadOfExtensionList(dpy_union), pData);
+ if (pCodes) {
+ int result;
+
+ /* See if the server supports the XF86BigfontQueryFont request. */
+ xXF86BigfontQueryVersionReply reply;
+ register xXF86BigfontQueryVersionReq *req;
+
+ LockDisplay(dpy);
+
+ GetReq(XF86BigfontQueryVersion, req);
+ req->reqType = pCodes->codes->major_opcode;
+ req->xf86bigfontReqType = X_XF86BigfontQueryVersion;
+
+ result = _XReply (dpy, (xReply *) &reply,
+ (SIZEOF(xXF86BigfontQueryVersionReply) - SIZEOF(xReply)) >> 2,
+ xFalse);
+
+ UnlockDisplay(dpy);
+ SyncHandle();
+
+ if(!result)
+ goto ignore_extension;
+
+ /* No need to provide backward compatibility with version 1.0. It
+ was never widely distributed. */
+ if (!(reply.majorVersion > 1
+ || (reply.majorVersion == 1 && reply.minorVersion >= 1)))
+ goto ignore_extension;
+
+ pCodes->serverSignature = reply.signature;
+ pCodes->serverCapabilities = reply.capabilities;
+ }
+ return pCodes;
+
+ ignore_extension:
+ /* No need to Xfree(pCodes) or Xfree(pCodes->codes), see
+ _XF86BigfontFreeCodes comment. */
+ pCodes = (XF86BigfontCodes *) NULL;
+ pData->private_data = (XPointer) pCodes;
+ return pCodes;
+}
+
+static int
+_XF86BigfontFreeNop (
+ XExtData *extension)
+{
+ return 0;
+}
+
+static XFontStruct *
+_XF86BigfontQueryFont (dpy, extcodes, fid, seq)
register Display *dpy;
+ XF86BigfontCodes *extcodes;
Font fid;
+ unsigned long seq;
{
- XFontStruct *font_result;
+ register XFontStruct *fs;
+ register long nbytes;
+ xXF86BigfontQueryFontReply reply;
+ register xXF86BigfontQueryFontReq *req;
+ register _XExtension *ext;
+ _XAsyncHandler async1;
+ _XAsyncErrorState async1_state;
+ _XAsyncHandler async2;
+ _XAsyncErrorState async2_state;
- LockDisplay(dpy);
- font_result = _XQueryFont(dpy, fid, 0L);
- UnlockDisplay(dpy);
- SyncHandle();
- return font_result;
+ if (seq) {
+ async1_state.min_sequence_number = seq;
+ async1_state.max_sequence_number = seq;
+ async1_state.error_code = BadName;
+ async1_state.major_opcode = X_OpenFont;
+ async1_state.minor_opcode = 0;
+ async1_state.error_count = 0;
+ async1.next = dpy->async_handlers;
+ async1.handler = _XAsyncErrorHandler;
+ async1.data = (XPointer)&async1_state;
+ dpy->async_handlers = &async1;
+ }
+
+ GetReq(XF86BigfontQueryFont, req);
+ req->reqType = extcodes->codes->major_opcode;
+ req->xf86bigfontReqType = X_XF86BigfontQueryFont;
+ req->id = fid;
+ req->flags = (extcodes->serverCapabilities & XF86Bigfont_CAP_LocalShm
+ ? XF86Bigfont_FLAGS_Shm : 0);
+
+ /* The function _XQueryFont benefits from a "magic" error handler for
+ BadFont coming from a X_QueryFont request. (See function _XReply.)
+ We have to establish an error handler ourselves. */
+ async2_state.min_sequence_number = dpy->request;
+ async2_state.max_sequence_number = dpy->request;
+ async2_state.error_code = BadFont;
+ async2_state.major_opcode = extcodes->codes->major_opcode;
+ async2_state.minor_opcode = X_XF86BigfontQueryFont;
+ async2_state.error_count = 0;
+ async2.next = dpy->async_handlers;
+ async2.handler = _XAsyncErrorHandler;
+ async2.data = (XPointer)&async2_state;
+ dpy->async_handlers = &async2;
+
+ if (!_XReply (dpy, (xReply *) &reply,
+ ((SIZEOF(xXF86BigfontQueryFontReply) - SIZEOF(xReply)) >> 2), xFalse)) {
+ DeqAsyncHandler(dpy, &async2);
+ if (seq)
+ DeqAsyncHandler(dpy, &async1);
+ return (XFontStruct *)NULL;
+ }
+ DeqAsyncHandler(dpy, &async2);
+ if (seq)
+ DeqAsyncHandler(dpy, &async1);
+ if (! (fs = (XFontStruct *) Xmalloc (sizeof (XFontStruct)))) {
+ _XEatData(dpy,
+ reply.nFontProps * SIZEOF(xFontProp)
+ + (reply.nCharInfos > 0 && reply.shmid == (CARD32)(-1)
+ ? reply.nUniqCharInfos * SIZEOF(xCharInfo)
+ + (reply.nCharInfos+1)/2 * 2 * sizeof(CARD16)
+ : 0));
+ return (XFontStruct *)NULL;
+ }
+ fs->ext_data = NULL;
+ fs->fid = fid;
+ fs->direction = reply.drawDirection;
+ fs->min_char_or_byte2 = reply.minCharOrByte2;
+ fs->max_char_or_byte2 = reply.maxCharOrByte2;
+ fs->min_byte1 = reply.minByte1;
+ fs->max_byte1 = reply.maxByte1;
+ fs->default_char = reply.defaultChar;
+ fs->all_chars_exist = reply.allCharsExist;
+ fs->ascent = cvtINT16toInt (reply.fontAscent);
+ fs->descent = cvtINT16toInt (reply.fontDescent);
+
+ /* XXX the next two statements won't work if short isn't 16 bits */
+ fs->min_bounds = * (XCharStruct *) &reply.minBounds;
+ fs->max_bounds = * (XCharStruct *) &reply.maxBounds;
+
+ fs->n_properties = reply.nFontProps;
+ /*
+ * if no properties defined for the font, then it is bad
+ * font, but shouldn't try to read nothing.
+ */
+ fs->properties = NULL;
+ if (fs->n_properties > 0) {
+ nbytes = reply.nFontProps * sizeof(XFontProp);
+ fs->properties = (XFontProp *) Xmalloc ((unsigned) nbytes);
+ nbytes = reply.nFontProps * SIZEOF(xFontProp);
+ if (! fs->properties) {
+ Xfree((char *) fs);
+ _XEatData(dpy,
+ nbytes
+ + (reply.nCharInfos > 0 && reply.shmid == (CARD32)(-1)
+ ? reply.nUniqCharInfos * SIZEOF(xCharInfo)
+ + (reply.nCharInfos+1)/2 * 2 * sizeof(CARD16)
+ : 0));
+ return (XFontStruct *)NULL;
+ }
+ _XRead32 (dpy, (long *)fs->properties, nbytes);
+ }
+
+ fs->per_char = NULL;
+ if (reply.nCharInfos > 0) {
+ /* fprintf(stderr, "received font metrics, nCharInfos = %d, nUniqCharInfos = %d, shmid = %d\n", reply.nCharInfos, reply.nUniqCharInfos, reply.shmid); */
+ if (reply.shmid == (CARD32)(-1)) {
+ xCharInfo* pUniqCI;
+ CARD16* pIndex2UniqIndex;
+ int i;
+
+ nbytes = reply.nUniqCharInfos * SIZEOF(xCharInfo)
+ + (reply.nCharInfos+1)/2 * 2 * sizeof(CARD16);
+ pUniqCI = (xCharInfo *) Xmalloc (nbytes);
+ if (!pUniqCI) {
+ if (fs->properties) Xfree((char *) fs->properties);
+ Xfree((char *) fs);
+ _XEatData(dpy, nbytes);
+ return (XFontStruct *)NULL;
+ }
+ if (! (fs->per_char = (XCharStruct *) Xmalloc (reply.nCharInfos * sizeof(XCharStruct)))) {
+ Xfree((char *) pUniqCI);
+ if (fs->properties) Xfree((char *) fs->properties);
+ Xfree((char *) fs);
+ _XEatData(dpy, nbytes);
+ return (XFontStruct *)NULL;
+ }
+ _XRead16 (dpy, (char *) pUniqCI, nbytes);
+ pIndex2UniqIndex = (CARD16*) (pUniqCI + reply.nUniqCharInfos);
+ for (i = 0; i < reply.nCharInfos; i++) {
+ if (pIndex2UniqIndex[i] >= reply.nUniqCharInfos) {
+ fprintf(stderr, "_XF86BigfontQueryFont: server returned wrong data\n");
+ Xfree((char *) pUniqCI);
+ if (fs->properties) Xfree((char *) fs->properties);
+ Xfree((char *) fs);
+ return (XFontStruct *)NULL;
+ }
+ /* XXX the next statement won't work if short isn't 16 bits */
+ fs->per_char[i] = * (XCharStruct *) &pUniqCI[pIndex2UniqIndex[i]];
+ }
+ Xfree((char *) pUniqCI);
+ } else {
+#ifdef HAS_SHM
+ XExtData *pData;
+ XEDataObject fs_union;
+ char *addr;
+
+ pData = (XExtData *) Xmalloc(sizeof(XExtData));
+ if (!pData) {
+ if (fs->properties) Xfree((char *) fs->properties);
+ Xfree((char *) fs);
+ return (XFontStruct *)NULL;
+ }
+
+ /* In some cases (e.g. an ssh daemon forwarding an X session to
+ a remote machine) it is possible that the X server thinks we
+ are running on the same machine (because getpeername() and
+ LocalClient() cannot know about the forwarding) but we are
+ not really local. Therefore, when we attach the first shared
+ memory segment, we verify that we are on the same machine as
+ the X server by checking that 1. shmat() succeeds, 2. the
+ segment has a sufficient size, 3. it contains the X server's
+ signature. Then we set the CAP_VerifiedLocal bit to indicate
+ the verification was successful. */
+
+ if ((addr = shmat(reply.shmid, 0, SHM_RDONLY)) == (char *)-1) {
+ if (extcodes->serverCapabilities & CAP_VerifiedLocal)
+ fprintf(stderr, "_XF86BigfontQueryFont: could not attach shm segment\n");
+ Xfree((char *) pData);
+ if (fs->properties) Xfree((char *) fs->properties);
+ Xfree((char *) fs);
+ /* Stop requesting shared memory transport from now on. */
+ extcodes->serverCapabilities &= ~ XF86Bigfont_CAP_LocalShm;
+ return (XFontStruct *)NULL;
+ }
+
+ if (!(extcodes->serverCapabilities & CAP_VerifiedLocal)) {
+ struct shmid_ds buf;
+ if (!(shmctl(reply.shmid, IPC_STAT, &buf) >= 0
+ && buf.shm_segsz >= reply.shmsegoffset + reply.nCharInfos * sizeof(XCharStruct) + sizeof(CARD32)
+ && *(CARD32 *)(addr + reply.shmsegoffset + reply.nCharInfos * sizeof(XCharStruct)) == extcodes->serverSignature)) {
+ shmdt(addr);
+ Xfree((char *) pData);
+ if (fs->properties) Xfree((char *) fs->properties);
+ Xfree((char *) fs);
+ /* Stop requesting shared memory transport from now on. */
+ extcodes->serverCapabilities &= ~ XF86Bigfont_CAP_LocalShm;
+ return (XFontStruct *)NULL;
+ }
+ extcodes->serverCapabilities |= CAP_VerifiedLocal;
+ }
+
+ pData->number = XF86BigfontNumber;
+ pData->private_data = (XPointer) addr;
+ pData->free_private = _XF86BigfontFreeNop;
+ fs_union.font = fs;
+ XAddToExtensionList(XEHeadOfExtensionList(fs_union), pData);
+
+ fs->per_char = (XCharStruct *) (addr + reply.shmsegoffset);
+#else
+ fprintf(stderr, "_XF86BigfontQueryFont: try recompiling libX11 with HasShm, Xserver has shm support\n");
+ if (fs->properties) Xfree((char *) fs->properties);
+ Xfree((char *) fs);
+ /* Stop requesting shared memory transport from now on. */
+ extcodes->serverCapabilities &= ~ XF86Bigfont_CAP_LocalShm;
+ return (XFontStruct *)NULL;
+#endif
+ }
+ }
+
+ /* call out to any extensions interested */
+ for (ext = dpy->ext_procs; ext; ext = ext->next)
+ if (ext->create_Font) (*ext->create_Font)(dpy, fs, &ext->codes);
+ return fs;
}
-
-
+void
+_XF86BigfontFreeFontMetrics (fs)
+ XFontStruct *fs;
+{
+#ifdef HAS_SHM
+ XExtData *pData;
+ XEDataObject fs_union;
+
+ fs_union.font = fs;
+ if ((pData = XFindOnExtensionList(XEHeadOfExtensionList(fs_union),
+ XF86BigfontNumber)))
+ shmdt ((char *) pData->private_data);
+ else
+ Xfree ((char *) fs->per_char);
+#else
+ Xfree ((char *) fs->per_char);
+#endif
+}
+
+#endif /* USE_XF86BIGFONT */
+
+int _XF86LoadQueryLocaleFont(
+ Display *dpy,
+ _Xconst char *name,
+ XFontStruct **xfp,
+ Font *fidp)
+{
+ int l;
+ char *charset, *p;
+ char buf[256];
+ XFontStruct *fs;
+ XLCd lcd;
+
+ if (!name)
+ return 0;
+ l = strlen(name);
+ if (l < 2 || name[l - 1] != '*' || name[l - 2] != '-')
+ return 0;
+ charset = 0;
+ /* next three lines stolen from _XkbGetCharset() */
+ lcd = _XlcCurrentLC();
+ if ((lcd = _XlcCurrentLC()) != 0)
+ charset = XLC_PUBLIC(lcd, encoding_name);
+ if (!charset || (p = strrchr(charset, '-')) == 0 || p == charset || p[1] == 0 || (p[1] == '*' && p[2] == 0)) {
+ /* prefer latin1 if no encoding found */
+ charset = "ISO8859-1";
+ p = charset + 7;
+ }
+ if (l - 2 - (p - charset) < 0)
+ return 0;
+ if (_XlcNCompareISOLatin1(name + l - 2 - (p - charset), charset, p - charset))
+ return 0;
+ if (strlen(p + 1) + l - 1 >= sizeof(buf) - 1)
+ return 0;
+ strcpy(buf, name);
+ strcpy(buf + l - 1, p + 1);
+ fs = XLoadQueryFont(dpy, buf);
+ if (!fs)
+ return 0;
+ if (xfp) {
+ *xfp = fs;
+ if (fidp)
+ *fidp = fs->fid;
+ } else if (fidp) {
+ if (fs->per_char) {
+#ifdef USE_XF86BIGFONT
+ _XF86BigfontFreeFontMetrics(fs);
+#else
+ Xfree ((char *) fs->per_char);
+#endif
+ }
+ _XFreeExtData(fs->ext_data);
+ if (fs->properties)
+ Xfree ((char *) fs->properties);
+ *fidp = fs->fid;
+ Xfree ((char *) fs);
+ } else {
+ XFreeFont(dpy, fs);
+ }
+ return 1;
+}
diff --git a/src/FontInfo.c b/src/FontInfo.c
index 2dd4e793..a98d0736 100644
--- a/src/FontInfo.c
+++ b/src/FontInfo.c
@@ -24,25 +24,26 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/FontInfo.c,v 1.6 2001/12/14 19:54:00 dawes Exp $ */
#define NEED_REPLIES
#include "Xlibint.h"
-#if NeedFunctionPrototypes
+#if defined(XF86BIGFONT) && !defined(MUSTCOPY)
+#define USE_XF86BIGFONT
+#endif
+#ifdef USE_XF86BIGFONT
+extern void _XF86BigfontFreeFontMetrics(
+ XFontStruct* /* fs */
+);
+#endif
+
char **XListFontsWithInfo(
register Display *dpy,
_Xconst char *pattern, /* null-terminated */
int maxNames,
int *actualCount, /* RETURN */
XFontStruct **info) /* RETURN */
-#else
-char **XListFontsWithInfo(dpy, pattern, maxNames, actualCount, info)
-register Display *dpy;
-char *pattern; /* null-terminated */
-int maxNames;
-int *actualCount; /* RETURN */
-XFontStruct **info; /* RETURN */
-#endif
{
register long nbytes;
register int i;
@@ -163,7 +164,7 @@ XFontStruct **info; /* RETURN */
if (! (fs->properties = (XFontProp *) Xmalloc((unsigned) nbytes)))
goto badmem;
nbytes = reply.nFontProps * SIZEOF(xFontProp);
- _XRead32 (dpy, (char *)fs->properties, nbytes);
+ _XRead32 (dpy, (long *)fs->properties, nbytes);
} else
fs->properties = NULL;
@@ -174,7 +175,7 @@ XFontStruct **info; /* RETURN */
flist[i] = (char *) Xmalloc ((unsigned int) j);
if (! flist[i]) {
if (finfo[i].properties) Xfree((char *) finfo[i].properties);
- nbytes = reply.nameLength + 3 & ~3;
+ nbytes = (reply.nameLength + 3) & ~3;
_XEatData(dpy, (unsigned long) nbytes);
goto badmem;
}
@@ -221,7 +222,7 @@ XFontStruct **info; /* RETURN */
return (char **) NULL;
}
-
+int
XFreeFontInfo (names, info, actualCount)
char **names;
XFontStruct *info;
@@ -238,7 +239,11 @@ int actualCount;
if (info) {
for (i = 0; i < actualCount; i++) {
if (info[i].per_char)
+#ifdef USE_XF86BIGFONT
+ _XF86BigfontFreeFontMetrics(&info[i]);
+#else
Xfree ((char *) info[i].per_char);
+#endif
if (info[i].properties)
Xfree ((char *) info[i].properties);
}
diff --git a/src/FontNames.c b/src/FontNames.c
index 8432b2f9..f6e7036e 100644
--- a/src/FontNames.c
+++ b/src/FontNames.c
@@ -25,22 +25,17 @@ in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/FontNames.c,v 1.6 2001/12/14 19:54:00 dawes Exp $ */
+
#define NEED_REPLIES
#include "Xlibint.h"
-#if NeedFunctionPrototypes
-char **XListFonts(
+char **
+XListFonts(
register Display *dpy,
_Xconst char *pattern, /* null-terminated */
int maxNames,
int *actualCount) /* RETURN */
-#else
-char **XListFonts(dpy, pattern, maxNames, actualCount)
-register Display *dpy;
-char *pattern; /* null-terminated */
-int maxNames;
-int *actualCount; /* RETURN */
-#endif
{
register long nbytes;
register unsigned i;
@@ -102,6 +97,7 @@ int *actualCount; /* RETURN */
return (flist);
}
+int
XFreeFontNames(list)
char **list;
{
diff --git a/src/FreeCmap.c b/src/FreeCmap.c
index 3a2d370c..1195b3ad 100644
--- a/src/FreeCmap.c
+++ b/src/FreeCmap.c
@@ -24,14 +24,16 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/FreeCmap.c,v 1.4 2001/12/14 19:54:00 dawes Exp $ */
+#include "Xlib.h"
#include "Xlibint.h"
+#include "Cmap.h"
-extern void _XcmsDeleteCmapRec();
-
-XFreeColormap(dpy, cmap)
-register Display *dpy;
-Colormap cmap;
+int
+XFreeColormap(
+ register Display *dpy,
+ Colormap cmap)
{
register xResourceReq *req;
diff --git a/src/FreeCols.c b/src/FreeCols.c
index 03f74b90..d9516bad 100644
--- a/src/FreeCols.c
+++ b/src/FreeCols.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/FreeCols.c,v 1.3 2001/01/17 19:41:36 dawes Exp $ */
#include "Xlibint.h"
+int
XFreeColors(dpy, cmap, pixels, npixels, planes)
register Display *dpy;
Colormap cmap;
diff --git a/src/FreeCurs.c b/src/FreeCurs.c
index 4fe214a9..8fff916a 100644
--- a/src/FreeCurs.c
+++ b/src/FreeCurs.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/FreeCurs.c,v 1.3 2001/01/17 19:41:36 dawes Exp $ */
#include "Xlibint.h"
+int
XFreeCursor(dpy, cursor)
register Display *dpy;
Cursor cursor;
diff --git a/src/FreeEData.c b/src/FreeEData.c
index 14344fb8..d3555d54 100644
--- a/src/FreeEData.c
+++ b/src/FreeEData.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/FreeEData.c,v 1.3 2001/01/17 19:41:36 dawes Exp $ */
#include "Xlibint.h"
+int
_XFreeExtData (extension)
XExtData *extension;
{
diff --git a/src/FreeGC.c b/src/FreeGC.c
index 9912ff6f..96e61de3 100644
--- a/src/FreeGC.c
+++ b/src/FreeGC.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/FreeGC.c,v 1.4 2001/08/18 02:41:28 dawes Exp $ */
#include "Xlibint.h"
+int
XFreeGC (dpy, gc)
register Display *dpy;
GC gc;
diff --git a/src/FreePix.c b/src/FreePix.c
index d90ae131..40ad42f3 100644
--- a/src/FreePix.c
+++ b/src/FreePix.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/FreePix.c,v 1.3 2001/01/17 19:41:36 dawes Exp $ */
#include "Xlibint.h"
+int
XFreePixmap(dpy, pixmap)
register Display *dpy;
Pixmap pixmap;
diff --git a/src/GCMisc.c b/src/GCMisc.c
index 3735f692..62f4af00 100644
--- a/src/GCMisc.c
+++ b/src/GCMisc.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/GCMisc.c,v 1.3 2001/01/17 19:41:36 dawes Exp $ */
#include "Xlibint.h"
+int
XSetArcMode (dpy, gc, arc_mode)
register Display *dpy;
register GC gc;
@@ -42,6 +44,7 @@ int arc_mode;
return 1;
}
+int
XSetFillRule (dpy, gc, fill_rule)
register Display *dpy;
register GC gc;
@@ -57,6 +60,7 @@ int fill_rule;
return 1;
}
+int
XSetFillStyle (dpy, gc, fill_style)
register Display *dpy;
register GC gc;
@@ -72,6 +76,7 @@ int fill_style;
return 1;
}
+int
XSetGraphicsExposures (dpy, gc, graphics_exposures)
register Display *dpy;
register GC gc;
@@ -87,6 +92,7 @@ Bool graphics_exposures;
return 1;
}
+int
XSetSubwindowMode (dpy, gc, subwindow_mode)
register Display *dpy;
register GC gc;
diff --git a/src/Geom.c b/src/Geom.c
index 2699231d..0980094c 100644
--- a/src/Geom.c
+++ b/src/Geom.c
@@ -27,6 +27,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86$ */
#include "Xlibint.h"
#include "Xutil.h"
@@ -37,8 +38,8 @@ from The Open Group.
* returns 0 if there was some problem, else the position bitmask.
*/
-#if NeedFunctionPrototypes
-int XGeometry (
+int
+XGeometry (
Display *dpy, /* user's display connection */
int screen, /* screen on which to do computation */
_Xconst char *pos, /* user provided geometry spec */
@@ -52,17 +53,6 @@ int XGeometry (
register int *y, /* always set on successful RETURN */
register int *width, /* always set on successful RETURN */
register int *height) /* always set on successful RETURN */
-#else
-int XGeometry (dpy, screen, pos, def, bwidth, fwidth, fheight, xadd, yadd, x, y, width, height)
- Display *dpy; /* user's display connection */
- int screen; /* screen on which to do computation */
- char *pos; /* user provided geometry spec */
- char *def; /* default geometry spec for window */
- unsigned int bwidth; /* border width */
- unsigned int fwidth, fheight; /* size of position units */
- int xadd, yadd; /* any additional interior space */
- register int *x, *y, *width, *height;/* always set on successful RETURN */
-#endif
{
int px, py; /* returned values from parse */
unsigned int pwidth, pheight; /* returned values from parse */
diff --git a/src/GetAtomNm.c b/src/GetAtomNm.c
index 1b11fd7a..495fb426 100644
--- a/src/GetAtomNm.c
+++ b/src/GetAtomNm.c
@@ -24,31 +24,16 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/GetAtomNm.c,v 3.4 2001/08/18 02:41:28 dawes Exp $ */
#define NEED_REPLIES
#include "Xlibint.h"
-
-extern void _XFreeAtomTable();
-
-/* XXX this table def is duplicated in IntAtom.c, keep them consistent! */
-
-#define TABLESIZE 64
-
-typedef struct _Entry {
- unsigned long sig;
- Atom atom;
-} EntryRec, *Entry;
-
-#define EntryName(e) ((char *)(e+1))
-
-typedef struct _XDisplayAtoms {
- Entry table[TABLESIZE];
-} AtomTable;
+#include "Xintatom.h"
static
-char *_XGetAtomName(dpy, atom)
- Display *dpy;
- Atom atom;
+char *_XGetAtomName(
+ Display *dpy,
+ Atom atom)
{
xResourceReq *req;
char *name;
@@ -112,12 +97,12 @@ typedef struct {
} _XGetAtomNameState;
static
-Bool _XGetAtomNameHandler(dpy, rep, buf, len, data)
- register Display *dpy;
- register xReply *rep;
- char *buf;
- int len;
- XPointer data;
+Bool _XGetAtomNameHandler(
+ register Display *dpy,
+ register xReply *rep,
+ char *buf,
+ int len,
+ XPointer data)
{
register _XGetAtomNameState *state;
xGetAtomNameReply replbuf;
diff --git a/src/GetColor.c b/src/GetColor.c
index b469b5d4..2ccaf92f 100644
--- a/src/GetColor.c
+++ b/src/GetColor.c
@@ -24,29 +24,20 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/GetColor.c,v 1.6 2003/04/13 19:22:16 dawes Exp $ */
#define NEED_REPLIES
#include <stdio.h>
#include "Xlibint.h"
#include "Xcmsint.h"
-extern void _XcmsRGB_to_XColor();
-
-#if NeedFunctionPrototypes
-Status XAllocNamedColor(
+Status
+XAllocNamedColor(
register Display *dpy,
Colormap cmap,
_Xconst char *colorname, /* STRING8 */
XColor *hard_def, /* RETURN */
XColor *exact_def) /* RETURN */
-#else
-Status XAllocNamedColor(dpy, cmap, colorname, hard_def, exact_def)
-register Display *dpy;
-Colormap cmap;
-char *colorname; /* STRING8 */
-XColor *hard_def; /* RETURN */
-XColor *exact_def; /* RETURN */
-#endif
{
long nbytes;
@@ -60,20 +51,27 @@ XColor *exact_def; /* RETURN */
/*
* Let's Attempt to use Xcms and i18n approach to Parse Color
*/
- /* copy string to allow overwrite by _XcmsResolveColorString() */
if ((ccc = XcmsCCCOfColormap(dpy, cmap)) != (XcmsCCC)NULL) {
- if (_XcmsResolveColorString(ccc, &colorname, &cmsColor_exact,
- XcmsRGBFormat) >= XcmsSuccess) {
+ const char *tmpName = colorname;
+
+ switch (_XcmsResolveColorString(ccc, &tmpName, &cmsColor_exact,
+ XcmsRGBFormat)) {
+ case XcmsSuccess:
+ case XcmsSuccessWithCompression:
_XcmsRGB_to_XColor(&cmsColor_exact, exact_def, 1);
memcpy((char *)hard_def, (char *)exact_def, sizeof(XColor));
ret = XAllocColor(dpy, cmap, hard_def);
exact_def->pixel = hard_def->pixel;
return(ret);
+ case XcmsFailure:
+ case _XCMS_NEWNAME:
+ /*
+ * if the result was _XCMS_NEWNAME tmpName points to
+ * a string in cmsColNm.c:pairs table, for example,
+ * gray70 would become tekhvc:0.0/70.0/0.0
+ */
+ break;
}
- /*
- * Otherwise we failed; or colorname was changed with yet another
- * name. Thus pass name to the X Server.
- */
}
/*
diff --git a/src/GetDflt.c b/src/GetDflt.c
index 6e05abd4..3c7ba344 100644
--- a/src/GetDflt.c
+++ b/src/GetDflt.c
@@ -46,6 +46,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/lib/X11/GetDflt.c,v 3.22 2003/04/13 19:22:16 dawes Exp $ */
#include "Xlibint.h"
#include <X11/Xos.h>
@@ -86,14 +87,12 @@ SOFTWARE.
#include <stdio.h>
#include <ctype.h>
-#ifdef X_NOT_STDC_ENV
-extern char *getenv();
-#endif
/*ARGSUSED*/
-static char *GetHomeDir (dest, len)
- char *dest;
- int len;
+static char *
+GetHomeDir(
+ char *dest,
+ int len)
{
#ifdef WIN32
register char *ptr1;
@@ -114,7 +113,9 @@ static char *GetHomeDir (dest, len)
else
*dest = '\0';
#else
+#ifdef X_NEEDS_PWPARAMS
_Xgetpwparams pwparams;
+#endif
struct passwd *pw;
register char *ptr;
@@ -122,7 +123,7 @@ static char *GetHomeDir (dest, len)
return NULL;
if ((ptr = getenv("HOME"))) {
- (void) strncpy(dest, ptr, len);
+ (void) strncpy(dest, ptr, len-1);
dest[len-1] = '\0';
} else {
if ((ptr = getenv("USER")))
@@ -130,7 +131,7 @@ static char *GetHomeDir (dest, len)
else
pw = _XGetpwuid(getuid(),pwparams);
if (pw != NULL) {
- (void) strncpy(dest, pw->pw_dir, len);
+ (void) strncpy(dest, pw->pw_dir, len-1);
dest[len-1] = '\0';
} else
*dest = '\0';
@@ -140,8 +141,9 @@ static char *GetHomeDir (dest, len)
}
-static XrmDatabase InitDefaults (dpy)
- Display *dpy; /* display for defaults.... */
+static XrmDatabase
+InitDefaults(
+ Display *dpy) /* display for defaults.... */
{
XrmDatabase userdb;
XrmDatabase xdb;
@@ -190,17 +192,11 @@ static XrmDatabase InitDefaults (dpy)
#endif
}
-#if NeedFunctionPrototypes
-char *XGetDefault(
+char *
+XGetDefault(
Display *dpy, /* display for defaults.... */
char _Xconst *prog, /* name of program for option */
register _Xconst char *name) /* name of option program wants */
-#else
-char *XGetDefault(dpy, prog, name)
- Display *dpy; /* display for defaults.... */
- char *prog; /* name of program for option */
- register char *name; /* name of option program wants */
-#endif
{ /* to get, for example, "font" */
XrmName names[3];
XrmClass classes[3];
@@ -210,6 +206,10 @@ char *XGetDefault(dpy, prog, name)
#ifdef WIN32
char *progname2;
#endif
+#ifdef __UNIXOS2__
+ char *progname2;
+ char *dotpos;
+#endif
/*
* strip path off of program name (XXX - this is OS specific)
@@ -220,6 +220,14 @@ char *XGetDefault(dpy, prog, name)
if (progname2 && (!progname || progname < progname2))
progname = progname2;
#endif
+#ifdef __UNIXOS2__ /* Very similar to WIN32 */
+ progname2 = strrchr (prog, '\\');
+ if (progname2 && (!progname || progname < progname2))
+ progname = progname2;
+ dotpos = strrchr (prog, '.');
+ if (dotpos && (dotpos>progname2)) *dotpos='\0';
+#endif /* We take out the .exe suffix */
+
if (progname)
progname++;
else
@@ -231,8 +239,9 @@ char *XGetDefault(dpy, prog, name)
*/
LockDisplay(dpy);
if (dpy->db == NULL) {
- dpy->db = InitDefaults(dpy);
- }
+ dpy->db = InitDefaults(dpy);
+ dpy->flags |= XlibDisplayDfltRMDB;
+ }
UnlockDisplay(dpy);
names[0] = XrmStringToName(progname);
diff --git a/src/GetFPath.c b/src/GetFPath.c
index 69dd809c..6db1602e 100644
--- a/src/GetFPath.c
+++ b/src/GetFPath.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/GetFPath.c,v 1.3 2001/01/17 19:41:36 dawes Exp $ */
#define NEED_REPLIES
#include "Xlibint.h"
@@ -79,6 +80,7 @@ int *npaths; /* RETURN */
return (flist);
}
+int
XFreeFontPath (list)
char **list;
{
diff --git a/src/GetHints.c b/src/GetHints.c
index 7958fd1f..d2452700 100644
--- a/src/GetHints.c
+++ b/src/GetHints.c
@@ -46,6 +46,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/lib/X11/GetHints.c,v 1.3 2001/01/17 19:41:36 dawes Exp $ */
#include <X11/Xlibint.h>
#include <X11/Xos.h>
diff --git a/src/GetIFocus.c b/src/GetIFocus.c
index 7e2ca86c..fe1e80f8 100644
--- a/src/GetIFocus.c
+++ b/src/GetIFocus.c
@@ -24,10 +24,12 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/GetIFocus.c,v 1.3 2001/01/17 19:41:36 dawes Exp $ */
#define NEED_REPLIES
#include "Xlibint.h"
+int
XGetInputFocus(dpy, focus, revert_to)
register Display *dpy;
Window *focus;
diff --git a/src/GetImage.c b/src/GetImage.c
index ab665d81..3a2939cf 100644
--- a/src/GetImage.c
+++ b/src/GetImage.c
@@ -24,15 +24,17 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/GetImage.c,v 1.4 2001/12/14 19:54:00 dawes Exp $ */
#define NEED_REPLIES
#include "Xlibint.h"
#include <X11/Xutil.h> /* for XDestroyImage */
+#include "ImUtil.h"
#define ROUNDUP(nbytes, pad) (((((nbytes) - 1) + (pad)) / (pad)) * (pad))
-static unsigned int Ones(mask) /* HACKMEM 169 */
- unsigned long mask;
+static unsigned int Ones( /* HACKMEM 169 */
+ unsigned long mask)
{
register unsigned long y;
diff --git a/src/GetKCnt.c b/src/GetKCnt.c
index d8fa69c9..525ea1b9 100644
--- a/src/GetKCnt.c
+++ b/src/GetKCnt.c
@@ -24,10 +24,12 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/GetKCnt.c,v 1.5 2001/01/17 19:41:36 dawes Exp $ */
#define NEED_REPLIES
#include "Xlibint.h"
+int
XGetKeyboardControl (dpy, state)
register Display *dpy;
register XKeyboardState *state;
diff --git a/src/GetPCnt.c b/src/GetPCnt.c
index 54b84270..457dc9bc 100644
--- a/src/GetPCnt.c
+++ b/src/GetPCnt.c
@@ -24,10 +24,12 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/GetPCnt.c,v 1.3 2001/01/17 19:41:36 dawes Exp $ */
#define NEED_REPLIES
#include "Xlibint.h"
+int
XGetPointerControl(dpy, accel_numer, accel_denom, threshold)
register Display *dpy;
/* the following are return only vars */
diff --git a/src/GetPntMap.c b/src/GetPntMap.c
index 9af3a57c..65a5215f 100644
--- a/src/GetPntMap.c
+++ b/src/GetPntMap.c
@@ -25,6 +25,8 @@ in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/GetPntMap.c,v 1.6 2001/12/14 19:54:01 dawes Exp $ */
+
#define NEED_REPLIES
#include "Xlibint.h"
@@ -54,6 +56,7 @@ int XGetPointerMapping (dpy, map, nmaps)
nbytes = (long)rep.length << 2;
+ /* Don't count on the server returning a valid value */
if (nbytes > sizeof mapping) {
remainder = nbytes - sizeof mapping;
nbytes = sizeof mapping;
@@ -73,8 +76,8 @@ int XGetPointerMapping (dpy, map, nmaps)
return ((int) rep.nElts);
}
-#if NeedFunctionPrototypes
-KeySym *XGetKeyboardMapping (Display *dpy,
+KeySym *
+XGetKeyboardMapping (Display *dpy,
#if NeedWidePrototypes
unsigned int first_keycode,
#else
@@ -82,13 +85,6 @@ KeySym *XGetKeyboardMapping (Display *dpy,
#endif
int count,
int *keysyms_per_keycode)
-#else
-KeySym *XGetKeyboardMapping (dpy, first_keycode, count, keysyms_per_keycode)
- register Display *dpy;
- KeyCode first_keycode;
- int count;
- int *keysyms_per_keycode; /* RETURN */
-#endif
{
long nbytes;
unsigned long nkeysyms;
@@ -117,7 +113,7 @@ KeySym *XGetKeyboardMapping (dpy, first_keycode, count, keysyms_per_keycode)
SyncHandle();
return (KeySym *) NULL;
}
- _XRead32 (dpy, (char *) mapping, nbytes);
+ _XRead32 (dpy, (long *) mapping, nbytes);
}
*keysyms_per_keycode = rep.keySymsPerKeyCode;
UnlockDisplay(dpy);
diff --git a/src/GetProp.c b/src/GetProp.c
index ac8ef1c5..3323c778 100644
--- a/src/GetProp.c
+++ b/src/GetProp.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/GetProp.c,v 1.5 2001/10/28 03:32:30 tsi Exp $ */
#define NEED_REPLIES
#include "Xlibint.h"
@@ -75,21 +76,24 @@ XGetWindowProperty(dpy, w, property, offset, length, delete,
*/
case 8:
nbytes = netbytes = reply.nItems;
- if ((*prop = (unsigned char *) Xmalloc ((unsigned)nbytes + 1)))
+ if (nbytes + 1 > 0 &&
+ (*prop = (unsigned char *) Xmalloc ((unsigned)nbytes + 1)))
_XReadPad (dpy, (char *) *prop, netbytes);
break;
case 16:
nbytes = reply.nItems * sizeof (short);
netbytes = reply.nItems << 1;
- if ((*prop = (unsigned char *) Xmalloc ((unsigned)nbytes + 1)))
+ if (nbytes + 1 > 0 &&
+ (*prop = (unsigned char *) Xmalloc ((unsigned)nbytes + 1)))
_XRead16Pad (dpy, (short *) *prop, netbytes);
break;
case 32:
nbytes = reply.nItems * sizeof (long);
netbytes = reply.nItems << 2;
- if ((*prop = (unsigned char *) Xmalloc ((unsigned)nbytes + 1)))
+ if (nbytes + 1 > 0 &&
+ (*prop = (unsigned char *) Xmalloc ((unsigned)nbytes + 1)))
_XRead32 (dpy, (long *) *prop, netbytes);
break;
@@ -107,7 +111,7 @@ XGetWindowProperty(dpy, w, property, offset, length, delete,
error.errorCode = BadImplementation;
_XError(dpy, &error);
}
- netbytes = 0L;
+ nbytes = netbytes = 0L;
break;
}
if (! *prop) {
diff --git a/src/GetSSaver.c b/src/GetSSaver.c
index 60a7ef08..1dc004d9 100644
--- a/src/GetSSaver.c
+++ b/src/GetSSaver.c
@@ -24,10 +24,12 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/GetSSaver.c,v 1.3 2001/01/17 19:41:37 dawes Exp $ */
#define NEED_REPLIES
#include "Xlibint.h"
+int
XGetScreenSaver(dpy, timeout, interval, prefer_blanking, allow_exp)
register Display *dpy;
/* the following are return only vars */
diff --git a/src/GetWAttrs.c b/src/GetWAttrs.c
index 7856b6f0..c5e9d438 100644
--- a/src/GetWAttrs.c
+++ b/src/GetWAttrs.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86$ */
#define NEED_REPLIES
#include "Xlibint.h"
@@ -35,12 +36,12 @@ typedef struct _WAttrsState {
} _XWAttrsState;
static Bool
-_XWAttrsHandler(dpy, rep, buf, len, data)
- register Display *dpy;
- register xReply *rep;
- char *buf;
- int len;
- XPointer data;
+_XWAttrsHandler(
+ register Display *dpy,
+ register xReply *rep,
+ char *buf,
+ int len,
+ XPointer data)
{
register _XWAttrsState *state;
xGetWindowAttributesReply replbuf;
diff --git a/src/GrButton.c b/src/GrButton.c
index f0a8ebfb..af642e9a 100644
--- a/src/GrButton.c
+++ b/src/GrButton.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/GrButton.c,v 1.3 2001/01/17 19:41:37 dawes Exp $ */
#include "Xlibint.h"
+int
XGrabButton(dpy, button, modifiers, grab_window, owner_events, event_mask,
pointer_mode, keyboard_mode, confine_to, curs)
register Display *dpy;
diff --git a/src/GrKey.c b/src/GrKey.c
index 4f339b75..a1d5973f 100644
--- a/src/GrKey.c
+++ b/src/GrKey.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/GrKey.c,v 1.3 2001/01/17 19:41:37 dawes Exp $ */
#include "Xlibint.h"
+int
XGrabKey(dpy, key, modifiers, grab_window, owner_events,
pointer_mode, keyboard_mode)
register Display *dpy;
diff --git a/src/GrServer.c b/src/GrServer.c
index 9dfc04ac..df8cf3f2 100644
--- a/src/GrServer.c
+++ b/src/GrServer.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/GrServer.c,v 1.3 2001/01/17 19:41:37 dawes Exp $ */
#include "Xlibint.h"
+int
XGrabServer (dpy)
register Display *dpy;
{
diff --git a/src/Host.c b/src/Host.c
index 863ff8ef..4569863b 100644
--- a/src/Host.c
+++ b/src/Host.c
@@ -1,75 +1,125 @@
/* $Xorg: Host.c,v 1.4 2001/02/09 02:03:33 xorgcvs Exp $ */
+/* $XdotOrg: lib/X11/src/Host.c,v 1.2 2004-04-23 18:43:24 eich Exp $ */
/*
Copyright 1986, 1998 The Open Group
+Copyright 2004 Sun Microsystems, Inc.
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
+All rights reserved.
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, and/or sell copies of the Software, and to permit persons
+to whom the Software is furnished to do so, provided that the above
+copyright notice(s) and this permission notice appear in all copies of
+the Software and that both the above copyright notice(s) and this
+permission notice appear in supporting documentation.
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
+Except as contained in this notice, the name of a copyright holder
+shall not be used in advertising or otherwise to promote the sale, use
+or other dealings in this Software without prior written authorization
+of the copyright holder.
+
+X Window System is a trademark of The Open Group.
*/
+/* $XFree86: xc/lib/X11/Host.c,v 1.3 2001/01/17 19:41:37 dawes Exp $ */
-/* this might be rightly reguarded an os dependent file */
+/* this might be rightly regarded an os dependent file */
#include "Xlibint.h"
-XAddHost (dpy, host)
- register Display *dpy;
- XHostAddress *host;
- {
+int
+XAddHost (
+ register Display *dpy,
+ XHostAddress *host)
+{
register xChangeHostsReq *req;
- register int length = (host->length + 3) & ~0x3; /* round up */
+ register int length;
+ XServerInterpretedAddress *siAddr;
+ int addrlen;
+
+ if (host->family == FamilyServerInterpreted) {
+ siAddr = (XServerInterpretedAddress *) host->address;
+ addrlen = siAddr->typelength + siAddr->valuelength + 1;
+ } else {
+ addrlen = host->length;
+ }
+
+ length = (addrlen + 3) & ~0x3; /* round up */
LockDisplay(dpy);
GetReqExtra (ChangeHosts, length, req);
req->mode = HostInsert;
req->hostFamily = host->family;
- req->hostLength = host->length;
- memcpy((char *) NEXTPTR(req,xChangeHostsReq), host->address, host->length);
+ req->hostLength = addrlen;
+ if (host->family == FamilyServerInterpreted) {
+ char *dest = (char *) NEXTPTR(req,xChangeHostsReq);
+ memcpy(dest, siAddr->type, siAddr->typelength);
+ dest[siAddr->typelength] = '\0';
+ memcpy(dest + siAddr->typelength + 1,siAddr->value,siAddr->valuelength);
+ } else {
+ memcpy((char *) NEXTPTR(req,xChangeHostsReq), host->address, addrlen);
+ }
UnlockDisplay(dpy);
SyncHandle();
return 1;
- }
+}
-XRemoveHost (dpy, host)
- register Display *dpy;
- XHostAddress *host;
- {
+int
+XRemoveHost (
+ register Display *dpy,
+ XHostAddress *host)
+{
register xChangeHostsReq *req;
- register int length = (host->length + 3) & ~0x3; /* round up */
+ register int length;
+ XServerInterpretedAddress *siAddr;
+ int addrlen;
+
+ if (host->family == FamilyServerInterpreted) {
+ siAddr = (XServerInterpretedAddress *) host->address;
+ addrlen = siAddr->typelength + siAddr->valuelength + 1;
+ } else {
+ addrlen = host->length;
+ }
+
+ length = (addrlen + 3) & ~0x3; /* round up */
LockDisplay(dpy);
GetReqExtra (ChangeHosts, length, req);
req->mode = HostDelete;
req->hostFamily = host->family;
- req->hostLength = host->length;
- memcpy((char *) NEXTPTR(req,xChangeHostsReq), host->address, host->length);
+ req->hostLength = addrlen;
+ if (host->family == FamilyServerInterpreted) {
+ char *dest = (char *) NEXTPTR(req,xChangeHostsReq);
+ memcpy(dest, siAddr->type, siAddr->typelength);
+ dest[siAddr->typelength] = '\0';
+ memcpy(dest + siAddr->typelength + 1,siAddr->value,siAddr->valuelength);
+ } else {
+ memcpy((char *) NEXTPTR(req,xChangeHostsReq), host->address, addrlen);
+ }
UnlockDisplay(dpy);
SyncHandle();
return 1;
- }
-
+}
-XAddHosts (dpy, hosts, n)
- register Display *dpy;
- XHostAddress *hosts;
- int n;
+int
+XAddHosts (
+ register Display *dpy,
+ XHostAddress *hosts,
+ int n)
{
register int i;
for (i = 0; i < n; i++) {
@@ -78,10 +128,11 @@ XAddHosts (dpy, hosts, n)
return 1;
}
-XRemoveHosts (dpy, hosts, n)
- register Display *dpy;
- XHostAddress *hosts;
- int n;
+int
+XRemoveHosts (
+ register Display *dpy,
+ XHostAddress *hosts,
+ int n)
{
register int i;
for (i = 0; i < n; i++) {
diff --git a/src/IfEvent.c b/src/IfEvent.c
index 975d77a1..57b792d8 100644
--- a/src/IfEvent.c
+++ b/src/IfEvent.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/IfEvent.c,v 1.4 2001/12/14 19:54:01 dawes Exp $ */
#define NEED_EVENTS
#include "Xlibint.h"
@@ -33,14 +34,13 @@ in this Software without prior written authorization from The Open Group.
* predicate in the queue.
*/
+int
XIfEvent (dpy, event, predicate, arg)
register Display *dpy;
Bool (*predicate)(
-#if NeedNestedPrototypes
Display* /* display */,
XEvent* /* event */,
char* /* arg */
-#endif
); /* function to call */
register XEvent *event;
char *arg;
diff --git a/src/ImText.c b/src/ImText.c
index 45f17983..c6cd2c04 100644
--- a/src/ImText.c
+++ b/src/ImText.c
@@ -24,11 +24,12 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/ImText.c,v 1.4 2001/12/14 19:54:02 dawes Exp $ */
#define NEED_REPLIES
#include "Xlibint.h"
-#if NeedFunctionPrototypes
+int
XDrawImageString(
register Display *dpy,
Drawable d,
@@ -37,15 +38,6 @@ XDrawImageString(
int y,
_Xconst char *string,
int length)
-#else
-XDrawImageString(dpy, d, gc, x, y, string, length)
- register Display *dpy;
- Drawable d;
- GC gc;
- int x, y;
- char *string;
- int length;
-#endif
{
register xImageText8Req *req;
char *CharacterOffset = (char *)string;
diff --git a/src/ImText16.c b/src/ImText16.c
index fdc171ad..cabcf279 100644
--- a/src/ImText16.c
+++ b/src/ImText16.c
@@ -24,11 +24,12 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/ImText16.c,v 1.4 2001/12/14 19:54:02 dawes Exp $ */
#define NEED_REPLIES
#include "Xlibint.h"
-#if NeedFunctionPrototypes
+int
XDrawImageString16(
register Display *dpy,
Drawable d,
@@ -37,15 +38,6 @@ XDrawImageString16(
int y,
_Xconst XChar2b *string,
int length)
-#else
-XDrawImageString16(dpy, d, gc, x, y, string, length)
- register Display *dpy;
- Drawable d;
- GC gc;
- int x, y;
- XChar2b *string;
- int length;
-#endif
{
register xImageText16Req *req;
XChar2b *CharacterOffset = (XChar2b *)string;
diff --git a/src/ImUtil.c b/src/ImUtil.c
index b358e511..446bef23 100644
--- a/src/ImUtil.c
+++ b/src/ImUtil.c
@@ -24,18 +24,13 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/ImUtil.c,v 3.12 2003/04/15 22:10:06 herrb Exp $ */
#include <X11/Xlibint.h>
#include <X11/Xutil.h>
#include <stdio.h>
+#include "ImUtil.h"
-#ifdef __STDC__
-#define Const const
-#else
-#define Const /**/
-#endif
-
-#if NeedFunctionPrototypes
static int _XDestroyImage(XImage *);
static unsigned long _XGetPixel(XImage *, int, int);
static unsigned long _XGetPixel1(XImage *, int, int);
@@ -49,18 +44,18 @@ static int _XPutPixel16(XImage *, int, int, unsigned long);
static int _XPutPixel32(XImage *, int, int, unsigned long);
static XImage *_XSubImage(XImage *, int, int, unsigned int, unsigned int);
static int _XAddPixel(XImage *, long);
-#endif
-static unsigned char Const _lomask[0x09] = { 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff };
-static unsigned char Const _himask[0x09] = { 0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00 };
+static unsigned char const _lomask[0x09] = { 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff };
+static unsigned char const _himask[0x09] = { 0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00 };
/* These two convenience routines return the scanline_pad and bits_per_pixel
associated with a specific depth of ZPixmap format image for a
display. */
- _XGetScanlinePad(dpy, depth)
- Display *dpy;
- int depth;
+int
+_XGetScanlinePad(
+ Display *dpy,
+ int depth)
{
register ScreenFormat *fmt = dpy->pixmap_format;
register int i;
@@ -72,9 +67,10 @@ static unsigned char Const _himask[0x09] = { 0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0,
return(dpy->bitmap_pad);
}
- _XGetBitsPerPixel(dpy, depth)
- Display *dpy;
- int depth;
+int
+_XGetBitsPerPixel(
+ Display *dpy,
+ int depth)
{
register ScreenFormat *fmt = dpy->pixmap_format;
register int i;
@@ -121,9 +117,9 @@ static unsigned char Const _himask[0x09] = { 0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0,
* For XY formats, bitmap_unit is 8, 16, or 32 bits.
* For Z format, bits_per_pixel is 1, 4, 8, 16, 24, or 32 bits.
*/
-static void _xynormalizeimagebits (bp, img)
- register unsigned char *bp;
- register XImage *img;
+static void _xynormalizeimagebits (
+ register unsigned char *bp,
+ register XImage *img)
{
register unsigned char c;
@@ -150,9 +146,9 @@ static void _xynormalizeimagebits (bp, img)
_XReverse_Bytes (bp, img->bitmap_unit >> 3);
}
-static void _znormalizeimagebits (bp, img)
- register unsigned char *bp;
- register XImage *img;
+static void _znormalizeimagebits (
+ register unsigned char *bp,
+ register XImage *img)
{
register unsigned char c;
switch (img->bits_per_pixel) {
@@ -184,11 +180,11 @@ static void _znormalizeimagebits (bp, img)
}
}
-static void _putbits (src, dstoffset, numbits, dst)
- register char *src; /* address of source bit string */
- int dstoffset; /* bit offset into destination; range is 0-31 */
- register int numbits;/* number of bits to copy to destination */
- register char *dst; /* address of destination bit string */
+static void _putbits(
+ register char *src, /* address of source bit string */
+ int dstoffset, /* bit offset into destination; range is 0-31 */
+ register int numbits,/* number of bits to copy to destination */
+ register char *dst) /* address of destination bit string */
{
register unsigned char chlo, chhi;
int hibits;
@@ -241,6 +237,10 @@ static void _putbits (src, dstoffset, numbits, dst)
*
*/
+#if defined(Lynx) && defined(ROUNDUP)
+#undef ROUNDUP
+#endif
+
#define ROUNDUP(nbytes, pad) ((((nbytes) + ((pad)-1)) / (pad)) * ((pad)>>3))
#define XYNORMALIZE(bp, img) \
@@ -267,8 +267,8 @@ static void _putbits (src, dstoffset, numbits, dst)
* routines always have to check to make sure the optimization is still
* valid, and reinit the functions if not.
*/
-void _XInitImageFuncPtrs (image)
- register XImage *image;
+void _XInitImageFuncPtrs (
+ register XImage *image)
{
image->f.create_image = XCreateImage;
image->f.destroy_image = _XDestroyImage;
@@ -444,7 +444,7 @@ static int _XDestroyImage (ximage)
*
*/
-static unsigned long Const low_bits_table[] = {
+static unsigned long const low_bits_table[] = {
0x00000000, 0x00000001, 0x00000003, 0x00000007,
0x0000000f, 0x0000001f, 0x0000003f, 0x0000007f,
0x000000ff, 0x000001ff, 0x000003ff, 0x000007ff,
@@ -518,7 +518,7 @@ static unsigned long _XGetPixel (ximage, x, y)
}
#ifndef WORD64
-static unsigned long byteorderpixel = MSBFirst << 24;
+static CARD32 const byteorderpixel = MSBFirst << 24;
#endif
static unsigned long _XGetPixel32 (ximage, x, y)
@@ -533,7 +533,7 @@ static unsigned long _XGetPixel32 (ximage, x, y)
addr = &((unsigned char *)ximage->data)
[y * ximage->bytes_per_line + (x << 2)];
#ifndef WORD64
- if (*((char *)&byteorderpixel) == ximage->byte_order)
+ if (*((const char *)&byteorderpixel) == ximage->byte_order)
pixel = *((CARD32 *)addr);
else
#endif
@@ -724,7 +724,7 @@ static int _XPutPixel32 (ximage, x, y, pixel)
addr = &((unsigned char *)ximage->data)
[y * ximage->bytes_per_line + (x << 2)];
#ifndef WORD64
- if (*((char *)&byteorderpixel) == ximage->byte_order)
+ if (*((const char *)&byteorderpixel) == ximage->byte_order)
*((CARD32 *)addr) = pixel;
else
#endif
@@ -913,12 +913,11 @@ static XImage *_XSubImage (ximage, x, y, width, height)
*
*/
-int _XSetImage (srcimg, dstimg, x, y)
- XImage *srcimg;
- register XImage *dstimg;
- register int x;
- register int y;
-
+int _XSetImage(
+ XImage *srcimg,
+ register XImage *dstimg,
+ register int x,
+ register int y)
{
register unsigned long pixel;
register int row, col;
@@ -957,7 +956,8 @@ int _XSetImage (srcimg, dstimg, x, y)
*
*/
-static _XAddPixel (ximage, value)
+static int
+_XAddPixel (ximage, value)
register XImage *ximage;
register long value;
{
@@ -989,14 +989,14 @@ static _XAddPixel (ximage, value)
#ifndef WORD64
} else if ((ximage->format == ZPixmap) &&
(ximage->bits_per_pixel == 16) &&
- (*((char *)&byteorderpixel) == ximage->byte_order)) {
+ (*((const char *)&byteorderpixel) == ximage->byte_order)) {
register unsigned short *dp = (unsigned short *) ximage->data;
x = (ximage->bytes_per_line >> 1) * ximage->height;
while (--x >= 0)
*dp++ += value;
} else if ((ximage->format == ZPixmap) &&
(ximage->bits_per_pixel == 32) &&
- (*((char *)&byteorderpixel) == ximage->byte_order)) {
+ (*((const char *)&byteorderpixel) == ximage->byte_order)) {
register CARD32 *dp = (CARD32 *) ximage->data;
x = (ximage->bytes_per_line >> 2) * ximage->height;
while (--x >= 0)
diff --git a/src/InitExt.c b/src/InitExt.c
index c24d4490..215ed7b3 100644
--- a/src/InitExt.c
+++ b/src/InitExt.c
@@ -26,29 +26,20 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/lib/X11/InitExt.c,v 1.7 2001/12/14 19:54:02 dawes Exp $ */
#include <X11/Xlibint.h>
#include <X11/Xos.h>
#include <stdio.h>
-extern Bool _XUnknownWireEvent();
-extern Status _XUnknownNativeEvent();
-extern Bool _XDefaultWireError();
-
/*
* This routine is used to link a extension in so it will be called
* at appropriate times.
*/
-#if NeedFunctionPrototypes
XExtCodes *XInitExtension (
Display *dpy,
_Xconst char *name)
-#else
-XExtCodes *XInitExtension (dpy, name)
- Display *dpy;
- char *name;
-#endif
{
XExtCodes codes; /* temp. place for extension information. */
register _XExtension *ext;/* need a place to build it all */
@@ -95,9 +86,9 @@ XExtCodes *XAddExtension (dpy)
return (&ext->codes); /* tell him which extension */
}
-static _XExtension *XLookupExtension (dpy, extension)
- register Display *dpy; /* display */
- register int extension; /* extension number */
+static _XExtension *XLookupExtension (
+ register Display *dpy, /* display */
+ register int extension) /* extension number */
{
register _XExtension *ext;
for (ext = dpy->ext_procs; ext; ext = ext->next)
@@ -111,6 +102,7 @@ XExtData **XEHeadOfExtensionList(object)
return *(XExtData ***)&object;
}
+int
XAddToExtensionList(structure, ext_data)
XExtData **structure;
XExtData *ext_data;
@@ -132,14 +124,6 @@ XExtData *XFindOnExtensionList(structure, number)
return ext;
}
-typedef int (*CreateGCType) (
-#if NeedFunctionPrototypes
- Display* /* display */,
- GC /* gc */,
- XExtCodes* /* codes */
-#endif
-);
-
/*
* Routines to hang procs on the extension structure.
*/
@@ -149,7 +133,7 @@ CreateGCType XESetCreateGC(dpy, extension, proc)
CreateGCType proc; /* routine to call when GC created */
{
register _XExtension *e; /* for lookup of extension */
- register int (*oldproc)();
+ register CreateGCType oldproc;
if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL);
LockDisplay(dpy);
oldproc = e->create_GC;
@@ -158,21 +142,13 @@ CreateGCType XESetCreateGC(dpy, extension, proc)
return (CreateGCType)oldproc;
}
-typedef int (*CopyGCType)(
-#if NeedFunctionPrototypes
- Display* /* display */,
- GC /* gc */,
- XExtCodes* /* codes */
-#endif
-);
-
CopyGCType XESetCopyGC(dpy, extension, proc)
Display *dpy; /* display */
int extension; /* extension number */
CopyGCType proc; /* routine to call when GC copied */
{
register _XExtension *e; /* for lookup of extension */
- register int (*oldproc)();
+ register CopyGCType oldproc;
if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL);
LockDisplay(dpy);
oldproc = e->copy_GC;
@@ -181,21 +157,13 @@ CopyGCType XESetCopyGC(dpy, extension, proc)
return (CopyGCType)oldproc;
}
-typedef int (*FlushGCType) (
-#if NeedFunctionPrototypes
- Display* /* display */,
- GC /* gc */,
- XExtCodes* /* codes */
-#endif
-);
-
FlushGCType XESetFlushGC(dpy, extension, proc)
Display *dpy; /* display */
int extension; /* extension number */
FlushGCType proc; /* routine to call when GC copied */
{
register _XExtension *e; /* for lookup of extension */
- register int (*oldproc)();
+ register FlushGCType oldproc;
if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL);
LockDisplay(dpy);
oldproc = e->flush_GC;
@@ -204,21 +172,13 @@ FlushGCType XESetFlushGC(dpy, extension, proc)
return (FlushGCType)oldproc;
}
-typedef int (*FreeGCType) (
-#if NeedFunctionPrototypes
- Display* /* display */,
- GC /* gc */,
- XExtCodes* /* codes */
-#endif
-);
-
FreeGCType XESetFreeGC(dpy, extension, proc)
Display *dpy; /* display */
int extension; /* extension number */
FreeGCType proc; /* routine to call when GC freed */
{
register _XExtension *e; /* for lookup of extension */
- register int (*oldproc)();
+ register FreeGCType oldproc;
if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL);
LockDisplay(dpy);
oldproc = e->free_GC;
@@ -227,21 +187,13 @@ FreeGCType XESetFreeGC(dpy, extension, proc)
return (FreeGCType)oldproc;
}
-typedef int (*CreateFontType) (
-#if NeedFunctionPrototypes
- Display* /* display */,
- XFontStruct* /* fs */,
- XExtCodes* /* codes */
-#endif
-);
-
CreateFontType XESetCreateFont(dpy, extension, proc)
Display *dpy; /* display */
int extension; /* extension number */
CreateFontType proc; /* routine to call when font created */
{
register _XExtension *e; /* for lookup of extension */
- register int (*oldproc)();
+ register CreateFontType oldproc;
if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL);
LockDisplay(dpy);
oldproc = e->create_Font;
@@ -250,21 +202,13 @@ CreateFontType XESetCreateFont(dpy, extension, proc)
return (CreateFontType)oldproc;
}
-typedef int (*FreeFontType) (
-#if NeedFunctionPrototypes
- Display* /* display */,
- XFontStruct* /* fs */,
- XExtCodes* /* codes */
-#endif
-);
-
FreeFontType XESetFreeFont(dpy, extension, proc)
Display *dpy; /* display */
int extension; /* extension number */
FreeFontType proc; /* routine to call when font freed */
{
register _XExtension *e; /* for lookup of extension */
- register int (*oldproc)();
+ register FreeFontType oldproc;
if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL);
LockDisplay(dpy);
oldproc = e->free_Font;
@@ -273,20 +217,13 @@ FreeFontType XESetFreeFont(dpy, extension, proc)
return (FreeFontType)oldproc;
}
-typedef int (*CloseDisplayType) (
-#if NeedFunctionPrototypes
- Display* /* display */,
- XExtCodes* /* codes */
-#endif
-);
-
CloseDisplayType XESetCloseDisplay(dpy, extension, proc)
Display *dpy; /* display */
int extension; /* extension number */
CloseDisplayType proc; /* routine to call when display closed */
{
register _XExtension *e; /* for lookup of extension */
- register int (*oldproc)();
+ register CloseDisplayType oldproc;
if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL);
LockDisplay(dpy);
oldproc = e->close_display;
@@ -296,11 +233,9 @@ CloseDisplayType XESetCloseDisplay(dpy, extension, proc)
}
typedef Bool (*WireToEventType) (
-#if NeedFunctionPrototypes
Display* /* display */,
XEvent* /* re */,
xEvent* /* event */
-#endif
);
WireToEventType XESetWireToEvent(dpy, event_number, proc)
@@ -308,7 +243,7 @@ WireToEventType XESetWireToEvent(dpy, event_number, proc)
WireToEventType proc; /* routine to call when converting event */
int event_number; /* event routine to replace */
{
- register Bool (*oldproc)();
+ register WireToEventType oldproc;
if (proc == NULL) proc = (WireToEventType)_XUnknownWireEvent;
LockDisplay (dpy);
oldproc = dpy->event_vec[event_number];
@@ -318,11 +253,9 @@ WireToEventType XESetWireToEvent(dpy, event_number, proc)
}
typedef Status (*EventToWireType) (
-#if NeedFunctionPrototypes
Display* /* display */,
XEvent* /* re */,
xEvent* /* event */
-#endif
);
EventToWireType XESetEventToWire(dpy, event_number, proc)
@@ -330,7 +263,7 @@ EventToWireType XESetEventToWire(dpy, event_number, proc)
EventToWireType proc; /* routine to call when converting event */
int event_number; /* event routine to replace */
{
- register Status (*oldproc)();
+ register EventToWireType oldproc;
if (proc == NULL) proc = (EventToWireType) _XUnknownNativeEvent;
LockDisplay (dpy);
oldproc = dpy->wire_vec[event_number];
@@ -340,11 +273,9 @@ EventToWireType XESetEventToWire(dpy, event_number, proc)
}
typedef Bool (*WireToErrorType) (
-#if NeedFunctionPrototypes
Display* /* display */,
XErrorEvent* /* he */,
xError* /* we */
-#endif
);
WireToErrorType XESetWireToError(dpy, error_number, proc)
@@ -352,12 +283,12 @@ WireToErrorType XESetWireToError(dpy, error_number, proc)
WireToErrorType proc; /* routine to call when converting error */
int error_number; /* error routine to replace */
{
- register Bool (*oldproc)();
+ register WireToErrorType oldproc = NULL;
if (proc == NULL) proc = (WireToErrorType)_XDefaultWireError;
LockDisplay (dpy);
if (!dpy->error_vec) {
int i;
- dpy->error_vec = (Bool (**)())Xmalloc(256 * sizeof(oldproc));
+ dpy->error_vec = Xmalloc(256 * sizeof(oldproc));
for (i = 1; i < 256; i++)
dpy->error_vec[i] = _XDefaultWireError;
}
@@ -369,22 +300,13 @@ WireToErrorType XESetWireToError(dpy, error_number, proc)
return (WireToErrorType)oldproc;
}
-typedef int (*ErrorType) (
-#if NeedFunctionPrototypes
- Display* /* display */,
- xError* /* err */,
- XExtCodes* /* codes */,
- int* /* ret_code */
-#endif
-);
-
ErrorType XESetError(dpy, extension, proc)
Display *dpy; /* display */
int extension; /* extension number */
ErrorType proc; /* routine to call when X error happens */
{
register _XExtension *e; /* for lookup of extension */
- register int (*oldproc)();
+ register ErrorType oldproc;
if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL);
LockDisplay(dpy);
oldproc = e->error;
@@ -393,23 +315,13 @@ ErrorType XESetError(dpy, extension, proc)
return (ErrorType)oldproc;
}
-typedef char* (*ErrorStringType) (
-#if NeedFunctionPrototypes
- Display* /* display */,
- int /* code */,
- XExtCodes* /* codes */,
- char* /* buffer */,
- int /* nbytes */
-#endif
-);
-
ErrorStringType XESetErrorString(dpy, extension, proc)
Display *dpy; /* display */
int extension; /* extension number */
ErrorStringType proc; /* routine to call when I/O error happens */
{
register _XExtension *e; /* for lookup of extension */
- register char *(*oldproc)();
+ register ErrorStringType oldproc;
if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL);
LockDisplay(dpy);
oldproc = e->error_string;
@@ -418,21 +330,13 @@ ErrorStringType XESetErrorString(dpy, extension, proc)
return (ErrorStringType)oldproc;
}
-typedef void (*PrintErrorType)(
-#if NeedFunctionPrototypes
- Display* /* display */,
- XErrorEvent* /* ev */,
- void* /* fp */
-#endif
-);
-
PrintErrorType XESetPrintErrorValues(dpy, extension, proc)
Display *dpy; /* display */
int extension; /* extension number */
PrintErrorType proc; /* routine to call to print */
{
register _XExtension *e; /* for lookup of extension */
- register void (*oldproc)();
+ register PrintErrorType oldproc;
if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL);
LockDisplay(dpy);
oldproc = e->error_values;
@@ -441,22 +345,13 @@ PrintErrorType XESetPrintErrorValues(dpy, extension, proc)
return (PrintErrorType)oldproc;
}
-typedef void (*BeforeFlushType)(
-#if NeedFunctionPrototypes
- Display* /* display */,
- XExtCodes* /* codes */,
- char* /* data */,
- long /* len */
-#endif
-);
-
BeforeFlushType XESetBeforeFlush(dpy, extension, proc)
Display *dpy; /* display */
int extension; /* extension number */
BeforeFlushType proc; /* routine to call on flush */
{
register _XExtension *e; /* for lookup of extension */
- register void (*oldproc)();
+ register BeforeFlushType oldproc;
register _XExtension *ext;
if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL);
LockDisplay(dpy);
diff --git a/src/InsCmap.c b/src/InsCmap.c
index 1e10d953..df0dc9f7 100644
--- a/src/InsCmap.c
+++ b/src/InsCmap.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/InsCmap.c,v 1.3 2001/01/17 19:41:38 dawes Exp $ */
#include "Xlibint.h"
+int
XInstallColormap(dpy, cmap)
register Display *dpy;
Colormap cmap;
diff --git a/src/IntAtom.c b/src/IntAtom.c
index 467286b0..00240fd9 100644
--- a/src/IntAtom.c
+++ b/src/IntAtom.c
@@ -26,26 +26,11 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/lib/X11/IntAtom.c,v 1.6 2001/12/14 19:54:02 dawes Exp $ */
#define NEED_REPLIES
#include "Xlibint.h"
-
-/* XXX this table def is duplicated in GetAtomNm.c, keep them consistent! */
-
-#define TABLESIZE 64
-
-typedef struct _Entry {
- unsigned long sig;
- Atom atom;
-} EntryRec, *Entry;
-
-#define RESERVED ((Entry) 1)
-
-#define EntryName(e) ((char *)(e+1))
-
-typedef struct _XDisplayAtoms {
- Entry table[TABLESIZE];
-} AtomTable;
+#include "Xintatom.h"
#define HASH(sig) ((sig) & (TABLESIZE-1))
#define REHASHVAL(sig) ((((sig) % (TABLESIZE-3)) + 2) | 1)
@@ -70,20 +55,20 @@ _XFreeAtomTable(dpy)
}
static
-Atom _XInternAtom(dpy, name, onlyIfExists, psig, pidx, pn)
- Display *dpy;
- char *name;
- Bool onlyIfExists;
- unsigned long *psig;
- int *pidx;
- int *pn;
+Atom _XInternAtom(
+ Display *dpy,
+ _Xconst char *name,
+ Bool onlyIfExists,
+ unsigned long *psig,
+ int *pidx,
+ int *pn)
{
register AtomTable *atoms;
register char *s1, c, *s2;
register unsigned long sig;
- register int idx, i;
+ register int idx = 0, i;
Entry e;
- int n, firstidx, rehash;
+ int n, firstidx, rehash = 0;
xInternAtomReq *req;
/* look in the cache first */
@@ -130,7 +115,7 @@ nomatch: if (idx == firstidx)
void
_XUpdateAtomCache(dpy, name, atom, sig, idx, n)
Display *dpy;
- char *name;
+ const char *name;
Atom atom;
unsigned long sig;
int idx;
@@ -174,17 +159,11 @@ _XUpdateAtomCache(dpy, name, atom, sig, idx, n)
}
}
-#if NeedFunctionPrototypes
-Atom XInternAtom (
+Atom
+XInternAtom (
Display *dpy,
- _Xconst char *name,
+ const char *name,
Bool onlyIfExists)
-#else
-Atom XInternAtom (dpy, name, onlyIfExists)
- Display *dpy;
- char *name;
- Bool onlyIfExists;
-#endif
{
Atom atom;
unsigned long sig;
@@ -219,15 +198,15 @@ typedef struct {
} _XIntAtomState;
static
-Bool _XIntAtomHandler(dpy, rep, buf, len, data)
- register Display *dpy;
- register xReply *rep;
- char *buf;
- int len;
- XPointer data;
+Bool _XIntAtomHandler(
+ register Display *dpy,
+ register xReply *rep,
+ char *buf,
+ int len,
+ XPointer data)
{
register _XIntAtomState *state;
- register int i, idx;
+ register int i, idx = 0;
xInternAtomReply replbuf;
register xInternAtomReply *repl;
diff --git a/src/Key.h b/src/Key.h
index 2cfb82af..a0ca795d 100644
--- a/src/Key.h
+++ b/src/Key.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/Key.h,v 1.1 2003/04/13 19:22:16 dawes Exp $ */
+/* $XFree86$ */
#ifndef _KEY_H_
#define _KEY_H_
diff --git a/src/KeyBind.c b/src/KeyBind.c
index f56a06a4..36108245 100644
--- a/src/KeyBind.c
+++ b/src/KeyBind.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/KeyBind.c,v 1.8 2003/05/27 22:26:25 tsi Exp $ */
/* Beware, here be monsters (still under construction... - JG */
@@ -35,22 +36,35 @@ in this Software without prior written authorization from The Open Group.
#define XK_LATIN2
#define XK_LATIN3
#define XK_LATIN4
+#define XK_LATIN8
+#define XK_LATIN9
#define XK_CYRILLIC
#define XK_GREEK
+#define XK_ARMENIAN
+#define XK_CAUCASUS
+#define XK_VIETNAMESE
#define XK_XKB_KEYS
#include <X11/keysymdef.h>
#include <stdio.h>
+#include "XKBlib.h"
+
#ifdef USE_OWN_COMPOSE
#include "imComp.h"
+
#endif
+#include "Xresource.h"
+#include "XKBlibint.h"
+#include "Key.h"
+
#ifdef XKB
#define XKeycodeToKeysym _XKeycodeToKeysym
#define XKeysymToKeycode _XKeysymToKeycode
#define XLookupKeysym _XLookupKeysym
#define XRefreshKeyboardMapping _XRefreshKeyboardMapping
#define XLookupString _XLookupString
+/* XKBBind.c */
#else
#define XkbKeysymToModifiers _XKeysymToModifiers
#endif
@@ -58,7 +72,10 @@ in this Software without prior written authorization from The Open Group.
#define AllMods (ShiftMask|LockMask|ControlMask| \
Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)
-static void ComputeMaskFromKeytrans();
+static void
+ComputeMaskFromKeytrans(
+ Display *dpy,
+ register struct _XKeytrans *p);
struct _XKeytrans {
struct _XKeytrans *next;/* next on list */
@@ -71,14 +88,7 @@ struct _XKeytrans {
};
static KeySym
-#if NeedFunctionPrototypes
KeyCodetoKeySym(register Display *dpy, KeyCode keycode, int col)
-#else
-KeyCodetoKeySym(dpy, keycode, col)
- register Display *dpy;
- KeyCode keycode;
- int col;
-#endif
{
register int per = dpy->keysyms_per_keycode;
register KeySym *syms;
@@ -109,7 +119,6 @@ KeyCodetoKeySym(dpy, keycode, col)
return syms[col];
}
-#if NeedFunctionPrototypes
KeySym
XKeycodeToKeysym(Display *dpy,
#if NeedWidePrototypes
@@ -118,13 +127,6 @@ XKeycodeToKeysym(Display *dpy,
KeyCode kc,
#endif
int col)
-#else
-KeySym
-XKeycodeToKeysym(dpy, kc, col)
- Display *dpy;
- KeyCode kc;
- int col;
-#endif
{
if ((! dpy->keysyms) && (! _XKeyInitialize(dpy)))
return NoSymbol;
@@ -160,8 +162,8 @@ XLookupKeysym(event, col)
}
static void
-ResetModMap(dpy)
- Display *dpy;
+ResetModMap(
+ Display *dpy)
{
register XModifierKeymap *map;
register int i, j, n;
@@ -209,8 +211,8 @@ ResetModMap(dpy)
}
static int
-InitModMap(dpy)
- Display *dpy;
+InitModMap(
+ Display *dpy)
{
register XModifierKeymap *map;
@@ -227,6 +229,7 @@ InitModMap(dpy)
return 1;
}
+int
XRefreshKeyboardMapping(event)
register XMappingEvent *event;
{
@@ -257,8 +260,8 @@ XRefreshKeyboardMapping(event)
}
int
-_XKeyInitialize(dpy)
- Display *dpy;
+_XKeyInitialize(
+ Display *dpy)
{
int per, n;
KeySym *keysyms;
@@ -287,14 +290,372 @@ _XKeyInitialize(dpy)
return 1;
}
+static void
+UCSConvertCase( register unsigned code,
+ KeySym *lower,
+ KeySym *upper )
+{
+ /* Case conversion for UCS, as in Unicode Data version 4.0.0 */
+ /* NB: Only converts simple one-to-one mappings. */
+
+ /* Tables are used where they take less space than */
+ /* the code to work out the mappings. Zero values mean */
+ /* undefined code points. */
+
+ static unsigned short const IPAExt_upper_mapping[] = { /* part only */
+ 0x0181, 0x0186, 0x0255, 0x0189, 0x018A,
+ 0x0258, 0x018F, 0x025A, 0x0190, 0x025C, 0x025D, 0x025E, 0x025F,
+ 0x0193, 0x0261, 0x0262, 0x0194, 0x0264, 0x0265, 0x0266, 0x0267,
+ 0x0197, 0x0196, 0x026A, 0x026B, 0x026C, 0x026D, 0x026E, 0x019C,
+ 0x0270, 0x0271, 0x019D, 0x0273, 0x0274, 0x019F, 0x0276, 0x0277,
+ 0x0278, 0x0279, 0x027A, 0x027B, 0x027C, 0x027D, 0x027E, 0x027F,
+ 0x01A6, 0x0281, 0x0282, 0x01A9, 0x0284, 0x0285, 0x0286, 0x0287,
+ 0x01AE, 0x0289, 0x01B1, 0x01B2, 0x028C, 0x028D, 0x028E, 0x028F,
+ 0x0290, 0x0291, 0x01B7
+ };
+
+ static unsigned short const LatinExtB_upper_mapping[] = { /* first part only */
+ 0x0180, 0x0181, 0x0182, 0x0182, 0x0184, 0x0184, 0x0186, 0x0187,
+ 0x0187, 0x0189, 0x018A, 0x018B, 0x018B, 0x018D, 0x018E, 0x018F,
+ 0x0190, 0x0191, 0x0191, 0x0193, 0x0194, 0x01F6, 0x0196, 0x0197,
+ 0x0198, 0x0198, 0x019A, 0x019B, 0x019C, 0x019D, 0x0220, 0x019F,
+ 0x01A0, 0x01A0, 0x01A2, 0x01A2, 0x01A4, 0x01A4, 0x01A6, 0x01A7,
+ 0x01A7, 0x01A9, 0x01AA, 0x01AB, 0x01AC, 0x01AC, 0x01AE, 0x01AF,
+ 0x01AF, 0x01B1, 0x01B2, 0x01B3, 0x01B3, 0x01B5, 0x01B5, 0x01B7,
+ 0x01B8, 0x01B8, 0x01BA, 0x01BB, 0x01BC, 0x01BC, 0x01BE, 0x01F7,
+ 0x01C0, 0x01C1, 0x01C2, 0x01C3, 0x01C4, 0x01C4, 0x01C4, 0x01C7,
+ 0x01C7, 0x01C7, 0x01CA, 0x01CA, 0x01CA
+ };
+
+ static unsigned short const LatinExtB_lower_mapping[] = { /* first part only */
+ 0x0180, 0x0253, 0x0183, 0x0183, 0x0185, 0x0185, 0x0254, 0x0188,
+ 0x0188, 0x0256, 0x0257, 0x018C, 0x018C, 0x018D, 0x01DD, 0x0259,
+ 0x025B, 0x0192, 0x0192, 0x0260, 0x0263, 0x0195, 0x0269, 0x0268,
+ 0x0199, 0x0199, 0x019A, 0x019B, 0x026F, 0x0272, 0x019E, 0x0275,
+ 0x01A1, 0x01A1, 0x01A3, 0x01A3, 0x01A5, 0x01A5, 0x0280, 0x01A8,
+ 0x01A8, 0x0283, 0x01AA, 0x01AB, 0x01AD, 0x01AD, 0x0288, 0x01B0,
+ 0x01B0, 0x028A, 0x028B, 0x01B4, 0x01B4, 0x01B6, 0x01B6, 0x0292,
+ 0x01B9, 0x01B9, 0x01BA, 0x01BB, 0x01BD, 0x01BD, 0x01BE, 0x01BF,
+ 0x01C0, 0x01C1, 0x01C2, 0x01C3, 0x01C6, 0x01C6, 0x01C6, 0x01C9,
+ 0x01C9, 0x01C9, 0x01CC, 0x01CC, 0x01CC
+ };
+
+ static unsigned short const Greek_upper_mapping[] = {
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0374, 0x0375, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x037A, 0x0000, 0x0000, 0x0000, 0x037E, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0384, 0x0385, 0x0386, 0x0387,
+ 0x0388, 0x0389, 0x038A, 0x0000, 0x038C, 0x0000, 0x038E, 0x038F,
+ 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397,
+ 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F,
+ 0x03A0, 0x03A1, 0x0000, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7,
+ 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x0386, 0x0388, 0x0389, 0x038A,
+ 0x03B0, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397,
+ 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F,
+ 0x03A0, 0x03A1, 0x03A3, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7,
+ 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x038C, 0x038E, 0x038F, 0x0000,
+ 0x0392, 0x0398, 0x03D2, 0x03D3, 0x03D4, 0x03A6, 0x03A0, 0x03D7,
+ 0x03D8, 0x03D8, 0x03DA, 0x03DA, 0x03DC, 0x03DC, 0x03DE, 0x03DE,
+ 0x03E0, 0x03E0, 0x03E2, 0x03E2, 0x03E4, 0x03E4, 0x03E6, 0x03E6,
+ 0x03E8, 0x03E8, 0x03EA, 0x03EA, 0x03EC, 0x03EC, 0x03EE, 0x03EE,
+ 0x039A, 0x03A1, 0x03F9, 0x03F3, 0x03F4, 0x0395, 0x03F6, 0x03F7,
+ 0x03F7, 0x03F9, 0x03FA, 0x03FA, 0x0000, 0x0000, 0x0000, 0x0000
+ };
+
+ static unsigned short const Greek_lower_mapping[] = {
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0374, 0x0375, 0x0000, 0x0000,
+ 0x0000, 0x0000, 0x037A, 0x0000, 0x0000, 0x0000, 0x037E, 0x0000,
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0384, 0x0385, 0x03AC, 0x0387,
+ 0x03AD, 0x03AE, 0x03AF, 0x0000, 0x03CC, 0x0000, 0x03CD, 0x03CE,
+ 0x0390, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7,
+ 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF,
+ 0x03C0, 0x03C1, 0x0000, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7,
+ 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03AC, 0x03AD, 0x03AE, 0x03AF,
+ 0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7,
+ 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF,
+ 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7,
+ 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0x0000,
+ 0x03D0, 0x03D1, 0x03D2, 0x03D3, 0x03D4, 0x03D5, 0x03D6, 0x03D7,
+ 0x03D9, 0x03D9, 0x03DB, 0x03DB, 0x03DD, 0x03DD, 0x03DF, 0x03DF,
+ 0x03E1, 0x03E1, 0x03E3, 0x03E3, 0x03E5, 0x03E5, 0x03E7, 0x03E7,
+ 0x03E9, 0x03E9, 0x03EB, 0x03EB, 0x03ED, 0x03ED, 0x03EF, 0x03EF,
+ 0x03F0, 0x03F1, 0x03F2, 0x03F3, 0x03B8, 0x03F5, 0x03F6, 0x03F8,
+ 0x03F8, 0x03F2, 0x03FB, 0x03FB, 0x0000, 0x0000, 0x0000, 0x0000
+ };
+
+ static unsigned short const GreekExt_lower_mapping[] = {
+ 0x1F00, 0x1F01, 0x1F02, 0x1F03, 0x1F04, 0x1F05, 0x1F06, 0x1F07,
+ 0x1F00, 0x1F01, 0x1F02, 0x1F03, 0x1F04, 0x1F05, 0x1F06, 0x1F07,
+ 0x1F10, 0x1F11, 0x1F12, 0x1F13, 0x1F14, 0x1F15, 0x0000, 0x0000,
+ 0x1F10, 0x1F11, 0x1F12, 0x1F13, 0x1F14, 0x1F15, 0x0000, 0x0000,
+ 0x1F20, 0x1F21, 0x1F22, 0x1F23, 0x1F24, 0x1F25, 0x1F26, 0x1F27,
+ 0x1F20, 0x1F21, 0x1F22, 0x1F23, 0x1F24, 0x1F25, 0x1F26, 0x1F27,
+ 0x1F30, 0x1F31, 0x1F32, 0x1F33, 0x1F34, 0x1F35, 0x1F36, 0x1F37,
+ 0x1F30, 0x1F31, 0x1F32, 0x1F33, 0x1F34, 0x1F35, 0x1F36, 0x1F37,
+ 0x1F40, 0x1F41, 0x1F42, 0x1F43, 0x1F44, 0x1F45, 0x0000, 0x0000,
+ 0x1F40, 0x1F41, 0x1F42, 0x1F43, 0x1F44, 0x1F45, 0x0000, 0x0000,
+ 0x1F50, 0x1F51, 0x1F52, 0x1F53, 0x1F54, 0x1F55, 0x1F56, 0x1F57,
+ 0x0000, 0x1F51, 0x0000, 0x1F53, 0x0000, 0x1F55, 0x0000, 0x1F57,
+ 0x1F60, 0x1F61, 0x1F62, 0x1F63, 0x1F64, 0x1F65, 0x1F66, 0x1F67,
+ 0x1F60, 0x1F61, 0x1F62, 0x1F63, 0x1F64, 0x1F65, 0x1F66, 0x1F67,
+ 0x1F70, 0x1F71, 0x1F72, 0x1F73, 0x1F74, 0x1F75, 0x1F76, 0x1F77,
+ 0x1F78, 0x1F79, 0x1F7A, 0x1F7B, 0x1F7C, 0x1F7D, 0x0000, 0x0000,
+ 0x1F80, 0x1F81, 0x1F82, 0x1F83, 0x1F84, 0x1F85, 0x1F86, 0x1F87,
+ 0x1F80, 0x1F81, 0x1F82, 0x1F83, 0x1F84, 0x1F85, 0x1F86, 0x1F87,
+ 0x1F90, 0x1F91, 0x1F92, 0x1F93, 0x1F94, 0x1F95, 0x1F96, 0x1F97,
+ 0x1F90, 0x1F91, 0x1F92, 0x1F93, 0x1F94, 0x1F95, 0x1F96, 0x1F97,
+ 0x1FA0, 0x1FA1, 0x1FA2, 0x1FA3, 0x1FA4, 0x1FA5, 0x1FA6, 0x1FA7,
+ 0x1FA0, 0x1FA1, 0x1FA2, 0x1FA3, 0x1FA4, 0x1FA5, 0x1FA6, 0x1FA7,
+ 0x1FB0, 0x1FB1, 0x1FB2, 0x1FB3, 0x1FB4, 0x0000, 0x1FB6, 0x1FB7,
+ 0x1FB0, 0x1FB1, 0x1F70, 0x1F71, 0x1FB3, 0x1FBD, 0x1FBE, 0x1FBF,
+ 0x1FC0, 0x1FC1, 0x1FC2, 0x1FC3, 0x1FC4, 0x0000, 0x1FC6, 0x1FC7,
+ 0x1F72, 0x1F73, 0x1F74, 0x1F75, 0x1FC3, 0x1FCD, 0x1FCE, 0x1FCF,
+ 0x1FD0, 0x1FD1, 0x1FD2, 0x1FD3, 0x0000, 0x0000, 0x1FD6, 0x1FD7,
+ 0x1FD0, 0x1FD1, 0x1F76, 0x1F77, 0x0000, 0x1FDD, 0x1FDE, 0x1FDF,
+ 0x1FE0, 0x1FE1, 0x1FE2, 0x1FE3, 0x1FE4, 0x1FE5, 0x1FE6, 0x1FE7,
+ 0x1FE0, 0x1FE1, 0x1F7A, 0x1F7B, 0x1FE5, 0x1FED, 0x1FEE, 0x1FEF,
+ 0x0000, 0x0000, 0x1FF2, 0x1FF3, 0x1FF4, 0x0000, 0x1FF6, 0x1FF7,
+ 0x1F78, 0x1F79, 0x1F7C, 0x1F7D, 0x1FF3, 0x1FFD, 0x1FFE, 0x0000
+ };
+
+ static unsigned short const GreekExt_upper_mapping[] = {
+ 0x1F08, 0x1F09, 0x1F0A, 0x1F0B, 0x1F0C, 0x1F0D, 0x1F0E, 0x1F0F,
+ 0x1F08, 0x1F09, 0x1F0A, 0x1F0B, 0x1F0C, 0x1F0D, 0x1F0E, 0x1F0F,
+ 0x1F18, 0x1F19, 0x1F1A, 0x1F1B, 0x1F1C, 0x1F1D, 0x0000, 0x0000,
+ 0x1F18, 0x1F19, 0x1F1A, 0x1F1B, 0x1F1C, 0x1F1D, 0x0000, 0x0000,
+ 0x1F28, 0x1F29, 0x1F2A, 0x1F2B, 0x1F2C, 0x1F2D, 0x1F2E, 0x1F2F,
+ 0x1F28, 0x1F29, 0x1F2A, 0x1F2B, 0x1F2C, 0x1F2D, 0x1F2E, 0x1F2F,
+ 0x1F38, 0x1F39, 0x1F3A, 0x1F3B, 0x1F3C, 0x1F3D, 0x1F3E, 0x1F3F,
+ 0x1F38, 0x1F39, 0x1F3A, 0x1F3B, 0x1F3C, 0x1F3D, 0x1F3E, 0x1F3F,
+ 0x1F48, 0x1F49, 0x1F4A, 0x1F4B, 0x1F4C, 0x1F4D, 0x0000, 0x0000,
+ 0x1F48, 0x1F49, 0x1F4A, 0x1F4B, 0x1F4C, 0x1F4D, 0x0000, 0x0000,
+ 0x1F50, 0x1F59, 0x1F52, 0x1F5B, 0x1F54, 0x1F5D, 0x1F56, 0x1F5F,
+ 0x0000, 0x1F59, 0x0000, 0x1F5B, 0x0000, 0x1F5D, 0x0000, 0x1F5F,
+ 0x1F68, 0x1F69, 0x1F6A, 0x1F6B, 0x1F6C, 0x1F6D, 0x1F6E, 0x1F6F,
+ 0x1F68, 0x1F69, 0x1F6A, 0x1F6B, 0x1F6C, 0x1F6D, 0x1F6E, 0x1F6F,
+ 0x1FBA, 0x1FBB, 0x1FC8, 0x1FC9, 0x1FCA, 0x1FCB, 0x1FDA, 0x1FDB,
+ 0x1FF8, 0x1FF9, 0x1FEA, 0x1FEB, 0x1FFA, 0x1FFB, 0x0000, 0x0000,
+ 0x1F88, 0x1F89, 0x1F8A, 0x1F8B, 0x1F8C, 0x1F8D, 0x1F8E, 0x1F8F,
+ 0x1F88, 0x1F89, 0x1F8A, 0x1F8B, 0x1F8C, 0x1F8D, 0x1F8E, 0x1F8F,
+ 0x1F98, 0x1F99, 0x1F9A, 0x1F9B, 0x1F9C, 0x1F9D, 0x1F9E, 0x1F9F,
+ 0x1F98, 0x1F99, 0x1F9A, 0x1F9B, 0x1F9C, 0x1F9D, 0x1F9E, 0x1F9F,
+ 0x1FA8, 0x1FA9, 0x1FAA, 0x1FAB, 0x1FAC, 0x1FAD, 0x1FAE, 0x1FAF,
+ 0x1FA8, 0x1FA9, 0x1FAA, 0x1FAB, 0x1FAC, 0x1FAD, 0x1FAE, 0x1FAF,
+ 0x1FB8, 0x1FB9, 0x1FB2, 0x1FBC, 0x1FB4, 0x0000, 0x1FB6, 0x1FB7,
+ 0x1FB8, 0x1FB9, 0x1FBA, 0x1FBB, 0x1FBC, 0x1FBD, 0x0399, 0x1FBF,
+ 0x1FC0, 0x1FC1, 0x1FC2, 0x1FCC, 0x1FC4, 0x0000, 0x1FC6, 0x1FC7,
+ 0x1FC8, 0x1FC9, 0x1FCA, 0x1FCB, 0x1FCC, 0x1FCD, 0x1FCE, 0x1FCF,
+ 0x1FD8, 0x1FD9, 0x1FD2, 0x1FD3, 0x0000, 0x0000, 0x1FD6, 0x1FD7,
+ 0x1FD8, 0x1FD9, 0x1FDA, 0x1FDB, 0x0000, 0x1FDD, 0x1FDE, 0x1FDF,
+ 0x1FE8, 0x1FE9, 0x1FE2, 0x1FE3, 0x1FE4, 0x1FEC, 0x1FE6, 0x1FE7,
+ 0x1FE8, 0x1FE9, 0x1FEA, 0x1FEB, 0x1FEC, 0x1FED, 0x1FEE, 0x1FEF,
+ 0x0000, 0x0000, 0x1FF2, 0x1FFC, 0x1FF4, 0x0000, 0x1FF6, 0x1FF7,
+ 0x1FF8, 0x1FF9, 0x1FFA, 0x1FFB, 0x1FFC, 0x1FFD, 0x1FFE, 0x0000
+ };
+
+ *lower = code;
+ *upper = code;
+
+ /* Basic Latin and Latin-1 Supplement, U+0000 to U+00FF */
+ if (code <= 0x00ff) {
+ if (code >= 0x0041 && code <= 0x005a)
+ *lower += 0x20;
+ else if (code >= 0x0061 && code <= 0x007a)
+ *upper -= 0x20;
+ else if ( (code >= 0x00c0 && code <= 0x00d6) ||
+ (code >= 0x00d8 && code <= 0x00de) )
+ *lower += 0x20;
+ else if ( (code >= 0x00e0 && code <= 0x00f6) ||
+ (code >= 0x00f8 && code <= 0x00fe) )
+ *upper -= 0x20;
+ else if (code == 0x00ff)
+ *upper = 0x0178;
+ else if (code == 0x00b5)
+ *upper = 0x039c;
+ }
+
+ /* Latin Extended-A, U+0100 to U+017F */
+ if (code >= 0x0100 && code <= 0x017f) {
+ if ( (code >= 0x0100 && code <= 0x012f) ||
+ (code >= 0x0132 && code <= 0x0137) ||
+ (code >= 0x014a && code <= 0x0177) ) {
+ *upper = code & ~1;
+ *lower = code | 1;
+ }
+ else if ( (code >= 0x0139 && code <= 0x0148) ||
+ (code >= 0x0179 && code <= 0x017e) ) {
+ if (code & 1)
+ *lower += 1;
+ else
+ *upper -= 1;
+ }
+ else if (code == 0x0130)
+ *lower = 0x0069;
+ else if (code == 0x0131)
+ *upper = 0x0049;
+ else if (code == 0x0178)
+ *lower = 0x00ff;
+ else if (code == 0x017f)
+ *upper = 0x0053;
+ }
+
+ /* Latin Extended-B, U+0180 to U+024F */
+ if (code >= 0x0180 && code <= 0x024f) {
+ if (code >= 0x01cd && code <= 0x01dc) {
+ if (code & 1)
+ *lower += 1;
+ else
+ *upper -= 1;
+ }
+ else if ( (code >= 0x01de && code <= 0x01ef) ||
+ (code >= 0x01f4 && code <= 0x01f5) ||
+ (code >= 0x01f8 && code <= 0x021f) ||
+ (code >= 0x0222 && code <= 0x0233) ) {
+ *lower |= 1;
+ *upper &= ~1;
+ }
+ else if (code >= 0x0180 && code <= 0x01cc) {
+ *lower = LatinExtB_lower_mapping[code - 0x0180];
+ *upper = LatinExtB_upper_mapping[code - 0x0180];
+ }
+ else if (code == 0x01dd)
+ *upper = 0x018e;
+ else if (code == 0x01f1 || code == 0x01f2) {
+ *lower = 0x01f3;
+ *upper = 0x01f1;
+ }
+ else if (code == 0x01f3)
+ *upper = 0x01f1;
+ else if (code == 0x01f6)
+ *lower = 0x0195;
+ else if (code == 0x01f7)
+ *lower = 0x01bf;
+ else if (code == 0x0220)
+ *lower = 0x019e;
+ }
+
+ /* IPA Extensions, U+0250 to U+02AF */
+ if (code >= 0x0253 && code <= 0x0292) {
+ *upper = IPAExt_upper_mapping[code - 0x0253];
+ }
+
+ /* Combining Diacritical Marks, U+0300 to U+036F */
+ if (code == 0x0345) {
+ *upper = 0x0399;
+ }
+
+ /* Greek and Coptic, U+0370 to U+03FF */
+ if (code >= 0x0370 && code <= 0x03ff) {
+ *lower = Greek_lower_mapping[code - 0x0370];
+ *upper = Greek_upper_mapping[code - 0x0370];
+ if (*upper == 0)
+ *upper = code;
+ if (*lower == 0)
+ *lower = code;
+ }
+
+ /* Cyrillic and Cyrillic Supplementary, U+0400 to U+052F */
+ if ( (code >= 0x0400 && code <= 0x04ff) ||
+ (code >= 0x0500 && code <= 0x052f) ) {
+ if (code >= 0x0400 && code <= 0x040f)
+ *lower += 0x50;
+ else if (code >= 0x0410 && code <= 0x042f)
+ *lower += 0x20;
+ else if (code >= 0x0430 && code <= 0x044f)
+ *upper -= 0x20;
+ else if (code >= 0x0450 && code <= 0x045f)
+ *upper -= 0x50;
+ else if ( (code >= 0x0460 && code <= 0x0481) ||
+ (code >= 0x048a && code <= 0x04bf) ||
+ (code >= 0x04d0 && code <= 0x04f5) ||
+ (code >= 0x04f8 && code <= 0x04f9) ||
+ (code >= 0x0500 && code <= 0x050f) ) {
+ *upper &= ~1;
+ *lower |= 1;
+ }
+ else if (code >= 0x04c1 && code <= 0x04ce) {
+ if (code & 1)
+ *lower += 1;
+ else
+ *upper -= 1;
+ }
+ }
+
+ /* Armenian, U+0530 to U+058F */
+ if (code >= 0x0530 && code <= 0x058f) {
+ if (code >= 0x0531 && code <= 0x0556)
+ *lower += 0x30;
+ else if (code >=0x0561 && code <= 0x0586)
+ *upper -= 0x30;
+ }
+
+ /* Latin Extended Additional, U+1E00 to U+1EFF */
+ if (code >= 0x1e00 && code <= 0x1eff) {
+ if ( (code >= 0x1e00 && code <= 0x1e95) ||
+ (code >= 0x1ea0 && code <= 0x1ef9) ) {
+ *upper &= ~1;
+ *lower |= 1;
+ }
+ else if (code == 0x1e9b)
+ *upper = 0x1e60;
+ }
+
+ /* Greek Extended, U+1F00 to U+1FFF */
+ if (code >= 0x1f00 && code <= 0x1fff) {
+ *lower = GreekExt_lower_mapping[code - 0x1f00];
+ *upper = GreekExt_upper_mapping[code - 0x1f00];
+ if (*upper == 0)
+ *upper = code;
+ if (*lower == 0)
+ *lower = code;
+ }
+
+ /* Letterlike Symbols, U+2100 to U+214F */
+ if (code >= 0x2100 && code <= 0x214f) {
+ switch (code) {
+ case 0x2126: *lower = 0x03c9; break;
+ case 0x212a: *lower = 0x006b; break;
+ case 0x212b: *lower = 0x00e5; break;
+ }
+ }
+ /* Number Forms, U+2150 to U+218F */
+ else if (code >= 0x2160 && code <= 0x216f)
+ *lower += 0x10;
+ else if (code >= 0x2170 && code <= 0x217f)
+ *upper -= 0x10;
+ /* Enclosed Alphanumerics, U+2460 to U+24FF */
+ else if (code >= 0x24b6 && code <= 0x24cf)
+ *lower += 0x1a;
+ else if (code >= 0x24d0 && code <= 0x24e9)
+ *upper -= 0x1a;
+ /* Halfwidth and Fullwidth Forms, U+FF00 to U+FFEF */
+ else if (code >= 0xff21 && code <= 0xff3a)
+ *lower += 0x20;
+ else if (code >= 0xff41 && code <= 0xff5a)
+ *upper -= 0x20;
+ /* Deseret, U+10400 to U+104FF */
+ else if (code >= 0x10400 && code <= 0x10427)
+ *lower += 0x28;
+ else if (code >= 0x10428 && code <= 0x1044f)
+ *upper -= 0x28;
+}
+
void
XConvertCase(sym, lower, upper)
register KeySym sym;
KeySym *lower;
KeySym *upper;
{
+ /* Unicode keysym */
+ if ((sym & 0xff000000) == 0x01000000) {
+ UCSConvertCase((sym & 0x00ffffff), lower, upper);
+ *upper |= 0x01000000;
+ *lower |= 0x01000000;
+ return;
+ }
+
*lower = sym;
*upper = sym;
+
switch(sym >> 8) {
case 0: /* Latin 1 */
if ((sym >= XK_A) && (sym <= XK_Z))
@@ -309,6 +670,8 @@ XConvertCase(sym, lower, upper)
*lower += (XK_oslash - XK_Ooblique);
else if ((sym >= XK_oslash) && (sym <= XK_thorn))
*upper -= (XK_oslash - XK_Ooblique);
+ else if (sym == XK_ydiaeresis)
+ *upper = XK_Ydiaeresis; /* actually a Latin 9 character */
break;
case 1: /* Latin 2 */
/* Assume the KeySym is a legal value (ignore discontinuities) */
@@ -388,24 +751,119 @@ XConvertCase(sym, lower, upper)
sym != XK_Greek_finalsmallsigma)
*upper -= (XK_Greek_alpha - XK_Greek_ALPHA);
break;
+ case 0x12: /* Latin 8 */
+ /* No neat pattern to the values */
+ switch (sym) {
+ case XK_Babovedot:
+ *lower = XK_babovedot; break;
+ case XK_babovedot:
+ *upper = XK_Babovedot; break;
+ case XK_Dabovedot:
+ *lower = XK_dabovedot; break;
+ case XK_Wgrave:
+ *lower = XK_wgrave; break;
+ case XK_Wacute:
+ *lower = XK_wacute; break;
+ case XK_dabovedot:
+ *upper = XK_Dabovedot; break;
+ case XK_Ygrave:
+ *lower = XK_ygrave; break;
+ case XK_Fabovedot:
+ *lower = XK_fabovedot; break;
+ case XK_fabovedot:
+ *upper = XK_Fabovedot; break;
+ case XK_Mabovedot:
+ *lower = XK_mabovedot; break;
+ case XK_mabovedot:
+ *upper = XK_Mabovedot; break;
+ case XK_Pabovedot:
+ *lower = XK_pabovedot; break;
+ case XK_wgrave:
+ *upper = XK_Wgrave; break;
+ case XK_pabovedot:
+ *upper = XK_Pabovedot; break;
+ case XK_wacute:
+ *upper = XK_Wacute; break;
+ case XK_Sabovedot:
+ *lower = XK_sabovedot; break;
+ case XK_ygrave:
+ *upper = XK_Ygrave; break;
+ case XK_Wdiaeresis:
+ *lower = XK_wdiaeresis; break;
+ case XK_wdiaeresis:
+ *upper = XK_Wdiaeresis; break;
+ case XK_sabovedot:
+ *upper = XK_Sabovedot; break;
+ case XK_Wcircumflex:
+ *lower = XK_wcircumflex; break;
+ case XK_Tabovedot:
+ *lower = XK_tabovedot; break;
+ case XK_Ycircumflex:
+ *lower = XK_ycircumflex; break;
+ case XK_wcircumflex:
+ *upper = XK_Wcircumflex; break;
+ case XK_tabovedot:
+ *upper = XK_Tabovedot; break;
+ case XK_ycircumflex:
+ *upper = XK_Ycircumflex; break;
+ }
+ break;
+ case 0x13: /* Latin 9 */
+ if (sym == XK_OE)
+ *lower = XK_oe;
+ else if (sym == XK_oe)
+ *upper = XK_OE;
+ else if (sym == XK_Ydiaeresis)
+ *lower = XK_ydiaeresis;
+ break;
+ case 0x14: /* Armenian */
+ if (sym >= XK_Armenian_AYB && sym <= XK_Armenian_fe) {
+ *lower = sym | 1;
+ *upper = sym & ~1;
+ }
+ break;
+ case 0x16: /* Caucasus, Inupiak, Guarani */
+ if (sym == XK_ocaron || sym == XK_Ocaron) {
+ *upper = XK_Ocaron;
+ *lower = XK_ocaron;
+ }
+ else if (sym >= XK_Ccedillaabovedot && sym <= XK_Obarred)
+ *lower += (XK_ccedillaabovedot - XK_Ccedillaabovedot);
+ else if (sym >= XK_ccedillaabovedot && sym <= XK_obarred)
+ *upper -= (XK_ccedillaabovedot - XK_Ccedillaabovedot);
+ else if (sym == XK_schwa || sym == XK_SCHWA) {
+ *lower = XK_schwa;
+ *upper = XK_SCHWA;
+ }
+ else if (sym == XK_lbelowdot || sym == XK_Lbelowdot) {
+ *lower = XK_lbelowdot;
+ *upper = XK_Lbelowdot;
+ }
+ else if (sym == XK_lstrokebelowdot || sym == XK_Lstrokebelowdot) {
+ *lower = XK_lstrokebelowdot;
+ *upper = XK_Lstrokebelowdot;
+ }
+ else if (sym == XK_gtilde || sym == XK_Gtilde) {
+ *lower = XK_gtilde;
+ *upper = XK_Gtilde;
+ }
+ break;
+ case 0x1e: /* Vietnamese */
+ if ((sym >= XK_Abelowdot && sym <= XK_uhornbelowdot) ||
+ (sym >= XK_Ybelowdot && sym <= XK_uhorn)) {
+ *lower = sym | 1;
+ *upper = sym & ~1;
+ }
+ break;
}
}
int
-#if NeedFunctionPrototypes
_XTranslateKey( register Display *dpy,
KeyCode keycode,
register unsigned int modifiers,
unsigned int *modifiers_return,
KeySym *keysym_return)
-#else
-_XTranslateKey(dpy, keycode, modifiers, modifiers_return, keysym_return)
- register Display *dpy;
- KeyCode keycode;
- register unsigned int modifiers;
- unsigned int *modifiers_return;
- KeySym *keysym_return;
-#endif
{
int per;
register KeySym *syms;
@@ -610,8 +1068,8 @@ XLookupString (event, buffer, nbytes, keysym, status)
}
static void
-_XFreeKeyBindings (dpy)
- Display *dpy;
+_XFreeKeyBindings(
+ Display *dpy)
{
register struct _XKeytrans *p, *np;
@@ -623,7 +1081,7 @@ _XFreeKeyBindings (dpy)
}
}
-#if NeedFunctionPrototypes
+int
XRebindKeysym (
Display *dpy,
KeySym keysym,
@@ -631,15 +1089,6 @@ XRebindKeysym (
int nm, /* number of modifiers in mlist */
_Xconst unsigned char *str,
int nbytes)
-#else
-XRebindKeysym (dpy, keysym, mlist, nm, str, nbytes)
- Display *dpy;
- KeySym keysym;
- KeySym *mlist;
- int nm; /* number of modifiers in mlist */
- unsigned char *str;
- int nbytes;
-#endif
{
register struct _XKeytrans *tmp, *p;
int nb;
@@ -678,9 +1127,9 @@ XRebindKeysym (dpy, keysym, mlist, nm, str, nbytes)
}
unsigned
-_XKeysymToModifiers(dpy,ks)
- Display *dpy;
- KeySym ks;
+_XKeysymToModifiers(
+ Display *dpy,
+ KeySym ks)
{
CARD8 code,mods;
register KeySym *kmax;
@@ -717,9 +1166,9 @@ _XKeysymToModifiers(dpy,ks)
* can't map some keysym to a modifier.
*/
static void
-ComputeMaskFromKeytrans(dpy, p)
- Display *dpy;
- register struct _XKeytrans *p;
+ComputeMaskFromKeytrans(
+ Display *dpy,
+ register struct _XKeytrans *p)
{
register int i;
diff --git a/src/KeysymStr.c b/src/KeysymStr.c
index 1e94a5d7..5a21f05f 100644
--- a/src/KeysymStr.c
+++ b/src/KeysymStr.c
@@ -25,24 +25,19 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/KeysymStr.c,v 3.9 2003/04/13 19:22:16 dawes Exp $ */
#include "Xlibint.h"
#include <X11/Xresource.h>
#include <X11/keysymdef.h>
-#ifdef __STDC__
-#define Const const
-#else
-#define Const /**/
-#endif
+#include <stdio.h> /* sprintf */
typedef unsigned long Signature;
#define NEEDVTABLE
#include "ks_tables.h"
-
-extern XrmDatabase _XInitKeysymDB();
-extern Const unsigned char _XkeyTable[];
+#include "Key.h"
typedef struct _GRNData {
@@ -51,9 +46,9 @@ typedef struct _GRNData {
XrmValuePtr value;
} GRNData;
-#if NeedFunctionPrototypes
/*ARGSUSED*/
-static Bool SameValue(
+static Bool
+SameValue(
XrmDatabase* db,
XrmBindingList bindings,
XrmQuarkList quarks,
@@ -61,15 +56,6 @@ static Bool SameValue(
XrmValuePtr value,
XPointer data
)
-#else
-static Bool SameValue(db, bindings, quarks, type, value, data)
- XrmDatabase *db;
- XrmBindingList bindings;
- XrmQuarkList quarks;
- XrmRepresentation *type;
- XrmValuePtr value;
- XPointer data;
-#endif
{
GRNData *gd = (GRNData *)data;
@@ -88,7 +74,7 @@ char *XKeysymToString(ks)
register int i, n;
int h;
register int idx;
- Const unsigned char *entry;
+ const unsigned char *entry;
unsigned char val1, val2;
XrmDatabase keysymdb;
@@ -131,7 +117,32 @@ char *XKeysymToString(ks)
data.value = &resval;
(void)XrmEnumerateDatabase(keysymdb, &empty, &empty, XrmEnumAllLevels,
SameValue, (XPointer)&data);
- return data.name;
+ if (data.name)
+ return data.name;
+ }
+ if ((ks & 0xff000000) == 0x01000000){
+ KeySym val = ks & 0xffffff;
+ char *s;
+ int i;
+ if (val & 0xff0000)
+ i = 10;
+ else
+ i = 6;
+ s = Xmalloc(i);
+ if (s == NULL)
+ return s;
+ i--;
+ s[i--] = '\0';
+ for (; i; i--){
+ val1 = val & 0xf;
+ val >>= 4;
+ if (val1 < 10)
+ s[i] = '0'+ val1;
+ else
+ s[i] = 'A'+ val1 - 10;
+ }
+ s[i] = 'U';
+ return s;
}
return ((char *) NULL);
}
diff --git a/src/KillCl.c b/src/KillCl.c
index 750ea825..6f05057c 100644
--- a/src/KillCl.c
+++ b/src/KillCl.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/KillCl.c,v 1.3 2001/01/17 19:41:38 dawes Exp $ */
#include "Xlibint.h"
+int
XKillClient(dpy, resource)
register Display *dpy;
XID resource;
diff --git a/src/LiHosts.c b/src/LiHosts.c
index 2f22d71d..406c8550 100644
--- a/src/LiHosts.c
+++ b/src/LiHosts.c
@@ -1,27 +1,38 @@
/* $Xorg: LiHosts.c,v 1.4 2001/02/09 02:03:34 xorgcvs Exp $ */
+/* $XdotOrg: lib/X11/src/LiHosts.c,v 1.2 2004-04-23 18:43:24 eich Exp $ */
/*
Copyright 1986, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
+Copyright 2004 Sun Microsystems, Inc.
+
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, and/or sell copies of the Software, and to permit persons
+to whom the Software is furnished to do so, provided that the above
+copyright notice(s) and this permission notice appear in all copies of
+the Software and that both the above copyright notice(s) and this
+permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
+INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
+FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder
+shall not be used in advertising or otherwise to promote the sale, use
+or other dealings in this Software without prior written authorization
+of the copyright holder.
+
+X Window System is a trademark of The Open Group.
*/
@@ -33,17 +44,18 @@ in this Software without prior written authorization from The Open Group.
* can be freed using XFree.
*/
-XHostAddress *XListHosts (dpy, nhosts, enabled)
- register Display *dpy;
- int *nhosts; /* RETURN */
- Bool *enabled; /* RETURN */
- {
+XHostAddress *XListHosts (
+ register Display *dpy,
+ int *nhosts, /* RETURN */
+ Bool *enabled) /* RETURN */
+{
register XHostAddress *outbuf = 0, *op;
xListHostsReply reply;
long nbytes;
unsigned char *buf, *bp;
register unsigned i;
register xListHostsReq *req;
+ XServerInterpretedAddress *sip;
*nhosts = 0;
LockDisplay(dpy);
@@ -56,9 +68,15 @@ XHostAddress *XListHosts (dpy, nhosts, enabled)
}
if (reply.nHosts) {
+ unsigned int l;
nbytes = reply.length << 2; /* compute number of bytes in reply */
+ l = (unsigned) (nbytes +
+ (reply.nHosts * sizeof(XHostAddress)) +
+ (reply.nHosts * sizeof(XServerInterpretedAddress)));
op = outbuf = (XHostAddress *)
- Xmalloc((unsigned) (nbytes + reply.nHosts * sizeof(XHostAddress)));
+ Xmalloc((unsigned) (nbytes +
+ (reply.nHosts * sizeof(XHostAddress)) +
+ (reply.nHosts * sizeof(XServerInterpretedAddress))));
if (! outbuf) {
_XEatData(dpy, (unsigned long) nbytes);
@@ -66,8 +84,10 @@ XHostAddress *XListHosts (dpy, nhosts, enabled)
SyncHandle();
return (XHostAddress *) NULL;
}
- bp = buf =
- ((unsigned char *) outbuf) + reply.nHosts * sizeof(XHostAddress);
+ sip = (XServerInterpretedAddress *)
+ (((unsigned char *) outbuf) + (reply.nHosts * sizeof(XHostAddress)));
+ bp = buf = ((unsigned char *) sip)
+ + (reply.nHosts * sizeof(XServerInterpretedAddress));
_XRead (dpy, (char *) buf, nbytes);
@@ -81,7 +101,24 @@ XHostAddress *XListHosts (dpy, nhosts, enabled)
op->family = ((xHostEntry *) bp)->family;
op->length =((xHostEntry *) bp)->length;
#endif
- op->address = (char *) (bp + SIZEOF(xHostEntry));
+ if (op->family == FamilyServerInterpreted) {
+ char *tp = (char *) (bp + SIZEOF(xHostEntry));
+ char *vp = memchr(tp, 0, op->length);
+
+ if (vp != NULL) {
+ sip->type = tp;
+ sip->typelength = vp - tp;
+ sip->value = vp + 1;
+ sip->valuelength = op->length - (sip->typelength + 1);
+ } else {
+ sip->type = sip->value = NULL;
+ sip->typelength = sip->valuelength = 0;
+ }
+ op->address = (char *) sip;
+ sip++;
+ } else {
+ op->address = (char *) (bp + SIZEOF(xHostEntry));
+ }
bp += SIZEOF(xHostEntry) + (((op->length + 3) >> 2) << 2);
op++;
}
diff --git a/src/LiICmaps.c b/src/LiICmaps.c
index 93076cc7..93a45025 100644
--- a/src/LiICmaps.c
+++ b/src/LiICmaps.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/LiICmaps.c,v 1.3 2001/01/17 19:41:39 dawes Exp $ */
#define NEED_REPLIES
#include "Xlibint.h"
@@ -58,7 +59,7 @@ int *n; /* RETURN */
SyncHandle();
return((Colormap *) NULL);
}
- _XRead32 (dpy, (char *) cmaps, nbytes);
+ _XRead32 (dpy, (long *) cmaps, nbytes);
}
else cmaps = (Colormap *) NULL;
diff --git a/src/LiProps.c b/src/LiProps.c
index ae733d74..346b8cac 100644
--- a/src/LiProps.c
+++ b/src/LiProps.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/LiProps.c,v 1.3 2001/01/17 19:41:39 dawes Exp $ */
#define NEED_REPLIES
#include "Xlibint.h"
@@ -57,7 +58,7 @@ int *n_props; /* RETURN */
SyncHandle();
return (Atom *) NULL;
}
- _XRead32 (dpy, (char *) properties, nbytes);
+ _XRead32 (dpy, (long *) properties, nbytes);
}
else properties = (Atom *) NULL;
diff --git a/src/ListExt.c b/src/ListExt.c
index 6d626be9..e0a35c20 100644
--- a/src/ListExt.c
+++ b/src/ListExt.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/ListExt.c,v 1.3 2001/01/17 19:41:39 dawes Exp $ */
#define NEED_REPLIES
#include "Xlibint.h"
@@ -85,6 +86,7 @@ int *nextensions; /* RETURN */
return (list);
}
+int
XFreeExtensionList (list)
char **list;
{
diff --git a/src/LoadFont.c b/src/LoadFont.c
index 6dd96ad6..bffdafe8 100644
--- a/src/LoadFont.c
+++ b/src/LoadFont.c
@@ -24,22 +24,22 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/LoadFont.c,v 1.4 2001/12/14 19:54:02 dawes Exp $ */
#include "Xlibint.h"
-#if NeedFunctionPrototypes
-Font XLoadFont (
+Font
+XLoadFont (
register Display *dpy,
_Xconst char *name)
-#else
-Font XLoadFont (dpy, name)
- register Display *dpy;
- char *name;
-#endif
{
register long nbytes;
Font fid;
register xOpenFontReq *req;
+
+ if (_XF86LoadQueryLocaleFont(dpy, name, (XFontStruct **)0, &fid))
+ return fid;
+
LockDisplay(dpy);
GetReq(OpenFont, req);
nbytes = req->nbytes = name ? strlen(name) : 0;
diff --git a/src/LockDis.c b/src/LockDis.c
index 91766791..96aabe45 100644
--- a/src/LockDis.c
+++ b/src/LockDis.c
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86$ */
/*
* Author: Stephen Gildea, MIT X Consortium
@@ -37,13 +38,9 @@ in this Software without prior written authorization from The Open Group.
#include "locking.h"
#endif
-#if NeedFunctionPrototypes
-void XLockDisplay(
+void
+XLockDisplay(
register Display* dpy)
-#else
-void XLockDisplay(dpy)
- register Display* dpy;
-#endif
{
#ifdef XTHREADS
LockDisplay(dpy);
@@ -73,13 +70,9 @@ void XLockDisplay(dpy)
#endif
}
-#if NeedFunctionPrototypes
-void XUnlockDisplay(
+void
+XUnlockDisplay(
register Display* dpy)
-#else
-void XUnlockDisplay(dpy)
- register Display* dpy;
-#endif
{
#ifdef XTHREADS
LockDisplay(dpy);
diff --git a/src/LookupCol.c b/src/LookupCol.c
index b7f56d3d..e68625e8 100644
--- a/src/LookupCol.c
+++ b/src/LookupCol.c
@@ -24,29 +24,21 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/LookupCol.c,v 1.6 2003/04/13 19:22:16 dawes Exp $ */
#define NEED_REPLIES
#include <stdio.h>
#include "Xlibint.h"
#include "Xcmsint.h"
-extern void _XcmsRGB_to_XColor();
-extern void _XUnresolveColor();
-#if NeedFunctionPrototypes
-Status XLookupColor (
+Status
+XLookupColor (
register Display *dpy,
Colormap cmap,
_Xconst char *spec,
XColor *def,
XColor *scr)
-#else
-Status XLookupColor (dpy, cmap, spec, def, scr)
- register Display *dpy;
- Colormap cmap;
- char *spec;
- XColor *def, *scr;
-#endif
{
register int n;
xLookupColorReply reply;
@@ -57,22 +49,28 @@ Status XLookupColor (dpy, cmap, spec, def, scr)
/*
* Let's Attempt to use Xcms and i18n approach to Parse Color
*/
- /* copy string to allow overwrite by _XcmsResolveColorString() */
if ((ccc = XcmsCCCOfColormap(dpy, cmap)) != (XcmsCCC)NULL) {
- if (_XcmsResolveColorString(ccc, &spec,
- &cmsColor_exact, XcmsRGBFormat) >= XcmsSuccess) {
+ const char *tmpName = spec;
+
+ switch (_XcmsResolveColorString(ccc, &tmpName, &cmsColor_exact,
+ XcmsRGBFormat)) {
+ case XcmsSuccess:
+ case XcmsSuccessWithCompression:
_XcmsRGB_to_XColor(&cmsColor_exact, def, 1);
memcpy((char *)scr, (char *)def, sizeof(XColor));
_XUnresolveColor(ccc, scr);
return(1);
+ case XcmsFailure:
+ case _XCMS_NEWNAME:
+ /*
+ * if the result was _XCMS_NEWNAME tmpName points to
+ * a string in cmsColNm.c:pairs table, for example,
+ * gray70 would become tekhvc:0.0/70.0/0.0
+ */
+ break;
}
- /*
- * Otherwise we failed; or spec was changed with yet another
- * name. Thus pass name to the X Server.
- */
}
-
/*
* Xcms and i18n methods failed, so lets pass it to the server
* for parsing.
diff --git a/src/LowerWin.c b/src/LowerWin.c
index fb53df0a..1a639deb 100644
--- a/src/LowerWin.c
+++ b/src/LowerWin.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/LowerWin.c,v 1.3 2001/01/17 19:41:39 dawes Exp $ */
#include "Xlibint.h"
+int
XLowerWindow(dpy, w)
Display *dpy;
Window w;
diff --git a/src/Macros.c b/src/Macros.c
index 61188588..cc7c6172 100644
--- a/src/Macros.c
+++ b/src/Macros.c
@@ -24,8 +24,12 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/Macros.c,v 1.4 2001/12/14 19:54:02 dawes Exp $ */
#include "Xlibint.h"
+#define XUTIL_DEFINE_FUNCTIONS
+#include "Xutil.h"
+
/*
* This file makes full definitions of routines for each macro.
* We do not expect C programs to use these, but other languages may
@@ -198,44 +202,46 @@ int XScreenNumberOfScreen (scr)
* naive people are more comfortable with them.
*/
#undef XDestroyImage
-XDestroyImage(ximage)
- XImage *ximage;
+int
+XDestroyImage(
+ XImage *ximage)
{
return((*((ximage)->f.destroy_image))((ximage)));
}
#undef XGetPixel
-unsigned long XGetPixel(ximage, x, y)
- XImage *ximage;
- int x, y;
+unsigned long XGetPixel(
+ XImage *ximage,
+ int x, int y)
{
return ((*((ximage)->f.get_pixel))((ximage), (x), (y)));
}
#undef XPutPixel
-int XPutPixel(ximage, x, y, pixel)
- XImage *ximage;
- int x, y;
- unsigned long pixel;
+int XPutPixel(
+ XImage *ximage,
+ int x, int y,
+ unsigned long pixel)
{
return((*((ximage)->f.put_pixel))((ximage), (x), (y), (pixel)));
}
#undef XSubImage
-XImage *XSubImage(ximage, x, y, width, height)
- XImage *ximage;
- int x, y;
- unsigned int width, height;
+XImage *XSubImage(
+ XImage *ximage,
+ int x, int y,
+ unsigned int width, unsigned int height)
{
return((*((ximage)->f.sub_image))((ximage), (x),
(y), (width), (height)));
}
#undef XAddPixel
-int XAddPixel(ximage, value)
- XImage *ximage;
- long value;
+int XAddPixel(
+ XImage *ximage,
+ long value)
{
return((*((ximage)->f.add_pixel))((ximage), (value)));
}
+int
XNoOp (dpy)
register Display *dpy;
{
diff --git a/src/MapRaised.c b/src/MapRaised.c
index e00cb75a..fc98179d 100644
--- a/src/MapRaised.c
+++ b/src/MapRaised.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/MapRaised.c,v 1.3 2001/01/17 19:41:40 dawes Exp $ */
#include "Xlibint.h"
+int
XMapRaised (dpy, w)
Window w;
register Display *dpy;
diff --git a/src/MapSubs.c b/src/MapSubs.c
index 39589e93..8c07b7d5 100644
--- a/src/MapSubs.c
+++ b/src/MapSubs.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/MapSubs.c,v 1.3 2001/01/17 19:41:40 dawes Exp $ */
#include "Xlibint.h"
+int
XMapSubwindows(dpy, win)
register Display *dpy;
Window win;
diff --git a/src/MapWindow.c b/src/MapWindow.c
index e0c06efe..5258fd91 100644
--- a/src/MapWindow.c
+++ b/src/MapWindow.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/MapWindow.c,v 1.3 2001/01/17 19:41:40 dawes Exp $ */
#include "Xlibint.h"
+int
XMapWindow (dpy, w)
Window w;
register Display *dpy;
diff --git a/src/MaskEvent.c b/src/MaskEvent.c
index c51d7b9d..94db3ae2 100644
--- a/src/MaskEvent.c
+++ b/src/MaskEvent.c
@@ -24,17 +24,12 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/MaskEvent.c,v 3.5 2001/10/28 03:32:30 tsi Exp $ */
#define NEED_EVENTS
#include "Xlibint.h"
-#ifdef __STDC__
-#define Const const
-#else
-#define Const /**/
-#endif
-
-extern long Const _Xevent_to_mask[];
+extern long const _Xevent_to_mask[];
#define AllPointers (PointerMotionMask|PointerMotionHintMask|ButtonMotionMask)
#define AllButtons (Button1MotionMask|Button2MotionMask|Button3MotionMask|\
Button4MotionMask|Button5MotionMask)
@@ -45,13 +40,14 @@ extern long Const _Xevent_to_mask[];
* Events earlier in the queue are not discarded.
*/
+int
XMaskEvent (dpy, mask, event)
register Display *dpy;
long mask; /* Selected event mask. */
register XEvent *event; /* XEvent to be filled in. */
{
register _XQEvent *prev, *qelt;
- unsigned long qe_serial;
+ unsigned long qe_serial = 0;
LockDisplay(dpy);
prev = NULL;
diff --git a/src/Misc.c b/src/Misc.c
index 3b0b17d8..bd017bad 100644
--- a/src/Misc.c
+++ b/src/Misc.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/Misc.c,v 1.3 2001/01/17 19:41:40 dawes Exp $ */
#include "Xlibint.h"
@@ -45,6 +46,7 @@ unsigned long XDisplayMotionBufferSize(dpy)
return dpy->motion_buffer;
}
+int
XDisplayKeycodes(dpy, min_keycode_return, max_keycode_return)
Display *dpy;
int *min_keycode_return, *max_keycode_return;
diff --git a/src/ModMap.c b/src/ModMap.c
index 51a32101..8740bd82 100644
--- a/src/ModMap.c
+++ b/src/ModMap.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/ModMap.c,v 1.4 2001/12/14 19:54:03 dawes Exp $ */
#define NEED_REPLIES
#include "Xlibint.h"
@@ -108,6 +109,7 @@ XNewModifiermap(keyspermodifier)
}
+int
XFreeModifiermap(map)
XModifierKeymap *map;
{
@@ -119,7 +121,6 @@ XFreeModifiermap(map)
return 1;
}
-#if NeedFunctionPrototypes
XModifierKeymap *
XInsertModifiermapEntry(XModifierKeymap *map,
#if NeedWidePrototypes
@@ -128,13 +129,6 @@ XInsertModifiermapEntry(XModifierKeymap *map,
KeyCode keycode,
#endif
int modifier)
-#else
-XModifierKeymap *
-XInsertModifiermapEntry(map, keycode, modifier)
- XModifierKeymap *map;
- KeyCode keycode;
- int modifier;
-#endif
{
XModifierKeymap *newmap;
int i,
@@ -169,7 +163,6 @@ XInsertModifiermapEntry(map, keycode, modifier)
return(newmap);
}
-#if NeedFunctionPrototypes
XModifierKeymap *
XDeleteModifiermapEntry(XModifierKeymap *map,
#if NeedWidePrototypes
@@ -178,13 +171,6 @@ XDeleteModifiermapEntry(XModifierKeymap *map,
KeyCode keycode,
#endif
int modifier)
-#else
-XModifierKeymap *
-XDeleteModifiermapEntry(map, keycode, modifier)
- XModifierKeymap *map;
- KeyCode keycode;
- int modifier;
-#endif
{
int i,
row = modifier * map->max_keypermod;
diff --git a/src/MoveWin.c b/src/MoveWin.c
index 0ec2c8a8..c693065b 100644
--- a/src/MoveWin.c
+++ b/src/MoveWin.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/MoveWin.c,v 1.3 2001/01/17 19:41:40 dawes Exp $ */
#include "Xlibint.h"
+int
XMoveWindow (dpy, w, x, y)
register Display *dpy;
Window w;
diff --git a/src/NextEvent.c b/src/NextEvent.c
index 40e7528a..82805b57 100644
--- a/src/NextEvent.c
+++ b/src/NextEvent.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/NextEvent.c,v 1.3 2001/01/17 19:41:40 dawes Exp $ */
#define NEED_EVENTS
#include "Xlibint.h"
@@ -33,6 +34,7 @@ in this Software without prior written authorization from The Open Group.
* events.
*/
+int
XNextEvent (dpy, event)
register Display *dpy;
register XEvent *event;
diff --git a/src/OCWrap.c b/src/OCWrap.c
index 97a3aee0..bd74f1e1 100644
--- a/src/OCWrap.c
+++ b/src/OCWrap.c
@@ -23,30 +23,24 @@
* Author: Katsuhisa Yano TOSHIBA Corp.
* mopi@osa.ilab.toshiba.co.jp
*/
+/* $XFree86: xc/lib/X11/OCWrap.c,v 1.3 2001/01/17 19:41:40 dawes Exp $ */
#include "Xlibint.h"
#include "Xlcint.h"
-#if NeedVarargsPrototypes
XOC
XCreateOC(XOM om, ...)
-#else
-XOC
-XCreateOC(om, va_alist)
- XOM om;
- va_dcl
-#endif
{
va_list var;
XlcArgList args;
XOC oc;
int num_args;
- Va_start(var, om);
+ va_start(var, om);
_XlcCountVaList(var, &num_args);
va_end(var);
- Va_start(var, om);
+ va_start(var, om);
_XlcVaToArgList(var, num_args, &args);
va_end(var);
@@ -94,26 +88,19 @@ XOMOfOC(oc)
return oc->core.om;
}
-#if NeedVarargsPrototypes
char *
XSetOCValues(XOC oc, ...)
-#else
-char *
-XSetOCValues(oc, va_alist)
- XOC oc;
- va_dcl
-#endif
{
va_list var;
XlcArgList args;
char *ret;
int num_args;
- Va_start(var, oc);
+ va_start(var, oc);
_XlcCountVaList(var, &num_args);
va_end(var);
- Va_start(var, oc);
+ va_start(var, oc);
_XlcVaToArgList(var, num_args, &args);
va_end(var);
@@ -127,26 +114,19 @@ XSetOCValues(oc, va_alist)
return ret;
}
-#if NeedVarargsPrototypes
char *
XGetOCValues(XOC oc, ...)
-#else
-char *
-XGetOCValues(oc, va_alist)
- XOC oc;
- va_dcl
-#endif
{
va_list var;
XlcArgList args;
char *ret;
int num_args;
- Va_start(var, oc);
+ va_start(var, oc);
_XlcCountVaList(var, &num_args);
va_end(var);
- Va_start(var, oc);
+ va_start(var, oc);
_XlcVaToArgList(var, num_args, &args);
va_end(var);
diff --git a/src/OMWrap.c b/src/OMWrap.c
index d97bd647..988b63a5 100644
--- a/src/OMWrap.c
+++ b/src/OMWrap.c
@@ -23,21 +23,14 @@
* Author: Katsuhisa Yano TOSHIBA Corp.
* mopi@osa.ilab.toshiba.co.jp
*/
+/* $XFree86: xc/lib/X11/OMWrap.c,v 1.4 2001/07/25 15:04:44 dawes Exp $ */
#include "Xlibint.h"
#include "Xlcint.h"
XOM
-#if NeedFunctionPrototypes
XOpenOM(Display *dpy, XrmDatabase rdb, _Xconst char *res_name,
_Xconst char *res_class)
-#else
-XOpenOM(dpy, rdb, res_name, res_class)
- Display *dpy;
- XrmDatabase rdb;
- char *res_name;
- char *res_class;
-#endif
{
XLCd lcd = _XOpenLC((char *) NULL);
@@ -71,26 +64,19 @@ XCloseOM(om)
return (*om->methods->close)(om);
}
-#if NeedVarargsPrototypes
char *
XSetOMValues(XOM om, ...)
-#else
-char *
-XSetOMValues(om, va_alist)
- XOM om;
- va_dcl
-#endif
{
va_list var;
XlcArgList args;
char *ret;
int num_args;
- Va_start(var, om);
+ va_start(var, om);
_XlcCountVaList(var, &num_args);
va_end(var);
- Va_start(var, om);
+ va_start(var, om);
_XlcVaToArgList(var, num_args, &args);
va_end(var);
@@ -104,26 +90,19 @@ XSetOMValues(om, va_alist)
return ret;
}
-#if NeedVarargsPrototypes
char *
XGetOMValues(XOM om, ...)
-#else
-char *
-XGetOMValues(om, va_alist)
- XOM om;
- va_dcl
-#endif
{
va_list var;
XlcArgList args;
char *ret;
int num_args;
- Va_start(var, om);
+ va_start(var, om);
_XlcCountVaList(var, &num_args);
va_end(var);
- Va_start(var, om);
+ va_start(var, om);
_XlcVaToArgList(var, num_args, &args);
va_end(var);
diff --git a/src/OpenDis.c b/src/OpenDis.c
index 6207fdd2..f9a148d7 100644
--- a/src/OpenDis.c
+++ b/src/OpenDis.c
@@ -24,18 +24,21 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/OpenDis.c,v 3.16 2003/07/04 16:24:23 eich Exp $ */
#define NEED_REPLIES
#define NEED_EVENTS
#include "Xlibint.h"
#include <X11/Xtrans.h>
#include <X11/Xatom.h>
+#include <X11/Xresource.h>
#include "bigreqstr.h"
#include <stdio.h>
+#include "Xintconn.h"
-#ifdef X_NOT_STDC_ENV
-extern char *getenv();
-#endif
+#ifdef XKB
+#include "XKBlib.h"
+#endif /* XKB */
#ifdef X_NOT_POSIX
#define Size_t unsigned int
@@ -50,43 +53,37 @@ typedef struct {
int opcode;
} _XBigReqState;
-extern int _Xdebug;
#ifdef WIN32
int *_Xdebug_p = &_Xdebug;
#endif
#ifdef XTHREADS
-int (*_XInitDisplayLock_fn)() = NULL;
-void (*_XFreeDisplayLock_fn)() = NULL;
+#include "locking.h"
+int (*_XInitDisplayLock_fn)(Display *dpy) = NULL;
+void (*_XFreeDisplayLock_fn)(Display *dpy) = NULL;
#define InitDisplayLock(d) (_XInitDisplayLock_fn ? (*_XInitDisplayLock_fn)(d) : Success)
#define FreeDisplayLock(d) if (_XFreeDisplayLock_fn) (*_XFreeDisplayLock_fn)(d)
#else
#define InitDisplayLock(dis) Success
#define FreeDisplayLock(dis)
-#endif
+#endif /* XTHREADS */
static xReq _dummy_request = {
0, 0, 0
};
-static void OutOfMemory();
-static Bool _XBigReqHandler();
+static void OutOfMemory(Display *dpy, char *setup);
+static Bool _XBigReqHandler(Display *dpy, xReply *rep, char *buf, int len,
+ XPointer data);
-extern Bool _XWireToEvent();
-extern Status _XUnknownNativeEvent();
-extern Bool _XUnknownWireEvent();
/*
* Connects to a server, creates a Display object and returns a pointer to
* the newly created Display back to the caller.
*/
-#if NeedFunctionPrototypes
-Display *XOpenDisplay (
+Display *
+XOpenDisplay (
register _Xconst char *display)
-#else
-Display *XOpenDisplay (display)
- register char *display;
-#endif
{
register Display *dpy; /* New Display object being created. */
register int i;
@@ -111,13 +108,15 @@ Display *XOpenDisplay (display)
xVisualType *vp;
} u; /* proto data returned from server */
long setuplength; /* number of bytes in setup message */
+ long usedbytes = 0; /* number of bytes we have processed */
char *conn_auth_name, *conn_auth_data;
int conn_auth_namelen, conn_auth_datalen;
unsigned long mask;
- extern Bool _XSendClientPrefix();
- extern XtransConnInfo _X11TransConnectDisplay();
- extern XID _XAllocID();
- extern void _XAllocIDs();
+ long int conn_buf_size;
+ char *xlib_buffer_size;
+
+ bzero((char *) &client, sizeof(client));
+ bzero((char *) &prefix, sizeof(prefix));
/*
* If the display specifier string supplied as an argument to this
@@ -248,11 +247,24 @@ Display *XOpenDisplay (display)
}
/* Set up the output buffers. */
- if ((dpy->bufptr = dpy->buffer = Xmalloc(BUFSIZE)) == NULL) {
- OutOfMemory (dpy, setup);
- return(NULL);
- }
- dpy->bufmax = dpy->buffer + BUFSIZE;
+#ifndef XLIBDEFAULTBUFSIZE
+#define XLIBDEFAULTBUFSIZE 16384 /* 16k */
+#endif
+#ifndef XLIBMINBUFSIZE
+#define XLIBMINBUFSIZE BUFSIZE /* old default buffer size */
+#endif
+ if ((xlib_buffer_size = getenv("XLIBBUFFERSIZE")) == NULL)
+ conn_buf_size = XLIBDEFAULTBUFSIZE;
+ else
+ conn_buf_size = 1024 * strtol(xlib_buffer_size, NULL, 10);
+ if (conn_buf_size < XLIBMINBUFSIZE)
+ conn_buf_size = XLIBMINBUFSIZE;
+
+ if ((dpy->bufptr = dpy->buffer = Xcalloc(1, conn_buf_size)) == NULL) {
+ OutOfMemory (dpy, setup);
+ return(NULL);
+ }
+ dpy->bufmax = dpy->buffer + conn_buf_size;
/* Set up the input event queue and input event queue parameters. */
dpy->head = dpy->tail = NULL;
@@ -329,6 +341,7 @@ Display *XOpenDisplay (display)
return(NULL);
}
_XRead (dpy, (char *)u.setup, setuplength);
+
/*
* If the connection was not accepted by the server due to problems,
* give error message to the user....
@@ -338,14 +351,30 @@ Display *XOpenDisplay (display)
fprintf (stderr,
"Xlib: connection to \"%s\" refused by server\r\nXlib: ",
fullname);
- (void) fwrite (u.failure, (Size_t)sizeof(char),
+
+ if (prefix.lengthReason > setuplength) {
+ fprintf (stderr, "Xlib: Broken initial reply: length of reason > length of packet\r\n");
+ }else{
+ (void) fwrite (u.failure, (Size_t)sizeof(char),
(Size_t)prefix.lengthReason, stderr);
- (void) fwrite ("\r\n", sizeof(char), 2, stderr);
+ (void) fwrite ("\r\n", sizeof(char), 2, stderr);
+ }
+
OutOfMemory(dpy, setup);
return (NULL);
}
/*
+ * Check if the reply was long enough to get any information out of it.
+ */
+ usedbytes = sz_xConnSetup;
+ if (setuplength < usedbytes ) {
+ fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength);
+ OutOfMemory(dpy, setup);
+ return (NULL);
+ }
+
+/*
* We succeeded at authorization, so let us move the data into
* the display structure.
*/
@@ -366,6 +395,14 @@ Display *XOpenDisplay (display)
dpy->max_request_size = u.setup->maxRequestSize;
mask = dpy->resource_mask;
dpy->resource_shift = 0;
+ if (!mask)
+ {
+ fprintf (stderr, "Xlib: connection to \"%s\" invalid setup\n",
+ fullname);
+ OutOfMemory(dpy, setup);
+ return (NULL);
+ }
+
while (!(mask & 1)) {
dpy->resource_shift++;
mask = mask >> 1;
@@ -375,16 +412,35 @@ Display *XOpenDisplay (display)
* now extract the vendor string... String must be null terminated,
* padded to multiple of 4 bytes.
*/
+ /* Check for a sane vendor string length */
+ if (u.setup->nbytesVendor > 256) {
+ OutOfMemory(dpy, setup);
+ return (NULL);
+ }
+
dpy->vendor = (char *) Xmalloc((unsigned) (u.setup->nbytesVendor + 1));
if (dpy->vendor == NULL) {
OutOfMemory(dpy, setup);
return (NULL);
}
vendorlen = u.setup->nbytesVendor;
+
+/*
+ * validate setup length
+ */
+ usedbytes += (vendorlen + 3) & ~3;
+ if (setuplength < usedbytes) {
+ fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength);
+ OutOfMemory(dpy, setup);
+ return (NULL);
+ }
+
u.setup = (xConnSetup *) (((char *) u.setup) + sz_xConnSetup);
(void) strncpy(dpy->vendor, u.vendor, vendorlen);
dpy->vendor[vendorlen] = '\0';
vendorlen = (vendorlen + 3) & ~3; /* round up */
+
+
memmove (setup, u.vendor + vendorlen,
(int) setuplength - sz_xConnSetup - vendorlen);
u.vendor = setup;
@@ -401,6 +457,14 @@ Display *XOpenDisplay (display)
/*
* First decode the Z axis Screen format information.
*/
+ usedbytes += dpy->nformats * sz_xPixmapFormat;
+
+ if (setuplength < usedbytes) {
+ fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength);
+ OutOfMemory (dpy, setup);
+ return(NULL);
+ }
+
for (i = 0; i < dpy->nformats; i++) {
register ScreenFormat *fmt = &dpy->pixmap_format[i];
fmt->depth = u.sf->depth;
@@ -419,12 +483,22 @@ Display *XOpenDisplay (display)
OutOfMemory (dpy, setup);
return(NULL);
}
+
/*
* Now go deal with each screen structure.
*/
for (i = 0; i < dpy->nscreens; i++) {
register Screen *sp = &dpy->screens[i];
- VisualID root_visualID = u.rp->rootVisualID;
+ VisualID root_visualID;
+
+ usedbytes += sz_xWindowRoot;
+ if (setuplength < usedbytes) {
+ fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength);
+ OutOfMemory (dpy, setup);
+ return(NULL);
+ }
+
+ root_visualID = u.rp->rootVisualID;
sp->display = dpy;
sp->root = u.rp->windowId;
sp->cmap = u.rp->defaultColormap;
@@ -457,6 +531,14 @@ Display *XOpenDisplay (display)
*/
for (j = 0; j < sp->ndepths; j++) {
Depth *dp = &sp->depths[j];
+
+ usedbytes += sz_xDepth;
+ if (setuplength < usedbytes) {
+ fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength);
+ OutOfMemory (dpy, setup);
+ return(NULL);
+ }
+
dp->depth = u.dp->depth;
dp->nvisuals = u.dp->nVisuals;
u.dp = (xDepth *) (((char *) u.dp) + sz_xDepth);
@@ -469,6 +551,14 @@ Display *XOpenDisplay (display)
}
for (k = 0; k < dp->nvisuals; k++) {
register Visual *vp = &dp->visuals[k];
+
+ usedbytes += sz_xVisualType;
+ if (setuplength < usedbytes) {
+ fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength);
+ OutOfMemory (dpy, setup);
+ return(NULL);
+ }
+
vp->visualid = u.vp->visualID;
vp->class = u.vp->class;
vp->bits_per_rgb= u.vp->bitsPerRGB;
@@ -486,7 +576,15 @@ Display *XOpenDisplay (display)
}
sp->root_visual = _XVIDtoVisual(dpy, root_visualID);
}
-
+
+ if(usedbytes != setuplength){
+ /* Sanity check, shouldn't happen. */
+ fprintf(stderr, "Xlib: Did not parse entire setup message: "
+ "parsed: %ld, message: %ld\n",
+ usedbytes, setuplength);
+ OutOfMemory(dpy, setup);
+ return(NULL);
+ }
/*
* Now start talking to the server to setup all other information...
@@ -563,6 +661,8 @@ Display *XOpenDisplay (display)
if (_XReply (dpy, (xReply *) &reply, 0, xFalse)) {
if (reply.format == 8 && reply.propertyType == XA_STRING &&
+ (reply.nItems + 1 > 0) &&
+ (reply.nItems <= req->longLength * 4) &&
(dpy->xdefaults = Xmalloc (reply.nItems + 1))) {
_XReadPad (dpy, dpy->xdefaults, reply.nItems);
dpy->xdefaults[reply.nItems] = '\0';
@@ -661,6 +761,10 @@ void _XFreeDisplayStructure(dpy)
if (dpy->xkb_info)
(*dpy->free_funcs->xkb)(dpy);
+ /* if RM database was allocated by XGetDefault() free it */
+ if (dpy->db && (dpy->flags & XlibDisplayDfltRMDB))
+ XrmDestroyDatabase(dpy->db);
+
if (dpy->screens) {
register int i;
diff --git a/src/ParseCmd.c b/src/ParseCmd.c
index e2e302d0..7fd54246 100644
--- a/src/ParseCmd.c
+++ b/src/ParseCmd.c
@@ -46,6 +46,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/lib/X11/ParseCmd.c,v 1.5 2001/12/14 19:54:03 dawes Exp $ */
/* XrmParseCommand()
@@ -61,32 +62,21 @@ SOFTWARE.
#include <stdio.h>
-static void _XReportParseError(arg, msg)
- XrmOptionDescRec *arg;
- char *msg;
+static void _XReportParseError(XrmOptionDescRec *arg, char *msg)
{
(void) fprintf(stderr, "Error parsing argument \"%s\" (%s); %s\n",
arg->option, arg->specifier, msg);
exit(1);
}
-#if NeedFunctionPrototypes
-void XrmParseCommand(
+void
+XrmParseCommand(
XrmDatabase *pdb, /* data base */
register XrmOptionDescList options, /* pointer to table of valid options */
int num_options, /* number of options */
_Xconst char *prefix, /* name to prefix resources with */
int *argc, /* address of argument count */
char **argv) /* argument list (command line) */
-#else
-void XrmParseCommand(pdb, options, num_options, prefix, argc, argv)
- XrmDatabase *pdb; /* data base */
- register XrmOptionDescList options; /* pointer to table of valid options */
- int num_options; /* number of options */
- char *prefix; /* name to prefix resources with */
- int *argc; /* address of argument count */
- char **argv; /* argument list (command line) */
-#endif
{
int foundOption;
char **argsave;
@@ -95,7 +85,7 @@ void XrmParseCommand(pdb, options, num_options, prefix, argc, argv)
XrmQuark quarks[100];
XrmBinding *start_bindings;
XrmQuark *start_quarks;
- char *optP, *argP, optchar, argchar;
+ char *optP, *argP = NULL, optchar, argchar = 0;
int matches;
enum {DontCare, Check, NotSorted, Sorted} table_is_sorted;
char **argend;
@@ -208,7 +198,7 @@ void XrmParseCommand(pdb, options, num_options, prefix, argc, argv)
case XrmoptionSkipNArgs:
{
- register int j = 1 + (int) options[i].value;
+ register int j = 1 + (long) options[i].value;
if (j > myargc) j = myargc;
for (; j > 0; j--) {
diff --git a/src/ParseCol.c b/src/ParseCol.c
index 1520384a..018f79e1 100644
--- a/src/ParseCol.c
+++ b/src/ParseCol.c
@@ -24,27 +24,20 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/ParseCol.c,v 1.6 2003/04/13 19:22:17 dawes Exp $ */
#define NEED_REPLIES
#include <stdio.h>
#include "Xlibint.h"
#include "Xcmsint.h"
-extern void _XcmsRGB_to_XColor();
-#if NeedFunctionPrototypes
-Status XParseColor (
+Status
+XParseColor (
register Display *dpy,
Colormap cmap,
_Xconst char *spec,
XColor *def)
-#else
-Status XParseColor (dpy, cmap, spec, def)
- register Display *dpy;
- Colormap cmap;
- char *spec;
- XColor *def;
-#endif
{
register int n, i;
int r, g, b;
@@ -94,16 +87,24 @@ Status XParseColor (dpy, cmap, spec, def)
* Let's Attempt to use Xcms and i18n approach to Parse Color
*/
if ((ccc = XcmsCCCOfColormap(dpy, cmap)) != (XcmsCCC)NULL) {
- if (_XcmsResolveColorString(ccc, &spec,
- &cmsColor, XcmsRGBFormat) >= XcmsSuccess) {
+ const char *tmpName = spec;
+
+ switch (_XcmsResolveColorString(ccc, &tmpName, &cmsColor,
+ XcmsRGBFormat)) {
+ case XcmsSuccess:
+ case XcmsSuccessWithCompression:
cmsColor.pixel = def->pixel;
_XcmsRGB_to_XColor(&cmsColor, def, 1);
return(1);
+ case XcmsFailure:
+ case _XCMS_NEWNAME:
+ /*
+ * if the result was _XCMS_NEWNAME tmpName points to
+ * a string in cmsColNm.c:pairs table, for example,
+ * gray70 would become tekhvc:0.0/70.0/0.0
+ */
+ break;
}
- /*
- * Otherwise we failed; or spec was changed with yet another
- * name. Thus pass name to the X Server.
- */
}
/*
diff --git a/src/ParseGeom.c b/src/ParseGeom.c
index 6691c887..c00dc21a 100644
--- a/src/ParseGeom.c
+++ b/src/ParseGeom.c
@@ -27,6 +27,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/lib/X11/ParseGeom.c,v 1.3 2001/12/14 19:54:03 dawes Exp $ */
#include "Xlibint.h"
#include "Xutil.h"
@@ -62,9 +63,7 @@ char *search, *what;
*/
static int
-ReadInteger(string, NextString)
-register char *string;
-char **NextString;
+ReadInteger(char *string, char **NextString)
{
register int Result = 0;
int Sign = 1;
@@ -87,24 +86,18 @@ char **NextString;
return (-Result);
}
-#if NeedFunctionPrototypes
-int XParseGeometry (
+int
+XParseGeometry (
_Xconst char *string,
int *x,
int *y,
unsigned int *width, /* RETURN */
unsigned int *height) /* RETURN */
-#else
-int XParseGeometry (string, x, y, width, height)
-char *string;
-int *x, *y;
-unsigned int *width, *height; /* RETURN */
-#endif
{
int mask = NoValue;
register char *strind;
- unsigned int tempWidth, tempHeight;
- int tempX, tempY;
+ unsigned int tempWidth = 0, tempHeight = 0;
+ int tempX = 0, tempY = 0;
char *nextCharacter;
if ( (string == NULL) || (*string == '\0')) return(mask);
diff --git a/src/PeekEvent.c b/src/PeekEvent.c
index ba597eeb..4e2a61df 100644
--- a/src/PeekEvent.c
+++ b/src/PeekEvent.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/PeekEvent.c,v 1.3 2001/01/17 19:41:41 dawes Exp $ */
#define NEED_EVENTS
#include "Xlibint.h"
@@ -34,6 +35,7 @@ in this Software without prior written authorization from The Open Group.
* If none found, flush and wait until there is an event to peek.
*/
+int
XPeekEvent (dpy, event)
register Display *dpy;
register XEvent *event;
diff --git a/src/PeekIfEv.c b/src/PeekIfEv.c
index 6cb9d118..313c6981 100644
--- a/src/PeekIfEv.c
+++ b/src/PeekIfEv.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/PeekIfEv.c,v 1.4 2001/12/14 19:54:03 dawes Exp $ */
#define NEED_EVENTS
#include "Xlibint.h"
@@ -34,15 +35,14 @@ in this Software without prior written authorization from The Open Group.
* If none found, flush, and then wait until one satisfies the predicate.
*/
+int
XPeekIfEvent (dpy, event, predicate, arg)
register Display *dpy;
register XEvent *event;
Bool (*predicate)(
-#if NeedNestedPrototypes
Display* /* display */,
XEvent* /* event */,
char* /* arg */
-#endif
);
char *arg;
{
diff --git a/src/PmapBgnd.c b/src/PmapBgnd.c
index 5a74410f..18931949 100644
--- a/src/PmapBgnd.c
+++ b/src/PmapBgnd.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/PmapBgnd.c,v 1.3 2001/01/17 19:41:41 dawes Exp $ */
#include "Xlibint.h"
+int
XSetWindowBackgroundPixmap(dpy, w, pixmap)
register Display *dpy;
Window w;
diff --git a/src/PmapBord.c b/src/PmapBord.c
index e33738ab..cd5fc6c9 100644
--- a/src/PmapBord.c
+++ b/src/PmapBord.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/PmapBord.c,v 1.3 2001/01/17 19:41:41 dawes Exp $ */
#include "Xlibint.h"
+int
XSetWindowBorderPixmap(dpy, w, pixmap)
register Display *dpy;
Window w;
diff --git a/src/PolyReg.c b/src/PolyReg.c
index 4d9a0b52..66c50c4b 100644
--- a/src/PolyReg.c
+++ b/src/PolyReg.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
************************************************************************/
+/* $XFree86: xc/lib/X11/PolyReg.c,v 1.6 2001/12/14 19:54:03 dawes Exp $ */
#define LARGE_COORDINATE 1000000
#define SMALL_COORDINATE -LARGE_COORDINATE
@@ -64,12 +65,12 @@ SOFTWARE.
*
*/
static void
-InsertEdgeInET(ET, ETE, scanline, SLLBlock, iSLLBlock)
- EdgeTable *ET;
- EdgeTableEntry *ETE;
- int scanline;
- ScanLineListBlock **SLLBlock;
- int *iSLLBlock;
+InsertEdgeInET(
+ EdgeTable *ET,
+ EdgeTableEntry *ETE,
+ int scanline,
+ ScanLineListBlock **SLLBlock,
+ int *iSLLBlock)
{
register EdgeTableEntry *start, *prev;
register ScanLineList *pSLL, *pPrevSLL;
@@ -152,13 +153,13 @@ InsertEdgeInET(ET, ETE, scanline, SLLBlock, iSLLBlock)
*/
static void
-CreateETandAET(count, pts, ET, AET, pETEs, pSLLBlock)
- register int count;
- register XPoint *pts;
- EdgeTable *ET;
- EdgeTableEntry *AET;
- register EdgeTableEntry *pETEs;
- ScanLineListBlock *pSLLBlock;
+CreateETandAET(
+ register int count,
+ register XPoint *pts,
+ EdgeTable *ET,
+ EdgeTableEntry *AET,
+ register EdgeTableEntry *pETEs,
+ ScanLineListBlock *pSLLBlock)
{
register XPoint *top, *bottom;
register XPoint *PrevPt, *CurrPt;
@@ -244,8 +245,9 @@ CreateETandAET(count, pts, ET, AET, pETEs, pSLLBlock)
*/
static void
-loadAET(AET, ETEs)
- register EdgeTableEntry *AET, *ETEs;
+loadAET(
+ register EdgeTableEntry *AET,
+ register EdgeTableEntry *ETEs)
{
register EdgeTableEntry *pPrevAET;
register EdgeTableEntry *tmp;
@@ -292,8 +294,8 @@ loadAET(AET, ETEs)
*
*/
static void
-computeWAET(AET)
- register EdgeTableEntry *AET;
+computeWAET(
+ register EdgeTableEntry *AET)
{
register EdgeTableEntry *pWETE;
register int inside = 1;
@@ -331,8 +333,8 @@ computeWAET(AET)
*/
static int
-InsertionSort(AET)
- register EdgeTableEntry *AET;
+InsertionSort(
+ register EdgeTableEntry *AET)
{
register EdgeTableEntry *pETEchase;
register EdgeTableEntry *pETEinsert;
@@ -368,8 +370,8 @@ InsertionSort(AET)
* Clean up our act.
*/
static void
-FreeStorage(pSLLBlock)
- register ScanLineListBlock *pSLLBlock;
+FreeStorage(
+ register ScanLineListBlock *pSLLBlock)
{
register ScanLineListBlock *tmpSLLBlock;
@@ -389,10 +391,11 @@ FreeStorage(pSLLBlock)
* stack by the calling procedure.
*
*/
-static int PtsToRegion(numFullPtBlocks, iCurPtBlock, FirstPtBlock, reg)
- register int numFullPtBlocks, iCurPtBlock;
- POINTBLOCK *FirstPtBlock;
- REGION *reg;
+static int PtsToRegion(
+ register int numFullPtBlocks,
+ register int iCurPtBlock,
+ POINTBLOCK *FirstPtBlock,
+ REGION *reg)
{
register BOX *rects;
register XPoint *pts;
@@ -401,7 +404,7 @@ static int PtsToRegion(numFullPtBlocks, iCurPtBlock, FirstPtBlock, reg)
register BOX *extents;
register int numRects;
BOX *prevRects = reg->rects;
-
+
extents = &reg->extents;
numRects = ((numFullPtBlocks * NUMPTSTOBUFFER) + iCurPtBlock) >> 1;
diff --git a/src/PolyTxt.c b/src/PolyTxt.c
index c90a7b04..bd885266 100644
--- a/src/PolyTxt.c
+++ b/src/PolyTxt.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/PolyTxt.c,v 3.5 2001/10/28 03:32:30 tsi Exp $ */
#include "Xlibint.h"
+int
XDrawText(dpy, d, gc, x, y, items, nitems)
register Display *dpy;
Drawable d;
@@ -111,7 +113,7 @@ XDrawText(dpy, d, gc, x, y, items, nitems)
/* register xTextElt *elt; */
int FirstTimeThrough = True;
char *CharacterOffset = item->chars;
- char *tbuf;
+ char *tbuf = NULL;
while((PartialDelta < -128) || (PartialDelta > 127))
{
diff --git a/src/PolyTxt16.c b/src/PolyTxt16.c
index e75ad5c4..c7dce509 100644
--- a/src/PolyTxt16.c
+++ b/src/PolyTxt16.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/PolyTxt16.c,v 1.4 2001/10/28 03:32:31 tsi Exp $ */
#include "Xlibint.h"
+int
XDrawText16(dpy, d, gc, x, y, items, nitems)
register Display *dpy;
Drawable d;
@@ -108,7 +110,7 @@ XDrawText16(dpy, d, gc, x, y, items, nitems)
int nbytes = SIZEOF(xTextElt);
int PartialNChars = item->nchars;
int PartialDelta = item->delta;
- register xTextElt *elt;
+ register xTextElt *elt = NULL;
int FirstTimeThrough = True;
XChar2b *CharacterOffset = item->chars;
diff --git a/src/PropAlloc.c b/src/PropAlloc.c
index 9b95436e..96c92bbf 100644
--- a/src/PropAlloc.c
+++ b/src/PropAlloc.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/PropAlloc.c,v 1.3 2001/01/17 19:41:41 dawes Exp $ */
#include "Xlibint.h"
#include "Xutil.h"
@@ -58,7 +59,7 @@ XClassHint *XAllocClassHint ()
{
register XClassHint *h;
- if ((h = (XClassHint *) Xcalloc (1, (unsigned) sizeof (XClassHint))))
+ if ((h = (XClassHint *) Xcalloc (1, (unsigned) sizeof (XClassHint))))
h->res_name = h->res_class = NULL;
return h;
diff --git a/src/PutBEvent.c b/src/PutBEvent.c
index 21f57bb6..2260359f 100644
--- a/src/PutBEvent.c
+++ b/src/PutBEvent.c
@@ -26,11 +26,13 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/lib/X11/PutBEvent.c,v 1.3 2001/01/17 19:41:41 dawes Exp $ */
/* XPutBackEvent puts an event back at the head of the queue. */
#define NEED_EVENTS
#include "Xlibint.h"
+int
XPutBackEvent (dpy, event)
register Display *dpy;
register XEvent *event;
diff --git a/src/PutImage.c b/src/PutImage.c
index 8c13a097..415255a2 100644
--- a/src/PutImage.c
+++ b/src/PutImage.c
@@ -24,26 +24,28 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/PutImage.c,v 3.11 2002/12/09 04:10:56 tsi Exp $ */
#include "Xlibint.h"
#include "Xutil.h"
#include <stdio.h>
+#include "Cr.h"
+#include "ImUtil.h"
-#ifdef __STDC__
-#define Const const
-#else
-#define Const /**/
-#endif
#if defined(__STDC__) && ((defined(sun) && defined(SVR4)) || defined(WIN32))
#define RConst /**/
#else
-#define RConst Const
+#define RConst const
+#endif
+
+#if defined(Lynx) && defined(ROUNDUP)
+#undef ROUNDUP
#endif
/* assumes pad is a power of 2 */
#define ROUNDUP(nbytes, pad) (((nbytes) + ((pad) - 1)) & ~(long)((pad) - 1))
-static unsigned char Const _reverse_byte[0x100] = {
+static unsigned char const _reverse_byte[0x100] = {
0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
@@ -78,7 +80,7 @@ static unsigned char Const _reverse_byte[0x100] = {
0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
};
-static unsigned char Const _reverse_nibs[0x100] = {
+static unsigned char const _reverse_nibs[0x100] = {
0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70,
0x80, 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0,
0x01, 0x11, 0x21, 0x31, 0x41, 0x51, 0x61, 0x71,
@@ -113,10 +115,10 @@ static unsigned char Const _reverse_nibs[0x100] = {
0x8f, 0x9f, 0xaf, 0xbf, 0xcf, 0xdf, 0xef, 0xff
};
-
-_XReverse_Bytes (bpt, nb)
- register unsigned char *bpt;
- register int nb;
+int
+_XReverse_Bytes(
+ register unsigned char *bpt,
+ register int nb)
{
do {
*bpt = _reverse_byte[*bpt];
@@ -133,11 +135,14 @@ _XReverse_Bytes (bpt, nb)
/*ARGSUSED*/
static void
-NoSwap (src, dest, srclen, srcinc, destinc, height, half_order)
- register unsigned char *src, *dest;
- long srclen, srcinc, destinc;
- unsigned int height;
- int half_order;
+NoSwap (
+ register unsigned char *src,
+ register unsigned char *dest,
+ long srclen,
+ long srcinc,
+ long destinc,
+ unsigned int height,
+ int half_order)
{
long h = height;
@@ -149,11 +154,12 @@ NoSwap (src, dest, srclen, srcinc, destinc, height, half_order)
}
static void
-SwapTwoBytes (src, dest, srclen, srcinc, destinc, height, half_order)
- register unsigned char *src, *dest;
- long srclen, srcinc, destinc;
- unsigned int height;
- int half_order;
+SwapTwoBytes (
+ register unsigned char *src,
+ register unsigned char *dest,
+ long srclen, long srcinc, long destinc,
+ unsigned int height,
+ int half_order)
{
long length = ROUNDUP(srclen, 2);
register long h, n;
@@ -176,11 +182,12 @@ SwapTwoBytes (src, dest, srclen, srcinc, destinc, height, half_order)
}
static void
-SwapThreeBytes (src, dest, srclen, srcinc, destinc, height, byte_order)
- register unsigned char *src, *dest;
- long srclen, srcinc, destinc;
- unsigned int height;
- int byte_order;
+SwapThreeBytes (
+ register unsigned char *src,
+ register unsigned char *dest,
+ long srclen, long srcinc, long destinc,
+ unsigned int height,
+ int byte_order)
{
long length = ((srclen + 2) / 3) * 3;
register long h, n;
@@ -206,11 +213,12 @@ SwapThreeBytes (src, dest, srclen, srcinc, destinc, height, byte_order)
}
static void
-SwapFourBytes (src, dest, srclen, srcinc, destinc, height, half_order)
- register unsigned char *src, *dest;
- long srclen, srcinc, destinc;
- unsigned int height;
- int half_order;
+SwapFourBytes (
+ register unsigned char *src,
+ register unsigned char *dest,
+ long srclen, long srcinc, long destinc,
+ unsigned int height,
+ int half_order)
{
long length = ROUNDUP(srclen, 4);
register long h, n;
@@ -241,11 +249,12 @@ SwapFourBytes (src, dest, srclen, srcinc, destinc, height, half_order)
}
static void
-SwapWords (src, dest, srclen, srcinc, destinc, height, half_order)
- register unsigned char *src, *dest;
- long srclen, srcinc, destinc;
- unsigned int height;
- int half_order;
+SwapWords (
+ register unsigned char *src,
+ register unsigned char *dest,
+ long srclen, long srcinc, long destinc,
+ unsigned int height,
+ int half_order)
{
long length = ROUNDUP(srclen, 4);
register long h, n;
@@ -276,13 +285,14 @@ SwapWords (src, dest, srclen, srcinc, destinc, height, half_order)
}
static void
-SwapNibbles (src, dest, srclen, srcinc, destinc, height)
- register unsigned char *src, *dest;
- long srclen, srcinc, destinc;
- unsigned int height;
+SwapNibbles(
+ register unsigned char *src,
+ register unsigned char *dest,
+ long srclen, long srcinc, long destinc,
+ unsigned int height)
{
register long h, n;
- register Const unsigned char *rev = _reverse_nibs;
+ register const unsigned char *rev = _reverse_nibs;
srcinc -= srclen;
destinc -= srclen;
@@ -292,11 +302,12 @@ SwapNibbles (src, dest, srclen, srcinc, destinc, height)
}
static void
-ShiftNibblesLeft (src, dest, srclen, srcinc, destinc, height, nibble_order)
- register unsigned char *src, *dest;
- long srclen, srcinc, destinc;
- unsigned int height;
- int nibble_order;
+ShiftNibblesLeft (
+ register unsigned char *src,
+ register unsigned char *dest,
+ long srclen, long srcinc, long destinc,
+ unsigned int height,
+ int nibble_order)
{
register long h, n;
register unsigned char c1, c2;
@@ -322,14 +333,15 @@ ShiftNibblesLeft (src, dest, srclen, srcinc, destinc, height, nibble_order)
/*ARGSUSED*/
static void
-SwapBits (src, dest, srclen, srcinc, destinc, height, half_order)
- register unsigned char *src, *dest;
- long srclen, srcinc, destinc;
- unsigned int height;
- int half_order;
+SwapBits(
+ register unsigned char *src,
+ register unsigned char *dest,
+ long srclen, long srcinc, long destinc,
+ unsigned int height,
+ int half_order)
{
register long h, n;
- register Const unsigned char *rev = _reverse_byte;
+ register const unsigned char *rev = _reverse_byte;
srcinc -= srclen;
destinc -= srclen;
@@ -339,14 +351,16 @@ SwapBits (src, dest, srclen, srcinc, destinc, height, half_order)
}
static void
-SwapBitsAndTwoBytes (src, dest, srclen, srcinc, destinc, height, half_order)
- register unsigned char *src, *dest;
- long srclen, srcinc, destinc;
- unsigned int height;
+SwapBitsAndTwoBytes(
+ register unsigned char *src,
+ register unsigned char *dest,
+ long srclen, long srcinc, long destinc,
+ unsigned int height,
+ int half_order)
{
long length = ROUNDUP(srclen, 2);
register long h, n;
- register Const unsigned char *rev = _reverse_byte;
+ register const unsigned char *rev = _reverse_byte;
srcinc -= length;
destinc -= length;
@@ -366,15 +380,16 @@ SwapBitsAndTwoBytes (src, dest, srclen, srcinc, destinc, height, half_order)
}
static void
-SwapBitsAndFourBytes (src, dest, srclen, srcinc, destinc, height, half_order)
- register unsigned char *src, *dest;
- long srclen, srcinc, destinc;
- unsigned int height;
- int half_order;
+SwapBitsAndFourBytes(
+ register unsigned char *src,
+ register unsigned char *dest,
+ long srclen, long srcinc, long destinc,
+ unsigned int height,
+ int half_order)
{
long length = ROUNDUP(srclen, 4);
register long h, n;
- register Const unsigned char *rev = _reverse_byte;
+ register const unsigned char *rev = _reverse_byte;
srcinc -= length;
destinc -= length;
@@ -402,15 +417,16 @@ SwapBitsAndFourBytes (src, dest, srclen, srcinc, destinc, height, half_order)
}
static void
-SwapBitsAndWords (src, dest, srclen, srcinc, destinc, height, half_order)
- register unsigned char *src, *dest;
- long srclen, srcinc, destinc;
- unsigned int height;
- int half_order;
+SwapBitsAndWords(
+ register unsigned char *src,
+ register unsigned char *dest,
+ long srclen, long srcinc, long destinc,
+ unsigned int height,
+ int half_order)
{
long length = ROUNDUP(srclen, 4);
register long h, n;
- register Const unsigned char *rev = _reverse_byte;
+ register const unsigned char *rev = _reverse_byte;
srcinc -= length;
destinc -= length;
@@ -487,7 +503,14 @@ legend:
*/
-static void (* RConst (SwapFunction[12][12]))() = {
+static void (* RConst (SwapFunction[12][12]))(
+ register unsigned char *src,
+ register unsigned char *dest,
+ long srclen,
+ long srcinc,
+ long destinc,
+ unsigned int height,
+ int half_order) = {
#define n NoSwap,
#define s SwapTwoBytes,
#define l SwapFourBytes,
@@ -529,7 +552,7 @@ static void (* RConst (SwapFunction[12][12]))() = {
*
* Defines whether the first half of a unit has the first half of the data
*/
-static int Const HalfOrder[12] = {
+static int const HalfOrder[12] = {
LSBFirst, /* 1Mm */
LSBFirst, /* 2Mm */
LSBFirst, /* 4Mm */
@@ -550,7 +573,7 @@ static int Const HalfOrder[12] = {
* NoSwap or SwapBits) in addition to changing the desired ones.
*/
-static int Const HalfOrderWord[12] = {
+static int const HalfOrderWord[12] = {
MSBFirst, /* 1Mm */
MSBFirst, /* 2Mm */
MSBFirst, /* 4Mm */
@@ -587,18 +610,25 @@ static int Const HalfOrderWord[12] = {
#endif
static void
-SendXYImage(dpy, req, image, req_xoffset, req_yoffset)
- register Display *dpy;
- register xPutImageReq *req;
- register XImage *image;
- int req_xoffset, req_yoffset;
+SendXYImage(
+ register Display *dpy,
+ register xPutImageReq *req,
+ register XImage *image,
+ int req_xoffset, int req_yoffset)
{
register int j;
long total_xoffset, bytes_per_src, bytes_per_dest, length;
long bytes_per_line, bytes_per_src_plane, bytes_per_dest_plane;
char *src, *dest, *buf;
char *extra = (char *)NULL;
- register void (*swapfunc)();
+ register void (*swapfunc)(
+ register unsigned char *src,
+ register unsigned char *dest,
+ long srclen,
+ long srcinc,
+ long destinc,
+ unsigned int height,
+ int half_order);
int half_order;
total_xoffset = image->xoffset + req_xoffset;
@@ -725,12 +755,12 @@ SendXYImage(dpy, req, image, req_xoffset, req_yoffset)
}
static void
-SendZImage(dpy, req, image, req_xoffset, req_yoffset,
- dest_bits_per_pixel, dest_scanline_pad)
- register Display *dpy;
- register xPutImageReq *req;
- register XImage *image;
- int req_xoffset, req_yoffset, dest_bits_per_pixel, dest_scanline_pad;
+SendZImage(
+ register Display *dpy,
+ register xPutImageReq *req,
+ register XImage *image,
+ int req_xoffset, int req_yoffset,
+ int dest_bits_per_pixel, int dest_scanline_pad)
{
long bytes_per_src, bytes_per_dest, length;
unsigned char *src, *dest;
@@ -812,15 +842,15 @@ SendZImage(dpy, req, image, req_xoffset, req_yoffset,
}
static void
-PutImageRequest(dpy, d, gc, image, req_xoffset, req_yoffset, x, y,
- req_width, req_height, dest_bits_per_pixel, dest_scanline_pad)
- register Display *dpy;
- Drawable d;
- GC gc;
- register XImage *image;
- int x, y;
- unsigned int req_width, req_height;
- int req_xoffset, req_yoffset, dest_bits_per_pixel, dest_scanline_pad;
+PutImageRequest(
+ register Display *dpy,
+ Drawable d,
+ GC gc,
+ register XImage *image,
+ int req_xoffset, int req_yoffset,
+ int x, int y,
+ unsigned int req_width, unsigned int req_height,
+ int dest_bits_per_pixel, int dest_scanline_pad)
{
register xPutImageReq *req;
@@ -841,16 +871,18 @@ PutImageRequest(dpy, d, gc, image, req_xoffset, req_yoffset, x, y,
}
static void
-PutSubImage (dpy, d, gc, image, req_xoffset, req_yoffset, x, y,
- req_width, req_height, dest_bits_per_pixel, dest_scanline_pad)
- register Display *dpy;
- Drawable d;
- GC gc;
- register XImage *image;
- int x, y;
- unsigned int req_width, req_height;
- int req_xoffset, req_yoffset, dest_bits_per_pixel, dest_scanline_pad;
-
+PutSubImage (
+ register Display *dpy,
+ Drawable d,
+ GC gc,
+ register XImage *image,
+ int req_xoffset,
+ int req_yoffset,
+ int x, int y,
+ unsigned int req_width,
+ unsigned int req_height,
+ int dest_bits_per_pixel,
+ int dest_scanline_pad)
{
int left_pad, BytesPerRow, Available;
@@ -904,6 +936,8 @@ PutSubImage (dpy, d, gc, image, req_xoffset, req_yoffset, x, y,
}
}
+
+int
XPutImage (dpy, d, gc, image, req_xoffset, req_yoffset, x, y, req_width,
req_height)
register Display *dpy;
@@ -951,7 +985,6 @@ XPutImage (dpy, d, gc, image, req_xoffset, req_yoffset, x, y, req_width,
if (dest_bits_per_pixel != image->bits_per_pixel) {
XImage img;
register long i, j;
- extern void _XInitImageFuncPtrs();
/* XXX slow, but works */
img.width = width;
img.height = height;
@@ -994,5 +1027,15 @@ XPutImage (dpy, d, gc, image, req_xoffset, req_yoffset, x, y, req_width,
UnlockDisplay(dpy);
SyncHandle();
+#ifdef USE_DYNAMIC_XCURSOR
+ if (image->bits_per_pixel == 1 &&
+ x == 0 && y == 0 &&
+ width == image->width && height == image->height &&
+ gc->values.function == GXcopy &&
+ (gc->values.plane_mask & 1))
+ {
+ _XNoticePutBitmap (dpy, d, image);
+ }
+#endif
return 0;
}
diff --git a/src/QuColor.c b/src/QuColor.c
index fcd0517f..d7da47e8 100644
--- a/src/QuColor.c
+++ b/src/QuColor.c
@@ -24,10 +24,12 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/QuColor.c,v 1.3 2001/01/17 19:41:42 dawes Exp $ */
#define NEED_REPLIES
#include "Xlibint.h"
+int
XQueryColor(dpy, cmap, def)
register Display *dpy;
Colormap cmap;
diff --git a/src/QuColors.c b/src/QuColors.c
index 0aaed02a..1603a56f 100644
--- a/src/QuColors.c
+++ b/src/QuColors.c
@@ -24,10 +24,12 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/QuColors.c,v 1.3 2001/01/17 19:41:42 dawes Exp $ */
#define NEED_REPLIES
#include "Xlibint.h"
+int
XQueryColors(dpy, cmap, defs, ncolors)
register Display *dpy;
Colormap cmap;
diff --git a/src/QuExt.c b/src/QuExt.c
index 5d49da07..686334e0 100644
--- a/src/QuExt.c
+++ b/src/QuExt.c
@@ -24,25 +24,18 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86$ */
#define NEED_REPLIES
#include "Xlibint.h"
-#if NeedFunctionPrototypes
-Bool XQueryExtension(
+Bool
+XQueryExtension(
register Display *dpy,
_Xconst char *name,
int *major_opcode, /* RETURN */
int *first_event, /* RETURN */
int *first_error) /* RETURN */
-#else
-Bool XQueryExtension(dpy, name, major_opcode, first_event, first_error)
- register Display *dpy;
- char *name;
- int *major_opcode; /* RETURN */
- int *first_event; /* RETURN */
- int *first_error; /* RETURN */
-#endif
{
xQueryExtensionReply rep;
register xQueryExtensionReq *req;
diff --git a/src/QuKeybd.c b/src/QuKeybd.c
index 238881ce..4a7b8fba 100644
--- a/src/QuKeybd.c
+++ b/src/QuKeybd.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/QuKeybd.c,v 1.3 2001/01/17 19:41:42 dawes Exp $ */
#define NEED_REPLIES
#include "Xlibint.h"
@@ -32,6 +33,7 @@ struct kmap {
char map[32];
};
+int
XQueryKeymap(dpy, keys)
register Display *dpy;
char keys[32];
diff --git a/src/QuTextE16.c b/src/QuTextE16.c
index 66b3149f..58003f49 100644
--- a/src/QuTextE16.c
+++ b/src/QuTextE16.c
@@ -24,11 +24,12 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/QuTextE16.c,v 1.4 2001/12/14 19:54:04 dawes Exp $ */
#define NEED_REPLIES
#include "Xlibint.h"
-#if NeedFunctionPrototypes
+int
XQueryTextExtents16 (
register Display *dpy,
Font fid,
@@ -38,17 +39,6 @@ XQueryTextExtents16 (
int *font_ascent,
int *font_descent,
register XCharStruct *overall)
-#else
-XQueryTextExtents16 (dpy, fid, string, nchars, dir, font_ascent, font_descent,
- overall)
- register Display *dpy;
- Font fid;
- XChar2b *string;
- register int nchars;
- int *dir;
- int *font_ascent, *font_descent;
- register XCharStruct *overall;
-#endif
{
register long i;
register unsigned char *ptr;
diff --git a/src/QuTextExt.c b/src/QuTextExt.c
index bcf8ee17..3ab18138 100644
--- a/src/QuTextExt.c
+++ b/src/QuTextExt.c
@@ -24,11 +24,12 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/QuTextExt.c,v 1.4 2001/12/14 19:54:04 dawes Exp $ */
#define NEED_REPLIES
#include "Xlibint.h"
-#if NeedFunctionPrototypes
+int
XQueryTextExtents (
register Display *dpy,
Font fid,
@@ -38,17 +39,6 @@ XQueryTextExtents (
int *font_ascent,
int *font_descent,
register XCharStruct *overall)
-#else
-XQueryTextExtents (dpy, fid, string, nchars, dir, font_ascent, font_descent,
- overall)
- register Display *dpy;
- Font fid;
- register char *string;
- register int nchars;
- int *dir;
- int *font_ascent, *font_descent;
- register XCharStruct *overall;
-#endif
{
register int i;
register char *ptr;
diff --git a/src/QuTree.c b/src/QuTree.c
index 8c6fcc7a..bb7307a1 100644
--- a/src/QuTree.c
+++ b/src/QuTree.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/QuTree.c,v 1.5 2001/01/17 19:41:42 dawes Exp $ */
#define NEED_REPLIES
#include "Xlibint.h"
@@ -59,7 +60,7 @@ Status XQueryTree (dpy, w, root, parent, children, nchildren)
SyncHandle();
return (0);
}
- _XRead32 (dpy, (char *) *children, nbytes);
+ _XRead32 (dpy, (long *) *children, nbytes);
}
*parent = rep.parent;
*root = rep.root;
diff --git a/src/Quarks.c b/src/Quarks.c
index 98b1b761..70f6f492 100644
--- a/src/Quarks.c
+++ b/src/Quarks.c
@@ -49,18 +49,19 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/lib/X11/Quarks.c,v 1.6 2003/04/13 19:22:17 dawes Exp $ */
#include "Xlibint.h"
#include <X11/Xresource.h>
+#include "Xresinternal.h"
/* Not cost effective, at least for vanilla MIT clients */
/* #define PERMQ */
-typedef unsigned long Signature;
-typedef unsigned long Entry;
#ifdef PERMQ
typedef unsigned char Bits;
#endif
+typedef unsigned long Entry; /* dont confuse with EntryRec from Xintatom.h */
static XrmQuark nextQuark = 1; /* next available quark number */
static unsigned long quarkMask = 0;
@@ -111,8 +112,7 @@ static XrmQuark nextUniq = -1; /* next quark from XrmUniqueQuark */
static char *neverFreeTable = NULL;
static int neverFreeTableSize = 0;
-static char *permalloc(length)
- register unsigned int length;
+static char *permalloc(unsigned int length)
{
char *ret;
@@ -136,10 +136,9 @@ typedef struct {char a; unsigned long b;} TestType2;
#endif
#ifdef XTHREADS
-static char *_Xpermalloc();
+static char *_Xpermalloc(unsigned int length);
-char *Xpermalloc(length)
- unsigned int length;
+char *Xpermalloc(unsigned int length)
{
char *p;
@@ -152,8 +151,7 @@ char *Xpermalloc(length)
static
#endif /* XTHREADS */
-char *Xpermalloc(length)
- unsigned int length;
+char *Xpermalloc(unsigned int length)
{
int i;
@@ -176,7 +174,7 @@ char *Xpermalloc(length)
}
static Bool
-ExpandQuarkTable()
+ExpandQuarkTable(void)
{
unsigned long oldmask, newmask;
register char c, *s;
@@ -241,17 +239,10 @@ ExpandQuarkTable()
return True;
}
-#if NeedFunctionPrototypes
-XrmQuark _XrmInternalStringToQuark(
+XrmQuark
+_XrmInternalStringToQuark(
register _Xconst char *name, register int len, register Signature sig,
Bool permstring)
-#else
-XrmQuark _XrmInternalStringToQuark(name, len, sig, permstring)
- register XrmString name;
- register int len;
- register Signature sig;
- Bool permstring;
-#endif
{
register XrmQuark q;
register Entry entry;
@@ -356,13 +347,9 @@ nomatch: if (!rehash)
return NULLQUARK;
}
-#if NeedFunctionPrototypes
-XrmQuark XrmStringToQuark(
+XrmQuark
+XrmStringToQuark(
_Xconst char *name)
-#else
-XrmQuark XrmStringToQuark(name)
- XrmString name;
-#endif
{
register char c, *tname;
register Signature sig = 0;
@@ -376,13 +363,9 @@ XrmQuark XrmStringToQuark(name)
return _XrmInternalStringToQuark(name, tname-(char *)name-1, sig, False);
}
-#if NeedFunctionPrototypes
-XrmQuark XrmPermStringToQuark(
+XrmQuark
+XrmPermStringToQuark(
_Xconst char *name)
-#else
-XrmQuark XrmPermStringToQuark(name)
- XrmString name;
-#endif
{
register char c, *tname;
register Signature sig = 0;
diff --git a/src/RaiseWin.c b/src/RaiseWin.c
index 7524a5ae..a11aed8b 100644
--- a/src/RaiseWin.c
+++ b/src/RaiseWin.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/RaiseWin.c,v 1.3 2001/01/17 19:41:42 dawes Exp $ */
#include "Xlibint.h"
+int
XRaiseWindow (dpy, w)
register Display *dpy;
Window w;
diff --git a/src/RdBitF.c b/src/RdBitF.c
index 2b7b3966..b2826966 100644
--- a/src/RdBitF.c
+++ b/src/RdBitF.c
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/lib/X11/RdBitF.c,v 3.6 2003/04/13 19:22:17 dawes Exp $ */
/*
* Code to read bitmaps from disk files. Interprets
@@ -60,7 +61,7 @@ static Bool initialized = False; /* easier to fill in at run time */
* Table index for the hex values. Initialized once, first time.
* Used for translation value or delimiter significance lookup.
*/
-static void initHexTable()
+static void initHexTable(void)
{
/*
* We build the table at run time for several reasons:
@@ -93,8 +94,9 @@ static void initHexTable()
/*
* read next hex value in the input stream, return -1 if EOF
*/
-static NextInt (fstream)
- FILE *fstream;
+static int
+NextInt (
+ FILE *fstream)
{
int ch;
int value = 0;
@@ -122,21 +124,14 @@ static NextInt (fstream)
return value;
}
-#if NeedFunctionPrototypes
-int XReadBitmapFileData (
+int
+XReadBitmapFileData (
_Xconst char *filename,
unsigned int *width, /* RETURNED */
unsigned int *height, /* RETURNED */
unsigned char **data, /* RETURNED */
int *x_hot, /* RETURNED */
int *y_hot) /* RETURNED */
-#else
-int XReadBitmapFileData (filename, width, height, data, x_hot, y_hot)
- char *filename;
- unsigned int *width, *height; /* RETURNED */
- unsigned char **data; /* RETURNED */
- int *x_hot, *y_hot; /* RETURNED */
-#endif
{
FILE *fstream; /* handle on file */
unsigned char *bits = NULL; /* working variable */
@@ -156,6 +151,9 @@ int XReadBitmapFileData (filename, width, height, data, x_hot, y_hot)
/* first time initialization */
if (initialized == False) initHexTable();
+#ifdef __UNIXOS2__
+ filename = __XOS2RedirRoot(filename);
+#endif
if (!(fstream = fopen(filename, "r")))
return BitmapOpenFailed;
@@ -255,8 +253,8 @@ int XReadBitmapFileData (filename, width, height, data, x_hot, y_hot)
return (BitmapSuccess);
}
-#if NeedFunctionPrototypes
-int XReadBitmapFile (
+int
+XReadBitmapFile (
Display *display,
Drawable d,
_Xconst char *filename,
@@ -265,15 +263,6 @@ int XReadBitmapFile (
Pixmap *pixmap, /* RETURNED */
int *x_hot, /* RETURNED */
int *y_hot) /* RETURNED */
-#else
-int XReadBitmapFile (display, d, filename, width, height, pixmap, x_hot, y_hot)
- Display *display;
- Drawable d;
- char *filename;
- unsigned int *width, *height; /* RETURNED */
- Pixmap *pixmap; /* RETURNED */
- int *x_hot, *y_hot; /* RETURNED */
-#endif
{
unsigned char *data;
int res;
diff --git a/src/RecolorC.c b/src/RecolorC.c
index 06cf31ce..3066d1ad 100644
--- a/src/RecolorC.c
+++ b/src/RecolorC.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/RecolorC.c,v 1.3 2001/01/17 19:41:42 dawes Exp $ */
#include "Xlibint.h"
+int
XRecolorCursor(dpy, cursor, foreground, background)
register Display *dpy;
Cursor cursor;
diff --git a/src/ReconfWin.c b/src/ReconfWin.c
index e1e2fe59..ef536ff3 100644
--- a/src/ReconfWin.c
+++ b/src/ReconfWin.c
@@ -24,12 +24,14 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/ReconfWin.c,v 1.3 2001/01/17 19:41:42 dawes Exp $ */
#include "Xlibint.h"
#define AllMaskBits (CWX|CWY|CWWidth|CWHeight|\
CWBorderWidth|CWSibling|CWStackMode)
+int
XConfigureWindow(dpy, w, mask, changes)
register Display *dpy;
Window w;
diff --git a/src/Region.c b/src/Region.c
index c8eeabd6..79fb8e8b 100644
--- a/src/Region.c
+++ b/src/Region.c
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
************************************************************************/
+/* $XFree86: xc/lib/X11/Region.c,v 1.9 2002/06/04 22:19:57 dawes Exp $ */
/*
* The functions in this file implement the Region abstraction, similar to one
* used in the X11 sample server. A Region is simply an area, as the name
@@ -84,12 +85,56 @@ SOFTWARE.
#define assert(expr)
#endif
-typedef void (*voidProcp)();
+typedef int (*overlapProcp)(
+ register Region pReg,
+ register BoxPtr r1,
+ BoxPtr r1End,
+ register BoxPtr r2,
+ BoxPtr r2End,
+ short y1,
+ short y2);
+
+typedef int (*nonOverlapProcp)(
+ register Region pReg,
+ register BoxPtr r,
+ BoxPtr rEnd,
+ register short y1,
+ register short y2);
+
+static void miRegionOp(
+ register Region newReg, /* Place to store result */
+ Region reg1, /* First region in operation */
+ Region reg2, /* 2d region in operation */
+ int (*overlapFunc)(
+ register Region pReg,
+ register BoxPtr r1,
+ BoxPtr r1End,
+ register BoxPtr r2,
+ BoxPtr r2End,
+ short y1,
+ short y2), /* Function to call for over-
+ * lapping bands */
+ int (*nonOverlap1Func)(
+ register Region pReg,
+ register BoxPtr r,
+ BoxPtr rEnd,
+ register short y1,
+ register short y2), /* Function to call for non-
+ * overlapping bands in region
+ * 1 */
+ int (*nonOverlap2Func)(
+ register Region pReg,
+ register BoxPtr r,
+ BoxPtr rEnd,
+ register short y1,
+ register short y2)); /* Function to call for non-
+ * overlapping bands in region
+ * 2 */
+
-static void miRegionOp();
/* Create a new empty region */
Region
-XCreateRegion()
+XCreateRegion(void)
{
Region temp;
@@ -108,9 +153,10 @@ XCreateRegion()
return( temp );
}
-XClipBox( r, rect )
- Region r;
- XRectangle *rect;
+int
+XClipBox(
+ Region r,
+ XRectangle *rect)
{
rect->x = r->extents.x1;
rect->y = r->extents.y1;
@@ -119,9 +165,10 @@ XClipBox( r, rect )
return 1;
}
-XUnionRectWithRegion(rect, source, dest)
- register XRectangle *rect;
- Region source, dest;
+int
+XUnionRectWithRegion(
+ register XRectangle *rect,
+ Region source, Region dest)
{
REGION region;
@@ -154,8 +201,8 @@ XUnionRectWithRegion(rect, source, dest)
*-----------------------------------------------------------------------
*/
static void
-miSetExtents (pReg)
- Region pReg;
+miSetExtents (
+ Region pReg)
{
register BoxPtr pBox,
pBoxEnd,
@@ -202,16 +249,16 @@ miSetExtents (pReg)
assert(pExtents->x1 < pExtents->x2);
}
-XSetRegion( dpy, gc, r )
- Display *dpy;
- GC gc;
- register Region r;
+int
+XSetRegion(
+ Display *dpy,
+ GC gc,
+ register Region r)
{
register int i;
register XRectangle *xr, *pr;
register BOX *pb;
unsigned long total;
- extern void _XSetClipRectangles();
LockDisplay (dpy);
total = r->numRects * sizeof (XRectangle);
@@ -232,8 +279,9 @@ XSetRegion( dpy, gc, r )
return 1;
}
-XDestroyRegion( r )
- Region r;
+int
+XDestroyRegion(
+ Region r)
{
Xfree( (char *) r->rects );
Xfree( (char *) r );
@@ -246,10 +294,11 @@ XDestroyRegion( r )
added by raymond
*/
-XOffsetRegion(pRegion, x, y)
- register Region pRegion;
- register int x;
- register int y;
+int
+XOffsetRegion(
+ register Region pRegion,
+ register int x,
+ register int y)
{
register int nbox;
register BOX *pbox;
@@ -299,10 +348,10 @@ XOffsetRegion(pRegion, x, y)
#define ZCopyRegion(a,b) XUnionRegion(a,a,b)
static void
-Compress(r, s, t, dx, xdir, grow)
- Region r, s, t;
- register unsigned dx;
- register int xdir, grow;
+Compress(
+ Region r, Region s, Region t,
+ register unsigned dx,
+ register int xdir, register int grow)
{
register unsigned shift = 1;
@@ -325,9 +374,10 @@ Compress(r, s, t, dx, xdir, grow)
#undef ZShiftRegion
#undef ZCopyRegion
-XShrinkRegion(r, dx, dy)
- Region r;
- int dx, dy;
+int
+XShrinkRegion(
+ Region r,
+ int dx, int dy)
{
Region s, t;
int grow;
@@ -351,10 +401,10 @@ XShrinkRegion(r, dx, dy)
***********************************************************/
static BOX
-*IndexRects(rects, numRects, y)
- register BOX *rects;
- register int numRects;
- register int y;
+*IndexRects(
+ register BOX *rects,
+ register int numRects,
+ register int y)
{
while ((numRects--) && (rects->y2 <= y))
rects++;
@@ -379,15 +429,15 @@ static BOX
*-----------------------------------------------------------------------
*/
/* static void*/
-static
-miIntersectO (pReg, r1, r1End, r2, r2End, y1, y2)
- register Region pReg;
- register BoxPtr r1;
- BoxPtr r1End;
- register BoxPtr r2;
- BoxPtr r2End;
- short y1;
- short y2;
+static int
+miIntersectO (
+ register Region pReg,
+ register BoxPtr r1,
+ BoxPtr r1End,
+ register BoxPtr r2,
+ BoxPtr r2End,
+ short y1,
+ short y2)
{
register short x1;
register short x2;
@@ -443,10 +493,11 @@ miIntersectO (pReg, r1, r1End, r2, r2End, y1, y2)
return 0; /* lint */
}
-XIntersectRegion(reg1, reg2, newReg)
- Region reg1;
- Region reg2; /* source regions */
- register Region newReg; /* destination Region */
+int
+XIntersectRegion(
+ Region reg1,
+ Region reg2, /* source regions */
+ register Region newReg) /* destination Region */
{
/* check for trivial reject */
if ( (!(reg1->numRects)) || (!(reg2->numRects)) ||
@@ -454,7 +505,7 @@ XIntersectRegion(reg1, reg2, newReg)
newReg->numRects = 0;
else
miRegionOp (newReg, reg1, reg2,
- (voidProcp) miIntersectO, (voidProcp) NULL, (voidProcp) NULL);
+ miIntersectO, NULL, NULL);
/*
* Can't alter newReg's extents before we call miRegionOp because
@@ -468,9 +519,9 @@ XIntersectRegion(reg1, reg2, newReg)
}
static void
-miRegionCopy(dstrgn, rgn)
- register Region dstrgn;
- register Region rgn;
+miRegionCopy(
+ register Region dstrgn,
+ register Region rgn)
{
if (dstrgn != rgn) /* don't want to copy to itself */
@@ -509,10 +560,10 @@ miRegionCopy(dstrgn, rgn)
*/
static void
-combineRegs(newReg, reg1, reg2)
- register Region newReg;
- Region reg1;
- Region reg2;
+combineRegs(
+ register Region newReg,
+ Region reg1,
+ Region reg2)
{
register Region tempReg;
register BOX *rects;
@@ -558,8 +609,7 @@ combineRegs(newReg, reg1, reg2)
*/
static int
-QuickCheck(newReg, reg1, reg2)
- Region newReg, reg1, reg2;
+QuickCheck(Region newReg, Region reg1, Region reg2)
{
/* if unioning with itself or no rects to union with */
@@ -594,12 +644,12 @@ QuickCheck(newReg, reg1, reg2)
*/
static int
-TopRects(newReg, rects, reg1, reg2, FirstRect)
- register Region newReg;
- register BOX *rects;
- register Region reg1;
- register Region reg2;
- BOX *FirstRect;
+TopRects(
+ register Region newReg,
+ register BOX *rects,
+ register Region reg1,
+ register Region reg2,
+ BOX *FirstRect)
{
register BOX *tempRects;
@@ -653,11 +703,11 @@ TopRects(newReg, rects, reg1, reg2, FirstRect)
*-----------------------------------------------------------------------
*/
/* static int*/
-static
-miCoalesce (pReg, prevStart, curStart)
- register Region pReg; /* Region to coalesce */
- int prevStart; /* Index of start of previous band */
- int curStart; /* Index of start of current band */
+static int
+miCoalesce(
+ register Region pReg, /* Region to coalesce */
+ int prevStart, /* Index of start of previous band */
+ int curStart) /* Index of start of current band */
{
register BoxPtr pPrevBox; /* Current box in previous band */
register BoxPtr pCurBox; /* Current box in current band */
@@ -805,16 +855,33 @@ miCoalesce (pReg, prevStart, curStart)
*/
/* static void*/
static void
-miRegionOp(newReg, reg1, reg2, overlapFunc, nonOverlap1Func, nonOverlap2Func)
- register Region newReg; /* Place to store result */
- Region reg1; /* First region in operation */
- Region reg2; /* 2d region in operation */
- void (*overlapFunc)(); /* Function to call for over-
+miRegionOp(
+ register Region newReg, /* Place to store result */
+ Region reg1, /* First region in operation */
+ Region reg2, /* 2d region in operation */
+ int (*overlapFunc)(
+ register Region pReg,
+ register BoxPtr r1,
+ BoxPtr r1End,
+ register BoxPtr r2,
+ BoxPtr r2End,
+ short y1,
+ short y2), /* Function to call for over-
* lapping bands */
- void (*nonOverlap1Func)(); /* Function to call for non-
+ int (*nonOverlap1Func)(
+ register Region pReg,
+ register BoxPtr r,
+ BoxPtr rEnd,
+ register short y1,
+ register short y2), /* Function to call for non-
* overlapping bands in region
* 1 */
- void (*nonOverlap2Func)(); /* Function to call for non-
+ int (*nonOverlap2Func)(
+ register Region pReg,
+ register BoxPtr r,
+ BoxPtr rEnd,
+ register short y1,
+ register short y2)) /* Function to call for non-
* overlapping bands in region
* 2 */
{
@@ -932,7 +999,7 @@ miRegionOp(newReg, reg1, reg2, overlapFunc, nonOverlap1Func, nonOverlap2Func)
top = max(r1->y1,ybot);
bot = min(r1->y2,r2->y1);
- if ((top != bot) && (nonOverlap1Func != (void (*)())NULL))
+ if ((top != bot) && (nonOverlap1Func != NULL))
{
(* nonOverlap1Func) (newReg, r1, r1BandEnd, top, bot);
}
@@ -944,7 +1011,7 @@ miRegionOp(newReg, reg1, reg2, overlapFunc, nonOverlap1Func, nonOverlap2Func)
top = max(r2->y1,ybot);
bot = min(r2->y2,r1->y1);
- if ((top != bot) && (nonOverlap2Func != (void (*)())NULL))
+ if ((top != bot) && (nonOverlap2Func != NULL))
{
(* nonOverlap2Func) (newReg, r2, r2BandEnd, top, bot);
}
@@ -1004,7 +1071,7 @@ miRegionOp(newReg, reg1, reg2, overlapFunc, nonOverlap1Func, nonOverlap2Func)
curBand = newReg->numRects;
if (r1 != r1End)
{
- if (nonOverlap1Func != (void (*)())NULL)
+ if (nonOverlap1Func != NULL)
{
do
{
@@ -1019,7 +1086,7 @@ miRegionOp(newReg, reg1, reg2, overlapFunc, nonOverlap1Func, nonOverlap2Func)
} while (r1 != r1End);
}
}
- else if ((r2 != r2End) && (nonOverlap2Func != (void (*)())NULL))
+ else if ((r2 != r2End) && (nonOverlap2Func != NULL))
{
do
{
@@ -1095,13 +1162,13 @@ miRegionOp(newReg, reg1, reg2, overlapFunc, nonOverlap1Func, nonOverlap2Func)
*-----------------------------------------------------------------------
*/
/* static void*/
-static
-miUnionNonO (pReg, r, rEnd, y1, y2)
- register Region pReg;
- register BoxPtr r;
- BoxPtr rEnd;
- register short y1;
- register short y2;
+static int
+miUnionNonO (
+ register Region pReg,
+ register BoxPtr r,
+ BoxPtr rEnd,
+ register short y1,
+ register short y2)
{
register BoxPtr pNextRect;
@@ -1144,15 +1211,15 @@ miUnionNonO (pReg, r, rEnd, y1, y2)
*/
/* static void*/
-static
-miUnionO (pReg, r1, r1End, r2, r2End, y1, y2)
- register Region pReg;
- register BoxPtr r1;
- BoxPtr r1End;
- register BoxPtr r2;
- BoxPtr r2End;
- register short y1;
- register short y2;
+static int
+miUnionO (
+ register Region pReg,
+ register BoxPtr r1,
+ BoxPtr r1End,
+ register BoxPtr r2,
+ BoxPtr r2End,
+ register short y1,
+ register short y2)
{
register BoxPtr pNextRect;
@@ -1210,10 +1277,11 @@ miUnionO (pReg, r1, r1End, r2, r2End, y1, y2)
return 0; /* lint */
}
-XUnionRegion(reg1, reg2, newReg)
- Region reg1;
- Region reg2; /* source regions */
- Region newReg; /* destination Region */
+int
+XUnionRegion(
+ Region reg1,
+ Region reg2, /* source regions */
+ Region newReg) /* destination Region */
{
/* checks all the simple cases */
@@ -1265,8 +1333,8 @@ XUnionRegion(reg1, reg2, newReg)
return 1;
}
- miRegionOp (newReg, reg1, reg2, (voidProcp) miUnionO,
- (voidProcp) miUnionNonO, (voidProcp) miUnionNonO);
+ miRegionOp (newReg, reg1, reg2, miUnionO,
+ miUnionNonO, miUnionNonO);
newReg->extents.x1 = min(reg1->extents.x1, reg2->extents.x1);
newReg->extents.y1 = min(reg1->extents.y1, reg2->extents.y1);
@@ -1296,13 +1364,13 @@ XUnionRegion(reg1, reg2, newReg)
*-----------------------------------------------------------------------
*/
/* static void*/
-static
-miSubtractNonO1 (pReg, r, rEnd, y1, y2)
- register Region pReg;
- register BoxPtr r;
- BoxPtr rEnd;
- register short y1;
- register short y2;
+static int
+miSubtractNonO1 (
+ register Region pReg,
+ register BoxPtr r,
+ BoxPtr rEnd,
+ register short y1,
+ register short y2)
{
register BoxPtr pNextRect;
@@ -1343,15 +1411,15 @@ miSubtractNonO1 (pReg, r, rEnd, y1, y2)
*-----------------------------------------------------------------------
*/
/* static void*/
-static
-miSubtractO (pReg, r1, r1End, r2, r2End, y1, y2)
- register Region pReg;
- register BoxPtr r1;
- BoxPtr r1End;
- register BoxPtr r2;
- BoxPtr r2End;
- register short y1;
- register short y2;
+static int
+miSubtractO (
+ register Region pReg,
+ register BoxPtr r1,
+ BoxPtr r1End,
+ register BoxPtr r2,
+ BoxPtr r2End,
+ register short y1,
+ register short y2)
{
register BoxPtr pNextRect;
register int x1;
@@ -1447,7 +1515,8 @@ miSubtractO (pReg, r1, r1End, r2, r2End, y1, y2)
assert(pReg->numRects<=pReg->size);
}
r1++;
- x1 = r1->x1;
+ if (r1 != r1End)
+ x1 = r1->x1;
}
}
@@ -1491,10 +1560,11 @@ miSubtractO (pReg, r1, r1End, r2, r2End, y1, y2)
*-----------------------------------------------------------------------
*/
-XSubtractRegion(regM, regS, regD)
- Region regM;
- Region regS;
- register Region regD;
+int
+XSubtractRegion(
+ Region regM,
+ Region regS,
+ register Region regD)
{
/* check for trivial reject */
if ( (!(regM->numRects)) || (!(regS->numRects)) ||
@@ -1504,8 +1574,8 @@ XSubtractRegion(regM, regS, regD)
return 1;
}
- miRegionOp (regD, regM, regS, (voidProcp) miSubtractO,
- (voidProcp) miSubtractNonO1, (voidProcp) NULL);
+ miRegionOp (regD, regM, regS, miSubtractO,
+ miSubtractNonO1, NULL);
/*
* Can't alter newReg's extents before we call miRegionOp because
@@ -1519,8 +1589,7 @@ XSubtractRegion(regM, regS, regD)
}
int
-XXorRegion( sra, srb, dr )
- Region sra, srb, dr;
+XXorRegion(Region sra, Region srb, Region dr)
{
Region tra, trb;
@@ -1539,8 +1608,8 @@ XXorRegion( sra, srb, dr )
* as a parameter
*/
int
-XEmptyRegion( r )
- Region r;
+XEmptyRegion(
+ Region r)
{
if( r->numRects == 0 ) return TRUE;
else return FALSE;
@@ -1550,8 +1619,7 @@ XEmptyRegion( r )
* Check to see if two regions are equal
*/
int
-XEqualRegion( r1, r2 )
- Region r1, r2;
+XEqualRegion(Region r1, Region r2)
{
int i;
@@ -1571,9 +1639,9 @@ XEqualRegion( r1, r2 )
}
int
-XPointInRegion( pRegion, x, y )
- Region pRegion;
- int x, y;
+XPointInRegion(
+ Region pRegion,
+ int x, int y)
{
int i;
@@ -1590,10 +1658,10 @@ XPointInRegion( pRegion, x, y )
}
int
-XRectInRegion(region, rx, ry, rwidth, rheight)
- register Region region;
- int rx, ry;
- unsigned int rwidth, rheight;
+XRectInRegion(
+ register Region region,
+ int rx, int ry,
+ unsigned int rwidth, unsigned int rheight)
{
register BoxPtr pbox;
register BoxPtr pboxEnd;
diff --git a/src/RegstFlt.c b/src/RegstFlt.c
index 901e5f30..e3702bae 100644
--- a/src/RegstFlt.c
+++ b/src/RegstFlt.c
@@ -52,13 +52,14 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/lib/X11/RegstFlt.c,v 1.5 2003/04/13 19:22:17 dawes Exp $ */
#include "Xlibint.h"
#include "Xlcint.h"
static void
-_XFreeIMFilters(display)
- Display *display;
+_XFreeIMFilters(
+ Display *display)
{
register XFilterEventList fl;
@@ -72,16 +73,14 @@ _XFreeIMFilters(display)
* Register a filter with the filter machinery by event mask.
*/
void
-_XRegisterFilterByMask(display, window, event_mask, filter, client_data)
- Display *display;
- Window window;
- unsigned long event_mask;
+_XRegisterFilterByMask(
+ Display *display,
+ Window window,
+ unsigned long event_mask,
Bool (*filter)(
-#if NeedNestedPrototypes
Display*, Window, XEvent*, XPointer
-#endif
- );
- XPointer client_data;
+ ),
+ XPointer client_data)
{
XFilterEventRec *rec;
@@ -105,18 +104,15 @@ _XRegisterFilterByMask(display, window, event_mask, filter, client_data)
* Register a filter with the filter machinery by type code.
*/
void
-_XRegisterFilterByType(display, window, start_type, end_type,
- filter, client_data)
- Display *display;
- Window window;
- int start_type;
- int end_type;
+_XRegisterFilterByType(
+ Display *display,
+ Window window,
+ int start_type,
+ int end_type,
Bool (*filter)(
-#if NeedNestedPrototypes
Display*, Window, XEvent*, XPointer
-#endif
- );
- XPointer client_data;
+ ),
+ XPointer client_data)
{
XFilterEventRec *rec;
@@ -137,15 +133,13 @@ _XRegisterFilterByType(display, window, start_type, end_type,
}
void
-_XUnregisterFilter(display, window, filter, client_data)
- Display *display;
- Window window;
+_XUnregisterFilter(
+ Display *display,
+ Window window,
Bool (*filter)(
-#if NeedNestedPrototypes
Display*, Window, XEvent*, XPointer
-#endif
- );
- XPointer client_data;
+ ),
+ XPointer client_data)
{
register XFilterEventList *prev, fl;
diff --git a/src/RepWindow.c b/src/RepWindow.c
index ca1f6315..2193220d 100644
--- a/src/RepWindow.c
+++ b/src/RepWindow.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/RepWindow.c,v 1.3 2001/01/17 19:41:42 dawes Exp $ */
#include "Xlibint.h"
+int
XReparentWindow(dpy, w, p, x, y)
register Display *dpy;
Window w, p;
diff --git a/src/RestackWs.c b/src/RestackWs.c
index 1051fde6..8060f17a 100644
--- a/src/RestackWs.c
+++ b/src/RestackWs.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/RestackWs.c,v 1.3 2001/01/17 19:41:43 dawes Exp $ */
#include "Xlibint.h"
+int
XRestackWindows (dpy, windows, n)
register Display *dpy;
register Window *windows;
diff --git a/src/RotProp.c b/src/RotProp.c
index 36c3c1df..4020606f 100644
--- a/src/RotProp.c
+++ b/src/RotProp.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/RotProp.c,v 1.3 2001/01/17 19:41:43 dawes Exp $ */
#include "Xlibint.h"
+int
XRotateWindowProperties(dpy, w, properties, nprops, npositions)
register Display *dpy;
Window w;
diff --git a/src/SelInput.c b/src/SelInput.c
index c42a6674..5a8870e4 100644
--- a/src/SelInput.c
+++ b/src/SelInput.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/SelInput.c,v 1.3 2001/01/17 19:41:43 dawes Exp $ */
#include "Xlibint.h"
+int
XSelectInput (dpy, w, mask)
register Display *dpy;
Window w;
diff --git a/src/SendEvent.c b/src/SendEvent.c
index d853e273..6d7d6229 100644
--- a/src/SendEvent.c
+++ b/src/SendEvent.c
@@ -24,11 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/SendEvent.c,v 1.4 2001/12/14 19:54:05 dawes Exp $ */
#define NEED_EVENTS
#include "Xlibint.h"
-extern Status _XEventToWire();
/*
* In order to avoid all images requiring _XEventToWire, we install the
* event converter here if it has never been installed.
@@ -43,7 +43,10 @@ XSendEvent(dpy, w, propagate, event_mask, event)
{
register xSendEventReq *req;
xEvent ev;
- register Status (**fp)();
+ register Status (**fp)(
+ Display * /* dpy */,
+ XEvent * /* re */,
+ xEvent * /* event */);
Status status;
LockDisplay (dpy);
diff --git a/src/SetBack.c b/src/SetBack.c
index aea142c9..6c207f7d 100644
--- a/src/SetBack.c
+++ b/src/SetBack.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/SetBack.c,v 1.3 2001/01/17 19:41:43 dawes Exp $ */
#include "Xlibint.h"
+int
XSetBackground (dpy, gc, background)
register Display *dpy;
GC gc;
diff --git a/src/SetCRects.c b/src/SetCRects.c
index 8f03b7de..194998c3 100644
--- a/src/SetCRects.c
+++ b/src/SetCRects.c
@@ -24,18 +24,18 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/SetCRects.c,v 1.4 2001/12/14 19:54:06 dawes Exp $ */
#include "Xlibint.h"
/* can only call when display is locked. */
-void _XSetClipRectangles (dpy, gc, clip_x_origin, clip_y_origin, rectangles, n,
- ordering)
- register Display *dpy;
- GC gc;
- int clip_x_origin, clip_y_origin;
- XRectangle *rectangles;
- int n;
- int ordering;
+void _XSetClipRectangles (
+ register Display *dpy,
+ GC gc,
+ int clip_x_origin, int clip_y_origin,
+ XRectangle *rectangles,
+ int n,
+ int ordering)
{
register xSetClipRectanglesReq *req;
register long len;
@@ -60,6 +60,7 @@ void _XSetClipRectangles (dpy, gc, clip_x_origin, clip_y_origin, rectangles, n,
gc->dirty = dirty;
}
+int
XSetClipRectangles (dpy, gc, clip_x_origin, clip_y_origin, rectangles, n,
ordering)
register Display *dpy;
diff --git a/src/SetClMask.c b/src/SetClMask.c
index 75d97ab4..2503aef5 100644
--- a/src/SetClMask.c
+++ b/src/SetClMask.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/SetClMask.c,v 1.3 2001/01/17 19:41:43 dawes Exp $ */
#include "Xlibint.h"
+int
XSetClipMask (dpy, gc, mask)
register Display *dpy;
GC gc;
diff --git a/src/SetClOrig.c b/src/SetClOrig.c
index c471234e..659c9a8a 100644
--- a/src/SetClOrig.c
+++ b/src/SetClOrig.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/SetClOrig.c,v 1.3 2001/01/17 19:41:43 dawes Exp $ */
#include "Xlibint.h"
+int
XSetClipOrigin (dpy, gc, xorig, yorig)
register Display *dpy;
GC gc;
diff --git a/src/SetDashes.c b/src/SetDashes.c
index ce3a5e60..9fd0472f 100644
--- a/src/SetDashes.c
+++ b/src/SetDashes.c
@@ -24,24 +24,17 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/SetDashes.c,v 1.4 2001/12/14 19:54:06 dawes Exp $ */
#include "Xlibint.h"
-#if NeedFunctionPrototypes
+int
XSetDashes (
register Display *dpy,
GC gc,
int dash_offset,
_Xconst char *list,
int n)
-#else
-XSetDashes (dpy, gc, dash_offset, list, n)
- register Display *dpy;
- GC gc;
- int dash_offset;
- char *list;
- int n;
-#endif
{
register xSetDashesReq *req;
diff --git a/src/SetFPath.c b/src/SetFPath.c
index acf0a1d0..09441df0 100644
--- a/src/SetFPath.c
+++ b/src/SetFPath.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/SetFPath.c,v 1.5 2001/01/17 19:41:43 dawes Exp $ */
#include "Xlibint.h"
diff --git a/src/SetFont.c b/src/SetFont.c
index 57f7294f..9a8e67db 100644
--- a/src/SetFont.c
+++ b/src/SetFont.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/SetFont.c,v 1.3 2001/01/17 19:41:43 dawes Exp $ */
#include "Xlibint.h"
+int
XSetFont (dpy, gc, font)
register Display *dpy;
GC gc;
diff --git a/src/SetFore.c b/src/SetFore.c
index d8773494..e938d8fa 100644
--- a/src/SetFore.c
+++ b/src/SetFore.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/SetFore.c,v 1.3 2001/01/17 19:41:43 dawes Exp $ */
#include "Xlibint.h"
+int
XSetForeground (dpy, gc, foreground)
register Display *dpy;
GC gc;
diff --git a/src/SetFunc.c b/src/SetFunc.c
index b4154672..c0041317 100644
--- a/src/SetFunc.c
+++ b/src/SetFunc.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/SetFunc.c,v 1.3 2001/01/17 19:41:43 dawes Exp $ */
#include "Xlibint.h"
+int
XSetFunction (dpy, gc, function)
register Display *dpy;
GC gc;
diff --git a/src/SetHints.c b/src/SetHints.c
index f8201921..ffa5ebe9 100644
--- a/src/SetHints.c
+++ b/src/SetHints.c
@@ -46,6 +46,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/lib/X11/SetHints.c,v 1.4 2001/12/14 19:54:06 dawes Exp $ */
#include <X11/Xlibint.h>
#include <X11/Xutil.h>
@@ -55,6 +56,7 @@ SOFTWARE.
#define safestrlen(s) ((s) ? strlen(s) : 0)
+int
XSetSizeHints(dpy, w, hints, property) /* old routine */
Display *dpy;
Window w;
@@ -87,6 +89,7 @@ XSetSizeHints(dpy, w, hints, property) /* old routine */
* WM_HINTS type: WM_HINTS format:32
*/
+int
XSetWMHints (dpy, w, wmhints)
Display *dpy;
Window w;
@@ -114,6 +117,7 @@ XSetWMHints (dpy, w, wmhints)
* WM_ZOOM_HINTS type: WM_SIZE_HINTS format: 32
*/
+int
XSetZoomHints (dpy, w, zhints)
Display *dpy;
Window w;
@@ -128,6 +132,7 @@ XSetZoomHints (dpy, w, zhints)
* WM_NORMAL_HINTS type: WM_SIZE_HINTS format: 32
*/
+int
XSetNormalHints (dpy, w, hints) /* old routine */
Display *dpy;
Window w;
@@ -144,6 +149,7 @@ XSetNormalHints (dpy, w, hints) /* old routine */
* routine will take care of converting to host to network data structures.
*/
+int
XSetIconSizes (dpy, w, list, count)
Display *dpy;
Window w; /* typically, root */
@@ -174,6 +180,7 @@ XSetIconSizes (dpy, w, list, count)
return 1;
}
+int
XSetCommand (dpy, w, argv, argc)
Display *dpy;
Window w;
@@ -211,7 +218,7 @@ XSetCommand (dpy, w, argv, argc)
* WM_NORMAL_HINTS type: WM_SIZE_HINTS format: 32
*/
-#if NeedFunctionPrototypes
+int
XSetStandardProperties (
Display *dpy,
Window w, /* window to decorate */
@@ -221,17 +228,6 @@ XSetStandardProperties (
char **argv, /* command to be used to restart application */
int argc, /* count of arguments */
XSizeHints *hints) /* size hints for window in its normal state */
-#else
-XSetStandardProperties (dpy, w, name, icon_string, icon_pixmap, argv, argc, hints)
- Display *dpy;
- Window w; /* window to decorate */
- char *name; /* name of application */
- char *icon_string; /* name string for icon */
- Pixmap icon_pixmap; /* pixmap to use as icon, or None */
- char **argv; /* command to be used to restart application */
- int argc; /* count of arguments */
- XSizeHints *hints; /* size hints for window in its normal state */
-#endif
{
XWMHints phints;
phints.flags = 0;
@@ -256,6 +252,7 @@ XSetStandardProperties (dpy, w, name, icon_string, icon_pixmap, argv, argc, hint
return 1;
}
+int
XSetTransientForHint(dpy, w, propWindow)
Display *dpy;
Window w;
@@ -265,6 +262,7 @@ XSetTransientForHint(dpy, w, propWindow)
PropModeReplace, (unsigned char *) &propWindow, 1);
}
+int
XSetClassHint(dpy, w, classhint)
Display *dpy;
Window w;
diff --git a/src/SetIFocus.c b/src/SetIFocus.c
index 550a8cba..2e0eb1d9 100644
--- a/src/SetIFocus.c
+++ b/src/SetIFocus.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/SetIFocus.c,v 1.3 2001/01/17 19:41:43 dawes Exp $ */
#include "Xlibint.h"
+int
XSetInputFocus(dpy, focus, revert_to, time)
register Display *dpy;
Window focus;
diff --git a/src/SetLStyle.c b/src/SetLStyle.c
index a0352407..9f0c8c5e 100644
--- a/src/SetLStyle.c
+++ b/src/SetLStyle.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/SetLStyle.c,v 1.3 2001/01/17 19:41:43 dawes Exp $ */
#include "Xlibint.h"
+int
XSetLineAttributes(dpy, gc, linewidth, linestyle, capstyle, joinstyle)
register Display *dpy;
GC gc;
diff --git a/src/SetLocale.c b/src/SetLocale.c
index faa72941..49ec0d32 100644
--- a/src/SetLocale.c
+++ b/src/SetLocale.c
@@ -1,3 +1,4 @@
+/* $XdotOrg: lib/X11/src/SetLocale.c,v 1.2 2004-04-23 18:43:24 eich Exp $ */
/* $Xorg: SetLocale.c,v 1.4 2001/02/09 02:03:36 xorgcvs Exp $ */
/*
@@ -55,32 +56,25 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/lib/X11/SetLocale.c,v 3.20 2003/11/17 22:20:08 dawes Exp $ */
#include "Xlibint.h"
#include "Xlcint.h"
#include <X11/Xlocale.h>
#include <X11/Xos.h>
+#include "XlcPubI.h"
+
+#define MAXLOCALE 64 /* buffer size of locale name */
#ifdef X_LOCALE
/* alternative setlocale() for when the OS does not provide one */
-#ifdef X_NOT_STDC_ENV
-extern char *getenv();
-#endif
-
-#if NeedFunctionPrototypes
char *
_Xsetlocale(
int category,
- _Xconst char *name
+ _Xconst char *name
)
-#else
-char *
-_Xsetlocale(category, name)
- int category;
- char *name;
-#endif
{
static char *xsl_name;
char *old_name;
@@ -98,7 +92,9 @@ _Xsetlocale(category, name)
name = getenv("LC_CTYPE");
if (!name || !*name)
name = getenv("LANG");
- if (!name || !*name || !_XOpenLC(name))
+ if (name && strlen(name) >= MAXLOCALE)
+ name = NULL;
+ if (!name || !*name || !_XOpenLC((char *) name))
name = "C";
old_name = xsl_name;
xsl_name = (char *)name;
@@ -122,6 +118,17 @@ _Xsetlocale(category, name)
#else /* X_LOCALE */
+#ifdef __DARWIN__
+char *
+_Xsetlocale(
+ int category,
+ _Xconst char *name
+)
+{
+ return setlocale(category, name);
+}
+#endif /* __DARWIN__ */
+
/*
* _XlcMapOSLocaleName is an implementation dependent routine that derives
* the LC_CTYPE locale name as used in the sample implementation from that
@@ -139,90 +146,107 @@ _Xsetlocale(category, name)
*/
char *
-_XlcMapOSLocaleName(osname, siname)
- char *osname;
- char *siname;
+_XlcMapOSLocaleName(
+ char *osname,
+ char *siname)
{
-#if defined(hpux) || defined(CSRG_BASED) || defined(sun) || defined(SVR4) || defined(sgi) || defined(__osf__) || defined(AIXV3) || defined(ultrix) || defined(WIN32)
-#ifdef hpux
-#ifndef _LastCategory
-/* HPUX 9 and earlier */
-#define SKIPCOUNT 2
-#define STARTCHAR ':'
-#define ENDCHAR ';'
-#else
-/* HPUX 10 */
-#define ENDCHAR ' '
-#endif
-#else
-#ifdef ultrix
-#define SKIPCOUNT 2
-#define STARTCHAR '\001'
-#define ENDCHAR '\001'
-#else
-#ifdef WIN32
-#define SKIPCOUNT 1
-#define STARTCHAR '='
-#define ENDCHAR ';'
-#define WHITEFILL
-#else
-#if defined(__osf__) || (defined(AIXV3) && !defined(AIXV4))
-#define STARTCHAR ' '
-#define ENDCHAR ' '
-#else
-#if !defined(sun) || defined(SVR4)
-#define STARTCHAR '/'
-#endif
-#define ENDCHAR '/'
-#endif
-#endif
-#endif
-#endif
+#if defined(hpux) || defined(CSRG_BASED) || defined(sun) || defined(SVR4) || defined(sgi) || defined(__osf__) || defined(AIXV3) || defined(ultrix) || defined(WIN32) || defined(__UNIXOS2__) || defined(linux)
+# ifdef hpux
+# ifndef _LastCategory
+ /* HPUX 9 and earlier */
+# define SKIPCOUNT 2
+# define STARTCHAR ':'
+# define ENDCHAR ';'
+# else
+ /* HPUX 10 */
+# define ENDCHAR ' '
+# endif
+# else
+# ifdef ultrix
+# define SKIPCOUNT 2
+# define STARTCHAR '\001'
+# define ENDCHAR '\001'
+# else
+# if defined(WIN32) || defined(__UNIXOS2__)
+# define SKIPCOUNT 1
+# define STARTCHAR '='
+# define ENDCHAR ';'
+# define WHITEFILL
+# else
+# if defined(__osf__) || (defined(AIXV3) && !defined(AIXV4))
+# define STARTCHAR ' '
+# define ENDCHAR ' '
+# else
+# if defined(linux)
+# define STARTSTR "LC_CTYPE="
+# define ENDCHAR ';'
+# else
+# if !defined(sun) || defined(SVR4)
+# define STARTCHAR '/'
+# define ENDCHAR '/'
+# endif
+# endif
+# endif
+# endif
+# endif
+# endif
char *start;
char *end;
int len;
-#ifdef SKIPCOUNT
+# ifdef SKIPCOUNT
int n;
-#endif
+# endif
start = osname;
-#ifdef SKIPCOUNT
+# ifdef SKIPCOUNT
for (n = SKIPCOUNT;
--n >= 0 && start && (start = strchr (start, STARTCHAR));
start++)
;
if (!start)
start = osname;
-#endif
-#ifdef STARTCHAR
- if (start && (start = strchr (start, STARTCHAR))) {
+# endif
+# ifdef STARTCHAR
+ if (start && (start = strchr (start, STARTCHAR)))
+# elif defined (STARTSTR)
+ if (start && (start = strstr (start,STARTSTR)))
+# endif
+ {
+# ifdef STARTCHAR
start++;
-#endif
- if (end = strchr (start, ENDCHAR)) {
+# elif defined (STARTSTR)
+ start += strlen(STARTSTR);
+# endif
+ if ((end = strchr (start, ENDCHAR))) {
len = end - start;
+ if (len >= MAXLOCALE)
+ len = MAXLOCALE - 1;
strncpy(siname, start, len);
*(siname + len) = '\0';
-#ifdef WHITEFILL
+# ifdef WHITEFILL
for (start = siname; start = strchr(start, ' '); )
*start++ = '-';
-#endif
+# endif
return siname;
-#ifdef STARTCHAR
- }
-#endif
+ } else /* if no ENDCHAR is found we are at the end of the line */
+ return start;
}
-#ifdef WHITEFILL
+# ifdef WHITEFILL
if (strchr(osname, ' ')) {
- strcpy(siname, osname);
+ len = strlen(osname);
+ if (len >= MAXLOCALE - 1)
+ len = MAXLOCALE - 1;
+ strncpy(siname, osname, len);
+ *(siname + len) = '\0';
for (start = siname; start = strchr(start, ' '); )
*start++ = '-';
return siname;
}
-#endif
-#undef STARTCHAR
-#undef ENDCHAR
-#undef WHITEFILL
+# endif
+# undef STARTCHAR
+# undef ENDCHAR
+# undef WHITEFILL
#endif
return osname;
}
diff --git a/src/SetPMask.c b/src/SetPMask.c
index d712c12b..6c4b826c 100644
--- a/src/SetPMask.c
+++ b/src/SetPMask.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/SetPMask.c,v 1.3 2001/01/17 19:41:43 dawes Exp $ */
#include "Xlibint.h"
+int
XSetPlaneMask (dpy, gc, planemask)
register Display *dpy;
GC gc;
diff --git a/src/SetPntMap.c b/src/SetPntMap.c
index 52971616..7942537b 100644
--- a/src/SetPntMap.c
+++ b/src/SetPntMap.c
@@ -24,23 +24,18 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/SetPntMap.c,v 1.4 2001/12/14 19:54:06 dawes Exp $ */
#define NEED_REPLIES
#include "Xlibint.h"
/* returns either DeviceMappingSuccess or DeviceMappingBusy */
-#if NeedFunctionPrototypes
-int XSetPointerMapping (
+int
+XSetPointerMapping (
register Display *dpy,
_Xconst unsigned char *map,
int nmaps)
-#else
-int XSetPointerMapping (dpy, map, nmaps)
- register Display *dpy;
- unsigned char *map;
- int nmaps;
-#endif
{
register xSetPointerMappingReq *req;
xSetPointerMappingReply rep;
@@ -57,6 +52,7 @@ int XSetPointerMapping (dpy, map, nmaps)
return ((int) rep.success);
}
+int
XChangeKeyboardMapping (dpy, first_keycode, keysyms_per_keycode,
keysyms, nkeycodes)
register Display *dpy;
diff --git a/src/SetSOwner.c b/src/SetSOwner.c
index 67fc6ba2..40481ded 100644
--- a/src/SetSOwner.c
+++ b/src/SetSOwner.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/SetSOwner.c,v 1.3 2001/01/17 19:41:44 dawes Exp $ */
#include "Xlibint.h"
+int
XSetSelectionOwner(dpy, selection, owner, time)
register Display *dpy;
Atom selection;
diff --git a/src/SetSSaver.c b/src/SetSSaver.c
index 42ca05b0..cea64f25 100644
--- a/src/SetSSaver.c
+++ b/src/SetSSaver.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/SetSSaver.c,v 1.3 2001/01/17 19:41:44 dawes Exp $ */
#include "Xlibint.h"
+int
XSetScreenSaver(dpy, timeout, interval, prefer_blank, allow_exp)
register Display *dpy;
int timeout, interval, prefer_blank, allow_exp;
diff --git a/src/SetState.c b/src/SetState.c
index ad91d8fa..ecd51901 100644
--- a/src/SetState.c
+++ b/src/SetState.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/SetState.c,v 1.3 2001/01/17 19:41:44 dawes Exp $ */
#include "Xlibint.h"
+int
XSetState(dpy, gc, foreground, background, function, planemask)
register Display *dpy;
GC gc;
diff --git a/src/SetStip.c b/src/SetStip.c
index 3c6948f3..cb2ed999 100644
--- a/src/SetStip.c
+++ b/src/SetStip.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/SetStip.c,v 1.3 2001/01/17 19:41:44 dawes Exp $ */
#include "Xlibint.h"
+int
XSetStipple (dpy, gc, stipple)
register Display *dpy;
GC gc;
diff --git a/src/SetTSOrig.c b/src/SetTSOrig.c
index 6f6a2bad..d72e5cae 100644
--- a/src/SetTSOrig.c
+++ b/src/SetTSOrig.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/SetTSOrig.c,v 1.3 2001/01/17 19:41:44 dawes Exp $ */
#include "Xlibint.h"
+int
XSetTSOrigin (dpy, gc, x, y)
register Display *dpy;
GC gc;
diff --git a/src/SetTile.c b/src/SetTile.c
index 296e74aa..58ba8d90 100644
--- a/src/SetTile.c
+++ b/src/SetTile.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/SetTile.c,v 1.3 2001/01/17 19:41:44 dawes Exp $ */
#include "Xlibint.h"
+int
XSetTile (dpy, gc, tile)
register Display *dpy;
GC gc;
diff --git a/src/StBytes.c b/src/StBytes.c
index 880745f3..5daa3536 100644
--- a/src/StBytes.c
+++ b/src/StBytes.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/StBytes.c,v 1.4 2001/12/14 19:54:07 dawes Exp $ */
#include <X11/Xlibint.h>
#include <X11/Xatom.h>
@@ -39,6 +40,7 @@ static Atom n_to_atom[8] = {
XA_CUT_BUFFER6,
XA_CUT_BUFFER7};
+int
XRotateBuffers (dpy, rotate)
register Display *dpy;
int rotate;
@@ -79,36 +81,23 @@ char *XFetchBytes (dpy, nbytes)
return (XFetchBuffer (dpy, nbytes, 0));
}
-#if NeedFunctionPrototypes
+int
XStoreBuffer (
register Display *dpy,
_Xconst char *bytes,
int nbytes,
register int buffer)
-#else
-XStoreBuffer (dpy, bytes, nbytes, buffer)
- register Display *dpy;
- char *bytes;
- int nbytes;
- register int buffer;
-#endif
{
if ((buffer < 0) || (buffer > 7)) return 0;
return XChangeProperty(dpy, RootWindow(dpy, 0), n_to_atom[buffer],
XA_STRING, 8, PropModeReplace, (unsigned char *) bytes, nbytes);
}
-#if NeedFunctionPrototypes
+int
XStoreBytes (
register Display *dpy,
_Xconst char *bytes,
int nbytes)
-#else
-XStoreBytes (dpy, bytes, nbytes)
- register Display *dpy;
- char *bytes;
- int nbytes;
-#endif
{
return XStoreBuffer (dpy, bytes, nbytes, 0);
}
diff --git a/src/StColor.c b/src/StColor.c
index 332fdf49..10387873 100644
--- a/src/StColor.c
+++ b/src/StColor.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/StColor.c,v 1.3 2001/01/17 19:41:44 dawes Exp $ */
#include "Xlibint.h"
+int
XStoreColor(dpy, cmap, def)
register Display *dpy;
Colormap cmap;
diff --git a/src/StColors.c b/src/StColors.c
index cf970950..3ad030fa 100644
--- a/src/StColors.c
+++ b/src/StColors.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/StColors.c,v 1.3 2001/01/17 19:41:44 dawes Exp $ */
#include "Xlibint.h"
+int
XStoreColors(dpy, cmap, defs, ncolors)
register Display *dpy;
Colormap cmap;
diff --git a/src/StNColor.c b/src/StNColor.c
index 04d27d87..0ffbdc12 100644
--- a/src/StNColor.c
+++ b/src/StNColor.c
@@ -24,28 +24,20 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/StNColor.c,v 1.5 2003/04/13 19:22:18 dawes Exp $ */
#include <stdio.h>
#include "Xlibint.h"
#include "Xcmsint.h"
-extern void _XcmsRGB_to_XColor();
-#if NeedFunctionPrototypes
+int
XStoreNamedColor(
register Display *dpy,
Colormap cmap,
_Xconst char *name, /* STRING8 */
unsigned long pixel, /* CARD32 */
int flags) /* DoRed, DoGreen, DoBlue */
-#else
-XStoreNamedColor(dpy, cmap, name, pixel, flags)
-register Display *dpy;
-Colormap cmap;
-char *name; /* STRING8 */
-unsigned long pixel; /* CARD32 */
-int flags; /* DoRed, DoGreen, DoBlue */
-#endif
{
unsigned int nbytes;
register xStoreNamedColorReq *req;
diff --git a/src/StName.c b/src/StName.c
index 80fc2dcf..051bdda4 100644
--- a/src/StName.c
+++ b/src/StName.c
@@ -24,38 +24,27 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/StName.c,v 1.4 2001/12/14 19:54:07 dawes Exp $ */
#include <X11/Xlibint.h>
#include <X11/Xatom.h>
-#if NeedFunctionPrototypes
+int
XStoreName (
register Display *dpy,
Window w,
_Xconst char *name)
-#else
-XStoreName (dpy, w, name)
- register Display *dpy;
- Window w;
- char *name;
-#endif
{
return XChangeProperty(dpy, w, XA_WM_NAME, XA_STRING,
8, PropModeReplace, (unsigned char *)name,
name ? strlen(name) : 0);
}
-#if NeedFunctionPrototypes
+int
XSetIconName (
register Display *dpy,
Window w,
_Xconst char *icon_name)
-#else
-XSetIconName (dpy, w, icon_name)
- register Display *dpy;
- Window w;
- char *icon_name;
-#endif
{
return XChangeProperty(dpy, w, XA_WM_ICON_NAME, XA_STRING,
8, PropModeReplace, (unsigned char *)icon_name,
diff --git a/src/StrKeysym.c b/src/StrKeysym.c
index e378f93b..e2818716 100644
--- a/src/StrKeysym.c
+++ b/src/StrKeysym.c
@@ -24,26 +24,16 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/StrKeysym.c,v 3.7 2003/04/13 19:22:18 dawes Exp $ */
#include "Xlibint.h"
#include <X11/Xresource.h>
#include <X11/keysymdef.h>
-#ifdef X_NOT_STDC_ENV
-extern char *getenv();
-#endif
-
-extern XrmQuark _XrmInternalStringToQuark();
-
-#ifdef __STDC__
-#define Const const
-#else
-#define Const /**/
-#endif
-
-typedef unsigned long Signature;
+#include "Xresinternal.h"
#define NEEDKTABLE
#include "ks_tables.h"
+#include "Key.h"
#ifndef KEYSYMDB
#define KEYSYMDB "/usr/lib/X11/XKeysymDB"
@@ -54,7 +44,7 @@ static XrmDatabase keysymdb;
static XrmQuark Qkeysym[2];
XrmDatabase
-_XInitKeysymDB()
+_XInitKeysymDB(void)
{
if (!initialized)
{
@@ -74,21 +64,16 @@ _XInitKeysymDB()
return keysymdb;
}
-#if NeedFunctionPrototypes
-KeySym XStringToKeysym(s)
- _Xconst char *s;
-#else
-KeySym XStringToKeysym(s)
- char *s;
-#endif
+KeySym
+XStringToKeysym(_Xconst char *s)
{
register int i, n;
int h;
register Signature sig = 0;
- register Const char *p = s;
+ register const char *p = s;
register int c;
register int idx;
- Const unsigned char *entry;
+ const unsigned char *entry;
unsigned char sig1, sig2;
KeySym val;
@@ -124,7 +109,6 @@ KeySym XStringToKeysym(s)
XrmValue result;
XrmRepresentation from_type;
char c;
- KeySym val;
XrmQuark names[2];
names[0] = _XrmInternalStringToQuark(s, p - s - 1, sig, False);
@@ -137,12 +121,27 @@ KeySym XStringToKeysym(s)
{
c = ((char *)result.addr)[i];
if ('0' <= c && c <= '9') val = (val<<4)+c-'0';
- else if ('a' <= c && c <= 'z') val = (val<<4)+c-'a'+10;
- else if ('A' <= c && c <= 'Z') val = (val<<4)+c-'A'+10;
+ else if ('a' <= c && c <= 'f') val = (val<<4)+c-'a'+10;
+ else if ('A' <= c && c <= 'F') val = (val<<4)+c-'A'+10;
else return NoSymbol;
}
return val;
}
}
+
+ if (*s == 'U') {
+ val = 0;
+ for (p = &s[1]; *p; p++) {
+ c = *p;
+ if ('0' <= c && c <= '9') val = (val<<4)+c-'0';
+ else if ('a' <= c && c <= 'f') val = (val<<4)+c-'a'+10;
+ else if ('A' <= c && c <= 'F') val = (val<<4)+c-'A'+10;
+ else return NoSymbol;
+
+ }
+ if (val >= 0x01000000)
+ return NoSymbol;
+ return val | 0x01000000;
+ }
return (NoSymbol);
}
diff --git a/src/Sync.c b/src/Sync.c
index 98b5463b..ae423d09 100644
--- a/src/Sync.c
+++ b/src/Sync.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/Sync.c,v 1.3 2001/01/17 19:41:44 dawes Exp $ */
#define NEED_REPLIES
#define NEED_EVENTS
@@ -31,6 +32,7 @@ in this Software without prior written authorization from The Open Group.
/* Synchronize with errors and events, optionally discarding pending events */
+int
XSync (dpy, discard)
register Display *dpy;
Bool discard;
diff --git a/src/Synchro.c b/src/Synchro.c
index 9e9d50ad..8c84f504 100644
--- a/src/Synchro.c
+++ b/src/Synchro.c
@@ -24,27 +24,21 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/Synchro.c,v 1.3 2003/04/13 19:22:18 dawes Exp $ */
#include "Xlibint.h"
-int _XSyncFunction(dpy)
-register Display *dpy;
+static int _XSyncFunction(register Display *dpy)
{
XSync(dpy,0);
return 0;
}
-#if NeedFunctionPrototypes
-int (*XSynchronize(Display *dpy, int onoff))()
-#else
-int (*XSynchronize(dpy,onoff))()
- register Display *dpy;
- int onoff;
-#endif
+int (*XSynchronize(Display *dpy, int onoff))(Display *)
{
- int (*temp)();
- int (*func)() = NULL;
+ int (*temp)(Display *);
+ int (*func)(Display *) = NULL;
if (onoff)
func = _XSyncFunction;
@@ -61,26 +55,14 @@ int (*XSynchronize(dpy,onoff))()
return (temp);
}
-#if NeedFunctionPrototypes
int (*XSetAfterFunction(
Display *dpy,
int (*func)(
-#if NeedNestedPrototypes
Display*
-#endif
)
-))()
-#else
-int (*XSetAfterFunction(dpy,func))()
- register Display *dpy;
- int (*func)(
-#if NeedNestedPrototypes
- Display*
-#endif
- );
-#endif
+ ))(Display *)
{
- int (*temp)();
+ int (*temp)(Display *);
LockDisplay(dpy);
if (dpy->flags & XlibDisplayPrivSync) {
diff --git a/src/Text.c b/src/Text.c
index e8d3df45..23a57534 100644
--- a/src/Text.c
+++ b/src/Text.c
@@ -24,10 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/Text.c,v 1.4 2001/12/14 19:54:07 dawes Exp $ */
#include "Xlibint.h"
-#if NeedFunctionPrototypes
+int
XDrawString(
register Display *dpy,
Drawable d,
@@ -36,15 +37,6 @@ XDrawString(
int y,
_Xconst char *string,
int length)
-#else
-XDrawString(dpy, d, gc, x, y, string, length)
- register Display *dpy;
- Drawable d;
- GC gc;
- int x, y;
- char *string;
- int length;
-#endif
{
int Datalength = 0;
register xPolyText8Req *req;
diff --git a/src/Text16.c b/src/Text16.c
index f8714459..2eee708b 100644
--- a/src/Text16.c
+++ b/src/Text16.c
@@ -24,10 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/Text16.c,v 1.5 2001/12/14 19:54:07 dawes Exp $ */
#include "Xlibint.h"
-#if NeedFunctionPrototypes
+int
XDrawString16(
register Display *dpy,
Drawable d,
@@ -36,15 +37,6 @@ XDrawString16(
int y,
_Xconst XChar2b *string,
int length)
-#else
-XDrawString16(dpy, d, gc, x, y, string, length)
- register Display *dpy;
- Drawable d;
- GC gc;
- int x, y;
- XChar2b *string;
- int length;
-#endif
{
int Datalength = 0;
register xPolyText16Req *req;
@@ -99,7 +91,7 @@ XDrawString16(dpy, d, gc, x, y, string, length)
}
}
#else
- memcpy ((char *) (elt + 1), (char *)CharacterOffset, 254 * 2);
+ memcpy (((char *) elt) + 2, (char *)CharacterOffset, 254 * 2);
#endif
PartialNChars = PartialNChars - 254;
CharacterOffset += 254;
@@ -122,7 +114,7 @@ XDrawString16(dpy, d, gc, x, y, string, length)
}
}
#else
- memcpy((char *)(elt + 1), (char *)CharacterOffset, PartialNChars * 2);
+ memcpy(((char *)elt) + 2, (char *)CharacterOffset, PartialNChars * 2);
#endif
}
}
diff --git a/src/TextExt.c b/src/TextExt.c
index d7f4ff8a..1e6b1dce 100644
--- a/src/TextExt.c
+++ b/src/TextExt.c
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/lib/X11/TextExt.c,v 1.4 2001/12/14 19:54:07 dawes Exp $ */
/*
* Copyright 1995 by FUJITSU LIMITED
* This is source code modified by FUJITSU LIMITED under the Joint
@@ -68,7 +69,7 @@ from The Open Group.
* first row of the font (i.e. byte1 == 0), we can do some optimizations beyond
* what is done in XTextExtents16.
*/
-#if NeedFunctionPrototypes
+int
XTextExtents (
XFontStruct *fs,
_Xconst char *string,
@@ -77,14 +78,6 @@ XTextExtents (
int *font_ascent, /* RETURN font information */
int *font_descent, /* RETURN font information */
register XCharStruct *overall) /* RETURN character information */
-#else
-XTextExtents (fs, string, nchars, dir, font_ascent, font_descent, overall)
- XFontStruct *fs;
- char *string;
- int nchars;
- int *dir, *font_ascent, *font_descent; /* RETURN font information */
- register XCharStruct *overall; /* RETURN character information */
-#endif
{
int i; /* iterator */
Bool singlerow = (fs->max_byte1 == 0); /* optimization */
@@ -150,17 +143,11 @@ XTextExtents (fs, string, nchars, dir, font_ascent, font_descent, overall)
* XTextWidth - compute the width of a string of eightbit bytes. This is a
* subset of XTextExtents.
*/
-#if NeedFunctionPrototypes
-int XTextWidth (
+int
+XTextWidth (
XFontStruct *fs,
_Xconst char *string,
int count)
-#else
-int XTextWidth (fs, string, count)
- XFontStruct *fs;
- char *string;
- int count;
-#endif
{
int i; /* iterator */
Bool singlerow = (fs->max_byte1 == 0); /* optimization */
@@ -202,17 +189,11 @@ int XTextWidth (fs, string, count)
/*
* _XTextHeight - compute the height of a string of eightbit bytes.
*/
-#if NeedFunctionPrototypes
-int _XTextHeight (
+int
+_XTextHeight (
XFontStruct *fs,
_Xconst char *string,
int count)
-#else
-int _XTextHeight (fs, string, count)
- XFontStruct *fs;
- char *string;
- int count;
-#endif
{
int i; /* iterator */
Bool singlerow = (fs->max_byte1 == 0); /* optimization */
diff --git a/src/TextExt16.c b/src/TextExt16.c
index 24f888ec..9b4899cb 100644
--- a/src/TextExt16.c
+++ b/src/TextExt16.c
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/lib/X11/TextExt16.c,v 1.4 2001/12/14 19:54:07 dawes Exp $ */
/*
* Copyright 1995 by FUJITSU LIMITED
* This is source code modified by FUJITSU LIMITED under the Joint
@@ -42,7 +43,7 @@ from The Open Group.
* XTextExtents16 - compute the extents of string given as a sequence of
* XChar2bs.
*/
-#if NeedFunctionPrototypes
+int
XTextExtents16 (
XFontStruct *fs,
_Xconst XChar2b *string,
@@ -51,14 +52,6 @@ XTextExtents16 (
int *font_ascent, /* RETURN font information */
int *font_descent, /* RETURN font information */
register XCharStruct *overall) /* RETURN character information */
-#else
-XTextExtents16 (fs, string, nchars, dir, font_ascent, font_descent, overall)
- XFontStruct *fs;
- XChar2b *string;
- int nchars;
- int *dir, *font_ascent, *font_descent; /* RETURN font information */
- register XCharStruct *overall; /* RETURN character information */
-#endif
{
int i; /* iterator */
Bool singlerow = (fs->max_byte1 == 0); /* optimization */
@@ -125,17 +118,11 @@ XTextExtents16 (fs, string, nchars, dir, font_ascent, font_descent, overall)
* XTextWidth16 - compute the width of sequence of XChar2bs. This is a
* subset of XTextExtents16.
*/
-#if NeedFunctionPrototypes
-int XTextWidth16 (
+int
+XTextWidth16 (
XFontStruct *fs,
_Xconst XChar2b *string,
int count)
-#else
-int XTextWidth16 (fs, string, count)
- XFontStruct *fs;
- XChar2b *string;
- int count;
-#endif
{
int i; /* iterator */
Bool singlerow = (fs->max_byte1 == 0); /* optimization */
@@ -177,17 +164,11 @@ int XTextWidth16 (fs, string, count)
/*
* _XTextHeight16 - compute the height of sequence of XChar2bs.
*/
-#if NeedFunctionPrototypes
-int _XTextHeight16 (
+int
+_XTextHeight16 (
XFontStruct *fs,
_Xconst XChar2b *string,
int count)
-#else
-int _XTextHeight16 (fs, string, count)
- XFontStruct *fs;
- XChar2b *string;
- int count;
-#endif
{
int i; /* iterator */
Bool singlerow = (fs->max_byte1 == 0); /* optimization */
diff --git a/src/TextToStr.c b/src/TextToStr.c
index 2ac934c2..c775fa6e 100644
--- a/src/TextToStr.c
+++ b/src/TextToStr.c
@@ -25,6 +25,8 @@ in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/TextToStr.c,v 1.4 2001/01/17 19:41:45 dawes Exp $ */
+
#include <X11/Xlibint.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
@@ -110,6 +112,7 @@ void XFreeStringList (list)
if (list) {
if (list[0]) Xfree (list[0]);
Xfree ((char *) list);
+ list = NULL;
}
}
diff --git a/src/UIThrStubs.c b/src/UIThrStubs.c
index 64be42a8..3da0549e 100644
--- a/src/UIThrStubs.c
+++ b/src/UIThrStubs.c
@@ -1,5 +1,5 @@
/*
- * $XFree86: xc/lib/XThrStub/UIThrStubs.c,v 3.4 2003/01/15 02:55:16 dawes Exp $
+ * $XFree86: xc/lib/XThrStub/UIThrStubs.c,v 3.3 2001/11/18 21:13:26 herrb Exp $
*
* Copyright (c) 1995 David E. Wexelblat. All rights reserved
*
diff --git a/src/UndefCurs.c b/src/UndefCurs.c
index 46236ea4..ced35187 100644
--- a/src/UndefCurs.c
+++ b/src/UndefCurs.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/UndefCurs.c,v 1.3 2001/01/17 19:41:45 dawes Exp $ */
#include "Xlibint.h"
+int
XUndefineCursor (dpy,w)
register Display *dpy;
Window w;
diff --git a/src/UngrabBut.c b/src/UngrabBut.c
index e0e28a3a..4f1e12d0 100644
--- a/src/UngrabBut.c
+++ b/src/UngrabBut.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/UngrabBut.c,v 1.3 2001/01/17 19:41:45 dawes Exp $ */
#include "Xlibint.h"
+int
XUngrabButton(dpy, button, modifiers, grab_window)
register Display *dpy;
unsigned int button; /* CARD8 */
diff --git a/src/UngrabKbd.c b/src/UngrabKbd.c
index 5a9d7562..b4720a49 100644
--- a/src/UngrabKbd.c
+++ b/src/UngrabKbd.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/UngrabKbd.c,v 1.3 2001/01/17 19:41:45 dawes Exp $ */
#include "Xlibint.h"
+int
XUngrabKeyboard (dpy, time)
register Display *dpy;
Time time;
diff --git a/src/UngrabKey.c b/src/UngrabKey.c
index bfd28c0f..4f001d2e 100644
--- a/src/UngrabKey.c
+++ b/src/UngrabKey.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/UngrabKey.c,v 1.3 2001/01/17 19:41:45 dawes Exp $ */
#include "Xlibint.h"
+int
XUngrabKey(dpy, key, modifiers, grab_window)
register Display *dpy;
int key;
diff --git a/src/UngrabPtr.c b/src/UngrabPtr.c
index 4cf09cf1..1d6a02ea 100644
--- a/src/UngrabPtr.c
+++ b/src/UngrabPtr.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/UngrabPtr.c,v 1.3 2001/01/17 19:41:45 dawes Exp $ */
#include "Xlibint.h"
+int
XUngrabPointer(dpy, time)
register Display *dpy;
Time time;
diff --git a/src/UngrabSvr.c b/src/UngrabSvr.c
index e5267e18..6ec8ccef 100644
--- a/src/UngrabSvr.c
+++ b/src/UngrabSvr.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/UngrabSvr.c,v 1.3 2001/01/17 19:41:45 dawes Exp $ */
#include "Xlibint.h"
+int
XUngrabServer (dpy)
register Display *dpy;
{
diff --git a/src/UninsCmap.c b/src/UninsCmap.c
index 6b06c670..cd9af166 100644
--- a/src/UninsCmap.c
+++ b/src/UninsCmap.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/UninsCmap.c,v 1.3 2001/01/17 19:41:45 dawes Exp $ */
#include "Xlibint.h"
+int
XUninstallColormap(dpy, cmap)
register Display *dpy;
Colormap cmap;
diff --git a/src/UnldFont.c b/src/UnldFont.c
index 66f31a96..aafd9041 100644
--- a/src/UnldFont.c
+++ b/src/UnldFont.c
@@ -1,4 +1,4 @@
- /* $Xorg: UnldFont.c,v 1.4 2001/02/09 02:03:37 xorgcvs Exp $
+/* $Xorg: UnldFont.c,v 1.4 2001/02/09 02:03:37 xorgcvs Exp $ */
/*
Copyright 1986, 1998 The Open Group
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/UnldFont.c,v 1.5 2001/12/14 19:54:07 dawes Exp $ */
#include "Xlibint.h"
+int
XUnloadFont(dpy, font)
register Display *dpy;
Font font;
diff --git a/src/UnmapSubs.c b/src/UnmapSubs.c
index bb7158ea..56e30b7e 100644
--- a/src/UnmapSubs.c
+++ b/src/UnmapSubs.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/UnmapSubs.c,v 1.3 2001/01/17 19:41:45 dawes Exp $ */
#include "Xlibint.h"
+int
XUnmapSubwindows(dpy, win)
register Display *dpy;
Window win;
diff --git a/src/UnmapWin.c b/src/UnmapWin.c
index d536ecb0..da0e895c 100644
--- a/src/UnmapWin.c
+++ b/src/UnmapWin.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/UnmapWin.c,v 1.3 2001/01/17 19:41:45 dawes Exp $ */
#include "Xlibint.h"
+int
XUnmapWindow (dpy, w)
register Display *dpy;
Window w;
diff --git a/src/WMGeom.c b/src/WMGeom.c
index 96b9b536..7eb945f7 100644
--- a/src/WMGeom.c
+++ b/src/WMGeom.c
@@ -24,12 +24,13 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/WMGeom.c,v 1.3 2003/04/13 19:22:18 dawes Exp $ */
#include "Xlibint.h"
#include "Xutil.h"
-static int _GeometryMaskToGravity();
-
+static int _GeometryMaskToGravity(
+ int mask);
/*
* This routine given a user supplied positional argument and a default
@@ -40,8 +41,8 @@ static int _GeometryMaskToGravity();
* be considered "negative".
*/
-#if NeedFunctionPrototypes
-int XWMGeometry (
+int
+XWMGeometry (
Display *dpy, /* user's display connection */
int screen, /* screen on which to do computation */
_Xconst char *user_geom, /* user provided geometry spec */
@@ -53,20 +54,6 @@ int XWMGeometry (
int *width_return, /* size of window */
int *height_return, /* size of window */
int *gravity_return) /* gravity of window */
-#else
-int XWMGeometry (dpy, screen, user_geom, def_geom, bwidth, hints,
- x_return, y_return, width_return, height_return,
- gravity_return)
- Display *dpy; /* user's display connection */
- int screen; /* screen on which to do computation */
- char *user_geom; /* user provided geometry spec */
- char *def_geom; /* default geometry spec for window */
- unsigned int bwidth; /* border width */
- XSizeHints *hints; /* usually WM_NORMAL_HINTS */
- int *x_return, *y_return; /* location of window */
- int *width_return, *height_return; /* size of window */
- int *gravity_return; /* gravity of window */
-#endif
{
int ux, uy; /* returned values from parse */
unsigned int uwidth, uheight; /* returned values from parse */
@@ -179,8 +166,8 @@ int XWMGeometry (dpy, screen, user_geom, def_geom, bwidth, hints,
}
-static int _GeometryMaskToGravity (mask)
- int mask;
+static int _GeometryMaskToGravity(
+ int mask)
{
switch (mask & (XNegative|YNegative)) {
case 0:
diff --git a/src/WMProps.c b/src/WMProps.c
index c1ed9a9d..6e4e474c 100644
--- a/src/WMProps.c
+++ b/src/WMProps.c
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/lib/X11/WMProps.c,v 3.6 2001/12/14 19:54:07 dawes Exp $ */
/***********************************************************
Copyright 1988 by Wyse Technology, Inc., San Jose, Ca.,
@@ -55,10 +56,8 @@ SOFTWARE.
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
+#include <X11/Xlocale.h>
-#ifdef X_NOT_STDC_ENV
-extern char *getenv();
-#endif
/*
* XSetWMProperties sets the following properties:
@@ -86,6 +85,7 @@ void XSetWMProperties (dpy, w, windowName, iconName, argv, argc, sizeHints,
XTextProperty textprop;
char hostName[256];
int len = _XGetHostname (hostName, sizeof hostName);
+ char *locale;
/* set names of window and icon */
if (windowName) XSetWMName (dpy, w, windowName);
@@ -121,6 +121,14 @@ void XSetWMProperties (dpy, w, windowName, iconName, argv, argc, sizeHints,
* systems will have to change this.
*/
char *cp = strrchr (argv[0], '/');
+#ifdef __UNIXOS2__
+ char *os2_cp = strrchr (argv[0],'\\');
+ char *dot_cp = strrchr (argv[0],'.');
+ if (os2_cp && (os2_cp > cp)) {
+ if(dot_cp && (dot_cp > os2_cp)) *dot_cp = '\0';
+ cp=os2_cp;
+ }
+#endif
tmp.res_name = (cp ? cp + 1 : argv[0]);
}
tmp.res_class = classHints->res_class;
@@ -128,5 +136,11 @@ void XSetWMProperties (dpy, w, windowName, iconName, argv, argc, sizeHints,
}
XSetClassHint (dpy, w, classHints);
}
+
+ locale = setlocale(LC_CTYPE, (char *)NULL);
+ if (locale)
+ XChangeProperty (dpy, w, XInternAtom(dpy, "WM_LOCALE_NAME", False),
+ XA_STRING, 8, PropModeReplace,
+ (unsigned char *)locale, strlen(locale));
}
diff --git a/src/WarpPtr.c b/src/WarpPtr.c
index e3dfc8da..e83a7e2a 100644
--- a/src/WarpPtr.c
+++ b/src/WarpPtr.c
@@ -24,9 +24,11 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/WarpPtr.c,v 1.3 2001/01/17 19:41:47 dawes Exp $ */
#include "Xlibint.h"
+int
XWarpPointer(dpy, src_win, dest_win, src_x, src_y, src_width, src_height,
dest_x, dest_y)
register Display *dpy;
diff --git a/src/WinEvent.c b/src/WinEvent.c
index 726c7729..d69a6671 100644
--- a/src/WinEvent.c
+++ b/src/WinEvent.c
@@ -24,17 +24,12 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/WinEvent.c,v 3.5 2001/10/28 03:32:32 tsi Exp $ */
#define NEED_EVENTS
#include "Xlibint.h"
-#ifdef __STDC__
-#define Const const
-#else
-#define Const /**/
-#endif
-
-extern long Const _Xevent_to_mask[];
+extern long const _Xevent_to_mask[];
#define AllPointers (PointerMotionMask|PointerMotionHintMask|ButtonMotionMask)
#define AllButtons (Button1MotionMask|Button2MotionMask|Button3MotionMask|\
Button4MotionMask|Button5MotionMask)
@@ -47,6 +42,7 @@ extern long Const _Xevent_to_mask[];
* matches.
*/
+int
XWindowEvent (dpy, w, mask, event)
register Display *dpy;
Window w; /* Selected window. */
@@ -54,7 +50,7 @@ XWindowEvent (dpy, w, mask, event)
register XEvent *event; /* XEvent to be filled in. */
{
register _XQEvent *prev, *qelt;
- unsigned long qe_serial;
+ unsigned long qe_serial = 0;
LockDisplay(dpy);
prev = NULL;
diff --git a/src/Window.c b/src/Window.c
index 5d1f0afe..05628369 100644
--- a/src/Window.c
+++ b/src/Window.c
@@ -24,14 +24,15 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/Window.c,v 1.4 2001/12/14 19:54:08 dawes Exp $ */
#include "Xlibint.h"
-void _XProcessWindowAttributes (dpy, req, valuemask, attributes)
- register Display *dpy;
- xChangeWindowAttributesReq *req;
- register unsigned long valuemask;
- register XSetWindowAttributes *attributes;
+void _XProcessWindowAttributes (
+ register Display *dpy,
+ xChangeWindowAttributesReq *req,
+ register unsigned long valuemask,
+ register XSetWindowAttributes *attributes)
{
unsigned long values[32];
register unsigned long *value = values;
@@ -126,7 +127,7 @@ Window XCreateWindow(dpy, parent, x, y, width, height,
req->visual = visual->visualid;
wid = req->wid = XAllocID(dpy);
valuemask &= AllMaskBits;
- if ((req->mask = valuemask))
+ if ((req->mask = valuemask))
_XProcessWindowAttributes (dpy, (xChangeWindowAttributesReq *)req,
valuemask, attributes);
UnlockDisplay(dpy);
diff --git a/src/WrBitF.c b/src/WrBitF.c
index e8fad11d..f57bd930 100644
--- a/src/WrBitF.c
+++ b/src/WrBitF.c
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/lib/X11/WrBitF.c,v 3.6 2003/04/13 19:22:18 dawes Exp $ */
#include "Xlibint.h"
#include <X11/Xos.h>
@@ -34,9 +35,9 @@ from The Open Group.
#define ERR_RETURN 0
-static char *Format_Image(image, resultsize)
-XImage *image;
-int *resultsize;
+static char *Format_Image(
+ XImage *image,
+ int *resultsize)
{
register int x, c, b;
register char *ptr;
@@ -81,8 +82,8 @@ int *resultsize;
#define BYTES_PER_OUTPUT_LINE 12
-#if NeedFunctionPrototypes
-int XWriteBitmapFile(
+int
+XWriteBitmapFile(
Display *display,
_Xconst char *filename,
Pixmap bitmap,
@@ -90,14 +91,6 @@ int XWriteBitmapFile(
unsigned int height,
int x_hot,
int y_hot)
-#else
-int XWriteBitmapFile(display, filename, bitmap, width, height, x_hot, y_hot)
- Display *display;
- char *filename;
- Pixmap bitmap;
- unsigned int width, height;
- int x_hot, y_hot;
-#endif
{
char *data, *ptr;
int size, byte;
@@ -111,6 +104,9 @@ int XWriteBitmapFile(display, filename, bitmap, width, height, x_hot, y_hot)
else
name++;
+#ifdef __UNIXOS2__
+ filename = (char*)__XOS2RedirRoot(filename);
+#endif
if (!(stream = fopen(filename, "w")))
return(BitmapOpenFailed);
diff --git a/src/XErrorDB b/src/XErrorDB
index 5996026c..c1d6bf3d 100644
--- a/src/XErrorDB
+++ b/src/XErrorDB
@@ -1,7 +1,11 @@
! $Xorg: XErrorDB,v 1.3 2000/08/17 19:44:59 cpqbld Exp $
! Copyright 1993, 1995, 1998 The Open Group
-! All Rights Reserved.
+! Permission to use, copy, modify, distribute, and sell this software and its
+! documentation for any purpose is hereby granted without fee, provided that
+! the above copyright notice appear in all copies and that both that
+! copyright notice and this permission notice appear in supporting
+! documentation.
!
! The above copyright notice and this permission notice shall be
! included in all copies or substantial portions of the Software.
@@ -19,6 +23,8 @@
! other dealings in this Software without prior written authorization
! from The Open Group.
!
+! $XFree86: xc/lib/X11/XErrorDB,v 3.40 2002/12/21 17:51:42 dawes Exp $
+!
! these are used in XGetErrorMessage.
XlibMessage.XError: X Error of failed request
XlibMessage.MajorCode: Major opcode of failed request: %d
@@ -575,12 +581,20 @@ XRequest.XFree86-VidModeExtension.9: XF86VidModeValidateModeLine
XRequest.XFree86-VidModeExtension.10: XF86VidModeSwitchToMode
XRequest.XFree86-VidModeExtension.11: XF86VidModeGetViewPort
XRequest.XFree86-VidModeExtension.12: XF86VidModeSetViewPort
+XRequest.XFree86-VidModeExtension.13: XF86VidModeGetDotClocks
+XRequest.XFree86-VidModeExtension.14: XF86VidModeSetClientVersion
+XRequest.XFree86-VidModeExtension.15: XF86VidModeSetGamma
+XRequest.XFree86-VidModeExtension.16: XF86VidModeGetGamma
+XRequest.XFree86-VidModeExtension.17: XF86VidModeGetGammaRamp
+XRequest.XFree86-VidModeExtension.18: XF86VidModeSetGammaRamp
+XRequest.XFree86-VidModeExtension.19: XF86VidModeGetGammaRampSize
+XRequest.XFree86-VidModeExtension.20: XF86VidModeGetPermissions
XProtoError.XFree86-VidModeExtension.0: XF86VidModeBadClock
XProtoError.XFree86-VidModeExtension.1: XF86VidModeBadHTimings
XProtoError.XFree86-VidModeExtension.2: XF86VidModeBadVTimings
XProtoError.XFree86-VidModeExtension.3: XF86VidModeModeUnsuitable
-XProtoError.XFree86-VidModeExtension.4: XF86VidModeClientNotLocal
-XProtoError.XFree86-VidModeExtension.5: XF86VidModeExtensionDisabled
+XProtoError.XFree86-VidModeExtension.4: XF86VidModeExtensionDisabled
+XProtoError.XFree86-VidModeExtension.5: XF86VidModeClientNotLocal
XProtoError.XFree86-VidModeExtension.6: XF86VidModeZoomLocked
! XFree86-Misc -- not an X Consortium standard
XRequest.XFree86-Misc.0: XF86MiscQueryVersion
@@ -590,6 +604,9 @@ XRequest.XFree86-Misc.3: XF86MiscGetMouseSettings
XRequest.XFree86-Misc.4: XF86MiscGetKbdSettings
XRequest.XFree86-Misc.5: XF86MiscSetMouseSettings
XRequest.XFree86-Misc.6: XF86MiscSetKbdSettings
+XRequest.XFree86-Misc.7: XF86MiscSetGrabKeysState
+XRequest.XFree86-Misc.8: XF86MiscSetClientVersion
+XRequest.XFree86-Misc.9: XF86MiscGetFilePaths
XProtoError.XFree86-Misc.0: XF86MiscBadMouseProtocol
XProtoError.XFree86-Misc.1: XF86MiscBadMouseBaudRate
XProtoError.XFree86-Misc.2: XF86MiscBadMouseFlags
@@ -597,8 +614,9 @@ XProtoError.XFree86-Misc.3: XF86MiscBadMouseCombo
XProtoError.XFree86-Misc.4: XF86MiscBadKbdType
XProtoError.XFree86-Misc.5: XF86MiscModInDevDisabled
XProtoError.XFree86-Misc.6: XF86MiscModInDevClientNotLocal
+XProtoError.XFree86-Misc.7: XF86MiscNoModule
! XFree86-DGA -- not an X Consortium standard
-XRequest.XFree86-DGA.0: XF86DGAQueryVersion
+XRequest.XFree86-DGA.0: XDGAQueryVersion
XRequest.XFree86-DGA.1: XF86DGAGetVideoLL
XRequest.XFree86-DGA.2: XF86DGADirectVideo
XRequest.XFree86-DGA.3: XF86DGAGetViewPortSize
@@ -608,10 +626,28 @@ XRequest.XFree86-DGA.6: XF86DGASetVidPage
XRequest.XFree86-DGA.7: XF86DGAInstallColormap
XRequest.XFree86-DGA.8: XF86DGAQueryDirectVideo
XRequest.XFree86-DGA.9: XF86DGAViewPortChanged
+XRequest.XFree86-DGA.10: XF86DGAObsolete1
+XRequest.XFree86-DGA.11: XF86DGAObsolete2
+XRequest.XFree86-DGA.12: XDGAQueryModes
+XRequest.XFree86-DGA.13: XDGASetMode
+XRequest.XFree86-DGA.14: XDGASetViewport
+XRequest.XFree86-DGA.15: XDGAInstallColormap
+XRequest.XFree86-DGA.16: XDGASelectInput
+XRequest.XFree86-DGA.17: XDGAFillRectangle
+XRequest.XFree86-DGA.18: XDGACopyArea
+XRequest.XFree86-DGA.19: XDGACopyTransparentArea
+XRequest.XFree86-DGA.20: XDGAGetViewportStatus
+XRequest.XFree86-DGA.21: XDGASync
+XRequest.XFree86-DGA.22: XDGAOpenFramebuffer
+XRequest.XFree86-DGA.23: XDGACloseFramebuffer
+XRequest.XFree86-DGA.24: XDGASetClientVersion
+XRequest.XFree86-DGA.25: XDGAChangePixmapMode
+XRequest.XFree86-DGA.26: XDGACreateColormap
XProtoError.XFree86-DGA.0: XF86DGAClientNotLocal
XProtoError.XFree86-DGA.1: XF86DGANoDirectVideoMode
XProtoError.XFree86-DGA.2: XF86DGAScreenNotActive
XProtoError.XFree86-DGA.3: XF86DGADirectNotActivated
+XProtoError.XFree86-DGA.4: XF86DGAOperationNotSupported
! DOUBLE-BUFFER (DBE), an X Consortium standard
XRequest.DOUBLE-BUFFER.0: DBEGetVersion
XRequest.DOUBLE-BUFFER.1: DBEAllocateBackBufferName
@@ -735,3 +771,115 @@ XRequest.XINERAMA.0: XINERAMAQueryVersion
XRequest.XINERAMA.1: XINERAMAGetState
XRequest.XINERAMA.2: XINERAMAGetScreenCount
XRequest.XINERAMA.3: XINERAMAGetScreenSize
+XRequest.XINERAMA.4: XINERAMAIsActive
+XRequest.XINERAMA.5: XINERAMAQueryScreens
+! XF86Rush extension, not a standard spec
+Xrequest.XFree86-Rush.0: XF86RushQueryVersion
+Xrequest.XFree86-Rush.1: XF86RushLockPixmap
+Xrequest.XFree86-Rush.2: XF86RushUnlockPixmap
+Xrequest.XFree86-Rush.3: XF86RushUnlockAllPixmaps
+Xrequest.XFree86-Rush.4: XF86RushGetCopyMode
+Xrequest.XFree86-Rush.5: XF86RushSetCopyMode
+Xrequest.XFree86-Rush.6: XF86RushGetPixelStride
+Xrequest.XFree86-Rush.7: XF86RushSetPixelStride
+Xrequest.XFree86-Rush.8: XF86RushOverlayPixmap
+Xrequest.XFree86-Rush.9: XF86RushStatusRegOffset
+Xrequest.XFree86-Rush.10: XF86RushAT3DEnableRegs
+Xrequest.XFree86-Rush.11: XF86RushAT3DDisableRegs
+! XVideo
+Xrequest.XVideo.0: XvQueryExtension
+Xrequest.XVideo.1: XvQueryAdaptors
+Xrequest.XVideo.2: XvQueryEncodings
+Xrequest.XVideo.3: XvGrabPort
+Xrequest.XVideo.4: XvUngrabPort
+Xrequest.XVideo.5: XvPutVideo
+Xrequest.XVideo.6: XvPutStill
+Xrequest.XVideo.7: XvGetVideo
+Xrequest.XVideo.8: XvGetStill
+Xrequest.XVideo.9: XvStopVideo
+Xrequest.XVideo.10: XvSelectVideoNotify
+Xrequest.XVideo.11: XvSelectPortNotify
+Xrequest.XVideo.12: XvQueryBestSize
+Xrequest.XVideo.13: XvSetPortAttribute
+Xrequest.XVideo.14: XvGetPortAttribute
+Xrequest.XVideo.15: XvQueryPortAttributes
+Xrequest.XVideo.16: XvListImageFormats
+Xrequest.XVideo.17: XvQueryImageAttributes
+Xrequest.XVideo.18: XvPutImage
+Xrequest.XVideo.19: XvShmPutImage
+XProtoError.XVideo.0: XvBadPort
+XProtoError.XVideo.1: XvBadEncoding
+XProtoError.XVideo.2: XvBadControl
+! XFree86-Bigfont
+Xrequest.XFree86-Bigfont.0: XF86BigfontQueryVersion
+Xrequest.XFree86-Bigfont.1: XF86BigfontQueryFont
+! Adobe-DPS-Extension, not a standard
+XRequest.Adobe-DPS-Extension.1: PSInit
+XRequest.Adobe-DPS-Extension.2: PSCreateContext
+XRequest.Adobe-DPS-Extension.3: PSCreateSpace
+XRequest.Adobe-DPS-Extension.4: PSGiveInput
+XRequest.Adobe-DPS-Extension.5: PSGetStatus
+XRequest.Adobe-DPS-Extension.6: PSDestroySpace
+XRequest.Adobe-DPS-Extension.7: PSReset
+XRequest.Adobe-DPS-Extension.8: PSNotifyContext
+XRequest.Adobe-DPS-Extension.9: PSCreateContextFromID
+XRequest.Adobe-DPS-Extension.10: PSXIDFromContext
+XRequest.Adobe-DPS-Extension.11: PSContextFromXID
+XRequest.Adobe-DPS-Extension.12: PSSetStatusMask
+XRequest.Adobe-DPS-Extension.13: PSCreateSecureContext
+XRequest.Adobe-DPS-Extension.14: PSNotifyWhenReady
+XProtoError.Adobe-DPS-Extension.0: PSErrorBadContext (invalid Context parameter)
+XlibMessage.Adobe-DPS-Extension.0: Context id in failed request: 0x%lx
+XProtoError.Adobe-DPS-Extension.1: PSErrorBadSpace (invalid Space parameter)
+XlibMessage.Adobe-DPS-Extension.1: Space id in failed request: 0x%lx
+XProtoError.Adobe-DPS-Extension.2: PSErrorAbort (interpreter aborted)
+XlibMessage.Adobe-DPS-Extension.2: Value in failed request: 0x%lx
+! RANDR
+XRequest.RANDR.0: RRQueryVersion
+XRequest.RANDR.1: RROldGetScreenInfo
+XRequest.RANDR.2: RRSetScreenConfig
+XRequest.RANDR.3: RROldScreenChangeSelectInput
+XRequest.RANDR.4: RRSelectInput
+XRequest.RANDR.5: RRGetScreenInfo
+! RENDER
+XRequest.RENDER.0: RenderQueryVersion
+XRequest.RENDER.1: RenderQueryPictFormats
+XRequest.RENDER.2: RenderQueryPictIndexValues
+XRequest.RENDER.3: RenderQueryDithers
+XRequest.RENDER.4: RenderCreatePicture
+XRequest.RENDER.5: RenderChangePicture
+XRequest.RENDER.6: RenderSetPictureClipRectangles
+XRequest.RENDER.7: RenderFreePicture
+XRequest.RENDER.8: RenderComposite
+XRequest.RENDER.9: RenderScale
+XRequest.RENDER.10: RenderTrapezoids
+XRequest.RENDER.11: RenderTriangles
+XRequest.RENDER.12: RenderTriStrip
+XRequest.RENDER.13: RenderTriFan
+XRequest.RENDER.14: RenderColorTrapezoids
+XRequest.RENDER.15: RenderColorTriangles
+XRequest.RENDER.16: RenderTransform
+XRequest.RENDER.17: RenderCreateGlyphSet
+XRequest.RENDER.18: RenderReferenceGlyphSet
+XRequest.RENDER.19: RenderFreeGlyphSet
+XRequest.RENDER.20: RenderAddGlyphs
+XRequest.RENDER.21: RenderAddGlyphsFromPicture
+XRequest.RENDER.22: RenderFreeGlyphs
+XRequest.RENDER.23: RenderCompositeGlyphs8
+XRequest.RENDER.24: RenderCompositeGlyphs16
+XRequest.RENDER.25: RenderCompositeGlyphs32
+XRequest.RENDER.26: RenderFillRectangles
+XRequest.RENDER.27: RenderCreateCursor
+XRequest.RENDER.28: RenderSetPictureTransform
+XRequest.RENDER.29: RenderQueryFilters
+XRequest.RENDER.30: RenderSetPictureFilter
+XProtoError.RENDER.0: RenderBadFormat (invalid PictFormat parameter)
+XlibMessage.RENDER.0: PictFormat id in failed request: 0x%lx
+XProtoError.RENDER.1: RenderBadPicture (invalid Picture parameter)
+XlibMessage.RENDER.1: Picture id in failed request: 0x%lx
+XProtoError.RENDER.2: RenderBadPictOp (invalid PictOp parameter)
+XlibMessage.RENDER.2: PictOp in failed request: 0x%lx
+XProtoError.RENDER.3: RenderBadGlyphSet (invalid GlyphSet parameter)
+XlibMessage.RENDER.3: GlyphSet id in failed request: 0x%lx
+XProtoError.RENDER.4: RenderBadGlyph (invalid Glyph parameter)
+XlibMessage.RENDER.4: Glyph in failed request: 0x%lx
diff --git a/src/XKeysymDB b/src/XKeysymDB
index 70575cec..f1469505 100644
--- a/src/XKeysymDB
+++ b/src/XKeysymDB
@@ -10,6 +10,8 @@
! written prior permission. M.I.T. makes no representations about the
! suitability of this software for any purpose. It is provided "as is"
! without express or implied warranty.
+!
+! $XFree86: xc/lib/X11/XKeysymDB,v 3.16 2003/02/11 02:51:10 dawes Exp $
hpmute_acute :100000A8
hpmute_grave :100000A9
@@ -195,7 +197,153 @@ XeroxPointerButton3 :10070003
XeroxPointerButton4 :10070004
XeroxPointerButton5 :10070005
+! The definitions here should match <X11/XF86keysym.h>
XF86ModeLock :1008FF01
+XF86Standby :1008FF10
+XF86AudioLowerVolume :1008FF11
+XF86AudioMute :1008FF12
+XF86AudioRaiseVolume :1008FF13
+XF86AudioPlay :1008FF14
+XF86AudioStop :1008FF15
+XF86AudioPrev :1008FF16
+XF86AudioNext :1008FF17
+XF86HomePage :1008FF18
+XF86Mail :1008FF19
+XF86Start :1008FF1A
+XF86Search :1008FF1B
+XF86AudioRecord :1008FF1C
+XF86Calculator :1008FF1D
+XF86Memo :1008FF1E
+XF86ToDoList :1008FF1F
+XF86Calendar :1008FF20
+XF86PowerDown :1008FF21
+XF86ContrastAdjust :1008FF22
+XF86RockerUp :1008FF23
+XF86RockerDown :1008FF24
+XF86RockerEnter :1008FF25
+XF86Back :1008FF26
+XF86Forward :1008FF27
+XF86Stop :1008FF28
+XF86Refresh :1008FF29
+XF86PowerOff :1008FF2A
+XF86WakeUp :1008FF2B
+XF86Eject :1008FF2C
+XF86ScreenSaver :1008FF2D
+XF86WWW :1008FF2E
+XF86Sleep :1008FF2F
+XF86Favorites :1008FF30
+XF86AudioPause :1008FF31
+XF86AudioMedia :1008FF32
+XF86MyComputer :1008FF33
+XF86VendorHome :1008FF34
+XF86LightBulb :1008FF35
+XF86Shop :1008FF36
+XF86History :1008FF37
+XF86OpenURL :1008FF38
+XF86AddFavorite :1008FF39
+XF86HotLinks :1008FF3A
+XF86BrightnessAdjust :1008FF3B
+XF86Finance :1008FF3C
+XF86Community :1008FF3D
+XF86AudioRewind :1008FF3E
+XF86BackForward :1008FF3F
+XF86Launch0 :1008FF40
+XF86Launch1 :1008FF41
+XF86Launch2 :1008FF42
+XF86Launch3 :1008FF43
+XF86Launch4 :1008FF44
+XF86Launch5 :1008FF45
+XF86Launch6 :1008FF46
+XF86Launch7 :1008FF47
+XF86Launch8 :1008FF48
+XF86Launch9 :1008FF49
+XF86LaunchA :1008FF4A
+XF86LaunchB :1008FF4B
+XF86LaunchC :1008FF4C
+XF86LaunchD :1008FF4D
+XF86LaunchE :1008FF4E
+XF86LaunchF :1008FF4F
+XF86ApplicationLeft :1008FF50
+XF86ApplicationRight :1008FF51
+XF86Book :1008FF52
+XF86CD :1008FF53
+XF86Calculater :1008FF54
+XF86Clear :1008FF55
+XF86Close :1008FF56
+XF86Copy :1008FF57
+XF86Cut :1008FF58
+XF86Display :1008FF59
+XF86DOS :1008FF5A
+XF86Documents :1008FF5B
+XF86Excel :1008FF5C
+XF86Explorer :1008FF5D
+XF86Game :1008FF5E
+XF86Go :1008FF5F
+XF86iTouch :1008FF60
+XF86LogOff :1008FF61
+XF86Market :1008FF62
+XF86Meeting :1008FF63
+XF86MenuKB :1008FF65
+XF86MenuPB :1008FF66
+XF86MySites :1008FF67
+XF86New :1008FF68
+XF86News :1008FF69
+XF86OfficeHome :1008FF6A
+XF86Open :1008FF6B
+XF86Option :1008FF6C
+XF86Paste :1008FF6D
+XF86Phone :1008FF6E
+XF86Q :1008FF70
+XF86Reply :1008FF72
+XF86Reload :1008FF73
+XF86RotateWindows :1008FF74
+XF86RotationPB :1008FF75
+XF86RotationKB :1008FF76
+XF86Save :1008FF77
+XF86ScrollUp :1008FF78
+XF86ScrollDown :1008FF79
+XF86ScrollClick :1008FF7A
+XF86Send :1008FF7B
+XF86Spell :1008FF7C
+XF86SplitScreen :1008FF7D
+XF86Support :1008FF7E
+XF86TaskPane :1008FF7F
+XF86Terminal :1008FF80
+XF86Tools :1008FF81
+XF86Travel :1008FF82
+XF86UserPB :1008FF84
+XF86User1KB :1008FF85
+XF86User2KB :1008FF86
+XF86Video :1008FF87
+XF86WheelButton :1008FF88
+XF86Word :1008FF89
+XF86Xfer :1008FF8A
+XF86ZoomIn :1008FF8B
+XF86ZoomOut :1008FF8C
+XF86Away :1008FF8D
+XF86Messenger :1008FF8E
+XF86WebCam :1008FF8F
+XF86MailForward :1008FF90
+XF86Pictures :1008FF91
+XF86Music :1008FF92
+
+! XFree86 special action keys
+XF86_Switch_VT_1 :1008FE01
+XF86_Switch_VT_2 :1008FE02
+XF86_Switch_VT_3 :1008FE03
+XF86_Switch_VT_4 :1008FE04
+XF86_Switch_VT_5 :1008FE05
+XF86_Switch_VT_6 :1008FE06
+XF86_Switch_VT_7 :1008FE07
+XF86_Switch_VT_8 :1008FE08
+XF86_Switch_VT_9 :1008FE09
+XF86_Switch_VT_10 :1008FE0A
+XF86_Switch_VT_11 :1008FE0B
+XF86_Switch_VT_12 :1008FE0C
+XF86_Ungrab :1008FE20
+XF86_ClearGrab :1008FE21
+XF86_Next_VMode :1008FE22
+XF86_Prev_VMode :1008FE23
usldead_acute :100000A8
usldead_grave :100000A9
diff --git a/src/Xintatom.h b/src/Xintatom.h
index 910c0fa2..f1e13568 100644
--- a/src/Xintatom.h
+++ b/src/Xintatom.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/Xintatom.h,v 1.1 2001/08/18 02:41:28 dawes Exp $ */
+/* $XFree86$ */
#ifndef _XINTATOM_H_
#define _XINTATOM_H_ 1
diff --git a/src/Xintconn.h b/src/Xintconn.h
index 3010da4f..edea9830 100644
--- a/src/Xintconn.h
+++ b/src/Xintconn.h
@@ -9,6 +9,15 @@ _XFUNCPROTOBEGIN
/* ConnDis.c */
+int _XConnectDisplay (
+ char *display_name,
+ char **fullnamep, /* RETURN */
+ int *dpynump, /* RETURN */
+ int *screenp, /* RETURN */
+ char **auth_namep, /* RETURN */
+ int *auth_namelenp, /* RETURN */
+ char **auth_datap, /* RETURN */
+ int *auth_datalenp); /* RETURN */
extern int _XDisconnectDisplay(XtransConnInfo trans_conn);
extern Bool _XSendClientPrefix(Display *dpy, xConnClientPrefix *client,
char *auth_proto, char *auth_string,
diff --git a/src/XlibInt.c b/src/XlibInt.c
index a14cb333..172fc9e5 100644
--- a/src/XlibInt.c
+++ b/src/XlibInt.c
@@ -1,7 +1,7 @@
-/* $Xorg: XlibInt.c,v 1.10 2001/02/20 02:13:26 coskrey Exp $ */
+/* $Xorg: XlibInt.c,v 1.8 2001/02/09 02:03:38 xorgcvs Exp $ */
/*
-Copyright 1985, 1986, 1987, 1998, 2001 The Open Group
+Copyright 1985, 1986, 1987, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/lib/X11/XlibInt.c,v 3.38 2003/10/30 21:55:05 alanh Exp $ */
/*
* XlibInt.c - Internal support routines for the C subroutine
@@ -33,13 +34,11 @@ from The Open Group.
*/
#define NEED_EVENTS
#define NEED_REPLIES
-
-#define GENERIC_LENGTH_LIMIT (1 << 29)
#include "Xlibint.h"
#include <X11/Xpoll.h>
#include <X11/Xtrans.h>
-#include "xcmiscstr.h"
+#include <X11/extensions/xcmiscstr.h>
#include <stdio.h>
#ifdef XTHREADS
@@ -47,12 +46,24 @@ from The Open Group.
/* these pointers get initialized by XInitThreads */
LockInfoPtr _Xglobal_lock = NULL;
-void (*_XCreateMutex_fn)() = NULL;
-struct _XCVList *(*_XCreateCVL_fn)() = NULL;
-void (*_XFreeMutex_fn)() = NULL;
-void (*_XLockMutex_fn)() = NULL;
-void (*_XUnlockMutex_fn)() = NULL;
-xthread_t (*_Xthread_self_fn)() = NULL;
+void (*_XCreateMutex_fn)(LockInfoPtr) = NULL;
+/* struct _XCVList *(*_XCreateCVL_fn)() = NULL; */
+void (*_XFreeMutex_fn)(LockInfoPtr) = NULL;
+void (*_XLockMutex_fn)(
+ LockInfoPtr /* lock */
+#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
+ , char * /* file */
+ , int /* line */
+#endif
+ ) = NULL;
+void (*_XUnlockMutex_fn)(
+ LockInfoPtr /* lock */
+#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
+ , char * /* file */
+ , int /* line */
+#endif
+ ) = NULL;
+xthread_t (*_Xthread_self_fn)(void) = NULL;
#define XThread_Self() ((*_Xthread_self_fn)())
@@ -86,6 +97,9 @@ xthread_t (*_Xthread_self_fn)() = NULL;
#ifdef WIN32
#define ETEST() (WSAGetLastError() == WSAEWOULDBLOCK)
#else
+#ifdef __CYGWIN__ /* Cygwin uses ENOBUFS to signal socket is full */
+#define ETEST() (errno == EAGAIN || errno == EWOULDBLOCK || errno == ENOBUFS)
+#else
#if defined(EAGAIN) && defined(EWOULDBLOCK)
#define ETEST() (errno == EAGAIN || errno == EWOULDBLOCK)
#else
@@ -93,16 +107,27 @@ xthread_t (*_Xthread_self_fn)() = NULL;
#define ETEST() (errno == EAGAIN)
#else
#define ETEST() (errno == EWOULDBLOCK)
-#endif
-#endif
-#endif
+#endif /* EAGAIN */
+#endif /* EAGAIN && EWOULDBLOCK */
+#endif /* __CYGWIN__ */
+#endif /* WIN32 */
+
#ifdef WIN32
#define ECHECK(err) (WSAGetLastError() == err)
#define ESET(val) WSASetLastError(val)
#else
+#ifdef __UNIXOS2__
+#define ECHECK(err) (errno == err)
+#define ESET(val)
+#else
+#ifdef ISC
+#define ECHECK(err) ((errno == err) || ETEST())
+#else
#define ECHECK(err) (errno == err)
+#endif
#define ESET(val) errno = val
#endif
+#endif
#if defined(LOCALCONN) || defined(LACHMAN)
#ifdef EMSGSIZE
@@ -116,6 +141,12 @@ xthread_t (*_Xthread_self_fn)() = NULL;
#endif
#endif
+#ifdef __UNIXOS2__
+#define select(n,r,w,x,t) os2ClientSelect(n,r,w,x,t)
+#include <limits.h>
+#define MAX_PATH _POSIX_PATH_MAX
+#endif
+
#ifdef MUSTCOPY
#define STARTITERATE(tpvar,type,start,endcond) \
@@ -144,8 +175,17 @@ typedef union {
char buf[BUFSIZE];
} _XAlignedBuffer;
-static char *_XAsyncReply();
-static void _XProcessInternalConnection();
+static char *_XAsyncReply(
+ Display *dpy,
+ register xReply *rep,
+ char *buf,
+ register int *lenp,
+ Bool discard);
+
+static void _XProcessInternalConnection(
+ Display *dpy,
+ struct _XConnectionInfo *conn_info);
+
#define SEQLIMIT (65535 - (BUFSIZE / SIZEOF(xReq)) - 10)
/*
@@ -166,10 +206,6 @@ static void _XProcessInternalConnection();
* the object they have created.
*/
-static int padlength[4] = {0, 3, 2, 1};
- /* lookup table for adding padding bytes to data that is read from
- or written to the X socket. */
-
static xReq _dummy_request = {
0, 0, 0
};
@@ -181,15 +217,13 @@ static xReq _dummy_request = {
* until the connection is writable.
*/
static void
-_XWaitForWritable(dpy
+_XWaitForWritable(
+ Display *dpy
#ifdef XTHREADS
- , cv
-#endif
- )
- Display *dpy;
-#ifdef XTHREADS
- xcondition_t cv; /* our reading condition variable */
+ ,
+ xcondition_t cv /* our reading condition variable */
#endif
+ )
{
#ifdef USE_POLL
struct pollfd filedes;
@@ -263,7 +297,7 @@ _XWaitForWritable(dpy
{
_XAlignedBuffer buf;
BytesReadable_t pend;
- register BytesReadable_t len;
+ register int len;
register xReply *rep;
/* find out how much data can be read */
@@ -290,11 +324,12 @@ _XWaitForWritable(dpy
STARTITERATE(rep,xReply,buf.buf,len > 0) {
if (rep->generic.type == X_Reply) {
- pend = len;
+ int tmp = len;
RESETITERPTR(rep,xReply,
_XAsyncReply (dpy, rep,
- ITERPTR(rep), &pend, True));
- len = pend;
+ ITERPTR(rep), &tmp, True));
+ len = tmp;
+ pend = len;
} else {
if (rep->generic.type == X_Error)
_XError (dpy, (xError *)rep);
@@ -329,8 +364,8 @@ _XWaitForWritable(dpy
#define POLLFD_CACHE_SIZE 5
/* initialize the struct array passed to poll() below */
-Bool _XPollfdCacheInit(dpy)
- Display *dpy;
+Bool _XPollfdCacheInit(
+ Display *dpy)
{
#ifdef USE_POLL
struct pollfd *pfp;
@@ -346,9 +381,9 @@ Bool _XPollfdCacheInit(dpy)
return True;
}
-void _XPollfdCacheAdd(dpy, fd)
- Display *dpy;
- int fd;
+void _XPollfdCacheAdd(
+ Display *dpy,
+ int fd)
{
#ifdef USE_POLL
struct pollfd *pfp = (struct pollfd *)dpy->filedes;
@@ -361,9 +396,9 @@ void _XPollfdCacheAdd(dpy, fd)
}
/* ARGSUSED */
-void _XPollfdCacheDel(dpy, fd)
- Display *dpy;
- int fd; /* not used */
+void _XPollfdCacheDel(
+ Display *dpy,
+ int fd) /* not used */
{
#ifdef USE_POLL
struct pollfd *pfp = (struct pollfd *)dpy->filedes;
@@ -384,9 +419,9 @@ void _XPollfdCacheDel(dpy, fd)
/* returns True iff there is an event in the queue newer than serial_num */
static Bool
-_XNewerQueuedEvent(dpy, serial_num)
- Display *dpy;
- int serial_num;
+_XNewerQueuedEvent(
+ Display *dpy,
+ int serial_num)
{
_XQEvent *qev;
@@ -404,14 +439,14 @@ _XNewerQueuedEvent(dpy, serial_num)
}
static int
-_XWaitForReadable(dpy)
- Display *dpy;
+_XWaitForReadable(
+ Display *dpy)
{
int result;
int fd = dpy->fd;
struct _XConnectionInfo *ilist;
- register int saved_event_serial;
- int in_read_events;
+ register int saved_event_serial = 0;
+ int in_read_events = 0;
register Bool did_proc_conni = False;
#ifdef USE_POLL
struct pollfd *filedes;
@@ -512,8 +547,8 @@ _XWaitForReadable(dpy)
}
static
-int _XSeqSyncFunction(dpy)
- register Display *dpy;
+int _XSeqSyncFunction(
+ register Display *dpy)
{
xGetInputFocusReply rep;
register xReq *req;
@@ -534,7 +569,9 @@ int _XSeqSyncFunction(dpy)
}
#ifdef XTHREADS
-static void _XFlushInt();
+static void _XFlushInt(
+ register Display *dpy,
+ register xcondition_t cv);
#endif
/*
@@ -542,8 +579,8 @@ static void _XFlushInt();
* action is taken. This routine correctly handles incremental writes.
* This routine may have to be reworked if int < long.
*/
-void _XFlush (dpy)
- register Display *dpy;
+void _XFlush(
+ register Display *dpy)
{
#ifdef XTHREADS
/* With multi-threading we introduce an internal routine to which
@@ -556,11 +593,10 @@ void _XFlush (dpy)
* locking correctly.
*/
-static void _XFlushInt (dpy, cv)
- register Display *dpy;
- register xcondition_t cv;
+static void _XFlushInt(
+ register Display *dpy,
+ register xcondition_t cv)
{
- char *nextindex;
#endif /* XTHREADS*/
register long size, todo;
register int write_stat;
@@ -581,7 +617,11 @@ static void _XFlushInt (dpy, cv)
#ifdef XTHREADS
while (dpy->flags & XlibDisplayWriting) {
- ConditionWait(dpy, dpy->lock->writers);
+ if (dpy->lock) {
+ ConditionWait(dpy, dpy->lock->writers);
+ } else {
+ _XWaitForWritable (dpy, cv);
+ }
}
#endif
size = todo = dpy->bufptr - dpy->buffer;
@@ -653,11 +693,11 @@ static void _XFlushInt (dpy, cv)
}
int
-_XEventsQueued (dpy, mode)
- register Display *dpy;
- int mode;
+_XEventsQueued(
+ register Display *dpy,
+ int mode)
{
- register BytesReadable_t len;
+ register int len;
BytesReadable_t pend;
_XAlignedBuffer buf;
register xReply *rep;
@@ -726,6 +766,7 @@ _XEventsQueued (dpy, mode)
*/
if (!pend && !dpy->qlen && ++dpy->conn_checker >= XCONN_CHECK_FREQ)
{
+ int result;
#ifdef USE_POLL
struct pollfd filedes;
#else
@@ -737,14 +778,14 @@ _XEventsQueued (dpy, mode)
#ifdef USE_POLL
filedes.fd = dpy->fd;
filedes.events = POLLIN;
- if ((pend = poll(&filedes, 1, 0)))
+ if ((result = poll(&filedes, 1, 0)))
#else
FD_ZERO(&r_mask);
FD_SET(dpy->fd, &r_mask);
- if ((pend = Select(dpy->fd + 1, &r_mask, NULL, NULL, &zero_time)))
+ if ((result = Select(dpy->fd + 1, &r_mask, NULL, NULL, &zero_time)))
#endif
{
- if (pend > 0)
+ if (result > 0)
{
if (_X11TransBytesReadable(dpy->trans_conn, &pend) < 0)
_XIOError(dpy);
@@ -752,14 +793,19 @@ _XEventsQueued (dpy, mode)
if (!pend)
pend = SIZEOF(xReply);
}
- else if (pend < 0 && !ECHECK(EINTR))
+ else if (result < 0 && !ECHECK(EINTR))
_XIOError(dpy);
}
}
#endif /* XCONN_CHECK_FREQ */
if (!(len = pend)) {
/* _XFlush can enqueue events */
- UnlockNextEventReader(dpy);
+#ifdef XTHREADS
+ if (cvl)
+#endif
+ {
+ UnlockNextEventReader(dpy);
+ }
return(dpy->qlen);
}
/* Force a read if there is not enough data. Otherwise,
@@ -803,7 +849,9 @@ _XEventsQueued (dpy, mode)
if (read_buf != (char *)dpy->lock->reply_awaiters->buf)
memcpy(dpy->lock->reply_awaiters->buf, read_buf,
len);
- UnlockNextEventReader(dpy);
+ if (cvl) {
+ UnlockNextEventReader(dpy);
+ }
return(dpy->qlen); /* we read, so we can return */
} else if (read_buf != buf.buf)
memcpy(buf.buf, read_buf, len);
@@ -812,11 +860,12 @@ _XEventsQueued (dpy, mode)
STARTITERATE(rep,xReply,buf.buf,len > 0) {
if (rep->generic.type == X_Reply) {
- pend = len;
+ int tmp = len;
RESETITERPTR(rep,xReply,
_XAsyncReply (dpy, rep,
- ITERPTR(rep), &pend, True));
- len = pend;
+ ITERPTR(rep), &tmp, True));
+ len = tmp;
+ pend = len;
} else {
if (rep->generic.type == X_Error)
_XError (dpy, (xError *)rep);
@@ -827,19 +876,24 @@ _XEventsQueued (dpy, mode)
}
} ENDITERATE
- UnlockNextEventReader(dpy);
+#ifdef XTHREADS
+ if (cvl)
+#endif
+ {
+ UnlockNextEventReader(dpy);
+ }
return(dpy->qlen);
}
/* _XReadEvents - Flush the output queue,
* then read as many events as possible (but at least 1) and enqueue them
*/
-void _XReadEvents(dpy)
- register Display *dpy;
+void _XReadEvents(
+ register Display *dpy)
{
_XAlignedBuffer buf;
BytesReadable_t pend;
- register BytesReadable_t len;
+ int len;
register xReply *rep;
Bool not_yet_flushed = True;
char *read_buf;
@@ -971,11 +1025,10 @@ void _XReadEvents(dpy)
STARTITERATE(rep,xReply,buf.buf,len > 0) {
if (rep->generic.type == X_Reply) {
- pend = len;
RESETITERPTR(rep,xReply,
_XAsyncReply (dpy, rep,
- ITERPTR(rep), &pend, True));
- len = pend;
+ ITERPTR(rep), &len, True));
+ pend = len;
} else {
if (rep->generic.type == X_Error)
_XError (dpy, (xError *) rep);
@@ -994,10 +1047,10 @@ void _XReadEvents(dpy)
* _XRead - Read bytes from the socket taking into account incomplete
* reads. This routine may have to be reworked if int < long.
*/
-int _XRead (dpy, data, size)
- register Display *dpy;
- register char *data;
- register long size;
+int _XRead(
+ register Display *dpy,
+ register char *data,
+ register long size)
{
register long bytes_read;
#ifdef XTHREADS
@@ -1051,10 +1104,10 @@ int _XRead (dpy, data, size)
}
#ifdef LONG64
-void _XRead32 (dpy, data, len)
- Display *dpy;
- register long *data;
- long len;
+void _XRead32(
+ Display *dpy,
+ register long *data,
+ long len)
{
register int *buf;
register long i;
@@ -1085,11 +1138,11 @@ void _XRead32 (dpy, data, len)
* into a long (64 bits on a CRAY computer).
*
*/
-static void _doXRead32 (dpy, data, size, packbuffer)
- register Display *dpy;
- register long *data;
- register long size;
- register char *packbuffer;
+static void _doXRead32(
+ register Display *dpy,
+ register long *data
+ register long size,
+ register char *packbuffer)
{
long *lpack,*lp;
long mask32 = 0x00000000ffffffff;
@@ -1112,10 +1165,10 @@ static void _doXRead32 (dpy, data, size, packbuffer)
}
}
-void _XRead32 (dpy, data, len)
- Display *dpy;
- long *data;
- long len;
+void _XRead32(
+ Display *dpy,
+ long *data,
+ long len)
{
char packbuffer[PACKBUFFERSIZE];
unsigned nunits = PACKBUFFERSIZE >> 2;
@@ -1133,11 +1186,11 @@ void _XRead32 (dpy, data, len)
* into a long (64 bits on a CRAY computer).
*
*/
-static _doXRead16 (dpy, data, size, packbuffer)
- register Display *dpy;
- register short *data;
- register long size;
- char *packbuffer;
+static _doXRead16(
+ register Display *dpy,
+ register short *data,
+ register long size,
+ char *packbuffer)
{
long *lpack,*lp;
long mask16 = 0x000000000000ffff;
@@ -1160,10 +1213,10 @@ static _doXRead16 (dpy, data, size, packbuffer)
}
}
-void _XRead16 (dpy, data, len)
- Display *dpy;
- short *data;
- long len;
+void _XRead16(
+ Display *dpy,
+ short *data,
+ long len)
{
char packbuffer[PACKBUFFERSIZE];
unsigned nunits = PACKBUFFERSIZE >> 1;
@@ -1174,10 +1227,10 @@ void _XRead16 (dpy, data, len)
if (len) _doXRead16 (dpy, data, len, packbuffer);
}
-void _XRead16Pad (dpy, data, size)
- Display *dpy;
- short *data;
- long size;
+void _XRead16Pad(
+ Display *dpy,
+ short *data,
+ long size)
{
int slop = (size & 3);
short slopbuf[3];
@@ -1195,10 +1248,10 @@ void _XRead16Pad (dpy, data, size)
* reads. If the number of bytes is not 0 mod 4, read additional pad
* bytes. This routine may have to be reworked if int < long.
*/
-void _XReadPad (dpy, data, size)
- register Display *dpy;
- register char *data;
- register long size;
+void _XReadPad(
+ register Display *dpy,
+ register char *data,
+ register long size)
{
register long bytes_read;
struct iovec iov[2];
@@ -1216,7 +1269,7 @@ void _XReadPad (dpy, data, size)
* whatever is needed.
*/
- iov[1].iov_len = padlength[size & 3];
+ iov[1].iov_len = -size & 3;
iov[1].iov_base = pad;
size += iov[1].iov_len;
#ifdef XTHREADS
@@ -1227,14 +1280,18 @@ void _XReadPad (dpy, data, size)
if (bytes_read > 0) {
size -= bytes_read;
- if ((iov[0].iov_len -= bytes_read) < 0) {
- iov[1].iov_len += iov[0].iov_len;
- iov[1].iov_base = (char *)iov[1].iov_base - iov[0].iov_len;
+ if (iov[0].iov_len < bytes_read) {
+ int pad_bytes_read = bytes_read - iov[0].iov_len;
+ iov[1].iov_len -= pad_bytes_read;
+ iov[1].iov_base =
+ (char *)iov[1].iov_base + pad_bytes_read;
iov[0].iov_len = 0;
}
- else
+ else {
+ iov[0].iov_len -= bytes_read;
iov[0].iov_base = (char *)iov[0].iov_base + bytes_read;
}
+ }
else if (ETEST()) {
_XWaitForReadable(dpy);
ESET(0);
@@ -1274,20 +1331,13 @@ void _XReadPad (dpy, data, size)
* This routine may have to be reworked if int < long;
*/
void
-#if NeedFunctionPrototypes
_XSend (
register Display *dpy,
_Xconst char *data,
register long size)
-#else
-_XSend (dpy, data, size)
- register Display *dpy;
- char *data;
- register long size;
-#endif
{
struct iovec iov[3];
- static char pad[3] = {0, 0, 0};
+ static char const pad[3] = {0, 0, 0};
/* XText8 and XText16 require that the padding bytes be zero! */
long skip, dbufsize, padsize, total, todo;
@@ -1300,7 +1350,7 @@ _XSend (dpy, data, size)
/* make sure no one else can put in data */
dpy->bufptr = dpy->bufmax;
#endif
- padsize = padlength[size & 3];
+ padsize = -size & 3;
for (ext = dpy->flushes; ext; ext = ext->next_flush) {
(*ext->before_flush)(dpy, &ext->codes, dpy->buffer, dbufsize);
(*ext->before_flush)(dpy, &ext->codes, (char *)data, size);
@@ -1355,7 +1405,7 @@ _XSend (dpy, data, size)
InsertIOV (dpy->buffer, dbufsize)
InsertIOV ((char *)data, size)
- InsertIOV (pad, padsize)
+ InsertIOV ((char *)pad, padsize)
ESET(0);
if ((len = _X11TransWritev(dpy->trans_conn, iov, i)) >= 0) {
@@ -1407,8 +1457,8 @@ _XSend (dpy, data, size)
}
static void
-_XGetMiscCode(dpy)
- register Display *dpy;
+_XGetMiscCode(
+ register Display *dpy)
{
xQueryExtensionReply qrep;
register xQueryExtensionReq *qreq;
@@ -1437,8 +1487,8 @@ _XGetMiscCode(dpy)
}
static int
-_XIDHandler(dpy)
- register Display *dpy;
+_XIDHandler(
+ register Display *dpy)
{
xXCMiscGetXIDRangeReply grep;
register xXCMiscGetXIDRangeReq *greq;
@@ -1470,8 +1520,8 @@ _XIDHandler(dpy)
/*
* _XAllocID - resource ID allocation routine.
*/
-XID _XAllocID(dpy)
- register Display *dpy;
+XID _XAllocID(
+ register Display *dpy)
{
XID id;
@@ -1500,10 +1550,10 @@ XID _XAllocID(dpy)
/*
* _XAllocIDs - multiple resource ID allocation routine.
*/
-void _XAllocIDs(dpy, ids, count)
- register Display *dpy;
- XID *ids;
- int count;
+void _XAllocIDs(
+ register Display *dpy,
+ XID *ids,
+ int count)
{
XID id;
int i;
@@ -1561,9 +1611,9 @@ void _XAllocIDs(dpy, ids, count)
*/
unsigned long
-_XSetLastRequestRead(dpy, rep)
- register Display *dpy;
- register xGenericReply *rep;
+_XSetLastRequestRead(
+ register Display *dpy,
+ register xGenericReply *rep)
{
register unsigned long newseq, lastseq;
@@ -1599,11 +1649,11 @@ _XSetLastRequestRead(dpy, rep)
* we may encounter.
*/
Status
-_XReply (dpy, rep, extra, discard)
- register Display *dpy;
- register xReply *rep;
- int extra; /* number of 32-bit words expected after the reply */
- Bool discard; /* should I discard data following "extra" words? */
+_XReply (
+ register Display *dpy,
+ register xReply *rep,
+ int extra, /* number of 32-bit words expected after the reply */
+ Bool discard) /* should I discard data following "extra" words? */
{
/* Pull out the serial number now, so that (currently illegal) requests
* generated by an error handler don't confuse us.
@@ -1670,17 +1720,6 @@ _XReply (dpy, rep, extra, discard)
!= (char *)rep)
continue;
}
- /*
- * Don't accept ridiculously large values for
- * generic.length; doing so could cause stack-scribbling
- * problems elsewhere.
- */
- if (rep->generic.length > GENERIC_LENGTH_LIMIT) {
- rep->generic.length = GENERIC_LENGTH_LIMIT;
- (void) fprintf(stderr,
- "Xlib: suspiciously long reply length %d set to %d",
- rep->generic.length, GENERIC_LENGTH_LIMIT);
- }
if (extra <= rep->generic.length) {
if (extra > 0)
/*
@@ -1786,12 +1825,12 @@ _XReply (dpy, rep, extra, discard)
}
static char *
-_XAsyncReply(dpy, rep, buf, lenp, discard)
- Display *dpy;
- register xReply *rep;
- char *buf;
- register int *lenp;
- Bool discard;
+_XAsyncReply(
+ Display *dpy,
+ register xReply *rep,
+ char *buf,
+ register int *lenp,
+ Bool discard)
{
register _XAsyncHandler *async, *next;
register int len;
@@ -1800,7 +1839,13 @@ _XAsyncReply(dpy, rep, buf, lenp, discard)
(void) _XSetLastRequestRead(dpy, &rep->generic);
len = SIZEOF(xReply) + (rep->generic.length << 2);
-
+ if (len < SIZEOF(xReply)) {
+ _XIOError (dpy);
+ buf += *lenp;
+ *lenp = 0;
+ return buf;
+ }
+
for (async = dpy->async_handlers; async; async = next) {
next = async->next;
if ((consumed = (*async->handler)(dpy, rep, buf, *lenp, async->data)))
@@ -1822,7 +1867,6 @@ _XAsyncReply(dpy, rep, buf, lenp, discard)
}
if (len < SIZEOF(xReply))
{
- ESET(EINVAL);
_XIOError (dpy);
buf += *lenp;
*lenp = 0;
@@ -1856,7 +1900,7 @@ _XAsyncReply(dpy, rep, buf, lenp, discard)
/*
* Support for internal connections, such as an IM might use.
- * By Stephen Gildea, The Open Group, September 1993
+ * By Stephen Gildea, X Consortium, September 1993
*/
/* _XRegisterInternalConnection
@@ -1879,21 +1923,13 @@ _XAsyncReply(dpy, rep, buf, lenp, discard)
* because could not allocate memory.
* Assumes Display locked when called.
*/
-#if NeedFunctionPrototypes
-Status _XRegisterInternalConnection(
+Status
+_XRegisterInternalConnection(
Display* dpy,
int fd,
_XInternalConnectionProc callback,
XPointer call_data
)
-#else
-Status
-_XRegisterInternalConnection(dpy, fd, callback, call_data)
- Display *dpy;
- int fd;
- _XInternalConnectionProc callback;
- XPointer call_data;
-#endif
{
struct _XConnectionInfo *new_conni, **iptr;
struct _XConnWatchInfo *watchers;
@@ -1936,23 +1972,18 @@ _XRegisterInternalConnection(dpy, fd, callback, call_data)
*
* Assumes Display locked when called.
*/
-#if NeedFunctionPrototypes
-void _XUnregisterInternalConnection(
+void
+_XUnregisterInternalConnection(
Display* dpy,
int fd
)
-#else
-void
-_XUnregisterInternalConnection(dpy, fd)
- Display *dpy;
- int fd;
-#endif
{
struct _XConnectionInfo *info_list, **prev;
struct _XConnWatchInfo *watch;
XPointer *wd;
- for (prev = &dpy->im_fd_info; (info_list = *prev); prev = &info_list->next) {
+ for (prev = &dpy->im_fd_info; (info_list = *prev);
+ prev = &info_list->next) {
if (info_list->fd == fd) {
*prev = info_list->next;
dpy->im_fd_length--;
@@ -1979,19 +2010,12 @@ _XUnregisterInternalConnection(dpy, fd)
* The list is allocated with Xmalloc and should be freed by the caller
* with Xfree;
*/
-#if NeedFunctionPrototypes
-Status XInternalConnectionNumbers(
+Status
+XInternalConnectionNumbers(
Display *dpy,
int **fd_return,
int *count_return
)
-#else
-Status
-XInternalConnectionNumbers(dpy, fd_return, count_return)
- Display *dpy;
- int **fd_return;
- int *count_return;
-#endif
{
int count;
struct _XConnectionInfo *info_list;
@@ -2018,9 +2042,9 @@ XInternalConnectionNumbers(dpy, fd_return, count_return)
return 1;
}
-static void _XProcessInternalConnection(dpy, conn_info)
- Display *dpy;
- struct _XConnectionInfo *conn_info;
+static void _XProcessInternalConnection(
+ Display *dpy,
+ struct _XConnectionInfo *conn_info)
{
dpy->flags |= XlibDisplayProcConni;
#ifdef XTHREADS
@@ -2047,17 +2071,11 @@ static void _XProcessInternalConnection(dpy, conn_info)
* for this fd.
* The Display is NOT locked during the call.
*/
-#if NeedFunctionPrototypes
-void XProcessInternalConnection(
+void
+XProcessInternalConnection(
Display* dpy,
int fd
)
-#else
-void
-XProcessInternalConnection(dpy, fd)
- Display *dpy;
- int fd;
-#endif
{
struct _XConnectionInfo *info_list;
@@ -2078,19 +2096,12 @@ XProcessInternalConnection(dpy, fd)
* If any connections are already registered, the callback is immediately
* called for each of them.
*/
-#if NeedFunctionPrototypes
-Status XAddConnectionWatch(
+Status
+XAddConnectionWatch(
Display* dpy,
XConnectionWatchProc callback,
XPointer client_data
)
-#else
-Status
-XAddConnectionWatch(dpy, callback, client_data)
- Display *dpy;
- XConnectionWatchProc callback;
- XPointer client_data;
-#endif
{
struct _XConnWatchInfo *new_watcher, **wptr;
struct _XConnectionInfo *info_list;
@@ -2140,19 +2151,12 @@ XAddConnectionWatch(dpy, callback, client_data)
* Both callback and client_data must match what was passed to
* XAddConnectionWatch.
*/
-#if NeedFunctionPrototypes
-void XRemoveConnectionWatch(
+void
+XRemoveConnectionWatch(
Display* dpy,
XConnectionWatchProc callback,
XPointer client_data
)
-#else
-void
-XRemoveConnectionWatch(dpy, callback, client_data)
- Display *dpy;
- XConnectionWatchProc callback;
- XPointer client_data;
-#endif
{
struct _XConnWatchInfo *watch;
struct _XConnWatchInfo *previous = NULL;
@@ -2189,9 +2193,9 @@ XRemoveConnectionWatch(dpy, callback, client_data)
/* Read and discard "n" 8-bit bytes of data */
-void _XEatData (dpy, n)
- Display *dpy;
- register unsigned long n;
+void _XEatData(
+ Display *dpy,
+ register unsigned long n)
{
#define SCRATCHSIZE 2048
char buf[SCRATCHSIZE];
@@ -2210,9 +2214,9 @@ void _XEatData (dpy, n)
* note that no squishing of move events in V11, since there
* is pointer motion hints....
*/
-void _XEnq (dpy, event)
- register Display *dpy;
- register xEvent *event;
+void _XEnq(
+ register Display *dpy,
+ register xEvent *event)
{
register _XQEvent *qelt;
@@ -2245,10 +2249,10 @@ void _XEnq (dpy, event)
/*
* _XDeq - Remove event packet from the display's queue.
*/
-void _XDeq (dpy, prev, qelt)
- register Display *dpy;
- register _XQEvent *prev; /* element before qelt */
- register _XQEvent *qelt; /* element to be unlinked */
+void _XDeq(
+ register Display *dpy,
+ register _XQEvent *prev, /* element before qelt */
+ register _XQEvent *qelt) /* element to be unlinked */
{
if (prev) {
if ((prev->next = qelt->next) == NULL)
@@ -2270,10 +2274,10 @@ void _XDeq (dpy, prev, qelt)
/*ARGSUSED*/
Bool
-_XUnknownWireEvent(dpy, re, event)
-register Display *dpy; /* pointer to display structure */
-register XEvent *re; /* pointer to where event should be reformatted */
-register xEvent *event; /* wire protocol event */
+_XUnknownWireEvent(
+ register Display *dpy, /* pointer to display structure */
+ register XEvent *re, /* pointer to where event should be reformatted */
+ register xEvent *event) /* wire protocol event */
{
#ifdef notdef
(void) fprintf(stderr,
@@ -2285,10 +2289,10 @@ register xEvent *event; /* wire protocol event */
/*ARGSUSED*/
Status
-_XUnknownNativeEvent(dpy, re, event)
-register Display *dpy; /* pointer to display structure */
-register XEvent *re; /* pointer to where event should be reformatted */
-register xEvent *event; /* wire protocol event */
+_XUnknownNativeEvent(
+ register Display *dpy, /* pointer to display structure */
+ register XEvent *re, /* pointer to where event should be reformatted */
+ register xEvent *event) /* wire protocol event */
{
#ifdef notdef
(void) fprintf(stderr,
@@ -2301,10 +2305,10 @@ register xEvent *event; /* wire protocol event */
* reformat a wire event into an XEvent structure of the right type.
*/
Bool
-_XWireToEvent(dpy, re, event)
-register Display *dpy; /* pointer to display structure */
-register XEvent *re; /* pointer to where event should be reformatted */
-register xEvent *event; /* wire protocol event */
+_XWireToEvent(
+ register Display *dpy, /* pointer to display structure */
+ register XEvent *re, /* pointer to where event should be reformatted */
+ register xEvent *event) /* wire protocol event */
{
re->type = event->u.u.type & 0x7f;
@@ -2671,25 +2675,12 @@ register xEvent *event; /* wire protocol event */
}
-#ifndef USL_SHARELIB
-
-static char *_SysErrorMsg (n)
- int n;
-{
- char *s = strerror(n);
-
- return (s ? s : "no such error");
-}
-
-#endif /* USL sharedlibs in don't define for SVR3.2 */
-
-
/*
* _XDefaultIOError - Default fatal system error reporting routine. Called
* when an X internal system error is encountered.
*/
-void _XDefaultIOError (dpy)
- Display *dpy;
+int _XDefaultIOError(
+ Display *dpy)
{
if (ECHECK(EPIPE)) {
(void) fprintf (stderr,
@@ -2701,7 +2692,7 @@ void _XDefaultIOError (dpy)
#ifdef WIN32
WSAGetLastError(), strerror(WSAGetLastError()),
#else
- errno, _SysErrorMsg (errno),
+ errno, strerror (errno),
#endif
DisplayString (dpy));
(void) fprintf (stderr,
@@ -2711,13 +2702,14 @@ void _XDefaultIOError (dpy)
}
exit(1);
+ return(0); /* dummy - function should never return */
}
-static int _XPrintDefaultError (dpy, event, fp)
- Display *dpy;
- XErrorEvent *event;
- FILE *fp;
+static int _XPrintDefaultError(
+ Display *dpy,
+ XErrorEvent *event,
+ FILE *fp)
{
char buffer[BUFSIZ];
char mesg[BUFSIZ];
@@ -2825,9 +2817,9 @@ static int _XPrintDefaultError (dpy, event, fp)
return 1;
}
-int _XDefaultError(dpy, event)
- Display *dpy;
- XErrorEvent *event;
+int _XDefaultError(
+ Display *dpy,
+ XErrorEvent *event)
{
if (_XPrintDefaultError (dpy, event, stderr) == 0) return 0;
exit(1);
@@ -2846,9 +2838,9 @@ Bool _XDefaultWireError(display, he, we)
/*
* _XError - upcall internal or user protocol error handler
*/
-int _XError (dpy, rep)
- Display *dpy;
- register xError *rep;
+int _XError (
+ Display *dpy,
+ register xError *rep)
{
/*
* X_Error packet encountered! We need to unpack the error before
@@ -2897,8 +2889,9 @@ int _XError (dpy, rep)
/*
* _XIOError - call user connection error handler and exit
*/
-_XIOError (dpy)
- Display *dpy;
+int
+_XIOError (
+ Display *dpy)
{
dpy->flags |= XlibDisplayIOError;
#ifdef WIN32
@@ -2910,6 +2903,7 @@ _XIOError (dpy)
else
_XDefaultIOError(dpy);
exit (1);
+ return 0;
}
@@ -2920,9 +2914,9 @@ _XIOError (dpy)
* GetReq* and a call to Data* or _XSend*, or in a context when the thread
* is guaranteed to not unlock the display.
*/
-char *_XAllocScratch (dpy, nbytes)
- register Display *dpy;
- unsigned long nbytes;
+char *_XAllocScratch(
+ register Display *dpy,
+ unsigned long nbytes)
{
if (nbytes > dpy->scratch_length) {
if (dpy->scratch_buffer) Xfree (dpy->scratch_buffer);
@@ -2937,9 +2931,9 @@ char *_XAllocScratch (dpy, nbytes)
* Scratch space allocator you can call any time, multiple times, and be
* MT safe, but you must hand the buffer back with _XFreeTemp.
*/
-char *_XAllocTemp (dpy, nbytes)
- register Display *dpy;
- unsigned long nbytes;
+char *_XAllocTemp(
+ register Display *dpy,
+ unsigned long nbytes)
{
char *buf;
@@ -2949,10 +2943,10 @@ char *_XAllocTemp (dpy, nbytes)
return buf;
}
-void _XFreeTemp (dpy, buf, nbytes)
- register Display *dpy;
- char *buf;
- unsigned long nbytes;
+void _XFreeTemp(
+ register Display *dpy,
+ char *buf,
+ unsigned long nbytes)
{
if (dpy->scratch_buffer)
Xfree(dpy->scratch_buffer);
@@ -2963,9 +2957,9 @@ void _XFreeTemp (dpy, buf, nbytes)
/*
* Given a visual id, find the visual structure for this id on this display.
*/
-Visual *_XVIDtoVisual (dpy, id)
- Display *dpy;
- VisualID id;
+Visual *_XVIDtoVisual(
+ Display *dpy,
+ VisualID id)
{
register int i, j, k;
register Screen *sp;
@@ -2985,12 +2979,8 @@ Visual *_XVIDtoVisual (dpy, id)
return (NULL);
}
-#if NeedFunctionPrototypes
+int
XFree (void *data)
-#else
-XFree (data)
- char *data;
-#endif
{
Xfree (data);
return 1;
@@ -3014,10 +3004,10 @@ void _Xbcopy(b1, b2, length)
#endif
#ifdef DataRoutineIsProcedure
-void Data (dpy, data, len)
- Display *dpy;
- char *data;
- long len;
+void Data(
+ Display *dpy,
+ char *data,
+ long len)
{
if (dpy->bufptr + (len) <= dpy->bufmax) {
memcpy(dpy->bufptr, data, (int)len);
@@ -3030,10 +3020,11 @@ void Data (dpy, data, len)
#ifdef LONG64
-_XData32 (dpy, data, len)
- Display *dpy;
- register long *data;
- unsigned len;
+int
+_XData32(
+ Display *dpy,
+ register long *data,
+ unsigned len)
{
register int *buf;
register long i;
@@ -3053,6 +3044,7 @@ _XData32 (dpy, data, len)
while (--i >= 0)
*buf++ = *data++;
}
+ return 0;
}
#endif /* LONG64 */
@@ -3071,11 +3063,11 @@ _XData32 (dpy, data, len)
* "len" is the length in bytes of the data.
*/
-static doData16(dpy, data, len, packbuffer)
- register Display *dpy;
- short *data;
- unsigned len;
- char *packbuffer;
+static doData16(
+ register Display *dpy,
+ short *data,
+ unsigned len,
+ char *packbuffer)
{
long *lp,*lpack;
long i, nwords,bits;
@@ -3104,10 +3096,10 @@ static doData16(dpy, data, len, packbuffer)
Data(dpy, packbuffer, len);
}
-_XData16 (dpy, data, len)
- Display *dpy;
- short *data;
- unsigned len;
+_XData16 (
+ Display *dpy,
+ short *data,
+ unsigned len)
{
char packbuffer[PACKBUFFERSIZE];
unsigned nunits = PACKBUFFERSIZE >> 1;
@@ -3126,11 +3118,11 @@ _XData16 (dpy, data, len)
* "len" is the length in bytes of the data.
*/
-static doData32 (dpy, data, len, packbuffer)
- register Display *dpy;
- long *data;
- unsigned len;
- char *packbuffer;
+static doData32(
+ register Display *dpy
+ long *data,
+ unsigned len,
+ char *packbuffer)
{
long *lp,*lpack;
long i,bits,nwords;
@@ -3157,10 +3149,10 @@ static doData32 (dpy, data, len, packbuffer)
Data(dpy, packbuffer, len);
}
-_XData32 (dpy, data, len)
- Display *dpy;
- long *data;
- unsigned len;
+void _XData32(
+ Display *dpy,
+ long *data,
+ unsigned len,
{
char packbuffer[PACKBUFFERSIZE];
unsigned nunits = PACKBUFFERSIZE >> 2;
@@ -3182,7 +3174,7 @@ _XData32 (dpy, data, len)
* and so, you may be better off using gethostname (if it exists).
*/
-#if (defined(_POSIX_SOURCE) && !defined(AIXV3)) || defined(hpux) || defined(USG) || defined(SVR4)
+#if (defined(_POSIX_SOURCE) && !defined(AIXV3) && !defined(__QNX__)) || defined(hpux) || defined(USG) || defined(SVR4)
#define NEED_UTSNAME
#include <sys/utsname.h>
#endif
@@ -3190,9 +3182,9 @@ _XData32 (dpy, data, len)
/*
* _XGetHostname - similar to gethostname but allows special processing.
*/
-int _XGetHostname (buf, maxlen)
- char *buf;
- int maxlen;
+int _XGetHostname (
+ char *buf,
+ int maxlen)
{
int len;
@@ -3246,23 +3238,7 @@ Screen *_XScreenOfWindow (dpy, w)
}
-#if (MSKCNT > 4)
-/*
- * This is a macro if MSKCNT <= 4
- */
-_XANYSET(src)
- long *src;
-{
- int i;
-
- for (i=0; i<MSKCNT; i++)
- if (src[ i ])
- return (1);
- return (0);
-}
-#endif
-
-#if defined(WIN32) || defined(__EMX__) /* || defined(OS2) */
+#if defined(WIN32)
/*
* These functions are intended to be used internally to Xlib only.
@@ -3310,7 +3286,7 @@ static int AccessFile (path, pathbuf, len_pathbuf, pathret)
/* try the places set in the environment */
drive = getenv ("_XBASEDRIVE");
-#ifdef __EMX__
+#ifdef __UNIXOS2__
if (!drive)
drive = getenv ("X11ROOT");
#endif
@@ -3326,7 +3302,7 @@ static int AccessFile (path, pathbuf, len_pathbuf, pathret)
return 1;
}
-#ifndef __EMX__
+#ifndef __UNIXOS2__
/* one last place to look */
drive = getenv ("HOMEDRIVE");
if (drive) {
@@ -3366,7 +3342,7 @@ static int AccessFile (path, pathbuf, len_pathbuf, pathret)
}
int _XOpenFile(path, flags)
- char* path;
+ _Xconst char* path;
int flags;
{
char buf[MAX_PATH];
@@ -3385,8 +3361,8 @@ int _XOpenFile(path, flags)
}
void* _XFopenFile(path, mode)
- char* path;
- char* mode;
+ _Xconst char* path;
+ _Xconst char* mode;
{
char buf[MAX_PATH];
char* bufp;
@@ -3404,7 +3380,7 @@ void* _XFopenFile(path, mode)
}
int _XAccessFile(path)
- char* path;
+ _Xconst char* path;
{
char buf[MAX_PATH];
char* bufp;
diff --git a/src/XomGeneric.h b/src/XomGeneric.h
index 10dea3b3..ce61eca3 100644
--- a/src/XomGeneric.h
+++ b/src/XomGeneric.h
@@ -31,6 +31,7 @@
* Modifier: Takanori Tateno FUJITSU LIMITED
*
*/
+/* $XFree86: xc/lib/X11/XomGeneric.h,v 1.5 2003/04/13 19:22:19 dawes Exp $ */
#ifndef _XOMGENERIC_H_
#define _XOMGENERIC_H_
@@ -59,7 +60,8 @@ typedef struct _VRotateRec {
typedef enum {
XOMMultiByte,
- XOMWideChar
+ XOMWideChar,
+ XOMUtf8String
} XOMTextType;
typedef struct _FontDataRec {
@@ -134,6 +136,7 @@ typedef struct _FontSetRec {
typedef struct _XOCGenericPart {
XlcConv mbs_to_cs;
XlcConv wcs_to_cs;
+ XlcConv utf8_to_cs;
int font_set_num;
FontSet font_set;
} XOCGenericPart;
@@ -147,24 +150,19 @@ typedef struct _XOCGenericRec {
_XFUNCPROTOBEGIN
extern XOM _XomGenericOpenOM(
-#if NeedFunctionPrototypes
XLCd /* lcd */,
Display* /* dpy */,
XrmDatabase /* rdb */,
_Xconst char* /* res_name */,
_Xconst char* /* res_class */
-#endif
);
extern XlcConv _XomInitConverter(
-#if NeedFunctionPrototypes
XOC /* oc */,
XOMTextType /* type */
-#endif
);
extern int _XomConvert(
-#if NeedFunctionPrototypes
XOC /* oc */,
XlcConv /* conv */,
XPointer* /* from */,
@@ -173,9 +171,148 @@ extern int _XomConvert(
int* /* to_left */,
XPointer* /* args */,
int /* num_args */
-#endif
);
+extern int
+_XmbDefaultTextEscapement(XOC oc, _Xconst char *text, int length);
+extern int
+_XwcDefaultTextEscapement(XOC oc, _Xconst wchar_t *text, int length);
+extern int
+_Xutf8DefaultTextEscapement(XOC oc, _Xconst char *text, int length);
+extern int
+_XmbDefaultTextExtents(XOC oc, _Xconst char *text, int length,
+ XRectangle *overall_ink, XRectangle *overall_logical);
+extern int
+_XwcDefaultTextExtents(XOC oc, _Xconst wchar_t *text, int length,
+ XRectangle *overall_ink, XRectangle *overall_logical);
+extern int
+_Xutf8DefaultTextExtents(XOC oc, _Xconst char *text, int length,
+ XRectangle *overall_ink, XRectangle *overall_logical);
+extern Status
+_XmbDefaultTextPerCharExtents(
+ XOC oc, _Xconst char *text, int length,
+ XRectangle *ink_buf, XRectangle *logical_buf,
+ int buf_size, int *num_chars,
+ XRectangle *overall_ink,
+ XRectangle *overall_logical);
+extern Status
+_XwcDefaultTextPerCharExtents(
+ XOC oc, _Xconst wchar_t *text, int length,
+ XRectangle *ink_buf, XRectangle *logical_buf,
+ int buf_size, int *num_chars,
+ XRectangle *overall_ink,
+ XRectangle *overall_logical);
+extern Status
+_Xutf8DefaultTextPerCharExtents(
+ XOC oc, _Xconst char *text, int length,
+ XRectangle *ink_buf, XRectangle *logical_buf,
+ int buf_size, int *num_chars,
+ XRectangle *overall_ink,
+ XRectangle *overall_logical);
+extern int
+_XmbDefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y,
+ _Xconst char *text, int length);
+extern int
+_XwcDefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y,
+ _Xconst wchar_t *text, int length);
+extern int
+_Xutf8DefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y,
+ _Xconst char *text, int length);
+extern void
+_XmbDefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x,
+ int y, _Xconst char *text, int length);
+extern void
+_XwcDefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x,
+ int y, _Xconst wchar_t *text, int length);
+extern void
+_Xutf8DefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x,
+ int y, _Xconst char *text, int length);
+
+extern int
+_XmbGenericTextEscapement(XOC oc, _Xconst char *text, int length);
+extern int
+_XmbGenericTextExtents(XOC oc, _Xconst char *text, int length,
+ XRectangle *overall_ink, XRectangle *overall_logical);
+extern int
+_Xutf8GenericDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y,
+ _Xconst char *text, int length);
+extern void
+_Xutf8GenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x,
+ int y, _Xconst char *text, int length);
+extern Status
+_Xutf8GenericTextPerCharExtents(
+ XOC oc, _Xconst char *text, int length,
+ XRectangle *ink_buf, XRectangle *logical_buf,
+ int buf_size, int *num_chars,
+ XRectangle *overall_ink,
+ XRectangle *overall_logical);
+extern int
+_Xutf8GenericTextExtents(XOC oc, _Xconst char *text, int length,
+ XRectangle *overall_ink, XRectangle *overall_logical);
+extern int
+_Xutf8GenericTextEscapement(XOC oc, _Xconst char *text, int length);
+extern void
+_XwcGenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x,
+ int y, _Xconst wchar_t *text, int length);
+extern int
+_XwcGenericDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y,
+ _Xconst wchar_t *text, int length);
+extern Status
+_XwcGenericTextPerCharExtents(XOC oc, _Xconst wchar_t *text, int length,
+ XRectangle *ink_buf, XRectangle *logical_buf,
+ int buf_size, int *num_chars,
+ XRectangle *overall_ink,
+ XRectangle *overall_logical);
+extern int
+_XwcGenericTextExtents(XOC oc, _Xconst wchar_t *text, int length,
+ XRectangle *overall_ink, XRectangle *overall_logical);
+extern int
+_XwcGenericTextEscapement(XOC oc, _Xconst wchar_t *text, int length);
+extern void
+_XmbGenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x,
+ int y, _Xconst char *text, int length);
+extern int
+_XmbGenericDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y,
+ _Xconst char *text, int length);
+extern Status
+_XmbGenericTextPerCharExtents(XOC oc, _Xconst char *text, int length,
+ XRectangle *ink_buf, XRectangle *logical_buf,
+ int buf_size, int *num_chars,
+ XRectangle *overall_ink,
+ XRectangle *overall_logical);
+
+extern FontData
+read_EncodingInfo(
+ int count,
+ char **value);
+
+extern int
+_XomGenericDrawString(
+ Display *dpy,
+ Drawable d,
+ XOC oc,
+ GC gc,
+ int x, int y,
+ XOMTextType type,
+ XPointer text,
+ int length);
+extern int
+_XomGenericTextExtents(
+ XOC oc,
+ XOMTextType type,
+ XPointer text,
+ int length,
+ XRectangle *overall_ink,
+ XRectangle *overall_logical);
+extern FontData
+_XomGetFontDataFromFontSet(
+ FontSet fs,
+ unsigned char *str,
+ int len,
+ int *len_ret,
+ int is2b,
+ int type);
+
_XFUNCPROTOEND
#endif /* _XOMGENERIC_H_ */
diff --git a/src/Xresinternal.h b/src/Xresinternal.h
index b0a7897f..fc752855 100644
--- a/src/Xresinternal.h
+++ b/src/Xresinternal.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/Xresinternal.h,v 1.1 2003/04/13 19:22:19 dawes Exp $ */
+/* $XFree86$ */
#ifndef _XRESINTERNAL_H_
#define _XRESINTERNAL_H_
diff --git a/src/Xrm.c b/src/Xrm.c
index 022dbe60..08ecd793 100644
--- a/src/Xrm.c
+++ b/src/Xrm.c
@@ -49,6 +49,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/lib/X11/Xrm.c,v 3.22 2003/07/16 01:38:26 dawes Exp $ */
#include <stdio.h>
#include <ctype.h>
@@ -60,17 +61,8 @@ from The Open Group.
#endif
#include "XrmI.h"
#include <X11/Xos.h>
-
-#ifdef __STDC__
-#define Const const
-#else
-#define Const /**/
-#endif
-#if defined(__STDC__) && !defined(NORCONST)
-#define RConst const
-#else
-#define RConst /**/
-#endif
+#include "Xresinternal.h"
+#include "Xresource.h"
/*
@@ -120,19 +112,15 @@ Bob Scheifler
*/
-typedef unsigned long Signature;
-
static XrmQuark XrmQString, XrmQANY;
typedef Bool (*DBEnumProc)(
-#if NeedNestedPrototypes /* this is Nested on purpose, to match Xlib.h */
XrmDatabase* /* db */,
XrmBindingList /* bindings */,
XrmQuarkList /* quarks */,
XrmRepresentation* /* type */,
XrmValue* /* value */,
XPointer /* closure */
-#endif
);
typedef struct _VEntry {
@@ -226,6 +214,24 @@ typedef struct _EClosure {
int mode; /* XrmEnum<kind> */
} EClosureRec, *EClosure;
+/* types for typecasting ETable based functions to NTable based functions */
+typedef Bool (*getNTableSProcp)(
+ NTable table,
+ XrmNameList names,
+ XrmClassList classes,
+ SClosure closure);
+typedef Bool (*getNTableVProcp)(
+ NTable table,
+ XrmNameList names,
+ XrmClassList classes,
+ VClosure closure);
+typedef Bool (*getNTableEProcp)(
+ NTable table,
+ XrmNameList names,
+ XrmClassList classes,
+ register int level,
+ EClosure closure);
+
/* predicate to determine when to resize a hash table */
#define GrowthPred(n,m) ((unsigned)(n) > (((m) + 1) << 2))
@@ -294,10 +300,10 @@ typedef unsigned char XrmBits;
#define is_special(bits) ((bits) & (ENDOF|BSLASH))
/* parsing types */
-static XrmBits Const xrmtypes[256] = {
+static XrmBits const xrmtypes[256] = {
EOS,0,0,0,0,0,0,0,
0,SPACE,EOL,0,0,
-#if defined(WIN32) || defined(__EMX__) /* || defined(OS2) */
+#if defined(WIN32) || defined(__UNIXOS2__)
EOL, /* treat CR the same as LF, just in case */
#else
0,
@@ -320,14 +326,15 @@ static XrmBits Const xrmtypes[256] = {
/* The rest will be automatically initialized to zero. */
};
-void XrmInitialize()
+void XrmInitialize(void)
{
XrmQString = XrmPermStringToQuark("String");
XrmQANY = XrmPermStringToQuark("?");
}
-XrmDatabase XrmGetDatabase(display)
- Display *display;
+#ifndef _XP_PRINT_SERVER_
+XrmDatabase XrmGetDatabase(
+ Display *display)
{
XrmDatabase retval;
LockDisplay(display);
@@ -336,24 +343,25 @@ XrmDatabase XrmGetDatabase(display)
return retval;
}
-void XrmSetDatabase(display, database)
- Display *display;
- XrmDatabase database;
+void XrmSetDatabase(
+ Display *display,
+ XrmDatabase database)
{
LockDisplay(display);
+ /* destroy database if set up imlicitely by XGetDefault() */
+ if (display->db && (display->flags & XlibDisplayDfltRMDB)) {
+ XrmDestroyDatabase(display->db);
+ display->flags &= ~XlibDisplayDfltRMDB;
+ }
display->db = database;
UnlockDisplay(display);
}
+#endif /* !_XP_PRINT_SERVER_ */
-#if NeedFunctionPrototypes
-void XrmStringToQuarkList(
+void
+XrmStringToQuarkList(
register _Xconst char *name,
register XrmQuarkList quarks) /* RETURN */
-#else
-void XrmStringToQuarkList(name, quarks)
- register char *name;
- register XrmQuarkList quarks; /* RETURN */
-#endif
{
register XrmBits bits;
register Signature sig = 0;
@@ -383,17 +391,11 @@ void XrmStringToQuarkList(name, quarks)
*quarks = NULLQUARK;
}
-#if NeedFunctionPrototypes
-void XrmStringToBindingQuarkList(
+void
+XrmStringToBindingQuarkList(
register _Xconst char *name,
register XrmBindingList bindings, /* RETURN */
register XrmQuarkList quarks) /* RETURN */
-#else
-void XrmStringToBindingQuarkList(name, bindings, quarks)
- register char *name;
- register XrmBindingList bindings; /* RETURN */
- register XrmQuarkList quarks; /* RETURN */
-#endif
{
register XrmBits bits;
register Signature sig = 0;
@@ -434,9 +436,9 @@ void XrmStringToBindingQuarkList(name, bindings, quarks)
#ifdef DEBUG
-static void PrintQuarkList(quarks, stream)
- XrmQuarkList quarks;
- FILE *stream;
+static void PrintQuarkList(
+ XrmQuarkList quarks,
+ FILE *stream)
{
Bool firstNameSeen;
@@ -451,38 +453,45 @@ static void PrintQuarkList(quarks, stream)
#endif /* DEBUG */
-/*ARGSUSED*/
-static void mbnoop(state)
- XPointer state;
+
+/*
+ * Fallback methods for Xrm parsing.
+ * Simulate a C locale. No state needed here.
+ */
+
+static void
+c_mbnoop(
+ XPointer state)
{
}
-/*ARGSUSED*/
-static char mbchar(state, str, lenp)
- XPointer state;
- char *str;
- int *lenp;
+static char
+c_mbchar(
+ XPointer state,
+ const char *str,
+ int *lenp)
{
*lenp = 1;
return *str;
}
-/*ARGSUSED*/
-static char *lcname(state)
- XPointer state;
+static const char *
+c_lcname(
+ XPointer state)
{
return "C";
}
-static RConst XrmMethodsRec mb_methods = {
- mbnoop,
- mbchar,
- mbnoop,
- lcname,
- mbnoop
+static const XrmMethodsRec mb_methods = {
+ c_mbnoop, /* mbinit */
+ c_mbchar, /* mbchar */
+ c_mbnoop, /* mbfinish */
+ c_lcname, /* lcname */
+ c_mbnoop /* destroy */
};
-static XrmDatabase NewDatabase()
+
+static XrmDatabase NewDatabase(void)
{
register XrmDatabase db;
@@ -491,9 +500,13 @@ static XrmDatabase NewDatabase()
_XCreateMutex(&db->linfo);
db->table = (NTable)NULL;
db->mbstate = (XPointer)NULL;
+#ifdef _XP_PRINT_SERVER_
+ db->methods = NULL;
+#else
db->methods = _XrmInitParseInfo(&db->mbstate);
+#endif
if (!db->methods)
- db->methods = (XrmMethods)&mb_methods;
+ db->methods = &mb_methods;
}
return db;
}
@@ -501,9 +514,9 @@ static XrmDatabase NewDatabase()
/* move all values from ftable to ttable, and free ftable's buckets.
* ttable is quaranteed empty to start with.
*/
-static void MoveValues(ftable, ttable)
- LTable ftable;
- register LTable ttable;
+static void MoveValues(
+ LTable ftable,
+ register LTable ttable)
{
register VEntry fentry, nfentry;
register VEntry *prev;
@@ -528,9 +541,9 @@ static void MoveValues(ftable, ttable)
/* move all tables from ftable to ttable, and free ftable.
* ttable is quaranteed empty to start with.
*/
-static void MoveTables(ftable, ttable)
- NTable ftable;
- register NTable ttable;
+static void MoveTables(
+ NTable ftable,
+ register NTable ttable)
{
register NTable fentry, nfentry;
register NTable *prev;
@@ -553,8 +566,8 @@ static void MoveTables(ftable, ttable)
}
/* grow the table, based on current number of entries */
-static void GrowTable(prev)
- NTable *prev;
+static void GrowTable(
+ NTable *prev)
{
register NTable table;
register int i;
@@ -596,10 +609,10 @@ static void GrowTable(prev)
}
/* merge values from ftable into *pprev, destroy ftable in the process */
-static void MergeValues(ftable, pprev, override)
- LTable ftable;
- NTable *pprev;
- Bool override;
+static void MergeValues(
+ LTable ftable,
+ NTable *pprev,
+ Bool override)
{
register VEntry fentry, tentry;
register VEntry *prev;
@@ -676,10 +689,10 @@ static void MergeValues(ftable, pprev, override)
}
/* merge tables from ftable into *pprev, destroy ftable in the process */
-static void MergeTables(ftable, pprev, override)
- NTable ftable;
- NTable *pprev;
- Bool override;
+static void MergeTables(
+ NTable ftable,
+ NTable *pprev,
+ Bool override)
{
register NTable fentry, tentry;
NTable nfentry;
@@ -749,9 +762,9 @@ static void MergeTables(ftable, pprev, override)
GROW(pprev);
}
-void XrmCombineDatabase(from, into, override)
- XrmDatabase from, *into;
- Bool override;
+void XrmCombineDatabase(
+ XrmDatabase from, XrmDatabase *into,
+ Bool override)
{
register NTable *prev;
register NTable ftable, ttable, nftable;
@@ -798,19 +811,19 @@ void XrmCombineDatabase(from, into, override)
}
}
-void XrmMergeDatabases(from, into)
- XrmDatabase from, *into;
+void XrmMergeDatabases(
+ XrmDatabase from, XrmDatabase *into)
{
XrmCombineDatabase(from, into, True);
}
/* store a value in the database, overriding any existing entry */
-static void PutEntry(db, bindings, quarks, type, value)
- XrmDatabase db;
- XrmBindingList bindings;
- XrmQuarkList quarks;
- XrmRepresentation type;
- XrmValuePtr value;
+static void PutEntry(
+ XrmDatabase db,
+ XrmBindingList bindings,
+ XrmQuarkList quarks,
+ XrmRepresentation type,
+ XrmValuePtr value)
{
register NTable *pprev, *prev;
register NTable table;
@@ -998,12 +1011,12 @@ static void PutEntry(db, bindings, quarks, type, value)
#undef NEWTABLE
}
-void XrmQPutResource(pdb, bindings, quarks, type, value)
- XrmDatabase *pdb;
- XrmBindingList bindings;
- XrmQuarkList quarks;
- XrmRepresentation type;
- XrmValuePtr value;
+void XrmQPutResource(
+ XrmDatabase *pdb,
+ XrmBindingList bindings,
+ XrmQuarkList quarks,
+ XrmRepresentation type,
+ XrmValuePtr value)
{
if (!*pdb) *pdb = NewDatabase();
_XLockMutex(&(*pdb)->linfo);
@@ -1011,19 +1024,12 @@ void XrmQPutResource(pdb, bindings, quarks, type, value)
_XUnlockMutex(&(*pdb)->linfo);
}
-#if NeedFunctionPrototypes
-void XrmPutResource(
+void
+XrmPutResource(
XrmDatabase *pdb,
_Xconst char *specifier,
_Xconst char *type,
XrmValuePtr value)
-#else
-void XrmPutResource(pdb, specifier, type, value)
- XrmDatabase *pdb;
- char *specifier;
- char *type;
- XrmValuePtr value;
-#endif
{
XrmBinding bindings[MAXDBDEPTH+1];
XrmQuark quarks[MAXDBDEPTH+1];
@@ -1035,19 +1041,12 @@ void XrmPutResource(pdb, specifier, type, value)
_XUnlockMutex(&(*pdb)->linfo);
}
-#if NeedFunctionPrototypes
-void XrmQPutStringResource(
+void
+XrmQPutStringResource(
XrmDatabase *pdb,
XrmBindingList bindings,
XrmQuarkList quarks,
_Xconst char *str)
-#else
-void XrmQPutStringResource(pdb, bindings, quarks, str)
- XrmDatabase *pdb;
- XrmBindingList bindings;
- XrmQuarkList quarks;
- char *str;
-#endif
{
XrmValue value;
@@ -1088,13 +1087,17 @@ void XrmQPutStringResource(pdb, bindings, quarks, str)
*/
#define DEF_BUFF_SIZE 8192
-static void GetIncludeFile();
+static void GetIncludeFile(
+ XrmDatabase db,
+ _Xconst char *base,
+ _Xconst char *fname,
+ int fnamelen);
-static void GetDatabase(db, str, filename, doall)
- XrmDatabase db;
- register char *str;
- char *filename;
- Bool doall;
+static void GetDatabase(
+ XrmDatabase db,
+ _Xconst register char *str,
+ _Xconst char *filename,
+ Bool doall)
{
char *rhs;
char *lhs, lhs_s[DEF_BUFF_SIZE];
@@ -1191,7 +1194,7 @@ static void GetDatabase(db, str, filename, doall)
while (is_space(bits = next_char(c, str))) {};
/* must have a starting " */
if (c == '"') {
- char *fname = str+1;
+ _Xconst char *fname = str+1;
len = 0;
do {
if (only_pcs) {
@@ -1518,17 +1521,11 @@ static void GetDatabase(db, str, filename, doall)
(*db->methods->mbfinish)(db->mbstate);
}
-#if NeedFunctionPrototypes
-void XrmPutStringResource(
+void
+XrmPutStringResource(
XrmDatabase *pdb,
_Xconst char*specifier,
_Xconst char*str)
-#else
-void XrmPutStringResource(pdb, specifier, str)
- XrmDatabase *pdb;
- char *specifier;
- char *str;
-#endif
{
XrmValue value;
XrmBinding bindings[MAXDBDEPTH+1];
@@ -1544,15 +1541,10 @@ void XrmPutStringResource(pdb, specifier, str)
}
-#if NeedFunctionPrototypes
-void XrmPutLineResource(
+void
+XrmPutLineResource(
XrmDatabase *pdb,
_Xconst char*line)
-#else
-void XrmPutLineResource(pdb, line)
- XrmDatabase *pdb;
- char *line;
-#endif
{
if (!*pdb) *pdb = NewDatabase();
_XLockMutex(&(*pdb)->linfo);
@@ -1560,13 +1552,9 @@ void XrmPutLineResource(pdb, line)
_XUnlockMutex(&(*pdb)->linfo);
}
-#if NeedFunctionPrototypes
-XrmDatabase XrmGetStringDatabase(
+XrmDatabase
+XrmGetStringDatabase(
_Xconst char *data)
-#else
-XrmDatabase XrmGetStringDatabase(data)
- char *data;
-#endif
{
XrmDatabase db;
@@ -1584,12 +1572,15 @@ XrmDatabase XrmGetStringDatabase(data)
*/
static char *
-ReadInFile(filename)
-char * filename;
+ReadInFile(_Xconst char *filename)
{
register int fd, size;
char * filebuf;
+#ifdef __UNIXOS2__
+ filename = __XOS2RedirRoot(filename);
+#endif
+
/*
* MS-Windows and OS/2 note: Default open mode includes O_TEXT
*/
@@ -1598,11 +1589,11 @@ char * filename;
/*
* MS-Windows and OS/2 note: depending on how the sources are
- * untarred, the newlines in resource files may or may not have
- * been * expanded to CRLF. Either way the size returned by fstat
- * is sufficient to read the file into because in text-mode any
- * CRLFs in a file will be converted to newlines (LF) with the
- * result that * the number of bytes actually read with be <=
+ * untarred, the newlines in resource files may or may not have
+ * been expanded to CRLF. Either way the size returned by fstat
+ * is sufficient to read the file into because in text-mode any
+ * CRLFs in a file will be converted to newlines (LF) with the
+ * result that the number of bytes actually read with be <=
* to the size returned by fstat.
*/
GetSizeOfFile(fd, size);
@@ -1613,6 +1604,17 @@ char * filename;
}
size = read (fd, filebuf, size);
+#ifdef __UNIXOS2__
+ { /* kill CRLF */
+ int i,k;
+ for (i=k=0; i<size; i++)
+ if (filebuf[i] != 0x0d) {
+ filebuf[k++] = filebuf[i];
+ }
+ filebuf[k] = 0;
+ }
+#endif
+
if (size < 0) {
close (fd);
Xfree(filebuf);
@@ -1625,11 +1627,11 @@ char * filename;
}
static void
-GetIncludeFile(db, base, fname, fnamelen)
- XrmDatabase db;
- char *base;
- char *fname;
- int fnamelen;
+GetIncludeFile(
+ XrmDatabase db,
+ _Xconst char *base,
+ _Xconst char *fname,
+ int fnamelen)
{
int len;
char *str;
@@ -1654,13 +1656,9 @@ GetIncludeFile(db, base, fname, fnamelen)
Xfree(str);
}
-#if NeedFunctionPrototypes
-XrmDatabase XrmGetFileDatabase(
+XrmDatabase
+XrmGetFileDatabase(
_Xconst char *filename)
-#else
-XrmDatabase XrmGetFileDatabase(filename)
- char *filename;
-#endif
{
XrmDatabase db;
char *str;
@@ -1676,17 +1674,11 @@ XrmDatabase XrmGetFileDatabase(filename)
return db;
}
-#if NeedFunctionPrototypes
-Status XrmCombineFileDatabase(
+Status
+XrmCombineFileDatabase(
_Xconst char *filename,
XrmDatabase *target,
Bool override)
-#else
-Status XrmCombineFileDatabase(filename, target, override)
- char *filename;
- XrmDatabase *target;
- Bool override;
-#endif
{
XrmDatabase db;
char *str;
@@ -1712,12 +1704,12 @@ Status XrmCombineFileDatabase(filename, target, override)
* stop if user proc returns True. level is current depth in database.
*/
/*ARGSUSED*/
-static Bool EnumLTable(table, names, classes, level, closure)
- LTable table;
- XrmNameList names;
- XrmClassList classes;
- register int level;
- register EClosure closure;
+static Bool EnumLTable(
+ LTable table,
+ XrmNameList names,
+ XrmClassList classes,
+ register int level,
+ register EClosure closure)
{
register VEntry *bucket;
register int i;
@@ -1758,10 +1750,10 @@ static Bool EnumLTable(table, names, classes, level, closure)
return False;
}
-static Bool EnumAllNTable(table, level, closure)
- NTable table;
- register int level;
- register EClosure closure;
+static Bool EnumAllNTable(
+ NTable table,
+ register int level,
+ register EClosure closure)
{
register NTable *bucket;
register int i;
@@ -1792,17 +1784,22 @@ static Bool EnumAllNTable(table, level, closure)
/* recurse on every table in the table, arbitrary order.
* stop if user proc returns True. level is current depth in database.
*/
-static Bool EnumNTable(table, names, classes, level, closure)
- NTable table;
- XrmNameList names;
- XrmClassList classes;
- register int level;
- register EClosure closure;
+static Bool EnumNTable(
+ NTable table,
+ XrmNameList names,
+ XrmClassList classes,
+ register int level,
+ register EClosure closure)
{
register NTable entry;
register XrmQuark q;
register unsigned int leaf;
- Bool (*get)();
+ Bool (*get)(
+ NTable table,
+ XrmNameList names,
+ XrmClassList classes,
+ register int level,
+ EClosure closure);
Bool bilevel;
/* find entries named ename, leafness leaf, tight or loose, and call get */
@@ -1863,7 +1860,7 @@ static Bool EnumNTable(table, names, classes, level, closure)
leaf = 0;
bilevel = !names[1];
} else {
- get = EnumLTable; /* bottom of recursion */
+ get = (getNTableEProcp)EnumLTable; /* bottom of recursion */
leaf = 1;
bilevel = False;
}
@@ -1906,7 +1903,7 @@ static Bool EnumNTable(table, names, classes, level, closure)
if (!*names)
break;
if (!names[1] && closure->mode != XrmEnumAllLevels) {
- get = EnumLTable; /* bottom of recursion */
+ get = (getNTableEProcp)EnumLTable; /* bottom of recursion */
leaf = 1;
}
ILOOSE(*names); /* loose names */
@@ -1950,13 +1947,13 @@ static Bool EnumNTable(table, names, classes, level, closure)
/* call the proc for every value in the database, arbitrary order.
* stop if the proc returns True.
*/
-Bool XrmEnumerateDatabase(db, names, classes, mode, proc, closure)
- XrmDatabase db;
- XrmNameList names;
- XrmClassList classes;
- int mode;
- DBEnumProc proc;
- XPointer closure;
+Bool XrmEnumerateDatabase(
+ XrmDatabase db,
+ XrmNameList names,
+ XrmClassList classes,
+ int mode,
+ DBEnumProc proc,
+ XPointer closure)
{
XrmBinding bindings[MAXDBDEPTH+2];
XrmQuark quarks[MAXDBDEPTH+2];
@@ -1986,10 +1983,10 @@ Bool XrmEnumerateDatabase(db, names, classes, mode, proc, closure)
return retval;
}
-static void PrintBindingQuarkList(bindings, quarks, stream)
- XrmBindingList bindings;
- XrmQuarkList quarks;
- FILE *stream;
+static void PrintBindingQuarkList(
+ XrmBindingList bindings,
+ XrmQuarkList quarks,
+ FILE *stream)
{
Bool firstNameSeen;
@@ -2006,13 +2003,13 @@ static void PrintBindingQuarkList(bindings, quarks, stream)
/* output out the entry in correct file syntax */
/*ARGSUSED*/
-static Bool DumpEntry(db, bindings, quarks, type, value, data)
- XrmDatabase *db;
- XrmBindingList bindings;
- XrmQuarkList quarks;
- XrmRepresentation *type;
- XrmValuePtr value;
- XPointer data;
+static Bool DumpEntry(
+ XrmDatabase *db,
+ XrmBindingList bindings,
+ XrmQuarkList quarks,
+ XrmRepresentation *type,
+ XrmValuePtr value,
+ XPointer data)
{
FILE *stream = (FILE *)data;
register unsigned int i;
@@ -2054,9 +2051,9 @@ static Bool DumpEntry(db, bindings, quarks, type, value, data)
#ifdef DEBUG
-void PrintTable(table, file)
- NTable table;
- FILE *file;
+void PrintTable(
+ NTable table,
+ FILE *file)
{
XrmBinding bindings[MAXDBDEPTH+1];
XrmQuark quarks[MAXDBDEPTH+1];
@@ -2077,15 +2074,10 @@ void PrintTable(table, file)
#endif /* DEBUG */
-#if NeedFunctionPrototypes
-void XrmPutFileDatabase(
+void
+XrmPutFileDatabase(
XrmDatabase db,
_Xconst char *fileName)
-#else
-void XrmPutFileDatabase(db, fileName)
- XrmDatabase db;
- char *fileName;
-#endif
{
FILE *file;
XrmQuark empty = NULLQUARK;
@@ -2144,11 +2136,11 @@ void XrmPutFileDatabase(db, fileName)
/* add tight/loose entry to the search list, return True if list is full */
/*ARGSUSED*/
-static Bool AppendLEntry(table, names, classes, closure)
- LTable table;
- XrmNameList names;
- XrmClassList classes;
- register SClosure closure;
+static Bool AppendLEntry(
+ LTable table,
+ XrmNameList names,
+ XrmClassList classes,
+ register SClosure closure)
{
/* check for duplicate */
if (closure->idx >= 0 && closure->list[closure->idx] == table)
@@ -2163,11 +2155,11 @@ static Bool AppendLEntry(table, names, classes, closure)
/* add loose entry to the search list, return True if list is full */
/*ARGSUSED*/
-static Bool AppendLooseLEntry(table, names, classes, closure)
- LTable table;
- XrmNameList names;
- XrmClassList classes;
- register SClosure closure;
+static Bool AppendLooseLEntry(
+ LTable table,
+ XrmNameList names,
+ XrmClassList classes,
+ register SClosure closure)
{
/* check for duplicate */
if (closure->idx >= 0 && closure->list[closure->idx] == table)
@@ -2183,22 +2175,26 @@ static Bool AppendLooseLEntry(table, names, classes, closure)
}
/* search for a leaf table */
-static Bool SearchNEntry(table, names, classes, closure)
- NTable table;
- XrmNameList names;
- XrmClassList classes;
- SClosure closure;
+static Bool SearchNEntry(
+ NTable table,
+ XrmNameList names,
+ XrmClassList classes,
+ SClosure closure)
{
register NTable entry;
register XrmQuark q;
register unsigned int leaf;
- Bool (*get)();
+ Bool (*get)(
+ NTable table,
+ XrmNameList names,
+ XrmClassList classes,
+ SClosure closure);
if (names[1]) {
get = SearchNEntry; /* recurse */
leaf = 0;
} else {
- get = AppendLEntry; /* bottom of recursion */
+ get = (getNTableSProcp)AppendLEntry; /* bottom of recursion */
leaf = 1;
}
GTIGHTLOOSE(*names, AppendLooseLEntry); /* do name, tight and loose */
@@ -2213,7 +2209,7 @@ static Bool SearchNEntry(table, names, classes, closure)
if (!*names)
break;
if (!names[1]) {
- get = AppendLEntry; /* bottom of recursion */
+ get = (getNTableSProcp)AppendLEntry; /* bottom of recursion */
leaf = 1;
}
GLOOSE(*names, AppendLooseLEntry); /* loose names */
@@ -2247,12 +2243,12 @@ static Bool SearchNEntry(table, names, classes, closure)
return False;
}
-Bool XrmQGetSearchList(db, names, classes, searchList, listLength)
- XrmDatabase db;
- XrmNameList names;
- XrmClassList classes;
- XrmSearchList searchList; /* RETURN */
- int listLength;
+Bool XrmQGetSearchList(
+ XrmDatabase db,
+ XrmNameList names,
+ XrmClassList classes,
+ XrmSearchList searchList, /* RETURN */
+ int listLength)
{
register NTable table;
SClosureRec closure;
@@ -2292,16 +2288,16 @@ Bool XrmQGetSearchList(db, names, classes, searchList, listLength)
return True;
}
-Bool XrmQGetSearchResource(searchList, name, class, pType, pValue)
- XrmSearchList searchList;
- register XrmName name;
- register XrmClass class;
- XrmRepresentation *pType; /* RETURN */
- XrmValue *pValue; /* RETURN */
+Bool XrmQGetSearchResource(
+ XrmSearchList searchList,
+ register XrmName name,
+ register XrmClass class,
+ XrmRepresentation *pType, /* RETURN */
+ XrmValue *pValue) /* RETURN */
{
register LTable *list;
register LTable table;
- register VEntry entry;
+ register VEntry entry = NULL;
int flags;
/* find tight or loose entry */
@@ -2381,11 +2377,11 @@ Bool XrmQGetSearchResource(searchList, name, class, pType, pValue)
}
/* look for a tight/loose value */
-static Bool GetVEntry(table, names, classes, closure)
- LTable table;
- XrmNameList names;
- XrmClassList classes;
- VClosure closure;
+static Bool GetVEntry(
+ LTable table,
+ XrmNameList names,
+ XrmClassList classes,
+ VClosure closure)
{
register VEntry entry;
register XrmQuark q;
@@ -2416,11 +2412,11 @@ static Bool GetVEntry(table, names, classes, closure)
}
/* look for a loose value */
-static Bool GetLooseVEntry(table, names, classes, closure)
- LTable table;
- XrmNameList names;
- XrmClassList classes;
- VClosure closure;
+static Bool GetLooseVEntry(
+ LTable table,
+ XrmNameList names,
+ XrmClassList classes,
+ VClosure closure)
{
register VEntry entry;
register XrmQuark q;
@@ -2458,23 +2454,27 @@ static Bool GetLooseVEntry(table, names, classes, closure)
}
/* recursive search for a value */
-static Bool GetNEntry(table, names, classes, closure)
- NTable table;
- XrmNameList names;
- XrmClassList classes;
- VClosure closure;
+static Bool GetNEntry(
+ NTable table,
+ XrmNameList names,
+ XrmClassList classes,
+ VClosure closure)
{
register NTable entry;
register XrmQuark q;
register unsigned int leaf;
- Bool (*get)();
+ Bool (*get)(
+ NTable table,
+ XrmNameList names,
+ XrmClassList classes,
+ VClosure closure);
NTable otable;
if (names[2]) {
get = GetNEntry; /* recurse */
leaf = 0;
} else {
- get = GetVEntry; /* bottom of recursion */
+ get = (getNTableVProcp)GetVEntry; /* bottom of recursion */
leaf = 1;
}
GTIGHTLOOSE(*names, GetLooseVEntry); /* do name, tight and loose */
@@ -2489,7 +2489,7 @@ static Bool GetNEntry(table, names, classes, closure)
if (!names[1])
break;
if (!names[2]) {
- get = GetVEntry; /* bottom of recursion */
+ get = (getNTableVProcp)GetVEntry; /* bottom of recursion */
leaf = 1;
}
GLOOSE(*names, GetLooseVEntry); /* do name, loose only */
@@ -2526,12 +2526,12 @@ static Bool GetNEntry(table, names, classes, closure)
return False;
}
-Bool XrmQGetResource(db, names, classes, pType, pValue)
- XrmDatabase db;
- XrmNameList names;
- XrmClassList classes;
- XrmRepresentation *pType; /* RETURN */
- XrmValuePtr pValue; /* RETURN */
+Bool XrmQGetResource(
+ XrmDatabase db,
+ XrmNameList names,
+ XrmClassList classes,
+ XrmRepresentation *pType, /* RETURN */
+ XrmValuePtr pValue) /* RETURN */
{
register NTable table;
VClosureRec closure;
@@ -2568,21 +2568,13 @@ Bool XrmQGetResource(db, names, classes, pType, pValue)
return False;
}
-#if NeedFunctionPrototypes
-Bool XrmGetResource(db, name_str, class_str, pType_str, pValue)
+Bool
+XrmGetResource(db, name_str, class_str, pType_str, pValue)
XrmDatabase db;
_Xconst char *name_str;
_Xconst char *class_str;
XrmString *pType_str; /* RETURN */
XrmValuePtr pValue; /* RETURN */
-#else
-Bool XrmGetResource(db, name_str, class_str, pType_str, pValue)
- XrmDatabase db;
- XrmString name_str;
- XrmString class_str;
- XrmString *pType_str; /* RETURN */
- XrmValuePtr pValue; /* RETURN */
-#endif
{
XrmName names[MAXDBDEPTH+1];
XrmClass classes[MAXDBDEPTH+1];
@@ -2597,8 +2589,8 @@ Bool XrmGetResource(db, name_str, class_str, pType_str, pValue)
}
/* destroy all values, plus table itself */
-static void DestroyLTable(table)
- LTable table;
+static void DestroyLTable(
+ LTable table)
{
register int i;
register VEntry *buckets;
@@ -2616,8 +2608,8 @@ static void DestroyLTable(table)
}
/* destroy all contained tables, plus table itself */
-static void DestroyNTable(table)
- NTable table;
+static void DestroyNTable(
+ NTable table)
{
register int i;
register NTable *buckets;
@@ -2636,18 +2628,19 @@ static void DestroyNTable(table)
Xfree((char *)table);
}
-char *XrmLocaleOfDatabase(db)
- XrmDatabase db;
+const char *
+XrmLocaleOfDatabase(
+ XrmDatabase db)
{
- char* retval;
+ const char* retval;
_XLockMutex(&db->linfo);
retval = (*db->methods->lcname)(db->mbstate);
_XUnlockMutex(&db->linfo);
return retval;
}
-void XrmDestroyDatabase(db)
- XrmDatabase db;
+void XrmDestroyDatabase(
+ XrmDatabase db)
{
register NTable table, next;
diff --git a/src/evtomask.c b/src/evtomask.c
index 80047503..1ce018cd 100644
--- a/src/evtomask.c
+++ b/src/evtomask.c
@@ -24,20 +24,15 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/evtomask.c,v 3.4 2001/07/29 05:01:11 tsi Exp $ */
#include <X11/X.h>
-#ifdef __STDC__
-#define Const const
-#else
-#define Const /**/
-#endif
-
/*
* This array can be used given an event type to determine the mask bits
* that could have generated it.
*/
-long Const _Xevent_to_mask [LASTEvent] = {
+long const _Xevent_to_mask [LASTEvent] = {
0, /* no event 0 */
0, /* no event 1 */
KeyPressMask, /* KeyPress */
diff --git a/src/globals.c b/src/globals.c
index aadfa878..0fa860dc 100644
--- a/src/globals.c
+++ b/src/globals.c
@@ -26,7 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
-
+/* $XFree86: xc/lib/X11/globals.c,v 3.4 2001/07/29 05:01:11 tsi Exp $ */
/*
*
@@ -53,7 +53,7 @@ from The Open Group.
/*
* If we need to define extra variables for each global
*/
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
+#if !defined(UNIXCPP) || defined(ANSICPP)
#define ZEROINIT(t,var,val) SetZero(t,var,val); \
SetZero (long, _libX_##var##Flag, 0); \
SetZero (void *, _libX_##var##Ptr, NULL)
diff --git a/src/imConv.c b/src/imConv.c
index e16fb4d2..e0015716 100644
--- a/src/imConv.c
+++ b/src/imConv.c
@@ -1,4 +1,4 @@
-/* $Xorg: imConv.c,v 1.5 2000/08/17 19:45:11 cpqbld Exp $ */
+/* $TOG: imConv.c /main/20 1998/06/17 15:46:41 kaleb $ */
/******************************************************************
Copyright 1991, 1992 by Fuji Xerox Co.,Ltd.
@@ -31,6 +31,9 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
fujiwara@a80.tech.yk.fujitsu.co.jp
******************************************************************/
+/* 2000 Modifier: Ivan Pascal The XFree86 Project.
+ */
+/* $XFree86: xc/lib/X11/imConv.c,v 1.32 2003/04/13 19:22:20 dawes Exp $ */
#define NEED_EVENTS
#include <stdio.h>
@@ -38,8 +41,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "Xlcint.h"
#include "Ximint.h"
#include "XlcPubI.h"
-#define XK_PUBLISHING
-#include "X11/keysym.h"
#ifdef XKB
/*
@@ -53,716 +54,100 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define XLOOKUPSTRING XLookupString
#endif
-/* bit (1<<i) means character is in codeset i */
-unsigned int _Xlatin1[128] = {
-0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-0x990ee, 0x88000, 0x89000, 0x89084, 0x0902e, 0x89000, 0x09080, 0x9908e,
-0x0908e, 0x89080, 0x88000, 0x89080, 0x89080, 0x990ee, 0x89000, 0x89008,
-0x9908e, 0x89080, 0x89084, 0x89084, 0x0908e, 0x89004, 0x89000, 0x99084,
-0x0900c, 0x89000, 0x88000, 0x89080, 0x09000, 0x09084, 0x09000, 0x88000,
-0x88004, 0x9800e, 0x9800e, 0x98008, 0x9800e, 0x98008, 0x98008, 0x88006,
-0x88004, 0x9800e, 0x88004, 0x9800e, 0x88004, 0x9800e, 0x9800e, 0x98004,
-0x90000, 0x88004, 0x88004, 0x98006, 0x9800e, 0x98008, 0x9800e, 0x8800e,
-0x98008, 0x88004, 0x9800e, 0x9800c, 0x9800e, 0x90002, 0x90000, 0x9800e,
-0x88004, 0x9800e, 0x9800e, 0x98008, 0x9800e, 0x98008, 0x98008, 0x88004,
-0x88004, 0x9800e, 0x88004, 0x9800e, 0x88004, 0x9800e, 0x9800e, 0x98004,
-0x90000, 0x88004, 0x88004, 0x98006, 0x9800e, 0x98008, 0x9800e, 0x8800e,
-0x98008, 0x88004, 0x9800e, 0x9800c, 0x9800e, 0x90002, 0x90000, 0x88000
-};
-
-/* bit (1<<i) means character is in codeset i */
-unsigned int _Xlatin2[128] = {
-0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
-0x1800c, 0x10008, 0x00004, 0x00000, 0x0800c, 0x00000, 0x00000, 0x1800c,
-0x0800c, 0x00008, 0x00004, 0x00000, 0x00000, 0x1800c, 0x00008, 0x00004,
-0x1800c, 0x10008, 0x00008, 0x00000, 0x0800c, 0x00000, 0x00000, 0x00008,
-0x0800c, 0x00008, 0x00004, 0x00000, 0x00000, 0x00000, 0x00008, 0x00004,
-0x00000, 0x1800c, 0x1800c, 0x00000, 0x1800c, 0x00000, 0x00000, 0x08004,
-0x10008, 0x1800c, 0x10008, 0x1800c, 0x00000, 0x18008, 0x18008, 0x00000,
-0x00008, 0x00000, 0x00000, 0x18004, 0x1800c, 0x00000, 0x1800c, 0x0800c,
-0x00000, 0x00000, 0x0800c, 0x00000, 0x0800c, 0x10000, 0x00000, 0x1800c,
-0x00000, 0x1800c, 0x1800c, 0x00000, 0x1800c, 0x00000, 0x00000, 0x08004,
-0x10008, 0x1800c, 0x10008, 0x1800c, 0x00000, 0x1800c, 0x1800c, 0x00000,
-0x00008, 0x00000, 0x00000, 0x18004, 0x1800c, 0x00000, 0x1800c, 0x0800c,
-0x00000, 0x00000, 0x0800c, 0x00000, 0x0800c, 0x10000, 0x00000, 0x0000c
-};
-
-/* maps Cyrillic keysyms to 8859-5 */
-unsigned char _Xcyrillic[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80 - */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90 - */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0xf2, 0xf3, 0xf1, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xa0 - */
- 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0xfe, 0xff,
- 0xf0, 0xa2, 0xa3, 0xa1, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xb0 - */
- 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0x00, 0xae, 0xaf,
- 0xee, 0xd0, 0xd1, 0xe6, 0xd4, 0xd5, 0xe4, 0xd3, /* 0xc0 - */
- 0xe5, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde,
- 0xdf, 0xef, 0xe0, 0xe1, 0xe2, 0xe3, 0xd6, 0xd2, /* 0xd0 - */
- 0xec, 0xeb, 0xd7, 0xe8, 0xed, 0xe9, 0xe7, 0xea,
- 0xce, 0xb0, 0xb1, 0xc6, 0xb4, 0xb5, 0xc4, 0xb3, /* 0xe0 - */
- 0xc5, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe,
- 0xbf, 0xcf, 0xc0, 0xc1, 0xc2, 0xc3, 0xb6, 0xb2, /* 0xf0 - */
- 0xcc, 0xcb, 0xb7, 0xc8, 0xcd, 0xc9, 0xc7, 0xca
-};
-
-/* maps Cyrillic keysyms to KOI8-R */
-unsigned char _Xkoi8[] =
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0xa3, 0x00, 0x00, 0x00, 0x00, /* 10 */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, /* 11 */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 12 */
- 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
- 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 13 */
- 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
- 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 14 */
- 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
- 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 15 */
- 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff};
-
-unsigned short _Xkoi8_size = sizeof _Xkoi8;
-
-/* maps Greek keysyms to 8859-7 */
-unsigned char _Xgreek[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80 - */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90 - */
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0xb6, 0xb8, 0xb9, 0xba, 0xda, 0x00, 0xbc, /* 0xa0 - */
- 0xbe, 0xdb, 0x00, 0xbf, 0x00, 0x00, 0xb5, 0xaf,
- 0x00, 0xdc, 0xdd, 0xde, 0xdf, 0xfa, 0xc0, 0xfc, /* 0xb0 - */
- 0xfd, 0xfb, 0xe0, 0xfe, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0 - */
- 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
- 0xd0, 0xd1, 0xd3, 0x00, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0 - */
- 0xd8, 0xd9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0 - */
- 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
- 0xf0, 0xf1, 0xf3, 0xf2, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0 - */
- 0xf8, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-
-static unsigned short keysym_to_unicode_1a1_1ff[] = {
- 0x0104, 0x02d8, 0x0141, 0x0000, 0x013d, 0x015a, 0x0000, /* 0x01a0-0x01a7 */
- 0x0000, 0x0160, 0x015e, 0x0164, 0x0179, 0x0000, 0x017d, 0x017b, /* 0x01a8-0x01af */
- 0x0000, 0x0105, 0x02db, 0x0142, 0x0000, 0x013e, 0x015b, 0x02c7, /* 0x01b0-0x01b7 */
- 0x0000, 0x0161, 0x015f, 0x0165, 0x017a, 0x02dd, 0x017e, 0x017c, /* 0x01b8-0x01bf */
- 0x0154, 0x0000, 0x0000, 0x0102, 0x0000, 0x0139, 0x0106, 0x0000, /* 0x01c0-0x01c7 */
- 0x010c, 0x0000, 0x0118, 0x0000, 0x011a, 0x0000, 0x0000, 0x010e, /* 0x01c8-0x01cf */
- 0x0110, 0x0143, 0x0147, 0x0000, 0x0000, 0x0150, 0x0000, 0x0000, /* 0x01d0-0x01d7 */
- 0x0158, 0x016e, 0x0000, 0x0170, 0x0000, 0x0000, 0x0162, 0x0000, /* 0x01d8-0x01df */
- 0x0155, 0x0000, 0x0000, 0x0103, 0x0000, 0x013a, 0x0107, 0x0000, /* 0x01e0-0x01e7 */
- 0x010d, 0x0000, 0x0119, 0x0000, 0x011b, 0x0000, 0x0000, 0x010f, /* 0x01e8-0x01ef */
- 0x0111, 0x0144, 0x0148, 0x0000, 0x0000, 0x0151, 0x0000, 0x0000, /* 0x01f0-0x01f7 */
- 0x0159, 0x016f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0163, 0x02d9 /* 0x01f8-0x01ff */
-};
-
-static unsigned short keysym_to_unicode_2a1_2fe[] = {
- 0x0126, 0x0000, 0x0000, 0x0000, 0x0000, 0x0124, 0x0000, /* 0x02a0-0x02a7 */
- 0x0000, 0x0130, 0x0000, 0x011e, 0x0134, 0x0000, 0x0000, 0x0000, /* 0x02a8-0x02af */
- 0x0000, 0x0127, 0x0000, 0x0000, 0x0000, 0x0000, 0x0125, 0x0000, /* 0x02b0-0x02b7 */
- 0x0000, 0x0131, 0x0000, 0x011f, 0x0135, 0x0000, 0x0000, 0x0000, /* 0x02b8-0x02bf */
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x010a, 0x0108, 0x0000, /* 0x02c0-0x02c7 */
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x02c8-0x02cf */
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0120, 0x0000, 0x0000, /* 0x02d0-0x02d7 */
- 0x011c, 0x0000, 0x0000, 0x0000, 0x0000, 0x016c, 0x015c, 0x0000, /* 0x02d8-0x02df */
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x010b, 0x0109, 0x0000, /* 0x02e0-0x02e7 */
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x02e8-0x02ef */
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0121, 0x0000, 0x0000, /* 0x02f0-0x02f7 */
- 0x011d, 0x0000, 0x0000, 0x0000, 0x0000, 0x016c, 0x015d /* 0x02f8-0x02ff */
-};
-
-static unsigned short keysym_to_unicode_3a2_3fe[] = {
- 0x0138, 0x0156, 0x0000, 0x0128, 0x013b, 0x0000, /* 0x03a0-0x03a7 */
- 0x0000, 0x0000, 0x0112, 0x0122, 0x0166, 0x0000, 0x0000, 0x0000, /* 0x03a8-0x03af */
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x013c, 0x0000, /* 0x03b0-0x03b7 */
- 0x0000, 0x0000, 0x0113, 0x0123, 0x0167, 0x014a, 0x0000, 0x014b, /* 0x03b8-0x03bf */
- 0x0100, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x012e, /* 0x03c0-0x03c7 */
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0116, 0x0000, 0x0000, 0x012a, /* 0x03c8-0x03cf */
- 0x0000, 0x0145, 0x014c, 0x0136, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x03d0-0x03d7 */
- 0x0000, 0x0172, 0x0000, 0x0000, 0x0000, 0x0168, 0x016a, 0x0000, /* 0x03d8-0x03df */
- 0x0101, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x012f, /* 0x03e0-0x03e7 */
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0117, 0x0000, 0x0000, 0x012b, /* 0x03e8-0x03ef */
- 0x0000, 0x0146, 0x014d, 0x0137, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x03f0-0x03f7 */
- 0x0000, 0x0173, 0x0000, 0x0000, 0x0000, 0x0169, 0x016b /* 0x03f8-0x03ff */
-};
-
-static unsigned short keysym_to_unicode_4a1_4df[] = {
- 0x3002, 0x3008, 0x3009, 0x3001, 0x30fb, 0x30f2, 0x30a1, /* 0x04a0-0x04a7 */
- 0x30a3, 0x03a5, 0x30a7, 0x30a9, 0x30e3, 0x30e5, 0x30e7, 0x30c3, /* 0x04a8-0x04af */
- 0x30fc, 0x03a2, 0x30a4, 0x30a6, 0x30a8, 0x30aa, 0x30ab, 0x30ad, /* 0x04b0-0x04b7 */
- 0x30af, 0x30b1, 0x30b3, 0x30b5, 0x30b7, 0x30b9, 0x30bb, 0x30bd, /* 0x04b8-0x04bf */
- 0x30bf, 0x30c1, 0x30c4, 0x30c6, 0x30c8, 0x30ca, 0x30cb, 0x30cc, /* 0x04c0-0x04c7 */
- 0x30cd, 0x30ce, 0x30cf, 0x30d2, 0x30d5, 0x30d8, 0x30db, 0x30de, /* 0x04c8-0x04cf */
- 0x30df, 0x30e0, 0x30e1, 0x30e2, 0x30e4, 0x30e6, 0x30e8, 0x30e9, /* 0x04d0-0x04d7 */
- 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ef, 0x30f3, 0x309b, 0x309c /* 0x04d8-0x04df */
-};
-
-static unsigned short keysym_to_unicode_5ac_5f2[] = {
- 0x060c, 0x0000, 0x0000, 0x0000, /* 0x05ac-0x05af */
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x05b0-0x05b7 */
- 0x0000, 0x0000, 0x0000, 0x061b, 0x0000, 0x0000, 0x0000, 0x061f, /* 0x05b8-0x05bf */
- 0x0000, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, /* 0x05c0-0x05c7 */
- 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f, /* 0x05c8-0x05cf */
- 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, /* 0x05d0-0x05d7 */
- 0x0638, 0x0639, 0x063a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x05d8-0x05df */
- 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, /* 0x05e0-0x05e7 */
- 0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f, /* 0x05e8-0x05ef */
- 0x0650, 0x0651, 0x0652 /* 0x05f0-0x05f7 */
-};
-
-static unsigned short keysym_to_unicode_6a1_6ff[] = {
- 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, /* 0x06a0-0x06a7 */
- 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x0000, 0x045e, 0x045f, /* 0x06a8-0x06af */
- 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, /* 0x06b0-0x06b7 */
- 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x0000, 0x040e, 0x040f, /* 0x06b8-0x06bf */
- 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, /* 0x06c0-0x06c7 */
- 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, /* 0x06c8-0x06cf */
- 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, /* 0x06d0-0x06d7 */
- 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, /* 0x06d8-0x06df */
- 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, /* 0x06e0-0x06e7 */
- 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, /* 0x06e8-0x06ef */
- 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, /* 0x06f0-0x06f7 */
- 0x042c, 0x042d, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a /* 0x06f8-0x06ff */
-};
-
-static unsigned short keysym_to_unicode_7a1_7f9[] = {
- 0x0386, 0x0388, 0x0389, 0x038a, 0x03aa, 0x0000, 0x038c, /* 0x07a0-0x07a7 */
- 0x038e, 0x03ab, 0x0000, 0x038f, 0x0000, 0x0000, 0x0385, 0x2015, /* 0x07a8-0x07af */
- 0x0000, 0x03ac, 0x03ad, 0x03ae, 0x03af, 0x03ca, 0x0390, 0x03cc, /* 0x07b0-0x07b7 */
- 0x03cd, 0x03cb, 0x03b0, 0x03ce, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x07b8-0x07bf */
- 0x0000, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, /* 0x07c0-0x07c7 */
- 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, /* 0x07c8-0x07cf */
- 0x03a0, 0x03a1, 0x03a2, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, /* 0x07d0-0x07d7 */
- 0x03a8, 0x03a9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x07d8-0x07df */
- 0x0000, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, /* 0x07e0-0x07e7 */
- 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, /* 0x07e8-0x07ef */
- 0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, /* 0x07f0-0x07f7 */
- 0x03c8, 0x03c9 /* 0x07f8-0x07ff */
-};
-
-static unsigned short keysym_to_unicode_8a4_8fe[] = {
- 0x2320, 0x2321, 0x0000, 0x231c, /* 0x08a0-0x08a7 */
- 0x231d, 0x231e, 0x231f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08a8-0x08af */
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08b0-0x08b7 */
- 0x0000, 0x0000, 0x0000, 0x0000, 0x2264, 0x2260, 0x2265, 0x222b, /* 0x08b8-0x08bf */
- 0x2234, 0x0000, 0x221e, 0x0000, 0x0000, 0x2207, 0x0000, 0x0000, /* 0x08c0-0x08c7 */
- 0x2245, 0x2246, 0x0000, 0x0000, 0x0000, 0x0000, 0x22a2, 0x0000, /* 0x08c8-0x08cf */
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x221a, 0x0000, /* 0x08d0-0x08d7 */
- 0x0000, 0x0000, 0x2282, 0x2283, 0x2229, 0x222a, 0x2227, 0x2228, /* 0x08d8-0x08df */
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08e0-0x08e7 */
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08e8-0x08ef */
- 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0192, 0x0000, /* 0x08f0-0x08f7 */
- 0x0000, 0x0000, 0x0000, 0x2190, 0x2191, 0x2192, 0x2193 /* 0x08f8-0x08ff */
-};
-
-static unsigned short keysym_to_unicode_9df_9f8[] = {
- 0x2422, /* 0x09d8-0x09df */
- 0x2666, 0x25a6, 0x2409, 0x240c, 0x240d, 0x240a, 0x0000, 0x0000, /* 0x09e0-0x09e7 */
- 0x240a, 0x240b, 0x2518, 0x2510, 0x250c, 0x2514, 0x253c, 0x2500, /* 0x09e8-0x09ef */
- 0x0000, 0x0000, 0x0000, 0x0000, 0x251c, 0x2524, 0x2534, 0x252c, /* 0x09f0-0x09f7 */
- 0x2502 /* 0x09f8-0x09ff */
-};
+typedef unsigned int ucs4_t;
-static unsigned short keysym_to_unicode_aa1_afe[] = {
- 0x2003, 0x2002, 0x2004, 0x2005, 0x2007, 0x2008, 0x2009, /* 0x0aa0-0x0aa7 */
- 0x200a, 0x2014, 0x2013, 0x0000, 0x0000, 0x0000, 0x2026, 0x2025, /* 0x0aa8-0x0aaf */
- 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159, 0x215a, /* 0x0ab0-0x0ab7 */
- 0x2105, 0x0000, 0x0000, 0x2012, 0x2039, 0x2024, 0x203a, 0x0000, /* 0x0ab8-0x0abf */
- 0x0000, 0x0000, 0x0000, 0x215b, 0x215c, 0x215d, 0x215e, 0x0000, /* 0x0ac0-0x0ac7 */
- 0x0000, 0x2122, 0x2120, 0x00ae, 0x25c1, 0x25b7, 0x25cb, 0x25ad, /* 0x0ac8-0x0acf */
- 0x2018, 0x2019, 0x201c, 0x201d, 0x211e, 0x0000, 0x2032, 0x2033, /* 0x0ad0-0x0ad7 */
- 0x0000, 0x271d, 0x0000, 0x220e, 0x25c2, 0x2023, 0x25cf, 0x25ac, /* 0x0ad8-0x0adf */
- 0x25e6, 0x25ab, 0x25ae, 0x25b5, 0x25bf, 0x2606, 0x2022, 0x25aa, /* 0x0ae0-0x0ae7 */
- 0x25b4, 0x25be, 0x261a, 0x261b, 0x2663, 0x2666, 0x2665, 0x0000, /* 0x0ae8-0x0aef */
- 0x2720, 0x2020, 0x2021, 0x2713, 0x2612, 0x266f, 0x266d, 0x2642, /* 0x0af0-0x0af7 */
- 0x2640, 0x2121, 0x2315, 0x2117, 0x2038, 0x201a, 0x201e /* 0x0af8-0x0aff */
-};
-
-/* none of the APL keysyms match the Unicode characters */
+typedef int (*ucstocsConvProc)(
+ XPointer,
+ unsigned char *,
+ ucs4_t,
+ int
+);
-static unsigned short keysym_to_unicode_cdf_cfa[] = {
- 0x2017, /* 0x0cd8-0x0cdf */
- 0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, /* 0x0ce0-0x0ce7 */
- 0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, /* 0x0ce8-0x0cef */
- 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, /* 0x0cf0-0x0cf7 */
- 0x05e8, 0x05e9, 0x05ea /* 0x0cf8-0x0cff */
+struct SubstRec {
+ char* encoding_name;
+ char* charset_name;
};
-static unsigned short keysym_to_unicode_da1_df9[] = {
- 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, /* 0x0da0-0x0da7 */
- 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, /* 0x0da8-0x0daf */
- 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, /* 0x0db0-0x0db7 */
- 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, /* 0x0db8-0x0dbf */
- 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, /* 0x0dc0-0x0dc7 */
- 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, /* 0x0dc8-0x0dcf */
- 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, /* 0x0dd0-0x0dd7 */
- 0x0e38, 0x0e39, 0x0e3a, 0x0e3b, 0x0e3c, 0x0e3d, 0x0e3e, 0x0e3f, /* 0x0dd8-0x0ddf */
- 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, /* 0x0de0-0x0de7 */
- 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0000, 0x0000, /* 0x0de8-0x0def */
- 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, /* 0x0df0-0x0df7 */
- 0x0e58, 0x0e59 /* 0x0df8-0x0dff */
+static struct SubstRec SubstTable[] = {
+ {"STRING", "ISO8859-1"},
+ {"TIS620", "TIS620-0"},
+ {"UTF-8", "ISO10646-1"}
};
+#define num_substitute (sizeof SubstTable / sizeof SubstTable[0])
-static unsigned short keysym_to_unicode_ea0_eff[] = {
- 0x0000, 0x1101, 0x1101, 0x11aa, 0x1102, 0x11ac, 0x11ad, 0x1103, /* 0x0ea0-0x0ea7 */
- 0x1104, 0x1105, 0x11b0, 0x11b1, 0x11b2, 0x11b3, 0x11b4, 0x11b5, /* 0x0ea8-0x0eaf */
- 0x11b6, 0x1106, 0x1107, 0x1108, 0x11b9, 0x1109, 0x110a, 0x110b, /* 0x0eb0-0x0eb7 */
- 0x110c, 0x110d, 0x110e, 0x110f, 0x1110, 0x1111, 0x1112, 0x1161, /* 0x0eb8-0x0ebf */
- 0x1162, 0x1163, 0x1164, 0x1165, 0x1166, 0x1167, 0x1168, 0x1169, /* 0x0ec0-0x0ec7 */
- 0x116a, 0x116b, 0x116c, 0x116d, 0x116e, 0x116f, 0x1170, 0x1171, /* 0x0ec8-0x0ecf */
- 0x1172, 0x1173, 0x1174, 0x1175, 0x11a8, 0x11a9, 0x11aa, 0x11ab, /* 0x0ed0-0x0ed7 */
- 0x11ac, 0x11ad, 0x11ae, 0x11af, 0x11b0, 0x11b1, 0x11b2, 0x11b3, /* 0x0ed8-0x0edf */
- 0x11b4, 0x11b5, 0x11b6, 0x11b7, 0x11b8, 0x11b9, 0x11ba, 0x11bb, /* 0x0ee0-0x0ee7 */
- 0x11bc, 0x11bd, 0x11be, 0x11bf, 0x11c0, 0x11c1, 0x11c2, 0x0000, /* 0x0ee8-0x0eef */
- 0x0000, 0x0000, 0x1140, 0x0000, 0x0000, 0x1159, 0x119e, 0x0000, /* 0x0ef0-0x0ef7 */
- 0x11eb, 0x0000, 0x11f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x20a9, /* 0x0ef8-0x0eff */
-};
-
-static unsigned short keysym_to_unicode_13bc_13be[] = {
- 0x0152, 0x0153, 0x0178 /* 0x13b8-0x13bf */
-};
-
-static unsigned short keysym_to_unicode_20a0_20ac[] = {
- 0x20a0, 0x20a1, 0x20a2, 0x20a3, 0x20a4, 0x20a5, 0x20a6, 0x20a7, /* 0x20a0-0x20a7 */
- 0x20a8, 0x20a9, 0x20aa, 0x20ab, 0x20ac /* 0x20a8-0x20af */
-};
-
-static int keysym_to_ucs4(keysym)
- KeySym keysym;
-{
- if (keysym > 0 && keysym < 0x100)
- return keysym;
- else if (keysym > 0x1a0 && keysym < 0x200)
- return keysym_to_unicode_1a1_1ff[keysym - 0x1a1];
- else if (keysym > 0x2a0 && keysym < 0x2ff)
- return keysym_to_unicode_2a1_2fe[keysym - 0x2a1];
- else if (keysym > 0x3a1 && keysym < 0x3ff)
- return keysym_to_unicode_3a2_3fe[keysym - 0x3a2];
- else if (keysym > 0x4a0 && keysym < 0x4e0)
- return keysym_to_unicode_4a1_4df[keysym - 0x4a1];
- else if (keysym > 0x5ab && keysym < 0x5f3)
- return keysym_to_unicode_5ac_5f2[keysym - 0x5ac];
- else if (keysym > 0x6a0 && keysym < 0x700)
- return keysym_to_unicode_6a1_6ff[keysym - 0x6a1];
- else if (keysym > 0x7a0 && keysym < 0x7fa)
- return keysym_to_unicode_7a1_7f9[keysym - 0x7a1];
- else if (keysym > 0x8a3 && keysym < 0x8ff)
- return keysym_to_unicode_8a4_8fe[keysym - 0x8a4];
- else if (keysym > 0x9de && keysym < 0x9f9)
- return keysym_to_unicode_9df_9f8[keysym - 0x9df];
- else if (keysym > 0xaa0 && keysym < 0xaff)
- return keysym_to_unicode_aa1_afe[keysym - 0xaa1];
- else if (keysym > 0xcde && keysym < 0xcfb)
- return keysym_to_unicode_cdf_cfa[keysym - 0xcdf];
- else if (keysym > 0xda0 && keysym < 0xdfa)
- return keysym_to_unicode_da1_df9[keysym - 0xda1];
- else if (keysym > 0xe9f && keysym < 0xf00)
- return keysym_to_unicode_ea0_eff[keysym - 0xea0];
- else if (keysym > 0x13bb && keysym < 0x13bf)
- return keysym_to_unicode_13bc_13be[keysym - 0x13bc];
- else if (keysym > 0x209f && keysym < 0x20ad)
- return keysym_to_unicode_20a0_20ac[keysym - 0x20a0];
- else
- return 0;
-}
-
-struct CodesetRec {
- unsigned long locale_code;
- char* locale_name;
- char* escape_seq;
-};
-
-#define sLatin1 0L
-#define sLatin2 1L
-#define sLatin3 2L
-#define sLatin4 3L
-#define sKana 4L
-#define sX0201 0x01000004L
-#define sArabic 5L
-#define sCyrillic 6L
-#define sKoi8 0x01000006L
-#define sGreek 7L
-#define sHebrew 12L
-#define sThai 13L
-#define sKorean 14L
-#define sLatin5 15L
-#define sLatin6 16L
-#define sLatin7 17L
-#define sLatin8 18L
-#define sLatin9 19L
-#define sCurrency 32L
-#define sUTF8 0x02000000L
-
-static struct CodesetRec CodesetTable[] = {
- {sLatin1, "ISO8859-1", "\033-A"},
- {sLatin2, "ISO8859-2", "\033-B"},
- {sLatin3, "ISO8859-3", "\033-C"},
- {sLatin4, "ISO8859-4", "\033-D"},
- {sArabic, "ISO8859-6", "\033-G"},
- {sCyrillic, "ISO8859-5", "\033-L"},
- {sGreek, "ISO8859-7", "\033-F"},
- {sHebrew, "ISO8859-8", "\033-H"},
- {sLatin5, "ISO8859-9", "\033-M"},
- {sLatin6, "ISO8859-10", "\033-V"},
- {sThai, "TACTIS", "\033-T"},
- {sKorean, "ko.euc", "\033$(C"},
- {sThai, "ISO8859-11", "\033-T"},
-#if 0
- {sLatin8, "ISO8859-12", "\033-?"},/* Celtic, superceded by -14 */
- {sLatin7, "ISO8859-13", "\033-?"},/* Baltic Rim */
- {sLatin8 "ISO8859-14", "\033-?"},/* Celtic */
-#endif
- {sUTF8, "utf8", "\033%B"},
- /* Non-standard */
- {sKoi8, "KOI8-R", "\033%/1\200\210koi8-r\002"},
- {sLatin9, "FCD8859-15", "\033%/1\200\213fcd8859-15\002"},/* a.k.a. Latin-0 */
-};
-
-#define NUM_CODESETS sizeof CodesetTable / sizeof CodesetTable[0]
-
-#ifndef XK_emdash
-#define XK_emdash 0xaa9
-#endif
-
-
-/* ================================================================ */
/*
-File: ConvertUTF.C
-Author: Mark E. Davis
-Copyright (C) 1994 Taligent, Inc. All rights reserved.
-
-This code is copyrighted. Under the copyright laws, this code may not
-be copied, in whole or part, without prior written consent of Taligent.
-
-Taligent grants the right to use or reprint this code as long as this
-ENTIRE copyright notice is reproduced in the code or reproduction.
-The code is provided AS-IS, AND TALIGENT DISCLAIMS ALL WARRANTIES,
-EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN
-NO EVENT WILL TALIGENT BE LIABLE FOR ANY DAMAGES WHATSOEVER (INCLUDING,
-WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS
-INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY
-LOSS) ARISING OUT OF THE USE OR INABILITY TO USE THIS CODE, EVEN
-IF TALIGENT HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-BECAUSE SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF
-LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, THE ABOVE
-LIMITATION MAY NOT APPLY TO YOU.
-
-RESTRICTED RIGHTS LEGEND: Use, duplication, or disclosure by the
-government is subject to restrictions as set forth in subparagraph
-(c)(l)(ii) of the Rights in Technical Data and Computer Software
-clause at DFARS 252.227-7013 and FAR 52.227-19.
-
-This code may be protected by one or more U.S. and International
-Patents.
-
-TRADEMARKS: Taligent and the Taligent Design Mark are registered
-trademarks of Taligent, Inc.
-*/
-/* ================================================================ */
-
-#define kReplacementCharacter 0x0000FFFDUL
-#define kMaximumUCS2 0x0000FFFFUL
-#define kMaximumUCS4 0x7FFFFFFFUL
-
-typedef enum {
- ok, /* conversion successful */
- sourceExhausted, /* partial character in source, but hit end */
- targetExhausted /* insuff. room in target for conversion */
-} ConversionResult;
-
-#define halfShift 10
-#define halfBase 0x0010000UL
-#define halfMask 0x3FFUL
-#define kSurrogateHighStart 0xD800UL
-#define kSurrogateHighEnd 0xDBFFUL
-#define kSurrogateLowStart 0xDC00UL
-#define kSurrogateLowEnd 0xDFFFUL
-
-typedef unsigned int UCS4; /* wchar_t, but on AIX, SunOS wchar_t is 16 bits */
-typedef unsigned char UTF8;
-
-static UCS4 offsetsFromUTF8[6] = {
- 0x00000000UL, 0x00003080UL, 0x000E2080UL,
- 0x03C82080UL, 0xFA082080UL, 0x82082080UL
-};
-
-static char bytesFromUTF8[256] = {
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
- 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5
-};
-
-static UTF8 firstByteMark[7] = {
- 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC
-};
-
-static ConversionResult ConvertUCS4toUTF8 (
- UCS4** sourceStart, UCS4* sourceEnd,
- UTF8** targetStart, UTF8* targetEnd)
+ * Given the name of a charset, returns the pointer to convertors
+ * from UCS char to specified charset char.
+ * This converter is needed for _XimGetCharCode subroutine.
+ */
+XPointer
+_XimGetLocaleCode (
+ _Xconst char* encoding_name)
{
- ConversionResult result = ok;
- register UCS4* source = *sourceStart;
- register UTF8* target = *targetStart;
- while (source < sourceEnd) {
- register UCS4 ch;
- register unsigned short bytesToWrite = 0;
- register const UCS4 byteMask = 0xBF;
- register const UCS4 byteMark = 0x80;
- ch = *source++;
- if (ch >= kSurrogateHighStart && ch <= kSurrogateHighEnd
- && source < sourceEnd) {
- register UCS4 ch2 = *source;
- if (ch2 >= kSurrogateLowStart && ch2 <= kSurrogateLowEnd) {
- ch = ((ch - kSurrogateHighStart) << halfShift)
- + (ch2 - kSurrogateLowStart) + halfBase;
- ++source;
- };
- };
- if (ch < 0x80) { bytesToWrite = 1;
- } else if (ch < 0x800) { bytesToWrite = 2;
- } else if (ch < 0x10000) { bytesToWrite = 3;
- } else if (ch < 0x200000) { bytesToWrite = 4;
- } else if (ch < 0x4000000) { bytesToWrite = 5;
- } else if (ch <= kMaximumUCS4){ bytesToWrite = 6;
- } else { bytesToWrite = 2;
- ch = kReplacementCharacter;
- }; /* I wish there were a smart way to avoid this conditional */
-
- target += bytesToWrite;
- if (target > targetEnd) {
- target -= bytesToWrite; result = targetExhausted; break;
- };
- switch (bytesToWrite) { /* note: code falls through cases! */
- case 6: *--target = (ch | byteMark) & byteMask; ch >>= 6;
- case 5: *--target = (ch | byteMark) & byteMask; ch >>= 6;
- case 4: *--target = (ch | byteMark) & byteMask; ch >>= 6;
- case 3: *--target = (ch | byteMark) & byteMask; ch >>= 6;
- case 2: *--target = (ch | byteMark) & byteMask; ch >>= 6;
- case 1: *--target = ch | firstByteMark[bytesToWrite];
- };
- target += bytesToWrite;
- };
- *sourceStart = source;
- *targetStart = target;
- return result;
+ XPointer cvt = _Utf8GetConvByName(encoding_name);
+ if (!cvt && encoding_name) {
+ int i;
+ for (i = 0; i < num_substitute; i++)
+ if (!strcmp(encoding_name, SubstTable[i].encoding_name))
+ return _Utf8GetConvByName(SubstTable[i].charset_name);
+ }
+ return cvt;
}
+/*
+ * Returns the locale dependent representation of a keysym.
+ * The locale's encoding is passed in form of pointer to UCS convertor.
+ * The resulting multi-byte sequence is placed starting at buf (a buffer
+ * with nbytes bytes, nbytes should be >= 8) and is NUL terminated.
+ * Returns the length of the resulting multi-byte sequence, excluding the
+ * terminating NUL byte. Return 0 if the keysym is not representable in the
+ * locale
+ */
/*ARGSUSED*/
int
-#if NeedFunctionPrototypes
-_XGetCharCode (
- unsigned long locale_code,
- KeySym keysym,
- unsigned char* buf,
- int nbytes)
-#else
-_XGetCharCode (locale_code, keysym, buf, nbytes)
- unsigned long locale_code;
- KeySym keysym;
- unsigned char *buf;
- int nbytes;
-#endif
+_XimGetCharCode (
+ XPointer ucs_conv,
+ KeySym keysym,
+ unsigned char* buf,
+ int nbytes)
{
- unsigned long kset;
- int count,isLatin1;
-
- if (locale_code == sUTF8) {
- unsigned int ucs4[2];
- unsigned int* ucs4vec[1];
- unsigned char* utf8vec[1];
-
- ucs4[0] = keysym_to_ucs4 (keysym);
- ucs4[1] = 0;
- ucs4vec[0] = ucs4;
- utf8vec[0] = buf;
-
- (void) ConvertUCS4toUTF8 (ucs4vec, &ucs4[1], utf8vec, &buf[nbytes]);
- return (strlen ((char*) buf));
+ int count = 0;
+ ucstocsConvProc cvt = (ucstocsConvProc) ucs_conv;
+ ucs4_t ucs4;
+
+ if (keysym < 0x80) {
+ buf[0] = (char) keysym;
+ count = 1;
+ } else if (cvt) {
+ ucs4 = KeySymToUcs4(keysym);
+ if (ucs4)
+ count = (*cvt)((XPointer)NULL, buf, ucs4, nbytes);
}
- kset = locale_code&0xffffff;
-
- isLatin1 = ((keysym&0xffffff00)==0);
- count = 0;
-
- if ( keysym == NoSymbol )
- return 0;
- else if ((keysym >> 8) == kset) {
- count = 1;
- switch (kset) {
- case sKana:
- *buf = (unsigned char)(keysym & 0xff);
- if (buf[0] == 0x7e)
- count = 0;
- break;
- case sCyrillic:
- if (locale_code == sKoi8)
- *buf = _Xkoi8[keysym & 0x7f];
- else
- *buf = _Xcyrillic[keysym & 0x7f];
- break;
- case sGreek:
- *buf = _Xgreek[keysym & 0x7f];
- if (!buf[0])
- count = 0;
- break;
- default:
- *buf = (unsigned char)(keysym & 0xff);
- break;
- }
- } else if ((locale_code != 0) && (isLatin1) && (keysym & 0x80)) {
- if (_Xlatin1[keysym & 0x7f] & (1 << kset)) {
- /* Most non-latin1 locales use some latin-1 upper half
- keysyms as defined by bitpatterns in array latin1.
- Enforce it. */
- *buf = (unsigned char)(keysym & 0xff);
- count = 1;
- } else {
- count= 1;
- if ((locale_code == sHebrew) && (keysym == XK_multiply))
- *buf = (unsigned char)0xaa;
- else if ((locale_code == sHebrew) && (keysym == XK_division))
- *buf = (unsigned char)0xba;
- else if ((locale_code == sCyrillic) && (keysym == XK_section))
- *buf = (unsigned char)0xfd;
- else if ((locale_code == sX0201) && (keysym == XK_yen))
- *buf = (unsigned char)0x5c;
- else count = 0;
- }
- } else if (isLatin1) {
- if ((locale_code == sX0201) &&
- ((keysym == XK_backslash) || (keysym == XK_asciitilde)))
- count = 0;
- if ( (keysym&0x80)==0 ) {
- *buf = (unsigned char)(keysym&0x7f);
- count = 1;
- }
- } else if ((keysym >> 8) == sLatin2) {
- count = 1;
- if ((keysym & 0x80) && (_Xlatin2[keysym & 0x7f] & (1 << kset)))
- *buf = (unsigned char)(keysym & 0xff);
- else if (locale_code == sLatin5) {
- if (keysym == XK_Scedilla)
- *buf = (unsigned char)0xde;
- else if (keysym == XK_scedilla)
- *buf = (unsigned char)0xfe;
- else count = 0;
- } else if (locale_code == sLatin9) {
- if (keysym == XK_Scaron)
- *buf = (unsigned char)0xa6;
- else if (keysym == XK_scaron)
- *buf = (unsigned char)0xa8;
- else if (keysym == XK_Zcaron)
- *buf = (unsigned char)0xb4;
- else if (keysym == XK_zcaron)
- *buf = (unsigned char)0xb8;
- else count = 0;
- } else count = 0;
- } else if ((keysym >> 8) == sLatin3) {
- if (locale_code == sLatin5) {
- count = 1;
- switch (keysym) {
- case XK_Gbreve: *buf = (unsigned char)0xd0; break;
- case XK_gbreve: *buf = (unsigned char)0xf0; break;
- case XK_Scedilla: *buf = (unsigned char)0xde; break;
- case XK_scedilla: *buf = (unsigned char)0xfe; break;
- case XK_Iabovedot: *buf = (unsigned char)0xdd; break;
- case XK_idotless: *buf = (unsigned char)0xfd; break;
- default: count = 0;
- }
- }
- } else if ((keysym >> 8) == sLatin4) {
- if (locale_code == sLatin6) {
- count = 1;
- switch (keysym) {
- case XK_Emacron: *buf = (unsigned char)0xa2; break;
- case XK_Gcedilla: *buf = (unsigned char)0xa3; break;
- case XK_Imacron: *buf = (unsigned char)0xa4; break;
- case XK_Lcedilla: *buf = (unsigned char) 0xa8; break;
- case XK_Dstroke: *buf = (unsigned char)0xa9; break;
- case XK_Scaron: *buf = (unsigned char)0xaa; break;
- case XK_Tslash: *buf = (unsigned char)0xab; break;
- case XK_Zcaron: *buf = (unsigned char)0xac; break;
- case XK_Umacron: *buf = (unsigned char)0xae; break;
- case XK_Utilde: *buf = (unsigned char)0xd7; break;
- case XK_ENG: *buf = (unsigned char)0xaf; break;
- case XK_emacron: *buf = (unsigned char)0xb2; break;
- case XK_gcedilla: *buf = (unsigned char)0xb3; break;
- case XK_imacron: *buf = (unsigned char)0xb4; break;
- case XK_lcedilla: *buf = (unsigned char) 0xb8; break;
- case XK_dstroke: *buf = (unsigned char)0xb9; break;
- case XK_scaron: *buf = (unsigned char)0xba; break;
- case XK_tslash: *buf = (unsigned char)0xbb; break;
- case XK_zcaron: *buf = (unsigned char)0xbc; break;
- case XK_umacron: *buf = (unsigned char)0xbe; break;
- case XK_utilde: *buf = (unsigned char)0xf7; break;
- case XK_eng: *buf = (unsigned char)0xbf; break;
- case XK_kra: *buf = (unsigned char)0xff; break;
- case XK_Itilde:
- case XK_Kcedilla:
- case XK_Iogonek:
- case XK_Ncedilla:
- case XK_Omacron:
- case XK_Uogonek:
- case XK_itilde:
- case XK_kcedilla:
- case XK_iogonek:
- case XK_ncedilla:
- case XK_omacron:
- case XK_uogonek: *buf = (unsigned char)(keysym & 0xff); break;
- default: count = 0;
- }
- }
- } else if (locale_code == sLatin9 && keysym == XK_EuroSign) {
- count = 1;
- *buf = (unsigned char)0xa4;
- } else if ((locale_code == sGreek) &&
- ((keysym == XK_leftsinglequotemark) ||
- (keysym == XK_rightsinglequotemark))) {
- *buf = (unsigned char)(keysym - (XK_leftsinglequotemark - 0xa1));
- count = 1;
- }
+ if (count < 0)
+ count = 0;
if (count>nbytes)
- return nbytes;
+ return nbytes;
if (count<nbytes)
- buf[count]= '\0';
+ buf[count]= '\0';
return count;
}
#ifdef XKB
-static int lookup_string (event, buffer, nbytes, keysym, status)
- XKeyEvent* event;
- char* buffer;
- int nbytes;
- KeySym* keysym;
- XComposeStatus* status;
+static int lookup_string(
+ XKeyEvent* event,
+ char* buffer,
+ int nbytes,
+ KeySym* keysym,
+ XComposeStatus* status)
{
int ret;
unsigned ctrls = XkbGetXlibControls (event->display);
XkbSetXlibControls (event->display,
XkbLC_ForceLatin1Lookup, XkbLC_ForceLatin1Lookup);
- ret = XLookupString(event, buffer, nbytes, keysym, status);
- XkbSetXlibControls (event->display, ctrls, ctrls);
+ ret = XLookupString(event, (char *)buffer, nbytes, keysym, status);
+ XkbSetXlibControls (event->display,
+ XkbLC_ForceLatin1Lookup, ctrls);
return ret;
}
#endif
@@ -778,45 +163,20 @@ _XimLookupMBText(ic, event, buffer, nbytes, keysym, status)
KeySym* keysym;
XComposeStatus* status;
{
- int count, local_count;
+ int count;
KeySym symbol;
- struct CodesetRec *cset;
- int i;
Status dummy;
Xim im = (Xim)ic->core.im;
- XLCd lcd = im->core.lcd;
- unsigned char local_buf[BUF_SIZE];
+ XimCommonPrivateRec* private = &im->private.common;
unsigned char look[BUF_SIZE];
-
+ ucs4_t ucs4;
/* force a latin-1 lookup for compatibility */
count = XLOOKUPSTRING(event, (char *)buffer, nbytes, &symbol, status);
if (keysym != NULL) *keysym = symbol;
if ((nbytes == 0) || (symbol == NoSymbol)) return count;
- for (cset = NULL, i = 0; i < NUM_CODESETS; i++) {
- if (strcmp (XLC_PUBLIC(lcd,encoding_name), CodesetTable[i].locale_name) == 0) {
- cset = &CodesetTable[i];
- break;
- }
- }
- if (count == 0 && cset != NULL ||
- (count == 1 && (symbol > 0x7f && symbol < 0xff00) &&
- cset != NULL && cset->locale_code != 0)) {
- if ((count = _XGetCharCode(cset->locale_code, symbol,
- look, sizeof look))) {
- strcpy((char*) local_buf, cset->escape_seq);
- local_count = strlen(cset->escape_seq);
- local_buf[local_count] = look[0];
- local_count++;
- local_buf[local_count] = '\0';
- if ((count = im->methods->ctstombs(ic->core.im,
- (char*) local_buf, local_count,
- (char *)buffer, nbytes, &dummy)) < 0) {
- count = 0;
- }
- }
- } else if (count > 1) { /* not ASCII Encoding */
+ if (count > 1) {
memcpy(look, (char *)buffer,count);
look[count] = '\0';
if ((count = im->methods->ctstombs(ic->core.im,
@@ -824,8 +184,40 @@ _XimLookupMBText(ic, event, buffer, nbytes, keysym, status)
buffer, nbytes, &dummy)) < 0) {
count = 0;
}
+ } else if ((count == 0) ||
+ (count == 1 && (symbol > 0x7f && symbol < 0xff00))) {
+
+ XPointer from = (XPointer) &ucs4;
+ XPointer to = (XPointer) look;
+ int from_len = 1;
+ int to_len = BUF_SIZE;
+ XPointer args[1];
+ XlcCharSet charset;
+ args[0] = (XPointer) &charset;
+ ucs4 = (ucs4_t) KeySymToUcs4(symbol);
+ if (!ucs4)
+ return 0;
+
+ if (_XlcConvert(private->ucstoc_conv,
+ &from, &from_len, &to, &to_len,
+ args, 1 ) != 0) {
+ count = 0;
+ } else {
+ from = (XPointer) look;
+ to = (XPointer) buffer;
+ from_len = BUF_SIZE - to_len;
+ to_len = nbytes;
+ args[0] = (XPointer) charset;
+ if (_XlcConvert(private->cstomb_conv,
+ &from, &from_len, &to, &to_len,
+ args, 1 ) != 0) {
+ count = 0;
+ } else {
+ count = nbytes - to_len;
+ }
+ }
}
- /*
+ /* FIXME:
* we should make sure that if the character is a Latin1 character
* and it's on the right side, and we're in a non-Latin1 locale
* that this is a valid Latin1 character for this locale.
@@ -842,51 +234,60 @@ _XimLookupWCText(ic, event, buffer, nbytes, keysym, status)
KeySym* keysym;
XComposeStatus* status;
{
- int count, local_count;
+ int count;
KeySym symbol;
- struct CodesetRec *cset;
- int i;
Status dummy;
Xim im = (Xim)ic->core.im;
- XLCd lcd = im->core.lcd;
- unsigned char local_buf[BUF_SIZE];
+ XimCommonPrivateRec* private = &im->private.common;
unsigned char look[BUF_SIZE];
+ ucs4_t ucs4;
/* force a latin-1 lookup for compatibility */
count = XLOOKUPSTRING(event, (char *)look, nbytes, &symbol, status);
if (keysym != NULL) *keysym = symbol;
if ((nbytes == 0) || (symbol == NoSymbol)) return count;
- for (cset = NULL, i = 0; i < NUM_CODESETS; i++) {
- if (strcmp (XLC_PUBLIC(lcd,encoding_name), CodesetTable[i].locale_name) == 0) {
- cset = &CodesetTable[i];
- break;
- }
- }
- if (count == 0 && cset != NULL ||
- (count == 1 && (symbol > 0x7f && symbol < 0xff00) &&
- cset != NULL && cset->locale_code != 0)) {
- if ((count = _XGetCharCode(cset->locale_code, symbol,
- look, sizeof look))) {
- strcpy((char*) local_buf, cset->escape_seq);
- local_count = strlen(cset->escape_seq);
- local_buf[local_count] = look[0];
- local_count++;
- local_buf[local_count] = '\0';
- if ((count = im->methods->ctstowcs(ic->core.im,
- (char*) local_buf, local_count,
- buffer, nbytes, &dummy)) < 0) {
- count = 0;
- }
- }
- } else if (count > 1) {
+ if (count > 1) {
if ((count = im->methods->ctstowcs(ic->core.im,
(char*) look, count,
buffer, nbytes, &dummy)) < 0) {
count = 0;
}
+ } else if ((count == 0) ||
+ (count == 1 && (symbol > 0x7f && symbol < 0xff00))) {
+
+ XPointer from = (XPointer) &ucs4;
+ XPointer to = (XPointer) look;
+ int from_len = 1;
+ int to_len = BUF_SIZE;
+ XPointer args[1];
+ XlcCharSet charset;
+ args[0] = (XPointer) &charset;
+ ucs4 = (ucs4_t) KeySymToUcs4(symbol);
+ if (!ucs4)
+ return 0;
+
+ if (_XlcConvert(private->ucstoc_conv,
+ &from, &from_len, &to, &to_len,
+ args, 1 ) != 0) {
+ count = 0;
+ } else {
+ from = (XPointer) look;
+ to = (XPointer) buffer;
+ from_len = BUF_SIZE - to_len;
+ to_len = nbytes;
+ args[0] = (XPointer) charset;
+
+ if (_XlcConvert(private->cstowc_conv,
+ &from, &from_len, &to, &to_len,
+ args, 1 ) != 0) {
+ count = 0;
+ } else {
+ count = nbytes - to_len;
+ }
+ }
} else
- /*
+ /* FIXME:
* we should make sure that if the character is a Latin1 character
* and it's on the right side, and we're in a non-Latin1 locale
* that this is a valid Latin1 character for this locale.
@@ -895,3 +296,61 @@ _XimLookupWCText(ic, event, buffer, nbytes, keysym, status)
return count;
}
+
+int
+_XimLookupUTF8Text(ic, event, buffer, nbytes, keysym, status)
+ Xic ic;
+ XKeyEvent* event;
+ char* buffer;
+ int nbytes;
+ KeySym* keysym;
+ XComposeStatus* status;
+{
+ int count;
+ KeySym symbol;
+ Status dummy;
+ Xim im = (Xim)ic->core.im;
+ XimCommonPrivateRec* private = &im->private.common;
+ unsigned char look[BUF_SIZE];
+ ucs4_t ucs4;
+
+ /* force a latin-1 lookup for compatibility */
+ count = XLOOKUPSTRING(event, (char *)buffer, nbytes, &symbol, status);
+ if (keysym != NULL) *keysym = symbol;
+ if ((nbytes == 0) || (symbol == NoSymbol)) return count;
+
+ if (count > 1) {
+ memcpy(look, (char *)buffer,count);
+ look[count] = '\0';
+ if ((count = im->methods->ctstoutf8(ic->core.im,
+ (char*) look, count,
+ buffer, nbytes, &dummy)) < 0) {
+ count = 0;
+ }
+ } else if ((count == 0) ||
+ (count == 1 && (symbol > 0x7f && symbol < 0xff00))) {
+
+ XPointer from = (XPointer) &ucs4;
+ int from_len = 1;
+ XPointer to = (XPointer) buffer;
+ int to_len = nbytes;
+
+ ucs4 = (ucs4_t) KeySymToUcs4(symbol);
+ if (!ucs4)
+ return 0;
+
+ if (_XlcConvert(private->ucstoutf8_conv,
+ &from, &from_len, &to, &to_len,
+ NULL, 0) != 0) {
+ count = 0;
+ } else {
+ count = nbytes - to_len;
+ }
+ }
+ /* FIXME:
+ * we should make sure that if the character is a Latin1 character
+ * and it's on the right side, and we're in a non-Latin1 locale
+ * that this is a valid Latin1 character for this locale.
+ */
+ return count;
+}
diff --git a/src/locking.c b/src/locking.c
index 96926975..3508dea8 100644
--- a/src/locking.c
+++ b/src/locking.c
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/locking.c,v 1.5 2003/04/13 19:22:22 dawes Exp $ */
/*
* Author: Stephen Gildea, MIT X Consortium
@@ -46,10 +47,6 @@ in this Software without prior written authorization from The Open Group.
#define NUM_FREE_CVLS 4
-/* in XOpenDis.c */
-extern int (*_XInitDisplayLock_fn)();
-extern void (*_XFreeDisplayLock_fn)();
-
/* in lcWrap.c */
extern LockInfoPtr _Xi18n_lock;
@@ -77,7 +74,7 @@ _Xthread_waiter()
}
#endif /* WIN32 */
-static xthread_t _Xthread_self()
+static xthread_t _Xthread_self(void)
{
return xthread_self();
}
@@ -91,28 +88,28 @@ static void _XLockMutex(lip,file,line)
char* file;
int line;
#else
-static void _XLockMutex(lip)
- LockInfoPtr lip;
+static void _XLockMutex(
+ LockInfoPtr lip)
#endif
{
xmutex_lock(lip->lock);
}
#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
-static void _XUnlockMutex(lip,file,line)
- LockInfoPtr lip;
- char* file;
- int line;
+static void _XUnlockMutex(
+ LockInfoPtr lip,
+ char* file,
+ int line)
#else
-static void _XUnlockMutex(lip)
- LockInfoPtr lip;
+static void _XUnlockMutex(
+ LockInfoPtr lip)
#endif
{
xmutex_unlock(lip->lock);
}
-static void _XCreateMutex(lip)
- LockInfoPtr lip;
+static void _XCreateMutex(
+ LockInfoPtr lip)
{
lip->lock = xmutex_malloc();
if (lip->lock) {
@@ -121,8 +118,8 @@ static void _XCreateMutex(lip)
}
}
-static void _XFreeMutex(lip)
- LockInfoPtr lip;
+static void _XFreeMutex(
+ LockInfoPtr lip)
{
xmutex_clear(lip->lock);
xmutex_free(lip->lock);
@@ -146,10 +143,10 @@ static struct {
int lock_hist_loc = 0; /* next slot to fill */
-static void _XLockDisplayWarn(dpy,file,line)
- Display *dpy;
- char *file; /* source file, from macro */
- int line;
+static void _XLockDisplayWarn(
+ Display *dpy,
+ char *file, /* source file, from macro */
+ int line)
{
xthread_t self;
xthread_t old_locker;
@@ -204,8 +201,8 @@ static void _XUnlockDisplay(dpy,file,line)
char *file;
int line;
#else
-static void _XUnlockDisplay(dpy)
- Display *dpy;
+static void _XUnlockDisplay(
+ Display *dpy)
#endif
{
#ifdef XTHREADS_WARN
@@ -241,8 +238,8 @@ static void _XUnlockDisplay(dpy)
}
-static struct _XCVList *_XCreateCVL(dpy)
- Display *dpy;
+static struct _XCVList *_XCreateCVL(
+ Display *dpy)
{
struct _XCVList *cvl;
@@ -269,9 +266,9 @@ static struct _XCVList *_XCreateCVL(dpy)
Allocates and returns a queue element. */
static struct _XCVList *
-_XPushReader(dpy, tail)
- Display *dpy;
- struct _XCVList ***tail;
+_XPushReader(
+ Display *dpy,
+ struct _XCVList ***tail)
{
struct _XCVList *cvl;
@@ -287,10 +284,10 @@ _XPushReader(dpy, tail)
/* signal the next thread waiting to read the connection */
-static void _XPopReader(dpy, list, tail)
- Display *dpy;
- struct _XCVList **list;
- struct _XCVList ***tail;
+static void _XPopReader(
+ Display *dpy,
+ struct _XCVList **list,
+ struct _XCVList ***tail)
{
register struct _XCVList *front = *list;
@@ -333,9 +330,9 @@ static void _XConditionWait(cv, mutex,file,line)
char *file;
int line;
#else
-static void _XConditionWait(cv, mutex)
- xcondition_t cv;
- xmutex_t mutex;
+static void _XConditionWait(
+ xcondition_t cv,
+ xmutex_t mutex)
#endif
{
#ifdef XTHREADS_WARN
@@ -383,8 +380,8 @@ static void _XConditionSignal(cv,file,line)
char *file;
int line;
#else
-static void _XConditionSignal(cv)
- xcondition_t cv;
+static void _XConditionSignal(
+ xcondition_t cv)
#endif
{
#ifdef XTHREADS_WARN
@@ -402,8 +399,8 @@ static void _XConditionBroadcast(cv,file,line)
char *file;
int line;
#else
-static void _XConditionBroadcast(cv)
- xcondition_t cv;
+static void _XConditionBroadcast(
+ xcondition_t cv)
#endif
{
#ifdef XTHREADS_WARN
@@ -415,8 +412,8 @@ static void _XConditionBroadcast(cv)
}
-static void _XFreeDisplayLock(dpy)
- Display *dpy;
+static void _XFreeDisplayLock(
+ Display *dpy)
{
struct _XCVList *cvl;
@@ -452,8 +449,8 @@ static void _XFreeDisplayLock(dpy)
* wait for thread with user-level display lock to release it.
*/
-static void _XDisplayLockWait(dpy)
- Display *dpy;
+static void _XDisplayLockWait(
+ Display *dpy)
{
xthread_t self;
@@ -471,8 +468,8 @@ static void _XLockDisplay(dpy, file, line)
char *file; /* source file, from macro */
int line;
#else
-static void _XLockDisplay(dpy)
- Display *dpy;
+static void _XLockDisplay(
+ Display *dpy)
#endif
{
#ifdef XTHREADS_WARN
@@ -495,9 +492,9 @@ static void _XInternalLockDisplay(dpy, wskip, file, line)
char *file; /* source file, from macro */
int line;
#else
-static void _XInternalLockDisplay(dpy, wskip)
- Display *dpy;
- Bool wskip;
+static void _XInternalLockDisplay(
+ Display *dpy,
+ Bool wskip)
#endif
{
#ifdef XTHREADS_WARN
@@ -509,13 +506,8 @@ static void _XInternalLockDisplay(dpy, wskip)
_XDisplayLockWait(dpy);
}
-#if NeedFunctionPrototypes
static void _XUserLockDisplay(
register Display* dpy)
-#else
-static void _XUserLockDisplay(dpy)
- register Display* dpy;
-#endif
{
if (++dpy->lock->locking_level == 1) {
dpy->lock->lock_wait = _XDisplayLockWait;
@@ -523,13 +515,9 @@ static void _XUserLockDisplay(dpy)
}
}
-#if NeedFunctionPrototypes
+static
void _XUserUnlockDisplay(
register Display* dpy)
-#else
-void _XUserUnlockDisplay(dpy)
- register Display* dpy;
-#endif
{
if (dpy->lock->locking_level > 0 && --dpy->lock->locking_level == 0) {
/* signal other threads that might be waiting in XLockDisplay */
@@ -542,8 +530,8 @@ void _XUserUnlockDisplay(dpy)
/* returns 0 if initialized ok, -1 if unable to allocate
a mutex or other memory */
-static int _XInitDisplayLock(dpy)
- Display *dpy;
+static int _XInitDisplayLock(
+ Display *dpy)
{
dpy->lock_fns = (struct _XLockPtrs*)Xmalloc(sizeof(struct _XLockPtrs));
if (dpy->lock_fns == NULL)
diff --git a/src/locking.h b/src/locking.h
index 2b3afd32..96c99b97 100644
--- a/src/locking.h
+++ b/src/locking.h
@@ -24,6 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/locking.h,v 1.4 2001/12/14 19:54:10 dawes Exp $ */
/*
* Author: Stephen Gildea, MIT X Consortium
@@ -46,9 +47,7 @@ struct _XCVList {
};
extern xthread_t (*_Xthread_self_fn)( /* in XlibInt.c */
-#if NeedFunctionPrototypes
void
-#endif
);
/* Display->lock is a pointer to one of these */
@@ -73,77 +72,57 @@ struct _XLockInfo {
struct _XCVList *free_cvls;
/* used only in XlibInt.c */
void (*pop_reader)(
-#if NeedNestedPrototypes
Display* /* dpy */,
struct _XCVList** /* list */,
struct _XCVList*** /* tail */
-#endif
);
struct _XCVList *(*push_reader)(
-#if NeedNestedPrototypes
Display * /* dpy */,
struct _XCVList*** /* tail */
-#endif
);
void (*condition_wait)(
-#if NeedNestedPrototypes
xcondition_t /* cv */,
xmutex_t /* mutex */
#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
, char* /* file */,
int /* line */
#endif
-#endif
);
void (*internal_lock_display)(
-#if NeedNestedPrototypes
Display* /* dpy */,
Bool /* wskip */
#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
, char* /* file */,
int /* line */
#endif
-#endif
);
/* used in XlibInt.c and locking.c */
void (*condition_signal)(
-#if NeedNestedPrototypes
xcondition_t /* cv */
#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
, char* /* file */,
int /* line */
#endif
-#endif
);
void (*condition_broadcast)(
-#if NeedNestedPrototypes
xcondition_t /* cv */
#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE)
, char* /* file */,
int /* line */
#endif
-#endif
);
/* used in XlibInt.c and XLockDis.c */
void (*lock_wait)(
-#if NeedNestedPrototypes
Display* /* dpy */
-#endif
);
void (*user_lock_display)(
-#if NeedNestedPrototypes
Display* /* dpy */
-#endif
);
void (*user_unlock_display)(
-#if NeedNestedPrototypes
Display* /* dpy */
-#endif
);
struct _XCVList *(*create_cvl)(
-#if NeedNestedPrototypes
Display * /* dpy */
-#endif
);
};
@@ -170,4 +149,8 @@ typedef struct _LockInfoRec {
xmutex_t lock;
} LockInfoRec;
+/* XOpenDis.c */
+extern int (*_XInitDisplayLock_fn)(Display *dpy);
+extern void (*_XFreeDisplayLock_fn)(Display *dpy);
+
#endif /* _X_locking_H_ */
diff --git a/src/os2Stubs.c b/src/os2Stubs.c
index 6e3c4655..4fa953cf 100644
--- a/src/os2Stubs.c
+++ b/src/os2Stubs.c
@@ -28,7 +28,7 @@
*
*/
-/* $XFree86: xc/lib/X11/os2Stubs.c,v 3.1 2002/05/31 18:45:42 dawes Exp $ */
+/* $XFree86: xc/lib/X11/os2Stubs.c,v 3.0 1996/05/13 06:37:17 dawes Exp $ */
/* A few OS/2 functions needed in the X11 lib. Mainly, the file path redirection
* functions and the "optimized" select() for the clients */
diff --git a/src/udcInf.c b/src/udcInf.c
index c1392bed..b2a01727 100644
--- a/src/udcInf.c
+++ b/src/udcInf.c
@@ -32,6 +32,9 @@ from The Open Group.
* Modifier: Takanori Tateno FUJITSU LIMITED
*
*/
+
+/* $XFree86: xc/lib/X11/udcInf.c,v 1.6 2001/01/17 19:41:57 dawes Exp $ */
+
#include <stdio.h>
#include <locale.h>
#include <Xlib.h>
@@ -386,14 +389,15 @@ XlcCharSet charset;
char *src;
int size;
{
- int name_len,seq_len,i;
+ int name_len,seq_len,rest_len,i;
name_len = 2 + strlen(charset->encoding_name) + 1;
seq_len = strlen(charset->ct_sequence);
- if (name_len + seq_len + strlen(src) >= size)
+ rest_len = strlen(charset->encoding_name) + 1 + strlen(src);
+ if (name_len + seq_len + strlen(src) >= size || rest_len >= 0x4000)
return False;
strcpy(from,charset->ct_sequence);
- from[seq_len] = name_len / 128 + 128;
- from[seq_len+1] = name_len % 128 + 128;
+ from[seq_len] = (rest_len >> 7) + 128;
+ from[seq_len+1] = (rest_len & 0x7f) + 128;
strcpy(&from[seq_len + 2],charset->encoding_name);
from[seq_len+name_len-1] = 0x02; /* STX */
strcpy(&from[seq_len + name_len],src);
@@ -415,7 +419,7 @@ unsigned long *codepoint;
unsigned long from32[25];
unsigned long to32[25];
int i,j;
- char tmp[256],charsetname[256],src[10];
+ char charsetname[256],src[10];
XlcConv conv;
XlcCharSet charset;
XPointer args[2];
@@ -652,7 +656,7 @@ int *num_gi;
unsigned int from32[25];
unsigned int to32[25];
int i,j;
- char tmp[256],charsetname[256],src[10];
+ char charsetname[256],src[10];
XlcConv conv;
XlcCharSet charset;
XPointer args[2];
diff --git a/src/util/makekeys.c b/src/util/makekeys.c
index 24272bfb..768f5e8b 100644
--- a/src/util/makekeys.c
+++ b/src/util/makekeys.c
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/lib/X11/util/makekeys.c,v 3.6 2001/07/25 15:04:48 dawes Exp $ */
/* Constructs hash tables for XStringToKeysym and XKeysymToString. */
@@ -33,12 +34,7 @@ from The Open Group.
#include <X11/Xos.h>
#include <X11/keysymdef.h>
#include <stdio.h>
-
-#ifndef X_NOT_STDC_ENV
#include <stdlib.h>
-#else
-char *malloc();
-#endif
#if defined(macII) && !defined(__STDC__) /* stdlib.h fails to define these */
char *malloc();
#endif /* macII */
@@ -61,7 +57,8 @@ unsigned short indexes[KTNUM];
KeySym values[KTNUM];
char buf[1024];
-main()
+int
+main(int argc, char *argv[])
{
int ksnum;
int max_rehash;
@@ -144,7 +141,7 @@ next1: ;
z = best_z;
printf("#ifdef NEEDKTABLE\n");
- printf("Const unsigned char _XkeyTable[] = {\n");
+ printf("const unsigned char _XkeyTable[] = {\n");
printf("0,\n");
k = 1;
for (i = 0; i < ksnum; i++) {
@@ -161,7 +158,7 @@ next1: ;
offsets[j] = k;
indexes[i] = k;
val = info[i].val;
- printf("0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x, ",
+ printf("0x%.2lx, 0x%.2lx, 0x%.2lx, 0x%.2lx, ",
(sig >> 8) & 0xff, sig & 0xff,
(val >> 8) & 0xff, val & 0xff);
for (name = info[i].name, k += 5; (c = *name++); k++)
@@ -173,7 +170,7 @@ next1: ;
printf("#define KTABLESIZE %d\n", z);
printf("#define KMAXHASH %d\n", best_max_rehash + 1);
printf("\n");
- printf("static Const unsigned short hashString[KTABLESIZE] = {\n");
+ printf("static const unsigned short hashString[KTABLESIZE] = {\n");
for (i = 0; i < z;) {
printf("0x%.4x", offsets[i]);
i++;
@@ -243,7 +240,7 @@ skip2: ;
printf("#define VTABLESIZE %d\n", z);
printf("#define VMAXHASH %d\n", best_max_rehash + 1);
printf("\n");
- printf("static Const unsigned short hashKeysym[VTABLESIZE] = {\n");
+ printf("static const unsigned short hashKeysym[VTABLESIZE] = {\n");
for (i = 0; i < z;) {
printf("0x%.4x", offsets[i]);
i++;
diff --git a/src/xcms/AddDIC.c b/src/xcms/AddDIC.c
index aefae0f8..22364bec 100644
--- a/src/xcms/AddDIC.c
+++ b/src/xcms/AddDIC.c
@@ -32,9 +32,11 @@
*
*
*/
+/* $XFree86$ */
#include "Xlibint.h"
#include "Xcmsint.h"
+#include "Cv.h"
/*
@@ -44,15 +46,6 @@
(XCMS_UNREG_ID(lastid) ? ++lastid : XCMS_FIRST_UNREG_DI_ID)
#define MAX(x,y) ((x) < (y) ? (y) : (x))
-
-/*
- * EXTERNS
- */
-extern XcmsPerDpyInfo *_XcmsFindDpyInfo();
-extern XPointer *_XcmsPushPointerArray();
-extern XcmsColorFormat _XcmsRegFormatOfPrefix();
-extern XcmsColorSpace **_XcmsDIColorSpaces;
-extern XcmsColorSpace *_XcmsDIColorSpacesInit[];
/*
* NAME
diff --git a/src/xcms/AddSF.c b/src/xcms/AddSF.c
index 5c2ae54d..39601c2b 100644
--- a/src/xcms/AddSF.c
+++ b/src/xcms/AddSF.c
@@ -32,9 +32,11 @@
*
*
*/
+/* $XFree86$ */
#include "Xlibint.h"
#include "Xcmsint.h"
+#include "Cv.h"
/*
* DEFINES
@@ -43,18 +45,6 @@
(XCMS_UNREG_ID(lastid) ? ++lastid : XCMS_FIRST_UNREG_DD_ID)
#define MIN(x,y) ((x) > (y) ? (y) : (x))
-
-/*
- * EXTERNS
- */
-extern XPointer *_XcmsPushPointerArray();
-extern XcmsColorFormat _XcmsRegFormatOfPrefix();
-extern XcmsFunctionSet **_XcmsSCCFuncSets;
-extern XcmsFunctionSet **_XcmsSCCFuncSetsInit;
-extern XcmsColorSpace **_XcmsDDColorSpaces;
-extern XcmsColorSpace **_XcmsDDColorSpacesInit;
-
-
/*
* NAME
diff --git a/src/xcms/CCC.c b/src/xcms/CCC.c
index 9a7d5162..20cd3840 100644
--- a/src/xcms/CCC.c
+++ b/src/xcms/CCC.c
@@ -33,6 +33,7 @@
*
*
*/
+/* $XFree86: xc/lib/X11/CCC.c,v 1.4 2001/12/14 19:53:56 dawes Exp $ */
/*
@@ -65,8 +66,7 @@ from The Open Group.
#include <stdio.h>
#include "Xlibint.h"
#include "Xcmsint.h"
-
-extern XcmsIntensityMap *_XcmsGetIntensityMap();
+#include "Cv.h"
diff --git a/src/xcms/Cv.h b/src/xcms/Cv.h
index 08969e03..a887e9d2 100644
--- a/src/xcms/Cv.h
+++ b/src/xcms/Cv.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/Cv.h,v 1.2 2003/04/17 02:06:31 dawes Exp $ */
+/* $XFree86: xc/lib/X11/Cv.h,v 1.1 2003/04/13 19:22:15 dawes Exp $ */
#ifndef _CV_H_
#define _CV_H_
diff --git a/src/xcms/CvColW.c b/src/xcms/CvColW.c
index 249e30e5..336f606e 100644
--- a/src/xcms/CvColW.c
+++ b/src/xcms/CvColW.c
@@ -33,9 +33,11 @@
*
*
*/
+/* $XFree86: xc/lib/X11/CvColW.c,v 1.3 2001/01/17 19:41:34 dawes Exp $ */
#include "Xlibint.h"
#include "Xcmsint.h"
+#include "Cv.h"
/************************************************************************
@@ -52,14 +54,13 @@
* SYNOPSIS
*/
Status
-_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePt, nColors,
- newFormat, pCompressed)
- XcmsCCC ccc;
- XcmsColor *pColors_in_out;
- XcmsColor *pWhitePt;
- unsigned int nColors;
- XcmsColorFormat newFormat;
- Bool *pCompressed;
+_XcmsConvertColorsWithWhitePt(
+ XcmsCCC ccc,
+ XcmsColor *pColors_in_out,
+ XcmsColor *pWhitePt,
+ unsigned int nColors,
+ XcmsColorFormat newFormat,
+ Bool *pCompressed)
/*
* DESCRIPTION
* Convert XcmsColor structures between device-independent
diff --git a/src/xcms/CvCols.c b/src/xcms/CvCols.c
index d74ea323..6cd805b9 100644
--- a/src/xcms/CvCols.c
+++ b/src/xcms/CvCols.c
@@ -33,19 +33,11 @@
*
*
*/
+/* $XFree86: xc/lib/X11/CvCols.c,v 1.4 2003/04/13 19:22:15 dawes Exp $ */
#include "Xlibint.h"
#include "Xcmsint.h"
-
-/*
- * EXTERNS
- * External declarations required locally to this package
- * that are not already declared in any of the included header
- * files (external includes or internal includes).
- */
-extern XcmsRegColorSpaceEntry _XcmsRegColorSpaces[];
-extern XcmsColorSpace **_XcmsDIColorSpaces;
-extern XcmsColorSpace **_XcmsDDColorSpaces;
+#include "Cv.h"
/*
* LOCAL DEFINES
@@ -57,12 +49,6 @@ extern XcmsColorSpace **_XcmsDDColorSpaces;
# define MAX(x,y) ((x) > (y) ? (x) : (y))
#endif
-/*
- * FORWARD DECLARATIONS
- */
-Status _XcmsDIConvertColors();
-Status _XcmsDDConvertColors();
-
/************************************************************************
* *
@@ -77,8 +63,8 @@ Status _XcmsDDConvertColors();
* SYNOPSIS
*/
static int
-EqualCIEXYZ(p1, p2)
- XcmsColor *p1, *p2;
+EqualCIEXYZ(
+ XcmsColor *p1, XcmsColor *p2)
/*
* DESCRIPTION
* Compares two XcmsColor structures that are in XcmsCIEXYZFormat
@@ -107,9 +93,9 @@ EqualCIEXYZ(p1, p2)
* SYNOPSIS
*/
static XcmsColorSpace *
-ColorSpaceOfID(ccc, id)
- XcmsCCC ccc;
- XcmsColorFormat id;
+ColorSpaceOfID(
+ XcmsCCC ccc,
+ XcmsColorFormat id)
/*
* DESCRIPTION
* Returns a pointer to the color space structure
@@ -164,8 +150,8 @@ ColorSpaceOfID(ccc, id)
* SYNOPSIS
*/
static int
-ValidDIColorSpaceID(id)
- XcmsColorFormat id;
+ValidDIColorSpaceID(
+ XcmsColorFormat id)
/*
* DESCRIPTION
* Determines if the specified color space ID is a valid
@@ -197,9 +183,9 @@ ValidDIColorSpaceID(id)
* SYNOPSIS
*/
static int
-ValidDDColorSpaceID(ccc, id)
- XcmsCCC ccc;
- XcmsColorFormat id;
+ValidDDColorSpaceID(
+ XcmsCCC ccc,
+ XcmsColorFormat id)
/*
* DESCRIPTION
* Determines if the specified color space ID is a valid
@@ -232,14 +218,13 @@ ValidDDColorSpaceID(ccc, id)
* SYNOPSIS
*/
static Status
-ConvertMixedColors(ccc, pColors_in_out, pWhitePt, nColors,
- targetFormat, format_flag)
- XcmsCCC ccc;
- XcmsColor *pColors_in_out;
- XcmsColor *pWhitePt;
- unsigned int nColors;
- XcmsColorFormat targetFormat;
- unsigned char format_flag;
+ConvertMixedColors(
+ XcmsCCC ccc,
+ XcmsColor *pColors_in_out,
+ XcmsColor *pWhitePt,
+ unsigned int nColors,
+ XcmsColorFormat targetFormat,
+ unsigned char format_flag)
/*
* DESCRIPTION
* This routine will only convert the following types of
@@ -374,9 +359,7 @@ ConvertMixedColors(ccc, pColors_in_out, pWhitePt, nColors,
* SYNOPSIS
*/
int
-_XcmsEqualWhitePts(ccc, pWhitePt1, pWhitePt2)
- XcmsCCC ccc;
- XcmsColor *pWhitePt1, *pWhitePt2;
+_XcmsEqualWhitePts(XcmsCCC ccc, XcmsColor *pWhitePt1, XcmsColor *pWhitePt2)
/*
* DESCRIPTION
*
@@ -415,13 +398,12 @@ _XcmsEqualWhitePts(ccc, pWhitePt1, pWhitePt2)
* SYNOPSIS
*/
Status
-_XcmsDIConvertColors(ccc, pColors_in_out, pWhitePt, nColors,
- newFormat)
- XcmsCCC ccc;
- XcmsColor *pColors_in_out;
- XcmsColor *pWhitePt;
- unsigned int nColors;
- XcmsColorFormat newFormat;
+_XcmsDIConvertColors(
+ XcmsCCC ccc,
+ XcmsColor *pColors_in_out,
+ XcmsColor *pWhitePt,
+ unsigned int nColors,
+ XcmsColorFormat newFormat)
/*
* DESCRIPTION
* Convert XcmsColor structures to another Device-Independent
@@ -445,10 +427,10 @@ _XcmsDIConvertColors(ccc, pColors_in_out, pWhitePt, nColors,
*/
{
XcmsColorSpace *pFrom, *pTo;
- XcmsConversionProc *src_to_CIEXYZ, *src_from_CIEXYZ;
- XcmsConversionProc *dest_to_CIEXYZ, *dest_from_CIEXYZ;
- XcmsConversionProc *to_CIEXYZ_stop, *from_CIEXYZ_start;
- XcmsConversionProc *tmp;
+ XcmsDIConversionProc *src_to_CIEXYZ, *src_from_CIEXYZ;
+ XcmsDIConversionProc *dest_to_CIEXYZ, *dest_from_CIEXYZ;
+ XcmsDIConversionProc *to_CIEXYZ_stop, *from_CIEXYZ_start;
+ XcmsDIConversionProc *tmp;
/*
* Allow pWhitePt to equal NULL. This appropriate when converting
@@ -560,13 +542,12 @@ Continue:
* SYNOPSIS
*/
Status
-_XcmsDDConvertColors(ccc, pColors_in_out, nColors, newFormat,
- pCompressed)
- XcmsCCC ccc;
- XcmsColor *pColors_in_out;
- unsigned int nColors;
- XcmsColorFormat newFormat;
- Bool *pCompressed;
+_XcmsDDConvertColors(
+ XcmsCCC ccc,
+ XcmsColor *pColors_in_out,
+ unsigned int nColors,
+ XcmsColorFormat newFormat,
+ Bool *pCompressed)
/*
* DESCRIPTION
* Convert XcmsColor structures:
@@ -597,10 +578,10 @@ _XcmsDDConvertColors(ccc, pColors_in_out, nColors, newFormat,
*/
{
XcmsColorSpace *pFrom, *pTo;
- XcmsConversionProc *src_to_CIEXYZ, *src_from_CIEXYZ;
- XcmsConversionProc *dest_to_CIEXYZ, *dest_from_CIEXYZ;
- XcmsConversionProc *from_CIEXYZ_start, *to_CIEXYZ_stop;
- XcmsConversionProc *tmp;
+ XcmsDDConversionProc *src_to_CIEXYZ, *src_from_CIEXYZ;
+ XcmsDDConversionProc *dest_to_CIEXYZ, *dest_from_CIEXYZ;
+ XcmsDDConversionProc *from_CIEXYZ_start, *to_CIEXYZ_stop;
+ XcmsDDConversionProc *tmp;
int retval;
int hasCompressed = 0;
@@ -640,10 +621,10 @@ _XcmsDDConvertColors(ccc, pColors_in_out, nColors, newFormat,
return(XcmsFailure);
}
- src_to_CIEXYZ = pFrom->to_CIEXYZ;
- src_from_CIEXYZ = pFrom->from_CIEXYZ;
- dest_to_CIEXYZ = pTo->to_CIEXYZ;
- dest_from_CIEXYZ = pTo->from_CIEXYZ;
+ src_to_CIEXYZ = (XcmsDDConversionProc *)pFrom->to_CIEXYZ;
+ src_from_CIEXYZ = (XcmsDDConversionProc *)pFrom->from_CIEXYZ;
+ dest_to_CIEXYZ = (XcmsDDConversionProc *)pTo->to_CIEXYZ;
+ dest_from_CIEXYZ = (XcmsDDConversionProc *)pTo->from_CIEXYZ;
if (pTo->inverse_flag && pFrom->inverse_flag) {
/*
@@ -1024,8 +1005,8 @@ Failure:
* SYNOPSIS
*/
XcmsColorFormat
-_XcmsRegFormatOfPrefix(prefix)
- char *prefix;
+_XcmsRegFormatOfPrefix(
+ _Xconst char *prefix)
/*
* DESCRIPTION
* Returns a color space ID associated with the specified
diff --git a/src/xcms/HVC.c b/src/xcms/HVC.c
index 26bca265..bc08867e 100644
--- a/src/xcms/HVC.c
+++ b/src/xcms/HVC.c
@@ -1,3 +1,4 @@
+/* $XdotOrg: lib/X11/src/xcms/HVC.c,v 1.2 2004-04-23 18:43:24 eich Exp $ */
/* $Xorg: HVC.c,v 1.3 2000/08/17 19:44:36 cpqbld Exp $ */
/*
@@ -47,11 +48,15 @@
* DOCUMENTATION
* "TekColor Color Management System, System Implementor's Manual"
*/
+/* $XFree86: xc/lib/X11/HVC.c,v 1.3 2001/01/17 19:41:37 dawes Exp $ */
#include "Xlibint.h"
#include "Xcmsint.h"
#include <X11/Xos.h>
#include <math.h>
+#include "Cv.h"
+
+#include <stdio.h>
/*
* DEFINES
@@ -90,18 +95,10 @@
#endif
/*
- * EXTERNS
- */
-
-extern char _XcmsTekHVC_prefix[];
-
-/*
* FORWARD DECLARATIONS
*/
-
-static int TekHVC_ParseString();
-static Status XcmsTekHVC_ValidSpec();
-
+static int TekHVC_ParseString(register char *spec, XcmsColor *pColor);
+static Status XcmsTekHVC_ValidSpec(XcmsColor *pColor);
/*
* LOCAL VARIABLES
@@ -158,9 +155,9 @@ XcmsColorSpace XcmsTekHVCColorSpace =
* SYNOPSIS
*/
static int
-TekHVC_ParseString(spec, pColor)
- register char *spec;
- XcmsColor *pColor;
+TekHVC_ParseString(
+ register char *spec,
+ XcmsColor *pColor)
/*
* DESCRIPTION
* This routines takes a string and attempts to convert
@@ -216,9 +213,9 @@ TekHVC_ParseString(spec, pColor)
* SYNOPSIS
*/
static int
-ThetaOffset(pWhitePt, pThetaOffset)
- XcmsColor *pWhitePt;
- XcmsFloat *pThetaOffset;
+ThetaOffset(
+ XcmsColor *pWhitePt,
+ XcmsFloat *pThetaOffset)
/*
* DESCRIPTION
* This routine computes the theta offset of a given
@@ -265,8 +262,8 @@ ThetaOffset(pWhitePt, pThetaOffset)
* SYNOPSIS
*/
static int
-XcmsTekHVC_ValidSpec(pColor)
- XcmsColor *pColor;
+XcmsTekHVC_ValidSpec(
+ XcmsColor *pColor)
/*
* DESCRIPTION
* Checks if values in the color specification are valid.
@@ -567,8 +564,8 @@ XcmsCIEuvYToTekHVC(ccc, pHVC_WhitePt, pColors_in_out, nColors)
* SYNOPSIS
*/
int
-_XcmsTekHVC_CheckModify(pColor)
- XcmsColor *pColor;
+_XcmsTekHVC_CheckModify(
+ XcmsColor *pColor)
/*
* DESCRIPTION
* Checks if values in the color specification are valid.
diff --git a/src/xcms/HVCGcC.c b/src/xcms/HVCGcC.c
index 26a3f121..dc78bfec 100644
--- a/src/xcms/HVCGcC.c
+++ b/src/xcms/HVCGcC.c
@@ -43,16 +43,11 @@
* Source for XcmsTekHVCClipC() gamut compression routine.
*
*/
+/* $XFree86: xc/lib/X11/HVCGcC.c,v 1.3 2001/01/17 19:41:37 dawes Exp $ */
#include "Xlibint.h"
#include "Xcmsint.h"
-
-/*
- * EXTERNS
- */
-extern XcmsColorSpace XcmsTekHVCColorSpace;
-extern XcmsFunctionSet XcmsLinearRGBFunctionSet;
-
+#include "Cv.h"
/************************************************************************
diff --git a/src/xcms/HVCGcV.c b/src/xcms/HVCGcV.c
index 7b062123..6b9f92b8 100644
--- a/src/xcms/HVCGcV.c
+++ b/src/xcms/HVCGcV.c
@@ -43,17 +43,11 @@
* Source for XcmsTekHVCClipV() gamut compression routine.
*
*/
+/* $XFree86: xc/lib/X11/HVCGcV.c,v 1.3 2001/01/17 19:41:37 dawes Exp $ */
#include "Xlibint.h"
#include "Xcmsint.h"
-
-/*
- * EXTERNS
- */
-extern Status _XcmsTekHVC_CheckModify();
-extern XcmsColorSpace XcmsTekHVCColorSpace;
-extern XcmsFunctionSet XcmsLinearRGBFunctionSet;
-
+#include "Cv.h"
/************************************************************************
diff --git a/src/xcms/HVCGcVC.c b/src/xcms/HVCGcVC.c
index 00d09b2a..1286a20e 100644
--- a/src/xcms/HVCGcVC.c
+++ b/src/xcms/HVCGcVC.c
@@ -43,10 +43,12 @@
* Source for XcmsTekHVCClipVC() gamut
* compression function.
*/
+/* $XFree86: xc/lib/X11/HVCGcVC.c,v 1.3 2001/01/17 19:41:37 dawes Exp $ */
#include "Xlibint.h"
#include "Xcmsint.h"
#include <math.h>
+#include "Cv.h"
/*
* INTERNALS
@@ -55,14 +57,6 @@
*/
#define MAXBISECTCOUNT 100
-/*
- * EXTERNS
- */
-extern int _XcmsTekHVC_CheckModify();
-extern Status _XcmsTekHVCQueryMaxVCRGB();
-extern XcmsColorSpace XcmsTekHVCColorSpace;
-extern XcmsFunctionSet XcmsLinearRGBFunctionSet;
-
/************************************************************************
* *
diff --git a/src/xcms/HVCMnV.c b/src/xcms/HVCMnV.c
index f66e0e1c..c730d088 100644
--- a/src/xcms/HVCMnV.c
+++ b/src/xcms/HVCMnV.c
@@ -43,22 +43,17 @@
* Source for XcmsTekHVCQueryMinV gamut boundary querying routine.
*
*/
+/* $XFree86$ */
#include "Xlibint.h"
#include "Xcmsint.h"
+#include "Cv.h"
/*
* DEFINES
*/
#define EPS 0.001
-/*
- * EXTERNS
- */
-extern Status _XcmsTekHVCQueryMaxVCRGB();
-extern Status _XcmsTekHVC_CheckModify();
-extern XcmsColorSpace XcmsTekHVCColorSpace;
-
/************************************************************************
* *
diff --git a/src/xcms/HVCMxC.c b/src/xcms/HVCMxC.c
index e7e316fe..636e6d39 100644
--- a/src/xcms/HVCMxC.c
+++ b/src/xcms/HVCMxC.c
@@ -44,10 +44,12 @@
* querying routine.
*
*/
+/* $XFree86: xc/lib/X11/HVCMxC.c,v 1.4 2003/04/13 19:22:16 dawes Exp $ */
#include "Xlibint.h"
#include "Xcmsint.h"
#include <math.h>
+#include "Cv.h"
/*
* DEFINES
@@ -55,14 +57,6 @@
#define MAXBISECTCOUNT 100
#define EPS 0.001
-/*
- * EXTERNS
- */
-extern Status _XcmsTekHVCQueryMaxVCRGB();
-extern int _XcmsTekHVC_CheckModify();
-extern XcmsColorSpace XcmsTekHVCColorSpace;
-
-
/************************************************************************
* *
@@ -163,6 +157,7 @@ XcmsTekHVCQueryMaxC(ccc, hue, value, pColor_return)
/* save the structure input so that any elements that */
/* are not touched are recopied later in the routine. */
nValue = savedValue = value;
+ lastChroma = -1.0;
lastValue = -1.0;
nMaxCount = MAXBISECTCOUNT;
maxDist = 100.0 - max_vc.spec.TekHVC.V;
diff --git a/src/xcms/HVCMxV.c b/src/xcms/HVCMxV.c
index b1e70094..331651f1 100644
--- a/src/xcms/HVCMxV.c
+++ b/src/xcms/HVCMxV.c
@@ -44,10 +44,12 @@
* querying routine.
*
*/
+/* $XFree86: xc/lib/X11/HVCMxV.c,v 1.4 2003/04/13 19:22:16 dawes Exp $ */
#include "Xlibint.h"
#include "Xcmsint.h"
#include <math.h>
+#include "Cv.h"
/*
* DEFINES
@@ -55,13 +57,6 @@
#define MAXBISECTCOUNT 100
#define EPS 0.001
-/*
- * EXTERNS
- */
-extern Status _XcmsTekHVCQueryMaxVCRGB();
-extern int _XcmsTekHVC_CheckModify();
-extern XcmsColorSpace XcmsTekHVCColorSpace;
-
/************************************************************************
* *
@@ -173,6 +168,7 @@ XcmsTekHVCQueryMaxV(ccc, hue, chroma, pColor_return)
tmp.spec.TekHVC.C = max_vc.spec.TekHVC.C;
tmp.spec.TekHVC.V = max_vc.spec.TekHVC.V;
lastChroma = -1.0;
+ lastValue = -1.0;
nMaxCount = MAXBISECTCOUNT;
rFactor = 1.0;
diff --git a/src/xcms/HVCMxVC.c b/src/xcms/HVCMxVC.c
index 7c8ec7d0..18060dba 100644
--- a/src/xcms/HVCMxVC.c
+++ b/src/xcms/HVCMxVC.c
@@ -44,9 +44,11 @@
* querying routine.
*
*/
+/* $XFree86$ */
#include "Xlibint.h"
#include "Xcmsint.h"
+#include "Cv.h"
/*
* DEFINES
@@ -58,18 +60,6 @@
#define START_V 40.0
#define START_C 120.0
-/*
- * EXTERNS
- */
-extern Status _XcmsTekHVC_CheckModify();
-extern Status _XcmsConvertColorsWithWhitePt();
-extern XcmsColorSpace XcmsTekHVCColorSpace;
-
-/*
- * FORWARD DECLARATIONS
- */
-Status _XcmsTekHVCQueryMaxVCRGB();
-
/************************************************************************
* *
@@ -84,11 +74,11 @@ Status _XcmsTekHVCQueryMaxVCRGB();
* SYNOPSIS
*/
Status
-_XcmsTekHVCQueryMaxVCRGB(ccc, hue, pColor_return, pRGB_return)
- XcmsCCC ccc;
- XcmsFloat hue;
- XcmsColor *pColor_return;
- XcmsRGBi *pRGB_return;
+_XcmsTekHVCQueryMaxVCRGB(
+ XcmsCCC ccc,
+ XcmsFloat hue,
+ XcmsColor *pColor_return,
+ XcmsRGBi *pRGB_return)
/*
* DESCRIPTION
diff --git a/src/xcms/HVCMxVs.c b/src/xcms/HVCMxVs.c
index 33f84b61..cb843108 100644
--- a/src/xcms/HVCMxVs.c
+++ b/src/xcms/HVCMxVs.c
@@ -43,17 +43,11 @@
* Source for the XcmsTekHVCQueryMaxVSamples() gamut boundary
* querying routine.
*/
+/* $XFree86: xc/lib/X11/HVCMxVs.c,v 1.3 2001/01/17 19:41:37 dawes Exp $ */
#include "Xlibint.h"
#include "Xcmsint.h"
-
-/*
- * EXTERNS
- */
-extern Status _XcmsTekHVCQueryMaxVCRGB();
-extern Status _XcmsTekHVC_CheckModify();
-extern XcmsColorSpace XcmsTekHVCColorSpace;
-
+#include "Cv.h"
/************************************************************************
diff --git a/src/xcms/HVCWpAj.c b/src/xcms/HVCWpAj.c
index 76e64c05..c61ccbd8 100644
--- a/src/xcms/HVCWpAj.c
+++ b/src/xcms/HVCWpAj.c
@@ -44,15 +44,11 @@
* adjustment of color specifications in the TekHVC color
* space.
*/
+/* $XFree86$ */
#include "Xlibint.h"
#include "Xcmsint.h"
-
-/*
- * EXTERNS
- */
-extern Status _XcmsConvertColorsWithWhitePt();
-extern XcmsColorSpace XcmsTekHVCColorSpace;
+#include "Cv.h"
/************************************************************************
diff --git a/src/xcms/IdOfPr.c b/src/xcms/IdOfPr.c
index d84986eb..99173afa 100644
--- a/src/xcms/IdOfPr.c
+++ b/src/xcms/IdOfPr.c
@@ -32,16 +32,11 @@
*
*
*/
+/* $XFree86$ */
#include "Xlibint.h"
#include "Xcmsint.h"
-
-/*
- * EXTERNS
- */
-extern XcmsColorSpace **_XcmsDIColorSpaces;
-extern XcmsColorSpace **_XcmsDDColorSpaces;
-void _XcmsCopyISOLatin1Lowered();
+#include "Cv.h"
/*
diff --git a/src/xcms/LRGB.c b/src/xcms/LRGB.c
index 5b8b8068..6f8c6fb7 100644
--- a/src/xcms/LRGB.c
+++ b/src/xcms/LRGB.c
@@ -35,30 +35,14 @@
* 4. RGB intensity to CIE XYZ
*
*/
+/* $XFree86: xc/lib/X11/LRGB.c,v 3.6 2003/04/13 19:22:16 dawes Exp $ */
#include <stdio.h>
#include <X11/Xos.h>
#include <X11/Xatom.h>
#include "Xlibint.h"
#include "Xcmsint.h"
-
-#ifdef __STDC__
-#define Const const
-#else
-#define Const /**/
-#endif
-
-/*
- * EXTERNS
- * External declarations required locally to this package
- * that are not already declared in any of the included header
- * files (external includes or internal includes).
- */
-extern char _XcmsRGB_prefix[];
-extern char _XcmsRGBi_prefix[];
-extern unsigned long _XcmsGetElement();
-extern void _XcmsFreeIntensityMaps();
-
+#include "Cv.h"
/*
* LOCAL DEFINES
@@ -87,12 +71,23 @@ extern void _XcmsFreeIntensityMaps();
/*
* FORWARD DECLARATIONS
*/
-static void LINEAR_RGB_FreeSCCData();
-static int LINEAR_RGB_InitSCCData();
-static int XcmsLRGB_RGB_ParseString();
-static int XcmsLRGB_RGBi_ParseString();
-Status _XcmsGetTableType0();
-Status _XcmsGetTableType1();
+static void LINEAR_RGB_FreeSCCData(XPointer pScreenDataTemp);
+static int LINEAR_RGB_InitSCCData(Display *dpy,
+ int screenNumber, XcmsPerScrnInfo *pPerScrnInfo);
+static int XcmsLRGB_RGB_ParseString(register char *spec, XcmsColor *pColor);
+static int XcmsLRGB_RGBi_ParseString(register char *spec, XcmsColor *pColor);
+static Status
+_XcmsGetTableType0(
+ IntensityTbl *pTbl,
+ int format,
+ char **pChar,
+ unsigned long *pCount);
+static Status
+_XcmsGetTableType1(
+ IntensityTbl *pTbl,
+ int format,
+ char **pChar,
+ unsigned long *pCount);
/*
* LOCALS VARIABLES
@@ -101,7 +96,7 @@ Status _XcmsGetTableType1();
* static int ExampleLocalVar;
*/
-static unsigned short Const MASK[17] = {
+static unsigned short const MASK[17] = {
0x0000, /* 0 bitsPerRGB */
0x8000, /* 1 bitsPerRGB */
0xc000, /* 2 bitsPerRGB */
@@ -128,8 +123,8 @@ static unsigned short Const MASK[17] = {
* to XcmsCIEXYZFormat.
*/
static XcmsConversionProc Fl_RGB_to_CIEXYZ[] = {
- XcmsRGBToRGBi,
- XcmsRGBiToCIEXYZ,
+ (XcmsConversionProc)XcmsRGBToRGBi,
+ (XcmsConversionProc)XcmsRGBiToCIEXYZ,
NULL
};
@@ -139,8 +134,8 @@ static XcmsConversionProc Fl_RGB_to_CIEXYZ[] = {
* to XcmsRGBFormat.
*/
static XcmsConversionProc Fl_CIEXYZ_to_RGB[] = {
- XcmsCIEXYZToRGBi,
- XcmsRGBiToRGB,
+ (XcmsConversionProc)XcmsCIEXYZToRGBi,
+ (XcmsConversionProc)XcmsRGBiToRGB,
NULL
};
@@ -150,7 +145,7 @@ static XcmsConversionProc Fl_CIEXYZ_to_RGB[] = {
* to XcmsCIEXYZFormat.
*/
static XcmsConversionProc Fl_RGBi_to_CIEXYZ[] = {
- XcmsRGBiToCIEXYZ,
+ (XcmsConversionProc)XcmsRGBiToCIEXYZ,
NULL
};
@@ -160,7 +155,7 @@ static XcmsConversionProc Fl_RGBi_to_CIEXYZ[] = {
* to XcmsRGBiFormat.
*/
static XcmsConversionProc Fl_CIEXYZ_to_RGBi[] = {
- XcmsCIEXYZToRGBi,
+ (XcmsConversionProc)XcmsCIEXYZToRGBi,
NULL
};
@@ -231,169 +226,169 @@ XcmsFunctionSet XcmsLinearRGBFunctionSet =
* MODEL Tek4300, Tek4800
*/
-static IntensityRec Const Default_RGB_RedTuples[] = {
+static IntensityRec const Default_RGB_RedTuples[] = {
/* {unsigned short value, XcmsFloat intensity} */
- 0x0000, 0.000000,
- 0x0909, 0.000000,
- 0x0a0a, 0.000936,
- 0x0f0f, 0.001481,
- 0x1414, 0.002329,
- 0x1919, 0.003529,
- 0x1e1e, 0.005127,
- 0x2323, 0.007169,
- 0x2828, 0.009699,
- 0x2d2d, 0.012759,
- 0x3232, 0.016392,
- 0x3737, 0.020637,
- 0x3c3c, 0.025533,
- 0x4141, 0.031119,
- 0x4646, 0.037431,
- 0x4b4b, 0.044504,
- 0x5050, 0.052373,
- 0x5555, 0.061069,
- 0x5a5a, 0.070624,
- 0x5f5f, 0.081070,
- 0x6464, 0.092433,
- 0x6969, 0.104744,
- 0x6e6e, 0.118026,
- 0x7373, 0.132307,
- 0x7878, 0.147610,
- 0x7d7d, 0.163958,
- 0x8282, 0.181371,
- 0x8787, 0.199871,
- 0x8c8c, 0.219475,
- 0x9191, 0.240202,
- 0x9696, 0.262069,
- 0x9b9b, 0.285089,
- 0xa0a0, 0.309278,
- 0xa5a5, 0.334647,
- 0xaaaa, 0.361208,
- 0xafaf, 0.388971,
- 0xb4b4, 0.417945,
- 0xb9b9, 0.448138,
- 0xbebe, 0.479555,
- 0xc3c3, 0.512202,
- 0xc8c8, 0.546082,
- 0xcdcd, 0.581199,
- 0xd2d2, 0.617552,
- 0xd7d7, 0.655144,
- 0xdcdc, 0.693971,
- 0xe1e1, 0.734031,
- 0xe6e6, 0.775322,
- 0xebeb, 0.817837,
- 0xf0f0, 0.861571,
- 0xf5f5, 0.906515,
- 0xfafa, 0.952662,
- 0xffff, 1.000000
+ { 0x0000, 0.000000 },
+ { 0x0909, 0.000000 },
+ { 0x0a0a, 0.000936 },
+ { 0x0f0f, 0.001481 },
+ { 0x1414, 0.002329 },
+ { 0x1919, 0.003529 },
+ { 0x1e1e, 0.005127 },
+ { 0x2323, 0.007169 },
+ { 0x2828, 0.009699 },
+ { 0x2d2d, 0.012759 },
+ { 0x3232, 0.016392 },
+ { 0x3737, 0.020637 },
+ { 0x3c3c, 0.025533 },
+ { 0x4141, 0.031119 },
+ { 0x4646, 0.037431 },
+ { 0x4b4b, 0.044504 },
+ { 0x5050, 0.052373 },
+ { 0x5555, 0.061069 },
+ { 0x5a5a, 0.070624 },
+ { 0x5f5f, 0.081070 },
+ { 0x6464, 0.092433 },
+ { 0x6969, 0.104744 },
+ { 0x6e6e, 0.118026 },
+ { 0x7373, 0.132307 },
+ { 0x7878, 0.147610 },
+ { 0x7d7d, 0.163958 },
+ { 0x8282, 0.181371 },
+ { 0x8787, 0.199871 },
+ { 0x8c8c, 0.219475 },
+ { 0x9191, 0.240202 },
+ { 0x9696, 0.262069 },
+ { 0x9b9b, 0.285089 },
+ { 0xa0a0, 0.309278 },
+ { 0xa5a5, 0.334647 },
+ { 0xaaaa, 0.361208 },
+ { 0xafaf, 0.388971 },
+ { 0xb4b4, 0.417945 },
+ { 0xb9b9, 0.448138 },
+ { 0xbebe, 0.479555 },
+ { 0xc3c3, 0.512202 },
+ { 0xc8c8, 0.546082 },
+ { 0xcdcd, 0.581199 },
+ { 0xd2d2, 0.617552 },
+ { 0xd7d7, 0.655144 },
+ { 0xdcdc, 0.693971 },
+ { 0xe1e1, 0.734031 },
+ { 0xe6e6, 0.775322 },
+ { 0xebeb, 0.817837 },
+ { 0xf0f0, 0.861571 },
+ { 0xf5f5, 0.906515 },
+ { 0xfafa, 0.952662 },
+ { 0xffff, 1.000000 }
};
-static IntensityRec Const Default_RGB_GreenTuples[] = {
+static IntensityRec const Default_RGB_GreenTuples[] = {
/* {unsigned short value, XcmsFloat intensity} */
- 0x0000, 0.000000,
- 0x1313, 0.000000,
- 0x1414, 0.000832,
- 0x1919, 0.001998,
- 0x1e1e, 0.003612,
- 0x2323, 0.005736,
- 0x2828, 0.008428,
- 0x2d2d, 0.011745,
- 0x3232, 0.015740,
- 0x3737, 0.020463,
- 0x3c3c, 0.025960,
- 0x4141, 0.032275,
- 0x4646, 0.039449,
- 0x4b4b, 0.047519,
- 0x5050, 0.056520,
- 0x5555, 0.066484,
- 0x5a5a, 0.077439,
- 0x5f5f, 0.089409,
- 0x6464, 0.102418,
- 0x6969, 0.116485,
- 0x6e6e, 0.131625,
- 0x7373, 0.147853,
- 0x7878, 0.165176,
- 0x7d7d, 0.183604,
- 0x8282, 0.203140,
- 0x8787, 0.223783,
- 0x8c8c, 0.245533,
- 0x9191, 0.268384,
- 0x9696, 0.292327,
- 0x9b9b, 0.317351,
- 0xa0a0, 0.343441,
- 0xa5a5, 0.370580,
- 0xaaaa, 0.398747,
- 0xafaf, 0.427919,
- 0xb4b4, 0.458068,
- 0xb9b9, 0.489165,
- 0xbebe, 0.521176,
- 0xc3c3, 0.554067,
- 0xc8c8, 0.587797,
- 0xcdcd, 0.622324,
- 0xd2d2, 0.657604,
- 0xd7d7, 0.693588,
- 0xdcdc, 0.730225,
- 0xe1e1, 0.767459,
- 0xe6e6, 0.805235,
- 0xebeb, 0.843491,
- 0xf0f0, 0.882164,
- 0xf5f5, 0.921187,
- 0xfafa, 0.960490,
- 0xffff, 1.000000
+ { 0x0000, 0.000000 },
+ { 0x1313, 0.000000 },
+ { 0x1414, 0.000832 },
+ { 0x1919, 0.001998 },
+ { 0x1e1e, 0.003612 },
+ { 0x2323, 0.005736 },
+ { 0x2828, 0.008428 },
+ { 0x2d2d, 0.011745 },
+ { 0x3232, 0.015740 },
+ { 0x3737, 0.020463 },
+ { 0x3c3c, 0.025960 },
+ { 0x4141, 0.032275 },
+ { 0x4646, 0.039449 },
+ { 0x4b4b, 0.047519 },
+ { 0x5050, 0.056520 },
+ { 0x5555, 0.066484 },
+ { 0x5a5a, 0.077439 },
+ { 0x5f5f, 0.089409 },
+ { 0x6464, 0.102418 },
+ { 0x6969, 0.116485 },
+ { 0x6e6e, 0.131625 },
+ { 0x7373, 0.147853 },
+ { 0x7878, 0.165176 },
+ { 0x7d7d, 0.183604 },
+ { 0x8282, 0.203140 },
+ { 0x8787, 0.223783 },
+ { 0x8c8c, 0.245533 },
+ { 0x9191, 0.268384 },
+ { 0x9696, 0.292327 },
+ { 0x9b9b, 0.317351 },
+ { 0xa0a0, 0.343441 },
+ { 0xa5a5, 0.370580 },
+ { 0xaaaa, 0.398747 },
+ { 0xafaf, 0.427919 },
+ { 0xb4b4, 0.458068 },
+ { 0xb9b9, 0.489165 },
+ { 0xbebe, 0.521176 },
+ { 0xc3c3, 0.554067 },
+ { 0xc8c8, 0.587797 },
+ { 0xcdcd, 0.622324 },
+ { 0xd2d2, 0.657604 },
+ { 0xd7d7, 0.693588 },
+ { 0xdcdc, 0.730225 },
+ { 0xe1e1, 0.767459 },
+ { 0xe6e6, 0.805235 },
+ { 0xebeb, 0.843491 },
+ { 0xf0f0, 0.882164 },
+ { 0xf5f5, 0.921187 },
+ { 0xfafa, 0.960490 },
+ { 0xffff, 1.000000 }
};
-static IntensityRec Const Default_RGB_BlueTuples[] = {
+static IntensityRec const Default_RGB_BlueTuples[] = {
/* {unsigned short value, XcmsFloat intensity} */
- 0x0000, 0.000000,
- 0x0e0e, 0.000000,
- 0x0f0f, 0.001341,
- 0x1414, 0.002080,
- 0x1919, 0.003188,
- 0x1e1e, 0.004729,
- 0x2323, 0.006766,
- 0x2828, 0.009357,
- 0x2d2d, 0.012559,
- 0x3232, 0.016424,
- 0x3737, 0.021004,
- 0x3c3c, 0.026344,
- 0x4141, 0.032489,
- 0x4646, 0.039481,
- 0x4b4b, 0.047357,
- 0x5050, 0.056154,
- 0x5555, 0.065903,
- 0x5a5a, 0.076634,
- 0x5f5f, 0.088373,
- 0x6464, 0.101145,
- 0x6969, 0.114968,
- 0x6e6e, 0.129862,
- 0x7373, 0.145841,
- 0x7878, 0.162915,
- 0x7d7d, 0.181095,
- 0x8282, 0.200386,
- 0x8787, 0.220791,
- 0x8c8c, 0.242309,
- 0x9191, 0.264937,
- 0x9696, 0.288670,
- 0x9b9b, 0.313499,
- 0xa0a0, 0.339410,
- 0xa5a5, 0.366390,
- 0xaaaa, 0.394421,
- 0xafaf, 0.423481,
- 0xb4b4, 0.453547,
- 0xb9b9, 0.484592,
- 0xbebe, 0.516587,
- 0xc3c3, 0.549498,
- 0xc8c8, 0.583291,
- 0xcdcd, 0.617925,
- 0xd2d2, 0.653361,
- 0xd7d7, 0.689553,
- 0xdcdc, 0.726454,
- 0xe1e1, 0.764013,
- 0xe6e6, 0.802178,
- 0xebeb, 0.840891,
- 0xf0f0, 0.880093,
- 0xf5f5, 0.919723,
- 0xfafa, 0.959715,
- 0xffff, 1.00000
+ { 0x0000, 0.000000 },
+ { 0x0e0e, 0.000000 },
+ { 0x0f0f, 0.001341 },
+ { 0x1414, 0.002080 },
+ { 0x1919, 0.003188 },
+ { 0x1e1e, 0.004729 },
+ { 0x2323, 0.006766 },
+ { 0x2828, 0.009357 },
+ { 0x2d2d, 0.012559 },
+ { 0x3232, 0.016424 },
+ { 0x3737, 0.021004 },
+ { 0x3c3c, 0.026344 },
+ { 0x4141, 0.032489 },
+ { 0x4646, 0.039481 },
+ { 0x4b4b, 0.047357 },
+ { 0x5050, 0.056154 },
+ { 0x5555, 0.065903 },
+ { 0x5a5a, 0.076634 },
+ { 0x5f5f, 0.088373 },
+ { 0x6464, 0.101145 },
+ { 0x6969, 0.114968 },
+ { 0x6e6e, 0.129862 },
+ { 0x7373, 0.145841 },
+ { 0x7878, 0.162915 },
+ { 0x7d7d, 0.181095 },
+ { 0x8282, 0.200386 },
+ { 0x8787, 0.220791 },
+ { 0x8c8c, 0.242309 },
+ { 0x9191, 0.264937 },
+ { 0x9696, 0.288670 },
+ { 0x9b9b, 0.313499 },
+ { 0xa0a0, 0.339410 },
+ { 0xa5a5, 0.366390 },
+ { 0xaaaa, 0.394421 },
+ { 0xafaf, 0.423481 },
+ { 0xb4b4, 0.453547 },
+ { 0xb9b9, 0.484592 },
+ { 0xbebe, 0.516587 },
+ { 0xc3c3, 0.549498 },
+ { 0xc8c8, 0.583291 },
+ { 0xcdcd, 0.617925 },
+ { 0xd2d2, 0.653361 },
+ { 0xd7d7, 0.689553 },
+ { 0xdcdc, 0.726454 },
+ { 0xe1e1, 0.764013 },
+ { 0xe6e6, 0.802178 },
+ { 0xebeb, 0.840891 },
+ { 0xf0f0, 0.880093 },
+ { 0xf5f5, 0.919723 },
+ { 0xfafa, 0.959715 },
+ { 0xffff, 1.00000 }
};
static IntensityTbl Default_RGB_RedTbl = {
@@ -418,16 +413,19 @@ static IntensityTbl Default_RGB_BlueTbl = {
};
static LINEAR_RGB_SCCData Default_RGB_SCCData = {
-
/* XcmsFloat XYZtoRGBmatrix[3][3] */
- 3.48340481253539000, -1.52176374927285200, -0.55923133354049780,
- -1.07152751306193600, 1.96593795204372400, 0.03673691339553462,
- 0.06351179790497788, -0.20020501000496480, 0.81070942031648220,
+ {
+ { 3.48340481253539000, -1.52176374927285200, -0.55923133354049780 },
+ {-1.07152751306193600, 1.96593795204372400, 0.03673691339553462 },
+ { 0.06351179790497788, -0.20020501000496480, 0.81070942031648220 }
+ },
/* XcmsFloat RGBtoXYZmatrix[3][3] */
- 0.38106149108714790, 0.32025712365352110, 0.24834578525933100,
- 0.20729745115140850, 0.68054638776373240, 0.11215616108485920,
- 0.02133944350088028, 0.14297193020246480, 1.24172892629665500,
+ {
+ { 0.38106149108714790, 0.32025712365352110, 0.24834578525933100 },
+ { 0.20729745115140850, 0.68054638776373240, 0.11215616108485920 },
+ { 0.02133944350088028, 0.14297193020246480, 1.24172892629665500 }
+ },
/* IntensityTbl *pRedTbl */
&Default_RGB_RedTbl,
@@ -452,10 +450,10 @@ static LINEAR_RGB_SCCData Default_RGB_SCCData = {
* SYNOPSIS
*/
static Status
-LINEAR_RGB_InitSCCData(dpy, screenNumber, pPerScrnInfo)
- Display *dpy;
- int screenNumber;
- XcmsPerScrnInfo *pPerScrnInfo;
+LINEAR_RGB_InitSCCData(
+ Display *dpy,
+ int screenNumber,
+ XcmsPerScrnInfo *pPerScrnInfo)
/*
* DESCRIPTION
*
@@ -834,8 +832,8 @@ FreeSCCData:
* SYNOPSIS
*/
static void
-LINEAR_RGB_FreeSCCData(pScreenDataTemp)
- XPointer pScreenDataTemp;
+LINEAR_RGB_FreeSCCData(
+ XPointer pScreenDataTemp)
/*
* DESCRIPTION
*
@@ -894,12 +892,12 @@ LINEAR_RGB_FreeSCCData(pScreenDataTemp)
*
* SYNOPSIS
*/
-Status
-_XcmsGetTableType0(pTbl, format, pChar, pCount)
- IntensityTbl *pTbl;
- int format;
- char **pChar;
- unsigned long *pCount;
+static Status
+_XcmsGetTableType0(
+ IntensityTbl *pTbl,
+ int format,
+ char **pChar,
+ unsigned long *pCount)
/*
* DESCRIPTION
*
@@ -955,12 +953,12 @@ _XcmsGetTableType0(pTbl, format, pChar, pCount)
*
* SYNOPSIS
*/
-Status
-_XcmsGetTableType1(pTbl, format, pChar, pCount)
- IntensityTbl *pTbl;
- int format;
- char **pChar;
- unsigned long *pCount;
+static Status
+_XcmsGetTableType1(
+ IntensityTbl *pTbl,
+ int format,
+ char **pChar,
+ unsigned long *pCount)
/*
* DESCRIPTION
*
@@ -1017,9 +1015,9 @@ _XcmsGetTableType1(pTbl, format, pChar, pCount)
*
* SYNOPSIS
*/
-int
-_XcmsValueCmp (p1, p2)
- IntensityRec *p1, *p2;
+static int
+_XcmsValueCmp(
+ IntensityRec *p1, IntensityRec *p2)
/*
* DESCRIPTION
* Compares the value component of two IntensityRec
@@ -1042,9 +1040,9 @@ _XcmsValueCmp (p1, p2)
*
* SYNOPSIS
*/
-int
-_XcmsIntensityCmp (p1, p2)
- IntensityRec *p1, *p2;
+static int
+_XcmsIntensityCmp(
+ IntensityRec *p1, IntensityRec *p2)
/*
* DESCRIPTION
* Compares the intensity component of two IntensityRec
@@ -1073,10 +1071,10 @@ _XcmsIntensityCmp (p1, p2)
* SYNOPSIS
*/
/* ARGSUSED */
-int
-_XcmsValueInterpolation (key, lo, hi, answer, bitsPerRGB)
- IntensityRec *key, *lo, *hi, *answer;
- int bitsPerRGB;
+static int
+_XcmsValueInterpolation(
+ IntensityRec *key, IntensityRec *lo, IntensityRec *hi, IntensityRec *answer,
+ int bitsPerRGB)
/*
* DESCRIPTION
* Based on a given value, performs a linear interpolation
@@ -1103,10 +1101,10 @@ _XcmsValueInterpolation (key, lo, hi, answer, bitsPerRGB)
*
* SYNOPSIS
*/
-int
-_XcmsIntensityInterpolation (key, lo, hi, answer, bitsPerRGB)
- IntensityRec *key, *lo, *hi, *answer;
- int bitsPerRGB;
+static int
+_XcmsIntensityInterpolation(
+ IntensityRec *key, IntensityRec *lo, IntensityRec *hi, IntensityRec *answer,
+ int bitsPerRGB)
/*
* DESCRIPTION
* Based on a given intensity, performs a linear interpolation
@@ -1145,22 +1143,40 @@ _XcmsIntensityInterpolation (key, lo, hi, answer, bitsPerRGB)
}
+
+typedef int (*comparProcp)(
+ char *p1,
+ char *p2);
+typedef int (*interpolProcp)(
+ char *key,
+ char *lo,
+ char *hi,
+ char *answer,
+ int bitsPerRGB);
+
/*
* NAME
* _XcmsTableSearch
*
* SYNOPSIS
*/
-int
-_XcmsTableSearch (key, bitsPerRGB, base, nel, nKeyPtrSize, compar, interpol, answer)
- char *key;
- int bitsPerRGB;
- char *base;
- unsigned nel;
- unsigned nKeyPtrSize;
- int (*compar)();
- int (*interpol)();
- char *answer;
+static int
+_XcmsTableSearch(
+ char *key,
+ int bitsPerRGB,
+ char *base,
+ unsigned nel,
+ unsigned nKeyPtrSize,
+ int (*compar)(
+ char *p1,
+ char *p2),
+ int (*interpol)(
+ char *key,
+ char *lo,
+ char *hi,
+ char *answer,
+ int bitsPerRGB),
+ char *answer)
/*
* DESCRIPTION
@@ -1218,8 +1234,8 @@ _XcmsTableSearch (key, bitsPerRGB, base, nel, nKeyPtrSize, compar, interpol, ans
*
* SYNOPSIS
*/
-void _XcmsMatVec(pMat, pIn, pOut)
- XcmsFloat *pMat, *pIn, *pOut;
+static void _XcmsMatVec(
+ XcmsFloat *pMat, XcmsFloat *pIn, XcmsFloat *pOut)
/*
* DESCRIPTION
* Multiply the passed vector by the passed matrix to return a
@@ -1253,9 +1269,9 @@ void _XcmsMatVec(pMat, pIn, pOut)
* SYNOPSIS
*/
static int
-XcmsLRGB_RGB_ParseString(spec, pColor)
- register char *spec;
- XcmsColor *pColor;
+XcmsLRGB_RGB_ParseString(
+ register char *spec,
+ XcmsColor *pColor)
/*
* DESCRIPTION
* This routines takes a string and attempts to convert
@@ -1371,9 +1387,9 @@ XcmsLRGB_RGB_ParseString(spec, pColor)
* SYNOPSIS
*/
static int
-XcmsLRGB_RGBi_ParseString(spec, pColor)
- register char *spec;
- XcmsColor *pColor;
+XcmsLRGB_RGBi_ParseString(
+ register char *spec,
+ XcmsColor *pColor)
/*
* DESCRIPTION
* This routines takes a string and attempts to convert
@@ -1651,7 +1667,7 @@ XcmsRGBiToRGB(ccc, pXcmsColors_in_out, nColors, pCompressed)
(char *)pScreenData->pRedTbl->pBase,
(unsigned)pScreenData->pRedTbl->nEntries,
(unsigned)sizeof(IntensityRec),
- _XcmsIntensityCmp, _XcmsIntensityInterpolation, (char *)&answerIRec)) {
+ (comparProcp)_XcmsIntensityCmp, (interpolProcp)_XcmsIntensityInterpolation, (char *)&answerIRec)) {
return(XcmsFailure);
}
tmpRGB.red = answerIRec.value;
@@ -1661,7 +1677,7 @@ XcmsRGBiToRGB(ccc, pXcmsColors_in_out, nColors, pCompressed)
(char *)pScreenData->pGreenTbl->pBase,
(unsigned)pScreenData->pGreenTbl->nEntries,
(unsigned)sizeof(IntensityRec),
- _XcmsIntensityCmp, _XcmsIntensityInterpolation, (char *)&answerIRec)) {
+ (comparProcp)_XcmsIntensityCmp, (interpolProcp)_XcmsIntensityInterpolation, (char *)&answerIRec)) {
return(XcmsFailure);
}
tmpRGB.green = answerIRec.value;
@@ -1671,7 +1687,7 @@ XcmsRGBiToRGB(ccc, pXcmsColors_in_out, nColors, pCompressed)
(char *)pScreenData->pBlueTbl->pBase,
(unsigned)pScreenData->pBlueTbl->nEntries,
(unsigned)sizeof(IntensityRec),
- _XcmsIntensityCmp, _XcmsIntensityInterpolation, (char *)&answerIRec)) {
+ (comparProcp)_XcmsIntensityCmp, (interpolProcp)_XcmsIntensityInterpolation, (char *)&answerIRec)) {
return(XcmsFailure);
}
tmpRGB.blue = answerIRec.value;
@@ -1691,11 +1707,11 @@ XcmsRGBiToRGB(ccc, pXcmsColors_in_out, nColors, pCompressed)
*/
/* ARGSUSED */
Status
-XcmsRGBToRGBi(ccc, pXcmsColors_in_out, nColors, pCompressed)
- XcmsCCC ccc;
- XcmsColor *pXcmsColors_in_out;/* pointer to XcmsColors to convert */
- unsigned int nColors; /* Number of colors */
- Bool *pCompressed; /* pointer to a bit array */
+XcmsRGBToRGBi(
+ XcmsCCC ccc,
+ XcmsColor *pXcmsColors_in_out,/* pointer to XcmsColors to convert */
+ unsigned int nColors, /* Number of colors */
+ Bool *pCompressed) /* pointer to a bit array */
/*
* DESCRIPTION
* Converts color specifications in an array of XcmsColor
@@ -1732,7 +1748,7 @@ XcmsRGBToRGBi(ccc, pXcmsColors_in_out, nColors, pCompressed)
(char *)pScreenData->pRedTbl->pBase,
(unsigned)pScreenData->pRedTbl->nEntries,
(unsigned)sizeof(IntensityRec),
- _XcmsValueCmp, _XcmsValueInterpolation, (char *)&answerIRec)) {
+ (comparProcp)_XcmsValueCmp, (interpolProcp)_XcmsValueInterpolation, (char *)&answerIRec)) {
return(XcmsFailure);
}
tmpRGBi.red = answerIRec.intensity;
@@ -1742,7 +1758,7 @@ XcmsRGBToRGBi(ccc, pXcmsColors_in_out, nColors, pCompressed)
(char *)pScreenData->pGreenTbl->pBase,
(unsigned)pScreenData->pGreenTbl->nEntries,
(unsigned)sizeof(IntensityRec),
- _XcmsValueCmp, _XcmsValueInterpolation, (char *)&answerIRec)) {
+ (comparProcp)_XcmsValueCmp, (interpolProcp)_XcmsValueInterpolation, (char *)&answerIRec)) {
return(XcmsFailure);
}
tmpRGBi.green = answerIRec.intensity;
@@ -1752,7 +1768,7 @@ XcmsRGBToRGBi(ccc, pXcmsColors_in_out, nColors, pCompressed)
(char *)pScreenData->pBlueTbl->pBase,
(unsigned)pScreenData->pBlueTbl->nEntries,
(unsigned)sizeof(IntensityRec),
- _XcmsValueCmp, _XcmsValueInterpolation, (char *)&answerIRec)) {
+ (comparProcp)_XcmsValueCmp, (interpolProcp)_XcmsValueInterpolation, (char *)&answerIRec)) {
return(XcmsFailure);
}
tmpRGBi.blue = answerIRec.intensity;
@@ -1771,10 +1787,10 @@ XcmsRGBToRGBi(ccc, pXcmsColors_in_out, nColors, pCompressed)
*/
/* ARGSUSED */
int
-_XcmsLRGB_InitScrnDefault(dpy, screenNumber, pPerScrnInfo)
- Display *dpy;
- int screenNumber;
- XcmsPerScrnInfo *pPerScrnInfo;
+_XcmsLRGB_InitScrnDefault(
+ Display *dpy,
+ int screenNumber,
+ XcmsPerScrnInfo *pPerScrnInfo)
/*
* DESCRIPTION
* Given a display and screen number, this routine attempts
diff --git a/src/xcms/Lab.c b/src/xcms/Lab.c
index 7827d8e7..fed6115a 100644
--- a/src/xcms/Lab.c
+++ b/src/xcms/Lab.c
@@ -36,11 +36,14 @@
*
* Note that the range for L* is 0 to 1.
*/
+/* $XFree86: xc/lib/X11/Lab.c,v 1.3 2001/01/17 19:41:38 dawes Exp $ */
#include <X11/Xos.h>
+#include <stdio.h> /* sscanf */
#include "Xlibint.h"
#include "Xcmsint.h"
+#include "Cv.h"
/*
* DEFINES
@@ -55,17 +58,11 @@
#define DIV16BY116 0.137931
/*
- * EXTERNS
- */
-extern char _XcmsCIELab_prefix[];
-
-
-/*
* FORWARD DECLARATIONS
*/
-static int CIELab_ParseString();
-static Status XcmsCIELab_ValidSpec();
+static int CIELab_ParseString(register char *spec, XcmsColor *pColor);
+static Status XcmsCIELab_ValidSpec(XcmsColor *pColor);
/*
@@ -120,9 +117,9 @@ XcmsColorSpace XcmsCIELabColorSpace =
* SYNOPSIS
*/
static int
-CIELab_ParseString(spec, pColor)
- register char *spec;
- XcmsColor *pColor;
+CIELab_ParseString(
+ register char *spec,
+ XcmsColor *pColor)
/*
* DESCRIPTION
* This routines takes a string and attempts to convert
@@ -185,8 +182,8 @@ CIELab_ParseString(spec, pColor)
* SYNOPSIS
*/
static Status
-XcmsCIELab_ValidSpec(pColor)
- XcmsColor *pColor;
+XcmsCIELab_ValidSpec(
+ XcmsColor *pColor)
/*
* DESCRIPTION
* Checks if color specification valid for CIE L*a*b*.
diff --git a/src/xcms/LabGcC.c b/src/xcms/LabGcC.c
index 0618dcbb..306b811a 100644
--- a/src/xcms/LabGcC.c
+++ b/src/xcms/LabGcC.c
@@ -30,9 +30,11 @@
* Source for XcmsCIELabClipuv() gamut compression routine.
*
*/
+/* $XFree86: xc/lib/X11/LabGcC.c,v 1.3 2001/01/17 19:41:38 dawes Exp $ */
#include "Xlibint.h"
#include "Xcmsint.h"
+#include "Cv.h"
/************************************************************************
diff --git a/src/xcms/LabGcL.c b/src/xcms/LabGcL.c
index bc6d20ef..3311a978 100644
--- a/src/xcms/LabGcL.c
+++ b/src/xcms/LabGcL.c
@@ -30,14 +30,11 @@
* Source for XcmsCIELabClipL() gamut compression routine.
*
*/
+/* $XFree86: xc/lib/X11/LabGcL.c,v 1.3 2001/01/17 19:41:38 dawes Exp $ */
#include "Xlibint.h"
#include "Xcmsint.h"
-
-/*
- * EXTERNS
- */
-extern Status _XcmsCIELabQueryMaxLCRGB();
+#include "Cv.h"
/************************************************************************
diff --git a/src/xcms/LabGcLC.c b/src/xcms/LabGcLC.c
index 8ffaf8c3..85b1b001 100644
--- a/src/xcms/LabGcLC.c
+++ b/src/xcms/LabGcLC.c
@@ -30,10 +30,12 @@
* Source for XcmsCIELabClipLab() gamut
* compression function.
*/
+/* $XFree86: xc/lib/X11/LabGcLC.c,v 1.3 2001/01/17 19:41:39 dawes Exp $ */
#include "Xlibint.h"
#include "Xcmsint.h"
#include <math.h>
+#include "Cv.h"
/*
* INTERNALS
@@ -42,11 +44,6 @@
*/
#define MAXBISECTCOUNT 100
-/*
- * EXTERNS
- */
-extern Status _XcmsCIELabQueryMaxLCRGB();
-
/************************************************************************
* *
diff --git a/src/xcms/LabMnL.c b/src/xcms/LabMnL.c
index c5ca3e8e..dd5f5c1b 100644
--- a/src/xcms/LabMnL.c
+++ b/src/xcms/LabMnL.c
@@ -31,10 +31,12 @@
* querying routine.
*
*/
+/* $XFree86: xc/lib/X11/LabMnL.c,v 1.3 2001/01/17 19:41:39 dawes Exp $ */
#include "Xlibint.h"
#include "Xcmsint.h"
#include <math.h>
+#include "Cv.h"
/*
* DEFINES
@@ -43,11 +45,6 @@
#define EPS (XcmsFloat)0.001
#define START_L_STAR (XcmsFloat)40.0
-/*
- * EXTERNS
- */
-extern Status _XcmsCIELabQueryMaxLCRGB();
-
/************************************************************************
* *
diff --git a/src/xcms/LabMxC.c b/src/xcms/LabMxC.c
index a1a3d69d..d03ed9d8 100644
--- a/src/xcms/LabMxC.c
+++ b/src/xcms/LabMxC.c
@@ -33,10 +33,12 @@
* querying routine.
*
*/
+/* $XFree86: xc/lib/X11/LabMxC.c,v 1.3 2001/01/17 19:41:39 dawes Exp $ */
#include "Xlibint.h"
#include "Xcmsint.h"
#include <math.h>
+#include "Cv.h"
/*
* DEFINES
@@ -46,11 +48,6 @@
#define START_CHROMA (XcmsFloat)3.6
#define TOPL (XcmsFloat)100.0
-/*
- * EXTERNS
- */
-extern Status _XcmsCIELabQueryMaxLCRGB();
-
/************************************************************************
* *
diff --git a/src/xcms/LabMxL.c b/src/xcms/LabMxL.c
index a31a8f41..32f4bdbe 100644
--- a/src/xcms/LabMxL.c
+++ b/src/xcms/LabMxL.c
@@ -31,10 +31,12 @@
* querying routine.
*
*/
+/* $XFree86: xc/lib/X11/LabMxL.c,v 1.3 2001/01/17 19:41:39 dawes Exp $ */
#include "Xlibint.h"
#include "Xcmsint.h"
#include <math.h>
+#include "Cv.h"
/*
* DEFINES
@@ -43,11 +45,6 @@
#define EPS (XcmsFloat)0.001
#define START_L_STAR (XcmsFloat)40
-/*
- * EXTERNS
- */
-extern Status _XcmsCIELabQueryMaxLCRGB();
-
/************************************************************************
* *
diff --git a/src/xcms/LabMxLC.c b/src/xcms/LabMxLC.c
index 6fdeeb1b..e806bb19 100644
--- a/src/xcms/LabMxLC.c
+++ b/src/xcms/LabMxLC.c
@@ -38,9 +38,11 @@
* Fred W. Billmeyer & Max Saltzman, "Principles of Color
* Technology", John Wily & Sons, Inc, 1981.
*/
+/* $XFree86$ */
#include "Xlibint.h"
#include "Xcmsint.h"
+#include "Cv.h"
/*
* DEFINES
@@ -52,16 +54,6 @@
#define START_LSTAR (XcmsFloat)40.0
#define START_CHROMA (XcmsFloat)3.6
-/*
- * EXTERNS
- */
-extern Status _XcmsConvertColorsWithWhitePt();
-
-/*
- * FORWARD DECLARATIONS
- */
-Status _XcmsCIELabQueryMaxLCRGB();
-
/************************************************************************
* *
@@ -76,12 +68,11 @@ Status _XcmsCIELabQueryMaxLCRGB();
* SYNOPSIS
*/
Status
-_XcmsCIELabQueryMaxLCRGB(ccc, hue, pColor_return, pRGB_return)
- XcmsCCC ccc;
- XcmsFloat hue; /* hue in radians */
- XcmsColor *pColor_return;
- XcmsRGBi *pRGB_return;
-
+_XcmsCIELabQueryMaxLCRGB(
+ XcmsCCC ccc,
+ XcmsFloat hue, /* hue in radians */
+ XcmsColor *pColor_return,
+ XcmsRGBi *pRGB_return)
/*
* DESCRIPTION
* Return the maximum psychometric chroma for a specified
diff --git a/src/xcms/LabWpAj.c b/src/xcms/LabWpAj.c
index b4fc4a32..ec2a68d2 100644
--- a/src/xcms/LabWpAj.c
+++ b/src/xcms/LabWpAj.c
@@ -32,16 +32,16 @@
* adjustment of color specifications in the CIE L*a*b* color
* space.
*/
+/* $XFree86$ */
#include "Xlibint.h"
#include "Xcmsint.h"
+#include "Cv.h"
/*
* EXTERNS
*/
-extern Status _XcmsConvertColorsWithWhitePt();
-
/************************************************************************
* *
diff --git a/src/xcms/Luv.c b/src/xcms/Luv.c
index 9cb56cfd..17fff09a 100644
--- a/src/xcms/Luv.c
+++ b/src/xcms/Luv.c
@@ -38,24 +38,22 @@
* Fred W. Billmeyer & Max Saltzman, "Principles of Color
* Technology", John Wily & Sons, Inc, 1981.
*/
+/* $XFree86: xc/lib/X11/Luv.c,v 1.3 2001/01/17 19:41:39 dawes Exp $ */
#include <X11/Xos.h>
#include "Xlibint.h"
#include "Xcmsint.h"
+#include "Cv.h"
-/*
- * EXTERNS
- */
-
-extern char _XcmsCIELuv_prefix[];
+#include <stdio.h> /* sscanf */
/*
* FORWARD DECLARATIONS
*/
-static int CIELuv_ParseString();
-static Status XcmsCIELuv_ValidSpec();
+static int CIELuv_ParseString(register char *spec, XcmsColor *pColor);
+static Status XcmsCIELuv_ValidSpec(XcmsColor *pColor);
/*
* DEFINES
@@ -122,9 +120,9 @@ XcmsColorSpace XcmsCIELuvColorSpace =
* SYNOPSIS
*/
static int
-CIELuv_ParseString(spec, pColor)
- register char *spec;
- XcmsColor *pColor;
+CIELuv_ParseString(
+ register char *spec,
+ XcmsColor *pColor)
/*
* DESCRIPTION
* This routines takes a string and attempts to convert
@@ -185,8 +183,8 @@ CIELuv_ParseString(spec, pColor)
* SYNOPSIS
*/
static Status
-XcmsCIELuv_ValidSpec(pColor)
- XcmsColor *pColor;
+XcmsCIELuv_ValidSpec(
+ XcmsColor *pColor)
/*
* DESCRIPTION
* Checks if color specification valid for CIE L*u*v*.
diff --git a/src/xcms/LuvGcC.c b/src/xcms/LuvGcC.c
index fa3b3f11..a945cc8a 100644
--- a/src/xcms/LuvGcC.c
+++ b/src/xcms/LuvGcC.c
@@ -30,9 +30,11 @@
* Source for XcmsCIELuvClipuv() gamut compression routine.
*
*/
+/* $XFree86: xc/lib/X11/LuvGcC.c,v 1.3 2001/01/17 19:41:39 dawes Exp $ */
#include "Xlibint.h"
#include "Xcmsint.h"
+#include "Cv.h"
/************************************************************************
diff --git a/src/xcms/LuvGcL.c b/src/xcms/LuvGcL.c
index 32d09bdb..e2a0aa13 100644
--- a/src/xcms/LuvGcL.c
+++ b/src/xcms/LuvGcL.c
@@ -30,14 +30,11 @@
* Source for XcmsCIELuvClipL() gamut compression routine.
*
*/
+/* $XFree86: xc/lib/X11/LuvGcL.c,v 1.3 2001/01/17 19:41:39 dawes Exp $ */
#include "Xlibint.h"
#include "Xcmsint.h"
-
-/*
- * EXTERNS
- */
-extern Status _XcmsCIELuvQueryMaxLCRGB();
+#include "Cv.h"
/************************************************************************
diff --git a/src/xcms/LuvGcLC.c b/src/xcms/LuvGcLC.c
index 376f5f40..c859e37b 100644
--- a/src/xcms/LuvGcLC.c
+++ b/src/xcms/LuvGcLC.c
@@ -30,10 +30,12 @@
* Source for XcmsCIELuvClipLuv() gamut
* compression function.
*/
+/* $XFree86: xc/lib/X11/LuvGcLC.c,v 1.3 2001/01/17 19:41:39 dawes Exp $ */
#include "Xlibint.h"
#include "Xcmsint.h"
#include <math.h>
+#include "Cv.h"
/*
* INTERNALS
@@ -42,11 +44,6 @@
*/
#define MAXBISECTCOUNT 100
-/*
- * EXTERNS
- */
-extern Status _XcmsCIELuvQueryMaxLCRGB();
-
/************************************************************************
* *
diff --git a/src/xcms/LuvMnL.c b/src/xcms/LuvMnL.c
index c687037d..668365db 100644
--- a/src/xcms/LuvMnL.c
+++ b/src/xcms/LuvMnL.c
@@ -31,10 +31,12 @@
* querying routine.
*
*/
+/* $XFree86: xc/lib/X11/LuvMnL.c,v 1.3 2001/01/17 19:41:39 dawes Exp $ */
#include "Xlibint.h"
#include "Xcmsint.h"
#include <math.h>
+#include "Cv.h"
/*
* DEFINES
@@ -43,11 +45,6 @@
#define EPS (XcmsFloat)0.001
#define START_L_STAR (XcmsFloat)40.0
-/*
- * EXTERNS
- */
-extern Status _XcmsCIELuvQueryMaxLCRGB();
-
/************************************************************************
* *
diff --git a/src/xcms/LuvMxC.c b/src/xcms/LuvMxC.c
index 100a3b9e..2ff95afb 100644
--- a/src/xcms/LuvMxC.c
+++ b/src/xcms/LuvMxC.c
@@ -33,10 +33,12 @@
* querying routine.
*
*/
+/* $XFree86: xc/lib/X11/LuvMxC.c,v 1.3 2001/01/17 19:41:39 dawes Exp $ */
#include "Xlibint.h"
#include "Xcmsint.h"
#include <math.h>
+#include "Cv.h"
/*
* DEFINES
@@ -45,10 +47,6 @@
#define EPS (XcmsFloat)0.001
#define START_CHROMA (XcmsFloat)2.2
#define TOPL (XcmsFloat)100.0
-/*
- * EXTERNS
- */
-extern Status _XcmsCIELuvQueryMaxLCRGB();
/************************************************************************
diff --git a/src/xcms/LuvMxL.c b/src/xcms/LuvMxL.c
index 7925b010..08d01280 100644
--- a/src/xcms/LuvMxL.c
+++ b/src/xcms/LuvMxL.c
@@ -31,10 +31,12 @@
* querying routine.
*
*/
+/* $XFree86: xc/lib/X11/LuvMxL.c,v 1.3 2001/01/17 19:41:40 dawes Exp $ */
#include "Xlibint.h"
#include "Xcmsint.h"
#include <math.h>
+#include "Cv.h"
/*
* DEFINES
@@ -43,11 +45,6 @@
#define EPS (XcmsFloat)0.001
#define START_L_STAR (XcmsFloat)40.0
-/*
- * EXTERNS
- */
-extern Status _XcmsCIELuvQueryMaxLCRGB();
-
/************************************************************************
* *
diff --git a/src/xcms/LuvMxLC.c b/src/xcms/LuvMxLC.c
index 337bbbf2..bb00b713 100644
--- a/src/xcms/LuvMxLC.c
+++ b/src/xcms/LuvMxLC.c
@@ -38,9 +38,11 @@
* Fred W. Billmeyer & Max Saltzman, "Principles of Color
* Technology", John Wily & Sons, Inc, 1981.
*/
+/* $XFree86$ */
#include "Xlibint.h"
#include "Xcmsint.h"
+#include "Cv.h"
/*
* DEFINES
@@ -52,16 +54,6 @@
#define START_LSTAR (XcmsFloat)40.0
#define START_CHROMA (XcmsFloat)2.2
-/*
- * EXTERNS
- */
-extern Status _XcmsConvertColorsWithWhitePt();
-
-/*
- * FORWARD DECLARATIONS
- */
-Status _XcmsCIELuvQueryMaxLCRGB();
-
/************************************************************************
* *
@@ -76,12 +68,11 @@ Status _XcmsCIELuvQueryMaxLCRGB();
* SYNOPSIS
*/
Status
-_XcmsCIELuvQueryMaxLCRGB(ccc, hue, pColor_return, pRGB_return)
- XcmsCCC ccc;
- XcmsFloat hue; /* hue in radians */
- XcmsColor *pColor_return;
- XcmsRGBi *pRGB_return;
-
+_XcmsCIELuvQueryMaxLCRGB(
+ XcmsCCC ccc,
+ XcmsFloat hue, /* hue in radians */
+ XcmsColor *pColor_return,
+ XcmsRGBi *pRGB_return)
/*
* DESCRIPTION
* Return the maximum psychometric chroma for a specified
diff --git a/src/xcms/LuvWpAj.c b/src/xcms/LuvWpAj.c
index 5083ccb7..f19bfa5c 100644
--- a/src/xcms/LuvWpAj.c
+++ b/src/xcms/LuvWpAj.c
@@ -32,15 +32,11 @@
* adjustment of color specifications in the CIE CIELuv.color
* space.
*/
+/* $XFree86$ */
#include "Xlibint.h"
#include "Xcmsint.h"
-
-/*
- * EXTERNS
- */
-
-extern Status _XcmsConvertColorsWithWhitePt();
+#include "Cv.h"
diff --git a/src/xcms/PrOfId.c b/src/xcms/PrOfId.c
index 7b301e41..84c6166a 100644
--- a/src/xcms/PrOfId.c
+++ b/src/xcms/PrOfId.c
@@ -32,15 +32,11 @@
*
*
*/
+/* $XFree86$ */
#include "Xlibint.h"
#include "Xcmsint.h"
-
-/*
- * EXTERNS
- */
-extern XcmsColorSpace **_XcmsDIColorSpaces;
-extern XcmsColorSpace **_XcmsDDColorSpaces;
+#include "Cv.h"
/*
diff --git a/src/xcms/QuCol.c b/src/xcms/QuCol.c
index d632d457..3c48467b 100644
--- a/src/xcms/QuCol.c
+++ b/src/xcms/QuCol.c
@@ -32,10 +32,11 @@
*
*
*/
+/* $XFree86: xc/lib/X11/QuCol.c,v 1.3 2001/01/17 19:41:42 dawes Exp $ */
#include "Xlibint.h"
#include "Xcmsint.h"
-
+#include "Cv.h"
/************************************************************************
@@ -71,6 +72,6 @@ XcmsQueryColor(dpy, colormap, pXcmsColor_in_out, result_format)
* specified pixel.
*/
{
- return(_XcmsSetGetColors (XQueryColor, dpy, colormap,
- pXcmsColor_in_out, 1, result_format, (Bool *) NULL));
+ return(_XcmsSetGetColor(XQueryColor, dpy, colormap,
+ pXcmsColor_in_out, result_format, (Bool *) NULL));
}
diff --git a/src/xcms/QuCols.c b/src/xcms/QuCols.c
index 9a35cf05..3f4350b1 100644
--- a/src/xcms/QuCols.c
+++ b/src/xcms/QuCols.c
@@ -32,9 +32,11 @@
*
*
*/
+/* $XFree86: xc/lib/X11/QuCols.c,v 1.3 2001/01/17 19:41:42 dawes Exp $ */
#include "Xlibint.h"
#include "Xcmsint.h"
+#include "Cv.h"
/************************************************************************
@@ -70,6 +72,6 @@ XcmsQueryColors(dpy, colormap, pXcmsColors_in_out, nColors, result_format)
* specified pixels.
*/
{
- return(_XcmsSetGetColors (XQueryColors, dpy, colormap,
+ return(_XcmsSetGetColors(XQueryColors, dpy, colormap,
pXcmsColors_in_out, nColors, result_format, (Bool *) NULL));
}
diff --git a/src/xcms/SetCCC.c b/src/xcms/SetCCC.c
index d58daf8a..e8d3a779 100644
--- a/src/xcms/SetCCC.c
+++ b/src/xcms/SetCCC.c
@@ -33,6 +33,7 @@
*
*
*/
+/* $XFree86$ */
#include "Xlibint.h"
#include "Xcms.h"
@@ -86,17 +87,10 @@ XcmsSetWhitePoint(ccc, pColor)
*/
XcmsCompressionProc
-#if NeedFunctionPrototypes
XcmsSetCompressionProc(
XcmsCCC ccc,
XcmsCompressionProc compression_proc,
XPointer client_data)
-#else
-XcmsSetCompressionProc(ccc, compression_proc, client_data)
- XcmsCCC ccc;
- XcmsCompressionProc compression_proc;
- XPointer client_data;
-#endif
/*
* DESCRIPTION
* Set the specified CCC's compression function and client data.
@@ -122,17 +116,10 @@ XcmsSetCompressionProc(ccc, compression_proc, client_data)
*/
XcmsWhiteAdjustProc
-#if NeedFunctionPrototypes
XcmsSetWhiteAdjustProc(
XcmsCCC ccc,
XcmsWhiteAdjustProc white_adjust_proc,
XPointer client_data )
-#else
-XcmsSetWhiteAdjustProc(ccc, white_adjust_proc, client_data)
- XcmsCCC ccc;
- XcmsWhiteAdjustProc white_adjust_proc;
- XPointer client_data;
-#endif
/*
* DESCRIPTION
* Set the specified CCC's white_adjust function and client data.
diff --git a/src/xcms/SetGetCols.c b/src/xcms/SetGetCols.c
index 5ee68985..66477652 100644
--- a/src/xcms/SetGetCols.c
+++ b/src/xcms/SetGetCols.c
@@ -32,6 +32,7 @@
*
*
*/
+/* $XFree86$ */
/*
* EXTERNAL INCLUDES
@@ -40,15 +41,7 @@
*/
#include "Xlibint.h"
#include "Xcmsint.h"
-
-
-/*
- * EXTERNS
- */
-
-extern void _XcmsRGB_to_XColor();
-extern void _XColor_to_XcmsRGB();
-
+#include "Cv.h"
/************************************************************************
@@ -59,27 +52,144 @@ extern void _XColor_to_XcmsRGB();
/*
* NAME
- * XcmsSetColors -
+ * XcmsSetColor -
*
* SYNOPSIS
*/
Status
-_XcmsSetGetColors(xColorProc, dpy, cmap, pColors_in_out, nColors,
- result_format, pCompressed)
- Status (*xColorProc)();
- Display *dpy;
- Colormap cmap;
- XcmsColor *pColors_in_out;
- unsigned int nColors;
- XcmsColorFormat result_format;
- Bool *pCompressed;
+_XcmsSetGetColor(
+ Status (*xColorProc)(
+ Display* /* display */,
+ Colormap /* colormap */,
+ XColor* /* screen_in_out */),
+ Display *dpy,
+ Colormap cmap,
+ XcmsColor *pColors_in_out,
+ XcmsColorFormat result_format,
+ Bool *pCompressed)
/*
* DESCRIPTION
* Routine containing code common to:
* XcmsAllocColor
* XcmsQueryColor
- * XcmsQueryColors
* XcmsStoreColor
+ *
+ * RETURNS
+ * XcmsFailure if failed;
+ * XcmsSuccess if it succeeded without gamut compression;
+ * XcmsSuccessWithCompression if it succeeded with gamut
+ * compression;
+ */
+{
+ XcmsCCC ccc;
+ XColor XColors_in_out;
+ Status retval = XcmsSuccess;
+
+ /*
+ * Argument Checking
+ * 1. Assume xColorProc is correct
+ * 2. Insure ccc not NULL
+ * 3. Assume cmap correct (should be checked by Server)
+ * 4. Insure pColors_in_out valid
+ * 5. Assume method_in is valid (should be checked by Server)
+ */
+
+ if (dpy == NULL) {
+ return(XcmsFailure);
+ }
+
+ if (result_format == XcmsUndefinedFormat) {
+ return(XcmsFailure);
+ }
+
+ if ( !((*xColorProc == XAllocColor) || (*xColorProc == XStoreColor)
+ || (*xColorProc == XQueryColor)) ) {
+ return(XcmsFailure);
+ }
+
+ if ((ccc = XcmsCCCOfColormap(dpy, cmap)) == (XcmsCCC)NULL) {
+ return(XcmsFailure);
+ }
+
+ if (*xColorProc == XQueryColor) {
+ goto Query;
+ }
+
+ /*
+ * Convert to RGB, adjusting for white point differences if necessary.
+ */
+ if ((retval = XcmsConvertColors(ccc, pColors_in_out, 1, XcmsRGBFormat,
+ pCompressed)) == XcmsFailure) {
+ return(XcmsFailure);
+ }
+
+Query:
+ /*
+ * Convert XcmsColor to XColor structures
+ */
+ _XcmsRGB_to_XColor(pColors_in_out, &XColors_in_out, 1);
+
+ /*
+ * Now make appropriate X Call
+ */
+ if (*xColorProc == XAllocColor) {
+ if ((*xColorProc)(ccc->dpy, cmap, &XColors_in_out) == 0) {
+ return(XcmsFailure);
+ }
+ } else if ((*xColorProc == XQueryColor) || (*xColorProc == XStoreColor)) {
+ /* Note: XQueryColor and XStoreColor do not return any Status */
+ (*xColorProc)(ccc->dpy, cmap, &XColors_in_out);
+ } else {
+ return(XcmsFailure);
+ }
+
+ if ((*xColorProc == XStoreColor)) {
+ return(retval);
+ }
+
+ /*
+ * Now, convert the returned XColor (i.e., rgb) to XcmsColor structures
+ */
+ _XColor_to_XcmsRGB(ccc, &XColors_in_out, pColors_in_out, 1);
+
+ /*
+ * Then, convert XcmsColor structures to the original specification
+ * format. Note that we must use NULL instead of passing
+ * pCompressed.
+ */
+
+ if (result_format != XcmsRGBFormat) {
+ if (XcmsConvertColors(ccc, pColors_in_out, 1, result_format,
+ (Bool *) NULL) == XcmsFailure) {
+ return(XcmsFailure);
+ }
+ }
+ return(retval);
+}
+
+/*
+ * NAME
+ * XcmsSetColors -
+ *
+ * SYNOPSIS
+ */
+Status
+_XcmsSetGetColors(
+ Status (*xColorProc)(
+ Display* /* display */,
+ Colormap /* colormap */,
+ XColor* /* screen_in_out */,
+ int /* nColors */),
+ Display *dpy,
+ Colormap cmap,
+ XcmsColor *pColors_in_out,
+ int nColors,
+ XcmsColorFormat result_format,
+ Bool *pCompressed)
+/*
+ * DESCRIPTION
+ * Routine containing code common to:
+ * XcmsQueryColors
* XcmsStoreColors
*
* RETURNS
@@ -115,9 +225,7 @@ _XcmsSetGetColors(xColorProc, dpy, cmap, pColors_in_out, nColors,
return(XcmsFailure);
}
- if (!((*xColorProc == XAllocColor) || (*xColorProc == XStoreColor)
- || (*xColorProc == XStoreColors) || (*xColorProc == XQueryColor)
- || (*xColorProc == XQueryColors))) {
+ if ( !((*xColorProc == XStoreColors) || (*xColorProc == XQueryColors)) ) {
return(XcmsFailure);
}
@@ -125,11 +233,6 @@ _XcmsSetGetColors(xColorProc, dpy, cmap, pColors_in_out, nColors,
return(XcmsFailure);
}
- if ((*xColorProc == XAllocColor) || (*xColorProc == XStoreColor)
- || (*xColorProc == XQueryColor)) {
- nColors = 1;
- }
-
/*
* Allocate space for XColors
*/
@@ -138,14 +241,16 @@ _XcmsSetGetColors(xColorProc, dpy, cmap, pColors_in_out, nColors,
return(XcmsFailure);
}
- if ((*xColorProc == XQueryColor) || (*xColorProc == XQueryColors)) {
+ if (*xColorProc == XQueryColors) {
goto Query;
}
+
/*
* Convert to RGB, adjusting for white point differences if necessary.
*/
if ((retval = XcmsConvertColors(ccc, pColors_in_out, nColors, XcmsRGBFormat,
pCompressed)) == XcmsFailure) {
+ Xfree((char *)pXColors_in_out);
return(XcmsFailure);
}
@@ -158,15 +263,7 @@ Query:
/*
* Now make appropriate X Call
*/
- if (*xColorProc == XAllocColor) {
- if ((*xColorProc)(ccc->dpy, cmap, pXColors_in_out) == 0) {
- Xfree((char *)pXColors_in_out);
- return(XcmsFailure);
- }
- } else if ((*xColorProc == XQueryColor) || (*xColorProc == XStoreColor)) {
- /* Note: XQueryColor and XStoreColor do not return any Status */
- (*xColorProc)(ccc->dpy, cmap, pXColors_in_out);
- } else if ((*xColorProc == XQueryColors) || (*xColorProc == XStoreColors)){
+ if ((*xColorProc == XQueryColors) || (*xColorProc == XStoreColors)){
/* Note: XQueryColors and XStoreColors do not return any Status */
(*xColorProc)(ccc->dpy, cmap, pXColors_in_out, nColors);
} else {
@@ -174,13 +271,13 @@ Query:
return(XcmsFailure);
}
- if ((*xColorProc == XStoreColor) || (*xColorProc == XStoreColors)) {
+ if (*xColorProc == XStoreColors) {
Xfree((char *)pXColors_in_out);
return(retval);
}
/*
- * Now, convert returned XColor(i.e., rgb) to XcmsColor structures
+ * Now, convert the returned XColor (i.e., rgb) to XcmsColor structures
*/
_XColor_to_XcmsRGB(ccc, pXColors_in_out, pColors_in_out, nColors);
Xfree((char *)pXColors_in_out);
@@ -190,12 +287,14 @@ Query:
* format. Note that we must use NULL instead of passing
* pCompressed.
*/
-
if (result_format != XcmsRGBFormat) {
if (XcmsConvertColors(ccc, pColors_in_out, nColors, result_format,
(Bool *) NULL) == XcmsFailure) {
return(XcmsFailure);
}
}
+
return(retval);
}
+
+/* ### EOF ### */
diff --git a/src/xcms/StCol.c b/src/xcms/StCol.c
index b6229f98..5893d65b 100644
--- a/src/xcms/StCol.c
+++ b/src/xcms/StCol.c
@@ -32,9 +32,11 @@
*
*
*/
+/* $XFree86: xc/lib/X11/StCol.c,v 1.3 2001/01/17 19:41:44 dawes Exp $ */
#include "Xlibint.h"
#include "Xcmsint.h"
+#include "Cv.h"
/************************************************************************
@@ -74,6 +76,6 @@ XcmsStoreColor(dpy, colormap, pColor_in)
XcmsColor tmpColor;
tmpColor = *pColor_in;
- return(_XcmsSetGetColors (XStoreColor, dpy, colormap,
- &tmpColor, 1, XcmsRGBFormat, (Bool *) NULL));
+ return(_XcmsSetGetColor(XStoreColor, dpy, colormap,
+ &tmpColor, XcmsRGBFormat, (Bool *) NULL));
}
diff --git a/src/xcms/StCols.c b/src/xcms/StCols.c
index 1e833c34..8219a7f1 100644
--- a/src/xcms/StCols.c
+++ b/src/xcms/StCols.c
@@ -32,9 +32,11 @@
*
*
*/
+/* $XFree86: xc/lib/X11/StCols.c,v 1.3 2001/01/17 19:41:44 dawes Exp $ */
#include "Xlibint.h"
#include "Xcmsint.h"
+#include "Cv.h"
/************************************************************************
diff --git a/src/xcms/UNDEFINED.c b/src/xcms/UNDEFINED.c
index a4e05551..520d97a1 100644
--- a/src/xcms/UNDEFINED.c
+++ b/src/xcms/UNDEFINED.c
@@ -33,6 +33,7 @@
*
*
*/
+/* $XFree86$ */
#include "Xlibint.h"
#include "Xcmsint.h"
@@ -40,21 +41,33 @@
/*
* FORWARD DECLARATIONS
*/
-static int ReturnZero();
+static int DummyParseStringProc(
+ char* /* color_string */,
+ XcmsColor* /* color_return */
+ );
+static Status ReturnZero(
+ XcmsCCC /* ccc */,
+ XcmsColor* /* white_point */,
+ XcmsColor* /* colors */,
+ unsigned int /* ncolors */
+ );
/*
* LOCALS VARIABLES
*/
-static Status (*(Fl_ReturnZero[]))() = {
+static Status (*(Fl_ReturnZero[]))(
+ XcmsCCC /* ccc */,
+ XcmsColor* /* white_point */,
+ XcmsColor* /* colors */,
+ unsigned int /* ncolors */
+ ) = {
ReturnZero,
NULL
};
-
-
/*
* GLOBALS
* Variables declared in this package that are allowed
@@ -67,7 +80,7 @@ XcmsColorSpace XcmsUNDEFINEDColorSpace =
{
"undefined", /* prefix */
XcmsUndefinedFormat, /* id */
- ReturnZero, /* parseString */
+ &DummyParseStringProc, /* parseString */
Fl_ReturnZero, /* to_CIEXYZ */
Fl_ReturnZero /* from_CIEXYZ */
};
@@ -87,8 +100,13 @@ XcmsColorSpace XcmsUNDEFINEDColorSpace =
* SYNOPSIS
*/
/* ARGSUSED */
-static int
-ReturnZero()
+static Status
+ReturnZero(
+ XcmsCCC ccc /* ccc */,
+ XcmsColor* white /* white_point */,
+ XcmsColor* colors /* colors */,
+ unsigned int ncolors /* ncolors */
+ )
/*
* DESCRIPTION
* Does nothing.
@@ -100,3 +118,13 @@ ReturnZero()
{
return(0);
}
+
+static int DummyParseStringProc(
+ char* color_string /* color_string */,
+ XcmsColor* color_return /* color_return */
+ )
+{
+ return(0);
+}
+
+/* ### EOF ### */
diff --git a/src/xcms/XRGB.c b/src/xcms/XRGB.c
index 7e5b7f84..f868afcc 100644
--- a/src/xcms/XRGB.c
+++ b/src/xcms/XRGB.c
@@ -33,21 +33,17 @@
*
*
*/
+/* $XFree86: xc/lib/X11/XRGB.c,v 3.3 2001/07/29 05:01:11 tsi Exp $ */
#include "Xlibint.h"
#include "Xcmsint.h"
-
-#ifdef __STDC__
-#define Const const
-#else
-#define Const /**/
-#endif
+#include "Cv.h"
/*
* LOCAL VARIABLES
*/
-static unsigned short Const MASK[17] = {
+static unsigned short const MASK[17] = {
0x0000, /* 0 bitsPerRGB */
0x8000, /* 1 bitsPerRGB */
0xc000, /* 2 bitsPerRGB */
@@ -82,10 +78,10 @@ static unsigned short Const MASK[17] = {
* SYNOPSIS
*/
void
-_XcmsRGB_to_XColor(pColors, pXColors, nColors)
- XcmsColor *pColors;
- XColor *pXColors;
- unsigned int nColors;
+_XcmsRGB_to_XColor(
+ XcmsColor *pColors,
+ XColor *pXColors,
+ unsigned int nColors)
/*
* DESCRIPTION
* Translates a color specification in XcmsRGBFormat in a XcmsColor
@@ -112,11 +108,11 @@ _XcmsRGB_to_XColor(pColors, pXColors, nColors)
* SYNOPSIS
*/
void
-_XColor_to_XcmsRGB(ccc, pXColors, pColors, nColors)
- XcmsCCC ccc;
- XColor *pXColors;
- XcmsColor *pColors;
- unsigned int nColors;
+_XColor_to_XcmsRGB(
+ XcmsCCC ccc,
+ XColor *pXColors,
+ XcmsColor *pColors,
+ unsigned int nColors)
/*
* DESCRIPTION
* Translates an RGB color specification in an XColor
@@ -150,9 +146,9 @@ _XColor_to_XcmsRGB(ccc, pXColors, pColors, nColors)
* SYNOPSIS
*/
void
-_XcmsResolveColor(ccc, pXcmsColor)
- XcmsCCC ccc;
- XcmsColor *pXcmsColor;
+_XcmsResolveColor(
+ XcmsCCC ccc,
+ XcmsColor *pXcmsColor)
/*
* DESCRIPTION
* Uses the X Server ResolveColor() algorithm to
@@ -196,9 +192,9 @@ _XcmsResolveColor(ccc, pXcmsColor)
* SYNOPSIS
*/
void
-_XcmsUnresolveColor(ccc, pColor)
- XcmsCCC ccc;
- XcmsColor *pColor;
+_XcmsUnresolveColor(
+ XcmsCCC ccc,
+ XcmsColor *pColor)
/*
* DESCRIPTION
* Masks out insignificant bits.
@@ -225,9 +221,9 @@ _XcmsUnresolveColor(ccc, pColor)
* SYNOPSIS
*/
void
-_XUnresolveColor(ccc, pXColor)
- XcmsCCC ccc;
- XColor *pXColor;
+_XUnresolveColor(
+ XcmsCCC ccc,
+ XColor *pXColor)
/*
* DESCRIPTION
* Masks out insignificant bits.
diff --git a/src/xcms/XYZ.c b/src/xcms/XYZ.c
index a06b2132..86b18e10 100644
--- a/src/xcms/XYZ.c
+++ b/src/xcms/XYZ.c
@@ -33,19 +33,14 @@
*
*
*/
+/* $XFree86: xc/lib/X11/XYZ.c,v 1.3 2001/01/17 19:41:49 dawes Exp $ */
#include <X11/Xos.h>
#include "Xlibint.h"
#include "Xcmsint.h"
+#include "Cv.h"
-
-/*
- * EXTERNS
- * External declarations required locally to this package
- * that are not already declared in any of the included header
- * files (external includes or internal includes).
- */
-extern char _XcmsCIEXYZ_prefix[];
+#include <stdio.h> /* sscanf */
/*
* DEFINES
@@ -61,9 +56,7 @@ extern char _XcmsCIEXYZ_prefix[];
/*
* FORWARD DECLARATIONS
*/
-static int CIEXYZ_ParseString();
-Status _XcmsCIEXYZ_ValidSpec();
-
+static int CIEXYZ_ParseString(register char *spec, XcmsColor *pColor);
/*
* LOCALS VARIABLES
@@ -107,9 +100,9 @@ XcmsColorSpace XcmsCIEXYZColorSpace =
* SYNOPSIS
*/
static int
-CIEXYZ_ParseString(spec, pColor)
- register char *spec;
- XcmsColor *pColor;
+CIEXYZ_ParseString(
+ register char *spec,
+ XcmsColor *pColor)
/*
* DESCRIPTION
* This routines takes a string and attempts to convert
@@ -169,8 +162,8 @@ CIEXYZ_ParseString(spec, pColor)
* SYNOPSIS
*/
Status
-_XcmsCIEXYZ_ValidSpec(pColor)
- XcmsColor *pColor;
+_XcmsCIEXYZ_ValidSpec(
+ XcmsColor *pColor)
/*
* DESCRIPTION
* Checks if color specification valid for CIE XYZ
diff --git a/src/xcms/Xcms.txt b/src/xcms/Xcms.txt
index c27fd8f4..29069416 100644
--- a/src/xcms/Xcms.txt
+++ b/src/xcms/Xcms.txt
@@ -25,6 +25,7 @@
* DESCRIPTION
* Sample Color Name Database
*
+ * $XFree86$
*/
@@ -38,24 +39,7 @@ version number of the format/syntax used in this file. The color name is
delimited from the color specification by one or more tabs.
XCMS_COLORDB_START 0.1
-red CIEXYZ:0.371298/0.201443/0.059418
-green CIEXYZ:0.321204/0.660070/0.159833
-blue CIEXYZ:0.279962/0.160195/1.210705
-aquamarine CIEXYZ:0.34672401/0.54832153/0.44658871
-cadet blue CIEXYZ:0.22601070/0.28905571/0.47233452
-cornflower blue CIEXYZ:0.05658276/0.04476296/0.17063955
-navy blue CIEXYZ:0.06713718/0.03366278/0.31293880
-navy CIEXYZ:0.06713718/0.03366278/0.31293880
-brown CIEXYZ:0.08443233/0.06011398/0.01840693
-gray0 TekHVC:0.0/0.0/0.0
-gray10 TekHVC:0.0/10.0/0.0
-gray20 TekHVC:0.0/20.0/0.0
-gray30 TekHVC:0.0/30.0/0.0
-gray40 TekHVC:0.0/40.0/0.0
-gray50 TekHVC:0.0/50.0/0.0
-gray60 TekHVC:0.0/60.0/0.0
-gray70 TekHVC:0.0/70.0/0.0
-gray80 TekHVC:0.0/80.0/0.0
-gray90 TekHVC:0.0/90.0/0.0
-gray100 TekHVC:0.0/100.0/0.0
+cms red CIEXYZ:0.3811/0.2073/0.0213
+cms green CIEXYZ:0.3203/0.6805/0.1430
+cms blue CIEXYZ:0.2483/0.1122/1.2417
XCMS_COLORDB_END
diff --git a/src/xcms/Xcmsint.h b/src/xcms/Xcmsint.h
index 68cd1b7b..1bf02ba2 100644
--- a/src/xcms/Xcmsint.h
+++ b/src/xcms/Xcmsint.h
@@ -29,6 +29,8 @@
* (i.e., for API internal use only)
*
*/
+/* $XFree86: xc/lib/X11/Xcmsint.h,v 3.3 2001/07/25 15:04:44 dawes Exp $ */
+
#ifndef _XCMSINT_H_
#define _XCMSINT_H_
@@ -107,7 +109,7 @@ typedef struct _XcmsIntensityMap {
VisualID visualID;
XPointer screenData; /* pointer to corresponding Screen Color*/
/* Characterization Data */
- void (*pFreeScreenData)(); /* Function that frees a Screen */
+ void (*pFreeScreenData)(XPointer pScreenDataTemp); /* Function that frees a Screen */
/* structure. */
struct _XcmsIntensityMap *pNext;
} XcmsIntensityMap;
@@ -117,7 +119,7 @@ typedef struct _XcmsIntensityMap {
* Structure for storing "registered" color space prefix/ID
*/
typedef struct _XcmsRegColorSpaceEntry {
- char *prefix; /* Color Space prefix (e.g., "CIEXYZ:") */
+ const char *prefix; /* Color Space prefix (e.g., "CIEXYZ:") */
XcmsColorFormat id; /* Color Space ID (e.g., XcmsCIEXYZFormat) */
} XcmsRegColorSpaceEntry;
@@ -174,6 +176,28 @@ typedef struct {
IntensityTbl *pBlueTbl;
} LINEAR_RGB_SCCData;
+/* function prototypes */
+extern XcmsCmapRec *
+_XcmsAddCmapRec(
+ Display *dpy,
+ Colormap cmap,
+ Window windowID,
+ Visual *visual);
+extern void
+_XcmsRGB_to_XColor(
+ XcmsColor *pColors,
+ XColor *pXColors,
+ unsigned int nColors);
+extern Status
+_XcmsResolveColorString (
+ XcmsCCC ccc,
+ const char **color_string,
+ XcmsColor *pColor_exact_return,
+ XcmsColorFormat result_format);
+extern void
+_XUnresolveColor(
+ XcmsCCC ccc,
+ XColor *pXColor);
/*
* DESCRIPTION
* Include file for defining the math macros used in the
@@ -194,19 +218,11 @@ typedef struct {
#define XCMS_SQRT(x) _XcmsSquareRoot(x)
#define XCMS_TAN(x) (XCMS_SIN(x) / XCMS_COS(x))
-#ifdef __STDC__
double _XcmsArcTangent(double a);
double _XcmsCosine(double a);
double _XcmsCubeRoot(double a);
double _XcmsSine(double a);
double _XcmsSquareRoot(double a);
-#else
-double _XcmsArcTangent();
-double _XcmsCosine();
-double _XcmsCubeRoot();
-double _XcmsSine();
-double _XcmsSquareRoot();
-#endif
/*
* DEFINES FOR GAMUT COMPRESSION AND QUERY ROUTINES
diff --git a/src/xcms/cmsAllCol.c b/src/xcms/cmsAllCol.c
index b631064b..4d301485 100644
--- a/src/xcms/cmsAllCol.c
+++ b/src/xcms/cmsAllCol.c
@@ -32,9 +32,11 @@
*
*
*/
+/* $XFree86: xc/lib/X11/cmsAllCol.c,v 1.3 2001/01/17 19:41:50 dawes Exp $ */
#include "Xlibint.h"
#include "Xcmsint.h"
+#include "Cv.h"
/*
@@ -66,6 +68,6 @@ XcmsAllocColor(dpy, colormap, pXcmsColor_in_out, result_format)
*
*/
{
- return(_XcmsSetGetColors (XAllocColor, dpy, colormap, pXcmsColor_in_out, 1,
+ return(_XcmsSetGetColor(XAllocColor, dpy, colormap, pXcmsColor_in_out,
result_format, (Bool *)NULL));
}
diff --git a/src/xcms/cmsAllNCol.c b/src/xcms/cmsAllNCol.c
index 960173f8..efbb1e83 100644
--- a/src/xcms/cmsAllNCol.c
+++ b/src/xcms/cmsAllNCol.c
@@ -32,17 +32,13 @@
*
*
*/
+/* $XFree86: xc/lib/X11/cmsAllNCol.c,v 1.4 2003/04/13 19:22:20 dawes Exp $ */
#define NEED_REPLIES
#include <stdio.h>
#include "Xlibint.h"
#include "Xcmsint.h"
-
-/*
- * EXTERNS
- */
-extern void _XColor_to_XcmsRGB();
-extern void _XcmsRGB_to_XColor();
+#include "Cv.h"
/*
@@ -51,7 +47,6 @@ extern void _XcmsRGB_to_XColor();
*
* SYNOPSIS
*/
-#if NeedFunctionPrototypes
Status
XcmsAllocNamedColor (
Display *dpy,
@@ -60,17 +55,6 @@ XcmsAllocNamedColor (
XcmsColor *pColor_scrn_return,
XcmsColor *pColor_exact_return,
XcmsColorFormat result_format)
-#else
-Status
-XcmsAllocNamedColor(dpy, cmap, colorname, pColor_scrn_return,
- pColor_exact_return, result_format)
- Display *dpy;
- Colormap cmap;
- char *colorname;
- XcmsColor *pColor_scrn_return;
- XcmsColor *pColor_exact_return;
- XcmsColorFormat result_format;
-#endif
/*
* DESCRIPTION
* Finds the color specification associated with the color
diff --git a/src/xcms/cmsCmap.c b/src/xcms/cmsCmap.c
index 84d60a46..acdbb9d7 100644
--- a/src/xcms/cmsCmap.c
+++ b/src/xcms/cmsCmap.c
@@ -33,18 +33,20 @@
*
*
*/
+/* $XFree86$ */
#define NEED_EVENTS
#define NEED_REPLIES
#include "Xlibint.h"
#include "Xcmsint.h"
#include "Xutil.h"
+#include "Cmap.h"
+#include "Cv.h"
/*
* FORWARD DECLARATIONS
*/
-XcmsCmapRec *_XcmsAddCmapRec();
-static void _XcmsFreeClientCmaps();
+static void _XcmsFreeClientCmaps(Display *dpy);
/************************************************************************
@@ -60,9 +62,9 @@ static void _XcmsFreeClientCmaps();
* SYNOPSIS
*/
static XcmsCmapRec *
-CmapRecForColormap(dpy, cmap)
- Display *dpy;
- Colormap cmap;
+CmapRecForColormap(
+ Display *dpy,
+ Colormap cmap)
/*
* DESCRIPTION
* Find the corresponding XcmsCmapRec for cmap. In not found
@@ -278,10 +280,10 @@ _XcmsAddCmapRec(dpy, cmap, windowID, visual)
* SYNOPSIS
*/
XcmsCmapRec *
-_XcmsCopyCmapRecAndFree(dpy, src_cmap, copy_cmap)
- Display *dpy;
- Colormap src_cmap;
- Colormap copy_cmap;
+_XcmsCopyCmapRecAndFree(
+ Display *dpy,
+ Colormap src_cmap,
+ Colormap copy_cmap)
/*
* DESCRIPTION
* Augments Xlib's XCopyColormapAndFree() to copy
@@ -317,9 +319,9 @@ _XcmsCopyCmapRecAndFree(dpy, src_cmap, copy_cmap)
* SYNOPSIS
*/
void
-_XcmsDeleteCmapRec(dpy, cmap)
- Display *dpy;
- Colormap cmap;
+_XcmsDeleteCmapRec(
+ Display *dpy,
+ Colormap cmap)
/*
* DESCRIPTION
* Removes and frees the specified XcmsCmapRec structure
@@ -364,8 +366,8 @@ _XcmsDeleteCmapRec(dpy, cmap)
* SYNOPSIS
*/
static void
-_XcmsFreeClientCmaps(dpy)
- Display *dpy;
+_XcmsFreeClientCmaps(
+ Display *dpy)
/*
* DESCRIPTION
* Frees all XcmsCmapRec structures in the linked list
diff --git a/src/xcms/cmsColNm.c b/src/xcms/cmsColNm.c
index e4a9fc90..f7dd472f 100644
--- a/src/xcms/cmsColNm.c
+++ b/src/xcms/cmsColNm.c
@@ -1,3 +1,4 @@
+/* $XdotOrg: lib/X11/src/xcms/cmsColNm.c,v 1.2 2004-04-23 18:43:24 eich Exp $ */
/* $Xorg: cmsColNm.c,v 1.3 2000/08/17 19:45:09 cpqbld Exp $ */
/*
@@ -31,6 +32,7 @@
*
*
*/
+/* $XFree86: xc/lib/X11/cmsColNm.c,v 3.11 2003/04/13 19:22:20 dawes Exp $ */
#include "Xlibint.h"
#include "Xcmsint.h"
@@ -40,22 +42,11 @@
#include <ctype.h>
#define XK_LATIN1
#include <X11/keysymdef.h>
+#include "Cv.h"
+/* forwards/locals */
+static Status LoadColornameDB(void);
-/*
- * EXTERNS
- * External declarations required locally to this package
- * that are not already declared in any of the included header
- * files (external includes or internal includes).
- */
-#ifdef X_NOT_STDC_ENV
-extern char *getenv();
-extern void qsort();
-extern char *bsearch();
-#endif
-extern XcmsColorSpace **_XcmsDIColorSpaces;
-static Status LoadColornameDB();
-void _XcmsCopyISOLatin1Lowered();
/*
* LOCAL DEFINES
@@ -89,8 +80,8 @@ void _XcmsCopyISOLatin1Lowered();
* LOCAL TYPEDEFS
*/
typedef struct _XcmsPair {
- char *first;
- char *second;
+ const char *first;
+ const char *second;
int flag;
} XcmsPair;
@@ -101,7 +92,7 @@ static int XcmsColorDbState = XcmsDbInitNone;
static int nEntries;
static char *strings;
static XcmsPair *pairs;
-static char whitePtStr[] = "WhitePoint";
+static const char whitePtStr[] = "WhitePoint";
/************************************************************************
@@ -117,9 +108,9 @@ static char whitePtStr[] = "WhitePoint";
* SYNOPSIS
*/
static XcmsColorSpace *
-_XcmsColorSpaceOfString(ccc, color_string)
- XcmsCCC ccc;
- char *color_string;
+_XcmsColorSpaceOfString(
+ XcmsCCC ccc,
+ const char *color_string)
/*
* DESCRIPTION
* Returns a pointer to the color space structure
@@ -185,10 +176,10 @@ _XcmsColorSpaceOfString(ccc, color_string)
* SYNOPSIS
*/
static int
-_XcmsParseColorString(ccc, color_string, pColor)
- XcmsCCC ccc;
- char *color_string;
- XcmsColor *pColor;
+_XcmsParseColorString(
+ XcmsCCC ccc,
+ const char *color_string,
+ XcmsColor *pColor)
/*
* DESCRIPTION
* Assuming color_string contains a numerical string color
@@ -250,12 +241,7 @@ _XcmsParseColorString(ccc, color_string, pColor)
* SYNOPSIS
*/
static int
-FirstCmp(p1, p2)
-#ifdef __STDC__
- const void *p1, *p2;
-#else
- XcmsPair *p1, *p2;
-#endif
+FirstCmp(const void *p1, const void *p2)
/*
* DESCRIPTION
* Compares the color names of XcmsColorTuples.
@@ -280,7 +266,7 @@ FirstCmp(p1, p2)
* SYNOPSIS
*/
static void
-SetNoVisit()
+SetNoVisit(void)
/*
* DESCRIPTION
*
@@ -309,11 +295,11 @@ SetNoVisit()
* SYNOPSIS
*/
static int
-field2(pBuf, delim, p1, p2)
- char *pBuf;
- char delim; /* in: field delimiter */
- char **p1; /* in/out: pointer to pointer to field 1 */
- char **p2; /* in/out: pointer to pointer to field 2 */
+field2(
+ char *pBuf,
+ char delim, /* in: field delimiter */
+ char **p1, /* in/out: pointer to pointer to field 1 */
+ char **p2) /* in/out: pointer to pointer to field 2 */
/*
* DESCRIPTION
* Extracts two fields from a "record".
@@ -379,10 +365,10 @@ field2(pBuf, delim, p1, p2)
* SYNOPSIS
*/
static Status
-_XcmsLookupColorName(ccc, name, pColor)
- XcmsCCC ccc;
- char **name;
- XcmsColor *pColor;
+_XcmsLookupColorName(
+ XcmsCCC ccc,
+ const char **name,
+ XcmsColor *pColor)
/*
* DESCRIPTION
* Searches for an entry in the Device-Independent Color Name
@@ -403,8 +389,8 @@ _XcmsLookupColorName(ccc, name, pColor)
char *name_lowered;
register int i, j, left, right;
int len;
- char *tmpName;
- XcmsPair *pair;
+ const char *tmpName;
+ XcmsPair *pair = NULL;
/*
* Check state of Database:
@@ -502,8 +488,8 @@ Retry:
* SYNOPSIS
*/
static int
-RemoveSpaces(pString)
- char *pString;
+RemoveSpaces(
+ char *pString)
/*
* DESCRIPTION
* Removes spaces from string.
@@ -536,10 +522,10 @@ RemoveSpaces(pString)
* SYNOPSIS
*/
static int
-stringSectionSize(stream, pNumEntries, pSectionSize)
- FILE *stream;
- int *pNumEntries;
- int *pSectionSize;
+stringSectionSize(
+ FILE *stream,
+ int *pNumEntries,
+ int *pSectionSize)
/*
* DESCRIPTION
* Determines the amount of memory required to store the
@@ -621,10 +607,10 @@ stringSectionSize(stream, pNumEntries, pSectionSize)
* SYNOPSIS
*/
static Status
-ReadColornameDB(stream, pRec, pString)
- FILE *stream;
- XcmsPair *pRec;
- char *pString;
+ReadColornameDB(
+ FILE *stream,
+ XcmsPair *pRec,
+ char *pString)
/*
* DESCRIPTION
* Loads the Color Name Database from a text file.
@@ -708,7 +694,7 @@ ReadColornameDB(stream, pRec, pString)
* SYNOPSIS
*/
static Status
-LoadColornameDB()
+LoadColornameDB(void)
/*
* DESCRIPTION
* Loads the Color Name Database from a text file.
@@ -729,6 +715,9 @@ LoadColornameDB()
if ((pathname = getenv("XCMSDB")) == NULL) {
pathname = XCMSDB;
}
+#ifdef __UNIXOS2__
+ pathname = __XOS2RedirRoot(pathname);
+#endif
length = strlen(pathname);
if ((length == 0) || (length >= (BUFSIZ - 5))){
@@ -778,8 +767,9 @@ LoadColornameDB()
* SYNOPSIS
*/
void
-_XcmsCopyISOLatin1Lowered(dst, src)
- char *dst, *src;
+_XcmsCopyISOLatin1Lowered(
+ char *dst,
+ const char *src)
/*
* DESCRIPTION
* ISO Latin-1 case conversion routine
@@ -794,9 +784,10 @@ _XcmsCopyISOLatin1Lowered(dst, src)
*
*/
{
- register unsigned char *dest, *source;
+ register unsigned char *dest;
+ register const unsigned char *source;
- for (dest = (unsigned char *)dst, source = (unsigned char *)src;
+ for (dest = (unsigned char *)dst, source = (const unsigned char *)src;
*source;
source++, dest++)
{
@@ -819,21 +810,12 @@ _XcmsCopyISOLatin1Lowered(dst, src)
*
* SYNOPSIS
*/
-#if NeedFunctionPrototypes
Status
_XcmsResolveColorString (
XcmsCCC ccc,
- _Xconst char **color_string,
+ const char **color_string,
XcmsColor *pColor_exact_return,
XcmsColorFormat result_format)
-#else
-Status
-_XcmsResolveColorString(ccc, color_string, pColor_exact_return, result_format)
- XcmsCCC ccc;
- char **color_string;
- XcmsColor *pColor_exact_return;
- XcmsColorFormat result_format;
-#endif
/*
* DESCRIPTION
* The XcmsLookupColor function finds the color specification
@@ -861,7 +843,7 @@ _XcmsResolveColorString(ccc, color_string, pColor_exact_return, result_format)
/* the screen's white point */
XcmsColor *pClientWhitePt;
int retval;
- char *strptr = whitePtStr;
+ const char *strptr = whitePtStr;
/*
* 0. Check for invalid arguments.
diff --git a/src/xcms/cmsGlobls.c b/src/xcms/cmsGlobls.c
index deeea982..2a92a229 100644
--- a/src/xcms/cmsGlobls.c
+++ b/src/xcms/cmsGlobls.c
@@ -32,46 +32,11 @@
*
*
*/
+/* $XFree86: xc/lib/X11/cmsGlobls.c,v 1.4 2001/01/17 19:41:51 dawes Exp $ */
#include "Xlibint.h"
#include "Xcmsint.h"
-
-/*
- * EXTERNS
- * External declarations required locally to this package
- * that are not already declared in any of the included header
- * files (external includes or internal includes).
- */
-extern XcmsFunctionSet XcmsLinearRGBFunctionSet;
-#ifdef GRAY
-extern XcmsFunctionSet XcmsGrayFunctionSet;
-#endif /* GRAY */
-
-/* UNDEFINED Color Space */
-extern XcmsColorSpace XcmsUNDEFINEDColorSpace;
-
-/* CIE XYZ Color Space */
-extern XcmsColorSpace XcmsCIEXYZColorSpace;
-
-/* CIE uvY Color Space */
-extern XcmsColorSpace XcmsCIEuvYColorSpace;
-
-/* CIE xyY Color Space */
-extern XcmsColorSpace XcmsCIExyYColorSpace;
-
-/* CIE Lab Color Space */
-extern XcmsColorSpace XcmsCIELabColorSpace;
-
-/* CIE Luv Color Space */
-extern XcmsColorSpace XcmsCIELuvColorSpace;
-
-/* TekHVC Color Space */
-extern XcmsColorSpace XcmsTekHVCColorSpace;
-
-/* Device Dependent Color Space Structures */
-extern XcmsColorSpace XcmsRGBiColorSpace;
-extern XcmsColorSpace XcmsRGBColorSpace;
-
+#include "Cv.h"
/*
* GLOBALS
@@ -135,26 +100,26 @@ XcmsFunctionSet **_XcmsSCCFuncSets = _XcmsSCCFuncSetsInit;
* X Consortium Registered Device-Independent Color Spaces
* Note that prefix must be in lowercase.
*/
-char _XcmsCIEXYZ_prefix[] = "ciexyz";
-char _XcmsCIEuvY_prefix[] = "cieuvy";
-char _XcmsCIExyY_prefix[] = "ciexyy";
-char _XcmsCIELab_prefix[] = "cielab";
-char _XcmsCIELuv_prefix[] = "cieluv";
-char _XcmsTekHVC_prefix[] = "tekhvc";
+const char _XcmsCIEXYZ_prefix[] = "ciexyz";
+const char _XcmsCIEuvY_prefix[] = "cieuvy";
+const char _XcmsCIExyY_prefix[] = "ciexyy";
+const char _XcmsCIELab_prefix[] = "cielab";
+const char _XcmsCIELuv_prefix[] = "cieluv";
+const char _XcmsTekHVC_prefix[] = "tekhvc";
/*
* Registered Device-Dependent Color Spaces
*/
-char _XcmsRGBi_prefix[] = "rgbi";
-char _XcmsRGB_prefix[] = "rgb";
+const char _XcmsRGBi_prefix[] = "rgbi";
+const char _XcmsRGB_prefix[] = "rgb";
XcmsRegColorSpaceEntry _XcmsRegColorSpaces[] = {
- _XcmsCIEXYZ_prefix, XcmsCIEXYZFormat,
- _XcmsCIEuvY_prefix, XcmsCIEuvYFormat,
- _XcmsCIExyY_prefix, XcmsCIExyYFormat,
- _XcmsCIELab_prefix, XcmsCIELabFormat,
- _XcmsCIELuv_prefix, XcmsCIELuvFormat,
- _XcmsTekHVC_prefix, XcmsTekHVCFormat,
- _XcmsRGB_prefix, XcmsRGBFormat,
- _XcmsRGBi_prefix, XcmsRGBiFormat,
- NULL, 0
+ { _XcmsCIEXYZ_prefix, XcmsCIEXYZFormat },
+ { _XcmsCIEuvY_prefix, XcmsCIEuvYFormat },
+ { _XcmsCIExyY_prefix, XcmsCIExyYFormat },
+ { _XcmsCIELab_prefix, XcmsCIELabFormat },
+ { _XcmsCIELuv_prefix, XcmsCIELuvFormat },
+ { _XcmsTekHVC_prefix, XcmsTekHVCFormat },
+ { _XcmsRGB_prefix, XcmsRGBFormat },
+ { _XcmsRGBi_prefix, XcmsRGBiFormat },
+ { NULL, 0 }
};
diff --git a/src/xcms/cmsInt.c b/src/xcms/cmsInt.c
index b70e2c08..ea75c503 100644
--- a/src/xcms/cmsInt.c
+++ b/src/xcms/cmsInt.c
@@ -34,28 +34,20 @@
*
*
*/
+/* $XFree86: xc/lib/X11/cmsInt.c,v 1.4 2003/04/13 19:22:20 dawes Exp $ */
/* #define NEED_EVENTS */
#include <stdio.h>
#include "Xlibint.h"
#include "Xcmsint.h"
+#include "Cv.h"
#ifndef XCMSCOMPPROC
# define XCMSCOMPPROC XcmsTekHVCClipC
#endif
-/*
- * EXTERNS
- */
-extern XcmsColorSpace **_XcmsDIColorSpaces;
-extern XcmsFunctionSet **_XcmsSCCFuncSets;
-
-static void _XcmsFreeDefaultCCCs();
-
-/*
- * GLOBALS
- */
-
+/* forward/static */
+static void _XcmsFreeDefaultCCCs(Display *dpy);
/************************************************************************
@@ -71,8 +63,8 @@ static void _XcmsFreeDefaultCCCs();
* SYNOPSIS
*/
XPointer *
-_XcmsCopyPointerArray(pap)
- XPointer *pap;
+_XcmsCopyPointerArray(
+ XPointer *pap)
/*
* DESCRIPTION
* Copies an array of NULL terminated pointers.
@@ -104,8 +96,8 @@ _XcmsCopyPointerArray(pap)
* SYNOPSIS
*/
void
-_XcmsFreePointerArray(pap)
- XPointer *pap;
+_XcmsFreePointerArray(
+ XPointer *pap)
/*
* DESCRIPTION
* Frees an array of NULL terminated pointers.
@@ -125,10 +117,10 @@ _XcmsFreePointerArray(pap)
* SYNOPSIS
*/
XPointer *
-_XcmsPushPointerArray(pap, p, papNoFree)
- XPointer *pap;
- XPointer p;
- XPointer *papNoFree;
+_XcmsPushPointerArray(
+ XPointer *pap,
+ XPointer p,
+ XPointer *papNoFree)
/*
* DESCRIPTION
* Places the specified pointer at the head of an array of NULL
@@ -167,8 +159,8 @@ _XcmsPushPointerArray(pap, p, papNoFree)
* SYNOPSIS
*/
int
-_XcmsInitDefaultCCCs(dpy)
- Display *dpy;
+_XcmsInitDefaultCCCs(
+ Display *dpy)
/*
* DESCRIPTION
* Initializes the Xcms per Display Info structure
@@ -228,8 +220,8 @@ _XcmsInitDefaultCCCs(dpy)
* SYNOPSIS
*/
static void
-_XcmsFreeDefaultCCCs(dpy)
- Display *dpy;
+_XcmsFreeDefaultCCCs(
+ Display *dpy)
/*
* DESCRIPTION
* This routine frees the default XcmsCCC's associated with
@@ -287,9 +279,9 @@ _XcmsFreeDefaultCCCs(dpy)
* SYNOPSIS
*/
int
-_XcmsInitScrnInfo(dpy, screenNumber)
- register Display *dpy;
- int screenNumber;
+_XcmsInitScrnInfo(
+ register Display *dpy,
+ int screenNumber)
/*
* DESCRIPTION
* Given a display and screen number, this routine attempts
@@ -360,8 +352,8 @@ _XcmsInitScrnInfo(dpy, screenNumber)
* SYNOPSIS
*/
void
-_XcmsFreeIntensityMaps(dpy)
- Display *dpy;
+_XcmsFreeIntensityMaps(
+ Display *dpy)
/*
* DESCRIPTION
* Frees all XcmsIntensityMap structures in the linked list
@@ -393,9 +385,9 @@ _XcmsFreeIntensityMaps(dpy)
* SYNOPSIS
*/
XcmsIntensityMap *
-_XcmsGetIntensityMap(dpy, visual)
- Display *dpy;
- Visual *visual;
+_XcmsGetIntensityMap(
+ Display *dpy,
+ Visual *visual)
/*
* DESCRIPTION
* Attempts to return a per-Visual intensity map.
diff --git a/src/xcms/cmsLkCol.c b/src/xcms/cmsLkCol.c
index eb9669ff..8b3f5346 100644
--- a/src/xcms/cmsLkCol.c
+++ b/src/xcms/cmsLkCol.c
@@ -32,22 +32,14 @@
*
*
*/
+/* $XFree86: xc/lib/X11/cmsLkCol.c,v 1.5 2003/04/13 19:22:20 dawes Exp $ */
#define NEED_REPLIES
#include <stdio.h>
#include "Xlibint.h"
#include "Xcmsint.h"
+#include "Cv.h"
-/*
- * EXTERNS
- */
-extern void _XColor_to_XcmsRGB();
-extern void _XcmsRGB_to_XColor();
-extern void _XcmsResolveColor();
-extern void _XcmsUnresolveColor();
-#ifdef X_NOT_STDC_ENV
-extern char *getenv();
-#endif
/*
* NAME
@@ -55,7 +47,6 @@ extern char *getenv();
*
* SYNOPSIS
*/
-#if NeedFunctionPrototypes
Status
XcmsLookupColor (
Display *dpy,
@@ -64,17 +55,6 @@ XcmsLookupColor (
XcmsColor *pColor_exact_return,
XcmsColor *pColor_scrn_return,
XcmsColorFormat result_format)
-#else
-Status
-XcmsLookupColor(dpy, cmap, colorname, pColor_exact_return, pColor_scrn_return,
- result_format)
- Display *dpy;
- Colormap cmap;
- char *colorname;
- XcmsColor *pColor_exact_return;
- XcmsColor *pColor_scrn_return;
- XcmsColorFormat result_format;
-#endif
/*
* DESCRIPTION
* The XcmsLookupColor function finds the color specification
diff --git a/src/xcms/cmsMath.c b/src/xcms/cmsMath.c
index fd09cec1..04c0aea7 100644
--- a/src/xcms/cmsMath.c
+++ b/src/xcms/cmsMath.c
@@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+/* $XFree86: xc/lib/X11/cmsMath.c,v 3.4 2001/07/29 05:01:11 tsi Exp $ */
/*
* Stephen Gildea, MIT X Consortium, January 1991
@@ -33,9 +34,7 @@ in this Software without prior written authorization from The Open Group.
#include "Xlibint.h"
#include "Xcmsint.h"
-#if !defined(X_NOT_STDC_ENV) && (defined(__STDC__) || !(defined(sun) || (defined(sony) && !defined(SYSTYPE_SYSV) && !defined(_SYSTYPE_SYSV))))
#include <float.h>
-#endif
#ifndef DBL_EPSILON
#define DBL_EPSILON 1e-6
#endif
diff --git a/src/xcms/cmsProp.c b/src/xcms/cmsProp.c
index 28d7a880..7af729a7 100644
--- a/src/xcms/cmsProp.c
+++ b/src/xcms/cmsProp.c
@@ -31,10 +31,12 @@
* This utility routines for manipulating properties.
*
*/
+/* $XFree86$ */
#include <X11/Xatom.h>
#include "Xlibint.h"
#include "Xcmsint.h"
+#include "Cv.h"
/************************************************************************
@@ -51,10 +53,10 @@
* SYNOPSIS
*/
unsigned long
-_XcmsGetElement (format, pValue, pCount)
- int format;
- char **pValue;
- unsigned long *pCount;
+_XcmsGetElement(
+ int format,
+ char **pValue,
+ unsigned long *pCount)
/*
* DESCRIPTION
* Get the next element from the property and return it.
@@ -97,14 +99,14 @@ _XcmsGetElement (format, pValue, pCount)
* SYNOPSIS
*/
int
-_XcmsGetProperty (pDpy, w, property, pFormat, pNItems, pNBytes, pValue)
- Display *pDpy;
- Window w;
- Atom property;
- int *pFormat;
- unsigned long *pNItems;
- unsigned long *pNBytes;
- char **pValue;
+_XcmsGetProperty(
+ Display *pDpy,
+ Window w,
+ Atom property,
+ int *pFormat,
+ unsigned long *pNItems,
+ unsigned long *pNBytes,
+ char **pValue)
/*
* DESCRIPTION
*
diff --git a/src/xcms/cmsTrig.c b/src/xcms/cmsTrig.c
index a1e9b50c..6ff60e9e 100644
--- a/src/xcms/cmsTrig.c
+++ b/src/xcms/cmsTrig.c
@@ -24,6 +24,7 @@
* CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE.
*/
+/* $XFree86: xc/lib/X11/cmsTrig.c,v 3.8 2001/10/28 03:32:34 tsi Exp $ */
/*
* It should be pointed out that for simplicity's sake, the
* environment parameters are defined as floating point constants,
@@ -44,30 +45,22 @@
*
*/
-/*
- * EXTERNS
- */
-extern double _XcmsSquareRoot();
+#include "Xcmsint.h"
-/*
- * FORWARD DECLARATIONS
- */
-double _XcmsCosine();
-static double _XcmsModulo();
-static double _XcmsModuloF();
-static double _XcmsPolynomial();
-double _XcmsSine();
-double _XcmsArcTangent();
+/* forward/static */
+static double _XcmsModulo(double value, double base);
+static double _XcmsPolynomial(
+ register int order,
+ double const *coeffs,
+ double x);
+static double
+_XcmsModuloF(
+ double val,
+ register double *dp);
/*
* DEFINES
*/
-
-#ifdef __STDC__
-#define Const const
-#else
-#define Const /**/
-#endif
#define XCMS_MAXERROR 0.000001
#define XCMS_MAXITER 10000
#define XCMS_PI 3.14159265358979323846264338327950
@@ -90,35 +83,35 @@ double _XcmsArcTangent();
#define XCMS_DMAXPOWTWO ((double)(1 < 47))
#else
#define XCMS_DMAXPOWTWO ((double)(XCMS_LONG_MAX) * \
- (1L << (XCMS_NBITS(double)-XCMS_DEXPLEN) - XCMS_NBITS(long) + 1))
+ (1L << ((XCMS_NBITS(double)-XCMS_DEXPLEN) - XCMS_NBITS(int) + 1)))
#endif
/*
* LOCAL VARIABLES
*/
-static double Const cos_pcoeffs[] = {
+static double const cos_pcoeffs[] = {
0.12905394659037374438e7,
-0.37456703915723204710e6,
0.13432300986539084285e5,
-0.11231450823340933092e3
};
-static double Const cos_qcoeffs[] = {
+static double const cos_qcoeffs[] = {
0.12905394659037373590e7,
0.23467773107245835052e5,
0.20969518196726306286e3,
1.0
};
-static double Const sin_pcoeffs[] = {
+static double const sin_pcoeffs[] = {
0.20664343336995858240e7,
-0.18160398797407332550e6,
0.35999306949636188317e4,
-0.20107483294588615719e2
};
-static double Const sin_qcoeffs[] = {
+static double const sin_qcoeffs[] = {
0.26310659102647698963e7,
0.39270242774649000308e5,
0.27811919481083844087e3,
@@ -232,8 +225,7 @@ static double Const sin_qcoeffs[] = {
*
*/
-double _XcmsCosine (x)
-double x;
+double _XcmsCosine(double x)
{
auto double y;
auto double yt2;
@@ -293,9 +285,7 @@ double x;
* Fred Fish
*
*/
-static double _XcmsModulo (value, base)
-double value;
-double base;
+static double _XcmsModulo(double value, double base)
{
auto double intpart;
@@ -316,12 +306,16 @@ double base;
* defined in "math.h".
*/
static double
-_XcmsModuloF(val, dp)
-double val;
-register double *dp;
+_XcmsModuloF(
+ double val,
+ register double *dp)
{
register double abs;
- register double ip;
+ /*
+ * Don't use a register for this. The extra precision this results
+ * in on some systems causes problems.
+ */
+ double ip;
/* should check for illegal values here - nan, inf, etc */
abs = XCMS_FABS(val);
@@ -377,10 +371,10 @@ register double *dp;
*
*/
-static double _XcmsPolynomial (order, coeffs, x)
-register int order;
-double Const *coeffs;
-double x;
+static double _XcmsPolynomial(
+ register int order,
+ double const *coeffs,
+ double x)
{
auto double rtn_value;
@@ -567,7 +561,7 @@ _XcmsArcTangent(x)
* Returns the arctangent
*/
{
- double ai, a1, bi, b1, l, d;
+ double ai, a1 = 0.0, bi, b1 = 0.0, l, d;
double maxerror;
int i;
diff --git a/src/xcms/uvY.c b/src/xcms/uvY.c
index 3438d88d..d589b407 100644
--- a/src/xcms/uvY.c
+++ b/src/xcms/uvY.c
@@ -35,24 +35,20 @@
* DOCUMENTATION
* "TekColor Color Management System, System Implementor's Manual"
*/
+/* $XFree86: xc/lib/X11/uvY.c,v 1.3 2001/01/17 19:41:57 dawes Exp $ */
#include <X11/Xos.h>
#include "Xlibint.h"
#include "Xcmsint.h"
+#include "Cv.h"
-
-/*
- * EXTERNS
- */
-extern char _XcmsCIEuvY_prefix[];
-
+#include <stdio.h>
/*
* FORWARD DECLARATIONS
*/
+static int CIEuvY_ParseString(register char *spec, XcmsColor *pColor);
-static int CIEuvY_ParseString();
-Status _XcmsCIEuvY_ValidSpec();
/*
* DEFINES
* Internal definitions that need NOT be exported to any package
@@ -118,9 +114,9 @@ XcmsColorSpace XcmsCIEuvYColorSpace =
* SYNOPSIS
*/
static int
-CIEuvY_ParseString(spec, pColor)
- register char *spec;
- XcmsColor *pColor;
+CIEuvY_ParseString(
+ register char *spec,
+ XcmsColor *pColor)
/*
* DESCRIPTION
* This routines takes a string and attempts to convert
@@ -181,8 +177,8 @@ CIEuvY_ParseString(spec, pColor)
* SYNOPSIS
*/
Status
-_XcmsCIEuvY_ValidSpec(pColor)
- XcmsColor *pColor;
+_XcmsCIEuvY_ValidSpec(
+ XcmsColor *pColor)
/*
* DESCRIPTION
* Checks if color specification valid for CIE u'v'Y.
diff --git a/src/xcms/xyY.c b/src/xcms/xyY.c
index 00bd8413..749a05bb 100644
--- a/src/xcms/xyY.c
+++ b/src/xcms/xyY.c
@@ -34,11 +34,13 @@
* DOCUMENTATION
* "TekColor Color Management System, System Implementor's Manual"
*/
+/* $XFree86: xc/lib/X11/xyY.c,v 1.3 2001/01/17 19:41:57 dawes Exp $ */
#include <stdio.h>
#include <X11/Xos.h>
#include "Xlibint.h"
#include "Xcmsint.h"
+#include "Cv.h"
/*
* DEFINES
@@ -51,17 +53,11 @@
#endif
/*
- * EXTERNS
- */
-
-extern char _XcmsCIExyY_prefix[];
-
-/*
* FORWARD DECLARATIONS
*/
-static int CIExyY_ParseString();
-static Status XcmsCIExyY_ValidSpec();
+static int CIExyY_ParseString(register char *spec, XcmsColor *pColor);
+static Status XcmsCIExyY_ValidSpec(XcmsColor *pColor);
/*
@@ -117,9 +113,9 @@ XcmsColorSpace XcmsCIExyYColorSpace =
* SYNOPSIS
*/
static int
-CIExyY_ParseString(spec, pColor)
- register char *spec;
- XcmsColor *pColor;
+CIExyY_ParseString(
+ register char *spec,
+ XcmsColor *pColor)
/*
* DESCRIPTION
* This routines takes a string and attempts to convert
@@ -181,8 +177,8 @@ CIExyY_ParseString(spec, pColor)
* SYNOPSIS
*/
static Status
-XcmsCIExyY_ValidSpec(pColor)
- XcmsColor *pColor;
+XcmsCIExyY_ValidSpec(
+ XcmsColor *pColor)
/*
* DESCRIPTION
* Checks a valid CIExyY color specification.
diff --git a/src/xkb/XKB.c b/src/xkb/XKB.c
index 22a8731f..20936198 100644
--- a/src/xkb/XKB.c
+++ b/src/xkb/XKB.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/lib/X11/XKB.c,v 1.9 2003/04/17 02:06:31 dawes Exp $ */
#include <stdio.h>
#define NEED_REPLIES
@@ -36,23 +37,12 @@ XkbInternAtomFunc _XkbInternAtomFunc= XInternAtom;
XkbGetAtomNameFunc _XkbGetAtomNameFunc= XGetAtomName;
Bool
-#if NeedFunctionPrototypes
XkbQueryExtension( Display *dpy,
int * opcodeReturn,
int * eventBaseReturn,
int * errorBaseReturn,
int * majorReturn,
int * minorReturn)
-#else
-XkbQueryExtension(dpy,opcodeReturn,eventBaseReturn,errorBaseReturn,
- majorReturn,minorReturn)
- Display *dpy;
- int *opcodeReturn;
- int *eventBaseReturn;
- int *errorBaseReturn;
- int *majorReturn;
- int *minorReturn;
-#endif
{
if (!XkbUseExtension(dpy,majorReturn,minorReturn))
return False;
@@ -70,13 +60,7 @@ XkbQueryExtension(dpy,opcodeReturn,eventBaseReturn,errorBaseReturn,
}
Bool
-#if NeedFunctionPrototypes
XkbLibraryVersion(int *libMajorRtrn,int *libMinorRtrn)
-#else
-XkbLibraryVersion(libMajorRtrn,libMinorRtrn)
- int *libMajorRtrn;
- int *libMinorRtrn;
-#endif
{
int supported;
@@ -96,18 +80,10 @@ int supported;
}
Bool
-#if NeedFunctionPrototypes
XkbSelectEvents( Display * dpy,
unsigned int deviceSpec,
unsigned int affect,
unsigned int selectAll)
-#else
-XkbSelectEvents(dpy,deviceSpec,affect,selectAll)
- Display *dpy;
- unsigned int deviceSpec;
- unsigned int affect;
- unsigned int selectAll;
-#endif
{
register xkbSelectEventsReq *req;
XkbInfoPtr xkbi;
@@ -154,24 +130,15 @@ XkbSelectEvents(dpy,deviceSpec,affect,selectAll)
}
Bool
-#if NeedFunctionPrototypes
XkbSelectEventDetails( Display * dpy,
unsigned deviceSpec,
unsigned eventType,
unsigned long int affect,
unsigned long int details)
-#else
-XkbSelectEventDetails(dpy,deviceSpec,eventType,affect,details)
- Display *dpy;
- unsigned deviceSpec;
- unsigned eventType;
- unsigned long int affect;
- unsigned long int details;
-#endif
{
register xkbSelectEventsReq *req;
XkbInfoPtr xkbi;
- int size;
+ int size = 0;
char *out;
union {
CARD8 *c8;
@@ -255,18 +222,10 @@ XkbSelectEventDetails(dpy,deviceSpec,eventType,affect,details)
}
Bool
-#if NeedFunctionPrototypes
XkbLockModifiers( Display * dpy,
unsigned int deviceSpec,
unsigned int affect,
unsigned int values)
-#else
-XkbLockModifiers(dpy,deviceSpec,affect,values)
- Display *dpy;
- unsigned int deviceSpec;
- unsigned int affect;
- unsigned int values;
-#endif
{
register xkbLatchLockStateReq *req;
XkbInfoPtr xkbi;
@@ -294,18 +253,10 @@ XkbLockModifiers(dpy,deviceSpec,affect,values)
}
Bool
-#if NeedFunctionPrototypes
XkbLatchModifiers( Display * dpy,
unsigned int deviceSpec,
unsigned int affect,
unsigned int values)
-#else
-XkbLatchModifiers(dpy,deviceSpec,affect,values)
- Display *dpy;
- unsigned int deviceSpec;
- unsigned int affect;
- unsigned int values;
-#endif
{
register xkbLatchLockStateReq *req;
XkbInfoPtr xkbi;
@@ -335,14 +286,7 @@ XkbLatchModifiers(dpy,deviceSpec,affect,values)
}
Bool
-#if NeedFunctionPrototypes
XkbLockGroup(Display *dpy,unsigned int deviceSpec,unsigned int group)
-#else
-XkbLockGroup(dpy,deviceSpec,group)
- Display *dpy;
- unsigned int deviceSpec;
- unsigned int group;
-#endif
{
register xkbLatchLockStateReq *req;
XkbInfoPtr xkbi;
@@ -370,14 +314,7 @@ XkbLockGroup(dpy,deviceSpec,group)
}
Bool
-#if NeedFunctionPrototypes
XkbLatchGroup(Display *dpy,unsigned int deviceSpec,unsigned int group)
-#else
-XkbLatchGroup(dpy,deviceSpec,group)
- Display *dpy;
- unsigned int deviceSpec;
- unsigned int group;
-#endif
{
register xkbLatchLockStateReq *req;
XkbInfoPtr xkbi;
@@ -407,18 +344,12 @@ XkbLatchGroup(dpy,deviceSpec,group)
}
unsigned
-#if NeedFunctionPrototypes
XkbSetXlibControls(Display *dpy,unsigned affect,unsigned values)
-#else
-XkbSetXlibControls(dpy,affect,values)
- Display * dpy;
- unsigned affect;
- unsigned values;
-#endif
{
- if ((dpy->flags & XlibDisplayNoXkb) ||
- (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)))
- return False;
+ if (!dpy->xkb_info)
+ XkbUseExtension(dpy,NULL,NULL);
+ if (!dpy->xkb_info)
+ return 0;
affect&= XkbLC_AllControls;
dpy->xkb_info->xlib_ctrls&= ~affect;
dpy->xkb_info->xlib_ctrls|= (affect&values);
@@ -426,25 +357,17 @@ XkbSetXlibControls(dpy,affect,values)
}
unsigned
-#if NeedFunctionPrototypes
XkbGetXlibControls(Display *dpy)
-#else
-XkbGetXlibControls(dpy)
- Display * dpy;
-#endif
{
- if ((dpy->flags & XlibDisplayNoXkb) ||
- (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)))
+ if (!dpy->xkb_info)
+ XkbUseExtension(dpy,NULL,NULL);
+ if (!dpy->xkb_info)
return 0;
return dpy->xkb_info->xlib_ctrls;
}
unsigned int
-#if NeedFunctionPrototypes
XkbXlibControlsImplemented(void)
-#else
-XkbXlibControlsImplemented()
-#endif
{
#ifdef __sgi
return XkbLC_AllControls;
@@ -454,7 +377,6 @@ XkbXlibControlsImplemented()
}
Bool
-#if NeedFunctionPrototypes
XkbSetDebuggingFlags( Display * dpy,
unsigned int mask,
unsigned int flags,
@@ -463,17 +385,6 @@ XkbSetDebuggingFlags( Display * dpy,
unsigned int ctrls,
unsigned int * rtrn_flags,
unsigned int * rtrn_ctrls)
-#else
-XkbSetDebuggingFlags(dpy,mask,flags,msg,ctrls_mask,ctrls,rtrn_flags,rtrn_ctrls)
- Display * dpy;
- unsigned int mask;
- unsigned int flags;
- char * msg;
- unsigned int ctrls_mask;
- unsigned int ctrls;
- unsigned int * rtrn_flags;
- unsigned int * rtrn_ctrls;
-#endif
{
register xkbSetDebuggingFlagsReq *req;
xkbSetDebuggingFlagsReply rep;
@@ -515,20 +426,13 @@ XkbSetDebuggingFlags(dpy,mask,flags,msg,ctrls_mask,ctrls,rtrn_flags,rtrn_ctrls)
}
Bool
-#if NeedFunctionPrototypes
XkbComputeEffectiveMap( XkbDescPtr xkb,
XkbKeyTypePtr type,
unsigned char * map_rtrn)
-#else
-XkbComputeEffectiveMap(xkb,type,map_rtrn)
- XkbDescPtr xkb;
- XkbKeyTypePtr type;
- unsigned char * map_rtrn;
-#endif
{
register int i;
unsigned tmp;
-XkbKTMapEntryPtr entry;
+XkbKTMapEntryPtr entry = NULL;
if ((!xkb)||(!type)||(!xkb->server))
return False;
@@ -568,14 +472,7 @@ XkbKTMapEntryPtr entry;
}
Status
-#if NeedFunctionPrototypes
XkbGetState(Display *dpy,unsigned deviceSpec,XkbStatePtr rtrn)
-#else
-XkbGetState(dpy,deviceSpec,rtrn)
- Display * dpy;
- unsigned deviceSpec;
- XkbStatePtr rtrn;
-#endif
{
register xkbGetStateReq *req;
xkbGetStateReply rep;
@@ -615,14 +512,7 @@ XkbGetState(dpy,deviceSpec,rtrn)
}
Bool
-#if NeedFunctionPrototypes
XkbSetDetectableAutoRepeat(Display *dpy,Bool detectable,Bool *supported)
-#else
-XkbSetDetectableAutoRepeat(dpy,detectable,supported)
- Display * dpy;
- Bool detectable;
- Bool * supported;
-#endif
{
register xkbPerClientFlagsReq * req;
xkbPerClientFlagsReply rep;
@@ -655,13 +545,7 @@ XkbInfoPtr xkbi;
}
Bool
-#if NeedFunctionPrototypes
XkbGetDetectableAutoRepeat(Display *dpy,Bool *supported)
-#else
-XkbGetDetectableAutoRepeat(dpy,supported)
- Display * dpy;
- Bool * supported;
-#endif
{
register xkbPerClientFlagsReq * req;
xkbPerClientFlagsReply rep;
@@ -692,18 +576,10 @@ XkbInfoPtr xkbi;
}
Bool
-#if NeedFunctionPrototypes
XkbSetAutoResetControls( Display * dpy,
unsigned changes,
unsigned * auto_ctrls,
unsigned * auto_values)
-#else
-XkbSetAutoResetControls(dpy,changes,auto_ctrls,auto_values)
- Display * dpy;
- unsigned changes;
- unsigned * auto_ctrls;
- unsigned * auto_values;
-#endif
{
register xkbPerClientFlagsReq * req;
xkbPerClientFlagsReply rep;
@@ -736,16 +612,9 @@ XkbInfoPtr xkbi;
}
Bool
-#if NeedFunctionPrototypes
XkbGetAutoResetControls( Display * dpy,
unsigned * auto_ctrls,
unsigned * auto_ctrl_values)
-#else
-XkbGetAutoResetControls(dpy,auto_ctrls,auto_ctrl_values)
- Display * dpy;
- unsigned * auto_ctrls;
- unsigned * auto_ctrl_values;
-#endif
{
register xkbPerClientFlagsReq * req;
xkbPerClientFlagsReply rep;
@@ -778,16 +647,9 @@ XkbInfoPtr xkbi;
}
Bool
-#if NeedFunctionPrototypes
XkbSetPerClientControls( Display * dpy,
unsigned change,
unsigned * values)
-#else
-XkbSetPerClientControls(dpy,change,values)
- Display * dpy;
- unsigned change;
- unsigned * values;
-#endif
{
register xkbPerClientFlagsReq * req;
xkbPerClientFlagsReply rep;
@@ -819,14 +681,8 @@ unsigned value_hold = *values;
}
Bool
-#if NeedFunctionPrototypes
XkbGetPerClientControls( Display * dpy,
unsigned * ctrls)
-#else
-XkbGetPerClientControls(dpy,ctrls)
- Display * dpy;
- unsigned * ctrls;
-#endif
{
register xkbPerClientFlagsReq * req;
xkbPerClientFlagsReply rep;
@@ -853,27 +709,19 @@ XkbInfoPtr xkbi;
UnlockDisplay(dpy);
SyncHandle();
if (ctrls)
- *ctrls= (rep.value&XkbPCF_GrabsUseXKBStateMask|XkbPCF_LookupStateWhenGrabbed|XkbPCF_SendEventUsesXKBState);
+ *ctrls= (rep.value & (XkbPCF_GrabsUseXKBStateMask |
+ XkbPCF_LookupStateWhenGrabbed |
+ XkbPCF_SendEventUsesXKBState));
return (True);
}
Display *
-#if NeedFunctionPrototypes
XkbOpenDisplay( char * name,
int * ev_rtrn,
int * err_rtrn,
int * major_rtrn,
int * minor_rtrn,
int * reason)
-#else
-XkbOpenDisplay(name,ev_rtrn,err_rtrn,major_rtrn,minor_rtrn,reason)
- char * name;
- int * ev_rtrn;
- int * err_rtrn;
- int * major_rtrn;
- int * minor_rtrn;
- int * reason;
-#endif
{
Display* dpy;
int major_num,minor_num;
@@ -912,13 +760,7 @@ XkbOpenDisplay(name,ev_rtrn,err_rtrn,major_rtrn,minor_rtrn,reason)
}
void
-#if NeedFunctionPrototypes
XkbSetAtomFuncs(XkbInternAtomFunc getAtom,XkbGetAtomNameFunc getName)
-#else
-XkbSetAtomFuncs(getAtom,getName)
- XkbInternAtomFunc getAtom;
- XkbGetAtomNameFunc getName;
-#endif
{
_XkbInternAtomFunc= (getAtom?getAtom:XInternAtom);
_XkbGetAtomNameFunc= (getName?getName:XGetAtomName);
diff --git a/src/xkb/XKBAlloc.c b/src/xkb/XKBAlloc.c
index 82e98f4b..a6fec50f 100644
--- a/src/xkb/XKBAlloc.c
+++ b/src/xkb/XKBAlloc.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/lib/X11/XKBAlloc.c,v 3.5 2001/01/17 19:41:48 dawes Exp $ */
#ifndef XKB_IN_SERVER
@@ -54,14 +55,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
/*ARGSUSED*/
Status
-#if NeedFunctionPrototypes
XkbAllocCompatMap(XkbDescPtr xkb,unsigned which,unsigned nSI)
-#else
-XkbAllocCompatMap(xkb,which,nSI)
- XkbDescPtr xkb;
- unsigned which;
- unsigned nSI;
-#endif
{
XkbCompatMapPtr compat;
XkbSymInterpretRec *prev_interpret;
@@ -108,14 +102,7 @@ XkbSymInterpretRec *prev_interpret;
void
-#if NeedFunctionPrototypes
XkbFreeCompatMap(XkbDescPtr xkb,unsigned which,Bool freeMap)
-#else
-XkbFreeCompatMap(xkb,which,freeMap)
- XkbDescPtr xkb;
- unsigned which;
- Bool freeMap;
-#endif
{
register XkbCompatMapPtr compat;
@@ -142,15 +129,7 @@ register XkbCompatMapPtr compat;
/***===================================================================***/
Status
-#if NeedFunctionPrototypes
XkbAllocNames(XkbDescPtr xkb,unsigned which,int nTotalRG,int nTotalAliases)
-#else
-XkbAllocNames(xkb,which,nTotalRG,nTotalAliases)
- XkbDescPtr xkb;
- unsigned which;
- int nTotalRG;
- int nTotalAliases;
-#endif
{
XkbNamesPtr names;
@@ -230,14 +209,7 @@ XkbNamesPtr names;
}
void
-#if NeedFunctionPrototypes
XkbFreeNames(XkbDescPtr xkb,unsigned which,Bool freeMap)
-#else
-XkbFreeNames(xkb,which,freeMap)
- XkbDescPtr xkb;
- unsigned which;
- Bool freeMap;
-#endif
{
XkbNamesPtr names;
@@ -286,13 +258,7 @@ XkbNamesPtr names;
/*ARGSUSED*/
Status
-#if NeedFunctionPrototypes
XkbAllocControls(XkbDescPtr xkb,unsigned which)
-#else
-XkbAllocControls(xkb,which)
- XkbDescPtr xkb;
- unsigned which;
-#endif
{
if (xkb==NULL)
return BadMatch;
@@ -307,14 +273,7 @@ XkbAllocControls(xkb,which)
/*ARGSUSED*/
void
-#if NeedFunctionPrototypes
XkbFreeControls(XkbDescPtr xkb,unsigned which,Bool freeMap)
-#else
-XkbFreeControls(xkb,which,freeMap)
- XkbDescPtr xkb;
- unsigned which;
- Bool freeMap;
-#endif
{
if (freeMap && (xkb!=NULL) && (xkb->ctrls!=NULL)) {
_XkbFree(xkb->ctrls);
@@ -326,12 +285,7 @@ XkbFreeControls(xkb,which,freeMap)
/***===================================================================***/
Status
-#if NeedFunctionPrototypes
XkbAllocIndicatorMaps(XkbDescPtr xkb)
-#else
-XkbAllocIndicatorMaps(xkb)
- XkbDescPtr xkb;
-#endif
{
if (xkb==NULL)
return BadMatch;
@@ -344,12 +298,7 @@ XkbAllocIndicatorMaps(xkb)
}
void
-#if NeedFunctionPrototypes
XkbFreeIndicatorMaps(XkbDescPtr xkb)
-#else
-XkbFreeIndicatorMaps(xkb)
- XkbDescPtr xkb;
-#endif
{
if ((xkb!=NULL)&&(xkb->indicators!=NULL)) {
_XkbFree(xkb->indicators);
@@ -361,11 +310,7 @@ XkbFreeIndicatorMaps(xkb)
/***====================================================================***/
XkbDescRec *
-#if NeedFunctionPrototypes
XkbAllocKeyboard(void)
-#else
-XkbAllocKeyboard()
-#endif
{
XkbDescRec *xkb;
@@ -376,14 +321,7 @@ XkbDescRec *xkb;
}
void
-#if NeedFunctionPrototypes
XkbFreeKeyboard(XkbDescPtr xkb,unsigned which,Bool freeAll)
-#else
-XkbFreeKeyboard(xkb,which,freeAll)
- XkbDescPtr xkb;
- unsigned which;
- Bool freeAll;
-#endif
{
if (xkb==NULL)
return;
@@ -411,14 +349,7 @@ XkbFreeKeyboard(xkb,which,freeAll)
/***====================================================================***/
XkbDeviceLedInfoPtr
-#if NeedFunctionPrototypes
XkbAddDeviceLedInfo(XkbDeviceInfoPtr devi,unsigned ledClass,unsigned ledId)
-#else
-XkbAddDeviceLedInfo(devi,ledClass,ledId)
- XkbDeviceInfoPtr devi;
- unsigned ledClass;
- unsigned ledId;
-#endif
{
XkbDeviceLedInfoPtr devli;
register int i;
@@ -456,13 +387,7 @@ register int i;
}
Status
-#if NeedFunctionPrototypes
XkbResizeDeviceButtonActions(XkbDeviceInfoPtr devi,unsigned newTotal)
-#else
-XkbResizeDeviceButtonActions(devi,newTotal)
- XkbDeviceInfoPtr devi;
- unsigned newTotal;
-#endif
{
XkbAction *prev_btn_acts;
@@ -496,14 +421,7 @@ XkbResizeDeviceButtonActions(devi,newTotal)
/*ARGSUSED*/
XkbDeviceInfoPtr
-#if NeedFunctionPrototypes
XkbAllocDeviceInfo(unsigned deviceSpec,unsigned nButtons,unsigned szLeds)
-#else
-XkbAllocDeviceInfo(deviceSpec,nButtons,szLeds)
- unsigned deviceSpec;
- unsigned nButtons;
- unsigned szLeds;
-#endif
{
XkbDeviceInfoPtr devi;
@@ -542,14 +460,7 @@ XkbDeviceInfoPtr devi;
void
-#if NeedFunctionPrototypes
XkbFreeDeviceInfo(XkbDeviceInfoPtr devi,unsigned which,Bool freeDevI)
-#else
-XkbFreeDeviceInfo(devi,which,freeDevI)
- XkbDeviceInfoPtr devi;
- unsigned which;
- Bool freeDevI;
-#endif
{
if (devi) {
if (freeDevI) {
diff --git a/src/xkb/XKBBell.c b/src/xkb/XKBBell.c
index 3b6bb850..4c33b8e2 100644
--- a/src/xkb/XKBBell.c
+++ b/src/xkb/XKBBell.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86$ */
#include <stdio.h>
#define NEED_REPLIES
@@ -34,7 +35,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
Bool
-#if NeedFunctionPrototypes
XkbDeviceBell( Display * dpy,
Window window,
int deviceID,
@@ -42,16 +42,6 @@ XkbDeviceBell( Display * dpy,
int bellID,
int percent,
Atom name)
-#else
-XkbDeviceBell(dpy,window,deviceID,bellClass,bellID,percent,name)
- Display *dpy;
- Window window;
- int deviceID;
- int bellClass;
- int bellID;
- int percent;
- Atom name;
-#endif
{
register xkbBellReq *req;
XkbInfoPtr xkbi;
@@ -81,20 +71,11 @@ XkbDeviceBell(dpy,window,deviceID,bellClass,bellID,percent,name)
}
Bool
-#if NeedFunctionPrototypes
XkbForceDeviceBell( Display * dpy,
int deviceID,
int bellClass,
int bellID,
int percent)
-#else
-XkbForceDeviceBell(dpy,deviceID,bellClass,bellID,percent)
- Display *dpy;
- int deviceID;
- int bellClass;
- int bellID;
- int percent;
-#endif
{
register xkbBellReq *req;
XkbInfoPtr xkbi;
@@ -124,7 +105,6 @@ XkbForceDeviceBell(dpy,deviceID,bellClass,bellID,percent)
}
Bool
-#if NeedFunctionPrototypes
XkbDeviceBellEvent( Display * dpy,
Window window,
int deviceID,
@@ -132,16 +112,6 @@ XkbDeviceBellEvent( Display * dpy,
int bellID,
int percent,
Atom name)
-#else
-XkbDeviceBellEvent(dpy,window,deviceID,bellClass,bellID,percent,name)
- Display *dpy;
- Window window;
- int deviceID;
- int bellClass;
- int bellID;
- int percent;
- Atom name;
-#endif
{
register xkbBellReq *req;
XkbInfoPtr xkbi;
@@ -171,15 +141,7 @@ XkbDeviceBellEvent(dpy,window,deviceID,bellClass,bellID,percent,name)
}
Bool
-#if NeedFunctionPrototypes
XkbBell(Display *dpy,Window window,int percent,Atom name)
-#else
-XkbBell(dpy,window,percent,name)
- Display *dpy;
- Window window;
- int percent;
- Atom name;
-#endif
{
if ((dpy->flags & XlibDisplayNoXkb) ||
(!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL))) {
@@ -191,13 +153,7 @@ XkbBell(dpy,window,percent,name)
}
Bool
-#if NeedFunctionPrototypes
XkbForceBell(Display *dpy,int percent)
-#else
-XkbForceBell(dpy,percent)
- Display * dpy;
- int percent;
-#endif
{
if ((dpy->flags & XlibDisplayNoXkb) ||
(!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL))) {
@@ -209,15 +165,7 @@ XkbForceBell(dpy,percent)
}
Bool
-#if NeedFunctionPrototypes
XkbBellEvent(Display *dpy,Window window,int percent,Atom name)
-#else
-XkbBellEvent(dpy,window,percent,name)
- Display *dpy;
- Window window;
- int percent;
- Atom name;
-#endif
{
if ((dpy->flags & XlibDisplayNoXkb) ||
(!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL))) {
diff --git a/src/xkb/XKBBind.c b/src/xkb/XKBBind.c
index 4c6334a7..ba9f53fa 100644
--- a/src/xkb/XKBBind.c
+++ b/src/xkb/XKBBind.c
@@ -26,9 +26,12 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/lib/X11/XKBBind.c,v 3.19 2003/05/27 22:26:25 tsi Exp $ */
+
/* the new monsters ate the old ones */
#define NEED_EVENTS
+#include "XKBlib.h"
#include <X11/Xlibint.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
@@ -47,9 +50,7 @@ from The Open Group.
Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)
static int _XkbLoadDpy(
-#if NeedFunctionPrototypes
Display *dpy
-#endif
);
struct _XKeytrans {
@@ -63,7 +64,6 @@ struct _XKeytrans {
};
KeySym
-#if NeedFunctionPrototypes
XkbKeycodeToKeysym(Display *dpy,
#if NeedWidePrototypes
unsigned int kc,
@@ -72,13 +72,6 @@ XkbKeycodeToKeysym(Display *dpy,
#endif
int group,
int level)
-#else
-XkbKeycodeToKeysym(dpy, kc, group, level)
- Display *dpy;
- KeyCode kc;
- int group;
- int level;
-#endif
{
XkbDescRec *xkb;
@@ -107,7 +100,6 @@ XkbKeycodeToKeysym(dpy, kc, group, level)
}
KeySym
-#if NeedFunctionPrototypes
XKeycodeToKeysym(Display *dpy,
#if NeedWidePrototypes
unsigned int kc,
@@ -115,12 +107,6 @@ XKeycodeToKeysym(Display *dpy,
KeyCode kc,
#endif
int col)
-#else
-XKeycodeToKeysym(dpy, kc, col)
- Display *dpy;
- KeyCode kc;
- int col;
-#endif
{
XkbDescRec *xkb;
@@ -165,13 +151,7 @@ XKeycodeToKeysym(dpy, kc, col)
}
KeyCode
-#if NeedFunctionPrototypes
XKeysymToKeycode(Display *dpy, KeySym ks)
-#else
-XKeysymToKeycode(dpy, ks)
- Display *dpy;
- KeySym ks;
-#endif
{
register int i, j, gotOne;
@@ -196,12 +176,7 @@ XKeysymToKeycode(dpy, ks)
}
static int
-#if NeedFunctionPrototypes
_XkbComputeModmap(Display *dpy)
-#else
-_XkbComputeModmap(dpy)
- Display *dpy;
-#endif
{
register XkbDescPtr xkb;
@@ -212,13 +187,7 @@ register XkbDescPtr xkb;
}
unsigned
-#if NeedFunctionPrototypes
XkbKeysymToModifiers(Display *dpy,KeySym ks)
-#else
-XkbKeysymToModifiers(dpy,ks)
- Display *dpy;
- KeySym ks;
-#endif
{
XkbDescRec *xkb;
register int i,j;
@@ -247,13 +216,7 @@ XkbKeysymToModifiers(dpy,ks)
}
KeySym
-#if NeedFunctionPrototypes
XLookupKeysym(register XKeyEvent *event, int col)
-#else
-XLookupKeysym(event, col)
- register XKeyEvent *event;
- int col;
-#endif
{
Display *dpy = event->display;
if (_XkbUnavailable(dpy))
@@ -268,39 +231,27 @@ XLookupKeysym(event, col)
* version will continue to work in a shared library environment.
*/
int
-#if NeedFunctionPrototypes
+XkbTranslateKey( register Display * dpy,
+ KeyCode key,
+ register unsigned int mods,
+ unsigned int * mods_rtrn,
+ KeySym * keysym_rtrn);
+int
XkbTranslateKey( register Display * dpy,
KeyCode key,
register unsigned int mods,
unsigned int * mods_rtrn,
KeySym * keysym_rtrn)
-#else
-XkbTranslateKey(dpy, key, mods, mods_rtrn, keysym_rtrn)
- register Display *dpy;
- KeyCode key;
- register unsigned int mods;
- unsigned int *mods_rtrn;
- KeySym *keysym_rtrn;
-#endif
{
return XkbLookupKeySym(dpy,key,mods,mods_rtrn,keysym_rtrn);
}
Bool
-#if NeedFunctionPrototypes
XkbLookupKeySym( register Display * dpy,
KeyCode key,
register unsigned int mods,
unsigned int * mods_rtrn,
KeySym * keysym_rtrn)
-#else
-XkbLookupKeySym(dpy, key, mods, mods_rtrn, keysym_rtrn)
- register Display *dpy;
- KeyCode key;
- register unsigned int mods;
- unsigned int *mods_rtrn;
- KeySym *keysym_rtrn;
-#endif
{
if (_XkbUnavailable(dpy))
return _XTranslateKey(dpy, key, mods, mods_rtrn, keysym_rtrn);
@@ -310,20 +261,11 @@ XkbLookupKeySym(dpy, key, mods, mods_rtrn, keysym_rtrn)
}
Bool
-#if NeedFunctionPrototypes
XkbTranslateKeyCode( register XkbDescPtr xkb,
KeyCode key,
register unsigned int mods,
unsigned int * mods_rtrn,
KeySym * keysym_rtrn)
-#else
-XkbTranslateKeyCode(xkb, key, mods, mods_rtrn, keysym_rtrn)
- register XkbDescPtr xkb;
- KeyCode key;
- register unsigned int mods;
- unsigned int *mods_rtrn;
- KeySym *keysym_rtrn;
-#endif
{
XkbKeyTypeRec *type;
int col,nKeyGroups;
@@ -398,12 +340,7 @@ XkbTranslateKeyCode(xkb, key, mods, mods_rtrn, keysym_rtrn)
}
Status
-#if NeedFunctionPrototypes
XkbRefreshKeyboardMapping(register XkbMapNotifyEvent *event)
-#else
-XkbRefreshKeyboardMapping(event)
- register XkbMapNotifyEvent *event;
-#endif
{
Display *dpy = event->display;
XkbInfoPtr xkbi;
@@ -446,20 +383,18 @@ XkbRefreshKeyboardMapping(event)
}
int
-#if NeedFunctionPrototypes
XRefreshKeyboardMapping(register XMappingEvent *event)
-#else
-XRefreshKeyboardMapping(event)
- register XMappingEvent *event;
-#endif
{
XkbEvent *xkbevent = (XkbEvent *)event;
Display *dpy = event->display;
XkbMapChangesRec changes;
XkbInfoPtr xkbi;
+ /* always do this for input methods, which still use the old keymap */
+ (void) _XRefreshKeyboardMapping(event);
+
if (_XkbUnavailable(dpy))
- return _XRefreshKeyboardMapping(event);
+ return 1;
xkbi = dpy->xkb_info;
@@ -532,6 +467,7 @@ XRefreshKeyboardMapping(event)
UnlockDisplay(dpy);
}
if (event->request==MappingModifier) {
+ LockDisplay(dpy);
if (xkbi->desc->map->modmap) {
_XkbFree(xkbi->desc->map->modmap);
xkbi->desc->map->modmap= NULL;
@@ -556,12 +492,7 @@ XRefreshKeyboardMapping(event)
}
static int
-#if NeedFunctionPrototypes
_XkbLoadDpy(Display *dpy)
-#else
-_XkbLoadDpy(dpy)
- Display *dpy;
-#endif
{
XkbInfoPtr xkbi;
unsigned query,oldEvents;
@@ -582,8 +513,6 @@ _XkbLoadDpy(dpy)
LockDisplay(dpy);
xkbi->desc = desc;
- _XkbGetConverters(_XkbGetCharset(),&xkbi->cvt);
- _XkbGetConverters("ISO8859-1",&xkbi->latin1cvt);
UnlockDisplay(dpy);
oldEvents= xkbi->selected_events;
if (!(xkbi->xlib_ctrls&XkbLC_IgnoreNewKeyboards)) {
@@ -600,12 +529,7 @@ _XkbLoadDpy(dpy)
}
void
-#if NeedFunctionPrototypes
_XkbReloadDpy(Display *dpy)
-#else
-_XkbReloadDpy(dpy)
- Display *dpy;
-#endif
{
XkbInfoPtr xkbi;
XkbDescRec *desc;
@@ -648,56 +572,37 @@ _XkbReloadDpy(dpy)
}
int
-#if NeedFunctionPrototypes
XkbTranslateKeySym( register Display * dpy,
register KeySym * sym_rtrn,
unsigned int mods,
char * buffer,
int nbytes,
int * extra_rtrn)
-#else
-XkbTranslateKeySym(dpy, sym_rtrn, mods, buffer, nbytes, extra_rtrn)
- register Display *dpy;
- register KeySym *sym_rtrn;
- unsigned int mods;
- char *buffer;
- int nbytes;
- int *extra_rtrn;
-#endif
{
register XkbInfoPtr xkb;
XkbKSToMBFunc cvtr;
XPointer priv;
char tmp[4];
- register struct _XKeytrans *p;
int n;
+ xkb= dpy->xkb_info;
+ if (!xkb->cvt.KSToMB) {
+ _XkbGetConverters(_XkbGetCharset(),&xkb->cvt);
+ _XkbGetConverters("ISO8859-1",&xkb->latin1cvt);
+ }
+
if (extra_rtrn)
*extra_rtrn= 0;
- if (_XkbUnavailable(dpy))
- return _XTranslateKeySym(dpy, *sym_rtrn, mods, buffer, nbytes);
- _XkbCheckPendingRefresh(dpy,dpy->xkb_info);
-
- xkb= dpy->xkb_info;
if ((buffer==NULL)||(nbytes==0)) {
buffer= tmp;
nbytes= 4;
}
/* see if symbol rebound, if so, return that string. */
- for (p = dpy->key_bindings; p; p = p->next) {
- if (((mods & AllMods) == p->state) && (*sym_rtrn == p->key)) {
- int tmp = p->len;
- if (tmp > nbytes) {
- if (extra_rtrn)
- *extra_rtrn= tmp-nbytes;
- tmp = nbytes;
- }
- memcpy (buffer, p->string, tmp);
- return tmp;
- }
- }
+ n = XkbLookupKeyBinding(dpy,*sym_rtrn,mods,buffer,nbytes,extra_rtrn);
+ if (n)
+ return n;
if ( nbytes>0 )
buffer[0]= '\0';
@@ -717,35 +622,23 @@ XkbTranslateKeySym(dpy, sym_rtrn, mods, buffer, nbytes, extra_rtrn)
if ((!xkb->cvt.KSToUpper)&&( mods&LockMask )) {
register int i;
-
- if (!xkb->cvt.KSToUpper) {
- int change;
- char ch;
- for (i=change=0;i<n;i++) {
- ch= toupper(buffer[i]);
- change= (change||(buffer[i]!=ch));
- buffer[i] = ch;
- }
- if (change) {
- if (n==1)
- *sym_rtrn=(*xkb->cvt.MBToKS)(xkb->cvt.MBToKSPriv,
- buffer,n,0);
- else *sym_rtrn= NoSymbol;
- }
+ int change;
+ char ch;
+ for (i=change=0;i<n;i++) {
+ ch= toupper(buffer[i]);
+ change= (change||(buffer[i]!=ch));
+ buffer[i] = ch;
+ }
+ if (change) {
+ if (n==1)
+ *sym_rtrn=(*xkb->cvt.MBToKS)(xkb->cvt.MBToKSPriv,buffer,n,0);
+ else *sym_rtrn= NoSymbol;
}
}
if ( mods&ControlMask ) {
if ( n==1 ) {
- register char c = buffer[0];
-
- if ((c >= '@' && c < '\177') || c == ' ') c &= 0x1F;
- else if (c == '2') c = '\000';
- else if (c >= '3' && c <= '7') c -= ('3' - '\033');
- else if (c == '8') c = '\177';
- else if (c == '/') c = '_' & 0x1F;
-
- buffer[0]= c;
+ buffer[0]= XkbToControl(buffer[0]);
if ( nbytes>1 )
buffer[1]= '\0';
return 1;
@@ -758,38 +651,54 @@ XkbTranslateKeySym(dpy, sym_rtrn, mods, buffer, nbytes, extra_rtrn)
}
int
-#if NeedFunctionPrototypes
XLookupString ( register XKeyEvent * event,
char * buffer,
int nbytes,
KeySym * keysym,
XComposeStatus * status)
-#else
-XLookupString (event, buffer, nbytes, keysym, status)
- register XKeyEvent *event;
- char *buffer; /* buffer */
- int nbytes; /* space in buffer for characters */
- KeySym *keysym;
- XComposeStatus *status;
-#endif
{
KeySym dummy;
int rtrnLen;
unsigned int new_mods;
Display *dpy = event->display;
- XkbDescPtr xkb;
-
- if (_XkbUnavailable(dpy))
- return _XLookupString(event, buffer, nbytes, keysym, status);
- _XkbCheckPendingRefresh(dpy,dpy->xkb_info);
if (keysym==NULL)
keysym= &dummy;
- xkb= dpy->xkb_info->desc;
- if (!XkbTranslateKeyCode(xkb,event->keycode,event->state, &new_mods,keysym))
+ if (!XkbLookupKeySym(dpy,event->keycode,event->state, &new_mods,keysym))
return 0;
new_mods= (event->state&(~new_mods));
+ /* find the group where a symbol can be converted to control one */
+ if (new_mods&ControlMask && *keysym > 0x7F &&
+ (dpy->xkb_info->xlib_ctrls & XkbLC_ControlFallback)) {
+ XKeyEvent tmp_ev = *event;
+ KeySym tmp_keysym;
+ unsigned int tmp_new_mods;
+ if (_XkbUnavailable(dpy)) {
+ tmp_ev.state= event->state ^ dpy->mode_switch;
+ if (XkbLookupKeySym(dpy, tmp_ev.keycode, tmp_ev.state,
+ &tmp_new_mods, &tmp_keysym) &&
+ tmp_keysym != NoSymbol && tmp_keysym < 0x80 ) {
+ *keysym = tmp_keysym;
+ }
+ } else {
+ int n = XkbKeyNumGroups(dpy->xkb_info->desc, tmp_ev.keycode);
+ int i;
+ for (i = 0; i < n; i++) {
+ if (XkbGroupForCoreState(event->state) == i)
+ continue;
+ tmp_ev.state= XkbBuildCoreState(tmp_ev.state, i);
+ if (XkbLookupKeySym(dpy, tmp_ev.keycode, tmp_ev.state,
+ &tmp_new_mods, &tmp_keysym) &&
+ tmp_keysym != NoSymbol && tmp_keysym < 0x80 ) {
+ *keysym = tmp_keysym;
+ new_mods= (event->state&(~tmp_new_mods));
+ break;
+ }
+ }
+ }
+ }
+
#ifdef USE_OWN_COMPOSE
if ( status ) {
static int been_here= 0;
@@ -887,44 +796,25 @@ XLookupString (event, buffer, nbytes, keysym, status)
/* We *should* use the new_mods (which does not contain any modifiers */
/* that were used to compute the symbol here, but pre-XKB XLookupString */
/* did not and we have to remain compatible. Sigh. */
- if ((dpy->xkb_info->flags&XkbLC_ConsumeLookupMods)==0)
+ if (_XkbUnavailable(dpy) ||
+ (dpy->xkb_info->xlib_ctrls&XkbLC_ConsumeLookupMods)==0)
new_mods= event->state;
rtrnLen= XkbLookupKeyBinding(dpy,*keysym,new_mods,buffer,nbytes,NULL);
if (rtrnLen>0)
return rtrnLen;
- rtrnLen = XkbTranslateKeySym(dpy,keysym,new_mods,buffer,nbytes,NULL);
- if ((event->state&ControlMask)&&(nbytes>0)&&
- ((rtrnLen==0)||((rtrnLen==1)&&(buffer[0]>=' ')))&&
- (XkbGroupForCoreState(event->state)!=XkbGroup1Index)&&
- (dpy->xkb_info->xlib_ctrls&XkbLC_ControlFallback)) {
- XKeyEvent tmp_ev;
- tmp_ev= *event;
- tmp_ev.state= XkbBuildCoreState(event->state,XkbGroup1Index);
- return XLookupString (&tmp_ev, buffer, nbytes, keysym, status);
- }
- return rtrnLen;
+ return XkbTranslateKeySym(dpy,keysym,new_mods,buffer,nbytes,NULL);
}
int
-#if NeedFunctionPrototypes
XkbLookupKeyBinding( Display * dpy,
register KeySym sym,
unsigned int mods,
char * buffer,
int nbytes,
int * extra_rtrn)
-#else
-XkbLookupKeyBinding(dpy, sym, mods, buffer, nbytes, extra_rtrn)
- Display *dpy;
- register KeySym sym;
- unsigned int mods;
- char *buffer;
- int nbytes;
- int * extra_rtrn;
-#endif
{
register struct _XKeytrans *p;
@@ -947,13 +837,10 @@ XkbLookupKeyBinding(dpy, sym, mods, buffer, nbytes, extra_rtrn)
}
char
-#if NeedFunctionPrototypes
-XkbToControl( char c )
-#else
-XkbToControl( c )
- char c;
-#endif
+XkbToControl( char ch )
{
+ register char c = ch;
+
if ((c >= '@' && c < '\177') || c == ' ') c &= 0x1F;
else if (c == '2') c = '\000';
else if (c >= '3' && c <= '7') c -= ('3' - '\033');
diff --git a/src/xkb/XKBCompat.c b/src/xkb/XKBCompat.c
index 73c7d76d..859e0a0c 100644
--- a/src/xkb/XKBCompat.c
+++ b/src/xkb/XKBCompat.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86$ */
#include <stdio.h>
#define NEED_REPLIES
@@ -34,18 +35,10 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "XKBlibint.h"
Status
-#if NeedFunctionPrototypes
_XkbReadGetCompatMapReply( Display * dpy,
xkbGetCompatMapReply * rep,
XkbDescPtr xkb,
int * nread_rtrn)
-#else
-_XkbReadGetCompatMapReply(dpy,rep,xkb,nread_rtrn)
- Display * dpy;
- xkbGetCompatMapReply * rep;
- XkbDescPtr xkb;
- int * nread_rtrn;
-#endif
{
register int i;
XkbReadBufferRec buf;
@@ -114,14 +107,7 @@ BAILOUT:
}
Status
-#if NeedFunctionPrototypes
XkbGetCompatMap(Display *dpy,unsigned which,XkbDescPtr xkb)
-#else
-XkbGetCompatMap(dpy,which,xkb)
- Display * dpy;
- unsigned which;
- XkbDescPtr xkb;
-#endif
{
register xkbGetCompatMapReq *req;
xkbGetCompatMapReply rep;
@@ -164,14 +150,7 @@ XkbGetCompatMap(dpy,which,xkb)
}
static Bool
-#if NeedFunctionPrototypes
_XkbWriteSetCompatMap(Display *dpy,xkbSetCompatMapReq *req,XkbDescPtr xkb)
-#else
-_XkbWriteSetCompatMap(dpy,req,xkb)
- Display * dpy;
- xkbSetCompatMapReq *req;
- XkbDescPtr xkb;
-#endif
{
CARD16 firstSI;
CARD16 nSI;
@@ -229,15 +208,7 @@ char * buf;
}
Bool
-#if NeedFunctionPrototypes
XkbSetCompatMap(Display *dpy,unsigned which,XkbDescPtr xkb,Bool updateActions)
-#else
-XkbSetCompatMap(dpy,which,xkb,updateActions)
- Display * dpy;
- unsigned which;
- XkbDescPtr xkb;
- Bool updateActions;
-#endif
{
register xkbSetCompatMapReq *req;
Status ok;
diff --git a/src/xkb/XKBCtrls.c b/src/xkb/XKBCtrls.c
index 2e08e50e..bc58316b 100644
--- a/src/xkb/XKBCtrls.c
+++ b/src/xkb/XKBCtrls.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/lib/X11/XKBCtrls.c,v 1.4 2002/12/10 04:33:48 dawes Exp $ */
#include <stdio.h>
#define NEED_REPLIES
@@ -34,14 +35,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
static xkbSetControlsReq *
-#if NeedFunctionPrototypes
_XkbGetSetControlsReq(Display *dpy,XkbInfoPtr xkbi,unsigned int deviceSpec)
-#else
-_XkbGetSetControlsReq(dpy,xkbi,deviceSpec)
- Display * dpy;
- XkbInfoPtr xkbi;
- unsigned int deviceSpec;
-#endif
{
xkbSetControlsReq *req;
@@ -55,18 +49,10 @@ xkbSetControlsReq *req;
}
Bool
-#if NeedFunctionPrototypes
XkbSetAutoRepeatRate( Display *dpy,
unsigned int deviceSpec,
unsigned int timeout,
unsigned int interval)
-#else
-XkbSetAutoRepeatRate(dpy, deviceSpec, timeout, interval)
- Display *dpy;
- unsigned int deviceSpec;
- unsigned int timeout;
- unsigned int interval;
-#endif
{
register xkbSetControlsReq *req;
@@ -84,18 +70,10 @@ XkbSetAutoRepeatRate(dpy, deviceSpec, timeout, interval)
}
Bool
-#if NeedFunctionPrototypes
XkbGetAutoRepeatRate( Display * dpy,
unsigned int deviceSpec,
unsigned int * timeoutp,
unsigned int * intervalp)
-#else
-XkbGetAutoRepeatRate(dpy, deviceSpec, timeoutp, intervalp)
- Display *dpy;
- unsigned int deviceSpec;
- unsigned int *timeoutp;
- unsigned int *intervalp;
-#endif
{
register xkbGetControlsReq *req;
xkbGetControlsReply rep;
@@ -124,23 +102,12 @@ XkbGetAutoRepeatRate(dpy, deviceSpec, timeoutp, intervalp)
}
Bool
-#if NeedFunctionPrototypes
XkbSetServerInternalMods( Display * dpy,
unsigned deviceSpec,
unsigned affectReal,
unsigned realValues,
unsigned affectVirtual,
unsigned virtualValues)
-#else
-XkbSetServerInternalMods(dpy,deviceSpec,
- affectReal,realValues,affectVirtual,virtualValues)
- Display *dpy;
- unsigned deviceSpec;
- unsigned affectReal;
- unsigned realValues;
- unsigned affectVirtual;
- unsigned virtualValues;
-#endif
{
register xkbSetControlsReq *req;
@@ -160,23 +127,12 @@ XkbSetServerInternalMods(dpy,deviceSpec,
}
Bool
-#if NeedFunctionPrototypes
XkbSetIgnoreLockMods( Display * dpy,
unsigned int deviceSpec,
unsigned affectReal,
unsigned realValues,
unsigned affectVirtual,
unsigned virtualValues)
-#else
-XkbSetIgnoreLockMods(dpy,deviceSpec,
- affectReal,realValues,affectVirtual,virtualValues)
- Display *dpy;
- unsigned int deviceSpec;
- unsigned affectReal;
- unsigned realValues;
- unsigned affectVirtual;
- unsigned virtualValues;
-#endif
{
register xkbSetControlsReq *req;
@@ -196,18 +152,10 @@ XkbSetIgnoreLockMods(dpy,deviceSpec,
}
Bool
-#if NeedFunctionPrototypes
XkbChangeEnabledControls( Display * dpy,
unsigned deviceSpec,
unsigned affect,
unsigned values)
-#else
-XkbChangeEnabledControls(dpy,deviceSpec,affect,values)
- Display * dpy;
- unsigned deviceSpec;
- unsigned affect;
- unsigned values;
-#endif
{
register xkbSetControlsReq *req;
@@ -225,14 +173,7 @@ XkbChangeEnabledControls(dpy,deviceSpec,affect,values)
}
Status
-#if NeedFunctionPrototypes
XkbGetControls(Display *dpy, unsigned long which, XkbDescPtr xkb)
-#else
-XkbGetControls(dpy, which, xkb)
- Display *dpy;
- unsigned long which;
- XkbDescPtr xkb;
-#endif
{
register xkbGetControlsReq *req;
xkbGetControlsReply rep;
@@ -303,6 +244,14 @@ XkbGetControls(dpy, which, xkb)
}
if (which&XkbAccessXKeysMask)
ctrls->ax_options= rep.axOptions;
+ if (which&XkbStickyKeysMask) {
+ ctrls->ax_options &= ~XkbAX_SKOptionsMask;
+ ctrls->ax_options |= rep.axOptions & XkbAX_SKOptionsMask;
+ }
+ if (which&XkbAccessXFeedbackMask) {
+ ctrls->ax_options &= ~XkbAX_FBOptionsMask;
+ ctrls->ax_options |= rep.axOptions & XkbAX_FBOptionsMask;
+ }
if (which&XkbAccessXTimeoutMask) {
ctrls->ax_timeout = rep.axTimeout;
ctrls->axt_ctrls_mask = rep.axtCtrlsMask;
@@ -320,14 +269,7 @@ XkbGetControls(dpy, which, xkb)
}
Bool
-#if NeedFunctionPrototypes
XkbSetControls(Display *dpy, unsigned long which, XkbDescPtr xkb)
-#else
-XkbSetControls(dpy, which, xkb)
- Display * dpy;
- unsigned long which;
- XkbDescPtr xkb;
-#endif
{
register xkbSetControlsReq *req;
XkbControlsPtr ctrls;
@@ -393,22 +335,15 @@ XkbSetControls(dpy, which, xkb)
}
UnlockDisplay(dpy);
SyncHandle();
- return False;
+ return True;
}
/***====================================================================***/
void
-#if NeedFunctionPrototypes
XkbNoteControlsChanges( XkbControlsChangesPtr old,
XkbControlsNotifyEvent * new,
unsigned int wanted)
-#else
-XkbNoteControlsChanges(old,new,wanted)
- XkbControlsChangesPtr old;
- XkbControlsNotifyEvent * new;
- unsigned int wanted;
-#endif
{
old->changed_ctrls|= (new->changed_ctrls&wanted);
if (new->changed_ctrls&XkbControlsEnabledMask&wanted)
diff --git a/src/xkb/XKBCvt.c b/src/xkb/XKBCvt.c
index bd965d24..f2347fa8 100644
--- a/src/xkb/XKBCvt.c
+++ b/src/xkb/XKBCvt.c
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/lib/X11/XKBCvt.c,v 3.34 2002/10/08 23:31:35 dawes Exp $ */
#include <stdio.h>
#include <sys/types.h>
@@ -37,6 +38,7 @@ from The Open Group.
#include "Xlibint.h"
#include "Xlcint.h"
#include "XlcPubI.h"
+#include "Ximint.h"
#include <X11/Xutil.h>
#include <X11/Xmd.h>
#define XK_LATIN1
@@ -52,77 +54,8 @@ from The Open Group.
#define XKB_EXTEND_LOOKUP_STRING
#endif
-#ifdef X_NOT_STDC_ENV
-extern char *getenv();
-#endif
-
-#ifdef __STDC__
-#define Const const
-#else
-#define Const /**/
-#endif
-#if defined(__STDC__) && !defined(NORCONST)
-#define RConst const
-#else
-#define RConst /**/
-#endif
-
-/* bit (1<<i) means character is in codeset i at the same codepoint */
-extern unsigned int _Xlatin1[];
-
-/* bit (1<<i) means character is in codeset i at the same codepoint */
-extern unsigned int _Xlatin2[];
-
-/* maps Cyrillic keysyms to KOI8-R */
-extern unsigned char _Xkoi8[];
-
-extern unsigned short _Xkoi8_size;
-
-#define sLatin1 0
-#define sLatin2 1
-#define sLatin3 2
-#define sLatin4 3
-#define sKana 4
-#define sX0201 0x01000004
-#define sArabic 5
-#define sCyrillic 6
-#define sGreek 7
-#define sAPL 11
-#define sHebrew 12
-#define sThai 13
-#define sKorean 14
-#define sLatin5 15
-#define sLatin6 16
-#define sLatin7 17
-#define sLatin8 18
-#define sLatin9 19
-#define sCurrency 32
-
-
-static unsigned long WantLatin1 = sLatin1;
-static unsigned long WantLatin2 = sLatin2;
-static unsigned long WantLatin3 = sLatin3;
-static unsigned long WantLatin4 = sLatin4;
-static unsigned long WantLatin5 = sLatin5;
-static unsigned long WantLatin6 = sLatin6;
-static unsigned long WantKana = sKana;
-static unsigned long WantX0201 = sX0201;
-static unsigned long WantArabic = sArabic;
-static unsigned long WantCyrillic = sCyrillic;
-static unsigned long WantGreek = sGreek;
-static unsigned long WantAPL = sAPL;
-static unsigned long WantHebrew = sHebrew;
-
static int
-#if NeedFunctionPrototypes
_XkbHandleSpecialSym(KeySym keysym, char *buffer, int nbytes, int *extra_rtrn)
-#else
-_XkbHandleSpecialSym(keysym, buffer, nbytes, extra_rtrn)
- KeySym keysym;
- char *buffer;
- int nbytes;
- int * extra_rtrn;
-#endif
{
/* try to convert to Latin-1, handling ctrl */
@@ -149,40 +82,19 @@ _XkbHandleSpecialSym(keysym, buffer, nbytes, extra_rtrn)
return 1;
}
-extern int
-_XGetCharCode (
-#if NeedFunctionPrototypes
- unsigned long, KeySym, char*, int
-#endif
-);
-
/*ARGSUSED*/
-int
-#if NeedFunctionPrototypes
+static int
_XkbKSToKnownSet ( XPointer priv,
KeySym keysym,
char * buffer,
int nbytes,
int * extra_rtrn)
-#else
-_XkbKSToKnownSet (priv, keysym, buffer, nbytes, extra_rtrn)
- XPointer priv;
- KeySym keysym;
- char *buffer;
- int nbytes;
- int *extra_rtrn;
-#endif
{
- unsigned long kset,keysymSet;
- int count,isLatin1;
char tbuf[8],*buf;
if (extra_rtrn)
*extra_rtrn= 0;
- keysymSet = *((unsigned long *)priv);
- kset = keysymSet&0xffffff;
-
/* convert "dead" diacriticals for dumb applications */
if ( (keysym&0xffffff00)== 0xfe00 ) {
switch ( keysym ) {
@@ -207,16 +119,13 @@ _XkbKSToKnownSet (priv, keysym, buffer, nbytes, extra_rtrn)
}
}
- isLatin1 = ((keysym&0xffffff00)==0);
- count = 0;
-
if (nbytes<1) buf= tbuf;
else buf= buffer;
if ((keysym&0xffffff00)==0xff00) {
return _XkbHandleSpecialSym(keysym, buf, nbytes, extra_rtrn);
}
- return _XGetCharCode (keysymSet, keysym, buf, nbytes);
+ return _XimGetCharCode (priv, keysym, (unsigned char *)buf, nbytes);
}
typedef struct _XkbToKS {
@@ -226,15 +135,7 @@ typedef struct _XkbToKS {
/*ARGSUSED*/
static KeySym
-#if NeedFunctionPrototypes
_XkbKnownSetToKS(XPointer priv,char *buffer,int nbytes,Status *status)
-#else
-_XkbKnownSetToKS(priv,buffer,nbytes,status)
- XPointer priv;
- char *buffer;
- int nbytes;
- Status *status;
-#endif
{
if (nbytes!=1)
return NoSymbol;
@@ -251,69 +152,8 @@ _XkbKnownSetToKS(priv,buffer,nbytes,status)
return NoSymbol;
}
-/*ARGSUSED*/
-int
-#if NeedFunctionPrototypes
-_XkbKSToThai ( XPointer priv,
- KeySym keysym,
- char * buffer,
- int nbytes,
- int * extra_rtrn)
-#else
-_XkbKSToThai (priv, keysym, buffer, nbytes, extra_rtrn)
- XPointer priv;
- KeySym keysym;
- char *buffer;
- int nbytes;
- int *extra_rtrn;
-#endif
-{
-
- if ((keysym&0xffffff00)==0xff00) {
- return _XkbHandleSpecialSym(keysym, buffer, nbytes, extra_rtrn);
- }
- else if (((keysym&0xffffff80)==0xd80)||((keysym&0xffffff80)==0)) {
- if (nbytes>0) {
- buffer[0]= (char)(keysym&0xff);
- if (nbytes>1)
- buffer[1]= '\0';
- return 1;
- }
- if (extra_rtrn)
- *extra_rtrn= 1;
- }
- return 0;
-}
-
-/*ARGSUSED*/
-static KeySym
-#if NeedFunctionPrototypes
-_XkbThaiToKS(XPointer priv,char *buffer,int nbytes,Status *status)
-#else
-_XkbThaiToKS(priv,buffer,nbytes,status)
- XPointer priv;
- char *buffer;
- int nbytes;
- Status *status;
-#endif
-{
- if (nbytes!=1)
- return NoSymbol;
- if (((buffer[0]&0x80)==0)&&(buffer[0]>=32))
- return buffer[0];
- else if ((buffer[0]&0x7f)>=32) {
- return 0xd00|buffer[0];
- }
- return NoSymbol;
-}
-
static KeySym
-#if NeedFunctionPrototypes
__XkbDefaultToUpper(KeySym sym)
-#else
-__XkbDefaultToUpper(sym)
- KeySym sym;
-#endif
{
KeySym lower,upper;
@@ -321,129 +161,18 @@ __XkbDefaultToUpper(sym)
return upper;
}
-int _XkbKSToKoi8 (priv, keysym, buffer, nbytes, status)
- XPointer priv;
- KeySym keysym;
- char *buffer;
- int nbytes;
- Status *status;
-{
- if ((keysym&0xffffff00)==0xff00) {
- return _XkbHandleSpecialSym(keysym, buffer, nbytes, status);
- }
- else if (((keysym&0xffffff80)==0x680)||((keysym&0xffffff80)==0)) {
- if (nbytes>0) {
- if ( (keysym&0x80)==0 )
- buffer[0] = keysym&0x7f;
- else buffer[0] = _Xkoi8[keysym & 0x7f];
- if (nbytes>1)
- buffer[1]= '\0';
- return 1;
- }
- }
- return 0;
-}
-
-static KeySym
-_XkbKoi8ToKS(priv,buffer,nbytes,status)
- XPointer priv;
- char *buffer;
- int nbytes;
- Status *status;
-{
- if (nbytes!=1)
- return NoSymbol;
- if (((buffer[0]&0x80)==0)&&(buffer[0]>=32))
- return buffer[0];
- else if ((buffer[0]&0x7f)>=32) {
- register int i;
- for (i=0;i<_Xkoi8_size;i++) {
- if (_Xkoi8[i]==buffer[0])
- return 0x680|i;
- }
- }
- return NoSymbol;
-}
-
-/***====================================================================***/
-
-
-static XkbConverters RConst cvt_ascii = {
- _XkbKSToKnownSet,(XPointer)&WantLatin1,_XkbKnownSetToKS,NULL,__XkbDefaultToUpper
-};
-
-static XkbConverters RConst cvt_latin1 = {
- _XkbKSToKnownSet,(XPointer)&WantLatin1,_XkbKnownSetToKS,NULL,NULL
-};
-
-static XkbConverters RConst cvt_latin2 = {
- _XkbKSToKnownSet,(XPointer)&WantLatin2,_XkbKnownSetToKS,NULL,NULL
-};
-
-static XkbConverters RConst cvt_latin3 = {
- _XkbKSToKnownSet,(XPointer)&WantLatin3,_XkbKnownSetToKS,NULL,NULL
-};
-
-static XkbConverters RConst cvt_latin4 = {
- _XkbKSToKnownSet,(XPointer)&WantLatin4,_XkbKnownSetToKS,NULL,NULL
-};
-
-static XkbConverters RConst cvt_latin5 = {
- _XkbKSToKnownSet,(XPointer)&WantLatin5,_XkbKnownSetToKS,NULL,NULL
-};
-
-static XkbConverters RConst cvt_latin6 = {
- _XkbKSToKnownSet,(XPointer)&WantLatin6,_XkbKnownSetToKS,NULL,NULL
-};
-
-static XkbConverters RConst cvt_kana = {
- _XkbKSToKnownSet,(XPointer)&WantKana,_XkbKnownSetToKS,NULL,NULL
-};
-
-static XkbConverters RConst cvt_X0201 = {
- _XkbKSToKnownSet,(XPointer)&WantX0201,_XkbKnownSetToKS,NULL,NULL
-};
-
-static XkbConverters RConst cvt_Arabic = {
- _XkbKSToKnownSet,(XPointer)&WantArabic,_XkbKnownSetToKS,NULL,NULL
-};
-
-static XkbConverters RConst cvt_Cyrillic = {
- _XkbKSToKnownSet,(XPointer)&WantCyrillic,_XkbKnownSetToKS,NULL,NULL
-};
-
-static XkbConverters RConst cvt_Greek = {
- _XkbKSToKnownSet,(XPointer)&WantGreek,_XkbKnownSetToKS,NULL,NULL
-};
-
-static XkbConverters RConst cvt_APL = {
- _XkbKSToKnownSet,(XPointer)&WantAPL,_XkbKnownSetToKS,NULL,NULL
-};
-
-static XkbConverters RConst cvt_Hebrew = {
- _XkbKSToKnownSet,(XPointer)&WantHebrew,_XkbKnownSetToKS,NULL,NULL
-};
-
-static XkbConverters cvt_Thai = {
- _XkbKSToThai, NULL, _XkbThaiToKS, NULL, NULL
-};
-
-static XkbConverters cvt_Koi8 = {
- _XkbKSToKoi8, NULL, _XkbKoi8ToKS, NULL, NULL
-};
-
+#ifdef XKB_EXTEND_LOOKUP_STRING
static int
-#if NeedFunctionPrototypes
Strcmp(char *str1, char *str2)
-#else
-Strcmp(str1, str2)
- char *str1, *str2;
-#endif
{
char str[256];
char c, *s;
- if (strlen (str1) >= sizeof str) /* almost certain it's a mismatch */
+ /*
+ * unchecked strings from the environment can end up here, so check
+ * the length before copying.
+ */
+ if (strlen(str1) >= sizeof(str)) /* almost certain it's a mismatch */
return 1;
for (s = str; (c = *str1++); ) {
@@ -454,65 +183,18 @@ Strcmp(str1, str2)
*s = '\0';
return (strcmp(str, str2));
}
+#endif
int
-#if NeedFunctionPrototypes
_XkbGetConverters(char *encoding_name, XkbConverters *cvt_rtrn)
-#else
-_XkbGetConverters(encoding_name, cvt_rtrn)
- char *encoding_name;
- XkbConverters *cvt_rtrn;
-#endif
{
- if ( cvt_rtrn ) {
- if ( (encoding_name==NULL) ||
- (Strcmp(encoding_name,"ascii")==0) ||
- (Strcmp(encoding_name,"string")==0) )
- *cvt_rtrn = cvt_ascii;
- else if (Strcmp(encoding_name,"iso8859-1")==0)
- *cvt_rtrn = cvt_latin1;
- else if (Strcmp(encoding_name, "iso8859-2")==0)
- *cvt_rtrn = cvt_latin2;
- else if (Strcmp(encoding_name, "iso8859-3")==0)
- *cvt_rtrn = cvt_latin3;
- else if (Strcmp(encoding_name, "iso8859-4")==0)
- *cvt_rtrn = cvt_latin4;
- else if (Strcmp(encoding_name, "iso8859-5")==0)
- *cvt_rtrn = cvt_Cyrillic;
- else if (Strcmp(encoding_name, "iso8859-6")==0)
- *cvt_rtrn = cvt_Arabic;
- else if (Strcmp(encoding_name, "iso8859-7")==0)
- *cvt_rtrn = cvt_Greek;
- else if (Strcmp(encoding_name, "iso8859-8")==0)
- *cvt_rtrn = cvt_Hebrew;
- else if (Strcmp(encoding_name, "iso8859-9")==0)
- *cvt_rtrn = cvt_latin5;
- else if (Strcmp(encoding_name, "iso8859-10")==0)
- *cvt_rtrn = cvt_latin6;
- else if (Strcmp(encoding_name, "apl")==0)
- *cvt_rtrn = cvt_APL;
-#if 0
- else if (Strcmp(encoding_name, "ja.euc")==0)
- *cvt_rtrn = ???;
- else if (Strcmp(encoding_name, "ja.jis")==0)
- *cvt_rtrn = ???;
- else if (Strcmp(encoding_name, "ja.sjis")==0)
- *cvt_rtrn = ???;
-#endif
- else if (Strcmp(encoding_name, "jisx0201")==0) /* ??? */
- *cvt_rtrn = cvt_X0201;
- else if (Strcmp(encoding_name, "kana")==0) /* ??? */
- *cvt_rtrn = cvt_kana;
- else if ((Strcmp(encoding_name, "tactis")==0) ||
- (Strcmp(encoding_name, "tis620.2533-1")==0))
- *cvt_rtrn = cvt_Thai;
- else if (Strcmp(encoding_name, "koi8-r")==0)
- *cvt_rtrn = cvt_Koi8;
- /* other codesets go here */
- else *cvt_rtrn = cvt_latin1;
- return 1;
- }
- *cvt_rtrn= cvt_latin1;
+ if ( !cvt_rtrn ) return 0;
+
+ cvt_rtrn->KSToMB = _XkbKSToKnownSet;
+ cvt_rtrn->KSToMBPriv = _XimGetLocaleCode(encoding_name);
+ cvt_rtrn->MBToKS = _XkbKnownSetToKS;
+ cvt_rtrn->MBToKSPriv = NULL;
+ cvt_rtrn->KSToUpper = __XkbDefaultToUpper;
return 1;
}
@@ -532,7 +214,7 @@ _XkbGetConverters(encoding_name, cvt_rtrn)
*/
#define CHARSET_FILE "/usr/lib/X11/input/charsets"
-static char *_XkbKnownLanguages = "c=ascii:da,de,en,es,fi,fr,is,it,nl,no,pt,sv=iso8859-1:hu,pl,cs=iso8859-2:bg,ru=iso8859-5:ar,ara=iso8859-6:el=iso8859-7:th,th_TH,th_TH.TACTIS=tactis";
+static char *_XkbKnownLanguages = "c=ascii:da,de,en,es,fr,is,it,nl,no,pt,sv=iso8859-1:hu,pl,cs=iso8859-2:eo=iso8859-3:sp=iso8859-5:ar,ara=iso8859-6:el=iso8859-7:he=iso8859-8:tr=iso8859-9:lt,lv=iso8859-13:et,fi=iso8859-15:ru=koi8-r:uk=koi8-u:th,th_TH,th_TH.iso8859-11=iso8859-11:th_TH.TIS620=tis620:hy=armscii-8:vi=tcvn-5712:ka=georgian-academy:be,bg=microsoft-cp1251";
char *
_XkbGetCharset()
@@ -555,6 +237,9 @@ _XkbGetCharset()
if ( locale == NULL )
return NULL;
+ if (strlen(locale) >= sizeof(lang))
+ return NULL;
+
for (tmp = lang; *tmp = *locale++; tmp++) {
if (isupper(*tmp))
*tmp = tolower(*tmp);
@@ -581,8 +266,13 @@ _XkbGetCharset()
} else {
struct stat sbuf;
FILE *file;
- if ( (stat(CHARSET_FILE,&sbuf)==0) && (sbuf.st_mode&S_IFREG) &&
- (file = fopen(CHARSET_FILE,"r")) ) {
+#ifndef __UNIXOS2__
+ char *cf = CHARSET_FILE;
+#else
+ char *cf = __XOS2RedirRoot(CHARSET_FILE);
+#endif
+ if ( (stat(cf,&sbuf)==0) && (sbuf.st_mode&S_IFREG) &&
+ (file = fopen(cf,"r")) ) {
tmp = _XkbAlloc(sbuf.st_size+1);
if (tmp!=NULL) {
sbuf.st_size = (long)fread(tmp,1,sbuf.st_size,file);
diff --git a/src/xkb/XKBExtDev.c b/src/xkb/XKBExtDev.c
index c4d99681..1bc9a064 100644
--- a/src/xkb/XKBExtDev.c
+++ b/src/xkb/XKBExtDev.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/lib/X11/XKBExtDev.c,v 3.4 2001/10/28 03:32:33 tsi Exp $ */
#include <stdio.h>
#define NEED_REPLIES
@@ -37,16 +38,9 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
/***====================================================================***/
extern void
-#if NeedFunctionPrototypes
XkbNoteDeviceChanges( XkbDeviceChangesPtr old,
XkbExtensionDeviceNotifyEvent * new,
unsigned int wanted)
-#else
-XkbNoteDeviceChanges(old,new,wanted)
- XkbDeviceChangesPtr old;
- XkbExtensionDeviceNotifyEvent * new;
- unsigned int wanted;
-#endif
{
if ((!old)||(!new)||(!wanted)||((new->reason&wanted)==0))
return;
@@ -113,16 +107,9 @@ XkbNoteDeviceChanges(old,new,wanted)
/***====================================================================***/
static Status
-#if NeedFunctionPrototypes
_XkbReadDeviceLedInfo( XkbReadBufferPtr buf,
unsigned present,
XkbDeviceInfoPtr devi)
-#else
-_XkbReadDeviceLedInfo(buf,present,devi)
- XkbReadBufferPtr buf;
- unsigned present;
- XkbDeviceInfoPtr devi;
-#endif
{
register unsigned i,bit;
XkbDeviceLedInfoPtr devli;
@@ -178,16 +165,9 @@ xkbDeviceLedsWireDesc * wireli;
}
static Status
-#if NeedFunctionPrototypes
_XkbReadGetDeviceInfoReply( Display * dpy,
xkbGetDeviceInfoReply * rep,
XkbDeviceInfoPtr devi)
-#else
-_XkbReadGetDeviceInfoReply(dpy,rep,devi)
- Display * dpy;
- xkbGetDeviceInfoReply * rep;
- XkbDeviceInfoPtr devi;
-#endif
{
XkbReadBufferRec buf;
XkbAction * act;
@@ -235,20 +215,11 @@ BAILOUT:
}
XkbDeviceInfoPtr
-#if NeedFunctionPrototypes
XkbGetDeviceInfo( Display * dpy,
unsigned which,
unsigned deviceSpec,
unsigned class,
unsigned id)
-#else
-XkbGetDeviceInfo(dpy,which,deviceSpec,class,id)
- Display * dpy;
- unsigned which;
- unsigned deviceSpec;
- unsigned class;
- unsigned id;
-#endif
{
register xkbGetDeviceInfoReq * req;
xkbGetDeviceInfoReply rep;
@@ -293,16 +264,9 @@ XkbGetDeviceInfo(dpy,which,deviceSpec,class,id)
}
Status
-#if NeedFunctionPrototypes
XkbGetDeviceInfoChanges( Display * dpy,
XkbDeviceInfoPtr devi,
XkbDeviceChangesPtr changes)
-#else
-XkbGetDeviceInfoChanges(dpy,devi,changes)
- Display * dpy;
- XkbDeviceInfoPtr devi;
- XkbDeviceChangesPtr changes;
-#endif
{
register xkbGetDeviceInfoReq * req;
xkbGetDeviceInfoReply rep;
@@ -360,20 +324,11 @@ XkbGetDeviceInfoChanges(dpy,devi,changes)
}
Status
-#if NeedFunctionPrototypes
XkbGetDeviceButtonActions( Display * dpy,
XkbDeviceInfoPtr devi,
Bool all,
unsigned int first,
unsigned int num)
-#else
-XkbGetDeviceButtonActions(dpy,devi,all,first,num)
- Display * dpy;
- XkbDeviceInfoPtr devi;
- Bool all;
- unsigned int first;
- unsigned int num;
-#endif
{
register xkbGetDeviceInfoReq * req;
xkbGetDeviceInfoReply rep;
@@ -410,20 +365,11 @@ XkbGetDeviceButtonActions(dpy,devi,all,first,num)
}
Status
-#if NeedFunctionPrototypes
XkbGetDeviceLedInfo( Display * dpy,
XkbDeviceInfoPtr devi,
unsigned int ledClass,
unsigned int ledId,
unsigned int which)
-#else
-XkbGetDeviceLedInfo(dpy,devi,ledClass,ledId,which)
- Display * dpy;
- XkbDeviceInfoPtr devi;
- unsigned int ledClass;
- unsigned int ledId;
- unsigned int which;
-#endif
{
register xkbGetDeviceInfoReq * req;
xkbGetDeviceInfoReply rep;
@@ -477,14 +423,7 @@ typedef struct _SetLedStuff {
} SetLedStuff;
static void
-#if NeedFunctionPrototypes
_InitLedStuff(SetLedStuff *stuff,unsigned wanted,XkbDeviceInfoPtr devi)
-#else
-_InitLedStuff(stuff,wanted,devi)
- SetLedStuff * stuff;
- unsigned wanted;
- XkbDeviceInfoPtr devi;
-#endif
{
int i;
register XkbDeviceLedInfoPtr devli;
@@ -516,12 +455,7 @@ register XkbDeviceLedInfoPtr devli;
}
static void
-#if NeedFunctionPrototypes
_FreeLedStuff(SetLedStuff *stuff)
-#else
-_FreeLedStuff(stuff)
- SetLedStuff *stuff;
-#endif
{
if ((stuff->num_info>0)&&(stuff->info!=NULL))
_XkbFree(stuff->info);
@@ -530,13 +464,7 @@ _FreeLedStuff(stuff)
}
static int
-#if NeedFunctionPrototypes
_XkbSizeLedInfo(unsigned changed,XkbDeviceLedInfoPtr devli)
-#else
-_XkbSizeLedInfo(changed,devli)
- unsigned changed;
- XkbDeviceLedInfoPtr devli;
-#endif
{
register int i,size;
register unsigned bit,namesNeeded,mapsNeeded;
@@ -559,18 +487,10 @@ register unsigned bit,namesNeeded,mapsNeeded;
}
static Bool
-#if NeedFunctionPrototypes
_SizeMatches( SetLedStuff * stuff,
XkbDeviceLedChangesPtr changes,
int * sz_rtrn,
int * nleds_rtrn)
-#else
-_SizeMatches(stuff,changes,sz_rtrn,nleds_rtrn)
- SetLedStuff * stuff;
- XkbDeviceLedChangesPtr changes;
- int * sz_rtrn;
- int * nleds_rtrn;
-#endif
{
int i,nMatch,class,id;
LedInfoStuff * linfo;
@@ -589,8 +509,10 @@ Bool match;
match= ((class==devli->led_class)||(class==XkbAllXIClasses));
if (devli->led_class==KbdFeedbackClass) dflt= stuff->dflt_kbd_fb;
else dflt= stuff->dflt_led_fb;
- match= match && (id==devli->led_id) || (id==XkbAllXIIds) ||
- ((id==XkbDfltXIId)&&(linfo==dflt));
+ match = (match && (id == devli->led_id)) ||
+ (id == XkbAllXIIds) ||
+ ((id == XkbDfltXIId) &&
+ (linfo == dflt));
if (match) {
if (!linfo->used) {
*sz_rtrn+= _XkbSizeLedInfo(stuff->wanted,devli);
@@ -610,20 +532,11 @@ Bool match;
static Status
-#if NeedFunctionPrototypes
_XkbSetDeviceInfoSize( XkbDeviceInfoPtr devi,
XkbDeviceChangesPtr changes,
SetLedStuff * stuff,
int * sz_rtrn,
int * num_leds_rtrn)
-#else
-_XkbSetDeviceInfoSize(devi,changes,stuff,sz_rtrn,num_leds_rtrn)
- XkbDeviceInfoPtr devi;
- XkbDeviceChangesPtr changes;
- SetLedStuff * stuff;
- int * sz_rtrn;
- int * num_leds_rtrn;
-#endif
{
*sz_rtrn= 0;
if ((changes->changed&XkbXI_ButtonActionsMask)&&(changes->num_btns>0)) {
@@ -652,14 +565,7 @@ _XkbSetDeviceInfoSize(devi,changes,stuff,sz_rtrn,num_leds_rtrn)
}
static char *
-#if NeedFunctionPrototypes
_XkbWriteLedInfo(char *wire,unsigned changed,XkbDeviceLedInfoPtr devli)
-#else
-_XkbWriteLedInfo(wire,changed,devli)
- char * wire;
- unsigned changed;
- XkbDeviceLedInfoPtr devli;
-#endif
{
register int i;
register unsigned bit,namesNeeded,mapsNeeded;
@@ -716,18 +622,10 @@ xkbDeviceLedsWireDesc * lwire;
static int
-#if NeedFunctionPrototypes
_XkbWriteSetDeviceInfo( char * wire,
XkbDeviceChangesPtr changes,
SetLedStuff * stuff,
XkbDeviceInfoPtr devi)
-#else
-_XkbWriteSetDeviceInfo(wire,changes,stuff,devi)
- char * wire;
- XkbDeviceChangesPtr changes;
- SetLedStuff * stuff;
- XkbDeviceInfoPtr devi;
-#endif
{
char *start;
@@ -756,19 +654,12 @@ char *start;
}
Bool
-#if NeedFunctionPrototypes
XkbSetDeviceInfo( Display * dpy,
unsigned which,
XkbDeviceInfoPtr devi)
-#else
-XkbSetDeviceInfo(dpy,which,devi)
- Display * dpy;
- unsigned which;
- XkbDeviceInfoPtr devi;
-#endif
{
register xkbSetDeviceInfoReq *req;
- Status ok;
+ Status ok = 0;
int size,nLeds;
XkbInfoPtr xkbi;
XkbDeviceChangesRec changes;
@@ -818,19 +709,12 @@ XkbSetDeviceInfo(dpy,which,devi)
}
Bool
-#if NeedFunctionPrototypes
XkbChangeDeviceInfo( Display * dpy,
XkbDeviceInfoPtr devi,
XkbDeviceChangesPtr changes)
-#else
-XkbChangeDeviceInfo(dpy,devi,changes)
- Display * dpy;
- XkbDeviceInfoPtr devi;
- XkbDeviceChangesPtr changes;
-#endif
{
register xkbSetDeviceInfoReq *req;
- Status ok;
+ Status ok = 0;
int size,nLeds;
XkbInfoPtr xkbi;
SetLedStuff lstuff;
@@ -873,40 +757,23 @@ XkbChangeDeviceInfo(dpy,devi,changes)
}
Bool
-#if NeedFunctionPrototypes
XkbSetDeviceLedInfo( Display * dpy,
XkbDeviceInfoPtr devi,
unsigned ledClass,
unsigned ledID,
unsigned which)
-#else
-XkbSetDeviceLedInfo(dpy,devi,ledClass,ledID,which)
- Display * dpy;
- XkbDeviceInfoPtr devi;
- unsigned ledClass;
- unsigned ledID;
- unsigned which;
-#endif
{
return False;
}
Bool
-#if NeedFunctionPrototypes
XkbSetDeviceButtonActions( Display * dpy,
XkbDeviceInfoPtr devi,
unsigned int first,
unsigned int nBtns)
-#else
-XkbSetDeviceButtonActions(dpy,devi,first,nBtns)
- Display * dpy;
- XkbDeviceInfoPtr devi;
- unsigned int first;
- unsigned int nBtns;
-#endif
{
register xkbSetDeviceInfoReq *req;
- Status ok;
+ Status ok = 0;
int size,nLeds;
XkbInfoPtr xkbi;
XkbDeviceChangesRec changes;
diff --git a/src/xkb/XKBGAlloc.c b/src/xkb/XKBGAlloc.c
index c89e1197..6aa41d06 100644
--- a/src/xkb/XKBGAlloc.c
+++ b/src/xkb/XKBGAlloc.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/lib/X11/XKBGAlloc.c,v 3.4 2001/01/17 19:41:48 dawes Exp $ */
#define NEED_EVENTS
#define NEED_REPLIES
@@ -57,7 +58,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
/***====================================================================***/
static void
-#if NeedFunctionPrototypes
_XkbFreeGeomLeafElems( Bool freeAll,
int first,
int count,
@@ -65,16 +65,6 @@ _XkbFreeGeomLeafElems( Bool freeAll,
unsigned short * sz_inout,
char ** elems,
unsigned int elem_sz)
-#else
-_XkbFreeGeomLeafElems(freeAll,first,count,num_inout,sz_inout,elems,elem_sz)
- Bool freeAll;
- int first;
- int count;
- unsigned short * num_inout;
- unsigned short * sz_inout;
- char ** elems;
- unsigned int elem_sz;
-#endif
{
if ((freeAll)||(*elems==NULL)) {
*num_inout= *sz_inout= 0;
@@ -105,13 +95,10 @@ _XkbFreeGeomLeafElems(freeAll,first,count,num_inout,sz_inout,elems,elem_sz)
}
typedef void (*ContentsClearFunc)(
-#if NeedFunctionPrototypes
char * /* priv */
-#endif
);
static void
-#if NeedFunctionPrototypes
_XkbFreeGeomNonLeafElems( Bool freeAll,
int first,
int count,
@@ -120,18 +107,6 @@ _XkbFreeGeomNonLeafElems( Bool freeAll,
char ** elems,
unsigned int elem_sz,
ContentsClearFunc freeFunc)
-#else
-_XkbFreeGeomNonLeafElems(freeAll,first,count,num_inout,sz_inout,elems,elem_sz,
- freeFunc)
- Bool freeAll;
- int first;
- int count;
- unsigned short * num_inout;
- unsigned short * sz_inout;
- char ** elems;
- unsigned int elem_sz;
- ContentsClearFunc freeFunc;
-#endif
{
register int i;
register char *ptr;
@@ -176,12 +151,7 @@ register char *ptr;
/***====================================================================***/
static void
-#if NeedFunctionPrototypes
_XkbClearProperty(char *prop_in)
-#else
-_XkbClearProperty(prop_in)
- char * prop_in;
-#endif
{
XkbPropertyPtr prop= (XkbPropertyPtr)prop_in;
@@ -197,18 +167,10 @@ XkbPropertyPtr prop= (XkbPropertyPtr)prop_in;
}
void
-#if NeedFunctionPrototypes
XkbFreeGeomProperties( XkbGeometryPtr geom,
int first,
int count,
Bool freeAll)
-#else
-XkbFreeGeomProperties(geom,first,count,freeAll)
- XkbGeometryPtr geom;
- int first;
- int count;
- Bool freeAll;
-#endif
{
_XkbFreeGeomNonLeafElems(freeAll,first,count,
&geom->num_properties,&geom->sz_properties,
@@ -220,18 +182,10 @@ XkbFreeGeomProperties(geom,first,count,freeAll)
/***====================================================================***/
void
-#if NeedFunctionPrototypes
XkbFreeGeomKeyAliases( XkbGeometryPtr geom,
int first,
int count,
Bool freeAll)
-#else
-XkbFreeGeomKeyAliases(geom,first,count,freeAll)
- XkbGeometryPtr geom;
- int first;
- int count;
- Bool freeAll;
-#endif
{
_XkbFreeGeomLeafElems(freeAll,first,count,
&geom->num_key_aliases,&geom->sz_key_aliases,
@@ -243,12 +197,7 @@ XkbFreeGeomKeyAliases(geom,first,count,freeAll)
/***====================================================================***/
static void
-#if NeedFunctionPrototypes
_XkbClearColor(char *color_in)
-#else
-_XkbClearColor(color_in)
- char * color_in;
-#endif
{
XkbColorPtr color= (XkbColorPtr)color_in;
@@ -258,15 +207,7 @@ XkbColorPtr color= (XkbColorPtr)color_in;
}
void
-#if NeedFunctionPrototypes
XkbFreeGeomColors(XkbGeometryPtr geom,int first,int count,Bool freeAll)
-#else
-XkbFreeGeomColors(geom,first,count,freeAll)
- XkbGeometryPtr geom;
- int first;
- int count;
- Bool freeAll;
-#endif
{
_XkbFreeGeomNonLeafElems(freeAll,first,count,
&geom->num_colors,&geom->sz_colors,
@@ -278,15 +219,7 @@ XkbFreeGeomColors(geom,first,count,freeAll)
/***====================================================================***/
void
-#if NeedFunctionPrototypes
XkbFreeGeomPoints(XkbOutlinePtr outline,int first,int count,Bool freeAll)
-#else
-XkbFreeGeomPoints(outline,first,count,freeAll)
- XkbOutlinePtr outline;
- int first;
- int count;
- Bool freeAll;
-#endif
{
_XkbFreeGeomLeafElems(freeAll,first,count,
&outline->num_points,&outline->sz_points,
@@ -298,12 +231,7 @@ XkbFreeGeomPoints(outline,first,count,freeAll)
/***====================================================================***/
static void
-#if NeedFunctionPrototypes
_XkbClearOutline(char *outline_in)
-#else
-_XkbClearOutline(outline_in)
- char * outline_in;
-#endif
{
XkbOutlinePtr outline= (XkbOutlinePtr)outline_in;
@@ -313,15 +241,7 @@ XkbOutlinePtr outline= (XkbOutlinePtr)outline_in;
}
void
-#if NeedFunctionPrototypes
XkbFreeGeomOutlines(XkbShapePtr shape,int first,int count,Bool freeAll)
-#else
-XkbFreeGeomOutlines(shape,first,count,freeAll)
- XkbShapePtr shape;
- int first;
- int count;
- Bool freeAll;
-#endif
{
_XkbFreeGeomNonLeafElems(freeAll,first,count,
&shape->num_outlines,&shape->sz_outlines,
@@ -334,12 +254,7 @@ XkbFreeGeomOutlines(shape,first,count,freeAll)
/***====================================================================***/
static void
-#if NeedFunctionPrototypes
_XkbClearShape(char *shape_in)
-#else
-_XkbClearShape(shape_in)
- char * shape_in;
-#endif
{
XkbShapePtr shape= (XkbShapePtr)shape_in;
@@ -349,15 +264,7 @@ XkbShapePtr shape= (XkbShapePtr)shape_in;
}
void
-#if NeedFunctionPrototypes
XkbFreeGeomShapes(XkbGeometryPtr geom,int first,int count,Bool freeAll)
-#else
-XkbFreeGeomShapes(geom,first,count,freeAll)
- XkbGeometryPtr geom;
- int first;
- int count;
- Bool freeAll;
-#endif
{
_XkbFreeGeomNonLeafElems(freeAll,first,count,
&geom->num_shapes,&geom->sz_shapes,
@@ -369,15 +276,7 @@ XkbFreeGeomShapes(geom,first,count,freeAll)
/***====================================================================***/
void
-#if NeedFunctionPrototypes
XkbFreeGeomOverlayKeys(XkbOverlayRowPtr row,int first,int count,Bool freeAll)
-#else
-XkbFreeGeomOverlayKeys(row,first,count,freeAll)
- XkbOverlayRowPtr row;
- int first;
- int count;
- Bool freeAll;
-#endif
{
_XkbFreeGeomLeafElems(freeAll,first,count,
&row->num_keys,&row->sz_keys,
@@ -389,12 +288,7 @@ XkbFreeGeomOverlayKeys(row,first,count,freeAll)
/***====================================================================***/
static void
-#if NeedFunctionPrototypes
_XkbClearOverlayRow(char *row_in)
-#else
-_XkbClearOverlayRow(row_in)
- char * row_in;
-#endif
{
XkbOverlayRowPtr row= (XkbOverlayRowPtr)row_in;
@@ -404,15 +298,7 @@ XkbOverlayRowPtr row= (XkbOverlayRowPtr)row_in;
}
void
-#if NeedFunctionPrototypes
XkbFreeGeomOverlayRows(XkbOverlayPtr overlay,int first,int count,Bool freeAll)
-#else
-XkbFreeGeomOverlayRows(overlay,first,count,freeAll)
- XkbOverlayPtr overlay;
- int first;
- int count;
- Bool freeAll;
-#endif
{
_XkbFreeGeomNonLeafElems(freeAll,first,count,
&overlay->num_rows,&overlay->sz_rows,
@@ -424,12 +310,7 @@ XkbFreeGeomOverlayRows(overlay,first,count,freeAll)
/***====================================================================***/
static void
-#if NeedFunctionPrototypes
_XkbClearOverlay(char *overlay_in)
-#else
-_XkbClearOverlay(overlay_in)
- char * overlay_in;
-#endif
{
XkbOverlayPtr overlay= (XkbOverlayPtr)overlay_in;
@@ -439,15 +320,7 @@ XkbOverlayPtr overlay= (XkbOverlayPtr)overlay_in;
}
void
-#if NeedFunctionPrototypes
XkbFreeGeomOverlays(XkbSectionPtr section,int first,int count,Bool freeAll)
-#else
-XkbFreeGeomOverlays(section,first,count,freeAll)
- XkbSectionPtr section;
- int first;
- int count;
- Bool freeAll;
-#endif
{
_XkbFreeGeomNonLeafElems(freeAll,first,count,
&section->num_overlays,&section->sz_overlays,
@@ -459,15 +332,7 @@ XkbFreeGeomOverlays(section,first,count,freeAll)
/***====================================================================***/
void
-#if NeedFunctionPrototypes
XkbFreeGeomKeys(XkbRowPtr row,int first,int count,Bool freeAll)
-#else
-XkbFreeGeomKeys(row,first,count,freeAll)
- XkbRowPtr row;
- int first;
- int count;
- Bool freeAll;
-#endif
{
_XkbFreeGeomLeafElems(freeAll,first,count,
&row->num_keys,&row->sz_keys,
@@ -479,12 +344,7 @@ XkbFreeGeomKeys(row,first,count,freeAll)
/***====================================================================***/
static void
-#if NeedFunctionPrototypes
_XkbClearRow(char *row_in)
-#else
-_XkbClearRow(row_in)
- char * row_in;
-#endif
{
XkbRowPtr row= (XkbRowPtr)row_in;
@@ -494,15 +354,7 @@ XkbRowPtr row= (XkbRowPtr)row_in;
}
void
-#if NeedFunctionPrototypes
XkbFreeGeomRows(XkbSectionPtr section,int first,int count,Bool freeAll)
-#else
-XkbFreeGeomRows(section,first,count,freeAll)
- XkbSectionPtr section;
- int first;
- int count;
- Bool freeAll;
-#endif
{
_XkbFreeGeomNonLeafElems(freeAll,first,count,
&section->num_rows,&section->sz_rows,
@@ -513,12 +365,7 @@ XkbFreeGeomRows(section,first,count,freeAll)
/***====================================================================***/
static void
-#if NeedFunctionPrototypes
_XkbClearSection(char *section_in)
-#else
-_XkbClearSection(section_in)
- char * section_in;
-#endif
{
XkbSectionPtr section= (XkbSectionPtr)section_in;
@@ -532,15 +379,7 @@ XkbSectionPtr section= (XkbSectionPtr)section_in;
}
void
-#if NeedFunctionPrototypes
XkbFreeGeomSections(XkbGeometryPtr geom,int first,int count,Bool freeAll)
-#else
-XkbFreeGeomSections(geom,first,count,freeAll)
- XkbGeometryPtr geom;
- int first;
- int count;
- Bool freeAll;
-#endif
{
_XkbFreeGeomNonLeafElems(freeAll,first,count,
&geom->num_sections,&geom->sz_sections,
@@ -552,12 +391,7 @@ XkbFreeGeomSections(geom,first,count,freeAll)
/***====================================================================***/
static void
-#if NeedFunctionPrototypes
_XkbClearDoodad(char *doodad_in)
-#else
-_XkbClearDoodad(doodad_in)
- char * doodad_in;
-#endif
{
XkbDoodadPtr doodad= (XkbDoodadPtr)doodad_in;
@@ -587,14 +421,7 @@ XkbDoodadPtr doodad= (XkbDoodadPtr)doodad_in;
}
void
-#if NeedFunctionPrototypes
XkbFreeGeomDoodads(XkbDoodadPtr doodads,int nDoodads,Bool freeAll)
-#else
-XkbFreeGeomDoodads(doodads,nDoodads,freeAll)
- XkbDoodadPtr doodads;
- int nDoodads;
- Bool freeAll;
-#endif
{
register int i;
register XkbDoodadPtr doodad;
@@ -610,14 +437,7 @@ register XkbDoodadPtr doodad;
}
void
-#if NeedFunctionPrototypes
XkbFreeGeometry(XkbGeometryPtr geom,unsigned which,Bool freeMap)
-#else
-XkbFreeGeometry(geom,which,freeMap)
- XkbGeometryPtr geom;
- unsigned which;
- Bool freeMap;
-#endif
{
if (geom==NULL)
return;
@@ -651,20 +471,11 @@ XkbFreeGeometry(geom,which,freeMap)
/***====================================================================***/
static Status
-#if NeedFunctionPrototypes
_XkbGeomAlloc( XPointer * old,
unsigned short * num,
unsigned short * total,
int num_new,
Size_t sz_elem)
-#else
-_XkbGeomAlloc(old,num,total,num_new,sz_elem)
- XPointer * old;
- unsigned short * num;
- unsigned short * total;
- int num_new;
- Size_t sz_elem;
-#endif
{
if (num_new<1)
return Success;
@@ -732,181 +543,91 @@ _XkbGeomAlloc(old,num,total,num_new,sz_elem)
(n),sizeof(XkbOverlayKeyRec))
Status
-#if NeedFunctionPrototypes
XkbAllocGeomProps(XkbGeometryPtr geom,int nProps)
-#else
-XkbAllocGeomProps(geom,nProps)
- XkbGeometryPtr geom;
- int nProps;
-#endif
{
return _XkbAllocProps(geom,nProps);
}
Status
-#if NeedFunctionPrototypes
XkbAllocGeomColors(XkbGeometryPtr geom,int nColors)
-#else
-XkbAllocGeomColors(geom,nColors)
- XkbGeometryPtr geom;
- int nColors;
-#endif
{
return _XkbAllocColors(geom,nColors);
}
Status
-#if NeedFunctionPrototypes
XkbAllocGeomKeyAliases(XkbGeometryPtr geom,int nKeyAliases)
-#else
-XkbAllocGeomKeyAliases(geom,nKeyAliases)
- XkbGeometryPtr geom;
- int nKeyAliases;
-#endif
{
return _XkbAllocKeyAliases(geom,nKeyAliases);
}
Status
-#if NeedFunctionPrototypes
XkbAllocGeomShapes(XkbGeometryPtr geom,int nShapes)
-#else
-XkbAllocGeomShapes(geom,nShapes)
- XkbGeometryPtr geom;
- int nShapes;
-#endif
{
return _XkbAllocShapes(geom,nShapes);
}
Status
-#if NeedFunctionPrototypes
XkbAllocGeomSections(XkbGeometryPtr geom,int nSections)
-#else
-XkbAllocGeomSections(geom,nSections)
- XkbGeometryPtr geom;
- int nSections;
-#endif
{
return _XkbAllocSections(geom,nSections);
}
Status
-#if NeedFunctionPrototypes
XkbAllocGeomOverlays(XkbSectionPtr section,int nOverlays)
-#else
-XkbAllocGeomOverlays(section,nOverlays)
- XkbSectionPtr section;
- int nOverlays;
-#endif
{
return _XkbAllocOverlays(section,nOverlays);
}
Status
-#if NeedFunctionPrototypes
XkbAllocGeomOverlayRows(XkbOverlayPtr overlay,int nRows)
-#else
-XkbAllocGeomOverlayRows(overlay,nRows)
- XkbOverlayPtr overlay;
- int nRows;
-#endif
{
return _XkbAllocOverlayRows(overlay,nRows);
}
Status
-#if NeedFunctionPrototypes
XkbAllocGeomOverlayKeys(XkbOverlayRowPtr row,int nKeys)
-#else
-XkbAllocGeomOverlayKeys(row,nKeys)
- XkbOverlayRowPtr row;
- int nKeys;
-#endif
{
return _XkbAllocOverlayKeys(row,nKeys);
}
Status
-#if NeedFunctionPrototypes
XkbAllocGeomDoodads(XkbGeometryPtr geom,int nDoodads)
-#else
-XkbAllocGeomDoodads(geom,nDoodads)
- XkbGeometryPtr geom;
- int nDoodads;
-#endif
{
return _XkbAllocDoodads(geom,nDoodads);
}
Status
-#if NeedFunctionPrototypes
XkbAllocGeomSectionDoodads(XkbSectionPtr section,int nDoodads)
-#else
-XkbAllocGeomSectionDoodads(section,nDoodads)
- XkbSectionPtr section;
- int nDoodads;
-#endif
{
return _XkbAllocDoodads(section,nDoodads);
}
Status
-#if NeedFunctionPrototypes
XkbAllocGeomOutlines(XkbShapePtr shape,int nOL)
-#else
-XkbAllocGeomOutlines(shape,nOL)
- XkbShapePtr shape;
- int nOL;
-#endif
{
return _XkbAllocOutlines(shape,nOL);
}
Status
-#if NeedFunctionPrototypes
XkbAllocGeomRows(XkbSectionPtr section,int nRows)
-#else
-XkbAllocGeomRows(section,nRows)
- XkbSectionPtr section;
- int nRows;
-#endif
{
return _XkbAllocRows(section,nRows);
}
Status
-#if NeedFunctionPrototypes
XkbAllocGeomPoints(XkbOutlinePtr ol,int nPts)
-#else
-XkbAllocGeomPoints(ol,nPts)
- XkbOutlinePtr ol;
- int nPts;
-#endif
{
return _XkbAllocPoints(ol,nPts);
}
Status
-#if NeedFunctionPrototypes
XkbAllocGeomKeys(XkbRowPtr row,int nKeys)
-#else
-XkbAllocGeomKeys(row,nKeys)
- XkbRowPtr row;
- int nKeys;
-#endif
{
return _XkbAllocKeys(row,nKeys);
}
Status
-#if NeedFunctionPrototypes
XkbAllocGeometry(XkbDescPtr xkb,XkbGeometrySizesPtr sizes)
-#else
-XkbAllocGeometry(xkb,sizes)
- XkbDescPtr xkb;
- XkbGeometrySizesPtr sizes;
-#endif
{
XkbGeometryPtr geom;
Status rtrn;
@@ -951,14 +672,7 @@ BAIL:
/***====================================================================***/
XkbPropertyPtr
-#if NeedFunctionPrototypes
XkbAddGeomProperty(XkbGeometryPtr geom,char *name,char *value)
-#else
-XkbAddGeomProperty(geom,name,value)
- XkbGeometryPtr geom;
- char * name;
- char * value;
-#endif
{
register int i;
register XkbPropertyPtr prop;
@@ -996,14 +710,7 @@ register XkbPropertyPtr prop;
}
XkbKeyAliasPtr
-#if NeedFunctionPrototypes
XkbAddGeomKeyAlias(XkbGeometryPtr geom,char *aliasStr,char *realStr)
-#else
-XkbAddGeomKeyAlias(geom,aliasStr,realStr)
- XkbGeometryPtr geom;
- char * aliasStr;
- char * realStr;
-#endif
{
register int i;
register XkbKeyAliasPtr alias;
@@ -1030,14 +737,7 @@ register XkbKeyAliasPtr alias;
}
XkbColorPtr
-#if NeedFunctionPrototypes
XkbAddGeomColor(XkbGeometryPtr geom,char *spec,unsigned int pixel)
-#else
-XkbAddGeomColor(geom,spec,pixel)
- XkbGeometryPtr geom;
- char * spec;
- unsigned int pixel;
-#endif
{
register int i;
register XkbColorPtr color;
@@ -1065,13 +765,7 @@ register XkbColorPtr color;
}
XkbOutlinePtr
-#if NeedFunctionPrototypes
XkbAddGeomOutline(XkbShapePtr shape,int sz_points)
-#else
-XkbAddGeomOutline(shape,sz_points)
- XkbShapePtr shape;
- int sz_points;
-#endif
{
XkbOutlinePtr outline;
@@ -1090,14 +784,7 @@ XkbOutlinePtr outline;
}
XkbShapePtr
-#if NeedFunctionPrototypes
XkbAddGeomShape(XkbGeometryPtr geom,Atom name,int sz_outlines)
-#else
-XkbAddGeomShape(geom,name,sz_outlines)
- XkbGeometryPtr geom;
- Atom name;
- int sz_outlines;
-#endif
{
XkbShapePtr shape;
register int i;
@@ -1124,12 +811,7 @@ register int i;
}
XkbKeyPtr
-#if NeedFunctionPrototypes
XkbAddGeomKey(XkbRowPtr row)
-#else
-XkbAddGeomKey(row)
- XkbRowPtr row;
-#endif
{
XkbKeyPtr key;
if (!row)
@@ -1142,13 +824,7 @@ XkbKeyPtr key;
}
XkbRowPtr
-#if NeedFunctionPrototypes
XkbAddGeomRow(XkbSectionPtr section,int sz_keys)
-#else
-XkbAddGeomRow(section,sz_keys)
- XkbSectionPtr section;
- int sz_keys;
-#endif
{
XkbRowPtr row;
@@ -1166,20 +842,11 @@ XkbRowPtr row;
}
XkbSectionPtr
-#if NeedFunctionPrototypes
XkbAddGeomSection( XkbGeometryPtr geom,
Atom name,
int sz_rows,
int sz_doodads,
int sz_over)
-#else
-XkbAddGeomSection(geom,name,sz_rows,sz_doodads,sz_over)
- XkbGeometryPtr geom;
- Atom name;
- int sz_rows;
- int sz_doodads;
- int sz_over;
-#endif
{
register int i;
XkbSectionPtr section;
@@ -1215,14 +882,7 @@ XkbSectionPtr section;
}
XkbDoodadPtr
-#if NeedFunctionPrototypes
XkbAddGeomDoodad(XkbGeometryPtr geom,XkbSectionPtr section,Atom name)
-#else
-XkbAddGeomDoodad(geom,section,name)
- XkbGeometryPtr geom;
- XkbSectionPtr section;
- Atom name;
-#endif
{
XkbDoodadPtr old,doodad;
register int i,nDoodads;
@@ -1260,18 +920,10 @@ register int i,nDoodads;
}
XkbOverlayKeyPtr
-#if NeedFunctionPrototypes
XkbAddGeomOverlayKey( XkbOverlayPtr overlay,
XkbOverlayRowPtr row,
char * over,
char * under)
-#else
-XkbAddGeomOverlayKey(overlay,row,over,under)
- XkbOverlayPtr overlay;
- XkbOverlayRowPtr row;
- char * over;
- char * under;
-#endif
{
register int i;
XkbOverlayKeyPtr key;
@@ -1303,14 +955,7 @@ Bool found;
}
XkbOverlayRowPtr
-#if NeedFunctionPrototypes
XkbAddGeomOverlayRow(XkbOverlayPtr overlay,int row_under,int sz_keys)
-#else
-XkbAddGeomOverlayRow(overlay,row_under,sz_keys)
- XkbOverlayPtr overlay;
- int row_under;
- int sz_keys;
-#endif
{
register int i;
XkbOverlayRowPtr row;
@@ -1342,14 +987,7 @@ XkbOverlayRowPtr row;
}
XkbOverlayPtr
-#if NeedFunctionPrototypes
XkbAddGeomOverlay(XkbSectionPtr section,Atom name,int sz_rows)
-#else
-XkbAddGeomOverlay(section,name,sz_rows)
- XkbSectionPtr section;
- Atom name;
- int sz_rows;
-#endif
{
register int i;
XkbOverlayPtr overlay;
diff --git a/src/xkb/XKBGeom.c b/src/xkb/XKBGeom.c
index 5cdd6b99..f41823f5 100644
--- a/src/xkb/XKBGeom.c
+++ b/src/xkb/XKBGeom.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/lib/X11/XKBGeom.c,v 1.5 2003/04/13 19:22:18 dawes Exp $ */
#ifdef DEBUG
#include <stdio.h>
@@ -31,10 +32,11 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define NEED_EVENTS
#define NEED_REPLIES
+#define NEED_MAP_READERS
#include "Xlibint.h"
-#include "XKBlibint.h"
#include <X11/extensions/XKBgeom.h>
#include <X11/extensions/XKBproto.h>
+#include "XKBlibint.h"
#ifndef MINSHORT
#define MINSHORT -32768
@@ -46,13 +48,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
/***====================================================================***/
static void
-#if NeedFunctionPrototypes
_XkbCheckBounds(XkbBoundsPtr bounds,int x,int y)
-#else
-_XkbCheckBounds(bounds,x,y)
- XkbBoundsPtr bounds;
- int x,y;
-#endif
{
if (x<bounds->x1) bounds->x1= x;
if (x>bounds->x2) bounds->x2= x;
@@ -62,12 +58,7 @@ _XkbCheckBounds(bounds,x,y)
}
Bool
-#if NeedFunctionPrototypes
XkbComputeShapeBounds(XkbShapePtr shape)
-#else
-XkbComputeShapeBounds(shape)
- XkbShapePtr shape;
-#endif
{
register int o,p;
XkbOutlinePtr outline;
@@ -86,13 +77,7 @@ XkbPointPtr pt;
}
Bool
-#if NeedFunctionPrototypes
XkbComputeShapeTop(XkbShapePtr shape,XkbBoundsPtr bounds)
-#else
-XkbComputeShapeTop(shape,bounds)
- XkbShapePtr shape;
- XkbBoundsPtr bounds;
-#endif
{
register int p;
XkbOutlinePtr outline;
@@ -117,14 +102,7 @@ XkbPointPtr pt;
}
Bool
-#if NeedFunctionPrototypes
XkbComputeRowBounds(XkbGeometryPtr geom,XkbSectionPtr section,XkbRowPtr row)
-#else
-XkbComputeRowBounds(geom,section,row)
- XkbGeometryPtr geom;
- XkbSectionPtr section;
- XkbRowPtr row;
-#endif
{
register int k,pos;
XkbKeyPtr key;
@@ -161,19 +139,13 @@ XkbBoundsPtr bounds,sbounds;
}
Bool
-#if NeedFunctionPrototypes
XkbComputeSectionBounds(XkbGeometryPtr geom,XkbSectionPtr section)
-#else
-XkbComputeSectionBounds(geom,section)
- XkbGeometryPtr geom;
- XkbSectionPtr section;
-#endif
{
register int i;
XkbShapePtr shape;
XkbRowPtr row;
XkbDoodadPtr doodad;
-XkbBoundsPtr bounds,rbounds;
+XkbBoundsPtr bounds,rbounds=NULL;
if ((!geom)||(!section))
return False;
@@ -223,14 +195,7 @@ XkbBoundsPtr bounds,rbounds;
/***====================================================================***/
char *
-#if NeedFunctionPrototypes
XkbFindOverlayForKey(XkbGeometryPtr geom,XkbSectionPtr wanted,char *under)
-#else
-XkbFindOverlayForKey(geom,wanted,under)
- XkbGeometryPtr geom;
- XkbSectionPtr wanted;
- char * under;
-#endif
{
int s;
XkbSectionPtr section;
@@ -270,16 +235,9 @@ XkbSectionPtr section;
/***====================================================================***/
static Status
-#if NeedFunctionPrototypes
_XkbReadGeomProperties( XkbReadBufferPtr buf,
XkbGeometryPtr geom,
xkbGetGeometryReply * rep)
-#else
-_XkbReadGeomProperties(buf,geom,rep)
- XkbReadBufferPtr buf;
- XkbGeometryPtr geom;
- xkbGetGeometryReply * rep;
-#endif
{
Status rtrn;
@@ -302,16 +260,9 @@ Status rtrn;
}
static Status
-#if NeedFunctionPrototypes
_XkbReadGeomKeyAliases( XkbReadBufferPtr buf,
XkbGeometryPtr geom,
xkbGetGeometryReply * rep)
-#else
-_XkbReadGeomKeyAliases(buf,geom,rep)
- XkbReadBufferPtr buf;
- XkbGeometryPtr geom;
- xkbGetGeometryReply * rep;
-#endif
{
Status rtrn;
@@ -331,16 +282,9 @@ Status rtrn;
}
static Status
-#if NeedFunctionPrototypes
_XkbReadGeomColors( XkbReadBufferPtr buf,
XkbGeometryPtr geom,
xkbGetGeometryReply * rep)
-#else
-_XkbReadGeomColors(buf,geom,rep)
- XkbReadBufferPtr buf;
- XkbGeometryPtr geom;
- xkbGetGeometryReply * rep;
-#endif
{
Status rtrn;
@@ -361,16 +305,9 @@ Status rtrn;
}
static Status
-#if NeedFunctionPrototypes
_XkbReadGeomShapes( XkbReadBufferPtr buf,
XkbGeometryPtr geom,
xkbGetGeometryReply * rep)
-#else
-_XkbReadGeomShapes(buf,geom,rep)
- XkbReadBufferPtr buf;
- XkbGeometryPtr geom;
- xkbGetGeometryReply * rep;
-#endif
{
register int i;
Status rtrn;
@@ -426,16 +363,9 @@ Status rtrn;
}
static Status
-#if NeedFunctionPrototypes
_XkbReadGeomDoodad( XkbReadBufferPtr buf,
XkbGeometryPtr geom,
XkbSectionPtr section)
-#else
-_XkbReadGeomDoodad(buf,geom,section)
- XkbReadBufferPtr buf;
- XkbGeometryPtr geom;
- XkbSectionPtr section;
-#endif
{
XkbDoodadPtr doodad;
xkbDoodadWireDesc * doodadWire;
@@ -485,16 +415,9 @@ xkbDoodadWireDesc * doodadWire;
}
static Status
-#if NeedFunctionPrototypes
_XkbReadGeomOverlay( XkbReadBufferPtr buf,
XkbGeometryPtr geom,
XkbSectionPtr section)
-#else
-_XkbReadGeomOverlay(buf,geom,section)
- XkbReadBufferPtr buf;
- XkbGeometryPtr geom;
- XkbSectionPtr section;
-#endif
{
XkbOverlayPtr ol;
xkbOverlayWireDesc * olWire;
@@ -538,16 +461,9 @@ register int r;
}
static Status
-#if NeedFunctionPrototypes
_XkbReadGeomSections( XkbReadBufferPtr buf,
XkbGeometryPtr geom,
xkbGetGeometryReply * rep)
-#else
-_XkbReadGeomSections(buf,geom,rep)
- XkbReadBufferPtr buf;
- XkbGeometryPtr geom;
- xkbGetGeometryReply * rep;
-#endif
{
register int s;
XkbSectionPtr section;
@@ -628,16 +544,9 @@ Status rtrn;
}
static Status
-#if NeedFunctionPrototypes
_XkbReadGeomDoodads( XkbReadBufferPtr buf,
XkbGeometryPtr geom,
xkbGetGeometryReply * rep)
-#else
-_XkbReadGeomDoodads(buf,geom,rep)
- XkbReadBufferPtr buf;
- XkbGeometryPtr geom;
- xkbGetGeometryReply * rep;
-#endif
{
register int d;
Status rtrn;
@@ -654,18 +563,10 @@ Status rtrn;
}
Status
-#if NeedFunctionPrototypes
_XkbReadGetGeometryReply( Display * dpy,
xkbGetGeometryReply * rep,
XkbDescPtr xkb,
int * nread_rtrn)
-#else
-_XkbReadGetGeometryReply(dpy,rep,xkb,nread_rtrn)
- Display * dpy;
- xkbGetGeometryReply * rep;
- XkbDescPtr xkb;
- int * nread_rtrn;
-#endif
{
XkbGeometryPtr geom;
@@ -721,13 +622,7 @@ XkbGeometryPtr geom;
}
Status
-#if NeedFunctionPrototypes
XkbGetGeometry(Display *dpy,XkbDescPtr xkb)
-#else
-XkbGetGeometry(dpy,xkb)
- Display * dpy;
- XkbDescPtr xkb;
-#endif
{
xkbGetGeometryReq *req;
xkbGetGeometryReply rep;
@@ -749,14 +644,7 @@ xkbGetGeometryReply rep;
}
Status
-#if NeedFunctionPrototypes
XkbGetNamedGeometry(Display *dpy,XkbDescPtr xkb,Atom name)
-#else
-XkbGetNamedGeometry(dpy,xkb,name)
- Display * dpy;
- XkbDescPtr xkb;
- Atom name;
-#endif
{
xkbGetGeometryReq *req;
xkbGetGeometryReply rep;
diff --git a/src/xkb/XKBGetByName.c b/src/xkb/XKBGetByName.c
index 411be961..70258ce0 100644
--- a/src/xkb/XKBGetByName.c
+++ b/src/xkb/XKBGetByName.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86$ */
#define NEED_REPLIES
#define NEED_EVENTS
@@ -35,22 +36,12 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
/***====================================================================***/
XkbDescPtr
-#if NeedFunctionPrototypes
XkbGetKeyboardByName( Display * dpy,
unsigned deviceSpec,
XkbComponentNamesPtr names,
unsigned want,
unsigned need,
Bool load)
-#else
-XkbGetKeyboardByName(dpy,deviceSpec,names,want,need,load)
- Display * dpy;
- unsigned deviceSpec;
- XkbComponentNamesPtr names;
- unsigned want;
- unsigned need;
- Bool load;
-#endif
{
register xkbGetKbdByNameReq * req;
xkbGetKbdByNameReply rep;
@@ -218,14 +209,7 @@ BAILOUT:
}
XkbDescPtr
-#if NeedFunctionPrototypes
XkbGetKeyboard(Display *dpy,unsigned which,unsigned deviceSpec)
-#else
-XkbGetKeyboard(dpy,which,deviceSpec)
- Display * dpy;
- unsigned which;
- unsigned deviceSpec;
-#endif
{
return XkbGetKeyboardByName(dpy,deviceSpec,NULL,which,which,False);
}
diff --git a/src/xkb/XKBGetMap.c b/src/xkb/XKBGetMap.c
index 8975ba39..71fc7f48 100644
--- a/src/xkb/XKBGetMap.c
+++ b/src/xkb/XKBGetMap.c
@@ -25,6 +25,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/lib/X11/XKBGetMap.c,v 1.9 2003/04/17 02:06:31 dawes Exp $ */
+
#define NEED_REPLIES
#define NEED_EVENTS
#define NEED_MAP_READERS
@@ -33,14 +35,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "XKBlibint.h"
static Status
-#if NeedFunctionPrototypes
_XkbReadKeyTypes(XkbReadBufferPtr buf,XkbDescPtr xkb,xkbGetMapReply *rep)
-#else
-_XkbReadKeyTypes(buf,xkb,rep)
- XkbReadBufferPtr buf;
- XkbDescPtr xkb;
- xkbGetMapReply * rep;
-#endif
{
int i,n,lastMapCount;
XkbKeyTypePtr type;
@@ -150,14 +145,7 @@ XkbKeyTypePtr type;
}
static Status
-#if NeedFunctionPrototypes
_XkbReadKeySyms(XkbReadBufferPtr buf,XkbDescPtr xkb,xkbGetMapReply *rep)
-#else
-_XkbReadKeySyms(buf,xkb,rep)
- XkbReadBufferPtr buf;
- XkbDescPtr xkb;
- xkbGetMapReply * rep;
-#endif
{
register int i;
XkbClientMapPtr map;
@@ -252,14 +240,7 @@ XkbClientMapPtr map;
}
static Status
-#if NeedFunctionPrototypes
_XkbReadKeyActions(XkbReadBufferPtr buf,XkbDescPtr info,xkbGetMapReply *rep)
-#else
-_XkbReadKeyActions(buf,info,rep)
- XkbReadBufferPtr buf;
- XkbDescPtr info;
- xkbGetMapReply * rep;
-#endif
{
int i;
CARD8 numDescBuf[248];
@@ -311,14 +292,7 @@ done:
}
static Status
-#if NeedFunctionPrototypes
_XkbReadKeyBehaviors(XkbReadBufferPtr buf,XkbDescPtr xkb,xkbGetMapReply *rep)
-#else
-_XkbReadKeyBehaviors(buf,xkb,rep)
- XkbReadBufferPtr buf;
- XkbDescPtr xkb;
- xkbGetMapReply * rep;
-#endif
{
register int i;
xkbBehaviorWireDesc *wire;
@@ -347,14 +321,7 @@ xkbBehaviorWireDesc *wire;
}
static Status
-#if NeedFunctionPrototypes
_XkbReadVirtualMods(XkbReadBufferPtr buf,XkbDescPtr xkb,xkbGetMapReply *rep)
-#else
-_XkbReadVirtualMods(buf,xkb,rep)
- XkbReadBufferPtr buf;
- XkbDescPtr xkb;
- xkbGetMapReply * rep;
-#endif
{
if ( rep->virtualMods ) {
register int i,bit,nVMods;
@@ -378,16 +345,9 @@ _XkbReadVirtualMods(buf,xkb,rep)
}
static Status
-#if NeedFunctionPrototypes
_XkbReadExplicitComponents( XkbReadBufferPtr buf,
XkbDescPtr xkb,
xkbGetMapReply * rep)
-#else
-_XkbReadExplicitComponents(buf,xkb,rep)
- XkbReadBufferPtr buf;
- XkbDescPtr xkb;
- xkbGetMapReply * rep;
-#endif
{
register int i;
unsigned char *wire;
@@ -415,14 +375,7 @@ unsigned char *wire;
}
static Status
-#if NeedFunctionPrototypes
_XkbReadModifierMap(XkbReadBufferPtr buf,XkbDescPtr xkb,xkbGetMapReply *rep)
-#else
-_XkbReadModifierMap(buf,xkb,rep)
- XkbReadBufferPtr buf;
- XkbDescPtr xkb;
- xkbGetMapReply * rep;
-#endif
{
register int i;
unsigned char *wire;
@@ -447,14 +400,7 @@ unsigned char *wire;
}
static Status
-#if NeedFunctionPrototypes
_XkbReadVirtualModMap(XkbReadBufferPtr buf,XkbDescPtr xkb,xkbGetMapReply *rep)
-#else
-_XkbReadVirtualModMap(buf,xkb,rep)
- XkbReadBufferPtr buf;
- XkbDescPtr xkb;
- xkbGetMapReply * rep;
-#endif
{
register int i;
xkbVModMapWireDesc * wire;
@@ -467,8 +413,10 @@ XkbServerMapPtr srv;
}
else {
srv= xkb->server;
- bzero((char *)&srv->vmodmap[rep->firstVModMapKey],
- rep->nVModMapKeys*sizeof(unsigned short));
+ if (rep->nVModMapKeys > rep->firstVModMapKey)
+ bzero((char *)&srv->vmodmap[rep->firstVModMapKey],
+ (rep->nVModMapKeys - rep->firstVModMapKey) *
+ sizeof(unsigned short));
}
srv= xkb->server;
i= rep->totalVModMapKeys*SIZEOF(xkbVModMapWireDesc);
@@ -484,13 +432,7 @@ XkbServerMapPtr srv;
}
static xkbGetMapReq *
-#if NeedFunctionPrototypes
_XkbGetGetMapReq(Display *dpy,XkbDescPtr xkb)
-#else
-_XkbGetGetMapReq(dpy,xkb)
- Display * dpy;
- XkbDescPtr xkb;
-#endif
{
xkbGetMapReq *req;
@@ -511,18 +453,10 @@ xkbGetMapReq *req;
}
Status
-#if NeedFunctionPrototypes
_XkbReadGetMapReply( Display * dpy,
xkbGetMapReply *rep,
XkbDescPtr xkb,
int * nread_rtrn)
-#else
-_XkbReadGetMapReply(dpy,rep,xkb,nread_rtrn)
- Display * dpy;
- xkbGetMapReply * rep;
- XkbDescPtr xkb;
- int * nread_rtrn;
-#endif
{
int extraData;
unsigned mask;
@@ -577,13 +511,7 @@ unsigned mask;
}
static Status
-#if NeedFunctionPrototypes
_XkbHandleGetMapReply(Display *dpy,XkbDescPtr xkb)
-#else
-_XkbHandleGetMapReply(dpy,xkb)
- Display * dpy;
- XkbDescPtr xkb;
-#endif
{
xkbGetMapReply rep;
@@ -596,14 +524,7 @@ xkbGetMapReply rep;
}
Status
-#if NeedFunctionPrototypes
XkbGetUpdatedMap(Display *dpy,unsigned which,XkbDescPtr xkb)
-#else
-XkbGetUpdatedMap(dpy,which,xkb)
- Display * dpy;
- unsigned which;
- XkbDescPtr xkb;
-#endif
{
if ((dpy->flags & XlibDisplayNoXkb) ||
(!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)))
@@ -626,14 +547,7 @@ XkbGetUpdatedMap(dpy,which,xkb)
}
XkbDescPtr
-#if NeedFunctionPrototypes
XkbGetMap(Display *dpy,unsigned which,unsigned deviceSpec)
-#else
-XkbGetMap(dpy,which,deviceSpec)
- Display *dpy;
- unsigned which;
- unsigned deviceSpec;
-#endif
{
XkbDescPtr xkb;
@@ -656,15 +570,7 @@ XkbDescPtr xkb;
}
Status
-#if NeedFunctionPrototypes
XkbGetKeyTypes(Display *dpy,unsigned first,unsigned num,XkbDescPtr xkb)
-#else
-XkbGetKeyTypes(dpy,first,num,xkb)
- Display *dpy;
- unsigned first;
- unsigned num;
- XkbDescPtr xkb;
-#endif
{
register xkbGetMapReq *req;
Status status;
@@ -688,15 +594,7 @@ XkbGetKeyTypes(dpy,first,num,xkb)
}
Status
-#if NeedFunctionPrototypes
XkbGetKeyActions(Display *dpy,unsigned first,unsigned num,XkbDescPtr xkb)
-#else
-XkbGetKeyActions(dpy,first,num,xkb)
- Display *dpy;
- unsigned first;
- unsigned num;
- XkbDescPtr xkb;
-#endif
{
register xkbGetMapReq *req;
Status status;
@@ -721,15 +619,7 @@ XkbGetKeyActions(dpy,first,num,xkb)
}
Status
-#if NeedFunctionPrototypes
XkbGetKeySyms(Display *dpy,unsigned first,unsigned num,XkbDescPtr xkb)
-#else
-XkbGetKeySyms(dpy,first,num,xkb)
- Display *dpy;
- unsigned first;
- unsigned num;
- XkbDescPtr xkb;
-#endif
{
register xkbGetMapReq *req;
Status status;
@@ -755,15 +645,7 @@ XkbGetKeySyms(dpy,first,num,xkb)
}
Status
-#if NeedFunctionPrototypes
XkbGetKeyBehaviors(Display *dpy,unsigned first,unsigned num,XkbDescPtr xkb)
-#else
-XkbGetKeyBehaviors(dpy,first,num,xkb)
- Display * dpy;
- unsigned first;
- unsigned num;
- XkbDescPtr xkb;
-#endif
{
register xkbGetMapReq *req;
Status status;
@@ -788,14 +670,7 @@ XkbGetKeyBehaviors(dpy,first,num,xkb)
}
Status
-#if NeedFunctionPrototypes
XkbGetVirtualMods(Display *dpy,unsigned which,XkbDescPtr xkb)
-#else
-XkbGetVirtualMods(dpy,which,xkb)
- Display * dpy;
- unsigned which;
- XkbDescPtr xkb;
-#endif
{
register xkbGetMapReq *req;
Status status;
@@ -816,18 +691,10 @@ XkbGetVirtualMods(dpy,which,xkb)
}
Status
-#if NeedFunctionPrototypes
XkbGetKeyExplicitComponents( Display * dpy,
unsigned first,
unsigned num,
XkbDescPtr xkb)
-#else
-XkbGetKeyExplicitComponents(dpy,first,num,xkb)
- Display *dpy;
- unsigned first;
- unsigned num;
- XkbDescPtr xkb;
-#endif
{
register xkbGetMapReq *req;
Status status;
@@ -856,15 +723,7 @@ XkbGetKeyExplicitComponents(dpy,first,num,xkb)
}
Status
-#if NeedFunctionPrototypes
XkbGetKeyModifierMap(Display *dpy,unsigned first,unsigned num,XkbDescPtr xkb)
-#else
-XkbGetKeyModifierMap(dpy,first,num,xkb)
- Display * dpy;
- unsigned first;
- unsigned num;
- XkbDescPtr xkb;
-#endif
{
register xkbGetMapReq *req;
Status status;
@@ -893,15 +752,7 @@ XkbGetKeyModifierMap(dpy,first,num,xkb)
}
Status
-#if NeedFunctionPrototypes
XkbGetKeyVirtualModMap(Display *dpy,unsigned first,unsigned num,XkbDescPtr xkb)
-#else
-XkbGetKeyVirtualModMap(dpy,first,num,xkb)
- Display *dpy;
- unsigned first;
- unsigned num;
- XkbDescPtr xkb;
-#endif
{
register xkbGetMapReq *req;
Status status;
@@ -930,14 +781,7 @@ XkbGetKeyVirtualModMap(dpy,first,num,xkb)
}
Status
-#if NeedFunctionPrototypes
XkbGetMapChanges(Display *dpy,XkbDescPtr xkb,XkbMapChangesPtr changes)
-#else
-XkbGetMapChanges(dpy,xkb,changes)
- Display * dpy;
- XkbDescPtr xkb;
- XkbMapChangesPtr changes;
-#endif
{
xkbGetMapReq *req;
@@ -970,6 +814,7 @@ XkbGetMapChanges(dpy,xkb,changes)
UnlockDisplay(dpy);
return status;
}
+ UnlockDisplay(dpy);
return Success;
}
diff --git a/src/xkb/XKBList.c b/src/xkb/XKBList.c
index 9f521a60..e72ced96 100644
--- a/src/xkb/XKBList.c
+++ b/src/xkb/XKBList.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86$ */
#define NEED_REPLIES
#define NEED_EVENTS
@@ -35,13 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
/***====================================================================***/
static void
-#if NeedFunctionPrototypes
_FreeComponentNames(int num,XkbComponentNamePtr names)
-#else
-_FreeComponentNames(num,names)
- int num;
- XkbComponentNamePtr names;
-#endif
{
int i;
XkbComponentNamePtr tmp;
@@ -61,14 +56,7 @@ XkbComponentNamePtr tmp;
/***====================================================================***/
static XkbComponentNamePtr
-#if NeedFunctionPrototypes
_ReadListing(XkbReadBufferPtr buf,int count,Status *status_rtrn)
-#else
-_ReadListing(buf,count,status_rtrn)
- XkbReadBufferPtr buf;
- int count;
- Status * status_rtrn;
-#endif
{
XkbComponentNamePtr first,this;
register int i;
@@ -104,18 +92,10 @@ BAILOUT:
/***====================================================================***/
XkbComponentListPtr
-#if NeedFunctionPrototypes
XkbListComponents( Display * dpy,
unsigned deviceSpec,
XkbComponentNamesPtr ptrns,
int * max_inout)
-#else
-XkbListComponents(dpy,deviceSpec,ptrns,max_inout)
- Display * dpy;
- unsigned deviceSpec;
- XkbComponentNamesPtr ptrns;
- int * max_inout;
-#endif
{
register xkbListComponentsReq* req;
xkbListComponentsReply rep;
@@ -246,12 +226,7 @@ BAILOUT:
}
void
-#if NeedFunctionPrototypes
XkbFreeComponentList(XkbComponentListPtr list)
-#else
-XkbFreeComponentList(list)
- XkbComponentListPtr list;
-#endif
{
if (list) {
if (list->keymaps)
diff --git a/src/xkb/XKBMAlloc.c b/src/xkb/XKBMAlloc.c
index ba2a7076..d1fd14f2 100644
--- a/src/xkb/XKBMAlloc.c
+++ b/src/xkb/XKBMAlloc.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/lib/X11/XKBMAlloc.c,v 3.11 2001/01/17 19:41:48 dawes Exp $ */
#ifndef XKB_IN_SERVER
@@ -53,14 +54,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
/***====================================================================***/
Status
-#if NeedFunctionPrototypes
XkbAllocClientMap(XkbDescPtr xkb,unsigned which,unsigned nTotalTypes)
-#else
-XkbAllocClientMap(xkb,which,nTotalTypes)
- XkbDescPtr xkb;
- unsigned which;
- unsigned nTotalTypes;
-#endif
{
register int i;
XkbClientMapPtr map;
@@ -143,14 +137,7 @@ fprintf(stderr,"bad keycode (%d,%d) in XkbAllocClientMap\n",
}
Status
-#if NeedFunctionPrototypes
XkbAllocServerMap(XkbDescPtr xkb,unsigned which,unsigned nNewActions)
-#else
-XkbAllocServerMap(xkb,which,nNewActions)
- XkbDescPtr xkb;
- unsigned which;
- unsigned nNewActions;
-#endif
{
register int i;
XkbServerMapPtr map;
@@ -244,13 +231,7 @@ XkbServerMapPtr map;
/***====================================================================***/
Status
-#if NeedFunctionPrototypes
XkbCopyKeyType(XkbKeyTypePtr from,XkbKeyTypePtr into)
-#else
-XkbCopyKeyType(from,into)
- XkbKeyTypePtr from;
- XkbKeyTypePtr into;
-#endif
{
if ((!from)||(!into))
return BadMatch;
@@ -291,14 +272,7 @@ XkbCopyKeyType(from,into)
}
Status
-#if NeedFunctionPrototypes
XkbCopyKeyTypes(XkbKeyTypePtr from,XkbKeyTypePtr into,int num_types)
-#else
-XkbCopyKeyTypes(from,into,num_types)
- XkbKeyTypePtr from;
- XkbKeyTypePtr into;
- int num_types;
-#endif
{
register int i,rtrn;
@@ -312,20 +286,11 @@ register int i,rtrn;
}
XkbKeyTypePtr
-#if NeedFunctionPrototypes
XkbAddKeyType( XkbDescPtr xkb,
Atom name,
int map_count,
Bool want_preserve,
int num_lvls)
-#else
-XkbAddKeyType(xkb,name,map_count,want_preserve,num_lvls)
- XkbDescPtr xkb;
- Atom name;
- int map_count;
- Bool want_preserve;
- int num_lvls;
-#endif
{
register int i;
unsigned tmp;
@@ -396,20 +361,11 @@ XkbClientMapPtr map;
}
Status
-#if NeedFunctionPrototypes
XkbResizeKeyType( XkbDescPtr xkb,
int type_ndx,
int map_count,
Bool want_preserve,
int new_num_lvls)
-#else
-XkbResizeKeyType(xkb,type_ndx,map_count,want_preserve,new_num_lvls)
- XkbDescPtr xkb;
- int type_ndx;
- int map_count;
- Bool want_preserve;
- int new_num_lvls;
-#endif
{
XkbKeyTypePtr type;
KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys;
@@ -603,14 +559,7 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys;
}
KeySym *
-#if NeedFunctionPrototypes
XkbResizeKeySyms(XkbDescPtr xkb,int key,int needed)
-#else
-XkbResizeKeySyms(xkb,key,needed)
- XkbDescPtr xkb;
- int key;
- int needed;
-#endif
{
register int i,nSyms,nKeySyms;
unsigned nOldSyms;
@@ -665,20 +614,11 @@ KeySym *newSyms;
}
static unsigned
-#if NeedFunctionPrototypes
_ExtendRange( unsigned int old_flags,
unsigned int flag,
KeyCode newKC,
KeyCode * old_min,
unsigned char * old_num)
-#else
-_ExtendRange(old_flags,flag,newKC,old_min,old_num)
- unsigned int old_flags;
- unsigned int flag;
- KeyCode newKC;
- KeyCode * old_min;
- unsigned char * old_num;
-#endif
{
if ((old_flags&flag)==0) {
old_flags|= flag;
@@ -699,18 +639,10 @@ _ExtendRange(old_flags,flag,newKC,old_min,old_num)
}
Status
-#if NeedFunctionPrototypes
XkbChangeKeycodeRange( XkbDescPtr xkb,
int minKC,
int maxKC,
XkbChangesPtr changes)
-#else
-XkbChangeKeycodeRange(xkb,minKC,maxKC,changes)
- XkbDescPtr xkb;
- int minKC;
- int maxKC;
- XkbChangesPtr changes;
-#endif
{
int tmp;
@@ -907,14 +839,7 @@ int tmp;
}
XkbAction *
-#if NeedFunctionPrototypes
XkbResizeKeyActions(XkbDescPtr xkb,int key,int needed)
-#else
-XkbResizeKeyActions(xkb,key,needed)
- XkbDescPtr xkb;
- int key;
- int needed;
-#endif
{
register int i,nActs;
XkbAction *newActs;
@@ -964,14 +889,7 @@ XkbAction *newActs;
}
void
-#if NeedFunctionPrototypes
XkbFreeClientMap(XkbDescPtr xkb,unsigned what,Bool freeMap)
-#else
-XkbFreeClientMap(xkb,what,freeMap)
- XkbDescPtr xkb;
- unsigned what;
- Bool freeMap;
-#endif
{
XkbClientMapPtr map;
@@ -1029,14 +947,7 @@ XkbClientMapPtr map;
}
void
-#if NeedFunctionPrototypes
XkbFreeServerMap(XkbDescPtr xkb,unsigned what,Bool freeMap)
-#else
-XkbFreeServerMap(xkb,what,freeMap)
- XkbDescPtr xkb;
- unsigned what;
- Bool freeMap;
-#endif
{
XkbServerMapPtr map;
diff --git a/src/xkb/XKBMisc.c b/src/xkb/XKBMisc.c
index 45c00692..afc0dbeb 100644
--- a/src/xkb/XKBMisc.c
+++ b/src/xkb/XKBMisc.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/lib/X11/XKBMisc.c,v 3.5 2001/10/28 03:32:33 tsi Exp $ */
#ifndef XKB_IN_SERVER
@@ -54,12 +55,12 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define mapSize(m) (sizeof(m)/sizeof(XkbKTMapEntryRec))
static XkbKTMapEntryRec map2Level[]= {
- { True, ShiftMask, 1, ShiftMask, 0 }
+ { True, ShiftMask, {1, ShiftMask, 0} }
};
static XkbKTMapEntryRec mapAlpha[]= {
- { True, ShiftMask, 1, ShiftMask, 0 },
- { True, LockMask, 0, LockMask, 0 }
+ { True, ShiftMask, { 1, ShiftMask, 0 } },
+ { True, LockMask, { 0, LockMask, 0 } }
};
static XkbModsRec preAlpha[]= {
@@ -69,8 +70,8 @@ static XkbModsRec preAlpha[]= {
#define NL_VMOD_MASK 0
static XkbKTMapEntryRec mapKeypad[]= {
- { True, ShiftMask, 1, ShiftMask, 0 },
- { False, 0, 1, 0, NL_VMOD_MASK }
+ { True, ShiftMask, { 1, ShiftMask, 0 } },
+ { False, 0, { 1, 0, NL_VMOD_MASK } }
};
static XkbKeyTypeRec canonicalTypes[XkbNumRequiredTypes] = {
@@ -101,14 +102,7 @@ static XkbKeyTypeRec canonicalTypes[XkbNumRequiredTypes] = {
};
Status
-#if NeedFunctionPrototypes
XkbInitCanonicalKeyTypes(XkbDescPtr xkb,unsigned which,int keypadVMod)
-#else
-XkbInitCanonicalKeyTypes(xkb,which,keypadVMod)
- XkbDescPtr xkb;
- unsigned which;
- int keypadVMod;
-#endif
{
XkbClientMapPtr map;
XkbKeyTypePtr from,to;
@@ -158,23 +152,12 @@ Status rtrn;
#define XKB_OFFSET(g,l) (((g)*groupsWidth)+(l))
int
-#if NeedFunctionPrototypes
XkbKeyTypesForCoreSymbols( XkbDescPtr xkb,
int map_width,
KeySym * core_syms,
unsigned int protected,
int * types_inout,
KeySym * xkb_syms_rtrn)
-#else
-XkbKeyTypesForCoreSymbols(xkb,map_width,core_syms,protected,types_inout,
- xkb_syms_rtrn)
- XkbDescPtr xkb;
- int map_width;
- KeySym * core_syms;
- unsigned int protected;
- int * types_inout;
- KeySym * xkb_syms_rtrn;
-#endif
{
register int i;
unsigned int empty;
@@ -339,18 +322,10 @@ int nGroups,tmp,groupsWidth;
}
static XkbSymInterpretPtr
-#if NeedFunctionPrototypes
_XkbFindMatchingInterp( XkbDescPtr xkb,
KeySym sym,
unsigned int real_mods,
unsigned int level)
-#else
-_XkbFindMatchingInterp(xkb,sym,real_mods,level)
- XkbDescPtr xkb;
- KeySym sym;
- unsigned int real_mods;
- unsigned int level;
-#endif
{
register unsigned i;
XkbSymInterpretPtr interp,rtrn;
@@ -398,14 +373,7 @@ CARD8 mods;
}
static void
-#if NeedFunctionPrototypes
_XkbAddKeyChange(KeyCode *pFirst,unsigned char *pNum,KeyCode newKey)
-#else
-_XkbAddKeyChange(pFirst,pNum,newKey)
- KeyCode * pFirst;
- unsigned char * pNum;
- KeyCode newKey;
-#endif
{
KeyCode last;
@@ -421,14 +389,7 @@ KeyCode last;
}
static void
-#if NeedFunctionPrototypes
_XkbSetActionKeyMods(XkbDescPtr xkb,XkbAction *act,unsigned mods)
-#else
-_XkbSetActionKeyMods(xkb,act,mods)
- XkbDescPtr xkb;
- XkbAction * act;
- unsigned mods;
-#endif
{
unsigned tmp;
@@ -456,14 +417,7 @@ unsigned tmp;
#define IBUF_SIZE 8
Bool
-#if NeedFunctionPrototypes
XkbApplyCompatMapToKey(XkbDescPtr xkb,KeyCode key,XkbChangesPtr changes)
-#else
-XkbApplyCompatMapToKey(xkb,key,changes)
- XkbDescPtr xkb;
- KeyCode key;
- XkbChangesPtr changes;
-#endif
{
KeySym * syms;
unsigned char explicit,mods;
@@ -564,7 +518,7 @@ unsigned changed,tmp;
if (((explicit&XkbExplicitAutoRepeatMask)==0)&&(xkb->ctrls)) {
CARD8 old;
old= xkb->ctrls->per_key_repeat[key/8];
-#if RETURN_SHOULD_REPEAT
+#ifdef RETURN_SHOULD_REPEAT
if (*XkbKeySymsPtr(xkb,key) != XK_Return)
#endif
xkb->ctrls->per_key_repeat[key/8]|= (1<<(key%8));
@@ -612,22 +566,12 @@ unsigned changed,tmp;
}
Bool
-#if NeedFunctionPrototypes
XkbUpdateMapFromCore( XkbDescPtr xkb,
KeyCode first_key,
int num_keys,
int map_width,
KeySym * core_keysyms,
XkbChangesPtr changes)
-#else
-XkbUpdateMapFromCore(xkb,first_key,num_keys,map_width,core_keysyms,changes)
- XkbDescPtr xkb;
- KeyCode first_key;
- int num_keys;
- int map_width;
- KeySym * core_keysyms;
- XkbChangesPtr changes;
-#endif
{
register int key,last_key;
KeySym * syms;
@@ -704,22 +648,12 @@ KeySym * syms;
}
Status
-#if NeedFunctionPrototypes
XkbChangeTypesOfKey( XkbDescPtr xkb,
int key,
int nGroups,
unsigned groups,
int * newTypesIn,
XkbMapChangesPtr changes)
-#else
-XkbChangeTypesOfKey(xkb,key,nGroups,groups,newTypesIn,changes)
- XkbDescPtr xkb;
- int key;
- int nGroups;
- unsigned groups;
- int * newTypesIn;
- XkbMapChangesPtr changes;
-#endif
{
XkbKeyTypePtr pOldType,pNewType;
register int i;
@@ -838,14 +772,7 @@ int width,nOldGroups,oldWidth,newTypes[XkbNumKbdGroups];
/***====================================================================***/
Bool
-#if NeedFunctionPrototypes
XkbVirtualModsToReal(XkbDescPtr xkb,unsigned virtual_mask,unsigned *mask_rtrn)
-#else
-XkbVirtualModsToReal(xkb,virtual_mask,mask_rtrn)
- XkbDescPtr xkb;
- unsigned virtual_mask;
- unsigned * mask_rtrn;
-#endif
{
register int i,bit;
register unsigned mask;
@@ -869,14 +796,7 @@ register unsigned mask;
/***====================================================================***/
Bool
-#if NeedFunctionPrototypes
XkbUpdateActionVirtualMods(XkbDescPtr xkb,XkbAction *act,unsigned changed)
-#else
-XkbUpdateActionVirtualMods(xkb,act,changed)
- XkbDescPtr xkb;
- XkbAction * act;
- unsigned changed;
-#endif
{
unsigned int tmp;
@@ -902,18 +822,10 @@ unsigned int tmp;
}
void
-#if NeedFunctionPrototypes
XkbUpdateKeyTypeVirtualMods( XkbDescPtr xkb,
XkbKeyTypePtr type,
unsigned int changed,
XkbChangesPtr changes)
-#else
-XkbUpdateKeyTypeVirtualMods(xkb,type,changed,changes)
- XkbDescPtr xkb;
- XkbKeyTypePtr type;
- unsigned int changed;
- XkbChangesPtr changes;
-#endif
{
register unsigned int i;
unsigned int mask;
@@ -958,17 +870,10 @@ unsigned int mask;
}
Bool
-#if NeedFunctionPrototypes
XkbApplyVirtualModChanges(XkbDescPtr xkb,unsigned changed,XkbChangesPtr changes)
-#else
-XkbApplyVirtualModChanges(xkb,changed,changes)
- XkbDescPtr xkb;
- unsigned changed;
- XkbChangesPtr changes;
-#endif
{
register int i;
-unsigned checkState;
+unsigned int checkState = 0;
if ((!xkb) || (!xkb->map) || (changed==0))
return False;
@@ -1035,8 +940,7 @@ unsigned checkState;
}
}
if (xkb->map && xkb->server) {
- int highChange,lowChange;
- lowChange= -1;
+ int highChange = 0, lowChange = -1;
for (i=xkb->min_key_code;i<=xkb->max_key_code;i++) {
if (XkbKeyHasActions(xkb,i)) {
register XkbAction *pAct;
diff --git a/src/xkb/XKBNames.c b/src/xkb/XKBNames.c
index 22439d29..490deff2 100644
--- a/src/xkb/XKBNames.c
+++ b/src/xkb/XKBNames.c
@@ -24,27 +24,21 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/lib/X11/XKBNames.c,v 1.5 2003/04/13 19:22:18 dawes Exp $ */
#define NEED_REPLIES
#define NEED_EVENTS
+#define NEED_MAP_READERS
#include "Xlibint.h"
#include <X11/extensions/XKBproto.h>
#include "XKBlibint.h"
static Status
-#if NeedFunctionPrototypes
_XkbReadAtoms( XkbReadBufferPtr buf,
Atom * atoms,
int maxAtoms,
CARD32 present)
-#else
-_XkbReadAtoms(buf,atoms,maxAtoms,present)
- XkbReadBufferPtr buf;
- Atom *atoms;
- int maxAtoms;
- CARD32 present;
-#endif
{
register int i,bit;
@@ -59,18 +53,10 @@ register int i,bit;
}
Status
-#if NeedFunctionPrototypes
_XkbReadGetNamesReply( Display * dpy,
xkbGetNamesReply * rep,
XkbDescPtr xkb,
int * nread_rtrn)
-#else
-_XkbReadGetNamesReply(dpy,rep,xkb,nread_rtrn)
- Display * dpy;
- xkbGetNamesReply * rep;
- XkbDescPtr xkb;
- int * nread_rtrn;
-#endif
{
int i,len;
XkbReadBufferRec buf;
@@ -243,14 +229,7 @@ BAILOUT:
}
Status
-#if NeedFunctionPrototypes
XkbGetNames(Display *dpy,unsigned which,XkbDescPtr xkb)
-#else
-XkbGetNames(dpy,which,xkb)
- Display * dpy;
- unsigned which;
- XkbDescPtr xkb;
-#endif
{
register xkbGetNamesReq *req;
xkbGetNamesReply rep;
@@ -290,13 +269,7 @@ XkbGetNames(dpy,which,xkb)
/***====================================================================***/
static int
-#if NeedFunctionPrototypes
_XkbCountBits(int nBitsMax,unsigned long mask)
-#else
-_XkbCountBits(nBitsMax,mask)
- int nBitsMax;
- unsigned long mask;
-#endif
{
register unsigned long y, nBits;
@@ -309,14 +282,7 @@ register unsigned long y, nBits;
}
static CARD32
-#if NeedFunctionPrototypes
_XkbCountAtoms(Atom *atoms,int maxAtoms,int *count)
-#else
-_XkbCountAtoms(atoms,maxAtoms,count)
- Atom *atoms;
- int maxAtoms;
- int *count;
-#endif
{
register unsigned int i,bit,nAtoms;
register CARD32 atomsPresent;
@@ -333,15 +299,7 @@ register CARD32 atomsPresent;
}
static void
-#if NeedFunctionPrototypes
_XkbCopyAtoms(Display *dpy,Atom *atoms,CARD32 mask,int maxAtoms)
-#else
-_XkbCopyAtoms(dpy,atoms,mask,maxAtoms)
- Display * dpy;
- Atom * atoms;
- CARD32 mask;
- int maxAtoms;
-#endif
{
register unsigned int i,bit;
@@ -353,28 +311,19 @@ register unsigned int i,bit;
}
Bool
-#if NeedFunctionPrototypes
XkbSetNames( Display * dpy,
unsigned int which,
unsigned int firstType,
unsigned int nTypes,
XkbDescPtr xkb)
-#else
-XkbSetNames(dpy,which,firstType,nTypes,xkb)
- Display * dpy;
- unsigned int which;
- unsigned int firstType;
- unsigned int nTypes;
- XkbDescPtr xkb;
-#endif
{
register xkbSetNamesReq *req;
- int nLvlNames;
+ int nLvlNames = 0;
XkbInfoPtr xkbi;
XkbNamesPtr names;
unsigned firstLvlType,nLvlTypes;
int nVMods,nLEDs,nRG,nKA,nGroups;
- int nKeys,firstKey,nAtoms;
+ int nKeys=0,firstKey=0,nAtoms;
CARD32 leds,vmods,groups;
if ((dpy->flags & XlibDisplayNoXkb) ||
@@ -588,24 +537,17 @@ XkbSetNames(dpy,which,firstType,nTypes,xkb)
}
Bool
-#if NeedFunctionPrototypes
XkbChangeNames(Display *dpy,XkbDescPtr xkb,XkbNameChangesPtr changes)
-#else
-XkbChangeNames(dpy,xkb,changes)
- Display * dpy;
- XkbDescPtr xkb;
- XkbNameChangesPtr changes;
-#endif
{
register xkbSetNamesReq *req;
- int nLvlNames;
+ int nLvlNames = 0;
XkbInfoPtr xkbi;
XkbNamesPtr names;
unsigned which,firstType,nTypes;
unsigned firstLvlType,nLvlTypes;
int nVMods,nLEDs,nRG,nKA,nGroups;
- int nKeys,firstKey,nAtoms;
- CARD32 leds,vmods,groups;
+ int nKeys=0,firstKey=0,nAtoms;
+ CARD32 leds=0,vmods=0,groups=0;
if ((dpy->flags & XlibDisplayNoXkb) ||
(!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)))
@@ -851,16 +793,9 @@ XkbChangeNames(dpy,xkb,changes)
}
void
-#if NeedFunctionPrototypes
XkbNoteNameChanges( XkbNameChangesPtr old,
XkbNamesNotifyEvent * new,
unsigned int wanted)
-#else
-XkbNoteNameChanges(old,new,wanted)
- XkbNameChangesPtr old;
- XkbNamesNotifyEvent * new;
- unsigned int wanted;
-#endif
{
int first,last,old_last,new_last;
diff --git a/src/xkb/XKBRdBuf.c b/src/xkb/XKBRdBuf.c
index 11a9ba71..9b84424a 100644
--- a/src/xkb/XKBRdBuf.c
+++ b/src/xkb/XKBRdBuf.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/lib/X11/XKBRdBuf.c,v 1.2 2001/10/28 03:32:33 tsi Exp $ */
#include <stdio.h>
#define NEED_REPLIES
@@ -35,14 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
/***====================================================================***/
int
-#if NeedFunctionPrototypes
_XkbInitReadBuffer(Display *dpy,XkbReadBufferPtr buf,int size)
-#else
-_XkbInitReadBuffer(dpy,buf,size)
- Display *dpy;
- XkbReadBufferPtr buf;
- int size;
-#endif
{
if ((dpy!=NULL) && (buf!=NULL) && (size>0)) {
buf->error= 0;
@@ -59,13 +53,7 @@ _XkbInitReadBuffer(dpy,buf,size)
#define _XkbReadBufferDataLeft(b) (((b)->size)-((b)->data-(b)->start))
int
-#if NeedFunctionPrototypes
_XkbSkipReadBufferData(XkbReadBufferPtr from,int size)
-#else
-_XkbSkipReadBufferData(from,size)
- XkbReadBufferPtr from;
- int size;
-#endif
{
if (size==0)
return 1;
@@ -77,14 +65,7 @@ _XkbSkipReadBufferData(from,size)
}
int
-#if NeedFunctionPrototypes
_XkbCopyFromReadBuffer(XkbReadBufferPtr from,char *to,int size)
-#else
-_XkbCopyFromReadBuffer(from,to,size)
- XkbReadBufferPtr from;
- char *to;
- int size;
-#endif
{
if (size==0)
return 1;
@@ -98,14 +79,7 @@ _XkbCopyFromReadBuffer(from,to,size)
#ifdef XKB_FORCE_INT_KEYSYM
int
-#if NeedFunctionPrototypes
_XkbReadCopyKeySyms(int *wire,KeySym *to,int num_words)
-#else
-_XkbReadCopyKeySyms(wire,to,num_words)
- int * wire;
- KeySym * to;
- int num_words;
-#endif
{
while (num_words-->0) {
*to++= *wire++;
@@ -114,14 +88,7 @@ _XkbReadCopyKeySyms(wire,to,num_words)
}
int
-#if NeedFunctionPrototypes
_XkbReadBufferCopyKeySyms(XkbReadBufferPtr from,KeySym *to,int num_words)
-#else
-_XkbReadBufferCopyKeySyms(from,to,num_words)
- XkbReadBufferPtr from;
- KeySym * to;
- int num_words;
-#endif
{
if ((unsigned)(num_words*4)>_XkbReadBufferDataLeft(from))
return 0;
@@ -131,14 +98,7 @@ _XkbReadBufferCopyKeySyms(from,to,num_words)
}
int
-#if NeedFunctionPrototypes
_XkbWriteCopyKeySyms (register KeySym *from,CARD32 *to,int len)
-#else
-_XkbWriteCopyKeySyms (from,to,len)
- register KeySym * from;
- CARD32 * to;
- int len;
-#endif
{
while (len-->0) {
@@ -150,14 +110,7 @@ _XkbWriteCopyKeySyms (from,to,len)
#ifdef LONG64
int
-#if NeedFunctionPrototypes
_XkbReadCopyData32(int *wire,long *to,int num_words)
-#else
-_XkbReadCopyData32(wire,to,num_words)
- int * wire;
- long * to;
- int num_words;
-#endif
{
while (num_words-->0) {
*to++= *wire++;
@@ -167,14 +120,7 @@ _XkbReadCopyData32(wire,to,num_words)
#endif
#ifdef WORD64
int
-#if NeedFunctionPrototypes
_XkbReadCopyData32(int *from,long *lp,int num_words)
-#else
-_XkbReadCopyData32(from,lp,num_words)
- int * from;
- long * lp;
- int num_words;
-#endif
{
long *lpack;
long mask32 = 0x00000000ffffffff;
@@ -196,14 +142,7 @@ long maskw, i, bits;
#if defined(LONG64) || defined(WORD64)
int
-#if NeedFunctionPrototypes
_XkbReadBufferCopy32(XkbReadBufferPtr from,long *to,int num_words)
-#else
-_XkbReadBufferCopy32(from,to,num_words)
- XkbReadBufferPtr from;
- long * to;
- int num_words;
-#endif
{
if ((unsigned)(num_words*4)>_XkbReadBufferDataLeft(from))
return 0;
@@ -215,14 +154,7 @@ _XkbReadBufferCopy32(from,to,num_words)
#ifdef LONG64
int
-#if NeedFunctionPrototypes
_XkbWriteCopyData32 (register unsigned long *from,CARD32 *to,int len)
-#else
-_XkbWriteCopyData32 (from,to,len)
- register unsigned long * from;
- CARD32 * to;
- int len;
-#endif
{
while (len-->0) {
@@ -237,13 +169,7 @@ _XkbWriteCopyData32 Not Implemented Yet for sizeof(int)==8
#endif
char *
-#if NeedFunctionPrototypes
_XkbPeekAtReadBuffer(XkbReadBufferPtr from,int size)
-#else
-_XkbPeekAtReadBuffer(from,size)
- XkbReadBufferPtr from;
- int size;
-#endif
{
if ((from==NULL)||(from->error)||(size<1)||
(_XkbReadBufferDataLeft(from)<size))
@@ -252,13 +178,7 @@ _XkbPeekAtReadBuffer(from,size)
}
char *
-#if NeedFunctionPrototypes
_XkbGetReadBufferPtr(XkbReadBufferPtr from,int size)
-#else
-_XkbGetReadBufferPtr(from,size)
- XkbReadBufferPtr from;
- int size;
-#endif
{
char *ptr;
if ((from==NULL)||(from->error)||(size<1)||
@@ -271,12 +191,7 @@ char *ptr;
int
-#if NeedFunctionPrototypes
_XkbFreeReadBuffer(XkbReadBufferPtr buf)
-#else
-_XkbFreeReadBuffer(buf)
- XkbReadBufferPtr buf;
-#endif
{
if ((buf!=NULL) && (buf->start!=NULL)) {
int left;
@@ -291,17 +206,11 @@ _XkbFreeReadBuffer(buf)
}
Bool
-#if NeedFunctionPrototypes
_XkbGetReadBufferCountedString(XkbReadBufferPtr buf,char **rtrn)
-#else
-_XkbGetReadBufferCountedString(buf,rtrn)
- XkbReadBufferPtr buf;
- char ** rtrn;
-#endif
{
CARD16 len,*pLen;
int left;
-char * str;
+char * str = NULL;
if ((buf==NULL)||(buf->error)||((left=(int)_XkbReadBufferDataLeft(buf))<4))
return False;
diff --git a/src/xkb/XKBSetGeom.c b/src/xkb/XKBSetGeom.c
index 72d7f3d7..460594fa 100644
--- a/src/xkb/XKBSetGeom.c
+++ b/src/xkb/XKBSetGeom.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/lib/X11/XKBSetGeom.c,v 3.5 2003/05/27 22:26:25 tsi Exp $ */
#ifdef DEBUG
#include <stdio.h>
@@ -48,13 +49,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define _SizeCountedString(s) ((s)?XkbPaddedSize(2+strlen(s)):4)
static char *
-#if NeedFunctionPrototypes
_WriteCountedString(char *wire,char *str)
-#else
-_WriteCountedString(wire,str)
- char * wire;
- char * str;
-#endif
{
CARD16 len,*pLen;
@@ -68,12 +63,7 @@ CARD16 len,*pLen;
}
static int
-#if NeedFunctionPrototypes
_SizeGeomProperties(XkbGeometryPtr geom)
-#else
-_SizeGeomProperties(geom)
- XkbGeometryPtr geom;
-#endif
{
register int i,size;
XkbPropertyPtr prop;
@@ -86,12 +76,7 @@ XkbPropertyPtr prop;
}
static int
-#if NeedFunctionPrototypes
_SizeGeomColors(XkbGeometryPtr geom)
-#else
-_SizeGeomColors(geom)
- XkbGeometryPtr geom;
-#endif
{
register int i,size;
register XkbColorPtr color;
@@ -103,12 +88,7 @@ register XkbColorPtr color;
}
static int
-#if NeedFunctionPrototypes
_SizeGeomShapes(XkbGeometryPtr geom)
-#else
-_SizeGeomShapes(geom)
- XkbGeometryPtr geom;
-#endif
{
register int i,size;
register XkbShapePtr shape;
@@ -126,13 +106,7 @@ register XkbShapePtr shape;
}
static int
-#if NeedFunctionPrototypes
_SizeGeomDoodads(int num_doodads,XkbDoodadPtr doodad)
-#else
-_SizeGeomDoodads(num_doodads,doodad)
- int num_doodads;
- XkbDoodadPtr doodad;
-#endif
{
register int i,size;
@@ -150,12 +124,7 @@ register int i,size;
}
static int
-#if NeedFunctionPrototypes
_SizeGeomSections(XkbGeometryPtr geom)
-#else
-_SizeGeomSections(geom)
- XkbGeometryPtr geom;
-#endif
{
register int i,size;
XkbSectionPtr section;
@@ -190,12 +159,7 @@ XkbSectionPtr section;
}
static int
-#if NeedFunctionPrototypes
_SizeGeomKeyAliases(XkbGeometryPtr geom)
-#else
-_SizeGeomKeyAliases(geom)
- XkbGeometryPtr geom;
-#endif
{
return geom->num_key_aliases*(2*XkbKeyNameLength);
}
@@ -203,13 +167,7 @@ _SizeGeomKeyAliases(geom)
/***====================================================================***/
static char *
-#if NeedFunctionPrototypes
_WriteGeomProperties(char *wire,XkbGeometryPtr geom)
-#else
-_WriteGeomProperties(wire,geom)
- char * wire;
- XkbGeometryPtr geom;
-#endif
{
register int i;
register XkbPropertyPtr prop;
@@ -222,13 +180,7 @@ register XkbPropertyPtr prop;
}
static char *
-#if NeedFunctionPrototypes
_WriteGeomColors(char *wire,XkbGeometryPtr geom)
-#else
-_WriteGeomColors(wire,geom)
- char * wire;
- XkbGeometryPtr geom;
-#endif
{
register int i;
register XkbColorPtr color;
@@ -240,13 +192,7 @@ register XkbColorPtr color;
}
static char *
-#if NeedFunctionPrototypes
_WriteGeomShapes(char *wire,XkbGeometryPtr geom)
-#else
-_WriteGeomShapes(wire,geom)
- char * wire;
- XkbGeometryPtr geom;
-#endif
{
int i;
XkbShapePtr shape;
@@ -286,14 +232,7 @@ xkbShapeWireDesc * shapeWire;
}
static char *
-#if NeedFunctionPrototypes
_WriteGeomDoodads(char *wire,int num_doodads,XkbDoodadPtr doodad)
-#else
-_WriteGeomDoodads(wire,num_doodads,doodad)
- char * wire;
- int num_doodads;
- XkbDoodadPtr doodad;
-#endif
{
register int i;
xkbDoodadWireDesc * doodadWire;
@@ -340,13 +279,7 @@ xkbDoodadWireDesc * doodadWire;
}
static char *
-#if NeedFunctionPrototypes
_WriteGeomOverlay(char *wire,XkbOverlayPtr ol)
-#else
-_WriteGeomOverlay(wire,ol)
- char * wire;
- XkbOverlayPtr ol;
-#endif
{
register int r;
XkbOverlayRowPtr row;
@@ -376,13 +309,7 @@ xkbOverlayWireDesc * olWire;
}
static char *
-#if NeedFunctionPrototypes
_WriteGeomSections(char *wire,XkbGeometryPtr geom)
-#else
-_WriteGeomSections(wire,geom)
- char * wire;
- XkbGeometryPtr geom;
-#endif
{
register int i;
XkbSectionPtr section;
@@ -444,13 +371,7 @@ xkbSectionWireDesc * sectionWire;
}
static char *
-#if NeedFunctionPrototypes
_WriteGeomKeyAliases(char *wire,XkbGeometryPtr geom)
-#else
-_WriteGeomKeyAliases(wire,geom)
- char * wire;
- XkbGeometryPtr geom;
-#endif
{
register int sz;
@@ -465,16 +386,8 @@ register int sz;
/***====================================================================***/
static Status
-#if NeedFunctionPrototypes
_SendSetGeometry(Display *dpy,XkbGeometryPtr geom,xkbSetGeometryReq *req)
-#else
-_SendSetGeometry(dpy,geom,req)
- Display * dpy;
- XkbGeometryPtr geom;
- xkbSetGeometryReq * req;
-#endif
{
-xkbSetGeometryReq tmp;
int sz;
char * wire,*tbuf;
@@ -487,7 +400,6 @@ char * wire,*tbuf;
sz+= _SizeGeomDoodads(geom->num_doodads,geom->doodads);
sz+= _SizeGeomKeyAliases(geom);
req->length+= (sz/4);
- tmp= *req;
if (sz<BUFSIZE) {
BufAlloc(char *,wire,sz);
tbuf= NULL;
@@ -521,14 +433,7 @@ char * wire,*tbuf;
/***====================================================================***/
Status
-#if NeedFunctionPrototypes
XkbSetGeometry(Display *dpy,unsigned deviceSpec,XkbGeometryPtr geom)
-#else
-XkbSetGeometry(dpy,deviceSpec,geom)
- Display * dpy;
- unsigned deviceSpec;
- XkbGeometryPtr geom;
-#endif
{
xkbSetGeometryReq *req;
Status ret;
diff --git a/src/xkb/XKBSetMap.c b/src/xkb/XKBSetMap.c
index f7b99bde..3e56e98a 100644
--- a/src/xkb/XKBSetMap.c
+++ b/src/xkb/XKBSetMap.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/lib/X11/XKBSetMap.c,v 3.2 2001/01/17 19:41:49 dawes Exp $ */
#include <stdio.h>
#define NEED_REPLIES
@@ -33,13 +34,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "XKBlibint.h"
static int
-#if NeedFunctionPrototypes
_XkbSizeKeyTypes(XkbDescPtr xkb,xkbSetMapReq *req)
-#else
-_XkbSizeKeyTypes(xkb,req)
- XkbDescPtr xkb;
- xkbSetMapReq * req;
-#endif
{
XkbKeyTypePtr map;
int i,len;
@@ -61,14 +56,7 @@ _XkbSizeKeyTypes(xkb,req)
}
static void
-#if NeedFunctionPrototypes
_XkbWriteKeyTypes(Display *dpy,XkbDescPtr xkb,xkbSetMapReq *req)
-#else
-_XkbWriteKeyTypes(dpy,xkb,req)
- Display * dpy;
- XkbDescPtr xkb;
- xkbSetMapReq * req;
-#endif
{
char * buf;
XkbKeyTypePtr type;
@@ -114,13 +102,7 @@ _XkbWriteKeyTypes(dpy,xkb,req)
}
static int
-#if NeedFunctionPrototypes
_XkbSizeKeySyms(XkbDescPtr xkb,xkbSetMapReq *req)
-#else
-_XkbSizeKeySyms(xkb,req)
- XkbDescPtr xkb;
- xkbSetMapReq * req;
-#endif
{
int i,len;
unsigned nSyms;
@@ -141,14 +123,7 @@ _XkbSizeKeySyms(xkb,req)
}
static void
-#if NeedFunctionPrototypes
_XkbWriteKeySyms(Display *dpy,XkbDescPtr xkb,xkbSetMapReq *req)
-#else
-_XkbWriteKeySyms(dpy,xkb,req)
- Display * dpy;
- XkbDescPtr xkb;
- xkbSetMapReq * req;
-#endif
{
register KeySym * pSym;
CARD32 * outSym;
@@ -180,13 +155,7 @@ register int i;
}
static int
-#if NeedFunctionPrototypes
_XkbSizeKeyActions(XkbDescPtr xkb,xkbSetMapReq *req)
-#else
-_XkbSizeKeyActions(xkb,req)
- XkbDescPtr xkb;
- xkbSetMapReq * req;
-#endif
{
int i,len,nActs;
@@ -206,14 +175,7 @@ _XkbSizeKeyActions(xkb,req)
}
static void
-#if NeedFunctionPrototypes
_XkbWriteKeyActions(Display *dpy,XkbDescPtr xkb,xkbSetMapReq *req)
-#else
-_XkbWriteKeyActions(dpy,xkb,req)
- Display * dpy;
- XkbDescPtr xkb;
- xkbSetMapReq * req;
-#endif
{
register int i;
int n;
@@ -244,13 +206,7 @@ _XkbWriteKeyActions(dpy,xkb,req)
}
static int
-#if NeedFunctionPrototypes
_XkbSizeKeyBehaviors(XkbDescPtr xkb,xkbSetMapReq *req)
-#else
-_XkbSizeKeyBehaviors(xkb,req)
- XkbDescPtr xkb;
- xkbSetMapReq * req;
-#endif
{
register int i,first,last,nFound;
@@ -271,14 +227,7 @@ register int i,first,last,nFound;
}
static void
-#if NeedFunctionPrototypes
_XkbWriteKeyBehaviors(Display *dpy,XkbDescPtr xkb,xkbSetMapReq *req)
-#else
-_XkbWriteKeyBehaviors(dpy,xkb,req)
- Display * dpy;
- XkbDescPtr xkb;
- xkbSetMapReq * req;
-#endif
{
register int i,first,last;
xkbBehaviorWireDesc * wire;
@@ -305,12 +254,7 @@ char * buf;
}
static unsigned
-#if NeedFunctionPrototypes
_XkbSizeVirtualMods(xkbSetMapReq *req)
-#else
-_XkbSizeVirtualMods(req)
- xkbSetMapReq * req;
-#endif
{
register int i,bit,nMods;
@@ -327,18 +271,10 @@ register int i,bit,nMods;
}
static void
-#if NeedFunctionPrototypes
_XkbWriteVirtualMods( Display * dpy,
XkbDescPtr xkb,
xkbSetMapReq * req,
unsigned size)
-#else
-_XkbWriteVirtualMods(dpy,xkb,req,size)
- Display * dpy;
- XkbDescPtr xkb;
- xkbSetMapReq * req;
- unsigned size;
-#endif
{
register int i,bit;
CARD8 *vmods;
@@ -355,13 +291,7 @@ _XkbWriteVirtualMods(dpy,xkb,req,size)
}
static int
-#if NeedFunctionPrototypes
_XkbSizeKeyExplicit(XkbDescPtr xkb,xkbSetMapReq *req)
-#else
-_XkbSizeKeyExplicit(xkb,req)
- XkbDescPtr xkb;
- xkbSetMapReq * req;
-#endif
{
register int i,first,last,nFound;
@@ -383,14 +313,7 @@ register int i,first,last,nFound;
}
static void
-#if NeedFunctionPrototypes
_XkbWriteKeyExplicit(Display *dpy,XkbDescPtr xkb,xkbSetMapReq *req)
-#else
-_XkbWriteKeyExplicit(dpy,xkb,req)
- Display * dpy;
- XkbDescPtr xkb;
- xkbSetMapReq * req;
-#endif
{
register int i,first,last;
CARD8 * wire;
@@ -412,13 +335,7 @@ CARD8 * wire;
}
static int
-#if NeedFunctionPrototypes
_XkbSizeModifierMap(XkbDescPtr xkb,xkbSetMapReq *req)
-#else
-_XkbSizeModifierMap(xkb,req)
- XkbDescPtr xkb;
- xkbSetMapReq * req;
-#endif
{
register int i,first,last,nFound;
@@ -440,14 +357,7 @@ register int i,first,last,nFound;
}
static void
-#if NeedFunctionPrototypes
_XkbWriteModifierMap(Display *dpy,XkbDescPtr xkb,xkbSetMapReq *req)
-#else
-_XkbWriteModifierMap(dpy,xkb,req)
- Display * dpy;
- XkbDescPtr xkb;
- xkbSetMapReq * req;
-#endif
{
register int i,first,last;
CARD8 * wire;
@@ -471,13 +381,7 @@ CARD8 * wire;
}
static int
-#if NeedFunctionPrototypes
_XkbSizeVirtualModMap(XkbDescPtr xkb,xkbSetMapReq *req)
-#else
-_XkbSizeVirtualModMap(xkb,req)
- XkbDescPtr xkb;
- xkbSetMapReq * req;
-#endif
{
register int i,first,last,nFound;
@@ -499,14 +403,7 @@ register int i,first,last,nFound;
}
static void
-#if NeedFunctionPrototypes
_XkbWriteVirtualModMap(Display *dpy,XkbDescPtr xkb,xkbSetMapReq *req)
-#else
-_XkbWriteVirtualModMap(dpy,xkb,req)
- Display * dpy;
- XkbDescPtr xkb;
- xkbSetMapReq * req;
-#endif
{
register int i,first,last;
xkbVModMapWireDesc * wire;
@@ -530,14 +427,7 @@ xkbVModMapWireDesc * wire;
}
static void
-#if NeedFunctionPrototypes
SendSetMap(Display *dpy,XkbDescPtr xkb,xkbSetMapReq *req)
-#else
-SendSetMap(dpy,xkb,req)
- Display * dpy;
- XkbDescPtr xkb;
- xkbSetMapReq * req;
-#endif
{
xkbSetMapReq tmp;
unsigned szMods;
@@ -573,14 +463,7 @@ unsigned szMods;
}
Bool
-#if NeedFunctionPrototypes
XkbSetMap(Display *dpy,unsigned which,XkbDescPtr xkb)
-#else
-XkbSetMap(dpy,which,xkb)
- Display * dpy;
- unsigned which;
- XkbDescPtr xkb;
-#endif
{
register xkbSetMapReq * req;
XkbInfoPtr xkbi;
@@ -650,14 +533,7 @@ XkbClientMapPtr map;
}
Bool
-#if NeedFunctionPrototypes
XkbChangeMap(Display *dpy,XkbDescPtr xkb,XkbMapChangesPtr changes)
-#else
-XkbChangeMap(dpy,xkb,changes)
- Display * dpy;
- XkbDescPtr xkb;
- XkbMapChangesPtr changes;
-#endif
{
register xkbSetMapReq * req;
XkbInfoPtr xkbi;
diff --git a/src/xkb/XKBUse.c b/src/xkb/XKBUse.c
index 1b564cc6..aea49cb6 100644
--- a/src/xkb/XKBUse.c
+++ b/src/xkb/XKBUse.c
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/lib/X11/XKBUse.c,v 3.7 2003/07/07 15:34:21 eich Exp $ */
#include <stdio.h>
#include <ctype.h>
@@ -33,21 +34,10 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <X11/extensions/XKBproto.h>
#include "XKBlibint.h"
-#ifdef X_NOT_STDC_ENV
-extern char *getenv();
-#endif
-
static Bool _XkbIgnoreExtension = False;
void
-#if NeedFunctionPrototypes
XkbNoteMapChanges(XkbMapChangesPtr old,XkbMapNotifyEvent *new,unsigned wanted)
-#else
-XkbNoteMapChanges(old,new,wanted)
- XkbMapChangesPtr old;
- XkbMapNotifyEvent * new;
- unsigned int wanted;
-#endif
{
int first,oldLast,newLast;
wanted&= new->changed;
@@ -186,16 +176,9 @@ XkbNoteMapChanges(old,new,wanted)
}
void
-#if NeedFunctionPrototypes
_XkbNoteCoreMapChanges( XkbMapChangesPtr old,
XMappingEvent * new,
unsigned int wanted)
-#else
-_XkbNoteCoreMapChanges(old,new,wanted)
- XkbMapChangesPtr old;
- XMappingEvent * new;
- unsigned int wanted;
-#endif
{
int first,oldLast,newLast;
@@ -222,14 +205,7 @@ _XkbNoteCoreMapChanges(old,new,wanted)
}
static Bool
-#if NeedFunctionPrototypes
wire_to_event(Display *dpy,XEvent *re,xEvent *event)
-#else
-wire_to_event(dpy,re,event)
- Display *dpy;
- XEvent *re;
- xEvent *event;
-#endif
{
xkbEvent *xkbevent= (xkbEvent *)event;
XkbInfoPtr xkbi;
@@ -615,12 +591,7 @@ wire_to_event(dpy,re,event)
}
Bool
-#if NeedFunctionPrototypes
XkbIgnoreExtension(Bool ignore)
-#else
-XkbIgnoreExtension(ignore)
- Bool ignore;
-#endif
{
if (getenv("XKB_FORCE")!=NULL) {
#ifdef DEBUG
@@ -638,12 +609,7 @@ XkbIgnoreExtension(ignore)
}
static void
-#if NeedFunctionPrototypes
_XkbFreeInfo(Display *dpy)
-#else
-_XkbFreeInfo(dpy)
- Display *dpy;
-#endif
{
XkbInfoPtr xkbi = dpy->xkb_info;
if (xkbi) {
@@ -654,14 +620,7 @@ _XkbFreeInfo(dpy)
}
Bool
-#if NeedFunctionPrototypes
XkbUseExtension(Display *dpy,int *major_rtrn,int *minor_rtrn)
-#else
-XkbUseExtension(dpy,major_rtrn,minor_rtrn)
- Display * dpy;
- int * major_rtrn;
- int * minor_rtrn;
-#endif
{
xkbUseExtensionReply rep;
register xkbUseExtensionReq *req;
@@ -672,7 +631,7 @@ XkbUseExtension(dpy,major_rtrn,minor_rtrn)
static int debugMsg;
static int been_here= 0;
- if ( dpy->xkb_info ) {
+ if ( dpy->xkb_info && !(dpy->flags & XlibDisplayNoXkb)) {
if (major_rtrn) *major_rtrn= dpy->xkb_info->srv_major;
if (minor_rtrn) *minor_rtrn= dpy->xkb_info->srv_minor;
return True;
@@ -685,8 +644,78 @@ XkbUseExtension(dpy,major_rtrn,minor_rtrn)
if (major_rtrn) *major_rtrn= 0;
if (minor_rtrn) *minor_rtrn= 0;
+ if (!dpy->xkb_info) {
+ xkbi = _XkbTypedCalloc(1, XkbInfoRec);
+ if ( !xkbi )
+ return False;
+ dpy->xkb_info = xkbi;
+ dpy->free_funcs->xkb = _XkbFreeInfo;
+
+ xkbi->xlib_ctrls|= (XkbLC_ControlFallback|XkbLC_ConsumeLookupMods);
+ if ((str=getenv("_XKB_OPTIONS_ENABLE"))!=NULL) {
+ if ((str=getenv("_XKB_LATIN1_LOOKUP"))!=NULL) {
+ if ((strcmp(str,"off")==0)||(strcmp(str,"0")==0))
+ xkbi->xlib_ctrls&= ~XkbLC_ForceLatin1Lookup;
+ else xkbi->xlib_ctrls|= XkbLC_ForceLatin1Lookup;
+ }
+ if ((str=getenv("_XKB_CONSUME_LOOKUP_MODS"))!=NULL) {
+ if ((strcmp(str,"off")==0)||(strcmp(str,"0")==0))
+ xkbi->xlib_ctrls&= ~XkbLC_ConsumeLookupMods;
+ else xkbi->xlib_ctrls|= XkbLC_ConsumeLookupMods;
+ }
+ if ((str=getenv("_XKB_CONSUME_SHIFT_AND_LOCK"))!=NULL) {
+ if ((strcmp(str,"off")==0)||(strcmp(str,"0")==0))
+ xkbi->xlib_ctrls&= ~XkbLC_AlwaysConsumeShiftAndLock;
+ else xkbi->xlib_ctrls|= XkbLC_AlwaysConsumeShiftAndLock;
+ }
+ if ((str=getenv("_XKB_IGNORE_NEW_KEYBOARDS"))!=NULL) {
+ if ((strcmp(str,"off")==0)||(strcmp(str,"0")==0))
+ xkbi->xlib_ctrls&= ~XkbLC_IgnoreNewKeyboards;
+ else xkbi->xlib_ctrls|= XkbLC_IgnoreNewKeyboards;
+ }
+ if ((str=getenv("_XKB_CONTROL_FALLBACK"))!=NULL) {
+ if ((strcmp(str,"off")==0)||(strcmp(str,"0")==0))
+ xkbi->xlib_ctrls&= ~XkbLC_ControlFallback;
+ else xkbi->xlib_ctrls|= XkbLC_ControlFallback;
+ }
+ if ((str=getenv("_XKB_COMP_LED"))!=NULL) {
+ if ((strcmp(str,"off")==0)||(strcmp(str,"0")==0))
+ xkbi->xlib_ctrls&= ~XkbLC_ComposeLED;
+ else {
+ xkbi->xlib_ctrls|= XkbLC_ComposeLED;
+ if (strlen(str)>0)
+ xkbi->composeLED= XInternAtom(dpy,str,False);
+ }
+ }
+ if ((str=getenv("_XKB_COMP_FAIL_BEEP"))!=NULL) {
+ if ((strcmp(str,"off")==0)||(strcmp(str,"0")==0))
+ xkbi->xlib_ctrls&= ~XkbLC_BeepOnComposeFail;
+ else xkbi->xlib_ctrls|= XkbLC_BeepOnComposeFail;
+ }
+ }
+ if ((xkbi->composeLED==None)&&((xkbi->xlib_ctrls&XkbLC_ComposeLED)!=0))
+ xkbi->composeLED= XInternAtom(dpy,"Compose",False);
+#ifdef DEBUG
+ if (debugMsg) {
+ register unsigned c= xkbi->xlib_ctrls;
+ fprintf(stderr,"XKEYBOARD compose: beep on failure is %s, LED is %s\n",
+ ((c&XkbLC_BeepOnComposeFail)?"on":"off"),
+ ((c&XkbLC_ComposeLED)?"on":"off"));
+ fprintf(stderr,"XKEYBOARD XLookupString: %slatin-1, %s lookup modifiers\n",
+ ((c&XkbLC_ForceLatin1Lookup)?"allow non-":"force "),
+ ((c&XkbLC_ConsumeLookupMods)?"consume":"re-use"));
+ fprintf(stderr,
+ "XKEYBOARD XLookupString: %sconsume shift and lock, %scontrol fallback\n",
+ ((c&XkbLC_AlwaysConsumeShiftAndLock)?"always ":"don't "),
+ ((c&XkbLC_ControlFallback)?"":"no "));
+
+ }
+#endif
+ } else
+ xkbi = dpy->xkb_info;
+
forceIgnore= (dpy->flags&XlibDisplayNoXkb)||dpy->keysyms;
- forceIgnore= forceIgnore&(major_rtrn==NULL)&&(minor_rtrn==NULL);
+ forceIgnore= forceIgnore&&(major_rtrn==NULL)&&(minor_rtrn==NULL);
if ( forceIgnore || _XkbIgnoreExtension || getenv("XKB_DISABLE")) {
LockDisplay(dpy);
dpy->flags |= XlibDisplayNoXkb;
@@ -696,15 +725,10 @@ XkbUseExtension(dpy,major_rtrn,minor_rtrn)
return False;
}
- xkbi = _XkbTypedCalloc(1, XkbInfoRec);
- if ( !xkbi )
- return False;
-
if ( (codes=XInitExtension(dpy,XkbName))==NULL ) {
LockDisplay(dpy);
dpy->flags |= XlibDisplayNoXkb;
UnlockDisplay(dpy);
- Xfree(xkbi);
if (debugMsg)
fprintf(stderr,"XKEYBOARD extension not present\n");
return False;
@@ -746,8 +770,7 @@ XkbUseExtension(dpy,major_rtrn,minor_rtrn)
dpy->flags |= XlibDisplayNoXkb;
UnlockDisplay(dpy);
SyncHandle();
- Xfree(xkbi);
- if (major_rtrn) *major_rtrn= rep.serverMajor;
+ if (major_rtrn) *major_rtrn= rep.serverMajor;
if (minor_rtrn) *minor_rtrn= rep.serverMinor;
return False;
}
@@ -766,70 +789,8 @@ XkbUseExtension(dpy,major_rtrn,minor_rtrn)
fprintf(stderr,"XKEYBOARD (version %d.%02d/%d.%02d) OK!\n",
XkbMajorVersion,XkbMinorVersion,
rep.serverMajor,rep.serverMinor);
- dpy->xkb_info = xkbi;
- dpy->free_funcs->xkb = _XkbFreeInfo;
- ev_base = codes->first_event;
- xkbi->xlib_ctrls|=
- (XkbLC_BeepOnComposeFail|XkbLC_ComposeLED|XkbLC_ControlFallback);
- if ((str=getenv("_XKB_OPTIONS_ENABLE"))!=NULL) {
- if ((str=getenv("_XKB_LATIN1_LOOKUP"))!=NULL) {
- if ((strcmp(str,"off")==0)||(strcmp(str,"0")==0))
- xkbi->xlib_ctrls&= ~XkbLC_ForceLatin1Lookup;
- else xkbi->xlib_ctrls|= XkbLC_ForceLatin1Lookup;
- }
- if ((str=getenv("_XKB_CONSUME_LOOKUP_MODS"))!=NULL) {
- if ((strcmp(str,"off")==0)||(strcmp(str,"0")==0))
- xkbi->xlib_ctrls&= ~XkbLC_ConsumeLookupMods;
- else xkbi->xlib_ctrls|= XkbLC_ConsumeLookupMods;
- }
- if ((str=getenv("_XKB_CONSUME_SHIFT_AND_LOCK"))!=NULL) {
- if ((strcmp(str,"off")==0)||(strcmp(str,"0")==0))
- xkbi->xlib_ctrls&= ~XkbLC_AlwaysConsumeShiftAndLock;
- else xkbi->xlib_ctrls|= XkbLC_AlwaysConsumeShiftAndLock;
- }
- if ((str=getenv("_XKB_IGNORE_NEW_KEYBOARDS"))!=NULL) {
- if ((strcmp(str,"off")==0)||(strcmp(str,"0")==0))
- xkbi->xlib_ctrls&= ~XkbLC_IgnoreNewKeyboards;
- else xkbi->xlib_ctrls|= XkbLC_IgnoreNewKeyboards;
- }
- if ((str=getenv("_XKB_CONTROL_FALLBACK"))!=NULL) {
- if ((strcmp(str,"off")==0)||(strcmp(str,"0")==0))
- xkbi->xlib_ctrls&= ~XkbLC_ControlFallback;
- else xkbi->xlib_ctrls|= XkbLC_ControlFallback;
- }
- if ((str=getenv("_XKB_COMP_LED"))!=NULL) {
- if ((strcmp(str,"off")==0)||(strcmp(str,"0")==0))
- xkbi->xlib_ctrls&= ~XkbLC_ComposeLED;
- else {
- xkbi->xlib_ctrls|= XkbLC_ComposeLED;
- if (strlen(str)>0)
- xkbi->composeLED= XInternAtom(dpy,str,False);
- }
- }
- if ((str=getenv("_XKB_COMP_FAIL_BEEP"))!=NULL) {
- if ((strcmp(str,"off")==0)||(strcmp(str,"0")==0))
- xkbi->xlib_ctrls&= ~XkbLC_BeepOnComposeFail;
- else xkbi->xlib_ctrls|= XkbLC_BeepOnComposeFail;
- }
- }
- if ((xkbi->composeLED==None)&&((xkbi->xlib_ctrls&XkbLC_ComposeLED)!=0))
- xkbi->composeLED= XInternAtom(dpy,"Compose",False);
-#ifdef DEBUG
- if (debugMsg) {
- register unsigned c= xkbi->xlib_ctrls;
- fprintf(stderr,"XKEYBOARD compose: beep on failure is %s, LED is %s\n",
- ((c&XkbLC_BeepOnComposeFail)?"on":"off"),
- ((c&XkbLC_ComposeLED)?"on":"off"));
- fprintf(stderr,"XKEYBOARD XLookupString: %slatin-1, %s lookup modifiers\n",
- ((c&XkbLC_ForceLatin1Lookup)?"allow non-":"force "),
- ((c&XkbLC_ConsumeLookupMods)?"consume":"re-use"));
- fprintf(stderr,
- "XKEYBOARD XLookupString: %sconsume shift and lock, %scontrol fallback\n",
- ((c&XkbLC_AlwaysConsumeShiftAndLock)?"always ":"don't "),
- ((c&XkbLC_ControlFallback)?"":"no "));
- }
-#endif
+ ev_base = codes->first_event;
XESetWireToEvent(dpy,ev_base+XkbEventCode,wire_to_event);
SyncHandle();
return True;
diff --git a/src/xkb/XKBleds.c b/src/xkb/XKBleds.c
index a4636157..be6e6a1a 100644
--- a/src/xkb/XKBleds.c
+++ b/src/xkb/XKBleds.c
@@ -24,22 +24,17 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/lib/X11/XKBleds.c,v 1.4 2003/04/13 19:22:18 dawes Exp $ */
#define NEED_REPLIES
#define NEED_EVENTS
+#define NEED_MAP_READERS
#include "Xlibint.h"
#include <X11/extensions/XKBproto.h>
#include "XKBlibint.h"
Status
-#if NeedFunctionPrototypes
XkbGetIndicatorState(Display *dpy,unsigned deviceSpec,unsigned *pStateRtrn)
-#else
-XkbGetIndicatorState(dpy,deviceSpec,pStateRtrn)
- Display * dpy;
- unsigned int deviceSpec;
- unsigned int * pStateRtrn;
-#endif
{
register xkbGetIndicatorStateReq *req;
xkbGetIndicatorStateReply rep;
@@ -64,18 +59,10 @@ XkbGetIndicatorState(dpy,deviceSpec,pStateRtrn)
}
Status
-#if NeedFunctionPrototypes
_XkbReadGetIndicatorMapReply( Display * dpy,
xkbGetIndicatorMapReply * rep,
XkbDescPtr xkb,
int * nread_rtrn)
-#else
-_XkbReadGetIndicatorMapReply(dpy,rep,xkb,nread_rtrn)
- Display * dpy;
- xkbGetIndicatorMapReply * rep;
- XkbDescPtr xkb;
- int * nread_rtrn;
-#endif
{
XkbIndicatorPtr leds;
XkbReadBufferRec buf;
@@ -122,14 +109,7 @@ XkbReadBufferRec buf;
}
Bool
-#if NeedFunctionPrototypes
XkbGetIndicatorMap(Display *dpy,unsigned long which,XkbDescPtr xkb)
-#else
-XkbGetIndicatorMap(dpy,which,xkb)
- Display * dpy;
- unsigned long which;
- XkbDescPtr xkb;
-#endif
{
register xkbGetIndicatorMapReq * req;
xkbGetIndicatorMapReply rep;
@@ -169,14 +149,7 @@ XkbGetIndicatorMap(dpy,which,xkb)
}
Bool
-#if NeedFunctionPrototypes
XkbSetIndicatorMap(Display *dpy,unsigned long which,XkbDescPtr xkb)
-#else
-XkbSetIndicatorMap(dpy,which,xkb)
- Display * dpy;
- unsigned long which;
- XkbDescPtr xkb;
-#endif
{
register xkbSetIndicatorMapReq *req;
register int i,bit;
@@ -221,7 +194,6 @@ XkbSetIndicatorMap(dpy,which,xkb)
}
Bool
-#if NeedFunctionPrototypes
XkbGetNamedDeviceIndicator( Display * dpy,
unsigned device,
unsigned class,
@@ -231,19 +203,6 @@ XkbGetNamedDeviceIndicator( Display * dpy,
Bool * pStateRtrn,
XkbIndicatorMapPtr pMapRtrn,
Bool * pRealRtrn)
-#else
-XkbGetNamedDeviceIndicator(dpy,device,class,id,name,pNdxRtrn,pStateRtrn,
- pMapRtrn,pRealRtrn)
- Display * dpy;
- unsigned device;
- unsigned class;
- unsigned id;
- Atom name;
- int * pNdxRtrn;
- Bool * pStateRtrn;
- XkbIndicatorMapPtr pMapRtrn;
- Bool * pRealRtrn;
-#endif
{
register xkbGetNamedIndicatorReq *req;
xkbGetNamedIndicatorReply rep;
@@ -288,22 +247,12 @@ XkbGetNamedDeviceIndicator(dpy,device,class,id,name,pNdxRtrn,pStateRtrn,
}
Bool
-#if NeedFunctionPrototypes
XkbGetNamedIndicator( Display * dpy,
Atom name,
int * pNdxRtrn,
Bool * pStateRtrn,
XkbIndicatorMapPtr pMapRtrn,
Bool * pRealRtrn)
-#else
-XkbGetNamedIndicator(dpy,name,pNdxRtrn,pStateRtrn,pMapRtrn,pRealRtrn)
- Display * dpy;
- Atom name;
- int * pNdxRtrn;
- Bool * pStateRtrn;
- XkbIndicatorMapPtr pMapRtrn;
- Bool * pRealRtrn;
-#endif
{
return XkbGetNamedDeviceIndicator(dpy,XkbUseCoreKbd,
XkbDfltXIClass,XkbDfltXIId,
@@ -312,7 +261,6 @@ XkbGetNamedIndicator(dpy,name,pNdxRtrn,pStateRtrn,pMapRtrn,pRealRtrn)
}
Bool
-#if NeedFunctionPrototypes
XkbSetNamedDeviceIndicator( Display * dpy,
unsigned device,
unsigned class,
@@ -322,26 +270,12 @@ XkbSetNamedDeviceIndicator( Display * dpy,
Bool state,
Bool createNewMap,
XkbIndicatorMapPtr pMap)
-#else
-XkbSetNamedDeviceIndicator(dpy,device,class,id,name,changeState,
- state,createNewMap,pMap)
- Display * dpy;
- unsigned device;
- unsigned class;
- unsigned id;
- Atom name;
- Bool changeState;
- Bool state;
- Bool createNewMap;
- XkbIndicatorMapPtr pMap;
-#endif
{
register xkbSetNamedIndicatorReq *req;
XkbInfoPtr xkbi;
if ((dpy->flags & XlibDisplayNoXkb) || (name==None) ||
- (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)) ||
- (pMap==NULL))
+ (!dpy->xkb_info && !XkbUseExtension(dpy,NULL,NULL)))
return False;
LockDisplay(dpy);
xkbi = dpy->xkb_info;
@@ -384,22 +318,12 @@ XkbSetNamedDeviceIndicator(dpy,device,class,id,name,changeState,
}
Bool
-#if NeedFunctionPrototypes
XkbSetNamedIndicator( Display * dpy,
Atom name,
Bool changeState,
Bool state,
Bool createNewMap,
XkbIndicatorMapPtr pMap)
-#else
-XkbSetNamedIndicator(dpy,name,changeState,state,createNewMap,pMap)
- Display * dpy;
- Atom name;
- Bool changeState;
- Bool state;
- Bool createNewMap;
- XkbIndicatorMapPtr pMap;
-#endif
{
return XkbSetNamedDeviceIndicator(dpy,XkbUseCoreKbd,
XkbDfltXIClass,XkbDfltXIId,
diff --git a/src/xkb/XKBlibint.h b/src/xkb/XKBlibint.h
index 5247cb7c..a154d1bc 100644
--- a/src/xkb/XKBlibint.h
+++ b/src/xkb/XKBlibint.h
@@ -24,6 +24,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
THE USE OR PERFORMANCE OF THIS SOFTWARE.
********************************************************/
+/* $XFree86: xc/lib/X11/XKBlibint.h,v 3.5 2003/04/18 18:21:45 torrey Exp $ */
#ifndef _XKBLIBINT_H_
#define _XKBLIBINT_H_
@@ -35,28 +36,22 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define XkbXlibNewKeyboard (1<<1)
typedef int (*XkbKSToMBFunc)(
-#if NeedFunctionPrototypes
XPointer /* priv */,
KeySym /* sym */,
char * /* buf */,
int /* len */,
int * /* extra_rtrn */
-#endif
);
typedef KeySym (*XkbMBToKSFunc)(
-#if NeedFunctionPrototypes
XPointer /* priv */,
char * /* buf */,
int /* len */,
Status * /* status */
-#endif
);
typedef KeySym (*XkbToUpperFunc)(
-#if NeedFunctionPrototypes
KeySym /* sym */
-#endif
);
typedef struct _XkbConverters {
@@ -140,131 +135,103 @@ typedef struct _XkbReadBuffer {
_XFUNCPROTOBEGIN
extern void _XkbReloadDpy(
-#if NeedFunctionPrototypes
Display * /* dpy */
-#endif
);
extern KeySym _XKeycodeToKeysym(
-#if NeedFunctionPrototypes
Display* /* display */,
+#if NeedWidePrototypes
+ unsigned int /* keycode */,
+#else
KeyCode /* keycode */,
- int /* index */
#endif
+ int /* index */
);
extern KeyCode _XKeysymToKeycode(
-#if NeedFunctionPrototypes
Display* /* display */,
KeySym /* keysym */
-#endif
);
extern KeySym _XLookupKeysym(
-#if NeedFunctionPrototypes
XKeyEvent* /* key_event */,
int /* index */
-#endif
);
extern int _XRefreshKeyboardMapping(
-#if NeedFunctionPrototypes
XMappingEvent* /* event_map */
-#endif
);
extern unsigned _XKeysymToModifiers(
-#if NeedFunctionPrototypes
Display * /* dpy */,
KeySym /* ks */
-#endif
);
extern int _XTranslateKey(
-#if NeedFunctionPrototypes
register Display * /* dpy */,
KeyCode /* keycode */,
register unsigned int /* modifiers */,
unsigned int * /* modifiers_return */,
KeySym * /* keysym_return */
-#endif
);
extern int _XTranslateKeySym(
-#if NeedFunctionPrototypes
Display * /* dpy */,
register KeySym /* symbol */,
unsigned int /* modifiers */,
char * /* buffer */,
int /* nbytes */
-#endif
);
extern int _XLookupString(
-#if NeedFunctionPrototypes
register XKeyEvent * /* event */,
char * /* buffer */,
int /* nbytes */,
KeySym * /* keysym */,
XComposeStatus * /* status */
-#endif
);
extern void _XkbNoteCoreMapChanges(
-#if NeedFunctionPrototypes
XkbMapChangesRec * /* old */,
XMappingEvent * /* new */,
unsigned int /* wanted */
-#endif
);
extern int _XkbInitReadBuffer(
-#if NeedFunctionPrototypes
Display * /* dpy */,
XkbReadBufferPtr /* buf */,
int /* size */
-#endif
);
extern int _XkbSkipReadBufferData(
-#if NeedFunctionPrototypes
XkbReadBufferPtr /* from */,
int /* size */
-#endif
);
extern int _XkbCopyFromReadBuffer(
-#if NeedFunctionPrototypes
XkbReadBufferPtr /* from */,
char * /* to */,
int /* size */
-#endif
);
#if defined(WORD64) || defined(LONG64)
extern int _XkbReadCopyData32(
-#if NeedFunctionPrototypes
int * /* from */,
long * /* to */,
int /* num_words */
-#endif
);
extern int _XkbWriteCopyData32(
-#if NeedFunctionPrototypes
unsigned long * /* from */,
CARD32 * /* to */,
int /* num_words */
-#endif
);
extern int _XkbReadBufferCopy32(
-#if NeedFunctionPrototypes
XkbReadBufferPtr /* from */,
long * /* to */,
int /* size */
-#endif
);
#else
#define _XkbReadCopyData32(f,t,s) memcpy((char *)(t),(char *)(f),(s)*4)
@@ -278,23 +245,18 @@ extern int _XkbReadBufferCopy32(
#ifdef XKB_FORCE_INT_KEYSYM
extern int _XkbReadCopyKeySyms(
-#if NeedFunctionPrototypes
int * /* from */,
KeySym * /* to */,
int /* num_words */
-#endif
);
extern int _XkbWriteCopyKeySyms(
-#if NeedFunctionPrototypes
KeySym * /* from */,
CARD32 * /* to */,
int /* num_words */
-#endif
);
extern int _XkbReadBufferCopyKeySyms(
-#if NeedFunctionPrototypes
XkbReadBufferPtr /* from */,
#ifndef NO_DEC_BUG_FIX
KeySym * /* to */,
@@ -302,7 +264,6 @@ extern int _XkbReadBufferCopyKeySyms(
long * /* to */,
#endif
int /* size */
-#endif
);
#else
#define _XkbReadCopyKeySyms(f,t,n) _XkbReadCopyData32(f,t,n)
@@ -311,92 +272,70 @@ extern int _XkbReadBufferCopyKeySyms(
#endif
extern char *_XkbPeekAtReadBuffer(
-#if NeedFunctionPrototypes
XkbReadBufferPtr /* from */,
int /* size */
-#endif
);
extern char *_XkbGetReadBufferPtr(
-#if NeedFunctionPrototypes
XkbReadBufferPtr /* from */,
int /* size */
-#endif
);
#define _XkbGetTypedRdBufPtr(b,n,t) ((t *)_XkbGetReadBufferPtr(b,(n)*SIZEOF(t)))
extern int _XkbFreeReadBuffer(
-#if NeedFunctionPrototypes
XkbReadBufferPtr /* buf */
-#endif
);
extern Bool
_XkbGetReadBufferCountedString(
-#if NeedFunctionPrototypes
XkbReadBufferPtr /* buf */,
char ** /* rtrn */
-#endif
);
extern char *_XkbGetCharset(
-#if NeedFunctionPrototypes
void
-#endif
);
extern int _XkbGetConverters(
-#if NeedFunctionPrototypes
char * /* encoding_name */,
XkbConverters * /* cvt_rtrn */
-#endif
);
#ifdef NEED_MAP_READERS
extern Status _XkbReadGetMapReply(
-#if NeedFunctionPrototypes
Display * /* dpy */,
xkbGetMapReply * /* rep */,
XkbDescRec * /* xkb */,
int * /* nread_rtrn */
-#endif
);
extern Status _XkbReadGetCompatMapReply(
-#if NeedFunctionPrototypes
Display * /* dpy */,
xkbGetCompatMapReply * /* rep */,
XkbDescPtr /* xkb */,
int * /* nread_rtrn */
-#endif
);
extern Status _XkbReadGetIndicatorMapReply(
-#if NeedFunctionPrototypes
Display * /* dpy */,
xkbGetIndicatorMapReply * /* rep */,
XkbDescPtr /* xkb */,
int * /* nread_rtrn */
-#endif
);
extern Status _XkbReadGetNamesReply(
-#if NeedFunctionPrototypes
Display * /* dpy */,
xkbGetNamesReply * /* rep */,
XkbDescPtr /* xkb */,
int * /* nread_rtrn */
-#endif
);
extern Status _XkbReadGetGeometryReply(
-#if NeedFunctionPrototypes
Display * /* dpy */,
xkbGetGeometryReply * /* rep */,
XkbDescPtr /* xkb */,
int * /* nread_rtrn */
-#endif
);
#endif
diff --git a/src/xlibi18n/ICWrap.c b/src/xlibi18n/ICWrap.c
index be511f4a..73b16031 100644
--- a/src/xlibi18n/ICWrap.c
+++ b/src/xlibi18n/ICWrap.c
@@ -64,15 +64,16 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/lib/X11/ICWrap.c,v 1.10 2003/04/25 14:12:38 tsi Exp $ */
#define NEED_EVENTS
#include "Xlibint.h"
#include "Xlcint.h"
static int
-_XIMNestedListToNestedList(nlist, list)
- XIMArg *nlist; /* This is the new list */
- XIMArg *list; /* The original list */
+_XIMNestedListToNestedList(
+ XIMArg *nlist, /* This is the new list */
+ XIMArg *list) /* The original list */
{
register XIMArg *ptr = list;
@@ -90,9 +91,9 @@ _XIMNestedListToNestedList(nlist, list)
}
static void
-_XIMCountNestedList(args, total_count)
- XIMArg *args;
- int *total_count;
+_XIMCountNestedList(
+ XIMArg *args,
+ int *total_count)
{
for (; args->name; args++) {
if (!strcmp(args->name, XNVaNestedList))
@@ -102,15 +103,8 @@ _XIMCountNestedList(args, total_count)
}
}
-#if NeedVarargsPrototypes
static void
_XIMCountVaList(va_list var, int *total_count)
-#else
-static void
-_XIMCountVaList(var, total_count)
- va_list var;
- int *total_count;
-#endif
{
char *attr;
@@ -120,22 +114,14 @@ _XIMCountVaList(var, total_count)
if (!strcmp(attr, XNVaNestedList)) {
_XIMCountNestedList(va_arg(var, XIMArg*), total_count);
} else {
- va_arg(var, XIMArg*);
+ (void)va_arg(var, XIMArg*);
++(*total_count);
}
}
}
-#if NeedVarargsPrototypes
static void
_XIMVaToNestedList(va_list var, int max_count, XIMArg **args_return)
-#else
-static void
-_XIMVaToNestedList(var, max_count, args_return)
- va_list var;
- int max_count;
- XIMArg **args_return;
-#endif
{
XIMArg *args;
char *attr;
@@ -162,40 +148,26 @@ _XIMVaToNestedList(var, max_count, args_return)
}
/*ARGSUSED*/
-#if NeedVarargsPrototypes
XVaNestedList
XVaCreateNestedList(int dummy, ...)
-#else
-XVaNestedList
-XVaCreateNestedList(dummy, va_alist)
- int dummy;
- va_dcl
-#endif
{
va_list var;
XIMArg *args = NULL;
int total_count;
- Va_start(var, dummy);
+ va_start(var, dummy);
_XIMCountVaList(var, &total_count);
va_end(var);
- Va_start(var, dummy);
+ va_start(var, dummy);
_XIMVaToNestedList(var, total_count, &args);
va_end(var);
return (XVaNestedList)args;
}
-#if NeedVarargsPrototypes
char *
XSetIMValues(XIM im, ...)
-#else /* NeedVarargsPrototypes */
-char *
-XSetIMValues(im, va_alist)
- XIM im;
- va_dcl
-#endif /* NeedVarargsPrototypes */
{
va_list var;
int total_count;
@@ -205,14 +177,14 @@ XSetIMValues(im, va_alist)
/*
* so count the stuff dangling here
*/
- Va_start(var, im);
+ va_start(var, im);
_XIMCountVaList(var, &total_count);
va_end(var);
/*
* now package it up so we can send it along
*/
- Va_start(var, im);
+ va_start(var, im);
_XIMVaToNestedList(var, total_count, &args);
va_end(var);
@@ -221,15 +193,8 @@ XSetIMValues(im, va_alist)
return ret;
}
-#if NeedVarargsPrototypes
char *
XGetIMValues(XIM im, ...)
-#else /* NeedVarargsPrototypes */
-char *
-XGetIMValues(im, va_alist)
- XIM im;
- va_dcl
-#endif /* NeedVarargsPrototypes */
{
va_list var;
int total_count;
@@ -239,14 +204,14 @@ XGetIMValues(im, va_alist)
/*
* so count the stuff dangling here
*/
- Va_start(var, im);
+ va_start(var, im);
_XIMCountVaList(var, &total_count);
va_end(var);
/*
* now package it up so we can send it along
*/
- Va_start(var, im);
+ va_start(var, im);
_XIMVaToNestedList(var, total_count, &args);
va_end(var);
@@ -260,15 +225,8 @@ XGetIMValues(im, va_alist)
* and return a pointer to the input context.
*/
-#if NeedVarargsPrototypes
XIC
XCreateIC(XIM im, ...)
-#else
-XIC
-XCreateIC(im, va_alist)
- XIM im; /* specified the attached input method */
- va_dcl /* specified variable length argment list */
-#endif
{
va_list var;
int total_count;
@@ -278,14 +236,14 @@ XCreateIC(im, va_alist)
/*
* so count the stuff dangling here
*/
- Va_start(var, im);
+ va_start(var, im);
_XIMCountVaList(var, &total_count);
va_end(var);
/*
* now package it up so we can send it along
*/
- Va_start(var, im);
+ va_start(var, im);
_XIMVaToNestedList(var, total_count, &args);
va_end(var);
@@ -320,15 +278,8 @@ XDestroyIC(ic)
Xfree ((char *) ic);
}
-#if NeedVarargsPrototypes
char *
XGetICValues(XIC ic, ...)
-#else
-char *
-XGetICValues(ic, va_alist)
- XIC ic;
- va_dcl
-#endif
{
va_list var;
int total_count;
@@ -341,14 +292,14 @@ XGetICValues(ic, va_alist)
/*
* so count the stuff dangling here
*/
- Va_start(var, ic);
+ va_start(var, ic);
_XIMCountVaList(var, &total_count);
va_end(var);
/*
* now package it up so we can send it along
*/
- Va_start(var, ic);
+ va_start(var, ic);
_XIMVaToNestedList(var, total_count, &args);
va_end(var);
@@ -357,15 +308,8 @@ XGetICValues(ic, va_alist)
return ret;
}
-#if NeedVarargsPrototypes
char *
XSetICValues(XIC ic, ...)
-#else
-char *
-XSetICValues(ic, va_alist)
- XIC ic;
- va_dcl
-#endif
{
va_list var;
int total_count;
@@ -378,14 +322,14 @@ XSetICValues(ic, va_alist)
/*
* so count the stuff dangling here
*/
- Va_start(var, ic);
+ va_start(var, ic);
_XIMCountVaList(var, &total_count);
va_end(var);
/*
* now package it up so we can send it along
*/
- Va_start(var, ic);
+ va_start(var, ic);
_XIMVaToNestedList(var, total_count, &args);
va_end(var);
@@ -402,7 +346,7 @@ void
XSetICFocus(ic)
XIC ic;
{
- if (ic->core.im)
+ if (ic && ic->core.im)
(*ic->methods->set_focus) (ic);
}
@@ -428,7 +372,8 @@ XIMOfIC(ic)
return ic->core.im;
}
-char *XmbResetIC(ic)
+char *
+XmbResetIC(ic)
XIC ic;
{
if (ic->core.im)
@@ -436,7 +381,8 @@ char *XmbResetIC(ic)
return (char *)NULL;
}
-wchar_t *XwcResetIC(ic)
+wchar_t *
+XwcResetIC(ic)
XIC ic;
{
if (ic->core.im)
@@ -444,6 +390,19 @@ wchar_t *XwcResetIC(ic)
return (wchar_t *)NULL;
}
+char *
+Xutf8ResetIC(ic)
+ XIC ic;
+{
+ if (ic->core.im) {
+ if (ic->methods->utf8_reset)
+ return (*ic->methods->utf8_reset)(ic);
+ else if (ic->methods->mb_reset)
+ return (*ic->methods->mb_reset)(ic);
+ }
+ return (char *)NULL;
+}
+
int
XmbLookupString(ic, ev, buffer, nbytes, keysym, status)
XIC ic;
@@ -473,3 +432,23 @@ XwcLookupString(ic, ev, buffer, nchars, keysym, status)
keysym, status);
return XLookupNone;
}
+
+int
+Xutf8LookupString(ic, ev, buffer, nbytes, keysym, status)
+ XIC ic;
+ register XKeyEvent *ev;
+ char *buffer;
+ int nbytes;
+ KeySym *keysym;
+ Status *status;
+{
+ if (ic->core.im) {
+ if (ic->methods->utf8_lookup_string)
+ return (*ic->methods->utf8_lookup_string) (ic, ev, buffer, nbytes,
+ keysym, status);
+ else if (ic->methods->mb_lookup_string)
+ return (*ic->methods->mb_lookup_string) (ic, ev, buffer, nbytes,
+ keysym, status);
+ }
+ return XLookupNone;
+}
diff --git a/src/xlibi18n/IMWrap.c b/src/xlibi18n/IMWrap.c
index fc8e6426..8cfef782 100644
--- a/src/xlibi18n/IMWrap.c
+++ b/src/xlibi18n/IMWrap.c
@@ -1,5 +1,5 @@
/*
- * $Xorg: IMWrap.c,v 1.4 2001/02/09 02:03:33 xorgcvs Exp $
+ * $Xorg: IMWrap.c,v 1.3 2000/08/17 19:44:37 cpqbld Exp $
*/
/*
@@ -57,6 +57,8 @@ from The Open Group.
*/
+/* $XFree86: xc/lib/X11/IMWrap.c,v 3.8 2001/12/14 19:54:01 dawes Exp $ */
+
#include "Xlibint.h"
#include "Xlcint.h"
@@ -96,7 +98,7 @@ _XCopyToArg(src, dst, size)
memcpy((char *)&u, (char *)src, (int)size);
if (size == sizeof(long)) *dst = (XPointer)u.longval;
#ifdef LONG64
- else if (size == sizeof(int)) *dst = (XPointer)u.intval;
+ else if (size == sizeof(int)) *dst = (XPointer)(long)u.intval;
#endif
else if (size == sizeof(short)) *dst = (XPointer)(long)u.shortval;
else if (size == sizeof(char)) *dst = (XPointer)(long)u.charval;
@@ -174,14 +176,13 @@ XLocaleOfIM(im)
* on-demand input method instantiation.
*/
Bool
-XRegisterIMInstantiateCallback( display, rdb, res_name, res_class, callback,
- client_data)
- Display *display;
- XrmDatabase rdb;
- char *res_name;
- char *res_class;
- XIMProc callback;
- XPointer *client_data;
+XRegisterIMInstantiateCallback(
+ Display *display,
+ XrmDatabase rdb,
+ char *res_name,
+ char *res_class,
+ XIDProc callback,
+ XPointer client_data)
{
XLCd lcd = _XOpenLC( (char *)NULL );
@@ -196,14 +197,13 @@ XRegisterIMInstantiateCallback( display, rdb, res_name, res_class, callback,
* Unregister to a input method instantiation callback.
*/
Bool
-XUnregisterIMInstantiateCallback( display, rdb, res_name, res_class, callback,
- client_data )
- Display *display;
- XrmDatabase rdb;
- char *res_name;
- char *res_class;
- XIMProc callback;
- XPointer *client_data;
+XUnregisterIMInstantiateCallback(
+ Display *display,
+ XrmDatabase rdb,
+ char *res_name,
+ char *res_class,
+ XIDProc callback,
+ XPointer client_data)
{
XLCd lcd = _XlcCurrentLC();
diff --git a/src/xlibi18n/XDefaultIMIF.c b/src/xlibi18n/XDefaultIMIF.c
index e31c207b..6ab3ac6b 100644
--- a/src/xlibi18n/XDefaultIMIF.c
+++ b/src/xlibi18n/XDefaultIMIF.c
@@ -41,6 +41,7 @@ interest in or to any trademark, service mark, logo or trade name of
Sun Microsystems, Inc. or its licensors is granted.
*/
+/* $XFree86: xc/lib/X11/XDefaultIMIF.c,v 1.3 2003/04/13 19:22:18 dawes Exp $ */
#include <stdio.h>
#define NEED_EVENTS
@@ -73,27 +74,19 @@ typedef struct _StaticXIM {
} StaticXIMRec;
static Status _CloseIM(
-#if NeedFunctionPrototypes
XIM
-#endif
);
static char *_SetIMValues(
-#if NeedFunctionPrototypes
XIM, XIMArg *
-#endif
);
static char *_GetIMValues(
-#if NeedFunctionPrototypes
XIM, XIMArg*
-#endif
);
static XIC _CreateIC(
-#if NeedFunctionPrototypes
XIM, XIMArg*
-#endif
);
static _Xconst XIMMethodsRec local_im_methods = {
@@ -106,49 +99,31 @@ static _Xconst XIMMethodsRec local_im_methods = {
};
static void _DestroyIC(
-#if NeedFunctionPrototypes
XIC
-#endif
);
static void _SetFocus(
-#if NeedFunctionPrototypes
XIC
-#endif
);
static void _UnsetFocus(
-#if NeedFunctionPrototypes
XIC
-#endif
);
static char* _SetICValues(
-#if NeedFunctionPrototypes
XIC, XIMArg *
-#endif
);
static char* _GetICValues(
-#if NeedFunctionPrototypes
XIC, XIMArg *
-#endif
);
static char *_MbReset(
-#if NeedFunctionPrototypes
XIC
-#endif
);
static wchar_t *_WcReset(
-#if NeedFunctionPrototypes
XIC
-#endif
);
static int _MbLookupString(
-#if NeedFunctionPrototypes
XIC, XKeyEvent *, char *, int, KeySym *, Status *
-#endif
);
static int _WcLookupString(
-#if NeedFunctionPrototypes
XIC, XKeyEvent *, wchar_t *, int, KeySym *, Status *
-#endif
);
static _Xconst XICMethodsRec local_ic_methods = {
@@ -159,19 +134,20 @@ static _Xconst XICMethodsRec local_ic_methods = {
_GetICValues, /* get_values */
_MbReset, /* mb_reset */
_WcReset, /* wc_reset */
+ NULL, /* utf8_reset */ /* ??? */
_MbLookupString, /* mb_lookup_string */
_WcLookupString, /* wc_lookup_string */
+ NULL /* utf8_lookup_string */ /* ??? */
};
XIM
-_XDefaultOpenIM(lcd, dpy, rdb, res_name, res_class)
-XLCd lcd;
-Display *dpy;
-XrmDatabase rdb;
-char *res_name, *res_class;
+_XDefaultOpenIM(
+ XLCd lcd,
+ Display *dpy,
+ XrmDatabase rdb,
+ char *res_name,
+ char *res_class)
{
- FILE *fp;
- char *name;
StaticXIM im;
XIMStaticXIMRec *local_impart;
XlcConv ctom_conv, ctow_conv;
@@ -240,9 +216,6 @@ char *res_name, *res_class;
}
return (XIM)im;
-Error1 :
- if(im->core.im_name)
- Xfree(im->core.im_name);
Error2 :
Xfree(im->private);
Xfree(im->core.im_name);
@@ -253,8 +226,7 @@ Error2 :
}
static Status
-_CloseIM(xim)
-XIM xim;
+_CloseIM(XIM xim)
{
StaticXIM im = (StaticXIM)xim;
_XlcCloseConverter(im->private->ctom_conv);
@@ -280,10 +252,7 @@ XIM xim;
XIMArg *values;
{
XIMArg *p;
- XIMStyles **value;
XIMStyles *styles;
- int i;
- XIMStyles *p_style;
for (p = values; p->name != NULL; p++) {
if (strcmp(p->name, XNQueryInputStyle) == 0) {
@@ -301,13 +270,9 @@ XIMArg *values;
}
static char*
-_SetICValueData(ic, values, mode)
-XIC ic;
-XIMArg *values;
-XICOp_t mode;
+_SetICValueData(XIC ic, XIMArg *values, XICOp_t mode)
{
XIMArg *p;
- int i;
char *return_name = NULL;
for (p = values; p != NULL && p->name != NULL; p++) {
@@ -331,10 +296,7 @@ XICOp_t mode;
}
static char*
-_GetICValueData(ic, values, mode)
-XIC ic;
-XIMArg *values;
-XICOp_t mode;
+_GetICValueData(XIC ic, XIMArg *values, XICOp_t mode)
{
XIMArg *p;
char *return_name = NULL;
@@ -361,9 +323,7 @@ XICOp_t mode;
}
static XIC
-_CreateIC(im, arg)
-XIM im;
-XIMArg *arg;
+_CreateIC(XIM im, XIMArg *arg)
{
XIC ic;
@@ -387,9 +347,8 @@ err_return:
return ((XIC)NULL);
}
-static void
-_DestroyIC(ic)
-XIC ic;
+static void
+_DestroyIC(XIC ic)
{
/*BugId4255571. This Xfree() should be removed because XDestroyIC() still need ic after invoking _DestroyIC() and there is a XFree(ic) at the end of XDestroyIC() already.
if(ic)
@@ -403,15 +362,12 @@ XIC ic;
}
static void
-_UnsetFocus(ic)
-XIC ic;
+_UnsetFocus(XIC ic)
{
}
static char*
-_SetICValues(ic, args)
-XIC ic;
-XIMArg *args;
+_SetICValues(XIC ic, XIMArg *args)
{
char *ret = NULL;
if (!ic) {
@@ -422,9 +378,7 @@ XIMArg *args;
}
static char*
-_GetICValues(ic, args)
-XIC ic;
-XIMArg *args;
+_GetICValues(XIC ic, XIMArg *args)
{
char *ret = NULL;
if (!ic) {
@@ -435,27 +389,25 @@ XIMArg *args;
}
static char *
-_MbReset(xic)
-XIC xic;
+_MbReset(XIC xic)
{
return(NULL);
}
static wchar_t *
-_WcReset(xic)
-XIC xic;
+_WcReset(XIC xic)
{
return(NULL);
}
static int
-_MbLookupString(xic, ev, buffer, bytes, keysym, status)
-XIC xic;
-XKeyEvent *ev;
-char * buffer;
-int bytes;
-KeySym *keysym;
-Status *status;
+_MbLookupString(
+ XIC xic,
+ XKeyEvent *ev,
+ char * buffer,
+ int bytes,
+ KeySym *keysym,
+ Status *status)
{
XComposeStatus NotSupportedYet ;
int length;
@@ -473,13 +425,13 @@ Status *status;
}
static int
-_WcLookupString(xic, ev, buffer, wlen, keysym, status)
-XIC xic;
-XKeyEvent *ev;
-wchar_t * buffer;
-int wlen;
-KeySym *keysym;
-Status *status;
+_WcLookupString(
+ XIC xic,
+ XKeyEvent *ev,
+ wchar_t * buffer,
+ int wlen,
+ KeySym *keysym,
+ Status *status)
{
XComposeStatus NotSupportedYet ;
int length;
diff --git a/src/xlibi18n/XDefaultOMIF.c b/src/xlibi18n/XDefaultOMIF.c
index 1bb09dac..9182d6de 100644
--- a/src/xlibi18n/XDefaultOMIF.c
+++ b/src/xlibi18n/XDefaultOMIF.c
@@ -41,6 +41,8 @@ interest in or to any trademark, service mark, logo or trade name of
Sun Microsystems, Inc. or its licensors is granted.
*/
+/* $XFree86: xc/lib/X11/XDefaultOMIF.c,v 1.5 2003/04/17 02:39:56 dawes Exp $ */
+
#include "Xlibint.h"
#include "Xlcint.h"
#include "XlcPublic.h"
@@ -97,8 +99,8 @@ typedef struct _XOCGenericRec {
} XOCGenericRec, *XOCGeneric;
static Bool
-init_fontset(oc)
- XOC oc;
+init_fontset(
+ XOC oc)
{
XOCGenericPart *gen;
FontSet font_set;
@@ -121,9 +123,9 @@ init_fontset(oc)
}
static char *
-get_prop_name(dpy, fs)
- Display *dpy;
- XFontStruct *fs;
+get_prop_name(
+ Display *dpy,
+ XFontStruct *fs)
{
unsigned long fp;
@@ -134,9 +136,9 @@ get_prop_name(dpy, fs)
}
static FontData
-check_charset(font_set, font_name)
- FontSet font_set;
- char *font_name;
+check_charset(
+ FontSet font_set,
+ char *font_name)
{
FontData font_data;
char *last;
@@ -161,10 +163,11 @@ check_charset(font_set, font_name)
return (FontData) NULL;
}
+#if 0 /* Unused */
static int
-check_fontname(oc, name)
-XOC oc;
-char *name;
+check_fontname(
+ XOC oc,
+ char *name)
{
Display *dpy = oc->core.om->core.display;
XOCGenericPart *gen = XOC_GENERIC(oc);
@@ -214,10 +217,11 @@ char *name;
XFreeFontNames(fn_list);
return found_num;
}
+#endif
static Bool
-load_font(oc)
- XOC oc;
+load_font(
+ XOC oc)
{
Display *dpy = oc->core.om->core.display;
XOCGenericPart *gen = XOC_GENERIC(oc);
@@ -234,9 +238,10 @@ load_font(oc)
return True;
}
+#if 0
static Bool
-load_font_info(oc)
- XOC oc;
+load_font_info(
+ XOC oc)
{
Display *dpy = oc->core.om->core.display;
XOCGenericPart *gen = XOC_GENERIC(oc);
@@ -259,10 +264,11 @@ load_font_info(oc)
}
return True;
}
+#endif
static void
-set_fontset_extents(oc)
- XOC oc;
+set_fontset_extents(
+ XOC oc)
{
XRectangle *ink = &oc->core.font_set_extents.max_ink_extent;
XRectangle *logical = &oc->core.font_set_extents.max_logical_extent;
@@ -289,8 +295,8 @@ set_fontset_extents(oc)
}
static Bool
-init_core_part(oc)
- XOC oc;
+init_core_part(
+ XOC oc)
{
XOCGenericPart *gen = XOC_GENERIC(oc);
FontSet font_set;
@@ -351,9 +357,9 @@ err:
}
static char *
-get_font_name(oc, pattern)
- XOC oc;
- char *pattern;
+get_font_name(
+ XOC oc,
+ char *pattern)
{
char **list, *name, *prop_name;
int count;
@@ -384,8 +390,8 @@ get_font_name(oc, pattern)
}
static int
-parse_fontname(oc)
- XOC oc;
+parse_fontname(
+ XOC oc)
{
XOCGenericPart *gen = XOC_GENERIC(oc);
FontSet font_set;
@@ -395,7 +401,7 @@ parse_fontname(oc)
ssize_t length;
int count, num_fields;
char *base_name, *font_name, **name_list, **cur_name_list;
- char *charset_p;
+ char *charset_p = NULL;
Bool append_charset;
/*
append_charset flag should be set to True when the XLFD fontname
@@ -546,8 +552,8 @@ err:
}
static Bool
-set_missing_list(oc)
- XOC oc;
+set_missing_list(
+ XOC oc)
{
XOCGenericPart *gen = XOC_GENERIC(oc);
FontSet font_set;
@@ -588,10 +594,9 @@ set_missing_list(oc)
}
static Bool
-create_fontset(oc)
- XOC oc;
+create_fontset(
+ XOC oc)
{
- XOMGenericPart *gen = XOM_GENERIC(oc->core.om);
int found_num;
if (init_fontset(oc) == False)
@@ -617,8 +622,8 @@ create_fontset(oc)
}
static void
-destroy_oc(oc)
- XOC oc;
+destroy_oc(
+ XOC oc)
{
Display *dpy = oc->core.om->core.display;
XOCGenericPart *gen = XOC_GENERIC(oc);
@@ -633,8 +638,8 @@ destroy_oc(oc)
if (oc->core.font_info.font_name_list)
XFreeStringList(oc->core.font_info.font_name_list);
- if (font_list = oc->core.font_info.font_struct_list) {
- if (font = *font_list) {
+ if ((font_list = oc->core.font_info.font_struct_list)) {
+ if ((font = *font_list)) {
if (font->fid)
XFreeFont(dpy, font);
else
@@ -657,10 +662,10 @@ destroy_oc(oc)
}
static char *
-set_oc_values(oc, args, num_args)
- XOC oc;
- XlcArgList args;
- int num_args;
+set_oc_values(
+ XOC oc,
+ XlcArgList args,
+ int num_args)
{
if (oc->core.resources == NULL)
return NULL;
@@ -670,10 +675,10 @@ set_oc_values(oc, args, num_args)
}
static char *
-get_oc_values(oc, args, num_args)
- XOC oc;
- XlcArgList args;
- int num_args;
+get_oc_values(
+ XOC oc,
+ XlcArgList args,
+ int num_args)
{
if (oc->core.resources == NULL)
return NULL;
@@ -683,11 +688,11 @@ get_oc_values(oc, args, num_args)
}
static Bool
-wcs_to_mbs(oc, to, from, length)
- XOC oc;
- char *to;
- wchar_t *from;
- int length;
+wcs_to_mbs(
+ XOC oc,
+ char *to,
+ _Xconst wchar_t *from,
+ int length)
{
XlcConv conv = XOC_GENERIC(oc)->wcs_to_cs;
XLCd lcd;
@@ -711,31 +716,17 @@ wcs_to_mbs(oc, to, from, length)
}
static int
-#if NeedFunctionPrototypes
_XmbDefaultTextEscapement(XOC oc, _Xconst char *text, int length)
-#else
-_XmbDefaultTextEscapement(oc, text, length)
- XOC oc;
- char *text;
- int length;
-#endif
{
return XTextWidth(*oc->core.font_info.font_struct_list, text, length);
}
static int
-#if NeedFunctionPrototypes
_XwcDefaultTextEscapement(XOC oc, _Xconst wchar_t *text, int length)
-#else
-_XwcDefaultTextEscapement(oc, text, length)
- XOC oc;
- wchar_t *text;
- int length;
-#endif
{
DefineLocalBuf;
char *buf = AllocLocalBuf(length);
- int ret;
+ int ret = 0;
if (buf == NULL)
return 0;
@@ -752,17 +743,8 @@ err:
}
static int
-#if NeedFunctionPrototypes
_XmbDefaultTextExtents(XOC oc, _Xconst char *text, int length,
XRectangle *overall_ink, XRectangle *overall_logical)
-#else
-_XmbDefaultTextExtents(oc, text, length, overall_ink, overall_logical)
- XOC oc;
- char *text;
- int length;
- XRectangle *overall_ink;
- XRectangle *overall_logical;
-#endif
{
int direction, logical_ascent, logical_descent;
XCharStruct overall;
@@ -788,21 +770,12 @@ _XmbDefaultTextExtents(oc, text, length, overall_ink, overall_logical)
}
static int
-#if NeedFunctionPrototypes
_XwcDefaultTextExtents(XOC oc, _Xconst wchar_t *text, int length,
XRectangle *overall_ink, XRectangle *overall_logical)
-#else
-_XwcDefaultTextExtents(oc, text, length, overall_ink, overall_logical)
- XOC oc;
- wchar_t *text;
- int length;
- XRectangle *overall_ink;
- XRectangle *overall_logical;
-#endif
{
DefineLocalBuf;
char *buf = AllocLocalBuf(length);
- int ret;
+ int ret = 0;
if (buf == NULL)
return 0;
@@ -819,25 +792,11 @@ err:
}
static Status
-#if NeedFunctionPrototypes
_XmbDefaultTextPerCharExtents(XOC oc, _Xconst char *text, int length,
XRectangle *ink_buf, XRectangle *logical_buf,
int buf_size, int *num_chars,
XRectangle *overall_ink,
XRectangle *overall_logical)
-#else
-_XmbDefaultTextPerCharExtents(oc, text, length, ink_buf, logical_buf, buf_size,
- num_chars, overall_ink, overall_logical)
- XOC oc;
- char *text;
- int length;
- XRectangle *ink_buf;
- XRectangle *logical_buf;
- int buf_size;
- int *num_chars;
- XRectangle *overall_ink;
- XRectangle *overall_logical;
-#endif
{
XFontStruct *font = *oc->core.font_info.font_struct_list;
XCharStruct *def, *cs, overall;
@@ -902,29 +861,15 @@ _XmbDefaultTextPerCharExtents(oc, text, length, ink_buf, logical_buf, buf_size,
}
static Status
-#if NeedFunctionPrototypes
_XwcDefaultTextPerCharExtents(XOC oc, _Xconst wchar_t *text, int length,
XRectangle *ink_buf, XRectangle *logical_buf,
int buf_size, int *num_chars,
XRectangle *overall_ink,
XRectangle *overall_logical)
-#else
-_XwcDefaultTextPerCharExtents(oc, text, length, ink_buf, logical_buf, buf_size,
- num_chars, overall_ink, overall_logical)
- XOC oc;
- wchar_t *text;
- int length;
- XRectangle *ink_buf;
- XRectangle *logical_buf;
- int buf_size;
- int *num_chars;
- XRectangle *overall_ink;
- XRectangle *overall_logical;
-#endif
{
DefineLocalBuf;
char *buf = AllocLocalBuf(length);
- Status ret;
+ Status ret = 0;
if (buf == NULL)
return 0;
@@ -943,19 +888,8 @@ err:
}
static int
-#if NeedFunctionPrototypes
_XmbDefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y,
_Xconst char *text, int length)
-#else
-_XmbDefaultDrawString(dpy, d, oc, gc, x, y, text, length)
- Display *dpy;
- Drawable d;
- XOC oc;
- GC gc;
- int x, y;
- char *text;
- int length;
-#endif
{
XFontStruct *font = *oc->core.font_info.font_struct_list;
@@ -966,23 +900,12 @@ _XmbDefaultDrawString(dpy, d, oc, gc, x, y, text, length)
}
static int
-#if NeedFunctionPrototypes
_XwcDefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y,
_Xconst wchar_t *text, int length)
-#else
-_XwcDefaultDrawString(dpy, d, oc, gc, x, y, text, length)
- Display *dpy;
- Drawable d;
- XOC oc;
- GC gc;
- int x, y;
- wchar_t *text;
- int length;
-#endif
{
DefineLocalBuf;
char *buf = AllocLocalBuf(length);
- int ret;
+ int ret = 0;
if (buf == NULL)
return 0;
@@ -999,38 +922,16 @@ err:
}
static void
-#if NeedFunctionPrototypes
_XmbDefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x,
int y, _Xconst char *text, int length)
-#else
-_XmbDefaultDrawImageString(dpy, d, oc, gc, x, y, text, length)
- Display *dpy;
- Drawable d;
- XOC oc;
- GC gc;
- int x, y;
- char *text;
- int length;
-#endif
{
XSetFont(dpy, gc, (*oc->core.font_info.font_struct_list)->fid);
XDrawImageString(dpy, d, gc, x, y, text, length);
}
static void
-#if NeedFunctionPrototypes
_XwcDefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x,
int y, _Xconst wchar_t *text, int length)
-#else
-_XwcDefaultDrawImageString(dpy, d, oc, gc, x, y, text, length)
- Display *dpy;
- Drawable d;
- XOC oc;
- GC gc;
- int x, y;
- wchar_t *text;
- int length;
-#endif
{
DefineLocalBuf;
char *buf = AllocLocalBuf(length);
@@ -1083,13 +984,12 @@ static XlcResource oc_resources[] = {
};
static XOC
-create_oc(om, args, num_args)
- XOM om;
- XlcArgList args;
- int num_args;
+create_oc(
+ XOM om,
+ XlcArgList args,
+ int num_args)
{
XOC oc;
- XOMGenericPart *gen = XOM_GENERIC(om);
oc = (XOC) Xmalloc(sizeof(XOCGenericRec));
if (oc == NULL)
@@ -1125,15 +1025,15 @@ err:
}
static Status
-close_om(om)
- XOM om;
+close_om(
+ XOM om)
{
XOMGenericPart *gen = XOM_GENERIC(om);
OMData data;
FontData font_data;
int count;
- if (data = gen->data) {
+ if ((data = gen->data)) {
if (data->font_data) {
for (font_data = data->font_data, count = data->font_data_count;
count-- > 0 ; font_data++) {
@@ -1162,10 +1062,10 @@ close_om(om)
}
static char *
-set_om_values(om, args, num_args)
- XOM om;
- XlcArgList args;
- int num_args;
+set_om_values(
+ XOM om,
+ XlcArgList args,
+ int num_args)
{
if (om->core.resources == NULL)
return NULL;
@@ -1175,10 +1075,10 @@ set_om_values(om, args, num_args)
}
static char *
-get_om_values(om, args, num_args)
- XOM om;
- XlcArgList args;
- int num_args;
+get_om_values(
+ XOM om,
+ XlcArgList args,
+ int num_args)
{
if (om->core.resources == NULL)
return NULL;
@@ -1206,8 +1106,8 @@ static XlcResource om_resources[] = {
};
static OMData
-add_data(om)
- XOM om;
+add_data(
+ XOM om)
{
XOMGenericPart *gen = XOM_GENERIC(om);
OMData new;
@@ -1236,10 +1136,9 @@ static _Xconst char *supported_charset_list[] = {
};
static Bool
-init_om(om)
- XOM om;
+init_om(
+ XOM om)
{
- XLCd lcd = om->core.lcd;
XOMGenericPart *gen = XOM_GENERIC(om);
OMData data;
FontData font_data;
@@ -1319,17 +1218,8 @@ supported_charset_list[].
}
XOM
-#if NeedFunctionPrototypes
_XDefaultOpenOM(XLCd lcd, Display *dpy, XrmDatabase rdb,
_Xconst char *res_name, _Xconst char *res_class)
-#else
-_XDefaultOpenOM(lcd, dpy, rdb, res_name, res_class)
-XLCd lcd;
-Display *dpy;
-XrmDatabase rdb;
-char *res_name;
-char *res_class;
-#endif
{
XOM om;
diff --git a/src/xlibi18n/XimImSw.h b/src/xlibi18n/XimImSw.h
index eac27843..8ad5d287 100644
--- a/src/xlibi18n/XimImSw.h
+++ b/src/xlibi18n/XimImSw.h
@@ -26,25 +26,20 @@ PERFORMANCE OF THIS SOFTWARE.
fujiwara@a80.tech.yk.fujitsu.co.jp
******************************************************************/
+/* $XFree86$ */
#ifndef _XIMIMSW_H
#define _XIMIMSW_H
typedef struct {
Bool (*checkprocessing)(
-#if NeedNestedPrototypes
Xim im
-#endif
);
Bool (*im_open)(
-#if NeedNestedPrototypes
Xim im
-#endif
);
void (*im_free)(
-#if NeedNestedPrototypes
Xim im
-#endif
);
} XimImsportSW;
diff --git a/src/xlibi18n/XimThai.h b/src/xlibi18n/XimThai.h
index b883a6ef..5b2666eb 100644
--- a/src/xlibi18n/XimThai.h
+++ b/src/xlibi18n/XimThai.h
@@ -45,6 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
+/* $XFree86: xc/lib/X11/XimThai.h,v 1.5 2001/12/14 19:54:08 dawes Exp $ */
/*
**++
@@ -65,7 +66,7 @@ SOFTWARE.
#include <X11/Xlib.h>
-/* Classification of characters in TACTIS according to WTT */
+/* Classification of characters in TIS620 according to WTT */
#define CTRL 0 /* control chars */
#define NON 1 /* non composibles */
@@ -108,94 +109,4 @@ SOFTWARE.
#define NOISC 255 /* No ISC */
-/* Function prototypes (thaisub.c) */
-
-Private
-int THAI_chtype ( /* returns classification of a char */
-#if NeedFunctionPrototypes
- unsigned char ch
-#endif
-);
-
-Private
-int THAI_chlevel ( /* returns the display level */
-#if NeedFunctionPrototypes
- unsigned char ch
-#endif
-);
-
-Private
-Bool THAI_isdead ( /* return True if char is non-spacing */
-#if NeedFunctionPrototypes
- unsigned char ch
-#endif
-);
-
-Private
-Bool THAI_iscons ( /* return True if char is consonant */
-#if NeedFunctionPrototypes
- unsigned char ch
-#endif
-);
-
-Private
-Bool THAI_isvowel ( /* return True if char is vowel */
-#if NeedFunctionPrototypes
- unsigned char ch
-#endif
-);
-
-Private
-Bool THAI_istone ( /* return True if char is tonemark */
-#if NeedFunctionPrototypes
- unsigned char ch
-#endif
-);
-
-Private
-Bool THAI_iscomposible (
-#if NeedFunctionPrototypes
- unsigned char follow_ch,
- unsigned char lead_ch
-#endif
-);
-
-Private
-Bool THAI_isaccepted (
-#if NeedFunctionPrototypes
- unsigned char follow_ch,
- unsigned char lead_ch,
- unsigned char isc_mode
-#endif
-);
-
-Private
-void THAI_apply_write_rules (
-#if NeedFunctionPrototypes
- unsigned char *instr,
- unsigned char *outstr,
- unsigned char insert_ch,
- int *num_insert_ch
-#endif
-);
-
-Private
-int THAI_find_chtype (
-#if NeedFunctionPrototypes
- unsigned char *instr,
- int chtype
-#endif
-);
-
-Private
-int THAI_apply_scm (
-#if NeedFunctionPrototypes
- unsigned char *instr,
- unsigned char *outstr,
- unsigned char spec_ch,
- int num_sp,
- unsigned char insert_ch
-#endif
-);
-
#endif /* _XIMTHAI_H_ */
diff --git a/src/xlibi18n/XimTrInt.h b/src/xlibi18n/XimTrInt.h
index b10898b3..cc1cabfa 100644
--- a/src/xlibi18n/XimTrInt.h
+++ b/src/xlibi18n/XimTrInt.h
@@ -28,21 +28,18 @@ OR PERFORMANCE OF THIS SOFTWARE.
fujiwara@a80.tech.yk.fujitsu.co.jp
******************************************************************/
+/* $XFree86$ */
#ifndef _XIMTRINT_H
#define _XIMTRINT_H
-#if NeedFunctionPrototypes
#include "Ximint.h"
-#endif
typedef struct {
char *transportname;
Bool (*config)(
-#if NeedFunctionPrototypes
Xim,
char *
-#endif
);
} TransportSW;
@@ -53,19 +50,15 @@ extern TransportSW _XimTransportRec[];
*/
extern Bool _XimXConf(
-#if NeedFunctionPrototypes
Xim im,
char *address
-#endif
);
#if defined(TCPCONN) || defined(UNIXCONN) || defined(DNETCONN) || defined(STREAMSCONN)
extern Bool _XimTransConf(
-#if NeedFunctionPrototypes
Xim im,
char *address
-#endif
);
#endif
diff --git a/src/xlibi18n/XimTrX.h b/src/xlibi18n/XimTrX.h
index 489a0e3c..a4378439 100644
--- a/src/xlibi18n/XimTrX.h
+++ b/src/xlibi18n/XimTrX.h
@@ -28,6 +28,7 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
fujiwara@a80.tech.yk.fujitsu.co.jp
******************************************************************/
+/* $XFree86$ */
#ifndef _XIMTRX_H
#define _XIMTRX_H
@@ -36,9 +37,7 @@ typedef struct _XIntrCallbackRec *XIntrCallbackPtr;
typedef struct _XIntrCallbackRec {
Bool (*func)(
-#if NeedNestedPrototypes
Xim, INT16, XPointer, XPointer
-#endif
);
XPointer call_data;
XIntrCallbackPtr next;
diff --git a/src/xlibi18n/XimTrans.h b/src/xlibi18n/XimTrans.h
index 6914190e..f75270b2 100644
--- a/src/xlibi18n/XimTrans.h
+++ b/src/xlibi18n/XimTrans.h
@@ -28,6 +28,7 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
fujiwara@a80.tech.yk.fujitsu.co.jp
******************************************************************/
+/* $XFree86: xc/lib/X11/XimTrans.h,v 1.3 2003/10/24 15:34:00 tsi Exp $ */
#ifndef _XIMTRANS_H
#define _XIMTRANS_H
@@ -36,9 +37,7 @@ typedef struct _TransIntrCallbackRec *TransIntrCallbackPtr;
typedef struct _TransIntrCallbackRec {
Bool (*func)(
-#if NeedNestedPrototypes
Xim, INT16, XPointer, XPointer
-#endif
);
XPointer call_data;
TransIntrCallbackPtr next;
@@ -58,70 +57,67 @@ typedef struct {
* Prototypes
*/
+extern Bool _XimTransRegisterDispatcher(
+ Xim im,
+ Bool (*callback)(
+ Xim, INT16, XPointer, XPointer
+ ),
+ XPointer call_data
+);
+
+
extern Bool _XimTransIntrCallback(
-#if NeedFunctionPrototypes
Xim im,
Bool (*callback)(
-#if NeedNestedPrototypes
Xim, INT16, XPointer, XPointer
-#endif
),
XPointer call_data
-#endif
+);
+
+extern Bool _XimTransCallDispatcher(
+ Xim im,
+ INT16 len,
+ XPointer data
);
extern void _XimFreeTransIntrCallback(
-#if NeedFunctionPrototypes
Xim im
-#endif
);
extern Bool _XimTransIntrCallbackCheck(
-#if NeedFunctionPrototypes
Xim im,
INT16 len,
XPointer data
-#endif
);
extern Bool _XimTransFilterWaitEvent(
-#if NeedFunctionPrototypes
Display *d,
Window w,
XEvent *ev,
XPointer arg
-#endif
);
extern void _XimTransInternalConnection(
-#if NeedFunctionPrototypes
Display *d,
int fd,
XPointer arg
-#endif
);
extern Bool _XimTransWrite(
-#if NeedFunctionPrototypes
Xim im,
INT16 len,
XPointer data
-#endif
);
extern Bool _XimTransRead(
-#if NeedFunctionPrototypes
Xim im,
XPointer recv_buf,
int buf_len,
int *ret_len
-#endif
);
extern void _XimTransFlush(
-#if NeedFunctionPrototypes
Xim im
-#endif
);
#endif /* _XIMTRANS__H */
diff --git a/src/xlibi18n/Ximint.h b/src/xlibi18n/Ximint.h
index 17ca94a0..e9bdda24 100644
--- a/src/xlibi18n/Ximint.h
+++ b/src/xlibi18n/Ximint.h
@@ -30,6 +30,7 @@ PERFORMANCE OF THIS SOFTWARE.
makoto@sm.sony.co.jp
******************************************************************/
+/* $XFree86: xc/lib/X11/Ximint.h,v 3.13 2003/09/06 14:06:32 pascal Exp $ */
#ifndef _XIMINT_H
#define _XIMINT_H
@@ -52,7 +53,21 @@ typedef struct _Xic *Xic;
/*
* XIM dependent data
*/
+
+typedef struct _XimCommonPrivateRec {
+ /* This struct is also inlined in XimLocalPrivateRec, XimProtoPrivateRec. */
+ XlcConv ctom_conv;
+ XlcConv ctow_conv;
+ XlcConv ctoutf8_conv;
+ XlcConv cstomb_conv;
+ XlcConv cstowc_conv;
+ XlcConv cstoutf8_conv;
+ XlcConv ucstoc_conv;
+ XlcConv ucstoutf8_conv;
+} XimCommonPrivateRec;
+
typedef union _XIMPrivateRec {
+ XimCommonPrivateRec common;
XimLocalPrivateRec local;
XimProtoPrivateRec proto;
} XIMPrivateRec;
@@ -98,12 +113,12 @@ typedef struct _XimDefICValues {
Window client_window;
Window focus_window;
unsigned long filter_events;
- XIMCallback geometry_callback;
+ XICCallback geometry_callback;
char *res_name;
char *res_class;
- XIMCallback destroy_callback;
- XIMCallback preedit_state_notify_callback;
- XIMCallback string_conversion_callback;
+ XICCallback destroy_callback;
+ XICCallback preedit_state_notify_callback;
+ XICCallback string_conversion_callback;
XIMStringConversionText string_conversion;
XIMResetState reset_state;
XIMHotKeyTriggers *hotkey;
@@ -169,254 +184,202 @@ typedef struct _XimDefICValues {
* Global symbols
*/
+XPointer _XimGetLocaleCode (
+ const char *encoding_name
+);
+
+int _XimGetCharCode (
+ XPointer conv,
+ KeySym keysym,
+ unsigned char *buf,
+ int nbytes
+);
+
+unsigned int KeySymToUcs4 (
+ KeySym keysym
+);
+
extern Bool _XimSetIMResourceList(
-#if NeedFunctionPrototypes
XIMResourceList *res_list,
unsigned int *list_num
-#endif
);
extern Bool _XimSetICResourceList(
-#if NeedFunctionPrototypes
XIMResourceList *res_list,
unsigned int *list_num
-#endif
);
extern Bool _XimSetInnerIMResourceList(
-#if NeedFunctionPrototypes
XIMResourceList *res_list,
unsigned int *list_num
-#endif
);
extern Bool _XimSetInnerICResourceList(
-#if NeedFunctionPrototypes
XIMResourceList *res_list,
unsigned int *list_num
-#endif
);
-extern Bool cw_XimCheckCreateICValues(
-#if NeedFunctionPrototypes
+extern Bool _XimCheckCreateICValues(
XIMResourceList res_list,
unsigned int list_num
-#endif
);
extern XIMResourceList _XimGetResourceListRec(
-#if NeedFunctionPrototypes
XIMResourceList res_list,
unsigned int list_num,
char *name
-#endif
);
extern void _XimSetIMMode(
-#if NeedFunctionPrototypes
XIMResourceList res_list,
unsigned int list_num
-#endif
);
extern void _XimSetICMode(
-#if NeedFunctionPrototypes
XIMResourceList res_list,
unsigned int list_num,
XIMStyle style
-#endif
);
extern int _XimCheckIMMode(
-#if NeedFunctionPrototypes
XIMResourceList res_list,
unsigned long mode
-#endif
);
extern int _XimCheckICMode(
-#if NeedFunctionPrototypes
XIMResourceList res_list,
unsigned long mode
-#endif
);
extern Bool _XimSetLocalIMDefaults(
-#if NeedFunctionPrototypes
Xim im,
XPointer top,
XIMResourceList res_list,
unsigned int list_num
-#endif
);
extern Bool _XimSetICDefaults(
-#if NeedFunctionPrototypes
Xic ic,
XPointer top,
unsigned long mode,
XIMResourceList res_list,
unsigned int list_num
-#endif
);
extern Bool _XimEncodeLocalIMAttr(
-#if NeedFunctionPrototypes
XIMResourceList res,
XPointer top,
XPointer val
-#endif
);
extern Bool _XimEncodeLocalICAttr(
-#if NeedFunctionPrototypes
Xic ic,
XIMResourceList res,
XPointer top,
XIMArg *arg,
unsigned long mode
-#endif
);
extern Bool _XimCheckLocalInputStyle(
-#if NeedFunctionPrototypes
Xic ic,
XPointer top,
XIMArg *values,
XIMStyles *styles,
XIMResourceList res_list,
unsigned int list_num
-#endif
);
extern Bool _XimDecodeLocalIMAttr(
-#if NeedFunctionPrototypes
XIMResourceList res,
XPointer top,
XPointer val
-#endif
);
extern Bool _XimDecodeLocalICAttr(
-#if NeedFunctionPrototypes
XIMResourceList res,
XPointer top,
XPointer val,
unsigned long mode
-#endif
);
extern void _XimGetCurrentIMValues(
-#if NeedFunctionPrototypes
Xim im,
XimDefIMValues *im_values
-#endif
);
extern void _XimSetCurrentIMValues(
-#if NeedFunctionPrototypes
Xim im,
XimDefIMValues *im_values
-#endif
);
extern void _XimGetCurrentICValues(
-#if NeedFunctionPrototypes
Xic ic,
XimDefICValues *ic_values
-#endif
);
extern void _XimSetCurrentICValues(
-#if NeedFunctionPrototypes
Xic ic,
XimDefICValues *ic_values
-#endif
);
extern void _XimInitialResourceInfo(
-#if NeedFunctionPrototypes
void
-#endif
);
extern void _XimParseStringFile(
-#if NeedFunctionPrototypes
FILE *fp,
- DefTree **ptop
-#endif
+ Xim im
);
extern Bool _XimCheckIfLocalProcessing(
-#if NeedFunctionPrototypes
Xim im
-#endif
);
extern Bool _XimCheckIfThaiProcessing(
-#if NeedFunctionPrototypes
Xim im
-#endif
);
extern Bool _XimLocalOpenIM(
-#if NeedFunctionPrototypes
Xim im
-#endif
);
extern Bool _XimThaiOpenIM(
-#if NeedFunctionPrototypes
Xim im
-#endif
);
extern Bool _XimProtoOpenIM(
-#if NeedFunctionPrototypes
Xim im
-#endif
);
extern void _XimLocalIMFree(
-#if NeedFunctionPrototypes
Xim im
-#endif
);
extern void _XimThaiIMFree(
-#if NeedFunctionPrototypes
Xim im
-#endif
);
extern void _XimProtoIMFree(
-#if NeedFunctionPrototypes
Xim im
-#endif
);
extern char * _XimSetIMValueData(
-#if NeedFunctionPrototypes
Xim im,
XPointer top,
XIMArg *arg,
XIMResourceList res_list,
unsigned int list_num
-#endif
);
extern char * _XimGetIMValueData(
-#if NeedFunctionPrototypes
Xim im,
XPointer top,
XIMArg *arg,
XIMResourceList res_list,
unsigned int list_num
-#endif
);
extern char * _XimSetICValueData(
-#if NeedFunctionPrototypes
Xic ic,
XPointer top,
XIMResourceList res_list,
@@ -424,68 +387,50 @@ extern char * _XimSetICValueData(
XIMArg *arg,
unsigned long mode,
Bool flag
-#endif
);
extern char * _XimGetICValueData(
-#if NeedFunctionPrototypes
Xic ic,
XPointer top,
XIMResourceList res_list,
unsigned int list_num,
XIMArg *arg,
unsigned long mode
-#endif
);
extern char * _XimLocalSetIMValues(
-#if NeedFunctionPrototypes
XIM im,
XIMArg *arg
-#endif
);
extern char * _XimLocalGetIMValues(
-#if NeedFunctionPrototypes
XIM im,
XIMArg *arg
-#endif
);
extern XIC _XimLocalCreateIC(
-#if NeedFunctionPrototypes
XIM im,
XIMArg *arg
-#endif
);
extern Bool _XimDispatchInit(
-#if NeedFunctionPrototypes
Xim im
-#endif
);
extern Bool _XimGetAttributeID(
-#if NeedFunctionPrototypes
Xim im,
CARD16 *buf
-#endif
);
extern Bool _XimExtension(
-#if NeedFunctionPrototypes
Xim im
-#endif
);
extern void _XimDestroyIMStructureList(
-#if NeedFunctionPrototypes
Xim im
-#endif
);
extern char * _XimMakeIMAttrIDList(
-#if NeedFunctionPrototypes
Xim im,
XIMResourceList res_list,
unsigned int res_num,
@@ -493,11 +438,9 @@ extern char * _XimMakeIMAttrIDList(
CARD16 *buf,
INT16 *len,
unsigned long mode
-#endif
);
extern char * _XimMakeICAttrIDList(
-#if NeedFunctionPrototypes
Xic ic,
XIMResourceList res_list,
unsigned int res_num,
@@ -505,11 +448,9 @@ extern char * _XimMakeICAttrIDList(
CARD16 *idList,
INT16 *num,
unsigned long mode
-#endif
);
extern char * _XimDecodeIMATTRIBUTE(
-#if NeedFunctionPrototypes
Xim im,
XIMResourceList res_list,
unsigned int res_num,
@@ -517,11 +458,9 @@ extern char * _XimDecodeIMATTRIBUTE(
INT16 buf_len,
XIMArg *arg,
BITMASK32 mode
-#endif
);
extern char * _XimDecodeICATTRIBUTE(
-#if NeedFunctionPrototypes
Xic ic,
XIMResourceList res_list,
unsigned int res_num,
@@ -529,147 +468,118 @@ extern char * _XimDecodeICATTRIBUTE(
INT16 buf_len,
XIMArg *arg,
BITMASK32 mode
-#endif
);
extern Bool _XimRegProtoIntrCallback(
-#if NeedFunctionPrototypes
Xim im,
CARD16 major_code,
CARD16 minor_code,
Bool (*proc)(
-#if NeedNestedPrototypes
Xim, INT16, XPointer, XPointer
-#endif
),
XPointer call_data
-#endif
);
extern Bool _XimErrorCallback(
-#if NeedFunctionPrototypes
Xim im,
INT16 len,
XPointer data,
XPointer call_data
-#endif
+);
+
+extern Bool _XimError(
+ Xim im,
+ Xic ic,
+ CARD16 error_code,
+ INT16 detail_length,
+ CARD16 type,
+ char *detail
);
extern Bool _XimRegisterTriggerKeysCallback(
-#if NeedFunctionPrototypes
Xim im,
INT16 len,
XPointer data,
XPointer call_data
-#endif
);
extern Bool _XimSetEventMaskCallback(
-#if NeedFunctionPrototypes
Xim im,
INT16 len,
XPointer data,
XPointer call_data
-#endif
);
extern Bool _XimForwardEventCallback(
-#if NeedFunctionPrototypes
Xim im,
INT16 len,
XPointer data,
XPointer call_data
-#endif
);
extern Bool _XimCommitCallback(
-#if NeedFunctionPrototypes
Xim im,
INT16 len,
XPointer data,
XPointer call_data
-#endif
);
extern Bool _XimSyncCallback(
-#if NeedFunctionPrototypes
Xim im,
INT16 len,
XPointer data,
XPointer call_data
-#endif
);
extern void _XimFreeProtoIntrCallback(
-#if NeedFunctionPrototypes
Xim im
-#endif
);
extern XIC _XimProtoCreateIC(
-#if NeedFunctionPrototypes
XIM im,
XIMArg *arg
-#endif
);
extern void _XimRegisterServerFilter(
-#if NeedFunctionPrototypes
Xim im
-#endif
);
extern void _XimUnregisterServerFilter(
-#if NeedFunctionPrototypes
Xim im
-#endif
);
extern Bool _XimTriggerNotify(
-#if NeedFunctionPrototypes
Xim im,
Xic ic,
int mode,
CARD32 idx
-#endif
);
extern Bool _XimProcSyncReply(
-#if NeedFunctionPrototypes
Xim im,
Xic ic
-#endif
);
extern void _XimSendSetFocus(
-#if NeedFunctionPrototypes
Xim im,
Xic ic
-#endif
);
extern Bool _XimForwardEvent(
-#if NeedFunctionPrototypes
Xic ic,
XEvent *ev,
Bool sync
-#endif
);
extern void _XimFreeRemakeArg(
-#if NeedFunctionPrototypes
XIMArg *arg
-#endif
);
extern void _XimServerDestroy(
-#if NeedFunctionPrototypes
Xim im
-#endif
);
extern char * _XimEncodeIMATTRIBUTE(
-#if NeedFunctionPrototypes
Xim im,
XIMResourceList res_list,
unsigned int res_num,
@@ -680,11 +590,9 @@ extern char * _XimEncodeIMATTRIBUTE(
int *ret_len,
XPointer top,
unsigned long mode
-#endif
);
extern char * _XimEncodeICATTRIBUTE(
-#if NeedFunctionPrototypes
Xic ic,
XIMResourceList res_list,
unsigned int res_num,
@@ -696,424 +604,364 @@ extern char * _XimEncodeICATTRIBUTE(
XPointer top,
BITMASK32 *flag,
unsigned long mode
-#endif
);
#ifdef EXT_MOVE
extern Bool _XimExtenMove(
-#if NeedFunctionPrototypes
Xim im,
Xic ic,
CARD32 flag,
CARD16 *buf,
INT16 length
-#endif
);
#endif
extern int _Ximctstombs(
-#if NeedFunctionPrototypes
XIM im,
char *from,
- int from_len,
+ int from_len,
char *to,
- int to_len,
+ int to_len,
Status *state
-#endif
);
extern int _Ximctstowcs(
-#if NeedFunctionPrototypes
XIM im,
char *from,
int from_len,
wchar_t *to,
int to_len,
Status *state
-#endif
+);
+
+extern int _Ximctstoutf8(
+ XIM im,
+ char *from,
+ int from_len,
+ char *to,
+ int to_len,
+ Status *state
);
extern int _XimLcctstombs(
-#if NeedFunctionPrototypes
XIM im,
char *from,
- int from_len,
+ int from_len,
char *to,
- int to_len,
+ int to_len,
Status *state
-#endif
);
extern int _XimLcctstowcs(
-#if NeedFunctionPrototypes
XIM im,
char *from,
int from_len,
wchar_t *to,
int to_len,
Status *state
-#endif
+);
+
+extern int _XimLcctstoutf8(
+ XIM im,
+ char *from,
+ int from_len,
+ char *to,
+ int to_len,
+ Status *state
+);
+
+extern int _XimCheckDataSize(
+ XPointer buf,
+ int len
);
extern void _XimSetHeader(
-#if NeedFunctionPrototypes
XPointer buf,
CARD8 major_opcode,
CARD8 minor_opcode,
INT16 *len
-#endif
);
extern Bool _XimSync(
-#if NeedFunctionPrototypes
Xim im,
Xic ic
-#endif
);
extern int _XimProtoMbLookupString(
-#if NeedFunctionPrototypes
XIC xic,
XKeyEvent *ev,
char *buffer,
int bytes,
KeySym *keysym,
Status *state
-#endif
);
extern int _XimProtoWcLookupString(
-#if NeedFunctionPrototypes
XIC xic,
XKeyEvent *ev,
wchar_t *buffer,
int bytes,
KeySym *keysym,
Status *state
-#endif
+);
+
+extern int _XimProtoUtf8LookupString(
+ XIC xic,
+ XKeyEvent *ev,
+ char *buffer,
+ int bytes,
+ KeySym *keysym,
+ Status *state
);
extern void _XimRegisterFilter(
-#if NeedFunctionPrototypes
Xic ic
-#endif
);
extern void _XimUnregisterFilter(
-#if NeedFunctionPrototypes
Xic ic
-#endif
);
extern void _XimReregisterFilter(
-#if NeedFunctionPrototypes
Xic ic
-#endif
);
extern Status _XimProtoEventToWire(
-#if NeedFunctionPrototypes
XEvent *re,
xEvent *event,
Bool sw
-#endif
);
extern Bool _XimProtoWireToEvent(
-#if NeedFunctionPrototypes
XEvent *re,
xEvent *event,
Bool sw
-#endif
);
#ifdef EXT_FORWARD
extern Bool _XimExtForwardKeyEvent(
-#if NeedFunctionPrototypes
Xic ic,
XKeyEvent *ev,
Bool sync
-#endif
);
#endif
extern int _XimLookupMBText(
-#if NeedFunctionPrototypes
Xic ic,
XKeyEvent *event,
char *buffer,
int nbytes,
KeySym *keysym,
XComposeStatus *status
-#endif
);
extern int _XimLookupWCText(
-#if NeedFunctionPrototypes
Xic ic,
XKeyEvent *event,
wchar_t *buffer,
int nbytes,
KeySym *keysym,
XComposeStatus *status
-#endif
+);
+
+extern int _XimLookupUTF8Text(
+ Xic ic,
+ XKeyEvent *event,
+ char *buffer,
+ int nbytes,
+ KeySym *keysym,
+ XComposeStatus *status
);
extern EVENTMASK _XimGetWindowEventmask(
-#if NeedFunctionPrototypes
Xic ic
-#endif
);
extern Xic _XimICOfXICID(
-#if NeedFunctionPrototypes
Xim im,
XICID icid
-#endif
);
extern void _XimResetIMInstantiateCallback(
-#if NeedFunctionPrototypes
Xim xim
-#endif
);
extern Bool _XimRegisterIMInstantiateCallback(
-#if NeedFunctionPrototypes
XLCd lcd,
Display *display,
XrmDatabase rdb,
char *res_name,
char *res_class,
- XIMProc callback,
- XPointer *client_data
-#endif
+ XIDProc callback,
+ XPointer client_data
);
extern Bool _XimUnRegisterIMInstantiateCallback(
-#if NeedFunctionPrototypes
XLCd lcd,
Display *display,
XrmDatabase rdb,
char *res_name,
char *res_class,
- XIMProc callback,
- XPointer *client_data
-#endif
+ XIDProc callback,
+ XPointer client_data
);
extern void _XimFreeCommitInfo(
-#if NeedFunctionPrototypes
Xic ic
-#endif
);
extern Bool _XimConnect(
-#if NeedFunctionPrototypes
Xim im
-#endif
);
extern Bool _XimShutdown(
-#if NeedFunctionPrototypes
Xim im
-#endif
);
extern Bool _XimWrite(
-#if NeedFunctionPrototypes
Xim im,
INT16 len,
XPointer data
-#endif
);
extern Bool _XimRead(
-#if NeedFunctionPrototypes
Xim im,
INT16 *len,
XPointer data,
int data_len,
Bool (*predicate)(
-#if NeedNestedPrototypes
Xim, INT16, XPointer, XPointer
-#endif
),
XPointer arg
-#endif
);
extern Bool _XimIntrCallback(
-#if NeedFunctionPrototypes
Xim im,
Bool (*callback)(
-#if NeedNestedPrototypes
Xim, INT16, XPointer, XPointer
-#endif
),
XPointer call_data
-#endif
);
extern void _XimFlush(
-#if NeedFunctionPrototypes
Xim im
-#endif
);
extern Bool _XimFilterWaitEvent(
-#if NeedFunctionPrototypes
Xim im
-#endif
);
extern void _XimProcError(
-#if NeedFunctionPrototypes
Xim im,
Xic ic,
XPointer data
-#endif
);
#ifdef EXT_MOVE
extern CARD32 _XimExtenArgCheck(
-#if NeedFunctionProtoTypes
XIMArg *arg
-#endif
);
#endif
extern Bool _XimCbDispatch(
-#if NeedFunctionPrototypes
Xim im,
INT16 len,
XPointer data,
XPointer call_data
-#endif
-);
-
-extern void _XimGetResourceName(
-#if NeedFunctionPrototypes
- Xim im,
- char *res_name,
- char *res_class
-#endif
);
extern Bool _XimLocalFilter(
-#if NeedFunctionPrototypes
Display *d,
Window w,
XEvent *ev,
XPointer client_data
-#endif
);
extern XIMResourceList _XimGetResourceListRecByQuark(
-#if NeedFunctionPrototypes
XIMResourceList res_list,
unsigned int list_num,
XrmQuark quark
-#endif
);
extern Bool _XimReconnectModeCreateIC(
-#if NeedFunctionPrototypes
Xic ic
-#endif
);
extern char *_XimLocalSetICValues(
-#if NeedFunctionPrototypes
XIC ic,
XIMArg *values
-#endif
);
extern char * _XimLocalGetICValues(
-#if NeedFunctionPrototypes
XIC ic,
XIMArg *values
-#endif
);
extern int _XimLocalMbLookupString(
-#if NeedFunctionPrototypes
XIC ic,
XKeyEvent *ev,
char *buffer,
int bytes,
KeySym *keysym,
Status *status
-#endif
);
extern int _XimLocalWcLookupString(
-#if NeedFunctionPrototypes
XIC ic,
XKeyEvent *ev,
wchar_t *buffer,
int bytes,
KeySym *keysym,
Status *status
-#endif
+);
+
+extern int _XimLocalUtf8LookupString(
+ XIC ic,
+ XKeyEvent *ev,
+ char *buffer,
+ int bytes,
+ KeySym *keysym,
+ Status *status
);
extern Bool _XimThaiFilter(
-#if NeedFunctionPrototypes
Display *d,
Window w,
XEvent *ev,
XPointer client_data
-#endif
);
extern XIC _XimThaiCreateIC(
-#if NeedFunctionPrototypes
XIM im,
XIMArg *values
-#endif
);
extern Status _XimThaiCloseIM(
-#if NeedFunctionPrototypes
XIM xim
-#endif
);
#ifdef XIM_CONNECTABLE
extern void _XimSetProtoResource(
-#if NeedFunctionPrototypes
Xim im
-#endif
);
extern Bool _XimConnectServer(
-#if NeedFunctionPrototypes
Xim im
-#endif
);
extern Bool _XimDelayModeSetAttr(
-#if NeedFunctionPrototypes
Xim im
-#endif
);
extern void _XimServerReconectableDestroy(
-#if NeedFunctionPrototypes
void
-#endif
);
extern Bool _XimReCreateIC(
-#if NeedFunctionPrototypes
Xic ic
-#endif
);
extern Bool _XimEncodeSavedIMATTRIBUTE(
-#if NeedFunctionPrototypes
Xim im,
XIMResourceList res_list,
unsigned int res_num,
@@ -1123,11 +971,9 @@ extern Bool _XimEncodeSavedIMATTRIBUTE(
int *ret_len,
XPointer top,
unsigned long mode
-#endif
);
extern Bool _XimEncodeSavedICATTRIBUTE(
-#if NeedFunctionPrototypes
Xic ic,
XIMResourceList res_list,
unsigned int res_num,
@@ -1137,8 +983,20 @@ extern Bool _XimEncodeSavedICATTRIBUTE(
int *ret_len,
XPointer top,
unsigned long mode
-#endif
);
#endif
+extern Public Bool
+_XimRegisterDispatcher(
+ Xim im,
+ Bool (*callback)(
+ Xim, INT16, XPointer, XPointer
+ ),
+ XPointer call_data);
+
+extern Public Bool
+_XimRespSyncReply(
+ Xic ic,
+ BITMASK16 mode);
+
#endif /* _XIMINT_H */
diff --git a/src/xlibi18n/XimintL.h b/src/xlibi18n/XimintL.h
index 720a78bd..2d4f6a9e 100644
--- a/src/xlibi18n/XimintL.h
+++ b/src/xlibi18n/XimintL.h
@@ -32,6 +32,7 @@ THIS SOFTWARE.
frankyling@hgrd01.enet.dec.com
******************************************************************/
+/* $XFree86: xc/lib/X11/XimintL.h,v 1.6 2000/12/04 18:49:19 dawes Exp $ */
#ifndef _XIMINTL_H
#define _XIMINTL_H
@@ -50,14 +51,23 @@ typedef struct _DefTree {
KeySym keysym; /* leaf only */
char *mb;
wchar_t *wc; /* make from mb */
+ char *utf8; /* make from mb */
KeySym ks;
} DefTree;
typedef struct _XimLocalPrivateRec {
- XIC current_ic;
- DefTree *top;
- XlcConv ctom_conv;
- XlcConv ctow_conv;
+ /* The first fields are identical with XimCommonPrivateRec. */
+ XlcConv ctom_conv;
+ XlcConv ctow_conv;
+ XlcConv ctoutf8_conv;
+ XlcConv cstomb_conv;
+ XlcConv cstowc_conv;
+ XlcConv cstoutf8_conv;
+ XlcConv ucstoc_conv;
+ XlcConv ucstoutf8_conv;
+
+ XIC current_ic;
+ DefTree *top;
} XimLocalPrivateRec;
typedef struct _XicThaiPart {
diff --git a/src/xlibi18n/XimintP.h b/src/xlibi18n/XimintP.h
index 28e09e04..f10d9baa 100644
--- a/src/xlibi18n/XimintP.h
+++ b/src/xlibi18n/XimintP.h
@@ -35,6 +35,7 @@ PERFORMANCE OF THIS SOFTWARE.
miyamoto@jrd.dec.com
******************************************************************/
+/* $XFree86: xc/lib/X11/XimintP.h,v 1.7 2001/01/17 19:41:49 dawes Exp $ */
#ifndef _XIMINTP_H
#define _XIMINTP_H
@@ -46,9 +47,7 @@ PERFORMANCE OF THIS SOFTWARE.
* for protocol layer callback function
*/
typedef Bool (*XimProtoIntrProc)(
-#if NeedFunctionPrototypes
Xim, INT16, XPointer, XPointer
-#endif
);
typedef struct _XimProtoIntrRec {
XimProtoIntrProc func;
@@ -62,45 +61,41 @@ typedef struct _XimProtoIntrRec {
* for transport layer methods
*/
typedef Bool (*XimTransConnectProc)(
-#if NeedFunctionPrototypes
Xim
-#endif
);
typedef Bool (*XimTransShutdownProc)(
-#if NeedFunctionPrototypes
Xim
-#endif
);
typedef Bool (*XimTransWriteProc)(
-#if NeedFunctionPrototypes
Xim, INT16, XPointer
-#endif
);
typedef Bool (*XimTransReadProc)(
-#if NeedFunctionPrototypes
Xim, XPointer, int, int *
-#endif
);
typedef void (*XimTransFlushProc)(
-#if NeedFunctionPrototypes
Xim
-#endif
);
typedef Bool (*XimTransRegDispatcher)(
-#if NeedNestedPrototypes
Xim, Bool (*)(Xim, INT16, XPointer, XPointer), XPointer
-#endif
);
typedef Bool (*XimTransCallDispatcher)(
-#if NeedFunctionPrototypes
Xim, INT16, XPointer
-#endif
);
/*
* private part of IM
*/
typedef struct _XimProtoPrivateRec {
+ /* The first fields are identical with XimCommonPrivateRec. */
+ XlcConv ctom_conv;
+ XlcConv ctow_conv;
+ XlcConv ctoutf8_conv;
+ XlcConv cstomb_conv;
+ XlcConv cstowc_conv;
+ XlcConv cstoutf8_conv;
+ XlcConv ucstoc_conv;
+ XlcConv ucstoutf8_conv;
+
Window im_window;
XIMID imid;
CARD16 unused;
@@ -126,9 +121,6 @@ typedef struct _XimProtoPrivateRec {
XrmQuark *saved_imvalues;
int num_saved_imvalues;
- XlcConv ctom_conv;
- XlcConv ctow_conv;
-
/*
* transport specific
*/
diff --git a/src/xlibi18n/XlcDL.c b/src/xlibi18n/XlcDL.c
index 210bd731..2c7529f8 100644
--- a/src/xlibi18n/XlcDL.c
+++ b/src/xlibi18n/XlcDL.c
@@ -41,6 +41,8 @@ interest in or to any trademark, service mark, logo or trade name of
Sun Microsystems, Inc. or its licensors is granted.
*/
+/* $XFree86: xc/lib/X11/XlcDL.c,v 1.12 2003/04/13 19:22:19 dawes Exp $ */
+/* $XdotOrg: lib/X11/src/xlibi18n/XlcDL.c,v 1.2 2004-04-23 18:43:24 eich Exp $ */
#include <stdio.h>
#if defined(hpux)
@@ -54,14 +56,15 @@ Sun Microsystems, Inc. or its licensors is granted.
#include "XlcPublic.h"
#include "XlcPubI.h"
-#ifdef _LP64
-#if defined(__sparcv9)
-#define _MACH64_NAME "sparcv9"
-#define _MACH64_NAME_LEN (sizeof (_MACH64_NAME) - 1)
-#else /* !defined(__sparcv9) */
-#error "Unknown architecture"
-#endif /* defined(__sparcv9) */
-#endif /* _LP64 */
+#if defined(_LP64) && defined(__sparcv9)
+# define _MACH64_NAME "sparcv9"
+#else
+# undef _MACH64_NAME
+#endif /* defined(_LP64) && defined(__sparcv9) */
+
+#ifdef _MACH64_NAME
+# define _MACH64_NAME_LEN (sizeof (_MACH64_NAME) - 1)
+#endif
#define XI18N_DLREL 2
@@ -82,6 +85,7 @@ typedef struct {
char *im_register;
char *im_unregister;
int dl_release;
+ unsigned int refcount;
#if defined(hpux)
shl_t dl_module;
#else
@@ -96,10 +100,7 @@ static XI18NObjectsListRec *xi18n_objects_list = NULL;
static int lc_count = 0;
static int
-parse_line(line, argv, argsize)
-char *line;
-char **argv;
-int argsize;
+parse_line(char *line, char **argv, int argsize)
{
int argc = 0;
char *p = line;
@@ -123,10 +124,40 @@ int argsize;
return argc;
}
+static char *
+strdup_with_underscore(const char *symbol)
+{
+ char *result;
+
+ if ((result = malloc(strlen(symbol) + 2)) == NULL)
+ return NULL;
+ result[0] = '_';
+ strcpy(result + 1, symbol);
+ return result;
+}
+
+#ifndef hpux
+static void *
+try_both_dlsym (void *handle, char *name)
+{
+ void *ret;
+
+ ret = dlsym (handle, name);
+ if (!ret)
+ {
+ name = strdup_with_underscore (name);
+ if (name)
+ {
+ ret = dlsym (handle, name);
+ free (name);
+ }
+ }
+ return ret;
+}
+#endif
+
static void
-resolve_object(path, lc_name)
-char *path;
-char *lc_name;
+resolve_object(char *path, const char *lc_name)
{
char filename[BUFSIZ];
FILE *fp;
@@ -181,6 +212,7 @@ Limit the length of path to prevent stack buffer corruption.
xi18n_objects_list[lc_count].open = strdup(args[2]);
xi18n_objects_list[lc_count].dl_release = XI18N_DLREL;
xi18n_objects_list[lc_count].locale_name = strdup(lc_name);
+ xi18n_objects_list[lc_count].refcount = 0;
xi18n_objects_list[lc_count].dl_module = (void*)NULL;
if (n == 5) {
xi18n_objects_list[lc_count].im_register = strdup(args[3]);
@@ -196,14 +228,18 @@ Limit the length of path to prevent stack buffer corruption.
}
static char*
-__lc_path(dl_name, lc_dir)
-const char *dl_name;
-const char *lc_dir;
+__lc_path(const char *dl_name, const char *lc_dir)
{
char *path;
size_t len;
-#ifdef _LP64
+ /*
+ * reject this for possible security issue
+ */
+ if (strstr (dl_name, "../"))
+ return NULL;
+
+#if defined (_LP64) && defined (_MACH64_NAME)
len = (lc_dir ? strlen(lc_dir) : 0 ) +
(dl_name ? strlen(dl_name) : 0) + _MACH64_NAME_LEN + 10;
path = Xmalloc(len + 1);
@@ -234,6 +270,9 @@ const char *lc_dir;
#else
len = (lc_dir ? strlen(lc_dir) : 0 ) +
(dl_name ? strlen(dl_name) : 0) + 10;
+#if defined POSTLOCALELIBDIR
+ len += (strlen(POSTLOCALELIBDIR) + 1);
+#endif
path = Xmalloc(len + 1);
if (strchr(dl_name, '/') != NULL) {
@@ -241,34 +280,121 @@ const char *lc_dir;
slash_p = strrchr(lc_dir, '/');
*slash_p = '\0';
strcpy(path, lc_dir); strcat(path, "/");
+#if defined POSTLOCALELIBDIR
+ strcat(path, POSTLOCALELIBDIR); strcat(path, "/");
+#endif
strcat(path, dl_name); strcat(path, ".so.2");
*slash_p = '/';
} else {
strcpy(path, lc_dir); strcat(path, "/");
+#if defined POSTLOCALELIBDIR
+ strcat(path, POSTLOCALELIBDIR); strcat(path, "/");
+#endif
strcat(path, dl_name); strcat(path, ".so.2");
}
#endif
return path;
}
+/* We reference count dlopen() and dlclose() of modules; unfortunately,
+ * since XCloseIM, XCloseOM, XlcClose aren't wrapped, but directly
+ * call the close method of the object, we leak a reference count every
+ * time we open then close a module. Fixing this would require
+ * either creating proxy objects or hooks for close_im/close_om
+ * in XLCd
+ */
+static Bool
+open_object(
+ XI18NObjectsList object,
+ char *lc_dir)
+{
+ char *path;
+
+ if (object->refcount == 0) {
+ path = __lc_path(object->dl_name, lc_dir);
+ if (!path)
+ return False;
+#if defined(hpux)
+ object->dl_module = shl_load(path, BIND_DEFERRED, 0L);
+#else
+ object->dl_module = dlopen(path, RTLD_LAZY);
+#endif
+ Xfree(path);
+
+ if (!object->dl_module)
+ return False;
+ }
+
+ object->refcount++;
+ return True;
+}
+
+static void *
+fetch_symbol(
+ XI18NObjectsList object,
+ char *symbol)
+{
+ void *result = NULL;
+#if defined(hpux)
+ int getsyms_cnt, i;
+ struct shl_symbol *symbols;
+#endif
+
+ if (symbol == NULL)
+ return NULL;
+
+#if defined(hpux)
+ getsyms_cnt = shl_getsymbols(object->dl_module, TYPE_PROCEDURE,
+ EXPORT_SYMBOLS, malloc, &symbols);
+
+ for(i=0; i<getsyms_cnt; i++) {
+ if(!strcmp(symbols[i].name, symbol)) {
+ result = symbols[i].value;
+ break;
+ }
+ }
+
+ if(getsyms_cnt > 0) {
+ free(symbols);
+ }
+#else
+ result = try_both_dlsym(object->dl_module, symbol);
+#endif
+
+ return result;
+}
+
+static void
+close_object(XI18NObjectsList object)
+{
+ object->refcount--;
+ if (object->refcount == 0)
+ {
+#if defined(hpux)
+ shl_unload(object->dl_module);
+#else
+ dlclose(object->dl_module);
+#endif
+ object->dl_module = NULL;
+ }
+}
+
+
+typedef XLCd (*dynamicLoadProc)(const char *);
+
XLCd
-_XlcDynamicLoad(lc_name)
- char *lc_name;
+_XlcDynamicLoad(const char *lc_name)
{
XLCd lcd = (XLCd)NULL;
- XLCd (*lc_loader)() = (XLCd(*)())NULL;
- char *path;
+ dynamicLoadProc lc_loader = (dynamicLoadProc)NULL;
int count;
XI18NObjectsList objects_list;
char lc_dir[BUFSIZE];
-#if defined(hpux)
- int getsyms_cnt, i;
- struct shl_symbol *symbols;
-#endif
if (lc_name == NULL) return (XLCd)NULL;
- if (_XlcLocaleDirName(lc_dir, lc_name) == (char*)NULL) return (XLCd)NULL;
+ if (_XlcLocaleDirName(lc_dir, BUFSIZE, (char *)lc_name) == (char*)NULL)
+ return (XLCd)NULL;
resolve_object(lc_dir, lc_name);
@@ -277,140 +403,75 @@ _XlcDynamicLoad(lc_name)
for (; count-- > 0; objects_list++) {
if (objects_list->type != XLC_OBJECT ||
strcmp(objects_list->locale_name, lc_name)) continue;
- if (!objects_list->dl_module) {
- path = __lc_path(objects_list->dl_name, lc_dir);
-#if defined(hpux)
- objects_list->dl_module = shl_load(path, BIND_DEFERRED, 0L);
-#else
- objects_list->dl_module = dlopen(path, RTLD_LAZY);
-#endif
- Xfree(path);
- if (!objects_list->dl_module) continue;
- }
-#if defined(hpux)
- getsyms_cnt = shl_getsymbols(objects_list->dl_module, TYPE_PROCEDURE,
- EXPORT_SYMBOLS, malloc, &symbols);
-
- for(i=0; i<getsyms_cnt; i++) {
- if(!strcmp(symbols[i].name, objects_list->open)) {
- lc_loader = symbols[i].value;
- break;
- }
- }
+ if (!open_object (objects_list, lc_dir))
+ continue;
- if(getsyms_cnt > 0) {
- free(symbols);
- }
-#else
- lc_loader = (XLCd(*)())dlsym(objects_list->dl_module,
- objects_list->open);
-#endif
+ lc_loader = (dynamicLoadProc)fetch_symbol (objects_list, objects_list->open);
if (!lc_loader) continue;
lcd = (*lc_loader)(lc_name);
if (lcd != (XLCd)NULL) {
break;
}
-#if defined(hpux)
- shl_unload(objects_list->dl_module);
-#else
- dlclose(objects_list->dl_module);
-#endif
- objects_list->dl_module = NULL;
+
+ close_object (objects_list);
}
return (XLCd)lcd;
}
+
+typedef XIM (*dynamicOpenProcp)(XLCd, Display *, XrmDatabase, char *, char *);
+
static XIM
-#if NeedFunctionPrototypes
_XDynamicOpenIM(XLCd lcd, Display *display, XrmDatabase rdb,
char *res_name, char *res_class)
-#else
-_XDynamicOpenIM(lcd, display, rdb, res_name, res_class)
-XLCd lcd;
-Display *display;
-XrmDatabase rdb;
-char *res_name, *res_class;
-#endif
{
XIM im = (XIM)NULL;
- char *path;
char lc_dir[BUFSIZE];
char *lc_name;
- XIM (*im_openIM)() = (XIM(*)())NULL;
+ dynamicOpenProcp im_openIM = (dynamicOpenProcp)NULL;
int count;
XI18NObjectsList objects_list = xi18n_objects_list;
-#if defined(hpux)
- int getsyms_cnt, i;
- struct shl_symbol *symbols;
-#endif
lc_name = lcd->core->name;
- if (_XlcLocaleDirName(lc_dir, lc_name) == NULL) return (XIM)0;
+ if (_XlcLocaleDirName(lc_dir, BUFSIZE, lc_name) == NULL) return (XIM)0;
count = lc_count;
for (; count-- > 0; objects_list++) {
if (objects_list->type != XIM_OBJECT ||
strcmp(objects_list->locale_name, lc_name)) continue;
- if (!objects_list->dl_module) {
- path = __lc_path(objects_list->dl_name, lc_dir);
-#if defined(hpux)
- objects_list->dl_module = shl_load(path, BIND_DEFERRED, 0L);
-#else
- objects_list->dl_module = dlopen(path, RTLD_LAZY);
-#endif
- Xfree(path);
- if (!objects_list->dl_module) continue;
- }
-#if defined(hpux)
- getsyms_cnt = shl_getsymbols(objects_list->dl_module, TYPE_PROCEDURE,
- EXPORT_SYMBOLS, malloc, &symbols);
- for(i=0; i<getsyms_cnt; i++) {
- if(!strcmp(symbols[i].name, objects_list->open)) {
- im_openIM = symbols[i].value;
- break;
- }
- }
+ if (!open_object (objects_list, lc_dir))
+ continue;
- if(getsyms_cnt > 0) {
- free(symbols);
- }
-#else
- im_openIM = (XIM(*)())dlsym(objects_list->dl_module,
- objects_list->open);
+ im_openIM = (dynamicOpenProcp)fetch_symbol(objects_list, objects_list->open);
if (!im_openIM) continue;
-#endif
im = (*im_openIM)(lcd, display, rdb, res_name, res_class);
if (im != (XIM)NULL) {
- break;
+ break;
}
- im_openIM = 0;
-#if defined(hpux)
- shl_unload(objects_list->dl_module);
-#else
- dlclose(objects_list->dl_module);
-#endif
- objects_list->dl_module = NULL;
+
+ close_object (objects_list);
}
return (XIM)im;
}
+typedef Bool (*dynamicRegisterCBProcp)(
+ XLCd, Display *, XrmDatabase, char *, char *, XIDProc, XPointer);
+
static Bool
-_XDynamicRegisterIMInstantiateCallback(lcd, display, rdb,
- res_name, res_class,
- callback, client_data)
-XLCd lcd;
-Display *display;
-XrmDatabase rdb;
-char *res_name, *res_class;
-XIMProc callback;
-XPointer *client_data;
+_XDynamicRegisterIMInstantiateCallback(
+ XLCd lcd,
+ Display *display,
+ XrmDatabase rdb,
+ char *res_name,
+ char *res_class,
+ XIDProc callback,
+ XPointer client_data)
{
- char *path;
char lc_dir[BUFSIZE];
char *lc_name;
- Bool (*im_registerIM)() = (Bool(*)())NULL;
+ dynamicRegisterCBProcp im_registerIM = (dynamicRegisterCBProcp)NULL;
Bool ret_flag = False;
int count;
XI18NObjectsList objects_list = xi18n_objects_list;
@@ -421,72 +482,44 @@ XPointer *client_data;
lc_name = lcd->core->name;
- if (_XlcLocaleDirName(lc_dir, lc_name) == NULL) return False;
+ if (_XlcLocaleDirName(lc_dir, BUFSIZE, lc_name) == NULL) return False;
count = lc_count;
for (; count-- > 0; objects_list++) {
if (objects_list->type != XIM_OBJECT ||
strcmp(objects_list->locale_name, lc_name)) continue;
- if (!objects_list->dl_module) {
- path = __lc_path(objects_list->dl_name, lc_dir);
-#if defined(hpux)
- objects_list->dl_module = shl_load(path, BIND_DEFERRED, 0L);
-#else
- objects_list->dl_module = dlopen(path, RTLD_LAZY);
-#endif
- Xfree(path);
- if (!objects_list->dl_module) continue;
- }
-#if defined(hpux)
- getsyms_cnt = shl_getsymbols(objects_list->dl_module, TYPE_PROCEDURE,
- EXPORT_SYMBOLS, malloc, &symbols);
-
- for(i=0; i<getsyms_cnt; i++) {
- if(!strcmp(symbols[i].name, objects_list->open)) {
- im_registerIM = symbols[i].value;
- break;
- }
- }
- if(getsyms_cnt > 0) {
- free(symbols);
- }
-#else
- im_registerIM = (Bool(*)())dlsym(objects_list->dl_module,
- objects_list->im_register);
+ if (!open_object (objects_list, lc_dir))
+ continue;
+ im_registerIM = (dynamicRegisterCBProcp)fetch_symbol(objects_list,
+ objects_list->im_register);
if (!im_registerIM) continue;
-#endif
ret_flag = (*im_registerIM)(lcd, display, rdb,
res_name, res_class,
callback, client_data);
if (ret_flag) break;
- im_registerIM = 0;
-#if defined(hpux)
- shl_unload(objects_list->dl_module);
-#else
- dlclose(objects_list->dl_module);
-#endif
- objects_list->dl_module = NULL;
+ close_object (objects_list);
}
return (Bool)ret_flag;
}
+typedef Bool (*dynamicUnregisterProcp)(
+ XLCd, Display *, XrmDatabase, char *, char *, XIDProc, XPointer);
+
static Bool
-_XDynamicUnRegisterIMInstantiateCallback(lcd, display, rdb,
- res_name, res_class,
- callback, client_data)
-XLCd lcd;
-Display *display;
-XrmDatabase rdb;
-char *res_name, *res_class;
-XIMProc callback;
-XPointer *client_data;
+_XDynamicUnRegisterIMInstantiateCallback(
+ XLCd lcd,
+ Display *display,
+ XrmDatabase rdb,
+ char *res_name,
+ char *res_class,
+ XIDProc callback,
+ XPointer client_data)
{
- char *path;
char lc_dir[BUFSIZE];
char *lc_name;
- Bool (*im_unregisterIM)() = (Bool(*)())NULL;
+ dynamicUnregisterProcp im_unregisterIM = (dynamicUnregisterProcp)NULL;
Bool ret_flag = False;
int count;
XI18NObjectsList objects_list = xi18n_objects_list;
@@ -496,61 +529,33 @@ XPointer *client_data;
#endif
lc_name = lcd->core->name;
- if (_XlcLocaleDirName(lc_dir, lc_name) == NULL) return False;
+ if (_XlcLocaleDirName(lc_dir, BUFSIZE, lc_name) == NULL) return False;
count = lc_count;
for (; count-- > 0; objects_list++) {
if (objects_list->type != XIM_OBJECT ||
strcmp(objects_list->locale_name, lc_name)) continue;
- if (!objects_list->dl_module) {
- path = __lc_path(objects_list->dl_name, lc_dir);
-#if defined(hpux)
- objects_list->dl_module = shl_load(path, BIND_DEFERRED, 0L);
-#else
- objects_list->dl_module = dlopen(path, RTLD_LAZY);
-#endif
- Xfree(path);
- if (!objects_list->dl_module) continue;
- }
-#if defined(hpux)
- getsyms_cnt = shl_getsymbols(objects_list->dl_module, TYPE_PROCEDURE,
- EXPORT_SYMBOLS, malloc, &symbols);
- for(i=0; i<getsyms_cnt; i++) {
- if(!strcmp(symbols[i].name, objects_list->open)) {
- im_unregisterIM = symbols[i].value;
- break;
- }
- }
+ if (!objects_list->refcount) /* Must already be opened */
+ continue;
- if(getsyms_cnt > 0) {
- free(symbols);
- }
-#else
- im_unregisterIM = (Bool(*)())dlsym(objects_list->dl_module,
- objects_list->im_unregister);
+ im_unregisterIM = (dynamicUnregisterProcp)fetch_symbol(objects_list,
+ objects_list->im_unregister);
if (!im_unregisterIM) continue;
-#endif
ret_flag = (*im_unregisterIM)(lcd, display, rdb,
res_name, res_class,
callback, client_data);
- if (ret_flag) break;
-
- im_unregisterIM = 0;
-#if defined(hpux)
- shl_unload(objects_list->dl_module);
-#else
- dlclose(objects_list->dl_module);
-#endif
- objects_list->dl_module = NULL;
+ if (ret_flag) {
+ close_object (objects_list); /* opened in RegisterIMInstantiateCallback */
+ break;
+ }
}
return (Bool)ret_flag;
}
Bool
-_XInitDynamicIM(lcd)
-XLCd lcd;
+_XInitDynamicIM(XLCd lcd)
{
if(lcd == (XLCd)NULL)
return False;
@@ -560,25 +565,19 @@ XLCd lcd;
return True;
}
+
+typedef XOM (*dynamicIOpenProcp)(
+ XLCd, Display *, XrmDatabase, _Xconst char *, _Xconst char *);
+
static XOM
-#if NeedFunctionPrototypes
_XDynamicOpenOM(XLCd lcd, Display *display, XrmDatabase rdb,
_Xconst char *res_name, _Xconst char *res_class)
-#else
-_XDynamicOpenOM(lcd, display, rdb, res_name, res_class)
-XLCd lcd;
-Display *display;
-XrmDatabase rdb;
-char *res_name;
-char *res_class;
-#endif
{
XOM om = (XOM)NULL;
int count;
- char *path;
char lc_dir[BUFSIZE];
char *lc_name;
- XOM (*om_openOM)() = (XOM(*)())NULL;
+ dynamicIOpenProcp om_openOM = (dynamicIOpenProcp)NULL;
XI18NObjectsList objects_list = xi18n_objects_list;
#if defined(hpux)
int getsyms_cnt, i;
@@ -587,59 +586,28 @@ char *res_class;
lc_name = lcd->core->name;
- if (_XlcLocaleDirName(lc_dir, lc_name) == NULL) return (XOM)0;
+ if (_XlcLocaleDirName(lc_dir, BUFSIZE, lc_name) == NULL) return (XOM)0;
count = lc_count;
for (; count-- > 0; objects_list++) {
if (objects_list->type != XOM_OBJECT ||
strcmp(objects_list->locale_name, lc_name)) continue;
- if (!objects_list->dl_module) {
- path = __lc_path(objects_list->dl_name, lc_dir);
-#if defined(hpux)
- objects_list->dl_module = shl_load(path, BIND_DEFERRED, 0L);
-#else
- objects_list->dl_module = dlopen(path, RTLD_LAZY);
-#endif
- Xfree(path);
- if (!objects_list->dl_module) continue;
- }
-#if defined(hpux)
- getsyms_cnt = shl_getsymbols(objects_list->dl_module, TYPE_PROCEDURE,
- EXPORT_SYMBOLS, malloc, &symbols);
-
- for(i=0; i<getsyms_cnt; i++) {
- if(!strcmp(symbols[i].name, objects_list->open)) {
- om_openOM = symbols[i].value;
- break;
- }
- }
-
- if(getsyms_cnt > 0) {
- free(symbols);
- }
-#else
- om_openOM = (XOM(*)())dlsym(objects_list->dl_module,
- objects_list->open);
+ if (!open_object (objects_list, lc_dir))
+ continue;
+
+ om_openOM = (dynamicIOpenProcp)fetch_symbol(objects_list, objects_list->open);
if (!om_openOM) continue;
-#endif
om = (*om_openOM)(lcd, display, rdb, res_name, res_class);
if (om != (XOM)NULL) {
- break;
+ break;
}
- om_openOM = 0;
-#if defined(hpux)
- shl_unload(objects_list->dl_module);
-#else
- dlclose(objects_list->dl_module);
-#endif
- objects_list->dl_module = NULL;
+ close_object(objects_list);
}
return (XOM)om;
}
Bool
-_XInitDynamicOM(lcd)
- XLCd lcd;
+_XInitDynamicOM(XLCd lcd)
{
if(lcd == (XLCd)NULL)
return False;
diff --git a/src/xlibi18n/XlcGeneric.h b/src/xlibi18n/XlcGeneric.h
index 96f49fe8..f1d14e71 100644
--- a/src/xlibi18n/XlcGeneric.h
+++ b/src/xlibi18n/XlcGeneric.h
@@ -31,6 +31,7 @@
* Modifier: Takanori Tateno FUJITSU LIMITED
*
*/
+/* $XFree86: xc/lib/X11/XlcGeneric.h,v 1.4 2001/07/25 15:04:44 dawes Exp $ */
#ifndef _XLCGENERIC_H_
#define _XLCGENERIC_H_
@@ -93,6 +94,7 @@ typedef struct _CodeSetRec {
ExtdSegment ctextseg;
ParseInfo parse_info;
unsigned long wc_encoding;
+ Bool string_encoding;
} CodeSetRec, *CodeSet;
typedef enum {
@@ -129,10 +131,8 @@ typedef struct _XLCdGenericPart {
CodeSet initial_state_GR;
int segment_conv_num; /* UDC */
SegConv segment_conv; /* UDC */
-#ifndef X_NOT_STDC_ENV
Bool use_stdc_env;
Bool force_convert_to_mb;
-#endif
} XLCdGenericPart;
typedef struct _XLCdGenericRec {
@@ -143,4 +143,22 @@ typedef struct _XLCdGenericRec {
extern XLCdMethods _XlcGenericMethods;
+extern FontScope
+_XlcParse_scopemaps(
+ const char *str,
+ int *size);
+extern void
+_XlcDbg_printValue(
+ const char *str,
+ char **value,
+ int num);
+
+extern XIM
+_XDefaultOpenIM(
+ XLCd lcd,
+ Display *dpy,
+ XrmDatabase rdb,
+ char *res_name,
+ char *res_class);
+
#endif /* _XLCGENERIC_H_ */
diff --git a/src/xlibi18n/XlcPubI.h b/src/xlibi18n/XlcPubI.h
index 0234f0f4..8441d7f6 100644
--- a/src/xlibi18n/XlcPubI.h
+++ b/src/xlibi18n/XlcPubI.h
@@ -23,6 +23,7 @@
* Author: Katsuhisa Yano TOSHIBA Corp.
* mopi@osa.ilab.toshiba.co.jp
*/
+/* $XFree86: xc/lib/X11/XlcPubI.h,v 3.14 2003/11/17 22:20:10 dawes Exp $ */
#ifndef _XLCPUBLICI_H_
#define _XLCPUBLICI_H_
@@ -40,40 +41,30 @@
typedef struct _XLCdPublicMethodsRec *XLCdPublicMethods;
typedef XLCd (*XlcPubCreateProc)(
-#if NeedFunctionPrototypes
- char* /* name */,
- XLCdMethods /* methods */
-#endif
+ const char* name,
+ XLCdMethods methods
);
typedef Bool (*XlcPubInitializeProc)(
-#if NeedFunctionPrototypes
- XLCd /* lcd */
-#endif
+ XLCd lcd
);
typedef void (*XlcPubDestroyProc)(
-#if NeedFunctionPrototypes
- XLCd /* lcd */
-#endif
+ XLCd lcd
);
typedef char* (*XlcPubGetValuesProc)(
-#if NeedFunctionPrototypes
- XLCd /* lcd */,
- XlcArgList /* args */,
- int /* num_args */
-#endif
+ XLCd lcd,
+ XlcArgList args,
+ int num_args
);
typedef void (*XlcPubGetResourceProc)(
-#if NeedFunctionPrototypes
- XLCd /* lcd */,
- char* /* category */,
- char* /* class */,
- char*** /* value */,
- int* /* count */
-#endif
+ XLCd lcd,
+ const char* category,
+ const char* _class,
+ char*** value,
+ int* count
);
typedef struct _XLCdPublicMethodsPart {
@@ -102,7 +93,7 @@ typedef struct _XLCdPublicPart {
char *encoding_name; /* encoding name */
int mb_cur_max; /* ANSI C MB_CUR_MAX */
Bool is_state_depend; /* state-depend encoding */
- char *default_string; /* for XDefaultString() */
+ const char *default_string; /* for XDefaultString() */
XPointer xlocale_db;
} XLCdPublicPart;
@@ -116,137 +107,195 @@ extern XLCdMethods _XlcPublicMethods;
_XFUNCPROTOBEGIN
extern XLCd _XlcCreateLC(
-#if NeedFunctionPrototypes
- char* /* name */,
- XLCdMethods /* methods */
-#endif
+ const char* name,
+ XLCdMethods methods
);
extern void _XlcDestroyLC(
-#if NeedFunctionPrototypes
- XLCd /* lcd */
-#endif
+ XLCd lcd
);
+/* Fills into a freshly created XlcCharSet the fields that can be inferred
+ from the ESC sequence. These are side, char_size, set_size. */
extern Bool _XlcParseCharSet(
-#if NeedFunctionPrototypes
- XlcCharSet /* charset */
-#endif
+ XlcCharSet charset
);
+/* Creates a new XlcCharSet, given its name (including side suffix) and
+ Compound Text ESC sequence (normally at most 4 bytes). */
extern XlcCharSet _XlcCreateDefaultCharSet(
-#if NeedFunctionPrototypes
- char* /* name */,
- char* /* control_sequence */
-#endif
+ const char* name,
+ const char* ct_sequence
);
extern XlcCharSet _XlcAddCT(
-#if NeedFunctionPrototypes
- char* /* name */,
- char* /* control_sequence */
-#endif
+ const char* name,
+ const char* ct_sequence
);
+extern Bool _XlcInitCTInfo (void);
+
extern XrmMethods _XrmDefaultInitParseInfo(
-#if NeedFunctionPrototypes
- XLCd /* lcd */,
- XPointer* /* state */
-#endif
+ XLCd lcd,
+ XPointer* state
);
extern int _XmbTextPropertyToTextList(
-#if NeedFunctionPrototypes
- XLCd /* lcd */,
- Display* /* dpy */,
- XTextProperty* /* text_prop */,
- char*** /* list_ret */,
- int* /* count_ret */
-#endif
+ XLCd lcd,
+ Display* dpy,
+ const XTextProperty* text_prop,
+ char*** list_ret,
+ int* count_ret
);
extern int _XwcTextPropertyToTextList(
-#if NeedFunctionPrototypes
- XLCd /* lcd */,
- Display* /* dpy */,
- XTextProperty* /* text_prop */,
- wchar_t*** /* list_ret */,
- int* /* count_ret */
-#endif
+ XLCd lcd,
+ Display* dpy,
+ const XTextProperty* text_prop,
+ wchar_t*** list_ret,
+ int* count_ret
+);
+
+extern int _Xutf8TextPropertyToTextList(
+ XLCd lcd,
+ Display* dpy,
+ const XTextProperty* text_prop,
+ char*** list_ret,
+ int* count_ret
);
extern int _XmbTextListToTextProperty(
-#if NeedFunctionPrototypes
XLCd /* lcd */,
Display* /* dpy */,
char** /* list */,
int /* count */,
XICCEncodingStyle /* style */,
XTextProperty* /* text_prop */
-#endif
);
extern int _XwcTextListToTextProperty(
-#if NeedFunctionPrototypes
XLCd /* lcd */,
Display* /* dpy */,
wchar_t** /* list */,
int /* count */,
XICCEncodingStyle /* style */,
XTextProperty* /* text_prop */
-#endif
+);
+
+extern int _Xutf8TextListToTextProperty(
+ XLCd /* lcd */,
+ Display* /* dpy */,
+ char** /* list */,
+ int /* count */,
+ XICCEncodingStyle /* style */,
+ XTextProperty* /* text_prop */
);
extern void _XwcFreeStringList(
-#if NeedFunctionPrototypes
XLCd /* lcd */,
wchar_t** /* list */
-#endif
);
extern int _XlcResolveLocaleName(
-#if NeedFunctionPrototypes
- char* /* lc_name */,
- XLCdPublicPart* /* pub */
-#endif
+ const char* lc_name,
+ XLCdPublicPart* pub
);
extern int _XlcResolveI18NPath(
-#if NeedFunctionPrototypes
- char* /* buf */,
- int /* buf_len */
-#endif
+ char* buf,
+ int buf_len
);
extern char *_XlcLocaleDirName(
-#if NeedFunctionPrototypes
- char* /* dir_name */,
- char* /* lc_name */
-#endif
+ char* /* dir_name */,
+ size_t, /* dir_len */
+ char* /* lc_name */
);
extern XPointer _XlcCreateLocaleDataBase(
-#if NeedFunctionPrototypes
- XLCd /* lcd */
-#endif
+ XLCd lcd
);
extern void _XlcDestroyLocaleDataBase(
-#if NeedFunctionPrototypes
- XLCd /* lcd */
-#endif
+ XLCd lcd
);
extern void _XlcGetLocaleDataBase(
-#if NeedFunctionPrototypes
XLCd /* lcd */,
- char* /* category */,
- char* /* name */,
+ const char* /* category */,
+ const char* /* name */,
char*** /* value */,
int* /* count */
-#endif
);
+#ifdef X_LOCALE
+extern char *
+_Xsetlocale(
+ int category,
+ _Xconst char *name);
+#else
+#ifdef __DARWIN__
+extern char *
+_Xsetlocale(
+ int category,
+ _Xconst char *name);
+#endif
+extern char *_XlcMapOSLocaleName(
+ char *osname,
+ char *siname);
+#endif
+
+extern int
+_Xmbstoutf8(
+ char *ustr,
+ const char *str,
+ int len);
+extern int
+_Xlcmbstoutf8(
+ XLCd lcd,
+ char *ustr,
+ const char *str,
+ int len);
+extern int
+_Xmbstowcs(
+ wchar_t *wstr,
+ char *str,
+ int len);
+extern int
+_Xlcwcstombs(
+ XLCd lcd,
+ char *str,
+ wchar_t *wstr,
+ int len);
+extern int
+_Xlcmbstowcs(
+ XLCd lcd,
+ wchar_t *wstr,
+ char *str,
+ int len);
+extern int
+_Xwcstombs(
+ char *str,
+ wchar_t *wstr,
+ int len);
+extern int
+_Xlcmbtowc(
+ XLCd lcd,
+ wchar_t *wstr,
+ char *str,
+ int len);
+extern int
+_Xlcwctomb(
+ XLCd lcd,
+ char *str,
+ wchar_t wc);
+
+
+
+extern XPointer
+_Utf8GetConvByName(
+ const char *name);
+
_XFUNCPROTOEND
#endif /* _XLCPUBLICI_H_ */
diff --git a/src/xlibi18n/XlcPublic.h b/src/xlibi18n/XlcPublic.h
index 0deb44c1..27595d8a 100644
--- a/src/xlibi18n/XlcPublic.h
+++ b/src/xlibi18n/XlcPublic.h
@@ -31,65 +31,135 @@
* Modifier: Takanori Tateno FUJITSU LIMITED
*
*/
+/* $XFree86: xc/lib/X11/XlcPublic.h,v 1.11 2003/04/17 02:06:31 dawes Exp $ */
+/*
+ * Most of this API is documented in i18n/Framework.PS
+ */
#ifndef _XLCPUBLIC_H_
#define _XLCPUBLIC_H_
#include "Xlcint.h"
-#define XlcNCharSize "charSize"
-#define XlcNCodeset "codeset"
-#define XlcNControlSequence "controlSequence"
-#define XlcNDefaultString "defaultString"
-#define XlcNEncodingName "encodingName"
-#define XlcNLanguage "language"
-#define XlcNMbCurMax "mbCurMax"
-#define XlcNName "name"
-#define XlcNSetSize "setSize"
-#define XlcNSide "side"
-#define XlcNStateDependentEncoding "stateDependentEncoding"
-#define XlcNTerritory "territory"
+/*
+ * Character sets.
+ */
+
+/* Every character set has a "side". It denotes the range of byte values for
+ which the character set is responsible. This means that the character
+ set's encoded characters will only assumes bytes within the range, and
+ that the character set can be used simultaneously with another character
+ set responsible for a disjoint range. */
typedef enum {
- XlcUnknown, XlcC0, XlcGL, XlcC1, XlcGR, XlcGLGR, XlcOther, XlcNONE
+ XlcUnknown,
+ XlcC0, /* responsible for values 0x00..0x1F */
+ XlcGL, /* responsible for values 0x00..0x7F or 0x20..0x7F */
+ XlcC1, /* responsible for values 0x80..0x9F */
+ XlcGR, /* responsible for values 0x80..0xFF or 0xA0..0xFF */
+ XlcGLGR, /* responsible for values 0x00..0xFF */
+ XlcOther, /* unused */
+ XlcNONE
} XlcSide;
-typedef struct _FontScope {
- unsigned long start;
- unsigned long end;
- unsigned long shift;
- unsigned long shift_direction;
-} FontScopeRec, *FontScope;
-
+/* Data read from XLC_LOCALE files.
+ XXX Apparently superseded by _XUDCGlyphRegion. */
typedef struct _UDCArea {
- unsigned long start,end;
+ unsigned long start;
+ unsigned long end;
} UDCAreaRec, *UDCArea;
-typedef struct _XlcCharSetRec *XlcCharSet;
+/* Where the character set comes from. */
+typedef enum {
+ CSsrcUndef, /* unused */
+ CSsrcStd, /* defined in libX11 */
+ CSsrcXLC /* defined in an XLC_LOCALE file */
+} CSSrc;
-typedef char* (*XlcGetCSValuesProc)(
-#if NeedFunctionPrototypes
- XlcCharSet /* charset */,
- XlcArgList /* args */,
- int /* num_args */
-#endif
-);
+/* These are the supported properties of XlcCharSet. */
+#define XlcNCharSize "charSize"
+#define XlcNControlSequence "controlSequence"
+#define XlcNEncodingName "encodingName"
+#define XlcNName "name"
+#define XlcNSetSize "setSize"
+#define XlcNSide "side"
+/* This is the structure of an XlcCharSet.
+ Once allocated, they are never freed. */
typedef struct _XlcCharSetRec {
- char *name; /* character set name */
+ /* Character set name, including side suffix */
+ const char *name;
XrmQuark xrm_name;
- char *encoding_name; /* XLFD encoding name */
+
+ /* XLFD encoding name, no side suffix */
+ const char *encoding_name;
XrmQuark xrm_encoding_name;
- XlcSide side; /* GL, GR or others */
- int char_size; /* number of bytes per character */
- int set_size; /* graphic character sets */
- char *ct_sequence; /* control sequence of CT */
- XlcGetCSValuesProc get_values;
- /* UDC */
+
+ /* Range for which the charset is responsible: XlcGL, XlcGR or XlcGLGR */
+ XlcSide side;
+
+ /* Number of bytes per character. 0 means a varying number (e.g. UTF-8) */
+ int char_size;
+ /* Classification of the character set according to ISO-2022 */
+ int set_size; /* e.g. 94 or 96 */
+ const char *ct_sequence; /* control sequence of CT */
+ /* (normally at most 4 bytes) */
+
+ /* for UDC */
Bool string_encoding;
UDCArea udc_area;
int udc_area_num;
-} XlcCharSetRec;
+
+ /* Description source */
+ CSSrc source;
+} XlcCharSetRec, *XlcCharSet;
+
+_XFUNCPROTOBEGIN
+
+/* Returns the charset with the given name (including side suffix).
+ Returns NULL if not found. */
+extern XlcCharSet _XlcGetCharSet(
+ const char* name
+);
+
+/* Returns the charset with the given encoding (no side suffix) and
+ responsible for at least the given side (XlcGL or XlcGR).
+ Returns NULL if not found. */
+extern XlcCharSet _XlcGetCharSetWithSide(
+ const char* encoding_name,
+ XlcSide side
+);
+
+/* Registers an XlcCharSet in the list of character sets.
+ Returns True if successful. */
+extern Bool _XlcAddCharSet(
+ XlcCharSet charset
+);
+
+/* Retrieves a number of attributes of an XlcCharSet.
+ Return NULL if successful, otherwise the name of the first argument
+ specifiying a nonexistent attribute. */
+extern char *_XlcGetCSValues(
+ XlcCharSet charset,
+ ...
+);
+
+_XFUNCPROTOEND
+
+
+#define XlcNCodeset "codeset"
+#define XlcNDefaultString "defaultString"
+#define XlcNLanguage "language"
+#define XlcNMbCurMax "mbCurMax"
+#define XlcNStateDependentEncoding "stateDependentEncoding"
+#define XlcNTerritory "territory"
+
+typedef struct _FontScope {
+ unsigned long start;
+ unsigned long end;
+ unsigned long shift;
+ unsigned long shift_direction;
+} FontScopeRec, *FontScope;
/*
* conversion methods
@@ -98,22 +168,17 @@ typedef struct _XlcCharSetRec {
typedef struct _XlcConvRec *XlcConv;
typedef XlcConv (*XlcOpenConverterProc)(
-#if NeedFunctionPrototypes
- XLCd /* from_lcd */,
- char* /* from_type */,
- XLCd /* to_lcd */,
- char* /* to_type */
-#endif
+ XLCd from_lcd,
+ const char* from_type,
+ XLCd to_lcd,
+ const char* to_type
);
typedef void (*XlcCloseConverterProc)(
-#if NeedFunctionPrototypes
XlcConv /* conv */
-#endif
);
typedef int (*XlcConvertProc)(
-#if NeedFunctionPrototypes
XlcConv /* conv */,
XPointer* /* from */,
int* /* from_left */,
@@ -121,13 +186,10 @@ typedef int (*XlcConvertProc)(
int* /* to_left */,
XPointer* /* args */,
int /* num_args */
-#endif
);
typedef void (*XlcResetConverterProc)(
-#if NeedFunctionPrototypes
XlcConv /* conv */
-#endif
);
typedef struct _XlcConvMethodsRec{
@@ -144,9 +206,12 @@ typedef struct _XlcConvMethodsRec{
#define XlcNWideChar "wideChar"
#define XlcNCompoundText "compoundText"
#define XlcNString "string"
+#define XlcNUtf8String "utf8String"
#define XlcNCharSet "charSet"
#define XlcNCTCharSet "CTcharSet"
+#define XlcNFontCharSet "FontCharSet"
#define XlcNChar "char"
+#define XlcNUcsChar "UCSchar"
typedef struct _XlcConvRec {
XlcConvMethods methods;
@@ -157,131 +222,105 @@ typedef struct _XlcConvRec {
_XFUNCPROTOBEGIN
extern Bool _XInitOM(
-#if NeedFunctionPrototypes
XLCd /* lcd */
-#endif
);
extern Bool _XInitIM(
-#if NeedFunctionPrototypes
XLCd /* lcd */
-#endif
);
-extern char *_XGetLCValues(
-#if NeedVarargsPrototypes
+extern XIM _XimOpenIM(
XLCd /* lcd */,
- ...
-#endif
-);
-
-extern XlcCharSet _XlcGetCharSet(
-#if NeedFunctionPrototypes
- char* /* name */
-#endif
-);
-
-extern Bool _XlcAddCharSet(
-#if NeedFunctionPrototypes
- XlcCharSet /* charset */
-#endif
+ Display * /* dpy */,
+ XrmDatabase /* rdb */,
+ char * /* res_name */,
+ char * /* res_class */
);
-extern char *_XlcGetCSValues(
-#if NeedVarargsPrototypes
- XlcCharSet /* charset */,
+extern char *_XGetLCValues(
+ XLCd /* lcd */,
...
-#endif
);
extern XlcConv _XlcOpenConverter(
-#if NeedFunctionPrototypes
- XLCd /* from_lcd */,
- char* /* from_type */,
- XLCd /* to_lcd */,
- char* /* to_type */
-#endif
+ XLCd from_lcd,
+ const char* from_type,
+ XLCd to_lcd,
+ const char* to_type
);
extern void _XlcCloseConverter(
-#if NeedFunctionPrototypes
- XlcConv /* conv */
-#endif
+ XlcConv conv
);
extern int _XlcConvert(
-#if NeedFunctionPrototypes
- XlcConv /* conv */,
- XPointer* /* from */,
- int* /* from_left */,
- XPointer* /* to */,
- int* /* to_left */,
- XPointer* /* args */,
- int /* num_args */
-#endif
+ XlcConv conv,
+ XPointer* from,
+ int* from_left,
+ XPointer* to,
+ int* to_left,
+ XPointer* args,
+ int num_args
);
extern void _XlcResetConverter(
-#if NeedFunctionPrototypes
- XlcConv /* conv */
-#endif
+ XlcConv conv
);
extern Bool _XlcSetConverter(
-#if NeedFunctionPrototypes
- XLCd /* from_lcd */,
- char* /* from_type */,
- XLCd /* to_lcd */,
- char* /* to_type */,
- XlcOpenConverterProc /* open_converter */
-#endif
+ XLCd from_lcd,
+ const char* from_type,
+ XLCd to_lcd,
+ const char* to_type,
+ XlcOpenConverterProc open_converter
);
extern void _XlcGetResource(
-#if NeedFunctionPrototypes
- XLCd /* lcd */,
- char* /* category */,
- char* /* class */,
- char*** /* value */,
- int* /* count */
-#endif
+ XLCd lcd,
+ const char* category,
+ const char* _class,
+ char*** value,
+ int* count
);
extern char *_XlcFileName(
-#if NeedFunctionPrototypes
- XLCd /* lcd */,
- char* /* category */
-#endif
+ XLCd lcd,
+ const char* category
);
extern int _Xwcslen(
-#if NeedFunctionPrototypes
wchar_t* /* wstr */
-#endif
);
extern wchar_t *_Xwcscpy(
-#if NeedFunctionPrototypes
wchar_t* /* wstr1 */,
wchar_t* /* wstr2 */
-#endif
);
+extern wchar_t *_Xwcsncpy(wchar_t *wstr1, wchar_t *wstr2, int len);
+extern int _Xwcscmp(wchar_t *wstr1, wchar_t *wstr2);
+extern int _Xwcsncmp(wchar_t *wstr1, wchar_t *wstr2, int len);
+
+/* Compares two ISO 8859-1 strings, ignoring case of ASCII letters.
+ Like strcasecmp in an ASCII locale. */
extern int _XlcCompareISOLatin1(
-#if NeedFunctionPrototypes
- char* /* str1 */,
- char* /* str2 */
-#endif
+ const char* str1,
+ const char* str2
);
+/* Compares two ISO 8859-1 strings, at most len bytes of each, ignoring
+ case of ASCII letters. Like strncasecmp in an ASCII locale. */
extern int _XlcNCompareISOLatin1(
-#if NeedFunctionPrototypes
- char* /* str1 */,
- char* /* str2 */,
- int /* len */
-#endif
+ const char* str1,
+ const char* str2,
+ int len
);
+extern XOM
+_XDefaultOpenOM(
+ XLCd lcd, Display *dpy, XrmDatabase rdb,
+ _Xconst char *res_name, _Xconst char *res_class);
+
_XFUNCPROTOEND
#endif /* _XLCPUBLIC_H_ */
diff --git a/src/xlibi18n/XlcSL.c b/src/xlibi18n/XlcSL.c
index 12391b1d..bcf0a001 100644
--- a/src/xlibi18n/XlcSL.c
+++ b/src/xlibi18n/XlcSL.c
@@ -41,14 +41,13 @@ interest in or to any trademark, service mark, logo or trade name of
Sun Microsystems, Inc. or its licensors is granted.
*/
+/* $XFree86$ */
#include "Xlibint.h"
#include "Xlcint.h"
extern XIM _XDefaultOpenIM(
-#if NeedNestedPrototypes
XLCd, Display *, XrmDatabase, char *, char *
-#endif
);
Bool
@@ -65,9 +64,7 @@ XLCd lcd;
}
extern XOM _XDefaultOpenOM(
-#if NeedFunctionPrototypes
XLCd, Display*, XrmDatabase, _Xconst char*, _Xconst char*
-#endif
);
Bool
diff --git a/src/xlibi18n/Xlcint.h b/src/xlibi18n/Xlcint.h
index 60041e7e..fcc3a65f 100644
--- a/src/xlibi18n/Xlcint.h
+++ b/src/xlibi18n/Xlcint.h
@@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/lib/X11/Xlcint.h,v 3.16 2003/04/17 02:06:31 dawes Exp $ */
/*
* Copyright 1990, 1991 by OMRON Corporation, NTT Software Corporation,
@@ -71,17 +72,17 @@ from The Open Group.
#ifndef _XLCINT_H_
#define _XLCINT_H_
+#ifndef _XP_PRINT_SERVER_
+
#include <X11/Xresource.h>
#include <X11/Xutil.h>
-#include "Xvarargs.h"
+#include <stdarg.h>
typedef Bool (*XFilterEventProc)(
-#if NeedFunctionPrototypes
Display* /* display */,
Window /* window */,
XEvent* /* event */,
XPointer /* client_data */
-#endif
);
typedef struct _XIMFilter {
@@ -135,12 +136,12 @@ typedef struct {
XFontSet fontset;
int line_spacing;
Cursor cursor;
- XIMCallback start_callback;
- XIMCallback done_callback;
- XIMCallback draw_callback;
- XIMCallback caret_callback;
+ XICCallback start_callback;
+ XICCallback done_callback;
+ XICCallback draw_callback;
+ XICCallback caret_callback;
XIMPreeditState preedit_state;
- XIMCallback state_notify_callback;
+ XICCallback state_notify_callback;
} ICPreeditAttributes, *ICPreeditAttributesPtr;
typedef struct {
@@ -154,54 +155,62 @@ typedef struct {
XFontSet fontset;
int line_spacing;
Cursor cursor;
- XIMCallback start_callback;
- XIMCallback done_callback;
- XIMCallback draw_callback;
+ XICCallback start_callback;
+ XICCallback done_callback;
+ XICCallback draw_callback;
} ICStatusAttributes, *ICStatusAttributesPtr;
+#endif /* !_XP_PRINT_SERVER_ */
+
/*
* Methods for Xrm parsing
*/
+/* The state is a pointer to an object created by the locale's
+ init_parse_info function (default: _XrmDefaultInitParseInfo). */
+
+/* Sets the state to the initial state.
+ Initiates a sequence of calls to the XmbCharProc. */
typedef void (*XmbInitProc)(
-#if NeedFunctionPrototypes
- XPointer /* state */
-#endif
+ XPointer state
);
+/* Transforms one multibyte character, starting at str, and return a 'char'
+ in the same parsing class (not a wide character!). Returns the number of
+ consumed bytes in *lenp. */
typedef char (*XmbCharProc)(
-#if NeedFunctionPrototypes
- XPointer /* state */,
- char* /* str */,
- int* /* lenp */
-#endif
+ XPointer state,
+ const char * str,
+ int* lenp
);
+/* Terminates a sequence of calls to the XmbCharProc. */
typedef void (*XmbFinishProc)(
-#if NeedFunctionPrototypes
- XPointer /* state */
-#endif
+ XPointer state
);
-typedef char* (*XlcNameProc)(
-#if NeedFunctionPrototypes
- XPointer /* state */
-#endif
+/* Returns the name of the state's locale, as a static string. */
+typedef const char* (*XlcNameProc)(
+ XPointer state
);
+/* Frees the state, which was allocated by the locale's init_parse_info
+ function. */
typedef void (*XrmDestroyProc)(
-#if NeedFunctionPrototypes
- XPointer /* state */
-#endif
+ XPointer state
);
+/* Set of methods for Xrm parsing. */
typedef struct {
XmbInitProc mbinit;
XmbCharProc mbchar;
XmbFinishProc mbfinish;
XlcNameProc lcname;
XrmDestroyProc destroy;
-} XrmMethodsRec, *XrmMethods;
+} XrmMethodsRec;
+typedef const XrmMethodsRec *XrmMethods;
+
+#ifndef _XP_PRINT_SERVER_
typedef struct _XLCd *XLCd; /* need forward reference */
@@ -210,123 +219,97 @@ typedef struct _XLCd *XLCd; /* need forward reference */
*/
typedef void (*XCloseLCProc)(
-#if NeedFunctionPrototypes
XLCd /* lcd */
-#endif
);
typedef char* (*XlcMapModifiersProc)(
-#if NeedFunctionPrototypes
XLCd /* lcd */,
- char* /* user_mods */,
- char* /* prog_mods */
-#endif
+ _Xconst char* /* user_mods */,
+ _Xconst char* /* prog_mods */
);
typedef XOM (*XOpenOMProc)(
-#if NeedFunctionPrototypes
XLCd /* lcd */,
Display* /* display */,
XrmDatabase /* rdb */,
_Xconst char* /* res_name */,
_Xconst char* /* res_class */
-#endif
);
typedef XIM (*XOpenIMProc)(
-#if NeedFunctionPrototypes
XLCd /* lcd */,
Display* /* display */,
XrmDatabase /* rdb */,
char* /* res_name */,
char* /* res_class */
-#endif
);
typedef Bool (*XRegisterIMInstantiateCBProc)(
-#if NeedFunctionPrototypes
XLCd /* lcd */,
Display* /* display */,
XrmDatabase /* rdb */,
char* /* res_name */,
char* /* res_class */,
- XIMProc /* callback */,
- XPointer* /* client_data */
-#endif
+ XIDProc /* callback */,
+ XPointer /* client_data */
);
typedef Bool (*XUnregisterIMInstantiateCBProc)(
-#if NeedFunctionPrototypes
XLCd /* lcd */,
Display* /* display */,
XrmDatabase /* rdb */,
char* /* res_name */,
char* /* res_class */,
- XIMProc /* callback */,
- XPointer* /* client_data */
-#endif
+ XIDProc /* callback */,
+ XPointer /* client_data */
);
typedef XrmMethods (*XrmInitParseInfoProc)(
-#if NeedFunctionPrototypes
XLCd /* lcd */,
XPointer* /* state */
-#endif
);
typedef int (*XmbTextPropertyToTextListProc)(
-#if NeedFunctionPrototypes
- XLCd /* lcd */,
- Display* /* display */,
- XTextProperty* /* text_prop */,
- char*** /* list_return */,
- int* /* count_return */
-#endif
+ XLCd lcd,
+ Display* display,
+ const XTextProperty* text_prop,
+ char*** list_return,
+ int* count_return
);
typedef int (*XwcTextPropertyToTextListProc)(
-#if NeedFunctionPrototypes
- XLCd /* lcd */,
- Display* /* display */,
- XTextProperty* /* text_prop */,
- wchar_t*** /* list_return */,
- int* /* count_return */
-#endif
+ XLCd lcd,
+ Display* display,
+ const XTextProperty* text_prop,
+ wchar_t*** list_return,
+ int* count_return
);
typedef int (*XmbTextListToTextPropertyProc)(
-#if NeedFunctionPrototypes
- XLCd /* lcd */,
- Display* /* display */,
- char** /* list */,
- int /* count */,
- XICCEncodingStyle /* style */,
- XTextProperty* /* text_prop_return */
-#endif
+ XLCd lcd,
+ Display* display,
+ char** list,
+ int count,
+ XICCEncodingStyle style,
+ XTextProperty* text_prop_return
);
typedef int (*XwcTextListToTextPropertyProc)(
-#if NeedFunctionPrototypes
- XLCd /* lcd */,
- Display* /* display */,
- wchar_t** /* list */,
- int /* count */,
- XICCEncodingStyle /* style */,
- XTextProperty* /* text_prop_return */
-#endif
+ XLCd lcd,
+ Display* display,
+ wchar_t** list,
+ int count,
+ XICCEncodingStyle style,
+ XTextProperty* text_prop_return
);
typedef void (*XwcFreeStringListProc)(
-#if NeedFunctionPrototypes
- XLCd /* lcd */,
- wchar_t** /* list */
-#endif
+ XLCd lcd,
+ wchar_t** list
);
-typedef char* (*XDefaultStringProc)(
-#if NeedFunctionPrototypes
- XLCd /* lcd */
-#endif
+typedef const char* (*XDefaultStringProc)(
+ XLCd lcd
);
typedef struct {
@@ -337,8 +320,10 @@ typedef struct {
XrmInitParseInfoProc init_parse_info;
XmbTextPropertyToTextListProc mb_text_prop_to_list;
XwcTextPropertyToTextListProc wc_text_prop_to_list;
+ XmbTextPropertyToTextListProc utf8_text_prop_to_list;
XmbTextListToTextPropertyProc mb_text_list_to_prop;
XwcTextListToTextPropertyProc wc_text_list_to_prop;
+ XmbTextListToTextPropertyProc utf8_text_list_to_prop;
XwcFreeStringListProc wc_free_string_list;
XDefaultStringProc default_string;
XRegisterIMInstantiateCBProc register_callback;
@@ -385,33 +370,25 @@ typedef struct _XlcResource {
#define XlcNumber(arr) (sizeof(arr) / sizeof(arr[0]))
typedef Status (*XCloseOMProc)(
-#if NeedFunctionPrototypes
XOM /* om */
-#endif
);
typedef char* (*XSetOMValuesProc)(
-#if NeedFunctionPrototypes
XOM /* om */,
XlcArgList /* args */,
int /* num_args */
-#endif
);
typedef char* (*XGetOMValuesProc)(
-#if NeedFunctionPrototypes
XOM /* om */,
XlcArgList /* args */,
int /* num_args */
-#endif
);
typedef XOC (*XCreateOCProc)(
-#if NeedFunctionPrototypes
XOM /* om */,
XlcArgList /* args */,
int /* num_args */
-#endif
);
typedef struct _XOMMethodsRec {
@@ -443,25 +420,19 @@ typedef struct _XOM {
} XOMRec;
typedef void (*XDestroyOCProc)(
-#if NeedFunctionPrototypes
XOC /* oc */
-#endif
);
typedef char* (*XSetOCValuesProc)(
-#if NeedFunctionPrototypes
XOC /* oc */,
XlcArgList /* args */,
int /* num_args */
-#endif
);
typedef char* (*XGetOCValuesProc)(
-#if NeedFunctionPrototypes
XOC /* oc */,
XlcArgList /* args */,
int /* num_args */
-#endif
);
/*
@@ -474,25 +445,20 @@ typedef char* (*XGetOCValuesProc)(
*/
typedef int (*XmbTextEscapementProc)(
-#if NeedFunctionPrototypes
XFontSet /* font_set */,
_Xconst char* /* text */,
int /* text_len */
-#endif
);
typedef int (*XmbTextExtentsProc)(
-#if NeedFunctionPrototypes
XFontSet /* font_set */,
_Xconst char* /* text */,
int /* text_len */,
XRectangle* /* overall_ink_extents */,
XRectangle* /* overall_logical_extents */
-#endif
);
typedef Status (*XmbTextPerCharExtentsProc)(
-#if NeedFunctionPrototypes
XFontSet /* font_set */,
_Xconst char* /* text */,
int /* text_len */,
@@ -502,11 +468,9 @@ typedef Status (*XmbTextPerCharExtentsProc)(
int* /* num_chars */,
XRectangle* /* max_ink_extents */,
XRectangle* /* max_logical_extents */
-#endif
);
typedef int (*XmbDrawStringProc)(
-#if NeedFunctionPrototypes
Display* /* display */,
Drawable /* drawable */,
XFontSet /* font_set */,
@@ -515,11 +479,9 @@ typedef int (*XmbDrawStringProc)(
int /* y */,
_Xconst char* /* text */,
int /* text_len */
-#endif
);
typedef void (*XmbDrawImageStringProc)(
-#if NeedFunctionPrototypes
Display* /* display */,
Drawable /* drawable */,
XFontSet /* font_set */,
@@ -528,29 +490,23 @@ typedef void (*XmbDrawImageStringProc)(
int /* y */,
_Xconst char* /* text */,
int /* text_len */
-#endif
);
typedef int (*XwcTextEscapementProc)(
-#if NeedFunctionPrototypes
XFontSet /* font_set */,
_Xconst wchar_t* /* text */,
int /* text_len */
-#endif
);
typedef int (*XwcTextExtentsProc)(
-#if NeedFunctionPrototypes
XFontSet /* font_set */,
_Xconst wchar_t* /* text */,
int /* text_len */,
XRectangle* /* overall_ink_extents */,
XRectangle* /* overall_logical_extents */
-#endif
);
typedef Status (*XwcTextPerCharExtentsProc)(
-#if NeedFunctionPrototypes
XFontSet /* font_set */,
_Xconst wchar_t* /* text */,
int /* text_len */,
@@ -560,11 +516,9 @@ typedef Status (*XwcTextPerCharExtentsProc)(
int* /* num_chars */,
XRectangle* /* max_ink_extents */,
XRectangle* /* max_logical_extents */
-#endif
);
typedef int (*XwcDrawStringProc)(
-#if NeedFunctionPrototypes
Display* /* display */,
Drawable /* drawable */,
XFontSet /* font_set */,
@@ -573,11 +527,9 @@ typedef int (*XwcDrawStringProc)(
int /* y */,
_Xconst wchar_t* /* text */,
int /* text_len */
-#endif
);
typedef void (*XwcDrawImageStringProc)(
-#if NeedFunctionPrototypes
Display* /* display */,
Drawable /* drawable */,
XFontSet /* font_set */,
@@ -586,7 +538,6 @@ typedef void (*XwcDrawImageStringProc)(
int /* y */,
_Xconst wchar_t* /* text */,
int /* text_len */
-#endif
);
typedef struct {
@@ -609,6 +560,14 @@ typedef struct {
XwcTextPerCharExtentsProc wc_extents_per_char;
XwcDrawStringProc wc_draw_string;
XwcDrawImageStringProc wc_draw_image_string;
+
+ /* UTF-8 text drawing methods */
+
+ XmbTextEscapementProc utf8_escapement;
+ XmbTextExtentsProc utf8_extents;
+ XmbTextPerCharExtentsProc utf8_extents_per_char;
+ XmbDrawStringProc utf8_draw_string;
+ XmbDrawImageStringProc utf8_draw_image_string;
} XOCMethodsRec, *XOCMethods;
@@ -638,12 +597,6 @@ typedef struct _XOC {
} XOCRec;
-/* current Ultrix compiler gets horribly confused */
-#if defined(FUNCPROTO) && defined(ultrix)
-#undef NeedFunctionPrototypes
-#endif
-
-
/*
* X Input Managers are an instantiable object, so we define it, the
* object itself, a method list and data.
@@ -654,34 +607,25 @@ typedef struct _XOC {
*/
typedef struct {
Status (*close)(
-#if NeedFunctionPrototypes
XIM
-#endif
);
char* (*set_values)(
-#if NeedFunctionPrototypes
XIM, XIMArg*
-#endif
);
char* (*get_values)(
-#if NeedFunctionPrototypes
XIM, XIMArg*
-#endif
);
XIC (*create_ic)(
-#if NeedFunctionPrototypes
XIM, XIMArg*
-#endif
);
int (*ctstombs)(
-#if NeedFunctionPrototypes
XIM, char*, int, char*, int, Status *
-#endif
);
int (*ctstowcs)(
-#if NeedFunctionPrototypes
XIM, char*, int, wchar_t*, int, Status *
-#endif
+ );
+ int (*ctstoutf8)(
+ XIM, char*, int, char*, int, Status *
);
} XIMMethodsRec, *XIMMethods;
@@ -732,49 +676,37 @@ typedef struct _XIM {
*/
typedef struct {
void (*destroy)(
-#if NeedFunctionPrototypes
XIC
-#endif
);
void (*set_focus)(
-#if NeedFunctionPrototypes
XIC
-#endif
);
void (*unset_focus)(
-#if NeedFunctionPrototypes
XIC
-#endif
);
char* (*set_values)(
-#if NeedFunctionPrototypes
XIC, XIMArg*
-#endif
);
char* (*get_values)(
-#if NeedFunctionPrototypes
XIC, XIMArg*
-#endif
);
char* (*mb_reset)(
-#if NeedFunctionPrototypes
XIC
-#endif
);
wchar_t* (*wc_reset)(
-#if NeedFunctionPrototypes
XIC
-#endif
+ );
+ char* (*utf8_reset)(
+ XIC
);
int (*mb_lookup_string)(
-#if NeedFunctionPrototypes
XIC, XKeyEvent*, char*, int, KeySym*, Status*
-#endif
);
int (*wc_lookup_string)(
-#if NeedFunctionPrototypes
XIC, XKeyEvent*, wchar_t*, int, KeySym*, Status*
-#endif
+ );
+ int (*utf8_lookup_string)(
+ XIC, XKeyEvent*, char*, int, KeySym*, Status*
);
} XICMethodsRec, *XICMethods;
@@ -791,12 +723,12 @@ typedef struct {
XIMStyle input_style; /* IM's input style */
Window focus_window; /* where key events go */
unsigned long filter_events; /* event mask from IM */
- XIMCallback geometry_callback; /* client callback */
+ XICCallback geometry_callback; /* client callback */
char * res_name;
char * res_class;
- XIMCallback destroy_callback;
- XIMCallback string_conversion_callback;
+ XICCallback destroy_callback;
+ XICCallback string_conversion_callback;
XIMStringConversionText string_conversion;
XIMResetState reset_state;
XIMHotKeyTriggers *hotkey;
@@ -816,188 +748,229 @@ typedef struct _XIC {
XICCoreRec core; /* data of this IC */
} XICRec;
-/* current Ultrix compiler gets horribly confused */
-#if !defined(NeedFunctionPrototypes) && defined(FUNCPROTO)
-#define NeedFunctionPrototypes 1
-#endif
+/* If the argument 'name' is appropriate for this loader, it instantiates an
+ XLCd object with appropriate locale methods and returns it. May return
+ NULL; in this case, the remaining loaders are tried. */
typedef XLCd (*XLCdLoadProc)(
-#if NeedFunctionPrototypes
- char*
-#endif
+ const char* name
);
_XFUNCPROTOBEGIN
extern XLCd _XOpenLC(
-#if NeedFunctionPrototypes
- char* /* name */
-#endif
+ char* name
);
extern void _XCloseLC(
-#if NeedFunctionPrototypes
- XLCd /* lcd */
-#endif
+ XLCd lcd
);
-extern XLCd _XlcCurrentLC(
-#if NeedFunctionPrototypes
- void
-#endif
-);
+extern XLCd _XlcCurrentLC (void);
extern Bool _XlcValidModSyntax(
-#if NeedFunctionPrototypes
- char* /* mods */,
- char** /* valid */
-#endif
+ const char* mods,
+ const char* const * valid
);
extern char *_XlcDefaultMapModifiers(
-#if NeedFunctionPrototypes
- XLCd /* lcd */,
- char* /* user_mods */,
- char* /* prog_mods */
-#endif
+ XLCd lcd,
+ _Xconst char* user_mods,
+ _Xconst char* prog_mods
);
extern void _XIMCompileResourceList(
-#if NeedFunctionPrototypes
XIMResourceList /* res */,
unsigned int /* num_res */
-#endif
);
extern void _XCopyToArg(
-#if NeedFunctionPrototypes
XPointer /* src */,
XPointer* /* dst */,
unsigned int /* size */
-#endif
);
extern char ** _XParseBaseFontNameList(
-#if NeedFunctionPrototypes
char* /* str */,
int* /* num */
-#endif
);
extern XrmMethods _XrmInitParseInfo(
-#if NeedFunctionPrototypes
- XPointer* /* statep */
-#endif
+ XPointer* statep
);
extern void _XRegisterFilterByMask(
-#if NeedFunctionPrototypes
Display* /* dpy */,
Window /* window */,
unsigned long /* event_mask */,
Bool (*)(
-#if NeedNestedPrototypes
Display* /* display */,
Window /* window */,
XEvent* /* event */,
XPointer /* client_data */
-#endif
) /* filter */,
XPointer /* client_data */
-#endif
);
extern void _XRegisterFilterByType(
-#if NeedFunctionPrototypes
Display* /* dpy */,
Window /* window */,
int /* start_type */,
int /* end_type */,
Bool (*)(
-#if NeedNestedPrototypes
Display* /* display */,
Window /* window */,
XEvent* /* event */,
XPointer /* client_data */
-#endif
) /* filter */,
XPointer /* client_data */
-#endif
);
extern void _XUnregisterFilter(
-#if NeedFunctionPrototypes
Display* /* dpy */,
Window /* window */,
Bool (*)(
-#if NeedNestedPrototypes
Display* /* display */,
Window /* window */,
XEvent* /* event */,
XPointer /* client_data */
-#endif
) /* filter */,
XPointer /* client_data */
-#endif
);
extern void _XlcCountVaList(
-#if NeedFunctionPrototypes
- va_list /* var */,
- int* /* count_return */
-#endif
+ va_list var,
+ int* count_return
);
extern void _XlcVaToArgList(
-#if NeedFunctionPrototypes
- va_list /* var */,
- int /* count */,
- XlcArgList* /* args_return */
-#endif
+ va_list var,
+ int count,
+ XlcArgList* args_return
+);
+
+
+extern void _XlcCopyFromArg(
+ char * src,
+ char * dst,
+ int size
+);
+
+extern void _XlcCopyToArg(
+ char * src,
+ char ** dst,
+ int size
);
extern void _XlcCompileResourceList(
-#if NeedFunctionPrototypes
- XlcResourceList /* resources */,
- int /* num_resources */
-#endif
+ XlcResourceList resources,
+ int num_resources
);
extern char *_XlcGetValues(
-#if NeedFunctionPrototypes
- XPointer /* base */,
- XlcResourceList /* resources */,
- int /* num_resources */,
- XlcArgList /* args */,
- int /* num_args */,
- unsigned long /* mask */
-#endif
+ XPointer base,
+ XlcResourceList resources,
+ int num_resources,
+ XlcArgList args,
+ int num_args,
+ unsigned long mask
);
extern char *_XlcSetValues(
-#if NeedFunctionPrototypes
- XPointer /* base */,
- XlcResourceList /* resources */,
- int /* num_resources */,
- XlcArgList /* args */,
- int /* num_args */,
- unsigned long /* mask */
-#endif
+ XPointer base,
+ XlcResourceList resources,
+ int num_resources,
+ XlcArgList args,
+ int num_args,
+ unsigned long mask
);
+/* documented in i18n/Framework.PS */
+extern void _XlcInitLoader (void);
+
+extern void _XlcDeInitLoader (void);
+
+/* documented in i18n/Framework.PS */
+/* Returns True on success, False on failure. */
extern Bool _XlcAddLoader(
-#if NeedFunctionPrototypes
- XLCdLoadProc /* proc */,
- XlcPosition /* position */
-#endif
+ XLCdLoadProc proc,
+ XlcPosition position
);
+/* documented in i18n/Framework.PS */
extern void _XlcRemoveLoader(
-#if NeedFunctionPrototypes
- XLCdLoadProc /* proc */
-#endif
+ XLCdLoadProc proc
+);
+
+/* Registers UTF-8 converters for a non-UTF-8 locale. */
+extern void _XlcAddUtf8Converters(
+ XLCd lcd
+);
+
+/* Registers UTF-8 converters for a UTF-8 locale. */
+extern void _XlcAddUtf8LocaleConverters(
+ XLCd lcd
+);
+
+/* The default locale loader. Assumes an ASCII encoding. */
+extern XLCd _XlcDefaultLoader(
+ const char* name
+);
+
+/* The generic locale loader. Suitable for all encodings except UTF-8.
+ Uses an XLC_LOCALE configuration file. */
+extern XLCd _XlcGenericLoader(
+ const char* name
+);
+
+/* The UTF-8 locale loader. Suitable for UTF-8 encoding.
+ Uses an XLC_LOCALE configuration file. */
+extern XLCd _XlcUtf8Loader(
+ const char* name
+);
+
+/* The old EUC locale loader. */
+extern XLCd _XlcEucLoader(
+ const char* name
+);
+
+/* The old SJIS locale loader. */
+extern XLCd _XlcSjisLoader(
+ const char* name
+);
+
+/* The old ISO-2022-JP locale loader. */
+extern XLCd _XlcJisLoader(
+ const char* name
+);
+
+extern XLCd _XlcDynamicLoad(
+ const char* name
+);
+
+/* The old dynamic loader. */
+extern XLCd _XlcDynamicLoader(
+ const char* name
+);
+
+extern Bool _XInitDefaultIM(
+ XLCd lcd
+);
+
+extern Bool _XInitDefaultOM(
+ XLCd lcd
+);
+
+extern Bool _XInitDynamicIM(
+ XLCd lcd
+);
+
+extern Bool _XInitDynamicOM(
+ XLCd lcd
);
_XFUNCPROTOEND
+#endif /* !_XP_PRINT_SERVER_ */
+
#endif /* _XLCINT_H_ */
diff --git a/src/xlibi18n/imKStoUCS.c b/src/xlibi18n/imKStoUCS.c
index 693db4a9..3504a74e 100644
--- a/src/xlibi18n/imKStoUCS.c
+++ b/src/xlibi18n/imKStoUCS.c
@@ -1,6 +1,7 @@
-/* $XFree86: xc/lib/X11/imKStoUCS.c,v 1.2 2001/07/25 15:04:45 dawes Exp $ */
+/* $XFree86: xc/lib/X11/imKStoUCS.c,v 1.4 2003/04/29 11:29:18 pascal Exp $ */
#include "Xlibint.h"
+#include "Ximint.h"
static unsigned short const keysym_to_unicode_1a1_1ff[] = {
0x0104, 0x02d8, 0x0141, 0x0000, 0x013d, 0x015a, 0x0000, /* 0x01a0-0x01a7 */
@@ -233,8 +234,8 @@ static unsigned short keysym_to_unicode_15d0_15f6[] = {
static unsigned short keysym_to_unicode_16a0_16f6[] = {
0x0000, 0x0000, 0xf0a2, 0x1e8a, 0x0000, 0xf0a5, 0x012c, 0xf0a7, /* 0x16a0-0x16a7 */
0xf0a8, 0x01b5, 0x01e6, 0x0000, 0x0000, 0x0000, 0x0000, 0x019f, /* 0x16a8-0x16af */
- 0x0000, 0x017e, 0xf0b2, 0x1e8b, 0x01d1, 0xf0b5, 0x012d, 0xf0b7, /* 0x16b0-0x16b7 */
- 0xf0b8, 0x01b6, 0x01e7, 0x01d2, 0x0000, 0x0000, 0x0000, 0x0275, /* 0x16b8-0x16bf */
+ 0x0000, 0x0000, 0xf0b2, 0x1e8b, 0x01d1, 0xf0b5, 0x012d, 0xf0b7, /* 0x16b0-0x16b7 */
+ 0xf0b8, 0x01b6, 0x01e7, 0x0000, 0x0000, 0x01d2, 0x0000, 0x0275, /* 0x16b8-0x16bf */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x018f, 0x0000, /* 0x16c0-0x16c7 */
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16c8-0x16cf */
0x0000, 0x1e36, 0xf0d2, 0xf0d3, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16d0-0x16d7 */
@@ -266,12 +267,7 @@ static unsigned short const keysym_to_unicode_20a0_20ac[] = {
};
unsigned int
-#if NeedFunctionPrototypes
KeySymToUcs4(KeySym keysym)
-#else
-KeySymToUcs4(keysym)
- KeySym keysym;
-#endif
{
/* 'Unicode keysym' */
if ((keysym & 0xff000000) == 0x01000000)
@@ -316,7 +312,7 @@ KeySymToUcs4(keysym)
else if (keysym > 0x169f && keysym < 0x16f7)
return keysym_to_unicode_16a0_16f6[keysym - 0x16a0];
else if (keysym > 0x1e9e && keysym < 0x1f00)
- return keysym_to_unicode_1e9f_1eff[keysym - 0x1ea0];
+ return keysym_to_unicode_1e9f_1eff[keysym - 0x1e9f];
else if (keysym > 0x209f && keysym < 0x20ad)
return keysym_to_unicode_20a0_20ac[keysym - 0x20a0];
else
diff --git a/src/xlibi18n/lcCT.c b/src/xlibi18n/lcCT.c
index 5dd2ddcc..2afca02a 100644
--- a/src/xlibi18n/lcCT.c
+++ b/src/xlibi18n/lcCT.c
@@ -31,70 +31,109 @@
* Modifier: Takanori Tateno FUJITSU LIMITED
*
*/
+/*
+ * 2000
+ * Modifier: Ivan Pascal The XFree86 Project
+ * Modifier: Bruno Haible The XFree86 Project
+ */
+/* $XFree86: xc/lib/X11/lcCT.c,v 3.26 2001/10/28 03:32:34 tsi Exp $ */
#include "Xlibint.h"
#include "XlcPubI.h"
#include <X11/Xos.h>
#include <stdio.h>
-typedef struct _StateRec {
- XlcCharSet charset;
- XlcCharSet GL_charset;
- XlcCharSet GR_charset;
- XlcCharSet ext_seg_charset;
- int ext_seg_left;
-} StateRec, *State;
+/* ====================== Built-in Character Sets ====================== */
+
+/*
+ * Static representation of a character set that can be used in Compound Text.
+ */
typedef struct _CTDataRec {
- char *name;
- char *encoding; /* Compound Text encoding */
+ const char *name;
+ const char *ct_sequence; /* Compound Text encoding, ESC sequence */
} CTDataRec, *CTData;
-typedef struct _CTInfoRec {
- XlcCharSet charset;
- int encoding_len;
- char *encoding; /* Compound Text encoding */
- int ext_segment_len;
- char *ext_segment; /* extended segment */
- struct _CTInfoRec *next;
-} CTInfoRec, *CTInfo;
-
static CTDataRec default_ct_data[] =
{
- { "ISO8859-1:GL", "\033(B" },
- { "ISO8859-1:GR", "\033-A" },
- { "ISO8859-2:GR", "\033-B" },
- { "ISO8859-3:GR", "\033-C" },
- { "ISO8859-4:GR", "\033-D" },
- { "ISO8859-7:GR", "\033-F" },
- { "ISO8859-6:GR", "\033-G" },
- { "ISO8859-8:GR", "\033-H" },
- { "ISO8859-5:GR", "\033-L" },
- { "ISO8859-9:GR", "\033-M" },
- { "ISO8859-10:GR", "\033-V" },
- { "JISX0201.1976-0:GL", "\033(J" },
- { "JISX0201.1976-0:GR", "\033)I" },
-
- { "GB2312.1980-0:GL", "\033$(A" },
- { "GB2312.1980-0:GR", "\033$)A" },
- { "JISX0208.1983-0:GL", "\033$(B" },
- { "JISX0208.1983-0:GR", "\033$)B" },
- { "KSC5601.1987-0:GL", "\033$(C" },
- { "KSC5601.1987-0:GR", "\033$)C" },
-#ifdef notdef
- { "JISX0212.1990-0:GL", "\033$(D" },
- { "JISX0212.1990-0:GR", "\033$)D" },
- { "CNS11643.1986-1:GL", "\033$(G" },
- { "CNS11643.1986-1:GR", "\033$)G" },
- { "CNS11643.1986-2:GL", "\033$(H" },
- { "CNS11643.1986-2:GR", "\033$)H" },
+ /* */
+ /* X11 registry name MIME name ISO-IR ESC sequence */
+ /* */
+
+ /* Registered character sets with one byte per character */
+ { "ISO8859-1:GL", /* US-ASCII 6 */ "\033(B" },
+ { "ISO8859-1:GR", /* ISO-8859-1 100 */ "\033-A" },
+ { "ISO8859-2:GR", /* ISO-8859-2 101 */ "\033-B" },
+ { "ISO8859-3:GR", /* ISO-8859-3 109 */ "\033-C" },
+ { "ISO8859-4:GR", /* ISO-8859-4 110 */ "\033-D" },
+ { "ISO8859-5:GR", /* ISO-8859-5 144 */ "\033-L" },
+ { "ISO8859-6:GR", /* ISO-8859-6 127 */ "\033-G" },
+ { "ISO8859-7:GR", /* ISO-8859-7 126 */ "\033-F" },
+ { "ISO8859-8:GR", /* ISO-8859-8 138 */ "\033-H" },
+ { "ISO8859-9:GR", /* ISO-8859-9 148 */ "\033-M" },
+ { "ISO8859-10:GR", /* ISO-8859-10 157 */ "\033-V" },
+ { "ISO8859-11:GR", /* ISO-8859-11 166 */ "\033-T" },
+ { "ISO8859-13:GR", /* ISO-8859-13 179 */ "\033-Y" },
+ { "ISO8859-14:GR", /* ISO-8859-14 199 */ "\033-_" },
+ { "ISO8859-15:GR", /* ISO-8859-15 203 */ "\033-b" },
+ { "ISO8859-16:GR", /* ISO-8859-16 226 */ "\033-f" },
+ { "JISX0201.1976-0:GL", /* ISO-646-JP 14 */ "\033(J" },
+ { "JISX0201.1976-0:GR", "\033)I" },
+#if 0
+ { "TIS620-0:GR", /* TIS-620 166 */ "\033-T" },
+#endif
+
+ /* Registered character sets with two byte per character */
+ { "GB2312.1980-0:GL", /* GB_2312-80 58 */ "\033$(A" },
+ { "GB2312.1980-0:GR", /* GB_2312-80 58 */ "\033$)A" },
+ { "JISX0208.1983-0:GL", /* JIS_X0208-1983 87 */ "\033$(B" },
+ { "JISX0208.1983-0:GR", /* JIS_X0208-1983 87 */ "\033$)B" },
+ { "JISX0208.1990-0:GL", /* JIS_X0208-1990 168 */ "\033$(B" },
+ { "JISX0208.1990-0:GR", /* JIS_X0208-1990 168 */ "\033$)B" },
+ { "JISX0212.1990-0:GL", /* JIS_X0212-1990 159 */ "\033$(D" },
+ { "JISX0212.1990-0:GR", /* JIS_X0212-1990 159 */ "\033$)D" },
+ { "KSC5601.1987-0:GL", /* KS_C_5601-1987 149 */ "\033$(C" },
+ { "KSC5601.1987-0:GR", /* KS_C_5601-1987 149 */ "\033$)C" },
+ { "CNS11643.1986-1:GL", /* CNS 11643-1992 pl.1 171 */ "\033$(G" },
+ { "CNS11643.1986-1:GR", /* CNS 11643-1992 pl.1 171 */ "\033$)G" },
+ { "CNS11643.1986-2:GL", /* CNS 11643-1992 pl.2 172 */ "\033$(H" },
+ { "CNS11643.1986-2:GR", /* CNS 11643-1992 pl.2 172 */ "\033$)H" },
+ { "CNS11643.1992-3:GL", /* CNS 11643-1992 pl.3 183 */ "\033$(I" },
+ { "CNS11643.1992-3:GR", /* CNS 11643-1992 pl.3 183 */ "\033$)I" },
+ { "CNS11643.1992-4:GL", /* CNS 11643-1992 pl.4 184 */ "\033$(J" },
+ { "CNS11643.1992-4:GR", /* CNS 11643-1992 pl.4 184 */ "\033$)J" },
+ { "CNS11643.1992-5:GL", /* CNS 11643-1992 pl.5 185 */ "\033$(K" },
+ { "CNS11643.1992-5:GR", /* CNS 11643-1992 pl.5 185 */ "\033$)K" },
+ { "CNS11643.1992-6:GL", /* CNS 11643-1992 pl.6 186 */ "\033$(L" },
+ { "CNS11643.1992-6:GR", /* CNS 11643-1992 pl.6 186 */ "\033$)L" },
+ { "CNS11643.1992-7:GL", /* CNS 11643-1992 pl.7 187 */ "\033$(M" },
+ { "CNS11643.1992-7:GR", /* CNS 11643-1992 pl.7 187 */ "\033$)M" },
+
+ /* Registered encodings with a varying number of bytes per character */
+ { "ISO10646-1", /* UTF-8 196 */ "\033%G" },
+
+ /* Encodings without ISO-IR assigned escape sequence must be
+ defined in XLC_LOCALE files, using "\033%/1" or "\033%/2". */
+
+ /* Backward compatibility with XFree86 3.x */
+#if 1
+ { "ISO8859-14:GR", "\033%/1" },
+ { "ISO8859-15:GR", "\033%/1" },
#endif
- { "TIS620.2533-1:GR", "\033-T"},
- { "ISO10646-1", "\033%B"},
- /* Non-Standard Character Set Encodings */
- { "KOI8-R:GR", "\033%/1\200\210koi8-r\002"},
- { "FCD8859-15:GR", "\033%/1\200\213fcd8859-15\002"},
-} ;
+ /* For use by utf8 -> ctext */
+ { "BIG5-0:GLGR", "\033%/2"},
+ /* used by Emacs, but not backed by ISO-IR */
+ { "BIG5-E0:GL", "\033$(0" },
+ { "BIG5-E0:GR", "\033$)0" },
+ { "BIG5-E1:GL", "\033$(1" },
+ { "BIG5-E1:GR", "\033$)1" },
+
+};
+
+/* We represent UTF-8 as an XlcGLGR charset, not in extended segments. */
+#define UTF8_IN_EXTSEQ 0
+
+/* ======================= Parsing ESC Sequences ======================= */
#define XctC0 0x0000
#define XctHT 0x0009
@@ -104,6 +143,7 @@ static CTDataRec default_ct_data[] =
#define XctC1 0x0080
#define XctCSI 0x009b
#define XctGR 0x00a0
+#define XctSTX 0x0002
#define XctCntrlFunc 0x0023
#define XctMB 0x0024
@@ -122,268 +162,282 @@ static CTDataRec default_ct_data[] =
#define XctGL94MB 0x2428
#define XctGR94MB 0x2429
#define XctExtSeg 0x252f
-#define XctOtherSeg 0x2f00
-
-#define XctESCSeq 0x1b00
-#define XctCSISeq 0x9b00
-
-#define SKIP_I(str) while (*(str) >= 0x20 && *(str) <= 0x2f) (str)++;
-#define SKIP_P(str) while (*(str) >= 0x30 && *(str) <= 0x3f) (str)++;
-
-typedef struct {
- XlcSide side;
- int char_size;
- int set_size;
- int ext_seg_length;
- int version;
- CTInfo ct_info;
-} CTParseRec, *CTParse;
-
-CTDataRec *default_ct_data_list()
-{
- return(default_ct_data);
-}
-
-size_t default_ct_data_list_num()
-{
- size_t num = sizeof(default_ct_data) / sizeof(CTDataRec);
- return(num);
-}
-
-static CTInfo ct_list = NULL;
-
-static CTInfo
-_XlcGetCTInfoFromEncoding(encoding, length)
- register char *encoding;
- register int length;
-{
- register CTInfo ct_info;
-
- for (ct_info = ct_list; ct_info; ct_info = ct_info->next) {
- if (length >= ct_info->encoding_len) {
- if (ct_info->ext_segment) {
- if (!strncmp(ct_info->encoding, encoding, 4) &&
- !strncmp(ct_info->ext_segment, encoding + 6,
- ct_info->ext_segment_len))
- return ct_info;
- } else if (!strncmp(ct_info->encoding, encoding,
- ct_info->encoding_len)) {
- return ct_info;
- }
- }
- }
-
- return (CTInfo) NULL;
-}
+#define XctReturn 0x2540
+/*
+ * Parses the header of a Compound Text segment, i.e. the charset designator.
+ * The string starts at *text and has *length bytes.
+ * Return value is one of:
+ * 0 (no valid charset designator),
+ * XctGL94, XctGR94, XctGR96, XctGL94MB, XctGR94MB,
+ * XctLeftToRight, XctRightToLeft, XctDirectionEnd,
+ * XctExtSeg, XctOtherCoding, XctReturn, XctIgnoreExt, XctNotIgnoreExt.
+ * If the return value is not 0, *text is incremented and *length decremented,
+ * to point past the charset designator. If the return value is one of
+ * XctGL94, XctGR94, XctGR96, XctGL94MB, XctGR94MB,
+ * XctExtSeg, XctOtherCoding, XctIgnoreExt, XctNotIgnoreExt,
+ * *final_byte is set to the "final byte" of the charset designator.
+ */
static unsigned int
-_XlcParseCT(parse, text, length)
- register CTParse parse;
- char **text;
- int *length;
+_XlcParseCT(
+ const char **text,
+ int *length,
+ unsigned char *final_byte)
{
unsigned int ret = 0;
unsigned char ch;
- register unsigned char *str = (unsigned char *) *text;
+ const unsigned char *str = (const unsigned char *) *text;
- bzero((char *) parse, sizeof(CTParseRec));
+ *final_byte = 0;
+ if (*length < 1)
+ return 0;
switch (ch = *str++) {
- case XctESC:
- if (*str == XctOtherCoding && *(str + 1) == XctNonStandard
- && *(str + 2) >= 0x30 && *(str + 2) <= 0x3f && *length >= 6) {
-
- /* non-standard encodings */
- parse->side = XlcGLGR;
- parse->set_size = 0;
- str += 2;
- if (*str <= 0x34) {
- parse->char_size = *str - 0x30;
- if (parse->char_size == 0) parse->char_size = 1;
- ret = XctExtSeg;
- parse->ct_info = _XlcGetCTInfoFromEncoding(*text, *length);
- } else
- ret = XctOtherSeg;
- str++;
- parse->ext_seg_length = (*str - 128) * 128 + *(str + 1) - 128;
- str += 2;
-
- goto done;
- } else if (*str == XctCntrlFunc && *length >= 4 &&
- *(str + 1) >= 0x20 && *(str + 1) <= 0x2f &&
- (*(str + 2) == XctIgnoreExt ||
- *(str + 2) == XctNotIgnoreExt)) {
-
- /* ignore extension or not */
- str++;
- parse->version = *str++ - 0x20;
- ret = *str++;
-
- goto done;
- }
-
- if (*str == XctMB) { /* multiple-byte sets */
- parse->char_size = 2;
- str++;
- } else
- parse->char_size = 1;
-
- switch (*str) {
- case XctGL94:
- parse->side = XlcGL;
- parse->set_size = 94;
- ret = (parse->char_size == 1) ? XctGL94 : XctGL94MB;
- break;
- case XctGR94:
- parse->side = XlcGR;
- parse->set_size = 94;
- ret = (parse->char_size == 1) ? XctGR94 : XctGR94MB;
- break;
- case XctGR96:
- if (parse->char_size == 1) {
- parse->side = XlcGR;
- parse->set_size = 96;
- ret = XctGR96;
- }
- break;
- }
- if (ret) {
- str++;
- if (*str >= 0x24 && *str <= 0x2f) { /* non-standard */
- ret = 0;
- str++;
- }
- }
-
- SKIP_I(str)
-
- if (ret && *str < 0x40) /* non-standard */
- ret = 0;
-
- if (*str < 0x30 || *str > 0x7e || (char *) str - *text >= *length)
- break;
-
- if (ret == 0)
- ret = XctESCSeq;
- else {
- if (parse->char_size == 2) {
- if (*str >= 0x70)
- parse->char_size = 4;
- else if (*str >= 0x60)
- parse->char_size = 3;
- }
- parse->ct_info = _XlcGetCTInfoFromEncoding(*text, *length);
- }
- str++;
- goto done;
- case XctCSI:
+ case XctESC:
+ if (*length < 2)
+ return 0;
+ switch (ch = *str++) {
+ case XctOtherCoding: /* % */
+ if (*length < 3)
+ return 0;
+ ch = *str++;
+ if (ch == XctNonStandard) { /* / */
+ if (*length < 4)
+ return 0;
+ ret = XctExtSeg;
+ ch = *str++;
+ } else if (ch == '@') {
+ ret = XctReturn;
+ } else {
+ ret = XctOtherCoding;
+ }
+ *final_byte = ch;
+ break;
+
+ case XctCntrlFunc: /* # */
+ if (*length < 4)
+ return 0;
+ *final_byte = *str++;
+ switch (*str++) {
+ case XctIgnoreExt: /* 0 */
+ ret = XctIgnoreExt;
+ break;
+ case XctNotIgnoreExt: /* 1 */
+ ret = XctNotIgnoreExt;
+ break;
+ default:
+ ret = 0;
+ break;
+ }
+ break;
+
+ case XctMB: /* $ */
+ if (*length < 4)
+ return 0;
+ ch = *str++;
+ switch (ch) {
+ case XctGL94: /* ( */
+ ret = XctGL94MB;
+ break;
+ case XctGR94: /* ) */
+ ret = XctGR94MB;
+ break;
+ default:
+ ret = 0;
+ break;
+ }
+ *final_byte = *str++;
+ break;
+
+ case XctGL94: /* ( */
+ if (*length < 3)
+ return 0;
+ ret = XctGL94;
+ *final_byte = *str++;
+ break;
+ case XctGR94: /* ) */
+ if (*length < 3)
+ return 0;
+ ret = XctGR94;
+ *final_byte = *str++;
+ break;
+ case XctGR96: /* - */
+ if (*length < 3)
+ return 0;
+ ret = XctGR96;
+ *final_byte = *str++;
+ break;
+ }
+ break;
+ case XctCSI:
/* direction */
- if (*str == XctLeftToRight && *(str + 1) == XctDirection) {
- ret = XctLeftToRight;
- str += 2;
- goto done;
- } else if (*str == XctRightToLeft && *(str + 1) == XctDirection) {
- ret = XctRightToLeft;
- str += 2;
- goto done;
- } else if (*str == XctDirectionEnd) {
- ret = XctDirectionEnd;
- str++;
- goto done;
- }
+ if (*length < 2)
+ return 0;
+ switch (*str++) {
+ case XctLeftToRight:
+ if (*length < 3)
+ return 0;
+ if (*str++ == XctDirection)
+ ret = XctLeftToRight;
+ break;
+ case XctRightToLeft:
+ if (*length < 3)
+ return 0;
+ if (*str++ == XctDirection)
+ ret = XctRightToLeft;
+ break;
+ case XctDirectionEnd:
+ ret = XctDirectionEnd;
+ break;
+ }
+ break;
+ }
+
+ if (ret) {
+ *length -= (const char *) str - *text;
+ *text = (const char *) str;
+ }
+ return ret;
+}
- SKIP_P(str)
- SKIP_I(str)
+/*
+ * Fills into a freshly created XlcCharSet the fields that can be inferred
+ * from the ESC sequence. These are side, char_size, set_size.
+ * Returns True if the charset can be used with Compound Text.
+ *
+ * Used by _XlcCreateDefaultCharSet.
+ */
+Bool
+_XlcParseCharSet(
+ XlcCharSet charset)
+{
+ unsigned int type;
+ unsigned char final_byte;
+ const char *ptr = charset->ct_sequence;
+ int length;
+ int char_size;
+
+ if (*ptr == '\0')
+ return False;
- if (*str < 0x40 && *str > 0x7e)
- break;
+ length = strlen(ptr);
- ret = XctCSISeq;
- str++;
- goto done;
+ type = _XlcParseCT(&ptr, &length, &final_byte);
+
+ /* Check for validity and determine char_size.
+ char_size = 0 means varying number of bytes per character. */
+ switch (type) {
+ case XctGL94:
+ case XctGR94:
+ case XctGR96:
+ char_size = 1;
+ break;
+ case XctGL94MB:
+ case XctGR94MB:
+ char_size = (final_byte < 0x60 ? 2 : final_byte < 0x70 ? 3 : 4);
+ break;
+ case XctExtSeg:
+ char_size = final_byte - '0';
+ if (!(char_size >= 0 && char_size <= 4))
+ return False;
+ break;
+ case XctOtherCoding:
+ char_size = 0;
+ break;
+ default:
+ return False;
}
- if (ch & 0x80) {
- if (ch < 0xa0)
- ret = XctC1;
- else
- ret = XctGR;
- } else {
- if (ch == XctHT || ch == XctNL)
- ret = ch;
- else if (ch < 0x20)
- ret = XctC0;
- else
- ret = XctGL;
+ charset->char_size = char_size;
+
+ /* Fill in other values. */
+ switch (type) {
+ case XctGL94:
+ case XctGL94MB:
+ charset->side = XlcGL;
+ charset->set_size = 94;
+ break;
+ case XctGR94:
+ case XctGR94MB:
+ charset->side = XlcGR;
+ charset->set_size = 94;
+ break;
+ case XctGR96:
+ charset->side = XlcGR;
+ charset->set_size = 96;
+ break;
+ case XctExtSeg:
+ case XctOtherCoding:
+ charset->side = XlcGLGR;
+ charset->set_size = 0;
+ break;
}
+ return True;
+}
- return ret;
-
-done:
- *length -= (char *) str - *text;
- *text = (char *) str;
- return ret;
-}
+/* =============== Management of the List of Character Sets =============== */
-XlcCharSet
-_XlcAddCT(name, encoding)
- char *name;
- char *encoding;
-{
- CTInfo ct_info;
+/*
+ * Representation of a character set that can be used for Compound Text,
+ * at run time.
+ * Note: This information is not contained in the XlcCharSet, because
+ * multiple ESC sequences may be used for the same XlcCharSet.
+ */
+typedef struct _CTInfoRec {
XlcCharSet charset;
- CTParseRec parse;
- char *ct_ptr = encoding;
- int length;
+ const char *ct_sequence; /* Compound Text ESC sequence */
unsigned int type;
+ unsigned char final_byte;
+ /* If type == XctExtSeg: */
+ const char *ext_segment; /* extended segment name, then '\002' */
+ int ext_segment_len; /* length of above, including final '\002' */
- length = strlen(encoding);
+ struct _CTInfoRec *next;
+} CTInfoRec, *CTInfo;
- switch (type = _XlcParseCT(&parse, &ct_ptr, &length)) {
- case XctExtSeg:
- case XctGL94:
- case XctGL94MB:
- case XctGR94:
- case XctGR94MB:
- case XctGR96:
- if (parse.ct_info) /* existed */
- return parse.ct_info->charset;
- break;
- default:
- return (XlcCharSet) NULL;
- }
+/*
+ * List of character sets that can be used for Compound Text,
+ * Includes all that are listed in default_ct_data, but more can be added
+ * at runtime through _XlcAddCT.
+ */
+static CTInfo ct_list = NULL;
+static CTInfo ct_list_end = NULL;
- charset = _XlcCreateDefaultCharSet(name, encoding);
- if (charset == NULL)
- return (XlcCharSet) NULL;
- _XlcAddCharSet(charset);
+/*
+ * Returns a Compound Text info record for an ESC sequence.
+ * The first part of the ESC sequence has already been parsed into 'type'
+ * and 'final_byte'. The remainder starts at 'text', at least 'text_len'
+ * bytes (only used if type == XctExtSeg).
+ */
+static CTInfo
+_XlcGetCTInfo(
+ unsigned int type,
+ unsigned char final_byte,
+ const char *text,
+ int text_len)
+{
+ CTInfo ct_info;
- ct_info = (CTInfo) Xmalloc(sizeof(CTInfoRec));
- if (ct_info == NULL)
- return (XlcCharSet) NULL;
-
- ct_info->charset = charset;
- ct_info->encoding = charset->ct_sequence;
- ct_info->encoding_len = strlen(ct_info->encoding);
- if (type == XctExtSeg) {
- ct_info->ext_segment = ct_info->encoding + 6;
- ct_info->ext_segment_len = strlen(ct_info->ext_segment);
- } else {
- ct_info->ext_segment = NULL;
- ct_info->ext_segment_len = 0;
- }
- ct_info->next = ct_list;
- ct_list = ct_info;
+ for (ct_info = ct_list; ct_info; ct_info = ct_info->next)
+ if (ct_info->type == type
+ && ct_info->final_byte == final_byte
+ && (type != XctExtSeg
+ || (text_len >= ct_info->ext_segment_len
+ && memcmp(text, ct_info->ext_segment,
+ ct_info->ext_segment_len) == 0)))
+ return ct_info;
- return charset;
+ return (CTInfo) NULL;
}
+/* Returns the Compound Text info for a given XlcCharSet.
+ Returns NULL if none is found. */
static CTInfo
-_XlcGetCTInfoFromCharSet(charset)
- register XlcCharSet charset;
+_XlcGetCTInfoFromCharSet(
+ XlcCharSet charset)
{
- register CTInfo ct_info;
+ CTInfo ct_info;
for (ct_info = ct_list; ct_info; ct_info = ct_info->next)
if (ct_info->charset == charset)
@@ -392,244 +446,449 @@ _XlcGetCTInfoFromCharSet(charset)
return (CTInfo) NULL;
}
-Bool
-_XlcParseCharSet(charset)
- XlcCharSet charset;
+/* Creates a new XlcCharSet, given its name (including side suffix) and
+ Compound Text ESC sequence (normally at most 4 bytes), and makes it
+ eligible for Compound Text processing. */
+XlcCharSet
+_XlcAddCT(
+ const char *name,
+ const char *ct_sequence)
{
- CTParseRec parse;
- char *ptr, *bufp, buf[BUFSIZ];
+ CTInfo ct_info, existing_info;
+ XlcCharSet charset;
+ const char *ct_ptr;
int length;
+ unsigned int type;
+ unsigned char final_byte;
- if (charset->ct_sequence == NULL)
- return False;
-
- ptr = charset->ct_sequence;
- length = strlen(ptr);
-
- (void) _XlcParseCT(&parse, &ptr, &length);
-
- if (charset->name) {
- charset->xrm_name = XrmStringToQuark(charset->name);
-
- if ((length = strlen (charset->name)) < sizeof buf) bufp = buf;
- else bufp = Xmalloc (length + 1);
-
- if (bufp == NULL) return False;
- strcpy(bufp, charset->name);
- if ((ptr = strchr(bufp, ':')))
- *ptr = '\0';
- charset->xrm_encoding_name = XrmStringToQuark(bufp);
- if (bufp != buf) Xfree (bufp);
- charset->encoding_name = XrmQuarkToString(charset->xrm_encoding_name);
+ charset = _XlcGetCharSet(name);
+ if (charset != NULL) {
+ /* Even if the charset already exists, it is OK to register a second
+ Compound Text sequence for it. */
} else {
- charset->xrm_name = 0;
- charset->encoding_name = NULL;
- charset->xrm_encoding_name = 0;
+ /* Attempt to create the charset. */
+ charset = _XlcCreateDefaultCharSet(name, ct_sequence);
+ if (charset == NULL)
+ return (XlcCharSet) NULL;
+ _XlcAddCharSet(charset);
}
- charset->side = parse.side;
- charset->char_size = parse.char_size;
- charset->set_size = parse.set_size;
+ /* Allocate a CTinfo record. */
+ length = strlen(ct_sequence);
+ ct_info = (CTInfo) Xmalloc(sizeof(CTInfoRec) + length+1);
+ if (ct_info == NULL)
+ return charset;
- return True;
-}
+ ct_info->charset = charset;
+ ct_info->ct_sequence = strcpy((char *) (ct_info + 1), ct_sequence);
-static void init_converter();
+ /* Parse the Compound Text sequence. */
+ ct_ptr = ct_sequence;
+ type = _XlcParseCT(&ct_ptr, &length, &final_byte);
-Bool
-_XlcInitCTInfo()
-{
- register XlcCharSet charset;
- register CTData ct_data;
- register int num;
+ ct_info->type = type;
+ ct_info->final_byte = final_byte;
- if (ct_list == NULL) {
- num = sizeof(default_ct_data) / sizeof(CTDataRec);
- for (ct_data = default_ct_data; num-- > 0; ct_data++) {
- charset = _XlcAddCT(ct_data->name, ct_data->encoding);
- if (charset == NULL)
- continue;
- }
- init_converter();
+ switch (type) {
+ case XctGL94:
+ case XctGR94:
+ case XctGR96:
+ case XctGL94MB:
+ case XctGR94MB:
+ case XctOtherCoding:
+ ct_info->ext_segment = NULL;
+ ct_info->ext_segment_len = 0;
+ break;
+ case XctExtSeg: {
+ /* By convention, the extended segment name is the encoding_name
+ in lowercase. */
+ const char *q = charset->encoding_name;
+ int n = strlen(q);
+ char *p;
+
+ /* Ensure ct_info->ext_segment_len <= 0x3fff - 6. */
+ if (n > 0x3fff - 6 - 1) {
+ Xfree(ct_info);
+ return charset;
+ }
+ p = (char *) Xmalloc(n+1);
+ if (p == NULL) {
+ Xfree(ct_info);
+ return charset;
+ }
+ ct_info->ext_segment = p;
+ ct_info->ext_segment_len = n+1;
+ for ( ; n > 0; p++, q++, n--)
+ *p = (*q >= 'A' && *q <= 'Z' ? *q - 'A' + 'a' : *q);
+ *p = XctSTX;
+ break;
+ }
+ default:
+ Xfree(ct_info);
+ return (XlcCharSet) NULL;
}
- return True;
+ /* Insert it into the list, if not already present. */
+ existing_info =
+ _XlcGetCTInfo(type, ct_info->final_byte,
+ ct_info->ext_segment, ct_info->ext_segment_len);
+ if (existing_info == NULL) {
+ /* Insert it at the end. If there are duplicates CTinfo entries
+ for the same XlcCharSet, we want the first (standard) one to
+ override the second (user defined) one. */
+ ct_info->next = NULL;
+ if (ct_list_end)
+ ct_list_end->next = ct_info;
+ else
+ ct_list = ct_info;
+ ct_list_end = ct_info;
+ } else {
+ if (existing_info->charset != charset
+ /* We have a conflict, with one exception: JISX0208.1983-0 and
+ JISX0208.1990-0 are the same for all practical purposes. */
+ && !(strncmp(existing_info->charset->name, "JISX0208", 8) == 0
+ && strncmp(charset->name, "JISX0208", 8) == 0)) {
+ fprintf(stderr,
+ "Xlib: charsets %s and %s have the same CT sequence\n",
+ charset->name, existing_info->charset->name);
+ if (strcmp(charset->ct_sequence, ct_sequence) == 0)
+ charset->ct_sequence = "";
+ }
+ Xfree(ct_info);
+ }
+
+ return charset;
}
-static int
-_XlcCheckCTSequence(state, ctext, ctext_len)
- State state;
- char **ctext;
- int *ctext_len;
+/* ========== Converters String <--> CharSet <--> Compound Text ========== */
+
+/*
+ * Structure representing the parse state of a Compound Text string.
+ */
+typedef struct _StateRec {
+ XlcCharSet charset; /* The charset of the current segment */
+ XlcCharSet GL_charset; /* The charset responsible for 0x00..0x7F */
+ XlcCharSet GR_charset; /* The charset responsible for 0x80..0xFF */
+ XlcCharSet Other_charset; /* != NULL if currently in an other segment */
+ int ext_seg_left; /* > 0 if currently in an extended segment */
+} StateRec, *State;
+
+
+/* Subroutine for parsing an ESC sequence. */
+
+typedef enum {
+ resOK, /* Charset saved in 'state', sequence skipped */
+ resNotInList, /* Charset not found, sequence skipped */
+ resNotCTSeq /* EscSeq not recognized, pointers not changed */
+} CheckResult;
+
+static CheckResult
+_XlcCheckCTSequence(
+ State state,
+ const char **ctext,
+ int *ctext_len)
{
XlcCharSet charset;
- CTParseRec parse;
CTInfo ct_info;
- int length;
+ const char *tmp_ctext = *ctext;
+ int tmp_ctext_len = *ctext_len;
+ unsigned int type;
+ unsigned char final_byte;
+ int ext_seg_left = 0;
- _XlcParseCT(&parse, ctext, ctext_len);
-
- ct_info = parse.ct_info;
- if (parse.ext_seg_length > 0) { /* XctExtSeg or XctOtherSeg */
- if (ct_info) {
- length = ct_info->ext_segment_len;
- *ctext += length;
- *ctext_len -= length;
- state->ext_seg_left = parse.ext_seg_length - length;
- state->ext_seg_charset = ct_info->charset;
- } else {
- state->ext_seg_left = parse.ext_seg_length;
- state->ext_seg_charset = NULL;
- }
- } else if (ct_info) {
- if ((charset = ct_info->charset)) {
- if (charset->side == XlcGL)
- state->GL_charset = charset;
- else if (charset->side == XlcGR)
- state->GR_charset = charset;
- }
+ /* Check for validity. */
+ type = _XlcParseCT(&tmp_ctext, &tmp_ctext_len, &final_byte);
+
+ switch (type) {
+ case XctGL94:
+ case XctGR94:
+ case XctGR96:
+ case XctGL94MB:
+ case XctGR94MB:
+ case XctOtherCoding:
+ *ctext = tmp_ctext;
+ *ctext_len = tmp_ctext_len;
+ break;
+ case XctReturn:
+ *ctext = tmp_ctext;
+ *ctext_len = tmp_ctext_len;
+ state->Other_charset = NULL;
+ return resOK;
+ case XctExtSeg:
+ if (tmp_ctext_len > 2
+ && (tmp_ctext[0] & 0x80) && (tmp_ctext[0] & 0x80)) {
+ unsigned int msb = tmp_ctext[0] & 0x7f;
+ unsigned int lsb = tmp_ctext[1] & 0x7f;
+ ext_seg_left = (msb << 7) + lsb;
+ if (ext_seg_left <= tmp_ctext_len - 2) {
+ *ctext = tmp_ctext + 2;
+ *ctext_len = tmp_ctext_len - 2;
+ break;
+ }
+ }
+ return resNotCTSeq;
+ default:
+ return resNotCTSeq;
}
- return 0;
+ ct_info = _XlcGetCTInfo(type, final_byte, *ctext, ext_seg_left);
+
+ if (ct_info) {
+ charset = ct_info->charset;
+ state->ext_seg_left = ext_seg_left;
+ if (type == XctExtSeg) {
+ state->charset = charset;
+ /* Skip past the extended segment name and the separator. */
+ *ctext += ct_info->ext_segment_len;
+ *ctext_len -= ct_info->ext_segment_len;
+ state->ext_seg_left -= ct_info->ext_segment_len;
+ } else if (type == XctOtherCoding) {
+ state->Other_charset = charset;
+ } else {
+ if (charset->side == XlcGL) {
+ state->GL_charset = charset;
+ } else if (charset->side == XlcGR) {
+ state->GR_charset = charset;
+ } else {
+ state->GL_charset = charset;
+ state->GR_charset = charset;
+ }
+ }
+ return resOK;
+ } else {
+ state->ext_seg_left = 0;
+ if (type == XctExtSeg) {
+ /* Skip the entire extended segment. */
+ *ctext += ext_seg_left;
+ *ctext_len -= ext_seg_left;
+ }
+ return resNotInList;
+ }
}
-
static void
-init_state(conv)
- XlcConv conv;
+init_state(
+ XlcConv conv)
{
State state = (State) conv->state;
- static XlcCharSet GL_charset = NULL;
- static XlcCharSet GR_charset = NULL;
+ static XlcCharSet default_GL_charset = NULL;
+ static XlcCharSet default_GR_charset = NULL;
- if (GL_charset == NULL) {
- GL_charset = _XlcGetCharSet("ISO8859-1:GL");
- GR_charset = _XlcGetCharSet("ISO8859-1:GR");
+ if (default_GL_charset == NULL) {
+ default_GL_charset = _XlcGetCharSet("ISO8859-1:GL");
+ default_GR_charset = _XlcGetCharSet("ISO8859-1:GR");
}
- state->GL_charset = state->charset = GL_charset;
- state->GR_charset = GR_charset;
- state->ext_seg_charset = NULL;
+ /* The initial state is ISO-8859-1 on both sides. */
+ state->GL_charset = state->charset = default_GL_charset;
+ state->GR_charset = default_GR_charset;
+
+ state->Other_charset = NULL;
+
state->ext_seg_left = 0;
}
+/* from XlcNCompoundText to XlcNCharSet */
+
static int
-cttocs(conv, from, from_left, to, to_left, args, num_args)
- XlcConv conv;
- XPointer *from;
- int *from_left;
- XPointer *to;
- int *to_left;
- XPointer *args;
- int num_args;
+cttocs(
+ XlcConv conv,
+ XPointer *from,
+ int *from_left,
+ XPointer *to,
+ int *to_left,
+ XPointer *args,
+ int num_args)
{
- register State state = (State) conv->state;
- register unsigned char ch;
- int length;
+ State state = (State) conv->state;
XlcCharSet charset = NULL;
- char *ctptr, *bufptr;
+ const char *ctptr;
+ char *bufptr;
int ctext_len, buf_len;
+ int unconv_num = 0;
- ctptr = *((char **) from);
- bufptr = *((char **) to);
+ ctptr = (const char *) *from;
+ bufptr = (char *) *to;
ctext_len = *from_left;
buf_len = *to_left;
while (ctext_len > 0 && buf_len > 0) {
- if (state->ext_seg_left > 0) {
- length = min(state->ext_seg_left, ctext_len);
- length = min(length, buf_len);
-
- ctext_len -= length;
- state->ext_seg_left -= length;
-
- if (state->ext_seg_charset) {
- charset = state->ext_seg_charset;
- buf_len -= length;
- if (charset->side == XlcGL) {
- while (length-- > 0)
- *bufptr++ = *ctptr++ & 0x7f;
- } else if (charset->side == XlcGR) {
- while (length-- > 0)
- *bufptr++ = *ctptr++ | 0x80;
- } else {
- while (length-- > 0)
- *bufptr++ = *ctptr++;
- }
-
- if (state->ext_seg_left < 1)
- state->ext_seg_charset = NULL;
- }
- break;
- }
- ch = *((unsigned char *) ctptr);
- if (ch == 0x1b || ch == 0x9b) {
- length = _XlcCheckCTSequence(state, &ctptr, &ctext_len);
- if (length < 0)
- return -1;
- if (state->ext_seg_left > 0 && charset)
- break;
- } else {
- if (charset) {
- if (charset != (ch & 0x80 ? state->GR_charset :
- state->GL_charset))
- break;
- } else
- charset = ch & 0x80 ? state->GR_charset : state->GL_charset;
-
- if ((ch < 0x20 && ch != '\0' && ch != '\n' && ch != '\t') ||
- (ch >= 0x80 && ch < 0xa0))
- return -1;
-
- *bufptr++ = *ctptr++;
- ctext_len--;
- buf_len--;
- }
+ if (state->ext_seg_left == 0) {
+ /* Not in the middle of an extended segment; look at next byte. */
+ unsigned char ch = *ctptr;
+ XlcCharSet ch_charset;
+
+ if (ch == XctESC) {
+ CheckResult ret =
+ _XlcCheckCTSequence(state, &ctptr, &ctext_len);
+ if (ret == resOK)
+ /* state has been modified. */
+ continue;
+ if (ret == resNotInList) {
+ /* XXX Just continue with previous charset. */
+ unconv_num++;
+ continue;
+ }
+ } else if (ch == XctCSI) {
+ /* XXX Simply ignore the XctLeftToRight, XctRightToLeft,
+ XctDirectionEnd sequences for the moment. */
+ unsigned char dummy;
+ if (_XlcParseCT(&ctptr, &ctext_len, &dummy)) {
+ unconv_num++;
+ continue;
+ }
+ }
+
+ /* Find the charset which is responsible for this byte. */
+ ch_charset = (state->Other_charset != NULL ? state->Other_charset :
+ (ch & 0x80 ? state->GR_charset : state->GL_charset));
+
+ /* Set the charset of this run, or continue the current run,
+ or stop the current run. */
+ if (charset) {
+ if (charset != ch_charset)
+ break;
+ } else {
+ state->charset = charset = ch_charset;
+ }
+
+ /* We don't want to split a character into multiple pieces. */
+ if (buf_len < 6) {
+ if (charset->char_size > 0) {
+ if (buf_len < charset->char_size)
+ break;
+ } else {
+ /* char_size == 0 is tricky. The code here is good only
+ for valid UTF-8 input. */
+ if (charset->ct_sequence[0] == XctESC
+ && charset->ct_sequence[1] == XctOtherCoding
+ && charset->ct_sequence[2] == 'G') {
+ int char_size = (ch < 0xc0 ? 1 :
+ ch < 0xe0 ? 2 :
+ ch < 0xf0 ? 3 :
+ ch < 0xf8 ? 4 :
+ ch < 0xfc ? 5 :
+ 6);
+ if (buf_len < char_size)
+ break;
+ }
+ }
+ }
+
+ *bufptr++ = *ctptr++;
+ ctext_len--;
+ buf_len--;
+ } else {
+ /* Copy as much as possible from the current extended segment
+ to the buffer. */
+ int char_size;
+
+ /* Set the charset of this run, or continue the current run,
+ or stop the current run. */
+ if (charset) {
+ if (charset != state->charset)
+ break;
+ } else {
+ charset = state->charset;
+ }
+
+ char_size = charset->char_size;
+
+ if (state->ext_seg_left <= buf_len || char_size > 0) {
+ int n = (state->ext_seg_left <= buf_len
+ ? state->ext_seg_left
+ : (buf_len / char_size) * char_size);
+ memcpy(bufptr, ctptr, n);
+ ctptr += n; ctext_len -= n;
+ bufptr += n; buf_len -= n;
+ state->ext_seg_left -= n;
+ } else {
+#if UTF8_IN_EXTSEQ
+ /* char_size == 0 is tricky. The code here is good only
+ for valid UTF-8 input. */
+ if (strcmp(charset->name, "ISO10646-1") == 0) {
+ unsigned char ch = *ctptr;
+ int char_size = (ch < 0xc0 ? 1 :
+ ch < 0xe0 ? 2 :
+ ch < 0xf0 ? 3 :
+ ch < 0xf8 ? 4 :
+ ch < 0xfc ? 5 :
+ 6);
+ int i;
+ if (buf_len < char_size)
+ break;
+ /* A small loop is faster than calling memcpy. */
+ for (i = char_size; i > 0; i--)
+ *bufptr++ = *ctptr++;
+ ctext_len -= char_size;
+ buf_len -= char_size;
+ state->ext_seg_left -= char_size;
+ } else
+#endif
+ {
+ /* Here ctext_len >= state->ext_seg_left > buf_len.
+ We may be splitting a character into multiple pieces.
+ Oh well. */
+ int n = buf_len;
+ memcpy(bufptr, ctptr, n);
+ ctptr += n; ctext_len -= n;
+ bufptr += n; buf_len -= n;
+ state->ext_seg_left -= n;
+ }
+ }
+ }
}
- if (charset)
- state->charset = charset;
+ /* 'charset' is the charset for the current run. In some cases,
+ 'state->charset' contains the charset for the next run. Therefore,
+ return 'charset'.
+ 'charset' may still be NULL only if no output was produced. */
if (num_args > 0)
- *((XlcCharSet *) args[0]) = state->charset;
+ *((XlcCharSet *) args[0]) = charset;
- *from_left -= ctptr - *((char **) from);
+ *from_left -= ctptr - *((const char **) from);
*from = (XPointer) ctptr;
*to_left -= bufptr - *((char **) to);
*to = (XPointer) bufptr;
- return 0;
+ return unconv_num;
}
+/* from XlcNCharSet to XlcNCompoundText */
+
static int
-cstoct(conv, from, from_left, to, to_left, args, num_args)
- XlcConv conv;
- XPointer *from;
- int *from_left;
- XPointer *to;
- int *to_left;
- XPointer *args;
- int num_args;
+cstoct(
+ XlcConv conv,
+ XPointer *from,
+ int *from_left,
+ XPointer *to,
+ int *to_left,
+ XPointer *args,
+ int num_args)
{
State state = (State) conv->state;
XlcSide side;
- unsigned char min_ch, max_ch;
- register unsigned char ch;
- int length;
+ unsigned char min_ch = 0, max_ch = 0;
+ int length, unconv_num;
CTInfo ct_info;
XlcCharSet charset;
- char *csptr, *ctptr;
+ const char *csptr;
+ char *ctptr;
int csstr_len, ct_len;
+ char *ext_segment_start;
+ int char_size;
+ /* One argument is required, of type XlcCharSet. */
if (num_args < 1)
return -1;
-
- csptr = *((char **) from);
+
+ csptr = *((const char **) from);
ctptr = *((char **) to);
csstr_len = *from_left;
ct_len = *to_left;
-
+
charset = (XlcCharSet) args[0];
ct_info = _XlcGetCTInfoFromCharSet(charset);
@@ -637,74 +896,170 @@ cstoct(conv, from, from_left, to, to_left, args, num_args)
return -1;
side = charset->side;
+ length = strlen(ct_info->ct_sequence);
+
+ ext_segment_start = NULL;
+
+ if (ct_info->type == XctOtherCoding) {
+ /* Output the Escape sequence for switching to the charset, and
+ reserve room now for the XctReturn sequence at the end. */
+ if (ct_len < length + 3)
+ return -1;
+
+ memcpy(ctptr, ct_info->ct_sequence, length);
+ ctptr += length;
+ ct_len -= length + 3;
+ } else
+ /* Test whether the charset is already active. */
+ if (((side == XlcGR || side == XlcGLGR)
+ && charset != state->GR_charset)
+ || ((side == XlcGL || side == XlcGLGR)
+ && charset != state->GL_charset)) {
+
+ /* Output the Escape sequence for switching to the charset. */
+ if (ct_info->type == XctExtSeg) {
+ if (ct_len < length + 2 + ct_info->ext_segment_len)
+ return -1;
+
+ memcpy(ctptr, ct_info->ct_sequence, length);
+ ctptr += length;
+ ct_len -= length;
+
+ ctptr += 2;
+ ct_len -= 2;
+ ext_segment_start = ctptr;
+
+ /* The size of an extended segment must fit in 14 bits. */
+ if (ct_len > 0x3fff)
+ ct_len = 0x3fff;
+
+ memcpy(ctptr, ct_info->ext_segment, ct_info->ext_segment_len);
+ ctptr += ct_info->ext_segment_len;
+ ct_len -= ct_info->ext_segment_len;
+ } else {
+ if (ct_len < length)
+ return -1;
+
+ memcpy(ctptr, ct_info->ct_sequence, length);
+ ctptr += length;
+ ct_len -= length;
+ }
+ }
- if (ct_info->ext_segment) {
- if (charset != state->ext_seg_charset && state->ext_seg_left < 1) {
- length = ct_info->encoding_len;
- if (ct_len < length)
- return -1;
- strcpy(ctptr, ct_info->encoding);
- ctptr[4] = ((ct_info->ext_segment_len + csstr_len) / 128) | 0x80;
- ctptr[5] = ((ct_info->ext_segment_len + csstr_len) % 128) | 0x80;
- ctptr += length;
- ct_len -= length;
- state->ext_seg_left = csstr_len;
- }
- length = min(state->ext_seg_left, csstr_len);
- state->ext_seg_left -= length;
-
- if (side == XlcGL) {
- while (length-- > 0)
- *ctptr++ = *csptr++ & 0x7f;
- } else if (side == XlcGR) {
- while (length-- > 0)
- *ctptr++ = *csptr++ | 0x80;
- } else {
- while (length-- > 0)
- *ctptr++ = *csptr++;
- }
- state->ext_seg_charset = (state->ext_seg_left > 0) ? charset : NULL;
- } else {
- if ((side == XlcGR && charset != state->GR_charset) ||
- (side == XlcGL && charset != state->GL_charset)) {
-
- ct_len -= ct_info->encoding_len;
- if (ct_len < 0)
- return -1;
- strcpy(ctptr, ct_info->encoding);
- ctptr += ct_info->encoding_len;
- }
-
- min_ch = 0x20;
- max_ch = 0x7f;
-
- if (charset->set_size == 94) {
- max_ch--;
+ /* If the charset has side GL or GR, prepare remapping the characters
+ to the correct side. */
+ if (charset->set_size) {
+ min_ch = 0x20;
+ max_ch = 0x7f;
+ if (charset->set_size == 94) {
+ max_ch--;
if (charset->char_size > 1 || side == XlcGR)
min_ch++;
- }
+ }
+ }
+ /* Actually copy the contents. */
+ unconv_num = 0;
+ char_size = charset->char_size;
+ if (char_size == 1) {
while (csstr_len > 0 && ct_len > 0) {
- ch = *((unsigned char *) csptr++) & 0x7f;
- if (ch < min_ch || ch > max_ch)
- if (ch != 0x00 && ch != 0x09 && ch != 0x0a && ch != 0x1b)
- continue; /* XXX */
+ if (charset->set_size) {
+ /* The CompoundText specification says that the only
+ control characters allowed are 0x09, 0x0a, 0x1b, 0x9b.
+ Therefore here we eliminate other control characters. */
+ unsigned char ch = *((unsigned char *) csptr) & 0x7f;
+ if (!((ch >= min_ch && ch <= max_ch)
+ || (side == XlcGL
+ && (ch == 0x00 || ch == 0x09 || ch == 0x0a))
+ || ((side == XlcGL || side == XlcGR)
+ && (ch == 0x1b)))) {
+ csptr++;
+ csstr_len--;
+ unconv_num++;
+ continue;
+ }
+ }
+
if (side == XlcGL)
- *ctptr++ = ch & 0x7f;
+ *ctptr++ = *csptr++ & 0x7f;
else if (side == XlcGR)
- *ctptr++ = ch | 0x80;
+ *ctptr++ = *csptr++ | 0x80;
else
- *ctptr++ = ch;
+ *ctptr++ = *csptr++;
csstr_len--;
ct_len--;
}
- if (side == XlcGR)
- state->GR_charset = charset;
- else if (side == XlcGL)
- state->GL_charset = charset;
+ } else if (char_size > 1) {
+ while (csstr_len >= char_size && ct_len >= char_size) {
+ if (side == XlcGL) {
+ int i;
+ for (i = char_size; i > 0; i--)
+ *ctptr++ = *csptr++ & 0x7f;
+ } else if (side == XlcGR) {
+ int i;
+ for (i = char_size; i > 0; i--)
+ *ctptr++ = *csptr++ | 0x80;
+ } else {
+ int i;
+ for (i = char_size; i > 0; i--)
+ *ctptr++ = *csptr++;
+ }
+ csstr_len -= char_size;
+ ct_len -= char_size;
+ }
+ } else {
+ /* char_size = 0. The code here is good only for valid UTF-8 input. */
+ if ((charset->ct_sequence[0] == XctESC
+ && charset->ct_sequence[1] == XctOtherCoding
+ && charset->ct_sequence[2] == 'G')
+#if UTF8_IN_EXTSEQ
+ || strcmp(charset->name, "ISO10646-1") == 0
+#endif
+ ) {
+ while (csstr_len > 0 && ct_len > 0) {
+ unsigned char ch = * (unsigned char *) csptr;
+ int char_size = (ch < 0xc0 ? 1 :
+ ch < 0xe0 ? 2 :
+ ch < 0xf0 ? 3 :
+ ch < 0xf8 ? 4 :
+ ch < 0xfc ? 5 :
+ 6);
+ int i;
+ if (!(csstr_len >= char_size && ct_len >= char_size))
+ break;
+ for (i = char_size; i > 0; i--)
+ *ctptr++ = *csptr++;
+ csstr_len -= char_size;
+ ct_len -= char_size;
+ }
+ } else {
+ while (csstr_len > 0 && ct_len > 0) {
+ *ctptr++ = *csptr++;
+ csstr_len--;
+ ct_len--;
+ }
+ }
}
- *from_left -= csptr - *((char **) from);
+ if (ct_info->type == XctOtherCoding) {
+ /* Terminate with an XctReturn sequence. */
+ ctptr[0] = XctESC;
+ ctptr[1] = XctOtherCoding;
+ ctptr[2] = '@';
+ ctptr += 3;
+ } else if (ext_segment_start != NULL) {
+ /* Backpatch the extended segment's length. */
+ int ext_segment_length = ctptr - ext_segment_start;
+ *(ext_segment_start - 2) = (ext_segment_length >> 7) | 0x80;
+ *(ext_segment_start - 1) = (ext_segment_length & 0x7f) | 0x80;
+ } else {
+ if (side == XlcGR || side == XlcGLGR)
+ state->GR_charset = charset;
+ if (side == XlcGL || side == XlcGLGR)
+ state->GL_charset = charset;
+ }
+
+ *from_left -= csptr - *((const char **) from);
*from = (XPointer) csptr;
*to_left -= ctptr - *((char **) to);
@@ -713,22 +1068,25 @@ cstoct(conv, from, from_left, to, to_left, args, num_args)
return 0;
}
+/* from XlcNString to XlcNCharSet */
+
static int
-strtocs(conv, from, from_left, to, to_left, args, num_args)
- XlcConv conv;
- XPointer *from;
- int *from_left;
- XPointer *to;
- int *to_left;
- XPointer *args;
- int num_args;
+strtocs(
+ XlcConv conv,
+ XPointer *from,
+ int *from_left,
+ XPointer *to,
+ int *to_left,
+ XPointer *args,
+ int num_args)
{
State state = (State) conv->state;
- register char *src, *dst;
+ const char *src;
+ char *dst;
unsigned char side;
- register int length;
+ int length;
- src = (char *) *from;
+ src = (const char *) *from;
dst = (char *) *to;
length = min(*from_left, *to_left);
@@ -737,46 +1095,54 @@ strtocs(conv, from, from_left, to, to_left, args, num_args)
while (side == (*((unsigned char *) src) & 0x80) && length-- > 0)
*dst++ = *src++;
- *from_left -= src - (char *) *from;
+ *from_left -= src - (const char *) *from;
*from = (XPointer) src;
*to_left -= dst - (char *) *to;
*to = (XPointer) dst;
if (num_args > 0)
- *((XlcCharSet *)args[0]) = side ? state->GR_charset : state->GL_charset;
+ *((XlcCharSet *)args[0]) = (side ? state->GR_charset : state->GL_charset);
return 0;
}
+/* from XlcNCharSet to XlcNString */
+
static int
-cstostr(conv, from, from_left, to, to_left, args, num_args)
- XlcConv conv;
- XPointer *from;
- int *from_left;
- XPointer *to;
- int *to_left;
- XPointer *args;
- int num_args;
+cstostr(
+ XlcConv conv,
+ XPointer *from,
+ int *from_left,
+ XPointer *to,
+ int *to_left,
+ XPointer *args,
+ int num_args)
{
State state = (State) conv->state;
- char *csptr, *string_ptr;
+ const char *csptr;
+ char *string_ptr;
int csstr_len, str_len;
unsigned char ch;
int unconv_num = 0;
- if (num_args < 1 || (state->GL_charset != (XlcCharSet) args[0] &&
- state->GR_charset != (XlcCharSet) args[0]))
+ /* This converter can only convert from ISO8859-1:GL and ISO8859-1:GR. */
+ if (num_args < 1
+ || !((XlcCharSet) args[0] == state->GL_charset
+ || (XlcCharSet) args[0] == state->GR_charset))
return -1;
- csptr = *((char **) from);
+ csptr = *((const char **) from);
string_ptr = *((char **) to);
csstr_len = *from_left;
str_len = *to_left;
- while (csstr_len-- > 0 && str_len > 0) {
+ while (csstr_len > 0 && str_len > 0) {
ch = *((unsigned char *) csptr++);
- if ((ch < 0x20 && ch != 0x00 && ch != 0x09 && ch != 0x0a) ||
- ch == 0x7f || ((ch & 0x80) && ch < 0xa0)) {
+ csstr_len--;
+ /* Citing ICCCM: "STRING as a type specifies the ISO Latin-1 character
+ set plus the control characters TAB and NEWLINE." */
+ if ((ch < 0x20 && ch != 0x00 && ch != 0x09 && ch != 0x0a)
+ || (ch >= 0x7f && ch < 0xa0)) {
unconv_num++;
continue;
}
@@ -784,7 +1150,7 @@ cstostr(conv, from, from_left, to, to_left, args, num_args)
str_len--;
}
- *from_left -= csptr - *((char **) from);
+ *from_left -= csptr - *((const char **) from);
*from = (XPointer) csptr;
*to_left -= string_ptr - *((char **) to);
@@ -794,116 +1160,141 @@ cstostr(conv, from, from_left, to, to_left, args, num_args)
}
-static void
-close_converter(conv)
- XlcConv conv;
-{
- if (conv->state)
- Xfree((char *) conv->state);
-
- Xfree((char *) conv);
-}
-
static XlcConv
-create_conv(methods)
- XlcConvMethods methods;
+create_conv(
+ XlcConvMethods methods)
{
- register XlcConv conv;
+ XlcConv conv;
- conv = (XlcConv) Xmalloc(sizeof(XlcConvRec));
+ conv = (XlcConv) Xmalloc(sizeof(XlcConvRec) + sizeof(StateRec));
if (conv == NULL)
return (XlcConv) NULL;
- conv->state = (XPointer) Xmalloc(sizeof(StateRec));
- if (conv->state == NULL)
- goto err;
-
+ conv->state = (XPointer) &conv[1];
+
conv->methods = methods;
init_state(conv);
return conv;
+}
-err:
- close_converter(conv);
-
- return (XlcConv) NULL;
+static void
+close_converter(
+ XlcConv conv)
+{
+ /* conv->state is allocated together with conv, free both at once. */
+ Xfree((char *) conv);
}
+
static XlcConvMethodsRec cttocs_methods = {
close_converter,
cttocs,
init_state
-} ;
+};
static XlcConv
-open_cttocs(from_lcd, from_type, to_lcd, to_type)
- XLCd from_lcd;
- char *from_type;
- XLCd to_lcd;
- char *to_type;
+open_cttocs(
+ XLCd from_lcd,
+ const char *from_type,
+ XLCd to_lcd,
+ const char *to_type)
{
return create_conv(&cttocs_methods);
}
+
static XlcConvMethodsRec cstoct_methods = {
close_converter,
cstoct,
init_state
-} ;
+};
static XlcConv
-open_cstoct(from_lcd, from_type, to_lcd, to_type)
- XLCd from_lcd;
- char *from_type;
- XLCd to_lcd;
- char *to_type;
+open_cstoct(
+ XLCd from_lcd,
+ const char *from_type,
+ XLCd to_lcd,
+ const char *to_type)
{
return create_conv(&cstoct_methods);
}
+
static XlcConvMethodsRec strtocs_methods = {
close_converter,
strtocs,
init_state
-} ;
+};
static XlcConv
-open_strtocs(from_lcd, from_type, to_lcd, to_type)
- XLCd from_lcd;
- char *from_type;
- XLCd to_lcd;
- char *to_type;
+open_strtocs(
+ XLCd from_lcd,
+ const char *from_type,
+ XLCd to_lcd,
+ const char *to_type)
{
return create_conv(&strtocs_methods);
}
+
static XlcConvMethodsRec cstostr_methods = {
close_converter,
cstostr,
init_state
-} ;
+};
static XlcConv
-open_cstostr(from_lcd, from_type, to_lcd, to_type)
- XLCd from_lcd;
- char *from_type;
- XLCd to_lcd;
- char *to_type;
+open_cstostr(
+ XLCd from_lcd,
+ const char *from_type,
+ XLCd to_lcd,
+ const char *to_type)
{
return create_conv(&cstostr_methods);
}
-static void
-init_converter()
+
+/* =========================== Initialization =========================== */
+
+Bool
+_XlcInitCTInfo()
{
- _XlcSetConverter((XLCd) NULL, XlcNCompoundText, (XLCd) NULL, XlcNCharSet,
- open_cttocs);
- _XlcSetConverter((XLCd) NULL, XlcNString, (XLCd) NULL, XlcNCharSet,
- open_strtocs);
-
- _XlcSetConverter((XLCd) NULL, XlcNCharSet, (XLCd) NULL, XlcNCompoundText,
- open_cstoct);
- _XlcSetConverter((XLCd) NULL, XlcNCharSet, (XLCd) NULL, XlcNString,
- open_cstostr);
+ if (ct_list == NULL) {
+ CTData ct_data;
+ int num;
+ XlcCharSet charset;
+
+ /* Initialize ct_list. */
+
+ num = sizeof(default_ct_data) / sizeof(CTDataRec);
+ for (ct_data = default_ct_data; num > 0; ct_data++, num--) {
+ charset = _XlcAddCT(ct_data->name, ct_data->ct_sequence);
+ if (charset == NULL)
+ continue;
+ if (strncmp(charset->ct_sequence, "\x1b\x25\x2f", 3) != 0)
+ charset->source = CSsrcStd;
+ else
+ charset->source = CSsrcXLC;
+ }
+
+ /* Register CompoundText and CharSet converters. */
+
+ _XlcSetConverter((XLCd) NULL, XlcNCompoundText,
+ (XLCd) NULL, XlcNCharSet,
+ open_cttocs);
+ _XlcSetConverter((XLCd) NULL, XlcNString,
+ (XLCd) NULL, XlcNCharSet,
+ open_strtocs);
+
+ _XlcSetConverter((XLCd) NULL, XlcNCharSet,
+ (XLCd) NULL, XlcNCompoundText,
+ open_cstoct);
+ _XlcSetConverter((XLCd) NULL, XlcNCharSet,
+ (XLCd) NULL, XlcNString,
+ open_cstostr);
+ }
+
+ return True;
}
diff --git a/src/xlibi18n/lcCharSet.c b/src/xlibi18n/lcCharSet.c
index e9a376b0..3877495e 100644
--- a/src/xlibi18n/lcCharSet.c
+++ b/src/xlibi18n/lcCharSet.c
@@ -23,46 +23,14 @@
* Author: Katsuhisa Yano TOSHIBA Corp.
* mopi@osa.ilab.toshiba.co.jp
*/
+/* $XFree86: xc/lib/X11/lcCharSet.c,v 3.8 2001/01/17 19:41:53 dawes Exp $ */
#include <stdio.h>
#include "Xlibint.h"
#include "XlcPublic.h"
+#include "XlcPubI.h"
-#if NeedVarargsPrototypes
-char *
-_XlcGetCSValues(XlcCharSet charset, ...)
-#else
-char *
-_XlcGetCSValues(charset, va_alist)
- XlcCharSet charset;
- va_dcl
-#endif
-{
- va_list var;
- XlcArgList args;
- char *ret;
- int num_args;
-
- Va_start(var, charset);
- _XlcCountVaList(var, &num_args);
- va_end(var);
-
- Va_start(var, charset);
- _XlcVaToArgList(var, num_args, &args);
- va_end(var);
-
- if (args == (XlcArgList) NULL)
- return (char *) NULL;
-
- if (charset->get_values)
- ret = (*charset->get_values)(charset, args, num_args);
- else
- ret = args->name;
-
- Xfree(args);
-
- return ret;
-}
+/* The list of all known XlcCharSets. They are identified by their name. */
typedef struct _XlcCharSetListRec {
XlcCharSet charset;
@@ -71,9 +39,11 @@ typedef struct _XlcCharSetListRec {
static XlcCharSetList charset_list = NULL;
+/* Returns the charset with the given name (including side suffix).
+ Returns NULL if not found. */
XlcCharSet
-_XlcGetCharSet(name)
- char *name;
+_XlcGetCharSet(
+ const char *name)
{
XlcCharSetList list;
XrmQuark xrm_name;
@@ -88,9 +58,33 @@ _XlcGetCharSet(name)
return (XlcCharSet) NULL;
}
+/* Returns the charset with the given encoding (no side suffix) and
+ responsible for at least the given side (XlcGL or XlcGR).
+ Returns NULL if not found. */
+XlcCharSet
+_XlcGetCharSetWithSide(
+ const char *encoding_name,
+ XlcSide side)
+{
+ XlcCharSetList list;
+ XrmQuark xrm_encoding_name;
+
+ xrm_encoding_name = XrmStringToQuark(encoding_name);
+
+ for (list = charset_list; list; list = list->next) {
+ if (list->charset->xrm_encoding_name == xrm_encoding_name
+ && (list->charset->side == XlcGLGR || list->charset->side == side))
+ return (XlcCharSet) list->charset;
+ }
+
+ return (XlcCharSet) NULL;
+}
+
+/* Registers an XlcCharSet in the list of character sets.
+ Returns True if successful. */
Bool
-_XlcAddCharSet(charset)
- XlcCharSet charset;
+_XlcAddCharSet(
+ XlcCharSet charset)
{
XlcCharSetList list;
@@ -108,6 +102,7 @@ _XlcAddCharSet(charset)
return True;
}
+/* List of resources for XlcCharSet. */
static XlcResource resources[] = {
{ XlcNName, NULLQUARK, sizeof(char *),
XOffsetOf(XlcCharSetRec, name), XlcGetMask },
@@ -123,11 +118,14 @@ static XlcResource resources[] = {
XOffsetOf(XlcCharSetRec, ct_sequence), XlcGetMask }
};
+/* Retrieves a number of attributes of an XlcCharSet.
+ Return NULL if successful, otherwise the name of the first argument
+ specifiying a nonexistent attribute. */
static char *
-get_values(charset, args, num_args)
- register XlcCharSet charset;
- register XlcArgList args;
- register int num_args;
+get_values(
+ XlcCharSet charset,
+ XlcArgList args,
+ int num_args)
{
if (resources[0].xrm_name == NULLQUARK)
_XlcCompileResourceList(resources, XlcNumber(resources));
@@ -136,29 +134,92 @@ get_values(charset, args, num_args)
args, num_args, XlcGetMask);
}
+/* Retrieves a number of attributes of an XlcCharSet.
+ Return NULL if successful, otherwise the name of the first argument
+ specifiying a nonexistent attribute. */
+char *
+_XlcGetCSValues(XlcCharSet charset, ...)
+{
+ va_list var;
+ XlcArgList args;
+ char *ret;
+ int num_args;
+
+ va_start(var, charset);
+ _XlcCountVaList(var, &num_args);
+ va_end(var);
+
+ va_start(var, charset);
+ _XlcVaToArgList(var, num_args, &args);
+ va_end(var);
+
+ if (args == (XlcArgList) NULL)
+ return (char *) NULL;
+
+ ret = get_values(charset, args, num_args);
+
+ Xfree(args);
+
+ return ret;
+}
+
+/* Creates a new XlcCharSet, given its name (including side suffix) and
+ Compound Text ESC sequence (normally at most 4 bytes). */
XlcCharSet
-_XlcCreateDefaultCharSet(name, ct_sequence)
- char *name;
- char *ct_sequence;
+_XlcCreateDefaultCharSet(
+ const char *name,
+ const char *ct_sequence)
{
XlcCharSet charset;
+ int name_len, ct_sequence_len;
+ const char *colon;
+ char *tmp;
charset = (XlcCharSet) Xmalloc(sizeof(XlcCharSetRec));
if (charset == NULL)
return (XlcCharSet) NULL;
bzero((char *) charset, sizeof(XlcCharSetRec));
-
- charset->name = (char *) Xmalloc(strlen(name) + strlen(ct_sequence) + 2);
- if (charset->name == NULL) {
+
+ name_len = strlen(name);
+ ct_sequence_len = strlen(ct_sequence);
+
+ /* Fill in name and xrm_name. */
+ tmp = (char *) Xmalloc(name_len + 1 + ct_sequence_len + 1);
+ if (tmp == NULL) {
Xfree((char *) charset);
return (XlcCharSet) NULL;
}
- strcpy(charset->name, name);
- charset->ct_sequence = charset->name + strlen(name) + 1;
- strcpy(charset->ct_sequence, ct_sequence);
- charset->get_values = get_values;
+ memcpy(tmp, name, name_len+1);
+ charset->name = tmp;
+ charset->xrm_name = XrmStringToQuark(charset->name);
+
+ /* Fill in encoding_name and xrm_encoding_name. */
+ if ((colon = strchr(charset->name, ':')) != NULL) {
+ unsigned int length = colon - charset->name;
+ char *encoding_tmp = (char *) Xmalloc(length + 1);
+ if (encoding_tmp == NULL) {
+ Xfree((char *) charset->name);
+ Xfree((char *) charset);
+ return (XlcCharSet) NULL;
+ }
+ memcpy(encoding_tmp, charset->name, length);
+ encoding_tmp[length] = '\0';
+ charset->encoding_name = encoding_tmp;
+ charset->xrm_encoding_name = XrmStringToQuark(charset->encoding_name);
+ } else {
+ charset->encoding_name = charset->name;
+ charset->xrm_encoding_name = charset->xrm_name;
+ }
+
+ /* Fill in ct_sequence. */
+ tmp += name_len + 1;
+ memcpy(tmp, ct_sequence, ct_sequence_len+1);
+ charset->ct_sequence = tmp;
- _XlcParseCharSet(charset);
+ /* Fill in side, char_size, set_size. */
+ if (!_XlcParseCharSet(charset))
+ /* If ct_sequence is not usable in Compound Text, remove it. */
+ charset->ct_sequence = "";
return (XlcCharSet) charset;
}
diff --git a/src/xlibi18n/lcConv.c b/src/xlibi18n/lcConv.c
index f03adcc6..88ae52f4 100644
--- a/src/xlibi18n/lcConv.c
+++ b/src/xlibi18n/lcConv.c
@@ -23,41 +23,40 @@
* Author: Katsuhisa Yano TOSHIBA Corp.
* mopi@osa.ilab.toshiba.co.jp
*/
+/* $XFree86: xc/lib/X11/lcConv.c,v 1.5 2000/12/04 18:49:26 dawes Exp $ */
#include "Xlibint.h"
#include "XlcPubI.h"
#include <stdio.h>
-typedef XlcConv (*XlcConverter)();
-
typedef struct _XlcConverterListRec {
XLCd from_lcd;
- char *from;
+ const char *from;
XrmQuark from_type;
XLCd to_lcd;
- char *to;
+ const char *to;
XrmQuark to_type;
- XlcConverter converter;
+ XlcOpenConverterProc converter;
struct _XlcConverterListRec *next;
} XlcConverterListRec, *XlcConverterList;
static XlcConverterList conv_list = NULL;
static void
-close_converter(conv)
- XlcConv conv;
+close_converter(
+ XlcConv conv)
{
(*conv->methods->close)(conv);
}
static XlcConv
-get_converter(from_lcd, from_type, to_lcd, to_type)
- XLCd from_lcd;
- XrmQuark from_type;
- XLCd to_lcd;
- XrmQuark to_type;
+get_converter(
+ XLCd from_lcd,
+ XrmQuark from_type,
+ XLCd to_lcd,
+ XrmQuark to_type)
{
- register XlcConverterList list, prev = NULL;
+ XlcConverterList list, prev = NULL;
for (list = conv_list; list; list = list->next) {
if (list->from_lcd == from_lcd && list->to_lcd == to_lcd
@@ -74,20 +73,20 @@ get_converter(from_lcd, from_type, to_lcd, to_type)
prev = list;
}
-
+
return (XlcConv) NULL;
}
Bool
-_XlcSetConverter(from_lcd, from, to_lcd, to, converter)
- XLCd from_lcd;
- char *from;
- XLCd to_lcd;
- char *to;
- XlcOpenConverterProc converter;
+_XlcSetConverter(
+ XLCd from_lcd,
+ const char *from,
+ XLCd to_lcd,
+ const char *to,
+ XlcOpenConverterProc converter)
{
- register XlcConverterList list;
- register XrmQuark from_type, to_type;
+ XlcConverterList list;
+ XrmQuark from_type, to_type;
from_type = XrmStringToQuark(from);
to_type = XrmStringToQuark(to);
@@ -104,7 +103,7 @@ _XlcSetConverter(from_lcd, from, to_lcd, to, converter)
list = (XlcConverterList) Xmalloc(sizeof(XlcConverterListRec));
if (list == NULL)
return False;
-
+
list->from_lcd = from_lcd;
list->from = from;
list->from_type = from_type;
@@ -124,14 +123,14 @@ typedef struct _ConvRec {
} ConvRec, *Conv;
static int
-indirect_convert(lc_conv, from, from_left, to, to_left, args, num_args)
- XlcConv lc_conv;
- XPointer *from;
- int *from_left;
- XPointer *to;
- int *to_left;
- XPointer *args;
- int num_args;
+indirect_convert(
+ XlcConv lc_conv,
+ XPointer *from,
+ int *from_left,
+ XPointer *to,
+ int *to_left,
+ XPointer *args,
+ int num_args)
{
Conv conv = (Conv) lc_conv->state;
XlcConv from_conv = conv->from_conv;
@@ -161,28 +160,35 @@ indirect_convert(lc_conv, from, from_left, to, to_left, args, num_args)
if (ret < 0)
break;
- length = cs_left = cs - buf;
- cs = buf;
+ unconv_num += ret;
+
+ length = cs - buf;
+ if (length > 0) {
+ cs_left = length;
+ cs = buf;
- tmp_args[0] = (XPointer) charset;
+ tmp_args[0] = (XPointer) charset;
- ret = (*to_conv->methods->convert)(to_conv, &cs, &cs_left, to, to_left,
- tmp_args, 1);
- if (ret < 0) {
- unconv_num += length / charset->char_size;
- continue;
+ ret = (*to_conv->methods->convert)(to_conv, &cs, &cs_left, to, to_left,
+ tmp_args, 1);
+ if (ret < 0) {
+ unconv_num += length / (charset->char_size > 0 ? charset->char_size : 1);
+ continue;
+ }
+
+ unconv_num += ret;
+
+ if (*to_left < 1)
+ break;
}
-
- if (*to_left < 1)
- break;
}
return unconv_num;
}
static void
-close_indirect_converter(lc_conv)
- XlcConv lc_conv;
+close_indirect_converter(
+ XlcConv lc_conv)
{
Conv conv = (Conv) lc_conv->state;
@@ -199,8 +205,8 @@ close_indirect_converter(lc_conv)
}
static void
-reset_indirect_converter(lc_conv)
- XlcConv lc_conv;
+reset_indirect_converter(
+ XlcConv lc_conv)
{
Conv conv = (Conv) lc_conv->state;
@@ -219,11 +225,11 @@ static XlcConvMethodsRec conv_methods = {
} ;
static XlcConv
-open_indirect_converter(from_lcd, from, to_lcd, to)
- XLCd from_lcd;
- char *from;
- XLCd to_lcd;
- char *to;
+open_indirect_converter(
+ XLCd from_lcd,
+ const char *from,
+ XLCd to_lcd,
+ const char *to)
{
XlcConv lc_conv, from_conv, to_conv;
Conv conv;
@@ -246,13 +252,13 @@ open_indirect_converter(from_lcd, from, to_lcd, to)
lc_conv = (XlcConv) Xmalloc(sizeof(XlcConvRec));
if (lc_conv == NULL)
return (XlcConv) NULL;
-
+
lc_conv->methods = &conv_methods;
lc_conv->state = (XPointer) Xcalloc(1, sizeof(ConvRec));
if (lc_conv->state == NULL)
goto err;
-
+
conv = (Conv) lc_conv->state;
from_conv = get_converter(from_lcd, from_type, from_lcd, QCTCharSet);
@@ -284,11 +290,11 @@ err:
}
XlcConv
-_XlcOpenConverter(from_lcd, from, to_lcd, to)
- XLCd from_lcd;
- char *from;
- XLCd to_lcd;
- char *to;
+_XlcOpenConverter(
+ XLCd from_lcd,
+ const char *from,
+ XLCd to_lcd,
+ const char *to)
{
XlcConv conv;
XrmQuark from_type, to_type;
@@ -298,34 +304,34 @@ _XlcOpenConverter(from_lcd, from, to_lcd, to)
if ((conv = get_converter(from_lcd, from_type, to_lcd, to_type)))
return conv;
-
+
return open_indirect_converter(from_lcd, from, to_lcd, to);
}
void
-_XlcCloseConverter(conv)
- XlcConv conv;
+_XlcCloseConverter(
+ XlcConv conv)
{
close_converter(conv);
}
int
-_XlcConvert(conv, from, from_left, to, to_left, args, num_args)
- XlcConv conv;
- XPointer *from;
- int *from_left;
- XPointer *to;
- int *to_left;
- XPointer *args;
- int num_args;
+_XlcConvert(
+ XlcConv conv,
+ XPointer *from,
+ int *from_left,
+ XPointer *to,
+ int *to_left,
+ XPointer *args,
+ int num_args)
{
return (*conv->methods->convert)(conv, from, from_left, to, to_left, args,
num_args);
}
void
-_XlcResetConverter(conv)
- XlcConv conv;
+_XlcResetConverter(
+ XlcConv conv)
{
if (conv->methods->reset)
(*conv->methods->reset)(conv);
diff --git a/src/xlibi18n/lcDB.c b/src/xlibi18n/lcDB.c
index a6d8648b..2ed5f13a 100644
--- a/src/xlibi18n/lcDB.c
+++ b/src/xlibi18n/lcDB.c
@@ -28,6 +28,10 @@
* This is source code modified by FUJITSU LIMITED under the Joint
* Development Agreement for the CDE/Motif PST.
*/
+/* $XFree86: xc/lib/X11/lcDB.c,v 3.15tsi Exp $ */
+
+
+
#ifndef NOT_X_ENV
#include <X11/Xlib.h>
@@ -92,21 +96,22 @@ typedef enum {
typedef struct {
Token token; /* token id */
- char *name; /* token sequence */
+ const char *name; /* token sequence */
int len; /* length of token sequence */
- int (*parse_proc)(); /* parsing procedure */
+ int (*parse_proc)(const char *str, Token token, Database *db);
+ /* parsing procedure */
} TokenTable;
-static int f_newline();
-static int f_comment();
-static int f_semicolon();
-static int f_double_quote();
-static int f_left_brace();
-static int f_right_brace();
-static int f_white();
-static int f_backslash();
-static int f_numeric();
-static int f_default();
+static int f_newline (const char *str, Token token, Database *db);
+static int f_comment (const char *str, Token token, Database *db);
+static int f_semicolon (const char *str, Token token, Database *db);
+static int f_double_quote (const char *str, Token token, Database *db);
+static int f_left_brace (const char *str, Token token, Database *db);
+static int f_right_brace (const char *str, Token token, Database *db);
+static int f_white (const char *str, Token token, Database *db);
+static int f_backslash (const char *str, Token token, Database *db);
+static int f_numeric (const char *str, Token token, Database *db);
+static int f_default (const char *str, Token token, Database *db);
static TokenTable token_tbl[] = {
{ T_NEWLINE, "\n", 1, f_newline },
@@ -121,10 +126,10 @@ static TokenTable token_tbl[] = {
{ T_NUMERIC_HEX, "\\x", 2, f_numeric },
{ T_NUMERIC_DEC, "\\d", 2, f_numeric },
{ T_NUMERIC_OCT, "\\o", 2, f_numeric },
- { T_DEFAULT, " ", 1, f_default }, /* any character */
- 0
+ { T_DEFAULT, " ", 1, f_default } /* any character */
};
+#define SYM_CR '\r'
#define SYM_NEWLINE '\n'
#define SYM_COMMENT '#'
#define SYM_SEMICOLON ';'
@@ -154,17 +159,18 @@ typedef struct {
static DBParseInfo parse_info;
-static void init_parse_info()
+static void
+init_parse_info (void)
{
- static int first = 1;
+ static int allocated /* = 0 */;
char *ptr;
- int size;
- if(first == 1){
+ int size;
+ if (!allocated) {
bzero(&parse_info, sizeof(DBParseInfo));
parse_info.buf = (char *)Xmalloc(BUFSIZE);
parse_info.bufMaxSize = BUFSIZE;
- first = 0;
- return ;
+ allocated = 1;
+ return;
}
ptr = parse_info.buf;
size = parse_info.bufMaxSize;
@@ -174,22 +180,22 @@ static void init_parse_info()
}
static void
-clear_parse_info()
+clear_parse_info (void)
{
int i;
char *ptr;
int size;
parse_info.pre_state = S_NULL;
- if(parse_info.category != NULL){
+ if (parse_info.category != NULL) {
Xfree(parse_info.category);
}
- for(i = 0; i <= parse_info.nest_depth; ++i){
- if(parse_info.name[i]){
+ for (i = 0; i <= parse_info.nest_depth; ++i) {
+ if (parse_info.name[i]) {
Xfree(parse_info.name[i]);
}
}
- if(parse_info.value){
- if(*parse_info.value){
+ if (parse_info.value) {
+ if (*parse_info.value) {
Xfree(*parse_info.value);
}
Xfree((char *)parse_info.value);
@@ -202,23 +208,22 @@ clear_parse_info()
}
static Bool
-realloc_parse_info(len)
-int len;
+realloc_parse_info(
+ int len)
{
char *p;
-
- parse_info.bufMaxSize = BUFSIZE *
- ((parse_info.bufsize + len)/BUFSIZE + 1);
+ parse_info.bufMaxSize = BUFSIZE * ((parse_info.bufsize + len)/BUFSIZE + 1);
p = (char *)Xrealloc(parse_info.buf, parse_info.bufMaxSize);
- if(p == NULL){
- return(False);
- }
+ if (p == NULL)
+ return False;
parse_info.buf = p;
- return(True);
+ return True;
}
+
/************************************************************************/
+
typedef struct _Line {
char *str;
int cursize;
@@ -227,28 +232,28 @@ typedef struct _Line {
} Line;
static void
-free_line(line)
- Line *line;
+free_line(
+ Line *line)
{
- if(line->str != NULL){
+ if (line->str != NULL) {
Xfree(line->str);
}
bzero(line, sizeof(Line));
}
static int
-realloc_line(line, size)
- Line *line;
- int size;
+realloc_line(
+ Line *line,
+ int size)
{
char *str = line->str;
- if(str != NULL){
+ if (str != NULL) {
str = (char *)Xrealloc(str, size);
- }else{
+ } else {
str = (char *)Xmalloc(size);
}
- if(str == NULL){
+ if (str == NULL) {
/* malloc error */
if (line->str != NULL) {
Xfree(line->str);
@@ -264,34 +269,34 @@ realloc_line(line, size)
#define iswhite(ch) ((ch) == SYM_SPACE || (ch) == SYM_TAB)
static void
-zap_comment(str, quoted)
- char *str;
- int *quoted;
+zap_comment(
+ char *str,
+ int *quoted)
{
char *p = str;
#ifdef never
*quoted = 0;
- if(*p == SYM_COMMENT){
+ if (*p == SYM_COMMENT) {
int len = strlen(str);
- if(p[len - 1] == SYM_NEWLINE){
+ if (p[len - 1] == SYM_NEWLINE || p[len - 1] == SYM_CR) {
*p++ = SYM_NEWLINE;
}
*p = '\0';
}
#else
- while(*p){
- if(*p == SYM_DOUBLE_QUOTE){
- if(p == str || p[-1] != SYM_BACKSLASH){
+ while (*p) {
+ if (*p == SYM_DOUBLE_QUOTE) {
+ if (p == str || p[-1] != SYM_BACKSLASH) {
/* unescaped double quote changes quoted state. */
*quoted = *quoted ? 0 : 1;
}
}
- if(*p == SYM_COMMENT && !*quoted){
+ if (*p == SYM_COMMENT && !*quoted) {
int pos = p - str;
- if(pos == 0 ||
- iswhite(p[-1]) && (pos == 1 || p[-2] != SYM_BACKSLASH)){
+ if (pos == 0 ||
+ (iswhite(p[-1]) && (pos == 1 || p[-2] != SYM_BACKSLASH))) {
int len = strlen(p);
- if(len > 0 && p[len - 1] == SYM_NEWLINE){
+ if (len > 0 && (p[len - 1] == SYM_NEWLINE || p[len-1] == SYM_CR)) {
/* newline is the identifier for finding end of value.
therefore, it should not be removed. */
*p++ = SYM_NEWLINE;
@@ -306,9 +311,9 @@ zap_comment(str, quoted)
}
static int
-read_line(fd, line)
- FILE *fd;
- Line *line;
+read_line(
+ FILE *fd,
+ Line *line)
{
char buf[BUFSIZE], *p;
int len;
@@ -319,19 +324,19 @@ read_line(fd, line)
str = line->str;
cur = line->cursize = 0;
- while((p = fgets(buf, BUFSIZE, fd)) != NULL){
+ while ((p = fgets(buf, BUFSIZE, fd)) != NULL) {
++line->seq;
zap_comment(p, &quoted); /* remove comment line */
len = strlen(p);
- if(len == 0){
- if(cur > 0){
+ if (len == 0) {
+ if (cur > 0) {
break;
}
continue;
}
- if(cur + len + 1 > line->maxsize){
+ if (cur + len + 1 > line->maxsize) {
/* need to reallocate buffer. */
- if(! realloc_line(line, line->maxsize + BUFSIZE)){
+ if (! realloc_line(line, line->maxsize + BUFSIZE)) {
return -1; /* realloc error. */
}
str = line->str;
@@ -340,19 +345,28 @@ read_line(fd, line)
cur += len;
str[cur] = '\0';
- if(!quoted){
- if(cur > 1 && str[cur - 2] == SYM_BACKSLASH &&
- str[cur - 1] == SYM_NEWLINE){
- /* the line is ended backslash followed by newline.
- need to concatinate the next line. */
- cur -= 2;
- str[cur] = '\0';
- }else{
- break;
- }
+#ifdef __UNIXOS2__ /* Take out carriage returns under OS/2 */
+ if (cur>1) {
+ if (str[cur-2] == '\r' && str[cur-1] == '\n') {
+ str[cur-2] = '\n';
+ str[cur-1] = '\0';
+ cur--;
+ }
+ }
+#endif
+ if (!quoted && cur > 1 && str[cur - 2] == SYM_BACKSLASH &&
+ (str[cur - 1] == SYM_NEWLINE || str[cur-1] == SYM_CR)) {
+ /* the line is ended backslash followed by newline.
+ need to concatinate the next line. */
+ cur -= 2;
+ str[cur] = '\0';
+ } else if (len < BUFSIZE - 1 || buf[len - 1] == SYM_NEWLINE ||
+ buf[len - 1] == SYM_CR) {
+ /* the line is shorter than BUFSIZE. */
+ break;
}
}
- if(quoted){
+ if (quoted) {
/* error. still in quoted state. */
return -1;
}
@@ -362,20 +376,21 @@ read_line(fd, line)
/************************************************************************/
static Token
-get_token(str)
- char *str;
+get_token(
+ const char *str)
{
- switch(*str){
- case SYM_NEWLINE: return T_NEWLINE;
- case SYM_COMMENT: return T_COMMENT;
- case SYM_SEMICOLON: return T_SEMICOLON;
+ switch (*str) {
+ case SYM_NEWLINE:
+ case SYM_CR: return T_NEWLINE;
+ case SYM_COMMENT: return T_COMMENT;
+ case SYM_SEMICOLON: return T_SEMICOLON;
case SYM_DOUBLE_QUOTE: return T_DOUBLE_QUOTE;
case SYM_LEFT_BRACE: return T_LEFT_BRACE;
case SYM_RIGHT_BRACE: return T_RIGHT_BRACE;
- case SYM_SPACE: return T_SPACE;
- case SYM_TAB: return T_TAB;
+ case SYM_SPACE: return T_SPACE;
+ case SYM_TAB: return T_TAB;
case SYM_BACKSLASH:
- switch(str[1]){
+ switch (str[1]) {
case 'x': return T_NUMERIC_HEX;
case 'd': return T_NUMERIC_DEC;
case 'o': return T_NUMERIC_OCT;
@@ -387,26 +402,25 @@ get_token(str)
}
static int
-get_word(str, word)
- char *str;
- char *word;
+get_word(
+ const char *str,
+ char *word)
{
- char *p = str, *w = word;
+ const char *p = str;
+ char *w = word;
Token token;
int token_len;
- while(*p != '\0'){
+ while (*p != '\0') {
token = get_token(p);
token_len = token_tbl[token].len;
- if(token == T_BACKSLASH){
+ if (token == T_BACKSLASH) {
p += token_len;
- if(*p == '\0'){
+ if (*p == '\0')
break;
- }
token = get_token(p);
token_len = token_tbl[token].len;
- }else if(token != T_COMMENT &&
- token != T_DEFAULT){
+ } else if (token != T_COMMENT && token != T_DEFAULT) {
break;
}
strncpy(w, p, token_len);
@@ -417,27 +431,28 @@ get_word(str, word)
}
static int
-get_quoted_word(str, word)
- char *str;
- char *word;
+get_quoted_word(
+ const char *str,
+ char *word)
{
- char *p = str, *w = word;
+ const char *p = str;
+ char *w = word;
Token token;
int token_len;
- if(*p == SYM_DOUBLE_QUOTE){
+ if (*p == SYM_DOUBLE_QUOTE) {
++p;
}
- while(*p != '\0'){
+ while (*p != '\0') {
token = get_token(p);
token_len = token_tbl[token].len;
- if(token == T_DOUBLE_QUOTE){
+ if (token == T_DOUBLE_QUOTE) {
p += token_len;
goto found;
}
- if(token == T_BACKSLASH){
+ if (token == T_BACKSLASH) {
p += token_len;
- if(*p == '\0'){
+ if (*p == '\0') {
break;
}
token = get_token(p);
@@ -457,7 +472,7 @@ get_quoted_word(str, word)
/************************************************************************/
static int
-append_value_list()
+append_value_list (void)
{
char **value_list = parse_info.value;
char *value;
@@ -467,45 +482,44 @@ append_value_list()
int len = parse_info.bufsize;
char *p;
- if(len < 1){
+ if (len < 1) {
return 1; /* return with no error */
}
- if(value_list == (char **)NULL){
+ if (value_list == (char **)NULL) {
value_list = (char **)Xmalloc(sizeof(char *) * 2);
*value_list = NULL;
- }else{
+ } else {
char **prev_list = value_list;
value_list = (char **)
Xrealloc(value_list, sizeof(char *) * (value_num + 2));
- if (value_list == NULL){
+ if (value_list == NULL) {
Xfree(prev_list);
}
}
- if(value_list == (char **)NULL){
- goto err;
- }
+ if (value_list == (char **)NULL)
+ goto err2;
value = *value_list;
- if(value == NULL){
+ if (value == NULL) {
value = (char *)Xmalloc(value_len + len + 1);
- }else{
+ } else {
char *prev_value = value;
value = (char *)Xrealloc(value, value_len + len + 1);
- if (value == NULL){
+ if (value == NULL) {
Xfree(prev_value);
}
}
- if(value == NULL){
- goto err;
+ if (value == NULL) {
+ goto err1;
}
- if(value != *value_list){
+ if (value != *value_list) {
int delta, i;
delta = value - *value_list;
*value_list = value;
- for(i = 1; i < value_num; ++i){
+ for (i = 1; i < value_num; ++i) {
value_list[i] += delta;
}
}
@@ -521,13 +535,14 @@ append_value_list()
parse_info.bufsize = 0;
return 1;
- err:
- if(value_list){
+ err1:
+ if (value_list) {
Xfree((char **)value_list);
}
- if(value){
+ if (value) {
Xfree(value);
}
+ err2:
parse_info.value = (char **)NULL;
parse_info.value_num = 0;
parse_info.value_len = 0;
@@ -536,14 +551,15 @@ append_value_list()
}
static int
-construct_name(name, size)
- char *name;
- int size;
+construct_name(
+ char *name,
+ int size)
{
- register int i, len = 0;
+ int i;
+ int len = 0;
char *p = name;
- for(i = 0; i <= parse_info.nest_depth; ++i){
+ for (i = 0; i <= parse_info.nest_depth; ++i) {
len += strlen(parse_info.name[i]) + 1;
}
if (len >= size)
@@ -551,7 +567,7 @@ construct_name(name, size)
strcpy(p, parse_info.name[0]);
p += strlen(parse_info.name[0]);
- for(i = 1; i <= parse_info.nest_depth; ++i){
+ for (i = 1; i <= parse_info.nest_depth; ++i) {
*p++ = '.';
strcpy(p, parse_info.name[i]);
p += strlen(parse_info.name[i]);
@@ -560,39 +576,39 @@ construct_name(name, size)
}
static int
-store_to_database(db)
- Database *db;
+store_to_database(
+ Database *db)
{
Database new = (Database)NULL;
char name[BUFSIZE];
- if(parse_info.pre_state == S_VALUE){
- if(! append_value_list()){
+ if (parse_info.pre_state == S_VALUE) {
+ if (! append_value_list()) {
goto err;
}
}
- if(parse_info.name[parse_info.nest_depth] == NULL){
+ if (parse_info.name[parse_info.nest_depth] == NULL) {
goto err;
}
new = (Database)Xmalloc(sizeof(DatabaseRec));
- if(new == (Database)NULL){
+ if (new == (Database)NULL) {
goto err;
}
bzero(new, sizeof(DatabaseRec));
new->category = (char *)Xmalloc(strlen(parse_info.category) + 1);
- if(new->category == NULL){
+ if (new->category == NULL) {
goto err;
}
strcpy(new->category, parse_info.category);
- if(! construct_name(name, sizeof(name))){
+ if (! construct_name(name, sizeof(name))) {
goto err;
}
new->name = (char *)Xmalloc(strlen(name) + 1);
- if(new->name == NULL){
+ if (new->name == NULL) {
goto err;
}
strcpy(new->name, name);
@@ -611,16 +627,16 @@ store_to_database(db)
return 1;
err:
- if(new){
- if(new->category){
+ if (new) {
+ if (new->category) {
Xfree(new->category);
}
- if(new->name){
+ if (new->name) {
Xfree(new->name);
}
}
- if(parse_info.value){
- if(*parse_info.value){
+ if (parse_info.value) {
+ if (*parse_info.value) {
Xfree(*parse_info.value);
}
Xfree((char **)parse_info.value);
@@ -635,23 +651,23 @@ store_to_database(db)
#define END_MARK_LEN 3 /*strlen(END_MARK)*/
static int
-check_category_end(str)
- char *str;
+check_category_end(
+ const char *str)
{
- char *p;
+ const char *p;
int len;
p = str;
- if(strncmp(p, END_MARK, END_MARK_LEN)){
+ if (strncmp(p, END_MARK, END_MARK_LEN)) {
return 0;
}
p += END_MARK_LEN;
- while(iswhite(*p)){
+ while (iswhite(*p)) {
++p;
}
len = strlen(parse_info.category);
- if(strncmp(p, parse_info.category, len)){
+ if (strncmp(p, parse_info.category, len)) {
return 0;
}
p += len;
@@ -661,19 +677,19 @@ check_category_end(str)
/************************************************************************/
static int
-f_newline(str, token, db)
- char *str;
- Token token;
- Database *db;
+f_newline(
+ const char *str,
+ Token token,
+ Database *db)
{
- switch(parse_info.pre_state){
+ switch (parse_info.pre_state) {
case S_NULL:
case S_CATEGORY:
break;
case S_NAME:
return 0; /* no value */
case S_VALUE:
- if(!store_to_database(db))
+ if (!store_to_database(db))
return 0;
parse_info.pre_state = S_CATEGORY;
break;
@@ -684,49 +700,49 @@ f_newline(str, token, db)
}
static int
-f_comment(str, token, db)
- char *str;
- Token token;
- Database *db;
+f_comment(
+ const char *str,
+ Token token,
+ Database *db)
{
/* NOTE: comment is already handled in read_line(),
so this function is not necessary. */
- char *p = str;
+ const char *p = str;
- while(*p != SYM_NEWLINE && *p != '\0'){
+ while (*p != SYM_NEWLINE && *p != SYM_CR && *p != '\0') {
++p; /* zap to the end of line */
}
return p - str;
}
static int
-f_white(str, token, db)
- char *str;
- Token token;
- Database *db;
+f_white(
+ const char *str,
+ Token token,
+ Database *db)
{
- char *p = str;
+ const char *p = str;
- while(iswhite(*p)){
+ while (iswhite(*p)) {
++p;
}
return p - str;
}
static int
-f_semicolon(str, token, db)
- char *str;
- Token token;
- Database *db;
+f_semicolon(
+ const char *str,
+ Token token,
+ Database *db)
{
- switch(parse_info.pre_state){
+ switch (parse_info.pre_state) {
case S_NULL:
case S_CATEGORY:
case S_NAME:
return 0;
case S_VALUE:
- if(! append_value_list())
+ if (! append_value_list())
return 0;
parse_info.pre_state = S_VALUE;
break;
@@ -737,19 +753,19 @@ f_semicolon(str, token, db)
}
static int
-f_left_brace(str, token, db)
- char *str;
- Token token;
- Database *db;
+f_left_brace(
+ const char *str,
+ Token token,
+ Database *db)
{
- switch(parse_info.pre_state){
+ switch (parse_info.pre_state) {
case S_NULL:
case S_CATEGORY:
case S_VALUE:
return 0;
case S_NAME:
- if(parse_info.name[parse_info.nest_depth] == NULL ||
- parse_info.nest_depth + 1 > MAX_NAME_NEST)
+ if (parse_info.name[parse_info.nest_depth] == NULL
+ || parse_info.nest_depth + 1 > MAX_NAME_NEST)
return 0;
++parse_info.nest_depth;
parse_info.pre_state = S_CATEGORY;
@@ -761,24 +777,24 @@ f_left_brace(str, token, db)
}
static int
-f_right_brace(str, token, db)
- char *str;
- Token token;
- Database *db;
+f_right_brace(
+ const char *str,
+ Token token,
+ Database *db)
{
- if(parse_info.nest_depth < 1)
+ if (parse_info.nest_depth < 1)
return 0;
- switch(parse_info.pre_state){
+ switch (parse_info.pre_state) {
case S_NULL:
case S_NAME:
return 0;
case S_VALUE:
- if(! store_to_database(db))
+ if (! store_to_database(db))
return 0;
/* fall into next case */
case S_CATEGORY:
- if(parse_info.name[parse_info.nest_depth] != NULL){
+ if (parse_info.name[parse_info.nest_depth] != NULL) {
Xfree(parse_info.name[parse_info.nest_depth]);
parse_info.name[parse_info.nest_depth] = NULL;
}
@@ -792,10 +808,10 @@ f_right_brace(str, token, db)
}
static int
-f_double_quote(str, token, db)
- char *str;
- Token token;
- Database *db;
+f_double_quote(
+ const char *str,
+ Token token,
+ Database *db)
{
char word[BUFSIZE];
char* wordp;
@@ -809,18 +825,18 @@ f_double_quote(str, token, db)
return 0;
len = 0;
- switch(parse_info.pre_state){
+ switch (parse_info.pre_state) {
case S_NULL:
case S_CATEGORY:
goto err;
case S_NAME:
case S_VALUE:
len = get_quoted_word(str, wordp);
- if(len < 1)
+ if (len < 1)
goto err;
- if( (parse_info.bufsize + (int)strlen(wordp) +1)
- >= parse_info.bufMaxSize){
- if(realloc_parse_info(strlen(wordp) +1) == False){
+ if ((parse_info.bufsize + (int)strlen(wordp) + 1)
+ >= parse_info.bufMaxSize) {
+ if (realloc_parse_info(strlen(wordp)+1) == False) {
goto err;
}
}
@@ -831,30 +847,33 @@ f_double_quote(str, token, db)
default:
goto err;
}
- if (wordp != word) Xfree (wordp);
+ if (wordp != word)
+ Xfree (wordp);
return len; /* including length of token */
err:
- if (wordp != word) Xfree (wordp);
+ if (wordp != word)
+ Xfree (wordp);
return 0;
}
static int
-f_backslash(str, token, db)
- char *str;
- Token token;
- Database *db;
+f_backslash(
+ const char *str,
+ Token token,
+ Database *db)
{
return f_default(str, token, db);
}
static int
-f_numeric(str, token, db)
- char *str;
- Token token;
- Database *db;
+f_numeric(
+ const char *str,
+ Token token,
+ Database *db)
{
- char word[BUFSIZE], *p;
+ char word[BUFSIZE];
+ const char *p;
char* wordp;
int len;
int token_len;
@@ -866,7 +885,7 @@ f_numeric(str, token, db)
if (wordp == NULL)
return 0;
- switch(parse_info.pre_state){
+ switch (parse_info.pre_state) {
case S_NULL:
case S_CATEGORY:
goto err;
@@ -875,11 +894,11 @@ f_numeric(str, token, db)
token_len = token_tbl[token].len;
p = str + token_len;
len = get_word(p, wordp);
- if(len < 1)
+ if (len < 1)
goto err;
- if( (parse_info.bufsize + token_len + (int)strlen(wordp) +1)
- >= parse_info.bufMaxSize){
- if(realloc_parse_info(token_len + strlen(wordp) +1) == False)
+ if ((parse_info.bufsize + token_len + (int)strlen(wordp) + 1)
+ >= parse_info.bufMaxSize) {
+ if (realloc_parse_info(token_len + strlen(wordp) + 1) == False)
goto err;
}
strncpy(&parse_info.buf[parse_info.bufsize], str, token_len);
@@ -890,19 +909,21 @@ f_numeric(str, token, db)
default:
goto err;
}
- if (wordp != word) Xfree (wordp);
+ if (wordp != word)
+ Xfree (wordp);
return len + token_len;
err:
- if (wordp != word) Xfree (wordp);
+ if (wordp != word)
+ Xfree (wordp);
return 0;
}
static int
-f_default(str, token, db)
- char *str;
- Token token;
- Database *db;
+f_default(
+ const char *str,
+ Token token,
+ Database *db)
{
char word[BUFSIZE], *p;
char* wordp;
@@ -916,23 +937,23 @@ f_default(str, token, db)
return 0;
len = get_word(str, wordp);
- if(len < 1)
+ if (len < 1)
goto err;
- switch(parse_info.pre_state){
+ switch (parse_info.pre_state) {
case S_NULL:
- if(parse_info.category != NULL)
+ if (parse_info.category != NULL)
goto err;
p = (char *)Xmalloc(strlen(wordp) + 1);
- if(p == NULL)
+ if (p == NULL)
goto err;
strcpy(p, wordp);
parse_info.category = p;
parse_info.pre_state = S_CATEGORY;
break;
case S_CATEGORY:
- if(parse_info.nest_depth == 0){
- if(check_category_end(str)){
+ if (parse_info.nest_depth == 0) {
+ if (check_category_end(str)) {
/* end of category is detected.
clear context and zap to end of this line */
clear_parse_info();
@@ -941,10 +962,10 @@ f_default(str, token, db)
}
}
p = (char *)Xmalloc(strlen(wordp) + 1);
- if(p == NULL)
+ if (p == NULL)
goto err;
strcpy(p, wordp);
- if(parse_info.name[parse_info.nest_depth] != NULL){
+ if (parse_info.name[parse_info.nest_depth] != NULL) {
Xfree(parse_info.name[parse_info.nest_depth]);
}
parse_info.name[parse_info.nest_depth] = p;
@@ -952,9 +973,9 @@ f_default(str, token, db)
break;
case S_NAME:
case S_VALUE:
- if( (parse_info.bufsize + (int)strlen(wordp) +1 )
- >= parse_info.bufMaxSize){
- if(realloc_parse_info(strlen(wordp) +1) == False)
+ if ((parse_info.bufsize + (int)strlen(wordp) + 1)
+ >= parse_info.bufMaxSize) {
+ if (realloc_parse_info(strlen(wordp) + 1) == False)
goto err;
}
strcpy(&parse_info.buf[parse_info.bufsize], wordp);
@@ -964,30 +985,32 @@ f_default(str, token, db)
default:
goto err;
}
- if (wordp != word) Xfree (wordp);
+ if (wordp != word)
+ Xfree (wordp);
return len;
err:
- if (wordp != word) Xfree (wordp);
+ if (wordp != word)
+ Xfree (wordp);
return 0;
}
/************************************************************************/
-#ifdef DEBUG
+#ifdef DEBUG
static void
-PrintDatabase(db)
- Database db;
+PrintDatabase(
+ Database db)
{
Database p = db;
int i = 0, j;
printf("***\n*** BEGIN Database\n***\n");
- while(p){
+ while (p) {
printf("%3d: ", i++);
printf("%s, %s, ", p->category, p->name);
printf("\t[%d: ", p->value_num);
- for(j = 0; j < p->value_num; ++j){
+ for (j = 0; j < p->value_num; ++j) {
printf("%s, ", p->value[j]);
}
printf("]\n");
@@ -998,20 +1021,20 @@ PrintDatabase(db)
#endif
static void
-DestroyDatabase(db)
- Database db;
+DestroyDatabase(
+ Database db)
{
Database p = db;
- while(p){
- if(p->category != NULL){
+ while (p) {
+ if (p->category != NULL) {
Xfree(p->category);
}
- if(p->name != NULL){
+ if (p->name != NULL) {
Xfree(p->name);
}
- if(p->value != (char **)NULL){
- if(*p->value != NULL){
+ if (p->value != (char **)NULL) {
+ if (*p->value != NULL) {
Xfree(*p->value);
}
Xfree((char *)p->value);
@@ -1023,13 +1046,13 @@ DestroyDatabase(db)
}
static int
-CountDatabase(db)
- Database db;
+CountDatabase(
+ Database db)
{
Database p = db;
int cnt = 0;
- while(p){
+ while (p) {
++cnt;
p = p->next;
}
@@ -1037,8 +1060,8 @@ CountDatabase(db)
}
static Database
-CreateDatabase(dbfile)
- char *dbfile;
+CreateDatabase(
+ char *dbfile)
{
Database db = (Database)NULL;
FILE *fd;
@@ -1049,26 +1072,25 @@ CreateDatabase(dbfile)
int error = 0;
fd = _XFopenFile(dbfile, "r");
- if(fd == (FILE *)NULL){
+ if (fd == (FILE *)NULL)
return NULL;
- }
bzero(&line, sizeof(Line));
init_parse_info();
do {
int rc = read_line(fd, &line);
- if(rc < 0){
+ if (rc < 0) {
error = 1;
break;
- }else if(rc == 0){
+ } else if (rc == 0) {
break;
}
p = line.str;
- while(*p){
+ while (*p) {
token = get_token(p);
len = (*token_tbl[token].parse_proc)(p, token, &db);
- if(len < 1){
+ if (len < 1) {
error = 1;
break;
}
@@ -1076,11 +1098,11 @@ CreateDatabase(dbfile)
}
} while (!error);
- if(parse_info.pre_state != S_NULL){
+ if (parse_info.pre_state != S_NULL) {
clear_parse_info();
error = 1;
}
- if(error){
+ if (error) {
#ifdef DEBUG
fprintf(stderr, "database format error at line %d.\n", line.seq);
#endif
@@ -1128,12 +1150,12 @@ static XlcDatabaseList _db_list = (XlcDatabaseList)NULL;
/* This function retrieves XLocale database information. */
/************************************************************************/
void
-_XlcGetResource(lcd, category, class, value, count)
- XLCd lcd;
- char *category;
- char *class;
- char ***value;
- int *count;
+_XlcGetResource(
+ XLCd lcd,
+ const char *category,
+ const char *class,
+ char ***value,
+ int *count)
{
XLCdPublicMethodsPart *methods = XLC_PUBLIC_METHODS(lcd);
@@ -1147,20 +1169,20 @@ _XlcGetResource(lcd, category, class, value, count)
/* This function retrieves XLocale database information. */
/************************************************************************/
void
-_XlcGetLocaleDataBase(lcd, category, name, value, count)
- XLCd lcd;
- char *category;
- char *name;
- char ***value;
- int *count;
+_XlcGetLocaleDataBase(
+ XLCd lcd,
+ const char *category,
+ const char *name,
+ char ***value,
+ int *count)
{
XlcDatabase lc_db = (XlcDatabase)XLC_PUBLIC(lcd, xlocale_db);
XrmQuark category_q, name_q;
category_q = XrmStringToQuark(category);
name_q = XrmStringToQuark(name);
- for(; lc_db->db; ++lc_db){
- if(category_q == lc_db->category_q && name_q == lc_db->name_q){
+ for (; lc_db->db; ++lc_db) {
+ if (category_q == lc_db->category_q && name_q == lc_db->name_q) {
*value = lc_db->db->value;
*count = lc_db->db->value_num;
return;
@@ -1180,23 +1202,23 @@ _XlcGetLocaleDataBase(lcd, category, name, value, count)
/* remove it from the cache list and free work area. */
/************************************************************************/
void
-_XlcDestroyLocaleDataBase(lcd)
- XLCd lcd;
+_XlcDestroyLocaleDataBase(
+ XLCd lcd)
{
XlcDatabase lc_db = (XlcDatabase)XLC_PUBLIC(lcd, xlocale_db);
XlcDatabaseList p, prev;
- for(p = _db_list, prev = (XlcDatabaseList)NULL; p;
- prev = p, p = p->next){
- if(p->lc_db == lc_db){
- if((-- p->ref_count) < 1){
- if(p->lc_db != (XlcDatabase)NULL){
+ for (p = _db_list, prev = (XlcDatabaseList)NULL; p;
+ prev = p, p = p->next) {
+ if (p->lc_db == lc_db) {
+ if ((-- p->ref_count) < 1) {
+ if (p->lc_db != (XlcDatabase)NULL) {
Xfree((char *)p->lc_db);
}
DestroyDatabase(p->database);
- if(prev == (XlcDatabaseList)NULL){
+ if (prev == (XlcDatabaseList)NULL) {
_db_list = p->next;
- }else{
+ } else {
prev->next = p->next;
}
Xfree((char*)p);
@@ -1214,8 +1236,8 @@ _XlcDestroyLocaleDataBase(lcd)
/* the specified XLCd. */
/************************************************************************/
XPointer
-_XlcCreateLocaleDataBase(lcd)
- XLCd lcd;
+_XlcCreateLocaleDataBase(
+ XLCd lcd)
{
XlcDatabaseList list, new;
Database p, database = (Database)NULL;
@@ -1225,13 +1247,16 @@ _XlcCreateLocaleDataBase(lcd)
int i, n;
name = _XlcFileName(lcd, "locale");
- if(name == NULL){
+ if (name == NULL)
return (XPointer)NULL;
- }
+#ifndef __UNIXOS2__
name_q = XrmStringToQuark(name);
- for(list = _db_list; list; list = list->next){
- if(name_q == list->name_q){
+#else
+ name_q = XrmStringToQuark((char*)__XOS2RedirRoot(name));
+#endif
+ for (list = _db_list; list; list = list->next) {
+ if (name_q == list->name_q) {
list->ref_count++;
Xfree (name);
return XLC_PUBLIC(lcd, xlocale_db) = (XPointer)list->lc_db;
@@ -1239,24 +1264,23 @@ _XlcCreateLocaleDataBase(lcd)
}
database = CreateDatabase(name);
- if(database == (Database)NULL){
+ if (database == (Database)NULL) {
Xfree (name);
return (XPointer)NULL;
}
n = CountDatabase(database);
lc_db = (XlcDatabase)Xmalloc(sizeof(XlcDatabaseRec) * (n + 1));
- if(lc_db == (XlcDatabase)NULL){
+ if (lc_db == (XlcDatabase)NULL)
goto err;
- }
bzero(lc_db, sizeof(XlcDatabaseRec) * (n + 1));
- for(p = database, i = 0; p && i < n; p = p->next, ++i){
+ for (p = database, i = 0; p && i < n; p = p->next, ++i) {
lc_db[i].category_q = XrmStringToQuark(p->category);
lc_db[i].name_q = XrmStringToQuark(p->name);
lc_db[i].db = p;
}
new = (XlcDatabaseList)Xmalloc(sizeof(XlcDatabaseListRec));
- if(new == (XlcDatabaseList)NULL){
+ if (new == (XlcDatabaseList)NULL) {
goto err;
}
new->name_q = name_q;
@@ -1271,7 +1295,7 @@ _XlcCreateLocaleDataBase(lcd)
err:
DestroyDatabase(database);
- if(lc_db != (XlcDatabase)NULL){
+ if (lc_db != (XlcDatabase)NULL) {
Xfree((char *)lc_db);
}
Xfree (name);
diff --git a/src/xlibi18n/lcDynamic.c b/src/xlibi18n/lcDynamic.c
index 64484382..e443a056 100644
--- a/src/xlibi18n/lcDynamic.c
+++ b/src/xlibi18n/lcDynamic.c
@@ -32,10 +32,22 @@ from The Open Group.
* Modifier: Takanori Tateno FUJITSU LIMITED
*
*/
+/* $XFree86: xc/lib/X11/lcDynamic.c,v 1.4 2001/01/17 19:41:53 dawes Exp $ */
+
+/*
+ * A dynamically loaded locale.
+ * Supports: All locale names.
+ * How: Loads $(XLOCALEDIR)/xi18n.so and forwards the request to that library.
+ * Platforms: Only those defining USE_DYNAMIC_LOADER (none known).
+ */
+
#ifdef USE_DYNAMIC_LOADER
#include <stdio.h>
#include <string.h>
+#include <dlfcn.h>
+
#include "Xlibint.h"
+#include "Xlcint.h"
#ifndef XLOCALEDIR
#define XLOCALEDIR "/usr/lib/X11/locale"
@@ -43,18 +55,9 @@ from The Open Group.
#define LCLIBNAME "xi18n.so"
-extern void *dlopen();
-extern void *dlsym();
-extern int dlclose();
-extern char *dlerror();
-
-#define LAZY 1
-#define NOW 2
-#define GLOBAL 0x100
-
XLCd
-_XlcDynamicLoader(name)
- char *name;
+_XlcDynamicLoader(
+ const char *name)
{
char libpath[1024];
XLCdMethods _XlcGenericMethods;
@@ -64,11 +67,11 @@ _XlcDynamicLoader(name)
sprintf(libpath,"%s/%s/%s",
XLOCALEDIR,name,LCLIBNAME);
nlshandler = dlopen(libpath,LAZY);
- _XlcGenericMethods = (XLCdMethods)dlsym(nlshandler,
- "genericMethods");
+ _XlcGenericMethods = (XLCdMethods)dlsym(nlshandler,"genericMethods");
lcd = _XlcCreateLC(name,_XlcGenericMethods);
-
return lcd;
}
+#else
+typedef int dummy;
#endif /* USE_DYNAMIC_LOADER */
diff --git a/src/xlibi18n/lcFile.c b/src/xlibi18n/lcFile.c
index 164674fc..66df63f5 100644
--- a/src/xlibi18n/lcFile.c
+++ b/src/xlibi18n/lcFile.c
@@ -23,24 +23,38 @@
* SOFTWARE.
*
*/
+/* $XFree86: xc/lib/X11/lcFile.c,v 3.32 2003/03/25 04:18:09 dawes Exp $ */
+
+#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "Xlibint.h"
#include "XlcPubI.h"
#include <X11/Xos.h>
-#ifdef X_NOT_STDC_ENV
-extern char *getenv();
+#if 0
+#include <unistd.h> /* in theory delivers getresuid/gid prototypes,
+ * in practice only the Linux syscall wrapper is there. */
#endif
+
/************************************************************************/
+#ifdef __UNIXOS2__
+# define seteuid setuid
+#endif
#define iscomment(ch) ((ch) == '#' || (ch) == '\0')
-#if defined(WIN32) || defined(__EMX__) /* || defined(OS2) */
+#if defined(WIN32)
#define isreadable(f) (_XAccessFile(f))
#else
#define isreadable(f) ((access((f), R_OK) != -1) ? 1 : 0)
#endif
+#ifndef __UNIXOS2__
+#define LC_PATHDELIM ':'
+#else
+#define LC_PATHDELIM ';'
+#endif
+
#define XLC_BUFSIZE 256
#ifndef X_NOT_POSIX
@@ -69,27 +83,32 @@ extern char *getenv();
#define NUM_LOCALEDIR 64
+/* Splits a NUL terminated line into constituents, at colons and newline
+ characters. Leading whitespace is removed from constituents. The
+ constituents are stored at argv[0..argsize-1]. The number of stored
+ constituents (<= argsize) is returned. The line is destructively
+ modified. */
static int
-parse_line(line, argv, argsize)
- char *line;
- char **argv;
- int argsize;
+parse_line(
+ char *line,
+ char **argv,
+ int argsize)
{
int argc = 0;
char *p = line;
- while(argc < argsize){
- while(isspace(*p)){
+ while (argc < argsize) {
+ while (isspace(*p)) {
++p;
}
- if(*p == '\0'){
+ if (*p == '\0') {
break;
}
argv[argc++] = p;
- while(*p != ':' && *p != '\n' && *p != '\0'){
+ while (*p != ':' && *p != '\n' && *p != '\0') {
++p;
}
- if(*p == '\0'){
+ if (*p == '\0') {
break;
}
*p++ = '\0';
@@ -98,31 +117,64 @@ parse_line(line, argv, argsize)
return argc;
}
-/* parse the colon separated list in path into argv */
-int
-_XlcParsePath(path, argv, argsize)
- char *path;
- char **argv;
- int argsize;
+#ifdef __UNIXOS2__
+
+/* fg021216: entries in locale files are separated by colons while under
+ OS/2, path entries are separated by semicolon, so we need two functions */
+
+static int
+parse_line1(
+ char *line,
+ char **argv,
+ int argsize)
{
- char *p = path;
- int i, n;
+ int argc = 0;
+ char *p = line;
-#if 0
- while((p = strchr(p, ':')) != NULL){
- *p = ' '; /* place space on delimter */
+ while (argc < argsize) {
+ while (isspace(*p)) {
+ ++p;
+ }
+ if (*p == '\0') {
+ break;
+ }
+ argv[argc++] = p;
+ while (*p != ';' && *p != '\n' && *p != '\0') {
+ ++p;
+ }
+ if (*p == '\0') {
+ break;
+ }
+ *p++ = '\0';
}
-#endif
+
+ return argc;
+}
+#endif /* __UNIXOS2__ */
+
+/* Splits a colon separated list of directories, and returns the constituent
+ paths (without trailing slash). At most argsize constituents are stored
+ at argv[0..argsize-1]. The number of stored constituents is returned. */
+static int
+_XlcParsePath(
+ char *path,
+ char **argv,
+ int argsize)
+{
+ char *p = path;
+ int n, i;
+
+#ifndef __UNIXOS2__
n = parse_line(path, argv, argsize);
- if(n == 0){
- return 0;
- }
- for(i = 0; i < n; ++i){
+#else
+ n = parse_line1(path, argv, argsize);
+#endif
+ for (i = 0; i < n; ++i) {
int len;
p = argv[i];
len = strlen(p);
- if(p[len - 1] == '/'){
- /* eliminate slash */
+ if (len > 0 && p[len - 1] == '/') {
+ /* eliminate trailing slash */
p[len - 1] = '\0';
}
}
@@ -134,99 +186,157 @@ _XlcParsePath(path, argv, argsize)
#endif
static void
-xlocaledir(buf, buf_len)
- char *buf;
- int buf_len;
+xlocaledir(
+ char *buf,
+ int buf_len)
{
- char *dir, *p = buf;
+ char *p = buf;
int len = 0;
+#ifndef NO_XLOCALEDIR
+ char *dir;
+ int priv = 1;
+
dir = getenv("XLOCALEDIR");
- if(dir != NULL){
- len = strlen(dir);
- strncpy(p, dir, buf_len);
- if (len < buf_len) {
- p[len++] = ':';
- p += len;
+
+ if (dir) {
+ /*
+ * Only use the user-supplied path if the process isn't priviledged.
+ */
+ if (getuid() == geteuid() && getgid() == getegid()) {
+#if defined(HASSETUGID)
+ priv = issetugid();
+#elif defined(HASGETRESUID)
+ {
+ uid_t ruid, euid, suid;
+ gid_t rgid, egid, sgid;
+ if ((getresuid(&ruid, &euid, &suid) == 0) &&
+ (getresgid(&rgid, &egid, &sgid) == 0))
+ priv = (euid != suid) || (egid != sgid);
+ }
+#else
+ /*
+ * If there are saved ID's the process might still be priviledged
+ * even though the above test succeeded. If issetugid() and
+ * getresgid() aren't available, test this by trying to set
+ * euid to 0.
+ *
+ * Note: this only protects setuid-root clients. It doesn't
+ * protect other setuid or any setgid clients. If this tradeoff
+ * isn't acceptable, set DisableXLocaleDirEnv to YES in host.def.
+ */
+ unsigned int oldeuid;
+ oldeuid = geteuid();
+ if (seteuid(0) != 0) {
+ priv = 0;
+ } else {
+ seteuid(oldeuid);
+ priv = 1;
+ }
+#endif
+ }
+ if (!priv) {
+ len = strlen(dir);
+ strncpy(p, dir, buf_len);
+ if (len < buf_len) {
+ p[len++] = LC_PATHDELIM;
+ p += len;
+ }
}
}
+#endif /* NO_XLOCALEDIR */
+
if (len < buf_len)
- strncpy(p, XLOCALEDIR, buf_len-len);
+#ifndef __UNIXOS2__
+ strncpy(p, XLOCALEDIR, buf_len - len);
+#else
+ strncpy(p,__XOS2RedirRoot(XLOCALEDIR), buf_len - len);
+#endif
buf[buf_len-1] = '\0';
}
-enum { LtoR, RtoL };
+/* Mapping direction */
+typedef enum {
+ LtoR, /* Map first field to second field */
+ RtoL /* Map second field to first field */
+} MapDirection;
static char *
-resolve_name(lc_name, file_name, direction)
- char *lc_name;
- char *file_name;
- int direction; /* mapping direction */
+resolve_name(
+ const char *lc_name,
+ char *file_name,
+ MapDirection direction)
{
FILE *fp;
char buf[XLC_BUFSIZE], *name = NULL;
fp = _XFopenFile (file_name, "r");
- if(fp == (FILE *)NULL){
+ if (fp == NULL)
return NULL;
- }
- while(fgets(buf, XLC_BUFSIZE, fp) != NULL){
+ while (fgets(buf, XLC_BUFSIZE, fp) != NULL) {
char *p = buf;
int n;
char *args[2], *from, *to;
- while(isspace(*p)){
+#ifdef __UNIXOS2__ /* Take out CR under OS/2 */
+ int len;
+
+ len = strlen(p);
+ if (len > 1) {
+ if (*(p+len-2) == '\r' && *(p+len-1) == '\n') {
+ *(p+len-2) = '\n';
+ *(p+len-1) = '\0';
+ }
+ }
+#endif
+ while (isspace(*p)) {
++p;
}
- if(iscomment(*p)){
+ if (iscomment(*p)) {
continue;
}
n = parse_line(p, args, 2); /* get first 2 fields */
- if(n != 2){
+ if (n != 2) {
continue;
}
- if(direction == LtoR){
+ if (direction == LtoR) {
from = args[0], to = args[1]; /* left to right */
- }else{
+ } else {
from = args[1], to = args[0]; /* right to left */
}
- if(! strcmp(from, lc_name)){
+ if (! strcmp(from, lc_name)) {
name = Xmalloc(strlen(to) + 1);
- if(name != NULL){
+ if (name != NULL) {
strcpy(name, to);
}
break;
}
}
- if(fp != (FILE *)NULL){
- fclose(fp);
- }
+ fclose(fp);
return name;
}
-/*
-#define isupper(ch) ('A' <= (ch) && (ch) <= 'Z')
-#define tolower(ch) ((ch) - 'A' + 'a')
-*/
+#define c_tolower(ch) ((ch) >= 'A' && (ch) <= 'Z' ? (ch) - 'A' + 'a' : (ch))
+
static char *
-lowercase(dst, src)
- char *dst;
- char *src;
+lowercase(
+ char *dst,
+ const char *src)
{
- char *s, *t;
+ const char *s;
+ char *t;
- for(s = src, t = dst; *s; ++s, ++t){
- *t = isupper(*s) ? tolower(*s) : *s;
- }
+ for (s = src, t = dst; *s; ++s, ++t)
+ *t = c_tolower(*s);
*t = '\0';
return dst;
}
/************************************************************************/
char *
-_XlcFileName(lcd, category)
- XLCd lcd;
- char *category;
+_XlcFileName(
+ XLCd lcd,
+ const char *category)
{
char *siname;
char cat[XLC_BUFSIZE], dir[XLC_BUFSIZE];
@@ -234,16 +344,15 @@ _XlcFileName(lcd, category)
char *args[NUM_LOCALEDIR];
char *file_name = NULL;
- if(lcd == (XLCd)NULL){
+ if (lcd == (XLCd)NULL)
return NULL;
- }
siname = XLC_PUBLIC(lcd, siname);
lowercase(cat, category);
xlocaledir(dir,XLC_BUFSIZE);
n = _XlcParsePath(dir, args, NUM_LOCALEDIR);
- for(i = 0; i < n; ++i){
+ for (i = 0; i < n; ++i) {
char buf[PATH_MAX], *name;
name = NULL;
@@ -252,20 +361,20 @@ _XlcFileName(lcd, category)
sprintf(buf, "%s/%s.dir", args[i], cat);
name = resolve_name(siname, buf, RtoL);
}
- if(name == NULL){
+ if (name == NULL) {
continue;
}
- if(*name == '/'){
+ if (*name == '/') {
/* supposed to be absolute path name */
file_name = name;
- }else{
+ } else {
file_name = Xmalloc(2 + (args[i] ? strlen (args[i]) : 0) +
(name ? strlen (name) : 0));
if (file_name != NULL)
sprintf(file_name, "%s/%s", args[i], name);
Xfree(name);
}
- if(isreadable(file_name)){
+ if (isreadable(file_name)) {
break;
}
Xfree(file_name);
@@ -281,25 +390,26 @@ _XlcFileName(lcd, category)
#endif
int
-_XlcResolveLocaleName(lc_name, pub)
- char* lc_name;
- XLCdPublicPart* pub;
+_XlcResolveLocaleName(
+ const char* lc_name,
+ XLCdPublicPart* pub)
{
char dir[PATH_MAX], buf[PATH_MAX], *name = NULL;
char *dst;
int i, n, sinamelen;
char *args[NUM_LOCALEDIR];
- static char locale_alias[] = LOCALE_ALIAS;
+ static const char locale_alias[] = LOCALE_ALIAS;
+ char *tmp_siname;
xlocaledir (dir, PATH_MAX);
n = _XlcParsePath(dir, args, NUM_LOCALEDIR);
- for(i = 0; i < n; ++i){
+ for (i = 0; i < n; ++i) {
if ((2 + (args[i] ? strlen (args[i]) : 0) +
strlen (locale_alias)) < PATH_MAX) {
sprintf (buf, "%s/%s", args[i], locale_alias);
name = resolve_name (lc_name, buf, LtoR);
}
- if(name != NULL){
+ if (name != NULL) {
break;
}
}
@@ -324,7 +434,11 @@ _XlcResolveLocaleName(lc_name, pub)
* be "en_US.ISO8859-1", "en_US.utf8", "ru_RU.KOI-8", or ja_JP.SJIS,
* although it could be ja.SJIS too.
*/
- pub->siname = Xrealloc (pub->siname, 2 * (sinamelen + 1));
+ tmp_siname = Xrealloc (pub->siname, 2 * (sinamelen + 1));
+ if (tmp_siname == NULL) {
+ return 0;
+ }
+ pub->siname = tmp_siname;
/* language */
dst = &pub->siname[sinamelen + 1];
@@ -355,63 +469,82 @@ _XlcResolveI18NPath(buf, buf_len)
char *buf;
int buf_len;
{
- if(buf != NULL){
+ if (buf != NULL) {
xlocaledir(buf, buf_len);
}
return 1;
}
char *
-_XlcLocaleDirName(dir_name, lc_name)
+_XlcLocaleDirName(dir_name, dir_len, lc_name)
char *dir_name;
+ size_t dir_len;
char *lc_name;
{
- char dir[PATH_MAX], buf[PATH_MAX], *name = NULL;
- char *dst;
- int i, n, sinamelen;
- char *args[NUM_LOCALEDIR];
- static char locale_alias[] = LOCALE_ALIAS;
- char *target_name = (char*)0;
- char *target_dir = (char*)0;
-
- xlocaledir (dir, PATH_MAX);
- n = _XlcParsePath(dir, args, 256);
- for (i = 0; i < n; ++i){
- if ((2 + (args[i] ? strlen(args[i]) : 0) +
- strlen(locale_alias)) < PATH_MAX) {
- sprintf (buf, "%s/%s", args[i], locale_alias);
- name = resolve_name(lc_name, buf, LtoR);
+ char dir[PATH_MAX], buf[PATH_MAX], *name = NULL;
+ int i, n;
+ char *args[NUM_LOCALEDIR];
+ static char locale_alias[] = LOCALE_ALIAS;
+ char *target_name = (char*)0;
+ char *target_dir = (char*)0;
+
+ xlocaledir (dir, PATH_MAX);
+ n = _XlcParsePath(dir, args, 256);
+ for (i = 0; i < n; ++i) {
+
+ if ((2 + (args[i] ? strlen(args[i]) : 0) +
+ strlen(locale_alias)) < PATH_MAX) {
+ sprintf (buf, "%s/%s", args[i], locale_alias);
+ name = resolve_name(lc_name, buf, LtoR);
+ }
+
+ /* If name is not an alias, use lc_name for locale.dir search */
+ if (name == NULL)
+ name = lc_name;
+
+ /* look at locale.dir */
+
+ target_dir = args[i];
+ if (!target_dir) {
+ /* something wrong */
+ if (name != lc_name)
+ Xfree(name);
+ continue;
+ }
+ if ((1 + (target_dir ? strlen (target_dir) : 0) +
+ strlen("locale.dir")) < PATH_MAX) {
+ sprintf(buf, "%s/locale.dir", target_dir);
+ target_name = resolve_name(name, buf, RtoL);
+ }
+ if (name != lc_name)
+ Xfree(name);
+ if (target_name != NULL) {
+ char *p = 0;
+ if ((p = strstr(target_name, "/XLC_LOCALE"))) {
+ *p = '\0';
+ break;
+ }
+ Xfree(target_name);
+ target_name = NULL;
+ }
+ name = NULL;
}
- if (name != NULL){
- /* look at locale.dir */
- const char *cat = "locale";
-
- target_dir = args[i];
- if (!target_dir) {
- /* something wrong */
- continue;
- }
- if ((5 + (target_dir ? strlen (target_dir) : 0) +
- (cat ? strlen(cat) : 0)) < PATH_MAX) {
- sprintf(buf, "%s/%s.dir", target_dir, cat);
- target_name = resolve_name(name, buf, RtoL);
- }
- if (target_name != NULL) {
- char *p = 0;
- if (p = strstr(target_name, "/XLC_LOCALE")) {
- *p = '\0';
- break;
- }
- }
+ if (target_name == NULL) {
+ /* vendor locale name == Xlocale name, no expansion of alias */
+ target_dir = args[0];
+ target_name = lc_name;
+ }
+ /* snprintf(dir_name, dir_len, "%s/%", target_dir, target_name); */
+ strncpy(dir_name, target_dir, dir_len - 1);
+ if (strlen(target_dir) >= dir_len - 1) {
+ dir_name[dir_len - 1] = '\0';
+ } else {
+ strcat(dir_name, "/");
+ strncat(dir_name, target_name, dir_len - strlen(dir_name) - 1);
+ if (strlen(target_name) >= dir_len - strlen(dir_name) - 1)
+ dir_name[dir_len - 1] = '\0';
}
- }
- if (target_name == NULL) {
- /* vendor locale name == Xlocale name, no expansion of alias */
- target_dir = args[0];
- target_name = lc_name;
- }
- strcpy(dir_name, target_dir);
- strcat(dir_name, "/");
- strcat(dir_name, target_name);
- return dir_name;
+ if (target_name != lc_name)
+ Xfree(target_name);
+ return dir_name;
}
diff --git a/src/xlibi18n/lcGeneric.c b/src/xlibi18n/lcGeneric.c
index 48261139..7922928e 100644
--- a/src/xlibi18n/lcGeneric.c
+++ b/src/xlibi18n/lcGeneric.c
@@ -28,14 +28,15 @@
* This is source code modified by FUJITSU LIMITED under the Joint
* Development Agreement for the CDE/Motif PST.
*/
+/* $XFree86: xc/lib/X11/lcGeneric.c,v 3.19 2003/05/27 16:55:27 tsi Exp $ */
#include <stdio.h>
#include "Xlibint.h"
#include "XlcGeneric.h"
-static XLCd create();
-static Bool initialize();
-static void destroy();
+static XLCd create (const char *name, XLCdMethods methods);
+static Bool initialize (XLCd lcd);
+static void destroy (XLCd lcd);
static XLCdPublicMethodsRec genericMethods = {
{ NULL }, /* use default methods */
@@ -51,9 +52,9 @@ static XLCdPublicMethodsRec genericMethods = {
XLCdMethods _XlcGenericMethods = (XLCdMethods) &genericMethods;
static XLCd
-create(name, methods)
- char *name;
- XLCdMethods methods;
+create(
+ const char *name,
+ XLCdMethods methods)
{
XLCd lcd;
XLCdPublicMethods new;
@@ -71,7 +72,7 @@ create(name, methods)
new = (XLCdPublicMethods) Xmalloc(sizeof(XLCdPublicMethodsRec));
if (new == NULL)
goto err;
- *new = *((XLCdPublicMethods) methods);
+ memcpy(new,methods,sizeof(XLCdPublicMethodsRec));
lcd->methods = (XLCdMethods) new;
return lcd;
@@ -82,9 +83,9 @@ err:
}
static Bool
-string_to_encoding(str, encoding)
- char *str;
- char *encoding;
+string_to_encoding(
+ const char *str,
+ char *encoding)
{
char *next;
long value;
@@ -117,18 +118,18 @@ string_to_encoding(str, encoding)
}
static Bool
-string_to_ulong(str, value)
-char *str;
-unsigned long *value;
+string_to_ulong(
+ const char *str,
+ unsigned long *value)
{
- char *tmp1 = str;
- int base;
+ const char *tmp1 = str;
+ int base;
- if(*tmp1++ != '\\'){
+ if (*tmp1++ != '\\') {
tmp1--;
base = 10;
- }else{
- switch(*tmp1++){
+ } else {
+ switch (*tmp1++) {
case 'x':
base = 16;
break;
@@ -142,15 +143,15 @@ unsigned long *value;
return(False);
}
}
- *value = (unsigned) strtol(tmp1, NULL, base);
+ *value = (unsigned long) strtol(tmp1, NULL, base);
return(True);
}
static Bool
-add_charset(codeset, charset)
- CodeSet codeset;
- XlcCharSet charset;
+add_charset(
+ CodeSet codeset,
+ XlcCharSet charset)
{
XlcCharSet *new_list;
int num;
@@ -172,8 +173,8 @@ add_charset(codeset, charset)
}
static CodeSet
-add_codeset(gen)
- XLCdGenericPart *gen;
+add_codeset(
+ XLCdGenericPart *gen)
{
CodeSet new, *new_list;
int num;
@@ -205,11 +206,11 @@ err:
}
static Bool
-add_parse_list(gen, type, encoding, codeset)
- XLCdGenericPart *gen;
- EncodingType type;
- char *encoding;
- CodeSet codeset;
+add_parse_list(
+ XLCdGenericPart *gen,
+ EncodingType type,
+ const char *encoding,
+ CodeSet codeset)
{
ParseInfo new, *new_list;
char *str;
@@ -270,8 +271,8 @@ err:
}
static void
-free_charset(lcd)
- XLCd lcd;
+free_charset(
+ XLCd lcd)
{
XLCdGenericPart *gen = XLC_GENERIC_PART(lcd);
ParseInfo *parse_info;
@@ -279,7 +280,7 @@ free_charset(lcd)
if (gen->mb_parse_table)
Xfree(gen->mb_parse_table);
- if ((num = gen->mb_parse_list_num)) {
+ if ((num = gen->mb_parse_list_num) > 0) {
for (parse_info = gen->mb_parse_list; num-- > 0; parse_info++) {
if ((*parse_info)->encoding)
Xfree((*parse_info)->encoding);
@@ -288,23 +289,28 @@ free_charset(lcd)
Xfree(gen->mb_parse_list);
}
- if ((num = gen->codeset_num))
+ if ((num = gen->codeset_num) > 0)
Xfree(gen->codeset_list);
}
+
/* For VW/UDC */
#define FORWARD (unsigned long)'+'
#define BACKWARD (unsigned long)'-'
-static char *getscope(str,scp)
-char *str;
-FontScope scp;
+static const char *
+getscope(
+ const char *str,
+ FontScope scp)
{
- char* next;
- unsigned long start=0,end=0,dest=0,shift=0,direction=0;
- sscanf(str,"[\\x%lx,\\x%lx]->\\x%lx", &start, &end,&dest);
- if( dest ){
- if(dest >= start ){
+ unsigned long start = 0;
+ unsigned long end = 0;
+ unsigned long dest = 0;
+ unsigned long shift = 0;
+ unsigned long direction = 0;
+ sscanf(str,"[\\x%lx,\\x%lx]->\\x%lx", &start, &end, &dest);
+ if (dest) {
+ if (dest >= start) {
shift = dest - start;
direction = FORWARD ;
} else {
@@ -318,115 +324,119 @@ FontScope scp;
scp->shift_direction
= direction ;
/* .......... */
- while(*str){
- if(*str == ',' && *(str+1) == '['){
+ while (*str) {
+ if (*str == ',' && *(str+1) == '[')
break;
- }
str++;
}
- next = str+1 ;
- return(next);
+ return str+1;
}
-static int count_scopemap(str)
-char *str;
+static int
+count_scopemap(
+ const char *str)
{
- char *ptr;
+ const char *ptr;
int num=0;
- for(ptr=str;*ptr;ptr++){
- if(*ptr == ']'){
- num ++;
+ for (ptr=str; *ptr; ptr++) {
+ if (*ptr == ']') {
+ num++;
}
}
- return(num);
+ return num;
}
-FontScope _XlcParse_scopemaps(str,size)
-char *str;
-int *size;
+FontScope
+_XlcParse_scopemaps(
+ const char *str,
+ int *size)
{
- int num=0,i;
- FontScope scope,sc_ptr;
- char *str_sc;
- num = count_scopemap(str);
- scope = (FontScope )Xmalloc(num * sizeof(FontScopeRec));
- if(scope == NULL) {
- return (NULL);
- }
- for (i=0,str_sc=str,sc_ptr=scope;
- i < num; i++,sc_ptr++){
- str_sc = getscope(str_sc,sc_ptr);
- }
- *size = num;
- return (scope);
+ int num=0,i;
+ FontScope scope,sc_ptr;
+ const char *str_sc;
+
+ num = count_scopemap(str);
+ scope = (FontScope) Xmalloc(num * sizeof(FontScopeRec));
+ if (scope == NULL)
+ return NULL;
+
+ for (i=0, str_sc=str, sc_ptr=scope; i < num; i++, sc_ptr++) {
+ str_sc = getscope(str_sc, sc_ptr);
+ }
+ *size = num;
+ return scope;
}
-void _XlcDbg_printValue(str,value,num)
-char *str;
-char **value;
-int num;
+void
+_XlcDbg_printValue(
+ const char *str,
+ char **value,
+ int num)
{
/*
int i;
- for(i=0;i<num;i++){
- fprintf(stderr,"%s value[%d] = %s\n",str,i,value[i]);
- }
+ for (i = 0; i < num; i++)
+ fprintf(stderr, "%s value[%d] = %s\n", str, i, value[i]);
*/
}
-static void dmpscope(name,sc,num)
-char* name;
-FontScope sc;
-int num;
+static void
+dmpscope(
+ const char* name,
+ FontScope sc,
+ int num)
{
/*
int i;
- fprintf(stderr,"dmpscope %s\n",name);
- for(i=0;i<num;i++){
+ fprintf(stderr, "dmpscope %s\n", name);
+ for (i=0; i<num; i++)
fprintf(stderr,"%x %x %x %x \n",
sc[i].start,
sc[i].end,
sc[i].shift,
sc[i].shift_direction);
- }
- fprintf(stderr,"dmpscope end\n");
+ fprintf(stderr, "dmpscope end\n");
*/
}
-static XlcCharSet srch_charset_define(name,new)
-char *name;
-int *new;
+static XlcCharSet
+srch_charset_define(
+ const char *name,
+ int *new)
{
- XlcCharSet charset = NULL;
+ XlcCharSet charset;
+
*new = 0;
charset = _XlcGetCharSet(name);
if (charset == NULL &&
(charset = _XlcCreateDefaultCharSet(name, ""))) {
_XlcAddCharSet(charset);
*new = 1;
+ charset->source = CSsrcXLC;
}
- return(charset);
+ return charset;
}
-static void read_charset_define(lcd,gen)
-XLCd lcd;
-XLCdGenericPart *gen;
+static void
+read_charset_define(
+ XLCd lcd,
+ XLCdGenericPart *gen)
{
- int i=0;
- char csd[16],cset_name[256];
+ int i;
+ char csd[16], cset_name[256];
char name[BUFSIZ];
XlcCharSet charsetd;
char **value;
- int num,new;
+ int num, new;
XlcSide side = XlcUnknown;
char *tmp;
- for(i=0;;i++){ /* loop start */
+ for (i=0; ; i++) { /* loop start */
charsetd = 0;
sprintf(csd, "csd%d", i);
- /* charset_name */
- sprintf(name, "%s.%s", csd , "charset_name");
+ /* charset_name */
+ sprintf(name, "%s.%s", csd, "charset_name");
_XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num);
_XlcDbg_printValue(name,value,num);
if (num > 0) {
@@ -437,108 +447,102 @@ XLCdGenericPart *gen;
_XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num);
if (num > 0) {
_XlcDbg_printValue(name,value,num);
- if( !_XlcNCompareISOLatin1(value[0], "none", 4) ){
- side = XlcNONE ;
- strcat(cset_name,":none");
- } else
- if( !_XlcNCompareISOLatin1(value[0], "GL", 2) ){
- side = XlcGL ;
+ if (!_XlcNCompareISOLatin1(value[0], "none", 4)) {
+ side = XlcGLGR;
+ } else if (!_XlcNCompareISOLatin1(value[0], "GL", 2)) {
+ side = XlcGL;
strcat(cset_name,":GL");
} else {
- side = XlcGR ;
+ side = XlcGR;
strcat(cset_name,":GR");
}
if (charsetd == NULL &&
(charsetd = srch_charset_define(cset_name,&new)) == NULL)
- return ;
+ return;
}
} else {
- if(i == 0){
- continue ;
- } else {
- break ;
- }
+ if (i == 0)
+ continue;
+ else
+ break;
}
- if(new){
+ if (new) {
tmp = (char *)Xmalloc(strlen(cset_name)+1);
- if(tmp == NULL){
- return ;
- }
+ if (tmp == NULL)
+ return;
strcpy(tmp,cset_name);
charsetd->name = tmp;
}
/* side */
- charsetd->side = side ;
+ charsetd->side = side ;
/* length */
- sprintf(name, "%s.%s", csd , "length");
+ sprintf(name, "%s.%s", csd, "length");
_XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num);
if (num > 0) {
_XlcDbg_printValue(name,value,num);
charsetd->char_size = atoi(value[0]);
}
/* gc_number */
- sprintf(name, "%s.%s", csd , "gc_number");
+ sprintf(name, "%s.%s", csd, "gc_number");
_XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num);
if (num > 0) {
_XlcDbg_printValue(name,value,num);
charsetd->set_size = atoi(value[0]);
}
/* string_encoding */
- sprintf(name, "%s.%s", csd , "string_encoding");
+ sprintf(name, "%s.%s", csd, "string_encoding");
_XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num);
if (num > 0) {
_XlcDbg_printValue(name,value,num);
- if(!strcmp("False",value[0])){
+ if (!strcmp("False",value[0])) {
charsetd->string_encoding = False;
} else {
charsetd->string_encoding = True;
}
}
/* sequence */
- sprintf(name, "%s.%s", csd , "sequence");
+ sprintf(name, "%s.%s", csd, "sequence");
_XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num);
if (num > 0) {
_XlcDbg_printValue(name,value,num);
/*
- if(charsetd->ct_sequence){
+ if (charsetd->ct_sequence) {
Xfree(charsetd->ct_sequence);
}
*/
tmp = (char *)Xmalloc(strlen(value[0])+1);
- if(tmp == NULL){
+ if (tmp == NULL)
return;
- }
charsetd->ct_sequence = tmp;
string_to_encoding(value[0],tmp);
}
/* encoding_name */
- sprintf(name, "%s.%s", csd , "encoding_name");
+ sprintf(name, "%s.%s", csd, "encoding_name");
_XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num);
if (num > 0) {
_XlcDbg_printValue(name,value,num);
/*
- if(charsetd->encoding_name){
+ if (charsetd->encoding_name) {
Xfree(charsetd->encoding_name);
}
*/
- tmp = (char *)Xmalloc(strlen(value[0]+1));
+ tmp = (char *)Xmalloc(strlen(value[0])+1);
strcpy(tmp,value[0]);
charsetd->encoding_name = tmp;
- charsetd->xrm_encoding_name =
- XrmStringToQuark(tmp);
+ charsetd->xrm_encoding_name = XrmStringToQuark(tmp);
}
+ _XlcAddCT(charsetd->name, charsetd->ct_sequence);
}
-
}
-SegConv
-add_conversion(gen)
-XLCdGenericPart *gen;
+static SegConv
+add_conversion(
+ XLCdGenericPart *gen)
{
SegConv new_list;
int num;
- if ((num = gen->segment_conv_num)){
+ if ((num = gen->segment_conv_num) > 0) {
new_list = (SegConv) Xrealloc(gen->segment_conv,
(num + 1) * sizeof(SegConvRec));
} else {
@@ -546,102 +550,83 @@ XLCdGenericPart *gen;
}
if (new_list == NULL)
- return False;
+ return NULL;
gen->segment_conv = new_list;
gen->segment_conv_num = num + 1;
- return (&new_list[num]);
+ return &new_list[num];
}
-static void read_segmentconversion(lcd,gen)
-XLCd lcd;
-XLCdGenericPart *gen;
+
+static void
+read_segmentconversion(
+ XLCd lcd,
+ XLCdGenericPart *gen)
{
- int i=0;
+ int i;
char conv[16];
char name[BUFSIZ];
char **value;
int num,new;
SegConv conversion;
- for(i=0 ; ; i++){ /* loop start */
+ for (i=0 ; ; i++) { /* loop start */
conversion = 0;
sprintf(conv, "conv%d", i);
/* length */
- sprintf(name, "%s.%s", conv , "length");
+ sprintf(name, "%s.%s", conv, "length");
_XlcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num);
if (num > 0) {
if (conversion == NULL &&
(conversion = add_conversion(gen)) == NULL) {
- return ;
+ return;
}
_XlcDbg_printValue(name,value,num);
} else {
- if(i == 0){
+ if (i == 0)
continue;
- } else {
- break ;
- }
+ else
+ break;
}
conversion->length = atoi(value[0]);
/* source_encoding */
- sprintf(name, "%s.%s", conv , "source_encoding");
+ sprintf(name, "%s.%s", conv, "source_encoding");
_XlcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num);
if (num > 0) {
char *tmp;
_XlcDbg_printValue(name,value,num);
tmp = (char *)Xmalloc(strlen(value[0])+1);
- if(tmp == NULL){
+ if (tmp == NULL)
return;
- }
strcpy(tmp,value[0]);
conversion->source_encoding = tmp;
conversion->source = srch_charset_define(tmp,&new);
- if(new){
- tmp = (char *)Xmalloc(strlen(conversion->source_encoding)+1);
- if(tmp == NULL){
- return ;
- }
- strcpy(tmp,conversion->source_encoding);
- conversion->source->name = tmp;
- }
}
/* destination_encoding */
- sprintf(name, "%s.%s", conv , "destination_encoding");
+ sprintf(name, "%s.%s", conv, "destination_encoding");
_XlcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num);
if (num > 0) {
char *tmp;
_XlcDbg_printValue(name,value,num);
tmp = (char *)Xmalloc(strlen(value[0])+1);
- if(tmp == NULL){
+ if (tmp == NULL)
return;
- }
strcpy(tmp,value[0]);
conversion->destination_encoding = tmp;
conversion->dest = srch_charset_define(tmp,&new);
- if(new){
- tmp = (char *)Xmalloc(
- strlen(conversion->destination_encoding)+1);
- if(tmp == NULL){
- return ;
- }
- strcpy(tmp,conversion->destination_encoding);
- conversion->dest->name = tmp;
- }
}
/* range */
- sprintf(name, "%s.%s", conv , "range");
+ sprintf(name, "%s.%s", conv, "range");
_XlcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num);
if (num > 0) {
_XlcDbg_printValue(name,value,num);
sscanf(value[0],"\\x%lx,\\x%lx",
- &(conversion->range.start),
- &(conversion->range.end));
+ &(conversion->range.start), &(conversion->range.end));
}
/* conversion */
- sprintf(name, "%s.%s", conv , "conversion");
+ sprintf(name, "%s.%s", conv, "conversion");
_XlcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num);
if (num > 0) {
_XlcDbg_printValue(name,value,num);
@@ -651,9 +636,10 @@ XLCdGenericPart *gen;
} /* loop end */
}
-static ExtdSegment create_ctextseg(value,num)
-char **value;
-int num;
+static ExtdSegment
+create_ctextseg(
+ char **value,
+ int num)
{
ExtdSegment ret;
char* ptr;
@@ -661,69 +647,58 @@ int num;
int i,new;
FontScope scope;
ret = (ExtdSegment)Xmalloc(sizeof(ExtdSegmentRec));
- if(ret == NULL){
+ if (ret == NULL)
+ return NULL;
+ ret->name = (char *)Xmalloc(strlen(value[0]) + 1);
+ if (ret->name == NULL) {
+ Xfree (ret);
return NULL;
}
- if(strchr(value[0],':')){
- ret->name = (char *)Xmalloc(strlen(value[0])+1);
- if(ret->name == NULL){
- Xfree (ret);
- return NULL;
- }
- strcpy(ret->name,value[0]);
+ strcpy(ret->name,value[0]);
+ cset_name = (char*) Xmalloc (strlen(ret->name) + 1);
+ if (cset_name == NULL) {
+ Xfree (ret->name);
+ Xfree (ret);
+ return NULL;
+ }
+ if (strchr(value[0],':')) {
ptr = strchr(ret->name,':');
*ptr = '\0';
ptr++;
- cset_name = (char*) Xmalloc (strlen (ret->name) + 6);
- if (cset_name == NULL) {
- Xfree (ret->name);
- Xfree (ret);
- return NULL;
- }
- if( !_XlcNCompareISOLatin1(ptr, "none", 4) ){
- ret->side = XlcNONE ;
- sprintf(cset_name,"%s:%s",ret->name,"none");
- } else
- if( !_XlcNCompareISOLatin1(ptr, "GL", 2) ){
- ret->side = XlcGL ;
+ if (!_XlcNCompareISOLatin1(ptr, "GL", 2)) {
+ ret->side = XlcGL;
sprintf(cset_name,"%s:%s",ret->name,"GL");
} else {
- ret->side = XlcGR ;
+ ret->side = XlcGR;
sprintf(cset_name,"%s:%s",ret->name,"GR");
}
} else {
- ret->name = (char *)Xmalloc(strlen(value[0])+1);
- if(ret->name == NULL){
- Xfree (ret);
- return NULL;
- }
- strcpy(ret->name,value[0]);
+ ret->side = XlcGLGR;
+ strcpy(cset_name,ret->name);
}
ret->area = (FontScope)Xmalloc((num - 1)*sizeof(FontScopeRec));
- if(ret->area == NULL){
+ if (ret->area == NULL) {
+ Xfree (cset_name);
Xfree (ret->name);
Xfree (ret);
return NULL;
}
- ret->area_num = num - 1;
+ ret->area_num = num - 1;
scope = ret->area ;
- for(i=1;i<num;i++){
+ for (i = 1; i < num; i++) {
sscanf(value[i],"\\x%lx,\\x%lx",
- &scope[i-1].start,&scope[i-1].end);
+ &scope[i-1].start, &scope[i-1].end);
}
ret->charset = srch_charset_define(cset_name,&new);
- if (new)
- ret->charset->name = cset_name;
- else
- Xfree (cset_name);
+ Xfree (cset_name);
return ret;
}
/* For VW/UDC end */
static Bool
-load_generic(lcd)
- XLCd lcd;
+load_generic(
+ XLCd lcd)
{
XLCdGenericPart *gen = XLC_GENERIC_PART(lcd);
char **value;
@@ -731,6 +706,7 @@ load_generic(lcd)
unsigned long l;
int i;
int M,ii;
+ XlcCharSet charset;
gen->codeset_num = 0;
@@ -747,7 +723,6 @@ load_generic(lcd)
gen->wc_shift_bits = atoi(value[0]);
if (gen->wc_shift_bits < 1)
gen->wc_shift_bits = 8;
-#ifndef X_NOT_STDC_ENV
/***** use_stdc_env *****/
_XlcGetResource(lcd, "XLC_XLOCALE", "use_stdc_env", &value, &num);
if (num > 0 && !_XlcCompareISOLatin1(value[0], "True"))
@@ -760,7 +735,6 @@ load_generic(lcd)
gen->force_convert_to_mb = True;
else
gen->force_convert_to_mb = False;
-#endif
for (i = 0; ; i++) {
CodeSetRec *codeset = NULL;
@@ -779,13 +753,12 @@ load_generic(lcd)
goto err;
/* 3.4.1 side */
- if( !_XlcNCompareISOLatin1(value[0], "none", 4) ){
- codeset->side = XlcNONE ;
- } else
- if( !_XlcNCompareISOLatin1(value[0], "GL", 2) ){
- codeset->side = XlcGL ;
+ if (!_XlcNCompareISOLatin1(value[0], "none", 4)) {
+ codeset->side = XlcNONE;
+ } else if (!_XlcNCompareISOLatin1(value[0], "GL", 2)) {
+ codeset->side = XlcGL;
} else {
- codeset->side = XlcGR ;
+ codeset->side = XlcGR;
}
tmp = strrchr(value[0], ':');
@@ -813,13 +786,13 @@ load_generic(lcd)
_XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
if (num > 0) {
static struct {
- char *str;
- int type;
+ const char *str;
+ EncodingType type;
} shifts[] = {
{"<SS>", E_SS},
{"<LSL>", E_LSL},
{"<LSR>", E_LSR},
- 0
+ {0}
};
int j;
@@ -828,7 +801,7 @@ load_generic(lcd)
for ( ; num-- > 0; value++) {
char encoding[256];
char *tmp = *value;
- int type = E_SS; /* for BC */
+ EncodingType type = E_SS; /* for BC */
for (j = 0; shifts[j].str; j++) {
if (!_XlcNCompareISOLatin1(tmp, shifts[j].str,
strlen(shifts[j].str))) {
@@ -859,7 +832,6 @@ load_generic(lcd)
sprintf(name, "%s.%s", cs, "ct_encoding");
_XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
if (num > 0) {
- XlcCharSet charset;
char *encoding;
if (codeset == NULL && (codeset = add_codeset(gen)) == NULL)
@@ -895,33 +867,33 @@ load_generic(lcd)
codeset->cs_num = i;
/* For VW/UDC */
/***** 3.4.2 byteM (1 <= M <= length)*****/
- for(M=1; M-1 < codeset->length; M++){
- long start,end;
+ for (M=1; M-1 < codeset->length; M++) {
+ unsigned long start,end;
ByteInfo tmpb;
sprintf(name,"%s.%s%d",cs,"byte",M);
_XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
- if( M == 1){
- if(num < 1) {
- codeset->byteM = NULL ;
+ if (M == 1) {
+ if (num < 1) {
+ codeset->byteM = NULL;
break ;
}
codeset->byteM =
(ByteInfoListRec *)Xmalloc(
(codeset->length)*sizeof(ByteInfoListRec));
- if(codeset->byteM == NULL){
+ if (codeset->byteM == NULL) {
goto err;
}
}
- if(num > 0){
+ if (num > 0) {
_XlcDbg_printValue(name,value,num);
(codeset->byteM)[M-1].M = M;
(codeset->byteM)[M-1].byteinfo_num = num;
(codeset->byteM)[M-1].byteinfo =
(ByteInfo)Xmalloc( num * sizeof(ByteInfoRec));
- for(ii = 0 ; ii < num ; ii++){
+ for (ii = 0 ; ii < num ; ii++) {
tmpb = (codeset->byteM)[M-1].byteinfo ;
/* default 0x00 - 0xff */
sscanf(value[ii],"\\x%lx,\\x%lx",&start,&end);
@@ -942,7 +914,7 @@ load_generic(lcd)
codeset->mbconv->convlist =
_XlcParse_scopemaps(value[0],&(codeset->mbconv->conv_num));
dmpscope("mb_conv",codeset->mbconv->convlist,
- codeset->mbconv->conv_num);
+ codeset->mbconv->conv_num);
/* [\x%x,\x%x]->\x%x,... */
}
/***** codeset.ct_conversion *****/
@@ -954,7 +926,7 @@ load_generic(lcd)
codeset->ctconv->convlist =
_XlcParse_scopemaps(value[0],&(codeset->ctconv->conv_num));
dmpscope("ctconv",codeset->ctconv->convlist,
- codeset->ctconv->conv_num);
+ codeset->ctconv->conv_num);
/* [\x%x,\x%x]->\x%x,... */
}
/***** codeset.ct_conversion_file *****/
@@ -979,6 +951,34 @@ load_generic(lcd)
read_charset_define(lcd,gen); /* For VW/UDC */
read_segmentconversion(lcd,gen); /* For VW/UDC */
+ if (gen->initial_state_GL == NULL) {
+ CodeSetRec *codeset;
+ for (i = 0; i < gen->codeset_num; i++) {
+ codeset = gen->codeset_list[i];
+ if (codeset->side == XlcGL)
+ gen->initial_state_GL = codeset;
+ }
+ }
+
+ if (gen->initial_state_GR == NULL) {
+ CodeSetRec *codeset;
+ for (i = 0; i < gen->codeset_num; i++) {
+ codeset = gen->codeset_list[i];
+ if (codeset->side == XlcGR)
+ gen->initial_state_GR = codeset;
+ }
+ }
+
+ for (i = 0; i < gen->codeset_num; i++) {
+ CodeSetRec *codeset = gen->codeset_list[i];
+ for (ii = 0; ii < codeset->num_charsets; ii++) {
+ charset = codeset->charset_list[ii];
+ if (! strcmp(charset->encoding_name, "ISO8859-1"))
+ charset->string_encoding = True;
+ if ( charset->string_encoding )
+ codeset->string_encoding = True;
+ }
+ }
return True;
err:
@@ -992,8 +992,8 @@ err:
super_class's initialize method() */
static Bool
-initialize_core(lcd)
- XLCd lcd;
+initialize_core(
+ XLCd lcd)
{
_XInitDynamicOM(lcd);
@@ -1020,25 +1020,26 @@ initialize(lcd)
if (initialize_core(lcd) == False)
return False;
#endif
-
- if(load_generic(lcd) == False)
+
+ if (load_generic(lcd) == False)
return False;
return True;
}
+
/* VW/UDC start 95.01.08 */
static void
-freeByteM(codeset)
- CodeSet codeset;
+freeByteM(
+ CodeSet codeset)
{
int i;
ByteInfoList blst;
- if(codeset->byteM == NULL) {
+ if (codeset->byteM == NULL) {
return ;
}
blst = codeset->byteM;
- for(i=0;i<codeset->length;i++){
- if(blst[i].byteinfo){
+ for (i = 0; i < codeset->length; i++) {
+ if (blst[i].byteinfo) {
Xfree(blst[i].byteinfo);
blst[i].byteinfo = NULL;
}
@@ -1046,25 +1047,26 @@ freeByteM(codeset)
Xfree(codeset->byteM);
codeset->byteM = NULL;
}
+
static void
-freeConversion(codeset)
- CodeSet codeset;
+freeConversion(
+ CodeSet codeset)
{
Conversion mbconv,ctconv;
- if( codeset->mbconv ) {
+ if (codeset->mbconv) {
mbconv = codeset->mbconv;
/* ... */
- if(mbconv->convlist){
+ if (mbconv->convlist) {
Xfree(mbconv->convlist);
mbconv->convlist = NULL;
}
Xfree(mbconv);
codeset->mbconv = NULL;
}
- if( codeset->ctconv ) {
+ if (codeset->ctconv) {
ctconv = codeset->ctconv;
/* ... */
- if(ctconv->convlist){
+ if (ctconv->convlist) {
Xfree(ctconv->convlist);
ctconv->convlist = NULL;
}
@@ -1072,57 +1074,60 @@ freeConversion(codeset)
codeset->ctconv = NULL;
}
}
+
static void
-freeExtdSegment(codeset)
- CodeSet codeset;
+freeExtdSegment(
+ CodeSet codeset)
{
ExtdSegment ctextseg;
- if(codeset->ctextseg == NULL) {
- return ;
+ if (codeset->ctextseg == NULL) {
+ return;
}
ctextseg = codeset->ctextseg;
- if(ctextseg->name){
+ if (ctextseg->name) {
Xfree(ctextseg->name);
ctextseg->name = NULL;
}
- if(ctextseg->area){
+ if (ctextseg->area) {
Xfree(ctextseg->area);
ctextseg->area = NULL;
}
Xfree(codeset->ctextseg);
codeset->ctextseg = NULL;
}
+
static void
-freeParseInfo(codeset)
- CodeSet codeset;
+freeParseInfo(
+ CodeSet codeset)
{
ParseInfo parse_info;
- if(codeset->parse_info == NULL) {
- return ;
+ if (codeset->parse_info == NULL) {
+ return;
}
parse_info = codeset->parse_info;
- if(parse_info->encoding){
+ if (parse_info->encoding) {
Xfree(parse_info->encoding);
parse_info->encoding = NULL;
}
Xfree(codeset->parse_info);
codeset->parse_info = NULL;
}
+
static void
-destroy_CodeSetList(gen)
- XLCdGenericPart *gen ;
+destroy_CodeSetList(
+ XLCdGenericPart *gen)
{
CodeSet *codeset = gen->codeset_list;
int i;
- if(gen->codeset_num == 0) {
+ if (gen->codeset_num == 0) {
return;
}
- for(i=0;i<gen->codeset_num;i++){
+ for (i=0;i<gen->codeset_num;i++) {
freeByteM(codeset[i]);
freeConversion(codeset[i]);
freeExtdSegment(codeset[i]);
freeParseInfo(codeset[i]);
- if(codeset[i]->charset_list){
+ if (codeset[i]->charset_list) {
Xfree(codeset[i]->charset_list);
codeset[i]->charset_list = NULL;
}
@@ -1130,26 +1135,26 @@ destroy_CodeSetList(gen)
}
Xfree(codeset); gen->codeset_list = NULL;
}
-/* */
+
static void
-destroy_SegConv(gen)
- XLCdGenericPart *gen ;
+destroy_SegConv(
+ XLCdGenericPart *gen)
{
SegConv seg = gen->segment_conv;
int i;
- if(gen->segment_conv_num == 0) {
+ if (gen->segment_conv_num == 0) {
return;
}
- for(i=0;i<gen->segment_conv_num;i++){
- if(seg[i].source_encoding){
+ for (i=0;i<gen->segment_conv_num;i++) {
+ if (seg[i].source_encoding) {
Xfree(seg[i].source_encoding);
seg[i].source_encoding = NULL;
}
- if(seg[i].destination_encoding){
+ if (seg[i].destination_encoding) {
Xfree(seg[i].destination_encoding);
seg[i].destination_encoding = NULL;
}
- if(seg[i].conv){
+ if (seg[i].conv) {
Xfree(seg[i].conv); seg[i].conv = NULL;
}
}
@@ -1157,25 +1162,26 @@ destroy_SegConv(gen)
}
static void
-destroy_gen(lcd)
- XLCd lcd;
+destroy_gen(
+ XLCd lcd)
{
XLCdGenericPart *gen = XLC_GENERIC_PART(lcd);
destroy_SegConv(gen);
destroy_CodeSetList(gen);
- if(gen->mb_parse_table){
+ if (gen->mb_parse_table) {
Xfree(gen->mb_parse_table);
gen->mb_parse_table = NULL;
}
- if(gen->mb_parse_list){
+ if (gen->mb_parse_list) {
Xfree(gen->mb_parse_list);
gen->mb_parse_list = NULL;
}
}
/* VW/UDC end 95.01.08 */
+
static void
-destroy(lcd)
- XLCd lcd;
+destroy(
+ XLCd lcd)
{
XLCdPublicMethods superclass = XLC_PUBLIC_METHODS(lcd)->superclass;
diff --git a/src/xlibi18n/lcInit.c b/src/xlibi18n/lcInit.c
index e4d3a7a4..d034f4e0 100644
--- a/src/xlibi18n/lcInit.c
+++ b/src/xlibi18n/lcInit.c
@@ -74,156 +74,105 @@ Sun Microsystems, Inc. or its licensors is granted.
* Modifier: Masayoshi Shimamura FUJITSU LIMITED
*
*/
+/* $XFree86: xc/lib/X11/lcInit.c,v 3.9 2001/11/16 00:52:27 dawes Exp $ */
#include "Xlibint.h"
#include "Xlcint.h"
#ifdef USE_DYNAMIC_LC
#undef USE_DEFAULT_LOADER
+#undef USE_GENERIC_LOADER
+#undef USE_UTF8_LOADER
#else
#define USE_GENERIC_LOADER
#define USE_DEFAULT_LOADER
+#define USE_UTF8_LOADER
#ifdef X_LOCALE
# define USE_EUC_LOADER
# define USE_SJIS_LOADER
# define USE_JIS_LOADER
-# define USE_UTF_LOADER
#endif
#endif
-#ifdef USE_DEFAULT_LOADER
-extern XLCd _XlcDefaultLoader(
-#if NeedFunctionPrototypes
- char*
-#endif
-);
-#endif
+/*
+ * The _XlcInitLoader function initializes the locale object loader list
+ * with vendor specific manner.
+ */
-#ifdef USE_DYNAMIC_LC
-extern XLCd _XlcDynamicLoad(
-#if NeedFunctionPrototypes
- char*
-#endif
-);
-#endif
+void
+_XlcInitLoader()
+{
-#ifdef DYNAMIC_LOAD
-#ifdef AIXV3
-extern XLCd _XaixOsDynamicLoad(
-#if NeedFunctionPrototypes
- char*
-#endif
-);
-#endif /* AIXV3 */
-#endif
+#ifdef USE_DYNAMIC_LC
+ _XlcAddLoader(_XlcDynamicLoad, XlcHead);
+#else /* USE_DYNAMIC_LC */
#ifdef USE_GENERIC_LOADER
-extern XLCd _XlcGenericLoader(
-#if NeedFunctionPrototypes
- char*
-#endif
-);
+ _XlcAddLoader(_XlcGenericLoader, XlcHead);
#endif
-#ifdef USE_UTF_LOADER
-extern XLCd _XlcUtfLoader(
-#if NeedFunctionPrototypes
- char*
+#ifdef USE_DEFAULT_LOADER
+ _XlcAddLoader(_XlcDefaultLoader, XlcHead);
#endif
-);
+
+#ifdef USE_UTF8_LOADER
+ _XlcAddLoader(_XlcUtf8Loader, XlcHead);
#endif
#ifdef USE_EUC_LOADER
-extern XLCd _XlcEucLoader(
-#if NeedFunctionPrototypes
- char*
-#endif
-);
+ _XlcAddLoader(_XlcEucLoader, XlcHead);
#endif
#ifdef USE_SJIS_LOADER
-extern XLCd _XlcSjisLoader(
-#if NeedFunctionPrototypes
- char*
-#endif
-);
+ _XlcAddLoader(_XlcSjisLoader, XlcHead);
#endif
#ifdef USE_JIS_LOADER
-extern XLCd _XlcJisLoader(
-#if NeedFunctionPrototypes
- char*
-#endif
-);
+ _XlcAddLoader(_XlcJisLoader, XlcHead);
#endif
#ifdef USE_DYNAMIC_LOADER
-extern XLCd _XlcDynamicLoader(
-#if NeedFunctionPrototypes
- char*
-#endif
-);
+ _XlcAddLoader(_XlcDynamicLoader, XlcHead);
#endif
-/*
- * The _XlcInitLoader function initializes the locale object loader list
- * with vendor specific manner.
- */
+#endif /* USE_DYNAMIC_LC */
+}
void
-#if NeedFunctionPrototypes
-_XlcInitLoader(char *name)
-#else
-_XlcInitLoader(name)
- char *name;
-#endif
+_XlcDeInitLoader()
{
#ifdef USE_DYNAMIC_LC
- _XlcAddLoader(_XlcDynamicLoad, XlcHead);
-
-#ifdef USE_DEFAULT_LOADER
- if (strcmp(name, "C") == 0 || strcmp(name, "POSIX") == 0)
- _XlcAddLoader(_XlcDefaultLoader, XlcHead);
- else
- _XlcAddLoader(_XlcDefaultLoader, XlcTail);
-#endif
-
+ _XlcRemoveLoader(_XlcDynamicLoad);
#else /* USE_DYNAMIC_LC */
#ifdef USE_GENERIC_LOADER
- _XlcAddLoader(_XlcGenericLoader, XlcHead);
+ _XlcRemoveLoader(_XlcGenericLoader);
#endif
#ifdef USE_DEFAULT_LOADER
- _XlcAddLoader(_XlcDefaultLoader, XlcHead);
+ _XlcRemoveLoader(_XlcDefaultLoader);
+#endif
+
+#ifdef USE_UTF8_LOADER
+ _XlcRemoveLoader(_XlcUtf8Loader);
#endif
#ifdef USE_EUC_LOADER
- _XlcAddLoader(_XlcEucLoader, XlcHead);
+ _XlcRemoveLoader(_XlcEucLoader);
#endif
#ifdef USE_SJIS_LOADER
- _XlcAddLoader(_XlcSjisLoader, XlcHead);
+ _XlcRemoveLoader(_XlcSjisLoader);
#endif
#ifdef USE_JIS_LOADER
- _XlcAddLoader(_XlcJisLoader, XlcHead);
+ _XlcRemoveLoader(_XlcJisLoader);
#endif
-#ifdef USE_UTF_LOADER
- _XlcAddLoader(_XlcUtfLoader, XlcHead);
+#ifdef USE_DYNAMIC_LOADER
+ _XlcRemoveLoader(_XlcDynamicLoader);
#endif
#endif /* USE_DYNAMIC_LC */
-
-#ifdef DYNAMIC_LOAD
-#ifdef AIXV3
- _XlcAddLoader(_XaixOsDynamicLoad, XlcHead);
-#endif /* AIXV3 */
-#endif /* DYNAMIC_LOAD */
-
-#ifdef USE_DYNAMIC_LOADER
- _XlcAddLoader(_XlcDynamicLoader, XlcHead);
-#endif
}
diff --git a/src/xlibi18n/lcPrTxt.c b/src/xlibi18n/lcPrTxt.c
index c06a628f..3670340c 100644
--- a/src/xlibi18n/lcPrTxt.c
+++ b/src/xlibi18n/lcPrTxt.c
@@ -23,6 +23,7 @@
* Author: Katsuhisa Yano TOSHIBA Corp.
* mopi@osa.ilab.toshiba.co.jp
*/
+/* $XFree86: xc/lib/X11/lcPrTxt.c,v 1.9 2003/04/03 22:34:02 dawes Exp $ */
#include "Xlibint.h"
#include "XlcPubI.h"
@@ -30,10 +31,10 @@
#include <X11/Xatom.h>
static XPointer *
-alloc_list(is_wide_char, count, nitems)
- Bool is_wide_char;
- int count;
- int nitems;
+alloc_list(
+ Bool is_wide_char,
+ int count,
+ int nitems)
{
if (is_wide_char) {
wchar_t **wstr_list;
@@ -67,11 +68,11 @@ alloc_list(is_wide_char, count, nitems)
}
static void
-copy_list(is_wide_char, text, list, count)
- Bool is_wide_char;
- XPointer text;
- XPointer *list;
- int count;
+copy_list(
+ Bool is_wide_char,
+ XPointer text,
+ XPointer *list,
+ int count)
{
int length;
@@ -105,22 +106,22 @@ copy_list(is_wide_char, text, list, count)
}
static int
-_XTextPropertyToTextList(lcd, dpy, text_prop, to_type, list_ret, count_ret)
- XLCd lcd;
- Display *dpy;
- XTextProperty *text_prop;
- char *to_type;
- XPointer **list_ret;
- int *count_ret;
+_XTextPropertyToTextList(
+ XLCd lcd,
+ Display *dpy,
+ const XTextProperty *text_prop,
+ const char *to_type,
+ XPointer **list_ret,
+ int *count_ret)
{
- XlcConv conv;
- char *from_type;
+ XlcConv conv = NULL;
+ const char *from_type;
XPointer from, to, buf;
char *str_ptr, *last_ptr;
Atom encoding;
- int from_left, to_left, buf_len, ret;
+ int from_left, to_left, buf_len, ret, len;
int unconv_num, nitems = text_prop->nitems;
- Bool is_wide_char = False;
+ Bool is_wide_char = False, do_strcpy = False;
if (strcmp(XlcNWideChar, to_type) == 0)
is_wide_char = True;
@@ -137,6 +138,8 @@ _XTextPropertyToTextList(lcd, dpy, text_prop, to_type, list_ret, count_ret)
encoding = text_prop->encoding;
if (encoding == XA_STRING)
from_type = XlcNString;
+ else if (encoding == XInternAtom(dpy, "UTF8_STRING", False))
+ from_type = XlcNUtf8String;
else if (encoding == XInternAtom(dpy, "COMPOUND_TEXT", False))
from_type = XlcNCompoundText;
else if (encoding == XInternAtom(dpy, XLC_PUBLIC(lcd, encoding_name), False))
@@ -145,21 +148,29 @@ _XTextPropertyToTextList(lcd, dpy, text_prop, to_type, list_ret, count_ret)
return XConverterNotFound;
if (is_wide_char) {
- buf_len = text_prop->nitems + 1;
- buf = (XPointer) Xmalloc(buf_len * sizeof(wchar_t));
+ buf_len = (text_prop->nitems + 1) * sizeof(wchar_t);;
} else {
- buf_len = text_prop->nitems * XLC_PUBLIC(lcd, mb_cur_max) + 1;
- buf = (XPointer) Xmalloc(buf_len);
+ if (strcmp(to_type, XlcNUtf8String) == 0)
+ buf_len = text_prop->nitems * 6 + 1;
+ else
+ buf_len = text_prop->nitems * XLC_PUBLIC(lcd, mb_cur_max) + 1;
}
+ buf = (XPointer) Xmalloc(buf_len);
if (buf == NULL)
return XNoMemory;
to = buf;
to_left = buf_len;
- conv = _XlcOpenConverter(lcd, from_type, lcd, to_type);
- if (conv == NULL) {
- Xfree(buf);
- return XConverterNotFound;
+ /* can be XlcNMultiByte to XlcNMultiByte,
+ or XlcNUtf8String to XlcNUtf8String */
+ if (!strcmp(from_type, to_type)) {
+ do_strcpy = True;
+ } else {
+ conv = _XlcOpenConverter(lcd, from_type, lcd, to_type);
+ if (conv == NULL) {
+ Xfree(buf);
+ return XConverterNotFound;
+ }
}
last_ptr = str_ptr = (char *) text_prop->value;
@@ -171,7 +182,17 @@ _XTextPropertyToTextList(lcd, dpy, text_prop, to_type, list_ret, count_ret)
from_left = str_ptr - last_ptr;
last_ptr = str_ptr;
- ret = _XlcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0);
+ if (do_strcpy) {
+ len = min(from_left, to_left);
+ strncpy(to, from, len);
+ from += len;
+ to += len;
+ from_left -= len;
+ to_left -= len;
+ ret = 0;
+ } else {
+ ret = _XlcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0);
+ }
if (ret < 0)
continue;
@@ -191,20 +212,24 @@ _XTextPropertyToTextList(lcd, dpy, text_prop, to_type, list_ret, count_ret)
to++;
to_left--;
}
- _XlcResetConverter(conv);
+ if (! do_strcpy)
+ _XlcResetConverter(conv);
} else
str_ptr++;
nitems--;
}
- _XlcCloseConverter(conv);
+ if (! do_strcpy)
+ _XlcCloseConverter(conv);
- if (is_wide_char)
+ if (is_wide_char) {
*((wchar_t *) to) = (wchar_t) 0;
- else
+ to_left -= sizeof(wchar_t);
+ } else {
*((char *) to) = '\0';
- to_left--;
+ to_left--;
+ }
*list_ret = alloc_list(is_wide_char, *count_ret, buf_len - to_left);
if (*list_ret)
@@ -216,33 +241,45 @@ _XTextPropertyToTextList(lcd, dpy, text_prop, to_type, list_ret, count_ret)
}
int
-_XmbTextPropertyToTextList(lcd, dpy, text_prop, list_ret, count_ret)
- XLCd lcd;
- Display *dpy;
- XTextProperty *text_prop;
- char ***list_ret;
- int *count_ret;
+_XmbTextPropertyToTextList(
+ XLCd lcd,
+ Display *dpy,
+ const XTextProperty *text_prop,
+ char ***list_ret,
+ int *count_ret)
{
return _XTextPropertyToTextList(lcd, dpy, text_prop, XlcNMultiByte,
(XPointer **) list_ret, count_ret);
}
int
-_XwcTextPropertyToTextList(lcd, dpy, text_prop, list_ret, count_ret)
- XLCd lcd;
- Display *dpy;
- XTextProperty *text_prop;
- wchar_t ***list_ret;
- int *count_ret;
+_XwcTextPropertyToTextList(
+ XLCd lcd,
+ Display *dpy,
+ const XTextProperty *text_prop,
+ wchar_t ***list_ret,
+ int *count_ret)
{
return _XTextPropertyToTextList(lcd, dpy, text_prop, XlcNWideChar,
(XPointer **) list_ret, count_ret);
}
+int
+_Xutf8TextPropertyToTextList(
+ XLCd lcd,
+ Display *dpy,
+ const XTextProperty *text_prop,
+ char ***list_ret,
+ int *count_ret)
+{
+ return _XTextPropertyToTextList(lcd, dpy, text_prop, XlcNUtf8String,
+ (XPointer **) list_ret, count_ret);
+}
+
void
-_XwcFreeStringList(lcd, list)
- XLCd lcd;
- wchar_t **list;
+_XwcFreeStringList(
+ XLCd lcd,
+ wchar_t **list)
{
if (list) {
if (*list)
diff --git a/src/xlibi18n/lcPubWrap.c b/src/xlibi18n/lcPubWrap.c
index f9eeb244..cbbb65c2 100644
--- a/src/xlibi18n/lcPubWrap.c
+++ b/src/xlibi18n/lcPubWrap.c
@@ -23,19 +23,13 @@
* Author: Katsuhisa Yano TOSHIBA Corp.
* mopi@osa.ilab.toshiba.co.jp
*/
+/* $XFree86: xc/lib/X11/lcPubWrap.c,v 1.4 2001/01/17 19:41:55 dawes Exp $ */
#include "Xlibint.h"
#include "XlcPubI.h"
-#if NeedVarargsPrototypes
char *
_XGetLCValues(XLCd lcd, ...)
-#else
-char *
-_XGetLCValues(lcd, va_alist)
- XLCd lcd;
- va_dcl
-#endif
{
va_list var;
XlcArgList args;
@@ -43,11 +37,11 @@ _XGetLCValues(lcd, va_alist)
int num_args;
XLCdPublicMethodsPart *methods = XLC_PUBLIC_METHODS(lcd);
- Va_start(var, lcd);
+ va_start(var, lcd);
_XlcCountVaList(var, &num_args);
va_end(var);
- Va_start(var, lcd);
+ va_start(var, lcd);
_XlcVaToArgList(var, num_args, &args);
va_end(var);
@@ -62,8 +56,8 @@ _XGetLCValues(lcd, va_alist)
}
void
-_XlcDestroyLC(lcd)
- XLCd lcd;
+_XlcDestroyLC(
+ XLCd lcd)
{
XLCdPublicMethods methods = (XLCdPublicMethods) lcd->methods;
@@ -71,9 +65,9 @@ _XlcDestroyLC(lcd)
}
XLCd
-_XlcCreateLC(name, methods)
- char *name;
- XLCdMethods methods;
+_XlcCreateLC(
+ const char *name,
+ XLCdMethods methods)
{
XLCdPublicMethods pub_methods = (XLCdPublicMethods) methods;
XLCd lcd;
diff --git a/src/xlibi18n/lcPublic.c b/src/xlibi18n/lcPublic.c
index c72669ef..7b5e4230 100644
--- a/src/xlibi18n/lcPublic.c
+++ b/src/xlibi18n/lcPublic.c
@@ -23,17 +23,23 @@
* Author: Katsuhisa Yano TOSHIBA Corp.
* mopi@osa.ilab.toshiba.co.jp
*/
+/* $XFree86: xc/lib/X11/lcPublic.c,v 1.11 2001/11/16 00:52:28 dawes Exp $ */
#include <stdio.h>
#include "Xlibint.h"
#include "XlcPubI.h"
-static char *default_string();
+static const char *
+default_string(
+ XLCd lcd)
+{
+ return XLC_PUBLIC(lcd, default_string);
+}
-static XLCd create();
-static Bool initialize();
-static void destroy();
-static char *get_values();
+static XLCd create (const char *name, XLCdMethods methods);
+static Bool initialize (XLCd lcd);
+static void destroy (XLCd lcd);
+static char *get_values (XLCd lcd, XlcArgList args, int num_args);
static XLCdPublicMethodsRec publicMethods = {
{
@@ -44,8 +50,10 @@ static XLCdPublicMethodsRec publicMethods = {
_XrmDefaultInitParseInfo,
_XmbTextPropertyToTextList,
_XwcTextPropertyToTextList,
+ _Xutf8TextPropertyToTextList,
_XmbTextListToTextProperty,
_XwcTextListToTextProperty,
+ _Xutf8TextListToTextProperty,
_XwcFreeStringList,
default_string,
NULL,
@@ -63,17 +71,10 @@ static XLCdPublicMethodsRec publicMethods = {
XLCdMethods _XlcPublicMethods = (XLCdMethods) &publicMethods;
-static char *
-default_string(lcd)
- XLCd lcd;
-{
- return XLC_PUBLIC(lcd, default_string);
-}
-
static XLCd
-create(name, methods)
- char *name;
- XLCdMethods methods;
+create(
+ const char *name,
+ XLCdMethods methods)
{
XLCd lcd;
XLCdPublicMethods new;
@@ -91,7 +92,7 @@ create(name, methods)
new = (XLCdPublicMethods) Xmalloc(sizeof(XLCdPublicMethodsRec));
if (new == NULL)
goto err;
- *new = *((XLCdPublicMethods) methods);
+ memcpy(new,methods,sizeof(XLCdPublicMethodsRec));
lcd->methods = (XLCdMethods) new;
return lcd;
@@ -102,8 +103,8 @@ err:
}
static Bool
-load_public(lcd)
- XLCd lcd;
+load_public(
+ XLCd lcd)
{
XLCdPublicPart *pub = XLC_PUBLIC_PART(lcd);
char **values, *str;
@@ -137,8 +138,8 @@ load_public(lcd)
}
static Bool
-initialize_core(lcd)
- XLCd lcd;
+initialize_core(
+ XLCd lcd)
{
XLCdMethods methods = lcd->methods;
XLCdMethods core = &publicMethods.core;
@@ -172,12 +173,18 @@ initialize_core(lcd)
if (methods->wc_text_prop_to_list == NULL)
methods->wc_text_prop_to_list = core->wc_text_prop_to_list;
+ if (methods->utf8_text_prop_to_list == NULL)
+ methods->utf8_text_prop_to_list = core->utf8_text_prop_to_list;
+
if (methods->mb_text_list_to_prop == NULL)
methods->mb_text_list_to_prop = core->mb_text_list_to_prop;
if (methods->wc_text_list_to_prop == NULL)
methods->wc_text_list_to_prop = core->wc_text_list_to_prop;
+ if (methods->utf8_text_list_to_prop == NULL)
+ methods->utf8_text_list_to_prop = core->utf8_text_list_to_prop;
+
if (methods->wc_free_string_list == NULL)
methods->wc_free_string_list = core->wc_free_string_list;
@@ -187,21 +194,18 @@ initialize_core(lcd)
return True;
}
-extern Bool _XlcInitCTInfo();
-
static Bool
-initialize(lcd)
- XLCd lcd;
+initialize(
+ XLCd lcd)
{
XLCdPublicMethodsPart *methods = XLC_PUBLIC_METHODS(lcd);
XLCdPublicMethodsPart *pub_methods = &publicMethods.pub;
XLCdPublicPart *pub = XLC_PUBLIC_PART(lcd);
char *name;
-#if !defined(X_NOT_STDC_ENV) && !defined(X_LOCALE)
+#if !defined(X_LOCALE)
int len;
char sinamebuf[256];
char* siname;
- char *_XlcMapOSLocaleName();
#endif
_XlcInitCTInfo();
@@ -210,25 +214,29 @@ initialize(lcd)
return False;
name = lcd->core->name;
-#if !defined(X_NOT_STDC_ENV) && !defined(X_LOCALE)
+#if !defined(X_LOCALE)
/*
- * _XlMapOSLOcaleName will return the same string or a substring
+ * _XlMapOSLocaleName will return the same string or a substring
* of name, so strlen(name) is okay
*/
- if ((len = strlen(name)) < sizeof sinamebuf) siname = sinamebuf;
- else siname = Xmalloc (len + 1);
- if (siname == NULL) return False;
+ if ((len = strlen(name)) < sizeof sinamebuf)
+ siname = sinamebuf;
+ else
+ siname = Xmalloc (len + 1);
+ if (siname == NULL)
+ return False;
name = _XlcMapOSLocaleName(name, siname);
#endif
/* _XlcResolveLocaleName will lookup the SI's name for the locale */
if (_XlcResolveLocaleName(name, pub) == 0) {
-#if !defined(X_NOT_STDC_ENV) && !defined(X_LOCALE)
+#if !defined(X_LOCALE)
if (siname != sinamebuf) Xfree (siname);
#endif
return False;
}
-#if !defined(X_NOT_STDC_ENV) && !defined(X_LOCALE)
- if (siname != sinamebuf) Xfree (siname);
+#if !defined(X_LOCALE)
+ if (siname != sinamebuf)
+ Xfree (siname);
#endif
if (pub->default_string == NULL)
@@ -244,8 +252,8 @@ initialize(lcd)
}
static void
-destroy_core(lcd)
- XLCd lcd;
+destroy_core(
+ XLCd lcd)
{
if (lcd->core) {
if (lcd->core->name)
@@ -260,8 +268,8 @@ destroy_core(lcd)
}
static void
-destroy(lcd)
- XLCd lcd;
+destroy(
+ XLCd lcd)
{
XLCdPublicPart *pub = XLC_PUBLIC_PART(lcd);
@@ -293,10 +301,10 @@ static XlcResource resources[] = {
};
static char *
-get_values(lcd, args, num_args)
- register XLCd lcd;
- register XlcArgList args;
- register int num_args;
+get_values(
+ XLCd lcd,
+ XlcArgList args,
+ int num_args)
{
XLCdPublic pub = (XLCdPublic) lcd->core;
diff --git a/src/xlibi18n/lcRM.c b/src/xlibi18n/lcRM.c
index 0824a6f7..23ce80d3 100644
--- a/src/xlibi18n/lcRM.c
+++ b/src/xlibi18n/lcRM.c
@@ -22,101 +22,202 @@
*
* Author: Katsuhisa Yano TOSHIBA Corp.
* mopi@osa.ilab.toshiba.co.jp
+ * Bug fixes: Bruno Haible XFree86 Inc.
*/
+/* $XFree86: xc/lib/X11/lcRM.c,v 1.4 2000/11/28 18:49:48 dawes Exp $ */
#include "Xlibint.h"
#include "XlcPubI.h"
#include <stdio.h>
-typedef struct _StateRec {
- XLCd lcd;
- XlcConv conv;
-} StateRec, *State;
+/*
+ * Default implementation of methods for Xrm parsing.
+ */
+
+/* ======================= Unibyte implementation ======================= */
+
+/* Only for efficiency, to speed up things. */
+
+/* This implementation must keep the locale, for lcname. */
+typedef struct _UbStateRec {
+ XLCd lcd;
+} UbStateRec, *UbState;
+
+/* Sets the state to the initial state.
+ Initiates a sequence of calls to mbchar. */
+static void
+ub_mbinit(
+ XPointer state)
+{
+}
+
+/* Transforms one multibyte character, and return a 'char' in the same
+ parsing class. Returns the number of consumed bytes in *lenp. */
+static char
+ub_mbchar(
+ XPointer state,
+ const char *str,
+ int *lenp)
+{
+ *lenp = 1;
+ return *str;
+}
+
+/* Terminates a sequence of calls to mbchar. */
+static void
+ub_mbfinish(
+ XPointer state)
+{
+}
+/* Returns the name of the state's locale, as a static string. */
+static const char *
+ub_lcname(
+ XPointer state)
+{
+ return ((UbState) state)->lcd->core->name;
+}
+
+/* Frees the state, which was allocated by _XrmDefaultInitParseInfo. */
static void
-mbinit(state)
- XPointer state;
+ub_destroy(
+ XPointer state)
{
- _XlcResetConverter(((State) state)->conv);
+ _XCloseLC(((UbState) state)->lcd);
+ Xfree((char *) state);
}
+static const XrmMethodsRec ub_methods = {
+ ub_mbinit,
+ ub_mbchar,
+ ub_mbfinish,
+ ub_lcname,
+ ub_destroy
+};
+
+/* ======================= Multibyte implementation ======================= */
+
+/* This implementation uses an XlcConv from XlcNMultiByte to XlcNWideChar. */
+typedef struct _MbStateRec {
+ XLCd lcd;
+ XlcConv conv;
+} MbStateRec, *MbState;
+
+/* Sets the state to the initial state.
+ Initiates a sequence of calls to mbchar. */
+static void
+mb_mbinit(
+ XPointer state)
+{
+ _XlcResetConverter(((MbState) state)->conv);
+}
+
+/* Transforms one multibyte character, and return a 'char' in the same
+ parsing class. Returns the number of consumed bytes in *lenp. */
static char
-mbchar(state, str, lenp)
- XPointer state;
- char *str;
- int *lenp;
+mb_mbchar(
+ XPointer state,
+ const char *str,
+ int *lenp)
{
- XlcConv conv = ((State) state)->conv;
- XlcCharSet charset;
- char *from, *to, buf[BUFSIZ];
- int from_left, to_left;
- XPointer args[1];
+ XlcConv conv = ((MbState) state)->conv;
+ const char *from;
+ wchar_t *to, wc;
+ int cur_max, i, from_left, to_left, ret;
+
+ cur_max = XLC_PUBLIC(((MbState) state)->lcd, mb_cur_max);
from = str;
- *lenp = from_left = XLC_PUBLIC(((State) state)->lcd, mb_cur_max);
- to = buf;
- to_left = BUFSIZ;
- args[0] = (XPointer) &charset;
-
- _XlcConvert(conv, (XPointer *) &from, &from_left, (XPointer *) &to,
- &to_left, args, 1);
-
+ /* Determine from_left. Avoid overrun error which could occur if
+ from_left > strlen(str). */
+ from_left = cur_max;
+ for (i = 0; i < cur_max; i++)
+ if (str[i] == '\0') {
+ from_left = i;
+ break;
+ }
+ *lenp = from_left;
+
+ to = &wc;
+ to_left = 1;
+
+ ret = _XlcConvert(conv, (XPointer *) &from, &from_left,
+ (XPointer *) &to, &to_left, NULL, 0);
*lenp -= from_left;
- /* XXX */
- return buf[0];
+ if (ret < 0 || to_left > 0) {
+ /* Invalid or incomplete multibyte character seen. */
+ *lenp = 1;
+ return 0x7f;
+ }
+ /* Return a 'char' equivalent to wc. */
+ return (wc >= 0 && wc <= 0x7f ? wc : 0x7f);
}
+/* Terminates a sequence of calls to mbchar. */
static void
-mbfinish(state)
- XPointer state;
+mb_mbfinish(
+ XPointer state)
{
}
-static char *
-lcname(state)
- XPointer state;
+/* Returns the name of the state's locale, as a static string. */
+static const char *
+mb_lcname(
+ XPointer state)
{
- return ((State) state)->lcd->core->name;
+ return ((MbState) state)->lcd->core->name;
}
+/* Frees the state, which was allocated by _XrmDefaultInitParseInfo. */
static void
-destroy(state)
- XPointer state;
+mb_destroy(
+ XPointer state)
{
- _XlcCloseConverter(((State) state)->conv);
- _XCloseLC(((State) state)->lcd);
+ _XlcCloseConverter(((MbState) state)->conv);
+ _XCloseLC(((MbState) state)->lcd);
Xfree((char *) state);
}
-static XrmMethodsRec rm_methods = {
- mbinit,
- mbchar,
- mbfinish,
- lcname,
- destroy
-} ;
+static const XrmMethodsRec mb_methods = {
+ mb_mbinit,
+ mb_mbchar,
+ mb_mbfinish,
+ mb_lcname,
+ mb_destroy
+};
+
+/* ======================= Exported function ======================= */
XrmMethods
-_XrmDefaultInitParseInfo(lcd, rm_state)
- XLCd lcd;
- XPointer *rm_state;
+_XrmDefaultInitParseInfo(
+ XLCd lcd,
+ XPointer *rm_state)
{
- State state;
+ if (XLC_PUBLIC(lcd, mb_cur_max) == 1) {
+ /* Unibyte case. */
+ UbState state = (UbState) Xmalloc(sizeof(UbStateRec));
+ if (state == NULL)
+ return (XrmMethods) NULL;
+
+ state->lcd = lcd;
- state = (State) Xmalloc(sizeof(StateRec));
- if (state == NULL)
- return (XrmMethods) NULL;
+ *rm_state = (XPointer) state;
+ return &ub_methods;
+ } else {
+ /* Multibyte case. */
+ MbState state = (MbState) Xmalloc(sizeof(MbStateRec));
+ if (state == NULL)
+ return (XrmMethods) NULL;
- state->lcd = lcd;
- state->conv = _XlcOpenConverter(lcd, XlcNMultiByte, lcd, XlcNChar);
- if (state->conv == NULL) {
- Xfree((char *) state);
+ state->lcd = lcd;
+ state->conv = _XlcOpenConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar);
+ if (state->conv == NULL) {
+ Xfree((char *) state);
+ return (XrmMethods) NULL;
+ }
- return (XrmMethods) NULL;
+ *rm_state = (XPointer) state;
+ return &mb_methods;
}
-
- *rm_state = (XPointer) state;
-
- return &rm_methods;
}
diff --git a/src/xlibi18n/lcStd.c b/src/xlibi18n/lcStd.c
index 9d938d39..81216aaa 100644
--- a/src/xlibi18n/lcStd.c
+++ b/src/xlibi18n/lcStd.c
@@ -23,16 +23,17 @@
* Author: Katsuhisa Yano TOSHIBA Corp.
* mopi@osa.ilab.toshiba.co.jp
*/
+/* $XFree86: xc/lib/X11/lcStd.c,v 1.6 2003/04/13 19:22:21 dawes Exp $ */
#include "Xlibint.h"
#include "XlcPubI.h"
int
-_Xlcmbtowc(lcd, wstr, str, len)
- XLCd lcd;
- wchar_t *wstr;
- char *str;
- int len;
+_Xlcmbtowc(
+ XLCd lcd,
+ wchar_t *wstr,
+ char *str,
+ int len)
{
static XLCd last_lcd = NULL;
static XlcConv conv = NULL;
@@ -73,10 +74,10 @@ _Xlcmbtowc(lcd, wstr, str, len)
}
int
-_Xlcwctomb(lcd, str, wc)
- XLCd lcd;
- char *str;
- wchar_t wc;
+_Xlcwctomb(
+ XLCd lcd,
+ char *str,
+ wchar_t wc)
{
static XLCd last_lcd = NULL;
static XlcConv conv = NULL;
@@ -116,11 +117,11 @@ _Xlcwctomb(lcd, str, wc)
}
int
-_Xlcmbstowcs(lcd, wstr, str, len)
- XLCd lcd;
- wchar_t *wstr;
- char *str;
- int len;
+_Xlcmbstowcs(
+ XLCd lcd,
+ wchar_t *wstr,
+ char *str,
+ int len)
{
XlcConv conv;
XPointer from, to;
@@ -155,11 +156,11 @@ _Xlcmbstowcs(lcd, wstr, str, len)
}
int
-_Xlcwcstombs(lcd, str, wstr, len)
- XLCd lcd;
- char *str;
- wchar_t *wstr;
- int len;
+_Xlcwcstombs(
+ XLCd lcd,
+ char *str,
+ wchar_t *wstr,
+ int len)
{
XlcConv conv;
XPointer from, to;
@@ -195,51 +196,63 @@ _Xlcwcstombs(lcd, str, wstr, len)
int
-_Xmbtowc(wstr, str, len)
- wchar_t *wstr;
- char *str;
- int len;
+_Xmbtowc(
+ wchar_t *wstr,
+#ifdef ISC
+ char const *str,
+ size_t len
+#else
+ char *str,
+ int len
+#endif
+ )
{
return _Xlcmbtowc((XLCd) NULL, wstr, str, len);
}
int
-_Xmblen(str, len)
- char *str;
- int len;
+_Xmblen(
+#ifdef ISC
+ char const *str,
+ size_t len
+#else
+ char *str,
+ int len
+#endif
+ )
{
return _Xmbtowc((wchar_t *) NULL, str, len);
}
int
-_Xwctomb(str, wc)
- char *str;
- wchar_t wc;
+_Xwctomb(
+ char *str,
+ wchar_t wc)
{
return _Xlcwctomb((XLCd) NULL, str, wc);
}
int
-_Xmbstowcs(wstr, str, len)
- wchar_t *wstr;
- char *str;
- int len;
+_Xmbstowcs(
+ wchar_t *wstr,
+ char *str,
+ int len)
{
return _Xlcmbstowcs((XLCd) NULL, wstr, str, len);
}
int
-_Xwcstombs(str, wstr, len)
- char *str;
- wchar_t *wstr;
- int len;
+_Xwcstombs(
+ char *str,
+ wchar_t *wstr,
+ int len)
{
return _Xlcwcstombs((XLCd) NULL, str, wstr, len);
}
wchar_t *
-_Xwcscpy(wstr1, wstr2)
- register wchar_t *wstr1, *wstr2;
+_Xwcscpy(
+ register wchar_t *wstr1, register wchar_t *wstr2)
{
wchar_t *wstr_tmp = wstr1;
@@ -250,9 +263,9 @@ _Xwcscpy(wstr1, wstr2)
}
wchar_t *
-_Xwcsncpy(wstr1, wstr2, len)
- register wchar_t *wstr1, *wstr2;
- register int len;
+_Xwcsncpy(
+ register wchar_t *wstr1, register wchar_t *wstr2,
+ register int len)
{
wchar_t *wstr_tmp = wstr1;
@@ -267,8 +280,8 @@ _Xwcsncpy(wstr1, wstr2, len)
}
int
-_Xwcslen(wstr)
- register wchar_t *wstr;
+_Xwcslen(
+ register wchar_t *wstr)
{
register wchar_t *wstr_ptr = wstr;
@@ -279,8 +292,8 @@ _Xwcslen(wstr)
}
int
-_Xwcscmp(wstr1, wstr2)
- register wchar_t *wstr1, *wstr2;
+_Xwcscmp(
+ register wchar_t *wstr1, register wchar_t *wstr2)
{
for ( ; *wstr1 && *wstr2; wstr1++, wstr2++)
if (*wstr1 != *wstr2)
@@ -290,9 +303,9 @@ _Xwcscmp(wstr1, wstr2)
}
int
-_Xwcsncmp(wstr1, wstr2, len)
- register wchar_t *wstr1, *wstr2;
- register int len;
+_Xwcsncmp(
+ register wchar_t *wstr1, register wchar_t *wstr2,
+ register int len)
{
for ( ; *wstr1 && *wstr2 && len > 0; wstr1++, wstr2++, len--)
if (*wstr1 != *wstr2)
@@ -303,3 +316,52 @@ _Xwcsncmp(wstr1, wstr2, len)
return *wstr1 - *wstr2;
}
+
+
+int
+_Xlcmbstoutf8(
+ XLCd lcd,
+ char *ustr,
+ const char *str,
+ int len)
+{
+ XlcConv conv;
+ XPointer from, to;
+ int from_left, to_left, ret;
+
+ if (lcd == NULL) {
+ lcd = _XlcCurrentLC();
+ if (lcd == NULL)
+ return -1;
+ }
+
+ conv = _XlcOpenConverter(lcd, XlcNMultiByte, lcd, XlcNUtf8String);
+ if (conv == NULL)
+ return -1;
+
+ from = (XPointer) str;
+ from_left = strlen(str);
+ to = (XPointer) ustr;
+ to_left = len;
+
+ if (_XlcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0) < 0)
+ ret = -1;
+ else {
+ ret = len - to_left;
+ if (ustr && to_left > 0)
+ ustr[ret] = '\0';
+ }
+
+ _XlcCloseConverter(conv);
+
+ return ret;
+}
+
+int
+_Xmbstoutf8(
+ char *ustr,
+ const char *str,
+ int len)
+{
+ return _Xlcmbstoutf8((XLCd) NULL, ustr, str, len);
+}
diff --git a/src/xlibi18n/lcTxtPr.c b/src/xlibi18n/lcTxtPr.c
index 1efdb278..a58ef48b 100644
--- a/src/xlibi18n/lcTxtPr.c
+++ b/src/xlibi18n/lcTxtPr.c
@@ -23,6 +23,7 @@
* Author: Katsuhisa Yano TOSHIBA Corp.
* mopi@osa.ilab.toshiba.co.jp
*/
+/* $XFree86: xc/lib/X11/lcTxtPr.c,v 3.3 2001/01/17 19:41:55 dawes Exp $ */
#include "Xlibint.h"
#include "XlcPubI.h"
@@ -31,14 +32,14 @@
#include <stdio.h>
static int
-get_buf_size(is_wide_char, list, count)
- Bool is_wide_char;
- XPointer list;
- int count;
+get_buf_size(
+ Bool is_wide_char,
+ XPointer list,
+ int count)
{
- register int length = 0;
- register char **mb_list;
- register wchar_t **wc_list;
+ int length = 0;
+ char **mb_list;
+ wchar_t **wc_list;
if (list == NULL)
return 0;
@@ -64,23 +65,23 @@ get_buf_size(is_wide_char, list, count)
}
static int
-_XTextListToTextProperty(lcd, dpy, from_type, list, count, style, text_prop)
- XLCd lcd;
- Display *dpy;
- char *from_type;
- XPointer list;
- int count;
- XICCEncodingStyle style;
- XTextProperty *text_prop;
+_XTextListToTextProperty(
+ XLCd lcd,
+ Display *dpy,
+ const char *from_type,
+ XPointer list,
+ int count,
+ XICCEncodingStyle style,
+ XTextProperty *text_prop)
{
Atom encoding;
XlcConv conv;
- char *to_type;
- char **mb_list;
- wchar_t **wc_list;
+ const char *to_type;
+ char **mb_list = NULL;
+ wchar_t **wc_list = NULL;
XPointer from;
char *to, *buf, *value;
- int from_left, to_left, buf_len, nitems, unconv_num, ret, i;
+ int from_left, to_left, buf_len, nitems, unconv_num = 0, ret, i;
Bool is_wide_char = False;
if (strcmp(XlcNWideChar, from_type) == 0)
@@ -96,6 +97,10 @@ _XTextListToTextProperty(lcd, dpy, from_type, list, count, style, text_prop)
encoding = XA_STRING;
to_type = XlcNString;
break;
+ case XUTF8StringStyle:
+ encoding = XInternAtom(dpy, "UTF8_STRING", False);
+ to_type = XlcNUtf8String;
+ break;
case XCompoundTextStyle:
encoding = XInternAtom(dpy, "COMPOUND_TEXT", False);
to_type = XlcNCompoundText;
@@ -209,27 +214,40 @@ done:
}
int
-_XmbTextListToTextProperty(lcd, dpy, list, count, style, text_prop)
- XLCd lcd;
- Display *dpy;
- char **list;
- int count;
- XICCEncodingStyle style;
- XTextProperty *text_prop;
+_XmbTextListToTextProperty(
+ XLCd lcd,
+ Display *dpy,
+ char **list,
+ int count,
+ XICCEncodingStyle style,
+ XTextProperty *text_prop)
{
return _XTextListToTextProperty(lcd, dpy, XlcNMultiByte, (XPointer) list,
count, style, text_prop);
}
int
-_XwcTextListToTextProperty(lcd, dpy, list, count, style, text_prop)
- XLCd lcd;
- Display *dpy;
- wchar_t **list;
- int count;
- XICCEncodingStyle style;
- XTextProperty *text_prop;
+_XwcTextListToTextProperty(
+ XLCd lcd,
+ Display *dpy,
+ wchar_t **list,
+ int count,
+ XICCEncodingStyle style,
+ XTextProperty *text_prop)
{
return _XTextListToTextProperty(lcd, dpy, XlcNWideChar, (XPointer) list,
count, style, text_prop);
}
+
+int
+_Xutf8TextListToTextProperty(
+ XLCd lcd,
+ Display *dpy,
+ char **list,
+ int count,
+ XICCEncodingStyle style,
+ XTextProperty *text_prop)
+{
+ return _XTextListToTextProperty(lcd, dpy, XlcNUtf8String, (XPointer) list,
+ count, style, text_prop);
+}
diff --git a/src/xlibi18n/lcUTF8.c b/src/xlibi18n/lcUTF8.c
index 1f40704f..0994e965 100644
--- a/src/xlibi18n/lcUTF8.c
+++ b/src/xlibi18n/lcUTF8.c
@@ -129,16 +129,8 @@ typedef unsigned int ucs4_t;
typedef struct _Utf8ConvRec {
const char *name;
XrmQuark xrm_name;
-#if NeedFunctionPrototypes
int (* cstowc) (XlcConv, ucs4_t *, unsigned char const *, int);
-#else
- int (* cstowc) ();
-#endif
-#if NeedFunctionPrototypes
int (* wctocs) (XlcConv, unsigned char *, ucs4_t, int);
-#else
- int (* wctocs) ();
-#endif
} Utf8ConvRec, *Utf8Conv;
/*
@@ -1764,7 +1756,7 @@ create_tofontcs_conv(
if (!strcmp(preferred[k]->name, name))
break;
if (k < 0) {
- /* For fonts "ISO10646-1" means not utf8 but ucs2.*/
+ /* For fonts "ISO10646-1" means ucs2, not utf8.*/
if (!strcmp("ISO10646-1", name)) {
preferred[num++] = &all_charsets[ucs2_conv_index];
continue;
diff --git a/src/xlibi18n/lcUniConv/8bit_tab_to_h.c b/src/xlibi18n/lcUniConv/8bit_tab_to_h.c
index 1d794841..ae5340cf 100644
--- a/src/xlibi18n/lcUniConv/8bit_tab_to_h.c
+++ b/src/xlibi18n/lcUniConv/8bit_tab_to_h.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/8bit_tab_to_h.c,v 1.3 2001/02/09 00:02:54 dawes Exp $ */
+/* $XFree86: xc/lib/X11/lcUniConv/8bit_tab_to_h.c,v 1.2 2000/12/04 18:49:30 dawes Exp $ */
/*
* Generates an 8-bit character set table from a .TXT table as found on
diff --git a/src/xlibi18n/lcUniConv/README b/src/xlibi18n/lcUniConv/README
index 844f090b..5ea4f056 100644
--- a/src/xlibi18n/lcUniConv/README
+++ b/src/xlibi18n/lcUniConv/README
@@ -1,3 +1,5 @@
+$XFree86$
+
The files in this directory are taken from the libiconv-1.1 package.
The *.h files were generated from tables (mostly from ftp.unicode.org) using
@@ -6,5 +8,5 @@ optimizations were applied by hand.
If you find a bug in these files, instead of modifying them in XFree86
and let it diverge from libiconv, please notify the libiconv maintainer
-(currently <haible@clisp.cons.org>) so he can fix both in synch.
+(currently <bruno@clisp.org>) so he can fix both in synch.
diff --git a/src/xlibi18n/lcUniConv/armscii_8.h b/src/xlibi18n/lcUniConv/armscii_8.h
index 32b4e9c5..6ca102ea 100644
--- a/src/xlibi18n/lcUniConv/armscii_8.h
+++ b/src/xlibi18n/lcUniConv/armscii_8.h
@@ -6,8 +6,8 @@
static const unsigned short armscii_8_2uni[96] = {
/* 0xa0 */
- 0x00a0, 0x2741, 0x00a7, 0x0589, 0x0029, 0x0028, 0x00bb, 0x00ab,
- 0x2014, 0x002e, 0x055d, 0x002c, 0x002d, 0x055f, 0x2026, 0x055c,
+ 0x00a0, 0xfffd, 0x0587, 0x0589, 0x0029, 0x0028, 0x00bb, 0x00ab,
+ 0x2014, 0x002e, 0x055d, 0x002c, 0x002d, 0x058a, 0x2026, 0x055c,
/* 0xb0 */
0x055b, 0x055e, 0x0531, 0x0561, 0x0532, 0x0562, 0x0533, 0x0563,
0x0534, 0x0564, 0x0535, 0x0565, 0x0536, 0x0566, 0x0537, 0x0567,
@@ -22,26 +22,32 @@ static const unsigned short armscii_8_2uni[96] = {
0x054c, 0x057c, 0x054d, 0x057d, 0x054e, 0x057e, 0x054f, 0x057f,
/* 0xf0 */
0x0550, 0x0580, 0x0551, 0x0581, 0x0552, 0x0582, 0x0553, 0x0583,
- 0x0554, 0x0584, 0x0555, 0x0585, 0x0556, 0x0586, 0x2019, 0x0027,
+ 0x0554, 0x0584, 0x0555, 0x0585, 0x0556, 0x0586, 0x055a, 0xfffd,
};
static int
armscii_8_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)
{
unsigned char c = *s;
- if (c < 0xa0)
+ if (c < 0xa0) {
*pwc = (ucs4_t) c;
- else
- *pwc = (ucs4_t) armscii_8_2uni[c-0xa0];
- return 1;
+ return 1;
+ }
+ else {
+ unsigned short wc = armscii_8_2uni[c-0xa0];
+ if (wc != 0xfffd) {
+ *pwc = (ucs4_t) wc;
+ return 1;
+ }
+ }
+ return RET_ILSEQ;
}
-static const unsigned char armscii_8_page00[16] = {
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0xff, /* 0x20-0x27 */
+static const unsigned char armscii_8_page00[8] = {
0xa5, 0xa4, 0x2a, 0x2b, 0xab, 0xac, 0xa9, 0x2f, /* 0x28-0x2f */
};
static const unsigned char armscii_8_page00_1[32] = {
- 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa2, /* 0xa0-0xa7 */
+ 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */
0x00, 0x00, 0x00, 0xa7, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */
0x00, 0x00, 0x00, 0xa6, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */
@@ -52,17 +58,17 @@ static const unsigned char armscii_8_page05[96] = {
0xd0, 0xd2, 0xd4, 0xd6, 0xd8, 0xda, 0xdc, 0xde, /* 0x40-0x47 */
0xe0, 0xe2, 0xe4, 0xe6, 0xe8, 0xea, 0xec, 0xee, /* 0x48-0x4f */
0xf0, 0xf2, 0xf4, 0xf6, 0xf8, 0xfa, 0xfc, 0x00, /* 0x50-0x57 */
- 0x00, 0x00, 0x00, 0xb0, 0xaf, 0xaa, 0xb1, 0xad, /* 0x58-0x5f */
+ 0x00, 0x00, 0xfe, 0xb0, 0xaf, 0xaa, 0xb1, 0x00, /* 0x58-0x5f */
0x00, 0xb3, 0xb5, 0xb7, 0xb9, 0xbb, 0xbd, 0xbf, /* 0x60-0x67 */
0xc1, 0xc3, 0xc5, 0xc7, 0xc9, 0xcb, 0xcd, 0xcf, /* 0x68-0x6f */
0xd1, 0xd3, 0xd5, 0xd7, 0xd9, 0xdb, 0xdd, 0xdf, /* 0x70-0x77 */
0xe1, 0xe3, 0xe5, 0xe7, 0xe9, 0xeb, 0xed, 0xef, /* 0x78-0x7f */
- 0xf1, 0xf3, 0xf5, 0xf7, 0xf9, 0xfb, 0xfd, 0x00, /* 0x80-0x87 */
- 0x00, 0xa3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
+ 0xf1, 0xf3, 0xf5, 0xf7, 0xf9, 0xfb, 0xfd, 0xa2, /* 0x80-0x87 */
+ 0x00, 0xa3, 0xad, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */
};
static const unsigned char armscii_8_page20[24] = {
0x00, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, /* 0x10-0x17 */
- 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xae, 0x00, /* 0x20-0x27 */
};
@@ -70,12 +76,12 @@ static int
armscii_8_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
{
unsigned char c = 0;
- if (wc < 0x0020) {
+ if (wc < 0x0028) {
*r = wc;
return 1;
}
- else if (wc >= 0x0020 && wc < 0x0030)
- c = armscii_8_page00[wc-0x0020];
+ else if (wc >= 0x0028 && wc < 0x0030)
+ c = armscii_8_page00[wc-0x0028];
else if (wc >= 0x0030 && wc < 0x00a0)
c = wc;
else if (wc >= 0x00a0 && wc < 0x00c0)
@@ -84,8 +90,6 @@ armscii_8_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
c = armscii_8_page05[wc-0x0530];
else if (wc >= 0x2010 && wc < 0x2028)
c = armscii_8_page20[wc-0x2010];
- else if (wc == 0x2741)
- c = 0xa1;
if (c != 0) {
*r = c;
return 1;
diff --git a/src/xlibi18n/lcUniConv/ascii.h b/src/xlibi18n/lcUniConv/ascii.h
index 183de0bb..db8677d7 100644
--- a/src/xlibi18n/lcUniConv/ascii.h
+++ b/src/xlibi18n/lcUniConv/ascii.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/ascii.h,v 1.3 2000/11/29 17:40:28 dawes Exp $ */
+/* $XFree86$ */
/*
* ASCII
diff --git a/src/xlibi18n/lcUniConv/big5.h b/src/xlibi18n/lcUniConv/big5.h
index 83e5f400..b356b5eb 100644
--- a/src/xlibi18n/lcUniConv/big5.h
+++ b/src/xlibi18n/lcUniConv/big5.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/big5.h,v 1.1 2000/11/28 18:50:03 dawes Exp $ */
+/* $XFree86: xc/lib/X11/lcUniConv/big5.h,v 1.1tsi Exp $ */
/*
* BIG5
@@ -4103,7 +4103,7 @@ big5_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
{
if (n >= 2) {
const Summary16 *summary = NULL;
- if (wc >= 0x0000 && wc < 0x0100)
+ if (wc < 0x0100)
summary = &big5_uni2indx_page00[(wc>>4)];
else if (wc >= 0x0200 && wc < 0x0460)
summary = &big5_uni2indx_page02[(wc>>4)-0x020];
diff --git a/src/xlibi18n/lcUniConv/big5_emacs.h b/src/xlibi18n/lcUniConv/big5_emacs.h
index 91475539..4a8f6ed5 100644
--- a/src/xlibi18n/lcUniConv/big5_emacs.h
+++ b/src/xlibi18n/lcUniConv/big5_emacs.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/big5_emacs.h,v 1.1 2000/11/28 18:50:06 dawes Exp $ */
+/* $XFree86$ */
/*
* BIG5-0 and BIG5-1
diff --git a/src/xlibi18n/lcUniConv/cjk_tab_to_h.c b/src/xlibi18n/lcUniConv/cjk_tab_to_h.c
index 1335fae7..f3cc1e0e 100644
--- a/src/xlibi18n/lcUniConv/cjk_tab_to_h.c
+++ b/src/xlibi18n/lcUniConv/cjk_tab_to_h.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/cjk_tab_to_h.c,v 1.2 2000/12/04 18:49:31 dawes Exp $ */
+/* $XFree86$ */
/*
* Generates a CJK character set table from a .TXT table as found on
diff --git a/src/xlibi18n/lcUniConv/cp1133.h b/src/xlibi18n/lcUniConv/cp1133.h
index da7f5896..8b7ff548 100644
--- a/src/xlibi18n/lcUniConv/cp1133.h
+++ b/src/xlibi18n/lcUniConv/cp1133.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/cp1133.h,v 1.3 2000/11/29 17:40:28 dawes Exp $ */
+/* $XFree86$ */
/*
* IBM-CP1133
diff --git a/src/xlibi18n/lcUniConv/cp1251.h b/src/xlibi18n/lcUniConv/cp1251.h
index f3f7577f..166d5ba8 100644
--- a/src/xlibi18n/lcUniConv/cp1251.h
+++ b/src/xlibi18n/lcUniConv/cp1251.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/cp1251.h,v 1.1 2000/12/04 18:49:32 dawes Exp $ */
+/* $XFree86$ */
/*
* CP1251
diff --git a/src/xlibi18n/lcUniConv/cp1255.h b/src/xlibi18n/lcUniConv/cp1255.h
index 17b843ee..f8e175d8 100644
--- a/src/xlibi18n/lcUniConv/cp1255.h
+++ b/src/xlibi18n/lcUniConv/cp1255.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/cp1255.h,v 1.1 2000/12/04 18:49:33 dawes Exp $ */
+/* $XFree86$ */
/*
* CP1255
diff --git a/src/xlibi18n/lcUniConv/cp1256.h b/src/xlibi18n/lcUniConv/cp1256.h
index 5d4051bf..5097762a 100644
--- a/src/xlibi18n/lcUniConv/cp1256.h
+++ b/src/xlibi18n/lcUniConv/cp1256.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/cp1256.h,v 1.1 2000/12/04 18:49:34 dawes Exp $ */
+/* $XFree86$ */
/*
* CP1256
diff --git a/src/xlibi18n/lcUniConv/gb2312.h b/src/xlibi18n/lcUniConv/gb2312.h
index 7337e0b5..db900a47 100644
--- a/src/xlibi18n/lcUniConv/gb2312.h
+++ b/src/xlibi18n/lcUniConv/gb2312.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/gb2312.h,v 1.4 2001/08/09 19:14:07 dawes Exp $ */
+/* $XFree86: xc/lib/X11/lcUniConv/gb2312.h,v 1.4tsi Exp $ */
/*
* GB2312.1980-0
@@ -2518,7 +2518,7 @@ gb2312_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
{
if (n >= 2) {
const Summary16 *summary = NULL;
- if (wc >= 0x0000 && wc < 0x0460)
+ if (wc < 0x0460)
summary = &gb2312_uni2indx_page00[(wc>>4)];
else if (wc >= 0x2000 && wc < 0x2650)
summary = &gb2312_uni2indx_page20[(wc>>4)-0x200];
diff --git a/src/xlibi18n/lcUniConv/georgian_academy.h b/src/xlibi18n/lcUniConv/georgian_academy.h
index a847c52e..23036901 100644
--- a/src/xlibi18n/lcUniConv/georgian_academy.h
+++ b/src/xlibi18n/lcUniConv/georgian_academy.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/georgian_academy.h,v 1.3 2000/11/29 17:40:29 dawes Exp $ */
+/* $XFree86$ */
/*
* GEORGIAN-ACADEMY
diff --git a/src/xlibi18n/lcUniConv/georgian_ps.h b/src/xlibi18n/lcUniConv/georgian_ps.h
index e7220d0a..b7e30bf0 100644
--- a/src/xlibi18n/lcUniConv/georgian_ps.h
+++ b/src/xlibi18n/lcUniConv/georgian_ps.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/georgian_ps.h,v 1.3 2000/11/29 17:40:29 dawes Exp $ */
+/* $XFree86$ */
/*
* GEORGIAN-PS
diff --git a/src/xlibi18n/lcUniConv/iso8859_1.h b/src/xlibi18n/lcUniConv/iso8859_1.h
index a600899f..0b03e702 100644
--- a/src/xlibi18n/lcUniConv/iso8859_1.h
+++ b/src/xlibi18n/lcUniConv/iso8859_1.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/iso8859_1.h,v 1.3 2000/11/29 17:40:30 dawes Exp $ */
+/* $XFree86$ */
/*
* ISO-8859-1
diff --git a/src/xlibi18n/lcUniConv/iso8859_10.h b/src/xlibi18n/lcUniConv/iso8859_10.h
index b63de3eb..f0ef2f69 100644
--- a/src/xlibi18n/lcUniConv/iso8859_10.h
+++ b/src/xlibi18n/lcUniConv/iso8859_10.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/iso8859_10.h,v 1.3 2000/11/29 17:40:30 dawes Exp $ */
+/* $XFree86$ */
/*
* ISO-8859-10
diff --git a/src/xlibi18n/lcUniConv/iso8859_11.h b/src/xlibi18n/lcUniConv/iso8859_11.h
index ced0b3f2..57eb016a 100644
--- a/src/xlibi18n/lcUniConv/iso8859_11.h
+++ b/src/xlibi18n/lcUniConv/iso8859_11.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/iso8859_11.h,v 1.2 2002/10/09 16:38:19 tsi Exp $ */
+/* $XFree86: xc/lib/X11/lcUniConv/iso8859_11.h,v 1.1tsi Exp $ */
/*
* ISO8859-11
diff --git a/src/xlibi18n/lcUniConv/iso8859_13.h b/src/xlibi18n/lcUniConv/iso8859_13.h
index fe1d767b..7ad1fd2a 100644
--- a/src/xlibi18n/lcUniConv/iso8859_13.h
+++ b/src/xlibi18n/lcUniConv/iso8859_13.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/iso8859_13.h,v 1.2 2000/11/28 16:10:26 dawes Exp $ */
+/* $XFree86: xc/lib/X11/lcUniConv/iso8859_13.h,v 1.1 2000/06/23 19:50:59 dawes Exp $ */
/*
* ISO-8859-13
diff --git a/src/xlibi18n/lcUniConv/iso8859_14.h b/src/xlibi18n/lcUniConv/iso8859_14.h
index c76c2c2a..7fd322cc 100644
--- a/src/xlibi18n/lcUniConv/iso8859_14.h
+++ b/src/xlibi18n/lcUniConv/iso8859_14.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/iso8859_14.h,v 1.3 2000/11/29 17:40:30 dawes Exp $ */
+/* $XFree86$ */
/*
* ISO-8859-14
diff --git a/src/xlibi18n/lcUniConv/iso8859_15.h b/src/xlibi18n/lcUniConv/iso8859_15.h
index 8c613d7f..209ca21b 100644
--- a/src/xlibi18n/lcUniConv/iso8859_15.h
+++ b/src/xlibi18n/lcUniConv/iso8859_15.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/iso8859_15.h,v 1.3 2000/11/29 17:40:31 dawes Exp $ */
+/* $XFree86$ */
/*
* ISO-8859-15
diff --git a/src/xlibi18n/lcUniConv/iso8859_16.h b/src/xlibi18n/lcUniConv/iso8859_16.h
index 3efe2ffe..657e4450 100644
--- a/src/xlibi18n/lcUniConv/iso8859_16.h
+++ b/src/xlibi18n/lcUniConv/iso8859_16.h
@@ -6,8 +6,8 @@
static const unsigned short iso8859_16_2uni[96] = {
/* 0xa0 */
- 0x00a0, 0x0104, 0x0105, 0x0141, 0x20ac, 0x00ab, 0x0160, 0x00a7,
- 0x0161, 0x00a9, 0x0218, 0x201e, 0x0179, 0x00ad, 0x017a, 0x017b,
+ 0x00a0, 0x0104, 0x0105, 0x0141, 0x20ac, 0x201e, 0x0160, 0x00a7,
+ 0x0161, 0x00a9, 0x0218, 0x00ab, 0x0179, 0x00ad, 0x017a, 0x017b,
/* 0xb0 */
0x00b0, 0x00b1, 0x010c, 0x0142, 0x017d, 0x201d, 0x00b6, 0x00b7,
0x017e, 0x010d, 0x0219, 0x00bb, 0x0152, 0x0153, 0x0178, 0x017c,
@@ -38,7 +38,7 @@ iso8859_16_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)
static const unsigned char iso8859_16_page00[224] = {
0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa7, /* 0xa0-0xa7 */
- 0x00, 0xa9, 0x00, 0xa5, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */
+ 0x00, 0xa9, 0x00, 0xab, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */
0xb0, 0xb1, 0x00, 0x00, 0x00, 0x00, 0xb6, 0xb7, /* 0xb0-0xb7 */
0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */
0xc0, 0xc1, 0xc2, 0x00, 0xc4, 0x00, 0xc6, 0xc7, /* 0xc0-0xc7 */
@@ -71,7 +71,7 @@ static const unsigned char iso8859_16_page02[8] = {
0xaa, 0xba, 0xde, 0xfe, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */
};
static const unsigned char iso8859_16_page20[8] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0xb5, 0xab, 0x00, /* 0x18-0x1f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xb5, 0xa5, 0x00, /* 0x18-0x1f */
};
static int
diff --git a/src/xlibi18n/lcUniConv/iso8859_2.h b/src/xlibi18n/lcUniConv/iso8859_2.h
index 9598d54b..67abd855 100644
--- a/src/xlibi18n/lcUniConv/iso8859_2.h
+++ b/src/xlibi18n/lcUniConv/iso8859_2.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/iso8859_2.h,v 1.3 2000/11/29 17:40:31 dawes Exp $ */
+/* $XFree86$ */
/*
* ISO-8859-2
diff --git a/src/xlibi18n/lcUniConv/iso8859_3.h b/src/xlibi18n/lcUniConv/iso8859_3.h
index 1604c254..399b7906 100644
--- a/src/xlibi18n/lcUniConv/iso8859_3.h
+++ b/src/xlibi18n/lcUniConv/iso8859_3.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/iso8859_3.h,v 1.3 2000/11/29 17:40:31 dawes Exp $ */
+/* $XFree86$ */
/*
* ISO-8859-3
diff --git a/src/xlibi18n/lcUniConv/iso8859_4.h b/src/xlibi18n/lcUniConv/iso8859_4.h
index 6ea62d1c..f787fa85 100644
--- a/src/xlibi18n/lcUniConv/iso8859_4.h
+++ b/src/xlibi18n/lcUniConv/iso8859_4.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/iso8859_4.h,v 1.3 2000/11/29 17:40:31 dawes Exp $ */
+/* $XFree86$ */
/*
* ISO-8859-4
diff --git a/src/xlibi18n/lcUniConv/iso8859_5.h b/src/xlibi18n/lcUniConv/iso8859_5.h
index d4785677..4a2e46e5 100644
--- a/src/xlibi18n/lcUniConv/iso8859_5.h
+++ b/src/xlibi18n/lcUniConv/iso8859_5.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/iso8859_5.h,v 1.3 2000/11/29 17:40:32 dawes Exp $ */
+/* $XFree86$ */
/*
* ISO-8859-5
diff --git a/src/xlibi18n/lcUniConv/iso8859_6.h b/src/xlibi18n/lcUniConv/iso8859_6.h
index 4d57893a..22c66713 100644
--- a/src/xlibi18n/lcUniConv/iso8859_6.h
+++ b/src/xlibi18n/lcUniConv/iso8859_6.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/iso8859_6.h,v 1.3 2000/11/29 17:40:32 dawes Exp $ */
+/* $XFree86$ */
/*
* ISO-8859-6
diff --git a/src/xlibi18n/lcUniConv/iso8859_7.h b/src/xlibi18n/lcUniConv/iso8859_7.h
index 790cec75..2fb38cae 100644
--- a/src/xlibi18n/lcUniConv/iso8859_7.h
+++ b/src/xlibi18n/lcUniConv/iso8859_7.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/iso8859_7.h,v 1.3 2000/11/29 17:40:32 dawes Exp $ */
+/* $XFree86$ */
/*
* ISO-8859-7
diff --git a/src/xlibi18n/lcUniConv/iso8859_8.h b/src/xlibi18n/lcUniConv/iso8859_8.h
index 7b780f02..e9d77a22 100644
--- a/src/xlibi18n/lcUniConv/iso8859_8.h
+++ b/src/xlibi18n/lcUniConv/iso8859_8.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/iso8859_8.h,v 1.3 2000/11/29 17:40:32 dawes Exp $ */
+/* $XFree86$ */
/*
* ISO-8859-8
diff --git a/src/xlibi18n/lcUniConv/iso8859_9.h b/src/xlibi18n/lcUniConv/iso8859_9.h
index 55ec1cb1..662992d0 100644
--- a/src/xlibi18n/lcUniConv/iso8859_9.h
+++ b/src/xlibi18n/lcUniConv/iso8859_9.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/iso8859_9.h,v 1.3 2000/11/29 17:40:32 dawes Exp $ */
+/* $XFree86$ */
/*
* ISO-8859-9
diff --git a/src/xlibi18n/lcUniConv/iso8859_9e.h b/src/xlibi18n/lcUniConv/iso8859_9e.h
index a5a0b609..17ff75b0 100644
--- a/src/xlibi18n/lcUniConv/iso8859_9e.h
+++ b/src/xlibi18n/lcUniConv/iso8859_9e.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/iso8859_9e.h,v 1.3 2000/11/28 16:10:28 dawes Exp $ */
+/* $XFree86: xc/lib/X11/lcUniConv/iso8859_9e.h,v 1.2 2000/11/02 19:10:45 dawes Exp $ */
/*
* ISO-8859-9E
diff --git a/src/xlibi18n/lcUniConv/jisx0201.h b/src/xlibi18n/lcUniConv/jisx0201.h
index 4a30f284..fec138a4 100644
--- a/src/xlibi18n/lcUniConv/jisx0201.h
+++ b/src/xlibi18n/lcUniConv/jisx0201.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/jisx0201.h,v 1.3 2000/11/29 17:40:33 dawes Exp $ */
+/* $XFree86$ */
/*
* JISX0201.1976-0
diff --git a/src/xlibi18n/lcUniConv/jisx0208.h b/src/xlibi18n/lcUniConv/jisx0208.h
index ea075471..4d8a8918 100644
--- a/src/xlibi18n/lcUniConv/jisx0208.h
+++ b/src/xlibi18n/lcUniConv/jisx0208.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/jisx0208.h,v 1.5 2001/11/21 21:20:56 dawes Exp $ */
+/* $XFree86: xc/lib/X11/lcUniConv/jisx0208.h,v 1.5tsi Exp $ */
/*
* JISX0208.1990-0
@@ -2360,7 +2360,7 @@ jisx0208_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
{
if (n >= 2) {
const Summary16 *summary = NULL;
- if (wc >= 0x0000 && wc < 0x0100)
+ if (wc < 0x0100)
summary = &jisx0208_uni2indx_page00[(wc>>4)];
else if (wc >= 0x0300 && wc < 0x0460)
summary = &jisx0208_uni2indx_page03[(wc>>4)-0x030];
diff --git a/src/xlibi18n/lcUniConv/jisx0212.h b/src/xlibi18n/lcUniConv/jisx0212.h
index 3b7e6dc0..6c89ee63 100644
--- a/src/xlibi18n/lcUniConv/jisx0212.h
+++ b/src/xlibi18n/lcUniConv/jisx0212.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/jisx0212.h,v 1.4 2001/08/09 19:14:08 dawes Exp $ */
+/* $XFree86: xc/lib/X11/lcUniConv/jisx0212.h,v 1.4tsi Exp $ */
/*
* JISX0212.1990-0
@@ -2135,7 +2135,7 @@ jisx0212_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
{
if (n >= 2) {
const Summary16 *summary = NULL;
- if (wc >= 0x0000 && wc < 0x0460)
+ if (wc < 0x0460)
summary = &jisx0212_uni2indx_page00[(wc>>4)];
else if (wc >= 0x2100 && wc < 0x2130)
summary = &jisx0212_uni2indx_page21[(wc>>4)-0x210];
diff --git a/src/xlibi18n/lcUniConv/koi8_c.h b/src/xlibi18n/lcUniConv/koi8_c.h
index e31c3684..504c2589 100644
--- a/src/xlibi18n/lcUniConv/koi8_c.h
+++ b/src/xlibi18n/lcUniConv/koi8_c.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/koi8_c.h,v 1.2 2000/11/28 16:10:29 dawes Exp $ */
+/* $XFree86: xc/lib/X11/lcUniConv/koi8_c.h,v 1.1 2000/10/27 20:26:08 dawes Exp $ */
/*
* KOI8-C
diff --git a/src/xlibi18n/lcUniConv/koi8_r.h b/src/xlibi18n/lcUniConv/koi8_r.h
index a0d3d9b2..dfbbb8dc 100644
--- a/src/xlibi18n/lcUniConv/koi8_r.h
+++ b/src/xlibi18n/lcUniConv/koi8_r.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/koi8_r.h,v 1.3 2000/11/29 17:40:34 dawes Exp $ */
+/* $XFree86$ */
/*
* KOI8-R
diff --git a/src/xlibi18n/lcUniConv/koi8_u.h b/src/xlibi18n/lcUniConv/koi8_u.h
index 43457afd..168d6a10 100644
--- a/src/xlibi18n/lcUniConv/koi8_u.h
+++ b/src/xlibi18n/lcUniConv/koi8_u.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/koi8_u.h,v 1.3 2000/11/29 17:40:34 dawes Exp $ */
+/* $XFree86$ */
/*
* KOI8-U
diff --git a/src/xlibi18n/lcUniConv/ksc5601.h b/src/xlibi18n/lcUniConv/ksc5601.h
index c7dab1eb..7e2a4623 100644
--- a/src/xlibi18n/lcUniConv/ksc5601.h
+++ b/src/xlibi18n/lcUniConv/ksc5601.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/ksc5601.h,v 1.4 2001/08/09 19:14:09 dawes Exp $ */
+/* $XFree86: xc/lib/X11/lcUniConv/ksc5601.h,v 1.4tsi Exp $ */
/*
* KSC5601.1987-0
@@ -2966,7 +2966,7 @@ ksc5601_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n)
{
if (n >= 2) {
const Summary16 *summary = NULL;
- if (wc >= 0x0000 && wc < 0x0460)
+ if (wc < 0x0460)
summary = &ksc5601_uni2indx_page00[(wc>>4)];
else if (wc >= 0x2000 && wc < 0x2670)
summary = &ksc5601_uni2indx_page20[(wc>>4)-0x200];
diff --git a/src/xlibi18n/lcUniConv/mulelao.h b/src/xlibi18n/lcUniConv/mulelao.h
index 2afd7b51..0e331f81 100644
--- a/src/xlibi18n/lcUniConv/mulelao.h
+++ b/src/xlibi18n/lcUniConv/mulelao.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/mulelao.h,v 1.3 2000/11/29 17:40:35 dawes Exp $ */
+/* $XFree86$ */
/*
* MULELAO-1
diff --git a/src/xlibi18n/lcUniConv/tatar_cyr.h b/src/xlibi18n/lcUniConv/tatar_cyr.h
index 53607005..5783fd92 100644
--- a/src/xlibi18n/lcUniConv/tatar_cyr.h
+++ b/src/xlibi18n/lcUniConv/tatar_cyr.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/tatar_cyr.h,v 1.3 2000/12/04 18:49:42 dawes Exp $ */
+/* $XFree86: xc/lib/X11/lcUniConv/tatar_cyr.h,v 1.2 2000/11/28 16:10:31 dawes Exp $ */
/*
* TATAR-CYR
diff --git a/src/xlibi18n/lcUniConv/tcvn.h b/src/xlibi18n/lcUniConv/tcvn.h
index f3d49755..eb80ab3f 100644
--- a/src/xlibi18n/lcUniConv/tcvn.h
+++ b/src/xlibi18n/lcUniConv/tcvn.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/tcvn.h,v 1.3 2000/11/29 17:40:35 dawes Exp $ */
+/* $XFree86$ */
/*
* TCVN-5712
diff --git a/src/xlibi18n/lcUniConv/tis620.h b/src/xlibi18n/lcUniConv/tis620.h
index beb7cd95..deda9769 100644
--- a/src/xlibi18n/lcUniConv/tis620.h
+++ b/src/xlibi18n/lcUniConv/tis620.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/tis620.h,v 1.4 2001/02/09 00:02:54 dawes Exp $ */
+/* $XFree86: xc/lib/X11/lcUniConv/tis620.h,v 1.3 2000/11/29 17:40:35 dawes Exp $ */
/*
* TIS620-0
diff --git a/src/xlibi18n/lcUniConv/ucs2be.h b/src/xlibi18n/lcUniConv/ucs2be.h
index af2a586b..ff9acc39 100644
--- a/src/xlibi18n/lcUniConv/ucs2be.h
+++ b/src/xlibi18n/lcUniConv/ucs2be.h
@@ -1,7 +1,7 @@
/*
* UCS-2BE = UCS-2 big endian
*/
-/* $XFree86: xc/lib/X11/lcUniConv/ucs2be.h,v 1.1 2000/11/28 17:25:09 dawes Exp $ */
+/* $XFree86$ */
static int
ucs2be_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n)
diff --git a/src/xlibi18n/lcUniConv/utf8.h b/src/xlibi18n/lcUniConv/utf8.h
index fe189cc2..f8c2a7d8 100644
--- a/src/xlibi18n/lcUniConv/utf8.h
+++ b/src/xlibi18n/lcUniConv/utf8.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/utf8.h,v 1.3 2000/11/28 18:50:07 dawes Exp $ */
+/* $XFree86: xc/lib/X11/lcUniConv/utf8.h,v 1.2 2000/11/28 16:10:32 dawes Exp $ */
/*
* UTF-8
diff --git a/src/xlibi18n/lcUniConv/viscii.h b/src/xlibi18n/lcUniConv/viscii.h
index 9dffbf05..f7dfd447 100644
--- a/src/xlibi18n/lcUniConv/viscii.h
+++ b/src/xlibi18n/lcUniConv/viscii.h
@@ -1,4 +1,4 @@
-/* $XFree86: xc/lib/X11/lcUniConv/viscii.h,v 1.3 2000/11/29 17:40:35 dawes Exp $ */
+/* $XFree86$ */
/*
* VISCII1.1-1
diff --git a/src/xlibi18n/lcUtil.c b/src/xlibi18n/lcUtil.c
index cb439b0b..fb159098 100644
--- a/src/xlibi18n/lcUtil.c
+++ b/src/xlibi18n/lcUtil.c
@@ -22,57 +22,64 @@
*
* Author: Katsuhisa Yano TOSHIBA Corp.
* mopi@osa.ilab.toshiba.co.jp
+ * Bug fixes: Bruno Haible XFree86 Inc.
*/
+/* $XFree86: xc/lib/X11/lcUtil.c,v 1.3 2000/11/29 17:40:24 dawes Exp $ */
-#include <stdio.h>
-#include <ctype.h>
-#include <X11/Xos.h>
-#include "Xlibint.h"
+#include <X11/Xlib.h>
+#include "XlcPublic.h"
-#ifdef X_NOT_STDC_ENV
-#ifndef toupper
-#define toupper(c) ((int)(c) - 'a' + 'A')
-#endif
-#endif
+/* Don't use <ctype.h> here because it is locale dependent. */
+#define set_toupper(ch) \
+ if (ch >= 'a' && ch <= 'z') \
+ ch = ch - 'a' + 'A';
+
+/* Compares two ISO 8859-1 strings, ignoring case of ASCII letters.
+ Like strcasecmp in an ASCII locale. */
int
-_XlcCompareISOLatin1(str1, str2)
- char *str1, *str2;
+_XlcCompareISOLatin1(
+ const char *str1,
+ const char *str2)
{
- register char ch1, ch2;
-
- for ( ; (ch1 = *str1) && (ch2 = *str2); str1++, str2++) {
- if (islower(ch1))
- ch1 = toupper(ch1);
- if (islower(ch2))
- ch2 = toupper(ch2);
+ unsigned char ch1, ch2;
- if (ch1 != ch2)
- break;
+ for ( ; ; str1++, str2++) {
+ ch1 = *str1;
+ ch2 = *str2;
+ if (ch1 == '\0' || ch2 == '\0')
+ break;
+ set_toupper(ch1);
+ set_toupper(ch2);
+ if (ch1 != ch2)
+ break;
}
- return *str1 - *str2;
+ return ch1 - ch2;
}
+/* Compares two ISO 8859-1 strings, at most len bytes of each, ignoring
+ case of ASCII letters. Like strncasecmp in an ASCII locale. */
int
-_XlcNCompareISOLatin1(str1, str2, len)
- char *str1, *str2;
- int len;
+_XlcNCompareISOLatin1(
+ const char *str1,
+ const char *str2,
+ int len)
{
- register char ch1, ch2;
+ unsigned char ch1, ch2;
- for ( ; (ch1 = *str1) && (ch2 = *str2) && len; str1++, str2++, len--) {
- if (islower(ch1))
- ch1 = toupper(ch1);
- if (islower(ch2))
- ch2 = toupper(ch2);
-
- if (ch1 != ch2)
- break;
+ for ( ; ; str1++, str2++, len--) {
+ if (len == 0)
+ return 0;
+ ch1 = *str1;
+ ch2 = *str2;
+ if (ch1 == '\0' || ch2 == '\0')
+ break;
+ set_toupper(ch1);
+ set_toupper(ch2);
+ if (ch1 != ch2)
+ break;
}
- if (len == 0)
- return 0;
-
- return *str1 - *str2;
+ return ch1 - ch2;
}
diff --git a/src/xlibi18n/lcWrap.c b/src/xlibi18n/lcWrap.c
index d2dcfe94..e489d6a4 100644
--- a/src/xlibi18n/lcWrap.c
+++ b/src/xlibi18n/lcWrap.c
@@ -53,7 +53,9 @@ from The Open Group.
*
* Katsuhisa Yano TOSHIBA Corp.
*/
+/* $XFree86: xc/lib/X11/lcWrap.c,v 3.15 2003/04/13 19:22:22 dawes Exp $ */
+#include <stdlib.h>
#include "Xlibint.h"
#include "Xlcint.h"
#include <X11/Xlocale.h>
@@ -62,37 +64,15 @@ from The Open Group.
#undef close
#endif
#include <X11/Xutil.h>
-
-#ifdef __STDC__
-#define Const const
-#else
-#define Const /**/
-#endif
-
-#ifdef X_NOT_STDC_ENV
-extern char *getenv();
-#endif
-
-extern void _XlcInitLoader(
-#if NeedFunctionPrototypes
- char*
-#endif
-);
+#include "XlcPubI.h"
#ifdef XTHREADS
LockInfoPtr _Xi18n_lock;
#endif
-#if NeedFunctionPrototypes
char *
XSetLocaleModifiers(
- _Xconst char *modifiers
-)
-#else
-char *
-XSetLocaleModifiers(modifiers)
- char *modifiers;
-#endif
+ const char *modifiers)
{
XLCd lcd = _XlcCurrentLC();
char *user_mods;
@@ -118,12 +98,12 @@ XSupportsLocale()
return _XlcCurrentLC() != (XLCd)NULL;
}
-Bool _XlcValidModSyntax(mods, valid_mods)
- char *mods;
- char **valid_mods;
+Bool _XlcValidModSyntax(
+ const char * mods,
+ const char * const *valid_mods)
{
int i;
- char **ptr;
+ const char * const *ptr;
while (mods && (*mods == '@')) {
mods++;
@@ -144,21 +124,21 @@ Bool _XlcValidModSyntax(mods, valid_mods)
return !mods || !*mods;
}
-static Const char *im_valid[] = {"im", (char *)NULL};
+static const char *im_valid[] = {"im", (const char *)NULL};
/*ARGSUSED*/
char *
-_XlcDefaultMapModifiers (lcd, user_mods, prog_mods)
- XLCd lcd;
- char *user_mods;
- char *prog_mods;
+_XlcDefaultMapModifiers(
+ XLCd lcd,
+ const char *user_mods,
+ const char *prog_mods)
{
int i;
char *mods;
- if (!_XlcValidModSyntax(prog_mods, (char **)im_valid))
+ if (!_XlcValidModSyntax(prog_mods, im_valid))
return (char *)NULL;
- if (!_XlcValidModSyntax(user_mods, (char **)im_valid))
+ if (!_XlcValidModSyntax(user_mods, im_valid))
return (char *)NULL;
i = strlen(prog_mods) + 1;
if (user_mods)
@@ -201,8 +181,8 @@ typedef struct _XlcLoaderListRec {
static XlcLoaderList loader_list = NULL;
void
-_XlcRemoveLoader(proc)
- XLCdLoadProc proc;
+_XlcRemoveLoader(
+ XLCdLoadProc proc)
{
XlcLoaderList loader, prev;
@@ -229,9 +209,9 @@ _XlcRemoveLoader(proc)
}
Bool
-_XlcAddLoader(proc, position)
- XLCdLoadProc proc;
- XlcPosition position;
+_XlcAddLoader(
+ XLCdLoadProc proc,
+ XlcPosition position)
{
XlcLoaderList loader, last;
@@ -262,30 +242,31 @@ _XlcAddLoader(proc, position)
}
XLCd
-_XOpenLC(name)
- char *name;
+_XOpenLC(
+ char *name)
{
XLCd lcd;
XlcLoaderList loader;
XLCdList cur;
-#if !defined(X_NOT_STDC_ENV) && !defined(X_LOCALE)
+#if !defined(X_LOCALE)
int len;
char sinamebuf[256];
- char* siname;
- char *_XlcMapOSLocaleName();
+ char* siname = sinamebuf;
#endif
if (name == NULL) {
name = setlocale (LC_CTYPE, (char *)NULL);
-#if !defined(X_NOT_STDC_ENV) && !defined(X_LOCALE)
- /*
- * _XlMapOSLOcaleName will return the same string or a substring
- * of name, so strlen(name) is okay
- */
- if ((len = strlen(name)) < sizeof sinamebuf) siname = sinamebuf;
- else siname = Xmalloc (len + 1);
- if (siname == NULL) return NULL;
- name = _XlcMapOSLocaleName(name, siname);
+#if !defined(X_LOCALE)
+ /*
+ * _XlMapOSLocaleName will return the same string or a substring
+ * of name, so strlen(name) is okay
+ */
+ if ((len = strlen(name)) >= sizeof sinamebuf) {
+ siname = Xmalloc (len + 1);
+ if (siname == NULL)
+ return NULL;
+ }
+ name = _XlcMapOSLocaleName(name, siname);
#endif
}
@@ -302,7 +283,8 @@ _XOpenLC(name)
}
}
- _XlcInitLoader(name);
+ if (!loader_list)
+ _XlcInitLoader();
/*
* not there, so try to get and add to list
@@ -320,14 +302,16 @@ _XOpenLC(name)
(*lcd->methods->close)(lcd);
lcd = (XLCd) NULL;
}
- break;
+ goto found;
}
}
+ lcd = NULL;
+
found:
_XUnlockMutex(_Xi18n_lock);
-#if !defined(X_NOT_STDC_ENV) && !defined(X_LOCALE)
+#if !defined(X_LOCALE)
if (siname != sinamebuf) Xfree(siname);
#endif
@@ -335,8 +319,8 @@ found:
}
void
-_XCloseLC(lcd)
- XLCd lcd;
+_XCloseLC(
+ XLCd lcd)
{
XLCdList cur, *prev;
@@ -350,6 +334,11 @@ _XCloseLC(lcd)
break;
}
}
+
+ if(loader_list) {
+ _XlcDeInitLoader();
+ loader_list = NULL;
+ }
}
/*
@@ -373,8 +362,8 @@ _XlcCurrentLC()
}
XrmMethods
-_XrmInitParseInfo(state)
- XPointer *state;
+_XrmInitParseInfo(
+ XPointer *state)
{
XLCd lcd = _XOpenLC((char *) NULL);
@@ -385,11 +374,11 @@ _XrmInitParseInfo(state)
}
int
-XmbTextPropertyToTextList(dpy, text_prop, list_ret, count_ret)
- Display *dpy;
- XTextProperty *text_prop;
- char ***list_ret;
- int *count_ret;
+XmbTextPropertyToTextList(
+ Display *dpy,
+ const XTextProperty *text_prop,
+ char ***list_ret,
+ int *count_ret)
{
XLCd lcd = _XlcCurrentLC();
@@ -401,11 +390,11 @@ XmbTextPropertyToTextList(dpy, text_prop, list_ret, count_ret)
}
int
-XwcTextPropertyToTextList(dpy, text_prop, list_ret, count_ret)
- Display *dpy;
- XTextProperty *text_prop;
- wchar_t ***list_ret;
- int *count_ret;
+XwcTextPropertyToTextList(
+ Display *dpy,
+ const XTextProperty *text_prop,
+ wchar_t ***list_ret,
+ int *count_ret)
{
XLCd lcd = _XlcCurrentLC();
@@ -417,12 +406,28 @@ XwcTextPropertyToTextList(dpy, text_prop, list_ret, count_ret)
}
int
-XmbTextListToTextProperty(dpy, list, count, style, text_prop)
- Display *dpy;
- char **list;
- int count;
- XICCEncodingStyle style;
- XTextProperty *text_prop;
+Xutf8TextPropertyToTextList(
+ Display *dpy,
+ const XTextProperty *text_prop,
+ char ***list_ret,
+ int *count_ret)
+{
+ XLCd lcd = _XlcCurrentLC();
+
+ if (lcd == NULL)
+ return XLocaleNotSupported;
+
+ return (*lcd->methods->utf8_text_prop_to_list)(lcd, dpy, text_prop,
+ list_ret, count_ret);
+}
+
+int
+XmbTextListToTextProperty(
+ Display *dpy,
+ char **list,
+ int count,
+ XICCEncodingStyle style,
+ XTextProperty *text_prop)
{
XLCd lcd = _XlcCurrentLC();
@@ -434,12 +439,12 @@ XmbTextListToTextProperty(dpy, list, count, style, text_prop)
}
int
-XwcTextListToTextProperty(dpy, list, count, style, text_prop)
- Display *dpy;
- wchar_t **list;
- int count;
- XICCEncodingStyle style;
- XTextProperty *text_prop;
+XwcTextListToTextProperty(
+ Display *dpy,
+ wchar_t **list,
+ int count,
+ XICCEncodingStyle style,
+ XTextProperty *text_prop)
{
XLCd lcd = _XlcCurrentLC();
@@ -450,9 +455,26 @@ XwcTextListToTextProperty(dpy, list, count, style, text_prop)
text_prop);
}
+int
+Xutf8TextListToTextProperty(
+ Display *dpy,
+ char **list,
+ int count,
+ XICCEncodingStyle style,
+ XTextProperty *text_prop)
+{
+ XLCd lcd = _XlcCurrentLC();
+
+ if (lcd == NULL)
+ return XLocaleNotSupported;
+
+ return (*lcd->methods->utf8_text_list_to_prop)(lcd, dpy, list, count,
+ style, text_prop);
+}
+
void
-XwcFreeStringList(list)
- wchar_t **list;
+XwcFreeStringList(
+ wchar_t **list)
{
XLCd lcd = _XlcCurrentLC();
@@ -462,7 +484,7 @@ XwcFreeStringList(list)
(*lcd->methods->wc_free_string_list)(lcd, list);
}
-char *
+const char *
XDefaultString()
{
XLCd lcd = _XlcCurrentLC();
@@ -474,16 +496,16 @@ XDefaultString()
}
void
-_XlcCopyFromArg(src, dst, size)
- char *src;
- register char *dst;
- register int size;
+_XlcCopyFromArg(
+ char *src,
+ char *dst,
+ int size)
{
if (size == sizeof(long))
*((long *) dst) = (long) src;
#ifdef LONG64
else if (size == sizeof(int))
- *((int *) dst) = (int) src;
+ *((int *) dst) = (int)(long) src;
#endif
else if (size == sizeof(short))
*((short *) dst) = (short)(long) src;
@@ -498,13 +520,19 @@ _XlcCopyFromArg(src, dst, size)
}
void
-_XlcCopyToArg(src, dst, size)
- register char *src;
- register char **dst;
- register int size;
+_XlcCopyToArg(
+ char *src,
+ char **dst,
+ int size)
{
+ /* FIXME:
+ On Big Endian machines, this behaves differently than _XCopyToArg. */
if (size == sizeof(long))
*((long *) *dst) = *((long *) src);
+#ifdef LONG64
+ else if (size == sizeof(int))
+ *((int *) *dst) = *((int *) src);
+#endif
else if (size == sizeof(short))
*((short *) *dst) = *((short *) src);
else if (size == sizeof(char))
@@ -516,25 +544,25 @@ _XlcCopyToArg(src, dst, size)
}
void
-_XlcCountVaList(var, count_ret)
- va_list var;
- int *count_ret;
+_XlcCountVaList(
+ va_list var,
+ int *count_ret)
{
- register int count;
+ int count;
for (count = 0; va_arg(var, char *); count++)
- va_arg(var, XPointer);
+ (void)va_arg(var, XPointer);
*count_ret = count;
}
void
-_XlcVaToArgList(var, count, args_ret)
- va_list var;
- register int count;
- XlcArgList *args_ret;
+_XlcVaToArgList(
+ va_list var,
+ int count,
+ XlcArgList *args_ret)
{
- register XlcArgList args;
+ XlcArgList args;
*args_ret = args = (XlcArgList) Xmalloc(sizeof(XlcArg) * count);
if (args == (XlcArgList) NULL)
@@ -547,22 +575,22 @@ _XlcVaToArgList(var, count, args_ret)
}
void
-_XlcCompileResourceList(resources, num_resources)
- register XlcResourceList resources;
- register int num_resources;
+_XlcCompileResourceList(
+ XlcResourceList resources,
+ int num_resources)
{
for ( ; num_resources-- > 0; resources++)
resources->xrm_name = XrmPermStringToQuark(resources->name);
}
char *
-_XlcGetValues(base, resources, num_resources, args, num_args, mask)
- XPointer base;
- XlcResourceList resources;
- int num_resources;
- XlcArgList args;
- int num_args;
- unsigned long mask;
+_XlcGetValues(
+ XPointer base,
+ XlcResourceList resources,
+ int num_resources,
+ XlcArgList args,
+ int num_args,
+ unsigned long mask)
{
XlcResourceList res;
XrmQuark xrm_name;
@@ -588,13 +616,13 @@ _XlcGetValues(base, resources, num_resources, args, num_args, mask)
}
char *
-_XlcSetValues(base, resources, num_resources, args, num_args, mask)
- XPointer base;
- XlcResourceList resources;
- int num_resources;
- XlcArgList args;
- int num_args;
- unsigned long mask;
+_XlcSetValues(
+ XPointer base,
+ XlcResourceList resources,
+ int num_resources,
+ XlcArgList args,
+ int num_args,
+ unsigned long mask)
{
XlcResourceList res;
XrmQuark xrm_name;
diff --git a/src/xlibi18n/mbWMProps.c b/src/xlibi18n/mbWMProps.c
index be256575..44f38139 100644
--- a/src/xlibi18n/mbWMProps.c
+++ b/src/xlibi18n/mbWMProps.c
@@ -26,14 +26,15 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
+/* $XFree86: xc/lib/X11/mbWMProps.c,v 1.5 2001/12/14 19:54:10 dawes Exp $ */
#include <X11/Xlibint.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/Xlocale.h>
-#if NeedFunctionPrototypes
-void XmbSetWMProperties (
+void
+XmbSetWMProperties (
Display *dpy,
Window w,
_Xconst char *windowName,
@@ -43,32 +44,18 @@ void XmbSetWMProperties (
XSizeHints *sizeHints,
XWMHints *wmHints,
XClassHint *classHints)
-#else
-void XmbSetWMProperties (dpy, w, windowName, iconName, argv, argc, sizeHints,
- wmHints, classHints)
- Display *dpy;
- Window w; /* window to decorate */
- char *windowName; /* name of application */
- char *iconName; /* name string for icon */
- char **argv; /* command line */
- int argc; /* size of command line */
- XSizeHints *sizeHints; /* size hints for window in its normal state */
- XWMHints *wmHints; /* miscelaneous window manager hints */
- XClassHint *classHints; /* resource name and class */
-#endif
{
XTextProperty wname, iname;
XTextProperty *wprop = NULL;
XTextProperty *iprop = NULL;
- char *locale;
if (windowName &&
XmbTextListToTextProperty(dpy, (char**)&windowName, 1,
- XStdICCTextStyle, &wname) >= Success)
+ XStdICCTextStyle, &wname) >= Success)
wprop = &wname;
if (iconName &&
XmbTextListToTextProperty(dpy, (char**)&iconName, 1,
- XStdICCTextStyle, &iname) >= Success)
+ XStdICCTextStyle, &iname) >= Success)
iprop = &iname;
XSetWMProperties(dpy, w, wprop, iprop, argv, argc,
sizeHints, wmHints, classHints);
@@ -76,9 +63,6 @@ void XmbSetWMProperties (dpy, w, windowName, iconName, argv, argc, sizeHints,
Xfree((char *)wname.value);
if (iprop)
Xfree((char *)iname.value);
- locale = setlocale(LC_CTYPE, (char *)NULL);
- if (locale)
- XChangeProperty (dpy, w, XInternAtom(dpy, "WM_LOCALE_NAME", False),
- XA_STRING, 8, PropModeReplace,
- (unsigned char *)locale, strlen(locale));
+
+ /* Note: The WM_LOCALE_NAME property is set by XSetWMProperties. */
}
diff --git a/src/xlibi18n/mbWrap.c b/src/xlibi18n/mbWrap.c
index f82ba212..6eca32fc 100644
--- a/src/xlibi18n/mbWrap.c
+++ b/src/xlibi18n/mbWrap.c
@@ -50,20 +50,22 @@ from The Open Group.
*
* M. Collins OSF
*/
+/* $XFree86: xc/lib/X11/mbWrap.c,v 1.6 2001/12/14 19:54:10 dawes Exp $ */
#include "Xlibint.h"
#include "Xlcint.h"
void
-XmbDrawText(dpy, d, gc, x, y, text_items, nitems)
- Display *dpy;
- Drawable d;
- GC gc;
- int x, y;
- XmbTextItem *text_items;
- int nitems;
+XmbDrawText(
+ Display *dpy,
+ Drawable d,
+ GC gc,
+ int x,
+ int y,
+ XmbTextItem *text_items,
+ int nitems)
{
- register XFontSet fs;
+ register XFontSet fs = NULL;
register XmbTextItem *p = text_items;
register int i = nitems;
register int esc;
@@ -86,7 +88,6 @@ XmbDrawText(dpy, d, gc, x, y, text_items, nitems)
}
}
-#if NeedFunctionPrototypes
void
XmbDrawString(
Display *dpy,
@@ -97,24 +98,12 @@ XmbDrawString(
int y,
_Xconst char *text,
int text_len)
-#else
-void
-XmbDrawString(dpy, d, font_set, gc, x, y, text, text_len)
- Display *dpy;
- Drawable d;
- XFontSet font_set;
- GC gc;
- int x, y;
- char *text;
- int text_len;
-#endif
{
(void)(*font_set->methods->mb_draw_string) (dpy, d, font_set, gc, x, y,
(char *)text, text_len);
}
-#if NeedFunctionPrototypes
void
XmbDrawImageString(
Display *dpy,
@@ -125,41 +114,21 @@ XmbDrawImageString(
int y,
_Xconst char *text,
int text_len)
-#else
-void
-XmbDrawImageString(dpy, d, font_set, gc, x, y, text, text_len)
- Display *dpy;
- Drawable d;
- XFontSet font_set;
- GC gc;
- int x, y;
- char *text;
- int text_len;
-#endif
{
(*font_set->methods->mb_draw_image_string) (dpy, d, font_set, gc, x, y,
(char *)text, text_len);
}
-#if NeedFunctionPrototypes
int
XmbTextEscapement(
XFontSet font_set,
_Xconst char *text,
int text_len)
-#else
-int
-XmbTextEscapement(font_set, text, text_len)
- XFontSet font_set;
- char *text;
- int text_len;
-#endif
{
return (*font_set->methods->mb_escapement) (font_set,
(char *)text, text_len);
}
-#if NeedFunctionPrototypes
int
XmbTextExtents(
XFontSet font_set,
@@ -167,16 +136,6 @@ XmbTextExtents(
int text_len,
XRectangle *overall_ink_extents,
XRectangle *overall_logical_extents)
-#else
-int
-XmbTextExtents(font_set, text, text_len,
- overall_ink_extents, overall_logical_extents)
- XFontSet font_set;
- char *text;
- int text_len;
- XRectangle *overall_ink_extents;
- XRectangle *overall_logical_extents;
-#endif
{
return (*font_set->methods->mb_extents) (font_set,
(char *)text, text_len,
@@ -184,7 +143,6 @@ XmbTextExtents(font_set, text, text_len,
overall_logical_extents);
}
-#if NeedFunctionPrototypes
Status
XmbTextPerCharExtents(
XFontSet font_set,
@@ -196,22 +154,6 @@ XmbTextPerCharExtents(
int *num_chars,
XRectangle *max_ink_extents,
XRectangle *max_logical_extents)
-#else
-Status
-XmbTextPerCharExtents(font_set, text, text_len,
- ink_extents_buffer, logical_extents_buffer,
- buffer_size, num_chars,
- max_ink_extents, max_logical_extents)
- XFontSet font_set;
- char *text;
- int text_len;
- XRectangle *ink_extents_buffer;
- XRectangle *logical_extents_buffer;
- int buffer_size;
- int *num_chars;
- XRectangle *max_ink_extents;
- XRectangle *max_logical_extents;
-#endif
{
return (*font_set->methods->mb_extents_per_char)
(font_set, (char *)text, text_len,
diff --git a/src/xlibi18n/utf8WMProps.c b/src/xlibi18n/utf8WMProps.c
index bed38584..084e3d33 100644
--- a/src/xlibi18n/utf8WMProps.c
+++ b/src/xlibi18n/utf8WMProps.c
@@ -55,8 +55,8 @@ from The Open Group.
#include <X11/Xatom.h>
#include <X11/Xlocale.h>
-#if NeedFunctionPrototypes
-void Xutf8SetWMProperties (
+void
+Xutf8SetWMProperties (
Display *dpy,
Window w,
_Xconst char *windowName,
@@ -66,19 +66,6 @@ void Xutf8SetWMProperties (
XSizeHints *sizeHints,
XWMHints *wmHints,
XClassHint *classHints)
-#else
-void Xutf8SetWMProperties (dpy, w, windowName, iconName, argv, argc, sizeHints,
- wmHints, classHints)
- Display *dpy;
- Window w; /* window to decorate */
- _Xconst char *windowName; /* name of application */
- _Xconst char *iconName; /* name string for icon */
- char **argv; /* command line */
- int argc; /* size of command line */
- XSizeHints *sizeHints; /* size hints for window in its normal state */
- XWMHints *wmHints; /* miscelaneous window manager hints */
- XClassHint *classHints; /* resource name and class */
-#endif
{
XTextProperty wname, iname;
XTextProperty *wprop = NULL;
diff --git a/src/xlibi18n/utf8Wrap.c b/src/xlibi18n/utf8Wrap.c
index bde4647b..1a36463d 100644
--- a/src/xlibi18n/utf8Wrap.c
+++ b/src/xlibi18n/utf8Wrap.c
@@ -77,7 +77,6 @@ from The Open Group.
#include "Xlibint.h"
#include "Xlcint.h"
-#if NeedFunctionPrototypes
void
Xutf8DrawText(
Display *dpy,
@@ -87,16 +86,6 @@ Xutf8DrawText(
int y,
XmbTextItem *text_items,
int nitems)
-#else
-void
-Xutf8DrawText(dpy, d, gc, x, y, text_items, nitems)
- Display *dpy;
- Drawable d;
- GC gc;
- int x, y;
- XmbTextItem *text_items;
- int nitems;
-#endif
{
register XFontSet fs = NULL;
register XmbTextItem *p = text_items;
@@ -121,7 +110,6 @@ Xutf8DrawText(dpy, d, gc, x, y, text_items, nitems)
}
}
-#if NeedFunctionPrototypes
void
Xutf8DrawString(
Display *dpy,
@@ -132,24 +120,12 @@ Xutf8DrawString(
int y,
_Xconst char *text,
int text_len)
-#else
-void
-Xutf8DrawString(dpy, d, font_set, gc, x, y, text, text_len)
- Display *dpy;
- Drawable d;
- XFontSet font_set;
- GC gc;
- int x, y;
- _Xconst char *text;
- int text_len;
-#endif
{
(void)(*font_set->methods->utf8_draw_string) (dpy, d, font_set, gc, x, y,
(char *)text, text_len);
}
-#if NeedFunctionPrototypes
void
Xutf8DrawImageString(
Display *dpy,
@@ -160,41 +136,21 @@ Xutf8DrawImageString(
int y,
_Xconst char *text,
int text_len)
-#else
-void
-Xutf8DrawImageString(dpy, d, font_set, gc, x, y, text, text_len)
- Display *dpy;
- Drawable d;
- XFontSet font_set;
- GC gc;
- int x, y;
- _Xconst char *text;
- int text_len;
-#endif
{
(*font_set->methods->utf8_draw_image_string) (dpy, d, font_set, gc, x, y,
(char *)text, text_len);
}
-#if NeedFunctionPrototypes
int
Xutf8TextEscapement(
XFontSet font_set,
_Xconst char *text,
int text_len)
-#else
-int
-Xutf8TextEscapement(font_set, text, text_len)
- XFontSet font_set;
- _Xconst char *text;
- int text_len;
-#endif
{
return (*font_set->methods->utf8_escapement) (font_set,
(char *)text, text_len);
}
-#if NeedFunctionPrototypes
int
Xutf8TextExtents(
XFontSet font_set,
@@ -202,16 +158,6 @@ Xutf8TextExtents(
int text_len,
XRectangle *overall_ink_extents,
XRectangle *overall_logical_extents)
-#else
-int
-Xutf8TextExtents(font_set, text, text_len,
- overall_ink_extents, overall_logical_extents)
- XFontSet font_set;
- _Xconst char *text;
- int text_len;
- XRectangle *overall_ink_extents;
- XRectangle *overall_logical_extents;
-#endif
{
return (*font_set->methods->utf8_extents) (font_set,
(char *)text, text_len,
@@ -219,7 +165,6 @@ Xutf8TextExtents(font_set, text, text_len,
overall_logical_extents);
}
-#if NeedFunctionPrototypes
Status
Xutf8TextPerCharExtents(
XFontSet font_set,
@@ -231,22 +176,6 @@ Xutf8TextPerCharExtents(
int *num_chars,
XRectangle *max_ink_extents,
XRectangle *max_logical_extents)
-#else
-Status
-Xutf8TextPerCharExtents(font_set, text, text_len,
- ink_extents_buffer, logical_extents_buffer,
- buffer_size, num_chars,
- max_ink_extents, max_logical_extents)
- XFontSet font_set;
- _Xconst char *text;
- int text_len;
- XRectangle *ink_extents_buffer;
- XRectangle *logical_extents_buffer;
- int buffer_size;
- int *num_chars;
- XRectangle *max_ink_extents;
- XRectangle *max_logical_extents;
-#endif
{
return (*font_set->methods->utf8_extents_per_char)
(font_set, (char *)text, text_len,
diff --git a/src/xlibi18n/wcWrap.c b/src/xlibi18n/wcWrap.c
index 621423d3..d28f9d09 100644
--- a/src/xlibi18n/wcWrap.c
+++ b/src/xlibi18n/wcWrap.c
@@ -51,20 +51,22 @@ from The Open Group.
*
* M. Collins OSF
*/
+/* $XFree86: xc/lib/X11/wcWrap.c,v 1.6 2001/12/14 19:54:11 dawes Exp $ */
#include "Xlibint.h"
#include "Xlcint.h"
void
-XwcDrawText(dpy, d, gc, x, y, text_items, nitems)
- Display *dpy;
- Drawable d;
- GC gc;
- int x, y;
- XwcTextItem *text_items;
- int nitems;
+XwcDrawText(
+ Display *dpy,
+ Drawable d,
+ GC gc,
+ int x,
+ int y,
+ XwcTextItem *text_items,
+ int nitems)
{
- register XFontSet fs;
+ register XFontSet fs = NULL;
register XwcTextItem *p = text_items;
register int i = nitems;
register int esc;
@@ -87,7 +89,6 @@ XwcDrawText(dpy, d, gc, x, y, text_items, nitems)
}
}
-#if NeedFunctionPrototypes
void
XwcDrawString(
Display *dpy,
@@ -98,23 +99,11 @@ XwcDrawString(
int y,
_Xconst wchar_t *text,
int text_len)
-#else
-void
-XwcDrawString(dpy, d, font_set, gc, x, y, text, text_len)
- Display *dpy;
- Drawable d;
- XFontSet font_set;
- GC gc;
- int x, y;
- wchar_t *text;
- int text_len;
-#endif
{
(void)(*font_set->methods->wc_draw_string) (dpy, d, font_set, gc, x, y,
text, text_len);
}
-#if NeedFunctionPrototypes
void
XwcDrawImageString(
Display *dpy,
@@ -125,40 +114,20 @@ XwcDrawImageString(
int y,
_Xconst wchar_t *text,
int text_len)
-#else
-void
-XwcDrawImageString(dpy, d, font_set, gc, x, y, text, text_len)
- Display *dpy;
- Drawable d;
- XFontSet font_set;
- GC gc;
- int x, y;
- wchar_t *text;
- int text_len;
-#endif
{
(*font_set->methods->wc_draw_image_string) (dpy, d, font_set, gc, x, y,
text, text_len);
}
-#if NeedFunctionPrototypes
int
XwcTextEscapement(
XFontSet font_set,
_Xconst wchar_t *text,
int text_len)
-#else
-int
-XwcTextEscapement(font_set, text, text_len)
- XFontSet font_set;
- wchar_t *text;
- int text_len;
-#endif
{
return (*font_set->methods->wc_escapement) (font_set, text, text_len);
}
-#if NeedFunctionPrototypes
int
XwcTextExtents(
XFontSet font_set,
@@ -166,23 +135,12 @@ XwcTextExtents(
int text_len,
XRectangle *overall_ink_extents,
XRectangle *overall_logical_extents)
-#else
-int
-XwcTextExtents(font_set, text, text_len,
- overall_ink_extents, overall_logical_extents)
- XFontSet font_set;
- wchar_t *text;
- int text_len;
- XRectangle *overall_ink_extents;
- XRectangle *overall_logical_extents;
-#endif
{
return (*font_set->methods->wc_extents) (font_set, text, text_len,
overall_ink_extents,
overall_logical_extents);
}
-#if NeedFunctionPrototypes
Status
XwcTextPerCharExtents(
XFontSet font_set,
@@ -194,22 +152,6 @@ XwcTextPerCharExtents(
int *num_chars,
XRectangle *max_ink_extents,
XRectangle *max_logical_extents)
-#else
-Status
-XwcTextPerCharExtents(font_set, text, text_len,
- ink_extents_buffer, logical_extents_buffer,
- buffer_size, num_chars,
- max_ink_extents, max_logical_extents)
- XFontSet font_set;
- wchar_t *text;
- int text_len;
- XRectangle *ink_extents_buffer;
- XRectangle *logical_extents_buffer;
- int buffer_size;
- int *num_chars;
- XRectangle *max_ink_extents;
- XRectangle *max_logical_extents;
-#endif
{
return (*font_set->methods->wc_extents_per_char)
(font_set, text, text_len,