summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/xetexdir
diff options
context:
space:
mode:
authorJonathan Kew <jfkthame@googlemail.com>2008-04-25 14:48:35 +0000
committerJonathan Kew <jfkthame@googlemail.com>2008-04-25 14:48:35 +0000
commit12ed7b16e1915c6d5c3453f1bce9b4802de10882 (patch)
tree073ce924de3ed0c18b7656f8009d41dfa961fb85 /Build/source/texk/web2c/xetexdir
parent6ad0c2572b39216cefd820842002f54e65f96ce7 (diff)
XeTeX update (from svn r.655), incl new SyncTeX
git-svn-id: svn://tug.org/texlive/trunk@7643 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/xetexdir')
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeX_ext.c296
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeX_ext.h3
-rw-r--r--Build/source/texk/web2c/xetexdir/xetex.ch75
-rw-r--r--Build/source/texk/web2c/xetexdir/xetex.defines14
-rw-r--r--Build/source/texk/web2c/xetexdir/xetex.mk17
5 files changed, 281 insertions, 124 deletions
diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
index f12f2edd089..0e90547c385 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
+++ b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
@@ -254,7 +254,14 @@ setinputfileencoding(UFILE* f, integer mode, integer encodingData)
UErrorCode err = 0;
UConverter* cnv = ucnv_open(name, &err);
if (cnv == NULL) {
- fprintf(stderr, "! Error %d creating Unicode converter for %s\n", err, name);
+ begindiagnostic();
+ printnl('E');
+ printcstring("rror ");
+ printint(err);
+ printcstring(" creating Unicode converter for `");
+ printcstring(name);
+ printcstring("'; reading as raw bytes");
+ enddiagnostic(1);
f->encodingMode = RAW;
}
else {
@@ -278,66 +285,185 @@ uclose(UFILE* f)
}
}
-int
-input_line_icu(UFILE* f)
+static void
+buffer_overflow()
{
-static char* byteBuffer = NULL;
+ fprintf (stderr, "! Unable to read an entire line---bufsize=%u.\n",
+ (unsigned) bufsize);
+ fputs ("Please increase buf_size in texmf.cnf.\n", stderr);
+ uexit (1);
+}
- UInt32 bytesRead = 0;
- int i;
- UConverter* cnv;
- int outLen;
- UErrorCode errorCode = 0;
+static void
+conversion_error(int errcode)
+{
+ begindiagnostic();
+ printnl('U');
+ printcstring("nicode conversion failed (ICU error code = ");
+ printint(errcode);
+ printcstring(") discarding any remaining text");
+ enddiagnostic(1);
+}
- if (byteBuffer == NULL)
- byteBuffer = xmalloc(bufsize + 1);
+#ifdef WORDS_BIGENDIAN
+#define NATIVE_UTF32 kForm_UTF32BE
+#else
+#define NATIVE_UTF32 kForm_UTF32LE
+#endif
- /* Recognize either LF or CR as a line terminator; skip initial LF if prev line ended with CR. */
- i = getc(f->f);
- if (f->skipNextLF) {
- f->skipNextLF = 0;
- if (i == '\n')
- i = getc(f->f);
+static void
+apply_normalization(UInt32* buf, int len, int norm)
+{
+ static TECkit_Converter normalizers[2] = { NULL, NULL };
+
+ TECkit_Status status;
+ UInt32 inUsed, outUsed;
+ TECkit_Converter *normPtr = &normalizers[norm - 1];
+ if (*normPtr == NULL) {
+ status = TECkit_CreateConverter(NULL, 0, 1,
+ NATIVE_UTF32, NATIVE_UTF32 | (norm == 1 ? kForm_NFC : kForm_NFD),
+ &*normPtr);
+ if (status != kStatus_NoError) {
+ fprintf(stderr, "! Failed to create normalizer: error code = %d\n", (int)status);
+ uexit (1);
+ }
}
- if (i != EOF && i != '\n' && i != '\r')
- byteBuffer[bytesRead++] = i;
- if (i != EOF && i != '\n' && i != '\r')
- while (bytesRead < bufsize && (i = getc(f->f)) != EOF && i != '\n' && i != '\r')
+ status = TECkit_ConvertBuffer(*normPtr, (Byte*)buf, len * sizeof(UInt32), &inUsed,
+ (Byte*)&buffer[first], sizeof(*buffer) * (bufsize - first), &outUsed, 1);
+ if (status != kStatus_NoError)
+ buffer_overflow();
+ last = first + outUsed / sizeof(*buffer);
+}
+
+#ifdef WORDS_BIGENDIAN
+#define UCNV_UTF32_NativeEndian UCNV_UTF32_BigEndian
+#else
+#define UCNV_UTF32_NativeEndian UCNV_UTF32_LittleEndian
+#endif
+
+int
+input_line(UFILE* f)
+{
+static char* byteBuffer = NULL;
+static UInt32 *utf32Buf = NULL;
+ int i, tmpLen;
+
+ int norm = getinputnormalizationstate();
+
+ if (f->encodingMode == ICUMAPPING) {
+ UInt32 bytesRead = 0;
+ UConverter* cnv;
+ int outLen;
+ UErrorCode errorCode = 0;
+
+ if (byteBuffer == NULL)
+ byteBuffer = xmalloc(bufsize + 1);
+
+ /* Recognize either LF or CR as a line terminator; skip initial LF if prev line ended with CR. */
+ i = getc(f->f);
+ if (f->skipNextLF) {
+ f->skipNextLF = 0;
+ if (i == '\n')
+ i = getc(f->f);
+ }
+
+ if (i != EOF && i != '\n' && i != '\r')
byteBuffer[bytesRead++] = i;
+ if (i != EOF && i != '\n' && i != '\r')
+ while (bytesRead < bufsize && (i = getc(f->f)) != EOF && i != '\n' && i != '\r')
+ byteBuffer[bytesRead++] = i;
+
+ if (i == EOF && errno != EINTR && last == first)
+ return false;
+
+ if (i != EOF && i != '\n' && i != '\r')
+ buffer_overflow();
+
+ /* now apply the mapping to turn external bytes into Unicode characters in buffer */
+ cnv = (UConverter*)(f->conversionData);
+ switch (norm) {
+ case 1: // NFC
+ case 2: // NFD
+ if (utf32Buf == NULL)
+ utf32Buf = (UInt32*)xmalloc(bufsize * sizeof(*utf32Buf));
+ tmpLen = ucnv_toAlgorithmic(UCNV_UTF32_NativeEndian, cnv,
+ (char*)utf32Buf, bufsize * sizeof(*utf32Buf),
+ byteBuffer, bytesRead, &errorCode);
+ if (errorCode != 0) {
+ conversion_error((int)errorCode);
+ return false;
+ }
+ apply_normalization(utf32Buf, tmpLen / sizeof(*utf32Buf), norm); // sets 'last' correctly
+ break;
- if (i == EOF && errno != EINTR && last == first)
- return false;
-
- if (i != EOF && i != '\n' && i != '\r') {
- fprintf (stderr, "! Unable to read an entire line---bufsize=%u.\n",
- (unsigned) bufsize);
- fputs ("Please increase buf_size in texmf.cnf.\n", stderr);
- uexit (1);
+ default: // none
+ outLen = ucnv_toAlgorithmic(UCNV_UTF32_NativeEndian, cnv,
+ (char*)&buffer[first], sizeof(*buffer) * (bufsize - first),
+ byteBuffer, bytesRead, &errorCode);
+ if (errorCode != 0) {
+ conversion_error((int)errorCode);
+ return false;
+ }
+ outLen /= sizeof(*buffer);
+ last = first + outLen;
+ break;
+ }
+ }
+ else {
+ /* Recognize either LF or CR as a line terminator; skip initial LF if prev line ended with CR. */
+ i = get_uni_c(f);
+ if (f->skipNextLF) {
+ f->skipNextLF = 0;
+ if (i == '\n')
+ i = get_uni_c(f);
+ }
+
+ switch (norm) {
+ case 1: // NFC
+ case 2: // NFD
+ // read Unicode chars into utf32Buf as UTF32
+ if (utf32Buf == NULL)
+ utf32Buf = xmalloc(bufsize * sizeof(*utf32Buf));
+ tmpLen = 0;
+ if (i != EOF && i != '\n' && i != '\r')
+ utf32Buf[tmpLen++] = i;
+ if (i != EOF && i != '\n' && i != '\r')
+ while (tmpLen < bufsize && (i = get_uni_c(f)) != EOF && i != '\n' && i != '\r')
+ utf32Buf[tmpLen++] = i;
+
+ if (i == EOF && errno != EINTR && last == first)
+ return false;
+
+ /* We didn't get the whole line because our buffer was too small. */
+ if (i != EOF && i != '\n' && i != '\r')
+ buffer_overflow();
+ apply_normalization(utf32Buf, tmpLen, norm);
+ break;
+
+ default: // none
+ last = first;
+ if (last < bufsize && i != EOF && i != '\n' && i != '\r')
+ buffer[last++] = i;
+ if (i != EOF && i != '\n' && i != '\r')
+ while (last < bufsize && (i = get_uni_c(f)) != EOF && i != '\n' && i != '\r')
+ buffer[last++] = i;
+
+ if (i == EOF && errno != EINTR && last == first)
+ return false;
+
+ /* We didn't get the whole line because our buffer was too small. */
+ if (i != EOF && i != '\n' && i != '\r')
+ buffer_overflow();
+ break;
+ }
}
/* If line ended with CR, remember to skip following LF. */
if (i == '\r')
f->skipNextLF = 1;
- /* now apply the mapping to turn external bytes into Unicode characters in buffer */
- cnv = (UConverter*)(f->conversionData);
-#ifdef WORDS_BIGENDIAN
-#define UCNV_UTF32_NativeEndian UCNV_UTF32_BigEndian
-#else
-#define UCNV_UTF32_NativeEndian UCNV_UTF32_LittleEndian
-#endif
- outLen = ucnv_toAlgorithmic(UCNV_UTF32_NativeEndian, cnv,
- (char*)&buffer[first], sizeof(*buffer) * (bufsize - first),
- byteBuffer, bytesRead, &errorCode);
- if (errorCode != 0) {
- fprintf(stderr, "! Unicode conversion failed: error code = %d\n", (int)errorCode);
- return false;
- }
- outLen /= sizeof(*buffer);
- last = first + outLen;
buffer[last] = ' ';
-
if (last >= maxbufstack)
maxbufstack = last;
@@ -372,7 +498,14 @@ linebreakstart(integer localeStrNum, const UniChar* text, integer textLength)
char* locale = (char*)gettexstring(localeStrNum);
brkIter = ubrk_open(UBRK_LINE, locale, NULL, 0, &status);
if (U_FAILURE(status)) {
- fprintf(stderr, "\n! error %d creating linebreak iterator for locale \"%s\", trying default. ", status, locale);
+ begindiagnostic();
+ printnl('E');
+ printcstring("rror ");
+ printint(status);
+ printcstring(" creating linebreak iterator for locale `");
+ printcstring(locale);
+ printcstring("'; trying default locale `en_us'.");
+ enddiagnostic(1);
if (brkIter != NULL)
ubrk_close(brkIter);
status = 0;
@@ -432,7 +565,12 @@ getencodingmodeandinfo(integer* info)
/* try for an ICU converter */
cnv = ucnv_open(name, &err);
if (cnv == NULL) {
- fprintf(stderr, "! unknown encoding \"%s\"; reading as raw bytes\n", name);
+ begindiagnostic();
+ printnl('U'); /* ensure message starts on a new line */
+ printcstring("nknown encoding `");
+ printcstring(name);
+ printcstring("'; reading as raw bytes");
+ enddiagnostic(1);
return RAW;
}
else {
@@ -1981,8 +2119,13 @@ measure_native_node(void* pNode, int use_glyph_metrics)
int i;
OSStatus status = 0;
nGlyphs = layoutChars(engine, (UniChar*)txtPtr, 0, txtLen, txtLen, (dir == UBIDI_RTL), 0.0, 0.0, &status);
+ float maxRhs = 0.0;
+/* NO -- this is not valid in some Indic split-vowel situations
+ see http://sourceforge.net/tracker/index.php?func=detail&aid=1951292&group_id=194926&atid=951385 */
+#if 0
getGlyphPosition(engine, nGlyphs, &x, &y, &status);
node_width(node) = X2Fix(x);
+#endif
if (nGlyphs >= maxGlyphs) {
if (glyphs != 0) {
@@ -2007,6 +2150,9 @@ measure_native_node(void* pNode, int use_glyph_metrics)
realGlyphCount = 0;
for (i = 0; i < nGlyphs; ++i) {
if (glyphs[i] < 0xfffe) {
+ float rhs = positions[2*i] + getGlyphWidth(getFont(engine), glyphs[i]);
+ if (rhs > maxRhs)
+ maxRhs = rhs;
glyphIDs[realGlyphCount] = glyphs[i];
locations[realGlyphCount].x = X2Fix(positions[2*i]);
locations[realGlyphCount].y = X2Fix(positions[2*i+1]);
@@ -2014,7 +2160,8 @@ measure_native_node(void* pNode, int use_glyph_metrics)
}
}
}
-
+
+ node_width(node) = X2Fix(maxRhs);
native_glyph_count(node) = realGlyphCount;
native_glyph_info_ptr(node) = glyph_info;
}
@@ -2265,7 +2412,7 @@ double Fix2X(Fixed f)
/* these are here, not XeTeX_mac.c, because we need stubs on other platforms */
void
-atsugetfontmetrics(ATSUStyle style, Fixed* ascent, Fixed* descent, Fixed* xheight, Fixed* capheight, Fixed* slant)
+atsugetfontmetrics(ATSUStyle style, integer* ascent, integer* descent, integer* xheight, integer* capheight, integer* slant)
{
#ifdef XETEX_MAC
*ascent = *descent = *xheight = *capheight = *slant = 0;
@@ -2865,55 +3012,6 @@ get_uni_c(UFILE* f)
return rval;
}
-int
-input_line(UFILE* f)
-{
- int i;
-
- if (f->encodingMode == ICUMAPPING)
- return input_line_icu(f);
-
- /* Recognize either LF or CR as a line terminator; skip initial LF if prev line ended with CR. */
- i = get_uni_c(f);
- if (f->skipNextLF) {
- f->skipNextLF = 0;
- if (i == '\n')
- i = get_uni_c(f);
- }
-
- last = first;
- if (last < bufsize && i != EOF && i != '\n' && i != '\r')
- buffer[last++] = i;
- if (i != EOF && i != '\n' && i != '\r')
- while (last < bufsize && (i = get_uni_c(f)) != EOF && i != '\n' && i != '\r')
- buffer[last++] = i;
-
- if (i == EOF && errno != EINTR && last == first)
- return false;
-
- /* We didn't get the whole line because our buffer was too small. */
- if (i != EOF && i != '\n' && i != '\r') {
- fprintf (stderr, "! Unable to read an entire line---bufsize=%u.\n",
- (unsigned) bufsize);
- fputs ("Please increase buf_size in texmf.cnf.\n", stderr);
- uexit (1);
- }
-
- buffer[last] = ' ';
- if (last >= maxbufstack)
- maxbufstack = last;
-
- /* If line ended with CR, remember to skip following LF. */
- if (i == '\r')
- f->skipNextLF = 1;
-
- /* Trim trailing whitespace. */
- while (last > first && ISBLANK (buffer[last - 1]))
- --last;
-
- return true;
-}
-
void
makeutf16name()
{
diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_ext.h b/Build/source/texk/web2c/xetexdir/XeTeX_ext.h
index 9c2d362dffa..3fd3a25a81d 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeX_ext.h
+++ b/Build/source/texk/web2c/xetexdir/XeTeX_ext.h
@@ -291,7 +291,8 @@ typedef void* ATSUStyle; /* dummy declaration just so the stubs can compile */
int atsufontgetnamed(int what, ATSUStyle style);
int atsufontgetnamed1(int what, ATSUStyle style, int param);
void atsuprintfontname(int what, ATSUStyle style, int param1, int param2);
- void atsugetfontmetrics(ATSUStyle style, Fixed* ascent, Fixed* descent, Fixed* xheight, Fixed* capheight, Fixed* slant);
+ /* the metrics params here are really TeX 'scaled' (or MacOS 'Fixed') values, but that typedef isn't available every place this is included */
+ void atsugetfontmetrics(ATSUStyle style, integer* ascent, integer* descent, integer* xheight, integer* capheight, integer* slant);
#ifdef XETEX_MAC
/* functions in XeTeX_mac.c */
diff --git a/Build/source/texk/web2c/xetexdir/xetex.ch b/Build/source/texk/web2c/xetexdir/xetex.ch
index ccee9272ac0..2e9867a2c24 100644
--- a/Build/source/texk/web2c/xetexdir/xetex.ch
+++ b/Build/source/texk/web2c/xetexdir/xetex.ch
@@ -106,7 +106,9 @@ authorization from SIL International.
@d XeTeX_use_glyph_metrics_code = 3 {non-zero to use exact glyph height/depth}
@d XeTeX_inter_char_tokens_code = 4 {non-zero to enable \\XeTeXinterchartokens insertion}
@#
-@d XeTeX_default_input_mode_code = 5 {input mode for newly opened files}
+@d XeTeX_input_normalization_code = 5 {normalization mode: 1 = NFC, 2 = NFD, else none}
+@#
+@d XeTeX_default_input_mode_code = 6 {input mode for newly opened files}
@d XeTeX_input_mode_auto = 0
@d XeTeX_input_mode_utf8 = 1
@d XeTeX_input_mode_utf16be = 2
@@ -114,9 +116,9 @@ authorization from SIL International.
@d XeTeX_input_mode_raw = 4
@d XeTeX_input_mode_icu_mapping = 5
@#
-@d XeTeX_default_input_encoding_code = 6 {|str_number| of encoding name if mode = ICU}
+@d XeTeX_default_input_encoding_code = 7 {|str_number| of encoding name if mode = ICU}
@#
-@d eTeX_states=7 {number of \eTeX\ state variables in |eqtb|}
+@d eTeX_states=8 {number of \eTeX\ state variables in |eqtb|}
@z
@x
@@ -3745,7 +3747,9 @@ g_sign:=glue_sign(this_box); p:=list_ptr(this_box);
incr(cur_s);
if cur_s>0 then dvi_out(push);
if cur_s>max_push then max_push:=cur_s;
-save_loc:=dvi_offset+dvi_ptr; left_edge:=cur_h; cur_v:=cur_v-height(this_box);
+save_loc:=dvi_offset+dvi_ptr; left_edge:=cur_h;
+@<Start vlist {\sl Sync\TeX} information record@>;
+cur_v:=cur_v-height(this_box);
@y
@!cur_g:scaled; {rounded equivalent of |cur_glue| times the glue ratio}
@!upwards:boolean; {whether we're stacking upwards}
@@ -3757,6 +3761,7 @@ incr(cur_s);
if cur_s>0 then dvi_out(push);
if cur_s>max_push then max_push:=cur_s;
save_loc:=dvi_offset+dvi_ptr; left_edge:=cur_h;
+@<Start vlist {\sl Sync\TeX} information record@>;
if upwards then cur_v:=cur_v+depth(this_box) else cur_v:=cur_v-height(this_box);
@z
@@ -3774,7 +3779,16 @@ move_past: if upwards then cur_v:=cur_v-rule_ht else cur_v:=cur_v+rule_ht;
@x
@<Output a box in a vlist@>=
-if list_ptr(p)=null then cur_v:=cur_v+height(p)+depth(p)
+if list_ptr(p)=null then begin
+ cur_v:=cur_v+height(p);
+ if type(p)=vlist_node then begin
+ @<Record void vlist {\sl Sync\TeX} information@>;
+ end
+ else begin
+ @<Record void hlist {\sl Sync\TeX} information@>;
+ end;
+ cur_v:=cur_v+depth(p);
+end
else begin cur_v:=cur_v+height(p); synch_v;
save_h:=dvi_h; save_v:=dvi_v;
if cur_dir=right_to_left then cur_h:=left_edge-shift_amount(p)
@@ -3786,9 +3800,16 @@ else begin cur_v:=cur_v+height(p); synch_v;
end
@y
@<Output a box in a vlist@>=
-if list_ptr(p)=null then
- if upwards then cur_v:=cur_v-height(p)-depth(p)
- else cur_v:=cur_v+height(p)+depth(p)
+if list_ptr(p)=null then begin
+ if upwards then cur_v:=cur_v-depth(p) else cur_v:=cur_v+height(p);
+ if type(p)=vlist_node then begin
+ @<Record void vlist {\sl Sync\TeX} information@>;
+ end
+ else begin
+ @<Record void hlist {\sl Sync\TeX} information@>;
+ end;
+ if upwards then cur_v:=cur_v-height(p) else cur_v:=cur_v+depth(p);
+end
else begin if upwards then cur_v:=cur_v-depth(p) else cur_v:=cur_v+height(p); synch_v;
save_h:=dvi_h; save_v:=dvi_v;
if cur_dir=right_to_left then cur_h:=left_edge-shift_amount(p)
@@ -3807,13 +3828,10 @@ if upwards then cur_v:=cur_v-rule_ht else cur_v:=cur_v+rule_ht;
@z
@x
-begin
-@<Record sheet {\sl synctex} information@>
-if tracing_output>0 then
+begin if tracing_output>0 then
@y
begin
if job_name=0 then open_log_file;
-@<Record sheet {\sl synctex} information@>
if tracing_output>0 then
@z
@@ -7080,8 +7098,11 @@ end else
begin cur_lang:=what_lang(#); l_hyf:=what_lhm(#); r_hyf:=what_rhm(#);
set_hyph_index;
end
+
+@<Advance \(p)past a whatsit node in the \(l)|line_break| loop@>=@+
+adv_past(cur_p)
@y
-@ @d adv_past(#)==@+if subtype(#)=language_node then
+@ @d adv_past_linebreak(#)==@+if subtype(#)=language_node then
begin cur_lang:=what_lang(#); l_hyf:=what_lhm(#); r_hyf:=what_rhm(#);
set_hyph_index;
end
@@ -7091,6 +7112,22 @@ end else
or (subtype(#)=pdf_node)
then
begin act_width:=act_width+width(#); end
+
+@<Advance \(p)past a whatsit node in the \(l)|line_break| loop@>=@+
+adv_past_linebreak(cur_p)
+@z
+
+@x
+@ @<Advance \(p)past a whatsit node in the \(p)pre-hyphenation loop@>=@+
+adv_past(s)
+@y
+@ @d adv_past_prehyph(#)==@+if subtype(#)=language_node then
+ begin cur_lang:=what_lang(#); l_hyf:=what_lhm(#); r_hyf:=what_rhm(#);
+ set_hyph_index;
+ end
+
+@<Advance \(p)past a whatsit node in the \(p)pre-hyphenation loop@>=@+
+adv_past_prehyph(s)
@z
@x
@@ -8212,6 +8249,8 @@ font_char_ic_code: begin scan_font_ident; q:=cur_val; scan_usv_num;
@d XeTeX_dash_break_state == eTeX_state(XeTeX_dash_break_code)
@d XeTeX_dash_break_en == (XeTeX_dash_break_state>0)
+@d XeTeX_input_normalization_state == eTeX_state(XeTeX_input_normalization_code)
+
@d XeTeX_default_input_mode == eTeX_state(XeTeX_default_input_mode_code)
@d XeTeX_default_input_encoding == eTeX_state(XeTeX_default_input_encoding_code)
@z
@@ -8225,6 +8264,7 @@ eTeX_state_code+XeTeX_upwards_code:print_esc("XeTeXupwardsmode");
eTeX_state_code+XeTeX_use_glyph_metrics_code:print_esc("XeTeXuseglyphmetrics");
eTeX_state_code+XeTeX_inter_char_tokens_code:print_esc("XeTeXinterchartokenstate");
eTeX_state_code+XeTeX_dash_break_code:print_esc("XeTeXdashbreakstate");
+eTeX_state_code+XeTeX_input_normalization_code:print_esc("XeTeXinputnormalization");
@z
@x
@@ -8244,6 +8284,9 @@ primitive("XeTeXinterchartokenstate",assign_int,eTeX_state_base+XeTeX_inter_char
primitive("XeTeXdashbreakstate",assign_int,eTeX_state_base+XeTeX_dash_break_code);
@!@:XeTeX_dash_break_state_}{\.{\\XeTeX_dash_break_state} primitive@>
+primitive("XeTeXinputnormalization",assign_int,eTeX_state_base+XeTeX_input_normalization_code);
+@!@:XeTeX_input_normalization_}{\.{\\XeTeX_input_normalization} primitive@>
+
primitive("XeTeXinputencoding",extension,XeTeX_input_encoding_extension_code);
primitive("XeTeXdefaultencoding",extension,XeTeX_default_encoding_extension_code);
@z
@@ -8756,6 +8799,12 @@ begin
end_diagnostic(false);
end;
+function get_input_normalization_state: integer;
+begin
+ if eqtb=nil then get_input_normalization_state:=0
+ else get_input_normalization_state:=XeTeX_input_normalization_state;
+end;
+
@z
@x
diff --git a/Build/source/texk/web2c/xetexdir/xetex.defines b/Build/source/texk/web2c/xetexdir/xetex.defines
index 0ead228689f..6b96c7590a7 100644
--- a/Build/source/texk/web2c/xetexdir/xetex.defines
+++ b/Build/source/texk/web2c/xetexdir/xetex.defines
@@ -170,12 +170,20 @@ authorization from SIL International.
@define function htField();
@define function applymapping();
-{ functions from the synctex controller in synctex.h }
+{ functions from the synctex controller in synctex.c }
@define procedure synctexstartinput;
+@define procedure synctexterminate;
@define procedure synctexsheet();
+@define procedure synctexteehs;
+@define procedure synctexvlist();
+@define procedure synctextsilv();
+@define procedure synctexvoidvlist();
@define procedure synctexhlist();
@define procedure synctextsilh();
+@define procedure synctexvoidhlist();
@define procedure synctexmath();
@define procedure synctexkern();
-@define procedure synctexglue();
-
+@define procedure synctexchar();
+@define procedure synctexnode();
+@define procedure synctexcurrent;
+@define procedure synctexhorizontalruleorglue();
diff --git a/Build/source/texk/web2c/xetexdir/xetex.mk b/Build/source/texk/web2c/xetexdir/xetex.mk
index b7dc7eb3a95..d3e32a38c43 100644
--- a/Build/source/texk/web2c/xetexdir/xetex.mk
+++ b/Build/source/texk/web2c/xetexdir/xetex.mk
@@ -128,7 +128,7 @@ xetexdir/etex.version: $(srcdir)/etexdir/etex.ch
# The C sources.
xetex_c = xetexini.c xetex0.c xetex1.c xetex2.c
xetex_o = xetexini.o xetex0.o xetex1.o xetex2.o xetexextra.o
-xetex_add_o = trans.o XeTeX_ext.o xetex_pool.o xetex_synctex.o $(xetex_platform_o)
+xetex_add_o = trans.o XeTeX_ext.o xetex_pool.o $(xetex_platform_o) $(synctex-xetex_o)
# these compilations require the path to TECkit headers;
# just setting it in XCFLAGS doesn't seem to work when we're called
@@ -168,10 +168,6 @@ pdfimage.o: $(srcdir)/xetexdir/pdfimage.cpp $(srcdir)/xetexdir/pdfimage.h
XeTeX_pic.o: $(srcdir)/xetexdir/XeTeX_pic.c $(srcdir)/xetexdir/XeTeX_ext.h $(XeTeXImageHdrs)
$(compile) $(TECKITFLAGS) $(FTFLAGS) $(ALL_CFLAGS) $(XETEX_DEFINES) -c $< -o $@
-# sync
-xetex_synctex.o: $(srcdir)/synctex/synctex.c
- $(compile) $(ALL_CFLAGS) $(TECKITFLAGS) $(FTFLAGS) $(XETEX_DEFINES) -c $< -o $@
-
# Layout library
xetex_ot_layout_o = \
XeTeXFontMgr.o \
@@ -222,6 +218,10 @@ XeTeX_mac.o: $(srcdir)/xetexdir/XeTeX_mac.c xetexd.h
trans.o: $(srcdir)/xetexdir/trans.c
$(compile) $(ALL_CFLAGS) $(XETEX_DEFINES) -c $< -o $@
+# sync
+synctex-xe.o: synctex-xe.c
+ $(compile) $(ALL_CFLAGS) $(TECKITFLAGS) $(FTFLAGS) $(XETEX_DEFINES) -c $< -o $@
+
# Making xetex.
xetex: $(xetex_o) $(xetex_add_o) $(xetex_images_o) $(xetex_ot_layout_o) \
$(GRAPHITEDEP) $(TECKITDEP) $(FREETYPE2DEP) $(ICUDEP) $(EXTRADEPS)
@@ -232,6 +232,8 @@ xetex: $(xetex_o) $(xetex_add_o) $(xetex_images_o) $(xetex_ot_layout_o) \
# C file dependencies
$(xetex_c) xetexcoerce.h xetexd.h: xetex.p $(web2c_texmf)
$(web2c) xetex
+ $(synctex_xetexd)
+
xetexextra.c: lib/texmfmp.c xetexdir/xetexextra.h
sed s/TEX-OR-MF-OR-MP/xetex/ $(srcdir)/lib/texmfmp.c >$@
xetexdir/xetexextra.h: xetexdir/xetexextra.in xetexdir/xetex.version xetexdir/etex.version
@@ -251,13 +253,12 @@ xetex.p xetex.pool: ./otangle xetex.web
# Sources for xetex.web:
xetex_web_srcs = $(srcdir)/tex.web \
$(srcdir)/etexdir/etex.ch \
- $(srcdir)/synctex/synctex.ch \
$(srcdir)/etexdir/tex.ch0 \
$(srcdir)/tex.ch \
$(srcdir)/etexdir/tex.ch1 \
$(srcdir)/etexdir/tex.ech \
- $(srcdir)/xetexdir/xetex.ch \
- $(srcdir)/xetexdir/sync-xetex.ch
+ $(synctex-xetex_ch_srcs) \
+ $(srcdir)/xetexdir/xetex.ch
xetex.web: tie xetexdir/xetex.mk $(xetex_web_srcs)
$(TIE) -m xetex.web $(xetex_web_srcs)