X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fdata-io%2Flist.q;h=b1bb9aadf05d35c3724af8453a507f8d6e23fe0c;hb=efe067379890a29af2b4ad06bf83df7a2eb4d009;hp=a79c51ada6f452e7f21baa45225377bb7ba96fec;hpb=393668423c1c9456fd82db6b30f25de078915da5;p=pspp diff --git a/src/language/data-io/list.q b/src/language/data-io/list.q index a79c51ada6..b1bb9aadf0 100644 --- a/src/language/data-io/list.q +++ b/src/language/data-io/list.q @@ -18,27 +18,30 @@ 02110-1301, USA. */ #include -#include + #include #include -#include + +#include "intprops.h" +#include "size_max.h" #include -#include -#include #include -#include "intprops.h" +#include +#include +#include +#include +#include #include -#include +#include +#include #include +#include +#include #include #include -#include -#include "size_max.h" #include +#include #include -#include -#include -#include #include "gettext.h" #define _(msgid) gettext (msgid) @@ -80,11 +83,11 @@ static unsigned n_chars_width (struct outp_driver *d); static void write_line (struct outp_driver *d, const char *s); /* Other functions. */ -static bool list_cases (struct ccase *, void *); +static bool list_cases (const struct ccase *, void *); static void determine_layout (void); static void clean_up (void); static void write_header (struct outp_driver *); -static void write_all_headers (void *); +static void write_all_headers (const struct ccase *, void *); /* Returns the number of text lines that can fit on the remainder of the page. */ @@ -237,10 +240,11 @@ cmd_list (void) /* Writes headers to all devices. This is done at the beginning of each SPLIT FILE group. */ static void -write_all_headers (void *aux UNUSED) +write_all_headers (const struct ccase *c, void *aux UNUSED) { struct outp_driver *d; + output_split_file_values (c); for (d = outp_drivers (NULL); d; d = outp_drivers (d)) { if (!d->class->special) @@ -434,6 +438,7 @@ write_fallback_headers (struct outp_driver *d) while (index < cmd.n_variables) { struct outp_text text; + int leader_width; /* Ensure that there is enough room for a line of text. */ if (d->cp_y + d->font_height > d->length) @@ -448,7 +453,8 @@ write_fallback_headers (struct outp_driver *d) text.y = d->cp_y; text.h = text.v = INT_MAX; d->class->text_draw (d, &text); - d->class->text_metrics (d, &text, &d->cp_x, NULL); + d->class->text_metrics (d, &text, &leader_width, NULL); + d->cp_x = leader_width; goto entry; do @@ -469,9 +475,10 @@ write_fallback_headers (struct outp_driver *d) } { - char varname[10]; - sprintf (varname, " %s", cmd.v_variables[index]->name); - write_varname (d, varname, text.h); + char varname[LONG_NAME_LEN + 2]; + snprintf (varname, sizeof varname, + " %s", cmd.v_variables[index]->name); + write_varname (d, varname, leader_width); } } while (++index < cmd.n_variables); @@ -602,7 +609,7 @@ determine_layout (void) /* Writes case C to output. */ static bool -list_cases (struct ccase *c, void *aux UNUSED) +list_cases (const struct ccase *c, void *aux UNUSED) { struct outp_driver *d;