1 # ncurses output for DCT, by Shiar
3 # 1.12.0 200410312200 - define main loop (get input from Term::ReadKey)
4 # 1.11.0 200410152225 - uses class in filename instead of $set{display} check
5 # 1.10.0 200410140120 - all output functions seperated from main
13 push @{$hook{init}}, sub {
15 ReadMode 3; # cbreak mode
20 } # restore terminal on quit
22 $set{height} = $LINES-2 if $LINES>=3;
23 $set{width} = $COLS if $COLS;
26 push @{$hook{showerror}}, sub {
33 ReadKey; # wait for confirm
34 1 while defined ReadKey(-1); # clear key buffer
37 push @{$hook{showstack}}, sub {
39 addstr($set{height}-$_, 1, "$_: ".showval($stack[$_], $set{base}));
42 clrtoeol($set{height}-@stack, 1);
45 push @{$hook{refresh}}, sub {
47 addstr($set{height}+1, 0, "> "); # prompt
50 push @{$hook{showentry}}, sub {
51 addstr($set{height}+1, 2, $_[0]);
60 my $key = ReadKey; # wait for user input
62 $key .= $_ while defined ($_ = ReadKey(-1)); # read additional keys
71 title => "curses output",