dict.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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. typedef struct Entry Entry;
  66. typedef struct Assoc Assoc;
  67. typedef struct Nassoc Nassoc;
  68. typedef struct Dict Dict;
  69. struct Entry {
  70. char *start; /* entry starts at start */
  71. char *end; /* and finishes just before end */
  72. long doff; /* dictionary offset (for debugging) */
  73. };
  74. struct Assoc {
  75. char *key;
  76. long val;
  77. };
  78. struct Nassoc {
  79. long key;
  80. long val;
  81. };
  82. struct Dict {
  83. char *name; /* dictionary name */
  84. char *desc; /* description */
  85. char *path; /* path to dictionary data */
  86. char *indexpath; /* path to index data */
  87. long (*nextoff)(long); /* function to find next entry offset from arg */
  88. void (*printentry)(Entry, int); /* function to print entry */
  89. void (*printkey)(void); /* function to print pronunciation key */
  90. };
  91. int acomp(Rune*, Rune*);
  92. Rune *changett(Rune *, Rune *, int);
  93. void err(char*, ...);
  94. void fold(Rune *);
  95. void foldre(char*, char*);
  96. Rune liglookup(Rune, Rune);
  97. long lookassoc(Assoc*, int, char*);
  98. long looknassoc(Nassoc*, int, long);
  99. void outprint(char*, ...);
  100. void outrune(long);
  101. void outrunes(Rune *);
  102. void outchar(int);
  103. void outchars(char *);
  104. void outnl(int);
  105. void outpiece(char *, char *);
  106. void runescpy(Rune*, Rune*);
  107. long runetol(Rune*);
  108. long oednextoff(long);
  109. void oedprintentry(Entry, int);
  110. void oedprintkey(void);
  111. long ahdnextoff(long);
  112. void ahdprintentry(Entry, int);
  113. void ahdprintkey(void);
  114. long pcollnextoff(long);
  115. void pcollprintentry(Entry, int);
  116. void pcollprintkey(void);
  117. long pcollgnextoff(long);
  118. void pcollgprintentry(Entry, int);
  119. void pcollgprintkey(void);
  120. long movienextoff(long);
  121. void movieprintentry(Entry, int);
  122. void movieprintkey(void);
  123. long pgwnextoff(long);
  124. void pgwprintentry(Entry,int);
  125. void pgwprintkey(void);
  126. void rogetprintentry(Entry, int);
  127. long rogetnextoff(long);
  128. void rogetprintkey(void);
  129. long slangnextoff(long);
  130. void slangprintentry(Entry, int);
  131. void slangprintkey(void);
  132. long robertnextoff(long);
  133. void robertindexentry(Entry, int);
  134. void robertprintkey(void);
  135. long robertnextflex(long);
  136. void robertflexentry(Entry, int);
  137. long simplenextoff(long);
  138. void simpleprintentry(Entry, int);
  139. void simpleprintkey(void);
  140. long thesnextoff(long);
  141. void thesprintentry(Entry, int);
  142. void thesprintkey(void);
  143. long worldnextoff(long);
  144. void worldprintentry(Entry, int);
  145. void worldprintkey(void);
  146. extern Biobuf *bdict;
  147. extern Biobuf *bout;
  148. extern int linelen;
  149. extern int breaklen;
  150. extern int outinhibit;
  151. extern int debug;
  152. extern Rune *multitab[];
  153. extern Dict dicts[];
  154. #define asize(a) (sizeof (a)/sizeof(a[0]))