X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fdata-io%2Fprint.c;h=c981bb1dcc2300f1053f741bc5dd9b93a7c8569e;hb=2764b3157e26955a31af5f4aa7d14e27098ddf19;hp=408224afb921acd9900d53b44a092d1a28302725;hpb=392ab4052e2743f80664a4130b2b4ee5d82af7fe;p=pspp-builds.git diff --git a/src/language/data-io/print.c b/src/language/data-io/print.c index 408224af..c981bb1d 100644 --- a/src/language/data-io/print.c +++ b/src/language/data-io/print.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2006, 2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -83,7 +84,7 @@ struct print_trns struct pool *pool; /* Stores related data. */ bool eject; /* Eject page before printing? */ bool include_prefix; /* Prefix lines with space? */ - enum legacy_encoding encoding; /* Encoding to use for output. */ + const char *encoding; /* Encoding to use for output. */ struct dfm_writer *writer; /* Output file, NULL=listing file. */ struct ll_list specs; /* List of struct prt_out_specs. */ size_t record_cnt; /* Number of records to write. */ @@ -404,7 +405,7 @@ dump_table (struct print_trns *trns, const struct file_handle *fh) tab_text (t, 1, 0, TAB_CENTER | TAT_TITLE, _("Record")); tab_text (t, 2, 0, TAB_CENTER | TAT_TITLE, _("Columns")); tab_text (t, 3, 0, TAB_CENTER | TAT_TITLE, _("Format")); - tab_dim (t, tab_natural_dimensions); + tab_dim (t, tab_natural_dimensions, NULL); row = 1; ll_for_each (spec, struct prt_out_spec, ll, &trns->specs) { @@ -450,7 +451,7 @@ static void flush_records (struct print_trns *, int target_record, /* Performs the transformation inside print_trns T on case C. */ static int -print_trns_proc (void *trns_, struct ccase *c, casenumber case_num UNUSED) +print_trns_proc (void *trns_, struct ccase **c, casenumber case_num UNUSED) { struct print_trns *trns = trns_; bool eject = trns->eject; @@ -467,7 +468,7 @@ print_trns_proc (void *trns_, struct ccase *c, casenumber case_num UNUSED) ds_set_length (&trns->line, spec->first_column, encoded_space); if (spec->type == PRT_VAR) { - const union value *input = case_data (c, spec->var); + const union value *input = case_data (*c, spec->var); char *output = ds_put_uninit (&trns->line, spec->format.w); if (!spec->sysmis_as_spaces || input->f != SYSMIS) data_out_legacy (input, trns->encoding, &spec->format, output); @@ -479,12 +480,13 @@ print_trns_proc (void *trns_, struct ccase *c, casenumber case_num UNUSED) else { ds_put_substring (&trns->line, ds_ss (&spec->string)); - if (trns->encoding != LEGACY_NATIVE) + if (0 != strcmp (trns->encoding, LEGACY_NATIVE)) { size_t length = ds_length (&spec->string); char *data = ss_data (ds_tail (&trns->line, length)); - legacy_recode (LEGACY_NATIVE, data, - trns->encoding, data, length); + char *s = recode_string (trns->encoding, LEGACY_NATIVE, data, length); + memcpy (data, s, length); + free (s); } } }