]> git.sur5r.net Git - cc65/blobdiff - src/cc65/stdfunc.c
Removed unused modules
[cc65] / src / cc65 / stdfunc.c
index 763c895ceecdf2fef090a5cf2b9953bf41793578..7877f6c9da95a9f2a5355d45b2fc39cd33a6f5ab 100644 (file)
@@ -48,6 +48,7 @@
 #include "litpool.h"
 #include "scanner.h"
 #include "stdfunc.h"
+#include "stdnames.h"
 #include "typeconv.h"
 
 
@@ -116,17 +117,17 @@ static unsigned ParseArg (type* Type, ExprDesc* Arg)
     unsigned Flags = CF_FORCECHAR;
 
     /* Read the expression we're going to pass to the function */
-    int k = hie1 (InitExprDesc (Arg));
+    hie1 (InitExprDesc (Arg));
 
     /* Convert this expression to the expected type */
-    k = TypeConversion (Arg, k, Type);
+    TypeConversion (Arg, Type);
 
     /* If the value is not a constant, load it into the primary */
-    if (k != 0 || Arg->Flags != E_MCONST) {
+    if (ED_IsLVal (Arg) || Arg->Flags != E_MCONST) {
 
         /* Load into the primary */
-        ExprLoad (CF_NONE, k, Arg);
-        k = 0;
+        ExprLoad (CF_NONE, Arg);
+        ED_MakeRVal (Arg);
 
     } else {
 
@@ -191,11 +192,11 @@ static void StdFunc_memset (FuncDesc* F attribute ((unused)),
        if (Arg.ConstVal == 0) {
            Warning ("Call to memset has no effect");
        }
-        ExprLoad (CF_FORCECHAR, 0, &Arg);
+        ExprLoad (CF_FORCECHAR, &Arg);
     }
 
     /* Emit the actual function call */
-    g_call (CF_NONE, MemSet? "memset" : "_bzero", ParamSize);
+    g_call (CF_NONE, MemSet? Func_memset : Func__bzero, ParamSize);
 
     /* We expect the closing brace */
     ConsumeRParen ();
@@ -208,7 +209,6 @@ static void StdFunc_strlen (FuncDesc* F attribute ((unused)),
 /* Handle the strlen function */
 {
     static type   ParamType[] = { T_PTR, T_SCHAR, T_END };
-    int           k;
     ExprDesc      Param;
     unsigned      CodeFlags;
     unsigned long ParamName;
@@ -217,7 +217,8 @@ static void StdFunc_strlen (FuncDesc* F attribute ((unused)),
     ParamType[1] = GetDefaultChar () | T_QUAL_CONST;
 
     /* Fetch the parameter and convert it to the type needed */
-    k = TypeConversion (&Param, hie1 (InitExprDesc (&Param)), ParamType);
+    hie1 (InitExprDesc (&Param));
+    TypeConversion (&Param, ParamType);
 
     /* Check if the parameter is a constant array of some type, or a numeric
      * address cast to a pointer.
@@ -259,9 +260,9 @@ static void StdFunc_strlen (FuncDesc* F attribute ((unused)),
                 if (!WriteableStrings) {
                     /* String literals are const */
                     ExprDesc Length;
-                    MakeConstIntExpr (&Length, strlen (GetLiteral (Param.ConstVal)));
+                    ED_MakeConstInt (&Length, strlen (GetLiteral (Param.ConstVal)));
                     ResetLiteralPoolOffs (Param.ConstVal);
-                    ExprLoad (CF_NONE, 0, &Length);
+                    ExprLoad (CF_NONE, &Length);
                     goto ExitPoint;
                 } else {
                     CodeFlags |= CF_CONST | CF_STATIC;
@@ -276,7 +277,7 @@ static void StdFunc_strlen (FuncDesc* F attribute ((unused)),
     } else {
 
        /* Not an array with a constant address. Load parameter into primary */
-       ExprLoad (CF_NONE, k, &Param);
+       ExprLoad (CF_NONE, &Param);
 
     }