Back to index

im-sdk  12.3.91
ciku.h
Go to the documentation of this file.
00001 #ifndef _CI_KU_H
00002 #define _CI_KU_H
00003 
00004 #include "GeneType.h"
00005 #include "PyBasic.h"
00006 
00007 #define MAX_CIZU_ITEMS         85000
00008 #define CIZU_ITEM_LEN            126
00009 #define MAX_CIZU_HZ_NUM            9
00010 
00011 #define ENUM_FULL           4
00012 #define ENUM_SIMP           0
00013 #define ENUM_SIMP_W         1
00014 
00015 #define F_PRINT                    1
00016 #define F_NOPRINT           0
00017 
00018 #define READ_RAW_CIZU              1
00019 #define READ_SORTED_CIZU       2
00020 
00021 #define SINGLEHZ_DSP_NONE      0
00022 #define SINGLEHZ_DSP_SIMP      1
00023 #define SINGLEHZ_DSP_FULL      2
00024 
00025 typedef struct _CizuItem {
00026        UCHAR    szLine[CIZU_ITEM_LEN];       /* Org Line read from file */
00027        UCHAR    szHz[2 * MAX_CIZU_HZ_NUM];
00028        UCHAR    szHz2244[2 * MAX_CIZU_HZ_NUM];   /* Notice: may also contain 0x2001 ~ 0x2244, means DuoYinZi */
00029        JINT     nHzNum;
00030        JINT     nYj[MAX_CIZU_HZ_NUM];               /* nHzNum may be diff from nYjNum */
00031        JINT     nYjNum;
00032        JINT     nFreq;
00033        JINT     nbIsXianForm;
00034        JINT     nbIsFanganForm;
00035        JINT     nbIsEnaoForm;
00036        JINT     nXianFormYj[MAX_CIZU_HZ_NUM];
00037        JINT     nFanganFormYj[MAX_CIZU_HZ_NUM];
00038 } CizuItem;          /* Max Array Size is MAX_CIZU_ITEMS(64000) */
00039 
00040 
00041 typedef struct _SingleHanziByYj {
00042        UCHAR    szHanzi[256];
00043        JINT     nHzNum;                      /* don't include nXianFormNum */
00044        JINT     nXianFormNum;
00045        UCHAR    szXianFormList[64];                 /* Seperated by 0x0909 */
00046 } SingleHanziByYj;  /* Max Array Size is NUM_YINJIE(415) */
00047 
00048 
00049 /* 1300: beacause "yi" have max nNumFirstYjIs = 1019 */
00050 typedef struct _CizuGroupByYj {
00051        JINT     nNumFirstYjIs;            /* Number of Cizu which start by this Yinjie Code */
00052        JINT     nNum2ndYjIs[NUM_YINJIE];  /* Number of Cizu whose second Yinjie is 0~414. Sum of this array is nNumFirstYjIs */
00053        JINT     nIdxItem[1300];           /* Index to CizuItem, sorted by nNum2ndYjIs, include also nFanganForm */
00054        JINT     nIdxFanganItem[60];              /* Index to CizuItem which is a Fangan Form, sorted by nIdxItem[1300] */
00055        JINT     nSizePureCizu;            /* Pure Hanzi Number by this Yinjie. Space is 2 * nSizePureCizu */
00056 } CizuGroupByYj;      /* Max Array Size is NUM_YINJIE(415) */
00057 
00058 typedef struct _CikuHeader {
00059        JINT     nMagicDescHi;          /* "PY" ==> 0x5059 ==> 0x35303539 */
00060        JINT     nMagicDescLow;    /* "CK" ==> 0x434B ==> 0x34333442 */
00061        JINT     nSize;          /* Size of this structure: 128 */
00062        JINT     nFileSize;      /* Size of this file */
00063        CHAR     szName[32];     /* Name of this ciku file */
00064        CHAR     szCopyright[48];  /* Copyright info of this file */
00065        JINT     nVersion;       /* Hi(nVersion) is main version, Low() is reversion */
00066        JINT     nLatestTime;           /* Last Create time by seconds from 1970.1.1.0.0.0 */
00067        JINT     nIdxShPos;      /* Index Position from file header of Single Hanzi */
00068        JINT     nIdxDhPos;      /* Index Position from file header of Double Hanzi */
00069        JINT     nIdxMhPos;      /* Index Position from file header of Multi Hanzi  */
00070        JINT     nIdxGbkPos;     /* Index Position from file header of GBK Single Hanzi. MXL 97.12.21 */
00071        JINT     nReserve2;      /* Reserves(2.3) for future development */
00072        JINT     nReserve3;
00073 } CikuHeader;
00074 
00075 typedef struct _ShIndex {   /* SINGLE HANZI */
00076        JINT     nSize;          /* Size of this structure */
00077        JINT     nStartPos;      /* First position of Single Hanzi Data Area */
00078        JINT     nEndPos;        /* End position of Single Hanzi Data Area */
00079        JINT     nYjOff[NUM_YINJIE + 1];  /* Offset of each Yj relative to this nStartPos  */
00080 } ShIndex;
00081 
00082 typedef struct _DhIndex {   /* DOUBLE HANZI CIZU */
00083        JINT    nSize;
00084        JINT    nStartPos;
00085        JINT    nEndPos;
00086        JINT    nYjOff[NUM_YINJIE + 1];   /* Offset of each Yj relative to this nStartPos */
00087 } DhIndex;
00088 
00089 typedef struct _MhIndex {   /* MULTIPLE HANZI CIZU ( > 3 ) */
00090        JINT    nSize;
00091        JINT    nStartPos;
00092        JINT    nEndPos;
00093        JINT    nYjOff[NUM_YINJIE + 1];  /* Offset of each Yj relative to this nStartPos */
00094 } MhIndex;
00095 
00096 typedef struct _GbkIndex {  /* Single Hanzi of Only GBKKKK!! */
00097        JINT    nSize;
00098        JINT    nStartPos;
00099        JINT    nEndPos;
00100        JINT    nYjOff[NUM_YINJIE + 1];   /* Offset of each Yj relative to this nStartPos */
00101 } GbkIndex;
00102 
00103 typedef struct _SysCandi {  /* Candidates come from System Ciku */
00104                                 /* SINGLE HANZI WAS SORTED BY FREQUENCE */
00105        JINT   nOrgYj[9];        /* Original YinjieCode Array of 0~414 & 450~475 */
00106        JINT   nLenYj;
00107        JINT   nNumShCandi;      /* Number of Single Hanzi Candidates, High 8 bits indicates XianNum */
00108        JINT   nSizShCandi;      /* In JWORD */
00109        JWORD* pwShCandi;        /* Pointer of Single Hanzi Area : Encoded in GB2244 */
00110 
00111        JINT   nNumDhCandi;      /* Number of Double Hanzi Candidates */
00112        JINT   nSizDhCandi;      /* In JWORD */
00113        JWORD* pwDhCandi;        /* Pointer of Double Hanzi Area:  Encoded in GB2244, sorted by Freq, with
00114                                    a Word (Not Byte!!!) in front of each Candi to indicates Frequence */
00115 
00116        JINT   nNumMhCandi;      /* Number of Multiple Hanzi Candidates */
00117        JINT   nSizMhCandi;      /* In JWORD */
00118        JWORD* pwMhCandi;        /* Pointer of Multiple Hanzi Area: Encoded in GB2244, Sorted by Length and Freq,
00119                                 ** With a word (Not Byte!!!) in front of each Candi to indicates Length and Freq!
00120                                 ** Contain a 0x0000 in the end of each candidate. */
00121 
00122        JINT   nNumGbkCandi;     /* Number of GBK Single Hanzi Candidates */
00123        JINT   nSizGbkCandi;     /* In JWORD */
00124        JWORD* pwGbkCandi;       /* Pointer of Single Hanzi Area */
00125 } SysCandi;
00126 
00127 /* nMode */
00128 #define LU_SYSCANDI_CALC       1
00129 #define LU_SYSCANDI_WRITE      2
00130 
00131 /* nMatchMode */
00132 #define LU_MATCH_STRICT            1
00133 #define LU_MATCH_WIDELY            2
00134 
00135 typedef struct _UdCikuHeader {
00136        JINT     nMagicDescHi;          /* "PY" ==> 0x5059 ==> 0x35303539 */
00137        JINT     nMagicDescLow;    /* "CK" ==> 0x434B ==> 0x34333442 */
00138        JINT     nSize;          /* Size of this structure: 128 */
00139        JINT     nFileSize;      /* Size of this file */
00140        CHAR     szName[32];     /* Name of this ciku file */
00141        CHAR     szCopyright[48];  /* Copyright info of this file */
00142        JINT     nVersion;       /* Hi(nVersion) is main version, Low() is reversion */
00143        JINT     nLatestTime;           /* Last Create time by seconds from 1970.1.1.0.0.0 */
00144                                 /* Spec Hanzi include UDSINGLEHZ which defined in <PyBasic.h> */
00145        JINT     nSpecHzStartPos;  /* Offset of SpecHz Data Area */
00146        JINT     nSizeSpecHz;           /* 2048 is ENOUGH!! */
00147        JINT     nIdxUdcPos;     /* Index Position from file header of Multi Hanzi */
00148        JINT     nReserve1;      /* Reserves(1.2.3) for future development */
00149        JINT     nReserve2;
00150        JINT     nReserve3;
00151 } UdCikuHeader;
00152 
00153 typedef struct _UdcIndex {  /* Index of User Defined Cizu */
00154        JINT    nSize;
00155        JINT    nStartPos;
00156        JINT    nEndPos;
00157        JINT    nYjOff[NUM_YINJIE + 1];  /* Offset of each Yj relative to this nStartPos */
00158 } UdcIndex;
00159 
00160 typedef struct _UdcMemAll { /* Structure of All Udc Data in Memory */
00161        UdCikuHeader  udcfh;
00162        UdcIndex      udci;
00163        JWORD         *pwUdcSh;
00164        JWORD         *pwUdc28[NUM_YINJIE];
00165 } UdcMemAll;
00166 
00167 #endif  /* End of _CI_KU_H */
00168 
00169