rjb 1.0.0-mswin32

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,183 @@
1
+ Tue Aug 1 arton
2
+ *load.c
3
+ *rjb.c
4
+ change load pathname of the bridge class.
5
+ *post-install.rb
6
+ add for remove previous installed rjb.so.
7
+ *rjb.rake
8
+ add for build Gem.
9
+ *rjb.rb
10
+ for preparing the pathname constant of the bridge class.
11
+ *depend
12
+ chage binary name from rjb.so to rjbcore.so
13
+ *extconf.rb
14
+ chage binary name from rjb.so to rjbcore.so
15
+
16
+ Mon Jul 31 arton
17
+ *load.c
18
+ fix buffer allocation
19
+
20
+ Sun Jul 16 (Jun 22) Kuwashima and arton
21
+ *rjb.c
22
+ version 0.2.8
23
+ *MANIFEST
24
+ *depend
25
+ *load.c
26
+ *rjbexception.c
27
+ change jni.h to jniwrap.h.
28
+ change the bridge class's header according to JDK 5.0's javah.
29
+ *jniwrap.h
30
+ wrap jni.h for Cygin
31
+
32
+ Sat Jun 10 14:10:05 2006 arton
33
+ *rjb.c
34
+ version 0.2.7
35
+ support an array of arrays from ruby to java.
36
+
37
+ Mon May 8 08:52:12 2006 arton
38
+ *load.c
39
+ revision 5
40
+ support both Intel and PPC Mac.
41
+ Patched version was contributed by Demetrius Nunes.
42
+
43
+ Wed Apr 12 03:57:12 2006 arton
44
+ *rjb.c
45
+ version 0.2.6
46
+ support an array of arrays.
47
+ *test.rb
48
+ add an array of arrays test, some tests are contributed by Darren Day.
49
+ *Test.java
50
+ add a test method that returns an array of arrays, some tests are
51
+ contributed by Darren Day.
52
+
53
+ Sat Dec 24 18:56:38 2005 arton
54
+ *rjb.c
55
+ version 0.2.5
56
+ release String, Float, Array object after method call.
57
+ *gctest.rb
58
+ add for String object gc test
59
+
60
+ Mon Sep 19 01:09:30 2005 arton
61
+ *rjb.c
62
+ version 0.2.4
63
+ use null instead of empty string when String argument is nil
64
+ omit unused local variable from jstring2val
65
+ *test.rb
66
+ add null string test (bug since utf-8 support)
67
+
68
+ Tue Jun 28 01:57:07 2005 arton
69
+ *rjb.c
70
+ version 0.2.3
71
+ convert result object to imported class if object is an instance of Class
72
+ call Class#forName if argument count is 1
73
+ *test.rb
74
+ add test_importobj contributed by Mr. Kuwashima, thanks.
75
+
76
+ Mon Jun 27 20:30:50 2005 arton
77
+ treat Class.forName as Rjb::import
78
+ *rjb.c
79
+ version 0.2.2
80
+ add method 'forName' into imported Class object
81
+ if pass imported object to JVM, extract Class object from ruby object
82
+ *test.rb
83
+ add above tests
84
+
85
+ Sat Jun 25 05:58:36 2005 arton
86
+ most bugs were reported by Mr. Micael Weller, thanks.
87
+ *rjb.c
88
+ version 0.2.1
89
+ correct derived static method search
90
+ search class methods then class's instance methods when called by class
91
+ avoid register non capitalized named constants into constants table
92
+ correct capitalized named method search
93
+ *riconv.c
94
+ never call iconv if $KCODE is nil
95
+ *load.c
96
+ using path separator ; for cygwin (by Ryugate)
97
+
98
+ Sun Apr 24 05:26:16 2005 arton
99
+ *rb.c
100
+ version 0.2.0
101
+ delete localref if globalref was created.
102
+ load can take the second argument for jvm
103
+ *load.c
104
+ load can take the second argument for jvm
105
+
106
+ Mon Jan 17 02:40:21 2005 arton
107
+ *rjb.c
108
+ add 'throw' module function.
109
+ move java exception handling functions into newly created rjbexception.c
110
+ *rjb.h
111
+ declations for rjb.c and rjbexception.c
112
+ *rjbexception.c
113
+ java exception handling functions, and 'throw' module function.
114
+ *test.rb
115
+ adding throw test.
116
+
117
+ Wed Jan 12 00:01:08 2005 Kaspar Schiess and arton
118
+ *rjb.c
119
+ correct Rjb::load parameter evaluation (classpath).
120
+ - many thanks to Mr.Schiess.
121
+
122
+ Sun Nov 21 02:51:43 2004 Kuwashima and arton
123
+ *rjb.c
124
+ move dbcs-utf-8 auto conversion feature into riconv.?
125
+ remove JNI version argument from Rjb::load. (bug reported by Mr.Tateishi)
126
+ *load.c
127
+ correct CLASSPATH setting (bad environment name).(bug reported by Mr.Tateishi)
128
+ *riconv.c riconv.h (contributed by Mr.Kuwashima)
129
+ DBCS - utf-8 auto conversion functions.
130
+ *depend MANIFEST
131
+ add riconv.?
132
+ - many tanks to Mr.Kuwashima and Mr.Tateishi.
133
+
134
+ Tue Oct 5 23:08:59 2004 Kuwashima and arton
135
+ *test.rb
136
+ add kanji conversion test
137
+ *rjb.c
138
+ add dbcs(sjis and euc-jp) - utf-8 auto conversion feature.
139
+ the patch was contributed by Mr.Kuwashima, many thanks.
140
+
141
+ Sun Oct 3 18:24:42 2004 arton
142
+ *load.c
143
+ JNIEnv* now using local variable instead of global one.
144
+ Because AWT event use a worker thread, and JNI need thread's owned JNIEnv.
145
+ *rjb.c
146
+ JNIEnv* now using local variable instead of global one.
147
+ Because AWT event use a worker thread, and JNI need thread's owned JNIEnv.
148
+ This change was suggested by Mr.Kuwashima, he also tested the behavior,
149
+ and gave me some test codes.
150
+ and attach_current_thread is from Mr.Kuwashima's patch.
151
+ Many thanks to Mr.Kuwashima.
152
+
153
+ Sat Sep 25 03:25:45 2004 arton
154
+ *rjb.c
155
+ implements interface's method argument conversion.
156
+ *test.rb
157
+ add Comparable test (interface with method arguments)
158
+ *Test.java
159
+ add Comparable test method.
160
+
161
+ Wed Sep 22 02:30:15 2004 arton
162
+ *rjb.c
163
+ correct constants load, using mid-class.
164
+ convert null string to nil
165
+
166
+ Wed Sep 22 00:05:32 2004 arton
167
+ *rjb.c
168
+ correct ruby type checking. If the parameter type is java.lang.String, rjb instance is always accepted.
169
+
170
+ Mon Sep 20 22:02:53 2004 arton
171
+ *rjb.c
172
+ checking method/constructor signature with class when the argument is rjb's instance.
173
+ Sun Sep 19 00:54:35 2004 arton
174
+ *rjb.c
175
+ convert Java exception to Ruby's StandardError derived class.
176
+ checking method/constructor signature when invoking if no signatur argument is supplied.
177
+ adding field accessor.
178
+
179
+ Sun Sep 12 21:42:00 2004 arton
180
+ *rjb.c
181
+ call exception description when verbose = true.
182
+ correct recursive import call (for Boolean).
183
+ corrent method not found message creation.
@@ -0,0 +1,39 @@
1
+ /*
2
+ * Rjb - Ruby <-> Java Bridge
3
+ * Copyright(c) 2004 arton
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * $Id: RBridge.java 2 2006-04-11 19:04:40Z arton $
16
+ * $Log: RBridge.java,v $
17
+ * Revision 1.2 2004/06/19 09:05:00 arton
18
+ * delete debug lines
19
+ *
20
+ * Revision 1.1 2004/06/19 09:00:19 arton
21
+ * Initial revision
22
+ *
23
+ */
24
+ package jp.co.infoseek.hp.arton.rjb;
25
+ import java.lang.reflect.InvocationHandler;
26
+ import java.lang.reflect.Method;
27
+ import java.lang.reflect.Proxy;
28
+
29
+ public class RBridge implements InvocationHandler {
30
+ public Object register(Class itf) {
31
+ return Proxy.newProxyInstance(itf.getClassLoader(),
32
+ new Class[] { itf }, this);
33
+ }
34
+ public Object invoke(Object proxy, Method method, Object[] args)
35
+ throws Throwable {
36
+ return call(method.getName(), proxy, args);
37
+ }
38
+ private native Object call(String methodName, Object target, Object[] args);
39
+ }
@@ -0,0 +1,23 @@
1
+ riconv.o : riconv.c $(hdrdir)/ruby.h $(hdrdir)/config.h $(hdrdir)/defines.h jp_co_infoseek_hp_arton_rjb_RBridge.h
2
+ rjb.o : rjb.c $(hdrdir)/ruby.h $(hdrdir)/config.h $(hdrdir)/defines.h jp_co_infoseek_hp_arton_rjb_RBridge.h riconv.h rjb.h
3
+ rjbexception.o : rjbexception.c $(hdrdir)/ruby.h $(hdrdir)/config.h $(hdrdir)/defines.h jp_co_infoseek_hp_arton_rjb_RBridge.h riconv.h rjb.h
4
+ load.o : load.c $(hdrdir)/ruby.h $(hdrdir)/config.h $(hdrdir)/defines.h jp_co_infoseek_hp_arton_rjb_RBridge.h
5
+ jp_co_infoseek_hp_arton_rjb_RBridge.h : jniwrap.h ../data/rjb/jp/co/infoseek/hp/arton/rjb/RBridge.class
6
+ javah -classpath ../data/rjb jp.co.infoseek.hp.arton.rjb.RBridge
7
+ ../data/rjb/jp/co/infoseek/hp/arton/rjb/RBridge.class : RBridge.java
8
+ mkdir -p ../data/rjb/jp/co/infoseek/hp/arton/rjb
9
+ javac -d ../data/rjb RBridge.java
10
+ test : rjbcore.so ../test/jp/co/infoseek/hp/arton/rjb/Test.class ../test/jp/co/infoseek/hp/arton/rjb/IBase.class ../test/jp/co/infoseek/hp/arton/rjb/Base.class ../test/jp/co/infoseek/hp/arton/rjb/ExtBase.class
11
+ ruby ../test/test.rb
12
+ ../test/jp/co/infoseek/hp/arton/rjb/Test.class : ../test/Test.java
13
+ javac ../test/Test.java
14
+ $(RUBY) -r fileutils -e 'FileUtils.mkdir_p "../test/jp/co/infoseek/hp/arton/rjb";FileUtils.mv("../test/Test.class", "../test/jp/co/infoseek/hp/arton/rjb")'
15
+ ../test/jp/co/infoseek/hp/arton/rjb/IBase.class : ../test/IBase.java
16
+ javac ../test/IBase.java
17
+ $(RUBY) -r fileutils -e 'FileUtils.mkdir_p "../test/jp/co/infoseek/hp/arton/rjb";FileUtils.mv("../test/IBase.class", "../test/jp/co/infoseek/hp/arton/rjb")'
18
+ ../test/jp/co/infoseek/hp/arton/rjb/Base.class : ../test/Base.java ../test/jp/co/infoseek/hp/arton/rjb/IBase.class
19
+ javac -classpath ../test ../test/Base.java
20
+ $(RUBY) -r fileutils -e 'FileUtils.mkdir_p "../test/jp/co/infoseek/hp/arton/rjb";FileUtils.mv("../test/Base.class", "../test/jp/co/infoseek/hp/arton/rjb")'
21
+ ../test/jp/co/infoseek/hp/arton/rjb/ExtBase.class : ../test/ExtBase.java
22
+ javac -classpath ../test ../test/ExtBase.java
23
+ $(RUBY) -r fileutils -e 'FileUtils.mkdir_p "../test/jp/co/infoseek/hp/arton/rjb";FileUtils.mv("../test/ExtBase.class", "../test/jp/co/infoseek/hp/arton/rjb")'
@@ -0,0 +1,32 @@
1
+ /*
2
+ * Rjb - Ruby <-> Java Bridge
3
+ * Copyright(c) 2006 Kuwashima
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * $Id:$
16
+ */
17
+ #ifndef _Included_jniwrap
18
+ #define _Included_jniwrap
19
+ #ifdef __cplusplus
20
+ extern "C" {
21
+ #endif
22
+
23
+ #if defined(__GNUC__) && (defined(__CYGWIN32__) || defined(__MINGW32__))
24
+ typedef long long __int64;
25
+ #endif
26
+
27
+ #include <jni.h>
28
+
29
+ #ifdef __cplusplus
30
+ }
31
+ #endif
32
+ #endif
@@ -0,0 +1,21 @@
1
+ /* DO NOT EDIT THIS FILE - it is machine generated */
2
+ #include <jni.h>
3
+ /* Header for class jp_co_infoseek_hp_arton_rjb_RBridge */
4
+
5
+ #ifndef _Included_jp_co_infoseek_hp_arton_rjb_RBridge
6
+ #define _Included_jp_co_infoseek_hp_arton_rjb_RBridge
7
+ #ifdef __cplusplus
8
+ extern "C" {
9
+ #endif
10
+ /*
11
+ * Class: jp_co_infoseek_hp_arton_rjb_RBridge
12
+ * Method: call
13
+ * Signature: (Ljava/lang/String;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
14
+ */
15
+ JNIEXPORT jobject JNICALL Java_jp_co_infoseek_hp_arton_rjb_RBridge_call
16
+ (JNIEnv *, jobject, jstring, jobject, jobjectArray);
17
+
18
+ #ifdef __cplusplus
19
+ }
20
+ #endif
21
+ #endif
@@ -0,0 +1,250 @@
1
+ /*
2
+ * Rjb - Ruby <-> Java Bridge
3
+ * Copyright(c) 2004,2005,2006 arton
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * $Id: load.c 14 2006-08-01 13:51:41Z arton $
16
+ */
17
+
18
+ #include <stdlib.h>
19
+ #include <stdio.h>
20
+ #include "ruby.h"
21
+ #include "intern.h"
22
+ #include "st.h"
23
+ #include "util.h"
24
+ #include "jniwrap.h"
25
+ #include "jp_co_infoseek_hp_arton_rjb_RBridge.h"
26
+ #include "rjb.h"
27
+
28
+ #define JVM_TYPE "client"
29
+
30
+ #if defined(_WIN32) || defined(__CYGWIN__)
31
+ #if defined(__CYGWIN__)
32
+ #define JVMDLL "%s/jre/bin/%s/jvm.dll"
33
+ #define DIRSEPARATOR '/'
34
+ #else
35
+ #define JVMDLL "%s\\jre\\bin\\%s\\jvm.dll"
36
+ #define DIRSEPARATOR '\\'
37
+ #endif
38
+ #define CLASSPATH_SEP ';'
39
+ #elif defined(__APPLE__) && defined(__MACH__)
40
+ #define JVMDLL "%s/Libraries/libjvm_compat.dylib"
41
+ #define DIRSEPARATOR '/'
42
+ #define CLASSPATH_SEP ':'
43
+ #else /* defined(_WIN32) || defined(__CYGWIN__) */
44
+ #if defined(__sparc_v9__)
45
+ #define ARCH "sparcv9"
46
+ #elif defined(__sparc__)
47
+ #define ARCH "sparc"
48
+ #elif defined(i586) || defined(__i386__)
49
+ #define ARCH "i386"
50
+ #endif
51
+ #ifndef ARCH
52
+ #include <sys/systeminfo.h>
53
+ #endif
54
+ #define JVMDLL "%s/jre/lib/%s/%s/libjvm.so"
55
+ #define DIRSEPARATOR '/'
56
+ #define CLASSPATH_SEP ':'
57
+ #endif
58
+
59
+ typedef void (*GETDEFAULTJAVAVMINITARGS)(void*);
60
+ typedef int (*CREATEJAVAVM)(JavaVM**, void**, void*);
61
+
62
+ extern JavaVM* jvm;
63
+ extern jclass rbridge;
64
+ extern jmethodID register_bridge;
65
+ static VALUE jvmdll = Qnil;
66
+ static VALUE GetDefaultJavaVMInitArgs;
67
+ static VALUE CreateJavaVM;
68
+
69
+ /*
70
+ * not completed, only valid under some circumstances.
71
+ */
72
+ static VALUE load_jvm(char* jvmtype)
73
+ {
74
+ char* libpath;
75
+ char* java_home;
76
+ char* jh;
77
+ VALUE dl;
78
+
79
+ #if defined(__APPLE__) && defined(__MACH__)
80
+ jh = "/System/Library/Frameworks/JavaVM.framework";
81
+ #else
82
+ jh = getenv("JAVA_HOME");
83
+ #endif
84
+ if (!jh)
85
+ {
86
+ return Qnil;
87
+ }
88
+ java_home = ALLOCA_N(char, strlen(jh) + 1);
89
+ strcpy(java_home, jh);
90
+ if (*(java_home + strlen(jh) - 1) == DIRSEPARATOR)
91
+ {
92
+ *(java_home + strlen(jh) - 1) = '\0';
93
+ }
94
+ #if defined(_WIN32) || defined(__CYGWIN__)
95
+ libpath = ALLOCA_N(char, sizeof(JVMDLL) + strlen(java_home)
96
+ + strlen(jvmtype) + 1);
97
+ sprintf(libpath, JVMDLL, java_home, jvmtype);
98
+ #elif defined(__APPLE__) && defined(__MACH__)
99
+ libpath = ALLOCA_N(char, sizeof(JVMDLL) + strlen(java_home) + 1);
100
+ sprintf(libpath, JVMDLL, java_home);
101
+ #else /* not Windows / MAC OS-X */
102
+ libpath = ALLOCA_N(char, sizeof(JVMDLL) + strlen(java_home)
103
+ + strlen(ARCH) + strlen(jvmtype) + 1);
104
+ sprintf(libpath, JVMDLL, java_home, ARCH, jvmtype);
105
+ #endif
106
+ rb_require("dl");
107
+ dl = rb_eval_string("DL");
108
+ jvmdll = rb_funcall(dl, rb_intern("dlopen"), 1, rb_str_new2(libpath));
109
+ GetDefaultJavaVMInitArgs = rb_funcall(jvmdll, rb_intern("sym"),
110
+ 2, rb_str_new2("JNI_GetDefaultJavaVMInitArgs"),
111
+ rb_str_new2("0p"));
112
+ CreateJavaVM = rb_funcall(jvmdll, rb_intern("sym"),
113
+ 2, rb_str_new2("JNI_CreateJavaVM"),
114
+ rb_str_new2("pppp"));
115
+ return Qtrue;
116
+ }
117
+
118
+ int load_bridge(JNIEnv* jenv)
119
+ {
120
+ JNINativeMethod nmethod[1];
121
+ jbyte buff[8192];
122
+ char* bridge;
123
+ int len;
124
+ FILE* f;
125
+ jclass loader = (*jenv)->FindClass(jenv, "java/lang/ClassLoader");
126
+ jmethodID getSysLoader = (*jenv)->GetStaticMethodID(jenv, loader,
127
+ "getSystemClassLoader", "()Ljava/lang/ClassLoader;");
128
+ jobject iloader = (*jenv)->CallStaticObjectMethod(jenv, loader, getSysLoader);
129
+ VALUE v = rb_const_get_at(rb_const_get(rb_cObject, rb_intern("RjbConf")),
130
+ rb_intern("BRIDGE_FILE"));
131
+ bridge = StringValuePtr(v);
132
+ #if defined(DOSISH)
133
+ bridge = ALLOCA_N(char, strlen(bridge) + 8);
134
+ strcpy(bridge, StringValuePtr(v));
135
+ for (len = 0; bridge[len]; len++)
136
+ {
137
+ if (bridge[len] == '/')
138
+ {
139
+ bridge[len] = '\\';
140
+ }
141
+ }
142
+ #endif
143
+ f = fopen(bridge, "rb");
144
+ if (f == NULL)
145
+ {
146
+ return -1;
147
+ }
148
+ len = fread(buff, 1, sizeof(buff), f);
149
+ fclose(f);
150
+ rbridge = (*jenv)->DefineClass(jenv,
151
+ "jp/co/infoseek/hp/arton/rjb/RBridge", iloader, buff, len);
152
+ if (rbridge == NULL)
153
+ {
154
+ check_exception(jenv, 1);
155
+ }
156
+ register_bridge = (*jenv)->GetMethodID(jenv, rbridge, "register",
157
+ "(Ljava/lang/Class;)Ljava/lang/Object;");
158
+ nmethod[0].name = "call";
159
+ nmethod[0].signature = "(Ljava/lang/String;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;";
160
+ nmethod[0].fnPtr = Java_jp_co_infoseek_hp_arton_rjb_RBridge_call;
161
+ (*jenv)->RegisterNatives(jenv, rbridge, nmethod, 1);
162
+ rbridge = (*jenv)->NewGlobalRef(jenv, rbridge);
163
+ return 0;
164
+ }
165
+
166
+ int create_jvm(JNIEnv** pjenv, JavaVMInitArgs* vm_args, char* userpath, VALUE argv)
167
+ {
168
+ static JavaVMOption soptions[] = {
169
+ #if defined(__sparc_v9__) || defined(__sparc__)
170
+ { "-Xusealtsigs", NULL },
171
+ #elif defined(linux) || defined(__linux__)
172
+ { "-Xrs", NULL },
173
+ #elif defined(__APPLE__) && defined(_ARCH_PPC)
174
+ { "-Xrs", NULL },
175
+ #endif
176
+ #if defined(SHOW_JAVAGC)
177
+ { "-verbose:gc", NULL },
178
+ #endif
179
+ { "DUMMY", NULL }, /* for classpath count */
180
+ };
181
+ char* newpath;
182
+ VALUE ptr;
183
+ int len;
184
+ int result;
185
+ GETDEFAULTJAVAVMINITARGS initargs;
186
+ CREATEJAVAVM createjavavm;
187
+ JavaVMOption* options;
188
+ int optlen;
189
+ int i;
190
+ VALUE optval;
191
+
192
+ if (jvmdll == Qnil)
193
+ {
194
+ if (load_jvm(JVM_TYPE) == Qnil)
195
+ {
196
+ return -1;
197
+ }
198
+ }
199
+
200
+ ptr = rb_funcall(GetDefaultJavaVMInitArgs, rb_intern("to_i"), 0);
201
+ initargs = *(GETDEFAULTJAVAVMINITARGS*)FIX2INT(ptr);
202
+ initargs(vm_args);
203
+ len = strlen(userpath);
204
+ if (getenv("CLASSPATH"))
205
+ {
206
+ len += strlen(getenv("CLASSPATH"));
207
+ }
208
+ newpath = ALLOCA_N(char, len + 32);
209
+ if (getenv("CLASSPATH"))
210
+ {
211
+ sprintf(newpath, "-Djava.class.path=%s%c%s",
212
+ userpath, CLASSPATH_SEP, getenv("CLASSPATH"));
213
+ }
214
+ else
215
+ {
216
+ sprintf(newpath, "-Djava.class.path=%s", userpath);
217
+ }
218
+ optlen = 0;
219
+ if (!NIL_P(argv))
220
+ {
221
+ optlen += RARRAY(argv)->len;
222
+ }
223
+ optlen += COUNTOF(soptions);
224
+ options = ALLOCA_N(JavaVMOption, optlen);
225
+ options->optionString = newpath;
226
+ options->extraInfo = NULL;
227
+ for (i = 1; i < COUNTOF(soptions); i++)
228
+ {
229
+ *(options + i) = soptions[i - 1];
230
+ }
231
+ for (; i < optlen; i++)
232
+ {
233
+ optval = rb_ary_entry(argv, i - COUNTOF(soptions));
234
+ Check_Type(optval, T_STRING);
235
+ (options + i)->optionString = StringValueCStr(optval);
236
+ (options + i)->extraInfo = NULL;
237
+ }
238
+ vm_args->nOptions = optlen;
239
+ vm_args->options = options;
240
+ vm_args->ignoreUnrecognized = JNI_TRUE;
241
+ ptr = rb_funcall(CreateJavaVM, rb_intern("to_i"), 0);
242
+ createjavavm = *(CREATEJAVAVM*)FIX2INT(ptr);
243
+ result = createjavavm(&jvm, (void**)pjenv, vm_args);
244
+ if (!result)
245
+ {
246
+ result = load_bridge(*pjenv);
247
+ }
248
+ return result;
249
+ }
250
+