fix some tests
[calc.git] / argument.c
index bda7684e754e813659e1c53fe72b56bb60210331..c5b1504b25409f9795459eb3885e1813d12ea6c4 100644 (file)
@@ -1,3 +1,5 @@
+#include <stdio.h>
+
 #include "parser.h"
 #include "tabular.h"
 
@@ -18,14 +20,16 @@ double arg (int n)
 
 /* set arguments */
 
-double def (int nbops, element_t **ops)
+tab_t *def (int nbops, element_t **ops)
 {
     int i;
-    argument = resize_tab (argument, nbops);
+    tab_t *new = alloc_tab (nbops);
     for (i = 0; i < nbops; i++) {
-        set_tab (argument, i + 1, evaluate_element (ops[i], 0));
+        double val = evaluate_element (ops[i], 0);
+        VERBOSE (DEBUG, fprintf (stdout, "value %d/%d = %g\n", i + 1, nbops, val));
+        set_tab (new, i + 1, val);
     }
-    return size_tab (argument);
+    return new;
 }
 
 /* vim: set ts=4 sw=4 et: */