ncursesw 1.4.11 → 1.4.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Changes +6 -0
- data/extconf.rb +0 -8
- data/ncurses_wrap.c +41 -36
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8754a10870f91ce6c48d2482fb10d990f0a0429653fa9f5a7bb28f7a077e9608
|
4
|
+
data.tar.gz: 108f8b3f906c2e1355354633acccaed824a1dd70dc1d770f049150f8bf7ea0e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 762a8a786de43dea665fbecb8a936089d64a84ec20ece8ead5d8d116c93d68f8db88f63814700b813d5348bd37b2e168f1588cd80186afaaec7d5d100cb267c4
|
7
|
+
data.tar.gz: df600969cf72cdb85a4691464aaa0520755acc8dd3f1aa9916c8c013805d20893deb49c3b867ad623dc766d4fd0fddf807f32880eb50222586e05037c3d9a4b7
|
data/Changes
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
ncurses-ruby-1.4.13
|
2
|
+
* Fixed compilation errors under C23 due to unprototyped functions.
|
3
|
+
|
4
|
+
ncurses-ruby-1.4.12
|
5
|
+
* Fixed getch non-blocking behaviour with NCURSES_OPAQUE.
|
6
|
+
|
1
7
|
ncurses-ruby-1.4.11
|
2
8
|
* Fixed some incorrectly declared method arguments.
|
3
9
|
* Fixed warnings about "undefining the allocator of T_DATA class".
|
data/extconf.rb
CHANGED
@@ -174,14 +174,6 @@ if have_func("rb_thread_fd_select")
|
|
174
174
|
$CFLAGS += " -DHAVE_RB_THREAD_FD_SELECT"
|
175
175
|
end
|
176
176
|
|
177
|
-
# Avoid dereferencing WINDOW pointers on FreeBSD
|
178
|
-
if RUBY_PLATFORM =~ /freebsd/
|
179
|
-
$CFLAGS += " -DNCURSES_OPAQUE=1"
|
180
|
-
else
|
181
|
-
# add NCURSES_OPAQUE for mac
|
182
|
-
$CFLAGS += " -DNCURSES_OPAQUE=0"
|
183
|
-
end
|
184
|
-
|
185
177
|
if have_func("clock_gettime")
|
186
178
|
$CFLAGS += " -DHAVE_CLOCK_GETTIME"
|
187
179
|
end
|
data/ncurses_wrap.c
CHANGED
@@ -146,9 +146,9 @@ init_constants_1(void)
|
|
146
146
|
#endif
|
147
147
|
}
|
148
148
|
|
149
|
-
static VALUE rbncurs_COLORS()
|
149
|
+
static VALUE rbncurs_COLORS(VALUE dummy)
|
150
150
|
{return INT2NUM(COLORS);}
|
151
|
-
static VALUE rbncurs_COLOR_PAIRS()
|
151
|
+
static VALUE rbncurs_COLOR_PAIRS(VALUE dummy)
|
152
152
|
{return INT2NUM(COLOR_PAIRS);}
|
153
153
|
|
154
154
|
static
|
@@ -233,6 +233,7 @@ VALUE wrap_window(WINDOW* window)
|
|
233
233
|
if (rb_window == Qnil) {
|
234
234
|
rb_window = Data_Wrap_Struct(cWINDOW, 0, 0, window);
|
235
235
|
rb_iv_set(rb_window, "@destroyed", Qfalse);
|
236
|
+
rb_iv_set(rb_window, "@timeout", INT2FIX(-1));
|
236
237
|
rb_hash_aset(windows_hash, window_adress, rb_window);
|
237
238
|
}
|
238
239
|
return rb_window;
|
@@ -370,7 +371,7 @@ init_functions_0(void)
|
|
370
371
|
NCFUNC(wgetnstr, 3);
|
371
372
|
}
|
372
373
|
|
373
|
-
static VALUE get_stdscr()
|
374
|
+
static VALUE get_stdscr(VALUE dummy)
|
374
375
|
{
|
375
376
|
VALUE rb_stdscr = rb_iv_get(mNcurses, "@stdscr");
|
376
377
|
if (rb_stdscr == Qnil) {
|
@@ -379,7 +380,7 @@ static VALUE get_stdscr()
|
|
379
380
|
}
|
380
381
|
return rb_stdscr;
|
381
382
|
}
|
382
|
-
static VALUE get_curscr()
|
383
|
+
static VALUE get_curscr(VALUE dummy)
|
383
384
|
{
|
384
385
|
VALUE rb_curscr = rb_iv_get(mNcurses, "@curscr");
|
385
386
|
if (rb_curscr == Qnil) {
|
@@ -389,7 +390,7 @@ static VALUE get_curscr()
|
|
389
390
|
return rb_curscr;
|
390
391
|
}
|
391
392
|
#ifdef HAVE_NEWSCR
|
392
|
-
static VALUE get_newscr()
|
393
|
+
static VALUE get_newscr(VALUE dummy)
|
393
394
|
{
|
394
395
|
VALUE rb_newscr = rb_iv_get(mNcurses, "@newscr");
|
395
396
|
if (rb_newscr == Qnil) {
|
@@ -399,15 +400,15 @@ static VALUE get_newscr()
|
|
399
400
|
return rb_newscr;
|
400
401
|
}
|
401
402
|
#endif
|
402
|
-
static VALUE get_LINES() {return INT2NUM(LINES);}
|
403
|
-
static VALUE get_COLS() {return INT2NUM(COLS);}
|
403
|
+
static VALUE get_LINES(VALUE dummy) {return INT2NUM(LINES);}
|
404
|
+
static VALUE get_COLS(VALUE dummy) {return INT2NUM(COLS);}
|
404
405
|
#ifdef HAVE_TABSIZE
|
405
|
-
static VALUE get_TABSIZE() {return INT2NUM(TABSIZE);}
|
406
|
+
static VALUE get_TABSIZE(VALUE dummy) {return INT2NUM(TABSIZE);}
|
406
407
|
#endif
|
407
408
|
#ifdef HAVE_ESCDELAY
|
408
409
|
/* This global was an undocumented feature under AIX curses. */
|
409
410
|
/* ESC expire time in milliseconds */
|
410
|
-
static VALUE get_ESCDELAY(){return INT2NUM(ESCDELAY);}
|
411
|
+
static VALUE get_ESCDELAY(VALUE dummy){return INT2NUM(ESCDELAY);}
|
411
412
|
static VALUE set_ESCDELAY(VALUE dummy, VALUE new_delay)
|
412
413
|
{
|
413
414
|
ESCDELAY=NUM2INT(new_delay);
|
@@ -418,7 +419,7 @@ static VALUE set_ESCDELAY(VALUE dummy, VALUE new_delay)
|
|
418
419
|
/* This global is wrapper-specific. It denotes the interval after which the
|
419
420
|
terminal is periodically checked for having resized or not. */
|
420
421
|
/* time in milliseconds */
|
421
|
-
static VALUE get_RESIZEDELAY(){return rb_iv_get(mNcurses, "@resize_delay");}
|
422
|
+
static VALUE get_RESIZEDELAY(VALUE dummy){return rb_iv_get(mNcurses, "@resize_delay");}
|
422
423
|
static VALUE set_RESIZEDELAY(VALUE dummy, VALUE rb_new_delay)
|
423
424
|
{
|
424
425
|
int c_new_delay = NUM2INT(rb_new_delay);
|
@@ -479,7 +480,7 @@ static VALUE rbncurs_keybound(VALUE dummy, VALUE keycode, VALUE count)
|
|
479
480
|
}
|
480
481
|
#endif
|
481
482
|
#ifdef HAVE_CURSES_VERSION
|
482
|
-
static VALUE rbncurs_curses_version(){return rb_str_new2(curses_version());}
|
483
|
+
static VALUE rbncurs_curses_version(VALUE dummy){return rb_str_new2(curses_version());}
|
483
484
|
#endif
|
484
485
|
#ifdef HAVE_DEFINE_KEY
|
485
486
|
static VALUE rbncurs_define_key(VALUE dummy, VALUE definition, VALUE keycode)
|
@@ -503,7 +504,7 @@ static VALUE rbncurs_resizeterm(VALUE dummy, VALUE lines, VALUE columns)
|
|
503
504
|
}
|
504
505
|
#endif
|
505
506
|
#ifdef HAVE_USE_DEFAULT_COLORS
|
506
|
-
static VALUE rbncurs_use_default_colors()
|
507
|
+
static VALUE rbncurs_use_default_colors(VALUE dummy)
|
507
508
|
{
|
508
509
|
return INT2NUM(use_default_colors());
|
509
510
|
}
|
@@ -838,22 +839,17 @@ static VALUE rbncurs_getbkgd(VALUE dummy, VALUE arg1) {
|
|
838
839
|
typedef int (*wgetch_func) (WINDOW *);
|
839
840
|
|
840
841
|
/* functor for getting a char nonblocking, pass getchar function */
|
841
|
-
static int rbncurshelper_do_wgetch_functor (WINDOW *c_win, wgetch_func _wgetch_func) {
|
842
|
+
static int rbncurshelper_do_wgetch_functor (WINDOW *c_win, wgetch_func _wgetch_func, int windelay) {
|
842
843
|
/* nonblocking wgetch only implemented for Ncurses */
|
843
844
|
int halfdelay = NUM2INT(rb_iv_get(mNcurses, "@halfdelay"));
|
844
845
|
int infd = NUM2INT(rb_iv_get(mNcurses, "@infd"));
|
845
846
|
double screen_delay = halfdelay * 0.1;
|
846
|
-
#if defined(NCURSES_VERSION) && defined(NCURSES_OPAQUE) && !NCURSES_OPAQUE
|
847
|
-
int windelay = c_win->_delay;
|
848
|
-
#else
|
849
|
-
int windelay = 0;
|
850
|
-
#endif
|
851
847
|
double window_delay = (windelay >= 0) ? 0.001 * windelay : (1e200*1e200);
|
852
848
|
/* FIXME: ^ Infinity ^*/
|
853
849
|
double delay = (screen_delay > 0) ? screen_delay : window_delay;
|
854
850
|
int result;
|
855
851
|
double starttime, nowtime, finishtime;
|
856
|
-
double resize_delay = NUM2INT(get_RESIZEDELAY()) / 1000.0;
|
852
|
+
double resize_delay = NUM2INT(get_RESIZEDELAY(mNcurses)) / 1000.0;
|
857
853
|
fd_set in_fds;
|
858
854
|
#ifdef HAVE_CLOCK_GETTIME
|
859
855
|
struct timespec tv;
|
@@ -867,9 +863,7 @@ static int rbncurshelper_do_wgetch_functor (WINDOW *c_win, wgetch_func _wgetch_f
|
|
867
863
|
starttime = tv.tv_sec + tv.tv_usec * 1e-6;
|
868
864
|
#endif
|
869
865
|
finishtime = starttime + delay;
|
870
|
-
|
871
|
-
c_win->_delay = 0;
|
872
|
-
#endif
|
866
|
+
wtimeout(c_win, 0);
|
873
867
|
while (doupdate() /* detects resize */, (result = _wgetch_func(c_win)) == ERR) {
|
874
868
|
#ifdef HAVE_RB_THREAD_FD_SELECT
|
875
869
|
rb_fdset_t fdsets[3];
|
@@ -922,15 +916,13 @@ static int rbncurshelper_do_wgetch_functor (WINDOW *c_win, wgetch_func _wgetch_f
|
|
922
916
|
#endif
|
923
917
|
#endif
|
924
918
|
}
|
925
|
-
|
926
|
-
c_win->_delay = windelay;
|
927
|
-
#endif
|
919
|
+
wtimeout(c_win, windelay);
|
928
920
|
return result;
|
929
921
|
}
|
930
922
|
|
931
923
|
/* non-wide char getch */
|
932
|
-
static int rbncurshelper_nonblocking_wgetch(WINDOW *c_win) {
|
933
|
-
return rbncurshelper_do_wgetch_functor (c_win, &wgetch);
|
924
|
+
static int rbncurshelper_nonblocking_wgetch(WINDOW *c_win, int windelay) {
|
925
|
+
return rbncurshelper_do_wgetch_functor (c_win, &wgetch, windelay);
|
934
926
|
}
|
935
927
|
|
936
928
|
#ifdef HAVE_GET_WCH
|
@@ -942,20 +934,22 @@ static int my_wget_wch (WINDOW *c_win) {
|
|
942
934
|
|
943
935
|
/* return array with first element being return key code status,
|
944
936
|
* and second element the key code */
|
945
|
-
static VALUE rbncurshelper_nonblocking_wget_wch(WINDOW *c_win) {
|
946
|
-
int retcode = rbncurshelper_do_wgetch_functor (c_win, &my_wget_wch);
|
937
|
+
static VALUE rbncurshelper_nonblocking_wget_wch(WINDOW *c_win, int windelay) {
|
938
|
+
int retcode = rbncurshelper_do_wgetch_functor (c_win, &my_wget_wch, windelay);
|
947
939
|
VALUE r = rb_assoc_new (INT2NUM(retcode), LONG2NUM(wget_wch_back));
|
948
940
|
return r;
|
949
941
|
}
|
950
942
|
#endif
|
951
943
|
|
952
944
|
static VALUE rbncurs_getch(VALUE dummy) {
|
953
|
-
|
945
|
+
int windelay = NUM2INT(rb_iv_get(get_stdscr(dummy), "@timeout"));
|
946
|
+
return INT2NUM(rbncurshelper_nonblocking_wgetch(stdscr, windelay));
|
954
947
|
}
|
955
948
|
|
956
949
|
#ifdef HAVE_GET_WCH
|
957
950
|
static VALUE rbncurs_get_wch(VALUE dummy) {
|
958
|
-
|
951
|
+
int windelay = NUM2INT(rb_iv_get(get_stdscr(dummy), "@timeout"));
|
952
|
+
return rbncurshelper_nonblocking_wget_wch(stdscr, windelay);
|
959
953
|
}
|
960
954
|
#endif
|
961
955
|
|
@@ -1191,9 +1185,10 @@ static VALUE rbncurs_mvderwin(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
|
|
1191
1185
|
return INT2NUM(mvderwin(get_window(arg1), NUM2INT(arg2), NUM2INT(arg3)));
|
1192
1186
|
}
|
1193
1187
|
static VALUE rbncurs_mvgetch(VALUE dummy, VALUE arg1, VALUE arg2) {
|
1188
|
+
int windelay = NUM2INT(rb_iv_get(get_stdscr(dummy), "@timeout"));
|
1194
1189
|
if (wmove(stdscr, NUM2INT(arg1), NUM2INT(arg2)) == ERR)
|
1195
1190
|
return INT2NUM(ERR);
|
1196
|
-
return INT2NUM(rbncurshelper_nonblocking_wgetch(stdscr));
|
1191
|
+
return INT2NUM(rbncurshelper_nonblocking_wgetch(stdscr, windelay));
|
1197
1192
|
}
|
1198
1193
|
#ifdef HAVE_MVHLINE
|
1199
1194
|
static VALUE rbncurs_mvhline(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4) {
|
@@ -1253,9 +1248,10 @@ static VALUE rbncurs_mvwdelch(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
|
|
1253
1248
|
}
|
1254
1249
|
static VALUE rbncurs_mvwgetch(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3) {
|
1255
1250
|
WINDOW * c_win = get_window(arg1);
|
1251
|
+
int windelay = NUM2INT(rb_iv_get(arg1, "@timeout"));
|
1256
1252
|
if (wmove(c_win, NUM2INT(arg1), NUM2INT(arg2)) == ERR)
|
1257
1253
|
return INT2NUM(ERR);
|
1258
|
-
return INT2NUM(rbncurshelper_nonblocking_wgetch(c_win));
|
1254
|
+
return INT2NUM(rbncurshelper_nonblocking_wgetch(c_win, windelay));
|
1259
1255
|
}
|
1260
1256
|
#ifdef HAVE_MVWHLINE
|
1261
1257
|
static VALUE rbncurs_mvwhline(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4, VALUE arg5) {
|
@@ -1298,7 +1294,12 @@ static VALUE rbncurs_nocbreak(VALUE dummy) {
|
|
1298
1294
|
return INT2NUM(rbncurshelper_halfdelay_cbreak(0, 0));
|
1299
1295
|
}
|
1300
1296
|
static VALUE rbncurs_nodelay(VALUE dummy, VALUE arg1, VALUE arg2) {
|
1301
|
-
|
1297
|
+
bool flag = RTEST(arg2);
|
1298
|
+
int return_value = nodelay(get_window(arg1), flag);
|
1299
|
+
if (return_value != ERR) {
|
1300
|
+
rb_iv_set(arg1, "@timeout", INT2FIX(flag ? 0 : -1));
|
1301
|
+
}
|
1302
|
+
return INT2NUM(return_value);
|
1302
1303
|
}
|
1303
1304
|
static VALUE rbncurs_noecho(VALUE dummy) {
|
1304
1305
|
return INT2NUM(noecho());
|
@@ -1498,6 +1499,7 @@ static VALUE rbncurs_tigetstr(VALUE dummy, VALUE arg1) {
|
|
1498
1499
|
}
|
1499
1500
|
#endif
|
1500
1501
|
static VALUE rbncurs_timeout(VALUE dummy, VALUE arg1) {
|
1502
|
+
rb_iv_set(get_stdscr(dummy), "@timeout", arg1);
|
1501
1503
|
return ((timeout(NUM2INT(arg1))),Qnil);
|
1502
1504
|
}
|
1503
1505
|
static VALUE rbncurs_typeahead(VALUE dummy, VALUE arg1) {
|
@@ -1603,12 +1605,14 @@ static VALUE rbncurs_werase(VALUE dummy, VALUE arg1) {
|
|
1603
1605
|
return INT2NUM(werase(get_window(arg1)));
|
1604
1606
|
}
|
1605
1607
|
static VALUE rbncurs_wgetch(VALUE dummy, VALUE arg1) {
|
1606
|
-
|
1608
|
+
int windelay = NUM2INT(rb_iv_get(arg1, "@timeout"));
|
1609
|
+
return INT2NUM(rbncurshelper_nonblocking_wgetch(get_window(arg1), windelay));
|
1607
1610
|
}
|
1608
1611
|
|
1609
1612
|
#ifdef HAVE_GET_WCH
|
1610
1613
|
static VALUE rbncurs_wget_wch(VALUE dummy, VALUE arg1) {
|
1611
|
-
|
1614
|
+
int windelay = NUM2INT(rb_iv_get(arg1, "@timeout"));
|
1615
|
+
return rbncurshelper_nonblocking_wget_wch(get_window(arg1), windelay);
|
1612
1616
|
}
|
1613
1617
|
#endif
|
1614
1618
|
|
@@ -1664,6 +1668,7 @@ static VALUE rbncurs_wsyncup(VALUE dummy, VALUE arg1) {
|
|
1664
1668
|
return ((wsyncup(get_window(arg1))),Qnil);
|
1665
1669
|
}
|
1666
1670
|
static VALUE rbncurs_wtimeout(VALUE dummy, VALUE arg1, VALUE arg2) {
|
1671
|
+
rb_iv_set(arg1, "@timeout", arg2);
|
1667
1672
|
return ((wtimeout(get_window(arg1), NUM2INT(arg2))),Qnil);
|
1668
1673
|
}
|
1669
1674
|
static VALUE rbncurs_wtouchln(VALUE dummy, VALUE arg1, VALUE arg2, VALUE arg3, VALUE arg4) {
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ncursesw
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Herzke
|
@@ -65,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
65
65
|
- !ruby/object:Gem::Version
|
66
66
|
version: '0'
|
67
67
|
requirements: []
|
68
|
-
rubygems_version: 3.
|
68
|
+
rubygems_version: 3.5.22
|
69
69
|
signing_key:
|
70
70
|
specification_version: 4
|
71
71
|
summary: 'This wrapper provides access to the functions, macros, global variables
|