/* texmfmem.h: the memory_word type, which is too hard to translate
automatically from Pascal. We have to make sure the byte-swapping
that the (un)dumping routines do suffices to put things in the right
place in memory.
A memory_word can be broken up into a `twohalves' or a
`fourquarters', and a `twohalves' can be further broken up. Here is
a picture. ..._M = most significant byte, ..._L = least significant
byte.
The halfword fields are four bytes if we are building a big TeX or MF;
this leads to further complications:
I guess TeX and Metafont never refer to the B1 and B0 in the
fourquarters structure as the B1 and B0 in the twohalves.u structure.
The B0 and B1 fields are declared short instead of quarterword,
because they are used in character nodes to store a font number and a
character. If left as a quarterword (which is a single byte), we
couldn't support more than 256 fonts. (If shorts aren't two bytes,
this will lose.)
In the old four-byte memory structure (something more needs to be
done to handle >256 fonts):
This file can't be part of texmf.h, because texmf.h gets included by
{tex,mf,mp}d.h before the `halfword' etc. types are defined. So we
include it from the change file instead.
*/
/* Aleph is sufficiently different to separate the definition. */
#if !defined(Aleph) && !defined(epTeX)
struct
{ /* Make B0,B1 overlap the most significant bytes of LH. */
#ifdef WORDS_BIGENDIAN
halfword junk;
short B0, B1;
#else /* not WORDS_BIGENDIAN */
/* If 32-bit memory words, have to do something. */
#if defined (SMALLTeX) || defined (SMALLMF) || defined (SMALLMP)
fixme
#else
short B1, B0;
#endif /* big memory words */
#endif /* LittleEndian */
} u;
} twohalves;
typedef union
{
#ifdef TeX
glueratio gr;
twohalves hh;
#else
twohalves hhfield;
#endif
#ifdef XeTeX
voidpointer ptr;
#endif
#ifdef WORDS_BIGENDIAN
integer cint;
fourquarters qqqq;
#else /* not WORDS_BIGENDIAN */
struct
{
#if defined (TeX) && !defined (SMALLTeX) || defined (MF) && !defined (SMALLMF) || defined (MP) && !defined (SMALLMP)
halfword junk;
#endif /* big {TeX,MF,MP} */
integer CINT;
} u;
struct
{
#ifndef XeTeX
#if defined (TeX) && !defined (SMALLTeX) || defined (MF) && !defined (SMALLMF) || defined (MP) && !defined (SMALLMP)
halfword junk;
#endif /* big {TeX,MF,MP} */
#endif
fourquarters QQQQ;
} v;
#endif /* not WORDS_BIGENDIAN */
} memoryword;
/* fmemory_word for font_list; needs to be only four bytes. This saves
significant space in the .fmt files. (Not true in XeTeX, actually!) */
typedef union
{
#ifdef WORDS_BIGENDIAN
integer cint;
fourquarters qqqq;
#else /* not WORDS_BIGENDIAN */
struct
{
#ifdef XeTeX
halfword junk; /* quarterword is really 16 bits in XeTeX, so integer does not fill the union */
#endif
integer CINT;
} u;
/* To keep the original structure accesses working, we must go through
the extra names C forced us to introduce. */
#define b0 u.B0
#define b1 u.B1
#define b2 u.B2
#define b3 u.B3
struct
{ /* Make B0,B1 overlap the most significant bytes of LH. */
#ifdef WORDS_BIGENDIAN
halfword junk;
quarterword B0, B1;
#else /* not WORDS_BIGENDIAN */
/* If 32-bit memory words, have to do something. */
#if defined (SMALLTeX) || defined (SMALLMF) || defined (SMALLMP)
fixme
#else
quarterword B1, B0;
#endif /* big memory words */
#endif /* LittleEndian */
} u;
} twohalves;