X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flist.q;h=e3ac2ed52e853e27cff9877afc37e6e7659dafda;hb=29c51e39acf3554a56aa2adc9451cc5fd70318ae;hp=10d2baad38df3999a9b458222781eda4dc78604c;hpb=74a57f26f1458b28a0fddbb9f46004ac8f4d9c30;p=pspp-builds.git diff --git a/src/list.q b/src/list.q index 10d2baad..e3ac2ed5 100644 --- a/src/list.q +++ b/src/list.q @@ -18,12 +18,14 @@ 02111-1307, USA. */ #include -#include +#include "error.h" #include #include #include "alloc.h" +#include "case.h" #include "command.h" #include "devind.h" +#include "dictionary.h" #include "lexer.h" #include "error.h" #include "magic.h" @@ -35,13 +37,10 @@ #include "var.h" #include "vfm.h" #include "format.h" +/* (headers) */ #include "debug-print.h" -#if DEBUGGING -static void debug_print (void); -#endif - /* (specification) list (lst_): *variables=varlist("PV_NO_SCRATCH"); @@ -66,7 +65,7 @@ struct list_ext static struct cmd_list cmd; /* Current case number. */ -static int case_num; +static int case_idx; /* Line buffer. */ static char *line_buf; @@ -218,14 +217,9 @@ cmd_list (void) cmd.v_variables[0] = &casenum_var; } -#if DEBUGGING - /* Print out command. */ - debug_print (); -#endif - determine_layout (); - case_num = 0; + case_idx = 0; procedure_with_splits (write_all_headers, list_cases, NULL, NULL); free (line_buf); @@ -621,9 +615,9 @@ list_cases (struct ccase *c, void *aux UNUSED) { struct outp_driver *d; - case_num++; - if (case_num < cmd.first || case_num > cmd.last - || (cmd.step != 1 && (case_num - cmd.first) % cmd.step)) + case_idx++; + if (case_idx < cmd.first || case_idx > cmd.last + || (cmd.step != 1 && (case_idx - cmd.first) % cmd.step)) return 1; for (d = outp_drivers (NULL); d; d = outp_drivers (d)) @@ -670,12 +664,12 @@ list_cases (struct ccase *c, void *aux UNUSED) } if ((formats[v->print.type].cat & FCAT_STRING) || v->fv != -1) - data_out (&line_buf[x], &v->print, &c->data[v->fv]); + data_out (&line_buf[x], &v->print, case_data (c, v->fv)); else { - union value case_num_value; - case_num_value.f = case_num; - data_out (&line_buf[x], &v->print, &case_num_value); + union value case_idx_value; + case_idx_value.f = case_idx; + data_out (&line_buf[x], &v->print, &case_idx_value); } x += v->print.w; @@ -704,12 +698,12 @@ list_cases (struct ccase *c, void *aux UNUSED) char buf[41]; if ((formats[v->print.type].cat & FCAT_STRING) || v->fv != -1) - data_out (buf, &v->print, &c->data[v->fv]); + data_out (buf, &v->print, case_data (c, v->fv)); else { - union value case_num_value; - case_num_value.f = case_num; - data_out (buf, &v->print, &case_num_value); + union value case_idx_value; + case_idx_value.f = case_idx; + data_out (buf, &v->print, &case_idx_value); } buf[v->print.w] = 0; @@ -728,45 +722,6 @@ list_cases (struct ccase *c, void *aux UNUSED) return 1; } - -/* Debugging output. */ - -#if DEBUGGING -/* Prints out the command as parsed by cmd_list(). */ -static void -debug_print (void) -{ - int i; - - puts ("LIST"); - printf (" VARIABLES="); - for (i = 0; i < cmd.n_variables; i++) - { - if (i) - putc (' ', stdout); - fputs (cmd.v_variables[i]->name, stdout); - } - - printf ("\n /CASES=FROM %ld TO %ld BY %ld\n", cmd.first, cmd.last, cmd.step); - - fputs (" /FORMAT=", stdout); - if (cmd.numbering == LST_NUMBERED) - fputs ("NUMBERED", stdout); - else - fputs ("UNNUMBERED", stdout); - putc (' ', stdout); - if (cmd.wrap == LST_WRAP) - fputs ("WRAP", stdout); - else - fputs ("SINGLE", stdout); - putc (' ', stdout); - if (cmd.weight == LST_WEIGHT) - fputs ("WEIGHT", stdout); - else - fputs ("NOWEIGHT", stdout); - puts ("."); -} -#endif /* DEBUGGING */ /* Local Variables: