From 142f3db069bd40d760a2926765c0e051b7789cdf Mon Sep 17 00:00:00 2001 From: Kristaps Dzonsons Date: Sun, 18 Jul 2010 22:55:06 +0000 Subject: Throw out a2roffdeco() in out.c for a readable version. The prior one was completely unmaintainable. The new one is both readable and quite similar to mandoc_special(), which in future versions will easily allow throwing-away of unsupported escapes (such as \m). It's also a fair bit smaller. DECO_SIZE has been removed: this crap, like colours, will not be supported. mandoc_special() also has #if 0'd switch branches for ALL groff.7 escapes and some lint fixes. --- mandoc.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 2 deletions(-) (limited to 'mandoc.c') diff --git a/mandoc.c b/mandoc.c index 80972279..83dafb33 100644 --- a/mandoc.c +++ b/mandoc.c @@ -48,6 +48,49 @@ mandoc_special(char *p) p++; switch (*p++) { +#if 0 + case ('Z'): + /* FALLTHROUGH */ + case ('X'): + /* FALLTHROUGH */ + case ('x'): + /* FALLTHROUGH */ + case ('w'): + /* FALLTHROUGH */ + case ('v'): + /* FALLTHROUGH */ + case ('S'): + /* FALLTHROUGH */ + case ('R'): + /* FALLTHROUGH */ + case ('o'): + /* FALLTHROUGH */ + case ('N'): + /* FALLTHROUGH */ + case ('l'): + /* FALLTHROUGH */ + case ('L'): + /* FALLTHROUGH */ + case ('H'): + /* FALLTHROUGH */ + case ('h'): + /* FALLTHROUGH */ + case ('D'): + /* FALLTHROUGH */ + case ('C'): + /* FALLTHROUGH */ + case ('b'): + /* FALLTHROUGH */ + case ('B'): + /* FALLTHROUGH */ + case ('a'): + /* FALLTHROUGH */ + case ('A'): + if (*p++ != '\'') + return(0); + term = '\''; + break; +#endif case ('s'): if (ASCII_HYPH == *p) *p = '-'; @@ -83,6 +126,22 @@ mandoc_special(char *p) if (0 == i) return(0); break; +#if 0 + case ('Y'): + /* FALLTHROUGH */ + case ('V'): + /* FALLTHROUGH */ + case ('$'): + /* FALLTHROUGH */ + case ('n'): + /* FALLTHROUGH */ + case ('k'): + /* FALLTHROUGH */ +#endif + case ('M'): + /* FALLTHROUGH */ + case ('m'): + /* FALLTHROUGH */ case ('f'): /* FALLTHROUGH */ case ('F'): @@ -117,13 +176,13 @@ mandoc_special(char *p) for ( ; *p && term != *p; p++) if (ASCII_HYPH == *p) *p = '-'; - return(*p ? p - sv : 0); + return(*p ? (int)(p - sv) : 0); } for (i = 0; *p && i < len; i++, p++) if (ASCII_HYPH == *p) *p = '-'; - return(i == len ? p - sv : 0); + return(i == len ? (int)(p - sv) : 0); } -- cgit