texlive[45249] Build/source/texk: \epTeXinputencoding works also with
commits+hironobu at tug.org
commits+hironobu at tug.org
Sat Sep 9 19:17:11 CEST 2017
Revision: 45249
http://tug.org/svn/texlive?view=revision&revision=45249
Author: hironobu
Date: 2017-09-09 19:17:10 +0200 (Sat, 09 Sep 2017)
Log Message:
-----------
\epTeXinputencoding works also with the terminal (H. Kitagawa and N. Abe)
Modified Paths:
--------------
trunk/Build/source/texk/ptexenc/ChangeLog
trunk/Build/source/texk/ptexenc/ptexenc/ptexenc.h
trunk/Build/source/texk/ptexenc/ptexenc.c
trunk/Build/source/texk/web2c/eptexdir/ChangeLog
trunk/Build/source/texk/web2c/eptexdir/eptex.defines
trunk/Build/source/texk/web2c/eptexdir/eptex.ech
trunk/Build/source/texk/web2c/euptexdir/ChangeLog
trunk/Build/source/texk/web2c/euptexdir/euptex.defines
Modified: trunk/Build/source/texk/ptexenc/ChangeLog
===================================================================
--- trunk/Build/source/texk/ptexenc/ChangeLog 2017-09-09 00:21:22 UTC (rev 45248)
+++ trunk/Build/source/texk/ptexenc/ChangeLog 2017-09-09 17:17:10 UTC (rev 45249)
@@ -1,3 +1,8 @@
+2017-09-09 Hironori Kitagawa <h_kitagawa2001 at yahoo.co.jp>
+
+ * ptexenc.c, ptexenc/ptexenc.h: Add a new function setstdinenc() for the
+ primitive \epTeXinputencoding in e-(u)pTeX.
+
2017-03-18 Karl Berry <karl at tug.org>
* version.ac (ptexenc_version): 1.3.5dev => 1.3.5 for TL17.
Modified: trunk/Build/source/texk/ptexenc/ptexenc/ptexenc.h
===================================================================
--- trunk/Build/source/texk/ptexenc/ptexenc/ptexenc.h 2017-09-09 00:21:22 UTC (rev 45248)
+++ trunk/Build/source/texk/ptexenc/ptexenc/ptexenc.h 2017-09-09 17:17:10 UTC (rev 45249)
@@ -83,6 +83,7 @@
/* set current encoding */
extern PTENCDLL boolean setinfileenc(FILE *fp, const char *str);
+extern PTENCDLL boolean setstdinenc(const char *str);
#ifdef WIN32
extern PTENCDLL void clear_infile_enc(FILE *fp);
Modified: trunk/Build/source/texk/ptexenc/ptexenc.c
===================================================================
--- trunk/Build/source/texk/ptexenc/ptexenc.c 2017-09-09 00:21:22 UTC (rev 45248)
+++ trunk/Build/source/texk/ptexenc/ptexenc.c 2017-09-09 17:17:10 UTC (rev 45249)
@@ -840,6 +840,7 @@
return last;
}
+// set encode of stdin if fp = NULL
boolean setinfileenc(FILE *fp, const char *str)
{
int enc;
@@ -849,6 +850,15 @@
return true;
}
+boolean setstdinenc(const char *str)
+{
+ int enc;
+ enc = string_to_enc(str);
+ if (enc < 0) return false;
+ infile_enc[fileno(stdin)] = enc;
+ return true;
+}
+
#ifdef WIN32
void clear_infile_enc(FILE *fp)
{
Modified: trunk/Build/source/texk/web2c/eptexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/eptexdir/ChangeLog 2017-09-09 00:21:22 UTC (rev 45248)
+++ trunk/Build/source/texk/web2c/eptexdir/ChangeLog 2017-09-09 17:17:10 UTC (rev 45249)
@@ -1,3 +1,9 @@
+2017-09-09 Hironori Kitagawa <h_kitagawa2001 at yahoo.co.jp>
+ and Noriyuki Abe <abenori at math.sci.hokudai.ac.jp>
+
+ * eptex.ech: \epTeXinputencoding works also with the terminal.
+ * eptex.defines: Add a new function setstdinenc().
+
2017-09-06 Noriyuki Abe <abenori at math.sci.hokudai.ac.jp>
* eptex.ech: fix a bug in \epTeXinputencoding.
Modified: trunk/Build/source/texk/web2c/eptexdir/eptex.defines
===================================================================
--- trunk/Build/source/texk/web2c/eptexdir/eptex.defines 2017-09-09 00:21:22 UTC (rev 45248)
+++ trunk/Build/source/texk/web2c/eptexdir/eptex.defines 2017-09-09 17:17:10 UTC (rev 45249)
@@ -20,6 +20,7 @@
@define function inputline2 ();
@define function setinfileenc ();
+ at define function setstdinenc ();
@define function fromJIS ();
@define function fromEUC ();
Modified: trunk/Build/source/texk/web2c/eptexdir/eptex.ech
===================================================================
--- trunk/Build/source/texk/web2c/eptexdir/eptex.ech 2017-09-09 00:21:22 UTC (rev 45248)
+++ trunk/Build/source/texk/web2c/eptexdir/eptex.ech 2017-09-09 17:17:10 UTC (rev 45249)
@@ -339,19 +339,52 @@
@x
@ @<Finish the extensions@>=
@y
-@ @<Implement \.{\\epTeXinputencoding}@>=
- begin
- scan_file_name;
- pack_cur_name;
- if setinfileenc(input_file[in_open],stringcast(name_of_file+1)) = false then
- begin
- wlog_cr;
- wlog('Unknown encoding `');
- fputs(stringcast(name_of_file + 1), log_file);
- wlog('''');
+@ @<Declare procedures needed in |do_ext...@>=
+procedure eptex_set_input_encoding;
+var j,k:integer;
+begin
+ scan_file_name;
+ pack_cur_name;
+ if state=token_list then
+ begin k:=input_ptr-1; j:=-1;
+ while k>=0 do
+ begin if input_stack[k].state_field=token_list then decr(k)
+ else if input_stack[k].name_field>19 then
+ begin j:=input_stack[k].index_field; k:=-1; end
+ else begin j:=-(name+1); k:=-1; end
+ end
end
- end
+ else if name>19 then j:=index else j:=-(name+1);
+ if (j>=0) or (j=-1) or (j=-18) then begin
+ k:=true;
+ if j>= 0 then k:=setinfileenc(input_file[j],stringcast(name_of_file+1))
+ else k:=setstdinenc(stringcast(name_of_file+1));
+ if k = false then
+ begin begin_diagnostic;
+ print_nl("Unknown encoding `");
+ case selector of
+ term_and_log: begin wterm(stringcast(name_of_file + 1));
+ wlog(stringcast(name_of_file + 1)); end;
+ log_only: wlog(stringcast(name_of_file + 1));
+ term_only: wterm(stringcast(name_of_file + 1));
+ endcases;
+ print("'"); end_diagnostic(false);
+ end
+ end
+ else
+ begin begin_diagnostic; j:=-j-1;
+ print_ln;
+ print_nl("Warning: \epTeXinputencoding is ignored, since I am current reading");
+ print_nl("from ");
+ if j>=18 then print("a pseudo file created by \scantokens.")
+ else begin print("input stream "); print_int(j); print("."); end;
+ end_diagnostic(false);
+ end
+end;
+@ @<Implement \.{\\epTeXinputencoding}@>=
+eptex_set_input_encoding
+
@ @<Finish the extensions@>=
@z
Modified: trunk/Build/source/texk/web2c/euptexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/euptexdir/ChangeLog 2017-09-09 00:21:22 UTC (rev 45248)
+++ trunk/Build/source/texk/web2c/euptexdir/ChangeLog 2017-09-09 17:17:10 UTC (rev 45249)
@@ -1,3 +1,7 @@
+2017-09-09 Hironori Kitagawa <h_kitagawa2001 at yahoo.co.jp>
+
+ * euptex.defines: Add a new function setstdinenc().
+
2017-04-24 Hironori Kitagawa <h_kitagawa2001 at yahoo.co.jp>
* euptex.ch0: Adapt to changes in ptexdir/ptex-base.ch (p\TeX -> \pTeX).
Modified: trunk/Build/source/texk/web2c/euptexdir/euptex.defines
===================================================================
--- trunk/Build/source/texk/web2c/euptexdir/euptex.defines 2017-09-09 00:21:22 UTC (rev 45248)
+++ trunk/Build/source/texk/web2c/euptexdir/euptex.defines 2017-09-09 17:17:10 UTC (rev 45249)
@@ -25,6 +25,7 @@
@define function inputline2 ();
@define function setinfileenc ();
+ at define function setstdinenc ();
@define function fromJIS ();
@define function fromEUC ();
More information about the tex-live-commits
mailing list