curses 1.3.0 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (256) 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 +34 -0
  6. data/README.md +14 -46
  7. data/Rakefile +0 -86
  8. data/curses.gemspec +2 -3
  9. data/ext/curses/curses.c +70 -58
  10. data/ext/curses/extconf.rb +134 -21
  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/menu.rb +3 -3
  16. data/sample/mouse_move.rb +75 -0
  17. data/vendor/PDCurses/.gitignore +47 -0
  18. data/vendor/PDCurses/.travis.yml +49 -0
  19. data/vendor/PDCurses/CMakeLists.txt +68 -0
  20. data/vendor/PDCurses/HISTORY.md +2036 -0
  21. data/vendor/PDCurses/IMPLEMNT.md +327 -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.bcc +83 -0
  57. data/vendor/PDCurses/dos/Makefile.dmc +257 -0
  58. data/vendor/PDCurses/dos/Makefile.msc +113 -0
  59. data/vendor/PDCurses/dos/Makefile.wcc +107 -0
  60. data/vendor/PDCurses/dos/README.md +51 -0
  61. data/vendor/PDCurses/dos/bccdos.lrf +9 -0
  62. data/vendor/PDCurses/dos/mscdos.lrf +50 -0
  63. data/vendor/PDCurses/dos/pdcclip.c +132 -0
  64. data/vendor/PDCurses/dos/pdcdisp.c +135 -0
  65. data/vendor/PDCurses/dos/pdcdos.h +194 -0
  66. data/vendor/PDCurses/dos/pdcgetsc.c +98 -0
  67. data/vendor/PDCurses/dos/pdckbd.c +513 -0
  68. data/vendor/PDCurses/dos/pdcscrn.c +785 -0
  69. data/vendor/PDCurses/dos/pdcsetsc.c +101 -0
  70. data/vendor/PDCurses/dos/pdcutil.c +212 -0
  71. data/vendor/PDCurses/libobjs.mif +26 -0
  72. data/vendor/PDCurses/makedist.mif +20 -0
  73. data/vendor/PDCurses/man/README.md +21 -0
  74. data/vendor/PDCurses/man/intro.md +361 -0
  75. data/vendor/PDCurses/man/manext.c +119 -0
  76. data/vendor/PDCurses/man/sdl.md +152 -0
  77. data/vendor/PDCurses/man/sdl2.md +58 -0
  78. data/vendor/PDCurses/man/x11.md +407 -0
  79. data/vendor/PDCurses/ncurses/CMakeLists.txt +66 -0
  80. data/vendor/PDCurses/ncurses/README.md +26 -0
  81. data/vendor/PDCurses/ncurses/makefile +29 -0
  82. data/vendor/PDCurses/os2/CMakeLists.txt +41 -0
  83. data/vendor/PDCurses/os2/Makefile.bcc +90 -0
  84. data/vendor/PDCurses/os2/Makefile.wcc +43 -0
  85. data/vendor/PDCurses/os2/README.md +43 -0
  86. data/vendor/PDCurses/os2/iccos2.lrf +50 -0
  87. data/vendor/PDCurses/os2/iccos2.mak +256 -0
  88. data/vendor/PDCurses/os2/pdcclip.c +188 -0
  89. data/vendor/PDCurses/os2/pdcdisp.c +93 -0
  90. data/vendor/PDCurses/os2/pdcgetsc.c +89 -0
  91. data/vendor/PDCurses/os2/pdckbd.c +521 -0
  92. data/vendor/PDCurses/os2/pdcos2.h +55 -0
  93. data/vendor/PDCurses/os2/pdcscrn.c +449 -0
  94. data/vendor/PDCurses/os2/pdcsetsc.c +112 -0
  95. data/vendor/PDCurses/os2/pdcutil.c +52 -0
  96. data/vendor/PDCurses/panel.h +56 -0
  97. data/vendor/PDCurses/pdcurses/README.md +25 -0
  98. data/vendor/PDCurses/pdcurses/addch.c +693 -0
  99. data/vendor/PDCurses/pdcurses/addchstr.c +245 -0
  100. data/vendor/PDCurses/pdcurses/addstr.c +240 -0
  101. data/vendor/PDCurses/pdcurses/attr.c +359 -0
  102. data/vendor/PDCurses/pdcurses/beep.c +68 -0
  103. data/vendor/PDCurses/pdcurses/bkgd.c +223 -0
  104. data/vendor/PDCurses/pdcurses/border.c +411 -0
  105. data/vendor/PDCurses/pdcurses/clear.c +159 -0
  106. data/vendor/PDCurses/pdcurses/color.c +298 -0
  107. data/vendor/PDCurses/pdcurses/debug.c +109 -0
  108. data/vendor/PDCurses/pdcurses/delch.c +96 -0
  109. data/vendor/PDCurses/pdcurses/deleteln.c +211 -0
  110. data/vendor/PDCurses/pdcurses/deprec.c +27 -0
  111. data/vendor/PDCurses/pdcurses/getch.c +417 -0
  112. data/vendor/PDCurses/pdcurses/getstr.c +474 -0
  113. data/vendor/PDCurses/pdcurses/getyx.c +139 -0
  114. data/vendor/PDCurses/pdcurses/inch.c +127 -0
  115. data/vendor/PDCurses/pdcurses/inchstr.c +214 -0
  116. data/vendor/PDCurses/pdcurses/initscr.c +367 -0
  117. data/vendor/PDCurses/pdcurses/inopts.c +324 -0
  118. data/vendor/PDCurses/pdcurses/insch.c +271 -0
  119. data/vendor/PDCurses/pdcurses/insstr.c +264 -0
  120. data/vendor/PDCurses/pdcurses/instr.c +246 -0
  121. data/vendor/PDCurses/pdcurses/kernel.c +259 -0
  122. data/vendor/PDCurses/pdcurses/keyname.c +157 -0
  123. data/vendor/PDCurses/pdcurses/mouse.c +438 -0
  124. data/vendor/PDCurses/pdcurses/move.c +57 -0
  125. data/vendor/PDCurses/pdcurses/outopts.c +159 -0
  126. data/vendor/PDCurses/pdcurses/overlay.c +214 -0
  127. data/vendor/PDCurses/pdcurses/pad.c +260 -0
  128. data/vendor/PDCurses/pdcurses/panel.c +633 -0
  129. data/vendor/PDCurses/pdcurses/printw.c +126 -0
  130. data/vendor/PDCurses/pdcurses/refresh.c +279 -0
  131. data/vendor/PDCurses/pdcurses/scanw.c +578 -0
  132. data/vendor/PDCurses/pdcurses/scr_dump.c +213 -0
  133. data/vendor/PDCurses/pdcurses/scroll.c +101 -0
  134. data/vendor/PDCurses/pdcurses/slk.c +591 -0
  135. data/vendor/PDCurses/pdcurses/termattr.c +182 -0
  136. data/vendor/PDCurses/pdcurses/terminfo.c +217 -0
  137. data/vendor/PDCurses/pdcurses/touch.c +163 -0
  138. data/vendor/PDCurses/pdcurses/util.c +312 -0
  139. data/vendor/PDCurses/pdcurses/window.c +569 -0
  140. data/vendor/PDCurses/sdl1/Makefile.mng +110 -0
  141. data/vendor/PDCurses/sdl1/README.md +31 -0
  142. data/vendor/PDCurses/sdl1/deffont.h +385 -0
  143. data/vendor/PDCurses/sdl1/deficon.h +23 -0
  144. data/vendor/PDCurses/sdl1/pdcclip.c +131 -0
  145. data/vendor/PDCurses/sdl1/pdcdisp.c +373 -0
  146. data/vendor/PDCurses/sdl1/pdcgetsc.c +30 -0
  147. data/vendor/PDCurses/sdl1/pdckbd.c +405 -0
  148. data/vendor/PDCurses/sdl1/pdcscrn.c +414 -0
  149. data/vendor/PDCurses/sdl1/pdcsdl.h +31 -0
  150. data/vendor/PDCurses/sdl1/pdcsetsc.c +64 -0
  151. data/vendor/PDCurses/sdl1/pdcutil.c +40 -0
  152. data/vendor/PDCurses/sdl1/sdltest.c +79 -0
  153. data/vendor/PDCurses/sdl2/CMakeLists.txt +76 -0
  154. data/vendor/PDCurses/sdl2/Makefile.vc +164 -0
  155. data/vendor/PDCurses/sdl2/README.md +34 -0
  156. data/vendor/PDCurses/sdl2/deffont.h +385 -0
  157. data/vendor/PDCurses/sdl2/deficon.h +23 -0
  158. data/vendor/PDCurses/sdl2/pdcclip.c +93 -0
  159. data/vendor/PDCurses/sdl2/pdcdisp.c +534 -0
  160. data/vendor/PDCurses/sdl2/pdcgetsc.c +30 -0
  161. data/vendor/PDCurses/sdl2/pdckbd.c +480 -0
  162. data/vendor/PDCurses/sdl2/pdcscrn.c +443 -0
  163. data/vendor/PDCurses/sdl2/pdcsdl.h +33 -0
  164. data/vendor/PDCurses/sdl2/pdcsetsc.c +67 -0
  165. data/vendor/PDCurses/sdl2/pdcutil.c +39 -0
  166. data/vendor/PDCurses/sdl2/sdltest.c +81 -0
  167. data/vendor/PDCurses/term.h +48 -0
  168. data/vendor/PDCurses/version.mif +7 -0
  169. data/vendor/PDCurses/vt/CMakeLists.txt +28 -0
  170. data/vendor/PDCurses/vt/Makefile.bcc +111 -0
  171. data/vendor/PDCurses/vt/Makefile.dmc +258 -0
  172. data/vendor/PDCurses/vt/Makefile.vc +144 -0
  173. data/vendor/PDCurses/vt/Makefile.wcc +107 -0
  174. data/vendor/PDCurses/vt/README.md +64 -0
  175. data/vendor/PDCurses/vt/pdcclip.c +20 -0
  176. data/vendor/PDCurses/vt/pdcdisp.c +284 -0
  177. data/vendor/PDCurses/vt/pdcgetsc.c +27 -0
  178. data/vendor/PDCurses/vt/pdckbd.c +394 -0
  179. data/vendor/PDCurses/vt/pdcscrn.c +434 -0
  180. data/vendor/PDCurses/vt/pdcsetsc.c +45 -0
  181. data/vendor/PDCurses/vt/pdcutil.c +43 -0
  182. data/vendor/PDCurses/vt/pdcvt.h +16 -0
  183. data/vendor/PDCurses/watcom.mif +68 -0
  184. data/vendor/PDCurses/wincon/CMakeLists.txt +27 -0
  185. data/vendor/PDCurses/wincon/Makefile.bcc +88 -0
  186. data/vendor/PDCurses/wincon/Makefile.dmc +256 -0
  187. data/vendor/PDCurses/wincon/Makefile.lcc +273 -0
  188. data/vendor/PDCurses/wincon/Makefile.mng +176 -0
  189. data/vendor/PDCurses/wincon/Makefile.vc +144 -0
  190. data/vendor/PDCurses/wincon/Makefile.wcc +51 -0
  191. data/vendor/PDCurses/wincon/README.md +85 -0
  192. data/vendor/PDCurses/wincon/pdcclip.c +174 -0
  193. data/vendor/PDCurses/wincon/pdcdisp.c +143 -0
  194. data/vendor/PDCurses/wincon/pdcgetsc.c +55 -0
  195. data/vendor/PDCurses/wincon/pdckbd.c +786 -0
  196. data/vendor/PDCurses/wincon/pdcscrn.c +717 -0
  197. data/vendor/PDCurses/wincon/pdcsetsc.c +91 -0
  198. data/vendor/PDCurses/wincon/pdcurses.ico +0 -0
  199. data/vendor/PDCurses/wincon/pdcurses.rc +28 -0
  200. data/vendor/PDCurses/wincon/pdcutil.c +41 -0
  201. data/vendor/PDCurses/wincon/pdcwin.h +31 -0
  202. data/vendor/PDCurses/wingui/CMakeLists.txt +27 -0
  203. data/vendor/PDCurses/wingui/Makefile.bcc +85 -0
  204. data/vendor/PDCurses/wingui/Makefile.dmc +259 -0
  205. data/vendor/PDCurses/wingui/Makefile.lcc +273 -0
  206. data/vendor/PDCurses/wingui/Makefile.mng +171 -0
  207. data/vendor/PDCurses/wingui/Makefile.vc +144 -0
  208. data/vendor/PDCurses/wingui/Makefile.wcc +51 -0
  209. data/vendor/PDCurses/wingui/README.md +93 -0
  210. data/vendor/PDCurses/wingui/pdcclip.c +174 -0
  211. data/vendor/PDCurses/wingui/pdcdisp.c +718 -0
  212. data/vendor/PDCurses/wingui/pdcgetsc.c +30 -0
  213. data/vendor/PDCurses/wingui/pdckbd.c +143 -0
  214. data/vendor/PDCurses/wingui/pdcscrn.c +2797 -0
  215. data/vendor/PDCurses/wingui/pdcsetsc.c +89 -0
  216. data/vendor/PDCurses/wingui/pdcurses.ico +0 -0
  217. data/vendor/PDCurses/wingui/pdcurses.rc +28 -0
  218. data/vendor/PDCurses/wingui/pdcutil.c +61 -0
  219. data/vendor/PDCurses/wingui/pdcwin.h +122 -0
  220. data/vendor/PDCurses/x11/Makefile.in +754 -0
  221. data/vendor/PDCurses/x11/PDCurses.spec +82 -0
  222. data/vendor/PDCurses/x11/README.md +62 -0
  223. data/vendor/PDCurses/x11/ScrollBox.c +319 -0
  224. data/vendor/PDCurses/x11/ScrollBox.h +51 -0
  225. data/vendor/PDCurses/x11/ScrollBoxP.h +70 -0
  226. data/vendor/PDCurses/x11/aclocal.m4 +994 -0
  227. data/vendor/PDCurses/x11/big_icon.xbm +46 -0
  228. data/vendor/PDCurses/x11/compose.h +201 -0
  229. data/vendor/PDCurses/x11/config.guess +1500 -0
  230. data/vendor/PDCurses/x11/config.h.in +100 -0
  231. data/vendor/PDCurses/x11/config.sub +1616 -0
  232. data/vendor/PDCurses/x11/configure +6700 -0
  233. data/vendor/PDCurses/x11/configure.ac +295 -0
  234. data/vendor/PDCurses/x11/debian/changelog +6 -0
  235. data/vendor/PDCurses/x11/debian/compat +1 -0
  236. data/vendor/PDCurses/x11/debian/control +11 -0
  237. data/vendor/PDCurses/x11/debian/copyright +27 -0
  238. data/vendor/PDCurses/x11/debian/rules +98 -0
  239. data/vendor/PDCurses/x11/install-sh +253 -0
  240. data/vendor/PDCurses/x11/little_icon.xbm +14 -0
  241. data/vendor/PDCurses/x11/ncurses_cfg.h +45 -0
  242. data/vendor/PDCurses/x11/pdcclip.c +173 -0
  243. data/vendor/PDCurses/x11/pdcdisp.c +85 -0
  244. data/vendor/PDCurses/x11/pdcgetsc.c +28 -0
  245. data/vendor/PDCurses/x11/pdckbd.c +104 -0
  246. data/vendor/PDCurses/x11/pdcscrn.c +258 -0
  247. data/vendor/PDCurses/x11/pdcsetsc.c +95 -0
  248. data/vendor/PDCurses/x11/pdcutil.c +52 -0
  249. data/vendor/PDCurses/x11/pdcx11.c +316 -0
  250. data/vendor/PDCurses/x11/pdcx11.h +191 -0
  251. data/vendor/PDCurses/x11/sb.c +155 -0
  252. data/vendor/PDCurses/x11/x11.c +3686 -0
  253. data/vendor/PDCurses/x11/xcurses-config.in +81 -0
  254. metadata +258 -24
  255. data/.travis.yml +0 -16
  256. data/appveyor.yml +0 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a4d2078ada136fc3603a23e253c9342efe47cc62daad3db6459c57d1822b740a
