diff --git a/lapi.h b/lapi.h index 618448a6..bb522de5 100644 --- a/lapi.h +++ b/lapi.h @@ -1,5 +1,5 @@ /* -** $Id: lapi.h,v 1.21 2002/03/04 21:29:41 roberto Exp roberto $ +** $Id: lapi.h,v 2.1 2003/12/10 12:13:36 roberto Exp roberto $ ** Auxiliary functions from Lua API ** See Copyright Notice in lua.h */ @@ -11,6 +11,6 @@ #include "lobject.h" -void luaA_pushobject (lua_State *L, const TValue *o); +LUAI_FUNC void luaA_pushobject (lua_State *L, const TValue *o); #endif diff --git a/lcode.h b/lcode.h index c1fae300..d32e3503 100644 --- a/lcode.h +++ b/lcode.h @@ -1,5 +1,5 @@ /* -** $Id: lcode.h,v 1.41 2005/03/08 18:00:16 roberto Exp roberto $ +** $Id: lcode.h,v 1.42 2005/03/16 16:59:21 roberto Exp roberto $ ** Code generator for Lua ** See Copyright Notice in lua.h */ @@ -43,36 +43,36 @@ typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_SIZE, OPR_NOUNOPR } UnOpr; #define luaK_setmultret(fs,e) luaK_setreturns(fs, e, LUA_MULTRET) -int luaK_code (FuncState *fs, Instruction i, int line); -int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx); -int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C); -void luaK_fixline (FuncState *fs, int line); -void luaK_nil (FuncState *fs, int from, int n); -void luaK_reserveregs (FuncState *fs, int n); -void luaK_checkstack (FuncState *fs, int n); -int luaK_stringK (FuncState *fs, TString *s); -int luaK_numberK (FuncState *fs, lua_Number r); -void luaK_dischargevars (FuncState *fs, expdesc *e); -int luaK_exp2anyreg (FuncState *fs, expdesc *e); -void luaK_exp2nextreg (FuncState *fs, expdesc *e); -void luaK_exp2val (FuncState *fs, expdesc *e); -int luaK_exp2RK (FuncState *fs, expdesc *e); -void luaK_self (FuncState *fs, expdesc *e, expdesc *key); -void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k); -void luaK_goiftrue (FuncState *fs, expdesc *e); -void luaK_goiffalse (FuncState *fs, expdesc *e); -void luaK_storevar (FuncState *fs, expdesc *var, expdesc *e); -void luaK_setreturns (FuncState *fs, expdesc *e, int nresults); -void luaK_setoneret (FuncState *fs, expdesc *e); -int luaK_jump (FuncState *fs); -void luaK_patchlist (FuncState *fs, int list, int target); -void luaK_patchtohere (FuncState *fs, int list); -void luaK_concat (FuncState *fs, int *l1, int l2); -int luaK_getlabel (FuncState *fs); -void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v); -void luaK_infix (FuncState *fs, BinOpr op, expdesc *v); -void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1, expdesc *v2); -void luaK_setlist (FuncState *fs, int base, int nelems, int tostore); +LUAI_FUNC int luaK_code (FuncState *fs, Instruction i, int line); +LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx); +LUAI_FUNC int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C); +LUAI_FUNC void luaK_fixline (FuncState *fs, int line); +LUAI_FUNC void luaK_nil (FuncState *fs, int from, int n); +LUAI_FUNC void luaK_reserveregs (FuncState *fs, int n); +LUAI_FUNC void luaK_checkstack (FuncState *fs, int n); +LUAI_FUNC int luaK_stringK (FuncState *fs, TString *s); +LUAI_FUNC int luaK_numberK (FuncState *fs, lua_Number r); +LUAI_FUNC void luaK_dischargevars (FuncState *fs, expdesc *e); +LUAI_FUNC int luaK_exp2anyreg (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_exp2nextreg (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_exp2val (FuncState *fs, expdesc *e); +LUAI_FUNC int luaK_exp2RK (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_self (FuncState *fs, expdesc *e, expdesc *key); +LUAI_FUNC void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k); +LUAI_FUNC void luaK_goiftrue (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_goiffalse (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_storevar (FuncState *fs, expdesc *var, expdesc *e); +LUAI_FUNC void luaK_setreturns (FuncState *fs, expdesc *e, int nresults); +LUAI_FUNC void luaK_setoneret (FuncState *fs, expdesc *e); +LUAI_FUNC int luaK_jump (FuncState *fs); +LUAI_FUNC void luaK_patchlist (FuncState *fs, int list, int target); +LUAI_FUNC void luaK_patchtohere (FuncState *fs, int list); +LUAI_FUNC void luaK_concat (FuncState *fs, int *l1, int l2); +LUAI_FUNC int luaK_getlabel (FuncState *fs); +LUAI_FUNC void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v); +LUAI_FUNC void luaK_infix (FuncState *fs, BinOpr op, expdesc *v); +LUAI_FUNC void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1, expdesc *v2); +LUAI_FUNC void luaK_setlist (FuncState *fs, int base, int nelems, int tostore); #endif diff --git a/ldebug.h b/ldebug.h index 8f087b52..fcb0b901 100644 --- a/ldebug.h +++ b/ldebug.h @@ -1,5 +1,5 @@ /* -** $Id: ldebug.h,v 2.1 2003/12/10 12:13:36 roberto Exp roberto $ +** $Id: ldebug.h,v 2.2 2004/06/02 19:07:55 roberto Exp roberto $ ** Auxiliary functions from Debug Interface module ** See Copyright Notice in lua.h */ @@ -18,13 +18,16 @@ #define resethookcount(L) (L->hookcount = L->basehookcount) -void luaG_typeerror (lua_State *L, const TValue *o, const char *opname); -void luaG_concaterror (lua_State *L, StkId p1, StkId p2); -void luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2); -int luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2); -void luaG_runerror (lua_State *L, const char *fmt, ...); -void luaG_errormsg (lua_State *L); -int luaG_checkcode (const Proto *pt); -int luaG_checkopenop (Instruction i); +LUAI_FUNC void luaG_typeerror (lua_State *L, const TValue *o, + const char *opname); +LUAI_FUNC void luaG_concaterror (lua_State *L, StkId p1, StkId p2); +LUAI_FUNC void luaG_aritherror (lua_State *L, const TValue *p1, + const TValue *p2); +LUAI_FUNC int luaG_ordererror (lua_State *L, const TValue *p1, + const TValue *p2); +LUAI_FUNC void luaG_runerror (lua_State *L, const char *fmt, ...); +LUAI_FUNC void luaG_errormsg (lua_State *L); +LUAI_FUNC int luaG_checkcode (const Proto *pt); +LUAI_FUNC int luaG_checkopenop (Instruction i); #endif diff --git a/ldo.h b/ldo.h index 665934bd..e16e53c6 100644 --- a/ldo.h +++ b/ldo.h @@ -1,5 +1,5 @@ /* -** $Id: ldo.h,v 2.2 2004/05/14 19:25:09 roberto Exp roberto $ +** $Id: ldo.h,v 2.3 2004/09/08 14:23:09 roberto Exp roberto $ ** Stack and Call structure of Lua ** See Copyright Notice in lua.h */ @@ -47,20 +47,20 @@ /* type of protected functions, to be ran by `runprotected' */ typedef void (*Pfunc) (lua_State *L, void *ud); -void luaD_resetprotection (lua_State *L); -int luaD_protectedparser (lua_State *L, ZIO *z, const char *name); -void luaD_callhook (lua_State *L, int event, int line); -int luaD_precall (lua_State *L, StkId func, int nresults); -void luaD_call (lua_State *L, StkId func, int nResults); -int luaD_pcall (lua_State *L, Pfunc func, void *u, - ptrdiff_t oldtop, ptrdiff_t ef); -void luaD_poscall (lua_State *L, int wanted, StkId firstResult); -void luaD_reallocCI (lua_State *L, int newsize); -void luaD_reallocstack (lua_State *L, int newsize); -void luaD_growstack (lua_State *L, int n); +LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name); +LUAI_FUNC void luaD_callhook (lua_State *L, int event, int line); +LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults); +LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults); +LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, + ptrdiff_t oldtop, ptrdiff_t ef); +LUAI_FUNC void luaD_poscall (lua_State *L, int wanted, StkId firstResult); +LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize); +LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize); +LUAI_FUNC void luaD_growstack (lua_State *L, int n); -void luaD_throw (lua_State *L, int errcode); -int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud); +LUAI_FUNC void luaD_throw (lua_State *L, int errcode); +LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud); #endif + diff --git a/lfunc.h b/lfunc.h index a69b5327..6f19e2fa 100644 --- a/lfunc.h +++ b/lfunc.h @@ -1,5 +1,5 @@ /* -** $Id: lfunc.h,v 2.2 2005/01/18 17:18:09 roberto Exp roberto $ +** $Id: lfunc.h,v 2.3 2005/02/18 12:40:02 roberto Exp roberto $ ** Auxiliary functions to manipulate prototypes and closures ** See Copyright Notice in lua.h */ @@ -18,17 +18,17 @@ cast(int, sizeof(TValue *)*((n)-1))) -Proto *luaF_newproto (lua_State *L); -Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e); -Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e); -UpVal *luaF_newupval (lua_State *L); -UpVal *luaF_findupval (lua_State *L, StkId level); -void luaF_close (lua_State *L, StkId level); -void luaF_freeproto (lua_State *L, Proto *f); -void luaF_freeclosure (lua_State *L, Closure *c); -void luaF_freeupval (lua_State *L, UpVal *uv); - -const char *luaF_getlocalname (const Proto *func, int local_number, int pc); +LUAI_FUNC Proto *luaF_newproto (lua_State *L); +LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e); +LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e); +LUAI_FUNC UpVal *luaF_newupval (lua_State *L); +LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); +LUAI_FUNC void luaF_close (lua_State *L, StkId level); +LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); +LUAI_FUNC void luaF_freeclosure (lua_State *L, Closure *c); +LUAI_FUNC void luaF_freeupval (lua_State *L, UpVal *uv); +LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, + int pc); #endif diff --git a/lgc.h b/lgc.h index be7aa039..6c628a23 100644 --- a/lgc.h +++ b/lgc.h @@ -1,5 +1,5 @@ /* -** $Id: lgc.h,v 2.11 2005/02/10 13:25:02 roberto Exp roberto $ +** $Id: lgc.h,v 2.12 2005/02/23 17:30:22 roberto Exp roberto $ ** Garbage Collector ** See Copyright Notice in lua.h */ @@ -95,15 +95,15 @@ { if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) \ luaC_barrierback(L,obj2gco(p)); } -size_t luaC_separateudata (lua_State *L, int all); -void luaC_callGCTM (lua_State *L); -void luaC_freeall (lua_State *L); -void luaC_step (lua_State *L); -void luaC_fullgc (lua_State *L); -void luaC_link (lua_State *L, GCObject *o, lu_byte tt); -void luaC_linkupval (lua_State *L, UpVal *uv); -void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v); -void luaC_barrierback (lua_State *L, GCObject *o); +LUAI_FUNC size_t luaC_separateudata (lua_State *L, int all); +LUAI_FUNC void luaC_callGCTM (lua_State *L); +LUAI_FUNC void luaC_freeall (lua_State *L); +LUAI_FUNC void luaC_step (lua_State *L); +LUAI_FUNC void luaC_fullgc (lua_State *L); +LUAI_FUNC void luaC_link (lua_State *L, GCObject *o, lu_byte tt); +LUAI_FUNC void luaC_linkupval (lua_State *L, UpVal *uv); +LUAI_FUNC void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v); +LUAI_FUNC void luaC_barrierback (lua_State *L, GCObject *o); #endif diff --git a/llex.h b/llex.h index 25582643..835a6879 100644 --- a/llex.h +++ b/llex.h @@ -1,5 +1,5 @@ /* -** $Id: llex.h,v 1.52 2004/12/03 20:54:12 roberto Exp roberto $ +** $Id: llex.h,v 1.53 2005/04/07 13:09:07 roberto Exp roberto $ ** Lexical Analyzer ** See Copyright Notice in lua.h */ @@ -66,13 +66,14 @@ typedef struct LexState { } LexState; -void luaX_init (lua_State *L); -void luaX_setinput (lua_State *L, LexState *LS, ZIO *z, TString *source); -TString *luaX_newstring (LexState *LS, const char *str, size_t l); -int luaX_lex (LexState *LS, SemInfo *seminfo); -void luaX_lexerror (LexState *ls, const char *msg, int token); -void luaX_syntaxerror (LexState *ls, const char *s); -const char *luaX_token2str (LexState *ls, int token); +LUAI_FUNC void luaX_init (lua_State *L); +LUAI_FUNC void luaX_setinput (lua_State *L, LexState *LS, ZIO *z, + TString *source); +LUAI_FUNC TString *luaX_newstring (LexState *LS, const char *str, size_t l); +LUAI_FUNC int luaX_lex (LexState *LS, SemInfo *seminfo); +LUAI_FUNC void luaX_lexerror (LexState *ls, const char *msg, int token); +LUAI_FUNC void luaX_syntaxerror (LexState *ls, const char *s); +LUAI_FUNC const char *luaX_token2str (LexState *ls, int token); #endif diff --git a/lmem.h b/lmem.h index 13377d00..d6bbdd9f 100644 --- a/lmem.h +++ b/lmem.h @@ -1,5 +1,5 @@ /* -** $Id: lmem.h,v 1.29 2004/12/01 15:46:18 roberto Exp roberto $ +** $Id: lmem.h,v 1.30 2005/03/18 16:38:02 roberto Exp roberto $ ** Interface to Memory Manager ** See Copyright Notice in lua.h */ @@ -16,19 +16,11 @@ #define MEMERRMSG "not enough memory" -void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, size_t size); - -void *luaM_toobig (lua_State *L); - #define luaM_reallocv(L,b,on,n,e) \ ((cast(size_t, (n)+1) <= MAX_SIZET/(e)) ? /* +1 to avoid warnings */ \ luaM_realloc_(L, (b), (on)*(e), (n)*(e)) : \ luaM_toobig(L)) - -void *luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elem, - int limit, const char *errormsg); - #define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0) #define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) #define luaM_freearray(L, b, n, t) luaM_reallocv(L, (b), n, 0, sizeof(t)) @@ -46,5 +38,12 @@ void *luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elem, ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t)))) +LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, + size_t size); +LUAI_FUNC void *luaM_toobig (lua_State *L); +LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size, + size_t size_elem, int limit, + const char *errormsg); + #endif diff --git a/lobject.h b/lobject.h index ab0ddee7..25ce9705 100644 --- a/lobject.h +++ b/lobject.h @@ -1,5 +1,5 @@ /* -** $Id: lobject.h,v 2.10 2005/01/18 17:18:09 roberto Exp roberto $ +** $Id: lobject.h,v 2.11 2005/02/18 12:40:02 roberto Exp roberto $ ** Type definitions for Lua objects ** See Copyright Notice in lua.h */ @@ -360,16 +360,15 @@ extern const TValue luaO_nilobject; #define ceillog2(x) (luaO_log2((x)-1) + 1) -int luaO_log2 (unsigned int x); -int luaO_int2fb (unsigned int x); -int luaO_fb2int (int x); - -int luaO_rawequalObj (const TValue *t1, const TValue *t2); -int luaO_str2d (const char *s, lua_Number *result); - -const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp); -const char *luaO_pushfstring (lua_State *L, const char *fmt, ...); -void luaO_chunkid (char *out, const char *source, int len); +LUAI_FUNC int luaO_log2 (unsigned int x); +LUAI_FUNC int luaO_int2fb (unsigned int x); +LUAI_FUNC int luaO_fb2int (int x); +LUAI_FUNC int luaO_rawequalObj (const TValue *t1, const TValue *t2); +LUAI_FUNC int luaO_str2d (const char *s, lua_Number *result); +LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt, + va_list argp); +LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...); +LUAI_FUNC void luaO_chunkid (char *out, const char *source, int len); #endif diff --git a/lparser.h b/lparser.h index ffcfca3c..44729492 100644 --- a/lparser.h +++ b/lparser.h @@ -1,5 +1,5 @@ /* -** $Id: lparser.h,v 1.53 2005/03/08 20:10:05 roberto Exp roberto $ +** $Id: lparser.h,v 1.54 2005/03/09 16:28:07 roberto Exp roberto $ ** Lua Parser ** See Copyright Notice in lua.h */ @@ -72,7 +72,8 @@ typedef struct FuncState { } FuncState; -Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *name); +LUAI_FUNC Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, + const char *name); #endif diff --git a/lstate.h b/lstate.h index 6292d5e7..908abf70 100644 --- a/lstate.h +++ b/lstate.h @@ -1,5 +1,5 @@ /* -** $Id: lstate.h,v 2.18 2005/03/22 16:04:29 roberto Exp roberto $ +** $Id: lstate.h,v 2.19 2005/04/05 13:41:29 roberto Exp roberto $ ** Global State ** See Copyright Notice in lua.h */ @@ -160,8 +160,8 @@ union GCObject { #define obj2gco(v) (cast(GCObject *, (v))) -lua_State *luaE_newthread (lua_State *L); -void luaE_freethread (lua_State *L, lua_State *L1); +LUAI_FUNC lua_State *luaE_newthread (lua_State *L); +LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1); #endif diff --git a/lstring.h b/lstring.h index 78bc7e99..29bdcb9d 100644 --- a/lstring.h +++ b/lstring.h @@ -1,5 +1,5 @@ /* -** $Id: lstring.h,v 1.41 2005/02/18 12:40:02 roberto Exp roberto $ +** $Id: lstring.h,v 1.42 2005/02/23 17:30:22 roberto Exp roberto $ ** String table (keep all strings handled by Lua) ** See Copyright Notice in lua.h */ @@ -23,9 +23,9 @@ #define luaS_fix(s) l_setbit((s)->tsv.marked, FIXEDBIT) -void luaS_resize (lua_State *L, int newsize); -Udata *luaS_newudata (lua_State *L, size_t s, Table *e); -TString *luaS_newlstr (lua_State *L, const char *str, size_t l); +LUAI_FUNC void luaS_resize (lua_State *L, int newsize); +LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s, Table *e); +LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); #endif diff --git a/ltable.h b/ltable.h index 0036198f..05b554f6 100644 --- a/ltable.h +++ b/ltable.h @@ -1,5 +1,5 @@ /* -** $Id: ltable.h,v 2.5 2005/01/05 18:20:51 roberto Exp roberto $ +** $Id: ltable.h,v 2.6 2005/03/16 16:58:41 roberto Exp roberto $ ** Lua tables (hash) ** See Copyright Notice in lua.h */ @@ -20,20 +20,20 @@ extern const Node luaH_dummynode; -const TValue *luaH_getnum (Table *t, int key); -TValue *luaH_setnum (lua_State *L, Table *t, int key); -const TValue *luaH_getstr (Table *t, TString *key); -TValue *luaH_setstr (lua_State *L, Table *t, TString *key); -const TValue *luaH_get (Table *t, const TValue *key); -TValue *luaH_set (lua_State *L, Table *t, const TValue *key); -Table *luaH_new (lua_State *L, int narray, int lnhash); -void luaH_resizearray (lua_State *L, Table *t, int nasize); -void luaH_free (lua_State *L, Table *t); -int luaH_next (lua_State *L, Table *t, StkId key); -int luaH_getn (Table *t); +LUAI_FUNC const TValue *luaH_getnum (Table *t, int key); +LUAI_FUNC TValue *luaH_setnum (lua_State *L, Table *t, int key); +LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key); +LUAI_FUNC TValue *luaH_setstr (lua_State *L, Table *t, TString *key); +LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key); +LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key); +LUAI_FUNC Table *luaH_new (lua_State *L, int narray, int lnhash); +LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, int nasize); +LUAI_FUNC void luaH_free (lua_State *L, Table *t); +LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key); +LUAI_FUNC int luaH_getn (Table *t); /* exported only for debugging */ -Node *luaH_mainposition (const Table *t, const TValue *key); +LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key); #endif diff --git a/ltm.h b/ltm.h index 21eff396..bd007ee8 100644 --- a/ltm.h +++ b/ltm.h @@ -1,5 +1,5 @@ /* -** $Id: ltm.h,v 2.1 2003/12/10 12:13:36 roberto Exp roberto $ +** $Id: ltm.h,v 2.2 2005/03/08 18:00:16 roberto Exp roberto $ ** Tag methods ** See Copyright Notice in lua.h */ @@ -42,11 +42,12 @@ typedef enum { #define fasttm(l,et,e) gfasttm(G(l), et, e) +extern const char *const luaT_typenames[]; -const TValue *luaT_gettm (Table *events, TMS event, TString *ename); -const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event); -void luaT_init (lua_State *L); -extern const char *const luaT_typenames[]; +LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename); +LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, + TMS event); +LUAI_FUNC void luaT_init (lua_State *L); #endif diff --git a/luaconf.h b/luaconf.h index 6a571cbc..f7a6c0ec 100644 --- a/luaconf.h +++ b/luaconf.h @@ -1,5 +1,5 @@ /* -** $Id: luaconf.h,v 1.42 2005/04/07 13:09:07 roberto Exp roberto $ +** $Id: luaconf.h,v 1.43 2005/04/07 13:52:45 roberto Exp roberto $ ** Configuration file for Lua ** See Copyright Notice in lua.h */ @@ -117,6 +117,20 @@ #define LUALIB_API LUA_API +/* +@@ LUAI_FUNC is a mark for all extern functions that are not to be +@* exported to outside modules. +** CHANGE it if you need to mark them in some special way. Gcc mark +** them as "hidden" to optimize their call when Lua is compiled as a +** shared library. +*/ +#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) +#define LUAI_FUNC __attribute__((visibility("hidden"))) +#else +#define LUAI_FUNC extern +#endif + + /* @@ lua_assert describes the internal assertions in Lua. ** CHANGE that only if you need to debug Lua. diff --git a/lundump.h b/lundump.h index b3f9b6d2..7af3d636 100644 --- a/lundump.h +++ b/lundump.h @@ -1,5 +1,5 @@ /* -** $Id: lundump.h,v 1.33 2003/08/15 13:48:53 roberto Exp roberto $ +** $Id: lundump.h,v 1.34 2003/08/25 19:51:54 roberto Exp roberto $ ** load pre-compiled Lua chunks ** See Copyright Notice in lua.h */ @@ -11,16 +11,18 @@ #include "lzio.h" /* load one chunk; from lundump.c */ -Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char *name); +LUAI_FUNC Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, + const char *name); /* find byte order; from lundump.c */ -int luaU_endianness (void); +LUAI_FUNC int luaU_endianness (void); /* dump one chunk; from ldump.c */ -int luaU_dump (lua_State* L, const Proto* Main, lua_Chunkwriter w, void* data, int strip); +LUAI_FUNC int luaU_dump (lua_State* L, const Proto* Main, lua_Chunkwriter w, + void* data, int strip); /* print one chunk; from print.c */ -void luaU_print (const Proto* Main); +LUAI_FUNC void luaU_print (const Proto* Main); /* definitions for headers of binary files */ #define VERSION 0x50 /* last format change was in 5.0 */ diff --git a/lvm.h b/lvm.h index 0e096c96..b120286c 100644 --- a/lvm.h +++ b/lvm.h @@ -1,5 +1,5 @@ /* -** $Id: lvm.h,v 2.2 2004/05/14 19:25:09 roberto Exp roberto $ +** $Id: lvm.h,v 2.3 2005/04/04 18:12:51 roberto Exp roberto $ ** Lua virtual machine ** See Copyright Notice in lua.h */ @@ -22,13 +22,15 @@ (ttype(o1) == ttype(o2) && luaV_equalval(L, o1, o2)) -int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); -int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2); -const TValue *luaV_tonumber (const TValue *obj, TValue *n); -int luaV_tostring (lua_State *L, StkId obj); -void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val); -void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val); -StkId luaV_execute (lua_State *L, int nexeccalls); -void luaV_concat (lua_State *L, int total, int last); +LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); +LUAI_FUNC int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2); +LUAI_FUNC const TValue *luaV_tonumber (const TValue *obj, TValue *n); +LUAI_FUNC int luaV_tostring (lua_State *L, StkId obj); +LUAI_FUNC void luaV_gettable (lua_State *L, const TValue *t, TValue *key, + StkId val); +LUAI_FUNC void luaV_settable (lua_State *L, const TValue *t, TValue *key, + StkId val); +LUAI_FUNC StkId luaV_execute (lua_State *L, int nexeccalls); +LUAI_FUNC void luaV_concat (lua_State *L, int total, int last); #endif diff --git a/lzio.h b/lzio.h index c9703d3f..e18b9fbb 100644 --- a/lzio.h +++ b/lzio.h @@ -1,5 +1,5 @@ /* -** $Id: lzio.h,v 1.18 2003/08/28 14:38:46 roberto Exp roberto $ +** $Id: lzio.h,v 1.19 2003/10/03 16:05:34 roberto Exp roberto $ ** Buffered streams ** See Copyright Notice in lua.h */ @@ -17,26 +17,16 @@ typedef struct Zio ZIO; - #define char2int(c) cast(int, cast(unsigned char, (c))) #define zgetc(z) (((z)->n--)>0 ? char2int(*(z)->p++) : luaZ_fill(z)) -void luaZ_init (lua_State *L, ZIO *z, lua_Chunkreader reader, void *data); -size_t luaZ_read (ZIO* z, void* b, size_t n); /* read next n bytes */ -int luaZ_lookahead (ZIO *z); - - - typedef struct Mbuffer { char *buffer; size_t n; size_t buffsize; } Mbuffer; - -char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n); - #define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0) #define luaZ_buffer(buff) ((buff)->buffer) @@ -53,6 +43,13 @@ char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n); #define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0) +LUAI_FUNC char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n); +LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Chunkreader reader, + void *data); +LUAI_FUNC size_t luaZ_read (ZIO* z, void* b, size_t n); /* read next n bytes */ +LUAI_FUNC int luaZ_lookahead (ZIO *z); + + /* --------- Private Part ------------------ */ @@ -65,6 +62,6 @@ struct Zio { }; -int luaZ_fill (ZIO *z); +LUAI_FUNC int luaZ_fill (ZIO *z); #endif