- struct ascii_driver_ext *x = this->ext;
-
- assert (this->driver_open == 0);
-
- if (NULL == x->file.filename)
- x->file.filename = xstrdup ("pspp.list");
-
- x->w = x->page_width - x->left_margin - x->right_margin;
- x->l = (x->page_length - (x->headers ? 3 : 0) - x->top_margin
- - x->bottom_margin - 1);
- if (x->w < 59 || x->l < 15)
- {
- msg (SE, _("ascii driver: Area of page excluding margins and headers "
- "must be at least 59 characters wide by 15 lines long. Page as "
- "configured is only %d characters by %d lines."), x->w, x->l);
- return 0;
- }
-
- this->res = x->lpi * x->cpi;
- this->horiz = x->lpi;
- this->vert = x->cpi;
- this->width = x->w * this->horiz;
- this->length = x->l * this->vert;
-
- if (ls_null_p (&x->ops[OPS_FORMFEED]))
- ls_create (&x->ops[OPS_FORMFEED], "\f");
- if (ls_null_p (&x->ops[OPS_NEWLINE])
- || !strcmp (ls_c_str (&x->ops[OPS_NEWLINE]), "default"))
- {
- ls_create (&x->ops[OPS_NEWLINE], "\n");
- x->file.mode = "wt";
- }
-
- {
- int i;
-
- for (i = 0; i < LNS_COUNT; i++)
- {
- char c[2];
- c[1] = 0;
- if (!ls_null_p (&x->box[i]))
- continue;
- switch (i)
- {
- case TAYSTE2BYTE (0, 0, 0, 0):
- c[0] = ' ';
- break;
-
- case TAYSTE2BYTE (0, 1, 0, 0):
- case TAYSTE2BYTE (0, 1, 0, 1):
- case TAYSTE2BYTE (0, 0, 0, 1):
- c[0] = '-';
- break;
-
- case TAYSTE2BYTE (1, 0, 0, 0):
- case TAYSTE2BYTE (1, 0, 1, 0):
- case TAYSTE2BYTE (0, 0, 1, 0):
- c[0] = '|';
- break;
-
- case TAYSTE2BYTE (0, 3, 0, 0):
- case TAYSTE2BYTE (0, 3, 0, 3):
- case TAYSTE2BYTE (0, 0, 0, 3):
- case TAYSTE2BYTE (0, 2, 0, 0):
- case TAYSTE2BYTE (0, 2, 0, 2):
- case TAYSTE2BYTE (0, 0, 0, 2):
- c[0] = '=';
- break;
-
- case TAYSTE2BYTE (3, 0, 0, 0):
- case TAYSTE2BYTE (3, 0, 3, 0):
- case TAYSTE2BYTE (0, 0, 3, 0):
- case TAYSTE2BYTE (2, 0, 0, 0):
- case TAYSTE2BYTE (2, 0, 2, 0):
- case TAYSTE2BYTE (0, 0, 2, 0):
- c[0] = '#';
- break;
-
- default:
- if (BYTE2TAYSTE (i, LNS_LEFT) > 1
- || BYTE2TAYSTE (i, LNS_TOP) > 1
- || BYTE2TAYSTE (i, LNS_RIGHT) > 1
- || BYTE2TAYSTE (i, LNS_BOTTOM) > 1)
- c[0] = '#';
- else
- c[0] = '+';
- break;
- }
- ls_create (&x->box[i], c);
- }
- }
-
- {
- int i;
-
- this->cp_x = this->cp_y = 0;
- this->font_height = this->vert;
- this->prop_em_width = this->horiz;
- this->fixed_width = this->horiz;
-
- this->horiz_line_width[0] = 0;
- this->vert_line_width[0] = 0;
-
- for (i = 1; i < OUTP_L_COUNT; i++)
- {
- this->horiz_line_width[i] = this->vert;
- this->vert_line_width[i] = this->horiz;
- }
-
- for (i = 0; i < (1 << OUTP_L_COUNT); i++)
- {
- this->horiz_line_spacing[i] = (i & ~1) ? this->vert : 0;
- this->vert_line_spacing[i] = (i & ~1) ? this->horiz : 0;
- }
- }
-
- this->driver_open = 1;
- msg (VM (2), _("%s: Initialization complete."), this->name);
-
- return 1;
-}
-
-static int
-ascii_close_driver (struct outp_driver *this)
-{
- struct ascii_driver_ext *x = this->ext;
- int i;
-
- assert (this->driver_open == 1);
- msg (VM (2), _("%s: Beginning closing..."), this->name);
-
- x = this->ext;
- for (i = 0; i < OPS_COUNT; i++)
- ls_destroy (&x->ops[i]);
- for (i = 0; i < LNS_COUNT; i++)
- ls_destroy (&x->box[i]);
- for (i = 0; i < FSTY_COUNT; i++)
- ls_destroy (&x->fonts[i]);
- if (x->lines != NULL)
- {
- int line;
-
- for (line = 0; line < x->lines_cap; line++)
- free (x->lines[line].chars);
- free (x->lines);
- }
- fn_close_ext (&x->file);
- free (x->file.filename);
- free (x);
-
- this->driver_open = 0;
- msg (VM (3), _("%s: Finished closing."), this->name);
-
- return 1;
-}
-
-/* Generic option types. */
-enum
- {
- pos_int_arg = -10,
- nonneg_int_arg,
- string_arg,
- font_string_arg,
- boolean_arg
- };