curses 1.4.4 → 1.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +6 -0
- data/.github/workflows/macos.yml +1 -1
- data/.github/workflows/push_gem.yml +48 -0
- data/.github/workflows/ubuntu.yml +2 -2
- data/.github/workflows/windows.yml +2 -2
- data/History.md +23 -0
- data/README.md +7 -0
- data/curses.gemspec +1 -1
- data/ext/curses/curses.c +7 -7
- data/sample/colors.rb +6 -1
- data/sample/form.rb +1 -1
- data/sample/menu.rb +2 -0
- metadata +9 -251
- data/vendor/PDCurses/.gitignore +0 -47
- data/vendor/PDCurses/.travis.yml +0 -49
- data/vendor/PDCurses/CMakeLists.txt +0 -68
- data/vendor/PDCurses/HISTORY.md +0 -2036
- data/vendor/PDCurses/IMPLEMNT.md +0 -327
- data/vendor/PDCurses/Makefile +0 -27
- data/vendor/PDCurses/README.md +0 -77
- data/vendor/PDCurses/acs_defs.h +0 -265
- data/vendor/PDCurses/appveyor.yml +0 -218
- data/vendor/PDCurses/cmake/README.md +0 -71
- data/vendor/PDCurses/cmake/build_dependencies.cmake +0 -178
- data/vendor/PDCurses/cmake/build_options.cmake +0 -25
- data/vendor/PDCurses/cmake/dll_version.cmake +0 -26
- data/vendor/PDCurses/cmake/gen_config_header.cmake +0 -43
- data/vendor/PDCurses/cmake/get_version.cmake +0 -17
- data/vendor/PDCurses/cmake/make_uninstall.cmake +0 -19
- data/vendor/PDCurses/cmake/project_common.cmake +0 -121
- data/vendor/PDCurses/cmake/resource.in.cmake +0 -52
- data/vendor/PDCurses/cmake/sdl2_ttf/CMakeLists.txt +0 -83
- data/vendor/PDCurses/cmake/target_arch.cmake +0 -36
- data/vendor/PDCurses/cmake/version.in.cmake +0 -73
- data/vendor/PDCurses/cmake/watcom_open_dos16_toolchain.cmake +0 -96
- data/vendor/PDCurses/cmake/watcom_open_dos32_toolchain.cmake +0 -106
- data/vendor/PDCurses/cmake/watcom_open_os2v2_toolchain.cmake +0 -105
- data/vendor/PDCurses/curses.h +0 -1846
- data/vendor/PDCurses/curspriv.h +0 -134
- data/vendor/PDCurses/demos/README.md +0 -25
- data/vendor/PDCurses/demos/firework.c +0 -144
- data/vendor/PDCurses/demos/newtest.c +0 -581
- data/vendor/PDCurses/demos/ozdemo.c +0 -447
- data/vendor/PDCurses/demos/ptest.c +0 -283
- data/vendor/PDCurses/demos/rain.c +0 -157
- data/vendor/PDCurses/demos/testcurs.c +0 -1607
- data/vendor/PDCurses/demos/tui.c +0 -1048
- data/vendor/PDCurses/demos/tui.h +0 -65
- data/vendor/PDCurses/demos/tuidemo.c +0 -233
- data/vendor/PDCurses/demos/version.c +0 -61
- data/vendor/PDCurses/demos/worm.c +0 -432
- data/vendor/PDCurses/demos/xmas.c +0 -955
- data/vendor/PDCurses/dos/CMakeLists.txt +0 -47
- data/vendor/PDCurses/dos/Makefile +0 -105
- data/vendor/PDCurses/dos/Makefile.bcc +0 -83
- data/vendor/PDCurses/dos/Makefile.dmc +0 -257
- data/vendor/PDCurses/dos/Makefile.msc +0 -113
- data/vendor/PDCurses/dos/Makefile.wcc +0 -107
- data/vendor/PDCurses/dos/README.md +0 -51
- data/vendor/PDCurses/dos/bccdos.lrf +0 -9
- data/vendor/PDCurses/dos/mscdos.lrf +0 -50
- data/vendor/PDCurses/dos/pdcclip.c +0 -132
- data/vendor/PDCurses/dos/pdcdisp.c +0 -135
- data/vendor/PDCurses/dos/pdcdos.h +0 -194
- data/vendor/PDCurses/dos/pdcgetsc.c +0 -98
- data/vendor/PDCurses/dos/pdckbd.c +0 -513
- data/vendor/PDCurses/dos/pdcscrn.c +0 -785
- data/vendor/PDCurses/dos/pdcsetsc.c +0 -101
- data/vendor/PDCurses/dos/pdcutil.c +0 -212
- data/vendor/PDCurses/libobjs.mif +0 -26
- data/vendor/PDCurses/makedist.mif +0 -20
- data/vendor/PDCurses/man/Makefile +0 -37
- data/vendor/PDCurses/man/README.md +0 -21
- data/vendor/PDCurses/man/intro.md +0 -361
- data/vendor/PDCurses/man/manext.c +0 -119
- data/vendor/PDCurses/man/sdl.md +0 -152
- data/vendor/PDCurses/man/sdl2.md +0 -58
- data/vendor/PDCurses/man/x11.md +0 -407
- data/vendor/PDCurses/ncurses/CMakeLists.txt +0 -66
- data/vendor/PDCurses/ncurses/README.md +0 -26
- data/vendor/PDCurses/ncurses/makefile +0 -29
- data/vendor/PDCurses/os2/CMakeLists.txt +0 -41
- data/vendor/PDCurses/os2/Makefile +0 -132
- data/vendor/PDCurses/os2/Makefile.bcc +0 -90
- data/vendor/PDCurses/os2/Makefile.wcc +0 -43
- data/vendor/PDCurses/os2/README.md +0 -43
- data/vendor/PDCurses/os2/iccos2.lrf +0 -50
- data/vendor/PDCurses/os2/iccos2.mak +0 -256
- data/vendor/PDCurses/os2/pdcclip.c +0 -188
- data/vendor/PDCurses/os2/pdcdisp.c +0 -93
- data/vendor/PDCurses/os2/pdcgetsc.c +0 -89
- data/vendor/PDCurses/os2/pdckbd.c +0 -521
- data/vendor/PDCurses/os2/pdcos2.h +0 -55
- data/vendor/PDCurses/os2/pdcscrn.c +0 -449
- data/vendor/PDCurses/os2/pdcsetsc.c +0 -112
- data/vendor/PDCurses/os2/pdcutil.c +0 -52
- data/vendor/PDCurses/panel.h +0 -56
- data/vendor/PDCurses/pdcurses/README.md +0 -25
- data/vendor/PDCurses/pdcurses/addch.c +0 -693
- data/vendor/PDCurses/pdcurses/addchstr.c +0 -245
- data/vendor/PDCurses/pdcurses/addstr.c +0 -240
- data/vendor/PDCurses/pdcurses/attr.c +0 -359
- data/vendor/PDCurses/pdcurses/beep.c +0 -68
- data/vendor/PDCurses/pdcurses/bkgd.c +0 -223
- data/vendor/PDCurses/pdcurses/border.c +0 -411
- data/vendor/PDCurses/pdcurses/clear.c +0 -159
- data/vendor/PDCurses/pdcurses/color.c +0 -298
- data/vendor/PDCurses/pdcurses/debug.c +0 -109
- data/vendor/PDCurses/pdcurses/delch.c +0 -96
- data/vendor/PDCurses/pdcurses/deleteln.c +0 -211
- data/vendor/PDCurses/pdcurses/deprec.c +0 -27
- data/vendor/PDCurses/pdcurses/getch.c +0 -417
- data/vendor/PDCurses/pdcurses/getstr.c +0 -474
- data/vendor/PDCurses/pdcurses/getyx.c +0 -139
- data/vendor/PDCurses/pdcurses/inch.c +0 -127
- data/vendor/PDCurses/pdcurses/inchstr.c +0 -214
- data/vendor/PDCurses/pdcurses/initscr.c +0 -367
- data/vendor/PDCurses/pdcurses/inopts.c +0 -324
- data/vendor/PDCurses/pdcurses/insch.c +0 -271
- data/vendor/PDCurses/pdcurses/insstr.c +0 -264
- data/vendor/PDCurses/pdcurses/instr.c +0 -246
- data/vendor/PDCurses/pdcurses/kernel.c +0 -259
- data/vendor/PDCurses/pdcurses/keyname.c +0 -157
- data/vendor/PDCurses/pdcurses/mouse.c +0 -438
- data/vendor/PDCurses/pdcurses/move.c +0 -57
- data/vendor/PDCurses/pdcurses/outopts.c +0 -159
- data/vendor/PDCurses/pdcurses/overlay.c +0 -214
- data/vendor/PDCurses/pdcurses/pad.c +0 -260
- data/vendor/PDCurses/pdcurses/panel.c +0 -633
- data/vendor/PDCurses/pdcurses/printw.c +0 -126
- data/vendor/PDCurses/pdcurses/refresh.c +0 -279
- data/vendor/PDCurses/pdcurses/scanw.c +0 -578
- data/vendor/PDCurses/pdcurses/scr_dump.c +0 -213
- data/vendor/PDCurses/pdcurses/scroll.c +0 -101
- data/vendor/PDCurses/pdcurses/slk.c +0 -591
- data/vendor/PDCurses/pdcurses/termattr.c +0 -182
- data/vendor/PDCurses/pdcurses/terminfo.c +0 -217
- data/vendor/PDCurses/pdcurses/touch.c +0 -163
- data/vendor/PDCurses/pdcurses/util.c +0 -312
- data/vendor/PDCurses/pdcurses/window.c +0 -569
- data/vendor/PDCurses/sdl1/Makefile +0 -129
- data/vendor/PDCurses/sdl1/Makefile.mng +0 -110
- data/vendor/PDCurses/sdl1/README.md +0 -31
- data/vendor/PDCurses/sdl1/deffont.h +0 -385
- data/vendor/PDCurses/sdl1/deficon.h +0 -23
- data/vendor/PDCurses/sdl1/pdcclip.c +0 -131
- data/vendor/PDCurses/sdl1/pdcdisp.c +0 -373
- data/vendor/PDCurses/sdl1/pdcgetsc.c +0 -30
- data/vendor/PDCurses/sdl1/pdckbd.c +0 -405
- data/vendor/PDCurses/sdl1/pdcscrn.c +0 -414
- data/vendor/PDCurses/sdl1/pdcsdl.h +0 -31
- data/vendor/PDCurses/sdl1/pdcsetsc.c +0 -64
- data/vendor/PDCurses/sdl1/pdcutil.c +0 -40
- data/vendor/PDCurses/sdl1/sdltest.c +0 -79
- data/vendor/PDCurses/sdl2/CMakeLists.txt +0 -76
- data/vendor/PDCurses/sdl2/Makefile +0 -135
- data/vendor/PDCurses/sdl2/Makefile.vc +0 -164
- data/vendor/PDCurses/sdl2/README.md +0 -34
- data/vendor/PDCurses/sdl2/deffont.h +0 -385
- data/vendor/PDCurses/sdl2/deficon.h +0 -23
- data/vendor/PDCurses/sdl2/pdcclip.c +0 -93
- data/vendor/PDCurses/sdl2/pdcdisp.c +0 -534
- data/vendor/PDCurses/sdl2/pdcgetsc.c +0 -30
- data/vendor/PDCurses/sdl2/pdckbd.c +0 -480
- data/vendor/PDCurses/sdl2/pdcscrn.c +0 -443
- data/vendor/PDCurses/sdl2/pdcsdl.h +0 -33
- data/vendor/PDCurses/sdl2/pdcsetsc.c +0 -67
- data/vendor/PDCurses/sdl2/pdcutil.c +0 -39
- data/vendor/PDCurses/sdl2/sdltest.c +0 -81
- data/vendor/PDCurses/term.h +0 -48
- data/vendor/PDCurses/version.mif +0 -7
- data/vendor/PDCurses/vt/CMakeLists.txt +0 -28
- data/vendor/PDCurses/vt/Makefile +0 -135
- data/vendor/PDCurses/vt/Makefile.bcc +0 -111
- data/vendor/PDCurses/vt/Makefile.dmc +0 -258
- data/vendor/PDCurses/vt/Makefile.vc +0 -144
- data/vendor/PDCurses/vt/Makefile.wcc +0 -107
- data/vendor/PDCurses/vt/README.md +0 -64
- data/vendor/PDCurses/vt/pdcclip.c +0 -20
- data/vendor/PDCurses/vt/pdcdisp.c +0 -284
- data/vendor/PDCurses/vt/pdcgetsc.c +0 -27
- data/vendor/PDCurses/vt/pdckbd.c +0 -394
- data/vendor/PDCurses/vt/pdcscrn.c +0 -434
- data/vendor/PDCurses/vt/pdcsetsc.c +0 -45
- data/vendor/PDCurses/vt/pdcutil.c +0 -43
- data/vendor/PDCurses/vt/pdcvt.h +0 -16
- data/vendor/PDCurses/watcom.mif +0 -68
- data/vendor/PDCurses/wincon/CMakeLists.txt +0 -27
- data/vendor/PDCurses/wincon/Makefile.bcc +0 -88
- data/vendor/PDCurses/wincon/Makefile.dmc +0 -256
- data/vendor/PDCurses/wincon/Makefile.lcc +0 -273
- data/vendor/PDCurses/wincon/Makefile.mng +0 -176
- data/vendor/PDCurses/wincon/Makefile.vc +0 -144
- data/vendor/PDCurses/wincon/Makefile.wcc +0 -51
- data/vendor/PDCurses/wincon/README.md +0 -85
- data/vendor/PDCurses/wincon/pdcclip.c +0 -174
- data/vendor/PDCurses/wincon/pdcdisp.c +0 -143
- data/vendor/PDCurses/wincon/pdcgetsc.c +0 -55
- data/vendor/PDCurses/wincon/pdckbd.c +0 -786
- data/vendor/PDCurses/wincon/pdcscrn.c +0 -717
- data/vendor/PDCurses/wincon/pdcsetsc.c +0 -91
- data/vendor/PDCurses/wincon/pdcurses.ico +0 -0
- data/vendor/PDCurses/wincon/pdcurses.rc +0 -28
- data/vendor/PDCurses/wincon/pdcutil.c +0 -41
- data/vendor/PDCurses/wincon/pdcwin.h +0 -31
- data/vendor/PDCurses/wingui/CMakeLists.txt +0 -27
- data/vendor/PDCurses/wingui/Makefile.bcc +0 -85
- data/vendor/PDCurses/wingui/Makefile.dmc +0 -259
- data/vendor/PDCurses/wingui/Makefile.lcc +0 -273
- data/vendor/PDCurses/wingui/Makefile.mng +0 -171
- data/vendor/PDCurses/wingui/Makefile.vc +0 -144
- data/vendor/PDCurses/wingui/Makefile.wcc +0 -51
- data/vendor/PDCurses/wingui/README.md +0 -93
- data/vendor/PDCurses/wingui/pdcclip.c +0 -174
- data/vendor/PDCurses/wingui/pdcdisp.c +0 -718
- data/vendor/PDCurses/wingui/pdcgetsc.c +0 -30
- data/vendor/PDCurses/wingui/pdckbd.c +0 -143
- data/vendor/PDCurses/wingui/pdcscrn.c +0 -2797
- data/vendor/PDCurses/wingui/pdcsetsc.c +0 -89
- data/vendor/PDCurses/wingui/pdcurses.ico +0 -0
- data/vendor/PDCurses/wingui/pdcurses.rc +0 -28
- data/vendor/PDCurses/wingui/pdcutil.c +0 -61
- data/vendor/PDCurses/wingui/pdcwin.h +0 -122
- data/vendor/PDCurses/x11/Makefile.in +0 -754
- data/vendor/PDCurses/x11/PDCurses.spec +0 -82
- data/vendor/PDCurses/x11/README.md +0 -62
- data/vendor/PDCurses/x11/ScrollBox.c +0 -319
- data/vendor/PDCurses/x11/ScrollBox.h +0 -51
- data/vendor/PDCurses/x11/ScrollBoxP.h +0 -70
- data/vendor/PDCurses/x11/aclocal.m4 +0 -994
- data/vendor/PDCurses/x11/big_icon.xbm +0 -46
- data/vendor/PDCurses/x11/compose.h +0 -201
- data/vendor/PDCurses/x11/config.guess +0 -1500
- data/vendor/PDCurses/x11/config.h.in +0 -100
- data/vendor/PDCurses/x11/config.sub +0 -1616
- data/vendor/PDCurses/x11/configure +0 -6700
- data/vendor/PDCurses/x11/configure.ac +0 -295
- data/vendor/PDCurses/x11/debian/changelog +0 -6
- data/vendor/PDCurses/x11/debian/compat +0 -1
- data/vendor/PDCurses/x11/debian/control +0 -11
- data/vendor/PDCurses/x11/debian/copyright +0 -27
- data/vendor/PDCurses/x11/debian/rules +0 -98
- data/vendor/PDCurses/x11/install-sh +0 -253
- data/vendor/PDCurses/x11/little_icon.xbm +0 -14
- data/vendor/PDCurses/x11/ncurses_cfg.h +0 -45
- data/vendor/PDCurses/x11/pdcclip.c +0 -173
- data/vendor/PDCurses/x11/pdcdisp.c +0 -85
- data/vendor/PDCurses/x11/pdcgetsc.c +0 -28
- data/vendor/PDCurses/x11/pdckbd.c +0 -104
- data/vendor/PDCurses/x11/pdcscrn.c +0 -258
- data/vendor/PDCurses/x11/pdcsetsc.c +0 -95
- data/vendor/PDCurses/x11/pdcutil.c +0 -52
- data/vendor/PDCurses/x11/pdcx11.c +0 -316
- data/vendor/PDCurses/x11/pdcx11.h +0 -191
- data/vendor/PDCurses/x11/sb.c +0 -155
- data/vendor/PDCurses/x11/x11.c +0 -3686
- data/vendor/PDCurses/x11/xcurses-config.in +0 -81
@@ -1,95 +0,0 @@
|
|
1
|
-
/* Public Domain Curses */
|
2
|
-
|
3
|
-
#include "pdcx11.h"
|
4
|
-
|
5
|
-
#include <string.h>
|
6
|
-
|
7
|
-
/*man-start**************************************************************
|
8
|
-
|
9
|
-
pdcsetsc
|
10
|
-
--------
|
11
|
-
|
12
|
-
### Synopsis
|
13
|
-
|
14
|
-
int PDC_set_blink(bool blinkon);
|
15
|
-
void PDC_set_title(const char *title);
|
16
|
-
|
17
|
-
### Description
|
18
|
-
|
19
|
-
PDC_set_blink() toggles whether the A_BLINK attribute sets an
|
20
|
-
actual blink mode (TRUE), or sets the background color to high
|
21
|
-
intensity (FALSE). The default is platform-dependent (FALSE in
|
22
|
-
most cases). It returns OK if it could set the state to match
|
23
|
-
the given parameter, ERR otherwise. Current platforms also
|
24
|
-
adjust the value of COLORS according to this function -- 16 for
|
25
|
-
FALSE, and 8 for TRUE.
|
26
|
-
|
27
|
-
PDC_set_title() sets the title of the window in which the curses
|
28
|
-
program is running. This function may not do anything on some
|
29
|
-
platforms. (Currently it only works in Win32 and X11.)
|
30
|
-
|
31
|
-
### Portability
|
32
|
-
X/Open BSD SYS V
|
33
|
-
PDC_set_blink - - -
|
34
|
-
PDC_set_title - - -
|
35
|
-
|
36
|
-
**man-end****************************************************************/
|
37
|
-
|
38
|
-
int PDC_curs_set(int visibility)
|
39
|
-
{
|
40
|
-
int ret_vis = SP->visibility;
|
41
|
-
|
42
|
-
PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility));
|
43
|
-
|
44
|
-
if (visibility != -1)
|
45
|
-
SP->visibility = visibility;
|
46
|
-
|
47
|
-
PDC_display_cursor(SP->cursrow, SP->curscol, SP->cursrow,
|
48
|
-
SP->curscol, visibility);
|
49
|
-
|
50
|
-
return ret_vis;
|
51
|
-
}
|
52
|
-
|
53
|
-
void PDC_set_title(const char *title)
|
54
|
-
{
|
55
|
-
int len;
|
56
|
-
|
57
|
-
PDC_LOG(("PDC_set_title() - called:<%s>\n", title));
|
58
|
-
|
59
|
-
len = strlen(title) + 1; /* write nul character */
|
60
|
-
|
61
|
-
XCursesInstruct(CURSES_TITLE);
|
62
|
-
|
63
|
-
if (XC_write_display_socket_int(len) >= 0)
|
64
|
-
if (XC_write_socket(xc_display_sock, title, len) >= 0)
|
65
|
-
return;
|
66
|
-
|
67
|
-
XCursesExitCursesProcess(1, "exiting from PDC_set_title");
|
68
|
-
}
|
69
|
-
|
70
|
-
/* If PDC_really_blinking is TRUE, then text with the A_BLINK */
|
71
|
-
/* attribute will actually blink. Otherwise, such text will */
|
72
|
-
/* be shown with higher color intensity (the R, G, and B values */
|
73
|
-
/* are averaged with pure white). See pdcdisp.c for details of */
|
74
|
-
/* how this is done. */
|
75
|
-
/* Unlike on other PDCurses platforms, this doesn't require */
|
76
|
-
/* decreasing the number of colors by half. Also, the choice */
|
77
|
-
/* indicated by 'blinkon' will actually be respected, so OK is */
|
78
|
-
/* always returned (most platforms don't actually support */
|
79
|
-
/* blinking). */
|
80
|
-
/* The default behavior is to not show A_BLINK text as */
|
81
|
-
/* blinking, i.e., PDC_really_blinking = FALSE. Blinking text */
|
82
|
-
/* can be pretty annoying to some people. You should probably */
|
83
|
-
/* call PDC_set_blink( TRUE) only if there is something to which */
|
84
|
-
/* the user _must_ pay attention; say, "the nuclear reactor */
|
85
|
-
/* is about to melt down". Otherwise, the bolder, brighter */
|
86
|
-
/* text should be attention-getting enough. */
|
87
|
-
|
88
|
-
int PDC_set_blink(bool blinkon)
|
89
|
-
{
|
90
|
-
if (pdc_color_started) /* We've got 256 colors in this version */
|
91
|
-
COLORS = 256;
|
92
|
-
|
93
|
-
XCursesInstruct( blinkon ? CURSES_BLINK_ON : CURSES_BLINK_OFF);
|
94
|
-
return OK;
|
95
|
-
}
|
@@ -1,52 +0,0 @@
|
|
1
|
-
/* Public Domain Curses */
|
2
|
-
|
3
|
-
#include "pdcx11.h"
|
4
|
-
|
5
|
-
#if defined(HAVE_POLL) && !defined(HAVE_USLEEP)
|
6
|
-
# include <poll.h>
|
7
|
-
#endif
|
8
|
-
|
9
|
-
void PDC_beep(void)
|
10
|
-
{
|
11
|
-
PDC_LOG(("PDC_beep() - called\n"));
|
12
|
-
|
13
|
-
XCursesInstruct(CURSES_BELL);
|
14
|
-
}
|
15
|
-
|
16
|
-
void PDC_napms(int ms)
|
17
|
-
{
|
18
|
-
PDC_LOG(("PDC_napms() - called: ms=%d\n", ms));
|
19
|
-
|
20
|
-
#if defined(HAVE_USLEEP)
|
21
|
-
|
22
|
-
usleep(1000 * ms);
|
23
|
-
|
24
|
-
#elif defined(HAVE_POLL)
|
25
|
-
{
|
26
|
-
struct pollfd fd;
|
27
|
-
fd.fd = -1;
|
28
|
-
fd.events = 0;
|
29
|
-
poll(&fd, 1, ms);
|
30
|
-
}
|
31
|
-
#endif
|
32
|
-
}
|
33
|
-
|
34
|
-
const char *PDC_sysname(void)
|
35
|
-
{
|
36
|
-
return "X11";
|
37
|
-
}
|
38
|
-
|
39
|
-
PDC_version_info PDC_version = { PDC_PORT_WINGUI,
|
40
|
-
PDC_VER_MAJOR, PDC_VER_MINOR, PDC_VER_CHANGE,
|
41
|
-
sizeof( chtype),
|
42
|
-
#ifdef PDC_WIDE
|
43
|
-
TRUE,
|
44
|
-
#else
|
45
|
-
FALSE,
|
46
|
-
#endif
|
47
|
-
#ifdef PDC_FORCE_UTF8
|
48
|
-
TRUE,
|
49
|
-
#else
|
50
|
-
FALSE,
|
51
|
-
#endif
|
52
|
-
};
|
@@ -1,316 +0,0 @@
|
|
1
|
-
/* Public Domain Curses */
|
2
|
-
|
3
|
-
#include "pdcx11.h"
|
4
|
-
|
5
|
-
#include <errno.h>
|
6
|
-
#include <stdlib.h>
|
7
|
-
|
8
|
-
/*** Functions that are called by both processes ***/
|
9
|
-
|
10
|
-
unsigned char *Xcurscr;
|
11
|
-
|
12
|
-
int XCursesProcess = 1;
|
13
|
-
int shmidSP;
|
14
|
-
int shmid_Xcurscr;
|
15
|
-
int shmkeySP;
|
16
|
-
int shmkey_Xcurscr;
|
17
|
-
int xc_otherpid;
|
18
|
-
int XCursesLINES = 24;
|
19
|
-
int XCursesCOLS = 80;
|
20
|
-
int xc_display_sock;
|
21
|
-
int xc_key_sock;
|
22
|
-
int xc_display_sockets[2];
|
23
|
-
int xc_key_sockets[2];
|
24
|
-
int xc_exit_sock;
|
25
|
-
|
26
|
-
fd_set xc_readfds;
|
27
|
-
|
28
|
-
static void _dummy_function(void)
|
29
|
-
{
|
30
|
-
PDC_napms( 1);
|
31
|
-
}
|
32
|
-
|
33
|
-
void XC_get_line_lock(int row)
|
34
|
-
{
|
35
|
-
/* loop until we can write to the line -- Patch by:
|
36
|
-
Georg Fuchs, georg.fuchs@rz.uni-regensburg.de */
|
37
|
-
|
38
|
-
while (*(Xcurscr + XCURSCR_FLAG_OFF + row))
|
39
|
-
_dummy_function();
|
40
|
-
|
41
|
-
*(Xcurscr + XCURSCR_FLAG_OFF + row) = 1;
|
42
|
-
}
|
43
|
-
|
44
|
-
void XC_release_line_lock(int row)
|
45
|
-
{
|
46
|
-
*(Xcurscr + XCURSCR_FLAG_OFF + row) = 0;
|
47
|
-
}
|
48
|
-
|
49
|
-
int XC_write_socket(int sock_num, const void *buf, int len)
|
50
|
-
{
|
51
|
-
int start = 0, rc;
|
52
|
-
|
53
|
-
PDC_LOG(("%s:XC_write_socket called: sock_num %d len %d\n",
|
54
|
-
XCLOGMSG, sock_num, len));
|
55
|
-
|
56
|
-
#ifdef MOUSE_DEBUG
|
57
|
-
if (sock_num == xc_key_sock)
|
58
|
-
printf("%s:XC_write_socket(key) len: %d\n", XCLOGMSG, len);
|
59
|
-
#endif
|
60
|
-
while (1)
|
61
|
-
{
|
62
|
-
rc = write(sock_num, (const char *)buf + start, len);
|
63
|
-
|
64
|
-
if (rc < 0 || rc == len)
|
65
|
-
return rc;
|
66
|
-
|
67
|
-
len -= rc;
|
68
|
-
start = rc;
|
69
|
-
}
|
70
|
-
}
|
71
|
-
|
72
|
-
int XC_read_socket(int sock_num, void *buf, int len)
|
73
|
-
{
|
74
|
-
int start = 0, length = len, rc;
|
75
|
-
|
76
|
-
PDC_LOG(("%s:XC_read_socket called: sock_num %d len %d\n",
|
77
|
-
XCLOGMSG, sock_num, len));
|
78
|
-
|
79
|
-
while (1)
|
80
|
-
{
|
81
|
-
rc = read(sock_num, (char *)buf + start, length);
|
82
|
-
|
83
|
-
#ifdef MOUSE_DEBUG
|
84
|
-
if (sock_num == xc_key_sock)
|
85
|
-
printf("%s:XC_read_socket(key) rc %d errno %d "
|
86
|
-
"resized: %d\n", XCLOGMSG, rc, errno, SP->resized);
|
87
|
-
#endif
|
88
|
-
if (rc < 0 && sock_num == xc_key_sock && errno == EINTR
|
89
|
-
&& SP->resized != FALSE)
|
90
|
-
{
|
91
|
-
MOUSE_LOG(("%s:continuing\n", XCLOGMSG));
|
92
|
-
|
93
|
-
rc = 0;
|
94
|
-
|
95
|
-
if (SP->resized > 1)
|
96
|
-
SP->resized = TRUE;
|
97
|
-
else
|
98
|
-
SP->resized = FALSE;
|
99
|
-
|
100
|
-
memcpy(buf, &rc, sizeof(int));
|
101
|
-
|
102
|
-
return 0;
|
103
|
-
}
|
104
|
-
|
105
|
-
if (rc <= 0 || rc == length)
|
106
|
-
return rc;
|
107
|
-
|
108
|
-
length -= rc;
|
109
|
-
start = rc;
|
110
|
-
}
|
111
|
-
}
|
112
|
-
|
113
|
-
int XC_write_display_socket_int(int x)
|
114
|
-
{
|
115
|
-
return XC_write_socket(xc_display_sock, &x, sizeof(int));
|
116
|
-
}
|
117
|
-
|
118
|
-
#ifdef PDCDEBUG
|
119
|
-
void XC_say(const char *msg)
|
120
|
-
{
|
121
|
-
PDC_LOG(("%s:%s", XCLOGMSG, msg));
|
122
|
-
}
|
123
|
-
#endif
|
124
|
-
|
125
|
-
/*** Functions that are called by the "curses" process ***/
|
126
|
-
|
127
|
-
int XCursesInstruct(int flag)
|
128
|
-
{
|
129
|
-
PDC_LOG(("%s:XCursesInstruct() - called flag %d\n", XCLOGMSG, flag));
|
130
|
-
|
131
|
-
/* Send a request to X */
|
132
|
-
|
133
|
-
if (XC_write_display_socket_int(flag) < 0)
|
134
|
-
XCursesExitCursesProcess(4, "exiting from XCursesInstruct");
|
135
|
-
|
136
|
-
return OK;
|
137
|
-
}
|
138
|
-
|
139
|
-
int XCursesInstructAndWait(int flag)
|
140
|
-
{
|
141
|
-
int result;
|
142
|
-
|
143
|
-
XC_LOG(("XCursesInstructAndWait() - called\n"));
|
144
|
-
|
145
|
-
/* tell X we want to do something */
|
146
|
-
|
147
|
-
XCursesInstruct(flag);
|
148
|
-
|
149
|
-
/* wait for X to say the refresh has occurred*/
|
150
|
-
|
151
|
-
if (XC_read_socket(xc_display_sock, &result, sizeof(int)) < 0)
|
152
|
-
XCursesExitCursesProcess(5, "exiting from XCursesInstructAndWait");
|
153
|
-
|
154
|
-
if (result != CURSES_CONTINUE)
|
155
|
-
XCursesExitCursesProcess(6, "exiting from XCursesInstructAndWait"
|
156
|
-
" - synchronization error");
|
157
|
-
|
158
|
-
return OK;
|
159
|
-
}
|
160
|
-
|
161
|
-
static int _setup_curses(void)
|
162
|
-
{
|
163
|
-
int wait_value;
|
164
|
-
|
165
|
-
XC_LOG(("_setup_curses called\n"));
|
166
|
-
|
167
|
-
close(xc_display_sockets[1]);
|
168
|
-
close(xc_key_sockets[1]);
|
169
|
-
|
170
|
-
xc_display_sock = xc_display_sockets[0];
|
171
|
-
xc_key_sock = xc_key_sockets[0];
|
172
|
-
|
173
|
-
FD_ZERO(&xc_readfds);
|
174
|
-
|
175
|
-
XC_read_socket(xc_display_sock, &wait_value, sizeof(int));
|
176
|
-
|
177
|
-
if (wait_value != CURSES_CHILD)
|
178
|
-
return ERR;
|
179
|
-
|
180
|
-
/* Set LINES and COLS now so that the size of the shared memory
|
181
|
-
segment can be allocated */
|
182
|
-
|
183
|
-
if ((shmidSP = shmget(shmkeySP, sizeof(SCREEN) + XCURSESSHMMIN, 0700)) < 0)
|
184
|
-
{
|
185
|
-
perror("Cannot allocate shared memory for SCREEN");
|
186
|
-
kill(xc_otherpid, SIGKILL);
|
187
|
-
return ERR;
|
188
|
-
}
|
189
|
-
|
190
|
-
SP = (SCREEN*)shmat(shmidSP, 0, 0);
|
191
|
-
|
192
|
-
XCursesLINES = SP->lines;
|
193
|
-
LINES = XCursesLINES - SP->linesrippedoff - SP->slklines;
|
194
|
-
XCursesCOLS = COLS = SP->cols;
|
195
|
-
|
196
|
-
if ((shmid_Xcurscr = shmget(shmkey_Xcurscr,
|
197
|
-
SP->XcurscrSize + XCURSESSHMMIN, 0700)) < 0)
|
198
|
-
{
|
199
|
-
perror("Cannot allocate shared memory for curscr");
|
200
|
-
kill(xc_otherpid, SIGKILL);
|
201
|
-
return ERR;
|
202
|
-
}
|
203
|
-
|
204
|
-
PDC_LOG(("%s:shmid_Xcurscr %d shmkey_Xcurscr %d LINES %d COLS %d\n",
|
205
|
-
XCLOGMSG, shmid_Xcurscr, shmkey_Xcurscr, LINES, COLS));
|
206
|
-
|
207
|
-
Xcurscr = (unsigned char *)shmat(shmid_Xcurscr, 0, 0);
|
208
|
-
xc_atrtab = (short *)(Xcurscr + XCURSCR_ATRTAB_OFF);
|
209
|
-
|
210
|
-
XC_LOG(("cursesprocess exiting from Xinitscr\n"));
|
211
|
-
|
212
|
-
/* Always trap SIGWINCH if the C library supports SIGWINCH */
|
213
|
-
|
214
|
-
XCursesSetSignal(SIGWINCH, XCursesSigwinchHandler);
|
215
|
-
|
216
|
-
atexit(XCursesExit);
|
217
|
-
|
218
|
-
return OK;
|
219
|
-
}
|
220
|
-
|
221
|
-
int XCursesInitscr(int argc, char *argv[])
|
222
|
-
{
|
223
|
-
int pid, rc;
|
224
|
-
|
225
|
-
XC_LOG(("XCursesInitscr() - called\n"));
|
226
|
-
|
227
|
-
shmkeySP = getpid();
|
228
|
-
|
229
|
-
if (socketpair(AF_UNIX, SOCK_STREAM, 0, xc_display_sockets) < 0)
|
230
|
-
{
|
231
|
-
fprintf(stderr, "ERROR: cannot create display socketpair\n");
|
232
|
-
return ERR;
|
233
|
-
}
|
234
|
-
|
235
|
-
if (socketpair(AF_UNIX, SOCK_STREAM, 0, xc_key_sockets) < 0)
|
236
|
-
{
|
237
|
-
fprintf(stderr, "ERROR: cannot create key socketpair\n");
|
238
|
-
return ERR;
|
239
|
-
}
|
240
|
-
|
241
|
-
pid = fork();
|
242
|
-
|
243
|
-
switch(pid)
|
244
|
-
{
|
245
|
-
case -1:
|
246
|
-
fprintf(stderr, "ERROR: cannot fork()\n");
|
247
|
-
return ERR;
|
248
|
-
break;
|
249
|
-
|
250
|
-
case 0: /* child */
|
251
|
-
shmkey_Xcurscr = getpid();
|
252
|
-
#ifdef XISPARENT
|
253
|
-
XCursesProcess = 0;
|
254
|
-
rc = _setup_curses();
|
255
|
-
#else
|
256
|
-
XCursesProcess = 1;
|
257
|
-
xc_otherpid = getppid();
|
258
|
-
rc = XCursesSetupX(argc, argv);
|
259
|
-
#endif
|
260
|
-
break;
|
261
|
-
|
262
|
-
default: /* parent */
|
263
|
-
shmkey_Xcurscr = pid;
|
264
|
-
#ifdef XISPARENT
|
265
|
-
XCursesProcess = 1;
|
266
|
-
xc_otherpid = pid;
|
267
|
-
rc = XCursesSetupX(argc, argv);
|
268
|
-
#else
|
269
|
-
XCursesProcess = 0;
|
270
|
-
rc = _setup_curses();
|
271
|
-
#endif
|
272
|
-
}
|
273
|
-
|
274
|
-
return rc;
|
275
|
-
}
|
276
|
-
|
277
|
-
static void _cleanup_curses_process(int rc)
|
278
|
-
{
|
279
|
-
PDC_LOG(("%s:_cleanup_curses_process() - called: %d\n", XCLOGMSG, rc));
|
280
|
-
|
281
|
-
shutdown(xc_display_sock, 2);
|
282
|
-
close(xc_display_sock);
|
283
|
-
|
284
|
-
shutdown(xc_key_sock, 2);
|
285
|
-
close(xc_key_sock);
|
286
|
-
|
287
|
-
shmdt((char *)SP);
|
288
|
-
shmdt((char *)Xcurscr);
|
289
|
-
|
290
|
-
if (rc)
|
291
|
-
_exit(rc);
|
292
|
-
}
|
293
|
-
|
294
|
-
void XCursesExitCursesProcess(int rc, char *msg)
|
295
|
-
{
|
296
|
-
PDC_LOG(("%s:XCursesExitCursesProcess() - called: %d %s\n",
|
297
|
-
XCLOGMSG, rc, msg));
|
298
|
-
|
299
|
-
endwin();
|
300
|
-
_cleanup_curses_process(rc);
|
301
|
-
}
|
302
|
-
|
303
|
-
void XCursesExit(void)
|
304
|
-
{
|
305
|
-
static bool called = FALSE;
|
306
|
-
|
307
|
-
XC_LOG(("XCursesExit() - called\n"));
|
308
|
-
|
309
|
-
if (FALSE == called)
|
310
|
-
{
|
311
|
-
XCursesInstruct(CURSES_EXIT);
|
312
|
-
_cleanup_curses_process(0);
|
313
|
-
|
314
|
-
called = TRUE;
|
315
|
-
}
|
316
|
-
}
|
@@ -1,191 +0,0 @@
|
|
1
|
-
/* Public Domain Curses */
|
2
|
-
|
3
|
-
#ifdef HAVE_CONFIG_H
|
4
|
-
# include "config.h"
|
5
|
-
#endif
|
6
|
-
|
7
|
-
#include <curspriv.h>
|
8
|
-
|
9
|
-
#ifdef HAVE_UNISTD_H
|
10
|
-
# include <unistd.h>
|
11
|
-
#endif
|
12
|
-
|
13
|
-
#include <signal.h>
|
14
|
-
#include <ctype.h>
|
15
|
-
#include <pwd.h>
|
16
|
-
|
17
|
-
#include <sys/types.h>
|
18
|
-
#include <sys/socket.h>
|
19
|
-
#ifdef HAVE_FCNTL_H
|
20
|
-
# include <fcntl.h>
|
21
|
-
#endif
|
22
|
-
#ifdef HAVE_SYS_SELECT_H
|
23
|
-
# include <sys/select.h> /* AIX needs this for FD_ZERO etc macros */
|
24
|
-
#endif
|
25
|
-
#include <sys/ipc.h>
|
26
|
-
#include <sys/shm.h>
|
27
|
-
|
28
|
-
#ifdef TIME_WITH_SYS_TIME
|
29
|
-
# include <sys/time.h>
|
30
|
-
# include <time.h>
|
31
|
-
#else
|
32
|
-
# ifdef HAVE_SYS_TIME_H
|
33
|
-
# include <sys/time.h>
|
34
|
-
# else
|
35
|
-
# include <time.h>
|
36
|
-
# endif
|
37
|
-
#endif
|
38
|
-
|
39
|
-
#include <Intrinsic.h>
|
40
|
-
#include <StringDefs.h>
|
41
|
-
#include <Shell.h>
|
42
|
-
|
43
|
-
#ifdef USE_XAW3D
|
44
|
-
# include <Xaw3d/Box.h>
|
45
|
-
# include <Xaw3d/Scrollbar.h>
|
46
|
-
#elif defined(USE_NEXTAW)
|
47
|
-
# include <neXtaw/Box.h>
|
48
|
-
# include <neXtaw/Scrollbar.h>
|
49
|
-
#else
|
50
|
-
# include <Xaw/Box.h>
|
51
|
-
# include <Xaw/Scrollbar.h>
|
52
|
-
#endif
|
53
|
-
#include "x11/ScrollBox.h"
|
54
|
-
|
55
|
-
#include "Xmu/StdSel.h"
|
56
|
-
#include "Xmu/Atoms.h"
|
57
|
-
|
58
|
-
#include <keysym.h>
|
59
|
-
#include <Xatom.h>
|
60
|
-
|
61
|
-
#define XCURSCR_Y_SIZE (XCursesLINES * XCursesCOLS * sizeof(chtype))
|
62
|
-
#define XCURSCR_FLAG_SIZE (XCursesLINES * sizeof(int))
|
63
|
-
#define XCURSCR_START_SIZE (XCursesLINES * sizeof(int))
|
64
|
-
#define XCURSCR_LENGTH_SIZE (XCursesLINES * sizeof(int))
|
65
|
-
#define XCURSCR_ATRTAB_SIZE (PDC_COLOR_PAIRS * 2 * sizeof(short))
|
66
|
-
#define XCURSCR_SIZE (XCURSCR_FLAG_SIZE + XCURSCR_START_SIZE + \
|
67
|
-
XCURSCR_LENGTH_SIZE + XCURSCR_Y_SIZE + XCURSCR_ATRTAB_SIZE + \
|
68
|
-
sizeof(XColor))
|
69
|
-
|
70
|
-
#define XCURSCR_Y_OFF(y) ((y) * XCursesCOLS * sizeof(chtype))
|
71
|
-
#define XCURSCR_FLAG_OFF (XCURSCR_Y_OFF(0) + XCURSCR_Y_SIZE)
|
72
|
-
#define XCURSCR_START_OFF (XCURSCR_FLAG_OFF + XCURSCR_FLAG_SIZE)
|
73
|
-
#define XCURSCR_LENGTH_OFF (XCURSCR_START_OFF + XCURSCR_START_SIZE)
|
74
|
-
#define XCURSCR_ATRTAB_OFF (XCURSCR_LENGTH_OFF + XCURSCR_LENGTH_SIZE)
|
75
|
-
#define XCURSCR_XCOLOR_OFF (XCURSCR_ATRTAB_OFF + XCURSCR_ATRTAB_SIZE)
|
76
|
-
|
77
|
-
typedef struct
|
78
|
-
{
|
79
|
-
int lines;
|
80
|
-
int cols;
|
81
|
-
Pixel cursorColor;
|
82
|
-
Pixel colorBlack;
|
83
|
-
Pixel colorRed;
|
84
|
-
Pixel colorGreen;
|
85
|
-
Pixel colorYellow;
|
86
|
-
Pixel colorBlue;
|
87
|
-
Pixel colorMagenta;
|
88
|
-
Pixel colorCyan;
|
89
|
-
Pixel colorWhite;
|
90
|
-
Pixel colorBoldBlack;
|
91
|
-
Pixel colorBoldRed;
|
92
|
-
Pixel colorBoldGreen;
|
93
|
-
Pixel colorBoldYellow;
|
94
|
-
Pixel colorBoldBlue;
|
95
|
-
Pixel colorBoldMagenta;
|
96
|
-
Pixel colorBoldCyan;
|
97
|
-
Pixel colorBoldWhite;
|
98
|
-
Pixel pointerForeColor;
|
99
|
-
Pixel pointerBackColor;
|
100
|
-
XFontStruct *normalFont;
|
101
|
-
XFontStruct *italicFont;
|
102
|
-
XFontStruct *boldFont;
|
103
|
-
char *bitmap;
|
104
|
-
#ifdef HAVE_XPM_H
|
105
|
-
char *pixmap;
|
106
|
-
#endif
|
107
|
-
char *composeKey;
|
108
|
-
Cursor pointer;
|
109
|
-
int shmmin;
|
110
|
-
int borderWidth;
|
111
|
-
int borderColor;
|
112
|
-
int clickPeriod;
|
113
|
-
int doubleClickPeriod;
|
114
|
-
int scrollbarWidth;
|
115
|
-
int cursorBlinkRate;
|
116
|
-
char *textCursor;
|
117
|
-
} XCursesAppData;
|
118
|
-
|
119
|
-
extern XCursesAppData xc_app_data;
|
120
|
-
|
121
|
-
#define XCURSESSHMMIN xc_app_data.shmmin
|
122
|
-
|
123
|
-
#define XCLOGMSG (XCursesProcess ? " X" : "CURSES")
|
124
|
-
|
125
|
-
void XC_get_line_lock(int);
|
126
|
-
void XC_release_line_lock(int);
|
127
|
-
|
128
|
-
int PDC_display_cursor(int, int, int, int, int);
|
129
|
-
|
130
|
-
void XCursesExitCursesProcess(int, char *);
|
131
|
-
int XCursesInstruct(int);
|
132
|
-
int XCursesInstructAndWait(int);
|
133
|
-
int XCursesInitscr(int, char **);
|
134
|
-
|
135
|
-
int XC_write_socket(int, const void *, int);
|
136
|
-
int XC_read_socket(int, void *, int);
|
137
|
-
int XC_write_display_socket_int(int);
|
138
|
-
|
139
|
-
int XCursesSetupX(int argc, char *argv[]);
|
140
|
-
RETSIGTYPE XCursesSigwinchHandler(int signo);
|
141
|
-
|
142
|
-
#ifdef _HPUX_SOURCE
|
143
|
-
# define FD_SET_CAST int *
|
144
|
-
#else
|
145
|
-
# define FD_SET_CAST fd_set *
|
146
|
-
#endif
|
147
|
-
|
148
|
-
extern fd_set xc_readfds;
|
149
|
-
|
150
|
-
extern unsigned char *Xcurscr;
|
151
|
-
extern int XCursesProcess;
|
152
|
-
extern int shmidSP;
|
153
|
-
extern int shmid_Xcurscr;
|
154
|
-
extern int shmkeySP;
|
155
|
-
extern int shmkey_Xcurscr;
|
156
|
-
extern int xc_otherpid;
|
157
|
-
extern int XCursesLINES;
|
158
|
-
extern int XCursesCOLS;
|
159
|
-
extern int xc_display_sock;
|
160
|
-
extern int xc_key_sock;
|
161
|
-
extern int xc_display_sockets[2];
|
162
|
-
extern int xc_key_sockets[2];
|
163
|
-
extern int xc_exit_sock;
|
164
|
-
|
165
|
-
typedef RETSIGTYPE (*signal_handler)();
|
166
|
-
|
167
|
-
signal_handler XCursesSetSignal(int, signal_handler);
|
168
|
-
|
169
|
-
#ifdef PDCDEBUG
|
170
|
-
void XC_say(const char *msg);
|
171
|
-
# define XC_LOG(x) XC_say x
|
172
|
-
#else
|
173
|
-
# define XC_LOG(x)
|
174
|
-
#endif
|
175
|
-
|
176
|
-
#ifdef MOUSE_DEBUG
|
177
|
-
# define MOUSE_LOG(x) printf x
|
178
|
-
#else
|
179
|
-
# define MOUSE_LOG(x)
|
180
|
-
#endif
|
181
|
-
|
182
|
-
enum
|
183
|
-
{
|
184
|
-
CURSES_CLEAR_SELECTION, CURSES_DISPLAY_CURSOR, CURSES_SET_SELECTION,
|
185
|
-
CURSES_GET_SELECTION, CURSES_TITLE, CURSES_REFRESH_SCROLLBAR,
|
186
|
-
CURSES_RESIZE, CURSES_BELL, CURSES_CONTINUE, CURSES_CURSOR,
|
187
|
-
CURSES_CHILD, CURSES_REFRESH, CURSES_GET_COLOR, CURSES_SET_COLOR,
|
188
|
-
CURSES_BLINK_ON, CURSES_BLINK_OFF, CURSES_EXIT
|
189
|
-
};
|
190
|
-
|
191
|
-
extern short *xc_atrtab;
|