summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Kew <jfkthame@googlemail.com>2007-06-27 12:31:45 +0000
committerJonathan Kew <jfkthame@googlemail.com>2007-06-27 12:31:45 +0000
commit8bfa2aac1554707168df10fb620993fe6457b780 (patch)
treeaa4fc03cb30dfa44525c60b391e77533d60a4584
parent0bd58b0f8d37681608458f63701370ab183d7ae4 (diff)
xetex bugfixes for 64-bit architectures (especially big-endian)
git-svn-id: svn://tug.org/texlive/branches/branch2007@4515 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/web2c/texmfmem.h39
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeX_ext.c100
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeX_ext.h63
-rw-r--r--Build/source/texk/web2c/xetexdir/XeTeX_mac.c2
-rw-r--r--Build/source/texk/web2c/xetexdir/jpegimage.c2
-rw-r--r--Build/source/texk/web2c/xetexdir/xetex-new.ch37
-rw-r--r--Build/source/texk/web2c/xetexdir/xetex.defines2
-rw-r--r--Build/source/texk/web2c/xetexdir/xetex.h3
8 files changed, 115 insertions, 133 deletions
diff --git a/Build/source/texk/web2c/texmfmem.h b/Build/source/texk/web2c/texmfmem.h
index 78bf73fb787..13697685121 100644
--- a/Build/source/texk/web2c/texmfmem.h
+++ b/Build/source/texk/web2c/texmfmem.h
@@ -112,25 +112,13 @@ typedef union
#else
twohalves hhfield;
#endif
-#ifdef WORDS_BIGENDIAN
#ifdef XeTeX
- struct
- {
- integer CINT;
- integer CINT1;
- } x;
-#else
- integer cint;
+ voidpointer ptr;
#endif
+#ifdef WORDS_BIGENDIAN
+ integer cint;
fourquarters qqqq;
#else /* not WORDS_BIGENDIAN */
-#ifdef XeTeX
- struct
- {
- integer CINT1;
- integer CINT;
- } x;
-#else
struct
{
#if defined (TeX) && !defined (SMALLTeX) || defined (MF) && !defined (SMALLMF) || defined (MP) && !defined (SMALLMP)
@@ -138,7 +126,6 @@ typedef union
#endif /* big {TeX,MF,MP} */
integer CINT;
} u;
-#endif
struct
{
@@ -159,28 +146,13 @@ typedef union
typedef union
{
#ifdef WORDS_BIGENDIAN
-#ifdef XeTeX
- struct
- {
- integer CINT;
- } x;
-#else
integer cint;
-#endif
fourquarters qqqq;
#else /* not WORDS_BIGENDIAN */
-#ifdef XeTeX
- struct
- {
- halfword junk;
- integer CINT;
- } x;
-#else
struct
{
integer CINT;
} u;
-#endif
struct
{
@@ -199,14 +171,9 @@ typedef union
#define rh v.RH
#define lhfield v.LH
-#ifdef XeTeX
-#define cint x.CINT
-#define cint1 x.CINT1
-#else
#ifndef WORDS_BIGENDIAN
#define cint u.CINT
#endif
-#endif /* XeTeX */
#ifndef WORDS_BIGENDIAN
#define qqqq v.QQQQ
diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
index 122605694b0..a4b467bb10c 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
+++ b/Build/source/texk/web2c/xetexdir/XeTeX_ext.c
@@ -236,9 +236,9 @@ void initversionstring(char **versions)
}
-extern char* gettexstring(int strNumber);
+extern char* gettexstring(integer strNumber);
void
-setinputfileencoding(UFILE* f, int mode, int encodingData)
+setinputfileencoding(UFILE* f, integer mode, integer encodingData)
{
if ((f->encodingMode == ICUMAPPING) && (f->conversionData != NULL))
ucnv_close((UConverter*)(f->conversionData));
@@ -288,9 +288,9 @@ input_line_icu(UFILE* f)
static char* byteBuffer = NULL;
UInt32 bytesRead = 0;
- int i;
+ int i;
UConverter* cnv;
- long outLen;
+ int outLen;
UErrorCode errorCode = 0;
if (byteBuffer == NULL)
@@ -355,10 +355,9 @@ static UBreakIterator* brkIter = NULL;
static int brkLocaleStrNum = 0;
void
-linebreakstart(int localeStrNum, const UniChar* text, int textLength)
+linebreakstart(integer localeStrNum, const UniChar* text, integer textLength)
{
UErrorCode status = 0;
- int i;
if ((localeStrNum != brkLocaleStrNum) && (brkIter != NULL)) {
ubrk_close(brkIter);
@@ -392,8 +391,8 @@ linebreaknext()
return ubrk_next((UBreakIterator*)brkIter);
}
-long
-getencodingmodeandinfo(long* info)
+int
+getencodingmodeandinfo(integer* info)
{
/* \XeTeXinputencoding "enc-name"
* -> name is packed in |nameoffile| as a C string, starting at [1]
@@ -811,7 +810,7 @@ splitFontName(char* name, char** var, char** feat, char** end)
}
void*
-findnativefont(unsigned char* uname, long scaled_size)
+findnativefont(unsigned char* uname, integer scaled_size)
/* scaled_size here is in TeX points */
{
void* rval = 0;
@@ -950,7 +949,6 @@ void
otgetfontmetrics(void* pEngine, scaled* ascent, scaled* descent, scaled* xheight, scaled* capheight, scaled* slant)
{
XeTeXLayoutEngine engine = (XeTeXLayoutEngine)pEngine;
- long rval = 0;
float a, d;
int glyphID;
@@ -977,8 +975,8 @@ otgetfontmetrics(void* pEngine, scaled* ascent, scaled* descent, scaled* xheight
*capheight = *ascent; /* arbitrary figure if there's no 'X' in the font */
}
-long
-otfontget(int what, void* pEngine)
+integer
+otfontget(integer what, void* pEngine)
{
XeTeXLayoutEngine engine = (XeTeXLayoutEngine)pEngine;
XeTeXFont fontInst = getFont(engine);
@@ -995,8 +993,8 @@ otfontget(int what, void* pEngine)
}
-long
-otfontget1(int what, void* pEngine, long param)
+integer
+otfontget1(integer what, void* pEngine, integer param)
{
XeTeXLayoutEngine engine = (XeTeXLayoutEngine)pEngine;
XeTeXFont fontInst = getFont(engine);
@@ -1013,8 +1011,8 @@ otfontget1(int what, void* pEngine, long param)
}
-long
-otfontget2(int what, void* pEngine, long param1, long param2)
+integer
+otfontget2(integer what, void* pEngine, integer param1, integer param2)
{
XeTeXLayoutEngine engine = (XeTeXLayoutEngine)pEngine;
XeTeXFont fontInst = getFont(engine);
@@ -1032,8 +1030,8 @@ otfontget2(int what, void* pEngine, long param1, long param2)
}
-long
-otfontget3(int what, void* pEngine, long param1, long param2, long param3)
+integer
+otfontget3(integer what, void* pEngine, integer param1, integer param2, integer param3)
{
XeTeXLayoutEngine engine = (XeTeXLayoutEngine)pEngine;
XeTeXFont fontInst = getFont(engine);
@@ -1091,7 +1089,7 @@ makeXDVGlyphArrayData(void* pNode)
xdvbuffer = (char*)xmalloc(xdvBufSize);
}
- glyph_info = (void*)native_glyph_info_ptr(p);
+ glyph_info = native_glyph_info_ptr(p);
locations = (FixedPoint*)glyph_info;
glyphIDs = (UInt16*)(locations + glyphCount);
@@ -1138,8 +1136,8 @@ makeXDVGlyphArrayData(void* pNode)
return ((char*)cp - xdvbuffer);
}
-long
-makefontdef(long f)
+int
+makefontdef(integer f)
{
UInt16 flags = 0;
UInt32 variationCount = 0;
@@ -1349,7 +1347,7 @@ snap_zone(scaled* value, scaled snap_value, scaled fuzz)
}
void
-getnativecharheightdepth(int font, int ch, scaled* height, scaled* depth)
+getnativecharheightdepth(integer font, integer ch, scaled* height, scaled* depth)
{
#define QUAD(f) fontinfo[6+parambase[f]].cint
#define X_HEIGHT(f) fontinfo[5+parambase[f]].cint
@@ -1389,7 +1387,7 @@ getnativecharheightdepth(int font, int ch, scaled* height, scaled* depth)
}
scaled
-getnativecharht(int f, int c)
+getnativecharht(integer f, integer c)
{
scaled h, d;
getnativecharheightdepth(f, c, &h, &d);
@@ -1397,7 +1395,7 @@ getnativecharht(int f, int c)
}
scaled
-getnativechardp(int f, int c)
+getnativechardp(integer f, integer c)
{
scaled h, d;
getnativecharheightdepth(f, c, &h, &d);
@@ -1405,7 +1403,7 @@ getnativechardp(int f, int c)
}
void
-getnativecharsidebearings(int font, int ch, scaled* lsb, scaled* rsb)
+getnativecharsidebearings(integer font, integer ch, scaled* lsb, scaled* rsb)
{
float l, r;
@@ -1432,7 +1430,7 @@ getnativecharsidebearings(int font, int ch, scaled* lsb, scaled* rsb)
}
scaled
-getnativecharic(int f, int c)
+getnativecharic(integer f, integer c)
{
scaled lsb, rsb;
getnativecharsidebearings(f, c, &lsb, &rsb);
@@ -1443,7 +1441,7 @@ getnativecharic(int f, int c)
}
scaled
-getnativecharwd(int f, int c)
+getnativecharwd(integer f, integer c)
{
scaled wd = 0;
#ifdef XETEX_MAC
@@ -1515,7 +1513,7 @@ measure_native_node(void* pNode, int use_glyph_metrics)
void* glyph_info = 0;
static float* positions = 0;
static UInt32* glyphs = 0;
- static long maxGlyphs = 0;
+ static int maxGlyphs = 0;
FixedPoint* locations;
UInt16* glyphIDs;
@@ -1591,7 +1589,7 @@ measure_native_node(void* pNode, int use_glyph_metrics)
node_width(node) = X2Fix(wid);
native_glyph_count(node) = realGlyphCount;
- native_glyph_info_ptr(node) = (long)glyph_info;
+ native_glyph_info_ptr(node) = glyph_info;
}
else {
int i;
@@ -1632,7 +1630,7 @@ measure_native_node(void* pNode, int use_glyph_metrics)
}
native_glyph_count(node) = realGlyphCount;
- native_glyph_info_ptr(node) = (long)glyph_info;
+ native_glyph_info_ptr(node) = glyph_info;
}
ubidi_close(pBiDi);
@@ -1787,8 +1785,8 @@ measure_native_glyph(void* pNode, int use_glyph_metrics)
}
}
-int
-mapchartoglyph(int font, unsigned int ch)
+integer
+mapchartoglyph(integer font, integer ch)
{
if (ch > 0x10ffff || ((ch >= 0xd800) && (ch <= 0xdfff)))
return 0;
@@ -1805,8 +1803,8 @@ mapchartoglyph(int font, unsigned int ch)
}
}
-int
-mapglyphtoindex(int font)
+integer
+mapglyphtoindex(integer font)
/* glyph name is at nameoffile+1 */
{
#ifdef XETEX_MAC
@@ -1822,8 +1820,8 @@ mapglyphtoindex(int font)
}
}
-int
-getfontcharrange(int font, int first)
+integer
+getfontcharrange(integer font, int first)
{
#ifdef XETEX_MAC
if (fontarea[font] == AAT_FONT_FLAG)
@@ -1928,10 +1926,10 @@ atsugetfontmetrics(ATSUStyle style, Fixed* ascent, Fixed* descent, Fixed* xheigh
#endif
}
-long
+int
atsufontget(int what, ATSUStyle style)
{
- long rval = -1;
+ int rval = -1;
#ifdef XETEX_MAC
ATSUFontID fontID;
@@ -1966,10 +1964,10 @@ atsufontget(int what, ATSUStyle style)
return rval;
}
-long
+int
atsufontget1(int what, ATSUStyle style, int param)
{
- long rval = -1;
+ int rval = -1;
#ifdef XETEX_MAC
ATSUFontID fontID;
@@ -2026,10 +2024,10 @@ atsufontget1(int what, ATSUStyle style, int param)
return rval;
}
-long
+int
atsufontget2(int what, ATSUStyle style, int param1, int param2)
{
- long rval = -1;
+ int rval = -1;
#ifdef XETEX_MAC
ATSUFontID fontID;
@@ -2063,10 +2061,10 @@ atsufontget2(int what, ATSUStyle style, int param1, int param2)
return rval;
}
-long
+int
atsufontgetnamed(int what, ATSUStyle style)
{
- long rval = -1;
+ int rval = -1;
#ifdef XETEX_MAC
ATSUFontID fontID;
@@ -2090,10 +2088,10 @@ atsufontgetnamed(int what, ATSUStyle style)
return rval;
}
-long
+int
atsufontgetnamed1(int what, ATSUStyle style, int param)
{
- long rval = -1;
+ int rval = -1;
#ifdef XETEX_MAC
ATSUFontID fontID;
@@ -2220,7 +2218,7 @@ atsuprintfontname(int what, ATSUStyle style, int param1, int param2)
}
void
-printglyphname(int font, int gid)
+printglyphname(integer font, integer gid)
{
char* s;
int len = 0;
@@ -2243,8 +2241,8 @@ printglyphname(int font, int gid)
printchar(*s++);
}
-boolean
-u_open_in(unicodefile* f, int filefmt, const_string fopen_mode, int mode, int encodingData)
+int
+u_open_in(unicodefile* f, integer filefmt, const_string fopen_mode, integer mode, integer encodingData)
{
boolean rval;
*f = malloc(sizeof(UFILE));
@@ -2287,7 +2285,7 @@ u_open_in(unicodefile* f, int filefmt, const_string fopen_mode, int mode, int en
return rval;
}
-boolean
+int
open_dvi_output(FILE** fptr)
{
if (nopdfoutput) {
@@ -2391,7 +2389,7 @@ get_uni_c(UFILE* f)
return rval;
}
-boolean
+int
input_line(UFILE* f)
{
int i;
diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_ext.h b/Build/source/texk/web2c/xetexdir/XeTeX_ext.h
index 45d71cca8d1..74d1851b69a 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeX_ext.h
+++ b/Build/source/texk/web2c/xetexdir/XeTeX_ext.h
@@ -141,10 +141,10 @@ typedef struct {
#define node_width(node) node[width_offset].cint
#define node_depth(node) node[depth_offset].cint
#define node_height(node) node[height_offset].cint
-#define native_length(node) node[native_info_offset].hh.v.RH
-#define native_font(node) node[native_info_offset].hh.b1
-#define native_glyph_count(node) node[native_glyph_info_offset].hh.v.LH
-#define native_glyph_info_ptr(node) node[native_glyph_info_offset].hh.v.RH
+#define native_length(node) node[native_info_offset].qqqq.b2
+#define native_font(node) node[native_info_offset].qqqq.b1
+#define native_glyph_count(node) node[native_info_offset].qqqq.b3
+#define native_glyph_info_ptr(node) node[native_glyph_info_offset].ptr
#define native_glyph_info_size 10 /* info for each glyph is location (FixedPoint) + glyph ID (UInt16) */
#define native_glyph(p) native_length(p) /* glyph ID field in a glyph_node */
@@ -206,6 +206,8 @@ extern const UInt32 kSurrogateLowEnd;
extern const UInt32 byteMask;
extern const UInt32 byteMark;
+#include <stdio.h> /* for FILE */
+
#include "trans.h"
#ifdef __cplusplus
@@ -213,51 +215,62 @@ extern "C" {
#endif
void initversionstring(char **versions);
- void setinputfileencoding(unicodefile f, int mode, int encodingData);
+ void setinputfileencoding(unicodefile f, integer mode, integer encodingData);
void uclose(unicodefile f);
int input_line_icu(unicodefile f);
- void linebreakstart(int localeStrNum, const UniChar* text, int textLength);
+ void linebreakstart(integer localeStrNum, const UniChar* text, integer textLength);
int linebreaknext();
- long getencodingmodeandinfo(long* info);
+ int getencodingmodeandinfo(integer* info);
void printutf8str(const unsigned char* str, int len);
void printchars(const unsigned short* str, int len);
void* load_mapping_file(const char* s, const char* e);
- void* findnativefont(unsigned char* name, long scaled_size);
+ void* findnativefont(unsigned char* name, integer scaled_size);
void releasefontengine(void* engine, int type_flag);
- /* 'integer' params here are really TeX 'scaled' values, but that typedef isn't available every place this is included */
+ /* the metrics params here are really TeX 'scaled' values, but that typedef isn't available every place this is included */
void otgetfontmetrics(void* engine, integer* ascent, integer* descent, integer* xheight, integer* capheight, integer* slant);
- void getnativecharheightdepth(int font, int ch, integer* height, integer* depth);
- void getnativecharsidebearings(int font, int ch, integer* lsb, integer* rsb);
+ void getnativecharheightdepth(integer font, integer ch, integer* height, integer* depth);
+ void getnativecharsidebearings(integer font, integer ch, integer* lsb, integer* rsb);
/* single-purpose metrics accessors */
- integer getnativecharwd(int font, int ch);
- integer getnativecharht(int font, int ch);
- integer getnativechardp(int font, int ch);
- integer getnativecharic(int font, int ch);
-
- long otfontget(int what, void* engine);
- long otfontget1(int what, void* engine, long param);
- long otfontget2(int what, void* engine, long param1, long param2);
- long otfontget3(int what, void* engine, long param1, long param2, long param3);
+ integer getnativecharwd(integer font, integer ch);
+ integer getnativecharht(integer font, integer ch);
+ integer getnativechardp(integer font, integer ch);
+ integer getnativecharic(integer font, integer ch);
+
+ long otfontget(integer what, void* engine);
+ long otfontget1(integer what, void* engine, integer param);
+ long otfontget2(integer what, void* engine, integer param1, integer param2);
+ long otfontget3(integer what, void* engine, integer param1, integer param2, integer param3);
int makeXDVGlyphArrayData(void* p);
- long makefontdef(long f);
+ int makefontdef(integer f);
int applymapping(void* cnv, const UniChar* txtPtr, int txtLen);
void store_justified_native_glyphs(void* node);
void measure_native_node(void* node, int use_glyph_metrics);
Fixed get_native_ital_corr(void* node);
Fixed get_native_glyph_ital_corr(void* node);
void measure_native_glyph(void* node, int use_glyph_metrics);
- int mapchartoglyph(int font, unsigned int ch);
- int mapglyphtoindex(int font);
-
+ integer mapchartoglyph(integer font, integer ch);
+ integer mapglyphtoindex(integer font);
+ integer getfontcharrange(integer font, int first);
+ void printglyphname(integer font, integer gid);
+
+ double read_double(const char** s);
+ unsigned int read_rgb_a(const char** cp);
+
const char* getGlyphNamePtr(const char* buffer, int tableSize, UInt16 gid, int* len);
int find_pic_file(char** path, realrect* bounds, int pdfBoxType, int page);
+ int u_open_in(unicodefile* f, integer filefmt, const char* fopen_mode, integer mode, integer encodingData);
+ int open_dvi_output(FILE** fptr);
+ void dviclose(FILE* fptr);
+ int get_uni_c(UFILE* f);
+ int input_line(UFILE* f);
+ void makeutf16name();
#ifdef XETEX_MAC
/* functions in XeTeX_mac.c */
- void* loadAATfont(ATSFontRef fontRef, long scaled_size, const char* cp1);
+ void* loadAATfont(ATSFontRef fontRef, integer scaled_size, const char* cp1);
void DoAtsuiLayout(void* node, int justify);
void GetGlyphBBox_AAT(ATSUStyle style, UInt16 gid, GlyphBBox* bbox);
float GetGlyphWidth_AAT(ATSUStyle style, UInt16 gid);
diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_mac.c b/Build/source/texk/web2c/xetexdir/XeTeX_mac.c
index 6aba6083f41..4c64a65feb4 100644
--- a/Build/source/texk/web2c/xetexdir/XeTeX_mac.c
+++ b/Build/source/texk/web2c/xetexdir/XeTeX_mac.c
@@ -162,7 +162,7 @@ DoAtsuiLayout(void* p, int justify)
lsDelta -= lsUnit;
native_glyph_count(node) = realGlyphCount;
- native_glyph_info_ptr(node) = (long)glyph_info;
+ native_glyph_info_ptr(node) = glyph_info;
if (!justify)
node_width(node) = FixedPStoTeXPoints(layoutRec[count-1].realPos) + lsDelta;
diff --git a/Build/source/texk/web2c/xetexdir/jpegimage.c b/Build/source/texk/web2c/xetexdir/jpegimage.c
index 165a675f6f6..a70c4241c35 100644
--- a/Build/source/texk/web2c/xetexdir/jpegimage.c
+++ b/Build/source/texk/web2c/xetexdir/jpegimage.c
@@ -81,6 +81,8 @@
#include <memory.h>
+#include "kpathsea/lib.h" /* for xmalloc/xrealloc prototypes */
+
#define JPEG_DEBUG_STR "JPEG"
#define JPEG_DEBUG 3
diff --git a/Build/source/texk/web2c/xetexdir/xetex-new.ch b/Build/source/texk/web2c/xetexdir/xetex-new.ch
index c7dc05fa0ba..7fdfc33e658 100644
--- a/Build/source/texk/web2c/xetexdir/xetex-new.ch
+++ b/Build/source/texk/web2c/xetexdir/xetex-new.ch
@@ -706,27 +706,28 @@ if max_quarterword-min_quarterword<@"FFFF then bad:=19;
To support ``native'' fonts, we build |native_word_nodes|, which are variable size whatsits.
These have the same |width|, |depth|, and |height| fields as a |box_node|, at offsets 1-3,
-and then a word containing a size field for the node, a font number, and a length.
-Then there is a field containing two halfwords, a glyph count and a C pointer to a glyph info array;
-these are set by |set_native_metrics|. Copying and freeing of these nodes needs to take account of this!
+and then a word containing a size field for the node, a font number, a length, and a glyph count.
+Then there is a field containing a C pointer to a glyph info array;
+this and the glyph count are set by |set_native_metrics|.
+Copying and freeing of these nodes needs to take account of this!
This is followed by |length| bytes, for the actual characters of the string.
(Yes, we count in bytes, even though what we store there is UTF-16.)
So |native_node_size|, which does not include any space for the actual text, is 6.}
@d native_node_size=6 {size of a native_word node (plus the actual chars) -- see also xetex.h}
-@d native_size(#)==mem[#+4].hh.b0
-@d native_font(#)==mem[#+4].hh.b1
-@d native_length(#)==mem[#+4].hh.rh
-@d native_glyph_count(#)==mem[#+5].hh.lh
-@d native_glyph_info_ptr(#)==mem[#+5].hh.rh
+@d native_size(#)==mem[#+4].qqqq.b0
+@d native_font(#)==mem[#+4].qqqq.b1
+@d native_length(#)==mem[#+4].qqqq.b2
+@d native_glyph_count(#)==mem[#+4].qqqq.b3
+@d native_glyph_info_ptr(#)==mem[#+5].ptr
@d native_glyph_info_size=10 { number of bytes of info per glyph: 16-bit glyph ID, 32-bit x and y coords }
@d free_native_glyph_info(#) ==
begin
- if native_glyph_info_ptr(#) <> 0 then begin
- libc_free(cast_to_ptr(native_glyph_info_ptr(#)));
- native_glyph_info_ptr(#) := 0;
+ if native_glyph_info_ptr(#) <> null_ptr then begin
+ libc_free(native_glyph_info_ptr(#));
+ native_glyph_info_ptr(#) := null_ptr;
native_glyph_count(#) := 0;
end
end
@@ -734,10 +735,10 @@ So |native_node_size|, which does not include any space for the actual text, is
@p procedure copy_native_glyph_info(src:pointer; dest:pointer);
var glyph_count:integer;
begin
- if native_glyph_info_ptr(src) <> 0 then begin
+ if native_glyph_info_ptr(src) <> null_ptr then begin
glyph_count := native_glyph_count(src);
- native_glyph_info_ptr(dest) := cast_to_integer(xmalloc_array(char, glyph_count * native_glyph_info_size));
- memcpy(cast_to_ptr(native_glyph_info_ptr(dest)), cast_to_ptr(native_glyph_info_ptr(src)), glyph_count * native_glyph_info_size);
+ native_glyph_info_ptr(dest) := xmalloc_array(char, glyph_count * native_glyph_info_size);
+ memcpy(native_glyph_info_ptr(dest), native_glyph_info_ptr(src), glyph_count * native_glyph_info_size);
native_glyph_count(dest) := glyph_count;
end
end;
@@ -4851,7 +4852,7 @@ native_word_node: begin words:=native_size(p);
r:=get_node(words);
while words > 0 do
begin decr(words); mem[r+words]:=mem[p+words]; end;
- native_glyph_info_ptr(r):=0; native_glyph_count(r):=0;
+ native_glyph_info_ptr(r):=null_ptr; native_glyph_count(r):=0;
copy_native_glyph_info(p, r);
end;
glyph_node: begin r:=get_node(glyph_node_size);
@@ -5116,7 +5117,7 @@ begin
dvi_two(native_glyph(p));
cur_h := cur_h + width(p);
end else begin
- if native_glyph_info_ptr(p) <> 0 then begin
+ if native_glyph_info_ptr(p) <> null_ptr then begin
len := make_xdv_glyph_array_data(p);
for k := 0 to len-1 do
dvi_out(xdv_buffer_byte(k));
@@ -6121,7 +6122,7 @@ begin
native_length(q) := n;
native_glyph_count(q) := 0;
- native_glyph_info_ptr(q) := 0;
+ native_glyph_info_ptr(q) := null_ptr;
new_native_word_node := q;
end;
@@ -6178,7 +6179,7 @@ begin
native_size(p) := native_node_size + 1;
native_glyph_count(p) := 0;
- native_glyph_info_ptr(p) := 0;
+ native_glyph_info_ptr(p) := null_ptr;
native_font(p) := f;
if c > @"FFFF then begin
diff --git a/Build/source/texk/web2c/xetexdir/xetex.defines b/Build/source/texk/web2c/xetexdir/xetex.defines
index 222ed2717a0..218d8228c97 100644
--- a/Build/source/texk/web2c/xetexdir/xetex.defines
+++ b/Build/source/texk/web2c/xetexdir/xetex.defines
@@ -32,6 +32,8 @@ authorization from SIL International.
{ xetex.defines: additions for xetex }
+@define @field ptr;
+@define const nullptr;
@define type voidpointer;
@define function getnativechar();
@define procedure setnativechar();
diff --git a/Build/source/texk/web2c/xetexdir/xetex.h b/Build/source/texk/web2c/xetexdir/xetex.h
index 951ac4d7632..60ac046a0b8 100644
--- a/Build/source/texk/web2c/xetexdir/xetex.h
+++ b/Build/source/texk/web2c/xetexdir/xetex.h
@@ -63,8 +63,7 @@ void* getotassemblyptr(int f, int g); /* function in XeTeXOTMath.cpp */
#define dviopenout(f) open_dvi_output(&(f))
-#define casttoptr(x) (void*)(x)
-#define casttointeger(x) (long)(x)
+#define nullptr (NULL)
#define glyphinfobyte(p,k) ((unsigned char*)p)[k]
#define casttoushort(x) (unsigned short)(x)