source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Step 4: merge chars.h into out.h.
@ 2011-03-22 10:13 kristaps
  0 siblings, 0 replies; only message in thread
From: kristaps @ 2011-03-22 10:13 UTC (permalink / raw)
  To: source

Log Message:
-----------
Step 4: merge chars.h into out.h.  The functions in this file are
necessary to all [real] front-ends, so stop pretending it's special.
While here, add some documentation to the variable types.

Modified Files:
--------------
    mdocml:
        Makefile
        chars.c
        html.c
        man_term.c
        mdoc_term.c
        out.h
        term.c

Removed Files:
-------------
    mdocml:
        chars.h

Revision Data
-------------
Index: term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/term.c,v
retrieving revision 1.180
retrieving revision 1.181
diff -Lterm.c -Lterm.c -u -p -r1.180 -r1.181
--- term.c
+++ term.c
@@ -29,7 +29,6 @@
 #include <string.h>
 
 #include "mandoc.h"
-#include "chars.h"
 #include "out.h"
 #include "term.h"
 #include "main.h"
Index: chars.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/chars.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -Lchars.c -Lchars.c -u -p -r1.33 -r1.34
--- chars.c
+++ chars.c
@@ -25,7 +25,7 @@
 #include <string.h>
 
 #include "mandoc.h"
-#include "chars.h"
+#include "out.h"
 
 #define	PRINT_HI	 126
 #define	PRINT_LO	 32
Index: html.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/html.c,v
retrieving revision 1.129
retrieving revision 1.130
diff -Lhtml.c -Lhtml.c -u -p -r1.129 -r1.130
--- html.c
+++ html.c
@@ -32,7 +32,6 @@
 
 #include "mandoc.h"
 #include "out.h"
-#include "chars.h"
 #include "html.h"
 #include "main.h"
 
Index: out.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/out.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -Lout.h -Lout.h -u -p -r1.17 -r1.18
--- out.h
+++ out.h
@@ -17,34 +17,17 @@
 #ifndef OUT_H
 #define OUT_H
 
-__BEGIN_DECLS
-
-struct	roffcol {
-	size_t		 width; /* width of cell */
-	size_t		 decimal; /* decimal position in cell */
-};
-
-typedef	size_t (*tbl_strlen)(const char *, void *);
-typedef	size_t (*tbl_len)(size_t, void *);
-
-struct	rofftbl {
-	tbl_strlen	 slen; /* calculate string length */
-	tbl_len		 len; /* produce width of empty space */
-	struct roffcol	*cols; /* master column specifiers */
-	void		*arg; /* passed to slen and len */
-};
-
 enum	roffscale {
-	SCALE_CM,
-	SCALE_IN,
-	SCALE_PC,
-	SCALE_PT,
-	SCALE_EM,
-	SCALE_MM,
-	SCALE_EN,
-	SCALE_BU,
-	SCALE_VS,
-	SCALE_FS,
+	SCALE_CM, /* centimeters (c) */
+	SCALE_IN, /* inches (i) */
+	SCALE_PC, /* pica (P) */
+	SCALE_PT, /* points (p) */
+	SCALE_EM, /* ems (m) */
+	SCALE_MM, /* mini-ems (M) */
+	SCALE_EN, /* ens (n) */
+	SCALE_BU, /* default horizontal (u) */
+	SCALE_VS, /* default vertical (v) */
+	SCALE_FS, /* syn. for u (f) */
 	SCALE_MAX
 };
 
@@ -64,11 +47,33 @@ enum	roffdeco {
 	DECO_MAX
 };
 
+enum	chars {
+	CHARS_ASCII, /* 7-bit ascii representation */
+	CHARS_HTML /* unicode values */
+};
+
+struct	roffcol {
+	size_t		 width; /* width of cell */
+	size_t		 decimal; /* decimal position in cell */
+};
+
 struct	roffsu {
 	enum roffscale	  unit;
 	double		  scale;
 };
 
+typedef	size_t	(*tbl_strlen)(const char *, void *);
+typedef	size_t	(*tbl_len)(size_t, void *);
+
+struct	rofftbl {
+	tbl_strlen	 slen; /* calculate string length */
+	tbl_len		 len; /* produce width of empty space */
+	struct roffcol	*cols; /* master column specifiers */
+	void		*arg; /* passed to slen and len */
+};
+
+__BEGIN_DECLS
+
 #define	SCALE_VS_INIT(p, v) \
 	do { (p)->unit = SCALE_VS; \
 	     (p)->scale = (v); } \
