pdftex[861] branches/stable/source/src/texk/web2c: missed

commits+karl at tug.org commits+karl at tug.org
Sat Aug 21 23:51:57 CEST 2021


Revision: 861
          http://tug.org/svn/pdftex?view=revision&revision=861
Author:   karl
Date:     2021-08-21 23:51:57 +0200 (Sat, 21 Aug 2021)
Log Message:
-----------
missed partoken*.ch

Added Paths:
-----------
    branches/stable/source/src/texk/web2c/partoken-102.ch
    branches/stable/source/src/texk/web2c/partoken.ch

Added: branches/stable/source/src/texk/web2c/partoken-102.ch
===================================================================
--- branches/stable/source/src/texk/web2c/partoken-102.ch	                        (rev 0)
+++ branches/stable/source/src/texk/web2c/partoken-102.ch	2021-08-21 21:51:57 UTC (rev 861)
@@ -0,0 +1,14 @@
+% $Id: partoken-102.ch 60054 2021-07-25 16:07:35Z karl $
+% Public domain. See partoken.ch (and pdfTeX manual) for main information.
+
+% New internal constant for the main command |\partokenname|.
+% This redefinition of max_command varies, but the rest of the change
+% file works across all engines, so separate it out. This version is
+% used for pdftex and xetex. For the pTeX family, the max_command update
+% is done in the main change files (ptex-base.ch and uptex-m.ch).
+ at x
+ at d max_command=102 {the largest command code seen at |big_switch|}
+ at y
+ at d partoken_name=103 {set |par_token| name}
+ at d max_command=103 {the largest command code seen at |big_switch|}
+ at z


