aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc.h
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-12-22 11:15:16 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-12-22 11:15:16 +0000
commit5e8dea30d01017a3651dedc1f6eda3d2b1e6f8d1 (patch)
treec8b375d34bff877a170de8f810c1516d101a37e3 /mdoc.h
parenta227976c4a6d61ca51f3b2ae7f15ee46a39ac235 (diff)
downloadmandoc-5e8dea30d01017a3651dedc1f6eda3d2b1e6f8d1.tar.gz
mandoc-5e8dea30d01017a3651dedc1f6eda3d2b1e6f8d1.tar.zst
mandoc-5e8dea30d01017a3651dedc1f6eda3d2b1e6f8d1.zip
Implement reference-counted version of original union mdoc_data. This
simplifies clean-up and allows for more types without extra hassle. Also made in-line literal types in -T[x]html use CODE instead of SPAN to match how literal blocks use PRE.
Diffstat (limited to 'mdoc.h')
-rw-r--r--mdoc.h23
1 files changed, 16 insertions, 7 deletions
diff --git a/mdoc.h b/mdoc.h
index 31fb0a3e..1041a303 100644
--- a/mdoc.h
+++ b/mdoc.h
@@ -1,4 +1,4 @@
-/* $Id: mdoc.h,v 1.108 2010/12/16 17:14:48 kristaps Exp $ */
+/* $Id: mdoc.h,v 1.109 2010/12/22 11:15:16 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -358,11 +358,20 @@ struct mdoc_an {
* of iterating through the mdoc_arg pointers of a node: defaults are
* provided, etc.
*/
-union mdoc_data {
- struct mdoc_an *An;
- struct mdoc_bd *Bd;
- struct mdoc_bf *Bf;
- struct mdoc_bl *Bl;
+union mdoc_data {
+ struct mdoc_an An;
+ struct mdoc_bd Bd;
+ struct mdoc_bf Bf;
+ struct mdoc_bl Bl;
+};
+
+/*
+ * Reference-counted structure for containing normalised arguments of
+ * certain macros (those listed in union mdoc_data).
+ */
+struct mdoc_norm {
+ int refcnt;
+ union mdoc_data d;
};
/*
@@ -387,6 +396,7 @@ struct mdoc_node {
#define MDOC_ENDED (1 << 5) /* rendering has been ended */
enum mdoc_type type; /* AST node type */
enum mdoc_sec sec; /* current named section */
+ struct mdoc_norm *norm; /* ref-counted, normalised args */
/* FIXME: these can be union'd to shave a few bytes. */
struct mdoc_arg *args; /* BLOCK/ELEM */
struct mdoc_node *pending; /* BLOCK */
@@ -395,7 +405,6 @@ struct mdoc_node {
struct mdoc_node *tail; /* BLOCK */
char *string; /* TEXT */
enum mdoc_endbody end; /* BODY */
- union mdoc_data data;
};
/*