oed.c 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425
  1. #include <u.h>
  2. #include <libc.h>
  3. #include <bio.h>
  4. #include "dict.h"
  5. enum {
  6. Buflen=1000,
  7. Maxaux=5,
  8. };
  9. /* Possible tags */
  10. enum {
  11. A, /* author in quote (small caps) */
  12. B, /* bold */
  13. Ba, /* author inside bib */
  14. Bch, /* builtup chem component */
  15. Bib, /* surrounds word 'in' for bibliographic ref */
  16. Bl, /* bold */
  17. Bo, /* bond over */
  18. Bu, /* bond under */
  19. Cb, /* ? block of stuff (indent) */
  20. Cf, /* cross ref to another entry (italics) */
  21. Chem, /* chemistry formula */
  22. Co, /* over (preceding sum, integral, etc.) */
  23. Col, /* column of table (aux just may be r) */
  24. Cu, /* under (preceding sum, integral, etc.) */
  25. Dat, /* date */
  26. Db, /* def block? indent */
  27. Dn, /* denominator of fraction */
  28. E, /* main entry */
  29. Ed, /* editor's comments (in [...]) */
  30. Etym, /* etymology (in [...]) */
  31. Fq, /* frequency count (superscript) */
  32. Form, /* formula */
  33. Fr, /* fraction (contains <nu>, then <dn>) */
  34. Gk, /* greek (transliteration) */
  35. Gr, /* grammar? (e.g., around 'pa.' in 'pa. pple.') */
  36. Hg, /* headword group */
  37. Hm, /* homonym (superscript) */
  38. Hw, /* headword (bold) */
  39. I, /* italics */
  40. Il, /* italic list? */
  41. In, /* inferior (subscript) */
  42. L, /* row of col of table */
  43. La, /* status or usage label (italic) */
  44. Lc, /* chapter/verse sort of thing for works */
  45. N, /* note (smaller type) */
  46. Nu, /* numerator of fraction */
  47. Ov, /* needs overline */
  48. P, /* paragraph (indent) */
  49. Ph, /* pronunciation (transliteration) */
  50. Pi, /* pile (frac without line) */
  51. Pqp, /* subblock of quote */
  52. Pr, /* pronunciation (in (...)) */
  53. Ps, /* position (e.g., adv.) (italic) */
  54. Pt, /* part (in lc) */
  55. Q, /* quote in quote block */
  56. Qd, /* quote date (bold) */
  57. Qig, /* quote number (greek) */
  58. Qla, /* status or usage label in quote (italic) */
  59. Qp, /* quote block (small type, indent) */
  60. Qsn, /* quote number */
  61. Qt, /* quote words */
  62. R, /* roman type style */
  63. Rx, /* relative cross reference (e.g., next) */
  64. S, /* another form? (italic) */
  65. S0, /* sense (sometimes surrounds several sx's) */
  66. S1, /* sense (aux num: indented bold letter) */
  67. S2, /* sense (aux num: indented bold capital rom num) */
  68. S3, /* sense (aux num: indented number of asterisks) */
  69. S4, /* sense (aux num: indented bold number) */
  70. S5, /* sense (aux num: indented number of asterisks) */
  71. S6, /* subsense (aux num: bold letter) */
  72. S7a, /* subsense (aux num: letter) */
  73. S7n, /* subsense (aux num: roman numeral) */
  74. Sc, /* small caps */
  75. Sgk, /* subsense (aux num: transliterated greek) */
  76. Sn, /* sense of subdefinition (aux num: roman letter) */
  77. Ss, /* sans serif */
  78. Ssb, /* sans serif bold */
  79. Ssi, /* sans serif italic */
  80. Su, /* superior (superscript) */
  81. Sub, /* subdefinition */
  82. Table, /* table (aux cols=number of columns) */
  83. Tt, /* title? (italics) */
  84. Vd, /* numeric label for variant form */
  85. Ve, /* variant entry */
  86. Vf, /* variant form (light bold) */
  87. Vfl, /* list of vf's (starts with Also or Forms) */
  88. W, /* work (e.g., Beowulf) (italics) */
  89. X, /* cross reference to main word (small caps) */
  90. Xd, /* cross reference to quotation by date */
  91. Xi, /* internal cross reference ? (italic) */
  92. Xid, /* cross reference identifer, in quote ? */
  93. Xs, /* cross reference sense (lower number) */
  94. Xr, /* list of x's */
  95. Ntag /* end of tags */
  96. };
  97. /* Assoc tables must be sorted on first field */
  98. static Assoc tagtab[] = {
  99. {"a", A},
  100. {"b", B},
  101. {"ba", Ba},
  102. {"bch", Bch},
  103. {"bib", Bib},
  104. {"bl", Bl},
  105. {"bo", Bo},
  106. {"bu", Bu},
  107. {"cb", Cb},
  108. {"cf", Cf},
  109. {"chem", Chem},
  110. {"co", Co},
  111. {"col", Col},
  112. {"cu", Cu},
  113. {"dat", Dat},
  114. {"db", Db},
  115. {"dn", Dn},
  116. {"e", E},
  117. {"ed", Ed},
  118. {"et", Etym},
  119. {"etym", Etym},
  120. {"form", Form},
  121. {"fq", Fq},
  122. {"fr", Fr},
  123. {"frac", Fr},
  124. {"gk", Gk},
  125. {"gr", Gr},
  126. {"hg", Hg},
  127. {"hm", Hm},
  128. {"hw", Hw},
  129. {"i", I},
  130. {"il", Il},
  131. {"in", In},
  132. {"l", L},
  133. {"la", La},
  134. {"lc", Lc},
  135. {"n", N},
  136. {"nu", Nu},
  137. {"ov", Ov},
  138. {"p", P},
  139. {"ph", Ph},
  140. {"pi", Pi},
  141. {"pqp", Pqp},
  142. {"pr", Pr},
  143. {"ps", Ps},
  144. {"pt", Pt},
  145. {"q", Q},
  146. {"qd", Qd},
  147. {"qig", Qig},
  148. {"qla", Qla},
  149. {"qp", Qp},
  150. {"qsn", Qsn},
  151. {"qt", Qt},
  152. {"r", R},
  153. {"rx", Rx},
  154. {"s", S},
  155. {"s0", S0},
  156. {"s1", S1},
  157. {"s2", S2},
  158. {"s3", S3},
  159. {"s4", S4},
  160. {"s5", S5},
  161. {"s6", S6},
  162. {"s7a", S7a},
  163. {"s7n", S7n},
  164. {"sc", Sc},
  165. {"sgk", Sgk},
  166. {"sn", Sn},
  167. {"ss", Ss,},
  168. {"ssb", Ssb},
  169. {"ssi", Ssi},
  170. {"su", Su},
  171. {"sub", Sub},
  172. {"table", Table},
  173. {"tt", Tt},
  174. {"vd", Vd},
  175. {"ve", Ve},
  176. {"vf", Vf},
  177. {"vfl", Vfl},
  178. {"w", W},
  179. {"x", X},
  180. {"xd", Xd},
  181. {"xi", Xi},
  182. {"xid", Xid},
  183. {"xr", Xr},
  184. {"xs", Xs},
  185. };
  186. /* Possible tag auxilliary info */
  187. enum {
  188. Cols, /* number of columns in a table */
  189. Num, /* letter or number, for a sense */
  190. St, /* status (e.g., obs) */
  191. Naux
  192. };
  193. static Assoc auxtab[] = {
  194. {"cols", Cols},
  195. {"num", Num},
  196. {"st", St}
  197. };
  198. static Assoc spectab[] = {
  199. {"3on4", L'¾'},
  200. {"Aacu", L'Á'},
  201. {"Aang", L'Å'},
  202. {"Abarab", L'Ā'},
  203. {"Acirc", L'Â'},
  204. {"Ae", L'Æ'},
  205. {"Agrave", L'À'},
  206. {"Alpha", L'Α'},
  207. {"Amac", L'Ā'},
  208. {"Asg", L'Ʒ'}, /* Unicyle. Cf "Sake" */
  209. {"Auml", L'Ä'},
  210. {"Beta", L'Β'},
  211. {"Cced", L'Ç'},
  212. {"Chacek", L'Č'},
  213. {"Chi", L'Χ'},
  214. {"Chirho", L'☧'}, /* Chi Rho U+2627 */
  215. {"Csigma", L'Ϛ'},
  216. {"Delta", L'Δ'},
  217. {"Eacu", L'É'},
  218. {"Ecirc", L'Ê'},
  219. {"Edh", L'Ð'},
  220. {"Epsilon", L'Ε'},
  221. {"Eta", L'Η'},
  222. {"Gamma", L'Γ'},
  223. {"Iacu", L'Í'},
  224. {"Icirc", L'Î'},
  225. {"Imac", L'Ī'},
  226. {"Integ", L'∫'},
  227. {"Iota", L'Ι'},
  228. {"Kappa", L'Κ'},
  229. {"Koppa", L'Ϟ'},
  230. {"Lambda", L'Λ'},
  231. {"Lbar", L'Ł'},
  232. {"Mu", L'Μ'},
  233. {"Naira", L'N'}, /* should have bar through */
  234. {"Nplus", L'N'}, /* should have plus above */
  235. {"Ntilde", L'Ñ'},
  236. {"Nu", L'Ν'},
  237. {"Oacu", L'Ó'},
  238. {"Obar", L'Ø'},
  239. {"Ocirc", L'Ô'},
  240. {"Oe", L'Œ'},
  241. {"Omega", L'Ω'},
  242. {"Omicron", L'Ο'},
  243. {"Ouml", L'Ö'},
  244. {"Phi", L'Φ'},
  245. {"Pi", L'Π'},
  246. {"Psi", L'Ψ'},
  247. {"Rho", L'Ρ'},
  248. {"Sacu", L'Ś'},
  249. {"Sigma", L'Σ'},
  250. {"Summ", L'∑'},
  251. {"Tau", L'Τ'},
  252. {"Th", L'Þ'},
  253. {"Theta", L'Θ'},
  254. {"Tse", L'Ц'},
  255. {"Uacu", L'Ú'},
  256. {"Ucirc", L'Û'},
  257. {"Upsilon", L'Υ'},
  258. {"Uuml", L'Ü'},
  259. {"Wyn", L'ƿ'}, /* wynn U+01BF */
  260. {"Xi", L'Ξ'},
  261. {"Ygh", L'Ʒ'}, /* Yogh U+01B7 */
  262. {"Zeta", L'Ζ'},
  263. {"Zh", L'Ʒ'}, /* looks like Yogh. Cf "Sake" */
  264. {"a", L'a'}, /* ante */
  265. {"aacu", L'á'},
  266. {"aang", L'å'},
  267. {"aasper", MAAS},
  268. {"abreve", L'ă'},
  269. {"acirc", L'â'},
  270. {"acu", LACU},
  271. {"ae", L'æ'},
  272. {"agrave", L'à'},
  273. {"ahook", L'ą'},
  274. {"alenis", MALN},
  275. {"alpha", L'α'},
  276. {"amac", L'ā'},
  277. {"amp", L'&'},
  278. {"and", MAND},
  279. {"ang", LRNG},
  280. {"angle", L'∠'},
  281. {"ankh", L'☥'}, /* ankh U+2625 */
  282. {"ante", L'a'}, /* before (year) */
  283. {"aonq", MAOQ},
  284. {"appreq", L'≃'},
  285. {"aquar", L'♒'},
  286. {"arDadfull", L'ض'}, /* Dad U+0636 */
  287. {"arHa", L'ح'}, /* haa U+062D */
  288. {"arTa", L'ت'}, /* taa U+062A */
  289. {"arain", L'ع'}, /* ain U+0639 */
  290. {"arainfull", L'ع'}, /* ain U+0639 */
  291. {"aralif", L'ا'}, /* alef U+0627 */
  292. {"arba", L'ب'}, /* baa U+0628 */
  293. {"arha", L'ه'}, /* ha U+0647 */
  294. {"aries", L'♈'},
  295. {"arnun", L'ن'}, /* noon U+0646 */
  296. {"arnunfull", L'ن'}, /* noon U+0646 */
  297. {"arpa", L'ه'}, /* ha U+0647 */
  298. {"arqoph", L'ق'}, /* qaf U+0642 */
  299. {"arshinfull", L'ش'}, /* sheen U+0634 */
  300. {"arta", L'ت'}, /* taa U+062A */
  301. {"artafull", L'ت'}, /* taa U+062A */
  302. {"artha", L'ث'}, /* thaa U+062B */
  303. {"arwaw", L'و'}, /* waw U+0648 */
  304. {"arya", L'ي'}, /* ya U+064A */
  305. {"aryafull", L'ي'}, /* ya U+064A */
  306. {"arzero", L'٠'}, /* indic zero U+0660 */
  307. {"asg", L'ʒ'}, /* unicycle character. Cf "hallow" */
  308. {"asper", LASP},
  309. {"assert", L'⊢'},
  310. {"astm", L'⁂'}, /* asterism: should be upside down */
  311. {"at", L'@'},
  312. {"atilde", L'ã'},
  313. {"auml", L'ä'},
  314. {"ayin", L'ع'}, /* arabic ain U+0639 */
  315. {"b1", L'-'}, /* single bond */
  316. {"b2", L'='}, /* double bond */
  317. {"b3", L'≡'}, /* triple bond */
  318. {"bbar", L'ƀ'}, /* b with bar U+0180 */
  319. {"beta", L'β'},
  320. {"bigobl", L'/'},
  321. {"blC", L'C'}, /* should be black letter */
  322. {"blJ", L'J'}, /* should be black letter */
  323. {"blU", L'U'}, /* should be black letter */
  324. {"blb", L'b'}, /* should be black letter */
  325. {"blozenge", L'◊'}, /* U+25CA; should be black */
  326. {"bly", L'y'}, /* should be black letter */
  327. {"bra", MBRA},
  328. {"brbl", LBRB},
  329. {"breve", LBRV},
  330. {"bslash", L'\\'},
  331. {"bsquare", L'■'}, /* black square U+25A0 */
  332. {"btril", L'◀'}, /* U+25C0 */
  333. {"btrir", L'▶'}, /* U+25B6 */
  334. {"c", L'c'}, /* circa */
  335. {"cab", L'〉'},
  336. {"cacu", L'ć'},
  337. {"canc", L'♋'},
  338. {"capr", L'♑'},
  339. {"caret", L'^'},
  340. {"cb", L'}'},
  341. {"cbigb", L'}'},
  342. {"cbigpren", L')'},
  343. {"cbigsb", L']'},
  344. {"cced", L'ç'},
  345. {"cdil", LCED},
  346. {"cdsb", L'〛'}, /* ]] U+301b */
  347. {"cent", L'¢'},
  348. {"chacek", L'č'},
  349. {"chi", L'χ'},
  350. {"circ", LRNG},
  351. {"circa", L'c'}, /* about (year) */
  352. {"circbl", L'̥'}, /* ring below accent U+0325 */
  353. {"circle", L'○'}, /* U+25CB */
  354. {"circledot", L'⊙'},
  355. {"click", L'ʖ'},
  356. {"club", L'♣'},
  357. {"comtime", L'C'},
  358. {"conj", L'☌'},
  359. {"cprt", L'©'},
  360. {"cq", L'\''},
  361. {"cqq", L'”'},
  362. {"cross", L'✠'}, /* maltese cross U+2720 */
  363. {"crotchet", L'♩'},
  364. {"csb", L']'},
  365. {"ctilde", L'c'}, /* +tilde */
  366. {"ctlig", MLCT},
  367. {"cyra", L'а'},
  368. {"cyre", L'е'},
  369. {"cyrhard", L'ъ'},
  370. {"cyrjat", L'ѣ'},
  371. {"cyrm", L'м'},
  372. {"cyrn", L'н'},
  373. {"cyrr", L'р'},
  374. {"cyrsoft", L'ь'},
  375. {"cyrt", L'т'},
  376. {"cyry", L'ы'},
  377. {"dag", L'†'},
  378. {"dbar", L'đ'},
  379. {"dblar", L'⇋'},
  380. {"dblgt", L'≫'},
  381. {"dbllt", L'≪'},
  382. {"dced", L'd'}, /* +cedilla */
  383. {"dd", MDD},
  384. {"ddag", L'‡'},
  385. {"ddd", MDDD},
  386. {"decr", L'↓'},
  387. {"deg", L'°'},
  388. {"dele", L'd'}, /* should be dele */
  389. {"delta", L'δ'},
  390. {"descnode", L'☋'}, /* descending node U+260B */
  391. {"diamond", L'♢'},
  392. {"digamma", L'ϝ'},
  393. {"div", L'÷'},
  394. {"dlessi", L'ı'},
  395. {"dlessj1", L'j'}, /* should be dotless */
  396. {"dlessj2", L'j'}, /* should be dotless */
  397. {"dlessj3", L'j'}, /* should be dotless */
  398. {"dollar", L'$'},
  399. {"dotab", LDOT},
  400. {"dotbl", LDTB},
  401. {"drachm", L'ʒ'},
  402. {"dubh", L'-'},
  403. {"eacu", L'é'},
  404. {"earth", L'♁'},
  405. {"easper", MEAS},
  406. {"ebreve", L'ĕ'},
  407. {"ecirc", L'ê'},
  408. {"edh", L'ð'},
  409. {"egrave", L'è'},
  410. {"ehacek", L'ě'},
  411. {"ehook", L'ę'},
  412. {"elem", L'∊'},
  413. {"elenis", MELN},
  414. {"em", L'—'},
  415. {"emac", L'ē'},
  416. {"emem", MEMM},
  417. {"en", L'–'},
  418. {"epsilon", L'ε'},
  419. {"equil", L'⇋'},
  420. {"ergo", L'∴'},
  421. {"es", MES},
  422. {"eszett", L'ß'},
  423. {"eta", L'η'},
  424. {"eth", L'ð'},
  425. {"euml", L'ë'},
  426. {"expon", L'↑'},
  427. {"fact", L'!'},
  428. {"fata", L'ɑ'},
  429. {"fatpara", L'¶'}, /* should have fatter, filled in bowl */
  430. {"female", L'♀'},
  431. {"ffilig", MLFFI},
  432. {"fflig", MLFF},
  433. {"ffllig", MLFFL},
  434. {"filig", MLFI},
  435. {"flat", L'♭'},
  436. {"fllig", MLFL},
  437. {"frE", L'E'}, /* should be curly */
  438. {"frL", L'L'}, /* should be curly */
  439. {"frR", L'R'}, /* should be curly */
  440. {"frakB", L'B'}, /* should have fraktur style */
  441. {"frakG", L'G'},
  442. {"frakH", L'H'},
  443. {"frakI", L'I'},
  444. {"frakM", L'M'},
  445. {"frakU", L'U'},
  446. {"frakX", L'X'},
  447. {"frakY", L'Y'},
  448. {"frakh", L'h'},
  449. {"frbl", LFRB},
  450. {"frown", LFRN},
  451. {"fs", L' '},
  452. {"fsigma", L'ς'},
  453. {"gAacu", L'Á'}, /* should be Α+acute */
  454. {"gaacu", L'α'}, /* +acute */
  455. {"gabreve", L'α'}, /* +breve */
  456. {"gafrown", L'α'}, /* +frown */
  457. {"gagrave", L'α'}, /* +grave */
  458. {"gamac", L'α'}, /* +macron */
  459. {"gamma", L'γ'},
  460. {"gauml", L'α'}, /* +umlaut */
  461. {"ge", L'≧'},
  462. {"geacu", L'ε'}, /* +acute */
  463. {"gegrave", L'ε'}, /* +grave */
  464. {"ghacu", L'η'}, /* +acute */
  465. {"ghfrown", L'η'}, /* +frown */
  466. {"ghgrave", L'η'}, /* +grave */
  467. {"ghmac", L'η'}, /* +macron */
  468. {"giacu", L'ι'}, /* +acute */
  469. {"gibreve", L'ι'}, /* +breve */
  470. {"gifrown", L'ι'}, /* +frown */
  471. {"gigrave", L'ι'}, /* +grave */
  472. {"gimac", L'ι'}, /* +macron */
  473. {"giuml", L'ι'}, /* +umlaut */
  474. {"glagjat", L'ѧ'},
  475. {"glots", L'ˀ'},
  476. {"goacu", L'ο'}, /* +acute */
  477. {"gobreve", L'ο'}, /* +breve */
  478. {"grave", LGRV},
  479. {"gt", L'>'},
  480. {"guacu", L'υ'}, /* +acute */
  481. {"gufrown", L'υ'}, /* +frown */
  482. {"gugrave", L'υ'}, /* +grave */
  483. {"gumac", L'υ'}, /* +macron */
  484. {"guuml", L'υ'}, /* +umlaut */
  485. {"gwacu", L'ω'}, /* +acute */
  486. {"gwfrown", L'ω'}, /* +frown */
  487. {"gwgrave", L'ω'}, /* +grave */
  488. {"hacek", LHCK},
  489. {"halft", L'⌈'},
  490. {"hash", L'#'},
  491. {"hasper", MHAS},
  492. {"hatpath", L'ֲ'}, /* hataf patah U+05B2 */
  493. {"hatqam", L'ֳ'}, /* hataf qamats U+05B3 */
  494. {"hatseg", L'ֱ'}, /* hataf segol U+05B1 */
  495. {"hbar", L'ħ'},
  496. {"heart", L'♡'},
  497. {"hebaleph", L'א'}, /* aleph U+05D0 */
  498. {"hebayin", L'ע'}, /* ayin U+05E2 */
  499. {"hebbet", L'ב'}, /* bet U+05D1 */
  500. {"hebbeth", L'ב'}, /* bet U+05D1 */
  501. {"hebcheth", L'ח'}, /* bet U+05D7 */
  502. {"hebdaleth", L'ד'}, /* dalet U+05D3 */
  503. {"hebgimel", L'ג'}, /* gimel U+05D2 */
  504. {"hebhe", L'ה'}, /* he U+05D4 */
  505. {"hebkaph", L'כ'}, /* kaf U+05DB */
  506. {"heblamed", L'ל'}, /* lamed U+05DC */
  507. {"hebmem", L'מ'}, /* mem U+05DE */
  508. {"hebnun", L'נ'}, /* nun U+05E0 */
  509. {"hebnunfin", L'ן'}, /* final nun U+05DF */
  510. {"hebpe", L'פ'}, /* pe U+05E4 */
  511. {"hebpedag", L'ף'}, /* final pe? U+05E3 */
  512. {"hebqoph", L'ק'}, /* qof U+05E7 */
  513. {"hebresh", L'ר'}, /* resh U+05E8 */
  514. {"hebshin", L'ש'}, /* shin U+05E9 */
  515. {"hebtav", L'ת'}, /* tav U+05EA */
  516. {"hebtsade", L'צ'}, /* tsadi U+05E6 */
  517. {"hebwaw", L'ו'}, /* vav? U+05D5 */
  518. {"hebyod", L'י'}, /* yod U+05D9 */
  519. {"hebzayin", L'ז'}, /* zayin U+05D6 */
  520. {"hgz", L'ʒ'}, /* ??? Cf "alet" */
  521. {"hireq", L'ִ'}, /* U+05B4 */
  522. {"hlenis", MHLN},
  523. {"hook", LOGO},
  524. {"horizE", L'E'}, /* should be on side */
  525. {"horizP", L'P'}, /* should be on side */
  526. {"horizS", L'∽'},
  527. {"horizT", L'⊣'},
  528. {"horizb", L'{'}, /* should be underbrace */
  529. {"ia", L'α'},
  530. {"iacu", L'í'},
  531. {"iasper", MIAS},
  532. {"ib", L'β'},
  533. {"ibar", L'ɨ'},
  534. {"ibreve", L'ĭ'},
  535. {"icirc", L'î'},
  536. {"id", L'δ'},
  537. {"ident", L'≡'},
  538. {"ie", L'ε'},
  539. {"ifilig", MLFI},
  540. {"ifflig", MLFF},
  541. {"ig", L'γ'},
  542. {"igrave", L'ì'},
  543. {"ih", L'η'},
  544. {"ii", L'ι'},
  545. {"ik", L'κ'},
  546. {"ilenis", MILN},
  547. {"imac", L'ī'},
  548. {"implies", L'⇒'},
  549. {"index", L'☞'},
  550. {"infin", L'∞'},
  551. {"integ", L'∫'},
  552. {"intsec", L'∩'},
  553. {"invpri", L'ˏ'},
  554. {"iota", L'ι'},
  555. {"iq", L'ψ'},
  556. {"istlig", MLST},
  557. {"isub", L'ϵ'}, /* iota below accent */
  558. {"iuml", L'ï'},
  559. {"iz", L'ζ'},
  560. {"jup", L'♃'},
  561. {"kappa", L'κ'},
  562. {"koppa", L'ϟ'},
  563. {"lambda", L'λ'},
  564. {"lar", L'←'},
  565. {"lbar", L'ł'},
  566. {"le", L'≦'},
  567. {"lenis", LLEN},
  568. {"leo", L'♌'},
  569. {"lhalfbr", L'⌈'},
  570. {"lhshoe", L'⊃'},
  571. {"libra", L'♎'},
  572. {"llswing", MLLS},
  573. {"lm", L'ː'},
  574. {"logicand", L'∧'},
  575. {"logicor", L'∨'},
  576. {"longs", L'ʃ'},
  577. {"lrar", L'↔'},
  578. {"lt", L'<'},
  579. {"ltappr", L'≾'},
  580. {"ltflat", L'∠'},
  581. {"lumlbl", L'l'}, /* +umlaut below */
  582. {"mac", LMAC},
  583. {"male", L'♂'},
  584. {"mc", L'c'}, /* should be raised */
  585. {"merc", L'☿'}, /* mercury U+263F */
  586. {"min", L'−'},
  587. {"moonfq", L'☽'}, /* first quarter moon U+263D */
  588. {"moonlq", L'☾'}, /* last quarter moon U+263E */
  589. {"msylab", L'm'}, /* +sylab (ˌ) */
  590. {"mu", L'μ'},
  591. {"nacu", L'ń'},
  592. {"natural", L'♮'},
  593. {"neq", L'≠'},
  594. {"nfacu", L'′'},
  595. {"nfasper", L'ʽ'},
  596. {"nfbreve", L'˘'},
  597. {"nfced", L'¸'},
  598. {"nfcirc", L'ˆ'},
  599. {"nffrown", L'⌢'},
  600. {"nfgra", L'ˋ'},
  601. {"nfhacek", L'ˇ'},
  602. {"nfmac", L'¯'},
  603. {"nftilde", L'˜'},
  604. {"nfuml", L'¨'},
  605. {"ng", L'ŋ'},
  606. {"not", L'¬'},
  607. {"notelem", L'∉'},
  608. {"ntilde", L'ñ'},
  609. {"nu", L'ν'},
  610. {"oab", L'〈'},
  611. {"oacu", L'ó'},
  612. {"oasper", MOAS},
  613. {"ob", L'{'},
  614. {"obar", L'ø'},
  615. {"obigb", L'{'}, /* should be big */
  616. {"obigpren", L'('},
  617. {"obigsb", L'['}, /* should be big */
  618. {"obreve", L'ŏ'},
  619. {"ocirc", L'ô'},
  620. {"odsb", L'〚'}, /* [[ U+301A */
  621. {"oe", L'œ'},
  622. {"oeamp", L'&'},
  623. {"ograve", L'ò'},
  624. {"ohook", L'o'}, /* +hook */
  625. {"olenis", MOLN},
  626. {"omac", L'ō'},
  627. {"omega", L'ω'},
  628. {"omicron", L'ο'},
  629. {"ope", L'ɛ'},
  630. {"opp", L'☍'},
  631. {"oq", L'`'},
  632. {"oqq", L'“'},
  633. {"or", MOR},
  634. {"osb", L'['},
  635. {"otilde", L'õ'},
  636. {"ouml", L'ö'},
  637. {"ounce", L'℥'}, /* ounce U+2125 */
  638. {"ovparen", L'⌢'}, /* should be sideways ( */
  639. {"p", L'′'},
  640. {"pa", L'∂'},
  641. {"page", L'P'},
  642. {"pall", L'ʎ'},
  643. {"paln", L'ɲ'},
  644. {"par", PAR},
  645. {"para", L'¶'},
  646. {"pbar", L'p'}, /* +bar */
  647. {"per", L'℘'}, /* per U+2118 */
  648. {"phi", L'φ'},
  649. {"phi2", L'ϕ'},
  650. {"pi", L'π'},
  651. {"pisces", L'♓'},
  652. {"planck", L'ħ'},
  653. {"plantinJ", L'J'}, /* should be script */
  654. {"pm", L'±'},
  655. {"pmil", L'‰'},
  656. {"pp", L'″'},
  657. {"ppp", L'‴'},
  658. {"prop", L'∝'},
  659. {"psi", L'ψ'},
  660. {"pstlg", L'£'},
  661. {"q", L'?'}, /* should be raised */
  662. {"qamets", L'ֳ'}, /* U+05B3 */
  663. {"quaver", L'♪'},
  664. {"rar", L'→'},
  665. {"rasper", MRAS},
  666. {"rdot", L'·'},
  667. {"recipe", L'℞'}, /* U+211E */
  668. {"reg", L'®'},
  669. {"revC", L'Ɔ'}, /* open O U+0186 */
  670. {"reva", L'ɒ'},
  671. {"revc", L'ɔ'},
  672. {"revope", L'ɜ'},
  673. {"revr", L'ɹ'},
  674. {"revsc", L'˒'}, /* upside-down semicolon */
  675. {"revv", L'ʌ'},
  676. {"rfa", L'o'}, /* +hook (Cf "goal") */
  677. {"rhacek", L'ř'},
  678. {"rhalfbr", L'⌉'},
  679. {"rho", L'ρ'},
  680. {"rhshoe", L'⊂'},
  681. {"rlenis", MRLN},
  682. {"rsylab", L'r'}, /* +sylab */
  683. {"runash", L'F'}, /* should be runic 'ash' */
  684. {"rvow", L'˔'},
  685. {"sacu", L'ś'},
  686. {"sagit", L'♐'},
  687. {"sampi", L'ϡ'},
  688. {"saturn", L'♄'},
  689. {"sced", L'ş'},
  690. {"schwa", L'ə'},
  691. {"scorpio", L'♏'},
  692. {"scrA", L'A'}, /* should be script */
  693. {"scrC", L'C'},
  694. {"scrE", L'E'},
  695. {"scrF", L'F'},
  696. {"scrI", L'I'},
  697. {"scrJ", L'J'},
  698. {"scrL", L'L'},
  699. {"scrO", L'O'},
  700. {"scrP", L'P'},
  701. {"scrQ", L'Q'},
  702. {"scrS", L'S'},
  703. {"scrT", L'T'},
  704. {"scrb", L'b'},
  705. {"scrd", L'd'},
  706. {"scrh", L'h'},
  707. {"scrl", L'l'},
  708. {"scruple", L'℈'}, /* U+2108 */
  709. {"sdd", L'ː'},
  710. {"sect", L'§'},
  711. {"semE", L'∃'},
  712. {"sh", L'ʃ'},
  713. {"shacek", L'š'},
  714. {"sharp", L'♯'},
  715. {"sheva", L'ְ'}, /* U+05B0 */
  716. {"shti", L'ɪ'},
  717. {"shtsyll", L'∪'},
  718. {"shtu", L'ʊ'},
  719. {"sidetri", L'⊲'},
  720. {"sigma", L'σ'},
  721. {"since", L'∵'},
  722. {"slge", L'≥'}, /* should have slanted line under */
  723. {"slle", L'≤'}, /* should have slanted line under */
  724. {"sm", L'ˈ'},
  725. {"smm", L'ˌ'},
  726. {"spade", L'♠'},
  727. {"sqrt", L'√'},
  728. {"square", L'□'}, /* U+25A1 */
  729. {"ssChi", L'Χ'}, /* should be sans serif */
  730. {"ssIota", L'Ι'},
  731. {"ssOmicron", L'Ο'},
  732. {"ssPi", L'Π'},
  733. {"ssRho", L'Ρ'},
  734. {"ssSigma", L'Σ'},
  735. {"ssTau", L'Τ'},
  736. {"star", L'*'},
  737. {"stlig", MLST},
  738. {"sup2", L'⁲'},
  739. {"supgt", L'˃'},
  740. {"suplt", L'˂'},
  741. {"sur", L'ʳ'},
  742. {"swing", L'∼'},
  743. {"tau", L'τ'},
  744. {"taur", L'♉'},
  745. {"th", L'þ'},
  746. {"thbar", L'þ'}, /* +bar */
  747. {"theta", L'θ'},
  748. {"thinqm", L'?'}, /* should be thinner */
  749. {"tilde", LTIL},
  750. {"times", L'×'},
  751. {"tri", L'∆'},
  752. {"trli", L'‖'},
  753. {"ts", L' '},
  754. {"uacu", L'ú'},
  755. {"uasper", MUAS},
  756. {"ubar", L'u'}, /* +bar */
  757. {"ubreve", L'ŭ'},
  758. {"ucirc", L'û'},
  759. {"udA", L'∀'},
  760. {"udT", L'⊥'},
  761. {"uda", L'ɐ'},
  762. {"udh", L'ɥ'},
  763. {"udqm", L'¿'},
  764. {"udpsi", L'⋔'},
  765. {"udtr", L'∇'},
  766. {"ugrave", L'ù'},
  767. {"ulenis", MULN},
  768. {"umac", L'ū'},
  769. {"uml", LUML},
  770. {"undl", L'ˍ'}, /* underline accent */
  771. {"union", L'∪'},
  772. {"upsilon", L'υ'},
  773. {"uuml", L'ü'},
  774. {"vavpath", L'ו'}, /* vav U+05D5 (+patah) */
  775. {"vavsheva", L'ו'}, /* vav U+05D5 (+sheva) */
  776. {"vb", L'|'},
  777. {"vddd", L'⋮'},
  778. {"versicle2", L'℣'}, /* U+2123 */
  779. {"vinc", L'¯'},
  780. {"virgo", L'♍'},
  781. {"vpal", L'ɟ'},
  782. {"vvf", L'ɣ'},
  783. {"wasper", MWAS},
  784. {"wavyeq", L'≈'},
  785. {"wlenis", MWLN},
  786. {"wyn", L'ƿ'}, /* wynn U+01BF */
  787. {"xi", L'ξ'},
  788. {"yacu", L'ý'},
  789. {"ycirc", L'ŷ'},
  790. {"ygh", L'ʒ'},
  791. {"ymac", L'y'}, /* +macron */
  792. {"yuml", L'ÿ'},
  793. {"zced", L'z'}, /* +cedilla */
  794. {"zeta", L'ζ'},
  795. {"zh", L'ʒ'},
  796. {"zhacek", L'ž'},
  797. };
  798. /*
  799. The following special characters don't have close enough
  800. equivalents in Unicode, so aren't in the above table.
  801. 22n 2^(2^n) Cf Fermat
  802. 2on4 2/4
  803. 3on8 3/8
  804. Bantuo Bantu O. Cf Otshi-herero
  805. Car C with circular arrow on top
  806. albrtime cut-time: C with vertical line
  807. ardal Cf dental
  808. bantuo Bantu o. Cf Otshi-herero
  809. bbc1 single chem bond below
  810. bbc2 double chem bond below
  811. bbl1 chem bond like /
  812. bbl2 chem bond like //
  813. bbr1 chem bond like \
  814. bbr2 chem bond \\
  815. bcop1 copper symbol. Cf copper
  816. bcop2 copper symbol. Cf copper
  817. benchm Cf benchmark
  818. btc1 single chem bond above
  819. btc2 double chem bond above
  820. btl1 chem bond like \
  821. btl2 chem bond like \\
  822. btr1 chem bond like /
  823. btr2 chem bond line //
  824. burman Cf Burman
  825. devph sanskrit letter. Cf ph
  826. devrfls sanskrit letter. Cf cerebral
  827. duplong[12] musical note
  828. egchi early form of chi
  829. eggamma[12] early form of gamma
  830. egiota early form of iota
  831. egkappa early form of kappa
  832. eglambda early form of lambda
  833. egmu[12] early form of mu
  834. egnu[12] early form of nu
  835. egpi[123] early form of pi
  836. egrho[12] early form of rho
  837. egsampi early form of sampi
  838. egsan early form of san
  839. egsigma[12] early form of sigma
  840. egxi[123] early form of xi
  841. elatS early form of S
  842. elatc[12] early form of C
  843. elatg[12] early form of G
  844. glagjeri Slavonic Glagolitic jeri
  845. glagjeru Slavonic Glagolitic jeru
  846. hypolem hypolemisk (line with underdot)
  847. lhrbr lower half }
  848. longmord long mordent
  849. mbwvow backwards scretched C. Cf retract.
  850. mord music symbol. Cf mordent
  851. mostra Cf direct
  852. ohgcirc old form of circumflex
  853. oldbeta old form of β. Cf perturbate
  854. oldsemibr[12] old forms of semibreve. Cf prolation
  855. ormg old form of g. Cf G
  856. para[12345] form of ¶
  857. pauseo musical pause sign
  858. pauseu musical pause sign
  859. pharyng Cf pharyngal
  860. ragr Black letter ragged r
  861. repetn musical repeat. Cf retort
  862. segno musical segno sign
  863. semain[12] semitic ain
  864. semhe semitic he
  865. semheth semitic heth
  866. semkaph semitic kaph
  867. semlamed[12] semitic lamed
  868. semmem semitic mem
  869. semnum semitic nun
  870. sempe semitic pe
  871. semqoph[123] semitic qoph
  872. semresh semitic resh
  873. semtav[1234] semitic tav
  874. semyod semitic yod
  875. semzayin[123] semitic zayin
  876. shtlong[12] U with underbar. Cf glyconic
  877. sigmatau σ,τ combination
  878. squaver sixteenth note
  879. sqbreve square musical breve note
  880. swast swastika
  881. uhrbr upper half of big }
  882. versicle1 Cf versicle
  883. */
  884. static Rune normtab[128] = {
  885. /*0*/ /*1*/ /*2*/ /*3*/ /*4*/ /*5*/ /*6*/ /*7*/
  886. /*00*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
  887. NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
  888. /*10*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
  889. NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
  890. /*20*/ L' ', L'!', L'"', L'#', L'$', L'%', SPCS, L'\'',
  891. L'(', L')', L'*', L'+', L',', L'-', L'.', L'/',
  892. /*30*/ L'0', L'1', L'2', L'3', L'4', L'5', L'6', L'7',
  893. L'8', L'9', L':', L';', TAGS, L'=', TAGE, L'?',
  894. /*40*/ L'@', L'A', L'B', L'C', L'D', L'E', L'F', L'G',
  895. L'H', L'I', L'J', L'K', L'L', L'M', L'N', L'O',
  896. /*50*/ L'P', L'Q', L'R', L'S', L'T', L'U', L'V', L'W',
  897. L'X', L'Y', L'Z', L'[', L'\\', L']', L'^', L'_',
  898. /*60*/ L'`', L'a', L'b', L'c', L'd', L'e', L'f', L'g',
  899. L'h', L'i', L'j', L'k', L'l', L'm', L'n', L'o',
  900. /*70*/ L'p', L'q', L'r', L's', L't', L'u', L'v', L'w',
  901. L'x', L'y', L'z', L'{', L'|', L'}', L'~', NONE,
  902. };
  903. static Rune phtab[128] = {
  904. /*0*/ /*1*/ /*2*/ /*3*/ /*4*/ /*5*/ /*6*/ /*7*/
  905. /*00*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
  906. NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
  907. /*10*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
  908. NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
  909. /*20*/ L' ', L'!', L'ˈ', L'#', L'$', L'ˌ', L'æ', L'\'',
  910. L'(', L')', L'*', L'+', L',', L'-', L'.', L'/',
  911. /*30*/ L'0', L'1', L'2', L'ɜ', L'4', L'5', L'6', L'7',
  912. L'8', L'ø', L'ː', L';', TAGS, L'=', TAGE, L'?',
  913. /*40*/ L'ə', L'ɑ', L'B', L'C', L'ð', L'ɛ', L'F', L'G',
  914. L'H', L'ɪ', L'J', L'K', L'L', L'M', L'ŋ', L'ɔ',
  915. /*50*/ L'P', L'ɒ', L'R', L'ʃ', L'θ', L'ʊ', L'ʌ', L'W',
  916. L'X', L'Y', L'ʒ', L'[', L'\\', L']', L'^', L'_',
  917. /*60*/ L'`', L'a', L'b', L'c', L'd', L'e', L'f', L'g',
  918. L'h', L'i', L'j', L'k', L'l', L'm', L'n', L'o',
  919. /*70*/ L'p', L'q', L'r', L's', L't', L'u', L'v', L'w',
  920. L'x', L'y', L'z', L'{', L'|', L'}', L'~', NONE,
  921. };
  922. static Rune grtab[128] = {
  923. /*0*/ /*1*/ /*2*/ /*3*/ /*4*/ /*5*/ /*6*/ /*7*/
  924. /*00*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
  925. NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
  926. /*10*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
  927. NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
  928. /*20*/ L' ', L'!', L'"', L'#', L'$', L'%', SPCS, L'\'',
  929. L'(', L')', L'*', L'+', L',', L'-', L'.', L'/',
  930. /*30*/ L'0', L'1', L'2', L'3', L'4', L'5', L'6', L'7',
  931. L'8', L'9', L':', L';', TAGS, L'=', TAGE, L'?',
  932. /*40*/ L'@', L'Α', L'Β', L'Ξ', L'Δ', L'Ε', L'Φ', L'Γ',
  933. L'Η', L'Ι', L'Ϛ', L'Κ', L'Λ', L'Μ', L'Ν', L'Ο',
  934. /*50*/ L'Π', L'Θ', L'Ρ', L'Σ', L'Τ', L'Υ', L'V', L'Ω',
  935. L'Χ', L'Ψ', L'Ζ', L'[', L'\\', L']', L'^', L'_',
  936. /*60*/ L'`', L'α', L'β', L'ξ', L'δ', L'ε', L'φ', L'γ',
  937. L'η', L'ι', L'ς', L'κ', L'λ', L'μ', L'ν', L'ο',
  938. /*70*/ L'π', L'θ', L'ρ', L'σ', L'τ', L'υ', L'v', L'ω',
  939. L'χ', L'ψ', L'ζ', L'{', L'|', L'}', L'~', NONE,
  940. };
  941. static Rune subtab[128] = {
  942. /*0*/ /*1*/ /*2*/ /*3*/ /*4*/ /*5*/ /*6*/ /*7*/
  943. /*00*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
  944. NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
  945. /*10*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
  946. NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
  947. /*20*/ L' ', L'!', L'"', L'#', L'$', L'%', SPCS, L'\'',
  948. L'₍', L'₎', L'*', L'₊', L',', L'₋', L'.', L'/',
  949. /*30*/ L'₀', L'₁', L'₂', L'₃', L'₄', L'₅', L'₆', L'₇',
  950. L'₈', L'₉', L':', L';', TAGS, L'₌', TAGE, L'?',
  951. /*40*/ L'@', L'A', L'B', L'C', L'D', L'E', L'F', L'G',
  952. L'H', L'I', L'J', L'K', L'L', L'M', L'N', L'O',
  953. /*50*/ L'P', L'Q', L'R', L'S', L'T', L'U', L'V', L'W',
  954. L'X', L'Y', L'Z', L'[', L'\\', L']', L'^', L'_',
  955. /*60*/ L'`', L'a', L'b', L'c', L'd', L'e', L'f', L'g',
  956. L'h', L'i', L'j', L'k', L'l', L'm', L'n', L'o',
  957. /*70*/ L'p', L'q', L'r', L's', L't', L'u', L'v', L'w',
  958. L'x', L'y', L'z', L'{', L'|', L'}', L'~', NONE,
  959. };
  960. static Rune suptab[128] = {
  961. /*0*/ /*1*/ /*2*/ /*3*/ /*4*/ /*5*/ /*6*/ /*7*/
  962. /*00*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
  963. NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
  964. /*10*/ NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
  965. NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE,
  966. /*20*/ L' ', L'!', L'"', L'#', L'$', L'%', SPCS, L'\'',
  967. L'⁽', L'⁾', L'*', L'⁺', L',', L'⁻', L'.', L'/',
  968. /*30*/ L'⁰', L'ⁱ', L'⁲', L'⁳', L'⁴', L'⁵', L'⁶', L'⁷',
  969. L'⁸', L'⁹', L':', L';', TAGS, L'⁼', TAGE, L'?',
  970. /*40*/ L'@', L'A', L'B', L'C', L'D', L'E', L'F', L'G',
  971. L'H', L'I', L'J', L'K', L'L', L'M', L'N', L'O',
  972. /*50*/ L'P', L'Q', L'R', L'S', L'T', L'U', L'V', L'W',
  973. L'X', L'Y', L'Z', L'[', L'\\', L']', L'^', L'_',
  974. /*60*/ L'`', L'a', L'b', L'c', L'd', L'e', L'f', L'g',
  975. L'h', L'i', L'j', L'k', L'l', L'm', L'n', L'o',
  976. /*70*/ L'p', L'q', L'r', L's', L't', L'u', L'v', L'w',
  977. L'x', L'y', L'z', L'{', L'|', L'}', L'~', NONE,
  978. };
  979. static int tagstarts;
  980. static char tag[Buflen];
  981. static int naux;
  982. static char auxname[Maxaux][Buflen];
  983. static char auxval[Maxaux][Buflen];
  984. static char spec[Buflen];
  985. static char *auxstate[Naux]; /* vals for most recent tag */
  986. static Entry curentry;
  987. #define cursize (curentry.end-curentry.start)
  988. static char *getspec(char *, char *);
  989. static char *gettag(char *, char *);
  990. static void dostatus(void);
  991. /*
  992. * cmd is one of:
  993. * 'p': normal print
  994. * 'h': just print headwords
  995. * 'P': print raw
  996. */
  997. void
  998. oedprintentry(Entry e, int cmd)
  999. {
  1000. char *p, *pe;
  1001. int t, a, i;
  1002. long r, rprev, rlig;
  1003. Rune *transtab;
  1004. p = e.start;
  1005. pe = e.end;
  1006. transtab = normtab;
  1007. rprev = NONE;
  1008. changett(0, 0, 0);
  1009. curentry = e;
  1010. if(cmd == 'h')
  1011. outinhibit = 1;
  1012. while(p < pe) {
  1013. if(cmd == 'r') {
  1014. outchar(*p++);
  1015. continue;
  1016. }
  1017. r = transtab[(*p++)&0x7F];
  1018. if(r < NONE) {
  1019. /* Emit the rune, but buffer in case of ligature */
  1020. if(rprev != NONE)
  1021. outrune(rprev);
  1022. rprev = r;
  1023. } else if(r == SPCS) {
  1024. /* Start of special character name */
  1025. p = getspec(p, pe);
  1026. r = lookassoc(spectab, asize(spectab), spec);
  1027. if(r == -1) {
  1028. if(debug)
  1029. err("spec %ld %d %s",
  1030. e.doff, cursize, spec);
  1031. r = L'�';
  1032. }
  1033. if(r >= LIGS && r < LIGE) {
  1034. /* handle possible ligature */
  1035. rlig = liglookup(r, rprev);
  1036. if(rlig != NONE)
  1037. rprev = rlig; /* overwrite rprev */
  1038. else {
  1039. /* could print accent, but let's not */
  1040. if(rprev != NONE) outrune(rprev);
  1041. rprev = NONE;
  1042. }
  1043. } else if(r >= MULTI && r < MULTIE) {
  1044. if(rprev != NONE) {
  1045. outrune(rprev);
  1046. rprev = NONE;
  1047. }
  1048. outrunes(multitab[r-MULTI]);
  1049. } else if(r == PAR) {
  1050. if(rprev != NONE) {
  1051. outrune(rprev);
  1052. rprev = NONE;
  1053. }
  1054. outnl(1);
  1055. } else {
  1056. if(rprev != NONE) outrune(rprev);
  1057. rprev = r;
  1058. }
  1059. } else if(r == TAGS) {
  1060. /* Start of tag name */
  1061. if(rprev != NONE) {
  1062. outrune(rprev);
  1063. rprev = NONE;
  1064. }
  1065. p = gettag(p, pe);
  1066. t = lookassoc(tagtab, asize(tagtab), tag);
  1067. if(t == -1) {
  1068. if(debug)
  1069. err("tag %ld %d %s",
  1070. e.doff, cursize, tag);
  1071. continue;
  1072. }
  1073. for(i = 0; i < Naux; i++)
  1074. auxstate[i] = 0;
  1075. for(i = 0; i < naux; i++) {
  1076. a = lookassoc(auxtab, asize(auxtab), auxname[i]);
  1077. if(a == -1) {
  1078. if(debug)
  1079. err("aux %ld %d %s",
  1080. e.doff, cursize, auxname[i]);
  1081. } else
  1082. auxstate[a] = auxval[i];
  1083. }
  1084. switch(t){
  1085. case E:
  1086. case Ve:
  1087. outnl(0);
  1088. if(tagstarts)
  1089. dostatus();
  1090. break;
  1091. case Ed:
  1092. case Etym:
  1093. outchar(tagstarts? '[' : ']');
  1094. break;
  1095. case Pr:
  1096. outchar(tagstarts? '(' : ')');
  1097. break;
  1098. case In:
  1099. transtab = changett(transtab, subtab, tagstarts);
  1100. break;
  1101. case Hm:
  1102. case Su:
  1103. case Fq:
  1104. transtab = changett(transtab, suptab, tagstarts);
  1105. break;
  1106. case Gk:
  1107. transtab = changett(transtab, grtab, tagstarts);
  1108. break;
  1109. case Ph:
  1110. transtab = changett(transtab, phtab, tagstarts);
  1111. break;
  1112. case Hw:
  1113. if(cmd == 'h') {
  1114. if(!tagstarts)
  1115. outchar(' ');
  1116. outinhibit = !tagstarts;
  1117. }
  1118. break;
  1119. case S0:
  1120. case S1:
  1121. case S2:
  1122. case S3:
  1123. case S4:
  1124. case S5:
  1125. case S6:
  1126. case S7a:
  1127. case S7n:
  1128. case Sn:
  1129. case Sgk:
  1130. if(tagstarts) {
  1131. outnl(2);
  1132. dostatus();
  1133. if(auxstate[Num]) {
  1134. if(t == S3 || t == S5) {
  1135. i = atoi(auxstate[Num]);
  1136. while(i--)
  1137. outchar('*');
  1138. outchars(" ");
  1139. } else if(t == S7a || t == S7n || t == Sn) {
  1140. outchar('(');
  1141. outchars(auxstate[Num]);
  1142. outchars(") ");
  1143. } else if(t == Sgk) {
  1144. i = grtab[auxstate[Num][0]];
  1145. if(i != NONE)
  1146. outrune(i);
  1147. outchars(". ");
  1148. } else {
  1149. outchars(auxstate[Num]);
  1150. outchars(". ");
  1151. }
  1152. }
  1153. }
  1154. break;
  1155. case Cb:
  1156. case Db:
  1157. case Qp:
  1158. case P:
  1159. if(tagstarts)
  1160. outnl(1);
  1161. break;
  1162. case Table:
  1163. /*
  1164. * Todo: gather columns, justify them, etc.
  1165. * For now, just let colums come out as rows
  1166. */
  1167. if(!tagstarts)
  1168. outnl(0);
  1169. break;
  1170. case Col:
  1171. if(tagstarts)
  1172. outnl(0);
  1173. break;
  1174. case Dn:
  1175. if(tagstarts)
  1176. outchar('/');
  1177. break;
  1178. }
  1179. }
  1180. }
  1181. if(cmd == 'h') {
  1182. outinhibit = 0;
  1183. outnl(0);
  1184. }
  1185. }
  1186. /*
  1187. * Return offset into bdict where next oed entry after fromoff starts.
  1188. * Oed entries start with <e>, <ve>, <e st=...>, or <ve st=...>
  1189. */
  1190. long
  1191. oednextoff(long fromoff)
  1192. {
  1193. long a, n;
  1194. int c;
  1195. a = Bseek(bdict, fromoff, 0);
  1196. if(a < 0)
  1197. return -1;
  1198. n = 0;
  1199. for(;;) {
  1200. c = Bgetc(bdict);
  1201. if(c < 0)
  1202. break;
  1203. if(c == '<') {
  1204. c = Bgetc(bdict);
  1205. if(c == 'e') {
  1206. c = Bgetc(bdict);
  1207. if(c == '>' || c == ' ')
  1208. n = 3;
  1209. } else if(c == 'v' && Bgetc(bdict) == 'e') {
  1210. c = Bgetc(bdict);
  1211. if(c == '>' || c == ' ')
  1212. n = 4;
  1213. }
  1214. if(n)
  1215. break;
  1216. }
  1217. }
  1218. return (Boffset(bdict)-n);
  1219. }
  1220. static char *prkey =
  1221. "KEY TO THE PRONUNCIATION\n"
  1222. "\n"
  1223. "I. CONSONANTS\n"
  1224. "b, d, f, k, l, m, n, p, t, v, z: usual English values\n"
  1225. "\n"
  1226. "g as in go (gəʊ)\n"
  1227. "h ... ho! (həʊ)\n"
  1228. "r ... run (rʌn), terrier (ˈtɛriə(r))\n"
  1229. "(r)... her (hɜː(r))\n"
  1230. "s ... see (siː), success (səkˈsɜs)\n"
  1231. "w ... wear (wɛə(r))\n"
  1232. "hw ... when (hwɛn)\n"
  1233. "j ... yes (jɛs)\n"
  1234. "θ ... thin (θin), bath (bɑːθ)\n"
  1235. "ð ... then (ðɛn), bathe (beɪð)\n"
  1236. "ʃ ... shop (ʃɒp), dish (dɪʃ)\n"
  1237. "tʃ ... chop (tʃɒp), ditch (dɪtʃ)\n"
  1238. "ʒ ... vision (ˈvɪʒən), déjeuner (deʒøne)\n"
  1239. "dʒ ... judge (dʒʌdʒ)\n"
  1240. "ŋ ... singing (ˈsɪŋɪŋ), think (θiŋk)\n"
  1241. "ŋg ... finger (ˈfiŋgə(r))\n"
  1242. "\n"
  1243. "Foreign\n"
  1244. "ʎ as in It. seraglio (serˈraʎo)\n"
  1245. "ɲ ... Fr. cognac (kɔɲak)\n"
  1246. "x ... Ger. ach (ax), Sc. loch (lɒx)\n"
  1247. "ç ... Ger. ich (ɪç), Sc. nicht (nɪçt)\n"
  1248. "ɣ ... North Ger. sagen (ˈzaːɣən)\n"
  1249. "c ... Afrikaans baardmannetjie (ˈbaːrtmanəci)\n"
  1250. "ɥ ... Fr. cuisine (kɥizin)\n"
  1251. "\n"
  1252. "II. VOWELS AND DIPTHONGS\n"
  1253. "\n"
  1254. "Short\n"
  1255. "ɪ as in pit (pɪt), -ness (-nɪs)\n"
  1256. "ɛ ... pet (pɛt), Fr. sept (sɛt)\n"
  1257. "æ ... pat (pæt)\n"
  1258. "ʌ ... putt (pʌt)\n"
  1259. "ɒ ... pot (pɒt)\n"
  1260. "ʊ ... put (pʊt)\n"
  1261. "ə ... another (əˈnʌðə(r))\n"
  1262. "(ə)... beaten (ˈbiːt(ə)n)\n"
  1263. "i ... Fr. si (si)\n"
  1264. "e ... Fr. bébé (bebe)\n"
  1265. "a ... Fr. mari (mari)\n"
  1266. "ɑ ... Fr. bâtiment (bɑtimã)\n"
  1267. "ɔ ... Fr. homme (ɔm)\n"
  1268. "o ... Fr. eau (o)\n"
  1269. "ø ... Fr. peu (pø)\n"
  1270. "œ ... Fr. boeuf (bœf), coeur (kœr)\n"
  1271. "u ... Fr. douce (dus)\n"
  1272. "ʏ ... Ger. Müller (ˈmʏlər)\n"
  1273. "y ... Fr. du (dy)\n"
  1274. "\n"
  1275. "Long\n"
  1276. "iː as in bean (biːn)\n"
  1277. "ɑː ... barn (bɑːn)\n"
  1278. "ɔː ... born (bɔːn)\n"
  1279. "uː ... boon (buːn)\n"
  1280. "ɜː ... burn (bɜːn)\n"
  1281. "eː ... Ger. Schnee (ʃneː)\n"
  1282. "ɛː ... Ger. Fähre (ˈfɛːrə)\n"
  1283. "aː ... Ger. Tag (taːk)\n"
  1284. "oː ... Ger. Sohn (zoːn)\n"
  1285. "øː ... Ger. Goethe (gøːtə)\n"
  1286. "yː ... Ger. grün (gryːn)\n"
  1287. "\n"
  1288. "Nasal\n"
  1289. "ɛ˜, æ˜ as in Fr. fin (fɛ˜, fæ˜)\n"
  1290. "ã ... Fr. franc (frã)\n"
  1291. "ɔ˜ ... Fr. bon (bɔ˜n)\n"
  1292. "œ˜ ... Fr. un (œ˜)\n"
  1293. "\n"
  1294. "Dipthongs, etc.\n"
  1295. "eɪ as in bay (beɪ)\n"
  1296. "aɪ ... buy (baɪ)\n"
  1297. "ɔɪ ... boy (bɔɪ)\n"
  1298. "əʊ ... no (nəʊ)\n"
  1299. "aʊ ... now (naʊ)\n"
  1300. "ɪə ... peer (pɪə(r))\n"
  1301. "ɛə ... pair (pɛə(r))\n"
  1302. "ʊə ... tour (tʊə(r))\n"
  1303. "ɔə ... boar (bɔə(r))\n"
  1304. "\n"
  1305. "III. STRESS\n"
  1306. "\n"
  1307. "Main stress: ˈ preceding stressed syllable\n"
  1308. "Secondary stress: ˌ preceding stressed syllable\n"
  1309. "\n"
  1310. "E.g.: pronunciation (prəˌnʌnsɪˈeɪʃ(ə)n)\n";
  1311. /* TODO: find transcriptions of foreign consonents, œ, ʏ, nasals */
  1312. void
  1313. oedprintkey(void)
  1314. {
  1315. Bprint(bout, "%s", prkey);
  1316. }
  1317. /*
  1318. * f points just after a '&', fe points at end of entry.
  1319. * Accumulate the special name, starting after the &
  1320. * and continuing until the next '.', in spec[].
  1321. * Return pointer to char after '.'.
  1322. */
  1323. static char *
  1324. getspec(char *f, char *fe)
  1325. {
  1326. char *t;
  1327. int c, i;
  1328. t = spec;
  1329. i = sizeof spec;
  1330. while(--i > 0) {
  1331. c = *f++;
  1332. if(c == '.' || f == fe)
  1333. break;
  1334. *t++ = c;
  1335. }
  1336. *t = 0;
  1337. return f;
  1338. }
  1339. /*
  1340. * f points just after '<'; fe points at end of entry.
  1341. * Expect next characters from bin to match:
  1342. * [/][^ >]+( [^>=]+=[^ >]+)*>
  1343. * tag auxname auxval
  1344. * Accumulate the tag and its auxilliary information in
  1345. * tag[], auxname[][] and auxval[][].
  1346. * Set tagstarts=1 if the tag is 'starting' (has no '/'), else 0.
  1347. * Set naux to the number of aux pairs found.
  1348. * Return pointer to after final '>'.
  1349. */
  1350. static char *
  1351. gettag(char *f, char *fe)
  1352. {
  1353. char *t;
  1354. int c, i;
  1355. t = tag;
  1356. c = *f++;
  1357. if(c == '/')
  1358. tagstarts = 0;
  1359. else {
  1360. tagstarts = 1;
  1361. *t++ = c;
  1362. }
  1363. i = Buflen;
  1364. naux = 0;
  1365. while(--i > 0) {
  1366. c = *f++;
  1367. if(c == '>' || f == fe)
  1368. break;
  1369. if(c == ' ') {
  1370. *t = 0;
  1371. t = auxname[naux];
  1372. i = Buflen;
  1373. if(naux < Maxaux-1)
  1374. naux++;
  1375. } else if(naux && c == '=') {
  1376. *t = 0;
  1377. t = auxval[naux-1];
  1378. i = Buflen;
  1379. } else
  1380. *t++ = c;
  1381. }
  1382. *t = 0;
  1383. return f;
  1384. }
  1385. static void
  1386. dostatus(void)
  1387. {
  1388. char *s;
  1389. s = auxstate[St];
  1390. if(s) {
  1391. if(strcmp(s, "obs") == 0)
  1392. outrune(L'†');
  1393. else if(strcmp(s, "ali") == 0)
  1394. outrune(L'‖');
  1395. else if(strcmp(s, "err") == 0 || strcmp(s, "spu") == 0)
  1396. outrune(L'¶');
  1397. else if(strcmp(s, "xref") == 0)
  1398. {/* nothing */}
  1399. else if(debug)
  1400. err("status %ld %d %s", curentry.doff, cursize, s);
  1401. }
  1402. }