Hi Thanh,
the attached last-minute-patch to pdftex.ch contains:
1. Akira's identification of binary PDF file, now by special string
"PTEX" with 128 added to each ASCII char (highest bit set).
2. Taco's fix for compile time warnings (without the tex-k one).
3. And i would like to propose to change the register \pdfstrcompresult
into simple \pdfretval. Reason is that it would be nice to have a global
integer "return value" register for general use with utility functions,
e. g. to check whether image embedding failed or so, and i also need
such a return value register for map related stuff...
When i saw that \pdfstrcompresult is already a typical integer return
value for \pdfstrcomp, i thought that this would be the ideal moment to
start a \pdfretval. After the patch, comparison by \pdfstrcomp would set
\pdfretval to -1, 0, or 1.
You sure will have ideas for what to set \pdfretval. It then normally
should contain a 0 for "success", some positive value coding various
"fail" conditions, or other e. g. signed values as after \pdfstrcomp...
Question is, who already is using \pdfstrcomp, and whether he can live
with such a new \pdfretval instead?
Regards, Hartmut
--- pdftex.ch.orig 2005-05-24 09:43:10.000000000 +0200
+++ pdftex.ch 2005-05-24 21:33:31.443521131 +0200
@@ -382,7 +382,7 @@
@d pdf_last_annot_code = pdftex_first_rint_code + 5 {code for \.{\\pdflastannot}}
@d pdf_last_x_pos_code = pdftex_first_rint_code + 6 {code for \.{\\pdflastxpos}}
@d pdf_last_y_pos_code = pdftex_first_rint_code + 7 {code for \.{\\pdflastypos}}
-@d pdf_strcmp_result_code = pdftex_first_rint_code + 8 {result of \.{\\pdfstrcmp}}
+@d pdf_retval_code = pdftex_first_rint_code + 8 {global multi-purpose return value}
@d pdf_last_ximage_colordepth_code = pdftex_first_rint_code + 9 {code for \.{\\pdflastximagecolordepth}}
@d elapsed_time_code = pdftex_first_rint_code + 10 {code for \.{\\elapsedtime}}
@d pdftex_last_item_codes = pdftex_first_rint_code + 10 {end of \pdfTeX's command codes}
@@ -410,8 +410,8 @@
@!@:pdf_last_x_pos_}{\.{\\pdflastxpos} primitive@>
primitive("pdflastypos",last_item,pdf_last_y_pos_code);@/
@!@:pdf_last_y_pos_}{\.{\\pdflastypos} primitive@>
-primitive("pdfstrcmpresult",last_item,pdf_strcmp_result_code);@/
-@!@:pdf_strcmp_result_}{\.{\\pdfstrcmpresult} primitive@>
+primitive("pdfretval",last_item,pdf_retval_code);@/
+@!@:pdf_retval_}{\.{\\pdfretval} primitive@>
primitive("pdflastximagecolordepth",last_item,pdf_last_ximage_colordepth_code);@/
@!@:pdf_last_ximage_colordepth_}{\.{\\pdflastximagecolordepth} primitive@>
primitive("elapsedtime",last_item,elapsed_time_code);
@@ -429,7 +429,7 @@
pdf_last_annot_code: print_esc("pdflastannot");
pdf_last_x_pos_code: print_esc("pdflastxpos");
pdf_last_y_pos_code: print_esc("pdflastypos");
- pdf_strcmp_result_code: print_esc("pdfstrcmpresult");
+ pdf_retval_code: print_esc("pdfretval");
pdf_last_ximage_colordepth_code: print_esc("pdflastximagecolordepth");
elapsed_time_code: print_esc("elapsedtime");
othercases print_esc("badness")
@@ -456,7 +456,7 @@
pdf_last_annot_code: cur_val := pdf_last_annot;
pdf_last_x_pos_code: cur_val := pdf_last_x_pos;
pdf_last_y_pos_code: cur_val := pdf_last_y_pos;
- pdf_strcmp_result_code: cur_val := pdf_strcmp_result;
+ pdf_retval_code: cur_val := pdf_retval;
pdf_last_ximage_colordepth_code: cur_val := pdf_last_ximage_colordepth;
elapsed_time_code: cur_val := get_microinterval;
end; {there are no other cases}
@@ -488,7 +488,7 @@
in {\sl Technische Grundlagen zur Satzherstellung\/} (Bern, 1980).
The Didot point has been newly standardized in 1978;
it's now exactly $\rm 1\,nd=0.375\,mm$.
-Conversion uses the equation $0.375=21681/20320/72.27*25.4$.
+Conversion uses the equation $0.375=21681/20320/72.27\cdot25.4$.
The new Cicero follows the new Didot point; $\rm 1\,nc=12\,nd$.
@z
@@ -929,7 +929,13 @@
pdf_buf[6] := ".";
pdf_buf[7] := "4";
pdf_buf[8] := pdf_new_line_char;
-pdf_ptr := 9;
+pdf_buf[9] := "%";
+pdf_buf[10] := 208; {``PTEX''}
+pdf_buf[11] := 212;
+pdf_buf[12] := 197;
+pdf_buf[13] := 216;
+pdf_buf[14] := pdf_new_line_char;
+pdf_ptr := 15;
pdf_gone := 0;
zip_write_state := no_zip;
pdf_minor_version_written := false;
@@ -1212,7 +1218,7 @@
end;
procedure pdf_print_int(n:integer); {print out a integer to PDF buffer}
-var k:0..23; {index to current digit; we assume that $|n|<10^{23}$}
+var k:integer; {index to current digit ($0\le k\le23$); we assume that $|n|<10^{23}$}
m:integer; {used to negate |n| in possibly dangerous cases}
begin
k:=0;
@@ -2012,7 +2018,7 @@
@p procedure pdf_print_fw_int(n, w: integer); {print out an integer with
fixed width; used for outputting cross-reference table}
-var k:0..23;
+var k:integer; {$0\le k\le23$}
begin
k:=0;
repeat dig[k]:=n mod 10; n:=n div 10; incr(k);
@@ -4766,7 +4772,7 @@
else
result := -1;
done:
- pdf_strcmp_result := result;
+ pdf_retval := result;
flush_str(s2);
flush_str(s1);
end;
@@ -5642,7 +5648,7 @@
end
@ @