aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjluehrs2 <jluehrs2@uiuc.edu>2008-03-18 15:56:19 -0500
committerjluehrs2 <jluehrs2@uiuc.edu>2008-03-18 15:56:19 -0500
commit8f1c876f63727f87227ec7739f63375931ccf847 (patch)
tree21583a0d0d5702f397b4a8f9eb8137e8212fc118
parent85708d1089a6a82ad604c1cac6fd92f4e89f00fa (diff)
downloadluancurses-8f1c876f63727f87227ec7739f63375931ccf847.tar.gz
luancurses-8f1c876f63727f87227ec7739f63375931ccf847.zip
finish filling out the setup_term function
-rw-r--r--TODO3
-rw-r--r--src/curses.c58
2 files changed, 54 insertions, 7 deletions
diff --git a/TODO b/TODO
index 8b56bba..dce7e9d 100644
--- a/TODO
+++ b/TODO
@@ -3,9 +3,8 @@
- reading from the screen (curs_instr, curs_inch)
- reading input (ungetch (curs_getch), curs_getstr
- attribute support (curs_attr)
-- finish up curs_inopts and curs_outopts
- finish up curs_color (color_content, pair_content)
-- scrolling support (curs_scroll)
+- scrolling support (curs_scroll, setscrreg (curs_outopts))
- support the rest of the refresh options (curs_refresh)
- window background support (curs_bkgd)
- multiple window support (all fns that start with w, curs_overlay, curs_initscr, curs_window, curs_getyx (par, beg), curs_touch, curs_overlay)
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);
}