From 7626b1d3ff9a8b821adc818514696cf34d257049 Mon Sep 17 00:00:00 2001 From: Hironobu Yamashita Date: Sat, 3 Feb 2018 11:18:35 +0000 Subject: xetexdir: sync with the upstream [acfb33c] (version 0.99999) git-svn-id: svn://tug.org/texlive/trunk@46526 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/lib/texmfmp.c | 30 +++++++++++ Build/source/texk/web2c/texmfmp.h | 3 ++ Build/source/texk/web2c/xetexdir/XeTeX_ext.c | 22 ++++---- Build/source/texk/web2c/xetexdir/XeTeX_ext.h | 2 +- Build/source/texk/web2c/xetexdir/xetex.ch | 4 +- Build/source/texk/web2c/xetexdir/xetex.web | 78 +++++++++++++++++++++------- 6 files changed, 105 insertions(+), 34 deletions(-) diff --git a/Build/source/texk/web2c/lib/texmfmp.c b/Build/source/texk/web2c/lib/texmfmp.c index 55dea7291bb..3642decb137 100644 --- a/Build/source/texk/web2c/lib/texmfmp.c +++ b/Build/source/texk/web2c/lib/texmfmp.c @@ -2175,6 +2175,36 @@ close_file_or_pipe (FILE *f) } close_file(f); } + +#ifdef XeTeX + +#include + +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; if) { + 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 diff --git a/Build/source/texk/web2c/texmfmp.h b/Build/source/texk/web2c/texmfmp.h index 874c0aeccc1..be8311f0e58 100644 --- a/Build/source/texk/web2c/texmfmp.h +++ b/Build/source/texk/web2c/texmfmp.h @@ -274,9 +274,12 @@ extern void topenin (void); #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 diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c index fa83bab8289..4968ee41e66 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c +++ b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c @@ -264,17 +264,6 @@ setinputfileencoding(UFILE* f, integer mode, integer encodingData) } } -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 @@ u_open_in(unicodefile* f, integer filefmt, const_string fopen_mode, integer mode 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) diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_ext.h b/Build/source/texk/web2c/xetexdir/XeTeX_ext.h index 1ed54689eb7..29c06ab6891 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeX_ext.h +++ b/Build/source/texk/web2c/xetexdir/XeTeX_ext.h @@ -196,7 +196,6 @@ extern "C" { 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 @@ extern "C" { 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); diff --git a/Build/source/texk/web2c/xetexdir/xetex.ch b/Build/source/texk/web2c/xetexdir/xetex.ch index 0eb481a91a1..2f24abd3eac 100644 --- a/Build/source/texk/web2c/xetexdir/xetex.ch +++ b/Build/source/texk/web2c/xetexdir/xetex.ch @@ -168,9 +168,7 @@ has been detected. It has five possible values: |spotless|, |warning_issued|, @x [17.222] l.4523 - frozen_special, for source specials. @d frozen_null_font=frozen_control_sequence+11 @y -@d frozen_primitive=frozen_control_sequence+11 - {permanent `\.{\\primitive}'} -@d frozen_null_font=frozen_control_sequence+12 +@d frozen_null_font=frozen_control_sequence+12+prim_size @z @x [17.230] l.4731 diff --git a/Build/source/texk/web2c/xetexdir/xetex.web b/Build/source/texk/web2c/xetexdir/xetex.web index 37e2cb3d038..56a8f4c486f 100644 --- a/Build/source/texk/web2c/xetexdir/xetex.web +++ b/Build/source/texk/web2c/xetexdir/xetex.web @@ -315,8 +315,8 @@ known as `\eTeX'. @d eTeX_version_string=='-2.6' {current \eTeX\ version} @# @d XeTeX_version=0 { \.{\\XeTeXversion} } -@d XeTeX_revision==".99998" { \.{\\XeTeXrevision} } -@d XeTeX_version_string=='-0.99998' {current \XeTeX\ version} +@d XeTeX_revision==".99999" { \.{\\XeTeXrevision} } +@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 @@ locations for control sequences that are perpetually defined @d end_write=frozen_control_sequence+8 {permanent `\.{\\endwrite}'} @d frozen_dont_expand=frozen_control_sequence+9 {permanent `\.{\\notexpanded:}'} +@d prim_size=500 {maximum number of primitives } @d frozen_null_font=frozen_control_sequence+10 {permanent `\.{\\nullfont}'} +@d frozen_primitive=frozen_control_sequence+11 + {permanent `\.{\\pdfprimitive}'} +@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 @@ A global boolean variable called |no_new_control_sequence| is set to @ Primitive support needs a few extra variables and definitions -@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 @@ A global boolean variable called |no_new_control_sequence| is set to @d prim_eq_level_field(#)==#.hh.b1 @d prim_eq_type_field(#)==#.hh.b0 @d prim_equiv_field(#)==#.hh.rh -@d prim_eq_level(#)==prim_eq_level_field(prim_eqtb[#]) {level of definition} -@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 prim_eq_level(#)==prim_eq_level_field(eqtb[prim_eqtb_base+#]) {level of definition} +@d prim_eq_type(#)==prim_eq_type_field(eqtb[prim_eqtb_base+#]) {command code for equivalent} +@d prim_equiv(#)==prim_equiv_field(eqtb[prim_eqtb_base+#]) {equivalent value} @d undefined_primitive=0 @= @!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; @ @= 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 @@ begin 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=prim_eqtb_base)and(pundefined_primitive then begin 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. + +@= +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 +@z + @ @= begin print_err("Undefined control sequence"); @.Undefined control sequence@> @@ -9191,6 +9223,7 @@ label exit; 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 @@ -9219,6 +9253,7 @@ while kspacer)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,14 +9360,14 @@ the internal quantity to be scanned; an error will be signalled if @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} @!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: @; XeTeX_def_code: @@ -9376,6 +9411,8 @@ assign_font_dimen: @; assign_font_int: @; register: @; last_item: @; +ignore_spaces: {trap unexpandable primitives} + if cur_chr=1 then @; othercases @ endcases;@/ while cur_val_level>level do @; @@ -9964,7 +10001,7 @@ after the integer part of such a fraction has been scanned by |scan_int|, 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 @@ var negative:boolean; {should the answer be negated?} @!OK_so_far:boolean; {has an error message been issued?} begin radix:=0; OK_so_far:=true;@/ @; +restart: if cur_tok=alpha_token then @ +else if cur_tok=cs_token_flag+frozen_primitive then + @ else if (cur_cmd>=min_internal)and(cur_cmd<=max_internal) then scan_something_internal(int_val,false) else @; @@ -24078,6 +24118,7 @@ any_mode(ignore_spaces): begin 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 @@ for |p>=hash_used|, so the remaining entries are output in a~block. @= 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 @@ print_ln; print_int(cs_count); print(" multiletter control sequences") @ @= 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 @@ procedure compare_strings; {to implement \.{\\strcmp}} 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); -- cgit v1.2.3