Next Previous Contents

2. 資料結構

2.1 前言

在本節中,我們將介紹在 libtabe 中所會使用到的幾個基本資料結構。 有些資料結構雖然只是其他資料形態的重新定義而已,不過, 為了不與 C 語言中的資料形態相混淆,我們還是使用這樣的方式。

2.2 定義


typedef unsigned char    *ZuYinSymbol;
typedef unsigned char    *ZuYinSymbolSequence;
typedef unsigned int      ZuYinIndex;

typedef unsigned int      ZhiCode;
typedef unsigned char    *Zhi;
typedef unsigned char    *ZhiStr;

typedef unsigned long int Yin;

struct ZhiInfo {
  ZhiCode           code;
  Zhi               chct;
  Yin               yin[4];
  unsigned long int refcount; /* should be obsoleted soon */
};

struct TsiInfo {
  ZhiStr             tsi;
  unsigned long int  refcount;
  unsigned long int  yinnum;
  Yin               *yindata;
};

struct TsiYinInfo {
  Yin               *yin ;
  unsigned long int  yinlen;
  unsigned long int  tsinum;
  ZhiStr             tsidata;
};

struct ChunkInfo {
  ZhiStr          chunk;
  int             num_tsi;
  struct TsiInfo *tsi;
};

struct ChuInfo {
  ZhiStr            chu;
  int               num_chunk;
  struct ChunkInfo *chunk;
};

struct TsiDB {
  int type;
  int flags;
  char *db_name;
  void *dbp;
  void *dbcp;
  .
  .
  .
};

struct TsiYinDB {
  int type;
  int flags;
  char *db_name;
  void *dbp;
  void *dbcp;
  .
  .
  .
};

2.3 說明


Next Previous Contents