468 |
468 |
|
469 |
469 |
AM_PATH_RUBY(,with_ruby=yes, with_ruby=no)
|
470 |
470 |
if test x$with_ruby != xno; then
|
471 |
|
RUBY_ARCHDIR=`$RUBY -e 'require "rbconfig.rb"; puts Config::expand("\$(archdir)")'`
|
472 |
|
RUBY_LIBRUBYARG=`$RUBY -e 'require "rbconfig.rb"; puts Config::expand("\$(LIBRUBYARG)")'`
|
|
471 |
RUBY_ARCHDIR=`$RUBY -e 'require "rbconfig.rb"; puts RbConfig::expand("\$(archdir)")'`
|
|
472 |
RUBY_LIBRUBYARG=`$RUBY -e 'require "rbconfig.rb"; puts RbConfig::expand("\$(LIBRUBYARG)")'`
|
473 |
473 |
|
474 |
474 |
RUBY_LIBS="-L$RUBY_ARCHDIR $RUBY_LIBRUBYARG"
|
475 |
475 |
AC_SUBST(RUBY_LIBS)
|
476 |
476 |
|
477 |
|
RUBY_CCFLAGS=`$RUBY -rrbconfig -e "print Config::CONFIG[['CFLAGS']]"`
|
|
477 |
RUBY_CCFLAGS=`$RUBY -rrbconfig -e "print RbConfig::CONFIG[['CFLAGS']]"`
|
478 |
478 |
AC_SUBST(RUBY_CCFLAGS)
|
479 |
479 |
|
480 |
480 |
old_CPPFLAGS="$CPPFLAGS"
|
481 |
|
-- libprelude-1.0.1-old/m4/am_path_ruby.m4 2012-04-02 06:41:15.000000000 -0300
|
|
481 |
++ libprelude-1.0.1/m4/am_path_ruby.m4 2012-08-03 20:17:05.476741375 -0300
|
... | ... | |
86 |
86 |
dnl rubydir -- where to install ruby scripts.
|
87 |
87 |
AC_CACHE_CHECK([for $am_display_RUBY script directory],
|
88 |
88 |
[am_cv_ruby_rubydir],
|
89 |
|
[am_cv_ruby_rubydir=`$RUBY -rrbconfig -e "drive = File::PATH_SEPARATOR == ';' ? /\A\w:/ : /\A/; prefix = Regexp.new('\\A' + Regexp.quote(Config::CONFIG[['prefix']])); \\$prefix = Config::CONFIG[['prefix']].sub(drive, ''); \\$archdir = Config::CONFIG[['archdir']].sub(prefix, '\\$(prefix)').sub(drive, ''); print \\$archdir;"`])
|
|
89 |
[am_cv_ruby_rubydir=`$RUBY -rrbconfig -e "drive = File::PATH_SEPARATOR == ';' ? /\A\w:/ : /\A/; prefix = Regexp.new('\\A' + Regexp.quote(RbConfig::CONFIG[['prefix']])); \\$prefix = RbConfig::CONFIG[['prefix']].sub(drive, ''); \\$archdir = RbConfig::CONFIG[['archdir']].sub(prefix, '\\$(prefix)').sub(drive, ''); print \\$archdir;"`])
|
90 |
90 |
AC_SUBST([rubydir], [$am_cv_ruby_rubydir])
|
91 |
91 |
|
92 |
92 |
dnl pkgrubydir -- $PACKAGE directory under rubydir.
|
... | ... | |
96 |
96 |
dnl (shared libraries)
|
97 |
97 |
AC_CACHE_CHECK([for $am_display_RUBY extension module directory],
|
98 |
98 |
[am_cv_ruby_rbexecdir],
|
99 |
|
[am_cv_ruby_rbexecdir=`$RUBY -rrbconfig -e "drive = File::PATH_SEPARATOR == ';' ? /\A\w:/ : /\A/; prefix = Regexp.new('\\A' + Regexp.quote(Config::CONFIG[['prefix']])); \\$prefix = Config::CONFIG[['prefix']].sub(drive, ''); \\$sitearchdir = Config::CONFIG[['sitearchdir']].sub(prefix, '\\$(prefix)').sub(drive, ''); print \\$sitearchdir;" 2>/dev/null || echo "${RUBY_EXEC_PREFIX}/local/lib/site_ruby/${RUBY_VERSION}/${RUBY_PLATFORM}"`])
|
|
99 |
[am_cv_ruby_rbexecdir=`$RUBY -rrbconfig -e "drive = File::PATH_SEPARATOR == ';' ? /\A\w:/ : /\A/; prefix = Regexp.new('\\A' + Regexp.quote(RbConfig::CONFIG[['prefix']])); \\$prefix = RbConfig::CONFIG[['prefix']].sub(drive, ''); \\$sitearchdir = RbConfig::CONFIG[['sitearchdir']].sub(prefix, '\\$(prefix)').sub(drive, ''); print \\$sitearchdir;" 2>/dev/null || echo "${RUBY_EXEC_PREFIX}/local/lib/site_ruby/${RUBY_VERSION}/${RUBY_PLATFORM}"`])
|
100 |
100 |
AC_SUBST([rbexecdir], [$am_cv_ruby_rbexecdir])
|
101 |
101 |
|
102 |
|
RUBY_INCLUDES=`$RUBY -r rbconfig -e 'if Config::CONFIG[["archdir"]] then print " -I" + Config::CONFIG[["archdir"]] end
|
103 |
|
if Config::CONFIG[["rubyhdrdir"]] then print " -I" + Config::CONFIG[["rubyhdrdir"]] end'`
|
|
102 |
RUBY_INCLUDES=`$RUBY -rrbconfig -e 'if RbConfig::CONFIG[["archdir"]] then print " -I" + RbConfig::CONFIG[["archdir"]] end
|
|
103 |
if RbConfig::CONFIG[["rubyhdrdir"]] then print " -I" + RbConfig::CONFIG[["rubyhdrdir"]]; print " -I" + RbConfig::CONFIG[["rubyhdrdir"]]+File::SEPARATOR+RbConfig::CONFIG[["sitearch"]] end
|
|
104 |
'`
|
104 |
105 |
AC_SUBST([RUBY_INCLUDES])
|
105 |
106 |
|
106 |
107 |
dnl pkgrbexecdir -- $(rbexecdir)/$(PACKAGE)
|
107 |
|
-- libprelude-1.0.1-old/bindings/ruby/libpreludecpp-ruby.i 2012-06-01 12:12:00.000000000 -0300
|
|
108 |
++ libprelude-1.0.1/bindings/ruby/libpreludecpp-ruby.i 2012-08-03 23:45:22.090875875 -0300
|
... | ... | |
44 |
44 |
|
45 |
45 |
%{
|
46 |
46 |
extern "C" {
|
|
47 |
#ifdef HAVE_RUBY_IO_H
|
|
48 |
#include "ruby/io.h"
|
|
49 |
#else
|
47 |
50 |
#include "rubyio.h"
|
|
51 |
#endif
|
48 |
52 |
}
|
49 |
53 |
%};
|
50 |
54 |
|
... | ... | |
68 |
72 |
{
|
69 |
73 |
FILE *f;
|
70 |
74 |
ssize_t ret;
|
71 |
|
OpenFile *fptr;
|
|
75 |
rb_io_t *fptr;
|
72 |
76 |
VALUE *io = (VALUE *) prelude_msgbuf_get_data(fd);
|
73 |
77 |
|
74 |
78 |
GetOpenFile(*io, fptr);
|
75 |
|
f = fptr->f;
|
|
79 |
%#ifdef HAVE_RUBY_IO_H
|
|
80 |
f = rb_io_stdio_file(fptr);
|
|
81 |
%#else
|
|
82 |
f = GetWriteFile(fptr);
|
|
83 |
%#endif
|
76 |
84 |
|
77 |
85 |
ret = fwrite((const char *) prelude_msg_get_message_data(msg), 1, prelude_msg_get_len(msg), f);
|
78 |
86 |
if ( ret != prelude_msg_get_len(msg) )
|
... | ... | |
88 |
96 |
{
|
89 |
97 |
FILE *f;
|
90 |
98 |
ssize_t ret;
|
91 |
|
OpenFile *fptr;
|
|
99 |
rb_io_t *fptr;
|
92 |
100 |
VALUE *io = (VALUE *) prelude_io_get_fdptr(fd);
|
93 |
101 |
|
94 |
102 |
GetOpenFile(*io, fptr);
|
95 |
|
f = fptr->f;
|
|
103 |
%#ifdef HAVE_RUBY_IO_H
|
|
104 |
f = rb_io_stdio_file(fptr);
|
|
105 |
%#else
|
|
106 |
f = GetReadFile(fptr);
|
|
107 |
%#endif
|
96 |
108 |
|
97 |
109 |
ret = fread(buf, 1, size, f);
|
98 |
110 |
if ( ret < 0 )
|
... | ... | |
155 |
167 |
if ( ret < 0 )
|
156 |
168 |
return Qnil;
|
157 |
169 |
|
158 |
|
RARRAY(ary)->ptr[j++] = val;
|
|
170 |
rb_ary_store(ary, j++, val);
|
159 |
171 |
}
|
160 |
172 |
|
161 |
|
RARRAY(ary)->len = result.size();
|
162 |
|
|
163 |
173 |
return ary;
|
164 |
174 |
}
|
165 |
175 |
}
|
... | ... | |
184 |
194 |
int ret;
|
185 |
195 |
char **argv;
|
186 |
196 |
int _i, argc;
|
187 |
|
VALUE rbargv, *ptr;
|
|
197 |
VALUE rbargv, *ptr, tmp;
|
188 |
198 |
|
189 |
199 |
__initial_thread = (gl_thread_t) gl_thread_self();
|
190 |
200 |
|
191 |
201 |
rbargv = rb_const_get(rb_cObject, rb_intern("ARGV"));
|
192 |
|
argc = RARRAY(rbargv)->len + 1;
|
|
202 |
argc = RARRAY_LEN(rbargv) + 1;
|
193 |
203 |
|
194 |
204 |
if ( argc + 1 < 0 )
|
195 |
205 |
throw PreludeError("Invalid argc length");
|
... | ... | |
198 |
208 |
if ( ! argv )
|
199 |
209 |
throw PreludeError("Allocation failure");
|
200 |
210 |
|
201 |
|
argv[0] = STR2CSTR(rb_gv_get("$0"));
|
|
211 |
tmp = rb_gv_get("$0");
|
|
212 |
argv[0] = StringValuePtr(tmp);
|
202 |
213 |
|
203 |
|
ptr = RARRAY(rbargv)->ptr;
|
204 |
|
for ( ptr = RARRAY(rbargv)->ptr, _i = 1; _i < argc; _i++, ptr++ )
|
205 |
|
argv[_i] = STR2CSTR(*ptr);
|
|
214 |
ptr = RARRAY_PTR(rbargv);
|
|
215 |
for ( ptr = RARRAY_PTR(rbargv), _i = 1; _i < argc; _i++, ptr++ )
|
|
216 |
argv[_i] = StringValuePtr(*ptr);
|
206 |
217 |
|
207 |
218 |
argv[_i] = NULL;
|
208 |
219 |
|