Back to index

im-sdk  12.3.91
print-misc.c
Go to the documentation of this file.
00001 #include <iiimp-data.h>
00002 #include <iiimp-opcode.h>
00003 
00004 #include "print-misc.h"
00005 
00006 
00007 typedef struct {
00008     int       id;
00009     char *    string;
00010 } id_string_pair;
00011 
00012 static id_string_pair opcode_string[] = {
00013        {0,                         "IM_NOP (0)"},
00014 
00015        {IM_CONNECT,                "IM_CONNECT"},
00016        {IM_CONNECT_REPLY,          "IM_CONNECT_REPLY"},
00017        {IM_DISCONNECT,                    "IM_DISCONNECT"},
00018        {IM_DISCONNECT_REPLY ,      "IM_DISCONNECT_REPLY"},
00019        {IM_REGISTER_TRIGGER_KEYS,  "IM_REGISTER_TRIGGER_KEYS"},
00020        {IM_TRIGGER_NOTIFY,         "IM_TRIGGER_NOTIFY"},
00021        {IM_TRIGGER_NOTIFY_REPLY,   "IM_TRIGGER_NOTIFY_REPLY"},
00022        {IM_SETIMVALUES,            "IM_SETIMVALUES"},
00023        {IM_SETIMVALUES_REPLY,             "IM_SETIMVALUES_REPLY"},
00024        {IM_GETIMVALUES,            "IM_GETIMVALUES"},
00025        {IM_GETIMVALUES_REPLY,             "IM_GETIMVALUES_REPLY"},
00026 
00027        {IM_FORWARD_EVENT,          "IM_FORWARD_EVENT"},
00028        {IM_FORWARD_EVENT_REPLY,    "IM_FORWARD_EVENT_REPLY"},
00029        {IM_COMMIT_STRING,          "IM_COMMIT_STRING"},
00030        {IM_FORWARD_EVENT_WITH_OPERATIONS,
00031         "IM_FORWARD_EVENT_WITH_OPERATIONS"},
00032        {IM_FORWARD_EVENT_WITH_OPERATIONS_REPLY,
00033         "IM_FORWARD_EVENT_WITH_OPERATIONS_REPLY"},
00034 
00035        {IM_REGISTER_HOTKEYS,       "IM_REGISTER_HOTKEYS"},
00036        {IM_HOTKEY_NOTIFY,          "IM_HOTKEY_NOTIFY"},
00037        {IM_HOTKEY_NOTIFY_REPLY,    "IM_HOTKEY_NOTIFY_REPLY"},
00038 
00039        {IM_CREATEIC,               "IM_CREATEIC"},
00040        {IM_CREATEIC_REPLY,         "IM_CREATEIC_REPLY"},
00041        {IM_DESTROYIC,                     "IM_DESTROYIC"},
00042        {IM_DESTROYIC_REPLY,        "IM_DESTROYIC_REPLY"},
00043        {IM_SETICVALUES,            "IM_SETICVALUES"},
00044        {IM_SETICVALUES_REPLY,             "IM_SETICVALUES_REPLY"},
00045        {IM_GETICVALUES,            "IM_GETICVALUES"},
00046        {IM_GETICVALUES_REPLY,             "IM_GETICVALUES_REPLY"},
00047        {IM_SETICFOCUS,                    "IM_SETICFOCUS"},
00048        {IM_SETICFOCUS_REPLY,              "IM_SETICFOCUS_REPLY"},
00049        {IM_UNSETICFOCUS,           "IM_UNSETICFOCUS"},
00050        {IM_UNSETICFOCUS_REPLY,            "IM_UNSETICFOCUS_REPLY"},
00051        {IM_RESETIC,                "IM_RESETIC"},
00052        {IM_RESETIC_REPLY,          "IM_RESETIC_REPLY"},
00053 
00054        {IM_HOTKEY_STATE_NOTIFY,    "IM_HOTKEY_STATE_NOTIFY"},
00055        {IM_HOTKEY_STATE_NOTIFY_REPLY,     "IM_HOTKEY_STATE_NOTIFY_REPLY"},
00056        {IM_SELECT_HOTKEY_PROFILE,  "IM_SELECT_HOTKEY_PROFILE"},
00057        {37,                        "IM_NOP (37)"},
00058        {38,                        "IM_NOP (38)"},
00059        {39,                        "IM_NOP (39)"},
00060 
00061        {IM_PREEDIT_START,          "IM_PREEDIT_START"},
00062        {IM_PREEDIT_START_REPLY,    "IM_PREEDIT_START_REPLY"},
00063        {IM_PREEDIT_DRAW,           "IM_PREEDIT_DRAW"},
00064        {IM_PREEDIT_DRAW_REPLY,            "IM_PREEDIT_DRAW_REPLY"},
00065        {44,                        "IM_NOP (44)"},
00066        {45,                        "IM_NOP (45)"},
00067        {IM_PREEDIT_DONE,           "IM_PREEDIT_DONE"},
00068        {IM_PREEDIT_DONE_REPLY,            "IM_PREEDIT_DONE_REPLY"},
00069 
00070        {48,                        "IM_NOP (48)"},
00071        {49,                        "IM_NOP (49)"},
00072 
00073        {IM_STATUS_START,           "IM_STATUS_START"},
00074        {IM_STATUS_START_REPLY,            "IM_STATUS_START_REPLY"},
00075        {IM_STATUS_DRAW,            "IM_STATUS_DRAW"},
00076        {IM_STATUS_DRAW_REPLY,             "IM_STATUS_DRAW_REPLY"},
00077        {IM_STATUS_DONE,            "IM_STATUS_DONE"},
00078        {IM_STATUS_DONE_REPLY,             "IM_STATUS_DONE_REPLY"},
00079 
00080        {56,                        "IM_NOP (56)"},
00081        {57,                        "IM_NOP (57)"},
00082        {58,                        "IM_NOP (58)"},
00083        {59,                        "IM_NOP (59)"},
00084        {60,                        "IM_NOP (60)"},
00085        {61,                        "IM_NOP (61)"},
00086        {62,                        "IM_NOP (62)"},
00087        {63,                        "IM_NOP (63)"},
00088        {64,                        "IM_NOP (64)"},
00089        {65,                        "IM_NOP (65)"},
00090        {66,                        "IM_NOP (66)"},
00091        {67,                        "IM_NOP (67)"},
00092        {68,                        "IM_NOP (68)"},
00093        {69,                        "IM_NOP (69)"},
00094 
00095        {IM_LOOKUP_CHOICE_START,    "IM_LOOKUP_CHOICE_START"},
00096        {IM_LOOKUP_CHOICE_START_REPLY,
00097         "IM_LOOKUP_CHOICE_START_REPLY"},
00098        {IM_LOOKUP_CHOICE_DRAW,            "IM_LOOKUP_CHOICE_DRAW"},
00099        {IM_LOOKUP_CHOICE_DRAW_REPLY,      "IM_LOOKUP_CHOICE_DRAW_REPLY"},
00100        {IM_LOOKUP_CHOICE_DONE,            "IM_LOOKUP_CHOICE_DONE"},
00101        {IM_LOOKUP_CHOICE_DONE_REPLY,      "IM_LOOKUP_CHOICE_DONE_REPLY"},
00102        {IM_LOOKUP_CHOICE_PROCESS,  "IM_LOOKUP_CHOICE_PROCESS"},
00103        {IM_LOOKUP_CHOICE_PROCESS_REPLY,"IM_LOOKUP_CHOICE_PROCESS_REPLY"},
00104 
00105        {78,                        "IM_NOP (78)"},
00106        {79,                        "IM_NOP (79)"},
00107        {80,                        "IM_NOP (80)"},
00108        {81,                        "IM_NOP (81)"},
00109        {82,                        "IM_NOP (82)"},
00110        {83,                        "IM_NOP (83)"},
00111        {84,                        "IM_NOP (84)"},
00112        {85,                        "IM_NOP (85)"},
00113        {86,                        "IM_NOP (86)"},
00114        {87,                        "IM_NOP (87)"},
00115        {88,                        "IM_NOP (88)"},
00116        {89,                        "IM_NOP (89)"},
00117 
00118        {IM_AUX_START,                     "IM_AUX_START"},
00119        {IM_AUX_START_REPLY,        "IM_AUX_START_REPLY"},
00120        {IM_AUX_DRAW,               "IM_AUX_DRAW"},
00121        {IM_AUX_DRAW_REPLY,         "IM_AUX_DRAW_REPLY"},
00122        {IM_AUX_DONE,               "IM_AUX_DONE"},
00123        {IM_AUX_DONE_REPLY,         "IM_AUX_DONE_REPLY"},
00124        {IM_AUX_SETVALUES,          "IM_AUX_SETVALUES"},
00125        {IM_AUX_SETVALUES_REPLY,    "IM_AUX_SETVALUES_REPLY"},
00126        {IM_AUX_GETVALUES,          "IM_AUX_GETVALUES"},
00127        {IM_AUX_GETVALUES_REPLY,    "IM_AUX_GETVALUES_REPLY"},
00128 
00129        {IM_PROTOCOL_VERSION,              "IM_PROTOCOL_VERSION (100)"},
00130        {IM_FILE_OPERATION,         "IM_FILE_OPERATION"},
00131        {IM_FILE_OPERATION_REPLY,   "IM_FILE_OPERATION_REPLY"},
00132        {103,                       "IM_NOP (103)"},
00133        {104,                       "IM_NOP (104)"},
00134        {105,                       "IM_NOP (105)"},
00135        {106,                       "IM_NOP (106)"},
00136        {107,                       "IM_NOP (107)"},
00137        {108,                       "IM_NOP (108)"},
00138        {109,                       "IM_NOP (109)"},
00139        {110,                       "IM_NOP (110)"},
00140        {111,                       "IM_NOP (111)"},
00141        {112,                       "IM_NOP (112)"},
00142        {113,                       "IM_NOP (113)"},
00143        {114,                       "IM_NOP (114)"},
00144        {115,                       "IM_NOP (115)"},
00145        {116,                       "IM_NOP (116)"},
00146        {117,                       "IM_NOP (117)"},
00147        {118,                       "IM_NOP (118)"},
00148        {119,                       "IM_NOP (119)"},
00149        {120,                       "IM_NOP (120)"},
00150        {121,                       "IM_NOP (121)"},
00151        {122,                       "IM_NOP (122)"},
00152        {123,                       "IM_NOP (123)"},
00153        {124,                       "IM_NOP (124)"},
00154        {125,                       "IM_NOP (125)"},
00155        {126,                       "IM_NOP (126)"},
00156        {127,                       "IM_NOP (127)"},
00157 };
00158 
00159 
00160 #define FEEDBACK_NUM (3)
00161 static char * feedback_string[] = {
00162        "Normal",
00163        "Reverse",
00164        "Underline",
00165        "Undefined"
00166 };
00167 
00168 
00169 #define OBJECT_DESCRIPTOR_CATEGORY_NUM    (5)
00170 static char * object_descriptor_category_string[] = {
00171        "GUI",
00172        "LWE",
00173        "Syntax Rule",
00174        "IM Manager rule",
00175        "Preloading LWE",
00176        "unknown"
00177 };
00178 
00179 static id_string_pair annotation_id_string[] = {
00180        {IIIMP_ANNOTATION_TEXT_INPUT_BEFORE_CONVERSION,
00181         "text input before conversion"},
00182        {IIIMP_ANNOTATION_READING_OF_THE_TEXT,    "reading of the text"},
00183        {IIIMP_ANNOTATION_TYPE_OF_SPEECH,  "type of speech"},
00184        {IIIMP_ANNOTATION_TYPE_OF_CLAUSE,  "type of clause"},
00185        {0x00,                             "invalid"}
00186 };
00187 
00188 static id_string_pair       imattribute_id_string[] = {
00189        {IIIMP_IMATTRIBUTE_INPUT_METHOD_LIST,
00190         "Input Method List"},
00191        {IIIMP_IMATTRIBUTE_OBJECT_DESCRIPTOR_LIST,
00192         "Object Descriptor List"},
00193        {IIIMP_IMATTRIBUTE_CLIENT_DESCRIPTOR,
00194         "Client Descriptor"},
00195        {IIIMP_IMATTRIBUTE_CHARACTER_CONVERSION_DEFINITION_RULE,
00196         "Character Conversion Definition Rule"},
00197        {IIIMP_IMATTRIBUTE_JAR_GUI_OBJECT,
00198         "Jar GUI Object"},
00199        {IIIMP_IMATTRIBUTE_JAR_LIGHT_WEIGHT_ENGINE_OBJECT,
00200         "Jar Light Weight Engine Object"},
00201        {IIIMP_IMATTRIBUTE_BINARY_GUI_OBJECT,
00202         "Binary GUI Object"},
00203        {IIIMP_IMATTRIBUTE_BINARY_LIGHT_WEIGHT_ENGINE_OBJECT,
00204         "Binary Light Weight Engine Object"},
00205        {IIIMP_IMATTRIBUTE_SCRIPT_GUI_OBJECT,
00206         "SCRIPT GUI Object"},
00207        {IIIMP_IMATTRIBUTE_SCRIPT_LIGHT_WEIGHT_ENGINE_OBJECT,
00208         "SCRIPT Light Weight Engine Object"},
00209        {0x0000,                    "undefined"},
00210 };
00211 
00212 static id_string_pair       icattribute_id_string[] = {
00213        {IIIMP_ICATTRIBUTE_INPUT_LANGUAGE, "Input Language"},
00214        {IIIMP_ICATTRIBUTE_CHARACTER_SUBSETS,     "Character Subsets"},
00215        {IIIMP_ICATTRIBUTE_INPUT_METHOD_NAME,     "Input Method Name"},
00216        {IIIMP_ICATTRIBUTE_INPUT_METHOD,   "Input Method"},
00217        {0x00,                             "undefined"}
00218 };
00219 
00220 static id_string_pair lookup_choice_master_string[] = {
00221        {IM_LOOKUP_CHOICE_START_SERVER_IS_MASTER, "ServerIsMaster"},
00222        {IM_LOOKUP_CHOICE_START_CLIENT_IS_MASTER, "ClientIsMaster"},
00223        {IM_LOOKUP_CHOICE_START_UNKNOWN_IS_MASTER,"UnknownIsMaster"}
00224 };
00225 
00226 
00227 static id_string_pair lookup_choice_direction_string[] = {
00228        {IM_LOOKUP_CHOICE_START_DRAWING_UP_HORIZONTALLY, "Horizontal "},
00229        {IM_LOOKUP_CHOICE_START_DRAWING_UP_VERTICALLY,          "Vertical "},
00230        {-1,                                             "Unknown "}
00231 };
00232 
00233 static id_string_pair lookup_choice_label_owner_string[] = {
00234        {IM_LOOKUP_CHOICE_START_SERVER_OWNS_LABEL,       "ServerOwnsLabel"},
00235        {IM_LOOKUP_CHOICE_START_CLIENT_OWNS_LABEL,       "ClientOwnsLabel"},
00236        {-1,                                      "UnknownOwnsLabel"}
00237 };
00238 
00239 static id_string_pair lookup_choice_process_page_string[] = {
00240        {IM_LOOKUP_CHOICE_PROCESS_PAGE_NEXT_PAGE, "NEXT_PAGE"},
00241        {IM_LOOKUP_CHOICE_PROCESS_PAGE_PREV_PAGE, "PREV_PAGE"},
00242        {IM_LOOKUP_CHOICE_PROCESS_PAGE_FIRST_PAGE,       "FIRST_PAGE"},
00243        {IM_LOOKUP_CHOICE_PROCESS_PAGE_LAST_PAGE, "LAST_PAGE"},
00244        {0,                                       "NO_PAGE"}
00245 };
00246 
00247 
00248 #define CHARACTER_SUBSETS_STRING_NUM      (73)
00249 static char * character_subsets_string[] = {
00250        "undefined(0)",
00251        "BASIC_LATIN",
00252        "LATIN_1_SUPPLEMENT",
00253        "LATIN_EXTENDED_A",
00254        "LATIN_EXTENDED_B",
00255        "IPA_EXTENTIONS",
00256        "SPACING_MODIFIER_LETTERS",
00257        "COMBINING_DIACRITICAL_MARKS",
00258        "GREEK",
00259        "CYRILLIC",
00260        "ARMENIAN",
00261        "HEBREW",
00262        "ARABIC",
00263        "DEVANAGARI",
00264        "BENGALI",
00265        "GURMUKHI",
00266        "GUJARATI",
00267        "ORIYA",
00268        "TAMIL",
00269        "TELUGU",
00270        "KANNADA",
00271        "MALAYALAM",
00272        "THAI",
00273        "LAO",
00274        "TIBETAN",
00275        "GEORGIAN",
00276        "HANGUL_JAMO",
00277        "LATIN_EXTENDED_ADDITIONAL",
00278        "GREEK_EXTENDED",
00279        "GENERAL_PUNCTUATION",
00280        "SUPERSCRIPTS_AND_SUBSCRIPTS",
00281        "CURRENCY_SYMBOLS",
00282        "COMBINING_MARKS_FOR_SYMBOLS",
00283        "LETTERLIKE_SYMBOLS",
00284        "NUMBER_FORMS",
00285        "ARROWS",
00286        "MATHEMATICAL_OPERATORS",
00287        "MISCELLANEOUS_TECHNICAL",
00288        "CONTROL_PICTURES",
00289        "OPTICAL_CHARACTER_RECOGNITION",
00290        "ENCLOSED_ALPHANUMERICS",
00291        "BOX_DRAWING",
00292        "BLOCK_ELEMENTS",
00293        "GEOMETRIC_SHAPES",
00294        "MISCELLANEOUS_SYMBOLS",
00295        "DINGBATS",
00296        "CJK_SYMBOLS_AND_PUNCTUATION",
00297        "HIRAGANA",
00298        "KATAKANA",
00299        "BOPOMOFO",
00300        "HANGUL_COMPATIBILITY_JAMO",
00301        "KANBUN",
00302        "ENCLOSED_CJK_LETTERS_AND_MONTHS",
00303        "CJK_COMPATIBILITY",
00304        "CJK_UNIFIED_IDEOGRAPHS",
00305        "HANGUL_SYLLABLES",
00306        "SURROGATES_AREA",
00307        "PRIVATE_USE_AREA",
00308        "CJK_COMPATIBILITY_IDEOGRAPHS",
00309        "ALPHABETIC_PRESENTATION_FORMS",
00310        "ARABIC_PRESENTATION_FORMS_A",
00311        "COMBINING_HALF_MARKS",
00312        "CJK_COMPATIBILITY_FORMS",
00313        "SMALL_FORM_VARIANTS",
00314        "ARABIC_PRESENTATION_FORMS_B",
00315        "HALFWIDTH_AND_FULLWIDTH_FORMS",
00316        "SPECIALS",
00317        "LATIN",
00318        "LATIN_DIGITS",
00319        "TRADITIONAL_HANZI",
00320        "SIMPLIFIED_HANZI",
00321        "KANJI",
00322        "HANJA",
00323        "HALFWIDTH_KATAKANA",
00324 };
00325 
00326 
00327 const char *
00328 opcode_string_get(int num)
00329 {
00330     return opcode_string[0x7f & num].string;
00331 }
00332 
00333 
00334 const char *
00335 feedback_string_get(int num)
00336 {
00337     if ((num < 0) || (FEEDBACK_NUM < num)) {
00338        num = FEEDBACK_NUM;
00339     }
00340     return feedback_string[num];
00341 }
00342 
00343 
00344 const char *
00345 object_descriptor_category_string_get(int num)
00346 {
00347     if ((num < 0) || (OBJECT_DESCRIPTOR_CATEGORY_NUM < num)) {
00348        num = OBJECT_DESCRIPTOR_CATEGORY_NUM;
00349     }
00350     return object_descriptor_category_string[num];
00351 }
00352 
00353 
00354 static const char *
00355 id_string_pair_search(id_string_pair * p, int key, int key_stop)
00356 {
00357     for (; (key != p->id) && (key_stop != p->id); p++) {}
00358     return p->string;
00359 }
00360 
00361 
00362 const char *
00363 annotation_id_string_get(int num)
00364 {
00365     return id_string_pair_search(annotation_id_string, num, 0);
00366 }
00367 
00368 
00369 const char *
00370 imattribute_id_string_get(int num)
00371 {
00372     return id_string_pair_search(imattribute_id_string, num, 0);
00373 }
00374 
00375 
00376 const char *
00377 icattribute_id_string_get(int num)
00378 {
00379     return id_string_pair_search(icattribute_id_string, num, 0);
00380 }
00381 
00382 
00383 const char *
00384 lookup_choice_master_string_get(int num)
00385 {
00386     return id_string_pair_search(lookup_choice_master_string, num, 0);
00387 }
00388 
00389 
00390 const char *
00391 lookup_choice_direction_string_get(int num)
00392 {
00393     return id_string_pair_search(lookup_choice_direction_string, num, -1);
00394 }
00395 
00396 
00397 const char *
00398 lookup_choice_label_owner_string_get(int num)
00399 {
00400     return id_string_pair_search(lookup_choice_label_owner_string, num, -1);
00401 }
00402 
00403 
00404 const char *
00405 lookup_choice_process_page_string_get(int num)
00406 {
00407     return id_string_pair_search(lookup_choice_process_page_string, num, 0);
00408 }
00409 
00410 
00411 const char *
00412 character_subsets_string_get(int num)
00413 {
00414     if ((num < 0) || (CHARACTER_SUBSETS_STRING_NUM < num)) {
00415        num = 0;
00416     }
00417     return character_subsets_string[num];
00418 }
00419 
00420 
00421 const char *
00422 iiimp_opcode_string(int num)
00423 {
00424     return opcode_string[0x7f & num].string;
00425 }
00426 
00427 
00428 /* Local Variables: */
00429 /* c-file-style: "iiim-project" */
00430 /* End: */