diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /systems/generic/mltex |
Initial commit
Diffstat (limited to 'systems/generic/mltex')
-rw-r--r-- | systems/generic/mltex/README.v22 | 92 | ||||
l--------- | systems/generic/mltex/latex | 1 | ||||
-rw-r--r-- | systems/generic/mltex/mltex.ch | 1046 | ||||
-rw-r--r-- | systems/generic/mltex/mltextst.tex | 200 | ||||
-rw-r--r-- | systems/generic/mltex/mltrip/mltrip.dvi | bin | 0 -> 384 bytes | |||
-rw-r--r-- | systems/generic/mltex/mltrip/mltrip.log | 56 | ||||
-rw-r--r-- | systems/generic/mltex/mltrip/mltrip.tex | 259 | ||||
-rw-r--r-- | systems/generic/mltex/mltrip/mltrip.typ | 182 |
8 files changed, 1836 insertions, 0 deletions
diff --git a/systems/generic/mltex/README.v22 b/systems/generic/mltex/README.v22 new file mode 100644 index 0000000000..0df63b32b4 --- /dev/null +++ b/systems/generic/mltex/README.v22 @@ -0,0 +1,92 @@ +-------------------------- README.v22 -------------------------- + +This directory contains the change files for MLTeX v2.2: + + - README.v22 This file you are currently reading. + - mltex.ch TeX.web change file including the MLTeX/ + \charsubdef extensions. + - mltextst.tex Test file to check for bugs in a MLTeX binary. + Please apply this test to your currently used MLTeX, + additionally use it __before__ reporting a bug. + + - archiv/ This directory contains macros, etc. distributed with + the former version 2.01 of MLTeX. + + +MLTeX is a modification of TeX version >= 3.0 that allows the +hyphenation of words with accented letters using ordinary Computer +Modern (CM) fonts. These fonts miss the glyphs of ready-made accented +letters. MLTeX translates accented letters in TeX's internal code, +following the "Cork standard" (known as LaTeX2e's T1 font encoding), +which do not exist in the current font into an equivalent <accent> +<letter> construct just before the character is sent out to the .dvi +file. These modifications have been called character substitution +definitions, internally "charsubdef". + + +Installation/Implementation: +---------------------------- + +Please read the comments in the file "mltex.ch". They explain how to +create a MLTeX binary, what is different between MLTeX v2.01 und v2.2, +and which restrictions still exist in v2.2. + +If you have no experience creating a TeX implementation by your own, I +suggest to use a ready-to-run version. + +MLTeX v2.2 will be included in + + - web2c v7.0 and all its derivatives (e.g., teTeX distribution) + - emTeX for OS/2 & MS-DOS + +Note: they are _not_ yet included in this packages. + + +Usage: +------ + +To use the \charsubdef extension with ordinary Computer Modern (CM) +fonts, it is needed a) to redefine the accent macros \`, \', \^, \", +etc. to expand to accented characters in TeX's internal code, and b) +to define character substitutions for these accented characters using +an accent and a base character from ordinary CM fonts. + +You can find the original definitions for MLTeX made by Michael +J. Ferguson in the directory archiv/mltex/. These definitions aren't +maintained. + +Bernard Gaulle's "french" style files distribution contains support +for MLTeX derived from Ferguson's macros. You can find this +distribution on the Comprehensive TeX Archive Network (CTAN) in +tex-archive/language/french/ or on the ftp server of GUTenberg, the +french speaking TeX user group, on ftp.univ-rennes1.fr in +pub/GUTenberg/french/. + + +Error Reports: +-------------- + +Error Reports in case of UNCHANGED versions to + + Bernd Raichle + Stettener Str. 73 + 73732 Esslingen + Federal Republic of Germany + Email: raichle@Informatik.Uni-Stuttgart.DE + +Please apply the test file "mltextst.tex" to your MLTeX binary to make +sure that your are using the newest version of MLTeX. If you are +using an old version, update to the newest version before reporting an +error. + +Include a _short_ TeX input file and the output of the log file in +your error report. Add a note about your environment: TeX version, +implementation, operating system. + + + +MLTeX is copyright (C) 1990-92 by Michael J. Ferguson; +MLTeX Version 2.2 is copyright (C) 1995 by B. Raichle; +all rights are reserved. + +-------------------- <95/12/18> Bernd Raichle -------------------- diff --git a/systems/generic/mltex/latex b/systems/generic/mltex/latex new file mode 120000 index 0000000000..f54d88564a --- /dev/null +++ b/systems/generic/mltex/latex @@ -0,0 +1 @@ +../../../macros/latex/contrib/mltex
\ No newline at end of file diff --git a/systems/generic/mltex/mltex.ch b/systems/generic/mltex/mltex.ch new file mode 100644 index 0000000000..7efc6ca7a9 --- /dev/null +++ b/systems/generic/mltex/mltex.ch @@ -0,0 +1,1046 @@ +% This is MLTEX.CH (Version 2.2) in text format, as of Dec 17, 1995. +% WEB change file containing code for various features extending TeX; to +% be applied to TEX.WEB (Version 3.14159) in order to generate MLTEX.WEB. + +% MLTeX is copyright (C) 1990-92 by Michael J. Ferguson; all rights are reserved. +% MLTeX Version 2.2 is copyright (C) 1995 by B. Raichle; all rights are reserved. +% +% +% The MLTeX changes are copyrighted so that we have some chance to +% forbid unauthorized copies; we explicitly authorize copying of +% correct MLTeX implementations, and not of incorrect ones! +% +% (This means that you can use the MLTeX changes as free as you can +% use TeX and its algorithm.) +% +% Copying of this file is authorized only if either +% (1) you make absolutely no changes to your copy, including name, or +% (2) if you do make changes, you name it to something other than +% "mltex.ch", "char_sub.ch", or "charsub.ch". + + +% The TeX program is copyright (C) 1982 by D. E. Knuth. +% TeX is a trademark of the American Mathematical Society. + +% MLTeX Version 2.2 was created by Bernd Raichle +% All line numbers refer to TEX.WEB 3.14159 as of March, 1995. + + +%============================================================ +% INSTALLATION NOTICES: +% +% === Creating MLTeX (general information) === +% +% 1) Merging the change files: +% +% In order to generate an implementation of MLTeX your implementation +% dependent change file and MLTeX's change file "mltex.ch" have to be +% applied to "tex.web", one after the other. +% The process of merging several change files into "tex.web" should +% certainly not be performed by hand. There are programs such as TIE +% and PATCHWEB that perform this process automatically. If no such +% program is available, a TeX program "webmerge.tex" can be used. +% Examples: To merge the two changes files "mltex.ch" and "tex.ch" +% using tie: +% +% tie -c newtex.ch tex.web mltex.ch tex.ch +% +% To do the same using "webmerge.tex" you have to apply TeX to the +% following driver input file: +% +% \input webmerge % needs `webmerge.tex' +% \webfile{tex.web} +% \changefile{mltex.ch} +% \changefile{tex.ch} +% \outfile{newtex.ch} % output file, start processing +% \bye +% +% Before merging the change files it might be necessary to make +% small changes in one of the two change files or, as a more elegant +% way, to add an additional change file for theses some changes which +% interfere between the change files. One of these interferences is +% caused by the change of the banner line ([1] m.2 l.187). +% +% 2) Tangling TeX: +% +% Apply TANGLE on "tex.web" and the combined change file "newtex.ch": +% +% tangle tex.web newtex.ch +% +% 3) Post-processing the Pascal source "tex.p": +% +% Because of a restriction in TANGLE's macros, you have to replace +% the strings "XLPAREN" and "XRPAREN" (resp. "xlparen"/"xrparen") +% with a left parenthesis "(" and a right parenthesis ")" by hand. +% If the Unix tool "sed" is available you can use +% +% sed -e 's/xlparen/(/g' -e 's/xrparen/)/g' < tex.p > mltex.p +% mv mltex.p tex.p +% +% 4) Compile TeX and apply the TRIP test: +% +% The final step will be the compilation of (ML)TeX. You should +% apply the TRIP test to the resulting program to make sure that your +% MLTeX will be compatible to TeX unless one of the new feature is +% used. +% +% +% === Creating MLTeX using web2c v7.0 === +% +% MLTeX v2.2 is part of the TeX in web2c v7.0, you can use the +% "-mltex" option to enable MLTeX. Please read the documentation +% of web2c for more information. +% +% +% === Creating MLTeX using web2c prior to v7.0 === +% +% To create a new change file for web2c v6.1, adapt the change of the +% banner line ([1] m.2 l.187) to the used TeX version. Then use +% `tie' to merge the two change files: +% +% tie -c newtex.ch tex.web mltex.ch tex.ch +% +% Make sure that the combined change file "newtex.ch" will identify +% the resulting TeX as a MLTeX, i.e. make sure that the banner line +% is changed accordingly. +% +% Use tangle: +% +% tangle tex.web newtex.ch +% +% then replace the string "xlparen" with "(" and "xrparen" with `)' +% by using "sed": +% +% sed -e 's/xlparen/(/g' -e 's/xrparen/)/g' < tex.p > mltex.p +% mv mltex.p tex.p +% +% Finally convert the new Pascal source `tex.p' to a C Source using +% `web2c' and compile it. +% +% +%============================================================ +% Differences between MLTeX version 2.1 and 2.2: +% +% * \charsubdefmax has an initial version of -1 +% * All non-existing characters of a font are substituted if a +% \charsubdef is given (the former version doesn't substitute +% characters with codes < highest font character code) +% * Changed log output texts. +% * There will be no |push| and |pop| operations in the dvi file +% for substituted accent constructions +% * With \tracingoutput enabled missing characters are reported +% _before_ the box contents is shown and the box will not contain +% additional character nodes showing the substitutions +% +% Bugs fixed: +% * Error message ("Bad metric (TFM) file.") while loading a font +% was shown in versions 2.01 and older in some cases. +% * No character substitution for large math delimiter character +% * If a character substitution was used and then removed (e.g. by +% \charsubdef <char>=0 0 or \charsubdefmax=-1), all accesses +% to |font_info| for this non-existing character are invalid and +% undefined (=> runtime errors, access violations!). These +% accesses are always done in |char_info| and they occur during +% the |line_break| pass and in |hpack|. +% Fixed: MLTeX will now access the character information for the +% first existing character in the font (normally \char0) instead. +% This means that the character/box dimensions will be incorrect! +% +% ...and in versions before 2.2 (done by Michael J. Ferguson): +% * Errors during shipout to dvi file if \*leaders box contains +% substituted characters +% * Incorrect spacing of |hpack| or |rebox| if two fonts with +% different character metrics are used, e.g. use ArabTeX with +% mixed arabic/latin text. ArabTeX contains a fix on the macro +% level, but it doesn't really fix this bug! +% +% Restrictions: +% * Do not change character substitutions! Because the current +% character substitutions are only read while creating a character +% node in the horizontal list, but are _not_ saved in this node, +% the same substitutions have to be valid during |shipout| of +% this character node to the dvi file. +% (Bugs if \charsubdefs are changed: 1) during |hpack| or +% |shipout| missing character warnings are reported, +% 2) \unhbox will change the width of a box) +% * If an accentee in a \charsubdef has height <= 0 it will +% overlap the base character (for \c c), a real "\underaccent" +% primitive is still missing. +% * Accent placement routine is taken from TeX's \accent primitive, +% adjustments of accent characters (cf. `german.sty' lowers them) +% are not possible. +% +% +%============================================================ +% ChangeLog: +% +% Dec 17, 1995 (br) -- MLTeX v2.2 +% -- add flag |mltex_p| and |mltex_enabled_p|, +% add code to dump and undump the flag and a magic constant +% simplifying the implementation of a command line option `-mltex' +% -- print additional banner line "MLTeX v2.2 enabled" after the fmt +% file is loaded; original banner line is left unmodified +% +% Dec 07, 1995 (br) -- MLTeX v2.2 (betatest) +% -- |effective_char| can return non-existing characters. +% This is not valid after character substitutions are used and +% then are disabled because a node for a non-existing character +% can remain in a horizontal list. (TeX assumes that all char +% nodes are valid, no checks are done after the character node +% is created.) Introduced third argument for |effective_char|, +% introduced function |effective_char_info| as shortcut. +% -- Do not try to substitute characters in math mode +% (for compatibility with MLTeX v2.01) +% -- removed old change of [32] m.638 l.12638; with the changed dvi +% character substitution routines |show_box| can be called in +% |ship_out| before shipping the box to the dvi file---without +% getting incompatible with TRIP +% +% Dec 05, 1995 (br) -- MLTeX v2.2 (alphatest) +% -- typo in test version: |..._slant| are |real|, not |scaled| +% (Thanks, em!) +% -- bug while loading fonts which contains less than 256 characters +% and a character substitution was defined for an existing +% character but a non-existing base character; the analysis of +% bug showed another one w.r.t. a non-existing boundary character +% (fix: define macro |orig_char_info| which doesn't use +% |effective_char| and use it while loading a new font). +% +% Oct 28, 1995 (br) -- MLTeX v2.1+ (not released) +% -- Subsumed "\charsubdef" under |shorthand_def| to simplify +% the merge of multiple change files. +% -- Moved character substitution from |eqtb| region 1 to region 4 +% which will allow \subcharcode<charnum>=<integer> -- a TeX +% construct analogous to \catcode et.al. (This change is already +% included in a prototype of MLTeX version 3 which will use +% different data structures to allow \charsubdef changes on the fly +% without the anomalies in version 2.) +% -- When substituting a character, test if c>font_ec and additionally +% if c<font_bc. +% -- Removed the changes in part 2 ("The character set"), module 24 to +% allow non-ASCII characters in the input files. These changes +% should be included in the implementation specific change files! +% -- addded \charsubdefmin parameter (which can not be accessed by +% the user!) +% -- there was a bug using a \*leaders box with charsubdef'ed +% characters as a \*leaders box; it will try to access characters +% in the |null_font| (probably resulting in access violations)! +% (Fix: additional test for |if f<>null_font ...| in [32] m.620) +% Better fix: don't construct a box construction like \accent, +% write the dvi code directly; this will also simplify other +% changes for TeX--XeT or e-TeX which need a |prevp| pointer. +% +% Sep 9 + Sep 16, 1992 (br) -- MLTeX v2.1+ (test, not released) +% -- initialize char_sub_def_max with -1 (instead of 0) +% -- changed effective_char to blend with the rest of TeX.web +% parameter `c' is an `eight_bit' +% -- removed change of \S708 because it is silly to substitute +% (character parts of) a large math delimiter character +% -- added proposals from E. Mattes +% -- deleted `font_chs' (unnecessary and inconsistent use) +% replaced chs_accent, chs_char, chs_replace +% -- make changes as short as possible +% -- make sure that xchr[@'177] is initialized +% +%============================================================ +% Comments from `char_sub.ch', the former MLTeX change file: +% +% Oct 29, 1993 (MJF) +% In hlist_out change, prevent nullfont from being sent out to .dvi +% file (proposed by B.Raichle). +% ........ version 2.01 +% +% Feb 3, 1992 (MJF) +% effective_char ... modified to include explicit font information. +% This change ensures that the effective_char returns the character +% in the font when that character actually exists ... and not the +% base character in the substitution list. +% char_info and char_info-end have been modified to overcome a Web +% limitation on two parameters and a Web2c parsing problem. +% The result is a tex.p(as) file that will NOT compile WITHOUT the +% following change ... (ugh!): +% Globally replace XIIIX with ( and XTTTX with ) in the tex.p(as) +% file. +% +% bug corrections ... made May 8, 1991 ... errors found by B. Raichle +% +% Trip Switch added by PCTeX ... May 1990 -- Section [*638] +% +% \tracingcharsubdef added June 1990---to aid in debugging---non zero +% values will leave a record of a charsub definition in the log file. +% +% +% Charsub modification of TeX 3.+ to allow for the hyphenation of +% words with current (May 1990) fonts and explicitly built accents. +% +%============================================================ + +@x limbo l.64 - bug fix (print only changed modules) +\def\pct!{{\char`\%}} % percent sign in ordinary text +@y +\def\pct!{{\char`\%}} % percent sign in ordinary text +\def\grp{\.{\char'173...\char'175}} +\let\maybe=\iffalse % print only changed modules +@z + +@x [1] m.2 l.187 - MLTeX: change banner line +@d banner=='This is TeX, Version 3.14159' {printed when \TeX\ starts} +@y + +ML\TeX{} will add new primitives changing the behaviour of \TeX. The +|banner| string has to be changed. We do not change the |banner| +string, but will output an additional line to make clear that this is +a modified \TeX{} version. + +If you plan to add a command line option ``mltex'' to your \TeX{} +implementation, use the boolean variable |mltex_p| to reflect this +option. The boolean |mltex_p| should be set {\it before\/} or in the +initialisation routine |initialize| in the Ini\TeX{} run. (You can +not use a ``mltex'' option in Vir\TeX{}.) To add this option, remove +the definition of |mltex_p| below and add some code to set it. + +The boolean value of |mltex_p| is dumped to the \.{FMT} file and +undumped from this file to the boolean |mltex_enabled_p|. + +@d mltex_p==true {enable ML\TeX{} primitives} +@d banner=='This is TeX, Version 3.14159' {printed when \TeX\ starts} +@z + + +%--------------------------------------- + +@x [15] m.209 l.4165 - MLTeX: \charsubdef primitive +@d shorthand_def=95 {code definition ( \.{\\chardef}, \.{\\countdef}, etc.~)} +@y +@d shorthand_def=95 {code definition ( \.{\\chardef}, \.{\\countdef}, etc.~)} + {or \.{\\charsubdef}} +@z + + +%--------------------------------------- + +@x [17] m.220 l.4448 - MLTeX: char_sub_code_base +paragraph shape. +@y +paragraph shape. +Additionally region~4 contains the table with ML\TeX's character +substitution definitions. +@z + +@x [17] m.230 l.4731 - MLTeX: char_sub_code_base +@d int_base=math_code_base+256 {beginning of region 5} +@y +@d char_sub_code_base=math_code_base+256 {table of character substitutions} +@d int_base=char_sub_code_base+256 {beginning of region 5} +@z + +@x [17] m.230 l.4752 - MLTeX: char_sub_code_base + {Note: |math_code(c)| is the true math code plus |min_halfword|} +@y + {Note: |math_code(c)| is the true math code plus |min_halfword|} +@d char_sub_code(#)==equiv(char_sub_code_base+#) + {Note: |char_sub_code(c)| is the true substitution info plus |min_halfword|} +@z + + +%--------------------------------------- + +@x [17] m.236 l.4954 - MLTeX: \charsubdefmax and \tracingcharsubdef +@d int_pars=55 {total number of integer parameters} +@y +@d char_sub_def_min_code=55 {smallest value in the charsubdef list} +@d char_sub_def_max_code=56 {largest value in the charsubdef list} +@d tracing_char_sub_def_code=57 {traces changes to a charsubdef def} +@d int_pars=58 {total number of integer parameters} +@z + +@x [17] m.236 l.5016 +@d error_context_lines==int_par(error_context_lines_code) +@y +@d error_context_lines==int_par(error_context_lines_code) +@d char_sub_def_min==int_par(char_sub_def_min_code) +@d char_sub_def_max==int_par(char_sub_def_max_code) +@d tracing_char_sub_def==int_par(tracing_char_sub_def_code) +@z + +@x [17] m.237 l.5080 +error_context_lines_code:print_esc("errorcontextlines"); +@y +error_context_lines_code:print_esc("errorcontextlines"); +char_sub_def_min_code:print_esc("charsubdefmin"); +char_sub_def_max_code:print_esc("charsubdefmax"); +tracing_char_sub_def_code:print_esc("tracingcharsubdef"); +@z + +@x [17] m.238 l.5200 +@!@:error_context_lines_}{\.{\\errorcontextlines} primitive@> +@y +@!@:error_context_lines_}{\.{\\errorcontextlines} primitive@> +if mltex_p then + begin mltex_enabled_p:=true; {enable character substitution} + if false then {remove the if-clause to enable \.{\\charsubdefmin}} + primitive("charsubdefmin",assign_int,int_base+char_sub_def_min_code);@/ +@!@:char_sub_def_min_}{\.{\\charsubdefmin} primitive@> + primitive("charsubdefmax",assign_int,int_base+char_sub_def_max_code);@/ +@!@:char_sub_def_max_}{\.{\\charsubdefmax} primitive@> + primitive("tracingcharsubdef",assign_int,int_base+tracing_char_sub_def_code);@/ +@!@:tracing_char_sub_def_}{\.{\\tracingcharsubdef} primitive@> + end; +@z + +@x [17] m.240 l.5213 +for k:=int_base to del_code_base-1 do eqtb[k].int:=0; +@y +for k:=int_base to del_code_base-1 do eqtb[k].int:=0; +char_sub_def_min:=256; char_sub_def_max:=-1; +{allow \.{\\charsubdef} for char 0}@/ +{|tracing_char_sub_def:=0| is already done}@/ +@z + + +%--------------------------------------- + +@x [29] m.534 l.10293 - MLTeX: add. MLTeX banner after loading fmt file +@<Print the banner line, including the date and time@>; +@y +@<Print the banner line, including the date and time@>; +if mltex_enabled_p then + begin wlog_cr; wlog('MLTeX v2.2 enabled'); + end; +@z + + +%--------------------------------------- + +@x [30] m.554 l.10795 - MLTeX: |effective_char| in |char_info| +as fast as possible under the circumstances. +@^inner loop@> + +@d char_info_end(#)==#].qqqq +@d char_info(#)==font_info[char_base[#]+char_info_end +@y +as fast as possible under the circumstances. + +ML\TeX{} will assume that a character |c| exists iff either exists in +the current font or a character substitution definition for this +character was defined using \.{\\charsubdef}. To avoid the +distinction between these two cases, ML\TeX{} introduces the notion +``effective character'' of an input character |c|. If |c| exists in +the current font, the effective character of |c| is the character |c| +itself. If it doesn't exist but a character substitution is defined, +the effective character of |c| is the base character defined in the +character substitution. If there is an effective character for a +non-existing character |c|, the ``virtual character'' |c| will get +appended to the horizontal lists. + +The effective character is used within |char_info| to access +appropriate character descriptions in the font. For example, when +calculating the width of a box, ML\TeX{} will use the metrics of the +effective characters. For the case of a substitution, ML\TeX{} uses +the metrics of the base character, ignoring the metrics of the accent +character. + +If character substitutions are changed, it will be possible that a +character |c| neither exists in a font nor there is a valid character +substitution for |c|. To handle these cases |effective_char| should +be called with its first argument set to |true| to ensure that it +will still return an existing character in the font. If neither |c| +nor the substituted base character in the current character +substitution exists, |effective_char| will output a warning and +return the character |font_bc[f]| (which is incorrect, but can not be +changed within the current framework). + +Sometimes character substitutions are unwanted, therefore the +original definition of |char_info| can be used using the macro +|orig_char_info|. Operations in which character substitutions should +be avoided are, for example, loading a new font and checking the font +metric information in this font, and character accesses in math mode. + +(Because of retrictions in \.{TANGLE}'s macro capabilities you have +to replace \.{XLPAREN} resp.\ \.{xlparen} with an opening brace and +\.{XRPAREN} resp.\ \.{xrparen} with a closing brace after tangling +\TeX!) +@^inner loop@> + +@d char_list_exists(#)==(char_sub_code(#)>hi(0)) +@d char_list_accent(#)==(ho(char_sub_code(#)) div 256) +@d char_list_char(#)==(ho(char_sub_code(#)) mod 256) +@# +@d char_info_end(#)== #xrparen].qqqq +@d char_info(#)== + font_info[char_base[#]+effective_char xlparen true,#,char_info_end +@# +@d orig_char_info_end(#)==#].qqqq +@d orig_char_info(#)==font_info[char_base[#]+orig_char_info_end +@# +@z + +@x [30] m.560 l.10876 - MLTeX: |effective_char| in |char_info| +@p function read_font_info(@!u:pointer;@!nom,@!aire:str_number; +@y +@p @t\4@>@<Declare additional functions for ML\TeX@>@/ + +function read_font_info(@!u:pointer;@!nom,@!aire:str_number; +@z + + +% Bug report: (Nov/Dec 95) +% When +% 1) character substitution \charsubdef x1=x2 x3 is active and +% 2) font Y with character x1 but the base char x3 doesn't exist +% the error message +% ! Font \test=test not loadable: Bad metric (TFM) file. +% will appear when loading Y. +% +% Bug analysis: +% !! |font_bc[f]| and |font_ec[f]| are set at the end of the loading +% !! process in module 576. |effective_char| uses these two +% !! values, therefore never use |effective_char| or |char_info| +% !! until the end of |read_font_info|. +% +% There are three places in which |char_info| is called: +% a) @<Check for charlist cycle@> +% no box dimensions are read at this time, i.e. +% width index is 0 for each character and +% font_ec/bc have undefined values +% => |effective_char| assumes that char x1 doesn't exist +% ==> x1 gets replaced by the "effective" character x3 +% which doesn't exist! ==> error message +% b) @<Read ligature/kern program@>, macro |check_existence| +% box dimensions are already read, i.e. width index<>0 and +% ligature/kerning program contains "real" characters, +% nonetheless font_bc/ec have undefined values! +% => |effective_char| assumes that char x1 doesn't exist +% in most cases (because font_bc/ec are normally zeroed) +% ==> error message +% c) @<Make final adjustments...@> +% code decides if boundary character exists in the font, +% it will be ok---normally, but font_bc/ec... :-( +% => |effective_char| assumes that char x1 doesn't exist +% in most cases (because font_bc/ec are normally zeroed) +% ==> wrong _if_ effective character exits but not the +% boundary character and vice versa +% This is another bug, because the value of the flag +% |font_false_bchar| depends on current substitution. +% +% The cause of the error message was the undefined values of +% |font_bc[f]| and |font_ec[f]|, and even if they will have +% defined values there would be error because of a) and, if a +% font contains a boundary character, c). +% +% Bug fix: +% Don't use |effective_char|, use the original definition of +% |char_info| named |orig_char_info|. +% + +@x [30] m.570 l.11064 - MLTeX: fix for bug while loading font + begin qw:=char_info(f)(d); +@y + begin qw:=orig_char_info(f)(d); +@z +@x [30] m.573 l.11116 - MLTeX: fix for bug while loading font + qw:=char_info(f)(#); {N.B.: not |qi(#)|} +@y + qw:=orig_char_info(f)(#); {N.B.: not |qi(#)|} +@z +@x [30] m.576 l.11180 - MLTeX: fix for bug while loading font + begin qw:=char_info(f)(bchar); {N.B.: not |qi(bchar)|} +@y + begin qw:=orig_char_info(f)(bchar); {N.B.: not |qi(bchar)|} +@z + + +%--------------------------------------- + +@x [30] m.582 l.11276 - MLTeX: call |effective_char| in |new_character| +@p function new_character(@!f:internal_font_number;@!c:eight_bits):pointer; +label exit; +var p:pointer; {newly allocated node} +begin if font_bc[f]<=c then if font_ec[f]>=c then + if char_exists(char_info(f)(qi(c))) then +@y + +This allows a character node to be used if there is an equivalent +in the |char_sub_code| list. + +@p function new_character(@!f:internal_font_number;@!c:eight_bits):pointer; +label exit; +var p:pointer; {newly allocated node} +@!ec:quarterword; {effective character of |c|} +begin ec:=effective_char(false,f,qi(c)); +if font_bc[f]<=qo(ec) then if font_ec[f]>=qo(ec) then + if char_exists(orig_char_info(f)(ec)) then {N.B.: not |char_info|} +@z + + +%--------------------------------------- + +@x [32] m.619 l.12294 - MLTeX: substitute character in |hlist_out| +procedure hlist_out; {output an |hlist_node| box} +label reswitch, move_past, fin_rule, next_p; +@y +procedure hlist_out; {output an |hlist_node| box} +label reswitch, move_past, fin_rule, next_p, continue, found; +@z + +@x [32] m.620 l.12326 - MLTeX: replace virtual character in |hlist_out| +reaching a non-|char_node|. The program uses the fact that |set_char_0=0|. +@^inner loop@> +@y +reaching a non-|char_node|. The program uses the fact that |set_char_0=0|. + +In ML\TeX{} this part looks for the existence of a substitution +definition for a character |c|, if |c| does not exist in the font, +and create appropriate \.{DVI} commands. Former versions of ML\TeX{} +have spliced appropriate character, kern, and box nodes into the +horizontal list. +% +% 91/05/08 \charsubdefmax bug detected by Bernd Raichle +Because the user can change character substitions or +\.{\\charsubdefmax} on the fly, we have to test a again +for valid substitutions. +% +% 93/10/29 \leaders bug detected by Eberhard Mattes +% ==> prevent nullfont from being sent to .dvi file (B.R.) +(Additional it is necessary to be careful---if leaders are used +the current hlist is normally traversed more than once!) +@^inner loop@> +@z + +@x [32] m.620 l.12334 -- MLTeX: substitute character during |shipout| + if c>=qi(128) then dvi_out(set1); + dvi_out(qo(c));@/ + cur_h:=cur_h+char_width(f)(char_info(f)(c)); +@y + if font_ec[f]>=qo(c) then if font_bc[f]<=qo(c) then + if char_exists(orig_char_info(f)(c)) then {N.B.: not |char_info|} + begin if c>=qi(128) then dvi_out(set1); + dvi_out(qo(c));@/ + cur_h:=cur_h+char_width(f)(orig_char_info(f)(c)); + goto continue; + end; + if mltex_enabled_p then + @<Output a substitution, |goto continue| if not possible@>; +continue: +@z + + +%--------------------------------------- + +% The MLTeX changes never dealt with the problems of character +% substitutions in math mode. With the new additions in v2.2, +% non-existing characters between |font_bc[f]| and |font_ec[f]| +% can be substituted => we have to avoid this in math mode +% (for compatibility reasons and to avoid other problems). + +@x [35] m.708 l.13903 -- MLTeX: avoid substitution in |var_delimiter| +if (qo(y)>=font_bc[g])and(qo(y)<=font_ec[g]) then + begin continue: q:=char_info(g)(y); +@y +if (qo(y)>=font_bc[g])and(qo(y)<=font_ec[g]) then + begin continue: q:=orig_char_info(g)(y); +@z + +@x [36] m.722 l.14172 -- MLTeX: avoid substitution in |fetch| +else begin if (qo(cur_c)>=font_bc[cur_f])and(qo(cur_c)<=font_ec[cur_f]) then + cur_i:=char_info(cur_f)(cur_c) +@y +else begin if (qo(cur_c)>=font_bc[cur_f])and(qo(cur_c)<=font_ec[cur_f]) then + cur_i:=orig_char_info(cur_f)(cur_c) +@z + +@x [36] m.740 l.14486 -- MLTeX: avoid substitution in |make_math_accent| + i:=char_info(f)(y); +@y + i:=orig_char_info(f)(y); +@z + +@x [36] m.749 l.14638 -- MLTeX: avoid substitution in |make_op| + begin c:=rem_byte(cur_i); i:=char_info(cur_f)(c); +@y + begin c:=rem_byte(cur_i); i:=orig_char_info(cur_f)(c); +@z + +%--------------------------------------- + +%% +%% We can rewrite the original code after "main_loop_move+2" upto the +%% "tail_append(lig_stack)" in module 1036 as +%% +% +% main_loop_move+2: +% if font_bc[main_f]<=cur_chr then +% if cur_chr<=font_ec[main_f] then +% begin main_i:=char_info(main_f)(cur_l); +% if char_exists(main_i) goto main_loop_move+3; +% end; +% char_warning(main_f,cur_chr); free_avail(lig_stack); goto big_switch; +% main_loop_move+3: +% tail_append(lig_stack) {|main_loop_lookahead| is next} +% +%% +%% We can use the rewritten code above to include additional MLTeX +%% specific parts in the future. Additionally it can be used when +%% optimizing |main_control| to minimize the call of the function +%% |effective_char|. +%% +% +%@x [46] m.1030 l.19977 - MLTeX: substitution in |main_control| +% main_loop_move,main_loop_move+1,main_loop_move+2,main_loop_move_lig, +%@y +% main_loop_move,main_loop_move+1,main_loop_move+2,main_loop_move+3, +% main_loop_move_lig, +%@z + +@x [46] m.1036 l.20138 - MLTeX: substitution in |main_control| +main_loop_move+2:if(cur_chr<font_bc[main_f])or(cur_chr>font_ec[main_f]) then +@y +main_loop_move+2: +if(qo(effective_char(false,main_f,qi(cur_chr)))>font_ec[main_f])or + (qo(effective_char(false,main_f,qi(cur_chr)))<font_bc[main_f]) then +@z + +@x [46] m.1036 l.20141 - MLTeX: substitution in |main_control| +main_i:=char_info(main_f)(cur_l); +@y +main_i:=effective_char_info(main_f,cur_l); +@z + + +%--------------------------------------- + +@x [49] m.1222 l.22794 - MLTeX: \charsubdef primitive +@d toks_def_code=6 {|shorthand_def| for \.{\\toksdef}} +@y +@d toks_def_code=6 {|shorthand_def| for \.{\\toksdef}} +@d char_sub_def_code=7 {|shorthand_def| for \.{\\charsubdef}} +@z + +@x [49] m.1222 l.22810 - MLTeX: \charsubdef primitive +@!@:toks_def_}{\.{\\toksdef} primitive@> +@y +@!@:toks_def_}{\.{\\toksdef} primitive@> +if mltex_p then + begin + primitive("charsubdef",shorthand_def,char_sub_def_code);@/ +@!@:char_sub_def_}{\.{\\charsubdef} primitive@> + end; +@z + +@x [49] m.1222 l.22820 - MLTeX: \charsubdef primitive + othercases print_esc("toksdef") +@y + char_sub_def_code: print_esc("charsubdef"); + othercases print_esc("toksdef") +@z + +@x [49] m.1222 l.22833 - MLTeX: \charsubdef primitive +shorthand_def: begin n:=cur_chr; get_r_token; p:=cur_cs; define(p,relax,256); +@y +shorthand_def: if cur_chr=char_sub_def_code then + begin scan_char_num; p:=char_sub_code_base+cur_val; scan_optional_equals; + scan_char_num; n:=cur_val; {accent character in substitution} + scan_char_num; + if (tracing_char_sub_def>0) then + begin begin_diagnostic; print_nl("New character substitution: "); + print_ASCII(p-char_sub_code_base); print(" = "); + print_ASCII(n); print_char(" "); + print_ASCII(cur_val); end_diagnostic(false); + end; + n:=n*256+cur_val; + define(p,data,hi(n)); + if (p-char_sub_code_base)<char_sub_def_min then + word_define(int_base+char_sub_def_min_code,p-char_sub_code_base); + if (p-char_sub_code_base)>char_sub_def_max then + word_define(int_base+char_sub_def_max_code,p-char_sub_code_base); + end +else begin n:=cur_chr; get_r_token; p:=cur_cs; define(p,relax,256); +@z + + +%--------------------------------------- + +@x [50] m.1302 l.23694 - MLTeX: dump |mltex_p| to fmt file +@<Dump constants for consistency check@>; +@y +@<Dump constants for consistency check@>; +dump_int(@"4D4C5458); {ML\TeX's magic constant: "MLTX"} +if mltex_p then dump_int(1) +else dump_int(0); +@z + +@x [50] m.1303 l.23694 - MLTeX: undump |mltex_enabled_p| from fmt file +begin @<Undump constants for consistency check@>; +@y +begin @<Undump constants for consistency check@>; +undump_int(x); {check magic constant of ML\TeX} +if x<>@"4D4C5458 then goto bad_fmt; +undump_int(x); {undump |mltex_p| flag into |mltex_enabled_p|} +if x=1 then mltex_enabled_p:=true +else if x<>0 then goto bad_fmt; +@z + +@x [51] m.1337 l.24371 - MLTeX: add. MLTeX banner after loading fmt file +fix_date_and_time;@/ +@y +if mltex_enabled_p then + begin wterm_ln('MLTeX v2.2 enabled'); + end; +fix_date_and_time;@/ +@z + + +%--------------------------------------- + +@x [54] m.1376 l.24903 - MLTeX: additional routines +@* \[54] System-dependent changes. +@y +@* \[54/ML\TeX] System-dependent changes for ML\TeX. + +The boolean variable |mltex_enabled_p| is used to enable ML\TeX's +character substitution. It is initialised to |false|. When loading +a \.{FMT} it is set to the value of the boolean |mltex_p| saved in +the \.{FMT} file. Additionally it is set to the value of |mltex_p| +in Ini\TeX. + +@<Glob...@>= +@!mltex_enabled_p:boolean; {enable character substitution} + + +@ @<Set init...@>= +mltex_enabled_p:=false; + + +@ The function |effective_char| computes the effective character with +respect to font information. The effective character is either the +base character part of a character substitution definition, if the +character does not exist in the font or the character itself. + +Inside |effective_char| we can not use |char_info| because the macro +|char_info| uses |effective_char| calling this function a second time +with the same arguments. + +If neither the character |c| exists in font |f| nor a character +substitution for |c| was defined, you can not use the function value +as a character offset in |char_info| because it will access an +undefined or invalid |font_info| entry! Therefore inside |char_info| +and in other places, |effective_char|'s boolean parameter |err_p| is +set to |true| to issue a warning and return the incorrect +replacement, but always existing character |font_bc[f]|. +@^inner loop@> + +@<Declare additional functions for ML\TeX@>= +function effective_char(@!err_p:boolean; + @!f:internal_font_number;@!c:quarterword):integer; +label found; +var base_c: integer; {or |eightbits|: replacement base character} +@!result: integer; {or |quarterword|} +begin result:=c; {return |c| unless it does not exist in the font} +if not mltex_enabled_p then goto found; +if font_ec[f]>=qo(c) then if font_bc[f]<=qo(c) then + if char_exists(orig_char_info(f)(c)) then {N.B.: not |char_info|(f)(c)} + goto found; +if qo(c)>=char_sub_def_min then if qo(c)<=char_sub_def_max then + if char_list_exists(qo(c)) then + begin base_c:=char_list_char(qo(c)); + result:=qi(base_c); {return |base_c|} + if not err_p then goto found; + if font_ec[f]>=base_c then if font_bc[f]<=base_c then + if char_exists(orig_char_info(f)(qi(base_c))) then goto found; + end; +if err_p then {print error and return existing character?} + begin begin_diagnostic; + print_nl("Missing character: There is no "); print("substitution for "); +@.Missing character@> + print_ASCII(qo(c)); print(" in font "); + slow_print(font_name[f]); print_char("!"); end_diagnostic(false); + result:=qi(font_bc[f]); {N.B.: not non-existing character |c|!} + end; +found: effective_char:=result; +end; + + +@ The function |effective_char_info| is equivalent to |char_info|, +except it will return |null_character| if neither the character |c| +exists in font |f| nor is there a substitution definition for |c|. +(For these cases |char_info| using |effective_char| will access an +undefined or invalid |font_info| entry. See the documentation of +|effective_char| for more information.) +@^inner loop@> + +@<Declare additional functions for ML\TeX@>= +function effective_char_info(@!f:internal_font_number; + @!c:quarterword):four_quarters; +label exit; +var ci:four_quarters; {character information bytes for |c|} +@!base_c:integer; {or |eightbits|: replacement base character} +begin if not mltex_enabled_p then + begin effective_char_info:=orig_char_info(f)(c); return; + end; +if font_ec[f]>=qo(c) then if font_bc[f]<=qo(c) then + begin ci:=orig_char_info(f)(c); {N.B.: not |char_info|(f)(c)} + if char_exists(ci) then + begin effective_char_info:=ci; return; + end; + end; +if qo(c)>=char_sub_def_min then if qo(c)<=char_sub_def_max then + if char_list_exists(qo(c)) then + begin {|effective_char_info:=char_info(f)(qi(char_list_char(qo(c))));|} + base_c:=char_list_char(qo(c)); + if font_ec[f]>=base_c then if font_bc[f]<=base_c then + begin ci:=orig_char_info(f)(qi(base_c)); {N.B.: not |char_info|(f)(c)} + if char_exists(ci) then + begin effective_char_info:=ci; return; + end; + end; + end; +effective_char_info:=null_character; +exit:end; + + +@ This code is called for a virtual character |c| in |hlist_out| +during |ship_out|. It tries to built a character substitution +construct for |c| generating appropriate \.{DVI} code using the +character substitution definition for this character. If a valid +character substitution exists \.{DVI} code is created as if +|make_accent| was used. In all other cases the status of the +substituion for this character has been changed between the creation +of the character node in the hlist and the output of the page---the +created \.{DVI} code will be correct but the visual result will be +undefined. + +Former ML\TeX\ versions have replaced the character node by a +sequence of character, box, and accent kern nodes splicing them into +the original horizontal list. This version does not do this to avoid +a)~a memory overflow at this processing stage, b)~additional code to +add a pointer to the previous node needed for the replacement, and +c)~to avoid wrong code resulting in anomalies because of the use +within a \.{\\leaders} box. + +@<Output a substitution, |goto continue| if not possible@>= + begin + @<Get substitution information, check it, goto |found| + if all is ok, otherwise goto |continue|@>; +found: @<Print character substition tracing log@>; + @<Rebuild character using substitution information@>; + end + + +@ The global variables for the code to substitute a virtual character +can be declared as local. Nonetheless we declare them as global to +avoid stack overflows because |hlist_out| can be called recursivly. + +@<Glob...@>= +@!accent_c,@!base_c,@!replace_c:integer; +@!ia_c,@!ib_c:four_quarters; {accent and base character information} +@!base_slant,@!accent_slant:real; {amount of slant} +@!base_x_height:scaled; {accent is designed for characters of this height} +@!base_width,@!base_height:scaled; {height and width for base character} +@!accent_width,@!accent_height:scaled; {height and width for accent} +@!delta:scaled; {amount of right shift} + + +@ Get the character substitution information in |char_sub_code| for +the character |c|. The current code checks that the substition +exists and is valid and all substitution characters exist in the +font, so we can {\it not\/} substitute a character used in a +substitution. This simplifies the code because we have not to check +for cycles in all character substitution definitions. + +@<Get substitution information, check it...@>= + if qo(c)>=char_sub_def_min then if qo(c)<=char_sub_def_max then + if char_list_exists(qo(c)) then + begin base_c:=char_list_char(qo(c)); + accent_c:=char_list_accent(qo(c)); + if (font_ec[f]>=base_c) then if (font_bc[f]<=base_c) then + if (font_ec[f]>=accent_c) then if (font_bc[f]<=accent_c) then + begin ia_c:=char_info(f)(qi(accent_c)); + ib_c:=char_info(f)(qi(base_c)); + if char_exists(ib_c) then + if char_exists(ia_c) then goto found; + end; + begin_diagnostic; + print_nl("Missing character: Incomplete substitution "); +@.Missing character@> + print_ASCII(qo(c)); print(" = "); print_ASCII(accent_c); + print(" "); print_ASCII(base_c); print(" in font "); + slow_print(font_name[f]); print_char("!"); end_diagnostic(false); + goto continue; + end; + begin_diagnostic; + print_nl("Missing character: There is no "); print("substitution for "); +@.Missing character@> + print_ASCII(qo(c)); print(" in font "); + slow_print(font_name[f]); print_char("!"); end_diagnostic(false); + goto continue + + +@ For |tracinglostchars>99| the substitution is shown in the log file. + +@<Print character substition tracing log@>= + if tracing_lost_chars>99 then + begin begin_diagnostic; + print_nl("Using character substitution: "); + print_ASCII(qo(c)); print(" = "); + print_ASCII(accent_c); print(" "); print_ASCII(base_c); + print(" in font "); slow_print(font_name[f]); print_char("."); + end_diagnostic(false); + end + + +@ This outputs the accent and the base character given in the +substitution. It uses code virtually identical to the |make_accent| +procedure, but without the node creation steps. + +Additionally if the accent character has to be shifted vertically it +does {\it not\/} create the same code. The original routine in +|make_accent| and former versions of ML\TeX{} creates a box node +resulting in |push| and |pop| operations, whereas this code simply +produces vertical positioning operations. This can influence the +pixel rounding algorithm in some \.{DVI} drivers---and therefore will +probably be changed in one of the next ML\TeX{} versions. + +@<Rebuild character using substitution information@>= + base_x_height:=x_height(f); + base_slant:=slant(f)/float_constant(65536); +@^real division@> + accent_slant:=base_slant; {slant of accent character font} + base_width:=char_width(f)(ib_c); + base_height:=char_height(f)(height_depth(ib_c)); + accent_width:=char_width(f)(ia_c); + accent_height:=char_height(f)(height_depth(ia_c));@/ + {compute necessary horizontal shift (don't forget slant)} + delta:=round((base_width-accent_width)/float_constant(2)+ + base_height*base_slant-base_x_height*accent_slant); +@^real multiplication@> +@^real addition@> + dvi_h:=cur_h; {update |dvi_h|, similar to the last statement in module 620}@/ + {1. For centering/horizontal shifting insert a kern node.} + cur_h:=cur_h+delta; synch_h;@/ + {2. Then insert the accent character possibly shifted up or down.} + if ((base_height<>base_x_height) and (accent_height>0)) then + begin {the accent must be shifted up or down} + cur_v:=base_line+(base_x_height-base_height); synch_v; + if accent_c>=128 then dvi_out(set1); + dvi_out(accent_c); + cur_v:=base_line; + end + else begin synch_v; + if accent_c>=128 then dvi_out(set1); + dvi_out(accent_c); + end; + cur_h:=cur_h+accent_width; dvi_h:=cur_h;@/ + {3. For centering/horizontal shifting insert another kern node.} + cur_h:=cur_h+(-accent_width-delta);@/ + {4. Output the base character.} + synch_h; synch_v; + if base_c>=128 then dvi_out(set1); + dvi_out(base_c);@/ + cur_h:=cur_h+base_width; + dvi_h:=cur_h {update of |dvi_h| is unnecessary, will be set in module 620} + + +@* \[54] System-dependent changes. +@z +% +%%% --- end of MLTEX.CH --- diff --git a/systems/generic/mltex/mltextst.tex b/systems/generic/mltex/mltextst.tex new file mode 100644 index 0000000000..d7925fea20 --- /dev/null +++ b/systems/generic/mltex/mltextst.tex @@ -0,0 +1,200 @@ +% This is MLTEXTST.TEX (Version 1.2) in text format, as of Dec 07, 1995. +% Test file to check MLTeX implementations. +% +% Copyright (C) 1995 by B.Raichle; all rights are reserved. +% +% Usage: +% +% Run iniTeX on this file. Do not try to use plain-TeX or LaTeX. +% Needs the font metric files: cmr10.tfm, cmti10.tfm +% +% +% Changes: +% +% 95/12/05 v1.0 +% - initial version +% 95/12/06 v1.1 +% - don't show tracing output +% - \nonstopmode and additional test for bug 2. +% 95/12/07 v1.2 +% - added MLTeX version numbers (and release dates) +% - added test for MLTeX version 2.2 +% +% +% History of MLTeX for TeX 3.x: +% +% 90/04/02 Version ?? (for TeX 3.0) +% \charsublist, \charsublistmax +% ??/??/?? Version 1.0 +% 92/02/03 Version 2 (for TeX 3.1--3.141) +% |effective_char| uses explicit font information +% 93/10/29 Version 2.01 +% fix \*leaders problem +% 95/12/06 Version 2.2 (for TeX 3.14159) +% fix font loading bug +% fix invalid |font_info| access +% in work Version 3.0 +% complete re-implementation +% +% +\catcode`\{=1 \catcode`\}=2 \catcode`\#=6 +% +\immediate\write16{} +\immediate\write16{Test for bugs in MLTeX (1995/12/07 v1.2 [br])} +\immediate\write16{} +% +% check for plain-TeX: +% we have to ensure that _no_ fonts are preloaded +\expandafter\ifx\csname active\endcsname\relax \else + \message{Please (Ini)TeX this file, no plain-TeX, no LaTeX!} + \expandafter\endinput\expandafter\end\fi +% check for MLTeX +\expandafter\ifx\csname charsubdef\endcsname\relax + \message{This test file can only be used with MLTeX!} + \expandafter\endinput\fi +% +\nonstopmode +%%%\tracingonline=1 \tracingoutput=1 \showboxbreadth=255 +%%%\tracinglostchars=100 \tracingcharsubdef=1 +\hsize=5in +% +% +% 1. Check for bug accessing the wrong character metrics: +% (in versions before Feb 1992) +% +\font\tenrm=cmr10\relax +% +% The group is only necessary, if you want to use this +% test in your own macros. \charsubdefmax is saved +% explicitly for very old versions of MLTeX which have +% an additional bug when assigning this special integer. +\begingroup + \count255=\charsubdefmax + \charsubdefmax=256 % enable all substitutions + % very old versions of MLTeX will + \charsubdef`\i=1 `\M % substitute "i" by "M" + \setbox0=\hbox{\tenrm i}% <-- here + \dimen0=\wd0 % get width of box (either "i" or "M") + % get width of "i" + \charsubdefmax=-1 % disable all substitutions + \setbox0=\hbox{\tenrm i}% + \dimen2=\wd0 % get width of box + % restore former value of \charsubdefmax + \charsubdefmax=\count255 +\expandafter\endgroup +\ifdim\dimen0=\dimen2\relax + \immediate\write16{..... Ok, this is a newer MLTeX version (>= 2.0).} + \immediate\write16{} +\else + \immediate\write16{% +..... This is a very old version of MLTeX < 2.0 (released before Feb. 1992)} + \immediate\write16{% +..... immediately update to the newest MLTeX version!} + \immediate\write16{} + \expandafter\endinput\expandafter\end +\fi +% +% +% 2. Check for font loading bug: +% (in versions before Dec 1995) +% +% - Define a \charsubdef of an existing character with +% a non-existing base character +% +\charsubdef `A=`a 128 +%%%\message{now: \string\charsubdefmax=\number\charsubdefmax} +% +% - now load font (do not preload this font!!!!!!) +% +\immediate\write16{} +\immediate\write16{..... If there will be an error "Bad metric (TFM) file",} +\immediate\write16{..... please update to the newest MLTeX version!} +\immediate\write16{} +\font\test=cmti10\relax +\begingroup + \setbox0=\hbox{\test A} +\expandafter\endgroup +\ifdim\wd0>0pt\relax \else + \immediate\write16{} + \immediate\write16{% +..... This seems to be MLTeX version 2.0 or 2.01 (released before Dec. 1995)} + \immediate\write16{% +..... this version has bugs,} + \immediate\write16{% +..... please update to the newest MLTeX version!} + \immediate\write16{} + \expandafter\endinput\expandafter\end +\fi +\immediate\write16{..... Good, no "Bad metric (TFM) file" bug,} +\immediate\write16{..... seems to be the a MLTeX version > 2.01.} +% +% +% 3. Check for invalid |font_info| access: +% +\immediate\write16{} +\font\tenrm=cmr10\relax +% +\setbox0=\hbox{\tenrm \char`a}\dimen1=\wd0 +\setbox0=\hbox{\tenrm \char`M}\dimen3=\wd0 +\setbox0=\hbox{\tenrm \char0}\dimen5=\wd0 +% +\charsubdef 128=`a `a +\setbox0=\hbox{\tenrm \char128} +\dimen0=\wd0 % get width of `a +% +% Now the \charsubdef is changed using +% an existing base character: +\charsubdef 128=`a `M +\setbox0=\hbox{\unhbox0} +\dimen2=\wd0 % get width of `a or `M +% +% And then we remove it. MLTeX will try to access the 128th +% entry in the |char_base| array, which is the first entry in +% the width index array. +% For MLTeX 2.2 this was "fixed", now it will report a warning +% "Missing char... no substitution for ..." and MLTeX will use +% the first character of the font. +\charsubdefmax=-1 +\setbox0=\hbox{\unhbox0}% +\dimen4=\wd0 +% +%%%\message{\the\dimen0-\the\dimen1-\the\dimen2-\the\dimen3-% +%%% \the\dimen4-\the\dimen5-} +% +\def\x#1\fi\fi{\fi\fi#1} +\ifdim\dimen0=\dimen2\relax \ifdim\dimen0=\dimen4\relax + \immediate\write16{} + \immediate\write16{% +...... Seems to be MLTeX version 3.x (unreleased),} + \immediate\write16{% +...... from whom did you get this version? :-)} + \immediate\write16{} + \immediate\write16{% +Congratulations, you have the best MLTeX version!} + \immediate\write16{} + \x{\endinput\csname end\endcsname}% +\fi\fi +% +\def\x#1\fi{\fi#1} +\ifdim\dimen4=\dimen5\relax \else + \immediate\write16{} + \immediate\write16{% +..... Seems to be MLTeX version 2.0 or 2.01 (released before Dec. 1995)} + \immediate\write16{% +..... this version has bugs,} + \immediate\write16{% +..... please update to the newest MLTeX version!} + \immediate\write16{} + \expandafter\endinput\expandafter\end +\fi +% +\immediate\write16{} +\immediate\write16{% +...... Seems to be MLTeX version 2.2 (released Dec. 1995).} +\immediate\write16{} +\immediate\write16{% +Congratulations, you have a MLTeX version with all known bugs fixed.} +\immediate\write16{} +\end +% +%%% END OF FILE %%% diff --git a/systems/generic/mltex/mltrip/mltrip.dvi b/systems/generic/mltex/mltrip/mltrip.dvi Binary files differnew file mode 100644 index 0000000000..29377dcd6f --- /dev/null +++ b/systems/generic/mltex/mltrip/mltrip.dvi diff --git a/systems/generic/mltex/mltrip/mltrip.log b/systems/generic/mltex/mltrip/mltrip.log new file mode 100644 index 0000000000..4f9a3da06e --- /dev/null +++ b/systems/generic/mltex/mltrip/mltrip.log @@ -0,0 +1,56 @@ +This is MLTeX, Version 3.14159 (INITEX) 16 JAN 1997 13:49 +MLTeX v2.2 enabled +**mltrip +(mltrip.tex + +"Trip" test for MLTeX implementations (1997/01/14 v1.0c [br]) + +Test font load bug (in MLTeX < v2.2): +done. +Test assignments to \charsubdefmax: +done. +Test char substitution, box packing and repacking: +<2 missing char warnings: +Missing character: There is no ^^c1 in font cmr10! +Missing character: There is no ^^c2 in font cmr10! +>, <1 missing substitution warning: +Missing character: There is no substitution for ^^e0 in font cmr10! +>, <2 missing substitution warnings: +Missing character: There is no substitution for ^^e0 in font cmr10! +Missing character: There is no substitution for ^^e0 in font cmr10! +>, done. +Test dvi output with substitutions: +<Alternating 5 incomplete subst. + 5 missing subst. warnings: [0 +Missing character: Incomplete substitution ^^d2 = ^^80 a in font cmr10! +Missing character: There is no substitution for ^^e0 in font cmr10! +Missing character: Incomplete substitution ^^d3 = ^^80 a in font cmr10! +Missing character: There is no substitution for ^^e1 in font cmr10! +Missing character: Incomplete substitution ^^d4 = ^^80 a in font cmr10! +Missing character: There is no substitution for ^^e2 in font cmr10! +Missing character: Incomplete substitution ^^d6 = ^^80 a in font cmr10! +Missing character: There is no substitution for ^^e4 in font cmr10! +Missing character: Incomplete substitution ^^d5 = ^^80 c in font cmr10! +Missing character: There is no substitution for ^^e3 in font cmr10! +] >, done. + + +To complete the test: +===================== + +1. Compare the log file with the one provided. +2. Compare the dvi output: +The dvi file should contain 5 lines of text, each line beginning +with an ASCII description of the accented character, a colon +followed by five en-dashes and two accented characters: + a-grave: -- \`a -- \`a-- -- -- + a-acute: -- \'a -- \'a-- -- -- + a-circonflex: -- \^a -- \^a-- -- -- + a-umlaut: -- \"a -- \"a-- -- -- + c-cedille: -- \c{c} -- \c{c}-- -- -- +The spacing between the first accented character and the first +two en-dashes has to be correct, whereas the en-dash after the +second accented character has to touch the character! Otherwise +your MLTeX implementation is incorrect. + + ) +Output written on mltrip.dvi (1 page, 384 bytes). diff --git a/systems/generic/mltex/mltrip/mltrip.tex b/systems/generic/mltex/mltrip/mltrip.tex new file mode 100644 index 0000000000..ac7c3be79c --- /dev/null +++ b/systems/generic/mltex/mltrip/mltrip.tex @@ -0,0 +1,259 @@ +% This is `mltrip.tex' for MLTeX v2.2 (as of December 17, 1995). +% +% A test file to check for correct MLTeX implementations similar to +% `trip.tex', Knuth's torture test for TeX. +% +% Copyright (C) 1997 by B. Raichle; all rights are reserved. +% +% MLTeX is copyright (C) 1990-92 by Michael J. Ferguson; all rights are reserved. +% MLTeX Version 2.2 is copyright (C) 1995 by B. Raichle; all rights are reserved. +% The TeX program is copyright (C) 1982 by D. E. Knuth. +% TeX is a trademark of the American Mathematical Society. +% +% +% Usage: +% +% 1. Run iniTeX with the MLTeX extensions on this file. +% Do not try to use plain-TeX or LaTeX. +% 2. Compare the produced log file with the one provided. +% 3. Take a look at the dvi file and compare it with the +% description at the end of the log file. +% 4. (optional) Use dvitype to convert the dvi file to the +% ASCII representation of its contents using these options: +% Output level = 2 +% Starting page = * (default) +% Number of pages = 1000000 (default) +% Resolution = 7227/100 +% New magnification = 0 (default) +% Compare the output with the provided file `mltrip.typ'. +% +% +% Needs: +% +% - MLTeX v2.2 +% - font metric file cmr10.tfm +% - dvitype (if you want to compare the dvi files) +% +% +% Changes: +% +% 97/01/06 v1.0a +% - initial version +% 97/01/08 v1.0b +% - added error count + \inputlineno test, fixed log output +% 97/01/14 v1.0c +% - added tests for math character substitution +% +\catcode`\{=1 \catcode`\}=2 \catcode`\$=3 \catcode`\#=6 \catcode`\^=7 +\endlinechar=`\^^M\newlinechar=`\^^J \def\space{ } \nonstopmode +% +\def\typeout#1{\immediate\write16{#1}} +\countdef\errorcount=254 \errorcount=0 +\def\error#1{\advance\errorcount 1% + \typeout{^^J^^J\space\space\space ERROR: #1^^J^^J}} +% +\typeout{^^J"Trip" test for MLTeX implementations (1997/01/14 v1.0c [br])^^J} +% +% check for plain-TeX: +% we have to ensure that _no_ fonts are preloaded +\expandafter\ifx\csname active\endcsname\relax \else + \typeout{Please (Ini)TeX this file, no plain-TeX, no LaTeX!^^J} + \expandafter + \endinput\csname @@end\expandafter\endcsname\expandafter\end\fi\relax +% check for MLTeX +\expandafter\ifx\csname charsubdef\endcsname\relax + \typeout{This test file can only be used with MLTeX!^^J} + \expandafter\endinput\expandafter\end\fi\relax +% check for MLTeX v2.2 +% (former MLTeX versions have initialized \charsubdefmax with 0) +\ifnum\charsubdefmax<0 \else + \typeout{...ouch, an old MLTeX version!^^J% + This test file can only be used with MLTeX v2.2 or newer!^^J} + \expandafter\endinput\expandafter\end\fi\relax +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +\typeout{Test font load bug (in MLTeX < v2.2):} +% define substitution of an existing char with a non-existing base char +\charsubdef `\A=`\a 128 +% load font (which should be preloaded before!) +\font\test=cmr10 \relax \test + \textfont0=\test \textfont1=\test +\font\smalltest=cmr10 \relax % our symbols font +\fontdimen22\smalltest=7pt + \textfont2=\smalltest \scriptfont2=\smalltest + \scriptscriptfont2=\smalltest +\font\bigtest=cmr10 \relax % our extension font + \textfont3=\bigtest \scriptfont3=\bigtest + \scriptscriptfont3=\bigtest +\thinmuskip=18mu plus 18mu +\medmuskip=36mu plus 9mu minus 18mu +\thickmuskip=54mu minus 18mu \relax +% +\hsize=2in \parindent=.5pt \parfillskip=0pt plus1fil\relax +\baselineskip=12pt \topskip=10pt \relax +\tracingonline=1\showboxbreadth=255\showboxdepth=255 +\tracinglostchars=1 +%%%\tracingcharsubdef=1 +\message{done.} +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +\typeout{Test assignments to \string\charsubdefmax:} +\charsubdefmax=-1 % reset because of \charsubdef`\A ... +\begingroup + %%%\tracingrestores=10 + \count0=\charsubdefmax + \begingroup \charsubdef 224 = `\` `a + \ifnum\charsubdefmax=224 \else + \error{\string\charsubdefmax\space set incorrectly (1)!}\fi + \endgroup + \ifnum\count0=\charsubdefmax \else + \error{\string\charsubdefmax\space reset incorrectly (1)!}\fi + % Test of a bug in MLTeX v2.2! + \begingroup \charsubdef 228 = `\" `a \global\charsubdef 224 = `\` `a + \ifnum\charsubdefmax=228\else + \error{\string\charsubdefmax\space set incorrectly (2)!}\fi + \endgroup + \ifnum\charsubdefmax=-1 \else % BUG: 224 was expected, not -1! + \error{\string\charsubdefmax\space reset incorrectly (2)!}\fi + % ...instead we use a simpler test: + \begingroup \charsubdef 226 = `\^ `a \charsubdef 224 = `\` `a + \ifnum\charsubdefmax=226 \else + \error{\string\charsubdefmax\space set incorrectly (3)!}\fi + \global\charsubdef 228 = `\" `a + \endgroup + \ifnum\charsubdefmax=228 \else + \error{\string\charsubdefmax\space reset incorrectly (3)!}\fi + % reset former value of \charsubdef and \charsubdefmax + \global\charsubdef 224=0 0 + \global\charsubdef 228=0 0 + \global\charsubdefmax=\count0 +\endgroup +\message{done.} +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +\typeout{Test char substitution, box packing and repacking:} +\charsubdef 224 = 18 `a % "E0 \`a +\charsubdef 225 = 19 `a % "E1 \'a +\charsubdef 226 = 94 `a % "E2 \^a +\charsubdef 228 = 127 `a % "E4 \"a +% define some substitutions whose characters doesn't exist in cmr10: +\charsubdef 192 = 200 `a +\charsubdef 193 = `a 129 +\charsubdef 194 = 128 129 +% +\setbox2=\hbox{\char`a}\setbox4=\hbox{\char0} +\message{<2 missing char warnings:} +\setbox0=\hbox{\char224\char192\char193\char194} +\message{>,} +\ifdim\wd0=2\wd2 \else + \error{box width dimension set incorrectly (1)!}\fi +% +\setbox0=\hbox{\char224} +\ifdim\wd0=\wd2 \else + \error{box width dimension set incorrectly (2)!}\fi +% re-access character dimensions while substitution is disabled +% (=> warning message, width of \char224 is first char in font, i.e. \char0) +\message{<1 missing substitution warning:} +{\charsubdefmax=0 \global\setbox0=\hbox{\unhbox0}} +\message{>,} +\ifdim\wd0=\wd4 \else + \error{box width dimension set incorrectly (3)!}\fi +% re-box it again (=> no warning message!) +\setbox0=\hbox{\unhbox0} +\ifdim\wd0=\wd2 \else + \error{box width dimension set incorrectly (4)!}\fi +% +\message{<2 missing substitution warnings:} +\setbox0=\vbox{\char224 \charsubdefmax=0\par} +\message{>,} +\message{done.} +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +%%\typeout{Test math character substitutions:} +%%\setbox0=\hbox{$\mathchar"2E0 % |fetch| +%% \mathaccent"70E1 a % |fetch| + |make_math_accent| +%% \mathaccent"7013 \mathchar"2E2 % |fetch| +%% \mathop{\mathchar"0E4}{}% |fetch| +%% \delimiter"43E03E1 % |var_delimiter| +%% $}\showbox0 +%%\message{done.} +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +\typeout{Test dvi output with substitutions:} +% define correct substitutions +\charsubdef 192 = 18 `a % \`a +\charsubdef 193 = 19 `a % \'a +\charsubdef 194 = 94 `a % \^a +\charsubdef 196 = 127 `a % \"a +\charsubdef 199 = 24 `c % \c{c} +% define correct substitutions +\charsubdef 204 = 18 16 % \`\i +\charsubdef 205 = 19 16 % \'\i +\charsubdef 206 = 94 16 % \^\i +\charsubdef 208 = 127 16 % \"\i +\charsubdef 207 = 24 `i % \c{i} +% define substitutions with non-existing characters +\charsubdef 210 = 128 `a % \`a +\charsubdef 211 = 128 `a % \'a +\charsubdef 212 = 128 `a % \^a +\charsubdef 214 = 128 `a % \"a +\charsubdef 213 = 128 `c % \c{c} +% define correct substitutions +\charsubdef 224 = 18 `a % \`a +\charsubdef 225 = 19 `a % \'a +\charsubdef 226 = 94 `a % \^a +\charsubdef 228 = 127 `a % \"a +\charsubdef 227 = 24 `c % \c{c} +% +\setbox0=\vbox{% + \def\row#1 #2 #3 #4 {--\char#1--\hbox{\char#2}--\char#3--\char#4--\par}% + a-grave: \row 192 204 210 224 % + a-acute: \row 193 205 211 225 % + a-circonflex: \row 194 206 212 226 % + a-umlaut: \row 196 208 214 228 % + c-cedille: \row 199 207 213 227 % +} +% +% redefine the correct substitutions +\charsubdef 204 = 18 `a % \`a <= \`\i +\charsubdef 205 = 19 `a % \'a <= \'\i +\charsubdef 206 = 94 `a % \^a <= \^\i +\charsubdef 208 = 127 `a % \"a <= \"\i +\charsubdef 207 = 24 `c % \c{c} <= \c\i +% +\begingroup + \message{<Alternating 5 incomplete subst. + 5 missing subst. warnings:} + \charsubdefmax=223 + \shipout\box0 + \message{>,} +\endgroup +\message{done.} +% +\def\row#1#2#3{\space\space #1: -- \string#2#3 -- \string#2#3-- -- --} +\typeout{^^J^^JTo complete the test:^^J=====================^^J^^J% +1. Compare the log file with the one provided.^^J% +2. Compare the dvi output:^^J% +The dvi file should contain 5 lines of text, each line beginning^^J% +with an ASCII description of the accented character, a colon^^J% +followed by five en-dashes and two accented characters:^^J% + \row{a-grave}{\`}{a}^^J% + \row{a-acute}{\'}{a}^^J% + \row{a-circonflex}{\^}{a}^^J% + \row{a-umlaut}{\"}{a}^^J% + \row{c-cedille}{\c}{{c}}^^J% +The spacing between the first accented character and the first^^J% +two en-dashes has to be correct, whereas the en-dash after the^^J% +second accented character has to touch the character! Otherwise^^J% +your MLTeX implementation is incorrect.^^J} +% +% Test for correct number of lines: +\ifnum 255=\inputlineno \else + \error{`mltrip.tex' corrupted! (l.\the\inputlineno)}\fi +\ifnum\errorcount>0 \error{There was atleast one error!}\fi +\end\relax \typeout{Can't happen in MLTeX "trip" test!} +%% End of file `mltrip.tex'. diff --git a/systems/generic/mltex/mltrip/mltrip.typ b/systems/generic/mltex/mltrip/mltrip.typ new file mode 100644 index 0000000000..177c1118a4 --- /dev/null +++ b/systems/generic/mltex/mltrip/mltrip.typ @@ -0,0 +1,182 @@ +Options selected: + Starting page = * + Maximum number of pages = 1000000 + Output level = 2 (mnemonics) + Resolution = 72.27000000 pixels per inch +numerator/denominator=25400000/473628672 +magnification=1000; 0.00001526 pixels per DVI unit +' TeX output 1997.01.16:1349' + +42: beginning of page 0 +87: down3 282168 +91: push +92: right3 32768 +[ ] +96: fntdef1 0: cmr10---loaded at size 655360 DVI units +117: fntnum0 +118: setchar97 +119: setchar45 +120: setchar103 +121: setchar114 +122: setchar97 +123: w2 -18205 +126: setchar118 +127: w0 -18205 +128: setchar101 +129: setchar58 +130: right3 218453 +134: setchar123 +[a-grave: {] +135: setchar18 +136: w3 -327681 +140: setchar97 +141: setchar123 +[a{] +142: push +143: setchar18 +144: w0 -327681 +145: setchar97 +[a] +146: pop +147: right3 182045 +151: setchar123 +152: setchar123 +153: setchar123 +[ {{{] +154: pop +155: y3 786432 +159: push +160: right3 32768 +164: setchar97 +165: setchar45 +166: setchar97 +167: setchar99 +168: setchar117 +169: setchar116 +170: setchar101 +171: setchar58 +172: right3 218453 +176: setchar123 +[a-acute: {] +177: setchar19 +178: w3 -327681 +182: setchar97 +183: setchar123 +[a{] +184: push +185: setchar19 +186: w0 -327681 +187: setchar97 +[a] +188: pop +189: right3 182045 +193: setchar123 +194: setchar123 +195: setchar123 +[ {{{] +196: pop +197: y0 786432 +198: push +199: right3 32768 +203: setchar97 +204: setchar45 +205: setchar99 +206: setchar105 +207: setchar114 +208: setchar99 +209: setchar111 +210: setchar110 +[a-circon] +211: setchar13 +212: setchar101 +213: setchar120 +214: setchar58 +215: right3 218453 +219: setchar123 +220: setchar94 +221: w3 -327681 +225: setchar97 +226: setchar123 +[ex: {^a{] +227: push +228: setchar94 +229: w0 -327681 +230: setchar97 +[^a] +231: pop +232: right3 182045 +236: setchar123 +237: setchar123 +238: setchar123 +[ {{{] +239: pop +240: y0 786432 +241: push +242: right3 32768 +246: setchar97 +247: setchar45 +248: setchar117 +249: setchar109 +250: setchar108 +251: setchar97 +252: setchar117 +253: setchar116 +254: setchar58 +255: right3 218453 +259: setchar123 +[a-umlaut: {] +260: setchar127 +261: w3 -327681 +265: setchar97 +266: setchar123 +[a{] +267: push +268: setchar127 +269: w0 -327681 +270: setchar97 +[a] +271: pop +272: right3 182045 +276: setchar123 +277: setchar123 +278: setchar123 +[ {{{] +279: pop +280: y0 786432 +281: push +282: right3 32768 +286: setchar99 +287: setchar45 +288: setchar99 +289: setchar101 +290: setchar100 +291: setchar105 +292: setchar108 +293: setchar108 +294: setchar101 +295: setchar58 +296: right3 218453 +300: setchar123 +[c-cedille: {] +301: setchar24 +302: w3 -291271 +306: setchar99 +307: setchar123 +[c{] +308: push +309: setchar24 +310: w0 -291271 +311: setchar99 +[c] +312: pop +313: right3 182045 +317: setchar123 +318: setchar123 +319: setchar123 +[ {{{] +320: pop +321: eop +Postamble starts at byte 322. +maxv=3427896, maxh=9472573, maxstackdepth=2, totalpages=1 +Font 0: cmr10 + |