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
@@ -0,0 +1,411 @@
1
+ /* Public Domain Curses */
2
+
3
+ #include <curspriv.h>
4
+
5
+ /*man-start**************************************************************
6
+
7
+ border
8
+ ------
9
+
10
+ ### Synopsis
11
+
12
+ int border(chtype ls, chtype rs, chtype ts, chtype bs, chtype tl,
13
+ chtype tr, chtype bl, chtype br);
14
+ int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts,
15
+ chtype bs, chtype tl, chtype tr, chtype bl, chtype br);
16
+ int box(WINDOW *win, chtype verch, chtype horch);
17
+ int hline(chtype ch, int n);
18
+ int vline(chtype ch, int n);
19
+ int whline(WINDOW *win, chtype ch, int n);
20
+ int wvline(WINDOW *win, chtype ch, int n);
21
+ int mvhline(int y, int x, chtype ch, int n);
22
+ int mvvline(int y, int x, chtype ch, int n);
23
+ int mvwhline(WINDOW *win, int y, int x, chtype ch, int n);
24
+ int mvwvline(WINDOW *win, int y, int x, chtype ch, int n);
25
+
26
+ int border_set(const cchar_t *ls, const cchar_t *rs,
27
+ const cchar_t *ts, const cchar_t *bs,
28
+ const cchar_t *tl, const cchar_t *tr,
29
+ const cchar_t *bl, const cchar_t *br);
30
+ int wborder_set(WINDOW *win, const cchar_t *ls, const cchar_t *rs,
31
+ const cchar_t *ts, const cchar_t *bs,
32
+ const cchar_t *tl, const cchar_t *tr,
33
+ const cchar_t *bl, const cchar_t *br);
34
+ int box_set(WINDOW *win, const cchar_t *verch, const cchar_t *horch);
35
+ int hline_set(const cchar_t *wch, int n);
36
+ int vline_set(const cchar_t *wch, int n);
37
+ int whline_set(WINDOW *win, const cchar_t *wch, int n);
38
+ int wvline_set(WINDOW *win, const cchar_t *wch, int n);
39
+ int mvhline_set(int y, int x, const cchar_t *wch, int n);
40
+ int mvvline_set(int y, int x, const cchar_t *wch, int n);
41
+ int mvwhline_set(WINDOW *win, int y, int x, const cchar_t *wch, int n);
42
+ int mvwvline_set(WINDOW *win, int y, int x, const cchar_t *wch, int n);
43
+
44
+ ### Description
45
+
46
+ border(), wborder(), and box() draw a border around the edge of
47
+ the window. If any argument is zero, an appropriate default is
48
+ used:
49
+
50
+ ls left side of border ACS_VLINE
51
+ rs right side of border ACS_VLINE
52
+ ts top side of border ACS_HLINE
53
+ bs bottom side of border ACS_HLINE
54
+ tl top left corner of border ACS_ULCORNER
55
+ tr top right corner of border ACS_URCORNER
56
+ bl bottom left corner of border ACS_LLCORNER
57
+ br bottom right corner of border ACS_LRCORNER
58
+
59
+ hline() and whline() draw a horizontal line, using ch, starting
60
+ from the current cursor position. The cursor position does not
61
+ change. The line is at most n characters long, or as many as
62
+ will fit in the window.
63
+
64
+ vline() and wvline() draw a vertical line, using ch, starting
65
+ from the current cursor position. The cursor position does not
66
+ change. The line is at most n characters long, or as many as
67
+ will fit in the window.
68
+
69
+ ### Return Value
70
+
71
+ These functions return OK on success and ERR on error.
72
+
73
+ ### Portability
74
+ X/Open BSD SYS V
75
+ border Y - 4.0
76
+ wborder Y - 4.0
77
+ box Y Y Y
78
+ hline Y - 4.0
79
+ vline Y - 4.0
80
+ whline Y - 4.0
81
+ wvline Y - 4.0
82
+ mvhline Y
83
+ mvvline Y
84
+ mvwhline Y
85
+ mvwvline Y
86
+ border_set Y
87
+ wborder_set Y
88
+ box_set Y
89
+ hline_set Y
90
+ vline_set Y
91
+ whline_set Y
92
+ wvline_set Y
93
+ mvhline_set Y
94
+ mvvline_set Y
95
+ mvwhline_set Y
96
+ mvwvline_set Y
97
+
98
+ **man-end****************************************************************/
99
+
100
+ /* _attr_passthru() -- Takes a single chtype 'ch' and checks if the
101
+ current attribute of window 'win', as set by wattrset(), and/or the
102
+ current background of win, as set by wbkgd(), should by combined with
103
+ it. Attributes set explicitly in ch take precedence. */
104
+
105
+ static chtype _attr_passthru(WINDOW *win, chtype ch)
106
+ {
107
+ chtype attr;
108
+
109
+ /* If the incoming character doesn't have its own attribute, then
110
+ use the current attributes for the window. If the incoming
111
+ character has attributes, but not a color component, OR the
112
+ attributes to the current attributes for the window. If the
113
+ incoming character has a color component, use only the attributes
114
+ from the incoming character. */
115
+
116
+ attr = ch & A_ATTRIBUTES;
117
+ if (!(attr & A_COLOR))
118
+ attr |= win->_attrs;
119
+
120
+ /* wrs (4/10/93) -- Apply the same sort of logic for the window
121
+ background, in that it only takes precedence if other color
122
+ attributes are not there. */
123
+
124
+ if (!(attr & A_COLOR))
125
+ attr |= win->_bkgd & A_ATTRIBUTES;
126
+ else
127
+ attr |= win->_bkgd & (A_ATTRIBUTES ^ A_COLOR);
128
+
129
+ ch = (ch & A_CHARTEXT) | attr;
130
+
131
+ return ch;
132
+ }
133
+
134
+ int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts, chtype bs,
135
+ chtype tl, chtype tr, chtype bl, chtype br)
136
+ {
137
+ int i, ymax, xmax;
138
+
139
+ PDC_LOG(("wborder() - called\n"));
140
+
141
+ if (!win)
142
+ return ERR;
143
+
144
+ ymax = win->_maxy - 1;
145
+ xmax = win->_maxx - 1;
146
+
147
+ ls = _attr_passthru(win, ls ? ls : ACS_VLINE);
148
+ rs = _attr_passthru(win, rs ? rs : ACS_VLINE);
149
+ ts = _attr_passthru(win, ts ? ts : ACS_HLINE);
150
+ bs = _attr_passthru(win, bs ? bs : ACS_HLINE);
151
+ tl = _attr_passthru(win, tl ? tl : ACS_ULCORNER);
152
+ tr = _attr_passthru(win, tr ? tr : ACS_URCORNER);
153
+ bl = _attr_passthru(win, bl ? bl : ACS_LLCORNER);
154
+ br = _attr_passthru(win, br ? br : ACS_LRCORNER);
155
+
156
+ for (i = 1; i < xmax; i++)
157
+ {
158
+ win->_y[0][i] = ts;
159
+ win->_y[ymax][i] = bs;
160
+ }
161
+
162
+ for (i = 1; i < ymax; i++)
163
+ {
164
+ win->_y[i][0] = ls;
165
+ win->_y[i][xmax] = rs;
166
+ }
167
+
168
+ win->_y[0][0] = tl;
169
+ win->_y[0][xmax] = tr;
170
+ win->_y[ymax][0] = bl;
171
+ win->_y[ymax][xmax] = br;
172
+
173
+ for (i = 0; i <= ymax; i++)
174
+ {
175
+ win->_firstch[i] = 0;
176
+ win->_lastch[i] = xmax;
177
+ }
178
+
179
+ PDC_sync(win);
180
+
181
+ return OK;
182
+ }
183
+
184
+ int border(chtype ls, chtype rs, chtype ts, chtype bs, chtype tl,
185
+ chtype tr, chtype bl, chtype br)
186
+ {
187
+ PDC_LOG(("border() - called\n"));
188
+
189
+ return wborder(stdscr, ls, rs, ts, bs, tl, tr, bl, br);
190
+ }
191
+
192
+ int box(WINDOW *win, chtype verch, chtype horch)
193
+ {
194
+ PDC_LOG(("box() - called\n"));
195
+
196
+ return wborder(win, verch, verch, horch, horch, 0, 0, 0, 0);
197
+ }
198
+
199
+ int whline(WINDOW *win, chtype ch, int n)
200
+ {
201
+ chtype *dest;
202
+ int startpos, endpos;
203
+
204
+ PDC_LOG(("whline() - called\n"));
205
+
206
+ if (!win || n < 1)
207
+ return ERR;
208
+
209
+ startpos = win->_curx;
210
+ endpos = min(startpos + n, win->_maxx) - 1;
211
+ dest = win->_y[win->_cury];
212
+ ch = _attr_passthru(win, ch ? ch : ACS_HLINE);
213
+
214
+ for (n = startpos; n <= endpos; n++)
215
+ dest[n] = ch;
216
+
217
+ n = win->_cury;
218
+
219
+ if (startpos < win->_firstch[n] || win->_firstch[n] == _NO_CHANGE)
220
+ win->_firstch[n] = startpos;
221
+
222
+ if (endpos > win->_lastch[n])
223
+ win->_lastch[n] = endpos;
224
+
225
+ PDC_sync(win);
226
+
227
+ return OK;
228
+ }
229
+
230
+ int hline(chtype ch, int n)
231
+ {
232
+ PDC_LOG(("hline() - called\n"));
233
+
234
+ return whline(stdscr, ch, n);
235
+ }
236
+
237
+ int mvhline(int y, int x, chtype ch, int n)
238
+ {
239
+ PDC_LOG(("mvhline() - called\n"));
240
+
241
+ if (move(y, x) == ERR)
242
+ return ERR;
243
+
244
+ return whline(stdscr, ch, n);
245
+ }
246
+
247
+ int mvwhline(WINDOW *win, int y, int x, chtype ch, int n)
248
+ {
249
+ PDC_LOG(("mvwhline() - called\n"));
250
+
251
+ if (wmove(win, y, x) == ERR)
252
+ return ERR;
253
+
254
+ return whline(win, ch, n);
255
+ }
256
+
257
+ int wvline(WINDOW *win, chtype ch, int n)
258
+ {
259
+ int endpos, x;
260
+
261
+ PDC_LOG(("wvline() - called\n"));
262
+
263
+ if (!win || n < 1)
264
+ return ERR;
265
+
266
+ endpos = min(win->_cury + n, win->_maxy);
267
+ x = win->_curx;
268
+
269
+ ch = _attr_passthru(win, ch ? ch : ACS_VLINE);
270
+
271
+ for (n = win->_cury; n < endpos; n++)
272
+ {
273
+ win->_y[n][x] = ch;
274
+
275
+ if (x < win->_firstch[n] || win->_firstch[n] == _NO_CHANGE)
276
+ win->_firstch[n] = x;
277
+
278
+ if (x > win->_lastch[n])
279
+ win->_lastch[n] = x;
280
+ }
281
+
282
+ PDC_sync(win);
283
+
284
+ return OK;
285
+ }
286
+
287
+ int vline(chtype ch, int n)
288
+ {
289
+ PDC_LOG(("vline() - called\n"));
290
+
291
+ return wvline(stdscr, ch, n);
292
+ }
293
+
294
+ int mvvline(int y, int x, chtype ch, int n)
295
+ {
296
+ PDC_LOG(("mvvline() - called\n"));
297
+
298
+ if (move(y, x) == ERR)
299
+ return ERR;
300
+
301
+ return wvline(stdscr, ch, n);
302
+ }
303
+
304
+ int mvwvline(WINDOW *win, int y, int x, chtype ch, int n)
305
+ {
306
+ PDC_LOG(("mvwvline() - called\n"));
307
+
308
+ if (wmove(win, y, x) == ERR)
309
+ return ERR;
310
+
311
+ return wvline(win, ch, n);
312
+ }
313
+
314
+ #ifdef PDC_WIDE
315
+ int wborder_set(WINDOW *win, const cchar_t *ls, const cchar_t *rs,
316
+ const cchar_t *ts, const cchar_t *bs, const cchar_t *tl,
317
+ const cchar_t *tr, const cchar_t *bl, const cchar_t *br)
318
+ {
319
+ PDC_LOG(("wborder_set() - called\n"));
320
+
321
+ return wborder(win, ls ? *ls : 0, rs ? *rs : 0, ts ? *ts : 0,
322
+ bs ? *bs : 0, tl ? *tl : 0, tr ? *tr : 0,
323
+ bl ? *bl : 0, br ? *br : 0);
324
+ }
325
+
326
+ int border_set(const cchar_t *ls, const cchar_t *rs, const cchar_t *ts,
327
+ const cchar_t *bs, const cchar_t *tl, const cchar_t *tr,
328
+ const cchar_t *bl, const cchar_t *br)
329
+ {
330
+ PDC_LOG(("border_set() - called\n"));
331
+
332
+ return wborder_set(stdscr, ls, rs, ts, bs, tl, tr, bl, br);
333
+ }
334
+
335
+ int box_set(WINDOW *win, const cchar_t *verch, const cchar_t *horch)
336
+ {
337
+ PDC_LOG(("box_set() - called\n"));
338
+
339
+ return wborder_set(win, verch, verch, horch, horch,
340
+ (const cchar_t *)NULL, (const cchar_t *)NULL,
341
+ (const cchar_t *)NULL, (const cchar_t *)NULL);
342
+ }
343
+
344
+ int whline_set(WINDOW *win, const cchar_t *wch, int n)
345
+ {
346
+ PDC_LOG(("whline_set() - called\n"));
347
+
348
+ return wch ? whline(win, *wch, n) : ERR;
349
+ }
350
+
351
+ int hline_set(const cchar_t *wch, int n)
352
+ {
353
+ PDC_LOG(("hline_set() - called\n"));
354
+
355
+ return whline_set(stdscr, wch, n);
356
+ }
357
+
358
+ int mvhline_set(int y, int x, const cchar_t *wch, int n)
359
+ {
360
+ PDC_LOG(("mvhline_set() - called\n"));
361
+
362
+ if (move(y, x) == ERR)
363
+ return ERR;
364
+
365
+ return whline_set(stdscr, wch, n);
366
+ }
367
+
368
+ int mvwhline_set(WINDOW *win, int y, int x, const cchar_t *wch, int n)
369
+ {
370
+ PDC_LOG(("mvwhline_set() - called\n"));
371
+
372
+ if (wmove(win, y, x) == ERR)
373
+ return ERR;
374
+
375
+ return whline_set(win, wch, n);
376
+ }
377
+
378
+ int wvline_set(WINDOW *win, const cchar_t *wch, int n)
379
+ {
380
+ PDC_LOG(("wvline_set() - called\n"));
381
+
382
+ return wch ? wvline(win, *wch, n) : ERR;
383
+ }
384
+
385
+ int vline_set(const cchar_t *wch, int n)
386
+ {
387
+ PDC_LOG(("vline_set() - called\n"));
388
+
389
+ return wvline_set(stdscr, wch, n);
390
+ }
391
+
392
+ int mvvline_set(int y, int x, const cchar_t *wch, int n)
393
+ {
394
+ PDC_LOG(("mvvline_set() - called\n"));
395
+
396
+ if (move(y, x) == ERR)
397
+ return ERR;
398
+
399
+ return wvline_set(stdscr, wch, n);
400
+ }
401
+
402
+ int mvwvline_set(WINDOW *win, int y, int x, const cchar_t *wch, int n)
403
+ {
404
+ PDC_LOG(("mvwvline_set() - called\n"));
405
+
406
+ if (wmove(win, y, x) == ERR)
407
+ return ERR;
408
+
409
+ return wvline_set(win, wch, n);
410
+ }
411
+ #endif
@@ -0,0 +1,159 @@
1
+ /* Public Domain Curses */
2
+
3
+ #include <curspriv.h>
4
+
5
+ /*man-start**************************************************************
6
+
7
+ clear
8
+ -----
9
+
10
+ ### Synopsis
11
+
12
+ int clear(void);
13
+ int wclear(WINDOW *win);
14
+ int erase(void);
15
+ int werase(WINDOW *win);
16
+ int clrtobot(void);
17
+ int wclrtobot(WINDOW *win);
18
+ int clrtoeol(void);
19
+ int wclrtoeol(WINDOW *win);
20
+
21
+ ### Description
22
+
23
+ erase() and werase() copy blanks (i.e. the background chtype) to
24
+ every cell of the window.
25
+
26
+ clear() and wclear() are similar to erase() and werase(), but
27
+ they also call clearok() to ensure that the the window is
28
+ cleared on the next wrefresh().
29
+
30
+ clrtobot() and wclrtobot() clear the window from the current
31
+ cursor position to the end of the window.
32
+
33
+ clrtoeol() and wclrtoeol() clear the window from the current
34
+ cursor position to the end of the current line.
35
+
36
+ ### Return Value
37
+
38
+ All functions return OK on success and ERR on error.
39
+
40
+ ### Portability
41
+ X/Open BSD SYS V
42
+ clear Y Y Y
43
+ wclear Y Y Y
44
+ erase Y Y Y
45
+ werase Y Y Y
46
+ clrtobot Y Y Y
47
+ wclrtobot Y Y Y
48
+ clrtoeol Y Y Y
49
+ wclrtoeol Y Y Y
50
+
51
+ **man-end****************************************************************/
52
+
53
+ int wclrtoeol(WINDOW *win)
54
+ {
55
+ int x, y, minx;
56
+ chtype blank, *ptr;
57
+
58
+ PDC_LOG(("wclrtoeol() - called: Row: %d Col: %d\n",
59
+ win->_cury, win->_curx));
60
+
61
+ if (!win)
62
+ return ERR;
63
+
64
+ y = win->_cury;
65
+ x = win->_curx;
66
+
67
+ /* wrs (4/10/93) account for window background */
68
+
69
+ blank = win->_bkgd;
70
+
71
+ for (minx = x, ptr = &win->_y[y][x]; minx < win->_maxx; minx++, ptr++)
72
+ *ptr = blank;
73
+
74
+ if (x < win->_firstch[y] || win->_firstch[y] == _NO_CHANGE)
75
+ win->_firstch[y] = x;
76
+
77
+ win->_lastch[y] = win->_maxx - 1;
78
+
79
+ PDC_sync(win);
80
+ return OK;
81
+ }
82
+
83
+ int clrtoeol(void)
84
+ {
85
+ PDC_LOG(("clrtoeol() - called\n"));
86
+
87
+ return wclrtoeol(stdscr);
88
+ }
89
+
90
+ int wclrtobot(WINDOW *win)
91
+ {
92
+ int savey, savex;
93
+
94
+ PDC_LOG(("wclrtobot() - called\n"));
95
+
96
+ if (!win)
97
+ return ERR;
98
+
99
+ savey = win->_cury;
100
+ savex = win->_curx;
101
+
102
+ /* should this involve scrolling region somehow ? */
103
+
104
+ if (win->_cury + 1 < win->_maxy)
105
+ {
106
+ win->_curx = 0;
107
+ win->_cury++;
108
+ for (; win->_maxy > win->_cury; win->_cury++)
109
+ wclrtoeol(win);
110
+ win->_cury = savey;
111
+ win->_curx = savex;
112
+ }
113
+ wclrtoeol(win);
114
+
115
+ PDC_sync(win);
116
+ return OK;
117
+ }
118
+
119
+ int clrtobot(void)
120
+ {
121
+ PDC_LOG(("clrtobot() - called\n"));
122
+
123
+ return wclrtobot(stdscr);
124
+ }
125
+
126
+ int werase(WINDOW *win)
127
+ {
128
+ PDC_LOG(("werase() - called\n"));
129
+
130
+ if (wmove(win, 0, 0) == ERR)
131
+ return ERR;
132
+
133
+ return wclrtobot(win);
134
+ }
135
+
136
+ int erase(void)
137
+ {
138
+ PDC_LOG(("erase() - called\n"));
139
+
140
+ return werase(stdscr);
141
+ }
142
+
143
+ int wclear(WINDOW *win)
144
+ {
145
+ PDC_LOG(("wclear() - called\n"));
146
+
147
+ if (!win)
148
+ return ERR;
149
+
150
+ win->_clear = TRUE;
151
+ return werase(win);
152
+ }
153
+
154
+ int clear(void)
155
+ {
156
+ PDC_LOG(("clear() - called\n"));
157
+
158
+ return wclear(stdscr);
159
+ }