00001 /*---------------------------------------------------------------------------* 00002 * SR_SymbolTable.h * 00003 * * 00004 * Copyright 2007 Nuance Communciations, Inc. * 00005 * * 00006 * Licensed under the Apache License, Version 2.0 (the 'License'); * 00007 * you may not use this file except in compliance with the License. * 00008 * * 00009 * You may obtain a copy of the License at * 00010 * http://www.apache.org/licenses/LICENSE-2.0 * 00011 * * 00012 * Unless required by applicable law or agreed to in writing, software * 00013 * distributed under the License is distributed on an 'AS IS' BASIS, * 00014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 00015 * See the License for the specific language governing permissions and * 00016 * limitations under the License. * 00017 * * 00018 *---------------------------------------------------------------------------*/ 00019 00020 #ifndef __SR_SYMBOLTABLE_H 00021 #define __SR_SYMBOLTABLE_H 00022 00023 00024 00025 #include "SR_SemprocPrefix.h" 00026 #include "SR_SemprocDefinitions.h" 00027 00028 #include "ESR_ReturnCode.h" 00029 00030 #include "HashMap.h" 00031 00032 #include "ptypes.h" 00033 #include "pstdio.h" 00034 00035 #define MAX_SEMPROC_KEY 128 /* was 350 */ 00036 #define MAX_SEMPROC_VALUE 512 /* was 300 */ 00037 00041 typedef struct Symbol_t 00042 { 00046 LCHAR key[MAX_SEMPROC_KEY]; 00050 LCHAR value[MAX_SEMPROC_VALUE]; 00051 } 00052 Symbol; 00053 00057 typedef struct SymbolTable_t 00058 { 00062 HashMap* hashmap; 00063 00067 Symbol Symbols[MAX_SYMBOLS]; 00068 00072 Symbol *next; 00073 00077 Symbol SpecialSymbols[MAX_SPECIAL_SYMBOLS]; 00078 00082 size_t num_special_symbols; 00083 00084 } 00085 SymbolTable; 00086 00090 //static LCHAR undefined_symbol[] = UNDEFINED_SYMBOL; 00091 00096 SREC_SEMPROC_API ESR_ReturnCode ST_Init(SymbolTable** self); 00097 00102 SREC_SEMPROC_API ESR_ReturnCode ST_Free(SymbolTable* self); 00103 00109 ESR_ReturnCode ST_Copy(SymbolTable* self, HashMap* dst); 00110 00117 SREC_SEMPROC_API ESR_ReturnCode ST_putKeyValue(SymbolTable* self, LCHAR* key, LCHAR* value); 00118 00125 SREC_SEMPROC_API ESR_ReturnCode ST_getKeyValue(SymbolTable* self, LCHAR* key, LCHAR** value); 00126 00132 SREC_SEMPROC_API ESR_ReturnCode ST_getSymbolSlot(SymbolTable* self, Symbol** slot); 00133 00138 SREC_SEMPROC_API ESR_ReturnCode ST_reset(SymbolTable* self); 00139 SREC_SEMPROC_API ESR_ReturnCode ST_reset_all(SymbolTable* self); 00140 00148 SREC_SEMPROC_API ESR_ReturnCode ST_putSpecialKeyValue(SymbolTable* self, const LCHAR* key, const LCHAR* value); 00149 00150 00151 #endif /* __SYMBOL_TABLE_H */