static void ascii_flush (struct outp_driver *);
static int get_default_box_char (size_t idx);
static bool update_page_size (struct outp_driver *, bool issue_error);
-static bool handle_option (struct outp_driver *this, const char *key,
+static bool handle_option (void *this, const char *key,
const struct string *val);
static bool
x->line_cap = 0;
x->chart_cnt = 0;
- if (!outp_parse_options (options, handle_option, this))
+ if (!outp_parse_options (this->name, options, handle_option, this))
goto error;
if (!update_page_size (this, true))
};
static bool
-handle_option (struct outp_driver *this, const char *key,
+handle_option (void *this_, const char *key,
const struct string *val)
{
+ struct outp_driver *this = this_;
struct ascii_driver_ext *x = this->ext;
int subcat;
const char *value;
struct xr_font fonts[OUTP_FONT_CNT];
};
-static bool handle_option (struct outp_driver *this, const char *key,
+static bool handle_option (void *this, const char *key,
const struct string *val);
static void draw_headers (struct outp_driver *this);
font->layout = NULL;
}
- outp_parse_options (options, handle_option, this);
+ outp_parse_options (name, options, handle_option, this);
width_pt = x->paper_width / 1000.0;
length_pt = x->paper_length / 1000.0;
};
static bool
-handle_option (struct outp_driver *this, const char *key,
+handle_option (void *this_, const char *key,
const struct string *val)
{
+ struct outp_driver *this = this_;
struct xr_driver_ext *x = this->ext;
int subcat;
char *value = ds_cstr (val);
static void escape_string (FILE *file,
const char *text, size_t length,
const char *space);
-static bool handle_option (struct outp_driver *this,
+static bool handle_option (void *this,
const char *key, const struct string *val);
static void print_title_tag (FILE *file, const char *name,
const char *content);
x->file = NULL;
x->chart_cnt = 0;
- outp_parse_options (options, handle_option, this);
+ outp_parse_options (name, options, handle_option, this);
x->file = fn_open (x->file_name, "w");
if (x->file == NULL)
};
static bool
-handle_option (struct outp_driver *this,
- const char *key, const struct string *val)
+handle_option (void *this_, const char *key, const struct string *val)
{
+ struct outp_driver *this = this_;
struct html_driver_ext *x = this->ext;
int subcat;
}
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);
void outp_enable_device (bool enable, int device);
struct outp_driver *outp_drivers (struct outp_driver *);
-bool outp_parse_options (struct substring options,
- bool (*) (struct outp_driver *, const char *key,
- const struct string *value),
- struct outp_driver *);
+bool outp_parse_options (const char *driver_name, struct substring options,
+ bool (*callback) (void *aux, const char *key,
+ const struct string *value),
+ void *aux);
int outp_match_keyword (const char *, const struct outp_option *, int *);
int outp_evaluate_dimension (const char *);
/* Transform logical y-ordinate Y into a page ordinate. */
#define YT(Y) (this->length - (Y))
-static bool handle_option (struct outp_driver *this, const char *key,
+static bool handle_option (void *this, const char *key,
const struct string *val);
static void draw_headers (struct outp_driver *this);
for (i = 0; i < OUTP_FONT_CNT; i++)
x->fonts[i] = NULL;
- outp_parse_options (options, handle_option, this);
+ outp_parse_options (this->name, options, handle_option, this);
x->file = fn_open (x->file_name, "w");
if (x->file == NULL)
};
static bool
-handle_option (struct outp_driver *this, const char *key,
+handle_option (void *this_, const char *key,
const struct string *val)
{
+ struct outp_driver *this = this_;
struct ps_driver_ext *x = this->ext;
int subcat;
char *value = ds_cstr (val);