const StrBuf* GetFileName (unsigned Name) /* Get the name of a file where the name index is known */ { static const StrBuf ErrorMsg = LIT_STRBUF_INITIALIZER ("(outside file scope)"); const FileEntry* F; if (Name == 0) { /* Name was defined outside any file scope, use the name of the first * file instead. Errors are then reported with a file position of * line zero in the first file. */ if (CollCount (&FileTab) == 0) { /* No files defined until now */ return &ErrorMsg; } else { F = CollConstAt (&FileTab, 0); } } else { F = CollConstAt (&FileTab, Name-1); } return GetStrBuf (F->Name); }
#include "expr.h" #include "sizeof.h" #include "symtab.h" /*****************************************************************************/ /* Data */ /*****************************************************************************/ /* The name of the symbol used to encode the size. The name of this entry is * choosen so that it cannot be accessed by the user. */ static const StrBuf SizeEntryName = LIT_STRBUF_INITIALIZER (".size"); /*****************************************************************************/ /* Code */ /*****************************************************************************/ int IsSizeOfSymbol (const SymEntry* Sym) /* Return true if the given symbol is the one that encodes the size of some * entity. Sym may also be a NULL pointer in which case false is returned. */ { return (Sym != 0 && SB_Compare (GetSymName (Sym), &SizeEntryName) == 0);