/* PSPP - computes sample statistics.
Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
- Written by Ben Pfaff <blp@gnu.org>.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
/* A list of driver classes. */
struct outp_driver_class_list
{
- struct outp_class *class;
+ const struct outp_class *class;
struct outp_driver_class_list *next;
};
-struct outp_driver_class_list *outp_class_list;
-struct outp_driver *outp_driver_list;
+static struct outp_driver_class_list *outp_class_list;
+static struct outp_driver *outp_driver_list;
char *outp_title;
char *outp_subtitle;
/* Add a class to the class list. */
static void
-add_class (struct outp_class *class)
+add_class (const struct outp_class *class)
{
struct outp_driver_class_list *new_list = xmalloc (sizeof *new_list);
{
extern struct outp_class ascii_class;
extern struct outp_class postscript_class;
- extern struct outp_class html_class;
char def[] = "default";
}
static void
-init_default_drivers (void)
+init_default_drivers (void)
{
error (0, 0, _("using default output driver configuration"));
configure_driver (ss_cstr ("list"),
init_fn = fn_search_path (fn_getenv_default ("STAT_OUTPUT_INIT_FILE",
"devices"),
fn_getenv_default ("STAT_OUTPUT_INIT_PATH",
- config_path),
- NULL);
+ config_path));
ds_init_empty (&line);
ds_destroy (&line);
delete_macros ();
- if (result)
+ if (result)
{
- if (outp_driver_list == NULL)
- error (0, 0, _("no active output drivers"));
+ if (outp_driver_list == NULL)
+ error (0, 0, _("no active output drivers"));
}
else
error (0, 0, _("error reading device definition file"));
free (d);
return;
}
-
+
if (*ep == '=')
ep++;
while (isspace ((unsigned char) *ep))
void
outp_done (void)
{
- struct outp_driver_class_list *n = outp_class_list ;
+ struct outp_driver_class_list *n = outp_class_list ;
destroy_list (&outp_driver_list);
- while (n)
+ while (n)
{
struct outp_driver_class_list *next = n->next;
free(n);
free (outp_title);
outp_title = NULL;
-
+
free (outp_subtitle);
outp_subtitle = NULL;
}
struct string *token)
{
int c;
-
+
ds_clear (token);
c = ss_get_char (s);
if (c == EOF)
c = ss_get_char (s);
if (c == quote)
break;
- else if (c == EOF)
+ else if (c == EOF)
{
error (0, 0,
_("reached end of options inside quoted string "
}
}
}
- else
+ else
{
for (;;)
{
ss_advance (s, 1);
}
}
-
+
return 1;
}
ss_ltrim (&left, ss_cstr (CC_SPACES));
if (ss_is_empty (left))
break;
-
+
if (!get_option_token (&left, driver->name, &key))
break;
ok = callback (driver, ds_cstr (&key), &value);
}
while (ok);
-
+
ds_destroy (&key);
ds_destroy (&value);
(int) ss_length (class_name), ss_data (class_name));
return;
}
-
+
/* Parse device type. */
device = 0;
while (ss_tokenize (device_type, ss_cstr (CC_SPACES), &save_idx, &token))
fn_interp_vars (line_, find_defn_value, &line);
save_idx = 0;
- for (i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++)
{
struct substring *token = &tokens[i];
ds_separate (&line, ss_cstr (i < 3 ? ":" : ""), &save_idx, token);
code and stores subcategory in *SUBCAT on success. Returns -1
on failure. */
int
-outp_match_keyword (const char *s, struct outp_option *tab, int *subcat)
+outp_match_keyword (const char *s, const struct outp_option *tab, int *subcat)
{
for (; tab->keyword != NULL; tab++)
if (!strcmp (s, tab->keyword))
/* Stores the dimensions in 1/72000" units of paper identified by
SIZE, which is of form `HORZ x VERT' or `HORZ by VERT' where each
- of HORZ and VERT are dimensions, into *H and *V. Return nonzero on
+ of HORZ and VERT are dimensions, into *H and *V. Return true on
success. */
-static int
+static bool
internal_get_paper_size (char *size, int *h, int *v)
{
char *tail;
size++;
*h = outp_evaluate_dimension (size, &tail);
if (tail == NULL)
- return 0;
+ return false;
while (isspace ((unsigned char) *tail))
tail++;
if (*tail == 'x')
else
{
error (0, 0, _("`x' expected in paper size `%s'"), size);
- return 0;
+ return false;
}
*v = outp_evaluate_dimension (tail, &tail);
if (tail == NULL)
if (*tail)
{
error (0, 0, _("trailing garbage `%s' on paper size `%s'"), tail, size);
- return 0;
+ return false;
}
-
- return 1;
+
+ return true;
}
/* Stores the dimensions, in 1/72000" units, of paper identified by
SIZE into *H and *V. SIZE may be a pair of dimensions of form `H x
V', or it may be a case-insensitive paper identifier, which is
- looked up in the `papersize' configuration file. Returns nonzero
+ looked up in the `papersize' configuration file. Returns true
on success. May modify SIZE. */
/* Don't read further unless you've got a strong stomach. */
-int
+bool
outp_get_paper_size (char *size, int *h, int *v)
{
struct paper_size
int line_number = 0;
bool free_it = false;
- int result = 0;
+ bool result = false;
char *ep;
while (isspace ((unsigned char) *size))
error (0, 0, _("paper size name cannot be empty"));
return 0;
}
-
+
ep++;
if (*ep)
*ep = 0;
pprsz_fn = fn_search_path (fn_getenv_default ("STAT_OUTPUT_PAPERSIZE_FILE",
"papersize"),
fn_getenv_default ("STAT_OUTPUT_INIT_PATH",
- config_path),
- NULL);
+ config_path));
ds_init_empty (&line);
if (!result)
error (0, 0, _("error reading paper size definition file"));
-
+
return result;
}
/* Opens a page on driver D (if one is not open). */
void
-outp_open_page (struct outp_driver *d)
+outp_open_page (struct outp_driver *d)
{
- if (!d->page_open)
+ if (!d->page_open)
{
d->cp_x = d->cp_y = 0;
/* Closes the page on driver D (if one is open). */
void
-outp_close_page (struct outp_driver *d)
+outp_close_page (struct outp_driver *d)
{
- if (d->page_open)
+ if (d->page_open)
{
if (d->class->close_page != NULL)
d->class->close_page (d);
{
struct outp_text text;
int width;
-
+
text.font = font;
text.justification = OUTP_LEFT;
text.string = ss_cstr (s);