diff options
Diffstat (limited to 'modules/im')
-rw-r--r-- | modules/im/ximcp/imCallbk.c | 139 | ||||
-rw-r--r-- | modules/im/ximcp/imDefFlt.c | 118 | ||||
-rw-r--r-- | modules/im/ximcp/imDefIc.c | 134 | ||||
-rw-r--r-- | modules/im/ximcp/imDefIm.c | 315 | ||||
-rw-r--r-- | modules/im/ximcp/imDefLkup.c | 485 | ||||
-rw-r--r-- | modules/im/ximcp/imDispch.c | 24 | ||||
-rw-r--r-- | modules/im/ximcp/imEvToWire.c | 19 | ||||
-rw-r--r-- | modules/im/ximcp/imExten.c | 107 | ||||
-rw-r--r-- | modules/im/ximcp/imImSw.c | 6 | ||||
-rw-r--r-- | modules/im/ximcp/imInsClbk.c | 45 | ||||
-rw-r--r-- | modules/im/ximcp/imInt.c | 25 | ||||
-rw-r--r-- | modules/im/ximcp/imLcIc.c | 32 | ||||
-rw-r--r-- | modules/im/ximcp/imLcIm.c | 86 | ||||
-rw-r--r-- | modules/im/ximcp/imLcLkup.c | 140 | ||||
-rw-r--r-- | modules/im/ximcp/imLcPrs.c | 219 | ||||
-rw-r--r-- | modules/im/ximcp/imRm.c | 852 | ||||
-rw-r--r-- | modules/im/ximcp/imRmAttr.c | 283 | ||||
-rw-r--r-- | modules/im/ximcp/imThaiFlt.c | 244 | ||||
-rw-r--r-- | modules/im/ximcp/imThaiIc.c | 32 | ||||
-rw-r--r-- | modules/im/ximcp/imTrX.c | 95 | ||||
-rw-r--r-- | modules/im/ximcp/imTrans.c | 75 | ||||
-rw-r--r-- | modules/im/ximcp/imTransR.c | 47 |
22 files changed, 1529 insertions, 1993 deletions
diff --git a/modules/im/ximcp/imCallbk.c b/modules/im/ximcp/imCallbk.c index e6ffb139..65e8f0f6 100644 --- a/modules/im/ximcp/imCallbk.c +++ b/modules/im/ximcp/imCallbk.c @@ -32,12 +32,16 @@ PERFORMANCE OF THIS SOFTWARE. makoto@sm.sony.co.jp ***********************************************************************/ -/* $XFree86: xc/lib/X11/imCallbk.c,v 3.8 2002/12/15 01:20:56 dawes Exp $ */ +/* $XFree86: xc/lib/X11/imCallbk.c,v 3.10 2003/11/17 22:20:11 dawes Exp $ */ #include "Xlibint.h" #include "Xlcint.h" #include "Ximint.h" #include "XlcPubI.h" +#ifdef X_LOCALE +#define mblen(a,b) _Xmblen(a,b) +extern int _Xmblen (); +#endif #define sz_CARD8 1 #define sz_INT8 1 @@ -72,9 +76,7 @@ typedef enum { } XimCbStatus; typedef XimCbStatus (*XimCb)( -#if NeedFunctionPrototypes Xim, Xic, char*, int -#endif ); #define PACKET_TO_MAJOROPCODE(p) (*(CARD8*)((CARD8*)(p))) @@ -89,7 +91,6 @@ typedef XimCbStatus (*XimCb)( (im->private.proto.read((im),(XPointer)(buf),(buf_len),&(len))) #define _XimFlushData(im) im->private.proto.flush((im)) -#if NeedFunctionPrototypes Private XimCbStatus _XimGeometryCallback(Xim, Xic, char*, int); Private XimCbStatus _XimStrConversionCallback(Xim, Xic, char*, int); Private XimCbStatus _XimPreeditStartCallback(Xim, Xic, char*, int); @@ -101,20 +102,6 @@ Private XimCbStatus _XimStatusStartCallback(Xim, Xic, char*, int); Private XimCbStatus _XimStatusDoneCallback(Xim, Xic, char*, int); Private XimCbStatus _XimStatusDrawCallback(Xim, Xic, char*, int); Private XimCbStatus _XimPreeditStateNotifyCallback(Xim, Xic, char *, int); -#else -Public Bool _XimCbDispatch(); -Private XimCbStatus _XimGeometryCallback(); -Private XimCbStatus _XimStrConversionCallback(); -Private XimCbStatus _XimPreeditStartCallback(); -Private XimCbStatus _XimPreeditDoneCallback(); -Private void _free_memory_for_text(); -Private XimCbStatus _XimPreeditDrawCallback(); -Private XimCbStatus _XimPreeditCaretCallback(); -Private XimCbStatus _XimStatusStartCallback(); -Private XimCbStatus _XimStatusDoneCallback(); -Private XimCbStatus _XimStatusDrawCallback(); -Private XimCbStatus _XimPreeditStateNotifyCallback(); -#endif /* NeedFunctionPrototypes */ #if defined(__STDC__) && ((defined(sun) && defined(SVR4)) || defined(WIN32)) #define RConst /**/ @@ -151,23 +138,13 @@ static RConst XimCb callback_table[] = { Private Bool -#if NeedFunctionPrototypes _XimIsReadyForProcess(Xic ic) -#else -_XimIsReadyForProcess(ic) - Xic ic; -#endif { return(!ic->private.proto.waitCallback); /* check HM */ } Private void -#if NeedFunctionPrototypes _XimProcessPendingCallbacks(Xic ic) -#else -_XimProcessPendingCallbacks(ic) - Xic ic; -#endif { XimPendingCallback pcbq; @@ -184,13 +161,7 @@ _XimProcessPendingCallbacks(ic) } Private void -#if NeedFunctionPrototypes _XimPutCbIntoQueue(Xic ic, XimPendingCallback call_data) -#else -_XimPutCbIntoQueue(ic, call_data) - Xic ic; - XimPendingCallback call_data; -#endif { XimPendingCallback pcbq = ic->private.proto.pend_cb_que; @@ -211,18 +182,10 @@ _XimPutCbIntoQueue(ic, call_data) } Public Bool -#if NeedFunctionPrototypes _XimCbDispatch(Xim xim, INT16 len, XPointer data, XPointer call_data) -#else -_XimCbDispatch(xim, len, data, call_data) - Xim xim; - INT16 len; - XPointer data; - XPointer call_data; -#endif { /* `data' points to the beginning of the packet defined in IM Protocol doc. */ @@ -296,18 +259,10 @@ _XimCbDispatch(xim, len, data, call_data) } Private XimCbStatus -#if NeedFunctionPrototypes _XimGeometryCallback(Xim im, Xic ic, char* proto, int len) -#else -_XimGeometryCallback(im, ic, proto, len) - Xim im; - Xic ic; - char* proto; - int len; -#endif { XICCallback* cb = &ic->core.geometry_callback; @@ -327,18 +282,10 @@ _XimGeometryCallback(im, ic, proto, len) } Private XimCbStatus -#if NeedFunctionPrototypes _XimStrConversionCallback(Xim im, Xic ic, char* proto, int len) -#else -_XimStrConversionCallback(im, ic, proto, len) - Xim im; - Xic ic; - char* proto; - int len; -#endif { XICCallback* cb = &ic->core.string_conversion_callback; /* check HM */ XIMStringConversionCallbackStruct cbrec; @@ -418,18 +365,10 @@ _XimStrConversionCallback(im, ic, proto, len) } Private XimCbStatus -#if NeedFunctionPrototypes _XimPreeditStartCallback(Xim im, Xic ic, char* proto, int len) -#else -_XimPreeditStartCallback(im, ic, proto, len) - Xim im; - Xic ic; - char* proto; - int len; -#endif { XICCallback* cb = &ic->core.preedit_attr.start_callback; int ret; @@ -475,18 +414,10 @@ _XimPreeditStartCallback(im, ic, proto, len) } Private XimCbStatus -#if NeedFunctionPrototypes _XimPreeditDoneCallback(Xim im, Xic ic, char* proto, int len) -#else -_XimPreeditDoneCallback(im, ic, proto, len) - Xim im; - Xic ic; - char* proto; - int len; -#endif { XICCallback* cb = &ic->core.preedit_attr.done_callback; @@ -506,16 +437,9 @@ _XimPreeditDoneCallback(im, ic, proto, len) } Private void -#if NeedFunctionPrototypes _read_text_from_packet(Xim im, char* buf, XIMText** text_ptr) -#else -_read_text_from_packet(im, buf, text_ptr) - Xim im; - char* buf; - XIMText** text_ptr; -#endif { int status; XIMText* text; @@ -628,12 +552,7 @@ _read_text_from_packet(im, buf, text_ptr) } Private void -#if NeedFunctionPrototypes _free_memory_for_text(XIMText* text) -#else -_free_memory_for_text(text) - XIMText* text; -#endif { if (text) { if (text->string.multi_byte) @@ -645,18 +564,10 @@ _free_memory_for_text(text) } Private XimCbStatus -#if NeedFunctionPrototypes _XimPreeditDrawCallback(Xim im, Xic ic, char* proto, int len) -#else -_XimPreeditDrawCallback(im, ic, proto, len) - Xim im; - Xic ic; - char* proto; - int len; -#endif { XICCallback* cb = &ic->core.preedit_attr.draw_callback; XIMPreeditDrawCallbackStruct cbs; @@ -684,18 +595,10 @@ _XimPreeditDrawCallback(im, ic, proto, len) } Private XimCbStatus -#if NeedFunctionPrototypes _XimPreeditCaretCallback(Xim im, Xic ic, char* proto, int len) -#else -_XimPreeditCaretCallback(im, ic, proto, len) - Xim im; - Xic ic; - char* proto; - int len; -#endif { XICCallback* cb = &ic->core.preedit_attr.caret_callback; XIMPreeditCaretCallbackStruct cbs; @@ -744,18 +647,10 @@ _XimPreeditCaretCallback(im, ic, proto, len) } Private XimCbStatus -#if NeedFunctionPrototypes _XimStatusStartCallback(Xim im, Xic ic, char* proto, int len) -#else -_XimStatusStartCallback(im, ic, proto, len) - Xim im; - Xic ic; - char* proto; - int len; -#endif { XICCallback* cb = &ic->core.status_attr.start_callback; @@ -775,18 +670,10 @@ _XimStatusStartCallback(im, ic, proto, len) } Private XimCbStatus -#if NeedFunctionPrototypes _XimStatusDoneCallback(Xim im, Xic ic, char* proto, int len) -#else -_XimStatusDoneCallback(im, ic, proto, len) - Xim im; - Xic ic; - char* proto; - int len; -#endif { XICCallback* cb = &ic->core.status_attr.done_callback; @@ -806,18 +693,10 @@ _XimStatusDoneCallback(im, ic, proto, len) } Private XimCbStatus -#if NeedFunctionPrototypes _XimStatusDrawCallback(Xim im, Xic ic, char* proto, int len) -#else -_XimStatusDrawCallback(im, ic, proto, len) - Xim im; - Xic ic; - char* proto; - int len; -#endif { XICCallback* cb = &ic->core.status_attr.draw_callback; XIMStatusDrawCallbackStruct cbs; @@ -849,15 +728,7 @@ _XimStatusDrawCallback(im, ic, proto, len) } Private XimCbStatus -#if NeedFunctionPrototypes _XimPreeditStateNotifyCallback( Xim im, Xic ic, char* proto, int len ) -#else -_XimPreeditStateNotifyCallback( im, ic, proto, len ) - Xim im; - Xic ic; - char *proto; - int len; -#endif { XICCallback *cb = &ic->core.preedit_attr.state_notify_callback; diff --git a/modules/im/ximcp/imDefFlt.c b/modules/im/ximcp/imDefFlt.c index 19a67cfd..27e7973a 100644 --- a/modules/im/ximcp/imDefFlt.c +++ b/modules/im/ximcp/imDefFlt.c @@ -26,7 +26,7 @@ PERFORMANCE OF THIS SOFTWARE. fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ -/* $XFree86: xc/lib/X11/imDefFlt.c,v 1.4 2001/01/17 19:41:51 dawes Exp $ */ +/* $XFree86: xc/lib/X11/imDefFlt.c,v 1.5 2003/04/13 19:22:20 dawes Exp $ */ #include <X11/Xatom.h> #define NEED_EVENTS @@ -36,11 +36,11 @@ PERFORMANCE OF THIS SOFTWARE. #include "Ximint.h" Private long -_XimTriggerCheck(im, ev, len, keylist) - Xim im; - XKeyEvent *ev; - INT32 len; - CARD32 *keylist; +_XimTriggerCheck( + Xim im, + XKeyEvent *ev, + INT32 len, + CARD32 *keylist) { register long i; KeySym keysym; @@ -67,27 +67,27 @@ _XimTriggerCheck(im, ev, len, keylist) } Private long -_XimTriggerOnCheck(im, ev) - Xim im; - XKeyEvent *ev; +_XimTriggerOnCheck( + Xim im, + XKeyEvent *ev) { return _XimTriggerCheck(im, ev, (INT32)im->private.proto.im_onkeylist[0], &im->private.proto.im_onkeylist[1]); } Private long -_XimTriggerOffCheck(im, ev) - Xim im; - XKeyEvent *ev; +_XimTriggerOffCheck( + Xim im, + XKeyEvent *ev) { return _XimTriggerCheck(im, ev, (INT32)im->private.proto.im_offkeylist[0], &im->private.proto.im_offkeylist[1]); } Private Bool -_XimOnKeysCheck(ic, ev) - Xic ic; - XKeyEvent *ev; +_XimOnKeysCheck( + Xic ic, + XKeyEvent *ev) { Xim im = (Xim)ic->core.im; long idx; @@ -104,9 +104,9 @@ _XimOnKeysCheck(ic, ev) } Private Bool -_XimOffKeysCheck(ic, ev) - Xic ic; - XKeyEvent *ev; +_XimOffKeysCheck( + Xic ic, + XKeyEvent *ev) { Xim im = (Xim)ic->core.im; long idx; @@ -123,8 +123,8 @@ _XimOffKeysCheck(ic, ev) } Private void -_XimPendingFilter(ic) - Xic ic; +_XimPendingFilter( + Xic ic) { Xim im = (Xim)ic->core.im; @@ -136,9 +136,9 @@ _XimPendingFilter(ic) } Private Bool -_XimProtoKeypressFilter(ic, ev) - Xic ic; - XKeyEvent *ev; +_XimProtoKeypressFilter( + Xic ic, + XKeyEvent *ev) { #ifdef XIM_CONNECTABLE Xim im = (Xim)ic->core.im; @@ -189,19 +189,19 @@ _XimProtoKeypressFilter(ic, ev) } Private Bool -_XimFilterKeypress (d, w, ev, client_data) - Display *d; - Window w; - XEvent *ev; - XPointer client_data; +_XimFilterKeypress( + Display *d, + Window w, + XEvent *ev, + XPointer client_data) { return _XimProtoKeypressFilter((Xic)client_data, (XKeyEvent *)ev ); } Private Bool -_XimProtoKeyreleaseFilter( ic, ev ) - Xic ic; - XKeyEvent *ev; +_XimProtoKeyreleaseFilter( + Xic ic, + XKeyEvent *ev) { #ifdef XIM_CONNECTABLE Xim im = (Xim)ic->core.im; @@ -252,18 +252,18 @@ _XimProtoKeyreleaseFilter( ic, ev ) } Private Bool -_XimFilterKeyrelease (d, w, ev, client_data) - Display *d; - Window w; - XEvent *ev; - XPointer client_data; +_XimFilterKeyrelease( + Display *d, + Window w, + XEvent *ev, + XPointer client_data) { return _XimProtoKeyreleaseFilter((Xic)client_data, (XKeyEvent *)ev); } Private void -_XimRegisterKeyPressFilter(ic) - Xic ic ; +_XimRegisterKeyPressFilter( + Xic ic) { if (ic->core.focus_window) { if (!(ic->private.proto.registed_filter_event & KEYPRESS_MASK)) { @@ -279,8 +279,8 @@ _XimRegisterKeyPressFilter(ic) } Private void -_XimRegisterKeyReleaseFilter(ic) - Xic ic ; +_XimRegisterKeyReleaseFilter( + Xic ic) { if (ic->core.focus_window) { if (!(ic->private.proto.registed_filter_event & KEYRELEASE_MASK)) { @@ -296,8 +296,8 @@ _XimRegisterKeyReleaseFilter(ic) } Private void -_XimUnregisterKeyPressFilter(ic) - Xic ic ; +_XimUnregisterKeyPressFilter( + Xic ic) { if (ic->core.focus_window) { if (ic->private.proto.registed_filter_event & KEYPRESS_MASK) { @@ -312,8 +312,8 @@ _XimUnregisterKeyPressFilter(ic) } Private void -_XimUnregisterKeyReleaseFilter(ic) - Xic ic ; +_XimUnregisterKeyReleaseFilter( + Xic ic) { if (ic->core.focus_window) { if (ic->private.proto.registed_filter_event & KEYRELEASE_MASK) { @@ -328,8 +328,8 @@ _XimUnregisterKeyReleaseFilter(ic) } Public void -_XimRegisterFilter(ic) - Xic ic; +_XimRegisterFilter( + Xic ic) { _XimRegisterKeyPressFilter(ic); if (IS_FORWARD_EVENT(ic, KeyReleaseMask)) @@ -338,8 +338,8 @@ _XimRegisterFilter(ic) } Public void -_XimUnregisterFilter(ic) - Xic ic; +_XimUnregisterFilter( + Xic ic) { _XimUnregisterKeyPressFilter(ic); _XimUnregisterKeyReleaseFilter(ic); @@ -347,8 +347,8 @@ _XimUnregisterFilter(ic) } Public void -_XimReregisterFilter(ic) - Xic ic; +_XimReregisterFilter( + Xic ic) { if (IS_FORWARD_EVENT(ic, KeyReleaseMask)) _XimRegisterKeyReleaseFilter(ic); @@ -359,11 +359,11 @@ _XimReregisterFilter(ic) } Private Bool -_XimFilterServerDestroy (d, w, ev, client_data) - Display *d; - Window w; - XEvent *ev; - XPointer client_data; +_XimFilterServerDestroy( + Display *d, + Window w, + XEvent *ev, + XPointer client_data) { Xim im = (Xim)client_data; @@ -381,8 +381,8 @@ _XimFilterServerDestroy (d, w, ev, client_data) } Public void -_XimRegisterServerFilter(im) - Xim im ; +_XimRegisterServerFilter( + Xim im) { if (im->private.proto.im_window) { if (!(im->private.proto.registed_filter_event & DESTROYNOTIFY_MASK)) { @@ -400,8 +400,8 @@ _XimRegisterServerFilter(im) } Public void -_XimUnregisterServerFilter(im) - Xim im ; +_XimUnregisterServerFilter( + Xim im) { if (im->private.proto.im_window) { if (im->private.proto.registed_filter_event & DESTROYNOTIFY_MASK) { diff --git a/modules/im/ximcp/imDefIc.c b/modules/im/ximcp/imDefIc.c index 69a492dd..39e952a8 100644 --- a/modules/im/ximcp/imDefIc.c +++ b/modules/im/ximcp/imDefIc.c @@ -28,7 +28,7 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ -/* $XFree86: xc/lib/X11/imDefIc.c,v 3.8 2001/01/17 19:41:51 dawes Exp $ */ +/* $XFree86: xc/lib/X11/imDefIc.c,v 3.10 2003/11/17 22:20:11 dawes Exp $ */ #include "Xlibint.h" #include "Xlcint.h" @@ -40,19 +40,11 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. extern Bool _XimCheckCreateICValues(); Private Bool -#if NeedFunctionPrototypes _XimCreateICCheck( Xim im, INT16 len, XPointer data, XPointer arg) -#else -_XimCreateICCheck(im, len, data, arg) - Xim im; - INT16 len; - XPointer data; - XPointer arg; -#endif { CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); CARD8 major_opcode = *((CARD8 *)data); @@ -251,19 +243,11 @@ _XimDelayModeGetICValues(ic, arg) #endif /* XIM_CONNECTABLE */ Private Bool -#if NeedFunctionPrototypes _XimGetICValuesCheck( Xim im, INT16 len, XPointer data, XPointer arg) -#else -_XimGetICValuesCheck(im, len, data, arg) - Xim im; - INT16 len; - XPointer data; - XPointer arg; -#endif { Xic ic = (Xic)arg; CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); @@ -288,9 +272,9 @@ _XimGetICValuesCheck(im, len, data, arg) } Private char * -_XimProtoGetICValues(xic, arg) - XIC xic ; - XIMArg *arg ; +_XimProtoGetICValues( + XIC xic, + XIMArg *arg) { Xic ic = (Xic)xic; Xim im = (Xim)ic->core.im; @@ -628,19 +612,11 @@ _XimDelayModeSetICValues(ic, arg) #endif /* XIM_CONNECTABLE */ Private Bool -#if NeedFunctionPrototypes _XimSetICValuesCheck( Xim im, INT16 len, XPointer data, XPointer arg) -#else -_XimSetICValuesCheck(im, len, data, arg) - Xim im; - INT16 len; - XPointer data; - XPointer arg; -#endif { Xic ic = (Xic)arg; CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); @@ -665,9 +641,9 @@ _XimSetICValuesCheck(im, len, data, arg) } Private char * -_XimProtoSetICValues(xic, arg) - XIC xic; - XIMArg *arg; +_XimProtoSetICValues( + XIC xic, + XIMArg *arg) { Xic ic = (Xic)xic; Xim im = (Xim)ic->core.im; @@ -815,19 +791,11 @@ _XimProtoSetICValues(xic, arg) } Private Bool -#if NeedFunctionPrototypes _XimDestroyICCheck( Xim im, INT16 len, XPointer data, XPointer arg) -#else -_XimDestroyICCheck(im, len, data, arg) - Xim im; - INT16 len; - XPointer data; - XPointer arg; -#endif { Xic ic = (Xic)arg; CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); @@ -853,8 +821,8 @@ _XimDestroyICCheck(im, len, data, arg) } Private void -_XimProtoICFree(ic) - Xic ic; +_XimProtoICFree( + Xic ic) { #ifdef XIM_CONNECTABLE Xim im = (Xim)ic->core.im; @@ -900,8 +868,8 @@ _XimProtoICFree(ic) } Private void -_XimProtoDestroyIC(xic) - XIC xic; +_XimProtoDestroyIC( + XIC xic) { Xic ic = (Xic)xic; Xim im = (Xim)ic->core.im; @@ -943,8 +911,8 @@ _XimProtoDestroyIC(xic) } Private void -_XimProtoSetFocus(xic) - XIC xic; +_XimProtoSetFocus( + XIC xic) { Xic ic = (Xic)xic; Xim im = (Xim)ic->core.im; @@ -988,8 +956,8 @@ _XimProtoSetFocus(xic) } Private void -_XimProtoUnsetFocus(xic) - XIC xic; +_XimProtoUnsetFocus( + XIC xic) { Xic ic = (Xic)xic; Xim im = (Xim)ic->core.im; @@ -1033,19 +1001,11 @@ _XimProtoUnsetFocus(xic) } Private Bool -#if NeedFunctionPrototypes _XimResetICCheck( Xim im, INT16 len, XPointer data, XPointer arg) -#else -_XimResetICCheck(im, len, data, arg) - Xim im; - INT16 len; - XPointer data; - XPointer arg; -#endif { Xic ic = (Xic)arg; CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); @@ -1070,9 +1030,9 @@ _XimResetICCheck(im, len, data, arg) } Private char * -_XimProtoReset(xic, retfunc) - XIC xic; - char * (*retfunc) (Xim im, Xic ic, XPointer buf); +_XimProtoReset( + XIC xic, + char * (*retfunc) (Xim im, Xic ic, XPointer buf) ) { Xic ic = (Xic)xic; Xim im = (Xim)ic->core.im; @@ -1141,10 +1101,10 @@ _XimProtoReset(xic, retfunc) } Private char * -_XimCommitedMbString(im, ic, buf) - Xim im; - Xic ic; - XPointer buf; +_XimCommitedMbString( + Xim im, + Xic ic, + XPointer buf) { CARD16 *buf_s = (CARD16 *)buf; XimCommitInfo info; @@ -1191,17 +1151,17 @@ Error_On_Reset: } Private char * -_XimProtoMbReset(xic) - XIC xic; +_XimProtoMbReset( + XIC xic) { return _XimProtoReset(xic, _XimCommitedMbString); } Private wchar_t * -_XimCommitedWcString(im, ic, buf) - Xim im; - Xic ic; - XPointer buf; +_XimCommitedWcString( + Xim im, + Xic ic, + XPointer buf) { CARD16 *buf_s = (CARD16 *)buf; XimCommitInfo info; @@ -1249,18 +1209,18 @@ Error_On_Reset: } Private wchar_t * -_XimProtoWcReset(xic) - XIC xic; +_XimProtoWcReset( + XIC xic) { return (wchar_t *) _XimProtoReset(xic, (char * (*) (Xim, Xic, XPointer)) _XimCommitedWcString); } Private char * -_XimCommitedUtf8String(im, ic, buf) - Xim im; - Xic ic; - XPointer buf; +_XimCommitedUtf8String( + Xim im, + Xic ic, + XPointer buf) { CARD16 *buf_s = (CARD16 *)buf; XimCommitInfo info; @@ -1307,8 +1267,8 @@ Error_On_Reset: } Private char * -_XimProtoUtf8Reset(xic) - XIC xic; +_XimProtoUtf8Reset( + XIC xic) { return _XimProtoReset(xic, _XimCommitedUtf8String); } @@ -1328,9 +1288,9 @@ Private XICMethodsRec ic_methods = { }; Private Bool -_XimGetInputStyle(arg, input_style) - XIMArg *arg; - XIMStyle *input_style; +_XimGetInputStyle( + XIMArg *arg, + XIMStyle *input_style) { register XIMArg *p; @@ -1345,11 +1305,11 @@ _XimGetInputStyle(arg, input_style) #ifdef XIM_CONNECTABLE Private Bool -_XimDelayModeCreateIC(ic, values, res, num) - Xic ic; - XIMArg *values; - XIMResourceList res; - unsigned int num; +_XimDelayModeCreateIC( + Xic ic, + XIMArg *values, + XIMResourceList res, + unsigned int num) { Xim im = (Xim)ic->core.im; XimDefICValues ic_values; @@ -1406,9 +1366,9 @@ _XimReconnectModeCreateIC(ic) #endif /* XIM_CONNECTABLE */ Public XIC -_XimProtoCreateIC(xim, arg) - XIM xim; - XIMArg *arg; +_XimProtoCreateIC( + XIM xim, + XIMArg *arg) { Xim im = (Xim)xim; Xic ic; diff --git a/modules/im/ximcp/imDefIm.c b/modules/im/ximcp/imDefIm.c index e420be14..a2f81eea 100644 --- a/modules/im/ximcp/imDefIm.c +++ b/modules/im/ximcp/imDefIm.c @@ -31,7 +31,7 @@ OF THIS SOFTWARE. makoto@sm.sony.co.jp ******************************************************************/ -/* $XFree86: xc/lib/X11/imDefIm.c,v 1.11 2002/12/14 01:53:56 dawes Exp $ */ +/* $XFree86: xc/lib/X11/imDefIm.c,v 1.16 2003/11/17 22:20:11 dawes Exp $ */ #include <X11/Xatom.h> #define NEED_EVENTS @@ -43,14 +43,10 @@ OF THIS SOFTWARE. #include "Ximint.h" -/* EXTERNS */ -/* imTransR.c */ -extern Bool _XimRegisterDispatcher(); - Public int -_XimCheckDataSize(buf, len) - XPointer buf; - int len; +_XimCheckDataSize( + XPointer buf, + int len) { CARD16 *buf_s = (CARD16 *)buf; @@ -60,20 +56,12 @@ _XimCheckDataSize(buf, len) } Public void -#if NeedFunctionPrototypes _XimSetHeader( XPointer buf, CARD8 major_opcode, CARD8 minor_opcode, INT16 *len ) -#else -_XimSetHeader(buf, major_opcode, minor_opcode, len) - XPointer buf; - CARD8 major_opcode; - CARD8 minor_opcode; - INT16 *len; -#endif /* NeedFunctionPrototypes */ { CARD8 *buf_b = (CARD8 *)buf; CARD16 *buf_s = (CARD16 *)buf; @@ -86,7 +74,7 @@ _XimSetHeader(buf, major_opcode, minor_opcode, len) } Private char -_XimGetMyEndian() +_XimGetMyEndian(void) { CARD16 test_card = 1; @@ -97,9 +85,9 @@ _XimGetMyEndian() } Private Bool -_XimCheckServerName(im, str) - Xim im; - char *str; +_XimCheckServerName( + Xim im, + char *str) { char *server_name = im->core.im_name; int len; @@ -135,12 +123,12 @@ _XimCheckServerName(im, str) } Private char * -_XimCheckLocaleName(im, address, address_len, locale_name, len) - Xim im; - char *address; - int address_len; - char *locale_name[]; - int len; +_XimCheckLocaleName( + Xim im, + char *address, + int address_len, + char *locale_name[], + int len) { int category_len; char *pp; @@ -175,12 +163,12 @@ _XimCheckLocaleName(im, address, address_len, locale_name, len) } Private Bool -_XimCheckTransport(address, address_len, transport, len, trans_addr) - char *address; - int address_len; - char *transport; - int len; - char **trans_addr; +_XimCheckTransport( + char *address, + int address_len, + char *transport, + int len, + char **trans_addr) { int category_len = strlen(XIM_TRANSPORT_CATEGORY); char *pp; @@ -219,10 +207,10 @@ _XimCheckTransport(address, address_len, transport, len, trans_addr) } Private Bool -_CheckSNEvent(display, xevent, arg) - Display *display; - XEvent *xevent; - XPointer arg; +_CheckSNEvent( + Display *display, + XEvent *xevent, + XPointer arg) { XSelectionEvent *event = (XSelectionEvent *)xevent; Window window = *(Window*)arg; @@ -233,11 +221,11 @@ _CheckSNEvent(display, xevent, arg) } Private Bool -_XimGetSelectionNotify(display, window, target, ret_address) - Display *display; - Window window; - Atom target; - char **ret_address; +_XimGetSelectionNotify( + Display *display, + Window window, + Atom target, + char **ret_address) { XEvent event; XSelectionEvent *ev = (XSelectionEvent *)&event; @@ -262,9 +250,9 @@ _XimGetSelectionNotify(display, window, target, ret_address) } Private Bool -_XimPreConnectionIM(im, selection) - Xim im; - Atom selection; +_XimPreConnectionIM( + Xim im, + Atom selection) { Display *display = im->core.display; Atom locales, transport; @@ -380,8 +368,8 @@ Error: } Private Bool -_XimPreConnect(im) - Xim im; +_XimPreConnect( + Xim im) { Display *display = im->core.display; Atom imserver; @@ -427,11 +415,11 @@ _XimPreConnect(im) } Private Bool -_XimGetAuthProtocolNames(im, buf, num, len) - Xim im; - CARD16 *buf; - CARD8 *num; - INT16 *len; +_XimGetAuthProtocolNames( + Xim im, + CARD16 *buf, + CARD8 *num, + INT16 *len) { if (!IS_USE_AUTHORIZATION_FUNC(im)) { *num = 0; @@ -445,10 +433,10 @@ _XimGetAuthProtocolNames(im, buf, num, len) } Private Bool -_XimSetAuthReplyData(im, buf, len) - Xim im; - XPointer buf; - INT16 *len; +_XimSetAuthReplyData( + Xim im, + XPointer buf, + INT16 *len) { /* * Not yet @@ -458,10 +446,10 @@ _XimSetAuthReplyData(im, buf, len) } Private Bool -_XimSetAuthNextData(im, buf, len) - Xim im; - XPointer buf; - INT16 *len; +_XimSetAuthNextData( + Xim im, + XPointer buf, + INT16 *len) { /* * Not yet @@ -471,10 +459,10 @@ _XimSetAuthNextData(im, buf, len) } Private Bool -_XimSetAuthRequiredData(im, buf, len) - Xim im; - XPointer buf; - INT16 *len; +_XimSetAuthRequiredData( + Xim im, + XPointer buf, + INT16 *len) { /* * Not yet @@ -484,9 +472,9 @@ _XimSetAuthRequiredData(im, buf, len) } Private Bool -_XimCheckAuthSetupData(im, buf) - Xim im; - XPointer buf; +_XimCheckAuthSetupData( + Xim im, + XPointer buf) { /* * Not yet @@ -495,9 +483,9 @@ _XimCheckAuthSetupData(im, buf) } Private Bool -_XimCheckAuthNextData(im, buf) - Xim im; - XPointer buf; +_XimCheckAuthNextData( + Xim im, + XPointer buf) { /* * Not yet @@ -510,9 +498,9 @@ _XimCheckAuthNextData(im, buf) #define BAD_AUTH 0 Private int -_XimClientAuthCheck(im, buf) - Xim im; - XPointer buf; +_XimClientAuthCheck( + Xim im, + XPointer buf) { /* * Not yet @@ -521,8 +509,8 @@ _XimClientAuthCheck(im, buf) } Private void -_XimAuthNG(im) - Xim im; +_XimAuthNG( + Xim im) { CARD32 buf32[BUFSIZE/4]; CARD8 *buf = (CARD8 *)buf32; @@ -535,19 +523,11 @@ _XimAuthNG(im) } Private Bool -#if NeedFunctionPrototypes _XimAllRecv( Xim im, INT16 len, XPointer data, XPointer arg) -#else -_XimAllRecv(im, len, data, arg) - Xim im; - INT16 len; - XPointer data; - XPointer arg; -#endif { return True; } @@ -556,8 +536,8 @@ _XimAllRecv(im, len, data, arg) #define CLIENT_WAIT2 2 Private Bool -_XimConnection(im) - Xim im; +_XimConnection( + Xim im) { CARD32 buf32[BUFSIZE/4]; CARD8 *buf = (CARD8 *)buf32; @@ -717,19 +697,11 @@ _XimConnection(im) } Private Bool -#if NeedFunctionPrototypes _XimDisconnectCheck( Xim im, INT16 len, XPointer data, XPointer arg) -#else -_XimDisconnectCheck(im, len, data, arg) - Xim im; - INT16 len; - XPointer data; - XPointer arg; -#endif { CARD8 major_opcode = *((CARD8 *)data); CARD8 minor_opcode = *((CARD8 *)data + 1); @@ -744,8 +716,8 @@ _XimDisconnectCheck(im, len, data, arg) } Private Bool -_XimDisconnect(im) - Xim im; +_XimDisconnect( + Xim im) { CARD32 buf32[BUFSIZE/4]; CARD8 *buf = (CARD8 *)buf32; @@ -784,19 +756,11 @@ _XimDisconnect(im) } Private Bool -#if NeedFunctionPrototypes _XimOpenCheck( Xim im, INT16 len, XPointer data, XPointer arg) -#else -_XimOpenCheck(im, len, data, arg) - Xim im; - INT16 len; - XPointer data; - XPointer arg; -#endif { CARD8 major_opcode = *((CARD8 *)data); CARD8 minor_opcode = *((CARD8 *)data + 1); @@ -811,8 +775,8 @@ _XimOpenCheck(im, len, data, arg) } Private Bool -_XimOpen(im) - Xim im; +_XimOpen( + Xim im) { CARD32 buf32[BUFSIZE/4]; CARD8 *buf = (CARD8 *)buf32; @@ -907,19 +871,11 @@ _XimOpen(im) } Private Bool -#if NeedFunctionPrototypes _XimCloseCheck( Xim im, INT16 len, XPointer data, XPointer arg) -#else -_XimCloseCheck(im, len, data, arg) - Xim im; - INT16 len; - XPointer data; - XPointer arg; -#endif { CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); CARD8 major_opcode = *((CARD8 *)data); @@ -939,8 +895,8 @@ _XimCloseCheck(im, len, data, arg) } Private Bool -_XimClose(im) - Xim im; +_XimClose( + Xim im) { CARD32 buf32[BUFSIZE/4]; CARD8 *buf = (CARD8 *)buf32; @@ -997,8 +953,8 @@ _XimClose(im) } Public void -_XimProtoIMFree(im) - Xim im; +_XimProtoIMFree( + Xim im) { /* XIMPrivateRec */ if (im->private.proto.im_onkeylist) { @@ -1115,8 +1071,8 @@ _XimProtoIMFree(im) } Private Status -_XimProtoCloseIM(xim) - XIM xim; +_XimProtoCloseIM( + XIM xim) { Xim im = (Xim)xim; XIC ic; @@ -1161,11 +1117,12 @@ _XimProtoCloseIM(xim) return status; } +#ifdef XIM_CONNECTABLE Private Bool -_XimCheckIMQuarkList(quark_list, num_quark, quark) - XrmQuark *quark_list; - int num_quark; - XrmQuark quark; +_XimCheckIMQuarkList( + XrmQuark *quark_list, + int num_quark, + XrmQuark quark) { register int i; @@ -1177,11 +1134,10 @@ _XimCheckIMQuarkList(quark_list, num_quark, quark) return False; } -#ifdef XIM_CONNECTABLE Private Bool -_XimSaveIMValues(im, arg) - Xim im; - XIMArg *arg; +_XimSaveIMValues( + Xim im, + XIMArg *arg) { register XIMArg *p; register int n; @@ -1228,9 +1184,9 @@ _XimSaveIMValues(im, arg) } Private char * -_XimDelayModeSetIMValues(im, arg) - Xim im; - XIMArg *arg; +_XimDelayModeSetIMValues( + Xim im, + XIMArg *arg) { XimDefIMValues im_values; char *name; @@ -1246,19 +1202,11 @@ _XimDelayModeSetIMValues(im, arg) #endif /* XIM_CONNECTABLE */ Private Bool -#if NeedFunctionPrototypes _XimSetIMValuesCheck( Xim im, INT16 len, XPointer data, XPointer arg) -#else -_XimSetIMValuesCheck(im, len, data, arg) - Xim im; - INT16 len; - XPointer data; - XPointer arg; -#endif { CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); CARD8 major_opcode = *((CARD8 *)data); @@ -1278,9 +1226,9 @@ _XimSetIMValuesCheck(im, len, data, arg) } Private char * -_XimProtoSetIMValues(xim, arg) - XIM xim; - XIMArg *arg; +_XimProtoSetIMValues( + XIM xim, + XIMArg *arg) { Xim im = (Xim)xim; XimDefIMValues im_values; @@ -1410,9 +1358,9 @@ _XimProtoSetIMValues(xim, arg) #ifdef XIM_CONNECTABLE Private char * -_XimDelayModeGetIMValues(im, arg) - Xim im; - XIMArg *arg; +_XimDelayModeGetIMValues( + Xim im, + XIMArg *arg) { XimDefIMValues im_values; @@ -1423,19 +1371,11 @@ _XimDelayModeGetIMValues(im, arg) #endif /* XIM_CONNECTABLE */ Private Bool -#if NeedFunctionPrototypes _XimGetIMValuesCheck( Xim im, INT16 len, XPointer data, XPointer arg) -#else -_XimGetIMValuesCheck(im, len, data, arg) - Xim im; - INT16 len; - XPointer data; - XPointer arg; -#endif { CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); CARD8 major_opcode = *((CARD8 *)data); @@ -1455,9 +1395,9 @@ _XimGetIMValuesCheck(im, len, data, arg) } Private char * -_XimProtoGetIMValues(xim, arg) - XIM xim; - XIMArg *arg; +_XimProtoGetIMValues( + XIM xim, + XIMArg *arg) { Xim im = (Xim)xim; register XIMArg *p; @@ -1577,10 +1517,10 @@ Private XIMMethodsRec im_methods = { }; Private Bool -_XimSetEncodingByName(im, buf, len) - Xim im; - char **buf; - int *len; +_XimSetEncodingByName( + Xim im, + char **buf, + int *len) { char *encoding = (char *)NULL; int encoding_len; @@ -1610,10 +1550,10 @@ _XimSetEncodingByName(im, buf, len) } Private Bool -_XimSetEncodingByDetail(im, buf, len) - Xim im; - char **buf; - int *len; +_XimSetEncodingByDetail( + Xim im, + char **buf, + int *len) { *len = 0; *buf = NULL; @@ -1621,13 +1561,13 @@ _XimSetEncodingByDetail(im, buf, len) } Private Bool -_XimGetEncoding(im, buf, name, name_len, detail, detail_len) - Xim im; - CARD16 *buf; - char *name; - int name_len; - char *detail; - int detail_len; +_XimGetEncoding( + Xim im, + CARD16 *buf, + char *name, + int name_len, + char *detail, + int detail_len) { XLCd lcd = im->core.lcd; CARD16 category = buf[0]; @@ -1710,19 +1650,11 @@ _XimGetEncoding(im, buf, name, name_len, detail, detail_len) } Private Bool -#if NeedFunctionPrototypes _XimEncodingNegoCheck( Xim im, INT16 len, XPointer data, XPointer arg) -#else -_XimEncodingNegoCheck(im, len, data, arg) - Xim im; - INT16 len; - XPointer data; - XPointer arg; -#endif { CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); CARD8 major_opcode = *((CARD8 *)data); @@ -1742,8 +1674,8 @@ _XimEncodingNegoCheck(im, len, data, arg) } Private Bool -_XimEncodingNegotiation(im) - Xim im; +_XimEncodingNegotiation( + Xim im) { char *name_ptr = 0; int name_len = 0; @@ -1849,8 +1781,8 @@ _XimEncodingNegotiation(im) #ifdef XIM_CONNECTABLE Private Bool -_XimSendSavedIMValues(im) - Xim im; +_XimSendSavedIMValues( + Xim im) { XimDefIMValues im_values; INT16 len; @@ -1959,8 +1891,8 @@ _XimSendSavedIMValues(im) } Private void -_XimDelayModeIMFree(im) - Xim im; +_XimDelayModeIMFree( + Xim im) { if (im->core.im_resources) { Xfree(im->core.im_resources); @@ -1982,8 +1914,8 @@ _XimDelayModeIMFree(im) } Public Bool -_XimConnectServer(im) - Xim im; +_XimConnectServer( + Xim im) { Xim save_im; @@ -2006,8 +1938,8 @@ _XimConnectServer(im) } Public Bool -_XimDelayModeSetAttr(im) - Xim im; +_XimDelayModeSetAttr( + Xim im) { XimDefIMValues im_values; @@ -2038,8 +1970,8 @@ _XimDelayModeSetAttr(im) } Private Bool -_XimReconnectModeSetAttr(im) - Xim im; +_XimReconnectModeSetAttr( + Xim im) { XimDefIMValues im_values; @@ -2065,8 +1997,8 @@ _XimReconnectModeSetAttr(im) #endif /* XIM_CONNECTABLE */ Public Bool -_XimProtoOpenIM(im) - Xim im; +_XimProtoOpenIM( + Xim im) { _XimInitialResourceInfo(); @@ -2081,6 +2013,7 @@ _XimProtoOpenIM(im) _XimRegisterServerFilter(im); return True; } + _XimShutdown(im); #ifdef XIM_CONNECTABLE } else if (IS_DELAYBINDABLE(im)) { if (_XimDelayModeSetAttr(im)) diff --git a/modules/im/ximcp/imDefLkup.c b/modules/im/ximcp/imDefLkup.c index f4f25b06..627e5f09 100644 --- a/modules/im/ximcp/imDefLkup.c +++ b/modules/im/ximcp/imDefLkup.c @@ -26,7 +26,7 @@ PERFORMANCE OF THIS SOFTWARE. fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ -/* $XFree86: xc/lib/X11/imDefLkup.c,v 3.9 2001/08/13 21:46:46 dawes Exp $ */ +/* $XFree86: xc/lib/X11/imDefLkup.c,v 3.12 2003/11/17 22:20:11 dawes Exp $ */ #include <X11/Xatom.h> #define NEED_EVENTS @@ -35,15 +35,9 @@ PERFORMANCE OF THIS SOFTWARE. #include "Ximint.h" Public Xic -#if NeedFunctionPrototypes _XimICOfXICID( Xim im, XICID icid) -#else -_XimICOfXICID(im, icid) - Xim im; - XICID icid; -#endif /* NeedFunctionPrototypes */ { Xic pic; @@ -55,9 +49,9 @@ _XimICOfXICID(im, icid) } Private void -_XimProcIMSetEventMask(im, buf) - Xim im; - XPointer buf; +_XimProcIMSetEventMask( + Xim im, + XPointer buf) { EVENTMASK *buf_l = (EVENTMASK *)buf; @@ -67,9 +61,9 @@ _XimProcIMSetEventMask(im, buf) } Private void -_XimProcICSetEventMask(ic, buf) - Xic ic; - XPointer buf; +_XimProcICSetEventMask( + Xic ic, + XPointer buf) { EVENTMASK *buf_l = (EVENTMASK *)buf; @@ -80,19 +74,11 @@ _XimProcICSetEventMask(ic, buf) } Public Bool -#if NeedFunctionPrototypes _XimSetEventMaskCallback( Xim xim, INT16 len, XPointer data, XPointer call_data) -#else -_XimSetEventMaskCallback(xim, len, data, call_data) - Xim xim; - INT16 len; - XPointer data; - XPointer call_data; -#endif /* NeedFunctionPrototypes */ { CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); XIMID imid = buf_s[0]; @@ -113,19 +99,11 @@ _XimSetEventMaskCallback(xim, len, data, call_data) } Private Bool -#if NeedFunctionPrototypes _XimSyncCheck( Xim im, INT16 len, XPointer data, XPointer arg) -#else -_XimSyncCheck(im, len, data, arg) - Xim im; - INT16 len; - XPointer data; - XPointer arg; -#endif { Xic ic = (Xic)arg; CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); @@ -150,9 +128,9 @@ _XimSyncCheck(im, len, data, arg) } Public Bool -_XimSync(im, ic) - Xim im; - Xic ic; +_XimSync( + Xim im, + Xic ic) { CARD32 buf32[BUFSIZE/4]; CARD8 *buf = (CARD8 *)buf32; @@ -208,9 +186,9 @@ _XimSync(im, ic) } Public Bool -_XimProcSyncReply(im, ic) - Xim im; - Xic ic; +_XimProcSyncReply( + Xim im, + Xic ic) { CARD32 buf32[BUFSIZE/4]; CARD8 *buf = (CARD8 *)buf32; @@ -231,9 +209,9 @@ _XimProcSyncReply(im, ic) } Public Bool -_XimRespSyncReply(ic, mode) - Xic ic; - BITMASK16 mode; +_XimRespSyncReply( + Xic ic, + BITMASK16 mode) { if (mode & XimSYNCHRONUS) /* SYNC Request */ MARK_NEED_SYNC_REPLY(ic); @@ -241,19 +219,11 @@ _XimRespSyncReply(ic, mode) } Public Bool -#if NeedFunctionPrototypes _XimSyncCallback( Xim xim, INT16 len, XPointer data, XPointer call_data) -#else -_XimSyncCallback(xim, len, data, call_data) - Xim xim; - INT16 len; - XPointer data; - XPointer call_data; -#endif /* NeedFunctionPrototypes */ { CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); XIMID imid = buf_s[0]; @@ -270,9 +240,9 @@ _XimSyncCallback(xim, len, data, call_data) } Private INT16 -_XimSetEventToWire(ev, event) - XEvent *ev; - xEvent *event; +_XimSetEventToWire( + XEvent *ev, + xEvent *event) { if (!(_XimProtoEventToWire(ev, event, False))) return 0; @@ -282,10 +252,10 @@ _XimSetEventToWire(ev, event) } Private Bool -_XimForwardEventCore(ic, ev, sync) - Xic ic; - XEvent *ev; - Bool sync; +_XimForwardEventCore( + Xic ic, + XEvent *ev, + Bool sync) { Xim im = (Xim)ic->core.im; CARD32 buf32[BUFSIZE/4]; @@ -354,10 +324,10 @@ _XimForwardEventCore(ic, ev, sync) } Public Bool -_XimForwardEvent(ic, ev, sync) - Xic ic; - XEvent *ev; - Bool sync; +_XimForwardEvent( + Xic ic, + XEvent *ev, + Bool sync) { #ifdef EXT_FORWARD if (((ev->type == KeyPress) || (ev->type == KeyRelease))) @@ -368,11 +338,11 @@ _XimForwardEvent(ic, ev, sync) } Private void -_XimProcEvent(d, ic, ev, buf) - Display *d; - Xic ic; - XEvent *ev; - CARD16 *buf; +_XimProcEvent( + Display *d, + Xic ic, + XEvent *ev, + CARD16 *buf) { INT16 serial = buf[0]; xEvent *xev = (xEvent *)&buf[1]; @@ -386,10 +356,10 @@ _XimProcEvent(d, ic, ev, buf) } Private Bool -_XimForwardEventRecv(im, ic, buf) - Xim im; - Xic ic; - XPointer buf; +_XimForwardEventRecv( + Xim im, + Xic ic, + XPointer buf) { CARD16 *buf_s = (CARD16 *)buf; Display *d = im->core.display; @@ -405,19 +375,11 @@ _XimForwardEventRecv(im, ic, buf) } Public Bool -#if NeedFunctionPrototypes _XimForwardEventCallback( Xim xim, INT16 len, XPointer data, XPointer call_data) -#else -_XimForwardEventCallback(xim, len, data, call_data) - Xim xim; - INT16 len; - XPointer data; - XPointer call_data; -#endif /* NeedFunctionPrototypes */ { CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); XIMID imid = buf_s[0]; @@ -434,9 +396,9 @@ _XimForwardEventCallback(xim, len, data, call_data) } Private Bool -_XimRegisterTriggerkey(im, buf) - Xim im; - XPointer buf; +_XimRegisterTriggerkey( + Xim im, + XPointer buf) { CARD32 *buf_l = (CARD32 *)buf; CARD32 len; @@ -481,19 +443,11 @@ _XimRegisterTriggerkey(im, buf) } Public Bool -#if NeedFunctionPrototypes _XimRegisterTriggerKeysCallback( Xim xim, INT16 len, XPointer data, XPointer call_data) -#else -_XimRegisterTriggerKeysCallback(xim, len, data, call_data) - Xim xim; - INT16 len; - XPointer data; - XPointer call_data; -#endif /* NeedFunctionPrototypes */ { CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); Xim im = (Xim)call_data; @@ -503,8 +457,8 @@ _XimRegisterTriggerKeysCallback(xim, len, data, call_data) } Public EVENTMASK -_XimGetWindowEventmask(ic) - Xic ic; +_XimGetWindowEventmask( + Xic ic) { Xim im = (Xim )ic->core.im; XWindowAttributes atr; @@ -516,19 +470,11 @@ _XimGetWindowEventmask(ic) Private Bool -#if NeedFunctionPrototypes _XimTriggerNotifyCheck( Xim im, INT16 len, XPointer data, XPointer arg) -#else -_XimTriggerNotifyCheck(im, len, data, arg) - Xim im; - INT16 len; - XPointer data; - XPointer arg; -#endif { Xic ic = (Xic)arg; CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); @@ -553,11 +499,11 @@ _XimTriggerNotifyCheck(im, len, data, arg) } Public Bool -_XimTriggerNotify(im, ic, mode, idx) - Xim im; - Xic ic; - int mode; - CARD32 idx; +_XimTriggerNotify( + Xim im, + Xic ic, + int mode, + CARD32 idx) { CARD32 buf32[BUFSIZE/4]; CARD8 *buf = (CARD8 *)buf32; @@ -621,12 +567,12 @@ _XimTriggerNotify(im, ic, mode, idx) } Private Bool -_XimRegCommitInfo(ic, string, string_len, keysym, keysym_len) - Xic ic; - char *string; - int string_len; - KeySym *keysym; - int keysym_len; +_XimRegCommitInfo( + Xic ic, + char *string, + int string_len, + KeySym *keysym, + int keysym_len) { XimCommitInfo info; @@ -642,8 +588,8 @@ _XimRegCommitInfo(ic, string, string_len, keysym, keysym_len) } Private void -_XimUnregCommitInfo(ic) - Xic ic; +_XimUnregCommitInfo( + Xic ic) { XimCommitInfo info; @@ -660,8 +606,8 @@ _XimUnregCommitInfo(ic) } Public void -_XimFreeCommitInfo(ic) - Xic ic; +_XimFreeCommitInfo( + Xic ic) { while (ic->private.proto.commit_info) _XimUnregCommitInfo(ic); @@ -669,11 +615,11 @@ _XimFreeCommitInfo(ic) } Private Bool -_XimProcKeySym(ic, sym, xim_keysym, xim_keysym_len) - Xic ic; - CARD32 sym; - KeySym **xim_keysym; - int *xim_keysym_len; +_XimProcKeySym( + Xic ic, + CARD32 sym, + KeySym **xim_keysym, + int *xim_keysym_len) { Xim im = (Xim)ic->core.im; @@ -689,12 +635,12 @@ _XimProcKeySym(ic, sym, xim_keysym, xim_keysym_len) } Private Bool -_XimProcCommit(ic, buf, len, xim_string, xim_string_len) - Xic ic; - BYTE *buf; - int len; - char **xim_string; - int *xim_string_len; +_XimProcCommit( + Xic ic, + BYTE *buf, + int len, + char **xim_string, + int *xim_string_len) { Xim im = (Xim)ic->core.im; char *string; @@ -713,10 +659,10 @@ _XimProcCommit(ic, buf, len, xim_string, xim_string_len) } Private Bool -_XimCommitRecv(im, ic, buf) - Xim im; - Xic ic; - XPointer buf; +_XimCommitRecv( + Xim im, + Xic ic, + XPointer buf) { CARD16 *buf_s = (CARD16 *)buf; BITMASK16 flag = buf_s[0]; @@ -770,19 +716,11 @@ _XimCommitRecv(im, ic, buf) } Public Bool -#if NeedFunctionPrototypes _XimCommitCallback( Xim xim, INT16 len, XPointer data, XPointer call_data) -#else -_XimCommitCallback(xim, len, data, call_data) - Xim xim; - INT16 len; - XPointer data; - XPointer call_data; -#endif /* NeedFunctionPrototypes */ { CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); XIMID imid = buf_s[0]; @@ -799,28 +737,20 @@ _XimCommitCallback(xim, len, data, call_data) } Public void -_XimProcError(im, ic, data) - Xim im; - Xic ic; - XPointer data; +_XimProcError( + Xim im, + Xic ic, + XPointer data) { return; } Public Bool -#if NeedFunctionPrototypes _XimErrorCallback( Xim xim, INT16 len, XPointer data, XPointer call_data) -#else -_XimErrorCallback(xim, len, data, call_data) - Xim xim; - INT16 len; - XPointer data; - XPointer call_data; -#endif /* NeedFunctionPrototypes */ { CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); BITMASK16 flag = buf_s[2]; @@ -845,7 +775,6 @@ _XimErrorCallback(xim, len, data, call_data) } Public Bool -#if NeedFunctionPrototypes _XimError( Xim im, Xic ic, @@ -853,15 +782,6 @@ _XimError( INT16 detail_length, CARD16 type, char *detail) -#else -_XimError(im, ic, error_code, detail_length, type, detail) - Xim im; - Xic ic; - CARD16 error_code; - INT16 detail_length; - CARD16 type; - char *detail; -#endif /* NeedFunctionPrototypes */ { CARD32 buf32[BUFSIZE/4]; CARD8 *buf = (CARD8 *)buf32; @@ -899,13 +819,13 @@ _XimError(im, ic, error_code, detail_length, type, detail) } Private int -_Ximctsconvert(conv, from, from_len, to, to_len, state) - XlcConv conv; - char *from; - int from_len; - char *to; - int to_len; - Status *state; +_Ximctsconvert( + XlcConv conv, + char *from, + int from_len, + char *to, + int to_len, + Status *state) { int from_left; int to_left; @@ -930,59 +850,37 @@ _Ximctsconvert(conv, from, from_len, to, to_len, state) initial state. */ _XlcResetConverter(conv); - if (to && to_len) { - from_left = from_len; - to_left = to_len; - from_cnvlen = 0; - to_cnvlen = 0; - for (;;) { - from_savelen = from_left; - to_savelen = to_left; - from_buf = &from[from_cnvlen]; - to_buf = &to[to_cnvlen]; - if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left, - (XPointer *)&to_buf, &to_left, NULL, 0) < 0) { - *state = XLookupNone; - return 0; - } - from_cnvlen += (from_savelen - from_left); - to_cnvlen += (to_savelen - to_left); - if (from_left == 0) { - if (to_cnvlen > 0) { - *state = XLookupChars; - } else { - *state = XLookupNone; - } - return to_cnvlen; - } - if (to_left == 0) - break; - } - } - from_left = from_len; + to_left = BUFSIZ; from_cnvlen = 0; to_cnvlen = 0; for (;;) { - from_savelen = from_left; - to_buf = scratchbuf; - to_left = BUFSIZ; from_buf = &from[from_cnvlen]; + from_savelen = from_left; + to_buf = &scratchbuf[to_cnvlen]; + to_savelen = to_left; if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left, (XPointer *)&to_buf, &to_left, NULL, 0) < 0) { *state = XLookupNone; return 0; } from_cnvlen += (from_savelen - from_left); - to_cnvlen += (BUFSIZ - to_left); + to_cnvlen += (to_savelen - to_left); if (from_left == 0) { - if (to_cnvlen > 0) - *state = XBufferOverflow; - else + if (!to_cnvlen) { *state = XLookupNone; - break; + return 0; + } + break; } } + + if (!to || !to_len || (to_len < to_cnvlen)) { + *state = XBufferOverflow; + } else { + memcpy(to, scratchbuf, to_cnvlen); + *state = XLookupChars; + } return to_cnvlen; } @@ -1000,13 +898,13 @@ _Ximctstombs(xim, from, from_len, to, to_len, state) } Public int -_Ximctstowcs(xim, from, from_len, to, to_len, state) - XIM xim; - char *from; - int from_len; - wchar_t *to; - int to_len; - Status *state; +_Ximctstowcs( + XIM xim, + char *from, + int from_len, + wchar_t *to, + int to_len, + Status *state) { Xim im = (Xim)xim; XlcConv conv = im->private.proto.ctow_conv; @@ -1032,84 +930,62 @@ _Ximctstowcs(xim, from, from_len, to, to_len, state) /* Reset the converter. The CompoundText at 'from' starts in initial state. */ _XlcResetConverter(conv); - - if (to && to_len) { - from_left = from_len; - to_left = to_len; - from_cnvlen = 0; - to_cnvlen = 0; - for (;;) { - from_savelen = from_left; - to_savelen = to_left; - from_buf = &from[from_cnvlen]; - to_buf = &to[to_cnvlen]; - if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left, - (XPointer *)&to_buf, &to_left, NULL, 0) < 0) { - *state = XLookupNone; - return 0; - } - from_cnvlen += (from_savelen - from_left); - to_cnvlen += (to_savelen - to_left); - if (from_left == 0) { - if (to_cnvlen > 0) { - *state = XLookupChars; - } else { - *state = XLookupNone; - } - return to_cnvlen; - } - if (to_left == 0) - break; - } - } from_left = from_len; + to_left = BUFSIZ; from_cnvlen = 0; to_cnvlen = 0; for (;;) { - from_savelen = from_left; - to_buf = scratchbuf; - to_left = BUFSIZ * sizeof(wchar_t); from_buf = &from[from_cnvlen]; + from_savelen = from_left; + to_buf = &scratchbuf[to_cnvlen]; + to_savelen = to_left; if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left, (XPointer *)&to_buf, &to_left, NULL, 0) < 0) { *state = XLookupNone; return 0; } from_cnvlen += (from_savelen - from_left); - to_cnvlen += (BUFSIZ * sizeof(wchar_t) - to_left); + to_cnvlen += (to_savelen - to_left); if (from_left == 0) { - if (to_cnvlen > 0) - *state = XBufferOverflow; - else + if (!to_cnvlen){ *state = XLookupNone; + return 0; + } break; } } + + if (!to || !to_len || (to_len < to_cnvlen)) { + *state = XBufferOverflow; + } else { + memcpy(to, scratchbuf, to_cnvlen * sizeof(wchar_t)); + *state = XLookupChars; + } return to_cnvlen; } Public int -_Ximctstoutf8(xim, from, from_len, to, to_len, state) - XIM xim; - char *from; - int from_len; - char *to; - int to_len; - Status *state; +_Ximctstoutf8( + XIM xim, + char *from, + int from_len, + char *to, + int to_len, + Status *state) { return _Ximctsconvert(((Xim)xim)->private.proto.ctoutf8_conv, from, from_len, to, to_len, state); } Public int -_XimProtoMbLookupString(xic, ev, buffer, bytes, keysym, state) - XIC xic; - XKeyEvent *ev; - char *buffer; - int bytes; - KeySym *keysym; - Status *state; +_XimProtoMbLookupString( + XIC xic, + XKeyEvent *ev, + char *buffer, + int bytes, + KeySym *keysym, + Status *state) { Xic ic = (Xic)xic; Xim im = (Xim)ic->core.im; @@ -1125,15 +1001,14 @@ _XimProtoMbLookupString(xic, ev, buffer, bytes, keysym, state) if ((ev->type == KeyPress) && (ev->keycode == 0)) { /* Filter function */ if (!(info = ic->private.proto.commit_info)) { - if (state) - *state = XLookupNone; + *state = XLookupNone; return 0; } ret = im->methods->ctstombs((XIM)im, info->string, info->string_len, buffer, bytes, state); if (*state == XBufferOverflow) - return 0; + return ret; if (keysym && (info->keysym && *(info->keysym))) { *keysym = *(info->keysym); if (*state == XLookupChars) @@ -1146,7 +1021,9 @@ _XimProtoMbLookupString(xic, ev, buffer, bytes, keysym, state) } else if (ev->type == KeyPress) { ret = _XimLookupMBText(ic, ev, buffer, bytes, keysym, NULL); if (ret > 0) { - if (keysym && *keysym != NoSymbol) + if (ret > bytes) + *state = XBufferOverflow; + else if (keysym && *keysym != NoSymbol) *state = XLookupBoth; else *state = XLookupChars; @@ -1165,13 +1042,13 @@ _XimProtoMbLookupString(xic, ev, buffer, bytes, keysym, state) } Public int -_XimProtoWcLookupString(xic, ev, buffer, bytes, keysym, state) - XIC xic; - XKeyEvent *ev; - wchar_t *buffer; - int bytes; - KeySym *keysym; - Status *state; +_XimProtoWcLookupString( + XIC xic, + XKeyEvent *ev, + wchar_t *buffer, + int bytes, + KeySym *keysym, + Status *state) { Xic ic = (Xic)xic; Xim im = (Xim)ic->core.im; @@ -1187,15 +1064,14 @@ _XimProtoWcLookupString(xic, ev, buffer, bytes, keysym, state) if (ev->type == KeyPress && ev->keycode == 0) { /* Filter function */ if (!(info = ic->private.proto.commit_info)) { - if (state) - *state = XLookupNone; + *state = XLookupNone; return 0; } ret = im->methods->ctstowcs((XIM)im, info->string, info->string_len, buffer, bytes, state); if (*state == XBufferOverflow) - return 0; + return ret; if (keysym && (info->keysym && *(info->keysym))) { *keysym = *(info->keysym); if (*state == XLookupChars) @@ -1208,7 +1084,72 @@ _XimProtoWcLookupString(xic, ev, buffer, bytes, keysym, state) } else if (ev->type == KeyPress) { ret = _XimLookupWCText(ic, ev, buffer, bytes, keysym, NULL); if (ret > 0) { + if (ret > bytes) + *state = XBufferOverflow; + else if (keysym && *keysym != NoSymbol) + *state = XLookupBoth; + else + *state = XLookupChars; + } else { if (keysym && *keysym != NoSymbol) + *state = XLookupKeySym; + else + *state = XLookupNone; + } + } else { + *state = XLookupNone; + ret = 0; + } + + return ret; +} + +Public int +_XimProtoUtf8LookupString( + XIC xic, + XKeyEvent *ev, + char *buffer, + int bytes, + KeySym *keysym, + Status *state) +{ + Xic ic = (Xic)xic; + Xim im = (Xim)ic->core.im; + int ret; + Status tmp_state; + XimCommitInfo info; + + if (!IS_SERVER_CONNECTED(im)) + return 0; + + if (!state) + state = &tmp_state; + + if (ev->type == KeyPress && ev->keycode == 0) { /* Filter function */ + if (!(info = ic->private.proto.commit_info)) { + *state = XLookupNone; + return 0; + } + + ret = im->methods->ctstoutf8((XIM)im, info->string, + info->string_len, buffer, bytes, state); + if (*state == XBufferOverflow) + return ret; + if (keysym && (info->keysym && *(info->keysym))) { + *keysym = *(info->keysym); + if (*state == XLookupChars) + *state = XLookupBoth; + else + *state = XLookupKeySym; + } + _XimUnregCommitInfo(ic); + + } else if (ev->type == KeyPress) { + ret = _XimLookupUTF8Text(ic, ev, buffer, bytes, keysym, NULL); + if (ret > 0) { + if (ret > bytes) + *state = XBufferOverflow; + else if (keysym && *keysym != NoSymbol) *state = XLookupBoth; else *state = XLookupChars; diff --git a/modules/im/ximcp/imDispch.c b/modules/im/ximcp/imDispch.c index 830b8b5a..8b429485 100644 --- a/modules/im/ximcp/imDispch.c +++ b/modules/im/ximcp/imDispch.c @@ -26,7 +26,7 @@ PERFORMANCE OF THIS SOFTWARE. fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ -/* $XFree86: xc/lib/X11/imDispch.c,v 1.3 2001/01/17 19:41:51 dawes Exp $ */ +/* $XFree86: xc/lib/X11/imDispch.c,v 1.5 2003/11/17 22:20:11 dawes Exp $ */ #include <X11/Xlib.h> #include "Xlibint.h" @@ -34,31 +34,17 @@ PERFORMANCE OF THIS SOFTWARE. #include "Xlcint.h" #include "Ximint.h" -/* EXTERNS */ -/* imTransR.c */ -extern Bool _XimRegisterDispatcher(); Public Bool -#if NeedFunctionPrototypes _XimRegProtoIntrCallback( Xim im, CARD16 major_code, CARD16 minor_code, Bool (*proc)( -#if NeedNestedPrototypes Xim, INT16, XPointer, XPointer -#endif ), XPointer call_data) -#else -_XimRegProtoIntrCallback(im, major_code, minor_code, proc, call_data) - Xim im; - CARD16 major_code; - CARD16 minor_code; - Bool (*proc)(); - XPointer call_data; -#endif /* NeedFunctionPrototypes */ { XimProtoIntrRec *rec; @@ -89,19 +75,11 @@ _XimFreeProtoIntrCallback(im) } Private Bool -#if NeedFunctionPrototypes _XimTransportIntr( Xim im, INT16 len, XPointer data, XPointer call_data) -#else -_XimTransportIntr(im, len, data, call_data) - Xim im; - INT16 len; - XPointer data; - XPointer call_data; -#endif { Xim call_im = (Xim)call_data; XimProtoIntrRec *rec = call_im->private.proto.intrproto; diff --git a/modules/im/ximcp/imEvToWire.c b/modules/im/ximcp/imEvToWire.c index 1bbf74e6..6ca08a92 100644 --- a/modules/im/ximcp/imEvToWire.c +++ b/modules/im/ximcp/imEvToWire.c @@ -21,11 +21,14 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ +/* $XFree86: xc/lib/X11/imEvToWire.c,v 1.2 2003/04/13 19:22:20 dawes Exp $ */ #define NEED_EVENTS #include <X11/Xlibint.h> #include <X11/Xlib.h> #undef NEED_EVENTS +#include "Ximint.h" + #define sw16(n, s) ((s) ? \ (((n) << 8 & 0xff00) | \ @@ -40,10 +43,10 @@ SOFTWARE. ) : n) Status -_XimProtoEventToWire(re, event, sw) -register XEvent *re; /* pointer to where event should be reformatted */ -register xEvent *event; /* wire protocol event */ -Bool sw; /* swap byte? */ +_XimProtoEventToWire( + register XEvent *re, /* pointer to where event should be reformatted */ + register xEvent *event, /* wire protocol event */ + Bool sw) /* swap byte? */ { switch (event->u.u.type = re->type) { case KeyPress: @@ -417,10 +420,10 @@ Bool sw; /* swap byte? */ * reformat a wire event into an XEvent structure of the right type. */ Bool -_XimProtoWireToEvent(re, event, sw) -register XEvent *re; /* pointer to where event should be reformatted */ -register xEvent *event; /* wire protocol event */ -Bool sw; /* swap byte? */ +_XimProtoWireToEvent( + register XEvent *re, /* pointer to where event should be reformatted */ + register xEvent *event, /* wire protocol event */ + Bool sw) /* swap byte? */ { re->type = event->u.u.type & 0x7f; diff --git a/modules/im/ximcp/imExten.c b/modules/im/ximcp/imExten.c index 911d84d4..c19b2834 100644 --- a/modules/im/ximcp/imExten.c +++ b/modules/im/ximcp/imExten.c @@ -26,7 +26,7 @@ PERFORMANCE OF THIS SOFTWARE. fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ -/* $XFree86: xc/lib/X11/imExten.c,v 1.3 2003/02/20 03:30:36 dawes Exp $ */ +/* $XFree86: xc/lib/X11/imExten.c,v 1.5 2003/11/17 22:20:11 dawes Exp $ */ #include <X11/Xatom.h> #define NEED_EVENTS @@ -69,8 +69,8 @@ Private XIM_QueryExtRec extensions[] = { }; Private int -_XimIsSupportExt(idx) - int idx; +_XimIsSupportExt( + int idx) { register int i; int n = XIMNumber(extensions) - 1; @@ -87,10 +87,10 @@ _XimIsSupportExt(idx) } Private Bool -_XimProcExtSetEventMask(im, ic, buf) - Xim im; - Xic ic; - XPointer buf; +_XimProcExtSetEventMask( + Xim im, + Xic ic, + XPointer buf) { EVENTMASK *buf_l = (EVENTMASK *)buf; EVENTMASK select_mask = _XimGetWindowEventmask(ic); @@ -114,19 +114,11 @@ _XimProcExtSetEventMask(im, ic, buf) } Private Bool -#if NeedFunctionPrototypes _XimExtSetEventMaskCallback( Xim xim, INT16 len, XPointer data, XPointer call_data) -#else -_XimExtSetEventMaskCallback(xim, len, data, call_data) - Xim xim; - INT16 len; - XPointer data; - XPointer call_data; -#endif /* NeedFunctionPrototypes */ { CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); XIMID imid = buf_s[0]; @@ -144,10 +136,10 @@ _XimExtSetEventMaskCallback(xim, len, data, call_data) #ifdef EXT_FORWARD Private Bool -_XimProcExtForwardKeyEvent(im, ic, buf) - Xim im; - Xic ic; - XPointer buf; +_XimProcExtForwardKeyEvent( + Xim im, + Xic ic, + XPointer buf) { CARD8 *buf_b = (CARD8 *)buf; CARD16 *buf_s = (CARD16 *)buf; @@ -173,19 +165,11 @@ _XimProcExtForwardKeyEvent(im, ic, buf) } Private Bool -#if NeedFunctionPrototypes _XimExtForwardKeyEventCallback( Xim xim, INT16 len, XPointer data, XPointer call_data) -#else -_XimExtForwardKeyEventCallback(xim, len, data, call_data) - Xim xim; - INT16 len; - XPointer data; - XPointer call_data; -#endif /* NeedFunctionPrototypes */ { CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); XIMID imid = buf_s[0]; @@ -202,19 +186,11 @@ _XimExtForwardKeyEventCallback(xim, len, data, call_data) } Private Bool -#if NeedFunctionPrototypes _XimExtForwardKeyEventCheck( Xim im, INT16 len, XPointer data, XPointer arg) -#else -_XimExtForwardKeyEventCheck(im, len, data, arg) - Xim im; - INT16 len; - XPointer data; - XPointer arg; -#endif { Xic ic = (Xic)arg; CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); @@ -238,10 +214,10 @@ _XimExtForwardKeyEventCheck(im, len, data, arg) } Public Bool -_XimExtForwardKeyEvent(ic, ev, sync) - Xic ic; - XKeyEvent *ev; - Bool sync; +_XimExtForwardKeyEvent( + Xic ic, + XKeyEvent *ev, + Bool sync) { Xim im = (Xim) ic->core.im; CARD32 buf32[BUFSIZE/4]; @@ -320,7 +296,7 @@ _XimExtForwardKeyEvent(ic, ev, sync) #endif /* EXT_FORWARD */ Private int -_XimCheckExtensionListSize() +_XimCheckExtensionListSize(void) { register int i; int len; @@ -337,8 +313,8 @@ _XimCheckExtensionListSize() } Private void -_XimSetExtensionList(buf) - CARD8 *buf; +_XimSetExtensionList( + CARD8 *buf) { register int i; int len; @@ -355,9 +331,9 @@ _XimSetExtensionList(buf) } Private unsigned int -_XimCountNumberOfExtension(total, ext) - INT16 total; - CARD8 *ext; +_XimCountNumberOfExtension( + INT16 total, + CARD8 *ext) { unsigned int n; INT16 len; @@ -377,9 +353,9 @@ _XimCountNumberOfExtension(total, ext) } Private Bool -_XimParseExtensionList(im, data) - Xim im; - CARD16 *data; +_XimParseExtensionList( + Xim im, + CARD16 *data) { int num = XIMNumber(extensions) - 1; unsigned int n; @@ -413,19 +389,11 @@ _XimParseExtensionList(im, data) } Private Bool -#if NeedFunctionPrototypes _XimQueryExtensionCheck( Xim im, INT16 len, XPointer data, XPointer arg) -#else -_XimQueryExtensionCheck(im, len, data, arg) - Xim im; - INT16 len; - XPointer data; - XPointer arg; -#endif { CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); CARD8 major_opcode = *((CARD8 *)data); @@ -445,8 +413,8 @@ _XimQueryExtensionCheck(im, len, data, arg) } Public Bool -_XimExtension(im) - Xim im; +_XimExtension( + Xim im) { CARD8 *buf; CARD16 *buf_s; @@ -551,11 +519,11 @@ _XimExtension(im) #define XIM_Xpoint_length 12 Private Bool -_XimExtMove(im, ic, x, y) - Xim im; - Xic ic; - CARD16 x; - CARD16 y; +_XimExtMove( + Xim im, + Xic ic, + CARD16 x, + CARD16 y) { CARD32 buf32[BUFSIZE/4]; CARD8 *buf = (CARD8 *)buf32; @@ -584,8 +552,8 @@ _XimExtMove(im, ic, x, y) } Public BITMASK32 -_XimExtenArgCheck(arg) - XIMArg *arg; +_XimExtenArgCheck( + XIMArg *arg) { CARD32 flag = 0L; if (!strcmp(arg->name, XNSpotLocation)) @@ -594,21 +562,12 @@ _XimExtenArgCheck(arg) } Public Bool -#if NeedFunctionPrototypes _XimExtenMove( Xim im, Xic ic, CARD32 flag, CARD16 *buf, INT16 length) -#else -_XimExtenMove(im, ic, flag, buf, length) - Xim im; - Xic ic; - CARD32 flag; - CARD16 *buf; - INT16 length; -#endif /* NeedFunctionPrototypes */ { if ((IS_EXT_XNSPOTLOCATION(flag)) && (length == XIM_Xpoint_length)) return _XimExtMove(im, ic, buf[4], buf[5]); diff --git a/modules/im/ximcp/imImSw.c b/modules/im/ximcp/imImSw.c index c6e5d819..42d66f44 100644 --- a/modules/im/ximcp/imImSw.c +++ b/modules/im/ximcp/imImSw.c @@ -32,7 +32,7 @@ THIS SOFTWARE. frankyling@hgrd01.enet.dec.com ******************************************************************/ -/* $XFree86: xc/lib/X11/imImSw.c,v 1.3 2001/01/17 19:41:51 dawes Exp $ */ +/* $XFree86: xc/lib/X11/imImSw.c,v 1.4 2003/04/13 19:22:21 dawes Exp $ */ #include "Xlibint.h" #include "Xlcint.h" @@ -40,8 +40,8 @@ THIS SOFTWARE. #include "XimImSw.h" Private Bool -_XimCheckIfDefault(im) - Xim im; +_XimCheckIfDefault( + Xim im) { return(True); } diff --git a/modules/im/ximcp/imInsClbk.c b/modules/im/ximcp/imInsClbk.c index ea28ff36..a6143f08 100644 --- a/modules/im/ximcp/imInsClbk.c +++ b/modules/im/ximcp/imInsClbk.c @@ -26,7 +26,7 @@ PERFORMANCE OF THIS SOFTWARE. makoto@sm.sony.co.jp ******************************************************************/ -/* $XFree86: xc/lib/X11/imInsClbk.c,v 3.1 2001/01/17 19:41:51 dawes Exp $ */ +/* $XFree86: xc/lib/X11/imInsClbk.c,v 3.4 2003/11/17 22:20:11 dawes Exp $ */ #include <X11/Xatom.h> #define NEED_EVENTS @@ -57,13 +57,7 @@ Private Bool lock = False; Private void -#if NeedFunctionPrototypes MakeLocale( XLCd lcd, char locale[] ) -#else -MakeLocale( lcd, locale ) - XLCd lcd; - char locale[]; -#endif { char *language, *territory, *codeset; @@ -83,24 +77,15 @@ MakeLocale( lcd, locale ) Private Bool -#if NeedFunctionPrototypes _XimFilterPropertyNotify( Display *display, Window window, XEvent *event, XPointer client_data) -#else -_XimFilterPropertyNotify( display, window, event, client_data ) - Display *display; - Window window; - XEvent *event; - XPointer client_data; -#endif { Atom ims, actual_type, *atoms; int actual_format; unsigned long nitems, bytes_after; - Window ims_window; int ii; XIM xim; Bool flag = False; @@ -124,7 +109,7 @@ _XimFilterPropertyNotify( display, window, event, client_data ) lock = True; for( ii = 0; ii < nitems; ii++, atoms ) { - if((ims_window = XGetSelectionOwner (display, atoms[ii]))) { + if(XGetSelectionOwner (display, atoms[ii])) { for( icb = callback_list; icb; icb = icb->next ) { if( !icb->call && !icb->destroy ) { xim = (*icb->lcd->methods->open_im)( icb->lcd, display, @@ -166,7 +151,6 @@ _XimFilterPropertyNotify( display, window, event, client_data ) Public Bool -#if NeedFunctionPrototypes _XimRegisterIMInstantiateCallback( XLCd lcd, Display *display, @@ -175,16 +159,6 @@ _XimRegisterIMInstantiateCallback( char *res_class, XIDProc callback, XPointer client_data) -#else -_XimRegisterIMInstantiateCallback( lcd, display, rdb, res_name, res_class, - callback, client_data ) - XLCd lcd; - Display *display; - XrmDatabase rdb; - char *res_name, *res_class; - XIDProc callback; - XPointer client_data; -#endif { XimInstCallback icb, tmp; XIM xim; @@ -240,7 +214,6 @@ _XimRegisterIMInstantiateCallback( lcd, display, rdb, res_name, res_class, Public Bool -#if NeedFunctionPrototypes _XimUnRegisterIMInstantiateCallback( XLCd lcd, Display *display, @@ -249,16 +222,6 @@ _XimUnRegisterIMInstantiateCallback( char *res_class, XIDProc callback, XPointer client_data) -#else -_XimUnRegisterIMInstantiateCallback( lcd, display, rdb, res_name, res_class, - callback, client_data ) - XLCd lcd; - Display *display; - XrmDatabase rdb; - char *res_name, *res_class; - XIDProc callback; - XPointer client_data; -#endif { char locale[XIM_MAXLCNAMELEN]; XimInstCallback icb, picb; @@ -280,8 +243,8 @@ _XimUnRegisterIMInstantiateCallback( lcd, display, rdb, res_name, res_class, ((res_class == NULL && icb->res_class == NULL) || (res_class != NULL && icb->res_class != NULL && !strcmp( res_class, icb->res_class ))) && - callback == icb->callback && - client_data == icb->client_data && /* XXXXX */ + (callback == icb->callback) && + (client_data == icb->client_data) && /* XXXXX */ !icb->destroy ) { if( lock ) icb->destroy = True; diff --git a/modules/im/ximcp/imInt.c b/modules/im/ximcp/imInt.c index b38abfb9..62b1a8ed 100644 --- a/modules/im/ximcp/imInt.c +++ b/modules/im/ximcp/imInt.c @@ -26,7 +26,7 @@ PERFORMANCE OF THIS SOFTWARE. fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ -/* $XFree86: xc/lib/X11/imInt.c,v 3.10 2001/11/16 00:52:27 dawes Exp $ */ +/* $XFree86: xc/lib/X11/imInt.c,v 3.13 2003/11/17 22:20:11 dawes Exp $ */ #include <X11/Xatom.h> #include <X11/Xlib.h> @@ -40,13 +40,8 @@ Private Xim *_XimCurrentIMlist = (Xim *)NULL; Private int _XimCurrentIMcount = 0; Private Bool -#if NeedFunctionPrototypes _XimSetIMStructureList( Xim im) -#else -_XimSetIMStructureList(im) - Xim im; -#endif { register int i; Xim *xim; @@ -154,14 +149,9 @@ _XimServerReconectableDestroy() #endif /* XIM_CONNECTABLE */ Private char * -#if NeedFunctionPrototypes _XimStrstr( register char *src, register char *dest) -#else -_XimStrstr(src, dest) - register char *src, *dest; -#endif { int len; @@ -175,13 +165,8 @@ _XimStrstr(src, dest) } Private char * -#if NeedFunctionPrototypes _XimMakeImName( XLCd lcd) -#else -_XimMakeImName(lcd) - XLCd lcd; -#endif { char* begin = NULL; char* end = NULL; @@ -210,20 +195,12 @@ _XimMakeImName(lcd) } Public XIM -#if NeedFunctionPrototypes _XimOpenIM( XLCd lcd, Display *dpy, XrmDatabase rdb, char *res_name, char *res_class) -#else -_XimOpenIM(lcd, dpy, rdb, res_name, res_class) - XLCd lcd; - Display *dpy; - XrmDatabase rdb; - char *res_name, *res_class; -#endif { Xim im; register int i; diff --git a/modules/im/ximcp/imLcIc.c b/modules/im/ximcp/imLcIc.c index 740d22fa..9a65d3db 100644 --- a/modules/im/ximcp/imLcIc.c +++ b/modules/im/ximcp/imLcIc.c @@ -26,7 +26,7 @@ PERFORMANCE OF THIS SOFTWARE. fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ -/* $XFree86: xc/lib/X11/imLcIc.c,v 1.4 2001/01/17 19:41:52 dawes Exp $ */ +/* $XFree86: xc/lib/X11/imLcIc.c,v 1.5 2003/04/13 19:22:21 dawes Exp $ */ #include <stdio.h> #include <X11/Xlib.h> @@ -36,8 +36,8 @@ PERFORMANCE OF THIS SOFTWARE. #include "Ximint.h" Private void -_XimLocalUnSetFocus(xic) - XIC xic; +_XimLocalUnSetFocus( + XIC xic) { Xic ic = (Xic)xic; ((Xim)ic->core.im)->private.local.current_ic = (XIC)NULL; @@ -49,8 +49,8 @@ _XimLocalUnSetFocus(xic) } Private void -_XimLocalDestroyIC(xic) - XIC xic; +_XimLocalDestroyIC( + XIC xic) { Xic ic = (Xic)xic; @@ -68,8 +68,8 @@ _XimLocalDestroyIC(xic) } Private void -_XimLocalSetFocus(xic) - XIC xic; +_XimLocalSetFocus( + XIC xic) { Xic ic = (Xic)xic; XIC current_ic = ((Xim)ic->core.im)->private.local.current_ic; @@ -90,8 +90,8 @@ _XimLocalSetFocus(xic) } Private void -_XimLocalReset(xic) - XIC xic; +_XimLocalReset( + XIC xic) { Xic ic = (Xic)xic; ic->private.local.composed = (DefTree *)NULL; @@ -99,16 +99,16 @@ _XimLocalReset(xic) } Private char * -_XimLocalMbReset(xic) - XIC xic; +_XimLocalMbReset( + XIC xic) { _XimLocalReset(xic); return (char *)NULL; } Private wchar_t * -_XimLocalWcReset(xic) - XIC xic; +_XimLocalWcReset( + XIC xic) { _XimLocalReset(xic); return (wchar_t *)NULL; @@ -129,9 +129,9 @@ Private XICMethodsRec Local_ic_methods = { }; Public XIC -_XimLocalCreateIC(im, values) - XIM im; - XIMArg *values; +_XimLocalCreateIC( + XIM im, + XIMArg *values) { Xic ic; XimDefICValues ic_values; diff --git a/modules/im/ximcp/imLcIm.c b/modules/im/ximcp/imLcIm.c index 8c64cf83..2e622f62 100644 --- a/modules/im/ximcp/imLcIm.c +++ b/modules/im/ximcp/imLcIm.c @@ -32,7 +32,7 @@ THIS SOFTWARE. frankyling@hgrd01.enet.dec.com ******************************************************************/ -/* $XFree86: xc/lib/X11/imLcIm.c,v 1.10 2002/09/21 02:46:04 dawes Exp $ */ +/* $XFree86: xc/lib/X11/imLcIm.c,v 1.12 2003/09/06 14:06:32 pascal Exp $ */ #include <stdio.h> /* @@ -74,8 +74,8 @@ _XimCheckIfLocalProcessing(im) } Private void -XimFreeDefaultTree(top) - DefTree *top; +XimFreeDefaultTree( + DefTree *top) { if (!top) return; if (top->succession) XimFreeDefaultTree(top->succession); @@ -87,8 +87,8 @@ XimFreeDefaultTree(top) } Public void -_XimLocalIMFree(im) - Xim im; +_XimLocalIMFree( + Xim im) { XimFreeDefaultTree(im->private.local.top); if(im->core.im_resources) { @@ -159,8 +159,8 @@ _XimLocalIMFree(im) } Private Status -_XimLocalCloseIM(xim) - XIM xim; +_XimLocalCloseIM( + XIM xim) { Xim im = (Xim)xim; XIC ic; @@ -180,9 +180,9 @@ _XimLocalCloseIM(xim) } Public char * -_XimLocalGetIMValues(xim, values) - XIM xim; - XIMArg *values; +_XimLocalGetIMValues( + XIM xim, + XIMArg *values) { Xim im = (Xim)xim; XimDefIMValues im_values; @@ -193,9 +193,9 @@ _XimLocalGetIMValues(xim, values) } Public char * -_XimLocalSetIMValues(xim, values) - XIM xim; - XIMArg *values; +_XimLocalSetIMValues( + XIM xim, + XIMArg *values) { Xim im = (Xim)xim; XimDefIMValues im_values; @@ -209,20 +209,46 @@ _XimLocalSetIMValues(xim, values) } Private void -_XimCreateDefaultTree(im) - Xim im; +_XimCreateDefaultTree( + Xim im) { - FILE *fp; - char *name; - - name = _XlcFileName(im->core.lcd, COMPOSE_FILE); - if (name == (char *)NULL) - return; - fp = _XFopenFile (name, "r"); - Xfree(name); - if (fp == (FILE *)NULL) - return; - _XimParseStringFile(fp, &im->private.local.top); + FILE *fp = NULL; + char *name, *tmpname = NULL; + + name = getenv("XCOMPOSEFILE"); + + if (name == (char *) NULL) { + char *home = getenv("HOME"); + if (home != (char *) NULL) { + int hl = strlen(home); + tmpname = name = Xmalloc(hl + 10 + 1); + if (name != (char *) NULL) { + strcpy(name, home); + strcpy(name + hl, "/.XCompose"); + fp = _XFopenFile (name, "r"); + if (fp == (FILE *) NULL) { + Xfree(name); + name = tmpname = NULL; + } + } + } + } + + if (name == (char *) NULL) { + tmpname = name = _XlcFileName(im->core.lcd, COMPOSE_FILE); + } + + if (name == (char *) NULL) + return; + if (fp == (FILE *) NULL) { + fp = _XFopenFile (name, "r"); + } + if (tmpname != (char *) NULL) { + Xfree(tmpname); + } + if (fp == (FILE *) NULL) + return; + _XimParseStringFile(fp, im); fclose(fp); } @@ -237,8 +263,8 @@ Private XIMMethodsRec Xim_im_local_methods = { }; Public Bool -_XimLocalOpenIM(im) - Xim im; +_XimLocalOpenIM( + Xim im) { XLCd lcd = im->core.lcd; XlcConv conv; @@ -264,8 +290,6 @@ _XimLocalOpenIM(im) } _XimSetCurrentIMValues(im, &im_values); - _XimCreateDefaultTree(im); - if (!(conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNMultiByte))) goto Open_Error; private->ctom_conv = conv; @@ -298,6 +322,8 @@ _XimLocalOpenIM(im) goto Open_Error; private->ucstoutf8_conv = conv; + _XimCreateDefaultTree(im); + im->methods = &Xim_im_local_methods; private->current_ic = (XIC)NULL; diff --git a/modules/im/ximcp/imLcLkup.c b/modules/im/ximcp/imLcLkup.c index 46ef857a..f3399aa0 100644 --- a/modules/im/ximcp/imLcLkup.c +++ b/modules/im/ximcp/imLcLkup.c @@ -29,7 +29,7 @@ PERFORMANCE OF THIS SOFTWARE. fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ -/* $XFree86: xc/lib/X11/imLcLkup.c,v 3.6 2001/08/13 21:46:46 dawes Exp $ */ +/* $XFree86: xc/lib/X11/imLcLkup.c,v 3.9 2003/07/08 15:39:47 tsi Exp $ */ #include <stdio.h> #include <X11/Xatom.h> @@ -66,7 +66,7 @@ _XimLocalMbLookupString(xic, ev, buffer, bytes, keysym, status) memcpy(buffer, ic->private.local.composed->mb, ret); if(keysym) *keysym = ic->private.local.composed->ks; if (ret > 0) { - if(keysym && *keysym != NoSymbol) { + if (keysym && *keysym != NoSymbol) { if(status) *status = XLookupBoth; } else { if(status) *status = XLookupChars; @@ -82,7 +82,9 @@ _XimLocalMbLookupString(xic, ev, buffer, bytes, keysym, status) } else { /* Throughed Event */ ret = _XimLookupMBText(ic, ev, buffer, bytes, keysym, NULL); if(ret > 0) { - if(keysym && *keysym != NoSymbol) { + if (ret > bytes) { + if (status) *status = XBufferOverflow; + } else if (keysym && *keysym != NoSymbol) { if(status) *status = XLookupBoth; } else { if(status) *status = XLookupChars; @@ -124,7 +126,7 @@ _XimLocalWcLookupString(xic, ev, buffer, wlen, keysym, status) ret * sizeof(wchar_t)); if(keysym) *keysym = ic->private.local.composed->ks; if (ret > 0) { - if(keysym && *keysym != NoSymbol) { + if (keysym && *keysym != NoSymbol) { if(status) *status = XLookupBoth; } else { if(status) *status = XLookupChars; @@ -140,7 +142,9 @@ _XimLocalWcLookupString(xic, ev, buffer, wlen, keysym, status) } else { /* Throughed Event */ ret = _XimLookupWCText(ic, ev, buffer, wlen, keysym, NULL); if(ret > 0) { - if(keysym && *keysym != NoSymbol) { + if (ret > wlen) { + if (status) *status = XBufferOverflow; + } else if (keysym && *keysym != NoSymbol) { if(status) *status = XLookupBoth; } else { if(status) *status = XLookupChars; @@ -181,7 +185,7 @@ _XimLocalUtf8LookupString(xic, ev, buffer, bytes, keysym, status) memcpy(buffer, ic->private.local.composed->utf8, ret); if(keysym) *keysym = ic->private.local.composed->ks; if (ret > 0) { - if(keysym && *keysym != NoSymbol) { + if (keysym && *keysym != NoSymbol) { if(status) *status = XLookupBoth; } else { if(status) *status = XLookupChars; @@ -197,7 +201,9 @@ _XimLocalUtf8LookupString(xic, ev, buffer, bytes, keysym, status) } else { /* Throughed Event */ ret = _XimLookupUTF8Text(ic, ev, buffer, bytes, keysym, NULL); if(ret > 0) { - if(keysym && *keysym != NoSymbol) { + if (ret > bytes) { + if (status) *status = XBufferOverflow; + } else if (keysym && *keysym != NoSymbol) { if(status) *status = XLookupBoth; } else { if(status) *status = XLookupChars; @@ -214,13 +220,13 @@ _XimLocalUtf8LookupString(xic, ev, buffer, bytes, keysym, status) } Private int -_XimLcctsconvert(conv, from, from_len, to, to_len, state) - XlcConv conv; - char *from; - int from_len; - char *to; - int to_len; - Status *state; +_XimLcctsconvert( + XlcConv conv, + char *from, + int from_len, + char *to, + int to_len, + Status *state) { int from_left; int to_left; @@ -245,59 +251,37 @@ _XimLcctsconvert(conv, from, from_len, to, to_len, state) initial state. */ _XlcResetConverter(conv); - if (to && to_len) { - from_left = from_len; - to_left = to_len; - from_cnvlen = 0; - to_cnvlen = 0; - for (;;) { - from_savelen = from_left; - to_savelen = to_left; - from_buf = &from[from_cnvlen]; - to_buf = &to[to_cnvlen]; - if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left, - (XPointer *)&to_buf, &to_left, NULL, 0) < 0) { - *state = XLookupNone; - return 0; - } - from_cnvlen += (from_savelen - from_left); - to_cnvlen += (to_savelen - to_left); - if (from_left == 0) { - if (to_cnvlen > 0) { - *state = XLookupChars; - } else { - *state = XLookupNone; - } - return to_cnvlen; - } - if (to_left == 0) - break; - } - } - from_left = from_len; + to_left = BUFSIZ; from_cnvlen = 0; to_cnvlen = 0; for (;;) { - from_savelen = from_left; - to_buf = scratchbuf; - to_left = BUFSIZ; from_buf = &from[from_cnvlen]; + from_savelen = from_left; + to_buf = &scratchbuf[to_cnvlen]; + to_savelen = to_left; if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left, (XPointer *)&to_buf, &to_left, NULL, 0) < 0) { *state = XLookupNone; return 0; } from_cnvlen += (from_savelen - from_left); - to_cnvlen += (BUFSIZ - to_left); + to_cnvlen += (to_savelen - to_left); if (from_left == 0) { - if (to_cnvlen > 0) - *state = XBufferOverflow; - else + if (!to_cnvlen) { *state = XLookupNone; - break; + return 0; + } + break; } } + + if (!to || !to_len || (to_len < to_cnvlen)) { + *state = XBufferOverflow; + } else { + memcpy(to, scratchbuf, to_cnvlen); + *state = XLookupChars; + } return to_cnvlen; } @@ -347,60 +331,38 @@ _XimLcctstowcs(xim, from, from_len, to, to_len, state) /* Reset the converter. The CompoundText at 'from' starts in initial state. */ _XlcResetConverter(conv); - - if (to && to_len) { - from_left = from_len; - to_left = to_len; - from_cnvlen = 0; - to_cnvlen = 0; - for (;;) { - from_savelen = from_left; - to_savelen = to_left; - from_buf = &from[from_cnvlen]; - to_buf = &to[to_cnvlen]; - if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left, - (XPointer *)&to_buf, &to_left, NULL, 0) < 0) { - *state = XLookupNone; - return 0; - } - from_cnvlen += (from_savelen - from_left); - to_cnvlen += (to_savelen - to_left); - if (from_left == 0) { - if (to_cnvlen > 0) { - *state = XLookupChars; - } else { - *state = XLookupNone; - } - return to_cnvlen; - } - if (to_left == 0) - break; - } - } from_left = from_len; + to_left = BUFSIZ; from_cnvlen = 0; to_cnvlen = 0; for (;;) { - from_savelen = from_left; - to_buf = scratchbuf; - to_left = BUFSIZ * sizeof(wchar_t); from_buf = &from[from_cnvlen]; + from_savelen = from_left; + to_buf = &scratchbuf[to_cnvlen]; + to_savelen = to_left; if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left, (XPointer *)&to_buf, &to_left, NULL, 0) < 0) { *state = XLookupNone; return 0; } from_cnvlen += (from_savelen - from_left); - to_cnvlen += (BUFSIZ * sizeof(wchar_t) - to_left); + to_cnvlen += (to_savelen - to_left); if (from_left == 0) { - if (to_cnvlen > 0) - *state = XBufferOverflow; - else + if (!to_cnvlen){ *state = XLookupNone; + return 0; + } break; } } + + if (!to || !to_len || (to_len < to_cnvlen)) { + *state = XBufferOverflow; + } else { + memcpy(to, scratchbuf, to_cnvlen * sizeof(wchar_t)); + *state = XLookupChars; + } return to_cnvlen; } diff --git a/modules/im/ximcp/imLcPrs.c b/modules/im/ximcp/imLcPrs.c index 7cfa5a16..21a29826 100644 --- a/modules/im/ximcp/imLcPrs.c +++ b/modules/im/ximcp/imLcPrs.c @@ -30,7 +30,7 @@ OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ -/* $XFree86: xc/lib/X11/imLcPrs.c,v 1.8 2003/01/15 02:59:33 dawes Exp $ */ +/* $XFree86: xc/lib/X11/imLcPrs.c,v 1.11 2003/11/17 22:20:12 dawes Exp $ */ #include <X11/Xlib.h> #include <X11/Xmd.h> @@ -42,11 +42,15 @@ OR PERFORMANCE OF THIS SOFTWARE. #include <stdio.h> extern int _Xmbstowcs( -#if NeedFunctionPrototypes wchar_t *wstr, char *str, int len -#endif +); + +extern int _Xmbstoutf8( + char *ustr, + const char *str, + int len ); extern int _Xmbstoutf8( @@ -80,9 +84,9 @@ extern int _Xmbstoutf8( */ static int -nextch(fp, lastch) - FILE *fp; - int *lastch; +nextch( + FILE *fp, + int *lastch) { int c; @@ -105,9 +109,9 @@ nextch(fp, lastch) } static void -putbackch(c, lastch) - int c; - int *lastch; +putbackch( + int c, + int *lastch) { *lastch = c; } @@ -131,10 +135,10 @@ putbackch(c, lastch) #endif static int -nexttoken(fp, tokenbuf, lastch) - FILE *fp; - char *tokenbuf; - int *lastch; +nexttoken( + FILE *fp, + char *tokenbuf, + int *lastch) { int c; int token; @@ -179,6 +183,15 @@ nexttoken(fp, tokenbuf, lastch) case '"': *p++ = c; break; + case 'n': + *p++ = '\n'; + break; + case 'r': + *p++ = '\r'; + break; + case 't': + *p++ = '\t'; + break; case '0': case '1': case '2': @@ -200,30 +213,27 @@ nexttoken(fp, tokenbuf, lastch) case 'X': case 'x': i = 0; - c = nextch(fp, lastch); -#define ishexch(c) (((c) >= '0' && (c) <= '9') || \ - ((c) >= 'A' && (c) <= 'F') || \ - ((c) >= 'a' && (c) <= 'f')) - for (j = 0; j < 2 && ishexch(c); j++) { - i <<= 4; + for (j = 0; j < 2; j++) { + c = nextch(fp, lastch); + i <<= 4; if (c >= '0' && c <= '9') { i += c - '0'; } else if (c >= 'A' && c <= 'F') { i += c - 'A' + 10; - } else { + } else if (c >= 'a' && c <= 'f') { i += c - 'a' + 10; - } - c = nextch(fp, lastch); + } else { + putbackch(c, lastch); + i >>= 4; + break; + } } if (j == 0) { token = ERROR; goto string_error; } - putbackch(c, lastch); *p++ = (char)i; -#undef ishexch break; - case '\n': case EOF: putbackch(c, lastch); token = ERROR; @@ -270,8 +280,8 @@ string_error: } static long -modmask(name) - char *name; +modmask( + char *name) { long mask; @@ -301,28 +311,134 @@ modmask(name) return(mask); } +static char* +TransFileName(Xim im, char *name) +{ + char *home = NULL, *lcCompose = NULL; + char *i = name, *ret, *j; + int l = 0; + + while (*i) { + if (*i == '%') { + i++; + switch (*i) { + case '%': + l++; + break; + case 'H': + home = getenv("HOME"); + if (home) + l += strlen(home); + break; + case 'L': + lcCompose = _XlcFileName(im->core.lcd, COMPOSE_FILE); + if (lcCompose) + l += strlen(lcCompose); + break; + } + } else { + l++; + } + i++; + } + + j = ret = Xmalloc(l+1); + if (ret == NULL) + return ret; + i = name; + while (*i) { + if (*i == '%') { + i++; + switch (*i) { + case '%': + *j++ = '%'; + break; + case 'H': + if (home) { + strcpy(j, home); + j += strlen(home); + } + break; + case 'L': + if (lcCompose) { + strcpy(j, lcCompose); + j += strlen(lcCompose); + Xfree(lcCompose); + } + break; + } + i++; + } else { + *j++ = *i++; + } + } + *j = '\0'; + return ret; +} + +#ifndef MB_LEN_MAX +#define MB_LEN_MAX 6 +#endif + +static int +get_mb_string (Xim im, char *buf, KeySym ks) +{ + XPointer from, to; + int from_len, to_len, len; + XPointer args[1]; + XlcCharSet charset; + char local_buf[MB_LEN_MAX]; + unsigned int ucs; + ucs = KeySymToUcs4(ks); + + from = (XPointer) &ucs; + to = (XPointer) local_buf; + from_len = 1; + to_len = MB_LEN_MAX; + args[0] = (XPointer) &charset; + if (_XlcConvert(im->private.local.ucstoc_conv, + &from, &from_len, &to, &to_len, args, 1 ) != 0) { + return 0; + } + + from = (XPointer) local_buf; + to = (XPointer) buf; + from_len = MB_LEN_MAX - to_len; + to_len = MB_LEN_MAX + 1; + args[0] = (XPointer) charset; + if (_XlcConvert(im->private.local.cstomb_conv, + &from, &from_len, &to, &to_len, args, 1 ) != 0) { + return 0; + } + len = MB_LEN_MAX + 1 - to_len; + buf[len] = '\0'; + return len; +} + #define AllMask (ShiftMask | LockMask | ControlMask | Mod1Mask) #define LOCAL_WC_BUFSIZE 128 #define LOCAL_UTF8_BUFSIZE 256 #define SEQUENCE_MAX 10 static int -parseline(fp, top, tokenbuf) - FILE *fp; - DefTree **top; - char* tokenbuf; +parseline( + FILE *fp, + Xim im, + char* tokenbuf) { int token; unsigned modifier_mask; unsigned modifier; unsigned tmp; KeySym keysym = NoSymbol; + DefTree **top = &im->private.local.top; DefTree *p = NULL; Bool exclam, tilde; KeySym rhs_keysym = 0; char *rhs_string_mb; int l; int lastch = 0; + char local_mb_buf[MB_LEN_MAX+1]; wchar_t local_wc_buf[LOCAL_WC_BUFSIZE], *rhs_string_wc; char local_utf8_buf[LOCAL_UTF8_BUFSIZE], *rhs_string_utf8; @@ -345,7 +461,21 @@ parseline(fp, top, tokenbuf) n = 0; do { - if ((token == KEY) && (strcmp("None", tokenbuf) == 0)) { + if ((token == KEY) && (strcmp("include", tokenbuf) == 0)) { + char *filename; + FILE *infp; + token = nexttoken(fp, tokenbuf, &lastch); + if (token != KEY && token != STRING) + goto error; + if ((filename = TransFileName(im, tokenbuf)) == NULL) + goto error; + infp = _XFopenFile(filename, "r"); + Xfree(filename); + if (infp == NULL) + goto error; + _XimParseStringFile(infp, im); + return (0); + } else if ((token == KEY) && (strcmp("None", tokenbuf) == 0)) { modifier = 0; modifier_mask = AllMask; token = nexttoken(fp, tokenbuf, &lastch); @@ -359,12 +489,11 @@ parseline(fp, top, tokenbuf) while (token == TILDE || token == KEY) { tilde = False; if (token == TILDE) { - token = nexttoken(fp, tokenbuf, &lastch); tilde = True; + token = nexttoken(fp, tokenbuf, &lastch); if (token != KEY) goto error; } - token = nexttoken(fp, tokenbuf, &lastch); tmp = modmask(tokenbuf); if (!tmp) { goto error; @@ -375,6 +504,7 @@ parseline(fp, top, tokenbuf) } else { modifier |= tmp; } + token = nexttoken(fp, tokenbuf, &lastch); } if (exclam) { modifier_mask = AllMask; @@ -436,11 +566,18 @@ parseline(fp, top, tokenbuf) if (token != ENDOFLINE && token != ENDOFFILE) { goto error; } - if( (rhs_string_mb = Xmalloc(1)) == NULL ) { - Xfree( rhs_string_mb ); + + l = get_mb_string(im, local_mb_buf, rhs_keysym); + if (l == 0) { + rhs_string_mb = Xmalloc(1); + } else { + rhs_string_mb = Xmalloc(l + 1); + } + if( rhs_string_mb == NULL ) { goto error; } - rhs_string_mb[0] = '\0'; + memcpy(rhs_string_mb, local_mb_buf, l); + rhs_string_mb[l] = '\0'; } else { goto error; } @@ -514,9 +651,9 @@ error: } void -_XimParseStringFile(fp, ptop) - FILE *fp; - DefTree **ptop; +_XimParseStringFile( + FILE *fp, + Xim im) { char tb[8192]; char* tbp; @@ -528,7 +665,7 @@ _XimParseStringFile(fp, ptop) else tbp = malloc (size); if (tbp != NULL) { - while (parseline(fp, ptop, tbp) >= 0) {} + while (parseline(fp, im, tbp) >= 0) {} if (tbp != tb) free (tbp); } } diff --git a/modules/im/ximcp/imRm.c b/modules/im/ximcp/imRm.c index 3af7c391..60c3b088 100644 --- a/modules/im/ximcp/imRm.c +++ b/modules/im/ximcp/imRm.c @@ -30,7 +30,7 @@ PERFORMANCE OF THIS SOFTWARE. makoto@sm.sony.co.jp ******************************************************************/ -/* $XFree86: xc/lib/X11/imRm.c,v 3.11 2001/01/22 21:32:32 dawes Exp $ */ +/* $XFree86: xc/lib/X11/imRm.c,v 3.13 2003/11/17 22:20:12 dawes Exp $ */ #include <stdio.h> #include <X11/Xlib.h> @@ -44,19 +44,13 @@ typedef struct _XimValueOffsetInfo { XrmQuark quark; unsigned int offset; Bool (*defaults)( -#if NeedNestedPrototypes struct _XimValueOffsetInfo *, XPointer, XPointer, unsigned long -#endif ); Bool (*encode)( -#if NeedNestedPrototypes struct _XimValueOffsetInfo *, XPointer, XPointer -#endif ); Bool (*decode)( -#if NeedNestedPrototypes struct _XimValueOffsetInfo *, XPointer, XPointer -#endif ); } XimValueOffsetInfoRec, *XimValueOffsetInfo; @@ -266,11 +260,11 @@ static XIMStyle const supported_local_styles[] = { }; Private Bool -_XimDefaultStyles(info, top, parm, mode) - XimValueOffsetInfo info; - XPointer top; - XPointer parm; /* unused */ - unsigned long mode; /* unused */ +_XimDefaultStyles( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, /* unused */ + unsigned long mode) /* unused */ { XIMStyles *styles; XIMStyles **out; @@ -302,11 +296,11 @@ _XimDefaultStyles(info, top, parm, mode) } Private Bool -_XimDefaultIMValues(info, top, parm, mode) - XimValueOffsetInfo info; - XPointer top; - XPointer parm; /* unused */ - unsigned long mode; /* unused */ +_XimDefaultIMValues( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, /* unused */ + unsigned long mode) /* unused */ { XIMValuesList *values_list; XIMValuesList **out; @@ -339,11 +333,11 @@ _XimDefaultIMValues(info, top, parm, mode) } Private Bool -_XimDefaultICValues(info, top, parm, mode) - XimValueOffsetInfo info; - XPointer top; - XPointer parm; /* unused */ - unsigned long mode; /* unused */ +_XimDefaultICValues( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, /* unused */ + unsigned long mode) /* unused */ { XIMValuesList *values_list; XIMValuesList **out; @@ -376,11 +370,11 @@ _XimDefaultICValues(info, top, parm, mode) } Private Bool -_XimDefaultVisiblePos(info, top, parm, mode) - XimValueOffsetInfo info; - XPointer top; - XPointer parm; /* unused */ - unsigned long mode; /* unused */ +_XimDefaultVisiblePos( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, /* unused */ + unsigned long mode) /* unused */ { Bool *out; @@ -390,11 +384,11 @@ _XimDefaultVisiblePos(info, top, parm, mode) } Private Bool -_XimDefaultFocusWindow(info, top, parm, mode) - XimValueOffsetInfo info; - XPointer top; - XPointer parm; - unsigned long mode; +_XimDefaultFocusWindow( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) { Xic ic = (Xic)parm; Window *out; @@ -409,11 +403,11 @@ _XimDefaultFocusWindow(info, top, parm, mode) } Private Bool -_XimDefaultResName(info, top, parm, mode) - XimValueOffsetInfo info; - XPointer top; - XPointer parm; - unsigned long mode; +_XimDefaultResName( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) { Xic ic = (Xic)parm; Xim im = (Xim)ic->core.im; @@ -429,11 +423,11 @@ _XimDefaultResName(info, top, parm, mode) } Private Bool -_XimDefaultResClass(info, top, parm, mode) - XimValueOffsetInfo info; - XPointer top; - XPointer parm; - unsigned long mode; +_XimDefaultResClass( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) { Xic ic = (Xic)parm; Xim im = (Xim)ic->core.im; @@ -449,11 +443,11 @@ _XimDefaultResClass(info, top, parm, mode) } Private Bool -_XimDefaultDestroyCB(info, top, parm, mode) - XimValueOffsetInfo info; - XPointer top; - XPointer parm; - unsigned long mode; +_XimDefaultDestroyCB( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) { Xic ic = (Xic)parm; Xim im = (Xim)ic->core.im; @@ -465,11 +459,11 @@ _XimDefaultDestroyCB(info, top, parm, mode) } Private Bool -_XimDefaultResetState(info, top, parm, mode) - XimValueOffsetInfo info; - XPointer top; - XPointer parm; - unsigned long mode; +_XimDefaultResetState( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) { XIMResetState *out; @@ -479,11 +473,11 @@ _XimDefaultResetState(info, top, parm, mode) } Private Bool -_XimDefaultHotKeyState(info, top, parm, mode) - XimValueOffsetInfo info; - XPointer top; - XPointer parm; - unsigned long mode; +_XimDefaultHotKeyState( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) { XIMHotKeyState *out; @@ -493,11 +487,11 @@ _XimDefaultHotKeyState(info, top, parm, mode) } Private Bool -_XimDefaultArea(info, top, parm, mode) - XimValueOffsetInfo info; - XPointer top; - XPointer parm; - unsigned long mode; +_XimDefaultArea( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) { Xic ic = (Xic)parm; Xim im = (Xim)ic->core.im; @@ -529,11 +523,11 @@ _XimDefaultArea(info, top, parm, mode) } Private Bool -_XimDefaultColormap(info, top, parm, mode) - XimValueOffsetInfo info; - XPointer top; - XPointer parm; - unsigned long mode; +_XimDefaultColormap( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) { Xic ic = (Xic)parm; Xim im = (Xim)ic->core.im; @@ -554,11 +548,11 @@ _XimDefaultColormap(info, top, parm, mode) } Private Bool -_XimDefaultStdColormap(info, top, parm, mode) - XimValueOffsetInfo info; - XPointer top; - XPointer parm; - unsigned long mode; +_XimDefaultStdColormap( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) { Atom *out; @@ -568,11 +562,11 @@ _XimDefaultStdColormap(info, top, parm, mode) } Private Bool -_XimDefaultFg(info, top, parm, mode) - XimValueOffsetInfo info; - XPointer top; - XPointer parm; - unsigned long mode; +_XimDefaultFg( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) { Xic ic = (Xic)parm; Xim im = (Xim)ic->core.im; @@ -586,11 +580,11 @@ _XimDefaultFg(info, top, parm, mode) } Private Bool -_XimDefaultBg(info, top, parm, mode) - XimValueOffsetInfo info; - XPointer top; - XPointer parm; - unsigned long mode; +_XimDefaultBg( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) { Xic ic = (Xic)parm; Xim im = (Xim)ic->core.im; @@ -604,11 +598,11 @@ _XimDefaultBg(info, top, parm, mode) } Private Bool -_XimDefaultBgPixmap(info, top, parm, mode) - XimValueOffsetInfo info; - XPointer top; - XPointer parm; - unsigned long mode; +_XimDefaultBgPixmap( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) { Pixmap *out; @@ -618,11 +612,11 @@ _XimDefaultBgPixmap(info, top, parm, mode) } Private Bool -_XimDefaultFontSet(info, top, parm, mode) - XimValueOffsetInfo info; - XPointer top; - XPointer parm; - unsigned long mode; +_XimDefaultFontSet( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) { XFontSet *out; @@ -632,11 +626,11 @@ _XimDefaultFontSet(info, top, parm, mode) } Private Bool -_XimDefaultLineSpace(info, top, parm, mode) - XimValueOffsetInfo info; - XPointer top; - XPointer parm; - unsigned long mode; +_XimDefaultLineSpace( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) { Xic ic = (Xic)parm; XFontSet fontset; @@ -661,11 +655,11 @@ _XimDefaultLineSpace(info, top, parm, mode) } Private Bool -_XimDefaultCursor(info, top, parm, mode) - XimValueOffsetInfo info; - XPointer top; - XPointer parm; - unsigned long mode; +_XimDefaultCursor( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) { Cursor *out; @@ -675,11 +669,11 @@ _XimDefaultCursor(info, top, parm, mode) } Private Bool -_XimDefaultPreeditState(info, top, parm, mode) - XimValueOffsetInfo info; - XPointer top; - XPointer parm; - unsigned long mode; +_XimDefaultPreeditState( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) { XIMPreeditState *out; @@ -689,20 +683,20 @@ _XimDefaultPreeditState(info, top, parm, mode) } Private Bool -_XimDefaultNest(info, top, parm, mode) - XimValueOffsetInfo info; - XPointer top; - XPointer parm; - unsigned long mode; +_XimDefaultNest( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) { return True; } Private Bool -_XimEncodeCallback(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimEncodeCallback( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { XIMCallback *out; @@ -712,10 +706,10 @@ _XimEncodeCallback(info, top, val) } Private Bool -_XimEncodeString(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimEncodeString( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { int len; char *string; @@ -740,10 +734,10 @@ _XimEncodeString(info, top, val) } Private Bool -_XimEncodeStyle(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimEncodeStyle( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { XIMStyle *out; @@ -753,10 +747,10 @@ _XimEncodeStyle(info, top, val) } Private Bool -_XimEncodeWindow(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimEncodeWindow( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { Window *out; @@ -766,10 +760,10 @@ _XimEncodeWindow(info, top, val) } Private Bool -_XimEncodeStringConv(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimEncodeStringConv( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { /* * Not yet @@ -778,10 +772,10 @@ _XimEncodeStringConv(info, top, val) } Private Bool -_XimEncodeResetState(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimEncodeResetState( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { XIMResetState *out; @@ -791,10 +785,10 @@ _XimEncodeResetState(info, top, val) } Private Bool -_XimEncodeHotKey(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimEncodeHotKey( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { XIMHotKeyTriggers *hotkey = (XIMHotKeyTriggers *)val; XIMHotKeyTriggers **out; @@ -834,10 +828,10 @@ _XimEncodeHotKey(info, top, val) } Private Bool -_XimEncodeHotKetState(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimEncodeHotKetState( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { XIMHotKeyState *out; @@ -847,10 +841,10 @@ _XimEncodeHotKetState(info, top, val) } Private Bool -_XimEncodeRectangle(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimEncodeRectangle( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { XRectangle *out; @@ -860,10 +854,10 @@ _XimEncodeRectangle(info, top, val) } Private Bool -_XimEncodeSpot(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimEncodeSpot( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { XPoint *out; @@ -873,10 +867,10 @@ _XimEncodeSpot(info, top, val) } Private Bool -_XimEncodeColormap(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimEncodeColormap( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { Colormap *out; @@ -886,10 +880,10 @@ _XimEncodeColormap(info, top, val) } Private Bool -_XimEncodeStdColormap(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimEncodeStdColormap( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { Atom *out; @@ -899,10 +893,10 @@ _XimEncodeStdColormap(info, top, val) } Private Bool -_XimEncodeLong(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimEncodeLong( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { unsigned long *out; @@ -912,10 +906,10 @@ _XimEncodeLong(info, top, val) } Private Bool -_XimEncodeBgPixmap(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimEncodeBgPixmap( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { Pixmap *out; @@ -925,10 +919,10 @@ _XimEncodeBgPixmap(info, top, val) } Private Bool -_XimEncodeFontSet(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimEncodeFontSet( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { XFontSet *out; @@ -938,10 +932,10 @@ _XimEncodeFontSet(info, top, val) } Private Bool -_XimEncodeLineSpace(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimEncodeLineSpace( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { int *out; @@ -951,10 +945,10 @@ _XimEncodeLineSpace(info, top, val) } Private Bool -_XimEncodeCursor(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimEncodeCursor( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { Cursor *out; @@ -964,10 +958,10 @@ _XimEncodeCursor(info, top, val) } Private Bool -_XimEncodePreeditState(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimEncodePreeditState( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { XIMPreeditState *out; @@ -977,19 +971,19 @@ _XimEncodePreeditState(info, top, val) } Private Bool -_XimEncodeNest(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimEncodeNest( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { return True; } Private Bool -_XimDecodeStyles(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimDecodeStyles( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { XIMStyles *styles; XIMStyles *out; @@ -1025,10 +1019,10 @@ _XimDecodeStyles(info, top, val) } Private Bool -_XimDecodeValues(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimDecodeValues( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { XIMValuesList *values_list; XIMValuesList *out; @@ -1064,10 +1058,10 @@ _XimDecodeValues(info, top, val) } Private Bool -_XimDecodeCallback(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimDecodeCallback( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { XIMCallback *in; XIMCallback *callback; @@ -1084,10 +1078,10 @@ _XimDecodeCallback(info, top, val) } Private Bool -_XimDecodeString(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimDecodeString( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { int len = 0; char *in; @@ -1109,10 +1103,10 @@ _XimDecodeString(info, top, val) } Private Bool -_XimDecodeBool(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimDecodeBool( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { Bool *in; @@ -1122,10 +1116,10 @@ _XimDecodeBool(info, top, val) } Private Bool -_XimDecodeStyle(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimDecodeStyle( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { XIMStyle *in; @@ -1135,10 +1129,10 @@ _XimDecodeStyle(info, top, val) } Private Bool -_XimDecodeWindow(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimDecodeWindow( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { Window *in; @@ -1148,10 +1142,10 @@ _XimDecodeWindow(info, top, val) } Private Bool -_XimDecodeStringConv(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimDecodeStringConv( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { /* * Not yet @@ -1160,10 +1154,10 @@ _XimDecodeStringConv(info, top, val) } Private Bool -_XimDecodeResetState(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimDecodeResetState( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { XIMResetState *in; @@ -1173,10 +1167,10 @@ _XimDecodeResetState(info, top, val) } Private Bool -_XimDecodeHotKey(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimDecodeHotKey( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { XIMHotKeyTriggers *in; XIMHotKeyTriggers *hotkey; @@ -1207,10 +1201,10 @@ _XimDecodeHotKey(info, top, val) } Private Bool -_XimDecodeHotKetState(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimDecodeHotKetState( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { XIMHotKeyState *in; @@ -1220,10 +1214,10 @@ _XimDecodeHotKetState(info, top, val) } Private Bool -_XimDecodeRectangle(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimDecodeRectangle( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { XRectangle *in; XRectangle *rect; @@ -1238,10 +1232,10 @@ _XimDecodeRectangle(info, top, val) } Private Bool -_XimDecodeSpot(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimDecodeSpot( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { XPoint *in; XPoint *spot; @@ -1256,10 +1250,10 @@ _XimDecodeSpot(info, top, val) } Private Bool -_XimDecodeColormap(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimDecodeColormap( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { Colormap *in; @@ -1269,10 +1263,10 @@ _XimDecodeColormap(info, top, val) } Private Bool -_XimDecodeStdColormap(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimDecodeStdColormap( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { Atom *in; @@ -1282,10 +1276,10 @@ _XimDecodeStdColormap(info, top, val) } Private Bool -_XimDecodeLong(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimDecodeLong( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { unsigned long *in; @@ -1295,10 +1289,10 @@ _XimDecodeLong(info, top, val) } Private Bool -_XimDecodeBgPixmap(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimDecodeBgPixmap( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { Pixmap *in; @@ -1308,10 +1302,10 @@ _XimDecodeBgPixmap(info, top, val) } Private Bool -_XimDecodeFontSet(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimDecodeFontSet( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { XFontSet *in; @@ -1321,10 +1315,10 @@ _XimDecodeFontSet(info, top, val) } Private Bool -_XimDecodeLineSpace(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimDecodeLineSpace( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { int *in; @@ -1334,10 +1328,10 @@ _XimDecodeLineSpace(info, top, val) } Private Bool -_XimDecodeCursor(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimDecodeCursor( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { Cursor *in; @@ -1347,10 +1341,10 @@ _XimDecodeCursor(info, top, val) } Private Bool -_XimDecodePreeditState(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimDecodePreeditState( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { XIMPreeditState *in; @@ -1360,10 +1354,10 @@ _XimDecodePreeditState(info, top, val) } Private Bool -_XimDecodeNest(info, top, val) - XimValueOffsetInfo info; - XPointer top; - XPointer val; +_XimDecodeNest( + XimValueOffsetInfo info, + XPointer top, + XPointer val) { return True; } @@ -2048,12 +2042,12 @@ static XimICMode ic_mode[] = { }; Private Bool -_XimSetResourceList(res_list, list_num, resource, num_resource, id) - XIMResourceList *res_list; - unsigned int *list_num; - XIMResourceList resource; - unsigned int num_resource; - unsigned short id; +_XimSetResourceList( + XIMResourceList *res_list, + unsigned int *list_num, + XIMResourceList resource, + unsigned int num_resource, + unsigned short id) { register int i; int len; @@ -2077,46 +2071,46 @@ _XimSetResourceList(res_list, list_num, resource, num_resource, id) } Public Bool -_XimSetIMResourceList(res_list, list_num) - XIMResourceList *res_list; - unsigned int *list_num; +_XimSetIMResourceList( + XIMResourceList *res_list, + unsigned int *list_num) { return _XimSetResourceList(res_list, list_num, im_resources, XIMNumber(im_resources), 100); } Public Bool -_XimSetICResourceList(res_list, list_num) - XIMResourceList *res_list; - unsigned int *list_num; +_XimSetICResourceList( + XIMResourceList *res_list, + unsigned int *list_num) { return _XimSetResourceList(res_list, list_num, ic_resources, XIMNumber(ic_resources), 200); } Public Bool -_XimSetInnerIMResourceList(res_list, list_num) - XIMResourceList *res_list; - unsigned int *list_num; +_XimSetInnerIMResourceList( + XIMResourceList *res_list, + unsigned int *list_num) { return _XimSetResourceList(res_list, list_num, im_inner_resources, XIMNumber(im_inner_resources), 100); } Public Bool -_XimSetInnerICResourceList(res_list, list_num) - XIMResourceList *res_list; - unsigned int *list_num; +_XimSetInnerICResourceList( + XIMResourceList *res_list, + unsigned int *list_num) { return _XimSetResourceList(res_list, list_num, ic_inner_resources, XIMNumber(ic_inner_resources), 200); } Private XIMResourceList -_XimGetResourceListRecByMode(res_list, list_num, mode) - XIMResourceList res_list; - unsigned int list_num; - unsigned short mode; +_XimGetResourceListRecByMode( + XIMResourceList res_list, + unsigned int list_num, + unsigned short mode) { register int i; @@ -2129,9 +2123,9 @@ _XimGetResourceListRecByMode(res_list, list_num, mode) } Public Bool -_XimCheckCreateICValues(res_list, list_num) - XIMResourceList res_list; - unsigned int list_num; +_XimCheckCreateICValues( + XIMResourceList res_list, + unsigned int list_num) { if (!_XimGetResourceListRecByMode(res_list, list_num, XIM_MODE_IC_CREATE)) { return True; @@ -2140,10 +2134,10 @@ _XimCheckCreateICValues(res_list, list_num) } Public XIMResourceList -_XimGetResourceListRecByQuark(res_list, list_num, quark) - XIMResourceList res_list; - unsigned int list_num; - XrmQuark quark; +_XimGetResourceListRecByQuark( + XIMResourceList res_list, + unsigned int list_num, + XrmQuark quark) { register int i; @@ -2156,10 +2150,10 @@ _XimGetResourceListRecByQuark(res_list, list_num, quark) } Public XIMResourceList -_XimGetResourceListRec(res_list, list_num, name) - XIMResourceList res_list; - unsigned int list_num; - char *name; +_XimGetResourceListRec( + XIMResourceList res_list, + unsigned int list_num, + char *name) { XrmQuark quark = XrmStringToQuark(name); @@ -2167,12 +2161,12 @@ _XimGetResourceListRec(res_list, list_num, name) } Public char * -_XimSetIMValueData(im, top, values, res_list, list_num) - Xim im; - XPointer top; - XIMArg *values; - XIMResourceList res_list; - unsigned int list_num; +_XimSetIMValueData( + Xim im, + XPointer top, + XIMArg *values, + XIMResourceList res_list, + unsigned int list_num) { register XIMArg *p; XIMResourceList res; @@ -2197,12 +2191,12 @@ _XimSetIMValueData(im, top, values, res_list, list_num) } Public char * -_XimGetIMValueData(im, top, values, res_list, list_num) - Xim im; - XPointer top; - XIMArg *values; - XIMResourceList res_list; - unsigned int list_num; +_XimGetIMValueData( + Xim im, + XPointer top, + XIMArg *values, + XIMResourceList res_list, + unsigned int list_num) { register XIMArg *p; XIMResourceList res; @@ -2227,9 +2221,9 @@ _XimGetIMValueData(im, top, values, res_list, list_num) } Public void -_XimSetIMMode(res_list, list_num) - XIMResourceList res_list; - unsigned int list_num; +_XimSetIMMode( + XIMResourceList res_list, + unsigned int list_num) { XIMResourceList res; unsigned int n = XIMNumber(im_mode); @@ -2246,8 +2240,8 @@ _XimSetIMMode(res_list, list_num) } Private int -_XimCheckSetIMDefaultsMode(res) - XIMResourceList res; +_XimCheckSetIMDefaultsMode( + XIMResourceList res) { if(res->mode & XIM_MODE_IM_DEFAULT) { return XIM_CHECK_VALID; @@ -2256,8 +2250,8 @@ _XimCheckSetIMDefaultsMode(res) } Private int -_XimCheckSetIMValuesMode(res) - XIMResourceList res; +_XimCheckSetIMValuesMode( + XIMResourceList res) { if(res->mode & XIM_MODE_IM_SET) { return XIM_CHECK_VALID; @@ -2266,8 +2260,8 @@ _XimCheckSetIMValuesMode(res) } Private int - _XimCheckGetIMValuesMode(res) - XIMResourceList res; + _XimCheckGetIMValuesMode( + XIMResourceList res) { if(res->mode & XIM_MODE_IM_GET) { return XIM_CHECK_VALID; @@ -2276,9 +2270,9 @@ Private int } Public int - _XimCheckIMMode(res, mode) - XIMResourceList res; - unsigned long mode; + _XimCheckIMMode( + XIMResourceList res, + unsigned long mode) { if(res->mode == 0) { return XIM_CHECK_INVALID; @@ -2340,9 +2334,9 @@ _XimSetICMode(res_list, list_num, style) } Private int -_XimCheckSetICDefaultsMode(res, mode) - XIMResourceList res; - unsigned long mode; +_XimCheckSetICDefaultsMode( + XIMResourceList res, + unsigned long mode) { if(mode & XIM_PREEDIT_ATTR) { if(!(res->mode & XIM_MODE_PRE_MASK)) { @@ -2383,9 +2377,9 @@ _XimCheckSetICDefaultsMode(res, mode) } Private int -_XimCheckCreateICMode(res, mode) - XIMResourceList res; - unsigned long mode; +_XimCheckCreateICMode( + XIMResourceList res, + unsigned long mode) { if(mode & XIM_PREEDIT_ATTR) { if(!(res->mode & XIM_MODE_PRE_MASK)) { @@ -2436,9 +2430,9 @@ _XimCheckCreateICMode(res, mode) } Private int -_XimCheckSetICValuesMode(res, mode) - XIMResourceList res; - unsigned long mode; +_XimCheckSetICValuesMode( + XIMResourceList res, + unsigned long mode) { if(mode & XIM_PREEDIT_ATTR) { if(!(res->mode & XIM_MODE_PRE_MASK)) { @@ -2477,9 +2471,9 @@ _XimCheckSetICValuesMode(res, mode) } Private int -_XimCheckGetICValuesMode(res, mode) - XIMResourceList res; - unsigned long mode; +_XimCheckGetICValuesMode( + XIMResourceList res, + unsigned long mode) { if(mode & XIM_PREEDIT_ATTR) { if(!(res->mode & XIM_MODE_PRE_MASK)) { @@ -2512,9 +2506,9 @@ _XimCheckGetICValuesMode(res, mode) } Public int - _XimCheckICMode(res, mode) - XIMResourceList res; - unsigned long mode; + _XimCheckICMode( + XIMResourceList res, + unsigned long mode) { if(mode &XIM_SETICDEFAULTS) { return _XimCheckSetICDefaultsMode(res, mode); @@ -2530,11 +2524,11 @@ Public int } Public Bool -_XimSetLocalIMDefaults(im, top, res_list, list_num) - Xim im; - XPointer top; - XIMResourceList res_list; - unsigned int list_num; +_XimSetLocalIMDefaults( + Xim im, + XPointer top, + XIMResourceList res_list, + unsigned int list_num) { XimValueOffsetInfo info; unsigned int num; @@ -2569,12 +2563,12 @@ _XimSetLocalIMDefaults(im, top, res_list, list_num) } Public Bool -_XimSetICDefaults(ic, top, mode, res_list, list_num) - Xic ic; - XPointer top; - unsigned long mode; - XIMResourceList res_list; - unsigned int list_num; +_XimSetICDefaults( + Xic ic, + XPointer top, + unsigned long mode, + XIMResourceList res_list, + unsigned int list_num) { unsigned int num; XimValueOffsetInfo info; @@ -2634,12 +2628,12 @@ _XimSetICDefaults(ic, top, mode, res_list, list_num) } Private Bool -_XimEncodeAttr(info, num, res, top, val) - XimValueOffsetInfo info; - unsigned int num; - XIMResourceList res; - XPointer top; - XPointer val; +_XimEncodeAttr( + XimValueOffsetInfo info, + unsigned int num, + XIMResourceList res, + XPointer top, + XPointer val) { register int i; @@ -2655,22 +2649,22 @@ _XimEncodeAttr(info, num, res, top, val) } Public Bool -_XimEncodeLocalIMAttr(res, top, val) - XIMResourceList res; - XPointer top; - XPointer val; +_XimEncodeLocalIMAttr( + XIMResourceList res, + XPointer top, + XPointer val) { return _XimEncodeAttr(im_attr_info, XIMNumber(im_attr_info), res, top, val); } Public Bool -_XimEncodeLocalICAttr(ic, res, top, arg, mode) - Xic ic; - XIMResourceList res; - XPointer top; - XIMArg *arg; - unsigned long mode; +_XimEncodeLocalICAttr( + Xic ic, + XIMResourceList res, + XPointer top, + XIMArg *arg, + unsigned long mode) { unsigned int num; XimValueOffsetInfo info; @@ -2690,11 +2684,11 @@ _XimEncodeLocalICAttr(ic, res, top, arg, mode) } Private Bool -_XimEncodeLocalTopValue(ic, res, val, flag) - Xic ic; - XIMResourceList res; - XPointer val; - Bool flag; +_XimEncodeLocalTopValue( + Xic ic, + XIMResourceList res, + XPointer val, + Bool flag) { XIMArg *p = (XIMArg *)val; @@ -2726,10 +2720,10 @@ _XimEncodeLocalTopValue(ic, res, val, flag) } Private Bool -_XimEncodeLocalPreeditValue(ic, res, val) - Xic ic; - XIMResourceList res; - XPointer val; +_XimEncodeLocalPreeditValue( + Xic ic, + XIMResourceList res, + XPointer val) { XIMArg *p = (XIMArg *)val; @@ -2746,10 +2740,10 @@ _XimEncodeLocalPreeditValue(ic, res, val) } Private Bool -_XimEncodeLocalStatusValue(ic, res, val) - Xic ic; - XIMResourceList res; - XPointer val; +_XimEncodeLocalStatusValue( + Xic ic, + XIMResourceList res, + XPointer val) { XIMArg *p = (XIMArg *)val; @@ -2766,14 +2760,14 @@ _XimEncodeLocalStatusValue(ic, res, val) } Public char * -_XimSetICValueData(ic, top, res_list, list_num, values, mode, flag) - Xic ic; - XPointer top; - XIMResourceList res_list; - unsigned int list_num; - XIMArg *values; - unsigned long mode; - Bool flag; +_XimSetICValueData( + Xic ic, + XPointer top, + XIMResourceList res_list, + unsigned int list_num, + XIMArg *values, + unsigned long mode, + Bool flag) { register XIMArg *p; XIMResourceList res; @@ -2831,9 +2825,9 @@ _XimSetICValueData(ic, top, res_list, list_num, values, mode, flag) } Private Bool -_XimCheckInputStyle(styles, style) - XIMStyles *styles; - XIMStyle style; +_XimCheckInputStyle( + XIMStyles *styles, + XIMStyle style) { int num = styles->count_styles; register int i; @@ -2847,13 +2841,13 @@ _XimCheckInputStyle(styles, style) } Public Bool -_XimCheckLocalInputStyle(ic, top, values, styles, res_list, list_num) - Xic ic; - XPointer top; - XIMArg *values; - XIMStyles *styles; - XIMResourceList res_list; - unsigned int list_num; +_XimCheckLocalInputStyle( + Xic ic, + XPointer top, + XIMArg *values, + XIMStyles *styles, + XIMResourceList res_list, + unsigned int list_num) { XrmQuark quark = XrmStringToQuark(XNInputStyle); register XIMArg *p; @@ -2878,12 +2872,12 @@ _XimCheckLocalInputStyle(ic, top, values, styles, res_list, list_num) } Private Bool -_XimDecodeAttr(info, num, res, top, val) - XimValueOffsetInfo info; - unsigned int num; - XIMResourceList res; - XPointer top; - XPointer val; +_XimDecodeAttr( + XimValueOffsetInfo info, + unsigned int num, + XIMResourceList res, + XPointer top, + XPointer val) { register int i; @@ -2899,21 +2893,21 @@ _XimDecodeAttr(info, num, res, top, val) } Public Bool -_XimDecodeLocalIMAttr(res, top, val) - XIMResourceList res; - XPointer top; - XPointer val; +_XimDecodeLocalIMAttr( + XIMResourceList res, + XPointer top, + XPointer val) { return _XimDecodeAttr(im_attr_info, XIMNumber(im_attr_info), res, top, val); } Public Bool -_XimDecodeLocalICAttr(res, top, val, mode) - XIMResourceList res; - XPointer top; - XPointer val; - unsigned long mode; +_XimDecodeLocalICAttr( + XIMResourceList res, + XPointer top, + XPointer val, + unsigned long mode) { unsigned int num; XimValueOffsetInfo info; @@ -3042,9 +3036,9 @@ _XimGetCurrentICValues(ic, ic_values) } Public void -_XimSetCurrentICValues(ic, ic_values) - Xic ic; - XimDefICValues *ic_values; +_XimSetCurrentICValues( + Xic ic, + XimDefICValues *ic_values) { ic->core.input_style = ic_values->input_style; ic->core.client_window = ic_values->client_window; @@ -3066,7 +3060,7 @@ _XimSetCurrentICValues(ic, ic_values) } Private void -_XimInitialIMOffsetInfo() +_XimInitialIMOffsetInfo(void) { unsigned int n = XIMNumber(im_attr_info); register int i; @@ -3077,7 +3071,7 @@ _XimInitialIMOffsetInfo() } Private void -_XimInitialICOffsetInfo() +_XimInitialICOffsetInfo(void) { unsigned int n; register int i; @@ -3099,7 +3093,7 @@ _XimInitialICOffsetInfo() } Private void -_XimInitialIMMode() +_XimInitialIMMode(void) { unsigned int n = XIMNumber(im_mode); register int i; @@ -3110,7 +3104,7 @@ _XimInitialIMMode() } Private void -_XimInitialICMode() +_XimInitialICMode(void) { unsigned int n = XIMNumber(ic_mode); register int i; @@ -3121,7 +3115,7 @@ _XimInitialICMode() } Public void -_XimInitialResourceInfo() +_XimInitialResourceInfo(void) { static Bool init_flag = False; diff --git a/modules/im/ximcp/imRmAttr.c b/modules/im/ximcp/imRmAttr.c index df05ecb8..91f6b2de 100644 --- a/modules/im/ximcp/imRmAttr.c +++ b/modules/im/ximcp/imRmAttr.c @@ -26,25 +26,26 @@ PERFORMANCE OF THIS SOFTWARE. fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ -/* $XFree86: xc/lib/X11/imRmAttr.c,v 1.6 2001/10/28 03:32:34 tsi Exp $ */ +/* $XFree86: xc/lib/X11/imRmAttr.c,v 1.8 2003/11/17 22:20:12 dawes Exp $ */ #include "Xlibint.h" #include "Xlcint.h" #include "Ximint.h" + Private XIMResourceList -_XimGetNestedListSeparator(res_list, res_num) - XIMResourceList res_list; /* LISTofIMATTR or IMATTR */ - unsigned int res_num; +_XimGetNestedListSeparator( + XIMResourceList res_list, /* LISTofIMATTR or IMATTR */ + unsigned int res_num) { return _XimGetResourceListRec(res_list, res_num, XNSeparatorofNestedList); } Private Bool -_XimCheckInnerIMAttributes(im, arg, mode) - Xim im; - XIMArg *arg; - unsigned long mode; +_XimCheckInnerIMAttributes( + Xim im, + XIMArg *arg, + unsigned long mode) { XIMResourceList res; int check; @@ -63,14 +64,14 @@ _XimCheckInnerIMAttributes(im, arg, mode) } Public char * -_XimMakeIMAttrIDList(im, res_list, res_num, arg, buf, len, mode) - Xim im; - XIMResourceList res_list; - unsigned int res_num; - XIMArg *arg; - CARD16 *buf; - INT16 *len; - unsigned long mode; +_XimMakeIMAttrIDList( + Xim im, + XIMResourceList res_list, + unsigned int res_num, + XIMArg *arg, + CARD16 *buf, + INT16 *len, + unsigned long mode) { register XIMArg *p; XIMResourceList res; @@ -101,10 +102,10 @@ _XimMakeIMAttrIDList(im, res_list, res_num, arg, buf, len, mode) } Private Bool -_XimCheckInnerICAttributes(ic, arg, mode) - Xic ic; - XIMArg *arg; - unsigned long mode; +_XimCheckInnerICAttributes( + Xic ic, + XIMArg *arg, + unsigned long mode) { XIMResourceList res; int check; @@ -123,14 +124,14 @@ _XimCheckInnerICAttributes(ic, arg, mode) } Public char * -_XimMakeICAttrIDList(ic, res_list, res_num, arg, buf, len, mode) - Xic ic; - XIMResourceList res_list; - unsigned int res_num; - XIMArg *arg; - CARD16 *buf; - INT16 *len; - unsigned long mode; +_XimMakeICAttrIDList( + Xic ic, + XIMResourceList res_list, + unsigned int res_num, + XIMArg *arg, + CARD16 *buf, + INT16 *len, + unsigned long mode) { register XIMArg *p; XIMResourceList res; @@ -205,13 +206,13 @@ _XimMakeICAttrIDList(ic, res_list, res_num, arg, buf, len, mode) } Private Bool -_XimAttributeToValue(ic, res, data, data_len, value, mode) - Xic ic; - XIMResourceList res; - CARD16 *data; - INT16 data_len; - XPointer value; - BITMASK32 mode; +_XimAttributeToValue( + Xic ic, + XIMResourceList res, + CARD16 *data, + INT16 data_len, + XPointer value, + BITMASK32 mode) { switch (res->resource_size) { case XimType_SeparatorOfNestedList: @@ -394,9 +395,9 @@ _XimAttributeToValue(ic, res, data, data_len, value, mode) } Private Bool -_XimDecodeInnerIMATTRIBUTE(im, arg) - Xim im; - XIMArg *arg; +_XimDecodeInnerIMATTRIBUTE( + Xim im, + XIMArg *arg) { XIMResourceList res; XimDefIMValues im_values; @@ -410,7 +411,6 @@ _XimDecodeInnerIMATTRIBUTE(im, arg) } Public char * -#if NeedFunctionPrototypes _XimDecodeIMATTRIBUTE( Xim im, XIMResourceList res_list, @@ -419,16 +419,6 @@ _XimDecodeIMATTRIBUTE( INT16 data_len, XIMArg *arg, BITMASK32 mode) -#else -_XimDecodeIMATTRIBUTE(im, res_list, res_num, data, data_len, arg, mode) - Xim im; - XIMResourceList res_list; - unsigned int res_num; - CARD16 *data; - INT16 data_len; - XIMArg *arg; - BITMASK32 mode; -#endif /* NeedFunctionPrototypes */ { register XIMArg *p; XIMResourceList res; @@ -474,10 +464,10 @@ _XimDecodeIMATTRIBUTE(im, res_list, res_num, data, data_len, arg, mode) } Private Bool -_XimDecodeInnerICATTRIBUTE(ic, arg, mode) - Xic ic; - XIMArg *arg; - unsigned long mode; +_XimDecodeInnerICATTRIBUTE( + Xic ic, + XIMArg *arg, + unsigned long mode) { XIMResourceList res; XimDefICValues ic_values; @@ -494,7 +484,6 @@ _XimDecodeInnerICATTRIBUTE(ic, arg, mode) } Public char * -#if NeedFunctionPrototypes _XimDecodeICATTRIBUTE( Xic ic, XIMResourceList res_list, @@ -503,16 +492,6 @@ _XimDecodeICATTRIBUTE( INT16 data_len, XIMArg *arg, BITMASK32 mode) -#else -_XimDecodeICATTRIBUTE(ic, res_list, res_num, data, data_len, arg, mode) - Xic ic; - XIMResourceList res_list; - unsigned int res_num; - CARD16 *data; - INT16 data_len; - XIMArg *arg; - BITMASK32 mode; -#endif /* NeedFunctionPrototypes */ { register XIMArg *p; XIMResourceList res; @@ -581,14 +560,14 @@ _XimDecodeICATTRIBUTE(ic, res_list, res_num, data, data_len, arg, mode) } Private Bool -_XimValueToAttribute(res, buf, buf_size, value, len, mode, param) - XIMResourceList res; - XPointer buf; - int buf_size; - XPointer value; - int *len; - unsigned long mode; - XPointer param; +_XimValueToAttribute( + XIMResourceList res, + XPointer buf, + int buf_size, + XPointer value, + int *len, + unsigned long mode, + XPointer param) { int ret_len; @@ -789,11 +768,11 @@ _XimValueToAttribute(res, buf, buf_size, value, len, mode, param) } Private Bool -_XimSetInnerIMAttributes(im, top, arg, mode) - Xim im; - XPointer top; - XIMArg *arg; - unsigned long mode; +_XimSetInnerIMAttributes( + Xim im, + XPointer top, + XIMArg *arg, + unsigned long mode) { XIMResourceList res; int check; @@ -812,17 +791,17 @@ _XimSetInnerIMAttributes(im, top, arg, mode) } Public char * -_XimEncodeIMATTRIBUTE(im, res_list, res_num, arg, arg_ret, buf, size, ret_len, top, mode) - Xim im; - XIMResourceList res_list; - unsigned int res_num; - XIMArg *arg; - XIMArg **arg_ret; - char *buf; - int size; - int *ret_len; - XPointer top; - unsigned long mode; +_XimEncodeIMATTRIBUTE( + Xim im, + XIMResourceList res_list, + unsigned int res_num, + XIMArg *arg, + XIMArg **arg_ret, + char *buf, + int size, + int *ret_len, + XPointer top, + unsigned long mode) { register XIMArg *p; XIMResourceList res; @@ -876,16 +855,16 @@ _XimEncodeIMATTRIBUTE(im, res_list, res_num, arg, arg_ret, buf, size, ret_len, #ifdef XIM_CONNECTABLE Public Bool -_XimEncodeSavedIMATTRIBUTE(im, res_list, res_num, idx, buf, size, ret_len, top, mode) - Xim im; - XIMResourceList res_list; - unsigned int res_num; - int *idx; - char *buf; - int size; - int *ret_len; - XPointer top; - unsigned long mode; +_XimEncodeSavedIMATTRIBUTE( + Xim im, + XIMResourceList res_list, + unsigned int res_num, + int *idx, + char *buf, + int size, + int *ret_len, + XPointer top, + unsigned long mode) { register int i; int num = im->private.proto.num_saved_imvalues; @@ -939,10 +918,10 @@ _XimEncodeSavedIMATTRIBUTE(im, res_list, res_num, idx, buf, size, ret_len, top, #endif /* XIM_CONNECTABLE */ Private Bool -_XimEncodeTopValue(ic, res, p) - Xic ic; - XIMResourceList res; - XIMArg *p; +_XimEncodeTopValue( + Xic ic, + XIMResourceList res, + XIMArg *p) { if (res->xrm_name == XrmStringToQuark(XNClientWindow)) { ic->core.client_window = (Window)p->value; @@ -962,10 +941,10 @@ _XimEncodeTopValue(ic, res, p) } Private Bool -_XimEncodePreeditValue(ic, res, p) - Xic ic; - XIMResourceList res; - XIMArg *p; +_XimEncodePreeditValue( + Xic ic, + XIMResourceList res, + XIMArg *p) { if (res->xrm_name == XrmStringToQuark(XNStdColormap)) { XStandardColormap *colormap_ret; @@ -1013,10 +992,10 @@ _XimEncodePreeditValue(ic, res, p) } Private Bool -_XimEncodeStatusValue(ic, res, p) - Xic ic; - XIMResourceList res; - XIMArg *p; +_XimEncodeStatusValue( + Xic ic, + XIMResourceList res, + XIMArg *p) { if (res->xrm_name == XrmStringToQuark(XNStdColormap)) { XStandardColormap *colormap_ret; @@ -1064,11 +1043,11 @@ _XimEncodeStatusValue(ic, res, p) } Private Bool -_XimSetInnerICAttributes(ic, top, arg, mode) - Xic ic; - XPointer top; - XIMArg *arg; - unsigned long mode; +_XimSetInnerICAttributes( + Xic ic, + XPointer top, + XIMArg *arg, + unsigned long mode) { XIMResourceList res; int check; @@ -1087,18 +1066,18 @@ _XimSetInnerICAttributes(ic, top, arg, mode) } Public char * -_XimEncodeICATTRIBUTE(ic, res_list, res_num, arg, arg_ret, buf, size, ret_len, top, flag, mode) - Xic ic; - XIMResourceList res_list; - unsigned int res_num; - XIMArg *arg; - XIMArg **arg_ret; - char *buf; - int size; - int *ret_len; - XPointer top; - BITMASK32 *flag; - unsigned long mode; +_XimEncodeICATTRIBUTE( + Xic ic, + XIMResourceList res_list, + unsigned int res_num, + XIMArg *arg, + XIMArg **arg_ret, + char *buf, + int size, + int *ret_len, + XPointer top, + BITMASK32 *flag, + unsigned long mode) { register XIMArg *p; XIMResourceList res; @@ -1199,10 +1178,10 @@ _XimEncodeICATTRIBUTE(ic, res_list, res_num, arg, arg_ret, buf, size, ret_len, t #ifdef XIM_CONNECTABLE Private Bool -_XimEncodeSavedPreeditValue(ic, res, value) - Xic ic; - XIMResourceList res; - XPointer value; +_XimEncodeSavedPreeditValue( + Xic ic, + XIMResourceList res, + XPointer value) { int list_ret; XFontStruct **struct_list; @@ -1241,10 +1220,10 @@ _XimEncodeSavedPreeditValue(ic, res, value) } Private Bool -_XimEncodeSavedStatusValue(ic, res, value) - Xic ic; - XIMResourceList res; - XPointer value; +_XimEncodeSavedStatusValue( + Xic ic, + XIMResourceList res, + XPointer value) { int list_ret; XFontStruct **struct_list; @@ -1283,16 +1262,16 @@ _XimEncodeSavedStatusValue(ic, res, value) } Public Bool -_XimEncodeSavedICATTRIBUTE(ic, res_list, res_num, idx, buf, size, ret_len, top, mode) - Xic ic; - XIMResourceList res_list; - unsigned int res_num; - int *idx; - char *buf; - int size; - int *ret_len; - XPointer top; - unsigned long mode; +_XimEncodeSavedICATTRIBUTE( + Xic ic, + XIMResourceList res_list, + unsigned int res_num, + int *idx, + char *buf, + int size, + int *ret_len, + XPointer top, + unsigned long mode) { int i; int num = ic->private.proto.num_saved_icvalues; @@ -1394,10 +1373,10 @@ _XimEncodeSavedICATTRIBUTE(ic, res_list, res_num, idx, buf, size, ret_len, top, #endif /* XIM_CONNECTABLE */ Private unsigned int -_XimCountNumberOfAttr(total, attr, names_len) - INT16 total; - CARD16 *attr; - int *names_len; +_XimCountNumberOfAttr( + INT16 total, + CARD16 *attr, + int *names_len) { unsigned int n; INT16 len; @@ -1419,9 +1398,9 @@ _XimCountNumberOfAttr(total, attr, names_len) } Public Bool -_XimGetAttributeID(im, buf) - Xim im; - CARD16 *buf; +_XimGetAttributeID( + Xim im, + CARD16 *buf) { unsigned int n; XIMResourceList res; diff --git a/modules/im/ximcp/imThaiFlt.c b/modules/im/ximcp/imThaiFlt.c index 5168de2b..3e57f145 100644 --- a/modules/im/ximcp/imThaiFlt.c +++ b/modules/im/ximcp/imThaiFlt.c @@ -45,7 +45,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ -/* $XFree86: xc/lib/X11/imThaiFlt.c,v 3.18 2003/02/21 03:13:30 dawes Exp $ */ +/* $XFree86: xc/lib/X11/imThaiFlt.c,v 3.21 2003/11/17 22:20:12 dawes Exp $ */ /* **++ @@ -73,6 +73,8 @@ SOFTWARE. #include "Xlcint.h" #include "Ximint.h" #include "XimThai.h" +#include "XlcPubI.h" + /* EXTERNS */ /* KeyBind.c */ @@ -247,12 +249,7 @@ char const thaicat_isc_lookup[CH_CLASSES][CH_CLASSES] = { /* returns classification of a char */ Private int -#if NeedFunctionPrototypes THAI_chtype (unsigned char ch) -#else -THAI_chtype (ch) - unsigned char ch; -#endif { return tactis_chtype[ch]; } @@ -260,12 +257,7 @@ THAI_chtype (ch) /* returns the display level */ Private int -#if NeedFunctionPrototypes THAI_chlevel (unsigned char ch) -#else -THAI_chlevel (ch) - unsigned char ch; -#endif { int chlevel; @@ -306,12 +298,7 @@ THAI_chlevel (ch) /* return True if char is non-spacing */ Private Bool -#if NeedFunctionPrototypes THAI_isdead (unsigned char ch) -#else -THAI_isdead (ch) - unsigned char ch; -#endif { return ((tactis_chtype[ch] == CTRL) || (tactis_chtype[ch] == BV1) || (tactis_chtype[ch] == BV2) || (tactis_chtype[ch] == BD) || @@ -324,12 +311,7 @@ THAI_isdead (ch) /* return True if char is consonant */ Private Bool -#if NeedFunctionPrototypes THAI_iscons (unsigned char ch) -#else -THAI_iscons (ch) - unsigned char ch; -#endif { return (tactis_chtype[ch] == CONS); } @@ -337,12 +319,7 @@ THAI_iscons (ch) /* return True if char is vowel */ Private Bool -#if NeedFunctionPrototypes THAI_isvowel (unsigned char ch) -#else -THAI_isvowel (ch) - unsigned char ch; -#endif { return ((tactis_chtype[ch] == LV) || (tactis_chtype[ch] == FV1) || (tactis_chtype[ch] == FV2) || (tactis_chtype[ch] == FV3) || @@ -354,27 +331,16 @@ THAI_isvowel (ch) /* return True if char is tonemark */ Private Bool -#if NeedFunctionPrototypes THAI_istone (unsigned char ch) -#else -THAI_istone (ch) - unsigned char ch; -#endif { return (tactis_chtype[ch] == TONE); } Private Bool -#if NeedFunctionPrototypes THAI_iscomposible ( unsigned char follow_ch, unsigned char lead_ch) -#else -THAI_iscomposible (follow_ch, lead_ch) - unsigned char follow_ch; - unsigned char lead_ch; -#endif {/* "Can follow_ch be put in the same display cell as lead_ch?" */ return (write_rules_lookup[THAI_chtype(lead_ch)][THAI_chtype(follow_ch)] @@ -382,17 +348,10 @@ THAI_iscomposible (follow_ch, lead_ch) } Private Bool -#if NeedFunctionPrototypes THAI_isaccepted ( unsigned char follow_ch, unsigned char lead_ch, unsigned char mode) -#else -THAI_isaccepted (follow_ch, lead_ch, mode) - unsigned char follow_ch; - unsigned char lead_ch; - unsigned char mode; -#endif { Bool iskeyvalid; /* means "Can follow_ch be keyed in after lead_ch?" */ @@ -420,19 +379,11 @@ THAI_isaccepted (follow_ch, lead_ch, mode) #if 0 Private void -#if NeedFunctionPrototypes THAI_apply_write_rules( unsigned char *instr, unsigned char *outstr, unsigned char insert_ch, int *num_insert_ch) -#else -THAI_apply_write_rules(instr, outstr, insert_ch, num_insert_ch) - unsigned char *instr; - unsigned char *outstr; - unsigned char insert_ch; - int *num_insert_ch; -#endif { /* Input parameters: @@ -474,15 +425,9 @@ Output parameters: } Private int -#if NeedFunctionPrototypes THAI_find_chtype ( unsigned char *instr, int chtype) -#else -THAI_find_chtype (instr, chtype) - unsigned char *instr; - int chtype; -#endif { /* Input parameters: @@ -509,21 +454,12 @@ Output parameters: #endif Private int -#if NeedFunctionPrototypes THAI_apply_scm( unsigned char *instr, unsigned char *outstr, unsigned char spec_ch, int num_sp, unsigned char insert_ch) -#else -THAI_apply_scm(instr, outstr, spec_ch, num_sp, insert_ch) - unsigned char *instr; - unsigned char *outstr; - unsigned char spec_ch; - int num_sp; - unsigned char insert_ch; -#endif { unsigned char *scan, *outch; int i, dead_count, found_count; @@ -555,9 +491,11 @@ THAI_apply_scm(instr, outstr, spec_ch, num_sp, insert_ch) #if 0 Private void ComputeMaskFromKeytrans(); #endif -Private int IsCancelComposeKey(); -Private void SetLed(); +Private int IsCancelComposeKey(KeySym *symbol, XKeyEvent *event); +Private void SetLed(Display *dpy, int num, int state); +#if 0 Private CARD8 FindKeyCode(); +#endif /* The following functions are specific to this module */ @@ -566,12 +504,28 @@ Private int XThaiTranslateKey(); Private int XThaiTranslateKeySym(); #endif -Private KeySym HexIMNormalKey(); -Private KeySym HexIMFirstComposeKey(); -Private KeySym HexIMSecondComposeKey(); -Private KeySym HexIMComposeSequence(); -Private void InitIscMode(); -Private Bool ThaiComposeConvert(); +#if 0 +Private KeySym HexIMNormalKey( + XicThaiPart *thai_part, + KeySym symbol, + XKeyEvent *event); +Private KeySym HexIMFirstComposeKey( + XicThaiPart *thai_part, + KeySym symbol, + XKeyEvent *event); +Private KeySym HexIMSecondComposeKey( + XicThaiPart *thai_part, + KeySym symbol + XKeyEvent *event); +#endif +Private KeySym HexIMComposeSequence(KeySym ks1, KeySym ks2); +#if 0 +Private void InitIscMode(Xic ic); +Private Bool ThaiComposeConvert( + Display *dpy, + KeySym insym, + KeySym *outsym, KeySym *lower, KeySym *upper); +#endif /* * Definitions @@ -605,13 +559,7 @@ Private Bool ThaiComposeConvert(); (IC_RealDeletePreviousChar(ic)) Private unsigned char -#if NeedFunctionPrototypes IC_RealGetPreviousChar(Xic ic, unsigned short pos) -#else -IC_RealGetPreviousChar(ic, pos) - Xic ic; - XIMStringConversionPosition pos; -#endif { XICCallback* cb = &ic->core.string_conversion_callback; @@ -653,12 +601,7 @@ IC_RealGetPreviousChar(ic, pos) } Private unsigned char -#if NeedFunctionPrototypes IC_RealDeletePreviousChar(Xic ic) -#else -IC_RealDeletePreviousChar(ic) - Xic ic; -#endif { XICCallback* cb = &ic->core.string_conversion_callback; @@ -726,7 +669,12 @@ IC_RealDeletePreviousChar(ic) #define COMPOSE_LED 2 -typedef KeySym (*StateProc)(); +#if 0 +typedef KeySym (*StateProc)( + XicThaiPart *thai_part, + KeySym symbol, + XKeyEvent *event); +#endif /* * macros to classify XKeyEvent state field @@ -797,10 +745,10 @@ struct _XKeytrans { /* Convert keysym to 'Thai Compose' keysym */ /* The current implementation use latin-1 keysyms */ Private Bool -ThaiComposeConvert(dpy, insym, outsym ,lower, upper) - Display *dpy; - KeySym insym; - KeySym *outsym,*lower,*upper; +ThaiComposeConvert( + Display *dpy, + KeySym insym, + KeySym *outsym, KeySym *lower, KeySym *upper) { struct _XMapThaiKey const *table_entry = ThaiComposeTable; @@ -818,13 +766,14 @@ ThaiComposeConvert(dpy, insym, outsym ,lower, upper) #if 0 Private int -XThaiTranslateKey(dpy, keycode, modifiers, modifiers_return, keysym_return, - lsym_return, usym_return) - register Display *dpy; - KeyCode keycode; - register unsigned int modifiers; - unsigned int *modifiers_return; - KeySym *keysym_return,*lsym_return,*usym_return; +XThaiTranslateKey( + register Display *dpy, + KeyCode keycode, + register unsigned int modifiers, + unsigned int *modifiers_return, + KeySym *keysym_return, + KeySym *lsym_return, + KeySym *usym_return) { int per; register KeySym *syms; @@ -902,12 +851,14 @@ XThaiTranslateKey(dpy, keycode, modifiers, modifiers_return, keysym_return, * standard. */ Private int -XThaiTranslateKeySym(dpy, symbol, lsym, usym, modifiers, buffer, nbytes) - Display *dpy; - register KeySym symbol, lsym, usym; - unsigned int modifiers; - unsigned char *buffer; - int nbytes; +XThaiTranslateKeySym( + Display *dpy, + register KeySym symbol, + register KeySym lsym, + register KeySym usym, + unsigned int modifiers, + unsigned char *buffer, + int nbytes) { KeySym ckey = 0; register struct _XKeytrans *p; @@ -1010,9 +961,9 @@ XThaiTranslateKeySym(dpy, symbol, lsym, usym, modifiers, buffer, nbytes) * given a KeySym, returns the first keycode containing it, if any. */ Private CARD8 -FindKeyCode(dpy, code) - register Display *dpy; - register KeySym code; +FindKeyCode( + register Display *dpy, + register KeySym code) { register KeySym *kmax = dpy->keysyms + @@ -1035,9 +986,9 @@ FindKeyCode(dpy, code) * can't map some keysym to a modifier. */ Private void -ComputeMaskFromKeytrans(dpy, p) - Display *dpy; - register struct _XKeytrans *p; +ComputeMaskFromKeytrans( + Display *dpy, + register struct _XKeytrans *p) { register int i; register CARD8 code; @@ -1076,11 +1027,10 @@ ComputeMaskFromKeytrans(dpy, p) #define SECOND_COMPOSE_KEY_STATE 2 Private -KeySym HexIMNormalKey (thai_part, symbol, event) - XicThaiPart *thai_part; - KeySym symbol; - XKeyEvent *event; - +KeySym HexIMNormalKey( + XicThaiPart *thai_part, + KeySym symbol, + XKeyEvent *event) { if (IsComposeKey (symbol, event)) /* start compose sequence */ { @@ -1093,11 +1043,10 @@ KeySym HexIMNormalKey (thai_part, symbol, event) Private -KeySym HexIMFirstComposeKey (thai_part, symbol, event) - XicThaiPart *thai_part; - KeySym symbol; - XKeyEvent *event; - +KeySym HexIMFirstComposeKey( + XicThaiPart *thai_part, + KeySym symbol, + XKeyEvent *event) { if (IsModifierKey (symbol)) return symbol; /* ignore shift etc. */ if (IsCancelComposeKey (&symbol, event)) /* cancel sequence */ @@ -1117,11 +1066,10 @@ KeySym HexIMFirstComposeKey (thai_part, symbol, event) } Private -KeySym HexIMSecondComposeKey (thai_part, symbol, event) - XicThaiPart *thai_part; - KeySym symbol; - XKeyEvent *event; - +KeySym HexIMSecondComposeKey( + XicThaiPart *thai_part, + KeySym symbol, + XKeyEvent *event) { if (IsModifierKey (symbol)) return symbol; /* ignore shift etc. */ if (IsComposeKey (symbol, event)) /* restart sequence ? */ @@ -1153,9 +1101,7 @@ KeySym HexIMSecondComposeKey (thai_part, symbol, event) */ Private -KeySym HexIMComposeSequence (ks1, ks2) - -KeySym ks1, ks2; +KeySym HexIMComposeSequence(KeySym ks1, KeySym ks2) { int hi_digit; int lo_digit; @@ -1192,9 +1138,9 @@ int tactis_code; */ Private -int IsCancelComposeKey(symbol, event) - KeySym *symbol; - XKeyEvent *event; +int IsCancelComposeKey( + KeySym *symbol, + XKeyEvent *event) { if (*symbol==XK_Delete && !IsControl(event->state) && !IsMod1(event->state)) { @@ -1224,10 +1170,10 @@ int IsCancelComposeKey(symbol, event) */ Private -void SetLed (dpy, num, state) - Display *dpy; - int num; - int state; +void SetLed( + Display *dpy, + int num, + int state) { XKeyboardControl led_control; @@ -1240,8 +1186,7 @@ void SetLed (dpy, num, state) /* * Initialize ISC mode from im modifier */ -Private void InitIscMode(ic) -Xic ic; +Private void InitIscMode(Xic ic) { Xim im; char *im_modifier_name; @@ -1275,14 +1220,7 @@ Xic ic; * Helper functions for _XimThaiFilter() */ Private Bool -#if NeedFunctionPrototypes ThaiFltAcceptInput(Xic ic, unsigned char new_char, KeySym symbol) -#else -ThaiFltAcceptInput(ic, new_char, symbol) - Xic ic; - unsigned char new_char; - KeySym symbol; -#endif { ic->private.local.composed->wc[0] = tis2ucs(new_char); ic->private.local.composed->wc[1] = '\0'; @@ -1296,13 +1234,7 @@ ThaiFltAcceptInput(ic, new_char, symbol) } Private Bool -#if NeedFunctionPrototypes ThaiFltReorderInput(Xic ic, unsigned char previous_char, unsigned char new_char) -#else -ThaiFltReorderInput(ic, previous_char, new_char) - Xic ic; - unsigned char previous_char, new_char; -#endif { if (!IC_DeletePreviousChar(ic)) return False; ic->private.local.composed->wc[0] = tis2ucs(new_char); @@ -1315,14 +1247,7 @@ ThaiFltReorderInput(ic, previous_char, new_char) } Private Bool -#if NeedFunctionPrototypes ThaiFltReplaceInput(Xic ic, unsigned char new_char, KeySym symbol) -#else -ThaiFltReplaceInput(ic, new_char, symbol) - Xic ic; - unsigned char new_char; - KeySym symbol; -#endif { if (!IC_DeletePreviousChar(ic)) return False; ic->private.local.composed->wc[0] = tis2ucs(new_char); @@ -1348,7 +1273,6 @@ XPointer client_data; { Xic ic = (Xic)client_data; KeySym symbol; - int wcount; int isc_mode; /* Thai Input Sequence Check mode */ unsigned char previous_char; /* Last inputted Thai char */ unsigned char new_char; @@ -1368,8 +1292,8 @@ XPointer client_data; if (!IC_IscMode(ic)) InitIscMode(ic); - wcount = XwcLookupString((XIC)ic, &ev->xkey, - wbuf, sizeof(wbuf)/sizeof(wbuf[0]), &symbol, NULL); + XwcLookupString((XIC)ic, &ev->xkey, wbuf, sizeof(wbuf) / sizeof(wbuf[0]), + &symbol, NULL); if ((ev->xkey.state & (AllMods & ~ShiftMask)) || ((symbol >> 8 == 0xFF) && diff --git a/modules/im/ximcp/imThaiIc.c b/modules/im/ximcp/imThaiIc.c index 711654f5..b67e9c14 100644 --- a/modules/im/ximcp/imThaiIc.c +++ b/modules/im/ximcp/imThaiIc.c @@ -32,7 +32,7 @@ THIS SOFTWARE. frankyling@hgrd01.enet.dec.com ******************************************************************/ -/* $XFree86: xc/lib/X11/imThaiIc.c,v 1.4 2001/01/17 19:41:52 dawes Exp $ */ +/* $XFree86: xc/lib/X11/imThaiIc.c,v 1.5 2003/04/13 19:22:21 dawes Exp $ */ #include <stdio.h> #include <X11/Xlib.h> @@ -42,8 +42,8 @@ THIS SOFTWARE. #include "Ximint.h" Private void -_XimThaiUnSetFocus(xic) - XIC xic; +_XimThaiUnSetFocus( + XIC xic) { Xic ic = (Xic)xic; ((Xim)ic->core.im)->private.local.current_ic = (XIC)NULL; @@ -55,8 +55,8 @@ _XimThaiUnSetFocus(xic) } Private void -_XimThaiDestroyIC(xic) - XIC xic; +_XimThaiDestroyIC( + XIC xic) { Xic ic = (Xic)xic; if(((Xim)ic->core.im)->private.local.current_ic == (XIC)ic) { @@ -79,8 +79,8 @@ _XimThaiDestroyIC(xic) } Private void -_XimThaiSetFocus(xic) - XIC xic; +_XimThaiSetFocus( + XIC xic) { Xic ic = (Xic)xic; XIC current_ic = ((Xim)ic->core.im)->private.local.current_ic; @@ -100,8 +100,8 @@ _XimThaiSetFocus(xic) } Private void -_XimThaiReset(xic) - XIC xic; +_XimThaiReset( + XIC xic) { Xic ic = (Xic)xic; ic->private.local.thai.comp_state = 0; @@ -112,16 +112,16 @@ _XimThaiReset(xic) } Private char * -_XimThaiMbReset(xic) - XIC xic; +_XimThaiMbReset( + XIC xic) { _XimThaiReset(xic); return (char *)NULL; } Private wchar_t * -_XimThaiWcReset(xic) - XIC xic; +_XimThaiWcReset( + XIC xic) { _XimThaiReset(xic); return (wchar_t *)NULL; @@ -142,9 +142,9 @@ Private XICMethodsRec Thai_ic_methods = { }; XIC -_XimThaiCreateIC(im, values) - XIM im; - XIMArg *values; +_XimThaiCreateIC( + XIM im, + XIMArg *values) { Xic ic; XimDefICValues ic_values; diff --git a/modules/im/ximcp/imTrX.c b/modules/im/ximcp/imTrX.c index 9386d8fd..38ac014e 100644 --- a/modules/im/ximcp/imTrX.c +++ b/modules/im/ximcp/imTrX.c @@ -28,7 +28,7 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ -/* $XFree86: xc/lib/X11/imTrX.c,v 1.2 2002/11/26 01:21:25 dawes Exp $ */ +/* $XFree86: xc/lib/X11/imTrX.c,v 1.4 2003/11/17 22:20:12 dawes Exp $ */ #include <string.h> #include <X11/Xatom.h> @@ -40,14 +40,12 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "XimTrX.h" Private Bool -_XimXRegisterDispatcher(im, callback, call_data) - Xim im; +_XimXRegisterDispatcher( + Xim im, Bool (*callback)( -#if NeedNestedPrototypes Xim, INT16, XPointer, XPointer -#endif - ); - XPointer call_data; + ), + XPointer call_data) { XIntrCallbackPtr rec; XSpecRec *spec = (XSpecRec *)im->private.proto.spec; @@ -63,8 +61,8 @@ _XimXRegisterDispatcher(im, callback, call_data) } Private void -_XimXFreeIntrCallback(im) - Xim im; +_XimXFreeIntrCallback( + Xim im) { XSpecRec *spec = (XSpecRec *)im->private.proto.spec; register XIntrCallbackPtr rec, next; @@ -78,14 +76,7 @@ _XimXFreeIntrCallback(im) } Private Bool -#if NeedFunctionPrototypes _XimXCallDispatcher(Xim im, INT16 len, XPointer data) -#else -_XimXCallDispatcher(im, len, data) - Xim im; - INT16 len; - XPointer data; -#endif { register XIntrCallbackRec *rec; XSpecRec *spec = (XSpecRec *)im->private.proto.spec; @@ -98,11 +89,11 @@ _XimXCallDispatcher(im, len, data) } Private Bool -_XimXFilterWaitEvent(d, w, ev, arg) - Display *d; - Window w; - XEvent *ev; - XPointer arg; +_XimXFilterWaitEvent( + Display *d, + Window w, + XEvent *ev, + XPointer arg) { Xim im = (Xim)arg; XSpecRec *spec = (XSpecRec *)im->private.proto.spec; @@ -126,10 +117,10 @@ _XimXFilterWaitEvent(d, w, ev, arg) } Private Bool -_CheckConnect(display, event, xim) - Display *display; - XEvent *event; - XPointer xim; +_CheckConnect( + Display *display, + XEvent *event, + XPointer xim) { Xim im = (Xim)xim; XSpecRec *spec = (XSpecRec *)im->private.proto.spec; @@ -142,12 +133,7 @@ _CheckConnect(display, event, xim) } Private Bool -#if NeedFunctionPrototypes _XimXConnect(Xim im) -#else -_XimXConnect(im) - Xim im; -#endif { XEvent event; XSpecRec *spec = (XSpecRec *)im->private.proto.spec; @@ -216,12 +202,7 @@ _XimXConnect(im) } Private Bool -#if NeedFunctionPrototypes _XimXShutdown(Xim im) -#else -_XimXShutdown(im) - Xim im; -#endif { XSpecRec *spec = (XSpecRec *)im->private.proto.spec; @@ -241,8 +222,8 @@ _XimXShutdown(im) } Private char * -_NewAtom(atomName) - char *atomName; +_NewAtom( + char *atomName) { static int sequence = 0; @@ -252,14 +233,7 @@ _NewAtom(atomName) } Private Bool -#if NeedFunctionPrototypes _XimXWrite(Xim im, INT16 len, XPointer data) -#else -_XimXWrite(im, len, data) - Xim im; - INT16 len; - XPointer data; -#endif { Atom atom; char atomName[16]; @@ -320,12 +294,12 @@ _XimXWrite(im, len, data) } Private Bool -_XimXGetReadData(im, buf, buf_len, ret_len, event) - Xim im; - char *buf; - int buf_len; - int *ret_len; - XEvent *event; +_XimXGetReadData( + Xim im, + char *buf, + int buf_len, + int *ret_len, + XEvent *event) { char *data; int len; @@ -434,10 +408,10 @@ _XimXGetReadData(im, buf, buf_len, ret_len, event) } Private Bool -_CheckCMEvent(display, event, xim) - Display *display; - XEvent *event; - XPointer xim; +_CheckCMEvent( + Display *display, + XEvent *event, + XPointer xim) { Xim im = (Xim)xim; XSpecRec *spec = (XSpecRec *)im->private.proto.spec; @@ -455,15 +429,7 @@ _CheckCMEvent(display, event, xim) } Private Bool -#if NeedFunctionPrototypes _XimXRead(Xim im, XPointer recv_buf, int buf_len, int *ret_len) -#else -_XimXRead(im, recv_buf, buf_len, ret_len) - Xim im; - XPointer recv_buf; - int buf_len; - int *ret_len; -#endif { XEvent *ev; XEvent event; @@ -486,12 +452,7 @@ _XimXRead(im, recv_buf, buf_len, ret_len) } Private void -#if NeedFunctionPrototypes _XimXFlush(Xim im) -#else -_XimXFlush(im) - Xim im; -#endif { XFlush(im->core.display); return; diff --git a/modules/im/ximcp/imTrans.c b/modules/im/ximcp/imTrans.c index 53ca201c..f1035d23 100644 --- a/modules/im/ximcp/imTrans.c +++ b/modules/im/ximcp/imTrans.c @@ -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/imTrans.c,v 1.4 2003/11/17 22:20:12 dawes Exp $ */ #include <stdio.h> #include <X11/Xatom.h> @@ -38,6 +39,7 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "Xlcint.h" #include "Ximint.h" #include "XimTrans.h" +#include "XimTrInt.h" #ifndef XIM_CONNECTION_RETRIES @@ -46,8 +48,8 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. Private Bool -_XimTransConnect(im) - Xim im; +_XimTransConnect( + Xim im) { TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; int connect_stat, retry; @@ -99,8 +101,8 @@ _XimTransConnect(im) Private Bool -_XimTransShutdown(im) - Xim im; +_XimTransShutdown( + Xim im) { TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; @@ -119,21 +121,12 @@ _XimTransShutdown(im) Public Bool -#if NeedFunctionPrototypes _XimTransRegisterDispatcher( Xim im, Bool (*callback)( -#if NeedNestedPrototypes Xim, INT16, XPointer, XPointer -#endif ), XPointer call_data) -#else -_XimTransRegisterDispatcher(im, callback, call_data) - Xim im; - Bool (*callback)(); - XPointer call_data; -#endif { TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; TransIntrCallbackPtr rec; @@ -150,8 +143,8 @@ _XimTransRegisterDispatcher(im, callback, call_data) Public void -_XimFreeTransIntrCallback(im) - Xim im; +_XimFreeTransIntrCallback( + Xim im) { TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; register TransIntrCallbackPtr rec, next; @@ -166,14 +159,7 @@ _XimFreeTransIntrCallback(im) Public Bool -#if NeedFunctionPrototypes _XimTransCallDispatcher(Xim im, INT16 len, XPointer data) -#else -_XimTransCallDispatcher(im, len, data) - Xim im; - INT16 len; - XPointer data; -#endif { TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; TransIntrCallbackRec *rec; @@ -187,11 +173,11 @@ _XimTransCallDispatcher(im, len, data) Public Bool -_XimTransFilterWaitEvent(d, w, ev, arg) - Display *d; - Window w; - XEvent *ev; - XPointer arg; +_XimTransFilterWaitEvent( + Display *d, + Window w, + XEvent *ev, + XPointer arg) { Xim im = (Xim)arg; TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; @@ -202,10 +188,10 @@ _XimTransFilterWaitEvent(d, w, ev, arg) Public void -_XimTransInternalConnection(d, fd, arg) - Display *d; - int fd; - XPointer arg; +_XimTransInternalConnection( + Display *d, + int fd, + XPointer arg) { Xim im = (Xim)arg; XEvent ev; @@ -228,14 +214,7 @@ _XimTransInternalConnection(d, fd, arg) Public Bool -#if NeedFunctionPrototypes _XimTransWrite(Xim im, INT16 len, XPointer data) -#else -_XimTransWrite(im, len, data) - Xim im; - INT16 len; - XPointer data; -#endif { TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; char *buf = (char *)data; @@ -252,11 +231,11 @@ _XimTransWrite(im, len, data) Public Bool -_XimTransRead(im, recv_buf, buf_len, ret_len) - Xim im; - XPointer recv_buf; - int buf_len; - int *ret_len; +_XimTransRead( + Xim im, + XPointer recv_buf, + int buf_len, + int *ret_len) { TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; int len; @@ -273,8 +252,8 @@ _XimTransRead(im, recv_buf, buf_len, ret_len) Public void -_XimTransFlush(im) - Xim im; +_XimTransFlush( + Xim im) { return; } @@ -282,9 +261,9 @@ _XimTransFlush(im) Public Bool -_XimTransConf(im, address) - Xim im; - char *address; +_XimTransConf( + Xim im, + char *address) { char *paddr; TransSpecRec *spec; diff --git a/modules/im/ximcp/imTransR.c b/modules/im/ximcp/imTransR.c index 016c5e47..f36f77e4 100644 --- a/modules/im/ximcp/imTransR.c +++ b/modules/im/ximcp/imTransR.c @@ -28,7 +28,7 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. fujiwara@a80.tech.yk.fujitsu.co.jp ******************************************************************/ -/* $XFree86: xc/lib/X11/imTransR.c,v 3.4 2001/01/17 19:41:52 dawes Exp $ */ +/* $XFree86: xc/lib/X11/imTransR.c,v 3.7 2003/11/17 22:20:12 dawes Exp $ */ #include "Xlibint.h" #include "Xlcint.h" @@ -50,7 +50,7 @@ Public TransportSW _XimTransportRec[] = { #ifdef STREAMSCONN { "streams", _XimTransConf }, /* use X transport lib */ #endif /* STREAMSCONN */ - { (char *)NULL, (Bool (*)())NULL }, + { (char *)NULL, (Bool (*)(Xim, char *))NULL }, }; Public Bool @@ -68,22 +68,15 @@ _XimShutdown(im) } Public Bool -#if NeedFunctionPrototypes _XimWrite(Xim im, INT16 len, XPointer data) -#else -_XimWrite(im, len, data) - Xim im; - INT16 len; - XPointer data; -#endif { return im->private.proto.write(im, len, data); } Private int -_CheckProtocolData(im, recv_buf) - Xim im; - char *recv_buf; +_CheckProtocolData( + Xim im, + char *recv_buf) { int data_len; @@ -92,11 +85,11 @@ _CheckProtocolData(im, recv_buf) } Private int -_XimReadData(im, len, buf, buf_size) - Xim im; - INT16 *len; - XPointer buf; - int buf_size; +_XimReadData( + Xim im, + INT16 *len, + XPointer buf, + int buf_size) { char *hold_buf; char *tmp; @@ -209,10 +202,10 @@ _XimReadData(im, len, buf, buf_size) } Private Bool -_XimCallDispatcher(im, len, data) - Xim im; - INT16 len; - XPointer data; +_XimCallDispatcher( + Xim im, + INT16 len, + XPointer data) { return im->private.proto.call_dispatcher(im, len, data); } @@ -224,9 +217,7 @@ _XimRead(im, len, buf, buf_size, predicate, arg) XPointer buf; int buf_size; Bool (*predicate)( -#if NeedNestedPrototypes Xim, INT16, XPointer, XPointer -#endif ); XPointer arg; { @@ -249,14 +240,12 @@ _XimRead(im, len, buf, buf_size, predicate, arg) } Public Bool -_XimRegisterDispatcher(im, callback, call_data) - Xim im; +_XimRegisterDispatcher( + Xim im, Bool (*callback)( -#if NeedNestedPrototypes Xim, INT16, XPointer, XPointer -#endif - ); - XPointer call_data; + ), + XPointer call_data) { return im->private.proto.register_dispatcher(im, callback, call_data); } |