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 // (load "~/LUA/Gdb1.el") // (find-angg "LUA/Gdb1.el") // (find-preproc :end) #ifdef PREPROC HELLO #endif /* * (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} * (eepitch-gdb-kill) * (eepitch-gdb-start "gdb -i=mi ./Gdb1") * (eepitch-gdb-select) * (my-gud-mode 1) file ./Gdb1 br main run ** (find-angg ".emacs" "my-gud-mode") */ // Local Variables: // coding: utf-8-unix // End: