readline-ext 0.1.5 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +11 -4
- data/Gemfile +1 -0
- data/ext/readline/extconf.rb +2 -0
- data/ext/readline/readline.c +31 -14
- data/readline-ext.gemspec +12 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aee9c6dfd2619ad2f975738c3cd0f8f142996637ca21d788acb5e8d695c3c2e9
|
4
|
+
data.tar.gz: 1228d841d7bf7c1b606f766fb6c37a3cb2d60ea4fdbd7bfeea85ba8782fd9b3c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 625852ad1adfe1a8e61f5d243754bf112764cb4a37a7975d5871d1f267856c083f3fd5bccbe9ab077d3928b02bf004c6bfda6a35ee22275a9710919ddb6c744b
|
7
|
+
data.tar.gz: 95f3ae47e17404fbd40041f3d3396a4b9aa86d44e56e7796c73631fc4379f8190e2e5e202a8b14cf1ed18c4cf3eaff8b0f8a435691946570a8e2bdeea061092c
|
data/.github/workflows/test.yml
CHANGED
@@ -1,17 +1,24 @@
|
|
1
|
-
name:
|
1
|
+
name: test
|
2
2
|
|
3
3
|
on: [push, pull_request]
|
4
4
|
|
5
5
|
jobs:
|
6
|
-
|
6
|
+
ruby-versions:
|
7
|
+
uses: ruby/actions/.github/workflows/ruby_versions.yml@master
|
8
|
+
with:
|
9
|
+
min_version: 2.6
|
10
|
+
engine: cruby
|
11
|
+
|
12
|
+
test:
|
13
|
+
needs: ruby-versions
|
7
14
|
name: build (${{ matrix.ruby }} / ${{ matrix.os }})
|
8
15
|
strategy:
|
9
16
|
matrix:
|
10
|
-
ruby:
|
17
|
+
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
|
11
18
|
os: [ ubuntu-latest, macos-latest ]
|
12
19
|
runs-on: ${{ matrix.os }}
|
13
20
|
steps:
|
14
|
-
- uses: actions/checkout@
|
21
|
+
- uses: actions/checkout@v4
|
15
22
|
- name: Install libedit
|
16
23
|
run: sudo apt-get install -q libedit-dev libedit2
|
17
24
|
if: startsWith(matrix.os, 'ubuntu')
|
data/Gemfile
CHANGED
data/ext/readline/extconf.rb
CHANGED
data/ext/readline/readline.c
CHANGED
@@ -15,6 +15,8 @@
|
|
15
15
|
|
16
16
|
************************************************/
|
17
17
|
|
18
|
+
#define READLINE_VERSION "0.2.0"
|
19
|
+
|
18
20
|
#ifdef RUBY_EXTCONF_H
|
19
21
|
#include RUBY_EXTCONF_H
|
20
22
|
#endif
|
@@ -44,6 +46,15 @@
|
|
44
46
|
#include <sys/stat.h>
|
45
47
|
#endif
|
46
48
|
|
49
|
+
#ifndef HAVE_RB_IO_DESCRIPTOR
|
50
|
+
int io_descriptor_fallback(VALUE io) {
|
51
|
+
rb_io_t *fptr;
|
52
|
+
GetOpenFile(io, fptr);
|
53
|
+
return fptr->fd;
|
54
|
+
}
|
55
|
+
#define rb_io_descriptor io_descriptor_fallback
|
56
|
+
#endif
|
57
|
+
|
47
58
|
static VALUE mReadline;
|
48
59
|
|
49
60
|
#define EDIT_LINE_LIBRARY_VERSION "EditLine wrapper"
|
@@ -371,30 +382,36 @@ clear_rl_outstream(void)
|
|
371
382
|
readline_outstream = Qfalse;
|
372
383
|
}
|
373
384
|
|
385
|
+
VALUE io_descriptor(VALUE io) {
|
386
|
+
return RB_INT2NUM(rb_io_descriptor(io));
|
387
|
+
}
|
388
|
+
|
374
389
|
static void
|
375
390
|
prepare_readline(void)
|
376
391
|
{
|
377
392
|
static int initialized = 0;
|
393
|
+
int state;
|
394
|
+
|
378
395
|
if (!initialized) {
|
379
396
|
rl_initialize();
|
380
397
|
initialized = 1;
|
381
398
|
}
|
382
399
|
|
383
400
|
if (readline_instream) {
|
384
|
-
|
385
|
-
|
386
|
-
if (
|
401
|
+
rb_protect(io_descriptor, readline_instream, &state);
|
402
|
+
|
403
|
+
if (state) {
|
387
404
|
clear_rl_instream();
|
388
|
-
|
405
|
+
rb_jump_tag(state);
|
389
406
|
}
|
390
407
|
}
|
391
408
|
|
392
409
|
if (readline_outstream) {
|
393
|
-
|
394
|
-
|
395
|
-
if (
|
410
|
+
rb_protect(io_descriptor, readline_outstream, &state);
|
411
|
+
|
412
|
+
if (state) {
|
396
413
|
clear_rl_outstream();
|
397
|
-
|
414
|
+
rb_jump_tag(state);
|
398
415
|
}
|
399
416
|
}
|
400
417
|
}
|
@@ -551,7 +568,6 @@ readline_readline(int argc, VALUE *argv, VALUE self)
|
|
551
568
|
static VALUE
|
552
569
|
readline_s_set_input(VALUE self, VALUE input)
|
553
570
|
{
|
554
|
-
rb_io_t *ifp;
|
555
571
|
int fd;
|
556
572
|
FILE *f;
|
557
573
|
|
@@ -560,9 +576,9 @@ readline_s_set_input(VALUE self, VALUE input)
|
|
560
576
|
}
|
561
577
|
else {
|
562
578
|
Check_Type(input, T_FILE);
|
563
|
-
|
579
|
+
fd = rb_io_descriptor(input);
|
564
580
|
clear_rl_instream();
|
565
|
-
fd = rb_cloexec_dup(
|
581
|
+
fd = rb_cloexec_dup(fd);
|
566
582
|
if (fd == -1)
|
567
583
|
rb_sys_fail("dup");
|
568
584
|
f = fdopen(fd, "r");
|
@@ -587,7 +603,6 @@ readline_s_set_input(VALUE self, VALUE input)
|
|
587
603
|
static VALUE
|
588
604
|
readline_s_set_output(VALUE self, VALUE output)
|
589
605
|
{
|
590
|
-
rb_io_t *ofp;
|
591
606
|
int fd;
|
592
607
|
FILE *f;
|
593
608
|
|
@@ -596,9 +611,9 @@ readline_s_set_output(VALUE self, VALUE output)
|
|
596
611
|
}
|
597
612
|
else {
|
598
613
|
Check_Type(output, T_FILE);
|
599
|
-
|
614
|
+
fd = rb_io_descriptor(output);
|
600
615
|
clear_rl_outstream();
|
601
|
-
fd = rb_cloexec_dup(
|
616
|
+
fd = rb_cloexec_dup(fd);
|
602
617
|
if (fd == -1)
|
603
618
|
rb_sys_fail("dup");
|
604
619
|
f = fdopen(fd, "w");
|
@@ -2119,6 +2134,8 @@ Init_readline(void)
|
|
2119
2134
|
/* Version string of GNU Readline or libedit. */
|
2120
2135
|
rb_define_const(mReadline, "VERSION", version);
|
2121
2136
|
|
2137
|
+
rb_define_const(mReadline, "GEM_VERSION", rb_str_new_cstr(READLINE_VERSION));
|
2138
|
+
|
2122
2139
|
rl_attempted_completion_function = readline_attempted_completion_function;
|
2123
2140
|
#if defined(HAVE_RL_PRE_INPUT_HOOK)
|
2124
2141
|
rl_pre_input_hook = (rl_hook_func_t *)readline_pre_input_hook;
|
data/readline-ext.gemspec
CHANGED
@@ -1,6 +1,16 @@
|
|
1
|
+
source_version = ["", "ext/readline/"].find do |dir|
|
2
|
+
begin
|
3
|
+
break File.open(File.join(__dir__, "#{dir}readline.c")) {|f|
|
4
|
+
f.gets("\n#define READLINE_VERSION ")
|
5
|
+
f.gets[/\s*"(.+)"/, 1]
|
6
|
+
}
|
7
|
+
rescue Errno::ENOENT
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
1
11
|
Gem::Specification.new do |spec|
|
2
12
|
spec.name = "readline-ext"
|
3
|
-
spec.version =
|
13
|
+
spec.version = source_version
|
4
14
|
spec.authors = ["Yukihiro Matsumoto"]
|
5
15
|
spec.email = ["matz@ruby-lang.org"]
|
6
16
|
|
@@ -14,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
14
24
|
spec.metadata["source_code_uri"] = spec.homepage
|
15
25
|
|
16
26
|
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
17
|
-
`git ls-files -z 2
|
27
|
+
`git ls-files -z 2>#{IO::NULL}`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
28
|
end
|
19
29
|
spec.bindir = "exe"
|
20
30
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: readline-ext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yukihiro Matsumoto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Provides an interface for GNU Readline and Edit Line (libedit).
|
14
14
|
email:
|
@@ -57,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
57
57
|
- !ruby/object:Gem::Version
|
58
58
|
version: '0'
|
59
59
|
requirements: []
|
60
|
-
rubygems_version: 3.
|
60
|
+
rubygems_version: 3.5.0.dev
|
61
61
|
signing_key:
|
62
62
|
specification_version: 4
|
63
63
|
summary: Provides an interface for GNU Readline and Edit Line (libedit).
|