X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput.c;h=ba620e061314f493f5138a6add50117405345ce4;hb=6950df40513e606e6be42fa83a36a281f654d553;hp=6a4ed78dbb9ada555050b262de963b1456e2b892;hpb=60d7d619ee7885ad065f178eb0cf1e5d432b1921;p=pspp diff --git a/src/output.c b/src/output.c index 6a4ed78dbb..ba620e0613 100644 --- a/src/output.c +++ b/src/output.c @@ -14,18 +14,17 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ #include #include "output.h" -#include +#include "error.h" #include #include #include #include #include "alloc.h" -#include "devind.h" #include "error.h" #include "filename.h" #include "htmlP.h" @@ -34,6 +33,9 @@ #include "settings.h" #include "str.h" +#include "gettext.h" +#define _(msgid) gettext (msgid) + /* FIXME? Should the output configuration format be changed to drivername:classname:devicetype:options, where devicetype is zero or more of screen, printer, listing? */ @@ -74,7 +76,7 @@ char *outp_subtitle; /* A set of OUTP_DEV_* bits indicating the devices that are disabled. */ -int disabled_devices; +static int disabled_devices; static void destroy_driver (struct outp_driver *); static void configure_driver (char *); @@ -206,12 +208,12 @@ find_defn_value (const char *key) return d->value; if (!strcmp (key, "viewwidth")) { - sprintf (buf, "%d", set_viewwidth); + sprintf (buf, "%d", get_viewwidth()); return buf; } else if (!strcmp (key, "viewlength")) { - sprintf (buf, "%d", set_viewlength); + sprintf (buf, "%d", get_viewlength()); return buf; } else @@ -228,7 +230,6 @@ outp_init (void) extern struct outp_class epsf_class; #endif extern struct outp_class html_class; - extern struct outp_class devind_class; char def[] = "default"; @@ -239,7 +240,6 @@ outp_init (void) add_class (&epsf_class); add_class (&postscript_class); #endif - add_class (&devind_class); add_class (&ascii_class); add_name (def, &def[strlen (def)], OUTP_S_INIT_FILE); @@ -288,12 +288,12 @@ outp_read_devices (void) where.line_number = 0; err_push_file_locator (&where); - ds_init (NULL, &line, 128); + ds_init (&line, 128); if (init_fn == NULL) { - msg (IE, _("Cannot find output initialization file. Use `-vv' to view " - "search path.")); + msg (IE, _("Cannot find output initialization file. " + "Use `-vvvvv' to view search path.")); goto exit; } @@ -315,7 +315,7 @@ outp_read_devices (void) msg (ME, _("Reading %s: %s."), init_fn, strerror (errno)); break; } - for (cp = ds_value (&line); isspace ((unsigned char) *cp); cp++); + for (cp = ds_c_str (&line); isspace ((unsigned char) *cp); cp++); if (!strncmp ("define", cp, 6) && isspace ((unsigned char) cp[6])) outp_configure_macro (&cp[7]); else if (*cp) @@ -442,12 +442,27 @@ destroy_list (struct outp_driver ** dl) int outp_done (void) { + struct outp_driver_class_list *n = outp_class_list ; #if GLOBAL_DEBUGGING if (iterating_driver_list) reentrancy (); #endif destroy_list (&outp_driver_list); + while (n) + { + struct outp_driver_class_list *next = n->next; + free(n); + n = next; + } + outp_class_list = NULL; + + free (outp_title); + outp_title = NULL; + + free (outp_subtitle); + outp_subtitle = NULL; + return 1; } @@ -455,7 +470,7 @@ outp_done (void) void outp_list_classes (void) { - int width = set_viewwidth; + int width = get_viewwidth(); struct outp_driver_class_list *c; printf (_("Driver classes:\n\t")); @@ -465,7 +480,7 @@ outp_list_classes (void) if ((int) strlen (c->class->name) + 1 > width) { printf ("\n\t"); - width = set_viewwidth - 8; + width = get_viewwidth() - 8; } else putc (' ', stdout); @@ -511,7 +526,7 @@ tokener (void) while (*prog && *prog != quote) { if (*prog != '\\') - ds_putchar (&op_tokstr, *prog++); + ds_putc (&op_tokstr, *prog++); else { int c; @@ -588,15 +603,16 @@ tokener (void) break; default: msg (IS, _("Syntax error in string constant.")); + continue; } - ds_putchar (&op_tokstr, (unsigned char) c); + ds_putc (&op_tokstr, (unsigned char) c); } } prog++; } else while (*prog && !isspace ((unsigned char) *prog) && *prog != '=') - ds_putchar (&op_tokstr, *prog++); + ds_putc (&op_tokstr, *prog++); op_token = 'a'; } @@ -611,7 +627,7 @@ parse_options (char *s, struct outp_driver * d) prog = s; op_token = -1; - ds_init (NULL, &op_tokstr, 64); + ds_init (&op_tokstr, 64); while (tokener ()) { char key[65]; @@ -623,7 +639,7 @@ parse_options (char *s, struct outp_driver * d) } ds_truncate (&op_tokstr, 64); - strcpy (key, ds_value (&op_tokstr)); + strcpy (key, ds_c_str (&op_tokstr)); tokener (); if (op_token != '=') @@ -892,7 +908,7 @@ outp_match_keyword (const char *s, struct outp_option *tab, *++cp = 0; info->initial = xstrdup (s); - info->options = xmalloc (sizeof *info->options * (cp - s)); + info->options = xnmalloc (cp - s, sizeof *info->options); memcpy (info->options, ptr, sizeof *info->options * (cp - s)); } @@ -1149,7 +1165,7 @@ outp_get_paper_size (char *size, int *h, int *v) where.filename = pprsz_fn; where.line_number = 0; err_push_file_locator (&where); - ds_init (NULL, &line, 128); + ds_init (&line, 128); if (pprsz_fn == NULL) { @@ -1175,7 +1191,7 @@ outp_get_paper_size (char *size, int *h, int *v) msg (ME, _("Reading %s: %s."), pprsz_fn, strerror (errno)); break; } - for (cp = ds_value (&line); isspace ((unsigned char) *cp); cp++); + for (cp = ds_c_str (&line); isspace ((unsigned char) *cp); cp++); if (*cp == 0) continue; if (*cp != '"')