Browse Source

Some small code cleanups

framebuffer
Łukasz Magiera 7 years ago
parent
commit
0c3c3d58ce
  1. 3
      include/lupi.h
  2. 2
      scripts/txt2c
  3. 36
      src/c/lnative.c
  4. 1
      src/c/main.c
  5. 2
      src/c/run.c

3
include/lupi.h

@ -4,7 +4,6 @@
#ifndef LUPI_H
#define LUPI_H
/* #define LOGGING */
#ifdef LOGGING
void logn(const char *message);
void logi(int message);
@ -15,7 +14,7 @@ void logm(const char *message);
#define logm(m)
#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();

2
scripts/txt2c

@ -23,9 +23,11 @@ generate() {
filename="$(basename "$file")"
if [ -d "$file" ]
then
echo "Enter directory $file"
generate $file $2 $3 ${PREFIX}${filename}_
else
filename="${filename%.*}"
echo "Generate $PREFIX$filename"
echo "extern char $PREFIX$filename[];" >> "$OUTPUTH"

36
src/c/lnative.c

@ -385,42 +385,6 @@ static int l_debug (lua_State *L) {
#endif
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[] = {
{"sleep", l_sleep},

1
src/c/main.c

@ -3,6 +3,7 @@
int main (void) {
puts("LuPI L0 INIT");
lupi_init();
run_init();
return 0;
}

2
src/c/run.c

@ -21,7 +21,6 @@ lua_State* getL() {
}
void run_init() {
lupi_init();
L = luaL_newstate();
luaL_openlibs (L);
@ -31,7 +30,6 @@ void run_init() {
termutils_start (L);
event_prepare();
/* int status = luaL_loadstring(L, lua_init); */
int status = luaL_loadbuffer(L, lua_init, strlen(lua_init), "=INIT");
if (status) {
fprintf(stderr, "Couldn't load init: %s\n", lua_tostring(L, -1));

Loading…
Cancel
Save