4
- data.tar.gz: 27ee0f6320474baacbe459dc52f40500240d55ce7656663cf8c8074774643fdf
3
+ metadata.gz: 1dbe3f75b839ed01f58ee7743d9d2e147491255aabc4292d04ddcf00a2eaec25
4
+ data.tar.gz: 057d072c126f7d00f8f23cd6fdb246255f94545af1bdb836648b68903a1f959f
5
5
  SHA512:
6
- metadata.gz: dd21a812ca31bc59dc6e4377a61fc1b19d57779c95b5da48b358b28eb69f29686273de212527744038e508e0a42aed87ead357fe91f85d075eee30eed2aa1a68
7
- data.tar.gz: e378f6977737d7871074d3fd08436b447823ef347fc67cfe4d367fc245bb7238c2d7514799a2a6324c2ec5cebb544c94f5fabaacfe66adc753ecc6c372970648
6
+ metadata.gz: 4bd61ea426ca6a68141099c8f6b734cd9094ade75fb5cb11525f285c41e6bec346e3b163bc0f37e1a29b96857ac1d2430f751f056e28641da7116c46ba458a19
7
+ data.tar.gz: bd3f77e5ff14b8c9aeb86d2e498a66f53d66999f55eb81848cf953946a10f242d906b2047eb8e342f0149a436766c810d53c3c06ee942e69d3ae20068e3c8e14
@@ -0,0 +1,19 @@
1
+ name: macos
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: macos-latest
8
+ steps:
9
+ - uses: actions/checkout@v2
10
+ - name: Install dependencies
11
+ run: |
12
+ gem install bundler --no-document
13
+ bundle install
14
+ - name: Build package
15
+ run: bundle exec rake build
16
+ - name: Install package
17
+ run: |
18
+ gem install pkg/curses-*.gem
19
+ ruby -r curses -e 'puts Curses::VERSION'
@@ -0,0 +1,26 @@
1
+ name: ubuntu
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ test:
7
+ strategy:
8
+ matrix:
9
+ ruby: [ head, 2.7, 2.6, 2.5 ]
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v2
13
+ - uses: ruby/setup-ruby@v1
14
+ with:
15
+ ruby-version: ${{ matrix.ruby }}
16
+ - name: Install dependencies
17
+ run: |
18
+ sudo apt install libncursesw5-dev
19
+ gem install bundler --no-document
20
+ bundle install
21
+ - name: Build package
22
+ run: bundle exec rake build
23
+ - name: Install package
24
+ run: |
25
+ gem install pkg/curses-*.gem
26
+ ruby -r curses -e 'puts Curses::VERSION'
@@ -0,0 +1,25 @@
1
+ name: windows
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: windows-latest
8
+ strategy:
9
+ matrix:
10
+ ruby: [ 'mingw', 'mswin', '2.7', '2.6', '2.5' ]
11
+ steps:
12
+ - uses: actions/checkout@v2
13
+ with:
14
+ submodules: true
15
+ - name: Set up Ruby
16
+ uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: ${{ matrix.ruby }}
19
+ bundler-cache: true
20
+ - name: Build package
21
+ run: bundle exec rake build
22
+ - name: Install package
23
+ run: |
24
+ gem install pkg/curses-*.gem
25
+ ruby -r curses -e 'puts Curses::VERSION'
data/History.md CHANGED
@@ -1,3 +1,37 @@
1
+ ### 1.4.2 / 2021-06-14
2
+
3
+ New features:
4
+
5
+ * Added samples for addch, attron, mouse tracking and colors.
6
+ Pull request #62 by coezbek.
7
+
8
+ ### 1.4.1 / 2021-05-22
9
+
10
+ Bug fixes:
11
+
12
+ * Use chtype instead of char to support attributes
13
+ * Fixes for Ruby 3.1.
14
+
15
+ ### 1.4.0 / 2020-12-10
16
+
17
+ New features:
18
+
19
+ * Remove fat binary support for newer versions of Ruby
20
+
21
+ ### 1.3.2 / 2019-12-20
22
+
23
+ Bug fixes:
24
+
25
+ * Drop rb_safe_level check for Ruby 2.7 by Eric Wong.
26
+ * Try libtinfow first. Issue #52 by Marco Sirabella.
27
+
28
+ ### 1.3.1 / 2019-04-21
29
+
30
+ Bug fixes:
31
+
32
+ * Check whether sizeof(WINDOW) is available to avoid build failures on macOS.
33
+ Issue #48 reported by chdiza.
34
+
1
35
  ### 1.3.0 / 2019-04-16
