curses 1.4.4 → 1.4.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (258) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +6 -0
  3. data/.github/workflows/macos.yml +1 -1
  4. data/.github/workflows/push_gem.yml +48 -0
  5. data/.github/workflows/ubuntu.yml +2 -2
  6. data/.github/workflows/windows.yml +2 -2
  7. data/History.md +23 -0
  8. data/README.md +7 -0
  9. data/curses.gemspec +1 -1
  10. data/ext/curses/curses.c +7 -7
  11. data/sample/colors.rb +6 -1
  12. data/sample/form.rb +1 -1
  13. data/sample/menu.rb +2 -0
  14. metadata +9 -251
  15. data/vendor/PDCurses/.gitignore +0 -47
  16. data/vendor/PDCurses/.travis.yml +0 -49
  17. data/vendor/PDCurses/CMakeLists.txt +0 -68
  18. data/vendor/PDCurses/HISTORY.md +0 -2036
  19. data/vendor/PDCurses/IMPLEMNT.md +0 -327
  20. data/vendor/PDCurses/Makefile +0 -27
  21. data/vendor/PDCurses/README.md +0 -77
  22. data/vendor/PDCurses/acs_defs.h +0 -265
  23. data/vendor/PDCurses/appveyor.yml +0 -218
  24. data/vendor/PDCurses/cmake/README.md +0 -71
  25. data/vendor/PDCurses/cmake/build_dependencies.cmake +0 -178
  26. data/vendor/PDCurses/cmake/build_options.cmake +0 -25
  27. data/vendor/PDCurses/cmake/dll_version.cmake +0 -26
  28. data/vendor/PDCurses/cmake/gen_config_header.cmake +0 -43
  29. data/vendor/PDCurses/cmake/get_version.cmake +0 -17
  30. data/vendor/PDCurses/cmake/make_uninstall.cmake +0 -19
  31. data/vendor/PDCurses/cmake/project_common.cmake +0 -121
  32. data/vendor/PDCurses/cmake/resource.in.cmake +0 -52
  33. data/vendor/PDCurses/cmake/sdl2_ttf/CMakeLists.txt +0 -83
  34. data/vendor/PDCurses/cmake/target_arch.cmake +0 -36
  35. data/vendor/PDCurses/cmake/version.in.cmake +0 -73
  36. data/vendor/PDCurses/cmake/watcom_open_dos16_toolchain.cmake +0 -96
  37. data/vendor/PDCurses/cmake/watcom_open_dos32_toolchain.cmake +0 -106
  38. data/vendor/PDCurses/cmake/watcom_open_os2v2_toolchain.cmake +0 -105
  39. data/vendor/PDCurses/curses.h +0 -1846
  40. data/vendor/PDCurses/curspriv.h +0 -134
  41. data/vendor/PDCurses/demos/README.md +0 -25
  42. data/vendor/PDCurses/demos/firework.c +0 -144
  43. data/vendor/PDCurses/demos/newtest.c +0 -581
  44. data/vendor/PDCurses/demos/ozdemo.c +0 -447
  45. data/vendor/PDCurses/demos/ptest.c +0 -283
  46. data/vendor/PDCurses/demos/rain.c +0 -157
  47. data/vendor/PDCurses/demos/testcurs.c +0 -1607
  48. data/vendor/PDCurses/demos/tui.c +0 -1048
  49. data/vendor/PDCurses/demos/tui.h +0 -65
  50. data/vendor/PDCurses/demos/tuidemo.c +0 -233
  51. data/vendor/PDCurses/demos/version.c +0 -61
  52. data/vendor/PDCurses/demos/worm.c +0 -432
  53. data/vendor/PDCurses/demos/xmas.c +0 -955
  54. data/vendor/PDCurses/dos/CMakeLists.txt +0 -47
  55. data/vendor/PDCurses/dos/Makefile +0 -105
  56. data/vendor/PDCurses/dos/Makefile.bcc +0 -83
  57. data/vendor/PDCurses/dos/Makefile.dmc +0 -257
  58. data/vendor/PDCurses/dos/Makefile.msc +0 -113
  59. data/vendor/PDCurses/dos/Makefile.wcc +0 -107
  60. data/vendor/PDCurses/dos/README.md +0 -51
  61. data/vendor/PDCurses/dos/bccdos.lrf +0 -9
  62. data/vendor/PDCurses/dos/mscdos.lrf +0 -50
  63. data/vendor/PDCurses/dos/pdcclip.c +0 -132
  64. data/vendor/PDCurses/dos/pdcdisp.c +0 -135
  65. data/vendor/PDCurses/dos/pdcdos.h +0 -194
  66. data/vendor/PDCurses/dos/pdcgetsc.c +0 -98
  67. data/vendor/PDCurses/dos/pdckbd.c +0 -513
  68. data/vendor/PDCurses/dos/pdcscrn.c +0 -785
  69. data/vendor/PDCurses/dos/pdcsetsc.c +0 -101
  70. data/vendor/PDCurses/dos/pdcutil.c +0 -212
  71. data/vendor/PDCurses/libobjs.mif +0 -26
  72. data/vendor/PDCurses/makedist.mif +0 -20
  73. data/vendor/PDCurses/man/Makefile +0 -37
  74. data/vendor/PDCurses/man/README.md +0 -21
  75. data/vendor/PDCurses/man/intro.md +0 -361
  76. data/vendor/PDCurses/man/manext.c +0 -119
  77. data/vendor/PDCurses/man/sdl.md +0 -152
  78. data/vendor/PDCurses/man/sdl2.md +0 -58
  79. data/vendor/PDCurses/man/x11.md +0 -407
  80. data/vendor/PDCurses/ncurses/CMakeLists.txt +0 -66
  81. data/vendor/PDCurses/ncurses/README.md +0 -26
  82. data/vendor/PDCurses/ncurses/makefile +0 -29
  83. data/vendor/PDCurses/os2/CMakeLists.txt +0 -41
  84. data/vendor/PDCurses/os2/Makefile +0 -132
  85. data/vendor/PDCurses/os2/Makefile.bcc +0 -90
  86. data/vendor/PDCurses/os2/Makefile.wcc +0 -43
  87. data/vendor/PDCurses/os2/README.md +0 -43
  88. data/vendor/PDCurses/os2/iccos2.lrf +0 -50
  89. data/vendor/PDCurses/os2/iccos2.mak +0 -256
  90. data/vendor/PDCurses/os2/pdcclip.c +0 -188
  91. data/vendor/PDCurses/os2/pdcdisp.c +0 -93
  92. data/vendor/PDCurses/os2/pdcgetsc.c +0 -89
  93. data/vendor/PDCurses/os2/pdckbd.c +0 -521
  94. data/vendor/PDCurses/os2/pdcos2.h +0 -55
  95. data/vendor/PDCurses/os2/pdcscrn.c +0 -449
  96. data/vendor/PDCurses/os2/pdcsetsc.c +0 -112
  97. data/vendor/PDCurses/os2/pdcutil.c +0 -52
  98. data/vendor/PDCurses/panel.h +0 -56
  99. data/vendor/PDCurses/pdcurses/README.md +0 -25
  100. data/vendor/PDCurses/pdcurses/addch.c +0 -693
  101. data/vendor/PDCurses/pdcurses/addchstr.c +0 -245
  102. data/vendor/PDCurses/pdcurses/addstr.c +0 -240
  103. data/vendor/PDCurses/pdcurses/attr.c +0 -359
  104. data/vendor/PDCurses/pdcurses/beep.c +0 -68
  105. data/vendor/PDCurses/pdcurses/bkgd.c +0 -223
  106. data/vendor/PDCurses/pdcurses/border.c +0 -411
  107. data/vendor/PDCurses/pdcurses/clear.c +0 -159
  108. data/vendor/PDCurses/pdcurses/color.c +0 -298
  109. data/vendor/PDCurses/pdcurses/debug.c +0 -109
  110. data/vendor/PDCurses/pdcurses/delch.c +0 -96
  111. data/vendor/PDCurses/pdcurses/deleteln.c +0 -211
  112. data/vendor/PDCurses/pdcurses/deprec.c +0 -27
  113. data/vendor/PDCurses/pdcurses/getch.c +0 -417
  114. data/vendor/PDCurses/pdcurses/getstr.c +0 -474
  115. data/vendor/PDCurses/pdcurses/getyx.c +0 -139
  116. data/vendor/PDCurses/pdcurses/inch.c +0 -127
  117. data/vendor/PDCurses/pdcurses/inchstr.c +0 -214
  118. data/vendor/PDCurses/pdcurses/initscr.c +0 -367
  119. data/vendor/PDCurses/pdcurses/inopts.c +0 -324
  120. data/vendor/PDCurses/pdcurses/insch.c +0 -271
  121. data/vendor/PDCurses/pdcurses/insstr.c +0 -264
  122. data/vendor/PDCurses/pdcurses/instr.c +0 -246
  123. data/vendor/PDCurses/pdcurses/kernel.c +0 -259
  124. data/vendor/PDCurses/pdcurses/keyname.c +0 -157
  125. data/vendor/PDCurses/pdcurses/mouse.c +0 -438
  126. data/vendor/PDCurses/pdcurses/move.c +0 -57
  127. data/vendor/PDCurses/pdcurses/outopts.c +0 -159
  128. data/vendor/PDCurses/pdcurses/overlay.c +0 -214
  129. data/vendor/PDCurses/pdcurses/pad.c +0 -260
  130. data/vendor/PDCurses/pdcurses/panel.c +0 -633
  131. data/vendor/PDCurses/pdcurses/printw.c +0 -126
  132. data/vendor/PDCurses/pdcurses/refresh.c +0 -279
  133. data/vendor/PDCurses/pdcurses/scanw.c +0 -578
  134. data/vendor/PDCurses/pdcurses/scr_dump.c +0 -213
  135. data/vendor/PDCurses/pdcurses/scroll.c +0 -101
  136. data/vendor/PDCurses/pdcurses/slk.c +0 -591
  137. data/vendor/PDCurses/pdcurses/termattr.c +0 -182
  138. data/vendor/PDCurses/pdcurses/terminfo.c +0 -217
  139. data/vendor/PDCurses/pdcurses/touch.c +0 -163
  140. data/vendor/PDCurses/pdcurses/util.c +0 -312
  141. data/vendor/PDCurses/pdcurses/window.c +0 -569
  142. data/vendor/PDCurses/sdl1/Makefile +0 -129
  143. data/vendor/PDCurses/sdl1/Makefile.mng +0 -110
  144. data/vendor/PDCurses/sdl1/README.md +0 -31
  145. data/vendor/PDCurses/sdl1/deffont.h +0 -385
  146. data/vendor/PDCurses/sdl1/deficon.h +0 -23
  147. data/vendor/PDCurses/sdl1/pdcclip.c +0 -131
  148. data/vendor/PDCurses/sdl1/pdcdisp.c +0 -373
  149. data/vendor/PDCurses/sdl1/pdcgetsc.c +0 -30
  150. data/vendor/PDCurses/sdl1/pdckbd.c +0 -405
  151. data/vendor/PDCurses/sdl1/pdcscrn.c +0 -414
  152. data/vendor/PDCurses/sdl1/pdcsdl.h +0 -31
  153. data/vendor/PDCurses/sdl1/pdcsetsc.c +0 -64
  154. data/vendor/PDCurses/sdl1/pdcutil.c +0 -40
  155. data/vendor/PDCurses/sdl1/sdltest.c +0 -79
  156. data/vendor/PDCurses/sdl2/CMakeLists.txt +0 -76
  157. data/vendor/PDCurses/sdl2/Makefile +0 -135
  158. data/vendor/PDCurses/sdl2/Makefile.vc +0 -164
  159. data/vendor/PDCurses/sdl2/README.md +0 -34
  160. data/vendor/PDCurses/sdl2/deffont.h +0 -385
  161. data/vendor/PDCurses/sdl2/deficon.h +0 -23
  162. data/vendor/PDCurses/sdl2/pdcclip.c +0 -93
  163. data/vendor/PDCurses/sdl2/pdcdisp.c +0 -534
  164. data/vendor/PDCurses/sdl2/pdcgetsc.c +0 -30
  165. data/vendor/PDCurses/sdl2/pdckbd.c +0 -480
  166. data/vendor/PDCurses/sdl2/pdcscrn.c +0 -443
  167. data/vendor/PDCurses/sdl2/pdcsdl.h +0 -33
  168. data/vendor/PDCurses/sdl2/pdcsetsc.c +0 -67
  169. data/vendor/PDCurses/sdl2/pdcutil.c +0 -39
  170. data/vendor/PDCurses/sdl2/sdltest.c +0 -81
  171. data/vendor/PDCurses/term.h +0 -48
  172. data/vendor/PDCurses/version.mif +0 -7
  173. data/vendor/PDCurses/vt/CMakeLists.txt +0 -28
  174. data/vendor/PDCurses/vt/Makefile +0 -135
  175. data/vendor/PDCurses/vt/Makefile.bcc +0 -111
  176. data/vendor/PDCurses/vt/Makefile.dmc +0 -258
  177. data/vendor/PDCurses/vt/Makefile.vc +0 -144
  178. data/vendor/PDCurses/vt/Makefile.wcc +0 -107
  179. data/vendor/PDCurses/vt/README.md +0 -64
  180. data/vendor/PDCurses/vt/pdcclip.c +0 -20
  181. data/vendor/PDCurses/vt/pdcdisp.c +0 -284
  182. data/vendor/PDCurses/vt/pdcgetsc.c +0 -27
  183. data/vendor/PDCurses/vt/pdckbd.c +0 -394
  184. data/vendor/PDCurses/vt/pdcscrn.c +0 -434
  185. data/vendor/PDCurses/vt/pdcsetsc.c +0 -45
  186. data/vendor/PDCurses/vt/pdcutil.c +0 -43
  187. data/vendor/PDCurses/vt/pdcvt.h +0 -16
  188. data/vendor/PDCurses/watcom.mif +0 -68
  189. data/vendor/PDCurses/wincon/CMakeLists.txt +0 -27
  190. data/vendor/PDCurses/wincon/Makefile.bcc +0 -88
  191. data/vendor/PDCurses/wincon/Makefile.dmc +0 -256
  192. data/vendor/PDCurses/wincon/Makefile.lcc +0 -273
  193. data/vendor/PDCurses/wincon/Makefile.mng +0 -176
  194. data/vendor/PDCurses/wincon/Makefile.vc +0 -144
  195. data/vendor/PDCurses/wincon/Makefile.wcc +0 -51
  196. data/vendor/PDCurses/wincon/README.md +0 -85
  197. data/vendor/PDCurses/wincon/pdcclip.c +0 -174
  198. data/vendor/PDCurses/wincon/pdcdisp.c +0 -143
  199. data/vendor/PDCurses/wincon/pdcgetsc.c +0 -55
  200. data/vendor/PDCurses/wincon/pdckbd.c +0 -786
  201. data/vendor/PDCurses/wincon/pdcscrn.c +0 -717
  202. data/vendor/PDCurses/wincon/pdcsetsc.c +0 -91
  203. data/vendor/PDCurses/wincon/pdcurses.ico +0 -0
  204. data/vendor/PDCurses/wincon/pdcurses.rc +0 -28
  205. data/vendor/PDCurses/wincon/pdcutil.c +0 -41
  206. data/vendor/PDCurses/wincon/pdcwin.h +0 -31
  207. data/vendor/PDCurses/wingui/CMakeLists.txt +0 -27
  208. data/vendor/PDCurses/wingui/Makefile.bcc +0 -85
  209. data/vendor/PDCurses/wingui/Makefile.dmc +0 -259
  210. data/vendor/PDCurses/wingui/Makefile.lcc +0 -273
  211. data/vendor/PDCurses/wingui/Makefile.mng +0 -171
  212. data/vendor/PDCurses/wingui/Makefile.vc +0 -144
  213. data/vendor/PDCurses/wingui/Makefile.wcc +0 -51
  214. data/vendor/PDCurses/wingui/README.md +0 -93
  215. data/vendor/PDCurses/wingui/pdcclip.c +0 -174
  216. data/vendor/PDCurses/wingui/pdcdisp.c +0 -718
  217. data/vendor/PDCurses/wingui/pdcgetsc.c +0 -30
  218. data/vendor/PDCurses/wingui/pdckbd.c +0 -143
  219. data/vendor/PDCurses/wingui/pdcscrn.c +0 -2797
  220. data/vendor/PDCurses/wingui/pdcsetsc.c +0 -89
  221. data/vendor/PDCurses/wingui/pdcurses.ico +0 -0
  222. data/vendor/PDCurses/wingui/pdcurses.rc +0 -28
  223. data/vendor/PDCurses/wingui/pdcutil.c +0 -61
  224. data/vendor/PDCurses/wingui/pdcwin.h +0 -122
  225. data/vendor/PDCurses/x11/Makefile.in +0 -754
  226. data/vendor/PDCurses/x11/PDCurses.spec +0 -82
  227. data/vendor/PDCurses/x11/README.md +0 -62
  228. data/vendor/PDCurses/x11/ScrollBox.c +0 -319
  229. data/vendor/PDCurses/x11/ScrollBox.h +0 -51
  230. data/vendor/PDCurses/x11/ScrollBoxP.h +0 -70
  231. data/vendor/PDCurses/x11/aclocal.m4 +0 -994
  232. data/vendor/PDCurses/x11/big_icon.xbm +0 -46
  233. data/vendor/PDCurses/x11/compose.h +0 -201
  234. data/vendor/PDCurses/x11/config.guess +0 -1500
  235. data/vendor/PDCurses/x11/config.h.in +0 -100
  236. data/vendor/PDCurses/x11/config.sub +0 -1616
  237. data/vendor/PDCurses/x11/configure +0 -6700
  238. data/vendor/PDCurses/x11/configure.ac +0 -295
  239. data/vendor/PDCurses/x11/debian/changelog +0 -6
  240. data/vendor/PDCurses/x11/debian/compat +0 -1
  241. data/vendor/PDCurses/x11/debian/control +0 -11
  242. data/vendor/PDCurses/x11/debian/copyright +0 -27
  243. data/vendor/PDCurses/x11/debian/rules +0 -98
  244. data/vendor/PDCurses/x11/install-sh +0 -253
  245. data/vendor/PDCurses/x11/little_icon.xbm +0 -14
  246. data/vendor/PDCurses/x11/ncurses_cfg.h +0 -45
  247. data/vendor/PDCurses/x11/pdcclip.c +0 -173
  248. data/vendor/PDCurses/x11/pdcdisp.c +0 -85
  249. data/vendor/PDCurses/x11/pdcgetsc.c +0 -28
  250. data/vendor/PDCurses/x11/pdckbd.c +0 -104
  251. data/vendor/PDCurses/x11/pdcscrn.c +0 -258
  252. data/vendor/PDCurses/x11/pdcsetsc.c +0 -95
  253. data/vendor/PDCurses/x11/pdcutil.c +0 -52
  254. data/vendor/PDCurses/x11/pdcx11.c +0 -316
  255. data/vendor/PDCurses/x11/pdcx11.h +0 -191
  256. data/vendor/PDCurses/x11/sb.c +0 -155
  257. data/vendor/PDCurses/x11/x11.c +0 -3686
  258. data/vendor/PDCurses/x11/xcurses-config.in +0 -81
