quick start:g++ [flags ...] file ... -l /isip/tools/lib/$ISIP_BINARY/lib_io.a #include <SofSymbolTable.h> SofSymbolTable(); long add(const SysString& name); boolean remove(long number); long getIndex(const SysString& name) const;
SofSymbolTable table0;
SysString n1(L"Long")
table0.add(n1);
table0.remove(n1);
SysString bad_name(L"oscar had");
if (table0.checkName(bad_name)) {
return Error::handle(name(), L"checkName", Error::TEST, __FILE__, __LINE__);
}
description:
static const SysString CLASS_NAME = L"SofSymbolTable";
static const long MAX_SYM_LENGTH = 64;
static const long GROW_SIZE = 256;
static const SysString INVALID_CHARS = L" {}=\\;\"'/`:#";
static const long MAX_WASTED_SPACE = 1024;
static const long NO_SYMB = -1;
static const long ERR = 10200;
static const long ERR_ADD = 10201;
static const long ERR_NOTFND = 10202;
static const long ERR_NOVEC = 10203;
static const long ERR_SYMB = 10204;
SysString* table_d;
long* ref_count_d;
long table_size_d;
long num_syms_d;
long table_capacity_d;
long* transform_d;
long transform_size_d;
Integral::DEBUG debug_level_d;
static const SysString& name();
static boolean diagnose(Integral::DEBUG debug_level);
boolean setDebug(Integral::DEBUG debug_level);
boolean debug(const unichar* msg) const;
~SofSymbolTable();
SofSymbolTable();
SofSymbolTable(const SofSymbolTable& arg);
boolean assign(const SofSymbolTable& arg);
SofSymbolTable& operator=(const SofSymbolTable& arg);
these methods are omitted because SofSymbolTable can not write itself to an sof file
these methods are omitted because they are not useful for SofSymbolTable objects
boolean clear(Integral::CMODE ctype_a = Integral::DEF_CMODE);
boolean assignCompact(const SofSymbolTable& arg);
long memSize() const;
long getIndex(const SysString& name) const;
boolean getSymbol(SysString& name, long num) const;
long getRefCount(const SysString& name) const;
long getRefCount(long index) const;
long getCount() const;
long add(const SysString& name);
long add(long index, long refs, const SysString& name);
boolean remove(const SysString& name);
boolean remove(long number);
boolean checkName(const SysString& name) const;
boolean isEfficient() const;
long convert(const SofSymbolTable& old, long index) const;
long convert(long index) const;
boolean transformInit(const SofSymbolTable& old);
boolean transformDelete();
long addNew(const SysString& name);
boolean growCapacity();
boolean freeMem();
SofSymbolTable table0;
SofSymbolTable table1(table0);
SysString n1(L"Long");
SysString n2(L"Short");
SysString n3(L"Float");
SysString n4(L"Long");
// add symbols into table
//
table0.add(n1);
table0.add(n2);
table0.add(n3);
table0.add(n4);
// check the entry
//
SysString symbol;
if (!table0.getSymbol(symbol, 0) || symbol.ne(n1)) {
Console::put(L"Error in add/getSymbol");
}
long i = table0.getIndex(n1);
if (i == SofSymbolTable::NO_SYMB) {
return Error::handle(name(), L"getEntry", Error::TEST, __FILE__, __LINE__);
}
// remove a symbol
//
table0.remove(n1);