2
36
 
3
37
  New features:
data/README.md CHANGED
@@ -1,8 +1,9 @@
1
1
  # curses
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/curses.svg)](https://badge.fury.io/rb/curses)
4
- [![Build Status](https://travis-ci.org/ruby/curses.svg?branch=master)](https://travis-ci.org/ruby/curses)
5
- [![Build status](https://ci.appveyor.com/api/projects/status/kdvksgjo4fyd3c4m/branch/master?svg=true)](https://ci.appveyor.com/project/ruby/curses/branch/master)
4
+ [![ubuntu](https://github.com/ruby/curses/workflows/ubuntu/badge.svg)](https://github.com/ruby/curses/actions?query=workflow%3Aubuntu)
5
+ [![windows](https://github.com/ruby/curses/workflows/windows/badge.svg)](https://github.com/ruby/curses/actions?query=workflow%3Awindows)
6
+ [![macos](https://github.com/ruby/curses/workflows/macos/badge.svg)](https://github.com/ruby/curses/actions?query=workflow%3Amacos)
6
7
 
7
8
  * https://github.com/ruby/curses
8
9
  * https://github.com/ruby/curses/issues
@@ -18,7 +19,7 @@ with the release of Ruby 2.1.0. (see [ruby/ruby@9c5b2fd][2])
18
19
  ## Install
19
20
 
20
21
  $ gem install curses
21
-
22
+
22
23
  Requires ncurses or ncursesw (with wide character support).
23
24
  On Debian based distributions, you can install it with apt:
24
25
 
@@ -28,6 +29,14 @@ Or
28
29
 
29
30
  $ apt install libncursesw5-dev
30
31
 
32
+ On Windows, `gem install curses` will build bundled PDCurses, so you
33
+ don't need to install extra libraries.
34
+ However, if you prefer ncurses to PDCurses, specify the following option:
35
+
36
+ > gem install curses -- --use-system-libraries
37
+
38
+ On mingw, you need DevKit to compile the extension library.
39
+
31
40
  ## Documentation
32
41
 
33
42
  See [https://www.rubydoc.info/gems/curses](https://www.rubydoc.info/gems/curses).
@@ -39,57 +48,16 @@ After checking out the repo, run `bundle install` to install dependencies.
39
48
  To compile the extension library, run `bundle exec rake compile`.
40
49
 
41
50
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `curses.gemspec`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
42
-
43
- ### Cross compilation for Windows on Debian GNU/Linux based platforms
44
-
45
- 1. Install development environment fo 32- and 64-bit Windows.
46
-
47
- ```
48
- $ sudo apt-get install mingw-w64
49
- ```
50
-
51
- 2. Install rake-compiler.
52
-
53
- ```
54
- $ gem install rake-compiler
55
- ```
56
-
57
- 3. Compile multiple versions of Ruby.
58
-
59
- ```
60
- $ rake-compiler cross-ruby HOST=i686-w64-mingw32 VERSION=2.2.6
61
- $ rake-compiler cross-ruby HOST=i686-w64-mingw32 VERSION=2.3.3
62
- $ rake-compiler cross-ruby HOST=i686-w64-mingw32 VERSION=2.4.0
63
- $ rake-compiler cross-ruby HOST=x86_64-w64-mingw32 VERSION=2.2.6
64
- $ rake-compiler cross-ruby HOST=x86_64-w64-mingw32 VERSION=2.3.3
65
- $ rake-compiler cross-ruby HOST=x86_64-w64-mingw32 VERSION=2.4.0
66
- ```
67
-
68
- 3. Compile PDCurses.
69
-
70
- ```
71
- $ rake build:pdcurses
72
- ```
73
-
74
- 5. Compile curses.gem.
75
-
76
- ```
77
- $ rake RUBY_CC_VERSION=2.3.3:2.4.0 cross clean compile native gem
78
- ```
79
-
80
- Binary gems are generated in pkg/.
81
-
82
51
  ## License
83
52
 
84
53
  curses is released under the Ruby and 2-clause BSD licenses. See COPYING for
85
54
  details.
86
55
 
87
- Binary gems for mingw32 include a forked version of PDCurses, which is in
88
- the public domain:
56
+ It includes a forked version of PDCurses, which is in the public domain:
89
57
 
90
58
  https://github.com/Bill-Gray/PDCurses
91
59
 
92
- The version for Win32 console mode in the win32 subdirectory is used.
60
+ The version for Win32 console mode in the wincon subdirectory is used.
93
61
 
94
62
  [1]: https://bugs.ruby-lang.org/issues/8584
95
63
  [2]: https://github.com/ruby/ruby/commit/9c5b2fd8aa0fd343ad094d47a638cfd3f6ae0a81
data/Rakefile CHANGED
@@ -1,89 +1,3 @@
1
1
  require "bundler"
2
2
 
3
3
  Bundler::GemHelper.install_tasks
4
-
5
- begin
6
- require 'rake/extensiontask'
7
- rescue LoadError => e
8
- warn "\nmissing #{e.path} (for rake-compiler)" if e.respond_to? :path
9
- warn "run: bundle install\n\n"
10
- end
11
-
12
- $mswin = /mswin/ =~ RUBY_PLATFORM
13
-
14
- CLOBBER.include("vendor/#{RUBY_PLATFORM}") if $mswin
15
- CLOBBER.include("vendor/x86-mingw32")
16
- CLOBBER.include("vendor/x64-mingw32")
17
- CLOBBER.include("lib/2.*")
18
- CLOBBER.include("pkg")
19
-
20
- namespace :build do
21
- desc "Build PDCurses"
22
- task :pdcurses do
23
- mkdir_p "vendor/#{RUBY_PLATFORM}/PDCurses" if $mswin
24
- mkdir_p "vendor/x86-mingw32/PDCurses"
25
- mkdir_p "vendor/x64-mingw32/PDCurses"
26
- chdir "vendor/PDCurses/wincon" do
27
- if $mswin
28
- sh "nmake -f Makefile.vc clean all WIDE=Y DLL=Y"
29
- cp %w[pdcurses.dll pdcurses.lib], "../../#{RUBY_PLATFORM}/PDCurses"
30
- else
31
- sh "make -f Makefile.mng clean all WIDE=Y DLL=N"
32
- cp "pdcurses.a", "../../x86-mingw32/PDCurses/libpdcurses.a"
33
-
34
- sh "make -f Makefile.mng clean all _w64=1 WIDE=Y DLL=N"
35
- cp "pdcurses.a", "../../x64-mingw32/PDCurses/libpdcurses.a"
36
- end
37
- end
38
- end
39
- end
40
-
41
- namespace :clean do
42
- desc "Clean PDCurses"
43
- task :pdcurses do
44
- chdir "vendor/PDCurses/wincon" do
45
- if $mswin
46
- sh "nmake -f Makefile.vc clean"
47
- else
48
- sh "make -f Makefile.mng clean _linux_w64=1"
49
- end
50
- end
51
- end
52
- end
53
-
54
- spec = eval(File.read(File.expand_path("curses.gemspec", __dir__)))
55
- Rake::ExtensionTask.new(spec.name, spec) do |ext|
56
- if $mswin
57
- ext.config_options << '--with-curses-include=' +
58
- File.expand_path("vendor/PDCurses", __dir__) +
59
- ' --with-curses-version=function --enable-pdcurses-wide' +
60
- ' --enable-pdcurses-dll' +
61
- ' --with-curses-lib=' +
62
- File.expand_path("vendor/#{RUBY_PLATFORM}/PDCurses", __dir__)
63
- spec.files += ["vendor/#{RUBY_PLATFORM}/PDCurses/pdcurses.dll"]
64
- end
65
-
66
- ext.cross_compile = true
67
- ext.cross_platform = ["x86-mingw32", "x64-mingw32"]
68
- ext.cross_config_options << '--with-curses-include=' +
69
- File.expand_path("vendor/PDCurses", __dir__) +
70
- ' --with-curses-version=function --enable-pdcurses-wide'
71
- ext.cross_config_options << {
72
- 'x86-mingw32' => '--with-curses-lib=' +
73
- File.expand_path("vendor/x86-mingw32/PDCurses", __dir__),
74
- 'x64-mingw32' => '--with-curses-lib=' +
75
- File.expand_path("vendor/x64-mingw32/PDCurses", __dir__)
76
- }
77
- if $mswin
78
- ext.cross_compiling do |_spec|
79
- bin_file = "vendor/#{_spec.platform}/PDCurses/pdcurses.dll"
80
- _spec.files += [bin_file]
81
- stage_file = "#{ext.tmp_dir}/#{_spec.platform}/stage/#{bin_file}"
82
- stage_dir = File.dirname(stage_file)
83
- directory stage_dir
84
- file stage_file => [stage_dir, bin_file] do
85
- cp bin_file, stage_file
86
- end
87
- end
88
- end
89
- end
data/curses.gemspec CHANGED
@@ -1,17 +1,16 @@
1
1
  Gem::Specification.new { |s|
2
2
  s.name = "curses"
3
- s.version = "1.3.0"
3
+ s.version = "1.4.2"
4
4
  s.author = ["Shugo Maeda", 'Eric Hodel']
5
5
  s.email = ["shugo@ruby-lang.org", 'drbrain@segment7.net']
6
6
  s.homepage = "https://github.com/ruby/curses"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.summary = "A Ruby binding for curses, ncurses, and PDCurses. curses is an extension library for text UI applications. Formerly part of the Ruby standard library, [curses was removed and placed in this gem][1] with the release of Ruby 2.1.0. (see [ruby/ruby@9c5b2fd][2])"
9
- s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(vendor)/}) }
9
+ s.files = `git ls-files --recurse-submodules -z`.split("\x0")
10
10
  s.extensions = ["ext/curses/extconf.rb"]
11
11
  s.require_path = "lib"
12
12
  s.required_ruby_version = Gem::Requirement.new('>= 2.1.0')
13
13
  s.licenses = ['Ruby', 'BSD-2-Clause']
14
14
  s.add_development_dependency 'bundler'
15
15
  s.add_development_dependency 'rake'
16
- s.add_development_dependency 'rake-compiler'
17
16
  }
data/ext/curses/curses.c CHANGED
@@ -20,7 +20,9 @@
20
20
  #include "ruby/io.h"
21
21
  #include "ruby/thread.h"
22
22
 
23
- #if defined(HAVE_NCURSESW_CURSES_H)
23
+ #if defined(HAVE_PDCURSES_H)
24
+ # include <pdcurses.h>
25
+ #elif defined(HAVE_NCURSESW_CURSES_H)
24
26
  # include <ncursesw/curses.h>
25
27
  #elif defined(HAVE_NCURSES_CURSES_H)
26
28
  # include <ncurses/curses.h>
@@ -80,8 +82,19 @@
80
82
  # define USE_MOUSE 1
81
83
  #endif
82
84
 
83
- #define NUM2CH NUM2CHR
84
- #define CH2FIX CHR2FIX
85
+ #define OBJ2CHTYPE rb_obj2chtype_inline
86
+
87
+ static inline chtype
88
+ rb_obj2chtype_inline(VALUE x)
89
+ {
90
+ if (RB_TYPE_P(x, RUBY_T_STRING)) {
91
+ ID id_ord;
92
+
93
+ CONST_ID(id_ord, "ord");
94
+ x = rb_funcall(x, id_ord, 0);
95
+ }
96
+ return NUM2CHTYPE(x);
97
+ }
85
98
 
86
99
  static VALUE mCurses;
87
100
  static VALUE mKey;
@@ -213,6 +226,7 @@ static VALUE window_attroff(VALUE obj, VALUE attrs);
213
226
  static VALUE window_attron(VALUE obj, VALUE attrs);
214
227
  static VALUE window_attrset(VALUE obj, VALUE attrs);
215
228
 
229
+ NORETURN(static void no_window(void));
216
230
  static void
217
231
  no_window(void)
218
232
  {
@@ -220,8 +234,6 @@ no_window(void)
220
234
  }
221
235
 
222
236
  #define GetWINDOW(obj, winp) do {\
223
- if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4)\
224
- rb_raise(rb_eSecurityError, "Insecure: operation on untainted window");\
225
237
  TypedData_Get_Struct((obj), struct windata, &windata_type, (winp));\
226
238
  if ((winp)->window == 0) no_window();\
227
239
  } while (0)
@@ -241,7 +253,7 @@ window_memsize(const void *p)
241
253
  const struct windata *winp = p;
242
254
  size_t size = sizeof(*winp);
243
255
  if (!winp) return 0;
244
- if (winp->window && winp->window != stdscr) size += sizeof(*winp->window);
256
+ if (winp->window && winp->window != stdscr) size += CURSES_SIZEOF_WINDOW;
245
257
  return size;
246
258
  }
247
259
 
@@ -290,7 +302,7 @@ static void curses_finalize(VALUE);
290
302
  * see also Curses.stdscr
291
303
  */
292
304
  static VALUE
293
- curses_init_screen(void)
305
+ curses_init_screen(VALUE self)
294
306
  {
295
307
  if (rb_stdscr) return rb_stdscr;
296
308
  initscr();
@@ -313,7 +325,7 @@ curses_init_screen(void)
313
325
  *
314
326
  * Many curses functions use this window.
315
327
  */
316
- #define curses_stdscr curses_init_screen
328
+ #define curses_stdscr() curses_init_screen(Qnil)
317
329
 
318
330
  /*
319
331
  * Document-method: Curses.close_screen
@@ -329,7 +341,7 @@ curses_init_screen(void)
329
341
  *
330
342
  */
331
343
  static VALUE
332
- curses_close_screen(void)
344
+ curses_close_screen(VALUE self)
333
345
  {
334
346
  curses_stdscr();
335
347
  #ifdef HAVE_ISENDWIN
@@ -369,7 +381,7 @@ curses_finalize(VALUE dummy)
369
381
  * returns +false+ otherwise.
370
382
  */
371
383
  static VALUE
372
- curses_closed(void)
384
+ curses_closed(VALUE self)
373
385
  {
374
386
  curses_stdscr();
375
387
  if (isendwin()) {
@@ -419,7 +431,7 @@ curses_erase(VALUE obj)
419
431
  * Clears to the end of line, that the cursor is currently on.
420
432
  */
421
433
  static VALUE
422
- curses_clrtoeol(void)
434
+ curses_clrtoeol(VALUE self)
423
435
  {
424
436
  curses_stdscr();
425
437
  clrtoeol();
@@ -746,7 +758,7 @@ static VALUE
746
758
  curses_inch(VALUE obj)
747
759
  {
748
760
  curses_stdscr();
749
- return CH2FIX(inch());
761
+ return CHTYPE2NUM(inch());
750
762
  }
751
763
 
752
764
  /*
@@ -761,7 +773,7 @@ static VALUE
761
773
  curses_addch(VALUE obj, VALUE ch)
762
774
  {
763
775
  curses_stdscr();
764
- addch(NUM2CH(ch));
776
+ addch(OBJ2CHTYPE(ch));
765
777
  return Qnil;
766
778
  }
767
779
 
@@ -776,7 +788,7 @@ static VALUE
776
788
  curses_insch(VALUE obj, VALUE ch)
777
789
  {
778
790
  curses_stdscr();
779
- insch(NUM2CH(ch));
791
+ insch(OBJ2CHTYPE(ch));
780
792
  return Qnil;
781
793
  }
782
794
 
@@ -857,7 +869,7 @@ getstr_func(void *arg)
857
869
  /*
858
870
  * Document-method: Curses.getstr
859
871
  *
860
- * This is equivalent to a series f Curses::Window.getch calls
872
+ * This is equivalent to a series of Curses::Window.getch calls
861
873
  *
862
874
  */
863
875
  static VALUE
@@ -948,7 +960,7 @@ curses_keyname(VALUE obj, VALUE c)
948
960
  * Returns the number of lines on the screen
949
961
  */
950
962
  static VALUE
951
- curses_lines(void)
963
+ curses_lines(VALUE self)
952
964
  {
953
965
  return INT2FIX(LINES);
954
966
  }
@@ -959,7 +971,7 @@ curses_lines(void)
959
971
  * Returns the number of columns on the screen
960
972
  */
961
973
  static VALUE
962
- curses_cols(void)
974
+ curses_cols(VALUE self)
963
975
  {
964
976
  return INT2FIX(COLS);
965
977
  }
@@ -1105,7 +1117,7 @@ curses_bkgdset(VALUE obj, VALUE ch)
1105
1117
  {
1106
1118
  #ifdef HAVE_BKGDSET
1107
1119
  curses_stdscr();
1108
- bkgdset(NUM2CHTYPE(ch));
1120
+ bkgdset(OBJ2CHTYPE(ch));
1109
1121
  #endif
1110
1122
  return Qnil;
1111
1123
  }
@@ -1126,7 +1138,7 @@ curses_bkgd(VALUE obj, VALUE ch)
1126
1138
  {
1127
1139
  #ifdef HAVE_BKGD
1128
1140
  curses_stdscr();
1129
- return (bkgd(NUM2CHTYPE(ch)) == OK) ? Qtrue : Qfalse;
1141
+ return (bkgd(OBJ2CHTYPE(ch)) == OK) ? Qtrue : Qfalse;
1130
1142
  #else
1131
1143
  return Qfalse;
1132
1144
  #endif
@@ -1439,6 +1451,7 @@ struct mousedata {
1439
1451
  MEVENT *mevent;
1440
1452
  };
1441
1453
 
1454
+ NORETURN(static void no_mevent(void));
1442
1455
  static void
1443
1456
  no_mevent(void)
1444
1457
  {
@@ -1446,8 +1459,6 @@ no_mevent(void)
1446
1459
  }
1447
1460
 
1448
1461
  #define GetMOUSE(obj, data) do {\
1449
- if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4)\
1450
- rb_raise(rb_eSecurityError, "Insecure: operation on untainted mouse");\
1451
1462
  TypedData_Get_Struct((obj), struct mousedata, &mousedata_type, (data));\
1452
1463
  if ((data)->mevent == 0) no_mevent();\
1453
1464
  } while (0)
@@ -1466,7 +1477,7 @@ curses_mousedata_memsize(const void *p)
1466
1477
  const struct mousedata *mdata = p;
1467
1478
  size_t size = sizeof(*mdata);
1468
1479
  if (!mdata) return 0;
1469
- if (mdata->mevent) size += sizeof(*mdata->mevent);
1480
+ if (mdata->mevent) size += CURSES_SIZEOF_MEVENT;
1470
1481
  return size;
1471
1482
  }
1472
1483
 
@@ -1548,7 +1559,7 @@ static VALUE
1548
1559
  curses_mousemask(VALUE obj, VALUE mask)
1549
1560
  {
1550
1561
  curses_stdscr();
1551
- return INT2NUM(mousemask(NUM2UINT(mask),NULL));
1562
+ return ULONG2NUM(mousemask(NUM2UINT(mask),NULL));
1552
1563
  }
1553
1564
 
1554
1565
  #define DEFINE_MOUSE_GET_MEMBER(func_name,mem) \
@@ -1589,7 +1600,12 @@ DEFINE_MOUSE_GET_MEMBER(curs_mouse_z, z)
1589
1600
  * Returns the current mouse's button state. Use this with the button state
1590
1601
  * constants to determine which buttons were pressed.
1591
1602
  */
1592
- DEFINE_MOUSE_GET_MEMBER(curs_mouse_bstate, bstate)
1603
+ static VALUE curs_mouse_bstate(VALUE mouse)
1604
+ {
1605
+ struct mousedata *mdata;
1606
+ GetMOUSE(mouse, mdata);
1607
+ return ULONG2NUM(mdata->mevent->bstate);
1608
+ }
1593
1609
  #undef define_curs_mouse_member
1594
1610
  #endif /* USE_MOUSE */
1595
1611
 
@@ -1681,7 +1697,7 @@ window_initialize(VALUE obj, VALUE h, VALUE w, VALUE top, VALUE left)
1681
1697
  struct windata *winp;
1682
1698
  WINDOW *window;
1683
1699
 
1684
- curses_init_screen();
1700
+ curses_init_screen(Qnil);
1685
1701
  TypedData_Get_Struct(obj, struct windata, &windata_type, winp);
1686
1702
  if (winp->window) delwin(winp->window);
1687
1703
  window = newwin(NUM2INT(h), NUM2INT(w), NUM2INT(top), NUM2INT(left));
@@ -2178,7 +2194,7 @@ window_begx(VALUE obj)
2178
2194
 
2179
2195
  /*
2180
2196
  * Document-method: Curses::Window.box
2181
- * call-seq: box(vert, hor)
2197
+ * call-seq: box(vert = nil, hor = nil, corn = nil)
2182
2198
  *
2183
2199
  * set the characters to frame the window in.
2184
2200
  * The vertical +vert+ and horizontal +hor+ character.
@@ -2193,16 +2209,18 @@ window_box(int argc, VALUE *argv, VALUE self)
2193
2209
  struct windata *winp;
2194
2210
  VALUE vert, hor, corn;
2195
2211
 
2196
- rb_scan_args(argc, argv, "21", &vert, &hor, &corn);
2212
+ rb_scan_args(argc, argv, "03", &vert, &hor, &corn);
2197
2213
 
2198
2214
  GetWINDOW(self, winp);
2199
- box(winp->window, NUM2CH(vert), NUM2CH(hor));
2215
+ box(winp->window,
2216
+ NIL_P(vert) ? 0 : OBJ2CHTYPE(vert),
2217
+ NIL_P(hor) ? 0 : OBJ2CHTYPE(hor));
2200
2218
 
2201
2219
  if (!NIL_P(corn)) {
2202
2220
  int cur_x, cur_y, x, y;
2203
2221
  chtype c;
2204
2222
 
2205
- c = NUM2CH(corn);
2223
+ c = OBJ2CHTYPE(corn);
2206
2224
  getyx(winp->window, cur_y, cur_x);
2207
2225
  x = NUM2INT(window_maxx(self)) - 1;
2208
2226
  y = NUM2INT(window_maxy(self)) - 1;
@@ -2269,7 +2287,7 @@ window_inch(VALUE obj)
2269
2287
  struct windata *winp;
2270
2288
 
2271
2289
  GetWINDOW(obj, winp);
2272
- return CH2FIX(winch(winp->window));
2290
+ return CHTYPE2NUM(winch(winp->window));
2273
2291
  }
2274
2292
 
2275
2293
  /*
@@ -2286,7 +2304,7 @@ window_addch(VALUE obj, VALUE ch)
2286
2304
  struct windata *winp;
2287
2305
 
2288
2306
  GetWINDOW(obj, winp);
2289
- waddch(winp->window, NUM2CH(ch));
2307
+ waddch(winp->window, OBJ2CHTYPE(ch));
2290
2308
 
2291
2309
  return Qnil;
2292
2310
  }
@@ -2304,7 +2322,7 @@ window_insch(VALUE obj, VALUE ch)
2304
2322
  struct windata *winp;
2305
2323
 
2306
2324
  GetWINDOW(obj, winp);
2307
- winsch(winp->window, NUM2CH(ch));
2325
+ winsch(winp->window, OBJ2CHTYPE(ch));
2308
2326
 
2309
2327
  return Qnil;
2310
2328
  }
@@ -2414,7 +2432,7 @@ wgetstr_func(void *_arg)
2414
2432
  /*
2415
2433
  * Document-method: Curses::Window.getstr
2416
2434
  *
2417
- * This is equivalent to a series f Curses::Window.getch calls
2435
+ * This is equivalent to a series of Curses::Window.getch calls
2418
2436
  *
2419
2437
  */
2420
2438
  static VALUE
@@ -2732,7 +2750,7 @@ window_bkgdset(VALUE obj, VALUE ch)
2732
2750
  struct windata *winp;
2733
2751
 
2734
2752
  GetWINDOW(obj,winp);
2735
- wbkgdset(winp->window, NUM2CHTYPE(ch));
2753
+ wbkgdset(winp->window, OBJ2CHTYPE(ch));
2736
2754
  #endif
2737
2755
  return Qnil;
2738
2756
  }
@@ -2753,7 +2771,7 @@ window_bkgd(VALUE obj, VALUE ch)
2753
2771
  struct windata *winp;
2754
2772
 
2755
2773
  GetWINDOW(obj,winp);
2756
- return (wbkgd(winp->window, NUM2CHTYPE(ch)) == OK) ? Qtrue : Qfalse;
2774
+ return (wbkgd(winp->window, OBJ2CHTYPE(ch)) == OK) ? Qtrue : Qfalse;
2757
2775
  #else
2758
2776
  return Qfalse;
2759
2777
  #endif
@@ -2921,7 +2939,7 @@ pad_initialize(VALUE obj, VALUE h, VALUE w)
2921
2939
  struct windata *padp;
2922
2940
  WINDOW *window;
2923
2941
 
2924
- curses_init_screen();
2942
+ curses_init_screen(Qnil);
2925
2943
  TypedData_Get_Struct(obj, struct windata, &windata_type, padp);
2926
2944
  if (padp->window) delwin(padp->window);
2927
2945
  window = newpad(NUM2INT(h), NUM2INT(w));
@@ -3042,8 +3060,6 @@ no_item(void)
3042
3060
  }
3043
3061
 
3044
3062
  #define GetITEM(obj, itemp) do {\
3045
- if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4)\
3046
- rb_raise(rb_eSecurityError, "Insecure: operation on untainted item");\
3047
3063
  TypedData_Get_Struct((obj), struct itemdata, &itemdata_type, (itemp));\
3048
3064
  if ((itemp)->item == 0) no_item();\
3049
3065
  } while (0)
@@ -3063,7 +3079,7 @@ item_memsize(const void *p)
3063
3079
  const struct itemdata *itemp = p;
3064
3080
  size_t size = sizeof(*itemp);
3065
3081
  if (!itemp) return 0;
3066
- if (itemp->item) size += sizeof(*itemp->item);
3082
+ if (itemp->item) size += CURSES_SIZEOF_ITEM;
3067
3083
  return size;
3068
3084
  }
3069
3085
 
@@ -3094,7 +3110,7 @@ item_initialize(VALUE obj, VALUE name, VALUE description)
3094
3110
  {
3095
3111
  struct itemdata *itemp;
3096
3112
 
3097
- curses_init_screen();
3113
+ curses_init_screen(Qnil);
3098
3114
  TypedData_Get_Struct(obj, struct itemdata, &itemdata_type, itemp);
3099
3115
  if (itemp->item) {
3100
3116
  rb_raise(rb_eRuntimeError, "already initialized item");
@@ -3242,8 +3258,6 @@ no_menu(void)
3242
3258
  }
3243
3259
 
3244
3260
  #define GetMENU(obj, menup) do {\
3245
- if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4)\
3246
- rb_raise(rb_eSecurityError, "Insecure: operation on untainted menu");\
3247
3261
  TypedData_Get_Struct((obj), struct menudata, &menudata_type, (menup));\
3248
3262
  if ((menup)->menu == 0) no_menu();\
3249
3263
  } while (0)
@@ -3274,7 +3288,7 @@ menu_memsize(const void *p)
3274
3288
  const struct menudata *menup = p;
3275
3289
  size_t size = sizeof(*menup);
3276
3290
  if (!menup) return 0;
3277
- if (menup->menu) size += sizeof(*menup->menu);
3291
+ if (menup->menu) size += CURSES_SIZEOF_MENU;
3278
3292
  return size;
3279
3293
  }
3280
3294
 
@@ -3309,7 +3323,7 @@ menu_initialize(VALUE obj, VALUE items)
3309
3323
  ID id_new;
3310
3324
 
3311
3325
  Check_Type(items, T_ARRAY);
3312
- curses_init_screen();
3326
+ curses_init_screen(Qnil);
3313
3327
  TypedData_Get_Struct(obj, struct menudata, &menudata_type, menup);
3314
3328
  if (menup->menu) {
3315
3329
  rb_raise(rb_eRuntimeError, "already initialized menu");
@@ -3706,6 +3720,7 @@ struct fielddata {
3706
3720
  FIELD *field;
3707
3721
  };
3708
3722
 
3723
+ NORETURN(static void no_field(void));
3709
3724
  static void
3710
3725
  no_field(void)
3711
3726
  {
@@ -3713,8 +3728,6 @@ no_field(void)
3713
3728
  }
3714
3729
 
3715
3730
  #define GetFIELD(obj, fieldp) do {\
3716
- if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4)\
3717
- rb_raise(rb_eSecurityError, "Insecure: operation on untainted field");\
3718
3731
  TypedData_Get_Struct((obj), struct fielddata, &fielddata_type, (fieldp));\
3719
3732
  if ((fieldp)->field == 0) no_field();\
3720
3733
  } while (0)
@@ -3734,7 +3747,7 @@ field_memsize(const void *p)
3734
3747
  const struct fielddata *fieldp = p;
3735
3748
  size_t size = sizeof(*fieldp);
3736
3749
  if (!fieldp) return 0;
3737
- if (fieldp->field) size += sizeof(*fieldp->field);
3750
+ if (fieldp->field) size += CURSES_SIZEOF_FIELD;
3738
3751
  return size;
3739
3752
  }
