DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T c

⟦965ca6083⟧ TextFile

    Length: 26793 (0x68a9)
    Types: TextFile
    Names: »cxet.patch«

Derivation

└─⟦060c9c824⟧ Bits:30007080 DKUUG TeX 2/12/89
    └─⟦this⟧ »./tex82/TeXpatches/cxet.patch« 

TextFile

*** ctex.ch	Mon Jan  2 14:13:18 1989 (starting with a BIG ctex.ch)
--- cxet.ch	Mon Jan  2 14:26:25 1989
***************
*** 37,43 ****
  @x
  @d banner=='This is TeX, Version 2.95' {printed when \TeX\ starts}
  @y
! @d banner=='This is TeX, C Version 2.95' {printed when \TeX\ starts}
  @z
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--- 37,43 ----
  @x
  @d banner=='This is TeX, Version 2.95' {printed when \TeX\ starts}
  @y
! @d banner=='This is TeX-Xet, C Version 2.95' {printed when \TeX\ starts}
  @z
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
***************
*** 63,69 ****
  @f type==true {but `|type|' will not be treated as a reserved word}
  
  @p @t\4@>@<Compiler directives@>@/
! program TEX; {all file names are defined dynamically}
  @z
  
  @x
--- 63,69 ----
  @f type==true {but `|type|' will not be treated as a reserved word}
  
  @p @t\4@>@<Compiler directives@>@/
! program TEXXET; {all file names are defined dynamically}
  @z
  
  @x
***************
*** 198,204 ****
    \.{INITEX} than it is in production versions of \TeX}
  @!dvi_buf_size=16384; {size of the output buffer; must be a multiple of 8}
  @!file_name_size=1024; {file names shouldn't be longer than this}
! @!pool_name='tex.pool';
    {string of length |file_name_size|; tells where the string pool appears}
  @!mem_top=262140; {largest index in the |mem| array dumped by \.{INITEX};
    must be substantially larger than |mem_bot|
--- 198,204 ----
    \.{INITEX} than it is in production versions of \TeX}
  @!dvi_buf_size=16384; {size of the output buffer; must be a multiple of 8}
  @!file_name_size=1024; {file names shouldn't be longer than this}
! @!pool_name='texxet.pool';
    {string of length |file_name_size|; tells where the string pool appears}
  @!mem_top=262140; {largest index in the |mem| array dumped by \.{INITEX};
    must be substantially larger than |mem_bot|
***************
*** 626,632 ****
  @y
  else begin
     {Like |bad_pool|, but must not close file if we never opened it}
!    wake_up_terminal; write_ln(term_out, '! I can''t read tex.pool.');
     get_strings_started:= false; return;
  end
  @z
--- 626,632 ----
  @y
  else begin
     {Like |bad_pool|, but must not close file if we never opened it}
!    wake_up_terminal; write_ln(term_out, '! I can''t read texxet.pool.');
     get_strings_started:= false; return;
  end
  @z
***************
*** 635,641 ****
  @.TEX.POOL has no check sum@>
  read(pool_file,m,n); {read two digits of string length}
  @y
! begin if eof(pool_file) then bad_pool('! tex.pool has no check sum.');
  @.TEX.POOL has no check sum@>
  read(pool_file,m); read(pool_file,n); {read two digits of string length}
  @z
--- 635,641 ----
  @.TEX.POOL has no check sum@>
  read(pool_file,m,n); {read two digits of string length}
  @y
! begin if eof(pool_file) then bad_pool('! texxet.pool has no check sum.');
  @.TEX.POOL has no check sum@>
  read(pool_file,m); read(pool_file,n); {read two digits of string length}
  @z
***************
*** 642,658 ****
  @x
      bad_pool('! TEX.POOL line doesn''t begin with two digits.');
  @y
!     bad_pool('! tex.pool line doesn''t begin with two digits.');
  @z
  @x
    bad_pool('! TEX.POOL check sum doesn''t have nine digits.');
  @y
!   bad_pool('! tex.pool check sum doesn''t have nine digits.');
  @z
  @x
  done: if a<>@$ then bad_pool('! TEX.POOL doesn''t match; TANGLE me again.');
  @y
! done: if a<>@$ then bad_pool('! tex.pool doesn''t match; tangle me again.');
  @z
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--- 642,658 ----
  @x
      bad_pool('! TEX.POOL line doesn''t begin with two digits.');
  @y
!     bad_pool('! texxet.pool line doesn''t begin with two digits.');
  @z
  @x
    bad_pool('! TEX.POOL check sum doesn''t have nine digits.');
  @y
!   bad_pool('! texxet.pool check sum doesn''t have nine digits.');
  @z
  @x
  done: if a<>@$ then bad_pool('! TEX.POOL doesn''t match; TANGLE me again.');
  @y
! done: if a<>@$ then bad_pool('! texxet.pool doesn''t match; tangle me again.');
  @z
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
***************
*** 842,848 ****
--- 842,861 ----
  if r>toint(p+1) then @<Allocate from the top of node |p| and |goto found|@>;
  @z
  
+ 
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ % [10.161] make room for a new creation procedure (TeX-XeT extension)
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ @x 
+ \TeX's other algorithms intact.
+ @^system dependencies@>
+ @y
+ \TeX's other algorithms intact.
+ @^system dependencies@>
+ @p@<Declare functions needed for special kinds of nodes@>
+ @z
+ 
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  % [11.165] fix the word "free" so that it doesn't conflict with the C routine
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  @x
***************
*** 927,933 ****
--- 940,1037 ----
  @^real multiplication@>
    end
  @z
+ 
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ % [15.208,209] New command code (TeX-XeT extension)
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ @x 
+ @d max_non_prefixed_command=69 {largest command code that can't be \.{\\global}}
+ 
+ @ The next codes are special; they all relate to mode-independent
+ assignment of values to \TeX's internal registers or tables.
+ Codes that are |max_internal| or less represent internal quantities
+ that might be expanded by `\.{\\the}'.
+ 
+ @d toks_register=70 {token list register ( \.{\\toks} )}
+ @d assign_toks=71 {special token list ( \.{\\output}, \.{\\everypar}, etc.~)}
+ @d assign_int=72 {user-defined integer ( \.{\\tolerance}, \.{\\day}, etc.~)}
+ @d assign_dimen=73 {user-defined length ( \.{\\hsize}, etc.~)}
+ @d assign_glue=74 {user-defined glue ( \.{\\baselineskip}, etc.~)}
+ @d assign_mu_glue=75 {user-defined muglue ( \.{\\thinmuskip}, etc.~)}
+ @d assign_font_dimen=76 {user-defined font dimension ( \.{\\fontdimen} )}
+ @d assign_font_int=77 {user-defined font integer ( \.{\\hyphenchar},
+   \.{\\skewchar} )}
+ @d set_aux=78 {specify state info ( \.{\\spacefactor}, \.{\\prevdepth} )}
+ @d set_prev_graf=79 {specify state info ( \.{\\prevgraf} )}
+ @d set_page_dimen=80 {specify state info ( \.{\\pagegoal}, etc.~)}
+ @d set_page_int=81 {specify state info ( \.{\\deadcycles},
+   \.{\\insertpenalties} )}
+ @d set_box_dimen=82 {change dimension of box ( \.{\\wd}, \.{\\ht}, \.{\\dp} )}
+ @d set_shape=83 {specify fancy paragraph shape ( \.{\\parshape} )}
+ @d def_code=84 {define a character code ( \.{\\catcode}, etc.~)}
+ @d def_family=85 {declare math fonts ( \.{\\textfont}, etc.~)}
+ @d set_font=86 {set current font ( font identifiers )}
+ @d def_font=87 {define a font file ( \.{\\font} )}
+ @d register=88 {internal register ( \.{\\count}, \.{\\dimen}, etc.~)}
+ @d max_internal=88 {the largest code that can follow \.{\\the}}
+ @d advance=89 {advance a register or parameter ( \.{\\advance} )}
+ @d multiply=90 {multiply a register or parameter ( \.{\\multiply} )}
+ @d divide=91 {divide a register or parameter ( \.{\\divide} )}
+ @d prefix=92 {qualify a definition ( \.{\\global}, \.{\\long}, \.{\\outer} )}
+ @d let=93 {assign a command code ( \.{\\let}, \.{\\futurelet} )}
+ @d shorthand_def=94 {code definition ( \.{\\chardef}, \.{\\countdef}, etc.~)}
+ @d read_to_cs=95 {read into a control sequence ( \.{\\read} )}
+ @d def=96 {macro definition ( \.{\\def}, \.{\\gdef}, \.{\\xdef}, \.{\\edef} )}
+ @d set_box=97 {set a box ( \.{\\setbox} )}
+ @d hyph_data=98 {hyphenation data ( \.{\\hyphenation}, \.{\\patterns} )}
+ @d set_interaction=99 {define level of interaction ( \.{\\batchmode}, etc.~)}
+ @d max_command=99 {the largest command code seen at |big_switch|}
+ @y
+ @d LR=70 {text direction ( \.{\\beginL}, \.{\\beginR}, \.{\\endL}, \.{\\endR} )}
+ @d max_non_prefixed_command=70 {largest command code that can't be \.{\\global}}
+ 
+ @ The next codes are special; they all relate to mode-independent
+ assignment of values to \TeX's internal registers or tables.
+ Codes that are |max_internal| or less represent internal quantities
+ that might be expanded by `\.{\\the}'.
+ 
+ @d toks_register=71 {token list register ( \.{\\toks} )}
+ @d assign_toks=72 {special token list ( \.{\\output}, \.{\\everypar}, etc.~)}
+ @d assign_int=73 {user-defined integer ( \.{\\tolerance}, \.{\\day}, etc.~)}
+ @d assign_dimen=74 {user-defined length ( \.{\\hsize}, etc.~)}
+ @d assign_glue=75 {user-defined glue ( \.{\\baselineskip}, etc.~)}
+ @d assign_mu_glue=76 {user-defined muglue ( \.{\\thinmuskip}, etc.~)}
+ @d assign_font_dimen=77 {user-defined font dimension ( \.{\\fontdimen} )}
+ @d assign_font_int=78 {user-defined font integer ( \.{\\hyphenchar},
+   \.{\\skewchar} )}
+ @d set_aux=79 {specify state info ( \.{\\spacefactor}, \.{\\prevdepth} )}
+ @d set_prev_graf=80 {specify state info ( \.{\\prevgraf} )}
+ @d set_page_dimen=81 {specify state info ( \.{\\pagegoal}, etc.~)}
+ @d set_page_int=82 {specify state info ( \.{\\deadcycles},
+   \.{\\insertpenalties} )}
+ @d set_box_dimen=83 {change dimension of box ( \.{\\wd}, \.{\\ht}, \.{\\dp} )}
+ @d set_shape=84 {specify fancy paragraph shape ( \.{\\parshape} )}
+ @d def_code=85 {define a character code ( \.{\\catcode}, etc.~)}
+ @d def_family=86 {declare math fonts ( \.{\\textfont}, etc.~)}
+ @d set_font=87 {set current font ( font identifiers )}
+ @d def_font=88 {define a font file ( \.{\\font} )}
+ @d register=89 {internal register ( \.{\\count}, \.{\\dimen}, etc.~)}
+ @d max_internal=89 {the largest code that can follow \.{\\the}}
+ @d advance=90 {advance a register or parameter ( \.{\\advance} )}
+ @d multiply=91 {multiply a register or parameter ( \.{\\multiply} )}
+ @d divide=92 {divide a register or parameter ( \.{\\divide} )}
+ @d prefix=93 {qualify a definition ( \.{\\global}, \.{\\long}, \.{\\outer} )}
+ @d let=94 {assign a command code ( \.{\\let}, \.{\\futurelet} )}
+ @d shorthand_def=95 {code definition ( \.{\\chardef}, \.{\\countdef}, etc.~)}
+ @d read_to_cs=96 {read into a control sequence ( \.{\\read} )}
+ @d def=97 {macro definition ( \.{\\def}, \.{\\gdef}, \.{\\xdef}, \.{\\edef} )}
+ @d set_box=98 {set a box ( \.{\\setbox} )}
+ @d hyph_data=99 {hyphenation data ( \.{\\hyphenation}, \.{\\patterns} )}
+ @d set_interaction=100 {define level of interaction ( \.{\\batchmode}, etc.~)}
+ @d max_command=100 {the largest command code seen at |big_switch|}
+ @z
+ 
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  % [17.241] fix_date_and_time
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  @x
***************
*** 1241,1246 ****
--- 1345,1371 ----
  @z
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ % [31.585-586] new DVI opcodes (TeX-XeT extension)
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ @x 
+ \yskip\noindent Commands 250--255 are undefined at the present time.
+ 
+ @ @d set_char_0=0 {typeset character 0 and move right}
+ @y
+ \yskip\hang|begin_reflect| 250. Begin a (possibly recursive) reflected segment.
+ 
+ \yskip\hang|end_reflect| 251. End a (possibly recursive) reflected segment.
+ 
+ \yskip\noindent Commands 250--255 are undefined in normal \.{DVI} files,
+ but 250 and 251 are permitted in the special `\.{DVI-IVD}' files
+ produced by this variant of \TeX.
+ 
+ @ @d begin_reflect=250 {begin a reflected segment (not normally allowed)}
+ @d end_reflect=251 {end a reflected segment (not normally allowed)}
+ @d set_char_0=0 {typeset character 0 and move right}
+ @z
+ 
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  % [32.597] write_dvi
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  @x
***************
*** 1269,1274 ****
--- 1394,1432 ----
  @z
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ % [32.638] changes to ship_out (TeX-XeT extension)
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ @x 
+ begin if tracing_output>0 then
+ @y
+ begin LR_ptr:=get_avail; info(LR_ptr):=0; {|begin_L_code| at outer level}
+ if tracing_output>0 then
+ @z
+ @x (module 639)
+ flush_node_list(p);
+ @y
+ flush_node_list(p); @<Flush the LR stack@>;
+ @z
+ 
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ % [33.649] hpack changes (TeX-XeT extension)
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ @x 
+ begin r:=get_node(box_node_size); type(r):=hlist_node;
+ @y
+ @!LR_ptr,@!LR_tmp:pointer; {for LR stack maintenance}
+ @!LR_problems:integer; {counts missing begins and ends}
+ begin LR_ptr:=null; LR_problems:=0;
+ r:=get_node(box_node_size); type(r):=hlist_node;
+ @z
+ @x (module 649, continued)
+ exit: hpack:=r;
+ @y
+ exit: @<Check for LR anomalies at the end of |hpack|@>;
+ hpack:=r;
+ @z
+ 
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  % [38.859] Fix a C casting/expression evaluation problem
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  @x
***************
*** 1289,1294 ****
--- 1447,1483 ----
  @z
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ % [39.877] post_line_break stuff (TeX-XeT extension)
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ @x 
+ begin @<Reverse the links of the relevant passive nodes, setting |cur_p| to the
+ @y
+ @!LR_ptr,@!LR_tmp:pointer; {for LR stack maintenance}
+ begin LR_ptr:=null;
+  @<Reverse the links of the relevant passive nodes, setting |cur_p| to the
+ @z
+ @x (module 877, continued)
+ prev_graf:=best_line-1;
+ @y
+ prev_graf:=best_line-1;
+ @<Flush the LR stack@>;
+ @z
+ 
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ % [39.880] post_line_break stuff continued(TeX-XeT extension)
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ @x (module 880)
+ @<Modify the end of the line to reflect the nature of the break and to include
+   \.{\\rightskip}; also set the proper value of |disc_break|@>;
+ @y
+ @<Insert LR nodes at the beginning of the current line@>;
+ @<Adjust the LR stack based on LR nodes in this line@>;
+ @<Modify the end of the line to reflect the nature of the break and to include
+   \.{\\rightskip}; also set the proper value of |disc_break|@>;
+ @<Insert LR nodes at the end of the current line@>;
+ @z
+ 
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  % [43.944] Fix a C casting/expression evaluation problem
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  @x
***************
*** 1309,1358 ****
  @z
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! % [49.1275] a_open_in of \read file needs path specifier
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! @x
!   if a_open_in(read_file[n]) then read_open[n]:=just_open;
  @y
!   if a_open_in(read_file[n],read_path_spec) then read_open[n]:=just_open;
  @z
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! % [50.1302] Eliminate unused variable w in |store_fmt_file|
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! @x
! @!init procedure store_fmt_file;
! label found1,found2,done1,done2;
! var j,@!k,@!l:integer; {all-purpose indices}
! @!p,@!q: pointer; {all-purpose pointers}
! @!x: integer; {something to dump}
! @!w: four_quarters; {four ASCII codes}
  @y
! @!init procedure store_fmt_file;
! label found1,found2,done1,done2;
! var j,@!k,@!l:integer; {all-purpose indices}
! @!p,@!q: pointer; {all-purpose pointers}
! @!x: integer; {something to dump}
  @z
  
! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! % [50.1303] Eliminate unused variable w in |load_fmt_file|
! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  @x
! @p @t\4@>@<Declare the function called |open_fmt_file|@>@;
! function load_fmt_file:boolean;
! label bad_fmt,exit;
! var j,@!k:integer; {all-purpose indices}
! @!p,@!q: pointer; {all-purpose pointers}
! @!x: integer; {something undumped}
! @!w: four_quarters; {four ASCII codes}
  @y
! @p @t\4@>@<Declare the function called |open_fmt_file|@>@;
! function load_fmt_file:boolean;
! label bad_fmt,exit;
! var j,@!k:integer; {all-purpose indices}
! @!p,@!q: pointer; {all-purpose pointers}
! @!x: integer; {something undumped}
  @z
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--- 1498,1534 ----
  @z
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! % [47.1090] new horizontal command (TeX-XeT extension)
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! @x 
!    vmode+ex_space:@t@>@;@/
  @y
!    vmode+ex_space,vmode+LR:@t@>@;@/
  @z
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! % [48.1196] math in text is L-text (TeX-XeT extension)
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! @x 
! begin tail_append(new_math(math_surround,before));
  @y
! begin tail_append(new_math(math_surround,before));
! @<Append a |begin_L| to the tail of the current list@>;
  @z
+ @x (module 1196, continued)
+ tail_append(new_math(math_surround,after));
+ @y
+ @<Append an |end_L| to the tail of the current list@>;
+ tail_append(new_math(math_surround,after));
+ @z
  
! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! % [49.1275] a_open_in of \read file needs path specifier
! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  @x
!   if a_open_in(read_file[n]) then read_open[n]:=just_open;
  @y
!   if a_open_in(read_file[n],read_path_spec) then read_open[n]:=just_open;
  @z
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
***************
*** 1752,1760 ****
  @z
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! % [54.1376] add editor-switch variables to globals
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! @x
  This section should be replaced, if necessary, by changes to the program
  that are necessary to make \TeX\ work at a particular installation.
  It is usually best to design your change file so that all changes to
--- 1928,2036 ----
  @z
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! % [53.1341] whatsit processing (TeX-XeT extension)
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! @x 
! @d special_node=3 {|subtype| in whatsits that represent \.{\\special} things}
! @y
! @d special_node=3 {|subtype| in whatsits that represent \.{\\special} things}
! @d LR_node=4 {|subtype| in whatsits that represent \.{\\beginL}, etc.}
! @d LR_type(#)==mem[#+1].int {the sub-subtype}
! @z
! 
! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! % [53.1344] whatsit processing continued (TeX-XeT extension)
! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! @x 
! @d immediate_code=4 {command modifier for \.{\\immediate}}
! 
! @<Put each...@>=
! @y
! @d immediate_code=4 {command modifier for \.{\\immediate}}
! @d begin_L_code=0 {command modifier for \.{\\beginL}}
! @d begin_R_code=1 {command modifier for \.{\\beginR}}
! @d end_L_code=2 {command modifier for \.{\\endL}}
! @d end_R_code=3 {command modifier for \.{\\endR}}
! @d begin_LR(#)==(LR_type(#)<end_L_code)
! @d begin_LR_type(#)==(LR_type(#)-end_L_code)
! 
! @<Put each...@>=
! primitive("beginL",LR,begin_L_code);@/
! @!@:begin_L_}{\.{\\beginL} primitive@>
! primitive("beginR",LR,begin_R_code);@/
! @!@:begin_R_}{\.{\\beginR} primitive@>
! primitive("endL",LR,end_L_code);@/
! @!@:end_L_}{\.{\\endL} primitive@>
! primitive("endR",LR,end_R_code);@/
! @!@:end_R_}{\.{\\endR} primitive@>
! @z
! 
! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! % [53.1346] whatsit processing continued (TeX-XeT extension)
! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! @x (module 1346)
! @ @<Cases of |print_cmd_chr|...@>=
! @y
! @ @<Cases of |print_cmd_chr|...@>=
! LR: case chr_code of
! begin_L_code: print_esc("beginL");
! begin_R_code: print_esc("beginR");
! end_L_code: print_esc("endL");
! othercases print_esc("endR")
! endcases;
! @z
! 
! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! % [53.1356] whatsit processing continued (TeX-XeT extension)
! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! @x (module 1356)
! othercases print("whatsit?")
! @y
! LR_node: case LR_type(p) of
! begin_L_code: print_esc("beginL");
! begin_R_code: print_esc("beginR");
! end_L_code: print_esc("endL");
! othercases print_esc("endR")
! endcases;
! othercases print("whatsit?")
! @z
! @x (module 1357)
! close_node: begin r:=get_node(small_node_size); words:=small_node_size;
! @y
! close_node,LR_node: begin r:=get_node(small_node_size); words:=small_node_size;
! @z
! @x (module 1358)
! close_node: free_node(p,small_node_size);
! @y
! close_node,LR_node: free_node(p,small_node_size);
! @z
! 
! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! % [53.1360] whatsit processing continued (TeX-XeT extension)
! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! @x (module 1360)
! @ @<Incorporate a whatsit node into an hbox@>=do_nothing
! @y
! @ @<Incorporate a whatsit node into an hbox@>=
! if subtype(p)=LR_node then @<Adjust the LR stack for the |hpack| routine@>
! @z
! 
! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! % [53.1366] whatsit processing continued (TeX-XeT extension)
! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! @x (module 1366)
! @ @<Output the whatsit node |p| in an hlist@>=
! out_what(p)
! @y
! @ @<Output the whatsit node |p| in an hlist@>=
! if subtype(p)<>LR_node then out_what(p)
! else @<Output a reflection instruction if the direction has changed@>
! @z
! 
! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! % [54.1376] add TeX-XeT extensions 
! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! @x Final system-dependent changes: [1376]
  This section should be replaced, if necessary, by changes to the program
  that are necessary to make \TeX\ work at a particular installation.
  It is usually best to design your change file so that all changes to
***************
*** 1764,1769 ****
--- 2040,2159 ----
  itself will get a new section number.
  @^system dependencies@>
  @y
+ Now we do the main work required for mixed-direction texts.
+ 
+ @<Cases of |main_control| that build...@>=
+ hmode+LR: begin new_whatsit(LR_node,small_node_size); LR_type(tail):=cur_chr;
+   end;
+ mmode+LR: report_illegal_case;
+ 
+ @ @<Glob...@>=
+ @!LR_ptr,@!LR_tmp:pointer; {stack of LR codes and temp for manipulation}
+ 
+ @ @<Declare functions needed for special kinds of nodes@>=
+ function new_LR(@!s:small_number): pointer;
+ var p: pointer; {the new node}
+ begin p:=get_node(small_node_size); type(p):=whatsit_node; subtype(p):=LR_node;
+ LR_type(p):=s; new_LR:=p;
+ end;
+ 
+ @ @<Declare functions needed for special kinds of nodes@>=
+ function safe_info(@!p:pointer): integer;
+ begin if p=null then safe_info:=-1@+else safe_info:=info(p);
+ end;
+ 
+ @ @<Append a |begin_L| to the tail of the current list@>=
+ tail_append(new_LR(begin_L_code))
+ 
+ @ @<Append an |end_L| to the tail of the current list@>=
+ tail_append(new_LR(end_L_code))
+ 
+ @ A number of routines are based on a stack of one-word nodes whose |info|
+ fields contain either |begin_L_code| or |begin_R_code|. The top of the
+ stack is pointed to by |LR_ptr|, and an auxiliary variable |LR_tmp| is
+ available for stack manipulation.
+ 
+ @d push_LR(#)==begin LR_tmp:=get_avail; info(LR_tmp):=LR_type(#);
+   link(LR_tmp):=LR_ptr; LR_ptr:=LR_tmp;
+   end
+ @d pop_LR==begin LR_tmp:=LR_ptr; LR_ptr:=link(LR_tmp); free_avail(LR_tmp);
+   end
+ 
+ @<Flush the LR stack@>=while LR_ptr<>null do pop_LR
+ 
+ @ @<Insert LR nodes at the beginning of the current line@>=
+ while LR_ptr<>null do
+   begin LR_tmp:=new_LR(info(LR_ptr)); link(LR_tmp):=link(temp_head);
+   link(temp_head):=LR_tmp; pop_LR;
+   end
+ 
+ @ @<Adjust the LR stack based on LR nodes in this line@>=
+ q:=link(temp_head);
+ while q<>cur_break(cur_p) do
+   begin if not is_char_node(q) then if type(q)=whatsit_node then
+    if subtype(q)=LR_node then
+     if begin_LR(q) then push_LR(q)
+     else if LR_ptr<>null then
+      if info(LR_ptr)=begin_LR_type(q) then pop_LR;
+   q:=link(q);
+   end
+ 
+ @ We use the fact that |q| now points to the node with \.{\\rightskip} glue.
+ 
+ @<Insert LR nodes at the end of the current line@>=
+ if LR_ptr<>null then
+   begin s:=temp_head; r:=link(s);
+   while r<>q do
+     begin s:=r; r:=link(s);
+     end;
+   r:=LR_ptr;
+   while r<>null do
+     begin LR_tmp:=new_LR(info(r)+end_L_code);
+     link(s):=LR_tmp; s:=LR_tmp; r:=link(r);
+     end;
+   link(s):=q;
+   end
+ 
+ @ @<Adjust the LR stack for the |hpack| routine@>=
+ if begin_LR(p) then push_LR(p)
+ else if safe_info(LR_ptr)=begin_LR_type(p) then pop_LR
+ else  begin incr(LR_problems);
+   while link(q)<>p do q:=link(q);
+   link(q):=link(p); free_node(p,small_node_size); p:=q;
+   end
+ 
+ @ @<Check for LR anomalies at the end of |hpack|@>=
+ if LR_ptr<>null then
+   begin while link(q)<>null do q:=link(q);
+   repeat link(q):=new_LR(info(LR_ptr)+end_L_code); q:=link(q);
+   LR_problems:=LR_problems+10000; pop_LR;
+   until LR_ptr=null;
+   end;
+ if LR_problems>0 then
+   begin print_ln; print_nl("\endL or \endR problem (");@/
+   print_int(LR_problems div 10000); print(" missing, ");@/
+   print_int(LR_problems mod 10000); print(" extra");@/
+   LR_problems:=0; goto common_ending;
+   end
+ 
+ @ @<Output a reflection instruction if the direction has changed@>=
+ if begin_LR(p) then
+   begin if safe_info(LR_ptr)<>LR_type(p) then
+     begin synch_h; synch_v; dvi_out(begin_reflect);
+     end;
+   push_LR(p);
+   end
+ else if safe_info(LR_ptr)=begin_LR_type(p) then
+   begin pop_LR;
+   if info(LR_ptr)+end_L_code<>LR_type(p) then
+     begin synch_h; synch_v; dvi_out(end_reflect);
+     end;
+   end
+ else confusion("LR")
+ @:this can't happen LR}{\quad LR@>
+ 
+ @ Finally we get to a small addition that has nothing to do with LR nodes.
+ 
  Here is a temporary integer, used as a holder during reading and writing of
  TFM files, and a temporary memory_word, used in reading/writing format
  files.