ncurses 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,62 @@
1
+ /*
2
+ * This is a curses forms wrapper as part of ncurses-ruby
3
+ * Contributed by Simon Kaczor <skaczor@cox.net>
4
+ * Prognosoft Inc. <http://www.prognosoft.biz>
5
+ * Copyright 2004
6
+ *
7
+ * This module is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU Lesser General Public
9
+ * License as published by the Free Software Foundation; either
10
+ * version 2 of the License, or (at your option) any later version.
11
+ *
12
+ * This module is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ * Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public
18
+ * License along with this module; if not, write to the Free Software
19
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
+ *
21
+ */
22
+
23
+ #if !defined(FORM_HH) && defined(HAVE_FORM_H)
24
+ #define FORM_HH
25
+
26
+ #include <form.h>
27
+ #include <ruby.h>
28
+
29
+ extern VALUE mForm;
30
+ extern VALUE cFIELD;
31
+ extern VALUE cFIELDTYPE;
32
+ extern VALUE cFORM;
33
+ /*extern VALUE cPAGE;*/
34
+
35
+ typedef struct {
36
+ bool (* field_check)(FIELD *,const void *);
37
+ FIELDTYPE* fieldtype;
38
+ } FLDCHKFUNC;
39
+
40
+
41
+
42
+ #define FORM_DEF_CONST(name) \
43
+ rb_define_const(mForm, #name, INT2NUM(name));
44
+
45
+ #define FORM_SNG_FUNC(name, nargs) \
46
+ rb_define_singleton_method(mForm, \
47
+ #name, \
48
+ &rbncurs_m_ ## name, \
49
+ nargs)
50
+ #define RB_CLASS_METH(class, name, nargs) \
51
+ rb_define_method(class, \
52
+ #name, \
53
+ (&rbncurs_c_ ## name), \
54
+ nargs);
55
+
56
+ void init_req_constants();
57
+ void init_just_constants();
58
+ void init_opts_constants();
59
+
60
+ void init_form(void);
61
+
62
+ #endif
@@ -0,0 +1,289 @@
1
+ # ncurses-ruby is a ruby module for accessing the FSF's ncurses library
2
+ # (C) 2002, 2003 Tobias Peters <t-peters@users.berlios.de>
3
+ # (C) 2004 Simon Kaczor <skaczor@cox.net>
4
+ #
5
+ # This module is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2 of the License, or (at your option) any later version.
9
+ #
10
+ # This module is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this module; if not, write to the Free Software
17
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
+
19
+ # $Id: ncurses.rb,v 1.5 2004/07/31 08:34:09 t-peters Exp $
20
+
21
+ require "ncurses.so"
22
+
23
+
24
+ # Ncurses constants with leading underscore
25
+ def Ncurses._XOPEN_CURSES
26
+ Ncurses::XOPEN_CURSES
27
+ end
28
+ def Ncurses._SUBWIN
29
+ Ncurses::SUBWIN
30
+ end
31
+ def Ncurses._ENDLINE
32
+ Ncurses::ENDLINE
33
+ end
34
+ def Ncurses._FULLWIN
35
+ Ncurses::FULLWIN
36
+ end
37
+ def Ncurses._SCROLLWIN
38
+ Ncurses::SCROLLWIN
39
+ end
40
+ def Ncurses._ISPAD
41
+ Ncurses::ISPAD
42
+ end
43
+ def Ncurses._HASMOVED
44
+ Ncurses::HASMOVED
45
+ end
46
+ def Ncurses._WRAPPED
47
+ Ncurses::WRAPPED
48
+ end
49
+ def Ncurses._NOCHANGE
50
+ Ncurses::NOCHANGE
51
+ end
52
+ def Ncurses._NEWINDEX
53
+ Ncurses::NEWINDEX
54
+ end
55
+
56
+
57
+ module Ncurses
58
+ module Destroy_checker; def destroyed?; @destroyed; end; end
59
+ class WINDOW
60
+ include Destroy_checker
61
+ def method_missing(name, *args)
62
+ name = name.to_s
63
+ if (name[0,2] == "mv")
64
+ test_name = name.dup
65
+ test_name[2,0] = "w" # insert "w" after"mv"
66
+ if (Ncurses.respond_to?(test_name))
67
+ return Ncurses.send(test_name, self, *args)
68
+ end
69
+ end
70
+ test_name = "w" + name
71
+ if (Ncurses.respond_to?(test_name))
72
+ return Ncurses.send(test_name, self, *args)
73
+ end
74
+ Ncurses.send(name, self, *args)
75
+ end
76
+ def respond_to?(name)
77
+ name = name.to_s
78
+ if (name[0,2] == "mv" && Ncurses.respond_to?("mvw" + name[2..-1]))
79
+ return true
80
+ end
81
+ Ncurses.respond_to?("w" + name) || Ncurses.respond_to?(name)
82
+ end
83
+ def del
84
+ Ncurses.delwin(self)
85
+ end
86
+ alias delete del
87
+ def WINDOW.new(*args)
88
+ Ncurses.newwin(*args)
89
+ end
90
+ end
91
+ class SCREEN
92
+ include Destroy_checker
93
+ def del
94
+ Ncurses.delscreen(self)
95
+ end
96
+ alias delete del
97
+ end
98
+ class MEVENT
99
+ attr_accessor :id, :x,:y,:z, :bstate
100
+ end
101
+ GETSTR_LIMIT = 1024
102
+
103
+ module Panel
104
+ class PANEL; end
105
+ end
106
+
107
+ module Form
108
+ class FORM
109
+ attr_reader :user_object
110
+
111
+ # This placeholder replaces the field_userptr function in curses
112
+ def user_object=(obj)
113
+ @user_object = obj
114
+ end
115
+ end
116
+
117
+ class FIELD
118
+ attr_reader :user_object
119
+
120
+ # This placeholder replaces the field_userptr function in curses
121
+ def user_object=(obj)
122
+ @user_object = obj
123
+ end
124
+ end
125
+
126
+ class FIELDTYPE
127
+ end
128
+ end
129
+ end
130
+ def Ncurses.inchnstr(str,n)
131
+ Ncurses.winchnstr(Ncurses.stdscr, str, n)
132
+ end
133
+ def Ncurses.inchstr(str)
134
+ Ncurses.winchstr(Ncurses.stdscr, str)
135
+ end
136
+ def Ncurses.mvinchnstr(y,x, str, n)
137
+ Ncurses.mvwinchnstr(Ncurses.stdscr, y,x, str, n)
138
+ end
139
+ def Ncurses.mvinchstr(y,x, str)
140
+ Ncurses.mvwinchstr(Ncurses.stdscr, y,x, str)
141
+ end
142
+ def Ncurses.mvwinchnstr(win, y,x, str, n)
143
+ if (Ncurses.wmove(win,y,x) == Ncurses::ERR)
144
+ Ncurses::ERR
145
+ else
146
+ Ncurses.winchnstr(win,str,n)
147
+ end
148
+ end
149
+ def Ncurses.mvwinchstr(win, y,x, str)
150
+ maxy = []; maxx = []; getmaxyx(win, maxy,maxx)
151
+ return Ncurses::ERR if (maxx[0] == Ncurses::ERR)
152
+ Ncurses.mvwinchnstr(win, y,x, str, maxx[0]+1)
153
+ end
154
+ def Ncurses.winchstr(win, str)
155
+ maxy = []; maxx = []; getmaxyx(win, maxy,maxx)
156
+ return Ncurses::ERR if (maxx[0] == Ncurses::ERR)
157
+ Ncurses.winchnstr(win, str, maxx[0]+1)
158
+ end
159
+
160
+ def Ncurses.getnstr(str,n)
161
+ Ncurses.wgetnstr(Ncurses.stdscr, str, n)
162
+ end
163
+ def Ncurses.mvgetnstr(y,x, str, n)
164
+ Ncurses.mvwgetnstr(Ncurses.stdscr, y,x, str, n)
165
+ end
166
+ def Ncurses.mvwgetnstr(win, y,x, str, n)
167
+ if (Ncurses.wmove(win,y,x) == Ncurses::ERR)
168
+ Ncurses::ERR
169
+ else
170
+ Ncurses.wgetnstr(win,str,n)
171
+ end
172
+ end
173
+
174
+ def Ncurses.innstr(str,n)
175
+ Ncurses.winnstr(Ncurses.stdscr, str, n)
176
+ end
177
+ def Ncurses.instr(str)
178
+ Ncurses.winstr(Ncurses.stdscr, str)
179
+ end
180
+ def Ncurses.mvinnstr(y,x, str, n)
181
+ Ncurses.mvwinnstr(Ncurses.stdscr, y,x, str, n)
182
+ end
183
+ def Ncurses.mvinstr(y,x, str)
184
+ Ncurses.mvwinstr(Ncurses.stdscr, y,x, str)
185
+ end
186
+ def Ncurses.mvwinnstr(win, y,x, str, n)
187
+ if (Ncurses.wmove(win,y,x) == Ncurses::ERR)
188
+ Ncurses::ERR
189
+ else
190
+ Ncurses.winnstr(win,str,n)
191
+ end
192
+ end
193
+ def Ncurses.mvwinstr(win, y,x, str)
194
+ maxy = []; maxx = []; getmaxyx(win, maxy,maxx)
195
+ return Ncurses::ERR if (maxx[0] == Ncurses::ERR)
196
+ Ncurses.mvwinnstr(win, y,x, str, maxx[0]+1)
197
+ end
198
+ def Ncurses.winstr(win, str)
199
+ maxy = []; maxx = []; getmaxyx(win, maxy,maxx)
200
+ return Ncurses::ERR if (maxx[0] == Ncurses::ERR)
201
+ Ncurses.winnstr(win, str, maxx[0]+1)
202
+ end
203
+
204
+ def Ncurses.mouse_trafo(pY, pX, to_screen)
205
+ Ncurses.wmouse_trafo(Ncurses.stdscr, pY, pX, to_screen)
206
+ end
207
+
208
+ def Ncurses.getcurx(win)
209
+ x = []; y = []; Ncurses.getyx(win, y,x); x[0]
210
+ end
211
+ def Ncurses.getcury(win)
212
+ x = []; y = []; Ncurses.getyx(win, y,x); y[0]
213
+ end
214
+ def Ncurses.getbegx(win)
215
+ x = []; y = []; Ncurses.getbegyx(win, y,x); x[0]
216
+ end
217
+ def Ncurses.getbegy(win)
218
+ x = []; y = []; Ncurses.getbegyx(win, y,x); y[0]
219
+ end
220
+ def Ncurses.getmaxx(win)
221
+ x = []; y = []; Ncurses.getmaxyx(win, y,x); x[0]
222
+ end
223
+ def Ncurses.getmaxy(win)
224
+ x = []; y = []; Ncurses.getmaxyx(win, y,x); y[0]
225
+ end
226
+ def Ncurses.getparx(win)
227
+ x = []; y = []; Ncurses.getparyx(win, y,x); x[0]
228
+ end
229
+ def Ncurses.getpary(win)
230
+ x = []; y = []; Ncurses.getparyx(win, y,x); y[0]
231
+ end
232
+ def Ncurses.erase
233
+ Ncurses.werase(Ncurses.stdscr)
234
+ end
235
+ def Ncurses.getstr(str)
236
+ Ncurses.getnstr(str, Ncurses::GETSTR_LIMIT)
237
+ end
238
+ def Ncurses.mvgetstr(y,x, str)
239
+ Ncurses.mvgetnstr(y,x, str, Ncurses::GETSTR_LIMIT)
240
+ end
241
+ def Ncurses.mvwgetstr(win, y,x, str)
242
+ Ncurses.mvwgetnstr(win, y,x, str, Ncurses::GETSTR_LIMIT)
243
+ end
244
+ def Ncurses.wgetstr(win, str)
245
+ Ncurses.wgetnstr(win, str, Ncurses::GETSTR_LIMIT)
246
+ end
247
+
248
+ def Ncurses.scanw(format, result)
249
+ Ncurses.wscanw(Ncurses.stdscr, format, result)
250
+ end
251
+ def Ncurses.mvscanw(y,x, format, result)
252
+ Ncurses.mvwscanw(Ncurses.stdscr, y,x, format, result)
253
+ end
254
+ def Ncurses.mvwscanw(win, y,x, format, result)
255
+ if (Ncurses.wmove(win, y,x) == Ncurses::ERR)
256
+ Ncurses::ERR
257
+ else
258
+ Ncurses.wscanw(win, format, result)
259
+ end
260
+ end
261
+ def Ncurses.wscanw(win, format, result)
262
+ str = ""
263
+ if (Ncurses.wgetstr(win, str) == Ncurses::ERR)
264
+ Ncurses::ERR
265
+ else
266
+ require "scanf.rb" # Use ruby's implementation of scanf
267
+ result.replace(str.scanf(format))
268
+ end
269
+ end
270
+
271
+ def Ncurses.mvprintw(*args)
272
+ Ncurses.mvwprintw(Ncurses.stdscr, *args)
273
+ end
274
+ def Ncurses.mvwprintw(win, y,x, *args)
275
+ if (Ncurses.wmove(win,y,x) == Ncurses::ERR)
276
+ Ncurses::ERR
277
+ else
278
+ wprintw(win, *args)
279
+ end
280
+ end
281
+ def Ncurses.printw(*args)
282
+ Ncurses.wprintw(Ncurses.stdscr, *args)
283
+ end
284
+ def Ncurses.touchline(win, start, count)
285
+ Ncurses.wtouchln(win, start, count, 1)
286
+ end
287
+ def Ncurses.touchwin(win)
288
+ wtouchln(win, 0, getmaxy(win), 1)
289
+ end
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # $Id: make_dist.rb,v 1.6 2003/08/29 22:50:12 t-peters Exp $
4
+
5
+ require "fileutils"
6
+
7
+ def sys(i)
8
+ puts("\"#{i}\"")
9
+ system(i)
10
+ end
11
+
12
+ dir = File.dirname(__FILE__)
13
+ base = File.basename(dir)
14
+ base = "ncurses-ruby" if base == "."
15
+
16
+ files = IO.readlines(dir + "/MANIFEST").collect{|filename|filename.chomp}
17
+
18
+ Version = File.new("#{dir}/VERSION").readline.chomp!
19
+
20
+ FileUtils.mkdir "#{base}-#{Version}"
21
+ files.each{|filename|
22
+ if filename.index "/"
23
+ FileUtils.mkdir_p "#{base}-#{Version}/#{File.dirname(filename)}"
24
+ end
25
+ sys "cp #{dir}/#{filename} #{base}-#{Version}/#{filename}"
26
+ }
27
+ sys "tar cjf #{base}-#{Version}.tar.bz2 --owner=0 --group=0 #{base}-#{Version}"
28
+
29
+ # check if we create a binary distribution for a mingw extension
30
+ binary_description = `file ncurses.so`
31
+
32
+ if ((binary_description =~ /\s(windows)\s/i) &&
33
+ (binary_description =~ /\s(pe)|(portable executable)\s/i) &&
34
+ (binary_description =~ /\s(dll)\s/i))
35
+ sys "cp ncurses.so README.binary #{base}-#{Version}"
36
+ Dir.glob("#{base}-#{Version}/README*").each{|textfile|
37
+ text = IO.readlines(textfile).map{|line|line.chomp + "\r\n"}
38
+ File.open(textfile + ".txt", "wb"){|outfd| outfd.write(text.join)}
39
+ sys "rm #{textfile}"
40
+ }
41
+ sys "rm #{base}-#{Version}/{MANIFEST,make_dist.rb}"
42
+ sys "zip -9 -r #{base}-#{Version}-i386-mswin32.zip #{base}-#{Version}"
43
+ end
44
+
45
+ sys "rm -r #{base}-#{Version}/"
@@ -0,0 +1,2611 @@
1
+ /*
2
+ * ncurses-ruby is a ruby module for accessing the FSF's ncurses library
3
+ * (C) 2002, 2003, 2004 Tobias Peters <t-peters@berlios.de>
4
+ * (C) 2004 Simon Kaczor <skaczor@cox.net>
5
+ *
6
+ * This module is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2 of the License, or (at your option) any later version.
10
+ *
11
+ * This module is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this module; if not, write to the Free Software
18
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
+ *
20
+ * $Id: ncurses_wrap.c,v 1.6 2004/07/31 08:35:13 t-peters Exp $
21
+ *
22
+ * This file was adapted from the original ncurses header file which
23
+ * has the following copyright statements:
24
+ */
25
+
26
+ /****************************************************************************
27
+ * Copyright (c) 1998 Free Software Foundation, Inc. *
28
+ * *
29
+ * Permission is hereby granted, free of charge, to any person obtaining a *
30
+ * copy of this software and associated documentation files (the *
31
+ * "Software"), to deal in the Software without restriction, including *
32
+ * without limitation the rights to use, copy, modify, merge, publish, *
33
+ * distribute, distribute with modifications, sublicense, and/or sell *
34
+ * copies of the Software, and to permit persons to whom the Software is *
35
+ * furnished to do so, subject to the following conditions: *
36
+ * *
37
+ * The above copyright notice and this permission notice shall be included *
38
+ * in all copies or substantial portions of the Software. *
39
+ * *
40
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
41
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
42
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
43
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
44
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
45
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
46
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
47
+ * *
48
+ * Except as contained in this notice, the name(s) of the above copyright *
49
+ * holders shall not be used in advertising or otherwise to promote the *
50
+ * sale, use or other dealings in this Software without prior written *
51
+ * authorization. *
52
+ ****************************************************************************/
53
+
54
+ /****************************************************************************
55
+ * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995 *
56
+ * and: Eric S. Raymond <esr@snark.thyrsus.com> *
57
+ ****************************************************************************/
58
+
59
+ /*
60
+ NOT IMPLEMENTED:
61
+ - terminfo, termcap-functions
62
+ - rippoffline
63
+ - v*printw functions (but normal printw functions are supported!)
64
+ */
65
+
66
+ #include "ncurses_wrap.h"
67
+
68
+ VALUE mNcurses; /* module Ncurses */
69
+ VALUE cWINDOW; /* class Ncurses::WINDOW */
70
+ VALUE cSCREEN; /* class Ncurses::SCREEN */
71
+ VALUE eNcurses; /* Ncurses::Exception thrown by this extension */
72
+
73
+ static void Init_ncurses_full(void);
74
+
75
+ static
76
+ void
77
+ init_constants_1(void)
78
+ {
79
+ #ifdef CURSES
80
+ rb_define_const(mNcurses, "CURSES", INT2NUM((int)(CURSES)));
81
+ #endif
82
+ #ifdef CURSES_H
83
+ rb_define_const(mNcurses, "CURSES_H", INT2NUM((int)(CURSES_H)));
84
+ #endif
85
+ #ifdef NCURSES_VERSION_MAJOR
86
+ rb_define_const(mNcurses, "NCURSES_VERSION_MAJOR",
87
+ INT2NUM((int)(NCURSES_VERSION_MAJOR)));
88
+ #endif
89
+ #ifdef NCURSES_VERSION_MINOR
90
+ rb_define_const(mNcurses, "NCURSES_VERSION_MINOR",
91
+ INT2NUM((int)(NCURSES_VERSION_MINOR)));
92
+ #endif
93
+ #ifdef NCURSES_VERSION_PATCH
94
+ rb_define_const(mNcurses, "NCURSES_VERSION_PATCH",
95
+ INT2NUM((int)(NCURSES_VERSION_PATCH)));
96
+ #endif
97
+ #ifdef NCURSES_VERSION
98
+ rb_define_const(mNcurses, "NCURSES_VERSION",
99
+ rb_str_new2(NCURSES_VERSION));
100
+ #endif
101
+
102
+ /* attributes */
103
+ #ifdef WA_ATTRIBUTES
104
+ rb_define_const(mNcurses, "WA_ATTRIBUTES", INT2NUM(WA_ATTRIBUTES));
105
+ rb_define_const(mNcurses, "WA_NORMAL", INT2NUM(WA_NORMAL));
106
+ rb_define_const(mNcurses, "WA_STANDOUT", INT2NUM(WA_STANDOUT));
107
+ rb_define_const(mNcurses, "WA_UNDERLINE", INT2NUM(WA_UNDERLINE));
108
+ rb_define_const(mNcurses, "WA_REVERSE", INT2NUM(WA_REVERSE));
109
+ rb_define_const(mNcurses, "WA_BLINK", INT2NUM(WA_BLINK));
110
+ rb_define_const(mNcurses, "WA_DIM", INT2NUM(WA_DIM));
111
+ rb_define_const(mNcurses, "WA_BOLD", INT2NUM(WA_BOLD));
112
+ rb_define_const(mNcurses, "WA_ALTCHARSET", INT2NUM(WA_ALTCHARSET));
113
+ rb_define_const(mNcurses, "WA_INVIS", INT2NUM(WA_INVIS));
114
+ rb_define_const(mNcurses, "WA_PROTECT", INT2NUM(WA_PROTECT));
115
+ rb_define_const(mNcurses, "WA_HORIZONTAL", INT2NUM(WA_HORIZONTAL));
116
+ rb_define_const(mNcurses, "WA_LEFT", INT2NUM(WA_LEFT));
117
+ rb_define_const(mNcurses, "WA_LOW", INT2NUM(WA_LOW));
118
+ rb_define_const(mNcurses, "WA_RIGHT", INT2NUM(WA_RIGHT));
119
+ rb_define_const(mNcurses, "WA_TOP", INT2NUM(WA_TOP));
120
+ rb_define_const(mNcurses, "WA_VERTICAL", INT2NUM(WA_VERTICAL));
121
+ #endif
122
+ }
123
+
124
+ static VALUE rbncurs_COLORS()
125
+ {return INT2NUM(COLORS);}
126
+ static VALUE rbncurs_COLOR_PAIRS()
127
+ {return INT2NUM(COLOR_PAIRS);}
128
+
129
+ static
130
+ void
131
+ init_globals_1(void)
132
+ {
133
+ /* colors */
134
+ NCFUNC(COLORS, 0);
135
+ NCFUNC(COLOR_PAIRS, 0);
136
+ }
137
+ static
138
+ void
139
+ init_constants_2(void)
140
+ {
141
+ rb_define_const(mNcurses, "COLOR_BLACK", INT2NUM(COLOR_BLACK));
142
+ rb_define_const(mNcurses, "COLOR_RED", INT2NUM(COLOR_RED));
143
+ rb_define_const(mNcurses, "COLOR_GREEN", INT2NUM(COLOR_GREEN));
144
+ rb_define_const(mNcurses, "COLOR_YELLOW", INT2NUM(COLOR_YELLOW));
145
+ rb_define_const(mNcurses, "COLOR_BLUE", INT2NUM(COLOR_BLUE));
146
+ rb_define_const(mNcurses, "COLOR_MAGENTA", INT2NUM(COLOR_MAGENTA));
147
+ rb_define_const(mNcurses, "COLOR_CYAN", INT2NUM(COLOR_CYAN));
148
+ rb_define_const(mNcurses, "COLOR_WHITE", INT2NUM(COLOR_WHITE));
149
+
150
+ rb_define_const(mNcurses, "ERR", INT2NUM(ERR));
151
+ rb_define_const(mNcurses, "OK", INT2NUM(OK));
152
+
153
+ /* values for the _flags member */
154
+ #ifdef _SUBWIN
155
+ rb_define_const(mNcurses, "SUBWIN", INT2NUM(_SUBWIN));
156
+ #endif
157
+ #ifdef _ENDLINE
158
+ rb_define_const(mNcurses, "ENDLINE", INT2NUM(_ENDLINE));
159
+ #endif
160
+ #ifdef _FULLWIN
161
+ rb_define_const(mNcurses, "FULLWIN", INT2NUM(_FULLWIN));
162
+ #endif
163
+ #ifdef _SCROLLWIN
164
+ rb_define_const(mNcurses, "SCROLLWIN", INT2NUM(_SCROLLWIN));
165
+ #endif
166
+ #ifdef _ISPAD
167
+ rb_define_const(mNcurses, "ISPAD", INT2NUM(_ISPAD));
168
+ #endif
169
+ #ifdef _HASMOVED
170
+ rb_define_const(mNcurses, "HASMOVED", INT2NUM(_HASMOVED));
171
+ #endif
172
+ #ifdef _WRAPPED
173
+ rb_define_const(mNcurses, "WRAPPED", INT2NUM(_WRAPPED));
174
+ #endif
175
+
176
+ #ifdef _NOCHANGE
177
+ /*
178
+ * this value is used in the firstchar and lastchar fields to mark
179
+ * unchanged lines
180
+ */
181
+ rb_define_const(mNcurses, "NOCHANGE", INT2NUM(_NOCHANGE));
182
+ #endif
183
+ #ifdef _NEWINDEX
184
+ /*
185
+ * this value is used in the oldindex field to mark lines created by
186
+ * insertions and scrolls.
187
+ */
188
+ rb_define_const(mNcurses, "NEWINDEX", INT2NUM(_NEWINDEX));
189
+ #endif
190
+ #ifdef CCHARW_MAX
191
+ rb_define_const(mNcurses, "CCHARW_MAX", INT2NUM(CCHARW_MAX));
192
+ #endif
193
+ }
194
+
195
+ VALUE wrap_window(WINDOW* window)
196
+ {
197
+ if (window == 0) return Qnil;
198
+ {
199
+ VALUE windows_hash = rb_iv_get(mNcurses, "@windows_hash");
200
+ VALUE window_adress = INT2NUM((long)(window));
201
+ VALUE rb_window = rb_hash_aref(windows_hash, window_adress);
202
+ if (rb_window == Qnil) {
203
+ rb_window = Data_Wrap_Struct(cWINDOW, 0, 0, window);
204
+ rb_iv_set(rb_window, "@destroyed", Qfalse);
205
+ rb_hash_aset(windows_hash, window_adress, rb_window);
206
+ }
207
+ return rb_window;
208
+ }
209
+ }
210
+ WINDOW* get_window(VALUE rb_window)
211
+ {
212
+ WINDOW* window;
213
+ if (rb_window == Qnil) return 0;
214
+ if (rb_iv_get(rb_window, "@destroyed") == Qtrue) {
215
+ rb_raise(eNcurses, "Attempt to access a destroyed window");
216
+ return 0;
217
+ }
218
+ Data_Get_Struct(rb_window, WINDOW, window);
219
+ return window;
220
+ }
221
+ static VALUE rbncurs_delwin(VALUE dummy, VALUE arg1) {
222
+ VALUE windows_hash = rb_iv_get(mNcurses, "@windows_hash");
223
+ WINDOW* window = get_window(arg1);
224
+ VALUE window_adress = INT2NUM((long)(window));
225
+ rb_funcall(windows_hash, rb_intern("delete"), 1, window_adress);
226
+ rb_iv_set(arg1, "@destroyed", Qtrue);
227
+ return INT2NUM(delwin(window));
228
+ }
229
+
230
+ static VALUE wrap_screen(SCREEN* screen)
231
+ {
232
+ if (screen == 0) return Qnil;
233
+ {
234
+ VALUE screens_hash = rb_iv_get(mNcurses, "@screens_hash");
235
+ VALUE screen_adress = INT2NUM((long)(screen));
236
+ VALUE rb_screen = rb_hash_aref(screens_hash, screen_adress);
237
+ if (rb_screen == Qnil) {
238
+ rb_screen = Data_Wrap_Struct(cSCREEN, 0, 0, screen);
239
+ rb_iv_set(rb_screen, "@destroyed", Qfalse);
240
+ rb_hash_aset(screens_hash, screen_adress, rb_screen);
241
+ }
242
+ return rb_screen;
243
+ }
244
+ }
245
+ static SCREEN* get_screen(VALUE rb_screen)
246
+ {
247
+ SCREEN* screen;
248
+ if (rb_screen == Qnil) return 0;
249
+ if (rb_iv_get(rb_screen, "@destroyed") == Qtrue) {
250
+ rb_raise(eNcurses, "Attempt to access a destroyed screen");
251
+ return 0;
252
+ }
253
+ Data_Get_Struct(rb_screen, SCREEN, screen);
254
+ return screen;
255
+ }
256
+ #ifdef HAVE_DELSCREEN
257
+ static VALUE rbncurs_delscreen(VALUE dummy, VALUE arg1) {
258
+ VALUE screens_hash = rb_iv_get(mNcurses, "@screens_hash");
259
+ SCREEN* screen = get_screen(arg1);
260
+ VALUE screen_adress = INT2NUM((long)(screen));
261
+ rb_funcall(screens_hash, rb_intern("delete"), 1, screen_adress);
262
+ rb_iv_set(arg1, "@destroyed", Qtrue);
263
+ delscreen(screen);
264
+ return Qnil;
265
+ }
266
+ #endif
267
+ static VALUE rbncurs_winchnstr(VALUE dummy, VALUE rb_win, VALUE rb_str, VALUE rb_n)
268
+ {
269
+ if (rb_obj_is_instance_of(rb_str, rb_cArray) != Qtrue) {
270
+ rb_raise(rb_eArgError, "2nd argument must be an empty Array");
271
+ return Qnil;
272
+ }
273
+
274
+ {
275
+ WINDOW * window = get_window(rb_win);
276
+ int n = NUM2INT(rb_n);
277
+ chtype * str = ALLOC_N(chtype, n + 1);
278
+ int return_value;
279
+ return_value = winchnstr(window, str, n);
280
+ if (return_value != ERR) {
281
+ int i;
282
+ for (i = 0; i < return_value; ++i) {
283
+ rb_ary_push(rb_str, INT2NUM(str[i]));
284
+ }
285
+ }
286
+ xfree(str);
287
+ return INT2NUM(return_value);
288
+ }
289
+ }
290
+ static VALUE rbncurs_wgetnstr(VALUE dummy, VALUE rb_win, VALUE rb_chstr, VALUE rb_n)
291
+ {
292
+ WINDOW * window = get_window(rb_win);
293
+ int n = NUM2INT(rb_n);
294
+ char * str = ALLOC_N(char, n + 1);
295
+ int return_value;
296
+ return_value = wgetnstr(window, str, n);
297
+ if (return_value != ERR) {
298
+ rb_str_cat2(rb_chstr, str);
299
+ }
300
+ xfree(str);
301
+ return INT2NUM(return_value);
302
+ }
303
+ static VALUE rbncurs_winnstr(VALUE dummy, VALUE rb_win, VALUE rb_chstr, VALUE rb_n)
304
+ {
305
+ WINDOW * window = get_window(rb_win);
306
+ int n = NUM2INT(rb_n);
307
+ char* str = ALLOC_N(char, n + 1);
308
+ int return_value;
309
+ return_value = winnstr(window, str, n);
310
+ if (return_value != ERR) {
311
+ rb_str_cat(rb_chstr, str, return_value);
312
+ }
313
+ xfree(str);
314
+ return INT2NUM(return_value);
315
+ }
316
+
317
+ #ifdef HAVE_PANEL_H
318
+ #include "panel_wrap.h" /* needs access to mNcurses, wrap_window, get_window */
319
+ #endif
320
+
321
+ #ifdef HAVE_FORM_H
322
+ #include "form_wrap.h" /* needs init_form */
323
+ #endif
324
+
325
+ static
326
+ void
327
+ init_functions_0(void)
328
+ {
329
+ #ifdef HAVE_DELSCREEN
330
+ NCFUNC(delscreen, 1);
331
+ #endif
332
+ NCFUNC(delwin, 1);
333
+ NCFUNC(winchnstr, 3);
334
+ NCFUNC(winnstr, 3);
335
+ NCFUNC(wgetnstr, 3);
336
+ }
337
+
338
+ static VALUE get_stdscr()
339
+ {
340
+ VALUE rb_stdscr = rb_iv_get(mNcurses, "@stdscr");
341
+ if (rb_stdscr == Qnil) {
342
+ rb_stdscr = wrap_window(stdscr);
343
+ rb_iv_set(mNcurses, "@stdscr", rb_stdscr);
344
+ }
345
+ return rb_stdscr;
346
+ }
347
+ static VALUE get_curscr()
348
+ {
349
+ VALUE rb_curscr = rb_iv_get(mNcurses, "@curscr");
350
+ if (rb_curscr == Qnil) {
351
+ rb_curscr = wrap_window(curscr);
352
+ rb_iv_set(mNcurses, "@curscr", rb_curscr);
353
+ }
354
+ return rb_curscr;
355
+ }
356
+ #ifdef HAVE_NEWSCR
357
+ static VALUE get_newscr()
358
+ {
359
+ VALUE rb_newscr = rb_iv_get(mNcurses, "@newscr");
360
+ if (rb_newscr == Qnil) {
361
+ rb_newscr = wrap_window(newscr);
362
+ rb_iv_set(mNcurses, "@newscr", rb_newscr);
363
+ }
364
+ return rb_newscr;
365
+ }
366
+ #endif
367
+ static VALUE get_LINES() {return INT2NUM(LINES);}
368
+ static VALUE get_COLS() {return INT2NUM(COLS);}
369
+ #ifdef HAVE_TABSIZE
370
+ static VALUE get_TABSIZE() {return INT2NUM(TABSIZE);}
371
+ #endif
372
+ #ifdef HAVE_ESCDELAY
373
+ /* This global was an undocumented feature under AIX curses. */
374
+ /* ESC expire time in milliseconds */
375
+ static VALUE get_ESCDELAY(){return INT2NUM(ESCDELAY);}
376
+ static VALUE set_ESCDELAY(VALUE dummy, VALUE new_delay)
377
+ {
378
+ ESCDELAY=NUM2INT(new_delay);
379
+ return INT2NUM(ESCDELAY);
380
+ }
381
+ #endif
382
+ static
383
+ void
384
+ init_globals_2(void)
385
+ {
386
+ rb_iv_set(mNcurses, "@stdscr", Qnil);
387
+ rb_iv_set(mNcurses, "@curscr", Qnil);
388
+ rb_iv_set(mNcurses, "@newscr", Qnil);
389
+ rb_define_module_function(mNcurses, "stdscr",
390
+ (&get_stdscr), 0);
391
+ rb_define_module_function(mNcurses, "curscr",
392
+ (&get_curscr), 0);
393
+ #ifdef HAVE_NEWSCR
394
+ rb_define_module_function(mNcurses, "newscr",
395
+ (&get_newscr), 0);
396
+ #endif
397
+ rb_define_module_function(mNcurses, "LINES",
398
+ (&get_LINES), 0);
399
+ rb_define_module_function(mNcurses, "COLS",
400
+ (&get_COLS), 0);
401
+ #ifdef HAVE_TABSIZE
402
+ rb_define_module_function(mNcurses, "TABSIZE",
403
+ (&get_TABSIZE),0);
404
+ #endif
405
+ #ifdef HAVE_ESCDELAY
406
+ rb_define_module_function(mNcurses, "ESCDELAY",
407
+ (&get_ESCDELAY),0);
408
+ rb_define_module_function(mNcurses, "ESCDELAY=",
409
+ (&set_ESCDELAY),1);
410
+ #endif
411
+ }
412
+ #ifdef HAVE_KEYBOUND
413
+ static VALUE rbncurs_keybound(VALUE dummy, VALUE keycode, VALUE count)
414
+ {
415
+ char * str = keybound(NUM2INT(keycode), NUM2INT(count));
416
+ VALUE rb_str = Qnil;
417
+ if (str) {
418
+ rb_str = rb_str_new2(str);
419
+ free(str);
420
+ }
421
+ return rb_str;
422
+ }
423
+ #endif
424
+ #ifdef HAVE_CURSES_VERSION
425
+ static VALUE rbncurs_curses_version(){return rb_str_new2(curses_version());}
426
+ #endif
427
+ #ifdef HAVE_DEFINE_KEY
428
+ static VALUE rbncurs_define_key(VALUE dummy, VALUE definition, VALUE keycode)
429
+ {
430
+ return INT2NUM(define_key((definition != Qnil)
431
+ ? STR2CSTR(definition)
432
+ : (char*)(NULL),
433
+ NUM2INT(keycode)));
434
+ }
435
+ #endif
436
+ #ifdef HAVE_KEYOK
437
+ static VALUE rbncurs_keyok(VALUE dummy, VALUE keycode, VALUE enable)
438
+ {
439
+ return INT2NUM(keyok(NUM2INT(keycode), RTEST(enable)));
440
+ }
441
+ #endif
442
+ #ifdef HAVE_RESIZETERM
443
+ static VALUE rbncurs_resizeterm(VALUE dummy, VALUE lines, VALUE columns)
444
+ {
445
+ return INT2NUM(resizeterm(NUM2INT(lines), NUM2INT(columns)));
446
+ }
447
+ #endif
448
+ #ifdef HAVE_USE_DEFAULT_COLORS
449
+ static VALUE rbncurs_use_default_colors()
450
+ {
451
+ return INT2NUM(use_default_colors());
452
+ }
453
+ #endif
454
+ #ifdef HAVE_USE_EXTENDED_NAMES
455
+ static VALUE rbncurs_use_extended_names(VALUE dummy, VALUE boolean)
456
+ {return INT2NUM(use_extended_names(RTEST(boolean)));}
457
+ #endif
458
+ #ifdef HAVE_WRESIZE
459
+ static VALUE rbncurs_wresize(VALUE dummy, VALUE win, VALUE lines, VALUE columns)
460
+ {
461
+ return INT2NUM(wresize(get_window(win), NUM2INT(lines), NUM2INT(columns)));
462
+ }
463
+ #endif
464
+ static
465
+ void
466
+ init_functions_1(void)
467
+ {
468
+ #ifdef HAVE_KEYBOUND
469
+ NCFUNC(keybound, 2);
470
+ #endif
471
+ #ifdef HAVE_CURSES_VERSION
472
+ NCFUNC(curses_version, 0);
473
+ #endif
474
+ #ifdef HAVE_DEFINE_KEY
475
+ NCFUNC(define_key, 2);
476
+ #endif
477
+ #ifdef HAVE_KEYOK
478
+ NCFUNC(keyok, 2);
479
+ #endif
480
+ #ifdef HAVE_RESIZETERM
481
+ NCFUNC(resizeterm, 2);
482
+ #endif
483
+ #ifdef HAVE_USE_DEFAULT_COLORS
484
+ NCFUNC(use_default_colors, 0);
485
+ #endif
486
+ #ifdef HAVE_USE_EXTENDED_NAMES
487
+ NCFUNC(use_extended_names, 1);
488
+ #endif
489
+ #ifdef HAVE_WRESIZE
490
+ NCFUNC(wresize, 3);
491
+ #endif
492
+ }
493
+ /* FIXME: what's this? */
494
+ /* extern char ttytype[]; */ /* needed for backward compatibility */
495
+
496
+
497
+ /* copy a chstr from ruby to c */
498
+ static chtype * RB2CHSTR(VALUE array)
499
+ {
500
+ if (rb_obj_is_instance_of(array, rb_cArray) != Qtrue) {
501
+ rb_raise(rb_eArgError,
502
+ "chtype string argument must be an empty Array");
503
+ return NULL;
504
+ }
505
+ {
506
+ size_t string_length =
507
+ NUM2ULONG(rb_funcall(array, rb_intern("size"), 0));
508
+ size_t vector_length =
509
+ string_length + 1; /* for terminating 0 */
510
+ chtype * chstr = ALLOC_N(chtype, vector_length);
511
+ unsigned long i;
512
+ for (i = 0; i < string_length; ++i) {
513
+ chstr[i] = NUM2ULONG(rb_ary_entry(array, i));
514
+ }
515
+ chstr[string_length] = 0;
516
+ return chstr;
517
+ }
518
+ }
519
+
520
+ static VALUE rbncurs_addch(VALUE dummy, VALUE arg1) {
521
+ return INT2NUM(addch(NUM2ULONG(arg1)));
522
+ }
523
+ static VALUE rbncurs_addchnstr(VALUE dummy, VALUE arg1, VALUE arg2) {
524
+ chtype * chstr = RB2CHSTR(arg1);
525
+ VALUE return_value = INT2NUM(addchnstr(chstr, NUM2INT(arg2)));
526
+ xfree(chstr);
527
+ return return_value;
528
+ }
529
+ static VALUE rbncurs_addchstr(VALUE dummy, VALUE arg1) {
530
+ chtype * chstr = RB2CHSTR(arg1);
531
+ VALUE return_value = INT2NUM(addchstr(chstr));
532
+ xfree(chstr);
533
+ return return_value;
534
+ }
535
+ static VALUE rbncurs_addnstr(VALUE dummy, VALUE arg1, VALUE arg2) {
536
+ return INT2NUM(addnstr(STR2CSTR(arg1), NUM2INT(arg2)));
537
+ }
538
+ static VALUE rbncurs_addstr(VALUE dummy, VALUE arg1) {
539
+ return INT2NUM(addstr(STR2CSTR(arg1)));
540
+ }
541
+ static VALUE rbncurs_attroff(VALUE dummy, VALUE arg1) {
542
+ return INT2NUM(attroff(NUM2ULONG(arg1)));
543
+ }
544
+ static VALUE rbncurs_attron(VALUE dummy, VALUE arg1) {
545
+ return INT2NUM(attron(NUM2ULONG(arg1)));
546
+ }
547
+ static VALUE rbncurs_attrset(VALUE dummy, VALUE arg1) {
548
+ return INT2NUM(attrset(NUM2ULONG(arg1)));
549
+ }
550
+ #if defined(NCURSES_VERSION_MAJOR) && NCURSES_VERSION_MAJOR > 4
551
+ #ifdef HAVE_ATTR_OFF
552
+ static VALUE rbncurs_attr_off(VALUE dummy, VALUE arg1, VALUE arg2) {
553
+ return INT2NUM(attr_off(NUM2ULONG(arg1), ((void)(arg2),NULL)));
554
+ }
555
+ #endif
556
+ #ifdef HAVE_ATTR_ON
557
+ static VALUE rbncurs_attr_on(VALUE dummy, VALUE arg1, VALUE arg2) {
558
+ return INT2NUM(attr_on(NUM2ULONG(arg1), ((void)(arg2),NULL)));
559
+ }
560
+ #endif
561
+ #ifdef HAVE_ATTR_SET
562
+ static VALUE rbncurs_attr_set(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
563
+ return INT2NUM(attr_set(NUM2ULONG(arg1), NUM2INT(arg2), ((void)(arg3),NULL)));
564
+ }
565
+ #endif
566
+ #if defined(HAVE_SLK_ATTR_OFF) || defined(slk_attr_off)
567
+ static VALUE rbncurs_slk_attr_off(VALUE dummy, VALUE arg1, VALUE arg2) {
568
+ return INT2NUM(slk_attr_off(NUM2ULONG(arg1), ((void)(arg2),NULL)));
569
+ }
570
+ #endif
571
+ #if defined(HAVE_SLK_ATTR_ON) || defined(slk_attr_on)
572
+ static VALUE rbncurs_slk_attr_on(VALUE dummy, VALUE arg1, VALUE arg2) {
573
+ return INT2NUM(slk_attr_on(NUM2ULONG(arg1), ((void)(arg2),NULL)));
574
+ }
575
+ #endif
576
+ #ifdef HAVE_SLK_ATTR_SET
577
+ static VALUE rbncurs_slk_attr_set(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
578
+ return INT2NUM(slk_attr_set(NUM2ULONG(arg1), NUM2INT(arg2), ((void)(arg3),NULL)));
579
+ }
580
+ #endif
581
+ #ifdef HAVE_WATTR_ON
582
+ static VALUE rbncurs_wattr_on(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
583
+ return INT2NUM(wattr_on(get_window(arg1), NUM2ULONG(arg2), ((void)(arg3),NULL)));
584
+ }
585
+ #endif
586
+ #ifdef HAVE_WATTR_OFF
587
+ static VALUE rbncurs_wattr_off(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
588
+ return INT2NUM(wattr_off(get_window(arg1), NUM2ULONG(arg2), ((void)(arg3),NULL)));
589
+ }
590
+ #endif
591
+ #ifdef HAVE_WATTR_SET
592
+ static VALUE rbncurs_wattr_set(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4) {
593
+ return INT2NUM(wattr_set(get_window(arg1), NUM2ULONG(arg2), NUM2INT(arg3), ((void)(arg4),NULL)));
594
+ }
595
+ #endif
596
+ #if defined(HAVE_VID_ATTR) || defined(vid_attr)
597
+ static VALUE rbncurs_vid_attr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
598
+ return INT2NUM(vid_attr(NUM2ULONG(arg1), NUM2INT(arg2), ((void)(arg3),NULL)));
599
+ }
600
+ #endif
601
+ #ifdef HAVE_ATTR_GET
602
+ static VALUE rbncurs_attr_get(VALUE dummy, VALUE rb_attrs, VALUE rb_pair,
603
+ VALUE dummy2)
604
+ {
605
+ if ((rb_obj_is_instance_of(rb_attrs, rb_cArray) != Qtrue)
606
+ || (rb_obj_is_instance_of(rb_pair, rb_cArray) != Qtrue)) {
607
+ rb_raise(rb_eArgError,
608
+ "attrs and pair arguments must be empty Arrays");
609
+ return Qnil;
610
+ }
611
+ {
612
+ attr_t attrs = 0;
613
+ short pair = 0;
614
+ int return_value = attr_get(&attrs, &pair, 0);
615
+ rb_ary_push(rb_attrs, INT2NUM(attrs));
616
+ rb_ary_push(rb_pair, INT2NUM(pair));
617
+ return INT2NUM(return_value);
618
+ }
619
+ }
620
+ static VALUE rbncurs_wattr_get(VALUE dummy,VALUE win, VALUE rb_attrs, VALUE rb_pair,
621
+ VALUE dummy2)
622
+ {
623
+ if ((rb_obj_is_instance_of(rb_attrs, rb_cArray) != Qtrue)
624
+ || (rb_obj_is_instance_of(rb_pair, rb_cArray) != Qtrue)) {
625
+ rb_raise(rb_eArgError,
626
+ "attrs and pair arguments must be empty Arrays");
627
+ return Qnil;
628
+ }
629
+ {
630
+ attr_t attrs = 0;
631
+ short pair = 0;
632
+ int return_value = wattr_get(get_window(win), &attrs, &pair, 0);
633
+ rb_ary_push(rb_attrs, INT2NUM(attrs));
634
+ rb_ary_push(rb_pair, INT2NUM(pair));
635
+ return INT2NUM(return_value);
636
+ }
637
+ }
638
+ #endif /* HAVE_ATTR_GET */
639
+ #endif
640
+
641
+ static VALUE rbncurs_baudrate(VALUE dummy) {
642
+ return INT2NUM(baudrate());
643
+ }
644
+ static VALUE rbncurs_beep(VALUE dummy) {
645
+ return INT2NUM(beep());
646
+ }
647
+ static VALUE rbncurs_bkgd(VALUE dummy, VALUE arg1) {
648
+ return INT2NUM(bkgd(NUM2ULONG(arg1)));
649
+ }
650
+ static VALUE rbncurs_bkgdset(VALUE dummy, VALUE arg1) {
651
+ return ((bkgdset(NUM2ULONG(arg1))),Qnil);
652
+ }
653
+ static VALUE rbncurs_border(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4, VALUE arg5, VALUE arg6, VALUE arg7, VALUE arg8) {
654
+ return INT2NUM(border(NUM2ULONG(arg1), NUM2ULONG(arg2), NUM2ULONG(arg3), NUM2ULONG(arg4), NUM2ULONG(arg5), NUM2ULONG(arg6), NUM2ULONG(arg7), NUM2ULONG(arg8)));
655
+ }
656
+ static VALUE rbncurs_box(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
657
+ return INT2NUM(box(get_window(arg1), NUM2ULONG(arg2), NUM2ULONG(arg3)));
658
+ }
659
+ static VALUE rbncurs_can_change_color(VALUE dummy) {
660
+ return (can_change_color()) ? Qtrue : Qfalse;
661
+ }
662
+ static VALUE rbncurs_cbreak(VALUE dummy) {
663
+ return INT2NUM(cbreak());
664
+ }
665
+ #ifdef HAVE_CHGAT
666
+ static VALUE rbncurs_chgat(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4) {
667
+ return INT2NUM(chgat(NUM2INT(arg1), NUM2ULONG(arg2), NUM2INT(arg3),
668
+ ((void)(arg4),NULL)));
669
+ }
670
+ #endif
671
+ static VALUE rbncurs_clear(VALUE dummy) {
672
+ return INT2NUM(clear());
673
+ }
674
+ static VALUE rbncurs_clearok(VALUE dummy, VALUE arg1, VALUE arg2) {
675
+ return INT2NUM(clearok(get_window(arg1), RTEST(arg2)));
676
+ }
677
+ static VALUE rbncurs_clrtobot(VALUE dummy) {
678
+ return INT2NUM(clrtobot());
679
+ }
680
+ static VALUE rbncurs_clrtoeol(VALUE dummy) {
681
+ return INT2NUM(clrtoeol());
682
+ }
683
+ #ifdef HAVE_COLOR_SET
684
+ static VALUE rbncurs_color_set(VALUE dummy, VALUE arg1, VALUE arg2) {
685
+ return INT2NUM(color_set(NUM2INT(arg1), ((void)(arg2),NULL)));
686
+ }
687
+ #endif
688
+ static VALUE rbncurs_COLOR_PAIR(VALUE dummy, VALUE arg1) {
689
+ return INT2NUM(COLOR_PAIR(NUM2INT(arg1)));
690
+ }
691
+ static VALUE rbncurs_copywin(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4, VALUE arg5, VALUE arg6, VALUE arg7, VALUE arg8, VALUE arg9) {
692
+ return INT2NUM(copywin(get_window(arg1), get_window(arg2), NUM2INT(arg3), NUM2INT(arg4), NUM2INT(arg5), NUM2INT(arg6), NUM2INT(arg7), NUM2INT(arg8), NUM2INT(arg9)));
693
+ }
694
+ static VALUE rbncurs_curs_set(VALUE dummy, VALUE arg1) {
695
+ return INT2NUM(curs_set(NUM2INT(arg1)));
696
+ }
697
+ static VALUE rbncurs_def_prog_mode(VALUE dummy) {
698
+ return INT2NUM(def_prog_mode());
699
+ }
700
+ static VALUE rbncurs_def_shell_mode(VALUE dummy) {
701
+ return INT2NUM(def_shell_mode());
702
+ }
703
+ static VALUE rbncurs_delay_output(VALUE dummy, VALUE arg1) {
704
+ return INT2NUM(delay_output(NUM2INT(arg1)));
705
+ }
706
+ static VALUE rbncurs_delch(VALUE dummy) {
707
+ return INT2NUM(delch());
708
+ }
709
+ static VALUE rbncurs_deleteln(VALUE dummy) {
710
+ return INT2NUM(deleteln());
711
+ }
712
+ static VALUE rbncurs_derwin(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4, VALUE arg5) {
713
+ return wrap_window(derwin(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), NUM2INT(arg4), NUM2INT(arg5)));
714
+ }
715
+ static VALUE rbncurs_doupdate(VALUE dummy) {
716
+ return INT2NUM(doupdate());
717
+ }
718
+ static VALUE rbncurs_dupwin(VALUE dummy, VALUE arg1) {
719
+ return wrap_window(dupwin(get_window(arg1)));
720
+ }
721
+ static VALUE rbncurs_echo(VALUE dummy) {
722
+ return INT2NUM(echo());
723
+ }
724
+ static VALUE rbncurs_echochar(VALUE dummy, VALUE arg1) {
725
+ return INT2NUM(echochar(NUM2ULONG(arg1)));
726
+ }
727
+ static VALUE rbncurs_endwin(VALUE dummy) {
728
+ return INT2NUM(endwin());
729
+ }
730
+ static VALUE rbncurs_erasechar(VALUE dummy) {
731
+ return INT2NUM(erasechar());
732
+ }
733
+ #ifdef HAVE_FILTER
734
+ static VALUE rbncurs_filter(VALUE dummy) {
735
+ return ((filter()),Qnil);
736
+ }
737
+ #endif
738
+ static VALUE rbncurs_flash(VALUE dummy) {
739
+ return INT2NUM(flash());
740
+ }
741
+ static VALUE rbncurs_flushinp(VALUE dummy) {
742
+ return INT2NUM(flushinp());
743
+ }
744
+ static VALUE rbncurs_getbkgd(VALUE dummy, VALUE arg1) {
745
+ return INT2NUM(getbkgd(get_window(arg1)));
746
+ }
747
+ static VALUE rbncurs_getch(VALUE dummy) {
748
+ return INT2NUM(getch());
749
+ }
750
+ static VALUE rbncurs_halfdelay(VALUE dummy, VALUE arg1) {
751
+ return INT2NUM(halfdelay(NUM2INT(arg1)));
752
+ }
753
+ static VALUE rbncurs_has_colors(VALUE dummy) {
754
+ return (has_colors()) ? Qtrue : Qfalse;
755
+ }
756
+ static VALUE rbncurs_has_ic(VALUE dummy) {
757
+ return (has_ic()) ? Qtrue : Qfalse;
758
+ }
759
+ static VALUE rbncurs_has_il(VALUE dummy) {
760
+ return (has_il()) ? Qtrue : Qfalse;
761
+ }
762
+ static VALUE rbncurs_hline(VALUE dummy, VALUE arg1, VALUE arg2) {
763
+ return INT2NUM(hline(NUM2ULONG(arg1), NUM2INT(arg2)));
764
+ }
765
+ static VALUE rbncurs_idcok(VALUE dummy, VALUE arg1, VALUE arg2) {
766
+ return ((idcok(get_window(arg1), RTEST(arg2))),Qnil);
767
+ }
768
+ static VALUE rbncurs_idlok(VALUE dummy, VALUE arg1, VALUE arg2) {
769
+ return INT2NUM(idlok(get_window(arg1), RTEST(arg2)));
770
+ }
771
+ static VALUE rbncurs_immedok(VALUE dummy, VALUE arg1, VALUE arg2) {
772
+ return ((immedok(get_window(arg1), RTEST(arg2))),Qnil);
773
+ }
774
+ static VALUE rbncurs_inch(VALUE dummy) {
775
+ return INT2NUM(inch());
776
+ }
777
+ static VALUE rbncurs_initscr(VALUE dummy) {
778
+ VALUE v = wrap_window(initscr());
779
+ if (!RTEST(v))
780
+ return v;
781
+
782
+ Init_ncurses_full();
783
+
784
+ /* Some constants defined by the initscr call. */
785
+
786
+ /* line graphics */
787
+
788
+ /* VT100 symbols begin here */
789
+
790
+ rb_define_const(mNcurses, "ACS_ULCORNER", INT2NUM(ACS_ULCORNER));
791
+ rb_define_const(mNcurses, "ACS_LLCORNER", INT2NUM(ACS_LLCORNER));
792
+ rb_define_const(mNcurses, "ACS_URCORNER", INT2NUM(ACS_URCORNER));
793
+ rb_define_const(mNcurses, "ACS_LRCORNER", INT2NUM(ACS_LRCORNER));
794
+ rb_define_const(mNcurses, "ACS_LTEE", INT2NUM(ACS_LTEE));
795
+ rb_define_const(mNcurses, "ACS_RTEE", INT2NUM(ACS_RTEE));
796
+ rb_define_const(mNcurses, "ACS_BTEE", INT2NUM(ACS_BTEE));
797
+ rb_define_const(mNcurses, "ACS_TTEE", INT2NUM(ACS_TTEE));
798
+ rb_define_const(mNcurses, "ACS_HLINE", INT2NUM(ACS_HLINE));
799
+ rb_define_const(mNcurses, "ACS_VLINE", INT2NUM(ACS_VLINE));
800
+ rb_define_const(mNcurses, "ACS_PLUS", INT2NUM(ACS_PLUS));
801
+ rb_define_const(mNcurses, "ACS_S1", INT2NUM(ACS_S1));
802
+ rb_define_const(mNcurses, "ACS_S9", INT2NUM(ACS_S9));
803
+ rb_define_const(mNcurses, "ACS_DIAMOND", INT2NUM(ACS_DIAMOND));
804
+ rb_define_const(mNcurses, "ACS_CKBOARD", INT2NUM(ACS_CKBOARD));
805
+ rb_define_const(mNcurses, "ACS_DEGREE", INT2NUM(ACS_DEGREE));
806
+ rb_define_const(mNcurses, "ACS_PLMINUS", INT2NUM(ACS_PLMINUS));
807
+ rb_define_const(mNcurses, "ACS_BULLET", INT2NUM(ACS_BULLET));
808
+ /* Teletype 5410v1 symbols begin here */
809
+ rb_define_const(mNcurses, "ACS_LARROW", INT2NUM(ACS_LARROW));
810
+ rb_define_const(mNcurses, "ACS_RARROW", INT2NUM(ACS_RARROW));
811
+ rb_define_const(mNcurses, "ACS_DARROW", INT2NUM(ACS_DARROW));
812
+ rb_define_const(mNcurses, "ACS_UARROW", INT2NUM(ACS_UARROW));
813
+ rb_define_const(mNcurses, "ACS_BOARD", INT2NUM(ACS_BOARD));
814
+ rb_define_const(mNcurses, "ACS_LANTERN", INT2NUM(ACS_LANTERN));
815
+ rb_define_const(mNcurses, "ACS_BLOCK", INT2NUM(ACS_BLOCK));
816
+ /*
817
+ * These aren't documented, but a lot of System Vs have them anyway
818
+ * (you can spot pprryyzz{{||}} in a lot of AT&T terminfo strings).
819
+ * The ACS_names may not match AT&T's, our source didn't know them.
820
+ */
821
+ #ifdef ACS_S3
822
+ rb_define_const(mNcurses, "ACS_S3", INT2NUM(ACS_S3));
823
+ #endif
824
+ #ifdef ACS_S7
825
+ rb_define_const(mNcurses, "ACS_S7", INT2NUM(ACS_S7));
826
+ #endif
827
+ #ifdef ACS_LEQUAL
828
+ rb_define_const(mNcurses, "ACS_LEQUAL", INT2NUM(ACS_LEQUAL));
829
+ #endif
830
+ #ifdef ACS_LEQUAL
831
+ rb_define_const(mNcurses, "ACS_GEQUAL", INT2NUM(ACS_GEQUAL));
832
+ #endif
833
+ #ifdef ACS_PI
834
+ rb_define_const(mNcurses, "ACS_PI", INT2NUM(ACS_PI));
835
+ #endif
836
+ #ifdef ACS_NEQUAL
837
+ rb_define_const(mNcurses, "ACS_NEQUAL", INT2NUM(ACS_NEQUAL));
838
+ #endif
839
+ #ifdef ACS_STERLING
840
+ rb_define_const(mNcurses, "ACS_STERLING", INT2NUM(ACS_STERLING));
841
+ #endif
842
+ /*
843
+ * Line drawing ACS names are of the form ACS_trbl, where t is the top, r
844
+ * is the right, b is the bottom, and l is the left. t, r, b, and l might
845
+ * be B (blank), S (single), D (double), or T (thick). The subset defined
846
+ * here only uses B and S.
847
+ */
848
+ #ifdef ACS_BSSB
849
+ rb_define_const(mNcurses, "ACS_BSSB", INT2NUM(ACS_BSSB));
850
+ #endif
851
+ #ifdef ACS_SSBB
852
+ rb_define_const(mNcurses, "ACS_SSBB", INT2NUM(ACS_SSBB));
853
+ #endif
854
+ #ifdef ACS_BBSS
855
+ rb_define_const(mNcurses, "ACS_BBSS", INT2NUM(ACS_BBSS));
856
+ #endif
857
+ #ifdef ACS_SBBS
858
+ rb_define_const(mNcurses, "ACS_SBBS", INT2NUM(ACS_SBBS));
859
+ #endif
860
+ #ifdef ACS_SBSS
861
+ rb_define_const(mNcurses, "ACS_SBSS", INT2NUM(ACS_SBSS));
862
+ #endif
863
+ #ifdef ACS_SSSB
864
+ rb_define_const(mNcurses, "ACS_SSSB", INT2NUM(ACS_SSSB));
865
+ #endif
866
+ #ifdef ACS_SSBS
867
+ rb_define_const(mNcurses, "ACS_SSBS", INT2NUM(ACS_SSBS));
868
+ #endif
869
+ #ifdef ACS_BSSS
870
+ rb_define_const(mNcurses, "ACS_BSSS", INT2NUM(ACS_BSSS));
871
+ #endif
872
+ #ifdef ACS_BSBS
873
+ rb_define_const(mNcurses, "ACS_BSBS", INT2NUM(ACS_BSBS));
874
+ #endif
875
+ #ifdef ACS_SBSB
876
+ rb_define_const(mNcurses, "ACS_SBSB", INT2NUM(ACS_SBSB));
877
+ #endif
878
+ #ifdef ACS_SSSS
879
+ rb_define_const(mNcurses, "ACS_SSSS", INT2NUM(ACS_SSSS));
880
+ #endif
881
+ return v;
882
+ }
883
+ static VALUE rbncurs_init_color(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4) {
884
+ return INT2NUM(init_color(NUM2INT(arg1), NUM2INT(arg2), NUM2INT(arg3), NUM2INT(arg4)));
885
+ }
886
+ static VALUE rbncurs_init_pair(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
887
+ return INT2NUM(init_pair(NUM2INT(arg1), NUM2INT(arg2), NUM2INT(arg3)));
888
+ }
889
+ static VALUE rbncurs_insch(VALUE dummy, VALUE arg1) {
890
+ return INT2NUM(insch(NUM2ULONG(arg1)));
891
+ }
892
+ static VALUE rbncurs_insdelln(VALUE dummy, VALUE arg1) {
893
+ return INT2NUM(insdelln(NUM2INT(arg1)));
894
+ }
895
+ static VALUE rbncurs_insertln(VALUE dummy) {
896
+ return INT2NUM(insertln());
897
+ }
898
+ static VALUE rbncurs_insnstr(VALUE dummy, VALUE arg1, VALUE arg2) {
899
+ return INT2NUM(insnstr(STR2CSTR(arg1), NUM2INT(arg2)));
900
+ }
901
+ static VALUE rbncurs_insstr(VALUE dummy, VALUE arg1) {
902
+ return INT2NUM(insstr(STR2CSTR(arg1)));
903
+ }
904
+ #ifdef HAVE_INTRFLUSH
905
+ static VALUE rbncurs_intrflush(VALUE dummy, VALUE arg1, VALUE arg2) {
906
+ return INT2NUM(intrflush(get_window(arg1), RTEST(arg2)));
907
+ }
908
+ #endif
909
+ static VALUE rbncurs_isendwin(VALUE dummy) {
910
+ return (isendwin()) ? Qtrue : Qfalse;
911
+ }
912
+ static VALUE rbncurs_is_linetouched(VALUE dummy, VALUE arg1, VALUE arg2) {
913
+ return (is_linetouched(get_window(arg1), NUM2INT(arg2))) ? Qtrue : Qfalse;
914
+ }
915
+ static VALUE rbncurs_is_wintouched(VALUE dummy, VALUE arg1) {
916
+ return (is_wintouched(get_window(arg1))) ? Qtrue : Qfalse;
917
+ }
918
+ static VALUE rbncurs_keyname(VALUE dummy, VALUE arg1) {
919
+ return rb_str_new2(keyname(NUM2INT(arg1)));
920
+ }
921
+ static VALUE rbncurs_keypad(VALUE dummy, VALUE arg1, VALUE arg2) {
922
+ return INT2NUM(keypad(get_window(arg1), RTEST(arg2)));
923
+ }
924
+ static VALUE rbncurs_killchar(VALUE dummy) {
925
+ return INT2NUM(killchar());
926
+ }
927
+ static VALUE rbncurs_leaveok(VALUE dummy, VALUE arg1, VALUE arg2) {
928
+ return INT2NUM(leaveok(get_window(arg1), RTEST(arg2)));
929
+ }
930
+ static VALUE rbncurs_longname(VALUE dummy) {
931
+ return rb_str_new2(longname());
932
+ }
933
+ static VALUE rbncurs_meta(VALUE dummy, VALUE arg1, VALUE arg2) {
934
+ return INT2NUM(meta(get_window(arg1), RTEST(arg2)));
935
+ }
936
+ static VALUE rbncurs_move(VALUE dummy, VALUE arg1, VALUE arg2) {
937
+ return INT2NUM(move(NUM2INT(arg1), NUM2INT(arg2)));
938
+ }
939
+ static VALUE rbncurs_mvaddch(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
940
+ return INT2NUM(mvaddch(NUM2INT(arg1), NUM2INT(arg2), NUM2ULONG(arg3)));
941
+ }
942
+ static VALUE rbncurs_mvaddchnstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3,
943
+ VALUE arg4) {
944
+ chtype * chstr = RB2CHSTR(arg3);
945
+ VALUE return_value = INT2NUM(mvaddchnstr(NUM2INT(arg1), NUM2INT(arg2),
946
+ chstr, NUM2INT(arg4)));
947
+ xfree(chstr);
948
+ return return_value;
949
+ }
950
+ static VALUE rbncurs_mvaddchstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
951
+ chtype * chstr = RB2CHSTR(arg3);
952
+ VALUE return_value = INT2NUM(mvaddchstr(NUM2INT(arg1), NUM2INT(arg2),
953
+ chstr));
954
+ xfree(chstr);
955
+ return return_value;
956
+ }
957
+ static VALUE rbncurs_mvaddnstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4) {
958
+ return INT2NUM(mvaddnstr(NUM2INT(arg1), NUM2INT(arg2), STR2CSTR(arg3), NUM2INT(arg4)));
959
+ }
960
+ static VALUE rbncurs_mvaddstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
961
+ return INT2NUM(mvaddstr(NUM2INT(arg1), NUM2INT(arg2), STR2CSTR(arg3)));
962
+ }
963
+ #ifdef HAVE_MVCHGAT
964
+ static VALUE rbncurs_mvchgat(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4, VALUE arg5, VALUE arg6) {
965
+ return INT2NUM(mvchgat(NUM2INT(arg1), NUM2INT(arg2), NUM2INT(arg3), NUM2ULONG(arg4), NUM2INT(arg5), ((void)(arg6),NULL)));
966
+ }
967
+ #endif
968
+ static VALUE rbncurs_mvcur(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4) {
969
+ return INT2NUM(mvcur(NUM2INT(arg1), NUM2INT(arg2), NUM2INT(arg3), NUM2INT(arg4)));
970
+ }
971
+ static VALUE rbncurs_mvdelch(VALUE dummy, VALUE arg1, VALUE arg2) {
972
+ return INT2NUM(mvdelch(NUM2INT(arg1), NUM2INT(arg2)));
973
+ }
974
+ static VALUE rbncurs_mvderwin(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
975
+ return INT2NUM(mvderwin(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3)));
976
+ }
977
+ static VALUE rbncurs_mvgetch(VALUE dummy, VALUE arg1, VALUE arg2) {
978
+ return INT2NUM(mvgetch(NUM2INT(arg1), NUM2INT(arg2)));
979
+ }
980
+ #ifdef HAVE_MVHLINE
981
+ static VALUE rbncurs_mvhline(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4) {
982
+ return INT2NUM(mvhline(NUM2INT(arg1), NUM2INT(arg2), NUM2ULONG(arg3), NUM2INT(arg4)));
983
+ }
984
+ #endif
985
+ static VALUE rbncurs_mvinch(VALUE dummy, VALUE arg1, VALUE arg2) {
986
+ return INT2NUM(mvinch(NUM2INT(arg1), NUM2INT(arg2)));
987
+ }
988
+ static VALUE rbncurs_mvinsch(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
989
+ return INT2NUM(mvinsch(NUM2INT(arg1), NUM2INT(arg2), NUM2ULONG(arg3)));
990
+ }
991
+ static VALUE rbncurs_mvinsnstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4) {
992
+ return INT2NUM(mvinsnstr(NUM2INT(arg1), NUM2INT(arg2), STR2CSTR(arg3), NUM2INT(arg4)));
993
+ }
994
+ static VALUE rbncurs_mvinsstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
995
+ return INT2NUM(mvinsstr(NUM2INT(arg1), NUM2INT(arg2), STR2CSTR(arg3)));
996
+ }
997
+ #ifdef HAVE_MVVLINE
998
+ static VALUE rbncurs_mvvline(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4) {
999
+ return INT2NUM(mvvline(NUM2INT(arg1), NUM2INT(arg2), NUM2ULONG(arg3), NUM2INT(arg4)));
1000
+ }
1001
+ #endif
1002
+ static VALUE rbncurs_mvwaddch(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4) {
1003
+ return INT2NUM(mvwaddch(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), NUM2ULONG(arg4)));
1004
+ }
1005
+ static VALUE rbncurs_mvwaddchnstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3,
1006
+ VALUE arg4, VALUE arg5) {
1007
+ chtype * chstr = RB2CHSTR(arg4);
1008
+ VALUE return_value = INT2NUM(mvwaddchnstr(get_window(arg1), NUM2INT(arg2),
1009
+ NUM2INT(arg3), chstr,
1010
+ NUM2INT(arg5)));
1011
+ xfree(chstr);
1012
+ return return_value;
1013
+ }
1014
+ static VALUE rbncurs_mvwaddchstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3,
1015
+ VALUE arg4) {
1016
+ chtype * chstr = RB2CHSTR(arg4);
1017
+ VALUE return_value = INT2NUM(mvwaddchstr(get_window(arg1), NUM2INT(arg2),
1018
+ NUM2INT(arg3), chstr));
1019
+ xfree(chstr);
1020
+ return return_value;
1021
+ }
1022
+ static VALUE rbncurs_mvwaddnstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4, VALUE arg5) {
1023
+ return INT2NUM(mvwaddnstr(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), STR2CSTR(arg4), NUM2INT(arg5)));
1024
+ }
1025
+ static VALUE rbncurs_mvwaddstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4) {
1026
+ return INT2NUM(mvwaddstr(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), STR2CSTR(arg4)));
1027
+ }
1028
+ #ifdef HAVE_MVWCHGAT
1029
+ static VALUE rbncurs_mvwchgat(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4, VALUE arg5, VALUE arg6, VALUE arg7) {
1030
+ return INT2NUM(mvwchgat(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), NUM2INT(arg4), NUM2ULONG(arg5), NUM2INT(arg6), ((void)(arg7),NULL)));
1031
+ }
1032
+ #endif
1033
+ static VALUE rbncurs_mvwdelch(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
1034
+ return INT2NUM(mvwdelch(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3)));
1035
+ }
1036
+ static VALUE rbncurs_mvwgetch(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
1037
+ return INT2NUM(mvwgetch(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3)));
1038
+ }
1039
+ #ifdef HAVE_MVWHLINE
1040
+ static VALUE rbncurs_mvwhline(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4, VALUE arg5) {
1041
+ return INT2NUM(mvwhline(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), NUM2ULONG(arg4), NUM2INT(arg5)));
1042
+ }
1043
+ #endif
1044
+ static VALUE rbncurs_mvwin(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
1045
+ return INT2NUM(mvwin(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3)));
1046
+ }
1047
+ static VALUE rbncurs_mvwinch(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
1048
+ return INT2NUM(mvwinch(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3)));
1049
+ }
1050
+ static VALUE rbncurs_mvwinsch(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4) {
1051
+ return INT2NUM(mvwinsch(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), NUM2ULONG(arg4)));
1052
+ }
1053
+ static VALUE rbncurs_mvwinsnstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4, VALUE arg5) {
1054
+ return INT2NUM(mvwinsnstr(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), STR2CSTR(arg4), NUM2INT(arg5)));
1055
+ }
1056
+ static VALUE rbncurs_mvwinsstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4) {
1057
+ return INT2NUM(mvwinsstr(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), STR2CSTR(arg4)));
1058
+ }
1059
+ #ifdef HAVE_MVWVLINE
1060
+ static VALUE rbncurs_mvwvline(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4, VALUE arg5) {
1061
+ return INT2NUM(mvwvline(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), NUM2ULONG(arg4), NUM2INT(arg5)));
1062
+ }
1063
+ #endif
1064
+ static VALUE rbncurs_napms(VALUE dummy, VALUE arg1) {
1065
+ return INT2NUM(napms(NUM2INT(arg1)));
1066
+ }
1067
+ static VALUE rbncurs_newpad(VALUE dummy, VALUE arg1, VALUE arg2) {
1068
+ return wrap_window(newpad(NUM2INT(arg1), NUM2INT(arg2)));
1069
+ }
1070
+ static VALUE rbncurs_newwin(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4) {
1071
+ return wrap_window(newwin(NUM2INT(arg1), NUM2INT(arg2), NUM2INT(arg3), NUM2INT(arg4)));
1072
+ }
1073
+ static VALUE rbncurs_nl(VALUE dummy) {
1074
+ return INT2NUM(nl());
1075
+ }
1076
+ static VALUE rbncurs_nocbreak(VALUE dummy) {
1077
+ return INT2NUM(nocbreak());
1078
+ }
1079
+ static VALUE rbncurs_nodelay(VALUE dummy, VALUE arg1, VALUE arg2) {
1080
+ return INT2NUM(nodelay(get_window(arg1), RTEST(arg2)));
1081
+ }
1082
+ static VALUE rbncurs_noecho(VALUE dummy) {
1083
+ return INT2NUM(noecho());
1084
+ }
1085
+ static VALUE rbncurs_nonl(VALUE dummy) {
1086
+ return INT2NUM(nonl());
1087
+ }
1088
+ #ifdef HAVE_NOQIFLUSH
1089
+ static VALUE rbncurs_noqiflush(VALUE dummy) {
1090
+ return ((noqiflush()),Qnil);
1091
+ }
1092
+ #endif
1093
+ static VALUE rbncurs_noraw(VALUE dummy) {
1094
+ return INT2NUM(noraw());
1095
+ }
1096
+ static VALUE rbncurs_notimeout(VALUE dummy, VALUE arg1, VALUE arg2) {
1097
+ return INT2NUM(notimeout(get_window(arg1), RTEST(arg2)));
1098
+ }
1099
+ static VALUE rbncurs_overlay(VALUE dummy, VALUE arg1, VALUE arg2) {
1100
+ return INT2NUM(overlay(get_window(arg1), get_window(arg2)));
1101
+ }
1102
+ static VALUE rbncurs_overwrite(VALUE dummy, VALUE arg1, VALUE arg2) {
1103
+ return INT2NUM(overwrite(get_window(arg1), get_window(arg2)));
1104
+ }
1105
+ static VALUE rbncurs_PAIR_NUMBER(VALUE dummy, VALUE arg1) {
1106
+ return INT2NUM(PAIR_NUMBER(NUM2INT(arg1)));
1107
+ }
1108
+ #ifndef __PDCURSES__ /* pdcurses "pechochar" macro won't compile*/
1109
+ static VALUE rbncurs_pechochar(VALUE dummy, VALUE arg1, VALUE arg2) {
1110
+ return INT2NUM(pechochar(get_window(arg1), NUM2ULONG(arg2)));
1111
+ }
1112
+ #endif
1113
+ static VALUE rbncurs_pnoutrefresh(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4, VALUE arg5, VALUE arg6, VALUE arg7) {
1114
+ return INT2NUM(pnoutrefresh(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), NUM2INT(arg4), NUM2INT(arg5), NUM2INT(arg6), NUM2INT(arg7)));
1115
+ }
1116
+ static VALUE rbncurs_prefresh(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4, VALUE arg5, VALUE arg6, VALUE arg7) {
1117
+ return INT2NUM(prefresh(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), NUM2INT(arg4), NUM2INT(arg5), NUM2INT(arg6), NUM2INT(arg7)));
1118
+ }
1119
+ #ifdef HAVE_PUTP
1120
+ static VALUE rbncurs_putp(VALUE dummy, VALUE arg1) {
1121
+ return INT2NUM(putp(STR2CSTR(arg1)));
1122
+ }
1123
+ #endif
1124
+ #ifdef HAVE_QIFLUSH
1125
+ static VALUE rbncurs_qiflush(VALUE dummy) {
1126
+ return ((qiflush()),Qnil);
1127
+ }
1128
+ #endif
1129
+ static VALUE rbncurs_raw(VALUE dummy) {
1130
+ return INT2NUM(raw());
1131
+ }
1132
+ #ifndef __PDCURSES__ /* __PDCURSES__ redrawwin macro is buggy */
1133
+ static VALUE rbncurs_redrawwin(VALUE dummy, VALUE arg1) {
1134
+ return INT2NUM(redrawwin(get_window(arg1)));
1135
+ }
1136
+ #endif
1137
+ static VALUE rbncurs_refresh(VALUE dummy) {
1138
+ return INT2NUM(refresh());
1139
+ }
1140
+ static VALUE rbncurs_resetty(VALUE dummy) {
1141
+ return INT2NUM(resetty());
1142
+ }
1143
+ static VALUE rbncurs_reset_prog_mode(VALUE dummy) {
1144
+ return INT2NUM(reset_prog_mode());
1145
+ }
1146
+ static VALUE rbncurs_reset_shell_mode(VALUE dummy) {
1147
+ return INT2NUM(reset_shell_mode());
1148
+ }
1149
+ static VALUE rbncurs_savetty(VALUE dummy) {
1150
+ return INT2NUM(savetty());
1151
+ }
1152
+ #ifdef HAVE_SCR_DUMP
1153
+ static VALUE rbncurs_scr_dump(VALUE dummy, VALUE arg1) {
1154
+ return INT2NUM(scr_dump(STR2CSTR(arg1)));
1155
+ }
1156
+ #endif
1157
+ #ifdef HAVE_SCR_INIT
1158
+ static VALUE rbncurs_scr_init(VALUE dummy, VALUE arg1) {
1159
+ return INT2NUM(scr_init(STR2CSTR(arg1)));
1160
+ }
1161
+ #endif
1162
+ static VALUE rbncurs_scrl(VALUE dummy, VALUE arg1) {
1163
+ return INT2NUM(scrl(NUM2INT(arg1)));
1164
+ }
1165
+ static VALUE rbncurs_scroll(VALUE dummy, VALUE arg1) {
1166
+ return INT2NUM(scroll(get_window(arg1)));
1167
+ }
1168
+ static VALUE rbncurs_scrollok(VALUE dummy, VALUE arg1, VALUE arg2) {
1169
+ return INT2NUM(scrollok(get_window(arg1), RTEST(arg2)));
1170
+ }
1171
+ #ifdef HAVE_SCR_RESTORE
1172
+ static VALUE rbncurs_scr_restore(VALUE dummy, VALUE arg1) {
1173
+ return INT2NUM(scr_restore(STR2CSTR(arg1)));
1174
+ }
1175
+ #endif
1176
+ #ifdef HAVE_SCR_SET
1177
+ static VALUE rbncurs_scr_set(VALUE dummy, VALUE arg1) {
1178
+ return INT2NUM(scr_set(STR2CSTR(arg1)));
1179
+ }
1180
+ #endif
1181
+ static VALUE rbncurs_setscrreg(VALUE dummy, VALUE arg1, VALUE arg2) {
1182
+ return INT2NUM(setscrreg(NUM2INT(arg1), NUM2INT(arg2)));
1183
+ }
1184
+ static VALUE rbncurs_set_term(VALUE dummy, VALUE arg1) {
1185
+ return wrap_screen(set_term(get_screen(arg1)));
1186
+ }
1187
+ static VALUE rbncurs_slk_attroff(VALUE dummy, VALUE arg1) {
1188
+ return INT2NUM(slk_attroff(NUM2ULONG(arg1)));
1189
+ }
1190
+ static VALUE rbncurs_slk_attron(VALUE dummy, VALUE arg1) {
1191
+ return INT2NUM(slk_attron(NUM2ULONG(arg1)));
1192
+ }
1193
+ static VALUE rbncurs_slk_attrset(VALUE dummy, VALUE arg1) {
1194
+ return INT2NUM(slk_attrset(NUM2ULONG(arg1)));
1195
+ }
1196
+ #ifdef HAVE_SLK_ATTR
1197
+ static VALUE rbncurs_slk_attr(VALUE dummy) {
1198
+ return INT2NUM(slk_attr());
1199
+ }
1200
+ #endif
1201
+
1202
+ static VALUE rbncurs_slk_clear(VALUE dummy) {
1203
+ return INT2NUM(slk_clear());
1204
+ }
1205
+ #ifdef HAVE_SLK_COLOR
1206
+ static VALUE rbncurs_slk_color(VALUE dummy, VALUE arg1) {
1207
+ return INT2NUM(slk_color(NUM2INT(arg1)));
1208
+ }
1209
+ #endif
1210
+ static VALUE rbncurs_slk_init(VALUE dummy, VALUE arg1) {
1211
+ return INT2NUM(slk_init(NUM2INT(arg1)));
1212
+ }
1213
+ static VALUE rbncurs_slk_label(VALUE dummy, VALUE arg1) {
1214
+ return rb_str_new2(slk_label(NUM2INT(arg1)));
1215
+ }
1216
+ static VALUE rbncurs_slk_noutrefresh(VALUE dummy) {
1217
+ return INT2NUM(slk_noutrefresh());
1218
+ }
1219
+ static VALUE rbncurs_slk_refresh(VALUE dummy) {
1220
+ return INT2NUM(slk_refresh());
1221
+ }
1222
+ static VALUE rbncurs_slk_restore(VALUE dummy) {
1223
+ return INT2NUM(slk_restore());
1224
+ }
1225
+ static VALUE rbncurs_slk_set(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
1226
+ return INT2NUM(slk_set(NUM2INT(arg1), STR2CSTR(arg2), NUM2INT(arg3)));
1227
+ }
1228
+ static VALUE rbncurs_slk_touch(VALUE dummy) {
1229
+ return INT2NUM(slk_touch());
1230
+ }
1231
+ static VALUE rbncurs_standout(VALUE dummy) {
1232
+ return INT2NUM(standout());
1233
+ }
1234
+ static VALUE rbncurs_standend(VALUE dummy) {
1235
+ return INT2NUM(standend());
1236
+ }
1237
+ static VALUE rbncurs_start_color(VALUE dummy) {
1238
+ return INT2NUM(start_color());
1239
+ }
1240
+ static VALUE rbncurs_subpad(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4, VALUE arg5) {
1241
+ return wrap_window(subpad(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), NUM2INT(arg4), NUM2INT(arg5)));
1242
+ }
1243
+ static VALUE rbncurs_subwin(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4, VALUE arg5) {
1244
+ return wrap_window(subwin(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), NUM2INT(arg4), NUM2INT(arg5)));
1245
+ }
1246
+ static VALUE rbncurs_syncok(VALUE dummy, VALUE arg1, VALUE arg2) {
1247
+ return INT2NUM(syncok(get_window(arg1), RTEST(arg2)));
1248
+ }
1249
+ static VALUE rbncurs_termattrs(VALUE dummy) {
1250
+ return INT2NUM(termattrs());
1251
+ }
1252
+ static VALUE rbncurs_termname(VALUE dummy) {
1253
+ return rb_str_new2(termname());
1254
+ }
1255
+ #ifdef HAVE_TIGETFLAG
1256
+ static VALUE rbncurs_tigetflag(VALUE dummy, VALUE arg1) {
1257
+ return INT2NUM(tigetflag(STR2CSTR(arg1)));
1258
+ }
1259
+ #endif
1260
+ #ifdef HAVE_TIGETNUM
1261
+ static VALUE rbncurs_tigetnum(VALUE dummy, VALUE arg1) {
1262
+ return INT2NUM(tigetnum(STR2CSTR(arg1)));
1263
+ }
1264
+ #endif
1265
+ #ifdef HAVE_TIGETSTR
1266
+ static VALUE rbncurs_tigetstr(VALUE dummy, VALUE arg1) {
1267
+ return rb_str_new2(tigetstr(STR2CSTR(arg1)));
1268
+ }
1269
+ #endif
1270
+ static VALUE rbncurs_timeout(VALUE dummy, VALUE arg1) {
1271
+ return ((timeout(NUM2INT(arg1))),Qnil);
1272
+ }
1273
+ static VALUE rbncurs_typeahead(VALUE dummy, VALUE arg1) {
1274
+ return INT2NUM(typeahead(NUM2INT(arg1)));
1275
+ }
1276
+ static VALUE rbncurs_ungetch(VALUE dummy, VALUE arg1) {
1277
+ return INT2NUM(ungetch(NUM2INT(arg1)));
1278
+ }
1279
+ static VALUE rbncurs_untouchwin(VALUE dummy, VALUE arg1) {
1280
+ return INT2NUM(untouchwin(get_window(arg1)));
1281
+ }
1282
+ #ifdef HAVE_USE_ENV
1283
+ static VALUE rbncurs_use_env(VALUE dummy, VALUE arg1) {
1284
+ return ((use_env(RTEST(arg1))),Qnil);
1285
+ }
1286
+ #endif
1287
+ #ifdef HAVE_VIDATTR
1288
+ static VALUE rbncurs_vidattr(VALUE dummy, VALUE arg1) {
1289
+ return INT2NUM(vidattr(NUM2ULONG(arg1)));
1290
+ }
1291
+ #endif
1292
+ static VALUE rbncurs_vline(VALUE dummy, VALUE arg1, VALUE arg2) {
1293
+ return INT2NUM(vline(NUM2ULONG(arg1), NUM2INT(arg2)));
1294
+ }
1295
+ static VALUE rbncurs_waddch(VALUE dummy, VALUE arg1, VALUE arg2) {
1296
+ return INT2NUM(waddch(get_window(arg1), NUM2ULONG(arg2)));
1297
+ }
1298
+ static VALUE rbncurs_waddchnstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
1299
+ chtype * chstr = RB2CHSTR(arg2);
1300
+ VALUE return_value = INT2NUM(waddchnstr(get_window(arg1), chstr,
1301
+ NUM2INT(arg3)));
1302
+ xfree(chstr);
1303
+ return return_value;
1304
+ }
1305
+ static VALUE rbncurs_waddchstr(VALUE dummy, VALUE arg1, VALUE arg2) {
1306
+ chtype * chstr = RB2CHSTR(arg2);
1307
+ VALUE return_value = INT2NUM(waddchstr(get_window(arg1), chstr));
1308
+ xfree(chstr);
1309
+ return return_value;
1310
+ }
1311
+ static VALUE rbncurs_waddnstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
1312
+ return INT2NUM(waddnstr(get_window(arg1), STR2CSTR(arg2), NUM2INT(arg3)));
1313
+ }
1314
+ static VALUE rbncurs_waddstr(VALUE dummy, VALUE arg1, VALUE arg2) {
1315
+ return INT2NUM(waddstr(get_window(arg1), STR2CSTR(arg2)));
1316
+ }
1317
+ static VALUE rbncurs_wattron(VALUE dummy, VALUE arg1, VALUE arg2) {
1318
+ return INT2NUM(wattron(get_window(arg1), NUM2INT(arg2)));
1319
+ }
1320
+ static VALUE rbncurs_wattroff(VALUE dummy, VALUE arg1, VALUE arg2) {
1321
+ return INT2NUM(wattroff(get_window(arg1), NUM2INT(arg2)));
1322
+ }
1323
+ static VALUE rbncurs_wattrset(VALUE dummy, VALUE arg1, VALUE arg2) {
1324
+ return INT2NUM(wattrset(get_window(arg1), NUM2INT(arg2)));
1325
+ }
1326
+ static VALUE rbncurs_wbkgd(VALUE dummy, VALUE arg1, VALUE arg2) {
1327
+ return INT2NUM(wbkgd(get_window(arg1), NUM2ULONG(arg2)));
1328
+ }
1329
+ static VALUE rbncurs_wbkgdset(VALUE dummy, VALUE arg1, VALUE arg2) {
1330
+ return ((wbkgdset(get_window(arg1), NUM2ULONG(arg2))),Qnil);
1331
+ }
1332
+ static VALUE rbncurs_wborder(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4, VALUE arg5, VALUE arg6, VALUE arg7, VALUE arg8, VALUE arg9) {
1333
+ return INT2NUM(wborder(get_window(arg1), NUM2ULONG(arg2), NUM2ULONG(arg3), NUM2ULONG(arg4), NUM2ULONG(arg5), NUM2ULONG(arg6), NUM2ULONG(arg7), NUM2ULONG(arg8), NUM2ULONG(arg9)));
1334
+ }
1335
+ #ifdef HAVE_WCHGAT
1336
+ static VALUE rbncurs_wchgat(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4, VALUE arg5) {
1337
+ return INT2NUM(wchgat(get_window(arg1), NUM2INT(arg2), NUM2ULONG(arg3), NUM2INT(arg4), ((void)(arg5),NULL)));
1338
+ }
1339
+ #endif
1340
+ static VALUE rbncurs_wclear(VALUE dummy, VALUE arg1) {
1341
+ return INT2NUM(wclear(get_window(arg1)));
1342
+ }
1343
+ static VALUE rbncurs_wclrtobot(VALUE dummy, VALUE arg1) {
1344
+ return INT2NUM(wclrtobot(get_window(arg1)));
1345
+ }
1346
+ static VALUE rbncurs_wclrtoeol(VALUE dummy, VALUE arg1) {
1347
+ return INT2NUM(wclrtoeol(get_window(arg1)));
1348
+ }
1349
+ #ifdef HAVE_WCOLOR_SET
1350
+ static VALUE rbncurs_wcolor_set(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
1351
+ return INT2NUM(wcolor_set(get_window(arg1), NUM2INT(arg2), ((void)(arg3),NULL)));
1352
+ }
1353
+ #endif
1354
+ static VALUE rbncurs_wcursyncup(VALUE dummy, VALUE arg1) {
1355
+ return ((wcursyncup(get_window(arg1))),Qnil);
1356
+ }
1357
+ static VALUE rbncurs_wdelch(VALUE dummy, VALUE arg1) {
1358
+ return INT2NUM(wdelch(get_window(arg1)));
1359
+ }
1360
+ static VALUE rbncurs_wdeleteln(VALUE dummy, VALUE arg1) {
1361
+ return INT2NUM(wdeleteln(get_window(arg1)));
1362
+ }
1363
+ static VALUE rbncurs_wechochar(VALUE dummy, VALUE arg1, VALUE arg2) {
1364
+ return INT2NUM(wechochar(get_window(arg1), NUM2ULONG(arg2)));
1365
+ }
1366
+ static VALUE rbncurs_werase(VALUE dummy, VALUE arg1) {
1367
+ return INT2NUM(werase(get_window(arg1)));
1368
+ }
1369
+ static VALUE rbncurs_wgetch(VALUE dummy, VALUE arg1) {
1370
+ return INT2NUM(wgetch(get_window(arg1)));
1371
+ }
1372
+ static VALUE rbncurs_whline(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
1373
+ return INT2NUM(whline(get_window(arg1), NUM2ULONG(arg2), NUM2INT(arg3)));
1374
+ }
1375
+ static VALUE rbncurs_winch(VALUE dummy, VALUE arg1) {
1376
+ return INT2NUM(winch(get_window(arg1)));
1377
+ }
1378
+ static VALUE rbncurs_winsch(VALUE dummy, VALUE arg1, VALUE arg2) {
1379
+ return INT2NUM(winsch(get_window(arg1), NUM2ULONG(arg2)));
1380
+ }
1381
+ static VALUE rbncurs_winsdelln(VALUE dummy, VALUE arg1, VALUE arg2) {
1382
+ return INT2NUM(winsdelln(get_window(arg1), NUM2INT(arg2)));
1383
+ }
1384
+ static VALUE rbncurs_winsertln(VALUE dummy, VALUE arg1) {
1385
+ return INT2NUM(winsertln(get_window(arg1)));
1386
+ }
1387
+ static VALUE rbncurs_winsnstr(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
1388
+ return INT2NUM(winsnstr(get_window(arg1), STR2CSTR(arg2), NUM2INT(arg3)));
1389
+ }
1390
+ static VALUE rbncurs_winsstr(VALUE dummy, VALUE arg1, VALUE arg2) {
1391
+ return INT2NUM(winsstr(get_window(arg1), STR2CSTR(arg2)));
1392
+ }
1393
+ static VALUE rbncurs_wmove(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
1394
+ return INT2NUM(wmove(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3)));
1395
+ }
1396
+ static VALUE rbncurs_wnoutrefresh(VALUE dummy, VALUE arg1) {
1397
+ return INT2NUM(wnoutrefresh(get_window(arg1)));
1398
+ }
1399
+ static VALUE rbncurs_wredrawln(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
1400
+ return INT2NUM(wredrawln(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3)));
1401
+ }
1402
+ static VALUE rbncurs_wrefresh(VALUE dummy, VALUE arg1) {
1403
+ return INT2NUM(wrefresh(get_window(arg1)));
1404
+ }
1405
+ static VALUE rbncurs_wscrl(VALUE dummy, VALUE arg1, VALUE arg2) {
1406
+ return INT2NUM(wscrl(get_window(arg1), NUM2INT(arg2)));
1407
+ }
1408
+ static VALUE rbncurs_wsetscrreg(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
1409
+ return INT2NUM(wsetscrreg(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3)));
1410
+ }
1411
+ static VALUE rbncurs_wstandout(VALUE dummy, VALUE arg1) {
1412
+ return INT2NUM(wstandout(get_window(arg1)));
1413
+ }
1414
+ static VALUE rbncurs_wstandend(VALUE dummy, VALUE arg1) {
1415
+ return INT2NUM(wstandend(get_window(arg1)));
1416
+ }
1417
+ static VALUE rbncurs_wsyncdown(VALUE dummy, VALUE arg1) {
1418
+ return ((wsyncdown(get_window(arg1))),Qnil);
1419
+ }
1420
+ static VALUE rbncurs_wsyncup(VALUE dummy, VALUE arg1) {
1421
+ return ((wsyncup(get_window(arg1))),Qnil);
1422
+ }
1423
+ static VALUE rbncurs_wtimeout(VALUE dummy, VALUE arg1, VALUE arg2) {
1424
+ return ((wtimeout(get_window(arg1), NUM2INT(arg2))),Qnil);
1425
+ }
1426
+ static VALUE rbncurs_wtouchln(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4) {
1427
+ return INT2NUM(wtouchln(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3), NUM2INT(arg4)));
1428
+ }
1429
+ static VALUE rbncurs_wvline(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
1430
+ return INT2NUM(wvline(get_window(arg1), NUM2ULONG(arg2), NUM2INT(arg3)));
1431
+ }
1432
+ static VALUE rbncurs_color_content(VALUE dummy, VALUE color, VALUE r, VALUE g, VALUE b) {
1433
+ if (rb_obj_is_instance_of(r, rb_cArray) != Qtrue
1434
+ || rb_obj_is_instance_of(g, rb_cArray) != Qtrue
1435
+ || rb_obj_is_instance_of(b, rb_cArray) != Qtrue) {
1436
+ rb_raise(rb_eArgError,
1437
+ "r,g and b (2nd to 4th argument) must be an empty Arrays");
1438
+ return Qnil;
1439
+ }
1440
+ {
1441
+ short cv[3] = {0,0,0};
1442
+ int return_value = color_content(NUM2INT(color), &cv[0], &cv[1],
1443
+ &cv[2]);
1444
+ rb_ary_push(r, INT2NUM(cv[0])); rb_ary_push(g, INT2NUM(cv[1]));
1445
+ rb_ary_push(b, INT2NUM(cv[2])); return INT2NUM(return_value);
1446
+ }
1447
+ }
1448
+ static VALUE rbncurs_pair_content(VALUE dummy, VALUE pair, VALUE fg, VALUE bg) {
1449
+ if (rb_obj_is_instance_of(fg, rb_cArray) != Qtrue
1450
+ || rb_obj_is_instance_of(bg, rb_cArray) != Qtrue) {
1451
+ rb_raise(rb_eArgError,
1452
+ "fg and bg (2nd and 3rd argument) must be an empty Arrays");
1453
+ return Qnil;
1454
+ }
1455
+ {
1456
+ short cn[2] = {0,0};
1457
+ int return_value = pair_content(NUM2INT(pair), &cn[0], &cn[1]);
1458
+ rb_ary_push(fg, INT2NUM(cn[0])); rb_ary_push(bg, INT2NUM(cn[1]));
1459
+ return INT2NUM(return_value);
1460
+ }
1461
+ }
1462
+ #ifdef HAVE_GETWIN
1463
+ static VALUE rbncurs_getwin(VALUE dummy, VALUE io)
1464
+ {
1465
+ int fd = dup(NUM2INT(rb_funcall(io, rb_intern("to_i"), 0)));
1466
+ FILE * f = fdopen(fd, "r");
1467
+ WINDOW * win = getwin(f);
1468
+ fclose(f);
1469
+ close(fd);
1470
+ {
1471
+ VALUE return_value = Qnil;
1472
+ if (win) return_value = wrap_window(win);
1473
+ return return_value;
1474
+ }
1475
+ }
1476
+ #endif
1477
+ #ifdef HAVE_PUTWIN
1478
+ static VALUE rbncurs_putwin(VALUE dummy, VALUE rb_win, VALUE io)
1479
+ {
1480
+ int fd = dup(NUM2INT(rb_funcall(io, rb_intern("to_i"), 0)));
1481
+ FILE * f = fdopen(fd, "w");
1482
+ WINDOW * win = get_window(rb_win);
1483
+ int return_value = putwin(win, f);
1484
+ fclose(f);
1485
+ close(fd);
1486
+ return INT2NUM(return_value);
1487
+ }
1488
+ #endif
1489
+ static VALUE rbncurs_unctrl(VALUE dummy, VALUE ch)
1490
+ { return rb_str_new2(unctrl(NUM2ULONG(ch))); }
1491
+ static VALUE rbncurs_newterm(VALUE dummy, VALUE rb_type, VALUE rb_outfd, VALUE rb_infd)
1492
+ {
1493
+ char * type = (rb_type == Qnil) ? (char*)0 : STR2CSTR(rb_type);
1494
+ int outfd = NUM2INT(rb_funcall(rb_outfd, rb_intern("to_i"), 0));
1495
+ int infd = NUM2INT(rb_funcall(rb_infd, rb_intern("to_i"), 0));
1496
+ VALUE rb_screen =
1497
+ wrap_screen(newterm(type, fdopen(outfd, "w"), fdopen(infd, "r")));
1498
+ if (RTEST(rb_screen))
1499
+ Init_ncurses_full();
1500
+ return rb_screen;
1501
+ }
1502
+
1503
+
1504
+ static void init_functions_2(void) {
1505
+ NCFUNC(addch, 1);
1506
+ NCFUNC(addchnstr, 2);
1507
+ NCFUNC(addchstr, 1);
1508
+ NCFUNC(addnstr, 2);
1509
+ NCFUNC(addstr, 1);
1510
+ NCFUNC(attroff, 1);
1511
+ NCFUNC(attron, 1);
1512
+ NCFUNC(attrset, 1);
1513
+ #if defined(NCURSES_VERSION_MAJOR) && NCURSES_VERSION_MAJOR > 4
1514
+ #ifdef HAVE_ATTR_OFF
1515
+ NCFUNC(attr_off, 2);
1516
+ #endif
1517
+ #ifdef HAVE_ATTR_ON
1518
+ NCFUNC(attr_on, 2);
1519
+ #endif
1520
+ #ifdef HAVE_ATTR_SET
1521
+ NCFUNC(attr_set, 3);
1522
+ #endif
1523
+ #if defined(HAVE_SLK_ATTR_OFF) || defined(slk_attr_off)
1524
+ NCFUNC(slk_attr_off, 2);
1525
+ #endif
1526
+ #if defined(HAVE_SLK_ATTR_ON) || defined(slk_attr_on)
1527
+ NCFUNC(slk_attr_on, 2);
1528
+ #endif
1529
+ #ifdef HAVE_SLK_ATTR_SET
1530
+ NCFUNC(slk_attr_set, 3);
1531
+ #endif
1532
+ #ifdef HAVE_WATTR_ON
1533
+ NCFUNC(wattr_on, 3);
1534
+ #endif
1535
+ #ifdef HAVE_WATTR_OFF
1536
+ NCFUNC(wattr_off, 3);
1537
+ #endif
1538
+ #ifdef HAVE_WATTR_SET
1539
+ NCFUNC(wattr_set, 4);
1540
+ #endif
1541
+ #if defined (HAVE_VID_ATTR) || defined(vid_attr)
1542
+ NCFUNC(vid_attr, 3);
1543
+ #endif
1544
+ #ifdef HAVE_ATTR_GET
1545
+ NCFUNC(attr_get, 3);
1546
+ NCFUNC(wattr_get, 4);
1547
+ #endif /* HAVE_ATTR_GET */
1548
+ #endif
1549
+ NCFUNC(baudrate, 0);
1550
+ NCFUNC(beep, 0);
1551
+ NCFUNC(bkgd, 1);
1552
+ NCFUNC(bkgdset, 1);
1553
+ NCFUNC(border, 8);
1554
+ NCFUNC(box, 3);
1555
+ rb_define_module_function(mNcurses, "can_change_color?",
1556
+ (&rbncurs_can_change_color),
1557
+ 0);
1558
+ NCFUNC(cbreak, 0);
1559
+ #ifdef HAVE_CHGAT
1560
+ NCFUNC(chgat, 4);
1561
+ #endif
1562
+ NCFUNC(clear, 0);
1563
+ NCFUNC(clearok, 2);
1564
+ NCFUNC(clrtobot, 0);
1565
+ NCFUNC(clrtoeol, 0);
1566
+ #ifdef HAVE_COLOR_SET
1567
+ NCFUNC(color_set, 2);
1568
+ #endif
1569
+ NCFUNC(COLOR_PAIR, 1);
1570
+ NCFUNC(copywin, 9);
1571
+ NCFUNC(curs_set, 1);
1572
+ NCFUNC(def_prog_mode, 0);
1573
+ NCFUNC(def_shell_mode, 0);
1574
+ NCFUNC(delay_output, 1);
1575
+ NCFUNC(delch, 0);
1576
+ NCFUNC(deleteln, 0);
1577
+ NCFUNC(derwin, 5);
1578
+ NCFUNC(doupdate, 0);
1579
+ NCFUNC(dupwin, 1);
1580
+ NCFUNC(echo, 0);
1581
+ NCFUNC(echochar, 1);
1582
+ NCFUNC(endwin, 0);
1583
+ NCFUNC(erasechar, 0);
1584
+ NCFUNC(flash, 0);
1585
+ NCFUNC(flushinp, 0);
1586
+ NCFUNC(getbkgd, 1);
1587
+ NCFUNC(getch, 0);
1588
+ NCFUNC(halfdelay, 1);
1589
+ rb_define_module_function(mNcurses, "has_colors?",
1590
+ (&rbncurs_has_colors),
1591
+ 0);
1592
+ rb_define_module_function(mNcurses, "has_ic?",
1593
+ (&rbncurs_has_ic),
1594
+ 0);
1595
+ rb_define_module_function(mNcurses, "has_il?",
1596
+ (&rbncurs_has_il),
1597
+ 0);
1598
+ NCFUNC(hline, 2);
1599
+ NCFUNC(idcok, 2);
1600
+ NCFUNC(idlok, 2);
1601
+ NCFUNC(immedok, 2);
1602
+ NCFUNC(inch, 0);
1603
+ NCFUNC(init_color, 4);
1604
+ NCFUNC(init_pair, 3);
1605
+ NCFUNC(insch, 1);
1606
+ NCFUNC(insdelln, 1);
1607
+ NCFUNC(insertln, 0);
1608
+ NCFUNC(insnstr, 2);
1609
+ NCFUNC(insstr, 1);
1610
+ #ifdef HAVE_INTRFLUSH
1611
+ NCFUNC(intrflush, 2);
1612
+ #endif
1613
+ rb_define_module_function(mNcurses, "isendwin?",
1614
+ (&rbncurs_isendwin),
1615
+ 0);
1616
+ rb_define_module_function(mNcurses, "is_linetouched?",
1617
+ (&rbncurs_is_linetouched),
1618
+ 2);
1619
+ rb_define_module_function(mNcurses, "is_wintouched?",
1620
+ (&rbncurs_is_wintouched),
1621
+ 1);
1622
+ NCFUNC(keyname, 1);
1623
+ NCFUNC(keypad, 2);
1624
+ NCFUNC(killchar, 0);
1625
+ NCFUNC(leaveok, 2);
1626
+ NCFUNC(longname, 0);
1627
+ NCFUNC(meta, 2);
1628
+ NCFUNC(move, 2);
1629
+ NCFUNC(mvaddch, 3);
1630
+ NCFUNC(mvaddchnstr, 4);
1631
+ NCFUNC(mvaddchstr, 3);
1632
+ NCFUNC(mvaddnstr, 4);
1633
+ NCFUNC(mvaddstr, 3);
1634
+ #ifdef HAVE_MVCHGAT
1635
+ NCFUNC(mvchgat, 6);
1636
+ #endif
1637
+ NCFUNC(mvcur, 4);
1638
+ NCFUNC(mvdelch, 2);
1639
+ NCFUNC(mvderwin, 3);
1640
+ NCFUNC(mvgetch, 2);
1641
+ #ifdef HAVE_MVHLINE
1642
+ NCFUNC(mvhline, 4);
1643
+ #endif
1644
+ NCFUNC(mvinch, 2);
1645
+ NCFUNC(mvinsch, 3);
1646
+ NCFUNC(mvinsnstr, 4);
1647
+ NCFUNC(mvinsstr, 3);
1648
+ #ifdef HAVE_MVVLINE
1649
+ NCFUNC(mvvline, 4);
1650
+ #endif
1651
+ NCFUNC(mvwaddch, 4);
1652
+ NCFUNC(mvwaddchnstr, 5);
1653
+ NCFUNC(mvwaddchstr, 4);
1654
+ NCFUNC(mvwaddnstr, 5);
1655
+ NCFUNC(mvwaddstr, 4);
1656
+ #ifdef HAVE_MVWCHGAT
1657
+ NCFUNC(mvwchgat, 7);
1658
+ #endif
1659
+ NCFUNC(mvwdelch, 3);
1660
+ NCFUNC(mvwgetch, 3);
1661
+ #ifdef HAVE_MVWHLINE
1662
+ NCFUNC(mvwhline, 5);
1663
+ #endif
1664
+ NCFUNC(mvwin, 3);
1665
+ NCFUNC(mvwinch, 3);
1666
+ NCFUNC(mvwinsch, 4);
1667
+ NCFUNC(mvwinsnstr, 5);
1668
+ NCFUNC(mvwinsstr, 4);
1669
+ #ifdef HAVE_MVWVLINE
1670
+ NCFUNC(mvwvline, 5);
1671
+ #endif
1672
+ NCFUNC(napms, 1);
1673
+ NCFUNC(newpad, 2);
1674
+ NCFUNC(newwin, 4);
1675
+ NCFUNC(nl, 0);
1676
+ NCFUNC(nocbreak, 0);
1677
+ NCFUNC(nodelay, 2);
1678
+ NCFUNC(noecho, 0);
1679
+ NCFUNC(nonl, 0);
1680
+ #ifdef HAVE_NOQIFLUSH
1681
+ NCFUNC(noqiflush, 0);
1682
+ #endif
1683
+ NCFUNC(noraw, 0);
1684
+ NCFUNC(notimeout, 2);
1685
+ NCFUNC(overlay, 2);
1686
+ NCFUNC(overwrite, 2);
1687
+ NCFUNC(PAIR_NUMBER, 1);
1688
+ #ifndef __PDCURSES__ /* pdcurses' pechochar macro does not work */
1689
+ NCFUNC(pechochar, 2);
1690
+ #endif
1691
+ NCFUNC(pnoutrefresh, 7);
1692
+ NCFUNC(prefresh, 7);
1693
+ #ifdef HAVE_PUTP
1694
+ NCFUNC(putp, 1);
1695
+ #endif
1696
+ #ifdef HAVE_QIFLUSH
1697
+ NCFUNC(qiflush, 0);
1698
+ #endif
1699
+ NCFUNC(raw, 0);
1700
+ #ifndef __PDCURSES__ /* pdcurses redrawwin macro has a bug */
1701
+ NCFUNC(redrawwin, 1);
1702
+ #endif
1703
+ NCFUNC(refresh, 0);
1704
+ NCFUNC(resetty, 0);
1705
+ NCFUNC(reset_prog_mode, 0);
1706
+ NCFUNC(reset_shell_mode, 0);
1707
+ NCFUNC(savetty, 0);
1708
+ #ifdef HAVE_SCR_DUMP
1709
+ NCFUNC(scr_dump, 1);
1710
+ #endif
1711
+ #ifdef HAVE_SCR_INIT
1712
+ NCFUNC(scr_init, 1);
1713
+ #endif
1714
+ NCFUNC(scrl, 1);
1715
+ NCFUNC(scroll, 1);
1716
+ NCFUNC(scrollok, 2);
1717
+ #ifdef HAVE_SCR_RESTORE
1718
+ NCFUNC(scr_restore, 1);
1719
+ #endif
1720
+ #ifdef HAVE_SCR_SET
1721
+ NCFUNC(scr_set, 1);
1722
+ #endif
1723
+ NCFUNC(setscrreg, 2);
1724
+ NCFUNC(set_term, 1);
1725
+ NCFUNC(slk_attroff, 1);
1726
+ NCFUNC(slk_attron, 1);
1727
+ NCFUNC(slk_attrset, 1);
1728
+ #ifdef HAVE_SLK_ATTR
1729
+ NCFUNC(slk_attr, 0);
1730
+ #endif
1731
+ NCFUNC(slk_clear, 0);
1732
+ #ifdef HAVE_SLK_COLOR
1733
+ NCFUNC(slk_color, 1);
1734
+ #endif
1735
+ NCFUNC(slk_label, 1);
1736
+ NCFUNC(slk_noutrefresh, 0);
1737
+ NCFUNC(slk_refresh, 0);
1738
+ NCFUNC(slk_restore, 0);
1739
+ NCFUNC(slk_set, 3);
1740
+ NCFUNC(slk_touch, 0);
1741
+ NCFUNC(standout, 0);
1742
+ NCFUNC(standend, 0);
1743
+ NCFUNC(start_color, 0);
1744
+ NCFUNC(subpad, 5);
1745
+ NCFUNC(subwin, 5);
1746
+ NCFUNC(syncok, 2);
1747
+ NCFUNC(termattrs, 0);
1748
+ NCFUNC(termname, 0);
1749
+ #ifdef HAVE_TIGETFLAG
1750
+ NCFUNC(tigetflag, 1);
1751
+ #endif
1752
+ #ifdef HAVE_TIGETNUM
1753
+ NCFUNC(tigetnum, 1);
1754
+ #endif
1755
+ #ifdef HAVE_TIGETSTR
1756
+ NCFUNC(tigetstr, 1);
1757
+ #endif
1758
+ NCFUNC(timeout, 1);
1759
+ NCFUNC(typeahead, 1);
1760
+ NCFUNC(ungetch, 1);
1761
+ NCFUNC(untouchwin, 1);
1762
+ #ifdef HAVE_VIDATTR
1763
+ NCFUNC(vidattr, 1);
1764
+ #endif
1765
+ NCFUNC(vline, 2);
1766
+ NCFUNC(waddch, 2);
1767
+ NCFUNC(waddchnstr, 3);
1768
+ NCFUNC(waddchstr, 2);
1769
+ NCFUNC(waddnstr, 3);
1770
+ NCFUNC(waddstr, 2);
1771
+ NCFUNC(wattron, 2);
1772
+ NCFUNC(wattroff, 2);
1773
+ NCFUNC(wattrset, 2);
1774
+ NCFUNC(wbkgd, 2);
1775
+ NCFUNC(wbkgdset, 2);
1776
+ NCFUNC(wborder, 9);
1777
+ #ifdef HAVE_WCHGAT
1778
+ NCFUNC(wchgat, 5);
1779
+ #endif
1780
+ NCFUNC(wclear, 1);
1781
+ NCFUNC(wclrtobot, 1);
1782
+ NCFUNC(wclrtoeol, 1);
1783
+ #ifdef HAVE_WCOLOR_SET
1784
+ NCFUNC(wcolor_set, 3);
1785
+ #endif
1786
+ NCFUNC(wcursyncup, 1);
1787
+ NCFUNC(wdelch, 1);
1788
+ NCFUNC(wdeleteln, 1);
1789
+ NCFUNC(wechochar, 2);
1790
+ NCFUNC(werase, 1);
1791
+ NCFUNC(wgetch, 1);
1792
+ NCFUNC(whline, 3);
1793
+ NCFUNC(winch, 1);
1794
+ NCFUNC(winsch, 2);
1795
+ NCFUNC(winsdelln, 2);
1796
+ NCFUNC(winsertln, 1);
1797
+ NCFUNC(winsnstr, 3);
1798
+ NCFUNC(winsstr, 2);
1799
+ NCFUNC(wmove, 3);
1800
+ NCFUNC(wnoutrefresh, 1);
1801
+ NCFUNC(wredrawln, 3);
1802
+ NCFUNC(wrefresh, 1);
1803
+ NCFUNC(wscrl, 2);
1804
+ NCFUNC(wsetscrreg, 3);
1805
+ NCFUNC(wstandout, 1);
1806
+ NCFUNC(wstandend, 1);
1807
+ NCFUNC(wsyncdown, 1);
1808
+ NCFUNC(wsyncup, 1);
1809
+ NCFUNC(wtimeout, 2);
1810
+ NCFUNC(wtouchln, 4);
1811
+ NCFUNC(wvline, 3);
1812
+ NCFUNC(color_content, 4);
1813
+ NCFUNC(pair_content, 3);
1814
+ NCFUNC(pair_content, 3);
1815
+ #ifdef HAVE_GETWIN
1816
+ NCFUNC(getwin, 1);
1817
+ #endif
1818
+ #ifdef HAVE_PUTWIN
1819
+ NCFUNC(putwin, 2);
1820
+ #endif
1821
+ NCFUNC(unctrl, 1);
1822
+ }
1823
+
1824
+
1825
+ static void init_constants_3(void) {
1826
+ /* #define NCURSES_BITS(mask,shift) ((mask) << ((shift) + 8)) */
1827
+
1828
+ /* attributes */
1829
+
1830
+ rb_define_const(mNcurses, "A_NORMAL", INT2NUM(A_NORMAL));
1831
+ rb_define_const(mNcurses, "A_ATTRIBUTES", INT2NUM(A_ATTRIBUTES));
1832
+ rb_define_const(mNcurses, "A_CHARTEXT", INT2NUM(A_CHARTEXT));
1833
+ rb_define_const(mNcurses, "A_COLOR", INT2NUM(A_COLOR));
1834
+ rb_define_const(mNcurses, "A_STANDOUT", INT2NUM(A_STANDOUT));
1835
+ rb_define_const(mNcurses, "A_UNDERLINE", INT2NUM(A_UNDERLINE));
1836
+ rb_define_const(mNcurses, "A_REVERSE", INT2NUM(A_REVERSE));
1837
+ rb_define_const(mNcurses, "A_BLINK", INT2NUM(A_BLINK));
1838
+ rb_define_const(mNcurses, "A_DIM", INT2NUM(A_DIM));
1839
+ rb_define_const(mNcurses, "A_BOLD", INT2NUM(A_BOLD));
1840
+ rb_define_const(mNcurses, "A_ALTCHARSET", INT2NUM(A_ALTCHARSET));
1841
+ rb_define_const(mNcurses, "A_INVIS", INT2NUM(A_INVIS));
1842
+
1843
+ /* Tradeoff on 32-bit machines ('protect' vs widec). The others (e.g., left
1844
+ * highlight are not implemented in any terminal descriptions, anyway.
1845
+ */
1846
+ rb_define_const(mNcurses, "A_PROTECT", INT2NUM(A_PROTECT));
1847
+ #ifdef A_HORIZONTAL
1848
+ rb_define_const(mNcurses, "A_HORIZONTAL", INT2NUM(A_HORIZONTAL));
1849
+ #endif
1850
+ #ifdef A_LEFT
1851
+ rb_define_const(mNcurses, "A_LEFT", INT2NUM(A_LEFT));
1852
+ #endif
1853
+ #ifdef A_LOW
1854
+ rb_define_const(mNcurses, "A_LOW", INT2NUM(A_LOW));
1855
+ #endif
1856
+ #ifdef A_RIGHT
1857
+ rb_define_const(mNcurses, "A_RIGHT", INT2NUM(A_RIGHT));
1858
+ #endif
1859
+ #ifdef A_TOP
1860
+ rb_define_const(mNcurses, "A_TOP", INT2NUM(A_TOP));
1861
+ #endif
1862
+ #ifdef A_VERTICAL
1863
+ rb_define_const(mNcurses, "A_VERTICAL", INT2NUM(A_VERTICAL));
1864
+ #endif
1865
+
1866
+ /* Pseudo-character tokens outside ASCII range. The curses wgetch()
1867
+ * function will return any given one of these only if the corresponding
1868
+ * k- capability is defined in your terminal's terminfo entry. */
1869
+ #ifdef KAY_CODE_YES
1870
+ rb_define_const(mNcurses, "KEY_CODE_YES", INT2NUM(KEY_CODE_YES));
1871
+ #endif
1872
+ rb_define_const(mNcurses, "KEY_MIN", INT2NUM(KEY_MIN));
1873
+ rb_define_const(mNcurses, "KEY_BREAK", INT2NUM(KEY_BREAK));
1874
+ rb_define_const(mNcurses, "KEY_DOWN", INT2NUM(KEY_DOWN));
1875
+ rb_define_const(mNcurses, "KEY_UP", INT2NUM(KEY_UP));
1876
+ rb_define_const(mNcurses, "KEY_LEFT", INT2NUM(KEY_LEFT));
1877
+ rb_define_const(mNcurses, "KEY_RIGHT", INT2NUM(KEY_RIGHT));
1878
+ rb_define_const(mNcurses, "KEY_HOME", INT2NUM(KEY_HOME));
1879
+ rb_define_const(mNcurses, "KEY_BACKSPACE", INT2NUM(KEY_BACKSPACE));
1880
+ rb_define_const(mNcurses, "KEY_F0", INT2NUM(KEY_F(0)));
1881
+ rb_define_const(mNcurses, "KEY_F1", INT2NUM(KEY_F(1)));
1882
+ rb_define_const(mNcurses, "KEY_F2", INT2NUM(KEY_F(2)));
1883
+ rb_define_const(mNcurses, "KEY_F3", INT2NUM(KEY_F(3)));
1884
+ rb_define_const(mNcurses, "KEY_F4", INT2NUM(KEY_F(4)));
1885
+ rb_define_const(mNcurses, "KEY_F5", INT2NUM(KEY_F(5)));
1886
+ rb_define_const(mNcurses, "KEY_F6", INT2NUM(KEY_F(6)));
1887
+ rb_define_const(mNcurses, "KEY_F7", INT2NUM(KEY_F(7)));
1888
+ rb_define_const(mNcurses, "KEY_F8", INT2NUM(KEY_F(8)));
1889
+ rb_define_const(mNcurses, "KEY_F9", INT2NUM(KEY_F(9)));
1890
+ rb_define_const(mNcurses, "KEY_F10", INT2NUM(KEY_F(10)));
1891
+ rb_define_const(mNcurses, "KEY_F11", INT2NUM(KEY_F(11)));
1892
+ rb_define_const(mNcurses, "KEY_F12", INT2NUM(KEY_F(12)));
1893
+ rb_define_const(mNcurses, "KEY_F13", INT2NUM(KEY_F(13)));
1894
+ rb_define_const(mNcurses, "KEY_F14", INT2NUM(KEY_F(14)));
1895
+ rb_define_const(mNcurses, "KEY_F15", INT2NUM(KEY_F(15)));
1896
+ rb_define_const(mNcurses, "KEY_F16", INT2NUM(KEY_F(16)));
1897
+ rb_define_const(mNcurses, "KEY_F17", INT2NUM(KEY_F(17)));
1898
+ rb_define_const(mNcurses, "KEY_F18", INT2NUM(KEY_F(18)));
1899
+ rb_define_const(mNcurses, "KEY_F19", INT2NUM(KEY_F(19)));
1900
+ rb_define_const(mNcurses, "KEY_F20", INT2NUM(KEY_F(20)));
1901
+ rb_define_const(mNcurses, "KEY_F21", INT2NUM(KEY_F(21)));
1902
+ rb_define_const(mNcurses, "KEY_F22", INT2NUM(KEY_F(22)));
1903
+ rb_define_const(mNcurses, "KEY_F23", INT2NUM(KEY_F(23)));
1904
+ rb_define_const(mNcurses, "KEY_F24", INT2NUM(KEY_F(24)));
1905
+ rb_define_const(mNcurses, "KEY_F25", INT2NUM(KEY_F(25)));
1906
+ rb_define_const(mNcurses, "KEY_F26", INT2NUM(KEY_F(26)));
1907
+ rb_define_const(mNcurses, "KEY_F27", INT2NUM(KEY_F(27)));
1908
+ rb_define_const(mNcurses, "KEY_F28", INT2NUM(KEY_F(28)));
1909
+ rb_define_const(mNcurses, "KEY_F29", INT2NUM(KEY_F(29)));
1910
+ rb_define_const(mNcurses, "KEY_F30", INT2NUM(KEY_F(30)));
1911
+ rb_define_const(mNcurses, "KEY_DL", INT2NUM(KEY_DL));
1912
+ rb_define_const(mNcurses, "KEY_IL", INT2NUM(KEY_IL));
1913
+ rb_define_const(mNcurses, "KEY_DC", INT2NUM(KEY_DC));
1914
+ rb_define_const(mNcurses, "KEY_IC", INT2NUM(KEY_IC));
1915
+ rb_define_const(mNcurses, "KEY_EIC", INT2NUM(KEY_EIC));
1916
+ rb_define_const(mNcurses, "KEY_CLEAR", INT2NUM(KEY_CLEAR));
1917
+ rb_define_const(mNcurses, "KEY_EOS", INT2NUM(KEY_EOS));
1918
+ rb_define_const(mNcurses, "KEY_EOL", INT2NUM(KEY_EOL));
1919
+ rb_define_const(mNcurses, "KEY_SF", INT2NUM(KEY_SF));
1920
+ rb_define_const(mNcurses, "KEY_SR", INT2NUM(KEY_SR));
1921
+ rb_define_const(mNcurses, "KEY_NPAGE", INT2NUM(KEY_NPAGE));
1922
+ rb_define_const(mNcurses, "KEY_PPAGE", INT2NUM(KEY_PPAGE));
1923
+ rb_define_const(mNcurses, "KEY_STAB", INT2NUM(KEY_STAB));
1924
+ rb_define_const(mNcurses, "KEY_CTAB", INT2NUM(KEY_CTAB));
1925
+ rb_define_const(mNcurses, "KEY_CATAB", INT2NUM(KEY_CATAB));
1926
+ rb_define_const(mNcurses, "KEY_ENTER", INT2NUM(KEY_ENTER));
1927
+ rb_define_const(mNcurses, "KEY_SRESET", INT2NUM(KEY_SRESET));
1928
+ rb_define_const(mNcurses, "KEY_RESET", INT2NUM(KEY_RESET));
1929
+ rb_define_const(mNcurses, "KEY_PRINT", INT2NUM(KEY_PRINT));
1930
+ rb_define_const(mNcurses, "KEY_LL", INT2NUM(KEY_LL));
1931
+
1932
+ /* The keypad is arranged like this: */
1933
+ /* a1 up a3 */
1934
+ /* left b2 right */
1935
+ /* c1 down c3 */
1936
+
1937
+ rb_define_const(mNcurses, "KEY_A1", INT2NUM(KEY_A1));
1938
+ rb_define_const(mNcurses, "KEY_A3", INT2NUM(KEY_A3));
1939
+ rb_define_const(mNcurses, "KEY_B2", INT2NUM(KEY_B2));
1940
+ rb_define_const(mNcurses, "KEY_C1", INT2NUM(KEY_C1));
1941
+ rb_define_const(mNcurses, "KEY_C3", INT2NUM(KEY_C3));
1942
+ rb_define_const(mNcurses, "KEY_BTAB", INT2NUM(KEY_BTAB));
1943
+ rb_define_const(mNcurses, "KEY_BEG", INT2NUM(KEY_BEG));
1944
+ rb_define_const(mNcurses, "KEY_CANCEL", INT2NUM(KEY_CANCEL));
1945
+ rb_define_const(mNcurses, "KEY_CLOSE", INT2NUM(KEY_CLOSE));
1946
+ rb_define_const(mNcurses, "KEY_COMMAND", INT2NUM(KEY_COMMAND));
1947
+ rb_define_const(mNcurses, "KEY_COPY", INT2NUM(KEY_COPY));
1948
+ rb_define_const(mNcurses, "KEY_CREATE", INT2NUM(KEY_CREATE));
1949
+ rb_define_const(mNcurses, "KEY_END", INT2NUM(KEY_END));
1950
+ rb_define_const(mNcurses, "KEY_EXIT", INT2NUM(KEY_EXIT));
1951
+ rb_define_const(mNcurses, "KEY_FIND", INT2NUM(KEY_FIND));
1952
+ rb_define_const(mNcurses, "KEY_HELP", INT2NUM(KEY_HELP));
1953
+ rb_define_const(mNcurses, "KEY_MARK", INT2NUM(KEY_MARK));
1954
+ rb_define_const(mNcurses, "KEY_MESSAGE", INT2NUM(KEY_MESSAGE));
1955
+ rb_define_const(mNcurses, "KEY_MOVE", INT2NUM(KEY_MOVE));
1956
+ rb_define_const(mNcurses, "KEY_NEXT", INT2NUM(KEY_NEXT));
1957
+ rb_define_const(mNcurses, "KEY_OPEN", INT2NUM(KEY_OPEN));
1958
+ rb_define_const(mNcurses, "KEY_OPTIONS", INT2NUM(KEY_OPTIONS));
1959
+ rb_define_const(mNcurses, "KEY_PREVIOUS", INT2NUM(KEY_PREVIOUS));
1960
+ rb_define_const(mNcurses, "KEY_REDO", INT2NUM(KEY_REDO));
1961
+ rb_define_const(mNcurses, "KEY_REFERENCE", INT2NUM(KEY_REFERENCE));
1962
+ rb_define_const(mNcurses, "KEY_REFRESH", INT2NUM(KEY_REFRESH));
1963
+ rb_define_const(mNcurses, "KEY_REPLACE", INT2NUM(KEY_REPLACE));
1964
+ rb_define_const(mNcurses, "KEY_RESTART", INT2NUM(KEY_RESTART));
1965
+ rb_define_const(mNcurses, "KEY_RESUME", INT2NUM(KEY_RESUME));
1966
+ rb_define_const(mNcurses, "KEY_SAVE", INT2NUM(KEY_SAVE));
1967
+ rb_define_const(mNcurses, "KEY_SBEG", INT2NUM(KEY_SBEG));
1968
+ rb_define_const(mNcurses, "KEY_SCANCEL", INT2NUM(KEY_SCANCEL));
1969
+ rb_define_const(mNcurses, "KEY_SCOMMAND", INT2NUM(KEY_SCOMMAND));
1970
+ rb_define_const(mNcurses, "KEY_SCOPY", INT2NUM(KEY_SCOPY));
1971
+ rb_define_const(mNcurses, "KEY_SCREATE", INT2NUM(KEY_SCREATE));
1972
+ rb_define_const(mNcurses, "KEY_SDC", INT2NUM(KEY_SDC));
1973
+ rb_define_const(mNcurses, "KEY_SDL", INT2NUM(KEY_SDL));
1974
+ rb_define_const(mNcurses, "KEY_SELECT", INT2NUM(KEY_SELECT));
1975
+ rb_define_const(mNcurses, "KEY_SEND", INT2NUM(KEY_SEND));
1976
+ rb_define_const(mNcurses, "KEY_SEOL", INT2NUM(KEY_SEOL));
1977
+ rb_define_const(mNcurses, "KEY_SEXIT", INT2NUM(KEY_SEXIT));
1978
+ rb_define_const(mNcurses, "KEY_SFIND", INT2NUM(KEY_SFIND));
1979
+ rb_define_const(mNcurses, "KEY_SHELP", INT2NUM(KEY_SHELP));
1980
+ rb_define_const(mNcurses, "KEY_SHOME", INT2NUM(KEY_SHOME));
1981
+ rb_define_const(mNcurses, "KEY_SIC", INT2NUM(KEY_SIC));
1982
+ rb_define_const(mNcurses, "KEY_SLEFT", INT2NUM(KEY_SLEFT));
1983
+ rb_define_const(mNcurses, "KEY_SMESSAGE", INT2NUM(KEY_SMESSAGE));
1984
+ rb_define_const(mNcurses, "KEY_SMOVE", INT2NUM(KEY_SMOVE));
1985
+ rb_define_const(mNcurses, "KEY_SNEXT", INT2NUM(KEY_SNEXT));
1986
+ rb_define_const(mNcurses, "KEY_SOPTIONS", INT2NUM(KEY_SOPTIONS));
1987
+ rb_define_const(mNcurses, "KEY_SPREVIOUS", INT2NUM(KEY_SPREVIOUS));
1988
+ rb_define_const(mNcurses, "KEY_SPRINT", INT2NUM(KEY_SPRINT));
1989
+ rb_define_const(mNcurses, "KEY_SREDO", INT2NUM(KEY_SREDO));
1990
+ rb_define_const(mNcurses, "KEY_SREPLACE", INT2NUM(KEY_SREPLACE));
1991
+ rb_define_const(mNcurses, "KEY_SRIGHT", INT2NUM(KEY_SRIGHT));
1992
+ rb_define_const(mNcurses, "KEY_SRSUME", INT2NUM(KEY_SRSUME));
1993
+ rb_define_const(mNcurses, "KEY_SSAVE", INT2NUM(KEY_SSAVE));
1994
+ rb_define_const(mNcurses, "KEY_SSUSPEND", INT2NUM(KEY_SSUSPEND));
1995
+ rb_define_const(mNcurses, "KEY_SUNDO", INT2NUM(KEY_SUNDO));
1996
+ rb_define_const(mNcurses, "KEY_SUSPEND", INT2NUM(KEY_SUSPEND));
1997
+ rb_define_const(mNcurses, "KEY_UNDO", INT2NUM(KEY_UNDO));
1998
+ rb_define_const(mNcurses, "KEY_MOUSE", INT2NUM(KEY_MOUSE));
1999
+ rb_define_const(mNcurses, "KEY_RESIZE", INT2NUM(KEY_RESIZE));
2000
+ rb_define_const(mNcurses, "KEY_MAX", INT2NUM(KEY_MAX));
2001
+
2002
+ /* mouse interface */
2003
+ /* #define NCURSES_MOUSE_VERSION 1 */
2004
+
2005
+ /* event masks */
2006
+ rb_define_const(mNcurses, "BUTTON1_RELEASED", INT2NUM(BUTTON1_RELEASED));
2007
+ rb_define_const(mNcurses, "BUTTON1_PRESSED", INT2NUM(BUTTON1_PRESSED));
2008
+ rb_define_const(mNcurses, "BUTTON1_CLICKED", INT2NUM(BUTTON1_CLICKED));
2009
+ rb_define_const(mNcurses, "BUTTON1_DOUBLE_CLICKED", INT2NUM(BUTTON1_DOUBLE_CLICKED));
2010
+ rb_define_const(mNcurses, "BUTTON1_TRIPLE_CLICKED", INT2NUM(BUTTON1_TRIPLE_CLICKED));
2011
+ #ifdef BUTTON1_RESERVED_EVENT
2012
+ rb_define_const(mNcurses, "BUTTON1_RESERVED_EVENT", INT2NUM(BUTTON1_RESERVED_EVENT));
2013
+ #endif
2014
+ rb_define_const(mNcurses, "BUTTON2_RELEASED", INT2NUM(BUTTON2_RELEASED));
2015
+ rb_define_const(mNcurses, "BUTTON2_PRESSED", INT2NUM(BUTTON2_PRESSED));
2016
+ rb_define_const(mNcurses, "BUTTON2_CLICKED", INT2NUM(BUTTON2_CLICKED));
2017
+ rb_define_const(mNcurses, "BUTTON2_DOUBLE_CLICKED", INT2NUM(BUTTON2_DOUBLE_CLICKED));
2018
+ rb_define_const(mNcurses, "BUTTON2_TRIPLE_CLICKED", INT2NUM(BUTTON2_TRIPLE_CLICKED));
2019
+ #ifdef BUTTON2_RESERVED_EVENT
2020
+ rb_define_const(mNcurses, "BUTTON2_RESERVED_EVENT", INT2NUM(BUTTON2_RESERVED_EVENT));
2021
+ #endif
2022
+ rb_define_const(mNcurses, "BUTTON3_RELEASED", INT2NUM(BUTTON3_RELEASED));
2023
+ rb_define_const(mNcurses, "BUTTON3_PRESSED", INT2NUM(BUTTON3_PRESSED));
2024
+ rb_define_const(mNcurses, "BUTTON3_CLICKED", INT2NUM(BUTTON3_CLICKED));
2025
+ rb_define_const(mNcurses, "BUTTON3_DOUBLE_CLICKED", INT2NUM(BUTTON3_DOUBLE_CLICKED));
2026
+ rb_define_const(mNcurses, "BUTTON3_TRIPLE_CLICKED", INT2NUM(BUTTON3_TRIPLE_CLICKED));
2027
+ #ifdef BUTTON3_RESERVED_EVENT
2028
+ rb_define_const(mNcurses, "BUTTON3_RESERVED_EVENT", INT2NUM(BUTTON3_RESERVED_EVENT));
2029
+ #endif
2030
+ #ifdef BUTTON4_RELEASED
2031
+ rb_define_const(mNcurses, "BUTTON4_RELEASED", INT2NUM(BUTTON4_RELEASED));
2032
+ #endif
2033
+ #ifdef BUTTON4_PRESSED
2034
+ rb_define_const(mNcurses, "BUTTON4_PRESSED", INT2NUM(BUTTON4_PRESSED));
2035
+ #endif
2036
+ #ifdef BUTTON4_CLICKED
2037
+ rb_define_const(mNcurses, "BUTTON4_CLICKED", INT2NUM(BUTTON4_CLICKED));
2038
+ #endif
2039
+ #ifdef BUTTON4_DOUBLE_CLICKED
2040
+ rb_define_const(mNcurses, "BUTTON4_DOUBLE_CLICKED", INT2NUM(BUTTON4_DOUBLE_CLICKED));
2041
+ #endif
2042
+ #ifdef BUTTON4_TRIPLE_CLICKED
2043
+ rb_define_const(mNcurses, "BUTTON4_TRIPLE_CLICKED", INT2NUM(BUTTON4_TRIPLE_CLICKED));
2044
+ #endif
2045
+ #ifdef BUTTON4_RESERVED_EVENT
2046
+ rb_define_const(mNcurses, "BUTTON4_RESERVED_EVENT", INT2NUM(BUTTON4_RESERVED_EVENT));
2047
+ #endif
2048
+ #ifdef BUTTON_CTRL
2049
+ rb_define_const(mNcurses, "BUTTON_CTRL", INT2NUM(BUTTON_CTRL));
2050
+ #endif
2051
+ #ifdef BUTTON_CONTROL
2052
+ rb_define_const(mNcurses, "BUTTON_CTRL", INT2NUM(BUTTON_CONTROL));
2053
+ #endif
2054
+ rb_define_const(mNcurses, "BUTTON_SHIFT", INT2NUM(BUTTON_SHIFT));
2055
+ rb_define_const(mNcurses, "BUTTON_ALT", INT2NUM(BUTTON_ALT));
2056
+ rb_define_const(mNcurses, "ALL_MOUSE_EVENTS", INT2NUM(ALL_MOUSE_EVENTS));
2057
+ rb_define_const(mNcurses, "REPORT_MOUSE_POSITION", INT2NUM(REPORT_MOUSE_POSITION));
2058
+ }
2059
+
2060
+ /* typedef struct */
2061
+ /* { */
2062
+ /* short id; */ /* ID to distinguish multiple devices */
2063
+ /* int x, y, z; */ /* event coordinates (character-cell) */
2064
+ /* mmask_t bstate; *//* button state bits */
2065
+ /* } */
2066
+ /* MEVENT; */
2067
+ #ifdef HAVE_UNGETMOUSE
2068
+ static VALUE rbncurs_getmouse(VALUE dummy, VALUE rb_m)
2069
+ {
2070
+ MEVENT m;
2071
+ int return_value = getmouse(&m);
2072
+ if (return_value != ERR) {
2073
+ rb_iv_set(rb_m, "@id", INT2NUM(m.id));
2074
+ rb_iv_set(rb_m, "@x", INT2NUM(m.x));
2075
+ rb_iv_set(rb_m, "@y", INT2NUM(m.y));
2076
+ rb_iv_set(rb_m, "@z", INT2NUM(m.z));
2077
+ rb_iv_set(rb_m, "@bstate", INT2NUM(m.bstate));
2078
+ }
2079
+ return INT2NUM(return_value);
2080
+ }
2081
+ static VALUE rbncurs_ungetmouse(VALUE dummy, VALUE rb_m)
2082
+ {
2083
+ MEVENT m;
2084
+ m.id = NUM2INT(rb_iv_get(rb_m, "@id"));
2085
+ m.x = NUM2INT(rb_iv_get(rb_m, "@x"));
2086
+ m.y = NUM2INT(rb_iv_get(rb_m, "@y"));
2087
+ m.z = NUM2INT(rb_iv_get(rb_m, "@z"));
2088
+ m.bstate = NUM2ULONG(rb_iv_get(rb_m, "@bstate"));
2089
+ return INT2NUM(ungetmouse(&m));
2090
+ }
2091
+ #endif
2092
+ #ifdef HAVE_MOUSEMASK
2093
+ static VALUE rbncurs_mousemask(VALUE dummy, VALUE rb_newmask, VALUE rb_oldmask)
2094
+ {
2095
+ if (rb_obj_is_instance_of(rb_oldmask, rb_cArray) != Qtrue) {
2096
+ rb_raise(rb_eArgError,
2097
+ "oldmask (2nd argument) must be an empty Array");
2098
+ return Qnil;
2099
+ }
2100
+ {
2101
+ mmask_t oldmask, return_value;
2102
+ return_value = mousemask(NUM2ULONG(rb_newmask), &oldmask);
2103
+ rb_ary_push(rb_oldmask, INT2NUM(oldmask));
2104
+ return INT2NUM(return_value);
2105
+ }
2106
+ }
2107
+ #endif
2108
+ #ifdef HAVE_WENCLOSE
2109
+ static VALUE rbncurs_wenclose(VALUE dummy, VALUE rb_win, VALUE rb_y, VALUE rb_x)
2110
+ {
2111
+ return wenclose(get_window(rb_win), NUM2INT(rb_y), NUM2INT(rb_y))
2112
+ ? Qtrue : Qfalse;
2113
+ }
2114
+ #endif
2115
+ #ifdef HAVE_MOUSEINTERVAL
2116
+ static VALUE rbncurs_mouseinterval(VALUE dummy, VALUE rb_interval)
2117
+ { return INT2NUM(mouseinterval(NUM2INT(rb_interval))); }
2118
+ #endif
2119
+ #ifdef HAVE_WMOUSE_TRAFO
2120
+ static VALUE rbncurs_wmouse_trafo(VALUE dummy, VALUE rb_win, VALUE rb_pY, VALUE rb_pX,
2121
+ VALUE rb_to_screen)
2122
+ {
2123
+ if ((rb_obj_is_instance_of(rb_pY, rb_cArray) != Qtrue)
2124
+ || (rb_obj_is_instance_of(rb_pY, rb_cArray) != Qtrue)) {
2125
+ rb_raise(rb_eArgError,
2126
+ "pY and pX arguments must be Arrays, containing exactly one "
2127
+ "Integer");
2128
+ return Qnil;
2129
+ }
2130
+ {
2131
+ int X = NUM2INT(rb_ary_pop(rb_pX));
2132
+ int Y = NUM2INT(rb_ary_pop(rb_pY));
2133
+ bool return_value =
2134
+ wmouse_trafo(get_window(rb_win), &Y, &X, RTEST(rb_to_screen));
2135
+ rb_ary_push(rb_pY, INT2NUM(Y)); rb_ary_push(rb_pX, INT2NUM(X));
2136
+ return return_value ? Qtrue : Qfalse;
2137
+ }
2138
+ }
2139
+ #endif
2140
+ #ifdef HAVE_MCPRINT
2141
+ static VALUE rbncurs_mcprint(VALUE dummy, VALUE data, VALUE len)
2142
+ {
2143
+ return INT2NUM(mcprint(STR2CSTR(data), NUM2INT(len)));
2144
+ }
2145
+ #endif
2146
+ #ifdef HAVE_HAS_KEY
2147
+ static VALUE rbncurs_has_key(VALUE dummy, VALUE ch)
2148
+ {return INT2NUM(has_key(NUM2INT(ch)));}
2149
+ #endif
2150
+ static VALUE rbncurs_getyx(VALUE dummy, VALUE rb_win, VALUE rb_y, VALUE rb_x)
2151
+ {
2152
+ if ((rb_obj_is_instance_of(rb_y, rb_cArray) != Qtrue)
2153
+ || (rb_obj_is_instance_of(rb_x, rb_cArray) != Qtrue)) {
2154
+ rb_raise(rb_eArgError,
2155
+ "y and x arguments must be empty Arrays");
2156
+ return Qnil;
2157
+ }
2158
+ {
2159
+ int y,x;
2160
+ getyx(get_window(rb_win), y,x);
2161
+ rb_ary_push(rb_y, INT2NUM(y));
2162
+ rb_ary_push(rb_x, INT2NUM(x));
2163
+ return Qnil;
2164
+ }
2165
+ }
2166
+ #if defined(HAVE_GETATTRS) || defined(getattrs)
2167
+ static VALUE rbncurs_getattrs(VALUE dummy, VALUE rb_win)
2168
+ {return INT2NUM(getattrs(get_window(rb_win)));}
2169
+ #endif
2170
+ static VALUE rbncurs_getbegyx(VALUE dummy, VALUE rb_win, VALUE rb_y, VALUE rb_x)
2171
+ {
2172
+ int y,x;
2173
+ if ((rb_obj_is_instance_of(rb_y, rb_cArray) != Qtrue)
2174
+ || (rb_obj_is_instance_of(rb_x, rb_cArray) != Qtrue)) {
2175
+ rb_raise(rb_eArgError,
2176
+ "y and x arguments must be empty Arrays");
2177
+ return Qnil;
2178
+ }
2179
+ getbegyx(get_window(rb_win), y,x);
2180
+ rb_ary_push(rb_y, INT2NUM(y));
2181
+ rb_ary_push(rb_x, INT2NUM(x));
2182
+ return Qnil;
2183
+ }
2184
+ static VALUE rbncurs_getmaxyx(VALUE dummy, VALUE rb_win, VALUE rb_y, VALUE rb_x)
2185
+ {
2186
+ int y,x;
2187
+ if ((rb_obj_is_instance_of(rb_y, rb_cArray) != Qtrue)
2188
+ || (rb_obj_is_instance_of(rb_x, rb_cArray) != Qtrue)) {
2189
+ rb_raise(rb_eArgError,
2190
+ "y and x arguments must be empty Arrays");
2191
+ return Qnil;
2192
+ }
2193
+ getmaxyx(get_window(rb_win), y,x);
2194
+ rb_ary_push(rb_y, INT2NUM(y));
2195
+ rb_ary_push(rb_x, INT2NUM(x));
2196
+ return Qnil;
2197
+ }
2198
+ static VALUE rbncurs_getparyx(VALUE dummy, VALUE rb_win, VALUE rb_y, VALUE rb_x)
2199
+ {
2200
+ int y,x;
2201
+ if ((rb_obj_is_instance_of(rb_y, rb_cArray) != Qtrue)
2202
+ || (rb_obj_is_instance_of(rb_x, rb_cArray) != Qtrue)) {
2203
+ rb_raise(rb_eArgError,
2204
+ "y and x arguments must be empty Arrays");
2205
+ return Qnil;
2206
+ }
2207
+ getparyx(get_window(rb_win), y,x);
2208
+ rb_ary_push(rb_y, INT2NUM(y));
2209
+ rb_ary_push(rb_x, INT2NUM(x));
2210
+ return Qnil;
2211
+ }
2212
+ static VALUE rbncurs_getsyx(VALUE dummy, VALUE rb_y, VALUE rb_x)
2213
+ {
2214
+ int y,x;
2215
+ if ((rb_obj_is_instance_of(rb_y, rb_cArray) != Qtrue)
2216
+ || (rb_obj_is_instance_of(rb_x, rb_cArray) != Qtrue)) {
2217
+ rb_raise(rb_eArgError,
2218
+ "y and x arguments must be empty Arrays");
2219
+ return Qnil;
2220
+ }
2221
+ #ifdef getsyx
2222
+ getsyx(y,x);
2223
+ #else
2224
+ getsyx(&y,&x);
2225
+ #endif
2226
+ rb_ary_push(rb_y, INT2NUM(y));
2227
+ rb_ary_push(rb_x, INT2NUM(x));
2228
+ return Qnil;
2229
+ }
2230
+ static VALUE rbncurs_setsyx(VALUE dummy, VALUE rb_y, VALUE rb_x)
2231
+ {
2232
+ int y = NUM2INT(rb_y), x = NUM2INT(rb_x);
2233
+ setsyx(y,x);
2234
+ return Qnil;
2235
+ }
2236
+
2237
+ static VALUE rbncurs_wprintw(int argc, VALUE * argv, VALUE dummy)
2238
+ {
2239
+ if (argc < 2) {
2240
+ rb_raise(rb_eArgError, "function needs at least 2 arguments: a WINDOW"
2241
+ " and a String");
2242
+ return Qnil;
2243
+ }
2244
+ wprintw(get_window(argv[0]), "%s",
2245
+ STR2CSTR(rb_funcall3(rb_mKernel, rb_intern("sprintf"), argc-1,
2246
+ argv + 1)));
2247
+ return Qnil;
2248
+ }
2249
+
2250
+ /* Debugging : use with libncurses_g.a */
2251
+ #ifdef HAVE__TRACEF
2252
+ static VALUE rbncurs_tracef(int argc, VALUE * argv, VALUE)
2253
+ {
2254
+ if (argc < 1) {
2255
+ rb_raise(rb_eArgError, "function needs at least 1 argument");
2256
+ return Qnil;
2257
+ }
2258
+ _tracef("%s",
2259
+ STR2CSTR(funcall3(rb_mKernel, rb_intern("sprintf"), argc, argv)));
2260
+ return Qnil;
2261
+ }
2262
+ #endif /* HAVE__TRACEF */
2263
+ #ifdef HAVE__TRACEDUMP
2264
+ static VALUE rbncurs_tracedump(VALUE dummy, VALUE rb_label, label rb_win)
2265
+ {
2266
+ _tracedump(STR2CSTR(rb_label), get_window(rb_win));
2267
+ }
2268
+ #endif /* HAVE__TRACEDUMP */
2269
+ #ifdef HAVE__TRACEATTR
2270
+ static VALUE rbncurs_traceattr(VALUE dummy, VALUE attr)
2271
+ { return rb_str_new2(_traceattr(NUM2ULONG(attr))); }
2272
+ #endif /* HAVE__TRACEATTR */
2273
+ #ifdef HAVE__TRACEATTR2
2274
+ static VALUE rbncurs_traceattr2(VALUE dummy, VALUE buffer, VALUE ch)
2275
+ { return rb_str_new2(_traceattr2(NUM2INT(buffer),NUM2ULONG(ch))); }
2276
+ #endif /* HAVE__TRACEATTR2 */
2277
+ #ifdef HAVE__TRACEBITS
2278
+ static VALUE rbncurs_tracebits(VALUE dummy)
2279
+ { return rb_str_new2(_tracebits()); }
2280
+ #endif /* HAVE__TRACEBITS */
2281
+ #ifdef HAVE__TRACECHAR
2282
+ static VALUE rbncurs_tracechar(VALUE dummy, VALUE ch)
2283
+ { return rb_str_new2(_tracechar(NUM2ULONG(ch))); }
2284
+ #endif /* HAVE__TRACECHAR */
2285
+ #ifdef HAVE__TRACECHTYPE
2286
+ static VALUE rbncurs_tracechtype(VALUE dummy, VALUE ch)
2287
+ { return rb_str_new2(_tracechtype(NUM2ULONG(ch))); }
2288
+ #endif /* HAVE__TRACECHTYPE */
2289
+ #ifdef HAVE__TRACECHTYPE2
2290
+ static VALUE rbncurs_tracechtype2(VALUE dummy, VALUE buffer, VALUE ch)
2291
+ { return rb_str_new2(_tracechtype2(NUM2INT(buffer),NUM2ULONG(ch))); }
2292
+ #endif /* HAVE__TRACECHTYPE2 */
2293
+ #ifdef HAVE__TRACEMOUSE
2294
+ static VALUE rbncurs_tracemouse(VALUE dummy, VALUE rb_m)
2295
+ {
2296
+ MEVENT m;
2297
+ m.id = NUM2INT(rb_iv_get(rb_m, "@id"));
2298
+ m.x = NUM2INT(rb_iv_get(rb_m, "@x"));
2299
+ m.y = NUM2INT(rb_iv_get(rb_m, "@y"));
2300
+ m.z = NUM2INT(rb_iv_get(rb_m, "@z"));
2301
+ m.bstate = NUM2ULONG(rb_iv_get(rb_m, "@bstate"));
2302
+ return rb_str_new2(_tracemouse(&m));
2303
+ }
2304
+ #endif /* HAVE__TRACEMOUSE */
2305
+ #ifdef HAVE_TRACE
2306
+ static VALUE rbncurs_trace(VALUE dummy, VALUE param)
2307
+ { trace(NUM2ULONG(param)); return Qnil; }
2308
+ #endif /* HAVE_TRACE */
2309
+ #ifdef HAVE__NC_TRACEBITS
2310
+ static VALUE rbncurs_nc_tracebits()
2311
+ { return rb_str_new2((char*)_nc_tracebits()); }
2312
+ #endif /* HAVE__NC_TRACEBITS */
2313
+
2314
+ #ifdef HAVE_ASSUME_DEFAULT_COLORS
2315
+ static VALUE rbncurs_assume_default_colors(VALUE dummy, VALUE fg, VALUE bg)
2316
+ { return INT2NUM(assume_default_colors(NUM2INT(fg),NUM2INT(bg))); }
2317
+ #endif /* HAVE_ASSUME_DEFAULT_COLORS */
2318
+
2319
+ static void init_functions_3(void)
2320
+ {
2321
+ #ifdef HAVE_UNGETMOUSE
2322
+ NCFUNC(getmouse, 1);
2323
+ NCFUNC(ungetmouse, 1);
2324
+ #endif
2325
+ #ifdef HAVE_MOUSEMASK
2326
+ NCFUNC(mousemask, 1);
2327
+ #endif
2328
+ #ifdef HAVE_WENCLOSE
2329
+ rb_define_module_function(mNcurses, "wenclose?",
2330
+ (&rbncurs_wenclose),
2331
+ 1);
2332
+ #endif
2333
+ #ifdef HAVE_MOUSEINTERVAL
2334
+ NCFUNC(mouseinterval, 1);
2335
+ #endif
2336
+ #ifdef HAVE_WMOUSE_TRAFO
2337
+ NCFUNC(wmouse_trafo, 4);
2338
+ #endif
2339
+ #ifdef HAVE_MCPRINT
2340
+ NCFUNC(mcprint, 2);
2341
+ #endif
2342
+ #ifdef HAVE_HAS_KEY
2343
+ rb_define_module_function(mNcurses, "has_key?",
2344
+ (&rbncurs_has_key),
2345
+ 2);
2346
+ #endif
2347
+ NCFUNC(getyx, 3);
2348
+ NCFUNC(getbegyx, 3);
2349
+ NCFUNC(getmaxyx, 3);
2350
+ NCFUNC(getparyx, 3);
2351
+ NCFUNC(getsyx, 2);
2352
+ NCFUNC(setsyx, 2);
2353
+ #if defined(HAVE_GETATTRS) || defined(getattrs)
2354
+ NCFUNC(getattrs, 1);
2355
+ #endif
2356
+ #ifdef HAVE__TRACEF
2357
+ rb_define_module_function(mNcurses, "_tracef",
2358
+ (&rbncurs_tracef), -1);
2359
+ #endif /* HAVE__TRACEF */
2360
+ #ifdef HAVE__TRACEDUMP
2361
+ rb_define_module_function(mNcurses, "_tracedump",
2362
+ (&rbncurs_tracedump),
2363
+ 2);
2364
+ #endif /* HAVE__TRACEDUMP */
2365
+ #ifdef HAVE__TRACEATTR
2366
+ rb_define_module_function(mNcurses, "_traceattr",
2367
+ (&rbncurs_traceattr),
2368
+ 1);
2369
+ #endif /* HAVE__TRACEATTR */
2370
+ #ifdef HAVE__TRACEATTR2
2371
+ rb_define_module_function(mNcurses, "_traceattr2",
2372
+ (&rbncurs_traceattr2),
2373
+ 2);
2374
+ #endif /* HAVE__TRACEATTR2 */
2375
+ #ifdef HAVE__TRACEBITS
2376
+ rb_define_module_function(mNcurses, "_tracebits",
2377
+ (&rbncurs_tracebits),
2378
+ 0);
2379
+ #endif /* HAVE__TRACEBITS */
2380
+ #ifdef HAVE__TRACECHAR
2381
+ rb_define_module_function(mNcurses, "_tracechar",
2382
+ (&rbncurs_tracechar),
2383
+ 1);
2384
+ #endif /* HAVE__TRACECHAR */
2385
+ #ifdef HAVE__TRACECHTYPE
2386
+ rb_define_module_function(mNcurses, "_tracechtype",
2387
+ (&rbncurs_tracechtype),
2388
+ 1);
2389
+ #endif /* HAVE__TRACECHTYPE */
2390
+ #ifdef HAVE__TRACECHTYPE2
2391
+ rb_define_module_function(mNcurses, "_tracechtype2",
2392
+ (&rbncurs_tracechtype2), 2);
2393
+ #endif /* HAVE__TRACECHTYPE2 */
2394
+ #ifdef HAVE__TRACEMOUSE
2395
+ rb_define_module_function(mNcurses, "_tracechmouse",
2396
+ (&rbncurs_tracemouse),
2397
+ 1);
2398
+ #endif /* HAVE__TRACEMOUSE */
2399
+ #ifdef HAVE_TRACE
2400
+ NCFUNC(trace, 1);
2401
+ #endif /* HAVE_TRACE */
2402
+ #ifdef HAVE__NC_TRACEBITS
2403
+ rb_define_module_function(mNcurses, "_nc_tracebits", &rbncurs_nc_tracebits, 0);
2404
+ #endif /* HAVE__NC_TRACEBITS */
2405
+ #ifdef HAVE_ASSUME_DEFAULT_COLORS
2406
+ NCFUNC(assume_default_colors, 2);
2407
+ #endif /* HAVE_ASSUME_DEFAULT_COLORS */
2408
+ NCFUNC(wprintw, -1);
2409
+ }
2410
+
2411
+ static void init_constants_4(void)
2412
+ {
2413
+ /* trace masks */
2414
+ #ifdef TRACE_DISABLE
2415
+ rb_define_const(mNcurses, "TRACE_DISABLE", INT2NUM(TRACE_DISABLE));
2416
+ #endif
2417
+ #ifdef TRACE_TIMES
2418
+ rb_define_const(mNcurses, "TRACE_TIMES", INT2NUM(TRACE_TIMES));
2419
+ #endif
2420
+ #ifdef TRACE_TPUTS
2421
+ rb_define_const(mNcurses, "TRACE_TPUTS", INT2NUM(TRACE_TPUTS));
2422
+ #endif
2423
+ #ifdef TRACE_UPDATE
2424
+ rb_define_const(mNcurses, "TRACE_UPDATE", INT2NUM(TRACE_UPDATE));
2425
+ #endif
2426
+ #ifdef TRACE_MOVE
2427
+ rb_define_const(mNcurses, "TRACE_MOVE", INT2NUM(TRACE_MOVE));
2428
+ #endif
2429
+ #ifdef TRACE_CHARPUT
2430
+ rb_define_const(mNcurses, "TRACE_CHARPUT", INT2NUM(TRACE_CHARPUT));
2431
+ #endif
2432
+ #ifdef TRACE_ORDINARY
2433
+ rb_define_const(mNcurses, "TRACE_ORDINARY", INT2NUM(TRACE_ORDINARY));
2434
+ #endif
2435
+ #ifdef TRACE_CALLS
2436
+ rb_define_const(mNcurses, "TRACE_CALLS", INT2NUM(TRACE_CALLS));
2437
+ #endif
2438
+ #ifdef TRACE_VIRTPUT
2439
+ rb_define_const(mNcurses, "TRACE_VIRTPUT", INT2NUM(TRACE_VIRTPUT));
2440
+ #endif
2441
+ #ifdef TRACE_IEVENT
2442
+ rb_define_const(mNcurses, "TRACE_IEVENT", INT2NUM(TRACE_IEVENT));
2443
+ #endif
2444
+ #ifdef TRACE_BITS
2445
+ rb_define_const(mNcurses, "TRACE_BITS", INT2NUM(TRACE_BITS));
2446
+ #endif
2447
+ #ifdef TRACE_ICALLS
2448
+ rb_define_const(mNcurses, "TRACE_ICALLS", INT2NUM(TRACE_ICALLS));
2449
+ #endif
2450
+ #ifdef TRACE_CCALLS
2451
+ rb_define_const(mNcurses, "TRACE_CCALLS", INT2NUM(TRACE_CCALLS));
2452
+ #endif
2453
+ #ifdef TRACE_MAXIMUM
2454
+ rb_define_const(mNcurses, "TRACE_MAXIMUM", INT2NUM(TRACE_MAXIMUM));
2455
+ #endif
2456
+ }
2457
+
2458
+ /* Wrap ACS_* constants (additionally) as methods of SCREEN: */
2459
+ #define rb_ACS(ACS) \
2460
+ VALUE rb_## ACS (VALUE rb_screen) \
2461
+ { \
2462
+ SCREEN * c_screen = get_screen(rb_screen); \
2463
+ SCREEN * current_screen = set_term(c_screen); \
2464
+ VALUE rb_ACS_CONST = INT2NUM(ACS); \
2465
+ set_term(current_screen); \
2466
+ return rb_ACS_CONST; \
2467
+ }
2468
+ #define wrap_ACS(ACS) \
2469
+ rb_define_method(cSCREEN, #ACS, \
2470
+ (&rb_ ## ACS), \
2471
+ 0)
2472
+ rb_ACS(ACS_ULCORNER)
2473
+ rb_ACS(ACS_LLCORNER)
2474
+ rb_ACS(ACS_URCORNER)
2475
+ rb_ACS(ACS_LRCORNER)
2476
+ rb_ACS(ACS_LTEE)
2477
+ rb_ACS(ACS_RTEE)
2478
+ rb_ACS(ACS_BTEE)
2479
+ rb_ACS(ACS_TTEE)
2480
+ rb_ACS(ACS_HLINE)
2481
+ rb_ACS(ACS_VLINE)
2482
+ rb_ACS(ACS_PLUS)
2483
+ rb_ACS(ACS_S1)
2484
+ rb_ACS(ACS_S9)
2485
+ rb_ACS(ACS_DIAMOND)
2486
+ rb_ACS(ACS_CKBOARD)
2487
+ rb_ACS(ACS_DEGREE)
2488
+ rb_ACS(ACS_PLMINUS)
2489
+ rb_ACS(ACS_BULLET)
2490
+ rb_ACS(ACS_LARROW)
2491
+ rb_ACS(ACS_RARROW)
2492
+ rb_ACS(ACS_DARROW)
2493
+ rb_ACS(ACS_UARROW)
2494
+ rb_ACS(ACS_BOARD)
2495
+ rb_ACS(ACS_LANTERN)
2496
+ rb_ACS(ACS_BLOCK)
2497
+ #ifdef ACS_S3
2498
+ rb_ACS(ACS_S3)
2499
+ #endif
2500
+ #ifdef ACS_S7
2501
+ rb_ACS(ACS_S7)
2502
+ #endif
2503
+ #ifdef ACS_LEQUAL
2504
+ rb_ACS(ACS_LEQUAL)
2505
+ #endif
2506
+ #ifdef ACS_GEQUAL
2507
+ rb_ACS(ACS_GEQUAL)
2508
+ #endif
2509
+ #ifdef ACS_PI
2510
+ rb_ACS(ACS_PI)
2511
+ #endif
2512
+ #ifdef ACS_NEQUAL
2513
+ rb_ACS(ACS_NEQUAL)
2514
+ #endif
2515
+ #ifdef ACS_STERLING
2516
+ rb_ACS(ACS_STERLING)
2517
+ #endif
2518
+
2519
+ void init_SCREEN_methods(void)
2520
+ {
2521
+ wrap_ACS(ACS_ULCORNER);
2522
+ wrap_ACS(ACS_LLCORNER);
2523
+ wrap_ACS(ACS_URCORNER);
2524
+ wrap_ACS(ACS_LRCORNER);
2525
+ wrap_ACS(ACS_LTEE);
2526
+ wrap_ACS(ACS_RTEE);
2527
+ wrap_ACS(ACS_BTEE);
2528
+ wrap_ACS(ACS_TTEE);
2529
+ wrap_ACS(ACS_HLINE);
2530
+ wrap_ACS(ACS_VLINE);
2531
+ wrap_ACS(ACS_PLUS);
2532
+ wrap_ACS(ACS_S1);
2533
+ wrap_ACS(ACS_S9);
2534
+ wrap_ACS(ACS_DIAMOND);
2535
+ wrap_ACS(ACS_CKBOARD);
2536
+ wrap_ACS(ACS_DEGREE);
2537
+ wrap_ACS(ACS_PLMINUS);
2538
+ wrap_ACS(ACS_BULLET);
2539
+ wrap_ACS(ACS_LARROW);
2540
+ wrap_ACS(ACS_RARROW);
2541
+ wrap_ACS(ACS_DARROW);
2542
+ wrap_ACS(ACS_UARROW);
2543
+ wrap_ACS(ACS_BOARD);
2544
+ wrap_ACS(ACS_LANTERN);
2545
+ wrap_ACS(ACS_BLOCK);
2546
+ #ifdef ACS_S3
2547
+ wrap_ACS(ACS_S3);
2548
+ #endif
2549
+ #ifdef ACS_S7
2550
+ wrap_ACS(ACS_S7);
2551
+ #endif
2552
+ #ifdef ACS_LEQUAL
2553
+ wrap_ACS(ACS_LEQUAL);
2554
+ #endif
2555
+ #ifdef ACS_GEQUAL
2556
+ wrap_ACS(ACS_GEQUAL);
2557
+ #endif
2558
+ #ifdef ACS_PI
2559
+ wrap_ACS(ACS_PI);
2560
+ #endif
2561
+ #ifdef ACS_NEQUAL
2562
+ wrap_ACS(ACS_NEQUAL);
2563
+ #endif
2564
+ #ifdef ACS_STERLING
2565
+ wrap_ACS(ACS_STERLING);
2566
+ #endif
2567
+ }
2568
+
2569
+ static void init_safe_functions(void)
2570
+ {
2571
+ NCFUNC(initscr, 0);
2572
+ NCFUNC(newterm, 3);
2573
+ NCFUNC(slk_init, 1);
2574
+ #ifdef HAVE_FILTER
2575
+ NCFUNC(filter, 0);
2576
+ #endif
2577
+ #ifdef HAVE_USE_ENV
2578
+ NCFUNC(use_env, 1);
2579
+ #endif
2580
+ }
2581
+ void Init_ncurses(void)
2582
+ {
2583
+ mNcurses = rb_define_module("Ncurses");
2584
+ eNcurses = rb_define_class_under(mNcurses, "Exception", rb_eRuntimeError);
2585
+ rb_iv_set(mNcurses, "@windows_hash", rb_hash_new());
2586
+ rb_iv_set(mNcurses, "@screens_hash", rb_hash_new());
2587
+ cWINDOW = rb_define_class_under(mNcurses, "WINDOW", rb_cObject);
2588
+ cSCREEN = rb_define_class_under(mNcurses, "SCREEN", rb_cObject);
2589
+ init_constants_1();
2590
+ init_constants_2();
2591
+ init_constants_3();
2592
+ init_constants_4();
2593
+ init_safe_functions();
2594
+ }
2595
+ static void Init_ncurses_full(void)
2596
+ {
2597
+ init_globals_1();
2598
+ init_globals_2();
2599
+ init_functions_0();
2600
+ init_functions_1();
2601
+ init_functions_2();
2602
+ init_functions_3();
2603
+
2604
+ init_SCREEN_methods();
2605
+ #ifdef HAVE_PANEL_H
2606
+ init_panel();
2607
+ #endif
2608
+ #ifdef HAVE_FORM_H
2609
+ init_form();
2610
+ #endif
2611
+ }