summaryrefslogtreecommitdiffstats
path: root/term.h
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-06-09 08:07:13 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-06-09 08:07:13 +0000
commit21a2b28bbf9477322208667281f6c561985a17d7 (patch)
tree357aa266e5748aa0e24241f07ebb47fc556c4474 /term.h
parent04759c423ec318452d781322725260af09ce908a (diff)
downloadmandoc-21a2b28bbf9477322208667281f6c561985a17d7.tar.gz
Have the standard manpage header and footer print on every page of -Tps
output. This is more tricky than you may think: we can't just call the header function out-of-state (i.e., before a flushln has occured) because we'd clobber our current state. Thus, we call at the beginning and dump the output into an auxiliary buffer. For the record, I don't think there's any other clean way to do this. The only other Way That Works is to copy-aside *all* termp state, zero it, and do the necessary headf/footf. This is just as complex, as memory needs to be alloc'd and free'd per margin. Unfortunately, this prohibits page numbering (the margin is only printed once), so I'll probably end up re-writing this down the line.
Diffstat (limited to 'term.h')
-rw-r--r--term.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/term.h b/term.h
index 54b9d46f..dad0a71d 100644
--- a/term.h
+++ b/term.h
@@ -41,12 +41,15 @@ enum termfont {
typedef void (*term_margin)(struct termp *, const void *);
struct termp_ps {
- 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 */
+ int psstate; /* state of ps output */
+#define PS_INLINE (1 << 0) /* we're in a word */
+#define PS_MARGINS (1 << 1) /* we're in the margins */
+ size_t pscol; /* visible column */
+ size_t psrow; /* visible row */
+ char *psmarg; /* margin buf */
+ size_t psmargsz; /* margin buf size */
+ size_t psmargcur; /* current pos in margin buf */
+ size_t pspage; /* current page */
};
struct termp {