/* * Format c for list mode; leave things in common * with normal print mode to be done by normchar. */ void listchar(int c) { c &= (TRIM|QUOTE); switch (c) { case '\t': case '\b': outchar('^'); c = ctlof(c); break; case '\n': break; case '\n' | QUOTE: outchar('$'); break; default: if (c & QUOTE) break; if ((c < ' ' && c != '\n') || c == DELETE) outchar('^'), c = ctlof(c); break; } normchar(c); }
void tracec(int c) /* int c; /\* mjm: char --> int */ { if (!techoin) trubble = 1; if (c == ESCAPE) fprintf(trace, "$"); else if (c & QUOTE) /* mjm: for 3B (no sign extension) */ fprintf(trace, "~%c", ctlof(c&TRIM)); else if (c < ' ' || c == DELETE) fprintf(trace, "^%c", ctlof(c)); else fprintf(trace, "%c", c); }
/* * Format c for printing. Handle funnies of upper case terminals * and crocky hazeltines which don't have ~. */ static void normchar(int c) { register char *colp; c &= (TRIM|QUOTE); if (c == '~' && ex_HZ) { normchar('\\'); c = '^'; } if (c & QUOTE) switch (c) { case ' ' | QUOTE: case '\b' | QUOTE: break; case QUOTE: return; default: c &= TRIM; #ifdef BIT8 if ((c < ' ' && (c != '\b' || !OS) && c != '\n' && c != '\t') || c == DELETE) ex_putchar('^'), c = ctlof(c); #endif } else if ((c < ' ' && (c != '\b' || !OS) && c != '\n' && c != '\t') || c == DELETE) ex_putchar('^'), c = ctlof(c); else if (UPPERCASE) { if (isupper(c)) { outchar('\\'); c = tolower(c); } else { colp = "({)}!|^~'`"; while (*colp++) if (c == *colp++) { outchar('\\'); c = colp[-2]; break; } } } outchar(c); }
/* * Format c for list mode; leave things in common * with normal print mode to be done by normchar. */ int listchar(int c) { if (c & MULTICOL) { c &= ~MULTICOL; if (c == 0) return MULTICOL; } c &= (TRIM|QUOTE); switch (c) { case '\t': case '\b': c = ctlof(c); outchar('^'); break; case '\n': break; default: if (c == ('\n' | QUOTE)) outchar('$'); if (c & QUOTE) break; #ifndef BIT8 if (c < ' ' && c != '\n') outchar('^'), c = ctlof(c); #else /* !BIT8 */ if (!printable(c) && c != '\n' || c == DELETE) c = printof(c); #endif break; } return normchar(c); }
/* * Format c for printing. Handle funnies of upper case terminals * and crocky hazeltines which don't have ~. */ int normchar(register int c) { int u; #ifdef UCVISUAL register char *colp; if (c == '~' && xHZ) { normchar('\\'); c = '^'; } #endif if (c & MULTICOL) { c &= ~MULTICOL; if (c == 0) return MULTICOL; } c &= (TRIM|QUOTE); u = c & TRIM; if (c & QUOTE) { if (c == (' ' | QUOTE) || c == ('\b' | QUOTE)) /*EMPTY*/; else if (c == QUOTE) return c; else c &= TRIM; } #ifdef BIT8 else { if (!printable(c) && (u != '\b' || !OS) && u != '\n' && u != '\t') c = printof(u); else { c = u; if (0) /*EMPTY*/; #else /* !BIT8 */ else if (c < ' ' && (c != '\b' || !OS) && c != '\n' && c != '\t') putchar('^'), c = ctlof(c); #endif /* !BIT8 */ #ifdef UCVISUAL else if (UPPERCASE) if (xisupper(c)) { outchar('\\'); c = tolower(c); } else { colp = "({)}!|^~'`"; while (*colp++) if (c == *colp++) { outchar('\\'); c = colp[-2]; break; } } #endif /* UCVISUAL */ #ifdef BIT8 } } #endif outchar(c); return c; }