supplement 2.20 → 2.21

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8787714cfe43e572f3ea76d897be6f62902bef77397723210e77cc05e9da3ffe
4
- data.tar.gz: ba6d8f69cbdc98f9573bc67af364272cc69400935d94e21a058e2836b0c989f5
3
+ metadata.gz: 7195670e7cd62225ea949b29536edf23349f53688ad4bb85f2aae7e90497cef9
4
+ data.tar.gz: 61b52622f92b881337daf310681533758245f61b9939997caf018088e0f00547
5
5
  SHA512:
6
- metadata.gz: 6e0f5c4e4ff4c1e515be996e30ff7f8437c13079718b832233bd591a9418e55c4f939522dec7023b8d1eb18b6b8c446f82316a3c82bf26530e3f5db2e74a9352
7
- data.tar.gz: 6811a569b15b096aeada5c792cb0474944735be1967c02a6d0f8489e56b30f191507af03e5cede067b1b27c87f9aa243030691209ef7f5370981310c0ba40e7c
6
+ metadata.gz: 3fecc23c00a4981a04cd4193297ff84f768b2b37d98e471a36a86e7af062197ddbe4977f9d44c0f2f979b22dddfc4c28d889189e7c029cc0a7a4f6eb6b5b474b
7
+ data.tar.gz: 1e8e2585b26e5fa445d370b169a7ba73d08b42bec9399bf6b4ade2b90fc4fc0885d766a24c26705899bc176cf15d71d6b27645f3723ee1eff743bb2ce9a68016
data/README CHANGED
@@ -1,4 +1,4 @@
1
- = supplement 2.20 -- Useful Ruby enhancements
1
+ = supplement 2.21 -- Useful Ruby enhancements
2
2
 
3
3
 
4
4
  Some simple Ruby extensions.
