]> git.sur5r.net Git - cc65/blobdiff - src/cc65/exprdesc.c
Merge remote-tracking branch 'upstream/master' into a5200
[cc65] / src / cc65 / exprdesc.c
index 7881f352458d035b0a17b7025cf1fe1c5d995852..a5787d96745dc05c68ead8eb27fc5dcd85969175 100644 (file)
@@ -6,7 +6,7 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2002-2009, Ullrich von Bassewitz                                      */
+/* (C) 2002-2010, Ullrich von Bassewitz                                      */
 /*                Roemerstrasse 52                                           */
 /*                D-70794 Filderstadt                                        */
 /* EMail:         uz@cc65.org                                                */
@@ -49,7 +49,7 @@
 
 
 /*****************************************************************************/
-/*                                  Code                                    */
+/*                                   Code                                    */
 /*****************************************************************************/
 
 
@@ -63,6 +63,7 @@ ExprDesc* ED_Init (ExprDesc* Expr)
     Expr->Name      = 0;
     Expr->IVal      = 0;
     Expr->FVal      = FP_D_Make (0.0);
+    Expr->LVal      = 0;
     Expr->BitOffs   = 0;
     Expr->BitWidth  = 0;
     return Expr;
@@ -117,31 +118,31 @@ const char* ED_GetLabelName (const ExprDesc* Expr, long Offs)
 
         case E_LOC_ABS:
             /* Absolute: numeric address or const */
-                   SB_Printf (&Buf, "$%04X", (int)(Offs & 0xFFFF));
+            SB_Printf (&Buf, "$%04X", (int)(Offs & 0xFFFF));
             break;
 
         case E_LOC_GLOBAL:
         case E_LOC_STATIC:
             /* Global or static variable */
-           if (Offs) {
-               SB_Printf (&Buf, "%s%+ld", SymGetAsmName (Expr->Sym), Offs);
-           } else {
-               SB_Printf (&Buf, "%s", SymGetAsmName (Expr->Sym));
-           }
+            if (Offs) {
+                SB_Printf (&Buf, "%s%+ld", SymGetAsmName (Expr->Sym), Offs);
+            } else {
+                SB_Printf (&Buf, "%s", SymGetAsmName (Expr->Sym));
+            }
             break;
 
         case E_LOC_REGISTER:
             /* Register variable */
-           SB_Printf (&Buf, "regbank+%u", (unsigned)((Offs + Expr->Name) & 0xFFFFU));
+            SB_Printf (&Buf, "regbank+%u", (unsigned)((Offs + Expr->Name) & 0xFFFFU));
             break;
 
         case E_LOC_LITERAL:
             /* Literal in the literal pool */
-           if (Offs) {
-               SB_Printf (&Buf, "%s%+ld", LocalLabelName (Expr->Name), Offs);
-           } else {
-                       SB_Printf (&Buf, "%s", LocalLabelName (Expr->Name));
-           }
+            if (Offs) {
+                SB_Printf (&Buf, "%s%+ld", LocalLabelName (Expr->Name), Offs);
+            } else {
+                SB_Printf (&Buf, "%s", LocalLabelName (Expr->Name));
+            }
             break;
 
         default:
@@ -172,7 +173,7 @@ ExprDesc* ED_MakeConstAbs (ExprDesc* Expr, long Value, Type* Type)
 {
     Expr->Sym   = 0;
     Expr->Type  = Type;
-    Expr->Flags = E_LOC_ABS | E_RTYPE_RVAL;
+    Expr->Flags = E_LOC_ABS | E_RTYPE_RVAL | (Expr->Flags & E_HAVE_MARKS);
     Expr->Name  = 0;
     Expr->IVal  = Value;
     Expr->FVal  = FP_D_Make (0.0);
@@ -186,7 +187,7 @@ ExprDesc* ED_MakeConstAbsInt (ExprDesc* Expr, long Value)
 {
     Expr->Sym   = 0;
     Expr->Type  = type_int;
-    Expr->Flags = E_LOC_ABS | E_RTYPE_RVAL;
+    Expr->Flags = E_LOC_ABS | E_RTYPE_RVAL | (Expr->Flags & E_HAVE_MARKS);
     Expr->Name  = 0;
     Expr->IVal  = Value;
     Expr->FVal  = FP_D_Make (0.0);
@@ -372,6 +373,3 @@ Type* ReplaceType (ExprDesc* Expr, const Type* NewType)
     Expr->Type = TypeDup (NewType);
     return OldType;
 }
-
-
-