1 /* Copyright 1992 Karl Berry
2 Copyright 2007 TeX Users Group
3 Copyright 2014 Clerk Ma
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 /* texmfmem.h: the memory_word type, which is too hard to translate
21 automatically from Pascal. We have to make sure the byte-swapping
22 that the (un)dumping routines do suffices to put things in the right
25 A memory_word can be broken up into a `twohalves' or a
26 `fourquarters', and a `twohalves' can be further broken up. Here is
27 a picture. ..._M = most significant byte, ..._L = least significant
31 twohalves.v: RH_M RH_L LH_M LH_L
32 twohalves.u: JNK1 JNK2 B0 B1
33 fourquarters: B0 B1 B2 B3
36 twohalves.v: LH_L LH_M RH_L RH_M
37 twohalves.u: B1 B0 JNK1 JNK2
38 fourquarters: B3 B2 B1 B0
40 The halfword fields are four bytes if we are building a TeX or MF;
41 this leads to further complications:
44 twohalves.v: RH_MM RH_ML RH_LM RH_LL LH_MM LH_ML LH_LM LH_LL
45 twohalves.u: ---------JUNK---------- B0 B1
46 fourquarters: B0 B1 B2 B3
49 twohalves.v: LH_LL LH_LM LH_ML LH_MM RH_LL RH_LM RH_ML RH_MM
50 twohalves.u: junkx junky B1 B0
51 fourquarters: ---------JUNK---------- B3 B2 B1 B0
53 I guess TeX and Metafont never refer to the B1 and B0 in the
54 fourquarters structure as the B1 and B0 in the twohalves.u structure.
56 This file can't be part of texmf.h, because texmf.h gets included by
57 {tex,mf}d.h before the `halfword' etc. types are defined. So we
58 include it from the change file instead.
65 #ifdef WORDS_BIGENDIAN
73 { /* Make B0,B1 overlap the most significant bytes of LH. */
74 #ifdef WORDS_BIGENDIAN
77 #else /* not WORDS_BIGENDIAN */
78 /* If 32-bit TeX/MF, have to have an extra two bytes of junk.
79 I would like to break this line, but I'm afraid that some
80 preprocessors don't properly handle backslash-newline in # commands. */
81 #if (defined (TeX) && !defined (SMALLTeX)) || !defined (TeX) && !defined (SMALLMF)
82 quarterword junkx, junky;
83 #endif /* big TeX or big MF */
85 #endif /* not WORDS_BIGENDIAN */
89 /* new in Y&Y TeX 1.3 1996/Jan/18 used for hash [...] if SHORTHASH defined */
93 #ifdef WORDS_BIGENDIAN
105 #ifdef WORDS_BIGENDIAN
106 quarterword B0, B1, B2, B3;
108 quarterword B3, B2, B1, B0;
122 #ifdef WORDS_BIGENDIAN
125 #else /* not WORDS_BIGENDIAN */
128 #if defined (TeX) && !defined (SMALLTeX) || !defined (TeX) && !defined (SMALLMF)
130 #endif /* big TeX or big MF */
136 #if defined (TeX) && !defined (SMALLTeX) || !defined (TeX) && !defined (SMALLMF)
138 #endif /* big TeX or big MF */
141 #endif /* not WORDS_BIGENDIAN */
144 /* Attempt to reduce size of font_info array ... (and hence format files) */
146 typedef unsigned char unsignedchar;
152 #ifdef WORDS_BIGENDIAN
153 unsignedchar B0, B1, B2, B3;
155 unsignedchar B3, B2, B1, B0;
158 } ffourquarters; /* was fourunsignedchars; */
160 #define fquarterword unsigned char
164 /* fourunsignedchars qqqq; */
168 /* To keep the original structure accesses working, we must go through
169 the extra names C forced us to introduce. */
178 #ifndef WORDS_BIGENDIAN