details (for regularity)
This commit is contained in:
7
lmem.h
7
lmem.h
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lmem.h,v 1.4 1997/12/01 20:30:44 roberto Exp roberto $
|
** $Id: lmem.h,v 1.5 1997/12/17 20:48:58 roberto Exp roberto $
|
||||||
** Interface to Memory Manager
|
** Interface to Memory Manager
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -8,10 +8,7 @@
|
|||||||
#define lmem_h
|
#define lmem_h
|
||||||
|
|
||||||
|
|
||||||
#ifndef NULL
|
#include <stdlib.h>
|
||||||
#define NULL 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* memory error messages */
|
/* memory error messages */
|
||||||
#define codeEM "code size overflow"
|
#define codeEM "code size overflow"
|
||||||
|
|||||||
8
lua.h
8
lua.h
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lua.h,v 1.23 1998/06/18 16:51:53 roberto Exp roberto $
|
** $Id: lua.h,v 1.24 1998/08/21 17:43:44 roberto Exp roberto $
|
||||||
** Lua - An Extensible Extension Language
|
** Lua - An Extensible Extension Language
|
||||||
** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil
|
** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil
|
||||||
** e-mail: lua@tecgraf.puc-rio.br
|
** e-mail: lua@tecgraf.puc-rio.br
|
||||||
@@ -20,12 +20,12 @@
|
|||||||
|
|
||||||
#define LUA_ANYTAG (-1)
|
#define LUA_ANYTAG (-1)
|
||||||
|
|
||||||
typedef void (*lua_CFunction) (void);
|
|
||||||
typedef unsigned int lua_Object;
|
|
||||||
|
|
||||||
typedef struct lua_State lua_State;
|
typedef struct lua_State lua_State;
|
||||||
extern lua_State *lua_state;
|
extern lua_State *lua_state;
|
||||||
|
|
||||||
|
typedef void (*lua_CFunction) (void);
|
||||||
|
typedef unsigned int lua_Object;
|
||||||
|
|
||||||
void lua_open (void);
|
void lua_open (void);
|
||||||
void lua_close (void);
|
void lua_close (void);
|
||||||
lua_State *lua_setstate (lua_State *st);
|
lua_State *lua_setstate (lua_State *st);
|
||||||
|
|||||||
36
lundump.c
36
lundump.c
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lundump.c,v 1.10 1998/06/25 15:50:09 lhf Exp $
|
** $Id: lundump.c,v 1.4 1998/06/25 16:48:44 roberto Exp roberto $
|
||||||
** load bytecodes from files
|
** load bytecodes from files
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -20,32 +20,32 @@
|
|||||||
#define doLoadNumber(f,Z) f=LoadNumber(Z)
|
#define doLoadNumber(f,Z) f=LoadNumber(Z)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void unexpectedEOZ(ZIO* Z)
|
static void unexpectedEOZ (ZIO* Z)
|
||||||
{
|
{
|
||||||
luaL_verror("unexpected end of file in %s",zname(Z));
|
luaL_verror("unexpected end of file in %s",zname(Z));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ezgetc(ZIO* Z)
|
static int ezgetc (ZIO* Z)
|
||||||
{
|
{
|
||||||
int c=zgetc(Z);
|
int c=zgetc(Z);
|
||||||
if (c==EOZ) unexpectedEOZ(Z);
|
if (c==EOZ) unexpectedEOZ(Z);
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ezread(ZIO* Z, void* b, int n)
|
static void ezread (ZIO* Z, void* b, int n)
|
||||||
{
|
{
|
||||||
int r=zread(Z,b,n);
|
int r=zread(Z,b,n);
|
||||||
if (r!=0) unexpectedEOZ(Z);
|
if (r!=0) unexpectedEOZ(Z);
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int LoadWord(ZIO* Z)
|
static unsigned int LoadWord (ZIO* Z)
|
||||||
{
|
{
|
||||||
unsigned int hi=ezgetc(Z);
|
unsigned int hi=ezgetc(Z);
|
||||||
unsigned int lo=ezgetc(Z);
|
unsigned int lo=ezgetc(Z);
|
||||||
return (hi<<8)|lo;
|
return (hi<<8)|lo;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned long LoadLong(ZIO* Z)
|
static unsigned long LoadLong (ZIO* Z)
|
||||||
{
|
{
|
||||||
unsigned long hi=LoadWord(Z);
|
unsigned long hi=LoadWord(Z);
|
||||||
unsigned long lo=LoadWord(Z);
|
unsigned long lo=LoadWord(Z);
|
||||||
@@ -55,7 +55,7 @@ static unsigned long LoadLong(ZIO* Z)
|
|||||||
#if ID_NUMBER==ID_REAL4
|
#if ID_NUMBER==ID_REAL4
|
||||||
/* LUA_NUMBER */
|
/* LUA_NUMBER */
|
||||||
/* assumes sizeof(long)==4 and sizeof(float)==4 (IEEE) */
|
/* assumes sizeof(long)==4 and sizeof(float)==4 (IEEE) */
|
||||||
static float LoadFloat(ZIO* Z)
|
static float LoadFloat (ZIO* Z)
|
||||||
{
|
{
|
||||||
unsigned long l=LoadLong(Z);
|
unsigned long l=LoadLong(Z);
|
||||||
float f=*(float*)&l;
|
float f=*(float*)&l;
|
||||||
@@ -66,7 +66,7 @@ static float LoadFloat(ZIO* Z)
|
|||||||
#if ID_NUMBER==ID_REAL8
|
#if ID_NUMBER==ID_REAL8
|
||||||
/* LUA_NUMBER */
|
/* LUA_NUMBER */
|
||||||
/* assumes sizeof(long)==4 and sizeof(double)==8 (IEEE) */
|
/* assumes sizeof(long)==4 and sizeof(double)==8 (IEEE) */
|
||||||
static double LoadDouble(ZIO* Z)
|
static double LoadDouble (ZIO* Z)
|
||||||
{
|
{
|
||||||
unsigned long l[2];
|
unsigned long l[2];
|
||||||
double f;
|
double f;
|
||||||
@@ -86,7 +86,7 @@ static double LoadDouble(ZIO* Z)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static Byte* LoadCode(ZIO* Z)
|
static Byte* LoadCode (ZIO* Z)
|
||||||
{
|
{
|
||||||
unsigned long size=LoadLong(Z);
|
unsigned long size=LoadLong(Z);
|
||||||
unsigned int s=size;
|
unsigned int s=size;
|
||||||
@@ -97,7 +97,7 @@ static Byte* LoadCode(ZIO* Z)
|
|||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
static TaggedString* LoadTString(ZIO* Z)
|
static TaggedString* LoadTString (ZIO* Z)
|
||||||
{
|
{
|
||||||
int size=LoadWord(Z);
|
int size=LoadWord(Z);
|
||||||
if (size==0)
|
if (size==0)
|
||||||
@@ -110,7 +110,7 @@ static TaggedString* LoadTString(ZIO* Z)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LoadLocals(TProtoFunc* tf, ZIO* Z)
|
static void LoadLocals (TProtoFunc* tf, ZIO* Z)
|
||||||
{
|
{
|
||||||
int i,n=LoadWord(Z);
|
int i,n=LoadWord(Z);
|
||||||
if (n==0) return;
|
if (n==0) return;
|
||||||
@@ -124,9 +124,9 @@ static void LoadLocals(TProtoFunc* tf, ZIO* Z)
|
|||||||
tf->locvars[i].varname=NULL;
|
tf->locvars[i].varname=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static TProtoFunc* LoadFunction(ZIO* Z);
|
static TProtoFunc* LoadFunction (ZIO* Z);
|
||||||
|
|
||||||
static void LoadConstants(TProtoFunc* tf, ZIO* Z)
|
static void LoadConstants (TProtoFunc* tf, ZIO* Z)
|
||||||
{
|
{
|
||||||
int i,n=LoadWord(Z);
|
int i,n=LoadWord(Z);
|
||||||
tf->nconsts=n;
|
tf->nconsts=n;
|
||||||
@@ -157,7 +157,7 @@ static void LoadConstants(TProtoFunc* tf, ZIO* Z)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static TProtoFunc* LoadFunction(ZIO* Z)
|
static TProtoFunc* LoadFunction (ZIO* Z)
|
||||||
{
|
{
|
||||||
TProtoFunc* tf=luaF_newproto();
|
TProtoFunc* tf=luaF_newproto();
|
||||||
tf->lineDefined=LoadWord(Z);
|
tf->lineDefined=LoadWord(Z);
|
||||||
@@ -168,7 +168,7 @@ static TProtoFunc* LoadFunction(ZIO* Z)
|
|||||||
return tf;
|
return tf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LoadSignature(ZIO* Z)
|
static void LoadSignature (ZIO* Z)
|
||||||
{
|
{
|
||||||
char* s=SIGNATURE;
|
char* s=SIGNATURE;
|
||||||
while (*s!=0 && ezgetc(Z)==*s)
|
while (*s!=0 && ezgetc(Z)==*s)
|
||||||
@@ -176,7 +176,7 @@ static void LoadSignature(ZIO* Z)
|
|||||||
if (*s!=0) luaL_verror("bad signature in %s",zname(Z));
|
if (*s!=0) luaL_verror("bad signature in %s",zname(Z));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LoadHeader(ZIO* Z)
|
static void LoadHeader (ZIO* Z)
|
||||||
{
|
{
|
||||||
int version,id,sizeofR;
|
int version,id,sizeofR;
|
||||||
real f=-TEST_NUMBER,tf=TEST_NUMBER;
|
real f=-TEST_NUMBER,tf=TEST_NUMBER;
|
||||||
@@ -205,7 +205,7 @@ static void LoadHeader(ZIO* Z)
|
|||||||
zname(Z),(double)f,(double)tf);
|
zname(Z),(double)f,(double)tf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static TProtoFunc* LoadChunk(ZIO* Z)
|
static TProtoFunc* LoadChunk (ZIO* Z)
|
||||||
{
|
{
|
||||||
LoadHeader(Z);
|
LoadHeader(Z);
|
||||||
return LoadFunction(Z);
|
return LoadFunction(Z);
|
||||||
@@ -215,7 +215,7 @@ static TProtoFunc* LoadChunk(ZIO* Z)
|
|||||||
** load one chunk from a file or buffer
|
** load one chunk from a file or buffer
|
||||||
** return main if ok and NULL at EOF
|
** return main if ok and NULL at EOF
|
||||||
*/
|
*/
|
||||||
TProtoFunc* luaU_undump1(ZIO* Z)
|
TProtoFunc* luaU_undump1 (ZIO* Z)
|
||||||
{
|
{
|
||||||
int c=zgetc(Z);
|
int c=zgetc(Z);
|
||||||
if (c==ID_CHUNK)
|
if (c==ID_CHUNK)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lundump.h,v 1.7 1998/06/25 15:50:09 lhf Exp $
|
** $Id: lundump.h,v 1.4 1998/06/25 16:48:44 roberto Exp roberto $
|
||||||
** load pre-compiled Lua chunks
|
** load pre-compiled Lua chunks
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
#include "lobject.h"
|
#include "lobject.h"
|
||||||
#include "lzio.h"
|
#include "lzio.h"
|
||||||
|
|
||||||
TProtoFunc* luaU_undump1(ZIO* Z); /* load one chunk */
|
TProtoFunc *luaU_undump1 (ZIO* Z); /* load one chunk */
|
||||||
|
|
||||||
#define SIGNATURE "Lua"
|
#define SIGNATURE "Lua"
|
||||||
#define VERSION 0x31 /* last format change was in 3.1 */
|
#define VERSION 0x31 /* last format change was in 3.1 */
|
||||||
|
|||||||
Reference in New Issue
Block a user