data/lib/mkrf_conf CHANGED
@@ -10,12 +10,15 @@ Autorake.configure {
10
10
 
11
11
  extending_ruby
12
12
 
13
- if RUBY_VERSION < "2.7" then
14
- if RUBY_VERSION < "2.6" then
15
- enable :dir_children
13
+ if RUBY_VERSION < "3.3" then
14
+ if RUBY_VERSION < "2.7" then
15
+ if RUBY_VERSION < "2.6" then
16
+ enable :dir_children
17
+ end
18
+ else
19
+ enable :super_kwargs
16
20
  end
17
- else
18
- enable :super_kwargs
21
+ enable :old_io_functions
19
22
  end
20
23
 
21
24
  have_header "ruby/ruby.h"
@@ -28,20 +28,35 @@
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
31
34
  #ifdef HAVE_FUNC_RB_THREAD_WAIT_FOR
32
35
  struct timeval time;
33
36
  #endif
34
37
  int op;
35
38
 
39
+ #ifdef FEATURE_OLD_IO_FUNCTIONS
40
+ GetOpenFile( self, fptr);
41
+ #endif
42
+
36
43
  #ifdef FEATURE_SUPER_KWARGS
37
44
  rb_call_super_kw(argc, argv, RB_PASS_CALLED_KEYWORDS);
38
45
  #else
39
46
  rb_call_super( argc, argv);
40
47
  #endif
41
48
 
49
+ #ifdef FEATURE_OLD_IO_FUNCTIONS
50
+ op = fptr->mode & FMODE_WRITABLE ? LOCK_EX : LOCK_SH;
51
+ #else
42
52
  op = rb_io_mode( self) & FMODE_WRITABLE ? LOCK_EX : LOCK_SH;
53
+ #endif
43
54
  op |= LOCK_NB;
55
+ #ifdef FEATURE_OLD_IO_FUNCTIONS
56
+ while (flock( fptr->fd, op) < 0) {
57
+ #else
44
58
  while (flock( rb_io_descriptor( self), op) < 0) {
59
+ #endif
45
60
  static ID id_lock_failed = 0;
46
61
 
47
62
  switch (errno) {
@@ -67,7 +82,11 @@ rb_locked_init( int argc, VALUE *argv, VALUE self)
67
82
  }
68
83
  break;
69
84
  default:
85
+ #ifdef FEATURE_OLD_IO_FUNCTIONS
86
+ rb_sys_fail_str( fptr->pathv);
87
+ #else
70
88
  rb_sys_fail_str( rb_io_path( self));
89
+ #endif
71
90
  break;
72
91
  }
73
92
  }
@@ -13,7 +13,13 @@ static VALUE io_unget( VALUE);
13
13
  static VALUE io_reset( VALUE);
14
14
 
15
15
 
16
- #define RB_SYS_FAIL( io) rb_sys_fail_str( rb_io_path( io));
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
17
23
 
18
24
  /*
19
25
  * call-seq:
@@ -27,20 +33,28 @@ static VALUE io_reset( VALUE);
27
33
  VALUE
28
34
  rb_io_unget( int argc, VALUE *argv, VALUE io)
29
35
  {
36
+ #ifdef FEATURE_OLD_IO_FUNCTIONS
37
+ rb_io_t *fptr;
38
+ #endif
30
39
  int fd;
31
40
  struct termios oldtio, newtio;
32
41
  void *v[5];
33
42
 
43
+ #ifdef FEATURE_OLD_IO_FUNCTIONS
44
+ GetOpenFile( io, fptr);
45
+ fd = fptr->fd;
46
+ #else
34
47
  fd = rb_io_descriptor( io);
48
+ #endif
35
49
 
36
50
  if (tcgetattr( fd, &oldtio) < 0)
37
- RB_SYS_FAIL( io);
51
+ rb_sys_fail_str( RB_FAIL_PATH( io, fptr));
38
52
  newtio = oldtio;
39
53
  newtio.c_iflag &= ~ICRNL;
40
54
  if (tcsetattr( fd, TCSANOW, &newtio) < 0)
41
- RB_SYS_FAIL( io);
55
+ rb_sys_fail_str( RB_FAIL_PATH( io, fptr));
42
56
 
43
- v[0] = &fd, v[1] = (void *) io, v[2] = &oldtio,
57
+ v[0] = &fd, v[1] = (void *) RB_IO_VAR( io, fptr), v[2] = &oldtio,
44
58
  v[3] = &argc, v[4] = (void *) argv;
45
59
  return rb_ensure( io_unget, (VALUE) v, io_reset, (VALUE) v);
46
60
  }
@@ -62,7 +76,7 @@ io_unget( VALUE v)
62
76
  p = RSTRING_PTR(str);
63
77
  for (i = RSTRING_LEN(str); i; --i, ++p)
64
78
  if (ioctl( *(int *) vp[0], TIOCSTI, p) < 0)
65
- RB_SYS_FAIL( (VALUE) vp[1]);
79
+ rb_sys_fail_str( RB_FAIL_PATH( (VALUE) vp[1], (rb_io_t *) vp[1]));
66
80
  }
67
81
  return Qnil;
68
82
  }
@@ -73,7 +87,7 @@ io_reset( VALUE v)
73
87
  void **vp = (void **) v;
74
88
 
75
89
  if (tcsetattr( *(int *) vp[0], TCSANOW, (struct termios *) vp[2]) < 0)
76
- RB_SYS_FAIL( (VALUE) vp[1]);
90
+ rb_sys_fail_str( RB_FAIL_PATH( (VALUE) vp[1], (rb_io_t *) vp[1]));
77
91
 
78
92
  return Qnil;
79
93
  }
@@ -91,14 +105,22 @@ io_reset( VALUE v)
91
105
  VALUE
92
106
  rb_io_wingeom( VALUE self)
93
107
  {
108
+ #ifdef FEATURE_OLD_IO_FUNCTIONS
109
+ rb_io_t *fptr;
110
+ #endif
94
111
  int fd;
95
112
  struct winsize w;
96
113
  VALUE r;
97
114
 
115
+ #ifdef FEATURE_OLD_IO_FUNCTIONS
116
+ GetOpenFile( self, fptr);
117
+ fd = fptr->fd;
118
+ #else
98
119
  fd = rb_io_descriptor( self);
120
+ #endif
99
121
 
100
122
  if (ioctl( fd, TIOCGWINSZ, &w) < 0)
101
- RB_SYS_FAIL( self);
123
+ rb_sys_fail_str( RB_FAIL_PATH( self, fptr));
102
124
  r = rb_ary_new2( 4);
103
125
  rb_ary_store( r, 0, INT2NUM( w.ws_col));
104
126
  rb_ary_store( r, 1, INT2NUM( w.ws_row));
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: supplement
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.20'
4
+ version: '2.21'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bertram Scharpf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-22 00:00:00.000000000 Z
11
+ date: 2024-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  version: '0'
96
96
  requirements:
97
97
  - Ruby and the autorake gem
98
- rubygems_version: 3.5.14
98
+ rubygems_version: 3.5.6
99
99
  signing_key:
100
100
  specification_version: 4
101
101
  summary: Simple Ruby extensions