Commit 1baa27d0 authored by Ulrich Sibiller's avatar Ulrich Sibiller

update files from modules dir of libX11 1.3.4

parent da3e7fd2
...@@ -5,14 +5,14 @@ Copyright 1994 by Sony Corporation ...@@ -5,14 +5,14 @@ Copyright 1994 by Sony Corporation
All Rights Reserved All Rights Reserved
Permission to use, copy, modify, and distribute this software and its Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted, documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital, FUJITSU supporting documentation, and that the names of Digital, FUJITSU
LIMITED and Sony Corporation not be used in advertising or publicity LIMITED and Sony Corporation not be used in advertising or publicity
pertaining to distribution of the software without specific, written pertaining to distribution of the software without specific, written
prior permission. prior permission.
DIGITAL, FUJITSU LIMITED AND SONY CORPORATION DISCLAIMS ALL WARRANTIES DIGITAL, FUJITSU LIMITED AND SONY CORPORATION DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
...@@ -29,7 +29,7 @@ PERFORMANCE OF THIS SOFTWARE. ...@@ -29,7 +29,7 @@ PERFORMANCE OF THIS SOFTWARE.
fujiwara@a80.tech.yk.fujitsu.co.jp fujiwara@a80.tech.yk.fujitsu.co.jp
Makoto Wakamatsu Sony Corporation Makoto Wakamatsu Sony Corporation
makoto@sm.sony.co.jp makoto@sm.sony.co.jp
***********************************************************************/ ***********************************************************************/
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
...@@ -68,11 +68,11 @@ extern int _Xmblen (); ...@@ -68,11 +68,11 @@ extern int _Xmblen ();
#define sz_ximStatusDone 0 #define sz_ximStatusDone 0
typedef enum { typedef enum {
XimCbSuccess, XimCbSuccess,
XimCbNoCallback, XimCbNoCallback,
XimCbError, XimCbError,
XimCbQueued, XimCbQueued,
XimCbBadContextID, XimCbBadContextID,
XimCbBadOpcode XimCbBadOpcode
} XimCbStatus; } XimCbStatus;
...@@ -111,7 +111,7 @@ Private XimCbStatus _XimPreeditStateNotifyCallback(Xim, Xic, char *, int); ...@@ -111,7 +111,7 @@ Private XimCbStatus _XimPreeditStateNotifyCallback(Xim, Xic, char *, int);
#endif #endif
/* NOTE: /* NOTE:
* the table below depends on the protocol number * the table below depends on the protocol number
* defined in the IM Protocol document. * defined in the IM Protocol document.
*/ */
static RConst XimCb callback_table[] = { static RConst XimCb callback_table[] = {
...@@ -149,11 +149,11 @@ _XimProcessPendingCallbacks(Xic ic) ...@@ -149,11 +149,11 @@ _XimProcessPendingCallbacks(Xic ic)
{ {
XimPendingCallback pcbq; XimPendingCallback pcbq;
while (((pcbq = ic->private.proto.pend_cb_que) != (XimPendingCallback)NULL) while (((pcbq = ic->private.proto.pend_cb_que) != (XimPendingCallback)NULL)
&& _XimIsReadyForProcess(ic)) { && _XimIsReadyForProcess(ic)) {
(void) (*callback_table[pcbq->major_opcode])(pcbq->im, (void) (*callback_table[pcbq->major_opcode])(pcbq->im,
pcbq->ic, pcbq->ic,
pcbq->proto, pcbq->proto,
pcbq->proto_len); pcbq->proto_len);
ic->private.proto.pend_cb_que = pcbq->next; ic->private.proto.pend_cb_que = pcbq->next;
Xfree(pcbq->proto); /* free memory of XimPendingCallback */ Xfree(pcbq->proto); /* free memory of XimPendingCallback */
...@@ -183,9 +183,9 @@ _XimPutCbIntoQueue(Xic ic, XimPendingCallback call_data) ...@@ -183,9 +183,9 @@ _XimPutCbIntoQueue(Xic ic, XimPendingCallback call_data)
} }
Public Bool Public Bool
_XimCbDispatch(Xim xim, _XimCbDispatch(Xim xim,
INT16 len, INT16 len,
XPointer data, XPointer data,
XPointer call_data) XPointer call_data)
{ {
/* `data' points to the beginning of the packet defined in IM Protocol doc. /* `data' points to the beginning of the packet defined in IM Protocol doc.
...@@ -260,16 +260,16 @@ _XimCbDispatch(Xim xim, ...@@ -260,16 +260,16 @@ _XimCbDispatch(Xim xim,
} }
Private XimCbStatus Private XimCbStatus
_XimGeometryCallback(Xim im, _XimGeometryCallback(Xim im,
Xic ic, Xic ic,
char* proto, char* proto,
int len) int len)
{ {
XICCallback* cb = &ic->core.geometry_callback; XICCallback* cb = &ic->core.geometry_callback;
/* invoke the callack /* invoke the callack
*/ */
if (cb && cb->callback) { if (cb && cb->callback) {
(*cb->callback)((XIC)ic, cb->client_data, (XPointer)NULL); (*cb->callback)((XIC)ic, cb->client_data, (XPointer)NULL);
} }
else { else {
...@@ -283,9 +283,9 @@ _XimGeometryCallback(Xim im, ...@@ -283,9 +283,9 @@ _XimGeometryCallback(Xim im,
} }
Private XimCbStatus Private XimCbStatus
_XimStrConversionCallback(Xim im, _XimStrConversionCallback(Xim im,
Xic ic, Xic ic,
char* proto, char* proto,
int len) int len)
{ {
XICCallback* cb = &ic->core.string_conversion_callback; /* check HM */ XICCallback* cb = &ic->core.string_conversion_callback; /* check HM */
...@@ -310,10 +310,10 @@ _XimStrConversionCallback(Xim im, ...@@ -310,10 +310,10 @@ _XimStrConversionCallback(Xim im,
/* no callback registered /* no callback registered
*/ */
_XimError(im, ic, _XimError(im, ic,
(CARD16)XIM_BadSomething, (CARD16)XIM_BadSomething,
(INT16)len, (INT16)len,
(CARD16)XIM_STR_CONVERSION, (CARD16)XIM_STR_CONVERSION,
(char*)proto); /* send XIM_ERROR */ (char*)proto); /* send XIM_ERROR */
return XimCbNoCallback; return XimCbNoCallback;
} }
...@@ -332,9 +332,9 @@ _XimStrConversionCallback(Xim im, ...@@ -332,9 +332,9 @@ _XimStrConversionCallback(Xim im,
length_in_bytes = (cbrec.text->encoding_is_wchar)? length_in_bytes = (cbrec.text->encoding_is_wchar)?
sizeof(wchar_t) * cbrec.text->length: /* wchar */ sizeof(wchar_t) * cbrec.text->length: /* wchar */
strlen(cbrec.text->string.mbs); /* mb */ strlen(cbrec.text->string.mbs); /* mb */
buf_len = XIM_HEADER_SIZE + buf_len = XIM_HEADER_SIZE +
sz_CARD16 + sz_CARD16 +
2 + length_in_bytes + 2 + length_in_bytes +
XIM_PAD(2 + length_in_bytes) + XIM_PAD(2 + length_in_bytes) +
2 + 2 + sz_CARD32 * cbrec.text->length; 2 + 2 + sz_CARD32 * cbrec.text->length;
buf = (CARD8*)Xmalloc(buf_len); buf = (CARD8*)Xmalloc(buf_len);
...@@ -366,9 +366,9 @@ _XimStrConversionCallback(Xim im, ...@@ -366,9 +366,9 @@ _XimStrConversionCallback(Xim im,
} }
Private XimCbStatus Private XimCbStatus
_XimPreeditStartCallback(Xim im, _XimPreeditStartCallback(Xim im,
Xic ic, Xic ic,
char* proto, char* proto,
int len) int len)
{ {
XICCallback* cb = &ic->core.preedit_attr.start_callback; XICCallback* cb = &ic->core.preedit_attr.start_callback;
...@@ -381,12 +381,12 @@ _XimPreeditStartCallback(Xim im, ...@@ -381,12 +381,12 @@ _XimPreeditStartCallback(Xim im,
} }
else { else {
/* no callback registered /* no callback registered
*/ */
_XimError(im, ic, _XimError(im, ic,
(CARD16)XIM_BadSomething, (CARD16)XIM_BadSomething,
(INT16)len, (INT16)len,
(CARD16)XIM_PREEDIT_START, (CARD16)XIM_PREEDIT_START,
(char*)proto); /* send XIM_ERROR */ (char*)proto); /* send XIM_ERROR */
return XimCbNoCallback; return XimCbNoCallback;
} }
...@@ -415,9 +415,9 @@ _XimPreeditStartCallback(Xim im, ...@@ -415,9 +415,9 @@ _XimPreeditStartCallback(Xim im,
} }
Private XimCbStatus Private XimCbStatus
_XimPreeditDoneCallback(Xim im, _XimPreeditDoneCallback(Xim im,
Xic ic, Xic ic,
char* proto, char* proto,
int len) int len)
{ {
XICCallback* cb = &ic->core.preedit_attr.done_callback; XICCallback* cb = &ic->core.preedit_attr.done_callback;
...@@ -438,8 +438,8 @@ _XimPreeditDoneCallback(Xim im, ...@@ -438,8 +438,8 @@ _XimPreeditDoneCallback(Xim im,
} }
Private void Private void
_read_text_from_packet(Xim im, _read_text_from_packet(Xim im,
char* buf, char* buf,
XIMText** text_ptr) XIMText** text_ptr)
{ {
int status; int status;
...@@ -469,8 +469,8 @@ _read_text_from_packet(Xim im, ...@@ -469,8 +469,8 @@ _read_text_from_packet(Xim im,
tmp_buf[tmp_len] = '\0'; tmp_buf[tmp_len] = '\0';
text->encoding_is_wchar = False; text->encoding_is_wchar = False;
text->length = im->methods->ctstombs((XIM)im, text->length = im->methods->ctstombs((XIM)im,
tmp_buf, tmp_len, tmp_buf, tmp_len,
NULL, 0, &s); /* CT? HM */ NULL, 0, &s); /* CT? HM */
if (s != XLookupNone) { if (s != XLookupNone) {
#ifndef NO_DEC_I18N_FIX #ifndef NO_DEC_I18N_FIX
...@@ -487,12 +487,12 @@ _read_text_from_packet(Xim im, ...@@ -487,12 +487,12 @@ _read_text_from_packet(Xim im,
int char_len; int char_len;
#endif #endif
tmp = im->methods->ctstombs((XIM)im, tmp = im->methods->ctstombs((XIM)im,
tmp_buf, tmp_len, tmp_buf, tmp_len,
#ifndef NO_DEC_I18N_FIX #ifndef NO_DEC_I18N_FIX
text->string.multi_byte, text->string.multi_byte,
text->length * XLC_PUBLIC(im->core.lcd,mb_cur_max) + 1, text->length * XLC_PUBLIC(im->core.lcd,mb_cur_max) + 1,
#else #else
text->string.multi_byte, text->length, text->string.multi_byte, text->length,
#endif #endif
&s); &s);
text->string.multi_byte[tmp] = '\0'; text->string.multi_byte[tmp] = '\0';
...@@ -536,7 +536,7 @@ _read_text_from_packet(Xim im, ...@@ -536,7 +536,7 @@ _read_text_from_packet(Xim im,
i -= sz_CARD32; i -= sz_CARD32;
j++; j++;
} }
/* /*
* text->length tells how long both the status string and * text->length tells how long both the status string and
* the feedback array are. If there's "no string" the * the feedback array are. If there's "no string" the
* text->length was set to zero previously. See above. * text->length was set to zero previously. See above.
...@@ -565,9 +565,9 @@ _free_memory_for_text(XIMText* text) ...@@ -565,9 +565,9 @@ _free_memory_for_text(XIMText* text)
} }
Private XimCbStatus Private XimCbStatus
_XimPreeditDrawCallback(Xim im, _XimPreeditDrawCallback(Xim im,
Xic ic, Xic ic,
char* proto, char* proto,
int len) int len)
{ {
XICCallback* cb = &ic->core.preedit_attr.draw_callback; XICCallback* cb = &ic->core.preedit_attr.draw_callback;
...@@ -596,8 +596,8 @@ _XimPreeditDrawCallback(Xim im, ...@@ -596,8 +596,8 @@ _XimPreeditDrawCallback(Xim im,
} }
Private XimCbStatus Private XimCbStatus
_XimPreeditCaretCallback(Xim im, _XimPreeditCaretCallback(Xim im,
Xic ic, Xic ic,
char* proto, char* proto,
int len) int len)
{ {
...@@ -615,12 +615,12 @@ _XimPreeditCaretCallback(Xim im, ...@@ -615,12 +615,12 @@ _XimPreeditCaretCallback(Xim im,
} }
else { else {
/* no callback registered /* no callback registered
*/ */
_XimError(im, ic, _XimError(im, ic,
(CARD16)XIM_BadSomething, (CARD16)XIM_BadSomething,
(INT16)len, (INT16)len,
(CARD16)XIM_PREEDIT_CARET, (CARD16)XIM_PREEDIT_CARET,
(char*)proto); /* send XIM_ERROR */ (char*)proto); /* send XIM_ERROR */
return XimCbNoCallback; return XimCbNoCallback;
} }
...@@ -648,9 +648,9 @@ _XimPreeditCaretCallback(Xim im, ...@@ -648,9 +648,9 @@ _XimPreeditCaretCallback(Xim im,
} }
Private XimCbStatus Private XimCbStatus
_XimStatusStartCallback(Xim im, _XimStatusStartCallback(Xim im,
Xic ic, Xic ic,
char* proto, char* proto,
int len) int len)
{ {
XICCallback* cb = &ic->core.status_attr.start_callback; XICCallback* cb = &ic->core.status_attr.start_callback;
...@@ -671,9 +671,9 @@ _XimStatusStartCallback(Xim im, ...@@ -671,9 +671,9 @@ _XimStatusStartCallback(Xim im,
} }
Private XimCbStatus Private XimCbStatus
_XimStatusDoneCallback(Xim im, _XimStatusDoneCallback(Xim im,
Xic ic, Xic ic,
char* proto, char* proto,
int len) int len)
{ {
XICCallback* cb = &ic->core.status_attr.done_callback; XICCallback* cb = &ic->core.status_attr.done_callback;
...@@ -694,9 +694,9 @@ _XimStatusDoneCallback(Xim im, ...@@ -694,9 +694,9 @@ _XimStatusDoneCallback(Xim im,
} }
Private XimCbStatus Private XimCbStatus
_XimStatusDrawCallback(Xim im, _XimStatusDrawCallback(Xim im,
Xic ic, Xic ic,
char* proto, char* proto,
int len) int len)
{ {
XICCallback* cb = &ic->core.status_attr.draw_callback; XICCallback* cb = &ic->core.status_attr.draw_callback;
...@@ -735,7 +735,7 @@ _XimPreeditStateNotifyCallback( Xim im, Xic ic, char* proto, int len ) ...@@ -735,7 +735,7 @@ _XimPreeditStateNotifyCallback( Xim im, Xic ic, char* proto, int len )
/* invoke the callack /* invoke the callack
*/ */
if( cb && cb->callback ) { if( cb && cb->callback ) {
XIMPreeditStateNotifyCallbackStruct cbrec; XIMPreeditStateNotifyCallbackStruct cbrec;
cbrec.state = *(BITMASK32 *)proto; cbrec.state = *(BITMASK32 *)proto;
......
...@@ -10,7 +10,7 @@ in supporting documentation, and that the name of FUJITSU LIMITED ...@@ -10,7 +10,7 @@ in supporting documentation, and that the name of FUJITSU LIMITED
not be used in advertising or publicity pertaining to distribution not be used in advertising or publicity pertaining to distribution
of the software without specific, written prior permission. of the software without specific, written prior permission.
FUJITSU LIMITED makes no representations about the suitability of FUJITSU LIMITED makes no representations about the suitability of
this software for any purpose. this software for any purpose.
It is provided "as is" without express or implied warranty. It is provided "as is" without express or implied warranty.
FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
...@@ -21,7 +21,7 @@ USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR ...@@ -21,7 +21,7 @@ USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
Author: Takashi Fujiwara FUJITSU LIMITED Author: Takashi Fujiwara FUJITSU LIMITED
fujiwara@a80.tech.yk.fujitsu.co.jp fujiwara@a80.tech.yk.fujitsu.co.jp
******************************************************************/ ******************************************************************/
...@@ -261,7 +261,7 @@ _XimFilterKeyrelease( ...@@ -261,7 +261,7 @@ _XimFilterKeyrelease(
return _XimProtoKeyreleaseFilter((Xic)client_data, (XKeyEvent *)ev); return _XimProtoKeyreleaseFilter((Xic)client_data, (XKeyEvent *)ev);
} }
Private void Private void
_XimRegisterKeyPressFilter( _XimRegisterKeyPressFilter(
Xic ic) Xic ic)
{ {
...@@ -278,7 +278,7 @@ _XimRegisterKeyPressFilter( ...@@ -278,7 +278,7 @@ _XimRegisterKeyPressFilter(
return; return;
} }
Private void Private void
_XimRegisterKeyReleaseFilter( _XimRegisterKeyReleaseFilter(
Xic ic) Xic ic)
{ {
...@@ -295,7 +295,7 @@ _XimRegisterKeyReleaseFilter( ...@@ -295,7 +295,7 @@ _XimRegisterKeyReleaseFilter(
return; return;
} }
Private void Private void
_XimUnregisterKeyPressFilter( _XimUnregisterKeyPressFilter(
Xic ic) Xic ic)
{ {
...@@ -311,7 +311,7 @@ _XimUnregisterKeyPressFilter( ...@@ -311,7 +311,7 @@ _XimUnregisterKeyPressFilter(
return; return;
} }
Private void Private void
_XimUnregisterKeyReleaseFilter( _XimUnregisterKeyReleaseFilter(
Xic ic) Xic ic)
{ {
...@@ -380,7 +380,7 @@ _XimFilterServerDestroy( ...@@ -380,7 +380,7 @@ _XimFilterServerDestroy(
return True; return True;
} }
Public void Public void
_XimRegisterServerFilter( _XimRegisterServerFilter(
Xim im) Xim im)
{ {
...@@ -399,7 +399,7 @@ _XimRegisterServerFilter( ...@@ -399,7 +399,7 @@ _XimRegisterServerFilter(
return; return;
} }
Public void Public void
_XimUnregisterServerFilter( _XimUnregisterServerFilter(
Xim im) Xim im)
{ {
......
/*
* Copyright 1991, 1992 Sun Microsystems, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
/****************************************************************** /******************************************************************
Copyright 1991, 1992 by Sun Microsystems, Inc.
Copyright 1992, 1993, 1994 by FUJITSU LIMITED Copyright 1992, 1993, 1994 by FUJITSU LIMITED
Permission to use, copy, modify, distribute, and sell this software Permission to use, copy, modify, distribute, and sell this software
and its documentation for any purpose is hereby granted without fee, and its documentation for any purpose is hereby granted without fee,
provided that the above copyright notice appear in all copies and provided that the above copyright notice appear in all copies and
that both that copyright notice and this permission notice appear that both that copyright notice and this permission notice appear
in supporting documentation, and that the name of Sun Microsystems, Inc. in supporting documentation, and that the name of FUJITSU LIMITED
and FUJITSU LIMITED not be used in advertising or publicity pertaining to not be used in advertising or publicity pertaining to distribution
distribution of the software without specific, written prior permission. of the software without specific, written prior permission.
Sun Microsystems, Inc. and FUJITSU LIMITED makes no representations about FUJITSU LIMITED makes no representations about the suitability of
the suitability of this software for any purpose. this software for any purpose.
It is provided "as is" without express or implied warranty. It is provided "as is" without express or implied warranty.
Sun Microsystems Inc. AND FUJITSU LIMITED DISCLAIMS ALL WARRANTIES WITH FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
AND FITNESS, IN NO EVENT SHALL Sun Microsystems, Inc. AND FUJITSU LIMITED EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc.
Takashi Fujiwara FUJITSU LIMITED Takashi Fujiwara FUJITSU LIMITED
fujiwara@a80.tech.yk.fujitsu.co.jp fujiwara@a80.tech.yk.fujitsu.co.jp
******************************************************************/ ******************************************************************/
...@@ -916,7 +937,7 @@ _XimProtoSetFocus( ...@@ -916,7 +937,7 @@ _XimProtoSetFocus(
CARD8 *buf = (CARD8 *)buf32; CARD8 *buf = (CARD8 *)buf32;
CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE];
INT16 len; INT16 len;
#ifndef XIM_CONNECTABLE #ifndef XIM_CONNECTABLE
if (!IS_IC_CONNECTED(ic)) if (!IS_IC_CONNECTED(ic))
return; return;
...@@ -947,6 +968,8 @@ _XimProtoSetFocus( ...@@ -947,6 +968,8 @@ _XimProtoSetFocus(
(void)_XimWrite(im, len, (XPointer)buf); (void)_XimWrite(im, len, (XPointer)buf);
_XimFlush(im); _XimFlush(im);
MARK_FOCUSED(ic);
_XimRegisterFilter(ic); _XimRegisterFilter(ic);
return; return;
} }
...@@ -992,6 +1015,8 @@ _XimProtoUnsetFocus( ...@@ -992,6 +1015,8 @@ _XimProtoUnsetFocus(
(void)_XimWrite(im, len, (XPointer)buf); (void)_XimWrite(im, len, (XPointer)buf);
_XimFlush(im); _XimFlush(im);
UNMARK_FOCUSED(ic);
_XimUnregisterFilter(ic); _XimUnregisterFilter(ic);
return; return;
} }
...@@ -1311,7 +1336,7 @@ _XimDelayModeCreateIC( ...@@ -1311,7 +1336,7 @@ _XimDelayModeCreateIC(
XimDefICValues ic_values; XimDefICValues ic_values;
int len; int len;
XIMStyle input_style; XIMStyle input_style;
bzero((char *)&ic_values, sizeof(XimDefICValues)); bzero((char *)&ic_values, sizeof(XimDefICValues));
_XimGetCurrentICValues(ic, &ic_values); _XimGetCurrentICValues(ic, &ic_values);
if (!(_XimGetInputStyle(values, &input_style))) if (!(_XimGetInputStyle(values, &input_style)))
......
/*
* Copyright 1990, 1991, 1992 Sun Microsystems, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
/****************************************************************** /******************************************************************
Copyright 1990, 1991, 1992 by Sun Microsystems, Inc.
Copyright 1992, 1993, 1994 by FUJITSU LIMITED Copyright 1992, 1993, 1994 by FUJITSU LIMITED
Copyright 1993, 1994 by Sony Corporation Copyright 1993, 1994 by Sony Corporation
Permission to use, copy, modify, distribute, and sell this software and its Permission to use, copy, modify, and distribute this software and its
documentation for any purpose is hereby granted without fee, provided that documentation for any purpose and without fee is hereby granted,
the above copyright notice appear in all copies and that both that copyright provided that the above copyright notice appear in all copies and that
notice and this permission notice appear in supporting documentation, and both that copyright notice and this permission notice appear in
that the name of Sun Microsystems, Inc., FUJITSU LIMITED and Sony supporting documentation, and that the names of Digital, FUJITSU
Corporation not be used in advertising or publicity pertaining to LIMITED and Sony Corporation not be used in advertising or publicity
distribution of the software without specific, written prior permission. pertaining to distribution of the software without specific, written
Sun Microsystems, Inc., FUJITSU LIMITED and Sony Corporation makes no prior permission.
representations about the suitability of this software for any purpose. It
is provided "as is" without express or implied warranty. DIGITAL, FUJITSU LIMITED AND SONY CORPORATION DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
Sun Microsystems Inc., FUJITSU LIMITED AND SONY CORPORATION DISCLAIMS ALL MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL, FUJITSU LIMITED
WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF AND SONY CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR
MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL Sun Microsystems, Inc., CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
FUJITSU LIMITED AND SONY CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER PERFORMANCE OF THIS SOFTWARE.
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
OF THIS SOFTWARE.
Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc.
Takashi Fujiwara FUJITSU LIMITED Takashi Fujiwara FUJITSU LIMITED
fujiwara@a80.tech.yk.fujitsu.co.jp fujiwara@a80.tech.yk.fujitsu.co.jp
Makoto Wakamatsu Sony Corporation Makoto Wakamatsu Sony Corporation
makoto@sm.sony.co.jp makoto@sm.sony.co.jp
...@@ -73,7 +93,7 @@ _XimSetHeader( ...@@ -73,7 +93,7 @@ _XimSetHeader(
return; return;
} }
Private char Public char
_XimGetMyEndian(void) _XimGetMyEndian(void)
{ {
CARD16 test_card = 1; CARD16 test_card = 1;
...@@ -106,7 +126,7 @@ _XimCheckServerName( ...@@ -106,7 +126,7 @@ _XimCheckServerName(
if(strncmp(str, XIM_SERVER_CATEGORY, category_len)) if(strncmp(str, XIM_SERVER_CATEGORY, category_len))
return False; return False;
pp = &str[category_len]; pp = &str[category_len];
for(;;) { for(;;) {
...@@ -142,7 +162,7 @@ _XimCheckLocaleName( ...@@ -142,7 +162,7 @@ _XimCheckLocaleName(
if(strncmp(address, XIM_LOCAL_CATEGORY, category_len)) if(strncmp(address, XIM_LOCAL_CATEGORY, category_len))
return (char*)NULL; return (char*)NULL;
pp = &address[category_len]; pp = &address[category_len];
for(;;) { for(;;) {
...@@ -166,7 +186,7 @@ Private Bool ...@@ -166,7 +186,7 @@ Private Bool
_XimCheckTransport( _XimCheckTransport(
char *address, char *address,
int address_len, int address_len,
char *transport, const char *transport,
int len, int len,
char **trans_addr) char **trans_addr)
{ {
...@@ -179,7 +199,7 @@ _XimCheckTransport( ...@@ -179,7 +199,7 @@ _XimCheckTransport(
if(strncmp(address, XIM_TRANSPORT_CATEGORY, category_len)) if(strncmp(address, XIM_TRANSPORT_CATEGORY, category_len))
return False; return False;
pp = &address[category_len]; pp = &address[category_len];
for(;;) { for(;;) {
...@@ -254,7 +274,7 @@ _XimPreConnectionIM( ...@@ -254,7 +274,7 @@ _XimPreConnectionIM(
Xim im, Xim im,
Atom selection) Atom selection)
{ {
Display *display = im->core.display; Display *display = im->core.display;
Atom locales, transport; Atom locales, transport;
char *address; char *address;
XLCd lcd; XLCd lcd;
...@@ -364,14 +384,14 @@ Error: ...@@ -364,14 +384,14 @@ Error:
if( locale_name[i] != NULL ) if( locale_name[i] != NULL )
XFree( locale_name[i] ); XFree( locale_name[i] );
XDestroyWindow(display, window); XDestroyWindow(display, window);
return False; return False;
} }
Private Bool Private Bool
_XimPreConnect( _XimPreConnect(
Xim im) Xim im)
{ {
Display *display = im->core.display; Display *display = im->core.display;
Atom imserver; Atom imserver;
Atom actual_type; Atom actual_type;
int actual_format; int actual_format;
...@@ -386,7 +406,7 @@ _XimPreConnect( ...@@ -386,7 +406,7 @@ _XimPreConnect(
return False; return False;
if(XGetWindowProperty(display, RootWindow(display, 0), if(XGetWindowProperty(display, RootWindow(display, 0),
imserver, 0L, 1000000L, False, XA_ATOM, &actual_type, imserver, 0L, 1000000L, False, XA_ATOM, &actual_type,
&actual_format, &nitems, &bytes_after, &actual_format, &nitems, &bytes_after,
&prop_return) != Success) &prop_return) != Success)
return False; return False;
...@@ -681,7 +701,7 @@ _XimConnection( ...@@ -681,7 +701,7 @@ _XimConnection(
} }
} }
if (!( buf_s[0] == im->private.proto.protocol_major_version if (!( buf_s[0] == im->private.proto.protocol_major_version
&& buf_s[1] == im->private.proto.protocol_minor_version)) { && buf_s[1] == im->private.proto.protocol_minor_version)) {
if(reply != preply) if(reply != preply)
Xfree(preply); Xfree(preply);
...@@ -915,7 +935,7 @@ _XimClose( ...@@ -915,7 +935,7 @@ _XimClose(
buf_s[1] = 0; /* unused */ buf_s[1] = 0; /* unused */
len = sizeof(CARD16) /* sizeof imid */ len = sizeof(CARD16) /* sizeof imid */
+ sizeof(CARD16); /* sizeof unused */ + sizeof(CARD16); /* sizeof unused */
_XimSetHeader((XPointer)buf, XIM_CLOSE, 0, &len); _XimSetHeader((XPointer)buf, XIM_CLOSE, 0, &len);
if (!(_XimWrite(im, len, (XPointer)buf))) if (!(_XimWrite(im, len, (XPointer)buf)))
return False; return False;
......
...@@ -10,7 +10,7 @@ in supporting documentation, and that the name of FUJITSU LIMITED ...@@ -10,7 +10,7 @@ in supporting documentation, and that the name of FUJITSU LIMITED
not be used in advertising or publicity pertaining to distribution not be used in advertising or publicity pertaining to distribution
of the software without specific, written prior permission. of the software without specific, written prior permission.
FUJITSU LIMITED makes no representations about the suitability of FUJITSU LIMITED makes no representations about the suitability of
this software for any purpose. this software for any purpose.
It is provided "as is" without express or implied warranty. It is provided "as is" without express or implied warranty.
FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
...@@ -21,7 +21,7 @@ USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR ...@@ -21,7 +21,7 @@ USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
Author: Takashi Fujiwara FUJITSU LIMITED Author: Takashi Fujiwara FUJITSU LIMITED
fujiwara@a80.tech.yk.fujitsu.co.jp fujiwara@a80.tech.yk.fujitsu.co.jp
******************************************************************/ ******************************************************************/
...@@ -213,8 +213,13 @@ _XimRespSyncReply( ...@@ -213,8 +213,13 @@ _XimRespSyncReply(
Xic ic, Xic ic,
BITMASK16 mode) BITMASK16 mode)
{ {
if (mode & XimSYNCHRONUS) /* SYNC Request */ if (mode & XimSYNCHRONUS) /* SYNC Request */ {
MARK_NEED_SYNC_REPLY(ic); if (IS_FOCUSED(ic))
MARK_NEED_SYNC_REPLY(ic);
else
_XimProcSyncReply((Xim)ic->core.im, ic);
}
return True; return True;
} }
...@@ -463,7 +468,7 @@ _XimGetWindowEventmask( ...@@ -463,7 +468,7 @@ _XimGetWindowEventmask(
Xim im = (Xim )ic->core.im; Xim im = (Xim )ic->core.im;
XWindowAttributes atr; XWindowAttributes atr;
if (!_XGetWindowAttributes(im->core.display, ic->core.focus_window, &atr)) if (!XGetWindowAttributes(im->core.display, ic->core.focus_window, &atr))
return 0; return 0;
return (EVENTMASK)atr.your_event_mask; return (EVENTMASK)atr.your_event_mask;
} }
...@@ -885,13 +890,8 @@ _Ximctsconvert( ...@@ -885,13 +890,8 @@ _Ximctsconvert(
} }
Public int Public int
_Ximctstombs(xim, from, from_len, to, to_len, state) _Ximctstombs(XIM xim, char *from, int from_len,
XIM xim; char *to, int to_len, Status *state)
char *from;
int from_len;
char *to;
int to_len;
Status *state;
{ {
return _Ximctsconvert(((Xim)xim)->private.proto.ctom_conv, return _Ximctsconvert(((Xim)xim)->private.proto.ctom_conv,
from, from_len, to, to_len, state); from, from_len, to, to_len, state);
...@@ -930,7 +930,7 @@ _Ximctstowcs( ...@@ -930,7 +930,7 @@ _Ximctstowcs(
/* Reset the converter. The CompoundText at 'from' starts in /* Reset the converter. The CompoundText at 'from' starts in
initial state. */ initial state. */
_XlcResetConverter(conv); _XlcResetConverter(conv);
from_left = from_len; from_left = from_len;
to_left = BUFSIZ; to_left = BUFSIZ;
from_cnvlen = 0; from_cnvlen = 0;
......
...@@ -10,7 +10,7 @@ in supporting documentation, and that the name of FUJITSU LIMITED ...@@ -10,7 +10,7 @@ in supporting documentation, and that the name of FUJITSU LIMITED
not be used in advertising or publicity pertaining to distribution not be used in advertising or publicity pertaining to distribution
of the software without specific, written prior permission. of the software without specific, written prior permission.
FUJITSU LIMITED makes no representations about the suitability of FUJITSU LIMITED makes no representations about the suitability of
this software for any purpose. this software for any purpose.
It is provided "as is" without express or implied warranty. It is provided "as is" without express or implied warranty.
FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
...@@ -21,7 +21,7 @@ USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR ...@@ -21,7 +21,7 @@ USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
Author: Takashi Fujiwara FUJITSU LIMITED Author: Takashi Fujiwara FUJITSU LIMITED
fujiwara@a80.tech.yk.fujitsu.co.jp fujiwara@a80.tech.yk.fujitsu.co.jp
******************************************************************/ ******************************************************************/
...@@ -61,8 +61,7 @@ _XimRegProtoIntrCallback( ...@@ -61,8 +61,7 @@ _XimRegProtoIntrCallback(
} }
Public void Public void
_XimFreeProtoIntrCallback(im) _XimFreeProtoIntrCallback(Xim im)
Xim im;
{ {
register XimProtoIntrRec *rec, *next; register XimProtoIntrRec *rec, *next;
...@@ -97,8 +96,7 @@ _XimTransportIntr( ...@@ -97,8 +96,7 @@ _XimTransportIntr(
} }
Public Bool Public Bool
_XimDispatchInit(im) _XimDispatchInit(Xim im)
Xim im;
{ {
if (_XimRegisterDispatcher(im, _XimTransportIntr, (XPointer)im)) if (_XimRegisterDispatcher(im, _XimTransportIntr, (XPointer)im))
return True; return True;
......
...@@ -3,13 +3,13 @@ Copyright 1993 by Digital Equipment Corporation, Maynard, Massachusetts, ...@@ -3,13 +3,13 @@ Copyright 1993 by Digital Equipment Corporation, Maynard, Massachusetts,
All Rights Reserved All Rights Reserved
Permission to use, copy, modify, and distribute this software and its Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted, documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission. software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
...@@ -55,14 +55,14 @@ _XimProtoEventToWire( ...@@ -55,14 +55,14 @@ _XimProtoEventToWire(
event->u.keyButtonPointer.root = sw32(ev->root, sw); event->u.keyButtonPointer.root = sw32(ev->root, sw);
event->u.keyButtonPointer.event = event->u.keyButtonPointer.event =
sw32(ev->window, sw); sw32(ev->window, sw);
event->u.keyButtonPointer.child = event->u.keyButtonPointer.child =
sw32(ev->subwindow, sw); sw32(ev->subwindow, sw);
event->u.keyButtonPointer.time = sw32(ev->time, sw); event->u.keyButtonPointer.time = sw32(ev->time, sw);
event->u.keyButtonPointer.eventX = sw16(ev->x, sw) ; event->u.keyButtonPointer.eventX = sw16(ev->x, sw) ;
event->u.keyButtonPointer.eventY = sw16(ev->y, sw) ; event->u.keyButtonPointer.eventY = sw16(ev->y, sw) ;
event->u.keyButtonPointer.rootX = event->u.keyButtonPointer.rootX =
sw16(ev->x_root, sw); sw16(ev->x_root, sw);
event->u.keyButtonPointer.rootY = event->u.keyButtonPointer.rootY =
sw16(ev->y_root, sw); sw16(ev->y_root, sw);
event->u.keyButtonPointer.state = sw16(ev->state, sw); event->u.keyButtonPointer.state = sw16(ev->state, sw);
event->u.keyButtonPointer.sameScreen = ev->same_screen; event->u.keyButtonPointer.sameScreen = ev->same_screen;
...@@ -139,7 +139,7 @@ _XimProtoEventToWire( ...@@ -139,7 +139,7 @@ _XimProtoEventToWire(
{ {
register XKeymapEvent *ev = (XKeymapEvent *) re; register XKeymapEvent *ev = (XKeymapEvent *) re;
memcpy((char *)(((xKeymapEvent *) event)->map), memcpy((char *)(((xKeymapEvent *) event)->map),
&ev->key_vector[1], &ev->key_vector[1],
sizeof (((xKeymapEvent *) event)->map)); sizeof (((xKeymapEvent *) event)->map));
} }
break; break;
...@@ -356,12 +356,12 @@ _XimProtoEventToWire( ...@@ -356,12 +356,12 @@ _XimProtoEventToWire(
case ClientMessage: case ClientMessage:
{ {
register int i; register int i;
register XClientMessageEvent *ev register XClientMessageEvent *ev
= (XClientMessageEvent *) re; = (XClientMessageEvent *) re;
event->u.clientMessage.window = sw32(ev->window, sw); event->u.clientMessage.window = sw32(ev->window, sw);
event->u.u.detail = ev->format; event->u.u.detail = ev->format;
switch (ev->format) { switch (ev->format) {
case 8: case 8:
event->u.clientMessage.u.b.type = sw32(ev->message_type, sw); event->u.clientMessage.u.b.type = sw32(ev->message_type, sw);
for (i = 0; i < 20; i++) for (i = 0; i < 20; i++)
event->u.clientMessage.u.b.bytes[i] = ev->data.b[i]; event->u.clientMessage.u.b.bytes[i] = ev->data.b[i];
...@@ -401,7 +401,7 @@ _XimProtoEventToWire( ...@@ -401,7 +401,7 @@ _XimProtoEventToWire(
event->u.mappingNotify.count = ev->count; event->u.mappingNotify.count = ev->count;
} }
break; break;
default: default:
return(0); return(0);
} }
...@@ -429,7 +429,7 @@ _XimProtoWireToEvent( ...@@ -429,7 +429,7 @@ _XimProtoWireToEvent(
((XAnyEvent *)re)->serial = sw16(event->u.u.sequenceNumber, sw); ((XAnyEvent *)re)->serial = sw16(event->u.u.sequenceNumber, sw);
((XAnyEvent *)re)->send_event = ((event->u.u.type & 0x80) != 0); ((XAnyEvent *)re)->send_event = ((event->u.u.type & 0x80) != 0);
((XAnyEvent *)re)->display = NULL; ((XAnyEvent *)re)->display = NULL;
/* Ignore the leading bit of the event type since it is set when a /* Ignore the leading bit of the event type since it is set when a
client sends an event rather than the server. */ client sends an event rather than the server. */
...@@ -498,7 +498,7 @@ _XimProtoWireToEvent( ...@@ -498,7 +498,7 @@ _XimProtoWireToEvent(
ev->y_root = cvtINT16toInt(sw16(event->u.enterLeave.rootY, sw)); ev->y_root = cvtINT16toInt(sw16(event->u.enterLeave.rootY, sw));
ev->state = sw16(event->u.enterLeave.state, sw); ev->state = sw16(event->u.enterLeave.state, sw);
ev->mode = event->u.enterLeave.mode; ev->mode = event->u.enterLeave.mode;
ev->same_screen = (event->u.enterLeave.flags & ev->same_screen = (event->u.enterLeave.flags &
ELFlagSameScreen) && True; ELFlagSameScreen) && True;
ev->focus = (event->u.enterLeave.flags & ev->focus = (event->u.enterLeave.flags &
ELFlagFocus) && True; ELFlagFocus) && True;
...@@ -518,7 +518,7 @@ _XimProtoWireToEvent( ...@@ -518,7 +518,7 @@ _XimProtoWireToEvent(
{ {
register XKeymapEvent *ev = (XKeymapEvent *) re; register XKeymapEvent *ev = (XKeymapEvent *) re;
ev->window = None; ev->window = None;
memcpy(&ev->key_vector[1], memcpy(&ev->key_vector[1],
(char *)((xKeymapEvent *) event)->map, (char *)((xKeymapEvent *) event)->map,
sizeof (((xKeymapEvent *) event)->map)); sizeof (((xKeymapEvent *) event)->map));
} }
...@@ -736,14 +736,14 @@ _XimProtoWireToEvent( ...@@ -736,14 +736,14 @@ _XimProtoWireToEvent(
case ClientMessage: case ClientMessage:
{ {
register int i; register int i;
register XClientMessageEvent *ev register XClientMessageEvent *ev
= (XClientMessageEvent *) re; = (XClientMessageEvent *) re;
ev->window = sw32(event->u.clientMessage.window, sw); ev->window = sw32(event->u.clientMessage.window, sw);
ev->format = event->u.u.detail; ev->format = event->u.u.detail;
switch (ev->format) { switch (ev->format) {
case 8: case 8:
ev->message_type = sw32(event->u.clientMessage.u.b.type, sw); ev->message_type = sw32(event->u.clientMessage.u.b.type, sw);
for (i = 0; i < 20; i++) for (i = 0; i < 20; i++)
ev->data.b[i] = event->u.clientMessage.u.b.bytes[i]; ev->data.b[i] = event->u.clientMessage.u.b.bytes[i];
break; break;
case 16: case 16:
......
...@@ -10,7 +10,7 @@ in supporting documentation, and that the name of FUJITSU LIMITED ...@@ -10,7 +10,7 @@ in supporting documentation, and that the name of FUJITSU LIMITED
not be used in advertising or publicity pertaining to distribution not be used in advertising or publicity pertaining to distribution
of the software without specific, written prior permission. of the software without specific, written prior permission.
FUJITSU LIMITED makes no representations about the suitability of FUJITSU LIMITED makes no representations about the suitability of
this software for any purpose. this software for any purpose.
It is provided "as is" without express or implied warranty. It is provided "as is" without express or implied warranty.
FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
...@@ -21,7 +21,7 @@ USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR ...@@ -21,7 +21,7 @@ USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
Author: Takashi Fujiwara FUJITSU LIMITED Author: Takashi Fujiwara FUJITSU LIMITED
fujiwara@a80.tech.yk.fujitsu.co.jp fujiwara@a80.tech.yk.fujitsu.co.jp
******************************************************************/ ******************************************************************/
...@@ -48,7 +48,7 @@ PERFORMANCE OF THIS SOFTWARE. ...@@ -48,7 +48,7 @@ PERFORMANCE OF THIS SOFTWARE.
typedef struct _XIM_QueryExtRec { typedef struct _XIM_QueryExtRec {
Bool is_support; Bool is_support;
char *name; const char *name;
int name_len; int name_len;
CARD16 major_opcode; CARD16 major_opcode;
CARD16 minor_opcode; CARD16 minor_opcode;
...@@ -57,7 +57,7 @@ typedef struct _XIM_QueryExtRec { ...@@ -57,7 +57,7 @@ typedef struct _XIM_QueryExtRec {
Private XIM_QueryExtRec extensions[] = { Private XIM_QueryExtRec extensions[] = {
{False, "XIM_EXT_SET_EVENT_MASK", 0, 0, 0, {False, "XIM_EXT_SET_EVENT_MASK", 0, 0, 0,
XIM_EXT_SET_EVENT_MASK_IDX}, XIM_EXT_SET_EVENT_MASK_IDX},
#ifdef EXT_FORWARD #ifdef EXT_FORWARD
{False, "XIM_EXT_FORWARD_KEYEVENT", 0, 0, 0, {False, "XIM_EXT_FORWARD_KEYEVENT", 0, 0, 0,
XIM_EXT_FORWARD_KEYEVENT_IDX}, XIM_EXT_FORWARD_KEYEVENT_IDX},
...@@ -222,7 +222,7 @@ _XimExtForwardKeyEvent( ...@@ -222,7 +222,7 @@ _XimExtForwardKeyEvent(
Xim im = (Xim) ic->core.im; Xim im = (Xim) ic->core.im;
CARD32 buf32[BUFSIZE/4]; CARD32 buf32[BUFSIZE/4];
CARD8 *buf = (CARD8 *)buf32; CARD8 *buf = (CARD8 *)buf32;
CARD8 *buf_b = &buf[XIM_HEADER_SIZE]; CARD8 *buf_b = &buf[XIM_HEADER_SIZE];
CARD16 *buf_s = (CARD16 *)buf_b; CARD16 *buf_s = (CARD16 *)buf_b;
CARD32 *buf_l = (CARD32 *)buf_b; CARD32 *buf_l = (CARD32 *)buf_b;
CARD32 reply32[BUFSIZE/4]; CARD32 reply32[BUFSIZE/4];
...@@ -382,7 +382,7 @@ _XimParseExtensionList( ...@@ -382,7 +382,7 @@ _XimParseExtensionList(
+ sizeof(CARD8) /* sizeof minor_opcode */ + sizeof(CARD8) /* sizeof minor_opcode */
+ sizeof(INT16) /* sizeof length */ + sizeof(INT16) /* sizeof length */
+ XIM_PAD(len); /* sizeof pad */ + XIM_PAD(len); /* sizeof pad */
buf += len; buf += len;
} }
return True; return True;
......
...@@ -15,17 +15,17 @@ makes no representations about the suitability of this software for ...@@ -15,17 +15,17 @@ makes no representations about the suitability of this software for
any purpose. It is provided "as is" without express or implied any purpose. It is provided "as is" without express or implied
warranty. warranty.
FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION DISCLAIM ALL FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION DISCLAIM ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR
ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE. THIS SOFTWARE.
Author: Takashi Fujiwara FUJITSU LIMITED Author: Takashi Fujiwara FUJITSU LIMITED
fujiwara@a80.tech.yk.fujitsu.co.jp fujiwara@a80.tech.yk.fujitsu.co.jp
Modifier: Franky Ling Digital Equipment Corporation Modifier: Franky Ling Digital Equipment Corporation
frankyling@hgrd01.enet.dec.com frankyling@hgrd01.enet.dec.com
......
...@@ -108,7 +108,7 @@ _XimFilterPropertyNotify( ...@@ -108,7 +108,7 @@ _XimFilterPropertyNotify(
} }
lock = True; lock = True;
for( ii = 0; ii < nitems; ii++ ) { for( ii = 0; ii < nitems; ii++, atoms ) {
if(XGetSelectionOwner (display, atoms[ii])) { if(XGetSelectionOwner (display, atoms[ii])) {
for( icb = callback_list; icb; icb = icb->next ) { for( icb = callback_list; icb; icb = icb->next ) {
if( !icb->call && !icb->destroy ) { if( !icb->call && !icb->destroy ) {
...@@ -268,8 +268,7 @@ _XimUnRegisterIMInstantiateCallback( ...@@ -268,8 +268,7 @@ _XimUnRegisterIMInstantiateCallback(
Public void Public void
_XimResetIMInstantiateCallback( xim ) _XimResetIMInstantiateCallback(Xim xim)
Xim xim;
{ {
char locale[XIM_MAXLCNAMELEN]; char locale[XIM_MAXLCNAMELEN];
XimInstCallback icb; XimInstCallback icb;
......
...@@ -10,7 +10,7 @@ in supporting documentation, and that the name of FUJITSU LIMITED ...@@ -10,7 +10,7 @@ in supporting documentation, and that the name of FUJITSU LIMITED
not be used in advertising or publicity pertaining to distribution not be used in advertising or publicity pertaining to distribution
of the software without specific, written prior permission. of the software without specific, written prior permission.
FUJITSU LIMITED makes no representations about the suitability of FUJITSU LIMITED makes no representations about the suitability of
this software for any purpose. this software for any purpose.
It is provided "as is" without express or implied warranty. It is provided "as is" without express or implied warranty.
FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
...@@ -21,7 +21,7 @@ USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR ...@@ -21,7 +21,7 @@ USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
Author: Takashi Fujiwara FUJITSU LIMITED Author: Takashi Fujiwara FUJITSU LIMITED
fujiwara@a80.tech.yk.fujitsu.co.jp fujiwara@a80.tech.yk.fujitsu.co.jp
******************************************************************/ ******************************************************************/
...@@ -61,7 +61,7 @@ _XimSetIMStructureList( ...@@ -61,7 +61,7 @@ _XimSetIMStructureList(
} }
} }
if(i >= _XimCurrentIMcount) { if(i >= _XimCurrentIMcount) {
if(!(xim = (Xim *)Xrealloc(_XimCurrentIMlist, if(!(xim = (Xim *)Xrealloc(_XimCurrentIMlist,
((i + 1) * sizeof(Xim))))) ((i + 1) * sizeof(Xim)))))
return False; return False;
_XimCurrentIMlist = xim; _XimCurrentIMlist = xim;
...@@ -73,8 +73,7 @@ _XimSetIMStructureList( ...@@ -73,8 +73,7 @@ _XimSetIMStructureList(
} }
Public void Public void
_XimDestroyIMStructureList(im) _XimDestroyIMStructureList(Xim im)
Xim im;
{ {
register int i; register int i;
...@@ -88,8 +87,7 @@ _XimDestroyIMStructureList(im) ...@@ -88,8 +87,7 @@ _XimDestroyIMStructureList(im)
} }
Public void Public void
_XimServerDestroy(im_2_destroy) _XimServerDestroy(Xim im_2_destroy)
Xim im_2_destroy;
{ {
register int i; register int i;
Xim im; Xim im;
...@@ -123,7 +121,7 @@ _XimServerDestroy(im_2_destroy) ...@@ -123,7 +121,7 @@ _XimServerDestroy(im_2_destroy)
#ifdef XIM_CONNECTABLE #ifdef XIM_CONNECTABLE
Public void Public void
_XimServerReconectableDestroy() _XimServerReconectableDestroy(void)
{ {
register int i; register int i;
Xim im; Xim im;
...@@ -149,13 +147,13 @@ _XimServerReconectableDestroy() ...@@ -149,13 +147,13 @@ _XimServerReconectableDestroy()
} }
#endif /* XIM_CONNECTABLE */ #endif /* XIM_CONNECTABLE */
Private char * Private const char *
_XimStrstr( _XimStrstr(
register char *src, register const char *src,
register char *dest) register const char *dest)
{ {
int len; int len;
len = strlen(dest); len = strlen(dest);
while((src = strchr(src, *dest))) { while((src = strchr(src, *dest))) {
if(!strncmp(src, dest, len)) if(!strncmp(src, dest, len))
...@@ -169,10 +167,10 @@ Private char * ...@@ -169,10 +167,10 @@ Private char *
_XimMakeImName( _XimMakeImName(
XLCd lcd) XLCd lcd)
{ {
char* begin = NULL; const char* begin = NULL;
char* end = NULL; const char* end = NULL;
char* ret = NULL; char* ret = NULL;
char* ximmodifier = XIMMODIFIER; const char* ximmodifier = XIMMODIFIER;
if(lcd->core->modifiers != NULL && *lcd->core->modifiers != '\0') { if(lcd->core->modifiers != NULL && *lcd->core->modifiers != '\0') {
begin = _XimStrstr(lcd->core->modifiers, ximmodifier); begin = _XimStrstr(lcd->core->modifiers, ximmodifier);
...@@ -205,7 +203,7 @@ _XimOpenIM( ...@@ -205,7 +203,7 @@ _XimOpenIM(
{ {
Xim im; Xim im;
register int i; register int i;
if (!(im = (Xim)Xmalloc(sizeof(XimRec)))) if (!(im = (Xim)Xmalloc(sizeof(XimRec))))
return (XIM)NULL; return (XIM)NULL;
bzero(im, sizeof(XimRec)); bzero(im, sizeof(XimRec));
...@@ -257,8 +255,7 @@ Error1: ...@@ -257,8 +255,7 @@ Error1:
} }
Public Bool Public Bool
_XInitIM(lcd) _XInitIM(XLCd lcd)
XLCd lcd;
{ {
if(lcd == (XLCd)NULL) if(lcd == (XLCd)NULL)
return False; return False;
......
...@@ -7,7 +7,7 @@ Permission to use, copy, modify, distribute, and sell this software ...@@ -7,7 +7,7 @@ Permission to use, copy, modify, distribute, and sell this software
and its documentation for any purpose is hereby granted without fee, and its documentation for any purpose is hereby granted without fee,
provided that the above copyright notice appear in all copies and provided that the above copyright notice appear in all copies and
that both that copyright notice and this permission notice appear that both that copyright notice and this permission notice appear
in supporting documentation, and that the name of Fuji Xerox, in supporting documentation, and that the name of Fuji Xerox,
FUJITSU LIMITED not be used in advertising or publicity pertaining FUJITSU LIMITED not be used in advertising or publicity pertaining
to distribution of the software without specific, written prior to distribution of the software without specific, written prior
permission. Fuji Xerox, FUJITSU LIMITED make no representations permission. Fuji Xerox, FUJITSU LIMITED make no representations
...@@ -24,7 +24,7 @@ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR ...@@ -24,7 +24,7 @@ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
Author : Kazunori Nishihara Fuji Xerox Author : Kazunori Nishihara Fuji Xerox
Modifier : Takashi Fujiwara FUJITSU LIMITED Modifier : Takashi Fujiwara FUJITSU LIMITED
fujiwara@a80.tech.yk.fujitsu.co.jp fujiwara@a80.tech.yk.fujitsu.co.jp
******************************************************************/ ******************************************************************/
...@@ -38,43 +38,67 @@ PERFORMANCE OF THIS SOFTWARE. ...@@ -38,43 +38,67 @@ PERFORMANCE OF THIS SOFTWARE.
#include "Ximint.h" #include "Ximint.h"
Bool Bool
_XimLocalFilter(d, w, ev, client_data) _XimLocalFilter(Display *d, Window w, XEvent *ev, XPointer client_data)
Display *d;
Window w;
XEvent *ev;
XPointer client_data;
{ {
Xic ic = (Xic)client_data; Xic ic = (Xic)client_data;
KeySym keysym; KeySym keysym;
static char buf[256]; static char buf[256];
DefTree *p; DefTree *b = ic->private.local.base.tree;
DTIndex t;
if( (ev->type != KeyPress) if(ev->xkey.keycode == 0)
|| (ev->xkey.keycode == 0) return (False);
|| (((Xim)ic->core.im)->private.local.top == (DefTree *)NULL) )
return(False);
XLookupString((XKeyEvent *)ev, buf, sizeof(buf), &keysym, NULL); XLookupString((XKeyEvent *)ev, buf, sizeof(buf), &keysym, NULL);
if(IsModifierKey(keysym)) if(IsModifierKey(keysym))
return (False); return (False);
for(p = ic->private.local.context; p; p = p->next) { if(keysym >= XK_braille_dot_1 && keysym <= XK_braille_dot_8) {
if(((ev->xkey.state & p->modifier_mask) == p->modifier) && if(ev->type == KeyPress) {
(keysym == p->keysym)) { ic->private.local.brl_pressed |=
break; 1<<(keysym-XK_braille_dot_1);
} else {
if(!ic->private.local.brl_committing
|| ev->xkey.time - ic->private.local.brl_release_start > 300) {
ic->private.local.brl_committing = ic->private.local.brl_pressed;
ic->private.local.brl_release_start = ev->xkey.time;
}
ic->private.local.brl_pressed &= ~(1<<(keysym-XK_braille_dot_1));
if(!ic->private.local.brl_pressed) {
if(ic->private.local.brl_committing) {
ic->private.local.brl_committed =
ic->private.local.brl_committing;
ic->private.local.composed = 0;
ev->type = KeyPress;
ev->xkey.keycode = 0;
_XPutBackEvent(d, ev);
}
}
} }
return(True);
}
if( (ev->type != KeyPress)
|| (((Xim)ic->core.im)->private.local.top == 0 ) )
return(False);
for(t = ic->private.local.context; t; t = b[t].next) {
if(((ev->xkey.state & b[t].modifier_mask) == b[t].modifier) &&
(keysym == b[t].keysym))
break;
} }
if(p) { /* Matched */ if(t) { /* Matched */
if(p->succession) { /* Intermediate */ if(b[t].succession) { /* Intermediate */
ic->private.local.context = p->succession; ic->private.local.context = b[t].succession;
return(True); return(True);
} else { /* Terminate (reached to leaf) */ } else { /* Terminate (reached to leaf) */
ic->private.local.composed = p; ic->private.local.composed = t;
ic->private.local.brl_committed = 0;
/* return back to client KeyPressEvent keycode == 0 */ /* return back to client KeyPressEvent keycode == 0 */
ev->xkey.keycode = 0; ev->xkey.keycode = 0;
_XPutBackEvent(d, ev); XPutBackEvent(d, ev);
/* initialize internal state for next key sequence */ /* initialize internal state for next key sequence */
ic->private.local.context = ((Xim)ic->core.im)->private.local.top; ic->private.local.context = ((Xim)ic->core.im)->private.local.top;
return(True); return(True);
......
...@@ -10,7 +10,7 @@ in supporting documentation, and that the name of FUJITSU LIMITED ...@@ -10,7 +10,7 @@ in supporting documentation, and that the name of FUJITSU LIMITED
not be used in advertising or publicity pertaining to distribution not be used in advertising or publicity pertaining to distribution
of the software without specific, written prior permission. of the software without specific, written prior permission.
FUJITSU LIMITED makes no representations about the suitability of FUJITSU LIMITED makes no representations about the suitability of
this software for any purpose. this software for any purpose.
It is provided "as is" without express or implied warranty. It is provided "as is" without express or implied warranty.
FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
...@@ -21,7 +21,7 @@ USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR ...@@ -21,7 +21,7 @@ USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
Author: Takashi Fujiwara FUJITSU LIMITED Author: Takashi Fujiwara FUJITSU LIMITED
fujiwara@a80.tech.yk.fujitsu.co.jp fujiwara@a80.tech.yk.fujitsu.co.jp
******************************************************************/ ******************************************************************/
...@@ -34,9 +34,7 @@ PERFORMANCE OF THIS SOFTWARE. ...@@ -34,9 +34,7 @@ PERFORMANCE OF THIS SOFTWARE.
#include "Ximint.h" #include "Ximint.h"
Public char * Public char *
_XimLocalGetICValues(xic, values) _XimLocalGetICValues(XIC xic, XIMArg *values)
XIC xic;
XIMArg *values;
{ {
Xic ic = (Xic)xic; Xic ic = (Xic)xic;
XimDefICValues ic_values; XimDefICValues ic_values;
......
...@@ -10,7 +10,7 @@ in supporting documentation, and that the name of FUJITSU LIMITED ...@@ -10,7 +10,7 @@ in supporting documentation, and that the name of FUJITSU LIMITED
not be used in advertising or publicity pertaining to distribution not be used in advertising or publicity pertaining to distribution
of the software without specific, written prior permission. of the software without specific, written prior permission.
FUJITSU LIMITED makes no representations about the suitability of FUJITSU LIMITED makes no representations about the suitability of
this software for any purpose. this software for any purpose.
It is provided "as is" without express or implied warranty. It is provided "as is" without express or implied warranty.
FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
...@@ -21,7 +21,7 @@ USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR ...@@ -21,7 +21,7 @@ USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
Author: Takashi Fujiwara FUJITSU LIMITED Author: Takashi Fujiwara FUJITSU LIMITED
fujiwara@a80.tech.yk.fujitsu.co.jp fujiwara@a80.tech.yk.fujitsu.co.jp
******************************************************************/ ******************************************************************/
...@@ -85,7 +85,7 @@ _XimLocalSetFocus( ...@@ -85,7 +85,7 @@ _XimLocalSetFocus(
if (ic->core.focus_window) if (ic->core.focus_window)
_XRegisterFilterByType(ic->core.im->core.display, _XRegisterFilterByType(ic->core.im->core.display,
ic->core.focus_window, KeyPress, KeyPress, ic->core.focus_window, KeyPress, KeyRelease,
_XimLocalFilter, (XPointer)ic); _XimLocalFilter, (XPointer)ic);
return; return;
} }
...@@ -95,8 +95,11 @@ _XimLocalReset( ...@@ -95,8 +95,11 @@ _XimLocalReset(
XIC xic) XIC xic)
{ {
Xic ic = (Xic)xic; Xic ic = (Xic)xic;
ic->private.local.composed = (DefTree *)NULL; ic->private.local.composed = 0;
ic->private.local.context = ((Xim)ic->core.im)->private.local.top; ic->private.local.context = ((Xim)ic->core.im)->private.local.top;
ic->private.local.brl_pressed = 0;
ic->private.local.brl_committing = 0;
ic->private.local.brl_committed = 0;
} }
Private char * Private char *
...@@ -147,8 +150,12 @@ _XimLocalCreateIC( ...@@ -147,8 +150,12 @@ _XimLocalCreateIC(
ic->methods = &Local_ic_methods; ic->methods = &Local_ic_methods;
ic->core.im = im; ic->core.im = im;
ic->private.local.context = ((Xim)im)->private.local.top; ic->private.local.base = ((Xim)im)->private.local.base;
ic->private.local.composed = (DefTree *)NULL; ic->private.local.context = ((Xim)im)->private.local.top;
ic->private.local.composed = 0;
ic->private.local.brl_pressed = 0;
ic->private.local.brl_committing = 0;
ic->private.local.brl_committed = 0;
num = im->core.ic_num_resources; num = im->core.ic_num_resources;
len = sizeof(XIMResource) * num; len = sizeof(XIMResource) * num;
......
...@@ -15,17 +15,17 @@ makes no representations about the suitability of this software for ...@@ -15,17 +15,17 @@ makes no representations about the suitability of this software for
any purpose. It is provided "as is" without express or implied any purpose. It is provided "as is" without express or implied
warranty. warranty.
FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION DISCLAIM ALL FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION DISCLAIM ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR
ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE. THIS SOFTWARE.
Author: Takashi Fujiwara FUJITSU LIMITED Author: Takashi Fujiwara FUJITSU LIMITED
fujiwara@a80.tech.yk.fujitsu.co.jp fujiwara@a80.tech.yk.fujitsu.co.jp
Modifier: Franky Ling Digital Equipment Corporation Modifier: Franky Ling Digital Equipment Corporation
frankyling@hgrd01.enet.dec.com frankyling@hgrd01.enet.dec.com
...@@ -48,10 +48,55 @@ THIS SOFTWARE. ...@@ -48,10 +48,55 @@ THIS SOFTWARE.
#include "XlcPubI.h" #include "XlcPubI.h"
#include "Ximint.h" #include "Ximint.h"
#include <ctype.h> #include <ctype.h>
#include <assert.h>
#ifdef COMPOSECACHE
# include <sys/types.h>
# include <sys/stat.h>
# include <sys/mman.h>
# include <langinfo.h>
#endif
#ifdef COMPOSECACHE
/* include trailing '/' for cache directory, file prefix otherwise */
#define XIM_GLOBAL_CACHE_DIR "/var/cache/libx11/compose/"
#define XIM_HOME_CACHE_DIR "/.compose-cache/"
#define XIM_CACHE_MAGIC ('X' | 'i'<<8 | 'm'<<16 | 'C'<<24)
#define XIM_CACHE_VERSION 4
#define XIM_CACHE_TREE_ALIGNMENT 4
#define XIM_HASH_PRIME_1 13
#define XIM_HASH_PRIME_2 1234096939
typedef INT32 DTStructIndex;
struct _XimCacheStruct {
INT32 id;
INT32 version;
DTStructIndex tree;
DTStructIndex mb;
DTStructIndex wc;
DTStructIndex utf8;
DTStructIndex size;
DTIndex top;
DTIndex treeused;
DTCharIndex mbused;
DTCharIndex wcused;
DTCharIndex utf8used;
char fname[1];
/* char encoding[1] */
};
Private struct _XimCacheStruct* _XimCache_mmap = NULL;
Private DefTreeBase _XimCachedDefaultTreeBase;
Private int _XimCachedDefaultTreeRefcount = 0;
#endif
Public Bool Public Bool
_XimCheckIfLocalProcessing(im) _XimCheckIfLocalProcessing(Xim im)
Xim im;
{ {
FILE *fp; FILE *fp;
char *name; char *name;
...@@ -76,23 +121,37 @@ _XimCheckIfLocalProcessing(im) ...@@ -76,23 +121,37 @@ _XimCheckIfLocalProcessing(im)
Private void Private void
XimFreeDefaultTree( XimFreeDefaultTree(
DefTree *top) DefTreeBase *b)
{ {
if (!top) return; if (!b) return;
if (top->succession) XimFreeDefaultTree(top->succession); if (b->tree == NULL) return;
if (top->next) XimFreeDefaultTree(top->next); #ifdef COMPOSECACHE
if (top->mb) Xfree(top->mb); if (b->tree == _XimCachedDefaultTreeBase.tree) {
if (top->wc) Xfree(top->wc); _XimCachedDefaultTreeRefcount--;
if (top->utf8) Xfree(top->utf8); /* No deleting, it's a cache after all. */
Xfree(top); return;
}
#endif
Xfree (b->tree);
if (b->mb) Xfree (b->mb);
if (b->wc) Xfree (b->wc);
if (b->utf8) Xfree (b->utf8);
b->tree = NULL;
b->mb = NULL;
b->wc = NULL;
b->utf8 = NULL;
b->treeused = b->treesize = 0;
b->mbused = b->mbsize = 0;
b->wcused = b->wcsize = 0;
b->utf8used = b->utf8size = 0;
} }
Public void Public void
_XimLocalIMFree( _XimLocalIMFree(
Xim im) Xim im)
{ {
XimFreeDefaultTree(im->private.local.top); XimFreeDefaultTree(&im->private.local.base);
im->private.local.top = NULL; im->private.local.top = 0;
if(im->core.im_resources) { if(im->core.im_resources) {
Xfree(im->core.im_resources); Xfree(im->core.im_resources);
...@@ -211,28 +270,282 @@ _XimLocalSetIMValues( ...@@ -211,28 +270,282 @@ _XimLocalSetIMValues(
return(name); return(name);
} }
#ifdef COMPOSECACHE
Private Bool
_XimReadCachedDefaultTree(
int fd_cache,
const char *name,
const char *encoding,
DTStructIndex size)
{
struct _XimCacheStruct* m;
int namelen = strlen (name) + 1;
int encodinglen = strlen (encoding) + 1;
m = mmap (NULL, size, PROT_READ, MAP_PRIVATE, fd_cache, 0);
if (m == NULL || m == MAP_FAILED)
return False;
assert (m->id == XIM_CACHE_MAGIC);
assert (m->version == XIM_CACHE_VERSION);
if (size != m->size ||
size < XOffsetOf (struct _XimCacheStruct, fname) + namelen + encodinglen) {
fprintf (stderr, "Ignoring broken XimCache %s [%s]\n", name, encoding);
munmap (m, size);
return False;
}
if (strncmp (name, m->fname, namelen) != 0) {
/* m->fname may *not* be terminated - but who cares here */
fprintf (stderr, "Filename hash clash - expected %s, got %s\n",
name, m->fname);
munmap (m, size);
return False;
}
if (strncmp (encoding, m->fname + namelen, encodinglen) != 0) {
/* m->fname+namelen may *not* be terminated - but who cares here */
fprintf (stderr, "Enoding hash clash - expected %s, got %s\n",
encoding, m->fname + namelen);
munmap (m, size);
return False;
}
_XimCache_mmap = m;
_XimCachedDefaultTreeBase.tree = (DefTree *) (((char *) m) + m->tree);
_XimCachedDefaultTreeBase.mb = (((char *) m) + m->mb);
_XimCachedDefaultTreeBase.wc = (wchar_t *) (((char *) m) + m->wc);
_XimCachedDefaultTreeBase.utf8 = (((char *) m) + m->utf8);
_XimCachedDefaultTreeBase.treeused = m->treeused;
_XimCachedDefaultTreeBase.mbused = m->mbused;
_XimCachedDefaultTreeBase.wcused = m->wcused;
_XimCachedDefaultTreeBase.utf8used = m->utf8used;
/* treesize etc. is ignored because only used during parsing */
_XimCachedDefaultTreeRefcount = 0;
/* fprintf (stderr, "read cached tree at %p: %s\n", (void *) m, name); */
return True;
}
Private unsigned int strToHash (
const char *name)
{
unsigned int hash = 0;
while (*name)
hash = hash * XIM_HASH_PRIME_1 + *(unsigned const char *)name++;
return hash % XIM_HASH_PRIME_2;
}
/* Returns read-only fd of cache file, -1 if none.
* Sets *res to cache filename if safe. Sets *size to file size of cache. */
Private int _XimCachedFileName (
const char *dir, const char *name,
const char *intname, const char *encoding,
uid_t uid, int isglobal, char **res, off_t *size)
{
struct stat st_name, st;
int fd;
unsigned int len, hash, hash2;
struct _XimCacheStruct *m;
/* There are some races here with 'dir', but we are either in our own home
* or the global cache dir, and not inside some public writable dir */
/* fprintf (stderr, "XimCachedFileName for dir %s name %s intname %s encoding %s uid %d\n", dir, name, intname, encoding, uid); */
if (stat (name, &st_name) == -1 || ! S_ISREG (st_name.st_mode)
|| stat (dir, &st) == -1 || ! S_ISDIR (st.st_mode) || st.st_uid != uid
|| (st.st_mode & 0022) != 0000) {
*res = NULL;
return -1;
}
len = strlen (dir);
hash = strToHash (intname);
hash2 = strToHash (encoding);
*res = Xmalloc (len + 1 + 27 + 1); /* Max VERSION 9999 */
if (len == 0 || dir [len-1] != '/')
sprintf (*res, "%s/%c%d_%03x_%08x_%08x", dir, _XimGetMyEndian(),
XIM_CACHE_VERSION, (unsigned int)sizeof (DefTree), hash, hash2);
else
sprintf (*res, "%s%c%d_%03x_%08x_%08x", dir, _XimGetMyEndian(),
XIM_CACHE_VERSION, (unsigned int)sizeof (DefTree), hash, hash2);
/* fprintf (stderr, "-> %s\n", *res); */
if ( (fd = _XOpenFile (*res, O_RDONLY)) == -1)
return -1;
if (fstat (fd, &st) == -1) {
Xfree (*res);
*res = NULL;
close (fd);
return -1;
}
*size = st.st_size;
if (! S_ISREG (st.st_mode) || st.st_uid != uid
|| (st.st_mode & 0022) != 0000 || st.st_mtime <= st_name.st_mtime
|| (st.st_mtime < time (NULL) - 24*60*60 && ! isglobal)) {
close (fd);
if (unlink (*res) != 0) {
Xfree (*res);
*res = NULL; /* cache is not safe */
}
return -1;
}
m = mmap (NULL, sizeof (struct _XimCacheStruct), PROT_READ, MAP_PRIVATE,
fd, 0);
if (m == NULL || m == MAP_FAILED) {
close (fd);
Xfree (*res);
*res = NULL;
return -1;
}
if (*size < sizeof (struct _XimCacheStruct) || m->id != XIM_CACHE_MAGIC) {
munmap (m, sizeof (struct _XimCacheStruct));
close (fd);
fprintf (stderr, "Ignoring broken XimCache %s\n", *res);
Xfree (*res);
*res = NULL;
return -1;
}
if (m->version != XIM_CACHE_VERSION) {
munmap (m, sizeof (struct _XimCacheStruct));
close (fd);
if (unlink (*res) != 0) {
Xfree (*res);
*res = NULL; /* cache is not safe */
}
return -1;
}
munmap (m, sizeof (struct _XimCacheStruct));
return fd;
}
Private Bool _XimLoadCache (
int fd,
const char *name,
const char *encoding,
off_t size,
Xim im)
{
if (_XimCache_mmap ||
_XimReadCachedDefaultTree (fd, name, encoding, size)) {
_XimCachedDefaultTreeRefcount++;
memcpy (&im->private.local.base, &_XimCachedDefaultTreeBase,
sizeof (_XimCachedDefaultTreeBase));
im->private.local.top = _XimCache_mmap->top;
return True;
}
return False;
}
Private void
_XimWriteCachedDefaultTree(
const char *name,
const char *encoding,
const char *cachename,
Xim im)
{
int fd;
FILE *fp;
struct _XimCacheStruct *m;
int msize = (XOffsetOf(struct _XimCacheStruct, fname)
+ strlen(name) + strlen(encoding) + 2
+ XIM_CACHE_TREE_ALIGNMENT-1) & -XIM_CACHE_TREE_ALIGNMENT;
DefTreeBase *b = &im->private.local.base;
if (! b->tree && ! (b->tree = Xmalloc (sizeof(DefTree))) )
return;
if (! b->mb && ! (b->mb = Xmalloc (1)) )
return;
if (! b->wc && ! (b->wc = Xmalloc (sizeof(wchar_t))) )
return;
if (! b->utf8 && ! (b->utf8 = Xmalloc (1)) )
return;
/* First entry is always unused */
memset (b->tree, 0, sizeof(DefTree));
b->mb[0] = 0;
b->wc[0] = 0;
b->utf8[0] = 0;
m = Xmalloc (msize);
memset (m, 0, msize);
m->id = XIM_CACHE_MAGIC;
m->version = XIM_CACHE_VERSION;
m->top = im->private.local.top;
m->treeused = b->treeused;
m->mbused = b->mbused;
m->wcused = b->wcused;
m->utf8used = b->utf8used;
/* Tree first, then wide chars, then the rest due to alignment */
m->tree = msize;
m->wc = msize + sizeof (DefTree) * m->treeused;
m->mb = m->wc + sizeof (wchar_t) * m->wcused;
m->utf8 = m->mb + m->mbused;
m->size = m->utf8 + m->utf8used;
strcpy (m->fname, name);
strcpy (m->fname+strlen(name)+1, encoding);
/* This STILL might be racy on NFS */
if ( (fd = _XOpenFileMode (cachename, O_WRONLY | O_CREAT | O_EXCL,
0600)) < 0)
return;
if (! (fp = fdopen (fd, "wb")) ) {
close (fd);
return;
}
fwrite (m, msize, 1, fp);
fwrite (im->private.local.base.tree, sizeof(DefTree), m->treeused, fp);
fwrite (im->private.local.base.wc, sizeof(wchar_t), m->wcused, fp);
fwrite (im->private.local.base.mb, 1, m->mbused, fp);
fwrite (im->private.local.base.utf8, 1, m->utf8used, fp);
if (fclose (fp) != 0)
unlink (cachename);
_XimCache_mmap = m;
memcpy (&_XimCachedDefaultTreeBase, &im->private.local.base,
sizeof (_XimCachedDefaultTreeBase));
/* fprintf (stderr, "wrote tree %s size %ld to %s\n", name, m->size, cachename); */
}
#endif
Private void Private void
_XimCreateDefaultTree( _XimCreateDefaultTree(
Xim im) Xim im)
{ {
FILE *fp = NULL; FILE *fp = NULL;
char *name, *tmpname = NULL; char *name, *tmpname = NULL, *intname;
char *cachename = NULL;
/* Should use getpwent() instead of $HOME (cross-platform?) */
char *home = getenv("HOME");
char *cachedir = NULL;
char *tmpcachedir = NULL;
int hl = home ? strlen (home) : 0;
#ifdef COMPOSECACHE
const char *encoding = nl_langinfo (CODESET);
uid_t euid = geteuid ();
gid_t egid = getegid ();
int cachefd = -1;
off_t size;
#endif
name = getenv("XCOMPOSEFILE"); name = getenv("XCOMPOSEFILE");
if (name == (char *) NULL) { if (name == (char *) NULL) {
char *home = getenv("HOME");
if (home != (char *) NULL) { if (home != (char *) NULL) {
int hl = strlen(home);
tmpname = name = Xmalloc(hl + 10 + 1); tmpname = name = Xmalloc(hl + 10 + 1);
if (name != (char *) NULL) { if (name != (char *) NULL) {
int fd;
strcpy(name, home); strcpy(name, home);
strcpy(name + hl, "/.XCompose"); strcpy(name + hl, "/.XCompose");
fp = _XFopenFile (name, "r"); if ( (fd = _XOpenFile (name, O_RDONLY)) < 0) {
if (fp == (FILE *) NULL) { Xfree (name);
Xfree(name); name = tmpname = NULL;
name = tmpname = NULL; } else
} close (fd);
} }
} }
} }
...@@ -240,19 +553,94 @@ _XimCreateDefaultTree( ...@@ -240,19 +553,94 @@ _XimCreateDefaultTree(
if (name == (char *) NULL) { if (name == (char *) NULL) {
tmpname = name = _XlcFileName(im->core.lcd, COMPOSE_FILE); tmpname = name = _XlcFileName(im->core.lcd, COMPOSE_FILE);
} }
intname = name;
#ifdef COMPOSECACHE
if (getuid () == euid && getgid () == egid && euid != 0) {
char *c;
/* Usage: XCOMPOSECACHE=<cachedir>[=<filename>]
* cachedir: directory of cache files
* filename: internally used name for cache file */
cachedir = getenv("XCOMPOSECACHE");
if (cachedir && (c = strchr (cachedir, '='))) {
tmpcachedir = strdup (cachedir);
intname = tmpcachedir + (c-cachedir) + 1;
tmpcachedir[c-cachedir] = '\0';
cachedir = tmpcachedir;
}
}
if (name == (char *) NULL) if (! cachedir) {
return; cachefd = _XimCachedFileName (XIM_GLOBAL_CACHE_DIR, name, intname,
if (fp == (FILE *) NULL) { encoding, 0, 1, &cachename, &size);
fp = _XFopenFile (name, "r"); if (cachefd != -1) {
if (_XimLoadCache (cachefd, intname, encoding, size, im)) {
if (tmpcachedir)
Xfree (tmpcachedir);
if (tmpname)
Xfree (tmpname);
if (cachename)
Xfree (cachename);
close (cachefd);
return;
}
close (cachefd);
}
if (cachename)
Xfree (cachename);
cachename = NULL;
} }
if (tmpname != (char *) NULL) {
Xfree(tmpname); if (getuid () == euid && getgid () == egid && euid != 0 && home) {
if (! cachedir) {
tmpcachedir = cachedir = Xmalloc (hl+strlen(XIM_HOME_CACHE_DIR)+1);
strcpy (cachedir, home);
strcat (cachedir, XIM_HOME_CACHE_DIR);
}
cachefd = _XimCachedFileName (cachedir, name, intname, encoding,
euid, 0, &cachename, &size);
if (cachefd != -1) {
if (_XimLoadCache (cachefd, intname, encoding, size, im)) {
if (tmpcachedir)
Xfree (tmpcachedir);
if (tmpname)
Xfree (tmpname);
if (cachename)
Xfree (cachename);
close (cachefd);
return;
}
close (cachefd);
}
}
#endif
if (! (fp = _XFopenFile (name, "r"))) {
if (tmpcachedir)
Xfree (tmpcachedir);
if (tmpname)
Xfree (tmpname);
if (cachename)
Xfree (cachename);
return;
} }
if (fp == (FILE *) NULL)
return;
_XimParseStringFile(fp, im); _XimParseStringFile(fp, im);
fclose(fp); fclose(fp);
#ifdef COMPOSECACHE
if (cachename) {
assert (euid != 0);
_XimWriteCachedDefaultTree (intname, encoding, cachename, im);
}
#endif
if (tmpcachedir)
Xfree (tmpcachedir);
if (tmpname)
Xfree (tmpname);
if (cachename)
Xfree (cachename);
} }
Private XIMMethodsRec Xim_im_local_methods = { Private XIMMethodsRec Xim_im_local_methods = {
...@@ -325,6 +713,11 @@ _XimLocalOpenIM( ...@@ -325,6 +713,11 @@ _XimLocalOpenIM(
goto Open_Error; goto Open_Error;
private->ucstoutf8_conv = conv; private->ucstoutf8_conv = conv;
private->base.treeused = 1;
private->base.mbused = 1;
private->base.wcused = 1;
private->base.utf8used = 1;
_XimCreateDefaultTree(im); _XimCreateDefaultTree(im);
im->methods = &Xim_im_local_methods; im->methods = &Xim_im_local_methods;
......
...@@ -16,7 +16,7 @@ It is provided "as is" without express or implied warranty. ...@@ -16,7 +16,7 @@ It is provided "as is" without express or implied warranty.
FUJI XEROX, FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH FUJI XEROX, FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJI XEROX, MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJI XEROX,
FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
...@@ -24,7 +24,7 @@ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR ...@@ -24,7 +24,7 @@ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
Author: Kazunori Nishihara Fuji Xerox Author: Kazunori Nishihara Fuji Xerox
Takashi Fujiwara FUJITSU LIMITED Takashi Fujiwara FUJITSU LIMITED
fujiwara@a80.tech.yk.fujitsu.co.jp fujiwara@a80.tech.yk.fujitsu.co.jp
******************************************************************/ ******************************************************************/
...@@ -40,43 +40,59 @@ PERFORMANCE OF THIS SOFTWARE. ...@@ -40,43 +40,59 @@ PERFORMANCE OF THIS SOFTWARE.
#include <nx-X11/Xutil.h> #include <nx-X11/Xutil.h>
#include "Xlibint.h" #include "Xlibint.h"
#include "Xlcint.h" #include "Xlcint.h"
#include "XlcPubI.h"
#include "Ximint.h" #include "Ximint.h"
Public int Public int
_XimLocalMbLookupString(xic, ev, buffer, bytes, keysym, status) _XimLocalMbLookupString(XIC xic, XKeyEvent *ev, char *buffer, int bytes,
XIC xic; KeySym *keysym, Status *status)
XKeyEvent *ev;
char *buffer;
int bytes;
KeySym *keysym;
Status *status;
{ {
Xic ic = (Xic)xic; Xic ic = (Xic)xic;
int ret; int ret;
DefTree *b = ic->private.local.base.tree;
char *mb = ic->private.local.base.mb;
if(ev->type != KeyPress) { if(ev->type != KeyPress) {
if(status) *status = XLookupNone; if(status) *status = XLookupNone;
return(0); return(0);
} }
if(ev->keycode == 0 && ic->private.local.composed != NULL) { /* Composed Event */ if(ev->keycode == 0 &&
ret = strlen(ic->private.local.composed->mb); ( (ic->private.local.composed != 0)
if(ret > bytes) { ||(ic->private.local.brl_committed != 0))) {
if(status) *status = XBufferOverflow; if (ic->private.local.brl_committed != 0) { /* Braille Event */
return(ret); unsigned char pattern = ic->private.local.brl_committed;
} char mb[XLC_PUBLIC(ic->core.im->core.lcd, mb_cur_max)];
memcpy(buffer, ic->private.local.composed->mb, ret); ret = _Xlcwctomb(ic->core.im->core.lcd, mb, BRL_UC_ROW | pattern);
if(keysym) *keysym = ic->private.local.composed->ks; if(ret > bytes) {
if (ret > 0) { if(status) *status = XBufferOverflow;
if (keysym && *keysym != NoSymbol) { return(ret);
}
if(keysym) {
*keysym = XK_braille_blank | pattern;
if(status) *status = XLookupBoth; if(status) *status = XLookupBoth;
} else { } else
if(status) *status = XLookupChars; if(status) *status = XLookupChars;
memcpy(buffer, mb, ret);
} else { /* Composed Event */
ret = strlen(&mb[b[ic->private.local.composed].mb]);
if(ret > bytes) {
if(status) *status = XBufferOverflow;
return(ret);
} }
} else { memcpy(buffer, &mb[b[ic->private.local.composed].mb], ret);
if(keysym && *keysym != NoSymbol) { if(keysym) *keysym = b[ic->private.local.composed].ks;
if(status) *status = XLookupKeySym; if (ret > 0) {
if (keysym && *keysym != NoSymbol) {
if(status) *status = XLookupBoth;
} else {
if(status) *status = XLookupChars;
}
} else { } else {
if(status) *status = XLookupNone; if(keysym && *keysym != NoSymbol) {
if(status) *status = XLookupKeySym;
} else {
if(status) *status = XLookupNone;
}
} }
} }
return (ret); return (ret);
...@@ -102,41 +118,53 @@ _XimLocalMbLookupString(xic, ev, buffer, bytes, keysym, status) ...@@ -102,41 +118,53 @@ _XimLocalMbLookupString(xic, ev, buffer, bytes, keysym, status)
} }
Public int Public int
_XimLocalWcLookupString(xic, ev, buffer, wlen, keysym, status) _XimLocalWcLookupString(XIC xic, XKeyEvent *ev, wchar_t *buffer, int wlen,
XIC xic; KeySym *keysym, Status *status)
XKeyEvent *ev;
wchar_t *buffer;
int wlen;
KeySym *keysym;
Status *status;
{ {
Xic ic = (Xic)xic; Xic ic = (Xic)xic;
int ret; int ret;
DefTree *b = ic->private.local.base.tree;
wchar_t *wc = ic->private.local.base.wc;
if(ev->type != KeyPress) { if(ev->type != KeyPress) {
if(status) *status = XLookupNone; if(status) *status = XLookupNone;
return(0); return(0);
} }
if(ev->keycode == 0) { /* Composed Event */ if(ev->keycode == 0) {
ret = _Xwcslen(ic->private.local.composed->wc); if (ic->private.local.brl_committed != 0) { /* Braille Event */
if(ret > wlen) { unsigned char pattern = ic->private.local.brl_committed;
if(status) *status = XBufferOverflow; ret = 1;
return (ret); if (ret > wlen) {
} if(status) *status = XBufferOverflow;
memcpy((char *)buffer, (char *)ic->private.local.composed->wc, return (ret);
ret * sizeof(wchar_t)); }
if(keysym) *keysym = ic->private.local.composed->ks; *buffer = BRL_UC_ROW | pattern;
if (ret > 0) { if(keysym) {
if (keysym && *keysym != NoSymbol) { *keysym = XK_braille_blank | pattern;
if(status) *status = XLookupBoth; if(status) *status = XLookupBoth;
} else { } else
if(status) *status = XLookupChars; if(status) *status = XLookupChars;
} else { /* Composed Event */
ret = _Xwcslen(&wc[b[ic->private.local.composed].wc]);
if(ret > wlen) {
if(status) *status = XBufferOverflow;
return (ret);
} }
} else { memcpy((char *)buffer, (char *)&wc[b[ic->private.local.composed].wc],
if(keysym && *keysym != NoSymbol) { ret * sizeof(wchar_t));
if(status) *status = XLookupKeySym; if(keysym) *keysym = b[ic->private.local.composed].ks;
if (ret > 0) {
if (keysym && *keysym != NoSymbol) {
if(status) *status = XLookupBoth;
} else {
if(status) *status = XLookupChars;
}
} else { } else {
if(status) *status = XLookupNone; if(keysym && *keysym != NoSymbol) {
if(status) *status = XLookupKeySym;
} else {
if(status) *status = XLookupNone;
}
} }
} }
return (ret); return (ret);
...@@ -162,40 +190,49 @@ _XimLocalWcLookupString(xic, ev, buffer, wlen, keysym, status) ...@@ -162,40 +190,49 @@ _XimLocalWcLookupString(xic, ev, buffer, wlen, keysym, status)
} }
Public int Public int
_XimLocalUtf8LookupString(xic, ev, buffer, bytes, keysym, status) _XimLocalUtf8LookupString(XIC xic, XKeyEvent *ev, char *buffer, int bytes,
XIC xic; KeySym *keysym, Status *status)
XKeyEvent *ev;
char *buffer;
int bytes;
KeySym *keysym;
Status *status;
{ {
Xic ic = (Xic)xic; Xic ic = (Xic)xic;
int ret; int ret;
DefTree *b = ic->private.local.base.tree;
char *utf8 = ic->private.local.base.utf8;
if(ev->type != KeyPress) { if(ev->type != KeyPress) {
if(status) *status = XLookupNone; if(status) *status = XLookupNone;
return(0); return(0);
} }
if(ev->keycode == 0) { /* Composed Event */ if(ev->keycode == 0) {
ret = strlen(ic->private.local.composed->utf8); if (ic->private.local.brl_committed != 0) { /* Braille Event */
if(ret > bytes) { unsigned char pattern = ic->private.local.brl_committed;
if(status) *status = XBufferOverflow; ret = 3;
return (ret); if (ret > bytes) {
} if(status) *status = XBufferOverflow;
memcpy(buffer, ic->private.local.composed->utf8, ret); return (ret);
if(keysym) *keysym = ic->private.local.composed->ks;
if (ret > 0) {
if (keysym && *keysym != NoSymbol) {
if(status) *status = XLookupBoth;
} else {
if(status) *status = XLookupChars;
} }
} else { buffer[0] = 0xe0 | ((BRL_UC_ROW >> 12) & 0x0f);
if(keysym && *keysym != NoSymbol) { buffer[1] = 0x80 | ((BRL_UC_ROW >> 8) & 0x30) | (pattern >> 6);
if(status) *status = XLookupKeySym; buffer[2] = 0x80 | (pattern & 0x3f);
} else { /* Composed Event */
ret = strlen(&utf8[b[ic->private.local.composed].utf8]);
if(ret > bytes) {
if(status) *status = XBufferOverflow;
return (ret);
}
memcpy(buffer, &utf8[b[ic->private.local.composed].utf8], ret);
if(keysym) *keysym = b[ic->private.local.composed].ks;
if (ret > 0) {
if (keysym && *keysym != NoSymbol) {
if(status) *status = XLookupBoth;
} else {
if(status) *status = XLookupChars;
}
} else { } else {
if(status) *status = XLookupNone; if(keysym && *keysym != NoSymbol) {
if(status) *status = XLookupKeySym;
} else {
if(status) *status = XLookupNone;
}
} }
} }
return (ret); return (ret);
...@@ -287,26 +324,16 @@ _XimLcctsconvert( ...@@ -287,26 +324,16 @@ _XimLcctsconvert(
} }
Public int Public int
_XimLcctstombs(xim, from, from_len, to, to_len, state) _XimLcctstombs(XIM xim, char *from, int from_len,
XIM xim; char *to, int to_len, Status *state)
char *from;
int from_len;
char *to;
int to_len;
Status *state;
{ {
return _XimLcctsconvert(((Xim)xim)->private.local.ctom_conv, return _XimLcctsconvert(((Xim)xim)->private.local.ctom_conv,
from, from_len, to, to_len, state); from, from_len, to, to_len, state);
} }
Public int Public int
_XimLcctstowcs(xim, from, from_len, to, to_len, state) _XimLcctstowcs(XIM xim, char *from, int from_len,
XIM xim; wchar_t *to, int to_len, Status *state)
char *from;
int from_len;
wchar_t *to;
int to_len;
Status *state;
{ {
Xim im = (Xim)xim; Xim im = (Xim)xim;
XlcConv conv = im->private.local.ctow_conv; XlcConv conv = im->private.local.ctow_conv;
...@@ -332,7 +359,7 @@ _XimLcctstowcs(xim, from, from_len, to, to_len, state) ...@@ -332,7 +359,7 @@ _XimLcctstowcs(xim, from, from_len, to, to_len, state)
/* Reset the converter. The CompoundText at 'from' starts in /* Reset the converter. The CompoundText at 'from' starts in
initial state. */ initial state. */
_XlcResetConverter(conv); _XlcResetConverter(conv);
from_left = from_len; from_left = from_len;
to_left = BUFSIZ; to_left = BUFSIZ;
from_cnvlen = 0; from_cnvlen = 0;
...@@ -368,13 +395,8 @@ _XimLcctstowcs(xim, from, from_len, to, to_len, state) ...@@ -368,13 +395,8 @@ _XimLcctstowcs(xim, from, from_len, to, to_len, state)
} }
Public int Public int
_XimLcctstoutf8(xim, from, from_len, to, to_len, state) _XimLcctstoutf8(XIM xim, char *from, int from_len,
XIM xim; char *to, int to_len, Status *state)
char *from;
int from_len;
char *to;
int to_len;
Status *state;
{ {
return _XimLcctsconvert(((Xim)xim)->private.local.ctoutf8_conv, return _XimLcctsconvert(((Xim)xim)->private.local.ctoutf8_conv,
from, from_len, to, to_len, state); from, from_len, to, to_len, state);
......
...@@ -42,6 +42,8 @@ OR PERFORMANCE OF THIS SOFTWARE. ...@@ -42,6 +42,8 @@ OR PERFORMANCE OF THIS SOFTWARE.
#include <sys/stat.h> #include <sys/stat.h>
#include <stdio.h> #include <stdio.h>
#define XLC_BUFSIZE 256
extern int _Xmbstowcs( extern int _Xmbstowcs(
wchar_t *wstr, wchar_t *wstr,
char *str, char *str,
...@@ -276,38 +278,33 @@ static long ...@@ -276,38 +278,33 @@ static long
modmask( modmask(
char *name) char *name)
{ {
long mask;
struct _modtbl { struct _modtbl {
char *name; const char name[6];
long mask; long mask;
}; };
struct _modtbl *p;
static struct _modtbl tbl[] = { static const struct _modtbl tbl[] = {
{ "Ctrl", ControlMask }, { "Ctrl", ControlMask },
{ "Lock", LockMask }, { "Lock", LockMask },
{ "Caps", LockMask }, { "Caps", LockMask },
{ "Shift", ShiftMask }, { "Shift", ShiftMask },
{ "Alt", Mod1Mask }, { "Alt", Mod1Mask },
{ "Meta", Mod1Mask }, { "Meta", Mod1Mask }};
{ NULL, 0 }};
int i, num_entries = sizeof (tbl) / sizeof (tbl[0]);
p = tbl;
mask = 0; for (i = 0; i < num_entries; i++)
for (p = tbl; p->name != NULL; p++) { if (!strcmp (name, tbl[i].name))
if (strcmp(name, p->name) == 0) { return tbl[i].mask;
mask = p->mask;
break; return 0;
}
}
return(mask);
} }
static char* static char*
TransFileName(Xim im, char *name) TransFileName(Xim im, char *name)
{ {
char *home = NULL, *lcCompose = NULL; char *home = NULL, *lcCompose = NULL;
char dir[XLC_BUFSIZE];
char *i = name, *ret, *j; char *i = name, *ret, *j;
int l = 0; int l = 0;
...@@ -328,6 +325,10 @@ TransFileName(Xim im, char *name) ...@@ -328,6 +325,10 @@ TransFileName(Xim im, char *name)
if (lcCompose) if (lcCompose)
l += strlen(lcCompose); l += strlen(lcCompose);
break; break;
case 'S':
xlocaledir(dir, XLC_BUFSIZE);
l += strlen(dir);
break;
} }
} else { } else {
l++; l++;
...@@ -359,6 +360,10 @@ TransFileName(Xim im, char *name) ...@@ -359,6 +360,10 @@ TransFileName(Xim im, char *name)
Xfree(lcCompose); Xfree(lcCompose);
} }
break; break;
case 'S':
strcpy(j, dir);
j += strlen(dir);
break;
} }
i++; i++;
} else { } else {
...@@ -408,7 +413,7 @@ get_mb_string (Xim im, char *buf, KeySym ks) ...@@ -408,7 +413,7 @@ get_mb_string (Xim im, char *buf, KeySym ks)
return len; return len;
} }
#define AllMask (ShiftMask | LockMask | ControlMask | Mod1Mask) #define AllMask (ShiftMask | LockMask | ControlMask | Mod1Mask)
#define LOCAL_WC_BUFSIZE 128 #define LOCAL_WC_BUFSIZE 128
#define LOCAL_UTF8_BUFSIZE 256 #define LOCAL_UTF8_BUFSIZE 256
#define SEQUENCE_MAX 10 #define SEQUENCE_MAX 10
...@@ -420,11 +425,13 @@ parseline( ...@@ -420,11 +425,13 @@ parseline(
char* tokenbuf) char* tokenbuf)
{ {
int token; int token;
unsigned modifier_mask; DTModifier modifier_mask;
unsigned modifier; DTModifier modifier;
unsigned tmp; DTModifier tmp;
KeySym keysym = NoSymbol; KeySym keysym = NoSymbol;
DefTree **top = &im->private.local.top; DTIndex *top = &im->private.local.top;
DefTreeBase *b = &im->private.local.base;
DTIndex t;
DefTree *p = NULL; DefTree *p = NULL;
Bool exclam, tilde; Bool exclam, tilde;
KeySym rhs_keysym = 0; KeySym rhs_keysym = 0;
...@@ -436,8 +443,8 @@ parseline( ...@@ -436,8 +443,8 @@ parseline(
char local_utf8_buf[LOCAL_UTF8_BUFSIZE], *rhs_string_utf8; char local_utf8_buf[LOCAL_UTF8_BUFSIZE], *rhs_string_utf8;
struct DefBuffer { struct DefBuffer {
unsigned modifier_mask; DTModifier modifier_mask;
unsigned modifier; DTModifier modifier;
KeySym keysym; KeySym keysym;
}; };
...@@ -447,7 +454,7 @@ parseline( ...@@ -447,7 +454,7 @@ parseline(
do { do {
token = nexttoken(fp, tokenbuf, &lastch); token = nexttoken(fp, tokenbuf, &lastch);
} while (token == ENDOFLINE); } while (token == ENDOFLINE);
if (token == ENDOFFILE) { if (token == ENDOFFILE) {
return(-1); return(-1);
} }
...@@ -467,6 +474,7 @@ parseline( ...@@ -467,6 +474,7 @@ parseline(
if (infp == NULL) if (infp == NULL)
goto error; goto error;
_XimParseStringFile(infp, im); _XimParseStringFile(infp, im);
fclose(infp);
return (0); return (0);
} else if ((token == KEY) && (strcmp("None", tokenbuf) == 0)) { } else if ((token == KEY) && (strcmp("None", tokenbuf) == 0)) {
modifier = 0; modifier = 0;
...@@ -534,20 +542,24 @@ parseline( ...@@ -534,20 +542,24 @@ parseline(
token = nexttoken(fp, tokenbuf, &lastch); token = nexttoken(fp, tokenbuf, &lastch);
if (token == STRING) { if (token == STRING) {
if( (rhs_string_mb = Xmalloc(strlen(tokenbuf) + 1)) == NULL ) l = strlen(tokenbuf) + 1;
goto error; while (b->mbused + l > b->mbsize) {
b->mbsize = b->mbsize ? b->mbsize * 1.5 : 1024;
if (! (b->mb = Xrealloc (b->mb, b->mbsize)) )
goto error;
}
rhs_string_mb = &b->mb[b->mbused];
b->mbused += l;
strcpy(rhs_string_mb, tokenbuf); strcpy(rhs_string_mb, tokenbuf);
token = nexttoken(fp, tokenbuf, &lastch); token = nexttoken(fp, tokenbuf, &lastch);
if (token == KEY) { if (token == KEY) {
rhs_keysym = XStringToKeysym(tokenbuf); rhs_keysym = XStringToKeysym(tokenbuf);
if (rhs_keysym == NoSymbol) { if (rhs_keysym == NoSymbol) {
Xfree(rhs_string_mb);
goto error; goto error;
} }
token = nexttoken(fp, tokenbuf, &lastch); token = nexttoken(fp, tokenbuf, &lastch);
} }
if (token != ENDOFLINE && token != ENDOFFILE) { if (token != ENDOFLINE && token != ENDOFFILE) {
Xfree(rhs_string_mb);
goto error; goto error;
} }
} else if (token == KEY) { } else if (token == KEY) {
...@@ -561,14 +573,13 @@ parseline( ...@@ -561,14 +573,13 @@ parseline(
} }
l = get_mb_string(im, local_mb_buf, rhs_keysym); l = get_mb_string(im, local_mb_buf, rhs_keysym);
if (l == 0) { while (b->mbused + l + 1 > b->mbsize) {
rhs_string_mb = Xmalloc(1); b->mbsize = b->mbsize ? b->mbsize * 1.5 : 1024;
} else { if (! (b->mb = Xrealloc (b->mb, b->mbsize)) )
rhs_string_mb = Xmalloc(l + 1); goto error;
}
if( rhs_string_mb == NULL ) {
goto error;
} }
rhs_string_mb = &b->mb[b->mbused];
b->mbused += l + 1;
memcpy(rhs_string_mb, local_mb_buf, l); memcpy(rhs_string_mb, local_mb_buf, l);
rhs_string_mb[l] = '\0'; rhs_string_mb[l] = '\0';
} else { } else {
...@@ -579,62 +590,70 @@ parseline( ...@@ -579,62 +590,70 @@ parseline(
if (l == LOCAL_WC_BUFSIZE - 1) { if (l == LOCAL_WC_BUFSIZE - 1) {
local_wc_buf[l] = (wchar_t)'\0'; local_wc_buf[l] = (wchar_t)'\0';
} }
if( (rhs_string_wc = (wchar_t *)Xmalloc((l + 1) * sizeof(wchar_t))) == NULL ) { while (b->wcused + l + 1 > b->wcsize) {
Xfree( rhs_string_mb ); b->wcsize = b->wcsize ? b->wcsize * 1.5 : 512;
return( 0 ); if (! (b->wc = Xrealloc (b->wc, sizeof(wchar_t) * b->wcsize)) )
goto error;
} }
rhs_string_wc = &b->wc[b->wcused];
b->wcused += l + 1;
memcpy((char *)rhs_string_wc, (char *)local_wc_buf, (l + 1) * sizeof(wchar_t) ); memcpy((char *)rhs_string_wc, (char *)local_wc_buf, (l + 1) * sizeof(wchar_t) );
l = _Xmbstoutf8(local_utf8_buf, rhs_string_mb, LOCAL_UTF8_BUFSIZE - 1); l = _Xmbstoutf8(local_utf8_buf, rhs_string_mb, LOCAL_UTF8_BUFSIZE - 1);
if (l == LOCAL_UTF8_BUFSIZE - 1) { if (l == LOCAL_UTF8_BUFSIZE - 1) {
local_utf8_buf[l] = '\0'; local_utf8_buf[l] = '\0';
} }
if( (rhs_string_utf8 = (char *)Xmalloc(l + 1)) == NULL ) { while (b->utf8used + l + 1 > b->utf8size) {
Xfree( rhs_string_wc ); b->utf8size = b->utf8size ? b->utf8size * 1.5 : 1024;
Xfree( rhs_string_mb ); if (! (b->utf8 = Xrealloc (b->utf8, b->utf8size)) )
return( 0 ); goto error;
} }
rhs_string_utf8 = &b->utf8[b->utf8used];
b->utf8used += l + 1;
memcpy(rhs_string_utf8, local_utf8_buf, l + 1); memcpy(rhs_string_utf8, local_utf8_buf, l + 1);
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
for (p = *top; p; p = p->next) { for (t = *top; t; t = b->tree[t].next) {
if (buf[i].keysym == p->keysym && if (buf[i].keysym == b->tree[t].keysym &&
buf[i].modifier == p->modifier && buf[i].modifier == b->tree[t].modifier &&
buf[i].modifier_mask == p->modifier_mask) { buf[i].modifier_mask == b->tree[t].modifier_mask) {
break; break;
} }
} }
if (p) { if (t) {
p = &b->tree[t];
top = &p->succession; top = &p->succession;
} else { } else {
if( (p = (DefTree*)Xmalloc(sizeof(DefTree))) == NULL ) { while (b->treeused >= b->treesize) {
Xfree( rhs_string_mb ); DefTree *old = b->tree;
goto error; int oldsize = b->treesize;
b->treesize = b->treesize ? b->treesize * 1.5 : 256;
if (! (b->tree = Xrealloc (b->tree, sizeof(DefTree) * b->treesize)) )
goto error;
if (top >= (DTIndex *) old && top < (DTIndex *) &old[oldsize])
top = (DTIndex *) (((char *) top) + (((char *)b->tree)-(char *)old));
} }
p = &b->tree[b->treeused];
p->keysym = buf[i].keysym; p->keysym = buf[i].keysym;
p->modifier = buf[i].modifier; p->modifier = buf[i].modifier;
p->modifier_mask = buf[i].modifier_mask; p->modifier_mask = buf[i].modifier_mask;
p->succession = NULL; p->succession = 0;
p->next = *top; p->next = *top;
p->mb = NULL; p->mb = 0;
p->wc = NULL; p->wc = 0;
p->utf8 = NULL; p->utf8 = 0;
p->ks = NoSymbol; p->ks = NoSymbol;
*top = p; *top = b->treeused;
top = &p->succession; top = &p->succession;
b->treeused++;
} }
} }
if( p->mb != NULL ) /* old entries no longer freed... */
Xfree( p->mb ); p->mb = rhs_string_mb - b->mb;
p->mb = rhs_string_mb; p->wc = rhs_string_wc - b->wc;
if( p->wc != NULL ) p->utf8 = rhs_string_utf8 - b->utf8;
Xfree( p->wc ); p->ks = rhs_keysym;
p->wc = rhs_string_wc;
if( p->utf8 != NULL )
Xfree( p->utf8 );
p->utf8 = rhs_string_utf8;
p->ks = rhs_keysym;
return(n); return(n);
error: error:
while (token != ENDOFLINE && token != ENDOFFILE) { while (token != ENDOFLINE && token != ENDOFFILE) {
......
...@@ -10,7 +10,7 @@ in supporting documentation, and that the name of FUJITSU LIMITED ...@@ -10,7 +10,7 @@ in supporting documentation, and that the name of FUJITSU LIMITED
not be used in advertising or publicity pertaining to distribution not be used in advertising or publicity pertaining to distribution
of the software without specific, written prior permission. of the software without specific, written prior permission.
FUJITSU LIMITED makes no representations about the suitability of FUJITSU LIMITED makes no representations about the suitability of
this software for any purpose. this software for any purpose.
It is provided "as is" without express or implied warranty. It is provided "as is" without express or implied warranty.
FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
...@@ -21,7 +21,7 @@ USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR ...@@ -21,7 +21,7 @@ USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
Author: Takashi Fujiwara FUJITSU LIMITED Author: Takashi Fujiwara FUJITSU LIMITED
fujiwara@a80.tech.yk.fujitsu.co.jp fujiwara@a80.tech.yk.fujitsu.co.jp
******************************************************************/ ******************************************************************/
...@@ -38,9 +38,7 @@ PERFORMANCE OF THIS SOFTWARE. ...@@ -38,9 +38,7 @@ PERFORMANCE OF THIS SOFTWARE.
#include "Ximint.h" #include "Ximint.h"
Public char * Public char *
_XimLocalSetICValues(xic, values) _XimLocalSetICValues(XIC xic, XIMArg *values)
XIC xic;
XIMArg *values;
{ {
XimDefICValues ic_values; XimDefICValues ic_values;
Xic ic = (Xic)xic; Xic ic = (Xic)xic;
......
...@@ -23,7 +23,7 @@ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER ...@@ -23,7 +23,7 @@ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
Author: Takashi Fujiwara FUJITSU LIMITED Author: Takashi Fujiwara FUJITSU LIMITED
fujiwara@a80.tech.yk.fujitsu.co.jp fujiwara@a80.tech.yk.fujitsu.co.jp
Modifier: Makoto Wakamatsu Sony Corporation Modifier: Makoto Wakamatsu Sony Corporation
makoto@sm.sony.co.jp makoto@sm.sony.co.jp
...@@ -40,8 +40,10 @@ PERFORMANCE OF THIS SOFTWARE. ...@@ -40,8 +40,10 @@ PERFORMANCE OF THIS SOFTWARE.
#include "Ximint.h" #include "Ximint.h"
#include "Xresource.h" #include "Xresource.h"
#define GET_NAME(x) name_table + x.name_offset
typedef struct _XimValueOffsetInfo { typedef struct _XimValueOffsetInfo {
char *name; unsigned short name_offset;
XrmQuark quark; XrmQuark quark;
unsigned int offset; unsigned int offset;
Bool (*defaults)( Bool (*defaults)(
...@@ -94,11 +96,11 @@ _XimSetProtoResource(im) ...@@ -94,11 +96,11 @@ _XimSetProtoResource(im)
else res_class = Xmalloc (strlen (im->core.res_class) + 50); else res_class = Xmalloc (strlen (im->core.res_class) + 50);
/* pretend malloc always works */ /* pretend malloc always works */
(void) sprintf (res_name, "%s%s%s", (void) sprintf (res_name, "%s%s%s",
im->core.res_name != NULL ? im->core.res_name : "*", im->core.res_name != NULL ? im->core.res_name : "*",
im->core.res_name != NULL ? dotximdot : ximdot, im->core.res_name != NULL ? dotximdot : ximdot,
"useAuth"); "useAuth");
(void) sprintf (res_class, "%s%s%s", (void) sprintf (res_class, "%s%s%s",
im->core.res_class != NULL ? im->core.res_class : "*", im->core.res_class != NULL ? im->core.res_class : "*",
im->core.res_class != NULL ? dotXimdot : Ximdot, im->core.res_class != NULL ? dotXimdot : Ximdot,
"UseAuth"); "UseAuth");
...@@ -109,11 +111,11 @@ _XimSetProtoResource(im) ...@@ -109,11 +111,11 @@ _XimSetProtoResource(im)
} }
} }
(void) sprintf (res_name, "%s%s%s", (void) sprintf (res_name, "%s%s%s",
im->core.res_name != NULL ? im->core.res_name : "*", im->core.res_name != NULL ? im->core.res_name : "*",
im->core.res_name != NULL ? dotximdot : ximdot, im->core.res_name != NULL ? dotximdot : ximdot,
"delaybinding"); "delaybinding");
(void) sprintf (res_class, "%s%s%s", (void) sprintf (res_class, "%s%s%s",
im->core.res_class != NULL ? im->core.res_class : "*", im->core.res_class != NULL ? im->core.res_class : "*",
im->core.res_class != NULL ? dotXimdot : Ximdot, im->core.res_class != NULL ? dotXimdot : Ximdot,
"Delaybinding"); "Delaybinding");
...@@ -124,11 +126,11 @@ _XimSetProtoResource(im) ...@@ -124,11 +126,11 @@ _XimSetProtoResource(im)
} }
} }
(void) sprintf (res_name, "%s%s%s", (void) sprintf (res_name, "%s%s%s",
im->core.res_name != NULL ? im->core.res_name : "*", im->core.res_name != NULL ? im->core.res_name : "*",
im->core.res_name != NULL ? dotximdot : ximdot, im->core.res_name != NULL ? dotximdot : ximdot,
"reconnect"); "reconnect");
(void) sprintf (res_class, "%s%s%s", (void) sprintf (res_class, "%s%s%s",
im->core.res_class != NULL ? im->core.res_class : "*", im->core.res_class != NULL ? im->core.res_class : "*",
im->core.res_class != NULL ? dotXimdot : Ximdot, im->core.res_class != NULL ? dotXimdot : Ximdot,
"Reconnect"); "Reconnect");
...@@ -145,11 +147,11 @@ _XimSetProtoResource(im) ...@@ -145,11 +147,11 @@ _XimSetProtoResource(im)
return; return;
} }
(void) sprintf (res_name, "%s%s%s", (void) sprintf (res_name, "%s%s%s",
im->core.res_name != NULL ? im->core.res_name : "*", im->core.res_name != NULL ? im->core.res_name : "*",
im->core.res_name != NULL ? dotximdot : ximdot, im->core.res_name != NULL ? dotximdot : ximdot,
"preeditDefaultStyle"); "preeditDefaultStyle");
(void) sprintf (res_class, "%s%s%s", (void) sprintf (res_class, "%s%s%s",
im->core.res_class != NULL ? im->core.res_class : "*", im->core.res_class != NULL ? im->core.res_class : "*",
im->core.res_class != NULL ? dotXimdot : Ximdot, im->core.res_class != NULL ? dotXimdot : Ximdot,
"PreeditDefaultStyle"); "PreeditDefaultStyle");
...@@ -168,11 +170,11 @@ _XimSetProtoResource(im) ...@@ -168,11 +170,11 @@ _XimSetProtoResource(im)
if(!preedit_style) if(!preedit_style)
preedit_style = XIMPreeditNothing; preedit_style = XIMPreeditNothing;
(void) sprintf (res_name, "%s%s%s", (void) sprintf (res_name, "%s%s%s",
im->core.res_name != NULL ? im->core.res_name : "*", im->core.res_name != NULL ? im->core.res_name : "*",
im->core.res_name != NULL ? dotximdot : ximdot, im->core.res_name != NULL ? dotximdot : ximdot,
"statusDefaultStyle"); "statusDefaultStyle");
(void) sprintf (res_class, "%s%s%s", (void) sprintf (res_class, "%s%s%s",
im->core.res_class != NULL ? im->core.res_class : "*", im->core.res_class != NULL ? im->core.res_class : "*",
im->core.res_class != NULL ? dotXimdot : Ximdot, im->core.res_class != NULL ? dotXimdot : Ximdot,
"StatusDefaultStyle"); "StatusDefaultStyle");
...@@ -204,54 +206,136 @@ _XimSetProtoResource(im) ...@@ -204,54 +206,136 @@ _XimSetProtoResource(im)
} }
#endif /* XIM_CONNECTABLE */ #endif /* XIM_CONNECTABLE */
static char *supported_local_im_values_list[] = { static const char name_table[] =
XNQueryInputStyle, /* 0 */ XNQueryInputStyle"\0"
XNResourceName, /* 16 */ XNClientWindow"\0"
XNResourceClass, /* 29 */ XNInputStyle"\0"
XNDestroyCallback, /* 40 */ XNFocusWindow"\0"
XNQueryIMValuesList, /* 52 */ XNResourceName"\0"
XNQueryICValuesList, /* 65 */ XNResourceClass"\0"
XNVisiblePosition, /* 79 */ XNGeometryCallback"\0"
(char *)NULL /* 96 */ XNDestroyCallback"\0"
/* 112 */ XNFilterEvents"\0"
/* 125 */ XNPreeditStartCallback"\0"
/* 146 */ XNPreeditDoneCallback"\0"
/* 166 */ XNPreeditDrawCallback"\0"
/* 186 */ XNPreeditCaretCallback"\0"
/* 207 */ XNPreeditStateNotifyCallback"\0"
/* 234 */ XNPreeditAttributes"\0"
/* 252 */ XNStatusStartCallback"\0"
/* 272 */ XNStatusDoneCallback"\0"
/* 291 */ XNStatusDrawCallback"\0"
/* 310 */ XNStatusAttributes"\0"
/* 327 */ XNArea"\0"
/* 332 */ XNAreaNeeded"\0"
/* 343 */ XNSpotLocation"\0"
/* 356 */ XNColormap"\0"
/* 365 */ XNStdColormap"\0"
/* 377 */ XNForeground"\0"
/* 388 */ XNBackground"\0"
/* 399 */ XNBackgroundPixmap"\0"
/* 416 */ XNFontSet"\0"
/* 424 */ XNLineSpace"\0"
/* 434 */ XNCursor"\0"
/* 441 */ XNQueryIMValuesList"\0"
/* 459 */ XNQueryICValuesList"\0"
/* 477 */ XNVisiblePosition"\0"
/* 493 */ XNStringConversionCallback"\0"
/* 518 */ XNStringConversion"\0"
/* 535 */ XNResetState"\0"
/* 546 */ XNHotKey"\0"
/* 553 */ XNHotKeyState"\0"
/* 565 */ XNPreeditState
;
#define OFFSET_XNQUERYINPUTSTYLE 0
#define OFFSET_XNCLIENTWINDOW 16
#define OFFSET_XNINPUTSTYLE 29
#define OFFSET_XNFOCUSWINDOW 40
#define OFFSET_XNRESOURCENAME 52
#define OFFSET_XNRESOURCECLASS 65
#define OFFSET_XNGEOMETRYCALLBACK 79
#define OFFSET_XNDESTROYCALLBACK 96
#define OFFSET_XNFILTEREVENTS 112
#define OFFSET_XNPREEDITSTARTCALLBACK 125
#define OFFSET_XNPREEDITDONECALLBACK 146
#define OFFSET_XNPREEDITDRAWCALLBACK 166
#define OFFSET_XNPREEDITCARETCALLBACK 186
#define OFFSET_XNPREEDITSTATENOTIFYCALLBACK 207
#define OFFSET_XNPREEDITATTRIBUTES 234
#define OFFSET_XNSTATUSSTARTCALLBACK 252
#define OFFSET_XNSTATUSDONECALLBACK 272
#define OFFSET_XNSTATUSDRAWCALLBACK 291
#define OFFSET_XNSTATUSATTRIBUTES 310
#define OFFSET_XNAREA 327
#define OFFSET_XNAREANEEDED 332
#define OFFSET_XNSPOTLOCATION 343
#define OFFSET_XNCOLORMAP 356
#define OFFSET_XNSTDCOLORMAP 365
#define OFFSET_XNFOREGROUND 377
#define OFFSET_XNBACKGROUND 388
#define OFFSET_XNBACKGROUNDPIXMAP 399
#define OFFSET_XNFONTSET 416
#define OFFSET_XNLINESPACE 424
#define OFFSET_XNCURSOR 434
#define OFFSET_XNQUERYIMVALUESLIST 441
#define OFFSET_XNQUERYICVALUESLIST 459
#define OFFSET_XNVISIBLEPOSITION 477
#define OFFSET_XNSTRINGCONVERSIONCALLBACK 493
#define OFFSET_XNSTRINGCONVERSION 518
#define OFFSET_XNRESETSTATE 535
#define OFFSET_XNHOTKEY 546
#define OFFSET_XNHOTKEYSTATE 553
#define OFFSET_XNPREEDITSTATE 565
/* offsets into name_table */
static const unsigned short supported_local_im_values_list[] = {
OFFSET_XNQUERYINPUTSTYLE,
OFFSET_XNRESOURCENAME,
OFFSET_XNRESOURCECLASS,
OFFSET_XNDESTROYCALLBACK,
OFFSET_XNQUERYIMVALUESLIST,
OFFSET_XNQUERYICVALUESLIST,
OFFSET_XNVISIBLEPOSITION
}; };
static char *supported_local_ic_values_list[] = { /* offsets into name_table */
XNInputStyle, static const unsigned short supported_local_ic_values_list[] = {
XNClientWindow, OFFSET_XNINPUTSTYLE,
XNFocusWindow, OFFSET_XNCLIENTWINDOW,
XNResourceName, OFFSET_XNFOCUSWINDOW,
XNResourceClass, OFFSET_XNRESOURCENAME,
XNGeometryCallback, OFFSET_XNRESOURCECLASS,
XNFilterEvents, OFFSET_XNGEOMETRYCALLBACK,
XNDestroyCallback, OFFSET_XNFILTEREVENTS,
XNStringConversionCallback, OFFSET_XNDESTROYCALLBACK,
XNStringConversion, OFFSET_XNSTRINGCONVERSIONCALLBACK,
XNResetState, OFFSET_XNSTRINGCONVERSIONCALLBACK,
XNHotKey, OFFSET_XNRESETSTATE,
XNHotKeyState, OFFSET_XNHOTKEY,
XNPreeditAttributes, OFFSET_XNHOTKEYSTATE,
XNStatusAttributes, OFFSET_XNPREEDITATTRIBUTES,
XNArea, OFFSET_XNSTATUSATTRIBUTES,
XNAreaNeeded, OFFSET_XNAREA,
XNSpotLocation, OFFSET_XNAREANEEDED,
XNColormap, OFFSET_XNSPOTLOCATION,
XNStdColormap, OFFSET_XNCOLORMAP,
XNForeground, OFFSET_XNSTDCOLORMAP,
XNBackground, OFFSET_XNFOREGROUND,
XNBackgroundPixmap, OFFSET_XNBACKGROUND,
XNFontSet, OFFSET_XNBACKGROUNDPIXMAP,
XNLineSpace, OFFSET_XNFONTSET,
XNCursor, OFFSET_XNLINESPACE,
XNPreeditStartCallback, OFFSET_XNCURSOR,
XNPreeditDoneCallback, OFFSET_XNPREEDITSTARTCALLBACK,
XNPreeditDrawCallback, OFFSET_XNPREEDITDONECALLBACK,
XNPreeditCaretCallback, OFFSET_XNPREEDITDRAWCALLBACK,
XNStatusStartCallback, OFFSET_XNPREEDITCARETCALLBACK,
XNStatusDoneCallback, OFFSET_XNSTATUSSTARTCALLBACK,
XNStatusDrawCallback, OFFSET_XNSTATUSDONECALLBACK,
XNPreeditState, OFFSET_XNSTATUSDRAWCALLBACK,
XNPreeditStateNotifyCallback, OFFSET_XNPREEDITSTATE,
(char *)NULL OFFSET_XNPREEDITSTATENOTIFYCALLBACK
}; };
static XIMStyle const supported_local_styles[] = { static XIMStyle const supported_local_styles[] = {
...@@ -310,7 +394,7 @@ _XimDefaultIMValues( ...@@ -310,7 +394,7 @@ _XimDefaultIMValues(
int len; int len;
XPointer tmp; XPointer tmp;
n = XIMNumber(supported_local_im_values_list) - 1; n = XIMNumber(supported_local_im_values_list);
len = sizeof(XIMValuesList) + sizeof(char **) * n; len = sizeof(XIMValuesList) + sizeof(char **) * n;
if(!(tmp = (XPointer)Xmalloc(len))) { if(!(tmp = (XPointer)Xmalloc(len))) {
return False; return False;
...@@ -323,8 +407,8 @@ _XimDefaultIMValues( ...@@ -323,8 +407,8 @@ _XimDefaultIMValues(
values_list->supported_values values_list->supported_values
= (char **)((char *)tmp + sizeof(XIMValuesList)); = (char **)((char *)tmp + sizeof(XIMValuesList));
for(i = 0; i < n; i++) { for(i = 0; i < n; i++) {
values_list->supported_values[i] values_list->supported_values[i] =
= supported_local_im_values_list[i]; (char *)name_table + supported_local_im_values_list[i];
} }
} }
...@@ -347,7 +431,7 @@ _XimDefaultICValues( ...@@ -347,7 +431,7 @@ _XimDefaultICValues(
int len; int len;
XPointer tmp; XPointer tmp;
n = XIMNumber(supported_local_ic_values_list) - 1; n = XIMNumber(supported_local_ic_values_list);
len = sizeof(XIMValuesList) + sizeof(char **) * n; len = sizeof(XIMValuesList) + sizeof(char **) * n;
if(!(tmp = (XPointer)Xmalloc(len))) { if(!(tmp = (XPointer)Xmalloc(len))) {
return False; return False;
...@@ -360,8 +444,8 @@ _XimDefaultICValues( ...@@ -360,8 +444,8 @@ _XimDefaultICValues(
values_list->supported_values values_list->supported_values
= (char **)((char *)tmp + sizeof(XIMValuesList)); = (char **)((char *)tmp + sizeof(XIMValuesList));
for(i = 0; i < n; i++) { for(i = 0; i < n; i++) {
values_list->supported_values[i] values_list->supported_values[i] =
= supported_local_ic_values_list[i]; (char *)name_table + supported_local_ic_values_list[i];
} }
} }
...@@ -510,7 +594,7 @@ _XimDefaultArea( ...@@ -510,7 +594,7 @@ _XimDefaultArea(
if(XGetGeometry(im->core.display, (Drawable)ic->core.focus_window, if(XGetGeometry(im->core.display, (Drawable)ic->core.focus_window,
&root_return, &x_return, &y_return, &width_return, &root_return, &x_return, &y_return, &width_return,
&height_return, &border_width_return, &depth_return) &height_return, &border_width_return, &depth_return)
== (Status)NULL) { == (Status)Success) {
return True; return True;
} }
area.x = 0; area.x = 0;
...@@ -539,10 +623,10 @@ _XimDefaultColormap( ...@@ -539,10 +623,10 @@ _XimDefaultColormap(
return True; return True;
} }
if(XGetWindowAttributes(im->core.display, ic->core.client_window, if(XGetWindowAttributes(im->core.display, ic->core.client_window,
&win_attr) == (Status)NULL) { &win_attr) == (Status)Success) {
return True; return True;
} }
out = (Colormap *)((char *)top + info->offset); out = (Colormap *)((char *)top + info->offset);
*out = win_attr.colormap; *out = win_attr.colormap;
return True; return True;
...@@ -1010,7 +1094,7 @@ _XimDecodeStyles( ...@@ -1010,7 +1094,7 @@ _XimDecodeStyles(
if(num >0) { if(num >0) {
out->count_styles = (unsigned short)num; out->count_styles = (unsigned short)num;
out->supported_styles = (XIMStyle *)((char *)tmp + sizeof(XIMStyles)); out->supported_styles = (XIMStyle *)((char *)tmp + sizeof(XIMStyles));
for(i = 0; i < num; i++) { for(i = 0; i < num; i++) {
out->supported_styles[i] = styles->supported_styles[i]; out->supported_styles[i] = styles->supported_styles[i];
} }
...@@ -1049,7 +1133,7 @@ _XimDecodeValues( ...@@ -1049,7 +1133,7 @@ _XimDecodeValues(
if(num) { if(num) {
out->count_values = (unsigned short)num; out->count_values = (unsigned short)num;
out->supported_values = (char **)((char *)tmp + sizeof(XIMValuesList)); out->supported_values = (char **)((char *)tmp + sizeof(XIMValuesList));
for(i = 0; i < num; i++) { for(i = 0; i < num; i++) {
out->supported_values[i] = values_list->supported_values[i]; out->supported_values[i] = values_list->supported_values[i];
} }
...@@ -1437,247 +1521,245 @@ static XIMResource ic_inner_resources[] = { ...@@ -1437,247 +1521,245 @@ static XIMResource ic_inner_resources[] = {
}; };
static XimValueOffsetInfoRec im_attr_info[] = { static XimValueOffsetInfoRec im_attr_info[] = {
{XNQueryInputStyle, 0, {OFFSET_XNQUERYINPUTSTYLE, 0,
XOffsetOf(XimDefIMValues, styles), XOffsetOf(XimDefIMValues, styles),
_XimDefaultStyles, NULL, _XimDecodeStyles}, _XimDefaultStyles, NULL, _XimDecodeStyles},
{XNDestroyCallback, 0, {OFFSET_XNDESTROYCALLBACK, 0,
XOffsetOf(XimDefIMValues, destroy_callback), XOffsetOf(XimDefIMValues, destroy_callback),
NULL, _XimEncodeCallback, _XimDecodeCallback}, NULL, _XimEncodeCallback, _XimDecodeCallback},
{XNResourceName, 0, {OFFSET_XNRESOURCENAME, 0,
XOffsetOf(XimDefIMValues, res_name), XOffsetOf(XimDefIMValues, res_name),
NULL, _XimEncodeString, _XimDecodeString}, NULL, _XimEncodeString, _XimDecodeString},
{XNResourceClass, 0, {OFFSET_XNRESOURCECLASS, 0,
XOffsetOf(XimDefIMValues, res_class), XOffsetOf(XimDefIMValues, res_class),
NULL, _XimEncodeString, _XimDecodeString}, NULL, _XimEncodeString, _XimDecodeString},
{XNQueryIMValuesList, 0, {OFFSET_XNQUERYIMVALUESLIST, 0,
XOffsetOf(XimDefIMValues, im_values_list), XOffsetOf(XimDefIMValues, im_values_list),
_XimDefaultIMValues, NULL, _XimDecodeValues}, _XimDefaultIMValues, NULL, _XimDecodeValues},
{XNQueryICValuesList, 0, {OFFSET_XNQUERYICVALUESLIST, 0,
XOffsetOf(XimDefIMValues, ic_values_list), XOffsetOf(XimDefIMValues, ic_values_list),
_XimDefaultICValues, NULL, _XimDecodeValues}, _XimDefaultICValues, NULL, _XimDecodeValues},
{XNVisiblePosition, 0, {OFFSET_XNVISIBLEPOSITION, 0,
XOffsetOf(XimDefIMValues, visible_position), XOffsetOf(XimDefIMValues, visible_position),
_XimDefaultVisiblePos, NULL, _XimDecodeBool} _XimDefaultVisiblePos, NULL, _XimDecodeBool}
}; };
static XimValueOffsetInfoRec ic_attr_info[] = { static XimValueOffsetInfoRec ic_attr_info[] = {
{XNInputStyle, 0, {OFFSET_XNINPUTSTYLE, 0,
XOffsetOf(XimDefICValues, input_style), XOffsetOf(XimDefICValues, input_style),
NULL, _XimEncodeStyle, _XimDecodeStyle}, NULL, _XimEncodeStyle, _XimDecodeStyle},
{XNClientWindow, 0, {OFFSET_XNCLIENTWINDOW, 0,
XOffsetOf(XimDefICValues, client_window), XOffsetOf(XimDefICValues, client_window),
NULL, _XimEncodeWindow, _XimDecodeWindow}, NULL, _XimEncodeWindow, _XimDecodeWindow},
{XNFocusWindow, 0, {OFFSET_XNFOCUSWINDOW, 0,
XOffsetOf(XimDefICValues, focus_window), XOffsetOf(XimDefICValues, focus_window),
_XimDefaultFocusWindow, _XimEncodeWindow, _XimDecodeWindow}, _XimDefaultFocusWindow, _XimEncodeWindow, _XimDecodeWindow},
{XNResourceName, 0, {OFFSET_XNRESOURCENAME, 0,
XOffsetOf(XimDefICValues, res_name), XOffsetOf(XimDefICValues, res_name),
_XimDefaultResName, _XimEncodeString, _XimDecodeString}, _XimDefaultResName, _XimEncodeString, _XimDecodeString},
{XNResourceClass, 0, {OFFSET_XNRESOURCECLASS, 0,
XOffsetOf(XimDefICValues, res_class), XOffsetOf(XimDefICValues, res_class),
_XimDefaultResClass, _XimEncodeString, _XimDecodeString}, _XimDefaultResClass, _XimEncodeString, _XimDecodeString},
{XNGeometryCallback, 0, {OFFSET_XNGEOMETRYCALLBACK, 0,
XOffsetOf(XimDefICValues, geometry_callback), XOffsetOf(XimDefICValues, geometry_callback),
NULL, _XimEncodeCallback, _XimDecodeCallback}, NULL, _XimEncodeCallback, _XimDecodeCallback},
{XNFilterEvents, 0, {OFFSET_XNFILTEREVENTS, 0,
XOffsetOf(XimDefICValues, filter_events), XOffsetOf(XimDefICValues, filter_events),
NULL, NULL, _XimDecodeLong}, NULL, NULL, _XimDecodeLong},
{XNDestroyCallback, 0, {OFFSET_XNDESTROYCALLBACK, 0,
XOffsetOf(XimDefICValues, destroy_callback), XOffsetOf(XimDefICValues, destroy_callback),
_XimDefaultDestroyCB, _XimEncodeCallback, _XimDecodeCallback}, _XimDefaultDestroyCB, _XimEncodeCallback, _XimDecodeCallback},
{XNStringConversionCallback, 0, {OFFSET_XNSTRINGCONVERSIONCALLBACK, 0,
XOffsetOf(XimDefICValues, string_conversion_callback), XOffsetOf(XimDefICValues, string_conversion_callback),
NULL, _XimEncodeCallback, _XimDecodeCallback}, NULL, _XimEncodeCallback, _XimDecodeCallback},
{XNStringConversion, 0, {OFFSET_XNSTRINGCONVERSION, 0,
XOffsetOf(XimDefICValues, string_conversion), XOffsetOf(XimDefICValues, string_conversion),
NULL, _XimEncodeStringConv, _XimDecodeStringConv}, NULL, _XimEncodeStringConv, _XimDecodeStringConv},
{XNResetState, 0, {OFFSET_XNRESETSTATE, 0,
XOffsetOf(XimDefICValues, reset_state), XOffsetOf(XimDefICValues, reset_state),
_XimDefaultResetState, _XimEncodeResetState, _XimDecodeResetState}, _XimDefaultResetState, _XimEncodeResetState, _XimDecodeResetState},
{XNHotKey, 0, {OFFSET_XNHOTKEY, 0,
XOffsetOf(XimDefICValues, hotkey), XOffsetOf(XimDefICValues, hotkey),
NULL, _XimEncodeHotKey, _XimDecodeHotKey}, NULL, _XimEncodeHotKey, _XimDecodeHotKey},
{XNHotKeyState, 0, {OFFSET_XNHOTKEYSTATE, 0,
XOffsetOf(XimDefICValues, hotkey_state), XOffsetOf(XimDefICValues, hotkey_state),
_XimDefaultHotKeyState, _XimEncodeHotKetState, _XimDecodeHotKetState}, _XimDefaultHotKeyState, _XimEncodeHotKetState, _XimDecodeHotKetState},
{XNPreeditAttributes, 0, {OFFSET_XNPREEDITATTRIBUTES, 0,
XOffsetOf(XimDefICValues, preedit_attr), XOffsetOf(XimDefICValues, preedit_attr),
_XimDefaultNest, _XimEncodeNest, _XimDecodeNest}, _XimDefaultNest, _XimEncodeNest, _XimDecodeNest},
{XNStatusAttributes, 0, {OFFSET_XNSTATUSATTRIBUTES, 0,
XOffsetOf(XimDefICValues, status_attr), XOffsetOf(XimDefICValues, status_attr),
_XimDefaultNest, _XimEncodeNest, _XimDecodeNest}, _XimDefaultNest, _XimEncodeNest, _XimDecodeNest},
}; };
static XimValueOffsetInfoRec ic_pre_attr_info[] = { static XimValueOffsetInfoRec ic_pre_attr_info[] = {
{XNArea, 0, {OFFSET_XNAREA, 0,
XOffsetOf(ICPreeditAttributes, area), XOffsetOf(ICPreeditAttributes, area),
_XimDefaultArea, _XimEncodeRectangle, _XimDecodeRectangle}, _XimDefaultArea, _XimEncodeRectangle, _XimDecodeRectangle},
{XNAreaNeeded, 0, {OFFSET_XNAREANEEDED, 0,
XOffsetOf(ICPreeditAttributes, area_needed), XOffsetOf(ICPreeditAttributes, area_needed),
NULL, _XimEncodeRectangle, _XimDecodeRectangle}, NULL, _XimEncodeRectangle, _XimDecodeRectangle},
{XNSpotLocation, 0, {OFFSET_XNSPOTLOCATION, 0,
XOffsetOf(ICPreeditAttributes, spot_location), XOffsetOf(ICPreeditAttributes, spot_location),
NULL, _XimEncodeSpot, _XimDecodeSpot}, NULL, _XimEncodeSpot, _XimDecodeSpot},
{XNColormap, 0, {OFFSET_XNCOLORMAP, 0,
XOffsetOf(ICPreeditAttributes, colormap), XOffsetOf(ICPreeditAttributes, colormap),
_XimDefaultColormap, _XimEncodeColormap, _XimDecodeColormap}, _XimDefaultColormap, _XimEncodeColormap, _XimDecodeColormap},
{XNStdColormap, 0, {OFFSET_XNSTDCOLORMAP, 0,
XOffsetOf(ICPreeditAttributes, std_colormap), XOffsetOf(ICPreeditAttributes, std_colormap),
_XimDefaultStdColormap, _XimEncodeStdColormap, _XimDecodeStdColormap}, _XimDefaultStdColormap, _XimEncodeStdColormap, _XimDecodeStdColormap},
{XNForeground, 0, {OFFSET_XNFOREGROUND, 0,
XOffsetOf(ICPreeditAttributes, foreground), XOffsetOf(ICPreeditAttributes, foreground),
_XimDefaultFg, _XimEncodeLong, _XimDecodeLong}, _XimDefaultFg, _XimEncodeLong, _XimDecodeLong},
{XNBackground, 0, {OFFSET_XNBACKGROUND, 0,
XOffsetOf(ICPreeditAttributes, background), XOffsetOf(ICPreeditAttributes, background),
_XimDefaultBg, _XimEncodeLong, _XimDecodeLong}, _XimDefaultBg, _XimEncodeLong, _XimDecodeLong},
{XNBackgroundPixmap, 0, {OFFSET_XNBACKGROUNDPIXMAP, 0,
XOffsetOf(ICPreeditAttributes, background_pixmap), XOffsetOf(ICPreeditAttributes, background_pixmap),
_XimDefaultBgPixmap, _XimEncodeBgPixmap, _XimDecodeBgPixmap}, _XimDefaultBgPixmap, _XimEncodeBgPixmap, _XimDecodeBgPixmap},
{XNFontSet, 0, {OFFSET_XNFONTSET, 0,
XOffsetOf(ICPreeditAttributes, fontset), XOffsetOf(ICPreeditAttributes, fontset),
_XimDefaultFontSet, _XimEncodeFontSet, _XimDecodeFontSet}, _XimDefaultFontSet, _XimEncodeFontSet, _XimDecodeFontSet},
{XNLineSpace, 0, {OFFSET_XNLINESPACE, 0,
XOffsetOf(ICPreeditAttributes, line_spacing), XOffsetOf(ICPreeditAttributes, line_spacing),
_XimDefaultLineSpace, _XimEncodeLineSpace, _XimDecodeLineSpace}, _XimDefaultLineSpace, _XimEncodeLineSpace, _XimDecodeLineSpace},
{XNCursor, 0, {OFFSET_XNCURSOR, 0,
XOffsetOf(ICPreeditAttributes, cursor), XOffsetOf(ICPreeditAttributes, cursor),
_XimDefaultCursor, _XimEncodeCursor, _XimDecodeCursor}, _XimDefaultCursor, _XimEncodeCursor, _XimDecodeCursor},
{XNPreeditStartCallback, 0, {OFFSET_XNPREEDITSTARTCALLBACK, 0,
XOffsetOf(ICPreeditAttributes, start_callback), XOffsetOf(ICPreeditAttributes, start_callback),
NULL, _XimEncodeCallback, _XimDecodeCallback}, NULL, _XimEncodeCallback, _XimDecodeCallback},
{XNPreeditDoneCallback, 0, {OFFSET_XNPREEDITDONECALLBACK, 0,
XOffsetOf(ICPreeditAttributes, done_callback), XOffsetOf(ICPreeditAttributes, done_callback),
NULL, _XimEncodeCallback, _XimDecodeCallback}, NULL, _XimEncodeCallback, _XimDecodeCallback},
{XNPreeditDrawCallback, 0, {OFFSET_XNPREEDITDRAWCALLBACK, 0,
XOffsetOf(ICPreeditAttributes, draw_callback), XOffsetOf(ICPreeditAttributes, draw_callback),
NULL, _XimEncodeCallback, _XimDecodeCallback}, NULL, _XimEncodeCallback, _XimDecodeCallback},
{XNPreeditCaretCallback, 0, {OFFSET_XNPREEDITCARETCALLBACK, 0,
XOffsetOf(ICPreeditAttributes, caret_callback), XOffsetOf(ICPreeditAttributes, caret_callback),
NULL, _XimEncodeCallback, _XimDecodeCallback}, NULL, _XimEncodeCallback, _XimDecodeCallback},
{XNPreeditState, 0, {OFFSET_XNPREEDITSTATE, 0,
XOffsetOf(ICPreeditAttributes, preedit_state), XOffsetOf(ICPreeditAttributes, preedit_state),
_XimDefaultPreeditState, _XimEncodePreeditState,_XimDecodePreeditState}, _XimDefaultPreeditState, _XimEncodePreeditState,_XimDecodePreeditState},
{XNPreeditStateNotifyCallback, 0, {OFFSET_XNPREEDITSTATENOTIFYCALLBACK, 0,
XOffsetOf(ICPreeditAttributes, state_notify_callback), XOffsetOf(ICPreeditAttributes, state_notify_callback),
NULL, _XimEncodeCallback, _XimDecodeCallback}, NULL, _XimEncodeCallback, _XimDecodeCallback},
}; };
static XimValueOffsetInfoRec ic_sts_attr_info[] = { static XimValueOffsetInfoRec ic_sts_attr_info[] = {
{XNArea, 0, {OFFSET_XNAREA, 0,
XOffsetOf(ICStatusAttributes, area), XOffsetOf(ICStatusAttributes, area),
_XimDefaultArea, _XimEncodeRectangle, _XimDecodeRectangle}, _XimDefaultArea, _XimEncodeRectangle, _XimDecodeRectangle},
{XNAreaNeeded, 0, {OFFSET_XNAREANEEDED, 0,
XOffsetOf(ICStatusAttributes, area_needed), XOffsetOf(ICStatusAttributes, area_needed),
NULL, _XimEncodeRectangle, _XimDecodeRectangle}, NULL, _XimEncodeRectangle, _XimDecodeRectangle},
{XNColormap, 0, {OFFSET_XNCOLORMAP, 0,
XOffsetOf(ICStatusAttributes, colormap), XOffsetOf(ICStatusAttributes, colormap),
_XimDefaultColormap, _XimEncodeColormap, _XimDecodeColormap}, _XimDefaultColormap, _XimEncodeColormap, _XimDecodeColormap},
{XNStdColormap, 0, {OFFSET_XNSTDCOLORMAP, 0,
XOffsetOf(ICStatusAttributes, std_colormap), XOffsetOf(ICStatusAttributes, std_colormap),
_XimDefaultStdColormap, _XimEncodeStdColormap, _XimDecodeStdColormap}, _XimDefaultStdColormap, _XimEncodeStdColormap, _XimDecodeStdColormap},
{XNForeground, 0, {OFFSET_XNFOREGROUND, 0,
XOffsetOf(ICStatusAttributes, foreground), XOffsetOf(ICStatusAttributes, foreground),
_XimDefaultFg, _XimEncodeLong, _XimDecodeLong}, _XimDefaultFg, _XimEncodeLong, _XimDecodeLong},
{XNBackground, 0, {OFFSET_XNBACKGROUND, 0,
XOffsetOf(ICStatusAttributes, background), XOffsetOf(ICStatusAttributes, background),
_XimDefaultBg, _XimEncodeLong, _XimDecodeLong}, _XimDefaultBg, _XimEncodeLong, _XimDecodeLong},
{XNBackgroundPixmap, 0, {OFFSET_XNBACKGROUNDPIXMAP, 0,
XOffsetOf(ICStatusAttributes, background_pixmap), XOffsetOf(ICStatusAttributes, background_pixmap),
_XimDefaultBgPixmap, _XimEncodeBgPixmap, _XimDecodeBgPixmap}, _XimDefaultBgPixmap, _XimEncodeBgPixmap, _XimDecodeBgPixmap},
{XNFontSet, 0, {OFFSET_XNFONTSET, 0,
XOffsetOf(ICStatusAttributes, fontset), XOffsetOf(ICStatusAttributes, fontset),
_XimDefaultFontSet, _XimEncodeFontSet, _XimDecodeFontSet}, _XimDefaultFontSet, _XimEncodeFontSet, _XimDecodeFontSet},
{XNLineSpace, 0, {OFFSET_XNLINESPACE, 0,
XOffsetOf(ICStatusAttributes, line_spacing), XOffsetOf(ICStatusAttributes, line_spacing),
_XimDefaultLineSpace, _XimEncodeLineSpace, _XimDecodeLineSpace}, _XimDefaultLineSpace, _XimEncodeLineSpace, _XimDecodeLineSpace},
{XNCursor, 0, {OFFSET_XNCURSOR, 0,
XOffsetOf(ICStatusAttributes, cursor), XOffsetOf(ICStatusAttributes, cursor),
_XimDefaultCursor, _XimEncodeCursor, _XimDecodeCursor}, _XimDefaultCursor, _XimEncodeCursor, _XimDecodeCursor},
{XNStatusStartCallback, 0, {OFFSET_XNSTATUSSTARTCALLBACK, 0,
XOffsetOf(ICStatusAttributes, start_callback), XOffsetOf(ICStatusAttributes, start_callback),
NULL, _XimEncodeCallback, _XimDecodeCallback}, NULL, _XimEncodeCallback, _XimDecodeCallback},
{XNStatusDoneCallback, 0, {OFFSET_XNSTATUSDONECALLBACK, 0,
XOffsetOf(ICStatusAttributes, done_callback), XOffsetOf(ICStatusAttributes, done_callback),
NULL, _XimEncodeCallback, _XimDecodeCallback}, NULL, _XimEncodeCallback, _XimDecodeCallback},
{XNStatusDrawCallback, 0, {OFFSET_XNSTATUSDRAWCALLBACK, 0,
XOffsetOf(ICStatusAttributes, draw_callback), XOffsetOf(ICStatusAttributes, draw_callback),
NULL, _XimEncodeCallback, _XimDecodeCallback} NULL, _XimEncodeCallback, _XimDecodeCallback}
}; };
typedef struct _XimIMMode { typedef struct _XimIMMode {
char *name; unsigned short name_offset;
XrmQuark quark;
unsigned short mode; unsigned short mode;
} XimIMMode; } XimIMMode;
static XimIMMode im_mode[] = { static const XimIMMode im_mode[] = {
{XNQueryInputStyle, 0, {OFFSET_XNQUERYINPUTSTYLE,
(XIM_MODE_IM_DEFAULT | XIM_MODE_IM_GET)}, (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_GET)},
{XNDestroyCallback, 0, {OFFSET_XNDESTROYCALLBACK,
(XIM_MODE_IM_DEFAULT | XIM_MODE_IM_SET | XIM_MODE_IM_GET)}, (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_SET | XIM_MODE_IM_GET)},
{XNResourceName, 0, {OFFSET_XNRESOURCENAME,
(XIM_MODE_IM_DEFAULT | XIM_MODE_IM_SET | XIM_MODE_IM_GET)}, (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_SET | XIM_MODE_IM_GET)},
{XNResourceClass, 0, {OFFSET_XNRESOURCECLASS,
(XIM_MODE_IM_DEFAULT | XIM_MODE_IM_SET | XIM_MODE_IM_GET)}, (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_SET | XIM_MODE_IM_GET)},
{XNQueryIMValuesList, 0, {OFFSET_XNQUERYIMVALUESLIST,
(XIM_MODE_IM_DEFAULT | XIM_MODE_IM_GET)}, (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_GET)},
{XNQueryICValuesList, 0, {OFFSET_XNQUERYICVALUESLIST,
(XIM_MODE_IM_DEFAULT | XIM_MODE_IM_GET)}, (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_GET)},
{XNVisiblePosition, 0, {OFFSET_XNVISIBLEPOSITION,
(XIM_MODE_IM_DEFAULT | XIM_MODE_IM_GET)} (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_GET)}
}; };
typedef struct _XimICMode { typedef struct _XimICMode {
char *name; unsigned short name_offset;
XrmQuark quark;
unsigned short preedit_callback_mode; unsigned short preedit_callback_mode;
unsigned short preedit_position_mode; unsigned short preedit_position_mode;
unsigned short preedit_area_mode; unsigned short preedit_area_mode;
...@@ -1689,8 +1771,8 @@ typedef struct _XimICMode { ...@@ -1689,8 +1771,8 @@ typedef struct _XimICMode {
unsigned short status_none_mode; unsigned short status_none_mode;
} XimICMode; } XimICMode;
static XimICMode ic_mode[] = { static const XimICMode ic_mode[] = {
{XNInputStyle, 0, {OFFSET_XNINPUTSTYLE,
(XIM_MODE_PRE_CREATE | XIM_MODE_PRE_GET), (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_CREATE | XIM_MODE_PRE_GET), (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_CREATE | XIM_MODE_PRE_GET), (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_GET),
...@@ -1700,7 +1782,7 @@ static XimICMode ic_mode[] = { ...@@ -1700,7 +1782,7 @@ static XimICMode ic_mode[] = {
(XIM_MODE_STS_CREATE | XIM_MODE_STS_GET), (XIM_MODE_STS_CREATE | XIM_MODE_STS_GET),
(XIM_MODE_STS_CREATE | XIM_MODE_STS_GET), (XIM_MODE_STS_CREATE | XIM_MODE_STS_GET),
(XIM_MODE_STS_CREATE | XIM_MODE_STS_GET)}, (XIM_MODE_STS_CREATE | XIM_MODE_STS_GET)},
{XNClientWindow, 0, {OFFSET_XNCLIENTWINDOW,
(XIM_MODE_PRE_ONCE | XIM_MODE_PRE_GET), (XIM_MODE_PRE_ONCE | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_ONCE | XIM_MODE_PRE_GET), (XIM_MODE_PRE_ONCE | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_ONCE | XIM_MODE_PRE_GET), (XIM_MODE_PRE_ONCE | XIM_MODE_PRE_GET),
...@@ -1710,7 +1792,7 @@ static XimICMode ic_mode[] = { ...@@ -1710,7 +1792,7 @@ static XimICMode ic_mode[] = {
(XIM_MODE_STS_ONCE | XIM_MODE_STS_GET), (XIM_MODE_STS_ONCE | XIM_MODE_STS_GET),
(XIM_MODE_STS_ONCE | XIM_MODE_STS_GET), (XIM_MODE_STS_ONCE | XIM_MODE_STS_GET),
0}, 0},
{XNFocusWindow, 0, {OFFSET_XNFOCUSWINDOW,
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
...@@ -1720,7 +1802,7 @@ static XimICMode ic_mode[] = { ...@@ -1720,7 +1802,7 @@ static XimICMode ic_mode[] = {
(XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET),
(XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET),
0}, 0},
{XNResourceName, 0, {OFFSET_XNRESOURCENAME,
0, 0,
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
...@@ -1730,7 +1812,7 @@ static XimICMode ic_mode[] = { ...@@ -1730,7 +1812,7 @@ static XimICMode ic_mode[] = {
(XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET),
(XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET),
0}, 0},
{XNResourceClass, 0, {OFFSET_XNRESOURCECLASS,
0, 0,
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
...@@ -1740,7 +1822,7 @@ static XimICMode ic_mode[] = { ...@@ -1740,7 +1822,7 @@ static XimICMode ic_mode[] = {
(XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET),
(XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET),
0}, 0},
{XNGeometryCallback, 0, {OFFSET_XNGEOMETRYCALLBACK,
0, 0,
0, 0,
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
...@@ -1750,7 +1832,7 @@ static XimICMode ic_mode[] = { ...@@ -1750,7 +1832,7 @@ static XimICMode ic_mode[] = {
(XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET),
0, 0,
0}, 0},
{XNFilterEvents, 0, {OFFSET_XNFILTEREVENTS,
XIM_MODE_PRE_GET, XIM_MODE_PRE_GET,
XIM_MODE_PRE_GET, XIM_MODE_PRE_GET,
XIM_MODE_PRE_GET, XIM_MODE_PRE_GET,
...@@ -1760,7 +1842,7 @@ static XimICMode ic_mode[] = { ...@@ -1760,7 +1842,7 @@ static XimICMode ic_mode[] = {
XIM_MODE_STS_GET, XIM_MODE_STS_GET,
XIM_MODE_STS_GET, XIM_MODE_STS_GET,
XIM_MODE_STS_GET}, XIM_MODE_STS_GET},
{XNDestroyCallback, 0, {OFFSET_XNDESTROYCALLBACK,
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
...@@ -1770,7 +1852,7 @@ static XimICMode ic_mode[] = { ...@@ -1770,7 +1852,7 @@ static XimICMode ic_mode[] = {
0, 0,
0, 0,
0}, 0},
{XNStringConversionCallback, 0, {OFFSET_XNSTRINGCONVERSIONCALLBACK,
(XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
...@@ -1780,7 +1862,7 @@ static XimICMode ic_mode[] = { ...@@ -1780,7 +1862,7 @@ static XimICMode ic_mode[] = {
0, 0,
0, 0,
0}, 0},
{XNStringConversion, 0, {OFFSET_XNSTRINGCONVERSION,
XIM_MODE_PRE_SET, XIM_MODE_PRE_SET,
XIM_MODE_PRE_SET, XIM_MODE_PRE_SET,
XIM_MODE_PRE_SET, XIM_MODE_PRE_SET,
...@@ -1790,7 +1872,7 @@ static XimICMode ic_mode[] = { ...@@ -1790,7 +1872,7 @@ static XimICMode ic_mode[] = {
0, 0,
0, 0,
0}, 0},
{XNResetState, 0, {OFFSET_XNRESETSTATE,
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
...@@ -1800,7 +1882,7 @@ static XimICMode ic_mode[] = { ...@@ -1800,7 +1882,7 @@ static XimICMode ic_mode[] = {
0, 0,
0, 0,
0}, 0},
{XNHotKey, 0, {OFFSET_XNHOTKEY,
(XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
...@@ -1810,7 +1892,7 @@ static XimICMode ic_mode[] = { ...@@ -1810,7 +1892,7 @@ static XimICMode ic_mode[] = {
0, 0,
0, 0,
0}, 0},
{XNHotKeyState, 0, {OFFSET_XNHOTKEYSTATE,
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
...@@ -1820,7 +1902,7 @@ static XimICMode ic_mode[] = { ...@@ -1820,7 +1902,7 @@ static XimICMode ic_mode[] = {
0, 0,
0, 0,
0}, 0},
{XNPreeditAttributes, 0, {OFFSET_XNPREEDITATTRIBUTES,
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
...@@ -1830,7 +1912,7 @@ static XimICMode ic_mode[] = { ...@@ -1830,7 +1912,7 @@ static XimICMode ic_mode[] = {
0, 0,
0, 0,
0}, 0},
{XNStatusAttributes, 0, {OFFSET_XNSTATUSATTRIBUTES,
0, 0,
0, 0,
0, 0,
...@@ -1840,7 +1922,7 @@ static XimICMode ic_mode[] = { ...@@ -1840,7 +1922,7 @@ static XimICMode ic_mode[] = {
(XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET),
(XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET),
0}, 0},
{XNArea, 0, {OFFSET_XNAREA,
0, 0,
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
...@@ -1850,7 +1932,7 @@ static XimICMode ic_mode[] = { ...@@ -1850,7 +1932,7 @@ static XimICMode ic_mode[] = {
(XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET),
0, 0,
0}, 0},
{XNAreaNeeded, 0, {OFFSET_XNAREANEEDED,
0, 0,
0, 0,
(XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
...@@ -1860,7 +1942,7 @@ static XimICMode ic_mode[] = { ...@@ -1860,7 +1942,7 @@ static XimICMode ic_mode[] = {
(XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_SET | XIM_MODE_STS_GET),
0, 0,
0}, 0},
{XNSpotLocation, 0, {OFFSET_XNSPOTLOCATION,
0, /*(XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),*/ 0, /*(XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),*/
(XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
0, 0,
...@@ -1870,7 +1952,7 @@ static XimICMode ic_mode[] = { ...@@ -1870,7 +1952,7 @@ static XimICMode ic_mode[] = {
0, 0,
0, 0,
0}, 0},
{XNColormap, 0, {OFFSET_XNCOLORMAP,
0, 0,
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
...@@ -1880,7 +1962,7 @@ static XimICMode ic_mode[] = { ...@@ -1880,7 +1962,7 @@ static XimICMode ic_mode[] = {
(XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET),
(XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET),
0}, 0},
{XNStdColormap, 0, {OFFSET_XNSTDCOLORMAP,
0, 0,
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
...@@ -1890,7 +1972,7 @@ static XimICMode ic_mode[] = { ...@@ -1890,7 +1972,7 @@ static XimICMode ic_mode[] = {
(XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET),
(XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET),
0}, 0},
{XNForeground, 0, {OFFSET_XNFOREGROUND,
0, 0,
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
...@@ -1900,7 +1982,7 @@ static XimICMode ic_mode[] = { ...@@ -1900,7 +1982,7 @@ static XimICMode ic_mode[] = {
(XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET),
(XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET),
0}, 0},
{XNBackground, 0, {OFFSET_XNBACKGROUND,
0, 0,
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
...@@ -1910,7 +1992,7 @@ static XimICMode ic_mode[] = { ...@@ -1910,7 +1992,7 @@ static XimICMode ic_mode[] = {
(XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET),
(XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET),
0}, 0},
{XNBackgroundPixmap, 0, {OFFSET_XNBACKGROUNDPIXMAP,
0, 0,
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
...@@ -1920,7 +2002,7 @@ static XimICMode ic_mode[] = { ...@@ -1920,7 +2002,7 @@ static XimICMode ic_mode[] = {
(XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET),
(XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET),
0}, 0},
{XNFontSet, 0, {OFFSET_XNFONTSET,
0, 0,
(XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
...@@ -1930,7 +2012,7 @@ static XimICMode ic_mode[] = { ...@@ -1930,7 +2012,7 @@ static XimICMode ic_mode[] = {
(XIM_MODE_STS_CREATE | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_CREATE | XIM_MODE_STS_SET | XIM_MODE_STS_GET),
(XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET),
0}, 0},
{XNLineSpace, 0, {OFFSET_XNLINESPACE,
0, 0,
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
...@@ -1940,7 +2022,7 @@ static XimICMode ic_mode[] = { ...@@ -1940,7 +2022,7 @@ static XimICMode ic_mode[] = {
(XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET),
(XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET),
0}, 0},
{XNCursor, 0, {OFFSET_XNCURSOR,
0, 0,
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
...@@ -1950,7 +2032,7 @@ static XimICMode ic_mode[] = { ...@@ -1950,7 +2032,7 @@ static XimICMode ic_mode[] = {
(XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET),
(XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET),
0}, 0},
{XNPreeditStartCallback, 0, {OFFSET_XNPREEDITSTARTCALLBACK,
(XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
0, 0,
0, 0,
...@@ -1960,7 +2042,7 @@ static XimICMode ic_mode[] = { ...@@ -1960,7 +2042,7 @@ static XimICMode ic_mode[] = {
0, 0,
0, 0,
0}, 0},
{XNPreeditDoneCallback, 0, {OFFSET_XNPREEDITDONECALLBACK,
(XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
0, 0,
0, 0,
...@@ -1970,7 +2052,7 @@ static XimICMode ic_mode[] = { ...@@ -1970,7 +2052,7 @@ static XimICMode ic_mode[] = {
0, 0,
0, 0,
0}, 0},
{XNPreeditDrawCallback, 0, {OFFSET_XNPREEDITDRAWCALLBACK,
(XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
0, 0,
0, 0,
...@@ -1980,7 +2062,7 @@ static XimICMode ic_mode[] = { ...@@ -1980,7 +2062,7 @@ static XimICMode ic_mode[] = {
0, 0,
0, 0,
0}, 0},
{XNPreeditCaretCallback, 0, {OFFSET_XNPREEDITCARETCALLBACK,
(XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
0, 0,
0, 0,
...@@ -1990,7 +2072,7 @@ static XimICMode ic_mode[] = { ...@@ -1990,7 +2072,7 @@ static XimICMode ic_mode[] = {
0, 0,
0, 0,
0}, 0},
{XNPreeditState, 0, {OFFSET_XNPREEDITSTATE,
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
...@@ -2000,7 +2082,7 @@ static XimICMode ic_mode[] = { ...@@ -2000,7 +2082,7 @@ static XimICMode ic_mode[] = {
0, 0,
0, 0,
0}, 0},
{XNPreeditStateNotifyCallback, 0, {OFFSET_XNPREEDITSTATENOTIFYCALLBACK,
(XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
(XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),
...@@ -2010,7 +2092,7 @@ static XimICMode ic_mode[] = { ...@@ -2010,7 +2092,7 @@ static XimICMode ic_mode[] = {
0, 0,
0, 0,
0}, 0},
{XNStatusStartCallback, 0, {OFFSET_XNSTATUSSTARTCALLBACK,
0, 0,
0, 0,
0, 0,
...@@ -2020,7 +2102,7 @@ static XimICMode ic_mode[] = { ...@@ -2020,7 +2102,7 @@ static XimICMode ic_mode[] = {
0, 0,
0, 0,
0}, 0},
{XNStatusDoneCallback, 0, {OFFSET_XNSTATUSDONECALLBACK,
0, 0,
0, 0,
0, 0,
...@@ -2030,7 +2112,7 @@ static XimICMode ic_mode[] = { ...@@ -2030,7 +2112,7 @@ static XimICMode ic_mode[] = {
0, 0,
0, 0,
0}, 0},
{XNStatusDrawCallback, 0, {OFFSET_XNSTATUSDRAWCALLBACK,
0, 0,
0, 0,
0, 0,
...@@ -2042,6 +2124,12 @@ static XimICMode ic_mode[] = { ...@@ -2042,6 +2124,12 @@ static XimICMode ic_mode[] = {
0} 0}
}; };
/* the quarks are separated from im_mode/ic_mode so those arrays
* can be const.
*/
static XrmQuark im_mode_quark[sizeof(im_mode) / sizeof(im_mode[0])];
static XrmQuark ic_mode_quark[sizeof(ic_mode) / sizeof(ic_mode[0])];
Private Bool Private Bool
_XimSetResourceList( _XimSetResourceList(
XIMResourceList *res_list, XIMResourceList *res_list,
...@@ -2154,7 +2242,7 @@ Public XIMResourceList ...@@ -2154,7 +2242,7 @@ Public XIMResourceList
_XimGetResourceListRec( _XimGetResourceListRec(
XIMResourceList res_list, XIMResourceList res_list,
unsigned int list_num, unsigned int list_num,
char *name) const char *name)
{ {
XrmQuark quark = XrmStringToQuark(name); XrmQuark quark = XrmStringToQuark(name);
...@@ -2177,13 +2265,13 @@ _XimSetIMValueData( ...@@ -2177,13 +2265,13 @@ _XimSetIMValueData(
if(!(res = _XimGetResourceListRec(res_list, list_num, p->name))) { if(!(res = _XimGetResourceListRec(res_list, list_num, p->name))) {
return p->value; return p->value;
} }
check = _XimCheckIMMode(res, XIM_SETIMVALUES); check = _XimCheckIMMode(res, XIM_SETIMVALUES);
if(check == XIM_CHECK_INVALID) { if(check == XIM_CHECK_INVALID) {
continue; continue;
} else if (check == XIM_CHECK_ERROR) { } else if (check == XIM_CHECK_ERROR) {
return p->value; return p->value;
} }
if(!_XimEncodeLocalIMAttr(res, top, p->value)) { if(!_XimEncodeLocalIMAttr(res, top, p->value)) {
return p->value; return p->value;
} }
...@@ -2207,13 +2295,13 @@ _XimGetIMValueData( ...@@ -2207,13 +2295,13 @@ _XimGetIMValueData(
if(!(res = _XimGetResourceListRec(res_list, list_num, p->name))) { if(!(res = _XimGetResourceListRec(res_list, list_num, p->name))) {
return p->value; return p->value;
} }
check = _XimCheckIMMode(res, XIM_GETIMVALUES); check = _XimCheckIMMode(res, XIM_GETIMVALUES);
if(check == XIM_CHECK_INVALID) { if(check == XIM_CHECK_INVALID) {
continue; continue;
} else if (check == XIM_CHECK_ERROR) { } else if (check == XIM_CHECK_ERROR) {
return p->value; return p->value;
} }
if(!_XimDecodeLocalIMAttr(res, top, p->value)) { if(!_XimDecodeLocalIMAttr(res, top, p->value)) {
return p->value; return p->value;
} }
...@@ -2232,7 +2320,7 @@ _XimSetIMMode( ...@@ -2232,7 +2320,7 @@ _XimSetIMMode(
for(i = 0; i < n; i++) { for(i = 0; i < n; i++) {
if(!(res = _XimGetResourceListRecByQuark(res_list, if(!(res = _XimGetResourceListRecByQuark(res_list,
list_num, im_mode[i].quark))) { list_num, im_mode_quark[i]))) {
continue; continue;
} }
res->mode = im_mode[i].mode; res->mode = im_mode[i].mode;
...@@ -2290,10 +2378,7 @@ Public int ...@@ -2290,10 +2378,7 @@ Public int
} }
Public void Public void
_XimSetICMode(res_list, list_num, style) _XimSetICMode(XIMResourceList res_list, unsigned int list_num, XIMStyle style)
XIMResourceList res_list;
unsigned int list_num;
XIMStyle style;
{ {
XIMResourceList res; XIMResourceList res;
unsigned int n = XIMNumber(ic_mode); unsigned int n = XIMNumber(ic_mode);
...@@ -2325,7 +2410,7 @@ _XimSetICMode(res_list, list_num, style) ...@@ -2325,7 +2410,7 @@ _XimSetICMode(res_list, list_num, style)
for(i = 0; i < n; i++) { for(i = 0; i < n; i++) {
if(!(res = _XimGetResourceListRecByQuark(res_list, if(!(res = _XimGetResourceListRecByQuark(res_list,
list_num, ic_mode[i].quark))) { list_num, ic_mode_quark[i]))) {
continue; continue;
} }
res->mode = ( (*(unsigned short *)((char *)&ic_mode[i] + pre_offset)) res->mode = ( (*(unsigned short *)((char *)&ic_mode[i] + pre_offset))
...@@ -2542,7 +2627,7 @@ _XimSetLocalIMDefaults( ...@@ -2542,7 +2627,7 @@ _XimSetLocalIMDefaults(
for(i = 0; i < num; i++) { for(i = 0; i < num; i++) {
if((res = _XimGetResourceListRecByQuark( res_list, list_num, if((res = _XimGetResourceListRecByQuark( res_list, list_num,
info[i].quark)) == (XIMResourceList)NULL) { info[i].quark)) == (XIMResourceList)NULL) {
return False; return False;
} }
...@@ -2700,7 +2785,7 @@ _XimEncodeLocalTopValue( ...@@ -2700,7 +2785,7 @@ _XimEncodeLocalTopValue(
if (flag) { if (flag) {
_XRegisterFilterByType(ic->core.im->core.display, _XRegisterFilterByType(ic->core.im->core.display,
ic->core.focus_window, ic->core.focus_window,
KeyPress, KeyPress, _XimLocalFilter, (XPointer)ic); KeyPress, KeyRelease, _XimLocalFilter, (XPointer)ic);
} }
} else if (res->xrm_name == XrmStringToQuark(XNFocusWindow)) { } else if (res->xrm_name == XrmStringToQuark(XNFocusWindow)) {
if (ic->core.client_window) { if (ic->core.client_window) {
...@@ -2711,7 +2796,7 @@ _XimEncodeLocalTopValue( ...@@ -2711,7 +2796,7 @@ _XimEncodeLocalTopValue(
ic->core.focus_window = (Window)p->value; ic->core.focus_window = (Window)p->value;
if (flag) { if (flag) {
_XRegisterFilterByType(ic->core.im->core.display, _XRegisterFilterByType(ic->core.im->core.display,
ic->core.focus_window, KeyPress, KeyPress, ic->core.focus_window, KeyPress, KeyRelease,
_XimLocalFilter, (XPointer)ic); _XimLocalFilter, (XPointer)ic);
} }
} else } else
...@@ -2887,7 +2972,7 @@ _XimDecodeAttr( ...@@ -2887,7 +2972,7 @@ _XimDecodeAttr(
if(!info[i].decode) { if(!info[i].decode) {
return False; return False;
} }
return (*info[i].decode)(&info[i], top, val); return (*info[i].decode)(&info[i], top, val);
} }
} }
return False; return False;
...@@ -2928,13 +3013,8 @@ _XimDecodeLocalICAttr( ...@@ -2928,13 +3013,8 @@ _XimDecodeLocalICAttr(
} }
Public char * Public char *
_XimGetICValueData(ic, top, res_list, list_num, values, mode) _XimGetICValueData(Xic ic, XPointer top, XIMResourceList res_list,
Xic ic; unsigned int list_num, XIMArg *values, unsigned long mode)
XPointer top;
XIMResourceList res_list;
unsigned int list_num;
XIMArg *values;
unsigned long mode;
{ {
register XIMArg *p; register XIMArg *p;
XIMResourceList res; XIMResourceList res;
...@@ -2982,9 +3062,7 @@ _XimGetICValueData(ic, top, res_list, list_num, values, mode) ...@@ -2982,9 +3062,7 @@ _XimGetICValueData(ic, top, res_list, list_num, values, mode)
} }
Public void Public void
_XimGetCurrentIMValues(im, im_values) _XimGetCurrentIMValues(Xim im, XimDefIMValues *im_values)
Xim im;
XimDefIMValues *im_values;
{ {
bzero((char *)im_values, sizeof(XimDefIMValues)); bzero((char *)im_values, sizeof(XimDefIMValues));
...@@ -2998,9 +3076,7 @@ _XimGetCurrentIMValues(im, im_values) ...@@ -2998,9 +3076,7 @@ _XimGetCurrentIMValues(im, im_values)
} }
Public void Public void
_XimSetCurrentIMValues(im, im_values) _XimSetCurrentIMValues(Xim im, XimDefIMValues *im_values)
Xim im;
XimDefIMValues *im_values;
{ {
im->core.styles = im_values->styles; im->core.styles = im_values->styles;
im->core.im_values_list = im_values->im_values_list; im->core.im_values_list = im_values->im_values_list;
...@@ -3012,9 +3088,7 @@ _XimSetCurrentIMValues(im, im_values) ...@@ -3012,9 +3088,7 @@ _XimSetCurrentIMValues(im, im_values)
} }
Public void Public void
_XimGetCurrentICValues(ic, ic_values) _XimGetCurrentICValues(Xic ic, XimDefICValues *ic_values)
Xic ic;
XimDefICValues *ic_values;
{ {
bzero((char *)ic_values, sizeof(XimDefICValues)); bzero((char *)ic_values, sizeof(XimDefICValues));
...@@ -3067,7 +3141,7 @@ _XimInitialIMOffsetInfo(void) ...@@ -3067,7 +3141,7 @@ _XimInitialIMOffsetInfo(void)
register int i; register int i;
for(i = 0; i < n; i++) { for(i = 0; i < n; i++) {
im_attr_info[i].quark = XrmStringToQuark(im_attr_info[i].name); im_attr_info[i].quark = XrmStringToQuark(GET_NAME(im_attr_info[i]));
} }
} }
...@@ -3079,17 +3153,17 @@ _XimInitialICOffsetInfo(void) ...@@ -3079,17 +3153,17 @@ _XimInitialICOffsetInfo(void)
n = XIMNumber(ic_attr_info); n = XIMNumber(ic_attr_info);
for(i = 0; i < n; i++) { for(i = 0; i < n; i++) {
ic_attr_info[i].quark = XrmStringToQuark(ic_attr_info[i].name); ic_attr_info[i].quark = XrmStringToQuark(GET_NAME(ic_attr_info[i]));
} }
n = XIMNumber(ic_pre_attr_info); n = XIMNumber(ic_pre_attr_info);
for(i = 0; i < n; i++) { for(i = 0; i < n; i++) {
ic_pre_attr_info[i].quark = XrmStringToQuark(ic_pre_attr_info[i].name); ic_pre_attr_info[i].quark = XrmStringToQuark(GET_NAME(ic_pre_attr_info[i]));
} }
n = XIMNumber(ic_sts_attr_info); n = XIMNumber(ic_sts_attr_info);
for(i = 0; i < n; i++) { for(i = 0; i < n; i++) {
ic_sts_attr_info[i].quark = XrmStringToQuark(ic_sts_attr_info[i].name); ic_sts_attr_info[i].quark = XrmStringToQuark(GET_NAME(ic_sts_attr_info[i]));
} }
} }
...@@ -3100,7 +3174,7 @@ _XimInitialIMMode(void) ...@@ -3100,7 +3174,7 @@ _XimInitialIMMode(void)
register int i; register int i;
for(i = 0; i < n; i++) { for(i = 0; i < n; i++) {
im_mode[i].quark = XrmStringToQuark(im_mode[i].name); im_mode_quark[i] = XrmStringToQuark(GET_NAME(im_mode[i]));
} }
} }
...@@ -3111,7 +3185,7 @@ _XimInitialICMode(void) ...@@ -3111,7 +3185,7 @@ _XimInitialICMode(void)
register int i; register int i;
for(i = 0; i < n; i++) { for(i = 0; i < n; i++) {
ic_mode[i].quark = XrmStringToQuark(ic_mode[i].name); ic_mode_quark[i] = XrmStringToQuark(GET_NAME(ic_mode[i]));
} }
} }
......
...@@ -10,7 +10,7 @@ in supporting documentation, and that the name of FUJITSU LIMITED ...@@ -10,7 +10,7 @@ in supporting documentation, and that the name of FUJITSU LIMITED
not be used in advertising or publicity pertaining to distribution not be used in advertising or publicity pertaining to distribution
of the software without specific, written prior permission. of the software without specific, written prior permission.
FUJITSU LIMITED makes no representations about the suitability of FUJITSU LIMITED makes no representations about the suitability of
this software for any purpose. this software for any purpose.
It is provided "as is" without express or implied warranty. It is provided "as is" without express or implied warranty.
FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
...@@ -21,7 +21,7 @@ USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR ...@@ -21,7 +21,7 @@ USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
Author: Takashi Fujiwara FUJITSU LIMITED Author: Takashi Fujiwara FUJITSU LIMITED
fujiwara@a80.tech.yk.fujitsu.co.jp fujiwara@a80.tech.yk.fujitsu.co.jp
******************************************************************/ ******************************************************************/
...@@ -457,7 +457,7 @@ _XimDecodeIMATTRIBUTE( ...@@ -457,7 +457,7 @@ _XimDecodeIMATTRIBUTE(
if (total < min_len) if (total < min_len)
return p->name; return p->name;
if (!(_XimAttributeToValue((Xic) im->private.local.current_ic, if (!(_XimAttributeToValue((Xic) im->private.local.current_ic,
res, &buf[2], buf[1], p->value, mode))) res, &buf[2], buf[1], p->value, mode)))
return p->name; return p->name;
} }
......
...@@ -27,13 +27,13 @@ Copyright 1993 by Digital Equipment Corporation, Maynard, Massachusetts. ...@@ -27,13 +27,13 @@ Copyright 1993 by Digital Equipment Corporation, Maynard, Massachusetts.
All Rights Reserved All Rights Reserved
Permission to use, copy, modify, and distribute this software and its Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted, documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission. software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
...@@ -46,20 +46,20 @@ SOFTWARE. ...@@ -46,20 +46,20 @@ SOFTWARE.
******************************************************************/ ******************************************************************/
/* /*
**++ **++
** FACILITY: ** FACILITY:
** **
** Xlib ** Xlib
** **
** ABSTRACT: ** ABSTRACT:
** **
** Thai specific functions. ** Thai specific functions.
** Handles character classifications, composibility checking, ** Handles character classifications, composibility checking,
** Input sequence check and other Thai specific requirements ** Input sequence check and other Thai specific requirements
** according to WTT specification and DEC extensions. ** according to WTT specification and DEC extensions.
** **
** MODIFICATION HISTORY: ** MODIFICATION HISTORY:
** **
**/ **/
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
...@@ -316,17 +316,17 @@ THAI_istone (unsigned char ch) ...@@ -316,17 +316,17 @@ THAI_istone (unsigned char ch)
Private Bool Private Bool
THAI_iscomposible ( THAI_iscomposible (
unsigned char follow_ch, unsigned char follow_ch,
unsigned char lead_ch) unsigned char lead_ch)
{/* "Can follow_ch be put in the same display cell as lead_ch?" */ {/* "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)] return (write_rules_lookup[THAI_chtype(lead_ch)][THAI_chtype(follow_ch)]
== CP); == CP);
} }
Private Bool Private Bool
THAI_isaccepted ( THAI_isaccepted (
unsigned char follow_ch, unsigned char follow_ch,
unsigned char lead_ch, unsigned char lead_ch,
unsigned char mode) unsigned char mode)
{ {
...@@ -335,11 +335,11 @@ THAI_isaccepted ( ...@@ -335,11 +335,11 @@ THAI_isaccepted (
switch (mode) switch (mode)
{ {
case WTT_ISC1: case WTT_ISC1:
iskeyvalid = iskeyvalid =
(wtt_isc1_lookup[THAI_chtype(lead_ch)][THAI_chtype(follow_ch)] != RJ); (wtt_isc1_lookup[THAI_chtype(lead_ch)][THAI_chtype(follow_ch)] != RJ);
break; break;
case WTT_ISC2: case WTT_ISC2:
iskeyvalid = iskeyvalid =
(wtt_isc2_lookup[THAI_chtype(lead_ch)][THAI_chtype(follow_ch)] != RJ); (wtt_isc2_lookup[THAI_chtype(lead_ch)][THAI_chtype(follow_ch)] != RJ);
break; break;
case THAICAT_ISC: case THAICAT_ISC:
...@@ -355,15 +355,15 @@ THAI_isaccepted ( ...@@ -355,15 +355,15 @@ THAI_isaccepted (
} }
#ifdef UNUSED #ifdef UNUSED
Private void Private void
THAI_apply_write_rules( THAI_apply_write_rules(
unsigned char *instr, unsigned char *instr,
unsigned char *outstr, unsigned char *outstr,
unsigned char insert_ch, unsigned char insert_ch,
int *num_insert_ch) int *num_insert_ch)
{ {
/* /*
Input parameters: Input parameters:
instr - input string instr - input string
insert_ch specify what char to be added when invalid composition is found insert_ch specify what char to be added when invalid composition is found
Output parameters: Output parameters:
...@@ -387,8 +387,8 @@ Output parameters: ...@@ -387,8 +387,8 @@ Output parameters:
*out_ch++ = *lead_ch; *out_ch++ = *lead_ch;
while (*follow_ch != '\0') /* more char in string to check */ while (*follow_ch != '\0') /* more char in string to check */
{ {
if (THAI_isdead(*follow_ch) && if (THAI_isdead(*follow_ch) &&
!THAI_iscomposible(*follow_ch,*lead_ch)) !THAI_iscomposible(*follow_ch,*lead_ch))
{ {
*out_ch++ = SPACE; *out_ch++ = SPACE;
(*num_insert_ch)++; (*num_insert_ch)++;
...@@ -401,9 +401,9 @@ Output parameters: ...@@ -401,9 +401,9 @@ Output parameters:
} }
} }
Private int Private int
THAI_find_chtype ( THAI_find_chtype (
unsigned char *instr, unsigned char *instr,
int chtype) int chtype)
{ {
/* /*
...@@ -421,7 +421,7 @@ Output parameters: ...@@ -421,7 +421,7 @@ Output parameters:
case DEAD: case DEAD:
for (i = 0; *instr != '\0' && THAI_isdead(*instr); i++, instr++) for (i = 0; *instr != '\0' && THAI_isdead(*instr); i++, instr++)
; ;
if (*instr != '\0') position = i; if (*instr != '\0') position = i;
break; break;
default: default:
break; break;
...@@ -430,12 +430,12 @@ Output parameters: ...@@ -430,12 +430,12 @@ Output parameters:
} }
Private int Private int
THAI_apply_scm( THAI_apply_scm(
unsigned char *instr, unsigned char *instr,
unsigned char *outstr, unsigned char *outstr,
unsigned char spec_ch, unsigned char spec_ch,
int num_sp, int num_sp,
unsigned char insert_ch) unsigned char insert_ch)
{ {
unsigned char *scan, *outch; unsigned char *scan, *outch;
...@@ -450,7 +450,7 @@ THAI_apply_scm( ...@@ -450,7 +450,7 @@ THAI_apply_scm(
if (THAI_isdead(*scan)) if (THAI_isdead(*scan))
dead_count++; /* count number of non-spacing char */ dead_count++; /* count number of non-spacing char */
if (*scan == spec_ch) if (*scan == spec_ch)
if (!isconsecutive) if (!isconsecutive)
found_count++; /* count number consecutive spec char found */ found_count++; /* count number consecutive spec char found */
*outch++ = *scan++; *outch++ = *scan++;
if (found_count == num_sp) { if (found_count == num_sp) {
...@@ -472,7 +472,7 @@ Private void SetLed(Display *dpy, int num, int state); ...@@ -472,7 +472,7 @@ Private void SetLed(Display *dpy, int num, int state);
Private CARD8 FindKeyCode(); Private CARD8 FindKeyCode();
/* The following functions are specific to this module */ /* The following functions are specific to this module */
Private int XThaiTranslateKey(); Private int XThaiTranslateKey();
Private int XThaiTranslateKeySym(); Private int XThaiTranslateKeySym();
...@@ -520,9 +520,9 @@ Private Bool ThaiComposeConvert( ...@@ -520,9 +520,9 @@ Private Bool ThaiComposeConvert(
* Macros to save and recall last input character in XIC * Macros to save and recall last input character in XIC
*/ */
#define IC_SavePreviousChar(ic,ch) \ #define IC_SavePreviousChar(ic,ch) \
(*((ic)->private.local.context->mb) = (char) (ch)) ((ic)->private.local.base.mb[(ic)->private.local.base.tree[(ic)->private.local.context].mb] = (char) (ch))
#define IC_ClearPreviousChar(ic) \ #define IC_ClearPreviousChar(ic) \
(*((ic)->private.local.context->mb) = 0) ((ic)->private.local.base.mb[(ic)->private.local.base.tree[(ic)->private.local.context].mb] = 0)
#define IC_GetPreviousChar(ic) \ #define IC_GetPreviousChar(ic) \
(IC_RealGetPreviousChar(ic,1)) (IC_RealGetPreviousChar(ic,1))
#define IC_GetContextChar(ic) \ #define IC_GetContextChar(ic) \
...@@ -534,6 +534,7 @@ Private unsigned char ...@@ -534,6 +534,7 @@ Private unsigned char
IC_RealGetPreviousChar(Xic ic, unsigned short pos) IC_RealGetPreviousChar(Xic ic, unsigned short pos)
{ {
XICCallback* cb = &ic->core.string_conversion_callback; XICCallback* cb = &ic->core.string_conversion_callback;
DefTreeBase *b = &ic->private.local.base;
if (cb && cb->callback) { if (cb && cb->callback) {
XIMStringConversionCallbackStruct screc; XIMStringConversionCallbackStruct screc;
...@@ -550,25 +551,49 @@ IC_RealGetPreviousChar(Xic ic, unsigned short pos) ...@@ -550,25 +551,49 @@ IC_RealGetPreviousChar(Xic ic, unsigned short pos)
(cb->callback)((XIC)ic, cb->client_data, (XPointer)&screc); (cb->callback)((XIC)ic, cb->client_data, (XPointer)&screc);
if (!screc.text) if (!screc.text)
return (unsigned char) *((ic)->private.local.context->mb); return (unsigned char) b->mb[b->tree[(ic)->private.local.context].mb];
if ((screc.text->feedback && if ((screc.text->feedback &&
*screc.text->feedback == XIMStringConversionLeftEdge) || *screc.text->feedback == XIMStringConversionLeftEdge) ||
screc.text->length < 1) screc.text->length < 1)
{ {
c = 0; c = 0;
} else { } else {
Xim im;
XlcConv conv;
int from_left;
int to_left;
char *from_buf;
char *to_buf;
im = (Xim) XIMOfIC((XIC)ic);
if (screc.text->encoding_is_wchar) { if (screc.text->encoding_is_wchar) {
c = ucs2tis(screc.text->string.wcs[0]); conv = _XlcOpenConverter(im->core.lcd, XlcNWideChar,
XFree(screc.text->string.wcs); im->core.lcd, XlcNCharSet);
from_buf = (char *) screc.text->string.wcs;
from_left = screc.text->length * sizeof(wchar_t);
} else { } else {
c = screc.text->string.mbs[0]; conv = _XlcOpenConverter(im->core.lcd, XlcNMultiByte,
XFree(screc.text->string.mbs); im->core.lcd, XlcNCharSet);
from_buf = screc.text->string.mbs;
from_left = screc.text->length;
}
to_buf = (char *)&c;
to_left = 1;
_XlcResetConverter(conv);
if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left,
(XPointer *)&to_buf, &to_left, NULL, 0) < 0)
{
c = (unsigned char) b->mb[b->tree[(ic)->private.local.context].mb];
} }
_XlcCloseConverter(conv);
XFree(screc.text->string.mbs);
} }
XFree(screc.text); XFree(screc.text);
return c; return c;
} else { } else {
return (unsigned char) *((ic)->private.local.context->mb); return (unsigned char) b->mb[b->tree[(ic)->private.local.context].mb];
} }
} }
...@@ -791,12 +816,12 @@ XThaiTranslateKey( ...@@ -791,12 +816,12 @@ XThaiTranslateKey(
} }
/* /*
* ThaiCat keyboard support : * ThaiCat keyboard support :
* When the Shift and Thai keys are hold for some keys a 'Thai Compose' * When the Shift and Thai keys are hold for some keys a 'Thai Compose'
* character code is generated which is different from column 3 and * character code is generated which is different from column 3 and
* 4 of the keymap. * 4 of the keymap.
* Since we don't know whether ThaiCat keyboard or WTT keyboard is * Since we don't know whether ThaiCat keyboard or WTT keyboard is
* in use, the same mapping is done for all Thai input. * in use, the same mapping is done for all Thai input.
* We just arbitary choose to use column 3 keysyms as the indices of * We just arbitary choose to use column 3 keysyms as the indices of
* this mapping. * this mapping.
* When the control key is also hold, this mapping has no effect. * When the control key is also hold, this mapping has no effect.
*/ */
...@@ -814,7 +839,7 @@ XThaiTranslateKey( ...@@ -814,7 +839,7 @@ XThaiTranslateKey(
return 1; return 1;
} }
/* /*
* XThaiTranslateKeySym * XThaiTranslateKeySym
* *
* Translate KeySym to TACTIS code output. * Translate KeySym to TACTIS code output.
...@@ -833,7 +858,7 @@ XThaiTranslateKeySym( ...@@ -833,7 +858,7 @@ XThaiTranslateKeySym(
int nbytes) int nbytes)
{ {
KeySym ckey = 0; KeySym ckey = 0;
register struct _XKeytrans *p; register struct _XKeytrans *p;
int length; int length;
unsigned long hiBytes; unsigned long hiBytes;
register unsigned char c; register unsigned char c;
...@@ -910,8 +935,8 @@ XThaiTranslateKeySym( ...@@ -910,8 +935,8 @@ XThaiTranslateKeySym(
} }
/* /*
* ThaiCat has a key that generates two TACTIS codes D1 & E9. * ThaiCat has a key that generates two TACTIS codes D1 & E9.
* It is represented by the latin-1 keysym XK_thorn (0xfe). * It is represented by the latin-1 keysym XK_thorn (0xfe).
* If c is XK_thorn, this key is pressed and it is converted to * If c is XK_thorn, this key is pressed and it is converted to
* 0xd1 0xe9. * 0xd1 0xe9.
*/ */
if (c == XK_thorn) { if (c == XK_thorn) {
...@@ -937,7 +962,7 @@ FindKeyCode( ...@@ -937,7 +962,7 @@ FindKeyCode(
register KeySym code) register KeySym code)
{ {
register KeySym *kmax = dpy->keysyms + register KeySym *kmax = dpy->keysyms +
(dpy->max_keycode - dpy->min_keycode + 1) * dpy->keysyms_per_keycode; (dpy->max_keycode - dpy->min_keycode + 1) * dpy->keysyms_per_keycode;
register KeySym *k = dpy->keysyms; register KeySym *k = dpy->keysyms;
while (k < kmax) { while (k < kmax) {
...@@ -987,8 +1012,8 @@ ComputeMaskFromKeytrans( ...@@ -987,8 +1012,8 @@ ComputeMaskFromKeytrans(
* *
* *
* Compose handling routines - compose handlers 0,1,2 * Compose handling routines - compose handlers 0,1,2
* *
* *
************************************************************************/ ************************************************************************/
#define NORMAL_KEY_STATE 0 #define NORMAL_KEY_STATE 0
...@@ -1084,7 +1109,7 @@ int tactis_code; ...@@ -1084,7 +1109,7 @@ int tactis_code;
hi_digit = ks1 - XK_a + 10; hi_digit = ks1 - XK_a + 10;
else /* out of range */ else /* out of range */
return NoSymbol; return NoSymbol;
if ((ks2 >= XK_0) && (ks2 <= XK_9)) if ((ks2 >= XK_0) && (ks2 <= XK_9))
lo_digit = ks2 - XK_0; lo_digit = ks2 - XK_0;
else if ((ks2 >= XK_A) && (ks2 <= XK_F)) else if ((ks2 >= XK_A) && (ks2 <= XK_F))
...@@ -1153,7 +1178,7 @@ void SetLed( ...@@ -1153,7 +1178,7 @@ void SetLed(
#endif #endif
/* /*
* Initialize ISC mode from im modifier * Initialize ISC mode from im modifier
*/ */
Private void InitIscMode(Xic ic) Private void InitIscMode(Xic ic)
{ {
...@@ -1184,20 +1209,21 @@ Private void InitIscMode(Xic ic) ...@@ -1184,20 +1209,21 @@ Private void InitIscMode(Xic ic)
return; return;
} }
/* /*
* Helper functions for _XimThaiFilter() * Helper functions for _XimThaiFilter()
*/ */
Private Bool Private Bool
ThaiFltAcceptInput(Xic ic, unsigned char new_char, KeySym symbol) ThaiFltAcceptInput(Xic ic, unsigned char new_char, KeySym symbol)
{ {
ic->private.local.composed->wc[0] = tis2ucs(new_char); DefTreeBase *b = &ic->private.local.base;
ic->private.local.composed->wc[1] = '\0'; b->wc[b->tree[ic->private.local.composed].wc+0] = tis2ucs(new_char);
b->wc[b->tree[ic->private.local.composed].wc+1] = '\0';
if ((new_char <= 0x1f) || (new_char == 0x7f)) if ((new_char <= 0x1f) || (new_char == 0x7f))
ic->private.local.composed->keysym = symbol; b->tree[ic->private.local.composed].keysym = symbol;
else else
ic->private.local.composed->keysym = NoSymbol; b->tree[ic->private.local.composed].keysym = NoSymbol;
return True; return True;
} }
...@@ -1205,12 +1231,13 @@ ThaiFltAcceptInput(Xic ic, unsigned char new_char, KeySym symbol) ...@@ -1205,12 +1231,13 @@ ThaiFltAcceptInput(Xic ic, unsigned char new_char, KeySym symbol)
Private Bool Private Bool
ThaiFltReorderInput(Xic ic, unsigned char previous_char, unsigned char new_char) ThaiFltReorderInput(Xic ic, unsigned char previous_char, unsigned char new_char)
{ {
DefTreeBase *b = &ic->private.local.base;
if (!IC_DeletePreviousChar(ic)) return False; if (!IC_DeletePreviousChar(ic)) return False;
ic->private.local.composed->wc[0] = tis2ucs(new_char); b->wc[b->tree[ic->private.local.composed].wc+0] = tis2ucs(new_char);
ic->private.local.composed->wc[1] = tis2ucs(previous_char); b->wc[b->tree[ic->private.local.composed].wc+1] = tis2ucs(previous_char);
ic->private.local.composed->wc[2] = '\0'; b->wc[b->tree[ic->private.local.composed].wc+2] = '\0';
ic->private.local.composed->keysym = NoSymbol; b->tree[ic->private.local.composed].keysym = NoSymbol;
return True; return True;
} }
...@@ -1218,27 +1245,40 @@ ThaiFltReorderInput(Xic ic, unsigned char previous_char, unsigned char new_char) ...@@ -1218,27 +1245,40 @@ ThaiFltReorderInput(Xic ic, unsigned char previous_char, unsigned char new_char)
Private Bool Private Bool
ThaiFltReplaceInput(Xic ic, unsigned char new_char, KeySym symbol) ThaiFltReplaceInput(Xic ic, unsigned char new_char, KeySym symbol)
{ {
DefTreeBase *b = &ic->private.local.base;
if (!IC_DeletePreviousChar(ic)) return False; if (!IC_DeletePreviousChar(ic)) return False;
ic->private.local.composed->wc[0] = tis2ucs(new_char); b->wc[b->tree[ic->private.local.composed].wc+0] = tis2ucs(new_char);
ic->private.local.composed->wc[1] = '\0'; b->wc[b->tree[ic->private.local.composed].wc+1] = '\0';
if ((new_char <= 0x1f) || (new_char == 0x7f)) if ((new_char <= 0x1f) || (new_char == 0x7f))
ic->private.local.composed->keysym = symbol; b->tree[ic->private.local.composed].keysym = symbol;
else else
ic->private.local.composed->keysym = NoSymbol; b->tree[ic->private.local.composed].keysym = NoSymbol;
return True; return True;
} }
Private unsigned
NumLockMask(Display *d)
{
int i;
XModifierKeymap *map = XGetModifierMapping (d);
KeyCode numlock_keycode = XKeysymToKeycode (d, XK_Num_Lock);
if (numlock_keycode == NoSymbol)
return 0;
for (i = 0; i < 8; i++) {
if (map->modifiermap[map->max_keypermod * i] == numlock_keycode)
return 1 << i;
}
return 0;
}
/* /*
* Filter function for TACTIS * Filter function for TACTIS
*/ */
Bool Bool
_XimThaiFilter(d, w, ev, client_data) _XimThaiFilter(Display *d, Window w, XEvent *ev, XPointer client_data)
Display *d;
Window w;
XEvent *ev;
XPointer client_data;
{ {
Xic ic = (Xic)client_data; Xic ic = (Xic)client_data;
KeySym symbol; KeySym symbol;
...@@ -1254,6 +1294,7 @@ XPointer client_data; ...@@ -1254,6 +1294,7 @@ XPointer client_data;
#endif #endif
wchar_t wbuf[10]; wchar_t wbuf[10];
Bool isReject; Bool isReject;
DefTreeBase *b = &ic->private.local.base;
if ((ev->type != KeyPress) if ((ev->type != KeyPress)
|| (ev->xkey.keycode == 0)) || (ev->xkey.keycode == 0))
...@@ -1264,7 +1305,7 @@ XPointer client_data; ...@@ -1264,7 +1305,7 @@ XPointer client_data;
XwcLookupString((XIC)ic, &ev->xkey, wbuf, sizeof(wbuf) / sizeof(wbuf[0]), XwcLookupString((XIC)ic, &ev->xkey, wbuf, sizeof(wbuf) / sizeof(wbuf[0]),
&symbol, NULL); &symbol, NULL);
if ((ev->xkey.state & (AllMods & ~ShiftMask)) || if ((ev->xkey.state & (AllMods & ~(ShiftMask|LockMask|NumLockMask(d)))) ||
((symbol >> 8 == 0xFF) && ((symbol >> 8 == 0xFF) &&
((XK_BackSpace <= symbol && symbol <= XK_Clear) || ((XK_BackSpace <= symbol && symbol <= XK_Clear) ||
(symbol == XK_Return) || (symbol == XK_Return) ||
...@@ -1278,7 +1319,7 @@ XPointer client_data; ...@@ -1278,7 +1319,7 @@ XPointer client_data;
IsMiscFunctionKey(symbol) || IsMiscFunctionKey(symbol) ||
IsFunctionKey(symbol)))) IsFunctionKey(symbol))))
{ {
IC_ClearPreviousChar(ic); IC_ClearPreviousChar(ic);
return False; return False;
} }
if (((symbol >> 8 == 0xFF) && if (((symbol >> 8 == 0xFF) &&
...@@ -1297,7 +1338,7 @@ XPointer client_data; ...@@ -1297,7 +1338,7 @@ XPointer client_data;
return False; return False;
/* /*
* Hex input method processing * Hex input method processing
*/ */
thai_part = &ic->private.local.thai; thai_part = &ic->private.local.thai;
...@@ -1356,11 +1397,11 @@ XPointer client_data; ...@@ -1356,11 +1397,11 @@ XPointer client_data;
return True; return True;
} }
_Xlcwcstombs(ic->core.im->core.lcd, ic->private.local.composed->mb, _Xlcwcstombs(ic->core.im->core.lcd, &b->mb[b->tree[ic->private.local.composed].mb],
ic->private.local.composed->wc, 10); &b->wc[b->tree[ic->private.local.composed].wc], 10);
_Xlcmbstoutf8(ic->core.im->core.lcd, ic->private.local.composed->utf8, _Xlcmbstoutf8(ic->core.im->core.lcd, &b->utf8[b->tree[ic->private.local.composed].utf8],
ic->private.local.composed->mb, 10); &b->mb[b->tree[ic->private.local.composed].mb], 10);
/* Remember the last character inputted /* Remember the last character inputted
* (as fallback in case StringConversionCallback is not provided) * (as fallback in case StringConversionCallback is not provided)
......
...@@ -15,17 +15,17 @@ makes no representations about the suitability of this software for ...@@ -15,17 +15,17 @@ makes no representations about the suitability of this software for
any purpose. It is provided "as is" without express or implied any purpose. It is provided "as is" without express or implied
warranty. warranty.
FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION DISCLAIM ALL FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION DISCLAIM ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR
ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE. THIS SOFTWARE.
Author: Takashi Fujiwara FUJITSU LIMITED Author: Takashi Fujiwara FUJITSU LIMITED
fujiwara@a80.tech.yk.fujitsu.co.jp fujiwara@a80.tech.yk.fujitsu.co.jp
Modifier: Franky Ling Digital Equipment Corporation Modifier: Franky Ling Digital Equipment Corporation
frankyling@hgrd01.enet.dec.com frankyling@hgrd01.enet.dec.com
...@@ -60,6 +60,8 @@ _XimThaiDestroyIC( ...@@ -60,6 +60,8 @@ _XimThaiDestroyIC(
XIC xic) XIC xic)
{ {
Xic ic = (Xic)xic; Xic ic = (Xic)xic;
DefTreeBase *b = &ic->private.local.base;
if(((Xim)ic->core.im)->private.local.current_ic == (XIC)ic) { if(((Xim)ic->core.im)->private.local.current_ic == (XIC)ic) {
_XimThaiUnSetFocus(xic); _XimThaiUnSetFocus(xic);
} }
...@@ -68,14 +70,14 @@ _XimThaiDestroyIC( ...@@ -68,14 +70,14 @@ _XimThaiDestroyIC(
ic->private.local.ic_resources = NULL; ic->private.local.ic_resources = NULL;
} }
Xfree(ic->private.local.context->mb); if (b->tree) Xfree (b->tree);
Xfree(ic->private.local.context->wc); if (b->mb) Xfree (b->mb);
Xfree(ic->private.local.context->utf8); if (b->wc) Xfree (b->wc);
Xfree(ic->private.local.context); if (b->utf8) Xfree (b->utf8);
Xfree(ic->private.local.composed->mb); b->tree = NULL;
Xfree(ic->private.local.composed->wc); b->mb = NULL;
Xfree(ic->private.local.composed->utf8); b->wc = NULL;
Xfree(ic->private.local.composed); b->utf8 = NULL;
return; return;
} }
...@@ -105,11 +107,12 @@ _XimThaiReset( ...@@ -105,11 +107,12 @@ _XimThaiReset(
XIC xic) XIC xic)
{ {
Xic ic = (Xic)xic; Xic ic = (Xic)xic;
DefTreeBase *b = &ic->private.local.base;
ic->private.local.thai.comp_state = 0; ic->private.local.thai.comp_state = 0;
ic->private.local.thai.keysym = 0; ic->private.local.thai.keysym = 0;
ic->private.local.composed->mb[0] = '\0'; b->mb[b->tree[ic->private.local.composed].mb] = '\0';
ic->private.local.composed->wc[0] = 0; b->wc[b->tree[ic->private.local.composed].wc] = '\0';
ic->private.local.composed->utf8[0] = '\0'; b->utf8[b->tree[ic->private.local.composed].utf8] = '\0';
} }
Private char * Private char *
...@@ -152,6 +155,7 @@ _XimThaiCreateIC( ...@@ -152,6 +155,7 @@ _XimThaiCreateIC(
XIMResourceList res; XIMResourceList res;
unsigned int num; unsigned int num;
int len; int len;
DefTree *tree;
if((ic = (Xic)Xmalloc(sizeof(XicRec))) == (Xic)NULL) { if((ic = (Xic)Xmalloc(sizeof(XicRec))) == (Xic)NULL) {
return ((XIC)NULL); return ((XIC)NULL);
...@@ -161,30 +165,23 @@ _XimThaiCreateIC( ...@@ -161,30 +165,23 @@ _XimThaiCreateIC(
ic->methods = &Thai_ic_methods; ic->methods = &Thai_ic_methods;
ic->core.im = im; ic->core.im = im;
ic->core.filter_events = KeyPressMask; ic->core.filter_events = KeyPressMask;
if ((ic->private.local.context = (DefTree *)Xmalloc(sizeof(DefTree)))
== (DefTree *)NULL) if (! (ic->private.local.base.tree = tree = (DefTree *)Xmalloc(sizeof(DefTree)*3)) )
goto Set_Error;
if ((ic->private.local.context->mb = (char *)Xmalloc(10))
== (char *)NULL)
goto Set_Error;
if ((ic->private.local.context->wc = (wchar_t *)Xmalloc(10*sizeof(wchar_t)))
== (wchar_t *)NULL)
goto Set_Error;
if ((ic->private.local.context->utf8 = (char *)Xmalloc(10))
== (char *)NULL)
goto Set_Error;
if ((ic->private.local.composed = (DefTree *)Xmalloc(sizeof(DefTree)))
== (DefTree *)NULL)
goto Set_Error; goto Set_Error;
if ((ic->private.local.composed->mb = (char *)Xmalloc(10)) if (! (ic->private.local.base.mb = (char *)Xmalloc(21)) )
== (char *)NULL)
goto Set_Error; goto Set_Error;
if ((ic->private.local.composed->wc = (wchar_t *)Xmalloc(10*sizeof(wchar_t))) if (! (ic->private.local.base.wc = (wchar_t*)Xmalloc(sizeof(wchar_t)*21)) )
== (wchar_t *)NULL)
goto Set_Error; goto Set_Error;
if ((ic->private.local.composed->utf8 = (char *)Xmalloc(10)) if (! (ic->private.local.base.utf8 = (char *)Xmalloc(21)) )
== (char *)NULL)
goto Set_Error; goto Set_Error;
ic->private.local.context = 1;
tree[1].mb = 1;
tree[1].wc = 1;
tree[1].utf8 = 1;
ic->private.local.composed = 2;
tree[2].mb = 11;
tree[2].wc = 11;
tree[2].utf8 = 11;
ic->private.local.thai.comp_state = 0; ic->private.local.thai.comp_state = 0;
ic->private.local.thai.keysym = 0; ic->private.local.thai.keysym = 0;
......
...@@ -15,17 +15,17 @@ makes no representations about the suitability of this software for ...@@ -15,17 +15,17 @@ makes no representations about the suitability of this software for
any purpose. It is provided "as is" without express or implied any purpose. It is provided "as is" without express or implied
warranty. warranty.
FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION DISCLAIM ALL FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION DISCLAIM ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR FUJITSU LIMITED AND DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR
ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE. THIS SOFTWARE.
Author: Takashi Fujiwara FUJITSU LIMITED Author: Takashi Fujiwara FUJITSU LIMITED
fujiwara@a80.tech.yk.fujitsu.co.jp fujiwara@a80.tech.yk.fujitsu.co.jp
Modifier: Franky Ling Digital Equipment Corporation Modifier: Franky Ling Digital Equipment Corporation
frankyling@hgrd01.enet.dec.com frankyling@hgrd01.enet.dec.com
...@@ -59,21 +59,25 @@ Private XIMMethodsRec Xim_im_thai_methods = { ...@@ -59,21 +59,25 @@ Private XIMMethodsRec Xim_im_thai_methods = {
#define THAI_LANGUAGE_NAME "th" #define THAI_LANGUAGE_NAME "th"
Bool Bool
_XimCheckIfThaiProcessing(im) _XimCheckIfThaiProcessing(Xim im)
Xim im;
{ {
char *language; char *language;
_XGetLCValues(im->core.lcd, XlcNLanguage, &language, NULL); _XGetLCValues(im->core.lcd, XlcNLanguage, &language, NULL);
if(strcmp(language, THAI_LANGUAGE_NAME) == 0) { if(strcmp(language, THAI_LANGUAGE_NAME) == 0 &&
(strcmp(im->core.im_name, "") == 0 ||
strcmp(im->core.im_name, "BasicCheck") == 0 ||
strcmp(im->core.im_name, "Strict") == 0 ||
strcmp(im->core.im_name, "Thaicat") == 0 ||
strcmp(im->core.im_name, "Passthrough") == 0))
{
return(True); return(True);
} }
return(False); return(False);
} }
Public Bool Public Bool
_XimThaiOpenIM(im) _XimThaiOpenIM(Xim im)
Xim im;
{ {
XLCd lcd = im->core.lcd; XLCd lcd = im->core.lcd;
XlcConv conv; XlcConv conv;
...@@ -142,8 +146,7 @@ Open_Error : ...@@ -142,8 +146,7 @@ Open_Error :
} }
Public void Public void
_XimThaiIMFree(im) _XimThaiIMFree(Xim im)
Xim im;
{ {
if(im->core.im_resources) { if(im->core.im_resources) {
Xfree(im->core.im_resources); Xfree(im->core.im_resources);
...@@ -213,8 +216,7 @@ _XimThaiIMFree(im) ...@@ -213,8 +216,7 @@ _XimThaiIMFree(im)
} }
Public Status Public Status
_XimThaiCloseIM(xim) _XimThaiCloseIM(XIM xim)
XIM xim;
{ {
Xim im = (Xim)xim; Xim im = (Xim)xim;
XIC ic; XIC ic;
......
/*
* Copyright 1992 Sun Microsystems, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
/****************************************************************** /******************************************************************
Copyright 1992 by Sun Microsystems, Inc.
Copyright 1992, 1993, 1994 by FUJITSU LIMITED Copyright 1992, 1993, 1994 by FUJITSU LIMITED
Permission to use, copy, modify, distribute, and sell this software Permission to use, copy, modify, distribute, and sell this software
and its documentation for any purpose is hereby granted without fee, and its documentation for any purpose is hereby granted without fee,
provided that the above copyright notice appear in all copies and provided that the above copyright notice appear in all copies and
that both that copyright notice and this permission notice appear that both that copyright notice and this permission notice appear
in supporting documentation, and that the name of Sun Microsystems, Inc. in supporting documentation, and that the name of FUJITSU LIMITED
and FUJITSU LIMITED not be used in advertising or publicity pertaining to not be used in advertising or publicity pertaining to distribution
distribution of the software without specific, written prior permission. of the software without specific, written prior permission.
Sun Microsystems, Inc. and FUJITSU LIMITED makes no representations about FUJITSU LIMITED makes no representations about the suitability of
the suitability of this software for any purpose. this software for any purpose.
It is provided "as is" without express or implied warranty. It is provided "as is" without express or implied warranty.
Sun Microsystems Inc. AND FUJITSU LIMITED DISCLAIMS ALL WARRANTIES WITH FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
AND FITNESS, IN NO EVENT SHALL Sun Microsystems, Inc. AND FUJITSU LIMITED EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc.
Takashi Fujiwara FUJITSU LIMITED Takashi Fujiwara FUJITSU LIMITED
fujiwara@a80.tech.yk.fujitsu.co.jp fujiwara@a80.tech.yk.fujitsu.co.jp
******************************************************************/ ******************************************************************/
...@@ -102,12 +123,12 @@ _XimXFilterWaitEvent( ...@@ -102,12 +123,12 @@ _XimXFilterWaitEvent(
spec->ev = (XPointer)ev; spec->ev = (XPointer)ev;
ret = _XimFilterWaitEvent(im); ret = _XimFilterWaitEvent(im);
/* /*
* If ev is a pointer to a stack variable, there could be * If ev is a pointer to a stack variable, there could be
* a coredump later on if the pointer is dereferenced. * a coredump later on if the pointer is dereferenced.
* Therefore, reset to NULL to force reinitialization in * Therefore, reset to NULL to force reinitialization in
* _XimXRead(). * _XimXRead().
* *
* Keep in mind _XimXRead may be called again when the stack * Keep in mind _XimXRead may be called again when the stack
* is very different. * is very different.
*/ */
...@@ -153,6 +174,8 @@ _XimXConnect(Xim im) ...@@ -153,6 +174,8 @@ _XimXConnect(Xim im)
event.xclient.data.l[0] = (CARD32)spec->lib_connect_wid; event.xclient.data.l[0] = (CARD32)spec->lib_connect_wid;
event.xclient.data.l[1] = spec->major_code; event.xclient.data.l[1] = spec->major_code;
event.xclient.data.l[2] = spec->minor_code; event.xclient.data.l[2] = spec->minor_code;
event.xclient.data.l[3] = 0;
event.xclient.data.l[4] = 0;
if(event.xclient.data.l[1] == 1 || event.xclient.data.l[1] == 2) { if(event.xclient.data.l[1] == 1 || event.xclient.data.l[1] == 2) {
XWindowAttributes atr; XWindowAttributes atr;
...@@ -193,7 +216,7 @@ _XimXConnect(Xim im) ...@@ -193,7 +216,7 @@ _XimXConnect(Xim im)
((major_code == 2) && (minor_code == 1))) { ((major_code == 2) && (minor_code == 1))) {
spec->BoundarySize = (CARD32)event.xclient.data.l[3]; spec->BoundarySize = (CARD32)event.xclient.data.l[3];
} }
/* ClientMessage Event Filter */ /* ClientMessage Event Filter */
_XRegisterFilterByType(im->core.display, spec->lib_connect_wid, _XRegisterFilterByType(im->core.display, spec->lib_connect_wid,
ClientMessage, ClientMessage, ClientMessage, ClientMessage,
...@@ -233,7 +256,7 @@ _NewAtom( ...@@ -233,7 +256,7 @@ _NewAtom(
} }
Private Bool Private Bool
_XimXWrite(Xim im, INT16 len, XPointer data) _XimXWrite(Xim im, INT16 len, XPointer data)
{ {
Atom atom; Atom atom;
char atomName[16]; char atomName[16];
...@@ -353,6 +376,7 @@ _XimXGetReadData( ...@@ -353,6 +376,7 @@ _XimXGetReadData(
(void)memcpy(buf, prop_ret, (int)nitems); (void)memcpy(buf, prop_ret, (int)nitems);
*ret_len = (int)nitems; *ret_len = (int)nitems;
if (bytes_after_ret > 0) { if (bytes_after_ret > 0) {
XFree(prop_ret);
XGetWindowProperty(im->core.display, XGetWindowProperty(im->core.display,
spec->lib_connect_wid, prop, 0L, spec->lib_connect_wid, prop, 0L,
((length + bytes_after_ret + 3)/ 4), True, AnyPropertyType, ((length + bytes_after_ret + 3)/ 4), True, AnyPropertyType,
...@@ -360,7 +384,7 @@ _XimXGetReadData( ...@@ -360,7 +384,7 @@ _XimXGetReadData(
&prop_ret); &prop_ret);
XChangeProperty(im->core.display, spec->lib_connect_wid, prop, XChangeProperty(im->core.display, spec->lib_connect_wid, prop,
XA_STRING, 8, PropModePrepend, &prop_ret[length], XA_STRING, 8, PropModePrepend, &prop_ret[length],
(nitems - length)); (nitems - length));
} }
} else { } else {
(void)memcpy(buf, prop_ret, buf_len); (void)memcpy(buf, prop_ret, buf_len);
...@@ -375,7 +399,7 @@ _XimXGetReadData( ...@@ -375,7 +399,7 @@ _XimXGetReadData(
&type_ret, &format_ret, &nitems, &bytes_after_ret, &prop_ret); &type_ret, &format_ret, &nitems, &bytes_after_ret, &prop_ret);
} }
XChangeProperty(im->core.display, spec->lib_connect_wid, prop, XChangeProperty(im->core.display, spec->lib_connect_wid, prop,
XA_STRING, 8, PropModePrepend, &prop_ret[buf_len], len); XA_STRING, 8, PropModePrepend, &prop_ret[buf_len], len);
event->xclient.data.l[0] = (long)len; event->xclient.data.l[0] = (long)len;
event->xclient.data.l[1] = (long)prop; event->xclient.data.l[1] = (long)prop;
XPutBackEvent(im->core.display, event); XPutBackEvent(im->core.display, event);
...@@ -400,7 +424,7 @@ _XimXGetReadData( ...@@ -400,7 +424,7 @@ _XimXGetReadData(
*ret_len = buf_len; *ret_len = buf_len;
len = nitems - buf_len; len = nitems - buf_len;
XChangeProperty(im->core.display, spec->lib_connect_wid, prop, XChangeProperty(im->core.display, spec->lib_connect_wid, prop,
XA_STRING, 8, PropModePrepend, &prop_ret[buf_len], len); XA_STRING, 8, PropModePrepend, &prop_ret[buf_len], len);
} }
XFree(prop_ret); XFree(prop_ret);
} }
...@@ -459,9 +483,7 @@ _XimXFlush(Xim im) ...@@ -459,9 +483,7 @@ _XimXFlush(Xim im)
} }
Public Bool Public Bool
_XimXConf(im, address) _XimXConf(Xim im, char *address)
Xim im;
char *address;
{ {
XSpecRec *spec; XSpecRec *spec;
......
/*
* Copyright 1992 Sun Microsystems, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
/****************************************************************** /******************************************************************
Copyright 1992 by Sun Microsystems, Inc.
Copyright 1992, 1993, 1994 by FUJITSU LIMITED Copyright 1992, 1993, 1994 by FUJITSU LIMITED
Permission to use, copy, modify, distribute, and sell this software Permission to use, copy, modify, distribute, and sell this software
and its documentation for any purpose is hereby granted without fee, and its documentation for any purpose is hereby granted without fee,
provided that the above copyright notice appear in all copies and provided that the above copyright notice appear in all copies and
that both that copyright notice and this permission notice appear that both that copyright notice and this permission notice appear
in supporting documentation, and that the name of Sun Microsystems, Inc. in supporting documentation, and that the name of FUJITSU LIMITED
and FUJITSU LIMITED not be used in advertising or publicity pertaining to not be used in advertising or publicity pertaining to distribution
distribution of the software without specific, written prior permission. of the software without specific, written prior permission.
Sun Microsystems, Inc. and FUJITSU LIMITED makes no representations about FUJITSU LIMITED makes no representations about the suitability of
the suitability of this software for any purpose. this software for any purpose.
It is provided "as is" without express or implied warranty. It is provided "as is" without express or implied warranty.
Sun Microsystems Inc. AND FUJITSU LIMITED DISCLAIMS ALL WARRANTIES WITH FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
AND FITNESS, IN NO EVENT SHALL Sun Microsystems, Inc. AND FUJITSU LIMITED EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc.
Takashi Fujiwara FUJITSU LIMITED Takashi Fujiwara FUJITSU LIMITED
fujiwara@a80.tech.yk.fujitsu.co.jp fujiwara@a80.tech.yk.fujitsu.co.jp
******************************************************************/ ******************************************************************/
...@@ -74,10 +95,7 @@ _XimTransConnect( ...@@ -74,10 +95,7 @@ _XimTransConnect(
spec->trans_conn = NULL; spec->trans_conn = NULL;
if (connect_stat == TRANS_TRY_CONNECT_AGAIN) if (connect_stat == TRANS_TRY_CONNECT_AGAIN)
{
sleep(1);
continue; continue;
}
else else
break; break;
} }
...@@ -98,8 +116,8 @@ _XimTransConnect( ...@@ -98,8 +116,8 @@ _XimTransConnect(
_XRegisterFilterByType(im->core.display, window, KeyPress, KeyPress, _XRegisterFilterByType(im->core.display, window, KeyPress, KeyPress,
_XimTransFilterWaitEvent, (XPointer)im); _XimTransFilterWaitEvent, (XPointer)im);
return _XRegisterInternalConnection(im->core.display, spec->fd, return _XRegisterInternalConnection(im->core.display, spec->fd,
(_XInternalConnectionProc)_XimTransInternalConnection, (_XInternalConnectionProc)_XimTransInternalConnection,
(XPointer)im); (XPointer)im);
} }
......
/*
* Copyright 1992 Sun Microsystems, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
/****************************************************************** /******************************************************************
Copyright 1992 by Sun Microsystems, Inc.
Copyright 1992, 1993, 1994 by FUJITSU LIMITED Copyright 1992, 1993, 1994 by FUJITSU LIMITED
Permission to use, copy, modify, distribute, and sell this software Permission to use, copy, modify, distribute, and sell this software
and its documentation for any purpose is hereby granted without fee, and its documentation for any purpose is hereby granted without fee,
provided that the above copyright notice appear in all copies and provided that the above copyright notice appear in all copies and
that both that copyright notice and this permission notice appear that both that copyright notice and this permission notice appear
in supporting documentation, and that the name of Sun Microsystems, Inc. in supporting documentation, and that the name of FUJITSU LIMITED
and FUJITSU LIMITED not be used in advertising or publicity pertaining to not be used in advertising or publicity pertaining to distribution
distribution of the software without specific, written prior permission. of the software without specific, written prior permission.
Sun Microsystems, Inc. and FUJITSU LIMITED makes no representations about FUJITSU LIMITED makes no representations about the suitability of
the suitability of this software for any purpose. this software for any purpose.
It is provided "as is" without express or implied warranty. It is provided "as is" without express or implied warranty.
Sun Microsystems Inc. AND FUJITSU LIMITED DISCLAIMS ALL WARRANTIES WITH FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
AND FITNESS, IN NO EVENT SHALL Sun Microsystems, Inc. AND FUJITSU LIMITED EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc.
Takashi Fujiwara FUJITSU LIMITED Takashi Fujiwara FUJITSU LIMITED
fujiwara@a80.tech.yk.fujitsu.co.jp fujiwara@a80.tech.yk.fujitsu.co.jp
******************************************************************/ ******************************************************************/
...@@ -37,7 +58,7 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ...@@ -37,7 +58,7 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "Ximint.h" #include "Ximint.h"
Public TransportSW _XimTransportRec[] = { Public TransportSW _XimTransportRec[] = {
{ "X", _XimXConf }, /* 1st entry must be X. { "X", _XimXConf }, /* 1st entry must be X.
This will be a fallback */ This will be a fallback */
#ifdef TCPCONN #ifdef TCPCONN
{ "tcp", _XimTransConf }, /* use X transport lib */ { "tcp", _XimTransConf }, /* use X transport lib */
...@@ -55,15 +76,13 @@ Public TransportSW _XimTransportRec[] = { ...@@ -55,15 +76,13 @@ Public TransportSW _XimTransportRec[] = {
}; };
Public Bool Public Bool
_XimConnect(im) _XimConnect(Xim im)
Xim im;
{ {
return im->private.proto.connect(im); return im->private.proto.connect(im);
} }
Public Bool Public Bool
_XimShutdown(im) _XimShutdown(Xim im)
Xim im;
{ {
return im->private.proto.shutdown(im); return im->private.proto.shutdown(im);
} }
...@@ -212,15 +231,8 @@ _XimCallDispatcher( ...@@ -212,15 +231,8 @@ _XimCallDispatcher(
} }
Public int Public int
_XimRead(im, len, buf, buf_size, predicate, arg) _XimRead(Xim im, INT16 *len, XPointer buf, int buf_size,
Xim im; Bool (*predicate)(Xim, INT16, XPointer, XPointer), XPointer arg)
INT16 *len;
XPointer buf;
int buf_size;
Bool (*predicate)(
Xim, INT16, XPointer, XPointer
);
XPointer arg;
{ {
INT16 read_len; INT16 read_len;
int ret_code; int ret_code;
...@@ -252,16 +264,14 @@ _XimRegisterDispatcher( ...@@ -252,16 +264,14 @@ _XimRegisterDispatcher(
} }
Public void Public void
_XimFlush(im) _XimFlush(Xim im)
Xim im;
{ {
im->private.proto.flush(im); im->private.proto.flush(im);
return; return;
} }
Public Bool Public Bool
_XimFilterWaitEvent(im) _XimFilterWaitEvent(Xim im)
Xim im;
{ {
INT16 read_len; INT16 read_len;
CARD32 reply32[BUFSIZE/4]; CARD32 reply32[BUFSIZE/4];
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
#define MB_LEN_MAX 6 #define MB_LEN_MAX 6
#endif #endif
#if !defined(macII) && !defined(Lynx_22) && !defined(X_LOCALE) #if !defined(Lynx_22) && !defined(X_LOCALE)
#define STDCVT #define STDCVT
#endif #endif
......
...@@ -62,7 +62,7 @@ OF THIS SOFTWARE. ...@@ -62,7 +62,7 @@ OF THIS SOFTWARE.
#define KANJI_CODESET 1 #define KANJI_CODESET 1
#define KANA_CODESET 2 #define KANA_CODESET 2
#define USERDEF_CODESET 3 #define USERDEF_CODESET 3
#define MAX_CODESETS #define MAX_CODESETS
#define GR 0x80 /* begins right-side (non-ascii) region */ #define GR 0x80 /* begins right-side (non-ascii) region */
#define GL 0x7f /* ends left-side (ascii) region */ #define GL 0x7f /* ends left-side (ascii) region */
...@@ -123,7 +123,7 @@ euc_mbstowcs( ...@@ -123,7 +123,7 @@ euc_mbstowcs(
const char *inbufptr = *from; const char *inbufptr = *from;
wchar_t *outbufptr = (wchar_t *) *to; wchar_t *outbufptr = (wchar_t *) *to;
CodeSet *codesets = XLC_GENERIC(lcd, codeset_list); CodeSet *codesets = XLC_GENERIC(lcd, codeset_list);
int codeset_num = XLC_GENERIC(lcd, codeset_num); int codeset_num = XLC_GENERIC(lcd, codeset_num);
Ulong wc_shift = XLC_GENERIC(lcd, wc_shift_bits); Ulong wc_shift = XLC_GENERIC(lcd, wc_shift_bits);
...@@ -213,7 +213,7 @@ euc_mbstowcs( ...@@ -213,7 +213,7 @@ euc_mbstowcs(
chrcode <<= (wc_shift * shift_mult); chrcode <<= (wc_shift * shift_mult);
shift_mult--; shift_mult--;
wc_tmp |= chrcode; wc_tmp |= chrcode;
if (--chr_len == 0) { if (--chr_len == 0) {
wc_tmp |= wc_encode; wc_tmp |= wc_encode;
...@@ -438,11 +438,11 @@ euc_mbstocs( ...@@ -438,11 +438,11 @@ euc_mbstocs(
*from_left = tmp_from_left; *from_left = tmp_from_left;
*to = (XPointer) tmp_to; *to = (XPointer) tmp_to;
*to_left = tmp_to_left; *to_left = tmp_to_left;
} }
if (num_args > 0) if (num_args > 0)
*((XlcCharSet *) args[0]) = charset; *((XlcCharSet *) args[0]) = charset;
return unconv_num; return unconv_num;
} }
...@@ -528,7 +528,7 @@ euc_cstombs( ...@@ -528,7 +528,7 @@ euc_cstombs(
if (num_args < 1) if (num_args < 1)
return -1; return -1;
if (!(codeset = GetCodeSetFromCharSet(lcd, (XlcCharSet) args[0]))) if (!(codeset = GetCodeSetFromCharSet(lcd, (XlcCharSet) args[0])))
return -1; return -1;
...@@ -586,10 +586,10 @@ euc_cstowcs( ...@@ -586,10 +586,10 @@ euc_cstowcs(
int length; int length;
Ulong wc_shift_bits = XLC_GENERIC(lcd, wc_shift_bits); Ulong wc_shift_bits = XLC_GENERIC(lcd, wc_shift_bits);
CodeSet codeset; CodeSet codeset;
if (num_args < 1) if (num_args < 1)
return -1; return -1;
if (!(codeset = GetCodeSetFromCharSet(lcd, (XlcCharSet) args[0]))) if (!(codeset = GetCodeSetFromCharSet(lcd, (XlcCharSet) args[0])))
return -1; return -1;
...@@ -602,7 +602,7 @@ euc_cstowcs( ...@@ -602,7 +602,7 @@ euc_cstowcs(
toptr += buf_len; toptr += buf_len;
*to = (XPointer) toptr; *to = (XPointer) toptr;
while (buf_len--) { while (buf_len--) {
wch = (wchar_t) BIT8OFF(*csptr); wch = (wchar_t) BIT8OFF(*csptr);
...@@ -674,7 +674,7 @@ create_conv( ...@@ -674,7 +674,7 @@ create_conv(
conv = (XlcConv) Xmalloc(sizeof(XlcConvRec)); conv = (XlcConv) Xmalloc(sizeof(XlcConvRec));
if (conv == NULL) if (conv == NULL)
return (XlcConv) NULL; return (XlcConv) NULL;
conv->methods = methods; conv->methods = methods;
conv->state = (XPointer) lcd; conv->state = (XPointer) lcd;
return conv; return conv;
...@@ -1068,7 +1068,7 @@ euc_wcstocts( ...@@ -1068,7 +1068,7 @@ euc_wcstocts(
} }
} while (length); } while (length);
} /* end for */ } /* end for */
...@@ -1327,7 +1327,7 @@ euc_mbstocts( ...@@ -1327,7 +1327,7 @@ euc_mbstocts(
unconv_num++; unconv_num++;
break; break;
} }
if (ctptr) { if (ctptr) {
strcpy(ctptr, ctdptr[cs_num]->ct_encoding); strcpy(ctptr, ctdptr[cs_num]->ct_encoding);
ctptr += ctdptr[cs_num]->ct_encoding_len; ctptr += ctdptr[cs_num]->ct_encoding_len;
...@@ -1347,7 +1347,7 @@ euc_mbstocts( ...@@ -1347,7 +1347,7 @@ euc_mbstocts(
do { do {
*ctptr++ = charset == ct_state.GR_charset ? *ctptr++ = charset == ct_state.GR_charset ?
BIT8ON(*inbufptr++) : BIT8OFF(*inbufptr++); BIT8ON(*inbufptr++) : BIT8OFF(*inbufptr++);
} while (--clen); } while (--clen);
} }
*to = (XPointer)ctptr; *to = (XPointer)ctptr;
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
* *
*/ */
/* /*
* 2000 * 2000
* Modifier: Ivan Pascal The XFree86 Project * Modifier: Ivan Pascal The XFree86 Project
*/ */
...@@ -53,13 +53,13 @@ ...@@ -53,13 +53,13 @@
#include "XlcGeneric.h" #include "XlcGeneric.h"
#include <stdio.h> #include <stdio.h>
#if !defined(macII) && !defined(Lynx_22) && !defined(X_LOCALE) #if !defined(Lynx_22) && !defined(X_LOCALE)
#define STDCVT #define STDCVT
#endif #endif
typedef struct _CTDataRec { typedef struct _CTDataRec {
char *name; const char *name;
char *encoding; /* Compound Text encoding */ const char *encoding; /* Compound Text encoding */
} CTDataRec, *CTData; } CTDataRec, *CTData;
static CTDataRec directionality_data[] = static CTDataRec directionality_data[] =
...@@ -199,7 +199,7 @@ mb_to_gi( ...@@ -199,7 +199,7 @@ mb_to_gi(
return(mb_tmp); return(mb_tmp);
} }
if (codeset->side == XlcC0 || codeset->side == XlcGL || if (codeset->side == XlcC0 || codeset->side == XlcGL ||
codeset->side == XlcC1 || codeset->side == XlcGR) { codeset->side == XlcC1 || codeset->side == XlcGR) {
for (i = 0; i < codeset->length; i++) for (i = 0; i < codeset->length; i++)
...@@ -281,7 +281,7 @@ wc_to_gi( ...@@ -281,7 +281,7 @@ wc_to_gi(
wc = wc & ~wc_encode_mask; wc = wc & ~wc_encode_mask;
for (*glyph_index = 0, i = (*codeset)->length - 1; i >= 0; i--) for (*glyph_index = 0, i = (*codeset)->length - 1; i >= 0; i--)
*glyph_index = (*glyph_index << 8) | *glyph_index = (*glyph_index << 8) |
( ((unsigned long)wc >> (i * wc_shift_bits)) & mask ); ( ((unsigned long)wc >> (i * wc_shift_bits)) & mask );
return(True); return(True);
...@@ -300,7 +300,7 @@ mb_parse_codeset( ...@@ -300,7 +300,7 @@ mb_parse_codeset(
ParseInfo *mb_parse_list = XLC_GENERIC(state->lcd, mb_parse_list); ParseInfo *mb_parse_list = XLC_GENERIC(state->lcd, mb_parse_list);
ParseInfo parse_info; ParseInfo parse_info;
CodeSet codeset; CodeSet codeset;
for (--num ; (parse_info = mb_parse_list[num]) != NULL; num++) { for (--num ; (parse_info = mb_parse_list[num]) != NULL; num++) {
len = compare(src, parse_info->encoding, from_len); len = compare(src, parse_info->encoding, from_len);
if (len > 0) { if (len > 0) {
...@@ -342,7 +342,7 @@ byteM_parse_codeset( ...@@ -342,7 +342,7 @@ byteM_parse_codeset(
continue; continue;
for (j = 0; j < codeset->length; j++) { for (j = 0; j < codeset->length; j++) {
ch = *((unsigned char *)(inbufptr + j)); ch = *((unsigned char *)(inbufptr + j));
byteM_rec = byteM[j]; byteM_rec = byteM[j];
byteinfo = byteM_rec.byteinfo; byteinfo = byteM_rec.byteinfo;
...@@ -363,7 +363,7 @@ byteM_parse_codeset( ...@@ -363,7 +363,7 @@ byteM_parse_codeset(
} }
return(NULL); return(NULL);
} }
#define GLGR_parse_codeset(ch) \ #define GLGR_parse_codeset(ch) \
(isrightside(ch) ? (state->GR_codeset) : \ (isrightside(ch) ? (state->GR_codeset) : \
...@@ -428,7 +428,7 @@ ct_parse_csi( ...@@ -428,7 +428,7 @@ ct_parse_csi(
if ( !(*ctr_seq_len = strlen(directionality_data[i].encoding)) ) if ( !(*ctr_seq_len = strlen(directionality_data[i].encoding)) )
continue; continue;
if ( strncmp(inbufptr, directionality_data[i].encoding, if ( strncmp(inbufptr, directionality_data[i].encoding,
*ctr_seq_len) == 0) *ctr_seq_len) == 0)
return(True); return(True);
} }
...@@ -571,7 +571,7 @@ segment_conversion( ...@@ -571,7 +571,7 @@ segment_conversion(
range = segment_conv[i].range; range = segment_conv[i].range;
if (*glyph_index < range.start || range.end < *glyph_index) if (*glyph_index < range.start || range.end < *glyph_index)
return(True); return(True);
*charset = segment_conv[i].dest; *charset = segment_conv[i].dest;
conv_rec.conv_num = segment_conv[i].conv_num; conv_rec.conv_num = segment_conv[i].conv_num;
conv_rec.convlist = segment_conv[i].conv; conv_rec.convlist = segment_conv[i].conv;
...@@ -799,7 +799,7 @@ mbstowcs_org( ...@@ -799,7 +799,7 @@ mbstowcs_org(
continue; continue;
} }
} }
/* next mb char data for byteM ? */ /* next mb char data for byteM ? */
if ((codeset = byteM_parse_codeset(lcd, (inbufptr - 1)))) if ((codeset = byteM_parse_codeset(lcd, (inbufptr - 1))))
goto next_mb_char; goto next_mb_char;
...@@ -807,7 +807,7 @@ mbstowcs_org( ...@@ -807,7 +807,7 @@ mbstowcs_org(
/* next mb char data for GL or GR side ? */ /* next mb char data for GL or GR side ? */
if ((codeset = GLGR_parse_codeset(ch))) if ((codeset = GLGR_parse_codeset(ch)))
goto next_mb_char; goto next_mb_char;
/* can't find codeset for the ch */ /* can't find codeset for the ch */
unconv_num++; unconv_num++;
continue; continue;
...@@ -876,7 +876,7 @@ stdc_mbstowcs( ...@@ -876,7 +876,7 @@ stdc_mbstowcs(
/* null ? */ /* null ? */
src++; src++;
src_left--; src_left--;
if (dst) if (dst)
*dst++ = L'\0'; *dst++ = L'\0';
dst_left--; dst_left--;
} }
...@@ -916,7 +916,7 @@ wcstombs_org( ...@@ -916,7 +916,7 @@ wcstombs_org(
const wchar_t *inbufptr = (const wchar_t *) *from; const wchar_t *inbufptr = (const wchar_t *) *from;
char *outbufptr = *to; char *outbufptr = *to;
int from_size = *from_left; int from_size = *from_left;
const char *default_string = XLC_PUBLIC(lcd, default_string); const char *default_string = XLC_PUBLIC(lcd, default_string);
int defstr_len = strlen(default_string); int defstr_len = strlen(default_string);
...@@ -1031,14 +1031,14 @@ stdc_wcstombs( ...@@ -1031,14 +1031,14 @@ stdc_wcstombs(
if (length > 0) { if (length > 0) {
src++; src++;
src_left--; src_left--;
if (dst) if (dst)
dst += length; dst += length;
dst_left -= length; dst_left -= length;
} else if (length < 0) { } else if (length < 0) {
src++; src++;
src_left--; src_left--;
unconv_num++; unconv_num++;
} }
} }
*from = (XPointer) src; *from = (XPointer) src;
...@@ -1117,7 +1117,7 @@ wcstocts( ...@@ -1117,7 +1117,7 @@ wcstocts(
* +-----+-----+-----+-----+-----+-----+-----+---- ----+-----+-----+ * +-----+-----+-----+-----+-----+-----+-----+---- ----+-----+-----+
* | esc sequence | M | L | encoding name | STX | * | esc sequence | M | L | encoding name | STX |
* +-----+-----+-----+-----+-----+-----+-----+---- ----+-----+-----+ * +-----+-----+-----+-----+-----+-----+-----+---- ----+-----+-----+
* 4bytes 1byte 1byte variable length 1byte * 4bytes 1byte 1byte variable length 1byte
* | | * | |
* +-----------------------------------------+ * +-----------------------------------------+
* name length = ((M - 128) * 128) + (L - 128) * name length = ((M - 128) * 128) + (L - 128)
...@@ -1145,7 +1145,7 @@ wcstocts( ...@@ -1145,7 +1145,7 @@ wcstocts(
*ext_seg_len = i % 128 + 128; *ext_seg_len = i % 128 + 128;
ext_seg_len = NULL; ext_seg_len = NULL;
} }
if (*to_left < total_len + 1) { if (*to_left < total_len + 1) {
unconv_num++; unconv_num++;
break; break;
...@@ -1219,14 +1219,14 @@ stdc_wcstocts( ...@@ -1219,14 +1219,14 @@ stdc_wcstocts(
int buf_left2; int buf_left2;
int unconv_num1 = 0, unconv_num2 = 0; int unconv_num1 = 0, unconv_num2 = 0;
unconv_num1 = stdc_wcstombs(conv, unconv_num1 = stdc_wcstombs(conv,
from, from_left, &buf_ptr1, &buf_left1, args, num_args); from, from_left, &buf_ptr1, &buf_left1, args, num_args);
if (unconv_num1 < 0) if (unconv_num1 < 0)
goto ret; goto ret;
buf_left2 = buf_ptr1 - buf_ptr2; buf_left2 = buf_ptr1 - buf_ptr2;
unconv_num2 = mbstocts(conv, unconv_num2 = mbstocts(conv,
&buf_ptr2, &buf_left2, to, to_left, args, num_args); &buf_ptr2, &buf_left2, to, to_left, args, num_args);
if (unconv_num2 < 0) if (unconv_num2 < 0)
goto ret; goto ret;
...@@ -1319,25 +1319,25 @@ ctstowcs( ...@@ -1319,25 +1319,25 @@ ctstowcs(
/* escape sequence ? */ /* escape sequence ? */
if (ch == ESC) { if (ch == ESC) {
if ( !ct_parse_charset(lcd, if ( !ct_parse_charset(lcd,
inbufptr - 1, &state->charset, &ctr_seq_len) ) inbufptr - 1, &state->charset, &ctr_seq_len) )
goto skip_the_seg; goto skip_the_seg;
if (state->charset->side == XlcC0 || if (state->charset->side == XlcC0 ||
state->charset->side == XlcGL) state->charset->side == XlcGL)
{ {
state->GL_charset = state->charset; state->GL_charset = state->charset;
} }
else if (state->charset->side == XlcC1 || else if (state->charset->side == XlcC1 ||
state->charset->side == XlcGR) state->charset->side == XlcGR)
{ {
state->GR_charset = state->charset; state->GR_charset = state->charset;
} }
else if (state->charset->side == XlcGLGR) else if (state->charset->side == XlcGLGR)
{ {
state->GL_charset = state->charset; state->GL_charset = state->charset;
state->GR_charset = state->charset; state->GR_charset = state->charset;
} }
if (*from_left + 1 < ctr_seq_len) { if (*from_left + 1 < ctr_seq_len) {
inbufptr--; inbufptr--;
...@@ -1351,7 +1351,7 @@ ctstowcs( ...@@ -1351,7 +1351,7 @@ ctstowcs(
*from_left -= (ctr_seq_len - 1); *from_left -= (ctr_seq_len - 1);
continue; continue;
} }
/* check current state */ /* check current state */
if (isleftside(ch)) if (isleftside(ch))
...@@ -1378,7 +1378,7 @@ output_one_wc: ...@@ -1378,7 +1378,7 @@ output_one_wc:
segment_conversion(lcd, &charset_tmp, &glyph_index); segment_conversion(lcd, &charset_tmp, &glyph_index);
/* get codeset */ /* get codeset */
if ( !_XlcGetCodeSetFromCharSet(lcd, charset_tmp, if ( !_XlcGetCodeSetFromCharSet(lcd, charset_tmp,
&codeset, &glyph_index) ) { &codeset, &glyph_index) ) {
unconv_num += gi_len; unconv_num += gi_len;
continue; continue;
...@@ -1497,7 +1497,7 @@ cstowcs( ...@@ -1497,7 +1497,7 @@ cstowcs(
segment_conversion(lcd, &charset_tmp, &glyph_index); segment_conversion(lcd, &charset_tmp, &glyph_index);
/* get codeset */ /* get codeset */
if ( !_XlcGetCodeSetFromCharSet(lcd, charset_tmp, if ( !_XlcGetCodeSetFromCharSet(lcd, charset_tmp,
&codeset, &glyph_index) ) { &codeset, &glyph_index) ) {
unconv_num += gi_len; unconv_num += gi_len;
continue; continue;
...@@ -1542,14 +1542,14 @@ stdc_ctstowcs( ...@@ -1542,14 +1542,14 @@ stdc_ctstowcs(
int buf_left2; int buf_left2;
int unconv_num1 = 0, unconv_num2 = 0; int unconv_num1 = 0, unconv_num2 = 0;
unconv_num1 = ctstombs(conv, unconv_num1 = ctstombs(conv,
from, from_left, &buf_ptr1, &buf_left1, args, num_args); from, from_left, &buf_ptr1, &buf_left1, args, num_args);
if (unconv_num1 < 0) if (unconv_num1 < 0)
goto ret; goto ret;
buf_left2 = buf_ptr1 - buf_ptr2; buf_left2 = buf_ptr1 - buf_ptr2;
unconv_num2 = stdc_mbstowcs(conv, unconv_num2 = stdc_mbstowcs(conv,
&buf_ptr2, &buf_left2, to, to_left, args, num_args); &buf_ptr2, &buf_left2, to, to_left, args, num_args);
if (unconv_num2 < 0) if (unconv_num2 < 0)
goto ret; goto ret;
...@@ -1578,14 +1578,14 @@ stdc_cstowcs( ...@@ -1578,14 +1578,14 @@ stdc_cstowcs(
int buf_left2; int buf_left2;
int unconv_num1 = 0, unconv_num2 = 0; int unconv_num1 = 0, unconv_num2 = 0;
unconv_num1 = cstombs(conv, unconv_num1 = cstombs(conv,
from, from_left, &buf_ptr1, &buf_left1, args, num_args); from, from_left, &buf_ptr1, &buf_left1, args, num_args);
if (unconv_num1 < 0) if (unconv_num1 < 0)
goto ret; goto ret;
buf_left2 = buf_ptr1 - buf_ptr2; buf_left2 = buf_ptr1 - buf_ptr2;
unconv_num2 = stdc_mbstowcs(conv, unconv_num2 = stdc_mbstowcs(conv,
&buf_ptr2, &buf_left2, to, to_left, args, num_args); &buf_ptr2, &buf_left2, to, to_left, args, num_args);
if (unconv_num2 < 0) if (unconv_num2 < 0)
goto ret; goto ret;
...@@ -1614,14 +1614,14 @@ mbstocts( ...@@ -1614,14 +1614,14 @@ mbstocts(
int buf_left2; int buf_left2;
int unconv_num1 = 0, unconv_num2 = 0; int unconv_num1 = 0, unconv_num2 = 0;
unconv_num1 = mbstowcs_org(conv, unconv_num1 = mbstowcs_org(conv,
from, from_left, &buf_ptr1, &buf_left1, args, num_args); from, from_left, &buf_ptr1, &buf_left1, args, num_args);
if (unconv_num1 < 0) if (unconv_num1 < 0)
goto ret; goto ret;
buf_left2 = (buf_ptr1 - buf_ptr2) / sizeof(wchar_t); buf_left2 = (buf_ptr1 - buf_ptr2) / sizeof(wchar_t);
unconv_num2 += wcstocts(conv, unconv_num2 += wcstocts(conv,
&buf_ptr2, &buf_left2, to, to_left, args, num_args); &buf_ptr2, &buf_left2, to, to_left, args, num_args);
if (unconv_num2 < 0) if (unconv_num2 < 0)
goto ret; goto ret;
...@@ -1709,7 +1709,7 @@ mbstostr( ...@@ -1709,7 +1709,7 @@ mbstostr(
/* next char data : GL or GR side ? */ /* next char data : GL or GR side ? */
if ((codeset = GLGR_parse_codeset(ch))) if ((codeset = GLGR_parse_codeset(ch)))
goto next_mb_char; goto next_mb_char;
/* can't find codeset for the ch */ /* can't find codeset for the ch */
unconv_num++; unconv_num++;
continue; continue;
...@@ -1821,7 +1821,7 @@ mbtocs( ...@@ -1821,7 +1821,7 @@ mbtocs(
/* next mb char data for GL or GR side ? */ /* next mb char data for GL or GR side ? */
if ((codeset = GLGR_parse_codeset(ch))) if ((codeset = GLGR_parse_codeset(ch)))
goto next_mb_char; goto next_mb_char;
/* can't find codeset for the ch */ /* can't find codeset for the ch */
unconv_num = 1; unconv_num = 1;
break; break;
...@@ -1904,7 +1904,7 @@ mbstocs( ...@@ -1904,7 +1904,7 @@ mbstocs(
ret = mbtocs(conv, from, from_left, to, to_left, tmp_args, 1); ret = mbtocs(conv, from, from_left, to, to_left, tmp_args, 1);
charset_old = charset; charset_old = charset;
while ( ret == 0 && *from_left && *to_left) { while ( ret == 0 && *from_left && *to_left) {
inbufptr = *from; inbufptr = *from;
in_left = *from_left; in_left = *from_left;
...@@ -1955,7 +1955,7 @@ wcstostr( ...@@ -1955,7 +1955,7 @@ wcstostr(
const wchar_t *inbufptr = (const wchar_t *) *from; const wchar_t *inbufptr = (const wchar_t *) *from;
char *outbufptr = *to; char *outbufptr = *to;
int from_size = *from_left; int from_size = *from_left;
const char *default_string = XLC_PUBLIC(lcd, default_string); const char *default_string = XLC_PUBLIC(lcd, default_string);
int defstr_len = strlen(default_string); int defstr_len = strlen(default_string);
...@@ -2071,14 +2071,14 @@ stdc_wcstostr( ...@@ -2071,14 +2071,14 @@ stdc_wcstostr(
int buf_left2; int buf_left2;
int unconv_num1 = 0, unconv_num2 = 0; int unconv_num1 = 0, unconv_num2 = 0;
unconv_num1 = stdc_wcstombs(conv, unconv_num1 = stdc_wcstombs(conv,
from, from_left, &buf_ptr1, &buf_left1, args, num_args); from, from_left, &buf_ptr1, &buf_left1, args, num_args);
if (unconv_num1 < 0) if (unconv_num1 < 0)
goto ret; goto ret;
buf_left2 = buf_ptr1 - buf_ptr2; buf_left2 = buf_ptr1 - buf_ptr2;
unconv_num2 = mbstostr(conv, unconv_num2 = mbstostr(conv,
&buf_ptr2, &buf_left2, to, to_left, args, num_args); &buf_ptr2, &buf_left2, to, to_left, args, num_args);
if (unconv_num2 < 0) if (unconv_num2 < 0)
goto ret; goto ret;
...@@ -2204,7 +2204,7 @@ stdc_wctocs( ...@@ -2204,7 +2204,7 @@ stdc_wctocs(
} else { } else {
goto end; goto end;
} }
if (length < 0) if (length < 0)
goto end; goto end;
...@@ -2349,14 +2349,14 @@ ctstombs( ...@@ -2349,14 +2349,14 @@ ctstombs(
int buf_left2; int buf_left2;
int unconv_num1 = 0, unconv_num2 = 0; int unconv_num1 = 0, unconv_num2 = 0;
unconv_num1 = ctstowcs(conv, unconv_num1 = ctstowcs(conv,
from, from_left, &buf_ptr1, &buf_left1, args, num_args); from, from_left, &buf_ptr1, &buf_left1, args, num_args);
if (unconv_num1 < 0) if (unconv_num1 < 0)
goto ret; goto ret;
buf_left2 = (buf_ptr1 - buf_ptr2) / sizeof(wchar_t); buf_left2 = (buf_ptr1 - buf_ptr2) / sizeof(wchar_t);
unconv_num2 += wcstombs_org(conv, unconv_num2 += wcstombs_org(conv,
&buf_ptr2, &buf_left2, to, to_left, args, num_args); &buf_ptr2, &buf_left2, to, to_left, args, num_args);
if (unconv_num2 < 0) if (unconv_num2 < 0)
goto ret; goto ret;
...@@ -2385,14 +2385,14 @@ cstombs( ...@@ -2385,14 +2385,14 @@ cstombs(
int buf_left2; int buf_left2;
int unconv_num1 = 0, unconv_num2 = 0; int unconv_num1 = 0, unconv_num2 = 0;
unconv_num1 = cstowcs(conv, unconv_num1 = cstowcs(conv,
from, from_left, &buf_ptr1, &buf_left1, args, num_args); from, from_left, &buf_ptr1, &buf_left1, args, num_args);
if (unconv_num1 < 0) if (unconv_num1 < 0)
goto ret; goto ret;
buf_left2 = (buf_ptr1 - buf_ptr2) / sizeof(wchar_t); buf_left2 = (buf_ptr1 - buf_ptr2) / sizeof(wchar_t);
unconv_num2 += wcstombs_org(conv, unconv_num2 += wcstombs_org(conv,
&buf_ptr2, &buf_left2, to, to_left, args, num_args); &buf_ptr2, &buf_left2, to, to_left, args, num_args);
if (unconv_num2 < 0) if (unconv_num2 < 0)
goto ret; goto ret;
...@@ -2600,14 +2600,14 @@ stdc_strtowcs( ...@@ -2600,14 +2600,14 @@ stdc_strtowcs(
int buf_left2; int buf_left2;
int unconv_num1 = 0, unconv_num2 = 0; int unconv_num1 = 0, unconv_num2 = 0;
unconv_num1 = strtombs(conv, unconv_num1 = strtombs(conv,
from, from_left, &buf_ptr1, &buf_left1, args, num_args); from, from_left, &buf_ptr1, &buf_left1, args, num_args);
if (unconv_num1 < 0) if (unconv_num1 < 0)
goto ret; goto ret;
buf_left2 = buf_ptr1 - buf_ptr2; buf_left2 = buf_ptr1 - buf_ptr2;
unconv_num2 = stdc_mbstowcs(conv, unconv_num2 = stdc_mbstowcs(conv,
&buf_ptr2, &buf_left2, to, to_left, args, num_args); &buf_ptr2, &buf_left2, to, to_left, args, num_args);
if (unconv_num2 < 0) if (unconv_num2 < 0)
goto ret; goto ret;
...@@ -2653,23 +2653,23 @@ create_conv( ...@@ -2653,23 +2653,23 @@ create_conv(
conv = (XlcConv) Xmalloc(sizeof(XlcConvRec)); conv = (XlcConv) Xmalloc(sizeof(XlcConvRec));
if (conv == NULL) if (conv == NULL)
return (XlcConv) NULL; return (XlcConv) NULL;
conv->methods = (XlcConvMethods) Xmalloc(sizeof(XlcConvMethodsRec)); conv->methods = (XlcConvMethods) Xmalloc(sizeof(XlcConvMethodsRec));
if (conv->methods == NULL) if (conv->methods == NULL)
goto err; goto err;
*conv->methods = *methods; *conv->methods = *methods;
conv->methods->reset = init_state; conv->methods->reset = init_state;
conv->state = (XPointer) Xmalloc(sizeof(StateRec)); conv->state = (XPointer) Xmalloc(sizeof(StateRec));
if (conv->state == NULL) if (conv->state == NULL)
goto err; goto err;
bzero((char *) conv->state, sizeof(StateRec)); bzero((char *) conv->state, sizeof(StateRec));
state = (State) conv->state; state = (State) conv->state;
state->lcd = lcd; state->lcd = lcd;
_XlcResetConverter(conv); _XlcResetConverter(conv);
return conv; return conv;
err: err:
...@@ -3110,7 +3110,7 @@ _XlcGenericLoader( ...@@ -3110,7 +3110,7 @@ _XlcGenericLoader(
_XlcSetConverter(lcd, XlcNCompoundText, lcd, XlcNMultiByte, open_ctstombs); _XlcSetConverter(lcd, XlcNCompoundText, lcd, XlcNMultiByte, open_ctstombs);
_XlcSetConverter(lcd, XlcNString, lcd, XlcNMultiByte, open_strtombs); _XlcSetConverter(lcd, XlcNString, lcd, XlcNMultiByte, open_strtombs);
_XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNMultiByte, open_cstombs); _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNMultiByte, open_cstombs);
#ifdef STDCVT #ifdef STDCVT
gen = XLC_GENERIC_PART(lcd); gen = XLC_GENERIC_PART(lcd);
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#include "XlcGeneric.h" #include "XlcGeneric.h"
#include <stdio.h> #include <stdio.h>
#if !defined(macII) && !defined(X_LOCALE) #if !defined(X_LOCALE)
#define STDCVT #define STDCVT
#endif #endif
...@@ -220,7 +220,7 @@ mbstocs( ...@@ -220,7 +220,7 @@ mbstocs(
if (num_args > 0) if (num_args > 0)
*((XlcCharSet *) args[0]) = charset; *((XlcCharSet *) args[0]) = charset;
return unconv_num; return unconv_num;
} }
...@@ -372,7 +372,7 @@ cstombs( ...@@ -372,7 +372,7 @@ cstombs(
if (num_args < 1) if (num_args < 1)
return -1; return -1;
charset = (XlcCharSet) args[0]; charset = (XlcCharSet) args[0];
codeset = GetCodeSetFromCharSet(state->lcd, charset); codeset = GetCodeSetFromCharSet(state->lcd, charset);
...@@ -418,7 +418,7 @@ cstombs( ...@@ -418,7 +418,7 @@ cstombs(
buf_len /= codeset->length + encoding_len; buf_len /= codeset->length + encoding_len;
if (csstr_len < buf_len) if (csstr_len < buf_len)
buf_len = csstr_len; buf_len = csstr_len;
cvt_length += buf_len * (encoding_len + codeset->length); cvt_length += buf_len * (encoding_len + codeset->length);
if (bufptr) { if (bufptr) {
while (buf_len--) { while (buf_len--) {
...@@ -478,7 +478,7 @@ cstowcs( ...@@ -478,7 +478,7 @@ cstowcs(
if (num_args < 1) if (num_args < 1)
return -1; return -1;
codeset = GetCodeSetFromCharSet(lcd, (XlcCharSet) args[0]); codeset = GetCodeSetFromCharSet(lcd, (XlcCharSet) args[0]);
if (codeset == NULL) if (codeset == NULL)
return -1; return -1;
...@@ -487,7 +487,7 @@ cstowcs( ...@@ -487,7 +487,7 @@ cstowcs(
csstr_len /= length; csstr_len /= length;
if (csstr_len < buf_len) if (csstr_len < buf_len)
buf_len = csstr_len; buf_len = csstr_len;
code_mask = ~XLC_GENERIC(lcd, wc_encode_mask); code_mask = ~XLC_GENERIC(lcd, wc_encode_mask);
wc_encoding = codeset->wc_encoding; wc_encoding = codeset->wc_encoding;
wc_shift_bits = XLC_GENERIC(lcd, wc_shift_bits); wc_shift_bits = XLC_GENERIC(lcd, wc_shift_bits);
...@@ -537,7 +537,7 @@ create_conv( ...@@ -537,7 +537,7 @@ create_conv(
conv = (XlcConv) Xmalloc(sizeof(XlcConvRec)); conv = (XlcConv) Xmalloc(sizeof(XlcConvRec));
if (conv == NULL) if (conv == NULL)
return (XlcConv) NULL; return (XlcConv) NULL;
conv->methods = (XlcConvMethods) Xmalloc(sizeof(XlcConvMethodsRec)); conv->methods = (XlcConvMethods) Xmalloc(sizeof(XlcConvMethodsRec));
if (conv->methods == NULL) if (conv->methods == NULL)
goto err; goto err;
...@@ -549,11 +549,11 @@ create_conv( ...@@ -549,11 +549,11 @@ create_conv(
if (conv->state == NULL) if (conv->state == NULL)
goto err; goto err;
bzero((char *) conv->state, sizeof(StateRec)); bzero((char *) conv->state, sizeof(StateRec));
state = (State) conv->state; state = (State) conv->state;
state->lcd = lcd; state->lcd = lcd;
init_state(conv); init_state(conv);
return conv; return conv;
err: err:
...@@ -760,7 +760,7 @@ stdc_wcstocs( ...@@ -760,7 +760,7 @@ stdc_wcstocs(
length = 1; length = 1;
*tmp = '\0'; *tmp = '\0';
} }
if (length < 0) if (length < 0)
break; break;
...@@ -786,7 +786,7 @@ stdc_wcstocs( ...@@ -786,7 +786,7 @@ stdc_wcstocs(
if (num_args > 0) if (num_args > 0)
*((XlcCharSet *) args[0]) = charset; *((XlcCharSet *) args[0]) = charset;
return unconv_num; return unconv_num;
} }
...@@ -808,7 +808,7 @@ stdc_cstowcs( ...@@ -808,7 +808,7 @@ stdc_cstowcs(
DefineLocalBuf; DefineLocalBuf;
XPointer buf, save_buf; XPointer buf, save_buf;
int length, left, ret; int length, left, ret;
left = length = *to_left * XLC_PUBLIC(lcd, mb_cur_max); left = length = *to_left * XLC_PUBLIC(lcd, mb_cur_max);
buf = save_buf = (XPointer) AllocLocalBuf(length); buf = save_buf = (XPointer) AllocLocalBuf(length);
if (buf == NULL) if (buf == NULL)
...@@ -817,7 +817,7 @@ stdc_cstowcs( ...@@ -817,7 +817,7 @@ stdc_cstowcs(
ret = cstombs(conv, from, from_left, &buf, &left, args, num_args); ret = cstombs(conv, from, from_left, &buf, &left, args, num_args);
if (ret < 0) if (ret < 0)
goto err; goto err;
buf = save_buf; buf = save_buf;
length -= left; length -= left;
if (stdc_mbstowcs(conv, &buf, &length, to, to_left, args, num_args) < 0) if (stdc_mbstowcs(conv, &buf, &length, to, to_left, args, num_args) < 0)
......
...@@ -154,7 +154,7 @@ sjis_mbstowcs( ...@@ -154,7 +154,7 @@ sjis_mbstowcs(
wchar_t *outbufptr = (wchar_t *) *to; wchar_t *outbufptr = (wchar_t *) *to;
wchar_t *outbuf_base = outbufptr; wchar_t *outbuf_base = outbufptr;
CodeSet *codesets = XLC_GENERIC(lcd, codeset_list); CodeSet *codesets = XLC_GENERIC(lcd, codeset_list);
int codeset_num = XLC_GENERIC(lcd, codeset_num); int codeset_num = XLC_GENERIC(lcd, codeset_num);
Ulong wc_shift = XLC_GENERIC(lcd, wc_shift_bits); Ulong wc_shift = XLC_GENERIC(lcd, wc_shift_bits);
...@@ -321,7 +321,7 @@ sjis_wcstombs( ...@@ -321,7 +321,7 @@ sjis_wcstombs(
} }
*outbufptr++ = (char)tmp; *outbufptr++ = (char)tmp;
} while (length); } while (length);
} /* end for */ } /* end for */
...@@ -390,7 +390,7 @@ wc_codeset( ...@@ -390,7 +390,7 @@ wc_codeset(
return( codesets[0] ); return( codesets[0] );
#endif #endif
} }
static int static int
sjis_mbtocs( sjis_mbtocs(
...@@ -419,7 +419,7 @@ sjis_mbtocs( ...@@ -419,7 +419,7 @@ sjis_mbtocs(
if (*from_left >= char_size && *to_left >= char_size) { if (*from_left >= char_size && *to_left >= char_size) {
*dst++ = *src++; *dst++ = *src++;
*dst++ = *src++; *dst++ = *src++;
if (!VALID_MULTIBYTE((Uchar) *(src-1))) /* check 2nd byte */ if (!VALID_MULTIBYTE((Uchar) *(src-1))) /* check 2nd byte */
unconv_num++; unconv_num++;
sjis_to_jis((Uchar *)(dst-2), (Uchar *)(dst-1)); sjis_to_jis((Uchar *)(dst-2), (Uchar *)(dst-1));
...@@ -431,10 +431,10 @@ sjis_mbtocs( ...@@ -431,10 +431,10 @@ sjis_mbtocs(
return -1; return -1;
charset = *CS3->charset_list; charset = *CS3->charset_list;
char_size = charset->char_size; char_size = charset->char_size;
if (*from_left >= char_size && *to_left >= char_size) { if (*from_left >= char_size && *to_left >= char_size) {
*dst++ = *src++; *dst++ = *src++;
*dst++ = *src++; *dst++ = *src++;
if (!VALID_MULTIBYTE((Uchar) *(src-1))) /* check 2nd byte */ if (!VALID_MULTIBYTE((Uchar) *(src-1))) /* check 2nd byte */
unconv_num++; unconv_num++;
sjis_to_jis((Uchar *)(dst-2), (Uchar *)(dst-1)); sjis_to_jis((Uchar *)(dst-2), (Uchar *)(dst-1));
...@@ -528,11 +528,11 @@ sjis_mbstocs( ...@@ -528,11 +528,11 @@ sjis_mbstocs(
*from_left = tmp_from_left; *from_left = tmp_from_left;
*to = (XPointer) tmp_to; *to = (XPointer) tmp_to;
*to_left = tmp_to_left; *to_left = tmp_to_left;
} }
if (num_args > 0) if (num_args > 0)
*((XlcCharSet *) args[0]) = charset; *((XlcCharSet *) args[0]) = charset;
return unconv_num; return unconv_num;
} }
...@@ -660,7 +660,7 @@ sjis_cstombs( ...@@ -660,7 +660,7 @@ sjis_cstombs(
if (num_args < 1) if (num_args < 1)
return -1; return -1;
if (!(codeset = GetCodeSetFromCharSet(lcd, (XlcCharSet) args[0]))) if (!(codeset = GetCodeSetFromCharSet(lcd, (XlcCharSet) args[0])))
return -1; return -1;
...@@ -668,7 +668,7 @@ sjis_cstombs( ...@@ -668,7 +668,7 @@ sjis_cstombs(
buf_len /= codeset->length; buf_len /= codeset->length;
if (csstr_len < buf_len) if (csstr_len < buf_len)
buf_len = csstr_len; buf_len = csstr_len;
cvt_length += buf_len * codeset->length; cvt_length += buf_len * codeset->length;
if (bufptr) { if (bufptr) {
...@@ -962,7 +962,7 @@ sjis_mbstocts( ...@@ -962,7 +962,7 @@ sjis_mbstocts(
unconv_num++; unconv_num++;
break; break;
} }
if (ctptr) { if (ctptr) {
strcpy(ctptr, ctdptr[cs_num]->ct_encoding); strcpy(ctptr, ctdptr[cs_num]->ct_encoding);
ctptr += ctdptr[cs_num]->ct_encoding_len; ctptr += ctdptr[cs_num]->ct_encoding_len;
...@@ -972,7 +972,7 @@ sjis_mbstocts( ...@@ -972,7 +972,7 @@ sjis_mbstocts(
clen = charset->length; clen = charset->length;
do { do {
*ctptr++ = *inbufptr++; *ctptr++ = *inbufptr++;
} while (--clen); } while (--clen);
if (charset->length >= 2) { if (charset->length >= 2) {
sjis_to_jis((Uchar *)(ctptr-2), (Uchar *)(ctptr-1)); sjis_to_jis((Uchar *)(ctptr-2), (Uchar *)(ctptr-1));
...@@ -1118,7 +1118,7 @@ sjis_wcstocts( ...@@ -1118,7 +1118,7 @@ sjis_wcstocts(
} }
*ctptr++ = (char)tmp; *ctptr++ = (char)tmp;
} }
} while (length); } while (length);
} /* end for */ } /* end for */
...@@ -1297,7 +1297,7 @@ sjis_ctstowcs( ...@@ -1297,7 +1297,7 @@ sjis_ctstowcs(
if (*from_left > *to_left) if (*from_left > *to_left)
*from_left = *to_left; *from_left = *to_left;
for (length = ctdata[Ascii].length; *from_left > 0; (*from_left) -= length ) for (length = ctdata[Ascii].length; *from_left > 0; (*from_left) -= length )
{ {
ct_type = CT_STD; ct_type = CT_STD;
...@@ -1434,7 +1434,7 @@ create_conv( ...@@ -1434,7 +1434,7 @@ create_conv(
conv = (XlcConv) Xmalloc(sizeof(XlcConvRec)); conv = (XlcConv) Xmalloc(sizeof(XlcConvRec));
if (conv == NULL) if (conv == NULL)
return (XlcConv) NULL; return (XlcConv) NULL;
conv->methods = methods; conv->methods = methods;
conv->state = (XPointer) lcd; conv->state = (XPointer) lcd;
return conv; return conv;
......
/* $TOG: $ */
/****************************************************************** /******************************************************************
Copyright 1993 by SunSoft, Inc. Copyright 1993 by SunSoft, Inc.
...@@ -50,13 +49,21 @@ _XlcUtf8Loader( ...@@ -50,13 +49,21 @@ _XlcUtf8Loader(
return lcd; return lcd;
/* The official IANA name for UTF-8 is "UTF-8" in upper case with a dash. */ /* The official IANA name for UTF-8 is "UTF-8" in upper case with a dash. */
if (!XLC_PUBLIC_PART(lcd)->codeset || if (!XLC_PUBLIC_PART(lcd)->codeset) {
(_XlcCompareISOLatin1(XLC_PUBLIC_PART(lcd)->codeset, "UTF-8"))) { _XlcDestroyLC(lcd);
return (XLCd) NULL;
}
else if (!_XlcCompareISOLatin1(XLC_PUBLIC_PART(lcd)->codeset, "UTF-8")) {
_XlcAddUtf8LocaleConverters(lcd);
}
else if (!_XlcCompareISOLatin1(XLC_PUBLIC_PART(lcd)->codeset, "GB18030")) {
_XlcAddGB18030LocaleConverters(lcd);
}
else {
_XlcDestroyLC(lcd); _XlcDestroyLC(lcd);
return (XLCd) NULL; return (XLCd) NULL;
} }
_XlcAddUtf8LocaleConverters(lcd);
_XlcAddUtf8Converters(lcd); _XlcAddUtf8Converters(lcd);
return lcd; return lcd;
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
* so that you can figure out what in the heck we're doing. We * so that you can figure out what in the heck we're doing. We
* realize this is a departure from the norm, but hey, we're * realize this is a departure from the norm, but hey, we're
* rebels! :-) :-) * rebels! :-) :-)
* *
* Modifiers: Jeff Walls, Paul Anderson: HEWLETT-PACKARD * Modifiers: Jeff Walls, Paul Anderson: HEWLETT-PACKARD
*/ */
/* /*
...@@ -221,7 +221,7 @@ get_prop_name( ...@@ -221,7 +221,7 @@ get_prop_name(
unsigned long fp; unsigned long fp;
if (XGetFontProperty(fs, XA_FONT, &fp)) if (XGetFontProperty(fs, XA_FONT, &fp))
return XGetAtomName(dpy, fp); return XGetAtomName(dpy, fp);
return (char *) NULL; return (char *) NULL;
} }
...@@ -259,7 +259,7 @@ load_fontset_data( ...@@ -259,7 +259,7 @@ load_fontset_data(
if(font_set->font_name == (char *)NULL) return False ; if(font_set->font_name == (char *)NULL) return False ;
/* If font_set->font is not NULL, it contains the *best* /* If font_set->font is not NULL, it contains the *best*
* match font for this FontSet. * match font for this FontSet.
* -- jjw/pma (HP) * -- jjw/pma (HP)
*/ */
if(font_set->font == NULL) { if(font_set->font == NULL) {
...@@ -336,7 +336,7 @@ load_font_info( ...@@ -336,7 +336,7 @@ load_font_info(
&font_set->info); &font_set->info);
if (font_set->info == NULL) if (font_set->info == NULL)
return False; return False;
XFreeFontNames(fn_list); XFreeFontNames(fn_list);
} }
} }
...@@ -410,11 +410,10 @@ set_fontset_extents( ...@@ -410,11 +410,10 @@ set_fontset_extents(
} }
} }
if(font_set->vrotate_num > 0) { if(font_set->vrotate_num > 0 && font_set->vrotate != NULL) {
font_data = (FontData) font_set->vrotate; font_data = (FontData) font_set->vrotate;
font_data_count = font_set->vrotate_num; font_data_count = font_set->vrotate_num;
for( ; font_data_count-- ; font_data++) { for( ; font_data_count-- ; font_data++) {
if(font_data != NULL)
if(font_data->font != NULL) { if(font_data->font != NULL) {
check_fontset_extents(&overall, &logical_ascent, check_fontset_extents(&overall, &logical_ascent,
&logical_descent, &logical_descent,
...@@ -527,7 +526,7 @@ get_font_name( ...@@ -527,7 +526,7 @@ get_font_name(
name = (char *) Xmalloc(strlen(*list) + 1); name = (char *) Xmalloc(strlen(*list) + 1);
if (name) if (name)
strcpy(name, *list); strcpy(name, *list);
XFreeFontNames(list); XFreeFontNames(list);
return name; return name;
...@@ -566,9 +565,12 @@ get_rotate_fontname( ...@@ -566,9 +565,12 @@ get_rotate_fontname(
for(field_num = 0 ; field_num < CHARSET_ENCODING_FIELD && ptr && *ptr ; for(field_num = 0 ; field_num < CHARSET_ENCODING_FIELD && ptr && *ptr ;
ptr++, field_num++) { ptr++, field_num++) {
fields[field_num] = ptr; fields[field_num] = ptr;
if((ptr = strchr(ptr, '-'))) { if((ptr = strchr(ptr, '-'))) {
*ptr = '\0'; *ptr = '\0';
} else {
field_num++; /* Count last field */
break;
} }
} }
...@@ -602,7 +604,7 @@ get_rotate_fontname( ...@@ -602,7 +604,7 @@ get_rotate_fontname(
} }
/* Max XLFD length is 255 */ /* Max XLFD length is 255 */
if (len > XLFD_MAX_LEN) if (len > XLFD_MAX_LEN)
return NULL; return NULL;
rotate_font_ptr = (char *)Xmalloc(len + 1); rotate_font_ptr = (char *)Xmalloc(len + 1);
...@@ -613,7 +615,8 @@ get_rotate_fontname( ...@@ -613,7 +615,8 @@ get_rotate_fontname(
for(field_num = 0 ; field_num < CHARSET_ENCODING_FIELD && for(field_num = 0 ; field_num < CHARSET_ENCODING_FIELD &&
fields[field_num] ; field_num++) { fields[field_num] ; field_num++) {
sprintf(rotate_font_ptr, "%s-%s", rotate_font_ptr, fields[field_num]); strcat(rotate_font_ptr, "-");
strcat(rotate_font_ptr, fields[field_num]);
} }
if(pattern) if(pattern)
...@@ -636,7 +639,7 @@ is_match_charset( ...@@ -636,7 +639,7 @@ is_match_charset(
length = strlen(font_data->name); length = strlen(font_data->name);
if (length > name_len) if (length > name_len)
return False; return False;
if (_XlcCompareISOLatin1(last - length, font_data->name) == 0) if (_XlcCompareISOLatin1(last - length, font_data->name) == 0)
return True; return True;
...@@ -666,7 +669,7 @@ get_font_name_from_list( ...@@ -666,7 +669,7 @@ get_font_name_from_list(
break; break;
} }
} }
XFreeFontNames(list); XFreeFontNames(list);
return name; return name;
...@@ -756,7 +759,7 @@ parse_omit_name( ...@@ -756,7 +759,7 @@ parse_omit_name(
if (length > XLFD_MAX_LEN) if (length > XLFD_MAX_LEN)
return -1; return -1;
strcpy(buf, pattern); strcpy(buf, pattern);
last = buf + length - 1; last = buf + length - 1;
...@@ -769,12 +772,12 @@ parse_omit_name( ...@@ -769,12 +772,12 @@ parse_omit_name(
switch (num_fields) { switch (num_fields) {
case 12: case 12:
/* This is the best way to have specifed the fontset. In this /* This is the best way to have specifed the fontset. In this
* case, there is no original encoding. E.g., * case, there is no original encoding. E.g.,
* -*-*-*-*-*-*-14-*-*-*-*-* * -*-*-*-*-*-*-14-*-*-*-*-*
* To this, we'll append a dash: * To this, we'll append a dash:
* -*-*-*-*-*-*-14-*-*-*-*-*- * -*-*-*-*-*-*-14-*-*-*-*-*-
* then append the encoding to get: * then append the encoding to get:
* -*-*-*-*-*-*-14-*-*-*-*-*-JISX0208.1990-0 * -*-*-*-*-*-*-14-*-*-*-*-*-JISX0208.1990-0
*/ */
/* /*
* Take care of: * Take care of:
...@@ -787,7 +790,7 @@ parse_omit_name( ...@@ -787,7 +790,7 @@ parse_omit_name(
break; break;
case 13: case 13:
/* Got the charset, not the encoding, zap the charset In this /* Got the charset, not the encoding, zap the charset In this
* case, there is no original encoding, but there is a charset. E.g., * case, there is no original encoding, but there is a charset. E.g.,
* -*-*-*-*-*-*-14-*-*-*-*-*-jisx0212.1990 * -*-*-*-*-*-*-14-*-*-*-*-*-jisx0212.1990
* To this, we remove the charset: * To this, we remove the charset:
* -*-*-*-*-*-*-14-*-*-*-*-*- * -*-*-*-*-*-*-14-*-*-*-*-*-
...@@ -800,11 +803,11 @@ parse_omit_name( ...@@ -800,11 +803,11 @@ parse_omit_name(
case 14: case 14:
/* Both the charset and the encoding are specified. Get rid /* Both the charset and the encoding are specified. Get rid
* of them so that we can append the new charset encoding. E.g., * of them so that we can append the new charset encoding. E.g.,
* -*-*-*-*-*-*-14-*-*-*-*-*-jisx0212.1990-0 * -*-*-*-*-*-*-14-*-*-*-*-*-jisx0212.1990-0
* To this, we'll remove the encoding and charset to get: * To this, we'll remove the encoding and charset to get:
* -*-*-*-*-*-*-14-*-*-*-*-*- * -*-*-*-*-*-*-14-*-*-*-*-*-
* then append the new encoding to get: * then append the new encoding to get:
* -*-*-*-*-*-*-14-*-*-*-*-*-JISX0208.1990-0 * -*-*-*-*-*-*-14-*-*-*-*-*-JISX0208.1990-0
*/ */
last = strrchr (buf, '-'); last = strrchr (buf, '-');
*last = '\0'; *last = '\0';
...@@ -817,17 +820,17 @@ parse_omit_name( ...@@ -817,17 +820,17 @@ parse_omit_name(
break; break;
} }
/* At this point, "last" is pointing to the last "-" in the /* At this point, "last" is pointing to the last "-" in the
* xlfd, and all xlfd's at this point take a form similar to: * xlfd, and all xlfd's at this point take a form similar to:
* -*-*-*-*-*-*-14-*-*-*-*-*- * -*-*-*-*-*-*-14-*-*-*-*-*-
* (i.e., no encoding). * (i.e., no encoding).
* After the strcpy, we'll end up with something similar to: * After the strcpy, we'll end up with something similar to:
* -*-*-*-*-*-*-14-*-*-*-*-*-JISX0208.1990-0 * -*-*-*-*-*-*-14-*-*-*-*-*-JISX0208.1990-0
* *
* If the modified font is found in the current FontSet, * If the modified font is found in the current FontSet,
* we've found a match. * we've found a match.
*/ */
last++; last++;
if ((last - buf) + strlen(font_data->name) > XLFD_MAX_LEN) if ((last - buf) + strlen(font_data->name) > XLFD_MAX_LEN)
...@@ -844,12 +847,12 @@ parse_omit_name( ...@@ -844,12 +847,12 @@ parse_omit_name(
*last = '*'; *last = '*';
*(last + 1) = '-'; *(last + 1) = '-';
strcpy(last + 2, font_data->name); strcpy(last + 2, font_data->name);
num_fields++; num_fields++;
last+=2; last+=2;
if ((font_data->xlfd_name = get_font_name(oc, buf)) != NULL) if ((font_data->xlfd_name = get_font_name(oc, buf)) != NULL)
return True; return True;
} }
return False; return False;
} }
...@@ -882,7 +885,7 @@ parse_fontdata( ...@@ -882,7 +885,7 @@ parse_fontdata(
if(font_data == NULL || font_data_count <= 0) { if(font_data == NULL || font_data_count <= 0) {
return False; return False;
} }
/* Loop through each font encoding defined in the "font_data" FontSet. */ /* Loop through each font encoding defined in the "font_data" FontSet. */
for ( ; font_data_count-- > 0; font_data++) { for ( ; font_data_count-- > 0; font_data++) {
Bool is_found = False; Bool is_found = False;
...@@ -902,7 +905,7 @@ parse_fontdata( ...@@ -902,7 +905,7 @@ parse_fontdata(
fprintf(stderr,"Font pattern: %s %s\n", fprintf(stderr,"Font pattern: %s %s\n",
pattern,font_data->name); pattern,font_data->name);
#endif #endif
/* /*
* If the current font is fully specified (i.e., the * If the current font is fully specified (i.e., the
* xlfd contains no wildcards) and the font exists on * xlfd contains no wildcards) and the font exists on
...@@ -923,16 +926,16 @@ parse_fontdata( ...@@ -923,16 +926,16 @@ parse_fontdata(
if (ret == False) continue; if (ret == False) continue;
/* /*
* Since there was an exact match of a fully-specified font * Since there was an exact match of a fully-specified font
* or a font alias, we can return now since the desired font * or a font alias, we can return now since the desired font
* was found for the current font encoding for this FontSet. * was found for the current font encoding for this FontSet.
* *
* Previous implementations of this algorithm would * Previous implementations of this algorithm would
* not return here. Instead, they continued searching * not return here. Instead, they continued searching
* through the font encodings for this FontSet. The side-effect * through the font encodings for this FontSet. The side-effect
* of that behavior is you may return a "substitute" match * of that behavior is you may return a "substitute" match
* instead of an "exact" match. We believe there should be a * instead of an "exact" match. We believe there should be a
* preference on exact matches. Therefore, as soon as we * preference on exact matches. Therefore, as soon as we
* find one, we bail. * find one, we bail.
* *
* Also, previous implementations seemed to think it was * Also, previous implementations seemed to think it was
* important to find either a primary or substitute font * important to find either a primary or substitute font
...@@ -940,7 +943,7 @@ parse_fontdata( ...@@ -940,7 +943,7 @@ parse_fontdata(
* acceptable font. We don't believe this is necessary. * acceptable font. We don't believe this is necessary.
* All the client cares about is finding a reasonable font * All the client cares about is finding a reasonable font
* for what was passed in. If we find an exact match, * for what was passed in. If we find an exact match,
* there's no reason to look any further. * there's no reason to look any further.
* *
* -- jjw/pma (HP) * -- jjw/pma (HP)
*/ */
...@@ -971,7 +974,7 @@ parse_fontdata( ...@@ -971,7 +974,7 @@ parse_fontdata(
if (ret == False) continue; if (ret == False) continue;
/* /*
* A font which matched the wild-carded specification was found. * A font which matched the wild-carded specification was found.
* Only update the return data if a font has not yet been found. * Only update the return data if a font has not yet been found.
* This maintains the convention that FontSets listed higher in * This maintains the convention that FontSets listed higher in
* a CodeSet in the Locale Database have higher priority than * a CodeSet in the Locale Database have higher priority than
...@@ -988,7 +991,7 @@ parse_fontdata( ...@@ -988,7 +991,7 @@ parse_fontdata(
* *
* a font found in the JISX0208.1990-0 FontSet will have a * a font found in the JISX0208.1990-0 FontSet will have a
* higher priority than a font found in the JISX0208.1983-0 * higher priority than a font found in the JISX0208.1983-0
* FontSet. * FontSet.
*/ */
if (font_data_return && font_data_return->xlfd_name == NULL) { if (font_data_return && font_data_return->xlfd_name == NULL) {
...@@ -1015,7 +1018,7 @@ parse_fontdata( ...@@ -1015,7 +1018,7 @@ parse_fontdata(
/* /*
* Did not find a font for the current FontSet. Check the * Did not find a font for the current FontSet. Check the
* FontSet's "substitute" font for a match. If we find a * FontSet's "substitute" font for a match. If we find a
* match, we'll keep searching in hopes of finding an exact * match, we'll keep searching in hopes of finding an exact
* match later down the FontSet list. * match later down the FontSet list.
* *
* when we return and we have found a font font_data_return * when we return and we have found a font font_data_return
...@@ -1023,8 +1026,8 @@ parse_fontdata( ...@@ -1023,8 +1026,8 @@ parse_fontdata(
* is a C_PRIMARY or a C_SUBSTITUTE font * is a C_PRIMARY or a C_SUBSTITUTE font
*/ */
ret = parse_fontdata(oc, font_set, font_set->substitute, ret = parse_fontdata(oc, font_set, font_set->substitute,
font_set->substitute_num, name_list, font_set->substitute_num, name_list,
name_list_count, C_SUBSTITUTE, name_list_count, C_SUBSTITUTE,
font_data_return); font_data_return);
if (ret == -1) return -1; if (ret == -1) return -1;
if (ret == False) continue; if (ret == False) continue;
...@@ -1113,7 +1116,7 @@ parse_vw( ...@@ -1113,7 +1116,7 @@ parse_vw(
if(font_set->vrotate == (VRotate)NULL) if(font_set->vrotate == (VRotate)NULL)
return (-1); return (-1);
memset(font_set->vrotate, 0x00, sizeof(VRotateRec) * sub_num); memset(font_set->vrotate, 0x00, sizeof(VRotateRec) * sub_num);
for(i = 0 ; i < sub_num ; i++) { for(i = 0 ; i < sub_num ; i++) {
vrotate[i].charset_name = font_set->substitute[i].name; vrotate[i].charset_name = font_set->substitute[i].name;
vrotate[i].side = font_set->substitute[i].side; vrotate[i].side = font_set->substitute[i].side;
...@@ -1166,12 +1169,12 @@ parse_fontname( ...@@ -1166,12 +1169,12 @@ parse_fontname(
if(font_set->font_data_count > 0) { if(font_set->font_data_count > 0) {
/* /*
* If there are a non-zero number of FontSets defined * If there are a non-zero number of FontSets defined
* for this CharSet. * for this CharSet.
* Try to find a font for this CharSet. If we find an * Try to find a font for this CharSet. If we find an
* acceptable font, we save the information for return * acceptable font, we save the information for return
* to the client. If we do not find an acceptable font, * to the client. If we do not find an acceptable font,
* a "missing_charset" will be reported to the client * a "missing_charset" will be reported to the client
* for this CharSet. * for this CharSet.
*/ */
font_data_return. xlfd_name = NULL; font_data_return. xlfd_name = NULL;
...@@ -1208,7 +1211,7 @@ parse_fontname( ...@@ -1208,7 +1211,7 @@ parse_fontname(
} else if(font_set->substitute_num > 0) { } else if(font_set->substitute_num > 0) {
/* /*
* If there are no FontSets defined for this * If there are no FontSets defined for this
* CharSet. We can only find "substitute" fonts. * CharSet. We can only find "substitute" fonts.
*/ */
ret = parse_fontdata(oc, font_set, font_set->substitute, ret = parse_fontdata(oc, font_set, font_set->substitute,
...@@ -1275,14 +1278,14 @@ set_missing_list( ...@@ -1275,14 +1278,14 @@ set_missing_list(
if (font_set->info || font_set->font) { if (font_set->info || font_set->font) {
continue; continue;
} }
/* Change 1996.01.23 start */ /* Change 1996.01.23 start */
if(font_set->font_data_count <= 0 || if(font_set->font_data_count <= 0 ||
font_set->font_data == (FontData)NULL) { font_set->font_data == (FontData)NULL) {
if(font_set->substitute_num <= 0 || if(font_set->substitute_num <= 0 ||
font_set->substitute == (FontData)NULL) { font_set->substitute == (FontData)NULL) {
if(font_set->charset_list != NULL){ if(font_set->charset_list != NULL){
length += length +=
strlen(font_set->charset_list[0]->encoding_name) + 1; strlen(font_set->charset_list[0]->encoding_name) + 1;
} else { } else {
length += 1; length += 1;
...@@ -1344,7 +1347,7 @@ set_missing_list( ...@@ -1344,7 +1347,7 @@ set_missing_list(
/* Change 1996.01.23 end */ /* Change 1996.01.23 end */
*charset_list++ = charset_buf; *charset_list++ = charset_buf;
charset_buf += strlen(charset_buf) + 1; charset_buf += strlen(charset_buf) + 1;
} }
if(result == 0) { if(result == 0) {
return(False); return(False);
...@@ -1406,7 +1409,7 @@ free_fontdataOC( ...@@ -1406,7 +1409,7 @@ free_fontdataOC(
XFreeFontInfo(NULL, font_data->font, 1);/* Add 1996.01.23 */ XFreeFontInfo(NULL, font_data->font, 1);/* Add 1996.01.23 */
font_data->font = NULL; font_data->font = NULL;
} }
/* /*
* font_data->name and font_data->scopes belong to the OM not OC. * font_data->name and font_data->scopes belong to the OM not OC.
* To save space this data is shared between OM and OC. We are * To save space this data is shared between OM and OC. We are
* not allowed to free it here. * not allowed to free it here.
...@@ -1494,7 +1497,7 @@ destroy_oc( ...@@ -1494,7 +1497,7 @@ destroy_oc(
_XlcCloseConverter(gen->utf8_to_cs); _XlcCloseConverter(gen->utf8_to_cs);
/* For VW/UDC start */ /* Change 1996.01.8 */ /* For VW/UDC start */ /* Change 1996.01.8 */
destroy_fontdata(gen,dpy); destroy_fontdata(gen,dpy);
/* /*
*/ */
/* For VW/UDC end */ /* For VW/UDC end */
...@@ -1518,7 +1521,7 @@ destroy_oc( ...@@ -1518,7 +1521,7 @@ destroy_oc(
if (oc->core.res_class) if (oc->core.res_class)
Xfree(oc->core.res_class); Xfree(oc->core.res_class);
#endif #endif
Xfree(oc); Xfree(oc);
} }
...@@ -1614,7 +1617,7 @@ static XOCMethodsRec oc_generic_methods = { ...@@ -1614,7 +1617,7 @@ static XOCMethodsRec oc_generic_methods = {
}; };
typedef struct _XOCMethodsListRec { typedef struct _XOCMethodsListRec {
char *name; const char *name;
XOCMethods methods; XOCMethods methods;
} XOCMethodsListRec, *XOCMethodsList; } XOCMethodsListRec, *XOCMethodsList;
...@@ -1657,12 +1660,12 @@ create_oc( ...@@ -1657,12 +1660,12 @@ create_oc(
if (oc == NULL) if (oc == NULL)
return (XOC) NULL; return (XOC) NULL;
bzero((char *) oc, sizeof(XOCGenericRec)); bzero((char *) oc, sizeof(XOCGenericRec));
oc->core.om = om; oc->core.om = om;
if (oc_resources[0].xrm_name == NULLQUARK) if (oc_resources[0].xrm_name == NULLQUARK)
_XlcCompileResourceList(oc_resources, XlcNumber(oc_resources)); _XlcCompileResourceList(oc_resources, XlcNumber(oc_resources));
if (_XlcSetValues((XPointer) oc, oc_resources, XlcNumber(oc_resources), if (_XlcSetValues((XPointer) oc, oc_resources, XlcNumber(oc_resources),
args, num_args, XlcCreateMask | XlcDefaultMask)) args, num_args, XlcCreateMask | XlcDefaultMask))
goto err; goto err;
...@@ -1845,7 +1848,7 @@ create_om( ...@@ -1845,7 +1848,7 @@ create_om(
if (om == NULL) if (om == NULL)
return (XOM) NULL; return (XOM) NULL;
bzero((char *) om, sizeof(XOMGenericRec)); bzero((char *) om, sizeof(XOMGenericRec));
om->methods = &methods; om->methods = &methods;
om->core.lcd = lcd; om->core.lcd = lcd;
om->core.display = dpy; om->core.display = dpy;
...@@ -1865,7 +1868,7 @@ create_om( ...@@ -1865,7 +1868,7 @@ create_om(
if (om_resources[0].xrm_name == NULLQUARK) if (om_resources[0].xrm_name == NULLQUARK)
_XlcCompileResourceList(om_resources, XlcNumber(om_resources)); _XlcCompileResourceList(om_resources, XlcNumber(om_resources));
om->core.resources = om_resources; om->core.resources = om_resources;
om->core.num_resources = XlcNumber(om_resources); om->core.num_resources = XlcNumber(om_resources);
...@@ -2035,7 +2038,7 @@ init_om( ...@@ -2035,7 +2038,7 @@ init_om(
data = add_data(om); data = add_data(om);
if (data == NULL) if (data == NULL)
return False; return False;
charset_list = (XlcCharSet *) Xmalloc(sizeof(XlcCharSet) * count); charset_list = (XlcCharSet *) Xmalloc(sizeof(XlcCharSet) * count);
if (charset_list == NULL) if (charset_list == NULL)
return False; return False;
...@@ -2163,7 +2166,7 @@ _XomGenericOpenOM(XLCd lcd, Display *dpy, XrmDatabase rdb, ...@@ -2163,7 +2166,7 @@ _XomGenericOpenOM(XLCd lcd, Display *dpy, XrmDatabase rdb,
om = create_om(lcd, dpy, rdb, res_name, res_class); om = create_om(lcd, dpy, rdb, res_name, res_class);
if (om == NULL) if (om == NULL)
return (XOM) NULL; return (XOM) NULL;
if (init_om(om) == False) if (init_om(om) == False)
goto err; goto err;
......
...@@ -108,7 +108,7 @@ draw_vertical( ...@@ -108,7 +108,7 @@ draw_vertical(
int direction = 0; int direction = 0;
int font_ascent_return = 0, font_descent_return = 0; int font_ascent_return = 0, font_descent_return = 0;
int i; int i;
XCharStruct overall; XCharStruct overall;
wy = y; wy = y;
if (is_xchar2b) { if (is_xchar2b) {
...@@ -190,7 +190,7 @@ DrawStringWithFontSet( ...@@ -190,7 +190,7 @@ DrawStringWithFontSet(
* If it was, use that font. If it was not set, then use the * If it was, use that font. If it was not set, then use the
* font defined by font_set->font_data[0] (which is what * font defined by font_set->font_data[0] (which is what
* _XomGetFontDataFromFontSet() always seems to return for * _XomGetFontDataFromFontSet() always seems to return for
* non-VW text). Note that given the new algorithm in * non-VW text). Note that given the new algorithm in
* parse_fontname() and parse_fontdata(), fs->font will * parse_fontname() and parse_fontdata(), fs->font will
* *always* contain good data. We should probably remove * *always* contain good data. We should probably remove
* the check for "fd->font", but we won't :-) -- jjw/pma (HP) * the check for "fd->font", but we won't :-) -- jjw/pma (HP)
...@@ -305,7 +305,7 @@ _XomGenericDrawString( ...@@ -305,7 +305,7 @@ _XomGenericDrawString(
conv = _XomInitConverter(oc, type); conv = _XomInitConverter(oc, type);
if (conv == NULL) if (conv == NULL)
return -1; return -1;
args[0] = (XPointer) &font; args[0] = (XPointer) &font;
args[1] = (XPointer) &is_xchar2b; args[1] = (XPointer) &is_xchar2b;
args[2] = (XPointer) &fs; args[2] = (XPointer) &fs;
......
...@@ -257,7 +257,7 @@ _XomGenericTextEscapement( ...@@ -257,7 +257,7 @@ _XomGenericTextEscapement(
conv = _XomInitConverter(oc, type); conv = _XomInitConverter(oc, type);
if (conv == NULL) if (conv == NULL)
return escapement; return escapement;
args[0] = (XPointer) &font; args[0] = (XPointer) &font;
args[1] = (XPointer) &is_xchar2b; args[1] = (XPointer) &is_xchar2b;
args[2] = (XPointer) &font_set; args[2] = (XPointer) &font_set;
......
...@@ -57,7 +57,7 @@ _XomGenericTextPerCharExtents( ...@@ -57,7 +57,7 @@ _XomGenericTextPerCharExtents(
conv = _XomInitConverter(oc, type); conv = _XomInitConverter(oc, type);
if (conv == NULL) if (conv == NULL)
return 0; return 0;
bzero((char *) &overall, sizeof(XCharStruct)); bzero((char *) &overall, sizeof(XCharStruct));
logical_ascent = logical_descent = require_num = *num_chars = 0; logical_ascent = logical_descent = require_num = *num_chars = 0;
......
...@@ -118,7 +118,7 @@ _XomGetFontDataFromFontSet( ...@@ -118,7 +118,7 @@ _XomGetFontDataFromFontSet(
unsigned char *str, unsigned char *str,
int len, int len,
int *len_ret, int *len_ret,
int is2b, int is2b,
int type) /* VMAP , VROTATE , else */ int type) /* VMAP , VROTATE , else */
{ {
unsigned long value; unsigned long value;
...@@ -126,7 +126,7 @@ _XomGetFontDataFromFontSet( ...@@ -126,7 +126,7 @@ _XomGetFontDataFromFontSet(
FontData fontdata; FontData fontdata;
unsigned char *c; unsigned char *c;
int vfont_type; int vfont_type;
c = str; c = str;
hit = -1; hit = -1;
if(type == VMAP){ if(type == VMAP){
...@@ -162,7 +162,7 @@ _XomGetFontDataFromFontSet( ...@@ -162,7 +162,7 @@ _XomGetFontDataFromFontSet(
} else { } else {
value = (unsigned long)*c; value = (unsigned long)*c;
} }
/* ### NOTE: This routine DOES NOT WORK! /* ### NOTE: This routine DOES NOT WORK!
* ### We can work around the problem in the calling routine, * ### We can work around the problem in the calling routine,
* ### but we really need to understand this better. As it * ### but we really need to understand this better. As it
...@@ -289,7 +289,7 @@ load_font( ...@@ -289,7 +289,7 @@ load_font(
oc->core.font_info.font_name_list[font_set->id]); oc->core.font_info.font_name_list[font_set->id]);
if (font_set->font == NULL) if (font_set->font == NULL)
return False; return False;
oc->core.font_info.font_struct_list[font_set->id] = font_set->font; oc->core.font_info.font_struct_list[font_set->id] = font_set->font;
XFreeFontInfo(NULL, font_set->info, 1); XFreeFontInfo(NULL, font_set->info, 1);
font_set->info = NULL; font_set->info = NULL;
...@@ -365,7 +365,7 @@ _XomInitConverter( ...@@ -365,7 +365,7 @@ _XomInitConverter(
{ {
XOCGenericPart *gen = XOC_GENERIC(oc); XOCGenericPart *gen = XOC_GENERIC(oc);
XlcConv *convp; XlcConv *convp;
char *conv_type; const char *conv_type;
XlcConv conv; XlcConv conv;
XLCd lcd; XLCd lcd;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment