1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0269
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 8.1.0269
Problem: Ruby Kernel.#p method always returns nil.
Solution: Copy p method implementation from Ruby code. (Masataka Pocke
Kuwabara, closes #3315)
Files: src/if_ruby.c, src/testdir/test_ruby.vim
*** ../vim-8.1.0268/src/if_ruby.c 2018-08-04 17:24:39.062825210 +0200
--- src/if_ruby.c 2018-08-11 14:23:48.613860602 +0200
***************
*** 299,304 ****
--- 299,309 ----
# define rb_string_value_ptr dll_rb_string_value_ptr
# define rb_float_new dll_rb_float_new
# define rb_ary_new dll_rb_ary_new
+ # ifdef rb_ary_new4
+ # define RB_ARY_NEW4_MACRO 1
+ # undef rb_ary_new4
+ # endif
+ # define rb_ary_new4 dll_rb_ary_new4
# define rb_ary_push dll_rb_ary_push
# if defined(RUBY19_OR_LATER) || defined(RUBY_INIT_STACK)
# ifdef __ia64
***************
*** 441,446 ****
--- 446,452 ----
static char * (*dll_rb_string_value_ptr) (volatile VALUE*);
static VALUE (*dll_rb_float_new) (double);
static VALUE (*dll_rb_ary_new) (void);
+ static VALUE (*dll_rb_ary_new4) (long n, const VALUE *elts);
static VALUE (*dll_rb_ary_push) (VALUE, VALUE);
# if defined(RUBY19_OR_LATER) || defined(RUBY_INIT_STACK)
# ifdef __ia64
***************
*** 647,652 ****
--- 653,663 ----
{"rb_float_new_in_heap", (RUBY_PROC*)&dll_rb_float_new},
# endif
{"rb_ary_new", (RUBY_PROC*)&dll_rb_ary_new},
+ # ifdef RB_ARY_NEW4_MACRO
+ {"rb_ary_new_from_values", (RUBY_PROC*)&dll_rb_ary_new4},
+ # else
+ {"rb_ary_new4", (RUBY_PROC*)&dll_rb_ary_new4},
+ # endif
{"rb_ary_push", (RUBY_PROC*)&dll_rb_ary_push},
# endif
# ifdef RUBY19_OR_LATER
***************
*** 1577,1582 ****
--- 1588,1594 ----
{
int i;
VALUE str = rb_str_new("", 0);
+ VALUE ret = Qnil;
for (i = 0; i < argc; i++)
{
***************
*** 1584,1590 ****
rb_str_concat(str, rb_inspect(argv[i]));
}
MSG(RSTRING_PTR(str));
! return Qnil;
}
static void ruby_io_init(void)
--- 1596,1607 ----
rb_str_concat(str, rb_inspect(argv[i]));
}
MSG(RSTRING_PTR(str));
!
! if (argc == 1)
! ret = argv[0];
! else if (argc > 1)
! ret = rb_ary_new4(argc, argv);
! return ret;
}
static void ruby_io_init(void)
*** ../vim-8.1.0268/src/testdir/test_ruby.vim 2018-07-28 17:29:15.757096343 +0200
--- src/testdir/test_ruby.vim 2018-08-11 14:17:07.396211894 +0200
***************
*** 363,366 ****
--- 363,379 ----
ruby p 'Just a test'
let messages = split(execute('message'), "\n")
call assert_equal('"Just a test"', messages[-1])
+
+ " Check return values of p method
+
+ call assert_equal('123', RubyEval('p(123)'))
+ call assert_equal('[1, 2, 3]', RubyEval('p(1, 2, 3)'))
+
+ " Avoid the "message maintainer" line.
+ let $LANG = ''
+ messages clear
+ call assert_equal('true', RubyEval('p() == nil'))
+
+ let messages = split(execute('message'), "\n")
+ call assert_equal(0, len(messages))
endfunc
*** ../vim-8.1.0268/src/version.c 2018-08-11 13:57:16.215969777 +0200
--- src/version.c 2018-08-11 14:22:56.922175770 +0200
***************
*** 796,797 ****
--- 796,799 ----
{ /* Add new patch number below this line */
+ /**/
+ 269,
/**/
--
SIGFUN -- signature too funny (core dumped)
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|