X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fdictionary%2Fsys-file-info.c;h=b2e016ae149d0288b12dc669b09009b00c40fe1b;hb=e070d7ddf78446b9852c61c9af84ad3659bac3b3;hp=0234b833ca9fed36b8ff70336df5790dab740161;hpb=dcf9b154cbcaa35c3d8459a201b77eec8bcb30bd;p=pspp-builds.git diff --git a/src/language/dictionary/sys-file-info.c b/src/language/dictionary/sys-file-info.c index 0234b833..b2e016ae 100644 --- a/src/language/dictionary/sys-file-info.c +++ b/src/language/dictionary/sys-file-info.c @@ -18,25 +18,30 @@ 02110-1301, USA. */ #include -#include "message.h" + #include #include -#include "array.h" -#include "alloc.h" -#include "command.h" -#include "dictionary.h" -#include "message.h" -#include "file-handle-def.h" -#include "hash.h" -#include "lexer.h" -#include "magic.h" -#include "misc.h" -#include "output.h" -#include "sys-file-reader.h" -#include "manager.h" -#include "table.h" -#include "value-labels.h" -#include "variable.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "gettext.h" #define _(msgid) gettext (msgid) @@ -73,7 +78,7 @@ sysfile_info_dim (struct tab_table *t, struct outp_driver *d) /* SYSFILE INFO utility. */ int -cmd_sysfile_info (void) +cmd_sysfile_info (struct dataset *ds UNUSED) { struct file_handle *h; struct dictionary *d; @@ -96,9 +101,9 @@ cmd_sysfile_info (void) sfm_close_reader (reader); t = tab_create (2, 9, 0); - tab_vline (t, TAL_1 | TAL_SPACING, 1, 0, 8); + tab_vline (t, TAL_GAP, 1, 0, 8); tab_text (t, 0, 0, TAB_LEFT, _("File:")); - tab_text (t, 1, 0, TAB_LEFT, fh_get_filename (h)); + tab_text (t, 1, 0, TAB_LEFT, fh_get_file_name (h)); tab_text (t, 0, 1, TAB_LEFT, _("Label:")); { const char *label = dict_get_label (d); @@ -171,12 +176,12 @@ cmd_sysfile_info (void) /* DISPLAY utility. */ static void display_macros (void); -static void display_documents (void); +static void display_documents (const struct dictionary *dict); static void display_variables (struct variable **, size_t, int); -static void display_vectors (int sorted); +static void display_vectors (const struct dictionary *dict, int sorted); int -cmd_display (void) +cmd_display (struct dataset *ds) { /* Whether to sort the list of variables alphabetically. */ int sorted; @@ -188,19 +193,19 @@ cmd_display (void) if (lex_match_id ("MACROS")) display_macros (); else if (lex_match_id ("DOCUMENTS")) - display_documents (); + display_documents (dataset_dict (ds)); else if (lex_match_id ("FILE")) { som_blank_line (); if (!lex_force_match_id ("LABEL")) return CMD_FAILURE; - if (dict_get_label (default_dict) == NULL) + if (dict_get_label (dataset_dict (ds)) == NULL) tab_output_text (TAB_LEFT, _("The active file does not have a file label.")); else { tab_output_text (TAB_LEFT | TAT_TITLE, _("File label:")); - tab_output_text (TAB_LEFT | TAT_FIX, dict_get_label (default_dict)); + tab_output_text (TAB_LEFT | TAB_FIX, dict_get_label (dataset_dict (ds))); } } else @@ -226,7 +231,7 @@ cmd_display (void) if (as == AS_VECTOR) { - display_vectors (sorted); + display_vectors (dataset_dict(ds), sorted); return CMD_SUCCESS; } @@ -236,7 +241,7 @@ cmd_display (void) if (token != '.') { - if (!parse_variables (default_dict, &vl, &n, PV_NONE)) + if (!parse_variables (dataset_dict (ds), &vl, &n, PV_NONE)) { free (vl); return CMD_FAILURE; @@ -244,7 +249,7 @@ cmd_display (void) as = AS_DICTIONARY; } else - dict_get_vars (default_dict, &vl, &n, 0); + dict_get_vars (dataset_dict (ds), &vl, &n, 0); if (as == AS_SCRATCH) { @@ -284,9 +289,9 @@ display_macros (void) } static void -display_documents (void) +display_documents (const struct dictionary *dict) { - const char *documents = dict_get_documents (default_dict); + const char *documents = dict_get_documents (dict); som_blank_line (); if (documents == NULL) @@ -311,7 +316,7 @@ display_documents (void) && len > 0) len--; buf[len + 1] = 0; - tab_output_text (TAB_LEFT | TAT_FIX | TAT_NOWRAP, buf); + tab_output_text (TAB_LEFT | TAB_FIX | TAT_NOWRAP, buf); } } } @@ -478,11 +483,11 @@ describe_variable (struct variable *v, struct tab_table *t, int r, int as) double x, y; mv_pop_range (&mv, &x, &y); if (x == LOWEST) - cp += nsprintf (cp, "LOWEST THRU %g", y); + cp += sprintf (cp, "LOWEST THRU %g", y); else if (y == HIGHEST) - cp += nsprintf (cp, "%g THRU HIGHEST", x); + cp += sprintf (cp, "%g THRU HIGHEST", x); else - cp += nsprintf (cp, "%g THRU %g", x, y); + cp += sprintf (cp, "%g THRU %g", x, y); cnt++; } while (mv_has_value (&mv)) @@ -490,9 +495,9 @@ describe_variable (struct variable *v, struct tab_table *t, int r, int as) union value value; mv_pop_value (&mv, &value); if (cnt++ > 0) - cp += nsprintf (cp, "; "); + cp += sprintf (cp, "; "); if (v->type == NUMERIC) - cp += nsprintf (cp, "%g", value.f); + cp += sprintf (cp, "%g", value.f); else { *cp++ = '"'; @@ -562,14 +567,14 @@ compare_vectors_by_name (const void *a_, const void *b_) /* Display a list of vectors. If SORTED is nonzero then they are sorted alphabetically. */ static void -display_vectors (int sorted) +display_vectors (const struct dictionary *dict, int sorted) { const struct vector **vl; int i; struct tab_table *t; size_t nvec; - nvec = dict_get_vector_cnt (default_dict); + nvec = dict_get_vector_cnt (dict); if (nvec == 0) { msg (SW, _("No vectors defined.")); @@ -578,7 +583,7 @@ display_vectors (int sorted) vl = xnmalloc (nvec, sizeof *vl); for (i = 0; i < nvec; i++) - vl[i] = dict_get_vector (default_dict, i); + vl[i] = dict_get_vector (dict, i); if (sorted) qsort (vl, nvec, sizeof *vl, compare_vectors_by_name);