Property changes on: branches/stable/source/src/texk/web2c/partoken-102.ch
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: branches/stable/source/src/texk/web2c/partoken.ch
===================================================================
--- branches/stable/source/src/texk/web2c/partoken.ch	                        (rev 0)
+++ branches/stable/source/src/texk/web2c/partoken.ch	2021-08-21 21:51:57 UTC (rev 861)
@@ -0,0 +1,175 @@
+% $Id: partoken.ch 60088 2021-07-27 01:25:13Z karl $
+% Implementation of |\partokenname| and |\partokencontext| primitives.
+% Public domain. Originally written by Petr Olsak, 2021.
+
+% TeX inserts (let's say) "par-token" at empty lines and in other situations.
+% The primitive meaning of "par-token" is (let's say) "end-paragraph",
+%   but it can be changed by the macro programmer (by |\def\par|, for example).
+% The name of the auto-emitted "par-token" is fixed as |\par| in
+%   classical TeX. 
+% The new |\partokenname| primitive defined here allows changing this cs name.
+% After |\partokenname <control-sequence>| is given, the specified
+%   <control-sequence> will be emitted at empty lines, etc., not |\par|. 
+% Moreover, the given <control-sequence> plays the role of |\par| when
+%   processing not-\long macros ("runaway error").
+% The setting of |\partokenname| is global.
+%
+% The integer register |\partokencontext| allows controlling the places where
+% "par-token" is auto-emitted. The value of |\partokencontext| can be:
+%   0 ... "par-token" is emitted as in classical TeX, i.e. at empty lines,
+%         before \end, \vskip, \hrule, \unvbox, and \halign (if horizontal mode
+%         is current) and in several error recovery situations.
+%         This is the default value.
+%   1 ... "par-token" is emitted as before and at the end of \vbox,
+%         \vtop, and \vcenter if horizontal mode is current here.
+%   2 ... "par-token" is emitted as before and at the end of \noalign,
+%         \vadjust, \output, \insert, and \valign items, if horizontal
+%         mode is current here.
+% Classical TeX does a direct call of the "end-paragraph" routine at the
+% places mentioned in cases 1 and 2.
+% 
+% See the user documentation in the pdftex manual for more,
+% the tests/partoken-test.tex file for basic examples,
+% and the OpTeX format (eventually) for the practical case inspiring
+% this idea.
+
+% New internal constant for integer register |\partokencontext|
+ at x
+ at d web2c_int_pars=web2c_int_base+4 {total number of web2c's integer parameters}
+ at y
+ at d partoken_context_code=web2c_int_base+4 {controlling where |partoken| inserted}
+ at d web2c_int_pars=web2c_int_base+5 {total number of web2c's integer parameters}
+ at z
+
+% Allocation of integer register |\partokencontext|
+ at x
+ at d tracing_stack_levels==int_par(tracing_stack_levels_code)
+ at y
+ at d tracing_stack_levels==int_par(tracing_stack_levels_code)
+ at d partoken_context==int_par(partoken_context_code)
+ at z
+
+% Printing |\show\partokencontext|
+ at x
+tracing_stack_levels_code:print_esc("tracingstacklevels");
+ at y
+tracing_stack_levels_code:print_esc("tracingstacklevels");
+partoken_context_code:print_esc("partokencontext");
+ at z
+
+% Declaration of primitives |\partokenname| and |\partokencontext|
+ at x
+  primitive("tracingstacklevels",assign_int,int_base+tracing_stack_levels_code);@/
+@!@:tracing_stack_levels_}{\.{\\tracingstacklevels} primitive@>
+ at y
+  primitive("tracingstacklevels",assign_int,int_base+tracing_stack_levels_code);@/
+@!@:tracing_stack_levels_}{\.{\\tracingstacklevels} primitive@>
+  primitive("partokenname",partoken_name,0);@/
+@!@:partoken_name_}{\.{\\partokenname} primitive@>
+  primitive("partokencontext",assign_int,int_base+partoken_context_code);@/
+@!@:partoken_context_}{\.{\\partokencontext} primitive@>
+ at z
+
+% Printing |\show\partokenname|
+ at x
+vrule: print_esc("vrule");
+ at y
+vrule: print_esc("vrule");
+partoken_name: print_esc("partokenname");
+ at z
+
+% End of |\vbox| and |\vtop|
+ at x
+vbox_group: begin end_graf; package(0);
+  end;
+vtop_group: begin end_graf; package(vtop_code);
+  end;
+ at y
+vbox_group: if (partoken_context>0) and (mode=hmode) then 
+  begin
+     back_input; cur_tok := par_token; back_input; token_type := inserted;
+  end
+  else  begin end_graf; package(0); end;
+vtop_group: if (partoken_context>0) and (mode=hmode) then
+  begin
+     back_input; cur_tok := par_token; back_input; token_type := inserted;
+  end 
+  else begin end_graf; package(vtop_code); end;
+ at z
+
+% End of |\insert| or |\vadjust|
+ at x
+insert_group: begin end_graf; q:=split_top_skip; add_glue_ref(q);
+ at y
+insert_group: if (partoken_context>1) and (mode=hmode) then
+  begin
+     back_input; cur_tok := par_token; back_input; token_type := inserted;
+  end 
+  else begin end_graf; q:=split_top_skip; add_glue_ref(q);
+ at z
+
+% End of |\output|
+ at x
+output_group: @<Resume the page builder...@>;
+ at y
+output_group: if (partoken_context>1) and (mode=hmode) then
+  begin
+     back_input; cur_tok := par_token; back_input; token_type := inserted;
+  end 
+  else @<Resume the page builder...@>;
+ at z
+
+% End of item in |\valign|
+ at x
+vmode+endv,hmode+endv: do_endv;
+ at y
+vmode+endv,hmode+endv: if (partoken_context>1) and (mode=hmode) then
+  begin
+     back_input; cur_tok := par_token; back_input; token_type := inserted;
+  end
+  else do_endv;
+ at z
+
+% End of |\noalign| in |\halign|
+ at x
+no_align_group: begin end_graf; unsave; align_peek;
+  end;
+ at y
+no_align_group: if (partoken_context>1) and (mode=hmode) then
+  begin
+     back_input; cur_tok := par_token; back_input; token_type := inserted;
+  end 
+  else begin end_graf; unsave; align_peek;
+  end;
+ at z
+
+% End of |\vcenter|
+ at x
+vcenter_group: begin end_graf; unsave; save_ptr:=save_ptr-2;
+ at y
+vcenter_group: if (partoken_context>0) and (mode=hmode) then 
+  begin
+     back_input; cur_tok := par_token; back_input; token_type := inserted;
+  end else begin end_graf; unsave; save_ptr:=save_ptr-2;
+ at z
+
+% Setting new name of the |par-token|
+ at x
+any_mode(after_group):begin get_token; save_for_after(cur_tok);
+  end;
+ at y
+any_mode(after_group):begin get_token; save_for_after(cur_tok);
+  end;
+any_mode(partoken_name):begin get_token;
+  if cur_cs > 0 then begin
+     par_loc := cur_cs; par_token := cur_tok;
+     end; 
+  end;
+ at z
+
+% Undump |par-token| from the format
+ at x
+undump(hash_base)(hash_top)(par_loc);
+ at y
+undump_int(par_loc);
+ at z


Property changes on: branches/stable/source/src/texk/web2c/partoken.ch
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property


More information about the pdftex-commits mailing list.