version 1.12, 2015/02/23 22:50:11 |
version 1.13, 2015/02/24 14:35:40 |
Line 160 texierr(struct texi *p, const char *fmt, ...) |
|
Line 160 texierr(struct texi *p, const char *fmt, ...) |
|
|
|
/* |
/* |
* Put a single data character to the output if we're not ignoring. |
* Put a single data character to the output if we're not ignoring. |
* Makes sure we don't spurriously start a macro. |
* Escape starting a line with a control character and slashes. |
* Adjusts our output status. |
|
* This shouldn't be called for macros: just for ordinary text. |
|
*/ |
*/ |
void |
void |
texiputchar(struct texi *p, char c) |
texiputchar(struct texi *p, char c) |
Line 170 texiputchar(struct texi *p, char c) |
|
Line 168 texiputchar(struct texi *p, char c) |
|
|
|
if (p->ign) |
if (p->ign) |
return; |
return; |
|
|
if ('.' == c && 0 == p->outcol) |
if ('.' == c && 0 == p->outcol) |
fputs("\\&", stdout); |
fputs("\\&", stdout); |
if ('\'' == c && 0 == p->outcol) |
if ('\'' == c && 0 == p->outcol) |
fputs("\\&", stdout); |
fputs("\\&", stdout); |
|
|
putchar(c); |
putchar(c); |
|
if ('\\' == c) |
|
putchar('e'); |
p->seenvs = 0; |
p->seenvs = 0; |
if ('\n' == c) { |
if ('\n' == c) { |
p->outcol = 0; |
p->outcol = 0; |
Line 186 texiputchar(struct texi *p, char c) |
|
Line 185 texiputchar(struct texi *p, char c) |
|
} |
} |
|
|
/* |
/* |
* Put multiple characters (see texiputchar()). |
* Put an opaque series of characters. |
* This shouldn't be called for macros: just for ordinary text. |
* Characters starting a line with a control character are escaped, but |
|
* that's it, so don't use this for non-controlled sequences of text. |
*/ |
*/ |
void |
void |
texiputchars(struct texi *p, const char *s) |
texiputchars(struct texi *p, const char *s) |
{ |
{ |
|
|
while ('\0' != *s) |
if (p->ign) |
texiputchar(p, *s++); |
return; |
|
if ('.' == *s && 0 == p->outcol) |
|
fputs("\\&", stdout); |
|
if ('\'' == *s && 0 == p->outcol) |
|
fputs("\\&", stdout); |
|
p->outcol += fputs(s, stdout); |
|
p->seenvs = 0; |
} |
} |
|
|
/* |
/* |
Line 367 advancenext(struct texi *p, const char *buf, size_t sz |
|
Line 373 advancenext(struct texi *p, const char *buf, size_t sz |
|
|
|
if (p->literal) { |
if (p->literal) { |
while (*pos < sz && ismspace(buf[*pos])) { |
while (*pos < sz && ismspace(buf[*pos])) { |
if (*pos && '\n' == buf[*pos] && |
|
'\\' == buf[*pos - 1]) |
|
texiputchar(p, 'e'); |
|
texiputchar(p, buf[*pos]); |
texiputchar(p, buf[*pos]); |
advance(p, buf, pos); |
advance(p, buf, pos); |
} |
} |
Line 551 texiword(struct texi *p, const char *buf, |
|
Line 554 texiword(struct texi *p, const char *buf, |
|
'\'' == buf[*pos + 1]) { |
'\'' == buf[*pos + 1]) { |
texiputchars(p, "\\(rq"); |
texiputchars(p, "\\(rq"); |
advance(p, buf, pos); |
advance(p, buf, pos); |
} else if ('\\' == buf[*pos]) { |
|
texiputchar(p, buf[*pos]); |
|
texiputchar(p, 'e'); |
|
} else |
} else |
texiputchar(p, buf[*pos]); |
texiputchar(p, buf[*pos]); |
advance(p, buf, pos); |
advance(p, buf, pos); |
Line 1036 parsefile(struct texi *p, const char *fname, int parse |
|
Line 1036 parsefile(struct texi *p, const char *fname, int parse |
|
|
|
p->filepos++; |
p->filepos++; |
if ( ! parse) { |
if ( ! parse) { |
/* |
for (i = 0; i < f->mapsz; i++) |
* We're printing verbatim output. |
texiputchar(p, f->map[i]); |
* Make sure it doesn't get interpreted as mdoc by |
if (p->outcol) |
* escaping escapes and making sure leading dots don't |
texiputchar(p, '\n'); |
* trigger mdoc(7) expansion. |
|
*/ |
|
for (i = 0; i < f->mapsz; i++) { |
|
if (i > 0 && '.' == f->map[i]) |
|
if ('\n' == f->map[i - 1]) |
|
fputs("\\&", stdout); |
|
putchar(f->map[i]); |
|
if ('\\' == f->map[i]) |
|
putchar('e'); |
|
} |
|
} else |
} else |
parseeof(p, f->map, f->mapsz); |
parseeof(p, f->map, f->mapsz); |
texifilepop(p); |
texifilepop(p); |