X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flist.q;h=c2f3cd61e3e95b3bae92cd6cab2e5bceb6cbe358;hb=92fb12eb06716d14c05b781f5d9dcde956d77c30;hp=3add8de152e8bd9ef05744ab26020eb3df15e107;hpb=1339492699ce7e12c9bf9fa17f9d60a66024cbd1;p=pspp diff --git a/src/list.q b/src/list.q index 3add8de152..c2f3cd61e3 100644 --- a/src/list.q +++ b/src/list.q @@ -24,7 +24,6 @@ #include "alloc.h" #include "case.h" #include "command.h" -#include "devind.h" #include "dictionary.h" #include "lexer.h" #include "error.h" @@ -32,11 +31,16 @@ #include "misc.h" #include "htmlP.h" #include "output.h" +#include "size_max.h" #include "som.h" #include "tab.h" #include "var.h" #include "vfm.h" #include "format.h" + +#include "gettext.h" +#define _(msgid) gettext (msgid) + /* (headers) */ #include "debug-print.h" @@ -56,8 +60,8 @@ struct list_ext { int type; /* 0=Values and labels fit across the page. */ - int n_vertical; /* Number of labels to list vertically. */ - int header_rows; /* Number of header rows. */ + size_t n_vertical; /* Number of labels to list vertically. */ + size_t header_rows; /* Number of header rows. */ char **header; /* The header itself. */ }; @@ -71,8 +75,8 @@ static int case_idx; static char *line_buf; /* TTY-style output functions. */ -static int n_lines_remaining (struct outp_driver *d); -static int n_chars_width (struct outp_driver *d); +static unsigned n_lines_remaining (struct outp_driver *d); +static unsigned n_chars_width (struct outp_driver *d); static void write_line (struct outp_driver *d, char *s); /* Other functions. */ @@ -84,7 +88,7 @@ static void write_all_headers (void *); /* Returns the number of text lines that can fit on the remainder of the page. */ -static inline int +static inline unsigned n_lines_remaining (struct outp_driver *d) { int diff; @@ -95,7 +99,7 @@ n_lines_remaining (struct outp_driver *d) /* Returns the number of fixed-width character that can fit across the page. */ -static inline int +static inline unsigned n_chars_width (struct outp_driver *d) { return d->width / d->fixed_width; @@ -177,7 +181,7 @@ cmd_list (void) { if (dict_get_weight (default_dict) != NULL) { - int i; + size_t i; for (i = 0; i < cmd.n_variables; i++) if (cmd.v_variables[i] == dict_get_weight (default_dict)) @@ -186,9 +190,8 @@ cmd_list (void) { /* Add the weight variable to the end of the variable list. */ cmd.n_variables++; - cmd.v_variables = xrealloc (cmd.v_variables, - (cmd.n_variables - * sizeof *cmd.v_variables)); + cmd.v_variables = xnrealloc (cmd.v_variables, cmd.n_variables, + sizeof *cmd.v_variables); cmd.v_variables[cmd.n_variables - 1] = dict_get_weight (default_dict); } @@ -204,14 +207,14 @@ cmd_list (void) strcpy (casenum_var.name, "Case#"); casenum_var.type = NUMERIC; casenum_var.fv = -1; - casenum_var.print.type = FMT_F; - casenum_var.print.w = (cmd.last == LONG_MAX ? 5 : intlog10 (cmd.last)); - casenum_var.print.d = 0; + casenum_var.print = make_output_format (FMT_F, + (cmd.last == LONG_MAX + ? 5 : intlog10 (cmd.last)), 0); /* Add the weight variable at the beginning of the variable list. */ cmd.n_variables++; - cmd.v_variables = xrealloc (cmd.v_variables, - cmd.n_variables * sizeof *cmd.v_variables); + cmd.v_variables = xnrealloc (cmd.v_variables, + cmd.n_variables, sizeof *cmd.v_variables); memmove (&cmd.v_variables[1], &cmd.v_variables[0], (cmd.n_variables - 1) * sizeof *cmd.v_variables); cmd.v_variables[0] = &casenum_var; @@ -257,7 +260,7 @@ write_all_headers (void *aux UNUSED) fputs ("
%s | \n", @@ -266,10 +269,6 @@ write_all_headers (void *aux UNUSED) fputs ("
---|