Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
/* -*- coding: raw-text-unix -*- * 2008dec02: this is not needed anymore! See: * (find-angg ".lua51/PP.gdb") * (find-es "lua5" "luastackPP") * (find-angg "LUA/lua50init.lua" "load_PP") * (find-angg ".lua51/") * (find-sh "gcc -g -Wall -shared -I$LUA51SRC/src -o PP.so PP.c;pwd;ls -lAF") * A demo: #* cat > /tmp/testPP.lua <<'%%%' load_PP() math.sin(0) print("aa", "bb", "cc", "dd", "ee") %%% # cat /tmp/testPP.lua > /tmp/testPP.lst awk '{print NR ": " $0}' < /tmp/testPP.lua > /tmp/testPP.lst luac -p -l /tmp/testPP.lua >> /tmp/testPP.lst lua50 /tmp/testPP.lua #* # (ee-once (eeb-lua50gdb-start "bin/lua")) # (find-fline "/tmp/testPP.lst") source ~/.lua50/PP.gdb set args /tmp/testPP.lua br math_sin run #* */ #include <stdio.h> #include <stdlib.h> #include <lua.h> #include <lauxlib.h> void PP(lua_State *L, int index) { lua_pushstring(L, "PP"); lua_gettable(L, LUA_GLOBALSINDEX); if (index==0) { /* 0 is never a valid index */ lua_pushnil(L); } else { lua_pushvalue(L, index); } lua_call(L, 1, 0); } /* void PPO(lua_State *L, struct lua_TObject *O) { lua_pushstring(L, "PP"); lua_gettable(L, LUA_GLOBALSINDEX); setpvalue(L->top, p); api_incr_top(L); lua_call(L, 1, 0); } Also: PPeval(lua_State *L, const char *str) { } */ LUALIB_API int PP_init(lua_State *L) { /* nothing to do on the Lua side; we're only adding a C function */ return 0; }