texlive[46526] Build/source/texk/web2c: xetexdir: sync with the
commits+hironobu at tug.org
commits+hironobu at tug.org
Sat Feb 3 12:18:36 CET 2018
Revision: 46526
http://tug.org/svn/texlive?view=revision&revision=46526
Author: hironobu
Date: 2018-02-03 12:18:35 +0100 (Sat, 03 Feb 2018)
Log Message:
-----------
xetexdir: sync with the upstream [acfb33c] (version 0.99999)
Modified Paths:
--------------
trunk/Build/source/texk/web2c/lib/texmfmp.c
trunk/Build/source/texk/web2c/texmfmp.h
trunk/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
trunk/Build/source/texk/web2c/xetexdir/XeTeX_ext.h
trunk/Build/source/texk/web2c/xetexdir/xetex.ch
trunk/Build/source/texk/web2c/xetexdir/xetex.web
Modified: trunk/Build/source/texk/web2c/lib/texmfmp.c
===================================================================
--- trunk/Build/source/texk/web2c/lib/texmfmp.c 2018-02-03 01:17:57 UTC (rev 46525)
+++ trunk/Build/source/texk/web2c/lib/texmfmp.c 2018-02-03 11:18:35 UTC (rev 46526)
@@ -2175,6 +2175,36 @@
}
close_file(f);
}
+
+#ifdef XeTeX
+
+#include <unicode/ucnv.h>
+
+void
+u_close_file_or_pipe (unicodefile* f)
+{
+ int i; /* iterator */
+
+ if (shellenabledp) {
+ /* if this file was a pipe, pclose() it and return */
+ for (i=0; i<NUM_PIPES; i++) {
+ if (pipes[i] == (*f)->f) {
+ if ((*f)->f) {
+ pclose ((*f)->f);
+ if (((*f)->encodingMode == ICUMAPPING) && ((*f)->conversionData != NULL))
+ ucnv_close((*f)->conversionData);
+ free(*f);
+ }
+ pipes[i] = NULL;
+ return;
+ }
+ }
+ }
+ close_file((*f)->f);
+}
+
+#endif
+
#endif /* ENABLE_PIPES */
/* All our interrupt handler has to do is set TeX's or Metafont's global
Modified: trunk/Build/source/texk/web2c/texmfmp.h
===================================================================
--- trunk/Build/source/texk/web2c/texmfmp.h 2018-02-03 01:17:57 UTC (rev 46525)
+++ trunk/Build/source/texk/web2c/texmfmp.h 2018-02-03 11:18:35 UTC (rev 46526)
@@ -274,9 +274,12 @@
#ifdef XeTeX
#if ENABLE_PIPES
extern boolean u_open_in_or_pipe(unicodefile* f, integer filefmt, const_string fopen_mode, integer mode, integer encodingData);
+extern void u_close_file_or_pipe(unicodefile* f);
#define uopenin(f,p,m,d) u_open_in_or_pipe(&(f), p, FOPEN_RBIN_MODE, m, d)
+#define uclose(f) u_close_file_or_pipe(&(f))
#else
#define uopenin(f,p,m,d) u_open_in(&(f), p, FOPEN_RBIN_MODE, m, d)
+#define uclose(f) u_close_inout(&(f))
#endif
#endif
Modified: trunk/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
===================================================================
--- trunk/Build/source/texk/web2c/xetexdir/XeTeX_ext.c 2018-02-03 01:17:57 UTC (rev 46525)
+++ trunk/Build/source/texk/web2c/xetexdir/XeTeX_ext.c 2018-02-03 11:18:35 UTC (rev 46526)
@@ -264,17 +264,6 @@
}
}
-void
-uclose(UFILE* f)
-{
- if (f != 0) {
- fclose(f->f);
- if ((f->encodingMode == ICUMAPPING) && (f->conversionData != NULL))
- ucnv_close((UConverter*)(f->conversionData));
- free((void*)f);
- }
-}
-
static void
buffer_overflow(void)
{
@@ -2623,6 +2612,17 @@
return rval;
}
+void
+u_close_inout(unicodefile* f)
+{
+ if (f != 0) {
+ fclose((*f)->f);
+ if (((*f)->encodingMode == ICUMAPPING) && ((*f)->conversionData != NULL))
+ ucnv_close((*f)->conversionData);
+ free(*f);
+ }
+}
+
#if defined(WIN32)
static int
Isspace(char c)
Modified: trunk/Build/source/texk/web2c/xetexdir/XeTeX_ext.h
===================================================================
--- trunk/Build/source/texk/web2c/xetexdir/XeTeX_ext.h 2018-02-03 01:17:57 UTC (rev 46525)
+++ trunk/Build/source/texk/web2c/xetexdir/XeTeX_ext.h 2018-02-03 11:18:35 UTC (rev 46526)
@@ -196,7 +196,6 @@
void initversionstring(char **versions);
void setinputfileencoding(unicodefile f, integer mode, integer encodingData);
- void uclose(unicodefile f);
void linebreakstart(int f, integer localeStrNum, uint16_t* text, integer textLength);
int linebreaknext(void);
int getencodingmodeandinfo(integer* info);
@@ -248,6 +247,7 @@
int countpdffilepages(void);
int find_pic_file(char** path, realrect* bounds, int pdfBoxType, int page);
int u_open_in(unicodefile* f, integer filefmt, const char* fopen_mode, integer mode, integer encodingData);
+ void u_close_inout(unicodefile* f);
int open_dvi_output(FILE** fptr);
int dviclose(FILE* fptr);
int get_uni_c(UFILE* f);
Modified: trunk/Build/source/texk/web2c/xetexdir/xetex.ch
===================================================================
--- trunk/Build/source/texk/web2c/xetexdir/xetex.ch 2018-02-03 01:17:57 UTC (rev 46525)
+++ trunk/Build/source/texk/web2c/xetexdir/xetex.ch 2018-02-03 11:18:35 UTC (rev 46526)
@@ -168,9 +168,7 @@
@x [17.222] l.4523 - frozen_special, for source specials.
@d frozen_null_font=frozen_control_sequence+11
@y
- at d frozen_primitive=frozen_control_sequence+11
- {permanent `\.{\\primitive}'}
- at d frozen_null_font=frozen_control_sequence+12
+ at d frozen_null_font=frozen_control_sequence+12+prim_size
@z
@x [17.230] l.4731
Modified: trunk/Build/source/texk/web2c/xetexdir/xetex.web
===================================================================
--- trunk/Build/source/texk/web2c/xetexdir/xetex.web 2018-02-03 01:17:57 UTC (rev 46525)
+++ trunk/Build/source/texk/web2c/xetexdir/xetex.web 2018-02-03 11:18:35 UTC (rev 46526)
@@ -315,8 +315,8 @@
@d eTeX_version_string=='-2.6' {current \eTeX\ version}
@#
@d XeTeX_version=0 { \.{\\XeTeXversion} }
- at d XeTeX_revision==".99998" { \.{\\XeTeXrevision} }
- at d XeTeX_version_string=='-0.99998' {current \XeTeX\ version}
+ at d XeTeX_revision==".99999" { \.{\\XeTeXrevision} }
+ at d XeTeX_version_string=='-0.99999' {current \XeTeX\ version}
@#
@d XeTeX_banner=='This is XeTeX, Version 3.14159265',eTeX_version_string,XeTeX_version_string
{printed when \XeTeX\ starts}
@@ -5017,8 +5017,12 @@
@d end_write=frozen_control_sequence+8 {permanent `\.{\\endwrite}'}
@d frozen_dont_expand=frozen_control_sequence+9
{permanent `\.{\\notexpanded:}'}
+ at d prim_size=500 {maximum number of primitives }
@d frozen_null_font=frozen_control_sequence+10
{permanent `\.{\\nullfont}'}
+ at d frozen_primitive=frozen_control_sequence+11
+ {permanent `\.{\\pdfprimitive}'}
+ at d prim_eqtb_base=frozen_primitive+1
@d font_id_base=frozen_null_font-font_base
{begins table of 257 permanent font identifiers}
@d undefined_control_sequence=frozen_null_font+257 {dummy location}
@@ -6070,7 +6074,6 @@
@ Primitive support needs a few extra variables and definitions
- at d prim_size=500 {maximum number of primitives }
@d prim_prime=431 {about 85\pct! of |primitive_size|}
@d prim_base=1
@d prim_next(#) == prim[#].lh {link for coalesced lists}
@@ -6079,24 +6082,19 @@
@d prim_eq_level_field(#)==#.hh.b1
@d prim_eq_type_field(#)==#.hh.b0
@d prim_equiv_field(#)==#.hh.rh
- at d prim_eq_level(#)==prim_eq_level_field(prim_eqtb[#]) {level of definition}
- at d prim_eq_type(#)==prim_eq_type_field(prim_eqtb[#]) {command code for equivalent}
- at d prim_equiv(#)==prim_equiv_field(prim_eqtb[#]) {equivalent value}
+ at d prim_eq_level(#)==prim_eq_level_field(eqtb[prim_eqtb_base+#]) {level of definition}
+ at d prim_eq_type(#)==prim_eq_type_field(eqtb[prim_eqtb_base+#]) {command code for equivalent}
+ at d prim_equiv(#)==prim_equiv_field(eqtb[prim_eqtb_base+#]) {equivalent value}
@d undefined_primitive=0
@<Glob...@>=
@!prim: array [0..prim_size] of two_halves; {the primitives table}
@!prim_used:pointer; {allocation pointer for |prim|}
-@!prim_eqtb:array[0..prim_size] of memory_word;
@ @<Set init...@>=
no_new_control_sequence:=true; {new identifiers are usually forbidden}
prim_next(0):=0; prim_text(0):=0;
for k:=1 to prim_size do prim[k]:=prim[0];
-prim_eq_level(0):=level_zero;
-prim_eq_type(0):=undefined_cs;
-prim_equiv(0):=null;
-for k:=1 to prim_size do prim_eqtb[k]:=prim_eqtb[0];
next(hash_base):=0; text(hash_base):=0;
for k:=hash_base+1 to undefined_control_sequence-1 do hash[k]:=hash[hash_base];
@@ -6264,7 +6262,9 @@
else if p>=undefined_control_sequence then print_esc("IMPOSSIBLE.")
else if (text(p)<0)or(text(p)>=str_ptr) then print_esc("NONEXISTENT.")
@.NONEXISTENT@>
-else begin print_esc(text(p));
+else begin
+ if (p>=prim_eqtb_base)and(p<frozen_null_font) then
+ print_esc(prim_text(p-prim_eqtb_base)-1) else print_esc(text(p));
print_char(" ");
end;
end;
@@ -6279,6 +6279,8 @@
else if p<null_cs then print_esc(p-single_base)
else begin print_esc("csname"); print_esc("endcsname");
end
+else if (p>=prim_eqtb_base)and(p<frozen_null_font) then
+ print_esc(prim_text(p-prim_eqtb_base)-1)
else print_esc(text(p));
end;
@@ -8656,6 +8658,36 @@
end;
end
+@ This block deals with unexpandable \.{\\primitive} appearing at a spot where
+an integer or an internal values should have been found. It fetches the
+next token then resets |cur_cmd|, |cur_cs|, and |cur_tok|, based on the
+primitive value of that token. No expansion takes place, because the
+next token may be all sorts of things. This could trigger further
+expansion creating new errors.
+
+@<Reset |cur_tok| for unexpandable primitives, goto restart @>=
+begin
+get_token;
+if cur_cs < hash_base then
+ cur_cs := prim_lookup(cur_cs-single_base)
+else
+ cur_cs := prim_lookup(text(cur_cs));
+if cur_cs<>undefined_primitive then begin
+ cur_cmd := prim_eq_type(cur_cs);
+ cur_chr := prim_equiv(cur_cs);
+ cur_cs := prim_eqtb_base+cur_cs;
+ cur_tok := cs_token_flag+cur_cs;
+ end
+else begin
+ cur_cmd := relax;
+ cur_chr := 0;
+ cur_tok := cs_token_flag+frozen_relax;
+ cur_cs := frozen_relax;
+ end;
+goto restart;
+end
+ at z
+
@ @<Complain about an undefined macro@>=
begin print_err("Undefined control sequence");
@.Undefined control sequence@>
@@ -9191,6 +9223,7 @@
var p:pointer; {tail of the backup list}
@!q:pointer; {new node being added to the token list via |store_new_token|}
@!k:pool_pointer; {index into |str_pool|}
+@!save_cur_cs:pointer; {to save |cur_cs|}
begin p:=backup_head; link(p):=null;
if s<too_big_char then begin
while true do
@@ -9209,6 +9242,7 @@
end;
end;
k:=str_start_macro(s);
+save_cur_cs:=cur_cs;
while k<str_start_macro(s+1) do
begin get_x_token; {recursion is possible here}
@^recursion@>
@@ -9219,6 +9253,7 @@
else if (cur_cmd<>spacer)or(p<>backup_head) then
begin back_input;
if p<>backup_head then back_list(link(backup_head));
+ cur_cs:=save_cur_cs;
scan_keyword:=false; return;
end;
end;
@@ -9325,7 +9360,7 @@
@p procedure scan_something_internal(@!level:small_number;@!negative:boolean);
{fetch an internal parameter}
-label exit;
+label exit, restart;
var m:halfword; {|chr_code| part of the operand token}
n, k, kk: integer; {accumulators}
@!q,@!r:pointer; {general purpose indices}
@@ -9332,7 +9367,7 @@
@!tx:pointer; {effective tail node}
@!i:four_quarters; {character info}
@!p:0..nest_size; {index into |nest|}
-begin m:=cur_chr;
+begin restart: m:=cur_chr;
case cur_cmd of
def_code: @<Fetch a character code from some table@>;
XeTeX_def_code:
@@ -9376,6 +9411,8 @@
assign_font_int: @<Fetch a font integer@>;
register: @<Fetch a register@>;
last_item: @<Fetch an item in the current node, if appropriate@>;
+ignore_spaces: {trap unexpandable primitives}
+ if cur_chr=1 then @<Reset |cur_tok| for unexpandable primitives, goto restart@>;
othercases @<Complain that \.{\\the} can't do this; give zero result@>
endcases;@/
while cur_val_level>level do @<Convert \(c)|cur_val| to a lower level@>;
@@ -9964,7 +10001,7 @@
and that the decimal point has been backed up to be scanned again.
@p procedure scan_int; {sets |cur_val| to an integer}
-label done;
+label done, restart;
var negative:boolean; {should the answer be negated?}
@!m:integer; {|@t$2^{31}$@> div radix|, the threshold of danger}
@!d:small_number; {the digit just scanned}
@@ -9972,7 +10009,10 @@
@!OK_so_far:boolean; {has an error message been issued?}
begin radix:=0; OK_so_far:=true;@/
@<Get the next non-blank non-sign token; set |negative| appropriately@>;
+restart:
if cur_tok=alpha_token then @<Scan an alphabetic character code into |cur_val|@>
+else if cur_tok=cs_token_flag+frozen_primitive then
+ @<Reset |cur_tok| for unexpandable primitives, goto restart@>
else if (cur_cmd>=min_internal)and(cur_cmd<=max_internal) then
scan_something_internal(int_val,false)
else @<Scan a numeric constant@>;
@@ -24078,6 +24118,7 @@
if cur_cs<>undefined_primitive then begin
cur_cmd:=prim_eq_type(cur_cs);
cur_chr:=prim_equiv(cur_cs);
+ cur_tok := cs_token_flag+prim_eqtb_base+cur_cs;
goto reswitch;
end;
end;
@@ -28201,7 +28242,6 @@
@<Dump the hash table@>=
for p:=0 to prim_size do dump_hh(prim[p]);
-for p:=0 to prim_size do dump_wd(prim_eqtb[p]);
dump_int(hash_used); cs_count:=frozen_control_sequence-1-hash_used;
for p:=hash_base to hash_used do if text(p)<>0 then
begin dump_int(p); dump_hh(hash[p]); incr(cs_count);
@@ -28212,7 +28252,6 @@
@ @<Undump the hash table@>=
for p:=0 to prim_size do undump_hh(prim[p]);
-for p:=0 to prim_size do undump_wd(prim_eqtb[p]);
undump(hash_base)(frozen_control_sequence)(hash_used); p:=hash_base-1;
repeat undump(p+1)(hash_used)(p); undump_hh(hash[p]);
until p=hash_used;
@@ -28961,11 +29000,12 @@
label done;
var s1, s2: str_number;
i1, i2, j1, j2: pool_pointer;
+ save_cur_cs: pointer;
begin
- call_func(scan_toks(false, true));
+ save_cur_cs:=cur_cs; call_func(scan_toks(false, true));
s1:=tokens_to_string(def_ref);
delete_token_ref(def_ref);
- call_func(scan_toks(false, true));
+ cur_cs:=save_cur_cs; call_func(scan_toks(false, true));
s2:=tokens_to_string(def_ref);
delete_token_ref(def_ref);
i1:=str_start_macro(s1);
More information about the tex-live-commits
mailing list