summaryrefslogtreecommitdiff
path: root/usr.bin/mandoc/libmdoc.h
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2010-06-27 21:54:43 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2010-06-27 21:54:43 +0000
commitdae22b2a7b046070a5972b52c5be5ab23c603ce7 (patch)
tree04d8a2c11e8943c412d5e1de74ee8881754a9d61 /usr.bin/mandoc/libmdoc.h
parentd41b978186af813a0930f71b4972e6e4750be2c5 (diff)
Full .nr nS support, unbreaking the kernel manuals.
Kristaps coded this from scratch after reading my .nr patch; it is simpler and more powerful. Registers live in struct regset in regs.h, struct man and struct mdoc contain pointers to it. The nS register is cleared when parsing .Sh. Frontends respect the MDOC_SYNPRETTY flag set in mdoc node_alloc.
Diffstat (limited to 'usr.bin/mandoc/libmdoc.h')
-rw-r--r--usr.bin/mandoc/libmdoc.h26
1 files changed, 16 insertions, 10 deletions
diff --git a/usr.bin/mandoc/libmdoc.h b/usr.bin/mandoc/libmdoc.h
index ceeedfd3f0d..b37489b9f2d 100644
--- a/usr.bin/mandoc/libmdoc.h
+++ b/usr.bin/mandoc/libmdoc.h
@@ -1,6 +1,6 @@
-/* $Id: libmdoc.h,v 1.37 2010/06/06 20:30:08 schwarze Exp $ */
+/* $Id: libmdoc.h,v 1.38 2010/06/27 21:54:41 schwarze Exp $ */
/*
- * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
+ * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -17,6 +17,7 @@
#ifndef LIBMDOC_H
#define LIBMDOC_H
+#include "regs.h"
#include "mdoc.h"
enum mdoc_next {
@@ -25,8 +26,8 @@ enum mdoc_next {
};
struct mdoc {
- void *data;
- mandocmsg msg;
+ void *data; /* private application data */
+ mandocmsg msg; /* message callback */
int flags;
#define MDOC_HALT (1 << 0) /* error in parse: halt */
#define MDOC_LITERAL (1 << 1) /* in a literal scope */
@@ -36,16 +37,21 @@ struct mdoc {
#define MDOC_PPHRASE (1 << 5) /* within a partial phrase */
#define MDOC_FREECOL (1 << 6) /* `It' invocation should close */
int pflags;
- enum mdoc_next next;
- struct mdoc_node *last;
- struct mdoc_node *first;
- struct mdoc_meta meta;
+ enum mdoc_next next; /* where to put the next node */
+ struct mdoc_node *last; /* the last node parsed */
+ struct mdoc_node *first; /* the first node parsed */
+ struct mdoc_meta meta; /* document meta-data */
enum mdoc_sec lastnamed;
enum mdoc_sec lastsec;
+ struct regset *regs; /* registers */
};
-#define MACRO_PROT_ARGS struct mdoc *m, enum mdoct tok, \
- int line, int ppos, int *pos, char *buf
+#define MACRO_PROT_ARGS struct mdoc *m, \
+ enum mdoct tok, \
+ int line, \
+ int ppos, \
+ int *pos, \
+ char *buf
struct mdoc_macro {
int (*fp)(MACRO_PROT_ARGS);