]> git.sur5r.net Git - cc65/blobdiff - src/ca65/sizeof.c
Finished implemenation of commands to delete macros. Added the new commands to
[cc65] / src / ca65 / sizeof.c
index ae2210a04448d7ec4cb216dd2db599cb3933cd14..ba2b2281dcb2ca3c1fb6ac30be4205567f1768d0 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2003      Ullrich von Bassewitz                                       */
-/*               Römerstraße 52                                              */
-/*               D-70794 Filderstadt                                         */
-/* EMail:        uz@cc65.org                                                 */
+/* (C) 2003-2008, Ullrich von Bassewit                                       */
+/*                Roemerstrasse 52                                           */
+/*                D-70794 Filderstadt                                        */
+/* EMail:         uz@cc65.org                                                */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
@@ -37,6 +37,7 @@
 #include "addrsize.h"
 
 /* ca65 */
+#include "expr.h"
 #include "sizeof.h"
 #include "symtab.h"
 
 /* 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 char SizeEntryName[] = ".size";
-
+const StrBuf SizeEntryName = LIT_STRBUF_INITIALIZER (".size");
 
 
 
 /*****************************************************************************/
-/*                                          Code                                    */
+/*                                          Code                                    */
 /*****************************************************************************/
 
 
@@ -67,7 +67,7 @@ SymEntry* GetSizeOfScope (SymTable* Scope)
  * encodes the size, and will create a new entry if it does not exist.
  */
 {
-    return SymFind (Scope, SizeEntryName, SYM_ALLOC_NEW);
+    return SymFind (Scope, &SizeEntryName, SYM_ALLOC_NEW);
 }
 
 
@@ -78,7 +78,7 @@ SymEntry* GetSizeOfSymbol (SymEntry* Sym)
  * does not exist.
  */
 {
-    return SymFindLocal (Sym, SizeEntryName, SYM_ALLOC_NEW);
+    return SymFindLocal (Sym, &SizeEntryName, SYM_ALLOC_NEW);
 }
 
 
@@ -88,6 +88,7 @@ SymEntry* DefSizeOfScope (SymTable* Scope, long Size)
 {
     SymEntry* SizeSym = GetSizeOfScope (Scope);
     SymDef (SizeSym, GenLiteralExpr (Size), ADDR_SIZE_DEFAULT, SF_NONE);
+    return SizeSym;
 }
 
 
@@ -97,6 +98,7 @@ SymEntry* DefSizeOfSymbol (SymEntry* Sym, long Size)
 {
     SymEntry* SizeSym = GetSizeOfSymbol (Sym);
     SymDef (SizeSym, GenLiteralExpr (Size), ADDR_SIZE_DEFAULT, SF_NONE);
+    return SizeSym;
 }