Back to index

im-sdk  12.3.91
ciku.c
Go to the documentation of this file.
00001 #include  <stdio.h>
00002 #include  <string.h>
00003 #include  <stdlib.h>
00004 #include  "GeneType.h"
00005 #include  "PyBasic.h"
00006 #include  "ciku.h"
00007 
00008 VOID   ProcGbkHz(VOID);
00009 
00010 VOID   CreateUdCikuFile();
00011 JINT   ReadUdcData(CHAR* szUdcName);
00012 JINT   WriteUdcData(CHAR* szUdcName, JINT nTimeStamp);
00013 JINT   AddUdc(JWORD* pwHz2244, JINT nLen);
00014 JINT   DelUdc(JWORD* pwHz2244, JINT nLen);
00015 JINT   PureUdc(VOID);
00016 
00017 VOID   ParseSample(VOID);
00018 VOID   ListSysCandiInfo(SysCandi *psc);
00019 JINT   GetXrdCandi(SysCandi* psc, JINT nXrd, JWORD* pwOneCandi);
00020 VOID   ParseRawInputStr(CHAR* szPreedit, JINT* pnOutPreedit);
00021 VOID   DecompPeIntArray(JINT *pnOutPreedit, CHAR* szDspPreedit);
00022 
00023 extern JINT    HzcodeToYjcode(JINT nHzcode);
00024 JINT   Hzcode2244ToYjcode(JINT nHzcode);
00025 JINT   GetDyzInfo(JINT nHzcode, JINT* pnDyzYjCode);
00026 JINT   EncodeDyzTo2244(JINT nHzcode, JINT nYjcode);
00027 JINT   FastMatchYinJieStr(CHAR* szPystr);
00028 UCHAR* RecovDyz2244(UCHAR *szDyz2244);
00029 CHAR   LastChar (JINT nYinjieCode);
00030 CHAR   FirstChar(JINT nYinjieCode);
00031 JINT   ValidButLastChar (JINT nYinjieCode);
00032 JINT   ValidButFirstChar(JINT nYinjieCode);
00033 JINT   ValidAddChar(CHAR ch, JINT nYinjieCode);
00034 
00035 VOID   InitCizuItem(JINT nItems);
00036 VOID   InitSingleHanziByYj(JINT nArraySize);
00037 VOID   InitCizuGroupByYj(JINT nArraySize);
00038 VOID   CopyStructCZ(CizuItem* pThisCZ, CizuItem* pNewCZ);
00039 VOID   GetAllCizuItems(JINT nMode);
00040 VOID   GetAllCizuItems_CZPY(JINT nMode);
00041 JINT   GetNextLine(FILE* pfFile, CHAR* szBuf);
00042 VOID   FilterVtoU(UCHAR* pszLine);
00043 VOID   GetHzInfo(UCHAR *pszLine, UCHAR *pszHz, JINT *pnYj, JINT *pnHzNum, JINT *pnYjNum);
00044 VOID   GetYjInfo(UCHAR *pszLine, UCHAR *pszHz, JINT *pnYj, UCHAR *pszHz2244);
00045 JINT   EnumFanganForm(UCHAR *pszHz, JINT *pnYj, JINT nYjNum, JINT *pnbFanganFlag, JINT *pnFanganYj, JINT nMode, JINT nDspMode);
00046 JINT   EnumEnaoForm  (UCHAR* pszHz, JINT *pnYj, JINT nYjNum, JINT *pnbEnaoFlag,   JINT *pnFanganYj, JINT nMode, JINT nDspMode);
00047 JINT   EnumXianForm  (UCHAR* pszHz, JINT *pnYj, JINT nYjNum, JINT *pnbXianFlag,   JINT *pnXianYj,   JINT nMode, JINT nDspMode);
00048 VOID   BuildSingleHzDB(JINT nDspMode);
00049 
00050 JINT   CompIntArray(JINT* pnArray1, JINT* pnArray2);
00051 VOID   QuickSort(JINT nFirst, JINT nLast);
00052 
00053 VOID   CreateAllData();
00054 VOID   CreateCikuFile();
00055 VOID   SetCkh(CikuHeader *pCkh);
00056 VOID   SetShi(ShIndex *pShi);
00057 VOID   SetDhi(DhIndex *pDhi);
00058 VOID   SetMhi(MhIndex *pMhi);
00059 
00060 JINT   WriteCikuData (CHAR* szSysCikuName, JINT nTimeStamp);
00061 JINT   GetCikuData (CHAR* szSysCikuName);
00062 SysCandi* LookupSysCiku(JINT *pnOrgYj, JINT nLenYj, JINT nMatchMode);
00063 VOID   AdjustFreq(JWORD* pwHz2244, JINT nLenThis);
00064 
00065 JINT   nItemNum;
00066 JINT   nSortNumber;
00067 CizuItem        czCZ[MAX_CIZU_ITEMS];
00068 SingleHanziByYj        shSH[NUM_YINJIE];
00069 CizuGroupByYj   cgCG[NUM_YINJIE];
00070 
00071 
00072 VOID InitCizuItem(JINT nItems)
00073 {
00074        JINT   i, j;
00075 
00076        for (i = 0; i < nItems; i++)
00077        {
00078               for (j = 0; j < CIZU_ITEM_LEN; j++)
00079                      czCZ[i].szLine[j]       = '\0';
00080 
00081               for (j = 0; j < (2 * MAX_CIZU_HZ_NUM); j++)
00082               {
00083                      czCZ[i].szHz[j]                = '\0';
00084                      czCZ[i].szHz2244[j]     = '\0';
00085               }
00086 
00087               for (j = 0; j < MAX_CIZU_HZ_NUM; j++)
00088               {
00089                      czCZ[i].nYj[j]                 = 0xFFFF;
00090                      czCZ[i].nXianFormYj[j]         = 0xFFFF;
00091                      czCZ[i].nFanganFormYj[j]   = 0xFFFF;
00092               }
00093 
00094               czCZ[i].nHzNum              = 0;
00095               czCZ[i].nYjNum              = 0;
00096               czCZ[i].nFreq        = 0;
00097               czCZ[i].nbIsXianForm   = 0;
00098               czCZ[i].nbIsFanganForm = 0;
00099               czCZ[i].nbIsEnaoForm   = 0;
00100        }
00101 }
00102 
00103 
00104 VOID CopyStructCZ(CizuItem* pThisCZ, CizuItem* pNewCZ)
00105 {
00106        JINT   i, nSiz;
00107 
00108        nSiz = sizeof(CizuItem);
00109 
00110        for (i = 0; i < nSiz; i++)
00111               *((UCHAR*)pNewCZ + i) = *((UCHAR*)pThisCZ + i);
00112 }
00113 
00114 
00115 VOID InitSingleHanziByYj(JINT nArraySize)
00116 {
00117        JINT   i, j;
00118 
00119        for (i = 0; i < nArraySize; i++)
00120        {
00121               for (j = 0; j < 256; j++)
00122                      shSH[i].szHanzi[j]         = '\0';
00123               for (j = 0; j < 64; j++)
00124                      shSH[i].szXianFormList[j]     = '\0';
00125               shSH[i].nHzNum = shSH[i].nXianFormNum = 0;
00126        }
00127 }
00128 
00129 
00130 VOID InitCizuGroupByYj(JINT nArraySize)
00131 {
00132        JINT   i, j;
00133 
00134        for (i = 0; i < nArraySize; i++)
00135        {
00136               cgCG[i].nNumFirstYjIs         = 0;
00137               for(j = 0; j < NUM_YINJIE; j++)
00138                      cgCG[i].nNum2ndYjIs[j]           = 0;
00139               for(j = 0; j < 1300; j++)
00140                      cgCG[i].nIdxItem[j]       = 0;
00141               for(j = 0; j < 60; j++)
00142                      cgCG[i].nIdxFanganItem[j]    = 0;
00143               cgCG[i].nSizePureCizu         = 0;
00144        }
00145 }
00146 
00147 
00148 VOID GetAllCizuItems(JINT nMode)
00149 {
00150        FILE   *pfCneFile;
00151        CHAR   szCneCiku[] = "PyCiku.txt";
00152        JINT   i, j, m, k, t2, t3, nLen;
00153        UCHAR  szTmp[256];
00154        CHAR   szFreq[8];
00155        JINT   nFreq, nFlag;
00156 
00157        pfCneFile = fopen (szCneCiku, "rb");
00158        if (pfCneFile == NULL)
00159        {
00160               printf ("Failed to Open File %s\n", szCneCiku);
00161               exit (FALSE);
00162        }
00163 
00164        k = 0;
00165        for (t2 = 1; t2 == 1;  )
00166        {
00167               memset(szTmp, '\0', 256);
00168               t2 = GetNextLine(pfCneFile, (CHAR*)szTmp);
00169               t3 = strlen((CHAR*)szTmp);
00170 
00171               if (t3 > 3)
00172               {
00173                      for (m = 0; m < t3; m++)
00174                             czCZ[k].szLine[m] = szTmp[m];
00175                      k++;
00176               }
00177        }
00178 
00179        fclose (pfCneFile);
00180 
00181        nItemNum = k;
00182        printf("nItemNum is %d\n", nItemNum);
00183 
00184        for (i = 0; i < nItemNum; i++)
00185        {
00186               memset (szFreq, '\0', 8);
00187               nLen  = strlen ((CHAR*)czCZ[i].szLine);
00188 
00189               nFlag = 0;
00190               k     = 0;
00191 
00192               for (j = 0; j < nLen; j++)
00193               {
00194                      if( (czCZ[i].szLine[j] >= '0') && (czCZ[i].szLine[j] <= '9') )
00195                      {
00196                             nFlag = 1;
00197                             szFreq[k++] = czCZ[i].szLine[j];
00198                      }
00199                      else if (nFlag == 1)
00200                             break;
00201               }
00202 
00203               nFreq = atoi(szFreq);
00204               if (nFreq > 127)
00205                      nFreq = 127;
00206               if (nFreq < 1)
00207                      nFreq = 1;
00208 
00209               czCZ[i].nFreq = 1 + ((nFreq - 1) / 9);         /* Between [1 ~ 15] */
00210        }
00211 }
00212 
00213 
00214 /*
00215 **  Get All Cizu Items from CZPY??.TXT. It is an Alt Form of
00216 **  above function GetAllCizuItems(JINT nMode)
00217 */
00218 VOID GetAllCizuItems_CZPY(JINT nMode)
00219 {
00220        CHAR   szFileName[20];
00221        FILE*  pfRawFile;
00222        JINT   i, k, m, nTmp;
00223        JINT   t1, t2, t3;
00224        CHAR   szTmp[100];
00225 
00226        k = nItemNum = 0;
00227        if (nMode == READ_RAW_CIZU)
00228               nTmp = 56;
00229        else
00230               nTmp = 1;
00231 
00232        for (i = 1; i <= nTmp; i++)
00233        {
00234               t1 = t2 = t3 = 0;
00235 
00236               t1 = 15 - ((i+3)/4);               /* Freq number.       From 15 ~ 1 */
00237               if (nMode == READ_RAW_CIZU)
00238                      sprintf (szFileName, "./CZPY/CZPY%02d.TXT", i);
00239               else
00240                      sprintf (szFileName, "./CZPY/allcizu.txt");
00241 
00242               pfRawFile = fopen (szFileName , "rb");
00243               if (pfRawFile == NULL)
00244               {
00245                      printf ("Failed to Open File %s\n", szFileName);
00246                      exit (0);
00247               }
00248 
00249               for (t2 = 1; t2 == 1;  )
00250               {
00251                      t2 = GetNextLine(pfRawFile, szTmp);
00252                      t3 = strlen(szTmp);
00253 
00254                      if (t3 > 3)
00255                      {
00256                             for (m = 0; m < t3; m++)
00257                                    czCZ[k].szLine[m] = szTmp[m];
00258                             czCZ[k].nFreq = t1;
00259                             k++;
00260                      }
00261               }
00262               fclose (pfRawFile);
00263        }
00264 
00265        nItemNum = k;
00266        printf("nItemNum is %d\n", nItemNum);
00267 }
00268 
00269 
00270 JINT GetNextLine(FILE* pfFile, CHAR* szBuf)
00271 {
00272        JINT   i = 0;
00273 
00274        do
00275        {
00276               fread (&szBuf[i], 1, 1, pfFile);
00277               i ++;
00278        } while (!feof(pfFile) && (szBuf[i-1] != 0x0A));
00279 
00280        szBuf[i-1] = '\0';
00281 
00282        if (!feof(pfFile))
00283               return 1;
00284        else
00285               return 0;
00286 }
00287 
00288 
00289 /*
00290 **  Convert "v" to "u" except that "lv" and "nv" in given line
00291 */
00292 VOID FilterVtoU(UCHAR *pszLine)
00293 {
00294        JINT   i;
00295        UCHAR  ch;
00296 
00297        for (i = 0; pszLine[i] != '\0'; i++)
00298        {
00299               ch = pszLine[i];
00300               if (ch == 'v')
00301               {
00302                      if ( i > 0 && ((pszLine[i-1] == 'l') || (pszLine[i-1] == 'n')) &&     \
00303                             ((pszLine[i+1] < 'a')  || (pszLine[i+1] > 'z')) )
00304                      {
00305                             pszLine[i] = 'v';
00306                      }
00307                      else
00308                             pszLine[i] = 'u';
00309               }
00310        }
00311 }
00312 
00313 
00314 /*
00315 **  Get Hanzi string [pszHz], set default YinjieCode, number [pnHzNum] from pszLine
00316 */
00317 VOID GetHzInfo(UCHAR *pszLine, UCHAR *pszHz, JINT *pnYj, JINT *pnHzNum, JINT *pnYjNum)
00318 {
00319        JINT   i, t1;
00320        UCHAR  ch, chHigh, chLow;
00321        JINT   nHanziFlag;
00322        JINT   nThisHz;
00323 
00324        *pnHzNum = 0;
00325        *pnYjNum = 0;
00326        i = t1 = 0;
00327        nHanziFlag = 0;
00328        chHigh = chLow = '\0';
00329 
00330        for (i = 0; pszLine[i] != '\0'; i++)
00331        {
00332               ch = pszLine[i];
00333 
00334               if ((ch >= 0xB0) && (ch <= 0xF7) && (nHanziFlag == 0))
00335               {
00336                      nHanziFlag        = 1;
00337                      chHigh            = ch;
00338               }
00339               else if ((ch >= 0xA1) && (ch <= 0xFE) && (nHanziFlag == 1))
00340               {
00341                      nHanziFlag        = 0;
00342                      chLow             = ch;
00343 
00344                      pszHz[2 * t1]     = chHigh;
00345                      pszHz[(2 * t1) + 1] = chLow;
00346                      (*pnHzNum)++;
00347 
00348                      nThisHz                  = (JINT)((chHigh << 8) + chLow);
00349                      pnYj[t1]          = HzcodeToYjcode(nThisHz);
00350                      (*pnYjNum)++;
00351                      t1 ++;
00352               }
00353        }
00354 
00355        if (nHanziFlag)
00356               fprintf (stderr, "Error in GetHzInfo: %s\n", pszLine);
00357 }
00358 
00359 
00360 /*
00361 **  Check to see if there is any Yinjie String in pszLine and set related info.
00362 **  Steps:   1. Is this string a valid String
00363 **          2. Is it a DuoYinZi Yinjie of corresponding Hanzi
00364 **          3. If Yes, find their corresponding code between [0x2001 ~ 0x2244]
00365 */
00366 VOID GetYjInfo(UCHAR *pszLine, UCHAR *pszHz, JINT *pnYj, UCHAR *pszHz2244)
00367 {
00368        JINT   i, j, t1, t2, t3, t4;
00369        JINT   nPyFlag;
00370        CHAR   ch;
00371        CHAR   szYjStr[MAX_CIZU_HZ_NUM][7];
00372        JINT   nThisHz, nDyzYjCode[5], nbCorrectDyz;
00373 
00374        for (i = 0; i < MAX_CIZU_HZ_NUM; i++)
00375               for (j = 0; j < 7; j++)
00376                      szYjStr[i][j] = '\0';
00377 
00378        t2 = t3 = nPyFlag = 0;
00379        for (i = 0; pszLine[i] != '\0'; i++)
00380        {
00381               ch = pszLine[i];
00382 
00383               if (((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z')))
00384               {
00385                      nPyFlag              = 1;
00386                      szYjStr[t2][t3] = ch;
00387                      t3 ++;
00388               }
00389               else if ((ch == ' ') && (nPyFlag == 1))
00390               {
00391                      nPyFlag              = 0;
00392                      t2 ++;
00393                      t3 = 0;
00394               }
00395        }
00396        nPyFlag = 0;
00397 
00398        for (i = 0; i < (2 * MAX_CIZU_HZ_NUM); i++)
00399               pszHz2244[i] = pszHz[i];
00400 
00401        /* Check if it is a DyoYinZi, Is this given Yjcode correct? */
00402        for (i = 0; (i < MAX_CIZU_HZ_NUM) && (strlen(szYjStr[i]) > 0); i++)
00403        {
00404               t1 = FastMatchYinJieStr (szYjStr[i]);
00405               t2 = pnYj[i];
00406 
00407               /* Is t1 a Valid Yjcode? Is it as same as Yjcode in pnYj? */
00408               if ((t1 != -1) && (t1 != t2))
00409               {
00410                      nThisHz = ((JINT)(pszHz[2*i]) << 8) + (JINT)pszHz[2*i + 1];
00411                      t3     = GetDyzInfo(nThisHz, nDyzYjCode);
00412 
00413                      nbCorrectDyz = 1;
00414                      for (j = 0; (j < t3) && (nbCorrectDyz == 1); j++)
00415                      {
00416                             if (t1 == nDyzYjCode[j])
00417                             {
00418                                    nbCorrectDyz = 0;
00419                                    pnYj[i]            = t1;
00420                                    t4 = EncodeDyzTo2244(nThisHz, t1);
00421                                    if (t4 != 0xFFFF)
00422                                    {
00423                                           pszHz2244[2*i]          = (UCHAR)((t4 & 0xFF00) >> 8);
00424                                           pszHz2244[2*i + 1] = (UCHAR)(t4 & 0x00FF);
00425                                    }
00426                             }
00427                             else
00428                                    nbCorrectDyz = 1;
00429                      }
00430                      if ((t3 > 0) && (nbCorrectDyz == 1))
00431                             printf ("GetYjInfo Error. No this DYZ YjCode.[%s] %s\n", pszLine, &(pszHz[2*i]));
00432               }
00433               else if (t1 == -1)
00434                      printf ("GetYjInfo Error. Invalid Yinjie String.[%s]\n", pszLine);
00435        }
00436 }
00437 
00438 
00439 /*
00440 **  Is [*pnYj] Fangan Form? If yes, return TRUE, fill pnFanganFlag and pnFanganYj
00441 **                       else,   return FALSE
00442 */
00443 JINT EnumFanganForm(UCHAR* pszHz, JINT *pnYj, JINT nYjNum, JINT *pnbFanganFlag, JINT *pnFanganYj, JINT nMode, JINT nDspMode)
00444 {
00445        JINT   i, j, k;
00446        CHAR   ch1, ch2;
00447        JINT   res1, res2;
00448        JINT   nGNRAOEIUVnum = 0;
00449 
00450        CHAR   szTmp1[43], szTmp2[7];
00451        JINT   nYjNumAlt;
00452 
00453        JINT   nRet = FALSE;
00454 
00455        if ((nMode == ENUM_SIMP) || (nMode == ENUM_SIMP_W))            /* Simple Mode */
00456               nYjNumAlt = 2;
00457        else
00458               nYjNumAlt = nYjNum;
00459 
00460        for (i = 0; (i < (nYjNumAlt - 1)) && (nYjNumAlt >= 2); i++)
00461        {
00462               /* Get Last char of first Yinjie string and first char of second Yinjie string */
00463               ch1 = LastChar (pnYj[i]);
00464               ch2 = FirstChar(pnYj[i + 1]);
00465 
00466               res1 = res2 = 0xFFFF;
00467               /*
00468               **  Not include "an" "en" of first Yinjie
00469               */
00470               if( ((ch1 == 'g') && ((ch2 == 'a') || (ch2 == 'e') ||   \
00471                                   (ch2 == 'o') || (ch2 == 'u') ))     \
00472               ||  ((ch1 == 'r') && ((ch2 == 'a') || (ch2 == 'e') ||   \
00473                                   (ch2 == 'i') || (ch2 == 'o') ||     \
00474                                   (ch2 == 'u') ))                     \
00475               || (((ch1 == 'n') && ((ch2 == 'a') || (ch2 == 'e') ||   \
00476                                   (ch2 == 'i') || (ch2 == 'o') ||     \
00477                                   (ch2 == 'u') || (ch2 == 'v') ))     \
00478                   && ( strcmp ( "an", YINJIESTR_CSZ[ pnYj[i] ] ) != 0 )      \
00479                   && ( strcmp ( "en", YINJIESTR_CSZ[ pnYj[i] ] ) != 0 ) ))
00480               {
00481                      res1 = ValidButLastChar (pnYj[i]);
00482                      res2 = ValidAddChar (ch1, pnYj[i + 1]);
00483                      if ((res1 != 0xFFFF) && (res2 != 0xFFFF))
00484                      {
00485                             if (nDspMode == F_PRINT)
00486                             {
00487                             /***********************LIST FANGAN FORM ITEMS************************/
00488                             printf ("%-8s  ", pszHz);
00489 
00490                             for (k = 0; k < 43; k++)
00491                                    szTmp1[k] = '\0';
00492                             for (k = 0; k < 7; k++)
00493                                    szTmp2[k] = '\0';
00494 
00495                             for (k = 0; k < nYjNum; k++)
00496                             {
00497                                    for (j = 0; j < 7; j++)
00498                                           szTmp2[j] = '\0';
00499                                    strcat(szTmp2, YINJIESTR_CSZ[pnYj[k]]);
00500                                    strcat(szTmp2, " ");
00501                                    strcat(szTmp1, szTmp2);
00502                             }
00503                             printf ("%-20s | ", szTmp1);
00504 
00505                             for (k = 0; k < 43; k++)
00506                                    szTmp1[k] = '\0';
00507                             for (k = 0; k < 7; k++)
00508                                    szTmp2[k] = '\0';
00509                             for (k = 0; k < nYjNum; k++)
00510                             {
00511                                    for (j = 0; j < 7; j++)
00512                                           szTmp2[j] = '\0';
00513 
00514                                    if (k == i)
00515                                           strcat(szTmp2, YINJIESTR_CSZ[res1]);
00516                                    else if (k == (i + 1))
00517                                           strcat(szTmp2, YINJIESTR_CSZ[res2]);
00518                                    else
00519                                           strcat(szTmp2, YINJIESTR_CSZ[pnYj[k]]);
00520 
00521                                    strcat(szTmp2, " ");
00522                                    strcat(szTmp1, szTmp2);
00523                             }
00524                             printf ("%-20s \n", szTmp1);
00525                             /************************END LISTING HERE*****************************/
00526                             }
00527 
00528                             if (nMode == ENUM_SIMP_W)
00529                             {
00530                                    pnYj[i]           = res1;
00531                                    pnYj[i + 1] = res2;
00532                                    *pnbFanganFlag = TRUE;
00533                             }
00534                             nRet       = TRUE;
00535                      }
00536               }
00537        }
00538        return (nRet);
00539 }
00540 
00541 
00542 /*
00543 **  Is [*pnYj] Enao Form? If yes, return TRUE, fill pnFanganFlag and pnFanganYj
00544 **                     else,         return FALSE
00545 */
00546 JINT EnumEnaoForm(UCHAR* pszHz, JINT *pnYj, JINT nYjNum, JINT *pnbEnaoFlag, JINT *pnFanganYj, JINT nMode, JINT nDspMode)
00547 {
00548        JINT   i, j, k, tmp1, tmp2;
00549        CHAR   ch1, ch2;
00550        JINT   res1, res2;
00551        JINT   nGNRAOEIUVnum = 0;
00552 
00553        CHAR   szTmp1[43], szTmp2[7];
00554        JINT   nYjNumAlt;
00555 
00556        if ((nMode == ENUM_SIMP) || (nMode == ENUM_SIMP_W))            /* Simple Mode */
00557               nYjNumAlt = 2;
00558        else
00559               nYjNumAlt = nYjNum;
00560 
00561        for (i = 0; (i < (nYjNumAlt - 1)) && (nYjNumAlt >= 2); i++)
00562        {
00563               /* Get Last char of first Yinjie string and first char of second Yinjie string */
00564               ch1 = LastChar (pnYj[i]);
00565               ch2 = FirstChar(pnYj[i + 1]);
00566               res1 = res2 = 0xFFFF;
00567 
00568               tmp1 = strcmp("a", YINJIESTR_CSZ[ pnYj[i] ]);
00569               tmp2 = strcmp("e", YINJIESTR_CSZ[ pnYj[i] ]);
00570               if ( ((tmp1 == 0) || (tmp2 == 0)) && (ch2 == 'n') )
00571               {
00572                      res2 = ValidButFirstChar(pnYj[i + 1]);
00573 
00574                      if (res2 != 0xFFFF)
00575                      {
00576                             if (tmp1 == 0)
00577                                    res1 = 2;     /* "an" in YINJIESTR_CSZ */
00578                             else if (tmp2 == 0)
00579                                    res1 = 81;    /* "en" in YINJIESTR_CSZ */
00580 
00581                             if (nDspMode == F_PRINT)
00582                             {
00583                             /***********************LIST ENAO FORM ITEMS**************************/
00584                             printf ("%-8s  ", pszHz);
00585 
00586                             for (k = 0; k < 43; k++)
00587                                    szTmp1[k] = '\0';
00588                             for (k = 0; k < 7; k++)
00589                                    szTmp2[k] = '\0';
00590 
00591                             for (k = 0; k < nYjNum; k++)
00592                             {
00593                                    for (j = 0; j < 7; j++)
00594                                           szTmp2[j] = '\0';
00595                                    strcat(szTmp2, YINJIESTR_CSZ[pnYj[k]]);
00596                                    strcat(szTmp2, " ");
00597                                    strcat(szTmp1, szTmp2);
00598                             }
00599                             printf ("%-20s | ", szTmp1);
00600 
00601                             for (k = 0; k < 43; k++)
00602                                    szTmp1[k] = '\0';
00603                             for (k = 0; k < 7; k++)
00604                                    szTmp2[k] = '\0';
00605                             for (k = 0; k < nYjNum; k++)
00606                             {
00607                                    for (j = 0; j < 7; j++)
00608                                           szTmp2[j] = '\0';
00609 
00610                                    if (k == i)
00611                                           strcat(szTmp2, YINJIESTR_CSZ[res1]);
00612                                    else if (k == (i + 1))
00613                                           strcat(szTmp2, YINJIESTR_CSZ[res2]);
00614                                    else
00615                                           strcat(szTmp2, YINJIESTR_CSZ[pnYj[k]]);
00616 
00617                                    strcat(szTmp2, " ");
00618                                    strcat(szTmp1, szTmp2);
00619                             }
00620                             printf ("%-20s \n", szTmp1);
00621                             /************************END LISTING HERE*****************************/
00622                             }
00623 
00624                             if (nMode == ENUM_SIMP_W)
00625                             {
00626                                    pnYj[i]           = res1;
00627                                    pnYj[i + 1] = res2;
00628                             }
00629 
00630                             *pnbEnaoFlag = TRUE;
00631                      }
00632               }
00633        }
00634        return (*pnbEnaoFlag);
00635 }
00636 
00637 
00638 VOID QuickSort(JINT nFirst, JINT nLast)
00639 {
00640        JINT   nLow, nHigh, t1;
00641 
00642        CizuItem   czTmp, czMidSeptor;
00643 
00644        nLow  = nFirst;
00645        nHigh = nLast;
00646        t1 = (nFirst + nLast) /2;
00647 
00648        CopyStructCZ(&(czCZ[t1]), &(czMidSeptor));
00649 
00650        do
00651        {
00652               while( CompIntArray(czCZ[nLow].nYj,  czMidSeptor.nYj) < 0)
00653                      nLow ++;
00654 
00655               while( CompIntArray(czCZ[nHigh].nYj, czMidSeptor.nYj) > 0)
00656                      nHigh --;
00657 
00658               if (nLow <= nHigh)
00659               {
00660                      nSortNumber++;
00661                      if (nSortNumber % 1000 == 0)
00662                             fprintf (stderr, "\b\b\b\b\b\b\b%07d", nSortNumber);
00663 
00664                      CopyStructCZ(&(czCZ[nLow]),  &czTmp );
00665                      CopyStructCZ(&(czCZ[nHigh]), &(czCZ[nLow]) );
00666                      CopyStructCZ(&(czTmp),           &(czCZ[nHigh]) );
00667 
00668                      nLow++;
00669                      nHigh--;
00670               }
00671        } while (nLow < nHigh);
00672 
00673        if (nFirst < nHigh)
00674               QuickSort (nFirst, nHigh);
00675        if (nLow < nLast)
00676               QuickSort (nLow, nLast);
00677 }
00678 
00679 /*
00680 **  Return 1 if *pnArray1 > *pnArray2, return -1 if *pnArray1 < *pnArray2.
00681 **  return 0 if *pnArray1 == *pnArray2.
00682 **  The max length of pnArray is 9[0~8],
00683 */
00684 JINT CompIntArray(JINT* pnArray1, JINT* pnArray2)
00685 {
00686        JINT   i = 0;
00687        while ((pnArray1[i] == pnArray2[i]) && (pnArray1[i] != 0xFFFF))
00688        {
00689               i++;
00690        }
00691 
00692        if ((pnArray1[i] > pnArray2[i]) && (pnArray1[i] != 0xFFFF))
00693               return 1;
00694        if ((pnArray1[i] > pnArray2[i]) && (pnArray1[i] == 0xFFFF))
00695               return -1;
00696        if ((pnArray2[i] > pnArray1[i]) && (pnArray2[i] != 0xFFFF))
00697               return -1;
00698        if ((pnArray2[i] > pnArray1[i]) && (pnArray2[i] == 0xFFFF))
00699               return 1;
00700 
00701        return 0;
00702 }
00703 
00704 /*
00705 **  Build Single Hanzi Database to struct Array shSH[NUM_YINJIE]
00706 **
00707 **  !!! This function was rename as _Old, because it is replaced
00708 **  !!! by new BuildSingleHzDB() to process frequence data of
00709 **  !!! Single Hanzi !!!!    ==> Scott Ma  98-05-20
00710 */
00711 VOID BuildSingleHzDB_Old(JINT nDspMode)
00712 {
00713        JINT   i, j, k;
00714        JINT   nHzcode, nYjcode;
00715 
00716        k = 0;
00717        for (i = 0xB0; i <= 0xF7; i++)
00718        {
00719               for (j = 0xA1; j <= 0xFE; j++)
00720               {
00721                      if (!( (i == 0xD7) && (j >= 0xFA) ))
00722                      {
00723                             nHzcode = (i << 8) + j;
00724                             nYjcode = Hzcode2244ToYjcode(nHzcode);
00725 
00726                             if ((nYjcode >= 0) && (nYjcode <= 414))
00727                             {
00728                                    shSH[nYjcode].szHanzi[2 * shSH[nYjcode].nHzNum]      = (UCHAR)i;
00729                                    shSH[nYjcode].szHanzi[2 * shSH[nYjcode].nHzNum + 1] = (UCHAR)j;
00730                                    shSH[nYjcode].nHzNum ++;
00731                             }
00732                      }
00733               }
00734        }
00735 
00736        k = 0;
00737        for (i = 0x2001; i <= 0x2244; i++)
00738        {
00739               nYjcode = Hzcode2244ToYjcode(i);
00740               if ((nYjcode >= 0) && (nYjcode <= 414))
00741               {
00742                      shSH[nYjcode].szHanzi[2 * shSH[nYjcode].nHzNum]      = (UCHAR)((i >> 8) & 0x00FF);
00743                      shSH[nYjcode].szHanzi[2 * shSH[nYjcode].nHzNum + 1] = (UCHAR)(i & 0x00FF);
00744 
00745                      shSH[nYjcode].nHzNum ++;
00746               }
00747        }
00748 
00749        if ((nDspMode == SINGLEHZ_DSP_SIMP) || (nDspMode == SINGLEHZ_DSP_FULL))
00750        {
00751               for (i = 0; i < 83; i++)
00752               {
00753                      for (j = 0; j < 5; j++)
00754                             printf ("[%6s] %3d  ", YINJIESTR_CSZ[i * 5 + j], shSH[i * 5 + j].nHzNum);
00755                      printf ("\n");
00756               }
00757        }
00758 
00759        if (nDspMode == SINGLEHZ_DSP_FULL)
00760        {
00761               for (i = 0; i < 415; i++)
00762                      printf ("[%s] %3d\n%s\n\n", YINJIESTR_CSZ[i], shSH[i].nHzNum, RecovDyz2244(shSH[i].szHanzi));
00763        }
00764 }
00765 
00766 
00767 
00768 /*
00769 **  Build Single Hanzi Database to struct Array shSH[NUM_YINJIE]
00770 **
00771 **  This function was added to process Frequence Data of Single Hanzi  - Scott Ma 98-05-20
00772 */
00773 VOID BuildSingleHzDB(JINT nDspMode)
00774 {
00775        FILE*  pfShFile;
00776        CHAR   szShName[] = "SingleHz.txt";
00777        UCHAR  *chFileBuf;
00778        JINT   nSize, nRes, nLen, i, j, t1;
00779        UCHAR  szLineBuf[256];
00780        UCHAR  szPyStr[8];
00781        JINT   nCurYj;
00782        JINT   nHzcode;
00783 
00784 
00785        pfShFile = fopen(szShName, "rb");
00786        if (pfShFile == NULL)
00787        {
00788               fprintf(stderr, "Failed to open File < %s >.\n", szShName);
00789               exit(FALSE);
00790        }
00791 
00792        fseek(pfShFile, 0, SEEK_END);
00793        nSize = (JINT)ftell(pfShFile);
00794 
00795        fseek(pfShFile, 0, SEEK_SET);
00796 
00797        nCurYj = -1;
00798        for(t1 = 1; t1 == 1; )
00799        {
00800               memset(szLineBuf, 0, 256);
00801               t1 = GetNextLine(pfShFile, (CHAR*)szLineBuf);
00802               nLen = strlen((CHAR*)szLineBuf);
00803 
00804               i = 0;
00805               if((nLen >= 1) && (szLineBuf[0] == '['))
00806               {
00807                      /* Lines Start with '[' */
00808                      memset(szPyStr, 0, 8);
00809                      for(i = 0; ((i < 6) && (szLineBuf[i + 1] != ']')); i++ )
00810                             szPyStr[i] = szLineBuf[i + 1];
00811 
00812                      nRes = FastMatchYinJieStr((CHAR*)szPyStr);
00813                      if ((nRes >= 0) && (nRes <= 414))
00814                             nCurYj = nRes;
00815                      else
00816                             nCurYj = -1;
00817               }
00818               else if ((nLen >= 1) && (szLineBuf[0] == '#'))
00819               {
00820                      /* Just skip Lines start with '#' */
00821               }
00822               else if (nLen >= 1)
00823               {
00824                      /* Normal Lines */
00825                      if((nCurYj >= 0) && (nCurYj <= 414))
00826                      {
00827                             for(i = 0; i < nLen;  )
00828                             {
00829                                    if ((szLineBuf[i] >= 0xA1) && (szLineBuf[i + 1] >= 0xA1))    /* It is a MSB of Chinese */
00830                                    {
00831                                           nHzcode = 0;
00832                                           nHzcode = (szLineBuf[i] << 8) + szLineBuf[i + 1];
00833                                           nRes = EncodeDyzTo2244(nHzcode, nCurYj);
00834                                           if(nRes != 0xFFFF)     /* It is really a DuoYinZi!! */
00835                                                  nHzcode = nRes;
00836 
00837                                           shSH[nCurYj].szHanzi[2 * shSH[nCurYj].nHzNum]      = (UCHAR)((nHzcode & 0xFF00) >> 8);
00838                                           shSH[nCurYj].szHanzi[2 * shSH[nCurYj].nHzNum + 1] = (UCHAR)(nHzcode & 0x00FF);
00839                                           shSH[nCurYj].nHzNum ++;
00840                                           i += 2;
00841                                    }
00842                                    else
00843                                           i++;
00844                             }
00845                      }
00846               }
00847               else
00848               {
00849                      /* NULL Lines, just skip it */
00850               }
00851        }
00852 
00853        fclose(pfShFile);
00854 
00855        if ((nDspMode == SINGLEHZ_DSP_SIMP) || (nDspMode == SINGLEHZ_DSP_FULL))
00856        {
00857               for (i = 0; i < 83; i++)
00858               {
00859                      for (j = 0; j < 5; j++)
00860                             printf ("[%6s] %3d  ", YINJIESTR_CSZ[i * 5 + j], shSH[i * 5 + j].nHzNum);
00861                      printf ("\n");
00862               }
00863        }
00864 
00865        if (nDspMode == SINGLEHZ_DSP_FULL)
00866        {
00867               for (i = 0; i < 415; i++)
00868                      printf ("[%s] %3d\n%s\n\n", YINJIESTR_CSZ[i], shSH[i].nHzNum, RecovDyz2244(shSH[i].szHanzi));
00869        }
00870 }
00871 
00872 
00873 /*
00874 **  Xi'an => xian;   Qi'ang => qiang;      Ji'an => jian
00875 */
00876 JINT EnumXianForm(UCHAR* pszHz, JINT *pnYj, JINT nYjNum, JINT *pnbXianFlag, JINT *pnXianYj, JINT nMode, JINT nDspMode)
00877 {
00878        JINT   j, t2;
00879        JINT   res1;
00880        CHAR   szCombYJ[20];
00881 
00882        for (j = 0; j < 20; j++)
00883               szCombYJ[j] = '\0';
00884 
00885        if( (pnYj[0] != 0xFFFF) && (pnYj[1] != 0xFFFF) )
00886               strcat( strcat(szCombYJ, YINJIESTR_CSZ[pnYj[0]]),
00887                                     YINJIESTR_CSZ[pnYj[1]]);
00888 
00889        if (strlen(szCombYJ) <= 6 )
00890        {
00891               res1 = FastMatchYinJieStr (szCombYJ);
00892               if (res1 != -1)
00893               {
00894                      if (nMode == ENUM_SIMP_W)
00895                      {
00896                             if (nYjNum > 2)
00897                             {
00898                                    *pnbXianFlag = 1;
00899                                    pnXianYj[0] = res1;
00900                                    for (j = 2; j < MAX_CIZU_HZ_NUM; j++)
00901                                           pnXianYj[j - 1] = pnYj[j];
00902                             }
00903 
00904                             if (nYjNum == 2)
00905                             {
00906                                    t2 = shSH[res1].nXianFormNum;
00907                                    shSH[res1].szXianFormList[4 * t2 + 0] = (UCHAR)pszHz[0];
00908                                    shSH[res1].szXianFormList[4 * t2 + 1] = (UCHAR)pszHz[1];
00909                                    shSH[res1].szXianFormList[4 * t2 + 2] = (UCHAR)pszHz[2];
00910                                    shSH[res1].szXianFormList[4 * t2 + 3] = (UCHAR)pszHz[3];
00911                                    shSH[res1].nXianFormNum ++;
00912                             }
00913                      }
00914 
00915                      if (nDspMode == F_PRINT)
00916                             printf ("%s\n", pszHz);
00917 
00918                      return TRUE;
00919               }
00920        }
00921        return FALSE;
00922 }
00923 
00924 
00925 
00926 VOID ParseSample( )
00927 {
00928        CHAR   szSampleName[40] = "Sample.txt";
00929        FILE*  pf;
00930        JINT   t, m, k, nTmp;
00931        CHAR   szLine[256];
00932        JINT   nOutYj[256];
00933        CHAR   szDecomp[512];
00934        JINT   nLuNine[9];
00935        SysCandi *psc;
00936        JWORD  wOneCandi[9];
00937 
00938        pf = fopen(szSampleName, "rb");
00939        if (pf == NULL)
00940        {
00941               fprintf(stderr, "Failed to open Sample File.\n");
00942               exit(FALSE);
00943        }
00944 
00945        for (t = 1; t == 1;  )
00946        {
00947               for(m = 0; m < 256; m++)
00948               {
00949                      szLine[m] = '\0';
00950                      nOutYj[m] = 0xFFFF;
00951               }
00952 
00953               t = GetNextLine(pf, szLine);
00954               ParseRawInputStr(szLine, nOutYj);
00955               for(m = 0; m < 512; m++)
00956                      szDecomp[m] = '\0';
00957               DecompPeIntArray (nOutYj, szDecomp);
00958               printf("[Decomp] is %s\n", szDecomp);
00959 
00960               for(m = 0; m < 9; m++)
00961                      nLuNine[m] = 0xFFFF;
00962 
00963               for(m = 0; (m < 9) && (nOutYj[m] != 0); m++)
00964               {
00965                      nLuNine[m] = (nOutYj[m] & 0x01FF);
00966 
00967                      if ((nLuNine[m] < 0) || (nLuNine[m] > 475))
00968                      {
00969                             printf("Error!! in nLuNine\n");
00970                             exit(FALSE);
00971                      }
00972               }
00973 
00974               psc = LookupSysCiku(nLuNine, m, LU_MATCH_WIDELY);
00975               AdjustFreq((JWORD*)&(psc->pwDhCandi[psc->nSizDhCandi - 4]), 2);
00976 
00977               printf("\nStruct psc Info for String[%s]\n", szLine);
00978               printf("====================================================\n");
00979 
00980               for (k = 0; k < psc->nNumMhCandi; k++)
00981               {
00982                      for (m = 0; m < 9; m++)
00983                             wOneCandi[m] = 0x0000;
00984                      nTmp = GetXrdCandi(psc, k, wOneCandi);
00985 
00986                      printf( "%d %s\n", nTmp, RecovDyz2244((UCHAR*)wOneCandi) );
00987               }
00988               printf("==============\n");
00989 
00990               for (k = psc->nNumMhCandi; k < (psc->nNumMhCandi + psc->nNumDhCandi); k++)
00991               {
00992                      for (m = 0; m < 9; m++)
00993                             wOneCandi[m] = 0x0000;
00994                      nTmp = GetXrdCandi(psc, k, wOneCandi);
00995                      printf( "%d %s\n", nTmp, RecovDyz2244((UCHAR*)wOneCandi) );
00996               }
00997               printf("=============\n");
00998 
00999               for ( k = (psc->nNumMhCandi + psc->nNumDhCandi);
01000                      k < (psc->nNumMhCandi + psc->nNumDhCandi + psc->nNumShCandi); k++ )
01001               {
01002                      for (m = 0; m < 9; m++)
01003                             wOneCandi[m] = 0x0000;
01004                      nTmp = GetXrdCandi(psc, k, wOneCandi);
01005                      printf( "%d%s  ", nTmp, RecovDyz2244((UCHAR*)wOneCandi) );
01006                      if ( (k - psc->nNumMhCandi - psc->nNumDhCandi) % 20 == 0)
01007                             printf("\n");
01008               }
01009               printf("\n************\n");
01010               /*
01011               ListSysCandiInfo(psc);
01012               */
01013        }
01014 
01015        fclose (pf);
01016 }
01017 
01018 
01019 /*
01020 **  List All Those Information in Struct SysCandi
01021 */
01022 VOID ListSysCandiInfo(SysCandi *psc)
01023 {
01024        JINT   i, k, m, n;
01025        JWORD  wMh[9], wDh[3], wSh[2];
01026 
01027        for(i = 0; i < psc->nLenYj; i++)
01028        {
01029               if ((psc->nOrgYj[i] >= 450) && (psc->nOrgYj[i] <= 475) )
01030                      printf("%s ", SHENGMUSTR[psc->nOrgYj[i] - 450]);
01031               else if ((psc->nOrgYj[i] >= 0) && (psc->nOrgYj[i] < 415) )
01032                      printf("%s ", YINJIESTR_CSZ[psc->nOrgYj[i]]);
01033        }
01034        printf("\n\n");
01035 
01036        for(n = 0; n < 9; n++)
01037               *(wMh + n) = 0x0000;
01038        for(n = 0; n < 3; n++)
01039               *(wDh + n) = 0x0000;
01040        for(n = 0; n < 2; n++)
01041               *(wSh + n) = 0x0000;
01042 
01043        i = m = 0;
01044        for(k = 1; i < psc->nNumMhCandi; k++)
01045        {
01046               if (psc->pwMhCandi[k] == 0x0000)
01047               {
01048                      printf( "%s\n", RecovDyz2244((UCHAR*)wMh) );
01049                      i++;
01050                      k++;
01051                      m = 0;
01052                      for(n = 0; n < 9; n++)
01053                             *(wMh + n) = 0x0000;
01054               }
01055               else
01056                      wMh[m++] = psc->pwMhCandi[k];
01057        }
01058        printf("\n");
01059 
01060        i = m = 0;
01061        for(k = 1; i < psc->nNumDhCandi; k++)
01062        {
01063               if (psc->pwDhCandi[k] == 0x0000)
01064               {
01065                      printf( "%s\n", RecovDyz2244((UCHAR*)wDh) );
01066                      i++;
01067                      k++;
01068                      m = 0;
01069                      for(n = 0; n < 3; n++)
01070                             *(wDh + n) = 0x0000;
01071               }
01072               else
01073                      wDh[m++] = psc->pwDhCandi[k];
01074        }
01075        printf("\n");
01076 
01077        i = m = 0;
01078        for(k = 0; i < psc->nNumShCandi; k++)
01079        {
01080               if (psc->pwShCandi[k] == 0x0000)
01081               {
01082                      printf( "%s  ", RecovDyz2244((UCHAR*)wSh) );
01083                      i++;
01084                      m = 0;
01085                      for(n = 0; n < 2; n++)
01086                             *(wSh + n) = 0x0000;
01087               }
01088               else
01089                      wSh[m++] = psc->pwShCandi[k];
01090        }
01091        printf("\n\n");
01092 }
01093 
01094 
01095 
01096 /*
01097 **  Get the Xrd Candidates which store in structure psc. The content is to be
01098 **  store to pwOneCandi.
01099 **  Notice:  Range of nXrd is between [0 ~ (nTmp - 1)].
01100 **          Mh -> Dh -> Sh
01101 **  Return:  Valid Length of this candidate in JWORD.
01102 */
01103 JINT GetXrdCandi(SysCandi* psc, JINT nXrd, JWORD* pwOneCandi)
01104 {
01105        JINT   i, k, m, nTmp;
01106        JINT   nRet;
01107 
01108        nRet  = 0;
01109        nTmp  = psc->nNumMhCandi + psc->nNumDhCandi + psc->nNumShCandi;
01110 
01111        if ((nXrd < 0) || (nXrd > (nTmp - 1)))
01112               return nRet;
01113 
01114        if (nXrd < psc->nNumMhCandi)
01115        {
01116               m = 0;                                             /* [0 ~ (nNumMhCandi - 1)] */
01117               for (k = 0; k < psc->nSizMhCandi; k++)
01118               {
01119                      if (m == nXrd)
01120                      {
01121                             k++;
01122                             for(i = 0; psc->pwMhCandi[k] != 0x0000;    )
01123                                    pwOneCandi[i++] = psc->pwMhCandi[k++];
01124                             nRet = i;
01125                             break;
01126                      }
01127                      else if (psc->pwMhCandi[k] == 0x0000)
01128                             m++;
01129               }
01130        }
01131        else if ( (nXrd >= psc->nNumMhCandi) && (nXrd < (psc->nNumMhCandi + psc->nNumDhCandi)) )
01132        {
01133               m = psc->nNumMhCandi;                /* [nNumMhCandi ~ (nNumMhCandi + nNumDhCandi - 1)] */
01134               for (k = 0; k < psc->nSizDhCandi; k++)
01135               {
01136                      if (m == nXrd)
01137                      {
01138                             k++;
01139                             for(i = 0; psc->pwDhCandi[k] != 0x0000;    )
01140                                    pwOneCandi[i++] = psc->pwDhCandi[k++];
01141                             nRet = i;
01142                             break;
01143                      }
01144                      else if (psc->pwDhCandi[k] == 0x0000)
01145                             m++;
01146               }
01147               nRet  = 2;
01148        }
01149        /*
01150        **  Special Consideration for Single Hanzi Area: Because there is 'Xian' Question
01151        **  Here!!!! nRet may be 2.
01152        */
01153        else      /* Single Hanzi Area */
01154        {
01155               m = psc->nNumMhCandi + psc->nNumDhCandi;
01156               for (k = 0; k < psc->nSizShCandi; k++)
01157               {
01158                      if (m == nXrd)
01159                      {
01160                             for(i = 0; psc->pwShCandi[k] != 0x0000;    )
01161                                    pwOneCandi[i++] = psc->pwShCandi[k++];
01162                             nRet = i;
01163                             break;
01164                      }
01165                      else if (psc->pwShCandi[k] == 0x0000)
01166                             m++;
01167               }
01168        }
01169 
01170        return nRet;
01171 }
01172 
01173 
01174 int main(int argc, char **argv)
01175 {
01176        CHAR    szSysCikuName[40] = "PyCiku.dat";
01177 
01178        CHAR    szUdcName[40] = "UdCiku.dat";
01179        JINT    nRes;
01180 
01181        CreateUdCikuFile();
01182 
01183        nRes = ReadUdcData(szUdcName);
01184        if (nRes != TRUE)
01185               printf("Failed in ReadUdcData().\n");
01186 
01187        nRes = WriteUdcData(szUdcName, 0);
01188        if (nRes != TRUE)
01189               printf("Failed in WriteUdcData().\n");
01190 
01191        CreateAllData();
01192        CreateCikuFile();
01193        exit(0);
01194 
01195        /*
01196        GetCikuData (szSysCikuName);
01197        ParseSample();
01198        WriteCikuData (szSysCikuName, 0);
01199        */
01200 }
01201