Back to index

im-sdk  12.3.91
codetable.h
Go to the documentation of this file.
00001 #ifndef _CODETABLE_H_
00002 #define _CODETABLE_H_
00003 
00004 /* Limit Constant Defination */
00005 #define MAX_CHNAME_LEN             32 
00006 #define MAX_VERSION_LEN            4 
00007 #define MAX_UUID_LEN        64 
00008 #define MAX_ICON_PATH_LEN   128 
00009 #define MAX_AUTHOR_NAME_LEN 56 
00010 #define MAX_COPYRIGHT_LEN   128 
00011 #define MAX_HINTING_LEN            128 
00012 
00013 #define MAX_USEDCODES_NUM   126 
00014 #define MAX_WILDCHAR_NUM    4 
00015 
00016 /* Limit of Key Prompt */
00017 #define MAX_KEYPROMPT_LEN   4 
00018 
00019 /* Limit of Function Key */
00020 #define MAX_FUNCTIONKEY_LEN 6
00021 
00022 /* CodeTable File Distinguishment Flag */
00023 #define CODETABLE_FLAG             "CODETABLE"
00024 
00025 /* Version Defination */
00026 #define CODETABLE_VERSION   2
00027 
00028 /* Section Constant */
00029 enum _Section_List {
00030        DEFAULT_SECTION = 0,
00031        DESCRIPTION_SECTION,
00032        COMMENT_SECTION      ,
00033        KEYPROMPT_SECTION,
00034        FUNCTIONKEY_SECTION,
00035        PHRASE_SECTION       ,
00036        SINGLE_SECTION       ,
00037        OPTIONS_SECTION      ,
00038        MAX_SECTION_NUM
00039 };
00040 
00041 /* Function Key Defination */
00042 enum _Function_Key_ID {
00043        PAGEUP_KEY_ID = 0,
00044        PAGEDOWN_KEY_ID,
00045        BACKSPACE_KEY_ID,
00046        CLEARALL_KEY_ID      ,
00047        MAX_FUNCTIONKEY_NUM
00048 };
00049 
00050 /* Options Mode Defination */
00051 enum _Option_Mode {
00052        OFF_MODE = 0,
00053        ON_MODE       ,
00054 };
00055 
00056 /* SelectKey Mode Defination */
00057 enum _Select_Key_Mode {
00058        NUMBER0_MODE = 0,
00059        NUMBER_MODE,
00060        LOWER_MODE,
00061        UPPER_MODE,
00062 };
00063 
00064 /* Phrase Seperate Tag */
00065 #define HZ_PHRASE_TAG              '\001'
00066 
00067 /* Bit Operations */
00068 #define BITMASK(i)          (1 << (i))
00069 #define BITSET(a, i)               ((a) |= BITMASK(i))
00070 #define BITCLEAR(a, i)             ((a) &= ~BITMASK(i))
00071 #define GETBIT(a, i)               ((a) & BITMASK(i))
00072 
00073 typedef struct _tableNode {
00074        unsigned char        key;   /* key of this node */
00075        unsigned char   num_NextKeys;      /* number of possible next input key */
00076        unsigned short       num_HZchoice;        /* number of HZ choices */
00077        unsigned int  pos_NextKey;  /* table node pos of next key */
00078        unsigned int  pos_HZidx;    /* index of HZ list */
00079 } tableNode;
00080        
00081 typedef struct _keyPrompt {
00082        unsigned char prompt[MAX_KEYPROMPT_LEN + 1];
00083 } keyPrompt;
00084 
00085 typedef struct _functionKey {
00086        unsigned char keylist[MAX_FUNCTIONKEY_LEN + 1];
00087 } functionKey;
00088 
00089 /* codetable file header structure */
00090 typedef struct {
00091        char          UUID[MAX_UUID_LEN];         /* UUID */
00092        char          Version[MAX_VERSION_LEN];   /* VERSION */
00093        char          Author[MAX_AUTHOR_NAME_LEN];    /* Author */
00094        char          Copyright[MAX_COPYRIGHT_LEN];   /* CopyRight */
00095        char          Hinting[MAX_HINTING_LEN];       /* Hingting */
00096        char          IconPath[MAX_ICON_PATH_LEN];       /* icon path */
00097 
00098        char          Encode;                            /* UTF-8 or native: encode of dict */     
00099        unsigned char        Cname[MAX_CHNAME_LEN];      /* IM Name */
00100        char                 UsedCodes[MAX_USEDCODES_NUM];   /* Characters for valid input */
00101        unsigned char        WildChar[MAX_WILDCHAR_NUM]; /* Characters for WildChar */
00102        char                 MaxCodes;                   /* Max number of extern codes */
00103 
00104        char          bSectionsFlag;                     /* sections exist flag */
00105 
00106        char          Output_Encode;                     /* encode of output */
00107        unsigned      nKeyByKeyMode               :1;
00108        unsigned      nHelpInfoMode               :1;
00109        unsigned      nAutoSelectMode      :1;
00110        unsigned      nKeyPromptMode              :1;
00111        unsigned      nDisplayOnSpotMode   :1;
00112        unsigned      nSelectKeyMode              :2;
00113        unsigned      nReserved            :1;
00114 
00115        unsigned int  sizeHZList;                 /* size of whole hz list */
00116        unsigned int  sizeNodeList;               /* size of whole node list */
00117        unsigned char        *hzList;                    /* pointer of characters list */
00118        tableNode     *nodeList;                  /* pointer of Tree Node List */
00119        
00120        keyPrompt     *keyprompt;                 /* prompt list of keys */
00121        functionKey   *functionkey;               /* Functions key defination list */
00122               
00123 } CodeTableStruct;
00124 
00125 #endif    /*  _CODETABLE_H_  */