plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

dict.h (4296B)


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