summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/ptexdir/ptex-base.ch
diff options
context:
space:
mode:
authorHironobu Yamashita <h.y.acetaminophen@gmail.com>2019-02-06 11:00:54 +0000
committerHironobu Yamashita <h.y.acetaminophen@gmail.com>2019-02-06 11:00:54 +0000
commit9cd8661124409c76f10817e30328481ed3e02fea (patch)
treecec8974f9d2e24bd4e70301d1291e0aa204361d2 /Build/source/texk/web2c/ptexdir/ptex-base.ch
parentdecf7a7941406ca1f91ecd8456cefb033d45a5aa (diff)
inhibitglue (ptex and friends 4 of 5)
git-svn-id: svn://tug.org/texlive/trunk@49958 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/ptexdir/ptex-base.ch')
-rw-r--r--Build/source/texk/web2c/ptexdir/ptex-base.ch167
1 files changed, 108 insertions, 59 deletions
diff --git a/Build/source/texk/web2c/ptexdir/ptex-base.ch b/Build/source/texk/web2c/ptexdir/ptex-base.ch
index 9240bb9a1a6..bd850b61a73 100644
--- a/Build/source/texk/web2c/ptexdir/ptex-base.ch
+++ b/Build/source/texk/web2c/ptexdir/ptex-base.ch
@@ -1000,6 +1000,7 @@ kern_node,math_node,penalty_node: begin r:=get_node(small_node_size);
@!pdisp_field: scaled;
@!head_field,@!tail_field,@!pnode_field,@!last_jchr_field: pointer;
@!disp_called_field: boolean;
+ @!inhibit_glue_flag_field: integer;
@z
@x [16.213] l.4445 - pTeX: last_jchr, direction, adjust_dir, prev_{node,disp}
@@ -1014,6 +1015,7 @@ kern_node,math_node,penalty_node: begin r:=get_node(small_node_size);
@d prev_disp==cur_list.pdisp_field {displacemant at |prev_node|}
@d last_jchr==cur_list.last_jchr_field {final jchar node on current list}
@d disp_called==cur_list.disp_called_field {is a |disp_node| present in the current list?}
+@d inhibit_glue_flag==cur_list.inhibit_glue_flag_field {is \.{inhibitglue} is specified at the current list?}
@z
@x [16.214] l.4464 - pTeX: prev_append: disp_node
@@ -4044,6 +4046,17 @@ disp_node: begin link(p):=q; p:=q; q:=link(q); link(p):=null; goto done;
othercases confusion("mlist3")
@z
+@x [37.???] init_span: pTeX: init inhibit_glue_flag
+if mode=-hmode then space_factor:=1000
+else begin prev_depth:=ignore_depth; normal_paragraph;
+ end;
+@y
+if mode=-hmode then space_factor:=1000
+else begin prev_depth:=ignore_depth; normal_paragraph;
+ end;
+inhibit_glue_flag:=false;
+@z
+
@x [37.796] l.16276 - pTeX: call adjust_hlist
begin adjust_tail:=cur_tail; u:=hpack(link(head),natural); w:=width(u);
@y
@@ -4054,7 +4067,7 @@ othercases confusion("mlist3")
u:=hpack(link(head),natural); w:=width(u);
@z
-@x [37.799] l.16331 - pTeX: call adjust_hlist
+@x [37.799] l.16331 - fin_row: pTeX: call adjust_hlist
begin p:=hpack(link(head),natural);
@y
begin adjust_hlist(head,false);
@@ -4064,6 +4077,13 @@ othercases confusion("mlist3")
p:=hpack(link(head),natural);
@z
+@x [37.799] l.16331 - fin_row: init inhibit_glue_flag
+ link(tail):=p; tail:=p; space_factor:=1000;
+@y
+ link(tail):=p; tail:=p; space_factor:=1000;
+ inhibit_glue_flag:=false;
+@z
+
@x [37.800] l.16353 - pTeX: call adjust_hlist
var @!p,@!q,@!r,@!s,@!u,@!v: pointer; {registers for the list operations}
@y
@@ -4847,6 +4867,13 @@ else begin link(tail):=q; tail:=q;
end
@z
+@x [47.????] pTeX: reset inhibit_glue_flag at rule_node
+vmode+hrule,hmode+vrule,mmode+vrule: begin tail_append(scan_rule_spec);
+@y
+vmode+hrule,hmode+vrule,mmode+vrule: begin tail_append(scan_rule_spec);
+ inhibit_glue_flag := false;
+@z
+
@x [47.1060] pTeX: append_glue, inhibit_glue_flag
end; {now |cur_val| points to the glue specification}
tail_append(new_glue(cur_val));
@@ -4971,9 +4998,12 @@ q:pointer;
@z
@x [47.1076] pTeX: sub_exp_box
+ else begin if abs(mode)=hmode then space_factor:=1000
else begin p:=new_noad;
math_type(nucleus(p)):=sub_box;
@y
+ else begin if abs(mode)=hmode then
+ begin space_factor:=1000; inhibit_glue_flag:=false; end
else begin p:=new_noad;
math_type(nucleus(p)):=sub_exp_box;
@z
@@ -5004,7 +5034,7 @@ q:pointer;
end
@z
-@x [47.1079] l.20920 - pTeX: disp_node, adjust direction
+@x [47.1079] l.20920 begin_box - pTeX: disp_node, adjust direction
@!m:quarterword; {the length of a replacement list}
@y
@!r:pointer; {running behind |p|}
@@ -5126,6 +5156,12 @@ else begin if k=vmode then scan_spec(vbox_group,true)
push_nest; mode:=-k; adjust_dir:=a_dir;
@z
+@x [47.1083] reset inhibit_glue_flag
+else begin space_factor:=1000;
+@y
+else begin space_factor:=1000; inhibit_glue_flag:=false;
+@z
+
@x [47.1085] l.21031 - pTeX: end of box, call adjust_hlist
hbox_group: package(0);
adjusted_hbox_group: begin adjust_tail:=adjust_head; package(0);
@@ -5194,6 +5230,13 @@ push_nest; adjust_dir:=direction;
mode:=hmode; space_factor:=1000; set_cur_lang; clang:=cur_lang;
@z
+@x [47.???] indent_in_hmode: reset inhibit_glue_flag
+ if abs(mode)=hmode then space_factor:=1000
+@y
+ if abs(mode)=hmode then
+ begin space_factor:=1000; inhibit_glue_flag:=false; end
+@z
+
@x [47.1096] l.21155 - pTeX: end_graf, call adjust_hlist
begin if head=tail then pop_nest {null paragraphs are ignored}
else line_break(widow_penalty);
@@ -5203,10 +5246,11 @@ mode:=hmode; space_factor:=1000; set_cur_lang; clang:=cur_lang;
end;
@z
-@x [47.1099] l.21184 - pTeX: insert and adjust
+@x [47.1099] l.21184 begin_insert_or_adjust - pTeX: insert and adjust
new_save_level(insert_group); scan_left_brace; normal_paragraph;
push_nest; mode:=-vmode; prev_depth:=ignore_depth;
@y
+inhibit_glue_flag:=false;
new_save_level(insert_group); scan_left_brace; normal_paragraph;
push_nest; mode:=-vmode; direction:=adjust_dir; prev_depth:=ignore_depth;
@z
@@ -5266,9 +5310,10 @@ insert_group: begin end_graf; q:=split_top_skip; add_glue_ref(q);
end;
@z
-@x [47.1101] l.21214 - pTeX: mark_node, prev_append
+@x [47.1101] l.21214 make_mark - pTeX: mark_node, prev_append
mark_ptr(p):=def_ref; link(tail):=p; tail:=p;
@y
+inhibit_glue_flag:=false;
mark_ptr(p):=def_ref;
if not is_char_node(tail)and(type(tail)=disp_node) then
prev_append(p)
@@ -5283,6 +5328,7 @@ end;
@y
procedure append_penalty;
begin scan_int;
+ inhibit_glue_flag:=false;
if not is_char_node(tail)and(type(tail)=disp_node) then
prev_append(new_penalty(cur_val))
else tail_append(new_penalty(cur_val));
@@ -5327,7 +5373,7 @@ var p:pointer; {the box}
@!disp:scaled; {displacement}
@z
-@x [47.1110] l.21314 - pTeX: free box node, delete kanji_skip
+@x [47.1110] l.21314 unpackage - pTeX: free box node, delete kanji_skip
if (abs(mode)=mmode)or((abs(mode)=vmode)and(type(p)<>vlist_node))or@|
((abs(mode)=hmode)and(type(p)<>hlist_node)) then
begin print_err("Incompatible list can't be unboxed");
@@ -5376,28 +5422,38 @@ else
free_node(p,box_node_size);
end;
@z
+
@x [47.1110] l.22014 - pTeX: free box node, delete kanji_skip
while link(tail)<>null do tail:=link(tail);
@y
while link(tail)<>null do
+ {reset |inhibit_glue_flag| when a node other than |disp_node| is found;
+ |disp_node| is always inserted according to tex-jp-build issue 40}
begin p:=tail; tail:=link(tail);
- if not is_char_node(tail) then
+ if is_char_node(tail) then
+ inhibit_glue_flag:=false
+ else
case type(tail) of
- glue_node :
+ glue_node : begin
+ inhibit_glue_flag:=false;
if (subtype(tail)=kanji_skip_code+1)
or(subtype(tail)=xkanji_skip_code+1) then
begin link(p):=link(tail);
delete_glue_ref(glue_ptr(tail));
free_node(tail,small_node_size); tail:=p;
end;
- penalty_node :
+ end;
+ penalty_node : begin
+ inhibit_glue_flag:=false;
if subtype(tail)=widow_pena then
begin link(p):=link(tail); free_node(tail,small_node_size);
tail:=p;
end;
+ end;
disp_node :
begin prev_disp:=disp; disp:=disp_dimen(tail); prev_node:=p;
end;
+ othercases inhibit_glue_flag:=false;
endcases;
end;
@z
@@ -5441,6 +5497,16 @@ begin if tail<>head then
end;
@z
+@x [47.????] pTeX: reset inhibit_glue_flag at disc_node
+procedure append_discretionary;
+var c:integer; {hyphen character}
+begin tail_append(new_disc);
+@y
+procedure append_discretionary;
+var c:integer; {hyphen character}
+begin tail_append(new_disc); inhibit_glue_flag:=false;
+@z
+
@x pTeX: direction check in \discretionary
@!n:integer; {length of discretionary list}
@y
@@ -5470,6 +5536,12 @@ case saved(-1) of
end;
@z
+@x pTeX: reset inhibit_glue_flag
+push_nest; mode:=-hmode; space_factor:=1000;
+@y
+push_nest; mode:=-hmode; space_factor:=1000; inhibit_glue_flag:=false;
+@z
+
@x pTeX: direction check in \discretionary
else link(tail):=p;
if n<=max_quarterword then replace_count(tail):=n
@@ -5538,7 +5610,7 @@ else begin f:=cur_font; p:=new_character(f,cur_val);
link(tail):=p;
if link(p)<>null then tail:=link(p) else tail:=p;
@<Append |disp_node| at end of displace area@>;
- space_factor:=1000;
+ space_factor:=1000; inhibit_glue_flag:=false;
@z
@x [47.1124] l.22180 - pTeX: make_accent Kanji, insert disp_node
@@ -5754,7 +5826,6 @@ mmode+char_num: begin scan_char_num; cur_chr:=cur_val;
help1("IGNORE.");@/
error;
end;
- inhibit_glue_flag:=false;
@z
@x [48.1158] l.22690 - pTeX: scan_math
@@ -5776,14 +5847,6 @@ scan_math(nucleus(tail));
scan_math(nucleus(tail),kcode_noad(tail));
@z
-@x [48.1167] pTeX: vcenter, inhibit_glue_flag
-mmode+vcenter: begin scan_spec(vcenter_group,false); normal_paragraph;
-@y
-mmode+vcenter: begin
- scan_spec(vcenter_group,false); normal_paragraph;
- inhibit_glue_flag:=false;
-@z
-
@x [48.1164] l.22790 - pTeX: vcenter : dir
vcenter_group: begin end_graf; unsave; save_ptr:=save_ptr-2;
p:=vpack(link(head),saved(1),saved(0)); pop_nest;
@@ -5800,31 +5863,12 @@ vcenter_group: begin end_graf; unsave; save_ptr:=save_ptr-2;
end;
@z
-@x [48.1176] pTeX: sub_sup, inhibit_glue_flag
-procedure sub_sup;
-var t:small_number; {type of previous sub/superscript}
-@!p:pointer; {field to be filled by |scan_math|}
-begin t:=empty; p:=null;
-@y
-procedure sub_sup;
-var t:small_number; {type of previous sub/superscript}
-@!p:pointer; {field to be filled by |scan_math|}
-begin t:=empty; p:=null;
-inhibit_glue_flag:=false;
-@z
-
@x [48.1176] l.22864 - pTeX: scan_math
scan_math(p);
@y
scan_math(p,null);
@z
-@x [48.1181] pTeX: math_fraction, inhibit_glue_flag
-begin c:=cur_chr;
-@y
-begin c:=cur_chr; inhibit_glue_flag:=false;
-@z
-
@x [48.1186] l.23006 - pTeX: copy kanji code
if math_type(supscr(p))=empty then
begin mem[saved(0)].hh:=mem[nucleus(p)].hh;
@@ -5833,12 +5877,6 @@ begin c:=cur_chr; inhibit_glue_flag:=false;
begin mem[saved(0)].hh:=mem[nucleus(p)].hh;
@z
-@x [48.1191] pTeX: math_left_right, inhibit_glue_flag
-begin t:=cur_chr;
-@y
-begin t:=cur_chr; inhibit_glue_flag:=false;
-@z
-
@x [48.1194] l.23078 - pTeX: set cur_kanji_skip, cur_xkanji_skip
var l:boolean; {`\.{\\leqno}' instead of `\.{\\eqno}'}
@y
@@ -5876,14 +5914,14 @@ link(tail):=link(temp_head);
while link(tail)<>null do tail:=link(tail);
tail_append(new_math(math_surround,after));
@<Append |disp_node| at end of displace area@>;
-space_factor:=1000; unsave;
+space_factor:=1000; inhibit_glue_flag:=false; unsave;
end
@z
@x [48.1200] l.23203 - pTeX: adjust direction
push_nest; mode:=hmode; space_factor:=1000; set_cur_lang; clang:=cur_lang;
@y
-push_nest; adjust_dir:=direction;
+push_nest; adjust_dir:=direction; inhibit_glue_flag:=false;
mode:=hmode; space_factor:=1000; set_cur_lang; clang:=cur_lang;
@z
@@ -6251,6 +6289,15 @@ undump_things(char_base[null_font], font_ptr+1-null_font);
ctype_base[null_font]:=0; char_base[null_font]:=0; width_base[null_font]:=0;
@z
+@x [53.????] do_extension, inhibit_glue_flag
+begin case cur_chr of
+open_node:@<Implement \.{\\openout}@>;
+@y
+begin inhibit_glue_flag:=false;
+case cur_chr of
+open_node:@<Implement \.{\\openout}@>;
+@z
+
@x [53.1376] l.26309 - pTeX:
@<Glob...@> =
@!debug_format_file: boolean;
@@ -6419,23 +6466,20 @@ inserting a space between 2byte-char and 1byte-char.
@d new_pos=0
@d cur_pos=1
-@<Global...@>=
- inhibit_glue_flag:boolean;
-
-@ @<Set init...@>=
- inhibit_glue_flag:=false;
-
@ @<Cases of |main_control| that don't...@>=
- any_mode(inhibit_glue): inhibit_glue_flag:=true;
+ any_mode(inhibit_glue): inhibit_glue_flag:=(cur_chr=0);
@ @<Put each...@>=
primitive("inhibitglue",inhibit_glue,0);
@!@:inhibit_glue_}{\.{\\inhibitglue} primitive@>
+primitive("disinhibitglue",inhibit_glue,1);
+@!@:dis_inhibit_glue_}{\.{\\disinhibitglue} primitive@>
primitive("inhibitxspcode",assign_inhibit_xsp_code,inhibit_xsp_code_base);
@!@:inhibit_xsp_code_}{\.{\\inhibitxspcode} primitive@>
@ @<Cases of |print_cmd_chr|...@>=
-inhibit_glue: print_esc("inhibitglue");
+inhibit_glue: if (chr_code>0) then print_esc("disinhibitglue")
+ else print_esc("inhibitglue");
assign_inhibit_xsp_code: print_esc("inhibitxspcode");
@ @<Declare procedures needed in |scan_something_internal|@>=
@@ -7121,7 +7165,6 @@ written in section 48.
procedure set_math_kchar(@!c:integer);
var p:pointer; {the new noad}
begin p:=new_noad; math_type(nucleus(p)):=math_jchar;
-inhibit_glue_flag:=false;
character(nucleus(p)):=qi(0);
math_kcode(p):=c; fam(nucleus(p)):=cur_jfam;
if font_dir[fam_fnt(fam(nucleus(p))+cur_size)]=dir_default then
@@ -7201,9 +7244,9 @@ again_2:
end
else cur_l:=qi(get_jfm_pos(KANJI(cur_chr),main_f));
end;
- inhibit_glue: begin inhibit_glue_flag:=true; goto again_2; end;
+ inhibit_glue: begin inhibit_glue_flag:=(cur_chr=0); goto again_2; end;
othercases begin ins_kp:=max_halfword;
- cur_l:=qi(0); cur_r:=non_char; lig_stack:=null;
+ cur_l:=qi(-1); cur_r:=non_char; lig_stack:=null;
end;
endcases;
@#
@@ -7253,7 +7296,9 @@ end;
@ @<Look ahead for glue or kerning@>=
cur_q:=tail;
if inhibit_glue_flag<>true then
- begin if (tail=link(head))and(not is_char_node(tail))and(type(tail)=disp_node) then
+ begin { print("IF");print_int(cur_l); }
+ if cur_l<qi(0) then cur_l:=qi(0) else inhibit_glue_flag:=false;
+ if (tail=link(head))and(not is_char_node(tail))and(type(tail)=disp_node) then
goto skip_loop
else begin if char_tag(main_i)=gk_tag then
begin main_k:=glue_kern_start(main_f)(main_i);
@@ -7297,8 +7342,12 @@ if inhibit_glue_flag<>true then
end;
end;
end;
-end;
-skip_loop: inhibit_glue_flag:=false;
+end
+else
+ begin { print("IT");print_int(cur_l); }
+ if cur_l<qi(0) then cur_l:=qi(0) else inhibit_glue_flag:=false;
+ end;
+skip_loop: do_nothing;
@ @<Basic printing...@>=
procedure print_kanji(@!s:KANJI_code); {prints a single character}