summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-06-16 19:55:28 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-06-16 19:55:28 +0000
commit779cfd652ca006f1e2598aba37976bc9e022ac11 (patch)
tree9e664d074f0a23b507be5be82c55686e8dcb83bc
parenta7f2dc1d0e14e61727a4abdb0250b39e016e0705 (diff)
downloadmandoc-779cfd652ca006f1e2598aba37976bc9e022ac11.tar.gz
mandoc-779cfd652ca006f1e2598aba37976bc9e022ac11.tar.zst
mandoc-779cfd652ca006f1e2598aba37976bc9e022ac11.zip
Removed MAN___: moved MAN_br to its index (comments not passed into parser).
Fix: hashtable not fully formed after removal of MDOC___.
-rw-r--r--man.c6
-rw-r--r--man.h11
-rw-r--r--man_action.c5
-rw-r--r--man_hash.c4
-rw-r--r--man_macro.c5
-rw-r--r--man_term.c10
-rw-r--r--man_validate.c5
-rw-r--r--mdoc_hash.c4
8 files changed, 24 insertions, 26 deletions
diff --git a/man.c b/man.c
index 5b83d958..14004c55 100644
--- a/man.c
+++ b/man.c
@@ -1,4 +1,4 @@
-/* $Id: man.c,v 1.20 2009/06/16 19:13:28 kristaps Exp $ */
+/* $Id: man.c,v 1.21 2009/06/16 19:55:28 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -24,12 +24,12 @@
#include "libman.h"
const char *const __man_macronames[MAN_MAX] = {
- "\\\"", "TH", "SH", "SS",
+ "br", "TH", "SH", "SS",
"TP", "LP", "PP", "P",
"IP", "HP", "SM", "SB",
"BI", "IB", "BR", "RB",
"R", "B", "I", "IR",
- "RI", "br", "na", "i"
+ "RI", "na", "i"
};
const char * const *man_macronames = __man_macronames;
diff --git a/man.h b/man.h
index 2ae6946c..0efbebdc 100644
--- a/man.h
+++ b/man.h
@@ -1,4 +1,4 @@
-/* $Id: man.h,v 1.12 2009/06/10 20:18:43 kristaps Exp $ */
+/* $Id: man.h,v 1.13 2009/06/16 19:55:28 kristaps Exp $ */
/*
* Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -19,7 +19,7 @@
#include <time.h>
-#define MAN___ 0
+#define MAN_br 0
#define MAN_TH 1
#define MAN_SH 2
#define MAN_SS 3
@@ -40,10 +40,9 @@
#define MAN_I 18
#define MAN_IR 19
#define MAN_RI 20
-#define MAN_br 21
-#define MAN_na 22
-#define MAN_i 23
-#define MAN_MAX 24
+#define MAN_na 21
+#define MAN_i 22
+#define MAN_MAX 23
enum man_type {
MAN_TEXT,
diff --git a/man_action.c b/man_action.c
index 6c7b1e42..df9cb5f0 100644
--- a/man_action.c
+++ b/man_action.c
@@ -1,4 +1,4 @@
-/* $Id: man_action.c,v 1.11 2009/06/10 20:18:43 kristaps Exp $ */
+/* $Id: man_action.c,v 1.12 2009/06/16 19:55:28 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -36,7 +36,7 @@ static int post_TH(struct man *);
static time_t man_atotime(const char *);
const struct actions man_actions[MAN_MAX] = {
- { NULL }, /* __ */
+ { NULL }, /* br */
{ post_TH }, /* TH */
{ NULL }, /* SH */
{ NULL }, /* SS */
@@ -57,7 +57,6 @@ const struct actions man_actions[MAN_MAX] = {
{ NULL }, /* I */
{ NULL }, /* IR */
{ NULL }, /* RI */
- { NULL }, /* br */
{ NULL }, /* na */
{ NULL }, /* i */
};
diff --git a/man_hash.c b/man_hash.c
index 599c9f3f..e89244a9 100644
--- a/man_hash.c
+++ b/man_hash.c
@@ -1,4 +1,4 @@
-/* $Id: man_hash.c,v 1.8 2009/06/10 20:18:43 kristaps Exp $ */
+/* $Id: man_hash.c,v 1.9 2009/06/16 19:55:28 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -41,7 +41,7 @@ man_hash_alloc(void)
if (NULL == htab)
return(NULL);
- for (i = 1; i < MAN_MAX; i++) {
+ for (i = 0; i < MAN_MAX; i++) {
x = man_macronames[i][0];
assert((x >= 65 && x <= 90) ||
diff --git a/man_macro.c b/man_macro.c
index 1fce4a04..e619f452 100644
--- a/man_macro.c
+++ b/man_macro.c
@@ -1,4 +1,4 @@
-/* $Id: man_macro.c,v 1.15 2009/06/10 20:18:43 kristaps Exp $ */
+/* $Id: man_macro.c,v 1.16 2009/06/16 19:55:28 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -28,7 +28,7 @@ static int man_args(struct man *, int,
int *, char *, char **);
static int man_flags[MAN_MAX] = {
- 0, /* __ */
+ 0, /* br */
0, /* TH */
0, /* SH */
0, /* SS */
@@ -49,7 +49,6 @@ static int man_flags[MAN_MAX] = {
FL_NLINE, /* I */
FL_NLINE, /* IR */
FL_NLINE, /* RI */
- 0, /* br */
0, /* na */
FL_NLINE, /* i */
};
diff --git a/man_term.c b/man_term.c
index b07602d3..c832c9f7 100644
--- a/man_term.c
+++ b/man_term.c
@@ -1,4 +1,4 @@
-/* $Id: man_term.c,v 1.13 2009/06/15 20:26:47 kristaps Exp $ */
+/* $Id: man_term.c,v 1.14 2009/06/16 19:55:28 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -57,7 +57,7 @@ static void post_SH(DECL_ARGS);
static void post_SS(DECL_ARGS);
static const struct termact termacts[MAN_MAX] = {
- { NULL, NULL }, /* __ */
+ { pre_PP, NULL }, /* br */
{ NULL, NULL }, /* TH */
{ pre_SH, post_SH }, /* SH */
{ pre_SS, post_SS }, /* SS */
@@ -78,7 +78,6 @@ static const struct termact termacts[MAN_MAX] = {
{ pre_I, post_I }, /* I */
{ pre_IR, NULL }, /* IR */
{ pre_RI, NULL }, /* RI */
- { pre_PP, NULL }, /* br */
{ NULL, NULL }, /* na */
{ pre_I, post_I }, /* i */
};
@@ -97,7 +96,10 @@ man_run(struct termp *p, const struct man *m)
print_head(p, man_meta(m));
p->flags |= TERMP_NOSPACE;
- print_body(p, man_node(m), man_meta(m));
+ assert(man_node(m));
+ assert(MAN_ROOT == man_node(m)->type);
+ if (man_node(m)->child)
+ print_body(p, man_node(m)->child, man_meta(m));
print_foot(p, man_meta(m));
return(1);
diff --git a/man_validate.c b/man_validate.c
index 61c199b6..95452589 100644
--- a/man_validate.c
+++ b/man_validate.c
@@ -1,4 +1,4 @@
-/* $Id: man_validate.c,v 1.9 2009/06/10 20:18:43 kristaps Exp $ */
+/* $Id: man_validate.c,v 1.10 2009/06/16 19:55:28 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -48,7 +48,7 @@ static v_post posts_eq0[] = { check_eq0, NULL };
static v_post posts_ge2_le5[] = { check_ge2, check_le5, NULL };
static const struct man_valid man_valids[MAN_MAX] = {
- { NULL }, /* __ */
+ { posts_eq0 }, /* br */
{ posts_ge2_le5 }, /* TH */
{ posts_ge1 }, /* SH */
{ posts_ge1 }, /* SS */
@@ -69,7 +69,6 @@ static const struct man_valid man_valids[MAN_MAX] = {
{ NULL }, /* I */
{ NULL }, /* IR */
{ NULL }, /* RI */
- { posts_eq0 }, /* br */
{ posts_eq0 }, /* na */
{ NULL }, /* i */
};
diff --git a/mdoc_hash.c b/mdoc_hash.c
index ac1a4701..013856bf 100644
--- a/mdoc_hash.c
+++ b/mdoc_hash.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_hash.c,v 1.4 2009/06/10 20:18:43 kristaps Exp $ */
+/* $Id: mdoc_hash.c,v 1.5 2009/06/16 19:55:28 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -46,7 +46,7 @@ mdoc_hash_alloc(void)
if (NULL == htab)
return(NULL);
- for (i = 1; i < MDOC_MAX; i++) {
+ for (i = 0; i < MDOC_MAX; i++) {
major = mdoc_macronames[i][0];
assert((major >= 65 && major <= 90) ||
major == 37);