3740
3753
 
@@ -3766,7 +3779,7 @@ field_initialize(VALUE obj, VALUE height, VALUE width,
3766
3779
  {
3767
3780
  struct fielddata *fieldp;
3768
3781
 
3769
- curses_init_screen();
3782
+ curses_init_screen(Qnil);
3770
3783
  TypedData_Get_Struct(obj, struct fielddata, &fielddata_type, fieldp);
3771
3784
  if (fieldp->field) {
3772
3785
  rb_raise(rb_eRuntimeError, "already initialized field");
@@ -4152,6 +4165,7 @@ struct formdata {
4152
4165
  VALUE fields;
4153
4166
  };
4154
4167
 
4168
+ NORETURN(static void no_form(void));
4155
4169
  static void
4156
4170
  no_form(void)
4157
4171
  {
@@ -4159,8 +4173,6 @@ no_form(void)
4159
4173
  }
4160
4174
 
4161
4175
  #define GetFORM(obj, formp) do {\
4162
- if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4)\
4163
- rb_raise(rb_eSecurityError, "Insecure: operation on untainted form");\
4164
4176
  TypedData_Get_Struct((obj), struct formdata, &formdata_type, (formp));\
4165
4177
  if ((formp)->form == 0) no_form();\
4166
4178
  } while (0)
@@ -4191,7 +4203,7 @@ form_memsize(const void *p)
4191
4203
  const struct formdata *formp = p;
4192
4204
  size_t size = sizeof(*formp);
4193
4205
  if (!formp) return 0;
4194
- if (formp->form) size += sizeof(*formp->form);
4206
+ if (formp->form) size += CURSES_SIZEOF_FORM;
4195
4207
  return size;
4196
4208
  }
