aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2018-12-13 06:18:20 +0000
committerIngo Schwarze <schwarze@openbsd.org>2018-12-13 06:18:20 +0000
commitef4eacb2307e8303d7e4555864132f376af2ac59 (patch)
tree202e7b3ffd4ddb1199d4efc1c3392e240fc0f9ea
parent32c0933851c645dfc5d1af1bda32e80c9f237254 (diff)
downloadmandoc-ef4eacb2307e8303d7e4555864132f376af2ac59.tar.gz
mandoc-ef4eacb2307e8303d7e4555864132f376af2ac59.tar.zst
mandoc-ef4eacb2307e8303d7e4555864132f376af2ac59.zip
Cleanup, no functional change:
Move the roffhash_*() functions from roff.h to roff_int.h because they are only intended for use by parsers, neither by main programs nor by formatters.
-rw-r--r--mandoc_headers.322
-rw-r--r--read.c3
-rw-r--r--roff.h7
-rw-r--r--roff_int.h10
4 files changed, 29 insertions, 13 deletions
diff --git a/mandoc_headers.3 b/mandoc_headers.3
index 0adbf5a2..4c8ce5c2 100644
--- a/mandoc_headers.3
+++ b/mandoc_headers.3
@@ -167,6 +167,9 @@ and the functions
and
.Fn mandoc_xr_free .
.It Qq Pa roff.h
+Common data types for all syntax trees and related functions;
+can be used everywhere.
+.Pp
Requires
.Qq Pa mandoc_ohash.h
for
@@ -189,10 +192,7 @@ Provides
the constant array
.Va roff_name
and the functions
-.Fn deroff ,
-.Fn roffhash_alloc ,
-.Fn roffhash_find ,
-.Fn roffhash_free ,
+.Fn deroff
and
.Fn roff_validate .
.Pp
@@ -300,14 +300,24 @@ from
.Pa roff.h
as an opaque type for function prototypes.
.It Qq Pa roff_int.h
+Parser internals shared by multiple parsers.
+Can be used in all parsers, but not in main programs or formatters.
+.Pp
Requires
.Qq Pa roff.h
for
-.Vt enum roff_type .
+.Vt enum roff_type
+and
+.Vt enum roff_tok .
.Pp
Provides functions named
.Fn roff_*
-to handle roff nodes and the two special functions
+to handle roff nodes,
+.Fn roffhash_alloc ,
+.Fn roffhash_find ,
+and
+.Fn roffhash_free ,
+and the two special functions
.Fn man_breakscope
and
.Fn mdoc_argv_free
diff --git a/read.c b/read.c
index e9971a66..37862e38 100644
--- a/read.c
+++ b/read.c
@@ -1,4 +1,4 @@
-/* $Id: read.c,v 1.200 2018/08/25 16:53:39 schwarze Exp $ */
+/* $Id: read.c,v 1.201 2018/12/13 06:18:20 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010-2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -39,6 +39,7 @@
#include "mdoc.h"
#include "man.h"
#include "libmandoc.h"
+#include "roff_int.h"
#define REPARSE_LIMIT 1000
diff --git a/roff.h b/roff.h
index 786f16eb..cc964bed 100644
--- a/roff.h
+++ b/roff.h
@@ -1,4 +1,4 @@
-/* $Id: roff.h,v 1.62 2018/12/13 02:06:07 schwarze Exp $ */
+/* $Id: roff.h,v 1.63 2018/12/13 06:18:20 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2013,2014,2015,2017,2018 Ingo Schwarze <schwarze@openbsd.org>
@@ -14,6 +14,8 @@
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Common data types for all syntax trees and related functions.
*/
struct ohash;
@@ -577,7 +579,4 @@ extern const char *const *roff_name;
void deroff(char **, const struct roff_node *);
-struct ohash *roffhash_alloc(enum roff_tok, enum roff_tok);
-enum roff_tok roffhash_find(struct ohash *, const char *, size_t);
-void roffhash_free(struct ohash *);
void roff_validate(struct roff_man *);
diff --git a/roff_int.h b/roff_int.h
index 0d280890..8b49065e 100644
--- a/roff_int.h
+++ b/roff_int.h
@@ -1,7 +1,7 @@
-/* $Id: roff_int.h,v 1.10 2018/12/04 02:53:51 schwarze Exp $ */
+/* $Id: roff_int.h,v 1.11 2018/12/13 06:18:20 schwarze Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2013, 2014, 2015, 2018 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2013,2014,2015,2017,2018 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -14,6 +14,8 @@
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Parser internals shared by multiple parsers.
*/
struct roff_node *roff_node_alloc(struct roff_man *, int, int,
@@ -30,6 +32,10 @@ void roff_node_relink(struct roff_man *, struct roff_node *);
void roff_node_free(struct roff_node *);
void roff_node_delete(struct roff_man *, struct roff_node *);
+struct ohash *roffhash_alloc(enum roff_tok, enum roff_tok);
+enum roff_tok roffhash_find(struct ohash *, const char *, size_t);
+void roffhash_free(struct ohash *);
+
/*
* Functions called from roff.c need to be declared here,
* not in libmdoc.h or libman.h, even if they are specific