curses 1.4.4 → 1.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,474 +0,0 @@
1
- /* Public Domain Curses */
2
-
3
- #include <curspriv.h>
4
-
5
- /*man-start**************************************************************
6
-
7
- getstr
8
- ------
9
-
10
- ### Synopsis
11
-
12
- int getstr(char *str);
13
- int wgetstr(WINDOW *win, char *str);
14
- int mvgetstr(int y, int x, char *str);
15
- int mvwgetstr(WINDOW *win, int y, int x, char *str);
16
- int getnstr(char *str, int n);
17
- int wgetnstr(WINDOW *win, char *str, int n);
18
- int mvgetnstr(int y, int x, char *str, int n);
19
- int mvwgetnstr(WINDOW *win, int y, int x, char *str, int n);
20
-
21
- int get_wstr(wint_t *wstr);
22
- int wget_wstr(WINDOW *win, wint_t *wstr);
23
- int mvget_wstr(int y, int x, wint_t *wstr);
24
- int mvwget_wstr(WINDOW *win, int, int, wint_t *wstr);
25
- int getn_wstr(wint_t *wstr, int n);
26
- int wgetn_wstr(WINDOW *win, wint_t *wstr, int n);
27
- int mvgetn_wstr(int y, int x, wint_t *wstr, int n);
28
- int mvwgetn_wstr(WINDOW *win, int y, int x, wint_t *wstr, int n);
29
-
30
- ### Description
31
-
32
- These routines call wgetch() repeatedly to build a string,
33
- interpreting erase and kill characters along the way, until a
34
- newline or carriage return is received. When PDCurses is built
35
- with wide-character support enabled, the narrow-character
36
- functions convert the wgetch()'d values into a multibyte string
37
- in the current locale before returning it. The resulting string
38
- is placed in the area pointed to by *str. The routines with n as
39
- the last argument read at most n characters.
40
-
41
- Note that there's no way to know how long the buffer passed to
42
- wgetstr() is, so use wgetnstr() to avoid buffer overflows.
43
-
44
- ### Return Value
45
-
46
- These functions return ERR on failure or any other value on
47
- success.
48
-
49
- ### Portability
50
- X/Open BSD SYS V
51
- getstr Y Y Y
52
- wgetstr Y Y Y
53
- mvgetstr Y Y Y
54
- mvwgetstr Y Y Y
55
- getnstr Y - 4.0
56
- wgetnstr Y - 4.0
57
- mvgetnstr Y - -
58
- mvwgetnstr Y - -
59
- get_wstr Y
60
- wget_wstr Y
61
- mvget_wstr Y
62
- mvwget_wstr Y
63
- getn_wstr Y
64
- wgetn_wstr Y
65
- mvgetn_wstr Y
66
- mvwgetn_wstr Y
67
-
68
- **man-end****************************************************************/
69
-
70
- #define MAXLINE 255
71
-
72
- int wgetnstr(WINDOW *win, char *str, int n)
73
- {
74
- #ifdef PDC_WIDE
75
- wchar_t wstr[MAXLINE + 1];
76
-
77
- if (n < 0 || n > MAXLINE)
78
- n = MAXLINE;
79
-
80
- if (wgetn_wstr(win, (wint_t *)wstr, n) == ERR)
81
- return ERR;
82
-
83
- return (int)PDC_wcstombs(str, wstr, n);
84
- #else
85
- int ch, i, num, x, chars;
86
- char *p;
87
- bool stop, oldecho, oldcbreak, oldnodelay;
88
-
89
- PDC_LOG(("wgetnstr() - called\n"));
90
-
91
- if (!win || !str)
92
- return ERR;
93
-
94
- chars = 0;
95
- p = str;
96
- stop = FALSE;
97
-
98
- x = win->_curx;
99
-
100
- oldcbreak = SP->cbreak; /* remember states */
101
- oldecho = SP->echo;
102
- oldnodelay = win->_nodelay;
103
-
104
- SP->echo = FALSE; /* we do echo ourselves */
105
- cbreak(); /* ensure each key is returned immediately */
106
- win->_nodelay = FALSE; /* don't return -1 */
107
-
108
- wrefresh(win);
109
-
110
- while (!stop)
111
- {
112
- ch = wgetch(win);
113
-
114
- switch (ch)
115
- {
116
-
117
- case '\t':
118
- ch = ' ';
119
- num = TABSIZE - (win->_curx - x) % TABSIZE;
120
- for (i = 0; i < num; i++)
121
- {
122
- if (chars < n)
123
- {
124
- if (oldecho)
125
- waddch(win, ch);
126
- *p++ = (char)ch;
127
- ++chars;
128
- }
129
- else
130
- beep();
131
- }
132
- break;
133
-
134
- case _ECHAR: /* CTRL-H -- Delete character */
135
- if (p > str)
136
- {
137
- if (oldecho)
138
- waddstr(win, "\b \b");
139
- ch = (unsigned char)(*--p);
140
- if ((ch < ' ') && (oldecho))
141
- waddstr(win, "\b \b");
142
- chars--;
143
- }
144
- break;
145
-
146
- case _DLCHAR: /* CTRL-U -- Delete line */
147
- while (p > str)
148
- {
149
- if (oldecho)
150
- waddstr(win, "\b \b");
151
- ch = (unsigned char)(*--p);
152
- if ((ch < ' ') && (oldecho))
153
- waddstr(win, "\b \b");
154
- }
155
- chars = 0;
156
- break;
157
-
158
- case _DWCHAR: /* CTRL-W -- Delete word */
159
-
160
- while ((p > str) && (*(p - 1) == ' '))
161
- {
162
- if (oldecho)
163
- waddstr(win, "\b \b");
164
-
165
- --p; /* remove space */
166
- chars--;
167
- }
168
- while ((p > str) && (*(p - 1) != ' '))
169
- {
170
- if (oldecho)
171
- waddstr(win, "\b \b");
172
-
173
- ch = (unsigned char)(*--p);
174
- if ((ch < ' ') && (oldecho))
175
- waddstr(win, "\b \b");
176
- chars--;
177
- }
178
- break;
179
-
180
- case '\n':
181
- case '\r':
182
- stop = TRUE;
183
- if (oldecho)
184
- waddch(win, '\n');
185
- break;
186
-
187
- default:
188
- if (chars < n)
189
- {
190
- if (!SP->key_code && ch < 0x100)
191
- {
192
- *p++ = (char)ch;
193
- if (oldecho)
194
- waddch(win, ch);
195
- chars++;
196
- }
197
- }
198
- else
199
- beep();
200
-
201
- break;
202
-
203
- }
204
-
205
- wrefresh(win);
206
- }
207
-
208
- *p = '\0';
209
-
210
- SP->echo = oldecho; /* restore old settings */
211
- SP->cbreak = oldcbreak;
212
- win->_nodelay = oldnodelay;
213
-
214
- return OK;
215
- #endif
216
- }
217
-
218
- int getstr(char *str)
219
- {
220
- PDC_LOG(("getstr() - called\n"));
221
-
222
- return wgetnstr(stdscr, str, MAXLINE);
223
- }
224
-
225
- int wgetstr(WINDOW *win, char *str)
226
- {
227
- PDC_LOG(("wgetstr() - called\n"));
228
-
229
- return wgetnstr(win, str, MAXLINE);
230
- }
231
-
232
- int mvgetstr(int y, int x, char *str)
233
- {
234
- PDC_LOG(("mvgetstr() - called\n"));
235
-
236
- if (move(y, x) == ERR)
237
- return ERR;
238
-
239
- return wgetnstr(stdscr, str, MAXLINE);
240
- }
241
-
242
- int mvwgetstr(WINDOW *win, int y, int x, char *str)
243
- {
244
- PDC_LOG(("mvwgetstr() - called\n"));
245
-
246
- if (wmove(win, y, x) == ERR)
247
- return ERR;
248
-
249
- return wgetnstr(win, str, MAXLINE);
250
- }
251
-
252
- int getnstr(char *str, int n)
253
- {
254
- PDC_LOG(("getnstr() - called\n"));
255
-
256
- return wgetnstr(stdscr, str, n);
257
- }
258
-
259
- int mvgetnstr(int y, int x, char *str, int n)
260
- {
261
- PDC_LOG(("mvgetnstr() - called\n"));
262
-
263
- if (move(y, x) == ERR)
264
- return ERR;
265
-
266
- return wgetnstr(stdscr, str, n);
267
- }
268
-
269
- int mvwgetnstr(WINDOW *win, int y, int x, char *str, int n)
270
- {
271
- PDC_LOG(("mvwgetnstr() - called\n"));
272
-
273
- if (wmove(win, y, x) == ERR)
274
- return ERR;
275
-
276
- return wgetnstr(win, str, n);
277
- }
278
-
279
- #ifdef PDC_WIDE
280
- int wgetn_wstr(WINDOW *win, wint_t *wstr, int n)
281
- {
282
- int ch, i, num, x, chars;
283
- wint_t *p;
284
- bool stop, oldecho, oldcbreak, oldnodelay;
285
-
286
- PDC_LOG(("wgetn_wstr() - called\n"));
287
-
288
- if (!win || !wstr)
289
- return ERR;
290
-
291
- chars = 0;
292
- p = wstr;
293
- stop = FALSE;
294
-
295
- x = win->_curx;
296
-
297
- oldcbreak = SP->cbreak; /* remember states */
298
- oldecho = SP->echo;
299
- oldnodelay = win->_nodelay;
300
-
301
- SP->echo = FALSE; /* we do echo ourselves */
302
- cbreak(); /* ensure each key is returned immediately */
303
- win->_nodelay = FALSE; /* don't return -1 */
304
-
305
- wrefresh(win);
306
-
307
- while (!stop)
308
- {
309
- ch = wgetch(win);
310
-
311
- switch (ch)
312
- {
313
-
314
- case '\t':
315
- ch = ' ';
316
- num = TABSIZE - (win->_curx - x) % TABSIZE;
317
- for (i = 0; i < num; i++)
318
- {
319
- if (chars < n)
320
- {
321
- if (oldecho)
322
- waddch(win, ch);
323
- *p++ = ch;
324
- ++chars;
325
- }
326
- else
327
- beep();
328
- }
329
- break;
330
-
331
- case _ECHAR: /* CTRL-H -- Delete character */
332
- if (p > wstr)
333
- {
334
- if (oldecho)
335
- waddstr(win, "\b \b");
336
- ch = *--p;
337
- if ((ch < ' ') && (oldecho))
338
- waddstr(win, "\b \b");
339
- chars--;
340
- }
341
- break;
342
-
343
- case _DLCHAR: /* CTRL-U -- Delete line */
344
- while (p > wstr)
345
- {
346
- if (oldecho)
347
- waddstr(win, "\b \b");
348
- ch = *--p;
349
- if ((ch < ' ') && (oldecho))
350
- waddstr(win, "\b \b");
351
- }
352
- chars = 0;
353
- break;
354
-
355
- case _DWCHAR: /* CTRL-W -- Delete word */
356
-
357
- while ((p > wstr) && (*(p - 1) == ' '))
358
- {
359
- if (oldecho)
360
- waddstr(win, "\b \b");
361
-
362
- --p; /* remove space */
363
- chars--;
364
- }
365
- while ((p > wstr) && (*(p - 1) != ' '))
366
- {
367
- if (oldecho)
368
- waddstr(win, "\b \b");
369
-
370
- ch = *--p;
371
- if ((ch < ' ') && (oldecho))
372
- waddstr(win, "\b \b");
373
- chars--;
374
- }
375
- break;
376
-
377
- case '\n':
378
- case '\r':
379
- stop = TRUE;
380
- if (oldecho)
381
- waddch(win, '\n');
382
- break;
383
-
384
- default:
385
- if (chars < n)
386
- {
387
- if (!SP->key_code)
388
- {
389
- *p++ = ch;
390
- if (oldecho)
391
- waddch(win, ch);
392
- chars++;
393
- }
394
- }
395
- else
396
- beep();
397
-
398
- break;
399
-
400
- }
401
-
402
- wrefresh(win);
403
- }
404
-
405
- *p = '\0';
406
-
407
- SP->echo = oldecho; /* restore old settings */
408
- SP->cbreak = oldcbreak;
409
- win->_nodelay = oldnodelay;
410
-
411
- return OK;
412
- }
413
-
414
- int get_wstr(wint_t *wstr)
415
- {
416
- PDC_LOG(("get_wstr() - called\n"));
417
-
418
- return wgetn_wstr(stdscr, wstr, MAXLINE);
419
- }
420
-
421
- int wget_wstr(WINDOW *win, wint_t *wstr)
422
- {
423
- PDC_LOG(("wget_wstr() - called\n"));
424
-
425
- return wgetn_wstr(win, wstr, MAXLINE);
426
- }
427
-
428
- int mvget_wstr(int y, int x, wint_t *wstr)
429
- {
430
- PDC_LOG(("mvget_wstr() - called\n"));
431
-
432
- if (move(y, x) == ERR)
433
- return ERR;
434
-
435
- return wgetn_wstr(stdscr, wstr, MAXLINE);
436
- }
437
-
438
- int mvwget_wstr(WINDOW *win, int y, int x, wint_t *wstr)
439
- {
440
- PDC_LOG(("mvwget_wstr() - called\n"));
441
-
442
- if (wmove(win, y, x) == ERR)
443
- return ERR;
444
-
445
- return wgetn_wstr(win, wstr, MAXLINE);
446
- }
447
-
448
- int getn_wstr(wint_t *wstr, int n)
449
- {
450
- PDC_LOG(("getn_wstr() - called\n"));
451
-
452
- return wgetn_wstr(stdscr, wstr, n);
453
- }
454
-
455
- int mvgetn_wstr(int y, int x, wint_t *wstr, int n)
456
- {
457
- PDC_LOG(("mvgetn_wstr() - called\n"));
458
-
459
- if (move(y, x) == ERR)
460
- return ERR;
461
-
462
- return wgetn_wstr(stdscr, wstr, n);
463
- }
464
-
465
- int mvwgetn_wstr(WINDOW *win, int y, int x, wint_t *wstr, int n)
466
- {
467
- PDC_LOG(("mvwgetn_wstr() - called\n"));
468
-
469
- if (wmove(win, y, x) == ERR)
470
- return ERR;
471
-
472
- return wgetn_wstr(win, wstr, n);
473
- }
474
- #endif
@@ -1,139 +0,0 @@
1
- /* Public Domain Curses */
2
-
3
- #include <curspriv.h>
4
-
5
- /*man-start**************************************************************
6
-
7
- getyx
8
- -----
9
-
10
- ### Synopsis
11
-
12
- void getyx(WINDOW *win, int y, int x);
13
- void getparyx(WINDOW *win, int y, int x);
14
- void getbegyx(WINDOW *win, int y, int x);
15
- void getmaxyx(WINDOW *win, int y, int x);
16
-
17
- void getsyx(int y, int x);
18
- void setsyx(int y, int x);
19
-
20
- int getbegy(WINDOW *win);
21
- int getbegx(WINDOW *win);
22
- int getcury(WINDOW *win);
23
- int getcurx(WINDOW *win);
24
- int getpary(WINDOW *win);
25
- int getparx(WINDOW *win);
26
- int getmaxy(WINDOW *win);
27
- int getmaxx(WINDOW *win);
28
-
29
- ### Description
30
-
31
- The getyx() macro (defined in curses.h -- the prototypes here
32
- are merely illustrative) puts the current cursor position of the
33
- specified window into y and x. getbegyx() and getmaxyx() return
34
- the starting coordinates and size of the specified window,
35
- respectively. getparyx() returns the starting coordinates of the
36
- parent's window, if the specified window is a subwindow;
37
- otherwise it sets y and x to -1. These are all macros.
38
-
39
- getsyx() gets the coordinates of the virtual screen cursor, and
40
- stores them in y and x. If leaveok() is TRUE, it returns -1, -1.
41
- If lines have been removed with ripoffline(), then getsyx()
42
- includes these lines in its count; so, the returned y and x
43
- values should only be used with setsyx().
44
-
45
- setsyx() sets the virtual screen cursor to the y, x coordinates.
46
- If either y or x is -1, leaveok() is set TRUE, else it's set FALSE.
47
-
48
- getsyx() and setsyx() are meant to be used by a library routine
49
- that manipulates curses windows without altering the position of
50
- the cursor. Note that getsyx() is defined only as a macro.
51
-
52
- getbegy(), getbegx(), getcurx(), getcury(), getmaxy(),
53
- getmaxx(), getpary(), and getparx() return the appropriate
54
- coordinate or size values, or ERR in the case of a NULL window.
55
-
56
- ### Portability
57
- X/Open BSD SYS V
58
- getyx Y Y Y
59
- getparyx - - 4.0
60
- getbegyx - - 3.0
61
- getmaxyx - - 3.0
62
- getsyx - - 3.0
63
- setsyx - - 3.0
64
- getbegy - - -
65
- getbegx - - -
66
- getcury - - -
67
- getcurx - - -
68
- getpary - - -
69
- getparx - - -
70
- getmaxy - - -
71
- getmaxx - - -
72
-
73
- **man-end****************************************************************/
74
-
75
- int getbegy(WINDOW *win)
76
- {
77
- PDC_LOG(("getbegy() - called\n"));
78
-
79
- return win ? win->_begy : ERR;
80
- }
81
-
82
- int getbegx(WINDOW *win)
83
- {
84
- PDC_LOG(("getbegx() - called\n"));
85
-
86
- return win ? win->_begx : ERR;
87
- }
88
-
89
- int getcury(WINDOW *win)
90
- {
91
- PDC_LOG(("getcury() - called\n"));
92
-
93
- return win ? win->_cury : ERR;
94
- }
95
-
96
- int getcurx(WINDOW *win)
97
- {
98
- PDC_LOG(("getcurx() - called\n"));
99
-
100
- return win ? win->_curx : ERR;
101
- }
102
-
103
- int getpary(WINDOW *win)
104
- {
105
- PDC_LOG(("getpary() - called\n"));
106
-
107
- return win ? win->_pary : ERR;
108
- }
109
-
110
- int getparx(WINDOW *win)
111
- {
112
- PDC_LOG(("getparx() - called\n"));
113
-
114
- return win ? win->_parx : ERR;
115
- }
116
-
117
- int getmaxy(WINDOW *win)
118
- {
119
- PDC_LOG(("getmaxy() - called\n"));
120
-
121
- return win ? win->_maxy : ERR;
122
- }
123
-
124
- int getmaxx(WINDOW *win)
125
- {
126
- PDC_LOG(("getmaxx() - called\n"));
127
-
128
- return win ? win->_maxx : ERR;
129
- }
130
-
131
- void setsyx(int y, int x)
132
- {
133
- PDC_LOG(("setsyx() - called\n"));
134
-
135
- curscr->_leaveit = y == -1 || x == -1;
136
-
137
- if (!curscr->_leaveit)
138
- wmove(curscr, y, x);
139
- }