diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2011-03-18 15:17:50 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2011-03-18 15:17:50 +0000 |
commit | 2bd793f897d13d43a730e8a67ace22853df406d3 (patch) | |
tree | bbb22a91d203a29d48eb03db27325bada40bc74b /Build/source/texk/web2c/eptexdir | |
parent | 73e9e24d45dd4416e978feac22d0b88380f2eb7a (diff) |
e-pTeX-110315 (mostly)
git-svn-id: svn://tug.org/texlive/trunk@21756 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/eptexdir')
-rw-r--r-- | Build/source/texk/web2c/eptexdir/ChangeLog.TL | 15 | ||||
-rw-r--r-- | Build/source/texk/web2c/eptexdir/am/eptex.am | 1 | ||||
-rw-r--r-- | Build/source/texk/web2c/eptexdir/eptex-base.ch | 1 | ||||
-rw-r--r-- | Build/source/texk/web2c/eptexdir/eptex.ech | 22 | ||||
-rw-r--r-- | Build/source/texk/web2c/eptexdir/etex.ch1 | 25 | ||||
-rw-r--r-- | Build/source/texk/web2c/eptexdir/pdfsavepos.ch | 283 |
6 files changed, 336 insertions, 11 deletions
diff --git a/Build/source/texk/web2c/eptexdir/ChangeLog.TL b/Build/source/texk/web2c/eptexdir/ChangeLog.TL index 3c645b56958..6486175f987 100644 --- a/Build/source/texk/web2c/eptexdir/ChangeLog.TL +++ b/Build/source/texk/web2c/eptexdir/ChangeLog.TL @@ -1,6 +1,21 @@ ChangeLog.TL: TeX Live (TL) changes for e-pTeX ============================================== +2011-03-18 Peter Breitenlohner <peb@mppmu.mpg.de> + + e-pTeX update eptex-110315_tlsvn110318.diff [ptex:00248] + from Hironori Kitagawa <h_kitagawa2001@yahoo.co.jp>. + + * eptex.ech: Update pTeX_version_string. + Redefine box_dir and set_box_dir from pTeX as well as box_lrstat + and set_box_lrstat from e-TeX to avoid interference. + + * pdfsavepos.ch (new): Implement \pdfsavepos primitive. + * am/eptex.am (eptex_ch_srcs): Add pdfsavepos.ch. + + * etex.ch1: Adapt to use of set_box_dir in ../ptexdir/ptex-base.ch. + Adapt to "setting/reading a box register dimension" bug fix. + 2011-01-19 Peter Breitenlohner <peb@mppmu.mpg.de> * eptex.ech, etex.ch0: Adapt to modified ../ptexdir/ptex-base.ch. diff --git a/Build/source/texk/web2c/eptexdir/am/eptex.am b/Build/source/texk/web2c/eptexdir/am/eptex.am index 5b399622111..015cd56f466 100644 --- a/Build/source/texk/web2c/eptexdir/am/eptex.am +++ b/Build/source/texk/web2c/eptexdir/am/eptex.am @@ -78,6 +78,7 @@ eptex_ch_srcs = \ eptexdir/etex.ch1 \ eptexdir/fam256.ch \ eptexdir/pdfstrcmp.ch \ + eptexdir/pdfsavepos.ch \ tex-binpool.ch EXTRA_DIST += $(eptex_web_srcs) $(eptex_ch_srcs) eptexdir/eptex.defines diff --git a/Build/source/texk/web2c/eptexdir/eptex-base.ch b/Build/source/texk/web2c/eptexdir/eptex-base.ch index 5555620f9b1..04aea3426e3 100644 --- a/Build/source/texk/web2c/eptexdir/eptex-base.ch +++ b/Build/source/texk/web2c/eptexdir/eptex-base.ch @@ -23,6 +23,7 @@ % + eptexdir/etex.ch1 glue % + eptexdir/fam256.ch borrowed from Omega % + eptexdir/pdfstrcmp.ch borrowed from pdfTeX +% + eptexdir/pdfsavepos.ch borrowed from pdfTeX % + tex-binpool.ch compiled pool file % % where the three small files denoted as glue resolve incompatibilities diff --git a/Build/source/texk/web2c/eptexdir/eptex.ech b/Build/source/texk/web2c/eptexdir/eptex.ech index 868e1b2641e..3c16e9b26bb 100644 --- a/Build/source/texk/web2c/eptexdir/eptex.ech +++ b/Build/source/texk/web2c/eptexdir/eptex.ech @@ -11,7 +11,7 @@ @x [1.2] l.200 - pTeX: @d pTeX_version_string=='-p3.1.11' {current p\TeX\ version} @y -@d pTeX_version_string=='-p3.1.11-110102' {current \epTeX\ version} +@d pTeX_version_string=='-p3.1.11-110315' {current \epTeX\ version} @z @x e-pTeX: banner @@ -20,7 +20,7 @@ {printed when p\TeX\ starts} @# @d epTeX_version==pTeX_version_string,eTeX_version_string -@d epTeX_banner=='This is epTeX, Version 3.1415926',epTeX_version +@d epTeX_banner=='This is e-pTeX, Version 3.1415926',epTeX_version @d epTeX_banner_k==epTeX_banner {printed when \epTeX\ starts} @z @@ -31,6 +31,14 @@ @d max_quarterword=@"FFFF {largest allowable value in a |quarterword|} @z +@x +@d box_dir(#) == subtype(#) {direction mode of a box} +@d set_box_dir(#) == subtype(#):=set_box_dir_end +@y +@d box_dir(#) == (subtype(#)mod 8) {direction mode of a box} +@d set_box_dir(#) == subtype(#):=(subtype(#)div 8)*8+set_box_dir_end +@z + @x [26.424] e-pTeX: node types last_node_type_code: if (type(tail)<>math_node)or(subtype(tail)<>end_M_code) then @@ -58,6 +66,16 @@ @d if_tdir_code=if_case_code+4 { `\.{\\iftdir}' } @z +@x +@d box_lrstat(#) == subtype(#) {direction mode of a box} +@d set_box_lrstat(#) == subtype(#):=set_box_lrstat_end +@d set_box_lrstat_end(#) == # +@y +@d box_lrstat(#) == (subtype(#)div 8) {direction mode of a box} +@d set_box_lrstat(#) == subtype(#):=(subtype(#)mod 8)+8*set_box_lrstat_end +@d set_box_lrstat_end(#) == (#) +@z + @x e-pTeX: font_char_{wd,ht,dp,ic}_code l.27306 begin i:=char_info(q)(qi(cur_val)); @y diff --git a/Build/source/texk/web2c/eptexdir/etex.ch1 b/Build/source/texk/web2c/eptexdir/etex.ch1 index a722016c77e..37c0c36c1d3 100644 --- a/Build/source/texk/web2c/eptexdir/etex.ch1 +++ b/Build/source/texk/web2c/eptexdir/etex.ch1 @@ -36,14 +36,16 @@ else begin q:=box(cur_val); while (q<>null)and(box_dir(q)<>abs(direction)) do q:=link(q); if q=null then - begin q:=new_dir_node(box(cur_val),abs(direction)); + begin r:=link(box(cur_val)); link(box(cur_val)):=null; + q:=new_dir_node(box(cur_val),abs(direction)); link(box(cur_val)):=r; @y if q=null then cur_val:=0 else begin qx:=q; while (q<>null)and(box_dir(q)<>abs(direction)) do q:=link(q); if q=null then - begin q:=new_dir_node(qx,abs(direction)); + begin r:=link(qx); link(qx):=null; + q:=new_dir_node(qx,abs(direction)); link(qx):=r; @z @x [27.468] @@ -113,12 +115,12 @@ hpack:=r; q:=prune_page_top(q); p:=list_ptr(v); if q=null then box(n):=null {the |eq_level| of the box stays the same} else begin - box(n):=vpack(q,natural); box_dir(box(n)):=box_dir(v); + box(n):=vpack(q,natural); set_box_dir(box(n))(box_dir(v)); end; @y q:=prune_page_top(q,saving_vdiscards>0); p:=list_ptr(v); if q<>null then begin - q:=vpack(q,natural); box_dir(q):=box_dir(v); + q:=vpack(q,natural); set_box_dir(q)(box_dir(v)); end; change_box(q); @z @@ -152,10 +154,10 @@ change_box(q); if type(tail)=cur_chr then @z @x [47.1105] - begin prev_node:=tail; prev_disp:=disp; tail_append(d) - end + begin prev_node:=tail; prev_disp:=disp; tail_append(d); + end; @y - begin prev_node:=tail; prev_disp:=disp; tail_append(d) + begin prev_node:=tail; prev_disp:=disp; tail_append(d); end; if LR_temp<>null then insert_end_M; end; @@ -192,9 +194,14 @@ if b<>null then begin q:=b; p:=link(q); @z @x [49.1247] - link(q):=link(box(b)); link(box(b)):=q; + begin p:=link(box(b)); link(box(b)):=null; +@y + begin p:=link(b); link(b):=null; +@z +@x [49.1247] + link(q):=p; link(box(b)):=q; @y - link(q):=link(b); link(b):=q; + link(q):=p; link(b):=q; @z @x [49.1291] diff --git a/Build/source/texk/web2c/eptexdir/pdfsavepos.ch b/Build/source/texk/web2c/eptexdir/pdfsavepos.ch new file mode 100644 index 00000000000..fefe3151bae --- /dev/null +++ b/Build/source/texk/web2c/eptexdir/pdfsavepos.ch @@ -0,0 +1,283 @@ +% last update: 2011/3/15 + +@x +@d dimen_pars=23 {total number of dimension parameters} +@y +@d pdf_page_width_code=23 {page width} +@d pdf_page_height_code=24 {page height} +@d dimen_pars=25 {total number of dimension parameters} +@z + +@x +@d emergency_stretch==dimen_par(emergency_stretch_code) +@y +@d emergency_stretch==dimen_par(emergency_stretch_code) +@d pdf_page_width==dimen_par(pdf_page_width_code) +@d pdf_page_height==dimen_par(pdf_page_height_code) +@z + +@x +emergency_stretch_code:print_esc("emergencystretch"); +@y +emergency_stretch_code:print_esc("emergencystretch"); +pdf_page_width_code: print_esc("pdfpagewidth"); +pdf_page_height_code: print_esc("pdfpageheight"); +@z + +@x +@d badness_code=input_line_no_code+1 {code for \.{\\badness}} +@y +@d badness_code=input_line_no_code+1 {code for \.{\\badness}} +@d pdf_last_x_pos_code=badness_code+1 {code for \.{\\pdflastxpos}} +@d pdf_last_y_pos_code=pdf_last_x_pos_code+1 {code for \.{\\pdflastypos}} +@z + +@x +@d eTeX_int=badness_code+1 {first of \eTeX\ codes for integers} +@y +@d eTeX_int=pdf_last_y_pos_code+1 {first of \eTeX\ codes for integers} +@z + +@x +@d etex_convert_codes=etex_convert_base+2 {end of \eTeX's command codes} +@y +@d etex_convert_codes=etex_convert_base+3 {end of \eTeX's command codes} +@z + +@x +@ @<Initialize variables as |ship_out| begins@>= +@y +@ @<Initialize variables as |ship_out| begins@>= +@<Calculate DVI page dimensions and margins@>; +@z + +@x +@!old_setting:0..max_selector; {saved |selector| setting} +begin if tracing_output>0 then +@y +@!old_setting:0..max_selector; {saved |selector| setting} +@!t: scaled; +begin if tracing_output>0 then +@z + +@x +@d set_language_code=5 {command modifier for \.{\\setlanguage}} +@y +@d set_language_code=5 {command modifier for \.{\\setlanguage}} +@d TeX_extension_end=5 +@d pdf_save_pos_node=TeX_extension_end+1 +@z + +@x + set_language_code:print_esc("setlanguage"); +@y + set_language_code:print_esc("setlanguage"); + pdf_save_pos_node: print_esc("pdfsavepos"); +@z + +@x +set_language_code:@<Implement \.{\\setlanguage}@>; +@y +set_language_code:@<Implement \.{\\setlanguage}@>; +pdf_save_pos_node: @<Implement \.{\\pdfsavepos}@>; +@z + +@x + print_int(what_lhm(p)); print_char(","); + print_int(what_rhm(p)); print_char(")"); + end; +@y + print_int(what_lhm(p)); print_char(","); + print_int(what_rhm(p)); print_char(")"); + end; +pdf_save_pos_node: print_esc("pdfsavepos"); +@z + +@x +close_node,language_node: begin r:=get_node(small_node_size); + words:=small_node_size; + end; +@y +close_node,language_node: begin r:=get_node(small_node_size); + words:=small_node_size; + end; +pdf_save_pos_node: + r := get_node(small_node_size); +@z + +@x +close_node,language_node: free_node(p,small_node_size); +@y +close_node,language_node: free_node(p,small_node_size); +pdf_save_pos_node: free_node(p, small_node_size); +@z + +@x +procedure special_out(@!p:pointer); +var old_setting:0..max_selector; {holds print |selector|} +@!k:pool_pointer; {index into |str_pool|} +@y +procedure special_out(@!p:pointer); +label done; +var old_setting:0..max_selector; {holds print |selector|} +@!k:pool_pointer; {index into |str_pool|} +@!s,@!t,@!cw: scaled; +@!bl: boolean; +@!i: small_number; +@z + +@x +pool_ptr:=str_start[str_ptr]; {erase the string} +@y +@<Determine whether this \.{\\special} is a papersize special@>; +done: pool_ptr:=str_start[str_ptr]; {erase the string} +@z + +@x +language_node:do_nothing; +@y +language_node:do_nothing; +pdf_save_pos_node: + @<Save current position in DVI mode@>; +@z + +@x +primitive("pdfstrcmp",convert,pdf_strcmp_code);@/ +@!@:pdf_strcmp_}{\.{\\pdfstrcmp} primitive@> +@y +primitive("pdfstrcmp",convert,pdf_strcmp_code);@/ +@!@:pdf_strcmp_}{\.{\\pdfstrcmp} primitive@> +primitive("pdfsavepos",extension,pdf_save_pos_node);@/ +@!@:pdf_save_pos_}{\.{\\pdfsavepos} primitive@> +primitive("pdfpagewidth",assign_dimen,dimen_base+pdf_page_width_code);@/ +@!@:pdf_page_width_}{\.{\\pdfpagewidth} primitive@> +primitive("pdfpageheight",assign_dimen,dimen_base+pdf_page_height_code);@/ +@!@:pdf_page_height_}{\.{\\pdfpageheight} primitive@> +primitive("pdflastxpos",last_item,pdf_last_x_pos_code);@/ +@!@:pdf_last_x_pos_}{\.{\\pdflastxpos} primitive@> +primitive("pdflastypos",last_item,pdf_last_y_pos_code);@/ +@!@:pdf_last_y_pos_}{\.{\\pdflastypos} primitive@> +@z + +@x +eTeX_version_code: print_esc("eTeXversion"); +@y +eTeX_version_code: print_esc("eTeXversion"); +pdf_last_x_pos_code: print_esc("pdflastxpos"); +pdf_last_y_pos_code: print_esc("pdflastypos"); +@z + +@x +eTeX_version_code: cur_val:=eTeX_version; +@y +eTeX_version_code: cur_val:=eTeX_version; +pdf_last_x_pos_code: cur_val := pdf_last_x_pos; +pdf_last_y_pos_code: cur_val := pdf_last_y_pos; +@z + + +@x +@* \[54] System-dependent changes. +@y +@ Next, we implement \.{\\pdfsavepos} and its related primitives. + +@<Glob...@>= +@!cur_page_width: scaled; {width of page being shipped} +@!cur_page_height: scaled; {height of page being shipped} +@!pdf_last_x_pos: integer; +@!pdf_last_y_pos: integer; + +@ @<Implement \.{\\pdfsavepos}@>= +begin + new_whatsit(pdf_save_pos_node, small_node_size); +end + +@ @<Save current position in DVI mode@>= +begin + case dvi_dir of + dir_yoko: begin pdf_last_x_pos := cur_h; pdf_last_y_pos := cur_v; end; + dir_tate: begin pdf_last_x_pos := -cur_v; pdf_last_y_pos := cur_h; end; + dir_dtou: begin pdf_last_x_pos := cur_v; pdf_last_y_pos := -cur_h; end; + endcases; + pdf_last_x_pos := pdf_last_x_pos + 4736286; + case dvi_dir of + dir_tate,dir_dtou: + pdf_last_y_pos := cur_page_width - pdf_last_y_pos - 4736286; + dir_yoko: + pdf_last_y_pos := cur_page_height - pdf_last_y_pos - 4736286; + endcases; + {4736286 = 1in, the funny DVI origin offset} +end + +@ @<Calculate DVI page dimensions and margins@>= + if pdf_page_height <> 0 then + cur_page_height := pdf_page_height + else + cur_page_height := height(p) + depth(p) + 2*v_offset + 2*4736286; + if pdf_page_width <> 0 then + cur_page_width := pdf_page_width + else + cur_page_width := width(p) + 2*h_offset + 2*4736286; + if (type(p)=dir_node) then + if (box_dir(list_ptr(p))=dir_tate)or(box_dir(list_ptr(p))=dir_dtou) then begin + t:=cur_page_height; cur_page_height:=cur_page_width; + cur_page_width:=t; end; + + +@ Of course \epTeX\ can produce a \.{DVI} file only, not a PDF file. +A \.{DVI} file does not have the information of the page height, +which is needed to implement \.{\\pdflastypos} correctly. +To keep the information of the page height, I (H.~Kitagawa) +adopted \.{\\pdfpageheight} primitive from pdf\TeX. However, in \pTeX (and \epTeX), +the papersize special \.{\\special\{papersize=|width|,|height|\}} is commonly used +for specifying page width/height. Hence, I decided that the papersize special also +changes the value of \.{\\pdfpagewidth} and \.{\\pdfpageheight}. +The following routine does this. + +In present implementation, the ``valid'' papersize special, which can be interpreted by +this routine, is in the following form: +$$\hbox{.{\\special\{papersize=$x$pt,$y$pt\}}}$$ +where $x$\,pt and $y$\, pt are positive dimensions which \TeX\ can comprehend. +No spaces are allowed in the above form, and only ``pt'' is allowed for unit, for simplicity. + +@d ifps==if k=pool_ptr then goto done else if +@d sop(#)==so(str_pool[(#)]) + +@<Determine whether this \.{\\special} is a papersize special@>= +if pool_ptr-str_start[str_ptr]<=10 then goto done; +k:=str_start[str_ptr]; +if (sop(k+0)<>'p')or(sop(k+1)<>'a')or(sop(k+2)<>'p')or + (sop(k+3)<>'e')or(sop(k+4)<>'r')or(sop(k+5)<>'s')or + (sop(k+6)<>'i')or(sop(k+7)<>'z')or(sop(k+8)<>'e') then goto done; +k:=k+9; ifps sop(k)='=' then incr(k); +@<Read dimensions in the argument in the papersize special@>; +incr(k); ifps sop(k)<>',' then goto done else incr(k); cw:=t; +@<Read dimensions in the argument in the papersize special@>; +geq_word_define(dimen_base+pdf_page_width_code,cw); +geq_word_define(dimen_base+pdf_page_height_code,t); +cur_page_height := t; cur_page_width := cw; +if (dvi_dir=dir_tate)or(dvi_dir=dir_dtou) then begin + t:=cur_page_height; cur_page_height:=cur_page_width; + cur_page_width:=t; end; + +@ @<Read dimensions in the argument in the papersize special@>= +s:=1; t:=0; bl:=true; +while (k<pool_ptr)and(bl) do begin + if (sop(k)>='0')and (sop(k)<='9') then begin t:=10*t+sop(k)-'0'; incr(k); end + else begin bl:=false; end; +end; +t:=t*unity; +ifps sop(k)='.' then begin incr(k); bl:=true; i:=0; + while (k<pool_ptr)and(bl)and(i<=17) do begin + if (sop(k)>='0')and (sop(k)<='9') then begin + dig[i]:=sop(k)-'0'; incr(k); incr(i); end + else begin bl:=false; incr(k); incr(i); end; + end; + t:=s*(t+round_decimals(i-1)); +end +else if (sop(k)>='0')and(sop(k)<='9') then goto done +else begin t:=s*t; incr(k); end; +ifps sop(k-1)<>'p' then goto done; ifps sop(k)<>'t' then goto done; + +@* \[54] System-dependent changes. +@z |