diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-05-24 21:31:23 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-05-24 21:31:23 +0000 |
commit | 4b3a9caedf7632dd837b5d786c41d0d124c06ee4 (patch) | |
tree | 531792d234b46886165afa0ee0793e806c4e1f79 | |
parent | eec9b5ae7a9d9378856fdb038bf9c588af68f047 (diff) | |
download | mandoc-4b3a9caedf7632dd837b5d786c41d0d124c06ee4.tar.gz |
Remove all references to ESCAPE_PREDEF, which is now not exposed passed
the libroff point. This clears up a nice chunk of code.
-rw-r--r-- | chars.c | 31 | ||||
-rw-r--r-- | html.c | 25 | ||||
-rw-r--r-- | mandoc.3 | 24 | ||||
-rw-r--r-- | mandoc.c | 4 | ||||
-rw-r--r-- | mandoc.h | 3 | ||||
-rw-r--r-- | term.c | 22 |
6 files changed, 0 insertions, 109 deletions
@@ -113,21 +113,6 @@ mchars_spec2cp(struct mchars *arg, const char *p, size_t sz) return(ln->unicode); } - -/* - * Reserved word to Unicode codepoint. - */ -int -mchars_res2cp(struct mchars *arg, const char *p, size_t sz) -{ - const struct ln *ln; - - ln = find(arg, p, sz); - if (NULL == ln) - return(-1); - return(ln->unicode); -} - /* * Numbered character string to ASCII codepoint. * This can only be a printable character (i.e., alnum, punct, space) so @@ -176,22 +161,6 @@ mchars_spec2str(struct mchars *arg, const char *p, size_t sz, size_t *rsz) return(ln->ascii); } -/* - * Reserved word to string array. - */ -const char * -mchars_res2str(struct mchars *arg, const char *p, size_t sz, size_t *rsz) -{ - const struct ln *ln; - - ln = find(arg, p, sz); - if (NULL == ln) - return(NULL); - - *rsz = strlen(ln->ascii); - return(ln->ascii); -} - static const struct ln * find(struct mchars *tab, const char *p, size_t sz) { @@ -109,7 +109,6 @@ static const char *const roffscales[SCALE_MAX] = { static void bufncat(struct html *, const char *, size_t); static void print_spec(struct html *, const char *, size_t); -static void print_res(struct html *, const char *, size_t); static void print_ctag(struct html *, enum htmltag); static int print_encode(struct html *, const char *, int); static void print_metaf(struct html *, enum mandoc_esc); @@ -238,25 +237,6 @@ print_spec(struct html *h, const char *p, size_t len) fwrite(rhs, 1, sz, stdout); } - -static void -print_res(struct html *h, const char *p, size_t len) -{ - int cp; - const char *rhs; - size_t sz; - - if ((cp = mchars_res2cp(h->symtab, p, len)) > 0) { - printf("&#%d;", cp); - return; - } else if (-1 == cp) - return; - - if (NULL != (rhs = mchars_res2str(h->symtab, p, len, &sz))) - fwrite(rhs, 1, sz, stdout); -} - - static void print_metaf(struct html *h, enum mandoc_esc deco) { @@ -321,8 +301,6 @@ html_strlen(const char *cp) /* FALLTHROUGH */ case (ESCAPE_NUMBERED): /* FALLTHROUGH */ - case (ESCAPE_PREDEF): - /* FALLTHROUGH */ case (ESCAPE_SPECIAL): sz++; break; @@ -388,9 +366,6 @@ print_encode(struct html *h, const char *p, int norecurse) if ('\0' != c) putchar(c); break; - case (ESCAPE_PREDEF): - print_res(h, seq, len); - break; case (ESCAPE_SPECIAL): print_spec(h, seq, len); break; @@ -27,8 +27,6 @@ .Nm mchars_free , .Nm mchars_num2char , .Nm mchars_num2uc , -.Nm mchars_res2cp , -.Nm mchars_res2str , .Nm mchars_spec2cp , .Nm mchars_spec2str , .Nm mdoc_meta , @@ -70,20 +68,6 @@ .Ft int .Fn mchars_num2uc "const char *cp" "size_t sz" .Ft "const char *" -.Fo mchars_res2str -.Fa "struct mchars *p" -.Fa "const char *cp" -.Fa "size_t sz" -.Fa "size_t *rsz" -.Fc -.Ft int -.Fo mchars_res2cp -.Fa "struct mchars *p" -.Fa "const char *cp" -.Fa "size_t sz" -.Ft "const char *" -.Fc -.Ft "const char *" .Fo mchars_spec2str .Fa "struct mchars *p" .Fa "const char *cp" @@ -262,14 +246,6 @@ Returns \e0 (the nil character) if the input sequence is malformed. Convert a hexadecimal character index (e.g., the \e[uNNNN] escape) into a Unicode codepoint. Returns \e0 (the nil character) if the input sequence is malformed. -.It Fn mchars_res2cp -Convert a predefined character into a valid Unicode codepoint. -Returns \-1 on failure and 0 if no code-point exists (if this occurs, -the caller should fall back to -.Fn mchars_res2str ) . -.It Fn mchars_res2str -Convert a predefined character into an ASCII string. -Returns NULL on failure. .It Fn mchars_spec2cp Convert a special character into a valid Unicode codepoint. Returns \-1 on failure and 0 if no code-point exists (if this occurs, @@ -164,10 +164,6 @@ mandoc_escape(const char **end, const char **start, int *sz) if (ESCAPE_ERROR == gly) gly = ESCAPE_IGNORE; /* FALLTHROUGH */ - case ('*'): - if (ESCAPE_ERROR == gly) - gly = ESCAPE_PREDEF; - /* FALLTHROUGH */ case ('f'): if (ESCAPE_ERROR == gly) gly = ESCAPE_FONT; @@ -292,7 +292,6 @@ enum mandoc_esc { ESCAPE_ERROR = 0, /* bail! unparsable escape */ ESCAPE_IGNORE, /* escape to be ignored */ ESCAPE_SPECIAL, /* a regular special character */ - ESCAPE_PREDEF, /* a predefined special character */ ESCAPE_FONT, /* a generic font mode */ ESCAPE_FONTBOLD, /* bold font mode */ ESCAPE_FONTITALIC, /* italic font mode */ @@ -333,8 +332,6 @@ char mchars_num2char(const char *, size_t); int mchars_num2uc(const char *, size_t); const char *mchars_spec2str(struct mchars *, const char *, size_t, size_t *); int mchars_spec2cp(struct mchars *, const char *, size_t); -const char *mchars_res2str(struct mchars *, const char *, size_t, size_t *); -int mchars_res2cp(struct mchars *, const char *, size_t); void mchars_free(struct mchars *); @@ -447,12 +447,6 @@ term_word(struct termp *p, const char *word) break; encode1(p, uc); continue; - case (ESCAPE_PREDEF): - uc = mchars_res2cp(p->symtab, seq, sz); - if (uc <= 0) - break; - encode1(p, uc); - continue; case (ESCAPE_SPECIAL): uc = mchars_spec2cp(p->symtab, seq, sz); if (uc <= 0) @@ -472,11 +466,6 @@ term_word(struct termp *p, const char *word) if ('\0' != c) encode(p, &c, 1); break; - case (ESCAPE_PREDEF): - cp = mchars_res2str(p->symtab, seq, sz, &ssz); - if (NULL != cp) - encode(p, cp, ssz); - break; case (ESCAPE_SPECIAL): cp = mchars_spec2str(p->symtab, seq, sz, &ssz); if (NULL != cp) @@ -648,13 +637,6 @@ term_strlen(const struct termp *p, const char *cp) break; sz += (*p->width)(p, c); continue; - case (ESCAPE_PREDEF): - c = mchars_res2cp - (p->symtab, seq, ssz); - if (c <= 0) - break; - sz += (*p->width)(p, c); - continue; case (ESCAPE_SPECIAL): c = mchars_spec2cp (p->symtab, seq, ssz); @@ -677,10 +659,6 @@ term_strlen(const struct termp *p, const char *cp) if ('\0' != c) sz += (*p->width)(p, c); break; - case (ESCAPE_PREDEF): - rhs = mchars_res2str - (p->symtab, seq, ssz, &rsz); - break; case (ESCAPE_SPECIAL): rhs = mchars_spec2str (p->symtab, seq, ssz, &rsz); |