Back to index

im-sdk  12.3.91
Functions
zhuyin_data.c File Reference
#include <stdio.h>
#include "zhuyin_data.h"

Go to the source code of this file.

Functions

int ZhuyinData_Init (char *zhuyin_config_file, TZhuyinData *pZhuyinData)
int ZhuyinData_Free (TZhuyinData *pZhuyinData)
int ZhuyinData_Open (TZhuyinData *pZhuyinData)
int ZhuyinData_Print (TZhuyinData *pZhuyinData)

Function Documentation

int ZhuyinData_Free ( TZhuyinData pZhuyinData)

Definition at line 81 of file zhuyin_data.c.

{
       if (pZhuyinData->data_file != NULL) {
              free((char *)pZhuyinData->data_file);
       }

       pZhuyinData->nCurrentKeymapID = 0;
       if (pZhuyinData->pZhuyinKeymapList) {
              ZhuyinKeymapList_Free(pZhuyinData->pZhuyinKeymapList);
              free((char *)pZhuyinData->pZhuyinKeymapList);
       }

       if (pZhuyinData->pCodetableHeader) {
              UnloadCodeTable(pZhuyinData->pCodetableHeader);
              free((char *)pZhuyinData->pCodetableHeader);
       }

       return(ZHUYIN_OK);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int ZhuyinData_Init ( char *  zhuyin_config_file,
TZhuyinData pZhuyinData 
)

Definition at line 46 of file zhuyin_data.c.

{
       int ret;

       pZhuyinData->data_file = NULL;

       pZhuyinData->nCurrentKeymapID = 0;
       pZhuyinData->pZhuyinKeymapList = (TZhuyinKeymapList *)calloc(1, sizeof(TZhuyinKeymapList));
       if (pZhuyinData->pZhuyinKeymapList == NULL) {
              return(ZHUYIN_ERROR);
       }
       ZhuyinKeymapList_Init(pZhuyinData->pZhuyinKeymapList);

       pZhuyinData->pCodetableHeader = (CodeTableStruct *)calloc(1, sizeof(CodeTableStruct));
       if (pZhuyinData->pCodetableHeader == NULL) {
              return(ZHUYIN_ERROR);
       }

       ret = ZhuyinData_Read_Config(zhuyin_config_file, pZhuyinData);
       if (ret == ZHUYIN_ERROR) {
              return(ZHUYIN_ERROR);
       }

       if (pZhuyinData->data_file == NULL) {
              return(ZHUYIN_ERROR);
       }

       ret = LoadCodeTableHeader(pZhuyinData->data_file, pZhuyinData->pCodetableHeader);
       if (ret == -1) {
              return(ZHUYIN_ERROR);
       }

       return(ZHUYIN_OK);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int ZhuyinData_Open ( TZhuyinData pZhuyinData)

Definition at line 101 of file zhuyin_data.c.

{
       int ret;

       if (pZhuyinData->data_file == NULL) {
              return(ZHUYIN_ERROR);
       }

       if (pZhuyinData->pCodetableHeader == NULL) {
              return(ZHUYIN_ERROR);
       }

       ret = LoadCodeTable(pZhuyinData->data_file, pZhuyinData->pCodetableHeader);
       if (ret == -1) {
              return(ZHUYIN_ERROR);
       }

       return(ZHUYIN_OK);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int ZhuyinData_Print ( TZhuyinData pZhuyinData)

Definition at line 121 of file zhuyin_data.c.

{
       if (pZhuyinData->data_file != NULL) {
              printf("data_file: %s\n", pZhuyinData->data_file);
       }

       if (pZhuyinData->pZhuyinKeymapList) {
              ZhuyinKeymapList_Print(pZhuyinData->pZhuyinKeymapList);
       }
}

Here is the call graph for this function:

Here is the caller graph for this function: