Get rid of obsolete PutChar and Putc macros.

This commit is contained in:
Dianne Skoll
2022-02-01 16:05:06 -05:00
parent 9c2556f16d
commit cd68041312
7 changed files with 55 additions and 65 deletions

View File

@@ -684,7 +684,7 @@ static void DoCalendarOneWeek(int nleft)
DRAW(tb);
goff();
}
PutChar('\n');
putchar('\n');
for (l=0; l<CalPad; l++) {
gon();
DRAW(tb);
@@ -695,7 +695,7 @@ static void DoCalendarOneWeek(int nleft)
DRAW(tb);
goff();
}
PutChar('\n');
putchar('\n');
}
/* Write the body lines */
@@ -716,7 +716,7 @@ static void DoCalendarOneWeek(int nleft)
DRAW(tb);
goff();
}
PutChar('\n');
putchar('\n');
}
/* Write the final line */
@@ -867,7 +867,7 @@ static int WriteCalendarRow(void)
sprintf(buf, "%d ", d+i-wd);
if (Julian(y, m, d+i-wd) == RealToday) {
PrintLeft(buf, ColSpaces-1, '*');
PutChar(' ');
putchar(' ');
} else {
PrintLeft(buf, ColSpaces, ' ');
}
@@ -876,7 +876,7 @@ static int WriteCalendarRow(void)
DRAW(tb);
goff();
}
PutChar('\n');
putchar('\n');
for (l=0; l<CalPad; l++) {
gon();
DRAW(tb);
@@ -887,7 +887,7 @@ static int WriteCalendarRow(void)
DRAW(tb);
goff();
}
PutChar('\n');
putchar('\n');
}
/* Write the body lines */
@@ -908,7 +908,7 @@ static int WriteCalendarRow(void)
DRAW(tb);
goff();
}
PutChar('\n');
putchar('\n');
}
moreleft = (d+7-wd <= DaysInMonth(m, y));
@@ -934,7 +934,7 @@ static void PrintLeft(char const *s, int width, char pad)
#ifndef REM_USE_WCHAR
int len = strlen(s);
printf("%s", s);
while (len++ < width) PutChar(pad);
while (len++ < width) putchar(pad);
#else
size_t len = mbstowcs(NULL, s, 0);
int i;
@@ -999,10 +999,10 @@ static void PrintCentered(char const *s, int width, char *pad)
for (i=0; i<width; i++) {
if (*s) {
if (isspace(*s)) {
PutChar(' ');
putchar(' ');
s++;
} else {
PutChar(*s++);
putchar(*s++);
}
} else {
break;
@@ -1084,7 +1084,7 @@ static int WriteOneCalLine(void)
DRAW(tb);
goff();
}
PutChar('\n');
putchar('\n');
return done;
}
@@ -1157,7 +1157,7 @@ static int WriteOneColLine(int col)
for (ws = e->wc_pos; ws - e->wc_pos < ColSpaces; ws++) {
if (!*ws) break;
if (iswspace(*ws)) {
PutChar(' ');
putchar(' ');
numwritten++;
} else {
if (wcwidth(*ws) > 0) {
@@ -1172,7 +1172,7 @@ static int WriteOneColLine(int col)
for (ws = e->wc_pos; ws<wspace; ws++) {
if (!*ws) break;
if (iswspace(*ws)) {
PutChar(' ');
putchar(' ');
numwritten++;
} else {
if (wcwidth(*ws) > 0) {
@@ -1189,7 +1189,7 @@ static int WriteOneColLine(int col)
}
/* Flesh out the rest of the column */
while(numwritten++ < ColSpaces) PutChar(' ');
while(numwritten++ < ColSpaces) putchar(' ');
/* Skip any spaces before next word */
while (iswspace(*ws)) ws++;
@@ -1244,9 +1244,9 @@ static int WriteOneColLine(int col)
if (!*s) break;
numwritten++;
if (isspace(*s)) {
PutChar(' ');
putchar(' ');
} else {
PutChar(*s);
putchar(*s);
}
}
e->pos = s;
@@ -1256,9 +1256,9 @@ static int WriteOneColLine(int col)
if (!*s) break;
numwritten++;
if (isspace(*s)) {
PutChar(' ');
putchar(' ');
} else {
PutChar(*s);
putchar(*s);
}
}
}
@@ -1269,7 +1269,7 @@ static int WriteOneColLine(int col)
}
/* Flesh out the rest of the column */
while(numwritten++ < ColSpaces) PutChar(' ');
while(numwritten++ < ColSpaces) putchar(' ');
/* Skip any spaces before next word */
while (isspace(*s)) s++;
@@ -1423,7 +1423,7 @@ static void WriteCalHeader(void)
gon();
DRAW(tb);
goff();
PutChar('\n');
putchar('\n');
WritePostHeaderLine();
WriteCalDays();
@@ -1437,7 +1437,7 @@ static void WriteCalHeader(void)
/***************************************************************/
static void WriteCalTrailer(void)
{
PutChar('\f');
putchar('\f');
}
/***************************************************************/
@@ -2051,7 +2051,7 @@ static void WriteTopCalLine(void)
PrintCentered("", CalWidth-2, linestruct->lr);
DRAW(bl);
goff();
PutChar('\n');
putchar('\n');
}
static void WriteBottomCalLine(void)
@@ -2068,7 +2068,7 @@ static void WriteBottomCalLine(void)
}
}
goff();
PutChar('\n');
putchar('\n');
}
static void WritePostHeaderLine(void)
@@ -2085,7 +2085,7 @@ static void WritePostHeaderLine(void)
}
}
goff();
PutChar('\n');
putchar('\n');
}
static void WriteWeekHeaderLine(void)
@@ -2102,7 +2102,7 @@ static void WriteWeekHeaderLine(void)
}
}
goff();
PutChar('\n');
putchar('\n');
}
static void WriteIntermediateCalLine(void)
@@ -2120,7 +2120,7 @@ static void WriteIntermediateCalLine(void)
}
}
goff();
PutChar('\n');
putchar('\n');
}
static void WriteCalDays(void)
@@ -2138,7 +2138,7 @@ static void WriteCalDays(void)
DRAW(tb);
goff();
}
PutChar('\n');
putchar('\n');
}
/***************************************************************/

