--- a/JavaVM.st Fri Oct 29 14:48:43 1999 +0000
+++ b/JavaVM.st Tue Nov 09 09:25:25 1999 +0000
@@ -1,6 +1,6 @@
"
COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -45,7 +45,7 @@
copyright
"
COPYRIGHT (c) 1997 by eXept Software AG
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -62,35 +62,35 @@
"
all native methods:
- JavaMethod allSubInstances select:[:m |
- m isNative
- ]
+ JavaMethod allSubInstances select:[:m |
+ m isNative
+ ]
implemented methods:
- JavaMethod allSubInstances select:[:m |
- |sel|
-
- m isNative ifTrue:[
- sel := ('_' , m javaClass lastName , '_' , m name , ':') asSymbol.
- JavaVM class implements:sel.
- ] ifFalse:[
- false
- ]
- ]
+ JavaMethod allSubInstances select:[:m |
+ |sel|
+
+ m isNative ifTrue:[
+ sel := ('_' , m javaClass lastName , '_' , m name , ':') asSymbol.
+ JavaVM class implements:sel.
+ ] ifFalse:[
+ false
+ ]
+ ]
unimplemented methods:
- JavaMethod allSubInstances select:[:m |
- |sel|
-
- m isNative ifTrue:[
- sel := ('_' , m javaClass lastName , '_' , m name , ':') asSymbol.
- (JavaVM class implements:sel) not
- ] ifFalse:[
- false
- ]
- ]
+ JavaMethod allSubInstances select:[:m |
+ |sel|
+
+ m isNative ifTrue:[
+ sel := ('_' , m javaClass lastName , '_' , m name , ':') asSymbol.
+ (JavaVM class implements:sel) not
+ ] ifFalse:[
+ false
+ ]
+ ]
list of all native methods as in jdk1.1.3:
@@ -1041,33 +1041,33 @@
"
"
- caffmark loopmark logicmark sievemark methodmark stringmark float image graphic dialog newstringmark neweststringmark
+ caffmark loopmark logicmark sievemark methodmark stringmark float image graphic dialog newstringmark neweststringmark
linux:
P6/233 No JIT 84 87 90 40 22 17 10
- 103 133 142 137 28 73 109 167 18 140
+ 103 133 142 137 28 73 109 167 18 140
P6/233 JIT 479 2459 393 649 28 21 12
P6/233 JIT 473 1805 3046 439 986 28 21 12
- 533 1808 3382 613 1003 25 105 143 1
- 668 3330 3644 740
- 793 4116 3731 1243 1365 120 103 79 2
- 914 4480 4061 2290 68 106 158 19 34
- 941 4607 4149 1238 2434 75 101 152 18 32
- 591 164
- 1087 1836 800 110 35
- 1102 4592 4270 1844 2381 841 109 169 21 35
- 1177 4608 4309 1810 2432 895 532 182 20 35
+ 533 1808 3382 613 1003 25 105 143 1
+ 668 3330 3644 740
+ 793 4116 3731 1243 1365 120 103 79 2
+ 914 4480 4061 2290 68 106 158 19 34
+ 941 4607 4149 1238 2434 75 101 152 18 32
+ 591 164
+ 1087 1836 800 110 35
+ 1102 4592 4270 1844 2381 841 109 169 21 35
+ 1177 4608 4309 1810 2432 895 532 182 20 35
w95
P5/200 JIT 90 95 90 95 686 18 60 54 7
- 428 1657 2385 684 957 21 61 62 9
- 541 2886 2589 823 976 18 62 55 7
- 583 3062 2635 842 861 223 65 57 8
- 616 3075 2438 1081 1324 218 64 54 8
- 718 3138 2755 1085 1200 816 63 48 9 7
-
- caffmark loopmark logicmark sievemark methodmark stringmark float image graphic dialog newstringmark neweststringmark
+ 428 1657 2385 684 957 21 61 62 9
+ 541 2886 2589 823 976 18 62 55 7
+ 583 3062 2635 842 861 223 65 57 8
+ 616 3075 2438 1081 1324 218 64 54 8
+ 718 3138 2755 1085 1200 816 63 48 9 7
+
+ caffmark loopmark logicmark sievemark methodmark stringmark float image graphic dialog newstringmark neweststringmark
"
!
@@ -1079,7 +1079,7 @@
"
"
- BubbleSort BidirBubbleSort QuickSort Sieve Hanoi Dhry Fib Array Tree Total
+ BubbleSort BidirBubbleSort QuickSort Sieve Hanoi Dhry Fib Array Tree Total
ST/X+J Linux
233Mhz P6
@@ -1088,7 +1088,7 @@
ST/X+J Linux
233Mhz P6
JIT 128724 116810 20259 39733 83160 27613 52093 33166 43996 545554
- 124744 101428 17239 10052 8264 14004 38821 23252 33709 374660
+ 124744 101428 17239 10052 8264 14004 38821 23252 33709 374660
+IINC 120324 7265
+IADD op2 100173 90737 18128 6996 7423 17093 48559 44209 57056 390374
+ISUB op2 90460 17547 5921 57056 390461
@@ -1103,59 +1103,59 @@
+BASTORE 3279
+CALOAD/CASTORE 8907
regSave change 66119 60365 9997 4917 15386 37851 38202 50027 286497
- 64858 58360 9476 4889 15001 37211 36288 48313 278478
- 63146 55949 9302 14899
- 62970 56085 9352 3226 4837 8779 37573 22815 33899 241297
+ 64858 58360 9476 4889 15001 37211 36288 48313 278478
+ 63146 55949 9302 14899
+ 62970 56085 9352 3226 4837 8779 37573 22815 33899 241297
-O 43662 40292 7181 2530 4696 8170 34555 22116 32337 195539
+IALOAD 39162 36347
+IASTORE 32461 30663 4299 3667 19556 30563 166868
-IALOAD/IASTORE
- 34167 19347
- 19232 29726
- 18821
+ 34167 19347
+ 19232 29726
+ 18821
+AALOAD/BALOAD
- 41490 39527 6776 3315 4077 8443 33895 19152 28018 184693
- 41291 37034 6593 32682
+ 41490 39527 6776 3315 4077 8443 33895 19152 28018 184693
+ 41291 37034 6593 32682
+ATHROW 6449 180079
+IASTORE 38848 35601 6219 3796 6122 17869 30085 175106
IINC delayed code
+ANEWARRAY 3263
+LADD/LSUB const 38719 35256 6062 27071 172859
- 2837 22835
+ 2837 22835
+ISTORE into arg
- 3080
+ 3080
quick L2I for ints 2774 21184
+*ASTORE / *ALOAD
again 1621 3654 1525
+CHECKCAST 3574 25810
------------------------------------------------------------------------------------------------------------
- BubbleSort BidirBubbleSort QuickSort Sieve Hanoi Dhry Fib Array Tree Total
+ BubbleSort BidirBubbleSort QuickSort Sieve Hanoi Dhry Fib Array Tree Total
ST/X+J Win95
200Mhz P5
JIT 78490 77060 15220 4840 6370 9180 73160 36080 351700
- 76900 13560 5500 9010 35200 348600
- 66080 69920 370750
+ 76900 13560 5500 9010 35200 348600
+ 66080 69920 370750
+IADD non consts 76620 73210 13180 3790 63550 58880 356900
- 51740
- 77390 72450 12520 3900 6040 8950 62450 34330 57780 335810
- 77220 71950 5270 8840 338650
- 72390 70690 48010 327370
- 74910 66740 11420 8620 61730 33340 47350 313940
+ 51740
+ 77390 72450 12520 3900 6040 8950 62450 34330 57780 335810
+ 77220 71950 5270 8840 338650
+ 72390 70690 48010 327370
+ 74910 66740 11420 8620 61730 33340 47350 313940
+xALOAD/JMP_ZERO
- 71740 2800
- 71460 65250 11540 2750 62180 33840 50750 311660
+ 71740 2800
+ 71460 65250 11540 2750 62180 33840 50750 311660
+LCMP 59100
better abs(I)
+xALOAD/IF_ICMPx 66130 61520 12080 3300 5280 8190 56510 33830 50310 297150
elim dummy static 5210 48270
methods 44160
- 119020 112440 19330 3070 4560 2640 56960 37730 52790 408540
+ 119020 112440 19330 3070 4560 2640 56960 37730 52790 408540
------------------------------------------------------------------------------------------------------------
- BubbleSort BidirBubbleSort QuickSort Sieve Hanoi Dhry Fib Array Tree Total
+ BubbleSort BidirBubbleSort QuickSort Sieve Hanoi Dhry Fib Array Tree Total
Sun JDK 274625 244461 52676 50653 65183 26668 78133 28572 61608 882583
@@ -1220,18 +1220,18 @@
|cloneCode|
(aClass implements:javaSelector) ifFalse:[
- aClass
- compile:source
- classified:'java support'
- logged:false.
-
- cloneCode := aClass compiledMethodAt:smalltalkSelector.
- cloneCode source:fakedSource.
-
- Class withoutUpdatingChangesDo:[
- aClass removeSelector:smalltalkSelector.
- aClass addSelector:javaSelector withMethod:cloneCode.
- ]
+ aClass
+ compile:source
+ classified:'java support'
+ logged:false.
+
+ cloneCode := aClass compiledMethodAt:smalltalkSelector.
+ cloneCode source:fakedSource.
+
+ Class withoutUpdatingChangesDo:[
+ aClass removeSelector:smalltalkSelector.
+ aClass addSelector:javaSelector withMethod:cloneCode.
+ ]
].
"Created: / 5.11.1998 / 19:30:22 / cg"
@@ -1245,11 +1245,11 @@
self releaseAllMonitors.
KnownWindows notNil ifTrue:[
- KnownWindows do:[:v |
- v isTopView ifTrue:[
- v destroy
- ]
- ]
+ KnownWindows do:[:v |
+ v isTopView ifTrue:[
+ v destroy
+ ]
+ ]
].
JavaWindowGroup := nil.
@@ -1270,16 +1270,16 @@
"install additional java protocol in smalltalk classes, req'd for java programs"
#(
- #'clone()Ljava/lang/Object;'
- #'equals(Ljava/lang/Object;)Z'
- #'toString()Ljava/lang/String;'
- #'getClass()Ljava/lang/Class;'
+ #'clone()Ljava/lang/Object;'
+ #'equals(Ljava/lang/Object;)Z'
+ #'toString()Ljava/lang/String;'
+ #'getClass()Ljava/lang/Class;'
) do:[:sel |
- (Object implements:sel) ifTrue:[
- Class withoutUpdatingChangesDo:[
- Object removeSelector:sel.
- ]
- ].
+ (Object implements:sel) ifTrue:[
+ Class withoutUpdatingChangesDo:[
+ Object removeSelector:sel.
+ ]
+ ].
].
"
@@ -1366,86 +1366,86 @@
"/ Object, to be on the bright side of life; more of this later ...
self
- compile:'__clone
+ compile:'__clone
"this is smalltalk code with a java selector ...
(This source cannot be accepted in the browser,
since it has a funny selector.)
Has been added by JavaVM>>initializeAdditionalJavaProtocol"
^ self shallowCopy'
- selector:#'__clone'
- asJavaMethod:#'clone()Ljava/lang/Object;'
- fakedSource:'#''clone()Ljava/lang/Object;''
+ selector:#'__clone'
+ asJavaMethod:#'clone()Ljava/lang/Object;'
+ fakedSource:'#''clone()Ljava/lang/Object;''
"this is smalltalk code with a java selector ...
(This source cannot be accepted in the browser,
since it has a funny selector.)
Has been added by JavaVM>>initializeAdditionalJavaProtocol"
^ self shallowCopy'
- in:Object.
+ in:Object.
"/ ------------------------------------------------------------
self
- compile:'__equals:arg
+ compile:'__equals:arg
"this is smalltalk code with a java selector ...
(This source cannot be accepted in the browser,
since it has a funny selector.)
Has been added by JavaVM>>initializeAdditionalJavaProtocol"
^ (arg = self) ifTrue:[1] ifFalse:[0]'
- selector:#'__equals:'
- asJavaMethod:#'equals(Ljava/lang/Object;)Z'
- fakedSource:'#''equals(Ljava/lang/Object;)Z''
+ selector:#'__equals:'
+ asJavaMethod:#'equals(Ljava/lang/Object;)Z'
+ fakedSource:'#''equals(Ljava/lang/Object;)Z''
"this is smalltalk code with a java selector ...
(This source cannot be accepted in the browser,
since it has a funny selector.)
Has been added by JavaVM>>initializeAdditionalJavaProtocol"
^ (arg = self) ifTrue:[1] ifFalse:[0]'
- in:Object.
+ in:Object.
"/ ------------------------------------------------------------
self
- compile:'__toString
+ compile:'__toString
"this is smalltalk code with a java selector ...
(This source cannot be accepted in the browser,
since it has a funny selector.)
Has been added by JavaVM>>initializeAdditionalJavaProtocol"
^ Java as_String:(self displayString)'
- selector:#'__toString'
- asJavaMethod:#'toString()Ljava/lang/String;'
- fakedSource:'#''toString()Ljava/lang/String;''
+ selector:#'__toString'
+ asJavaMethod:#'toString()Ljava/lang/String;'
+ fakedSource:'#''toString()Ljava/lang/String;''
"this is smalltalk code with a java selector ...
(This source cannot be accepted in the browser,
since it has a funny selector.)
Has been added by JavaVM>>initializeAdditionalJavaProtocol"
^ Java as_String:(self displayString)'
- in:Object.
+ in:Object.
"/ ------------------------------------------------------------
self
- compile:'__getClass
+ compile:'__getClass
"this is smalltalk code with a java selector ...
(This source cannot be accepted in the browser,
since it has a funny selector.)
Has been added by JavaVM>>initializeAdditionalJavaProtocol"
^ JavaVM javaClassObjectForClass:self class'
- selector:#'__getClass'
- asJavaMethod:#'getClass()Ljava/lang/Class;'
- fakedSource:'#''getClass()Ljava/lang/Class;''
+ selector:#'__getClass'
+ asJavaMethod:#'getClass()Ljava/lang/Class;'
+ fakedSource:'#''getClass()Ljava/lang/Class;''
"this is smalltalk code with a java selector ...
(This source cannot be accepted in the browser,
since it has a funny selector.)
Has been added by JavaVM>>initializeAdditionalJavaProtocol"
^ JavaVM javaClassObjectForClass:self class'
- in:Object.
+ in:Object.
"
self initializeAdditionalJavaProtocol
@@ -1461,15 +1461,15 @@
"load req'd base classes"
#(
- 'java.lang.Object'
- 'java.lang.Class'
- 'java.lang.String'
- 'java.lang.System'
+ 'java.lang.Object'
+ 'java.lang.Class'
+ 'java.lang.String'
+ 'java.lang.System'
) do:[:cName |
- (Java classForName:cName) isNil ifTrue:[
- self warn:('JavaVM: could not find required class: ' , cName asText allBold).
- ^ self
- ]
+ (Java classForName:cName) isNil ifTrue:[
+ self warn:('JavaVM: could not find required class: ' , cName asText allBold).
+ ^ self
+ ]
].
"
@@ -1496,31 +1496,31 @@
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 |
- |jClass classInst|
-
- "/
- "/ create a javaClass for it.
- "/
- jClass := Java at:'java.lang.Class'.
- jClass notNil ifTrue:[
- classInst := jClass new.
- JavaClasses at:nm put:classInst.
- JavaClasses at:classInst put:nm.
- ]
+ |jClass classInst|
+
+ "/
+ "/ create a javaClass for it.
+ "/
+ jClass := Java at:'java.lang.Class'.
+ jClass notNil ifTrue:[
+ classInst := jClass new.
+ JavaClasses at:nm put:classInst.
+ JavaClasses at:classInst put:nm.
+ ]
].
"
@@ -1536,29 +1536,29 @@
being already loaded. (used with jdk < 1.2)"
LibPath := #(
- '__builtIn__'
- '/usr/local/lib'
- '/usr/local/lib/java'
- ).
+ '__builtIn__'
+ '/usr/local/lib'
+ '/usr/local/lib/java'
+ ).
SimulatedLibs := #(
- '__builtIn__/net'
- '__builtIn__/awt'
- '__builtIn__/tawt'
- '__builtIn__/winawt'
- '__builtIn__/jpeg'
- '__builtIn__/mmedia'
- '__builtIn__/zip'
- '__builtIn__/math'
- '__builtIn__/sysresource'
-
- "/ KAVA ...
- '__builtIn__/agent'
-
- "/ MS-java ...
- '__builtIn__/msawt'
- '__builtIn__/javart'
- ).
+ '__builtIn__/net'
+ '__builtIn__/awt'
+ '__builtIn__/tawt'
+ '__builtIn__/winawt'
+ '__builtIn__/jpeg'
+ '__builtIn__/mmedia'
+ '__builtIn__/zip'
+ '__builtIn__/math'
+ '__builtIn__/sysresource'
+
+ "/ KAVA ...
+ '__builtIn__/agent'
+
+ "/ MS-java ...
+ '__builtIn__/msawt'
+ '__builtIn__/javart'
+ ).
"
self initializeSimulatedLibs
@@ -1573,10 +1573,10 @@
being already loaded (used with jdk >= 1.2)"
SimulatedNativeLibs := #(
- '/libawt.so'
- '/libnet.so'
- '/libcmm.so'
- ).
+ '/libawt.so'
+ '/libnet.so'
+ '/libcmm.so'
+ ).
"
self initializeSimulatedNativeLibs
@@ -1591,13 +1591,13 @@
"/ use JAVA compatible cpu-name
cpu := OperatingSystem getCPUType.
cpu = 'i386' ifTrue:[
- cpu := 'ix86'
+ cpu := 'ix86'
].
SimulatedOS notNil ifTrue:[
- os := SimulatedOS
+ os := SimulatedOS
] ifFalse:[
- os := OperatingSystem getOSType.
- os := os asUppercaseFirst.
+ os := OperatingSystem getOSType.
+ os := os asUppercaseFirst.
].
props at:'java.version' put:'1'.
@@ -1661,8 +1661,8 @@
"/ by resolver ... (sigh)
JavaMethod allSubInstancesDo:[:m |
- m checked:false.
- m code:nil.
+ m checked:false.
+ m code:nil.
].
ObjectMemory flushCaches. "/ sigh - must flush inline caches.
@@ -1721,7 +1721,7 @@
classesToInit do:[:jClass |
Transcript showCR:'classInit: ' , jClass name.
- jClass classInit
+ jClass classInit
].
Java initSystemClass.
@@ -1731,7 +1731,7 @@
reinitializeVMIfNoEventThreadRunning
(JavaEventThread isNil or:[JavaEventThread isDead]) ifTrue:[
- self reinitializeVM
+ self reinitializeVM
].
"
@@ -1785,21 +1785,21 @@
releaseAllStreams
OpenFileTable notNil ifTrue:[
- OpenFileTable do:[:aStream |
- aStream notNil ifTrue:[
- aStream ~~ Stdin ifTrue:[
- aStream ~~ Stdout ifTrue:[
- aStream ~~ Stderr ifTrue:[
- aStream ~~ JavaConsoleStream ifTrue:[
- aStream isExternalStream ifTrue:[
- aStream shutDown
- ]
- ]
- ]
- ]
- ]
- ]
- ]
+ OpenFileTable do:[:aStream |
+ aStream notNil ifTrue:[
+ aStream ~~ Stdin ifTrue:[
+ aStream ~~ Stdout ifTrue:[
+ aStream ~~ Stderr ifTrue:[
+ aStream ~~ JavaConsoleStream ifTrue:[
+ aStream isExternalStream ifTrue:[
+ aStream shutDown
+ ]
+ ]
+ ]
+ ]
+ ]
+ ]
+ ]
].
self initializeOpenFileTable.
@@ -2002,7 +2002,7 @@
defaultJWSHome
'/phys/idefix/home2/java/JWS2_0/Java-WorkShop2.0/JWS' asFilename exists ifTrue:[
- ^ '/phys/idefix/home2/java/JWS2_0/Java-WorkShop2.0/JWS'
+ ^ '/phys/idefix/home2/java/JWS2_0/Java-WorkShop2.0/JWS'
].
^ '/usr/local/java/JWS'.
@@ -2015,10 +2015,10 @@
"/ prefer the windows toolkit ...
(Java classForName:'sun.awt.windows.WToolkit') notNil ifTrue:[
- ^ 'sun.awt.windows.WToolkit'.
+ ^ 'sun.awt.windows.WToolkit'.
].
(Java classForName:'sun.awt.motif.MToolkit') notNil ifTrue:[
- ^ 'sun.awt.motif.MToolkit'.
+ ^ 'sun.awt.motif.MToolkit'.
].
^ 'sun.awt.tiny.TinyToolkit'.
@@ -2158,12 +2158,12 @@
jClass := JavaClasses at:aClass ifAbsent:nil.
jClass isNil ifTrue:[
- "/ 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.
+ "/ 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
@@ -2179,10 +2179,10 @@
jMethod := JavaMethods at:aMethod ifAbsent:nil.
jMethod isNil ifTrue:[
- "/ class must be initialized (with all of its superclasses ?).
-
- JavaMethods at:aMethod put:(jMethod := (Java at:'java.lang.reflect.Method') new).
- JavaMethods at:jMethod put:aMethod.
+ "/ class must be initialized (with all of its superclasses ?).
+
+ JavaMethods at:aMethod put:(jMethod := (Java at:'java.lang.reflect.Method') new).
+ JavaMethods at:jMethod put:aMethod.
].
^ jMethod
@@ -2227,7 +2227,7 @@
"/ that on was only temporarily present in JDK1.1.3 (sigh)
"/
(i := thread class instVarOffsetOf:'initial_stack_memory') notNil ifTrue:[
- thread instVarAt:i put:0.
+ thread instVarAt:i put:0.
].
thread instVarNamed:'group' put:(self standardThreadGroup).
^ thread
@@ -2253,21 +2253,21 @@
|standardGroup threadClass|
StandardThreadGroup isNil ifTrue:[
- threadClass := Java at:'java.lang.Thread'.
-
- standardGroup := (Java at:'java.lang.ThreadGroup') new.
- standardGroup instVarNamed:'parent' put:nil.
- standardGroup instVarNamed:'name' put:(Java as_String:'main').
- standardGroup instVarNamed:'maxPriority' put:(threadClass instVarNamed:'MAX_PRIORITY').
- standardGroup instVarNamed:'destroyed' put:0.
- standardGroup instVarNamed:'daemon' put:nil.
- (standardGroup class instVarOffsetOf:'vmAllowSuspension') notNil ifTrue:[
- standardGroup instVarNamed:'vmAllowSuspension' put:0.
- ].
- standardGroup instVarNamed:'nthreads' put:0.
- standardGroup instVarNamed:'ngroups' put:0.
- standardGroup instVarNamed:'groups' put:nil.
- StandardThreadGroup := standardGroup.
+ threadClass := Java at:'java.lang.Thread'.
+
+ standardGroup := (Java at:'java.lang.ThreadGroup') new.
+ standardGroup instVarNamed:'parent' put:nil.
+ standardGroup instVarNamed:'name' put:(Java as_String:'main').
+ standardGroup instVarNamed:'maxPriority' put:(threadClass instVarNamed:'MAX_PRIORITY').
+ standardGroup instVarNamed:'destroyed' put:0.
+ standardGroup instVarNamed:'daemon' put:nil.
+ (standardGroup class instVarOffsetOf:'vmAllowSuspension') notNil ifTrue:[
+ standardGroup instVarNamed:'vmAllowSuspension' put:0.
+ ].
+ standardGroup instVarNamed:'nthreads' put:0.
+ standardGroup instVarNamed:'ngroups' put:0.
+ standardGroup instVarNamed:'groups' put:nil.
+ StandardThreadGroup := standardGroup.
].
^ StandardThreadGroup
@@ -2306,68 +2306,68 @@
"/ ' ' print. x print. '/' print. y print.
"/ ' extent: ' print. ext printNL.
view isPopUpView ifTrue:[
- view origin:x@y extent:ext.
+ view origin:x@y extent:ext.
] ifFalse:[
- (view isTopView
- or:[view isMemberOf:JavaEmbeddedFrameView]) ifTrue:[
- "/
- "/ dont allow setting the origin
- "/
- menu := self topViewsMenu:view.
- menu notNil ifTrue:[
- "/ must add the menus height
- height := height + menu height.
- ext := width@height.
- ].
-
- "/ to prevent a view from not being visible/closable
- "/ in case Java goes mad ..
-
- (width < 30
- or:[height < 10]) ifTrue:[
- "/ self halt.
- width := 30.
- height := 20.
- ext := width@height.
- ].
-
- view extent:ext.
- (view isKindOf:ModalBox) ifTrue:[
- view preferredExtent:ext
- ].
-
- "/ adjust non-resizable views min/max
-
- view isTopView ifTrue:[
- view minExtent notNil ifTrue:[
- view minExtent:ext.
- view maxExtent:ext
- ].
- ]
- ] ifFalse:[
- (view superView notNil
- and:[view superView isTopView]) ifTrue:[
- menu := self topViewsMenu:view superView.
- menu notNil ifTrue:[
- "/ must add menus height to yPos
- y := y + menu height.
- ]
- ] ifFalse:[
- "/ post a configuration event
- EventTrace == true ifTrue:[
- 'JAVA: configure: need event' printCR.
- ]
- ].
- (x isNil or:[y isNil]) ifTrue:[
- Transcript showCR:'bad args to reshape'.
- ] ifFalse:[
- view origin:x@y extent:ext.
- ]
- ].
+ (view isTopView
+ or:[view isMemberOf:JavaEmbeddedFrameView]) ifTrue:[
+ "/
+ "/ dont allow setting the origin
+ "/
+ menu := self topViewsMenu:view.
+ menu notNil ifTrue:[
+ "/ must add the menus height
+ height := height + menu height.
+ ext := width@height.
+ ].
+
+ "/ to prevent a view from not being visible/closable
+ "/ in case Java goes mad ..
+
+ (width < 30
+ or:[height < 10]) ifTrue:[
+ "/ self halt.
+ width := 30.
+ height := 20.
+ ext := width@height.
+ ].
+
+ view extent:ext.
+ (view isKindOf:ModalBox) ifTrue:[
+ view preferredExtent:ext
+ ].
+
+ "/ adjust non-resizable views min/max
+
+ view isTopView ifTrue:[
+ view minExtent notNil ifTrue:[
+ view minExtent:ext.
+ view maxExtent:ext
+ ].
+ ]
+ ] ifFalse:[
+ (view superView notNil
+ and:[view superView isTopView]) ifTrue:[
+ menu := self topViewsMenu:view superView.
+ menu notNil ifTrue:[
+ "/ must add menus height to yPos
+ y := y + menu height.
+ ]
+ ] ifFalse:[
+ "/ post a configuration event
+ EventTrace == true ifTrue:[
+ 'JAVA: configure: need event' printCR.
+ ]
+ ].
+ (x isNil or:[y isNil]) ifTrue:[
+ Transcript showCR:'bad args to reshape'.
+ ] ifFalse:[
+ view origin:x@y extent:ext.
+ ]
+ ].
].
view isJavaView ifTrue:[
- view invalidate.
+ view invalidate.
].
^ nil
@@ -2382,14 +2382,14 @@
aJavaPeer instVarNamed:'pData' put:aView.
JavaWindowGroup isNil ifTrue:[
- JavaWindowGroup := WindowGroup new.
- JavaWindowGroup isForModalSubview:true.
+ JavaWindowGroup := WindowGroup new.
+ JavaWindowGroup isForModalSubview:true.
].
aView windowGroup:JavaWindowGroup.
JavaWindowGroup addView:aView.
KnownWindows isNil ifTrue:[
- KnownWindows := IdentityDictionary new.
+ KnownWindows := IdentityDictionary new.
].
KnownWindows at:aJavaPeer put:aView.
@@ -2409,13 +2409,13 @@
jGraphics := nativeContext receiver.
O_WGgraphics_pData isNil ifTrue:[
- O_WGgraphics_pData := (jGraphics class instVarOffsetOf:'pData').
+ O_WGgraphics_pData := (jGraphics class instVarOffsetOf:'pData').
].
O_WGgraphics_originX isNil ifTrue:[
- O_WGgraphics_originX := (jGraphics class instVarOffsetOf:'originX').
+ O_WGgraphics_originX := (jGraphics class instVarOffsetOf:'originX').
].
O_WGgraphics_originY isNil ifTrue:[
- O_WGgraphics_originY := (jGraphics class instVarOffsetOf:'originY').
+ O_WGgraphics_originY := (jGraphics class instVarOffsetOf:'originY').
].
gc := jGraphics instVarAt:O_WGgraphics_pData.
@@ -2428,7 +2428,7 @@
orgX := jGraphics instVarAt:O_WGgraphics_originX.
orgY := jGraphics instVarAt:O_WGgraphics_originY.
((orgX ~~ tX) or:[orgY ~~ tY]) ifTrue:[
- gc translation:orgX@orgY
+ gc translation:orgX@orgY
].
^ gc
@@ -2459,30 +2459,30 @@
"/ ' extent: ' print. width print. '/' print. height printNL.
view isPopUpView ifTrue:[
- self halt.
+ self halt.
].
(view isTopView
or:[view isMemberOf:JavaEmbeddedFrameView]) ifTrue:[
- "/
- "/ dont allow setting the origin
- "/
- menu := self topViewsMenu:view.
- menu notNil ifTrue:[
- "/ must add the menus height
- height := height + menu height
- ].
- view extent:width@height.
+ "/
+ "/ dont allow setting the origin
+ "/
+ menu := self topViewsMenu:view.
+ menu notNil ifTrue:[
+ "/ must add the menus height
+ height := height + menu height
+ ].
+ view extent:width@height.
] ifFalse:[
- (view superView notNil
- and:[view superView isTopView]) ifTrue:[
- menu := self topViewsMenu:view superView.
- menu notNil ifTrue:[
- "/ must add menus height to yPos
- y := y + menu height.
- ]
- ].
- view origin:x@y extent:width@height.
+ (view superView notNil
+ and:[view superView isTopView]) ifTrue:[
+ menu := self topViewsMenu:view superView.
+ menu notNil ifTrue:[
+ "/ must add menus height to yPos
+ y := y + menu height.
+ ]
+ ].
+ view origin:x@y extent:width@height.
].
^ nil
@@ -2515,17 +2515,17 @@
"/ sigh; pData was renamed to pNativeWidget in jdk1.2 ...
O_FramePeer_pNativeWidget isNil ifTrue:[
- O_FramePeer_pNativeWidget := (jPeer class instVarOffsetOf:'pNativeWidget').
- O_FramePeer_pNativeWidget isNil ifTrue:[
- O_FramePeer_pNativeWidget := 0.
- O_FramePeer_pData isNil ifTrue:[
- O_FramePeer_pData := (jPeer class instVarOffsetOf:'pData').
- ].
- ]
+ O_FramePeer_pNativeWidget := (jPeer class instVarOffsetOf:'pNativeWidget').
+ O_FramePeer_pNativeWidget isNil ifTrue:[
+ O_FramePeer_pNativeWidget := 0.
+ O_FramePeer_pData isNil ifTrue:[
+ O_FramePeer_pData := (jPeer class instVarOffsetOf:'pData').
+ ].
+ ]
].
O_FramePeer_pNativeWidget > 0 ifTrue:[
- "/ ok, we are < 1.2
- ^ jPeer instVarAt:O_FramePeer_pNativeWidget.
+ "/ ok, we are < 1.2
+ ^ jPeer instVarAt:O_FramePeer_pNativeWidget.
].
^ jPeer instVarAt:O_FramePeer_pData.
@@ -2558,14 +2558,14 @@
throwArrayStoreException:badArray
^ self
- throwExceptionClassName:'java.lang.ArrayStoreException'
- withMessage:('bad array store: ' , badArray printString)
+ throwExceptionClassName:'java.lang.ArrayStoreException'
+ withMessage:('bad array store: ' , badArray printString)
!
throwClassCastException
^ self
- throwExceptionClassName:'java.lang.ClassCastException'
- withMessage:'cast failed'
+ throwExceptionClassName:'java.lang.ClassCastException'
+ withMessage:'cast failed'
"Modified: / 7.1.1998 / 15:25:35 / cg"
"Created: / 8.1.1999 / 18:55:31 / cg"
@@ -2573,8 +2573,8 @@
throwClassNotFoundException
^ self
- throwExceptionClassName:'java.lang.ClassNotFoundException'
- withMessage:'no such class'
+ throwExceptionClassName:'java.lang.ClassNotFoundException'
+ withMessage:'no such class'
"Created: / 4.1.1998 / 22:25:26 / cg"
"Modified: / 7.1.1998 / 15:25:35 / cg"
@@ -2582,8 +2582,8 @@
throwClassNotFoundException:className
^ self
- throwExceptionClassName:'java.lang.ClassNotFoundException'
- withMessage:'no such class: ' , className
+ throwExceptionClassName:'java.lang.ClassNotFoundException'
+ withMessage:'no such class: ' , className
"Created: / 4.1.1998 / 22:26:09 / cg"
"Modified: / 10.11.1998 / 13:20:31 / cg"
@@ -2591,11 +2591,11 @@
throwDivisionByZeroException
DivisionByZeroExceptionDebug == true ifTrue:[
- self halt:'division by zero'.
+ self halt:'division by zero'.
].
^ self
- throwExceptionClassName:'java.lang.ArithmeticException'
- withMessage:'division by zero'
+ throwExceptionClassName:'java.lang.ArithmeticException'
+ withMessage:'division by zero'
"Created: / 8.1.1999 / 14:28:15 / cg"
!
@@ -2605,17 +2605,17 @@
monitorObject|
ExceptionTrace ifTrue:[
- 'JAVA: exception: ' print. aJavaException class fullName print.
- msg := aJavaException instVarNamed:'detailMessage'.
- msg notNil ifTrue:[
- ' (' print.
- (Java as_ST_String:msg) print.
- ')' print.
- ].
- '' printCR.
+ 'JAVA: exception: ' print. aJavaException class fullName print.
+ msg := aJavaException instVarNamed:'detailMessage'.
+ msg notNil ifTrue:[
+ ' (' print.
+ (Java as_ST_String:msg) print.
+ ')' print.
+ ].
+ '' printCR.
].
ExceptionDebug ifTrue:[
- self halt:('JAVA: exceptionDebug: ' , aJavaException class fullName).
+ self halt:('JAVA: exceptionDebug: ' , aJavaException class fullName).
"/ self internalError:('JAVA: exception: ' , aJavaException class fullName).
].
@@ -2624,60 +2624,60 @@
"/
srchCon := thisContext sender.
[handlerContext isNil and:[srchCon notNil]] whileTrue:[
- (srchCon isJavaContext) ifTrue:[
- method := srchCon method.
- pc := srchCon pc.
- (hPC := method handlerFor:aJavaException at:pc) notNil ifTrue:[
- handlerPC := hPC.
- handlerContext := srchCon
- ] ifFalse:[
- "/ on the fly, release any monitor
- method isSynchronized ifTrue:[
- method isStatic ifTrue:[
- monitorObject := method javaClass
- ] ifFalse:[
- monitorObject := srchCon receiver
- ].
- self _MONITOREXIT:monitorObject
- ]
- ]
- ].
- srchCon := srchCon sender.
+ (srchCon isJavaContext) ifTrue:[
+ method := srchCon method.
+ pc := srchCon pc.
+ (hPC := method handlerFor:aJavaException at:pc) notNil ifTrue:[
+ handlerPC := hPC.
+ handlerContext := srchCon
+ ] ifFalse:[
+ "/ on the fly, release any monitor
+ method isSynchronized ifTrue:[
+ method isStatic ifTrue:[
+ monitorObject := method javaClass
+ ] ifFalse:[
+ monitorObject := srchCon receiver
+ ].
+ self _MONITOREXIT:monitorObject
+ ]
+ ]
+ ].
+ srchCon := srchCon sender.
].
handlerContext isNil ifTrue:[
- "/
- "/ no JavaHandler ... let smalltalk handle it
- "/
- exClass := aJavaException class.
- msg := 'Java ' , exClass name.
- jMsg := aJavaException instVarNamed:'detailMessage'.
- jMsg notNil ifTrue:[
- msg := msg , ': ' , (Java as_ST_String:jMsg).
- ].
-
- "/ for our convenience: skip ST contexts
- "/ (i.e. the handler or debugger will see the javaContext first )
-
- con := thisContext sender.
- [con isNil or:[con isJavaContext]] whileFalse:[
- con := con sender
- ].
- con isNil ifTrue:[con := thisContext sender].
-
- JavaVM javaExceptionSignal
- raiseWith:aJavaException
- errorString:msg
- in:con.
+ "/
+ "/ no JavaHandler ... let smalltalk handle it
+ "/
+ exClass := aJavaException class.
+ msg := 'Java ' , exClass name.
+ jMsg := aJavaException instVarNamed:'detailMessage'.
+ jMsg notNil ifTrue:[
+ msg := msg , ': ' , (Java as_ST_String:jMsg).
+ ].
+
+ "/ for our convenience: skip ST contexts
+ "/ (i.e. the handler or debugger will see the javaContext first )
+
+ con := thisContext sender.
+ [con isNil or:[con isJavaContext]] whileFalse:[
+ con := con sender
+ ].
+ con isNil ifTrue:[con := thisContext sender].
+
+ JavaVM javaExceptionSignal
+ raiseWith:aJavaException
+ errorString:msg
+ in:con.
] ifFalse:[
- "/
- "/ found a java exceptionHandler
- "/
- handlerContext setPC:handlerPC.
- handlerContext exceptionArg:aJavaException pc:handlerPC.
- handlerContext markForException.
- handlerContext unwindAndRestart.
- self halt:'should not be reached'.
+ "/
+ "/ found a java exceptionHandler
+ "/
+ handlerContext setPC:handlerPC.
+ handlerContext exceptionArg:aJavaException pc:handlerPC.
+ handlerContext markForException.
+ handlerContext unwindAndRestart.
+ self halt:'should not be reached'.
].
Processor activeProcess == JavaScreenUpdaterThread ifTrue:[self halt].
Processor activeProcess terminate.
@@ -2699,11 +2699,11 @@
throwIOExceptionWithMessage:message
IOExceptionDebug == true ifTrue:[
- self halt:'IO Exception'.
+ self halt:'IO Exception'.
].
^ self
- throwExceptionClassName:'java.io.IOException'
- withMessage:message
+ throwExceptionClassName:'java.io.IOException'
+ withMessage:message
"Created: / 7.1.1998 / 10:34:24 / cg"
"Modified: / 7.1.1998 / 15:26:25 / cg"
@@ -2711,8 +2711,8 @@
throwIllegalAccessException
^ self
- throwExceptionClassName:'java.lang.IllegalAccessException'
- withMessage:'illegal access'
+ throwExceptionClassName:'java.lang.IllegalAccessException'
+ withMessage:'illegal access'
"Modified: / 7.1.1998 / 15:25:35 / cg"
"Created: / 14.1.1998 / 23:13:44 / cg"
@@ -2720,8 +2720,8 @@
throwInstantiationException
^ self
- throwExceptionClassName:'java.lang.InstantiationException'
- withMessage:'cannot instantiate'
+ throwExceptionClassName:'java.lang.InstantiationException'
+ withMessage:'cannot instantiate'
"Modified: / 7.1.1998 / 15:25:35 / cg"
"Created: / 14.1.1998 / 23:15:01 / cg"
@@ -2729,8 +2729,8 @@
throwInstantiationExceptionFor:aJavaClass
^ self
- throwExceptionClassName:'java.lang.InstantiationException'
- withMessage:('cannot instantiate ' , aJavaClass fullName)
+ throwExceptionClassName:'java.lang.InstantiationException'
+ withMessage:('cannot instantiate ' , aJavaClass fullName)
"Modified: / 7.1.1998 / 15:25:35 / cg"
"Created: / 14.1.1998 / 23:17:02 / cg"
@@ -2738,12 +2738,12 @@
throwNullPointerException
NullPointerExceptionDebug == true ifTrue:[
- self halt:'Null Pointer exception'.
+ self halt:'Null Pointer exception'.
].
^ self
- throwExceptionClassName:'java.lang.NullPointerException'
- withMessage:'null pointer'
+ throwExceptionClassName:'java.lang.NullPointerException'
+ withMessage:'null pointer'
"Created: / 9.1.1998 / 02:26:08 / cg"
"Modified: / 28.1.1998 / 02:30:09 / cg"
@@ -2751,8 +2751,8 @@
throwNumberFormatException
^ self
- throwExceptionClassName:'java.lang.NumberFormatException'
- withMessage:'bad number format'
+ throwExceptionClassName:'java.lang.NumberFormatException'
+ withMessage:'bad number format'
"Modified: / 7.1.1998 / 15:25:35 / cg"
"Created: / 11.1.1998 / 16:08:22 / cg"
@@ -2767,21 +2767,21 @@
fileNo := self validateFileNo:jStream.
fileNo == 0 ifTrue:[
- 'JAVA: file is already closed' errorPrintCR.
- ^ self "/ already closed
+ 'JAVA: file is already closed' errorPrintCR.
+ ^ self "/ already closed
].
file := self getOpenFileAt:fileNo.
file isNil ifTrue:[
- self halt:'invalid fileNo in close'.
- self internalError:'invalid fileNo in close'.
- ^ self
+ self halt:'invalid fileNo in close'.
+ self internalError:'invalid fileNo in close'.
+ ^ self
].
file == Stdin ifTrue:[
- file := StdinReplacementFileQuerySignal raiseRequest.
- file isNil ifTrue:[
- file := Stdin
- ]
+ file := StdinReplacementFileQuerySignal raiseRequest.
+ file isNil ifTrue:[
+ file := Stdin
+ ]
].
"/ should always be bytes
@@ -2790,17 +2790,17 @@
and:[file ~~ Stdout
and:[file ~~ Stderr
and:[file ~~ Transcript]]]) ifTrue:[
- file close.
+ file close.
].
self setOpenFile:nil at:fileNo.
fileNo := jStream instVarNamed:'fd'.
fileNo isInteger ifFalse:[
- "/ JDK 1.1.3
- fileNo instVarNamed:'fd' put:0.
+ "/ JDK 1.1.3
+ fileNo instVarNamed:'fd' put:0.
] ifTrue:[
- "/ JDK 1.0
- jStream instVarNamed:'fd' put:0
+ "/ JDK 1.0
+ jStream instVarNamed:'fd' put:0
].
"Created: / 4.2.1998 / 15:22:03 / cg"
@@ -2818,42 +2818,42 @@
"/ should always be bytes
bytes class isBytes ifFalse:[
- self halt.
+ self halt.
].
stream == Stdin ifTrue:[
- stream := StdinReplacementFileQuerySignal raiseRequest.
- stream isNil ifTrue:[
- ^ -1 "/ 0 EOF
- ]
+ stream := StdinReplacementFileQuerySignal raiseRequest.
+ stream isNil ifTrue:[
+ ^ -1 "/ 0 EOF
+ ]
].
FileIOTrace ifTrue:[
- ('JAVA: read ' , count printString , ' bytes from ' , stream pathName) infoPrintCR.
+ ('JAVA: read ' , count printString , ' bytes from ' , stream pathName) infoPrintCR.
].
stream isPositionable ifFalse:[
- "/ mhmh - some kind of socket or pipe
-
- stream readWait.
+ "/ mhmh - some kind of socket or pipe
+
+ stream readWait.
].
Stream readErrorSignal handle:[:ex |
- nRead := -1
+ nRead := -1
] do:[
- nRead := stream nextAvailableBytes:count into:bytes startingAt:offset+1.
+ nRead := stream nextAvailableBytes:count into:bytes startingAt:offset+1.
].
nRead == 0 ifTrue:[
- stream atEnd ifTrue:[
- FileIOTrace ifTrue:[
- ('JAVA: at EOF ' , nRead printString) infoPrintCR.
- ].
- ^ -1
- ].
+ stream atEnd ifTrue:[
+ FileIOTrace ifTrue:[
+ ('JAVA: at EOF ' , nRead printString) infoPrintCR.
+ ].
+ ^ -1
+ ].
].
count ~~ nRead ifTrue:[
- FileIOTrace ifTrue:[
- ('JAVA: only got ' , nRead printString) infoPrintCR.
- ]
+ FileIOTrace ifTrue:[
+ ('JAVA: only got ' , nRead printString) infoPrintCR.
+ ]
].
^ nRead
@@ -2871,29 +2871,29 @@
stream := self validateFile:(nativeContext receiver).
FileIOTrace ifTrue:[
- stream isFileStream ifTrue:[
- ('JAVA: write ' , count printString , ' bytes to ' , stream pathName) infoPrintCR.
- ] ifFalse:[
- stream ~~ Stdout ifTrue:[
- stream ~~ Stderr ifTrue:[
- ('JAVA: write ' , count printString , ' bytes to ' , stream displayString) infoPrintCR.
- ]
- ]
- ]
+ stream isFileStream ifTrue:[
+ ('JAVA: write ' , count printString , ' bytes to ' , stream pathName) infoPrintCR.
+ ] ifFalse:[
+ stream ~~ Stdout ifTrue:[
+ stream ~~ Stderr ifTrue:[
+ ('JAVA: write ' , count printString , ' bytes to ' , stream displayString) infoPrintCR.
+ ]
+ ]
+ ]
].
"/ should always be bytes
Stream writeErrorSignal handle:[:ex |
- ex return
+ ex return
] do:[
- Socket brokenConnectionSignal handle:[:ex |
- ex return
- ] do:[
- stream nextPutBytes:count from:bytes startingAt:offset+1
- ].
- stream == Transcript ifTrue:[
- Transcript endEntry
- ]
+ Socket brokenConnectionSignal handle:[:ex |
+ ex return
+ ] do:[
+ stream nextPutBytes:count from:bytes startingAt:offset+1
+ ].
+ stream == Transcript ifTrue:[
+ Transcript endEntry
+ ]
].
"Created: / 4.2.1998 / 15:23:58 / cg"
@@ -2905,24 +2905,24 @@
(PermittedDirectories notNil
and:[PermittedDirectories includes:dir]) ifFalse:[
- FileOpenConfirmation ifTrue:[
- answer := Dialog
- confirmWithCancel:msg withCRs
- labels:#('no' 'grant')
- values:#(false true)
- default:2.
- answer == false ifTrue:[
- ^ false
- ].
-
- (self confirm:('JAVA Security check\\Always permit writes in this directory (''' , dir pathName , ''') ?') withCRs)
- ifTrue:[
- PermittedDirectories isNil ifTrue:[
- PermittedDirectories := Set new
- ].
- PermittedDirectories add:dir.
- ]
- ]
+ FileOpenConfirmation ifTrue:[
+ answer := Dialog
+ confirmWithCancel:msg withCRs
+ labels:#('no' 'grant')
+ values:#(false true)
+ default:2.
+ answer == false ifTrue:[
+ ^ false
+ ].
+
+ (self confirm:('JAVA Security check\\Always permit writes in this directory (''' , dir pathName , ''') ?') withCRs)
+ ifTrue:[
+ PermittedDirectories isNil ifTrue:[
+ PermittedDirectories := Set new
+ ].
+ PermittedDirectories add:dir.
+ ]
+ ]
].
^ true
@@ -2936,16 +2936,16 @@
fs := nativeContext receiver.
fd := fs instVarNamed:'fd'.
(fd instVarNamed:'fd') ~~ 0 ifTrue:[
- self halt:'file already open'.
- self internalError:'file already open'.
- ^ self.
+ self halt:'file already open'.
+ self internalError:'file already open'.
+ ^ self.
].
name := nativeContext argAt:1.
name := Java as_ST_String:name.
FileOpenTrace ifTrue:[
- ('JAVA: opening ' , name) infoPrintCR.
+ ('JAVA: opening ' , name) infoPrintCR.
].
fn := name asFilename.
@@ -2954,47 +2954,47 @@
readonly := false.
(PermittedDirectories notNil
and:[PermittedDirectories includes:dir]) ifFalse:[
- FileOpenConfirmation ifTrue:[
- answer := Dialog
- confirmWithCancel:('JAVA Security check\\Opening ''' , name , ''' for read/write.\Grant permission ?') withCRs
- labels:#('no' 'grant' 'readonly')
- values:#(false true #readonly)
- default:3.
- answer == false ifTrue:[
- self throwIOExceptionWithMessage:('no permission to open ' , name , ' for writing').
- ^ self
- ].
- readonly := (answer == #readonly).
-
- readonly ifFalse:[
- (self confirm:('JAVA Security check\\Always permit writes in this directory (''' , dir , ''') ?') withCRs)
- ifTrue:[
- PermittedDirectories isNil ifTrue:[
- PermittedDirectories := Set new
- ].
- PermittedDirectories add:dir.
- ]
- ]
- ]
+ FileOpenConfirmation ifTrue:[
+ answer := Dialog
+ confirmWithCancel:('JAVA Security check\\Opening ''' , name , ''' for read/write.\Grant permission ?') withCRs
+ labels:#('no' 'grant' 'readonly')
+ values:#(false true #readonly)
+ default:3.
+ answer == false ifTrue:[
+ self throwIOExceptionWithMessage:('no permission to open ' , name , ' for writing').
+ ^ self
+ ].
+ readonly := (answer == #readonly).
+
+ readonly ifFalse:[
+ (self confirm:('JAVA Security check\\Always permit writes in this directory (''' , dir , ''') ?') withCRs)
+ ifTrue:[
+ PermittedDirectories isNil ifTrue:[
+ PermittedDirectories := Set new
+ ].
+ PermittedDirectories add:dir.
+ ]
+ ]
+ ]
].
readonly ifTrue:[
- stream := fn readStream.
+ stream := fn readStream.
] ifFalse:[
- forAppend ifTrue:[
- stream := fn appendingWriteStream.
- ] ifFalse:[
- stream := fn writeStream.
- ]
+ forAppend ifTrue:[
+ stream := fn appendingWriteStream.
+ ] ifFalse:[
+ stream := fn writeStream.
+ ]
].
stream isNil ifTrue:[
- self throwIOExceptionWithMessage:('cannot open ' , name , ' for writing').
+ self throwIOExceptionWithMessage:('cannot open ' , name , ' for writing').
].
fileNo := self addOpenFile:stream.
FileOpenTrace ifTrue:[
- ('JAVA: opened ' , name , ' as FD ' , fileNo printString , ' for writing') infoPrintCR.
+ ('JAVA: opened ' , name , ' as FD ' , fileNo printString , ' for writing') infoPrintCR.
].
fd instVarNamed:'fd' put:fileNo.
@@ -3007,20 +3007,20 @@
|fn stream tryAlongClassPath|
FileOpenTrace ifTrue:[
- ('JAVA: opening for read:' , name) infoPrintCR.
+ ('JAVA: opening for read:' , name) infoPrintCR.
].
fn := name asFilename.
stream := fn readStream.
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 := true.
+ "/ 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.
@@ -3029,16 +3029,16 @@
"/ tryAlongClassPath := true.
"/ ].
- tryAlongClassPath ifTrue:[
- Java classPath do:[:dirName |
- |fn|
-
- (fn := dirName asFilename construct:name) exists ifTrue:[
- stream := fn readStream.
- stream notNil ifTrue:[^ stream].
- ]
- ]
- ]
+ tryAlongClassPath ifTrue:[
+ Java classPath do:[:dirName |
+ |fn|
+
+ (fn := dirName asFilename construct:name) exists ifTrue:[
+ stream := fn readStream.
+ stream notNil ifTrue:[^ stream].
+ ]
+ ]
+ ]
].
^ nil.
@@ -3047,11 +3047,11 @@
fixFilename:path
OperatingSystem isMSDOSlike ifTrue:[
- (#($/ $\) includes:(path at:1)) ifTrue:[
- (path at:3) == $: ifTrue:[
- ^ path copyFrom:2
- ]
- ]
+ (#($/ $\) includes:(path at:1)) ifTrue:[
+ (path at:3) == $: ifTrue:[
+ ^ path copyFrom:2
+ ]
+ ]
].
^ path
@@ -3093,17 +3093,17 @@
fileNo := javaStream instVarNamed:'fd'.
fileNo isInteger ifFalse:[
- descriptor := fileNo.
- descriptor notNil ifTrue:[
- fileNo := descriptor instVarNamed:'fd'.
- ]
+ descriptor := fileNo.
+ descriptor notNil ifTrue:[
+ fileNo := descriptor instVarNamed:'fd'.
+ ]
].
fileNo isInteger ifFalse:[
"/ self halt:'invalid fileNo in read'.
"/ self internalError:'invalid fileNo in read'.
- self throwIOExceptionWithMessage:'invalid fileNo in read'.
- ^ nil
+ self throwIOExceptionWithMessage:'invalid fileNo in read'.
+ ^ nil
].
^ fileNo.
@@ -3130,18 +3130,18 @@
fileNo := nativeContext argAt:2.
fileNo == 0 ifTrue:[
- myStream := Stdin
+ myStream := Stdin
] ifFalse:[
- fileNo == 1 ifTrue:[
- myStream := JavaConsoleStream ? Stdout
- ] ifFalse:[
- fileNo == 2 ifTrue:[
- myStream := JavaConsoleStream ? Stderr
- ] ifFalse:[
- self halt:'invalid fileNo given'.
- self internalError:'invalid fileNo given'.
- ]
- ]
+ fileNo == 1 ifTrue:[
+ myStream := JavaConsoleStream ? Stdout
+ ] ifFalse:[
+ fileNo == 2 ifTrue:[
+ myStream := JavaConsoleStream ? Stderr
+ ] ifFalse:[
+ self halt:'invalid fileNo given'.
+ self internalError:'invalid fileNo given'.
+ ]
+ ]
].
self setOpenFile:myStream at:fileNo.
@@ -3180,20 +3180,20 @@
file := self validateFile:(nativeContext receiver).
file isNil ifTrue:[
- self throwIOExceptionWithMessage:'invalid fileNo in available'.
- ^ self
+ self throwIOExceptionWithMessage:'invalid fileNo in available'.
+ ^ self
].
file == Stdin ifTrue:[
- file := StdinReplacementFileQuerySignal raiseRequest.
- file isNil ifTrue:[
- ^ 1
- ]
+ file := StdinReplacementFileQuerySignal raiseRequest.
+ file isNil ifTrue:[
+ ^ 1
+ ]
].
file isFileStream ifTrue:[
- ^ file size - file position + 1
+ ^ file size - file position + 1
].
file atEnd ifTrue:[
- ^ 0.
+ ^ 0.
].
self halt.
^ 1
@@ -3214,11 +3214,11 @@
fs := nativeContext receiver.
fd := fs instVarNamed:'fd'.
(fileNo := fd instVarNamed:'fd') ~~ 0 ifTrue:[
- fileNo ~~ -1 ifTrue:[
- self halt:'file already open'.
- self internalError:'file already open'.
- ^ self.
- ]
+ fileNo ~~ -1 ifTrue:[
+ self halt:'file already open'.
+ self internalError:'file already open'.
+ ^ self.
+ ]
].
name := nativeContext argAt:1.
@@ -3227,18 +3227,18 @@
name := self fixFilename:name.
FileOpenTrace ifTrue:[
- ('JAVA: opening ' , name) infoPrintCR.
+ ('JAVA: opening ' , name) infoPrintCR.
].
stream := self fileStreamForReading:name.
stream isNil ifTrue:[
- FileOpenTrace ifTrue:[
- ('JAVA: failed to open ''' , name , ''' for reading.') infoPrintCR.
- ].
-
- self throwIOExceptionWithMessage:('cannot open ' , name , ' for reading').
-
- ^ self.
+ FileOpenTrace ifTrue:[
+ ('JAVA: failed to open ''' , name , ''' for reading.') infoPrintCR.
+ ].
+
+ self throwIOExceptionWithMessage:('cannot open ' , name , ' for reading').
+
+ ^ self.
].
stream buffered:false.
@@ -3253,7 +3253,7 @@
fileNo := self addOpenFile:stream.
FileOpenTrace ifTrue:[
- ('JAVA: opened ' , name , ' as FD ' , fileNo printString) infoPrintCR.
+ ('JAVA: opened ' , name , ' as FD ' , fileNo printString) infoPrintCR.
].
fd instVarNamed:'fd' put:fileNo.
@@ -3268,19 +3268,19 @@
file := self validateFile:(nativeContext receiver).
file == Stdin ifTrue:[
- file := StdinReplacementFileQuerySignal raiseRequest.
- file isNil ifTrue:[
- ^ -1
- ]
+ file := StdinReplacementFileQuerySignal raiseRequest.
+ file isNil ifTrue:[
+ ^ -1
+ ]
].
FileIOTrace ifTrue:[
- ('JAVA: read 1 byte from ' , file pathName) infoPrintCR.
+ ('JAVA: read 1 byte from ' , file pathName) infoPrintCR.
].
byte := file nextByte.
byte isNil ifTrue:[
- ^ -1
+ ^ -1
].
^ byte
@@ -3302,14 +3302,14 @@
nSkip := nativeContext argAt:1.
file == Stdin ifTrue:[
- file := StdinReplacementFileQuerySignal raiseRequest.
- file isNil ifTrue:[
- ^ -1
- ]
+ file := StdinReplacementFileQuerySignal raiseRequest.
+ file isNil ifTrue:[
+ ^ -1
+ ]
].
FileIOTrace ifTrue:[
- (('JAVA: skip %1 byte(s) from ' bindWith:nSkip printString) , file pathName) infoPrintCR.
+ (('JAVA: skip %1 byte(s) from ' bindWith:nSkip printString) , file pathName) infoPrintCR.
].
file skip:nSkip.
@@ -3376,16 +3376,16 @@
file := nativeContext receiver.
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
- ]
+ 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
+ ]
].
^ 0 "/ FALSE
@@ -3399,14 +3399,14 @@
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:[
- ^ 1 "/ TRUE
- ]
+ FileAccessTrace == true ifTrue:[
+ path storeString print. ' ' print. thisContext printCR
+ ].
+ path := Java as_ST_String:path.
+ path := self fixFilename:path.
+ (f := path asFilename) isWritable ifTrue:[
+ ^ 1 "/ TRUE
+ ]
].
^ 0 "/ FALSE
@@ -3426,19 +3426,19 @@
oldF := oldPath asFilename.
oldF exists ifFalse:[
- ^ 1 "/ TRUE
+ ^ 1 "/ TRUE
].
(self checkWritePermissionOfDirectory:oldF directory message:('JAVA Security check\\Delete of ''' , oldPath , '''.\Grant permission ?'))
ifFalse:[
- ^ 0 "/ FALSE
+ ^ 0 "/ FALSE
].
OperatingSystem accessDeniedErrorSignal handle:[:ex |
- ^ 0 "/ FALSE
+ ^ 0 "/ FALSE
] do:[
- oldF delete.
- ^ 1 "/ TRUE
+ oldF delete.
+ ^ 1 "/ TRUE
].
^ 0 "/ FALSE
@@ -3451,14 +3451,14 @@
file := nativeContext receiver.
path := file instVarNamed:'path'.
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"
- ]
+ 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"
+ ]
].
^ 0 "FALSE"
@@ -3472,11 +3472,11 @@
file := nativeContext receiver.
path := file instVarNamed:'path'.
path notNil ifTrue:[
- path := Java as_ST_String:path.
- path := self fixFilename: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
@@ -3490,14 +3490,14 @@
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:[
- f isDirectory ifTrue:[^ 1 "TRUE"]
- ]
+ FileAccessTrace == true ifTrue:[
+ path storeString print. ' ' print. thisContext printCR
+ ].
+ path := Java as_ST_String:path.
+ path := self fixFilename:path.
+ (f := path asFilename) exists ifTrue:[
+ f isDirectory ifTrue:[^ 1 "TRUE"]
+ ]
].
^ 0 "FALSE"
@@ -3511,14 +3511,14 @@
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:[
- f isDirectory ifFalse:[^ 1 "TRUE"]
- ]
+ FileAccessTrace == true ifTrue:[
+ path storeString print. ' ' print. thisContext printCR
+ ].
+ path := Java as_ST_String:path.
+ path := self fixFilename:path.
+ (f := path asFilename) exists ifTrue:[
+ f isDirectory ifFalse:[^ 1 "TRUE"]
+ ]
].
^ 0 "/ FALSE
@@ -3532,11 +3532,11 @@
file := nativeContext receiver.
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.
- ]
+ path := Java as_ST_String:path.
+ path := self fixFilename:path.
+ (f := path asFilename) exists ifTrue:[
+ ^ f modificationTime getMilliseconds.
+ ]
].
^ 0
@@ -3550,14 +3550,14 @@
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:[
- ^ f fileSize
- ]
+ FileAccessTrace == true ifTrue:[
+ thisContext printCR
+ ].
+ path := Java as_ST_String:path.
+ path := self fixFilename:path.
+ (f := path asFilename) exists ifTrue:[
+ ^ f fileSize
+ ]
].
^ -1
@@ -3571,15 +3571,15 @@
file := nativeContext receiver.
path := file instVarNamed:'path'.
path notNil ifTrue:[
- 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
- ]
- ]
+ 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
@@ -3593,27 +3593,27 @@
file := nativeContext receiver.
path := file instVarNamed:'path'.
path notNil ifTrue:[
- path := Java as_ST_String:path.
- path := self fixFilename:path.
- f := path asFilename.
- (f exists and:[f isDirectory]) ifTrue:[
- ^ 0 "/ FALSE
- ].
-
- FileOpenConfirmation ifTrue:[
- (self confirm:('JAVA Security check\\Create directory ''' , path , '''.\Grant permission ?') withCRs)
- ifFalse:[
- ^ 0 "/ FALSE
- ]
- ].
- OperatingSystem accessDeniedErrorSignal handle:[:ex |
- ^ 0 "/ FALSE
- ] do:[
- f makeDirectory.
- ].
- f exists ifTrue:[
- f isDirectory ifTrue:[^ 1 "TRUE"]
- ]
+ path := Java as_ST_String:path.
+ path := self fixFilename:path.
+ f := path asFilename.
+ (f exists and:[f isDirectory]) ifTrue:[
+ ^ 0 "/ FALSE
+ ].
+
+ FileOpenConfirmation ifTrue:[
+ (self confirm:('JAVA Security check\\Create directory ''' , path , '''.\Grant permission ?') withCRs)
+ ifFalse:[
+ ^ 0 "/ FALSE
+ ]
+ ].
+ OperatingSystem accessDeniedErrorSignal handle:[:ex |
+ ^ 0 "/ FALSE
+ ] do:[
+ f makeDirectory.
+ ].
+ f exists ifTrue:[
+ f isDirectory ifTrue:[^ 1 "TRUE"]
+ ]
].
^ 0 "FALSE"
@@ -3642,20 +3642,20 @@
(self checkWritePermissionOfDirectory:oldF directory message:('JAVA Security check\\Rename of ''' , oldPath , ''' to ''' , newPath , '''.\Grant permission ?'))
ifFalse:[
- ^ 0 "/ FALSE
+ ^ 0 "/ FALSE
].
oldF directory pathName ~= newF directory pathName ifTrue:[
- (self checkWritePermissionOfDirectory:newF directory message:('JAVA Security check\\Rename of ''' , oldPath , ''' to ''' , newPath , '''.\Grant permission ?'))
- ifFalse:[
- ^ 0 "/ FALSE
- ].
+ (self checkWritePermissionOfDirectory:newF directory message:('JAVA Security check\\Rename of ''' , oldPath , ''' to ''' , newPath , '''.\Grant permission ?'))
+ ifFalse:[
+ ^ 0 "/ FALSE
+ ].
].
OperatingSystem accessDeniedErrorSignal handle:[:ex |
- ^ 0 "/ FALSE
+ ^ 0 "/ FALSE
] do:[
- oldF renameTo:newF.
- ^ 1 "/ TRUE
+ oldF renameTo:newF.
+ ^ 1 "/ TRUE
].
^ 0 "/ FALSE
@@ -3803,7 +3803,7 @@
file := self validateFile:(nativeContext receiver).
FileIOTrace ifTrue:[
- ('JAVA: length of ' , file pathName) infoPrintCR.
+ ('JAVA: length of ' , file pathName) infoPrintCR.
].
sz := file size.
@@ -3820,9 +3820,9 @@
fs := nativeContext receiver.
fd := fs instVarNamed:'fd'.
(fd instVarNamed:'fd') ~~ 0 ifTrue:[
- self halt:'file already open'.
- self internalError:'file already open'.
- ^ self.
+ self halt:'file already open'.
+ self internalError:'file already open'.
+ ^ self.
].
name := nativeContext argAt:1.
@@ -3830,50 +3830,50 @@
name := self fixFilename:name.
FileOpenTrace ifTrue:[
- ('JAVA: opening ' , name) infoPrintCR.
+ ('JAVA: opening ' , name) infoPrintCR.
].
dir := name asFilename directory pathName.
(PermittedDirectories notNil
and:[PermittedDirectories includes:dir]) ifFalse:[
- FileOpenConfirmation ifTrue:[
- answer := Dialog
- confirmWithCancel:('JAVA Security check\\Opening ''' , name , ''' for read/write.\Grant permission ?') withCRs
- labels:#('no' 'grant' 'readonly')
- values:#(false true #readonly)
- default:3.
- answer == false ifTrue:[
- self throwIOExceptionWithMessage:('no permission to open ' , name , ' for writing').
- ^ self
- ].
- readonly := (answer == #readonly).
-
- readonly ifFalse:[
- (self confirm:('JAVA Security check\\Always permit writes in this directory (''' , dir , ''') ?') withCRs)
- ifTrue:[
- PermittedDirectories isNil ifTrue:[
- PermittedDirectories := Set new
- ].
- PermittedDirectories add:dir.
- ]
- ]
- ]
+ FileOpenConfirmation ifTrue:[
+ answer := Dialog
+ confirmWithCancel:('JAVA Security check\\Opening ''' , name , ''' for read/write.\Grant permission ?') withCRs
+ labels:#('no' 'grant' 'readonly')
+ values:#(false true #readonly)
+ default:3.
+ answer == false ifTrue:[
+ self throwIOExceptionWithMessage:('no permission to open ' , name , ' for writing').
+ ^ self
+ ].
+ readonly := (answer == #readonly).
+
+ readonly ifFalse:[
+ (self confirm:('JAVA Security check\\Always permit writes in this directory (''' , dir , ''') ?') withCRs)
+ ifTrue:[
+ PermittedDirectories isNil ifTrue:[
+ PermittedDirectories := Set new
+ ].
+ PermittedDirectories add:dir.
+ ]
+ ]
+ ]
].
readonly ifTrue:[
- stream := name asFilename readStream.
+ stream := name asFilename readStream.
] ifFalse:[
- stream := name asFilename readWriteStream.
+ stream := name asFilename readWriteStream.
].
stream isNil ifTrue:[
- self throwIOExceptionWithMessage:('cannot open ' , name , ' for writing').
+ self throwIOExceptionWithMessage:('cannot open ' , name , ' for writing').
].
fileNo := self addOpenFile:stream.
FileOpenTrace ifTrue:[
- ('JAVA: opened ' , name , ' as FD ' , fileNo printString , ' for writing') infoPrintCR.
+ ('JAVA: opened ' , name , ' as FD ' , fileNo printString , ' for writing') infoPrintCR.
].
fd instVarNamed:'fd' put:fileNo.
@@ -3888,12 +3888,12 @@
file := self validateFile:(nativeContext receiver).
FileIOTrace ifTrue:[
- ('JAVA: read 1 byte from ' , file pathName) infoPrintCR.
+ ('JAVA: read 1 byte from ' , file pathName) infoPrintCR.
].
byte := file nextByte.
byte isNil ifTrue:[
- ^ -1
+ ^ -1
].
^ byte
@@ -3913,7 +3913,7 @@
file := self validateFile:(nativeContext receiver).
FileIOTrace ifTrue:[
- ('JAVA: seek on ' , file pathName) infoPrintCR.
+ ('JAVA: seek on ' , file pathName) infoPrintCR.
].
pos := nativeContext argAt:1.
@@ -4049,17 +4049,17 @@
class := Java at:name.
class isNil ifTrue:[
"/ ('JAVA: findSystemClass0 for ' , name , ' loader is ' , loader displayString) infoPrintCR.
- loader class == (Java classForName:'java.util.SystemClassLoader') ifTrue:[
+ loader class == (Java classForName:'java.util.SystemClassLoader') ifTrue:[
"/ Java classForName:name.
"/ class := Java at:name.
- class := JavaClassReader loadSystemClass:name.
- ] ifFalse:[
- "/ load using default (ST/X) loader
- class := JavaClassReader loadSystemClass:name.
+ class := JavaClassReader loadSystemClass:name.
+ ] ifFalse:[
+ "/ load using default (ST/X) loader
+ class := JavaClassReader loadSystemClass:name.
"/ JavaClassReader classLoaderQuerySignal answer:nil do:[
"/ Java classForName:name.
"/ ]
- ].
+ ].
].
"/ JavaClassReader classLoaderQuerySignal answer:nil "loader"
@@ -4073,10 +4073,10 @@
"/ self halt:'class: ' , name , ' not found.'.
"/ self internalError:'class: ' , name , ' not found.'.
- self
- throwExceptionClassName:'java.lang.ClassNotFoundException'
- withMessage:('class: ' , name , ' not found.').
- ^ nil
+ self
+ throwExceptionClassName:'java.lang.ClassNotFoundException'
+ withMessage:('class: ' , name , ' not found.').
+ ^ nil
].
"/ 'JAVA: findSystemClass0 - loaded: ' infoPrint. class fullName infoPrintCR.
@@ -4089,64 +4089,64 @@
_ClassLoader_getSystemResource:nativeContext asStream0:returnAsStream
"common code for
- getSystemResourceAsStream0
- getSystemResourceAsName0"
+ getSystemResourceAsStream0
+ getSystemResourceAsName0"
|jString rString dir file text inStream url|
jString := nativeContext argAt:1.
rString := Java as_ST_String:jString.
Java classPath keysAndValuesDo:[:classPathIndex :aPath |
- |f zipFile zar data |
-
- f := aPath asFilename.
- ((zipFile := f withSuffix:'jar') exists
- or:[(zipFile := f withSuffix:'zip') exists]) ifTrue:[
- zar := ZipArchive oldFileNamed:zipFile.
- (Array
- with:rString
- with:rString asLowercase
- with:rString asUppercase)
- do:[:tryName |
- |entry|
-
- entry := zar findMember:tryName.
- entry notNil ifTrue:[
- returnAsStream ifTrue:[
- data := zar extract:tryName.
- inStream := (Java classForName:'java.io.ByteArrayInputStream') newCleared.
- inStream perform:#'<init>([B)V' with:data.
- ^ inStream.
- ].
- url := 'systemResource:/ZIP' , (classPathIndex-1) printString , '/+/' , tryName.
- ^ Java as_String:url.
- ]
- ]
- ] ifFalse:[
- f exists ifTrue:[
- (file := f construct:rString) exists ifTrue:[
- (Java isExcludedFromClassPath:file) ifFalse:[
-
- "/ Copy data from returned buffer into Java byte array.
+ |f zipFile zar data |
+
+ f := aPath asFilename.
+ ((zipFile := f withSuffix:'jar') exists
+ or:[(zipFile := f withSuffix:'zip') exists]) ifTrue:[
+ zar := ZipArchive oldFileNamed:zipFile.
+ (Array
+ with:rString
+ with:rString asLowercase
+ with:rString asUppercase)
+ do:[:tryName |
+ |entry|
+
+ entry := zar findMember:tryName.
+ entry notNil ifTrue:[
+ returnAsStream ifTrue:[
+ data := zar extract:tryName.
+ inStream := (Java classForName:'java.io.ByteArrayInputStream') newCleared.
+ inStream perform:#'<init>([B)V' with:data.
+ ^ inStream.
+ ].
+ url := 'systemResource:/ZIP' , (classPathIndex-1) printString , '/+/' , tryName.
+ ^ Java as_String:url.
+ ]
+ ]
+ ] ifFalse:[
+ f exists ifTrue:[
+ (file := f construct:rString) exists ifTrue:[
+ (Java isExcludedFromClassPath:file) ifFalse:[
+
+ "/ Copy data from returned buffer into Java byte array.
"/ self halt.
- returnAsStream ifTrue:[
- text := file contents asString.
- data := text asByteArray.
-
- "/ Create input stream using byte array
-
- inStream := (Java classForName:'java.io.ByteArrayInputStream') newCleared.
- inStream perform:#'<init>([B)V' with:data.
- ^ inStream.
- ].
- url := 'systemResource:/FILE/' , file pathName.
+ returnAsStream ifTrue:[
+ text := file contents asString.
+ data := text asByteArray.
+
+ "/ Create input stream using byte array
+
+ inStream := (Java classForName:'java.io.ByteArrayInputStream') newCleared.
+ inStream perform:#'<init>([B)V' with:data.
+ ^ inStream.
+ ].
+ url := 'systemResource:/FILE/' , file pathName.
self halt.
- ^ Java as_String:url
- ]
- ]
- ]
- ]
+ ^ Java as_String:url
+ ]
+ ]
+ ]
+ ]
].
^ nil
@@ -4158,16 +4158,16 @@
"/ java.lang.String getSystemResourceAsName0 (java.lang.String)
^ self
- _ClassLoader_getSystemResource:nativeContext
- asStream0:false.
+ _ClassLoader_getSystemResource:nativeContext
+ asStream0:false.
!
_ClassLoader_getSystemResourceAsStream0:nativeContext
"/ java.lang.InputStream getSystemResourceAsStream0 (java.lang.String)
^ self
- _ClassLoader_getSystemResource:nativeContext
- asStream0:true.
+ _ClassLoader_getSystemResource:nativeContext
+ asStream0:true.
!
_ClassLoader_init:nativeContext
@@ -4184,44 +4184,44 @@
jClassLoader := nativeContext receiver.
jCls := nativeContext argAt:1.
jCls isNil ifTrue:[
- self halt.
- ^ nil
+ self halt.
+ ^ nil
].
cls := JavaClasses at:jCls ifAbsent:nil.
cls isNil ifTrue:[
- self halt.
- ^ nil
+ self halt.
+ ^ nil
].
('JavaVM [info]: resolving class ' , cls fullName , ' ...') infoPrintCR.
JavaClassReader classLoaderQuerySignal answer:jClassLoader
do:[
- JavaClassReader resolveClass:cls.
+ JavaClassReader resolveClass:cls.
"/ JavaClassReader postLoadActions:true.
- anyUnresolved := false.
- cls constantPool do:[:entry |
- (entry isMemberOf:JavaUnresolvedClassConstant) ifTrue:[
- self halt:'debugHalt'.
- entry preResolve.
- self halt:'debugHalt'.
- anyUnresolved := true.
- ]
- ]
+ anyUnresolved := false.
+ cls constantPool do:[:entry |
+ (entry isMemberOf:JavaUnresolvedClassConstant) ifTrue:[
+ self halt:'debugHalt'.
+ entry preResolve.
+ self halt:'debugHalt'.
+ anyUnresolved := true.
+ ]
+ ]
].
anyUnresolved ifTrue:[
jClassLoader notNil ifTrue:[
- "/ any unresolved left -> try resolving with standard loader
- JavaClassReader classLoaderQuerySignal answer:nil
- do:[
- JavaClassReader postLoadActions:true.
- cls constantPool do:[:entry |
- (entry isMemberOf:JavaUnresolvedClassConstant) ifTrue:[
- self halt:'debugHalt'.
- entry preResolve.
- self halt:'debugHalt'.
- ]
- ]
- ]
+ "/ any unresolved left -> try resolving with standard loader
+ JavaClassReader classLoaderQuerySignal answer:nil
+ do:[
+ JavaClassReader postLoadActions:true.
+ cls constantPool do:[:entry |
+ (entry isMemberOf:JavaUnresolvedClassConstant) ifTrue:[
+ self halt:'debugHalt'.
+ entry preResolve.
+ self halt:'debugHalt'.
+ ]
+ ]
+ ]
].
].
@@ -4238,18 +4238,18 @@
className := Java as_ST_String:jClassName.
(s := nativeContext sender) notNil ifTrue:[
- (s isJavaContext) ifTrue:[
- c := s method javaClass.
- loader := c classLoader.
- loader isNil ifTrue:[
+ (s isJavaContext) ifTrue:[
+ c := s method javaClass.
+ loader := c classLoader.
+ loader isNil ifTrue:[
"/ self halt.
- ]
- ]
+ ]
+ ]
].
JavaClassReader classLoaderQuerySignal answer:loader
do:[
- cls := Java classForName:className.
+ cls := Java classForName:className.
].
"/(className startsWith:'sun.awt') ifTrue:[self halt].
@@ -4257,17 +4257,17 @@
"/cls notNil ifTrue:[cls fullName printCR] ifFalse:['nil' printCR].
cls isNil ifTrue:[
- ExceptionTrace ifTrue:[
- ('throwing exception: no such class:' , className) infoPrintCR.
- ].
- ExceptionDebug ifTrue:[
- self halt:'no such class:' , className.
- ].
- self throwClassNotFoundException:className.
- "/ not proceedable
- AbortSignal raise.
- "/ not reached
- ^ self
+ ExceptionTrace ifTrue:[
+ ('throwing exception: no such class:' , className) infoPrintCR.
+ ].
+ ExceptionDebug ifTrue:[
+ self halt:'no such class:' , className.
+ ].
+ self throwClassNotFoundException:className.
+ "/ not proceedable
+ AbortSignal raise.
+ "/ not reached
+ ^ self
].
^ self javaClassObjectForClass:cls.
@@ -4284,7 +4284,7 @@
cls := self classForJavaClassObject:jClass.
loader := cls classLoader.
cls isNil ifTrue:[
- loader := JavaClassReader classLoaderQuerySignal query.
+ loader := JavaClassReader classLoaderQuerySignal query.
"/ ('JAVA: getClassLoader - ' , loader printString) infoPrintCR.
].
@@ -4354,57 +4354,57 @@
argSig := JavaMethod argSignatureFromArgTypeArray:mTypes.
cls methodDictionary keysAndValuesDo:[:sel :mthd |
- |i1 i2 jMethod retTypeClass argTypes|
-
- JavaMethods notNil ifTrue:[
- (jMethod := JavaMethods at:mthd ifAbsent:nil) notNil ifTrue:[
- ^ jMethod
- ]
- ].
-
- mthd name printCR.
- mName printCR.
-
- mthd name = mName ifTrue:[
- i1 := mthd signature indexOf:$(.
- i2 := mthd signature indexOf:$) startingAt:(i1+1).
+ |i1 i2 jMethod retTypeClass argTypes|
+
+ JavaMethods notNil ifTrue:[
+ (jMethod := JavaMethods at:mthd ifAbsent:nil) notNil ifTrue:[
+ ^ jMethod
+ ]
+ ].
+
+ mthd name printCR.
+ mName printCR.
+
+ mthd name = mName ifTrue:[
+ i1 := mthd signature indexOf:$(.
+ i2 := mthd signature indexOf:$) startingAt:(i1+1).
- (mthd signature copyFrom:i1+1 to:i2-1) = argSig ifTrue:[
- "/ found it - 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:jmName.
- 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
- ].
- JavaMethods at:jMethod put:mthd.
- JavaMethods at:mthd put:jMethod.
-
- ^ jMethod.
- ].
- ].
+ (mthd signature copyFrom:i1+1 to:i2-1) = argSig ifTrue:[
+ "/ found it - 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:jmName.
+ 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
+ ].
+ JavaMethods at:jMethod put:mthd.
+ JavaMethods at:mthd put:jMethod.
+
+ ^ jMethod.
+ ].
+ ].
].
self halt.
self
- throwExceptionClassName:'java.lang.NoSuchMethodException'
- withMessage:'not yet implemented'.
+ throwExceptionClassName:'java.lang.NoSuchMethodException'
+ withMessage:'not yet implemented'.
^ nil.
@@ -4414,7 +4414,7 @@
_Class_getMethods0:nativeContext
"get a method, given a name and type spec"
- |jClass cls jmName mName mTypes whichAccess argSig sel
+ |jClass cls jmName mTypes whichAccess argSig sel
methods|
jClass := nativeContext receiver.
@@ -4426,50 +4426,49 @@
methods := OrderedCollection new.
[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).
+ 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 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.
"/ (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.
- ].
- whichAccess == 1 ifTrue:[
- "/ local methods only
- cls := nil
- ] ifFalse:[
- cls := cls superclass.
- ]
+ 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.
^ methods.
@@ -4495,13 +4494,13 @@
self halt.
].
cls isJavaClass ifTrue:[
- nm := (cls fullName copyReplaceAll:$/ with:$.)
+ nm := (cls fullName copyReplaceAll:$/ with:$.)
] ifFalse:[
- cls isSymbol ifTrue:[
- nm := cls "/ simulated dummy primitive class
- ] ifFalse:[
- nm := cls name
- ]
+ cls isSymbol ifTrue:[
+ nm := cls "/ simulated dummy primitive class
+ ] ifFalse:[
+ nm := cls name
+ ]
].
^ Java as_String:nm.
@@ -4566,7 +4565,7 @@
cls := JavaClasses at:jClass.
superCls := cls superclass.
superCls == JavaObject ifTrue:[
- ^ nil.
+ ^ nil.
].
^ self javaClassObjectForClass:superCls
@@ -4604,30 +4603,30 @@
(obj isKindOf:cls) ifTrue:[^ 1 "TRUE"].
cls isBehavior ifTrue:[
- cls isInterface ifTrue:[
- (obj class hasInterface:cls) ifTrue:[
- ^ 1 "TRUE"
- ]
- ].
- ^ (obj isKindOf:cls) ifTrue:[1 "TRUE"] ifFalse:[0 "FALSE"]
+ cls isInterface ifTrue:[
+ (obj class hasInterface:cls) ifTrue:[
+ ^ 1 "TRUE"
+ ]
+ ].
+ ^ (obj isKindOf:cls) ifTrue:[1 "TRUE"] ifFalse:[0 "FALSE"]
].
(cls isMemberOf:JavaClassPointerRef) ifTrue:[
- "/ must be a pointer to an array of that class
-
- ^ (obj isArray) ifTrue:[1 "TRUE"] ifFalse:[0 "FALSE"]
+ "/ must be a pointer to an array of that class
+
+ ^ (obj isArray) ifTrue:[1 "TRUE"] ifFalse:[0 "FALSE"]
].
(cls isMemberOf:JavaBuiltInClassPointerRef) ifTrue:[
- cls arrayClass == obj class ifTrue:[
- ^ 1 "TRUE"
- ].
+ cls arrayClass == obj class ifTrue:[
+ ^ 1 "TRUE"
+ ].
].
(obj isMemberOf:Array) ifTrue:[
- obj size == 0 ifTrue:[
- ^ 1 "TRUE"
- ].
- ^ (self _checkCast:(obj at:1) class:(cls deref))
- ifTrue:[1 "TRUE"] ifFalse:[0 "FALSE"]
+ obj size == 0 ifTrue:[
+ ^ 1 "TRUE"
+ ].
+ ^ (self _checkCast:(obj at:1) class:(cls deref))
+ ifTrue:[1 "TRUE"] ifFalse:[0 "FALSE"]
].
self halt.
^ 0 "FALSE".
@@ -5045,7 +5044,7 @@
"/ how about domain errors ?
dVal < 0 ifTrue:[
- ^ 0.0
+ ^ 0.0
].
^ dVal sqrt
@@ -5079,8 +5078,8 @@
mthd := JavaMethods at:jMethod ifAbsent:nil.
mthd isNil ifTrue:[
- self halt.
- ^ 0
+ self halt.
+ ^ 0
].
^ mthd accessFlags
@@ -5098,26 +5097,26 @@
mthd := JavaMethods at:jMethod ifAbsent:nil.
mthd isNil ifTrue:[
- self halt.
+ self halt.
].
"/ check for arguments to match the expected types ...
mthd argSignature keysAndValuesDo:[:index :argSig |
- |cls arg|
-
- cls := Java at:argSig.
- arg := args at:index.
- (arg isKindOf:cls) ifFalse:[
- self halt.
- ]
+ |cls arg|
+
+ cls := Java at:argSig.
+ arg := args at:index.
+ (arg isKindOf:cls) ifFalse:[
+ self halt.
+ ]
].
mthd isStatic ifTrue:[
- retVal := mthd valueWithReceiver:(mthd javaClass) arguments:args selector:mthd selector.
- ^ retVal
+ retVal := mthd valueWithReceiver:(mthd javaClass) arguments:args selector:mthd selector.
+ ^ retVal
] ifFalse:[
- self halt.
+ self halt.
].
self halt.
@@ -5190,13 +5189,13 @@
sema := JavaVM semaphoreFor:handle.
[
- self waitFor:sema state:#javaWait timeOut:tmo.
+ self waitFor:sema state:#javaWait timeOut:tmo.
] valueOnUnwindDo:[
- JavaVM releaseSemaphoreFor:handle.
+ JavaVM releaseSemaphoreFor:handle.
].
ThreadTrace ifTrue:[
- '====> thread continues ...' printCR.
+ '====> thread continues ...' printCR.
]
"Modified: / 30.12.1998 / 19:20:43 / cg"
@@ -5233,19 +5232,19 @@
cmd := cmdAndArgArray at:1.
OperatingSystem isUNIXlike ifTrue:[
- jProcessClass := Java classForName:'java.lang.UNIXProcess'.
+ jProcessClass := Java classForName:'java.lang.UNIXProcess'.
] ifFalse:[
- jProcessClass := Java classForName:'java.lang.Win32Process'.
+ jProcessClass := Java classForName:'java.lang.Win32Process'.
].
"/
jProcessClass notNil ifTrue:[
self halt.
- jProcess := jProcessClass newCleared.
- jProcess
- perform:#'<init>([Ljava/lang/String;[Ljava/lang/String;)V'
- with:cmdAndArgArray
- with:envArray.
- ^ jProcess
+ jProcess := jProcessClass newCleared.
+ jProcess
+ perform:#'<init>([Ljava/lang/String;[Ljava/lang/String;)V'
+ with:cmdAndArgArray
+ with:envArray.
+ ^ jProcess
].
self halt.
self throwIOExceptionWithMessage:'Process execution disabled/unimplemented'.
@@ -5261,22 +5260,22 @@
|enteredMonitors|
ExitDebug == true ifTrue:[
- self halt:'Java code called exit'.
+ self halt:'Java code called exit'.
].
self syncMonitorCache.
(enteredMonitors := self enteredMonitors) size > 0 ifTrue:[
- enteredMonitors do:[:handle |
- | mon |
-
- mon := LockTable at:handle ifAbsent:nil.
- mon isNil ifTrue:[
- self halt:'no monitor in exitInternal'.
- ] ifFalse:[
- mon exit.
+ enteredMonitors do:[:handle |
+ | mon |
+
+ mon := LockTable at:handle ifAbsent:nil.
+ mon isNil ifTrue:[
+ self halt:'no monitor in exitInternal'.
+ ] ifFalse:[
+ mon exit.
('====> terminateThread - exit monitor for ' , handle displayString , ' in ' , Processor activeProcess name , ' ...') infoPrintCR.
- ].
- ].
+ ].
+ ].
].
"/ TODO: shut down all threads created by this one ...
@@ -5342,9 +5341,9 @@
_Runtime_loadFileInternalI:nativeContext
"1.1b3 change; load a sharedLib like 'loadFileInternal',
but return integer:
- -1 outOfMemory error
- 0 failed to load
- 1 loaded or already loaded (i.e. ok)"
+ -1 outOfMemory error
+ 0 failed to load
+ 1 loaded or already loaded (i.e. ok)"
|jLibName libName libHandle|
@@ -5353,30 +5352,30 @@
(SimulatedLibs includes:libName) ifTrue:[
"/ ('JAVA: builtIn libLoad simulated: ' , libName) printNL.
- ^ 1
+ ^ 1
].
(LoadedLibs notNil and:[LoadedLibs includesKey:libName]) ifTrue:[
"/ ('JAVA: already loaded: ' , libName) printNL.
- ^ 1
+ ^ 1
].
libName asFilename exists ifFalse:[
- ('JAVA: no file to load: ' , libName) printNL.
- ^ 0
+ ('JAVA: no file to load: ' , libName) printNL.
+ ^ 0
].
(self confirm:'permission to load native library: ' , libName , ' ?') ifFalse:[
- ^ 0
+ ^ 0
].
libHandle := ObjectFileLoader loadLibrary:libName.
libHandle isNil ifTrue:[
- ('JAVA: failed to load: ' , libName) printNL.
- ^ 0
+ ('JAVA: failed to load: ' , libName) printNL.
+ ^ 0
].
LoadedLibs isNil ifTrue:[
- LoadedLibs := Dictionary new.
+ LoadedLibs := Dictionary new.
].
LoadedLibs at:libName put:libHandle.
@@ -5494,31 +5493,31 @@
srcArray := nativeContext argAt:1.
srcArray isNil ifTrue:[
- ^ self throwNullPointerException
+ ^ self throwNullPointerException
].
srcIdx := nativeContext argAt:2.
dstArray := nativeContext argAt:3.
dstArray isNil ifTrue:[
- ^ self throwNullPointerException
+ ^ self throwNullPointerException
].
dstIdx := nativeContext argAt:4.
count := nativeContext argAt:5.
((srcIdx < 0) or:[srcIdx + count > srcArray size]) ifTrue:[
- srcArray size == 0 ifTrue:[
- srcArray isVariable ifFalse:[
- ^ self throwArrayStoreException:srcArray
- ]
- ].
- ^ self throwArrayIndexOutOfBoundsException:(srcIdx + count - 1)
+ srcArray size == 0 ifTrue:[
+ srcArray isVariable ifFalse:[
+ ^ self throwArrayStoreException:srcArray
+ ]
+ ].
+ ^ self throwArrayIndexOutOfBoundsException:(srcIdx + count - 1)
].
((dstIdx < 0) or:[dstIdx + count > dstArray size]) ifTrue:[
- dstArray size == 0 ifTrue:[
- dstArray isVariable ifFalse:[
- ^ self throwArrayStoreException:dstArray
- ]
- ].
- ^ self throwArrayIndexOutOfBoundsException:(dstIdx + count - 1)
+ dstArray size == 0 ifTrue:[
+ dstArray isVariable ifFalse:[
+ ^ self throwArrayStoreException:dstArray
+ ]
+ ].
+ ^ self throwArrayIndexOutOfBoundsException:(dstIdx + count - 1)
].
dstEndIdx := dstIdx + count.
@@ -5526,12 +5525,12 @@
srcIdx := srcIdx + 1. "/ ST uses 1-based indexing
srcArray class isBytes ifTrue:[
- dstArray class isBytes ifFalse:[
- self halt:'incompatible arraycopy collections'.
- ].
- dstArray replaceBytesFrom:dstIdx to:dstEndIdx with:srcArray startingAt:srcIdx.
+ dstArray class isBytes ifFalse:[
+ self halt:'incompatible arraycopy collections'.
+ ].
+ dstArray replaceBytesFrom:dstIdx to:dstEndIdx with:srcArray startingAt:srcIdx.
] ifFalse:[
- dstArray replaceFrom:dstIdx to:dstEndIdx with:srcArray startingAt:srcIdx.
+ dstArray replaceFrom:dstIdx to:dstEndIdx with:srcArray startingAt:srcIdx.
].
^ nil.
@@ -5665,8 +5664,8 @@
jThread := nativeContext receiver.
stProcess := self stProcessForJavaThread:jThread.
stProcess isNil ifTrue:[
- self halt.
- ^ 0
+ self halt.
+ ^ 0
].
stProcess markInterrupted
@@ -5683,10 +5682,10 @@
jThread := nativeContext receiver.
stProcess := JavaVM stProcessForJavaThread:jThread.
stProcess isNil ifTrue:[
- ThreadTrace == true ifTrue:[
- ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL.
- ].
- ^ 0 "FALSE"
+ ThreadTrace == true ifTrue:[
+ ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL.
+ ].
+ ^ 0 "FALSE"
].
stProcess isDead ifTrue:[^ 0 "FALSE"].
^ 1 "TRUE"
@@ -5724,10 +5723,10 @@
jThread := nativeContext receiver.
stProcess := JavaVM stProcessForJavaThread:jThread.
stProcess isNil ifTrue:[
- ThreadTrace == true ifTrue:[
- ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL.
- ].
- ^ nil "void"
+ ThreadTrace == true ifTrue:[
+ ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL.
+ ].
+ ^ nil "void"
].
stProcess resume
@@ -5743,14 +5742,14 @@
prio := nativeMethodContext argAt:1.
p isNil ifTrue:[
- ThreadTrace == true ifTrue:[
- 'JAVA [info]: no process yet (in setPriority)' infoPrintCR.
- ].
- ^ nil
+ ThreadTrace == true ifTrue:[
+ 'JAVA [info]: no process yet (in setPriority)' infoPrintCR.
+ ].
+ ^ nil
].
ThreadTrace ifTrue:[
- 'JAVA [info]: setPrio: ' print. t print. ' pri= ' print. prio print. ' p= ' print. p printNL.
+ 'JAVA [info]: setPrio: ' print. t print. ' pri= ' print. prio print. ' p= ' print. p printNL.
].
^ nil
@@ -5776,113 +5775,113 @@
jThread := nativeContext receiver.
(jThread instVarNamed:'priority') < 1 ifTrue:[
- self halt.
- jThread instVarNamed:'priority' put:1.
+ self halt.
+ jThread instVarNamed:'priority' put:1.
].
stProcess := JavaProcess
- for:[
- |procName|
-
- Object abortSignal handle:[:ex |
- procName := stProcess name.
- (procName startsWith:'JAVA-AWT-EventQueue') ifTrue:[
- ('JAVA: thread ' , procName , ' aborted - restarting process.') infoPrintCR.
- ex restart.
- ] ifFalse:[
- stProcess == JavaScreenUpdaterThread ifTrue:[
- ('JAVA: thread ' , procName , ' aborted - restarting process.') infoPrintCR.
- ex restart
- ] ifFalse:[
- ('JAVA: thread ' , procName , ' aborted.') infoPrintCR.
- ]
- ].
- ] do:[
- [
- JavaVM javaExceptionSignal handle:[:ex |
- |exClass|
-
- procName := stProcess name.
- exClass := ex parameter class.
-
- exClass == (Java at:'java.lang.ThreadDeath') ifTrue:[
- ('JAVA: thread ' , procName , ' terminated') infoPrintCR.
- ] ifFalse:[
- Transcript
- showCR:('JAVA: thread '''
- , procName
- , ''' terminated with exception: '
- , exClass name).
- ].
- ex return.
- ] do:[
- Object messageNotUnderstoodSignal handle:[:ex |
- "/ remap doesNotUnderstand with nil-receiver to
- "/ a nullPointerException ...
- |con m|
-
- con := ex suspendedContext.
- con receiver isNil ifTrue:[
- ((m := con sender method) notNil
- and:[m isJavaMethod]) ifTrue:[
- self throwNullPointerException.
- AbortSignal raise. "/ ex proceed.
- ]
- ].
- ex reject.
- ] do:[
- jThread perform:#'run()V'.
- ThreadTrace == true ifTrue:[
- ('JAVA: thread ' , stProcess name , ' terminated') infoPrintCR.
- ].
- jThread perform:#'exit()V'.
- ThreadTrace == true ifTrue:[
- ('JAVA: after exit of thread ' , stProcess name) infoPrintCR.
- ]
- ]
- ]
- ] valueNowOrOnUnwindDo:[
- |monitors|
-
- monitors := EnteredMonitorsPerProcess at:stProcess ifAbsent:nil.
- monitors notNil ifTrue:[
- monitors do:[:obj |
- | mon |
-
- mon := self monitorFor:obj.
- mon notNil ifTrue:[
- mon owningProcess == stProcess ifTrue:[
- ('JAVA: release monitor owned by dying thread: ' , stProcess name) infoPrintCR.
- mon exit
- ].
- ].
- ].
- EnteredMonitorsPerProcess removeKey:stProcess.
-
- stProcess == JavaScreenUpdaterThread ifTrue:[
- JavaScreenUpdaterThread := nil.
- ].
+ for:[
+ |procName|
+
+ Object abortSignal handle:[:ex |
+ procName := stProcess name.
+ (procName startsWith:'JAVA-AWT-EventQueue') ifTrue:[
+ ('JAVA: thread ' , procName , ' aborted - restarting process.') infoPrintCR.
+ ex restart.
+ ] ifFalse:[
+ stProcess == JavaScreenUpdaterThread ifTrue:[
+ ('JAVA: thread ' , procName , ' aborted - restarting process.') infoPrintCR.
+ ex restart
+ ] ifFalse:[
+ ('JAVA: thread ' , procName , ' aborted.') infoPrintCR.
+ ]
+ ].
+ ] do:[
+ [
+ JavaVM javaExceptionSignal handle:[:ex |
+ |exClass|
+
+ procName := stProcess name.
+ exClass := ex parameter class.
+
+ exClass == (Java at:'java.lang.ThreadDeath') ifTrue:[
+ ('JAVA: thread ' , procName , ' terminated') infoPrintCR.
+ ] ifFalse:[
+ Transcript
+ showCR:('JAVA: thread '''
+ , procName
+ , ''' terminated with exception: '
+ , exClass name).
+ ].
+ ex return.
+ ] do:[
+ Object messageNotUnderstoodSignal handle:[:ex |
+ "/ remap doesNotUnderstand with nil-receiver to
+ "/ a nullPointerException ...
+ |con m|
+
+ con := ex suspendedContext.
+ con receiver isNil ifTrue:[
+ ((m := con sender method) notNil
+ and:[m isJavaMethod]) ifTrue:[
+ self throwNullPointerException.
+ AbortSignal raise. "/ ex proceed.
+ ]
+ ].
+ ex reject.
+ ] do:[
+ jThread perform:#'run()V'.
+ ThreadTrace == true ifTrue:[
+ ('JAVA: thread ' , stProcess name , ' terminated') infoPrintCR.
+ ].
+ jThread perform:#'exit()V'.
+ ThreadTrace == true ifTrue:[
+ ('JAVA: after exit of thread ' , stProcess name) infoPrintCR.
+ ]
+ ]
+ ]
+ ] valueNowOrOnUnwindDo:[
+ |monitors|
+
+ monitors := EnteredMonitorsPerProcess at:stProcess ifAbsent:nil.
+ monitors notNil ifTrue:[
+ monitors do:[:obj |
+ | mon |
+
+ mon := self monitorFor:obj.
+ mon notNil ifTrue:[
+ mon owningProcess == stProcess ifTrue:[
+ ('JAVA: release monitor owned by dying thread: ' , stProcess name) infoPrintCR.
+ mon exit
+ ].
+ ].
+ ].
+ EnteredMonitorsPerProcess removeKey:stProcess.
+
+ stProcess == JavaScreenUpdaterThread ifTrue:[
+ JavaScreenUpdaterThread := nil.
+ ].
"/ screenUpdaterClass := Java at:'sun.awt.ScreenUpdater'.
"/ screenUpdaterClass notNil ifTrue:[
"/ screenUpdaterClass instVarNamed:'updater' put:nil.
"/ ].
- ].
- Java threads removeKey:jThread ifAbsent:[].
- ]
- ]
- ]
- priority:(Processor activePriority).
+ ].
+ Java threads removeKey:jThread ifAbsent:[].
+ ]
+ ]
+ ]
+ priority:(Processor activePriority).
jName := jThread instVarNamed:'name'.
jName isString ifFalse:[
- name := Java as_ST_String:jName.
+ name := Java as_ST_String:jName.
] ifTrue:[
- name := jName
+ name := jName
].
"/ kludge - remember the ScreenUpdater ...
name = 'Screen Updater' ifTrue:[
- JavaScreenUpdaterThread := stProcess.
+ JavaScreenUpdaterThread := stProcess.
].
"/name = 'UserDialogShowThread' ifTrue:[
@@ -5911,32 +5910,32 @@
stProcess := JavaVM stProcessForJavaThread:jThread.
stProcess isNil ifTrue:[
- ThreadTrace == true ifTrue:[
- ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL.
- ].
- ^ nil "void"
+ ThreadTrace == true ifTrue:[
+ ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL.
+ ].
+ ^ nil "void"
].
stProcess == JavaScreenUpdaterThread ifTrue:[self halt].
death := nativeContext argAt:1.
stProcess
- interruptWith:[
- JavaVM javaExceptionSignal handle:[:ex |
+ interruptWith:[
+ JavaVM javaExceptionSignal handle:[:ex |
Processor activeProcess == JavaScreenUpdaterThread ifTrue:[self halt].
- Processor activeProcess terminate
- ] do:[
- ThreadTrace == true ifTrue:[
- ('JAVA: thread exit: ' , jThread displayString) infoPrintNL.
- ].
- jThread perform:#'exit()V'.
- self throwException:death.
- ]
- ].
+ Processor activeProcess terminate
+ ] do:[
+ ThreadTrace == true ifTrue:[
+ ('JAVA: thread exit: ' , jThread displayString) infoPrintNL.
+ ].
+ jThread perform:#'exit()V'.
+ self throwException:death.
+ ]
+ ].
stProcess resume.
[stProcess isDead] whileFalse:[
- stProcess resume.
- 'JavaVM: wait for death' infoPrintCR.
- Delay waitForSeconds:0.1
+ stProcess resume.
+ 'JavaVM: wait for death' infoPrintCR.
+ Delay waitForSeconds:0.1
].
stProcess terminate
@@ -5952,10 +5951,10 @@
jThread := nativeContext receiver.
stProcess := JavaVM stProcessForJavaThread:jThread.
stProcess isNil ifTrue:[
- ThreadTrace == true ifTrue:[
- ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL.
- ].
- ^ nil "void"
+ ThreadTrace == true ifTrue:[
+ ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL.
+ ].
+ ^ nil "void"
].
stProcess suspend
@@ -5998,7 +5997,7 @@
"/ debugging only
"/
(exceptionObject isKindOf:(Java classNamed:'java.lang.Throwable')) ifFalse:[
- self halt
+ self halt
].
con := thisContext sender.
@@ -6007,24 +6006,24 @@
"/ we are not interrested in all intermediate Exception frames ...
"/
FullExceptionTrace ifFalse:[
- "/ first, skip any JavaVM contexts
- [con receiver == exceptionObject] whileFalse:[
- con := con sender
- ].
- "/ then, all exception-init contexts
- [con receiver == exceptionObject] whileTrue:[
- con := con sender
- ].
+ "/ first, skip any JavaVM contexts
+ [con receiver == exceptionObject] whileFalse:[
+ con := con sender
+ ].
+ "/ then, all exception-init contexts
+ [con receiver == exceptionObject] whileTrue:[
+ con := con sender
+ ].
].
list := OrderedCollection new.
[con notNil] whileTrue:[
- (con isJavaContext) ifTrue:[
- "/ add a copy, in case the context continues with some
- "/ cleanup ...
- list add:con shallowCopy
- ].
- con := con sender
+ (con isJavaContext) ifTrue:[
+ "/ add a copy, in case the context continues with some
+ "/ cleanup ...
+ list add:con shallowCopy
+ ].
+ con := con sender
].
exceptionObject instVarNamed:'backtrace' put:(list asArray).
@@ -6048,17 +6047,17 @@
out nextPutLine:'JAVA: stackTrace:'.
contextList do:[:con |
- out
- nextPutAll:' ';
- nextPutAll:(con method javaClass fullName);
- nextPutAll:'.';
- nextPutAll:(con method selector);
- nextPutAll:' [';
- nextPutAll:(con method javaClass sourceFile);
- nextPutAll:' ';
- nextPutAll:(con quickLineNumber displayString);
- nextPutAll:']'.
- out cr
+ out
+ nextPutAll:' ';
+ nextPutAll:(con method javaClass fullName);
+ nextPutAll:'.';
+ nextPutAll:(con method selector);
+ nextPutAll:' [';
+ nextPutAll:(con method javaClass sourceFile);
+ nextPutAll:' ';
+ nextPutAll:(con quickLineNumber displayString);
+ nextPutAll:']'.
+ out cr
].
out nextPutLine:'----------------------------------------------------'
@@ -6077,7 +6076,7 @@
env := nativeContext argAt:2.
env notNil ifTrue:[
- self halt
+ self halt
].
self halt.
@@ -6132,34 +6131,34 @@
(index := SimulatedNativeLibs indexOf:libName) ~~ 0 ifTrue:[
"/ ('JAVA: builtIn nativeLibLoad simulated: ' , libName) printNL.
- nativeLoader instVarNamed:'handle' put:index.
- ^ self "/ void
+ nativeLoader instVarNamed:'handle' put:index.
+ ^ self "/ void
].
(LoadedNativeLibs notNil
and:[LoadedNativeLibs includesKey:libName]) ifTrue:[
"/ ('JAVA: native library already loaded: ' , libName) printNL.
- nativeLoader instVarNamed:'handle' put:(LoadedNativeLibs at:libName).
- ^ self "/ void
+ nativeLoader instVarNamed:'handle' put:(LoadedNativeLibs at:libName).
+ ^ self "/ void
].
(self confirm:'permission to load native library: ' , libName , ' ?') ifFalse:[
- ^ self
+ ^ self
].
self halt.
libName asFilename exists ifFalse:[
- ('JAVA: no file to load nativeLib: ' , libName) printNL.
- ^ self "/ void
+ ('JAVA: no file to load nativeLib: ' , libName) printNL.
+ ^ self "/ void
].
libHandle := ObjectFileLoader loadLibrary:libName.
libHandle isNil ifTrue:[
- ('JAVA: failed to load nativeLib: ' , libName) printNL.
- ^ self "/ void
+ ('JAVA: failed to load nativeLib: ' , libName) printNL.
+ ^ self "/ void
].
LoadedNativeLibs isNil ifTrue:[
- LoadedNativeLibs := Dictionary new.
+ LoadedNativeLibs := Dictionary new.
].
LoadedNativeLibs at:libName put:libHandle.
@@ -6189,19 +6188,19 @@
senderContext := nativeContext sender.
[senderContext receiver == (Java at:'java.lang.System')] whileTrue:[
- senderContext := senderContext sender.
+ senderContext := senderContext sender.
].
senderContext method isStatic ifTrue:[
- cls := senderContext receiver
+ cls := senderContext receiver
] ifFalse:[
- cls := senderContext receiver class
+ cls := senderContext receiver class
].
cls isJavaClass ifTrue:[
- ^ self javaClassObjectForClass:cls
+ ^ self javaClassObjectForClass:cls
].
(cls isMemberOf:(Java at:'java.lang.Class')) ifTrue:[
- ^ Java at:'java.lang.Class'
+ ^ Java at:'java.lang.Class'
].
self halt.
^ nil
@@ -6318,7 +6317,7 @@
hostName := OperatingSystem getHostName.
addrBytes := Socket ipAddressOfHost:hostName.
addrBytes isNil ifTrue:[
- addrBytes := #[127 0 0 0].
+ addrBytes := #[127 0 0 0].
].
"/ MSB first into an integer.
address := (addrBytes at:1).
@@ -6345,23 +6344,23 @@
hostName := jaddr instVarNamed:'hostName'.
hostName isNil ifTrue:[
- self halt.
+ self halt.
] ifFalse:[
- hostName := Java as_ST_String:hostName
+ hostName := Java as_ST_String:hostName
].
sock := self validateFile:jsock.
sock notNil ifTrue:[
- FileIOTrace ifTrue:[
- ('JAVA: socket bind to ' , hostName printString, ' port ' , port printString) infoPrintCR
- ].
-
- ok := sock bindTo:port address:nil "hostName".
- ok ifFalse:[
- err := OperatingSystem lastErrorString.
- Transcript showCR:'sock err: ' , err printString.
- self throwIOExceptionWithMessage:'bind failed'.
- ]
+ FileIOTrace ifTrue:[
+ ('JAVA: socket bind to ' , hostName printString, ' port ' , port printString) infoPrintCR
+ ].
+
+ ok := sock bindTo:port address:nil "hostName".
+ ok ifFalse:[
+ err := OperatingSystem lastErrorString.
+ Transcript showCR:'sock err: ' , err printString.
+ self throwIOExceptionWithMessage:'bind failed'.
+ ]
].
"Created: / 4.2.1998 / 15:06:20 / cg"
@@ -6375,10 +6374,10 @@
sock := self validateFile:jsock.
sock notNil ifTrue:[
- FileIOTrace ifTrue:[
- 'JAVA: datagram close socket' infoPrintCR
- ].
- sock close.
+ FileIOTrace ifTrue:[
+ 'JAVA: datagram close socket' infoPrintCR
+ ].
+ sock close.
].
"Modified: / 21.8.1997 / 17:09:40 / cg"
@@ -6392,19 +6391,19 @@
fd := jsock instVarNamed:'fd'.
(fd instVarNamed:'fd') ~~ 0 ifTrue:[
- self halt:'file already open'.
- self internalError:'file already open'.
- self throwIOExceptionWithMessage:'file already open in socketCreate'.
- ^ self.
+ self halt:'file already open'.
+ self internalError:'file already open'.
+ self throwIOExceptionWithMessage:'file already open in socketCreate'.
+ ^ self.
].
FileOpenTrace ifTrue:[
- ('JAVA: create datagram socket') infoPrintCR.
+ ('JAVA: create datagram socket') infoPrintCR.
].
sock := Socket newUDP.
sock isNil ifTrue:[
- self throwIOExceptionWithMessage:'socketCreate failed'.
+ self throwIOExceptionWithMessage:'socketCreate failed'.
].
fileNo := self addOpenFile:sock.
@@ -6424,12 +6423,12 @@
sock := self validateFile:jsock.
sock notNil ifTrue:[
- FileIOTrace ifTrue:[
- ('JAVA: socket join ' , addr printString) infoPrintCR
- ].
- self throwIOExceptionWithMessage:'unimplemented: join'.
+ FileIOTrace ifTrue:[
+ ('JAVA: socket join ' , addr printString) infoPrintCR
+ ].
+ self throwIOExceptionWithMessage:'unimplemented: join'.
self halt.
- ^ nil. "/ void
+ ^ nil. "/ void
].
"Created: / 4.2.1998 / 15:06:20 / cg"
@@ -6444,10 +6443,10 @@
sock := self validateFile:jsock.
sock notNil ifTrue:[
- FileIOTrace ifTrue:[
- ('JAVA: socket receive') infoPrintCR
- ].
- ^ -1.
+ FileIOTrace ifTrue:[
+ ('JAVA: socket receive') infoPrintCR
+ ].
+ ^ -1.
].
^ -1
@@ -6463,10 +6462,10 @@
sock := self validateFile:jsock.
sock notNil ifTrue:[
- FileIOTrace ifTrue:[
- ('JAVA: socket send') infoPrintCR
- ].
- ^ -1.
+ FileIOTrace ifTrue:[
+ ('JAVA: socket send') infoPrintCR
+ ].
+ ^ -1.
].
^ -1
@@ -6482,12 +6481,12 @@
sock := self validateFile:jsock.
sock notNil ifTrue:[
- FileIOTrace ifTrue:[
- ('JAVA: socket getOption ' , opt printString) infoPrintCR
- ].
- self throwIOExceptionWithMessage:'unimplemented: getOption'.
+ FileIOTrace ifTrue:[
+ ('JAVA: socket getOption ' , opt printString) infoPrintCR
+ ].
+ self throwIOExceptionWithMessage:'unimplemented: getOption'.
self halt.
- ^ -1.
+ ^ -1.
].
^ -1.
@@ -6506,33 +6505,33 @@
sock := self validateFile:jsock.
sock notNil ifTrue:[
- FileIOTrace ifTrue:[
- ('JAVA: socket setOption ' , opt printString) infoPrintCR
- ].
-
- jSocketOptions := Java at:'java.net.SocketOptions'.
- (opt == (jSocketOptions instVarNamed:'TCP_NODELAY')) ifTrue:[
- ] ifFalse:[
- (opt == (jSocketOptions instVarNamed:'SO_BINDADDR')) ifTrue:[
- ] ifFalse:[
- (opt == (jSocketOptions instVarNamed:'SO_REUSEADDR')) ifTrue:[
- ] ifFalse:[
- (opt == (jSocketOptions instVarNamed:'IP_MULTICAST_IF')) ifTrue:[
- ] ifFalse:[
- (opt == (jSocketOptions instVarNamed:'SO_LINGER')) ifTrue:[
- ] ifFalse:[
- (opt == (jSocketOptions instVarNamed:'SO_TIMEOUT')) ifTrue:[
- ] ifFalse:[
- self throwIOExceptionWithMessage:'bad arg to setOption'.
- ]
- ]
- ]
- ]
- ]
- ].
- self throwIOExceptionWithMessage:'unimplemented: setOption'.
+ FileIOTrace ifTrue:[
+ ('JAVA: socket setOption ' , opt printString) infoPrintCR
+ ].
+
+ jSocketOptions := Java at:'java.net.SocketOptions'.
+ (opt == (jSocketOptions instVarNamed:'TCP_NODELAY')) ifTrue:[
+ ] ifFalse:[
+ (opt == (jSocketOptions instVarNamed:'SO_BINDADDR')) ifTrue:[
+ ] ifFalse:[
+ (opt == (jSocketOptions instVarNamed:'SO_REUSEADDR')) ifTrue:[
+ ] ifFalse:[
+ (opt == (jSocketOptions instVarNamed:'IP_MULTICAST_IF')) ifTrue:[
+ ] ifFalse:[
+ (opt == (jSocketOptions instVarNamed:'SO_LINGER')) ifTrue:[
+ ] ifFalse:[
+ (opt == (jSocketOptions instVarNamed:'SO_TIMEOUT')) ifTrue:[
+ ] ifFalse:[
+ self throwIOExceptionWithMessage:'bad arg to setOption'.
+ ]
+ ]
+ ]
+ ]
+ ]
+ ].
+ self throwIOExceptionWithMessage:'unimplemented: setOption'.
self halt.
- ^ nil. "/ void
+ ^ nil. "/ void
].
"Created: / 4.2.1998 / 15:06:20 / cg"
@@ -6551,24 +6550,24 @@
sock := self validateFile:jsock.
sock isNil ifTrue:[
- self throwIOExceptionWithMessage:'nil socket in accept'.
- ^ self.
+ self throwIOExceptionWithMessage:'nil socket in accept'.
+ ^ self.
].
newJSock := nativeContext argAt:1.
fd := newJSock instVarNamed:'fd'.
(fd instVarNamed:'fd') ~~ 0 ifTrue:[
- self halt:'file already open'.
- self internalError:'file already open'.
- self throwIOExceptionWithMessage:'socket already open in socketAccept'.
- ^ self.
+ self halt:'file already open'.
+ self internalError:'file already open'.
+ self throwIOExceptionWithMessage:'socket already open in socketAccept'.
+ ^ self.
].
FileIOTrace ifTrue:[
- 'JAVA: socket accept' infoPrintCR
+ 'JAVA: socket accept' infoPrintCR
].
newSock := sock accept.
newSock isNil ifTrue:[
- self throwIOExceptionWithMessage:'accept failed'.
+ self throwIOExceptionWithMessage:'accept failed'.
].
fileNo := self addOpenFile:newSock.
fd instVarNamed:'fd' put:fileNo.
@@ -6584,8 +6583,8 @@
sock := self validateFile:jSock.
sock isNil ifTrue:[
- self throwIOExceptionWithMessage:'socketAvailable on closed socket'.
- ^ self.
+ self throwIOExceptionWithMessage:'socketAvailable on closed socket'.
+ ^ self.
].
n := sock numAvailable.
@@ -6604,23 +6603,23 @@
hostName := jaddr instVarNamed:'hostName'.
hostName isNil ifTrue:[
- self halt.
+ self halt.
] ifFalse:[
- hostName := Java as_ST_String:hostName
+ hostName := Java as_ST_String:hostName
].
sock := self validateFile:jsock.
sock notNil ifTrue:[
- FileIOTrace ifTrue:[
- ('JAVA: socket bind to ' , hostName printString, ' port ' , port printString) infoPrintCR
- ].
-
- ok := sock bindTo:port address:nil "hostName".
- ok ifFalse:[
- err := OperatingSystem lastErrorString.
- Transcript showCR:'sock err: ' , err printString.
- self throwIOExceptionWithMessage:'bind failed'.
- ]
+ FileIOTrace ifTrue:[
+ ('JAVA: socket bind to ' , hostName printString, ' port ' , port printString) infoPrintCR
+ ].
+
+ ok := sock bindTo:port address:nil "hostName".
+ ok ifFalse:[
+ err := OperatingSystem lastErrorString.
+ Transcript showCR:'sock err: ' , err printString.
+ self throwIOExceptionWithMessage:'bind failed'.
+ ]
].
"Created: / 4.2.1998 / 15:06:20 / cg"
@@ -6634,10 +6633,10 @@
sock := self validateFile:jsock.
sock notNil ifTrue:[
- FileIOTrace ifTrue:[
- 'JAVA: close socket' infoPrintCR
- ].
- sock close.
+ FileIOTrace ifTrue:[
+ 'JAVA: close socket' infoPrintCR
+ ].
+ sock close.
].
"Modified: / 21.8.1997 / 17:09:40 / cg"
@@ -6653,51 +6652,51 @@
hostName := jaddr instVarNamed:'hostName'.
hostName notNil ifTrue:[
- hostName := Java as_ST_String:hostName
+ hostName := Java as_ST_String:hostName
] ifFalse:[
- addr := jaddr instVarNamed:'address'.
- addr notNil ifTrue:[
- hostName := ByteArray new:4.
- hostName at:4 put:(addr bitAnd:16rFF).
- addr := addr bitShift:-8.
- hostName at:3 put:(addr bitAnd:16rFF).
- addr := addr bitShift:-8.
- hostName at:2 put:(addr bitAnd:16rFF).
- addr := addr bitShift:-8.
- hostName at:1 put:(addr bitAnd:16rFF).
- ].
+ addr := jaddr instVarNamed:'address'.
+ addr notNil ifTrue:[
+ hostName := ByteArray new:4.
+ hostName at:4 put:(addr bitAnd:16rFF).
+ addr := addr bitShift:-8.
+ hostName at:3 put:(addr bitAnd:16rFF).
+ addr := addr bitShift:-8.
+ hostName at:2 put:(addr bitAnd:16rFF).
+ addr := addr bitShift:-8.
+ hostName at:1 put:(addr bitAnd:16rFF).
+ ].
].
hostName isNil ifTrue:[
- self halt.
+ self halt.
].
sock := self validateFile:jsock.
sock notNil ifTrue:[
- FileIOTrace ifTrue:[
- ('JAVA: socket connect to ' , hostName printString , ' port ' , port printString) infoPrintCR
- ].
- SocketConnectConfirmation ifTrue:[
- (PermittedHostConnects isNil
- or:[(PermittedHostConnects includes:hostName) not]) ifTrue:[
- (self confirm:'connect to host: ' , hostName printString , ' - ok ?')
- ifFalse:[
- self throwIOExceptionWithMessage:'connect permission denied'.
- ].
-
- (self confirm:('JAVA Security check\\Always permit connects to this host (''' , hostName printString , ''') ?') withCRs)
- ifTrue:[
- PermittedHostConnects isNil ifTrue:[
- PermittedHostConnects := Set new
- ].
- PermittedHostConnects add:hostName.
- ]
- ]
- ].
-
- ok := sock connectTo:hostName port:port blocking:true.
- ok ifFalse:[
- self throwIOExceptionWithMessage:'connect failed'.
- ]
+ FileIOTrace ifTrue:[
+ ('JAVA: socket connect to ' , hostName printString , ' port ' , port printString) infoPrintCR
+ ].
+ SocketConnectConfirmation ifTrue:[
+ (PermittedHostConnects isNil
+ or:[(PermittedHostConnects includes:hostName) not]) ifTrue:[
+ (self confirm:'connect to host: ' , hostName printString , ' - ok ?')
+ ifFalse:[
+ self throwIOExceptionWithMessage:'connect permission denied'.
+ ].
+
+ (self confirm:('JAVA Security check\\Always permit connects to this host (''' , hostName printString , ''') ?') withCRs)
+ ifTrue:[
+ PermittedHostConnects isNil ifTrue:[
+ PermittedHostConnects := Set new
+ ].
+ PermittedHostConnects add:hostName.
+ ]
+ ]
+ ].
+
+ ok := sock connectTo:hostName port:port blocking:true.
+ ok ifFalse:[
+ self throwIOExceptionWithMessage:'connect failed'.
+ ]
].
"Created: / 25.1.1998 / 20:02:27 / cg"
@@ -6712,23 +6711,23 @@
fd := jsock instVarNamed:'fd'.
(fd instVarNamed:'fd') ~~ 0 ifTrue:[
- self halt:'file already open'.
- self internalError:'file already open'.
- self throwIOExceptionWithMessage:'file already open in socketCreate'.
- ^ self.
+ self halt:'file already open'.
+ self internalError:'file already open'.
+ self throwIOExceptionWithMessage:'file already open in socketCreate'.
+ ^ self.
].
FileOpenTrace ifTrue:[
- ('JAVA: create socket') infoPrintCR.
+ ('JAVA: create socket') infoPrintCR.
].
isStream ifTrue:[
- sock := Socket newTCP
+ sock := Socket newTCP
] ifFalse:[
- sock := Socket newUDP
+ sock := Socket newUDP
].
sock isNil ifTrue:[
- self throwIOExceptionWithMessage:'socketCreate failed'.
+ self throwIOExceptionWithMessage:'socketCreate failed'.
].
fileNo := self addOpenFile:sock.
@@ -6746,17 +6745,17 @@
sock := self validateFile:jSock.
sock notNil ifTrue:[
- FileIOTrace ifTrue:[
- ('JAVA: socket listen with timeout ' , time printString) infoPrintCR.
- ].
- ok := sock listenWithBacklog:5.
- ok ifFalse:[
- self throwIOExceptionWithMessage:'listen failed'.
- ^ self.
- ].
- time ~~ 0 ifTrue:[
- sock readWaitWithTimeoutMs:time
- ]
+ FileIOTrace ifTrue:[
+ ('JAVA: socket listen with timeout ' , time printString) infoPrintCR.
+ ].
+ ok := sock listenWithBacklog:5.
+ ok ifFalse:[
+ self throwIOExceptionWithMessage:'listen failed'.
+ ^ self.
+ ].
+ time ~~ 0 ifTrue:[
+ sock readWaitWithTimeoutMs:time
+ ]
].
"Created: / 4.2.1998 / 15:17:48 / cg"
@@ -6827,7 +6826,7 @@
hostName := Java as_ST_String:jHostName.
addrBytes := Socket ipAddressOfHost:hostName.
addrBytes isNil ifTrue:[
- addrBytes := #[0 0 0 0] copy
+ addrBytes := #[0 0 0 0] copy
].
^ Array with:addrBytes
@@ -6846,7 +6845,7 @@
hostName := OperatingSystem getHostName.
addrBytes := Socket ipAddressOfHost:hostName.
addrBytes isNil ifTrue:[
- addrBytes := #[127 0 0 0].
+ addrBytes := #[127 0 0 0].
].
"/ MSB first into an integer.
address := (addrBytes at:1).
@@ -6876,28 +6875,28 @@
con := thisContext sender.
[con notNil
and:[con receiver isMethod not
- or:[con receiver isJavaMethod not]]] whileTrue:[
- con := con sender.
+ or:[con receiver isJavaMethod not]]] whileTrue:[
+ con := con sender.
].
con := con sender.
[con notNil] whileTrue:[
- (true "con isJavaContext") ifTrue:[
- cls := con receiver class.
- cls isMeta ifTrue:[
- "/ t'was a static method
- cls := cls soleInstance
- ].
- cls isJavaClass ifTrue:[
- jClass := JavaClasses at:cls ifAbsent:nil.
- jClass isNil ifTrue:[
- JavaClasses at:cls put:(jClass := (Java at:'java.lang.Class') new).
- JavaClasses at:jClass put:cls.
- ].
- chain add:jClass.
- ]
- ].
- con := con sender.
+ (true "con isJavaContext") ifTrue:[
+ cls := con receiver class.
+ cls isMeta ifTrue:[
+ "/ t'was a static method
+ cls := cls soleInstance
+ ].
+ cls isJavaClass ifTrue:[
+ jClass := JavaClasses at:cls ifAbsent:nil.
+ jClass isNil ifTrue:[
+ JavaClasses at:cls put:(jClass := (Java at:'java.lang.Class') new).
+ JavaClasses at:jClass put:cls.
+ ].
+ chain add:jClass.
+ ]
+ ].
+ con := con sender.
].
^ chain asArray
@@ -6961,7 +6960,7 @@
"/ somehow pass it to the html browser ....
Transcript show:'pShowDocument: '; show:s1; show:' / ';
- show:s2; show:' / '; showCR:s3.
+ show:s2; show:' / '; showCR:s3.
^ nil
@@ -6974,9 +6973,9 @@
js := nativeContext argAt:1.
js isNil ifTrue:[
- s := ''
+ s := ''
] ifFalse:[
- s := Java as_ST_String:js.
+ s := Java as_ST_String:js.
].
self activityNotification:s.
@@ -7123,43 +7122,43 @@
|f stream fileNo|
NoAudio ifTrue:[
- Transcript showCR:'JAVA: audio disabled'.
- ^ -1
+ Transcript showCR:'JAVA: audio disabled'.
+ ^ -1
].
Stream streamErrorSignal handle:[:ex |
- Stream streamErrorSignal handle:[:ex |
- stream := nil.
- ex return.
- ] do:[
- stream := SoundStream writing.
- ].
+ Stream streamErrorSignal handle:[:ex |
+ stream := nil.
+ ex return.
+ ] do:[
+ stream := SoundStream writing.
+ ].
] do:[
- stream := SoundStream writing.
- stream notNil ifTrue:[
- stream setSampleRate:8000.
- ]
+ stream := SoundStream writing.
+ stream notNil ifTrue:[
+ stream setSampleRate:8000.
+ ]
].
stream isNil ifTrue:[
"/ ^ -1.
- f := '/dev/audio' asFilename.
- f exists ifFalse:[
- Transcript showCR:'JAVA: neither SoundStream nor /dev/audio available'.
- ^ -1
- ].
- stream := f readWriteStream.
- stream isNil ifTrue:[
- Transcript showCR:'JAVA: /dev/audio exists, but cannot be opened'.
- ^ -1
- ].
- fileNo := self addOpenFile:stream.
+ f := '/dev/audio' asFilename.
+ f exists ifFalse:[
+ Transcript showCR:'JAVA: neither SoundStream nor /dev/audio available'.
+ ^ -1
+ ].
+ stream := f readWriteStream.
+ stream isNil ifTrue:[
+ Transcript showCR:'JAVA: /dev/audio exists, but cannot be opened'.
+ ^ -1
+ ].
+ fileNo := self addOpenFile:stream.
].
fileNo := self addOpenFile:stream.
FileOpenTrace ifTrue:[
- ('JAVA: opened audioDevice as FD ' , fileNo printString) infoPrintCR.
+ ('JAVA: opened audioDevice as FD ' , fileNo printString) infoPrintCR.
].
^ fileNo
@@ -7218,7 +7217,7 @@
stream := decoder instVarNamed:'input'.
pixelStore := decoder instVarNamed:'store'.
pixelStore isNil ifTrue:[
- ^ 0
+ ^ 0
].
buffSize := (width * height // 2) max:4096.
@@ -7228,61 +7227,61 @@
count := stream perform:#'read()I'.
[count notNil and:[count > 0]] whileTrue:[
- (index + count) > buffSize ifTrue:[
- t := ByteArray uninitializedNew:(buffSize * 2).
- t replaceFrom:1 to:buffSize with:compressedData startingAt:1.
- compressedData := t.
- buffSize := buffSize * 2.
- ].
- [count ~~ 0] whileTrue:[
- countGot := stream
- perform:#'read([BII)I'
- with:compressedData
- with:index-1
- with:count.
-
- countGot > 0 ifTrue:[
- count := count - countGot.
- index := index + countGot.
- ] ifFalse:[
- count := -1.
- ]
- ].
-
- count >= 0 ifTrue:[
- count := stream perform:#read.
- ]
+ (index + count) > buffSize ifTrue:[
+ t := ByteArray uninitializedNew:(buffSize * 2).
+ t replaceFrom:1 to:buffSize with:compressedData startingAt:1.
+ compressedData := t.
+ buffSize := buffSize * 2.
+ ].
+ [count ~~ 0] whileTrue:[
+ countGot := stream
+ perform:#'read([BII)I'
+ with:compressedData
+ with:index-1
+ with:count.
+
+ countGot > 0 ifTrue:[
+ count := count - countGot.
+ index := index + countGot.
+ ] ifFalse:[
+ count := -1.
+ ]
+ ].
+
+ count >= 0 ifTrue:[
+ count := stream perform:#read.
+ ]
].
compressedSize := index - 1.
data := pixelStore perform:#'allocateLines(I)Ljava/lang/Object;' with:height.
(data isMemberOf:ByteArray) ifFalse:[
- self halt.
- ^ 0.
+ self halt.
+ ^ 0.
].
"/ 'GIFReader: decompressing ...' infoPrintCR.
GIFReader
- decompressGIFFrom:compressedData
- count:compressedSize
- into:data
- startingAt:1
- codeLen:(codeLen + 1).
+ decompressGIFFrom:compressedData
+ count:compressedSize
+ into:data
+ startingAt:1
+ codeLen:(codeLen + 1).
clrModel := pixelStore instVarNamed:'colormodel'.
pixelStore
- perform:#'setPixels(IIII[BII)Z'
- withArguments:
- (Array
- with:0 "/ x
- with:0 "/ y
- with:width "/ w
- with:height "/ h
- with:data
- with:0 "/ offs
- with:width). "/ scanSize
+ perform:#'setPixels(IIII[BII)Z'
+ withArguments:
+ (Array
+ with:0 "/ x
+ with:0 "/ y
+ with:width "/ w
+ with:height "/ h
+ with:data
+ with:0 "/ offs
+ with:width). "/ scanSize
pixelStore perform:#'imageComplete()V'.
"/ perform:#'imageComplete(I)V'
@@ -7333,8 +7332,8 @@
imgRep := nativeContext receiver.
img := imgRep instVarNamed:'pData'.
(img isNil or:[img == 0]) ifTrue:[
- "/ self halt.
- ^ self.
+ "/ self halt.
+ ^ self.
].
jGraphics := nativeContext argAt:1.
gc := jGraphics instVarNamed:'pData'.
@@ -7346,7 +7345,7 @@
deviceImage := img onDevice:gc device.
deviceImage ~~ img ifTrue:[
- imgRep instVarNamed:'pData' put:deviceImage.
+ imgRep instVarNamed:'pData' put:deviceImage.
].
gc realized ifFalse:[^ self].
deviceImage displayOn:gc x:x y:y.
@@ -7458,17 +7457,17 @@
depth := clrModel instVarNamed:'pixel_bits'.
(clrModel instVarNamed:'map_size') ~~ 0 ifTrue:[
- rgbMap := clrModel instVarNamed:'rgb'.
- cmap := Array new:rgbMap size.
- rgbMap
- keysAndValuesDo:[:idx :rgb |
- cmap at:idx put:(Color rgbValue:(rgb bitAnd:16rFFFFFF))
- ].
+ rgbMap := clrModel instVarNamed:'rgb'.
+ cmap := Array new:rgbMap size.
+ rgbMap
+ keysAndValuesDo:[:idx :rgb |
+ cmap at:idx put:(Color rgbValue:(rgb bitAnd:16rFFFFFF))
+ ].
].
opaque := (clrModel instVarNamed:'opaque') ~~ 0.
opaque ifFalse:[
- transparentColorIndex := clrModel instVarNamed:'transparent_index'
+ transparentColorIndex := clrModel instVarNamed:'transparent_index'
].
img := imgRep instVarNamed:'pData'.
@@ -7477,27 +7476,27 @@
].
(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.
+ 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 := Image width:w height:h depth:depth fromArray:bytes.
cmap notNil ifTrue:[
- img colorMap:cmap.
- img photometric:#palette
+ img colorMap:cmap.
+ img photometric:#palette
].
opaque ifFalse:[
- img mask:(ImageReader
- buildMaskFromColor:transparentColorIndex
- for:bytes
- width:w
- height:h)
+ img mask:(ImageReader
+ buildMaskFromColor:transparentColorIndex
+ for:bytes
+ width:w
+ height:h)
].
imgRep instVarNamed:'pData' put:img.
@@ -7530,18 +7529,18 @@
depth := clrModel instVarNamed:'pixel_bits'.
clrModel class == (Java at:'java.awt.image.DirectColorModel') ifTrue:[
] ifFalse:[
- (clrModel instVarNamed:'map_size') ~~ 0 ifTrue:[
- rgbMap := clrModel instVarNamed:'rgb'.
- cmap := Array new:rgbMap size.
- rgbMap
- keysAndValuesDo:[:idx :rgb |
- cmap at:idx put:(Color rgbValue:(rgb bitAnd:16rFFFFFF))
- ].
- ].
- opaque := (clrModel instVarNamed:'opaque') ~~ 0.
- opaque ifFalse:[
- transparentColorIndex := clrModel instVarNamed:'transparent_index'
- ].
+ (clrModel instVarNamed:'map_size') ~~ 0 ifTrue:[
+ rgbMap := clrModel instVarNamed:'rgb'.
+ cmap := Array new:rgbMap size.
+ rgbMap
+ keysAndValuesDo:[:idx :rgb |
+ cmap at:idx put:(Color rgbValue:(rgb bitAnd:16rFFFFFF))
+ ].
+ ].
+ opaque := (clrModel instVarNamed:'opaque') ~~ 0.
+ opaque ifFalse:[
+ transparentColorIndex := clrModel instVarNamed:'transparent_index'
+ ].
].
img := imgRep instVarNamed:'pData'.
@@ -7550,51 +7549,51 @@
].
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 := Depth24Image width:w height:h depth:24 fromArray:bytes.
- img photometric:#rgb.
+ "/ 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 := Depth24Image width:w height:h depth:24 fromArray:bytes.
+ img photometric:#rgb.
] ifFalse:[
- scanLineWidth ~~ w ifTrue:[
- self halt
- ].
- img := Image width:w height:h depth:depth fromArray:ints.
- cmap notNil ifTrue:[
- img colorMap:cmap.
- img photometric:#palette
- ] ifFalse:[
- img photometric:#rgb
- ].
+ scanLineWidth ~~ w ifTrue:[
+ self halt
+ ].
+ img := Image width:w height:h depth:depth fromArray:ints.
+ cmap notNil ifTrue:[
+ img colorMap:cmap.
+ img photometric:#palette
+ ] ifFalse:[
+ img photometric:#rgb
+ ].
].
opaque ifFalse:[
- img mask:(ImageReader
- buildMaskFromColor:transparentColorIndex
- for:ints
- width:w
- height:h)
+ img mask:(ImageReader
+ buildMaskFromColor:transparentColorIndex
+ for:ints
+ width:w
+ height:h)
].
imgRep instVarNamed:'pData' put:img.
@@ -7809,8 +7808,8 @@
"/ frame views are under my browsers own control
(view isMemberOf:JavaEmbeddedFrameView) ifFalse:[
- view beVisible.
- view realize.
+ view beVisible.
+ view realize.
].
"/ view windowGroup notNil ifTrue:[
@@ -7838,18 +7837,18 @@
button := Button in:frame.
button sizeFixed:true.
button action:[
- jButtonPeer perform:#'handleAction()V'.
- ].
+ jButtonPeer perform:#'handleAction()V'.
+ ].
lbl := jButton instVarNamed:'label'.
lbl notNil ifTrue:[
- lbl := Java as_ST_String:lbl.
- button label:lbl
+ lbl := Java as_ST_String:lbl.
+ button label:lbl
].
self createdWindowsView:button for:jButtonPeer.
WindowCreationTrace == true ifTrue:[
- 'WButtonPeer_create: ' print. frame print. ' -> ' print. button printNL.
+ 'WButtonPeer_create: ' print. frame print. ' -> ' print. button printNL.
].
"Created: / 5.1.1998 / 01:53:30 / cg"
@@ -7875,13 +7874,13 @@
jFrame := nativeContext argAt:1.
jFrame isNil ifTrue:[
- self halt:'no frame in canvasPeer create'.
- subView := JavaView new.
+ self halt:'no frame in canvasPeer create'.
+ subView := JavaView new.
"/ self internalError:'no frame in canvasPeer create'.
"/ ^ self.
] ifFalse:[
- frame := jFrame instVarNamed:'pData'.
- subView := JavaView in:frame.
+ frame := jFrame instVarNamed:'pData'.
+ subView := JavaView in:frame.
].
subView delegate:self.
@@ -7890,7 +7889,7 @@
self createdWindowsView:subView for:jCanvasPeer.
WindowCreationTrace == true ifTrue:[
- 'WCanvasPeer_create: ' print. frame print. ' -> ' print. subView printNL.
+ 'WCanvasPeer_create: ' print. frame print. ' -> ' print. subView printNL.
].
"Created: / 5.1.1998 / 00:59:19 / cg"
@@ -7962,9 +7961,9 @@
state := nativeContext argAt:1.
state ~~ 0 ifTrue:[
- checkBox turnOn
+ checkBox turnOn
] ifFalse:[
- checkBox turnOff
+ checkBox turnOff
].
"Created: / 7.1.1998 / 21:49:13 / cg"
@@ -7998,15 +7997,15 @@
comboBox := ComboListView in:frame.
comboBox model:(SelectionInList new list:(OrderedCollection new)).
comboBox action:[:index |
- jChoicePeer
- perform:#'handleAction(I)V'
- with:(comboBox model selectionIndex - 1)
- ].
+ jChoicePeer
+ perform:#'handleAction(I)V'
+ with:(comboBox model selectionIndex - 1)
+ ].
self createdWindowsView:comboBox for:jChoicePeer.
WindowCreationTrace == true ifTrue:[
- 'WChoicePeer_create: ' print. frame print. ' -> ' print. comboBox printNL.
+ 'WChoicePeer_create: ' print. frame print. ' -> ' print. comboBox printNL.
].
"Created: / 7.1.1998 / 21:44:31 / cg"
@@ -8048,7 +8047,7 @@
str := Screen current rootView getTextSelection.
str isNil ifTrue:[
- str := ''.
+ str := ''.
].
^ Java as_String:''.
@@ -8070,7 +8069,7 @@
strSel := nativeContext argAt:1.
data := strSel instVarNamed:'data'.
data class == (Java at:'java.lang.String') ifTrue:[
- Screen current rootView setTextSelection:(Java as_ST_String:data)
+ Screen current rootView setTextSelection:(Java as_ST_String:data)
].
UnimplementedNativeMethodSignal raise
@@ -8126,7 +8125,7 @@
view := self viewForWPeer:nativeContext.
Object errorSignal catch:[
- view destroy.
+ view destroy.
].
JavaWindowGroup removeView:view.
@@ -8162,7 +8161,7 @@
"/ ].
(view isKindOf:ScrollableView) ifTrue:[
- view := view scrolledView
+ view := view scrolledView
].
view viewBackground:clr.
view backgroundPaint:clr.
@@ -8252,36 +8251,36 @@
view := self viewForWPeer:nativeContext.
view notNil ifTrue:[
- jEv := nativeContext argAt:1.
- stEv := jEv instVarNamed:'data'.
- (stEv notNil and:[stEv ~~ 0]) ifTrue:[
- ignore := true.
- view isJavaView ifFalse:[
- ignore := false
- ] ifTrue:[
- view isTopView ifTrue:[
- stEv type == #terminate ifTrue:[
- ignore := false
- ].
- ]
- ].
-
- ignore ifFalse:[
- EventTrace == true ifTrue:[
- ('JAVA: WComponent - handleEvent: ' , stEv type , ' for ' , view printString) infoPrintCR.
- ].
- view dispatchEvent:stEv.
- ^ self.
- ].
-
- EventTrace == true ifTrue:[
- ('JAVA: WComponent - handleEvent ignored:' , stEv type) infoPrintCR.
- ].
- ^ self
- ]
+ jEv := nativeContext argAt:1.
+ stEv := jEv instVarNamed:'data'.
+ (stEv notNil and:[stEv ~~ 0]) ifTrue:[
+ ignore := true.
+ view isJavaView ifFalse:[
+ ignore := false
+ ] ifTrue:[
+ view isTopView ifTrue:[
+ stEv type == #terminate ifTrue:[
+ ignore := false
+ ].
+ ]
+ ].
+
+ ignore ifFalse:[
+ EventTrace == true ifTrue:[
+ ('JAVA: WComponent - handleEvent: ' , stEv type , ' for ' , view printString) infoPrintCR.
+ ].
+ view dispatchEvent:stEv.
+ ^ self.
+ ].
+
+ EventTrace == true ifTrue:[
+ ('JAVA: WComponent - handleEvent ignored:' , stEv type) infoPrintCR.
+ ].
+ ^ self
+ ]
].
EventTrace == true ifTrue:[
- ('JAVA: WComponent - handleEvent ignored') infoPrintCR.
+ ('JAVA: WComponent - handleEvent ignored') infoPrintCR.
]
"Created: / 6.1.1998 / 21:10:17 / cg"
@@ -8296,7 +8295,7 @@
Object errorSignal handle:[:ex |
] do:[
- view beInvisible
+ view beInvisible
]
"Created: / 7.1.1998 / 22:35:32 / cg"
@@ -8314,20 +8313,20 @@
^self.
view := self viewForWPeer:nativeContext.
view notNil ifTrue:[
- (view isKindOf:JavaView) ifFalse:[
- jEv := nativeContext argAt:1.
- stEv := jEv instVarNamed:'data'.
- (stEv notNil and:[stEv ~~ 0]) ifTrue:[
- EventTrace == true ifTrue:[
- ('JAVA: WComponent - handleEvent: ' , stEv type , ' for ' , view printString) infoPrintCR.
- ].
- stEv sendEventWithFocusOn:nil.
- ^ self.
- ]
- ]
+ (view isKindOf:JavaView) ifFalse:[
+ jEv := nativeContext argAt:1.
+ stEv := jEv instVarNamed:'data'.
+ (stEv notNil and:[stEv ~~ 0]) ifTrue:[
+ EventTrace == true ifTrue:[
+ ('JAVA: WComponent - handleEvent: ' , stEv type , ' for ' , view printString) infoPrintCR.
+ ].
+ stEv sendEventWithFocusOn:nil.
+ ^ self.
+ ]
+ ]
].
EventTrace == true ifTrue:[
- ('JAVA: WComponent - handleEvent ignored') infoPrintCR.
+ ('JAVA: WComponent - handleEvent ignored') infoPrintCR.
]
"Created: / 19.10.1998 / 21:26:16 / cg"
@@ -8392,8 +8391,8 @@
"/ frame views are under my browsers own control
(view isMemberOf:JavaEmbeddedFrameView) ifFalse:[
- view beVisible.
- view realize.
+ view beVisible.
+ view realize.
].
"/ view windowGroup notNil ifTrue:[
@@ -8702,10 +8701,10 @@
frame := self viewForWPeer:nativeContext.
imgRep := nativeContext argAt:1.
imgRep notNil ifTrue:[
- image := imgRep instVarNamed:'pData'.
- (image notNil and:[image ~~ 0]) ifTrue:[
- frame icon:image.
- ]
+ image := imgRep instVarNamed:'pData'.
+ (image notNil and:[image ~~ 0]) ifTrue:[
+ frame icon:image.
+ ]
].
"Created: / 27.4.1998 / 17:15:09 / cg"
@@ -8724,39 +8723,39 @@
(jFrame notNil
and:[(pDataIdx := jFrame class instVarOffsetOf:'pData') notNil])
ifTrue:[
- ((frame := jFrame instVarAt:pDataIdx) notNil
- and:[frame ~~ 0]) ifTrue:[
- WindowCreationTrace == true ifTrue:[
- 'JAVA: targetFrame view already created: ' infoPrintCR.
- ].
- "/ sigh; pData was renamed to pNativeWidget in jdk1.2 ...
- pDataIdx := jFramePeer class instVarOffsetOf:'pNativeWidget'.
- pDataIdx isNil ifTrue:[
- "/ ok, we are < 1.2
- pDataIdx := jFramePeer class instVarOffsetOf:'pData'.
- ].
- jFramePeer instVarAt:pDataIdx put:frame.
- ]
+ ((frame := jFrame instVarAt:pDataIdx) notNil
+ and:[frame ~~ 0]) ifTrue:[
+ WindowCreationTrace == true ifTrue:[
+ 'JAVA: targetFrame view already created: ' infoPrintCR.
+ ].
+ "/ sigh; pData was renamed to pNativeWidget in jdk1.2 ...
+ pDataIdx := jFramePeer class instVarOffsetOf:'pNativeWidget'.
+ pDataIdx isNil ifTrue:[
+ "/ ok, we are < 1.2
+ pDataIdx := jFramePeer class instVarOffsetOf:'pData'.
+ ].
+ jFramePeer instVarAt:pDataIdx put:frame.
+ ]
] ifFalse:[
- frame := jFramePeer instVarNamed:'pData'
+ frame := jFramePeer instVarNamed:'pData'
].
(frame notNil and:[frame ~~ 0]) ifTrue:[
- WindowCreationTrace == true ifTrue:[
- 'JAVA: frame view already created: ' infoPrint.
- jFramePeer class name infoPrintCR.
- ].
+ WindowCreationTrace == true ifTrue:[
+ 'JAVA: frame view already created: ' infoPrint.
+ jFramePeer class name infoPrintCR.
+ ].
] ifFalse:[
"/ OLD
"/ frame := StandardSystemView new.
"/ self createdWindowsView:frame for:jFramePeer.
"/ JavaWindowGroup addTopView:frame.
- frame := JavaTopView new.
- frame delegate:self.
- frame javaPeer:jFramePeer.
- self createdWindowsView:frame for:jFramePeer.
- JavaWindowGroup addTopView:frame.
+ frame := JavaTopView new.
+ frame delegate:self.
+ frame javaPeer:jFramePeer.
+ self createdWindowsView:frame for:jFramePeer.
+ JavaWindowGroup addTopView:frame.
"/ top := StandardSystemView new.
"/ frame := JavaView origin:0.0@0.0 corner:1.0@1.0 in:top.
@@ -8768,8 +8767,8 @@
].
WindowCreationTrace == true ifTrue:[
- 'JAVA: WFramePeer_create: ' print. jFramePeer displayString print.
- ' frame: ' print. frame printNL.
+ 'JAVA: WFramePeer_create: ' print. jFramePeer displayString print.
+ ' frame: ' print. frame printNL.
].
"Created: / 4.1.1998 / 17:56:39 / cg"
@@ -8868,8 +8867,8 @@
"/ gc isNil ifTrue:[^ self].
gc realized ifFalse:[
- 'JAVA: copyArea on unrealized gc - ignored' infoPrintCR.
- ^ self
+ 'JAVA: copyArea on unrealized gc - ignored' infoPrintCR.
+ ^ self
].
srcX := nativeContext argAt:1.
@@ -8880,10 +8879,10 @@
deltaY := nativeContext argAt:6.
gc
- copyFrom:gc
- x:srcX y:srcY
- toX:srcX+deltaX y:srcY+deltaY
- width:w height:h
+ copyFrom:gc
+ x:srcX y:srcY
+ toX:srcX+deltaX y:srcY+deltaY
+ width:w height:h
"Created: / 8.1.1998 / 00:16:00 / cg"
"Modified: / 9.4.1998 / 22:01:32 / cg"
@@ -8897,8 +8896,8 @@
view := KnownWindows at:jWin ifAbsent:nil.
view isNil ifTrue:[
- self halt.
- ^ self
+ self halt.
+ ^ self
].
view clippingRectangle:nil.
@@ -8967,14 +8966,14 @@
endAngle := nativeContext argAt:6.
DrawOPTrace ifTrue:[
- 'drawArc x/y= ' print. x print. '@' print. y print.
- ' w/h= ' print. w print. '@' print. h print.
- ' startAngle= ' print. startAngle print. ' endAngle= ' print. endAngle printCR.
+ 'drawArc x/y= ' print. x print. '@' print. y print.
+ ' w/h= ' print. w print. '@' print. h print.
+ ' startAngle= ' print. startAngle print. ' endAngle= ' print. endAngle printCR.
].
gc
- displayArcX:x y:y
- width:w height:h
- from:startAngle angle:(endAngle - startAngle).
+ displayArcX:x y:y
+ width:w height:h
+ from:startAngle angle:(endAngle - startAngle).
"Created: / 6.1.1998 / 21:00:15 / cg"
"Modified: / 28.1.1999 / 17:38:45 / cg"
@@ -9030,7 +9029,7 @@
y := nativeContext argAt:7.
DrawOPTrace ifTrue:[
- 'drawMFCharsSegment x/y= ' print. x print. '@' print. y print. ' s= ' print. s printCR.
+ 'drawMFCharsSegment x/y= ' print. x print. '@' print. y print. ' s= ' print. s printCR.
].
gc displayString:s from:offs+1 to:offs+len x:x y:y.
^ (gc font onDevice:(gc graphicsDevice)) widthOf:s.
@@ -9052,8 +9051,8 @@
h := nativeContext argAt:4.
DrawOPTrace ifTrue:[
- 'drawOval x/y= ' print. x print. '@' print. y print.
- ' w/h= ' print. w print. '@' print. h printCR.
+ 'drawOval x/y= ' print. x print. '@' print. y print.
+ ' w/h= ' print. w print. '@' print. h printCR.
].
gc displayArcX:x y:y width:w height:h from:0 angle:360.
@@ -9147,8 +9146,8 @@
y := nativeContext argAt:5.
DrawOPTrace ifTrue:[
- 'drawSFChars x/y= ' print. x print. '@' print. y print.
- ' s= ' print. str printCR.
+ 'drawSFChars x/y= ' print. x print. '@' print. y print.
+ ' s= ' print. str printCR.
].
gc displayString:str from:idx1+1 to:idx1+nChars x:x y:y
@@ -9216,7 +9215,7 @@
count := nativeContext argAt:3.
DrawOPTrace ifTrue:[
- 'fillPolgon' printCR.
+ 'fillPolgon' printCR.
].
points := (1 to:count) collect:[:i | (xVector at:i) @ (yVector at:i)].
@@ -9277,22 +9276,22 @@
rect := (Java classForName:'java.awt.Rectangle') basicNew.
(gc isMemberOf:JavaView) ifTrue:[
- "/ r := gc clippingRectangleOrNil.
- r := gc getNextUpdateRectangle.
+ "/ r := gc clippingRectangleOrNil.
+ r := gc getNextUpdateRectangle.
].
r isNil ifTrue:[
- r := gc clippingRectangleOrNil.
+ r := gc clippingRectangleOrNil.
].
r isNil ifTrue:[
- x := y := 0.
- w := (gc width).
- h := (gc height).
+ x := y := 0.
+ w := (gc width).
+ h := (gc height).
] ifFalse:[
- x := (r left).
- y := (r top).
- w := (r width).
- h := (r height).
+ x := (r left).
+ y := (r top).
+ w := (r width).
+ h := (r height).
].
rect instVarNamed:'x' put:x.
rect instVarNamed:'y' put:y.
@@ -9375,7 +9374,7 @@
gc function:#copy.
true "DrawOPTrace" ifTrue:[
- 'copyMode' infoPrintCR.
+ 'copyMode' infoPrintCR.
].
"Created: / 8.1.1998 / 00:33:44 / cg"
@@ -9409,12 +9408,12 @@
"/ gc foreground:(Color colorId:invColor)
"/ background:device blackColor.
device
- setForeground:invColor background:0
- in:gc gcId.
+ setForeground:invColor background:0
+ in:gc gcId.
gc function:#xor.
true "DrawOPTrace" ifTrue:[
- 'xorMode' infoPrintCR.
+ 'xorMode' infoPrintCR.
].
"Created: / 8.1.1998 / 00:36:17 / cg"
@@ -9430,7 +9429,7 @@
lbl := jLabel instVarNamed:'text'.
lbl notNil ifTrue:[
- lbl := Java as_ST_String:lbl
+ lbl := Java as_ST_String:lbl
].
jFrame := nativeContext argAt:1.
@@ -9439,12 +9438,12 @@
label := Label in:frame.
label sizeFixed:true.
lbl notNil ifTrue:[
- label label:lbl
+ label label:lbl
].
self createdWindowsView:label for:jLabelPeer.
WindowCreationTrace == true ifTrue:[
- 'WLabelPeer_create: ' print. frame print. ' -> ' print. label printNL.
+ 'WLabelPeer_create: ' print. frame print. ' -> ' print. label printNL.
].
"Created: / 7.1.1998 / 21:42:31 / cg"
@@ -9470,7 +9469,7 @@
label := self viewForWPeer:nativeContext.
jString notNil ifTrue:[
- str := Java as_ST_String:jString
+ str := Java as_ST_String:jString
].
label label:str
@@ -9488,8 +9487,8 @@
length := nativeContext argAt:3.
(m := selListView model) notNil ifTrue:[
- m list addLast:(Java as_ST_String:jString).
- m changed:#list.
+ m list addLast:(Java as_ST_String:jString).
+ m changed:#list.
].
"Created: / 26.10.1998 / 20:11:30 / cg"
@@ -9506,10 +9505,10 @@
m := selListView model.
m isNil ifTrue:[
- Transcript showCR:'JAVA: access to listModel of closed view'.
+ Transcript showCR:'JAVA: access to listModel of closed view'.
] ifFalse:[
- m list addLast:(Java as_ST_String:jString).
- m changed:#list.
+ m list addLast:(Java as_ST_String:jString).
+ m changed:#list.
]
"Created: / 24.1.1998 / 21:10:05 / cg"
@@ -9533,7 +9532,7 @@
self createdWindowsView:selectionInListView for:jListPeer.
WindowCreationTrace == true ifTrue:[
- 'WTextAreaPeer_create: ' print. frame print. ' -> ' print. selectionInListView printNL.
+ 'WTextAreaPeer_create: ' print. frame print. ' -> ' print. selectionInListView printNL.
].
"Created: / 24.1.1998 / 19:58:54 / cg"
@@ -9552,8 +9551,8 @@
model isNil ifTrue:[^ self].
list := model list.
list size >= index1 ifTrue:[
- list removeFromIndex:index1 toIndex:(index2 min:list size).
- model changed:#list.
+ list removeFromIndex:index1 toIndex:(index2 min:list size).
+ model changed:#list.
].
"Created: / 9.4.1998 / 22:19:25 / cg"
@@ -9584,10 +9583,10 @@
index := nativeContext argAt:1.
(model := selectionInListView model) notNil ifTrue:[
- (model selectionIndex == (index + 1)) "/ JAVA indexing starts at 0
- ifTrue:[
- ^ 1
- ]
+ (model selectionIndex == (index + 1)) "/ JAVA indexing starts at 0
+ ifTrue:[
+ ^ 1
+ ]
].
^ 0.
@@ -9615,7 +9614,7 @@
index := nativeContext argAt:1.
(model := selectionInListView model) notNil ifTrue:[
- model selectionIndex:(index + 1). "/ JAVA indexing starts at 0
+ model selectionIndex:(index + 1). "/ JAVA indexing starts at 0
]
"Created: / 24.1.1998 / 22:32:35 / cg"
@@ -9665,7 +9664,7 @@
self createdWindowsView:menuBar for:jMenuBarPeer.
WindowCreationTrace == true ifTrue:[
- 'WMenuBarPeer_create: ' print. frame print. ' -> ' print. menuBar printNL.
+ 'WMenuBarPeer_create: ' print. frame print. ' -> ' print. menuBar printNL.
].
"Created: / 7.1.1998 / 21:38:31 / cg"
@@ -9699,15 +9698,15 @@
jMenuItemPeer := nativeContext receiver.
item := jMenuItemPeer instVarNamed:'pData'.
(item isNil or:[item == 0]) ifTrue:[
- 'JAVA [warning]: NULL menu item in setLabel' infoPrintCR.
- ^ self
+ 'JAVA [warning]: NULL menu item in setLabel' infoPrintCR.
+ ^ self
].
label := nativeContext argAt:1.
label isNil ifTrue:[
- label := ''
+ label := ''
] ifFalse:[
- label := Java as_ST_String:label
+ label := Java as_ST_String:label
].
item label:label.
@@ -9723,24 +9722,24 @@
jMenuPeer := nativeContext argAt:1.
menu := jMenuPeer instVarNamed:'pData'.
(menu isNil or:[menu == 0]) ifTrue:[
- 'JAVA: no menu to create item in' infoPrintCR.
- ^ self
+ 'JAVA: no menu to create item in' infoPrintCR.
+ ^ self
].
item := menu createAtIndex:nil.
item value:[
- jMenuItemPeer perform:#'handleAction(I)V' with:0
- ].
+ jMenuItemPeer perform:#'handleAction(I)V' with:0
+ ].
lbl := jMenuItem instVarNamed:'label'.
lbl notNil ifTrue:[
- lbl := Java as_ST_String:lbl.
- item label:lbl
+ lbl := Java as_ST_String:lbl.
+ item label:lbl
].
jMenuItemPeer instVarNamed:'pData' put:item.
WindowOPTrace == true ifTrue:[
- 'WMenuItem_create: ' print. menu print. ' -> ' print. item printNL.
+ 'WMenuItem_create: ' print. menu print. ' -> ' print. item printNL.
].
"Created: / 7.1.1998 / 21:40:44 / cg"
@@ -9753,8 +9752,8 @@
jMenuItemPeer := nativeContext receiver.
item := jMenuItemPeer instVarNamed:'pData'.
(item isNil or:[item == 0]) ifTrue:[
- 'JAVA [warning]: NULL menu item in enable' infoPrintCR.
- ^ self
+ 'JAVA [warning]: NULL menu item in enable' infoPrintCR.
+ ^ self
].
state := nativeContext argAt:1.
@@ -9880,7 +9879,7 @@
self createdWindowsView:scrollPane for:jScrollPanePeer.
WindowCreationTrace == true ifTrue:[
- 'WScrollPanePeer_create: ' print. frame print. ' -> ' print. scrollPane printNL.
+ 'WScrollPanePeer_create: ' print. frame print. ' -> ' print. scrollPane printNL.
].
"Created: / 9.4.1998 / 17:25:08 / cg"
@@ -9930,7 +9929,7 @@
max := nativeContext argAt:4.
(min ~~ 0 or:[max ~~ 100]) ifTrue:[
- scrollBar thumb start:min stop:max.
+ scrollBar thumb start:min stop:max.
].
scrollBar thumbOrigin:value thumbHeight:visibleAmount.
@@ -9950,28 +9949,28 @@
frame := jFrame instVarNamed:'pData'.
(jScrollbar instVarNamed:'orientation') == 0 "HORIZONTAL" ifTrue:[
- scrollBar := HorizontalScrollBar in:frame.
+ scrollBar := HorizontalScrollBar in:frame.
] ifFalse:[
- scrollBar := ScrollBar in:frame.
+ scrollBar := ScrollBar in:frame.
].
min := jScrollbar instVarNamed:'minimum'.
max := jScrollbar instVarNamed:'maximum'.
scrollBar scrollDownAction:[
- scrollBar thumbOrigin:(scrollBar thumbOrigin + ((max-min)/10) min:max).
- jScrollbarPeer perform:#'dragAbsolute(I)V' with:scrollBar thumbOrigin rounded.
- ].
+ scrollBar thumbOrigin:(scrollBar thumbOrigin + ((max-min)/10) min:max).
+ jScrollbarPeer perform:#'dragAbsolute(I)V' with:scrollBar thumbOrigin rounded.
+ ].
scrollBar scrollUpAction:[
- scrollBar thumbOrigin:(scrollBar thumbOrigin - ((max-min)/10) max:min).
- jScrollbarPeer perform:#'dragAbsolute(I)V' with:scrollBar thumbOrigin rounded.
- ].
+ scrollBar thumbOrigin:(scrollBar thumbOrigin - ((max-min)/10) max:min).
+ jScrollbarPeer perform:#'dragAbsolute(I)V' with:scrollBar thumbOrigin rounded.
+ ].
scrollBar scrollAction:[:org |
- jScrollbarPeer perform:#'dragAbsolute(I)V' with:org rounded.
- ].
+ jScrollbarPeer perform:#'dragAbsolute(I)V' with:org rounded.
+ ].
self createdWindowsView:scrollBar for:jScrollbarPeer.
WindowCreationTrace == true ifTrue:[
- 'WScrollbarPeer_create: ' print. frame print. ' -> ' print. scrollBar printNL.
+ 'WScrollbarPeer_create: ' print. frame print. ' -> ' print. scrollBar printNL.
].
"Created: / 5.1.1998 / 01:53:30 / cg"
@@ -10031,7 +10030,7 @@
textView := self viewForWPeer:nativeContext.
(textView isKindOf:ScrollableView) ifTrue:[
- textView := textView scrolledView
+ textView := textView scrolledView
].
jstring := nativeContext argAt:1.
@@ -10130,7 +10129,7 @@
jstring := nativeContext argAt:1.
jstring notNil ifTrue:[
- string := Java as_ST_String:jstring
+ string := Java as_ST_String:jstring
].
textView contents:string.
@@ -10152,10 +10151,10 @@
self createdWindowsView:editField for:jTextFieldPeer.
editField crAction:[
- jTextFieldPeer perform:#handleAction.
- ].
+ jTextFieldPeer perform:#handleAction.
+ ].
WindowCreationTrace == true ifTrue:[
- 'WTextFieldPeer_create: ' print. frame print. ' -> ' print. editField printNL.
+ 'WTextFieldPeer_create: ' print. frame print. ' -> ' print. editField printNL.
].
"Created: / 5.1.1998 / 01:27:37 / cg"
@@ -10184,20 +10183,20 @@
_WToolkit_eventLoop:nativeContext
(JavaEventThread notNil and:[JavaEventThread isDead not]) ifTrue:[
- 'JavaVM [warning]: oops - two threads executing eventLoop' errorPrintCR.
+ 'JavaVM [warning]: oops - two threads executing eventLoop' errorPrintCR.
].
JavaEventThread := Processor activeProcess.
[
- [true] whileTrue:[
- AbortSignal handle:[:ex |
- ex return
- ] do:[
- self doWindowsEventThread.
- ]
- ].
+ [true] whileTrue:[
+ AbortSignal handle:[:ex |
+ ex return
+ ] do:[
+ self doWindowsEventThread.
+ ]
+ ].
] valueNowOrOnUnwindDo:[
- JavaEventThread := nil.
+ JavaEventThread := nil.
].
"Created: / 6.1.1998 / 21:01:44 / cg"
@@ -10313,23 +10312,23 @@
window := jWindowPeer instVarNamed:'pData'.
(window notNil and:[window ~~ 0]) ifTrue:[
- WindowCreationTrace == true ifTrue:[
- 'JAVA: window view already created: ' infoPrint.
- jWindowPeer class name infoPrintCR.
- ].
+ WindowCreationTrace == true ifTrue:[
+ 'JAVA: window view already created: ' infoPrint.
+ jWindowPeer class name infoPrintCR.
+ ].
] ifFalse:[
"/ OLD
"/ window := StandardSystemView new.
"/ self createdWindowsView:window for:jWindowPeer.
"/ JavaWindowGroup addTopView:window.
- window := JavaPopUpView new.
- window borderWidth:0.
- window level:0.
- window delegate:self.
- window javaPeer:jWindowPeer.
- self createdWindowsView:window for:jWindowPeer.
- JavaWindowGroup addTopView:window.
+ window := JavaPopUpView new.
+ window borderWidth:0.
+ window level:0.
+ window delegate:self.
+ window javaPeer:jWindowPeer.
+ self createdWindowsView:window for:jWindowPeer.
+ JavaWindowGroup addTopView:window.
"/ top := StandardSystemView new.
"/ window := JavaView origin:0.0@0.0 corner:1.0@1.0 in:top.
@@ -10341,8 +10340,8 @@
].
WindowCreationTrace == true ifTrue:[
- 'JAVA: WWindowPeer_create: ' print. jWindowPeer displayString print.
- ' window: ' print. window printNL.
+ 'JAVA: WWindowPeer_create: ' print. jWindowPeer displayString print.
+ ' window: ' print. window printNL.
].
"Created: / 4.1.1998 / 17:56:39 / cg"
@@ -10415,9 +10414,9 @@
jFrame := nativeContext argAt:1.
jFrame isNil ifTrue:[
- self halt:'no frame in canvasPeer create'.
- self internalError:'no frame in canvasPeer create'.
- ^ self.
+ self halt:'no frame in canvasPeer create'.
+ self internalError:'no frame in canvasPeer create'.
+ ^ self.
].
frame := jFrame instVarNamed:'pData'.
@@ -10428,7 +10427,7 @@
self createdWindowsView:subView for:jCanvasPeer.
WindowCreationTrace == true ifTrue:[
- 'WCanvasPeer_create: ' print. frame print. ' -> ' print. subView printNL.
+ 'WCanvasPeer_create: ' print. frame print. ' -> ' print. subView printNL.
].
"Modified: / 16.1.1998 / 13:40:00 / cg"
@@ -10455,7 +10454,7 @@
clr := clr on:(view device).
(view isKindOf:ScrollableView) ifTrue:[
- view := view scrolledView
+ view := view scrolledView
].
view viewBackground:clr.
view backgroundPaint:clr.
@@ -10504,8 +10503,8 @@
"/ frame views are under my browsers own control
(view isMemberOf:JavaEmbeddedFrameView) ifFalse:[
- view beVisible.
- view realize.
+ view beVisible.
+ view realize.
].
"/ view windowGroup notNil ifTrue:[
@@ -10532,17 +10531,17 @@
onOff := (nativeContext argAt:1) == 1.
view isTopView ifTrue:[
- onOff ifTrue:[
- view minExtent:10@10.
- view maxExtent:(Screen current extent).
- ] ifFalse:[
- view minExtent:view extent.
- view maxExtent:view extent.
- ]
+ onOff ifTrue:[
+ view minExtent:10@10.
+ view maxExtent:(Screen current extent).
+ ] ifFalse:[
+ view minExtent:view extent.
+ view maxExtent:view extent.
+ ]
] ifFalse:[
- (view isMemberOf:JavaEmbeddedFrameView) ifFalse:[
- self halt.
- ]
+ (view isMemberOf:JavaEmbeddedFrameView) ifFalse:[
+ self halt.
+ ]
].
"/ 'JAVA: WWindowPeer_setResizable: ' print. view print. ' yes/no: ' print. onOff printNL.
@@ -10563,20 +10562,20 @@
self halt.
(JavaEventThread notNil and:[JavaEventThread isDead not]) ifTrue:[
- 'JavaVM [warning]: oops - two threads executing eventLoop' errorPrintCR.
+ 'JavaVM [warning]: oops - two threads executing eventLoop' errorPrintCR.
].
JavaEventThread := Processor activeProcess.
[
- [true] whileTrue:[
- AbortSignal handle:[:ex |
- ex return
- ] do:[
- self doWindowsEventThread.
- ]
- ].
+ [true] whileTrue:[
+ AbortSignal handle:[:ex |
+ ex return
+ ] do:[
+ self doWindowsEventThread.
+ ]
+ ].
] valueNowOrOnUnwindDo:[
- JavaEventThread := nil.
+ JavaEventThread := nil.
].
"Created: / 17.11.1998 / 23:58:33 / cg"
@@ -10587,7 +10586,7 @@
|toolKit|
(JavaEventThread notNil and:[JavaEventThread isDead not]) ifTrue:[
- 'JavaVM [warning]: oops - two threads executing eventLoop' errorPrintCR.
+ 'JavaVM [warning]: oops - two threads executing eventLoop' errorPrintCR.
].
toolKit := nativeContext receiver.
@@ -10597,15 +10596,15 @@
JavaEventThread := Processor activeProcess.
[
- [true] whileTrue:[
- AbortSignal handle:[:ex |
- ex return
- ] do:[
- self doWindowsEventThread.
- ]
- ].
+ [true] whileTrue:[
+ AbortSignal handle:[:ex |
+ ex return
+ ] do:[
+ self doWindowsEventThread.
+ ]
+ ].
] valueNowOrOnUnwindDo:[
- JavaEventThread := nil.
+ JavaEventThread := nil.
].
"Created: / 17.11.1998 / 23:04:29 / cg"
@@ -10638,7 +10637,7 @@
"/ ].
(view isKindOf:ScrollableView) ifTrue:[
- view := view scrolledView
+ view := view scrolledView
].
view viewBackground:clr.
view backgroundPaint:clr.
@@ -10661,7 +10660,7 @@
clr := clr on:(view device).
(view isKindOf:ScrollableView) ifTrue:[
- view := view scrolledView
+ view := view scrolledView
].
view paint:clr.
@@ -10682,17 +10681,17 @@
onOff := (nativeContext argAt:1) == 1.
view isTopView ifTrue:[
- onOff ifTrue:[
- view minExtent:10@10.
- view maxExtent:(Screen current extent).
- ] ifFalse:[
- view minExtent:view extent.
- view maxExtent:view extent.
- ]
+ onOff ifTrue:[
+ view minExtent:10@10.
+ view maxExtent:(Screen current extent).
+ ] ifFalse:[
+ view minExtent:view extent.
+ view maxExtent:view extent.
+ ]
] ifFalse:[
- (view isMemberOf:JavaEmbeddedFrameView) ifFalse:[
- self halt.
- ]
+ (view isMemberOf:JavaEmbeddedFrameView) ifFalse:[
+ self halt.
+ ]
].
"/ 'JAVA: WWindowPeer_setResizable: ' print. view print. ' yes/no: ' print. onOff printNL.
@@ -10799,8 +10798,8 @@
monitors := EnteredMonitorsPerProcess at:aProcess ifAbsent:nil.
monitors isNil ifTrue:[
- monitors := OrderedCollection new.
- EnteredMonitorsPerProcess at:aProcess put:monitors.
+ monitors := OrderedCollection new.
+ EnteredMonitorsPerProcess at:aProcess put:monitors.
].
^ monitors
@@ -10825,14 +10824,14 @@
|sema|
WaitTableAccess critical:[
- sema := WaitTable at:someObject ifAbsent:nil.
+ sema := WaitTable at:someObject ifAbsent:nil.
"/ sema notNil ifTrue:[
"/ WaitTable removeKey:someObject
"/ ]
].
sema notNil ifTrue:[
- sema signalForAll
+ sema signalForAll
]
"Created: / 2.1.1998 / 18:21:51 / cg"
@@ -10843,14 +10842,14 @@
|sema|
WaitTableAccess critical:[
- sema := WaitTable at:someObject ifAbsent:nil.
+ sema := WaitTable at:someObject ifAbsent:nil.
"/ sema notNil ifTrue:[
"/ WaitTable removeKey:someObject
"/ ]
].
sema notNil ifTrue:[
- sema signal
+ sema signal
]
"Created: / 2.1.1998 / 18:20:20 / cg"
@@ -10886,15 +10885,15 @@
wasBlocked := OperatingSystem blockInterrupts.
(mO := EnteredMonitorObject) notNil ifTrue:[
- mC := EnteredMonitorObjectCount.
- mP := EnteredMonitorProcess.
- mon := self monitorFor:mO.
- mon fakeEnter:mP count:mC.
- enteredMonitors := self enteredMonitorsOfProcess:mP.
- mC timesRepeat:[
- enteredMonitors addLast:mO
- ].
- EnteredMonitorObject := EnteredMonitorProcess := LeftMonitorObject := nil.
+ mC := EnteredMonitorObjectCount.
+ mP := EnteredMonitorProcess.
+ mon := self monitorFor:mO.
+ mon fakeEnter:mP count:mC.
+ enteredMonitors := self enteredMonitorsOfProcess:mP.
+ mC timesRepeat:[
+ enteredMonitors addLast:mO
+ ].
+ EnteredMonitorObject := EnteredMonitorProcess := LeftMonitorObject := nil.
].
wasBlocked ifFalse:[ OperatingSystem unblockInterrupts].
@@ -10918,63 +10917,63 @@
enteredMonitors := self enteredMonitorsOfProcess:thisProcess.
enteredMonitors size > 0 ifTrue:[
- MonitorTrace ifTrue:[
- ('====> wait - exit ' , enteredMonitors size printString , ' monitors in ' , Processor activeProcess name , ' ...') infoPrintCR.
- ].
- enteredMonitors do:[:handle |
- |mon|
-
- mon := LockTable at:handle ifAbsent:nil.
- mon isNil ifTrue:[
- self halt:'no monitor in wait'.
- ] ifFalse:[
- MonitorTrace ifTrue:[
- ('====> wait - exit monitor for ' , handle displayString , ' in ' , Processor activeProcess name , ' ...') infoPrintCR.
- ].
- mon exit.
- ].
- ].
- EnteredMonitorsPerProcess removeKey:thisProcess.
+ MonitorTrace ifTrue:[
+ ('====> wait - exit ' , enteredMonitors size printString , ' monitors in ' , Processor activeProcess name , ' ...') infoPrintCR.
+ ].
+ enteredMonitors do:[:handle |
+ |mon|
+
+ mon := LockTable at:handle ifAbsent:nil.
+ mon isNil ifTrue:[
+ self halt:'no monitor in wait'.
+ ] ifFalse:[
+ MonitorTrace ifTrue:[
+ ('====> wait - exit monitor for ' , handle displayString , ' in ' , Processor activeProcess name , ' ...') infoPrintCR.
+ ].
+ mon exit.
+ ].
+ ].
+ EnteredMonitorsPerProcess removeKey:thisProcess.
].
wasBlocked ifFalse:[ OperatingSystem unblockInterrupts].
pState notNil ifTrue:[thisProcess state:pState].
sema isNil ifTrue:[
- Delay waitForMilliseconds:tmo
+ Delay waitForMilliseconds:tmo
] ifFalse:[
- (tmo isNil or:[tmo = 0]) ifTrue:[
- sema wait.
- ] ifFalse:[
- sema waitWithTimeout:tmo / 1000.
- ].
+ (tmo isNil or:[tmo = 0]) ifTrue:[
+ sema wait.
+ ] ifFalse:[
+ sema waitWithTimeout:tmo / 1000.
+ ].
].
"/ re-enter monitors.
enteredMonitors size > 0 ifTrue:[
- wasBlocked := OperatingSystem blockInterrupts.
- self syncMonitorCache.
-
- MonitorTrace ifTrue:[
- ('====> wait - reenter ' , enteredMonitors size printString , ' monitors in ' , Processor activeProcess name , ' ...') infoPrintCR.
- ].
- enteredMonitors do:[:handle |
- |mon|
-
- LockTableAccess critical:[
- mon := LockTable at:handle ifAbsent:nil.
- mon isNil ifTrue:[
- LockTable at:handle put:(mon := Monitor new)
- ]
- ].
- MonitorTrace ifTrue:[
- ('====> wait - reenter monitor for ' , handle displayString , ' in ' , Processor activeProcess name , ' ...') infoPrintCR.
- ].
- mon enter.
- ].
- EnteredMonitorsPerProcess at:thisProcess put:enteredMonitors.
- wasBlocked ifFalse:[ OperatingSystem unblockInterrupts].
+ wasBlocked := OperatingSystem blockInterrupts.
+ self syncMonitorCache.
+
+ MonitorTrace ifTrue:[
+ ('====> wait - reenter ' , enteredMonitors size printString , ' monitors in ' , Processor activeProcess name , ' ...') infoPrintCR.
+ ].
+ enteredMonitors do:[:handle |
+ |mon|
+
+ LockTableAccess critical:[
+ mon := LockTable at:handle ifAbsent:nil.
+ mon isNil ifTrue:[
+ LockTable at:handle put:(mon := Monitor new)
+ ]
+ ].
+ MonitorTrace ifTrue:[
+ ('====> wait - reenter monitor for ' , handle displayString , ' in ' , Processor activeProcess name , ' ...') infoPrintCR.
+ ].
+ mon enter.
+ ].
+ EnteredMonitorsPerProcess at:thisProcess put:enteredMonitors.
+ wasBlocked ifFalse:[ OperatingSystem unblockInterrupts].
].
"Created: / 30.12.1998 / 19:19:35 / cg"
@@ -10985,8 +10984,8 @@
_ARRAYLENGTH:arr
arr isNil ifTrue:[
- self halt:'should not happen'.
- self throwNullPointerException.
+ self halt:'should not happen'.
+ self throwNullPointerException.
].
^ arr size
@@ -10995,7 +10994,7 @@
_ATHROW:aJavaException
aJavaException isNil ifTrue:[
- self halt:'cannot happen'
+ self halt:'cannot happen'
].
self throwException:aJavaException.
@@ -11006,54 +11005,54 @@
"trampouline for unhandled cases ..."
aClassOrInterface isBehavior ifTrue:[
- anObject class == aClassOrInterface ifTrue:[
- ^ true
- ].
- aClassOrInterface == ByteArray ifTrue:[
- ^ false
- ].
- aClassOrInterface == SignedIntegerArray ifTrue:[
- ^ false
- ].
-
- aClassOrInterface isInterface ifTrue:[
- (anObject class hasInterface:aClassOrInterface) ifTrue:[
- ^ true
- ]
- ].
- (anObject isKindOf:aClassOrInterface) ifTrue:[
- ^ true
- ].
- anObject isArray ifTrue:[
- ^ true
- ].
- self halt.
- ^ false.
+ anObject class == aClassOrInterface ifTrue:[
+ ^ true
+ ].
+ aClassOrInterface == ByteArray ifTrue:[
+ ^ false
+ ].
+ aClassOrInterface == SignedIntegerArray ifTrue:[
+ ^ false
+ ].
+
+ aClassOrInterface isInterface ifTrue:[
+ (anObject class hasInterface:aClassOrInterface) ifTrue:[
+ ^ true
+ ]
+ ].
+ (anObject isKindOf:aClassOrInterface) ifTrue:[
+ ^ true
+ ].
+ anObject isArray ifTrue:[
+ ^ true
+ ].
+ self halt.
+ ^ false.
].
(aClassOrInterface isMemberOf:JavaClassPointerRef) ifTrue:[
- "/ must be a pointer to an array of that class
-
- anObject isArray ifTrue:[
- ^ true
- ].
- self halt.
- ^ false.
+ "/ must be a pointer to an array of that class
+
+ anObject isArray ifTrue:[
+ ^ true
+ ].
+ self halt.
+ ^ false.
].
(aClassOrInterface isMemberOf:JavaBuiltInClassPointerRef) ifTrue:[
- aClassOrInterface arrayClass == anObject class ifTrue:[
- ^ true
- ].
+ aClassOrInterface arrayClass == anObject class ifTrue:[
+ ^ true
+ ].
].
(anObject isMemberOf:Array) ifTrue:[
- anObject size == 0 ifTrue:[
- ^ true
- ].
- (self _CHECKCAST:(anObject at:1) _:(aClassOrInterface deref)) ifTrue:[
- ^ true
- ].
- self halt.
- ^ false
+ anObject size == 0 ifTrue:[
+ ^ true
+ ].
+ (self _CHECKCAST:(anObject at:1) _:(aClassOrInterface deref)) ifTrue:[
+ ^ true
+ ].
+ self halt.
+ ^ false
].
self halt.
^ false.
@@ -11067,13 +11066,13 @@
v := op1 asInteger.
v > 16r7FFFFFFF ifTrue:[
- self halt.
- v := 16r7FFFFFFF
+ self halt.
+ v := 16r7FFFFFFF
] ifFalse:[
- v < 16r80000000 negated ifTrue:[
- self halt.
- v := 16r80000000 negated
- ]
+ v < 16r80000000 negated ifTrue:[
+ self halt.
+ v := 16r80000000 negated
+ ]
].
^ v
@@ -11086,13 +11085,13 @@
v := op1 asInteger.
v > 16r7FFFFFFFFFFFFFFF ifTrue:[
- self halt.
- v := 16r7FFFFFFFFFFFFFFF
+ self halt.
+ v := 16r7FFFFFFFFFFFFFFF
] ifFalse:[
- v < 16r8000000000000000 negated ifTrue:[
- self halt.
- v := 16r8000000000000000 negated
- ]
+ v < 16r8000000000000000 negated ifTrue:[
+ self halt.
+ v := 16r8000000000000000 negated
+ ]
].
^ v
@@ -11176,17 +11175,17 @@
"trampouline for unhandled cases ..."
aClassOrInterface isInterface ifTrue:[
- (anObject class hasInterface:aClassOrInterface) ifTrue:[
+ (anObject class hasInterface:aClassOrInterface) ifTrue:[
"/(aClassOrInterface name includesString:'LightweightPeer') ifTrue:[self halt].
- ^ 1
- ].
+ ^ 1
+ ].
].
"/ (aClassOrInterface name includesString:'LightweightPeer') ifTrue:[self halt].
anObject isArray ifTrue:[
- aClassOrInterface == (Java at:'java.lang.Object') ifTrue:[
- ^ 1
- ]
+ aClassOrInterface == (Java at:'java.lang.Object') ifTrue:[
+ ^ 1
+ ]
].
^ 0.
@@ -11220,7 +11219,7 @@
|rslt|
(op1 < 0 or:[op2 < 0]) ifTrue:[
- self halt.
+ self halt.
].
rslt := op1 bitAnd: op2.
^ rslt
@@ -11248,19 +11247,19 @@
sign := 1.
(o1 := op1) < 0 ifTrue:[
- sign := -1.
- o1 := o1 negated.
+ sign := -1.
+ o1 := o1 negated.
].
(o2 := op2) < 0 ifTrue:[
- sign := sign negated.
- o2 := o2 negated.
+ sign := sign negated.
+ o2 := o2 negated.
].
prod := (o1 * o2) bitAnd:16rFFFFFFFFFFFFFFFF.
(prod bitAnd:16r8000000000000000) ~~ 0 ifTrue:[
].
sign == -1 ifTrue:[
- prod := prod negated
+ prod := prod negated
].
^ prod
@@ -11277,7 +11276,7 @@
|rslt|
(op1 < 0 or:[op2 < 0]) ifTrue:[
- self halt.
+ self halt.
].
rslt := op1 bitOr: op2.
^ rslt
@@ -11299,7 +11298,7 @@
|rslt|
(op1 < 0) ifTrue:[
- self halt.
+ self halt.
].
rslt := (op1 bitShift:op2) bitAnd:16rFFFFFFFFFFFFFFFF.
^ rslt
@@ -11311,11 +11310,11 @@
|rslt|
op1 < 0 ifTrue:[
- self halt
+ self halt
].
(op1 < 0) ifTrue:[
- self halt.
+ self halt.
].
rslt := (op1 bitShift:op2 negated) bitAnd:16rFFFFFFFFFFFFFFFF.
^ rslt
@@ -11336,11 +11335,11 @@
|rslt|
op1 < 0 ifTrue:[
- self halt
+ self halt
].
(op1 < 0) ifTrue:[
- self halt.
+ self halt.
].
rslt := (op1 bitShift:op2 negated) bitAnd:16rFFFFFFFFFFFFFFFF.
^ rslt
@@ -11353,7 +11352,7 @@
|rslt|
(op1 < 0 or:[op2 < 0]) ifTrue:[
- self halt.
+ self halt.
].
rslt := op1 bitXor: op2.
^ rslt
@@ -11365,9 +11364,9 @@
|mon thisProcess|
someObject isNil ifTrue:[
- self throwNullPointerException.
- self halt.
- ^ self
+ self throwNullPointerException.
+ self halt.
+ ^ self
].
self syncMonitorCache.
@@ -11379,11 +11378,11 @@
mon := self monitorFor:someObject.
MonitorTrace ifTrue:[
- ('====> entering monitor for ' , someObject displayString , ' in ' , thisProcess name , ' ...') printCR.
+ ('====> entering monitor for ' , someObject displayString , ' in ' , thisProcess name , ' ...') printCR.
].
mon enter.
MonitorTrace ifTrue:[
- ('====> entered it in ' , thisProcess name , ' ...') printCR.
+ ('====> entered it in ' , thisProcess name , ' ...') printCR.
].
(self enteredMonitorsOfProcess:thisProcess) add:someObject.
@@ -11396,9 +11395,9 @@
|mon thisProcess wasBlocked lastMon|
someObject isNil ifTrue:[
- self throwNullPointerException.
- self halt.
- ^ self
+ self throwNullPointerException.
+ self halt.
+ ^ self
].
self syncMonitorCache.
@@ -11408,21 +11407,21 @@
mon := self monitorFor:someObject.
MonitorTrace ifTrue:[
- ('====> leaving monitor for ' , someObject displayString , ' in ' , thisProcess name , ' ...') printCR.
+ ('====> leaving monitor for ' , someObject displayString , ' in ' , thisProcess name , ' ...') printCR.
].
mon exit.
MonitorTrace ifTrue:[
- ('====> left it in ' , thisProcess name , ' ...') printCR.
+ ('====> left it in ' , thisProcess name , ' ...') printCR.
].
lastMon := (self enteredMonitorsOfProcess:thisProcess) removeLast.
lastMon ~~ someObject ifTrue:[
- self halt:'oops - monitor enter/exit nesting wrong'
+ self halt:'oops - monitor enter/exit nesting wrong'
].
wasBlocked := OperatingSystem blockInterrupts.
mon count == 0 ifTrue:[
- LeftMonitorObject := someObject
+ LeftMonitorObject := someObject
].
wasBlocked ifFalse:[ OperatingSystem unblockInterrupts ]
@@ -11434,14 +11433,14 @@
|clsRef cls arr elType elSizes|
typeRef == DoubleArray ifTrue:[
- cls := typeRef.
+ cls := typeRef.
] ifFalse:[
- typeRef == Array ifTrue:[
- cls := typeRef.
- ] ifFalse:[
- clsRef := typeRef asClassPointerRef.
- cls := clsRef arrayClass.
- ]
+ typeRef == Array ifTrue:[
+ cls := typeRef.
+ ] ifFalse:[
+ clsRef := typeRef asClassPointerRef.
+ cls := clsRef arrayClass.
+ ]
].
arr := cls new:dim1.
@@ -11456,24 +11455,24 @@
|clsRef cls arr elType elSizes|
typeRef == Array ifTrue:[
- cls := Array.
- elType := typeRef
+ cls := Array.
+ elType := typeRef
] ifFalse:[
- typeRef == DoubleArray ifTrue:[
- cls := Array.
- elType := typeRef
- ] ifFalse:[
- clsRef := typeRef asClassPointerRef.
+ typeRef == DoubleArray ifTrue:[
+ cls := Array.
+ elType := typeRef
+ ] ifFalse:[
+ clsRef := typeRef asClassPointerRef.
"/ cls := clsRef arrayClass.
- cls := Array.
- elType := typeRef deref.
- ]
+ cls := Array.
+ elType := typeRef deref.
+ ]
].
arr := cls new:dim2.
1 to:dim2 do:[:idx |
- arr at:idx put:(self _MULTINEW:elType _:dim1)
+ arr at:idx put:(self _MULTINEW:elType _:dim1)
].
^ arr
@@ -11492,7 +11491,7 @@
elType := typeRef deref.
1 to:dim3 do:[:idx |
- arr at:idx put:(self _MULTINEW:elType _:dim1 _:dim2)
+ arr at:idx put:(self _MULTINEW:elType _:dim1 _:dim2)
].
"/ self halt.
@@ -11529,302 +11528,302 @@
"/ jWindowEventClass := Java classForName:'java.awt.event.WindowEvent'.
"/ id := (jPaintEventClass instVarNamed:'PAINT').
- jPaintEventClass := Java classForName:'java.awt.event.PaintEvent'.
- id := (jPaintEventClass instVarNamed:'UPDATE').
-
- ((type == #'exposeX:y:width:height:')
- or:[(type == #'graphicExposeX:y:width:height:')]) ifTrue:[
- x := eventArgs at:1.
- y := eventArgs at:2.
- w := eventArgs at:3.
- h := eventArgs at:4.
- ] ifFalse:[
- x := eventArgs left.
- y := eventArgs top.
- w := eventArgs width.
- h := eventArgs height.
- ].
- jRect := (Java classForName:'java.awt.Rectangle') basicNew.
- jRect instVarNamed:'x' put:x.
- jRect instVarNamed:'y' put:y.
- jRect instVarNamed:'width' put:w.
- jRect instVarNamed:'height' put:h.
-
- jEv := jPaintEventClass newCleared "basicNew".
- jEv instVarNamed:'id' put:id.
- jEv instVarNamed:'updateRect' put:jRect.
+ jPaintEventClass := Java classForName:'java.awt.event.PaintEvent'.
+ id := (jPaintEventClass instVarNamed:'UPDATE').
+
+ ((type == #'exposeX:y:width:height:')
+ or:[(type == #'graphicExposeX:y:width:height:')]) ifTrue:[
+ x := eventArgs at:1.
+ y := eventArgs at:2.
+ w := eventArgs at:3.
+ h := eventArgs at:4.
+ ] ifFalse:[
+ x := eventArgs left.
+ y := eventArgs top.
+ w := eventArgs width.
+ h := eventArgs height.
+ ].
+ jRect := (Java classForName:'java.awt.Rectangle') basicNew.
+ jRect instVarNamed:'x' put:x.
+ jRect instVarNamed:'y' put:y.
+ jRect instVarNamed:'width' put:w.
+ jRect instVarNamed:'height' put:h.
+
+ jEv := jPaintEventClass newCleared "basicNew".
+ jEv instVarNamed:'id' put:id.
+ jEv instVarNamed:'updateRect' put:jRect.
"/ jEv instVarNamed:'g' put:jWin.
- ^ Array with:jEv.
+ ^ Array with:jEv.
].
(anEvent isKeyEvent
or:[anEvent isButtonEvent
or:[anEvent isPointerEnterLeaveEvent]]) ifTrue:[
- jInputEventClass := Java classForName:'java.awt.event.InputEvent'.
-
- anEvent hasAlt ifTrue:[
- modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'ALT_MASK')
- ].
- anEvent hasCtrl ifTrue:[
- modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'CTRL_MASK')
- ].
- anEvent hasMeta ifTrue:[
- modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'META_MASK')
- ].
- anEvent hasShift ifTrue:[
- modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'SHIFT_MASK')
- ].
- anEvent hasButton1 ifTrue:[
- modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'BUTTON1_MASK')
- ].
- anEvent hasButton2 ifTrue:[
- modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'BUTTON2_MASK')
- ].
- anEvent hasButton3 ifTrue:[
- modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'BUTTON3_MASK')
- ].
-
- anEvent isPointerEnterLeaveEvent ifFalse:[
- "/ ST/X does not (yet) record this information
- "/ with pointerLeave events.
-
- x := anEvent x.
- y := anEvent y.
- ].
+ jInputEventClass := Java classForName:'java.awt.event.InputEvent'.
+
+ anEvent hasAlt ifTrue:[
+ modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'ALT_MASK')
+ ].
+ anEvent hasCtrl ifTrue:[
+ modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'CTRL_MASK')
+ ].
+ anEvent hasMeta ifTrue:[
+ modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'META_MASK')
+ ].
+ anEvent hasShift ifTrue:[
+ modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'SHIFT_MASK')
+ ].
+ anEvent hasButton1 ifTrue:[
+ modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'BUTTON1_MASK')
+ ].
+ anEvent hasButton2 ifTrue:[
+ modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'BUTTON2_MASK')
+ ].
+ anEvent hasButton3 ifTrue:[
+ modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'BUTTON3_MASK')
+ ].
+
+ anEvent isPointerEnterLeaveEvent ifFalse:[
+ "/ ST/X does not (yet) record this information
+ "/ with pointerLeave events.
+
+ x := anEvent x.
+ y := anEvent y.
+ ].
].
anEvent isKeyEvent ifTrue:[
- jKeyEventClass := Java classForName:'java.awt.event.KeyEvent'.
-
- key := 0.
- keyChar := 0.
-
- key := anEvent key.
- key isCharacter ifTrue:[
- key := keyChar := key asciiValue
- ] ifFalse:[
- untranslatedKey := anEvent view device keyboardMap keyAtValue:key ifAbsent:key.
- untranslatedKey == #Insert ifTrue:[
- key := jKeyEventClass instVarNamed:'VK_INSERT'
- ].
- untranslatedKey == #Delete ifTrue:[
- key := jKeyEventClass instVarNamed:'VK_DELETE' "/ 127
- ].
- untranslatedKey == #BackSpace ifTrue:[
- key := jKeyEventClass instVarNamed:'VK_BACK_SPACE' "/ 8
- ].
- untranslatedKey == #Return ifTrue:[
- key := jKeyEventClass instVarNamed:'VK_ENTER' "/ 13
- ].
- untranslatedKey == #Tab ifTrue:[
- key := jKeyEventClass instVarNamed:'VK_TAB' "/ 9
- ].
- untranslatedKey == #Home ifTrue:[
- key := jKeyEventClass instVarNamed:'VK_HOME'
- ].
- untranslatedKey == #End ifTrue:[
- key := jKeyEventClass instVarNamed:'VK_END'
- ].
- (key == #PreviousPage or:[untranslatedKey == #Prior]) ifTrue:[
- key := jKeyEventClass instVarNamed:'VK_PAGE_UP'
- ].
- (key == #NextPage or:[key == #EndOfText]) ifTrue:[
- key := jKeyEventClass instVarNamed:'VK_PAGE_DOWN'
- ].
- untranslatedKey == #CursorUp ifTrue:[
- key := jKeyEventClass instVarNamed:'VK_UP'
- ].
- untranslatedKey == #CursorDown ifTrue:[
- key := jKeyEventClass instVarNamed:'VK_DOWN'
- ].
- untranslatedKey == #CursorLeft ifTrue:[
- key := jKeyEventClass instVarNamed:'VK_LEFT'
- ].
- untranslatedKey == #CursorRight ifTrue:[
- key := jKeyEventClass instVarNamed:'VK_RIGHT'
- ].
- (#( F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12)
- includes:untranslatedKey) ifTrue:[
- key := jKeyEventClass instVarNamed:('VK_' , untranslatedKey)
- ].
- ].
- (type == #'keyPress:x:y:') ifTrue:[
- id := jKeyEventClass instVarNamed:'KEY_PRESSED'
- ] ifFalse:[
- id := jKeyEventClass instVarNamed:'KEY_RELEASED'
- ].
- jEv := jKeyEventClass newCleared "basicNew".
- jEv instVarNamed:'modifiers' put:modifiers.
- jEv instVarNamed:'keyCode' put:key.
- jEv instVarNamed:'keyChar' put:keyChar.
- jEv instVarNamed:'id' put:id.
+ jKeyEventClass := Java classForName:'java.awt.event.KeyEvent'.
+
+ key := 0.
+ keyChar := 0.
+
+ key := anEvent key.
+ key isCharacter ifTrue:[
+ key := keyChar := key asciiValue
+ ] ifFalse:[
+ untranslatedKey := anEvent view device keyboardMap keyAtValue:key ifAbsent:key.
+ untranslatedKey == #Insert ifTrue:[
+ key := jKeyEventClass instVarNamed:'VK_INSERT'
+ ].
+ untranslatedKey == #Delete ifTrue:[
+ key := jKeyEventClass instVarNamed:'VK_DELETE' "/ 127
+ ].
+ untranslatedKey == #BackSpace ifTrue:[
+ key := jKeyEventClass instVarNamed:'VK_BACK_SPACE' "/ 8
+ ].
+ untranslatedKey == #Return ifTrue:[
+ key := jKeyEventClass instVarNamed:'VK_ENTER' "/ 13
+ ].
+ untranslatedKey == #Tab ifTrue:[
+ key := jKeyEventClass instVarNamed:'VK_TAB' "/ 9
+ ].
+ untranslatedKey == #Home ifTrue:[
+ key := jKeyEventClass instVarNamed:'VK_HOME'
+ ].
+ untranslatedKey == #End ifTrue:[
+ key := jKeyEventClass instVarNamed:'VK_END'
+ ].
+ (key == #PreviousPage or:[untranslatedKey == #Prior]) ifTrue:[
+ key := jKeyEventClass instVarNamed:'VK_PAGE_UP'
+ ].
+ (key == #NextPage or:[key == #EndOfText]) ifTrue:[
+ key := jKeyEventClass instVarNamed:'VK_PAGE_DOWN'
+ ].
+ untranslatedKey == #CursorUp ifTrue:[
+ key := jKeyEventClass instVarNamed:'VK_UP'
+ ].
+ untranslatedKey == #CursorDown ifTrue:[
+ key := jKeyEventClass instVarNamed:'VK_DOWN'
+ ].
+ untranslatedKey == #CursorLeft ifTrue:[
+ key := jKeyEventClass instVarNamed:'VK_LEFT'
+ ].
+ untranslatedKey == #CursorRight ifTrue:[
+ key := jKeyEventClass instVarNamed:'VK_RIGHT'
+ ].
+ (#( F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12)
+ includes:untranslatedKey) ifTrue:[
+ key := jKeyEventClass instVarNamed:('VK_' , untranslatedKey)
+ ].
+ ].
+ (type == #'keyPress:x:y:') ifTrue:[
+ id := jKeyEventClass instVarNamed:'KEY_PRESSED'
+ ] ifFalse:[
+ id := jKeyEventClass instVarNamed:'KEY_RELEASED'
+ ].
+ jEv := jKeyEventClass newCleared "basicNew".
+ jEv instVarNamed:'modifiers' put:modifiers.
+ jEv instVarNamed:'keyCode' put:key.
+ jEv instVarNamed:'keyChar' put:keyChar.
+ jEv instVarNamed:'id' put:id.
"/ jEv instVarNamed:'x' put:x.
"/ jEv instVarNamed:'y' put:y.
- jEv instVarNamed:'when' put:(OperatingSystem getMillisecondTime).
- ^ Array with:jEv
+ jEv instVarNamed:'when' put:(OperatingSystem getMillisecondTime).
+ ^ Array with:jEv
].
(anEvent isButtonEvent
or:[anEvent isPointerEnterLeaveEvent]) ifTrue:[
- jMouseEventClass := Java classForName:'java.awt.event.MouseEvent'.
- clickCount := 1.
-
- (type == #'buttonPress:x:y:') ifTrue:[
- id := jMouseEventClass instVarNamed:'MOUSE_PRESSED'.
- ] ifFalse:[
- (type == #'buttonRelease:x:y:') ifTrue:[
- id := jMouseEventClass instVarNamed:'MOUSE_RELEASED'.
- ] ifFalse:[
- (type == #'buttonMotion:x:y:') ifTrue:[
- (anEvent state bitAnd:(anEvent view device anyButtonMotionMask)) == 0 ifTrue:[
- id := jMouseEventClass instVarNamed:'MOUSE_MOVED'.
- ] ifFalse:[
- id := jMouseEventClass instVarNamed:'MOUSE_DRAGGED'.
- ].
- ] ifFalse:[
+ jMouseEventClass := Java classForName:'java.awt.event.MouseEvent'.
+ clickCount := 1.
+
+ (type == #'buttonPress:x:y:') ifTrue:[
+ id := jMouseEventClass instVarNamed:'MOUSE_PRESSED'.
+ ] ifFalse:[
+ (type == #'buttonRelease:x:y:') ifTrue:[
+ id := jMouseEventClass instVarNamed:'MOUSE_RELEASED'.
+ ] ifFalse:[
+ (type == #'buttonMotion:x:y:') ifTrue:[
+ (anEvent state bitAnd:(anEvent view device anyButtonMotionMask)) == 0 ifTrue:[
+ id := jMouseEventClass instVarNamed:'MOUSE_MOVED'.
+ ] ifFalse:[
+ id := jMouseEventClass instVarNamed:'MOUSE_DRAGGED'.
+ ].
+ ] ifFalse:[
"/ (type == #'pointerMotion:x:y:') ifTrue:[
"/ id := jMouseEventClass instVarNamed:'MOUSE_MOVED'.
"/ ] ifFalse:[
- (type == #'pointerEnter:x:y:') ifTrue:[
- id := jMouseEventClass instVarNamed:'MOUSE_ENTERED'.
- ] ifFalse:[
- (type == #'pointerLeave:') ifTrue:[
- id := jMouseEventClass instVarNamed:'MOUSE_EXITED'.
- ] ifFalse:[
- (type == #'buttonMultiPress:x:y:') ifTrue:[
- id := jMouseEventClass instVarNamed:'MOUSE_PRESSED'.
- clickCount := 2.
- ] ifFalse:[
- self halt.
- ]
- ]
+ (type == #'pointerEnter:x:y:') ifTrue:[
+ id := jMouseEventClass instVarNamed:'MOUSE_ENTERED'.
+ ] ifFalse:[
+ (type == #'pointerLeave:') ifTrue:[
+ id := jMouseEventClass instVarNamed:'MOUSE_EXITED'.
+ ] ifFalse:[
+ (type == #'buttonMultiPress:x:y:') ifTrue:[
+ id := jMouseEventClass instVarNamed:'MOUSE_PRESSED'.
+ clickCount := 2.
+ ] ifFalse:[
+ self halt.
+ ]
+ ]
"/ ]
- ]
- ]
- ]
- ].
- jEv := jMouseEventClass newCleared "basicNew".
- jEv instVarNamed:'modifiers' put:modifiers.
- jEv instVarNamed:'id' put:id.
- jEv instVarNamed:'x' put:x.
- jEv instVarNamed:'y' put:y.
- jEv instVarNamed:'when' put:(OperatingSystem getMillisecondTime).
- ^ Array with:jEv
+ ]
+ ]
+ ]
+ ].
+ jEv := jMouseEventClass newCleared "basicNew".
+ jEv instVarNamed:'modifiers' put:modifiers.
+ jEv instVarNamed:'id' put:id.
+ jEv instVarNamed:'x' put:x.
+ jEv instVarNamed:'y' put:y.
+ jEv instVarNamed:'when' put:(OperatingSystem getMillisecondTime).
+ ^ Array with:jEv
].
(type == #'configureX:y:width:height:') ifTrue:[
- view := anEvent view.
- x := eventArgs at:1.
- y := eventArgs at:2.
- w := eventArgs at:3.
- h := eventArgs at:4.
-
- resized := (w ~~ view width or:[h ~~ view height]).
- moved := (x ~~ view left or:[y ~~ view top]).
+ view := anEvent view.
+ x := eventArgs at:1.
+ y := eventArgs at:2.
+ w := eventArgs at:3.
+ h := eventArgs at:4.
+
+ resized := (w ~~ view width or:[h ~~ view height]).
+ moved := (x ~~ view left or:[y ~~ view top]).
"/ (view isTopView or:[view isPopUpView]) ifTrue:[
- "/ view must update its origin/extent.
- view dispatchEvent:anEvent.
+ "/ view must update its origin/extent.
+ view dispatchEvent:anEvent.
"/ ].
- "/
- "/ must change the components extent
- "/ is there no cleaner way to do this ?
- "/
- view isTopView ifTrue:[
- view isPopUpView ifFalse:[
- "/
- "/ sigh - don't include the menu.
- "/
- menu := self topViewsMenu:view.
- menu notNil ifTrue:[
- "/ must add the menus height
- h := h - menu height
- ]
- ]
- ].
-
- jWin instVarNamed:'width' put:w.
- jWin instVarNamed:'height' put:h.
- jWin instVarNamed:'x' put:x.
- jWin instVarNamed:'y' put:y.
-
- jComponentEventClass := Java classForName:'java.awt.event.ComponentEvent'.
- moved ifTrue:[
- id := (jComponentEventClass instVarNamed:'COMPONENT_MOVED').
- jEv1 := jComponentEventClass newCleared "basicNew".
- jEv1 instVarNamed:'id' put:id.
- ].
- resized ifTrue:[
- id := (jComponentEventClass instVarNamed:'COMPONENT_RESIZED').
- jEv2 := jComponentEventClass newCleared "basicNew".
- jEv2 instVarNamed:'id' put:id.
- ].
- jEv1 isNil ifTrue:[
- jEv2 isNil ifTrue:[^ nil].
- ^ Array with:jEv2
- ] ifFalse:[
- jEv2 isNil ifTrue:[
- ^ Array with:jEv1
- ]
- ].
- ^ Array with:jEv1 with:jEv2.
+ "/
+ "/ must change the components extent
+ "/ is there no cleaner way to do this ?
+ "/
+ view isTopView ifTrue:[
+ view isPopUpView ifFalse:[
+ "/
+ "/ sigh - don't include the menu.
+ "/
+ menu := self topViewsMenu:view.
+ menu notNil ifTrue:[
+ "/ must add the menus height
+ h := h - menu height
+ ]
+ ]
+ ].
+
+ jWin instVarNamed:'width' put:w.
+ jWin instVarNamed:'height' put:h.
+ jWin instVarNamed:'x' put:x.
+ jWin instVarNamed:'y' put:y.
+
+ jComponentEventClass := Java classForName:'java.awt.event.ComponentEvent'.
+ moved ifTrue:[
+ id := (jComponentEventClass instVarNamed:'COMPONENT_MOVED').
+ jEv1 := jComponentEventClass newCleared "basicNew".
+ jEv1 instVarNamed:'id' put:id.
+ ].
+ resized ifTrue:[
+ id := (jComponentEventClass instVarNamed:'COMPONENT_RESIZED').
+ jEv2 := jComponentEventClass newCleared "basicNew".
+ jEv2 instVarNamed:'id' put:id.
+ ].
+ jEv1 isNil ifTrue:[
+ jEv2 isNil ifTrue:[^ nil].
+ ^ Array with:jEv2
+ ] ifFalse:[
+ jEv2 isNil ifTrue:[
+ ^ Array with:jEv1
+ ]
+ ].
+ ^ Array with:jEv1 with:jEv2.
].
(type == #'focusIn') ifTrue:[
"/ 'focusIn' printCR.
- jComponentEventClass := Java classForName:'java.awt.event.FocusEvent'.
- id := (jComponentEventClass instVarNamed:'FOCUS_GAINED').
- jEv := jComponentEventClass newCleared "basicNew".
- jEv instVarNamed:'id' put:id.
- ^ Array with:jEv.
+ jComponentEventClass := Java classForName:'java.awt.event.FocusEvent'.
+ id := (jComponentEventClass instVarNamed:'FOCUS_GAINED').
+ jEv := jComponentEventClass newCleared "basicNew".
+ jEv instVarNamed:'id' put:id.
+ ^ Array with:jEv.
].
(type == #'focusOut') ifTrue:[
"/ 'focusOut' printCR.
- jComponentEventClass := Java classForName:'java.awt.event.FocusEvent'.
- id := (jComponentEventClass instVarNamed:'FOCUS_LOST').
- jEv := jComponentEventClass newCleared "basicNew".
- jEv instVarNamed:'id' put:id.
- ^ Array with:jEv.
+ jComponentEventClass := Java classForName:'java.awt.event.FocusEvent'.
+ id := (jComponentEventClass instVarNamed:'FOCUS_LOST').
+ jEv := jComponentEventClass newCleared "basicNew".
+ jEv instVarNamed:'id' put:id.
+ ^ Array with:jEv.
].
(type == #'mapped') ifTrue:[
"/ 'mapped' printCR.
- jComponentEventClass := Java classForName:'java.awt.event.ComponentEvent'.
- id := (jComponentEventClass instVarNamed:'COMPONENT_SHOWN').
+ jComponentEventClass := Java classForName:'java.awt.event.ComponentEvent'.
+ id := (jComponentEventClass instVarNamed:'COMPONENT_SHOWN').
"/ x := eventArgs at:1.
"/ y := eventArgs at:2.
- jEv := jComponentEventClass newCleared "basicNew".
- jEv instVarNamed:'id' put:id.
- ^ Array with:jEv.
+ jEv := jComponentEventClass newCleared "basicNew".
+ jEv instVarNamed:'id' put:id.
+ ^ Array with:jEv.
].
(type == #'unmapped') ifTrue:[
"/ 'unmapped' printCR.
- jComponentEventClass := Java classForName:'java.awt.event.ComponentEvent'.
- id := (jComponentEventClass instVarNamed:'COMPONENT_HIDDEN').
+ jComponentEventClass := Java classForName:'java.awt.event.ComponentEvent'.
+ id := (jComponentEventClass instVarNamed:'COMPONENT_HIDDEN').
"/ x := eventArgs at:1.
"/ y := eventArgs at:2.
- jEv := jComponentEventClass newCleared "basicNew".
- jEv instVarNamed:'id' put:id.
- ^ Array with:jEv.
+ jEv := jComponentEventClass newCleared "basicNew".
+ jEv instVarNamed:'id' put:id.
+ ^ Array with:jEv.
].
(type == #terminate) ifTrue:[
- jWindowEventClass := Java classForName:'java.awt.event.WindowEvent'.
+ jWindowEventClass := Java classForName:'java.awt.event.WindowEvent'.
"NEW
- id := (jWindowEventClass instVarNamed:'WINDOW_CLOSING').
+ id := (jWindowEventClass instVarNamed:'WINDOW_CLOSING').
"
"OLD "
- id := (jWindowEventClass instVarNamed:'WINDOW_CLOSED').
+ id := (jWindowEventClass instVarNamed:'WINDOW_CLOSED').
" "
- jEv := jWindowEventClass newCleared "basicNew".
- jEv instVarNamed:'id' put:id.
- ^ Array with:jEv.
+ jEv := jWindowEventClass newCleared "basicNew".
+ jEv instVarNamed:'id' put:id.
+ ^ Array with:jEv.
].
EventTrace == true ifTrue:[
- ('JAVA: unhandled event:' , type) infoPrintCR.
+ ('JAVA: unhandled event:' , type) infoPrintCR.
].
^ nil.
@@ -11845,46 +11844,46 @@
|sensor event more|
(JavaWindowGroup isNil or:[KnownWindows isNil]) ifTrue:[
- "/ '*** eventThread: no windowGroup / views ...' printCR.
- self waitFor:FirstWindowCreationSemaphore state:#eventWait timeOut:nil.
- "/ Delay waitForSeconds:0.1.
- ^ self
+ "/ '*** eventThread: no windowGroup / views ...' printCR.
+ self waitFor:FirstWindowCreationSemaphore state:#eventWait timeOut:nil.
+ "/ Delay waitForSeconds:0.1.
+ ^ self
].
"/ wait for an event to arrive ...
sensor := JavaWindowGroup sensor.
[sensor hasEvents or:[sensor damageCount ~~ 0]] whileFalse:[
- EventTrace ifTrue:[
- '*** eventThread waiting ...' printCR.
- ].
- Processor activeProcess state:#eventWait.
- self waitFor:sensor eventSemaphore state:#eventWait timeOut:nil.
+ EventTrace ifTrue:[
+ '*** eventThread waiting ...' printCR.
+ ].
+ Processor activeProcess state:#eventWait.
+ self waitFor:sensor eventSemaphore state:#eventWait timeOut:nil.
].
EventTrace ifTrue:[
- '*** eventThread event arrived ...' printCR.
+ '*** eventThread event arrived ...' printCR.
].
"/ EventTrace := true
more := true.
[more] whileTrue:[
- sensor hasDamage ifTrue:[
- EventTrace ifTrue:[
- '*** eventThread: damage arrived ...' printCR.
- ].
- event := sensor nextDamage.
- ] ifFalse:[
- event := sensor nextEvent.
- ].
- event isNil ifTrue:[
- EventTrace == true ifTrue:[
- '*** eventThread: nil event ignored' printCR.
- ].
- ^ self
- ].
-
- more := self processEvent:event
+ sensor hasDamage ifTrue:[
+ EventTrace ifTrue:[
+ '*** eventThread: damage arrived ...' printCR.
+ ].
+ event := sensor nextDamage.
+ ] ifFalse:[
+ event := sensor nextEvent.
+ ].
+ event isNil ifTrue:[
+ EventTrace == true ifTrue:[
+ '*** eventThread: nil event ignored' printCR.
+ ].
+ ^ self
+ ].
+
+ more := self processEvent:event
]
"Created: / 6.1.1998 / 21:02:40 / cg"
@@ -11895,25 +11894,25 @@
|evQ jEvents jWToolKitClass jWToolKit jWinPeer jWin v eventConsumed|
KnownWindows isNil ifTrue:[
- ^ false
+ ^ false
].
v := event view.
jWinPeer := self jPeerForView:v.
jWinPeer isNil ifTrue:[
- v isJavaView ifTrue:[
- "/ mhmh - an event for a JavaView,
- "/ which has no peer (anyMore ?)
- "/ should not happen.
- ] ifFalse:[
- "/ mhmh - an event for a subcomponent of an ST widget.
- "/ let it be handled normally.
- EventTrace ifTrue:[
- ('*** eventThread: ' , event type , '-event for unknown java-view - passed to view.') printCR.
- ].
- event view dispatchEvent:event.
- ].
- ^ true
+ v isJavaView ifTrue:[
+ "/ mhmh - an event for a JavaView,
+ "/ which has no peer (anyMore ?)
+ "/ should not happen.
+ ] ifFalse:[
+ "/ mhmh - an event for a subcomponent of an ST widget.
+ "/ let it be handled normally.
+ EventTrace ifTrue:[
+ ('*** eventThread: ' , event type , '-event for unknown java-view - passed to view.') printCR.
+ ].
+ event view dispatchEvent:event.
+ ].
+ ^ true
].
"/ change:
@@ -11943,13 +11942,13 @@
"/ ].
(#(
- #'mapped'
- #'unmapped'
- #'configureX:y:width:height:'
- #'exposeX:y:width:height:'
- #'graphicsExposeX:y:width:height:'
+ #'mapped'
+ #'unmapped'
+ #'configureX:y:width:height:'
+ #'exposeX:y:width:height:'
+ #'graphicsExposeX:y:width:height:'
) includes:event type) ifTrue:[
- event sendEventWithFocusOn:nil.
+ event sendEventWithFocusOn:nil.
].
].
@@ -11961,55 +11960,55 @@
eventConsumed := false.
v isJavaView ifTrue:[
- "/ all events handled by Java ...
+ "/ all events handled by Java ...
] ifFalse:[
- eventConsumed := true.
-
- "/ let widget handle it.
- event view dispatchEvent:event.
-
- "/ some are not passed to Java ...
- event isDamage ifTrue:[
- (v isKindOf:Button) ifTrue:[
- ^ true
- ].
- (v isKindOf:TextView) ifTrue:[
- ^ true
- ].
- (v isKindOf:Label) ifTrue:[
- ^ true
- ].
- (v isKindOf:ComboBoxView) ifTrue:[
- ^ true
- ].
- (v isKindOf:ScrollBar) ifTrue:[
- ^ true
- ].
- (v isKindOf:Scroller) ifTrue:[
- ^ true
- ].
- (v isKindOf:MenuPanel) ifTrue:[
- ^ true
- ].
- ].
+ eventConsumed := true.
+
+ "/ let widget handle it.
+ event view dispatchEvent:event.
+
+ "/ some are not passed to Java ...
+ event isDamage ifTrue:[
+ (v isKindOf:Button) ifTrue:[
+ ^ true
+ ].
+ (v isKindOf:TextView) ifTrue:[
+ ^ true
+ ].
+ (v isKindOf:Label) ifTrue:[
+ ^ true
+ ].
+ (v isKindOf:ComboBoxView) ifTrue:[
+ ^ true
+ ].
+ (v isKindOf:ScrollBar) ifTrue:[
+ ^ true
+ ].
+ (v isKindOf:Scroller) ifTrue:[
+ ^ true
+ ].
+ (v isKindOf:MenuPanel) ifTrue:[
+ ^ true
+ ].
+ ].
].
jWin := jWinPeer instVarNamed:'target'.
EventTrace ifTrue:[
- ('*** eventThread: event (' , event type , ') handled by JAVA: ') infoPrint.
- jWinPeer class name infoPrint. ' (' infoPrint.
- jWin class name infoPrint. ')' infoPrintCR.
+ ('*** eventThread: event (' , event type , ') handled by JAVA: ') infoPrint.
+ jWinPeer class name infoPrint. ' (' infoPrint.
+ jWin class name infoPrint. ')' infoPrintCR.
].
"/ create an event
jEvents := self awtEventsForEvent:event javaWindow:jWin.
jEvents isNil ifTrue:[
- EventTrace ifTrue:[
- ('*** eventThread: event ignored: ' , event type) printCR.
- ].
- ^ true
+ EventTrace ifTrue:[
+ ('*** eventThread: event ignored: ' , event type) printCR.
+ ].
+ ^ true
].
"/ v superView isNil ifTrue:[
@@ -12022,19 +12021,19 @@
jWToolKit := jWToolKitClass performStatic:#'getDefaultToolkit()Ljava/awt/Toolkit;'.
jEvents do:[:jEv |
- jEv instVarNamed:'source' put:jWin.
- jEv instVarNamed:'consumed' put:0.
- eventConsumed ifFalse:[
- "/ the first gets the original event as data
- jEv instVarNamed:'data' put:event.
- eventConsumed := true
- ].
-
- "/ post it (them) to the event queue
- EventTrace == true ifTrue:[
- 'postEvent to Java ...' printCR.
- ].
- jWToolKit "class" perform:#'postEvent(Ljava/awt/AWTEvent;)V' with:jEv.
+ jEv instVarNamed:'source' put:jWin.
+ jEv instVarNamed:'consumed' put:0.
+ eventConsumed ifFalse:[
+ "/ the first gets the original event as data
+ jEv instVarNamed:'data' put:event.
+ eventConsumed := true
+ ].
+
+ "/ post it (them) to the event queue
+ EventTrace == true ifTrue:[
+ 'postEvent to Java ...' printCR.
+ ].
+ jWToolKit "class" perform:#'postEvent(Ljava/awt/AWTEvent;)V' with:jEv.
].
^ false
@@ -12049,8 +12048,8 @@
|props|
(props := SystemProperties) isNil ifTrue:[
- props := SystemProperties := Dictionary new.
- self initializeSystemPropertiesInto:props.
+ props := SystemProperties := Dictionary new.
+ self initializeSystemPropertiesInto:props.
].
^ props
@@ -12061,6 +12060,6 @@
!JavaVM class methodsFor:'documentation'!
version
- ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaVM.st,v 1.162 1999/09/25 14:37:45 cg Exp $'
+ ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaVM.st,v 1.163 1999/11/09 09:24:34 cg Exp $'
! !
JavaVM initialize!