Back to index

im-sdk  12.3.91
UDEngine.h
Go to the documentation of this file.
00001 /*
00002 Copyright 1990-2001 Sun Microsystems, Inc. All Rights Reserved.
00003 
00004 Permission is hereby granted, free of charge, to any person obtaining a
00005 copy of this software and associated documentation files (the
00006 "Software"), to deal in the Software without restriction, including
00007 without limitation the rights to use, copy, modify, merge, publish,
00008 distribute, sublicense, and/or sell copies of the Software, and to
00009 permit persons to whom the Software is furnished to do so, subject to
00010 the following conditions: The above copyright notice and this
00011 permission notice shall be included in all copies or substantial
00012 portions of the Software.
00013 
00014 
00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00016 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00017 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00018 IN NO EVENT SHALL THE OPEN GROUP OR SUN MICROSYSTEMS, INC. BE LIABLE
00019 FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
00020 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
00021 THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE EVEN IF
00022 ADVISED IN ADVANCE OF THE POSSIBILITY OF SUCH DAMAGES.
00023 
00024 
00025 Except as contained in this notice, the names of The Open Group and/or
00026 Sun Microsystems, Inc. shall not be used in advertising or otherwise to
00027 promote the sale, use or other dealings in this Software without prior
00028 written authorization from The Open Group and/or Sun Microsystems,
00029 Inc., as applicable.
00030 
00031 
00032 X Window System is a trademark of The Open Group
00033 
00034 OSF/1, OSF/Motif and Motif are registered trademarks, and OSF, the OSF
00035 logo, LBX, X Window System, and Xinerama are trademarks of the Open
00036 Group. All other trademarks and registered trademarks mentioned herein
00037 are the property of their respective owners. No right, title or
00038 interest in or to any trademark, service mark, logo or trade name of
00039 Sun Microsystems, Inc. or its licensors is granted.
00040 
00041 */
00042 #ifndef UDENGINE_HH
00043 #define UDENGINE_HH
00044 
00045 #include "CodeTable.h"
00046 
00047 /* input context arguments */
00048 
00049 #define MAX_SESSION         512    
00050 #define MAX_CANDIDATE              40
00051 #define MAX_CHAR_PREEDIT    13
00052 #define MAX_CHAR_COMMIT            25
00053 #define IM_NAME_LEN         16
00054 
00055 /* operation type */
00056 
00057 #define CIM_INTERM          0
00058 #define CIM_COMMIT          1
00059 #define CIM_BOUNCEKEY       2
00060 #define CIM_COMMITSYMBOL    6
00061 #define CIM_STATUS          8
00062 
00063 /* label type */
00064 
00065 #define USE_HTT_LABEL           0
00066 #define NUMERIC_LABEL           1
00067 #define LOWER_LABEL      2
00068 #define UPPER_LABEL      3
00069 
00070 /* status value */
00071 
00072 #define QUANJIAO_ON     0
00073 #define QUANJIAO_OFF    1
00074 
00075 #define QUANJIAO_STR    "/ȫ\0"
00076 #define BANJIAO_STR     "/\0"
00077 
00078 #define LOOKUP_CHOICE   0
00079 #define PRE_EDIT        1
00080 
00081 #define PAGEUP          0
00082 #define PAGEDOWN        1
00083 
00084 /* aux value id */
00085 
00086 #define PUNCTUATION_STATUS    1
00087 #define SOFTKEYBOARD_LAYOUT   2
00088 #define GBKSWITCH_STATUS      3
00089 #define IM_STATUS          1
00090 
00091 /* data struct to transfer to sunim */
00092 
00093 typedef struct _im_data {
00094     int      operation;            /* operation type */
00095     unsigned char pre_str[256];    /* the preedit string */
00096     int      caret_pos;            /* the caret postion */
00097     char     luc_str[10][48];      /* the lookup choice string */
00098     int      luc_num;              /* the number of choices */
00099     char     commit_str[512];      /* the committed string */
00100     char     status_str[32];       /* the status string */
00101     int      error_num;
00102     int      labeltype;               /* label type "123", "abc", "ABC" */
00103 } im_data;
00104 
00105 
00106 /* data buffer for engine */
00107 
00108 #define Mode            buffer[session_id]->mode
00109 #define IM_Status       buffer[session_id]->status
00110 #define Preedit_Buf     buffer[session_id]->preedit
00111 #define Preedit_Len     buffer[session_id]->preedit_len
00112 #define Inbuf           buffer[session_id]->inbuf
00113 #define Inbuf_Len       buffer[session_id]->inbuf_len
00114 #define Commit_Buf      buffer[session_id]->commit
00115 #define WildChar_Pos    buffer[session_id]->wildchar_pos
00116 #define Candidate       buffer[session_id]->candidate
00117 #define First_Candidate buffer[session_id]->candidate_low
00118 #define Last_Candidate  buffer[session_id]->candidate_high
00119 #define S_Pointer       buffer[session_id]->search_pointer
00120 #define S_Direction     buffer[session_id]->search_direction
00121 #define LUC_Low         buffer[session_id]->lookupchoice_low
00122 #define LUC_High        buffer[session_id]->lookupchoice_high
00123 #define LUC_Number      buffer[session_id]->lookupchoice_number
00124 #define This_Operation  buffer[session_id]->this_operation
00125 #define Input_Method    buffer[session_id]->input_method
00126 #define Quanjiao        buffer[session_id]->quanjiao
00127 
00128 struct im_buffer {
00129     char        preedit[MAX_CHAR_PREEDIT];
00130     short int   preedit_len;
00131     char        commit[MAX_CHAR_COMMIT];
00132     char        inbuf[MAX_CHAR_PREEDIT];
00133     short int   inbuf_len;
00134     short int   wildchar_pos;
00135     char        * candidate[MAX_CANDIDATE];
00136     int         candidate_low;
00137     int         candidate_high;
00138     int         lookupchoice_low;
00139     int         lookupchoice_high;
00140     int              lookupchoice_number;
00141     int         search_pointer;
00142     int       search_direction;
00143     int         this_operation;
00144     int         mode;
00145     char        status[20];
00146     int         input_method;
00147     int         quanjiao;
00148 };
00149 
00150 /*
00151  * input method structure:
00152  */
00153 
00154 typedef struct _engine_info {
00155         char            name[16];       /* input method name */
00156         char            locale[16];
00157         char            next_choice;    /* key for next choice */
00158         char            prev_choice;    /* key for prev choice */
00159         char            del_pe_char;    /* key for delete preedit character */
00160         char            del_pe_str;     /* key for delete preedit string */
00161         char            wild_char;      /* */
00162         char            symbol;
00163         char            status_native[32];
00164         char            ct_file[80];    /* Code table file */
00165         table_index     tab_idx[MAXIDX];
00166         code_table      *c_tab;         /* Initial = NULL */
00167         char            *data;
00168 } engine_info;
00169 
00170 /*
00171   for new mode of Chinese symbols. -- roxon
00172 */
00173 
00174 #define PERIOD 0xa1a3           /* . */
00175 #define COMMAM 0xa3ac           /* , */
00176 #define EXCLMM 0xa3a1           /* ! */
00177 #define COLONM 0xa3ba           /* : */
00178 #define HYPHEN 0xa3ad           /* - */
00179 #define CARETM 0xa3de           /* ^ */
00180 #define DSPACE 0xa1a1           /*   */
00181 
00182 #define LPARNT 0xa3a8           /* ( */
00183 #define RPARNT 0xa3a9           /* ) */
00184 #define LCUBRT 0xa3fb           /* { */
00185 #define RCUBRT 0xa3fd           /* } */
00186 #define LSQBRT 0xa3db           /* [ */
00187 #define RSQBRT 0xa3dd           /* ] */
00188 
00189 #define SNGQUO 0xa1e4           /* ' */
00190 #define ACCENT 0xa3e0           /* ` */
00191 #define DBLQUO 0xa1e5           /* " */
00192 
00193 #define AMPERS 0xa3a6           /* & */
00194 #define COMMAT 0xa3c0           /* @ */
00195 #define SOLDUS 0xa1a2           /* / 0xa3af*/
00196 #define SEMCLN 0xa3bb           /* ; */
00197 #define QUESTM 0xa3bf           /* ? */
00198 #define LESSTH 0xa3bc           /* < */
00199 #define GREATH 0xa3be           /* > */
00200 #define VERBAR 0xa3fc           /* | */
00201 #define EQUALS 0xa3bd           /* = */
00202 
00203 #define SGNNUM 0xa3a3           /* # */
00204 #define DALLAR 0xa3a4           /* $ */
00205 #define PERCNT 0xa3a5           /* % */
00206 #define SGNSTR 0xa3aa           /* * */
00207 #define UNDSCR 0xa3df           /* _ */
00208 #define BCKSLH 0xa3dc           /* \ */
00209 #define STILDE 0xa1ab           /* ~ */
00210 #define SGNADD 0xa3ab           /* + */
00211 
00212 #define DIGITS 0xa3b0           /* 0-9 */
00213 
00214 #define UPPERS 0xa3c1           /* A-Z */
00215 
00216 #define LOWERS 0xa3e1           /* a-z */
00217 
00218 #define CTRL_F 6
00219 #define CTRL_P 16
00220 #define CTRL_N  14
00221 
00222 #endif