~ubuntu-branches/ubuntu/raring/sunpinyin/raring

« back to all changes in this revision

Viewing changes to wrapper/xim/IMdkit/Xi18n.h

  • Committer: Package Import Robot
  • Author(s): YunQiang Su
  • Date: 2012-03-30 15:31:55 UTC
  • mfrom: (1.1.3) (1.2.7 sid)
  • Revision ID: package-import@ubuntu.com-20120330153155-qgls77sogzgtg9zp
Tags: 2.0.3+git20120222-1
* Team upload: git snapshot 20120222.
   - fix breaks if LDFLAGS in environment contains
       multiple words (Closese #646001).
   - rm patches merged to upstream:
       append-os-environ-toenv.patch
       fix-ftbfs-on-sh.patch
       remove-10-candidate-words-limitation.patch
   - refresh disable-lm-dict-compile.patch.
* Bump stardard version to 3.9.3: no modify needed.
* add libsunpinyin3-dbg and python-sunpinyin packages.
* debian/compat to 9, multiarch it.
* rewrite debian/rules with dh 7 format.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/******************************************************************
 
2
 
 
3
         Copyright 1994, 1995 by Sun Microsystems, Inc.
 
4
         Copyright 1993, 1994 by Hewlett-Packard Company
 
5
 
 
6
Permission to use, copy, modify, distribute, and sell this software
 
7
and its documentation for any purpose is hereby granted without fee,
 
8
provided that the above copyright notice appear in all copies and
 
9
that both that copyright notice and this permission notice appear
 
10
in supporting documentation, and that the name of Sun Microsystems, Inc.
 
11
and Hewlett-Packard not be used in advertising or publicity pertaining to
 
12
distribution of the software without specific, written prior permission.
 
13
Sun Microsystems, Inc. and Hewlett-Packard make no representations about
 
14
the suitability of this software for any purpose.  It is provided "as is"
 
15
without express or implied warranty.
 
16
 
 
17
SUN MICROSYSTEMS INC. AND HEWLETT-PACKARD COMPANY DISCLAIMS ALL
 
18
WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED
 
19
WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
 
20
SUN MICROSYSTEMS, INC. AND HEWLETT-PACKARD COMPANY BE LIABLE FOR ANY
 
21
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
 
22
RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
 
23
CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
 
24
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
25
 
 
26
  Author: Hidetoshi Tajima(tajima@Eng.Sun.COM) Sun Microsystems, Inc.
 
27
 
 
28
    This version tidied and debugged by Steve Underwood May 1999
 
29
 
 
30
******************************************************************/
 
31
 
 
32
#ifndef _Xi18n_h
 
33
#define _Xi18n_h
 
34
#include <X11/Xlib.h>
 
35
#include <X11/Xfuncs.h>
 
36
#include <X11/Xos.h>
 
37
#include "XimProto.h"
 
38
 
 
39
/*
 
40
 * Minor Protocol Number for Extension Protocol 
 
41
 */
 
42
#define XIM_EXTENSION                           128
 
43
#define XIM_EXT_SET_EVENT_MASK                  (0x30)
 
44
#define XIM_EXT_FORWARD_KEYEVENT                (0x32)
 
45
#define XIM_EXT_MOVE                            (0x33)
 
46
#define COMMON_EXTENSIONS_NUM                   3
 
47
 
 
48
#include <stdlib.h>
 
49
#include "IMdkit.h"
 
50
 
 
51
/* XI18N Valid Attribute Name Definition */
 
52
#define ExtForwardKeyEvent      "extForwardKeyEvent"
 
53
#define ExtMove                 "extMove"
 
54
#define ExtSetEventMask         "extSetEventMask"
 
55
 
 
56
/*
 
57
 * Padding macro
 
58
 */
 
59
#define IMPAD(length) ((4 - ((length)%4))%4)
 
60
 
 
61
/*
 
62
 * Target Atom for Transport Connection
 
63
 */
 
64
#define LOCALES         "LOCALES"
 
65
#define TRANSPORT       "TRANSPORT"
 
66
 
 
67
#define I18N_OPEN       0
 
68
#define I18N_SET        1
 
69
#define I18N_GET        2
 
70
 
 
71
typedef struct
 
72
{
 
73
    char        *transportname;
 
74
    int         namelen;
 
75
    Bool        (*checkAddr) ();
 
76
} TransportSW;
 
77
 
 
78
typedef struct _XIMPending
 
79
{
 
80
    unsigned    char *p;
 
81
    struct _XIMPending *next;
 
82
} XIMPending;
 
83
 
 
84
typedef struct _XimProtoHdr
 
85
{
 
86
    CARD8       major_opcode;
 
87
    CARD8       minor_opcode;
 
88
    CARD16      length;
 
89
} XimProtoHdr;
 
90
 
 
91
typedef struct
 
92
{
 
93
    CARD16      attribute_id;
 
94
    CARD16      type;
 
95
    CARD16      length;
 
96
    char        *name;
 
97
} XIMAttr;
 
98
 
 
99
typedef struct
 
100
{
 
101
    CARD16      attribute_id;
 
102
    CARD16      type;
 
103
    CARD16      length;
 
104
    char        *name;
 
105
} XICAttr;
 
106
 
 
107
typedef struct
 
108
{
 
109
    int         attribute_id;
 
110
    CARD16      name_length; 
 
111
    char        *name;
 
112
    int         value_length;
 
113
    void        *value;
 
114
    int         type;
 
115
} XIMAttribute;
 
116
 
 
117
typedef struct
 
118
{
 
119
    int         attribute_id;
 
120
    CARD16      name_length;
 
121
    char        *name;
 
122
    int         value_length;
 
123
    void        *value;
 
124
    int         type;
 
125
} XICAttribute;
 
126
 
 
127
typedef struct
 
128
{
 
129
    int         length;
 
130
    char        *name;
 
131
} XIMStr;
 
132
 
 
133
typedef struct
 
134
{
 
135
    CARD16      major_opcode;
 
136
    CARD16      minor_opcode;
 
137
    CARD16      length;
 
138
    char        *name;
 
139
} XIMExt;
 
140
 
 
141
typedef struct _Xi18nClient
 
142
{
 
143
    int         connect_id;
 
144
    CARD8       byte_order;
 
145
    /*
 
146
       '?': initial value
 
147
       'B': for Big-Endian
 
148
       'l': for little-endian
 
149
     */
 
150
    int         sync;
 
151
    XIMPending  *pending;
 
152
    /* property offset to read next data */
 
153
    long        property_offset;
 
154
    void *trans_rec;            /* contains transport specific data  */
 
155
    struct _Xi18nClient *next;
 
156
} Xi18nClient;
 
157
 
 
158
typedef struct _Xi18nCore *Xi18n;
 
159
 
 
160
/*
 
161
 * Callback Struct for XIM Protocol
 
162
 */
 
163
typedef struct
 
164
{
 
165
    int         major_code;
 
166
    int         minor_code;
 
167
    CARD16      connect_id;
 
168
} IMAnyStruct;
 
169
 
 
170
typedef struct
 
171
{
 
172
    int         major_code;
 
173
    int         minor_code;
 
174
    CARD16      connect_id;
 
175
    CARD8       byte_order;
 
176
    CARD16      major_version;
 
177
    CARD16      minor_version;
 
178
} IMConnectStruct;
 
179
 
 
180
typedef struct
 
181
{
 
182
    int         major_code;
 
183
    int         minor_code;
 
184
    CARD16      connect_id;
 
185
} IMDisConnectStruct;
 
186
 
 
187
typedef struct
 
188
{
 
189
    int         major_code;
 
190
    int         minor_code;
 
191
    CARD16      connect_id;
 
192
    XIMStr      lang;
 
193
} IMOpenStruct;
 
194
 
 
195
typedef struct
 
196
{
 
197
    int         major_code;
 
198
    int         minor_code;
 
199
    CARD16      connect_id;
 
200
} IMCloseStruct;
 
201
 
 
202
typedef struct
 
203
{
 
204
    int         major_code;
 
205
    int         minor_code;
 
206
    CARD16      connect_id;
 
207
    CARD16      number;
 
208
    XIMStr      *extension;
 
209
} IMQueryExtensionStruct;
 
210
 
 
211
typedef struct
 
212
{
 
213
    int         major_code;
 
214
    int         minor_code;
 
215
    CARD16      connect_id;
 
216
    CARD16      number;
 
217
    char        **im_attr_list;
 
218
} IMGetIMValuesStruct;
 
219
 
 
220
typedef struct
 
221
{
 
222
    int         major_code;
 
223
    int         minor_code;
 
224
    CARD16      connect_id;
 
225
    CARD16      icid;
 
226
    CARD16      preedit_attr_num;
 
227
    CARD16      status_attr_num;
 
228
    CARD16      ic_attr_num;
 
229
    XICAttribute *preedit_attr;
 
230
    XICAttribute *status_attr;
 
231
    XICAttribute *ic_attr;
 
232
} IMChangeICStruct;
 
233
 
 
234
typedef struct
 
235
{
 
236
    int         major_code;
 
237
    int         minor_code;
 
238
    CARD16      connect_id;
 
239
    CARD16      icid;
 
240
} IMDestroyICStruct;
 
241
 
 
242
typedef struct
 
243
{
 
244
    int         major_code;
 
245
    int         minor_code;
 
246
    CARD16      connect_id;
 
247
    CARD16      icid;
 
248
    CARD16      length;
 
249
    char        *commit_string;
 
250
} IMResetICStruct;
 
251
 
 
252
typedef struct
 
253
{
 
254
    int         major_code;
 
255
    int         minor_code;
 
256
    CARD16      connect_id;
 
257
    CARD16      icid;
 
258
} IMChangeFocusStruct;
 
259
 
 
260
typedef struct
 
261
{
 
262
    int         major_code;
 
263
    int         minor_code;
 
264
    CARD16      connect_id;
 
265
    CARD16      icid;
 
266
    BITMASK16   sync_bit;
 
267
    CARD16      serial_number;
 
268
    XEvent      event;
 
269
} IMForwardEventStruct;
 
270
 
 
271
typedef struct
 
272
{
 
273
    int         major_code;
 
274
    int         minor_code;
 
275
    CARD16      connect_id;
 
276
    CARD16      icid;
 
277
    CARD16      flag;
 
278
    KeySym      keysym;
 
279
    char        *commit_string;
 
280
} IMCommitStruct;
 
281
 
 
282
typedef struct
 
283
{
 
284
    int         major_code;
 
285
    int         minor_code;
 
286
    CARD16      connect_id;
 
287
    CARD16      icid;
 
288
    CARD32      flag;
 
289
    CARD32      key_index;
 
290
    CARD32      event_mask;
 
291
} IMTriggerNotifyStruct;
 
292
 
 
293
typedef struct
 
294
{
 
295
    int         major_code;
 
296
    int         minor_code;
 
297
    CARD16      connect_id;
 
298
    CARD16      encoding_number;
 
299
    XIMStr      *encoding;      /* name information */
 
300
    CARD16      encoding_info_number;
 
301
    XIMStr      *encodinginfo;  /* detailed information */
 
302
    CARD16      category;       /* #0 for name, #1 for detail */
 
303
    INT16       enc_index;      /* index of the encoding determined */
 
304
} IMEncodingNegotiationStruct;
 
305
 
 
306
typedef struct
 
307
{
 
308
    int         major_code;
 
309
    int         minor_code;
 
310
    CARD16      connect_id;
 
311
    CARD16      icid;
 
312
    CARD32      flag;
 
313
    CARD32      forward_event_mask;
 
314
    CARD32      sync_event_mask;
 
315
} IMSetEventMaskStruct;
 
316
 
 
317
typedef struct
 
318
{
 
319
    int         major_code;
 
320
    int         minor_code;
 
321
    CARD16      connect_id;
 
322
    CARD16      icid;
 
323
    CARD32      filter_event_mask;
 
324
    CARD32      intercept_event_mask;
 
325
    CARD32      select_event_mask;
 
326
    CARD32      forward_event_mask;
 
327
    CARD32      sync_event_mask;
 
328
} IMExtSetEventMaskStruct;
 
329
 
 
330
typedef struct
 
331
{
 
332
    int         major_code;
 
333
    int         minor_code;
 
334
    CARD16      connect_id;
 
335
    CARD16      icid;
 
336
    CARD16      x;
 
337
    CARD16      y;
 
338
} IMMoveStruct;
 
339
 
 
340
typedef struct
 
341
{
 
342
    int         major_code;
 
343
    int         minor_code;
 
344
    CARD16      connect_id;
 
345
    CARD16      icid;
 
346
    BITMASK16   flag;
 
347
    CARD16      error_code;
 
348
    CARD16      str_length;
 
349
    CARD16      error_type;
 
350
    char        *error_detail;
 
351
} IMErrorStruct;
 
352
 
 
353
typedef struct
 
354
{
 
355
    int         major_code;
 
356
    int         minor_code;
 
357
    CARD16      connect_id;
 
358
    CARD16      icid;
 
359
} IMPreeditStateStruct;
 
360
 
 
361
/* Callbacks */
 
362
typedef struct
 
363
{
 
364
    int         major_code;
 
365
    int         minor_code;
 
366
    CARD16      connect_id;
 
367
    CARD16      icid;
 
368
} IMGeometryCBStruct;
 
369
 
 
370
typedef struct
 
371
{
 
372
    int         major_code;
 
373
    int         minor_code;
 
374
    CARD16      connect_id;
 
375
    CARD16      icid;
 
376
    union
 
377
    {
 
378
        int return_value;                       /* PreeditStart */
 
379
        XIMPreeditDrawCallbackStruct draw;      /* PreeditDraw */
 
380
        XIMPreeditCaretCallbackStruct caret;    /* PreeditCaret */
 
381
    } todo;
 
382
} IMPreeditCBStruct;
 
383
 
 
384
typedef struct
 
385
{
 
386
    int         major_code;
 
387
    int         minor_code;
 
388
    CARD16      connect_id;
 
389
    CARD16      icid;
 
390
    union
 
391
    {
 
392
        XIMStatusDrawCallbackStruct draw;       /* StatusDraw */
 
393
    } todo;
 
394
} IMStatusCBStruct;
 
395
 
 
396
typedef struct
 
397
{
 
398
    int         major_code;
 
399
    int         minor_code;
 
400
    CARD16      connect_id;
 
401
    CARD16      icid;
 
402
    XIMStringConversionCallbackStruct strconv;
 
403
} IMStrConvCBStruct;
 
404
 
 
405
typedef struct
 
406
{
 
407
    int         major_code;
 
408
    int         minor_code;
 
409
    CARD16      connect_id;
 
410
    CARD16      icid;
 
411
} IMSyncXlibStruct;
 
412
 
 
413
typedef union _IMProtocol
 
414
{
 
415
    int major_code;
 
416
    IMAnyStruct any;
 
417
    IMConnectStruct imconnect;
 
418
    IMDisConnectStruct imdisconnect;
 
419
    IMOpenStruct imopen;
 
420
    IMCloseStruct imclose;
 
421
    IMQueryExtensionStruct queryext;
 
422
    IMGetIMValuesStruct getim;
 
423
    IMEncodingNegotiationStruct encodingnego;
 
424
    IMExtSetEventMaskStruct extsetevent;
 
425
    IMMoveStruct extmove;
 
426
    IMSetEventMaskStruct setevent;
 
427
    IMChangeICStruct changeic;
 
428
    IMDestroyICStruct destroyic;
 
429
    IMResetICStruct resetic;
 
430
    IMChangeFocusStruct changefocus;
 
431
    IMCommitStruct commitstring;
 
432
    IMForwardEventStruct forwardevent;
 
433
    IMTriggerNotifyStruct triggernotify;
 
434
    IMPreeditStateStruct preedit_state;
 
435
    IMErrorStruct imerror;
 
436
    IMGeometryCBStruct geometry_callback;
 
437
    IMPreeditCBStruct preedit_callback;
 
438
    IMStatusCBStruct status_callback;
 
439
    IMStrConvCBStruct strconv_callback;
 
440
    IMSyncXlibStruct sync_xlib;
 
441
    long pad[32];
 
442
} IMProtocol;
 
443
 
 
444
typedef int (*IMProtoHandler) (XIMS, IMProtocol*);
 
445
 
 
446
#define DEFAULT_FILTER_MASK     (KeyPressMask)
 
447
 
 
448
/* Xi18nAddressRec structure */
 
449
typedef struct _Xi18nAddressRec
 
450
{
 
451
    Display     *dpy;
 
452
    CARD8       im_byteOrder;   /* byte order 'B' or 'l' */
 
453
    /* IM Values */
 
454
    long        imvalue_mask;
 
455
    Window      im_window;      /* IMServerWindow */
 
456
    char        *im_name;       /* IMServerName */
 
457
    char        *im_locale;     /* IMLocale */
 
458
    char        *im_addr;       /* IMServerTransport */
 
459
    XIMStyles   input_styles;   /* IMInputStyles */
 
460
    XIMTriggerKeys on_keys;     /* IMOnKeysList */
 
461
    XIMTriggerKeys off_keys;    /* IMOffKeysList */
 
462
    XIMEncodings encoding_list; /* IMEncodingList */
 
463
    IMProtoHandler improto;     /* IMProtocolHander */
 
464
    long        filterevent_mask; /* IMFilterEventMask */
 
465
    /* XIM_SERVERS target Atoms */
 
466
    Atom        selection;
 
467
    Atom        Localename;
 
468
    Atom        Transportname;
 
469
    /* XIM/XIC Attr */
 
470
    int         im_attr_num;
 
471
    XIMAttr     *xim_attr;
 
472
    int         ic_attr_num;
 
473
    XICAttr     *xic_attr;
 
474
    CARD16      preeditAttr_id;
 
475
    CARD16      statusAttr_id;
 
476
    CARD16      separatorAttr_id;
 
477
    /* XIMExtension List */
 
478
    int         ext_num;
 
479
    XIMExt      extension[COMMON_EXTENSIONS_NUM];
 
480
    /* transport specific connection address */
 
481
    void        *connect_addr;
 
482
    /* actual data is defined:
 
483
       XSpecRec in Xi18nX.h for X-based connection.
 
484
       TransSpecRec in Xi18nTr.h for Socket-based connection.
 
485
     */
 
486
    /* clients table */
 
487
    Xi18nClient *clients;
 
488
    Xi18nClient *free_clients;
 
489
} Xi18nAddressRec;
 
490
 
 
491
typedef struct _Xi18nMethodsRec
 
492
{
 
493
    Bool (*begin) (XIMS);
 
494
    Bool (*end) (XIMS);
 
495
    Bool (*send) (XIMS, CARD16, unsigned char*, long);
 
496
    Bool (*wait) (XIMS, CARD16, CARD8, CARD8);
 
497
    Bool (*disconnect) (XIMS, CARD16);
 
498
} Xi18nMethodsRec;
 
499
 
 
500
typedef struct _Xi18nCore
 
501
{
 
502
    Xi18nAddressRec address;
 
503
    Xi18nMethodsRec methods;
 
504
} Xi18nCore;
 
505
 
 
506
#endif
 
507