supplement 2.31.1 → 2.33
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.md +1 -1
- data/lib/mkrf_conf +2 -2
- data/lib/supplement/locked.c +0 -19
- data/lib/supplement/terminal.c +6 -30
- data/lib/supplement.c +38 -24
- data/lib/supplement.h +1 -1
- 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: 9a1c02a87bc3156c7468abf0618da0dc18769fc09335605638e62515ebfc4b3c
|
|
4
|
+
data.tar.gz: e73d0a28b4f10dafdaea31aa8aa55f85e29db0ecb5d392512ad0429a280a1e1d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ca470be4d0d6f934d0adc74d249b52a1c682a38928848d03ea78ba3ef564cae49f2de61540b6e886fc8e08340085dacfd55d1516a9eab6bbc2c6dc3bfa227c79
|
|
7
|
+
data.tar.gz: 2c00ea6c30f2a6aa3b7f456d05c8f58895b12821590f928263e32e411d151ffe7e702b9b090cb954d677a628a5fc161217675b2a3496ae472230286300a3ca6a
|
data/README.md
CHANGED
data/lib/mkrf_conf
CHANGED
data/lib/supplement/locked.c
CHANGED
|
@@ -28,29 +28,14 @@
|
|
|
28
28
|
VALUE
|
|
29
29
|
rb_locked_init( int argc, VALUE *argv, VALUE self)
|
|
30
30
|
{
|
|
31
|
-
#ifdef FEATURE_OLD_IO_FUNCTIONS
|
|
32
|
-
rb_io_t *fptr;
|
|
33
|
-
#endif
|
|
34
31
|
struct timeval time;
|
|
35
32
|
int op;
|
|
36
33
|
|
|
37
|
-
#ifdef FEATURE_OLD_IO_FUNCTIONS
|
|
38
|
-
GetOpenFile( self, fptr);
|
|
39
|
-
#endif
|
|
40
|
-
|
|
41
34
|
rb_call_super_kw(argc, argv, RB_PASS_CALLED_KEYWORDS);
|
|
42
35
|
|
|
43
|
-
#ifdef FEATURE_OLD_IO_FUNCTIONS
|
|
44
|
-
op = fptr->mode & FMODE_WRITABLE ? LOCK_EX : LOCK_SH;
|
|
45
|
-
#else
|
|
46
36
|
op = rb_io_mode( self) & FMODE_WRITABLE ? LOCK_EX : LOCK_SH;
|
|
47
|
-
#endif
|
|
48
37
|
op |= LOCK_NB;
|
|
49
|
-
#ifdef FEATURE_OLD_IO_FUNCTIONS
|
|
50
|
-
while (flock( fptr->fd, op) < 0) {
|
|
51
|
-
#else
|
|
52
38
|
while (flock( rb_io_descriptor( self), op) < 0) {
|
|
53
|
-
#endif
|
|
54
39
|
static ID id_lock_failed = 0;
|
|
55
40
|
|
|
56
41
|
switch (errno) {
|
|
@@ -72,11 +57,7 @@ rb_locked_init( int argc, VALUE *argv, VALUE self)
|
|
|
72
57
|
}
|
|
73
58
|
break;
|
|
74
59
|
default:
|
|
75
|
-
#ifdef FEATURE_OLD_IO_FUNCTIONS
|
|
76
|
-
rb_sys_fail_str( fptr->pathv);
|
|
77
|
-
#else
|
|
78
60
|
rb_sys_fail_str( rb_io_path( self));
|
|
79
|
-
#endif
|
|
80
61
|
break;
|
|
81
62
|
}
|
|
82
63
|
}
|
data/lib/supplement/terminal.c
CHANGED
|
@@ -13,14 +13,6 @@ static VALUE io_unget( VALUE);
|
|
|
13
13
|
static VALUE io_reset( VALUE);
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
#ifdef FEATURE_OLD_IO_FUNCTIONS
|
|
17
|
-
#define RB_FAIL_PATH( io, fptr) ((fptr)->pathv)
|
|
18
|
-
#define RB_IO_VAR( io, fptr) fptr
|
|
19
|
-
#else
|
|
20
|
-
#define RB_FAIL_PATH( io, fptr) rb_io_path( io)
|
|
21
|
-
#define RB_IO_VAR( io, fptr) io
|
|
22
|
-
#endif
|
|
23
|
-
|
|
24
16
|
/*
|
|
25
17
|
* call-seq:
|
|
26
18
|
* io.unget(str, ...) -> nil
|
|
@@ -33,28 +25,20 @@ static VALUE io_reset( VALUE);
|
|
|
33
25
|
VALUE
|
|
34
26
|
rb_io_unget( int argc, VALUE *argv, VALUE io)
|
|
35
27
|
{
|
|
36
|
-
#ifdef FEATURE_OLD_IO_FUNCTIONS
|
|
37
|
-
rb_io_t *fptr;
|
|
38
|
-
#endif
|
|
39
28
|
int fd;
|
|
40
29
|
struct termios oldtio, newtio;
|
|
41
30
|
void *v[5];
|
|
42
31
|
|
|
43
|
-
#ifdef FEATURE_OLD_IO_FUNCTIONS
|
|
44
|
-
GetOpenFile( io, fptr);
|
|
45
|
-
fd = fptr->fd;
|
|
46
|
-
#else
|
|
47
32
|
fd = rb_io_descriptor( io);
|
|
48
|
-
#endif
|
|
49
33
|
|
|
50
34
|
if (tcgetattr( fd, &oldtio) < 0)
|
|
51
|
-
rb_sys_fail_str(
|
|
35
|
+
rb_sys_fail_str( rb_io_path( io));
|
|
52
36
|
newtio = oldtio;
|
|
53
37
|
newtio.c_iflag &= ~ICRNL;
|
|
54
38
|
if (tcsetattr( fd, TCSANOW, &newtio) < 0)
|
|
55
|
-
rb_sys_fail_str(
|
|
39
|
+
rb_sys_fail_str( rb_io_path( io));
|
|
56
40
|
|
|
57
|
-
v[0] = &fd, v[1] = (void *)
|
|
41
|
+
v[0] = &fd, v[1] = (void *) io, v[2] = &oldtio,
|
|
58
42
|
v[3] = &argc, v[4] = (void *) argv;
|
|
59
43
|
return rb_ensure( io_unget, (VALUE) v, io_reset, (VALUE) v);
|
|
60
44
|
}
|
|
@@ -76,7 +60,7 @@ io_unget( VALUE v)
|
|
|
76
60
|
p = RSTRING_PTR(str);
|
|
77
61
|
for (i = RSTRING_LEN(str); i; --i, ++p)
|
|
78
62
|
if (ioctl( *(int *) vp[0], TIOCSTI, p) < 0)
|
|
79
|
-
rb_sys_fail_str(
|
|
63
|
+
rb_sys_fail_str( rb_io_path( (VALUE) vp[1]));
|
|
80
64
|
}
|
|
81
65
|
return Qnil;
|
|
82
66
|
}
|
|
@@ -87,7 +71,7 @@ io_reset( VALUE v)
|
|
|
87
71
|
void **vp = (void **) v;
|
|
88
72
|
|
|
89
73
|
if (tcsetattr( *(int *) vp[0], TCSANOW, (struct termios *) vp[2]) < 0)
|
|
90
|
-
rb_sys_fail_str(
|
|
74
|
+
rb_sys_fail_str( rb_io_path( (VALUE) vp[1]));
|
|
91
75
|
|
|
92
76
|
return Qnil;
|
|
93
77
|
}
|
|
@@ -105,22 +89,14 @@ io_reset( VALUE v)
|
|
|
105
89
|
VALUE
|
|
106
90
|
rb_io_wingeom( VALUE self)
|
|
107
91
|
{
|
|
108
|
-
#ifdef FEATURE_OLD_IO_FUNCTIONS
|
|
109
|
-
rb_io_t *fptr;
|
|
110
|
-
#endif
|
|
111
92
|
int fd;
|
|
112
93
|
struct winsize w;
|
|
113
94
|
VALUE r;
|
|
114
95
|
|
|
115
|
-
#ifdef FEATURE_OLD_IO_FUNCTIONS
|
|
116
|
-
GetOpenFile( self, fptr);
|
|
117
|
-
fd = fptr->fd;
|
|
118
|
-
#else
|
|
119
96
|
fd = rb_io_descriptor( self);
|
|
120
|
-
#endif
|
|
121
97
|
|
|
122
98
|
if (ioctl( fd, TIOCGWINSZ, &w) < 0)
|
|
123
|
-
rb_sys_fail_str(
|
|
99
|
+
rb_sys_fail_str( rb_io_path( self));
|
|
124
100
|
r = rb_ary_new2( 4);
|
|
125
101
|
rb_ary_store( r, 0, INT2NUM( w.ws_col));
|
|
126
102
|
rb_ary_store( r, 1, INT2NUM( w.ws_row));
|
data/lib/supplement.c
CHANGED
|
@@ -110,28 +110,6 @@ rb_krn_tap_bang( VALUE obj)
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
|
|
113
|
-
/*
|
|
114
|
-
* call-seq:
|
|
115
|
-
* with { |x| ... } -> obj
|
|
116
|
-
*
|
|
117
|
-
* Warning. This method will be removed. Use +Kernel#then+ instead.
|
|
118
|
-
*
|
|
119
|
-
* Yields +x+ to the block.
|
|
120
|
-
* The difference to +tap+ is that the block's result will be returned.
|
|
121
|
-
*
|
|
122
|
-
* Use this to narrow your namespace.
|
|
123
|
-
*
|
|
124
|
-
*/
|
|
125
|
-
|
|
126
|
-
VALUE
|
|
127
|
-
rb_krn_with( VALUE obj)
|
|
128
|
-
{
|
|
129
|
-
rb_category_warning(RB_WARN_CATEGORY_DEPRECATED,
|
|
130
|
-
"Kernel#with will be removed from the supplement gem. Use Kernel#then instead.");
|
|
131
|
-
return rb_yield( obj);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
113
|
/*
|
|
136
114
|
* Document-class: Module
|
|
137
115
|
*/
|
|
@@ -432,7 +410,6 @@ rb_str_axe( int argc, VALUE *argv, VALUE str)
|
|
|
432
410
|
if (newlen < 0)
|
|
433
411
|
return Qnil;
|
|
434
412
|
|
|
435
|
-
|
|
436
413
|
oldlen = rb_str_strlen( str);
|
|
437
414
|
if (newlen < oldlen) {
|
|
438
415
|
VALUE ell;
|
|
@@ -575,6 +552,43 @@ rb_str_ends_with_p( int argc, VALUE *argv, VALUE str)
|
|
|
575
552
|
}
|
|
576
553
|
|
|
577
554
|
|
|
555
|
+
/*
|
|
556
|
+
* call-seq:
|
|
557
|
+
* notempy?( oth) -> nil or sym
|
|
558
|
+
*
|
|
559
|
+
* Checks whether the head is <code>oth</code>. Returns length of
|
|
560
|
+
* <code>oth</code> when matching.
|
|
561
|
+
*
|
|
562
|
+
* :"sys-apps".starts_with?( "sys-") #=> 4
|
|
563
|
+
*
|
|
564
|
+
* Caution! The Ruby 1.9.3 method #start_with? (note the missing s)
|
|
565
|
+
* just returns +true+ or +false+. Mnemonics: "s" = prepare for
|
|
566
|
+
* <code>#slice</code>.
|
|
567
|
+
*/
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
/*
|
|
571
|
+
* call-seq:
|
|
572
|
+
* notempty? -> nil or self
|
|
573
|
+
*
|
|
574
|
+
* Returns <code>self</code> if and only if <code>str</code> is not
|
|
575
|
+
* empty, <code>nil</code> otherwise.
|
|
576
|
+
*
|
|
577
|
+
* :hello.notempty? #=> :hello
|
|
578
|
+
* :"".notempty? #=> nil
|
|
579
|
+
*
|
|
580
|
+
* This seems to be quite useless. Its only purpose is to avoid either type
|
|
581
|
+
* detection or error catching if other objects are asked whether they're not
|
|
582
|
+
* empty.
|
|
583
|
+
*/
|
|
584
|
+
|
|
585
|
+
VALUE
|
|
586
|
+
rb_sym_notempty_p( VALUE sym)
|
|
587
|
+
{
|
|
588
|
+
return NUM2LONG( rb_funcall( sym, rb_intern( "length"), 0)) ? sym : Qnil;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
|
|
578
592
|
/*
|
|
579
593
|
* call-seq:
|
|
580
594
|
* starts_with?( oth) -> nil or int
|
|
@@ -1224,7 +1238,6 @@ void Init_supplement( void)
|
|
|
1224
1238
|
rb_define_method( rb_cObject, "new_string", rb_obj_new_string, 0);
|
|
1225
1239
|
rb_define_method( rb_cObject, "nil_if", rb_obj_nil_if, 1);
|
|
1226
1240
|
rb_define_method( rb_mKernel, "tap!", rb_krn_tap_bang, 0);
|
|
1227
|
-
rb_define_method( rb_mKernel, "with", rb_krn_with, 0);
|
|
1228
1241
|
|
|
1229
1242
|
rb_define_method( rb_cModule, "plain_name", rb_module_plain_name, 0);
|
|
1230
1243
|
|
|
@@ -1243,6 +1256,7 @@ void Init_supplement( void)
|
|
|
1243
1256
|
rb_define_method( rb_cString, "axe!", rb_str_axe_bang, -1);
|
|
1244
1257
|
rb_define_method( rb_cString, "starts_with?", rb_str_starts_with_p, -1);
|
|
1245
1258
|
rb_define_method( rb_cString, "ends_with?", rb_str_ends_with_p, -1);
|
|
1259
|
+
rb_define_method( rb_cSymbol, "notempty?", rb_sym_notempty_p, 0);
|
|
1246
1260
|
rb_define_method( rb_cSymbol, "starts_with?", rb_sym_starts_with_p, -1);
|
|
1247
1261
|
rb_define_method( rb_cSymbol, "ends_with?", rb_sym_ends_with_p, -1);
|
|
1248
1262
|
|
data/lib/supplement.h
CHANGED
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
extern VALUE rb_obj_new_string( VALUE);
|
|
13
13
|
extern VALUE rb_obj_nil_if( VALUE, VALUE);
|
|
14
14
|
extern VALUE rb_krn_tap_bang( VALUE);
|
|
15
|
-
extern VALUE rb_krn_with( VALUE);
|
|
16
15
|
|
|
17
16
|
extern VALUE rb_module_plain_name( VALUE);
|
|
18
17
|
|
|
@@ -30,6 +29,7 @@ extern VALUE rb_str_axe( int, VALUE *, VALUE);
|
|
|
30
29
|
extern VALUE rb_str_axe_bang( int, VALUE *, VALUE);
|
|
31
30
|
extern VALUE rb_str_starts_with_p( int argc, VALUE *argv, VALUE);
|
|
32
31
|
extern VALUE rb_str_ends_with_p( int argc, VALUE *argv, VALUE);
|
|
32
|
+
extern VALUE rb_sym_notempty_p( VALUE);
|
|
33
33
|
extern VALUE rb_sym_starts_with_p( int argc, VALUE *argv, VALUE);
|
|
34
34
|
extern VALUE rb_sym_ends_with_p( int argc, VALUE *argv, VALUE);
|
|
35
35
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: supplement
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: '2.33'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bertram Scharpf
|
|
@@ -81,7 +81,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
81
81
|
requirements:
|
|
82
82
|
- - ">="
|
|
83
83
|
- !ruby/object:Gem::Version
|
|
84
|
-
version: 3.
|
|
84
|
+
version: 3.3.0
|
|
85
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
86
|
requirements:
|
|
87
87
|
- - ">="
|