diff options
author | rsc <devnull@localhost> | 2004-03-26 01:47:43 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2004-03-26 01:47:43 +0000 |
commit | 65d5010edaa5c4fd943bfa88b1d8271669092ee6 (patch) | |
tree | d9f4ca3f36631cec354d0da747f500654f1489db /src/cmd/dict | |
parent | d6f81d852d83f965d9e2c4b594eb90974a5e4123 (diff) | |
download | plan9port-65d5010edaa5c4fd943bfa88b1d8271669092ee6.tar.gz plan9port-65d5010edaa5c4fd943bfa88b1d8271669092ee6.tar.bz2 plan9port-65d5010edaa5c4fd943bfa88b1d8271669092ee6.zip |
unken
Diffstat (limited to 'src/cmd/dict')
-rw-r--r-- | src/cmd/dict/movie.c | 60 | ||||
-rw-r--r-- | src/cmd/dict/robert.c | 48 |
2 files changed, 64 insertions, 44 deletions
diff --git a/src/cmd/dict/movie.c b/src/cmd/dict/movie.c index f1042fd6..b191e140 100644 --- a/src/cmd/dict/movie.c +++ b/src/cmd/dict/movie.c @@ -36,33 +36,37 @@ enum { /* Assoc tables must be sorted on first field */ -static char *tagtab[] = { -[BEG] "$$", -[AB] "AB", -[AN] "AN", -[AS] "AS", -[AU] "AU", -[AW] "AW", -[BW] "BW", -[CA] "CA", -[CN] "CN", -[CO] "CO", -[CR] "CR", -[DE] "DE", -[DR] "DR", -[ED] "ED", -[MP] "MP", -[NT] "NT", -[PR] "PR", -[PS] "PS", -[RA] "RA", -[RD] "RD", -[RT] "RT", -[RV] "RV", -[ST] "ST", -[TI] "TI", -[TX] "TX", -[VD] "VD", +static char *tagtab[NTAG]; + +static void +inittagtab(void) +{ + tagtab[BEG]= "$$"; + tagtab[AB]= "AB"; + tagtab[AN]= "AN"; + tagtab[AS]= "AS"; + tagtab[AU]= "AU"; + tagtab[AW]= "AW"; + tagtab[BW]= "BW"; + tagtab[CA]= "CA"; + tagtab[CN]= "CN"; + tagtab[CO]= "CO"; + tagtab[CR]= "CR"; + tagtab[DE]= "DE"; + tagtab[DR]= "DR"; + tagtab[ED]= "ED"; + tagtab[MP]= "MP"; + tagtab[NT]= "NT"; + tagtab[PR]= "PR"; + tagtab[PS]= "PS"; + tagtab[RA]= "RA"; + tagtab[RD]= "RD"; + tagtab[RT]= "RT"; + tagtab[RV]= "RV"; + tagtab[ST]= "ST"; + tagtab[TI]= "TI"; + tagtab[TX]= "TX"; + tagtab[VD]= "VD"; }; static char *mget(int, char *, char *, char **); @@ -305,6 +309,8 @@ mget(int tag, char *b, char *e, char **eptr) if(tag < 0 || tag >= NTAG) return 0; + if(tagtab[BEG] == 0) + inittagtab(); t = tagtab[tag]; ans = 0; for(p = b;;) { diff --git a/src/cmd/dict/robert.c b/src/cmd/dict/robert.c index 53b72dfb..12768616 100644 --- a/src/cmd/dict/robert.c +++ b/src/cmd/dict/robert.c @@ -58,28 +58,36 @@ static Rune intab[256] = { 0xb0, 0x2219, 0xb7, 0x221a, 0x207f, 0xb2, 0x220e, 0xa0, }; -static Rune suptab[] = { - ['0'] 0x2070, ['1'] 0x2071, ['2'] 0x2072, ['3'] 0x2073, - ['4'] 0x2074, ['5'] 0x2075, ['6'] 0x2076, ['7'] 0x2077, - ['8'] 0x2078, ['9'] 0x2079, ['+'] 0x207a, ['-'] 0x207b, - ['='] 0x207c, ['('] 0x207d, [')'] 0x207e, ['a'] 0xaa, - ['n'] 0x207f, ['o'] 0xba -}; +static Rune suptab[256]; -static Rune subtab[] = { - ['0'] 0x2080, ['1'] 0x2081, ['2'] 0x2082, ['3'] 0x2083, - ['4'] 0x2084, ['5'] 0x2085, ['6'] 0x2086, ['7'] 0x2087, - ['8'] 0x2088, ['9'] 0x2089, ['+'] 0x208a, ['-'] 0x208b, - ['='] 0x208c, ['('] 0x208d, [')'] 0x208e -}; +static void +initsuptab(void) +{ + suptab['0']= 0x2070; suptab['1']= 0x2071; suptab['2']= 0x2072; suptab['3']= 0x2073; + suptab['4']= 0x2074; suptab['5']= 0x2075; suptab['6']= 0x2076; suptab['7']= 0x2077; + suptab['8']= 0x2078; suptab['9']= 0x2079; suptab['+']= 0x207a; suptab['-']= 0x207b; + suptab['=']= 0x207c; suptab['(']= 0x207d; suptab[')']= 0x207e; suptab['a']= 0xaa; + suptab['n']= 0x207f; suptab['o']= 0xba; +} + +static Rune subtab[256]; + +static void +initsubtab(void) +{ + subtab['0']= 0x2080; subtab['1']= 0x2081; subtab['2']= 0x2082; subtab['3']= 0x2083; + subtab['4']= 0x2084; subtab['5']= 0x2085; subtab['6']= 0x2086; subtab['7']= 0x2087; + subtab['8']= 0x2088; subtab['9']= 0x2089; subtab['+']= 0x208a; subtab['-']= 0x208b; + subtab['=']= 0x208c; subtab['(']= 0x208d; subtab[')']= 0x208e; +} #define GSHORT(p) (((p)[0]<<8) | (p)[1]) #define GLONG(p) (((p)[0]<<24) | ((p)[1]<<16) | ((p)[2]<<8) | (p)[3]) -static char cfile[] = "/lib/dict/robert/cits.rob"; -static char dfile[] = "/lib/dict/robert/defs.rob"; -static char efile[] = "/lib/dict/robert/etym.rob"; -static char kfile[] = "/lib/dict/robert/_phon"; +static char cfile[] = "#9/dict/robert/cits.rob"; +static char dfile[] = "#9/dict/robert/defs.rob"; +static char efile[] = "#9/dict/robert/etym.rob"; +static char kfile[] = "#9/dict/robert/_phon"; static Biobuf * cb; static Biobuf * db; @@ -137,6 +145,11 @@ robertprintentry(Entry *def, Entry *etym, int cmd) int lineno = 0; int cit = 0; + if(suptab['0'] == 0) + initsuptab(); + if(subtab['0'] == 0) + initsubtab(); + p = (uchar *)def->start; pe = (uchar *)def->end; while(p < pe){ @@ -303,6 +316,7 @@ Bouvrir(char *fichier) { Biobuf *db; + fichier = unsharp(fichier); db = Bopen(fichier, OREAD); if(db == 0){ fprint(2, "%s: impossible d'ouvrir %s: %r\n", argv0, fichier); |