projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
intern: Use UP_CAST macro instad of open-coding it.
[pspp]
/
src
/
language
/
dictionary
/
sys-file-info.c
diff --git
a/src/language/dictionary/sys-file-info.c
b/src/language/dictionary/sys-file-info.c
index 952930b5bad39332d0b1f70d5e76e706568ba930..7653e046bd7ea4b5f361f4eae47957fab5eff422 100644
(file)
--- a/
src/language/dictionary/sys-file-info.c
+++ b/
src/language/dictionary/sys-file-info.c
@@
-21,11
+21,11
@@
#include "data/attributes.h"
#include "data/casereader.h"
#include "data/attributes.h"
#include "data/casereader.h"
+#include "data/dataset.h"
#include "data/dictionary.h"
#include "data/file-handle-def.h"
#include "data/format.h"
#include "data/missing-values.h"
#include "data/dictionary.h"
#include "data/file-handle-def.h"
#include "data/format.h"
#include "data/missing-values.h"
-#include "data/procedure.h"
#include "data/sys-file-reader.h"
#include "data/value-labels.h"
#include "data/variable.h"
#include "data/sys-file-reader.h"
#include "data/value-labels.h"
#include "data/variable.h"
@@
-37,6
+37,7
@@
#include "libpspp/array.h"
#include "libpspp/message.h"
#include "libpspp/misc.h"
#include "libpspp/array.h"
#include "libpspp/message.h"
#include "libpspp/misc.h"
+#include "libpspp/string-array.h"
#include "output/tab.h"
#include "gl/minmax.h"
#include "output/tab.h"
#include "gl/minmax.h"
@@
-163,7
+164,7
@@
cmd_sysfile_info (struct lexer *lexer, struct dataset *ds UNUSED)
dict_destroy (d);
fh_unref (h);
dict_destroy (d);
fh_unref (h);
- return
lex_end_of_command (lexer)
;
+ return
CMD_SUCCESS
;
}
\f
/* DISPLAY utility. */
}
\f
/* DISPLAY utility. */
@@
-194,7
+195,7
@@
cmd_display (struct lexer *lexer, struct dataset *ds)
return CMD_FAILURE;
if (dict_get_label (dataset_dict (ds)) == NULL)
tab_output_text (TAB_LEFT,
return CMD_FAILURE;
if (dict_get_label (dataset_dict (ds)) == NULL)
tab_output_text (TAB_LEFT,
- _("The active
file
does not have a file label."));
+ _("The active
dataset
does not have a file label."));
else
{
tab_output_text (TAB_LEFT | TAT_TITLE, _("File label:"));
else
{
tab_output_text (TAB_LEFT | TAT_TITLE, _("File label:"));
@@
-210,7
+211,7
@@
cmd_display (struct lexer *lexer, struct dataset *ds)
if (lex_match_id (lexer, "VECTORS"))
{
display_vectors (dataset_dict(ds), sorted);
if (lex_match_id (lexer, "VECTORS"))
{
display_vectors (dataset_dict(ds), sorted);
- return
lex_end_of_command (lexer)
;
+ return
CMD_SUCCESS
;
}
else if (lex_match_id (lexer, "SCRATCH"))
{
}
else if (lex_match_id (lexer, "SCRATCH"))
{
@@
-280,7
+281,7
@@
cmd_display (struct lexer *lexer, struct dataset *ds)
flags);
}
flags);
}
- return
lex_end_of_command (lexer)
;
+ return
CMD_SUCCESS
;
}
static void
}
static void
@@
-292,24
+293,19
@@
display_macros (void)
static void
display_documents (const struct dictionary *dict)
{
static void
display_documents (const struct dictionary *dict)
{
- const
char
*documents = dict_get_documents (dict);
+ const
struct string_array
*documents = dict_get_documents (dict);
- if (
documents == NULL
)
- tab_output_text (TAB_LEFT, _("The active
file
dictionary does not "
+ if (
string_array_is_empty (documents)
)
+ tab_output_text (TAB_LEFT, _("The active
dataset
dictionary does not "
"contain any documents."));
else
{
"contain any documents."));
else
{
- struct string line = DS_EMPTY_INITIALIZER;
size_t i;
tab_output_text (TAB_LEFT | TAT_TITLE,
size_t i;
tab_output_text (TAB_LEFT | TAT_TITLE,
- _("Documents in the active
file
:"));
+ _("Documents in the active
dataset
:"));
for (i = 0; i < dict_get_document_line_cnt (dict); i++)
for (i = 0; i < dict_get_document_line_cnt (dict); i++)
- {
- dict_get_document_line (dict, i, &line);
- tab_output_text (TAB_LEFT | TAB_FIX, ds_cstr (&line));
- }
- ds_destroy (&line);
+ tab_output_text (TAB_LEFT | TAB_FIX, dict_get_document_line (dict, i));
}
}
}
}
@@
-588,18
+584,8
@@
describe_variable (const struct variable *v, struct tab_table *t, int r,
for (i = 0; i < n_labels; i++)
{
const struct val_lab *vl = labels[i];
for (i = 0; i < n_labels; i++)
{
const struct val_lab *vl = labels[i];
- char buf[MAX_STRING + 1];
-
- if (var_is_alpha (v))
- {
- int width = var_get_width (v);
- memcpy (buf, value_str (&vl->value, width), width);
- buf[width] = 0;
- }
- else
- sprintf (buf, "%g", vl->value.f);
- tab_
text (t, 1, r, TAB_NONE, buf
);
+ tab_
value (t, 1, r, TAB_NONE, &vl->value, v, NULL
);
tab_text (t, 2, r, TAB_LEFT, val_lab_get_label (vl));
r++;
}
tab_text (t, 2, r, TAB_LEFT, val_lab_get_label (vl));
r++;
}