summaryrefslogtreecommitdiffstats
path: root/term.h
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 /term.h
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 'term.h')
-rw-r--r--term.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/term.h b/term.h
index 0adbfd13..364b44ef 100644
--- a/term.h
+++ b/term.h
@@ -19,10 +19,17 @@
__BEGIN_DECLS
+struct termp;
+
enum termenc {
TERMENC_ASCII
};
+enum termtype {
+ TERMTYPE_CHAR,
+ TERMTYPE_PS
+};
+
enum termfont {
TERMFONT_NONE = 0,
TERMFONT_BOLD,
@@ -31,7 +38,10 @@ enum termfont {
#define TERM_MAXMARGIN 100000 /* FIXME */
+typedef void (*term_margin)(struct termp *, const void *);
+
struct termp {
+ enum termtype type;
size_t defrmargin; /* Right margin of the device.. */
size_t rmargin; /* Current right margin. */
size_t maxrmargin; /* Max right margin. */
@@ -60,12 +70,24 @@ struct termp {
enum termfont fontl; /* Last font set. */
enum termfont fontq[10]; /* Symmetric fonts. */
int fonti; /* Index of font stack. */
+ term_margin headf; /* invoked to print head */
+ term_margin footf; /* invoked to print foot */
+ const void *argf; /* arg for headf/footf */
+ int psstate; /* -Tps: state of ps output */
+#define PS_INLINE (1 << 0)
+#define PS_MARGINS (1 << 1)
+ size_t pscol; /* -Tps: visible column */
+ size_t psrow; /* -Tps: visible row */
+ size_t pspage; /* -Tps: current page */
};
void term_newln(struct termp *);
void term_vspace(struct termp *);
void term_word(struct termp *, const char *);
void term_flushln(struct termp *);
+void term_begin(struct termp *, term_margin,
+ term_margin, const void *);
+void term_end(struct termp *);
size_t term_hspan(const struct roffsu *);
size_t term_vspan(const struct roffsu *);