Back to index

im-sdk  12.3.91
Functions | Variables
CreateData.c File Reference
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "GeneType.h"
#include "PyBasic.h"
#include "ciku.h"

Go to the source code of this file.

Functions

JINT Hzcode2244ToYjcode (JINT nHzcode)
JINT GetDyzInfo (JINT nHzcode, JINT *pnDyzYjCode)
JINT EncodeDyzTo2244 (JINT nHzcode, JINT nYjcode)
JINT FastMatchYinJieStr (CHAR *szPystr)
UCHARRecovDyz2244 (UCHAR *szDyz2244)
CHAR LastChar (JINT nYinjieCode)
CHAR FirstChar (JINT nYinjieCode)
JINT ValidButLastChar (JINT nYinjieCode)
JINT ValidButFirstChar (JINT nYinjieCode)
JINT ValidAddChar (CHAR ch, JINT nYinjieCode)
VOID InitCizuItem (JINT nItems)
VOID InitSingleHanziByYj (JINT nArraySize)
VOID InitCizuGroupByYj (JINT nArraySize)
VOID CopyStructCZ (CizuItem *pThisCZ, CizuItem *pNewCZ)
VOID GetAllCizuItems (JINT nMode)
JINT GetNextLine (FILE *pfFile, CHAR *szBuf)
VOID FilterVtoU (UCHAR *pszLine)
VOID GetHzInfo (UCHAR *pszLine, UCHAR *pszHz, JINT *pnYj, JINT *pnHzNum, JINT *pnYjNum)
VOID GetYjInfo (UCHAR *pszLine, UCHAR *pszHz, JINT *pnYj, UCHAR *pszHz2244)
JINT EnumFanganForm (UCHAR *pszHz, JINT *pnYj, JINT nYjNum, JINT *pnbFanganFlag, JINT *pnFanganYj, JINT nMode, JINT nDspMode)
JINT EnumEnaoForm (UCHAR *pszHz, JINT *pnYj, JINT nYjNum, JINT *pnbEnaoFlag, JINT *pnFanganYj, JINT nMode, JINT nDspMode)
JINT EnumXianForm (UCHAR *pszHz, JINT *pnYj, JINT nYjNum, JINT *pnbXianFlag, JINT *pnXianYj, JINT nMode, JINT nDspMode)
VOID BuildSingleHzDB (JINT nDspMode)
JINT CompIntArray (JINT *pnArray1, JINT *pnArray2)
VOID QuickSort (JINT nFirst, JINT nLast)
VOID SetCkh (CikuHeader *pCkh)
VOID SetShi (ShIndex *pShi)
VOID SetDhi (DhIndex *pDhi)
VOID SetMhi (MhIndex *pMhi)
VOID SetGbki (GbkIndex *pGbki)
VOID ProcGbkHz ()
VOID CreateAllData ()
VOID CreateCikuFile ()

Variables

JINT nItemNum
JINT nSortNumber
JINT nGbkNumByYj [NUM_YINJIE]
JWORD wGbkHzByYj [NUM_YINJIE][400]
CizuItem czCZ [MAX_CIZU_ITEMS]
SingleHanziByYj shSH [NUM_YINJIE]
CizuGroupByYj cgCG [NUM_YINJIE]

Function Documentation

VOID BuildSingleHzDB ( JINT  nDspMode)

Definition at line 773 of file ciku.c.