4197
4209
 
@@ -4225,7 +4237,7 @@ form_initialize(VALUE obj, VALUE fields)
4225
4237
  int i;
4226
4238
 
4227
4239
  Check_Type(fields, T_ARRAY);
4228
- curses_init_screen();
4240
+ curses_init_screen(Qnil);
4229
4241
  TypedData_Get_Struct(obj, struct formdata, &formdata_type, formp);
4230
4242
  if (formp->form) {
4231
4243
  rb_raise(rb_eRuntimeError, "already initialized form");
@@ -4725,7 +4737,7 @@ Init_curses(void)
4725
4737
  rb_define_module_function(mCurses, "init_screen", curses_init_screen, 0);
4726
4738
  rb_define_module_function(mCurses, "close_screen", curses_close_screen, 0);
4727
4739
  rb_define_module_function(mCurses, "closed?", curses_closed, 0);
4728
- rb_define_module_function(mCurses, "stdscr", curses_stdscr, 0);
4740
+ rb_define_module_function(mCurses, "stdscr", curses_init_screen, 0);
4729
4741
  rb_define_module_function(mCurses, "refresh", curses_refresh, 0);
4730
4742
  rb_define_module_function(mCurses, "doupdate", curses_doupdate, 0);
4731
4743
  rb_define_module_function(mCurses, "clear", curses_clear, 0);
@@ -4865,7 +4877,7 @@ Init_curses(void)
4865
4877
  * win.close
4866
4878
  *
4867
4879
  */
4868
- cWindow = rb_define_class_under(mCurses, "Window", rb_cData);
4880
+ cWindow = rb_define_class_under(mCurses, "Window", rb_cObject);
4869
4881
  rb_define_alloc_func(cWindow, window_s_allocate);
4870
4882
  rb_define_method(cWindow, "initialize", window_initialize, 4);
4871
4883
  rb_define_method(cWindow, "subwin", window_subwin, 4);
@@ -4949,7 +4961,7 @@ Init_curses(void)
4949
4961
  #endif
4950
4962
 
4951
4963
  #ifdef HAVE_MENU
4952
- cItem = rb_define_class_under(mCurses, "Item", rb_cData);
4964
+ cItem = rb_define_class_under(mCurses, "Item", rb_cObject);
4953
4965
  rb_define_alloc_func(cItem, item_s_allocate);
4954
4966
  rb_define_method(cItem, "initialize", item_initialize, 2);
4955
4967
  rb_define_method(cItem, "==", item_eq, 1);
@@ -4960,7 +4972,7 @@ Init_curses(void)
4960
4972
  rb_define_method(cItem, "opts_off", item_opts_off_m, 1);
4961
4973
  rb_define_method(cItem, "opts", item_opts_m, 0);
4962
4974
 
4963
- cMenu = rb_define_class_under(mCurses, "Menu", rb_cData);
4975
+ cMenu = rb_define_class_under(mCurses, "Menu", rb_cObject);
4964
4976
  rb_define_alloc_func(cMenu, menu_s_allocate);
4965
4977
  rb_define_method(cMenu, "initialize", menu_initialize, 1);
4966
4978
  rb_define_method(cMenu, "post", menu_post, 0);
@@ -4983,7 +4995,7 @@ Init_curses(void)
4983
4995
  #endif
4984
4996
 
4985
4997
  #ifdef HAVE_FORM
4986
- cField = rb_define_class_under(mCurses, "Field", rb_cData);
4998
+ cField = rb_define_class_under(mCurses, "Field", rb_cObject);
4987
4999
  rb_define_alloc_func(cField, field_s_allocate);
4988
5000
  rb_define_method(cField, "initialize", field_initialize, 6);
4989
5001
  rb_define_method(cField, "set_buffer", field_set_buffer, 2);
@@ -5010,7 +5022,7 @@ Init_curses(void)
5010
5022
  rb_define_method(cField, "max=", field_set_max, 1);
5011
5023
  rb_define_method(cField, "set_type", field_set_type, -1);
5012
5024
 
5013
- cForm = rb_define_class_under(mCurses, "Form", rb_cData);
5025
+ cForm = rb_define_class_under(mCurses, "Form", rb_cObject);
5014
5026
  rb_define_alloc_func(cForm, form_s_allocate);
5015
5027
  rb_define_method(cForm, "initialize", form_initialize, 1);
5016
5028
  rb_define_method(cForm, "post", form_post, 0);