@@ -1,93 +0,0 @@
1
- /* Public Domain Curses */
2
-
3
- #include "pdcos2.h"
4
-
5
- /* ACS definitions originally by jshumate@wrdis01.robins.af.mil -- these
6
- match code page 437 and compatible pages (CP850, CP852, etc.) */
7
-
8
- #ifdef CHTYPE_LONG
9
-
10
- # define A(x) ((chtype)x | A_ALTCHARSET)
11
-
12
- chtype acs_map[128] =
13
- {
14
- A(0), A(1), A(2), A(3), A(4), A(5), A(6), A(7), A(8), A(9),
15
- A(10), A(11), A(12), A(13), A(14), A(15), A(16), A(17), A(18),
16
- A(19), A(20), A(21), A(22), A(23), A(24), A(25), A(26), A(27),
17
- A(28), A(29), A(30), A(31), ' ', '!', '"', '#', '$', '%', '&',
18
- '\'', '(', ')', '*',
19
-
20
- A(0x1a), A(0x1b), A(0x18), A(0x19),
21
-
22
- '/',
23
-
24
- 0xdb,
25
-
26
- '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=',
27
- '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
28
- 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
29
- 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
30
-
31
- A(0x04), 0xb1,
32
-
33
- 'b', 'c', 'd', 'e',
34
-
35
- 0xf8, 0xf1, 0xb0, A(0x0f), 0xd9, 0xbf, 0xda, 0xc0, 0xc5, 0x2d,
36
- 0x2d, 0xc4, 0x2d, 0x5f, 0xc3, 0xb4, 0xc1, 0xc2, 0xb3, 0xf3,
37
- 0xf2, 0xe3, 0xd8, 0x9c, 0xf9,
38
-
39
- A(127)
40
- };
41
-
42
- # undef A
43
-
44
- #endif
45
-
46
- /* position hardware cursor at (y, x) */
47
-
48
- void PDC_gotoyx(int row, int col)
49
- {
50
- PDC_LOG(("PDC_gotoyx() - called: row %d col %d\n", row, col));
51
-
52
- #ifdef EMXVIDEO
53
- v_gotoxy(col, row);
54
- #else
55
- VioSetCurPos(row, col, 0);
56
- #endif
57
- }
58
-
59
- /* update the given physical line to look like the corresponding line in
60
- curscr */
61
-
62
- void PDC_transform_line(int lineno, int x, int len, const chtype *srcp)
63
- {
64
- /* this should be enough for the maximum width of a screen. */
65
-
66
- struct {unsigned char text, attr;} temp_line[256];
67
- int j;
68
-
69
- PDC_LOG(("PDC_transform_line() - called: line %d\n", lineno));
70
-
71
- /* replace the attribute part of the chtype with the
72
- actual color value for each chtype in the line */
73
-
74
- for (j = 0; j < len; j++)
75
- {
76
- chtype ch = srcp[j];
77
-
78
- temp_line[j].attr = pdc_atrtab[ch >> PDC_ATTR_SHIFT];
79
-
80
- #ifdef CHTYPE_LONG
81
- if (ch & A_ALTCHARSET && !(ch & 0xff80))
82
- ch = acs_map[ch & 0x7f];
83
- #endif
84
- temp_line[j].text = ch & 0xff;
85
- }
86
-
87
- #ifdef EMXVIDEO
88
- v_putline((char *)temp_line, x, lineno, len);
89
- #else
90
- VioWrtCellStr((PCH)temp_line, (USHORT)(len * sizeof(unsigned short)),
91
- (USHORT)lineno, (USHORT)x, 0);
92
- #endif
93
- }
@@ -1,89 +0,0 @@
1
- /* Public Domain Curses */
2
-
3
- #include "pdcos2.h"
4
-
5
- /* return width of screen/viewport */
6
-
7
- int PDC_get_columns(void)
8
- {
9
- #ifdef EMXVIDEO
10
- int rows = 0;
11
- #else
12
- VIOMODEINFO modeInfo = {0};
13
- #endif
14
- int cols = 0;
15
- const char *env_cols;
16
-
17
- PDC_LOG(("PDC_get_columns() - called\n"));
18
-
19
- #ifdef EMXVIDEO
20
- v_dimen(&cols, &rows);
21
- #else
22
- modeInfo.cb = sizeof(modeInfo);
23
- VioGetMode(&modeInfo, 0);
24
- cols = modeInfo.col;
25
- #endif
26
- env_cols = getenv("COLS");
27
-
28
- if (env_cols)
29
- cols = min(atoi(env_cols), cols);
30
-
31
- PDC_LOG(("PDC_get_columns() - returned: cols %d\n", cols));
32
-
33
- return cols;
34
- }
35
-
36
- /* get the cursor size/shape */
37
-
38
- int PDC_get_cursor_mode(void)
39
- {
40
- #ifdef EMXVIDEO
41
- int curstart = 0, curend = 0;
42
- #else
43
- VIOCURSORINFO cursorInfo;
44
- #endif
45
- PDC_LOG(("PDC_get_cursor_mode() - called\n"));
46
-
47
- #ifdef EMXVIDEO
48
- v_getctype(&curstart, &curend);
49
- return (curstart << 8) | curend;
50
- #else
51
- VioGetCurType (&cursorInfo, 0);
52
-
53
- return (cursorInfo.yStart << 8) | cursorInfo.cEnd;
54
- #endif
55
- }
56
-
57
- /* return number of screen rows */
58
-
59
- int PDC_get_rows(void)
60
- {
61
- #ifdef EMXVIDEO
62
- int cols = 0;
63
- #else
64
- VIOMODEINFO modeInfo = {0};
65
- #endif
66
- int rows = 0;
67
- const char *env_rows;
68
-
69
- PDC_LOG(("PDC_get_rows() - called\n"));
70
-
71
- /* use the value from LINES environment variable, if set. MH 10-Jun-92 */
72
- /* and use the minimum of LINES and *ROWS. MH 18-Jun-92 */
73
-
74
- #ifdef EMXVIDEO
75
- v_dimen(&cols, &rows);
76
- #else
77
- modeInfo.cb = sizeof(modeInfo);
78
- VioGetMode(&modeInfo, 0);
79
- rows = modeInfo.row;
80
- #endif
81
- env_rows = getenv("LINES");
82
-
83
- if (env_rows)
84
- rows = min(atoi(env_rows), rows);
85
-
86
- PDC_LOG(("PDC_get_rows() - returned: rows %d\n", rows));
87
-
88
- return rows;
89
- }
@@ -1,521 +0,0 @@
1
- /* Public Domain Curses */
2
-
3
- #if defined(__EMX__) || defined(__WATCOMC__) || defined(__IBMC__) || \
4
- defined(__TURBOC__)
5
- # define HAVE_SIGNAL
6
- # include <signal.h>
7
- #endif
8
-
9
- #include "pdcos2.h"
10
-
11
- /*man-start**************************************************************
12
-
13
- pdckbd
14
- ------
15
-
16
- ### Synopsis
17
-
18
- unsigned long PDC_get_input_fd(void);
19
-
20
- ### Description
21
-
22
- PDC_get_input_fd() returns the file descriptor that PDCurses
23
- reads its input from. It can be used for select().
24
-
25
- ### Portability
26
- X/Open BSD SYS V
27
- PDC_get_input_fd - - -
28
-
29
- **man-end****************************************************************/
30
-
31
- #ifdef EMXVIDEO
32
- # include <termios.h>
33
- static int tahead = -1;
34
- #else
35
- static KBDINFO kbdinfo; /* default keyboard mode */
36
- static HMOU mouse_handle = 0;
37
- static MOUSE_STATUS old_mouse_status;
38
- static USHORT old_shift = 0;
39
- static bool key_pressed = FALSE;
40
- static int mouse_events = 0;
41
- #endif
42
-
43
- /************************************************************************
44
- * Table for key code translation of function keys in keypad mode *
45
- * These values are for strict IBM keyboard compatibles only *
46
- ************************************************************************/
47
-
48
- static short key_table[] =
49
- {
50
- -1, ALT_ESC, -1, 0,
51
- -1, -1, -1, -1,
52
- -1, -1, -1, -1,
53
- -1, -1, ALT_BKSP, KEY_BTAB,
54
- ALT_Q, ALT_W, ALT_E, ALT_R,
55
- ALT_T, ALT_Y, ALT_U, ALT_I,
56
- ALT_O, ALT_P, ALT_LBRACKET, ALT_RBRACKET,
57
- ALT_ENTER, -1, ALT_A, ALT_S,
58
- ALT_D, ALT_F, ALT_G, ALT_H,
59
- ALT_J, ALT_K, ALT_L, ALT_SEMICOLON,
60
- ALT_FQUOTE, ALT_BQUOTE, -1, ALT_BSLASH,
61
- ALT_Z, ALT_X, ALT_C, ALT_V,
62
- ALT_B, ALT_N, ALT_M, ALT_COMMA,
63
- ALT_STOP, ALT_FSLASH, -1, ALT_PADSTAR,
64
- -1, -1, -1, KEY_F(1),
65
- KEY_F(2), KEY_F(3), KEY_F(4), KEY_F(5),
66
- KEY_F(6), KEY_F(7), KEY_F(8), KEY_F(9),
67
- KEY_F(10), -1, -1, KEY_HOME,
68
- KEY_UP, KEY_PPAGE, ALT_PADMINUS, KEY_LEFT,
69
- KEY_B2, KEY_RIGHT, ALT_PADPLUS, KEY_END,
70
- KEY_DOWN, KEY_NPAGE, KEY_IC, KEY_DC,
71
- KEY_F(13), KEY_F(14), KEY_F(15), KEY_F(16),
72
- KEY_F(17), KEY_F(18), KEY_F(19), KEY_F(20),
73
- KEY_F(21), KEY_F(22), KEY_F(25), KEY_F(26),
74
- KEY_F(27), KEY_F(28), KEY_F(29), KEY_F(30),
75
- KEY_F(31), KEY_F(32), KEY_F(33), KEY_F(34),
76
- KEY_F(37), KEY_F(38), KEY_F(39), KEY_F(40),
77
- KEY_F(41), KEY_F(42), KEY_F(43), KEY_F(44),
78
- KEY_F(45), KEY_F(46), -1, CTL_LEFT,
79
- CTL_RIGHT, CTL_END, CTL_PGDN, CTL_HOME,
80
- ALT_1, ALT_2, ALT_3, ALT_4,
81
- ALT_5, ALT_6, ALT_7, ALT_8,
82
- ALT_9, ALT_0, ALT_MINUS, ALT_EQUAL,
83
- CTL_PGUP, KEY_F(11), KEY_F(12), KEY_F(23),
84
- KEY_F(24), KEY_F(35), KEY_F(36), KEY_F(47),
85
- KEY_F(48), CTL_UP, CTL_PADMINUS, CTL_PADCENTER,
86
- CTL_PADPLUS, CTL_DOWN, CTL_INS, CTL_DEL,
87
- CTL_TAB, CTL_PADSLASH, CTL_PADSTAR, ALT_HOME,
88
- ALT_UP, ALT_PGUP, -1, ALT_LEFT,
89
- -1, ALT_RIGHT, -1, ALT_END,
90
- ALT_DOWN, ALT_PGDN, ALT_INS, ALT_DEL,
91
- ALT_PADSLASH, ALT_TAB, ALT_PADENTER, -1
92
- };
93
-
94
- unsigned long pdc_key_modifiers = 0L;
95
-
96
- unsigned long PDC_get_input_fd(void)
97
- {
98
- PDC_LOG(("PDC_get_input_fd() - called\n"));
99
-
100
- return (unsigned long)fileno(stdin);
101
- }
102
-
103
- #ifndef EMXVIDEO
104
-
105
- void PDC_get_keyboard_info(void)
106
- {
107
- kbdinfo.cb = sizeof(kbdinfo);
108
- KbdGetStatus(&kbdinfo, 0);
109
- }
110
-
111
- void PDC_set_keyboard_default(void)
112
- {
113
- KbdSetStatus(&kbdinfo, 0);
114
- }
115
-
116
- #endif /* ifndef EMXVIDEO */
117
-
118
- void PDC_set_keyboard_binary(bool on)
119
- {
120
- PDC_LOG(("PDC_set_keyboard_binary() - called\n"));
121
-
122
- #ifndef EMXVIDEO
123
- if (on)
124
- {
125
- kbdinfo.fsMask &= ~(KEYBOARD_ASCII_MODE);
126
- kbdinfo.fsMask |= KEYBOARD_BINARY_MODE;
127
- }
128
- else
129
- {
130
- kbdinfo.fsMask &= ~(KEYBOARD_BINARY_MODE);
131
- kbdinfo.fsMask |= KEYBOARD_ASCII_MODE;
132
- }
133
-
134
- KbdSetStatus(&kbdinfo, 0);
135
- #endif
136
-
137
- #ifdef HAVE_SIGNAL
138
- signal(SIGBREAK, on ? SIG_IGN : SIG_DFL);
139
- #endif
140
- }
141
-
142
- /* check if a key or mouse event is waiting */
143
-
144
- bool PDC_check_key(void)
145
- {
146
- #if !defined(_MSC_VER) && !defined(EMXVIDEO)
147
- KBDKEYINFO keyInfo = {0};
148
- #endif
149
-
150
- #ifdef EMXVIDEO
151
- if (tahead == -1) /* Nothing typed yet */
152
- {
153
- tahead = _read_kbd(0, 0, 0);
154
-
155
- /* Read additional */
156
-
157
- if (tahead == 0)
158
- tahead = _read_kbd(0, 1, 0) << 8;
159
- }
160
-
161
- return (tahead != -1);
162
- #else
163
- # ifndef _MSC_VER
164
-
165
- KbdGetStatus(&kbdinfo, 0);
166
-
167
- if (mouse_handle)
168
- {
169
- MOUQUEINFO queue;
170
-
171
- MouGetNumQueEl(&queue, mouse_handle);
172
- mouse_events = queue.cEvents;
173
-
174
- if (mouse_events)
175
- return TRUE;
176
- }
177
-
178
- if (old_shift && !kbdinfo.fsState) /* modifier released */
179
- {
180
- if (!key_pressed && SP->return_key_modifiers)
181
- return TRUE;
182
- }
183
- else if (!old_shift && kbdinfo.fsState) /* modifier pressed */
184
- key_pressed = FALSE;
185
-
186
- old_shift = kbdinfo.fsState;
187
-
188
- KbdPeek(&keyInfo, 0); /* peek at keyboard */
189
- return (keyInfo.fbStatus != 0);
190
- # else
191
- return kbhit();
192
- # endif
193
- #endif
194
- }
195
-
196
- #ifndef EMXVIDEO
197
-
198
- static int _process_mouse_events(void)
199
- {
200
- MOUEVENTINFO event;
201
- static const USHORT button_mask[] = {6, 96, 24},
202
- move_mask[] = {2, 32, 8},
203
- press_mask[] = {4, 64, 16};
204
- USHORT count = 1;
205
- short shift_flags = 0;
206
- int i;
207
-
208
- MouReadEventQue(&event, &count, mouse_handle);
209
- mouse_events--;
210
-
211
- for (i = 0; i < 3; i++)
212
- {
213
- pdc_mouse_status.button[i] =
214
- ((event.fs & move_mask[i]) ? BUTTON_MOVED : 0) |
215
- ((event.fs & press_mask[i]) ? BUTTON_PRESSED : 0);
216
-
217
- /* PRESS events are sometimes mistakenly reported as MOVE
218
- events. A MOVE should always follow a PRESS, so treat a MOVE
219
- immediately after a RELEASE as a PRESS. */
220
-
221
- if ((pdc_mouse_status.button[i] == BUTTON_MOVED) &&
222
- (old_mouse_status.button[i] == BUTTON_RELEASED))
223
- {
224
- pdc_mouse_status.button[i] = BUTTON_PRESSED;
225
- }
226
-
227
- if (pdc_mouse_status.button[i] == BUTTON_PRESSED && SP->mouse_wait)
228
- {
229
- /* Check for a click -- a PRESS followed immediately by a
230
- release */
231
-
232
- if (!mouse_events)
233
- {
234
- MOUQUEINFO queue;
235
-
236
- napms(SP->mouse_wait);
237
-
238
- MouGetNumQueEl(&queue, mouse_handle);
239
- mouse_events = queue.cEvents;
240
- }
241
-
242
- if (mouse_events)
243
- {
244
- MouReadEventQue(&event, &count, mouse_handle);
245
-
246
- if (!(event.fs & button_mask[i]))
247
- pdc_mouse_status.button[i] = BUTTON_CLICKED;
248
- }
249
- }
250
- }
251
-
252
- pdc_mouse_status.x = event.col;
253
- pdc_mouse_status.y = event.row;
254
-
255
- pdc_mouse_status.changes = 0;
256
-
257
- for (i = 0; i < 3; i++)
258
- {
259
- if (old_mouse_status.button[i] != pdc_mouse_status.button[i])
260
- pdc_mouse_status.changes |= (1 << i);
261
-
262
- if (pdc_mouse_status.button[i] == BUTTON_MOVED)
263
- {
264
- /* Discard non-moved "moves" */
265
-
266
- if (pdc_mouse_status.x == old_mouse_status.x &&
267
- pdc_mouse_status.y == old_mouse_status.y)
268
- return -1;
269
-
270
- /* Motion events always flag the button as changed */
271
-
272
- pdc_mouse_status.changes |= (1 << i);
273
- pdc_mouse_status.changes |= PDC_MOUSE_MOVED;
274
- break;
275
- }
276
- }
277
-
278
- old_mouse_status = pdc_mouse_status;
279
-
280
- /* Treat click events as release events for comparison purposes */
281
-
282
- for (i = 0; i < 3; i++)
283
- {
284
- if (old_mouse_status.button[i] == BUTTON_CLICKED)
285
- old_mouse_status.button[i] = BUTTON_RELEASED;
286
- }
287
-
288
- /* Check for SHIFT/CONTROL/ALT */
289
-
290
- if (kbdinfo.fsState & KBDSTF_ALT)
291
- shift_flags |= BUTTON_ALT;
292
-
293
- if (kbdinfo.fsState & KBDSTF_CONTROL)
294
- shift_flags |= BUTTON_CONTROL;
295
-
296
- if (kbdinfo.fsState & (KBDSTF_LEFTSHIFT|KBDSTF_RIGHTSHIFT))
297
- shift_flags |= BUTTON_SHIFT;
298
-
299
- if (shift_flags)
300
- {
301
- for (i = 0; i < 3; i++)
302
- {
303
- if (pdc_mouse_status.changes & (1 << i))
304
- pdc_mouse_status.button[i] |= shift_flags;
305
- }
306
- }
307
-
308
- old_shift = kbdinfo.fsState;
309
- key_pressed = TRUE;
310
-
311
- SP->key_code = TRUE;
312
- return KEY_MOUSE;
313
- }
314
-
315
- #endif
316
-
317
- /* return the next available key or mouse event */
318
-
319
- int PDC_get_key(void)
320
- {
321
- int key, scan;
322
- #ifndef EMXVIDEO
323
- KBDKEYINFO keyInfo = {0};
324
- #endif
325
-
326
- #ifdef EMXVIDEO
327
- if (tahead == -1)
328
- {
329
- tahead = _read_kbd(0, 1, 0);
330
-
331
- /* Read additional */
332
-
333
- if (tahead == 0)
334
- tahead = _read_kbd(0, 1, 0) << 8;
335
- }
336
-
337
- key = tahead & 0xff;
338
- scan = tahead >> 8;
339
- pdc_key_modifiers = 0L;
340
-
341
- tahead = -1;
342
- #else
343
- pdc_key_modifiers = 0L;
344
-
345
- if (mouse_handle && mouse_events)
346
- return _process_mouse_events();
347
-
348
- if (old_shift && !kbdinfo.fsState)
349
- {
350
- key = -1;
351
-
352
- if (old_shift & KBDSTF_LEFTALT)
353
- {
354
- key = KEY_ALT_L;
355
- }
356
- else if (old_shift & KBDSTF_RIGHTALT)
357
- {
358
- key = KEY_ALT_R;
359
- }
360
- else if (old_shift & KBDSTF_LEFTCONTROL)
361
- {
362
- key = KEY_CONTROL_L;
363
- }
364
- else if (old_shift & KBDSTF_RIGHTCONTROL)
365
- {
366
- key = KEY_CONTROL_R;
367
- }
368
- else if (old_shift & KBDSTF_LEFTSHIFT)
369
- {
370
- key = KEY_SHIFT_L;
371
- }
372
- else if (old_shift & KBDSTF_RIGHTSHIFT)
373
- {
374
- key = KEY_SHIFT_R;
375
- }
376
-
377
- key_pressed = FALSE;
378
- old_shift = kbdinfo.fsState;
379
-
380
- SP->key_code = TRUE;
381
- return key;
382
- }
383
-
384
- KbdCharIn(&keyInfo, IO_WAIT, 0); /* get a character */
385
-
386
- key = keyInfo.chChar;
387
- scan = keyInfo.chScan;
388
-
389
- if (SP->save_key_modifiers)
390
- {
391
- if (keyInfo.fsState & KBDSTF_ALT)
392
- pdc_key_modifiers |= PDC_KEY_MODIFIER_ALT;
393
-
394
- if (keyInfo.fsState & KBDSTF_CONTROL)
395
- pdc_key_modifiers |= PDC_KEY_MODIFIER_CONTROL;
396
-
397
- if (keyInfo.fsState & KBDSTF_NUMLOCK_ON)
398
- pdc_key_modifiers |= PDC_KEY_MODIFIER_NUMLOCK;
399
-
400
- if (keyInfo.fsState & (KBDSTF_LEFTSHIFT|KBDSTF_RIGHTSHIFT))
401
- pdc_key_modifiers |= PDC_KEY_MODIFIER_SHIFT;
402
- }
403
- #endif
404
- if (scan == 0x1c && key == 0x0a) /* ^Enter */
405
- key = CTL_ENTER;
406
- else if (scan == 0xe0 && key == 0x0d) /* PadEnter */
407
- key = PADENTER;
408
- else if (scan == 0xe0 && key == 0x0a) /* ^PadEnter */
409
- key = CTL_PADENTER;
410
- else if (scan == 0x37 && key == 0x2a) /* Star */
411
- key = PADSTAR;
412
- else if (scan == 0x4a && key == 0x2d) /* Minus */
413
- key = PADMINUS;
414
- else if (scan == 0x4e && key == 0x2b) /* Plus */
415
- key = PADPLUS;
416
- else if (scan == 0xe0 && key == 0x2f) /* Slash */
417
- key = PADSLASH;
418
- else if (key == 0x00 || (key == 0xe0 && scan > 53 && scan != 86))
419
- key = (scan > 0xa7) ? -1 : key_table[scan];
420
-
421
- if (keyInfo.fsState & (KBDSTF_LEFTSHIFT|KBDSTF_RIGHTSHIFT))
422
- {
423
- switch (key)
424
- {
425
- case KEY_HOME: /* Shift Home */
426
- key = KEY_SHOME;
427
- break;
428
- case KEY_UP: /* Shift Up */
429
- key = KEY_SUP;
430
- break;
431
- case KEY_PPAGE: /* Shift PgUp */
432
- key = KEY_SPREVIOUS;
433
- break;
434
- case KEY_LEFT: /* Shift Left */
435
- key = KEY_SLEFT;
436
- break;
437
- case KEY_RIGHT: /* Shift Right */
438
- key = KEY_SRIGHT;
439
- break;
440
- case KEY_END: /* Shift End */
441
- key = KEY_SEND;
442
- break;
443
- case KEY_DOWN: /* Shift Down */
444
- key = KEY_SDOWN;
445
- break;
446
- case KEY_NPAGE: /* Shift PgDn */
447
- key = KEY_SNEXT;
448
- break;
449
- case KEY_IC: /* Shift Ins */
450
- key = KEY_SIC;
451
- break;
452
- case KEY_DC: /* Shift Del */
453
- key = KEY_SDC;
454
- }
455
- }
456
-
457
- key_pressed = TRUE;
458
- SP->key_code = ((unsigned)key >= 256);
459
-
460
- return key;
461
- }
462
-
463
- /* discard any pending keyboard or mouse input -- this is the core
464
- routine for flushinp() */
465
-
466
- void PDC_flushinp(void)
467
- {
468
- PDC_LOG(("PDC_flushinp() - called\n"));
469
-
470
- #ifdef EMXVIDEO
471
- tcflush(0, TCIFLUSH);
472
- #else
473
- if (mouse_handle)
474
- MouFlushQue(mouse_handle);
475
-
476
- KbdFlushBuffer(0);
477
- #endif
478
- }
479
-
480
- int PDC_mouse_set(void)
481
- {
482
- #ifndef EMXVIDEO
483
-
484
- unsigned long mbe = SP->_trap_mbe;
485
-
486
- if (mbe && !mouse_handle)
487
- {
488
- memset(&old_mouse_status, 0, sizeof(MOUSE_STATUS));
489
- MouOpen(NULL, &mouse_handle);
490
- if (mouse_handle)
491
- MouDrawPtr(mouse_handle);
492
- }
493
- else if (!mbe && mouse_handle)
494
- {
495
- MouClose(mouse_handle);
496
- mouse_handle = 0;
497
- }
498
-
499
- if (mbe && mouse_handle)
500
- {
501
- USHORT mask = ((mbe & (BUTTON1_PRESSED | BUTTON1_CLICKED |
502
- BUTTON1_MOVED)) ? 6 : 0) |
503
-
504
- ((mbe & (BUTTON3_PRESSED | BUTTON3_CLICKED |
505
- BUTTON3_MOVED)) ? 24 : 0) |
506
-
507
- ((mbe & (BUTTON2_PRESSED | BUTTON2_CLICKED |
508
- BUTTON2_MOVED)) ? 96 : 0);
509
-
510
- MouSetEventMask(&mask, mouse_handle);
511
- }
512
- #endif
513
- return OK;
514
- }
515
-
516
- int PDC_modifiers_set(void)
517
- {
518
- key_pressed = FALSE;
519
-
520
- return OK;
521
- }