curses 1.3.0 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/macos.yml +19 -0
- data/.github/workflows/ubuntu.yml +26 -0
- data/.github/workflows/windows.yml +25 -0
- data/History.md +34 -0
- data/README.md +14 -46
- data/Rakefile +0 -86
- data/curses.gemspec +2 -3
- data/ext/curses/curses.c +70 -58
- data/ext/curses/extconf.rb +134 -21
- data/lib/curses.rb +5 -12
- data/sample/addch.rb +16 -0
- data/sample/attr_demo.rb +32 -0
- data/sample/colors.rb +26 -0
- data/sample/menu.rb +3 -3
- data/sample/mouse_move.rb +75 -0
- data/vendor/PDCurses/.gitignore +47 -0
- data/vendor/PDCurses/.travis.yml +49 -0
- data/vendor/PDCurses/CMakeLists.txt +68 -0
- data/vendor/PDCurses/HISTORY.md +2036 -0
- data/vendor/PDCurses/IMPLEMNT.md +327 -0
- data/vendor/PDCurses/README.md +77 -0
- data/vendor/PDCurses/acs_defs.h +265 -0
- data/vendor/PDCurses/appveyor.yml +218 -0
- data/vendor/PDCurses/cmake/README.md +71 -0
- data/vendor/PDCurses/cmake/build_dependencies.cmake +178 -0
- data/vendor/PDCurses/cmake/build_options.cmake +25 -0
- data/vendor/PDCurses/cmake/dll_version.cmake +26 -0
- data/vendor/PDCurses/cmake/gen_config_header.cmake +43 -0
- data/vendor/PDCurses/cmake/get_version.cmake +17 -0
- data/vendor/PDCurses/cmake/make_uninstall.cmake +19 -0
- data/vendor/PDCurses/cmake/project_common.cmake +121 -0
- data/vendor/PDCurses/cmake/resource.in.cmake +52 -0
- data/vendor/PDCurses/cmake/sdl2_ttf/CMakeLists.txt +83 -0
- data/vendor/PDCurses/cmake/target_arch.cmake +36 -0
- data/vendor/PDCurses/cmake/version.in.cmake +73 -0
- data/vendor/PDCurses/cmake/watcom_open_dos16_toolchain.cmake +96 -0
- data/vendor/PDCurses/cmake/watcom_open_dos32_toolchain.cmake +106 -0
- data/vendor/PDCurses/cmake/watcom_open_os2v2_toolchain.cmake +105 -0
- data/vendor/PDCurses/curses.h +1846 -0
- data/vendor/PDCurses/curspriv.h +134 -0
- data/vendor/PDCurses/demos/README.md +25 -0
- data/vendor/PDCurses/demos/firework.c +144 -0
- data/vendor/PDCurses/demos/newtest.c +581 -0
- data/vendor/PDCurses/demos/ozdemo.c +447 -0
- data/vendor/PDCurses/demos/ptest.c +283 -0
- data/vendor/PDCurses/demos/rain.c +157 -0
- data/vendor/PDCurses/demos/testcurs.c +1607 -0
- data/vendor/PDCurses/demos/tui.c +1048 -0
- data/vendor/PDCurses/demos/tui.h +65 -0
- data/vendor/PDCurses/demos/tuidemo.c +233 -0
- data/vendor/PDCurses/demos/version.c +61 -0
- data/vendor/PDCurses/demos/worm.c +432 -0
- data/vendor/PDCurses/demos/xmas.c +955 -0
- data/vendor/PDCurses/dos/CMakeLists.txt +47 -0
- data/vendor/PDCurses/dos/Makefile.bcc +83 -0
- data/vendor/PDCurses/dos/Makefile.dmc +257 -0
- data/vendor/PDCurses/dos/Makefile.msc +113 -0
- data/vendor/PDCurses/dos/Makefile.wcc +107 -0
- data/vendor/PDCurses/dos/README.md +51 -0
- data/vendor/PDCurses/dos/bccdos.lrf +9 -0
- data/vendor/PDCurses/dos/mscdos.lrf +50 -0
- data/vendor/PDCurses/dos/pdcclip.c +132 -0
- data/vendor/PDCurses/dos/pdcdisp.c +135 -0
- data/vendor/PDCurses/dos/pdcdos.h +194 -0
- data/vendor/PDCurses/dos/pdcgetsc.c +98 -0
- data/vendor/PDCurses/dos/pdckbd.c +513 -0
- data/vendor/PDCurses/dos/pdcscrn.c +785 -0
- data/vendor/PDCurses/dos/pdcsetsc.c +101 -0
- data/vendor/PDCurses/dos/pdcutil.c +212 -0
- data/vendor/PDCurses/libobjs.mif +26 -0
- data/vendor/PDCurses/makedist.mif +20 -0
- data/vendor/PDCurses/man/README.md +21 -0
- data/vendor/PDCurses/man/intro.md +361 -0
- data/vendor/PDCurses/man/manext.c +119 -0
- data/vendor/PDCurses/man/sdl.md +152 -0
- data/vendor/PDCurses/man/sdl2.md +58 -0
- data/vendor/PDCurses/man/x11.md +407 -0
- data/vendor/PDCurses/ncurses/CMakeLists.txt +66 -0
- data/vendor/PDCurses/ncurses/README.md +26 -0
- data/vendor/PDCurses/ncurses/makefile +29 -0
- data/vendor/PDCurses/os2/CMakeLists.txt +41 -0
- data/vendor/PDCurses/os2/Makefile.bcc +90 -0
- data/vendor/PDCurses/os2/Makefile.wcc +43 -0
- data/vendor/PDCurses/os2/README.md +43 -0
- data/vendor/PDCurses/os2/iccos2.lrf +50 -0
- data/vendor/PDCurses/os2/iccos2.mak +256 -0
- data/vendor/PDCurses/os2/pdcclip.c +188 -0
- data/vendor/PDCurses/os2/pdcdisp.c +93 -0
- data/vendor/PDCurses/os2/pdcgetsc.c +89 -0
- data/vendor/PDCurses/os2/pdckbd.c +521 -0
- data/vendor/PDCurses/os2/pdcos2.h +55 -0
- data/vendor/PDCurses/os2/pdcscrn.c +449 -0
- data/vendor/PDCurses/os2/pdcsetsc.c +112 -0
- data/vendor/PDCurses/os2/pdcutil.c +52 -0
- data/vendor/PDCurses/panel.h +56 -0
- data/vendor/PDCurses/pdcurses/README.md +25 -0
- data/vendor/PDCurses/pdcurses/addch.c +693 -0
- data/vendor/PDCurses/pdcurses/addchstr.c +245 -0
- data/vendor/PDCurses/pdcurses/addstr.c +240 -0
- data/vendor/PDCurses/pdcurses/attr.c +359 -0
- data/vendor/PDCurses/pdcurses/beep.c +68 -0
- data/vendor/PDCurses/pdcurses/bkgd.c +223 -0
- data/vendor/PDCurses/pdcurses/border.c +411 -0
- data/vendor/PDCurses/pdcurses/clear.c +159 -0
- data/vendor/PDCurses/pdcurses/color.c +298 -0
- data/vendor/PDCurses/pdcurses/debug.c +109 -0
- data/vendor/PDCurses/pdcurses/delch.c +96 -0
- data/vendor/PDCurses/pdcurses/deleteln.c +211 -0
- data/vendor/PDCurses/pdcurses/deprec.c +27 -0
- data/vendor/PDCurses/pdcurses/getch.c +417 -0
- data/vendor/PDCurses/pdcurses/getstr.c +474 -0
- data/vendor/PDCurses/pdcurses/getyx.c +139 -0
- data/vendor/PDCurses/pdcurses/inch.c +127 -0
- data/vendor/PDCurses/pdcurses/inchstr.c +214 -0
- data/vendor/PDCurses/pdcurses/initscr.c +367 -0
- data/vendor/PDCurses/pdcurses/inopts.c +324 -0
- data/vendor/PDCurses/pdcurses/insch.c +271 -0
- data/vendor/PDCurses/pdcurses/insstr.c +264 -0
- data/vendor/PDCurses/pdcurses/instr.c +246 -0
- data/vendor/PDCurses/pdcurses/kernel.c +259 -0
- data/vendor/PDCurses/pdcurses/keyname.c +157 -0
- data/vendor/PDCurses/pdcurses/mouse.c +438 -0
- data/vendor/PDCurses/pdcurses/move.c +57 -0
- data/vendor/PDCurses/pdcurses/outopts.c +159 -0
- data/vendor/PDCurses/pdcurses/overlay.c +214 -0
- data/vendor/PDCurses/pdcurses/pad.c +260 -0
- data/vendor/PDCurses/pdcurses/panel.c +633 -0
- data/vendor/PDCurses/pdcurses/printw.c +126 -0
- data/vendor/PDCurses/pdcurses/refresh.c +279 -0
- data/vendor/PDCurses/pdcurses/scanw.c +578 -0
- data/vendor/PDCurses/pdcurses/scr_dump.c +213 -0
- data/vendor/PDCurses/pdcurses/scroll.c +101 -0
- data/vendor/PDCurses/pdcurses/slk.c +591 -0
- data/vendor/PDCurses/pdcurses/termattr.c +182 -0
- data/vendor/PDCurses/pdcurses/terminfo.c +217 -0
- data/vendor/PDCurses/pdcurses/touch.c +163 -0
- data/vendor/PDCurses/pdcurses/util.c +312 -0
- data/vendor/PDCurses/pdcurses/window.c +569 -0
- data/vendor/PDCurses/sdl1/Makefile.mng +110 -0
- data/vendor/PDCurses/sdl1/README.md +31 -0
- data/vendor/PDCurses/sdl1/deffont.h +385 -0
- data/vendor/PDCurses/sdl1/deficon.h +23 -0
- data/vendor/PDCurses/sdl1/pdcclip.c +131 -0
- data/vendor/PDCurses/sdl1/pdcdisp.c +373 -0
- data/vendor/PDCurses/sdl1/pdcgetsc.c +30 -0
- data/vendor/PDCurses/sdl1/pdckbd.c +405 -0
- data/vendor/PDCurses/sdl1/pdcscrn.c +414 -0
- data/vendor/PDCurses/sdl1/pdcsdl.h +31 -0
- data/vendor/PDCurses/sdl1/pdcsetsc.c +64 -0
- data/vendor/PDCurses/sdl1/pdcutil.c +40 -0
- data/vendor/PDCurses/sdl1/sdltest.c +79 -0
- data/vendor/PDCurses/sdl2/CMakeLists.txt +76 -0
- data/vendor/PDCurses/sdl2/Makefile.vc +164 -0
- data/vendor/PDCurses/sdl2/README.md +34 -0
- data/vendor/PDCurses/sdl2/deffont.h +385 -0
- data/vendor/PDCurses/sdl2/deficon.h +23 -0
- data/vendor/PDCurses/sdl2/pdcclip.c +93 -0
- data/vendor/PDCurses/sdl2/pdcdisp.c +534 -0
- data/vendor/PDCurses/sdl2/pdcgetsc.c +30 -0
- data/vendor/PDCurses/sdl2/pdckbd.c +480 -0
- data/vendor/PDCurses/sdl2/pdcscrn.c +443 -0
- data/vendor/PDCurses/sdl2/pdcsdl.h +33 -0
- data/vendor/PDCurses/sdl2/pdcsetsc.c +67 -0
- data/vendor/PDCurses/sdl2/pdcutil.c +39 -0
- data/vendor/PDCurses/sdl2/sdltest.c +81 -0
- data/vendor/PDCurses/term.h +48 -0
- data/vendor/PDCurses/version.mif +7 -0
- data/vendor/PDCurses/vt/CMakeLists.txt +28 -0
- data/vendor/PDCurses/vt/Makefile.bcc +111 -0
- data/vendor/PDCurses/vt/Makefile.dmc +258 -0
- data/vendor/PDCurses/vt/Makefile.vc +144 -0
- data/vendor/PDCurses/vt/Makefile.wcc +107 -0
- data/vendor/PDCurses/vt/README.md +64 -0
- data/vendor/PDCurses/vt/pdcclip.c +20 -0
- data/vendor/PDCurses/vt/pdcdisp.c +284 -0
- data/vendor/PDCurses/vt/pdcgetsc.c +27 -0
- data/vendor/PDCurses/vt/pdckbd.c +394 -0
- data/vendor/PDCurses/vt/pdcscrn.c +434 -0
- data/vendor/PDCurses/vt/pdcsetsc.c +45 -0
- data/vendor/PDCurses/vt/pdcutil.c +43 -0
- data/vendor/PDCurses/vt/pdcvt.h +16 -0
- data/vendor/PDCurses/watcom.mif +68 -0
- data/vendor/PDCurses/wincon/CMakeLists.txt +27 -0
- data/vendor/PDCurses/wincon/Makefile.bcc +88 -0
- data/vendor/PDCurses/wincon/Makefile.dmc +256 -0
- data/vendor/PDCurses/wincon/Makefile.lcc +273 -0
- data/vendor/PDCurses/wincon/Makefile.mng +176 -0
- data/vendor/PDCurses/wincon/Makefile.vc +144 -0
- data/vendor/PDCurses/wincon/Makefile.wcc +51 -0
- data/vendor/PDCurses/wincon/README.md +85 -0
- data/vendor/PDCurses/wincon/pdcclip.c +174 -0
- data/vendor/PDCurses/wincon/pdcdisp.c +143 -0
- data/vendor/PDCurses/wincon/pdcgetsc.c +55 -0
- data/vendor/PDCurses/wincon/pdckbd.c +786 -0
- data/vendor/PDCurses/wincon/pdcscrn.c +717 -0
- data/vendor/PDCurses/wincon/pdcsetsc.c +91 -0
- data/vendor/PDCurses/wincon/pdcurses.ico +0 -0
- data/vendor/PDCurses/wincon/pdcurses.rc +28 -0
- data/vendor/PDCurses/wincon/pdcutil.c +41 -0
- data/vendor/PDCurses/wincon/pdcwin.h +31 -0
- data/vendor/PDCurses/wingui/CMakeLists.txt +27 -0
- data/vendor/PDCurses/wingui/Makefile.bcc +85 -0
- data/vendor/PDCurses/wingui/Makefile.dmc +259 -0
- data/vendor/PDCurses/wingui/Makefile.lcc +273 -0
- data/vendor/PDCurses/wingui/Makefile.mng +171 -0
- data/vendor/PDCurses/wingui/Makefile.vc +144 -0
- data/vendor/PDCurses/wingui/Makefile.wcc +51 -0
- data/vendor/PDCurses/wingui/README.md +93 -0
- data/vendor/PDCurses/wingui/pdcclip.c +174 -0
- data/vendor/PDCurses/wingui/pdcdisp.c +718 -0
- data/vendor/PDCurses/wingui/pdcgetsc.c +30 -0
- data/vendor/PDCurses/wingui/pdckbd.c +143 -0
- data/vendor/PDCurses/wingui/pdcscrn.c +2797 -0
- data/vendor/PDCurses/wingui/pdcsetsc.c +89 -0
- data/vendor/PDCurses/wingui/pdcurses.ico +0 -0
- data/vendor/PDCurses/wingui/pdcurses.rc +28 -0
- data/vendor/PDCurses/wingui/pdcutil.c +61 -0
- data/vendor/PDCurses/wingui/pdcwin.h +122 -0
- data/vendor/PDCurses/x11/Makefile.in +754 -0
- data/vendor/PDCurses/x11/PDCurses.spec +82 -0
- data/vendor/PDCurses/x11/README.md +62 -0
- data/vendor/PDCurses/x11/ScrollBox.c +319 -0
- data/vendor/PDCurses/x11/ScrollBox.h +51 -0
- data/vendor/PDCurses/x11/ScrollBoxP.h +70 -0
- data/vendor/PDCurses/x11/aclocal.m4 +994 -0
- data/vendor/PDCurses/x11/big_icon.xbm +46 -0
- data/vendor/PDCurses/x11/compose.h +201 -0
- data/vendor/PDCurses/x11/config.guess +1500 -0
- data/vendor/PDCurses/x11/config.h.in +100 -0
- data/vendor/PDCurses/x11/config.sub +1616 -0
- data/vendor/PDCurses/x11/configure +6700 -0
- data/vendor/PDCurses/x11/configure.ac +295 -0
- data/vendor/PDCurses/x11/debian/changelog +6 -0
- data/vendor/PDCurses/x11/debian/compat +1 -0
- data/vendor/PDCurses/x11/debian/control +11 -0
- data/vendor/PDCurses/x11/debian/copyright +27 -0
- data/vendor/PDCurses/x11/debian/rules +98 -0
- data/vendor/PDCurses/x11/install-sh +253 -0
- data/vendor/PDCurses/x11/little_icon.xbm +14 -0
- data/vendor/PDCurses/x11/ncurses_cfg.h +45 -0
- data/vendor/PDCurses/x11/pdcclip.c +173 -0
- data/vendor/PDCurses/x11/pdcdisp.c +85 -0
- data/vendor/PDCurses/x11/pdcgetsc.c +28 -0
- data/vendor/PDCurses/x11/pdckbd.c +104 -0
- data/vendor/PDCurses/x11/pdcscrn.c +258 -0
- data/vendor/PDCurses/x11/pdcsetsc.c +95 -0
- data/vendor/PDCurses/x11/pdcutil.c +52 -0
- data/vendor/PDCurses/x11/pdcx11.c +316 -0
- data/vendor/PDCurses/x11/pdcx11.h +191 -0
- data/vendor/PDCurses/x11/sb.c +155 -0
- data/vendor/PDCurses/x11/x11.c +3686 -0
- data/vendor/PDCurses/x11/xcurses-config.in +81 -0
- metadata +258 -24
- data/.travis.yml +0 -16
- data/appveyor.yml +0 -16
@@ -0,0 +1,55 @@
|
|
1
|
+
/* Public Domain Curses */
|
2
|
+
|
3
|
+
#ifdef _MSC_VER
|
4
|
+
# define USE_OS2_H 1 /* Use the os2.h for the compiler */
|
5
|
+
# define APIRET USHORT
|
6
|
+
#endif
|
7
|
+
|
8
|
+
#include <stdlib.h>
|
9
|
+
#include <string.h>
|
10
|
+
|
11
|
+
#ifdef EMXVIDEO
|
12
|
+
# include <sys/video.h>
|
13
|
+
#else
|
14
|
+
# define INCL_DOS
|
15
|
+
# define INCL_DOSMISC
|
16
|
+
# define INCL_WIN
|
17
|
+
# define INCL_VIO
|
18
|
+
# define INCL_KBD
|
19
|
+
# define INCL_MOU
|
20
|
+
# include <os2.h>
|
21
|
+
#endif
|
22
|
+
|
23
|
+
#include <curspriv.h>
|
24
|
+
|
25
|
+
#ifdef CHTYPE_LONG
|
26
|
+
# define PDC_ATTR_SHIFT 19
|
27
|
+
#else
|
28
|
+
# define PDC_ATTR_SHIFT 8
|
29
|
+
#endif
|
30
|
+
|
31
|
+
#ifdef __WATCOMC__
|
32
|
+
# define PDCTHUNK(x) ((ptr_16)(x))
|
33
|
+
# ifdef __386__
|
34
|
+
# define SEG16 _Seg16
|
35
|
+
# else
|
36
|
+
# define SEG16
|
37
|
+
# endif
|
38
|
+
|
39
|
+
typedef void * SEG16 ptr_16;
|
40
|
+
|
41
|
+
#else
|
42
|
+
# ifdef __EMX__
|
43
|
+
# ifdef __INNOTEK_LIBC__
|
44
|
+
# define PDCTHUNK(x) ((PCH)_libc_32to16(x))
|
45
|
+
# else
|
46
|
+
# define PDCTHUNK(x) ((PCH)_emx_32to16(x))
|
47
|
+
# endif
|
48
|
+
# endif
|
49
|
+
#endif
|
50
|
+
|
51
|
+
extern unsigned char *pdc_atrtab;
|
52
|
+
extern int pdc_font;
|
53
|
+
|
54
|
+
extern void PDC_get_keyboard_info(void);
|
55
|
+
extern void PDC_set_keyboard_default(void);
|
@@ -0,0 +1,449 @@
|
|
1
|
+
/* Public Domain Curses */
|
2
|
+
|
3
|
+
#include "pdcos2.h"
|
4
|
+
|
5
|
+
#ifdef CHTYPE_LONG
|
6
|
+
# define PDC_OFFSET 32
|
7
|
+
#else
|
8
|
+
# define PDC_OFFSET 8
|
9
|
+
#endif
|
10
|
+
|
11
|
+
/* COLOR_PAIR to attribute encoding table. */
|
12
|
+
|
13
|
+
unsigned char *pdc_atrtab = (unsigned char *)NULL;
|
14
|
+
|
15
|
+
int pdc_font; /* default font size */
|
16
|
+
|
17
|
+
static short curstoreal[16], realtocurs[16] =
|
18
|
+
{
|
19
|
+
COLOR_BLACK, COLOR_BLUE, COLOR_GREEN, COLOR_CYAN, COLOR_RED,
|
20
|
+
COLOR_MAGENTA, COLOR_YELLOW, COLOR_WHITE, COLOR_BLACK + 8,
|
21
|
+
COLOR_BLUE + 8, COLOR_GREEN + 8, COLOR_CYAN + 8, COLOR_RED + 8,
|
22
|
+
COLOR_MAGENTA + 8, COLOR_YELLOW + 8, COLOR_WHITE + 8
|
23
|
+
};
|
24
|
+
|
25
|
+
#ifdef EMXVIDEO
|
26
|
+
static unsigned char *saved_screen = NULL;
|
27
|
+
static int saved_lines = 0;
|
28
|
+
static int saved_cols = 0;
|
29
|
+
#else
|
30
|
+
# ifdef PDCTHUNK
|
31
|
+
# ifdef __EMX__
|
32
|
+
# define THUNKEDVIO VIOCOLORREG
|
33
|
+
# else
|
34
|
+
|
35
|
+
typedef struct {
|
36
|
+
USHORT cb;
|
37
|
+
USHORT type;
|
38
|
+
USHORT firstcolorreg;
|
39
|
+
USHORT numcolorregs;
|
40
|
+
ptr_16 colorregaddr;
|
41
|
+
} THUNKEDVIO;
|
42
|
+
|
43
|
+
# endif
|
44
|
+
# endif
|
45
|
+
|
46
|
+
static PCH saved_screen = NULL;
|
47
|
+
static USHORT saved_lines = 0;
|
48
|
+
static USHORT saved_cols = 0;
|
49
|
+
static VIOMODEINFO scrnmode; /* default screen mode */
|
50
|
+
static VIOMODEINFO saved_scrnmode[3];
|
51
|
+
static int saved_font[3];
|
52
|
+
static bool can_change = FALSE;
|
53
|
+
|
54
|
+
/* special purpose function keys */
|
55
|
+
static int PDC_shutdown_key[PDC_MAX_FUNCTION_KEYS] = { 0, 0, 0, 0, 0 };
|
56
|
+
|
57
|
+
static int _get_font(void)
|
58
|
+
{
|
59
|
+
VIOMODEINFO modeInfo = {0};
|
60
|
+
|
61
|
+
modeInfo.cb = sizeof(modeInfo);
|
62
|
+
|
63
|
+
VioGetMode(&modeInfo, 0);
|
64
|
+
return (modeInfo.vres / modeInfo.row);
|
65
|
+
}
|
66
|
+
|
67
|
+
static void _set_font(int size)
|
68
|
+
{
|
69
|
+
VIOMODEINFO modeInfo = {0};
|
70
|
+
|
71
|
+
if (pdc_font != size)
|
72
|
+
{
|
73
|
+
modeInfo.cb = sizeof(modeInfo);
|
74
|
+
|
75
|
+
/* set most parameters of modeInfo */
|
76
|
+
|
77
|
+
VioGetMode(&modeInfo, 0);
|
78
|
+
modeInfo.cb = 8; /* ignore horiz an vert resolution */
|
79
|
+
modeInfo.row = modeInfo.vres / size;
|
80
|
+
VioSetMode(&modeInfo, 0);
|
81
|
+
}
|
82
|
+
|
83
|
+
curs_set(SP->visibility);
|
84
|
+
|
85
|
+
pdc_font = _get_font();
|
86
|
+
}
|
87
|
+
|
88
|
+
#endif
|
89
|
+
|
90
|
+
/* close the physical screen -- may restore the screen to its state
|
91
|
+
before PDC_scr_open(); miscellaneous cleanup */
|
92
|
+
|
93
|
+
void PDC_scr_close(void)
|
94
|
+
{
|
95
|
+
PDC_LOG(("PDC_scr_close() - called\n"));
|
96
|
+
|
97
|
+
if (saved_screen && getenv("PDC_RESTORE_SCREEN"))
|
98
|
+
{
|
99
|
+
#ifdef EMXVIDEO
|
100
|
+
v_putline(saved_screen, 0, 0, saved_lines * saved_cols);
|
101
|
+
#else
|
102
|
+
VioWrtCellStr(saved_screen, saved_lines * saved_cols * 2,
|
103
|
+
0, 0, (HVIO)NULL);
|
104
|
+
#endif
|
105
|
+
free(saved_screen);
|
106
|
+
saved_screen = NULL;
|
107
|
+
}
|
108
|
+
|
109
|
+
reset_shell_mode();
|
110
|
+
|
111
|
+
if (SP->visibility != 1)
|
112
|
+
curs_set(1);
|
113
|
+
|
114
|
+
/* Position cursor to the bottom left of the screen. */
|
115
|
+
|
116
|
+
PDC_gotoyx(PDC_get_rows() - 2, 0);
|
117
|
+
}
|
118
|
+
|
119
|
+
void PDC_scr_free(void)
|
120
|
+
{
|
121
|
+
if (SP)
|
122
|
+
free(SP);
|
123
|
+
if (pdc_atrtab)
|
124
|
+
free(pdc_atrtab);
|
125
|
+
|
126
|
+
pdc_atrtab = (unsigned char *)NULL;
|
127
|
+
}
|
128
|
+
|
129
|
+
/* open the physical screen -- allocate SP, miscellaneous intialization,
|
130
|
+
and may save the existing screen for later restoration */
|
131
|
+
|
132
|
+
int PDC_scr_open(int argc, char **argv)
|
133
|
+
{
|
134
|
+
#ifdef EMXVIDEO
|
135
|
+
int adapter;
|
136
|
+
#else
|
137
|
+
USHORT totchars;
|
138
|
+
#endif
|
139
|
+
int i;
|
140
|
+
short r, g, b;
|
141
|
+
|
142
|
+
PDC_LOG(("PDC_scr_open() - called\n"));
|
143
|
+
|
144
|
+
SP = calloc(1, sizeof(SCREEN));
|
145
|
+
pdc_atrtab = calloc(PDC_COLOR_PAIRS * PDC_OFFSET, 1);
|
146
|
+
|
147
|
+
if (!SP || !pdc_atrtab)
|
148
|
+
return ERR;
|
149
|
+
|
150
|
+
for (i = 0; i < 16; i++)
|
151
|
+
curstoreal[realtocurs[i]] = i;
|
152
|
+
|
153
|
+
#ifdef EMXVIDEO
|
154
|
+
v_init();
|
155
|
+
#endif
|
156
|
+
SP->orig_attr = FALSE;
|
157
|
+
|
158
|
+
#ifdef EMXVIDEO
|
159
|
+
adapter = v_hardware();
|
160
|
+
SP->mono = (adapter == V_MONOCHROME);
|
161
|
+
|
162
|
+
pdc_font = SP->mono ? 14 : (adapter == V_COLOR_8) ? 8 : 12;
|
163
|
+
#else
|
164
|
+
VioGetMode(&scrnmode, 0);
|
165
|
+
PDC_get_keyboard_info();
|
166
|
+
|
167
|
+
pdc_font = _get_font();
|
168
|
+
#endif
|
169
|
+
SP->lines = PDC_get_rows();
|
170
|
+
SP->cols = PDC_get_columns();
|
171
|
+
|
172
|
+
SP->mouse_wait = PDC_CLICK_PERIOD;
|
173
|
+
SP->audible = TRUE;
|
174
|
+
|
175
|
+
/* This code for preserving the current screen */
|
176
|
+
|
177
|
+
if (getenv("PDC_RESTORE_SCREEN"))
|
178
|
+
{
|
179
|
+
saved_lines = SP->lines;
|
180
|
+
saved_cols = SP->cols;
|
181
|
+
|
182
|
+
saved_screen = malloc(2 * saved_lines * saved_cols);
|
183
|
+
|
184
|
+
if (!saved_screen)
|
185
|
+
{
|
186
|
+
SP->_preserve = FALSE;
|
187
|
+
return OK;
|
188
|
+
}
|
189
|
+
#ifdef EMXVIDEO
|
190
|
+
v_getline(saved_screen, 0, 0, saved_lines * saved_cols);
|
191
|
+
#else
|
192
|
+
totchars = saved_lines * saved_cols * 2;
|
193
|
+
VioReadCellStr((PCH)saved_screen, &totchars, 0, 0, (HVIO)NULL);
|
194
|
+
#endif
|
195
|
+
}
|
196
|
+
|
197
|
+
SP->_preserve = (getenv("PDC_PRESERVE_SCREEN") != NULL);
|
198
|
+
|
199
|
+
can_change = (PDC_color_content(0, &r, &g, &b) == OK);
|
200
|
+
|
201
|
+
return OK;
|
202
|
+
}
|
203
|
+
|
204
|
+
/* the core of resize_term() */
|
205
|
+
|
206
|
+
int PDC_resize_screen(int nlines, int ncols)
|
207
|
+
{
|
208
|
+
#ifndef EMXVIDEO
|
209
|
+
VIOMODEINFO modeInfo = {0};
|
210
|
+
USHORT result;
|
211
|
+
#endif
|
212
|
+
|
213
|
+
PDC_LOG(("PDC_resize_screen() - called. Lines: %d Cols: %d\n",
|
214
|
+
nlines, ncols));
|
215
|
+
|
216
|
+
if( !stdscr) /* window hasn't been created yet; we're */
|
217
|
+
{ /* specifying its size before doing so */
|
218
|
+
return OK; /* ...which doesn't work (yet) on Win32 */
|
219
|
+
}
|
220
|
+
#ifdef EMXVIDEO
|
221
|
+
return ERR;
|
222
|
+
#else
|
223
|
+
modeInfo.cb = sizeof(modeInfo);
|
224
|
+
|
225
|
+
/* set most parameters of modeInfo */
|
226
|
+
|
227
|
+
VioGetMode(&modeInfo, 0);
|
228
|
+
modeInfo.fbType = 1;
|
229
|
+
modeInfo.row = nlines;
|
230
|
+
modeInfo.col = ncols;
|
231
|
+
result = VioSetMode(&modeInfo, 0);
|
232
|
+
|
233
|
+
LINES = PDC_get_rows();
|
234
|
+
COLS = PDC_get_columns();
|
235
|
+
|
236
|
+
return (result == 0) ? OK : ERR;
|
237
|
+
#endif
|
238
|
+
}
|
239
|
+
|
240
|
+
void PDC_reset_prog_mode(void)
|
241
|
+
{
|
242
|
+
PDC_LOG(("PDC_reset_prog_mode() - called.\n"));
|
243
|
+
|
244
|
+
#ifndef EMXVIDEO
|
245
|
+
PDC_set_keyboard_binary(TRUE);
|
246
|
+
#endif
|
247
|
+
}
|
248
|
+
|
249
|
+
void PDC_reset_shell_mode(void)
|
250
|
+
{
|
251
|
+
PDC_LOG(("PDC_reset_shell_mode() - called.\n"));
|
252
|
+
|
253
|
+
#ifndef EMXVIDEO
|
254
|
+
PDC_set_keyboard_default();
|
255
|
+
#endif
|
256
|
+
}
|
257
|
+
|
258
|
+
#ifndef EMXVIDEO
|
259
|
+
|
260
|
+
static bool _screen_mode_equals(VIOMODEINFO *oldmode)
|
261
|
+
{
|
262
|
+
VIOMODEINFO current = {0};
|
263
|
+
|
264
|
+
VioGetMode(¤t, 0);
|
265
|
+
|
266
|
+
return ((current.cb == oldmode->cb) &&
|
267
|
+
(current.fbType == oldmode->fbType) &&
|
268
|
+
(current.color == oldmode->color) &&
|
269
|
+
(current.col == oldmode->col) &&
|
270
|
+
(current.row == oldmode->row) &&
|
271
|
+
(current.hres == oldmode->vres) &&
|
272
|
+
(current.vres == oldmode->vres));
|
273
|
+
}
|
274
|
+
|
275
|
+
#endif
|
276
|
+
|
277
|
+
void PDC_restore_screen_mode(int i)
|
278
|
+
{
|
279
|
+
#ifndef EMXVIDEO
|
280
|
+
if (i >= 0 && i <= 2)
|
281
|
+
{
|
282
|
+
pdc_font = _get_font();
|
283
|
+
_set_font(saved_font[i]);
|
284
|
+
|
285
|
+
if (!_screen_mode_equals(&saved_scrnmode[i]))
|
286
|
+
if (VioSetMode(&saved_scrnmode[i], 0) != 0)
|
287
|
+
{
|
288
|
+
pdc_font = _get_font();
|
289
|
+
scrnmode = saved_scrnmode[i];
|
290
|
+
LINES = PDC_get_rows();
|
291
|
+
COLS = PDC_get_columns();
|
292
|
+
}
|
293
|
+
}
|
294
|
+
#endif
|
295
|
+
}
|
296
|
+
|
297
|
+
void PDC_save_screen_mode(int i)
|
298
|
+
{
|
299
|
+
#ifndef EMXVIDEO
|
300
|
+
if (i >= 0 && i <= 2)
|
301
|
+
{
|
302
|
+
saved_font[i] = pdc_font;
|
303
|
+
saved_scrnmode[i] = scrnmode;
|
304
|
+
}
|
305
|
+
#endif
|
306
|
+
}
|
307
|
+
|
308
|
+
void PDC_init_pair(short pair, short fg, short bg)
|
309
|
+
{
|
310
|
+
unsigned char att, temp_bg;
|
311
|
+
chtype i;
|
312
|
+
|
313
|
+
fg = curstoreal[fg];
|
314
|
+
bg = curstoreal[bg];
|
315
|
+
|
316
|
+
for (i = 0; i < PDC_OFFSET; i++)
|
317
|
+
{
|
318
|
+
att = fg | (bg << 4);
|
319
|
+
|
320
|
+
if (i & (A_REVERSE >> PDC_ATTR_SHIFT))
|
321
|
+
att = bg | (fg << 4);
|
322
|
+
if (i & (A_UNDERLINE >> PDC_ATTR_SHIFT))
|
323
|
+
att = 1;
|
324
|
+
if (i & (A_INVIS >> PDC_ATTR_SHIFT))
|
325
|
+
{
|
326
|
+
temp_bg = att >> 4;
|
327
|
+
att = temp_bg << 4 | temp_bg;
|
328
|
+
}
|
329
|
+
if (i & (A_BOLD >> PDC_ATTR_SHIFT))
|
330
|
+
att |= 8;
|
331
|
+
if (i & (A_BLINK >> PDC_ATTR_SHIFT))
|
332
|
+
att |= 128;
|
333
|
+
|
334
|
+
pdc_atrtab[pair * PDC_OFFSET + i] = att;
|
335
|
+
}
|
336
|
+
}
|
337
|
+
|
338
|
+
int PDC_pair_content(short pair, short *fg, short *bg)
|
339
|
+
{
|
340
|
+
*fg = realtocurs[pdc_atrtab[pair * PDC_OFFSET] & 0x0F];
|
341
|
+
*bg = realtocurs[(pdc_atrtab[pair * PDC_OFFSET] & 0xF0) >> 4];
|
342
|
+
|
343
|
+
return OK;
|
344
|
+
}
|
345
|
+
|
346
|
+
bool PDC_can_change_color(void)
|
347
|
+
{
|
348
|
+
return can_change;
|
349
|
+
}
|
350
|
+
|
351
|
+
int PDC_color_content(short color, short *red, short *green, short *blue)
|
352
|
+
{
|
353
|
+
#ifdef PDCTHUNK
|
354
|
+
THUNKEDVIO vcr;
|
355
|
+
USHORT palbuf[4];
|
356
|
+
unsigned char pal[3];
|
357
|
+
int rc;
|
358
|
+
|
359
|
+
/* Read single DAC register */
|
360
|
+
|
361
|
+
palbuf[0] = 8;
|
362
|
+
palbuf[1] = 0;
|
363
|
+
palbuf[2] = curstoreal[color];
|
364
|
+
|
365
|
+
rc = VioGetState(&palbuf, 0);
|
366
|
+
if (rc)
|
367
|
+
return ERR;
|
368
|
+
|
369
|
+
vcr.cb = sizeof(vcr);
|
370
|
+
vcr.type = 3;
|
371
|
+
vcr.firstcolorreg = palbuf[3];
|
372
|
+
vcr.numcolorregs = 1;
|
373
|
+
vcr.colorregaddr = PDCTHUNK(pal);
|
374
|
+
|
375
|
+
rc = VioGetState(&vcr, 0);
|
376
|
+
if (rc)
|
377
|
+
return ERR;
|
378
|
+
|
379
|
+
/* Scale and store */
|
380
|
+
|
381
|
+
*red = DIVROUND((unsigned)(pal[0]) * 1000, 63);
|
382
|
+
*green = DIVROUND((unsigned)(pal[1]) * 1000, 63);
|
383
|
+
*blue = DIVROUND((unsigned)(pal[2]) * 1000, 63);
|
384
|
+
|
385
|
+
return OK;
|
386
|
+
#else
|
387
|
+
return ERR;
|
388
|
+
#endif
|
389
|
+
}
|
390
|
+
|
391
|
+
int PDC_init_color(short color, short red, short green, short blue)
|
392
|
+
{
|
393
|
+
#ifdef PDCTHUNK
|
394
|
+
THUNKEDVIO vcr;
|
395
|
+
USHORT palbuf[4];
|
396
|
+
unsigned char pal[3];
|
397
|
+
int rc;
|
398
|
+
|
399
|
+
/* Scale */
|
400
|
+
|
401
|
+
pal[0] = DIVROUND((unsigned)red * 63, 1000);
|
402
|
+
pal[1] = DIVROUND((unsigned)green * 63, 1000);
|
403
|
+
pal[2] = DIVROUND((unsigned)blue * 63, 1000);
|
404
|
+
|
405
|
+
/* Set single DAC register */
|
406
|
+
|
407
|
+
palbuf[0] = 8;
|
408
|
+
palbuf[1] = 0;
|
409
|
+
palbuf[2] = curstoreal[color];
|
410
|
+
|
411
|
+
rc = VioGetState(&palbuf, 0);
|
412
|
+
if (rc)
|
413
|
+
return ERR;
|
414
|
+
|
415
|
+
vcr.cb = sizeof(vcr);
|
416
|
+
vcr.type = 3;
|
417
|
+
vcr.firstcolorreg = palbuf[3];
|
418
|
+
vcr.numcolorregs = 1;
|
419
|
+
vcr.colorregaddr = PDCTHUNK(pal);
|
420
|
+
|
421
|
+
rc = VioSetState(&vcr, 0);
|
422
|
+
|
423
|
+
return rc ? ERR : OK;
|
424
|
+
#else
|
425
|
+
return ERR;
|
426
|
+
#endif
|
427
|
+
}
|
428
|
+
|
429
|
+
/* Does nothing in the DOS (or OS/2 or Win32 console) flavors of PDCurses,
|
430
|
+
which lack user resizing. See X11 or Win32a versions of this function for
|
431
|
+
details of what it does on platforms that do support user resizing. */
|
432
|
+
|
433
|
+
void PDC_set_resize_limits( const int new_min_lines, const int new_max_lines,
|
434
|
+
const int new_min_cols, const int new_max_cols)
|
435
|
+
{
|
436
|
+
}
|
437
|
+
|
438
|
+
/* PDC_set_function_key() does nothing on this platform */
|
439
|
+
int PDC_set_function_key( const unsigned function, const int new_key)
|
440
|
+
{
|
441
|
+
int old_key = -1;
|
442
|
+
|
443
|
+
if( function < PDC_MAX_FUNCTION_KEYS)
|
444
|
+
{
|
445
|
+
old_key = PDC_shutdown_key[function];
|
446
|
+
PDC_shutdown_key[function] = new_key;
|
447
|
+
}
|
448
|
+
return( old_key);
|
449
|
+
}
|