From 8f1c876f63727f87227ec7739f63375931ccf847 Mon Sep 17 00:00:00 2001 From: jluehrs2 Date: Tue, 18 Mar 2008 15:56:19 -0500 Subject: finish filling out the setup_term function --- src/curses.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 53 insertions(+), 5 deletions(-) (limited to 'src/curses.c') diff --git a/src/curses.c b/src/curses.c index 469e18c..125578f 100644 --- a/src/curses.c +++ b/src/curses.c @@ -226,22 +226,70 @@ static int l_setup_term(lua_State* L) const char* str; str = lua_tostring(L, -2); - /* XXX: this certainly needs expansion */ - if (!strcmp(str, "nl")) { - ret += ((lua_toboolean(L, -1) ? nl() : nonl()) == OK); - } - else if (!strcmp(str, "cbreak")) { + if (!strcmp(str, "cbreak")) { ret += ((lua_toboolean(L, -1) ? cbreak() : nocbreak()) == OK); } else if (!strcmp(str, "echo")) { ret += ((lua_toboolean(L, -1) ? echo() : noecho()) == OK); } + else if (!strcmp(str, "halfdelay")) { + ret += (halfdelay(lua_tointeger(L, -1)) == OK); + } + else if (!strcmp(str, "intrflush")) { + ret += (intrflush(stdscr, lua_toboolean(L, -1)) == OK); + } else if (!strcmp(str, "keypad")) { ret += (keypad(stdscr, lua_toboolean(L, -1)) == OK); } + else if (!strcmp(str, "meta")) { + ret += (meta(stdscr, lua_toboolean(L, -1)) == OK); + } + else if (!strcmp(str, "nodelay")) { + ret += (nodelay(stdscr, lua_toboolean(L, -1)) == OK); + } + else if (!strcmp(str, "raw")) { + ret += ((lua_toboolean(L, -1) ? raw() : noraw()) == OK); + } + else if (!strcmp(str, "qiflush")) { + lua_toboolean(L, -1) ? qiflush() : noqiflush(); + ret++; + } + else if (!strcmp(str, "timeout")) { + if (lua_isnil(L, -1)) { + ret += (notimeout(stdscr, TRUE) == OK); + } + else { + timeout(lua_tointeger(L, -1)); + ret++; + } + } + else if (!strcmp(str, "typeahead")) { + ret += ((lua_toboolean(L, -1) ? typeahead(0) : + typeahead(-1)) == OK); + } + else if (!strcmp(str, "clear")) { + ret += (clearok(stdscr, lua_toboolean(L, -1)) == OK); + } + else if (!strcmp(str, "idl")) { + ret += (idlok(stdscr, lua_toboolean(L, -1)) == OK); + } + else if (!strcmp(str, "idc")) { + idcok(stdscr, lua_toboolean(L, -1)); + ret++; + } + else if (!strcmp(str, "immed")) { + immedok(stdscr, lua_toboolean(L, -1)); + ret++; + } + else if (!strcmp(str, "leave")) { + ret += (leaveok(stdscr, lua_toboolean(L, -1)) == OK); + } else if (!strcmp(str, "scroll")) { ret += (scrollok(stdscr, lua_toboolean(L, -1)) == OK); } + else if (!strcmp(str, "nl")) { + ret += ((lua_toboolean(L, -1) ? nl() : nonl()) == OK); + } else { luaL_error(L, "Unknown or unimplemented terminal mode %s", str); } -- cgit v1.2.3-54-g00ecf