X-Git-Url: http://git.shiar.net/descalc.git/blobdiff_plain/4e1d9535fda6685e53ce570ca4e4cd6c260f55d3..090ac304afe801cb3e72ced0941ff2a874a98cc9:/03_disp_curses.pm diff --git a/03_disp_curses.pm b/03_disp_curses.pm deleted file mode 100644 index 8f94960..0000000 --- a/03_disp_curses.pm +++ /dev/null @@ -1,74 +0,0 @@ -# ncurses output for DCT, by Shiar - -# 1.12.0 200410312200 - define main loop (get input from Term::ReadKey) -# 1.11.0 200410152225 - uses class in filename instead of $set{display} check -# 1.10.0 200410140120 - all output functions seperated from main - -use strict; -use warnings; - -use Curses; -use Term::ReadKey; - -push @{$hook{init}}, sub { - initscr; - ReadMode 3; # cbreak mode - - END { - ReadMode 0; - endwin; - } # restore terminal on quit - - $set{height} = $LINES-2 if $LINES>=3; - $set{width} = $COLS if $COLS; -}; # init - -push @{$hook{showerror}}, sub { - attron(A_REVERSE); - addstr(0, 0, shift); - attroff(A_REVERSE); - clrtoeol; - refresh; - - ReadKey; # wait for confirm - 1 while defined ReadKey(-1); # clear key buffer -}; # showerror - -push @{$hook{showstack}}, sub { - for (0..@stack-1) { - addstr($set{height}-$_, 1, "$_: ".showval($stack[$_], $set{base})); - clrtoeol; - } # show stack - clrtoeol($set{height}-@stack, 1); -}; # showstack - -push @{$hook{refresh}}, sub { - clear; - addstr($set{height}+1, 0, "> "); # prompt -}; # refresh - -push @{$hook{showentry}}, sub { - addstr($set{height}+1, 2, $_[0]); - clrtoeol; - refresh; -}; # showentry - -$hook{main} = sub { - while (1) { - draw(); - - my $key = ReadKey; # wait for user input - if ($key eq chr 27) { - $key .= $_ while defined ($_ = ReadKey(-1)); # read additional keys - } # escape sequence - - onkey($key); - } # input loop -}; # main - -return { - author => "Shiar", - title => "curses output", - version => "1.12", -}; -