pgw.c 29 KB

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