diff options
author | Steven Barth <steven@midlink.org> | 2008-08-31 11:16:52 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-08-31 11:16:52 +0000 |
commit | df52b711a78dbe8808628ae873acc1f3edefb1cf (patch) | |
tree | 00b4c145e7ab0501a6de277478b659d51e50fc92 /contrib/luacurses/src | |
parent | 36c76090638e80d1cb9ad2dd060aae65976f24c8 (diff) |
Reorganise luacurses
Diffstat (limited to 'contrib/luacurses/src')
-rw-r--r-- | contrib/luacurses/src/Makefile | 15 | ||||
-rw-r--r-- | contrib/luacurses/src/curses.c (renamed from contrib/luacurses/src/src/curses.c) | 0 | ||||
-rw-r--r-- | contrib/luacurses/src/doc/curses.pdf | bin | 39485 -> 0 bytes | |||
-rw-r--r-- | contrib/luacurses/src/doc/curses.ps.gz | bin | 36118 -> 0 bytes | |||
-rw-r--r-- | contrib/luacurses/src/luacurses.c (renamed from contrib/luacurses/src/src/luacurses.c) | 0 | ||||
-rw-r--r-- | contrib/luacurses/src/luacurses.h (renamed from contrib/luacurses/src/src/luacurses.h) | 0 | ||||
-rw-r--r-- | contrib/luacurses/src/test/filter.lua | 49 | ||||
-rw-r--r-- | contrib/luacurses/src/test/getnstr.lua | 12 | ||||
-rw-r--r-- | contrib/luacurses/src/test/getyx.lua | 13 | ||||
-rw-r--r-- | contrib/luacurses/src/test/hello.lua | 20 | ||||
-rw-r--r-- | contrib/luacurses/src/test/mouse.lua | 54 | ||||
-rw-r--r-- | contrib/luacurses/src/test/pair.lua | 18 | ||||
-rw-r--r-- | contrib/luacurses/src/test/rain.lua | 89 |
13 files changed, 0 insertions, 270 deletions
diff --git a/contrib/luacurses/src/Makefile b/contrib/luacurses/src/Makefile deleted file mode 100644 index 1dd108f49..000000000 --- a/contrib/luacurses/src/Makefile +++ /dev/null @@ -1,15 +0,0 @@ - -SRC=src/curses.c src/luacurses.c -INCLUDE=/usr/include/lua5.1 -CFLAGS=-shared -ansi -Wall -O2 -I$(INCLUDE) -fpic - -all: lib/curses.so - -lib/curses.so: $(SRC) - if ! [ -d lib ]; then mkdir lib; fi - gcc $(CFLAGS) -o lib/curses.so $(SRC) - -clean: - rm -Rf lib - - diff --git a/contrib/luacurses/src/src/curses.c b/contrib/luacurses/src/curses.c index 9e6760a9f..9e6760a9f 100644 --- a/contrib/luacurses/src/src/curses.c +++ b/contrib/luacurses/src/curses.c diff --git a/contrib/luacurses/src/doc/curses.pdf b/contrib/luacurses/src/doc/curses.pdf Binary files differdeleted file mode 100644 index b4dd7529d..000000000 --- a/contrib/luacurses/src/doc/curses.pdf +++ /dev/null diff --git a/contrib/luacurses/src/doc/curses.ps.gz b/contrib/luacurses/src/doc/curses.ps.gz Binary files differdeleted file mode 100644 index 72a20abac..000000000 --- a/contrib/luacurses/src/doc/curses.ps.gz +++ /dev/null diff --git a/contrib/luacurses/src/src/luacurses.c b/contrib/luacurses/src/luacurses.c index 0cbd2fe6a..0cbd2fe6a 100644 --- a/contrib/luacurses/src/src/luacurses.c +++ b/contrib/luacurses/src/luacurses.c diff --git a/contrib/luacurses/src/src/luacurses.h b/contrib/luacurses/src/luacurses.h index 2dc426c93..2dc426c93 100644 --- a/contrib/luacurses/src/src/luacurses.h +++ b/contrib/luacurses/src/luacurses.h diff --git a/contrib/luacurses/src/test/filter.lua b/contrib/luacurses/src/test/filter.lua deleted file mode 100644 index f8f6ef582..000000000 --- a/contrib/luacurses/src/test/filter.lua +++ /dev/null @@ -1,49 +0,0 @@ - -require("curses"); - -function read_cmd() - curses.attron(curses.A_BOLD); - curses.addstr("Command: "); - curses.attron(underline); - local s = ""; - while (true) do - local c = string.char(curses.getch()); - if (c == '\n') then break; end - s = s .. c; - end - curses.attroff(underline); - curses.attroff(curses.A_BOLD); - curses.addch("\n"); - - return s; -end - - -curses.filter(); -curses.initscr(); -curses.cbreak(); -curses.keypad(curses.stdscr(), TRUE); - -if (curses.has_colors()) then - curses.start_color(); - curses.init_pair(1, curses.COLOR_CYAN, curses.COLOR_BLACK); - underline = curses.COLOR_PAIR(1); -else - underline = curses.A_UNDERLINE; -end - -while (true) do - local s = read_cmd(); - if (s == "exit") then break; end - curses.reset_shell_mode(); - io.write("\n"); - io.flush(io.stdout); - os.execute(s); - curses.reset_prog_mode(); - curses.touchwin(curses.stdscr()); - curses.erase(); - curses.refresh(); -end - -curses.endwin(); - diff --git a/contrib/luacurses/src/test/getnstr.lua b/contrib/luacurses/src/test/getnstr.lua deleted file mode 100644 index 172365ea9..000000000 --- a/contrib/luacurses/src/test/getnstr.lua +++ /dev/null @@ -1,12 +0,0 @@ - -require("curses"); - -curses.initscr(); - -curses.keypad(curses.stdscr(), true); -s = curses.mvgetnstr(10, 10, 10); -curses.addstr(s); -curses.getch(); - -curses.endwin(); - diff --git a/contrib/luacurses/src/test/getyx.lua b/contrib/luacurses/src/test/getyx.lua deleted file mode 100644 index 4600236bb..000000000 --- a/contrib/luacurses/src/test/getyx.lua +++ /dev/null @@ -1,13 +0,0 @@ - -require("curses"); - -curses.initscr(); -while (true) do - local s = curses.getnstr(1000); - curses.addstr(s); - curses.addstr(":" .. table.concat({curses.getyx(curses.stdscr())}, ' ') .. "\n"); - if (s == "exit") then break; end -end - -curses.endwin(); - diff --git a/contrib/luacurses/src/test/hello.lua b/contrib/luacurses/src/test/hello.lua deleted file mode 100644 index 6a1d28a21..000000000 --- a/contrib/luacurses/src/test/hello.lua +++ /dev/null @@ -1,20 +0,0 @@ - -require("curses"); - -function show_message(message) - local width = string.len(message) + 6; - win = curses.newwin(5, width, (curses.LINES() - 5) / 2, (curses.COLS() - width) / 2); - win:box('|', '-'); - win:mvaddstr(2, 3, message); - win:getch(); - win:delwin(); -end - -curses.initscr(); -curses.cbreak(); -curses.mvaddstr((curses.LINES() - 5) / 2, (curses.COLS() - 10) / 2, "Hit any key"); -curses.getch(); -show_message("Hello, World!") - -curses.endwin(); - diff --git a/contrib/luacurses/src/test/mouse.lua b/contrib/luacurses/src/test/mouse.lua deleted file mode 100644 index 0129cd8c4..000000000 --- a/contrib/luacurses/src/test/mouse.lua +++ /dev/null @@ -1,54 +0,0 @@ - -require("curses"); - -function show_message(m) - local width = string.len(m) + 6; - local win = curses.newwin(5, width, (lines - 5) / 2, (cols - width) / 2); - win:keypad(true); - win:attron(curses.COLOR_PAIR(curses.COLOR_RED)); - win:box('|', '-', '+'); - win:mvaddstr(2, 3, m); - win:refresh(); - win:getch(); - win:delwin(); -end - -curses.initscr(); -curses.start_color(); -curses.init_pair(curses.COLOR_BLUE, curses.COLOR_BLUE, curses.COLOR_WHITE); -curses.init_pair(curses.COLOR_RED, curses.COLOR_RED, curses.COLOR_WHITE); -curses.cbreak(); -curses.noecho(); -curses.keypad(curses.stdscr(), true); - -lines = curses.LINES(); -cols = curses.COLS(); - -mmasks = -{ - curses.BUTTON1_CLICKED, - curses.BUTTON2_CLICKED, - curses.BUTTON3_CLICKED, - curses.BUTTON4_CLICKED -}; - -table.foreachi(mmasks, function(_i, _m) curses.addmousemask(_m) end); -curses.attron(curses.COLOR_PAIR(curses.COLOR_BLUE)); -curses.attron(curses.A_BOLD); -curses.mvaddstr((lines - 5) / 2, (cols - 10) / 2, "click"); - -curses.refresh(); -while(true) do - local c = curses.getch(); - if (c == curses.KEY_MOUSE) then - local r, id, x, y, z, bstate = curses.getmouse(); - if (r) then - show_message("id = " .. id .. ", x = " .. x .. ", y = " .. y .. ", z = " .. z .. ", bstate = " .. - string.format("0x%x", bstate)); - end - break; - end -end - -curses.endwin(); - diff --git a/contrib/luacurses/src/test/pair.lua b/contrib/luacurses/src/test/pair.lua deleted file mode 100644 index f26980061..000000000 --- a/contrib/luacurses/src/test/pair.lua +++ /dev/null @@ -1,18 +0,0 @@ - -require("curses"); - -curses.initscr(); - -curses.start_color(); -curses.init_pair(1, curses.COLOR_BLUE, curses.COLOR_YELLOW); -curses.init_pair(2, curses.COLOR_CYAN, curses.COLOR_RED); - -for i = 1, 2 do - local r, f, b = curses.pair_content(i); - curses.attrset(curses.COLOR_PAIR(i)); - curses.addstr(f .. ", " .. b .. "\n"); -end - -curses.getch(); -curses.endwin(); - diff --git a/contrib/luacurses/src/test/rain.lua b/contrib/luacurses/src/test/rain.lua deleted file mode 100644 index 35e469102..000000000 --- a/contrib/luacurses/src/test/rain.lua +++ /dev/null @@ -1,89 +0,0 @@ - -require("curses"); - -curses.initscr(); -curses.nl(); -curses.noecho(); - - -if (curses.has_colors()) then - curses.start_color(); - curses.init_pair(1, curses.COLOR_BLUE, curses.COLOR_BLACK); - curses.init_pair(2, curses.COLOR_CYAN, curses.COLOR_BLACK); -end - -curses.curs_set(0); -curses.timeout(0); - -math.randomseed(os.time()); - -lines = curses.LINES(); -cols = curses.COLS(); - -xpos = {}; -ypos = {}; -r = lines - 4; -c = cols - 4; -for i = 0, 4 do - xpos[i] = c * math.random() + 2; - ypos[i] = r * math.random() + 2; -end - -function dec(i, max) - if (curses.has_colors()) then - local z = 3 * math.random(); - local c = curses.COLOR_PAIR(z); - curses.attrset(c); - if (math.floor(z) > 0) then - curses.attron(curses.A_BOLD); - end - end - - if (i > 0) then return i - 1; - else return max; - end -end - -i = 0; -while(true) do - x = c * math.random() + 2; - y = r * math.random() + 2; - - curses.mvaddstr(y, x, "."); - - curses.mvaddstr(ypos[i], xpos[i], "o"); - - i = dec(i, 4); - curses.mvaddstr(ypos[i], xpos[i], "O"); - - i = dec(i, 4); - curses.mvaddstr(ypos[i] - 1, xpos[i], "-"); - curses.mvaddstr(ypos[i], xpos[i] - 1, "|.|"); - curses.mvaddstr(ypos[i] + 1, xpos[i], "-"); - - i = dec(i, 4); - curses.mvaddstr(ypos[i] - 2, xpos[i], "-"); - curses.mvaddstr(ypos[i] - 1, xpos[i] - 1, "/ \\"); - curses.mvaddstr(ypos[i], xpos[i] - 2, "| O |"); - curses.mvaddstr(ypos[i] + 1, xpos[i] - 1, "\\ /"); - curses.mvaddstr(ypos[i] + 2, xpos[i], "-"); - - i = dec(i, 4); - curses.mvaddstr(ypos[i] - 2, xpos[i], " "); - curses.mvaddstr(ypos[i] - 1, xpos[i] - 1, " "); - curses.mvaddstr(ypos[i], xpos[i] - 2, " "); - curses.mvaddstr(ypos[i] + 1, xpos[i] - 1, " "); - curses.mvaddstr(ypos[i] + 2, xpos[i], " "); - - - xpos[i] = x; - ypos[i] = y; - - local ch = curses.getch(); - if (ch == string.byte('q', 1)) or (ch == string.byte('Q', 1)) then break; end - curses.refresh(); - curses.napms(50); -end - -curses.endwin(); - |