/* */
/* */
/* */
-/* (C) 2003-2008, Ullrich von Bassewit */
+/* (C) 2003-2011, Ullrich von Bassewit */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/*****************************************************************************/
-/* Data */
+/* 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.
*/
-const StrBuf SizeEntryName = LIT_STRBUF_INITIALIZER (".size");
+static const StrBuf SizeEntryName = LIT_STRBUF_INITIALIZER (".size");
/*****************************************************************************/
-/* Code */
+/* 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);
+}
+
+
+
+SymEntry* FindSizeOfScope (SymTable* Scope)
+/* Get the size of a scope. The function returns the symbol table entry that
+ * encodes the size or NULL if there is no such entry.
+ */
+{
+ return SymFind (Scope, &SizeEntryName, SYM_FIND_EXISTING);
+}
+
+
+
+SymEntry* FindSizeOfSymbol (SymEntry* Sym)
+/* Get the size of a symbol table entry. The function returns the symbol table
+ * entry that encodes the size of the symbol or NULL if there is no such entry.
+ */
+{
+ return SymFindLocal (Sym, &SizeEntryName, SYM_FIND_EXISTING);
+}
+
+
+
SymEntry* GetSizeOfScope (SymTable* Scope)
/* Get the size of a scope. The function returns the symbol table entry that
* encodes the size, and will create a new entry if it does not exist.