|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
-- (find-fline "flua-lua.lua")
lua
strings.Cextras1 = strings.Cextras1 .. [[
#include "dllua.h"
/* define L (from now on, and in this file only) as a shorthand
* for a long variable name:
*/
#define L flua_lua_state
lua_State *L = NULL;
]]
add_Fprims(
"lua_state "," DS[1]=(void *)L; DS++; goto forth;",
"lua_state!"," L=(void *)(DS[0]); DS--; goto forth;",
"lua_pop "," lua_settop(L, -(DS[0])-1); DS--; goto forth;",
"lua_pushnumber"," lua_pushnumber(L, DS[0]); DS--; goto forth;"
)
add_Hprims(
"CLUA0 "," fun=*(funptr *)(_f0+RS[0]); DS[1]=(*fun)(L); RS--;"
.." DS++; goto forth;",
"CLUA1 "," fun=*(funptr *)(_f0+RS[0]); DS[0]=(*fun)(L,DS[0]); RS--;"
.." goto forth;",
"CLUA2 "," fun=*(funptr *)(_f0+RS[0]); DS[-1]=(*fun)(L,DS[-1],DS[0]);"
.." DS--; RS--; goto forth;",
"CLUA3 "," fun=*(funptr *)(_f0+RS[0]); DS[-2]=(*fun)(L,DS[-2],DS[-1],DS[0]);"
.." DS-=2; RS--; goto forth;"
)
function makecnword(immedword, heads)
action[immedword] = function() cnword(getword(), %heads) end
end
makecnword("C0::", "C0:")
makecnword("C1::", "C1:")
makecnword("C2::", "C2:")
makecnword("C3::", "C3:")
makecnword("CLUA0::", "CLUA0:")
makecnword("CLUA1::", "CLUA1:")
makecnword("CLUA2::", "CLUA2:")
makecnword("CLUA3::", "CLUA3:")
makecnword("CLUA00::", "DROPPING: CLUA0:")
makecnword("CLUA10::", "DROPPING: CLUA1:")
makecnword("CLUA20::", "DROPPING: CLUA2:")
makecnword("CLUA30::", "DROPPING: CLUA3:")
-- (find-angg "flua/flua-comp.lua" "cnword")
end;
C1:: lua_open -- ( nels -- lua_State* )
CLUA00:: lua_close -- ( -- )
C1:: dllua_open -- ( nels -- lua_Stt* )
-- (find-node "(lua)The Stack and Indices")
CLUA0:: lua_gettop -- ( -- nelements )
CLUA0:: lua_stackspace -- ( -- nelements )
-- (find-node "(lua)Stack Manipulation")
CLUA10:: lua_settop -- ( index -- )
CLUA10:: lua_pushvalue -- ( index -- )
CLUA10:: lua_remove -- ( index -- )
CLUA10:: lua_insert -- ( index -- )
-- (find-node "(lua)Pushing Values Onto The Stack")
CLUA20:: lua_pushlstring -- ( adr len -- )
CLUA10:: lua_pushstring -- ( adr -- )
CLUA20:: lua_pushusertag -- ( adr tag -- )
CLUA00:: lua_pushnil -- ( -- )
-- CLUA10:: lua_pushcfunction -- ( luacfun -- )
-- (find-node "(lua)Executing Lua Code")
CLUA10:: lua_dofile -- ( fnameadr -- )
CLUA10:: lua_dostring -- ( stradr -- )
CLUA30:: lua_dobuffer -- ( adr len nameadr -- )
-- (find-node "(lua)Manipulating Global Variables in Lua")
CLUA10:: lua_getglobal -- ( varname -- )
CLUA10:: lua_setglobal -- ( varname -- )
CLUA00:: lua_getglobals -- ( -- )
CLUA00:: lua_setglobals -- ( -- )
-- (find-node "(lua)Manipulating Tables in Lua")
CLUA10:: lua_gettable -- ( index -- )
CLUA10:: lua_rawget -- ( index -- )
CLUA10:: lua_settable -- ( index -- )
CLUA10:: lua_rawset -- ( index -- )
CLUA00:: lua_newtable -- ( -- )
-- (find-node "(lua)Using Tables as Arrays")
CLUA00:: lua_rawgeti -- ( index n -- )
CLUA00:: lua_rawseti -- ( index n -- )
CLUA00:: lua_getn -- ( index -- n)
-- (find-node "(lua)Calling Lua Functions")
CLUA2:: lua_call -- ( nargs nresults -- errcode )
CLUA20:: lua_rawcall -- ( nargs nresults -- )
CLUA1:: lua_error -- ( msgstr -- )
CLUA20:: lua_settagmethod -- ( tag evname -- )
CLUA20:: lua_gettagmethod -- ( tag evname -- )
CLUA20:: lua_copytagmethods -- ( tto tfrom-- )
CLUA1:: lua_next -- ( index -- status )
CLUA10:: lua_concat -- ( n -- )