]> git.lizzy.rs Git - plan9front.git/blob - sys/src/cmd/dict/dict.h
cc, ?[acl]: fix gethunk() and move common memory allocator code to cc/compat
[plan9front.git] / sys / src / cmd / dict / dict.h
1 /* Runes for special purposes (0xe800-0xfdff is Private Use Area) */
2 enum {  NONE=0xe800,    /* Emit nothing */
3         TAGS,           /* Start of tag */
4         TAGE,           /* End of tag */
5         SPCS,           /* Start of special character name */
6         PAR,            /* Newline, indent */
7         LIGS,           /* Start of ligature codes */
8         LACU=LIGS,      /* Acute (´) ligatures */
9         LGRV,           /* Grave (ˋ) ligatures */
10         LUML,           /* Umlaut (¨) ligatures */
11         LCED,           /* Cedilla (¸) ligatures */
12         LTIL,           /* Tilde (˜) ligatures */
13         LBRV,           /* Breve (˘) ligatures */
14         LRNG,           /* Ring (˚) ligatures */
15         LDOT,           /* Dot (˙) ligatures */
16         LDTB,           /* Dot below (.) ligatures */
17         LFRN,           /* Frown (⌢) ligatures */
18         LFRB,           /* Frown below (̯) ligatures */
19         LOGO,           /* Ogonek (˛) ligatures */
20         LMAC,           /* Macron (¯) ligatures */
21         LHCK,           /* Hacek (ˇ) ligatures */
22         LASP,           /* Asper (ʽ) ligatures */
23         LLEN,           /* Lenis (ʼ) ligatures */
24         LBRB,           /* Breve below (̮) ligatures */
25         LIGE,           /* End of ligature codes */
26         MULTI,          /* Start of multi-rune codes */
27         MAAS=MULTI,     /* ʽα */
28         MALN,           /* ʼα */
29         MAND,           /* and */
30         MAOQ,           /* a/q */
31         MBRA,           /* <| */
32         MDD,            /* .. */
33         MDDD,           /* ... */
34         MEAS,           /* ʽε */
35         MELN,           /* ʼε */
36         MEMM,           /* —— */
37         MHAS,           /* ʽη */
38         MHLN,           /* ʼη */
39         MIAS,           /* ʽι */
40         MILN,           /* ʼι */
41         MLCT,           /* ct */
42         MLFF,           /* ff */
43         MLFFI,          /* ffi */
44         MLFFL,          /* ffl */
45         MLFL,           /* fl */
46         MLFI,           /* fi */
47         MLLS,           /* ll with swing */
48         MLST,           /* st */
49         MOAS,           /* ʽο */
50         MOLN,           /* ʼο */
51         MOR,            /* or */
52         MRAS,           /* ʽρ */
53         MRLN,           /* ʼρ */
54         MTT,            /* ~~ */
55         MUAS,           /* ʽυ */
56         MULN,           /* ʼυ */
57         MWAS,           /* ʽω */
58         MWLN,           /* ʼω */
59         MOE,            /* oe */
60         MES,            /* em space */
61         MULTIE,         /* End of multi-rune codes */
62 };
63 #define Nligs (LIGE-LIGS)
64 #define Nmulti (MULTIE-MULTI)
65
66 typedef struct Entry Entry;
67 typedef struct Assoc Assoc;
68 typedef struct Nassoc Nassoc;
69 typedef struct Dict Dict;
70
71 struct Entry {
72         char    *start;         /* entry starts at start */
73         char    *end;           /* and finishes just before end */
74         long    doff;           /* dictionary offset (for debugging) */
75 };
76
77 struct Assoc {
78         char    *key;
79         long    val;
80 };
81
82 struct Nassoc {
83         long    key;
84         long    val;
85 };
86
87 struct Dict {
88         char    *name;                  /* dictionary name */
89         char    *desc;                  /* description */
90         char    *path;                  /* path to dictionary data */
91         char    *indexpath;             /* path to index data */
92         long    (*nextoff)(long);       /* function to find next entry offset from arg */
93         void    (*printentry)(Entry, int); /* function to print entry */
94         void    (*printkey)(void);      /* function to print pronunciation key */
95 };
96
97 int     acomp(Rune*, Rune*);
98 Rune    *changett(Rune *, Rune *, int);
99 void    err(char*, ...);
100 void    fold(Rune *);
101 void    foldre(char*, char*);
102 Rune    liglookup(Rune, Rune);
103 long    lookassoc(Assoc*, int, char*);
104 long    looknassoc(Nassoc*, int, long);
105 void    outprint(char*, ...);
106 void    outrune(long);
107 void    outrunes(Rune *);
108 void    outchar(int);
109 void    outchars(char *);
110 void    outnl(int);
111 void    outpiece(char *, char *);
112 long    runetol(Rune*);
113
114 long    oednextoff(long);
115 void    oedprintentry(Entry, int);
116 void    oedprintkey(void);
117 long    ahdnextoff(long);
118 void    ahdprintentry(Entry, int);
119 void    ahdprintkey(void);
120 long    pcollnextoff(long);
121 void    pcollprintentry(Entry, int);
122 void    pcollprintkey(void);
123 long    pcollgnextoff(long);
124 void    pcollgprintentry(Entry, int);
125 void    pcollgprintkey(void);
126 long    movienextoff(long);
127 void    movieprintentry(Entry, int);
128 void    movieprintkey(void);
129 long    pgwnextoff(long);
130 void    pgwprintentry(Entry,int);
131 void    pgwprintkey(void);
132 void    rogetprintentry(Entry, int);
133 long    rogetnextoff(long);
134 void    rogetprintkey(void);
135 long    slangnextoff(long);
136 void    slangprintentry(Entry, int);
137 void    slangprintkey(void);
138 long    robertnextoff(long);
139 void    robertindexentry(Entry, int);
140 void    robertprintkey(void);
141 long    robertnextflex(long);
142 void    robertflexentry(Entry, int);
143 long    simplenextoff(long);
144 void    simpleprintentry(Entry, int);
145 void    simpleprintkey(void);
146 long    thesnextoff(long);
147 void    thesprintentry(Entry, int);
148 void    thesprintkey(void);
149 long    worldnextoff(long);
150 void    worldprintentry(Entry, int);
151 void    worldprintkey(void);
152
153 extern Biobuf   *bdict;
154 extern Biobuf   *bout;
155 extern int      linelen;
156 extern int      breaklen;
157 extern int      outinhibit;
158 extern int      debug;
159 extern Rune     *multitab[];
160 extern Dict     dicts[];
161
162 #define asize(a) (sizeof (a)/sizeof(a[0]))