aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/main.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-06-07 20:57:09 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-06-07 20:57:09 +0000
commit46dd3365d4def0a50cf065f76bc39e52dfa71d82 (patch)
tree74b9fa659fcc01b96403653d79d3b6d33e020e85 /main.c
parent330def09deee27bc7f1f70f0870aebf0eeddd62c (diff)
downloadmandoc-46dd3365d4def0a50cf065f76bc39e52dfa71d82.tar.gz
mandoc-46dd3365d4def0a50cf065f76bc39e52dfa71d82.tar.zst
mandoc-46dd3365d4def0a50cf065f76bc39e52dfa71d82.zip
First check-in of PostScript output. This does not change any logic
within term.c, but does add a small shim over putchar() that switches on the output engine. Prints, for this initial version, only monospace and without font decorations. It's a start.
Diffstat (limited to 'main.c')
-rw-r--r--main.c34
1 files changed, 25 insertions, 9 deletions
diff --git a/main.c b/main.c
index b6a13f6e..949cddca 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.84 2010/06/07 10:52:44 kristaps Exp $ */
+/* $Id: main.c,v 1.85 2010/06/07 20:57:09 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -65,7 +65,8 @@ enum outt {
OUTT_TREE,
OUTT_HTML,
OUTT_XHTML,
- OUTT_LINT
+ OUTT_LINT,
+ OUTT_PS
};
struct curparse {
@@ -584,12 +585,24 @@ fdesc(struct curparse *curp)
switch (curp->outtype) {
case (OUTT_XHTML):
curp->outdata = xhtml_alloc(curp->outopts);
- curp->outman = html_man;
- curp->outmdoc = html_mdoc;
- curp->outfree = html_free;
break;
case (OUTT_HTML):
curp->outdata = html_alloc(curp->outopts);
+ break;
+ case (OUTT_ASCII):
+ curp->outdata = ascii_alloc(curp->outopts);
+ break;
+ case (OUTT_PS):
+ curp->outdata = ps_alloc();
+ break;
+ default:
+ break;
+ }
+
+ switch (curp->outtype) {
+ case (OUTT_HTML):
+ /* FALLTHROUGH */
+ case (OUTT_XHTML):
curp->outman = html_man;
curp->outmdoc = html_mdoc;
curp->outfree = html_free;
@@ -598,14 +611,15 @@ fdesc(struct curparse *curp)
curp->outman = tree_man;
curp->outmdoc = tree_mdoc;
break;
- case (OUTT_LINT):
- break;
- default:
- curp->outdata = ascii_alloc(curp->outopts);
+ case (OUTT_ASCII):
+ /* FALLTHROUGH */
+ case (OUTT_PS):
curp->outman = terminal_man;
curp->outmdoc = terminal_mdoc;
curp->outfree = terminal_free;
break;
+ default:
+ break;
}
}
@@ -729,6 +743,8 @@ toptions(struct curparse *curp, char *arg)
curp->outtype = OUTT_HTML;
else if (0 == strcmp(arg, "xhtml"))
curp->outtype = OUTT_XHTML;
+ else if (0 == strcmp(arg, "ps"))
+ curp->outtype = OUTT_PS;
else {
fprintf(stderr, "%s: Bad argument\n", arg);
return(0);