source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Step 1 of restructuring: libmandoc.h.
@ 2011-03-22  9:48 kristaps
  0 siblings, 0 replies; only message in thread
From: kristaps @ 2011-03-22  9:48 UTC (permalink / raw)
  To: source

Log Message:
-----------
Step 1 of restructuring: libmandoc.h.  Move all compiler-set-specific
stuff into libmandoc.h, including old mdoc.h/man.h/roff.h functions now
used by read.c.  The motivation behind this is to tighten the
relationship between the underlying compilers while keeping parse data
hidden from general callers (e.g., main.c).

While here, also move register values from mandoc.h into libmandoc.h as
noted by schwarze@.  See above for explanation.

Modified Files:
--------------
    mdocml:
        eqn.c
        libmandoc.h
        man.h
        mandoc.h
        mdoc.h
        roff.h
        tbl.c

Revision Data
-------------
Index: eqn.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/eqn.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -Leqn.c -Leqn.c -u -p -r1.3 -r1.4
--- eqn.c
+++ eqn.c
@@ -25,7 +25,6 @@
 #include <time.h>
 
 #include "mandoc.h"
-#include "roff.h"
 #include "libmandoc.h"
 #include "libroff.h"
 
Index: man.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man.h,v
retrieving revision 1.55
retrieving revision 1.56
diff -Lman.h -Lman.h -u -p -r1.55 -r1.56
--- man.h
+++ man.h
@@ -116,15 +116,6 @@ __BEGIN_DECLS
 
 struct	man;
 
-void	 	  man_free(struct man *);
-struct	man	 *man_alloc(struct regset *, struct mparse *);
-void		  man_reset(struct man *);
-int	 	  man_parseln(struct man *, int, char *, int);
-int		  man_endparse(struct man *);
-int		  man_addspan(struct man *,
-			const struct tbl_span *);
-int		  man_addeqn(struct man *, const struct eqn *);
-
 const struct man_node *man_node(const struct man *);
 const struct man_meta *man_meta(const struct man *);
 
Index: mdoc.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc.h,v
retrieving revision 1.119
retrieving revision 1.120
diff -Lmdoc.h -Lmdoc.h -u -p -r1.119 -r1.120
--- mdoc.h
+++ mdoc.h
@@ -423,17 +423,8 @@ __BEGIN_DECLS
 
 struct	mdoc;
 
-void	 	  mdoc_free(struct mdoc *);
-struct	mdoc	 *mdoc_alloc(struct regset *, struct mparse *);
-void		  mdoc_reset(struct mdoc *);
-int	 	  mdoc_parseln(struct mdoc *, int, char *, int);
 const struct mdoc_node *mdoc_node(const struct mdoc *);
 const struct mdoc_meta *mdoc_meta(const struct mdoc *);
-int		  mdoc_endparse(struct mdoc *);
-int		  mdoc_addspan(struct mdoc *,
-			const struct tbl_span *);
-int		  mdoc_addeqn(struct mdoc *,
-			const struct eqn *);
 
 __END_DECLS
 
Index: tbl.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/tbl.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -Ltbl.c -Ltbl.c -u -p -r1.23 -r1.24
--- tbl.c
+++ tbl.c
@@ -22,7 +22,6 @@
 #include <time.h>
 
 #include "mandoc.h"
-#include "roff.h"
 #include "libmandoc.h"
 #include "libroff.h"
 
Index: roff.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/roff.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -Lroff.h -Lroff.h -u -p -r1.25 -r1.26
--- roff.h
+++ roff.h
@@ -17,30 +17,7 @@
 #ifndef ROFF_H
 #define ROFF_H
 
-enum	rofferr {
-	ROFF_CONT, /* continue processing line */
-	ROFF_RERUN, /* re-run roff interpreter with offset */
-	ROFF_APPEND, /* re-run main parser, appending next line */
-	ROFF_REPARSE, /* re-run main parser on the result */
-	ROFF_SO, /* include another file */
-	ROFF_IGN, /* ignore current line */
-	ROFF_TBL, /* a table row was successfully parsed */
-	ROFF_EQN, /* an equation was successfully parsed */
-	ROFF_ERR /* badness: puke and stop */
-};
-
 __BEGIN_DECLS
-
-struct	roff;
-
-void	 	  roff_free(struct roff *);
-struct	roff	 *roff_alloc(struct regset *, struct mparse *);
-void		  roff_reset(struct roff *);
-enum	rofferr	  roff_parseln(struct roff *, int, 
-			char **, size_t *, int, int *);
-void		  roff_endparse(struct roff *);
-const struct tbl_span *roff_span(const struct roff *);
-const struct eqn *roff_eqn(const struct roff *);
 
 __END_DECLS
 
