12 CIT = MULTIE+1, /* citation ptr followed by long int and ascii label */
13 BROM, /* bold roman */
14 ITON, /* start italic */
16 SYM, /* symbol font? */
18 BHEL, /* helvetica bold */
20 ITOFF, /* end italic */
21 SUP, /* following character is superscript */
22 SUB /* following character is subscript */
25 static Rune intab[256] = {
26 /*0*/ /*1*/ /*2*/ /*3*/ /*4*/ /*5*/ /*6*/ /*7*/
27 /*00*/ NONE, L'☺', L'☻', L'♥', L'♦', L'♣', L'♠', L'•',
28 0x25d8, L'ʘ', L'\n', L'♂', L'♀', L'♪', 0x266b, L'※',
29 /*10*/ L'⇨', L'⇦', L'↕', L'‼', L'¶', L'§', L'⁃', L'↨',
30 L'↑', L'↓', L'→', L'←', L'⌙', L'↔', 0x25b4, 0x25be,
31 /*20*/ L' ', L'!', L'"', L'#', L'$', L'%', L'&', L''',
32 L'(', L')', L'*', L'+', L',', L'-', L'.', L'/',
33 /*30*/ L'0', L'1', L'2', L'3', L'4', L'5', L'6', L'7',
34 L'8', L'9', L':', L';', L'<', L'=', L'>', L'?',
35 /*40*/ L'@', L'A', L'B', L'C', L'D', L'E', L'F', L'G',
36 L'H', L'I', L'J', L'K', L'L', L'M', L'N', L'O',
37 /*50*/ L'P', L'Q', L'R', L'S', L'T', L'U', L'V', L'W',
38 L'X', L'Y', L'Z', L'[', L'\\', L']', L'^', L'_',
39 /*60*/ L'`', L'a', L'b', L'c', L'd', L'e', L'f', L'g',
40 L'h', L'i', L'j', L'k', L'l', L'm', L'n', L'o',
41 /*70*/ L'p', L'q', L'r', L's', L't', L'u', L'v', L'w',
42 L'x', L'y', L'z', L'{', L'|', L'}', L'~', L'
\7f',
43 /*80*/ L'Ç', L'ü', L'é', L'â', L'ä', L'à', L'å', L'ç',
44 L'ê', L'ë', L'è', L'ï', L'î', L'ì', L'Ä', L'Å',
45 /*90*/ L'É', L'æ', L'Æ', L'ô', L'ö', L'ò', L'û', L'ù',
46 L'ÿ', L'Ö', L'Ü', L'¢', L'£', L'¥', L'₧', L'ʃ',
47 /*a0*/ L'á', L'í', L'ó', L'ú', L'ñ', L'Ñ', L'ª', L'º',
48 L'¿', L'⌐', L'¬', L'½', L'¼', L'¡', L'«', L'»',
49 /*b0*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
50 NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
51 /*c0*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
52 CIT, BROM, NONE, ITON, ROM, SYM, HEL, BHEL,
53 /*d0*/ NONE, SMALL, ITOFF, SUP, SUB, NONE, NONE, NONE,
54 NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
55 /*e0*/ L'α', L'ß', L'γ', L'π', L'Σ', L'σ', L'µ', L'τ',
56 L'Φ', L'Θ', L'Ω', L'δ', L'∞', L'Ø', L'ε', L'∩',
57 /*f0*/ L'≡', L'±', L'≥', L'≤', L'⌠', L'⌡', L'÷', L'≈',
58 L'°', L'∙', L'·', L'√', L'ⁿ', L'²', L'∎', L' ',
61 static Rune suptab[] = {
62 ['0'] L'⁰', ['1'] L'¹', ['2'] L'²', ['3'] L'³',
63 ['4'] L'⁴', ['5'] L'⁵', ['6'] L'⁶', ['7'] L'⁷',
64 ['8'] L'⁸', ['9'] L'⁹', ['+'] L'⁺', ['-'] L'⁻',
65 ['='] L'⁼', ['('] L'⁽', [')'] L'⁾', ['a'] L'ª',
66 ['n'] L'ⁿ', ['o'] L'º'
69 static Rune subtab[] = {
70 ['0'] L'₀', ['1'] L'₁', ['2'] L'₂', ['3'] L'₃',
71 ['4'] L'₄', ['5'] L'₅', ['6'] L'₆', ['7'] L'₇',
72 ['8'] L'₈', ['9'] L'₉', ['+'] L'₊', ['-'] L'₋',
73 ['='] L'₌', ['('] L'₍', [')'] L'₎'
76 #define GSHORT(p) (((p)[0]<<8) | (p)[1])
77 #define GLONG(p) (((p)[0]<<24) | ((p)[1]<<16) | ((p)[2]<<8) | (p)[3])
79 static char cfile[] = "/lib/dict/robert/cits.rob";
80 static char dfile[] = "/lib/dict/robert/defs.rob";
81 static char efile[] = "/lib/dict/robert/etym.rob";
82 static char kfile[] = "/lib/dict/robert/_phon";
88 static Biobuf * Bouvrir(char*);
89 static void citation(int, int);
90 static void robertprintentry(Entry*, Entry*, int);
93 robertindexentry(Entry e, int cmd)
95 uchar *p = (uchar *)e.start;
96 long ea, el, da, dl, fa;
108 if((def.start = malloc(dl+1)) == nil)
109 sysfatal("malloc: %r");
110 def.end = def.start + dl;
113 Bread(db, def.start, dl);
116 robertprintentry(&def, 0, cmd);
120 if((etym.start = malloc(el+1)) == nil)
121 sysfatal("malloc: %r");
122 etym.end = etym.start + el;
125 Bread(eb, etym.start, el);
127 robertprintentry(&def, &etym, cmd);
134 robertprintentry(Entry *def, Entry *etym, int cmd)
142 p = (uchar *)def->start;
143 pe = (uchar *)def->end;
150 switch(r = intab[c]){ /* assign = */
161 outprint("\\%.2ux", c);
174 n = p[0] | (p[1]<<8) | (p[2]<<16) | (p[3]<<24);
178 while(*p == ' ' || ('0'<=*p && *p<='9') || *p == '.'){
196 if(baseline > 0 && r < nelem(suptab))
198 else if(baseline < 0 && r < nelem(subtab))
211 if(lineno == 1 && etym)
212 robertprintentry(etym, 0, cmd);
219 citation(int addr, int cmd)
226 cit.start = Brdline(cb, 0xc8);
227 cit.end = cit.start + Blinelen(cb) - 1;
230 robertprintentry(&cit, 0, cmd);
234 robertnextoff(long fromoff)
236 return (fromoff & ~15) + 16;
246 while(l = Brdline(db, '\n')) /* assign = */
247 Bwrite(bout, l, Blinelen(db));
252 robertflexentry(Entry e, int cmd)
258 p = (uchar *)e.start;
271 if(cmd == 'h' && lineno > 2)
274 if(cmd == 'h' && lineno < 2)
278 Bprint(bout, "\\%.2ux", c);
290 robertnextflex(long fromoff)
294 if(Bseek(bdict, fromoff, 0) < 0)
296 while((c = Bgetc(bdict)) >= 0){
298 return Boffset(bdict);
304 Bouvrir(char *fichier)
308 db = Bopen(fichier, OREAD);
310 fprint(2, "%s: impossible d'ouvrir %s: %r\n", argv0, fichier);