VERBOSE (WARNING, fprintf (stdout, "error unknown program (%d)\n", id));
return 0;
}
- VERBOSE (DEBUG, fprintf (stdout, "id -> n; %d -> %d\n", id, n));
/* set arguments */
- free_tab (argument);
- argument = NULL;
- VERBOSE (DEBUG, fprintf (stdout, "nbargs; %d\n", nbargs));
- if (nbargs > 0) {
- def (nbargs, args);
- }
+ tab_t *old_argument = copy_tab (argument);
/* backup context */
workspace_t *tmp = backup_ws (alloc_ws ());
restore_ws (programs[n]);
+ /* set arguments */
+ argument = def (nbargs, args);
+
/* evaluate program */
answer = 0;
element_t *elements = dupelement (programs[n]->root);
VERBOSE (DEBUG, fprintf (stdout, "ret; %g\n", ret));
delelement (elements);
- /* clean arguments */
- free_tab (argument);
- argument = NULL;
-
/* restore context */
backup_ws (programs[n]);
restore_ws (tmp);
free_ws (tmp);
+ /* clean arguments */
+ free_tab (argument);
+ argument = old_argument;
+
return ret;
}