add coverage tests
[calc.git] / argument.c
1 #include "parser.h"
2 #include "tabular.h"
3
4 #include "argument.h"
5
6 /* global variables */
7
8 tab_t *argument = NULL;
9
10 /* argument management */
11
12 /* get argument */
13
14 double arg (int n)
15 {
16 return get_tab (argument, n);
17 }
18
19 /* set arguments */
20
21 double def (int nbops, element_t **ops)
22 {
23 int i;
24 argument = resize_tab (argument, nbops);
25 for (i = 0; i < nbops; i++) {
26 set_tab (argument, i + 1, evaluate_element (ops[i], 0));
27 }
28 return size_tab (argument);
29 }
30
31 /* vim: set ts=4 sw=4 et: */