texlive[48574] Build/source/texk/web2c/eptexdir: eptexdir: add new

commits+hironobu at tug.org commits+hironobu at tug.org
Tue Sep 4 13:29:22 CEST 2018


Revision: 48574
          http://tug.org/svn/texlive?view=revision&revision=48574
Author:   hironobu
Date:     2018-09-04 13:29:21 +0200 (Tue, 04 Sep 2018)
Log Message:
-----------
eptexdir: add new primitive \readpapersizespecial (H. Kitagawa)

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/eptexdir/ChangeLog
    trunk/Build/source/texk/web2c/eptexdir/eptex.ech
    trunk/Build/source/texk/web2c/eptexdir/eptex_version.h
    trunk/Build/source/texk/web2c/eptexdir/pdfutils.ch

Added Paths:
-----------
    trunk/Build/source/texk/web2c/eptexdir/tests/pdforigin.sh
    trunk/Build/source/texk/web2c/eptexdir/tests/pdforigin.tex
    trunk/Build/source/texk/web2c/eptexdir/tests/pdfpagewidth.tex

Modified: trunk/Build/source/texk/web2c/eptexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/eptexdir/ChangeLog	2018-09-04 08:43:32 UTC (rev 48573)
+++ trunk/Build/source/texk/web2c/eptexdir/ChangeLog	2018-09-04 11:29:21 UTC (rev 48574)
@@ -1,3 +1,9 @@
+2018-09-01  Hironori Kitagawa  <h_kitagawa2001 at yahoo.co.jp>
+
+	* eptex.ech, pdfutils.ch: New primitive \readpapersizespecial.
+	* eptex.ech, eptex_version.h: e-pTeX version 180901.
+	* tests/pdforigin.tex, tests/pdfpagewidth.tex: Added.
+
 2018-05-18  Joseph Wright  <joseph.wright at morningstar2.co.uk>
             Hironori Kitagawa  <h_kitagawa2001 at yahoo.co.jp>
 

Modified: trunk/Build/source/texk/web2c/eptexdir/eptex.ech
===================================================================
--- trunk/Build/source/texk/web2c/eptexdir/eptex.ech	2018-09-04 08:43:32 UTC (rev 48573)
+++ trunk/Build/source/texk/web2c/eptexdir/eptex.ech	2018-09-04 11:29:21 UTC (rev 48574)
@@ -8,8 +8,12 @@
 %% \lastnodesubtype: the (internal) subtype of the last node
 %%   -1: null
 %%   fallback to 0 if not explicitly set
+%% \readpapersizespecial
+%%  1: papersize special automatically sets \pdfpage{width,height} (quick hack).
+%%  0: off
+%%  The default value is 1.
+%%
 
-
 @x e-pTeX: logo
 \def\eTeX{$\varepsilon$-\TeX}
 @y
@@ -22,8 +26,8 @@
 @y
 @d eTeX_version_string=='-2.6' {current \eTeX\ version}
 @#
- at d epTeX_version_string=='-180518'
- at d epTeX_version_number==180518
+ at d epTeX_version_string=='-180901'
+ at d epTeX_version_number==180901
 @z
 
 @x e-pTeX: banner
