summaryrefslogtreecommitdiff
path: root/lundump.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1998-03-26 11:50:19 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1998-03-26 11:50:19 -0300
commit439236773b9d36208375bb8eed251bcd393f7b24 (patch)
tree6946da44c969c715c09b9d3170e99dfd898d7c54 /lundump.h
parent2a2b64d6ac2ea7839dac41cc84be1c7a5a18bee7 (diff)
downloadlua-github-439236773b9d36208375bb8eed251bcd393f7b24.tar.gz
changes by lhf
Diffstat (limited to 'lundump.h')
-rw-r--r--lundump.h42
1 files changed, 34 insertions, 8 deletions
diff --git a/lundump.h b/lundump.h
index ea9e975c..7e5b286c 100644
--- a/lundump.h
+++ b/lundump.h
@@ -1,5 +1,5 @@
/*
-** $Id: lundump.h,v 1.4 1998/01/13 20:05:24 lhf Exp $
+** $Id: lundump.h,v 1.5 1998/02/06 20:05:39 lhf Exp lhf $
** load pre-compiled Lua chunks
** See Copyright Notice in lua.h
*/
@@ -10,18 +10,44 @@
#include "lobject.h"
#include "lzio.h"
+TProtoFunc* luaU_undump1(ZIO* Z); /* load one chunk */
+
+#define SIGNATURE "Lua"
+#define VERSION 0x31 /* last format change was in 3.1 */
+
+#define IsMain(f) (f->lineDefined==0)
+
#define ID_CHUNK 27 /* ESC */
-#define ID_FUNCTION '#'
-#define ID_END '$'
#define ID_NUM 'N'
#define ID_STR 'S'
#define ID_FUN 'F'
-#define SIGNATURE "Lua"
-#define VERSION 0x31 /* last format change was in 3.1 */
-#define TEST_FLOAT 0.123456789e-23 /* a float for testing representation */
-#define IsMain(f) (f->lineDefined==0)
+#define ID_INT4 'l'
+#define ID_REAL4 'f'
+#define ID_REAL8 'd'
+#define ID_NATIVE '?'
-TProtoFunc* luaU_undump1(ZIO* Z); /* load one chunk */
+/*
+* use a multiple of PI for testing number representation.
+* multiplying by 10E8 gives notrivial integer values.
+*/
+#define TEST_NUMBER 3.14159265358979323846E8
+
+/* LUA_NUMBER */
+/* if you change the definition of real, make sure you set ID_NUMBER
+* accordingly, specially if sizeof(long)!=4.
+* for types other than the ones listed below, you'll have to write your own
+* dump and undump routines.
+*/
+
+#if real==float
+ #define ID_NUMBER ID_REAL4
+#elif real==double
+ #define ID_NUMBER ID_REAL8
+#elif real==long
+ #define ID_NUMBER ID_INT4
+#else
+ #define ID_NUMBER ID_NATIVE
+#endif
#endif