#! /local/bin/perl

# curses.pl -- Copyright (c) 1990, Henk P. Penning.
# You may distribute under the terms of the GNU General Public License
# as specified in the README file that comes with the Jinx 2.1 kit.

sub addlog { &ctermlog($_[0]) if $logLevel >= 0 ; }

sub getchintR { return &ch2str(&getchR) ; }

sub initEdit
  { local($_) ;
    &editreset ;
    for ( @_ ) { &editq($_) ; }
  }

sub initCurses
  { &initscr ;
    &nonl ;
    &cbreak ;
    &noecho ;
    &keypad(0,1) ;
    &leaveok(0,0) ;
    $flushOn = 1 ;
  }

sub testCurses
  { local($_,@keys,@errors) ;
    for ( ('keypad','beep','editl','editr') )
      { if ( ! defined($curfun{$_}) )
          { eval "sub $_ { ; }" ;
	    $curfun{$_} = 'EMPTY' ;
	  }
      }
    for ( @testCurses )
      { push(@errors,"jinx: required cterm function '$_' is absent")
	  if ! defined $curfun{$_} ;
      }
    return $#errors == -1, @errors ;
  }

@testCurses = ('addstr','beep'
,'cbreak','clrreg','clrtoeol','ctermlog','edit'
,'editl','editq','editr','editreset','endwin'
,'getchR','initscr','keypad','leaveok','move'
,'mvaddstr','noecho','nonl','show') ;

1;