@@ -66,6 +70,22 @@
 @d set_box_dir(#) == subtype(#):=box_lr(#)*16+set_box_dir_end
 @z
 
+ at x [17]
+ at d saving_hyph_codes_code=etex_int_base+8 {save hyphenation codes for languages}
+ at d eTeX_state_code=etex_int_base+9 {\eTeX\ state variables}
+ at y
+ at d saving_hyph_codes_code=etex_int_base+8 {save hyphenation codes for languages}
+ at d read_papersize_special_code=etex_int_base+9
+ at d eTeX_state_code=etex_int_base+10 {\eTeX\ state variables}
+ at z
+
+ at x [17]
+ at d saving_hyph_codes==int_par(saving_hyph_codes_code)
+ at y
+ at d saving_hyph_codes==int_par(saving_hyph_codes_code)
+ at d read_papersize_special==int_par(read_papersize_special_code)
+ at z
+
 @x [26.413] l.8343 - e-pTeX: scan_something_internal
 var m:halfword; {|chr_code| part of the operand token}
 @y
@@ -240,6 +260,15 @@
 @d set_box_lr_end(#) == qi(16*(#))
 @z
 
+ at x [35]
+@<Initialize table entries...@>=
+text_baseline_shift_factor:=1000;
+ at y
+@<Initialize table entries...@>=
+text_baseline_shift_factor:=1000;
+read_papersize_special:=1;
+ at z
+
 @x
 @!last_node_type:integer; {used to implement \.{\\lastnodetype}}
 @y
@@ -469,6 +498,21 @@
 last_node_subtype_code: print_esc("lastnodesubtype");
 @z
 
+ at x
+primitive("savinghyphcodes",assign_int,int_base+saving_hyph_codes_code);@/
+@!@:saving_hyph_codes_}{\.{\\savinghyphcodes} primitive@>
+ at y
+primitive("savinghyphcodes",assign_int,int_base+saving_hyph_codes_code);@/
+@!@:saving_hyph_codes_}{\.{\\savinghyphcodes} primitive@>
+primitive("readpapersizespecial",assign_int,int_base+read_papersize_special_code);@/
+@!@:read_papersize_special_}{\.{\\readpapersizespecial} primitive@>
+ at z
+
+ at x
+saving_hyph_codes_code:print_esc("savinghyphcodes");
+ at y
+read_papersize_special_code:print_esc("readpapersizespecial");
+ at z
 @x e-pTeX: font_char_{wd,ht,dp,ic}_code l.27306
   if (font_bc[q]<=cur_val)and(font_ec[q]>=cur_val) then
     begin i:=char_info(q)(qi(cur_val));

Modified: trunk/Build/source/texk/web2c/eptexdir/eptex_version.h
===================================================================
--- trunk/Build/source/texk/web2c/eptexdir/eptex_version.h	2018-09-04 08:43:32 UTC (rev 48573)
+++ trunk/Build/source/texk/web2c/eptexdir/eptex_version.h	2018-09-04 11:29:21 UTC (rev 48574)
@@ -1 +1 @@
-#define EPTEX_VERSION "180518"
+#define EPTEX_VERSION "180901"

Modified: trunk/Build/source/texk/web2c/eptexdir/pdfutils.ch
===================================================================
--- trunk/Build/source/texk/web2c/eptexdir/pdfutils.ch	2018-09-04 08:43:32 UTC (rev 48573)
+++ trunk/Build/source/texk/web2c/eptexdir/pdfutils.ch	2018-09-04 11:29:21 UTC (rev 48574)
@@ -8,7 +8,6 @@
 %%
 %% \pdfsavepos and co.
 %%   (\pdfsavepos, \pdfpage{width,height}, \pdflast{x,y}pos)
-%%   papersize special automatically sets \pdfpage{width,height} (quick hack).
 %%
 %% \pdffiledump: for bmpsize package by Heiko Oberdiek
 %%
@@ -1197,7 +1196,7 @@
 label done;
 var old_setting:0..max_selector; {holds print |selector|}
 @!k:pool_pointer; {index into |str_pool|}
-@!s,@!t,@!cw: scaled;
+@!s,@!t,@!cw, @!num, @!denom: scaled;
 @!bl: boolean;
 @!i: small_number;
 @z
@@ -1205,7 +1204,8 @@
 @x
 pool_ptr:=str_start[str_ptr]; {erase the string}
 @y
-@<Determine whether this \.{\\special} is a papersize special@>;
+if read_papersize_special>0 then
+  @<Determine whether this \.{\\special} is a papersize special@>;
 done: pool_ptr:=str_start[str_ptr]; {erase the string}
 @z
 
@@ -1460,56 +1460,97 @@
 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 \hbox{\epTeX}),
-the papersize special \.{\\special\{papersize=|width|,|height|\}} is commonly used
-for specifying page width/height. Hence, I decided that the papersize special also
+adopted \.{\\pdfpageheight} primitive from pdf\TeX. 
+
+In \pTeX (and \hbox{\epTeX}), the papersize special 
+\.{\\special\{papersize=\<width>,\<height>\}} is commonly used
+for specifying page width/height. 
+If \.{\\readpapersizespecial} is greater than~0, the papersize special also
 changes the value of \.{\\pdfpagewidth} and \.{\\pdfpageheight}.
-The following routine does this.
+This process is done in the following routine.
 
-In present implementation, the ``valid'' papersize special, which can be interpreted by
-this routine, is in the following form:
-$$\hbox{\.{\\special\char"7Bpapersize=}$x$\.{pt,}$y$\.{pt\char"7D}}$$
-where $x$\thinspace pt and $y$\thinspace 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.
+{\def\<#1>{\langle\hbox{#1\/}\rangle}
+In present implementation, the papersize special $\<special>$, 
+which can be interpreted by this routine, is defined as follows.
+$$\eqalign{%
+  \<special> &\longrightarrow \.{papersize=}\<length>\.{,}\<length>\cr
+  \<length>  &\longrightarrow \<decimal> 
+    \<optional~\.{true}>\<physical unit>\cr
+  \<decimal> &\longrightarrow \.{.} \mid \<digit>\<decimal> \mid
+    \<decimal>\<digit>\cr
+}$$}
+Note that any space, ``\.{,}'' as a decimal separator, minus~symbol
+are neither permitted.
 
- at d ifps==if k=pool_ptr then goto done else if
- at d sop(#)==so(str_pool[(#)])
+ at d ifps(#)==@+if k+(#)>pool_ptr then goto done @+ else @+ if
+ at d sop(#)==so(str_pool[#])
+ at f ifps==if
 
 @<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);
+begin k:=str_start[str_ptr];@/
+ifps(10) @,
+   (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')or
+   (sop(k+9)<>'=')  then goto done;
+k:=k+10;
 @<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
+ifps(1) @, sop(k)=',' then begin 
+  incr(k); cw:=s;
+  @<Read dimensions in the argument in the papersize special@>;
+  if pool_ptr>k then goto done;
+  geq_word_define(dimen_base+pdf_page_width_code,cw);
+  geq_word_define(dimen_base+pdf_page_height_code,s);@|
+  cur_page_height := s; 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;
+end;
+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;
+@
+
+ at d if_ps_unit(#)==if bl then @+ begin @+ ifps(2) sop(k)=(#) @, if_ps_unit_two
+ at d if_ps_unit_two(#)==and (sop(k+1)=(#)) then begin bl:=false; k:=k+2; if_ps_unit_end
+ at d if_ps_unit_end(#)==# @+ end @+ end;
+
+ at d do_ps_conversion(#)==num:=#; do_ps_conversion_end
+ at d do_ps_conversion_end(#)==
+  s:=xn_over_d(s,num,#); s:=s*unity+((num*t+@'200000*remainder) div #)
+
+@<Read dimensions in the argument in the papersize special@>=
+s:=0; t:=0; bl:=true;
+while (k<pool_ptr)and bl do
+  if (sop(k)>='0')and (sop(k)<='9') then begin s:=10*s+sop(k)-'0'; incr(k); @+end
+  else bl:=false;
+ifps(1) sop(k)='.' then 
+  begin incr(k); bl:=true; i:=0; dig[0]:=0;
+  while (k<pool_ptr)and bl do begin
+    if (sop(k)>='0')and (sop(k)<='9') then
+      begin if i<17 then begin dig[i]:=sop(k)-'0'; incr(i); @+end;
+      incr(k); end
+    else bl:=false;
+  end;
+  t:=round_decimals(i);
+  end;
+if k+4>pool_ptr then
+  if (sop(k)='t')and(sop(k+1)='r')and(sop(k+2)='u')and(sop(k+3)='e') then
+    k:=k+4;
+if mag<>1000 then 
+  begin s:=xn_over_d(s,1000,mag);
+  t:=(1000*t+@'200000*remainder) div mag;
+  s:=s+(t div @'200000); t:=t mod @'200000;
 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;
+bl:=true;@/
+if_ps_unit('p')('t')(s:=s*unity+t)@/
+if_ps_unit('i')('n')(do_ps_conversion(7227)(100))@/
+if_ps_unit('p')('c')(do_ps_conversion(12)(1))@/
+if_ps_unit('c')('m')(do_ps_conversion(7227)(254))@/
+if_ps_unit('m')('m')(do_ps_conversion(7227)(2540))@/
+if_ps_unit('b')('p')(do_ps_conversion(7227)(7200))@/
+if_ps_unit('d')('d')(do_ps_conversion(1238)(1157))@/
+if_ps_unit('c')('c')(do_ps_conversion(14856)(1157))@/
+if_ps_unit('s')('p')(do_nothing)
 
 @ Finally, we declare some routine needed for \.{\\pdffilemoddate}.
 

Added: trunk/Build/source/texk/web2c/eptexdir/tests/pdforigin.sh
===================================================================
--- trunk/Build/source/texk/web2c/eptexdir/tests/pdforigin.sh	                        (rev 0)
+++ trunk/Build/source/texk/web2c/eptexdir/tests/pdforigin.sh	2018-09-04 11:29:21 UTC (rev 48574)
@@ -0,0 +1,10 @@
+#!/bin/bash
+etex pdforigin.tex && etex pdforigin.tex
+dvips pdforigin
+ps2pdf pdforigin.ps && mv pdforigin.pdf pdforigin_etex_dvips.pdf
+dvipdfmx pdforigin && mv pdforigin.pdf pdforigin_etex_dvipdfmx.pdf
+eptex pdforigin.tex && eptex pdforigin.tex
+dvipdfmx pdforigin && mv pdforigin.pdf pdforigin_eptex_dvipdfmx.pdf
+pdftex pdforigin.tex && pdftex pdforigin.tex && mv pdforigin.pdf pdforigin_pdftex.pdf
+xetex pdforigin.tex && xetex pdforigin.tex && mv pdforigin.pdf pdforigin_xetex.pdf
+


Property changes on: trunk/Build/source/texk/web2c/eptexdir/tests/pdforigin.sh
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+LF
\ No newline at end of property
Added: trunk/Build/source/texk/web2c/eptexdir/tests/pdforigin.tex
===================================================================
--- trunk/Build/source/texk/web2c/eptexdir/tests/pdforigin.tex	                        (rev 0)
+++ trunk/Build/source/texk/web2c/eptexdir/tests/pdforigin.tex	2018-09-04 11:29:21 UTC (rev 48574)
@@ -0,0 +1,40 @@
+\mag=3000
+
+\newdimen\XPOS\newdimen\YPOS\newread\TMP
+\openin\TMP=\jobname.tmp
+\ifeof\TMP\else\closein\TMP\input \jobname.tmp\fi
+\immediate\openout\TMP=\jobname.tmp
+\topskip0pt
+\ifdefined\pagewidth
+  \pagewidth=10truein\pageheight=10truein
+\else\ifdefined\pdfpagewidth
+  \pdfpagewidth=10truein\pdfpageheight=10truein
+\fi\fi
+
+\shipout\hbox{%
+  \special{papersize=10truein,10truein}%
+  \pdfsavepos%
+  \write\TMP{\noexpand\XPOS=\the\pdflastxpos sp\noexpand\YPOS=\the\pdflastypos sp}%
+  \smash{%
+    \llap{\hss\vrule height 1pt depth 0pt width \XPOS}%
+    \llap{\hss\vrule height 2.4pt depth -2pt width 1in}%
+    \llap{\hss\vrule height 4pt depth -3.2pt width 1truein}%
+    \llap{\vrule height 1in depth 0pt width 0.4pt\kern.8pt%
+    \vrule height 1truein depth 0pt width 0.8pt}%
+	\rlap{%
+	\vrule height 0pt depth \dimexpr\YPOS+5truept width .4pt\kern.8pt
+	\vrule height 0pt depth \dimexpr\YPOS+4truept width .4pt\kern.8pt
+	\vrule height 0pt depth \dimexpr\YPOS+3truept width .4pt\kern.8pt
+	\vrule height 0pt depth \dimexpr\YPOS+2truept width .4pt\kern.8pt
+	\vrule height 0pt depth \dimexpr\YPOS+1truept width .4pt\kern.8pt
+	\vrule height 0pt depth \dimexpr\YPOS width .8pt\kern.8pt
+	\vrule height 0pt depth \dimexpr\YPOS-1truept width .4pt\kern.8pt
+	\vrule height 0pt depth \dimexpr\YPOS-2truept width .4pt\kern.8pt
+	\vrule height 0pt depth \dimexpr\YPOS-3truept width .4pt\kern.8pt
+	\vrule height 0pt depth \dimexpr\YPOS-4truept width .4pt\kern.8pt
+	\vrule height 0pt depth \dimexpr\YPOS-5truept width .4pt\kern.8pt%
+	}%
+  }%
+}
+\end
+


Property changes on: trunk/Build/source/texk/web2c/eptexdir/tests/pdforigin.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Build/source/texk/web2c/eptexdir/tests/pdfpagewidth.tex
===================================================================
--- trunk/Build/source/texk/web2c/eptexdir/tests/pdfpagewidth.tex	                        (rev 0)
+++ trunk/Build/source/texk/web2c/eptexdir/tests/pdfpagewidth.tex	2018-09-04 11:29:21 UTC (rev 48574)
@@ -0,0 +1,24 @@
+%#!eptex
+
+\def\TEST#1{%
+  \pdfpagewidth0pt\pdfpageheight0pt
+  \shipout\hbox{\special{#1}}%
+  \message{<\the\pdfpagewidth, \the\pdfpageheight>}%
+}
+\count0=0
+\readpapersizespecial=1
+\TEST{papersize=10pt,20pt} % OK
+\TEST{papersize=10pt,20zw} % `zw' is not supported
+\TEST{papersize=10pt,20ex} % `ex' is neither
+\TEST{papersize=1pt,2}     % no unit
+\TEST{papersize 10pc,20pc}  % there is no `='
+\TEST{papersize=10pcA,20pc}% 
+\TEST{papersize=10pc,20pcs}% 
+\TEST{papersize=10pt,-20pt}% negative value
+\TEST{papersize=0pt,20000.6sp}% OK
+\TEST{papersize=30.2pt,665pt}% OK
+
+\readpapersizespecial=0
+\TEST{papersize=10pt,20pt}
+
+\end


Property changes on: trunk/Build/source/texk/web2c/eptexdir/tests/pdfpagewidth.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property


More information about the tex-live-commits mailing list