View File

@@ -177,9 +177,6 @@
#define PSBEGIN2 "# rem2ps2 begin"
#define PSEND2 "# rem2ps2 end"
#define Putc putc
#define PutChar putchar
#if defined(HAVE_MBSTOWCS) && defined(HAVE_WCTYPE_H)
#define REM_USE_WCHAR 1
#else

View File

@@ -177,9 +177,6 @@
#define PSBEGIN2 "# rem2ps2 begin"
#define PSEND2 "# rem2ps2 end"
#define Putc putc
#define PutChar putchar
#if defined(HAVE_MBSTOWCS) && defined(HAVE_WCTYPE_H)
#define REM_USE_WCHAR 1
#else

View File

@@ -101,7 +101,7 @@ static int DebugPerform(Operator *op)
fprintf(ErrFp, " => ");
if (!r) {
PrintValue(&ValStack[ValStackPtr-1], ErrFp);
Putc('\n', ErrFp);
putc('\n', ErrFp);
} else {
fprintf(ErrFp, "%s\n", ErrMsg[r]);
}
@@ -580,7 +580,7 @@ static int MakeValue(char const *s, Value *v, Var *locals, ParsePtr p)
if (! (DebugFlag & DB_PRTEXPR)) return r;
if (r == OK) {
PrintValue(v, ErrFp);
Putc('\n', ErrFp);
putc('\n', ErrFp);
}
return r;
} else { /* Must be a symbol */
@@ -591,7 +591,7 @@ static int MakeValue(char const *s, Value *v, Var *locals, ParsePtr p)
if (! (DebugFlag & DB_PRTEXPR)) return r;
if (r == OK) {
PrintValue(v, ErrFp);
Putc('\n', ErrFp);
putc('\n', ErrFp);
}
return r;
}
@@ -1232,9 +1232,9 @@ void PrintValue (Value *v, FILE *fp)
if (v->type == STR_TYPE) {
s=v->v.str;
Putc('"', fp);
for (y=0; y<MAX_PRT_LEN && *s; y++) Putc(*s++, fp);
Putc('"',fp);
putc('"', fp);
for (y=0; y<MAX_PRT_LEN && *s; y++) putc(*s++, fp);
putc('"',fp);
if (*s) fprintf(fp, "...");
}
else if (v->type == INT_TYPE) fprintf(fp, "%d", v->v.val);

View File

@@ -44,10 +44,6 @@
static void DoReminders(void);
/* Whooo... the putchar/Putchar/PutChar macros are a mess...
my apologies... */
#define Putchar(c) PutChar(c)
/***************************************************************/
/***************************************************************/
/** **/
@@ -616,11 +612,11 @@ void OutputLine(FILE *fp)
char c = 0;
while (*s) {
if (*s == '\n') Putc('\\', fp);
Putc(*s, fp);
if (*s == '\n') putc('\\', fp);
putc(*s, fp);
c = *s++;
}
if (c != '\n') Putc('\n', fp);
if (c != '\n') putc('\n', fp);
}
/***************************************************************/
@@ -1212,7 +1208,7 @@ void FillParagraph(char const *s)
/* If it's a carriage return, output it and start new paragraph */
if (*s == '\n') {
Putchar('\n');
putchar('\n');
s++;
line = 0;
while(ISBLANK(*s)) s++;
@@ -1225,7 +1221,7 @@ void FillParagraph(char const *s)
number of spaces */
j = line ? SubsIndent : FirstIndent;
for (i=0; i<j; i++) {
Putchar(' ');
putchar(' ');
}
/* Calculate the amount of room left on this line */
@@ -1244,17 +1240,17 @@ void FillParagraph(char const *s)
}
if (!pendspace || len+pendspace <= roomleft) {
for (i=0; i<pendspace; i++) {
Putchar(' ');
putchar(' ');
}
while(t < s) {
Putchar(*t);
putchar(*t);
if (strchr(EndSent, *t)) doublespace = 2;
else if (!strchr(EndSentIg, *t)) doublespace = 1;
t++;
}
} else {
s = t;
Putchar('\n');
putchar('\n');
line++;
break;
}

View File

@@ -146,9 +146,9 @@ put_escaped_string(char const *s)
{
while(*s) {
if (*s == '\\' || *s == '(' || *s == ')') {
PutChar('\\');
putchar('\\');
}
PutChar(*s);
putchar(*s);
s++;
}
}
@@ -625,7 +625,7 @@ void WriteProlog(void)
strcmp(SmallFont, DayFont) &&
strcmp(TitleFont, SmallFont) &&
strcmp(SmallFont, EntryFont)) printf(" %s", SmallFont);
PutChar('\n');
putchar('\n');
printf("%%%%Creator: Rem2PS\n");
printf("%%%%Pages: (atend)\n");
printf("%%%%Orientation: %s\n", PortraitMode ? "Portrait" : "Landscape");
@@ -805,20 +805,20 @@ void WriteOneEntry(CalEntry *c)
}
}
PutChar('(');
putchar('(');
while(*s) {
/* Use the "unsigned char" cast to fix problem on Solaris 2.5 */
/* which treated some latin1 characters as white space. */
ch = (unsigned char) *s++;
if (ch == '\\' || ch == '(' || ch == ')') PutChar('\\');
if (!isspace(ch)) PutChar(ch);
if (ch == '\\' || ch == '(' || ch == ')') putchar('\\');
if (!isspace(ch)) putchar(ch);
else {
PutChar(')');
putchar(')');
while(isspace((unsigned char)*s)) s++;
if (!*s) {
goto finish;
}
PutChar('(');
putchar('(');
}
}
printf(")\n");

View File

@@ -989,29 +989,29 @@ static void DumpSysVar(char const *name, const SysVar *v)
SysVarFunc f = (SysVarFunc) v->value;
f(0, &val);
PrintValue(&val, ErrFp);
Putc('\n', ErrFp);
putc('\n', ErrFp);
DestroyValue(val);
} else if (v->type == STR_TYPE) {
char const *s = *((char **)v->value);
int y;
Putc('"', ErrFp);
putc('"', ErrFp);
for (y=0; y<MAX_PRT_LEN && *s; y++) {
if (*s == '"') {
fprintf(ErrFp, "\" + char(34) + \"");
s++;
} else {
Putc(*s++, ErrFp);
putc(*s++, ErrFp);
}
}
Putc('"', ErrFp);
putc('"', ErrFp);
if (*s) fprintf(ErrFp, "...");
Putc('\n', ErrFp);
putc('\n', ErrFp);
} else if (v->type == DATE_TYPE) {
Value val;
val.type = DATE_TYPE;
val.v.val = * (int *) v->value;
PrintValue(&val, ErrFp);
Putc('\n', ErrFp);
putc('\n', ErrFp);
} else {
if (!v->modifiable) fprintf(ErrFp, "%d\n", *((int *)v->value));
else {