Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
// This file: // http://anggtwu.net/LUA/Gdb1.c.html // http://anggtwu.net/LUA/Gdb1.c // (find-angg "LUA/Gdb1.c") // Author: Eduardo Ochs <eduardoochs@gmail.com> // // (defun ec () (interactive) (find-angg "LUA/Gdb1.c")) // (defun el () (interactive) (find-angg "LUA/Gdb1.lua")) // (defun oc () (interactive) (find-angg ".lua51/PP.c")) // (defun og () (interactive) (find-angg ".lua51/PP.gdb")) // (defun rs () (interactive) (find-angg "LISP/2025-lua-runstring-0.c")) #include <lua.h> #include <lauxlib.h> #include <lualib.h> #include <stdio.h> static lua_State *L = NULL; const char *lua_runstring(char *str) { const char *result; if (!L) { L = luaL_newstate(); luaL_openlibs(L); } lua_getglobal (L, "load"); lua_pushstring (L, str); lua_call (L, 1, 1); lua_call (L, 0, 1); result = lua_tostring(L, -1); lua_pop(L, 1); return result; } void PP(lua_State *L, int index) { lua_getglobal(L, "PP"); if (index==0) { /* 0 is never a valid index */ lua_pushnil(L); } else { lua_pushvalue(L, index); } lua_call(L, 1, 0); } #ifdef MAIN int main(int argc, const char ** argv) { printf("%s\n", lua_runstring("return 'a'..'b'")); return 0; } #endif /* LUALIB_API int PP_init(lua_State *L) { */ /* /\* nothing to do on the Lua side; we're only adding a C function *\/ */ /* return 0; */ /* } */ /* * (eepitch-shell) * (eepitch-kill) * (eepitch-shell) LUA_INCLUDE_DIR=/usr/include/lua5.3 LUA_LIB=lua5.3 STEM=Gdb1 gcc -g -shared -I${LUA_INCLUDE_DIR} -o ${STEM}.so ${STEM}.c -l${LUA_LIB} gcc -g -DMAIN -I${LUA_INCLUDE_DIR} -o ${STEM} ${STEM}.c -l${LUA_LIB} ls -lAF ${STEM}* ./${STEM} ** (find-efunction 'gdb) ** (find-elocus-links "C-x C-a C-n" 'global-map "gud-next") ** (find-egrep "grep --color=auto -nH --null -e gud-next progmodes/*.el") ** * (eepitch-b-set-source) * (defun b () (interactive) (eepitch-b-set-target)) * (gdb "gdb -i=mi") file ./Gdb1 br main run */ // Local Variables: // coding: utf-8-unix // End: