LuPPC/include/lupi.h

39 lines
933 B
C
Raw Normal View History

2016-01-05 04:20:40 +11:00
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
#ifndef LUPI_H
#define LUPI_H
2016-01-19 07:24:13 +11:00
/* #define LOGGING */
2016-01-15 08:44:49 +11:00
#ifdef LOGGING
void logn(const char *message);
void logi(int message);
void logm(const char *message);
#else
#define logn(m)
#define logi(m)
#define logm(m)
#endif
2016-01-19 07:24:13 +11:00
/* TODO: move to utils */
2016-01-07 02:58:05 +11:00
#define pushstuple(state, name, value) lua_pushstring((state), (name)); lua_pushstring((state), (value)); lua_settable((state), -3)
#define pushctuple(state, name, value) lua_pushstring((state), (name)); lua_pushcfunction((state), (value)); lua_settable((state), -3)
2016-01-15 08:44:49 +11:00
lua_State* getL();
2016-01-05 04:20:40 +11:00
void run_init();
2016-01-07 03:16:09 +11:00
void luanative_start(lua_State *L);
2016-01-05 04:20:40 +11:00
void setup_modules(lua_State *L);
2016-01-07 02:58:05 +11:00
void termutils_start(lua_State *L);
2016-01-15 08:44:49 +11:00
void epoll_prepare();
int epoll_pull(int timeout);
struct lupi_event_handler {
2016-01-19 07:24:13 +11:00
int (*handler)(int, void*); /* FD, data, return number of pushed events */
/* TODO: doc? */
2016-01-15 08:44:49 +11:00
int fd;
void* data;
};
2016-01-05 04:20:40 +11:00
#endif