/******************************************************************
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.

******************************************************************/

/* Protocol Packet frames */

#include "FrameMgr.h"

/* Data type definitions */

static
XimFrameRec str_fr[] = {
    _FRAME(BIT8),		/* length of name in bytes */
    _FRAME(BARRAY),		/* name */
    _FRAME(EOL),
};

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),
};

/* values data format */
xim_externaldef
XimFrameRec bytedata_fr[] = {
    _FRAME(BIT8),	/* value */
    _FRAME(EOL),
};

xim_externaldef
XimFrameRec worddata_fr[] = {
    _FRAME(BIT16),	/* value */
    _FRAME(EOL),
};

xim_externaldef
XimFrameRec longdata_fr[] = {
    _FRAME(BIT32),	/* value */
    _FRAME(EOL),
};

xim_externaldef
XimFrameRec chardata_fr[] = {
    _FRAME(BARRAY),	/* value */
    _FRAME(EOL),
};

xim_externaldef
XimFrameRec window_fr[] = {
    _FRAME(BIT32),	/* value */
    _FRAME(EOL),
};

xim_externaldef
XimFrameRec ximstyles_fr[] = {
    _FRAME(BIT16),		/* number of XIMStyle list */
    _PAD4(1),			/* unused */
    _FRAME(ITER),		/* XIMStyle list */
    _FRAME(BIT32),
    _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 xfontset_fr[] = {
    _FRAME(BIT16),	/* length of Base font name */
    _FRAME(BARRAY),	/* Base font name list */
    _PAD4(2),		/* unused */
    _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),			/* unused */
    _FRAME(EOL),
};

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 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 ximfeedback_fr[] = {
    _FRAME(BIT32),		/* XIMFeedback */
    _FRAME(EOL),
};

#if 0
static
XimFrameRec ximhotkeystate_fr[] = {
    _FRAME(BIT32),		/* XIMHotKeyState */
    _FRAME(EOL),
};

static
XimFrameRec ximpreeditstate_fr[] = {
    _FRAME(BIT32),		/* XIMPreeditState */
    _FRAME(EOL),
};

static
XimFrameRec ximresetstate_fr[] = {
    _FRAME(BIT32),		/* XIMResetState */
    _FRAME(EOL),
};
#endif

static
XimFrameRec ximstrconvtext_fr[] = {
    _FRAME(BIT16),		/* XIMStringConversionFeedback */
    _FRAME(BIT16),		/* byte length of retrieved string */
    _FRAME(BARRAY),		/* retrieved string */
    _PAD4(1),			/* unused */
    _BYTE_COUNTER(BIT16, 2),	/* byte length of feedback array */
    _PAD4(1),			/* unused */
    _FRAME(ITER),		/* LISTofXIMSTRCONVFEEDBACK */
    _FRAME(POINTER),
    _PTR(ximfeedback_fr),
    _FRAME(EOL),
};

/* Protocol definitions */

xim_externaldef
XimFrameRec attr_head_fr[] = {
    _FRAME(BIT16),	/* attribute id */
    _FRAME(BIT16),	/* attribute length */
    _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),	/* number of client-auth-protocol-names */
    _FRAME(ITER),		/* client-auth-protocol-names */
    _FRAME(POINTER),
    _PTR(str_fr),
    _FRAME(EOL),
};

xim_externaldef
XimFrameRec auth_required_fr[] = {
    _FRAME(BIT8),		/* auth-protocol-index */
    _PAD4(1),			/* unused */
    _FRAME(BIT16),		/* lengh of authentication data */
    _PAD4(1),			/* unused */
    _FRAME(BARRAY),		/* data2 */
    _PAD4(1),			/* unused */
    _FRAME(EOL),
};

xim_externaldef
XimFrameRec auth_reply_fr[] = {
    _FRAME(BIT16),		/* length of authentication data */
    _PAD4(1),			/* unused */
#if 0
    _FRAME(BIT16),		/* length of authentication data */
    _PAD4(1),			/* unused */
#endif
    _FRAME(BIT8),
    _FRAME(BARRAY),
    _PAD4(2),
    _FRAME(EOL),
};

xim_externaldef
XimFrameRec auth_next_fr[] = {
    _FRAME(BIT16),		/* length of authentication data */
    _PAD4(1),			/* unused */
    _FRAME(BARRAY),		/* data */
    _PAD4(1),
    _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(str_fr),
    _FRAME(EOL),
};

xim_externaldef
XimFrameRec auth_ng_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 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 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 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 encoding_negotiation_fr[] = {
    _FRAME(BIT16),		/* input-method-ID */
    _BYTE_COUNTER(BIT16, 1),	/* byte length of encodings listed by name */
    _FRAME(ITER),		/* list of encodings supported in
				   IM library */
    _FRAME(POINTER),
    _PTR(str_fr),
    _PAD4(1),			/* unused */
    _BYTE_COUNTER(BIT16, 2),	/* byte length of encodings listed by
                                   detailed data */
    _PAD4(1),			/* unused */
    _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),			/* unused */
    _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),			/* unused */
    _FRAME(EOL),
};

xim_externaldef
XimFrameRec query_extension_reply_fr[] = {
    _FRAME(BIT16),		/* input-method-ID */
    _BYTE_COUNTER(BIT16, 1),	/* byte length of extensions supported
				   by both the IM library and IM Server */
    _FRAME(ITER),		/* list of extensions supported by both
				   the IM library and IM server */
    _FRAME(POINTER),
    _PTR(ext_fr),
    _FRAME(EOL),
};

xim_externaldef
XimFrameRec set_im_values_fr[] = {
    _FRAME(BIT16),		/* input-method-ID */
    _BYTE_COUNTER(BIT16, 1),	/* byte length of im-attribute */
    _FRAME(ITER),		/* im-attributes */
    _FRAME(POINTER),
    _PTR(ximattribute_fr),
    _FRAME(EOL),
};

xim_externaldef
XimFrameRec set_im_values_reply_fr[] = {
    _FRAME(BIT16),		/* input-method-ID */
    _PAD4(1),			/* unused */
    _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-attributes returned */
    _FRAME(ITER),		/* im-attributes 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),			/* unused */
    _FRAME(ITER),		/* ic-attributes */
    _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-id */
    _FRAME(BIT16),
    _PAD4(2),			/* unused */
    _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),			/* unused */
    _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),		/* serial number */
    _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_keysym_fr[] = {
    _FRAME(BIT16),		/* input-method-ID */
    _FRAME(BIT16),		/* input-context-ID */
    _FRAME(BIT16),		/* flag */
    _PAD4(1),			/* unused */
    _FRAME(BIT32),		/* KeySym */
    _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),			/* unused */
    _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 preedit string */
    _FRAME(BARRAY),		/* committed string */
    _PAD4(2),			/* unused */
    _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(BIT16),		/* XIMStringConversionPosition */
    _PAD4(1),			/* unused */
    _FRAME(BIT32),		/* XIMCaretDirection */
    _FRAME(BIT16),		/* factor */
    _FRAME(BIT16),		/* XIMStringConversionOperation */
    _FRAME(BIT16),		/* byte length to multiply the
				   XIMStringConversionType */
#if 0
    _PAD4(1),			/* unused */
#endif
    _FRAME(EOL),
};

xim_externaldef
XimFrameRec str_conversion_reply_fr[] = {
    _FRAME(BIT16),		/* input-method-ID */
    _FRAME(BIT16),		/* input-context-ID */
    _FRAME(BIT32),		/* XIMStringConversionFeedback */
    _FRAME(POINTER),
    _PTR(ximstrconvtext_fr),
    _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),			/* unused */
    _BYTE_COUNTER(BIT16, 2),	/* byte length of feedback array */
    _PAD4(1),			/* unused */
    _FRAME(ITER),		/* feedback array */
    _FRAME(POINTER),
    _PTR(ximfeedback_fr),
    _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 preedit_state_fr[] = {
    _FRAME(BIT16),		/* input-method-ID */
    _FRAME(BIT16),		/* input-context-ID */
    _FRAME(BIT32),		/* XIMPreeditState */
    _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),			/* unused */
    _BYTE_COUNTER(BIT16, 2),	/* byte length of feedback array */
    _PAD4(1),			/* unused */
    _FRAME(ITER),		/* feedback array */
    _FRAME(POINTER),
    _PTR(ximfeedback_fr),
    _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),
};

