7 * Routines for handling dictionaries in the "Paperback Collins"
8 * format (with tags surrounded by >....<)
14 /* More special runes */
16 B = MULTIE+1, /* bold */
17 H, /* headword start */
19 Ps, /* pronunciation start */
20 Pe, /* pronunciation end */
25 /* Assoc tables must be sorted on first field */
27 static Assoc tagtab[] = {
50 {"supe", L'e'}, /* should be raised */
51 {"supo", L'o'}, /* should be raised */
59 static Rune normtab[128] = {
60 /*0*/ /*1*/ /*2*/ /*3*/ /*4*/ /*5*/ /*6*/ /*7*/
61 /*00*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
62 NONE, NONE, L' ', NONE, NONE, NONE, NONE, NONE,
63 /*10*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
64 NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
65 /*20*/ L' ', L'!', L'"', L'#', L'$', L'%', L'&', L'\'',
66 L'(', L')', L'*', L'+', L',', L'-', L'.', L'/',
67 /*30*/ L'0', L'1', L'2', L'3', L'4', L'5', L'6', L'7',
68 L'8', L'9', L':', L';', TAGE, L'=', TAGS, L'?',
69 /*40*/ L'@', L'A', L'B', L'C', L'D', L'E', L'F', L'G',
70 L'H', L'I', L'J', L'K', L'L', L'M', L'N', L'O',
71 /*50*/ L'P', L'Q', L'R', L'S', L'T', L'U', L'V', L'W',
72 L'X', L'Y', L'Z', L'[', L'\\', L']', L'^', L'_',
73 /*60*/ L'`', L'a', L'b', L'c', L'd', L'e', L'f', L'g',
74 L'h', L'i', L'j', L'k', L'l', L'm', L'n', L'o',
75 /*70*/ L'p', L'q', L'r', L's', L't', L'u', L'v', L'w',
76 L'x', L'y', L'z', L'{', L'|', L'}', L'~', NONE,
79 static char *gettag(char *, char *);
81 static Entry curentry;
82 static char tag[Buflen];
83 #define cursize (curentry.end-curentry.start)
86 pcollprintentry(Entry e, int cmd)
89 long r, rprev, t, rlig;
107 r = transtab[(*p++)&0x7F];
109 /* Emit the rune, but buffer in case of ligature */
113 } else if(r == TAGS) {
115 t = lookassoc(tagtab, asize(tagtab), tag);
117 if(debug && !outinhibit)
119 e.doff, cursize, tag);
126 } else if(t >= LIGS && t < LIGE) {
127 /* handle possible ligature */
128 rlig = liglookup(t, rprev);
130 rprev = rlig; /* overwrite rprev */
132 /* could print accent, but let's not */
133 if(rprev != NONE) outrune(rprev);
136 } else if(t >= MULTI && t < MULTIE) {
141 outrunes(multitab[t-MULTI]);
161 /* don't know enough of pron. key yet */
178 pcollnextoff(long fromoff)
183 a = Bseek(bdict, fromoff, 0);
187 p = Brdline(bdict, '\n');
190 if(p[0] == '>' && p[1] == 'H' && p[2] == '<')
191 return (Boffset(bdict)-Blinelen(bdict));
199 Bprint(bout, "No pronunciation key yet\n");
203 * f points just after '>'; fe points at end of entry.
204 * Expect next characters from bin to match:
207 * Accumulate the tag in tag[].
208 * Return pointer to after final '<'.
211 gettag(char *f, char *fe)
220 if(c == '<' || f == fe)