diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2017-09-24 04:09:46 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2017-09-24 04:09:46 +0000 |
commit | 5c36658dc607c1565a19a064dfe2733e7f56902c (patch) | |
tree | 2c2cc4f03a9423a4e54ede7bc58e4a267587215a | |
parent | a9ea55e5c48336cba5dda436578adb0e28731701 (diff) |
pdftex.web, xetex.web: Avoid overwriting prim_* entries by primitive() (H. Kitagawa)
git-svn-id: svn://tug.org/texlive/trunk@45394 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/ChangeLog | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/pdftex.web | 48 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/ChangeLog | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/xetex.web | 47 |
4 files changed, 59 insertions, 44 deletions
diff --git a/Build/source/texk/web2c/pdftexdir/ChangeLog b/Build/source/texk/web2c/pdftexdir/ChangeLog index 8ecdff2ce2b..33d873d8f80 100644 --- a/Build/source/texk/web2c/pdftexdir/ChangeLog +++ b/Build/source/texk/web2c/pdftexdir/ChangeLog @@ -1,3 +1,7 @@ +2017-09-24 Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp> + + * pdxtex.web: Avoid overwriting prim_* entries by primitive(). + 2017-09-14 Akira Kakuto <kakuto@fuk.kindai.ac.jp> * pdftosrc.cc: Fix a potential bug which I introduced on diff --git a/Build/source/texk/web2c/pdftexdir/pdftex.web b/Build/source/texk/web2c/pdftexdir/pdftex.web index a00d8d408ac..76b8109f4e9 100644 --- a/Build/source/texk/web2c/pdftexdir/pdftex.web +++ b/Build/source/texk/web2c/pdftexdir/pdftex.web @@ -6459,7 +6459,7 @@ A global boolean variable called |no_new_control_sequence| is set to @d prim_prime=1777 {about 85\pct! of |primitive_size|} @d prim_base=1 @d prim_next(#) == prim[#].lh {link for coalesced lists} -@d prim_text(#) == prim[#].rh {string number for control sequence name} +@d prim_text(#) == prim[#].rh {string number for control sequence name, plus one} @d prim_is_full == (prim_used=prim_base) {test if all positions are occupied} @d prim_eq_level_field(#)==#.hh.b1 @d prim_eq_type_field(#)==#.hh.b0 @@ -6468,6 +6468,7 @@ A global boolean variable called |no_new_control_sequence| is set to @d prim_eq_type(#)==prim_eq_type_field(prim_eqtb[#]) {command code for equivalent} @d prim_equiv(#)==prim_equiv_field(prim_eqtb[#]) {equivalent value} @d undefined_primitive=0 +@d biggest_char=255 { 65535 in XeTeX } @<Glob...@>= @!prim: array [0..prim_size] of two_halves; {the primitives table} @@ -6566,27 +6567,30 @@ var h:integer; {hash code} @!k:pointer; {index in string pool} @!j,@!l:integer; begin -if s<256 then begin - p := s; - if (p<0) or (prim_eq_level(p)<>level_one) then - p := undefined_primitive; -end +if s<=biggest_char then begin + if s<0 then begin p:=undefined_primitive; goto found; end + else p:=(s mod prim_prime)+prim_base; {we start searching here} + end else begin j:=str_start[s]; if s = str_ptr then l := cur_length else l := length(s); @<Compute the primitive code |h|@>; - p:=h+prim_base; {we start searching here; note that |0<=h<hash_prime|} - loop@+begin if prim_text(p)>0 then if length(prim_text(p))=l then - if str_eq_str(prim_text(p),s) then goto found; - if prim_next(p)=0 then - begin if no_new_control_sequence then - p:=undefined_primitive - else @<Insert a new primitive after |p|, then make - |p| point to it@>; - goto found; - end; - p:=prim_next(p); + p:=h+prim_base; {we start searching here; note that |0<=h<prim_prime|} + end; +loop@+begin + if prim_text(p)>1+biggest_char then { |p| points a multi-letter primitive } + begin if length(prim_text(p)-1)=l then + if str_eq_str(prim_text(p)-1,s) then goto found; + end + else if prim_text(p)=1+s then goto found; { |p| points a single-letter primitive } + if prim_next(p)=0 then + begin if no_new_control_sequence then + p:=undefined_primitive + else @<Insert a new primitive after |p|, then make + |p| point to it@>; + goto found; end; + p:=prim_next(p); end; found: prim_lookup:=p; end; @@ -6599,7 +6603,7 @@ begin if prim_text(p)>0 then until prim_text(prim_used)=0; {search for an empty location in |prim|} prim_next(p):=prim_used; p:=prim_used; end; -prim_text(p):=s; +prim_text(p):=s+1; end @ The value of |prim_prime| should be roughly 85\pct! of @@ -6669,7 +6673,7 @@ var k:pool_pointer; {index into |str_pool|} @!prim_val:integer; {needed to fill |prim_eqtb|} begin if s<256 then begin cur_val:=s+single_base; - prim_val:=s; + prim_val:=prim_lookup(s); end else begin k:=str_start[s]; l:=str_start[s+1]-k; {we will move |s| into the (possibly non-empty) |buffer|} @@ -8918,7 +8922,7 @@ temporary file. begin save_scanner_status := scanner_status; scanner_status:=normal; get_token; scanner_status:=save_scanner_status; if cur_cs < hash_base then - cur_cs := prim_lookup(cur_cs-257) + cur_cs := prim_lookup(cur_cs-single_base) else cur_cs := prim_lookup(text(cur_cs)); if cur_cs<>undefined_primitive then begin @@ -11802,7 +11806,7 @@ if_pdfprimitive_code: begin get_next; scanner_status:=save_scanner_status; if cur_cs < hash_base then - m := prim_lookup(cur_cs-257) + m := prim_lookup(cur_cs-single_base) else m := prim_lookup(text(cur_cs)); b :=((cur_cmd<>undefined_cs) and @@ -28797,7 +28801,7 @@ any_mode(ignore_spaces): begin get_next; scanner_status:=t; if cur_cs < hash_base then - cur_cs := prim_lookup(cur_cs-257) + cur_cs := prim_lookup(cur_cs-single_base) else cur_cs := prim_lookup(text(cur_cs)); if cur_cs<>undefined_primitive then begin diff --git a/Build/source/texk/web2c/xetexdir/ChangeLog b/Build/source/texk/web2c/xetexdir/ChangeLog index d937561b22b..3e8fec002fc 100644 --- a/Build/source/texk/web2c/xetexdir/ChangeLog +++ b/Build/source/texk/web2c/xetexdir/ChangeLog @@ -1,3 +1,7 @@ +2017-09-24 Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp> + + * xetex.web: Avoid overwriting prim_* entries by primitive(). + 2017-09-05 Karl Berry <karl@tug.org> and Akira Kakuto <kakuto@fuk.kindai.ac.jp> diff --git a/Build/source/texk/web2c/xetexdir/xetex.web b/Build/source/texk/web2c/xetexdir/xetex.web index 51e8a055919..37e2cb3d038 100644 --- a/Build/source/texk/web2c/xetexdir/xetex.web +++ b/Build/source/texk/web2c/xetexdir/xetex.web @@ -6074,7 +6074,7 @@ A global boolean variable called |no_new_control_sequence| is set to @d prim_prime=431 {about 85\pct! of |primitive_size|} @d prim_base=1 @d prim_next(#) == prim[#].lh {link for coalesced lists} -@d prim_text(#) == prim[#].rh {string number for control sequence name} +@d prim_text(#) == prim[#].rh {string number for control sequence name, plus one} @d prim_is_full == (prim_used=prim_base) {test if all positions are occupied} @d prim_eq_level_field(#)==#.hh.b1 @d prim_eq_type_field(#)==#.hh.b0 @@ -6190,27 +6190,30 @@ var h:integer; {hash code} @!k:pointer; {index in string pool} @!j,@!l:integer; begin -if s<256 then begin - p:=s; - if (p<0) or (prim_eq_level(p)<>level_one) then - p:=undefined_primitive; -end +if s<=biggest_char then begin + if s<0 then begin p:=undefined_primitive; goto found; end + else p:=(s mod prim_prime)+prim_base; {we start searching here} + end else begin j:=str_start_macro(s); if s = str_ptr then l:=cur_length else l:=length(s); @<Compute the primitive code |h|@>; - p:=h+prim_base; {we start searching here; note that |0<=h<hash_prime|} - loop@+begin if prim_text(p)>0 then if length(prim_text(p))=l then - if str_eq_str(prim_text(p),s) then goto found; - if prim_next(p)=0 then - begin if no_new_control_sequence then - p:=undefined_primitive - else @<Insert a new primitive after |p|, then make - |p| point to it@>; - goto found; - end; - p:=prim_next(p); + p:=h+prim_base; {we start searching here; note that |0<=h<prim_prime|} + end; +loop@+begin + if prim_text(p)>1+biggest_char then { |p| points a multi-letter primitive } + begin if length(prim_text(p)-1)=l then + if str_eq_str(prim_text(p)-1,s) then goto found; + end + else if prim_text(p)=1+s then goto found; { |p| points a single-letter primitive } + if prim_next(p)=0 then + begin if no_new_control_sequence then + p:=undefined_primitive + else @<Insert a new primitive after |p|, then make + |p| point to it@>; + goto found; end; + p:=prim_next(p); end; found: prim_lookup:=p; end; @@ -6223,7 +6226,7 @@ begin if prim_text(p)>0 then until prim_text(prim_used)=0; {search for an empty location in |prim|} prim_next(p):=prim_used; p:=prim_used; end; -prim_text(p):=s; +prim_text(p):=s+1; end @ The value of |prim_prime| should be roughly 85\pct! of @@ -6292,7 +6295,7 @@ var k:pool_pointer; {index into |str_pool|} @!prim_val:integer; {needed to fill |prim_eqtb|} begin if s<256 then begin cur_val:=s+single_base; - prim_val:=s; + prim_val:=prim_lookup(s); end else begin k:=str_start_macro(s); l:=str_start_macro(s+1)-k; {we will move |s| into the (possibly non-empty) |buffer|} @@ -8633,7 +8636,7 @@ temporary file. begin save_scanner_status:=scanner_status; scanner_status:=normal; get_token; scanner_status:=save_scanner_status; if cur_cs < hash_base then - cur_cs:=prim_lookup(cur_cs-257) + cur_cs:=prim_lookup(cur_cs-single_base) else cur_cs:=prim_lookup(text(cur_cs)); if cur_cs<>undefined_primitive then begin @@ -11175,7 +11178,7 @@ if_primitive_code: begin get_next; scanner_status:=save_scanner_status; if cur_cs < hash_base then - m:=prim_lookup(cur_cs-257) + m:=prim_lookup(cur_cs-single_base) else m:=prim_lookup(text(cur_cs)); b :=((cur_cmd<>undefined_cs) and @@ -24069,7 +24072,7 @@ any_mode(ignore_spaces): begin get_next; scanner_status:=t; if cur_cs < hash_base then - cur_cs:=prim_lookup(cur_cs-257) + cur_cs:=prim_lookup(cur_cs-single_base) else cur_cs :=prim_lookup(text(cur_cs)); if cur_cs<>undefined_primitive then begin |