curses 1.3.2 → 1.4.3
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 +27 -0
- data/README.md +14 -46
- data/Rakefile +0 -86
- data/curses.gemspec +3 -4
- data/ext/curses/curses.c +194 -38
- data/ext/curses/extconf.rb +81 -22
- 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/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/Makefile +27 -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 +105 -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/Makefile +37 -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 +132 -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 +129 -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 +135 -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 +135 -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 +259 -25
- data/.travis.yml +0 -16
- data/appveyor.yml +0 -16
@@ -0,0 +1,107 @@
|
|
1
|
+
# Watcom WMAKE Makefile for PDCurses library - DOS (16 bit) or DOS/4GW Watcom C/C++ 10.6+
|
2
|
+
#
|
3
|
+
# Usage: wmake -f [path/]Makefile.wcc [DEBUG=Y] [MODEL=c|h|l|m|s|f]
|
4
|
+
# [CROSS=Y|N] [CHTYPE=[-DCHTYPE_16|-DCHTYPE_32]] [target]
|
5
|
+
#
|
6
|
+
# where target can be any of:
|
7
|
+
# [all|demos|pdcurses.lib|testcurs.exe...]
|
8
|
+
#
|
9
|
+
# and MODEL specifies the memory model (16-bit compact/huge/large/medium/
|
10
|
+
# small, or 32-bit flat)
|
11
|
+
#
|
12
|
+
# and CROSS=Y (CROSS=N) means to assume we are (are not) cross-compiling
|
13
|
+
# (default is to auto-detect)
|
14
|
+
#
|
15
|
+
# and CHTYPE is an optional compiler flag to set the size of chtype (default
|
16
|
+
# is 64 bits)
|
17
|
+
|
18
|
+
# Change the memory MODEL here, if desired
|
19
|
+
!ifndef MODEL
|
20
|
+
MODEL = l
|
21
|
+
!endif
|
22
|
+
|
23
|
+
!ifdef %PDCURSES_SRCDIR
|
24
|
+
PDCURSES_SRCDIR = $(%PDCURSES_SRCDIR)
|
25
|
+
!else
|
26
|
+
PDCURSES_SRCDIR = ..
|
27
|
+
!endif
|
28
|
+
|
29
|
+
!include $(PDCURSES_SRCDIR)/version.mif
|
30
|
+
|
31
|
+
!ifndef CROSS
|
32
|
+
!ifeq %SHELL /bin/bash
|
33
|
+
# assume we are cross-compiling
|
34
|
+
CROSS = Y
|
35
|
+
!endif
|
36
|
+
!ifeq %SHELL /bin/sh
|
37
|
+
CROSS = Y
|
38
|
+
!endif
|
39
|
+
!ifeq %SHELL /bin/csh
|
40
|
+
CROSS = Y
|
41
|
+
!endif
|
42
|
+
!ifeq %SHELL /bin/dash
|
43
|
+
CROSS = Y
|
44
|
+
!endif
|
45
|
+
!endif
|
46
|
+
|
47
|
+
osdir = $(PDCURSES_SRCDIR)/vt
|
48
|
+
# Open Watcom README strongly recommends setting WATCOM environment variable...
|
49
|
+
!ifeq CROSS Y
|
50
|
+
!ifdef %WATCOM
|
51
|
+
watcomdir = $(%WATCOM)
|
52
|
+
!else
|
53
|
+
watcomdir = "`which wcc | xargs realpath | xargs dirname`"/..
|
54
|
+
!endif
|
55
|
+
!endif
|
56
|
+
|
57
|
+
!ifneq MODEL f
|
58
|
+
CC = wcc
|
59
|
+
TARGET = dos
|
60
|
+
!else
|
61
|
+
CC = wcc386
|
62
|
+
TARGET = dos4g
|
63
|
+
!endif
|
64
|
+
|
65
|
+
CFLAGS = -bt=$(TARGET) -zq -wx -m$(MODEL) -i=$(PDCURSES_SRCDIR)
|
66
|
+
CFLAGS += $(CHTYPE) -DDOS
|
67
|
+
# the README also recommends setting INCLUDE; if absent, we need an extra -i=
|
68
|
+
!ifndef %INCLUDE
|
69
|
+
CFLAGS += -i=$(watcomdir)/h
|
70
|
+
!endif
|
71
|
+
|
72
|
+
!ifeq DEBUG Y
|
73
|
+
CFLAGS += -d2 -DPDCDEBUG
|
74
|
+
LDFLAGS = D W A op q sys $(TARGET)
|
75
|
+
!else
|
76
|
+
CFLAGS += -oneatx
|
77
|
+
LDFLAGS = op q sys $(TARGET)
|
78
|
+
!ifeq CROSS Y
|
79
|
+
!ifneq MODEL f
|
80
|
+
LDFLAGS += libp $(watcomdir)/lib286/dos\;$(watcomdir)/lib286
|
81
|
+
!else
|
82
|
+
LDFLAGS += libp $(watcomdir)/lib386/dos\;$(watcomdir)/lib386
|
83
|
+
!endif
|
84
|
+
!endif
|
85
|
+
!endif
|
86
|
+
|
87
|
+
LIBEXE = wlib -q -n -t
|
88
|
+
|
89
|
+
!include $(PDCURSES_SRCDIR)/watcom.mif
|
90
|
+
|
91
|
+
$(LIBCURSES) : $(LIBOBJS) $(PDCOBJS)
|
92
|
+
%write wccvt.lrf $(LIBOBJS) $(PDCOBJS)
|
93
|
+
$(LIBEXE) $@ @wccvt.lrf
|
94
|
+
-$(DEL) wccvt.lrf
|
95
|
+
-$(COPY) $(LIBCURSES) panel.lib
|
96
|
+
|
97
|
+
!ifneq MODEL f
|
98
|
+
PLATFORM1 = Watcom C++ 16-bit DOS/VT
|
99
|
+
PLATFORM2 = Open Watcom 1.6 for 16-bit DOS/VT
|
100
|
+
ARCNAME = pdc$(VER)16w
|
101
|
+
!else
|
102
|
+
PLATFORM1 = Watcom C++ 32-bit DOS/VT
|
103
|
+
PLATFORM2 = Open Watcom 1.6 for 32-bit DOS/VT
|
104
|
+
ARCNAME = pdc$(VER)32w
|
105
|
+
!endif
|
106
|
+
|
107
|
+
!include $(PDCURSES_SRCDIR)/makedist.mif
|
@@ -0,0 +1,64 @@
|
|
1
|
+
PDCurses for VT
|
2
|
+
================
|
3
|
+
|
4
|
+
This directory contains source code to support PDCurses using a mix
|
5
|
+
of VT-100, VT-200, and ANSI escape sequences to set colors, position
|
6
|
+
the cursor, etc. Note that the name is misleading; it uses an olio of
|
7
|
+
control sequences from
|
8
|
+
|
9
|
+
https://www.gnu.org/software/screen/manual/html_node/Control-Sequences.html
|
10
|
+
|
11
|
+
which may, or may not, work on your terminal (I've tested urxvt, xterm,
|
12
|
+
and QTerminal).
|
13
|
+
|
14
|
+
It assumes that 256 colors are available, but it can use full RGB on
|
15
|
+
terminals that support it.
|
16
|
+
|
17
|
+
This is a first pass; it mostly works, but some work remains to be done
|
18
|
+
(see 'Caveats' below).
|
19
|
+
|
20
|
+
Building
|
21
|
+
--------
|
22
|
+
|
23
|
+
In Linux, run `make` or `make WIDE=Y`. In *BSD, use `gmake` or `gmake WIDE=Y`.
|
24
|
+
|
25
|
+
In theory, this could be tweaked to work in Windows 10, which now has
|
26
|
+
some VT emulation. I do Windows as little as possible, so don't rely on
|
27
|
+
me for that part.
|
28
|
+
|
29
|
+
Caveats
|
30
|
+
-------
|
31
|
+
|
32
|
+
As currently set up, this is a bare-bones implementation. It relies on a
|
33
|
+
terminal that supports at least 256 colors. RGB colors get remapped to the
|
34
|
+
6x6x6 color cube. If your terminal supports full RGB coloring (QTerminal
|
35
|
+
and modern xterm, for example), you can set
|
36
|
+
|
37
|
+
`PDC_VT=RGB`
|
38
|
+
|
39
|
+
`export PDC_VT`
|
40
|
+
|
41
|
+
This will eventually be expanded so one can explain to PDCurses the
|
42
|
+
capabilities of the terminal, e.g.,
|
43
|
+
|
44
|
+
`PDC_VT=RGB BOLD ITALIC BLINK`
|
45
|
+
|
46
|
+
to say that the underlying terminal supports built-in bold, italic, and
|
47
|
+
blinking text. (And/or the code may dig around in the terminfo database,
|
48
|
+
as ncurses does. That would be the Right Way of doing it. Or at the
|
49
|
+
very least, look at the TERM and COLORTERM environment variables.)
|
50
|
+
|
51
|
+
Arrow keys and some function keys are recognized (see the `tbl` array
|
52
|
+
in `pdckey.c`). Some mouse input is recognized. Shift, Ctrl, and Alt
|
53
|
+
function keys and arrows are (mostly) not correctly identified; I've
|
54
|
+
not figured out how those keys are supposed to be detected yet. Or if
|
55
|
+
they can be.
|
56
|
+
|
57
|
+
Test routines have been run on rxvt, xterm, and QTerminal only, on
|
58
|
+
one Xubuntu box, plus some testing on TrueOS.
|
59
|
+
|
60
|
+
Distribution Status
|
61
|
+
-------------------
|
62
|
+
|
63
|
+
The files in this directory are released to the Public Domain.
|
64
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
int PDC_clearclipboard( void)
|
2
|
+
{
|
3
|
+
return( 0);
|
4
|
+
}
|
5
|
+
|
6
|
+
int PDC_freeclipboard( char *contents)
|
7
|
+
{
|
8
|
+
return( 0);
|
9
|
+
}
|
10
|
+
|
11
|
+
int PDC_getclipboard( char **contents, long *length)
|
12
|
+
{
|
13
|
+
return( 0);
|
14
|
+
}
|
15
|
+
|
16
|
+
int PDC_setclipboard( const char *contents, long length)
|
17
|
+
{
|
18
|
+
return( 0);
|
19
|
+
}
|
20
|
+
|
@@ -0,0 +1,284 @@
|
|
1
|
+
#define USE_UNICODE_ACS_CHARS 1
|
2
|
+
|
3
|
+
#include <wchar.h>
|
4
|
+
#include <assert.h>
|
5
|
+
|
6
|
+
#define USE_UNICODE_ACS_CHARS 1
|
7
|
+
|
8
|
+
#include "curses.h"
|
9
|
+
#include "pdcvt.h"
|
10
|
+
#include "acs_defs.h"
|
11
|
+
|
12
|
+
void PDC_gotoyx(int y, int x)
|
13
|
+
{
|
14
|
+
printf( "\033[%d;%dH", y + 1, x + 1);
|
15
|
+
}
|
16
|
+
|
17
|
+
#define STANDOUT_ON "\033[3m"
|
18
|
+
#define STANDOUT_OFF "\033[23m"
|
19
|
+
#define UNDERLINE_ON "\033[4m"
|
20
|
+
#define UNDERLINE_OFF "\033[24m"
|
21
|
+
#define BLINK_ON "\033[5m"
|
22
|
+
#define BLINK_OFF "\033[25m"
|
23
|
+
#define BOLD_ON "\033[1m"
|
24
|
+
#define BOLD_OFF "\033[22m"
|
25
|
+
#define DIM_ON "\033[2m"
|
26
|
+
#define DIM_OFF "\033[22m"
|
27
|
+
#define STDOUT 0
|
28
|
+
|
29
|
+
const chtype MAX_UNICODE = 0x110000;
|
30
|
+
|
31
|
+
/* see 'addch.c' for an explanation of how combining chars are handled. */
|
32
|
+
|
33
|
+
#if defined( CHTYPE_LONG) && CHTYPE_LONG >= 2 && defined( PDC_WIDE)
|
34
|
+
#define USING_COMBINING_CHARACTER_SCHEME
|
35
|
+
int PDC_expand_combined_characters( const cchar_t c, cchar_t *added); /* addch.c */
|
36
|
+
#endif
|
37
|
+
|
38
|
+
|
39
|
+
extern int PDC_really_blinking;
|
40
|
+
extern chtype PDC_capabilities;
|
41
|
+
|
42
|
+
/* This function 'intensifies' a color by shifting it toward white. */
|
43
|
+
/* It used to average the input color with white. Then it did a */
|
44
|
+
/* weighted average: 2/3 of the input color, 1/3 white, for a */
|
45
|
+
/* lower "intensification" level. */
|
46
|
+
/* Then Mark Hessling suggested that the output level should */
|
47
|
+
/* remap zero to 85 (= 255 / 3, so one-third intensity), and input */
|
48
|
+
/* of 192 or greater should be remapped to 255 (full intensity). */
|
49
|
+
/* Assuming we want a linear response between zero and 192, that */
|
50
|
+
/* leads to output = 85 + input * (255-85)/192. */
|
51
|
+
/* This should lead to proper handling of bold text in legacy */
|
52
|
+
/* apps, where "bold" means "high intensity". */
|
53
|
+
|
54
|
+
static PACKED_RGB intensified_color( PACKED_RGB ival)
|
55
|
+
{
|
56
|
+
int rgb, i;
|
57
|
+
PACKED_RGB oval = 0;
|
58
|
+
|
59
|
+
for( i = 0; i < 3; i++, ival >>= 8)
|
60
|
+
{
|
61
|
+
rgb = (int)( ival & 0xff);
|
62
|
+
if( rgb >= 192)
|
63
|
+
rgb = 255;
|
64
|
+
else
|
65
|
+
rgb = 85 + rgb * (255 - 85) / 192;
|
66
|
+
oval |= ((PACKED_RGB)rgb << (i * 8));
|
67
|
+
}
|
68
|
+
return( oval);
|
69
|
+
}
|
70
|
+
|
71
|
+
/* For use in adjusting colors for A_DIMmed characters. Just */
|
72
|
+
/* knocks down the intensity of R, G, and B by 1/3. */
|
73
|
+
|
74
|
+
static PACKED_RGB dimmed_color( PACKED_RGB ival)
|
75
|
+
{
|
76
|
+
unsigned i;
|
77
|
+
PACKED_RGB oval = 0;
|
78
|
+
|
79
|
+
for( i = 0; i < 3; i++, ival >>= 8)
|
80
|
+
{
|
81
|
+
unsigned rgb = (unsigned)( ival & 0xff);
|
82
|
+
|
83
|
+
rgb -= (rgb / 3);
|
84
|
+
oval |= ((PACKED_RGB)rgb << (i * 8));
|
85
|
+
}
|
86
|
+
return( oval);
|
87
|
+
}
|
88
|
+
|
89
|
+
|
90
|
+
/* PDC_get_rgb_values(), extract_packed_rgb(), intensified_component(), */
|
91
|
+
/* intensified_color(), and dimmed_color() each exist in x11/x11.c, */
|
92
|
+
/* win32a/pdcdisp.c, and sdl2/pdcdisp.c in forms slightly modified for */
|
93
|
+
/* each platform. But they all look pretty much alike. */
|
94
|
+
|
95
|
+
/* PDCurses stores RGBs in fifteen bits, five bits each */
|
96
|
+
/* for red, green, blue. A PACKED_RGB uses eight bits per */
|
97
|
+
/* channel. Hence the following. */
|
98
|
+
#if defined( CHTYPE_LONG) && CHTYPE_LONG >= 2
|
99
|
+
static PACKED_RGB extract_packed_rgb( const chtype color)
|
100
|
+
{
|
101
|
+
const int red = (int)( (color << 3) & 0xf8);
|
102
|
+
const int green = (int)( (color >> 2) & 0xf8);
|
103
|
+
const int blue = (int)( (color >> 7) & 0xf8);
|
104
|
+
|
105
|
+
return( PACK_RGB( red, green, blue));
|
106
|
+
}
|
107
|
+
#endif
|
108
|
+
|
109
|
+
void PDC_get_rgb_values( const chtype srcp,
|
110
|
+
PACKED_RGB *foreground_rgb, PACKED_RGB *background_rgb)
|
111
|
+
{
|
112
|
+
const int color = (int)(( srcp & A_COLOR) >> PDC_COLOR_SHIFT);
|
113
|
+
bool reverse_colors = ((srcp & A_REVERSE) ? TRUE : FALSE);
|
114
|
+
bool intensify_backgnd = FALSE;
|
115
|
+
|
116
|
+
#if defined( CHTYPE_LONG) && CHTYPE_LONG >= 2
|
117
|
+
if( srcp & A_RGB_COLOR)
|
118
|
+
{
|
119
|
+
/* Extract RGB from 30 bits of the color field */
|
120
|
+
*background_rgb = extract_packed_rgb( srcp >> PDC_COLOR_SHIFT);
|
121
|
+
*foreground_rgb = extract_packed_rgb( srcp >> (PDC_COLOR_SHIFT + 15));
|
122
|
+
}
|
123
|
+
else
|
124
|
+
#endif
|
125
|
+
{
|
126
|
+
extern PACKED_RGB *pdc_rgbs;
|
127
|
+
short foreground_index, background_index;
|
128
|
+
|
129
|
+
PDC_pair_content( (short)color, &foreground_index, &background_index);
|
130
|
+
*foreground_rgb = pdc_rgbs[foreground_index];
|
131
|
+
*background_rgb = pdc_rgbs[background_index];
|
132
|
+
}
|
133
|
+
|
134
|
+
if( srcp & A_BLINK)
|
135
|
+
{
|
136
|
+
extern int PDC_really_blinking; /* see 'pdcsetsc.c' */
|
137
|
+
|
138
|
+
if( !PDC_really_blinking) /* convert 'blinking' to 'bold' */
|
139
|
+
intensify_backgnd = TRUE;
|
140
|
+
}
|
141
|
+
if( reverse_colors)
|
142
|
+
{
|
143
|
+
const PACKED_RGB temp = *foreground_rgb;
|
144
|
+
|
145
|
+
*foreground_rgb = *background_rgb;
|
146
|
+
*background_rgb = temp;
|
147
|
+
}
|
148
|
+
|
149
|
+
if( srcp & A_BOLD)
|
150
|
+
*foreground_rgb = intensified_color( *foreground_rgb);
|
151
|
+
if( intensify_backgnd)
|
152
|
+
*background_rgb = intensified_color( *background_rgb);
|
153
|
+
if( srcp & A_DIM)
|
154
|
+
*foreground_rgb = dimmed_color( *foreground_rgb);
|
155
|
+
if( srcp & A_DIM)
|
156
|
+
*background_rgb = dimmed_color( *background_rgb);
|
157
|
+
}
|
158
|
+
|
159
|
+
static char *color_string( char *otext, const PACKED_RGB rgb)
|
160
|
+
{
|
161
|
+
if( PDC_capabilities & A_RGB_COLOR)
|
162
|
+
sprintf( otext, "2;%d;%d;%dm", Get_RValue( rgb),
|
163
|
+
Get_GValue( rgb), Get_BValue( rgb));
|
164
|
+
else
|
165
|
+
{
|
166
|
+
const int red = Get_RValue( rgb);
|
167
|
+
const int green = Get_GValue( rgb);
|
168
|
+
const int blue = Get_BValue( rgb);
|
169
|
+
int idx;
|
170
|
+
|
171
|
+
if( red == green && red == blue) /* gray scale: indices from */
|
172
|
+
{
|
173
|
+
if( red < 27) /* this would underflow; remap to black */
|
174
|
+
idx = COLOR_BLACK;
|
175
|
+
else if( red >= 243) /* this would overflow */
|
176
|
+
idx = COLOR_WHITE;
|
177
|
+
else
|
178
|
+
idx = (red - 3) / 10 + 232; /* 232 to 255 */
|
179
|
+
}
|
180
|
+
else
|
181
|
+
idx = ((blue - 35) / 40) + ((green - 35) / 40) * 6
|
182
|
+
+ ((red - 35) / 40) * 36 + 16;
|
183
|
+
|
184
|
+
sprintf( otext, "5;%dm", idx);
|
185
|
+
}
|
186
|
+
return( otext);
|
187
|
+
}
|
188
|
+
|
189
|
+
static int get_sixteen_color_idx( const PACKED_RGB rgb)
|
190
|
+
{
|
191
|
+
int rval = 0;
|
192
|
+
|
193
|
+
if( rgb & 0x800000) /* red value >= 128 */
|
194
|
+
rval = 1;
|
195
|
+
if( rgb & 0x8000) /* green value >= 128 */
|
196
|
+
rval |= 2;
|
197
|
+
if( rgb & 0x80) /* blue value >= 128 */
|
198
|
+
rval |= 4;
|
199
|
+
return( rval);
|
200
|
+
}
|
201
|
+
|
202
|
+
static void reset_color( const chtype ch)
|
203
|
+
{
|
204
|
+
static PACKED_RGB prev_bg = (PACKED_RGB)-1;
|
205
|
+
static PACKED_RGB prev_fg = (PACKED_RGB)-1;
|
206
|
+
PACKED_RGB bg, fg;
|
207
|
+
char txt[20];
|
208
|
+
|
209
|
+
PDC_get_rgb_values( ch, &fg, &bg);
|
210
|
+
if( bg != prev_bg)
|
211
|
+
{
|
212
|
+
if( COLORS == 16)
|
213
|
+
printf( "\033[4%dm", get_sixteen_color_idx( bg));
|
214
|
+
else
|
215
|
+
printf( "\033[48;%s", color_string( txt, bg));
|
216
|
+
prev_bg = bg;
|
217
|
+
}
|
218
|
+
if( fg != prev_fg)
|
219
|
+
{
|
220
|
+
if( COLORS == 16)
|
221
|
+
printf( "\033[3%dm", get_sixteen_color_idx( fg));
|
222
|
+
else
|
223
|
+
printf( "\033[38;%s", color_string( txt, fg));
|
224
|
+
prev_fg = fg;
|
225
|
+
}
|
226
|
+
}
|
227
|
+
|
228
|
+
void PDC_transform_line(int lineno, int x, int len, const chtype *srcp)
|
229
|
+
{
|
230
|
+
static chtype prev_ch = 0;
|
231
|
+
|
232
|
+
assert( x >= 0);
|
233
|
+
assert( len <= SP->cols - x);
|
234
|
+
assert( lineno >= 0);
|
235
|
+
assert( lineno < SP->lines);
|
236
|
+
assert( len > 0);
|
237
|
+
PDC_gotoyx( lineno, x);
|
238
|
+
while( len--)
|
239
|
+
{
|
240
|
+
int ch = (int)( *srcp & A_CHARTEXT);
|
241
|
+
chtype changes = *srcp ^ prev_ch;
|
242
|
+
|
243
|
+
if( (*srcp & A_ALTCHARSET) && ch < 0x80)
|
244
|
+
ch = acs_map[ch & 0x7f];
|
245
|
+
if( ch < (int)' ' || (ch >= 0x80 && ch <= 0x9f))
|
246
|
+
ch = ' ';
|
247
|
+
if( changes & A_BOLD)
|
248
|
+
printf( (*srcp & A_BOLD) ? BOLD_ON : BOLD_OFF);
|
249
|
+
if( changes & A_UNDERLINE)
|
250
|
+
printf( (*srcp & A_UNDERLINE) ? UNDERLINE_ON : UNDERLINE_OFF);
|
251
|
+
if( changes & A_STANDOUT)
|
252
|
+
printf( (*srcp & A_STANDOUT) ? STANDOUT_ON : STANDOUT_OFF);
|
253
|
+
if( PDC_really_blinking && ( changes & A_BLINK))
|
254
|
+
printf( (*srcp & A_BLINK) ? BLINK_ON : BLINK_OFF);
|
255
|
+
if( changes & (A_COLOR | A_STANDOUT | A_BLINK))
|
256
|
+
reset_color( *srcp);
|
257
|
+
#ifdef PDC_WIDE
|
258
|
+
if( ch < 128)
|
259
|
+
printf( "%c", (char)ch);
|
260
|
+
else if( ch < (int)MAX_UNICODE)
|
261
|
+
printf( "%lc", (wchar_t)ch);
|
262
|
+
#else
|
263
|
+
printf( "%c", (char)ch);
|
264
|
+
#endif
|
265
|
+
#ifdef USING_COMBINING_CHARACTER_SCHEME
|
266
|
+
else if( ch > (int)MAX_UNICODE) /* chars & fullwidth supported */
|
267
|
+
{
|
268
|
+
cchar_t root, newchar;
|
269
|
+
|
270
|
+
root = ch;
|
271
|
+
while( (root = PDC_expand_combined_characters( root,
|
272
|
+
&newchar)) > MAX_UNICODE)
|
273
|
+
;
|
274
|
+
printf( "%lc", (wchar_t)root);
|
275
|
+
root = ch;
|
276
|
+
while( (root = PDC_expand_combined_characters( root,
|
277
|
+
&newchar)) > MAX_UNICODE)
|
278
|
+
printf( "%lc", (wchar_t)newchar);
|
279
|
+
printf( "%lc", (wchar_t)newchar);
|
280
|
+
}
|
281
|
+
#endif
|
282
|
+
prev_ch = *srcp++;
|
283
|
+
}
|
284
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
/* Public Domain Curses */
|
2
|
+
|
3
|
+
#include <curspriv.h>
|
4
|
+
|
5
|
+
int PDC_get_cursor_mode(void)
|
6
|
+
{
|
7
|
+
PDC_LOG(("PDC_get_cursor_mode() - called\n"));
|
8
|
+
|
9
|
+
return SP->visibility;
|
10
|
+
}
|
11
|
+
|
12
|
+
|
13
|
+
int PDC_get_columns(void)
|
14
|
+
{
|
15
|
+
extern int PDC_cols;
|
16
|
+
|
17
|
+
PDC_LOG(("PDC_get_columns() - called\n"));
|
18
|
+
return( PDC_cols);
|
19
|
+
}
|
20
|
+
|
21
|
+
int PDC_get_rows(void)
|
22
|
+
{
|
23
|
+
extern int PDC_rows;
|
24
|
+
|
25
|
+
PDC_LOG(("PDC_get_rows() - called\n"));
|
26
|
+
return( PDC_rows);
|
27
|
+
}
|