diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-04-10 14:39:41 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-04-10 14:39:41 -0300 |
commit | 762c7370376dbd13cd8aeb4d8c8da0bb153269c3 (patch) | |
tree | 6170a2d6bc5d2a7cd4f15cf180dd17d89bf36554 | |
parent | de57dc2653ff9efcdfd1ddc5f21aaaa159e5f79a (diff) | |
download | lua-5.0.tar.gz lua-5.0.tar.bz2 lua-5.0.zip |
last changes by lhfv5.0
-rw-r--r-- | ldump.c | 9 | ||||
-rw-r--r-- | lundump.c | 10 | ||||
-rw-r--r-- | lundump.h | 8 |
3 files changed, 14 insertions, 13 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldump.c,v 1.3 2003/01/27 15:52:57 roberto Exp roberto $ | 2 | ** $Id: ldump.c,v 1.4 2003/02/11 23:52:12 lhf Exp $ |
3 | ** save bytecodes | 3 | ** save bytecodes |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -90,9 +90,9 @@ static void DumpLines(const Proto* f, DumpState* D) | |||
90 | 90 | ||
91 | static void DumpUpvalues(const Proto* f, DumpState* D) | 91 | static void DumpUpvalues(const Proto* f, DumpState* D) |
92 | { | 92 | { |
93 | int i,n=f->sizeupvalues; | 93 | int i,n=f->sizeupvalues; |
94 | DumpInt(n,D); | 94 | DumpInt(n,D); |
95 | for (i=0; i<n; i++) DumpString(f->upvalues[i],D); | 95 | for (i=0; i<n; i++) DumpString(f->upvalues[i],D); |
96 | } | 96 | } |
97 | 97 | ||
98 | static void DumpFunction(const Proto* f, const TString* p, DumpState* D); | 98 | static void DumpFunction(const Proto* f, const TString* p, DumpState* D); |
@@ -167,3 +167,4 @@ void luaU_dump (lua_State* L, const Proto* Main, lua_Chunkwriter w, void* data) | |||
167 | DumpHeader(&D); | 167 | DumpHeader(&D); |
168 | DumpFunction(Main,NULL,&D); | 168 | DumpFunction(Main,NULL,&D); |
169 | } | 169 | } |
170 | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lundump.c,v 1.59 2003/01/27 15:52:57 roberto Exp roberto $ | 2 | ** $Id: lundump.c,v 1.49 2003/04/07 20:34:20 lhf Exp $ |
3 | ** load pre-compiled Lua chunks | 3 | ** load pre-compiled Lua chunks |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -104,7 +104,7 @@ static TString* LoadString (LoadState* S) | |||
104 | { | 104 | { |
105 | char* s=luaZ_openspace(S->L,S->b,size); | 105 | char* s=luaZ_openspace(S->L,S->b,size); |
106 | ezread(S,s,size); | 106 | ezread(S,s,size); |
107 | return luaS_newlstr(S->L,s,size-1); /* remove trailing '\0' */ | 107 | return luaS_newlstr(S->L,s,size-1); /* remove trailing '\0' */ |
108 | } | 108 | } |
109 | } | 109 | } |
110 | 110 | ||
@@ -146,7 +146,7 @@ static void LoadUpvalues (LoadState* S, Proto* f) | |||
146 | luaG_runerror(S->L,"bad nupvalues in %s: read %d; expected %d", | 146 | luaG_runerror(S->L,"bad nupvalues in %s: read %d; expected %d", |
147 | S->name,n,f->nups); | 147 | S->name,n,f->nups); |
148 | f->upvalues=luaM_newvector(S->L,n,TString*); | 148 | f->upvalues=luaM_newvector(S->L,n,TString*); |
149 | f->sizeupvalues = n; | 149 | f->sizeupvalues=n; |
150 | for (i=0; i<n; i++) f->upvalues[i]=LoadString(S); | 150 | for (i=0; i<n; i++) f->upvalues[i]=LoadString(S); |
151 | } | 151 | } |
152 | 152 | ||
@@ -226,14 +226,14 @@ static void TestSize (LoadState* S, int s, const char* what) | |||
226 | static void LoadHeader (LoadState* S) | 226 | static void LoadHeader (LoadState* S) |
227 | { | 227 | { |
228 | int version; | 228 | int version; |
229 | lua_Number x=0,tx=TEST_NUMBER; | 229 | lua_Number x,tx=TEST_NUMBER; |
230 | LoadSignature(S); | 230 | LoadSignature(S); |
231 | version=LoadByte(S); | 231 | version=LoadByte(S); |
232 | if (version>VERSION) | 232 | if (version>VERSION) |
233 | luaG_runerror(S->L,"%s too new: " | 233 | luaG_runerror(S->L,"%s too new: " |
234 | "read version %d.%d; expected at most %d.%d", | 234 | "read version %d.%d; expected at most %d.%d", |
235 | S->name,V(version),V(VERSION)); | 235 | S->name,V(version),V(VERSION)); |
236 | if (version<VERSION0) /* check last major change */ | 236 | if (version<VERSION0) /* check last major change */ |
237 | luaG_runerror(S->L,"%s too old: " | 237 | luaG_runerror(S->L,"%s too old: " |
238 | "read version %d.%d; expected at least %d.%d", | 238 | "read version %d.%d; expected at least %d.%d", |
239 | S->name,V(version),V(VERSION0)); | 239 | S->name,V(version),V(VERSION0)); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lundump.h,v 1.28 2002/12/13 11:12:35 lhf Exp $ | 2 | ** $Id: lundump.h,v 1.30 2003/04/07 20:34:20 lhf Exp $ |
3 | ** load pre-compiled Lua chunks | 3 | ** load pre-compiled Lua chunks |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -23,12 +23,12 @@ void luaU_dump (lua_State* L, const Proto* Main, lua_Chunkwriter w, void* data); | |||
23 | void luaU_print (const Proto* Main); | 23 | void luaU_print (const Proto* Main); |
24 | 24 | ||
25 | /* definitions for headers of binary files */ | 25 | /* definitions for headers of binary files */ |
26 | #define LUA_SIGNATURE "\033Lua" /* binary files start with <esc>Lua */ | 26 | #define LUA_SIGNATURE "\033Lua" /* binary files start with "<esc>Lua" */ |
27 | #define VERSION 0x50 /* last format change was in 5.0 */ | 27 | #define VERSION 0x50 /* last format change was in 5.0 */ |
28 | #define VERSION0 0x50 /* last major change was in 5.0 */ | 28 | #define VERSION0 0x50 /* last major change was in 5.0 */ |
29 | 29 | ||
30 | /* a multiple of PI for testing native format */ | 30 | /* a multiple of PI for testing native format */ |
31 | /* multiplying by 1E8 gives non-trivial integer values */ | 31 | /* multiplying by 1E7 gives non-trivial integer values */ |
32 | #define TEST_NUMBER 3.14159265358979323846E8 | 32 | #define TEST_NUMBER ((lua_Number)3.14159265358979323846E7) |
33 | 33 | ||
34 | #endif | 34 | #endif |