diff options
-rw-r--r-- | Makefile | 8 | ||||
-rw-r--r-- | chars.c | 2 | ||||
-rw-r--r-- | chars.h | 38 | ||||
-rw-r--r-- | html.c | 1 | ||||
-rw-r--r-- | man_term.c | 1 | ||||
-rw-r--r-- | mdoc_term.c | 1 | ||||
-rw-r--r-- | out.h | 75 | ||||
-rw-r--r-- | term.c | 1 |
8 files changed, 49 insertions, 78 deletions
@@ -94,7 +94,7 @@ DATAS = arch.in att.in lib.in msec.in st.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 @@ -25,7 +25,7 @@ #include <string.h> #include "mandoc.h" -#include "chars.h" +#include "out.h" #define PRINT_HI 126 #define PRINT_LO 32 diff --git a/chars.h b/chars.h deleted file mode 100644 index 70abd3b2..00000000 --- a/chars.h +++ /dev/null @@ -1,38 +0,0 @@ -/* $Id$ */ -/* - * 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*/ @@ -32,7 +32,6 @@ #include "mandoc.h" #include "out.h" -#include "chars.h" #include "html.h" #include "main.h" @@ -31,7 +31,6 @@ #include "out.h" #include "man.h" #include "term.h" -#include "chars.h" #include "main.h" #define INDENT 7 diff --git a/mdoc_term.c b/mdoc_term.c index 5642ce06..16bfcd4a 100644 --- a/mdoc_term.c +++ b/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 @@ -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 @@ -29,7 +29,6 @@ #include <string.h> #include "mandoc.h" -#include "chars.h" #include "out.h" #include "term.h" #include "main.h" |