{
       FILE*  pfShFile;
       CHAR   szShName[] = "SingleHz.txt";
       UCHAR  *chFileBuf;
       JINT   nSize, nRes, nLen, i, j, t1;
       UCHAR  szLineBuf[256];
       UCHAR  szPyStr[8];
       JINT   nCurYj;
       JINT   nHzcode;


       pfShFile = fopen(szShName, "rb");
       if (pfShFile == NULL)
       {
              fprintf(stderr, "Failed to open File < %s >.\n", szShName);
              exit(FALSE);
       }

       fseek(pfShFile, 0, SEEK_END);
       nSize = (JINT)ftell(pfShFile);

       fseek(pfShFile, 0, SEEK_SET);

       nCurYj = -1;
       for(t1 = 1; t1 == 1; )
       {
              memset(szLineBuf, 0, 256);
              t1 = GetNextLine(pfShFile, (CHAR*)szLineBuf);
              nLen = strlen((CHAR*)szLineBuf);

              i = 0;
              if((nLen >= 1) && (szLineBuf[0] == '['))
              {
                     /* Lines Start with '[' */
                     memset(szPyStr, 0, 8);
                     for(i = 0; ((i < 6) && (szLineBuf[i + 1] != ']')); i++ )
                            szPyStr[i] = szLineBuf[i + 1];

                     nRes = FastMatchYinJieStr((CHAR*)szPyStr);
                     if ((nRes >= 0) && (nRes <= 414))
                            nCurYj = nRes;
                     else
                            nCurYj = -1;
              }
              else if ((nLen >= 1) && (szLineBuf[0] == '#'))
              {
                     /* Just skip Lines start with '#' */
              }
              else if (nLen >= 1)
              {
                     /* Normal Lines */
                     if((nCurYj >= 0) && (nCurYj <= 414))
                     {
                            for(i = 0; i < nLen;  )
                            {
                                   if ((szLineBuf[i] >= 0xA1) && (szLineBuf[i + 1] >= 0xA1))    /* It is a MSB of Chinese */
                                   {
                                          nHzcode = 0;
                                          nHzcode = (szLineBuf[i] << 8) + szLineBuf[i + 1];
                                          nRes = EncodeDyzTo2244(nHzcode, nCurYj);
                                          if(nRes != 0xFFFF)     /* It is really a DuoYinZi!! */
                                                 nHzcode = nRes;

                                          shSH[nCurYj].szHanzi[2 * shSH[nCurYj].nHzNum]      = (UCHAR)((nHzcode & 0xFF00) >> 8);
                                          shSH[nCurYj].szHanzi[2 * shSH[nCurYj].nHzNum + 1] = (UCHAR)(nHzcode & 0x00FF);
                                          shSH[nCurYj].nHzNum ++;
                                          i += 2;
                                   }
                                   else
                                          i++;
                            }
                     }
              }
              else
              {
                     /* NULL Lines, just skip it */
              }
       }

       fclose(pfShFile);

       if ((nDspMode == SINGLEHZ_DSP_SIMP) || (nDspMode == SINGLEHZ_DSP_FULL))
       {
              for (i = 0; i < 83; i++)
              {
                     for (j = 0; j < 5; j++)
                            printf ("[%6s] %3d  ", YINJIESTR_CSZ[i * 5 + j], shSH[i * 5 + j].nHzNum);
                     printf ("\n");
              }
       }

       if (nDspMode == SINGLEHZ_DSP_FULL)
       {
              for (i = 0; i < 415; i++)
                     printf ("[%s] %3d\n%s\n\n", YINJIESTR_CSZ[i], shSH[i].nHzNum, RecovDyz2244(shSH[i].szHanzi));
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

JINT CompIntArray ( JINT pnArray1,
JINT pnArray2 
)

Definition at line 684 of file ciku.c.

{
       JINT   i = 0;
       while ((pnArray1[i] == pnArray2[i]) && (pnArray1[i] != 0xFFFF))
       {
              i++;
       }

       if ((pnArray1[i] > pnArray2[i]) && (pnArray1[i] != 0xFFFF))
              return 1;
       if ((pnArray1[i] > pnArray2[i]) && (pnArray1[i] == 0xFFFF))
              return -1;
       if ((pnArray2[i] > pnArray1[i]) && (pnArray2[i] != 0xFFFF))
              return -1;
       if ((pnArray2[i] > pnArray1[i]) && (pnArray2[i] == 0xFFFF))
              return 1;

       return 0;
}

Here is the caller graph for this function:

VOID CopyStructCZ ( CizuItem pThisCZ,
CizuItem pNewCZ 
)

Definition at line 104 of file ciku.c.

{
       JINT   i, nSiz;

       nSiz = sizeof(CizuItem);

       for (i = 0; i < nSiz; i++)
              *((UCHAR*)pNewCZ + i) = *((UCHAR*)pThisCZ + i);
}

Here is the caller graph for this function:

Definition at line 53 of file CreateData.c.

{
       JINT   i, j, k, t;
       JINT   nTmpRes;
       JINT   nFanganNum, nEnaoNum, nXianNum, nXianNum2;
       JINT   nFrom, nTo;
       JINT   nFlag[MAX_CIZU_ITEMS];

       InitCizuItem (MAX_CIZU_ITEMS);
       InitSingleHanziByYj (NUM_YINJIE);
       InitCizuGroupByYj (NUM_YINJIE);

       GetAllCizuItems(READ_RAW_CIZU);

       for(i = 0; i < nItemNum; i++)
       {
              FilterVtoU(czCZ[i].szLine);
              GetHzInfo (czCZ[i].szLine, czCZ[i].szHz, czCZ[i].nYj, &(czCZ[i].nHzNum), &(czCZ[i].nYjNum));
              GetYjInfo (czCZ[i].szLine, czCZ[i].szHz, czCZ[i].nYj, czCZ[i].szHz2244);
       }

       nFanganNum = 0;
       for(i = 0; i < nItemNum; i++)
       {
              nTmpRes = EnumFanganForm(czCZ[i].szHz, czCZ[i].nYj, czCZ[i].nYjNum, &(czCZ[i].nbIsFanganForm), czCZ[i].nFanganFormYj, ENUM_SIMP, F_NOPRINT);
              if (nTmpRes == TRUE)
              {
                     t = nItemNum + nFanganNum;
                     CopyStructCZ(&(czCZ[i]), &(czCZ[t]));
                     EnumFanganForm(czCZ[t].szHz, czCZ[t].nYj, czCZ[t].nYjNum, &(czCZ[t].nbIsFanganForm), czCZ[t].nFanganFormYj, ENUM_SIMP_W, F_PRINT);
                     nFanganNum ++;
              }
       }
       nItemNum += nFanganNum;
       printf ("%d FanganForm Added. nItemNum is %d\n", nFanganNum, nItemNum);

       nEnaoNum = 0;
       for (i = 0; i < nItemNum; i++)
       {
              nTmpRes = EnumEnaoForm(czCZ[i].szHz, czCZ[i].nYj, czCZ[i].nYjNum, &(czCZ[i].nbIsEnaoForm), czCZ[i].nFanganFormYj, ENUM_SIMP, F_NOPRINT);
              if (nTmpRes == TRUE)
              {
                     t = nItemNum + nEnaoNum;
                     CopyStructCZ(&(czCZ[i]), &(czCZ[t]));
                     EnumEnaoForm(czCZ[t].szHz, czCZ[t].nYj, czCZ[t].nYjNum, &(czCZ[t].nbIsEnaoForm), czCZ[t].nFanganFormYj, ENUM_SIMP_W, F_PRINT);
                     nEnaoNum ++;
              }
       }
       nItemNum += nEnaoNum;
       printf ("%d EnaoForm Added. nItemNum is %d\n", nEnaoNum, nItemNum);

       nXianNum  = 0;
       nXianNum2 = 0;
       for (i = 0; i < nItemNum; i++)
       {
              nTmpRes = EnumXianForm(czCZ[i].szHz, czCZ[i].nYj, czCZ[i].nYjNum, &(czCZ[i].nbIsXianForm), czCZ[i].nXianFormYj, ENUM_SIMP, F_NOPRINT);
              if (nTmpRes == TRUE)
              {
                     t = nItemNum + nXianNum;
                     if (czCZ[i].nYjNum == 2)
                     {
                            EnumXianForm(czCZ[i].szHz, czCZ[i].nYj, czCZ[i].nYjNum, &(czCZ[i].nbIsXianForm), czCZ[i].nXianFormYj, ENUM_SIMP_W, F_PRINT);
                            nXianNum2 ++;
                     }
              }
       }
       nItemNum += nXianNum;
       printf ("%d XianForm Added. nItemNum is %d [nXianNum2 is %d]\n", nXianNum, nItemNum, nXianNum2);

       nFrom = 0;
       nTo   = nItemNum - 1;
       nSortNumber = 0;
       fprintf (stderr, "SortNum:    ");
       QuickSort (nFrom, nTo);
       fprintf (stderr, "\b\b\b\b\b\b\b%07d", nSortNumber);
       fprintf (stderr, "\n\n\n");

       /* Filter these duplicated Items: Scott Ma 1998-08-12 */
       memset(nFlag, 0x00, sizeof(JINT) * MAX_CIZU_ITEMS);

       for (i = 0; i < nItemNum; i++)
              nFlag[i] = 1;
       k = 0;
       for (i = 0; i < nItemNum; i++)
       {
              for (j = i + 1; j < nItemNum; j++)
              {
                     if ( (czCZ[i].nHzNum == czCZ[j].nHzNum) && (czCZ[i].nYjNum == czCZ[j].nYjNum) &&
                          (strncmp((CHAR*)(czCZ[i].szHz2244), (CHAR*)(czCZ[j].szHz2244), 2 * czCZ[i].nHzNum) == 0) &&
                          (CompIntArray(czCZ[i].nYj, czCZ[j].nYj) == 0) )
                     {
                            printf("!!! Duplicated Cizu Item to be deleted ==>[%2d]%s\n", strlen((char*)(czCZ[j].szHz2244)), RecovDyz2244(czCZ[j].szHz2244));
                            fflush(stdout);
                            k++;
                            nFlag[j] = 0;
                     }
                     else
                     {
                            break;
                     }
              }
       }
       printf("Warning: Totally %d duplicated Cizu Items were deleted!\n", k);

       i = j = k = 0;
       for (i = 0; i < nItemNum; i++)
       {
              if (nFlag[i] == 1)
              {
                     CopyStructCZ(&(czCZ[i]), &(czCZ[j]));
                     j++;
              }
              else
                     k++;
       }
       printf("Warning: Totally %d duplicated Cizu Items were deleted!\n", k);
       nItemNum -= k;

       /**************************************************************************/

       BuildSingleHzDB(SINGLEHZ_DSP_NONE);
       ProcGbkHz();

       for (i = 0; i < nItemNum; i++)
       {
              if (!(czCZ[i].nbIsXianForm))
              {
                     cgCG[czCZ[i].nYj[0]].nNum2ndYjIs[czCZ[i].nYj[1]] ++;
                     cgCG[czCZ[i].nYj[0]].nIdxItem[ cgCG[czCZ[i].nYj[0]].nNumFirstYjIs ] = i;
                     cgCG[czCZ[i].nYj[0]].nNumFirstYjIs++;
              }
              else if (czCZ[i].nbIsXianForm)
              {
                     cgCG[czCZ[i].nXianFormYj[0]].nNum2ndYjIs[czCZ[i].nXianFormYj[1]] ++;
                     cgCG[czCZ[i].nXianFormYj[0]].nIdxItem[ cgCG[czCZ[i].nXianFormYj[0]].nNumFirstYjIs ] = i;
                     cgCG[czCZ[i].nXianFormYj[0]].nNumFirstYjIs++;
              }
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 356 of file CreateData.c.

{
       JINT   nFileSize;
       BYTE*  pbAllData;
       JINT   i, k, m, nTmp, nt1, nAll;
       FILE*  pfCiku;

       CikuHeader    ckh;
       ShIndex             shi;
       DhIndex             dhi;
       MhIndex             mhi;
       GbkIndex      gbki;

       SetCkh(&ckh);
       SetShi(&shi);
       SetDhi(&dhi);
       SetMhi(&mhi);
       SetGbki(&gbki);

       nFileSize  = sizeof(CikuHeader) + sizeof(ShIndex) + sizeof(DhIndex) + sizeof(MhIndex) + sizeof(GbkIndex)
                 + shi.nYjOff[NUM_YINJIE] + dhi.nYjOff[NUM_YINJIE] + mhi.nYjOff[NUM_YINJIE] + gbki.nYjOff[NUM_YINJIE];

       printf("\n\n=========================================\n");
       printf("nFileSize is   %d[0x%X]\n", nFileSize, nFileSize);

       ckh.nFileSize = nFileSize;
       ckh.nIdxShPos = sizeof(CikuHeader);
       ckh.nIdxDhPos = ckh.nIdxShPos + sizeof(ShIndex);
       ckh.nIdxMhPos = ckh.nIdxDhPos + sizeof(DhIndex);
       ckh.nIdxGbkPos       = ckh.nIdxMhPos + sizeof(MhIndex);

       shi.nStartPos = ckh.nIdxGbkPos + sizeof(GbkIndex);
       shi.nEndPos    += shi.nStartPos;

       dhi.nStartPos = shi.nEndPos;
       dhi.nEndPos    += dhi.nStartPos;

       mhi.nStartPos = dhi.nEndPos;
       mhi.nEndPos    += mhi.nStartPos;

       gbki.nStartPos       = mhi.nEndPos;
       gbki.nEndPos   += gbki.nStartPos;

       pbAllData = (BYTE*)malloc(nFileSize);
       if (pbAllData == NULL)
       {
              fprintf(stderr, "Failed to Alloc memory for pbAllData\n");
              exit(FALSE);
       }

       memset (pbAllData, '\0', nFileSize);

       nAll = 0;
       nTmp = sizeof(CikuHeader);
       for (i = 0; i < nTmp; i++)
              pbAllData[nAll++]  = (BYTE)*((BYTE*)(&ckh) + i);

       nTmp = sizeof(ShIndex);
       for (i = 0; i < nTmp; i++)
              pbAllData[nAll++]  = (BYTE)*((BYTE*)(&shi) + i);

       nTmp = sizeof(DhIndex);
       for (i = 0; i < nTmp; i++)
              pbAllData[nAll++]  = (BYTE)*((BYTE*)(&dhi) + i);

       nTmp = sizeof(MhIndex);
       for (i = 0; i < nTmp; i++)
              pbAllData[nAll++]  = (BYTE)*((BYTE*)(&mhi) + i);

       nTmp = sizeof(GbkIndex);
       for (i = 0; i < nTmp; i++)
              pbAllData[nAll++]  = (BYTE)*((BYTE*)(&gbki) + i);

       /* Single Hanzi Area */
       for (i = 0; i < NUM_YINJIE; i++)
       {
              for (k = 0; k < (2 * shSH[i].nHzNum); k++)
                     pbAllData[nAll++] = (BYTE)(shSH[i].szHanzi[k] ^ ((i + 56) / 2));

              for (k = 0; k < (4 * shSH[i].nXianFormNum); k++)
                     pbAllData[nAll++] = (BYTE)(shSH[i].szXianFormList[k] ^ ((i + 56) / 2));
       }

       /* Double Hanzi Area */
       for (i = 0; i < NUM_YINJIE; i++)
       {
              for (k = 0; k < cgCG[i].nNumFirstYjIs; k++)
              {
                     nt1 = czCZ[ cgCG[i].nIdxItem[k] ].nHzNum;
                     if (nt1 == 2)
                     {
                            pbAllData[nAll++] = (BYTE) ( ((czCZ[cgCG[i].nIdxItem[k]].nFreq) * 8) ^ ((i + 56) / 2));           /* Freq */
                            for (m = 0; m < (2 * nt1); m++)
                                   pbAllData[nAll++] = (BYTE) ((czCZ[cgCG[i].nIdxItem[k]].szHz2244[m]) ^ ((i + 56) / 2));     /* Data */
                     }
              }
       }

       /*
       **  Multiple Hanzi Area
       **
       **  ABOUT Freq and Length BYTE:     7 |<== 5 Bits Freq ==>|<= 3 Bits Length =>| 0
       **  3 Bits (000 ~ 111) indicates the length of this Cizu is (2 ~ 9).
       **  5 Bits (00000 ~ 11111) indicates the freqence of this cizu is (0 ~ 31). (Default is 0 ~ 15)
       */
       for (i = 0; i < NUM_YINJIE; i++)
       {
              for (k = 0; k < cgCG[i].nNumFirstYjIs; k++)
              {
                     nt1 = czCZ[ cgCG[i].nIdxItem[k] ].nHzNum;
                     if (nt1 > 2)
                     {
                            nTmp = ((czCZ[cgCG[i].nIdxItem[k]].nFreq) << 3) + (nt1 - 2);
                            pbAllData[nAll++] = (BYTE) (nTmp ^ ((i + 56) / 2));                   /* Freq and Length */

                            for (m = 0; m < (2 * nt1); m++)
                                   pbAllData[nAll++] = (BYTE) ((czCZ[cgCG[i].nIdxItem[k]].szHz2244[m]) ^ ((i + 56) / 2));     /* Data */
                     }
              }
       }

       /* GBK Single Hanzi Area */
       for (i = 0; i < NUM_YINJIE; i++)
       {
              for (k = 0; k < nGbkNumByYj[i]; k++)
              {
                     pbAllData[nAll++] = (BYTE)( (((JINT)wGbkHzByYj[i][k] & 0xFF00) >> 8) ^ ((i + 56) / 2));
                     pbAllData[nAll++] = (BYTE)(  ((JINT)wGbkHzByYj[i][k] & 0x00FF)  ^ ((i + 56) / 2));
              }
       }

       pfCiku = fopen("PyCiku.dat", "wb");
       if (pfCiku == NULL)
       {
              fprintf (stderr, "Failed to Create System Ciku [PyCiku.dat]\n");
              exit (FALSE);
       }

       for (i = 0; i < nFileSize; i++)
              fprintf (pfCiku, "%c", pbAllData[i]);

       fclose(pfCiku);
}

Here is the call graph for this function:

Here is the caller graph for this function:

JINT EncodeDyzTo2244 ( JINT  nHzcode,
JINT  nYjcode 
)

Definition at line 1769 of file PyBasic.c.

{
       JINT    nHiHzPos, nLowHz;
       JINT    i;
       
       nHiHzPos = ((nHzcode & 0xFF00) >> 8) - 0xB0;
       if ((nHiHzPos < 0) || (nHiHzPos > (0xF7 - 0xB0)))
              return 0xFFFF;

       nLowHz = nHzcode & 0x00FF;
       
       for (i = INDEXOFDYZLIST[nHiHzPos]; i < INDEXOFDYZLIST[nHiHzPos + 1]; i++)
       {
              if ( ((DYZLIST[i] & 0x00FF) == nLowHz) && (DYZYJCODE[i] == nYjcode) )
                     return (i + 0x2001);
       }
       
       return 0xFFFF;
}

Here is the caller graph for this function:

JINT EnumEnaoForm ( UCHAR pszHz,
JINT pnYj,
JINT  nYjNum,
JINT pnbEnaoFlag,
JINT pnFanganYj,
JINT  nMode,
JINT  nDspMode 
)

Definition at line 546 of file ciku.c.

{
       JINT   i, j, k, tmp1, tmp2;
       CHAR   ch1, ch2;
       JINT   res1, res2;
       JINT   nGNRAOEIUVnum = 0;

       CHAR   szTmp1[43], szTmp2[7];
       JINT   nYjNumAlt;

       if ((nMode == ENUM_SIMP) || (nMode == ENUM_SIMP_W))            /* Simple Mode */
              nYjNumAlt = 2;
       else
              nYjNumAlt = nYjNum;

       for (i = 0; (i < (nYjNumAlt - 1)) && (nYjNumAlt >= 2); i++)
       {
              /* Get Last char of first Yinjie string and first char of second Yinjie string */
              ch1 = LastChar (pnYj[i]);
              ch2 = FirstChar(pnYj[i + 1]);
              res1 = res2 = 0xFFFF;

              tmp1 = strcmp("a", YINJIESTR_CSZ[ pnYj[i] ]);
              tmp2 = strcmp("e", YINJIESTR_CSZ[ pnYj[i] ]);
              if ( ((tmp1 == 0) || (tmp2 == 0)) && (ch2 == 'n') )
              {
                     res2 = ValidButFirstChar(pnYj[i + 1]);

                     if (res2 != 0xFFFF)
                     {
                            if (tmp1 == 0)
                                   res1 = 2;     /* "an" in YINJIESTR_CSZ */
                            else if (tmp2 == 0)
                                   res1 = 81;    /* "en" in YINJIESTR_CSZ */

                            if (nDspMode == F_PRINT)
                            {
                            /***********************LIST ENAO FORM ITEMS**************************/
                            printf ("%-8s  ", pszHz);

                            for (k = 0; k < 43; k++)
                                   szTmp1[k] = '\0';
                            for (k = 0; k < 7; k++)
                                   szTmp2[k] = '\0';

                            for (k = 0; k < nYjNum; k++)
                            {
                                   for (j = 0; j < 7; j++)
                                          szTmp2[j] = '\0';
                                   strcat(szTmp2, YINJIESTR_CSZ[pnYj[k]]);
                                   strcat(szTmp2, " ");
                                   strcat(szTmp1, szTmp2);
                            }
                            printf ("%-20s | ", szTmp1);

                            for (k = 0; k < 43; k++)
                                   szTmp1[k] = '\0';
                            for (k = 0; k < 7; k++)
                                   szTmp2[k] = '\0';
                            for (k = 0; k < nYjNum; k++)
                            {
                                   for (j = 0; j < 7; j++)
                                          szTmp2[j] = '\0';

                                   if (k == i)
                                          strcat(szTmp2, YINJIESTR_CSZ[res1]);
                                   else if (k == (i + 1))
                                          strcat(szTmp2, YINJIESTR_CSZ[res2]);
                                   else
                                          strcat(szTmp2, YINJIESTR_CSZ[pnYj[k]]);

                                   strcat(szTmp2, " ");
                                   strcat(szTmp1, szTmp2);
                            }
                            printf ("%-20s \n", szTmp1);
                            /************************END LISTING HERE*****************************/
                            }

                            if (nMode == ENUM_SIMP_W)
                            {
                                   pnYj[i]           = res1;
                                   pnYj[i + 1] = res2;
                            }

                            *pnbEnaoFlag = TRUE;
                     }
              }
       }
       return (*pnbEnaoFlag);
}

Here is the call graph for this function:

Here is the caller graph for this function:

JINT EnumFanganForm ( UCHAR pszHz,
JINT pnYj,
JINT  nYjNum,
JINT pnbFanganFlag,
JINT pnFanganYj,
JINT  nMode,
JINT  nDspMode 
)

Definition at line 443 of file ciku.c.

{
       JINT   i, j, k;
       CHAR   ch1, ch2;
       JINT   res1, res2;
       JINT   nGNRAOEIUVnum = 0;

       CHAR   szTmp1[43], szTmp2[7];
       JINT   nYjNumAlt;

       JINT   nRet = FALSE;

       if ((nMode == ENUM_SIMP) || (nMode == ENUM_SIMP_W))            /* Simple Mode */
              nYjNumAlt = 2;
       else
              nYjNumAlt = nYjNum;

       for (i = 0; (i < (nYjNumAlt - 1)) && (nYjNumAlt >= 2); i++)
       {
              /* Get Last char of first Yinjie string and first char of second Yinjie string */
              ch1 = LastChar (pnYj[i]);
              ch2 = FirstChar(pnYj[i + 1]);

              res1 = res2 = 0xFFFF;
              /*
              **  Not include "an" "en" of first Yinjie
              */
              if( ((ch1 == 'g') && ((ch2 == 'a') || (ch2 == 'e') ||   \
                                  (ch2 == 'o') || (ch2 == 'u') ))     \
              ||  ((ch1 == 'r') && ((ch2 == 'a') || (ch2 == 'e') ||   \
                                  (ch2 == 'i') || (ch2 == 'o') ||     \
                                  (ch2 == 'u') ))                     \
              || (((ch1 == 'n') && ((ch2 == 'a') || (ch2 == 'e') ||   \
                                  (ch2 == 'i') || (ch2 == 'o') ||     \
                                  (ch2 == 'u') || (ch2 == 'v') ))     \
                  && ( strcmp ( "an", YINJIESTR_CSZ[ pnYj[i] ] ) != 0 )      \
                  && ( strcmp ( "en", YINJIESTR_CSZ[ pnYj[i] ] ) != 0 ) ))
              {
                     res1 = ValidButLastChar (pnYj[i]);
                     res2 = ValidAddChar (ch1, pnYj[i + 1]);
                     if ((res1 != 0xFFFF) && (res2 != 0xFFFF))
                     {
                            if (nDspMode == F_PRINT)
                            {
                            /***********************LIST FANGAN FORM ITEMS************************/
                            printf ("%-8s  ", pszHz);

                            for (k = 0; k < 43; k++)
                                   szTmp1[k] = '\0';
                            for (k = 0; k < 7; k++)
                                   szTmp2[k] = '\0';

                            for (k = 0; k < nYjNum; k++)
                            {
                                   for (j = 0; j < 7; j++)
                                          szTmp2[j] = '\0';
                                   strcat(szTmp2, YINJIESTR_CSZ[pnYj[k]]);
                                   strcat(szTmp2, " ");
                                   strcat(szTmp1, szTmp2);
                            }
                            printf ("%-20s | ", szTmp1);

                            for (k = 0; k < 43; k++)
                                   szTmp1[k] = '\0';
                            for (k = 0; k < 7; k++)
                                   szTmp2[k] = '\0';
                            for (k = 0; k < nYjNum; k++)
                            {
                                   for (j = 0; j < 7; j++)
                                          szTmp2[j] = '\0';

                                   if (k == i)
                                          strcat(szTmp2, YINJIESTR_CSZ[res1]);
                                   else if (k == (i + 1))
                                          strcat(szTmp2, YINJIESTR_CSZ[res2]);
                                   else
                                          strcat(szTmp2, YINJIESTR_CSZ[pnYj[k]]);

                                   strcat(szTmp2, " ");
                                   strcat(szTmp1, szTmp2);
                            }
                            printf ("%-20s \n", szTmp1);
                            /************************END LISTING HERE*****************************/
                            }

                            if (nMode == ENUM_SIMP_W)
                            {
                                   pnYj[i]           = res1;
                                   pnYj[i + 1] = res2;
                                   *pnbFanganFlag = TRUE;
                            }
                            nRet       = TRUE;
                     }
              }
       }
       return (nRet);
}

Here is the call graph for this function:

Here is the caller graph for this function:

JINT EnumXianForm ( UCHAR pszHz,
JINT pnYj,
JINT  nYjNum,
JINT pnbXianFlag,
JINT pnXianYj,
JINT  nMode,
JINT  nDspMode 
)

Definition at line 876 of file ciku.c.

{
       JINT   j, t2;
       JINT   res1;
       CHAR   szCombYJ[20];

       for (j = 0; j < 20; j++)
              szCombYJ[j] = '\0';

       if( (pnYj[0] != 0xFFFF) && (pnYj[1] != 0xFFFF) )
              strcat( strcat(szCombYJ, YINJIESTR_CSZ[pnYj[0]]),
                                    YINJIESTR_CSZ[pnYj[1]]);

       if (strlen(szCombYJ) <= 6 )
       {
              res1 = FastMatchYinJieStr (szCombYJ);
              if (res1 != -1)
              {
                     if (nMode == ENUM_SIMP_W)
                     {
                            if (nYjNum > 2)
                            {
                                   *pnbXianFlag = 1;
                                   pnXianYj[0] = res1;
                                   for (j = 2; j < MAX_CIZU_HZ_NUM; j++)
                                          pnXianYj[j - 1] = pnYj[j];
                            }

                            if (nYjNum == 2)
                            {
                                   t2 = shSH[res1].nXianFormNum;
                                   shSH[res1].szXianFormList[4 * t2 + 0] = (UCHAR)pszHz[0];
                                   shSH[res1].szXianFormList[4 * t2 + 1] = (UCHAR)pszHz[1];
                                   shSH[res1].szXianFormList[4 * t2 + 2] = (UCHAR)pszHz[2];
                                   shSH[res1].szXianFormList[4 * t2 + 3] = (UCHAR)pszHz[3];
                                   shSH[res1].nXianFormNum ++;
                            }
                     }

                     if (nDspMode == F_PRINT)
                            printf ("%s\n", pszHz);

                     return TRUE;
              }
       }
       return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

JINT FastMatchYinJieStr ( CHAR szPystr)

Definition at line 1794 of file PyBasic.c.

{
       JINT    i, j, nLen;
       CHAR    chFirst;
       JINT    nFromYJStr, nToYJStr, nShengmuIndex;     
       
       i = 0;
       nLen = (JINT)strlen(szPystr);
       
       j = 0;
       if (nLen > 0)
       {
              chFirst    = szPystr[0];
              nFromYJStr = INDEXSMTOYINJIE[ INDEXMAGIC[(JINT)(chFirst - 'a')] ];
              nToYJStr   = INDEXSMTOYINJIE[ INDEXMAGIC[(JINT)(chFirst - 'a')] + 1];
              nShengmuIndex = INDEXMAGIC[(JINT)(chFirst - 'a')];
              
              if ((chFirst == 'c') && (nLen > 1) && (szPystr[1] == 'h'))
              {
                     nFromYJStr = INDEXSMTOYINJIE[3];
                     nToYJStr   = INDEXSMTOYINJIE[4];
                     nShengmuIndex = 3;
              }
              else if ((chFirst == 's') && (nLen > 1) && (szPystr[1] == 'h'))
              {
                     nFromYJStr = INDEXSMTOYINJIE[19];
                     nToYJStr   = INDEXSMTOYINJIE[20];
                     nShengmuIndex = 19;
              }
              else if ((chFirst == 'z') && (nLen > 1) && (szPystr[1] == 'h'))
              {
                     nFromYJStr = INDEXSMTOYINJIE[25];
                     nToYJStr   = INDEXSMTOYINJIE[26];
                     nShengmuIndex = 25;
              }

              i = nFromYJStr;
              do {
                     j = strcmp (YINJIESTR_CSZ[i], szPystr);
                     i++;
              } while ((i < nToYJStr) && (j != 0));
       }
       
       if (j == 0)
              return (i - 1);
       else
              return (-1);
}
VOID FilterVtoU ( UCHAR pszLine)

Definition at line 292 of file ciku.c.

{
       JINT   i;
       UCHAR  ch;

       for (i = 0; pszLine[i] != '\0'; i++)
       {
              ch = pszLine[i];
              if (ch == 'v')
              {
                     if ( i > 0 && ((pszLine[i-1] == 'l') || (pszLine[i-1] == 'n')) &&     \
                            ((pszLine[i+1] < 'a')  || (pszLine[i+1] > 'z')) )
                     {
                            pszLine[i] = 'v';
                     }
                     else
                            pszLine[i] = 'u';
              }
       }
}

Here is the caller graph for this function:

CHAR FirstChar ( JINT  nYinjieCode)

Definition at line 1866 of file PyBasic.c.

{
       CHAR   res = ' ';           /* SPACE */
       
       if ((nYinjieCode >= 0) && (nYinjieCode <= 414))
              res = YINJIESTR_CSZ[nYinjieCode][0];
       return res;
}

Here is the caller graph for this function:

Definition at line 148 of file ciku.c.

{
       FILE   *pfCneFile;
       CHAR   szCneCiku[] = "PyCiku.txt";
       JINT   i, j, m, k, t2, t3, nLen;
       UCHAR  szTmp[256];
       CHAR   szFreq[8];
       JINT   nFreq, nFlag;

       pfCneFile = fopen (szCneCiku, "rb");
       if (pfCneFile == NULL)
       {
              printf ("Failed to Open File %s\n", szCneCiku);
              exit (FALSE);
       }

       k = 0;
       for (t2 = 1; t2 == 1;  )
       {
              memset(szTmp, '\0', 256);
              t2 = GetNextLine(pfCneFile, (CHAR*)szTmp);
              t3 = strlen((CHAR*)szTmp);

              if (t3 > 3)
              {
                     for (m = 0; m < t3; m++)
                            czCZ[k].szLine[m] = szTmp[m];
                     k++;
              }
       }

       fclose (pfCneFile);

       nItemNum = k;
       printf("nItemNum is %d\n", nItemNum);

       for (i = 0; i < nItemNum; i++)
       {
              memset (szFreq, '\0', 8);
              nLen  = strlen ((CHAR*)czCZ[i].szLine);

              nFlag = 0;
              k     = 0;

              for (j = 0; j < nLen; j++)
              {
                     if( (czCZ[i].szLine[j] >= '0') && (czCZ[i].szLine[j] <= '9') )
                     {
                            nFlag = 1;
                            szFreq[k++] = czCZ[i].szLine[j];
                     }
                     else if (nFlag == 1)
                            break;
              }

              nFreq = atoi(szFreq);
              if (nFreq > 127)
                     nFreq = 127;
              if (nFreq < 1)
                     nFreq = 1;

              czCZ[i].nFreq = 1 + ((nFreq - 1) / 9);         /* Between [1 ~ 15] */
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

JINT GetDyzInfo ( JINT  nHzcode,
JINT pnDyzYjCode 
)

Definition at line 1739 of file PyBasic.c.

{
       JINT    nHiHzPos, nLowHz;
       JINT    i, j;
       
       nHiHzPos = ((nHzcode & 0xFF00) >> 8) - 0xB0;
       nLowHz   = nHzcode & 0x00FF;
       
       j = 0;
       if ((nHiHzPos < 0) || (nHiHzPos > (0xF7 - 0xB0)))
              return j;

       for (i = INDEXOFDYZLIST[nHiHzPos]; i < INDEXOFDYZLIST[nHiHzPos + 1]; i++)
       {
              if( (DYZLIST[i] & 0x00FF) == nLowHz )
              {
                     pnDyzYjCode[j] = DYZYJCODE[i];
                     j++;
              }
       }
       return j;
}

Here is the caller graph for this function:

VOID GetHzInfo ( UCHAR pszLine,
UCHAR pszHz,
JINT pnYj,
JINT pnHzNum,
JINT pnYjNum 
)

Definition at line 317 of file ciku.c.

{
       JINT   i, t1;
       UCHAR  ch, chHigh, chLow;
       JINT   nHanziFlag;
       JINT   nThisHz;

       *pnHzNum = 0;
       *pnYjNum = 0;
       i = t1 = 0;
       nHanziFlag = 0;
       chHigh = chLow = '\0';

       for (i = 0; pszLine[i] != '\0'; i++)
       {
              ch = pszLine[i];

              if ((ch >= 0xB0) && (ch <= 0xF7) && (nHanziFlag == 0))
              {
                     nHanziFlag        = 1;
                     chHigh            = ch;
              }
              else if ((ch >= 0xA1) && (ch <= 0xFE) && (nHanziFlag == 1))
              {
                     nHanziFlag        = 0;
                     chLow             = ch;

                     pszHz[2 * t1]     = chHigh;
                     pszHz[(2 * t1) + 1] = chLow;
                     (*pnHzNum)++;

                     nThisHz                  = (JINT)((chHigh << 8) + chLow);
                     pnYj[t1]          = HzcodeToYjcode(nThisHz);
                     (*pnYjNum)++;
                     t1 ++;
              }
       }

       if (nHanziFlag)
              fprintf (stderr, "Error in GetHzInfo: %s\n", pszLine);
}

Here is the call graph for this function:

Here is the caller graph for this function:

JINT GetNextLine ( FILE *  pfFile,
CHAR szBuf 
)

Definition at line 889 of file NewPY.c.

{
       JINT    i = 0;
       
       do
       {
              fread (&szBuf[i], 1, 1, pfFile);
              i ++;
       } while (!feof(pfFile) && (szBuf[i-1] != 0x0A));
       
       szBuf[i-1] = '\0';
       if ((i >= 2) && (szBuf[i-2] == 0x0D))
              szBuf[i-2] = '\0';
       
       if (!feof(pfFile))
              return 1;
       else
              return 0;
}
VOID GetYjInfo ( UCHAR pszLine,
UCHAR pszHz,
JINT pnYj,
UCHAR pszHz2244 
)

Definition at line 366 of file ciku.c.

{
       JINT   i, j, t1, t2, t3, t4;
       JINT   nPyFlag;
       CHAR   ch;
       CHAR   szYjStr[MAX_CIZU_HZ_NUM][7];
       JINT   nThisHz, nDyzYjCode[5], nbCorrectDyz;

       for (i = 0; i < MAX_CIZU_HZ_NUM; i++)
              for (j = 0; j < 7; j++)
                     szYjStr[i][j] = '\0';

       t2 = t3 = nPyFlag = 0;
       for (i = 0; pszLine[i] != '\0'; i++)
       {
              ch = pszLine[i];

              if (((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z')))
              {
                     nPyFlag              = 1;
                     szYjStr[t2][t3] = ch;
                     t3 ++;
              }
              else if ((ch == ' ') && (nPyFlag == 1))
              {
                     nPyFlag              = 0;
                     t2 ++;
                     t3 = 0;
              }
       }
       nPyFlag = 0;

       for (i = 0; i < (2 * MAX_CIZU_HZ_NUM); i++)
              pszHz2244[i] = pszHz[i];

       /* Check if it is a DyoYinZi, Is this given Yjcode correct? */
       for (i = 0; (i < MAX_CIZU_HZ_NUM) && (strlen(szYjStr[i]) > 0); i++)
       {
              t1 = FastMatchYinJieStr (szYjStr[i]);
              t2 = pnYj[i];

              /* Is t1 a Valid Yjcode? Is it as same as Yjcode in pnYj? */
              if ((t1 != -1) && (t1 != t2))
              {
                     nThisHz = ((JINT)(pszHz[2*i]) << 8) + (JINT)pszHz[2*i + 1];
                     t3     = GetDyzInfo(nThisHz, nDyzYjCode);

                     nbCorrectDyz = 1;
                     for (j = 0; (j < t3) && (nbCorrectDyz == 1); j++)
                     {
                            if (t1 == nDyzYjCode[j])
                            {
                                   nbCorrectDyz = 0;
                                   pnYj[i]            = t1;
                                   t4 = EncodeDyzTo2244(nThisHz, t1);
                                   if (t4 != 0xFFFF)
                                   {
                                          pszHz2244[2*i]          = (UCHAR)((t4 & 0xFF00) >> 8);
                                          pszHz2244[2*i + 1] = (UCHAR)(t4 & 0x00FF);
                                   }
                            }
                            else
                                   nbCorrectDyz = 1;
                     }
                     if ((t3 > 0) && (nbCorrectDyz == 1))
                            printf ("GetYjInfo Error. No this DYZ YjCode.[%s] %s\n", pszLine, &(pszHz[2*i]));
              }
              else if (t1 == -1)
                     printf ("GetYjInfo Error. Invalid Yinjie String.[%s]\n", pszLine);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 428 of file PyBasic.c.

{
       JINT   hi, low;
       JINT   res;
       JINT   t1, t2, t3, t4;

       hi = (nHzcode >> 8) & 0x00FF;
       low = nHzcode & 0x00FF;
       t1 = t2 = t3 = t4 = 0;
       res = 0xFFFF;

       if ((hi >= 0xB0) && (hi <= 0xF7) && (low >= 0xA1) && (low <= 0xFE))
       {
              t1 = (hi - 0xB0) * 94 + (low - 0xA1) + 1;
              t2 = (t1 * 9 - 1) / 32;
              t3 = ((t1 - 1) * 9 - 1) / 32;
              t4 = (t1 * 9) % 32;

              if (t2 > t3)
                     res = (int)( (GBHZCODETOYJ[t2] >> (32 - t4)) & 0x01FF ) +
                           (int)( (GBHZCODETOYJ[t3] << t4) & 0x01FF );
              else if (t2 == t3)
                     res = (int)( GBHZCODETOYJ[t2] >> (32 - t4) ) & 0x01FF;
       }
       else if ((nHzcode >= 0x2001) && (nHzcode <= 0x2244))
       {
              t1 = nHzcode - 0x2000;
              t2 = (t1 * 9 - 1) / 32;
              t3 = ((t1 - 1) * 9 - 1) / 32;
              t4 = (t1 * 9) % 32;

              if (t2 > t3)
                     res = (int)( (DYZCODETOYJ[t2] >> (32 - t4)) & 0x01FF ) +
                           (int)( (DYZCODETOYJ[t3] << t4) & 0x01FF );
              else if (t2 == t3)
                     res = (int)( DYZCODETOYJ[t2] >> (32 - t4) ) & 0x01FF;
       }
       else
              res = 0xFFFF;

       return (res);
}
VOID InitCizuGroupByYj ( JINT  nArraySize)

Definition at line 130 of file ciku.c.

{
       JINT   i, j;

       for (i = 0; i < nArraySize; i++)
       {
              cgCG[i].nNumFirstYjIs         = 0;
              for(j = 0; j < NUM_YINJIE; j++)
                     cgCG[i].nNum2ndYjIs[j]           = 0;
              for(j = 0; j < 1300; j++)
                     cgCG[i].nIdxItem[j]       = 0;
              for(j = 0; j < 60; j++)
                     cgCG[i].nIdxFanganItem[j]    = 0;
              cgCG[i].nSizePureCizu         = 0;
       }
}

Here is the caller graph for this function:

VOID InitCizuItem ( JINT  nItems)

Definition at line 72 of file ciku.c.

{
       JINT   i, j;

       for (i = 0; i < nItems; i++)
       {
              for (j = 0; j < CIZU_ITEM_LEN; j++)
                     czCZ[i].szLine[j]       = '\0';

              for (j = 0; j < (2 * MAX_CIZU_HZ_NUM); j++)
              {
                     czCZ[i].szHz[j]                = '\0';
                     czCZ[i].szHz2244[j]     = '\0';
              }

              for (j = 0; j < MAX_CIZU_HZ_NUM; j++)
              {
                     czCZ[i].nYj[j]                 = 0xFFFF;
                     czCZ[i].nXianFormYj[j]         = 0xFFFF;
                     czCZ[i].nFanganFormYj[j]   = 0xFFFF;
              }

              czCZ[i].nHzNum              = 0;
              czCZ[i].nYjNum              = 0;
              czCZ[i].nFreq        = 0;
              czCZ[i].nbIsXianForm   = 0;
              czCZ[i].nbIsFanganForm = 0;
              czCZ[i].nbIsEnaoForm   = 0;
       }
}

Here is the caller graph for this function:

VOID InitSingleHanziByYj ( JINT  nArraySize)

Definition at line 115 of file ciku.c.

{
       JINT   i, j;

       for (i = 0; i < nArraySize; i++)
       {
              for (j = 0; j < 256; j++)
                     shSH[i].szHanzi[j]         = '\0';
              for (j = 0; j < 64; j++)
                     shSH[i].szXianFormList[j]     = '\0';
              shSH[i].nHzNum = shSH[i].nXianFormNum = 0;
       }
}

Here is the caller graph for this function:

CHAR LastChar ( JINT  nYinjieCode)

Definition at line 1848 of file PyBasic.c.

{
       CHAR   res = ' ';           /* SPACE */
       JINT   i = 0;
       
       if ((nYinjieCode >= 0) && (nYinjieCode <= 414))
       {
              while (YINJIESTR_CSZ[nYinjieCode][i] != '\0')
                     i++;
              res = YINJIESTR_CSZ[nYinjieCode][i-1];
       }
       return res;
}

Here is the caller graph for this function:

VOID QuickSort ( JINT  nFirst,
JINT  nLast 
)

Definition at line 638 of file ciku.c.

{
       JINT   nLow, nHigh, t1;

       CizuItem   czTmp, czMidSeptor;

       nLow  = nFirst;
       nHigh = nLast;
       t1 = (nFirst + nLast) /2;

       CopyStructCZ(&(czCZ[t1]), &(czMidSeptor));

       do
       {
              while( CompIntArray(czCZ[nLow].nYj,  czMidSeptor.nYj) < 0)
                     nLow ++;

              while( CompIntArray(czCZ[nHigh].nYj, czMidSeptor.nYj) > 0)
                     nHigh --;

              if (nLow <= nHigh)
              {
                     nSortNumber++;
                     if (nSortNumber % 1000 == 0)
                            fprintf (stderr, "\b\b\b\b\b\b\b%07d", nSortNumber);

                     CopyStructCZ(&(czCZ[nLow]),  &czTmp );
                     CopyStructCZ(&(czCZ[nHigh]), &(czCZ[nLow]) );
                     CopyStructCZ(&(czTmp),           &(czCZ[nHigh]) );

                     nLow++;
                     nHigh--;
              }
       } while (nLow < nHigh);

       if (nFirst < nHigh)
              QuickSort (nFirst, nHigh);
       if (nLow < nLast)
              QuickSort (nLow, nLast);
}

Here is the call graph for this function:

Here is the caller graph for this function:

UCHAR* RecovDyz2244 ( UCHAR szDyz2244)

Definition at line 1972 of file PyBasic.c.

{
       JINT    i, j, nLen, nHlfLen;
       JINT    nDyzCode, nNormCode;
       static  UCHAR*  szNorm = NULL; 
   
       nLen = strlen((CHAR*)szDyz2244);
       nHlfLen = nLen / 2;

       if(szNorm != NULL)
              free(szNorm);

       szNorm = (UCHAR*)malloc(nLen + MALIGN);
       if (szNorm == NULL)
       {
              fprintf(stderr, "Failed to alloc Memory in function RecovDyz2244()\n");
              return (szNorm);
       }
       memset(szNorm, '\0', (nLen + MALIGN));
       
       j = 0;
       for (i = 0; i < nHlfLen; i++)
       {
              nDyzCode = szDyz2244[(2 * i) + 1] + ((JINT)szDyz2244[2 * i] << 8);
              if ((nDyzCode >= 0x2001) && (nDyzCode <= 0x2244))
              {
                     nNormCode         = DYZLIST[nDyzCode - 0x2001];
                     szNorm[2 * i]     = (UCHAR)((nNormCode & 0xFF00) >> 8);
                     szNorm[2 * i + 1] = (UCHAR)(nNormCode & 0x00FF);
              }
              else
              {
                     szNorm[2 * i]      = szDyz2244[2 * i];
                     szNorm[2 * i + 1]  = szDyz2244[2 * i + 1];
              }
       }
       
       return (szNorm);
}
VOID SetCkh ( CikuHeader pCkh)

Definition at line 194 of file CreateData.c.

{
       JINT   i, nLen;
       CHAR   szName[] = " SUN TDC P.R.C. 汉语拼音词库 1.0";
       CHAR   szCopyright[] = "版权所有(C) 太阳计算机系统(中国)有限公司 1997_11";

       for (i = 0; i < 32; i++)
              pCkh->szName[i]           = '\0';
       for (i = 0; i < 48; i++)
              pCkh->szCopyright[i] = '\0';

       pCkh->nMagicDescHi    = 0x35303539;
       pCkh->nMagicDescLow   = 0x34333442;
       pCkh->nSize         = sizeof(CikuHeader);
       pCkh->nFileSize            = 0;

       nLen = strlen(szName);
       for (i = 0; i < nLen; i++)
              pCkh->szName[i]           = szName[i];

       nLen = strlen(szCopyright);
       for (i = 0; i < nLen; i++)
              pCkh->szCopyright[i] = szCopyright[i];

       pCkh->nVersion             = 0x00010000;         /* Version 1.0 */
       pCkh->nLatestTime     = 0;
       pCkh->nIdxShPos            = 0;
       pCkh->nIdxDhPos            = 0;
       pCkh->nIdxMhPos            = 0;
       pCkh->nIdxGbkPos      = 0;
       pCkh->nReserve2            = 0;
       pCkh->nReserve3            = 0;

       printf("Sizeof this structure is %d\n", sizeof(CikuHeader));
}

Here is the caller graph for this function:

VOID SetDhi ( DhIndex pDhi)

Definition at line 259 of file CreateData.c.

{
       JINT   i, k, nt1, nTmp;
       JINT   nD2Num[NUM_YINJIE];

       pDhi->nSize         = sizeof(DhIndex);
       pDhi->nStartPos            = 0;                      /* To be added by a BaseOffset */

       for (i = 0; i < (NUM_YINJIE + 1); i++)
              pDhi->nYjOff[i]       = 0;

       for (i = 0; i < NUM_YINJIE; i++)
              nD2Num[i]      = 0;

       for (i = 0; i < NUM_YINJIE; i++)
       {
              for (k = 0; k < cgCG[i].nNumFirstYjIs; k++)
              {
                     nt1 = czCZ[ cgCG[i].nIdxItem[k] ].nHzNum;
                     if (nt1 == 2)
                            nD2Num[i] ++;
              }
       }

       for (i = 0; i < NUM_YINJIE; i++)
       {
              nTmp = 5 * nD2Num[i];                            /* 4 + 1(nFreqData) */
              for (k = i; k < NUM_YINJIE; k++)
                     pDhi->nYjOff[k + 1] += nTmp;
       }

       pDhi->nEndPos       = pDhi->nYjOff[NUM_YINJIE];  /* To be added by a BaseOffset */
       printf("Total Size of Double Hanzi Area is %d\n", pDhi->nEndPos);
}

Here is the caller graph for this function:

VOID SetGbki ( GbkIndex pGbki)

Definition at line 335 of file CreateData.c.

{
       JINT   i, k;

       pGbki->nSize        = sizeof(GbkIndex);
       pGbki->nStartPos      = 0;                    /* To be added by a BaseOffset */

       for (i = 0; i < (NUM_YINJIE + 1); i++)
              pGbki->nYjOff[i]  = 0;

       for (i = 0; i < NUM_YINJIE; i++)
              for (k = i; k < NUM_YINJIE; k++)
                     pGbki->nYjOff[k + 1] += (sizeof(JWORD) * nGbkNumByYj[i]);  /* Each GBK Hanzi is 2 bytes */

       pGbki->nEndPos             = pGbki->nYjOff[NUM_YINJIE]; /* To be added by a BaseOffset */

       printf("sizeof(GbkIndex) is %d, Total GBK Single Hanzi Data area size is %d Bytes\n",
              sizeof(GbkIndex), pGbki->nEndPos );
}

Here is the caller graph for this function:

VOID SetMhi ( MhIndex pMhi)

Definition at line 295 of file CreateData.c.

{
       JINT   i, k, nt1;
       JINT   nM3Num[NUM_YINJIE], nM3Len[NUM_YINJIE];

       pMhi->nSize         = sizeof(MhIndex);
       pMhi->nStartPos            = 0;

       for (i = 0; i < (NUM_YINJIE + 1); i++)
              pMhi->nYjOff[i]       = 0;

       for (i = 0; i < NUM_YINJIE; i++)
       {
              nM3Num[i]     = 0;
              nM3Len[i]     = 0;
       }

       for (i = 0; i < NUM_YINJIE; i++)
       {
              for (k = 0; k < cgCG[i].nNumFirstYjIs; k++)
              {
                     nt1 = czCZ[ cgCG[i].nIdxItem[k] ].nHzNum;
                     if (nt1 > 2)
                     {
                            nM3Num[i] ++;
                            nM3Len[i] += (2 * nt1) + 1;
                     }
              }
       }

       for (i = 0; i < NUM_YINJIE; i++)
              for (k = i; k < NUM_YINJIE; k++)
                     pMhi->nYjOff[k + 1] += nM3Len[i];

       pMhi->nEndPos       = pMhi->nYjOff[NUM_YINJIE];  /* To be added by a BaseOffset */

       printf("Total Size of Multiple (>=3) Hanzi Area is %d\n", pMhi->nEndPos);
}

Here is the caller graph for this function:

VOID SetShi ( ShIndex pShi)

Definition at line 231 of file CreateData.c.

{
       JINT   i, k, nTmp;

       pShi->nSize         = sizeof(ShIndex);
       pShi->nStartPos            = 0;                                /* To be added by a BaseOffset */

       for (i = 0; i < (NUM_YINJIE + 1); i++)
              pShi->nYjOff[i]       = 0;

       /*
       ** Each pShi->nYjOff[i] is less than 0x00FFFFFF. Highest 8 bit contains
       ** the number of nXianFormNum.
       */
       for (i = 0; i < NUM_YINJIE; i++)
       {
              nTmp = (2 * shSH[i].nHzNum) + (4 * shSH[i].nXianFormNum);
              for (k = i; k < NUM_YINJIE; k++)
                     pShi->nYjOff[k + 1] += nTmp;
              pShi->nYjOff[i + 1] += (shSH[i].nXianFormNum << 24);
       }

       pShi->nEndPos       = pShi->nYjOff[NUM_YINJIE] & 0x00FFFFFF;     /* To be added by a BaseOffset */

       printf("sizeof(ShIndex) is %d, Total Single Hanzi Data area size is %d\n", sizeof(ShIndex), pShi->nEndPos );
}

Here is the caller graph for this function:

JINT ValidAddChar ( CHAR  ch,
JINT  nYinjieCode 
)

Definition at line 1909 of file PyBasic.c.

{
       JINT    i, nTmpRes;
       CHAR    szStr[7];
       
       for (i = 0; i < 7; i++)
              szStr[i] = '\0';

       szStr[0] = ch;
       if ((nYinjieCode >= 0) && (nYinjieCode <= 414))
       {
              i = 0; 
              while (YINJIESTR_CSZ[nYinjieCode][i])
              {
                     szStr[i + 1] = YINJIESTR_CSZ[nYinjieCode][i];
                     i++;
              }
                     
              nTmpRes = FastMatchYinJieStr(szStr);
              if(nTmpRes != -1)
                     return nTmpRes;
       }
       
       return 0xFFFF;
}

Here is the call graph for this function:

Here is the caller graph for this function:

JINT ValidButFirstChar ( JINT  nYinjieCode)

Definition at line 1940 of file PyBasic.c.

{
       JINT    i, nTmpRes;
       CHAR    szStr[7];
       
       for (i = 0; i < 7; i++)
              szStr[i] = '\0';
       
       if ((nYinjieCode >= 0) && (nYinjieCode <= 414))
       {
              i = 0; 
              while (YINJIESTR_CSZ[nYinjieCode][i+1])
              {
                     szStr[i] = YINJIESTR_CSZ[nYinjieCode][i+1];
                     i++;
              }
                     
              nTmpRes = FastMatchYinJieStr(szStr);
              if(nTmpRes != -1)
                     return nTmpRes;
       }
       
       return 0xFFFF;
}

Here is the call graph for this function:

Here is the caller graph for this function:

JINT ValidButLastChar ( JINT  nYinjieCode)

Definition at line 1880 of file PyBasic.c.

{
       JINT    i, nTmpRes;
       CHAR    szStr[7];
       
       for (i = 0; i < 7; i++)
              szStr[i] = '\0';
       
       if ((nYinjieCode >= 0) && (nYinjieCode <= 414))
       {
              i = 0; 
              while (YINJIESTR_CSZ[nYinjieCode][i+1])
              {
                     szStr[i] = YINJIESTR_CSZ[nYinjieCode][i];
                     i++;
              }
                     
              nTmpRes = FastMatchYinJieStr(szStr);
              if(nTmpRes != -1)
                     return nTmpRes;
       }
       return 0xFFFF;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 69 of file ciku.c.

Definition at line 67 of file ciku.c.

Definition at line 23 of file ProcGbk.c.

Definition at line 65 of file ciku.c.

Definition at line 66 of file ciku.c.

Definition at line 68 of file ciku.c.

Definition at line 24 of file ProcGbk.c.