#ifndef LUT_H #define LUT_H /*----------------------------------------------------------- * * Source File : lut.h * *----------------------------------------------------------- */ typedef unsigned char bool; #ifndef ERROR #define ERROR -1 #endif #ifndef TRUE #define TRUE (bool) 1 #define FALSE (bool) 0 #endif #define ABBR_SIZE_BIG 4 /* num char in abbr name */ #define VER_SIZE 3 /* num char in version name */ #define ABBR_SIZE_SMALL 2 /* num char in abbr name */ #define ARR_SIZE ABBR_SIZE_BIG #ifdef MAXTABLES #define LUT_NUM_ELEMENTS MAXTABLES #else #define LUT_NUM_ELEMENTS 256 /* max num elements in lut */ #endif #define MAX_VER_ELEMENTS 100 /* max allowed elements in version lut */ #define MAX_VER_NUMBER 999 /* Highest version number allowed... */ typedef struct btree_node_st btree_node_st; /*****************************************************************/ /* the following structure is used as a binary tree node element */ /*****************************************************************/ struct btree_node_st { char name[ARR_SIZE+1]; unsigned char num; int weight; btree_node_st *p_right; /* ptr to right child */ btree_node_st *p_left; /* ptr to left child */ btree_node_st *p_parent; /* ptr to parent */ }; /***********************************/ /* the following structure is used */ /* as a look up table structure */ /***********************************/ typedef char C_TABLE[ARR_SIZE + 1]; typedef enum { ABBR_TBL_TYPE = 777, /* abbreviation table type */ VER_TBL_TYPE /* version number type */ } lut_type; typedef struct { int num_elements; /* num elements currently in lut. */ lut_type type; btree_node_st *p_btree_root; /* ptr to root of btree */ C_TABLE names[LUT_NUM_ELEMENTS]; /* look up table */ }lut_st; #endif