summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/eptexdir/pdfutils.ch
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/web2c/eptexdir/pdfutils.ch')
-rw-r--r--Build/source/texk/web2c/eptexdir/pdfutils.ch80
1 files changed, 74 insertions, 6 deletions
diff --git a/Build/source/texk/web2c/eptexdir/pdfutils.ch b/Build/source/texk/web2c/eptexdir/pdfutils.ch
index 88f80935ebc..36e821d1f9a 100644
--- a/Build/source/texk/web2c/eptexdir/pdfutils.ch
+++ b/Build/source/texk/web2c/eptexdir/pdfutils.ch
@@ -27,6 +27,8 @@
%% \expanded
%%
%% \ifincsname
+%%
+%% \Uchar, \Ucharcat
@x
@* \[8] Packed data.
@@ -830,6 +832,33 @@ else if cur_tok=cs_token_flag+frozen_primitive then
@<Reset |cur_tok| for unexpandable primitives, goto restart@>
@z
+@x \Ucharcat: str_toks_cat
+function str_toks(@!b:pool_pointer):pointer;
+@y
+function str_toks_cat(@!b:pool_pointer;@!cat:small_number):pointer;
+@z
+
+@x \Ucharcat: str_toks_cat
+ else if t=" " then t:=space_token
+ else t:=other_token+t;
+@y
+ else if (t=" ")and(cat=0) then t:=space_token
+ else if (cat=0)or(cat>=kanji) then t:=other_token+t
+ else if cat=active_char then t:= cs_token_flag + active_base + t
+ else t:=left_brace_token*cat+t;
+@z
+
+@x \Ucharcat: str_toks_cat
+pool_ptr:=b; str_toks:=p;
+end;
+@y
+pool_ptr:=b; str_toks_cat:=p;
+end;
+
+function str_toks(@!b:pool_pointer):pointer;
+begin str_toks:=str_toks_cat(b,0); end;
+@z
+
@x
@d etex_convert_codes=etex_convert_base+1 {end of \eTeX's command codes}
@d job_name_code=etex_convert_codes {command code for \.{\\jobname}}
@@ -846,15 +875,18 @@ else if cur_tok=cs_token_flag+frozen_primitive then
@d uniform_deviate_code = pdf_first_expand_code+6 {command code for \.{\\pdfuniformdeviate}}
@d normal_deviate_code = pdf_first_expand_code+7 {command code for \.{\\pdfnormaldeviate}}
@d pdf_convert_codes = pdf_first_expand_code+8 {end of \pdfTeX-like command codes}
-@d job_name_code=pdf_convert_codes {command code for \.{\\jobname}}
+@d Uchar_convert_code = pdf_convert_codes {command code for \.{\\Uchar}}
+@d Ucharcat_convert_code = pdf_convert_codes+1 {command code for \.{\\Ucharcat}}
+@d eptex_convert_codes = pdf_convert_codes+2 {end of \epTeX's command codes}
+@d job_name_code=eptex_convert_codes {command code for \.{\\jobname}}
@z
@x
primitive("jobname",convert,job_name_code);@/
@y
@#
-primitive("expanded",convert,expanded_code);@/
-@!@:expanded_}{\.{\\expanded} primitive@>
+primitive("expanded",convert,expanded_code);@/
+@!@:expanded_}{\.{\\expanded} primitive@>
@#
primitive("jobname",convert,job_name_code);@/
@z
@@ -872,6 +904,8 @@ primitive("jobname",convert,job_name_code);@/
pdf_file_dump_code: print_esc("pdffiledump");
uniform_deviate_code: print_esc("pdfuniformdeviate");
normal_deviate_code: print_esc("pdfnormaldeviate");
+ Uchar_convert_code: print_esc("Uchar");
+ Ucharcat_convert_code: print_esc("Ucharcat");
@z
@x
@@ -885,6 +919,10 @@ we have to create a temporary string that is destroyed immediately after.
@d save_cur_string==if str_start[str_ptr]<pool_ptr then u:=make_string else u:=0
@d restore_cur_string==if u<>0 then decr(str_ptr)
+@ Not all catcode values are allowed by \.{\\Ucharcat}:
+@d illegal_Ucharcat_ascii_catcode(#)==(#<left_brace)or(#>active_char)or(#=out_param)or(#=ignore)
+@d illegal_Ucharcat_wchar_catcode(#)==(#<kanji)or(#>other_kchar)
+
@p procedure conv_toks;
@z
@@ -899,16 +937,23 @@ we have to create a temporary string that is destroyed immediately after.
@!s: str_number; {first temp string}
@!i: integer;
@!j: integer;
+@!cat:small_number; {desired catcode, or 0 for automatic |spacer|/|other_char| selection}
@z
@x
begin c:=cur_chr; @<Scan the argument for command |c|@>;
@y
-begin c:=cur_chr; @<Scan the argument for command |c|@>;
+begin cat:=0; c:=cur_chr; @<Scan the argument for command |c|@>;
u:=0; { will become non-nil if a string is already being built}
@z
@x
+selector:=old_setting; link(garbage):=str_toks(b); ins_list(link(temp_head));
+@y
+selector:=old_setting; link(garbage):=str_toks_cat(b,cat); ins_list(link(temp_head));
+@z
+
+@x
eTeX_revision_code: do_nothing;
@y
eTeX_revision_code: do_nothing;
@@ -1061,6 +1106,21 @@ pdf_file_dump_code:
end;
uniform_deviate_code: scan_int;
normal_deviate_code: do_nothing;
+Uchar_convert_code: scan_char_num;
+Ucharcat_convert_code:
+ begin
+ scan_ascii_num;
+ i:=cur_val;
+ scan_int;
+ if illegal_Ucharcat_ascii_catcode(cur_val) then
+ begin print_err("Invalid code ("); print_int(cur_val);
+@.Invalid code@>
+ print("), should be in the ranges 1..4, 6..8, 10..13");
+ help1("I'm going to use 12 instead of that illegal code value.");@/
+ error; cat:=12;
+ end else cat:=cur_val;
+ cur_val:=i;
+ end;
@z
@x
@@ -1070,6 +1130,10 @@ eTeX_revision_code: print(eTeX_revision);
pdf_strcmp_code: print_int(cur_val);
uniform_deviate_code: print_int(unif_rand(cur_val));
normal_deviate_code: print_int(norm_rand);
+Uchar_convert_code:
+if is_char_ascii(cur_val) then print_char(cur_val) else print_kanji(cur_val);
+Ucharcat_convert_code:
+if cat<kanji then print_char(cur_val) else print_kanji(cur_val);
@z
@x e-pTeX: if primitives - leave room for \ifincsname
@@ -1313,6 +1377,10 @@ primitive("pdfelapsedtime",last_item,elapsed_time_code);
@!@:elapsed_time_}{\.{\\pdfelapsedtime} primitive@>
primitive("pdfresettimer",extension,reset_timer_code);@/
@!@:reset_timer_}{\.{\\pdfresettimer} primitive@>
+primitive("Uchar",convert,Uchar_convert_code);@/
+@!@:Uchar_}{\.{\\Uchar} primitive@>
+primitive("Ucharcat",convert,Ucharcat_convert_code);@/
+@!@:Ucharcat_}{\.{\\Ucharcat} primitive@>
@z
@x
@@ -1599,7 +1667,7 @@ 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
+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
@@ -1612,7 +1680,7 @@ ifps(1) sop(k)='.' then
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
+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;