xref: /plan9/sys/src/cmd/dict/dict.h (revision 119a69fa8ad92159a87063874a5e6ab47dcf1bcf)
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 void	runescpy(Rune*, Rune*);
113 long	runetol(Rune*);
114 
115 long	oednextoff(long);
116 void	oedprintentry(Entry, int);
117 void	oedprintkey(void);
118 long	ahdnextoff(long);
119 void	ahdprintentry(Entry, int);
120 void	ahdprintkey(void);
121 long	pcollnextoff(long);
122 void	pcollprintentry(Entry, int);
123 void	pcollprintkey(void);
124 long	pcollgnextoff(long);
125 void	pcollgprintentry(Entry, int);
126 void	pcollgprintkey(void);
127 long	movienextoff(long);
128 void	movieprintentry(Entry, int);
129 void	movieprintkey(void);
130 long	pgwnextoff(long);
131 void	pgwprintentry(Entry,int);
132 void	pgwprintkey(void);
133 void	rogetprintentry(Entry, int);
134 long	rogetnextoff(long);
135 void	rogetprintkey(void);
136 long	slangnextoff(long);
137 void	slangprintentry(Entry, int);
138 void	slangprintkey(void);
139 long	robertnextoff(long);
140 void	robertindexentry(Entry, int);
141 void	robertprintkey(void);
142 long	robertnextflex(long);
143 void	robertflexentry(Entry, int);
144 long	simplenextoff(long);
145 void	simpleprintentry(Entry, int);
146 void	simpleprintkey(void);
147 long	thesnextoff(long);
148 void	thesprintentry(Entry, int);
149 void	thesprintkey(void);
150 long	worldnextoff(long);
151 void	worldprintentry(Entry, int);
152 void	worldprintkey(void);
153 
154 extern Biobuf	*bdict;
155 extern Biobuf	*bout;
156 extern int	linelen;
157 extern int	breaklen;
158 extern int	outinhibit;
159 extern int	debug;
160 extern Rune	*multitab[];
161 extern Dict	dicts[];
162 
163 #define asize(a) (sizeof (a)/sizeof(a[0]))
164