summaryrefslogtreecommitdiffstats
path: root/x11/IMdkit
diff options
context:
space:
mode:
authorHuang Peng <shawn.p.huang@gmail.com>2008-08-16 12:51:47 +0800
committerHuang Peng <shawn.p.huang@gmail.com>2008-08-16 12:51:47 +0800
commit931f116d5fee25f22a48cf50b13323f3bd89180b (patch)
tree3bea5f8278717fd9552b008ffa21b01ef698da2f /x11/IMdkit
parent6a820938ed75a8c87ba223e248cba0d552bcb8b1 (diff)
downloadibus-931f116d5fee25f22a48cf50b13323f3bd89180b.tar.gz
ibus-931f116d5fee25f22a48cf50b13323f3bd89180b.tar.xz
ibus-931f116d5fee25f22a48cf50b13323f3bd89180b.zip
WIP.
Diffstat (limited to 'x11/IMdkit')
-rw-r--r--x11/IMdkit/FrameMgr.c2466
-rw-r--r--x11/IMdkit/FrameMgr.h131
-rw-r--r--x11/IMdkit/IMConn.c176
-rw-r--r--x11/IMdkit/IMMethod.c65
-rw-r--r--x11/IMdkit/IMValues.c124
-rw-r--r--x11/IMdkit/IMdkit.h144
-rw-r--r--x11/IMdkit/Makefile.am27
-rw-r--r--x11/IMdkit/Xi18n.h505
-rw-r--r--x11/IMdkit/Xi18nX.h52
-rw-r--r--x11/IMdkit/XimFunc.h72
-rw-r--r--x11/IMdkit/XimProto.h230
-rw-r--r--x11/IMdkit/Xtrans.h470
-rw-r--r--x11/IMdkit/i18nAttr.c175
-rw-r--r--x11/IMdkit/i18nClbk.c513
-rw-r--r--x11/IMdkit/i18nIMProto.c773
-rw-r--r--x11/IMdkit/i18nIc.c1106
-rw-r--r--x11/IMdkit/i18nMethod.c1150
-rw-r--r--x11/IMdkit/i18nPtHdr.c1848
-rw-r--r--x11/IMdkit/i18nUtil.c276
-rw-r--r--x11/IMdkit/i18nX.c497
20 files changed, 0 insertions, 10800 deletions
diff --git a/x11/IMdkit/FrameMgr.c b/x11/IMdkit/FrameMgr.c
deleted file mode 100644
index 9b49794..0000000
--- a/x11/IMdkit/FrameMgr.c
+++ /dev/null
@@ -1,2466 +0,0 @@
-/******************************************************************
-Copyright 1993, 1994 by Digital Equipment Corporation, Maynard, Massachusetts,
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the names of Digital or MIT not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
- Author: Hiroyuki Miyamoto Digital Equipment Corporation
- miyamoto@jrd.dec.com
-
- This version tidied and debugged by Steve Underwood May 1999
-
-******************************************************************/
-
-#include <X11/Xlibint.h>
-#include <stdlib.h>
-#include "FrameMgr.h"
-
-/* Convenient macro */
-
-#define _UNIT(n) ((int)(n) & 0xFF)
-#define _NUMBER(n) (((int)(n) >> 8) & 0xFF)
-
-/* For byte swapping */
-
-#define Swap16(p, n) ((p)->byte_swap ? \
-(((n) << 8 & 0xFF00) | \
- ((n) >> 8 & 0xFF) \
-) : n)
-#define Swap32(p, n) ((p)->byte_swap ? \
- (((n) << 24 & 0xFF000000) | \
- ((n) << 8 & 0xFF0000) | \
- ((n) >> 8 & 0xFF00) | \
- ((n) >> 24 & 0xFF) \
- ) : n)
-#define Swap64(p, n) ((p)->byte_swap ? \
- (((n) << 56 & 0xFF00000000000000) | \
- ((n) << 40 & 0xFF000000000000) | \
- ((n) << 24 & 0xFF0000000000) | \
- ((n) << 8 & 0xFF00000000) | \
- ((n) >> 8 & 0xFF000000) | \
- ((n) >> 24 & 0xFF0000) | \
- ((n) >> 40 & 0xFF00) | \
- ((n) >> 56 & 0xFF) \
- ) : n)
-
-/* Type definition */
-
-typedef struct _Iter *Iter;
-
-typedef struct _FrameInst *FrameInst;
-
-typedef union
-{
- int num; /* For BARRAY */
- FrameInst fi; /* For POINTER */
- Iter iter; /* For ITER */
-} ExtraDataRec, *ExtraData;
-
-typedef struct _Chain
-{
- ExtraDataRec d;
- int frame_no;
- struct _Chain *next;
-} ChainRec, *Chain;
-
-typedef struct _ChainMgr
-{
- Chain top;
- Chain tail;
-} ChainMgrRec, *ChainMgr;
-
-typedef struct _ChainIter
-{
- Chain cur;
-} ChainIterRec, *ChainIter;
-
-typedef struct _FrameIter
-{
- Iter iter;
- Bool counting;
- unsigned int counter;
- int end;
- struct _FrameIter* next;
-} FrameIterRec, *FrameIter;
-
-typedef struct _FrameInst
-{
- XimFrame template;
- ChainMgrRec cm;
- int cur_no;
-} FrameInstRec;
-
-typedef void (*IterStartWatchProc) (Iter it, void *client_data);
-
-typedef struct _Iter
-{
- XimFrame template;
- int max_count;
- Bool allow_expansion;
- ChainMgrRec cm;
- int cur_no;
- IterStartWatchProc start_watch_proc;
- void *client_data;
- Bool start_counter;
-} IterRec;
-
-typedef struct _FrameMgr
-{
- XimFrame frame;
- FrameInst fi;
- char *area;
- int idx;
- Bool byte_swap;
- int total_size;
- FrameIter iters;
-} FrameMgrRec;
-
-typedef union
-{
- int num; /* For BARRAY and PAD */
- struct
- { /* For COUNTER_* */
- Iter iter;
- Bool is_byte_len;
- } counter;
-} XimFrameTypeInfoRec, *XimFrameTypeInfo;
-
-/* Special values */
-#define NO_VALUE -1
-#define NO_VALID_FIELD -2
-
-static FrameInst FrameInstInit(XimFrame frame);
-static void FrameInstFree(FrameInst fi);
-static XimFrameType FrameInstGetNextType(FrameInst fi, XimFrameTypeInfo info);
-static XimFrameType FrameInstPeekNextType(FrameInst fi, XimFrameTypeInfo info);
-static FmStatus FrameInstSetSize(FrameInst fi, int num);
-static FmStatus FrameInstSetIterCount(FrameInst fi, int num);
-static int FrameInstGetTotalSize(FrameInst fi);
-static void FrameInstReset(FrameInst fi);
-
-static Iter IterInit(XimFrame frame, int count);
-static void IterFree(Iter it);
-static int FrameInstGetSize(FrameInst fi);
-static int IterGetSize(Iter it);
-static XimFrameType IterGetNextType(Iter it, XimFrameTypeInfo info);
-static XimFrameType IterPeekNextType(Iter it, XimFrameTypeInfo info);
-static FmStatus IterSetSize(Iter it, int num);
-static FmStatus IterSetIterCount(Iter it, int num);
-static int IterGetTotalSize(Iter it);
-static void IterReset(Iter it);
-static Bool IterIsLoopEnd(Iter it, Bool* myself);
-static void IterSetStartWatch(Iter it, IterStartWatchProc proc, void* client_data);
-static void _IterStartWatch(Iter it, void* client_data);
-
-static ExtraData ChainMgrGetExtraData(ChainMgr cm, int frame_no);
-static ExtraData ChainMgrSetData(ChainMgr cm, int frame_no,
- ExtraDataRec data);
-static Bool ChainIterGetNext(ChainIter ci, int* frame_no, ExtraData d);
-static int _FrameInstIncrement(XimFrame frame, int count);
-static int _FrameInstDecrement(XimFrame frame, int count);
-static int _FrameInstGetItemSize(FrameInst fi, int cur_no);
-static Bool FrameInstIsIterLoopEnd(FrameInst fi);
-
-static FrameIter _FrameMgrAppendIter(FrameMgr fm, Iter it, int end);
-static FrameIter _FrameIterCounterIncr(FrameIter fitr, int i);
-static void _FrameMgrRemoveIter(FrameMgr fm, FrameIter it);
-static Bool _FrameMgrIsIterLoopEnd(FrameMgr fm);
-static Bool _FrameMgrProcessPadding(FrameMgr fm, FmStatus* status);
-
-#define IterGetIterCount(it) ((it)->allow_expansion ? \
-NO_VALUE : (it)->max_count)
-
-#define IterFixIteration(it) ((it)->allow_expansion = False)
-
-#define IterSetStarter(it) ((it)->start_counter = True)
-
-#define ChainMgrInit(cm) (cm)->top = (cm)->tail = NULL
-#define ChainMgrFree(cm) \
-{ \
- Chain tmp; \
- Chain cur = (cm)->top; \
- \
- while (cur) \
- { \
- tmp = cur->next; \
- Xfree (cur); \
- cur = tmp; \
- } \
-}
-
-#define ChainIterInit(ci, cm) \
-{ \
- (ci)->cur = (cm)->top; \
-}
-
-/* ChainIterFree has nothing to do. */
-#define ChainIterFree(ci)
-
-#define FrameInstIsEnd(fi) ((fi)->template[(fi)->cur_no].type == EOL)
-
-FrameMgr FrameMgrInit (XimFrame frame, char* area, Bool byte_swap)
-{
- FrameMgr fm;
-
- fm = (FrameMgr) Xmalloc (sizeof (FrameMgrRec));
-
- fm->frame = frame;
- fm->fi = FrameInstInit (frame);
- fm->area = (char *) area;
- fm->idx = 0;
- fm->byte_swap = byte_swap;
- fm->total_size = NO_VALUE;
- fm->iters = NULL;
-
- return fm;
-}
-
-void FrameMgrInitWithData (FrameMgr fm,
- XimFrame frame,
- void * area,
- Bool byte_swap)
-{
- fm->frame = frame;
- fm->fi = FrameInstInit (frame);
- fm->area = (char *) area;
- fm->idx = 0;
- fm->byte_swap = byte_swap;
- fm->total_size = NO_VALUE;
-}
-
-void FrameMgrFree (FrameMgr fm)
-{
- FrameIter p, cur;
-
- p = fm->iters;
- cur = p;
-
- while (p)
- {
- p = p->next;
- Xfree (cur);
- cur = p;
- }
- /*endwhile*/
-
- FrameInstFree (fm->fi);
- Xfree (fm);
-}
-
-FmStatus FrameMgrSetBuffer (FrameMgr fm, void* area)
-{
- if (fm->area)
- return FmBufExist;
- fm->area = (char *) area;
- return FmSuccess;
-}
-
-FmStatus _FrameMgrPutToken (FrameMgr fm, void *data, int data_size)
-{
- XimFrameType type;
- XimFrameTypeInfoRec info;
-
- if (fm->total_size != NO_VALUE && fm->idx >= fm->total_size)
- return FmNoMoreData;
- /*endif*/
-
- type = FrameInstGetNextType(fm->fi, &info);
-
- if (type & COUNTER_MASK)
- {
- unsigned long input_length;
-
- if (info.counter.is_byte_len)
- {
- if ((input_length = IterGetTotalSize (info.counter.iter))
- == NO_VALUE)
- {
- return FmCannotCalc;
- }
- /*endif*/
- }
- else
- {
- if ((input_length = IterGetIterCount (info.counter.iter))
- == NO_VALUE)
- {
- return FmCannotCalc;
- }
- /*endif*/
- }
- /*endif*/
- switch (type)
- {
- case COUNTER_BIT8:
- *(CARD8 *) (fm->area + fm->idx) = input_length;
- fm->idx++;
- break;
-
- case COUNTER_BIT16:
- *(CARD16 *) (fm->area + fm->idx) = Swap16 (fm, input_length);
- fm->idx += 2;
- break;
-
- case COUNTER_BIT32:
- *(CARD32 *) (fm->area + fm->idx) = Swap32 (fm, input_length);
- fm->idx += 4;
- break;
-
-#if defined(_NEED64BIT)
- case COUNTER_BIT64:
- *(CARD64 *) (fm->area + fm->idx) = Swap64 (fm, input_length);
- fm->idx += 8;
- break;
-#endif
- default:
- break;
- }
- /*endswitch*/
- _FrameMgrPutToken(fm, data, data_size);
- return FmSuccess;
- }
- /*endif*/
-
- switch (type)
- {
- case BIT8:
- if (data_size == sizeof (unsigned char))
- {
- unsigned long num = *(unsigned char *) data;
- *(CARD8 *) (fm->area + fm->idx) = num;
- }
- else if (data_size == sizeof (unsigned short))
- {
- unsigned long num = *(unsigned short *) data;
- *(CARD8 *) (fm->area + fm->idx) = num;
- }
- else if (data_size == sizeof (unsigned int))
- {
- unsigned long num = *(unsigned int *) data;
- *(CARD8 *) (fm->area + fm->idx) = num;
- }
- else if (data_size == sizeof (unsigned long))
- {
- unsigned long num = *(unsigned long *) data;
- *(CARD8 *) (fm->area + fm->idx) = num;
- }
- else
- {
- ; /* Should never be reached */
- }
- /*endif*/
- fm->idx++;
- return FmSuccess;
-
- case BIT16:
- if (data_size == sizeof (unsigned char))
- {
- unsigned long num = *(unsigned char *) data;
- *(CARD16*)(fm->area + fm->idx) = Swap16 (fm, num);
- }
- else if (data_size == sizeof (unsigned short))
- {
- unsigned long num = *(unsigned short *) data;
- *(CARD16 *) (fm->area + fm->idx) = Swap16 (fm, num);
- }
- else if (data_size == sizeof (unsigned int))
- {
- unsigned long num = *(unsigned int *) data;
- *(CARD16 *) (fm->area + fm->idx) = Swap16 (fm, num);
- }
- else if (data_size == sizeof (unsigned long))
- {
- unsigned long num = *(unsigned long *) data;
- *(CARD16 *) (fm->area + fm->idx) = Swap16 (fm, num);
- }
- else
- {
- ; /* Should never reached */
- }
- /*endif*/
- fm->idx += 2;
- return FmSuccess;
-
- case BIT32:
- if (data_size == sizeof (unsigned char))
- {
- unsigned long num = *(unsigned char *) data;
- *(CARD32 *) (fm->area + fm->idx) = Swap32 (fm, num);
- }
- else if (data_size == sizeof (unsigned short))
- {
- unsigned long num = *(unsigned short *) data;
- *(CARD32 *) (fm->area + fm->idx) = Swap32 (fm, num);
- }
- else if (data_size == sizeof (unsigned int))
- {
- unsigned long num = *(unsigned int *) data;
- *(CARD32 *) (fm->area + fm->idx) = Swap32 (fm, num);
- }
- else if (data_size == sizeof (unsigned long))
- {
- unsigned long num = *(unsigned long *) data;
- *(CARD32 *) (fm->area + fm->idx) = Swap32 (fm, num);
- }
- else
- {
- ; /* Should never reached */
- }
- /*endif*/
- fm->idx += 4;
- return FmSuccess;
-
-#if defined(_NEED64BIT)
- case BIT64:
- if (data_size == sizeof (unsigned char))
- {
- unsigned long num = *(unsigned char *) data;
- *(CARD64 *) (fm->area + fm->idx) = Swap64 (fm, num);
- }
- else if (data_size == sizeof (unsigned short))
- {
- unsigned long num = *(unsigned short *) data;
- *(CARD64 *) (fm->area + fm->idx) = Swap64 (fm, num);
- }
- else if (data_size == sizeof (unsigned int))
- {
- unsigned long num = *(unsigned int *) data;
- *(CARD64 *) (fm->area + fm->idx) = Swap64 (fm, num);
- }
- else if (data_size == sizeof (unsigned long))
- {
- unsigned long num = *(unsigned long *) data;
- *(CARD64 *) (fm->area + fm->idx) = Swap64 (fm, num);
- }
- else
- {
- ; /* Should never reached */
- }
- /*endif*/
- fm->idx += 4;
- return FmSuccess;
-#endif
-
- case BARRAY:
- if (info.num == NO_VALUE)
- return FmInvalidCall;
- /*endif*/
- if (info.num > 0)
- {
- bcopy (*(char **) data, fm->area + fm->idx, info.num);
- fm->idx += info.num;
- }
- /*endif*/
- return FmSuccess;
-
- case PADDING:
- if (info.num == NO_VALUE)
- return FmInvalidCall;
- /*endif*/
- fm->idx += info.num;
- return _FrameMgrPutToken(fm, data, data_size);
-
- case ITER:
- return FmInvalidCall;
-
- case EOL:
- return FmEOD;
- default:
- break;
- }
- /*endswitch*/
- return (FmStatus) NULL; /* Should never be reached */
-}
-
-FmStatus _FrameMgrGetToken (FrameMgr fm , void* data, int data_size)
-{
- XimFrameType type;
- static XimFrameTypeInfoRec info; /* memory */
- FrameIter fitr;
-
- if (fm->total_size != NO_VALUE && fm->idx >= fm->total_size)
- return FmNoMoreData;
- /*endif*/
-
- type = FrameInstGetNextType(fm->fi, &info);
-
- if (type & COUNTER_MASK)
- {
- int end=0;
- FrameIter client_data;
-
- type &= ~COUNTER_MASK;
- switch (type)
- {
- case BIT8:
- end = *(CARD8 *) (fm->area + fm->idx);
- break;
-
- case BIT16:
- end = Swap16 (fm, *(CARD16 *) (fm->area + fm->idx));
- break;
-
- case BIT32:
- end = Swap32 (fm, *(CARD32 *) (fm->area + fm->idx));
- break;
-
-#if defined(_NEED64BIT)
- case BIT64:
- end = Swap64 (fm, *(CARD64 *) (fm->area + fm->idx));
- break;
-#endif
- default:
- break;
- }
- /*endswitch*/
-
- if ((client_data = _FrameMgrAppendIter (fm, info.counter.iter, end)))
- {
- IterSetStarter (info.counter.iter);
- IterSetStartWatch (info.counter.iter,
- _IterStartWatch,
- (void *) client_data);
- }
- /*endif*/
- }
- /*endif*/
-
- type &= ~COUNTER_MASK;
- switch (type)
- {
- case BIT8:
- if (data_size == sizeof (unsigned char))
- {
- *(unsigned char*) data = *(CARD8 *) (fm->area + fm->idx);
- }
- else if (data_size == sizeof (unsigned short))
- {
- *(unsigned short *) data = *(CARD8 *) (fm->area + fm->idx);
- }
- else if (data_size == sizeof (unsigned int))
- {
- *(unsigned int *) data = *(CARD8 *) (fm->area + fm->idx);
- }
- else if (data_size == sizeof (unsigned long))
- {
- *(unsigned long *) data = *(CARD8 *) (fm->area + fm->idx);
- }
- else
- {
- ; /* Should never reached */
- }
- /*endif*/
- fm->idx++;
- if ((fitr = _FrameIterCounterIncr (fm->iters, 1/*BIT8*/)))
- _FrameMgrRemoveIter (fm, fitr);
- /*endif*/
- return FmSuccess;
-
- case BIT16:
- if (data_size == sizeof (unsigned char))
- {
- *(unsigned char *) data =
- Swap16 (fm, *(CARD16 *) (fm->area + fm->idx));
- }
- else if (data_size == sizeof (unsigned short))
- {
- *(unsigned short *) data =
- Swap16 (fm, *(CARD16 *) (fm->area + fm->idx));
- }
- else if (data_size == sizeof (unsigned int))
- {
- *(unsigned int *) data =
- Swap16 (fm, *(CARD16 *) (fm->area + fm->idx));
- }
- else if (data_size == sizeof (unsigned long))
- {
- *(unsigned long *) data =
- Swap16 (fm, *(CARD16 *) (fm->area + fm->idx));
- }
- else
- {
- ; /* Should never reached */
- }
- /*endif*/
- fm->idx += 2;
- if ((fitr = _FrameIterCounterIncr (fm->iters, 2/*BIT16*/)))
- _FrameMgrRemoveIter(fm, fitr);
- /*endif*/
- return FmSuccess;
-
- case BIT32:
- if (data_size == sizeof (unsigned char))
- {
- *(unsigned char *) data =
- Swap32 (fm, *(CARD32 *) (fm->area + fm->idx));
- }
- else if (data_size == sizeof (unsigned short))
- {
- *(unsigned short *) data =
- Swap32 (fm, *(CARD32 *) (fm->area + fm->idx));
- }
- else if (data_size == sizeof (unsigned int))
- {
- *(unsigned int *) data =
- Swap32 (fm, *(CARD32 *) (fm->area + fm->idx));
- }
- else if (data_size == sizeof (unsigned long))
- {
- *(unsigned long *) data =
- Swap32 (fm, *(CARD32 *) (fm->area + fm->idx));
- }
- else
- {
- ; /* Should never reached */
- }
- /*endif*/
- fm->idx += 4;
- if ((fitr = _FrameIterCounterIncr (fm->iters, 4/*BIT32*/)))
- _FrameMgrRemoveIter (fm, fitr);
- /*endif*/
- return FmSuccess;
-
-#if defined(_NEED64BIT)
- case BIT64:
- if (data_size == sizeof (unsigned char))
- {
- *(unsigned char *) data =
- Swap64 (fm, *(CARD64 *) (fm->area + fm->idx));
- }
- else if (data_size == sizeof (unsigned short))
- {
- *(unsigned short *) data =
- Swap64 (fm, *(CARD64 *) (fm->area + fm->idx));
- }
- else if (data_size == sizeof (unsigned int))
- {
- *(unsigned int *) data =
- Swap64 (fm, *(CARD64 *) (fm->area + fm->idx));
- }
- else if (data_size == sizeof (unsigned long))
- {
- *(unsigned long *) data =
- Swap64 (fm, *(CARD64 *) (fm->area + fm->idx));
- }
- else
- {
- ; /* Should never reached */
- }
- /*endif*/
- fm->idx += 8;
- if ((fitr = _FrameIterCounterIncr (fm->iters, 8/*BIT64*/)))
- _FrameMgrRemoveIter (fm, fitr);
- /*endif*/
- return FmSuccess;
-#endif
-
- case BARRAY:
- if (info.num == NO_VALUE)
- return FmInvalidCall;
- /*endif*/
- if (info.num > 0)
- {
- *(char **) data = fm->area + fm->idx;
-
- fm->idx += info.num;
- if ((fitr = _FrameIterCounterIncr (fm->iters, info.num)))
- _FrameMgrRemoveIter (fm, fitr);
- /*endif*/
- }
- else
- {
- *(char **) data = NULL;
- }
- /*endif*/
- return FmSuccess;
-
- case PADDING:
- if (info.num == NO_VALUE)
- return FmInvalidCall;
- /*endif*/
- fm->idx += info.num;
- if ((fitr = _FrameIterCounterIncr (fm->iters, info.num)))
- _FrameMgrRemoveIter (fm, fitr);
- /*endif*/
- return _FrameMgrGetToken (fm, data, data_size);
-
- case ITER:
- return FmInvalidCall; /* if comes here, it's a bug! */
-
- case EOL:
- return FmEOD;
- default:
- break;
- }
- /*endswitch*/
- return (FmStatus) NULL; /* Should never be reached */
-}
-
-FmStatus FrameMgrSetSize (FrameMgr fm, int barray_size)
-{
- if (FrameInstSetSize (fm->fi, barray_size) == FmSuccess)
- return FmSuccess;
- /*endif*/
- return FmNoMoreData;
-}
-
-FmStatus FrameMgrSetIterCount (FrameMgr fm, int count)
-{
- if (FrameInstSetIterCount (fm->fi, count) == FmSuccess)
- return FmSuccess;
- /*endif*/
- return FmNoMoreData;
-}
-
-FmStatus FrameMgrSetTotalSize (FrameMgr fm, int total_size)
-{
- fm->total_size = total_size;
- return FmSuccess;
-}
-
-int FrameMgrGetTotalSize (FrameMgr fm)
-{
- return FrameInstGetTotalSize (fm->fi);
-}
-
-int FrameMgrGetSize (FrameMgr fm)
-{
- register int ret_size;
-
- ret_size = FrameInstGetSize (fm->fi);
- if (ret_size == NO_VALID_FIELD)
- return NO_VALUE;
- /*endif*/
- return ret_size;
-}
-
-FmStatus FrameMgrSkipToken (FrameMgr fm, int skip_count)
-{
- XimFrameType type;
- XimFrameTypeInfoRec info;
- register int i;
-
- if (fm->total_size != NO_VALUE && fm->idx >= fm->total_size)
- return FmNoMoreData;
- /*endif*/
- for (i = 0; i < skip_count; i++)
- {
- type = FrameInstGetNextType (fm->fi, &info);
- type &= ~COUNTER_MASK;
-
- switch (type)
- {
- case BIT8:
- fm->idx++;
- break;
-
- case BIT16:
- fm->idx += 2;
- break;
-
- case BIT32:
- fm->idx += 4;
- break;
-
- case BIT64:
- fm->idx += 8;
- break;
-
- case BARRAY:
- if (info.num == NO_VALUE)
- return FmInvalidCall;
- /*endif*/
- fm->idx += info.num;
- break;
-
- case PADDING:
- if (info.num == NO_VALUE)
- return FmInvalidCall;
- /*endif*/
- fm->idx += info.num;
- return FrameMgrSkipToken (fm, skip_count);
-
- case ITER:
- return FmInvalidCall;
-
- case EOL:
- return FmEOD;
- default:
- break;
- }
- /*endswitch*/
- }
- /*endfor*/
- return FmSuccess;
-}
-
-void FrameMgrReset (FrameMgr fm)
-{
- fm->idx = 0;
- FrameInstReset (fm->fi);
-}
-
-Bool FrameMgrIsIterLoopEnd (FrameMgr fm, FmStatus* status)
-{
- do
- {
- if (_FrameMgrIsIterLoopEnd (fm))
- return True;
- /*endif*/
- }
- while (_FrameMgrProcessPadding (fm, status));
-
- return False;
-}
-
-
-/* Internal routines */
-
-static Bool _FrameMgrIsIterLoopEnd (FrameMgr fm)
-{
- return FrameInstIsIterLoopEnd (fm->fi);
-}
-
-static Bool _FrameMgrProcessPadding (FrameMgr fm, FmStatus* status)
-{
- XimFrameTypeInfoRec info;
- XimFrameType next_type = FrameInstPeekNextType (fm->fi, &info);
- FrameIter fitr;
-
- if (next_type == PADDING)
- {
- if (info.num == NO_VALUE)
- {
- *status = FmInvalidCall;
- return True;
- }
- /*endif*/
- next_type = FrameInstGetNextType (fm->fi, &info);
- fm->idx += info.num;
- if ((fitr = _FrameIterCounterIncr (fm->iters, info.num)))
- _FrameMgrRemoveIter (fm, fitr);
- /*endif*/
- *status = FmSuccess;
- return True;
- }
- /*endif*/
- *status = FmSuccess;
- return False;
-}
-
-static FrameInst FrameInstInit (XimFrame frame)
-{
- FrameInst fi;
-
- fi = (FrameInst) Xmalloc (sizeof (FrameInstRec));
-
- fi->template = frame;
- fi->cur_no = 0;
- ChainMgrInit (&fi->cm);
- return fi;
-}
-
-static void FrameInstFree (FrameInst fi)
-{
- ChainIterRec ci;
- int frame_no;
- ExtraDataRec d;
-
- ChainIterInit (&ci, &fi->cm);
-
- while (ChainIterGetNext (&ci, &frame_no, &d))
- {
- register XimFrameType type;
- type = fi->template[frame_no].type;
- if (type == ITER)
- {
- if (d.iter)
- IterFree (d.iter);
- /*endif*/
- }
- else if (type == POINTER)
- {
- if (d.fi)
- FrameInstFree (d.fi);
- /*endif*/
- }
- /*endif*/
- }
- /*endwhile*/
- ChainIterFree (&ci);
- ChainMgrFree (&fi->cm);
- Xfree (fi);
-}
-
-static XimFrameType FrameInstGetNextType(FrameInst fi, XimFrameTypeInfo info)
-{
- XimFrameType ret_type;
-
- ret_type = fi->template[fi->cur_no].type;
-
- switch (ret_type)
- {
- case BIT8:
- case BIT16:
- case BIT32:
- case BIT64:
- case EOL:
- fi->cur_no = _FrameInstIncrement(fi->template, fi->cur_no);
- break;
-
- case COUNTER_BIT8:
- case COUNTER_BIT16:
- case COUNTER_BIT32:
- case COUNTER_BIT64:
- if (info)
- {
- register int offset, iter_idx;
-
- info->counter.is_byte_len =
- (((long) fi->template[fi->cur_no].data & 0xFF)) == FmCounterByte;
- offset = ((long) fi->template[fi->cur_no].data) >> 8;
- iter_idx = fi->cur_no + offset;
- if (fi->template[iter_idx].type == ITER)
- {
- ExtraData d;
- ExtraDataRec dr;
-
- if ((d = ChainMgrGetExtraData (&fi->cm, iter_idx)) == NULL)
- {
- dr.iter = IterInit (&fi->template[iter_idx + 1], NO_VALUE);
- d = ChainMgrSetData (&fi->cm, iter_idx, dr);
- }
- /*endif*/
- info->counter.iter = d->iter;
- }
- else
- {
- /* Should never reach here */
- }
- /*endif*/
- }
- /*endif*/
- fi->cur_no = _FrameInstIncrement (fi->template, fi->cur_no);
- break;
-
- case BARRAY:
- if (info)
- {
- ExtraData d;
-
- if ((d = ChainMgrGetExtraData (&fi->cm, fi->cur_no)) == NULL)
- info->num = NO_VALUE;
- else
- info->num = d->num;
- /*endif*/
- }
- /*endif*/
- fi->cur_no = _FrameInstIncrement (fi->template, fi->cur_no);
- break;
-
- case PADDING:
- if (info)
- {
- register int unit;
- register int number;
- register int size;
- register int i;
-
- unit = _UNIT ((long) fi->template[fi->cur_no].data);
- number = _NUMBER ((long) fi->template[fi->cur_no].data);
-
- i = fi->cur_no;
- size = 0;
- while (number > 0)
- {
- i = _FrameInstDecrement (fi->template, i);
- size += _FrameInstGetItemSize (fi, i);
- number--;
- }
- /*endwhile*/
- info->num = (unit - (size%unit))%unit;
- }
- /*endif*/
- fi->cur_no = _FrameInstIncrement (fi->template, fi->cur_no);
- break;
-
- case ITER:
- {
- ExtraData d;
- ExtraDataRec dr;
- XimFrameType sub_type;
-
-
- if ((d = ChainMgrGetExtraData (&fi->cm, fi->cur_no)) == NULL)
- {
- dr.iter = IterInit (&fi->template[fi->cur_no + 1], NO_VALUE);
- d = ChainMgrSetData (&fi->cm, fi->cur_no, dr);
- }
- /*endif*/
- sub_type = IterGetNextType (d->iter, info);
- if (sub_type == EOL)
- {
- fi->cur_no = _FrameInstIncrement (fi->template, fi->cur_no);
- ret_type = FrameInstGetNextType (fi, info);
- }
- else
- {
- ret_type = sub_type;
- }
- /*endif*/
- }
- break;
-
- case POINTER:
- {
- ExtraData d;
- ExtraDataRec dr;
- XimFrameType sub_type;
-
- if ((d = ChainMgrGetExtraData (&fi->cm, fi->cur_no)) == NULL)
- {
- dr.fi = FrameInstInit (fi->template[fi->cur_no + 1].data);
- d = ChainMgrSetData (&fi->cm, fi->cur_no, dr);
- }
- /*endif*/
- sub_type = FrameInstGetNextType (d->fi, info);
- if (sub_type == EOL)
- {
- fi->cur_no = _FrameInstIncrement (fi->template, fi->cur_no);
- ret_type = FrameInstGetNextType (fi, info);
- }
- else
- {
- ret_type = sub_type;
- }
- /*endif*/
- }
- break;
- default:
- break;
- }
- /*endswitch*/
- return ret_type;
-}
-
-static XimFrameType FrameInstPeekNextType (FrameInst fi, XimFrameTypeInfo info)
-{
- XimFrameType ret_type;
-
- ret_type = fi->template[fi->cur_no].type;
-
- switch (ret_type)
- {
- case BIT8:
- case BIT16:
- case BIT32:
- case BIT64:
- case EOL:
- break;
-
- case COUNTER_BIT8:
- case COUNTER_BIT16:
- case COUNTER_BIT32:
- case COUNTER_BIT64:
- if (info)
- {
- register int offset;
- register int iter_idx;
-
- info->counter.is_byte_len =
- (((long) fi->template[fi->cur_no].data) & 0xFF) == FmCounterByte;
- offset = ((long)fi->template[fi->cur_no].data) >> 8;
- iter_idx = fi->cur_no + offset;
- if (fi->template[iter_idx].type == ITER)
- {
- ExtraData d;
- ExtraDataRec dr;
-
- if ((d = ChainMgrGetExtraData (&fi->cm, iter_idx)) == NULL)
- {
- dr.iter = IterInit (&fi->template[iter_idx + 1], NO_VALUE);
- d = ChainMgrSetData (&fi->cm, iter_idx, dr);
- }
- /*endif*/
- info->counter.iter = d->iter;
- }
- else
- {
- /* Should not be reached here */
- }
- /*endif*/
- }
- /*endif*/
- break;
-
- case BARRAY:
- if (info)
- {
- ExtraData d;
-
- if ((d = ChainMgrGetExtraData (&fi->cm, fi->cur_no)) == NULL)
- info->num = NO_VALUE;
- else
- info->num = d->num;
- /*endif*/
- }
- /*endif*/
- break;
-
- case PADDING:
- if (info)
- {
- register int unit;
- register int number;
- register int size;
- register int i;
-
- unit = _UNIT ((long) fi->template[fi->cur_no].data);
- number = _NUMBER ((long) fi->template[fi->cur_no].data);
-
- i = fi->cur_no;
- size = 0;
- while (number > 0)
- {
- i = _FrameInstDecrement (fi->template, i);
- size += _FrameInstGetItemSize (fi, i);
- number--;
- }
- /*endwhile*/
- info->num = (unit - (size%unit))%unit;
- }
- /*endif*/
- break;
-
- case ITER:
- {
- ExtraData d;
- ExtraDataRec dr;
- XimFrameType sub_type;
-
- if ((d = ChainMgrGetExtraData (&fi->cm, fi->cur_no)) == NULL)
- {
- dr.iter = IterInit (&fi->template[fi->cur_no + 1], NO_VALUE);
- d = ChainMgrSetData (&fi->cm, fi->cur_no, dr);
- }
- /*endif*/
- sub_type = IterPeekNextType (d->iter, info);
- if (sub_type == EOL)
- ret_type = FrameInstPeekNextType (fi, info);
- else
- ret_type = sub_type;
- /*endif*/
- }
- break;
-
- case POINTER:
- {
- ExtraData d;
- ExtraDataRec dr;
- XimFrameType sub_type;
-
- if ((d = ChainMgrGetExtraData (&fi->cm, fi->cur_no)) == NULL)
- {
- dr.fi = FrameInstInit (fi->template[fi->cur_no + 1].data);
- d = ChainMgrSetData (&fi->cm, fi->cur_no, dr);
- }
- /*endif*/
- sub_type = FrameInstPeekNextType (d->fi, info);
- if (sub_type == EOL)
- ret_type = FrameInstPeekNextType (fi, info);
- else
- ret_type = sub_type;
- /*endif*/
- default:
- break;
- }
- break;
- }
- /*endswitch*/
- return ret_type;
-}
-
-static Bool FrameInstIsIterLoopEnd (FrameInst fi)
-{
- Bool ret = False;
-
- if (fi->template[fi->cur_no].type == ITER)
- {
- ExtraData d = ChainMgrGetExtraData (&fi->cm, fi->cur_no);
- Bool yourself;
-
- if (d)
- {
- ret = IterIsLoopEnd (d->iter, &yourself);
- if (ret && yourself)
- fi->cur_no = _FrameInstIncrement (fi->template, fi->cur_no);
- /*endif*/
- }
- /*endif*/
- }
- /*endif*/
- return (ret);
-}
-
-static FrameIter _FrameMgrAppendIter (FrameMgr fm, Iter it, int end)
-{
- FrameIter p = fm->iters;
-
- while (p && p->next)
- p = p->next;
- /*endwhile*/
-
- if (!p)
- {
- fm->iters =
- p = (FrameIter) Xmalloc (sizeof (FrameIterRec));
- }
- else
- {
- p->next = (FrameIter) Xmalloc (sizeof (FrameIterRec));
- p = p->next;
- }
- /*endif*/
- if (p)
- {
- p->iter = it;
- p->counting = False;
- p->counter = 0;
- p->end = end;
- p->next = NULL;
- }
- /*endif*/
- return (p);
-}
-
-static void _FrameMgrRemoveIter (FrameMgr fm, FrameIter it)
-{
- FrameIter prev;
- FrameIter p;
-
- prev = NULL;
- p = fm->iters;
- while (p)
- {
- if (p == it)
- {
- if (prev)
- prev->next = p->next;
- else
- fm->iters = p->next;
- /*endif*/
- Xfree (p);
- break;
- }
- /*endif*/
- prev = p;
- p = p->next;
- }
- /*endwhile*/
-}
-
-static FrameIter _FrameIterCounterIncr (FrameIter fitr, int i)
-{
- FrameIter p = fitr;
-
- while (p)
- {
- if (p->counting)
- {
- p->counter += i;
- if (p->counter >= p->end)
- {
- IterFixIteration (p->iter);
- return (p);
- }
- /*endif*/
- }
- /*endif*/
- p = p->next;
- }
- /*endwhile*/
- return (NULL);
-}
-
-static void _IterStartWatch (Iter it, void *client_data)
-{
- FrameIter p = (FrameIter) client_data;
- p->counting = True;
-}
-
-static FmStatus FrameInstSetSize (FrameInst fi, int num)
-{
- ExtraData d;
- ExtraDataRec dr;
- XimFrameType type;
- register int i;
-
- i = 0;
- while ((type = fi->template[i].type) != EOL)
- {
- switch (type)
- {
- case BARRAY:
- if ((d = ChainMgrGetExtraData (&fi->cm, i)) == NULL)
- {
- dr.num = -1;
- d = ChainMgrSetData (&fi->cm, i, dr);
- }
- /*endif*/
- if (d->num == NO_VALUE)
- {
- d->num = num;
- return FmSuccess;
- }
- /*endif*/
- break;
- case ITER:
- if ((d = ChainMgrGetExtraData (&fi->cm, i)) == NULL)
- {
- dr.iter = IterInit (&fi->template[i + 1], NO_VALUE);
- d = ChainMgrSetData (&fi->cm, i, dr);
- }
- /*endif*/
- if (IterSetSize (d->iter, num) == FmSuccess)
- return FmSuccess;
- /*endif*/
- break;
-
- case POINTER:
- if ((d = ChainMgrGetExtraData(&fi->cm, i)) == NULL)
- {
- dr.fi = FrameInstInit(fi->template[i + 1].data);
- d = ChainMgrSetData(&fi->cm, i, dr);
- }
- /*endif*/
- if (FrameInstSetSize(d->fi, num) == FmSuccess)
- return FmSuccess;
- /*endif*/
- break;
- default:
- break;
- }
- /*endswitch*/
- i = _FrameInstIncrement(fi->template, i);
- }
- /*endwhile*/
- return FmNoMoreData;
-}
-
-static int FrameInstGetSize (FrameInst fi)
-{
- XimFrameType type;
- register int i;
- ExtraData d;
- ExtraDataRec dr;
- int ret_size;
-
- i = fi->cur_no;
- while ((type = fi->template[i].type) != EOL)
- {
- switch (type)
- {
- case BARRAY:
- if ((d = ChainMgrGetExtraData (&fi->cm, i)) == NULL)
- return NO_VALUE;
- /*endif*/
- return d->num;
-
- case ITER:
- if ((d = ChainMgrGetExtraData (&fi->cm, i)) == NULL)
- {
- dr.iter = IterInit (&fi->template[i + 1], NO_VALUE);
- d = ChainMgrSetData (&fi->cm, i, dr);
- }
- /*endif*/
- ret_size = IterGetSize(d->iter);
- if (ret_size != NO_VALID_FIELD)
- return ret_size;
- /*endif*/
- break;
-
- case POINTER:
- if ((d = ChainMgrGetExtraData (&fi->cm, i)) == NULL)
- {
- dr.fi = FrameInstInit (fi->template[i + 1].data);
- d = ChainMgrSetData (&fi->cm, i, dr);
- }
- /*endif*/
- ret_size = FrameInstGetSize (d->fi);
- if (ret_size != NO_VALID_FIELD)
- return ret_size;
- /*endif*/
- break;
- default:
- break;
- }
- /*endswitch*/
- i = _FrameInstIncrement (fi->template, i);
- }
- /*endwhile*/
- return NO_VALID_FIELD;
-}
-
-static FmStatus FrameInstSetIterCount (FrameInst fi, int num)
-{
- ExtraData d;
- ExtraDataRec dr;
- register int i;
- XimFrameType type;
-
- i = 0;
- while ((type = fi->template[i].type) != EOL)
- {
- switch (type)
- {
- case ITER:
- if ((d = ChainMgrGetExtraData (&fi->cm, i)) == NULL)
- {
- dr.iter = IterInit (&fi->template[i + 1], num);
- (void)ChainMgrSetData (&fi->cm, i, dr);
- return FmSuccess;
- }
- /*endif*/
- if (IterSetIterCount (d->iter, num) == FmSuccess)
- return FmSuccess;
- /*endif*/
- break;
-
- case POINTER:
- if ((d = ChainMgrGetExtraData (&fi->cm, i)) == NULL)
- {
- dr.fi = FrameInstInit (fi->template[i + 1].data);
- d = ChainMgrSetData (&fi->cm, i, dr);
- }
- /*endif*/
- if (FrameInstSetIterCount (d->fi, num) == FmSuccess)
- return FmSuccess;
- /*endif*/
- break;
-
- default:
- break;
- }
- /*endswitch*/
- i = _FrameInstIncrement (fi->template, i);
- }
- /*endwhile*/
- return FmNoMoreData;
-}
-
-static int FrameInstGetTotalSize (FrameInst fi)
-{
- register int size;
- register int i;
-
- size = 0;
- i = 0;
-
- while (fi->template[i].type != EOL)
- {
- size += _FrameInstGetItemSize (fi, i);
- i = _FrameInstIncrement (fi->template, i);
- }
- /*endwhile*/
- return size;
-}
-
-static void FrameInstReset (FrameInst fi)
-{
- ChainIterRec ci;
- int frame_no;
- ExtraDataRec d;
-
- ChainIterInit (&ci, &fi->cm);
-
- while (ChainIterGetNext (&ci, &frame_no, &d))
- {
- register XimFrameType type;
- type = fi->template[frame_no].type;
- if (type == ITER)
- {
- if (d.iter)
- IterReset (d.iter);
- /*endif*/
- }
- else if (type == POINTER)
- {
- if (d.fi)
- FrameInstReset (d.fi);
- /*endif*/
- }
- /*endif*/
- }
- /*endwhile*/
- ChainIterFree (&ci);
-
- fi->cur_no = 0;
-}
-
-static Iter IterInit (XimFrame frame, int count)
-{
- Iter it;
- register XimFrameType type;
-
- it = (Iter) Xmalloc (sizeof (IterRec));
- it->template = frame;
- it->max_count = (count == NO_VALUE) ? 0 : count;
- it->allow_expansion = (count == NO_VALUE);
- it->cur_no = 0;
- it->start_watch_proc = NULL;
- it->client_data = NULL;
- it->start_counter = False;
-
- type = frame->type;
- if (type & COUNTER_MASK)
- {
- /* COUNTER_XXX cannot be an item of a ITER */
- Xfree (it);
- return NULL;
- }
- /*endif*/
-
- switch (type)
- {
- case BIT8:
- case BIT16:
- case BIT32:
- case BIT64:
- /* Do nothing */
- break;
-
- case BARRAY:
- case ITER:
- case POINTER:
- ChainMgrInit (&it->cm);
- break;
-
- default:
- Xfree (it);
- return NULL; /* This should never occur */
- }
- /*endswitch*/
- return it;
-}
-
-static void IterFree (Iter it)
-{
- switch (it->template->type)
- {
- case BARRAY:
- ChainMgrFree (&it->cm);
- break;
-
- case ITER:
- {
- ChainIterRec ci;
- int count;
- ExtraDataRec d;
-
- ChainIterInit (&ci, &it->cm);
- while (ChainIterGetNext (&ci, &count, &d))
- IterFree (d.iter);
- /*endwhile*/
- ChainIterFree (&ci);
- ChainMgrFree (&it->cm);
- }
- break;
-
- case POINTER:
- {
- ChainIterRec ci;
- int count;
- ExtraDataRec dr;
-
- ChainIterInit (&ci, &it->cm);
- while (ChainIterGetNext (&ci, &count, &dr))
- FrameInstFree (dr.fi);
- /*endwhile*/
- ChainIterFree (&ci);
- ChainMgrFree (&it->cm);
- }
- break;
-
- default:
- break;
- }
- /*endswitch*/
- Xfree (it);
-}
-
-static Bool IterIsLoopEnd (Iter it, Bool *myself)
-{
- Bool ret = False;
- *myself = False;
-
- if (!it->allow_expansion && (it->cur_no == it->max_count))
- {
- *myself = True;
- return True;
- }
- /*endif*/
-
- if (it->template->type == POINTER)
- {
- ExtraData d = ChainMgrGetExtraData (&it->cm, it->cur_no);
- if (d)
- {
- if (FrameInstIsIterLoopEnd (d->fi))
- {
- ret = True;
- }
- else
- {
- if (FrameInstIsEnd (d->fi))
- {
- it->cur_no++;
- if (!it->allow_expansion && it->cur_no == it->max_count)
- {
- *myself = True;
- ret = True;
- }
- /*endif*/
- }
- /*endif*/
- }
- /*endif*/
- }
- /*endif*/
- }
- else if (it->template->type == ITER)
- {
- ExtraData d = ChainMgrGetExtraData (&it->cm, it->cur_no);
- if (d)
- {
- Bool yourself;
-
- if (IterIsLoopEnd (d->iter, &yourself))
- ret = True;
- /*endif*/
- }
- /*endif*/
- }
- /*endif*/
-
- return ret;
-}
-
-static XimFrameType IterGetNextType (Iter it, XimFrameTypeInfo info)
-{
- XimFrameType type = it->template->type;
-
- if (it->start_counter)
- {
- (*it->start_watch_proc) (it, it->client_data);
- it->start_counter = False;
- }
- /*endif*/
- if (it->cur_no >= it->max_count)
- {
- if (it->allow_expansion)
- it->max_count = it->cur_no + 1;
- else
- return EOL;
- /*endif*/
- }
- /*endif*/
-
- switch (type)
- {
- case BIT8:
- case BIT16:
- case BIT32:
- case BIT64:
- it->cur_no++;
- return type;
-
- case BARRAY:
- if (info)
- {
- ExtraData d;
-
- if ((d = ChainMgrGetExtraData (&it->cm, it->cur_no)) == NULL)
- info->num = NO_VALUE;
- else
- info->num = d->num;
- /*endif*/
- }
- /*endif*/
- it->cur_no++;
- return BARRAY;
-
- case ITER:
- {
- XimFrameType ret_type;
- ExtraData d;
- ExtraDataRec dr;
-
- if ((d = ChainMgrGetExtraData (&it->cm, it->cur_no)) == NULL)
- {
- dr.iter = IterInit (it->template + 1, NO_VALUE);
- d = ChainMgrSetData (&it->cm, it->cur_no, dr);
- }
- /*endif*/
-
- ret_type = IterGetNextType (d->iter, info);
- if (ret_type == EOL)
- {
- it->cur_no++;
- ret_type = IterGetNextType (it, info);
- }
- /*endif*/
- return ret_type;
- }
-
- case POINTER:
- {
- XimFrameType ret_type;
- ExtraData d;
- ExtraDataRec dr;
-
- if ((d = ChainMgrGetExtraData (&it->cm, it->cur_no)) == NULL)
- {
- dr.fi = FrameInstInit (it->template[1].data);
- d = ChainMgrSetData (&it->cm, it->cur_no, dr);
- }
- /*endif*/
-
- ret_type = FrameInstGetNextType (d->fi, info);
- if (ret_type == EOL)
- {
- it->cur_no++;
- ret_type = IterGetNextType (it, info);
- }
- /*endif*/
- return ret_type;
- }
-
- default:
- return (XimFrameType) NULL;
- }
- /*endswitch*/
- return (XimFrameType) NULL; /* This should never occur */
-}
-
-static XimFrameType IterPeekNextType (Iter it, XimFrameTypeInfo info)
-{
- XimFrameType type = it->template->type;
-
- if (!it->allow_expansion && it->cur_no >= it->max_count)
- return (EOL);
- /*endif*/
-
- switch (type)
- {
- case BIT8:
- case BIT16:
- case BIT32:
- case BIT64:
- return type;
-
- case BARRAY:
- if (info)
- {
- ExtraData d;
-
- if ((d = ChainMgrGetExtraData (&it->cm, it->cur_no)) == NULL)
- info->num = NO_VALUE;
- else
- info->num = d->num;
- /*endif*/
- }
- /*endif*/
- return BARRAY;
-
- case ITER:
- {
- XimFrameType ret_type;
- ExtraData d;
- ExtraDataRec dr;
-
- if ((d = ChainMgrGetExtraData (&it->cm, it->cur_no)) == NULL)
- {
- dr.iter = IterInit (it->template + 1, NO_VALUE);
- d = ChainMgrSetData (&it->cm, it->cur_no, dr);
- }
- /*endif*/
-
- ret_type = IterPeekNextType (d->iter, info);
- if (ret_type == EOL)
- ret_type = IterPeekNextType (it, info);
- /*endif*/
- return ret_type;
- }
-
- case POINTER:
- {
- XimFrameType ret_type;
- ExtraData d;
- ExtraDataRec dr;
-
- if ((d = ChainMgrGetExtraData (&it->cm, it->cur_no)) == NULL)
- {
- dr.fi = FrameInstInit (it->template[1].data);
- d = ChainMgrSetData (&it->cm, it->cur_no, dr);
- }
- /*endif*/
-
- ret_type = FrameInstPeekNextType (d->fi, info);
- if (ret_type == EOL)
- ret_type = IterPeekNextType (it, info);
- /*endif*/
- return (ret_type);
- }
-
- default:
- break;
- }
- /*endswitch*/
- /* Reaching here is a bug! */
- return (XimFrameType) NULL;
-}
-
-static FmStatus IterSetSize (Iter it, int num)
-{
- XimFrameType type;
- register int i;
-
- if (!it->allow_expansion && it->max_count == 0)
- return FmNoMoreData;
- /*endif*/
-
- type = it->template->type;
- switch (type)
- {
- case BARRAY:
- {
- ExtraData d;
- ExtraDataRec dr;
-
- for (i = 0; i < it->max_count; i++)
- {
- if ((d = ChainMgrGetExtraData (&it->cm, i)) == NULL)
- {
- dr.num = NO_VALUE;
- d = ChainMgrSetData (&it->cm, i, dr);
- }
- /*endif*/
- if (d->num == NO_VALUE)
- {
- d->num = num;
- return FmSuccess;
- }
- /*endif*/
- }
- /*endfor*/
- if (it->allow_expansion)
- {
- ExtraDataRec dr;
-
- dr.num = num;
- ChainMgrSetData (&it->cm, it->max_count, dr);
- it->max_count++;
-
- return FmSuccess;
- }
- /*endif*/
- }
- return FmNoMoreData;
-
- case ITER:
- {
- ExtraData d;
- ExtraDataRec dr;
-
- for (i = 0; i < it->max_count; i++)
- {
- if ((d = ChainMgrGetExtraData (&it->cm, i)) == NULL)
- {
- dr.iter = IterInit (it->template + 1, NO_VALUE);
- d = ChainMgrSetData (&it->cm, i, dr);
- }
- /*endif*/
- if (IterSetSize (d->iter, num) == FmSuccess)
- return FmSuccess;
- /*endif*/
- }
- /*endfor*/
- if (it->allow_expansion)
- {
- ExtraDataRec dr;
-
- dr.iter = IterInit (it->template + 1, NO_VALUE);
- ChainMgrSetData (&it->cm, it->max_count, dr);
- it->max_count++;
-
- if (IterSetSize(dr.iter, num) == FmSuccess)
- return FmSuccess;
- /*endif*/
- }
- /*endif*/
- }
- return FmNoMoreData;
-
- case POINTER:
- {
- ExtraData d;
- ExtraDataRec dr;
-
- for (i = 0; i < it->max_count; i++)
- {
- if ((d = ChainMgrGetExtraData (&it->cm, i)) == NULL)
- {
- dr.fi = FrameInstInit (it->template[1].data);
- d = ChainMgrSetData (&it->cm, i, dr);
- }
- /*endif*/
- if (FrameInstSetSize (d->fi, num) == FmSuccess)
- return FmSuccess;
- /*endif*/
- }
- /*endfor*/
- if (it->allow_expansion)
- {
- ExtraDataRec dr;
-
- dr.fi = FrameInstInit (it->template[1].data);
- ChainMgrSetData (&it->cm, it->max_count, dr);
- it->max_count++;
-
- if (FrameInstSetSize (dr.fi, num) == FmSuccess)
- return FmSuccess;
- /*endif*/
- }
- /*endif*/
- }
- return FmNoMoreData;
-
- default:
- break;
- }
- /*endswitch*/
- return FmNoMoreData;
-}
-
-static int IterGetSize (Iter it)
-{
- register int i;
- ExtraData d;
- ExtraDataRec dr;
-
- if (it->cur_no >= it->max_count)
- return NO_VALID_FIELD;
- /*endif*/
-
- switch (it->template->type)
- {
- case BARRAY:
- if ((d = ChainMgrGetExtraData (&it->cm, it->cur_no)) == NULL)
- return NO_VALUE;
- /*endif*/
- return d->num;
-
- case ITER:
- for (i = it->cur_no; i < it->max_count; i++)
- {
- int ret_size;
-
- if ((d = ChainMgrGetExtraData (&it->cm, i)) == NULL)
- {
- dr.iter = IterInit (it->template + 1, NO_VALUE);
- d = ChainMgrSetData (&it->cm, i, dr);
- }
- /*endif*/
- ret_size = IterGetSize (d->iter);
- if (ret_size != NO_VALID_FIELD)
- return ret_size;
- /*endif*/
- }
- /*endfor*/
- return NO_VALID_FIELD;
-
- case POINTER:
- for (i = it->cur_no; i < it->max_count; i++)
- {
- int ret_size;
-
- if ((d = ChainMgrGetExtraData (&it->cm, i)) == NULL)
- {
- dr.fi = FrameInstInit (it->template[1].data);
- d = ChainMgrSetData (&it->cm, i, dr);
- }
- /*endif*/
- ret_size = FrameInstGetSize (d->fi);
- if (ret_size != NO_VALID_FIELD)
- return ret_size;
- /*endif*/
- }
- /*endfor*/
- return NO_VALID_FIELD;
-
- default:
- break;
- }
- /*endswitch*/
- return NO_VALID_FIELD;
-}
-
-static FmStatus IterSetIterCount (Iter it, int num)
-{
- register int i;
-
- if (it->allow_expansion)
- {
- it->max_count = num;
- it->allow_expansion = False;
- return FmSuccess;
- }
- /*endif*/
-
- if (it->max_count == 0)
- return FmNoMoreData;
- /*endif*/
-
- switch (it->template->type)
- {
- case ITER:
- for (i = 0; i < it->max_count; i++)
- {
- ExtraData d;
- ExtraDataRec dr;
-
- if ((d = ChainMgrGetExtraData(&it->cm, i)) == NULL)
- {
- dr.iter = IterInit(it->template + 1, num);
- (void)ChainMgrSetData(&it->cm, i, dr);
- return FmSuccess;
- }
- /*endif*/
- if (IterSetIterCount(d->iter, num) == FmSuccess)
- return FmSuccess;
- /*endif*/
- }
- /*endfor*/
- if (it->allow_expansion)
- {
- ExtraDataRec dr;
-
- dr.iter = IterInit (it->template + 1, num);
- ChainMgrSetData (&it->cm, it->max_count, dr);
- it->max_count++;
-
- return FmSuccess;
- }
- /*endif*/
- break;
-
- case POINTER:
- for (i = 0; i < it->max_count; i++)
- {
- ExtraData d;
- ExtraDataRec dr;
-
- if ((d = ChainMgrGetExtraData (&it->cm, i)) == NULL)
- {
- dr.fi = FrameInstInit (it->template[1].data);
- d = ChainMgrSetData (&it->cm, i, dr);
- }
- /*endif*/
- if (FrameInstSetIterCount (d->fi, num) == FmSuccess)
- return FmSuccess;
- /*endif*/
- }
- /*endfor*/
- if (it->allow_expansion)
- {
- ExtraDataRec dr;
-
- dr.fi = FrameInstInit (it->template[1].data);
- ChainMgrSetData (&it->cm, it->max_count, dr);
- it->max_count++;
-
- if (FrameInstSetIterCount (dr.fi, num) == FmSuccess)
- return FmSuccess;
- /*endif*/
- }
- /*endif*/
- break;
-
- default:
- break;
- }
- /*endswitch*/
- return FmNoMoreData;
-}
-
-static int IterGetTotalSize (Iter it)
-{
- register int size, i;
- XimFrameType type;
-
- if (it->allow_expansion)
- return NO_VALUE;
- /*endif*/
- if (it->max_count == 0)
- return 0;
- /*endif*/
-
- size = 0;
- type = it->template->type;
-
- switch (type)
- {
- case BIT8:
- size = it->max_count;
- break;
-
- case BIT16:
- size = it->max_count*2;
- break;
-
- case BIT32:
- size = it->max_count*4;
- break;
-
- case BIT64:
- size = it->max_count*8;
- break;
-
- case BARRAY:
- for (i = 0; i < it->max_count; i++)
- {
- register int num;
- ExtraData d;
-
- if ((d = ChainMgrGetExtraData (&it->cm, i)) == NULL)
- return NO_VALUE;
- /*endif*/
- if ((num = d->num) == NO_VALUE)
- return NO_VALUE;
- /*endif*/
- size += num;
- }
- /*endfor*/
- break;
-
- case ITER:
- for (i = 0; i < it->max_count; i++)
- {
- register int num;
- ExtraData d;
-
- if ((d = ChainMgrGetExtraData (&it->cm, i)) == NULL)
- return NO_VALUE;
- /*endif*/
- if ((num = IterGetTotalSize (d->iter)) == NO_VALUE)
- return NO_VALUE;
- /*endif*/
- size += num;
- }
- /*endfor*/
- break;
-
- case POINTER:
- for (i = 0; i < it->max_count; i++)
- {
- register int num;
- ExtraData d;
- ExtraDataRec dr;
-
- if ((d = ChainMgrGetExtraData (&it->cm, i)) == NULL)
- {
- dr.fi = FrameInstInit (it->template[1].data);
- d = ChainMgrSetData (&it->cm, i, dr);
- }
- /*endif*/
- if ((num = FrameInstGetTotalSize (d->fi)) == NO_VALUE)
- return NO_VALUE;
- /*endif*/
- size += num;
- }
- /*endfor*/
- break;
-
- default:
- break;
- }
- /*endswitch*/
- return size;
-}
-
-static void IterReset (Iter it)
-{
- ChainIterRec ci;
- int count;
- ExtraDataRec d;
-
- switch (it->template->type)
- {
- case ITER:
- ChainIterInit (&ci, &it->cm);
- while (ChainIterGetNext (&ci, &count, &d))
- IterReset (d.iter);
- /*endwhile*/
- ChainIterFree (&ci);
- break;
-
- case POINTER:
- ChainIterInit (&ci, &it->cm);
- while (ChainIterGetNext (&ci, &count, &d))
- FrameInstReset (d.fi);
- /*endwhile*/
- ChainIterFree (&ci);
- break;
-
- default:
- break;
- }
- /*endswitch*/
- it->cur_no = 0;
-}
-
-static void IterSetStartWatch (Iter it,
- IterStartWatchProc proc,
- void *client_data)
-{
- it->start_watch_proc = proc;
- it->client_data = client_data;
-}
-
-static ExtraData ChainMgrSetData (ChainMgr cm,
- int frame_no,
- ExtraDataRec data)
-{
- Chain cur = (Chain) Xmalloc (sizeof (ChainRec));
-
- cur->frame_no = frame_no;
- cur->d = data;
- cur->next = NULL;
-
- if (cm->top == NULL)
- {
- cm->top = cm->tail = cur;
- }
- else
- {
- cm->tail->next = cur;
- cm->tail = cur;
- }
- /*endif*/
- return &cur->d;
-}
-
-static ExtraData ChainMgrGetExtraData (ChainMgr cm, int frame_no)
-{
- Chain cur;
-
- cur = cm->top;
-
- while (cur)
- {
- if (cur->frame_no == frame_no)
- return &cur->d;
- /*endif*/
- cur = cur->next;
- }
- /*endwhile*/
- return NULL;
-}
-
-static Bool ChainIterGetNext (ChainIter ci, int *frame_no, ExtraData d)
-{
- if (ci->cur == NULL)
- return False;
- /*endif*/
-
- *frame_no = ci->cur->frame_no;
- *d = ci->cur->d;
-
- ci->cur = ci->cur->next;
-
- return True;
-}
-
-static int _FrameInstIncrement (XimFrame frame, int count)
-{
- XimFrameType type;
-
- type = frame[count].type;
- type &= ~COUNTER_MASK;
-
- switch (type)
- {
- case BIT8:
- case BIT16:
- case BIT32:
- case BIT64:
- case BARRAY:
- case PADDING:
- return count + 1;
-
- case POINTER:
- return count + 2;
-
- case ITER:
- return _FrameInstIncrement (frame, count + 1);
- default:
- break;
- }
- /*endswitch*/
- return - 1; /* Error */
-}
-
-static int _FrameInstDecrement (XimFrame frame, int count)
-{
- register int i;
- XimFrameType type;
-
- if (count == 0)
- return - 1; /* cannot decrement */
- /*endif*/
-
- if (count == 1)
- return 0; /* BOGUS - It should check the contents of data */
- /*endif*/
-
- type = frame[count - 2].type;
- type &= ~COUNTER_MASK;
-
- switch (type)
- {
- case BIT8:
- case BIT16:
- case BIT32:
- case BIT64:
- case BARRAY:
- case PADDING:
- case PTR_ITEM:
- return count - 1;
-
- case POINTER:
- case ITER:
- i = count - 3;
- while (i >= 0)
- {
- if (frame[i].type != ITER)
- return i + 1;
- /*endif*/
- i--;
- }
- /*endwhile*/
- return 0;
- default:
- break;
- }
- /*enswitch*/
- return - 1; /* Error */
-}
-
-static int _FrameInstGetItemSize (FrameInst fi, int cur_no)
-{
- XimFrameType type;
-
- type = fi->template[cur_no].type;
- type &= ~COUNTER_MASK;
-
- switch (type)
- {
- case BIT8:
- return 1;
-
- case BIT16:
- return 2;
-
- case BIT32:
- return 4;
-
- case BIT64:
- return 8;
-
- case BARRAY:
- {
- ExtraData d;
-
- if ((d = ChainMgrGetExtraData (&fi->cm, cur_no)) == NULL)
- return NO_VALUE;
- /*endif*/
- if (d->num == NO_VALUE)
- return NO_VALUE;
- /*endif*/
- return d->num;
- }
-
- case PADDING:
- {
- register int unit;
- register int number;
- register int size;
- register int i;
-
- unit = _UNIT ((long) fi->template[cur_no].data);
- number = _NUMBER ((long) fi->template[cur_no].data);
-
- i = cur_no;
- size = 0;
- while (number > 0)
- {
- i = _FrameInstDecrement (fi->template, i);
- size += _FrameInstGetItemSize (fi, i);
- number--;
- }
- /*endwhile*/
- size = (unit - (size%unit))%unit;
- return size;
- }
-
- case ITER:
- {
- ExtraData d;
- int sub_size;
-
- if ((d = ChainMgrGetExtraData (&fi->cm, cur_no)) == NULL)
- return NO_VALUE;
- /*endif*/
- sub_size = IterGetTotalSize (d->iter);
- if (sub_size == NO_VALUE)
- return NO_VALUE;
- /*endif*/
- return sub_size;
- }
-
- case POINTER:
- {
- ExtraData d;
- int sub_size;
-
- if ((d = ChainMgrGetExtraData (&fi->cm, cur_no)) == NULL)
- return NO_VALUE;
- /*endif*/
- sub_size = FrameInstGetTotalSize (d->fi);
- if (sub_size == NO_VALUE)
- return NO_VALUE;
- /*endif*/
- return sub_size;
- }
-
- default:
- break;
- }
- /*endswitch*/
- return NO_VALUE;
-}
diff --git a/x11/IMdkit/FrameMgr.h b/x11/IMdkit/FrameMgr.h
deleted file mode 100644
index ce7ed50..0000000
--- a/x11/IMdkit/FrameMgr.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/******************************************************************
-Copyright 1993, 1994 by Digital Equipment Corporation, Maynard, Massachusetts,
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the names of Digital or MIT not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
- Author: Hiroyuki Miyamoto Digital Equipment Corporation
- miyamoto@jrd.dec.com
-
- This version tidied and debugged by Steve Underwood May 1999
-
-******************************************************************/
-
-#ifndef FRAMEMGR_H
-#define FRAMEMGR_H
-
-#include <X11/Xmd.h>
-#include <X11/Xlib.h>
-#include <stdio.h>
-
-#if defined(VAXC) && !defined(__DECC)
-#define xim_externalref globalref
-#define xim_externaldef globaldef
-#else
-#define xim_externalref extern
-#define xim_externaldef
-#endif
-
-/* Definitions for FrameMgr */
-
-#define COUNTER_MASK 0x10
-
-typedef enum
-{
- BIT8 = 0x1, /* {CARD8* | INT8*} */
- BIT16 = 0x2, /* {CARD16* | INT16*} */
- BIT32 = 0x3, /* {CARD32* | INT32*} */
- BIT64 = 0x4, /* {CARD64* | INT64*} */
- BARRAY = 0x5, /* int*, void* */
- ITER = 0x6, /* int* */
- POINTER = 0x7, /* specifies next item is a PTR_ITEM */
- PTR_ITEM = 0x8, /* specifies the item has a pointer */
- /* BOGUS - POINTER and PTR_ITEM
- * In the current implementation, PTR_ITEM should be lead by
- * POINTER. But actually, it's just redundant logically. Someone
- * may remove this redundancy and POINTER from the enum member but he
- * should also modify the logic in FrameMgr program.
- */
- PADDING = 0x9, /* specifies that a padding is needed.
- * This requires extra data in data field.
- */
- EOL = 0xA, /* specifies the end of list */
-
- COUNTER_BIT8 = COUNTER_MASK | 0x1,
- COUNTER_BIT16 = COUNTER_MASK | 0x2,
- COUNTER_BIT32 = COUNTER_MASK | 0x3,
- COUNTER_BIT64 = COUNTER_MASK | 0x4
-} XimFrameType;
-
-/* Convenient macro */
-#define _FRAME(a) {a, NULL}
-#define _PTR(p) {PTR_ITEM, (void *)p}
-/* PADDING's usage of data field
- * B15-B8 : Shows the number of effective items.
- * B7-B0 : Shows padding unit. ex) 04 shows 4 unit padding.
- */
-#define _PAD2(n) {PADDING, (void*)((n)<<8|2)}
-#define _PAD4(n) {PADDING, (void*)((n)<<8|4)}
-
-#define FmCounterByte 0
-#define FmCounterNumber 1
-
-#define _BYTE_COUNTER(type, offset) \
- {(COUNTER_MASK|type), (void*)((offset)<<8|FmCounterByte)}
-
-#define _NUMBER_COUNTER(type, offset) \
- {(COUNTER_MASK|type), (void*)((offset)<<8|FmCounterNumber)}
-
-typedef struct _XimFrame
-{
- XimFrameType type;
- void* data; /* For PTR_ITEM and PADDING */
-} XimFrameRec, *XimFrame;
-
-typedef enum
-{
- FmSuccess,
- FmEOD,
- FmInvalidCall,
- FmBufExist,
- FmCannotCalc,
- FmNoMoreData
-} FmStatus;
-
-typedef struct _FrameMgr *FrameMgr;
-
-FrameMgr FrameMgrInit(XimFrame frame, char* area, Bool byte_swap);
-void FrameMgrInitWithData(FrameMgr fm, XimFrame frame, void* area,
- Bool byte_swap);
-void FrameMgrFree(FrameMgr fm);
-FmStatus FrameMgrSetBuffer(FrameMgr, void*);
-FmStatus _FrameMgrPutToken(FrameMgr, void*, int);
-FmStatus _FrameMgrGetToken(FrameMgr, void*, int);
-FmStatus FrameMgrSetSize(FrameMgr, int);
-FmStatus FrameMgrSetIterCount(FrameMgr, int);
-FmStatus FrameMgrSetTotalSize(FrameMgr, int);
-int FrameMgrGetTotalSize(FrameMgr);
-int FrameMgrGetSize(FrameMgr);
-FmStatus FrameMgrSkipToken(FrameMgr, int);
-void FrameMgrReset(FrameMgr);
-Bool FrameMgrIsIterLoopEnd(FrameMgr, FmStatus*);
-
-#define FrameMgrPutToken(fm, obj) _FrameMgrPutToken((fm), &(obj), sizeof(obj))
-#define FrameMgrGetToken(fm, obj) _FrameMgrGetToken((fm), &(obj), sizeof(obj))
-
-#endif /* FRAMEMGR_H */
diff --git a/x11/IMdkit/IMConn.c b/x11/IMdkit/IMConn.c
deleted file mode 100644
index 6d36589..0000000
--- a/x11/IMdkit/IMConn.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/******************************************************************
-
- Copyright 1994, 1995 by Sun Microsystems, Inc.
- Copyright 1993, 1994 by Hewlett-Packard Company
-
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and
-that both that copyright notice and this permission notice appear
-in supporting documentation, and that the name of Sun Microsystems, Inc.
-and Hewlett-Packard not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior permission.
-Sun Microsystems, Inc. and Hewlett-Packard make no representations about
-the suitability of this software for any purpose. It is provided "as is"
-without express or implied warranty.
-
-SUN MICROSYSTEMS INC. AND HEWLETT-PACKARD COMPANY DISCLAIMS ALL
-WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-SUN MICROSYSTEMS, INC. AND HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY
-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
- Author: Hidetoshi Tajima(tajima@Eng.Sun.COM) Sun Microsystems, Inc.
-
- This version tidied and debugged by Steve Underwood May 1999
-
-******************************************************************/
-
-#include <X11/Xlib.h>
-#include <stdlib.h>
-#include <string.h>
-#include "IMdkit.h"
-#include <stdarg.h>
-
-#define Va_start(a,b) va_start(a,b)
-
-static void _IMCountVaList(va_list var, int *total_count)
-{
- char *attr;
-
- *total_count = 0;
-
- for (attr = va_arg (var, char*); attr; attr = va_arg (var, char*))
- {
- (void)va_arg (var, XIMArg *);
- ++(*total_count);
- }
- /*endfor*/
-}
-
-static void _IMVaToNestedList(va_list var, int max_count, XIMArg **args_return)
-{
- XIMArg *args;
- char *attr;
-
- if (max_count <= 0)
- {
- *args_return = (XIMArg *) NULL;
- return;
- }
- /*endif*/
-
- args = (XIMArg *) malloc ((unsigned) (max_count + 1)*sizeof (XIMArg));
- *args_return = args;
- if (!args)
- return;
- /*endif*/
-
- for (attr = va_arg (var, char*); attr; attr = va_arg (var, char *))
- {
- args->name = attr;
- args->value = va_arg (var, XPointer);
- args++;
- }
- /*endfor*/
- args->name = (char*)NULL;
-}
-
-static char *_FindModifiers (XIMArg *args)
-{
- char *modifiers;
-
- while (args->name)
- {
- if (strcmp (args->name, IMModifiers) == 0)
- {
- modifiers = args->value;
- return modifiers;
- }
- else
- {
- args++;
- }
- /*endif*/
- }
- /*endwhile*/
- return NULL;
-}
-
-XIMS _GetIMS (char *modifiers)
-{
- XIMS ims;
- extern IMMethodsRec Xi18n_im_methods;
-
- if ((ims = (XIMS) malloc (sizeof (XIMProtocolRec))) == (XIMS) NULL)
- return ((XIMS) NULL);
- /*endif*/
- memset ((void *) ims, 0, sizeof (XIMProtocolRec));
-
- if (modifiers == NULL
- ||
- modifiers[0] == '\0'
- ||
- strcmp (modifiers, "Xi18n") == 0)
- {
- ims->methods = &Xi18n_im_methods;
- return ims;
- }
- /*endif*/
- XFree (ims);
- return (XIMS) NULL;
-}
-
-XIMS IMOpenIM (Display *display, ...)
-{
- va_list var;
- int total_count;
- XIMArg *args;
- XIMS ims;
- char *modifiers;
- Status ret;
-
- Va_start (var, display);
- _IMCountVaList (var, &total_count);
- va_end (var);
-
- Va_start (var, display);
- _IMVaToNestedList (var, total_count, &args);
- va_end (var);
-
- modifiers = _FindModifiers (args);
-
- ims = _GetIMS (modifiers);
- if (ims == (XIMS) NULL)
- return (XIMS) NULL;
- /*endif*/
-
- ims->core.display = display;
-
- ims->protocol = (*ims->methods->setup) (display, args);
- XFree (args);
- if (ims->protocol == (void *) NULL)
- {
- XFree (ims);
- return (XIMS) NULL;
- }
- /*endif*/
- ret = (ims->methods->openIM) (ims);
- if (ret == False)
- {
- XFree (ims);
- return (XIMS) NULL;
- }
- /*endif*/
- return (XIMS) ims;
-}
-
-Status IMCloseIM (XIMS ims)
-{
- (ims->methods->closeIM) (ims);
- XFree (ims);
- return True;
-}
diff --git a/x11/IMdkit/IMMethod.c b/x11/IMdkit/IMMethod.c
deleted file mode 100644
index 5a33878..0000000
--- a/x11/IMdkit/IMMethod.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/******************************************************************
-
- Copyright 1994, 1995 by Sun Microsystems, Inc.
- Copyright 1993, 1994 by Hewlett-Packard Company
-
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and
-that both that copyright notice and this permission notice appear
-in supporting documentation, and that the name of Sun Microsystems, Inc.
-and Hewlett-Packard not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior permission.
-Sun Microsystems, Inc. and Hewlett-Packard make no representations about
-the suitability of this software for any purpose. It is provided "as is"
-without express or implied warranty.
-
-SUN MICROSYSTEMS INC. AND HEWLETT-PACKARD COMPANY DISCLAIMS ALL
-WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-SUN MICROSYSTEMS, INC. AND HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY
-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
- Author: Hidetoshi Tajima(tajima@Eng.Sun.COM) Sun Microsystems, Inc.
-
- This version tidied and debugged by Steve Underwood May 1999
-
-******************************************************************/
-
-#include <X11/Xlib.h>
-#include "IMdkit.h"
-
-/* Public Function */
-void IMForwardEvent (XIMS ims, XPointer call_data)
-{
- (ims->methods->forwardEvent) (ims, call_data);
-}
-
-void IMCommitString (XIMS ims, XPointer call_data)
-{
- (ims->methods->commitString) (ims, call_data);
-}
-
-int IMCallCallback (XIMS ims, XPointer call_data)
-{
- return (ims->methods->callCallback) (ims, call_data);
-}
-
-int IMPreeditStart (XIMS ims, XPointer call_data)
-{
- return (ims->methods->preeditStart) (ims, call_data);
-}
-
-int IMPreeditEnd (XIMS ims, XPointer call_data)
-{
- return (ims->methods->preeditEnd) (ims, call_data);
-}
-
-int IMSyncXlib(XIMS ims, XPointer call_data)
-{
- ims->sync = True;
- return (ims->methods->syncXlib) (ims, call_data);
-}
diff --git a/x11/IMdkit/IMValues.c b/x11/IMdkit/IMValues.c
deleted file mode 100644
index 687014a..0000000
--- a/x11/IMdkit/IMValues.c
+++ /dev/null
@@ -1,124 +0,0 @@
-/******************************************************************
-
- Copyright 1994, 1995 by Sun Microsystems, Inc.
- Copyright 1993, 1994 by Hewlett-Packard Company
-
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and
-that both that copyright notice and this permission notice appear
-in supporting documentation, and that the name of Sun Microsystems, Inc.
-and Hewlett-Packard not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior permission.
-Sun Microsystems, Inc. and Hewlett-Packard make no representations about
-the suitability of this software for any purpose. It is provided "as is"
-without express or implied warranty.
-
-SUN MICROSYSTEMS INC. AND HEWLETT-PACKARD COMPANY DISCLAIMS ALL
-WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-SUN MICROSYSTEMS, INC. AND HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY
-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
- Author: Hidetoshi Tajima(tajima@Eng.Sun.COM) Sun Microsystems, Inc.
-
- This version tidied and debugged by Steve Underwood May 1999
-
-******************************************************************/
-
-#include <stdlib.h>
-#include <X11/Xlib.h>
-#include "IMdkit.h"
-#include <stdarg.h>
-
-#define Va_start(a,b) va_start(a,b)
-
-static void _IMCountVaList (va_list var, int *total_count)
-{
- char *attr;
-
- *total_count = 0;
-
- for (attr = va_arg (var, char *); attr; attr = va_arg (var, char *))
- {
- (void)va_arg (var, XIMArg *);
- ++(*total_count);
- }
- /*endfor*/
-}
-
-static void _IMVaToNestedList (va_list var, int max_count, XIMArg **args_return)
-{
- XIMArg *args;
- char *attr;
-
- if (max_count <= 0)
- {
- *args_return = (XIMArg *) NULL;
- return;
- }
- /*endif*/
-
- args = (XIMArg *) malloc ((unsigned) (max_count + 1)*sizeof (XIMArg));
- *args_return = args;
- if (!args)
- return;
- /*endif*/
- for (attr = va_arg (var, char *); attr; attr = va_arg (var, char *))
- {
- args->name = attr;
- args->value = va_arg (var, XPointer);
- args++;
- }
- /*endfor*/
- args->name = (char *) NULL;
-}
-
-char *IMGetIMValues (XIMS ims, ...)
-{
- va_list var;
- int total_count;
- XIMArg *args;
- char *ret;
-
- Va_start (var, ims);
- _IMCountVaList (var, &total_count);
- va_end (var);
-
- Va_start (var, ims);
- _IMVaToNestedList (var, total_count, &args);
- va_end (var);
-
- ret = (*ims->methods->getIMValues) (ims, args);
-
- if (args)
- XFree ((char *) args);
- /*endif*/
- return ret;
-}
-
-char *IMSetIMValues (XIMS ims, ...)
-{
- va_list var;
- int total_count;
- XIMArg *args;
- char *ret;
-
- Va_start (var, ims);
- _IMCountVaList (var, &total_count);
- va_end (var);
-
- Va_start (var, ims);
- _IMVaToNestedList (var, total_count, &args);
- va_end (var);
-
- ret = (*ims->methods->setIMValues) (ims, args);
-
- if (args)
- XFree ((char *) args);
- /*endif*/
- return ret;
-}
diff --git a/x11/IMdkit/IMdkit.h b/x11/IMdkit/IMdkit.h
deleted file mode 100644
index 6f8d673..0000000
--- a/x11/IMdkit/IMdkit.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/******************************************************************
-
- Copyright 1994, 1995 by Sun Microsystems, Inc.
- Copyright 1993, 1994 by Hewlett-Packard Company
-
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and
-that both that copyright notice and this permission notice appear
-in supporting documentation, and that the name of Sun Microsystems, Inc.
-and Hewlett-Packard not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior permission.
-Sun Microsystems, Inc. and Hewlett-Packard make no representations about
-the suitability of this software for any purpose. It is provided "as is"
-without express or implied warranty.
-
-SUN MICROSYSTEMS INC. AND HEWLETT-PACKARD COMPANY DISCLAIMS ALL
-WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-SUN MICROSYSTEMS, INC. AND HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY
-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
- Author: Hidetoshi Tajima(tajima@Eng.Sun.COM) Sun Microsystems, Inc.
-
- This version tidied and debugged by Steve Underwood May 1999
-
-******************************************************************/
-
-#ifndef _IMdkit_h
-#define _IMdkit_h
-
-#include <X11/Xmd.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* IM Attributes Name */
-#define IMModifiers "modifiers"
-#define IMServerWindow "serverWindow"
-#define IMServerName "serverName"
-#define IMServerTransport "serverTransport"
-#define IMLocale "locale"
-#define IMInputStyles "inputStyles"
-#define IMProtocolHandler "protocolHandler"
-#define IMOnKeysList "onKeysList"
-#define IMOffKeysList "offKeysList"
-#define IMEncodingList "encodingList"
-#define IMFilterEventMask "filterEventMask"
-#define IMProtocolDepend "protocolDepend"
-
-/* Masks for IM Attributes Name */
-#define I18N_IMSERVER_WIN 0x0001 /* IMServerWindow */
-#define I18N_IM_NAME 0x0002 /* IMServerName */
-#define I18N_IM_LOCALE 0x0004 /* IMLocale */
-#define I18N_IM_ADDRESS 0x0008 /* IMServerTransport */
-#define I18N_INPUT_STYLES 0x0010 /* IMInputStyles */
-#define I18N_ON_KEYS 0x0020 /* IMOnKeysList */
-#define I18N_OFF_KEYS 0x0040 /* IMOffKeysList */
-#define I18N_IM_HANDLER 0x0080 /* IMProtocolHander */
-#define I18N_ENCODINGS 0x0100 /* IMEncodingList */
-#define I18N_FILTERMASK 0x0200 /* IMFilterEventMask */
-#define I18N_PROTO_DEPEND 0x0400 /* IMProtoDepend */
-
-typedef struct
-{
- char *name;
- XPointer value;
-} XIMArg;
-
-typedef struct
-{
- CARD32 keysym;
- CARD32 modifier;
- CARD32 modifier_mask;
-} XIMTriggerKey;
-
-typedef struct
-{
- unsigned short count_keys;
- XIMTriggerKey *keylist;
-} XIMTriggerKeys;
-
-typedef char *XIMEncoding;
-
-typedef struct
-{
- unsigned short count_encodings;
- XIMEncoding *supported_encodings;
-} XIMEncodings;
-
-typedef struct _XIMS *XIMS;
-
-typedef struct
-{
- void* (*setup) (Display *, XIMArg *);
- Status (*openIM) (XIMS);
- Status (*closeIM) (XIMS);
- char* (*setIMValues) (XIMS, XIMArg *);
- char* (*getIMValues) (XIMS, XIMArg *);
- Status (*forwardEvent) (XIMS, XPointer);
- Status (*commitString) (XIMS, XPointer);
- int (*callCallback) (XIMS, XPointer);
- int (*preeditStart) (XIMS, XPointer);
- int (*preeditEnd) (XIMS, XPointer);
- int (*syncXlib) (XIMS, XPointer);
-} IMMethodsRec, *IMMethods;
-
-typedef struct
-{
- Display *display;
- int screen;
-} IMCoreRec, *IMCore;
-
-typedef struct _XIMS
-{
- IMMethods methods;
- IMCoreRec core;
- Bool sync;
- void *protocol;
-} XIMProtocolRec;
-
-/*
- * X function declarations.
- */
-extern XIMS IMOpenIM (Display *, ...);
-extern Status IMCloseIM (XIMS);
-extern char *IMSetIMValues (XIMS, ...);
-extern char *IMGetIMValues (XIMS, ...);
-void IMForwardEvent (XIMS, XPointer);
-void IMCommitString (XIMS, XPointer);
-int IMCallCallback (XIMS, XPointer);
-int IMPreeditStart (XIMS, XPointer);
-int IMPreeditEnd (XIMS, XPointer);
-int IMSyncXlib (XIMS, XPointer);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* IMdkit_h */
diff --git a/x11/IMdkit/Makefile.am b/x11/IMdkit/Makefile.am
deleted file mode 100644
index b567d9d..0000000
--- a/x11/IMdkit/Makefile.am
+++ /dev/null
@@ -1,27 +0,0 @@
-noinst_LTLIBRARIES = libIMdkit.la
-
-libIMdkit_la_SOURCES = \
- FrameMgr.c \
- i18nAttr.c \
- i18nClbk.c \
- i18nIc.c \
- i18nIMProto.c \
- i18nMethod.c \
- i18nPtHdr.c \
- i18nUtil.c \
- i18nX.c \
- IMConn.c \
- IMMethod.c \
- IMValues.c \
- $(NULL)
-
-noinst_HEADERS = \
- FrameMgr.h \
- IMdkit.h \
- Xi18n.h \
- Xi18nX.h \
- XimFunc.h \
- XimProto.h \
- Xtrans.h \
- $(NULL)
-
diff --git a/x11/IMdkit/Xi18n.h b/x11/IMdkit/Xi18n.h
deleted file mode 100644
index aaf7768..0000000
--- a/x11/IMdkit/Xi18n.h
+++ /dev/null
@@ -1,505 +0,0 @@
-/******************************************************************
-
- Copyright 1994, 1995 by Sun Microsystems, Inc.
- Copyright 1993, 1994 by Hewlett-Packard Company
-
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and
-that both that copyright notice and this permission notice appear
-in supporting documentation, and that the name of Sun Microsystems, Inc.
-and Hewlett-Packard not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior permission.
-Sun Microsystems, Inc. and Hewlett-Packard make no representations about
-the suitability of this software for any purpose. It is provided "as is"
-without express or implied warranty.
-
-SUN MICROSYSTEMS INC. AND HEWLETT-PACKARD COMPANY DISCLAIMS ALL
-WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-SUN MICROSYSTEMS, INC. AND HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY
-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
- Author: Hidetoshi Tajima(tajima@Eng.Sun.COM) Sun Microsystems, Inc.
-
- This version tidied and debugged by Steve Underwood May 1999
-
-******************************************************************/
-
-#ifndef _Xi18n_h
-#define _Xi18n_h
-#include <X11/Xlib.h>
-#include <X11/Xfuncs.h>
-#include <X11/Xos.h>
-#include "XimProto.h"
-
-/*
- * Minor Protocol Number for Extension Protocol
- */
-#define XIM_EXTENSION 128
-#define XIM_EXT_SET_EVENT_MASK (0x30)
-#define XIM_EXT_FORWARD_KEYEVENT (0x32)
-#define XIM_EXT_MOVE (0x33)
-#define COMMON_EXTENSIONS_NUM 3
-
-#include <stdlib.h>
-#include "IMdkit.h"
-
-/* XI18N Valid Attribute Name Definition */
-#define ExtForwardKeyEvent "extForwardKeyEvent"
-#define ExtMove "extMove"
-#define ExtSetEventMask "extSetEventMask"
-
-/*
- * Padding macro
- */
-#define IMPAD(length) ((4 - ((length)%4))%4)
-
-/*
- * Target Atom for Transport Connection
- */
-#define LOCALES "LOCALES"
-#define TRANSPORT "TRANSPORT"
-
-#define I18N_OPEN 0
-#define I18N_SET 1
-#define I18N_GET 2
-
-typedef struct
-{
- char *transportname;
- int namelen;
- Bool (*checkAddr) ();
-} TransportSW;
-
-typedef struct _XIMPending
-{
- unsigned char *p;
- struct _XIMPending *next;
-} XIMPending;
-
-typedef struct _XimProtoHdr
-{
- CARD8 major_opcode;
- CARD8 minor_opcode;
- CARD16 length;
-} XimProtoHdr;
-
-typedef struct
-{
- CARD16 attribute_id;
- CARD16 type;
- CARD16 length;
- char *name;
-} XIMAttr;
-
-typedef struct
-{
- CARD16 attribute_id;
- CARD16 type;
- CARD16 length;
- char *name;
-} XICAttr;
-
-typedef struct
-{
- int attribute_id;
- CARD16 name_length;
- char *name;
- int value_length;
- void *value;
- int type;
-} XIMAttribute;
-
-typedef struct
-{
- int attribute_id;
- CARD16 name_length;
- char *name;
- int value_length;
- void *value;
- int type;
-} XICAttribute;
-
-typedef struct
-{
- int length;
- char *name;
-} XIMStr;
-
-typedef struct
-{
- CARD16 major_opcode;
- CARD16 minor_opcode;
- CARD16 length;
- char *name;
-} XIMExt;
-
-typedef struct _Xi18nClient
-{
- int connect_id;
- CARD8 byte_order;
- /*
- '?': initial value
- 'B': for Big-Endian
- 'l': for little-endian
- */
- int sync;
- XIMPending *pending;
- void *trans_rec; /* contains transport specific data */
- struct _Xi18nClient *next;
-} Xi18nClient;
-
-typedef struct _Xi18nCore *Xi18n;
-
-/*
- * Callback Struct for XIM Protocol
- */
-typedef struct
-{
- int major_code;
- int minor_code;
- CARD16 connect_id;
-} IMAnyStruct;
-
-typedef struct
-{
- int major_code;
- int minor_code;
- CARD16 connect_id;
- CARD8 byte_order;
- CARD16 major_version;
- CARD16 minor_version;
-} IMConnectStruct;
-
-typedef struct
-{
- int major_code;
- int minor_code;
- CARD16 connect_id;
-} IMDisConnectStruct;
-
-typedef struct
-{
- int major_code;
- int minor_code;
- CARD16 connect_id;
- XIMStr lang;
-} IMOpenStruct;
-
-typedef struct
-{
- int major_code;
- int minor_code;
- CARD16 connect_id;
-} IMCloseStruct;
-
-typedef struct
-{
- int major_code;
- int minor_code;
- CARD16 connect_id;
- CARD16 number;
- XIMStr *extension;
-} IMQueryExtensionStruct;
-
-typedef struct
-{
- int major_code;
- int minor_code;
- CARD16 connect_id;
- CARD16 number;
- char **im_attr_list;
-} IMGetIMValuesStruct;
-
-typedef struct
-{
- int major_code;
- int minor_code;
- CARD16 connect_id;
- CARD16 icid;
- CARD16 preedit_attr_num;
- CARD16 status_attr_num;
- CARD16 ic_attr_num;
- XICAttribute *preedit_attr;
- XICAttribute *status_attr;
- XICAttribute *ic_attr;
-} IMChangeICStruct;
-
-typedef struct
-{
- int major_code;
- int minor_code;
- CARD16 connect_id;
- CARD16 icid;
-} IMDestroyICStruct;
-
-typedef struct
-{
- int major_code;
- int minor_code;
- CARD16 connect_id;
- CARD16 icid;
- CARD16 length;
- char *commit_string;
-} IMResetICStruct;
-
-typedef struct
-{
- int major_code;
- int minor_code;
- CARD16 connect_id;
- CARD16 icid;
-} IMChangeFocusStruct;
-
-typedef struct
-{
- int major_code;
- int minor_code;
- CARD16 connect_id;
- CARD16 icid;
- BITMASK16 sync_bit;
- CARD16 serial_number;
- XEvent event;
-} IMForwardEventStruct;
-
-typedef struct
-{
- int major_code;
- int minor_code;
- CARD16 connect_id;
- CARD16 icid;
- CARD16 flag;
- KeySym keysym;
- char *commit_string;
-} IMCommitStruct;
-
-typedef struct
-{
- int major_code;
- int minor_code;
- CARD16 connect_id;
- CARD16 icid;
- CARD32 flag;
- CARD32 key_index;
- CARD32 event_mask;
-} IMTriggerNotifyStruct;
-
-typedef struct
-{
- int major_code;
- int minor_code;
- CARD16 connect_id;
- CARD16 encoding_number;
- XIMStr *encoding; /* name information */
- CARD16 encoding_info_number;
- XIMStr *encodinginfo; /* detailed information */
- CARD16 category; /* #0 for name, #1 for detail */
- INT16 enc_index; /* index of the encoding determined */
-} IMEncodingNegotiationStruct;
-
-typedef struct
-{
- int major_code;
- int minor_code;
- CARD16 connect_id;
- CARD16 icid;
- CARD32 flag;
- CARD32 forward_event_mask;
- CARD32 sync_event_mask;
-} IMSetEventMaskStruct;
-
-typedef struct
-{
- int major_code;
- int minor_code;
- CARD16 connect_id;
- CARD16 icid;
- CARD32 filter_event_mask;
- CARD32 intercept_event_mask;
- CARD32 select_event_mask;
- CARD32 forward_event_mask;
- CARD32 sync_event_mask;
-} IMExtSetEventMaskStruct;
-
-typedef struct
-{
- int major_code;
- int minor_code;
- CARD16 connect_id;
- CARD16 icid;
- CARD16 x;
- CARD16 y;
-} IMMoveStruct;
-
-typedef struct
-{
- int major_code;
- int minor_code;
- CARD16 connect_id;
- CARD16 icid;
- BITMASK16 flag;
- CARD16 error_code;
- CARD16 str_length;
- CARD16 error_type;
- char *error_detail;
-} IMErrorStruct;
-
-typedef struct
-{
- int major_code;
- int minor_code;
- CARD16 connect_id;
- CARD16 icid;
-} IMPreeditStateStruct;
-
-/* Callbacks */
-typedef struct
-{
- int major_code;
- int minor_code;
- CARD16 connect_id;
- CARD16 icid;
-} IMGeometryCBStruct;
-
-typedef struct
-{
- int major_code;
- int minor_code;
- CARD16 connect_id;
- CARD16 icid;
- union
- {
- int return_value; /* PreeditStart */
- XIMPreeditDrawCallbackStruct draw; /* PreeditDraw */
- XIMPreeditCaretCallbackStruct caret; /* PreeditCaret */
- } todo;
-} IMPreeditCBStruct;
-
-typedef struct
-{
- int major_code;
- int minor_code;
- CARD16 connect_id;
- CARD16 icid;
- union
- {
- XIMStatusDrawCallbackStruct draw; /* StatusDraw */
- } todo;
-} IMStatusCBStruct;
-
-typedef struct
-{
- int major_code;
- int minor_code;
- CARD16 connect_id;
- CARD16 icid;
- XIMStringConversionCallbackStruct strconv;
-} IMStrConvCBStruct;
-
-typedef struct
-{
- int major_code;
- int minor_code;
- CARD16 connect_id;
- CARD16 icid;
-} IMSyncXlibStruct;
-
-typedef union _IMProtocol
-{
- int major_code;
- IMAnyStruct any;
- IMConnectStruct imconnect;
- IMDisConnectStruct imdisconnect;
- IMOpenStruct imopen;
- IMCloseStruct imclose;
- IMQueryExtensionStruct queryext;
- IMGetIMValuesStruct getim;
- IMEncodingNegotiationStruct encodingnego;
- IMExtSetEventMaskStruct extsetevent;
- IMMoveStruct extmove;
- IMSetEventMaskStruct setevent;
- IMChangeICStruct changeic;
- IMDestroyICStruct destroyic;
- IMResetICStruct resetic;
- IMChangeFocusStruct changefocus;
- IMCommitStruct commitstring;
- IMForwardEventStruct forwardevent;
- IMTriggerNotifyStruct triggernotify;
- IMPreeditStateStruct preedit_state;
- IMErrorStruct imerror;
- IMGeometryCBStruct geometry_callback;
- IMPreeditCBStruct preedit_callback;
- IMStatusCBStruct status_callback;
- IMStrConvCBStruct strconv_callback;
- IMSyncXlibStruct sync_xlib;
- long pad[32];
-} IMProtocol;
-
-typedef int (*IMProtoHandler) (XIMS, IMProtocol*);
-
-#define DEFAULT_FILTER_MASK (KeyPressMask)
-
-/* Xi18nAddressRec structure */
-typedef struct _Xi18nAddressRec
-{
- Display *dpy;
- CARD8 im_byteOrder; /* byte order 'B' or 'l' */
- /* IM Values */
- long imvalue_mask;
- Window im_window; /* IMServerWindow */
- char *im_name; /* IMServerName */
- char *im_locale; /* IMLocale */
- char *im_addr; /* IMServerTransport */
- XIMStyles input_styles; /* IMInputStyles */
- XIMTriggerKeys on_keys; /* IMOnKeysList */
- XIMTriggerKeys off_keys; /* IMOffKeysList */
- XIMEncodings encoding_list; /* IMEncodingList */
- IMProtoHandler improto; /* IMProtocolHander */
- long filterevent_mask; /* IMFilterEventMask */
- /* XIM_SERVERS target Atoms */
- Atom selection;
- Atom Localename;
- Atom Transportname;
- /* XIM/XIC Attr */
- int im_attr_num;
- XIMAttr *xim_attr;
- int ic_attr_num;
- XICAttr *xic_attr;
- CARD16 preeditAttr_id;
- CARD16 statusAttr_id;
- CARD16 separatorAttr_id;
- /* XIMExtension List */
- int ext_num;
- XIMExt extension[COMMON_EXTENSIONS_NUM];
- /* transport specific connection address */
- void *connect_addr;
- /* actual data is defined:
- XSpecRec in Xi18nX.h for X-based connection.
- TransSpecRec in Xi18nTr.h for Socket-based connection.
- */
- /* clients table */
- Xi18nClient *clients;
- Xi18nClient *free_clients;
-} Xi18nAddressRec;
-
-typedef struct _Xi18nMethodsRec
-{
- Bool (*begin) (XIMS);
- Bool (*end) (XIMS);
- Bool (*send) (XIMS, CARD16, unsigned char*, long);
- Bool (*wait) (XIMS, CARD16, CARD8, CARD8);
- Bool (*disconnect) (XIMS, CARD16);
-} Xi18nMethodsRec;
-
-typedef struct _Xi18nCore
-{
- Xi18nAddressRec address;
- Xi18nMethodsRec methods;
-} Xi18nCore;
-
-#endif
-
diff --git a/x11/IMdkit/Xi18nX.h b/x11/IMdkit/Xi18nX.h
deleted file mode 100644
index ff91b1a..0000000
--- a/x11/IMdkit/Xi18nX.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/******************************************************************
-
- Copyright 1994, 1995 by Sun Microsystems, Inc.
- Copyright 1993, 1994 by Hewlett-Packard Company
-
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and
-that both that copyright notice and this permission notice appear
-in supporting documentation, and that the name of Sun Microsystems, Inc.
-and Hewlett-Packard not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior permission.
-Sun Microsystems, Inc. and Hewlett-Packard make no representations about
-the suitability of this software for any purpose. It is provided "as is"
-without express or implied warranty.
-
-SUN MICROSYSTEMS INC. AND HEWLETT-PACKARD COMPANY DISCLAIMS ALL
-WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-SUN MICROSYSTEMS, INC. AND HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY
-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
- Author: Hidetoshi Tajima(tajima@Eng.Sun.COM) Sun Microsystems, Inc.
-
- This version tidied and debugged by Steve Underwood May 1999
-
-******************************************************************/
-
-#ifndef _Xi18nTrX_h
-#define _Xi18nTrX_h
-
-#define _XIM_PROTOCOL "_XIM_PROTOCOL"
-#define _XIM_XCONNECT "_XIM_XCONNECT"
-
-#define XCM_DATA_LIMIT 20
-
-typedef struct _XClient
-{
- Window client_win; /* client window */
- Window accept_win; /* accept window */
-} XClient;
-
-typedef struct
-{
- Atom xim_request;
- Atom connect_request;
-} XSpecRec;
-
-#endif
diff --git a/x11/IMdkit/XimFunc.h b/x11/IMdkit/XimFunc.h
deleted file mode 100644
index a9f4a04..0000000
--- a/x11/IMdkit/XimFunc.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/******************************************************************
-
- Copyright 1994, 1995 by Sun Microsystems, Inc.
- Copyright 1993, 1994 by Hewlett-Packard Company
-
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and
-that both that copyright notice and this permission notice appear
-in supporting documentation, and that the name of Sun Microsystems, Inc.
-and Hewlett-Packard not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior permission.
-Sun Microsystems, Inc. and Hewlett-Packard make no representations about
-the suitability of this software for any purpose. It is provided "as is"
-without express or implied warranty.
-
-SUN MICROSYSTEMS INC. AND HEWLETT-PACKARD COMPANY DISCLAIMS ALL
-WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-SUN MICROSYSTEMS, INC. AND HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY
-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
- Author: Hidetoshi Tajima(tajima@Eng.Sun.COM) Sun Microsystems, Inc.
-
- This version tidied and debugged by Steve Underwood May 1999
-
-******************************************************************/
-
-#ifndef _XimFunc_h
-#define _XimFunc_h
-
-/* i18nAttr.c */
-void _Xi18nInitAttrList (Xi18n i18n_core);
-void _Xi18nInitExtension(Xi18n i18n_core);
-
-/* i18nClbk.c */
-int _Xi18nGeometryCallback (XIMS ims, IMProtocol *call_data);
-int _Xi18nPreeditStartCallback (XIMS ims, IMProtocol *call_data);
-int _Xi18nPreeditDrawCallback (XIMS ims, IMProtocol *call_data);
-int _Xi18nPreeditCaretCallback (XIMS ims, IMProtocol *call_data);
-int _Xi18nPreeditDoneCallback (XIMS ims, IMProtocol *call_data);
-int _Xi18nStatusStartCallback (XIMS ims, IMProtocol *call_data);
-int _Xi18nStatusDrawCallback (XIMS ims, IMProtocol *call_data);
-int _Xi18nStatusDoneCallback (XIMS ims, IMProtocol *call_data);
-int _Xi18nStringConversionCallback (XIMS ims, IMProtocol *call_data);
-
-/* i18nIc.c */
-void _Xi18nChangeIC (XIMS ims, IMProtocol *call_data, unsigned char *p,
- int create_flag);
-void _Xi18nGetIC (XIMS ims, IMProtocol *call_data, unsigned char *p);
-
-/* i18nUtil.c */
-int _Xi18nNeedSwap (Xi18n i18n_core, CARD16 connect_id);
-Xi18nClient *_Xi18nNewClient(Xi18n i18n_core);
-Xi18nClient *_Xi18nFindClient (Xi18n i18n_core, CARD16 connect_id);
-void _Xi18nDeleteClient (Xi18n i18n_core, CARD16 connect_id);
-void _Xi18nSendMessage (XIMS ims, CARD16 connect_id, CARD8 major_opcode,
- CARD8 minor_opcode, unsigned char *data, long length);
-void _Xi18nSendTriggerKey (XIMS ims, CARD16 connect_id);
-void _Xi18nSetEventMask (XIMS ims, CARD16 connect_id, CARD16 im_id,
- CARD16 ic_id, CARD32 forward_mask, CARD32 sync_mask);
-
-/* Xlib internal */
-void _XRegisterFilterByType(Display*, Window, int, int,
- Bool (*filter)(Display*, Window, XEvent*, XPointer), XPointer);
-void _XUnregisterFilter(Display*, Window,
- Bool (*filter)(Display*, Window, XEvent*, XPointer), XPointer);
-
-#endif
diff --git a/x11/IMdkit/XimProto.h b/x11/IMdkit/XimProto.h
deleted file mode 100644
index e3ed168..0000000
--- a/x11/IMdkit/XimProto.h
+++ /dev/null
@@ -1,230 +0,0 @@
-/* $XConsortium: XimProto.h,v 1.2 94/01/20 18:02:24 rws Exp $ */
-/******************************************************************
-
- Copyright 1992, 1993, 1994 by FUJITSU LIMITED
-
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and
-that both that copyright notice and this permission notice appear
-in supporting documentation, and that the name of FUJITSU LIMITED
-not be used in advertising or publicity pertaining to distribution
-of the software without specific, written prior permission.
-FUJITSU LIMITED makes no representations about the suitability of
-this software for any purpose.
-It is provided "as is" without express or implied warranty.
-
-FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
-EVENT SHALL FUJITSU LIMITED BE LIABLE FOR ANY SPECIAL, INDIRECT OR
-CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
-USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
-OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-PERFORMANCE OF THIS SOFTWARE.
-
- Author: Takashi Fujiwara FUJITSU LIMITED
- fujiwara@a80.tech.yk.fujitsu.co.jp
-
- This version tidied and debugged by Steve Underwood May 1999
-
-******************************************************************/
-
-#ifndef _XIMPROTO_H
-#define _XIMPROTO_H
-
-/*
- * Default Preconnection selection target
- */
-#define XIM_SERVERS "XIM_SERVERS"
-#define XIM_LOCALES "LOCALES"
-#define XIM_TRANSPORT "TRANSPORT"
-
-/*
- * categories in XIM_SERVERS
- */
-#define XIM_SERVER_CATEGORY "@server="
-#define XIM_LOCAL_CATEGORY "@locale="
-#define XIM_TRANSPORT_CATEGORY "@transport="
-
-/*
- * Xim implementation revision
- */
-#define PROTOCOLMAJORVERSION 0
-#define PROTOCOLMINORVERSION 0
-
-/*
- * Major Protocol number
- */
-#define XIM_CONNECT 1
-#define XIM_CONNECT_REPLY 2
-#define XIM_DISCONNECT 3
-#define XIM_DISCONNECT_REPLY 4
-
-#define XIM_AUTH_REQUIRED 10
-#define XIM_AUTH_REPLY 11
-#define XIM_AUTH_NEXT 12
-#define XIM_AUTH_SETUP 13
-#define XIM_AUTH_NG 14
-
-#define XIM_ERROR 20
-
-#define XIM_OPEN 30
-#define XIM_OPEN_REPLY 31
-#define XIM_CLOSE 32
-#define XIM_CLOSE_REPLY 33
-#define XIM_REGISTER_TRIGGERKEYS 34
-#define XIM_TRIGGER_NOTIFY 35
-#define XIM_TRIGGER_NOTIFY_REPLY 36
-#define XIM_SET_EVENT_MASK 37
-#define XIM_ENCODING_NEGOTIATION 38
-#define XIM_ENCODING_NEGOTIATION_REPLY 39
-#define XIM_QUERY_EXTENSION 40
-#define XIM_QUERY_EXTENSION_REPLY 41
-#define XIM_SET_IM_VALUES 42
-#define XIM_SET_IM_VALUES_REPLY 43
-#define XIM_GET_IM_VALUES 44
-#define XIM_GET_IM_VALUES_REPLY 45
-
-#define XIM_CREATE_IC 50
-#define XIM_CREATE_IC_REPLY 51
-#define XIM_DESTROY_IC 52
-#define XIM_DESTROY_IC_REPLY 53
-#define XIM_SET_IC_VALUES 54
-#define XIM_SET_IC_VALUES_REPLY 55
-#define XIM_GET_IC_VALUES 56
-#define XIM_GET_IC_VALUES_REPLY 57
-#define XIM_SET_IC_FOCUS 58
-#define XIM_UNSET_IC_FOCUS 59
-#define XIM_FORWARD_EVENT 60
-#define XIM_SYNC 61
-#define XIM_SYNC_REPLY 62
-#define XIM_COMMIT 63
-#define XIM_RESET_IC 64
-#define XIM_RESET_IC_REPLY 65
-
-#define XIM_GEOMETRY 70
-#define XIM_STR_CONVERSION 71
-#define XIM_STR_CONVERSION_REPLY 72
-#define XIM_PREEDIT_START 73
-#define XIM_PREEDIT_START_REPLY 74
-#define XIM_PREEDIT_DRAW 75
-#define XIM_PREEDIT_CARET 76
-#define XIM_PREEDIT_CARET_REPLY 77
-#define XIM_PREEDIT_DONE 78
-#define XIM_STATUS_START 79
-#define XIM_STATUS_DRAW 80
-#define XIM_STATUS_DONE 81
-
-/*
- * values for the flag of XIM_ERROR
- */
-#define XIM_IMID_VALID 0x0001
-#define XIM_ICID_VALID 0x0002
-
-/*
- * XIM Error Code
- */
-#define XIM_BadAlloc 1
-#define XIM_BadStyle 2
-#define XIM_BadClientWindow 3
-#define XIM_BadFocusWindow 4
-#define XIM_BadArea 5
-#define XIM_BadSpotLocation 6
-#define XIM_BadColormap 7
-#define XIM_BadAtom 8
-#define XIM_BadPixel 9
-#define XIM_BadPixmap 10
-#define XIM_BadName 11
-#define XIM_BadCursor 12
-#define XIM_BadProtocol 13
-#define XIM_BadForeground 14
-#define XIM_BadBackground 15
-#define XIM_LocaleNotSupported 16
-#define XIM_BadSomething 999
-
-/*
- * byte order
- */
-#define BIGENDIAN (CARD8) 0x42 /* MSB first */
-#define LITTLEENDIAN (CARD8) 0x6c /* LSB first */
-
-/*
- * values for the type of XIMATTR & XICATTR
- */
-#define XimType_SeparatorOfNestedList 0
-#define XimType_CARD8 1
-#define XimType_CARD16 2
-#define XimType_CARD32 3
-#define XimType_STRING8 4
-#define XimType_Window 5
-#define XimType_XIMStyles 10
-#define XimType_XRectangle 11
-#define XimType_XPoint 12
-#define XimType_XFontSet 13
-#define XimType_XIMOptions 14
-#define XimType_XIMHotKeyTriggers 15
-#define XimType_XIMHotKeyState 16
-#define XimType_XIMStringConversion 17
-#define XimType_XIMValuesList 18
-#define XimType_NEST 0x7FFF
-
-/*
- * values for the category of XIM_ENCODING_NEGOTIATON_REPLY
- */
-#define XIM_Encoding_NameCategory 0
-#define XIM_Encoding_DetailCategory 1
-
-/*
- * value for the index of XIM_ENCODING_NEGOTIATON_REPLY
- */
-#define XIM_Default_Encoding_IDX -1
-
-/*
- * value for the flag of XIM_FORWARD_EVENT, XIM_COMMIT
- */
-#define XimSYNCHRONUS 0x0001
-#define XimLookupChars 0x0002
-#define XimLookupKeySym 0x0004
-#define XimLookupBoth 0x0006
-
-/*
- * request packet header size
- */
-#define XIM_HEADER_SIZE \
- sizeof(CARD8) /* sizeof mejor-opcode */ \
- + sizeof(CARD8) /* sizeof minor-opcode */ \
- + sizeof(INT16) /* sizeof length */
-
-/*
- * Client Message data size
- */
-#define XIM_CM_DATA_SIZE 20
-
-/*
- * XIM data structure
- */
-typedef CARD16 BITMASK16;
-typedef CARD32 BITMASK32;
-typedef CARD32 EVENTMASK;
-
-typedef CARD16 XIMID; /* Input Method ID */
-typedef CARD16 XICID; /* Input Context ID */
-
-/*
- * Padding macro
- */
-#define XIM_PAD(length) ((4 - ((length) % 4)) % 4)
-
-#define XIM_SET_PAD(ptr, length) \
- { \
- register int Counter = XIM_PAD((int)length); \
- if (Counter) { \
- register char *Ptr = (char *)(ptr) + (length); \
- length += Counter; \
- for (; Counter; --Counter, ++Ptr) \
- *Ptr = '\0'; \
- } \
- }
-
-#endif
-
diff --git a/x11/IMdkit/Xtrans.h b/x11/IMdkit/Xtrans.h
deleted file mode 100644
index cae691c..0000000
--- a/x11/IMdkit/Xtrans.h
+++ /dev/null
@@ -1,470 +0,0 @@
-/* $XConsortium: Xtrans.h,v 1.24 94/05/02 10:45:32 mor Exp $ */
-/*
-
-Copyright (c) 1993, 1994 X Consortium
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of the X Consortium shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from the X Consortium.
-
-*/
-
-/* Copyright (c) 1993, 1994 NCR Corporation - Dayton, Ohio, USA
- *
- * All Rights Reserved
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted, provided
- * that the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name NCR not be used in advertising
- * or publicity pertaining to distribution of the software without specific,
- * written prior permission. NCR makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL NCR BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef _XTRANS_H_
-#define _XTRANS_H_
-
-#include <X11/Xfuncproto.h>
-#include <X11/Xos.h>
-
-
-/*
- * Set the functions names according to where this code is being compiled.
- */
-
-#ifdef X11_t
-#if (__STDC__ && !defined(UNIXCPP)) || defined(ANSICPP)
-#define TRANS(func) _X11Trans##func
-#else
-#define TRANS(func) _X11Trans/**/func
-#endif
-#endif /* X11_t */
-
-#ifdef XSERV_t
-#if (__STDC__ && !defined(UNIXCPP)) || defined(ANSICPP)
-#define TRANS(func) _XSERVTrans##func
-#else
-#define TRANS(func) _XSERVTrans/**/func
-#endif
-#define X11_t
-#endif /* X11_t */
-
-#ifdef XIM_t
-#if (__STDC__ && !defined(UNIXCPP)) || defined(ANSICPP)
-#define TRANS(func) _XimdXTrans##func
-#else
-#define TRANS(func) _XimdXTrans/**/func
-#endif
-#endif /* XIM_t */
-
-#ifdef FS_t
-#if (__STDC__ && !defined(UNIXCPP)) || defined(ANSICPP)
-#define TRANS(func) _FSTrans##func
-#else
-#define TRANS(func) _FSTrans/**/func
-#endif
-#endif /* FS_t */
-
-#ifdef FONT_t
-#if (__STDC__ && !defined(UNIXCPP)) || defined(ANSICPP)
-#define TRANS(func) _FontTrans##func
-#else
-#define TRANS(func) _FontTrans/**/func
-#endif
-#endif /* FONT_t */
-
-#ifdef ICE_t
-#if (__STDC__ && !defined(UNIXCPP)) || defined(ANSICPP)
-#define TRANS(func) _IceTrans##func
-#else
-#define TRANS(func) _IceTrans/**/func
-#endif
-#endif /* ICE_t */
-
-#ifdef TEST_t
-#if (__STDC__ && !defined(UNIXCPP)) || defined(ANSICPP)
-#define TRANS(func) _TESTTrans##func
-#else
-#define TRANS(func) _TESTTrans/**/func
-#endif
-#endif /* TEST_t */
-
-#if !defined(TRANS)
-#if (__STDC__ && !defined(UNIXCPP)) || defined(ANSICPP)
-#define TRANS(func) _XTrans##func
-#else
-#define TRANS(func) _XTrans/**/func
-#endif
-#endif /* !TRANS */
-
-
-/*
- * Create a single address structure that can be used wherever
- * an address structure is needed. struct sockaddr is not big enough
- * to hold a sockadd_un, so we create this definition to have a single
- * structure that is big enough for all the structures we might need.
- *
- * This structure needs to be independent of the socket/TLI interface used.
- */
-
-#define XTRANS_MAX_ADDR_LEN 128 /* large enough to hold sun_path */
-
-typedef struct {
- unsigned char addr[XTRANS_MAX_ADDR_LEN];
-} Xtransaddr;
-
-
-#ifdef LONG64
-typedef int BytesReadable_t;
-#else
-typedef long BytesReadable_t;
-#endif
-
-
-#if defined(WIN32) || (defined(USG) && !defined(CRAY) && !defined(umips) && !defined(MOTOROLA) && !defined(uniosu) && !defined(__sxg__))
-
-/*
- * TRANS(Readv) and TRANS(Writev) use struct iovec, normally found
- * in Berkeley systems in <sys/uio.h>. See the readv(2) and writev(2)
- * manual pages for details.
- */
-
-struct iovec {
- caddr_t iov_base;
- int iov_len;
-};
-
-#else
-#include <sys/uio.h>
-#endif
-
-typedef struct _XtransConnInfo *XtransConnInfo;
-
-
-/*
- * Transport Option definitions
- */
-
-#define TRANS_NONBLOCKING 1
-#define TRANS_CLOSEONEXEC 2
-
-
-/*
- * Return values of Connect (0 is success)
- */
-
-#define TRANS_CONNECT_FAILED -1
-#define TRANS_TRY_CONNECT_AGAIN -2
-
-
-/*
- * Return values of Accept (0 is success)
- */
-
-#define TRANS_ACCEPT_BAD_MALLOC -1
-#define TRANS_ACCEPT_FAILED -2
-#define TRANS_ACCEPT_MISC_ERROR -3
-
-
-/*
- * ResetListener return values
- */
-
-#define TRANS_RESET_NOOP 1
-#define TRANS_RESET_NEW_FD 2
-#define TRANS_RESET_FAILURE 3
-
-
-/*
- * Function prototypes for the exposed interface
- */
-
-#ifdef TRANS_CLIENT
-
-XtransConnInfo TRANS(OpenCOTSClient)(
-#if NeedFunctionPrototypes
- char * /* address */
-#endif
-);
-
-#endif /* TRANS_CLIENT */
-
-#ifdef TRANS_SERVER
-
-XtransConnInfo TRANS(OpenCOTSServer)(
-#if NeedFunctionPrototypes
- char * /* address */
-#endif
-);
-
-#endif /* TRANS_SERVER */
-
-#ifdef TRANS_CLIENT
-
-XtransConnInfo TRANS(OpenCLTSClient)(
-#if NeedFunctionPrototypes
- char * /* address */
-#endif
-);
-
-#endif /* TRANS_CLIENT */
-
-#ifdef TRANS_SERVER
-
-XtransConnInfo TRANS(OpenCLTSServer)(
-#if NeedFunctionPrototypes
- char * /* address */
-#endif
-);
-
-#endif /* TRANS_SERVER */
-
-#ifdef TRANS_REOPEN
-
-XtransConnInfo TRANS(ReopenCOTSServer)(
-#if NeedFunctionPrototypes
- int, /* trans_id */
- int, /* fd */
- char * /* port */
-#endif
-);
-
-XtransConnInfo TRANS(ReopenCLTSServer)(
-#if NeedFunctionPrototypes
- int, /* trans_id */
- int, /* fd */
- char * /* port */
-#endif
-);
-
-int TRANS(GetReopenInfo)(
-#if NeedFunctionPrototypes
- XtransConnInfo, /* ciptr */
- int *, /* trans_id */
- int *, /* fd */
- char ** /* port */
-#endif
-);
-
-#endif /* TRANS_REOPEN */
-
-
-int TRANS(SetOption)(
-#if NeedFunctionPrototypes
- XtransConnInfo, /* ciptr */
- int, /* option */
- int /* arg */
-#endif
-);
-
-#ifdef TRANS_SERVER
-
-int TRANS(CreateListener)(
-#if NeedFunctionPrototypes
- XtransConnInfo, /* ciptr */
- char * /* port */
-#endif
-);
-
-int TRANS(ResetListener)(
-#if NeedFunctionPrototypes
- XtransConnInfo /* ciptr */
-#endif
-);
-
-XtransConnInfo TRANS(Accept)(
-#if NeedFunctionPrototypes
- XtransConnInfo, /* ciptr */
- int * /* status */
-#endif
-);
-
-#endif /* TRANS_SERVER */
-
-#ifdef TRANS_CLIENT
-
-int TRANS(Connect)(
-#if NeedFunctionPrototypes
- XtransConnInfo, /* ciptr */
- char * /* address */
-#endif
-);
-
-#endif /* TRANS_CLIENT */
-
-int TRANS(BytesReadable)(
-#if NeedFunctionPrototypes
- XtransConnInfo, /* ciptr */
- BytesReadable_t * /* pend */
-#endif
-);
-
-int TRANS(Read)(
-#if NeedFunctionPrototypes
- XtransConnInfo, /* ciptr */
- char *, /* buf */
- int /* size */
-#endif
-);
-
-int TRANS(Write)(
-#if NeedFunctionPrototypes
- XtransConnInfo, /* ciptr */
- char *, /* buf */
- int /* size */
-#endif
-);
-
-int TRANS(Readv)(
-#if NeedFunctionPrototypes
- XtransConnInfo, /* ciptr */
- struct iovec *, /* buf */
- int /* size */
-#endif
-);
-
-int TRANS(Writev)(
-#if NeedFunctionPrototypes
- XtransConnInfo, /* ciptr */
- struct iovec *, /* buf */
- int /* size */
-#endif
-);
-
-int TRANS(Disconnect)(
-#if NeedFunctionPrototypes
- XtransConnInfo /* ciptr */
-#endif
-);
-
-int TRANS(Close)(
-#if NeedFunctionPrototypes
- XtransConnInfo /* ciptr */
-#endif
-);
-
-int TRANS(CloseForCloning)(
-#if NeedFunctionPrototypes
- XtransConnInfo /* ciptr */
-#endif
-);
-
-int TRANS(IsLocal)(
-#if NeedFunctionPrototypes
- XtransConnInfo /* ciptr */
-#endif
-);
-
-int TRANS(GetMyAddr)(
-#if NeedFunctionPrototypes
- XtransConnInfo, /* ciptr */
- int *, /* familyp */
- int *, /* addrlenp */
- Xtransaddr ** /* addrp */
-#endif
-);
-
-int TRANS(GetPeerAddr)(
-#if NeedFunctionPrototypes
- XtransConnInfo, /* ciptr */
- int *, /* familyp */
- int *, /* addrlenp */
- Xtransaddr ** /* addrp */
-#endif
-);
-
-int TRANS(GetConnectionNumber)(
-#if NeedFunctionPrototypes
- XtransConnInfo /* ciptr */
-#endif
-);
-
-#ifdef TRANS_SERVER
-
-int TRANS(MakeAllCOTSServerListeners)(
-#if NeedFunctionPrototypes
- char *, /* port */
- int *, /* partial */
- int *, /* count_ret */
- XtransConnInfo ** /* ciptrs_ret */
-#endif
-);
-
-int TRANS(MakeAllCLTSServerListeners)(
-#if NeedFunctionPrototypes
- char *, /* port */
- int *, /* partial */
- int *, /* count_ret */
- XtransConnInfo ** /* ciptrs_ret */
-#endif
-);
-
-#endif /* TRANS_SERVER */
-
-
-/*
- * Function Prototypes for Utility Functions.
- */
-
-#ifdef X11_t
-
-int TRANS(ConvertAddress)(
-#if NeedFunctionPrototypes
- int *, /* familyp */
- int *, /* addrlenp */
- Xtransaddr * /* addrp */
-#endif
-);
-
-#endif /* X11_t */
-
-#ifdef ICE_t
-
-char *
-TRANS(GetMyNetworkId)(
-#if NeedFunctionPrototypes
- XtransConnInfo /* ciptr */
-#endif
-);
-
-char *
-TRANS(GetPeerNetworkId)(
-#if NeedFunctionPrototypes
- XtransConnInfo /* ciptr */
-#endif
-);
-
-#endif /* ICE_t */
-
-#endif /* _XTRANS_H_ */
diff --git a/x11/IMdkit/i18nAttr.c b/x11/IMdkit/i18nAttr.c
deleted file mode 100644
index a52370b..0000000
--- a/x11/IMdkit/i18nAttr.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/******************************************************************
-
- Copyright 1994, 1995 by Sun Microsystems, Inc.
- Copyright 1993, 1994 by Hewlett-Packard Company
-
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and
-that both that copyright notice and this permission notice appear
-in supporting documentation, and that the name of Sun Microsystems, Inc.
-and Hewlett-Packard not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior permission.
-Sun Microsystems, Inc. and Hewlett-Packard make no representations about
-the suitability of this software for any purpose. It is provided "as is"
-without express or implied warranty.
-
-SUN MICROSYSTEMS INC. AND HEWLETT-PACKARD COMPANY DISCLAIMS ALL
-WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-SUN MICROSYSTEMS, INC. AND HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY
-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
- Author: Hidetoshi Tajima(tajima@Eng.Sun.COM) Sun Microsystems, Inc.
-
- This version tidied and debugged by Steve Underwood May 1999
-
-******************************************************************/
-
-#include <X11/Xlib.h>
-#include <X11/Xresource.h>
-#include "IMdkit.h"
-#include "Xi18n.h"
-#include "XimFunc.h"
-
-typedef struct
-{
- char *name;
- CARD16 type;
-} IMListOfAttr;
-
-typedef struct
-{
- char *name;
- CARD8 major_opcode;
- CARD8 minor_opcode;
-} IMExtList;
-
-IMListOfAttr Default_IMattr[] =
-{
- {XNQueryInputStyle, XimType_XIMStyles},
-/* {XNQueryIMValuesList, XimType_XIMValuesList}, */
- {(char *) NULL, (CARD16) 0}
-};
-
-IMListOfAttr Default_ICattr[] =
-{
- {XNInputStyle, XimType_CARD32},
- {XNClientWindow, XimType_Window},
- {XNFocusWindow, XimType_Window},
- {XNFilterEvents, XimType_CARD32},
- {XNPreeditAttributes, XimType_NEST},
- {XNStatusAttributes, XimType_NEST},
- {XNFontSet, XimType_XFontSet},
- {XNArea, XimType_XRectangle},
- {XNAreaNeeded, XimType_XRectangle},
- {XNColormap, XimType_CARD32},
- {XNStdColormap, XimType_CARD32},
- {XNForeground, XimType_CARD32},
- {XNBackground, XimType_CARD32},
- {XNBackgroundPixmap, XimType_CARD32},
- {XNSpotLocation, XimType_XPoint},
- {XNLineSpace, XimType_CARD32},
- {XNPreeditState, XimType_CARD32},
- {XNSeparatorofNestedList, XimType_SeparatorOfNestedList},
- {(char *) NULL, 0}
-};
-
-IMExtList Default_Extension[] =
-{
- {"XIM_EXT_MOVE", XIM_EXTENSION, XIM_EXT_MOVE},
- {"XIM_EXT_SET_EVENT_MASK", XIM_EXTENSION, XIM_EXT_SET_EVENT_MASK},
- {"XIM_EXT_FORWARD_KEYEVENT", XIM_EXTENSION, XIM_EXT_FORWARD_KEYEVENT},
- {(char *) NULL, 0, 0}
-};
-
-static void CountAttrList(IMListOfAttr *attr, int *total_count)
-{
- *total_count = 0;
-
- while (attr->name != NULL)
- {
- attr++;
- ++(*total_count);
- }
-}
-
-static XIMAttr *CreateAttrList (Xi18n i18n_core,
- IMListOfAttr *attr,
- int *total_count)
-{
- XIMAttr *args, *p;
- unsigned int buf_size;
-
- CountAttrList(attr, total_count);
-
- buf_size = (unsigned) (*total_count + 1)*sizeof (XIMAttr);
- args = (XIMAttr *) malloc (buf_size);
- if (!args)
- return (XIMAttr *) NULL;
- /*endif*/
- memset (args, 0, buf_size);
-
- for (p = args; attr->name != NULL; attr++, p++)
- {
- p->name = attr->name;
- p->length = strlen (attr->name);
- p->type = (CARD16) attr->type;
- p->attribute_id = XrmStringToQuark (p->name);
- if (strcmp (p->name, XNPreeditAttributes) == 0)
- i18n_core->address.preeditAttr_id = p->attribute_id;
- else if (strcmp (p->name, XNStatusAttributes) == 0)
- i18n_core->address.statusAttr_id = p->attribute_id;
- else if (strcmp (p->name, XNSeparatorofNestedList) == 0)
- i18n_core->address.separatorAttr_id = p->attribute_id;
- /*endif*/
- }
- /*endfor*/
- p->name = (char *) NULL;
-
- return args;
-}
-
-void _Xi18nInitAttrList (Xi18n i18n_core)
-{
- XIMAttr *args;
- int total_count;
-
- /* init IMAttr list */
- if (i18n_core->address.xim_attr)
- XFree ((char *)i18n_core->address.xim_attr);
- /*endif*/
- args = CreateAttrList (i18n_core, Default_IMattr, &total_count);
-
- i18n_core->address.im_attr_num = total_count;
- i18n_core->address.xim_attr = (XIMAttr *)args;
-
- /* init ICAttr list */
- if (i18n_core->address.xic_attr)
- XFree ((char *) i18n_core->address.xic_attr);
- /*endif*/
- args = CreateAttrList (i18n_core, Default_ICattr, &total_count);
-
- i18n_core->address.ic_attr_num = total_count;
- i18n_core->address.xic_attr = (XICAttr *) args;
-}
-
-void _Xi18nInitExtension(Xi18n i18n_core)
-{
- register int i;
- IMExtList *extensions = (IMExtList *) Default_Extension;
- XIMExt *ext_list = (XIMExt *) i18n_core->address.extension;
-
- for (i = 0; extensions->name; i++, ext_list++, extensions++)
- {
- ext_list->major_opcode = extensions->major_opcode;
- ext_list->minor_opcode = extensions->minor_opcode;
- ext_list->name = extensions->name;
- ext_list->length = strlen(ext_list->name);
- }
- /*endfor*/
- i18n_core->address.ext_num = i;
-}
diff --git a/x11/IMdkit/i18nClbk.c b/x11/IMdkit/i18nClbk.c
deleted file mode 100644
index b3edf3a..0000000
--- a/x11/IMdkit/i18nClbk.c
+++ /dev/null
@@ -1,513 +0,0 @@
-/******************************************************************
-
- Copyright 1994, 1995 by Sun Microsystems, Inc.
- Copyright 1993, 1994 by Hewlett-Packard Company
-
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and
-that both that copyright notice and this permission notice appear
-in supporting documentation, and that the name of Sun Microsystems, Inc.
-and Hewlett-Packard not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior permission.
-Sun Microsystems, Inc. and Hewlett-Packard make no representations about
-the suitability of this software for any purpose. It is provided "as is"
-without express or implied warranty.
-
-SUN MICROSYSTEMS INC. AND HEWLETT-PACKARD COMPANY DISCLAIMS ALL
-WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-SUN MICROSYSTEMS, INC. AND HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY
-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
- Author: Hidetoshi Tajima(tajima@Eng.Sun.COM) Sun Microsystems, Inc.
-
- This version tidied and debugged by Steve Underwood May 1999
-
-******************************************************************/
-
-#include <X11/Xlib.h>
-#include "IMdkit.h"
-#include "Xi18n.h"
-#include "FrameMgr.h"
-#include "XimFunc.h"
-
-int _Xi18nGeometryCallback (XIMS ims, IMProtocol *call_data)
-{
- Xi18n i18n_core = ims->protocol;
- FrameMgr fm;
- extern XimFrameRec geometry_fr[];
- register int total_size;
- unsigned char *reply = NULL;
- IMGeometryCBStruct *geometry_CB =
- (IMGeometryCBStruct *) &call_data->geometry_callback;
- CARD16 connect_id = call_data->any.connect_id;
-
- fm = FrameMgrInit (geometry_fr,
- NULL,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- total_size = FrameMgrGetTotalSize (fm);
- reply = (unsigned char *) malloc (total_size);
- if (!reply)
- {
- _Xi18nSendMessage (ims, connect_id, XIM_ERROR, 0, 0, 0);
- return False;
- }
- /*endif*/
- memset (reply, 0, total_size);
- FrameMgrSetBuffer (fm, reply);
-
- FrameMgrPutToken (fm, connect_id);
- FrameMgrPutToken (fm, geometry_CB->icid);
-
- _Xi18nSendMessage (ims,
- connect_id,
- XIM_GEOMETRY,
- 0,
- reply,
- total_size);
- FrameMgrFree (fm);
- XFree (reply);
-
- /* XIM_GEOMETRY is an asyncronous protocol,
- so return immediately. */
- return True;
-}
-
-int _Xi18nPreeditStartCallback (XIMS ims, IMProtocol *call_data)
-{
- Xi18n i18n_core = ims->protocol;
- FrameMgr fm;
- extern XimFrameRec preedit_start_fr[];
- register int total_size;
- unsigned char *reply = NULL;
- IMPreeditCBStruct *preedit_CB =
- (IMPreeditCBStruct*) &call_data->preedit_callback;
- CARD16 connect_id = call_data->any.connect_id;
-
- fm = FrameMgrInit (preedit_start_fr,
- NULL,
- _Xi18nNeedSwap (i18n_core, connect_id));
- total_size = FrameMgrGetTotalSize (fm);
- reply = (unsigned char *) malloc (total_size);
- if (!reply)
- {
- _Xi18nSendMessage(ims, connect_id, XIM_ERROR, 0, 0, 0);
- return False;
- }
- /*endif*/
- memset (reply, 0, total_size);
- FrameMgrSetBuffer (fm, reply);
-
- FrameMgrPutToken (fm, connect_id);
- FrameMgrPutToken (fm, preedit_CB->icid);
-
- _Xi18nSendMessage (ims,
- connect_id,
- XIM_PREEDIT_START,
- 0,
- reply,
- total_size);
- FrameMgrFree (fm);
- XFree (reply);
-
- return True;
-}
-
-int _Xi18nPreeditDrawCallback (XIMS ims, IMProtocol *call_data)
-{
- Xi18n i18n_core = ims->protocol;
- FrameMgr fm;
- extern XimFrameRec preedit_draw_fr[];
- register int total_size;
- unsigned char *reply = NULL;
- IMPreeditCBStruct *preedit_CB =
- (IMPreeditCBStruct *) &call_data->preedit_callback;
- XIMPreeditDrawCallbackStruct *draw =
- (XIMPreeditDrawCallbackStruct *) &preedit_CB->todo.draw;
- CARD16 connect_id = call_data->any.connect_id;
- register int feedback_count;
- register int i;
- BITMASK32 status = 0x0;
-
- if (draw->text->length == 0)
- status = 0x00000001;
- else if (draw->text->feedback[0] == 0)
- status = 0x00000002;
- /*endif*/
-
- fm = FrameMgrInit (preedit_draw_fr,
- NULL,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- /* set length of preedit string */
- FrameMgrSetSize (fm, draw->text->length);
-
- /* set iteration count for list of feedback */
- for (i = 0; draw->text->feedback[i] != 0; i++)
- ;
- /*endfor*/
- feedback_count = i;
- FrameMgrSetIterCount (fm, feedback_count);
-
- total_size = FrameMgrGetTotalSize (fm);
- reply = (unsigned char *) malloc (total_size);
- if (!reply)
- {
- _Xi18nSendMessage (ims, connect_id, XIM_ERROR, 0, 0, 0);
- return False;
- }
- /*endif*/
- memset (reply, 0, total_size);
- FrameMgrSetBuffer (fm, reply);
-
- FrameMgrPutToken (fm, connect_id);
- FrameMgrPutToken (fm, preedit_CB->icid);
- FrameMgrPutToken (fm, draw->caret);
- FrameMgrPutToken (fm, draw->chg_first);
- FrameMgrPutToken (fm, draw->chg_length);
- FrameMgrPutToken (fm, status);
- FrameMgrPutToken (fm, draw->text->length);
- FrameMgrPutToken (fm, draw->text->string);
- for (i = 0; i < feedback_count; i++)
- FrameMgrPutToken (fm, draw->text->feedback[i]);
- /*endfor*/
-
- _Xi18nSendMessage (ims,
- connect_id,
- XIM_PREEDIT_DRAW,
- 0,
- reply,
- total_size);
- FrameMgrFree (fm);
- XFree (reply);
-
- /* XIM_PREEDIT_DRAW is an asyncronous protocol, so return immediately. */
- return True;
-}
-
-int _Xi18nPreeditCaretCallback (XIMS ims, IMProtocol *call_data)
-{
- Xi18n i18n_core = ims->protocol;
- FrameMgr fm;
- extern XimFrameRec preedit_caret_fr[];
- register int total_size;
- unsigned char *reply = NULL;
- IMPreeditCBStruct *preedit_CB =
- (IMPreeditCBStruct*) &call_data->preedit_callback;
- XIMPreeditCaretCallbackStruct *caret =
- (XIMPreeditCaretCallbackStruct *) &preedit_CB->todo.caret;
- CARD16 connect_id = call_data->any.connect_id;
-
- fm = FrameMgrInit (preedit_caret_fr,
- NULL,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- total_size = FrameMgrGetTotalSize (fm);
- reply = (unsigned char *) malloc (total_size);
- if (!reply)
- {
- _Xi18nSendMessage (ims, connect_id, XIM_ERROR, 0, 0, 0);
- return False;
- }
- /*endif*/
- memset (reply, 0, total_size);
- FrameMgrSetBuffer (fm, reply);
-
- FrameMgrPutToken (fm, connect_id);
- FrameMgrPutToken (fm, preedit_CB->icid);
- FrameMgrPutToken (fm, caret->position);
- FrameMgrPutToken (fm, caret->direction);
- FrameMgrPutToken (fm, caret->style);
-
- _Xi18nSendMessage (ims,
- connect_id,
- XIM_PREEDIT_CARET,
- 0,
- reply,
- total_size);
- FrameMgrFree (fm);
- XFree (reply);
-
- return True;
-}
-
-int _Xi18nPreeditDoneCallback (XIMS ims, IMProtocol *call_data)
-{
- Xi18n i18n_core = ims->protocol;
- FrameMgr fm;
- extern XimFrameRec preedit_done_fr[];
- register int total_size;
- unsigned char *reply = NULL;
- IMPreeditCBStruct *preedit_CB =
- (IMPreeditCBStruct *) &call_data->preedit_callback;
- CARD16 connect_id = call_data->any.connect_id;
-
- fm = FrameMgrInit (preedit_done_fr,
- NULL,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- total_size = FrameMgrGetTotalSize (fm);
- reply = (unsigned char *) malloc (total_size);
- if (!reply)
- {
- _Xi18nSendMessage (ims, connect_id, XIM_ERROR, 0, 0, 0);
- return False;
- }
- /*endif*/
- memset (reply, 0, total_size);
- FrameMgrSetBuffer (fm, reply);
-
- FrameMgrPutToken (fm, connect_id);
- FrameMgrPutToken (fm, preedit_CB->icid);
-
- _Xi18nSendMessage (ims,
- connect_id,
- XIM_PREEDIT_DONE,
- 0,
- reply,
- total_size);
- FrameMgrFree (fm);
- XFree (reply);
-
- /* XIM_PREEDIT_DONE is an asyncronous protocol, so return immediately. */
- return True;
-}
-
-int _Xi18nStatusStartCallback (XIMS ims, IMProtocol *call_data)
-{
- Xi18n i18n_core = ims->protocol;
- FrameMgr fm;
- extern XimFrameRec status_start_fr[];
- register int total_size;
- unsigned char *reply = NULL;
- IMStatusCBStruct *status_CB =
- (IMStatusCBStruct*) &call_data->status_callback;
- CARD16 connect_id = call_data->any.connect_id;
-
- fm = FrameMgrInit (status_start_fr,
- NULL,
- _Xi18nNeedSwap (i18n_core, connect_id));
- total_size = FrameMgrGetTotalSize (fm);
- reply = (unsigned char *) malloc (total_size);
- if (!reply)
- {
- _Xi18nSendMessage (ims, connect_id, XIM_ERROR, 0, 0, 0);
- return False;
- }
- /*endif*/
- memset (reply, 0, total_size);
- FrameMgrSetBuffer (fm, reply);
-
- FrameMgrPutToken (fm, connect_id);
- FrameMgrPutToken (fm, status_CB->icid);
-
- _Xi18nSendMessage (ims,
- connect_id,
- XIM_STATUS_START,
- 0,
- reply,
- total_size);
- FrameMgrFree (fm);
- XFree (reply);
-
- /* XIM_STATUS_START is an asyncronous protocol, so return immediately. */
- return True;
-}
-
-int _Xi18nStatusDrawCallback (XIMS ims, IMProtocol *call_data)
-{
- Xi18n i18n_core = ims->protocol;
- FrameMgr fm = (FrameMgr)0;
- extern XimFrameRec status_draw_text_fr[];
- extern XimFrameRec status_draw_bitmap_fr[];
- register int total_size = 0;
- unsigned char *reply = NULL;
- IMStatusCBStruct *status_CB =
- (IMStatusCBStruct *) &call_data->status_callback;
- XIMStatusDrawCallbackStruct *draw =
- (XIMStatusDrawCallbackStruct *) &status_CB->todo.draw;
- CARD16 connect_id = call_data->any.connect_id;
- register int feedback_count;
- register int i;
- BITMASK32 status = 0x0;
-
- switch (draw->type)
- {
- case XIMTextType:
- fm = FrameMgrInit (status_draw_text_fr,
- NULL,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- if (draw->data.text->length == 0)
- status = 0x00000001;
- else if (draw->data.text->feedback[0] == 0)
- status = 0x00000002;
- /*endif*/
-
- /* set length of status string */
- FrameMgrSetSize(fm, draw->data.text->length);
- /* set iteration count for list of feedback */
- for (i = 0; draw->data.text->feedback[i] != 0; i++)
- ;
- /*endfor*/
- feedback_count = i;
- FrameMgrSetIterCount (fm, feedback_count);
-
- total_size = FrameMgrGetTotalSize (fm);
- reply = (unsigned char *) malloc (total_size);
- if (!reply)
- {
- _Xi18nSendMessage (ims, connect_id, XIM_ERROR, 0, 0, 0);
- return False;
- }
- /*endif*/
- memset (reply, 0, total_size);
- FrameMgrSetBuffer (fm, reply);
-
- FrameMgrPutToken (fm, connect_id);
- FrameMgrPutToken (fm, status_CB->icid);
- FrameMgrPutToken (fm, draw->type);
- FrameMgrPutToken (fm, status);
- FrameMgrPutToken (fm, draw->data.text->length);
- FrameMgrPutToken (fm, draw->data.text->string);
- for (i = 0; i < feedback_count; i++)
- FrameMgrPutToken (fm, draw->data.text->feedback[i]);
- /*endfor*/
- break;
-
- case XIMBitmapType:
- fm = FrameMgrInit (status_draw_bitmap_fr,
- NULL,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- total_size = FrameMgrGetTotalSize (fm);
- reply = (unsigned char *) malloc (total_size);
- if (!reply)
- {
- _Xi18nSendMessage (ims, connect_id, XIM_ERROR, 0, 0, 0);
- return False;
- }
- /*endif*/
- memset (reply, 0, total_size);
- FrameMgrSetBuffer (fm, reply);
-
- FrameMgrPutToken (fm, connect_id);
- FrameMgrPutToken (fm, status_CB->icid);
- FrameMgrPutToken (fm, draw->data.bitmap);
- break;
- }
- /*endswitch*/
- _Xi18nSendMessage (ims,
- connect_id,
- XIM_STATUS_DRAW,
- 0,
- reply,
- total_size);
- FrameMgrFree (fm);
- XFree (reply);
-
- /* XIM_STATUS_DRAW is an asyncronous protocol, so return immediately. */
- return True;
-}
-
-int _Xi18nStatusDoneCallback (XIMS ims, IMProtocol *call_data)
-{
- Xi18n i18n_core = ims->protocol;
- FrameMgr fm;
- extern XimFrameRec status_done_fr[];
- register int total_size;
- unsigned char *reply = NULL;
- IMStatusCBStruct *status_CB =
- (IMStatusCBStruct *) &call_data->status_callback;
- CARD16 connect_id = call_data->any.connect_id;
-
- fm = FrameMgrInit (status_done_fr,
- NULL,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- total_size = FrameMgrGetTotalSize (fm);
- reply = (unsigned char *) malloc (total_size);
- if (!reply)
- {
- _Xi18nSendMessage (ims, connect_id, XIM_ERROR, 0, 0, 0);
- return False;
- }
- /*endif*/
- memset (reply, 0, total_size);
- FrameMgrSetBuffer (fm, reply);
-
- FrameMgrPutToken (fm, connect_id);
- FrameMgrPutToken (fm, status_CB->icid);
-
- _Xi18nSendMessage (ims,
- connect_id,
- XIM_STATUS_DONE,
- 0,
- reply,
- total_size);
- FrameMgrFree (fm);
- XFree (reply);
-
- /* XIM_STATUS_DONE is an asyncronous protocol, so return immediately. */
- return True;
-}
-
-int _Xi18nStringConversionCallback (XIMS ims, IMProtocol *call_data)
-{
- Xi18n i18n_core = ims->protocol;
- FrameMgr fm;
- extern XimFrameRec str_conversion_fr[];
- register int total_size;
- unsigned char *reply = NULL;
- IMStrConvCBStruct *call_back =
- (IMStrConvCBStruct *) &call_data->strconv_callback;
- XIMStringConversionCallbackStruct *strconv =
- (XIMStringConversionCallbackStruct *) &call_back->strconv;
- CARD16 connect_id = call_data->any.connect_id;
-
- fm = FrameMgrInit (str_conversion_fr,
- NULL,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- total_size = FrameMgrGetTotalSize (fm);
- reply = (unsigned char *) malloc (total_size);
- if (!reply)
- {
- _Xi18nSendMessage (ims, connect_id, XIM_ERROR, 0, 0, 0);
- return False;
- }
- /*endif*/
- memset (reply, 0, total_size);
- FrameMgrSetBuffer (fm, reply);
-
- FrameMgrPutToken (fm, connect_id);
- FrameMgrPutToken (fm, call_back->icid);
- FrameMgrPutToken (fm, strconv->position);
- FrameMgrPutToken (fm, strconv->direction);
- FrameMgrPutToken (fm, strconv->operation);
-
- _Xi18nSendMessage (ims, connect_id,
- XIM_STR_CONVERSION,
- 0,
- reply,
- total_size);
- FrameMgrFree (fm);
- XFree (reply);
-
- /* XIM_STR_CONVERSION is a syncronous protocol,
- so should wait here for XIM_STR_CONVERSION_REPLY. */
- if (i18n_core->methods.wait (ims,
- connect_id,
- XIM_STR_CONVERSION_REPLY,
- 0) == False)
- {
- return False;
- }
- /*endif*/
- return True;
-}
diff --git a/x11/IMdkit/i18nIMProto.c b/x11/IMdkit/i18nIMProto.c
deleted file mode 100644
index 618da9d..0000000
--- a/x11/IMdkit/i18nIMProto.c
+++ /dev/null
@@ -1,773 +0,0 @@
-/******************************************************************
-Copyright 1993, 1994 by Digital Equipment Corporation, Maynard, Massachusetts,
-Copyright 1993, 1994 by Hewlett-Packard Company
-
-Copyright 1994, 1995 by Sun Microsystems, Inc.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the names of Digital or MIT not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL AND HEWLETT-PACKARD COMPANY DISCLAIMS ALL WARRANTIES WITH REGARD
-TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS, IN NO EVENT SHALL DIGITAL AND HEWLETT-PACKARD COMPANY BE LIABLE
-FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
-CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
- Author: Hiroyuki Miyamoto Digital Equipment Corporation
- miyamoto@jrd.dec.com
- Hidetoshi Tajima(tajima@Eng.Sun.COM) Sun Microsystems, Inc.
-
- This version tidied and debugged by Steve Underwood May 1999
-
-******************************************************************/
-
-/* Protocol Packet frames */
-
-#include "FrameMgr.h"
-
-/* Data type definitions */
-
-static XimFrameRec ximattr_fr[] =
-{
- _FRAME(BIT16), /* attribute ID */
- _FRAME(BIT16), /* type of the value */
- _FRAME(BIT16), /* length of im-attribute */
- _FRAME(BARRAY), /* im-attribute */
- _PAD4(2),
- _FRAME(EOL),
-};
-
-static XimFrameRec xicattr_fr[] =
-{
- _FRAME(BIT16), /* attribute ID */
- _FRAME(BIT16), /* type of the value */
- _FRAME(BIT16), /* length of ic-attribute */
- _FRAME(BARRAY), /* ic-attribute */
- _PAD4(2),
- _FRAME(EOL),
-};
-
-static XimFrameRec ximattribute_fr[] =
-{
- _FRAME(BIT16), /* attribute ID */
- _FRAME(BIT16), /* value length */
- _FRAME(BARRAY), /* value */
- _PAD4(1),
- _FRAME(EOL),
-};
-
-static XimFrameRec xicattribute_fr[] =
-{
- _FRAME(BIT16), /* attribute ID */
- _FRAME(BIT16), /* value length */
- _FRAME(BARRAY), /* value */
- _PAD4(1),
- _FRAME(EOL),
-};
-
-static XimFrameRec ximtriggerkey_fr[] =
-{
- _FRAME(BIT32), /* keysym */
- _FRAME(BIT32), /* modifier */
- _FRAME(BIT32), /* modifier mask */
- _FRAME(EOL),
-};
-
-static XimFrameRec encodinginfo_fr[] =
-{
- _FRAME(BIT16), /* length of encoding info */
- _FRAME(BARRAY), /* encoding info */
- _PAD4(2),
- _FRAME(EOL),
-};
-
-static XimFrameRec str_fr[] =
-{
- _FRAME(BIT8), /* number of byte */
- _FRAME(BARRAY), /* string */
- _FRAME(EOL),
-};
-
-static XimFrameRec xpcs_fr[] =
-{
- _FRAME(BIT16), /* length of string in bytes */
- _FRAME(BARRAY), /* string */
- _PAD4(2),
-};
-
-static XimFrameRec ext_fr[] =
-{
- _FRAME(BIT8), /* extension major-opcode */
- _FRAME(BIT8), /* extension minor-opcode */
- _FRAME(BIT16), /* length of extension name */
- _FRAME(BARRAY), /* extension name */
- _PAD4(1),
- _FRAME(EOL),
-};
-
-static XimFrameRec inputstyle_fr[] =
-{
- _FRAME(BIT32), /* inputstyle */
- _FRAME(EOL),
-};
-/* Protocol definitions */
-
-xim_externaldef XimFrameRec attr_head_fr[] =
-{
- _FRAME(BIT16), /* attribute id */
- _FRAME(BIT16), /* attribute length */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec short_fr[] =
-{
- _FRAME(BIT16), /* value */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec long_fr[] =
-{
- _FRAME(BIT32), /* value */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec xrectangle_fr[] =
-{
- _FRAME(BIT16), /* x */
- _FRAME(BIT16), /* y */
- _FRAME(BIT16), /* width */
- _FRAME(BIT16), /* height */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec xpoint_fr[] =
-{
- _FRAME(BIT16), /* x */
- _FRAME(BIT16), /* y */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec fontset_fr[] =
-{
- _FRAME(BIT16), /* length of base font name */
- _FRAME(BARRAY), /* base font name list */
- _PAD4(2), /* unused */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec input_styles_fr[] =
-{
- _FRAME(BIT16), /* number of list */
- _PAD4(1), /* unused */
- _FRAME(ITER), /* XIMStyle list */
- _FRAME(POINTER),
- _PTR(inputstyle_fr),
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec packet_header_fr[] =
-{
- _FRAME(BIT8), /* major-opcode */
- _FRAME(BIT8), /* minor-opcode */
- _FRAME(BIT16), /* length */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec error_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(BIT16), /* flag */
- _FRAME(BIT16), /* Error Code */
- _FRAME(BIT16), /* length of error detail */
- _FRAME(BIT16), /* type of error detail */
- _FRAME(BARRAY), /* error detail */
- _PAD4(1),
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec connect_fr[] =
-{
- _FRAME(BIT8), /* byte order */
- _PAD2(1), /* unused */
- _FRAME(BIT16), /* client-major-protocol-version */
- _FRAME(BIT16), /* client-minor-protocol-version */
- _BYTE_COUNTER(BIT16, 1), /* length of client-auth-protocol-names */
- _FRAME(ITER), /* client-auth-protocol-names */
- _FRAME(POINTER),
- _PTR(xpcs_fr),
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec connect_reply_fr[] =
-{
- _FRAME(BIT16), /* server-major-protocol-version */
- _FRAME(BIT16), /* server-minor-protocol-version */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec auth_required_fr[] =
-{
- _FRAME(BIT8), /* auth-protocol-index */
- _FRAME(BIT8), /* auth-data1 */
- _FRAME(BARRAY), /* auth-data2 */
- _PAD4(3),
- _FRAME(EOL),
-};
-
-
-xim_externaldef XimFrameRec auth_reply_fr[] =
-{
- _FRAME(BIT8),
- _FRAME(BARRAY),
- _PAD4(2),
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec auth_next_fr[] =
-{
- _FRAME(BIT8), /* auth-data1 */
- _FRAME(BARRAY), /* auth-data2 */
- _PAD4(2),
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec auth_setup_fr[] =
-{
- _BYTE_COUNTER(BIT16, 2), /* number of client-auth-protocol-names */
- _PAD4(1), /* unused */
- _FRAME(ITER), /* server-auth-protocol-names */
- _FRAME(POINTER),
- _PTR(xpcs_fr),
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec auth_ng_fr[] =
-{
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec disconnect_fr[] =
-{
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec disconnect_reply_fr[] =
-{
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec open_fr[] =
-{
- _FRAME(POINTER), /* locale name */
- _PTR(str_fr),
- _PAD4(1),
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec open_reply_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _BYTE_COUNTER(BIT16, 1), /* byte length of IM attributes supported */
- _FRAME(ITER), /* IM attribute supported */
- _FRAME(POINTER),
- _PTR(ximattr_fr),
- _BYTE_COUNTER(BIT16, 2), /* number of IC attribute supported */
- _PAD4(1), /* unused */
- _FRAME(ITER), /* IC attribute supported */
- _FRAME(POINTER),
- _PTR(xicattr_fr),
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec close_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _PAD4(1), /* unused */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec close_reply_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _PAD4(1), /* unused */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec register_triggerkeys_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _PAD4(1), /* unused */
- _BYTE_COUNTER(BIT32, 1), /* byte length of on-keys */
- _FRAME(ITER), /* on-keys list */
- _FRAME(POINTER),
- _PTR(ximtriggerkey_fr),
- _BYTE_COUNTER(BIT32, 1), /* byte length of off-keys */
- _FRAME(ITER), /* off-keys list */
- _FRAME(POINTER),
- _PTR(ximtriggerkey_fr),
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec trigger_notify_fr[] =
-{
- _FRAME(BIT16), /* input-mehotd-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(BIT32), /* flag */
- _FRAME(BIT32), /* index of keys list */
- _FRAME(BIT32), /* client-select-event-mask */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec trigger_notify_reply_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec set_event_mask_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(BIT32), /* forward-event-mask */
- _FRAME(BIT32), /* synchronous-event-mask */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec encoding_negotiation_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _BYTE_COUNTER(BIT16, 1), /* byte length of encodings listed by name */
- _FRAME(ITER), /* supported list of encoding in IM library */
- _FRAME(POINTER),
- _PTR(str_fr),
- _PAD4(1),
- _BYTE_COUNTER(BIT16, 2), /* byte length of encodings listed by
- detailed data */
- _PAD4(1),
- _FRAME(ITER), /* list of encodings supported in the
- IM library */
- _FRAME(POINTER),
- _PTR(encodinginfo_fr),
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec encoding_negotiation_reply_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* category of the encoding determined */
- _FRAME(BIT16), /* index of the encoding dterminated */
- _PAD4(1),
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec query_extension_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _BYTE_COUNTER(BIT16, 1), /* byte length of extensions supported
- by the IM library */
- _FRAME(ITER), /* extensions supported by the IM library */
- _FRAME(POINTER),
- _PTR(str_fr),
- _PAD4(1),
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec query_extension_reply_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _BYTE_COUNTER(BIT16, 1), /* byte length of extensions supported
- by the IM server */
- _FRAME(ITER), /* list of extensions supported by the
- IM server */
- _FRAME(POINTER),
- _PTR(ext_fr),
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec get_im_values_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _BYTE_COUNTER(BIT16, 1), /* byte length of im-attribute-id */
- _FRAME(ITER), /* im-attribute-id */
- _FRAME(BIT16),
- _PAD4(1),
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec get_im_values_reply_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _BYTE_COUNTER(BIT16, 1), /* byte length of im-attribute returned */
- _FRAME(ITER), /* im-attribute returned */
- _FRAME(POINTER),
- _PTR(ximattribute_fr),
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec create_ic_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _BYTE_COUNTER(BIT16, 1), /* byte length of ic-attributes */
- _FRAME(ITER), /* ic-attributes */
- _FRAME(POINTER),
- _PTR(xicattribute_fr),
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec create_ic_reply_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec destroy_ic_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec destroy_ic_reply_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec set_ic_values_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _BYTE_COUNTER(BIT16, 2), /* byte length of ic-attributes */
- _PAD4(1),
- _FRAME(ITER), /* ic-attribute */
- _FRAME(POINTER),
- _PTR(xicattribute_fr),
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec set_ic_values_reply_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec get_ic_values_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _BYTE_COUNTER(BIT16, 1), /* byte length of ic-attribute-id */
- _FRAME(ITER), /* ic-attribute */
- _FRAME(BIT16),
- _PAD4(2),
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec get_ic_values_reply_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _BYTE_COUNTER(BIT16, 2), /* byte length of ic-attribute */
- _PAD4(1),
- _FRAME(ITER), /* ic-attribute */
- _FRAME(POINTER),
- _PTR(xicattribute_fr),
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec set_ic_focus_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec unset_ic_focus_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec forward_event_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(BIT16), /* flag */
- _FRAME(BIT16), /* sequence number */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec wire_keyevent_fr[] = {
- _FRAME(BIT8), /* type */
- _FRAME(BIT8), /* detail */
- _FRAME(BIT16), /* serial number */
- _FRAME(BIT32), /* time */
- _FRAME(BIT32), /* root */
- _FRAME(BIT32), /* window */
- _FRAME(BIT32), /* subwindow */
- _FRAME(BIT16), /* rootX */
- _FRAME(BIT16), /* rootY */
- _FRAME(BIT16), /* X */
- _FRAME(BIT16), /* Y */
- _FRAME(BIT16), /* state */
- _FRAME(BIT8), /* sameScreen */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec sync_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec sync_reply_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(EOL),
-};
-
-#if 0
-xim_externaldef XimFrameRec commit_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(BIT16), /* flag */
- _FRAME(BIT16), /* byte length of committed string */
- _FRAME(BARRAY), /* committed string */
- _PAD4(1),
- _BYTE_COUNTER(BIT16, 1), /* byte length of keysym */
- _FRAME(ITER), /* keysym */
- _FRAME(BIT32),
- _PAD4(1),
- _FRAME(EOL),
-};
-#endif
-
-xim_externaldef XimFrameRec commit_chars_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(BIT16), /* flag */
- _FRAME(BIT16), /* byte length of committed string */
- _FRAME(BARRAY), /* committed string */
- _PAD4(1),
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec commit_both_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(BIT16), /* flag */
- _PAD4(1), /* unused */
- _FRAME(BIT32), /* keysym */
- _FRAME(BIT16), /* byte length of committed string */
- _FRAME(BARRAY), /* committed string */
- _PAD4(2),
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec reset_ic_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec reset_ic_reply_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(BIT16), /* byte length of committed string */
- _FRAME(BARRAY), /* committed string */
- _PAD4(2),
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec geometry_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec str_conversion_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(BIT32), /* XIMStringConversionPosition */
- _FRAME(BIT32), /* XIMStringConversionType */
- _FRAME(BIT32), /* XIMStringConversionOperation */
- _FRAME(BIT16), /* length to multiply the
- XIMStringConversionType */
- _FRAME(BIT16), /* length of the string to be
- substituted */
-#if 0
- _FRAME(BARRAY), /* string */
- _PAD4(1),
-#endif
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec str_conversion_reply_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(BIT32), /* XIMStringConversionFeedback */
- _FRAME(BIT16), /* length of the retrieved string */
- _FRAME(BARRAY), /* retrieved string */
- _PAD4(2),
- _BYTE_COUNTER(BIT16, 2), /* number of feedback array */
- _PAD4(1),
- _FRAME(ITER), /* feedback array */
- _FRAME(BIT32),
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec preedit_start_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec preedit_start_reply_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(BIT32), /* return value */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec preedit_draw_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(BIT32), /* caret */
- _FRAME(BIT32), /* chg_first */
- _FRAME(BIT32), /* chg_length */
- _FRAME(BIT32), /* status */
- _FRAME(BIT16), /* length of preedit string */
- _FRAME(BARRAY), /* preedit string */
- _PAD4(2),
- _BYTE_COUNTER(BIT16, 2), /* number of feedback array */
- _PAD4(1),
- _FRAME(ITER), /* feedback array */
- _FRAME(BIT32),
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec preedit_caret_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(BIT32), /* position */
- _FRAME(BIT32), /* direction */
- _FRAME(BIT32), /* style */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec preedit_caret_reply_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(BIT32), /* position */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec preedit_done_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec status_start_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec status_draw_text_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(BIT32), /* type */
- _FRAME(BIT32), /* status */
- _FRAME(BIT16), /* length of status string */
- _FRAME(BARRAY), /* status string */
- _PAD4(2),
- _BYTE_COUNTER(BIT16, 2), /* number of feedback array */
- _PAD4(1),
- _FRAME(ITER), /* feedback array */
- _FRAME(BIT32),
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec status_draw_bitmap_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(BIT32), /* type */
- _FRAME(BIT32), /* pixmap data */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec status_done_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec ext_set_event_mask_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(BIT32), /* filter-event-mask */
- _FRAME(BIT32), /* intercept-event-mask */
- _FRAME(BIT32), /* select-event-mask */
- _FRAME(BIT32), /* forward-event-mask */
- _FRAME(BIT32), /* synchronous-event-mask */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec ext_forward_keyevent_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(BIT16), /* flag */
- _FRAME(BIT16), /* sequence number */
- _FRAME(BIT8), /* xEvent.u.u.type */
- _FRAME(BIT8), /* keycode */
- _FRAME(BIT16), /* state */
- _FRAME(BIT32), /* time */
- _FRAME(BIT32), /* window */
- _FRAME(EOL),
-};
-
-xim_externaldef XimFrameRec ext_move_fr[] =
-{
- _FRAME(BIT16), /* input-method-ID */
- _FRAME(BIT16), /* input-context-ID */
- _FRAME(BIT16), /* X */
- _FRAME(BIT16), /* Y */
- _FRAME(EOL),
-};
diff --git a/x11/IMdkit/i18nIc.c b/x11/IMdkit/i18nIc.c
deleted file mode 100644
index 61b576f..0000000
--- a/x11/IMdkit/i18nIc.c
+++ /dev/null
@@ -1,1106 +0,0 @@
-/******************************************************************
-
- Copyright 1994, 1995 by Sun Microsystems, Inc.
- Copyright 1993, 1994 by Hewlett-Packard Company
-
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and
-that both that copyright notice and this permission notice appear
-in supporting documentation, and that the name of Sun Microsystems, Inc.
-and Hewlett-Packard not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior permission.
-Sun Microsystems, Inc. and Hewlett-Packard make no representations about
-the suitability of this software for any purpose. It is provided "as is"
-without express or implied warranty.
-
-SUN MICROSYSTEMS INC. AND HEWLETT-PACKARD COMPANY DISCLAIMS ALL
-WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-SUN MICROSYSTEMS, INC. AND HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY
-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
- Author: Hidetoshi Tajima(tajima@Eng.Sun.COM) Sun Microsystems, Inc.
-
- This version tidied and debugged by Steve Underwood May 1999
-
-******************************************************************/
-
-#include <X11/Xlib.h>
-#include "IMdkit.h"
-#include "Xi18n.h"
-#include "FrameMgr.h"
-#include "XimFunc.h"
-
-#define IC_SIZE 64
-
-/* Set IC values */
-static void SetCardAttribute (XICAttribute *value_ret,
- char *p,
- XICAttr *ic_attr,
- int value_length,
- int need_swap,
- void **value_buf)
-{
- FrameMgr fm;
-
- /*endif*/
- if (value_length == sizeof (CARD8))
- {
- memmove (*value_buf, p, value_length);
- }
- else if (value_length == sizeof (CARD16))
- {
- INT16 value;
- extern XimFrameRec short_fr[];
-
- fm = FrameMgrInit (short_fr, (char *) p, need_swap);
- /* get data */
- FrameMgrGetToken (fm, value);
- FrameMgrFree (fm);
- memmove (*value_buf, &value, value_length);
- }
- else if (value_length == sizeof(CARD32))
- {
- INT32 value;
- extern XimFrameRec long_fr[];
-
- fm = FrameMgrInit (long_fr, (char *) p, need_swap);
- /* get data */
- FrameMgrGetToken (fm, value);
- FrameMgrFree (fm);
- memmove (*value_buf, &value, value_length);
- }
- /*endif*/
- value_ret->attribute_id = ic_attr->attribute_id;
- value_ret->name = ic_attr->name;
- value_ret->name_length = ic_attr->length;
- value_ret->type = ic_attr->type;
- value_ret->value_length = value_length;
- value_ret->value = *value_buf;
-
- *value_buf += value_length;
-}
-
-static void SetFontAttribute (XICAttribute *value_ret,
- char *p,
- XICAttr *ic_attr,
- int value_length,
- int need_swap,
- void **value_buf)
-{
- char *base_name;
- CARD16 base_length;
- FrameMgr fm;
- extern XimFrameRec fontset_fr[];
-
- fm = FrameMgrInit (fontset_fr, (char *) p, need_swap);
- /* get data */
- FrameMgrGetToken (fm, base_length);
- FrameMgrSetSize (fm, base_length);
-
- /*endif*/
- FrameMgrGetToken (fm, base_name);
- FrameMgrFree(fm);
- strncpy ((char *) (*value_buf), base_name, base_length);
- ((char *) *value_buf)[base_length] = (char) 0;
-
- value_ret->attribute_id = ic_attr->attribute_id;
- value_ret->name = ic_attr->name;
- value_ret->name_length = ic_attr->length;
- value_ret->type = ic_attr->type;
- value_ret->value_length = value_length;
- value_ret->value = *value_buf;
-
- *value_buf += (base_length + 1);
-}
-
-static void SetPointAttribute (XICAttribute *value_ret,
- char *p,
- XICAttr *ic_attr,
- int value_length,
- int need_swap,
- void **value_buf)
-{
- XPoint *buf;
- FrameMgr fm;
- extern XimFrameRec xpoint_fr[];
-
- buf = (XPoint *) (*value_buf);
-
- fm = FrameMgrInit (xpoint_fr, (char *) p, need_swap);
- /* get data */
- FrameMgrGetToken (fm, buf->x);
- FrameMgrGetToken (fm, buf->y);
- FrameMgrFree (fm);
-
- value_ret->attribute_id = ic_attr->attribute_id;
- value_ret->name = ic_attr->name;
- value_ret->name_length = ic_attr->length;
- value_ret->type = ic_attr->type;
- value_ret->value_length = value_length;
- value_ret->value = (char *) buf;
-
- *value_buf += value_length;
-}
-
-static void SetRectAttribute (XICAttribute *value_ret,
- char *p,
- XICAttr *ic_attr,
- int value_length,
- int need_swap,
- void **value_buf)
-{
- XRectangle *buf;
- FrameMgr fm;
- extern XimFrameRec xrectangle_fr[];
-
- buf = (XRectangle *) (*value_buf);
-
- fm = FrameMgrInit (xrectangle_fr, (char *) p, need_swap);
- /* get data */
- FrameMgrGetToken (fm, buf->x);
- FrameMgrGetToken (fm, buf->y);
- FrameMgrGetToken (fm, buf->width);
- FrameMgrGetToken (fm, buf->height);
- FrameMgrFree (fm);
-
- value_ret->attribute_id = ic_attr->attribute_id;
- value_ret->name = ic_attr->name;
- value_ret->name_length = ic_attr->length;
- value_ret->type = ic_attr->type;
- value_ret->value_length = value_length;
- value_ret->value = (char *) buf;
-
- *value_buf += value_length;
-}
-
-#if 0
-static void SetHotKeyAttribute (XICAttribute *value_ret,
- char *p,
- XICAttr *ic_attr,
- int value_length,
- int need_swap,
- void **value_buf)
-{
- INT32 list_number;
- XIMTriggerKey *hotkeys;
-
- memmove (&list_number, p, sizeof(INT32)); p += sizeof(INT32);
-
- hotkeys = (XIMTriggerKey *) (*value_buf);
-
- memmove (hotkeys, p, list_number*sizeof (XIMTriggerKey));
-
- value_ret->attribute_id = ic_attr->attribute_id;
- value_ret->name = ic_attr->name;
- value_ret->name_length = ic_attr->length;
- value_ret->type = ic_attr->type;
- value_ret->value_length = value_length;
- value_ret->value = (char *) hotkeys;
-
- *value_buf += value_length;
-}
-#endif
-
-/* get IC values */
-static void GetAttrHeader (unsigned char *rec,
- XICAttribute *list,
- int need_swap)
-{
- FrameMgr fm;
- extern XimFrameRec attr_head_fr[];
-
- fm = FrameMgrInit (attr_head_fr, (char *) rec, need_swap);
- /* put data */
- FrameMgrPutToken (fm, list->attribute_id);
- FrameMgrPutToken (fm, list->value_length);
- FrameMgrFree (fm);
-}
-
-static void GetCardAttribute (char *rec, XICAttribute *list, int need_swap)
-{
- FrameMgr fm;
- unsigned char *recp = (unsigned char *) rec;
-
- GetAttrHeader (recp, list, need_swap);
- recp += sizeof (CARD16)*2;
-
- if (list->value_length == sizeof (CARD8))
- {
- memmove (recp, list->value, list->value_length);
- }
- else if (list->value_length == sizeof (CARD16))
- {
- INT16 *value = (INT16 *) list->value;
- extern XimFrameRec short_fr[];
-
- fm = FrameMgrInit (short_fr, (char *) recp, need_swap);
- /* put data */
- FrameMgrPutToken (fm, *value);
- FrameMgrFree (fm);
- }
- else if (list->value_length == sizeof (CARD32))
- {
- INT32 *value = (INT32 *) list->value;
- extern XimFrameRec long_fr[];
-
- fm = FrameMgrInit (long_fr, (char *) recp, need_swap);
- /* put data */
- FrameMgrPutToken (fm, *value);
- FrameMgrFree (fm);
- }
- /*endif*/
-}
-
-static void GetFontAttribute(char *rec, XICAttribute *list, int need_swap)
-{
- FrameMgr fm;
- extern XimFrameRec fontset_fr[];
- char *base_name = (char *) list->value;
- unsigned char *recp = (unsigned char *) rec;
-
- GetAttrHeader (recp, list, need_swap);
- recp += sizeof (CARD16)*2;
-
- fm = FrameMgrInit (fontset_fr, (char *)recp, need_swap);
- /* put data */
- FrameMgrSetSize (fm, list->value_length);
- FrameMgrPutToken (fm, list->value_length);
- FrameMgrPutToken (fm, base_name);
- FrameMgrFree (fm);
-}
-
-static void GetRectAttribute (char *rec, XICAttribute *list, int need_swap)
-{
- FrameMgr fm;
- extern XimFrameRec xrectangle_fr[];
- XRectangle *rect = (XRectangle *) list->value;
- unsigned char *recp = (unsigned char *) rec;
-
- GetAttrHeader (recp, list, need_swap);
- recp += sizeof(CARD16)*2;
-
- fm = FrameMgrInit (xrectangle_fr, (char *) recp, need_swap);
- /* put data */
- FrameMgrPutToken (fm, rect->x);
- FrameMgrPutToken (fm, rect->y);
- FrameMgrPutToken (fm, rect->width);
- FrameMgrPutToken (fm, rect->height);
- FrameMgrFree (fm);
-}
-
-static void GetPointAttribute (char *rec, XICAttribute *list, int need_swap)
-{
- FrameMgr fm;
- extern XimFrameRec xpoint_fr[];
- XPoint *rect = (XPoint *) list->value;
- unsigned char *recp = (unsigned char *) rec;
-
- GetAttrHeader (recp, list, need_swap);
- recp += sizeof(CARD16)*2;
-
- fm = FrameMgrInit (xpoint_fr, (char *) recp, need_swap);
- /* put data */
- FrameMgrPutToken (fm, rect->x);
- FrameMgrPutToken (fm, rect->y);
- FrameMgrFree (fm);
-}
-
-static int ReadICValue (Xi18n i18n_core,
- CARD16 icvalue_id,
- int value_length,
- void *p,
- XICAttribute *value_ret,
- CARD16 *number_ret,
- int need_swap,
- void **value_buf)
-{
- XICAttr *ic_attr = i18n_core->address.xic_attr;
- int i;
-
- *number_ret = (CARD16) 0;
-
- for (i = 0; i < i18n_core->address.ic_attr_num; i++, ic_attr++)
- {
- if (ic_attr->attribute_id == icvalue_id)
- break;
- /*endif*/
- }
- /*endfor*/
- switch (ic_attr->type)
- {
- case XimType_NEST:
- {
- int total_length = 0;
- CARD16 attribute_ID;
- INT16 attribute_length;
- unsigned char *p1 = (unsigned char *) p;
- CARD16 ic_len = 0;
- CARD16 number;
- FrameMgr fm;
- extern XimFrameRec attr_head_fr[];
-
- while (total_length < value_length)
- {
- fm = FrameMgrInit (attr_head_fr, (char *) p1, need_swap);
- /* get data */
- FrameMgrGetToken (fm, attribute_ID);
- FrameMgrGetToken (fm, attribute_length);
- FrameMgrFree (fm);
- p1 += sizeof (CARD16)*2;
- ReadICValue (i18n_core,
- attribute_ID,
- attribute_length,
- p1,
- (value_ret + ic_len),
- &number,
- need_swap,
- value_buf);
- ic_len++;
- *number_ret += number;
- p1 += attribute_length;
- p1 += IMPAD (attribute_length);
- total_length += (CARD16) sizeof(CARD16)*2
- + (INT16) attribute_length
- + IMPAD (attribute_length);
- }
- /*endwhile*/
- return ic_len;
- }
-
- case XimType_CARD8:
- case XimType_CARD16:
- case XimType_CARD32:
- case XimType_Window:
- SetCardAttribute (value_ret, p, ic_attr, value_length, need_swap, value_buf);
- *number_ret = (CARD16) 1;
- return *number_ret;
-
- case XimType_XFontSet:
- SetFontAttribute (value_ret, p, ic_attr, value_length, need_swap, value_buf);
- *number_ret = (CARD16) 1;
- return *number_ret;
-
- case XimType_XRectangle:
- SetRectAttribute (value_ret, p, ic_attr, value_length, need_swap, value_buf);
- *number_ret = (CARD16) 1;
- return *number_ret;
-
- case XimType_XPoint:
- SetPointAttribute(value_ret, p, ic_attr, value_length, need_swap, value_buf);
- *number_ret = (CARD16) 1;
- return *number_ret;
-
-#if 0
- case XimType_XIMHotKeyTriggers:
- SetHotKeyAttribute (value_ret, p, ic_attr, value_length, need_swap, value_buf);
- *number_ret = (CARD16) 1;
- return *number_ret;
-#endif
- }
- /*endswitch*/
- return 0;
-}
-
-static XICAttribute *CreateNestedList (CARD16 attr_id,
- XICAttribute *list,
- int number,
- int need_swap)
-{
- XICAttribute *nest_list = NULL;
- register int i;
- char *values = NULL;
- char *valuesp;
- int value_length = 0;
-
- if (number == 0)
- return NULL;
- /*endif*/
- for (i = 0; i < number; i++)
- {
- value_length += sizeof (CARD16)*2;
- value_length += list[i].value_length;
- value_length += IMPAD (list[i].value_length);
- }
- /*endfor*/
- if ((values = (char *) malloc (value_length)) == NULL)
- return NULL;
- /*endif*/
- memset (values, 0, value_length);
-
- valuesp = values;
- for (i = 0; i < number; i++)
- {
- switch (list[i].type)
- {
- case XimType_CARD8:
- case XimType_CARD16:
- case XimType_CARD32:
- case XimType_Window:
- GetCardAttribute (valuesp, &list[i], need_swap);
- break;
-
- case XimType_XFontSet:
- GetFontAttribute (valuesp, &list[i], need_swap);
- break;
-
- case XimType_XRectangle:
- GetRectAttribute (valuesp, &list[i], need_swap);
- break;
-
- case XimType_XPoint:
- GetPointAttribute (valuesp, &list[i], need_swap);
- break;
-
-#if 0
- case XimType_XIMHotKeyTriggers:
- GetHotKeyAttribute (valuesp, &list[i], need_swap);
- break;
-#endif
- }
- /*endswitch*/
- valuesp += sizeof (CARD16)*2;
- valuesp += list[i].value_length;
- valuesp += IMPAD(list[i].value_length);
- }
- /*endfor*/
-
- nest_list = (XICAttribute *) malloc (sizeof (XICAttribute));
- if (nest_list == NULL)
- return NULL;
- /*endif*/
- memset (nest_list, 0, sizeof (XICAttribute));
- nest_list->value = (void *) malloc (value_length);
- if (nest_list->value == NULL)
- return NULL;
- /*endif*/
- memset (nest_list->value, 0, sizeof (value_length));
-
- nest_list->attribute_id = attr_id;
- nest_list->value_length = value_length;
- memmove (nest_list->value, values, value_length);
-
- XFree (values);
- return nest_list;
-}
-
-static Bool IsNestedList (Xi18n i18n_core, CARD16 icvalue_id)
-{
- XICAttr *ic_attr = i18n_core->address.xic_attr;
- int i;
-
- for (i = 0; i < i18n_core->address.ic_attr_num; i++, ic_attr++)
- {
- if (ic_attr->attribute_id == icvalue_id)
- {
- if (ic_attr->type == XimType_NEST)
- return True;
- /*endif*/
- return False;
- }
- /*endif*/
- }
- /*endfor*/
- return False;
-}
-
-static Bool IsSeparator (Xi18n i18n_core, CARD16 icvalue_id)
-{
- return (i18n_core->address.separatorAttr_id == icvalue_id);
-}
-
-static int GetICValue (Xi18n i18n_core,
- XICAttribute *attr_ret,
- CARD16 *id_list,
- int list_num)
-{
- XICAttr *xic_attr = i18n_core->address.xic_attr;
- register int i;
- register int j;
- register int n;
-
- i =
- n = 0;
- if (IsNestedList (i18n_core, id_list[i]))
- {
- i++;
- while (i < list_num && !IsSeparator (i18n_core, id_list[i]))
- {
- for (j = 0; j < i18n_core->address.ic_attr_num; j++)
- {
- if (xic_attr[j].attribute_id == id_list[i])
- {
- attr_ret[n].attribute_id = xic_attr[j].attribute_id;
- attr_ret[n].name_length = xic_attr[j].length;
- attr_ret[n].name = malloc (xic_attr[j].length + 1);
- strcpy(attr_ret[n].name, xic_attr[j].name);
- attr_ret[n].type = xic_attr[j].type;
- n++;
- i++;
- break;
- }
- /*endif*/
- }
- /*endfor*/
- }
- /*endwhile*/
- }
- else
- {
- for (j = 0; j < i18n_core->address.ic_attr_num; j++)
- {
- if (xic_attr[j].attribute_id == id_list[i])
- {
- attr_ret[n].attribute_id = xic_attr[j].attribute_id;
- attr_ret[n].name_length = xic_attr[j].length;
- attr_ret[n].name = malloc (xic_attr[j].length + 1);
- strcpy(attr_ret[n].name, xic_attr[j].name);
- attr_ret[n].type = xic_attr[j].type;
- n++;
- break;
- }
- /*endif*/
- }
- /*endfor*/
- }
- /*endif*/
- return n;
-}
-
-static void SwapAttributes (XICAttribute *list,
- int number){
- FrameMgr fm;
- CARD16 c16;
- extern XimFrameRec short_fr[];
- CARD32 c32;
- extern XimFrameRec long_fr[];
- XPoint xpoint;
- extern XimFrameRec xpoint_fr[];
- XRectangle xrect;
- extern XimFrameRec xrectangle_fr[];
- int i;
-
- for (i = 0; i < number; ++i, ++list) {
- if (list->value == NULL)
- continue;
- switch (list->type) {
- case XimType_CARD16:
- fm = FrameMgrInit (short_fr, (char *)list->value, 1);
- FrameMgrGetToken (fm, c16);
- memmove(list->value, &c16, sizeof(CARD16));
- FrameMgrFree (fm);
- break;
- case XimType_CARD32:
- case XimType_Window:
- fm = FrameMgrInit (long_fr, (char *)list->value, 1);
- FrameMgrGetToken (fm, c32);
- memmove(list->value, &c32, sizeof(CARD32));
- FrameMgrFree (fm);
- break;
- case XimType_XRectangle:
- fm = FrameMgrInit (xrectangle_fr, (char *)list->value, 1);
- FrameMgrGetToken (fm, xrect);
- memmove(list->value, &xrect, sizeof(XRectangle));
- FrameMgrFree (fm);
- break;
- case XimType_XPoint:
- fm = FrameMgrInit (xpoint_fr, (char *)list->value, 1);
- FrameMgrGetToken (fm, xpoint);
- memmove(list->value, &xpoint, sizeof(XPoint));
- FrameMgrFree (fm);
- break;
- default:
- break;
- }
- }
-}
-
-/* called from CreateICMessageProc and SetICValueMessageProc */
-void _Xi18nChangeIC (XIMS ims,
- IMProtocol *call_data,
- unsigned char *p,
- int create_flag)
-{
- Xi18n i18n_core = ims->protocol;
- FrameMgr fm;
- FmStatus status;
- CARD16 byte_length;
- register int total_size;
- unsigned char *reply = NULL;
- register int i;
- register int attrib_num;
- XICAttribute *attrib_list;
- XICAttribute pre_attr[IC_SIZE];
- XICAttribute sts_attr[IC_SIZE];
- XICAttribute ic_attr[IC_SIZE];
- CARD16 preedit_ic_num = 0;
- CARD16 status_ic_num = 0;
- CARD16 ic_num = 0;
- CARD16 connect_id = call_data->any.connect_id;
- IMChangeICStruct *changeic = (IMChangeICStruct *) &call_data->changeic;
- extern XimFrameRec create_ic_fr[];
- extern XimFrameRec create_ic_reply_fr[];
- extern XimFrameRec set_ic_values_fr[];
- extern XimFrameRec set_ic_values_reply_fr[];
- CARD16 input_method_ID;
-
- void *value_buf = NULL;
- void *value_buf_ptr;
-
- register int total_value_length = 0;
-
- memset (pre_attr, 0, sizeof (XICAttribute)*IC_SIZE);
- memset (sts_attr, 0, sizeof (XICAttribute)*IC_SIZE);
- memset (ic_attr, 0, sizeof (XICAttribute)*IC_SIZE);
-
- if (create_flag == True)
- {
- fm = FrameMgrInit (create_ic_fr,
- (char *) p,
- _Xi18nNeedSwap (i18n_core, connect_id));
- /* get data */
- FrameMgrGetToken (fm, input_method_ID);
- FrameMgrGetToken (fm, byte_length);
- }
- else
- {
- fm = FrameMgrInit (set_ic_values_fr,
- (char *) p,
- _Xi18nNeedSwap (i18n_core, connect_id));
- /* get data */
- FrameMgrGetToken (fm, input_method_ID);
- FrameMgrGetToken (fm, changeic->icid);
- FrameMgrGetToken (fm, byte_length);
- }
- /*endif*/
- attrib_list = (XICAttribute *) malloc (sizeof (XICAttribute)*IC_SIZE);
- if (!attrib_list)
- {
- _Xi18nSendMessage (ims, connect_id, XIM_ERROR, 0, 0, 0);
- return;
- }
- /*endif*/
- memset (attrib_list, 0, sizeof(XICAttribute)*IC_SIZE);
-
- attrib_num = 0;
- while (FrameMgrIsIterLoopEnd (fm, &status) == False)
- {
- void *value;
- int value_length;
-
- FrameMgrGetToken (fm, attrib_list[attrib_num].attribute_id);
- FrameMgrGetToken (fm, value_length);
- FrameMgrSetSize (fm, value_length);
- attrib_list[attrib_num].value_length = value_length;
- FrameMgrGetToken (fm, value);
- attrib_list[attrib_num].value = (void *) malloc (value_length + 1);
- memmove (attrib_list[attrib_num].value, value, value_length);
- ((char *)attrib_list[attrib_num].value)[value_length] = '\0';
- attrib_num++;
- total_value_length += (value_length + 1);
- }
- /*endwhile*/
-
- value_buf = (void *) malloc (total_value_length);
- value_buf_ptr = value_buf;
-
- if (!value_buf)
- {
- _Xi18nSendMessage (ims, connect_id, XIM_ERROR, 0, 0, 0);
- for (i = 0; i < attrib_num; i++)
- XFree (attrib_list[i].value);
- /*endfor*/
- XFree (attrib_list);
- return;
- }
- /*endif*/
-
- for (i = 0; i < attrib_num; i++)
- {
- CARD16 number;
-
- if (IsNestedList (i18n_core, attrib_list[i].attribute_id))
- {
- if (attrib_list[i].attribute_id
- == i18n_core->address.preeditAttr_id)
- {
- ReadICValue (i18n_core,
- attrib_list[i].attribute_id,
- attrib_list[i].value_length,
- attrib_list[i].value,
- &pre_attr[preedit_ic_num],
- &number,
- _Xi18nNeedSwap(i18n_core, connect_id),
- &value_buf_ptr);
- preedit_ic_num += number;
- }
- else if (attrib_list[i].attribute_id == i18n_core->address.statusAttr_id)
- {
- ReadICValue (i18n_core,
- attrib_list[i].attribute_id,
- attrib_list[i].value_length,
- attrib_list[i].value,
- &sts_attr[status_ic_num],
- &number,
- _Xi18nNeedSwap (i18n_core, connect_id),
- &value_buf_ptr);
- status_ic_num += number;
- }
- else
- {
- /* another nested list.. possible? */
- }
- /*endif*/
- }
- else
- {
- ReadICValue (i18n_core,
- attrib_list[i].attribute_id,
- attrib_list[i].value_length,
- attrib_list[i].value,
- &ic_attr[ic_num],
- &number,
- _Xi18nNeedSwap (i18n_core, connect_id),
- &value_buf_ptr);
- ic_num += number;
- }
- /*endif*/
- }
- /*endfor*/
- for (i = 0; i < attrib_num; i++)
- XFree (attrib_list[i].value);
- /*endfor*/
- XFree (attrib_list);
-
- FrameMgrFree (fm);
-
- changeic->preedit_attr_num = preedit_ic_num;
- changeic->status_attr_num = status_ic_num;
- changeic->ic_attr_num = ic_num;
- changeic->preedit_attr = pre_attr;
- changeic->status_attr = sts_attr;
- changeic->ic_attr = ic_attr;
-
- if (i18n_core->address.improto)
- {
- if (!(i18n_core->address.improto(ims, call_data))) {
- XFree (value_buf);
- return;
- }
- /*endif*/
- }
-
- XFree (value_buf);
-
- /*endif*/
- if (create_flag == True)
- {
- fm = FrameMgrInit (create_ic_reply_fr,
- NULL,
- _Xi18nNeedSwap (i18n_core, connect_id));
- }
- else
- {
- fm = FrameMgrInit (set_ic_values_reply_fr,
- NULL,
- _Xi18nNeedSwap (i18n_core, connect_id));
- }
- /*endif*/
- total_size = FrameMgrGetTotalSize (fm);
- reply = (unsigned char *) malloc (total_size);
-
- if (!reply)
- {
- _Xi18nSendMessage (ims, connect_id, XIM_ERROR, 0, 0, 0);
- return;
- }
- /*endif*/
- memset (reply, 0, total_size);
- FrameMgrSetBuffer (fm, reply);
-
- FrameMgrPutToken (fm, input_method_ID);
- FrameMgrPutToken (fm, changeic->icid);
-
- if (create_flag == True)
- {
- _Xi18nSendMessage (ims,
- connect_id,
- XIM_CREATE_IC_REPLY,
- 0,
- reply,
- total_size);
- }
- else
- {
- _Xi18nSendMessage (ims,
- connect_id,
- XIM_SET_IC_VALUES_REPLY,
- 0,
- reply,
- total_size);
- }
- /*endif*/
- if (create_flag == True)
- {
- int on_key_num = i18n_core->address.on_keys.count_keys;
- int off_key_num = i18n_core->address.off_keys.count_keys;
-
- if (on_key_num == 0 && off_key_num == 0)
- {
- long mask;
-
- if (i18n_core->address.imvalue_mask & I18N_FILTERMASK)
- mask = i18n_core->address.filterevent_mask;
- else
- mask = DEFAULT_FILTER_MASK;
- /*endif*/
- /* static event flow is default */
- _Xi18nSetEventMask (ims,
- connect_id,
- input_method_ID,
- changeic->icid,
- mask,
- ~mask);
- }
- /*endif*/
- }
- /*endif*/
- FrameMgrFree (fm);
- XFree(reply);
-}
-
-/* called from GetICValueMessageProc */
-void _Xi18nGetIC (XIMS ims, IMProtocol *call_data, unsigned char *p)
-{
- Xi18n i18n_core = ims->protocol;
- FrameMgr fm;
- FmStatus status;
- extern XimFrameRec get_ic_values_fr[];
- extern XimFrameRec get_ic_values_reply_fr[];
- CARD16 byte_length;
- register int total_size;
- unsigned char *reply = NULL;
- XICAttribute *preedit_ret = NULL;
- XICAttribute *status_ret = NULL;
- register int i;
- register int number;
- int iter_count;
- CARD16 *attrID_list;
- XICAttribute pre_attr[IC_SIZE];
- XICAttribute sts_attr[IC_SIZE];
- XICAttribute ic_attr[IC_SIZE];
- CARD16 pre_count = 0;
- CARD16 sts_count = 0;
- CARD16 ic_count = 0;
- IMChangeICStruct *getic = (IMChangeICStruct *) &call_data->changeic;
- CARD16 connect_id = call_data->any.connect_id;
- CARD16 input_method_ID;
-
- memset (pre_attr, 0, sizeof (XICAttribute)*IC_SIZE);
- memset (sts_attr, 0, sizeof (XICAttribute)*IC_SIZE);
- memset (ic_attr, 0, sizeof (XICAttribute)*IC_SIZE);
-
- fm = FrameMgrInit (get_ic_values_fr,
- (char *) p,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- /* get data */
- FrameMgrGetToken (fm, input_method_ID);
- FrameMgrGetToken (fm, getic->icid);
- FrameMgrGetToken (fm, byte_length);
-
- attrID_list = (CARD16 *) malloc (sizeof (CARD16)*IC_SIZE); /* bogus */
- memset (attrID_list, 0, sizeof (CARD16)*IC_SIZE);
-
- number = 0;
- while (FrameMgrIsIterLoopEnd (fm, &status) == False)
- FrameMgrGetToken (fm, attrID_list[number++]);
- /*endwhile*/
- FrameMgrFree (fm);
-
- i = 0;
- while (i < number)
- {
- int read_number;
-
- if (IsNestedList (i18n_core, attrID_list[i]))
- {
- if (attrID_list[i] == i18n_core->address.preeditAttr_id)
- {
- read_number = GetICValue (i18n_core,
- &pre_attr[pre_count],
- &attrID_list[i],
- number);
- i += read_number + 1;
- pre_count += read_number;
- }
- else if (attrID_list[i] == i18n_core->address.statusAttr_id)
- {
- read_number = GetICValue (i18n_core,
- &sts_attr[sts_count],
- &attrID_list[i],
- number);
- i += read_number + 1;
- sts_count += read_number;
- }
- else
- {
- /* another nested list.. possible? */
- }
- /*endif*/
- }
- else
- {
- read_number = GetICValue (i18n_core,
- &ic_attr[ic_count],
- &attrID_list[i],
- number);
- i += read_number;
- ic_count += read_number;
- }
- /*endif*/
- }
- /*endwhile*/
- getic->preedit_attr_num = pre_count;
- getic->status_attr_num = sts_count;
- getic->ic_attr_num = ic_count;
- getic->preedit_attr = pre_attr;
- getic->status_attr = sts_attr;
- getic->ic_attr = ic_attr;
- if (i18n_core->address.improto)
- {
- if (!(i18n_core->address.improto (ims, call_data)))
- return;
- /*endif*/
- if (_Xi18nNeedSwap (i18n_core, connect_id))
- SwapAttributes(getic->ic_attr, getic->ic_attr_num);
- }
- /*endif*/
- iter_count = getic->ic_attr_num;
-
- preedit_ret = CreateNestedList (i18n_core->address.preeditAttr_id,
- getic->preedit_attr,
- getic->preedit_attr_num,
- _Xi18nNeedSwap (i18n_core, connect_id));
- if (preedit_ret)
- iter_count++;
- /*endif*/
- status_ret = CreateNestedList (i18n_core->address.statusAttr_id,
- getic->status_attr,
- getic->status_attr_num,
- _Xi18nNeedSwap (i18n_core, connect_id));
- if (status_ret)
- iter_count++;
- /*endif*/
-
- fm = FrameMgrInit (get_ic_values_reply_fr,
- NULL,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- /* set iteration count for list of ic_attribute */
- FrameMgrSetIterCount (fm, iter_count);
-
- /* set length of BARRAY item in xicattribute_fr */
- for (i = 0; i < (int) getic->ic_attr_num; i++)
- FrameMgrSetSize (fm, ic_attr[i].value_length);
- /*endfor*/
-
- if (preedit_ret)
- FrameMgrSetSize (fm, preedit_ret->value_length);
- /*endif*/
- if (status_ret)
- FrameMgrSetSize (fm, status_ret->value_length);
- /*endif*/
- total_size = FrameMgrGetTotalSize (fm);
- reply = (unsigned char *) malloc (total_size);
- if (reply == NULL)
- {
- _Xi18nSendMessage (ims, connect_id, XIM_ERROR, 0, 0, 0);
- return;
- }
- /*endif*/
- memset (reply, 0, total_size);
- FrameMgrSetBuffer (fm, reply);
-
- FrameMgrPutToken (fm, input_method_ID);
- FrameMgrPutToken (fm, getic->icid);
-
- for (i = 0; i < (int) getic->ic_attr_num; i++)
- {
- FrameMgrPutToken (fm, ic_attr[i].attribute_id);
- FrameMgrPutToken (fm, ic_attr[i].value_length);
- FrameMgrPutToken (fm, ic_attr[i].value);
- }
- /*endfor*/
- if (preedit_ret)
- {
- FrameMgrPutToken (fm, preedit_ret->attribute_id);
- FrameMgrPutToken (fm, preedit_ret->value_length);
- FrameMgrPutToken (fm, preedit_ret->value);
- }
- /*endif*/
- if (status_ret)
- {
- FrameMgrPutToken (fm, status_ret->attribute_id);
- FrameMgrPutToken (fm, status_ret->value_length);
- FrameMgrPutToken (fm, status_ret->value);
- }
- /*endif*/
- _Xi18nSendMessage (ims,
- connect_id,
- XIM_GET_IC_VALUES_REPLY,
- 0,
- reply,
- total_size);
- XFree (reply);
- XFree (attrID_list);
-
- for (i = 0; i < (int) getic->ic_attr_num; i++)
- {
- if (getic->ic_attr[i].name)
- XFree (getic->ic_attr[i].name);
- /*endif*/
- if (getic->ic_attr[i].value)
- XFree (getic->ic_attr[i].value);
- /*endif*/
- }
- /*endfor*/
- for (i = 0; i < (int) getic->preedit_attr_num; i++)
- {
- if (getic->preedit_attr[i].name)
- XFree (getic->preedit_attr[i].name);
- /*endif*/
- if (getic->preedit_attr[i].value)
- XFree (getic->preedit_attr[i].value);
- /*endif*/
- }
- /*endfor*/
- for (i = 0; i < (int) getic->status_attr_num; i++)
- {
- if (getic->status_attr[i].name)
- XFree (getic->status_attr[i].name);
- /*endif*/
- if (getic->status_attr[i].value)
- XFree (getic->status_attr[i].value);
- /*endif*/
- }
- /*endfor*/
-
- if (preedit_ret)
- {
- XFree (preedit_ret->value);
- XFree (preedit_ret);
- }
- /*endif*/
- if (status_ret)
- {
- XFree (status_ret->value);
- XFree (status_ret);
- }
- /*endif*/
- FrameMgrFree (fm);
-}
diff --git a/x11/IMdkit/i18nMethod.c b/x11/IMdkit/i18nMethod.c
deleted file mode 100644
index 203f831..0000000
--- a/x11/IMdkit/i18nMethod.c
+++ /dev/null
@@ -1,1150 +0,0 @@
-/******************************************************************
-
- Copyright 1994, 1995 by Sun Microsystems, Inc.
- Copyright 1993, 1994 by Hewlett-Packard Company
-
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and
-that both that copyright notice and this permission notice appear
-in supporting documentation, and that the name of Sun Microsystems, Inc.
-and Hewlett-Packard not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior permission.
-Sun Microsystems, Inc. and Hewlett-Packard make no representations about
-the suitability of this software for any purpose. It is provided "as is"
-without express or implied warranty.
-
-SUN MICROSYSTEMS INC. AND HEWLETT-PACKARD COMPANY DISCLAIMS ALL
-WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-SUN MICROSYSTEMS, INC. AND HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY
-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
- Author: Hidetoshi Tajima(tajima@Eng.Sun.COM) Sun Microsystems, Inc.
-
- This version tidied and debugged by Steve Underwood May 1999
-
-******************************************************************/
-
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#ifndef NEED_EVENTS
-#define NEED_EVENTS
-#endif
-#include <X11/Xproto.h>
-#undef NEED_EVENTS
-#include "FrameMgr.h"
-#include "IMdkit.h"
-#include "Xi18n.h"
-#include "XimFunc.h"
-
-extern Xi18nClient *_Xi18nFindClient (Xi18n, CARD16);
-
-static void *xi18n_setup (Display *, XIMArg *);
-static Status xi18n_openIM (XIMS);
-static Status xi18n_closeIM (XIMS);
-static char *xi18n_setIMValues (XIMS, XIMArg *);
-static char *xi18n_getIMValues (XIMS, XIMArg *);
-static Status xi18n_forwardEvent (XIMS, XPointer);
-static Status xi18n_commit (XIMS, XPointer);
-static int xi18n_callCallback (XIMS, XPointer);
-static int xi18n_preeditStart (XIMS, XPointer);
-static int xi18n_preeditEnd (XIMS, XPointer);
-static int xi18n_syncXlib (XIMS, XPointer);
-
-#ifndef XIM_SERVERS
-#define XIM_SERVERS "XIM_SERVERS"
-#endif
-static Atom XIM_Servers = None;
-
-
-IMMethodsRec Xi18n_im_methods =
-{
- xi18n_setup,
- xi18n_openIM,
- xi18n_closeIM,
- xi18n_setIMValues,
- xi18n_getIMValues,
- xi18n_forwardEvent,
- xi18n_commit,
- xi18n_callCallback,
- xi18n_preeditStart,
- xi18n_preeditEnd,
- xi18n_syncXlib,
-};
-
-extern Bool _Xi18nCheckXAddress (Xi18n, TransportSW *, char *);
-extern Bool _Xi18nCheckTransAddress (Xi18n, TransportSW *, char *);
-
-TransportSW _TransR[] =
-{
- {"X", 1, _Xi18nCheckXAddress},
-#ifdef TCPCONN
- {"tcp", 3, _Xi18nCheckTransAddress},
- {"local", 5, _Xi18nCheckTransAddress},
-#endif
-#ifdef DNETCONN
- {"decnet", 6, _Xi18nCheckTransAddress},
-#endif
- {(char *) NULL, 0, (Bool (*) ()) NULL}
-};
-
-static Bool GetInputStyles (Xi18n i18n_core, XIMStyles **p_style)
-{
- Xi18nAddressRec *address = (Xi18nAddressRec *) &i18n_core->address;
- XIMStyles *p;
- int i;
-
- p = &address->input_styles;
- if ((*p_style = (XIMStyles *) malloc (sizeof (XIMStyles)
- + p->count_styles*sizeof (XIMStyle)))
- == NULL)
- {
- return False;
- }
- /*endif*/
- (*p_style)->count_styles = p->count_styles;
- (*p_style)->supported_styles = (XIMStyle *) ((XPointer) *p_style + sizeof (XIMStyles));
- for (i = 0; i < (int) p->count_styles; i++)
- (*p_style)->supported_styles[i] = p->supported_styles[i];
- /*endfor*/
- return True;
-}
-
-static Bool GetOnOffKeys (Xi18n i18n_core, long mask, XIMTriggerKeys **p_key)
-{
- Xi18nAddressRec *address = (Xi18nAddressRec *) &i18n_core->address;
- XIMTriggerKeys *p;
- int i;
-
- if (mask & I18N_ON_KEYS)
- p = &address->on_keys;
- else
- p = &address->off_keys;
- /*endif*/
- if ((*p_key = (XIMTriggerKeys *) malloc (sizeof(XIMTriggerKeys)
- + p->count_keys*sizeof(XIMTriggerKey)))
- == NULL)
- {
- return False;
- }
- /*endif*/
- (*p_key)->count_keys = p->count_keys;
- (*p_key)->keylist =
- (XIMTriggerKey *) ((XPointer) *p_key + sizeof(XIMTriggerKeys));
- for (i = 0; i < (int) p->count_keys; i++)
- {
- (*p_key)->keylist[i].keysym = p->keylist[i].keysym;
- (*p_key)->keylist[i].modifier = p->keylist[i].modifier;
- (*p_key)->keylist[i].modifier_mask = p->keylist[i].modifier_mask;
- }
- /*endfor*/
- return True;
-}
-
-static Bool GetEncodings(Xi18n i18n_core, XIMEncodings **p_encoding)
-{
- Xi18nAddressRec *address = (Xi18nAddressRec *) &i18n_core->address;
- XIMEncodings *p;
- int i;
-
- p = &address->encoding_list;
-
- if ((*p_encoding = (XIMEncodings *) malloc (sizeof (XIMEncodings)
- + p->count_encodings*sizeof(XIMEncoding))) == NULL)
- {
- return False;
- }
- /*endif*/
- (*p_encoding)->count_encodings = p->count_encodings;
- (*p_encoding)->supported_encodings =
- (XIMEncoding *) ((XPointer)*p_encoding + sizeof (XIMEncodings));
- for (i = 0; i < (int) p->count_encodings; i++)
- {
- (*p_encoding)->supported_encodings[i]
- = (char *) malloc (strlen (p->supported_encodings[i]) + 1);
- strcpy ((*p_encoding)->supported_encodings[i],
- p->supported_encodings[i]);
- }
- /*endif*/
- return True;
-}
-
-static char *ParseArgs (Xi18n i18n_core, int mode, XIMArg *args)
-{
- Xi18nAddressRec *address = (Xi18nAddressRec *) &i18n_core->address;
- XIMArg *p;
-
- if (mode == I18N_OPEN || mode == I18N_SET)
- {
- for (p = args; p->name != NULL; p++)
- {
- if (strcmp (p->name, IMLocale) == 0)
- {
- if (address->imvalue_mask & I18N_IM_LOCALE)
- return IMLocale;
- /*endif*/
- address->im_locale = (char *) malloc (strlen (p->value) + 1);
- if (!address->im_locale)
- return IMLocale;
- /*endif*/
- strcpy (address->im_locale, p->value);
- address->imvalue_mask |= I18N_IM_LOCALE;
- }
- else if (strcmp (p->name, IMServerTransport) == 0)
- {
- if (address->imvalue_mask & I18N_IM_ADDRESS)
- return IMServerTransport;
- /*endif*/
- address->im_addr = (char *) malloc (strlen (p->value) + 1);
- if (!address->im_addr)
- return IMServerTransport;
- /*endif*/
- strcpy(address->im_addr, p->value);
- address->imvalue_mask |= I18N_IM_ADDRESS;
- }
- else if (strcmp (p->name, IMServerName) == 0)
- {
- if (address->imvalue_mask & I18N_IM_NAME)
- return IMServerName;
- /*endif*/
- address->im_name = (char *) malloc (strlen (p->value) + 1);
- if (!address->im_name)
- return IMServerName;
- /*endif*/
- strcpy (address->im_name, p->value);
- address->imvalue_mask |= I18N_IM_NAME;
- }
- else if (strcmp (p->name, IMServerWindow) == 0)
- {
- if (address->imvalue_mask & I18N_IMSERVER_WIN)
- return IMServerWindow;
- /*endif*/
- address->im_window = (Window) p->value;
- address->imvalue_mask |= I18N_IMSERVER_WIN;
- }
- else if (strcmp (p->name, IMInputStyles) == 0)
- {
- if (address->imvalue_mask & I18N_INPUT_STYLES)
- return IMInputStyles;
- /*endif*/
- address->input_styles.count_styles =
- ((XIMStyles*)p->value)->count_styles;
- address->input_styles.supported_styles =
- (XIMStyle *) malloc (sizeof (XIMStyle)*address->input_styles.count_styles);
- if (address->input_styles.supported_styles == (XIMStyle *) NULL)
- return IMInputStyles;
- /*endif*/
- memmove (address->input_styles.supported_styles,
- ((XIMStyles *) p->value)->supported_styles,
- sizeof (XIMStyle)*address->input_styles.count_styles);
- address->imvalue_mask |= I18N_INPUT_STYLES;
- }
- else if (strcmp (p->name, IMProtocolHandler) == 0)
- {
- address->improto = (IMProtoHandler) p->value;
- address->imvalue_mask |= I18N_IM_HANDLER;
- }
- else if (strcmp (p->name, IMOnKeysList) == 0)
- {
- if (address->imvalue_mask & I18N_ON_KEYS)
- return IMOnKeysList;
- /*endif*/
- address->on_keys.count_keys =
- ((XIMTriggerKeys *) p->value)->count_keys;
- address->on_keys.keylist =
- (XIMTriggerKey *) malloc (sizeof (XIMTriggerKey)*address->on_keys.count_keys);
- if (address->on_keys.keylist == (XIMTriggerKey *) NULL)
- return IMOnKeysList;
- /*endif*/
- memmove (address->on_keys.keylist,
- ((XIMTriggerKeys *) p->value)->keylist,
- sizeof (XIMTriggerKey)*address->on_keys.count_keys);
- address->imvalue_mask |= I18N_ON_KEYS;
- }
- else if (strcmp (p->name, IMOffKeysList) == 0)
- {
- if (address->imvalue_mask & I18N_OFF_KEYS)
- return IMOffKeysList;
- /*endif*/
- address->off_keys.count_keys =
- ((XIMTriggerKeys *) p->value)->count_keys;
- address->off_keys.keylist =
- (XIMTriggerKey *) malloc (sizeof (XIMTriggerKey)*address->off_keys.count_keys);
- if (address->off_keys.keylist == (XIMTriggerKey *) NULL)
- return IMOffKeysList;
- /*endif*/
- memmove (address->off_keys.keylist,
- ((XIMTriggerKeys *) p->value)->keylist,
- sizeof (XIMTriggerKey)*address->off_keys.count_keys);
- address->imvalue_mask |= I18N_OFF_KEYS;
- }
- else if (strcmp (p->name, IMEncodingList) == 0)
- {
- if (address->imvalue_mask & I18N_ENCODINGS)
- return IMEncodingList;
- /*endif*/
- address->encoding_list.count_encodings =
- ((XIMEncodings *) p->value)->count_encodings;
- address->encoding_list.supported_encodings =
- (XIMEncoding *) malloc (sizeof (XIMEncoding)*address->encoding_list.count_encodings);
- if (address->encoding_list.supported_encodings
- == (XIMEncoding *) NULL)
- {
- return IMEncodingList;
- }
- /*endif*/
- memmove (address->encoding_list.supported_encodings,
- ((XIMEncodings *) p->value)->supported_encodings,
- sizeof (XIMEncoding)*address->encoding_list.count_encodings);
- address->imvalue_mask |= I18N_ENCODINGS;
- }
- else if (strcmp (p->name, IMFilterEventMask) == 0)
- {
- if (address->imvalue_mask & I18N_FILTERMASK)
- return IMFilterEventMask;
- /*endif*/
- address->filterevent_mask = (long) p->value;
- address->imvalue_mask |= I18N_FILTERMASK;
- }
- /*endif*/
- }
- /*endfor*/
- if (mode == I18N_OPEN)
- {
- /* check mandatory IM values */
- if (!(address->imvalue_mask & I18N_IM_LOCALE))
- {
- /* locales must be set in IMOpenIM */
- return IMLocale;
- }
- /*endif*/
- if (!(address->imvalue_mask & I18N_IM_ADDRESS))
- {
- /* address must be set in IMOpenIM */
- return IMServerTransport;
- }
- /*endif*/
- }
- /*endif*/
- }
- else if (mode == I18N_GET)
- {
- for (p = args; p->name != NULL; p++)
- {
- if (strcmp (p->name, IMLocale) == 0)
- {
- p->value = (char *) malloc (strlen (address->im_locale) + 1);
- if (!p->value)
- return IMLocale;
- /*endif*/
- strcpy (p->value, address->im_locale);
- }
- else if (strcmp (p->name, IMServerTransport) == 0)
- {
- p->value = (char *) malloc (strlen (address->im_addr) + 1);
- if (!p->value)
- return IMServerTransport;
- /*endif*/
- strcpy (p->value, address->im_addr);
- }
- else if (strcmp (p->name, IMServerName) == 0)
- {
- if (address->imvalue_mask & I18N_IM_NAME)
- {
- p->value = (char *) malloc (strlen (address->im_name) + 1);
- if (!p->value)
- return IMServerName;
- /*endif*/
- strcpy (p->value, address->im_name);
- }
- else
- {
- return IMServerName;
- }
- /*endif*/
- }
- else if (strcmp (p->name, IMServerWindow) == 0)
- {
- if (address->imvalue_mask & I18N_IMSERVER_WIN)
- *((Window *) (p->value)) = address->im_window;
- else
- return IMServerWindow;
- /*endif*/
- }
- else if (strcmp (p->name, IMInputStyles) == 0)
- {
- if (GetInputStyles (i18n_core,
- (XIMStyles **) p->value) == False)
- {
- return IMInputStyles;
- }
- /*endif*/
- }
- else if (strcmp (p->name, IMProtocolHandler) == 0)
- {
- if (address->imvalue_mask & I18N_IM_HANDLER)
- *((IMProtoHandler *) (p->value)) = address->improto;
- else
- return IMProtocolHandler;
- /*endif*/
- }
- else if (strcmp (p->name, IMOnKeysList) == 0)
- {
- if (address->imvalue_mask & I18N_ON_KEYS)
- {
- if (GetOnOffKeys (i18n_core,
- I18N_ON_KEYS,
- (XIMTriggerKeys **) p->value) == False)
- {
- return IMOnKeysList;
- }
- /*endif*/
- }
- else
- {
- return IMOnKeysList;
- }
- /*endif*/
- }
- else if (strcmp (p->name, IMOffKeysList) == 0)
- {
- if (address->imvalue_mask & I18N_OFF_KEYS)
- {
- if (GetOnOffKeys (i18n_core,
- I18N_OFF_KEYS,
- (XIMTriggerKeys **) p->value) == False)
- {
- return IMOffKeysList;
- }
- /*endif*/
- }
- else
- {
- return IMOffKeysList;
- }
- /*endif*/
- }
- else if (strcmp (p->name, IMEncodingList) == 0)
- {
- if (address->imvalue_mask & I18N_ENCODINGS)
- {
- if (GetEncodings (i18n_core,
- (XIMEncodings **) p->value) == False)
- {
- return IMEncodingList;
- }
- /*endif*/
- }
- else
- {
- return IMEncodingList;
- }
- /*endif*/
- }
- else if (strcmp (p->name, IMFilterEventMask) == 0)
- {
- if (address->imvalue_mask & I18N_FILTERMASK)
- *((long *) (p->value)) = address->filterevent_mask;
- else
- return IMFilterEventMask;
- /*endif*/
- }
- /*endif*/
- }
- /*endfor*/
- }
- /*endif*/
- return NULL;
-}
-
-static int CheckIMName (Xi18n i18n_core)
-{
- char *address = i18n_core->address.im_addr;
- int i;
-
- for (i = 0; _TransR[i].transportname; i++)
- {
- while (*address == ' ' || *address == '\t')
- address++;
- /*endwhile*/
- if (strncmp (address,
- _TransR[i].transportname,
- _TransR[i].namelen) == 0
- &&
- address[_TransR[i].namelen] == '/')
- {
- if (_TransR[i].checkAddr (i18n_core,
- &_TransR[i],
- address + _TransR[i].namelen + 1) == True)
- {
- return True;
- }
- /*endif*/
- return False;
- }
- /*endif*/
- }
- /*endfor*/
- return False;
-}
-
-static int SetXi18nSelectionOwner(Xi18n i18n_core)
-{
- Display *dpy = i18n_core->address.dpy;
- Window ims_win = i18n_core->address.im_window;
- Window root = RootWindow (dpy, DefaultScreen (dpy));
- Atom realtype;
- int realformat;
- unsigned long bytesafter;
- long *data=NULL;
- unsigned long length;
- Atom atom;
- int i;
- int found;
- int forse = False;
- char buf[256];
-
- (void)snprintf(buf, 256, "@server=%s", i18n_core->address.im_name);
- if ((atom = XInternAtom(dpy, buf, False)) == 0)
- return False;
- i18n_core->address.selection = atom;
-
- if (XIM_Servers == None)
- XIM_Servers = XInternAtom (dpy, XIM_SERVERS, False);
- /*endif*/
- XGetWindowProperty (dpy,
- root,
- XIM_Servers,
- 0L,
- 1000000L,
- False,
- XA_ATOM,
- &realtype,
- &realformat,
- &length,
- &bytesafter,
- (unsigned char **) (&data));
- if (realtype != None && (realtype != XA_ATOM || realformat != 32)) {
- if (data != NULL)
- XFree ((char *) data);
- return False;
- }
-
- found = False;
- for (i = 0; i < length; i++) {
- if (data[i] == atom) {
- Window owner;
- found = True;
- if ((owner = XGetSelectionOwner (dpy, atom)) != ims_win) {
- if (owner == None || forse == True)
- XSetSelectionOwner (dpy, atom, ims_win, CurrentTime);
- else
- return False;
- }
- break;
- }
- }
-
- if (found == False) {
- XSetSelectionOwner (dpy, atom, ims_win, CurrentTime);
- XChangeProperty (dpy,
- root,
- XIM_Servers,
- XA_ATOM,
- 32,
- PropModePrepend,
- (unsigned char *) &atom,
- 1);
- }
- else {
- /*
- * We always need to generate the PropertyNotify to the Root Window
- */
- XChangeProperty (dpy,
- root,
- XIM_Servers,
- XA_ATOM,
- 32,
- PropModePrepend,
- (unsigned char *) data,
- 0);
- }
- if (data != NULL)
- XFree ((char *) data);
-
- /* Intern "LOCALES" and "TRANSOPORT" Target Atoms */
- i18n_core->address.Localename = XInternAtom (dpy, LOCALES, False);
- i18n_core->address.Transportname = XInternAtom (dpy, TRANSPORT, False);
- return (XGetSelectionOwner (dpy, atom) == ims_win);
-}
-
-static int DeleteXi18nAtom(Xi18n i18n_core)
-{
- Display *dpy = i18n_core->address.dpy;
- Window root = RootWindow (dpy, DefaultScreen (dpy));
- Atom realtype;
- int realformat;
- unsigned long bytesafter;
- long *data=NULL;
- unsigned long length;
- Atom atom;
- int i, ret;
- int found;
- char buf[256];
-
- (void)snprintf(buf, 256, "@server=%s", i18n_core->address.im_name);
- if ((atom = XInternAtom(dpy, buf, False)) == 0)
- return False;
- i18n_core->address.selection = atom;
-
- if (XIM_Servers == None)
- XIM_Servers = XInternAtom (dpy, XIM_SERVERS, False);
- XGetWindowProperty (dpy,
- root,
- XIM_Servers,
- 0L,
- 1000000L,
- False,
- XA_ATOM,
- &realtype,
- &realformat,
- &length,
- &bytesafter,
- (unsigned char **) (&data));
- if (realtype != XA_ATOM || realformat != 32) {
- if (data != NULL)
- XFree ((char *) data);
- return False;
- }
-
- found = False;
- for (i = 0; i < length; i++) {
- if (data[i] == atom) {
- found = True;
- break;
- }
- }
-
- if (found == True) {
- for (i=i+1; i<length; i++)
- data[i-1] = data[i];
- XChangeProperty (dpy,
- root,
- XIM_Servers,
- XA_ATOM,
- 32,
- PropModeReplace,
- (unsigned char *)data,
- length-1);
- ret = True;
- }
- else {
- XChangeProperty (dpy,
- root,
- XIM_Servers,
- XA_ATOM,
- 32,
- PropModePrepend,
- (unsigned char *)data,
- 0);
- ret = False;
- }
- if (data != NULL)
- XFree ((char *) data);
- return ret;
-}
-
-
-/* XIM protocol methods */
-static void *xi18n_setup (Display *dpy, XIMArg *args)
-{
- Xi18n i18n_core;
- CARD16 endian = 1;
-
- if ((i18n_core = (Xi18n) malloc (sizeof (Xi18nCore))) == (Xi18n) NULL)
- return NULL;
- /*endif*/
-
- memset (i18n_core, 0, sizeof (Xi18nCore));
-
- i18n_core->address.dpy = dpy;
-
- if (ParseArgs (i18n_core, I18N_OPEN, args) != NULL)
- {
- XFree (i18n_core);
- return NULL;
- }
- /*endif*/
- if (*(char *) &endian)
- i18n_core->address.im_byteOrder = 'l';
- else
- i18n_core->address.im_byteOrder = 'B';
- /*endif*/
-
- /* install IMAttr and ICAttr list in i18n_core */
- _Xi18nInitAttrList (i18n_core);
-
- /* install IMExtension list in i18n_core */
- _Xi18nInitExtension (i18n_core);
-
- return i18n_core;
-}
-
-static void ReturnSelectionNotify (Xi18n i18n_core, XSelectionRequestEvent *ev)
-{
- XEvent event;
- Display *dpy = i18n_core->address.dpy;
- char buf[4096];
-
- event.type = SelectionNotify;
- event.xselection.requestor = ev->requestor;
- event.xselection.selection = ev->selection;
- event.xselection.target = ev->target;
- event.xselection.time = ev->time;
- event.xselection.property = ev->property;
- if (ev->target == i18n_core->address.Localename)
- {
- snprintf (buf, 4096, "@locale=%s", i18n_core->address.im_locale);
- }
- else if (ev->target == i18n_core->address.Transportname)
- {
- snprintf (buf, 4096, "@transport=%s", i18n_core->address.im_addr);
- }
- /*endif*/
- XChangeProperty (dpy,
- event.xselection.requestor,
- ev->target,
- ev->target,
- 8,
- PropModeReplace,
- (unsigned char *) buf,
- strlen (buf));
- XSendEvent (dpy, event.xselection.requestor, False, NoEventMask, &event);
- XFlush (i18n_core->address.dpy);
-}
-
-static Bool WaitXSelectionRequest (Display *dpy,
- Window win,
- XEvent *ev,
- XPointer client_data)
-{
- XIMS ims = (XIMS) client_data;
- Xi18n i18n_core = ims->protocol;
-
- if (((XSelectionRequestEvent *) ev)->selection
- == i18n_core->address.selection)
- {
- ReturnSelectionNotify (i18n_core, (XSelectionRequestEvent *) ev);
- return True;
- }
- /*endif*/
- return False;
-}
-
-static Status xi18n_openIM(XIMS ims)
-{
- Xi18n i18n_core = ims->protocol;
- Display *dpy = i18n_core->address.dpy;
-
- if (!CheckIMName (i18n_core)
- ||
- !SetXi18nSelectionOwner (i18n_core)
- ||
- !i18n_core->methods.begin (ims))
- {
- XFree (i18n_core->address.im_name);
- XFree (i18n_core->address.im_locale);
- XFree (i18n_core->address.im_addr);
- XFree (i18n_core);
- return False;
- }
- /*endif*/
-
- _XRegisterFilterByType (dpy,
- i18n_core->address.im_window,
- SelectionRequest,
- SelectionRequest,
- WaitXSelectionRequest,
- (XPointer)ims);
- XFlush(dpy);
- return True;
-}
-
-static Status xi18n_closeIM(XIMS ims)
-{
- Xi18n i18n_core = ims->protocol;
- Display *dpy = i18n_core->address.dpy;
-
- DeleteXi18nAtom(i18n_core);
- if (!i18n_core->methods.end (ims))
- return False;
-
- _XUnregisterFilter (dpy,
- i18n_core->address.im_window,
- WaitXSelectionRequest,
- (XPointer)ims);
- XFree (i18n_core->address.im_name);
- XFree (i18n_core->address.im_locale);
- XFree (i18n_core->address.im_addr);
- XFree (i18n_core);
- return True;
-}
-
-static char *xi18n_setIMValues (XIMS ims, XIMArg *args)
-{
- Xi18n i18n_core = ims->protocol;
- char *ret;
-
- if ((ret = ParseArgs (i18n_core, I18N_SET, args)) != NULL)
- return ret;
- /*endif*/
- return NULL;
-}
-
-static char *xi18n_getIMValues (XIMS ims, XIMArg *args)
-{
- Xi18n i18n_core = ims->protocol;
- char *ret;
-
- if ((ret = ParseArgs (i18n_core, I18N_GET, args)) != NULL)
- return ret;
- /*endif*/
- return NULL;
-}
-
-static void EventToWireEvent (XEvent *ev, xEvent *event,
- CARD16 *serial, Bool byte_swap)
-{
- FrameMgr fm;
- extern XimFrameRec wire_keyevent_fr[];
- extern XimFrameRec short_fr[];
- BYTE b;
- CARD16 c16;
- CARD32 c32;
-
- *serial = (CARD16)(ev->xany.serial >> 16);
- switch (ev->type) {
- case KeyPress:
- case KeyRelease:
- {
- XKeyEvent *kev = (XKeyEvent*)ev;
- /* create FrameMgr */
- fm = FrameMgrInit(wire_keyevent_fr, (char *)(&(event->u)), byte_swap);
-
- /* set values */
- b = (BYTE)kev->type; FrameMgrPutToken(fm, b);
- b = (BYTE)kev->keycode; FrameMgrPutToken(fm, b);
- c16 = (CARD16)(kev->serial & (unsigned long)0xffff);
- FrameMgrPutToken(fm, c16);
- c32 = (CARD32)kev->time; FrameMgrPutToken(fm, c32);
- c32 = (CARD32)kev->root; FrameMgrPutToken(fm, c32);
- c32 = (CARD32)kev->window; FrameMgrPutToken(fm, c32);
- c32 = (CARD32)kev->subwindow; FrameMgrPutToken(fm, c32);
- c16 = (CARD16)kev->x_root; FrameMgrPutToken(fm, c16);
- c16 = (CARD16)kev->y_root; FrameMgrPutToken(fm, c16);
- c16 = (CARD16)kev->x; FrameMgrPutToken(fm, c16);
- c16 = (CARD16)kev->y; FrameMgrPutToken(fm, c16);
- c16 = (CARD16)kev->state; FrameMgrPutToken(fm, c16);
- b = (BYTE)kev->same_screen; FrameMgrPutToken(fm, b);
- }
- break;
- default:
- /* create FrameMgr */
- fm = FrameMgrInit(short_fr, (char *)(&(event->u.u.sequenceNumber)),
- byte_swap);
- c16 = (CARD16)(ev->xany.serial & (unsigned long)0xffff);
- FrameMgrPutToken(fm, c16);
- break;
- }
- /* free FrameMgr */
- FrameMgrFree(fm);
-}
-
-static Status xi18n_forwardEvent (XIMS ims, XPointer xp)
-{
- Xi18n i18n_core = ims->protocol;
- IMForwardEventStruct *call_data = (IMForwardEventStruct *)xp;
- FrameMgr fm;
- extern XimFrameRec forward_event_fr[];
- register int total_size;
- unsigned char *reply = NULL;
- unsigned char *replyp;
- CARD16 serial;
- int event_size;
- Xi18nClient *client;
-
- client = (Xi18nClient *) _Xi18nFindClient (i18n_core, call_data->connect_id);
-
- /* create FrameMgr */
- fm = FrameMgrInit (forward_event_fr,
- NULL,
- _Xi18nNeedSwap (i18n_core, call_data->connect_id));
-
- total_size = FrameMgrGetTotalSize (fm);
- event_size = sizeof (xEvent);
- reply = (unsigned char *) malloc (total_size + event_size);
- if (!reply)
- {
- _Xi18nSendMessage (ims,
- call_data->connect_id,
- XIM_ERROR,
- 0,
- 0,
- 0);
- return False;
- }
- /*endif*/
- memset (reply, 0, total_size + event_size);
- FrameMgrSetBuffer (fm, reply);
- replyp = reply;
-
- call_data->sync_bit = 1; /* always sync */
- client->sync = True;
-
- FrameMgrPutToken (fm, call_data->connect_id);
- FrameMgrPutToken (fm, call_data->icid);
- FrameMgrPutToken (fm, call_data->sync_bit);
-
- replyp += total_size;
- EventToWireEvent (&(call_data->event),
- (xEvent *) replyp,
- &serial,
- _Xi18nNeedSwap (i18n_core, call_data->connect_id));
-
- FrameMgrPutToken (fm, serial);
-
- _Xi18nSendMessage (ims,
- call_data->connect_id,
- XIM_FORWARD_EVENT,
- 0,
- reply,
- total_size + event_size);
-
- XFree (reply);
- FrameMgrFree (fm);
-
- return True;
-}
-
-static Status xi18n_commit (XIMS ims, XPointer xp)
-{
- Xi18n i18n_core = ims->protocol;
- IMCommitStruct *call_data = (IMCommitStruct *)xp;
- FrameMgr fm;
- extern XimFrameRec commit_chars_fr[];
- extern XimFrameRec commit_both_fr[];
- register int total_size;
- unsigned char *reply = NULL;
- CARD16 str_length;
-
- call_data->flag |= XimSYNCHRONUS; /* always sync */
-
- if (!(call_data->flag & XimLookupKeySym)
- &&
- (call_data->flag & XimLookupChars))
- {
- fm = FrameMgrInit (commit_chars_fr,
- NULL,
- _Xi18nNeedSwap (i18n_core, call_data->connect_id));
-
- /* set length of STRING8 */
- str_length = strlen (call_data->commit_string);
- FrameMgrSetSize (fm, str_length);
- total_size = FrameMgrGetTotalSize (fm);
- reply = (unsigned char *) malloc (total_size);
- if (!reply)
- {
- _Xi18nSendMessage (ims,
- call_data->connect_id,
- XIM_ERROR,
- 0,
- 0,
- 0);
- return False;
- }
- /*endif*/
- memset (reply, 0, total_size);
- FrameMgrSetBuffer (fm, reply);
-
- str_length = FrameMgrGetSize (fm);
- FrameMgrPutToken (fm, call_data->connect_id);
- FrameMgrPutToken (fm, call_data->icid);
- FrameMgrPutToken (fm, call_data->flag);
- FrameMgrPutToken (fm, str_length);
- FrameMgrPutToken (fm, call_data->commit_string);
- }
- else
- {
- fm = FrameMgrInit (commit_both_fr,
- NULL,
- _Xi18nNeedSwap (i18n_core, call_data->connect_id));
- /* set length of STRING8 */
- str_length = strlen (call_data->commit_string);
- if (str_length > 0)
- FrameMgrSetSize (fm, str_length);
- /*endif*/
- total_size = FrameMgrGetTotalSize (fm);
- reply = (unsigned char *) malloc (total_size);
- if (!reply)
- {
- _Xi18nSendMessage (ims,
- call_data->connect_id,
- XIM_ERROR,
- 0,
- 0,
- 0);
- return False;
- }
- /*endif*/
- FrameMgrSetBuffer (fm, reply);
- FrameMgrPutToken (fm, call_data->connect_id);
- FrameMgrPutToken (fm, call_data->icid);
- FrameMgrPutToken (fm, call_data->flag);
- FrameMgrPutToken (fm, call_data->keysym);
- if (str_length > 0)
- {
- str_length = FrameMgrGetSize (fm);
- FrameMgrPutToken (fm, str_length);
- FrameMgrPutToken (fm, call_data->commit_string);
- }
- /*endif*/
- }
- /*endif*/
- _Xi18nSendMessage (ims,
- call_data->connect_id,
- XIM_COMMIT,
- 0,
- reply,
- total_size);
- FrameMgrFree (fm);
- XFree (reply);
-
- return True;
-}
-
-static int xi18n_callCallback (XIMS ims, XPointer xp)
-{
- IMProtocol *call_data = (IMProtocol *)xp;
- switch (call_data->major_code)
- {
- case XIM_GEOMETRY:
- return _Xi18nGeometryCallback (ims, call_data);
-
- case XIM_PREEDIT_START:
- return _Xi18nPreeditStartCallback (ims, call_data);
-
- case XIM_PREEDIT_DRAW:
- return _Xi18nPreeditDrawCallback (ims, call_data);
-
- case XIM_PREEDIT_CARET:
- return _Xi18nPreeditCaretCallback (ims, call_data);
-
- case XIM_PREEDIT_DONE:
- return _Xi18nPreeditDoneCallback (ims, call_data);
-
- case XIM_STATUS_START:
- return _Xi18nStatusStartCallback (ims, call_data);
-
- case XIM_STATUS_DRAW:
- return _Xi18nStatusDrawCallback (ims, call_data);
-
- case XIM_STATUS_DONE:
- return _Xi18nStatusDoneCallback (ims, call_data);
-
- case XIM_STR_CONVERSION:
- return _Xi18nStringConversionCallback (ims, call_data);
- }
- /*endswitch*/
- return False;
-}
-
-/* preeditStart and preeditEnd are used only for Dynamic Event Flow. */
-static int xi18n_preeditStart (XIMS ims, XPointer xp)
-{
- IMProtocol *call_data = (IMProtocol *)xp;
- Xi18n i18n_core = ims->protocol;
- IMPreeditStateStruct *preedit_state =
- (IMPreeditStateStruct *) &call_data->preedit_state;
- long mask;
- int on_key_num = i18n_core->address.on_keys.count_keys;
- int off_key_num = i18n_core->address.off_keys.count_keys;
-
- if (on_key_num == 0 && off_key_num == 0)
- return False;
- /*endif*/
- if (i18n_core->address.imvalue_mask & I18N_FILTERMASK)
- mask = i18n_core->address.filterevent_mask;
- else
- mask = DEFAULT_FILTER_MASK;
- /*endif*/
- _Xi18nSetEventMask (ims,
- preedit_state->connect_id,
- preedit_state->connect_id,
- preedit_state->icid,
- mask,
- ~mask);
- return True;
-}
-
-static int xi18n_preeditEnd (XIMS ims, XPointer xp)
-{
- IMProtocol *call_data = (IMProtocol *)xp;
- Xi18n i18n_core = ims->protocol;
- int on_key_num = i18n_core->address.on_keys.count_keys;
- int off_key_num = i18n_core->address.off_keys.count_keys;
- IMPreeditStateStruct *preedit_state;
-
- preedit_state = (IMPreeditStateStruct *) &call_data->preedit_state;
-
- if (on_key_num == 0 && off_key_num == 0)
- return False;
- /*endif*/
-
- _Xi18nSetEventMask (ims,
- preedit_state->connect_id,
- preedit_state->connect_id,
- preedit_state->icid,
- 0,
- 0);
- return True;
-}
-
-static int xi18n_syncXlib (XIMS ims, XPointer xp)
-{
- IMProtocol *call_data = (IMProtocol *)xp;
- Xi18n i18n_core = ims->protocol;
- IMSyncXlibStruct *sync_xlib;
-
- extern XimFrameRec sync_fr[];
- FrameMgr fm;
- CARD16 connect_id = call_data->any.connect_id;
- int total_size;
- unsigned char *reply;
-
- sync_xlib = (IMSyncXlibStruct *) &call_data->sync_xlib;
- fm = FrameMgrInit (sync_fr, NULL,
- _Xi18nNeedSwap (i18n_core, connect_id));
- total_size = FrameMgrGetTotalSize(fm);
- reply = (unsigned char *) malloc (total_size);
- if (!reply) {
- _Xi18nSendMessage (ims, connect_id, XIM_ERROR, 0, 0, 0);
- return False;
- }
- memset (reply, 0, total_size);
- FrameMgrSetBuffer (fm, reply);
-
- /* input input-method ID */
- FrameMgrPutToken (fm, connect_id);
- /* input input-context ID */
- FrameMgrPutToken (fm, sync_xlib->icid);
- _Xi18nSendMessage (ims, connect_id, XIM_SYNC, 0, reply, total_size);
-
- FrameMgrFree (fm);
- XFree(reply);
- return True;
-}
-
diff --git a/x11/IMdkit/i18nPtHdr.c b/x11/IMdkit/i18nPtHdr.c
deleted file mode 100644
index d350354..0000000
--- a/x11/IMdkit/i18nPtHdr.c
+++ /dev/null
@@ -1,1848 +0,0 @@
-/******************************************************************
-
- Copyright 1994, 1995 by Sun Microsystems, Inc.
- Copyright 1993, 1994 by Hewlett-Packard Company
-
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and
-that both that copyright notice and this permission notice appear
-in supporting documentation, and that the name of Sun Microsystems, Inc.
-and Hewlett-Packard not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior permission.
-Sun Microsystems, Inc. and Hewlett-Packard make no representations about
-the suitability of this software for any purpose. It is provided "as is"
-without express or implied warranty.
-
-SUN MICROSYSTEMS INC. AND HEWLETT-PACKARD COMPANY DISCLAIMS ALL
-WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-SUN MICROSYSTEMS, INC. AND HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY
-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
- Author: Hidetoshi Tajima(tajima@Eng.Sun.COM) Sun Microsystems, Inc.
-
- This version tidied and debugged by Steve Underwood May 1999
-
-******************************************************************/
-
-#include <stdlib.h>
-#include <sys/param.h>
-#include <X11/Xlib.h>
-#ifndef NEED_EVENTS
-#define NEED_EVENTS
-#endif
-#include <X11/Xproto.h>
-#undef NEED_EVENTS
-#include "FrameMgr.h"
-#include "IMdkit.h"
-#include "Xi18n.h"
-#include "XimFunc.h"
-
-#ifdef XIM_DEBUG
-#include <stdio.h>
-
-static void DebugLog(char * msg)
-{
- fprintf(stderr, msg);
-}
-#endif
-
-extern Xi18nClient *_Xi18nFindClient (Xi18n, CARD16);
-
-static void GetProtocolVersion (CARD16 client_major,
- CARD16 client_minor,
- CARD16 *server_major,
- CARD16 *server_minor)
-{
- *server_major = client_major;
- *server_minor = client_minor;
-}
-
-static void ConnectMessageProc (XIMS ims,
- IMProtocol *call_data,
- unsigned char *p)
-{
- Xi18n i18n_core = ims->protocol;
- FrameMgr fm;
- extern XimFrameRec connect_fr[], connect_reply_fr[];
- register int total_size;
- CARD16 server_major_version, server_minor_version;
- unsigned char *reply = NULL;
- IMConnectStruct *imconnect =
- (IMConnectStruct*) &call_data->imconnect;
- CARD16 connect_id = call_data->any.connect_id;
-
- fm = FrameMgrInit (connect_fr,
- (char *) p,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- /* get data */
- FrameMgrGetToken (fm, imconnect->byte_order);
- FrameMgrGetToken (fm, imconnect->major_version);
- FrameMgrGetToken (fm, imconnect->minor_version);
-
- FrameMgrFree (fm);
-
- GetProtocolVersion (imconnect->major_version,
- imconnect->minor_version,
- &server_major_version,
- &server_minor_version);
-#ifdef PROTOCOL_RICH
- if (i18n_core->address.improto)
- {
- if (!(i18n_core->address.improto(ims, call_data)))
- return;
- /*endif*/
- }
- /*endif*/
-#endif /* PROTOCOL_RICH */
-
- fm = FrameMgrInit (connect_reply_fr,
- NULL,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- total_size = FrameMgrGetTotalSize (fm);
- reply = (unsigned char *) malloc (total_size);
- if (!reply)
- {
- _Xi18nSendMessage (ims, connect_id, XIM_ERROR, 0, 0, 0);
- return;
- }
- /*endif*/
- memset (reply, 0, total_size);
- FrameMgrSetBuffer (fm, reply);
-
- FrameMgrPutToken (fm, server_major_version);
- FrameMgrPutToken (fm, server_minor_version);
-
- _Xi18nSendMessage (ims,
- connect_id,
- XIM_CONNECT_REPLY,
- 0,
- reply,
- total_size);
-
- FrameMgrFree (fm);
- XFree (reply);
-}
-
-static void DisConnectMessageProc (XIMS ims, IMProtocol *call_data)
-{
- Xi18n i18n_core = ims->protocol;
- unsigned char *reply = NULL;
- CARD16 connect_id = call_data->any.connect_id;
-
-#ifdef PROTOCOL_RICH
- if (i18n_core->address.improto)
- {
- if (!(i18n_core->address.improto (ims, call_data)))
- return;
- /*endif*/
- }
- /*endif*/
-#endif /* PROTOCOL_RICH */
-
- _Xi18nSendMessage (ims,
- connect_id,
- XIM_DISCONNECT_REPLY,
- 0,
- reply,
- 0);
-
- i18n_core->methods.disconnect (ims, connect_id);
-}
-
-static void OpenMessageProc(XIMS ims, IMProtocol *call_data, unsigned char *p)
-{
- Xi18n i18n_core = ims->protocol;
- FrameMgr fm;
- extern XimFrameRec open_fr[];
- extern XimFrameRec open_reply_fr[];
- unsigned char *reply = NULL;
- int str_size;
- register int i, total_size;
- CARD16 connect_id = call_data->any.connect_id;
- int str_length;
- char *name;
- IMOpenStruct *imopen = (IMOpenStruct *) &call_data->imopen;
-
- fm = FrameMgrInit (open_fr,
- (char *) p,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- /* get data */
- FrameMgrGetToken (fm, str_length);
- FrameMgrSetSize (fm, str_length);
- FrameMgrGetToken (fm, name);
- imopen->lang.length = str_length;
- imopen->lang.name = malloc (str_length + 1);
- strncpy (imopen->lang.name, name, str_length);
- imopen->lang.name[str_length] = (char) 0;
-
- FrameMgrFree (fm);
-
- if (i18n_core->address.improto)
- {
- if (!(i18n_core->address.improto(ims, call_data)))
- return;
- /*endif*/
- }
- /*endif*/
- if ((i18n_core->address.imvalue_mask & I18N_ON_KEYS)
- ||
- (i18n_core->address.imvalue_mask & I18N_OFF_KEYS))
- {
- _Xi18nSendTriggerKey (ims, connect_id);
- }
- /*endif*/
- XFree (imopen->lang.name);
-
- fm = FrameMgrInit (open_reply_fr,
- NULL,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- /* set iteration count for list of imattr */
- FrameMgrSetIterCount (fm, i18n_core->address.im_attr_num);
-
- /* set length of BARRAY item in ximattr_fr */
- for (i = 0; i < i18n_core->address.im_attr_num; i++)
- {
- str_size = strlen (i18n_core->address.xim_attr[i].name);
- FrameMgrSetSize (fm, str_size);
- }
- /*endfor*/
- /* set iteration count for list of icattr */
- FrameMgrSetIterCount (fm, i18n_core->address.ic_attr_num);
- /* set length of BARRAY item in xicattr_fr */
- for (i = 0; i < i18n_core->address.ic_attr_num; i++)
- {
- str_size = strlen (i18n_core->address.xic_attr[i].name);
- FrameMgrSetSize (fm, str_size);
- }
- /*endfor*/
-
- total_size = FrameMgrGetTotalSize (fm);
- reply = (unsigned char *) malloc (total_size);
- if (!reply)
- {
- _Xi18nSendMessage (ims, connect_id, XIM_ERROR, 0, 0, 0);
- return;
- }
- /*endif*/
- memset (reply, 0, total_size);
- FrameMgrSetBuffer (fm, reply);
-
- /* input input-method ID */
- FrameMgrPutToken (fm, connect_id);
-
- for (i = 0; i < i18n_core->address.im_attr_num; i++)
- {
- str_size = FrameMgrGetSize (fm);
- FrameMgrPutToken (fm, i18n_core->address.xim_attr[i].attribute_id);
- FrameMgrPutToken (fm, i18n_core->address.xim_attr[i].type);
- FrameMgrPutToken (fm, str_size);
- FrameMgrPutToken (fm, i18n_core->address.xim_attr[i].name);
- }
- /*endfor*/
- for (i = 0; i < i18n_core->address.ic_attr_num; i++)
- {
- str_size = FrameMgrGetSize (fm);
- FrameMgrPutToken (fm, i18n_core->address.xic_attr[i].attribute_id);
- FrameMgrPutToken (fm, i18n_core->address.xic_attr[i].type);
- FrameMgrPutToken (fm, str_size);
- FrameMgrPutToken (fm, i18n_core->address.xic_attr[i].name);
- }
- /*endfor*/
-
- _Xi18nSendMessage (ims,
- connect_id,
- XIM_OPEN_REPLY,
- 0,
- reply,
- total_size);
-
- FrameMgrFree (fm);
- XFree (reply);
-}
-
-static void CloseMessageProc (XIMS ims,
- IMProtocol *call_data,
- unsigned char *p)
-{
- Xi18n i18n_core = ims->protocol;
- FrameMgr fm;
- extern XimFrameRec close_fr[];
- extern XimFrameRec close_reply_fr[];
- unsigned char *reply = NULL;
- register int total_size;
- CARD16 connect_id = call_data->any.connect_id;
- CARD16 input_method_ID;
-
- fm = FrameMgrInit (close_fr,
- (char *) p,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- FrameMgrGetToken (fm, input_method_ID);
-
- FrameMgrFree (fm);
-
- if (i18n_core->address.improto)
- {
- if (!(i18n_core->address.improto (ims, call_data)))
- return;
- /*endif*/
- }
- /*endif*/
-
- fm = FrameMgrInit (close_reply_fr,
- NULL,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- total_size = FrameMgrGetTotalSize (fm);
- reply = (unsigned char *) malloc (total_size);
- if (!reply)
- {
- _Xi18nSendMessage (ims,
- connect_id,
- XIM_ERROR,
- 0,
- 0,
- 0);
- return;
- }
- /*endif*/
- memset (reply, 0, total_size);
- FrameMgrSetBuffer (fm, reply);
-
- FrameMgrPutToken (fm, input_method_ID);
-
- _Xi18nSendMessage (ims,
- connect_id,
- XIM_CLOSE_REPLY,
- 0,
- reply,
- total_size);
-
- FrameMgrFree (fm);
- XFree (reply);
-}
-
-static XIMExt *MakeExtensionList (Xi18n i18n_core,
- XIMStr *lib_extension,
- int number,
- int *reply_number)
-{
- XIMExt *ext_list;
- XIMExt *im_ext = (XIMExt *) i18n_core->address.extension;
- int im_ext_len = i18n_core->address.ext_num;
- int i;
- int j;
-
- *reply_number = 0;
-
- if (number == 0)
- {
- /* query all extensions */
- *reply_number = im_ext_len;
- }
- else
- {
- for (i = 0; i < im_ext_len; i++)
- {
- for (j = 0; j < (int) number; j++)
- {
- if (strcmp (lib_extension[j].name, im_ext[i].name) == 0)
- {
- (*reply_number)++;
- break;
- }
- /*endif*/
- }
- /*endfor*/
- }
- /*endfor*/
- }
- /*endif*/
-
- if (!(*reply_number))
- return NULL;
- /*endif*/
- ext_list = (XIMExt *) malloc (sizeof (XIMExt)*(*reply_number));
- if (!ext_list)
- return NULL;
- /*endif*/
- memset (ext_list, 0, sizeof (XIMExt)*(*reply_number));
-
- if (number == 0)
- {
- /* query all extensions */
- for (i = 0; i < im_ext_len; i++)
- {
- ext_list[i].major_opcode = im_ext[i].major_opcode;
- ext_list[i].minor_opcode = im_ext[i].minor_opcode;
- ext_list[i].length = im_ext[i].length;
- ext_list[i].name = malloc (im_ext[i].length + 1);
- strcpy (ext_list[i].name, im_ext[i].name);
- }
- /*endfor*/
- }
- else
- {
- int n = 0;
-
- for (i = 0; i < im_ext_len; i++)
- {
- for (j = 0; j < (int)number; j++)
- {
- if (strcmp (lib_extension[j].name, im_ext[i].name) == 0)
- {
- ext_list[n].major_opcode = im_ext[i].major_opcode;
- ext_list[n].minor_opcode = im_ext[i].minor_opcode;
- ext_list[n].length = im_ext[i].length;
- ext_list[n].name = malloc (im_ext[i].length + 1);
- strcpy (ext_list[n].name, im_ext[i].name);
- n++;
- break;
- }
- /*endif*/
- }
- /*endfor*/
- }
- /*endfor*/
- }
- /*endif*/
- return ext_list;
-}
-
-static void QueryExtensionMessageProc (XIMS ims,
- IMProtocol *call_data,
- unsigned char *p)
-{
- Xi18n i18n_core = ims->protocol;
- FrameMgr fm;
- FmStatus status;
- extern XimFrameRec query_extension_fr[];
- extern XimFrameRec query_extension_reply_fr[];
- unsigned char *reply = NULL;
- int str_size;
- register int i;
- register int number;
- register int total_size;
- int byte_length;
- int reply_number = 0;
- XIMExt *ext_list;
- IMQueryExtensionStruct *query_ext =
- (IMQueryExtensionStruct *) &call_data->queryext;
- CARD16 connect_id = call_data->any.connect_id;
- CARD16 input_method_ID;
-
- fm = FrameMgrInit (query_extension_fr,
- (char *) p,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- FrameMgrGetToken (fm, input_method_ID);
- FrameMgrGetToken (fm, byte_length);
- query_ext->extension = (XIMStr *) malloc (sizeof (XIMStr)*10);
- memset (query_ext->extension, 0, sizeof (XIMStr)*10);
- number = 0;
- while (FrameMgrIsIterLoopEnd (fm, &status) == False)
- {
- char *name;
- int str_length;
-
- FrameMgrGetToken (fm, str_length);
- FrameMgrSetSize (fm, str_length);
- query_ext->extension[number].length = str_length;
- FrameMgrGetToken (fm, name);
- query_ext->extension[number].name = malloc (str_length + 1);
- strncpy (query_ext->extension[number].name, name, str_length);
- query_ext->extension[number].name[str_length] = (char) 0;
- number++;
- }
- /*endwhile*/
- query_ext->number = number;
-
-#ifdef PROTOCOL_RICH
- if (i18n_core->address.improto)
- {
- if (!(i18n_core->address.improto(ims, call_data)))
- return;
- /*endif*/
- }
- /*endif*/
-#endif /* PROTOCOL_RICH */
-
- FrameMgrFree (fm);
-
- ext_list = MakeExtensionList (i18n_core,
- query_ext->extension,
- number,
- &reply_number);
-
- for (i = 0; i < number; i++)
- XFree (query_ext->extension[i].name);
- /*endfor*/
- XFree (query_ext->extension);
-
- fm = FrameMgrInit (query_extension_reply_fr,
- NULL,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- /* set iteration count for list of extensions */
- FrameMgrSetIterCount (fm, reply_number);
-
- /* set length of BARRAY item in ext_fr */
- for (i = 0; i < reply_number; i++)
- {
- str_size = strlen (ext_list[i].name);
- FrameMgrSetSize (fm, str_size);
- }
- /*endfor*/
-
- total_size = FrameMgrGetTotalSize (fm);
- reply = (unsigned char *) malloc (total_size);
- if (!reply)
- {
- _Xi18nSendMessage (ims,
- connect_id,
- XIM_ERROR,
- 0,
- 0,
- 0);
- return;
- }
- /*endif*/
- memset (reply, 0, total_size);
- FrameMgrSetBuffer (fm, reply);
-
- FrameMgrPutToken (fm, input_method_ID);
-
- for (i = 0; i < reply_number; i++)
- {
- str_size = FrameMgrGetSize (fm);
- FrameMgrPutToken (fm, ext_list[i].major_opcode);
- FrameMgrPutToken (fm, ext_list[i].minor_opcode);
- FrameMgrPutToken (fm, str_size);
- FrameMgrPutToken (fm, ext_list[i].name);
- }
- /*endfor*/
- _Xi18nSendMessage (ims,
- connect_id,
- XIM_QUERY_EXTENSION_REPLY,
- 0,
- reply,
- total_size);
- FrameMgrFree (fm);
- XFree (reply);
-
- for (i = 0; i < reply_number; i++)
- XFree (ext_list[i].name);
- /*endfor*/
- XFree ((char *) ext_list);
-}
-
-static void SyncReplyMessageProc (XIMS ims,
- IMProtocol *call_data,
- unsigned char *p)
-{
- Xi18n i18n_core = ims->protocol;
- FrameMgr fm;
- extern XimFrameRec sync_reply_fr[];
- CARD16 connect_id = call_data->any.connect_id;
- Xi18nClient *client;
- CARD16 input_method_ID;
- CARD16 input_context_ID;
-
- client = (Xi18nClient *)_Xi18nFindClient (i18n_core, connect_id);
- fm = FrameMgrInit (sync_reply_fr,
- (char *) p,
- _Xi18nNeedSwap (i18n_core, connect_id));
- FrameMgrGetToken (fm, input_method_ID);
- FrameMgrGetToken (fm, input_context_ID);
- FrameMgrFree (fm);
-
- client->sync = False;
-
- if (ims->sync == True) {
- ims->sync = False;
- if (i18n_core->address.improto) {
- call_data->sync_xlib.major_code = XIM_SYNC_REPLY;
- call_data->sync_xlib.minor_code = 0;
- call_data->sync_xlib.connect_id = input_method_ID;
- call_data->sync_xlib.icid = input_context_ID;
- i18n_core->address.improto(ims, call_data);
- }
- }
-}
-
-static void GetIMValueFromName (Xi18n i18n_core,
- CARD16 connect_id,
- char *buf,
- char *name,
- int *length)
-{
- register int i;
-
- if (strcmp (name, XNQueryInputStyle) == 0)
- {
- XIMStyles *styles = (XIMStyles *) &i18n_core->address.input_styles;
-
- *length = sizeof (CARD16)*2; /* count_styles, unused */
- *length += styles->count_styles*sizeof (CARD32);
-
- if (buf != NULL)
- {
- FrameMgr fm;
- extern XimFrameRec input_styles_fr[];
- unsigned char *data = NULL;
- int total_size;
-
- fm = FrameMgrInit (input_styles_fr,
- NULL,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- /* set iteration count for list of input_style */
- FrameMgrSetIterCount (fm, styles->count_styles);
-
- total_size = FrameMgrGetTotalSize (fm);
- data = (unsigned char *) malloc (total_size);
- if (!data)
- return;
- /*endif*/
- memset (data, 0, total_size);
- FrameMgrSetBuffer (fm, data);
-
- FrameMgrPutToken (fm, styles->count_styles);
- for (i = 0; i < (int) styles->count_styles; i++)
- FrameMgrPutToken (fm, styles->supported_styles[i]);
- /*endfor*/
- memmove (buf, data, total_size);
- FrameMgrFree (fm);
-
- /* ADDED BY SUZHE */
- free (data);
- /* ADDED BY SUZHE */
- }
- /*endif*/
- }
- /*endif*/
-
- else if (strcmp (name, XNQueryIMValuesList) == 0) {
- }
-}
-
-static XIMAttribute *MakeIMAttributeList (Xi18n i18n_core,
- CARD16 connect_id,
- CARD16 *list,
- int *number,
- int *length)
-{
- XIMAttribute *attrib_list;
- int list_num;
- XIMAttr *attr = i18n_core->address.xim_attr;
- int list_len = i18n_core->address.im_attr_num;
- register int i;
- register int j;
- int value_length;
- int number_ret = 0;
-
- *length = 0;
- list_num = 0;
- for (i = 0; i < *number; i++)
- {
- for (j = 0; j < list_len; j++)
- {
- if (attr[j].attribute_id == list[i])
- {
- list_num++;
- break;
- }
- /*endif*/
- }
- /*endfor*/
- }
- /*endfor*/
- attrib_list = (XIMAttribute *) malloc (sizeof (XIMAttribute)*list_num);
- if (!attrib_list)
- return NULL;
- /*endif*/
- memset (attrib_list, 0, sizeof (XIMAttribute)*list_num);
- number_ret = list_num;
- list_num = 0;
- for (i = 0; i < *number; i++)
- {
- for (j = 0; j < list_len; j++)
- {
- if (attr[j].attribute_id == list[i])
- {
- attrib_list[list_num].attribute_id = attr[j].attribute_id;
- attrib_list[list_num].name_length = attr[j].length;
- attrib_list[list_num].name = attr[j].name;
- attrib_list[list_num].type = attr[j].type;
- GetIMValueFromName (i18n_core,
- connect_id,
- NULL,
- attr[j].name,
- &value_length);
- attrib_list[list_num].value_length = value_length;
- attrib_list[list_num].value = (void *) malloc (value_length);
- memset(attrib_list[list_num].value, 0, value_length);
- GetIMValueFromName (i18n_core,
- connect_id,
- attrib_list[list_num].value,
- attr[j].name,
- &value_length);
- *length += sizeof (CARD16)*2;
- *length += value_length;
- *length += IMPAD (value_length);
- list_num++;
- break;
- }
- /*endif*/
- }
- /*endfor*/
- }
- /*endfor*/
- *number = number_ret;
- return attrib_list;
-}
-
-static void GetIMValuesMessageProc (XIMS ims,
- IMProtocol *call_data,
- unsigned char *p)
-{
- Xi18n i18n_core = ims->protocol;
- FrameMgr fm;
- FmStatus status;
- extern XimFrameRec get_im_values_fr[];
- extern XimFrameRec get_im_values_reply_fr[];
- CARD16 byte_length;
- int list_len, total_size;
- unsigned char *reply = NULL;
- int iter_count;
- register int i;
- register int j;
- int number;
- CARD16 *im_attrID_list;
- char **name_list;
- CARD16 name_number;
- XIMAttribute *im_attribute_list;
- IMGetIMValuesStruct *getim = (IMGetIMValuesStruct *)&call_data->getim;
- CARD16 connect_id = call_data->any.connect_id;
- CARD16 input_method_ID;
-
- /* create FrameMgr */
- fm = FrameMgrInit (get_im_values_fr,
- (char *) p,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- FrameMgrGetToken (fm, input_method_ID);
- FrameMgrGetToken (fm, byte_length);
- im_attrID_list = (CARD16 *) malloc (sizeof (CARD16)*20);
- memset (im_attrID_list, 0, sizeof (CARD16)*20);
- name_list = (char **)malloc(sizeof(char *) * 20);
- memset(name_list, 0, sizeof(char *) * 20);
- number = 0;
- while (FrameMgrIsIterLoopEnd (fm, &status) == False)
- {
- FrameMgrGetToken (fm, im_attrID_list[number]);
- number++;
- }
- FrameMgrFree (fm);
-
- name_number = 0;
- for (i = 0; i < number; i++) {
- for (j = 0; j < i18n_core->address.im_attr_num; j++) {
- if (i18n_core->address.xim_attr[j].attribute_id ==
- im_attrID_list[i]) {
- name_list[name_number++] =
- i18n_core->address.xim_attr[j].name;
- break;
- }
- }
- }
- getim->number = name_number;
- getim->im_attr_list = name_list;
- XFree (name_list);
-
-
-#ifdef PROTOCOL_RICH
- if (i18n_core->address.improto) {
- if (!(i18n_core->address.improto (ims, call_data)))
- return;
- }
-#endif /* PROTOCOL_RICH */
-
- im_attribute_list = MakeIMAttributeList (i18n_core,
- connect_id,
- im_attrID_list,
- &number,
- &list_len);
- if (im_attrID_list)
- XFree (im_attrID_list);
- /*endif*/
-
- fm = FrameMgrInit (get_im_values_reply_fr,
- NULL,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- iter_count = number;
-
- /* set iteration count for list of im_attribute */
- FrameMgrSetIterCount (fm, iter_count);
-
- /* set length of BARRAY item in ximattribute_fr */
- for (i = 0; i < iter_count; i++)
- FrameMgrSetSize (fm, im_attribute_list[i].value_length);
- /*endfor*/
-
- total_size = FrameMgrGetTotalSize (fm);
- reply = (unsigned char *) malloc (total_size);
- if (!reply)
- {
- _Xi18nSendMessage (ims, connect_id, XIM_ERROR, 0, 0, 0);
- return;
- }
- /*endif*/
- memset (reply, 0, total_size);
- FrameMgrSetBuffer (fm, reply);
-
- FrameMgrPutToken (fm, input_method_ID);
-
- for (i = 0; i < iter_count; i++)
- {
- FrameMgrPutToken (fm, im_attribute_list[i].attribute_id);
- FrameMgrPutToken (fm, im_attribute_list[i].value_length);
- FrameMgrPutToken (fm, im_attribute_list[i].value);
- }
- /*endfor*/
- _Xi18nSendMessage (ims,
- connect_id,
- XIM_GET_IM_VALUES_REPLY,
- 0,
- reply,
- total_size);
- FrameMgrFree (fm);
- XFree (reply);
-
- for (i = 0; i < iter_count; i++)
- XFree(im_attribute_list[i].value);
- XFree (im_attribute_list);
-}
-
-static void CreateICMessageProc (XIMS ims,
- IMProtocol *call_data,
- unsigned char *p)
-{
- _Xi18nChangeIC (ims, call_data, p, True);
-}
-
-static void SetICValuesMessageProc (XIMS ims,
- IMProtocol *call_data,
- unsigned char *p)
-{
- _Xi18nChangeIC (ims, call_data, p, False);
-}
-
-static void GetICValuesMessageProc (XIMS ims,
- IMProtocol *call_data,
- unsigned char *p)
-{
- _Xi18nGetIC (ims, call_data, p);
-}
-
-static void SetICFocusMessageProc (XIMS ims,
- IMProtocol *call_data,
- unsigned char *p)
-{
- Xi18n i18n_core = ims->protocol;
- FrameMgr fm;
- extern XimFrameRec set_ic_focus_fr[];
- IMChangeFocusStruct *setfocus;
- CARD16 connect_id = call_data->any.connect_id;
- CARD16 input_method_ID;
-
- setfocus = (IMChangeFocusStruct *) &call_data->changefocus;
-
- fm = FrameMgrInit (set_ic_focus_fr,
- (char *) p,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- /* get data */
- FrameMgrGetToken (fm, input_method_ID);
- FrameMgrGetToken (fm, setfocus->icid);
-
- FrameMgrFree (fm);
-
- if (i18n_core->address.improto)
- {
- if (!(i18n_core->address.improto (ims, call_data)))
- return;
- /*endif*/
- }
- /*endif*/
-}
-
-static void UnsetICFocusMessageProc (XIMS ims,
- IMProtocol *call_data,
- unsigned char *p)
-{
- Xi18n i18n_core = ims->protocol;
- FrameMgr fm;
- extern XimFrameRec unset_ic_focus_fr[];
- IMChangeFocusStruct *unsetfocus;
- CARD16 connect_id = call_data->any.connect_id;
- CARD16 input_method_ID;
-
- unsetfocus = (IMChangeFocusStruct *) &call_data->changefocus;
-
- fm = FrameMgrInit (unset_ic_focus_fr,
- (char *) p,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- /* get data */
- FrameMgrGetToken (fm, input_method_ID);
- FrameMgrGetToken (fm, unsetfocus->icid);
-
- FrameMgrFree (fm);
-
- if (i18n_core->address.improto)
- {
- if (!(i18n_core->address.improto (ims, call_data)))
- return;
- /*endif*/
- }
- /*endif*/
-}
-
-static void DestroyICMessageProc (XIMS ims,
- IMProtocol *call_data,
- unsigned char *p)
-{
- Xi18n i18n_core = ims->protocol;
- FrameMgr fm;
- extern XimFrameRec destroy_ic_fr[];
- extern XimFrameRec destroy_ic_reply_fr[];
- register int total_size;
- unsigned char *reply = NULL;
- IMDestroyICStruct *destroy =
- (IMDestroyICStruct *) &call_data->destroyic;
- CARD16 connect_id = call_data->any.connect_id;
- CARD16 input_method_ID;
-
- fm = FrameMgrInit (destroy_ic_fr,
- (char *) p,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- /* get data */
- FrameMgrGetToken (fm, input_method_ID);
- FrameMgrGetToken (fm, destroy->icid);
-
- FrameMgrFree (fm);
-
- if (i18n_core->address.improto)
- {
- if (!(i18n_core->address.improto (ims, call_data)))
- return;
- /*endif*/
- }
- /*endif*/
-
- fm = FrameMgrInit (destroy_ic_reply_fr,
- NULL,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- total_size = FrameMgrGetTotalSize (fm);
- reply = (unsigned char *) malloc (total_size);
- if (!reply)
- {
- _Xi18nSendMessage (ims, connect_id, XIM_ERROR, 0, 0, 0);
- return;
- }
- /*endif*/
- memset (reply, 0, total_size);
- FrameMgrSetBuffer (fm, reply);
-
- FrameMgrPutToken (fm, input_method_ID);
- FrameMgrPutToken (fm, destroy->icid);
-
- _Xi18nSendMessage (ims,
- connect_id,
- XIM_DESTROY_IC_REPLY,
- 0,
- reply,
- total_size);
- XFree(reply);
- FrameMgrFree (fm);
-}
-
-static void ResetICMessageProc (XIMS ims,
- IMProtocol *call_data,
- unsigned char *p)
-{
- Xi18n i18n_core = ims->protocol;
- FrameMgr fm;
- extern XimFrameRec reset_ic_fr[];
- extern XimFrameRec reset_ic_reply_fr[];
- register int total_size;
- unsigned char *reply = NULL;
- IMResetICStruct *resetic =
- (IMResetICStruct *) &call_data->resetic;
- CARD16 connect_id = call_data->any.connect_id;
- CARD16 input_method_ID;
-
- fm = FrameMgrInit (reset_ic_fr,
- (char *) p,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- /* get data */
- FrameMgrGetToken (fm, input_method_ID);
- FrameMgrGetToken (fm, resetic->icid);
-
- FrameMgrFree (fm);
-
- if (i18n_core->address.improto)
- {
- if (!(i18n_core->address.improto(ims, call_data)))
- return;
- /*endif*/
- }
- /*endif*/
-
- /* create FrameMgr */
- fm = FrameMgrInit (reset_ic_reply_fr,
- NULL,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- /* set length of STRING8 */
- FrameMgrSetSize (fm, resetic->length);
-
- total_size = FrameMgrGetTotalSize (fm);
- reply = (unsigned char *) malloc (total_size);
- if (!reply)
- {
- _Xi18nSendMessage (ims, connect_id, XIM_ERROR, 0, 0, 0);
- return;
- }
- /*endif*/
- memset (reply, 0, total_size);
- FrameMgrSetBuffer (fm, reply);
-
- FrameMgrPutToken (fm, input_method_ID);
- FrameMgrPutToken (fm, resetic->icid);
- FrameMgrPutToken(fm, resetic->length);
- FrameMgrPutToken (fm, resetic->commit_string);
-
- _Xi18nSendMessage (ims,
- connect_id,
- XIM_RESET_IC_REPLY,
- 0,
- reply,
- total_size);
- FrameMgrFree (fm);
- XFree(reply);
-}
-
-static int WireEventToEvent (Xi18n i18n_core,
- xEvent *event,
- CARD16 serial,
- XEvent *ev,
- Bool byte_swap)
-{
- FrameMgr fm;
- extern XimFrameRec wire_keyevent_fr[];
- BYTE b;
- CARD16 c16;
- CARD32 c32;
- int ret = False;
-
- /* create FrameMgr */
- fm = FrameMgrInit(wire_keyevent_fr, (char *)(&(event->u)), byte_swap);
-
-
- /* get & set type */
- FrameMgrGetToken(fm, b);
- ev->type = (unsigned int)b;
- /* get detail */
- FrameMgrGetToken(fm, b);
- /* get & set serial */
- FrameMgrGetToken(fm, c16);
- ev->xany.serial = (unsigned long)c16;
- ev->xany.serial |= serial << 16;
- ev->xany.send_event = False;
- ev->xany.display = i18n_core->address.dpy;
-
- /* Remove SendEvent flag from event type to emulate KeyPress/Release */
- ev->type &= 0x7F;
-
- switch (ev->type) {
- case KeyPress:
- case KeyRelease:
- {
- XKeyEvent *kev = (XKeyEvent*)ev;
-
- /* set keycode (detail) */
- kev->keycode = (unsigned int)b;
-
- /* get & set values */
- FrameMgrGetToken(fm, c32); kev->time = (Time)c32;
- FrameMgrGetToken(fm, c32); kev->root = (Window)c32;
- FrameMgrGetToken(fm, c32); kev->window = (Window)c32;
- FrameMgrGetToken(fm, c32); kev->subwindow = (Window)c32;
- FrameMgrGetToken(fm, c16); kev->x_root = (int)c16;
- FrameMgrGetToken(fm, c16); kev->y_root = (int)c16;
- FrameMgrGetToken(fm, c16); kev->x = (int)c16;
- FrameMgrGetToken(fm, c16); kev->y = (int)c16;
- FrameMgrGetToken(fm, c16); kev->state = (unsigned int)c16;
- FrameMgrGetToken(fm, b); kev->same_screen = (Bool)b;
- }
- ret = True;
- break;
- default:
- break;
- }
- /* free FrameMgr */
- FrameMgrFree(fm);
- return ret;
-}
-
-static void ForwardEventMessageProc (XIMS ims,
- IMProtocol *call_data,
- unsigned char *p)
-{
- Xi18n i18n_core = ims->protocol;
- FrameMgr fm;
- extern XimFrameRec forward_event_fr[];
- xEvent wire_event;
- IMForwardEventStruct *forward =
- (IMForwardEventStruct*) &call_data->forwardevent;
- CARD16 connect_id = call_data->any.connect_id;
- CARD16 input_method_ID;
-
- fm = FrameMgrInit (forward_event_fr,
- (char *) p,
- _Xi18nNeedSwap (i18n_core, connect_id));
- /* get data */
- FrameMgrGetToken (fm, input_method_ID);
- FrameMgrGetToken (fm, forward->icid);
- FrameMgrGetToken (fm, forward->sync_bit);
- FrameMgrGetToken (fm, forward->serial_number);
- p += sizeof (CARD16)*4;
- memmove (&wire_event, p, sizeof (xEvent));
-
- FrameMgrFree (fm);
-
- if (WireEventToEvent (i18n_core,
- &wire_event,
- forward->serial_number,
- &forward->event,
- _Xi18nNeedSwap (i18n_core, connect_id)) == True)
- {
- if (i18n_core->address.improto)
- {
- if (!(i18n_core->address.improto(ims, call_data)))
- return;
- /*endif*/
- }
- /*endif*/
- }
- /*endif*/
-}
-
-static void ExtForwardKeyEventMessageProc (XIMS ims,
- IMProtocol *call_data,
- unsigned char *p)
-{
- Xi18n i18n_core = ims->protocol;
- FrameMgr fm;
- extern XimFrameRec ext_forward_keyevent_fr[];
- CARD8 type, keycode;
- CARD16 state;
- CARD32 ev_time, window;
- IMForwardEventStruct *forward =
- (IMForwardEventStruct *) &call_data->forwardevent;
- XEvent *ev = (XEvent *) &forward->event;
- CARD16 connect_id = call_data->any.connect_id;
- CARD16 input_method_ID;
-
- fm = FrameMgrInit (ext_forward_keyevent_fr,
- (char *) p,
- _Xi18nNeedSwap (i18n_core, connect_id));
- /* get data */
- FrameMgrGetToken (fm, input_method_ID);
- FrameMgrGetToken (fm, forward->icid);
- FrameMgrGetToken (fm, forward->sync_bit);
- FrameMgrGetToken (fm, forward->serial_number);
- FrameMgrGetToken (fm, type);
- FrameMgrGetToken (fm, keycode);
- FrameMgrGetToken (fm, state);
- FrameMgrGetToken (fm, ev_time);
- FrameMgrGetToken (fm, window);
-
- FrameMgrFree (fm);
-
- if (type != KeyPress)
- {
- _Xi18nSendMessage (ims, connect_id, XIM_ERROR, 0, 0, 0);
- return;
- }
- /*endif*/
-
- /* make a faked keypress event */
- ev->type = (int)type;
- ev->xany.send_event = True;
- ev->xany.display = i18n_core->address.dpy;
- ev->xany.serial = (unsigned long) forward->serial_number;
- ((XKeyEvent *) ev)->keycode = (unsigned int) keycode;
- ((XKeyEvent *) ev)->state = (unsigned int) state;
- ((XKeyEvent *) ev)->time = (Time) ev_time;
- ((XKeyEvent *) ev)->window = (Window) window;
- ((XKeyEvent *) ev)->root = DefaultRootWindow (ev->xany.display);
- ((XKeyEvent *) ev)->x = 0;
- ((XKeyEvent *) ev)->y = 0;
- ((XKeyEvent *) ev)->x_root = 0;
- ((XKeyEvent *) ev)->y_root = 0;
-
- if (i18n_core->address.improto)
- {
- if (!(i18n_core->address.improto (ims, call_data)))
- return;
- /*endif*/
- }
- /*endif*/
-}
-
-static void ExtMoveMessageProc (XIMS ims,
- IMProtocol *call_data,
- unsigned char *p)
-{
- Xi18n i18n_core = ims->protocol;
- FrameMgr fm;
- extern XimFrameRec ext_move_fr[];
- IMMoveStruct *extmove =
- (IMMoveStruct*) & call_data->extmove;
- CARD16 connect_id = call_data->any.connect_id;
- CARD16 input_method_ID;
-
- fm = FrameMgrInit (ext_move_fr,
- (char *) p,
- _Xi18nNeedSwap (i18n_core, connect_id));
- /* get data */
- FrameMgrGetToken (fm, input_method_ID);
- FrameMgrGetToken (fm, extmove->icid);
- FrameMgrGetToken (fm, extmove->x);
- FrameMgrGetToken (fm, extmove->y);
-
- FrameMgrFree (fm);
-
- if (i18n_core->address.improto)
- {
- if (!(i18n_core->address.improto (ims, call_data)))
- return;
- /*endif*/
- }
- /*endif*/
-}
-
-static void ExtensionMessageProc (XIMS ims,
- IMProtocol *call_data,
- unsigned char *p)
-{
- switch (call_data->any.minor_code)
- {
- case XIM_EXT_FORWARD_KEYEVENT:
- ExtForwardKeyEventMessageProc (ims, call_data, p);
- break;
-
- case XIM_EXT_MOVE:
- ExtMoveMessageProc (ims, call_data, p);
- break;
- }
- /*endswitch*/
-}
-
-static void TriggerNotifyMessageProc (XIMS ims,
- IMProtocol *call_data,
- unsigned char *p)
-{
- Xi18n i18n_core = ims->protocol;
- FrameMgr fm;
- extern XimFrameRec trigger_notify_fr[], trigger_notify_reply_fr[];
- register int total_size;
- unsigned char *reply = NULL;
- IMTriggerNotifyStruct *trigger =
- (IMTriggerNotifyStruct *) &call_data->triggernotify;
- CARD16 connect_id = call_data->any.connect_id;
- CARD16 input_method_ID;
- CARD32 flag;
-
- fm = FrameMgrInit (trigger_notify_fr,
- (char *) p,
- _Xi18nNeedSwap (i18n_core, connect_id));
- /* get data */
- FrameMgrGetToken (fm, input_method_ID);
- FrameMgrGetToken (fm, trigger->icid);
- FrameMgrGetToken (fm, trigger->flag);
- FrameMgrGetToken (fm, trigger->key_index);
- FrameMgrGetToken (fm, trigger->event_mask);
- /*
- In order to support Front End Method, this event_mask must be saved
- per clients so that it should be restored by an XIM_EXT_SET_EVENT_MASK
- call when preediting mode is reset to off.
- */
-
- flag = trigger->flag;
-
- FrameMgrFree (fm);
-
- fm = FrameMgrInit (trigger_notify_reply_fr,
- NULL,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- total_size = FrameMgrGetTotalSize (fm);
- reply = (unsigned char *) malloc (total_size);
- if (!reply)
- {
- _Xi18nSendMessage (ims, connect_id, XIM_ERROR, 0, 0, 0);
- return;
- }
- /*endif*/
- memset (reply, 0, total_size);
- FrameMgrSetBuffer (fm, reply);
-
- FrameMgrPutToken (fm, input_method_ID);
- FrameMgrPutToken (fm, trigger->icid);
-
- /* NOTE:
- XIM_TRIGGER_NOTIFY_REPLY should be sent before XIM_SET_EVENT_MASK
- in case of XIM_TRIGGER_NOTIFY(flag == ON), while it should be
- sent after XIM_SET_EVENT_MASK in case of
- XIM_TRIGGER_NOTIFY(flag == OFF).
- */
- if (flag == 0)
- {
- /* on key */
- _Xi18nSendMessage (ims,
- connect_id,
- XIM_TRIGGER_NOTIFY_REPLY,
- 0,
- reply,
- total_size);
- IMPreeditStart (ims, (XPointer)call_data);
- }
- /*endif*/
- if (i18n_core->address.improto)
- {
- if (!(i18n_core->address.improto(ims, call_data)))
- return;
- /*endif*/
- }
- /*endif*/
-
- if (flag == 1)
- {
- /* off key */
- IMPreeditEnd (ims, (XPointer) call_data);
- _Xi18nSendMessage (ims,
- connect_id,
- XIM_TRIGGER_NOTIFY_REPLY,
- 0,
- reply,
- total_size);
- }
- /*endif*/
- FrameMgrFree (fm);
- XFree (reply);
-}
-
-static INT16 ChooseEncoding (Xi18n i18n_core,
- IMEncodingNegotiationStruct *enc_nego)
-{
- Xi18nAddressRec *address = (Xi18nAddressRec *) & i18n_core->address;
- XIMEncodings *p;
- int i, j;
- int enc_index=0;
-
- p = (XIMEncodings *) &address->encoding_list;
- for (i = 0; i < (int) p->count_encodings; i++)
- {
- for (j = 0; j < (int) enc_nego->encoding_number; j++)
- {
- if (strcmp (p->supported_encodings[i],
- enc_nego->encoding[j].name) == 0)
- {
- enc_index = j;
- break;
- }
- /*endif*/
- }
- /*endfor*/
- }
- /*endfor*/
-
- return (INT16) enc_index;
-#if 0
- return (INT16) XIM_Default_Encoding_IDX;
-#endif
-}
-
-static void EncodingNegotiatonMessageProc (XIMS ims,
- IMProtocol *call_data,
- unsigned char *p)
-{
- Xi18n i18n_core = ims->protocol;
- FrameMgr fm;
- FmStatus status;
- CARD16 byte_length;
- extern XimFrameRec encoding_negotiation_fr[];
- extern XimFrameRec encoding_negotiation_reply_fr[];
- register int i, total_size;
- unsigned char *reply = NULL;
- IMEncodingNegotiationStruct *enc_nego =
- (IMEncodingNegotiationStruct *) &call_data->encodingnego;
- CARD16 connect_id = call_data->any.connect_id;
- CARD16 input_method_ID;
-
- fm = FrameMgrInit (encoding_negotiation_fr,
- (char *) p,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- FrameMgrGetToken (fm, input_method_ID);
-
- /* get ENCODING STR field */
- FrameMgrGetToken (fm, byte_length);
- if (byte_length > 0)
- {
- enc_nego->encoding = (XIMStr *) malloc (sizeof (XIMStr)*10);
- memset (enc_nego->encoding, 0, sizeof (XIMStr)*10);
- i = 0;
- while (FrameMgrIsIterLoopEnd (fm, &status) == False)
- {
- char *name;
- int str_length;
-
- FrameMgrGetToken (fm, str_length);
- FrameMgrSetSize (fm, str_length);
- enc_nego->encoding[i].length = str_length;
- FrameMgrGetToken (fm, name);
- enc_nego->encoding[i].name = malloc (str_length + 1);
- strncpy (enc_nego->encoding[i].name, name, str_length);
- enc_nego->encoding[i].name[str_length] = '\0';
- i++;
- }
- /*endwhile*/
- enc_nego->encoding_number = i;
- }
- /*endif*/
- /* get ENCODING INFO field */
- FrameMgrGetToken (fm, byte_length);
- if (byte_length > 0)
- {
- enc_nego->encodinginfo = (XIMStr *) malloc (sizeof (XIMStr)*10);
- memset (enc_nego->encoding, 0, sizeof (XIMStr)*10);
- i = 0;
- while (FrameMgrIsIterLoopEnd (fm, &status) == False)
- {
- char *name;
- int str_length;
-
- FrameMgrGetToken (fm, str_length);
- FrameMgrSetSize (fm, str_length);
- enc_nego->encodinginfo[i].length = str_length;
- FrameMgrGetToken (fm, name);
- enc_nego->encodinginfo[i].name = malloc (str_length + 1);
- strncpy (enc_nego->encodinginfo[i].name, name, str_length);
- enc_nego->encodinginfo[i].name[str_length] = '\0';
- i++;
- }
- /*endwhile*/
- enc_nego->encoding_info_number = i;
- }
- /*endif*/
-
- enc_nego->enc_index = ChooseEncoding (i18n_core, enc_nego);
- enc_nego->category = 0;
-
-#ifdef PROTOCOL_RICH
- if (i18n_core->address.improto)
- {
- if (!(i18n_core->address.improto(ims, call_data)))
- return;
- /*endif*/
- }
- /*endif*/
-#endif /* PROTOCOL_RICH */
-
- FrameMgrFree (fm);
-
- fm = FrameMgrInit (encoding_negotiation_reply_fr,
- NULL,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- total_size = FrameMgrGetTotalSize (fm);
- reply = (unsigned char *) malloc (total_size);
- if (!reply)
- {
- _Xi18nSendMessage (ims, connect_id, XIM_ERROR, 0, 0, 0);
- return;
- }
- /*endif*/
- memset (reply, 0, total_size);
- FrameMgrSetBuffer (fm, reply);
-
- FrameMgrPutToken (fm, input_method_ID);
- FrameMgrPutToken (fm, enc_nego->category);
- FrameMgrPutToken (fm, enc_nego->enc_index);
-
- _Xi18nSendMessage (ims,
- connect_id,
- XIM_ENCODING_NEGOTIATION_REPLY,
- 0,
- reply,
- total_size);
- XFree (reply);
-
- /* free data for encoding list */
- if (enc_nego->encoding)
- {
- for (i = 0; i < (int) enc_nego->encoding_number; i++)
- XFree (enc_nego->encoding[i].name);
- /*endfor*/
- XFree (enc_nego->encoding);
- }
- /*endif*/
- if (enc_nego->encodinginfo)
- {
- for (i = 0; i < (int) enc_nego->encoding_info_number; i++)
- XFree (enc_nego->encodinginfo[i].name);
- /*endfor*/
- XFree (enc_nego->encodinginfo);
- }
- /*endif*/
- FrameMgrFree (fm);
-}
-
-void PreeditStartReplyMessageProc (XIMS ims,
- IMProtocol *call_data,
- unsigned char *p)
-{
- Xi18n i18n_core = ims->protocol;
- FrameMgr fm;
- extern XimFrameRec preedit_start_reply_fr[];
- IMPreeditCBStruct *preedit_CB =
- (IMPreeditCBStruct *) &call_data->preedit_callback;
- CARD16 connect_id = call_data->any.connect_id;
- CARD16 input_method_ID;
-
- fm = FrameMgrInit (preedit_start_reply_fr,
- (char *) p,
- _Xi18nNeedSwap (i18n_core, connect_id));
- /* get data */
- FrameMgrGetToken (fm, input_method_ID);
- FrameMgrGetToken (fm, preedit_CB->icid);
- FrameMgrGetToken (fm, preedit_CB->todo.return_value);
-
- FrameMgrFree (fm);
-
- if (i18n_core->address.improto)
- {
- if (!(i18n_core->address.improto (ims, call_data)))
- return;
- /*endif*/
- }
- /*endif*/
-}
-
-void PreeditCaretReplyMessageProc (XIMS ims,
- IMProtocol *call_data,
- unsigned char *p)
-{
- Xi18n i18n_core = ims->protocol;
- FrameMgr fm;
- extern XimFrameRec preedit_caret_reply_fr[];
- IMPreeditCBStruct *preedit_CB =
- (IMPreeditCBStruct *) &call_data->preedit_callback;
- XIMPreeditCaretCallbackStruct *caret =
- (XIMPreeditCaretCallbackStruct *) & preedit_CB->todo.caret;
- CARD16 connect_id = call_data->any.connect_id;
- CARD16 input_method_ID;
-
- fm = FrameMgrInit (preedit_caret_reply_fr,
- (char *) p,
- _Xi18nNeedSwap (i18n_core, connect_id));
- /* get data */
- FrameMgrGetToken (fm, input_method_ID);
- FrameMgrGetToken (fm, preedit_CB->icid);
- FrameMgrGetToken (fm, caret->position);
-
- FrameMgrFree (fm);
-
- if (i18n_core->address.improto)
- {
- if (!(i18n_core->address.improto(ims, call_data)))
- return;
- /*endif*/
- }
- /*endif*/
-}
-
-void StrConvReplyMessageProc (XIMS ims,
- IMProtocol *call_data,
- unsigned char *p)
-{
- return;
-}
-
-static void AddQueue (Xi18nClient *client, unsigned char *p)
-{
- XIMPending *new;
- XIMPending *last;
-
- if ((new = (XIMPending *) malloc (sizeof (XIMPending))) == NULL)
- return;
- /*endif*/
- new->p = p;
- new->next = (XIMPending *) NULL;
- if (!client->pending)
- {
- client->pending = new;
- }
- else
- {
- for (last = client->pending; last->next; last = last->next)
- ;
- /*endfor*/
- last->next = new;
- }
- /*endif*/
- return;
-}
-
-static void ProcessQueue (XIMS ims, CARD16 connect_id)
-{
- Xi18n i18n_core = ims->protocol;
- Xi18nClient *client = (Xi18nClient *) _Xi18nFindClient (i18n_core,
- connect_id);
-
- while (client->sync == False && client->pending)
- {
- XimProtoHdr *hdr = (XimProtoHdr *) client->pending->p;
- unsigned char *p1 = (unsigned char *) (hdr + 1);
- IMProtocol call_data;
-
- call_data.major_code = hdr->major_opcode;
- call_data.any.minor_code = hdr->minor_opcode;
- call_data.any.connect_id = connect_id;
-
- switch (hdr->major_opcode)
- {
- case XIM_FORWARD_EVENT:
- ForwardEventMessageProc(ims, &call_data, p1);
- break;
- }
- /*endswitch*/
- XFree (hdr);
- {
- XIMPending *old = client->pending;
-
- client->pending = old->next;
- XFree (old);
- }
- }
- /*endwhile*/
- return;
-}
-
-
-void _Xi18nMessageHandler (XIMS ims,
- CARD16 connect_id,
- unsigned char *p,
- Bool *delete)
-{
- XimProtoHdr *hdr = (XimProtoHdr *)p;
- unsigned char *p1 = (unsigned char *)(hdr + 1);
- IMProtocol call_data;
- Xi18n i18n_core = ims->protocol;
- Xi18nClient *client;
-
- client = (Xi18nClient *) _Xi18nFindClient (i18n_core, connect_id);
- if (hdr == (XimProtoHdr *) NULL)
- return;
- /*endif*/
-
- memset (&call_data, 0, sizeof(IMProtocol));
-
- call_data.major_code = hdr->major_opcode;
- call_data.any.minor_code = hdr->minor_opcode;
- call_data.any.connect_id = connect_id;
-
- switch (call_data.major_code)
- {
- case XIM_CONNECT:
-#ifdef XIM_DEBUG
- DebugLog("-- XIM_CONNECT\n");
-#endif
- ConnectMessageProc (ims, &call_data, p1);
- break;
-
- case XIM_DISCONNECT:
-#ifdef XIM_DEBUG
- DebugLog("-- XIM_DISCONNECT\n");
-#endif
- DisConnectMessageProc (ims, &call_data);
- break;
-
- case XIM_OPEN:
-#ifdef XIM_DEBUG
- DebugLog("-- XIM_OPEN\n");
-#endif
- OpenMessageProc (ims, &call_data, p1);
- break;
-
- case XIM_CLOSE:
-#ifdef XIM_DEBUG
- DebugLog("-- XIM_CLOSE\n");
-#endif
- CloseMessageProc (ims, &call_data, p1);
- break;
-
- case XIM_QUERY_EXTENSION:
-#ifdef XIM_DEBUG
- DebugLog("-- XIM_QUERY_EXTENSION\n");
-#endif
- QueryExtensionMessageProc (ims, &call_data, p1);
- break;
-
- case XIM_GET_IM_VALUES:
-#ifdef XIM_DEBUG
- DebugLog("-- XIM_GET_IM_VALUES\n");
-#endif
- GetIMValuesMessageProc (ims, &call_data, p1);
- break;
-
- case XIM_CREATE_IC:
-#ifdef XIM_DEBUG
- DebugLog("-- XIM_CREATE_IC\n");
-#endif
- CreateICMessageProc (ims, &call_data, p1);
- break;
-
- case XIM_SET_IC_VALUES:
-#ifdef XIM_DEBUG
- DebugLog("-- XIM_SET_IC_VALUES\n");
-#endif
- SetICValuesMessageProc (ims, &call_data, p1);
- break;
-
- case XIM_GET_IC_VALUES:
-#ifdef XIM_DEBUG
- DebugLog("-- XIM_GET_IC_VALUES\n");
-#endif
- GetICValuesMessageProc (ims, &call_data, p1);
- break;
-
- case XIM_SET_IC_FOCUS:
-#ifdef XIM_DEBUG
- DebugLog("-- XIM_SET_IC_FOCUS\n");
-#endif
- SetICFocusMessageProc (ims, &call_data, p1);
- break;
-
- case XIM_UNSET_IC_FOCUS:
-#ifdef XIM_DEBUG
- DebugLog("-- XIM_UNSET_IC_FOCUS\n");
-#endif
- UnsetICFocusMessageProc (ims, &call_data, p1);
- break;
-
- case XIM_DESTROY_IC:
-#ifdef XIM_DEBUG
- DebugLog("-- XIM_DESTROY_IC\n");
-#endif
- DestroyICMessageProc (ims, &call_data, p1);
- break;
-
- case XIM_RESET_IC:
-#ifdef XIM_DEBUG
- DebugLog("-- XIM_RESET_IC\n");
-#endif
- ResetICMessageProc (ims, &call_data, p1);
- break;
-
- case XIM_FORWARD_EVENT:
-#ifdef XIM_DEBUG
- DebugLog("-- XIM_FORWARD_EVENT\n");
-#endif
- if (client->sync == True)
- {
- AddQueue (client, p);
- *delete = False;
- }
- else
- {
- ForwardEventMessageProc (ims, &call_data, p1);
- }
- break;
-
- case XIM_EXTENSION:
-#ifdef XIM_DEBUG
- DebugLog("-- XIM_EXTENSION\n");
-#endif
- ExtensionMessageProc (ims, &call_data, p1);
- break;
-
- case XIM_SYNC:
-#ifdef XIM_DEBUG
- DebugLog("-- XIM_SYNC\n");
-#endif
- break;
-
- case XIM_SYNC_REPLY:
-#ifdef XIM_DEBUG
- DebugLog("-- XIM_SYNC_REPLY\n");
-#endif
- SyncReplyMessageProc (ims, &call_data, p1);
- ProcessQueue (ims, connect_id);
- break;
-
- case XIM_TRIGGER_NOTIFY:
-#ifdef XIM_DEBUG
- DebugLog("-- XIM_TRIGGER_NOTIFY\n");
-#endif
- TriggerNotifyMessageProc (ims, &call_data, p1);
- break;
-
- case XIM_ENCODING_NEGOTIATION:
-#ifdef XIM_DEBUG
- DebugLog("-- XIM_ENCODING_NEGOTIATION\n");
-#endif
- EncodingNegotiatonMessageProc (ims, &call_data, p1);
- break;
-
- case XIM_PREEDIT_START_REPLY:
-#ifdef XIM_DEBUG
- DebugLog("-- XIM_PREEDIT_START_REPLY\n");
-#endif
- PreeditStartReplyMessageProc (ims, &call_data, p1);
- break;
-
- case XIM_PREEDIT_CARET_REPLY:
-#ifdef XIM_DEBUG
- DebugLog("-- XIM_PREEDIT_CARET_REPLY\n");
-#endif
- PreeditCaretReplyMessageProc (ims, &call_data, p1);
- break;
-
- case XIM_STR_CONVERSION_REPLY:
-#ifdef XIM_DEBUG
- DebugLog("-- XIM_STR_CONVERSION_REPLY\n");
-#endif
- StrConvReplyMessageProc (ims, &call_data, p1);
- break;
- }
- /*endswitch*/
-}
diff --git a/x11/IMdkit/i18nUtil.c b/x11/IMdkit/i18nUtil.c
deleted file mode 100644
index 22a2376..0000000
--- a/x11/IMdkit/i18nUtil.c
+++ /dev/null
@@ -1,276 +0,0 @@
-/******************************************************************
-
- Copyright 1994, 1995 by Sun Microsystems, Inc.
- Copyright 1993, 1994 by Hewlett-Packard Company
-
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and
-that both that copyright notice and this permission notice appear
-in supporting documentation, and that the name of Sun Microsystems, Inc.
-and Hewlett-Packard not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior permission.
-Sun Microsystems, Inc. and Hewlett-Packard make no representations about
-the suitability of this software for any purpose. It is provided "as is"
-without express or implied warranty.
-
-SUN MICROSYSTEMS INC. AND HEWLETT-PACKARD COMPANY DISCLAIMS ALL
-WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-SUN MICROSYSTEMS, INC. AND HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY
-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
- Author: Hidetoshi Tajima(tajima@Eng.Sun.COM) Sun Microsystems, Inc.
-
- This version tidied and debugged by Steve Underwood May 1999
-
-******************************************************************/
-
-#include <X11/Xlib.h>
-#include "IMdkit.h"
-#include "Xi18n.h"
-#include "FrameMgr.h"
-#include "XimFunc.h"
-
-Xi18nClient *_Xi18nFindClient (Xi18n, CARD16);
-
-int
-_Xi18nNeedSwap (Xi18n i18n_core, CARD16 connect_id)
-{
- CARD8 im_byteOrder = i18n_core->address.im_byteOrder;
- Xi18nClient *client = _Xi18nFindClient (i18n_core, connect_id);
-
- return (client->byte_order != im_byteOrder);
-}
-
-Xi18nClient *_Xi18nNewClient(Xi18n i18n_core)
-{
- static CARD16 connect_id = 0;
- int new_connect_id;
- Xi18nClient *client;
-
- if (i18n_core->address.free_clients)
- {
- client = i18n_core->address.free_clients;
- i18n_core->address.free_clients = client->next;
- new_connect_id = client->connect_id;
- }
- else
- {
- client = (Xi18nClient *) malloc (sizeof (Xi18nClient));
- new_connect_id = ++connect_id;
- }
- /*endif*/
- memset (client, 0, sizeof (Xi18nClient));
- client->connect_id = new_connect_id;
- client->pending = (XIMPending *) NULL;
- client->sync = False;
- client->byte_order = '?'; /* initial value */
- memset (&client->pending, 0, sizeof (XIMPending *));
- client->next = i18n_core->address.clients;
- i18n_core->address.clients = client;
-
- return (Xi18nClient *) client;
-}
-
-Xi18nClient *_Xi18nFindClient (Xi18n i18n_core, CARD16 connect_id)
-{
- Xi18nClient *client = i18n_core->address.clients;
-
- while (client)
- {
- if (client->connect_id == connect_id)
- return client;
- /*endif*/
- client = client->next;
- }
- /*endwhile*/
- return NULL;
-}
-
-void _Xi18nDeleteClient (Xi18n i18n_core, CARD16 connect_id)
-{
- Xi18nClient *target = _Xi18nFindClient (i18n_core, connect_id);
- Xi18nClient *ccp;
- Xi18nClient *ccp0;
-
- for (ccp = i18n_core->address.clients, ccp0 = NULL;
- ccp != NULL;
- ccp0 = ccp, ccp = ccp->next)
- {
- if (ccp == target)
- {
- if (ccp0 == NULL)
- i18n_core->address.clients = ccp->next;
- else
- ccp0->next = ccp->next;
- /*endif*/
- /* put it back to free list */
- target->next = i18n_core->address.free_clients;
- i18n_core->address.free_clients = target;
- return;
- }
- /*endif*/
- }
- /*endfor*/
-}
-
-void _Xi18nSendMessage (XIMS ims,
- CARD16 connect_id,
- CARD8 major_opcode,
- CARD8 minor_opcode,
- unsigned char *data,
- long length)
-{
- Xi18n i18n_core = ims->protocol;
- FrameMgr fm;
- extern XimFrameRec packet_header_fr[];
- unsigned char *reply_hdr = NULL;
- int header_size;
- unsigned char *reply = NULL;
- unsigned char *replyp;
- int reply_length;
- long p_len = length/4;
-
- fm = FrameMgrInit (packet_header_fr,
- NULL,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- header_size = FrameMgrGetTotalSize (fm);
- reply_hdr = (unsigned char *) malloc (header_size);
- if (reply_hdr == NULL)
- {
- _Xi18nSendMessage (ims, connect_id, XIM_ERROR, 0, 0, 0);
- return;
- }
- /*endif*/
- FrameMgrSetBuffer (fm, reply_hdr);
-
- /* put data */
- FrameMgrPutToken (fm, major_opcode);
- FrameMgrPutToken (fm, minor_opcode);
- FrameMgrPutToken (fm, p_len);
-
- reply_length = header_size + length;
- reply = (unsigned char *) malloc (reply_length);
- replyp = reply;
- memmove (reply, reply_hdr, header_size);
- replyp += header_size;
- memmove (replyp, data, length);
-
- i18n_core->methods.send (ims, connect_id, reply, reply_length);
-
- XFree (reply);
- XFree (reply_hdr);
- FrameMgrFree (fm);
-}
-
-void _Xi18nSendTriggerKey (XIMS ims, CARD16 connect_id)
-{
- Xi18n i18n_core = ims->protocol;
- FrameMgr fm;
- extern XimFrameRec register_triggerkeys_fr[];
- XIMTriggerKey *on_keys = i18n_core->address.on_keys.keylist;
- XIMTriggerKey *off_keys = i18n_core->address.off_keys.keylist;
- int on_key_num = i18n_core->address.on_keys.count_keys;
- int off_key_num = i18n_core->address.off_keys.count_keys;
- unsigned char *reply = NULL;
- register int i, total_size;
- CARD16 im_id;
-
- if (on_key_num == 0 && off_key_num == 0)
- return;
- /*endif*/
-
- fm = FrameMgrInit (register_triggerkeys_fr,
- NULL,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- /* set iteration count for on-keys list */
- FrameMgrSetIterCount (fm, on_key_num);
- /* set iteration count for off-keys list */
- FrameMgrSetIterCount (fm, off_key_num);
-
- /* get total_size */
- total_size = FrameMgrGetTotalSize (fm);
-
- reply = (unsigned char *) malloc (total_size);
- if (!reply)
- return;
- /*endif*/
- memset (reply, 0, total_size);
- FrameMgrSetBuffer (fm, reply);
-
- /* Right now XIM_OPEN_REPLY hasn't been sent to this new client, so
- the input-method-id is still invalid, and should be set to zero...
- Reter to $(XC)/lib/X11/imDefLkup.c:_XimRegisterTriggerKeysCallback
- */
- im_id = 0;
- FrameMgrPutToken (fm, im_id); /* input-method-id */
- for (i = 0; i < on_key_num; i++)
- {
- FrameMgrPutToken (fm, on_keys[i].keysym);
- FrameMgrPutToken (fm, on_keys[i].modifier);
- FrameMgrPutToken (fm, on_keys[i].modifier_mask);
- }
- /*endfor*/
- for (i = 0; i < off_key_num; i++)
- {
- FrameMgrPutToken (fm, off_keys[i].keysym);
- FrameMgrPutToken (fm, off_keys[i].modifier);
- FrameMgrPutToken (fm, off_keys[i].modifier_mask);
- }
- /*endfor*/
- _Xi18nSendMessage (ims,
- connect_id,
- XIM_REGISTER_TRIGGERKEYS,
- 0,
- reply,
- total_size);
- FrameMgrFree (fm);
- XFree(reply);
-}
-
-void _Xi18nSetEventMask (XIMS ims,
- CARD16 connect_id,
- CARD16 im_id,
- CARD16 ic_id,
- CARD32 forward_mask,
- CARD32 sync_mask)
-{
- Xi18n i18n_core = ims->protocol;
- FrameMgr fm;
- extern XimFrameRec set_event_mask_fr[];
- unsigned char *reply = NULL;
- register int total_size;
-
- fm = FrameMgrInit (set_event_mask_fr,
- NULL,
- _Xi18nNeedSwap (i18n_core, connect_id));
-
- total_size = FrameMgrGetTotalSize (fm);
- reply = (unsigned char *) malloc (total_size);
- if (!reply)
- return;
- /*endif*/
- memset (reply, 0, total_size);
- FrameMgrSetBuffer (fm, reply);
-
- FrameMgrPutToken (fm, im_id); /* input-method-id */
- FrameMgrPutToken (fm, ic_id); /* input-context-id */
- FrameMgrPutToken (fm, forward_mask);
- FrameMgrPutToken (fm, sync_mask);
-
- _Xi18nSendMessage (ims,
- connect_id,
- XIM_SET_EVENT_MASK,
- 0,
- reply,
- total_size);
-
- FrameMgrFree (fm);
- XFree(reply);
-}
diff --git a/x11/IMdkit/i18nX.c b/x11/IMdkit/i18nX.c
deleted file mode 100644
index a5ba080..0000000
--- a/x11/IMdkit/i18nX.c
+++ /dev/null
@@ -1,497 +0,0 @@
-/******************************************************************
-
- Copyright 1994, 1995 by Sun Microsystems, Inc.
- Copyright 1993, 1994 by Hewlett-Packard Company
-
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and
-that both that copyright notice and this permission notice appear
-in supporting documentation, and that the name of Sun Microsystems, Inc.
-and Hewlett-Packard not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior permission.
-Sun Microsystems, Inc. and Hewlett-Packard make no representations about
-the suitability of this software for any purpose. It is provided "as is"
-without express or implied warranty.
-
-SUN MICROSYSTEMS INC. AND HEWLETT-PACKARD COMPANY DISCLAIMS ALL
-WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-SUN MICROSYSTEMS, INC. AND HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY
-SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
-RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
-IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
- Author: Hidetoshi Tajima(tajima@Eng.Sun.COM) Sun Microsystems, Inc.
-
- This version tidied and debugged by Steve Underwood May 1999
-
-******************************************************************/
-
-#include <X11/Xlib.h>
-#include <X11/Xatom.h>
-#include "FrameMgr.h"
-#include "IMdkit.h"
-#include "Xi18n.h"
-#include "Xi18nX.h"
-#include "XimFunc.h"
-
-extern Xi18nClient *_Xi18nFindClient(Xi18n, CARD16);
-extern Xi18nClient *_Xi18nNewClient(Xi18n);
-extern void _Xi18nDeleteClient(Xi18n, CARD16);
-static Bool WaitXConnectMessage(Display*, Window,
- XEvent*, XPointer);
-static Bool WaitXIMProtocol(Display*, Window, XEvent*, XPointer);
-
-static XClient *NewXClient (Xi18n i18n_core, Window new_client)
-{
- Display *dpy = i18n_core->address.dpy;
- Xi18nClient *client = _Xi18nNewClient (i18n_core);
- XClient *x_client;
-
- x_client = (XClient *) malloc (sizeof (XClient));
- x_client->client_win = new_client;
- x_client->accept_win = XCreateSimpleWindow (dpy,
- DefaultRootWindow(dpy),
- 0,
- 0,
- 1,
- 1,
- 1,
- 0,
- 0);
- client->trans_rec = x_client;
- return ((XClient *) x_client);
-}
-
-static unsigned char *ReadXIMMessage (XIMS ims,
- XClientMessageEvent *ev,
- int *connect_id)
-{
- Xi18n i18n_core = ims->protocol;
- Xi18nClient *client = i18n_core->address.clients;
- XClient *x_client = NULL;
- FrameMgr fm;
- extern XimFrameRec packet_header_fr[];
- unsigned char *p = NULL;
- unsigned char *p1;
-
- while (client != NULL) {
- x_client = (XClient *) client->trans_rec;
- if (x_client->accept_win == ev->window) {
- *connect_id = client->connect_id;
- break;
- }
- client = client->next;
- }
-
- if (ev->format == 8) {
- /* ClientMessage only */
- XimProtoHdr *hdr = (XimProtoHdr *) ev->data.b;
- unsigned char *rec = (unsigned char *) (hdr + 1);
- register int total_size;
- CARD8 major_opcode;
- CARD8 minor_opcode;
- CARD16 length;
- extern int _Xi18nNeedSwap (Xi18n, CARD16);
-
- if (client->byte_order == '?')
- {
- if (hdr->major_opcode != XIM_CONNECT)
- return (unsigned char *) NULL; /* can do nothing */
- client->byte_order = (CARD8) rec[0];
- }
-
- fm = FrameMgrInit (packet_header_fr,
- (char *) hdr,
- _Xi18nNeedSwap (i18n_core, *connect_id));
- total_size = FrameMgrGetTotalSize (fm);
- /* get data */
- FrameMgrGetToken (fm, major_opcode);
- FrameMgrGetToken (fm, minor_opcode);
- FrameMgrGetToken (fm, length);
- FrameMgrFree (fm);
-
- if ((p = (unsigned char *) malloc (total_size + length * 4)) == NULL)
- return (unsigned char *) NULL;
-
- p1 = p;
- memmove (p1, &major_opcode, sizeof (CARD8));
- p1 += sizeof (CARD8);
- memmove (p1, &minor_opcode, sizeof (CARD8));
- p1 += sizeof (CARD8);
- memmove (p1, &length, sizeof (CARD16));
- p1 += sizeof (CARD16);
- memmove (p1, rec, length * 4);
- }
- else if (ev->format == 32) {
- /* ClientMessage and WindowProperty */
- unsigned long length = (unsigned long) ev->data.l[0];
- Atom atom = (Atom) ev->data.l[1];
- int return_code;
- Atom actual_type_ret;
- int actual_format_ret;
- unsigned long bytes_after_ret;
- unsigned char *prop;
- unsigned long nitems;
-
- return_code = XGetWindowProperty (i18n_core->address.dpy,
- x_client->accept_win,
- atom,
- 0L,
- length,
- True,
- AnyPropertyType,
- &actual_type_ret,
- &actual_format_ret,
- &nitems,
- &bytes_after_ret,
- &prop);
- if (return_code != Success || actual_format_ret == 0 || nitems == 0) {
- if (return_code == Success)
- XFree (prop);
- return (unsigned char *) NULL;
- }
- if (length != nitems)
- length = nitems;
- if (actual_format_ret == 16)
- length *= 2;
- else if (actual_format_ret == 32)
- length *= 4;
-
- /* if hit, it might be an error */
- if ((p = (unsigned char *) malloc (length)) == NULL)
- return (unsigned char *) NULL;
-
- memmove (p, prop, length);
- XFree (prop);
- }
- return (unsigned char *) p;
-}
-
-static void ReadXConnectMessage (XIMS ims, XClientMessageEvent *ev)
-{
- Xi18n i18n_core = ims->protocol;
- XSpecRec *spec = (XSpecRec *) i18n_core->address.connect_addr;
- XEvent event;
- Display *dpy = i18n_core->address.dpy;
- Window new_client = ev->data.l[0];
- CARD32 major_version = ev->data.l[1];
- CARD32 minor_version = ev->data.l[2];
- XClient *x_client = NewXClient (i18n_core, new_client);
-
- if (ev->window != i18n_core->address.im_window)
- return; /* incorrect connection request */
- /*endif*/
- if (major_version != 0 || minor_version != 0)
- {
- major_version =
- minor_version = 0;
- /* Only supporting only-CM & Property-with-CM method */
- }
- /*endif*/
- _XRegisterFilterByType (dpy,
- x_client->accept_win,
- ClientMessage,
- ClientMessage,
- WaitXIMProtocol,
- (XPointer)ims);
- event.xclient.type = ClientMessage;
- event.xclient.display = dpy;
- event.xclient.window = new_client;
- event.xclient.message_type = spec->connect_request;
- event.xclient.format = 32;
- event.xclient.data.l[0] = x_client->accept_win;
- event.xclient.data.l[1] = major_version;
- event.xclient.data.l[2] = minor_version;
- event.xclient.data.l[3] = XCM_DATA_LIMIT;
-
- XSendEvent (dpy,
- new_client,
- False,
- NoEventMask,
- &event);
- XFlush (dpy);
-}
-
-static Bool Xi18nXBegin (XIMS ims)
-{
- Xi18n i18n_core = ims->protocol;
- Display *dpy = i18n_core->address.dpy;
- XSpecRec *spec = (XSpecRec *) i18n_core->address.connect_addr;
-
- spec->xim_request = XInternAtom (i18n_core->address.dpy,
- _XIM_PROTOCOL,
- False);
- spec->connect_request = XInternAtom (i18n_core->address.dpy,
- _XIM_XCONNECT,
- False);
-
- _XRegisterFilterByType (dpy,
- i18n_core->address.im_window,
- ClientMessage,
- ClientMessage,
- WaitXConnectMessage,
- (XPointer)ims);
- return True;
-}
-
-static Bool Xi18nXEnd(XIMS ims)
-{
- Xi18n i18n_core = ims->protocol;
- Display *dpy = i18n_core->address.dpy;
-
- _XUnregisterFilter (dpy,
- i18n_core->address.im_window,
- WaitXConnectMessage,
- (XPointer)ims);
- return True;
-}
-
-static char *MakeNewAtom (CARD16 connect_id, char *atomName)
-{
- static int sequence = 0;
-
- sprintf (atomName,
- "_server%d_%d",
- connect_id,
- ((sequence > 20) ? (sequence = 0) : sequence++));
- return atomName;
-}
-
-static Bool Xi18nXSend (XIMS ims,
- CARD16 connect_id,
- unsigned char *reply,
- long length)
-{
- Xi18n i18n_core = ims->protocol;
- Xi18nClient *client = _Xi18nFindClient (i18n_core, connect_id);
- XSpecRec *spec = (XSpecRec *) i18n_core->address.connect_addr;
- XClient *x_client = (XClient *) client->trans_rec;
- XEvent event;
-
- event.type = ClientMessage;
- event.xclient.window = x_client->client_win;
- event.xclient.message_type = spec->xim_request;
-
- if (length > XCM_DATA_LIMIT)
- {
- Atom atom;
- char atomName[16];
- Atom actual_type_ret;
- int actual_format_ret;
- int return_code;
- unsigned long nitems_ret;
- unsigned long bytes_after_ret;
- unsigned char *win_data;
-
- event.xclient.format = 32;
- atom = XInternAtom (i18n_core->address.dpy,
- MakeNewAtom (connect_id, atomName),
- False);
- return_code = XGetWindowProperty (i18n_core->address.dpy,
- x_client->client_win,
- atom,
- 0L,
- 10000L,
- False,
- XA_STRING,
- &actual_type_ret,
- &actual_format_ret,
- &nitems_ret,
- &bytes_after_ret,
- &win_data);
- if (return_code != Success)
- return False;
- /*endif*/
- if (win_data)
- XFree ((char *) win_data);
- /*endif*/
- XChangeProperty (i18n_core->address.dpy,
- x_client->client_win,
- atom,
- XA_STRING,
- 8,
- PropModeAppend,
- (unsigned char *) reply,
- length);
- event.xclient.data.l[0] = length;
- event.xclient.data.l[1] = atom;
- }
- else
- {
- unsigned char buffer[XCM_DATA_LIMIT];
- int i;
-
- event.xclient.format = 8;
-
- /* Clear unused field with NULL */
- memmove(buffer, reply, length);
- for (i = length; i < XCM_DATA_LIMIT; i++)
- buffer[i] = (char) 0;
- /*endfor*/
- length = XCM_DATA_LIMIT;
- memmove (event.xclient.data.b, buffer, length);
- }
- XSendEvent (i18n_core->address.dpy,
- x_client->client_win,
- False,
- NoEventMask,
- &event);
- XFlush (i18n_core->address.dpy);
- return True;
-}
-
-static Bool CheckCMEvent (Display *display, XEvent *event, XPointer xi18n_core)
-{
- Xi18n i18n_core = (Xi18n) ((void *) xi18n_core);
- XSpecRec *spec = (XSpecRec *) i18n_core->address.connect_addr;
-
- if ((event->type == ClientMessage)
- &&
- (event->xclient.message_type == spec->xim_request))
- {
- return True;
- }
- /*endif*/
- return False;
-}
-
-static Bool Xi18nXWait (XIMS ims,
- CARD16 connect_id,
- CARD8 major_opcode,
- CARD8 minor_opcode)
-{
- Xi18n i18n_core = ims->protocol;
- XEvent event;
- Xi18nClient *client = _Xi18nFindClient (i18n_core, connect_id);
- XClient *x_client = (XClient *) client->trans_rec;
-
- for (;;)
- {
- unsigned char *packet;
- XimProtoHdr *hdr;
- int connect_id_ret;
-
- XIfEvent (i18n_core->address.dpy,
- &event,
- CheckCMEvent,
- (XPointer) i18n_core);
- if (event.xclient.window == x_client->accept_win)
- {
- if ((packet = ReadXIMMessage (ims,
- (XClientMessageEvent *) & event,
- &connect_id_ret))
- == (unsigned char*) NULL)
- {
- return False;
- }
- /*endif*/
- hdr = (XimProtoHdr *)packet;
-
- if ((hdr->major_opcode == major_opcode)
- &&
- (hdr->minor_opcode == minor_opcode))
- {
- return True;
- }
- else if (hdr->major_opcode == XIM_ERROR)
- {
- return False;
- }
- /*endif*/
- }
- /*endif*/
- }
- /*endfor*/
-}
-
-static Bool Xi18nXDisconnect (XIMS ims, CARD16 connect_id)
-{
- Xi18n i18n_core = ims->protocol;
- Display *dpy = i18n_core->address.dpy;
- Xi18nClient *client = _Xi18nFindClient (i18n_core, connect_id);
- XClient *x_client = (XClient *) client->trans_rec;
-
- XDestroyWindow (dpy, x_client->accept_win);
- _XUnregisterFilter (dpy,
- x_client->accept_win,
- WaitXIMProtocol,
- (XPointer)ims);
- XFree (x_client);
- _Xi18nDeleteClient (i18n_core, connect_id);
- return True;
-}
-
-Bool _Xi18nCheckXAddress (Xi18n i18n_core,
- TransportSW *transSW,
- char *address)
-{
- XSpecRec *spec;
-
- if (!(spec = (XSpecRec *) malloc (sizeof (XSpecRec))))
- return False;
- /*endif*/
-
- i18n_core->address.connect_addr = (XSpecRec *) spec;
- i18n_core->methods.begin = Xi18nXBegin;
- i18n_core->methods.end = Xi18nXEnd;
- i18n_core->methods.send = Xi18nXSend;
- i18n_core->methods.wait = Xi18nXWait;
- i18n_core->methods.disconnect = Xi18nXDisconnect;
- return True;
-}
-
-static Bool WaitXConnectMessage (Display *dpy,
- Window win,
- XEvent *ev,
- XPointer client_data)
-{
- XIMS ims = (XIMS)client_data;
- Xi18n i18n_core = ims->protocol;
- XSpecRec *spec = (XSpecRec *) i18n_core->address.connect_addr;
-
- if (((XClientMessageEvent *) ev)->message_type
- == spec->connect_request)
- {
- ReadXConnectMessage (ims, (XClientMessageEvent *) ev);
- return True;
- }
- /*endif*/
- return False;
-}
-
-static Bool WaitXIMProtocol (Display *dpy,
- Window win,
- XEvent *ev,
- XPointer client_data)
-{
- extern void _Xi18nMessageHandler (XIMS, CARD16, unsigned char *, Bool *);
- XIMS ims = (XIMS) client_data;
- Xi18n i18n_core = ims->protocol;
- XSpecRec *spec = (XSpecRec *) i18n_core->address.connect_addr;
- Bool delete = True;
- unsigned char *packet;
- int connect_id;
-
- if (((XClientMessageEvent *) ev)->message_type
- == spec->xim_request)
- {
- if ((packet = ReadXIMMessage (ims,
- (XClientMessageEvent *) ev,
- &connect_id))
- == (unsigned char *) NULL)
- {
- return False;
- }
- /*endif*/
- _Xi18nMessageHandler (ims, connect_id, packet, &delete);
- if (delete == True)
- XFree (packet);
- /*endif*/
- return True;
- }
- /*endif*/
- return False;
-}