summaryrefslogtreecommitdiffstats
path: root/mdoc_term.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
commit7506d04e28e759651e3b7cf0f671282cfb8ab4fd (patch)
treedcc0c1b0d2b0b05ca3f50a2766c7e15cd07d3718 /mdoc_term.c
parent1ce42efc4cb4b55e9e64a347176288d71b9d5cc5 (diff)
downloadmandoc-7506d04e28e759651e3b7cf0f671282cfb8ab4fd.tar.gz
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 'mdoc_term.c')
-rw-r--r--mdoc_term.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index 84583caf..86a7fdde 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -65,9 +65,9 @@ static void print_bvspace(struct termp *,
const struct mdoc_node *,
const struct mdoc_node *);
static void print_mdoc_node(DECL_ARGS);
-static void print_mdoc_head(DECL_ARGS);
+static void print_mdoc_head(struct termp *, const void *);
static void print_mdoc_nodelist(DECL_ARGS);
-static void print_foot(DECL_ARGS);
+static void print_foot(struct termp *, const void *);
static void synopsis_pre(struct termp *,
const struct mdoc_node *);
@@ -276,6 +276,8 @@ terminal_mdoc(void *arg, const struct mdoc *mdoc)
p->maxrmargin = p->defrmargin;
p->tabwidth = 5;
+ term_begin(p, print_mdoc_head, print_foot, mdoc_meta(mdoc));
+
if (NULL == p->symtab)
switch (p->enc) {
case (TERMENC_ASCII):
@@ -289,10 +291,10 @@ terminal_mdoc(void *arg, const struct mdoc *mdoc)
n = mdoc_node(mdoc);
m = mdoc_meta(mdoc);
- print_mdoc_head(p, NULL, m, n);
if (n->child)
print_mdoc_nodelist(p, NULL, m, n->child);
- print_foot(p, NULL, m, n);
+
+ term_end(p);
}
@@ -348,9 +350,12 @@ print_mdoc_node(DECL_ARGS)
/* ARGSUSED */
static void
-print_foot(DECL_ARGS)
+print_foot(struct termp *p, const void *arg)
{
char buf[DATESIZ], os[BUFSIZ];
+ const struct mdoc_meta *m;
+
+ m = (const struct mdoc_meta *)arg;
term_fontrepl(p, TERMFONT_NONE);
@@ -397,9 +402,12 @@ print_foot(DECL_ARGS)
/* ARGSUSED */
static void
-print_mdoc_head(DECL_ARGS)
+print_mdoc_head(struct termp *p, const void *arg)
{
char buf[BUFSIZ], title[BUFSIZ];
+ const struct mdoc_meta *m;
+
+ m = (const struct mdoc_meta *)arg;
p->rmargin = p->maxrmargin;
p->offset = 0;