summaryrefslogtreecommitdiff
path: root/Build/source
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2012-08-07 13:23:53 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2012-08-07 13:23:53 +0000
commite18a0d3379d56e07aaf10334bcadd4a68889819d (patch)
tree338f3bc1c47ba4ddc5b45a008cd3fce511fda666 /Build/source
parent41ddf905c124da09f188bf0b7b1f40b7f5c0e47a (diff)
luaTeX: Move swap_items() to tex/texfileio.w where it is used
git-svn-id: svn://tug.org/texlive/trunk@27330 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r--Build/source/texk/web2c/luatexdir/ChangeLog6
-rw-r--r--Build/source/texk/web2c/luatexdir/luatex.c95
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/dumpdata.h6
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/texfileio.w93
4 files changed, 100 insertions, 100 deletions
diff --git a/Build/source/texk/web2c/luatexdir/ChangeLog b/Build/source/texk/web2c/luatexdir/ChangeLog
index ba1c99c0f1e..ffc4182063e 100644
--- a/Build/source/texk/web2c/luatexdir/ChangeLog
+++ b/Build/source/texk/web2c/luatexdir/ChangeLog
@@ -1,3 +1,9 @@
+2012-08-07 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * tex/dumpdata.h: Remove the swap_items() prototype.
+ * luatex.c (swap_items): Moved from here ...
+ * tex/texfileio.w (swap_items): ... to here and declared static.
+
2012-08-03 Peter Breitenlohner <peb@mppmu.mpg.de>
* luatex.[ch] [W32TeX]: Use DLLPROC for luatex.dll.
diff --git a/Build/source/texk/web2c/luatexdir/luatex.c b/Build/source/texk/web2c/luatexdir/luatex.c
index a9b7aa88a75..0d540533ee4 100644
--- a/Build/source/texk/web2c/luatexdir/luatex.c
+++ b/Build/source/texk/web2c/luatexdir/luatex.c
@@ -880,101 +880,6 @@ boolean input_line(FILE * f)
-/* Read and write dump files. As distributed, these files are
- architecture dependent; specifically, BigEndian and LittleEndian
- architectures produce different files. These routines always output
- BigEndian files. This still does not guarantee them to be
- architecture-independent, because it is possible to make a format
- that dumps a glue ratio, i.e., a floating-point number. Fortunately,
- none of the standard formats do that. */
-
-#if !defined (WORDS_BIGENDIAN) && !defined (NO_DUMP_SHARE) /* this fn */
-
-/* This macro is always invoked as a statement. It assumes a variable
- `temp'. */
-
-# define SWAP(x, y) do { temp = x; x = y; y = temp; } while (0)
-
-
-/* Make the NITEMS items pointed at by P, each of size SIZE, be the
- opposite-endianness of whatever they are now. */
-
-void swap_items(char *pp, int nitems, int size)
-{
- char temp;
- unsigned total = (unsigned) (nitems * size);
- char *q = xmalloc(total);
- char *p = q;
- memcpy(p,pp,total);
- /* Since `size' does not change, we can write a while loop for each
- case, and avoid testing `size' for each time. */
- switch (size) {
- /* 16-byte items happen on the DEC Alpha machine when we are not
- doing sharable memory dumps. */
- case 16:
- while (nitems--) {
- SWAP(p[0], p[15]);
- SWAP(p[1], p[14]);
- SWAP(p[2], p[13]);
- SWAP(p[3], p[12]);
- SWAP(p[4], p[11]);
- SWAP(p[5], p[10]);
- SWAP(p[6], p[9]);
- SWAP(p[7], p[8]);
- p += size;
- }
- break;
-
- case 12:
- while (nitems--) {
- SWAP(p[0], p[11]);
- SWAP(p[1], p[10]);
- SWAP(p[2], p[9]);
- SWAP(p[3], p[8]);
- SWAP(p[4], p[7]);
- SWAP(p[5], p[6]);
- p += size;
- }
- break;
-
- case 8:
- while (nitems--) {
- SWAP(p[0], p[7]);
- SWAP(p[1], p[6]);
- SWAP(p[2], p[5]);
- SWAP(p[3], p[4]);
- p += size;
- }
- break;
-
- case 4:
- while (nitems--) {
- SWAP(p[0], p[3]);
- SWAP(p[1], p[2]);
- p += size;
- }
- break;
-
- case 2:
- while (nitems--) {
- SWAP(p[0], p[1]);
- p += size;
- }
- break;
-
- case 1:
- /* Nothing to do. */
- break;
-
- default:
- FATAL1("Can't swap a %d-byte item for (un)dumping", size);
- }
- memcpy(pp,q,total);
- xfree(q);
-}
-#endif /* not WORDS_BIGENDIAN and not NO_DUMP_SHARE */
-
-
/* Get the job name to be used, which may have been set from the
command line. */
diff --git a/Build/source/texk/web2c/luatexdir/tex/dumpdata.h b/Build/source/texk/web2c/luatexdir/tex/dumpdata.h
index 3b29ca6372d..07a62f87ef5 100644
--- a/Build/source/texk/web2c/luatexdir/tex/dumpdata.h
+++ b/Build/source/texk/web2c/luatexdir/tex/dumpdata.h
@@ -1,6 +1,6 @@
/* dumpdata.h
- Copyright 2009 Taco Hoekwater <taco@luatex.org>
+ Copyright 2009, 2012 Taco Hoekwater <taco@luatex.org>
This file is part of LuaTeX.
@@ -38,10 +38,6 @@ extern boolean load_fmt_file(const char *);
extern void do_zdump(char *, int, int, FILE *);
extern void do_zundump(char *, int, int, FILE *);
-# if !defined (WORDS_BIGENDIAN) && !defined (NO_DUMP_SHARE) /* this fn */
-extern void swap_items(char *p, int nitems, int size); /* in luatex.c */
-# endif
-
/* Like do_undump, but check each value against LOW and HIGH. The
slowdown isn't significant, and this improves the chances of
detecting incompatible format files. In fact, Knuth himself noted
diff --git a/Build/source/texk/web2c/luatexdir/tex/texfileio.w b/Build/source/texk/web2c/luatexdir/tex/texfileio.w
index 396cfd78607..7123bdfb557 100644
--- a/Build/source/texk/web2c/luatexdir/tex/texfileio.w
+++ b/Build/source/texk/web2c/luatexdir/tex/texfileio.w
@@ -984,6 +984,99 @@ is needed.
@c
static gzFile gz_fmtfile = NULL;
+@ As distributed, the dump files are
+architecture dependent; specifically, BigEndian and LittleEndian
+architectures produce different files. These routines always output
+BigEndian files. This still does not guarantee them to be
+architecture-independent, because it is possible to make a format
+that dumps a glue ratio, i.e., a floating-point number. Fortunately,
+none of the standard formats do that.
+
+@c
+#if !defined (WORDS_BIGENDIAN) && !defined (NO_DUMP_SHARE)
+
+/* This macro is always invoked as a statement. It assumes a variable
+ `temp'. */
+# define SWAP(x, y) do { temp = x; x = y; y = temp; } while (0)
+
+/* Make the NITEMS items pointed at by P, each of size SIZE, be the
+ opposite-endianness of whatever they are now. */
+static void
+swap_items(char *pp, int nitems, int size)
+{
+ char temp;
+ unsigned total = (unsigned) (nitems * size);
+ char *q = xmalloc(total);
+ char *p = q;
+ memcpy(p,pp,total);
+ /* Since `size' does not change, we can write a while loop for each
+ case, and avoid testing `size' for each time. */
+ switch (size) {
+ /* 16-byte items happen on the DEC Alpha machine when we are not
+ doing sharable memory dumps. */
+ case 16:
+ while (nitems--) {
+ SWAP(p[0], p[15]);
+ SWAP(p[1], p[14]);
+ SWAP(p[2], p[13]);
+ SWAP(p[3], p[12]);
+ SWAP(p[4], p[11]);
+ SWAP(p[5], p[10]);
+ SWAP(p[6], p[9]);
+ SWAP(p[7], p[8]);
+ p += size;
+ }
+ break;
+
+ case 12:
+ while (nitems--) {
+ SWAP(p[0], p[11]);
+ SWAP(p[1], p[10]);
+ SWAP(p[2], p[9]);
+ SWAP(p[3], p[8]);
+ SWAP(p[4], p[7]);
+ SWAP(p[5], p[6]);
+ p += size;
+ }
+ break;
+
+ case 8:
+ while (nitems--) {
+ SWAP(p[0], p[7]);
+ SWAP(p[1], p[6]);
+ SWAP(p[2], p[5]);
+ SWAP(p[3], p[4]);
+ p += size;
+ }
+ break;
+
+ case 4:
+ while (nitems--) {
+ SWAP(p[0], p[3]);
+ SWAP(p[1], p[2]);
+ p += size;
+ }
+ break;
+
+ case 2:
+ while (nitems--) {
+ SWAP(p[0], p[1]);
+ p += size;
+ }
+ break;
+
+ case 1:
+ /* Nothing to do. */
+ break;
+
+ default:
+ FATAL1("Can't swap a %d-byte item for (un)dumping", size);
+ }
+ memcpy(pp,q,total);
+ xfree(q);
+}
+#endif /* not WORDS_BIGENDIAN and not NO_DUMP_SHARE */
+
@ That second swap is to make sure following calls don't get
confused in the case of |dump_things|.