diff options
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/NEWS | 14 | ||||
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/pdftex.defines | 1 | ||||
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/pdftex.web | 162 | ||||
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/ptexlib.h | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/vfpacket.c | 39 |
5 files changed, 137 insertions, 83 deletions
diff --git a/Build/source/texk/web2c/pdftexdir/NEWS b/Build/source/texk/web2c/pdftexdir/NEWS index f633ad368da..7acd2b3a964 100644 --- a/Build/source/texk/web2c/pdftexdir/NEWS +++ b/Build/source/texk/web2c/pdftexdir/NEWS @@ -1,4 +1,16 @@ - - \pdfshellescape is 2 if restricted shell escapes are enabled. +- \pdfshellescape is 2 if restricted shell escapes are enabled. +- sync with TL new build system +- update to libpng 1.2.35 +- update to xpdf-3.02pl3 +- applied patch #2087: Support for CMap namespace +- bugfixes: + - bugfix #993: "/Names array not sorted correctly" + - bugfix #606: "Forbidden ... while scanning ???" + - bugfix #3253: Bug in Type1 font subsetting + - bugfix #2090: enabling LFS breaks PDF inclusion on some systems (warning: not heavily-tested yet) + - bugfix #4288: character width mismatch in font XY.vf ignored + - bugfix #4289: \primitive\pdfoutput cannot be queried + - various minor fixes -------------------------------------------------- pdfTeX 3.1415926-1.40.9 was released on 2008-08-16 diff --git a/Build/source/texk/web2c/pdftexdir/pdftex.defines b/Build/source/texk/web2c/pdftexdir/pdftex.defines index 6959aefe1aa..7831314d8d2 100644 --- a/Build/source/texk/web2c/pdftexdir/pdftex.defines +++ b/Build/source/texk/web2c/pdftexdir/pdftex.defines @@ -97,7 +97,6 @@ Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. @define function packetbyte; @define procedure startpacket(); @define procedure storepacket(); -@define function sqxfw(); { functions from writefont.c } @define procedure dopdffont(); diff --git a/Build/source/texk/web2c/pdftexdir/pdftex.web b/Build/source/texk/web2c/pdftexdir/pdftex.web index b5d49d6cecb..3813399ae72 100644 --- a/Build/source/texk/web2c/pdftexdir/pdftex.web +++ b/Build/source/texk/web2c/pdftexdir/pdftex.web @@ -8890,9 +8890,40 @@ if cur_cs<>undefined_primitive then begin p:=get_avail; info(p):=cs_token_flag+frozen_primitive; link(p):=loc; loc:=p; start:=p; end; + end +else begin + print_err("Missing primitive name"); + help2("The control sequence marked <to be read again> does not")@/ + ("represent any known primitive."); + back_error; 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; +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_tok := (cur_cmd*@'400)+cur_chr; + end +else begin + cur_cmd := relax; + cur_chr := 0; + cur_tok := cs_token_flag+frozen_relax; + cur_cs := frozen_relax; + end; +goto restart; +end + @ @<Complain about an undefined macro@>= begin print_err("Undefined control sequence"); @.Undefined control sequence@> @@ -9541,13 +9572,13 @@ 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: integer; {accumulators} @!q:halfword; {general purpose index} @!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@>; toks_register,assign_toks,def_family,set_font,def_font,letterspace_font,pdf_copy_font: @<Fetch a token list or @@ -9567,6 +9598,8 @@ assign_font_dimen: @<Fetch a font dimension@>; 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@>; @@ -10055,7 +10088,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} @@ -10063,7 +10096,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;@/ @<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@>; @@ -13078,7 +13114,34 @@ of \TeX\ between computers. if a=0 then #:=sw@+else if a=255 then #:=sw-alpha@+else abort; end -@<Read box dimensions@>= +@p function store_scaled_f(sq, z: scaled): scaled; +var a,b,c,d:eight_bits; sw:scaled; +alpha:integer; +beta:1..16; +begin + alpha:=16; + while z>=@'40000000 do + begin z:=z div 2; alpha:=alpha+alpha; + end; + beta:=256 div alpha; alpha:=alpha*z; + if sq >= 0 then begin + d:=sq mod 256; sq:=sq div 256; {any "mod 256" not really needed, would typecast alone be safe?} + c:=sq mod 256; sq:=sq div 256; + b:=sq mod 256; sq:=sq div 256; + a:=sq mod 256; + end else begin + sq:=(sq+1073741824)+1073741824; {braces for optimizing compiler} + d:=sq mod 256; sq:=sq div 256; + c:=sq mod 256; sq:=sq div 256; + b:=sq mod 256; sq:=sq div 256; + a:=(sq+128) mod 256; + end; + sw:=(((((d*z)div@'400)+(c*z))div@'400)+(b*z))div beta; + if a=0 then store_scaled_f:=sw@+else if a=255 then store_scaled_f:=sw-alpha@+else pdf_error("store_scaled_f", "vf scaling"); +end; + + +@ @<Read box dimensions@>= begin @<Replace |z| by $|z|^\prime$ and compute $\alpha,\beta$@>; for k:=width_base[f] to lig_kern_base[f]-1 do store_scaled(font_info[k].sc); @@ -17577,19 +17640,36 @@ begin vf_byte := i; end; -function vf_read(k: integer): integer; {read |k| bytes as an integer from \.{VF} file} +function vf_read_signed(k: integer): integer; +{read |k| bytes as an signed integer from \.{VF} file} var i: integer; begin pdfassert((k > 0) and (k <= 4)); i := vf_byte; - if (k = 4) and (i > 127) then + if i >= 128 then i := i - 256; decr(k); while k > 0 do begin i := i*256 + vf_byte; decr(k); end; - vf_read := i; + vf_read_signed := i; +end; + +function vf_read_unsigned(k: integer): integer; +{read |k| bytes as an unsigned integer from \.{VF} file} +var i: integer; +begin + pdfassert((k > 0) and (k <= 4)); + i := vf_byte; + if (k = 4) and (i >= 128) then + bad_vf("number too big"); + decr(k); + while k > 0 do begin + i := i*256 + vf_byte; + decr(k); + end; + vf_read_unsigned := i; end; procedure vf_local_font_warning(f, k: internal_font_number; s: str_number); @@ -17612,8 +17692,8 @@ var k: internal_font_number; cs: four_quarters; begin cs.b0 := vf_byte; cs.b1 := vf_byte; cs.b2 := vf_byte; cs.b3 := vf_byte; - fs := sqxfw(vf_read(4), font_size[f]); - ds := vf_read(4) div @'20; + fs := store_scaled_f(vf_read_signed(4), font_size[f]); + ds := vf_read_signed(4) div @'20; tmp_b0 := vf_byte; tmp_b1 := vf_byte; while tmp_b0 > 0 do begin @@ -17695,7 +17775,7 @@ if ((tmp_b0 <> 0) or (tmp_b1 <> 0) or (tmp_b2 <> 0) or (tmp_b3 <> 0)) and print(font_name[f]); print(".vf ignored"); end; -if vf_read(4) div @'20 <> font_dsize[f] then begin +if vf_read_signed(4) div @'20 <> font_dsize[f] then begin print_nl("design size mismatch in font "); print(font_name[f]); print(".vf ignored"); @@ -17707,7 +17787,7 @@ cmd := vf_byte; save_vf_nf := vf_nf; while (cmd >= fnt_def1) and (cmd <= fnt_def1 + 3) do begin allocvffnts; - vf_e_fnts[vf_nf] := vf_read(cmd - fnt_def1 + 1); + vf_e_fnts[vf_nf] := vf_read_unsigned(cmd - fnt_def1 + 1); vf_i_fnts[vf_nf] := vf_def_font(f); incr(vf_nf); cmd := vf_byte; @@ -17720,24 +17800,24 @@ vf_local_font_num[f] := vf_nf - save_vf_nf; @ @<Build a character packet@>= if cmd = long_char then begin - packet_length := vf_read(4); - cc := vf_read(4); + packet_length := vf_read_unsigned(4); + cc := vf_read_unsigned(4); if not is_valid_char(cc) then bad_vf("invalid character code"); - tfm_width := sqxfw(vf_read(4), font_size[f]); + tfm_width := store_scaled_f(vf_read_signed(4), font_size[f]); end else begin packet_length := cmd; cc := vf_byte; if not is_valid_char(cc) then bad_vf("invalid character code"); - tfm_width := sqxfw(vf_read(3), font_size[f]); + tfm_width := store_scaled_f(vf_read_signed(3), font_size[f]); end; if packet_length < 0 then bad_vf("negative packet length"); if packet_length > vf_max_packet_length then bad_vf("packet length too long"); -if abs(tfm_width - char_width(f)(char_info(f)(cc))) > 1 then begin +if tfm_width <> char_width(f)(char_info(f)(cc)) then begin print_nl("character width mismatch in font "); print(font_name[f]); print(".vf ignored"); @@ -17773,7 +17853,7 @@ if (cmd >= set_char_0) and (cmd <= set_char_0 + 127) then else if ((fnt_num_0 <= cmd) and (cmd <= fnt_num_0 + 63)) or ((fnt1 <= cmd) and (cmd <= fnt1 + 3)) then begin if cmd >= fnt1 then begin - k := vf_read(cmd - fnt1 + 1); + k := vf_read_unsigned(cmd - fnt1 + 1); packet_length := packet_length - (cmd - fnt1 + 1); end else @@ -17806,7 +17886,7 @@ four_cases(down1): cmd_length := cmd - down1 + 1; four_cases(y1): cmd_length := cmd - y1 + 1; four_cases(z1): cmd_length := cmd - z1 + 1; four_cases(xxx1): begin - cmd_length := vf_read(cmd - xxx1 + 1); + cmd_length := vf_read_unsigned(cmd - xxx1 + 1); packet_length := packet_length - (cmd - xxx1 + 1); if cmd_length > vf_max_packet_length then bad_vf("packet length too long"); @@ -17906,36 +17986,42 @@ vf_stack_ptr := 0; @ Some functions for processing character packets. -@p function packet_read(k: integer): integer; {read |k| bytes as an integer from -character packet} +@p function packet_read_signed(k: integer): integer; +{read |k| bytes as a signed integer from character packet} var i: integer; begin pdfassert((k > 0) and (k <= 4)); i := packet_byte; - if (k = 4) and (i > 127) then + if i >= 128 then i := i - 256; decr(k); while k > 0 do begin i := i*256 + packet_byte; decr(k); end; - packet_read := i; + packet_read_signed := i; end; -function packet_scaled(k: integer; fs: scaled): scaled; {get |k| bytes from packet as a -scaled} -var fw: integer; +function packet_read_unsigned(k: integer): integer; +{read |k| bytes as an unsigned integer from character packet} +var i: integer; begin - fw := packet_read(k); - case k of - 1: if fw > 127 then - fw := fw - 256; - 2: if fw > @"8000 then - fw := fw - @"10000; - 3: if fw > @"800000 then - fw := fw - @"1000000; - endcases; - packet_scaled := sqxfw(fw, fs); + pdfassert((k > 0) and (k <= 4)); + i := packet_byte; + if (k = 4) and (i >= 128) then + bad_vf("number too big"); + decr(k); + while k > 0 do begin + i := i*256 + packet_byte; + decr(k); + end; + packet_read_unsigned := i; +end; + +function packet_scaled(k: integer; fs: scaled): scaled; +{get |k| bytes from packet as scaled} +begin + packet_scaled := store_scaled_f(packet_read_signed(k), fs); end; procedure do_vf_packet(vf_f: internal_font_number; c: eight_bits); {typeset the @@ -18027,11 +18113,11 @@ pop: begin end; four_cases(set1), four_cases(put1): begin if (set1 <= cmd) and (cmd <= set1 + 3) then begin - tmp_int := packet_read(cmd - set1 + 1); + tmp_int := packet_read_unsigned(cmd - set1 + 1); char_move := true; end else begin - tmp_int := packet_read(cmd - put1 + 1); + tmp_int := packet_read_unsigned(cmd - put1 + 1); char_move := false; end; if not is_valid_char(tmp_int) then begin @@ -18075,7 +18161,7 @@ z0, four_cases(z1): begin cur_v := cur_v + z; end; four_cases(xxx1): begin - tmp_int := packet_read(cmd - xxx1 + 1); + tmp_int := packet_read_unsigned(cmd - xxx1 + 1); str_room(tmp_int); while tmp_int > 0 do begin decr(tmp_int); diff --git a/Build/source/texk/web2c/pdftexdir/ptexlib.h b/Build/source/texk/web2c/pdftexdir/ptexlib.h index 9c17e3eca4e..f6cc38a62ff 100644 --- a/Build/source/texk/web2c/pdftexdir/ptexlib.h +++ b/Build/source/texk/web2c/pdftexdir/ptexlib.h @@ -278,10 +278,6 @@ extern eightbits packetbyte(void); extern void poppacketstate(void); extern void pushpacketstate(void); extern void vf_free(void); -# define SIGNED_QUAD scaled -# define fixword integer -extern SIGNED_QUAD sqxfw(SIGNED_QUAD sq, fixword fw); - /* writeenc.c */ extern fe_entry *get_fe_entry(char *); diff --git a/Build/source/texk/web2c/pdftexdir/vfpacket.c b/Build/source/texk/web2c/pdftexdir/vfpacket.c index 76152b986cf..7bc551bfc65 100644 --- a/Build/source/texk/web2c/pdftexdir/vfpacket.c +++ b/Build/source/texk/web2c/pdftexdir/vfpacket.c @@ -106,42 +106,3 @@ void vf_free(void) } xfree(packet_array); } - -/* this function was copied/borrowed/stolen from dvipdfm code */ -#define SIGNED_QUAD scaled -#define fixword integer -SIGNED_QUAD sqxfw(SIGNED_QUAD sq, fixword fw) -{ - int sign = 1; - unsigned long a, b, c, d, ad, bd, bc, ac; - unsigned long e, f, g, h, i, j, k; - unsigned long result; - /* Make positive. */ - if (sq < 0) { - sign = -sign; - sq = -sq; - } - if (fw < 0) { - sign = -sign; - fw = -fw; - } - a = ((unsigned long) sq) >> 16u; - b = ((unsigned long) sq) & 0xffffu; - c = ((unsigned long) fw) >> 16u; - d = ((unsigned long) fw) & 0xffffu; - ad = a * d; - bd = b * d; - bc = b * c; - ac = a * c; - e = bd >> 16u; - f = ad >> 16u; - g = ad & 0xffffu; - h = bc >> 16u; - i = bc & 0xffffu; - j = ac >> 16u; - k = ac & 0xffffu; - result = (e + g + i + (1 << 3)) >> 4u; /* 1<<3 is for rounding */ - result += (f + h + k) << 12u; - result += j << 28u; - return (sign > 0) ? result : -result; -} |