]> git.sur5r.net Git - cc65/blobdiff - src/ca65/studyexpr.c
Finished implemenation of commands to delete macros. Added the new commands to
[cc65] / src / ca65 / studyexpr.c
index 7d204982022fc57774470fb18cac79336f3fc222..42a8dbbd6a748b513b53791aad8cc49a6ebc357c 100644 (file)
@@ -510,9 +510,9 @@ static void StudySymbol (ExprNode* Expr, ExprDesc* D)
             if (Verbosity > 0) {
                 DumpExpr (Expr, SymResolve);
             }
-            PError (GetSymPos (Sym),
-                    "Circular reference in definition of symbol `%s'",
-                    GetSymName (Sym));
+            LIError (&Sym->LineInfos,
+                     "Circular reference in definition of symbol `%m%p'",
+                     GetSymName (Sym));
             ED_Invalidate (D);
         } else {
 
@@ -581,7 +581,7 @@ static void StudySection (ExprNode* Expr, ExprDesc* D)
 /* Study a section expression node */
 {
     /* Get the section reference */
-    ED_SecRef* SecRef = ED_GetSecRef (D, Expr->V.SegNum);
+    ED_SecRef* SecRef = ED_GetSecRef (D, Expr->V.SecNum);
 
     /* Update the data and the address size */
     ++SecRef->Count;
@@ -1002,6 +1002,34 @@ static void StudyBoolXor (ExprNode* Expr, ExprDesc* D)
 
 
 
+static void StudyMax (ExprNode* Expr, ExprDesc* D)
+/* Study an MAX binary expression node */
+{
+    /* Use helper function */
+    StudyBinaryExpr (Expr, D);
+
+    /* If the result is valid, apply the operation */
+    if (ED_IsValid (D)) {
+        D->Val = (D->Val > D->Right)? D->Val : D->Right;
+    }
+}
+
+
+
+static void StudyMin (ExprNode* Expr, ExprDesc* D)
+/* Study an MIN binary expression node */
+{
+    /* Use helper function */
+    StudyBinaryExpr (Expr, D);
+
+    /* If the result is valid, apply the operation */
+    if (ED_IsValid (D)) {
+        D->Val = (D->Val < D->Right)? D->Val : D->Right;
+    }
+}
+
+
+
 static void StudyUnaryMinus (ExprNode* Expr, ExprDesc* D)
 /* Study an EXPR_UNARY_MINUS expression node */
 {
@@ -1279,6 +1307,14 @@ static void StudyExprInternal (ExprNode* Expr, ExprDesc* D)
             StudyBoolXor (Expr, D);
             break;
 
+        case EXPR_MAX:
+            StudyMax (Expr, D);
+            break;
+
+        case EXPR_MIN:
+            StudyMin (Expr, D);
+            break;
+
         case EXPR_UNARY_MINUS:
             StudyUnaryMinus (Expr, D);
             break;