projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added src/ui/terminal/automake.mk and src/ui/gui/automake.mk
[pspp]
/
src
/
print.c
diff --git
a/src/print.c
b/src/print.c
index ccbb8c8c2d69ef9579e48334fbcaaa8c456c935f..966c481395d9c924342a8fef156110677b044130 100644
(file)
--- a/
src/print.c
+++ b/
src/print.c
@@
-80,7
+80,6
@@
enum
/* PRINT, PRINT EJECT, WRITE private data structure. */
struct print_trns
{
/* PRINT, PRINT EJECT, WRITE private data structure. */
struct print_trns
{
- struct trns_header h;
struct dfm_writer *writer; /* Output file, NULL=listing file. */
int options; /* PRT_* bitmapped field. */
struct prt_out_spec *spec; /* Output specifications. */
struct dfm_writer *writer; /* Output file, NULL=listing file. */
int options; /* PRT_* bitmapped field. */
struct prt_out_spec *spec; /* Output specifications. */
@@
-141,8
+140,6
@@
internal_cmd_print (int f)
struct file_handle *fh = NULL;
/* Fill in prt to facilitate error-handling. */
struct file_handle *fh = NULL;
/* Fill in prt to facilitate error-handling. */
- prt.h.proc = print_trns_proc;
- prt.h.free = print_trns_free;
prt.writer = NULL;
prt.options = f;
prt.spec = NULL;
prt.writer = NULL;
prt.options = f;
prt.spec = NULL;
@@
-159,7
+156,7
@@
internal_cmd_print (int f)
{
lex_match ('=');
{
lex_match ('=');
- fh = fh_parse ();
+ fh = fh_parse (
FH_REF_FILE
);
if (fh == NULL)
goto error;
}
if (fh == NULL)
goto error;
}
@@
-194,7
+191,7
@@
internal_cmd_print (int f)
if (prt.writer == NULL)
goto error;
if (prt.writer == NULL)
goto error;
- if (
handle_get_mode (fh) ==
MODE_BINARY)
+ if (
fh_get_mode (fh) == FH_
MODE_BINARY)
prt.options |= PRT_BINARY;
}
prt.options |= PRT_BINARY;
}
@@
-209,12
+206,12
@@
internal_cmd_print (int f)
/* Put the transformation in the queue. */
trns = xmalloc (sizeof *trns);
memcpy (trns, &prt, sizeof *trns);
/* Put the transformation in the queue. */
trns = xmalloc (sizeof *trns);
memcpy (trns, &prt, sizeof *trns);
- add_transformation (
(struct trns_header *)
trns);
+ add_transformation (
print_trns_proc, print_trns_free,
trns);
return CMD_SUCCESS;
error:
return CMD_SUCCESS;
error:
- print_trns_free (
(struct trns_header *) &
prt);
+ print_trns_free (
&
prt);
return CMD_FAILURE;
}
return CMD_FAILURE;
}
@@
-249,8
+246,8
@@
struct fmt_list
static struct
{
struct variable **v; /* variable list */
static struct
{
struct variable **v; /* variable list */
-
int nv;
/* number of variables in list */
-
int cv;
/* number of variables from list used up so far
+
size_t nv;
/* number of variables in list */
+
size_t cv;
/* number of variables from list used up so far
by the FORTRAN-like format specifiers */
int recno; /* current 1-based record number */
by the FORTRAN-like format specifiers */
int recno; /* current 1-based record number */
@@
-452,7
+449,7
@@
parse_variable_argument (void)
else
{
/* User wants dictionary format specifiers. */
else
{
/* User wants dictionary format specifiers. */
-
in
t i;
+
size_
t i;
lex_match ('*');
for (i = 0; i < fx.nv; i++)
lex_match ('*');
for (i = 0; i < fx.nv; i++)
@@
-500,9
+497,9
@@
check_string_width (const struct fmt_spec *format, const struct variable *v)
static int
fixed_parse_compatible (void)
{
static int
fixed_parse_compatible (void)
{
- int
dividend
;
+ int
individual_var_width
;
int type;
int type;
-
in
t i;
+
size_
t i;
type = fx.v[0]->type;
for (i = 1; i < fx.nv; i++)
type = fx.v[0]->type;
for (i = 1; i < fx.nv; i++)
@@
-610,13
+607,14
@@
fixed_parse_compatible (void)
if ((fx.lc - fx.fc + 1) % fx.nv)
{
if ((fx.lc - fx.fc + 1) % fx.nv)
{
- msg (SE, _("The %d columns %d-%d can't be evenly divided into %d "
- "fields."), fx.lc - fx.fc + 1, fx.fc + 1, fx.lc + 1, fx.nv);
+ msg (SE, _("The %d columns %d-%d can't be evenly divided into %u "
+ "fields."),
+ fx.lc - fx.fc + 1, fx.fc + 1, fx.lc + 1, (unsigned) fx.nv);
return 0;
}
return 0;
}
-
dividend
= (fx.lc - fx.fc + 1) / fx.nv;
- fx.spec.u.v.f.w =
dividend
;
+
individual_var_width
= (fx.lc - fx.fc + 1) / fx.nv;
+ fx.spec.u.v.f.w =
individual_var_width
;
if (!check_output_specifier (&fx.spec.u.v.f, true)
|| !check_specifier_type (&fx.spec.u.v.f, type, true))
return 0;
if (!check_output_specifier (&fx.spec.u.v.f, true)
|| !check_specifier_type (&fx.spec.u.v.f, type, true))
return 0;
@@
-630,7
+628,7
@@
fixed_parse_compatible (void)
fx.spec.type = PRT_VAR;
for (i = 0; i < fx.nv; i++)
{
fx.spec.type = PRT_VAR;
for (i = 0; i < fx.nv; i++)
{
- fx.spec.fc = fx.fc +
dividend
* i;
+ fx.spec.fc = fx.fc +
individual_var_width
* i;
fx.spec.u.v.v = fx.v[i];
append_var_spec (&fx.spec);
}
fx.spec.u.v.v = fx.v[i];
append_var_spec (&fx.spec);
}
@@
-639,7
+637,7
@@
fixed_parse_compatible (void)
/* Destroy a format list and, optionally, all its sublists. */
static void
/* Destroy a format list and, optionally, all its sublists. */
static void
-destroy_fmt_list (struct fmt_list *
f, int recurse)
+destroy_fmt_list (struct fmt_list *f, int recurse)
{
struct fmt_list *next;
{
struct fmt_list *next;
@@
-656,7
+654,7
@@
destroy_fmt_list (struct fmt_list * f, int recurse)
FORTRAN-like format specifications, like 4(F10,2X)) into the
structure prt. */
static int
FORTRAN-like format specifications, like 4(F10,2X)) into the
structure prt. */
static int
-dump_fmt_list (struct fmt_list *
f)
+dump_fmt_list (struct fmt_list *f)
{
int i;
{
int i;
@@
-838,10
+836,12
@@
dump_table (const struct file_handle *fh)
}
if (fh != NULL)
}
if (fh != NULL)
- tab_title (t, 1, _("Writing %d record(s) to file %s."),
- recno, handle_get_filename (fh));
+ tab_title (t, 1, ngettext ("Writing %d record to %s.",
+ "Writing %d records to %s.", recno),
+ recno, fh_get_name (fh));
else
else
- tab_title (t, 1, _("Writing %d record(s) to the listing file."), recno);
+ tab_title (t, 1, ngettext ("Writing %d record.",
+ "Writing %d records.", recno), recno);
tab_submit (t);
}
tab_submit (t);
}
@@
-898,11
+898,10
@@
alloc_line (void)
/* Performs the transformation inside print_trns T on case C. */
static int
/* Performs the transformation inside print_trns T on case C. */
static int
-print_trns_proc (struct trns_header * trns, struct ccase * c,
- int case_num UNUSED)
+print_trns_proc (void *trns_, struct ccase *c, int case_num UNUSED)
{
/* Transformation. */
{
/* Transformation. */
- struct print_trns *t =
(struct print_trns *) trns
;
+ struct print_trns *t =
trns_
;
/* Iterator. */
struct prt_out_spec *i;
/* Iterator. */
struct prt_out_spec *i;
@@
-975,9
+974,9
@@
print_trns_proc (struct trns_header * trns, struct ccase * c,
/* Frees all the data inside print_trns T. Does not free T. */
static void
/* Frees all the data inside print_trns T. Does not free T. */
static void
-print_trns_free (
struct trns_header * t
)
+print_trns_free (
void *prt_
)
{
{
- struct print_trns *prt =
(struct print_trns *) t
;
+ struct print_trns *prt =
prt_
;
struct prt_out_spec *i, *n;
for (i = prt->spec; i; i = n)
struct prt_out_spec *i, *n;
for (i = prt->spec; i; i = n)
@@
-1002,6
+1001,7
@@
print_trns_free (struct trns_header * t)
if (prt->writer != NULL)
dfm_close_writer (prt->writer);
free (prt->line);
if (prt->writer != NULL)
dfm_close_writer (prt->writer);
free (prt->line);
+ free (prt);
}
\f
/* PRINT SPACE. */
}
\f
/* PRINT SPACE. */
@@
-1009,8
+1009,6
@@
print_trns_free (struct trns_header * t)
/* PRINT SPACE transformation. */
struct print_space_trns
{
/* PRINT SPACE transformation. */
struct print_space_trns
{
- struct trns_header h;
-
struct dfm_writer *writer; /* Output data file. */
struct expression *e; /* Number of lines; NULL=1. */
}
struct dfm_writer *writer; /* Output data file. */
struct expression *e; /* Number of lines; NULL=1. */
}
@@
-1031,7
+1029,7
@@
cmd_print_space (void)
{
lex_match ('=');
{
lex_match ('=');
- fh = fh_parse ();
+ fh = fh_parse (
FH_REF_FILE
);
if (fh == NULL)
return CMD_FAILURE;
lex_get ();
if (fh == NULL)
return CMD_FAILURE;
lex_get ();
@@
-1065,23
+1063,18
@@
cmd_print_space (void)
writer = NULL;
t = xmalloc (sizeof *t);
writer = NULL;
t = xmalloc (sizeof *t);
- t->h.proc = print_space_trns_proc;
- if (e)
- t->h.free = print_space_trns_free;
- else
- t->h.free = NULL;
t->writer = writer;
t->e = e;
t->writer = writer;
t->e = e;
- add_transformation (
(struct trns_header *)
t);
+ add_transformation (
print_space_trns_proc, print_space_trns_free,
t);
return CMD_SUCCESS;
}
static int
return CMD_SUCCESS;
}
static int
-print_space_trns_proc (
struct trns_header * trns, struct ccase *
c,
+print_space_trns_proc (
void *t_, struct ccase *
c,
int case_num UNUSED)
{
int case_num UNUSED)
{
- struct print_space_trns *t =
(struct print_space_trns *) trns
;
+ struct print_space_trns *t =
t_
;
double n = 1.;
if (t->e)
double n = 1.;
if (t->e)
@@
-1117,7
+1110,9
@@
print_space_trns_proc (struct trns_header * trns, struct ccase * c,
}
static void
}
static void
-print_space_trns_free (
struct trns_header * trns
)
+print_space_trns_free (
void *trns_
)
{
{
- expr_free (((struct print_space_trns *) trns)->e);
+ struct print_space_trns *trns = trns_;
+ expr_free (trns->e);
+ free (trns);
}
}