aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/term_ascii.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-05-17 14:38:34 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-05-17 14:38:34 +0000
commit0587ad80d46d89f36315c37bbd67cf8899708b8d (patch)
treef6e1521213cb40a637bdb175e43f121249534ba3 /term_ascii.c
parent79f16537cd09bc054f9d18169708d63030803d98 (diff)
downloadmandoc-0587ad80d46d89f36315c37bbd67cf8899708b8d.tar.gz
mandoc-0587ad80d46d89f36315c37bbd67cf8899708b8d.tar.zst
mandoc-0587ad80d46d89f36315c37bbd67cf8899708b8d.zip
Add mode for -Tlocale. This mode, with this commit, behaves exactly
like -Tascii. While adding this, inline term_alloc() (was a one-liner), remove some switches around the terminal encoding for the symbol table (unnecessary), and split out ascii_alloc() into ascii_init(), which is also called from locale_init().
Diffstat (limited to 'term_ascii.c')
-rw-r--r--term_ascii.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/term_ascii.c b/term_ascii.c
index fd7005f0..5b2ee847 100644
--- a/term_ascii.c
+++ b/term_ascii.c
@@ -1,4 +1,4 @@
-/* $Id: term_ascii.c,v 1.13 2011/05/14 17:54:42 kristaps Exp $ */
+/* $Id: term_ascii.c,v 1.14 2011/05/17 14:38:34 kristaps Exp $ */
/*
* Copyright (c) 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -31,6 +31,7 @@
#include "term.h"
#include "main.h"
+static struct termp *ascii_init(enum termenc, char *);
static double ascii_hspan(const struct termp *,
const struct roffsu *);
static size_t ascii_width(const struct termp *, int);
@@ -40,15 +41,15 @@ static void ascii_end(struct termp *);
static void ascii_endline(struct termp *);
static void ascii_letter(struct termp *, int);
-
-void *
-ascii_alloc(char *outopts)
+static struct termp *
+ascii_init(enum termenc enc, char *outopts)
{
- struct termp *p;
const char *toks[2];
char *v;
+ struct termp *p;
- p = term_alloc(TERMENC_ASCII);
+ p = mandoc_calloc(1, sizeof(struct termp));
+ p->enc = enc;
p->tabwidth = 5;
p->defrmargin = 78;
@@ -81,6 +82,19 @@ ascii_alloc(char *outopts)
return(p);
}
+void *
+ascii_alloc(char *outopts)
+{
+
+ return(ascii_init(TERMENC_ASCII, outopts));
+}
+
+void *
+locale_alloc(char *outopts)
+{
+
+ return(ascii_init(TERMENC_LOCALE, outopts));
+}
/* ARGSUSED */
static size_t