#include /* * translate from UCB Old Norse conventions to ISO 8859-1 * (see http://www.humnet.ucla.edu/humnet/scandinavian/lsagas/bconv.htm) * * since the ISO character set does not supply hooked-o or the oe ligature, I * leave oe as oe and use o-circumflex instead of hooked-o (which almost * never occurs in the texts involved anyway) * * define USECIRCUMFLEX 0 will translate hooked-o to o-umlaut * tested with and designed for the texts from * http://www.humnet.ucla.edu/humnet/scandinavian/leghome.html * * of course, it is only as good as the input, for instance in * the untranscribed text of Völsunga Saga we have * Hu+n sat i+ einni skemmu vi`/f meyjar sinar. * which is automatically translated to * Hún sat í einni skemmu viÆ/f meyjar sinar. * and the correct text is * Hún sat í einni skemmu við meyjar sinar. * similarly later in the saga * sem Gri+mhildr kenndi /teim Sigur`/ri ok Gunnari. * is automatically transcribed to * sem Grímhildr kenndi þeim SigurÆ/ri ok Gunnari. * and the correct text is * sem Grímhildr kenndi þeim Sigurði ok Gunnari. * in both cases the ð has for some reason been rendered in the * original as `/f or `/r * * Mark Henderson - 25 Jan 98 * This program is hereby placed in the public domain */ #ifndef USECIRCUMFLEX #define USECIRCUMFLEX 1 #endif /* handles single character translations */ int strans(c) int c; { int r; switch (c) { case '@': r = 230; break; case '`': r = 198; break; #if USECIRCUMFLEX case 'q': /* use o-circumflex instead of hooked-o */ r = 244; break; case 'Q': /* use O-circumflex instead of hooked-o */ r = 212; break; #else case 'q': /* use o-umlaut instead of hooked-o */ r = 246; break; case 'Q': /* use O-umlaut instead of hooked-o */ r = 214; break; #endif default: r = c; } return r; } main() { int c1, c2; int offset = 0; while ((c1 = getchar()) != EOF) { offset++; l1: c2 = getchar(); offset++; if (c2 == EOF) { putchar(strans(c1)); break; } if (c1 == '\054' && c2 == '\054') { putchar('\253'); continue; } if (c1 == '\140' && c2 == '\140') { putchar('\273'); continue; } if (c1 == '/') { switch (c2) { case 'o': putchar('\370'); /* o slash */ break; case 'O': putchar('\330'); /* O slash */ break; case '"': putchar('\366'); /* o-umlaut */ break; case '\'': putchar('\326'); /* O-umlaut */ break; case 'd': putchar('\360'); /* eth */ break; case 'D': /* capital eth */ putchar('\320'); break; case 't': /* thorn */ putchar('\376'); break; case 'T': /* capital thorn */ putchar('\336'); break; case 'e': printf(""); break; case 'E': printf(""); break; case 'q': putchar('q'); break; case 'Q': putchar('Q'); break; default: fprintf(stderr, "warning: unrecognised / sequence /%c offset %d\n", c2, offset); putchar('/'); /* there isnt really anything * good to do here */ c1 = c2; goto l1; } continue; } if (c2 == '+') {/* accented vowel */ if (c1 == 'a' || c1 == 'A') { putchar(c1 + 128); } else if (c1 == 'u' || c1 == 'U') { putchar(c1 + 133); } else { putchar(c1 + 132); } continue; } /* ok - c1 is a single character */ putchar(strans(c1)); c1 = c2; goto l1; } exit(0); }