7 * Routines for handling dictionaries in the "Paperback Collins"
8 * `German' format (with tags surrounded by \5⋯\6 and \xba⋯\xba)
12 * \5...\6 escapes (fonts, mostly)
14 * h headword (helvetica 7 pt)
15 * c clause (helvetica 7 pt)
35 IBASE=0x69, /* dotless i */
39 static Rune intab[256] = {
40 /*0*/ /*1*/ /*2*/ /*3*/ /*4*/ /*5*/ /*6*/ /*7*/
41 /*00*/ NONE, NONE, NONE, NONE, NONE, TAGS, TAGE, NONE,
42 NONE, NONE, NONE, NONE, NONE, 0x20, NONE, NONE,
43 /*10*/ NONE, 0x2d, 0x20, 0x20, NONE, NONE, NONE, NONE,
44 0x20, NONE, NONE, NONE, 0x20, NONE, NONE, 0x2d,
45 /*20*/ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, '\'',
46 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
47 /*30*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
48 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
49 /*40*/ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
50 0x48, 0x49, 0x4a, 0x4b,'L', 0x4d, 0x4e, 0x4f,
51 /*50*/ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
52 0x58, 0x59, 0x5a, 0x5b,'\\', 0x5d, 0x5e, 0x5f,
53 /*60*/ 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
54 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
55 /*70*/ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
56 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, NONE,
57 /*80*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
58 NONE, NONE, 0x20, NONE, NONE, NONE, NONE, NONE,
59 /*90*/ 0xdf, 0xe6, NONE, MOE, NONE, NONE, NONE, 0xf8,
60 NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
61 /*A0*/ NONE, NONE, 0x22, 0xa3, NONE, NONE, NONE, NONE,
62 NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
63 /*B0*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, 0x7e,
64 NONE, IBASE, SPCS, NONE, NONE, NONE, NONE, NONE,
65 /*C0*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
66 NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
67 /*D0*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
68 NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
69 /*E0*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
70 NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
71 /*F0*/ 0x20, 0x20, NONE, NONE, NONE, NONE, NONE, NONE,
72 NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE
75 static Nassoc numtab[] = {
97 {445, 0xf0}, /* BUG -- should be script eth */
100 static Nassoc overtab[] = {
109 static uchar *reach(uchar*, int);
111 static Entry curentry;
112 static char tag[Taglen];
115 pcollgprintentry(Entry e, int cmd)
118 int r, rprev = NONE, rx, over = 0, font;
121 p = (uchar *)e.start;
131 switch(r = intab[*p++]){ /* assign = */
140 outinhibit = (font != 'h');
143 case TAGE: /* an extra one */
148 r = looknassoc(numtab, asize(numtab), strtol(tag,0,0));
154 sprint(buf, "\\N'%s'", tag);
158 /* else fall through */
162 rx = looknassoc(overtab, asize(overtab), r);
164 rx = liglookup(rx, rprev);
165 if(rx > 0 && rx != NONE)
196 pcollgnextoff(long fromoff)
198 int c, state = 0, defoff = -1;
200 if(Bseek(bdict, fromoff, 0) < 0)
202 while((c = Bgetc(bdict)) >= 0){
204 defoff = Boffset(bdict);
218 return (Boffset(bdict)-3);
230 Bprint(bout, "No pronunciation key yet\n");
234 reach(uchar *p, int tagchar)
238 while(p < (uchar *)curentry.end){
243 if(q >= &tag[sizeof tag-1])