newt 1.0.0 → 1.1.0
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/README.rdoc +3 -0
- data/ext/ruby_newt/extconf.rb +3 -5
- data/ext/ruby_newt/ruby_newt.c +23 -13
- data/lib/version.rb +1 -1
- metadata +3 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6d74c8224a4919f10b076b957c6c8b4d8fcac75f39eb5a3801c0a978ab565a7d
|
|
4
|
+
data.tar.gz: 274ae70768b83ba67614914b8a6d67d2d73baf432895d0e0a620d61a474f6712
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 80e5b0a82a5b572a0ffb4be71951cc60596ce558f29fffb563d20e8a1b6ec565d2a55686ff2aaecd4689cb249c673672e622914af49f4d32dc9ccf430426419b
|
|
7
|
+
data.tar.gz: 5644260058bc1099b4e6b4484f273781378963546e3504c82427320df83f7ad07a808095ec5d90250b0413c1296cd3f5a184c48537241559241f3010208fad6a
|
data/README.rdoc
CHANGED
|
@@ -29,6 +29,9 @@ See http://github.com/theforeman/ruby-newt/tree/master/examples for usage exampl
|
|
|
29
29
|
|
|
30
30
|
=== Development
|
|
31
31
|
|
|
32
|
+
Set +BUNDLE_PATH+ and +GEM_HOME+ to a location under <tt>$HOME</tt> to enable
|
|
33
|
+
unprivileged installs. <tt>$HOME/.local/share/gem</tt> is a common location.
|
|
34
|
+
|
|
32
35
|
$ bundle install
|
|
33
36
|
$ bundle exec rake compile
|
|
34
37
|
$ bundle exec rake test
|
data/ext/ruby_newt/extconf.rb
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
require 'mkmf'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
have_library('slang', 'SLsmg_refresh')
|
|
7
|
-
have_library('newt', 'newtInit')
|
|
3
|
+
pkg_config('slang')
|
|
4
|
+
pkg_config('libnewt')
|
|
8
5
|
|
|
9
6
|
append_cflags(ENV['CFLAGS'])
|
|
10
7
|
append_ldflags(ENV['LDFLAGS'])
|
|
8
|
+
|
|
11
9
|
create_makefile('ruby_newt/ruby_newt')
|
data/ext/ruby_newt/ruby_newt.c
CHANGED
|
@@ -38,10 +38,10 @@ static struct newtColors newtColors;
|
|
|
38
38
|
#define IVAR_DATA (rb_intern("newt_ivar_data"))
|
|
39
39
|
#define IVAR_COLS (rb_intern("newt_ivar_cols"))
|
|
40
40
|
#define IVAR_ROWS (rb_intern("newt_ivar_rows"))
|
|
41
|
-
#define IVAR_FILTER_CALLBACK (rb_intern("newt_ivar_filter_callback"))
|
|
42
41
|
#define CVAR_SUSPEND_CALLBACK (rb_intern("newt_cvar_suspend_callback"))
|
|
43
42
|
#define CVAR_HELP_CALLBACK (rb_intern("newt_cvar_help_callback"))
|
|
44
|
-
#define
|
|
43
|
+
#define IVAR_FILTER_CALLBACK (rb_intern("newt_ivar_filter_callback"))
|
|
44
|
+
#define IVAR_WIDGET_CALLBACK (rb_intern("newt_ivar_widget_callback"))
|
|
45
45
|
|
|
46
46
|
#define ARG_ERROR(given, expected) \
|
|
47
47
|
rb_raise(rb_eArgError, "wrong number of arguments (given %d, expected %s)", \
|
|
@@ -121,6 +121,13 @@ static inline Widget_data *widget_data_get(VALUE self)
|
|
|
121
121
|
return data;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
+
NORETURN(static VALUE newt_s_alloc(VALUE klass));
|
|
125
|
+
static VALUE newt_s_alloc(VALUE klass)
|
|
126
|
+
{
|
|
127
|
+
rb_raise(rb_eTypeError, "allocator undefined for %"PRIsVALUE, klass);
|
|
128
|
+
UNREACHABLE_RETURN(Qnil);
|
|
129
|
+
}
|
|
130
|
+
|
|
124
131
|
static void free_widget(void *ptr)
|
|
125
132
|
{
|
|
126
133
|
Widget_data *data = (Widget_data *) ptr;
|
|
@@ -184,7 +191,7 @@ static VALUE rb_ext_ColorSetCustom(VALUE self, VALUE id)
|
|
|
184
191
|
return INT2NUM(NEWT_COLORSET_CUSTOM(NUM2INT(id)));
|
|
185
192
|
}
|
|
186
193
|
|
|
187
|
-
static VALUE rb_ext_Screen_Init()
|
|
194
|
+
static VALUE rb_ext_Screen_Init(VALUE self)
|
|
188
195
|
{
|
|
189
196
|
if (initialized == Qtrue)
|
|
190
197
|
return Qnil;
|
|
@@ -195,35 +202,35 @@ static VALUE rb_ext_Screen_Init()
|
|
|
195
202
|
return Qnil;
|
|
196
203
|
}
|
|
197
204
|
|
|
198
|
-
static VALUE rb_ext_Screen_new()
|
|
205
|
+
static VALUE rb_ext_Screen_new(VALUE self)
|
|
199
206
|
{
|
|
200
|
-
rb_ext_Screen_Init();
|
|
207
|
+
rb_ext_Screen_Init(self);
|
|
201
208
|
newtCls();
|
|
202
209
|
return Qnil;
|
|
203
210
|
}
|
|
204
211
|
|
|
205
|
-
static VALUE rb_ext_Screen_Cls()
|
|
212
|
+
static VALUE rb_ext_Screen_Cls(VALUE self)
|
|
206
213
|
{
|
|
207
214
|
INIT_GUARD();
|
|
208
215
|
newtCls();
|
|
209
216
|
return Qnil;
|
|
210
217
|
}
|
|
211
218
|
|
|
212
|
-
static VALUE rb_ext_Screen_Finished()
|
|
219
|
+
static VALUE rb_ext_Screen_Finished(VALUE self)
|
|
213
220
|
{
|
|
214
221
|
newtFinished();
|
|
215
222
|
initialized = Qfalse;
|
|
216
223
|
return Qnil;
|
|
217
224
|
}
|
|
218
225
|
|
|
219
|
-
static VALUE rb_ext_Screen_WaitForKey()
|
|
226
|
+
static VALUE rb_ext_Screen_WaitForKey(VALUE self)
|
|
220
227
|
{
|
|
221
228
|
INIT_GUARD();
|
|
222
229
|
newtWaitForKey();
|
|
223
230
|
return Qnil;
|
|
224
231
|
}
|
|
225
232
|
|
|
226
|
-
static VALUE rb_ext_Screen_ClearKeyBuffer()
|
|
233
|
+
static VALUE rb_ext_Screen_ClearKeyBuffer(VALUE self)
|
|
227
234
|
{
|
|
228
235
|
INIT_GUARD();
|
|
229
236
|
newtClearKeyBuffer();
|
|
@@ -407,21 +414,21 @@ static VALUE rb_ext_Screen_SetColor(VALUE self, VALUE colorset, VALUE fg, VALUE
|
|
|
407
414
|
return Qnil;
|
|
408
415
|
}
|
|
409
416
|
|
|
410
|
-
static VALUE rb_ext_Screen_Resume()
|
|
417
|
+
static VALUE rb_ext_Screen_Resume(VALUE self)
|
|
411
418
|
{
|
|
412
419
|
INIT_GUARD();
|
|
413
420
|
newtResume();
|
|
414
421
|
return Qnil;
|
|
415
422
|
}
|
|
416
423
|
|
|
417
|
-
static VALUE rb_ext_Screen_Suspend()
|
|
424
|
+
static VALUE rb_ext_Screen_Suspend(VALUE self)
|
|
418
425
|
{
|
|
419
426
|
INIT_GUARD();
|
|
420
427
|
newtSuspend();
|
|
421
428
|
return Qnil;
|
|
422
429
|
}
|
|
423
430
|
|
|
424
|
-
static VALUE rb_ext_Screen_Refresh()
|
|
431
|
+
static VALUE rb_ext_Screen_Refresh(VALUE self)
|
|
425
432
|
{
|
|
426
433
|
INIT_GUARD();
|
|
427
434
|
newtRefresh();
|
|
@@ -697,7 +704,7 @@ static VALUE rb_ext_Widget_callback(int argc, VALUE *argv, VALUE self)
|
|
|
697
704
|
Get_newtComponent(self, co);
|
|
698
705
|
cb = rb_struct_new(rb_ext_sCallback, self, rb_binding_new(), argv[0], data, NULL);
|
|
699
706
|
rb_obj_freeze(cb);
|
|
700
|
-
|
|
707
|
+
rb_ivar_set(self, IVAR_WIDGET_CALLBACK, cb);
|
|
701
708
|
newtComponentAddCallback(co, rb_ext_Widget_callback_function, (void *) cb);
|
|
702
709
|
return Qnil;
|
|
703
710
|
}
|
|
@@ -1774,6 +1781,7 @@ void Init_ruby_newt(){
|
|
|
1774
1781
|
rb_define_module_function(mNewt, "reflow_text", rb_ext_ReflowText, 4);
|
|
1775
1782
|
|
|
1776
1783
|
mScreen = rb_define_class_under(mNewt, "Screen", rb_cObject);
|
|
1784
|
+
rb_define_alloc_func(mScreen, newt_s_alloc);
|
|
1777
1785
|
rb_define_module_function(mScreen, "init", rb_ext_Screen_Init, 0);
|
|
1778
1786
|
rb_define_module_function(mScreen, "new", rb_ext_Screen_new, 0);
|
|
1779
1787
|
rb_define_module_function(mScreen, "cls", rb_ext_Screen_Cls, 0);
|
|
@@ -1806,6 +1814,7 @@ void Init_ruby_newt(){
|
|
|
1806
1814
|
rb_ext_sCallback = rb_struct_define("NewtCallback", "widget", "context", "callback", "data", NULL);
|
|
1807
1815
|
|
|
1808
1816
|
cWidget = rb_define_class_under(mNewt, "Widget", rb_cObject);
|
|
1817
|
+
rb_define_alloc_func(cWidget, newt_s_alloc);
|
|
1809
1818
|
rb_define_method(cWidget, "callback", rb_ext_Widget_callback, -1);
|
|
1810
1819
|
rb_define_method(cWidget, "takes_focus", rb_ext_Widget_takesFocus, 1);
|
|
1811
1820
|
rb_define_method(cWidget, "get_position", rb_ext_Widget_GetPosition, 0);
|
|
@@ -1895,6 +1904,7 @@ void Init_ruby_newt(){
|
|
|
1895
1904
|
rb_define_method(cForm, "watch_fd", rb_ext_Form_WatchFd, 2);
|
|
1896
1905
|
|
|
1897
1906
|
cExitStruct = rb_define_class_under(cForm, "ExitStruct", rb_cObject);
|
|
1907
|
+
rb_define_alloc_func(cExitStruct, newt_s_alloc);
|
|
1898
1908
|
rb_define_private_method(rb_singleton_class(cExitStruct), "new", NULL, 0);
|
|
1899
1909
|
rb_define_method(cExitStruct, "reason", rb_ext_ExitStruct_reason, 0);
|
|
1900
1910
|
rb_define_method(cExitStruct, "watch", rb_ext_ExitStruct_watch, 0);
|
data/lib/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: newt
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Noritsugu Nakamura
|
|
8
8
|
- Eric Sperano
|
|
9
9
|
- Lukas Zapletal
|
|
10
10
|
- Robert Gill
|
|
11
|
-
autorequire:
|
|
12
11
|
bindir: bin
|
|
13
12
|
cert_chain: []
|
|
14
|
-
date:
|
|
13
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
15
14
|
dependencies: []
|
|
16
15
|
description: Ruby bindings for newt TUI library
|
|
17
16
|
email: foreman-dev@googlegroups.com
|
|
@@ -67,7 +66,6 @@ homepage: https://github.com/theforeman/ruby-newt
|
|
|
67
66
|
licenses:
|
|
68
67
|
- MIT
|
|
69
68
|
metadata: {}
|
|
70
|
-
post_install_message:
|
|
71
69
|
rdoc_options: []
|
|
72
70
|
require_paths:
|
|
73
71
|
- lib
|
|
@@ -83,8 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
83
81
|
- !ruby/object:Gem::Version
|
|
84
82
|
version: '0'
|
|
85
83
|
requirements: []
|
|
86
|
-
rubygems_version:
|
|
87
|
-
signing_key:
|
|
84
|
+
rubygems_version: 4.0.21
|
|
88
85
|
specification_version: 4
|
|
89
86
|
summary: Ruby bindings for newt
|
|
90
87
|
test_files: []
|