ienc.tex 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. % Some of the macros here (\iCh, \@iCh, \@denc@loop) originated in
  2. % LaTeX's inputenc.dtx (\DeclareInputText, \DeclareInputMath,
  3. % \@inpenc@loop). It's not clear whether copyright applies on these
  4. % small fragments, especially since they have been modified, but just
  5. % in case, we have permission from the LaTeX Project to distribute
  6. % them under the GPL.
  7. %
  8. % The idea is quite simple -- make all non-ASCII characters active and
  9. % give them encoding-independent definitions. The font encoding code
  10. % will map these definitions to relevant font slots based on the
  11. % current font encoding.
  12. %
  13. %
  14. % \iCh SLOT{TEXT}
  15. %
  16. % Define expansion of active character SLOT (*three* arguments as
  17. % decimal digits) to be TEXT commands. Since in text space matters,
  18. % we have to guard against TEXT which end in a macro, by checking
  19. % whether TEXT's \meaning ends in a space. If it does, then we add
  20. % braces around the definition, in order to avoid any space after the
  21. % active char being gobbled up once the text is written out to an
  22. % auxiliary file. FIXME Is this needed?
  23. \def\iCh#1#2#3#4{%
  24. \def\tempa##1 ${}%$ font-lock fix.
  25. \def\tempb{#4}%
  26. \ifcat_\expandafter\tempa\meaning\tempb$ $_%
  27. \@iCh{#1#2#3}{#4}%
  28. \else
  29. \@iCh{#1#2#3}{{#4}}%
  30. \fi
  31. }%
  32. %
  33. % \@iCh{SLOT}{TEXT}
  34. %
  35. % Define expansion of active character SLOT to be TEXT commands.
  36. % To get the active character, we use the fact that \uppercase
  37. % preserves catcodes of characters: we (temporarily) declare the
  38. % SLOT char to be the uppercase of ~ (which is active while we're in
  39. % texinfo.tex) and then "uppercase" it.
  40. \def\@iCh#1{%
  41. \bgroup
  42. \uccode`\~#1%
  43. \uppercase{%
  44. \egroup
  45. \def~%
  46. }%
  47. }%
  48. %
  49. % \documentencoding ENC
  50. %
  51. % Set input encoding to ENC. It first sets all the characters
  52. % 128-255 to be active (and sets their initial definition to be
  53. % \@denc@undefined). It then calls the macro which defines the
  54. % input encoding. Name of the current encoding is stored in
  55. % \documenttencodingname.
  56. \def\documentencoding#1 {%
  57. % Make sure that the encoding is defined.
  58. \expandafter\ifx\csname denc/#1\endcsname \relax
  59. \message{^^JWarning: document encoding `#1' is not defined,^^J
  60. leaving document encoding unchanged.}%
  61. \else
  62. % Keyboard characters which don't get a definition will be mapped to
  63. % \@denc@undefined.
  64. \edef\@denc@undefined{\noexpand\@denc@undefined@{#1}}%
  65. % Save encoding name.
  66. \edef\documentencodingname{#1}%
  67. % Make all potential input characters active.
  68. \@denc@loop\^^80\^^ff%
  69. % Call the command which will redefine the active characters
  70. % according to the document encoding.
  71. \csname denc/#1\endcsname
  72. % Set up the current font encoding list, which defines priority of
  73. % font encodings when searching for a glyph.
  74. \expandafter\let\expandafter\cur@fenc@list
  75. \csname denc@fenc@list/#1\endcsname
  76. % Update encoding list index, for proper glyph caching.
  77. \update@enclist@index
  78. \fi
  79. }%
  80. %
  81. % Default definition for active characters.
  82. \def\@denc@undefined@#1{%
  83. \errmessage{Keyboard character used is undefined in input encoding `#1'}%
  84. }%
  85. %
  86. % Make characters #1 to #2 inclusive active and undefined.
  87. \def\@denc@loop#1#2{%
  88. \count@`#1\relax
  89. \loop
  90. \catcode\count@\active
  91. \bgroup
  92. \uccode`\~\count@
  93. \uppercase{%
  94. \egroup
  95. \let~\@denc@undefined
  96. }%
  97. \ifnum\count@<`#2\relax
  98. \advance\count@\@ne
  99. \repeat
  100. }%
  101. %
  102. % \denc@begin{ENC}{FENC-LIST}{DEF-COMMANDS}
  103. %
  104. % Define input ("document") encoding ENC and save DEF-COMMANDS which
  105. % set up the encoding. FENC-LIST defines priorities of font encodings
  106. % which are searched for glyphs while this document encoding is
  107. % active.
  108. \def\denc@define#1#2{%
  109. \expandafter\edef\csname denc@fenc@list/#1\endcsname{#2\space}%
  110. \expandafter\def\csname denc/#1\endcsname
  111. }%
  112. %
  113. % US-ASCII -- leaves all characters above 127 as undefined.
  114. \denc@define{US-ASCII}{OT1 OMS OML}{}%
  115. % End of US-ASCII.
  116. %
  117. % Characters common to ISO-8859-1 and ISO-8859-15.
  118. \def\denc@common@latin@i@xv{%
  119. \iCh160\tie
  120. \iCh161\exclamdown
  121. \iCh162\textcent
  122. \iCh163\pounds
  123. \iCh165\textyen
  124. \iCh167\textsection
  125. \iCh169\copyright
  126. \iCh170\ordf
  127. \iCh171\textguillemotleft
  128. \iCh172\textlnot % FIXME What about \lnot?
  129. \iCh173\-%
  130. \iCh174\registeredsymbol
  131. \iCh175{\={}}%
  132. \iCh176\textdegree
  133. \iCh177\textplusminus
  134. \iCh178\texttwosuperior
  135. \iCh179\textthreesuperior
  136. \iCh181\textmu
  137. \iCh182\textparagraph
  138. \iCh183\textperiodcentered
  139. \iCh185\textonesuperior
  140. \iCh186\ordm
  141. \iCh187\textguillemotright
  142. \iCh191\questiondown
  143. \iCh192{\`A}%
  144. \iCh193{\'A}%
  145. \iCh194{\^A}%
  146. \iCh195{\~A}%
  147. \iCh196{\"A}%
  148. \iCh197{\ringaccent A}%
  149. \iCh198\AE
  150. \iCh199{\,C}%
  151. \iCh200{\`E}%
  152. \iCh201{\'E}%
  153. \iCh202{\^E}%
  154. \iCh203{\"E}%
  155. \iCh204{\`I}%
  156. \iCh205{\'I}%
  157. \iCh206{\^I}%
  158. \iCh207{\"I}%
  159. \iCh208\DH
  160. \iCh209{\~N}%
  161. \iCh210{\`O}%
  162. \iCh211{\'O}%
  163. \iCh212{\^O}%
  164. \iCh213{\~O}%
  165. \iCh214{\"O}%
  166. \iCh215\textmultiply
  167. \iCh216\O
  168. \iCh217{\`U}%
  169. \iCh218{\'U}%
  170. \iCh219{\^U}%
  171. \iCh220{\"U}%
  172. \iCh221{\'Y}%
  173. \iCh222\TH
  174. \iCh223\ss
  175. \iCh224{\`a}%
  176. \iCh225{\'a}%
  177. \iCh226{\^a}%
  178. \iCh227{\~a}%
  179. \iCh228{\"a}%
  180. \iCh229{\ringaccent a}%
  181. \iCh230\ae
  182. \iCh231{\,c}%
  183. \iCh232{\`e}%
  184. \iCh233{\'e}%
  185. \iCh234{\^e}%
  186. \iCh235{\"e}%
  187. \iCh236{\`i}%
  188. \iCh237{\'i}%
  189. \iCh238{\^i}%
  190. \iCh239{\"i}%
  191. \iCh240\dh
  192. \iCh241{\~n}%
  193. \iCh242{\`o}%
  194. \iCh243{\'o}%
  195. \iCh244{\^o}%
  196. \iCh245{\~o}%
  197. \iCh246{\"o}%
  198. \iCh247\textdivide
  199. \iCh248\o
  200. \iCh249{\`u}%
  201. \iCh250{\'u}%
  202. \iCh251{\^u}%
  203. \iCh252{\"u}%
  204. \iCh253{\'y}%
  205. \iCh254\th
  206. \iCh255{\"y}%
  207. }% End of characters common to ISO-8859-1 and ISO-8859-15.
  208. %
  209. % ISO-8859-1.
  210. \denc@define{ISO-8859-1}{T1 TS1 OT1 OMS OML}{%
  211. \denc@common@latin@i@xv
  212. \iCh164\textcurrency
  213. \iCh166\textbrokenbar
  214. \iCh168{\"{}}%
  215. \iCh180{\'{}}%
  216. \iCh184{\,{}}% FIXME LaTeX has it as `\c\ ' (`\ ' instead of `{}'), check why (alignment?).
  217. \iCh188\textonequarter
  218. \iCh189\textonehalf
  219. \iCh190\textthreequarters
  220. }% End of ISO-8859-1.
  221. %
  222. % ISO-8859-15.
  223. \denc@define{ISO-8859-15}{T1 TS1 OT1 OMS OML}{%
  224. \denc@common@latin@i@xv
  225. \iCh164\euro
  226. \iCh166{\v S}%
  227. \iCh168{\v s}%
  228. \iCh180{\v Z}%
  229. \iCh184{\v z}%
  230. \iCh188\OE
  231. \iCh189\oe
  232. \iCh190{\"Y}%
  233. }% End of ISO-8859-15.
  234. %
  235. % ISO-8859-2.
  236. \denc@define{ISO-8859-2}{T1 TS1 OT1 OMS OML}{%
  237. \iCh160\tie
  238. \iCh161{\k A}%
  239. \iCh162{\u{}}%
  240. \iCh163{\L}%
  241. \iCh164\textcurrency
  242. \iCh165{\v L}%
  243. \iCh166{\' S}%
  244. \iCh167\textsection
  245. \iCh168{\"{}}%
  246. \iCh169{\v S}%
  247. \iCh170{\, S}%
  248. \iCh171{\v T}%
  249. \iCh172{\'Z}%
  250. \iCh173\-%
  251. \iCh174{\v Z}%
  252. \iCh175{\dotaccent Z}%
  253. \iCh176\textdegree
  254. \iCh177{\k a}%
  255. \iCh178{\k{}}% FIXME LaTeX has it as `\k\ ' (`\ ' instead of `{}'), check why (alignment?).
  256. \iCh179\l
  257. \iCh180{\'{}}%
  258. \iCh181{\v l}%
  259. \iCh182{\'s}%
  260. \iCh183{\v{}}%
  261. \iCh184{\,{}}% FIXME LaTeX has it as `\c\ ' (`\ ' instead of `{}'), check why (alignment?).
  262. \iCh185{\v s}%
  263. \iCh186{\, s}%
  264. \iCh187{\v t}%
  265. \iCh188{\'z}%
  266. \iCh189{\H{}}%
  267. \iCh190{\v z}%
  268. \iCh191{\dotaccent z}%
  269. \iCh192{\'R}%
  270. \iCh193{\'A}%
  271. \iCh194{\^A}%
  272. \iCh195{\u A}%
  273. \iCh196{\"A}%
  274. \iCh197{\'L}%
  275. \iCh198{\'C}%
  276. \iCh199{\,C}%
  277. \iCh200{\v C}%
  278. \iCh201{\'E}%
  279. \iCh202{\k E}%
  280. \iCh203{\"E}%
  281. \iCh204{\v E}%
  282. \iCh205{\'I}%
  283. \iCh206{\^I}%
  284. \iCh207{\v D}%
  285. \iCh208\DJ
  286. \iCh209{\'N}%
  287. \iCh210{\v N}%
  288. \iCh211{\'O}%
  289. \iCh212{\^O}%
  290. \iCh213{\H O}%
  291. \iCh214{\"O}%
  292. \iCh215\textmultiply
  293. \iCh216{\v R}%
  294. \iCh217{\ringaccent U}%
  295. \iCh218{\'U}%
  296. \iCh219{\H U}%
  297. \iCh220{\"U}%
  298. \iCh221{\'Y}%
  299. \iCh222{\,T}%
  300. \iCh223{\ss}%
  301. \iCh224{\'r}%
  302. \iCh225{\'a}%
  303. \iCh226{\^a}%
  304. \iCh227{\u a}%
  305. \iCh228{\"a}%
  306. \iCh229{\'l}%
  307. \iCh230{\'c}%
  308. \iCh231{\,c}%
  309. \iCh232{\v c}%
  310. \iCh233{\'e}%
  311. \iCh234{\k e}%
  312. \iCh235{\"e}%
  313. \iCh236{\v e}%
  314. \iCh237{\'i}%
  315. \iCh238{\^i}%
  316. \iCh239{\v d}%
  317. \iCh240\dj
  318. \iCh241{\'n}%
  319. \iCh242{\v n}%
  320. \iCh243{\'o}%
  321. \iCh244{\^o}%
  322. \iCh245{\H o}%
  323. \iCh246{\"o}%
  324. \iCh247\textdivide
  325. \iCh248{\v r}%
  326. \iCh249{\ringaccent u}%
  327. \iCh250{\'u}%
  328. \iCh251{\H u}%
  329. \iCh252{\"u}%
  330. \iCh253{\'y}%
  331. \iCh254{\,t}%
  332. \iCh255{\dotaccent{}}%
  333. }% End of ISO-8859-2.
  334. %
  335. % KOI8-R.
  336. \denc@define{KOI8-R}{T2A T1 TS1 OT1 OMS OML}{%
  337. % FIXME \textblacksquare, \surd, \sim, \leq, \geq?
  338. \iCh149\bullet
  339. \iCh154\tie
  340. \iCh156\textdegree
  341. \iCh157\texttwosuperior
  342. \iCh158\textperiodcentered
  343. \iCh159\textdivide
  344. \iCh163\cyryo
  345. \iCh179\CYRYO
  346. \iCh191\copyright
  347. \iCh192\cyryu
  348. \iCh193\cyra
  349. \iCh194\cyrb
  350. \iCh195\cyrc
  351. \iCh196\cyrd
  352. \iCh197\cyre
  353. \iCh198\cyrf
  354. \iCh199\cyrg
  355. \iCh200\cyrh
  356. \iCh201\cyri
  357. \iCh202\cyrishrt
  358. \iCh203\cyrk
  359. \iCh204\cyrl
  360. \iCh205\cyrm
  361. \iCh206\cyrn
  362. \iCh207\cyro
  363. \iCh208\cyrp
  364. \iCh209\cyrya
  365. \iCh210\cyrr
  366. \iCh211\cyrs
  367. \iCh212\cyrt
  368. \iCh213\cyru
  369. \iCh214\cyrzh
  370. \iCh215\cyrv
  371. \iCh216\cyrsftsn
  372. \iCh217\cyrery
  373. \iCh218\cyrz
  374. \iCh219\cyrsh
  375. \iCh220\cyrerev
  376. \iCh221\cyrshch
  377. \iCh222\cyrch
  378. \iCh223\cyrhrdsn
  379. \iCh224\CYRYU
  380. \iCh225\CYRA
  381. \iCh226\CYRB
  382. \iCh227\CYRC
  383. \iCh228\CYRD
  384. \iCh229\CYRE
  385. \iCh230\CYRF
  386. \iCh231\CYRG
  387. \iCh232\CYRH
  388. \iCh233\CYRI
  389. \iCh234\CYRISHRT
  390. \iCh235\CYRK
  391. \iCh236\CYRL
  392. \iCh237\CYRM
  393. \iCh238\CYRN
  394. \iCh239\CYRO
  395. \iCh240\CYRP
  396. \iCh241\CYRYA
  397. \iCh242\CYRR
  398. \iCh243\CYRS
  399. \iCh244\CYRT
  400. \iCh245\CYRU
  401. \iCh246\CYRZH
  402. \iCh247\CYRV
  403. \iCh248\CYRSFTSN
  404. \iCh249\CYRERY
  405. \iCh250\CYRZ
  406. \iCh251\CYRSH
  407. \iCh252\CYREREV
  408. \iCh253\CYRSHCH
  409. \iCh254\CYRCH
  410. \iCh255\CYRHRDSN
  411. }% End of KOI8-R.
  412. %
  413. % CP1251.
  414. \denc@define{CP1251}{T2A T1 TS1 OT1 OMS OML}{%
  415. \iCh128\CYRDJE
  416. \iCh129{\'\CYRG}%
  417. \iCh130\textquotesinglbase
  418. \iCh131{\'\cyrg}%
  419. \iCh132\textquotedblbase
  420. \iCh133\dots
  421. \iCh134\textdagger
  422. \iCh135\textdaggerdbl
  423. \iCh136\euro
  424. \iCh137\textperthousand
  425. \iCh138\CYRLJE
  426. \iCh139\textguilsinglleft
  427. \iCh140\CYRNJE
  428. \iCh141{\'\CYRK}%
  429. \iCh142\CYRTSHE
  430. \iCh143\CYRDZHE
  431. \iCh144\cyrdje
  432. \iCh145\textquoteleft
  433. \iCh146\textquoteright
  434. \iCh147\textquotedblleft
  435. \iCh148\textquotedblright
  436. \iCh149\bullet
  437. \iCh150\textendash
  438. \iCh151\textemdash
  439. \iCh153\texttrademark
  440. \iCh154\cyrlje
  441. \iCh155\textguilsinglright
  442. \iCh156\cyrnje
  443. \iCh157{\'\cyrk}%
  444. \iCh158\cyrtshe
  445. \iCh159\cyrdzhe
  446. \iCh160\tie
  447. \iCh161\CYRUSHRT
  448. \iCh162\cyrushrt
  449. \iCh163\CYRJE
  450. \iCh164\textcurrency
  451. \iCh165\CYRGUP
  452. \iCh166\textbrokenbar
  453. \iCh167\textsection
  454. \iCh168\CYRYO
  455. \iCh169\copyright
  456. \iCh170\CYRIE
  457. \iCh171\textguillemotleft
  458. \iCh172\textlnot
  459. \iCh173\-%
  460. \iCh174\registeredsymbol
  461. \iCh175\CYRYI
  462. \iCh176\textdegree
  463. \iCh177\textplusminus
  464. \iCh178\CYRII
  465. \iCh179\cyrii
  466. \iCh180\cyrgup
  467. \iCh181\textmu
  468. \iCh182\textparagraph
  469. \iCh183\textperiodcentered
  470. \iCh184\cyryo
  471. \iCh185\textnumero
  472. \iCh186\cyrie
  473. \iCh187\textguillemotright
  474. \iCh188\cyrje
  475. \iCh189\CYRDZE
  476. \iCh190\cyrdze
  477. \iCh191\cyryi
  478. \iCh192\CYRA
  479. \iCh193\CYRB
  480. \iCh194\CYRV
  481. \iCh195\CYRG
  482. \iCh196\CYRD
  483. \iCh197\CYRE
  484. \iCh198\CYRZH
  485. \iCh199\CYRZ
  486. \iCh200\CYRI
  487. \iCh201\CYRISHRT
  488. \iCh202\CYRK
  489. \iCh203\CYRL
  490. \iCh204\CYRM
  491. \iCh205\CYRN
  492. \iCh206\CYRO
  493. \iCh207\CYRP
  494. \iCh208\CYRR
  495. \iCh209\CYRS
  496. \iCh210\CYRT
  497. \iCh211\CYRU
  498. \iCh212\CYRF
  499. \iCh213\CYRH
  500. \iCh214\CYRC
  501. \iCh215\CYRCH
  502. \iCh216\CYRSH
  503. \iCh217\CYRSHCH
  504. \iCh218\CYRHRDSN
  505. \iCh219\CYRERY
  506. \iCh220\CYRSFTSN
  507. \iCh221\CYREREV
  508. \iCh222\CYRYU
  509. \iCh223\CYRYA
  510. \iCh224\cyra
  511. \iCh225\cyrb
  512. \iCh226\cyrv
  513. \iCh227\cyrg
  514. \iCh228\cyrd
  515. \iCh229\cyre
  516. \iCh230\cyrzh
  517. \iCh231\cyrz
  518. \iCh232\cyri
  519. \iCh233\cyrishrt
  520. \iCh234\cyrk
  521. \iCh235\cyrl
  522. \iCh236\cyrm
  523. \iCh237\cyrn
  524. \iCh238\cyro
  525. \iCh239\cyrp
  526. \iCh240\cyrr
  527. \iCh241\cyrs
  528. \iCh242\cyrt
  529. \iCh243\cyru
  530. \iCh244\cyrf
  531. \iCh245\cyrh
  532. \iCh246\cyrc
  533. \iCh247\cyrch
  534. \iCh248\cyrsh
  535. \iCh249\cyrshch
  536. \iCh250\cyrhrdsn
  537. \iCh251\cyrery
  538. \iCh252\cyrsftsn
  539. \iCh253\cyrerev
  540. \iCh254\cyryu
  541. \iCh255\cyrya
  542. }% End of CP1251.
  543. %
  544. \endinput