summaryrefslogtreecommitdiffstatshomepage
path: root/mdoc.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2010-03-31 07:13:53 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2010-03-31 07:13:53 +0000
commitea6ed8eb4a9349ba679125913c5a03c1027783b2 (patch)
tree5e2e9909a3d4510379a5f0deb3c96b83b16d58e0 /mdoc.c
parentd0506b714f392d1f74c683bae920e02c500e05d5 (diff)
downloadmandoc-ea6ed8eb4a9349ba679125913c5a03c1027783b2.tar.gz
mandoc-ea6ed8eb4a9349ba679125913c5a03c1027783b2.tar.zst
mandoc-ea6ed8eb4a9349ba679125913c5a03c1027783b2.zip
Macro types enum-ated (enum mdoct) (for easier debugging in gdb of "tok" values).
Initial check-in of Ingo Schwarze's patch for Xo/Xc handling (in blocks ifdef'd "UGLY"). Put Oc-close-Op parts into UGLY ifdef blocks.
Diffstat (limited to 'mdoc.c')
-rw-r--r--mdoc.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/mdoc.c b/mdoc.c
index 96b4bffd..2ab3a0ca 100644
--- a/mdoc.c
+++ b/mdoc.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc.c,v 1.116 2010/01/07 10:24:43 kristaps Exp $ */
+/* $Id: mdoc.c,v 1.117 2010/03/31 07:13:53 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -143,7 +143,7 @@ const char * const *mdoc_argnames = __mdoc_argnames;
static void mdoc_free1(struct mdoc *);
static void mdoc_alloc1(struct mdoc *);
static struct mdoc_node *node_alloc(struct mdoc *, int, int,
- int, enum mdoc_type);
+ enum mdoct, enum mdoc_type);
static int node_append(struct mdoc *,
struct mdoc_node *);
static int parsetext(struct mdoc *, int, char *);
@@ -341,9 +341,11 @@ mdoc_err(struct mdoc *m, int line, int pos, int iserr, enum merr type)
int
-mdoc_macro(struct mdoc *m, int tok,
+mdoc_macro(struct mdoc *m, enum mdoct tok,
int ln, int pp, int *pos, char *buf)
{
+
+ assert(tok < MDOC_MAX);
/*
* If we're in the prologue, deny "body" macros. Similarly, if
* we're in the body, deny prologue calls.
@@ -424,8 +426,8 @@ node_append(struct mdoc *mdoc, struct mdoc_node *p)
static struct mdoc_node *
-node_alloc(struct mdoc *m, int line,
- int pos, int tok, enum mdoc_type type)
+node_alloc(struct mdoc *m, int line, int pos,
+ enum mdoct tok, enum mdoc_type type)
{
struct mdoc_node *p;
@@ -434,15 +436,13 @@ node_alloc(struct mdoc *m, int line,
p->line = line;
p->pos = pos;
p->tok = tok;
- if (MDOC_TEXT != (p->type = type))
- assert(p->tok >= 0);
return(p);
}
int
-mdoc_tail_alloc(struct mdoc *m, int line, int pos, int tok)
+mdoc_tail_alloc(struct mdoc *m, int line, int pos, enum mdoct tok)
{
struct mdoc_node *p;
@@ -455,7 +455,7 @@ mdoc_tail_alloc(struct mdoc *m, int line, int pos, int tok)
int
-mdoc_head_alloc(struct mdoc *m, int line, int pos, int tok)
+mdoc_head_alloc(struct mdoc *m, int line, int pos, enum mdoct tok)
{
struct mdoc_node *p;
@@ -471,7 +471,7 @@ mdoc_head_alloc(struct mdoc *m, int line, int pos, int tok)
int
-mdoc_body_alloc(struct mdoc *m, int line, int pos, int tok)
+mdoc_body_alloc(struct mdoc *m, int line, int pos, enum mdoct tok)
{
struct mdoc_node *p;
@@ -485,7 +485,7 @@ mdoc_body_alloc(struct mdoc *m, int line, int pos, int tok)
int
mdoc_block_alloc(struct mdoc *m, int line, int pos,
- int tok, struct mdoc_arg *args)
+ enum mdoct tok, struct mdoc_arg *args)
{
struct mdoc_node *p;
@@ -502,7 +502,7 @@ mdoc_block_alloc(struct mdoc *m, int line, int pos,
int
mdoc_elem_alloc(struct mdoc *m, int line, int pos,
- int tok, struct mdoc_arg *args)
+ enum mdoct tok, struct mdoc_arg *args)
{
struct mdoc_node *p;