80 |
/* PRINT, PRINT EJECT, WRITE private data structure. */ |
/* PRINT, PRINT EJECT, WRITE private data structure. */ |
81 |
struct print_trns |
struct print_trns |
82 |
{ |
{ |
|
struct trns_header h; |
|
83 |
struct dfm_writer *writer; /* Output file, NULL=listing file. */ |
struct dfm_writer *writer; /* Output file, NULL=listing file. */ |
84 |
int options; /* PRT_* bitmapped field. */ |
int options; /* PRT_* bitmapped field. */ |
85 |
struct prt_out_spec *spec; /* Output specifications. */ |
struct prt_out_spec *spec; /* Output specifications. */ |
140 |
struct file_handle *fh = NULL; |
struct file_handle *fh = NULL; |
141 |
|
|
142 |
/* Fill in prt to facilitate error-handling. */ |
/* Fill in prt to facilitate error-handling. */ |
|
prt.h.proc = print_trns_proc; |
|
|
prt.h.free = print_trns_free; |
|
143 |
prt.writer = NULL; |
prt.writer = NULL; |
144 |
prt.options = f; |
prt.options = f; |
145 |
prt.spec = NULL; |
prt.spec = NULL; |
206 |
/* Put the transformation in the queue. */ |
/* Put the transformation in the queue. */ |
207 |
trns = xmalloc (sizeof *trns); |
trns = xmalloc (sizeof *trns); |
208 |
memcpy (trns, &prt, sizeof *trns); |
memcpy (trns, &prt, sizeof *trns); |
209 |
add_transformation ((struct trns_header *) trns); |
add_transformation (print_trns_proc, print_trns_free, trns); |
210 |
|
|
211 |
return CMD_SUCCESS; |
return CMD_SUCCESS; |
212 |
|
|
213 |
error: |
error: |
214 |
print_trns_free ((struct trns_header *) & prt); |
print_trns_free (&prt); |
215 |
return CMD_FAILURE; |
return CMD_FAILURE; |
216 |
} |
} |
217 |
|
|
637 |
|
|
638 |
/* Destroy a format list and, optionally, all its sublists. */ |
/* Destroy a format list and, optionally, all its sublists. */ |
639 |
static void |
static void |
640 |
destroy_fmt_list (struct fmt_list * f, int recurse) |
destroy_fmt_list (struct fmt_list *f, int recurse) |
641 |
{ |
{ |
642 |
struct fmt_list *next; |
struct fmt_list *next; |
643 |
|
|
654 |
FORTRAN-like format specifications, like 4(F10,2X)) into the |
FORTRAN-like format specifications, like 4(F10,2X)) into the |
655 |
structure prt. */ |
structure prt. */ |
656 |
static int |
static int |
657 |
dump_fmt_list (struct fmt_list * f) |
dump_fmt_list (struct fmt_list *f) |
658 |
{ |
{ |
659 |
int i; |
int i; |
660 |
|
|
896 |
|
|
897 |
/* Performs the transformation inside print_trns T on case C. */ |
/* Performs the transformation inside print_trns T on case C. */ |
898 |
static int |
static int |
899 |
print_trns_proc (struct trns_header * trns, struct ccase * c, |
print_trns_proc (void *trns_, struct ccase *c, int case_num UNUSED) |
|
int case_num UNUSED) |
|
900 |
{ |
{ |
901 |
/* Transformation. */ |
/* Transformation. */ |
902 |
struct print_trns *t = (struct print_trns *) trns; |
struct print_trns *t = trns_; |
903 |
|
|
904 |
/* Iterator. */ |
/* Iterator. */ |
905 |
struct prt_out_spec *i; |
struct prt_out_spec *i; |
972 |
|
|
973 |
/* Frees all the data inside print_trns T. Does not free T. */ |
/* Frees all the data inside print_trns T. Does not free T. */ |
974 |
static void |
static void |
975 |
print_trns_free (struct trns_header * t) |
print_trns_free (void *prt_) |
976 |
{ |
{ |
977 |
struct print_trns *prt = (struct print_trns *) t; |
struct print_trns *prt = prt_; |
978 |
struct prt_out_spec *i, *n; |
struct prt_out_spec *i, *n; |
979 |
|
|
980 |
for (i = prt->spec; i; i = n) |
for (i = prt->spec; i; i = n) |
999 |
if (prt->writer != NULL) |
if (prt->writer != NULL) |
1000 |
dfm_close_writer (prt->writer); |
dfm_close_writer (prt->writer); |
1001 |
free (prt->line); |
free (prt->line); |
1002 |
|
free (prt); |
1003 |
} |
} |
1004 |
|
|
1005 |
/* PRINT SPACE. */ |
/* PRINT SPACE. */ |
1007 |
/* PRINT SPACE transformation. */ |
/* PRINT SPACE transformation. */ |
1008 |
struct print_space_trns |
struct print_space_trns |
1009 |
{ |
{ |
|
struct trns_header h; |
|
|
|
|
1010 |
struct dfm_writer *writer; /* Output data file. */ |
struct dfm_writer *writer; /* Output data file. */ |
1011 |
struct expression *e; /* Number of lines; NULL=1. */ |
struct expression *e; /* Number of lines; NULL=1. */ |
1012 |
} |
} |
1061 |
writer = NULL; |
writer = NULL; |
1062 |
|
|
1063 |
t = xmalloc (sizeof *t); |
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; |
|
1064 |
t->writer = writer; |
t->writer = writer; |
1065 |
t->e = e; |
t->e = e; |
1066 |
|
|
1067 |
add_transformation ((struct trns_header *) t); |
add_transformation (print_space_trns_proc, print_space_trns_free, t); |
1068 |
return CMD_SUCCESS; |
return CMD_SUCCESS; |
1069 |
} |
} |
1070 |
|
|
1071 |
static int |
static int |
1072 |
print_space_trns_proc (struct trns_header * trns, struct ccase * c, |
print_space_trns_proc (void *t_, struct ccase *c, |
1073 |
int case_num UNUSED) |
int case_num UNUSED) |
1074 |
{ |
{ |
1075 |
struct print_space_trns *t = (struct print_space_trns *) trns; |
struct print_space_trns *t = t_; |
1076 |
double n = 1.; |
double n = 1.; |
1077 |
|
|
1078 |
if (t->e) |
if (t->e) |
1108 |
} |
} |
1109 |
|
|
1110 |
static void |
static void |
1111 |
print_space_trns_free (struct trns_header * trns) |
print_space_trns_free (void *trns_) |
1112 |
{ |
{ |
1113 |
expr_free (((struct print_space_trns *) trns)->e); |
struct print_space_trns *trns = trns_; |
1114 |
|
expr_free (trns->e); |
1115 |
|
free (trns); |
1116 |
} |
} |