diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-05-07 14:36:56 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-05-07 14:36:56 -0300 |
| commit | dea6b6da9422f34ad91c8f6ad9ad3ed650e95713 (patch) | |
| tree | 3016b2fbcd67d75c71ee1b190aff2c24ada9b168 /lundump.c | |
| parent | 71144e3ff0cb81bd9b8bb56d94dc76074c638c64 (diff) | |
| download | lua-dea6b6da9422f34ad91c8f6ad9ad3ed650e95713.tar.gz lua-dea6b6da9422f34ad91c8f6ad9ad3ed650e95713.tar.bz2 lua-dea6b6da9422f34ad91c8f6ad9ad3ed650e95713.zip | |
new function `lua_vpushstr' to replace uses of `sprintf'
Diffstat (limited to 'lundump.c')
| -rw-r--r-- | lundump.c | 20 |
1 files changed, 10 insertions, 10 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lundump.c,v 1.44 2001/11/28 20:13:13 roberto Exp roberto $ | 2 | ** $Id: lundump.c,v 1.45 2002/03/25 17:47:14 roberto Exp roberto $ |
| 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 | */ |
| @@ -27,7 +27,7 @@ static const char* ZNAME (ZIO* Z) | |||
| 27 | 27 | ||
| 28 | static void unexpectedEOZ (lua_State* L, ZIO* Z) | 28 | static void unexpectedEOZ (lua_State* L, ZIO* Z) |
| 29 | { | 29 | { |
| 30 | luaO_verror(L,"unexpected end of file in `%.99s'",ZNAME(Z)); | 30 | luaO_verror(L,"unexpected end of file in `%s'",ZNAME(Z)); |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | static int ezgetc (lua_State* L, ZIO* Z) | 33 | static int ezgetc (lua_State* L, ZIO* Z) |
| @@ -157,7 +157,7 @@ static void LoadConstants (lua_State* L, Proto* f, ZIO* Z, int swap) | |||
| 157 | tsvalue(o)=LoadString(L,Z,swap); | 157 | tsvalue(o)=LoadString(L,Z,swap); |
| 158 | break; | 158 | break; |
| 159 | default: | 159 | default: |
| 160 | luaO_verror(L,"bad constant type (%d) in `%.99s'",ttype(o),ZNAME(Z)); | 160 | luaO_verror(L,"bad constant type (%d) in `%s'",ttype(o),ZNAME(Z)); |
| 161 | break; | 161 | break; |
| 162 | } | 162 | } |
| 163 | } | 163 | } |
| @@ -181,7 +181,7 @@ static Proto* LoadFunction (lua_State* L, TString* p, ZIO* Z, int swap) | |||
| 181 | LoadConstants(L,f,Z,swap); | 181 | LoadConstants(L,f,Z,swap); |
| 182 | LoadCode(L,f,Z,swap); | 182 | LoadCode(L,f,Z,swap); |
| 183 | #ifndef TRUST_BINARIES | 183 | #ifndef TRUST_BINARIES |
| 184 | if (!luaG_checkcode(f)) luaO_verror(L,"bad code in `%.99s'",ZNAME(Z)); | 184 | if (!luaG_checkcode(f)) luaO_verror(L,"bad code in `%s'",ZNAME(Z)); |
| 185 | #endif | 185 | #endif |
| 186 | return f; | 186 | return f; |
| 187 | } | 187 | } |
| @@ -191,14 +191,14 @@ static void LoadSignature (lua_State* L, ZIO* Z) | |||
| 191 | const char* s=LUA_SIGNATURE; | 191 | const char* s=LUA_SIGNATURE; |
| 192 | while (*s!=0 && ezgetc(L,Z)==*s) | 192 | while (*s!=0 && ezgetc(L,Z)==*s) |
| 193 | ++s; | 193 | ++s; |
| 194 | if (*s!=0) luaO_verror(L,"bad signature in `%.99s'",ZNAME(Z)); | 194 | if (*s!=0) luaO_verror(L,"bad signature in `%s'",ZNAME(Z)); |
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | static void TestSize (lua_State* L, int s, const char* what, ZIO* Z) | 197 | static void TestSize (lua_State* L, int s, const char* what, ZIO* Z) |
| 198 | { | 198 | { |
| 199 | int r=LoadByte(L,Z); | 199 | int r=LoadByte(L,Z); |
| 200 | if (r!=s) | 200 | if (r!=s) |
| 201 | luaO_verror(L,"virtual machine mismatch in `%.99s':\n" | 201 | luaO_verror(L,"virtual machine mismatch in `%s':\n" |
| 202 | " size of %.20s is %d but read %d",ZNAME(Z),what,s,r); | 202 | " size of %.20s is %d but read %d",ZNAME(Z),what,s,r); |
| 203 | } | 203 | } |
| 204 | 204 | ||
| @@ -212,11 +212,11 @@ static int LoadHeader (lua_State* L, ZIO* Z) | |||
| 212 | LoadSignature(L,Z); | 212 | LoadSignature(L,Z); |
| 213 | version=LoadByte(L,Z); | 213 | version=LoadByte(L,Z); |
| 214 | if (version>VERSION) | 214 | if (version>VERSION) |
| 215 | luaO_verror(L,"`%.99s' too new:\n" | 215 | luaO_verror(L,"`%s' too new:\n" |
| 216 | " read version %d.%d; expected at most %d.%d", | 216 | " read version %d.%d; expected at most %d.%d", |
| 217 | ZNAME(Z),V(version),V(VERSION)); | 217 | ZNAME(Z),V(version),V(VERSION)); |
| 218 | if (version<VERSION0) /* check last major change */ | 218 | if (version<VERSION0) /* check last major change */ |
| 219 | luaO_verror(L,"`%.99s' too old:\n" | 219 | luaO_verror(L,"`%s' too old:\n" |
| 220 | " read version %d.%d; expected at least %d.%d", | 220 | " read version %d.%d; expected at least %d.%d", |
| 221 | ZNAME(Z),V(version),V(VERSION)); | 221 | ZNAME(Z),V(version),V(VERSION)); |
| 222 | swap=(luaU_endianness()!=LoadByte(L,Z)); /* need to swap bytes? */ | 222 | swap=(luaU_endianness()!=LoadByte(L,Z)); /* need to swap bytes? */ |
| @@ -230,7 +230,7 @@ static int LoadHeader (lua_State* L, ZIO* Z) | |||
| 230 | TESTSIZE(sizeof(lua_Number), "number"); | 230 | TESTSIZE(sizeof(lua_Number), "number"); |
| 231 | x=LoadNumber(L,Z,swap); | 231 | x=LoadNumber(L,Z,swap); |
| 232 | if ((long)x!=(long)tx) /* disregard errors in last bits of fraction */ | 232 | if ((long)x!=(long)tx) /* disregard errors in last bits of fraction */ |
| 233 | luaO_verror(L,"unknown number format in `%.99s':\n" | 233 | luaO_verror(L,"unknown number format in `%s':\n" |
| 234 | " read " LUA_NUMBER_FMT "; expected " LUA_NUMBER_FMT, | 234 | " read " LUA_NUMBER_FMT "; expected " LUA_NUMBER_FMT, |
| 235 | ZNAME(Z),x,tx); | 235 | ZNAME(Z),x,tx); |
| 236 | return swap; | 236 | return swap; |
| @@ -248,7 +248,7 @@ Proto* luaU_undump (lua_State* L, ZIO* Z) | |||
| 248 | { | 248 | { |
| 249 | Proto* f=LoadChunk(L,Z); | 249 | Proto* f=LoadChunk(L,Z); |
| 250 | if (zgetc(Z)!=EOZ) | 250 | if (zgetc(Z)!=EOZ) |
| 251 | luaO_verror(L,"`%.99s' apparently contains more than one chunk",ZNAME(Z)); | 251 | luaO_verror(L,"`%s' apparently contains more than one chunk",ZNAME(Z)); |
| 252 | return f; | 252 | return f; |
| 253 | } | 253 | } |
| 254 | 254 | ||
