00001 00020 #ifndef FEATDEFS_H 00021 #define FEATDEFS_H 00022 00023 /* ================= 00024 Include Files and Type Defines 00025 ==================== */ 00026 #include "ocrfeatures.h" 00027 00029 #define NUM_FEATURE_TYPES 4 00030 00032 #define ILLEGAL_SHORT_NAME 2000 00033 00043 typedef struct 00044 { 00046 UINT32 NumFeatureSets; 00049 FEATURE_SET FeatureSets[NUM_FEATURE_TYPES]; 00050 } CHAR_DESC_STRUCT; 00051 00052 00058 typedef CHAR_DESC_STRUCT *CHAR_DESC; 00059 00068 typedef struct 00069 { 00071 UINT32 NumFeatureTypes; 00074 FEATURE_DESC FeatureDesc[NUM_FEATURE_TYPES]; 00076 FEATURE_EXT_STRUCT* FeatureExtractors[NUM_FEATURE_TYPES]; 00077 int FeatureEnabled[NUM_FEATURE_TYPES]; 00078 } FEATURE_DEFS_STRUCT; 00079 00084 typedef FEATURE_DEFS_STRUCT *FEATURE_DEFS; 00085 00086 /* 00087 Macros for finding feature definitions 00088 */ 00089 #define NumFeaturesDefined() (FeatureDefs.NumFeatureTypes) 00090 #define DefinitionOf(Type) (FeatureDefs.FeatureDesc[Type]) 00091 #define ExtractorOf(Type) (FeatureDefs.FeatureExtractors[Type]) 00092 #define FeatureOn(Type) (FeatureDefs.FeatureEnabled[Type]) 00093 00094 /* 00095 Macros for manipulating character descriptions 00096 */ 00097 #define NumFeatureSetsIn(Char) ((Char)->NumFeatureSets) 00098 #define FeaturesOfType(Char, Type) ((Char)->FeatureSets[Type]) 00099 00100 /*---------------------------------------------------------------------- 00101 Generic functions for manipulating character descriptions 00102 ----------------------------------------------------------------------*/ 00103 void FreeCharDescription(CHAR_DESC CharDesc); 00104 00105 CHAR_DESC NewCharDescription(); 00106 00107 void WriteCharDescription(FILE *File, CHAR_DESC CharDesc); 00108 00109 CHAR_DESC ReadCharDescription(FILE *File); 00110 00111 int ShortNameToFeatureType(const char *ShortName); 00112 00113 /* ================= 00114 Global Data Definitions and Declarations 00115 ==================== */ 00116 extern FEATURE_DEFS_STRUCT FeatureDefs; 00117 #endif