summaryrefslogtreecommitdiff
path: root/Build/source
diff options
context:
space:
mode:
authorJonathan Kew <jfkthame@googlemail.com>2008-02-20 12:31:51 +0000
committerJonathan Kew <jfkthame@googlemail.com>2008-02-20 12:31:51 +0000
commit0dcc5757f6f505f0ceefc2c15371250aa39275c4 (patch)
treeacbfe7e73ed768f644718f6550c5ef560aeefffe /Build/source
parenteb406813024bc4051d600b430d86f211c23d96b6 (diff)
update for recent e-tex bugfix
git-svn-id: svn://tug.org/texlive/trunk@6691 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeX_ext.c27
-rw-r--r--Build/source/texk/web2c/xetexdir/xetex.ch53
2 files changed, 72 insertions, 8 deletions
diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
index 7a2954e5e99..df871ba4796 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
+++ b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
@@ -2774,6 +2774,7 @@ int
get_uni_c(UFILE* f)
{
int rval;
+ unsigned c;
if (f->savedChar != -1) {
rval = f->savedChar;
@@ -2784,15 +2785,29 @@ get_uni_c(UFILE* f)
switch (f->encodingMode) {
case UTF8:
/* FIXME: we don't currently check for malformed UTF-8 */
- rval = getc(f->f);
+ c = rval = getc(f->f);
if (rval != EOF) {
UInt16 extraBytes = bytesFromUTF8[rval];
switch (extraBytes) { /* note: code falls through cases! */
- case 5: rval <<= 6; rval += getc(f->f);
- case 4: rval <<= 6; rval += getc(f->f);
- case 3: rval <<= 6; rval += getc(f->f);
- case 2: rval <<= 6; rval += getc(f->f);
- case 1: rval <<= 6; rval += getc(f->f);
+ default:
+ bad_utf8:
+ if (rval > 0x100)
+ rval = 0xfffd;
+ f->savedChar = c;
+ case 5:
+ case 4:
+ badutf8warning();
+ f->encodingMode = RAW;
+ return rval;
+ case 3: c = getc(f->f);
+ if (c < 0x80 || c >= 0xc0) goto bad_utf8;
+ rval <<= 6; rval += c;
+ case 2: c = getc(f->f);
+ if (c < 0x80 || c >= 0xc0) goto bad_utf8;
+ rval <<= 6; rval += c;
+ case 1: c = getc(f->f);
+ if (c < 0x80 || c >= 0xc0) goto bad_utf8;
+ rval <<= 6; rval += c;
case 0: ;
};
rval -= offsetsFromUTF8[extraBytes];
diff --git a/Build/source/texk/web2c/xetexdir/xetex.ch b/Build/source/texk/web2c/xetexdir/xetex.ch
index a1e05bbe05e..87a5869b158 100644
--- a/Build/source/texk/web2c/xetexdir/xetex.ch
+++ b/Build/source/texk/web2c/xetexdir/xetex.ch
@@ -1,3 +1,33 @@
+******************************************************************************
+ Part of the XeTeX typesetting system
+ copyright (c) 1994-2008 by SIL International
+ written by Jonathan Kew
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL SIL INTERNATIONAL BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of SIL International
+shall not be used in advertising or otherwise to promote the sale,
+use or other dealings in this Software without prior written
+authorization from SIL International.
+******************************************************************************
+
@x
\def\section{\mathhexbox278}
@y
@@ -7033,10 +7063,14 @@ end else
@x
@ @d adv_past(#)==@+if subtype(#)=language_node then
- begin cur_lang:=what_lang(#); l_hyf:=what_lhm(#); r_hyf:=what_rhm(#);@+end
+ begin cur_lang:=what_lang(#); l_hyf:=what_lhm(#); r_hyf:=what_rhm(#);
+ set_hyph_index;
+ end
@y
@ @d adv_past(#)==@+if subtype(#)=language_node then
- begin cur_lang:=what_lang(#); l_hyf:=what_lhm(#); r_hyf:=what_rhm(#);@+end
+ begin cur_lang:=what_lang(#); l_hyf:=what_lhm(#); r_hyf:=what_rhm(#);
+ set_hyph_index;
+ end
else if (subtype(#)=native_word_node)
or (subtype(#)=glyph_node)
or (subtype(#)=pic_node)
@@ -8679,6 +8713,21 @@ begin
end
end;
+procedure bad_utf8_warning;
+var
+ i: integer;
+begin
+ begin_diagnostic;
+ print_nl("Invalid UTF-8 byte sequence");
+ if terminal_input then print(" in terminal input")
+ else begin
+ print(" at line ");
+ print_int(line);
+ end;
+ print("; reading remainder as raw bytes.");
+ end_diagnostic(false);
+end;
+
@z
@x