Index: mandoc.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandoc.h,v
retrieving revision 1.64
retrieving revision 1.65
diff -Lmandoc.h -Lmandoc.h -u -p -r1.64 -r1.65
--- mandoc.h
+++ mandoc.h
@@ -277,42 +277,6 @@ struct	eqn {
 };
 
 /*
- * Available registers (set in libroff, accessed elsewhere).
- */
-enum	regs {
-	REG_nS = 0,
-	REG__MAX
-};
-
-/*
- * A register (struct reg) can consist of many types: this consists of
- * normalised types from the original string form.
- */
-union	regval {
-	unsigned  u; /* unsigned integer */
-};
-
-/*
- * A single register entity.  If "set" is zero, the value of the
- * register should be the default one, which is per-register.  It's
- * assumed that callers know which type in "v" corresponds to which
- * register value.
- */
-struct	reg {
-	int		  set; /* whether set or not */
-	union regval	  v; /* parsed data */
-};
-
-/*
- * The primary interface to setting register values is in libroff,
- * although libmdoc and libman from time to time will manipulate
- * registers (such as `.Sh SYNOPSIS' enabling REG_nS).
- */
-struct	regset {
-	struct reg	  regs[REG__MAX];
-};
-
-/*
  * A punctuation delimiter, used only in mdoc(7) documents, is opening,
  * closing, or "middle mark" punctuation.  These govern spacing.
  * Opening punctuation (e.g., the opening parenthesis) suppresses the
Index: libmandoc.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/libmandoc.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -Llibmandoc.h -Llibmandoc.h -u -p -r1.13 -r1.14
--- libmandoc.h
+++ libmandoc.h
@@ -17,18 +17,97 @@
 #ifndef LIBMANDOC_H
 #define LIBMANDOC_H
 
+enum	rofferr {
+	ROFF_CONT, /* continue processing line */
+	ROFF_RERUN, /* re-run roff interpreter with offset */
+	ROFF_APPEND, /* re-run main parser, appending next line */
+	ROFF_REPARSE, /* re-run main parser on the result */
+	ROFF_SO, /* include another file */
+	ROFF_IGN, /* ignore current line */
+	ROFF_TBL, /* a table row was successfully parsed */
+	ROFF_EQN, /* an equation was successfully parsed */
+	ROFF_ERR /* badness: puke and stop */
+};
+
+/*
+ * Available registers (set in libroff, accessed elsewhere).
+ */
+enum	regs {
+	REG_nS = 0,
+	REG__MAX
+};
+
+/*
+ * A register (struct reg) can consist of many types: this consists of
+ * normalised types from the original string form.
+ */
+union	regval {
+	unsigned  u; /* unsigned integer */
+};
+
+/*
+ * A single register entity.  If "set" is zero, the value of the
+ * register should be the default one, which is per-register.  It's
+ * assumed that callers know which type in "v" corresponds to which
+ * register value.
+ */
+struct	reg {
+	int		  set; /* whether set or not */
+	union regval	  v; /* parsed data */
+};
+
+/*
+ * The primary interface to setting register values is in libroff,
+ * although libmdoc and libman from time to time will manipulate
+ * registers (such as `.Sh SYNOPSIS' enabling REG_nS).
+ */
+struct	regset {
+	struct reg	  regs[REG__MAX];
+};
+
 __BEGIN_DECLS
 
-void	 mandoc_msg(enum mandocerr, struct mparse *, 
-		int, int, const char *);
-void	 mandoc_vmsg(enum mandocerr, struct mparse *, 
-		int, int, const char *, ...);
-int	 mandoc_special(char *);
-char	*mandoc_strdup(const char *);
-char	*mandoc_getarg(struct mparse *, char **, int, int *);
-char	*mandoc_normdate(struct mparse *, char *, int, int);
-int	 mandoc_eos(const char *, size_t, int);
-int	 mandoc_hyph(const char *, const char *);
+struct	roff;
+struct	mdoc;
+struct	man;
+
+void		 mandoc_msg(enum mandocerr, struct mparse *, 
+			int, int, const char *);
+void		 mandoc_vmsg(enum mandocerr, struct mparse *, 
+			int, int, const char *, ...);
+int		 mandoc_special(char *);
+char		 *mandoc_strdup(const char *);
+char		 *mandoc_getarg(struct mparse *, char **, int, int *);
+char		 *mandoc_normdate(struct mparse *, char *, int, int);
+int		 mandoc_eos(const char *, size_t, int);
+int		 mandoc_hyph(const char *, const char *);
+
+void	 	 mdoc_free(struct mdoc *);
+struct	mdoc	*mdoc_alloc(struct regset *, struct mparse *);
+void		 mdoc_reset(struct mdoc *);
+int	 	 mdoc_parseln(struct mdoc *, int, char *, int);
+int		 mdoc_endparse(struct mdoc *);
+int		 mdoc_addspan(struct mdoc *, const struct tbl_span *);
+int		 mdoc_addeqn(struct mdoc *, const struct eqn *);
+
+void	 	 man_free(struct man *);
+struct	man	*man_alloc(struct regset *, struct mparse *);
+void		 man_reset(struct man *);
+int	 	 man_parseln(struct man *, int, char *, int);
+int		 man_endparse(struct man *);
+int		 man_addspan(struct man *, const struct tbl_span *);
+int		 man_addeqn(struct man *, const struct eqn *);
+
+void	 	 roff_free(struct roff *);
+struct roff	*roff_alloc(struct regset *, struct mparse *);
+void		 roff_reset(struct roff *);
+enum rofferr	 roff_parseln(struct roff *, int, 
+			char **, size_t *, int, int *);
+void		  roff_endparse(struct roff *);
+
+const struct tbl_span *roff_span(const struct roff *);
+const struct eqn *roff_eqn(const struct roff *);
+
 
 __END_DECLS
 
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-03-22  9:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-22  9:48 mdocml: Step 1 of restructuring: libmandoc.h kristaps

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).