X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fexpr-prs.c;h=183d5b0f3fb30167f447b9851622bafa5358aad1;hb=f9ce8d75ae81553d9aec05351cb2d12d0df33e5e;hp=a6a4a7d680c8bb4d2f870e2057306b8dd0e70c40;hpb=b9e28aa5614a079548c616bcf97aa804024ad647;p=pspp diff --git a/src/expr-prs.c b/src/expr-prs.c index a6a4a7d680..183d5b0f3f 100644 --- a/src/expr-prs.c +++ b/src/expr-prs.c @@ -18,6 +18,7 @@ 02111-1307, USA. */ #include +#include "dictionary.h" #include "expr.h" #include "exprP.h" #include "error.h" @@ -60,10 +61,6 @@ static int type_check (union any_node **n, static algo_compare_func compare_functions; static void init_func_tab (void); - -#if DEBUGGING -static void debug_print_tree (union any_node *, int); -#endif /* Public functions. */ @@ -615,7 +612,7 @@ parse_primary (union any_node **n) case T_STRING: { - *n = allocate_str_con (ds_value (&tokstr), ds_length (&tokstr)); + *n = allocate_str_con (ds_c_str (&tokstr), ds_length (&tokstr)); lex_get (); return EXPR_STRING; } @@ -1223,7 +1220,7 @@ parse_function (union any_node ** n) } ds_truncate (&tokstr, 31); - strcpy (fname, ds_value (&tokstr)); + strcpy (fname, ds_c_str (&tokstr)); cp = strrchr (fname, '.'); if (cp && isdigit ((unsigned char) cp[1])) { @@ -1519,84 +1516,6 @@ init_func_tab (void) /* Debug output. */ -#if DEBUGGING -static void -print_type (union any_node * n) -{ - const char *s; - size_t len; - - s = ops[n->type].name; - len = strlen (s); - if (ops[n->type].flags & OP_MIN_ARGS) - printf ("%s.%d\n", s, (int) n->nonterm.arg[n->nonterm.n]); - else if (ops[n->type].flags & OP_FMT_SPEC) - { - struct fmt_spec f; - - f.type = (int) n->nonterm.arg[n->nonterm.n + 0]; - f.w = (int) n->nonterm.arg[n->nonterm.n + 1]; - f.d = (int) n->nonterm.arg[n->nonterm.n + 2]; - printf ("%s(%s)\n", s, fmt_to_string (&f)); - } - else - printf ("%s\n", s); -} - -static void -debug_print_tree (union any_node * n, int level) -{ - int i; - for (i = 0; i < level; i++) - printf (" "); - if (n->type < OP_TERMINAL) - { - print_type (n); - for (i = 0; i < n->nonterm.n; i++) - debug_print_tree (n->nonterm.arg[i], level + 1); - } - else - { - switch (n->type) - { - case OP_TERMINAL: - printf (_("!!TERMINAL!!")); - break; - case OP_NUM_CON: - if (n->num_con.value == SYSMIS) - printf ("SYSMIS"); - else - printf ("%f", n->num_con.value); - break; - case OP_STR_CON: - printf ("\"%.*s\"", n->str_con.len, n->str_con.s); - break; - case OP_NUM_VAR: - case OP_STR_VAR: - printf ("%s", n->var.v->name); - break; - case OP_NUM_LAG: - case OP_STR_LAG: - printf ("LAG(%s,%d)", n->lag.v->name, n->lag.lag); - break; - case OP_NUM_SYS: - printf ("SYSMIS(%s)", n->var.v->name); - break; - case OP_NUM_VAL: - printf ("VALUE(%s)", n->var.v->name); - break; - case OP_SENTINEL: - printf (_("!!SENTINEL!!")); - break; - default: - printf (_("!!ERROR%d!!"), n->type); - assert (0); - } - printf ("\n"); - } -} -#endif /* DEBUGGING */ - void expr_debug_print_postfix (const struct expression *e) {