scsh-ncurses/c/ncurses.c

2320 lines
53 KiB
C
Executable File

#include <curses.h>
#include "scheme48.h"
#include <stdlib.h>
#include <sys/ioctl.h>
//Makros zum Ein- und Auspacken von Zeigern
#define curses_enter_window(w) s48_enter_integer((long) w)
#define curses_extract_window(w) (WINDOW*) s48_extract_integer(w)
#define curses_enter_screen(s) s48_enter_integer((long) s)
#define curses_extract_screen(s) (SCREEN*) s48_extract_integer(s)
#define curses_extract_file(f) (FILE*) fdopen(s48_extract_integer(f),"rw")
#define curses_enter_chtype(c) s48_enter_char((short) c)
#define curses_extract_chtype(c) (chtype) s48_extract_char(c)
//*********************************************************************
//Bibliotheks-Funktionen
//*********************************************************************
//ALLGEMEINE:
//Initialisierung
s48_value scsh_initscr(void)
{
s48_value res;
WINDOW *stdscr;
stdscr = initscr();
if (stdscr==NULL)
return S48_FALSE;
else
{
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res=curses_enter_window (stdscr);
S48_GC_UNPROTECT();
return res;
}
}
s48_value scsh_newterm(s48_value type, s48_value outfd,
s48_value infd)
{
SCREEN *screen;
s48_value res;
S48_DECLARE_GC_PROTECT(4);
S48_GC_PROTECT_4(type, outfd, infd, res);
screen = newterm (s48_extract_string (type),
curses_extract_file (outfd),
curses_extract_file (infd));
if(screen==NULL)
{
S48_GC_UNPROTECT();
return S48_FALSE;
}
else
{
res = curses_enter_screen(screen);
S48_GC_UNPROTECT();
return res;
}
}
//Beenden
s48_value scsh_endwin(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer (endwin());
S48_GC_UNPROTECT();
}
s48_value scsh_isendwin(void)
{
return S48_ENTER_BOOLEAN (isendwin());
}
s48_value scsh_delscreen(s48_value s)
{
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(s);
(void) delscreen(curses_extract_screen(s));
S48_GC_UNPROTECT();
return S48_UNSPECIFIC;
}
//Hilfsfunktionen
s48_value scsh_unctrl(s48_value c)
{
char *res_c;
s48_value res_s;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(c, res_s);
res_c = (char*) unctrl(curses_extract_chtype(c));
if (res_c==NULL)
{
S48_GC_UNPROTECT();
return S48_FALSE;
}
else
{
res_s = s48_enter_string (res_c);
S48_GC_UNPROTECT();
return res_s;
}
}
s48_value scsh_keyname(s48_value c)
{
char *key;
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(c, res);
key = (char*) keyname((int) s48_extract_integer(c));
if (key==NULL)
{
S48_GC_UNPROTECT();
return S48_FALSE;
}
else
{
res = s48_enter_string(key);
S48_GC_UNPROTECT();
return res;
}
}
s48_value scsh_filter(void)
{
(void) filter();
return S48_UNSPECIFIC;
}
s48_value scsh_use_env(s48_value f)
{
(void) use_env( S48_EXTRACT_BOOLEAN(f));
return S48_UNSPECIFIC;
}
s48_value scsh_putwin(s48_value win, s48_value file)
{
s48_value res;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(win,file,res);
res = s48_enter_integer (putwin
(curses_extract_window(win),
curses_extract_file(file)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_getwin(s48_value file)
{
WINDOW *win;
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(file, res);
win = getwin(curses_extract_file(file));
if(win==NULL)
{
S48_GC_UNPROTECT();
return S48_FALSE;
}
else
{
res = curses_enter_window(win);
S48_GC_UNPROTECT();
return res;
}
}
s48_value scsh_delay_output(s48_value ms)
{
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(ms, res);
res = s48_enter_integer(delay_output (s48_extract_integer(ms)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_flushinp(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer(flushinp());
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_curses_version(void)
{
s48_value res_s;
char *res = (char*) curses_version();
if (res==NULL)
return S48_FALSE;
else
{
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res_s);
res_s = s48_enter_string (res);
S48_GC_UNPROTECT();
return res_s;
}
}
//Einstellungen
s48_value scsh_use_default_colors(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer((int)use_default_colors);
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_assume_default_colors(s48_value fg, s48_value bg)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer(assume_default_colors
(s48_extract_integer(fg),
s48_extract_integer(bg)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_define_key(s48_value def, s48_value keyc)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer (define_key (s48_extract_string (def),
s48_extract_integer (keyc)));
S48_GC_UNPROTECT();
return res;
}
//***************************************************************************
//TERMINAL
//Eigenschaften
s48_value scsh_baudrate(void)
{
int res=baudrate();
if (res==ERR)
return S48_FALSE;
else
{
s48_value res_s;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res_s);
res_s = s48_enter_integer(res);
S48_GC_UNPROTECT();
return res_s;
}
}
s48_value scsh_erasechar(void)
{
return s48_enter_char((unsigned char) erasechar());
}
s48_value scsh_has_ic(void)
{
return S48_ENTER_BOOLEAN((int)has_ic());
}
s48_value scsh_has_il(void)
{
return S48_ENTER_BOOLEAN((int) has_il());
}
s48_value scsh_killchar(void)
{
return s48_enter_char((unsigned char) killchar());
}
s48_value scsh_longname(void)
{
char *name = longname();
if (name==NULL)
return S48_FALSE;
else
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_string(name);
S48_GC_UNPROTECT();
return res;
}
}
s48_value scsh_termname(void)
{
char *name = termname();
if (name==NULL)
return S48_FALSE;
else
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_string(name);
S48_GC_UNPROTECT();
return res;
}
}
s48_value scsh_has_key(s48_value ch)
{
s48_value res_s;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(ch, res_s);
int res_c=has_key(s48_extract_integer(ch));
if (res_c==ERR)
{
S48_GC_UNPROTECT();
return S48_FALSE;
}
else
{
res_s = s48_extract_integer(res_c);
S48_GC_UNPROTECT();
return res_s;
}
}
//Farbe
s48_value scsh_start_color()
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer((int) start_color());
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_init_pair(s48_value pair, s48_value f,
s48_value b)
{
s48_value res;
S48_DECLARE_GC_PROTECT(4);
S48_GC_PROTECT_4(pair, f, b, res);
res = s48_enter_integer((int) init_pair((short) s48_extract_integer(pair),
(short) s48_extract_integer(f),
(short) s48_extract_integer(b)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_init_color(s48_value color, s48_value r,
s48_value g, s48_value b)
{
s48_value res;
S48_DECLARE_GC_PROTECT(5);
S48_GC_PROTECT_5(color, r, g, b, res);
res = s48_enter_integer(init_color ((short) s48_extract_integer(color),
(short) s48_extract_integer(r),
(short) s48_extract_integer(g),
(short) s48_extract_integer(b)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_has_colors(void)
{
return S48_ENTER_BOOLEAN((int)has_colors());
}
s48_value scsh_can_change_colors(void)
{
return S48_ENTER_BOOLEAN((int) can_change_color());
}
s48_value scsh_color_pair (s48_value num)
{
s48_value res;
S48_DECLARE_GC_PROTECT(12);
S48_GC_PROTECT_2(num, res);
res = s48_enter_integer( COLOR_PAIR(s48_extract_integer(num)));
S48_GC_UNPROTECT();
return res;
}
//Eingabe:
s48_value scsh_cbreak(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer(cbreak());
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_no_cbreak(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer(nocbreak());
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_echo(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer(echo());
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_noecho(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer(noecho());
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_halfdelay(s48_value tenth)
{
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(tenth, res);
res = s48_enter_integer(halfdelay(s48_extract_integer(tenth)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_intrflush(s48_value win, s48_value bf)
{
s48_value res;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(win, bf, res);
res = s48_enter_integer(intrflush (curses_extract_window(win),
S48_EXTRACT_BOOLEAN(bf)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_keypad(s48_value win, s48_value bf)
{
s48_value res;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(win, bf, res);
res = s48_enter_integer(keypad (curses_extract_window(win),
S48_EXTRACT_BOOLEAN(bf)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_meta(s48_value win, s48_value bf)
{
s48_value res;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(win, bf, res);
res = s48_enter_integer(meta (curses_extract_window(win),
S48_EXTRACT_BOOLEAN(bf)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_nodelay(s48_value win, s48_value bf)
{
s48_value res;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(win, bf, res);
res = s48_enter_integer(nodelay(curses_extract_window(win),
S48_EXTRACT_BOOLEAN(bf)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_raw(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer(raw());
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_noraw(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer(noraw());
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_qiflush(void)
{
(void) qiflush();
return S48_UNSPECIFIC;
}
s48_value scsh_noqiflush(void)
{
(void) noqiflush();
return S48_UNSPECIFIC;
}
//Terminalfunktionen
s48_value scsh_beep(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer(beep());
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_flash(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer(flash());
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_def_prog_mode(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer(def_prog_mode());
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_def_shell_mode(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer(def_shell_mode());
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_reset_prog_mode(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer(reset_prog_mode());
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_reset_shell_mode(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer(reset_shell_mode());
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_resetty(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer(resetty());
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_savetty(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer(savetty());
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_curs_set(s48_value visibility)
{
int old_vis;
old_vis = curs_set(s48_extract_fixnum(visibility));
if (old_vis == ERR)
return S48_FALSE;
else return s48_enter_fixnum(old_vis);
}
s48_value scsh_napms(s48_value ms)
{
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(ms, res);
res = s48_enter_integer(napms(s48_extract_integer(ms)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_mcprint(s48_value data, s48_value len)
{
s48_value res;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(data, len, res);
res = s48_enter_integer(mcprint(s48_extract_string (data),
s48_extract_integer(len)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_is_term_resized(s48_value lines, s48_value columns)
{
s48_value res;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(lines, columns, res);
res = S48_ENTER_BOOLEAN(is_term_resized
(s48_extract_integer(lines),
s48_extract_integer(columns)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_resize_term(s48_value lines, s48_value columns)
{
s48_value res;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(lines, columns, res);
res = s48_enter_integer(resize_term
(s48_extract_integer(lines),
s48_extract_integer(columns)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_resizeterm(s48_value lines, s48_value columns)
{
s48_value res;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(lines, columns, res);
res = s48_enter_integer(resizeterm
(s48_extract_integer(lines),
s48_extract_integer(columns)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_scr_dump(s48_value filename)
{
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(filename, res);
res = s48_enter_integer(scr_dump
(s48_extract_string (filename)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_scr_restore(s48_value filename)
{
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(filename, res);
res = s48_enter_integer(scr_restore
(s48_extract_string (filename)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_scr_init(s48_value filename)
{
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(filename, res);
res = s48_enter_integer(scr_init
(s48_extract_string (filename)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_scr_set(s48_value filename)
{
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(filename, res);
res = s48_enter_integer(scr_set
(s48_extract_string (filename)));
S48_GC_UNPROTECT();
return res;
}
//mehrere Terminals
s48_value scsh_set_term(s48_value new)
{
SCREEN *res;
s48_value res_s;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(new, res_s);
res= set_term (curses_extract_screen(new));
if(res==NULL)
{
S48_GC_UNPROTECT();
return S48_FALSE;
}
else
{
res_s = curses_enter_screen(res);
S48_GC_UNPROTECT();
return res_s;
}
}
//*************************************************************************
//FENSTER
//Allgemeine:
s48_value scsh_newwin(s48_value height, s48_value width,
s48_value starty, s48_value startx)
{
WINDOW *win;
s48_value res;
S48_DECLARE_GC_PROTECT(5);
S48_GC_PROTECT_5(height,width,starty,startx, res);
win=(newwin ((int) s48_extract_integer(height)
,(int) s48_extract_integer(width)
,(int) s48_extract_integer(starty)
,(int) s48_extract_integer(startx)));
if (win==NULL)
{
S48_GC_UNPROTECT();
return S48_FALSE;
}
else
{
res = curses_enter_window(win);
S48_GC_UNPROTECT();
return res;
}
}
s48_value scsh_delwin(s48_value win)
{
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(win, res);
res = s48_enter_integer(delwin (curses_extract_window (win)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_mvwin(s48_value win, s48_value y, s48_value x)
{
s48_value res;
S48_DECLARE_GC_PROTECT(4);
S48_GC_PROTECT_4(win, y, x, res);
res = s48_enter_integer(mvwin (curses_extract_window (win),
s48_extract_integer(y),
s48_extract_integer(x)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_subwin(s48_value orig, s48_value nlines,
s48_value ncols, s48_value begin_y,
s48_value begin_x)
{
WINDOW *res;
s48_value res_s;
S48_DECLARE_GC_PROTECT(6);
S48_GC_PROTECT_6(orig, nlines, ncols, begin_y, begin_x, res_s);
res=subwin (curses_extract_window (orig),
s48_extract_integer(nlines),
s48_extract_integer(ncols),
s48_extract_integer(begin_y),
s48_extract_integer(begin_x));
if(res==NULL)
{
S48_GC_UNPROTECT();
return S48_FALSE;
}
else
{
res_s = curses_enter_window(res);
S48_GC_UNPROTECT();
return res_s;
}
}
s48_value scsh_derwin(s48_value orig, s48_value nlines,
s48_value ncols, s48_value begin_y,
s48_value begin_x)
{
WINDOW *res;
s48_value res_s;
S48_DECLARE_GC_PROTECT(6);
S48_GC_PROTECT_6(orig, nlines, ncols, begin_y, begin_x, res_s);
res=derwin (curses_extract_window (orig),
s48_extract_integer(nlines),
s48_extract_integer(ncols),
s48_extract_integer(begin_y),
s48_extract_integer(begin_x));
if(res==NULL)
{
S48_GC_UNPROTECT();
return S48_FALSE;
}
else
{
res_s = curses_enter_window(res);
S48_GC_UNPROTECT();
return res_s;
}
}
s48_value scsh_mvderwin(s48_value win, s48_value par_y,
s48_value par_x)
{
s48_value res;
S48_DECLARE_GC_PROTECT(4);
S48_GC_PROTECT_4(win, par_y, par_x, res);
res = s48_enter_integer (mvderwin(curses_extract_window (win),
s48_extract_integer(par_y),
s48_extract_integer(par_x)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_dupwin(s48_value win)
{
WINDOW *res;
s48_value res_s;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(win, res_s);
res=dupwin(curses_extract_window(win));
if(res==NULL)
{
S48_GC_UNPROTECT();
return S48_FALSE;
}
else
{
res_s = curses_enter_window(res);
S48_GC_UNPROTECT();
return res_s;
}
}
s48_value scsh_wsyncup(s48_value win)
{
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(win);
(void) wsyncup(curses_extract_window(win));
S48_GC_UNPROTECT();
return S48_UNSPECIFIC;
}
s48_value scsh_wcursyncup(s48_value win)
{
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(win);
(void) wcursyncup(curses_extract_window(win));
S48_GC_UNPROTECT();
return S48_UNSPECIFIC;
}
s48_value scsh_wsyncdown(s48_value win)
{
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(win);
(void) wsyncdown(curses_extract_window(win));
S48_GC_UNPROTECT();
return S48_UNSPECIFIC;
}
s48_value scsh_syncok(s48_value win, s48_value bf)
{
s48_value res;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(win, bf, res);
res = s48_enter_integer (syncok(curses_extract_window (win),
S48_EXTRACT_BOOLEAN(bf)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_wrefresh(s48_value win)
{
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(win, res);
res = s48_enter_integer(wrefresh(curses_extract_window(win)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_wnoutrefresh(s48_value win)
{
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(win, res);
res = s48_enter_integer(wnoutrefresh(curses_extract_window(win)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_redrawwin(s48_value win)
{
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(win, res);
res = s48_enter_integer(redrawwin(curses_extract_window(win)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_doupdate(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer(doupdate());
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_wredrawln(s48_value win, s48_value beg_line,
s48_value num_lines)
{
s48_value res;
S48_DECLARE_GC_PROTECT(4);
S48_GC_PROTECT_4(win, beg_line, num_lines, res);
res = s48_enter_integer(wredrawln(curses_extract_window(win),
s48_extract_integer(beg_line),
s48_extract_integer(num_lines)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_gety(s48_value win)
{
int y=0;
int x=0;
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(win, res);
getyx(curses_extract_window(win), y, x);
res = s48_enter_integer(y);
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_getx(s48_value win)
{
int y = 0;
int x = 0;
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(win, res);
getyx(curses_extract_window(win), y, x);
res = s48_enter_integer(x);
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_getmaxy(s48_value win)
{
int y = 0;
int x = 0;
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(win, res);
getmaxyx(curses_extract_window(win), y, x);
res = s48_enter_integer(y);
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_getmaxx(s48_value win)
{
int y = 0;
int x = 0;
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(win, res);
getmaxyx(curses_extract_window(win), y, x);
res = s48_enter_integer(x);
S48_GC_UNPROTECT();
return res;
}
/*
s48_value scsh_getyx(s48_value win, s48_value y, s48_value x)
{
getyx(curses_extract_window(win),
s48_extract_integer(y),
s48_extract_integer(x));
return S48_UNSPECIFIC;
}
s48_value scsh_getparyx(s48_value win, s48_value y, s48_value x)
{
(void) getparyx(curses_extract_window(win),
s48_extract_integer(y),
s48_extract_integer(x));
return S48_UNSPECIFIC;
}
s48_value scsh_getbegyx(s48_value win, s48_value y, s48_value x)
{
(void) getbegyx(curses_extract_window(win),
s48_extract_integer(y),
s48_extract_integer(x));
return S48_UNSPECIFIC;
}
s48_value scsh_getmaxyx(s48_value win, s48_value y, s48_value x)
{
(void) getmaxyx(curses_extract_window(win),
s48_extract_integer(y),
s48_extract_integer(x));
return S48_UNSPECIFIC;
}
*/
s48_value scsh_wresize(s48_value win, s48_value lines,
s48_value columns)
{
s48_value res;
S48_DECLARE_GC_PROTECT(4);
S48_GC_PROTECT_4(win, lines, columns, res);
res = s48_enter_integer(wresize
(curses_extract_window(win),
s48_extract_integer(lines),
s48_extract_integer(columns)));
S48_GC_UNPROTECT();
return res;
}
//Ausgabe-Einstellungen
s48_value scsh_idlok(s48_value win, s48_value bf)
{
s48_value res;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(win,bf , res);
res = s48_enter_integer(idlok
(curses_extract_window(win),
S48_EXTRACT_BOOLEAN(bf)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_leaveok(s48_value win, s48_value bf)
{
s48_value res;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(win ,bf , res);
res = s48_enter_integer(leaveok
(curses_extract_window(win),
S48_EXTRACT_BOOLEAN(bf)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_scrollok(s48_value win, s48_value bf)
{
s48_value res;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(win ,bf , res);
res = s48_enter_integer(scrollok
(curses_extract_window(win),
S48_EXTRACT_BOOLEAN(bf)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_idcok(s48_value win, s48_value bf)
{
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(win ,bf);
(void) idcok(curses_extract_window(win), S48_EXTRACT_BOOLEAN(bf));
S48_GC_UNPROTECT();
return S48_UNSPECIFIC;
}
s48_value scsh_immedok(s48_value win, s48_value bf)
{
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(win ,bf);
(void) immedok(curses_extract_window(win), S48_EXTRACT_BOOLEAN(bf));
S48_GC_UNPROTECT();
return S48_UNSPECIFIC;
}
s48_value scsh_wsetscrreg(s48_value win, s48_value top,
s48_value bot)
{
s48_value res;
S48_DECLARE_GC_PROTECT(4);
S48_GC_PROTECT_4(win, top, bot, res);
res = s48_enter_integer(wsetscrreg
(curses_extract_window(win),
s48_extract_integer(top),
s48_extract_integer(bot)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_nl(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer(nl());
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_nonl(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer(nonl());
S48_GC_UNPROTECT();
return res;
}
//Text anzeigen:
s48_value scsh_waddch(s48_value win, s48_value ch)
{
s48_value res;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(win, ch, res);
res = s48_enter_integer(waddch
(curses_extract_window(win),
curses_extract_chtype(ch)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_wechochar(s48_value win, s48_value ch)
{
s48_value res;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(win, ch, res);
res = s48_enter_integer(wechochar
(curses_extract_window(win),
curses_extract_chtype(ch)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_waddstr(s48_value win, s48_value str)
{
s48_value res;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(win, str, res);
res = s48_enter_integer (waddstr
(curses_extract_window(win),
s48_extract_string(str)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_waddnstr(s48_value win, s48_value str,
s48_value n)
{
s48_value res;
S48_DECLARE_GC_PROTECT(4);
S48_GC_PROTECT_4(win, str, n, res);
res = s48_enter_integer (waddnstr
(curses_extract_window(win),
s48_extract_string(str),
s48_extract_integer(n)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_winsch(s48_value win, s48_value ch)
{
s48_value res;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(win, ch, res);
res = s48_enter_integer(winsch
(curses_extract_window(win),
curses_extract_chtype(ch)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_winsstr(s48_value win, s48_value str)
{
s48_value res;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(win, str, res);
res = s48_enter_integer (winsstr
(curses_extract_window(win),
s48_extract_string(str)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_winsnstr(s48_value win, s48_value str,
s48_value n)
{
s48_value res;
S48_DECLARE_GC_PROTECT(4);
S48_GC_PROTECT_4(win, str, n, res);
res = s48_enter_integer (winsnstr
(curses_extract_window(win),
s48_extract_string(str),
s48_extract_integer(n)));
S48_GC_UNPROTECT();
return res;
}
//Attribute
s48_value scsh_wattroff(s48_value win, s48_value attr)
{
s48_value res;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(win, attr, res);
res = s48_enter_integer (wattroff(curses_extract_window (win),
s48_extract_integer(attr)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_wattron(s48_value win, s48_value attr)
{
s48_value res;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(win, attr, res);
res = s48_enter_integer (wattron(curses_extract_window (win),
s48_extract_integer(attr)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_wattrset(s48_value win, s48_value attr)
{
s48_value res;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(win, attr, res);
res = s48_enter_integer (wattrset(curses_extract_window (win),
s48_extract_integer(attr)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_wstandend(s48_value win)
{
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(win, res);
res = s48_enter_integer (wstandend(curses_extract_window (win)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_wstandout(s48_value win)
{
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(win, res);
res = s48_enter_integer (wstandout(curses_extract_window (win)));
S48_GC_UNPROTECT();
return res;
}
//Background:
s48_value scsh_wbkgdset(s48_value win, s48_value ch)
{
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(win, ch);
(void) wbkgdset(curses_extract_window(win),
curses_extract_chtype(ch));
S48_GC_UNPROTECT();
return S48_UNSPECIFIC;
}
s48_value scsh_wbkgd(s48_value win, s48_value ch)
{
s48_value res;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(win, ch, res);
res = s48_enter_integer( wbkgd
(curses_extract_window(win),
curses_extract_chtype(ch)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_getbkgd(s48_value win)
{
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(win, res);
res = curses_enter_chtype( getbkgd
(curses_extract_window(win)));
S48_GC_UNPROTECT();
return res;
}
//Umrandung des Fensters
s48_value scsh_wborder(s48_value win, s48_value ls,
s48_value rs, s48_value ts,
s48_value bs, s48_value tl,
s48_value tr, s48_value bl,
s48_value br)
{
return s48_enter_integer(wborder
(curses_extract_window(win),
curses_extract_chtype(ls),
curses_extract_chtype(rs),
curses_extract_chtype(ts),
curses_extract_chtype(bs),
curses_extract_chtype(tl),
curses_extract_chtype(tr),
curses_extract_chtype(bl),
curses_extract_chtype(br)));
}
s48_value scsh_box(s48_value win, s48_value verch, s48_value horch)
{
s48_value res;
S48_DECLARE_GC_PROTECT(4);
S48_GC_PROTECT_4(win, verch, horch, res);
res = s48_enter_integer ( box(curses_extract_window(win),
curses_extract_chtype(verch),
curses_extract_chtype(horch)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_whline(s48_value win, s48_value ch, s48_value n)
{
s48_value res;
S48_DECLARE_GC_PROTECT(4);
S48_GC_PROTECT_4(win, ch, n, res);
res = s48_enter_integer (whline(curses_extract_window(win),
curses_extract_chtype(ch),
s48_extract_integer(n)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_wvline(s48_value win, s48_value ch, s48_value n)
{
s48_value res;
S48_DECLARE_GC_PROTECT(4);
S48_GC_PROTECT_4(win, ch, n, res);
res = s48_enter_integer ( wvline(curses_extract_window(win),
curses_extract_chtype(ch),
s48_extract_integer(n)));
S48_GC_UNPROTECT();
return res;
}
//Cursor:
s48_value scsh_scroll(s48_value win)
{
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(win, res);
res = s48_enter_integer( scroll (curses_extract_window(win)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_wscrl(s48_value win, s48_value n)
{
s48_value res;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(win, n, res);
res = s48_enter_integer( wscrl
(curses_extract_window(win),
s48_extract_integer(n)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_wmove(s48_value win, s48_value y,
s48_value x)
{
s48_value res;
S48_DECLARE_GC_PROTECT(4);
S48_GC_PROTECT_4(win, y, x, res);
res = s48_enter_integer( wmove
(curses_extract_window(win),
s48_extract_integer(y),
s48_extract_integer(x)));
S48_GC_UNPROTECT();
return res;
}
//Eingabe
s48_value scsh_wgetch(s48_value win)
{
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(win, res);
res = s48_enter_integer (wgetch (curses_extract_window(win)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_winch(s48_value win)
{
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(win, res);
res = curses_enter_chtype (winch (curses_extract_window(win)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_winstr(s48_value win)
{
char *str;
int status;
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(win, res);
status = winstr (curses_extract_window(win), str);
if(status==ERR)
{
S48_GC_UNPROTECT();
return S48_FALSE;
}
else
{
res = s48_enter_string(str);
S48_GC_UNPROTECT();
return res;
}
}
s48_value scsh_winnstr(s48_value win, s48_value n)
{
char *str;
int status;
s48_value res;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(win, n, res);
status = winnstr (curses_extract_window(win), str,
s48_extract_integer(n));
if(status==ERR)
{
S48_GC_UNPROTECT();
return S48_FALSE;
}
else
{
res = s48_enter_string(str);
S48_GC_UNPROTECT();
return res;
}
}
//Loeschen:
s48_value scsh_werase(s48_value win)
{
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(win, res);
res = s48_enter_integer( werase (curses_extract_window(win)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_wclear(s48_value win)
{
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(win, res);
res = s48_enter_integer( wclear (curses_extract_window(win)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_wclrtobot(s48_value win)
{
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(win, res);
res = s48_enter_integer( wclrtobot (curses_extract_window(win)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_wclrtoeol(s48_value win)
{
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(win, res);
res = s48_enter_integer( wclrtoeol (curses_extract_window(win)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_clearok(s48_value win, s48_value bf)
{
s48_value res;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(win, bf, res);
res = s48_enter_integer( clearok (curses_extract_window(win),
S48_EXTRACT_BOOLEAN(bf)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_wdelch(s48_value win)
{
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(win, res);
res = s48_enter_integer( wdelch (curses_extract_window(win)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_wdeleteln(s48_value win)
{
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(win, res);
res = s48_enter_integer( wdeleteln (curses_extract_window(win)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_winsertln(s48_value win)
{
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(win, res);
res = s48_enter_integer( winsertln (curses_extract_window(win)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_winsdelln(s48_value win, s48_value n)
{
s48_value res;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(win, n, res);
res = s48_enter_integer( winsdelln
(curses_extract_window(win),
s48_extract_integer(n)));
S48_GC_UNPROTECT();
return res;
}
//mehrere Fenster
s48_value scsh_overlay(s48_value srcwin, s48_value dstwin)
{
s48_value res;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(srcwin, dstwin, res);
res = s48_enter_integer (overlay(curses_extract_window(srcwin),
curses_extract_window(dstwin)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_overwrite(s48_value srcwin, s48_value dstwin)
{
s48_value res;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(srcwin, dstwin, res);
res = s48_enter_integer (overwrite(curses_extract_window(srcwin),
curses_extract_window(dstwin)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_copywin(s48_value srcwin, s48_value dstwin,
s48_value sminrow, s48_value smincol,
s48_value dminrow, s48_value dmincol,
s48_value dmaxrow, s48_value dmaxcol,
s48_value overlay)
{
S48_DECLARE_GC_PROTECT(9);
S48_GC_PROTECT_9(srcwin, dstwin, sminrow, smincol, dminrow, dmincol,
dmaxrow, dmaxcol, overlay);
int res = copywin(curses_extract_window(srcwin),
curses_extract_window(dstwin),
s48_extract_integer(sminrow),
s48_extract_integer(smincol),
s48_extract_integer(dminrow),
s48_extract_integer(dmincol),
s48_extract_integer(dmaxrow),
s48_extract_integer(dmaxcol),
s48_extract_integer(overlay));
S48_GC_UNPROTECT();
return s48_enter_integer(res);
}
//Eigenschaften
s48_value scsh_touchline(s48_value win, s48_value start,
s48_value count)
{
s48_value res;
S48_DECLARE_GC_PROTECT(4);
S48_GC_PROTECT_4(win, start, count, res);
res = s48_enter_integer(touchline
(curses_extract_window(win),
s48_extract_integer(start),
s48_extract_integer(count)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_touchwin(s48_value win)
{
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(win, res);
res = s48_enter_integer(touchwin
(curses_extract_window(win)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_untouchwin(s48_value win)
{
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(win, res);
res = s48_enter_integer(untouchwin
(curses_extract_window(win)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_wtouchln(s48_value win, s48_value y,
s48_value n, s48_value changed)
{
s48_value res;
S48_DECLARE_GC_PROTECT(5);
S48_GC_PROTECT_5(win, y, n, changed, res);
res = s48_enter_integer(wtouchln
(curses_extract_window(win),
s48_extract_integer(y),
s48_extract_integer(n),
s48_extract_integer(changed)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_is_linetouched(s48_value win, s48_value line)
{
s48_value res;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(win, line, res);
res = S48_ENTER_BOOLEAN(is_linetouched
(curses_extract_window(win),
s48_extract_integer(line)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_is_wintouched(s48_value win)
{
s48_value res;
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(win, res);
res = S48_ENTER_BOOLEAN(is_wintouched
(curses_extract_window(win)));
S48_GC_UNPROTECT();
return res;
}
//*************************************************************************
//PADS
s48_value scsh_newpad(s48_value nlines, s48_value ncols)
{
WINDOW *pad;
s48_value res;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(nlines, ncols, res);
pad=(newpad ((int) s48_extract_integer(nlines)
,(int) s48_extract_integer(ncols)));
if (pad==NULL)
{
S48_GC_UNPROTECT();
return S48_FALSE;
}
else
{
res = curses_enter_window(pad);
S48_GC_UNPROTECT();
return res;
}
}
s48_value scsh_subpad(s48_value win, s48_value nlines,
s48_value ncols, s48_value begin_y,
s48_value begin_x)
{
WINDOW *pad;
s48_value res;
S48_DECLARE_GC_PROTECT(6);
S48_GC_PROTECT_6(win, nlines, ncols, begin_y, begin_x, res);
pad=(subpad (curses_extract_window(win),
(int) s48_extract_integer(nlines),
(int) s48_extract_integer(ncols),
(int) s48_extract_integer(begin_y),
(int) s48_extract_integer(begin_x)));
if (pad==NULL)
{
S48_GC_UNPROTECT();
return S48_FALSE;
}
else
{
res = curses_enter_window(pad);
S48_GC_UNPROTECT();
return res;
}
}
s48_value scsh_prefresh(s48_value orig, s48_value pminrow,
s48_value pmincol, s48_value sminrow,
s48_value smincol, s48_value smaxrow,
s48_value smaxcol)
{
s48_value res;
S48_DECLARE_GC_PROTECT(8);
S48_GC_PROTECT_8(orig, pminrow, pmincol, sminrow, smincol, smaxrow,
smaxcol, res);
res = s48_enter_integer (prefresh(curses_extract_window(orig),
s48_extract_integer(pminrow),
s48_extract_integer(pmincol),
s48_extract_integer(sminrow),
s48_extract_integer(smincol),
s48_extract_integer(smaxrow),
s48_extract_integer(smaxcol)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_pnoutrefresh(s48_value orig, s48_value pminrow,
s48_value pmincol, s48_value sminrow,
s48_value smincol, s48_value smaxrow,
s48_value smaxcol)
{
s48_value res;
S48_DECLARE_GC_PROTECT(8);
S48_GC_PROTECT_8(orig, pminrow, pmincol, sminrow, smincol, smaxrow,
smaxcol, res);
res = s48_enter_integer (pnoutrefresh(curses_extract_window(orig),
s48_extract_integer(pminrow),
s48_extract_integer(pmincol),
s48_extract_integer(sminrow),
s48_extract_integer(smincol),
s48_extract_integer(smaxrow),
s48_extract_integer(smaxcol)));
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_pechochar(s48_value pad, s48_value ch)
{
s48_value res;
S48_DECLARE_GC_PROTECT(3);
S48_GC_PROTECT_3(pad, ch, res);
res = s48_enter_integer (pechochar(curses_extract_window(pad),
curses_extract_chtype(ch)));
S48_GC_UNPROTECT();
return res;
}
//*************************************************************************
//KONSTANTEN:
//Standard-Screen
s48_value scsh_stdscr(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = curses_enter_window (stdscr);
S48_GC_UNPROTECT();
return res;
}
//Lines-Cols
s48_value scsh_LINES(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = curses_enter_window (LINES);
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_COLS(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = curses_enter_window (COLS);
S48_GC_UNPROTECT();
return res;
}
//Attribute
s48_value scsh_A_NORMAL(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer (A_NORMAL);
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_A_STANDOUT(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer (A_STANDOUT);
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_A_UNDERLINE(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer (A_UNDERLINE);
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_A_REVERSE(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer (A_REVERSE);
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_A_BLINK(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer (A_BLINK);
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_A_DIM(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer (A_DIM);
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_A_BOLD(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer (A_BOLD);
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_A_PROTECT(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer (A_PROTECT);
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_A_INVIS(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer (A_INVIS);
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_A_ALTCHARSET(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer (A_ALTCHARSET);
S48_GC_UNPROTECT();
return res;
}
//Farben:
s48_value scsh_COLOR_BLACK(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer (COLOR_BLACK);
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_COLOR_RED(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer (COLOR_RED);
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_COLOR_GREEN(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer (COLOR_GREEN);
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_COLOR_YELLOW(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer (COLOR_YELLOW);
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_COLOR_BLUE(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer (COLOR_BLUE);
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_COLOR_MAGENTA(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer (COLOR_MAGENTA);
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_COLOR_CYAN(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer (COLOR_CYAN);
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_COLOR_WHITE(void)
{
s48_value res;
S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_1(res);
res = s48_enter_integer (COLOR_WHITE);
S48_GC_UNPROTECT();
return res;
}
s48_value scsh_wprintw(s48_value win, s48_value string)
{
S48_DECLARE_GC_PROTECT(2);
S48_GC_PROTECT_2(win,string);
int res = wprintw(curses_extract_window(win),
s48_extract_string(string));
S48_GC_UNPROTECT();
return s48_enter_integer(res);
}
s48_value scsh_printw(s48_value text)
{
(void) printw(s48_extract_string(text));
return S48_UNSPECIFIC;
}
s48_value scsh_refresh(void)
{
(void) refresh();
return S48_UNSPECIFIC;
}
s48_value scsh_clear(void)
{
(void) clear();
return S48_UNSPECIFIC;
}
s48_value scsh_get_term_window_size(s48_value fd)
{
struct winsize size;
if (ioctl(s48_extract_fixnum(fd), TIOCGWINSZ, (char *) &size) < 0)
return S48_FALSE;
else
return s48_list_4(s48_enter_fixnum(size.ws_row),
s48_enter_fixnum(size.ws_col),
s48_enter_fixnum(size.ws_xpixel),
s48_enter_fixnum(size.ws_ypixel));
}
s48_value scsh_set_term_window_size(s48_value fd, s48_value row,
s48_value col, s48_value xpixel,
s48_value ypixel)
{
struct winsize size;
size.ws_row = (unsigned short) s48_extract_fixnum(row);
size.ws_col = (unsigned short) s48_extract_fixnum(col);
size.ws_xpixel = (unsigned short) s48_extract_fixnum(xpixel);
size.ws_ypixel = (unsigned short) s48_extract_fixnum(ypixel);
if (ioctl(s48_extract_fixnum(fd), TIOCSWINSZ, (char *) &size) < 0)
return S48_TRUE;
else
return S48_FALSE;
}
void s48_init_ncurses(void)
{
S48_EXPORT_FUNCTION(scsh_initscr);
S48_EXPORT_FUNCTION(scsh_newterm);
S48_EXPORT_FUNCTION(scsh_endwin);
S48_EXPORT_FUNCTION(scsh_isendwin);
S48_EXPORT_FUNCTION(scsh_delscreen);
S48_EXPORT_FUNCTION(scsh_unctrl);
S48_EXPORT_FUNCTION(scsh_keyname);
S48_EXPORT_FUNCTION(scsh_filter);
S48_EXPORT_FUNCTION(scsh_use_env);
S48_EXPORT_FUNCTION(scsh_putwin);
S48_EXPORT_FUNCTION(scsh_getwin);
S48_EXPORT_FUNCTION(scsh_delay_output);
S48_EXPORT_FUNCTION(scsh_flushinp);
S48_EXPORT_FUNCTION(scsh_curses_version);
S48_EXPORT_FUNCTION(scsh_use_default_colors);
S48_EXPORT_FUNCTION(scsh_assume_default_colors);
S48_EXPORT_FUNCTION(scsh_define_key);
S48_EXPORT_FUNCTION(scsh_baudrate);
S48_EXPORT_FUNCTION(scsh_erasechar);
S48_EXPORT_FUNCTION(scsh_has_ic);
S48_EXPORT_FUNCTION(scsh_has_il);
S48_EXPORT_FUNCTION(scsh_killchar);
S48_EXPORT_FUNCTION(scsh_longname);
S48_EXPORT_FUNCTION(scsh_termname);
S48_EXPORT_FUNCTION(scsh_has_key);
S48_EXPORT_FUNCTION(scsh_start_color);
S48_EXPORT_FUNCTION(scsh_init_pair);
S48_EXPORT_FUNCTION(scsh_init_color);
S48_EXPORT_FUNCTION(scsh_has_colors);
S48_EXPORT_FUNCTION(scsh_can_change_colors);
S48_EXPORT_FUNCTION(scsh_color_pair);
S48_EXPORT_FUNCTION(scsh_cbreak);
S48_EXPORT_FUNCTION(scsh_no_cbreak);
S48_EXPORT_FUNCTION(scsh_echo);
S48_EXPORT_FUNCTION(scsh_noecho);
S48_EXPORT_FUNCTION(scsh_halfdelay);
S48_EXPORT_FUNCTION(scsh_intrflush);
S48_EXPORT_FUNCTION(scsh_keypad);
S48_EXPORT_FUNCTION(scsh_meta);
S48_EXPORT_FUNCTION(scsh_nodelay);
S48_EXPORT_FUNCTION(scsh_raw);
S48_EXPORT_FUNCTION(scsh_noraw);
S48_EXPORT_FUNCTION(scsh_qiflush);
S48_EXPORT_FUNCTION(scsh_noqiflush);
S48_EXPORT_FUNCTION(scsh_beep);
S48_EXPORT_FUNCTION(scsh_flash);
S48_EXPORT_FUNCTION(scsh_def_prog_mode);
S48_EXPORT_FUNCTION(scsh_def_shell_mode);
S48_EXPORT_FUNCTION(scsh_reset_prog_mode);
S48_EXPORT_FUNCTION(scsh_reset_shell_mode);
S48_EXPORT_FUNCTION(scsh_resetty);
S48_EXPORT_FUNCTION(scsh_savetty);
S48_EXPORT_FUNCTION(scsh_curs_set);
S48_EXPORT_FUNCTION(scsh_napms);
S48_EXPORT_FUNCTION(scsh_mcprint);
S48_EXPORT_FUNCTION(scsh_is_term_resized);
S48_EXPORT_FUNCTION(scsh_resize_term);
S48_EXPORT_FUNCTION(scsh_resizeterm);
S48_EXPORT_FUNCTION(scsh_scr_dump);
S48_EXPORT_FUNCTION(scsh_scr_restore);
S48_EXPORT_FUNCTION(scsh_scr_init);
S48_EXPORT_FUNCTION(scsh_scr_set);
S48_EXPORT_FUNCTION(scsh_set_term);
S48_EXPORT_FUNCTION(scsh_newwin);
S48_EXPORT_FUNCTION(scsh_delwin);
S48_EXPORT_FUNCTION(scsh_mvwin);
S48_EXPORT_FUNCTION(scsh_subwin);
S48_EXPORT_FUNCTION(scsh_derwin);
S48_EXPORT_FUNCTION(scsh_mvderwin);
S48_EXPORT_FUNCTION(scsh_dupwin);
S48_EXPORT_FUNCTION(scsh_wsyncup);
S48_EXPORT_FUNCTION(scsh_wcursyncup);
S48_EXPORT_FUNCTION(scsh_wsyncdown);
S48_EXPORT_FUNCTION(scsh_syncok);
S48_EXPORT_FUNCTION(scsh_wrefresh);
S48_EXPORT_FUNCTION(scsh_wnoutrefresh);
S48_EXPORT_FUNCTION(scsh_redrawwin);
S48_EXPORT_FUNCTION(scsh_doupdate);
S48_EXPORT_FUNCTION(scsh_wredrawln);
/*S48_EXPORT_FUNCTION(scsh_getyx);
S48_EXPORT_FUNCTION(scsh_getparyx);
S48_EXPORT_FUNCTION(scsh_getbegyx);
S48_EXPORT_FUNCTION(scsh_getmaxyx);*/
S48_EXPORT_FUNCTION(scsh_gety);
S48_EXPORT_FUNCTION(scsh_getx);
S48_EXPORT_FUNCTION(scsh_getmaxy);
S48_EXPORT_FUNCTION(scsh_getmaxx);
S48_EXPORT_FUNCTION(scsh_wresize);
S48_EXPORT_FUNCTION(scsh_idlok);
S48_EXPORT_FUNCTION(scsh_leaveok);
S48_EXPORT_FUNCTION(scsh_scrollok);
S48_EXPORT_FUNCTION(scsh_idcok);
S48_EXPORT_FUNCTION(scsh_immedok);
S48_EXPORT_FUNCTION(scsh_wsetscrreg);
S48_EXPORT_FUNCTION(scsh_nl);
S48_EXPORT_FUNCTION(scsh_nonl);
S48_EXPORT_FUNCTION(scsh_waddch);
S48_EXPORT_FUNCTION(scsh_wechochar);
S48_EXPORT_FUNCTION(scsh_waddstr);
S48_EXPORT_FUNCTION(scsh_waddnstr);
S48_EXPORT_FUNCTION(scsh_winsch);
S48_EXPORT_FUNCTION(scsh_winsstr);
S48_EXPORT_FUNCTION(scsh_winsnstr);
S48_EXPORT_FUNCTION(scsh_wattroff);
S48_EXPORT_FUNCTION(scsh_wattron);
S48_EXPORT_FUNCTION(scsh_wattrset);
S48_EXPORT_FUNCTION(scsh_wstandend);
S48_EXPORT_FUNCTION(scsh_wstandout);
S48_EXPORT_FUNCTION(scsh_wbkgdset);
S48_EXPORT_FUNCTION(scsh_wbkgd);
S48_EXPORT_FUNCTION(scsh_getbkgd);
S48_EXPORT_FUNCTION(scsh_wborder);
S48_EXPORT_FUNCTION(scsh_box);
S48_EXPORT_FUNCTION(scsh_whline);
S48_EXPORT_FUNCTION(scsh_wvline);
S48_EXPORT_FUNCTION(scsh_scroll);
S48_EXPORT_FUNCTION(scsh_wscrl);
S48_EXPORT_FUNCTION(scsh_wmove);
S48_EXPORT_FUNCTION(scsh_wgetch);
S48_EXPORT_FUNCTION(scsh_winch);
S48_EXPORT_FUNCTION(scsh_winstr);
S48_EXPORT_FUNCTION(scsh_winnstr);
S48_EXPORT_FUNCTION(scsh_werase);
S48_EXPORT_FUNCTION(scsh_wclear);
S48_EXPORT_FUNCTION(scsh_wclrtobot);
S48_EXPORT_FUNCTION(scsh_wclrtoeol);
S48_EXPORT_FUNCTION(scsh_clearok);
S48_EXPORT_FUNCTION(scsh_wdelch);
S48_EXPORT_FUNCTION(scsh_wdeleteln);
S48_EXPORT_FUNCTION(scsh_winsertln);
S48_EXPORT_FUNCTION(scsh_winsdelln);
S48_EXPORT_FUNCTION(scsh_overlay);
S48_EXPORT_FUNCTION(scsh_overwrite);
S48_EXPORT_FUNCTION(scsh_copywin);
S48_EXPORT_FUNCTION(scsh_touchline);
S48_EXPORT_FUNCTION(scsh_touchwin);
S48_EXPORT_FUNCTION(scsh_untouchwin);
S48_EXPORT_FUNCTION(scsh_wtouchln);
S48_EXPORT_FUNCTION(scsh_is_linetouched);
S48_EXPORT_FUNCTION(scsh_is_wintouched);
S48_EXPORT_FUNCTION(scsh_newpad);
S48_EXPORT_FUNCTION(scsh_subpad);
S48_EXPORT_FUNCTION(scsh_prefresh);
S48_EXPORT_FUNCTION(scsh_pnoutrefresh);
S48_EXPORT_FUNCTION(scsh_pechochar);
S48_EXPORT_FUNCTION(scsh_stdscr);
S48_EXPORT_FUNCTION(scsh_LINES);
S48_EXPORT_FUNCTION(scsh_COLS);
S48_EXPORT_FUNCTION(scsh_A_NORMAL);
S48_EXPORT_FUNCTION(scsh_A_STANDOUT);
S48_EXPORT_FUNCTION(scsh_A_UNDERLINE);
S48_EXPORT_FUNCTION(scsh_A_REVERSE);
S48_EXPORT_FUNCTION(scsh_A_BLINK);
S48_EXPORT_FUNCTION(scsh_A_DIM);
S48_EXPORT_FUNCTION(scsh_A_BOLD);
S48_EXPORT_FUNCTION(scsh_A_PROTECT);
S48_EXPORT_FUNCTION(scsh_A_INVIS);
S48_EXPORT_FUNCTION(scsh_A_ALTCHARSET);
S48_EXPORT_FUNCTION(scsh_COLOR_BLACK);
S48_EXPORT_FUNCTION(scsh_COLOR_RED);
S48_EXPORT_FUNCTION(scsh_COLOR_GREEN);
S48_EXPORT_FUNCTION(scsh_COLOR_YELLOW);
S48_EXPORT_FUNCTION(scsh_COLOR_BLUE);
S48_EXPORT_FUNCTION(scsh_COLOR_MAGENTA);
S48_EXPORT_FUNCTION(scsh_COLOR_CYAN);
S48_EXPORT_FUNCTION(scsh_COLOR_WHITE);
S48_EXPORT_FUNCTION(scsh_wprintw);
S48_EXPORT_FUNCTION(scsh_printw);
S48_EXPORT_FUNCTION(scsh_refresh);
S48_EXPORT_FUNCTION(scsh_clear);
S48_EXPORT_FUNCTION(scsh_get_term_window_size);
S48_EXPORT_FUNCTION(scsh_set_term_window_size);
}