[#6954] Why isn't Perl highly orthogonal? — Terrence Brannon <brannon@...>

27 messages 2000/12/09

[#7022] Re: Ruby in the US — Kevin Smith <kevinbsmith@...>

> Is it possible for the US to develop corporate

36 messages 2000/12/11
[#7633] Re: Ruby in the US — Dave Thomas <Dave@...> 2000/12/19

tonys@myspleenklug.on.ca (tony summerfelt) writes:

[#7636] Re: Ruby in the US — "Joseph McDonald" <joe@...> 2000/12/19

[#7704] Re: Ruby in the US — Jilani Khaldi <jilanik@...> 2000/12/19

> > first candidates would be mysql and postgressql because source is

[#7705] Code sample for improvement — Stephen White <steve@...> 2000/12/19

During an idle chat with someone on IRC, they presented some fairly

[#7750] Re: Code sample for improvement — "Guy N. Hurst" <gnhurst@...> 2000/12/20

Stephen White wrote:

[#7751] Re: Code sample for improvement — David Alan Black <dblack@...> 2000/12/20

Hello --

[#7755] Re: Code sample for improvement — "Guy N. Hurst" <gnhurst@...> 2000/12/20

David Alan Black wrote:

[#7758] Re: Code sample for improvement — Stephen White <steve@...> 2000/12/20

On Wed, 20 Dec 2000, Guy N. Hurst wrote:

[#7759] Next amusing problem: talking integers (was Re: Code sample for improvement) — David Alan Black <dblack@...> 2000/12/20

On Wed, 20 Dec 2000, Stephen White wrote:

[#7212] New User Survey: we need your opinions — Dave Thomas <Dave@...>

16 messages 2000/12/14

[#7330] A Java Developer's Wish List for Ruby — "Richard A.Schulman" <RichardASchulman@...>

I see Ruby as having a very bright future as a language to

22 messages 2000/12/15

[#7354] Ruby performance question — Eric Crampton <EricCrampton@...>

I'm parsing simple text lines which look like this:

21 messages 2000/12/15
[#7361] Re: Ruby performance question — Dave Thomas <Dave@...> 2000/12/15

Eric Crampton <EricCrampton@worldnet.att.net> writes:

[#7367] Re: Ruby performance question — David Alan Black <dblack@...> 2000/12/16

On Sat, 16 Dec 2000, Dave Thomas wrote:

[#7371] Re: Ruby performance question — "Joseph McDonald" <joe@...> 2000/12/16

[#7366] GUIs for Rubies — "Conrad Schneiker" <schneik@...>

Thought I'd switch the subject line to the subject at hand.

22 messages 2000/12/16

[#7416] Re: Ruby IDE (again) — Kevin Smith <kevins14@...>

>> >> I would contribute to this project, if it

17 messages 2000/12/16
[#7422] Re: Ruby IDE (again) — Holden Glova <dsafari@...> 2000/12/16

-----BEGIN PGP SIGNED MESSAGE-----

[#7582] New to Ruby — takaoueda@...

I have just started learning Ruby with the book of Thomas and Hunt. The

24 messages 2000/12/18

[#7604] Any corrections for Programming Ruby — Dave Thomas <Dave@...>

12 messages 2000/12/18

[#7737] strange border-case Numeric errors — "Brian F. Feldman" <green@...>

I haven't had a good enough chance to familiarize myself with the code in

19 messages 2000/12/20

[#7801] Is Ruby part of any standard GNU Linux distributions? — "Pete McBreen, McBreen.Consulting" <mcbreenp@...>

Anybody know what it would take to get Ruby into the standard GNU Linux

15 messages 2000/12/20

[#7938] Re: defined? problem? — Kevin Smith <sent@...>

matz@zetabits.com (Yukihiro Matsumoto) wrote:

26 messages 2000/12/22
[#7943] Re: defined? problem? — Dave Thomas <Dave@...> 2000/12/22

Kevin Smith <sent@qualitycode.com> writes:

[#7950] Re: defined? problem? — Stephen White <steve@...> 2000/12/22

On Fri, 22 Dec 2000, Dave Thomas wrote:

[#7951] Re: defined? problem? — David Alan Black <dblack@...> 2000/12/22

On Fri, 22 Dec 2000, Stephen White wrote:

[#7954] Re: defined? problem? — Dave Thomas <Dave@...> 2000/12/22

David Alan Black <dblack@candle.superlink.net> writes:

[#7975] Re: defined? problem? — David Alan Black <dblack@...> 2000/12/22

Hello --

[#7971] Hash access method — Ted Meng <ted_meng@...>

Hi,

20 messages 2000/12/22

[#8030] Re: Basic hash question — ts <decoux@...>

>>>>> "B" == Ben Tilly <ben_tilly@hotmail.com> writes:

15 messages 2000/12/24
[#8033] Re: Basic hash question — "David A. Black" <dblack@...> 2000/12/24

On Sun, 24 Dec 2000, ts wrote:

[#8178] Inexplicable core dump — "Nathaniel Talbott" <ntalbott@...>

I have some code that looks like this:

12 messages 2000/12/28

[#8196] My first impression of Ruby. Lack of overloading? (long) — jmichel@... (Jean Michel)

Hello,

23 messages 2000/12/28

[#8198] Re: Ruby cron scheduler for NT available — "Conrad Schneiker" <schneik@...>

John Small wrote:

14 messages 2000/12/28

[#8287] Re: speedup of anagram finder — "SHULTZ,BARRY (HP-Israel,ex1)" <barry_shultz@...>

> -----Original Message-----

12 messages 2000/12/29

[ruby-talk:7040] Re: Ruby as extension lang for Java app.

From: Yasushi Shoji <yashi@...>
Date: 2000-12-11 10:58:57 UTC
List: ruby-talk #7040
At Mon, 11 Dec 2000 13:25:22 +0900,
Yukihiro Matsumoto wrote:

> Anyway, thanks to Wes Nakamura, who created new java.c.

a few more steps.  it might save 2 sec.

$ LD_LIBRARY_PATH='/opt/IBMJava2-13/jre/bin:/opt/IBMJava2-13/jre/bin/classic' ~/ruby/ruby -v hello.rb
ruby 1.6.2 (2000-12-08) [i686-linux]
Hello World!
--
         yashi

--- extconf.rb~	Mon Dec 11 05:50:25 2000
+++ extconf.rb	Mon Dec 11 03:01:18 2000
@@ -1,3 +1,5 @@
+require 'mkmf'
+
 # extconf.rb
 
 # cache file for JAVA_HOME
@@ -24,13 +26,18 @@
 end
 
 def get_javalib(java_home)
-  if FileTest::directory?("#{java_home}/lib/Linux/green_threads")
-    # Sergey Nikitin's version
-    return "#{java_home}/lib/Linux/green_threads"
-  else
-    arch = `arch`.strip
-    return "#{java_home}/lib/#{arch}/green_threads"
-  end
+  # Sergey Nikitin's version
+  dir = "#{java_home}/lib/Linux/green_threads"
+  return dir if FileTest::directory?(dir)
+
+  # Sun JVM
+  arch = `arch`.strip
+  dir = "#{java_home}/lib/#{arch}/green_threads"
+  return dir if FileTest.directory?(dir)
+
+  # IBM JVM
+  dir = "#{java_home}/bin"
+  return dir if FileTest.exist?(dir + '/libjava.so')
 end
 
 $JAVA_HOME = get_javahome
@@ -42,6 +49,7 @@
 end
 
 $CFLAGS = "-I#{$JAVA_HOME}/include -I#{$JAVA_HOME}/include/genunix"
+$CFLAGS = "-I#{$JAVA_HOME}/../include " + $CFLAGS if /IBM/ =~ $JAVA_HOME
 
 $JAVA_LIB = get_javalib($JAVA_HOME)
 print "JAVA_LIB: ", $JAVA_LIB, "\n"
@@ -49,7 +57,10 @@
 $LDFLAGS = "-L#{$JAVA_LIB} -L/usr/X11R6/lib -Wl,-rpath #{$JAVA_LIB}"
 
 if have_header("jni.h") and
-    have_library("java", "JNI_CreateJavaVM")
+    (unless have_library("java", "JNI_CreateJavaVM")
+       $LDFLAGS = "-L#{$JAVA_LIB}/classic " + $LDFLAGS
+       have_library("jvm", "JNI_CreateJavaVM")
+     end)
   have_library("X11", "XCreateWindow")
   have_library("Xext", "XShmQueryExtension")
   have_library("Xt", "XtOpenApplication")

--- java.c~	Mon Dec 11 05:51:54 2000
+++ java.c	Mon Dec 11 05:42:47 2000
@@ -3,9 +3,6 @@
 
 #define JRI_VERSION "0.5"
 
-#define TRUE Qtrue
-#define FALSE Qfalse
-
 #include <string.h>
 #include <jni.h>
 #include "ruby.h"
@@ -762,9 +759,9 @@
 	    elements = (*jnienv)->GetBooleanArrayElements(jnienv, jary, 0);
 	    for (i = 0; i < len; i++) {
 		if (elements[i])
-		    rb_ary_push(result, TRUE);
+		    rb_ary_push(result, Qtrue);
 		else
-		    rb_ary_push(result, FALSE);
+		    rb_ary_push(result, Qfalse);
 	    }
 	    (*jnienv)->ReleaseBooleanArrayElements(jnienv, jary, elements, 0);
 	    break;
@@ -1154,9 +1151,9 @@
 		ret = (*jnienv)->CallStaticBooleanMethodA(jnienv, cls,
 							  mid, args);
 		if (ret)
-		    result = TRUE;
+		    result = Qtrue;
 		else
-		    result = FALSE;
+		    result = Qfalse;
 		break;
 	    }
 	case 'B':
@@ -1402,9 +1399,9 @@
 		ret = (*jnienv)->CallBooleanMethodA(jnienv, obj,
 						    mid, args);
 		if (ret)
-		    result = TRUE;
+		    result = Qtrue;
 		else
-		    result = FALSE;
+		    result = Qfalse;
 		break;
 	    }
 	case 'B':
@@ -1477,8 +1474,8 @@
 	rb_raise(rb_eArgError, "wrong # of arguments");
     }
     self = RARRAY(args)->ptr[0];
-    Check_Type(RARRAY(args)->ptr[1], T_FIXNUM);
-    method_name = rb_id2name(NUM2INT(RARRAY(args)->ptr[1]));
+    Check_Type(RARRAY(args)->ptr[1], T_SYMBOL);
+    method_name = rb_id2name(SYM2ID(RARRAY(args)->ptr[1]));
     argc = RARRAY(args)->len - 2;
     argv = RARRAY(args)->ptr + 2;
 
@@ -1495,8 +1492,9 @@
     if (argc == 0) {
 	rb_raise(rb_eArgError, "wrong # of arguments");
     }
-    Check_Type(argv[0], T_FIXNUM);
-    method_name = rb_id2name(NUM2INT(argv[0]));
+    Check_Type(argv[0], T_SYMBOL);
+    method_name = rb_id2name(SYM2ID(argv[0]));
+    
     args = rb_ary_new();
     rb_ary_push(args, self);
     for (i = 0; i < argc; i++)
@@ -1545,9 +1543,9 @@
 	    jboolean ret;
 	    ret = (*jnienv)->GetStaticBooleanField(jnienv, jcls, fid);
 	    if (ret)
-		result = TRUE;
+		result = Qtrue;
 	    else
-		result = FALSE;
+		result = Qfalse;
 	    break;
 	}
     case 'B':
@@ -1643,9 +1641,9 @@
 	    jboolean ret;
 	    ret = (*jnienv)->GetBooleanField(jnienv, jobj, fid);
 	    if (ret)
-		result = TRUE;
+		result = Qtrue;
 	    else
-		result = FALSE;
+		result = Qfalse;
 	    break;
 	}
     case 'B':
@@ -1918,19 +1916,19 @@
     jobject jself, jother;
 
     if (!rb_obj_is_kind_of(other, cJavaObject))
-	return FALSE;
+	return Qfalse;
 
     mid = (*jnienv)->GetMethodID(jnienv,
 				 extract_jclass(CLASS_OF(self)),
 				 "equals",
 				 "(Ljava/lang/Object;)Z");
-    if (mid == 0) return FALSE;
+    if (mid == 0) return Qfalse;
     jself = extract_jobject(self);
     jother = extract_jobject(other);
     if ((*jnienv)->CallBooleanMethod(jnienv, jself, mid, jother))
-	return TRUE;
+	return Qtrue;
     else
-	return FALSE;
+	return Qfalse;
 }
 
 static VALUE jobject_to_string(VALUE self)
@@ -1954,7 +1952,7 @@
     jclass jcls;
     jobject jobj;
 
-    if (!rb_obj_is_kind_of(self, cJavaObject)) return FALSE;
+    if (!rb_obj_is_kind_of(self, cJavaObject)) return Qfalse;
     if (TYPE(clazz) != T_CLASS)
 	rb_raise(eNoClassError,
 	      "%s is not a class",
@@ -1966,9 +1964,9 @@
 	      RSTRING(rb_inspect(clazz))->ptr);
     jobj = extract_jobject(self);
     if ((*jnienv)->IsInstanceOf(jnienv, jobj, jcls))
-	return TRUE;
+	return Qtrue;
     else
-	return FALSE;
+	return Qfalse;
 }
 
 static VALUE jobject_s_methods(VALUE self)
@@ -1976,7 +1974,7 @@
     VALUE argv[1];
     VALUE methods, hash, java_methods;
 
-    argv[0] = TRUE;
+    argv[0] = Qtrue;
     methods = rb_class_instance_methods(1, argv, CLASS_OF(self));
     hash = rb_const_get(self, rb_intern("STATIC_METHODS"));
     java_methods = rb_funcall(hash, rb_intern("keys"), 0);
@@ -2001,7 +1999,7 @@
     VALUE argv[1];
     VALUE methods, hash, java_methods;
 
-    argv[0] = TRUE;
+    argv[0] = Qtrue;
     methods = rb_class_instance_methods(1, argv, CLASS_OF(self));
     hash = rb_const_get(CLASS_OF(self), rb_intern("INSTANCE_METHODS"));
     java_methods = rb_funcall(hash, rb_intern("keys"), 0);
@@ -2365,9 +2363,17 @@
 {
     JDK1_1InitArgs vm_args;
     jint res;
-    
-    vm_args.version = 0x00010001;
+    char classpath[1024];
+    char *env_cp;
+    VALUE mystr;
+
+    vm_args.version = JNI_VERSION_1_1;
     JNI_GetDefaultJavaVMInitArgs(&vm_args);
+    env_cp = getenv("CLASSPATH");
+    if (env_cp) {
+	    sprintf(classpath, "%s:%s", vm_args.classpath, env_cp);
+    }
+    vm_args.classpath = classpath;
     res = JNI_CreateJavaVM(&javavm, &jnienv, &vm_args);
     if (res < 0) {
         rb_loaderror("can't create Java VM");

In This Thread

Prev Next