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)
#ifdef HAVE_CAIRO
add_class (&cairo_class);
#endif
+ add_class (&odt_class);
add_name (def, &def[strlen (def)], OUTP_S_INIT_FILE);
}
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)
}
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;
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));
{
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);
d->device = types;
d->cp_x = d->cp_y = 0;
d->ext = NULL;
- d->prc = NULL;
return d;
}
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++)