From: kristaps@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Remove all references to ESCAPE_PREDEF, which is now not exposed
Date: Tue, 24 May 2011 17:31:23 -0400 (EDT) [thread overview]
Message-ID: <201105242131.p4OLVNxJ022860@krisdoz.my.domain> (raw)
Log Message:
-----------
Remove all references to ESCAPE_PREDEF, which is now not exposed passed
the libroff point. This clears up a nice chunk of code.
Modified Files:
--------------
mdocml:
chars.c
html.c
mandoc.3
mandoc.c
mandoc.h
term.c
Revision Data
-------------
Index: term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/term.c,v
retrieving revision 1.196
retrieving revision 1.197
diff -Lterm.c -Lterm.c -u -p -r1.196 -r1.197
--- term.c
+++ term.c
@@ -447,12 +447,6 @@ term_word(struct termp *p, const char *w
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 *w
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
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);
@@ -676,10 +658,6 @@ term_strlen(const struct termp *p, const
c = mchars_num2char(seq, ssz);
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
Index: mandoc.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandoc.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -Lmandoc.c -Lmandoc.c -u -p -r1.52 -r1.53
--- mandoc.c
+++ mandoc.c
@@ -164,10 +164,6 @@ mandoc_escape(const char **end, const ch
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;
Index: chars.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/chars.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -Lchars.c -Lchars.c -u -p -r1.45 -r1.46
--- chars.c
+++ chars.c
@@ -113,21 +113,6 @@ mchars_spec2cp(struct mchars *arg, const
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
@@ -165,22 +150,6 @@ mchars_num2uc(const char *p, size_t sz)
*/
const char *
mchars_spec2str(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);
-}
-
-/*
- * 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;
Index: mandoc.3
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandoc.3,v
retrieving revision 1.8
retrieving revision 1.9
diff -Lmandoc.3 -Lmandoc.3 -u -p -r1.8 -r1.9
--- mandoc.3
+++ mandoc.3
@@ -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 i
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,
Index: html.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/html.c,v
retrieving revision 1.145
retrieving revision 1.146
diff -Lhtml.c -Lhtml.c -u -p -r1.145 -r1.146
--- html.c
+++ html.c
@@ -109,7 +109,6 @@ static const char *const roffscales[SCAL
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
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;
@@ -387,9 +365,6 @@ print_encode(struct html *h, const char
c = mchars_num2char(seq, len);
if ('\0' != c)
putchar(c);
- break;
- case (ESCAPE_PREDEF):
- print_res(h, seq, len);
break;
case (ESCAPE_SPECIAL):
print_spec(h, seq, len);
Index: mandoc.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandoc.h,v
retrieving revision 1.76
retrieving revision 1.77
diff -Lmandoc.h -Lmandoc.h -u -p -r1.76 -r1.77
--- mandoc.h
+++ mandoc.h
@@ -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 *, s
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 *);
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
reply other threads:[~2011-05-24 21:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201105242131.p4OLVNxJ022860@krisdoz.my.domain \
--to=kristaps@mdocml.bsd.lv \
--cc=source@mdocml.bsd.lv \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).