Home | History | Annotate | Line # | Download | only in xlibi18n
      1 /*
      2 
      3 Copyright 1991, 1998  The Open Group
      4 
      5 Permission to use, copy, modify, distribute, and sell this software and its
      6 documentation for any purpose is hereby granted without fee, provided that
      7 the above copyright notice appear in all copies and that both that
      8 copyright notice and this permission notice appear in supporting
      9 documentation.
     10 
     11 The above copyright notice and this permission notice shall be included
     12 in all copies or substantial portions of the Software.
     13 
     14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
     15 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
     16 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
     17 IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
     18 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
     19 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     20 OTHER DEALINGS IN THE SOFTWARE.
     21 
     22 Except as contained in this notice, the name of The Open Group shall
     23 not be used in advertising or otherwise to promote the sale, use or
     24 other dealings in this Software without prior written authorization
     25 from The Open Group.
     26 
     27 */
     28 
     29 /*
     30  * Copyright 1990, 1991 by OMRON Corporation, NTT Software Corporation,
     31  *                      and Nippon Telegraph and Telephone Corporation
     32  * Copyright 1991 by the Open Software Foundation
     33  * Copyright 1993 by the TOSHIBA Corp.
     34  * Copyright 1993, 1994 by Sony Corporation
     35  * Copyright 1993, 1994 by the FUJITSU LIMITED
     36  *
     37  * Permission to use, copy, modify, distribute, and sell this software and its
     38  * documentation for any purpose is hereby granted without fee, provided that
     39  * the above copyright notice appear in all copies and that both that
     40  * copyright notice and this permission notice appear in supporting
     41  * documentation, and that the names of OMRON, NTT Software, NTT, Open
     42  * Software Foundation, and Sony Corporation not be used in advertising
     43  * or publicity pertaining to distribution of the software without specific,
     44  * written prior permission. OMRON, NTT Software, NTT, Open Software
     45  * Foundation, and Sony Corporation  make no representations about the
     46  * suitability of this software for any purpose.  It is provided "as is"
     47  * without express or implied warranty.
     48  *
     49  * OMRON, NTT SOFTWARE, NTT, OPEN SOFTWARE FOUNDATION, AND SONY
     50  * CORPORATION DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
     51  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
     52  * SHALL OMRON, NTT SOFTWARE, NTT, OPEN SOFTWARE FOUNDATION, OR SONY
     53  * CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
     54  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
     55  * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
     56  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     57  *
     58  *	Authors: Li Yuhong		OMRON Corporation
     59  *		 Tatsuya Kato		NTT Software Corporation
     60  *		 Hiroshi Kuribayashi	OMRON Coproration
     61  *		 Muneiyoshi Suzuki	Nippon Telegraph and Telephone Co.
     62  *
     63  *		 M. Collins		OSF
     64  *		 Katsuhisa Yano		TOSHIBA Corp.
     65  *               Makoto Wakamatsu       Sony Corporation
     66  *               Takashi Fujiwara	FUJITSU LIMITED
     67  */
     68 
     69 
     70 #ifndef	_XLCINT_H_
     71 #define	_XLCINT_H_
     72 
     73 #ifndef _XP_PRINT_SERVER_
     74 
     75 #include <X11/Xresource.h>
     76 #include <X11/Xutil.h>
     77 #include <stdarg.h>
     78 
     79 typedef Bool (*XFilterEventProc)(
     80     Display*		/* display */,
     81     Window		/* window */,
     82     XEvent*		/* event */,
     83     XPointer		/* client_data */
     84 );
     85 
     86 typedef struct _XIMFilter {
     87     struct _XIMFilter *next;
     88     Window window;
     89     unsigned long event_mask;
     90     int start_type, end_type;
     91     XFilterEventProc filter;
     92     XPointer client_data;
     93 } XFilterEventRec, *XFilterEventList;
     94 
     95 typedef struct {
     96     char    *name;
     97     XPointer value;
     98 } XIMArg;
     99 
    100 #ifdef offsetof
    101 #define XOffsetOf(s_type,field) offsetof(s_type,field)
    102 #else
    103 #define XOffsetOf(s_type,field) ((unsigned int)&(((s_type*)NULL)->field))
    104 #endif
    105 
    106 #define XIMNumber(arr) ((unsigned int) (sizeof(arr) / sizeof(arr[0])))
    107 
    108 /*
    109  * define secondary data structs which are part of Input Methods
    110  * and Input Context
    111  */
    112 typedef struct {
    113     const char		*resource_name;		/* Resource string */
    114     XrmQuark		xrm_name;		/* Resource name quark */
    115     int			resource_size;		/* Size in bytes of data */
    116     long		resource_offset;	/* Offset from base */
    117     unsigned short 	mode;			/* Read Write Permission */
    118     unsigned short 	id;			/* Input Method Protocol */
    119 } XIMResource, *XIMResourceList;
    120 
    121 /*
    122  * data block describing the visual attributes associated with
    123  * an input context
    124  */
    125 typedef struct {
    126     XRectangle		area;
    127     XRectangle		area_needed;
    128     XPoint		spot_location;
    129     Colormap		colormap;
    130     Atom		std_colormap;
    131     unsigned long	foreground;
    132     unsigned long	background;
    133     Pixmap		background_pixmap;
    134     XFontSet            fontset;
    135     int	       		line_spacing;
    136     Cursor		cursor;
    137     XICCallback		start_callback;
    138     XICCallback		done_callback;
    139     XICCallback		draw_callback;
    140     XICCallback		caret_callback;
    141     XIMPreeditState	preedit_state;
    142     XICCallback		state_notify_callback;
    143 } ICPreeditAttributes, *ICPreeditAttributesPtr;
    144 
    145 typedef struct {
    146     XRectangle		area;
    147     XRectangle		area_needed;
    148     Colormap		colormap;
    149     Atom		std_colormap;
    150     unsigned long	foreground;
    151     unsigned long	background;
    152     Pixmap		background_pixmap;
    153     XFontSet            fontset;
    154     int	       		line_spacing;
    155     Cursor		cursor;
    156     XICCallback		start_callback;
    157     XICCallback		done_callback;
    158     XICCallback		draw_callback;
    159 } ICStatusAttributes, *ICStatusAttributesPtr;
    160 
    161 #endif /* !_XP_PRINT_SERVER_ */
    162 
    163 /*
    164  * Methods for Xrm parsing
    165  */
    166 
    167 /* The state is a pointer to an object created by the locale's
    168    init_parse_info function (default: _XrmDefaultInitParseInfo). */
    169 
    170 /* Sets the state to the initial state.
    171    Initiates a sequence of calls to the XmbCharProc. */
    172 typedef void (*XmbInitProc)(
    173     XPointer		state
    174 );
    175 
    176 /* Transforms one multibyte character, starting at str, and return a 'char'
    177    in the same parsing class (not a wide character!). Returns the number of
    178    consumed bytes in *lenp. */
    179 typedef char (*XmbCharProc)(
    180     XPointer		state,
    181     const char *	str,
    182     int*		lenp
    183 );
    184 
    185 /* Terminates a sequence of calls to the XmbCharProc. */
    186 typedef void (*XmbFinishProc)(
    187     XPointer		state
    188 );
    189 
    190 /* Returns the name of the state's locale, as a static string. */
    191 typedef const char* (*XlcNameProc)(
    192     XPointer		state
    193 );
    194 
    195 /* Frees the state, which was allocated by the locale's init_parse_info
    196    function. */
    197 typedef void (*XrmDestroyProc)(
    198     XPointer		state
    199 );
    200 
    201 /* Set of methods for Xrm parsing. */
    202 typedef struct {
    203     XmbInitProc		mbinit;
    204     XmbCharProc		mbchar;
    205     XmbFinishProc	mbfinish;
    206     XlcNameProc		lcname;
    207     XrmDestroyProc	destroy;
    208 } XrmMethodsRec;
    209 typedef const XrmMethodsRec *XrmMethods;
    210 
    211 #ifndef _XP_PRINT_SERVER_
    212 
    213 typedef struct _XLCd *XLCd; /* need forward reference */
    214 
    215 /*
    216  * define an LC, it's methods, and data.
    217  */
    218 
    219 typedef void (*XCloseLCProc)(
    220     XLCd		/* lcd */
    221 );
    222 
    223 typedef char* (*XlcMapModifiersProc)(
    224     XLCd		/* lcd */,
    225     _Xconst char*	/* user_mods */,
    226     _Xconst char*	/* prog_mods */
    227 );
    228 
    229 typedef XOM (*XOpenOMProc)(
    230     XLCd		/* lcd */,
    231     Display*		/* display */,
    232     XrmDatabase		/* rdb */,
    233     _Xconst char*	/* res_name */,
    234     _Xconst char*	/* res_class */
    235 );
    236 
    237 typedef XIM (*XOpenIMProc)(
    238     XLCd		/* lcd */,
    239     Display*		/* display */,
    240     XrmDatabase		/* rdb */,
    241     char*		/* res_name */,
    242     char*		/* res_class */
    243 );
    244 
    245 typedef Bool (*XRegisterIMInstantiateCBProc)(
    246     XLCd		/* lcd */,
    247     Display*		/* display */,
    248     XrmDatabase		/* rdb */,
    249     char*		/* res_name */,
    250     char*		/* res_class */,
    251     XIDProc		/* callback */,
    252     XPointer		/* client_data */
    253 );
    254 
    255 typedef Bool (*XUnregisterIMInstantiateCBProc)(
    256     XLCd		/* lcd */,
    257     Display*		/* display */,
    258     XrmDatabase		/* rdb */,
    259     char*		/* res_name */,
    260     char*		/* res_class */,
    261     XIDProc		/* callback */,
    262     XPointer		/* client_data */
    263 );
    264 
    265 typedef XrmMethods (*XrmInitParseInfoProc)(
    266     XLCd		/* lcd */,
    267     XPointer*		/* state */
    268 );
    269 
    270 typedef int (*XmbTextPropertyToTextListProc)(
    271     XLCd		lcd,
    272     Display*		display,
    273     const XTextProperty* text_prop,
    274     char***		list_return,
    275     int*		count_return
    276 );
    277 
    278 typedef int (*XwcTextPropertyToTextListProc)(
    279     XLCd		lcd,
    280     Display*		display,
    281     const XTextProperty* text_prop,
    282     wchar_t***		list_return,
    283     int*		count_return
    284 );
    285 
    286 typedef int (*XmbTextListToTextPropertyProc)(
    287     XLCd		lcd,
    288     Display*		display,
    289     char**		list,
    290     int			count,
    291     XICCEncodingStyle	style,
    292     XTextProperty*	text_prop_return
    293 );
    294 
    295 typedef int (*XwcTextListToTextPropertyProc)(
    296     XLCd		lcd,
    297     Display*		display,
    298     wchar_t**		list,
    299     int			count,
    300     XICCEncodingStyle	style,
    301     XTextProperty*	text_prop_return
    302 );
    303 
    304 typedef void (*XwcFreeStringListProc)(
    305     XLCd		lcd,
    306     wchar_t**		list
    307 );
    308 
    309 typedef const char* (*XDefaultStringProc)(
    310     XLCd		lcd
    311 );
    312 
    313 typedef struct {
    314     XCloseLCProc			close;
    315     XlcMapModifiersProc			map_modifiers;
    316     XOpenOMProc				open_om;
    317     XOpenIMProc				open_im;
    318     XrmInitParseInfoProc		init_parse_info;
    319     XmbTextPropertyToTextListProc	mb_text_prop_to_list;
    320     XwcTextPropertyToTextListProc	wc_text_prop_to_list;
    321     XmbTextPropertyToTextListProc	utf8_text_prop_to_list;
    322     XmbTextListToTextPropertyProc	mb_text_list_to_prop;
    323     XwcTextListToTextPropertyProc	wc_text_list_to_prop;
    324     XmbTextListToTextPropertyProc	utf8_text_list_to_prop;
    325     XwcFreeStringListProc		wc_free_string_list;
    326     XDefaultStringProc			default_string;
    327     XRegisterIMInstantiateCBProc	register_callback;
    328     XUnregisterIMInstantiateCBProc	unregister_callback;
    329 } XLCdMethodsRec, *XLCdMethods;
    330 
    331 
    332 typedef struct {
    333     char*		name;			/* name of this LC */
    334     char*		modifiers;		/* modifiers of locale */
    335 } XLCdCoreRec, *XLCdCore;
    336 
    337 
    338 typedef struct _XLCd {
    339     XLCdMethods		methods;		/* methods of this LC */
    340     XLCdCore		core;			/* data of this LC */
    341     XPointer		opaque;			/* LDX specific data */
    342 } XLCdRec;
    343 
    344 typedef int XlcPosition;
    345 
    346 #define XlcHead		0
    347 #define XlcTail		-1
    348 
    349 typedef struct {
    350     char *name;
    351     XPointer value;
    352 } XlcArg, *XlcArgList;
    353 
    354 typedef struct _XlcResource {
    355     const char *name;
    356     XrmQuark xrm_name;
    357     int size;
    358     int offset;
    359     unsigned long mask;
    360 } XlcResource, *XlcResourceList;
    361 
    362 #define XlcCreateMask	(1L<<0)
    363 #define XlcDefaultMask	(1L<<1)
    364 #define XlcGetMask	(1L<<2)
    365 #define XlcSetMask	(1L<<3)
    366 #define XlcIgnoreMask	(1L<<4)
    367 
    368 #define XlcNumber(arr)	(sizeof(arr) / sizeof(arr[0]))
    369 
    370 typedef Status (*XCloseOMProc)(
    371     XOM			/* om */
    372 );
    373 
    374 typedef char* (*XSetOMValuesProc)(
    375     XOM			/* om */,
    376     XlcArgList		/* args */,
    377     int			/* num_args */
    378 );
    379 
    380 typedef char* (*XGetOMValuesProc)(
    381     XOM			/* om */,
    382     XlcArgList		/* args */,
    383     int			/* num_args */
    384 );
    385 
    386 typedef XOC (*XCreateOCProc)(
    387     XOM			/* om */,
    388     XlcArgList		/* args */,
    389     int			/* num_args */
    390 );
    391 
    392 typedef struct _XOMMethodsRec {
    393     XCloseOMProc	close;
    394     XSetOMValuesProc	set_values;
    395     XGetOMValuesProc	get_values;
    396     XCreateOCProc	create_oc;
    397 } XOMMethodsRec, *XOMMethods;
    398 
    399 typedef struct _XOMCoreRec {
    400     XLCd lcd;				/* lcd */
    401     Display *display;			/* display */
    402     XrmDatabase rdb;			/* database */
    403     char *res_name;			/* resource name */
    404     char *res_class;			/* resource class */
    405     XOC oc_list;			/* xoc list */
    406     XlcResourceList resources;		/* xom resources */
    407     int num_resources;			/* number of xom resources */
    408     XOMCharSetList required_charset;	/* required charset list */
    409     XOMOrientation orientation_list;	/* orientation list */
    410     Bool directional_dependent;		/* directional-dependent */
    411     Bool contextual_drawing;		/* contextual drawing */
    412     Bool context_dependent;		/* context-dependent drawing */
    413 } XOMCoreRec, *XOMCore;
    414 
    415 typedef struct _XOM {
    416     XOMMethods methods;
    417     XOMCoreRec core;
    418 } XOMRec;
    419 
    420 typedef void (*XDestroyOCProc)(
    421     XOC			/* oc */
    422 );
    423 
    424 typedef char* (*XSetOCValuesProc)(
    425     XOC			/* oc */,
    426     XlcArgList		/* args */,
    427     int			/* num_args */
    428 );
    429 
    430 typedef char* (*XGetOCValuesProc)(
    431     XOC			/* oc */,
    432     XlcArgList		/* args */,
    433     int			/* num_args */
    434 );
    435 
    436 /*
    437  * X Font Sets are an instantiable object, so we define it, the
    438  * object itself, a method list and data
    439  */
    440 
    441 /*
    442  * XFontSet object method list
    443  */
    444 
    445 typedef int (*XmbTextEscapementProc)(
    446     XFontSet		/* font_set */,
    447     _Xconst char*	/* text */,
    448     int			/* text_len */
    449 );
    450 
    451 typedef int (*XmbTextExtentsProc)(
    452     XFontSet		/* font_set */,
    453     _Xconst char*	/* text */,
    454     int			/* text_len */,
    455     XRectangle*		/* overall_ink_extents */,
    456     XRectangle*		/* overall_logical_extents */
    457 );
    458 
    459 typedef Status (*XmbTextPerCharExtentsProc)(
    460     XFontSet		/* font_set */,
    461     _Xconst char*	/* text */,
    462     int			/* text_len */,
    463     XRectangle*		/* ink_extents_buffer */,
    464     XRectangle*		/* logical_extents_buffer */,
    465     int			/* buffer_size */,
    466     int*		/* num_chars */,
    467     XRectangle*		/* max_ink_extents */,
    468     XRectangle*		/* max_logical_extents */
    469 );
    470 
    471 typedef int (*XmbDrawStringProc)(
    472     Display*		/* display */,
    473     Drawable		/* drawable */,
    474     XFontSet		/* font_set */,
    475     GC			/* gc */,
    476     int			/* x */,
    477     int			/* y */,
    478     _Xconst char*	/* text */,
    479     int			/* text_len */
    480 );
    481 
    482 typedef void (*XmbDrawImageStringProc)(
    483     Display*		/* display */,
    484     Drawable		/* drawable */,
    485     XFontSet		/* font_set */,
    486     GC			/* gc */,
    487     int			/* x */,
    488     int			/* y */,
    489     _Xconst char*	/* text */,
    490     int			/* text_len */
    491 );
    492 
    493 typedef int (*XwcTextEscapementProc)(
    494     XFontSet		/* font_set */,
    495     _Xconst wchar_t*	/* text */,
    496     int			/* text_len */
    497 );
    498 
    499 typedef int (*XwcTextExtentsProc)(
    500     XFontSet		/* font_set */,
    501     _Xconst wchar_t*	/* text */,
    502     int			/* text_len */,
    503     XRectangle*		/* overall_ink_extents */,
    504     XRectangle*		/* overall_logical_extents */
    505 );
    506 
    507 typedef Status (*XwcTextPerCharExtentsProc)(
    508     XFontSet		/* font_set */,
    509     _Xconst wchar_t*	/* text */,
    510     int			/* text_len */,
    511     XRectangle*		/* ink_extents_buffer */,
    512     XRectangle*		/* logical_extents_buffer */,
    513     int			/* buffer_size */,
    514     int*		/* num_chars */,
    515     XRectangle*		/* max_ink_extents */,
    516     XRectangle*		/* max_logical_extents */
    517 );
    518 
    519 typedef int (*XwcDrawStringProc)(
    520     Display*		/* display */,
    521     Drawable		/* drawable */,
    522     XFontSet		/* font_set */,
    523     GC			/* gc */,
    524     int			/* x */,
    525     int			/* y */,
    526     _Xconst wchar_t*	/* text */,
    527     int			/* text_len */
    528 );
    529 
    530 typedef void (*XwcDrawImageStringProc)(
    531     Display*		/* display */,
    532     Drawable		/* drawable */,
    533     XFontSet		/* font_set */,
    534     GC			/* gc */,
    535     int			/* x */,
    536     int			/* y */,
    537     _Xconst wchar_t*	/* text */,
    538     int			/* text_len */
    539 );
    540 
    541 typedef struct {
    542     XDestroyOCProc 		destroy;
    543     XSetOCValuesProc 		set_values;
    544     XGetOCValuesProc 		get_values;
    545 
    546     /* multi-byte text drawing methods */
    547 
    548     XmbTextEscapementProc	mb_escapement;
    549     XmbTextExtentsProc		mb_extents;
    550     XmbTextPerCharExtentsProc	mb_extents_per_char;
    551     XmbDrawStringProc		mb_draw_string;
    552     XmbDrawImageStringProc	mb_draw_image_string;
    553 
    554     /* wide character text drawing methods */
    555 
    556     XwcTextEscapementProc	wc_escapement;
    557     XwcTextExtentsProc		wc_extents;
    558     XwcTextPerCharExtentsProc	wc_extents_per_char;
    559     XwcDrawStringProc		wc_draw_string;
    560     XwcDrawImageStringProc	wc_draw_image_string;
    561 
    562     /* UTF-8 text drawing methods */
    563 
    564     XmbTextEscapementProc	utf8_escapement;
    565     XmbTextExtentsProc		utf8_extents;
    566     XmbTextPerCharExtentsProc	utf8_extents_per_char;
    567     XmbDrawStringProc		utf8_draw_string;
    568     XmbDrawImageStringProc	utf8_draw_image_string;
    569 } XOCMethodsRec, *XOCMethods;
    570 
    571 
    572 /*
    573  * XOC independent data
    574  */
    575 
    576 typedef struct {
    577     XOM om;				/* XOM */
    578     XOC next;				/* next XOC */
    579     XlcResourceList resources;		/* xoc resources */
    580     int num_resources;			/* number of xoc resources */
    581     char *base_name_list;     		/* base font name list */
    582     Bool om_automatic;			/* OM Automatic */
    583     XOMFontInfo font_info;		/* font info */
    584     XFontSetExtents font_set_extents;  	/* font set extents */
    585     char *default_string;     		/* default string */
    586     XOMCharSetList missing_list;	/* missing charset list */
    587     XOrientation orientation;		/* orientation */
    588     char *res_name;			/* resource name */
    589     char *res_class;			/* resource class */
    590 } XOCCoreRec, *XOCCore;
    591 
    592 typedef struct _XOC {
    593     XOCMethods methods;
    594     XOCCoreRec core;
    595 } XOCRec;
    596 
    597 
    598 /*
    599  * X Input Managers are an instantiable object, so we define it, the
    600  * object itself, a method list and data.
    601  */
    602 
    603 /*
    604  * an Input Manager object method list
    605  */
    606 typedef struct {
    607     Status (*close)(
    608 	XIM
    609 	);
    610     char* (*set_values)(
    611 	XIM, XIMArg*
    612 	);
    613     char* (*get_values)(
    614 	XIM, XIMArg*
    615 	);
    616     XIC (*create_ic)(
    617 	XIM, XIMArg*
    618 	);
    619     int (*ctstombs)(
    620 	XIM, char*, int, char*, int, Status *
    621 	);
    622     int (*ctstowcs)(
    623 	XIM, char*, int, wchar_t*, int, Status *
    624 	);
    625     int (*ctstoutf8)(
    626 	XIM, char*, int, char*, int, Status *
    627 	);
    628 } XIMMethodsRec, *XIMMethods;
    629 
    630 /*
    631  * Input Manager LC independent data
    632  */
    633 typedef struct {
    634     XLCd		lcd;			/* LC of this input method */
    635     XIC			ic_chain;		/* list of ICs for this IM */
    636 
    637     Display *		display;               	/* display */
    638     XrmDatabase 	rdb;
    639     char *		res_name;
    640     char *		res_class;
    641 
    642     XIMValuesList	*im_values_list;
    643     XIMValuesList	*ic_values_list;
    644     XIMStyles		*styles;
    645     XIMCallback		 destroy_callback;
    646     char *		im_name;		/* XIMMODIFIER name */
    647     XIMResourceList	im_resources;		/* compiled IM resource list */
    648     unsigned int	im_num_resources;
    649     XIMResourceList	ic_resources;		/* compiled IC resource list */
    650     unsigned int	ic_num_resources;
    651     Bool		visible_position;
    652 } XIMCoreRec, *XIMCore;
    653 
    654 
    655 
    656 /*
    657  * An X Input Manager (IM).  Implementations may need to extend this data
    658  * structure to accommodate additional data, state information etc.
    659  */
    660 typedef struct _XIM {
    661     XIMMethods		methods;		/* method list of this IM */
    662     XIMCoreRec		core;			/* data of this IM */
    663 } XIMRec;
    664 
    665 
    666 
    667 /*
    668  * X Input Contexts (IC) are an instantiable object, so we define it, the
    669  * object itself, a method list and data for this object
    670  */
    671 
    672 /*
    673  * Input Context method list
    674  */
    675 typedef struct {
    676     void (*destroy)(
    677 	XIC
    678 	);
    679     void (*set_focus)(
    680 	XIC
    681 	);
    682     void (*unset_focus)(
    683 	XIC
    684 	);
    685     char* (*set_values)(
    686 	XIC, XIMArg*
    687 	);
    688     char* (*get_values)(
    689 	XIC, XIMArg*
    690 	);
    691     char* (*mb_reset)(
    692 	XIC
    693 	);
    694     wchar_t* (*wc_reset)(
    695 	XIC
    696 	);
    697     char* (*utf8_reset)(
    698 	XIC
    699 	);
    700     int (*mb_lookup_string)(
    701 	XIC, XKeyEvent*, char*, int, KeySym*, Status*
    702 	);
    703     int (*wc_lookup_string)(
    704 	XIC, XKeyEvent*, wchar_t*, int, KeySym*, Status*
    705 	);
    706     int (*utf8_lookup_string)(
    707 	XIC, XKeyEvent*, char*, int, KeySym*, Status*
    708 	);
    709 } XICMethodsRec, *XICMethods;
    710 
    711 
    712 /*
    713  * Input Context LC independent data
    714  */
    715 typedef struct {
    716     XIM			im;			/* XIM this IC belongs too */
    717     XIC			next;			/* linked list of ICs for IM */
    718 
    719     Window		client_window;		/* window IM can use for */
    720 						/* display or subwindows */
    721     XIMStyle		input_style;		/* IM's input style */
    722     Window		focus_window;		/* where key events go */
    723     unsigned long	filter_events;		/* event mask from IM */
    724     XICCallback		geometry_callback;	/* client callback */
    725     char *		res_name;
    726     char *		res_class;
    727 
    728     XICCallback		destroy_callback;
    729     XICCallback		string_conversion_callback;
    730     XIMStringConversionText	 string_conversion;
    731     XIMResetState	reset_state;
    732     XIMHotKeyTriggers  *hotkey;
    733     XIMHotKeyState	hotkey_state;
    734 
    735     ICPreeditAttributes	preedit_attr;		/* visuals of preedit area */
    736     ICStatusAttributes	status_attr;		/* visuals of status area */
    737 } XICCoreRec, *XICCore;
    738 
    739 
    740 /*
    741  * an Input Context.  Implementations may need to extend this data
    742  * structure to accommodate additional data, state information etc.
    743  */
    744 typedef struct _XIC {
    745     XICMethods		methods;		/* method list of this IC */
    746     XICCoreRec		core;			/* data of this IC */
    747 } XICRec;
    748 
    749 
    750 /* If the argument 'name' is appropriate for this loader, it instantiates an
    751    XLCd object with appropriate locale methods and returns it. May return
    752    NULL; in this case, the remaining loaders are tried. */
    753 typedef XLCd (*XLCdLoadProc)(
    754     const char*		name
    755 );
    756 
    757 _XFUNCPROTOBEGIN
    758 
    759 extern XLCd _XOpenLC(
    760     char*		name
    761 );
    762 
    763 extern void _XCloseLC(
    764     XLCd		lcd
    765 );
    766 
    767 extern XLCd _XlcCurrentLC (void);
    768 
    769 extern Bool _XlcValidModSyntax(
    770     const char*		mods,
    771     const char* const *	valid
    772 );
    773 
    774 extern char *_XlcDefaultMapModifiers(
    775     XLCd		lcd,
    776     _Xconst char*		user_mods,
    777     _Xconst char*		prog_mods
    778 );
    779 
    780 extern void _XIMCompileResourceList(
    781     XIMResourceList	/* res */,
    782     unsigned int	/* num_res */
    783 );
    784 
    785 extern void _XCopyToArg(
    786     XPointer		/* src */,
    787     XPointer*		/* dst */,
    788     unsigned int	/* size */
    789 );
    790 
    791 extern char ** _XParseBaseFontNameList(
    792     char*		/* str */,
    793     int*		/* num */
    794 );
    795 
    796 extern XrmMethods _XrmInitParseInfo(
    797 	XPointer*	statep
    798 );
    799 
    800 extern void _XRegisterFilterByMask(
    801     Display*		/* dpy */,
    802     Window		/* window */,
    803     unsigned long	/* event_mask */,
    804     Bool (*)(
    805 	     Display*	/* display */,
    806 	     Window	/* window */,
    807 	     XEvent*	/* event */,
    808 	     XPointer	/* client_data */
    809 	     )		/* filter */,
    810     XPointer		/* client_data */
    811 );
    812 
    813 extern void _XRegisterFilterByType(
    814     Display*		/* dpy */,
    815     Window		/* window */,
    816     int			/* start_type */,
    817     int			/* end_type */,
    818     Bool (*)(
    819 	     Display*	/* display */,
    820 	     Window	/* window */,
    821 	     XEvent*	/* event */,
    822 	     XPointer	/* client_data */
    823 	     )		/* filter */,
    824     XPointer		/* client_data */
    825 );
    826 
    827 extern void _XUnregisterFilter(
    828     Display*		/* dpy */,
    829     Window		/* window */,
    830     Bool (*)(
    831 	     Display*	/* display */,
    832 	     Window	/* window */,
    833 	     XEvent*	/* event */,
    834 	     XPointer	/* client_data */
    835 	     )		/* filter */,
    836     XPointer		/* client_data */
    837 );
    838 
    839 extern void _XlcCountVaList(
    840     va_list		var,
    841     int*		count_return
    842 );
    843 
    844 extern void _XlcVaToArgList(
    845     va_list		var,
    846     int			count,
    847     XlcArgList*		args_return
    848 );
    849 
    850 
    851 extern void _XlcCopyFromArg(
    852     char *		src,
    853     char *		dst,
    854     int			size
    855 );
    856 
    857 extern void _XlcCopyToArg(
    858     char *		src,
    859     char **		dst,
    860     int			size
    861 );
    862 
    863 extern void _XlcCompileResourceList(
    864     XlcResourceList	resources,
    865     int			num_resources
    866 );
    867 
    868 extern char *_XlcGetValues(
    869     XPointer		base,
    870     XlcResourceList	resources,
    871     int			num_resources,
    872     XlcArgList		args,
    873     int			num_args,
    874     unsigned long	mask
    875 );
    876 
    877 extern char *_XlcSetValues(
    878     XPointer		base,
    879     XlcResourceList	resources,
    880     int			num_resources,
    881     XlcArgList		args,
    882     int			num_args,
    883     unsigned long	mask
    884 );
    885 
    886 /* documented in i18n/Framework.PS */
    887 extern void _XlcInitLoader (void);
    888 
    889 extern void _XlcDeInitLoader (void);
    890 
    891 /* documented in i18n/Framework.PS */
    892 /* Returns True on success, False on failure. */
    893 extern Bool _XlcAddLoader(
    894     XLCdLoadProc	proc,
    895     XlcPosition		position
    896 );
    897 
    898 /* documented in i18n/Framework.PS */
    899 extern void _XlcRemoveLoader(
    900     XLCdLoadProc	proc
    901 );
    902 
    903 /* Registers UTF-8 converters for a non-UTF-8 locale. */
    904 extern void _XlcAddUtf8Converters(
    905     XLCd		lcd
    906 );
    907 
    908 /* Registers UTF-8 converters for a UTF-8 locale. */
    909 extern void _XlcAddUtf8LocaleConverters(
    910     XLCd		lcd
    911 );
    912 
    913 /* Registers GB18030 converters for a GB18030 locale. */
    914 extern void _XlcAddGB18030LocaleConverters(
    915     XLCd		lcd
    916 );
    917 
    918 /* The default locale loader. Assumes an ASCII encoding. */
    919 extern XLCd _XlcDefaultLoader(
    920     const char*		name
    921 );
    922 
    923 /* The generic locale loader. Suitable for all encodings except UTF-8.
    924    Uses an XLC_LOCALE configuration file. */
    925 extern XLCd _XlcGenericLoader(
    926     const char*		name
    927 );
    928 
    929 /* The UTF-8 locale loader. Suitable for UTF-8 encoding.
    930    Uses an XLC_LOCALE configuration file. */
    931 extern XLCd _XlcUtf8Loader(
    932     const char*		name
    933 );
    934 
    935 extern XLCd _XlcDynamicLoad(
    936     const char*		name
    937 );
    938 
    939 /* The old dynamic loader. */
    940 extern XLCd _XlcDynamicLoader(
    941     const char*		name
    942 );
    943 
    944 extern Bool _XInitDefaultIM(
    945     XLCd		lcd
    946 );
    947 
    948 extern Bool _XInitDefaultOM(
    949     XLCd		lcd
    950 );
    951 
    952 extern Bool _XInitDynamicIM(
    953     XLCd		lcd
    954 );
    955 
    956 extern Bool _XInitDynamicOM(
    957     XLCd		lcd
    958 );
    959 
    960 _XFUNCPROTOEND
    961 
    962 #endif /* !_XP_PRINT_SERVER_ */
    963 
    964 #endif	/* _XLCINT_H_ */
    965