LIST: Remove WEIGHT subcommand.
[pspp-builds.git] / src / output / output.c
index 6082d2490c0e6091477cebd67f1e26f0d8219709..2f4788f9a0016fe3a5f6b74a752e11062ba4c9f5 100644 (file)
@@ -218,6 +218,14 @@ find_defn_value (const char *key)
     return getenv (key);
 }
 
+static void
+insert_defn_value (const char *var, struct string *dst, void *aux UNUSED)
+{
+  const char *value = find_defn_value (var);
+  if (value != NULL)
+    ds_put_cstr (dst, value);
+}
+
 /* Initializes global variables. */
 void
 outp_init (void)
@@ -225,11 +233,11 @@ outp_init (void)
   char def[] = "default";
 
   add_class (&html_class);
-  add_class (&postscript_class);
   add_class (&ascii_class);
 #ifdef HAVE_CAIRO
   add_class (&cairo_class);
 #endif
+  add_class (&odt_class);
 
   add_name (def, &def[strlen (def)], OUTP_S_INIT_FILE);
 }
@@ -407,7 +415,7 @@ outp_configure_macro (char *bp)
     ep++;
 
   ds_init_cstr (&d->value, ep);
-  fn_interp_vars (ds_ss (&d->value), find_defn_value, &d->value);
+  fn_interp_vars (ds_ss (&d->value), insert_defn_value, NULL, &d->value);
   d->next = outp_macros;
   d->prev = NULL;
   if (outp_macros)
@@ -594,10 +602,9 @@ get_option_token (struct substring *s, const char *driver_name,
 }
 
 bool
-outp_parse_options (struct substring options,
-                    bool (*callback) (struct outp_driver *, const char *key,
-                                      const struct string *value),
-                    struct outp_driver *driver)
+outp_parse_options (const char *driver_name, struct substring options,
+                    bool (*callback) (void *aux, const char *key,
+                                      const struct string *value), void *aux)
 {
   struct string key = DS_EMPTY_INITIALIZER;
   struct string value = DS_EMPTY_INITIALIZER;
@@ -610,7 +617,7 @@ outp_parse_options (struct substring options,
       if (ss_is_empty (left))
         break;
 
-      if (!get_option_token (&left, driver->name, &key))
+      if (!get_option_token (&left, driver_name, &key))
         break;
 
       ss_ltrim (&left, ss_cstr (CC_SPACES));
@@ -618,15 +625,15 @@ outp_parse_options (struct substring options,
        {
          error (0, 0, _("syntax error expecting `=' "
                          "parsing options for driver \"%s\""),
-                 driver->name);
+                 driver_name);
          break;
        }
 
       ss_ltrim (&left, ss_cstr (CC_SPACES));
-      if (!get_option_token (&left, driver->name, &value))
+      if (!get_option_token (&left, driver_name, &value))
         break;
 
-      ok = callback (driver, ds_cstr (&key), &value);
+      ok = callback (aux, ds_cstr (&key), &value);
     }
   while (ok);
 
@@ -707,7 +714,6 @@ outp_allocate_driver (const struct outp_class *class,
   d->device = types;
   d->cp_x = d->cp_y = 0;
   d->ext = NULL;
-  d->prc = NULL;
   return d;
 }
 
@@ -759,7 +765,7 @@ outp_configure_driver_line (struct substring line_)
   size_t save_idx;
   size_t i;
 
-  fn_interp_vars (line_, find_defn_value, &line);
+  fn_interp_vars (line_, insert_defn_value, NULL, &line);
 
   save_idx = 0;
   for (i = 0; i < 4; i++)