From 07008b5d45da78180c1a0513d63367b7bc228bf4 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 25 Jun 1998 13:48:44 -0300 Subject: details (by lhf) --- lundump.c | 36 +++++++++++------------------------- 1 file changed, 11 insertions(+), 25 deletions(-) (limited to 'lundump.c') diff --git a/lundump.c b/lundump.c index a5bd4a35..ed4bd19c 100644 --- a/lundump.c +++ b/lundump.c @@ -1,11 +1,10 @@ /* -** $Id: lundump.c,v 1.9 1998/06/13 16:54:15 lhf Exp $ +** $Id: lundump.c,v 1.10 1998/06/25 15:50:09 lhf Exp $ ** load bytecodes from files ** See Copyright Notice in lua.h */ #include - #include "lauxlib.h" #include "lfunc.h" #include "lmem.h" @@ -13,21 +12,12 @@ #include "lundump.h" #define LoadBlock(b,size,Z) ezread(Z,b,size) -#define LoadNative(t,D) LoadBlock(&t,sizeof(t),D) - -/* LUA_NUMBER */ -/* see comment in lundump.h */ +#define LoadNative(t,Z) LoadBlock(&t,sizeof(t),Z) -#if ID_NUMBER==ID_REAL4 - #define LoadNumber LoadFloat -#elif ID_NUMBER==ID_REAL8 - #define LoadNumber LoadDouble -#elif ID_NUMBER==ID_INT4 - #define LoadNumber LoadLong -#elif ID_NUMBER==ID_NATIVE - #define LoadNumber LoadNative +#if ID_NUMBER==ID_NATIVE + #define doLoadNumber(f,Z) LoadNative(f,Z) #else - #define LoadNumber LoadWhat + #define doLoadNumber(f,Z) f=LoadNumber(Z) #endif static void unexpectedEOZ(ZIO* Z) @@ -150,11 +140,7 @@ static void LoadConstants(TProtoFunc* tf, ZIO* Z) { case ID_NUM: ttype(o)=LUA_T_NUMBER; -#if ID_NUMBER==ID_NATIVE - LoadNative(nvalue(o),Z) -#else - nvalue(o)=LoadNumber(Z); -#endif + doLoadNumber(nvalue(o),Z); break; case ID_STR: ttype(o)=LUA_T_STRING; @@ -200,19 +186,19 @@ static void LoadHeader(ZIO* Z) luaL_verror( "%s too new: version=0x%02x; expected at most 0x%02x", zname(Z),version,VERSION); - if (version<0x31) /* major change in 3.1 */ + if (version