Some small code cleanups
This commit is contained in:
parent
170ce567ce
commit
0c3c3d58ce
@ -4,7 +4,6 @@
|
|||||||
#ifndef LUPI_H
|
#ifndef LUPI_H
|
||||||
#define LUPI_H
|
#define LUPI_H
|
||||||
|
|
||||||
/* #define LOGGING */
|
|
||||||
#ifdef LOGGING
|
#ifdef LOGGING
|
||||||
void logn(const char *message);
|
void logn(const char *message);
|
||||||
void logi(int message);
|
void logi(int message);
|
||||||
@ -15,7 +14,7 @@ void logm(const char *message);
|
|||||||
#define logm(m)
|
#define logm(m)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define pushstuple(state, name, value) lua_pushstring((state), (name)); lua_pushstring((state), (value)); lua_settable((state), -3)
|
#define pushstuple(state, name, value) lua_pushstring((state), (name)); lua_pushstring((state), (value)); lua_settable((state), -3)
|
||||||
|
|
||||||
lua_State* getL();
|
lua_State* getL();
|
||||||
|
|
||||||
|
@ -23,9 +23,11 @@ generate() {
|
|||||||
filename="$(basename "$file")"
|
filename="$(basename "$file")"
|
||||||
if [ -d "$file" ]
|
if [ -d "$file" ]
|
||||||
then
|
then
|
||||||
|
echo "Enter directory $file"
|
||||||
generate $file $2 $3 ${PREFIX}${filename}_
|
generate $file $2 $3 ${PREFIX}${filename}_
|
||||||
else
|
else
|
||||||
filename="${filename%.*}"
|
filename="${filename%.*}"
|
||||||
|
echo "Generate $PREFIX$filename"
|
||||||
echo "extern char $PREFIX$filename[];" >> "$OUTPUTH"
|
echo "extern char $PREFIX$filename[];" >> "$OUTPUTH"
|
||||||
|
|
||||||
|
|
||||||
|
@ -385,42 +385,6 @@ static int l_debug (lua_State *L) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void luanative_start(lua_State *L) {
|
void luanative_start(lua_State *L) {
|
||||||
/*lua_createtable (L, 0, 1);
|
|
||||||
|
|
||||||
pushctuple(L, "sleep", l_sleep);
|
|
||||||
pushctuple(L, "log", l_log);
|
|
||||||
|
|
||||||
pushctuple(L, "fs_exists", l_fs_exists);
|
|
||||||
pushctuple(L, "fs_mkdir", l_fs_mkdir);
|
|
||||||
pushctuple(L, "fs_isdir", l_fs_isdir);
|
|
||||||
pushctuple(L, "fs_spaceUsed", l_fs_spaceUsed);
|
|
||||||
pushctuple(L, "fs_open", l_fs_open);
|
|
||||||
pushctuple(L, "fs_seek", l_fs_seek);
|
|
||||||
pushctuple(L, "fs_write", l_fs_write);
|
|
||||||
pushctuple(L, "fs_spaceTotal", l_fs_spaceTotal);
|
|
||||||
pushctuple(L, "fs_rename", l_fs_rename);
|
|
||||||
pushctuple(L, "fs_list", l_fs_list);
|
|
||||||
pushctuple(L, "fs_lastModified", l_fs_lastModified);
|
|
||||||
pushctuple(L, "fs_remove", l_fs_remove);
|
|
||||||
pushctuple(L, "fs_close", l_fs_close);
|
|
||||||
pushctuple(L, "fs_size", l_fs_size);
|
|
||||||
pushctuple(L, "fs_read", l_fs_read);
|
|
||||||
|
|
||||||
pushctuple(L, "wcwidth", l_wcwidth);
|
|
||||||
pushctuple(L, "towlower", l_towlower);
|
|
||||||
pushctuple(L, "towupper", l_towupper);
|
|
||||||
|
|
||||||
pushctuple(L, "beep", l_beep);
|
|
||||||
pushctuple(L, "uptime", l_uptime);
|
|
||||||
pushctuple(L, "totalMemory", l_totalMemory);
|
|
||||||
pushctuple(L, "freeMemory", l_freeMemory);
|
|
||||||
pushctuple(L, "pull", l_pull);
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
lua_pushstring(L, "debug");
|
|
||||||
lua_pushboolean(L, 1);
|
|
||||||
lua_settable(L, -3);
|
|
||||||
#endif*/
|
|
||||||
|
|
||||||
struct luaL_Reg nativelib[] = {
|
struct luaL_Reg nativelib[] = {
|
||||||
{"sleep", l_sleep},
|
{"sleep", l_sleep},
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
int main (void) {
|
int main (void) {
|
||||||
puts("LuPI L0 INIT");
|
puts("LuPI L0 INIT");
|
||||||
|
lupi_init();
|
||||||
run_init();
|
run_init();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,6 @@ lua_State* getL() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void run_init() {
|
void run_init() {
|
||||||
lupi_init();
|
|
||||||
L = luaL_newstate();
|
L = luaL_newstate();
|
||||||
|
|
||||||
luaL_openlibs (L);
|
luaL_openlibs (L);
|
||||||
@ -31,7 +30,6 @@ void run_init() {
|
|||||||
termutils_start (L);
|
termutils_start (L);
|
||||||
event_prepare();
|
event_prepare();
|
||||||
|
|
||||||
/* int status = luaL_loadstring(L, lua_init); */
|
|
||||||
int status = luaL_loadbuffer(L, lua_init, strlen(lua_init), "=INIT");
|
int status = luaL_loadbuffer(L, lua_init, strlen(lua_init), "=INIT");
|
||||||
if (status) {
|
if (status) {
|
||||||
fprintf(stderr, "Couldn't load init: %s\n", lua_tostring(L, -1));
|
fprintf(stderr, "Couldn't load init: %s\n", lua_tostring(L, -1));
|
||||||
|
Loading…
Reference in New Issue
Block a user