curses 1.3.2 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (262) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +19 -0
  3. data/.github/workflows/ubuntu.yml +26 -0
  4. data/.github/workflows/windows.yml +25 -0
  5. data/History.md +27 -0
  6. data/README.md +14 -46
  7. data/Rakefile +0 -86
  8. data/curses.gemspec +3 -4
  9. data/ext/curses/curses.c +194 -38
  10. data/ext/curses/extconf.rb +81 -22
  11. data/lib/curses.rb +5 -12
  12. data/sample/addch.rb +16 -0
  13. data/sample/attr_demo.rb +32 -0
  14. data/sample/colors.rb +26 -0
  15. data/sample/mouse_move.rb +75 -0
  16. data/vendor/PDCurses/.gitignore +47 -0
  17. data/vendor/PDCurses/.travis.yml +49 -0
  18. data/vendor/PDCurses/CMakeLists.txt +68 -0
  19. data/vendor/PDCurses/HISTORY.md +2036 -0
  20. data/vendor/PDCurses/IMPLEMNT.md +327 -0
  21. data/vendor/PDCurses/Makefile +27 -0
  22. data/vendor/PDCurses/README.md +77 -0
  23. data/vendor/PDCurses/acs_defs.h +265 -0
  24. data/vendor/PDCurses/appveyor.yml +218 -0
  25. data/vendor/PDCurses/cmake/README.md +71 -0
  26. data/vendor/PDCurses/cmake/build_dependencies.cmake +178 -0
  27. data/vendor/PDCurses/cmake/build_options.cmake +25 -0
  28. data/vendor/PDCurses/cmake/dll_version.cmake +26 -0
  29. data/vendor/PDCurses/cmake/gen_config_header.cmake +43 -0
  30. data/vendor/PDCurses/cmake/get_version.cmake +17 -0
  31. data/vendor/PDCurses/cmake/make_uninstall.cmake +19 -0
  32. data/vendor/PDCurses/cmake/project_common.cmake +121 -0
  33. data/vendor/PDCurses/cmake/resource.in.cmake +52 -0
  34. data/vendor/PDCurses/cmake/sdl2_ttf/CMakeLists.txt +83 -0
  35. data/vendor/PDCurses/cmake/target_arch.cmake +36 -0
  36. data/vendor/PDCurses/cmake/version.in.cmake +73 -0
  37. data/vendor/PDCurses/cmake/watcom_open_dos16_toolchain.cmake +96 -0
  38. data/vendor/PDCurses/cmake/watcom_open_dos32_toolchain.cmake +106 -0
  39. data/vendor/PDCurses/cmake/watcom_open_os2v2_toolchain.cmake +105 -0
  40. data/vendor/PDCurses/curses.h +1846 -0
  41. data/vendor/PDCurses/curspriv.h +134 -0
  42. data/vendor/PDCurses/demos/README.md +25 -0
  43. data/vendor/PDCurses/demos/firework.c +144 -0
  44. data/vendor/PDCurses/demos/newtest.c +581 -0
  45. data/vendor/PDCurses/demos/ozdemo.c +447 -0
  46. data/vendor/PDCurses/demos/ptest.c +283 -0
  47. data/vendor/PDCurses/demos/rain.c +157 -0
  48. data/vendor/PDCurses/demos/testcurs.c +1607 -0
  49. data/vendor/PDCurses/demos/tui.c +1048 -0
  50. data/vendor/PDCurses/demos/tui.h +65 -0
  51. data/vendor/PDCurses/demos/tuidemo.c +233 -0
  52. data/vendor/PDCurses/demos/version.c +61 -0
  53. data/vendor/PDCurses/demos/worm.c +432 -0
  54. data/vendor/PDCurses/demos/xmas.c +955 -0
  55. data/vendor/PDCurses/dos/CMakeLists.txt +47 -0
  56. data/vendor/PDCurses/dos/Makefile +105 -0
  57. data/vendor/PDCurses/dos/Makefile.bcc +83 -0
  58. data/vendor/PDCurses/dos/Makefile.dmc +257 -0
  59. data/vendor/PDCurses/dos/Makefile.msc +113 -0
  60. data/vendor/PDCurses/dos/Makefile.wcc +107 -0
  61. data/vendor/PDCurses/dos/README.md +51 -0
  62. data/vendor/PDCurses/dos/bccdos.lrf +9 -0
  63. data/vendor/PDCurses/dos/mscdos.lrf +50 -0
  64. data/vendor/PDCurses/dos/pdcclip.c +132 -0
  65. data/vendor/PDCurses/dos/pdcdisp.c +135 -0
  66. data/vendor/PDCurses/dos/pdcdos.h +194 -0
  67. data/vendor/PDCurses/dos/pdcgetsc.c +98 -0
  68. data/vendor/PDCurses/dos/pdckbd.c +513 -0
  69. data/vendor/PDCurses/dos/pdcscrn.c +785 -0
  70. data/vendor/PDCurses/dos/pdcsetsc.c +101 -0
  71. data/vendor/PDCurses/dos/pdcutil.c +212 -0
  72. data/vendor/PDCurses/libobjs.mif +26 -0
  73. data/vendor/PDCurses/makedist.mif +20 -0
  74. data/vendor/PDCurses/man/Makefile +37 -0
  75. data/vendor/PDCurses/man/README.md +21 -0
  76. data/vendor/PDCurses/man/intro.md +361 -0
  77. data/vendor/PDCurses/man/manext.c +119 -0
  78. data/vendor/PDCurses/man/sdl.md +152 -0
  79. data/vendor/PDCurses/man/sdl2.md +58 -0
  80. data/vendor/PDCurses/man/x11.md +407 -0
  81. data/vendor/PDCurses/ncurses/CMakeLists.txt +66 -0
  82. data/vendor/PDCurses/ncurses/README.md +26 -0
  83. data/vendor/PDCurses/ncurses/makefile +29 -0
  84. data/vendor/PDCurses/os2/CMakeLists.txt +41 -0
  85. data/vendor/PDCurses/os2/Makefile +132 -0
  86. data/vendor/PDCurses/os2/Makefile.bcc +90 -0
  87. data/vendor/PDCurses/os2/Makefile.wcc +43 -0
  88. data/vendor/PDCurses/os2/README.md +43 -0
  89. data/vendor/PDCurses/os2/iccos2.lrf +50 -0
  90. data/vendor/PDCurses/os2/iccos2.mak +256 -0
  91. data/vendor/PDCurses/os2/pdcclip.c +188 -0
  92. data/vendor/PDCurses/os2/pdcdisp.c +93 -0
  93. data/vendor/PDCurses/os2/pdcgetsc.c +89 -0
  94. data/vendor/PDCurses/os2/pdckbd.c +521 -0
  95. data/vendor/PDCurses/os2/pdcos2.h +55 -0
  96. data/vendor/PDCurses/os2/pdcscrn.c +449 -0
  97. data/vendor/PDCurses/os2/pdcsetsc.c +112 -0
  98. data/vendor/PDCurses/os2/pdcutil.c +52 -0
  99. data/vendor/PDCurses/panel.h +56 -0
  100. data/vendor/PDCurses/pdcurses/README.md +25 -0
  101. data/vendor/PDCurses/pdcurses/addch.c +693 -0
  102. data/vendor/PDCurses/pdcurses/addchstr.c +245 -0
  103. data/vendor/PDCurses/pdcurses/addstr.c +240 -0
  104. data/vendor/PDCurses/pdcurses/attr.c +359 -0
  105. data/vendor/PDCurses/pdcurses/beep.c +68 -0
  106. data/vendor/PDCurses/pdcurses/bkgd.c +223 -0
  107. data/vendor/PDCurses/pdcurses/border.c +411 -0
  108. data/vendor/PDCurses/pdcurses/clear.c +159 -0
  109. data/vendor/PDCurses/pdcurses/color.c +298 -0
  110. data/vendor/PDCurses/pdcurses/debug.c +109 -0
  111. data/vendor/PDCurses/pdcurses/delch.c +96 -0
  112. data/vendor/PDCurses/pdcurses/deleteln.c +211 -0
  113. data/vendor/PDCurses/pdcurses/deprec.c +27 -0
  114. data/vendor/PDCurses/pdcurses/getch.c +417 -0
  115. data/vendor/PDCurses/pdcurses/getstr.c +474 -0
  116. data/vendor/PDCurses/pdcurses/getyx.c +139 -0
  117. data/vendor/PDCurses/pdcurses/inch.c +127 -0
  118. data/vendor/PDCurses/pdcurses/inchstr.c +214 -0
  119. data/vendor/PDCurses/pdcurses/initscr.c +367 -0
  120. data/vendor/PDCurses/pdcurses/inopts.c +324 -0
  121. data/vendor/PDCurses/pdcurses/insch.c +271 -0
  122. data/vendor/PDCurses/pdcurses/insstr.c +264 -0
  123. data/vendor/PDCurses/pdcurses/instr.c +246 -0
  124. data/vendor/PDCurses/pdcurses/kernel.c +259 -0
  125. data/vendor/PDCurses/pdcurses/keyname.c +157 -0
  126. data/vendor/PDCurses/pdcurses/mouse.c +438 -0
  127. data/vendor/PDCurses/pdcurses/move.c +57 -0
  128. data/vendor/PDCurses/pdcurses/outopts.c +159 -0
  129. data/vendor/PDCurses/pdcurses/overlay.c +214 -0
  130. data/vendor/PDCurses/pdcurses/pad.c +260 -0
  131. data/vendor/PDCurses/pdcurses/panel.c +633 -0
  132. data/vendor/PDCurses/pdcurses/printw.c +126 -0
  133. data/vendor/PDCurses/pdcurses/refresh.c +279 -0
  134. data/vendor/PDCurses/pdcurses/scanw.c +578 -0
  135. data/vendor/PDCurses/pdcurses/scr_dump.c +213 -0
  136. data/vendor/PDCurses/pdcurses/scroll.c +101 -0
  137. data/vendor/PDCurses/pdcurses/slk.c +591 -0
  138. data/vendor/PDCurses/pdcurses/termattr.c +182 -0
  139. data/vendor/PDCurses/pdcurses/terminfo.c +217 -0
  140. data/vendor/PDCurses/pdcurses/touch.c +163 -0
  141. data/vendor/PDCurses/pdcurses/util.c +312 -0
  142. data/vendor/PDCurses/pdcurses/window.c +569 -0
  143. data/vendor/PDCurses/sdl1/Makefile +129 -0
  144. data/vendor/PDCurses/sdl1/Makefile.mng +110 -0
  145. data/vendor/PDCurses/sdl1/README.md +31 -0
  146. data/vendor/PDCurses/sdl1/deffont.h +385 -0
  147. data/vendor/PDCurses/sdl1/deficon.h +23 -0
  148. data/vendor/PDCurses/sdl1/pdcclip.c +131 -0
  149. data/vendor/PDCurses/sdl1/pdcdisp.c +373 -0
  150. data/vendor/PDCurses/sdl1/pdcgetsc.c +30 -0
  151. data/vendor/PDCurses/sdl1/pdckbd.c +405 -0
  152. data/vendor/PDCurses/sdl1/pdcscrn.c +414 -0
  153. data/vendor/PDCurses/sdl1/pdcsdl.h +31 -0
  154. data/vendor/PDCurses/sdl1/pdcsetsc.c +64 -0
  155. data/vendor/PDCurses/sdl1/pdcutil.c +40 -0
  156. data/vendor/PDCurses/sdl1/sdltest.c +79 -0
  157. data/vendor/PDCurses/sdl2/CMakeLists.txt +76 -0
  158. data/vendor/PDCurses/sdl2/Makefile +135 -0
  159. data/vendor/PDCurses/sdl2/Makefile.vc +164 -0
  160. data/vendor/PDCurses/sdl2/README.md +34 -0
  161. data/vendor/PDCurses/sdl2/deffont.h +385 -0
  162. data/vendor/PDCurses/sdl2/deficon.h +23 -0
  163. data/vendor/PDCurses/sdl2/pdcclip.c +93 -0
  164. data/vendor/PDCurses/sdl2/pdcdisp.c +534 -0
  165. data/vendor/PDCurses/sdl2/pdcgetsc.c +30 -0
  166. data/vendor/PDCurses/sdl2/pdckbd.c +480 -0
  167. data/vendor/PDCurses/sdl2/pdcscrn.c +443 -0
  168. data/vendor/PDCurses/sdl2/pdcsdl.h +33 -0
  169. data/vendor/PDCurses/sdl2/pdcsetsc.c +67 -0
  170. data/vendor/PDCurses/sdl2/pdcutil.c +39 -0
  171. data/vendor/PDCurses/sdl2/sdltest.c +81 -0
  172. data/vendor/PDCurses/term.h +48 -0
  173. data/vendor/PDCurses/version.mif +7 -0
  174. data/vendor/PDCurses/vt/CMakeLists.txt +28 -0
  175. data/vendor/PDCurses/vt/Makefile +135 -0
  176. data/vendor/PDCurses/vt/Makefile.bcc +111 -0
  177. data/vendor/PDCurses/vt/Makefile.dmc +258 -0
  178. data/vendor/PDCurses/vt/Makefile.vc +144 -0
  179. data/vendor/PDCurses/vt/Makefile.wcc +107 -0
  180. data/vendor/PDCurses/vt/README.md +64 -0
  181. data/vendor/PDCurses/vt/pdcclip.c +20 -0
  182. data/vendor/PDCurses/vt/pdcdisp.c +284 -0
  183. data/vendor/PDCurses/vt/pdcgetsc.c +27 -0
  184. data/vendor/PDCurses/vt/pdckbd.c +394 -0
  185. data/vendor/PDCurses/vt/pdcscrn.c +434 -0
  186. data/vendor/PDCurses/vt/pdcsetsc.c +45 -0
  187. data/vendor/PDCurses/vt/pdcutil.c +43 -0
  188. data/vendor/PDCurses/vt/pdcvt.h +16 -0
  189. data/vendor/PDCurses/watcom.mif +68 -0
  190. data/vendor/PDCurses/wincon/CMakeLists.txt +27 -0
  191. data/vendor/PDCurses/wincon/Makefile.bcc +88 -0
  192. data/vendor/PDCurses/wincon/Makefile.dmc +256 -0
  193. data/vendor/PDCurses/wincon/Makefile.lcc +273 -0
  194. data/vendor/PDCurses/wincon/Makefile.mng +176 -0
  195. data/vendor/PDCurses/wincon/Makefile.vc +144 -0
  196. data/vendor/PDCurses/wincon/Makefile.wcc +51 -0
  197. data/vendor/PDCurses/wincon/README.md +85 -0
  198. data/vendor/PDCurses/wincon/pdcclip.c +174 -0
  199. data/vendor/PDCurses/wincon/pdcdisp.c +143 -0
  200. data/vendor/PDCurses/wincon/pdcgetsc.c +55 -0
  201. data/vendor/PDCurses/wincon/pdckbd.c +786 -0
  202. data/vendor/PDCurses/wincon/pdcscrn.c +717 -0
  203. data/vendor/PDCurses/wincon/pdcsetsc.c +91 -0
  204. data/vendor/PDCurses/wincon/pdcurses.ico +0 -0
  205. data/vendor/PDCurses/wincon/pdcurses.rc +28 -0
  206. data/vendor/PDCurses/wincon/pdcutil.c +41 -0
  207. data/vendor/PDCurses/wincon/pdcwin.h +31 -0
  208. data/vendor/PDCurses/wingui/CMakeLists.txt +27 -0
  209. data/vendor/PDCurses/wingui/Makefile.bcc +85 -0
  210. data/vendor/PDCurses/wingui/Makefile.dmc +259 -0
  211. data/vendor/PDCurses/wingui/Makefile.lcc +273 -0
  212. data/vendor/PDCurses/wingui/Makefile.mng +171 -0
  213. data/vendor/PDCurses/wingui/Makefile.vc +144 -0
  214. data/vendor/PDCurses/wingui/Makefile.wcc +51 -0
  215. data/vendor/PDCurses/wingui/README.md +93 -0
  216. data/vendor/PDCurses/wingui/pdcclip.c +174 -0
  217. data/vendor/PDCurses/wingui/pdcdisp.c +718 -0
  218. data/vendor/PDCurses/wingui/pdcgetsc.c +30 -0
  219. data/vendor/PDCurses/wingui/pdckbd.c +143 -0
  220. data/vendor/PDCurses/wingui/pdcscrn.c +2797 -0
  221. data/vendor/PDCurses/wingui/pdcsetsc.c +89 -0
  222. data/vendor/PDCurses/wingui/pdcurses.ico +0 -0
  223. data/vendor/PDCurses/wingui/pdcurses.rc +28 -0
  224. data/vendor/PDCurses/wingui/pdcutil.c +61 -0
  225. data/vendor/PDCurses/wingui/pdcwin.h +122 -0
  226. data/vendor/PDCurses/x11/Makefile.in +754 -0
  227. data/vendor/PDCurses/x11/PDCurses.spec +82 -0
  228. data/vendor/PDCurses/x11/README.md +62 -0
  229. data/vendor/PDCurses/x11/ScrollBox.c +319 -0
  230. data/vendor/PDCurses/x11/ScrollBox.h +51 -0
  231. data/vendor/PDCurses/x11/ScrollBoxP.h +70 -0
  232. data/vendor/PDCurses/x11/aclocal.m4 +994 -0
  233. data/vendor/PDCurses/x11/big_icon.xbm +46 -0
  234. data/vendor/PDCurses/x11/compose.h +201 -0
  235. data/vendor/PDCurses/x11/config.guess +1500 -0
  236. data/vendor/PDCurses/x11/config.h.in +100 -0
  237. data/vendor/PDCurses/x11/config.sub +1616 -0
  238. data/vendor/PDCurses/x11/configure +6700 -0
  239. data/vendor/PDCurses/x11/configure.ac +295 -0
  240. data/vendor/PDCurses/x11/debian/changelog +6 -0
  241. data/vendor/PDCurses/x11/debian/compat +1 -0
  242. data/vendor/PDCurses/x11/debian/control +11 -0
  243. data/vendor/PDCurses/x11/debian/copyright +27 -0
  244. data/vendor/PDCurses/x11/debian/rules +98 -0
  245. data/vendor/PDCurses/x11/install-sh +253 -0
  246. data/vendor/PDCurses/x11/little_icon.xbm +14 -0
  247. data/vendor/PDCurses/x11/ncurses_cfg.h +45 -0
  248. data/vendor/PDCurses/x11/pdcclip.c +173 -0
  249. data/vendor/PDCurses/x11/pdcdisp.c +85 -0
  250. data/vendor/PDCurses/x11/pdcgetsc.c +28 -0
  251. data/vendor/PDCurses/x11/pdckbd.c +104 -0
  252. data/vendor/PDCurses/x11/pdcscrn.c +258 -0
  253. data/vendor/PDCurses/x11/pdcsetsc.c +95 -0
  254. data/vendor/PDCurses/x11/pdcutil.c +52 -0
  255. data/vendor/PDCurses/x11/pdcx11.c +316 -0
  256. data/vendor/PDCurses/x11/pdcx11.h +191 -0
  257. data/vendor/PDCurses/x11/sb.c +155 -0
  258. data/vendor/PDCurses/x11/x11.c +3686 -0
  259. data/vendor/PDCurses/x11/xcurses-config.in +81 -0
  260. metadata +259 -25
  261. data/.travis.yml +0 -16
  262. 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(&current, 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
+ }
@@ -0,0 +1,112 @@
1
+ /* Public Domain Curses */
2
+
3
+ #include "pdcos2.h"
4
+
5
+ /*man-start**************************************************************
6
+
7
+ pdcsetsc
8
+ --------
9
+
10
+ ### Synopsis
11
+
12
+ int PDC_set_blink(bool blinkon);
13
+ void PDC_set_title(const char *title);
14
+
15
+ ### Description
16
+
17
+ PDC_set_blink() toggles whether the A_BLINK attribute sets an
18
+ actual blink mode (TRUE), or sets the background color to high
19
+ intensity (FALSE). The default is platform-dependent (FALSE in
20
+ most cases). It returns OK if it could set the state to match
21
+ the given parameter, ERR otherwise. Current platforms also
22
+ adjust the value of COLORS according to this function -- 16 for
23
+ FALSE, and 8 for TRUE.
24
+
25
+ PDC_set_title() sets the title of the window in which the curses
26
+ program is running. This function may not do anything on some
27
+ platforms. (Currently it only works in Win32 and X11.)
28
+
29
+ ### Portability
30
+ X/Open BSD SYS V
31
+ PDC_set_blink - - -
32
+ PDC_set_title - - -
33
+
34
+ **man-end****************************************************************/
35
+
36
+ int PDC_curs_set(int visibility)
37
+ {
38
+ #ifndef EMXVIDEO
39
+ VIOCURSORINFO pvioCursorInfo;
40
+ #endif
41
+ int ret_vis, hidden = 0, start = 0, end = 0;
42
+
43
+ PDC_LOG(("PDC_curs_set() - called: visibility=%d\n", visibility));
44
+
45
+ ret_vis = SP->visibility;
46
+ SP->visibility = visibility;
47
+
48
+ switch(visibility)
49
+ {
50
+ case 0: /* invisible */
51
+ #ifdef EMXVIDEO
52
+ start = end = 0;
53
+ #else
54
+ start = pdc_font / 4;
55
+ end = pdc_font;
56
+ hidden = -1;
57
+ #endif
58
+ break;
59
+
60
+ case 2: /* highly visible */
61
+ start = 2; /* almost full-height block */
62
+ end = pdc_font - 1;
63
+ break;
64
+
65
+ default: /* normal visibility */
66
+ start = (SP->orig_cursor >> 8) & 0xff;
67
+ end = SP->orig_cursor & 0xff;
68
+ }
69
+
70
+ #ifdef EMXVIDEO
71
+ if (!visibility)
72
+ v_hidecursor();
73
+ else
74
+ v_ctype(start, end);
75
+ #else
76
+ pvioCursorInfo.yStart = (USHORT)start;
77
+ pvioCursorInfo.cEnd = (USHORT)end;
78
+ pvioCursorInfo.cx = (USHORT)1;
79
+ pvioCursorInfo.attr = hidden;
80
+ VioSetCurType((PVIOCURSORINFO)&pvioCursorInfo, 0);
81
+ #endif
82
+ return ret_vis;
83
+ }
84
+
85
+ void PDC_set_title(const char *title)
86
+ {
87
+ PDC_LOG(("PDC_set_title() - called:<%s>\n", title));
88
+ }
89
+
90
+ int PDC_set_blink(bool blinkon)
91
+ {
92
+ #ifndef EMXVIDEO
93
+ USHORT statebuf[3], result;
94
+
95
+ statebuf[0] = 6; /* length */
96
+ statebuf[1] = 2; /* blink/intensity */
97
+ statebuf[2] = !blinkon;
98
+
99
+ result = VioSetState(&statebuf, 0);
100
+ VioGetState(&statebuf, 0); /* needed? */
101
+
102
+ if (pdc_color_started)
103
+ COLORS = statebuf[2] ? 16 : 8;
104
+
105
+ return (result == 0) ? OK : ERR;
106
+ #else
107
+ if (pdc_color_started)
108
+ COLORS = 16;
109
+
110
+ return blinkon ? ERR : OK;
111
+ #endif
112
+ }
@@ -0,0 +1,52 @@
1
+ /* Public Domain Curses */
2
+
3
+ #include "pdcos2.h"
4
+
5
+ #if defined(OS2) && !defined(__EMX__)
6
+ APIRET APIENTRY DosSleep(ULONG ulTime);
7
+ #endif
8
+
9
+ void PDC_beep(void)
10
+ {
11
+ PDC_LOG(("PDC_beep() - called\n"));
12
+
13
+ #ifdef EMXVIDEO
14
+ putchar('\007');
15
+ #else
16
+ DosBeep(1380, 100);
17
+ #endif
18
+ }
19
+
20
+ void PDC_napms(int ms)
21
+ {
22
+ PDC_LOG(("PDC_napms() - called: ms=%d\n", ms));
23
+
24
+ #ifdef __EMX__
25
+ _sleep2(ms);
26
+ #else
27
+ DosSleep(ms);
28
+ #endif
29
+ }
30
+
31
+ const char *PDC_sysname(void)
32
+ {
33
+ return "OS/2";
34
+ }
35
+
36
+ PDCEX PDC_version_info PDC_version = { PDC_PORT_OS2,
37
+ PDC_VER_MAJOR, PDC_VER_MINOR, PDC_VER_CHANGE,
38
+ sizeof( chtype),
39
+ /* note that thus far, 'wide' and 'UTF8' versions exist */
40
+ /* only for SDL2, X11, Win32, and Win32a; elsewhere, */
41
+ /* these will be FALSE */
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
+ };
@@ -0,0 +1,56 @@
1
+ /* Public Domain Curses */
2
+
3
+ /*----------------------------------------------------------------------*
4
+ * Panels for PDCurses *
5
+ *----------------------------------------------------------------------*/
6
+
7
+ #ifndef __PDCURSES_PANEL_H__
8
+ #define __PDCURSES_PANEL_H__ 1
9
+
10
+ #include <curses.h>
11
+
12
+ #if defined(__cplusplus) || defined(__cplusplus__) || defined(__CPLUSPLUS)
13
+ extern "C"
14
+ {
15
+ #endif
16
+
17
+ typedef struct panelobs
18
+ {
19
+ struct panelobs *above;
20
+ struct panel *pan;
21
+ } PANELOBS;
22
+
23
+ typedef struct panel
24
+ {
25
+ WINDOW *win;
26
+ int wstarty;
27
+ int wendy;
28
+ int wstartx;
29
+ int wendx;
30
+ struct panel *below;
31
+ struct panel *above;
32
+ const void *user;
33
+ struct panelobs *obscure;
34
+ } PANEL;
35
+
36
+ PDCEX int bottom_panel(PANEL *pan);
37
+ PDCEX int del_panel(PANEL *pan);
38
+ PDCEX int hide_panel(PANEL *pan);
39
+ PDCEX int move_panel(PANEL *pan, int starty, int startx);
40
+ PDCEX PANEL *new_panel(WINDOW *win);
41
+ PDCEX PANEL *panel_above(const PANEL *pan);
42
+ PDCEX PANEL *panel_below(const PANEL *pan);
43
+ PDCEX int panel_hidden(const PANEL *pan);
44
+ PDCEX const void *panel_userptr(const PANEL *pan);
45
+ PDCEX WINDOW *panel_window(const PANEL *pan);
46
+ PDCEX int replace_panel(PANEL *pan, WINDOW *win);
47
+ PDCEX int set_panel_userptr(PANEL *pan, const void *uptr);
48
+ PDCEX int show_panel(PANEL *pan);
49
+ PDCEX int top_panel(PANEL *pan);
50
+ PDCEX void update_panels(void);
51
+
52
+ #if defined(__cplusplus) || defined(__cplusplus__) || defined(__CPLUSPLUS)
53
+ }
54
+ #endif
55
+
56
+ #endif /* __PDCURSES_PANEL_H__ */