=================================================================== RCS file: /cvs/texi2mdoc/main.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -p -r1.6 -r1.7 --- texi2mdoc/main.c 2015/02/18 11:03:04 1.6 +++ texi2mdoc/main.c 2015/02/18 11:08:58 1.7 @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.6 2015/02/18 11:03:04 kristaps Exp $ */ +/* $Id: main.c,v 1.7 2015/02/18 11:08:58 kristaps Exp $ */ /* * Copyright (c) 2015 Kristaps Dzonsons * @@ -44,6 +44,7 @@ enum texicmd { TEXICMD_AT, TEXICMD_AUTHOR, TEXICMD_BANG, + TEXICMD_BULLET, TEXICMD_BYE, TEXICMD_CENTER, TEXICMD_CHAPTER, @@ -106,6 +107,7 @@ enum texicmd { TEXICMD_PRINTINDEX, TEXICMD_REF, TEXICMD_SAMP, + TEXICMD_SC, TEXICMD_SECTION, TEXICMD_SET, TEXICMD_SETCHAPNEWPAGE, @@ -236,6 +238,7 @@ static const struct texitok texitoks[TEXICMD__MAX] = { { dosymbol, "@", 1 }, /* TEXICMD_AT */ { doignline, "author", 6 }, /* TEXICMD_AUTHOR */ { dosymbol, "!", 1 }, /* TEXICMD_BANG */ + { dosymbol, "bullet", 6 }, /* TEXICMD_BULLET */ { dobye, "bye", 3 }, /* TEXICMD_BYE */ { doignline, "center", 5 }, /* TEXICMD_CENTER */ { dochapter, "chapter", 7 }, /* TEXICMD_CHAPTER */ @@ -298,6 +301,7 @@ static const struct texitok texitoks[TEXICMD__MAX] = { { doignline, "printindex", 10 }, /* TEXICMD_PRINTINDEX */ { dobracket, "ref", 3 }, /* TEXICMD_REF */ { doliteral, "samp", 4 }, /* TEXICMD_SAMP */ + { dobracket, "sc", 2 }, /* TEXICMD_SC */ { dosection, "section", 7 }, /* TEXICMD_SECTION */ { doignline, "set", 3 }, /* TEXICMD_SET */ { doignline, "setchapternewpage", 17 }, /* TEXICMD_SETCHAPNEWPAGE */ @@ -656,41 +660,6 @@ texicmd(struct texi *p, const char *buf, } static void -parseeof(struct texi *p, const char *buf, size_t sz) -{ - size_t pos = 0; - enum texicmd cmd; - size_t end; - - while ((pos = advancenext(p, buf, sz, &pos)) < sz) { - switch (buf[pos]) { - case ('}'): - if (0 == p->ign) - texiwarn(p, "unexpected \"}\""); - advance(p, buf, &pos); - continue; - case ('{'): - if (0 == p->ign) - texiwarn(p, "unexpected \"{\""); - advance(p, buf, &pos); - continue; - case ('@'): - break; - default: - texiword(p, buf, sz, &pos); - continue; - } - - cmd = texicmd(p, buf, pos, sz, &end); - advanceto(p, buf, &pos, end); - if (TEXICMD__MAX == cmd) - continue; - if (NULL != texitoks[cmd].fp) - (*texitoks[cmd].fp)(p, cmd, buf, sz, &pos); - } -} - -static void parsebracket(struct texi *p, const char *buf, size_t sz, size_t *pos) { size_t end; @@ -810,6 +779,15 @@ parsesingle(struct texi *p, const char *buf, size_t sz } static void +parseeof(struct texi *p, const char *buf, size_t sz) +{ + size_t pos; + + for (pos = 0; pos < sz; ) + parsesingle(p, buf, sz, &pos); +} + +static void parseto(struct texi *p, const char *buf, size_t sz, size_t *pos, const char *endtoken) { @@ -1039,7 +1017,6 @@ doinclude(struct texi *p, enum texicmd cmd, for (i = 0; i < p->dirsz; i++) { rc = snprintf(path, sizeof(path), "%s/%s", p->dirs[i], fname); - texiwarn(p, "trying: %s", path); if (rc < 0) texierr(p, "couldn't format path"); else if ((size_t)rc >= sizeof(path)) @@ -1182,6 +1159,9 @@ dosymbol(struct texi *p, enum texicmd cmd, break; case (TEXICMD_BANG): texiputchar(p, '!'); + break; + case (TEXICMD_BULLET): + texiputchars(p, "\\(bu"); break; case (TEXICMD_COPYRIGHT): texiputchars(p, "\\(co");