/* * EntitySymtab is a hashed lookup table for EntityStructs. It's basically * just a C++ wrapper for translator symtab. */ #ifndef esymtabIncluded #define esymtabIncluded #include "std-macros++.h" #include "sym++.h" #include "entity.h" class EntitySymtab { public: int Size; /* Gotta a better guess?? */ EntitySymtab(); void EnterSym(EntityStruct* es); /* * Call HashAllocSymtabEntry and Enter to do the work. Use the Chain * field to point to the EntityStruct itself. */ EntityStruct* LookupSym(char* name); /* * Call lookup to do the work and return the entity struct that Chain * points to. Note that the input string s is a *disambiguated* browser * name. i.e., a name of the form (in module ). Use * LookupAmbig below to find a plain string name. */ EntityStruct* LookupAmbigSym(SymtabEntry* sym); /* * Lookup sym->Symbol, and if not found, lookup BuildDisambiguatedStr( * sym). */ char* BuildDisambiguatedStr(SymtabEntry* e, int alt_count); /* * If alt_count is zero, construct a disambiguated name of the form: * * e->Symbol || " (in module" * || e->Info.{Obj|Op}.parent->Symbol * || ")" * * That is, we disambiguate any symbol name that will appear more than * one in a string browser by suffixing it with its module name. We use * a suffix rather than standard prefix dot notation so that the browser * will remain sorted by entity name. I.e., as noted above, the entity * name is the primary sort key. * * If alt_count is non-zero, then we're dealing with either an op * overload or multiply-defined obj. If the former, disambiguate via * with the suffix "overload ". If the latter, disambiguate * with sufix "alt ". * * Note that the initial inclination was to disambiguate ops with a sig, * but since they won't necessarily be unique in a reasonbly short string * form, we opted for the "overload " suffix. This is not * really a cop out, since having very long unique sig strings simply * won't do in the browsers. */ char* BuildDisambiguatedHtmlStr(SymtabEntry* e, int alt_count); /* * Identical to BuildDisambiguatedStr, except " " is used instead of * space chars so that a narrow index frame entry will not break onto * more that one line. */ EntityStruct* Enum(); protected: char* BuildDisambiguatedStr1(SymtabEntry* e, int alt_count, const char* space_char); /* * Common work doer for BuildDisambiguated{,Html}Str, q.q.v. */ private: Symtab* symt; /* Rep is a translator symtab */ }; #endif