@@ -79,10 +84,18 @@ struct	roffsu {
 	     (p)->scale = (v); } \
 	while (/* CONSTCOND */ 0)
 
-int	  a2roffsu(const char *, struct roffsu *, enum roffscale);
-int	  a2roffdeco(enum roffdeco *, const char **, size_t *);
-void	  time2a(time_t, char *, size_t);
-void	  tblcalc(struct rofftbl *tbl, const struct tbl_span *);
+int	  	  a2roffsu(const char *, struct roffsu *, enum roffscale);
+int	  	  a2roffdeco(enum roffdeco *, const char **, size_t *);
+void	  	  time2a(time_t, char *, size_t);
+void	  	  tblcalc(struct rofftbl *tbl, const struct tbl_span *);
+
+void		 *chars_init(enum chars);
+const char	 *chars_num2char(const char *, size_t);
+const char	 *chars_spec2str(void *, const char *, size_t, size_t *);
+int		  chars_spec2cp(void *, const char *, size_t);
+const char	 *chars_res2str(void *, const char *, size_t, size_t *);
+int		  chars_res2cp(void *, const char *, size_t);
+void		  chars_free(void *);
 
 __END_DECLS
 
--- chars.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*	$Id: chars.h,v 1.7 2011/01/30 16:05:37 schwarze Exp $ */
-/*
- * Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2011 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
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * 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.
- */
-#ifndef CHARS_H
-#define CHARS_H
-
-__BEGIN_DECLS
-
-enum	chars {
-	CHARS_ASCII,
-	CHARS_HTML
-};
-
-void		 *chars_init(enum chars);
-const char	 *chars_num2char(const char *, size_t);
-const char	 *chars_spec2str(void *, const char *, size_t, size_t *);
-int		  chars_spec2cp(void *, const char *, size_t);
-const char	 *chars_res2str(void *, const char *, size_t, size_t *);
-int		  chars_res2cp(void *, const char *, size_t);
-void		  chars_free(void *);
-
-__END_DECLS
-
-#endif /*!CHARS_H*/
Index: man_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_term.c,v
retrieving revision 1.104
retrieving revision 1.105
diff -Lman_term.c -Lman_term.c -u -p -r1.104 -r1.105
--- man_term.c
+++ man_term.c
@@ -31,7 +31,6 @@
 #include "out.h"
 #include "man.h"
 #include "term.h"
-#include "chars.h"
 #include "main.h"
 
 #define	INDENT		  7
Index: mdoc_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v
retrieving revision 1.220
retrieving revision 1.221
diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.220 -r1.221
--- mdoc_term.c
+++ mdoc_term.c
@@ -32,7 +32,6 @@
 #include "out.h"
 #include "term.h"
 #include "mdoc.h"
-#include "chars.h"
 #include "main.h"
 
 #define	INDENT		  5
Index: Makefile
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/Makefile,v
retrieving revision 1.317
retrieving revision 1.318
diff -LMakefile -LMakefile -u -p -r1.317 -r1.318
--- Makefile
+++ Makefile
@@ -94,7 +94,7 @@ DATAS	   = arch.in att.in lib.in msec.in
 	     vol.in chars.in
 
 HEADS	   = mdoc.h libmdoc.h man.h libman.h term.h \
-	     libmandoc.h html.h chars.h out.h main.h \
+	     libmandoc.h html.h out.h main.h \
 	     mandoc.h libroff.h
 
 GSGMLS	   = mandoc.1.sgml mdoc.7.sgml \
@@ -207,7 +207,7 @@ arch.ln arch.o: arch.c arch.in libmdoc.h
 
 vol.ln vol.o: vol.c vol.in libmdoc.h
 
-chars.ln chars.o: chars.c chars.in chars.h
+chars.ln chars.o: chars.c chars.in 
 
 msec.ln msec.o: msec.c msec.in libmdoc.h
 
@@ -229,13 +229,13 @@ main.ln main.o: main.c mdoc.h man.h 
 
 compat.ln compat.o: compat.c 
 
-term.ln term.o: term.c term.h man.h mdoc.h chars.h
+term.ln term.o: term.c term.h man.h mdoc.h 
 
 term_ps.ln term_ps.o: term_ps.c term.h main.h
 
 term_ascii.ln term_ascii.o: term_ascii.c term.h main.h
 
-html.ln html.o: html.c html.h chars.h
+html.ln html.o: html.c html.h
 
 mdoc_html.ln mdoc_html.o: mdoc_html.c html.h mdoc.h
 
--
 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 10:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-22 10:13 mdocml: Step 4: merge chars.h into out.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).