]> git.sur5r.net Git - cc65/blobdiff - src/ca65/sizeof.c
Removed (pretty inconsistently used) tab chars from source code base.
[cc65] / src / ca65 / sizeof.c
index ba2b2281dcb2ca3c1fb6ac30be4205567f1768d0..a29c83e9d0d0c5ac6a8ff93856caa1197ee31310 100644 (file)
@@ -6,7 +6,7 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2003-2008, Ullrich von Bassewit                                       */
+/* (C) 2003-2011, Ullrich von Bassewit                                       */
 /*                Roemerstrasse 52                                           */
 /*                D-70794 Filderstadt                                        */
 /* EMail:         uz@cc65.org                                                */
@@ -44,7 +44,7 @@
 
 
 /*****************************************************************************/
-/*                                          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.