From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (fantadrom.bsd.lv [local]); by fantadrom.bsd.lv (OpenSMTPD) with ESMTPA id e571be7a; for ; Mon, 2 Mar 2015 13:13:23 -0500 (EST) Date: Mon, 2 Mar 2015 13:13:23 -0500 (EST) Message-Id: <3679786250748624993.enqueue@fantadrom.bsd.lv> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: kristaps@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: texi2mdoc: Allow for @sc{} to properly uppercase as requested by X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- Allow for @sc{} to properly uppercase as requested by Baptiste Daroussin--thanks! Modified Files: -------------- texi2mdoc: extern.h main.c util.c Revision Data ------------- Index: extern.h =================================================================== RCS file: /home/cvs/mdocml/texi2mdoc/extern.h,v retrieving revision 1.23 retrieving revision 1.24 diff -Lextern.h -Lextern.h -u -p -r1.23 -r1.24 --- extern.h +++ extern.h @@ -404,6 +404,7 @@ struct texi { int seenvs; /* newline has been Pp'd */ int ign; /* if >0, don't print anything */ int literal; /* if >0, literal context */ + int uppercase; /* if >0, uppercase */ }; #define BUF(_p) ((_p)->files[(_p)->filepos - 1].map) Index: util.c =================================================================== RCS file: /home/cvs/mdocml/texi2mdoc/util.c,v retrieving revision 1.22 retrieving revision 1.23 diff -Lutil.c -Lutil.c -u -p -r1.22 -r1.23 --- util.c +++ util.c @@ -184,7 +184,10 @@ texiputchar(struct texi *p, char c) if ('\'' == c && 0 == p->outcol) fputs("\\&", p->outfile); - fputc(c, p->outfile); + if (p->uppercase) + fputc(toupper((unsigned int)c), p->outfile); + else + fputc(c, p->outfile); if ('\\' == c) fputc('e', p->outfile); p->seenvs = 0; @@ -210,7 +213,12 @@ texiputchars(struct texi *p, const char fputs("\\&", p->outfile); if ('\'' == *s && 0 == p->outcol) fputs("\\&", p->outfile); - p->outcol += fputs(s, p->outfile); + if (p->uppercase) + for ( ; '\0' != *s; s++) + p->outcol += fputc(toupper + ((unsigned int)*s), p->outfile); + else + p->outcol += fputs(s, p->outfile); p->seenvs = 0; } @@ -616,7 +624,7 @@ texicmd(const struct texi *p, size_t pos return(TEXICMD__MAX); /* Alphabetic commands are special. */ - if ( ! isalpha((unsigned char)BUF(p)[pos])) { + if ( ! isalpha((unsigned int)BUF(p)[pos])) { if ((*end = pos + 1) == BUFSZ(p)) return(TEXICMD__MAX); for (i = 0; i < TEXICMD__MAX; i++) { Index: main.c =================================================================== RCS file: /home/cvs/mdocml/texi2mdoc/main.c,v retrieving revision 1.57 retrieving revision 1.58 diff -Lmain.c -Lmain.c -u -p -r1.57 -r1.58 --- main.c +++ main.c @@ -268,7 +268,7 @@ static const struct texitok __texitoks[T { doaccent, "ringaccent", 10 }, /* TEXICMD_RINGACCENT */ { doinline, "samp", 4 }, /* TEXICMD_SAMP */ { doinline, "sansserif", 9 }, /* TEXICMD_SANSSERIF */ - { dobracket, "sc", 2 }, /* TEXICMD_SC */ + { doinline, "sc", 2 }, /* TEXICMD_SC */ { dosection, "section", 7 }, /* TEXICMD_SECTION */ { dovalue, "set", 3 }, /* TEXICMD_SET */ { doignline, "setchapternewpage", 17 }, /* TEXICMD_SETCHAPNEWPAGE */ @@ -725,13 +725,21 @@ doinline(struct texi *p, enum texicmd cm } if (NULL == macro || p->literal || TEXILIST_TABLE == p->list) { + if (TEXICMD_SC == cmd) + p->uppercase++; parsebracket(p, pos, 0); + if (TEXICMD_SC == cmd) + p->uppercase--; return; } teximacroopen(p, macro); p->seenws = 0; + if (TEXICMD_SC == cmd) + p->uppercase++; parsebracket(p, pos, 0); + if (TEXICMD_SC == cmd) + p->uppercase--; texipunctuate(p, pos); teximacroclose(p); } -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv