*** empty log message ***
authorcg
Fri, 29 Jan 1999 15:34:00 +0000
changeset 546 56e1665483d2
parent 545 6a841644c5e9
child 547 38870f6447d0
*** empty log message ***
Java.st
JavaClass.st
JavaVM.st
--- a/Java.st	Fri Jan 29 15:30:31 1999 +0000
+++ b/Java.st	Fri Jan 29 15:34:00 1999 +0000
@@ -1151,7 +1151,7 @@
 
 classSourceOf:aClass
     |package dirName binary sourceFileName sourceFile dirHolder fileName path
-     loader codeBaseURL protocol dir file|
+     loader codeBaseURL protocol dir file codeBaseURLIdx|
 
     aClass isNil ifTrue:[
         ^ nil
@@ -1176,14 +1176,17 @@
     ] ifFalse:[
         "/ maybe it was loaded by a java classLoader ...
         (loader := aClass classLoader) notNil ifTrue:[
-            (codeBaseURL := loader instVarNamed:'codeBaseURL') notNil ifTrue:[
-                (protocol := codeBaseURL instVarNamed:'protocol') notNil ifTrue:[
-                    (Java as_ST_String:protocol) = 'file' ifTrue:[
-                        dirName := Java as_ST_String:(codeBaseURL instVarNamed:'file').
-                        dirName asFilename exists ifTrue:[
-                            aClass sourceFile notNil ifTrue:[
-                                sourceFileName := dirName asFilename construct:aClass sourceFile.
-                                sourceFile := sourceFileName asFilename.
+            codeBaseURLIdx := loader class instVarOffsetOf:'codeBaseURL'.
+            codeBaseURLIdx notNil ifTrue:[
+                (codeBaseURL := loader instVarAt:codeBaseURLIdx) notNil ifTrue:[
+                    (protocol := codeBaseURL instVarNamed:'protocol') notNil ifTrue:[
+                        (Java as_ST_String:protocol) = 'file' ifTrue:[
+                            dirName := Java as_ST_String:(codeBaseURL instVarNamed:'file').
+                            dirName asFilename exists ifTrue:[
+                                aClass sourceFile notNil ifTrue:[
+                                    sourceFileName := dirName asFilename construct:aClass sourceFile.
+                                    sourceFile := sourceFileName asFilename.
+                                ]
                             ]
                         ]
                     ]
@@ -1266,7 +1269,7 @@
     ].
     ^ (sourceFile contentsOfEntireFile).
 
-    "Modified: / 15.10.1998 / 23:38:18 / cg"
+    "Modified: / 27.1.1999 / 20:40:30 / cg"
 !
 
 findSourceDirOf:fileName inPackage:aPackage
@@ -1346,6 +1349,6 @@
 !Java class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/Java.st,v 1.90 1999/01/19 16:45:55 cg Exp $'
+    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/Java.st,v 1.91 1999/01/29 15:34:00 cg Exp $'
 ! !
 Java initialize!
--- a/JavaClass.st	Fri Jan 29 15:30:31 1999 +0000
+++ b/JavaClass.st	Fri Jan 29 15:34:00 1999 +0000
@@ -271,7 +271,7 @@
     "given a smalltalk argument, convert to a java object as appropriate.
      Currently, only a few types are converted."
 
-    |expectedCls f|
+    |expectedCls f failValue|
 
     type == #boolean ifTrue:[
         arg == true ifTrue:[
@@ -390,7 +390,7 @@
         arg isString ifTrue:[
             ^ Java as_String:arg
         ].
-        ^ failBlock value:('cannot convert argument to ' , type) value:''
+        failValue := ''
     ].
     expectedCls := Java classForName:type.
     (arg isKindOf:expectedCls) ifTrue:[
@@ -402,10 +402,10 @@
         ^ arg
     ].
 self halt.
-    ^ failBlock value:('cannot convert argument to ' , type) value:nil
+    ^ failBlock value:('cannot convert argument to ' , type) value:failValue
 
     "Created: / 6.11.1998 / 00:46:19 / cg"
-    "Modified: / 16.11.1998 / 16:30:09 / cg"
+    "Modified: / 28.1.1999 / 17:55:17 / cg"
 !
 
 convertToSmalltalk:jObj type:type 
@@ -1685,6 +1685,6 @@
 !JavaClass class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaClass.st,v 1.98 1999/01/08 16:50:58 cg Exp $'
+    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaClass.st,v 1.99 1999/01/29 15:32:42 cg Exp $'
 ! !
 JavaClass initialize!
--- a/JavaVM.st	Fri Jan 29 15:30:31 1999 +0000
+++ b/JavaVM.st	Fri Jan 29 15:34:00 1999 +0000
@@ -22,7 +22,7 @@
 		SimulatedNativeLibs LoadedNativeLibs WaitTable WaitTableAccess
 		JavaWindowGroup KnownWindows DrawOPTrace WindowOPTrace
 		WindowCreationTrace EventTrace ThreadTrace MonitorTrace
-		ExceptionTrace InsnCount InsnCounts FileOpenTrace
+		ExceptionTrace InsnCount InsnCounts FileOpenTrace FileAccessTrace
 		FileOpenConfirmation SocketConnectConfirmation FileIOTrace
 		OpenFileTable CachedNativeMethodTable ExceptionDebug ExitDebug
 		JavaConsoleStream StandardThreadGroup EnteredMonitorsPerProcess
@@ -2018,6 +2018,31 @@
     "Modified: / 27.1.1998 / 21:52:52 / cg"
 !
 
+exceptionDebug
+    ^ ExceptionDebug
+
+    "Created: / 27.1.1999 / 20:14:51 / cg"
+!
+
+exceptionDebug:aBoolean
+    ExceptionDebug := aBoolean
+
+    "Created: / 27.1.1999 / 20:15:00 / cg"
+!
+
+fileAccessTrace
+    ^ FileAccessTrace
+
+    "Created: / 27.1.1999 / 18:55:40 / cg"
+!
+
+fileAccessTrace:aBoolean
+    FileAccessTrace := aBoolean
+
+    "Created: / 19.10.1998 / 16:01:44 / cg"
+    "Modified: / 27.1.1999 / 18:55:52 / cg"
+!
+
 fileOpenConfirmation
     ^ FileOpenConfirmation
 
@@ -2934,6 +2959,9 @@
 fileStreamForReading:name
     |fn stream tryAlongClassPath|
 
+    FileOpenTrace ifTrue:[
+        ('JAVA: opening for read:' , name) infoPrintCR.
+    ].
     fn := name asFilename.
     stream := fn readStream.
     stream notNil ifTrue:[^ stream].
@@ -2967,7 +2995,7 @@
     ].
     ^ nil.
 
-    "Modified: / 21.10.1998 / 01:38:50 / cg"
+    "Modified: / 27.1.1999 / 18:54:46 / cg"
 !
 
 fixFilename:path
@@ -3176,7 +3204,7 @@
     fd instVarNamed:'fd' put:fileNo.
 
     "Created: / 4.1.1998 / 16:47:12 / cg"
-    "Modified: / 3.12.1998 / 15:13:51 / cg"
+    "Modified: / 28.1.1999 / 17:24:07 / cg"
 !
 
 _FileInputStream_read:nativeContext
@@ -3206,10 +3234,19 @@
 
 _FileInputStream_skip:nativeContext
     "/ long skip (long)
-    UnimplementedNativeMethodSignal raise
-
-    "Created: / 12.11.1998 / 18:57:12 / cg"
-    "Modified: / 12.11.1998 / 18:57:48 / cg"
+    |file nSkip nSkipped|
+
+    file := self validateFile:(nativeContext receiver).
+    nSkip := nativeContext argAt:1.
+
+    FileIOTrace ifTrue:[
+        (('JAVA: skip %1 byte(s) from ' bindWith:nSkip printString) , file pathName) infoPrintCR.
+    ].
+
+    file skip:nSkip.
+    ^ nSkip
+
+    "Modified: / 27.1.1999 / 20:36:11 / cg"
 !
 
 _FileOutputStream_close:nativeContext
@@ -3271,6 +3308,11 @@
     path := file instVarNamed:'path'.
     path notNil ifTrue:[
         path := Java as_ST_String:path.
+
+        FileAccessTrace == true ifTrue:[
+            path storeString print. ' ' print. thisContext printCR
+        ].
+
         path := self fixFilename:path.
         (f := path asFilename) isReadable ifTrue:[
             ^ 1 "/ TRUE
@@ -3279,7 +3321,7 @@
     ^ 0 "/ FALSE
 
     "Created: / 4.1.1998 / 18:09:55 / cg"
-    "Modified: / 20.10.1998 / 20:59:39 / cg"
+    "Modified: / 27.1.1999 / 18:57:55 / cg"
 !
 
 _File_canWrite0:nativeContext
@@ -3288,6 +3330,9 @@
     file := nativeContext receiver.
     path := file instVarNamed:'path'.
     path notNil ifTrue:[
+        FileAccessTrace == true ifTrue:[
+            path storeString print. ' ' print. thisContext printCR
+        ].
         path := Java as_ST_String:path.
         path := self fixFilename:path.
         (f := path asFilename) isWritable ifTrue:[
@@ -3297,7 +3342,7 @@
     ^ 0 "/ FALSE
 
     "Created: / 4.2.1998 / 00:19:55 / cg"
-    "Modified: / 20.10.1998 / 20:59:45 / cg"
+    "Modified: / 27.1.1999 / 18:57:52 / cg"
 !
 
 _File_delete0:nativeContext
@@ -3339,6 +3384,9 @@
     path notNil ifTrue:[
         path := Java as_ST_String:path.
         path := self fixFilename:path.
+        FileAccessTrace == true ifTrue:[
+            path storeString print. ' ' print. thisContext printCR
+        ].
         (f := path asFilename) exists ifTrue:[
             ^ 1 "TRUE"
         ]
@@ -3346,7 +3394,7 @@
     ^ 0 "FALSE"
 
     "Created: / 5.1.1998 / 02:07:48 / cg"
-    "Modified: / 20.10.1998 / 20:59:49 / cg"
+    "Modified: / 27.1.1999 / 18:57:46 / cg"
 !
 
 _File_isAbsolute:nativeContext
@@ -3373,6 +3421,9 @@
     file := nativeContext receiver.
     path := file instVarNamed:'path'.
     path notNil ifTrue:[
+        FileAccessTrace == true ifTrue:[
+            path storeString print. ' ' print. thisContext printCR
+        ].
         path := Java as_ST_String:path.
         path := self fixFilename:path.
         (f := path asFilename) exists ifTrue:[
@@ -3382,7 +3433,7 @@
     ^ 0 "FALSE"
 
     "Created: / 7.1.1998 / 10:31:37 / cg"
-    "Modified: / 20.10.1998 / 20:59:56 / cg"
+    "Modified: / 27.1.1999 / 18:58:01 / cg"
 !
 
 _File_isFile0:nativeContext
@@ -3391,6 +3442,9 @@
     file := nativeContext receiver.
     path := file instVarNamed:'path'.
     path notNil ifTrue:[
+        FileAccessTrace == true ifTrue:[
+            path storeString print. ' ' print. thisContext printCR
+        ].
         path := Java as_ST_String:path.
         path := self fixFilename:path.
         (f := path asFilename) exists ifTrue:[
@@ -3400,7 +3454,7 @@
     ^ 0 "/ FALSE
 
     "Created: / 11.1.1998 / 11:40:22 / cg"
-    "Modified: / 20.10.1998 / 21:00:00 / cg"
+    "Modified: / 27.1.1999 / 18:58:04 / cg"
 !
 
 _File_lastModified0:nativeContext
@@ -3427,6 +3481,9 @@
     file := nativeContext receiver.
     path := file instVarNamed:'path'.
     path notNil ifTrue:[
+        FileAccessTrace == true ifTrue:[
+            thisContext printCR
+        ].
         path := Java as_ST_String:path.
         path := self fixFilename:path.
         (f := path asFilename) exists ifTrue:[
@@ -3436,7 +3493,7 @@
     ^ -1
 
     "Created: / 7.1.1998 / 12:18:57 / cg"
-    "Modified: / 20.10.1998 / 21:00:18 / cg"
+    "Modified: / 27.1.1999 / 18:57:06 / cg"
 !
 
 _File_list0:nativeContext
@@ -3756,6 +3813,25 @@
     "Modified: / 12.11.1998 / 21:29:46 / cg"
 !
 
+_RandomAccessFile_read:nativeContext
+    |file byte|
+
+    file := self validateFile:(nativeContext receiver).
+
+    FileIOTrace ifTrue:[
+        ('JAVA: read 1 byte from ' , file pathName) infoPrintCR.
+    ].
+
+    byte := file nextByte.
+    byte isNil ifTrue:[
+        ^ -1
+    ].
+    ^ byte
+
+    "Modified: / 5.1.1998 / 02:17:25 / cg"
+    "Created: / 27.1.1999 / 19:01:15 / cg"
+!
+
 _RandomAccessFile_readBytes:nativeContext
     ^ self anyStream_readBytes:nativeContext
 
@@ -6484,6 +6560,24 @@
 
 !JavaVM class methodsFor:'native - java.utils.zip'!
 
+_Inflater_inflate:nativeContext
+    "public native synchronized int inflate (byte[] arg1, int arg2, int arg3)"
+
+    |inBytes in outBytes len offs|
+
+    inBytes := nativeContext argAt:1.
+    offs := nativeContext argAt:2.
+    len := nativeContext argAt:3.
+
+    outBytes := ByteArray new:16*1024.
+    in := inBytes copyFrom:offs+1 to:offs+len.
+
+    UnimplementedNativeMethodSignal raise
+
+    "Created: / 27.1.1999 / 20:57:37 / cg"
+    "Modified: / 27.1.1999 / 21:10:13 / cg"
+!
+
 _Inflater_init:nativeContext
 
     "Created: / 1.2.1998 / 20:14:01 / cg"
@@ -8492,7 +8586,7 @@
         from:startAngle angle:(endAngle - startAngle).
 
     "Created: / 6.1.1998 / 21:00:15 / cg"
-    "Modified: / 28.1.1998 / 23:23:42 / cg"
+    "Modified: / 28.1.1999 / 17:38:45 / cg"
 !
 
 _WGraphics_drawBytes:nativeContext
@@ -10643,10 +10737,15 @@
 "/    ].
 "/ (aClassOrInterface name includesString:'LightweightPeer') ifTrue:[self halt].
 
+    anObject isArray ifTrue:[
+        aClassOrInterface == (Java at:'java.lang.Object') ifTrue:[
+            ^ 1
+        ]
+    ].
     ^ 0.
 
-    "Modified: / 13.2.1998 / 18:03:03 / cg"
     "Created: / 8.1.1999 / 14:52:54 / cg"
+    "Modified: / 27.1.1999 / 20:56:25 / cg"
 !
 
 _L2D:op1
@@ -11505,6 +11604,6 @@
 !JavaVM class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaVM.st,v 1.135 1999/01/23 15:28:24 cg Exp $'
+    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaVM.st,v 1.136 1999/01/29 15:33:57 cg Exp $'
 ! !
 JavaVM initialize!