[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: How wide a pipe for dynamic modules?
- From: Asko Kauppi <Asko.Kauppi@...>
- Date: Fri, 7 Jun 2002 16:48:49 +0300
The work on a "dynamic extension modules" addon for Lua 4.0/4.1w4/5.0w0 is
under way. I plan to do it by Monday (after which I'll be out for the rest
of the week). Anyways, I've stumbled to the huge number of functions in the
Lua / C API. Are these all essential and if not, which ones can we drop out?
I'm perfectly okay with supporting all of these (technically, just "hard
work" ;) but if it makes sense to have a nicely picked subset, that would
make the job easier & code nicer. E.g. 'lua_open()' and 'lua_close()' are
hardly going to be called from extensions, right?
Could you please help out and share your experienced opinions. I'm new with
Lua and therefore don't have a good impression on where all of these have
been used. I'd need only some, but since we're at it, we should make the
extension system "wide enough". Do you agree?
Thanks... :) and have a nice weekend!
- Asko
//-----
// Interface from Lua 4.0 to the modules:
//
// NOTE!!!! Once this structure is taken into use, NO CHANGES OR
REARRANGEMENTS
// should be made above the last FROZEN LINE (see bottom of the
struct).
//
// Extension modules will have the offsets of this struct fixed
within
// them and any rearrangements or insertions will break their
logic!
//
struct s_luax_interface
{
// State manipulation: (not really needed in extension modules)
//
luafunc_L_i *lua_open;
luafunc_v_L *lua_close;
luafunc_L_L *lua_newthread; // 4.1w4 ->
luafunc_v_LL *lua_closethread; // 4.1w4 ->
luafunc_f_Lf *lua_atpanic; // 5.0w0 ->
// Basic stack manipulation:
//
luafunc_i_L *lua_gettop;
luafunc_v_Li *lua_settop;
luafunc_v_Li *lua_pushvalue;
luafunc_v_Li *lua_remove;
luafunc_v_Li *lua_insert;
luafunc_v_Li *lua_replace; // 4.1w4 ->
luafunc_i_Li *lua_checkstack; // 5.0 ->
// Access functions (stack -> C):
//
luafunc_i_Li *lua_isnumber;
luafunc_i_Li *lua_isstring;
luafunc_i_Li *lua_iscfunction;
luafunc_i_Li *lua_type;
luafunc_s_Li *lua_typename;
luafunc_i_Lii *lua_equal;
luafunc_i_Lii *lua_lessthan;
luafunc_d_Li *lua_tonumber;
luafunc_i_Li *lua_toboolean; // 4.1w4 ->
luafunc_s_Li *lua_tostring;
luafunc_z_Li *lua_strlen;
luafunc_f_Li *lua_tocfunction;
luafunc_V_Li *lua_touserdata;
luafunc_cV_Li *lua_topointer;
// Push functions (C -> stack):
//
luafunc_v_L *lua_pushnil;
luafunc_v_Ld *lua_pushnumber;
luafunc_v_Lsz *lua_pushlstring;
luafunc_v_Ls *lua_pushstring;
luafunc_s_Lsa *lua_pushvfstring; // 5.0 ->
luafunc_s_Lsn *lua_pushfstring; // 5.0 ->
luafunc_v_Lfi *lua_pushcclosure;
luafunc_v_Li *lua_pushboolean; // 4.1w4 ->
luafunc_v_LV *lua_pushudataval; // 5.0 ->
// Get functions (Lua -> stack):
//
luafunc_v_Li *lua_gettable;
luafunc_v_Li *lua_rawget;
luafunc_v_Lii *lua_rawgeti;
luafunc_v_L *lua_newtable;
luafunc_v_Li *lua_getmetatable; // 4.1w4 ->
// Set functions (stack -> Lua):
//
luafunc_v_Li *lua_settable;
luafunc_v_Li *lua_rawset;
luafunc_v_Lii *lua_rawseti;
luafunc_v_Li *lua_setmetatable; // 4.1w4 ->
// "Do" functions (run Lua code):
//
luafunc_v_Lii *lua_rawcall;
luafunc_i_Liii *lua_pcall; // 5.0 ->
luafunc_i_LCV *lua_load; // 5.0 ->
// Coroutine functions:
//
luafunc_v_Li *lua_cobegin; // 4.1w4 ->
luafunc_i_Li *lua_yield; // 4.1w4 ->
luafunc_i_LL *lua_resume; // 4.1w4 ->
// Garbage collection functions:
//
luafunc_i_L *lua_getgcthreshold;
luafunc_i_L *lua_getgccount;
luafunc_v_Li *lua_setgcthreshold;
// Miscellaneous functions:
//
luafunc_i_L *lua_errorobj; // 5.0 ->
luafunc_i_Li *lua_next;
luafunc_i_Li *lua_getn;
luafunc_v_Li *lua_concat;
luafunc_V_Lz *lua_newuserdata;
// Macros (implemented as functions in the LuaX extensions stub):
//
luafunc_v_Ls *lua_error;
luafunc_v_LV *lua_newpointerbox; // 5.0 ->
luafunc_V_Li *lua_getfrombox; // 5.0 ->
luafunc_v_Li *lua_pop;
luafunc_v_Lif *lua_register;
luafunc_v_Lf *lua_pushcfunction;
luafunc_b_Li *lua_isfunction;
luafunc_b_Li *lua_istable;
luafunc_b_Li *lua_isuserdata;
luafunc_b_Li *lua_isnil;
luafunc_b_Li *lua_isboolean; // 4.1w4 ->
luafunc_b_Li *lua_isnone; // 4.1w4 ->
luafunc_b_Li *lua_isnoneornil; // 5.0 ->
luafunc_v_Ls *lua_pushliteral; // 4.1w4 ->
// Lauxlib functions:
//
luafunc_v_LRi *luaL_openlib;
luafunc_v_LsRi *luaL_opennamedlib; // 5.0w0 ->
luafunc_i_Lis *luaL_callmeta; // 5.0w0 ->
luafunc_v_Lis *luaL_typerror; // 4.1w4 ->
luafunc_v_Lis *luaL_argerror;
luafunc_s_Liz *luaL_check_lstr;
luafunc_s_Lisz *luaL_opt_lstr;
luafunc_d_Li *luaL_check_number;
luafunc_d_Lid *luaL_opt_number;
luafunc_v_Lis *luaL_check_stack; // 4.1w4 ->
luafunc_v_Lii *luaL_check_type; // 4.1w4 ->
luafunc_v_Li *luaL_check_any; // 4.1w4 ->
luafunc_v_Lsa *luaL_verror;
luafunc_i_sS *luaL_findstring;
luafunc_i_Li *luaL_ref; // 4.1w4 ->
luafunc_v_Lii *luaL_unref; // 4.1w4 ->
luafunc_i_Ls *luaL_loadfile; // 5.0 ->
luafunc_i_Lszs *luaL_loadbuffer; // 5.0 ->
// Lauxlib macros:
//
luafunc_v_Lbis *luaL_arg_check;
luafunc_s_Li *luaL_check_string;
luafunc_s_Lis *luaL_opt_string;
luafunc_i_Li *luaL_check_int;
luafunc_l_Li *luaL_check_long;
luafunc_i_Lid *luaL_opt_int;
luafunc_l_Lid *luaL_opt_long;
luafunc_v_LR *luaL_openl;
// Lauxlib buffer manipulation:
//
luafunc_v_Bi *luaL_putchar;
luafunc_v_Bi *luaL_addsize;
luafunc_v_LB *luaL_buffinit;
luafunc_s_B *luaL_prepbuffer;
luafunc_v_Bsz *luaL_addlstring;
luafunc_v_Bs *luaL_addstring;
luafunc_v_B *luaL_addvalue;
luafunc_v_B *luaL_pushresult;
// Discontinued and "compatibility mode" (v4.0):
//
luafunc_i_L *lua_newtag; // 4.0 (not in later)
luafunc_i_Li *lua_tag; // 4.0 (not in later)
luafunc_v_LVi *lua_pushusertag; // 4.0 (not in later)
luafunc_v_Li *lua_settag; // 4.0 (not in later)
luafunc_v_Lis *lua_settagmethod; // 4.0 (not in later)
luafunc_v_Lis *lua_gettagmethod; // 4.0 (not in later)
luafunc_i_Lii *lua_copytagmethods; // 4.0 (not in later)
luafunc_i_Li *lua_clonetag; // 4.0 (not in later)
luafunc_v_LV *lua_pushuserdata; // 4.0 (not in later)
luafunc_v_Lis *luaL_checkstack; // 4.0 (not in later) <--
ACCIDENTIALLY MISSING FROM LATER LUA.H?!?
luafunc_v_Lii *luaL_checktype; // 4.0 (compat.mode in later)
luafunc_v_Li *luaL_checkany; // 4.0 (compat.mode in later)
luafunc_b_Li *lua_isnull; // 4.0 (compat.mode in later)
luafunc_v_L *lua_getregistry; // 4.0 (compat.mode in later)
luafunc_v_Ls *lua_getglobal; // 4.0 (compat.mode in later)
luafunc_v_L *lua_getglobals; // 4.0 (compat.mode in later)
luafunc_v_Ls *lua_setglobal; // 4.0 (compat.mode in later)
luafunc_v_L *lua_setglobals; // 4.0 (compat.mode in later)
luafunc_v_Li *lua_getref; // 4.0 (compat.mode in later)
luafunc_i_Li *lua_ref; // 4.0 (compat.mode in later)
luafunc_v_Li *lua_unref; // 4.0 (compat.mode in later)
// Discontinued and "compatibility mode" (v4.1w4):
//
luafunc_i_L *lua_stackspace; // -> 4.1w4 (not in later)
luafunc_i_Lii *lua_call; // -> 4.1w4 (not in later)
luafunc_i_Ls *lua_loadfile; // 4.1w4 (not in later)
luafunc_i_Lszs *lua_loadbuffer; // 4.1w4 (not in later)
luafunc_v_LV *lua_newuserdatabox; // 4.1w4 (not in later)
luafunc_s_i *luaL_errstr; // 4.1w4 (not in later)
luafunc_i_Ls *lua_dofile; // -> 4.1w4 (not in later?)
luafunc_i_Ls *lua_dostring; // -> 4.1w4 (not in later?)
luafunc_i_Lszs *lua_dobuffer; // -> 4.1w4 (not in later?)
luafunc_i_L *lua_pushupvalues; // 4.1w4 -> (compat.mode)
// DO _NOT_ REARRANGE FIELDS ABOVE THIS LINE, NO MATTER WHAT!!!
//
//-----( frozen dd-mmm-yyyy )-----//
// Fields new to version 5.xx:
//
//-----( frozen dd-mmm-yyyy )-----//
// ...add any new fields in here...
};
--
Asko Kauppi
Flextronics Design Finland
Box 23, 39201 Kyröskoski, Finland
www.flextronics.com
PGP: 8348 2AE1 CEDC C81A 2255 2439 E4C8 7308 825E 32C3
###########################################
This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.