JavaVM.st
changeset 405 c64cd83f8b42
parent 401 610bc793de74
child 408 37ee4bd9c0ee
--- a/JavaVM.st	Thu Oct 22 16:32:38 1998 +0000
+++ b/JavaVM.st	Thu Oct 22 16:44:34 1998 +0000
@@ -568,39 +568,39 @@
 
 initializePrimitiveClasses
     JavaClasses isNil ifTrue:[
-	JavaClasses := Dictionary new.
+        JavaClasses := Dictionary new.
     ].
 
     #(
-	('byte'    'B' 1)
-	('short'   'S' 2)
-	('int'     'I' 4)
-	('long'    'J' 8)
-	('boolean' 'Z' 1)
-	('char'    'C' 2)
-	('float'   'F' 4)
-	('double'  'D' 8)
-	('void'    'V' 0)
+        (#byte    'B' 1)
+        (#short   'S' 2)
+        (#int     'I' 4)
+        (#long    'J' 8)
+        (#boolean 'Z' 1)
+        (#char    'C' 2)
+        (#float   'F' 4)
+        (#double  'D' 8)
+        (#void    'V' 0)
     ) triplesDo:[:nm :sig :len |
-	|stClass jClass|
-
-	"/
-	"/ create a javaClass for it.
-	"/
-	jClass := (Java at:'java.lang.Class') new.
+        |stClass jClass|
+
+        "/
+        "/ create a javaClass for it.
+        "/
+        jClass := (Java at:'java.lang.Class') new.
 "/        stClass := Class new.
 "/        stClass setName:('JavaBase_' , nm) asSymbol.
 "/        JavaClasses at:stClass put:jClass.
 "/        JavaClasses at:jClass put:stClass.
 
-	JavaClasses at:nm put:jClass
+        JavaClasses at:nm put:jClass
     ].
 
     "
      self initializePrimitiveClasses
     "
 
-    "Modified: / 4.1.1998 / 00:56:05 / cg"
+    "Modified: / 22.10.1998 / 01:56:02 / cg"
 !
 
 initializeSimulatedLibs
@@ -1099,16 +1099,17 @@
 
     jClass := JavaClasses at:aClass ifAbsent:nil.
     jClass isNil ifTrue:[
-	"/ class must be initialized (with all of its superclasses ?).
-	aClass classInit.
-
-	JavaClasses at:aClass put:(jClass := (Java at:'java.lang.Class') new).
-	JavaClasses at:jClass put:aClass.
+        "/ class must be initialized (with all of its superclasses ?).
+        aClass isJavaClass ifTrue:[
+            aClass classInit.
+        ].
+        JavaClasses at:aClass put:(jClass := (Java at:'java.lang.Class') new).
+        JavaClasses at:jClass put:aClass.
     ].
     ^ jClass
 
     "Created: / 23.1.1998 / 17:43:38 / cg"
-    "Modified: / 23.1.1998 / 17:46:51 / cg"
+    "Modified: / 21.10.1998 / 02:50:15 / cg"
 !
 
 javaMethodObjectForMethod:aMethod
@@ -1813,35 +1814,49 @@
     stream notNil ifTrue:[^ stream].
 
     fn isAbsolute ifFalse:[
-	"/ if not absolute, try along classPath
-	"/ This allows classes to open local files (JEdit)
-	"/ even if they have NOT been loaded by a Java classLoader.
-	"/ Only do this for image files 
-	"/ (and maybe some other config files in the future),
-	"/ to avoid security holes.
-
-	tryAlongClassPath := false.
-	(fn hasSuffix:'gif') ifTrue:[
-	    tryAlongClassPath := true.
-	].
-	(fn hasSuffix:'jpg') ifTrue:[
-	    tryAlongClassPath := true.
-	].
-
-	tryAlongClassPath ifTrue:[
-	    Java classPath do:[:dirName |
-		|fn|
-
-		(fn := dirName asFilename construct:name) exists ifTrue:[
-		    stream := fn readStream.
-		    stream notNil ifTrue:[^ stream].
-		]
-	    ]
-	]
+        "/ if not absolute, try along classPath
+        "/ This allows classes to open local files (JEdit)
+        "/ even if they have NOT been loaded by a Java classLoader.
+        "/ Only do this for image files 
+        "/ (and maybe some other config files in the future),
+        "/ to avoid security holes.
+        tryAlongClassPath := true.
+"/        tryAlongClassPath := false.
+"/        (fn hasSuffix:'gif') ifTrue:[
+"/            tryAlongClassPath := true.
+"/        ].
+"/        (fn hasSuffix:'jpg') ifTrue:[
+"/            tryAlongClassPath := true.
+"/        ].
+
+        tryAlongClassPath ifTrue:[
+            Java classPath do:[:dirName |
+                |fn|
+
+                (fn := dirName asFilename construct:name) exists ifTrue:[
+                    stream := fn readStream.
+                    stream notNil ifTrue:[^ stream].
+                ]
+            ]
+        ]
     ].
     ^ nil.
 
-    "Modified: / 15.1.1998 / 13:01:34 / cg"
+    "Modified: / 21.10.1998 / 01:38:50 / cg"
+!
+
+fixFilename:path
+    OperatingSystem isMSDOSlike ifTrue:[
+        (#($/ $\) includes:(path at:1)) ifTrue:[
+            (path at:3) == $: ifTrue:[
+                ^ path copyFrom:2
+            ]
+        ]
+    ].
+    ^ path
+
+    "Created: / 20.10.1998 / 20:58:45 / cg"
+    "Modified: / 20.10.1998 / 21:06:49 / cg"
 !
 
 validateFile:javaStream
@@ -1969,6 +1984,8 @@
     name := nativeContext argAt:1.
     name := Java as_ST_String:name.
 
+    name := self fixFilename:name.
+
     FileOpenTrace ifTrue:[
         ('JAVA: opening ' , name) infoPrintCR.
     ].
@@ -2002,7 +2019,7 @@
     fd instVarNamed:'fd' put:fileNo.
 
     "Created: / 4.1.1998 / 16:47:12 / cg"
-    "Modified: / 1.2.1998 / 20:35:16 / cg"
+    "Modified: / 21.10.1998 / 01:40:00 / cg"
 !
 
 _FileInputStream_read:nativeContext
@@ -2088,15 +2105,16 @@
     file := nativeContext receiver.
     path := file instVarNamed:'path'.
     path notNil ifTrue:[
-	path := Java as_ST_String:path.
-	(f := path asFilename) isReadable ifTrue:[
-	    ^ 1 "/ TRUE
-	]
+        path := Java as_ST_String:path.
+        path := self fixFilename:path.
+        (f := path asFilename) isReadable ifTrue:[
+            ^ 1 "/ TRUE
+        ]
     ].
     ^ 0 "/ FALSE
 
     "Created: / 4.1.1998 / 18:09:55 / cg"
-    "Modified: / 15.1.1998 / 12:10:34 / cg"
+    "Modified: / 20.10.1998 / 20:59:39 / cg"
 !
 
 _File_canWrite0:nativeContext
@@ -2106,14 +2124,15 @@
     path := file instVarNamed:'path'.
     path notNil ifTrue:[
         path := Java as_ST_String:path.
+        path := self fixFilename:path.
         (f := path asFilename) isWritable ifTrue:[
             ^ 1 "/ TRUE
         ]
     ].
     ^ 0 "/ FALSE
 
-    "Modified: / 15.1.1998 / 12:10:34 / cg"
     "Created: / 4.2.1998 / 00:19:55 / cg"
+    "Modified: / 20.10.1998 / 20:59:45 / cg"
 !
 
 _File_exists0:nativeContext
@@ -2122,15 +2141,16 @@
     file := nativeContext receiver.
     path := file instVarNamed:'path'.
     path notNil ifTrue:[
-	path := Java as_ST_String:path.
-	(f := path asFilename) exists ifTrue:[
-	    ^ 1 "TRUE"
-	]
+        path := Java as_ST_String:path.
+        path := self fixFilename:path.
+        (f := path asFilename) exists ifTrue:[
+            ^ 1 "TRUE"
+        ]
     ].
     ^ 0 "FALSE"
 
     "Created: / 5.1.1998 / 02:07:48 / cg"
-    "Modified: / 15.1.1998 / 12:10:27 / cg"
+    "Modified: / 20.10.1998 / 20:59:49 / cg"
 !
 
 _File_isAbsolute:nativeContext
@@ -2139,15 +2159,16 @@
     file := nativeContext receiver.
     path := file instVarNamed:'path'.
     path notNil ifTrue:[
-	path := Java as_ST_String:path.
-	(f := path asFilename) isAbsolute ifTrue:[
-	    ^ 1 "/ TRUE
-	]
+        path := Java as_ST_String:path.
+        path := self fixFilename:path.
+        (f := path asFilename) isAbsolute ifTrue:[
+            ^ 1 "/ TRUE
+        ]
     ].
     ^ 0 "/ FALSE
 
-    "Modified: / 8.8.1997 / 12:04:05 / cg"
     "Created: / 11.1.1998 / 09:54:38 / cg"
+    "Modified: / 20.10.1998 / 20:59:53 / cg"
 !
 
 _File_isDirectory0:nativeContext
@@ -2156,15 +2177,16 @@
     file := nativeContext receiver.
     path := file instVarNamed:'path'.
     path notNil ifTrue:[
-	path := Java as_ST_String:path.
-	(f := path asFilename) exists ifTrue:[
-	    f isDirectory ifTrue:[^ 1 "TRUE"]
-	]
+        path := Java as_ST_String:path.
+        path := self fixFilename:path.
+        (f := path asFilename) exists ifTrue:[
+            f isDirectory ifTrue:[^ 1 "TRUE"]
+        ]
     ].
     ^ 0 "FALSE"
 
     "Created: / 7.1.1998 / 10:31:37 / cg"
-    "Modified: / 15.1.1998 / 12:10:20 / cg"
+    "Modified: / 20.10.1998 / 20:59:56 / cg"
 !
 
 _File_isFile0:nativeContext
@@ -2173,15 +2195,16 @@
     file := nativeContext receiver.
     path := file instVarNamed:'path'.
     path notNil ifTrue:[
-	path := Java as_ST_String:path.
-	(f := path asFilename) exists ifTrue:[
-	    f isDirectory ifFalse:[^ 1 "TRUE"]
-	]
+        path := Java as_ST_String:path.
+        path := self fixFilename:path.
+        (f := path asFilename) exists ifTrue:[
+            f isDirectory ifFalse:[^ 1 "TRUE"]
+        ]
     ].
     ^ 0 "/ FALSE
 
     "Created: / 11.1.1998 / 11:40:22 / cg"
-    "Modified: / 15.1.1998 / 12:10:13 / cg"
+    "Modified: / 20.10.1998 / 21:00:00 / cg"
 !
 
 _File_lastModified0:nativeContext
@@ -2191,14 +2214,15 @@
     path := file instVarNamed:'path'.
     path notNil ifTrue:[
         path := Java as_ST_String:path.
+        path := self fixFilename:path.
         (f := path asFilename) exists ifTrue:[
             ^ f modificationTime getMilliseconds.
         ]
     ].
     ^ 0
 
-    "Modified: / 8.8.1997 / 12:04:13 / cg"
     "Created: / 4.2.1998 / 16:50:30 / cg"
+    "Modified: / 20.10.1998 / 21:00:05 / cg"
 !
 
 _File_length0:nativeContext
@@ -2207,15 +2231,16 @@
     file := nativeContext receiver.
     path := file instVarNamed:'path'.
     path notNil ifTrue:[
-	path := Java as_ST_String:path.
-	(f := path asFilename) exists ifTrue:[
-	    ^ f fileSize
-	]
+        path := Java as_ST_String:path.
+        path := self fixFilename:path.
+        (f := path asFilename) exists ifTrue:[
+            ^ f fileSize
+        ]
     ].
     ^ -1
 
     "Created: / 7.1.1998 / 12:18:57 / cg"
-    "Modified: / 15.1.1998 / 12:10:06 / cg"
+    "Modified: / 20.10.1998 / 21:00:18 / cg"
 !
 
 _File_list0:nativeContext
@@ -2224,19 +2249,20 @@
     file := nativeContext receiver.
     path := file instVarNamed:'path'.
     path notNil ifTrue:[
-	path := Java as_ST_String:path.
-	(f := path asFilename) exists ifTrue:[
-	    f isDirectory ifTrue:[
-		files := f directoryContents asArray.
-		files := files collect:[:nm | Java as_String:nm].
-		^ files
-	    ]
-	]
+        path := Java as_ST_String:path.
+        path := self fixFilename:path.
+        (f := path asFilename) exists ifTrue:[
+            f isDirectory ifTrue:[
+                files := f directoryContents asArray.
+                files := files collect:[:nm | Java as_String:nm].
+                ^ files
+            ]
+        ]
     ].
     ^ nil
 
     "Created: / 14.1.1998 / 21:30:22 / cg"
-    "Modified: / 14.1.1998 / 21:32:09 / cg"
+    "Modified: / 20.10.1998 / 21:00:21 / cg"
 !
 
 _File_mkdir0:nativeContext
@@ -2246,6 +2272,7 @@
     path := file instVarNamed:'path'.
     path notNil ifTrue:[
         path := Java as_ST_String:path.
+        path := self fixFilename:path.
         FileOpenConfirmation ifTrue:[
             (self confirm:('JAVA Security check\\Create directory ''' , path , '''.\Grant permission ?') withCRs)
             ifFalse:[
@@ -2264,8 +2291,8 @@
     ].
     ^ 0 "FALSE"
 
-    "Modified: / 15.1.1998 / 12:10:20 / cg"
     "Created: / 4.2.1998 / 00:19:05 / cg"
+    "Modified: / 20.10.1998 / 21:00:25 / cg"
 !
 
 _RandomAccessFile_close:nativeContext
@@ -2303,6 +2330,7 @@
 
     name := nativeContext argAt:1.
     name := Java as_ST_String:name.
+    name := self fixFilename:name.
 
     FileOpenTrace ifTrue:[
         ('JAVA: opening ' , name) infoPrintCR.
@@ -2341,7 +2369,7 @@
     fd instVarNamed:'fd' put:fileNo.
 
     "Created: / 4.2.1998 / 00:14:48 / cg"
-    "Modified: / 4.2.1998 / 17:15:55 / cg"
+    "Modified: / 20.10.1998 / 21:00:51 / cg"
 !
 
 _RandomAccessFile_readBytes:nativeContext
@@ -2689,10 +2717,10 @@
     mName := Java as_ST_String:jmName.
     mTypes := nativeContext argAt:2.
     whichAccess := nativeContext argAt:3.
-
+self halt.
     argSig := JavaMethod argSignatureFromArgTypeArray:mTypes.
     cls methodDictionary keysAndValuesDo:[:sel :mthd |
-        |i1 i2 jMethod|
+        |i1 i2 jMethod retTypeClass argTypes|
 
         JavaMethods notNil ifTrue:[
             (jMethod := JavaMethods at:mthd ifAbsent:nil) notNil ifTrue:[
@@ -2713,7 +2741,19 @@
                 jMethod instVarNamed:'clazz' put:jClass.
                 jMethod instVarNamed:'slot' put:sel.
                 jMethod instVarNamed:'name' put:jmName.
-                jMethod instVarNamed:'returnType' put:(self javaClassObjectForClass:mthd returnTypeClass).
+                retTypeClass := mthd returnTypeClass.
+                retTypeClass isNil ifTrue:[
+                    retTypeClass := #void
+                ].
+                argTypes := mthd argSignature.
+                argTypes := argTypes collect:[:s |
+                    |c|
+
+                    c := Java at:s.
+                    self javaClassObjectForClass:(c ? s asSymbol)
+                ].
+                jMethod instVarNamed:'returnType' put:(self javaClassObjectForClass:retTypeClass).
+                jMethod instVarNamed:'parameterTypes' put:argTypes.
 
                 JavaMethods isNil ifTrue:[
                     JavaMethods := IdentityDictionary new
@@ -2733,7 +2773,7 @@
 
     ^ nil.
 
-    "Modified: / 13.2.1998 / 15:23:07 / cg"
+    "Modified: / 22.10.1998 / 01:54:38 / cg"
 !
 
 _Class_getMethods0:nativeContext
@@ -2745,42 +2785,61 @@
     jClass := nativeContext receiver.
     cls := JavaClasses at:jClass.
 
-    "/ 0 = PUBLIC / 1 = ANY
+    "/ 0 = PUBLIC (i.e. includes inherited) / 1 = DECLARED here
     whichAccess := nativeContext argAt:1.
 
     methods := OrderedCollection new.
 
-    cls methodDictionary keysAndValuesDo:[:sel :mthd |
-        |i1 i2 jMethod retTypeClass|
-
-        mthd name printCR.
-
-        i1 := mthd signature indexOf:$(.
-        i2 := mthd signature indexOf:$) startingAt:(i1+1).
+    [cls isJavaClass] whileTrue:[
+        cls methodDictionary keysAndValuesDo:[:sel :mthd |
+            |i1 i2 jMethod argTypes retTypeClass|
+
+            mthd name printCR.
+
+            i1 := mthd signature indexOf:$(.
+            i2 := mthd signature indexOf:$) startingAt:(i1+1).
+            
+            "/ create a java.lang.reflect.Method for it.
+            jMethod := (Java at:'java.lang.reflect.Method') new.
+            jMethod instVarNamed:'clazz' put:jClass.
+            jMethod instVarNamed:'slot' put:sel.
+            jMethod instVarNamed:'name' put:(Java as_String:mthd name).
+            retTypeClass := mthd returnTypeClass.
+            retTypeClass isNil ifTrue:[
+                retTypeClass := #void
+            ].
+(name endsWith:')I') ifTrue:[self halt].
+            argTypes := mthd argSignature.
+            argTypes := argTypes collect:[:s |
+                |c|
+
+                c := Java at:s.
+                self javaClassObjectForClass:(c ? s asSymbol)
+            ].
+
+            jMethod instVarNamed:'returnType' put:(self javaClassObjectForClass:retTypeClass).
+            jMethod instVarNamed:'parameterTypes' put:argTypes.
         
-        "/ create a java.lang.reflect.Method for it.
-        jMethod := (Java at:'java.lang.reflect.Method') new.
-        jMethod instVarNamed:'clazz' put:jClass.
-        jMethod instVarNamed:'slot' put:sel.
-        jMethod instVarNamed:'name' put:(Java as_String:mthd name).
-        retTypeClass := mthd returnTypeClass.
-        retTypeClass notNil ifTrue:[
-            jMethod instVarNamed:'returnType' put:(self javaClassObjectForClass:retTypeClass).
+(mthd name includesString:'setName') ifTrue:[self halt].
+            JavaMethods isNil ifTrue:[
+                JavaMethods := IdentityDictionary new
+            ].
+            JavaMethods at:jMethod put:mthd.
+            JavaMethods at:mthd put:jMethod.
+
+            methods add:jMethod.
         ].
-
-        JavaMethods isNil ifTrue:[
-            JavaMethods := IdentityDictionary new
-        ].
-        JavaMethods at:jMethod put:mthd.
-        JavaMethods at:mthd put:jMethod.
-
-        methods add:jMethod.
+        whichAccess == 1 ifTrue:[
+            "/ local methods only
+            cls := nil
+        ] ifFalse:[
+            cls := cls superclass.
+        ]
     ].
     methods := methods asArray.
-self halt.
     ^ methods.
 
-    "Modified: / 9.4.1998 / 17:42:35 / cg"
+    "Modified: / 22.10.1998 / 01:53:58 / cg"
 !
 
 _Class_getName:nativeContext
@@ -3914,9 +3973,16 @@
 
     stProcess := JavaProcess 
                     for:[   
+                          |procName|
+
+                          Object abortSignal handle:[:ex |
+                            procName := stProcess name.
+                            ('JAVA: thread ' , procName , ' aborted - restarting process.') infoPrintCR.
+                            ex restart.
+                          ] do:[ 
                             [
                                 JavaVM javaExceptionSignal handle:[:ex |
-                                    |procName exClass|
+                                    |exClass|
 
                                     procName := stProcess name.
                                     exClass := ex parameter class.
@@ -3944,6 +4010,7 @@
                             ] valueNowOrOnUnwindDo:[
                                 Java threads removeKey:jThread ifAbsent:[].
                             ]
+                          ]
                         ] 
                     priority:(Processor activePriority).
 
@@ -3970,7 +4037,7 @@
     ^ nil
 
     "Created: / 3.1.1998 / 02:05:52 / cg"
-    "Modified: / 6.2.1998 / 00:55:26 / cg"
+    "Modified: / 22.10.1998 / 01:37:56 / cg"
 !
 
 _Thread_stop0:nativeContext
@@ -4311,6 +4378,9 @@
 
     hostName := OperatingSystem getHostName.
     addrBytes := Socket ipAddressOfHost:hostName.
+    addrBytes isNil ifTrue:[
+        addrBytes := #[127 0 0 0].
+    ].
     "/ MSB first into an integer.
     address := (addrBytes at:1).
     address := (address bitShift:8) bitOr:(addrBytes at:2).
@@ -4323,8 +4393,8 @@
 
     ^ nil
 
-    "Modified: / 7.8.1997 / 21:16:57 / cg"
     "Created: / 5.1.1998 / 02:06:27 / cg"
+    "Modified: / 21.10.1998 / 03:30:29 / cg"
 !
 
 _PlainSocketImpl_initProto:nativeContext
@@ -4648,14 +4718,18 @@
     |s js|
 
     js := nativeContext argAt:1.
-    s := Java as_ST_String:js.
+    js isNil ifTrue:[
+        s := ''
+    ] ifFalse:[
+        s := Java as_ST_String:js.
+    ].
 
     self activityNotification:s.
 "/ Transcript showCR:s.
     ^ nil
 
     "Created: / 6.1.1998 / 18:31:34 / cg"
-    "Modified: / 8.1.1998 / 17:06:13 / cg"
+    "Modified: / 22.10.1998 / 01:17:46 / cg"
 !
 
 _URLStreamHandlerFactory_pInit:nativeContext
@@ -5036,40 +5110,39 @@
     ].
 
     img := imgRep instVarNamed:'pData'.
-    (img isNil or:[img == 0]) ifTrue:[
-        (offs ~~ 0 or:[scanLineWidth ~~ w]) ifTrue:[
-            nBytes := ByteArray new:w*h.
-            srcIdx := offs+1.
-            dstIdx := 1.
-            1 to:h do:[:y |
-                nBytes replaceFrom:dstIdx to:(dstIdx+w-1) with:bytes startingAt:srcIdx.
-                srcIdx := srcIdx + scanLineWidth.
-                dstIdx := dstIdx + w.
-            ].
-            bytes := nBytes.
+    (img isNil or:[img == 0]) ifFalse:[
+"/        self halt
+    ].
+
+    (offs ~~ 0 or:[scanLineWidth ~~ w]) ifTrue:[
+        nBytes := ByteArray new:w*h.
+        srcIdx := offs+1.
+        dstIdx := 1.
+        1 to:h do:[:y |
+            nBytes replaceFrom:dstIdx to:(dstIdx+w-1) with:bytes startingAt:srcIdx.
+            srcIdx := srcIdx + scanLineWidth.
+            dstIdx := dstIdx + w.
         ].
-        img := Image width:w height:h depth:depth fromArray:bytes.
-        cmap notNil ifTrue:[
-            img colorMap:cmap.
-            img photometric:#palette
-        ].
-        opaque ifFalse:[
-            img mask:(ImageReader 
-                        buildMaskFromColor:transparentColorIndex 
-                        for:bytes
-                        width:w
-                        height:h)
-        ].
-
-        imgRep instVarNamed:'pData' put:img.
-
-    ] ifFalse:[
-        self halt.
-    ].
+        bytes := nBytes.
+    ].
+    img := Image width:w height:h depth:depth fromArray:bytes.
+    cmap notNil ifTrue:[
+        img colorMap:cmap.
+        img photometric:#palette
+    ].
+    opaque ifFalse:[
+        img mask:(ImageReader 
+                    buildMaskFromColor:transparentColorIndex 
+                    for:bytes
+                    width:w
+                    height:h)
+    ].
+
+    imgRep instVarNamed:'pData' put:img.
     ^ 1.
 
     "Created: / 7.1.1998 / 22:31:46 / cg"
-    "Modified: / 6.2.1998 / 02:50:13 / cg"
+    "Modified: / 21.10.1998 / 00:35:45 / cg"
 !
 
 _ImageRepresentation_setIntPixels:nativeContext
@@ -5110,63 +5183,61 @@
     ].
 
     img := imgRep instVarNamed:'pData'.
-    (img isNil or:[img == 0]) ifTrue:[
-
-        depth == 32 ifTrue:[
-            "/ temporary kludge - ony use 24 bits/pixel
-            bytes := ByteArray new:w*h*3.
-            srcIdx := 1.
-            dstIdx := 1.
-            redMask := clrModel instVarNamed:'red_mask'.
-            greenMask := clrModel instVarNamed:'green_mask'.
-            blueMask := clrModel instVarNamed:'blue_mask'.
-            redShift := (clrModel instVarNamed:'red_offset') negated.
-            greenShift := (clrModel instVarNamed:'green_offset') negated.
-            blueShift := (clrModel instVarNamed:'blue_offset') negated.
-            1 to:h do:[:y |
-                1 to:w do:[:x |
-                    val := ints at:srcIdx.
-                    red := (val bitAnd:redMask) bitShift:redShift.
-                    green := (val bitAnd:greenMask) bitShift:greenShift.
-                    blue := (val bitAnd:blueMask) bitShift:blueShift.
-                    bytes at:dstIdx put:red.
-                    bytes at:dstIdx+1 put:green.
-                    bytes at:dstIdx+2 put:blue.
-                    dstIdx := dstIdx + 3.
-                    srcIdx := srcIdx + 1.
-                ].
-                srcIdx := srcIdx + (scanLineWidth - w).
+    (img isNil or:[img == 0]) ifFalse:[
+"/        self halt.
+    ].
+
+    depth == 32 ifTrue:[
+        "/ temporary kludge - ony use 24 bits/pixel
+        bytes := ByteArray new:w*h*3.
+        srcIdx := 1.
+        dstIdx := 1.
+        redMask := clrModel instVarNamed:'red_mask'.
+        greenMask := clrModel instVarNamed:'green_mask'.
+        blueMask := clrModel instVarNamed:'blue_mask'.
+        redShift := (clrModel instVarNamed:'red_offset') negated.
+        greenShift := (clrModel instVarNamed:'green_offset') negated.
+        blueShift := (clrModel instVarNamed:'blue_offset') negated.
+        1 to:h do:[:y |
+            1 to:w do:[:x |
+                val := ints at:srcIdx.
+                red := (val bitAnd:redMask) bitShift:redShift.
+                green := (val bitAnd:greenMask) bitShift:greenShift.
+                blue := (val bitAnd:blueMask) bitShift:blueShift.
+                bytes at:dstIdx put:red.
+                bytes at:dstIdx+1 put:green.
+                bytes at:dstIdx+2 put:blue.
+                dstIdx := dstIdx + 3.
+                srcIdx := srcIdx + 1.
             ].
-            img := Depth24Image width:w height:h depth:24 fromArray:bytes.
-        ] ifFalse:[
-scanLineWidth ~~ w ifTrue:[
-    self halt
-].
-            img := Image width:w height:h depth:depth fromArray:ints.
+            srcIdx := srcIdx + (scanLineWidth - w).
         ].
-        cmap notNil ifTrue:[
-            img colorMap:cmap.
-            img photometric:#palette
-        ] ifFalse:[
-            img photometric:#rgb
+        img := Depth24Image width:w height:h depth:24 fromArray:bytes.
+    ] ifFalse:[
+        scanLineWidth ~~ w ifTrue:[
+            self halt
         ].
-        opaque ifFalse:[
-            img mask:(ImageReader 
-                        buildMaskFromColor:transparentColorIndex 
-                        for:ints
-                        width:w
-                        height:h)
-        ].
-
-        imgRep instVarNamed:'pData' put:img.
-
+        img := Image width:w height:h depth:depth fromArray:ints.
+    ].
+    cmap notNil ifTrue:[
+        img colorMap:cmap.
+        img photometric:#palette
     ] ifFalse:[
-        self halt.
-    ].
+        img photometric:#rgb
+    ].
+    opaque ifFalse:[
+        img mask:(ImageReader 
+                    buildMaskFromColor:transparentColorIndex 
+                    for:ints
+                    width:w
+                    height:h)
+    ].
+
+    imgRep instVarNamed:'pData' put:img.
     ^ 1.
 
     "Created: / 1.2.1998 / 17:38:47 / cg"
-    "Modified: / 5.10.1998 / 15:29:01 / cg"
+    "Modified: / 21.10.1998 / 00:35:37 / cg"
 !
 
 _OffScreenImageSource_sendPixels:nativeContext
@@ -7211,6 +7282,13 @@
     "Modified: / 15.1.1998 / 19:48:55 / cg"
 !
 
+_WToolkit_getComboHeightOffset:nativeContext
+    ^ 0
+
+    "Modified: / 20.3.1997 / 13:50:04 / cg"
+    "Created: / 22.10.1998 / 00:59:14 / cg"
+!
+
 _WToolkit_getScreenHeight:nativeContext
     ^ Screen current height
 
@@ -8069,6 +8147,6 @@
 !JavaVM class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaVM.st,v 1.48 1998/10/20 17:40:46 cg Exp $'
+    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaVM.st,v 1.49 1998/10/22 16:44:34 cg Exp $'
 ! !
 JavaVM initialize!