#include <curses.h>
#include <malloc.h>
#include "../../basext.h"
Go to the source code of this file.
Defines | |
#define | MAX_WINDOWS 16 |
#define | AUTO_REFRESH do { if (auto_refresh) { refresh(); } } while (0) |
#define | HANDLE_ERR(cmd) LONGVALUE(besRETURNVALUE) = ((cmd) == ERR) ? 0 : -1; |
Functions | |
static int | color_to_basic (int color) |
static int | color_to_curses (int sbcolor) |
static int | attr_to_basic (int attr) |
static attr_t | attr_to_curses (int sbattr) |
Variables | |
WINDOW * | window_list [MAX_WINDOWS] |
WINDOW * | current_window |
static int | auto_refresh = -1 |
static int | color_supported |
besSUB_SHUTDOWN | return |
besEND SLFST | CURSES_SLFST [] |
|
Definition at line 214 of file interface.c. |
|
Definition at line 215 of file interface.c. |
|
=H the module CURSES This module implements a ScriptBasic-curses interface (something like CIO for Unix) that makes direct cursor control and screen drawing possible on Unix systems. Author: Berki Lukacs Tamas =section Installation =H Installation The distribution contains the C language source file and the ScriptBasic include file. The C source must be compiled with the following command: =verbatim cc -shared -o libcurses.so curses.c -lcurses =noverbatim The curses library and its include files (for Debian users: libncurses5 and libncurses5-dev packages) must be installed. Move the library to your ScriptBasic library directory and the include file to the ScriptBasic include file directory (or redefine include and library directories in basic.conf). I hope that this module will be included in the ScriptBasic distribution RSN. =section CIO compatibility My original plan was to port the CIO library to Unices, but most of its functions could not be adapted and curses supports a much wider range of screen operations than CIO, so this extension became a curses interface. This means that curses routines are not compatible with CIO, although it should be very easy to make a subset of CIO routines available under Unices. sbkbhit is the equivalent of getch(0, 0). Console title modification is (of course) not supported, but something could be done with xterm's title modification escape sequences. NoBreak is not supported. ScriptBasic programs should be terminated with Ctrl-C (SIGINT). SizeX and SizeY are the equivalent of getmaxx and getmaxy. Color support is VERY different in curses. Cls is the direct equivalent of erase. Naturally, the ncurses console cannot be resized like the SetWindow command does it under Windows. =section Color handling The only non-straightforward thing about the curses library is its color support. Every character on the screen has an associated color pair number. A color pair consists of a background and a foreground color. There are a a very finite number of available color pairs, which can be found out using the maxcolors function. If you want to print a character in a specified color, you initialize a color pair to that color, and then make that the active color pair using setcolor. You cannot cheat (i.e. print more colors on the screen than the number of available color pairs) by printing a character and then changing its color pair's definition, because if a color pair is changed, its occurrences on the screen are repainted using the new color. This is quirk in curses (I think for the sake of being compatible with some kind of old terminals). =section Windows This is VERY straightforward. Windows can be created and deleted using newwin and delwin. Sub-window support is there in ncurses, but I chose not to support that because the documentation of ncurses says that it is still buggy. Definition at line 115 of file interface.c. |
|
Definition at line 154 of file interface.c. |
|
Definition at line 184 of file interface.c. |
|
Definition at line 125 of file interface.c. |
|
Definition at line 141 of file interface.c. |
|
Definition at line 123 of file interface.c. |
|
Console handling low level routines for Unix ncurses environment. This module implements interface routines to the ncurses library. Definition at line 225 of file interface.c. |
|
Definition at line 117 of file interface.c. |
|
Definition at line 1139 of file interface.c. |
|
Definition at line 227 of file interface.c. |
|
Definition at line 116 of file interface.c. |