lua chunks. mainly from troubleshooters.com
- and for now is just test shit.
This commit is contained in:
parent
405178f89e
commit
e09862023e
1 changed files with 1918 additions and 1888 deletions
66
st.c
66
st.c
|
|
@ -31,6 +31,11 @@
|
||||||
#include <fontconfig/fontconfig.h>
|
#include <fontconfig/fontconfig.h>
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
|
||||||
|
// lua stuff
|
||||||
|
#include <lua.h>
|
||||||
|
#include <lauxlib.h>
|
||||||
|
#include <lualib.h>
|
||||||
|
|
||||||
#include "arg.h"
|
#include "arg.h"
|
||||||
|
|
||||||
char *argv0;
|
char *argv0;
|
||||||
|
|
@ -337,9 +342,9 @@ static void selpaste(const Arg *);
|
||||||
static void xzoom(const Arg *);
|
static void xzoom(const Arg *);
|
||||||
static void xzoomabs(const Arg *);
|
static void xzoomabs(const Arg *);
|
||||||
static void xzoomreset(const Arg *);
|
static void xzoomreset(const Arg *);
|
||||||
static void printsel(const Arg *);
|
/* static void printsel(const Arg *); */
|
||||||
static void printscreen(const Arg *) ;
|
/* static void printscreen(const Arg *) ; */
|
||||||
static void toggleprinter(const Arg *);
|
/* static void toggleprinter(const Arg *); */
|
||||||
static void sendbreak(const Arg *);
|
static void sendbreak(const Arg *);
|
||||||
|
|
||||||
/* Config.h for applying patches and the configuration. */
|
/* Config.h for applying patches and the configuration. */
|
||||||
|
|
@ -568,6 +573,31 @@ typedef struct {
|
||||||
static Fontcache frc[16];
|
static Fontcache frc[16];
|
||||||
static int frclen = 0;
|
static int frclen = 0;
|
||||||
|
|
||||||
|
/* I think code starts here. Well, I'm starting mine here.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void bail(lua_State *L, char *msg){
|
||||||
|
fprintf(stderr, "\nFATAL ERROR:\n %s: %s\n\n",
|
||||||
|
msg, lua_tostring(L, -1));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
int dothatLua(void) {
|
||||||
|
lua_State *L;
|
||||||
|
|
||||||
|
L = luaL_newstate(); /* Create Lua state variable */
|
||||||
|
luaL_openlibs(L); /* Load Lua libraries */
|
||||||
|
if (luaL_loadfile(L, "counter.lua")) /* Load but don't run the Lua script */
|
||||||
|
bail(L, "luaL_loadfile() failed"); /* Error out if file can't be read */
|
||||||
|
printf("In C, calling Lua\n");
|
||||||
|
if (lua_pcall(L, 0, 0, 0)) /* Run the loaded Lua script */
|
||||||
|
bail(L, "lua_pcall() failed"); /* Error out if Lua file has an error */
|
||||||
|
printf("Back in C again\n");
|
||||||
|
lua_close(L); /* Clean up, free the Lua state var */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ssize_t
|
ssize_t
|
||||||
xwrite(int fd, const char *s, size_t len)
|
xwrite(int fd, const char *s, size_t len)
|
||||||
{
|
{
|
||||||
|
|
@ -2611,23 +2641,23 @@ tprinter(char *s, size_t len)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
/* void */
|
||||||
toggleprinter(const Arg *arg)
|
/* toggleprinter(const Arg *arg) */
|
||||||
{
|
/* { */
|
||||||
term.mode ^= MODE_PRINT;
|
/* term.mode ^= MODE_PRINT; */
|
||||||
}
|
/* } */
|
||||||
|
|
||||||
void
|
/* void */
|
||||||
printscreen(const Arg *arg)
|
/* printscreen(const Arg *arg) */
|
||||||
{
|
/* { */
|
||||||
tdump();
|
/* tdump(); */
|
||||||
}
|
/* } */
|
||||||
|
|
||||||
void
|
/* void */
|
||||||
printsel(const Arg *arg)
|
/* printsel(const Arg *arg) */
|
||||||
{
|
/* { */
|
||||||
tdumpsel();
|
/* tdumpsel(); */
|
||||||
}
|
/* } */
|
||||||
|
|
||||||
void
|
void
|
||||||
tdumpsel(void)
|
tdumpsel(void)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue