/* Filter to convert between 8- and 7-bit representations of characters with diacritical marks in TeX. compile: gcc -o 7bitify 7bitify.c usage, e.g. "cat foo.tex | 7bitify > foo7.tex" Allin Cottrell, July 1998. */ #include void translate(int d) { if (d == 201) printf("\\\'E"); if (d == 233) printf("\\\'e"); if (d == 192) printf("\\`A"); if (d == 200) printf("\\`E"); if (d == 217) printf("\\`U"); if (d == 224) printf("\\`a"); if (d == 232) printf("\\`e"); if (d == 249) printf("\\`u"); if (d == 194) printf("\\^A"); if (d == 202) printf("\\^E"); if (d == 206) printf("\\^I"); if (d == 212) printf("\\^O"); if (d == 209) printf("\\^U"); if (d == 226) printf("\\^a"); if (d == 234) printf("\\^e"); if (d == 238) printf("\\^i"); if (d == 244) printf("\\^o"); if (d == 251) printf("\\^u"); if (d == 203) printf("\\\"E"); if (d == 207) printf("\\\"I"); if (d == 220) printf("\\\"U"); if (d == 236) printf("\\\"e"); if (d == 253) printf("\\\"i"); if (d == 252) printf("\\\"u"); if (d == 231) printf("\\c{c}"); if (d == 199) printf("\\c{C}"); } int main(void) { int deccodes[27] = {201, 233, 192, 200, 217, 224, 232, 249, 194, 202, 206, 212, 219, 226, 234, 238, 244, 251, 203, 207, 220, 236, 253, 252, 231, 199}; int c; int i, match; do { c = getchar(); match = 0; for (i=0; i<27; i++) { if (c == deccodes[i]) { match = 1; translate(deccodes[i]); } } if (match == 0 && c != EOF) putchar(c); } while (c != EOF); return 0; }