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", 0x65}, /* should be raised */
51 {"supo", 0x6f}, /* 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, 0x20, 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*/ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, '\'',
66 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
67 /*30*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
68 0x38, 0x39, 0x3a, 0x3b, TAGE, 0x3d, TAGS, 0x3f,
69 /*40*/ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
70 0x48, 0x49, 0x4a, 0x4b, 'L', 0x4d, 0x4e, 0x4f,
71 /*50*/ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
72 0x58, 0x59, 0x5a, 0x5b, '\\', 0x5d, 0x5e, 0x5f,
73 /*60*/ 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
74 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
75 /*70*/ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
76 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 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)