7 * Robert Électronique.
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, 0x263a, 0x263b, 0x2665, 0x2666, 0x2663, 0x2660, 0x2022,
28 0x25d8, 0x298, L'\n', 0x2642, 0x2640, 0x266a, 0x266b, 0x203b,
29 /*10*/ 0x21e8, 0x21e6, 0x2195, 0x203c, 0xb6, 0xa7, 0x2043, 0x21a8,
30 0x2191, 0x2193, 0x2192, 0x2190, 0x2319, 0x2194, 0x25b4, 0x25be,
31 /*20*/ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, L'\'',
32 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
33 /*30*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
34 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
35 /*40*/ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
36 0x48, 0x49, 0x4a, 0x4b, L'L', 0x4d, 0x4e, 0x4f,
37 /*50*/ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
38 0x58, 0x59, 0x5a, 0x5b, L'\\', 0x5d, 0x5e, 0x5f,
39 /*60*/ 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
40 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
41 /*70*/ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
42 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
43 /*80*/ 0xc7, 0xfc, 0xe9, 0xe2, 0xe4, 0xe0, 0xe5, 0xe7,
44 0xea, 0xeb, 0xe8, 0xef, 0xee, 0xec, 0xc4, 0xc5,
45 /*90*/ 0xc9, 0xe6, 0xc6, 0xf4, 0xf6, 0xf2, 0xfb, 0xf9,
46 0xff, 0xd6, 0xdc, 0xa2, 0xa3, 0xa5, 0x20a7, 0x283,
47 /*a0*/ 0xe1, 0xed, 0xf3, 0xfa, 0xf1, 0xd1, 0xaa, 0xba,
48 0xbf, 0x2310, 0xac, 0xbd, 0xbc, 0xa1, 0xab, 0xbb,
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*/ 0x3b1, 0xdf, 0x3b3, 0x3c0, 0x3a3, 0x3c3, 0xb5, 0x3c4,
56 0x3a6, 0x398, 0x3a9, 0x3b4, 0x221e, 0xd8, 0x3b5, 0x2229,
57 /*f0*/ 0x2261, 0xb1, 0x2265, 0x2264, 0x2320, 0x2321, 0xf7, 0x2248,
58 0xb0, 0x2219, 0xb7, 0x221a, 0x207f, 0xb2, 0x220e, 0xa0,
61 static Rune suptab[] = {
62 ['0'] 0x2070, ['1'] 0x2071, ['2'] 0x2072, ['3'] 0x2073,
63 ['4'] 0x2074, ['5'] 0x2075, ['6'] 0x2076, ['7'] 0x2077,
64 ['8'] 0x2078, ['9'] 0x2079, ['+'] 0x207a, ['-'] 0x207b,
65 ['='] 0x207c, ['('] 0x207d, [')'] 0x207e, ['a'] 0xaa,
66 ['n'] 0x207f, ['o'] 0xba
69 static Rune subtab[] = {
70 ['0'] 0x2080, ['1'] 0x2081, ['2'] 0x2082, ['3'] 0x2083,
71 ['4'] 0x2084, ['5'] 0x2085, ['6'] 0x2086, ['7'] 0x2087,
72 ['8'] 0x2088, ['9'] 0x2089, ['+'] 0x208a, ['-'] 0x208b,
73 ['='] 0x208c, ['('] 0x208d, [')'] 0x208e
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 def.start = malloc(dl+1);
109 def.end = def.start + dl;
112 Bread(db, def.start, dl);
115 robertprintentry(&def, 0, cmd);
119 etym.start = malloc(el+1);
120 etym.end = etym.start + el;
123 Bread(eb, etym.start, el);
125 robertprintentry(&def, &etym, cmd);
132 robertprintentry(Entry *def, Entry *etym, int cmd)
140 p = (uchar *)def->start;
141 pe = (uchar *)def->end;
148 switch(r = intab[c]){ /* assign = */
159 outprint("\\%.2ux", c);
172 n = p[0] | (p[1]<<8) | (p[2]<<16) | (p[3]<<24);
176 while(*p == ' ' || ('0'<=*p && *p<='9') || *p == '.'){
194 if(baseline > 0 && r < nelem(suptab))
196 else if(baseline < 0 && r < nelem(subtab))
209 if(lineno == 1 && etym)
210 robertprintentry(etym, 0, cmd);
217 citation(int addr, int cmd)
224 cit.start = Brdline(cb, 0xc8);
225 cit.end = cit.start + Blinelen(cb) - 1;
228 robertprintentry(&cit, 0, cmd);
232 robertnextoff(long fromoff)
234 return (fromoff & ~15) + 16;
244 while(l = Brdline(db, '\n')) /* assign = */
245 Bwrite(bout, l, Blinelen(db));
250 robertflexentry(Entry e, int cmd)
256 p = (uchar *)e.start;
269 if(cmd == 'h' && lineno > 2)
272 if(cmd == 'h' && lineno < 2)
276 Bprint(bout, "\\%.2ux", c);
288 robertnextflex(long fromoff)
292 if(Bseek(bdict, fromoff, 0) < 0)
294 while((c = Bgetc(bdict)) >= 0){
296 return Boffset(bdict);
302 Bouvrir(char *fichier)
306 db = Bopen(fichier, OREAD);
308 fprint(2, "%s: impossible d'ouvrir %s: %r\n", argv0, fichier);