=================================================================== RCS file: /cvs/mandoc/term_ascii.c,v retrieving revision 1.37 retrieving revision 1.39 diff -u -p -r1.37 -r1.39 --- mandoc/term_ascii.c 2014/10/28 02:43:59 1.37 +++ mandoc/term_ascii.c 2014/10/28 18:49:33 1.39 @@ -1,4 +1,4 @@ -/* $Id: term_ascii.c,v 1.37 2014/10/28 02:43:59 schwarze Exp $ */ +/* $Id: term_ascii.c,v 1.39 2014/10/28 18:49:33 schwarze Exp $ */ /* * Copyright (c) 2010, 2011 Kristaps Dzonsons * Copyright (c) 2014 Ingo Schwarze @@ -19,6 +19,7 @@ #include +#include #if HAVE_WCHAR #include #endif @@ -36,7 +37,8 @@ #include "term.h" #include "main.h" -static struct termp *ascii_init(enum termenc, char *); +static struct termp *ascii_init(enum termenc, + const struct mchars *, char *); static double ascii_hspan(const struct termp *, const struct roffsu *); static size_t ascii_width(const struct termp *, int); @@ -56,7 +58,7 @@ static size_t locale_width(const struct termp *, in static struct termp * -ascii_init(enum termenc enc, char *outopts) +ascii_init(enum termenc enc, const struct mchars *mchars, char *outopts) { const char *toks[5]; char *v; @@ -64,6 +66,7 @@ ascii_init(enum termenc enc, char *outopts) p = mandoc_calloc(1, sizeof(struct termp)); + p->symtab = mchars; p->tabwidth = 5; p->defrmargin = p->lastrmargin = 78; @@ -131,24 +134,24 @@ ascii_init(enum termenc enc, char *outopts) } void * -ascii_alloc(char *outopts) +ascii_alloc(const struct mchars *mchars, char *outopts) { - return(ascii_init(TERMENC_ASCII, outopts)); + return(ascii_init(TERMENC_ASCII, mchars, outopts)); } void * -utf8_alloc(char *outopts) +utf8_alloc(const struct mchars *mchars, char *outopts) { - return(ascii_init(TERMENC_UTF8, outopts)); + return(ascii_init(TERMENC_UTF8, mchars, outopts)); } void * -locale_alloc(char *outopts) +locale_alloc(const struct mchars *mchars, char *outopts) { - return(ascii_init(TERMENC_LOCALE, outopts)); + return(ascii_init(TERMENC_LOCALE, mchars, outopts)); } static void @@ -335,8 +338,7 @@ ascii_uc2str(int uc) "j", "DZ", "Dz", "dz", "'\bG", "'\bg", "HV", "W", "`\bN", "`\bn", "A", "a", "'\bAE","'\bae","O", "o"}; - if (uc < 0) - return(""); + assert(uc >= 0); if ((size_t)uc < sizeof(tab)/sizeof(tab[0])) return(tab[uc]); return(mchars_uc2str(uc));