author | cg |
Sat, 09 Jan 1999 00:12:22 +0000 | |
changeset 535 | 4de9e793b358 |
parent 534 | bd64d453373f |
child 536 | 25785e87af38 |
permissions | -rw-r--r-- |
454 | 1 |
" |
2 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
||
14 |
||
518 | 15 |
Object subclass:#JavaVM |
253 | 16 |
instanceVariableNames:'' |
17 |
classVariableNames:'UnhandledJavaExceptionSignal JavaExceptionSignal |
|
18 |
UnimplementedInstructionSignal UnimplementedNativeMethodSignal |
|
19 |
BadMessageSignal InternalErrorSignal CallHandlerSignal |
|
20 |
FullExceptionTrace StackTrace TraceHistory LockTable |
|
277 | 21 |
LockTableAccess LibPath SimulatedLibs LoadedLibs |
22 |
SimulatedNativeLibs LoadedNativeLibs WaitTable WaitTableAccess |
|
23 |
JavaWindowGroup KnownWindows DrawOPTrace WindowOPTrace |
|
24 |
WindowCreationTrace EventTrace ThreadTrace MonitorTrace |
|
25 |
ExceptionTrace InsnCount InsnCounts FileOpenTrace |
|
390 | 26 |
FileOpenConfirmation SocketConnectConfirmation FileIOTrace |
474 | 27 |
OpenFileTable CachedNativeMethodTable ExceptionDebug ExitDebug |
390 | 28 |
JavaConsoleStream StandardThreadGroup EnteredMonitorsPerProcess |
29 |
JavaClasses JavaMethods DUMMY_LONG_HIGHWORD DUMMY_DOUBLE_HIGHWORD |
|
526 | 30 |
NoAudio FirstWindowCreationSemaphore PermittedDirectories |
31 |
PermittedHostConnects SimulatedOS O_WGgraphics_originX |
|
32 |
O_WGgraphics_originY O_WGgraphics_pData O_FramePeer_pNativeWidget |
|
33 |
O_FramePeer_pData ImageStretchCache LastGraphics LastGC |
|
34 |
EnteredMonitorObject EnteredMonitorObjectCount |
|
35 |
EnteredMonitorProcess LeftMonitorObject JavaEventThread |
|
36 |
JavaScreenUpdaterThread' |
|
253 | 37 |
poolDictionaries:'' |
38 |
category:'Java-Support' |
|
39 |
! |
|
40 |
||
261 | 41 |
!JavaVM class methodsFor:'documentation'! |
42 |
||
454 | 43 |
copyright |
44 |
" |
|
45 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
46 |
All Rights Reserved |
|
47 |
||
48 |
This software is furnished under a license and may be used |
|
49 |
only in accordance with the terms of that license and with the |
|
50 |
inclusion of the above copyright notice. This software may not |
|
51 |
be provided or otherwise made available to, or used by, any |
|
52 |
other person. No title to or ownership of the software is |
|
53 |
hereby transferred. |
|
54 |
" |
|
55 |
||
56 |
||
57 |
! |
|
58 |
||
261 | 59 |
nativeMethods |
60 |
" |
|
440 | 61 |
all native methods: |
62 |
||
63 |
JavaMethod allSubInstances select:[:m | |
|
64 |
m isNative |
|
65 |
] |
|
66 |
||
67 |
implemented methods: |
|
68 |
||
69 |
JavaMethod allSubInstances select:[:m | |
|
70 |
|sel| |
|
71 |
||
72 |
m isNative ifTrue:[ |
|
73 |
sel := ('_' , m javaClass lastName , '_' , m name , ':') asSymbol. |
|
74 |
JavaVM class implements:sel. |
|
75 |
] ifFalse:[ |
|
76 |
false |
|
77 |
] |
|
78 |
] |
|
79 |
||
80 |
unimplemented methods: |
|
81 |
||
82 |
JavaMethod allSubInstances select:[:m | |
|
83 |
|sel| |
|
84 |
||
85 |
m isNative ifTrue:[ |
|
86 |
sel := ('_' , m javaClass lastName , '_' , m name , ':') asSymbol. |
|
87 |
(JavaVM class implements:sel) not |
|
88 |
] ifFalse:[ |
|
89 |
false |
|
90 |
] |
|
91 |
] |
|
92 |
||
93 |
||
261 | 94 |
list of all native methods as in jdk1.1.3: |
95 |
||
96 |
X - implemented |
|
494 | 97 |
* - implemented to be validated |
261 | 98 |
x - implemented with limited functionality |
99 |
o - implemented as dummy (no functionality) |
|
100 |
||
101 |
X (Math::double sin (double)) |
|
102 |
X (Math::double cos (double)) |
|
342 | 103 |
X (Math::double tan (double)) |
104 |
X (Math::double asin (double)) |
|
105 |
X (Math::double acos (double)) |
|
106 |
X (Math::double atan (double)) |
|
107 |
X (Math::double exp (double)) |
|
261 | 108 |
X (Math::double log (double)) |
109 |
X (Math::double sqrt (double)) |
|
110 |
(Math::double IEEEremainder (double double)) |
|
111 |
X (Math::double ceil (double)) |
|
112 |
X (Math::double floor (double)) |
|
113 |
(Math::double rint (double)) |
|
114 |
(Math::double atan2 (double double)) |
|
115 |
X (Math::double pow (double double)) |
|
116 |
||
117 |
X (Class::java.lang.Class forName (java.lang.String)) |
|
118 |
X (Class::java.lang.Object newInstance ()) |
|
494 | 119 |
* (Class::boolean isInstance (java.lang.Object)) |
120 |
X (Class::boolean isAssignableFrom (java.lang.Class)) |
|
261 | 121 |
X (Class::boolean isInterface ()) |
122 |
(Class::boolean isArray ()) |
|
342 | 123 |
X (Class::boolean isPrimitive ()) |
261 | 124 |
X (Class::java.lang.String getName ()) |
125 |
X (Class::java.lang.ClassLoader getClassLoader ()) |
|
126 |
X (Class::java.lang.Class getSuperclass ()) |
|
127 |
(Class::java.lang.Class[] getInterfaces ()) |
|
128 |
(Class::java.lang.Class getComponentType ()) |
|
129 |
(Class::int getModifiers ()) |
|
130 |
(Class::java.lang.Object[] getSigners ()) |
|
131 |
(Class::void setSigners (java.lang.Object[])) |
|
132 |
X (Class::java.lang.Class getPrimitiveClass (java.lang.String)) |
|
494 | 133 |
(Class::java.lang.reflect.Field getField0 (java.lang.String int)) |
261 | 134 |
(Class::java.lang.reflect.Field[] getFields0 (int)) |
494 | 135 |
X (Class::java.lang.reflect.Method getMethod0 (java.lang.String java.lang.Class[] int)) |
342 | 136 |
X (Class::java.lang.reflect.Method[] getMethods0 (int)) |
261 | 137 |
(Class::java.lang.reflect.Constructor[] getConstructors0 (int)) |
138 |
(Class::java.lang.reflect.Constructor getConstructor0 (java.lang.Class[] int)) |
|
139 |
||
140 |
X (InetAddressImpl::java.lang.String getLocalHostName ()) |
|
141 |
X (InetAddressImpl::void makeAnyLocalAddress (java.net.InetAddress)) |
|
142 |
X (InetAddressImpl::byte[][] lookupAllHostAddr (java.lang.String)) |
|
143 |
(InetAddressImpl::java.lang.String getHostByAddr (int)) |
|
144 |
X (InetAddressImpl::int getInetFamily ()) |
|
145 |
||
146 |
X (ResourceBundle::java.lang.Class[] getClassContext ()) |
|
147 |
||
148 |
X (System::void setIn0 (java.io.InputStream)) |
|
149 |
X (System::void setOut0 (java.io.PrintStream)) |
|
150 |
X (System::void setErr0 (java.io.PrintStream)) |
|
151 |
X (System::long currentTimeMillis ()) |
|
152 |
X (System::void arraycopy (java.lang.Object int java.lang.Object int int)) |
|
153 |
(System::int identityHashCode (java.lang.Object)) |
|
154 |
X (System::java.util.Properties initProperties (java.util.Properties)) |
|
155 |
||
156 |
X (Thread::java.lang.Thread currentThread ()) |
|
157 |
X (Thread::void yield ()) |
|
158 |
X (Thread::void sleep (long)) |
|
159 |
X (Thread::void start ()) |
|
160 |
X (Thread::boolean isInterrupted (boolean)) |
|
161 |
X (Thread::boolean isAlive ()) |
|
162 |
(Thread::int countStackFrames ()) |
|
163 |
X (Thread::void setPriority0 (int)) |
|
164 |
X (Thread::void stop0 (java.lang.Object)) |
|
165 |
X (Thread::void suspend0 ()) |
|
166 |
X (Thread::void resume0 ()) |
|
494 | 167 |
* (Thread::void interrupt0 ()) |
261 | 168 |
|
342 | 169 |
(String::java.lang.String intern ()) |
261 | 170 |
|
171 |
X (Float::int floatToIntBits (float)) |
|
172 |
X (Float::float intBitsToFloat (int)) |
|
173 |
||
174 |
(ObjectStreamClass::int getClassAccess (java.lang.Class)) |
|
175 |
(ObjectStreamClass::java.lang.String[] getMethodSignatures (java.lang.Class)) |
|
176 |
(ObjectStreamClass::int getMethodAccess (java.lang.Class java.lang.String)) |
|
177 |
(ObjectStreamClass::java.lang.String[] getFieldSignatures (java.lang.Class)) |
|
178 |
(ObjectStreamClass::int getFieldAccess (java.lang.Class java.lang.String)) |
|
179 |
(ObjectStreamClass::java.io.ObjectStreamField[] getFields0 (java.lang.Class)) |
|
180 |
(ObjectStreamClass::long getSerialVersionUID (java.lang.Class)) |
|
181 |
(ObjectStreamClass::boolean hasWriteObject (java.lang.Class)) |
|
182 |
(ObjectInputStream::java.lang.Class loadClass0 (java.lang.Class java.lang.String)) |
|
183 |
(ObjectInputStream::void inputClassFields (java.lang.Object java.lang.Class int[])) |
|
184 |
(ObjectInputStream::java.lang.Object allocateNewObject (java.lang.Class java.lang.Class)) |
|
185 |
(ObjectInputStream::java.lang.Object allocateNewArray (java.lang.Class int)) |
|
186 |
(ObjectInputStream::boolean invokeObjectReader (java.lang.Object java.lang.Class)) |
|
187 |
||
188 |
(SecurityManager::java.lang.Class[] getClassContext ()) |
|
189 |
X (SecurityManager::java.lang.ClassLoader currentClassLoader ()) |
|
190 |
(SecurityManager::int classDepth (java.lang.String)) |
|
191 |
X (SecurityManager::int classLoaderDepth ()) |
|
192 |
(SecurityManager::java.lang.Class currentLoadedClass0 ()) |
|
193 |
||
194 |
X (ClassLoader::void init ()) |
|
195 |
X (ClassLoader::java.lang.Class defineClass0 (java.lang.String byte[] int int)) |
|
196 |
X (ClassLoader::void resolveClass0 (java.lang.Class)) |
|
197 |
X (ClassLoader::java.lang.Class findSystemClass0 (java.lang.String)) |
|
198 |
X (ClassLoader::java.io.InputStream getSystemResourceAsStream0 (java.lang.String)) |
|
199 |
(ClassLoader::java.lang.String getSystemResourceAsName0 (java.lang.String)) |
|
200 |
||
201 |
(FileDescriptor::boolean valid ()) |
|
202 |
(FileDescriptor::void sync ()) |
|
203 |
X (FileDescriptor::java.io.FileDescriptor initSystemFD (java.io.FileDescriptor int)) |
|
204 |
||
205 |
X (Object::java.lang.Class getClass ()) |
|
206 |
X (Object::int hashCode ()) |
|
207 |
X (Object::java.lang.Object clone ()) |
|
208 |
X (Object::void notify ()) |
|
209 |
X (Object::void notifyAll ()) |
|
210 |
X (Object::void wait (long)) |
|
211 |
||
212 |
X (FileOutputStream::void open (java.lang.String)) |
|
342 | 213 |
X (FileOutputStream::void openAppend (java.lang.String)) |
261 | 214 |
X (FileOutputStream::void write (int)) |
215 |
X (FileOutputStream::void writeBytes (byte[] int int)) |
|
216 |
X (FileOutputStream::void close ()) |
|
217 |
X (FileInputStream::void open (java.lang.String)) |
|
218 |
X (FileInputStream::int read ()) |
|
219 |
X (FileInputStream::int readBytes (byte[] int int)) |
|
220 |
(FileInputStream::long skip (long)) |
|
221 |
X (FileInputStream::int available ()) |
|
222 |
X (FileInputStream::void close ()) |
|
223 |
||
224 |
(VM::int getState ()) |
|
225 |
(VM::boolean threadsSuspended ()) |
|
226 |
(VM::void unsuspendThreads ()) |
|
227 |
(VM::void unsuspendSomeThreads ()) |
|
228 |
||
229 |
X (File::boolean exists0 ()) |
|
342 | 230 |
X (File::boolean canWrite0 ()) |
261 | 231 |
X (File::boolean canRead0 ()) |
232 |
X (File::boolean isFile0 ()) |
|
233 |
X (File::boolean isDirectory0 ()) |
|
342 | 234 |
X (File::long lastModified0 ()) |
261 | 235 |
X (File::long length0 ()) |
342 | 236 |
X (File::boolean mkdir0 ()) |
494 | 237 |
X (File::boolean renameTo0 (java.io.File)) |
238 |
X (File::boolean delete0 ()) |
|
261 | 239 |
(File::boolean rmdir0 ()) |
240 |
X (File::java.lang.String[] list0 ()) |
|
241 |
(File::java.lang.String canonPath (java.lang.String)) |
|
242 |
X (File::boolean isAbsolute ()) |
|
243 |
||
244 |
(ObjectOutputStream::void outputClassFields (java.lang.Object java.lang.Class int[])) |
|
245 |
(ObjectOutputStream::boolean invokeObjectWriter (java.lang.Object java.lang.Class)) |
|
246 |
||
247 |
X (Throwable::void printStackTrace0 (java.lang.Object)) |
|
248 |
X (Throwable::java.lang.Throwable fillInStackTrace ()) |
|
249 |
||
250 |
X (Double::long doubleToLongBits (double)) |
|
251 |
X (Double::double longBitsToDouble (long)) |
|
252 |
X (Double::double valueOf0 (java.lang.String)) |
|
253 |
||
254 |
X (Runtime::void exitInternal (int)) |
|
494 | 255 |
o (Runtime::void runFinalizersOnExit0 (boolean)) |
261 | 256 |
o (Runtime::java.lang.Process execInternal (java.lang.String[] java.lang.String[])) |
257 |
X (Runtime::long freeMemory ()) |
|
258 |
X (Runtime::long totalMemory ()) |
|
259 |
X (Runtime::void gc ()) |
|
260 |
(Runtime::void runFinalization ()) |
|
261 |
(Runtime::void traceInstructions (boolean)) |
|
262 |
(Runtime::void traceMethodCalls (boolean)) |
|
263 |
X (Runtime::java.lang.String initializeLinkerInternal ()) |
|
264 |
X (Runtime::java.lang.String buildLibName (java.lang.String java.lang.String)) |
|
265 |
X (Runtime::int loadFileInternal (java.lang.String)) |
|
266 |
||
267 |
(WDrawingSurfaceInfo::int lock ()) |
|
268 |
(WDrawingSurfaceInfo::void unlock ()) |
|
269 |
(WDrawingSurfaceInfo::int getHWnd ()) |
|
270 |
(WDrawingSurfaceInfo::int getHBitmap ()) |
|
271 |
(WDrawingSurfaceInfo::int getPBits ()) |
|
272 |
(WDrawingSurfaceInfo::int getHDC ()) |
|
273 |
(WDrawingSurfaceInfo::int getDepth ()) |
|
274 |
(WDrawingSurfaceInfo::int getHPalette ()) |
|
275 |
||
276 |
X (WDefaultFontCharset::boolean canConvert (char)) |
|
277 |
||
278 |
(ColorModel::void deletepData ()) |
|
279 |
X (WToolkit::void init (java.lang.Thread)) |
|
280 |
X (WToolkit::void eventLoop ()) |
|
281 |
(WToolkit::java.awt.image.ColorModel makeColorModel ()) |
|
342 | 282 |
X (WToolkit::int getScreenResolution ()) |
261 | 283 |
X (WToolkit::int getScreenWidth ()) |
284 |
X (WToolkit::int getScreenHeight ()) |
|
285 |
(WToolkit::void sync ()) |
|
494 | 286 |
* (WToolkit::void beep ()) |
261 | 287 |
X (WToolkit::void loadSystemColors (int[])) |
288 |
||
289 |
(WPrintJob::void end ()) |
|
290 |
||
291 |
X (WDialogPeer::void create (sun.awt.windows.WComponentPeer)) |
|
292 |
X (WDialogPeer::void _show ()) |
|
293 |
X (WDialogPeer::void _hide ()) |
|
294 |
||
342 | 295 |
X (WWindowPeer::void toFront ()) |
296 |
X (WWindowPeer::void toBack ()) |
|
297 |
X (WWindowPeer::void _setTitle (java.lang.String)) |
|
298 |
X (WWindowPeer::void _setResizable (boolean)) |
|
494 | 299 |
X (WWindowPeer::void create (sun.awt.windows.WComponentPeer)) |
342 | 300 |
o (WWindowPeer::void updateInsets (java.awt.Insets)) |
261 | 301 |
(WWindowPeer::java.awt.Component getContainerElement (java.awt.Container int)) |
302 |
||
303 |
X (WCanvasPeer::void create (sun.awt.windows.WComponentPeer)) |
|
304 |
||
305 |
X (WTextAreaPeer::void create (sun.awt.windows.WComponentPeer)) |
|
306 |
X (WTextAreaPeer::void insertText (java.lang.String int)) |
|
307 |
(WTextAreaPeer::void replaceText (java.lang.String int int)) |
|
308 |
||
309 |
X (WTextComponentPeer::java.lang.String getText ()) |
|
310 |
X (WTextComponentPeer::void setText (java.lang.String)) |
|
311 |
X (WTextComponentPeer::int getSelectionStart ()) |
|
312 |
X (WTextComponentPeer::int getSelectionEnd ()) |
|
313 |
X (WTextComponentPeer::void select (int int)) |
|
314 |
X (WTextComponentPeer::void enableEditing (boolean)) |
|
315 |
||
316 |
X (WComponentPeer::void show ()) |
|
317 |
X (WComponentPeer::void hide ()) |
|
318 |
X (WComponentPeer::void enable ()) |
|
319 |
X (WComponentPeer::void disable ()) |
|
494 | 320 |
X (WComponentPeer::java.awt.Point getLocationOnScreen ()) |
261 | 321 |
X (WComponentPeer::void reshape (int int int int)) |
322 |
o (WComponentPeer::void handleEvent (java.awt.AWTEvent)) |
|
323 |
o (WComponentPeer::void _dispose ()) |
|
324 |
X (WComponentPeer::void _setForeground (int)) |
|
325 |
X (WComponentPeer::void _setBackground (int)) |
|
326 |
o (WComponentPeer::void setFont (java.awt.Font)) |
|
327 |
o (WComponentPeer::void requestFocus ()) |
|
328 |
o (WComponentPeer::void setCursor (java.awt.Cursor)) |
|
329 |
o (WComponentPeer::void start ()) |
|
330 |
(WComponentPeer::void _beginValidate ()) |
|
331 |
(WComponentPeer::void endValidate ()) |
|
332 |
o (WComponentPeer::void setZOrderPosition (sun.awt.windows.WComponentPeer)) |
|
333 |
||
334 |
X (WFramePeer::void setMenuBar0 (sun.awt.windows.WMenuBarPeer)) |
|
335 |
X (WFramePeer::void create (sun.awt.windows.WComponentPeer)) |
|
342 | 336 |
X (WFramePeer::void _setIconImage (sun.awt.image.ImageRepresentation)) |
261 | 337 |
|
338 |
o (WFontMetrics::boolean needsConversion (java.awt.Font sun.awt.FontDescriptor)) |
|
339 |
o (WFontMetrics::int getMFCharSegmentWidth (java.awt.Font sun.awt.FontDescriptor boolean char[] int int byte[] int)) |
|
340 |
(WFontMetrics::int bytesWidth (byte[] int int)) |
|
341 |
(WFontMetrics::void init ()) |
|
342 |
||
343 |
o (WChoicePeer::void select (int)) |
|
344 |
o (WChoicePeer::void remove (int)) |
|
345 |
o (WChoicePeer::void addItem (java.lang.String int)) |
|
346 |
X (WChoicePeer::void reshape (int int int int)) |
|
347 |
X (WChoicePeer::void create (sun.awt.windows.WComponentPeer)) |
|
348 |
||
349 |
X (WLabelPeer::void setText (java.lang.String)) |
|
350 |
o (WLabelPeer::void setAlignment (int)) |
|
351 |
X (WLabelPeer::void create (sun.awt.windows.WComponentPeer)) |
|
352 |
||
353 |
X (WMenuItemPeer::void _setLabel (java.lang.String)) |
|
354 |
X (WMenuItemPeer::void create (sun.awt.windows.WMenuPeer)) |
|
355 |
X (WMenuItemPeer::void enable (boolean)) |
|
342 | 356 |
o (WMenuItemPeer::void _dispose ()) |
261 | 357 |
(WMenuPeer::void addSeparator ()) |
358 |
(WMenuPeer::void delItem (int)) |
|
359 |
X (WMenuPeer::void createMenu (sun.awt.windows.WMenuBarPeer)) |
|
360 |
(WMenuPeer::void createSubMenu (sun.awt.windows.WMenuPeer)) |
|
361 |
||
362 |
(WPopupMenuPeer::void createMenu (sun.awt.windows.WComponentPeer)) |
|
363 |
(WPopupMenuPeer::void _show (java.awt.Event)) |
|
364 |
(WMenuBarPeer::void addMenu (java.awt.Menu)) |
|
365 |
(WMenuBarPeer::void delMenu (int)) |
|
366 |
X (WMenuBarPeer::void create (sun.awt.windows.WFramePeer)) |
|
367 |
||
368 |
(WCheckboxMenuItemPeer::void setState (boolean)) |
|
369 |
||
370 |
X (WFileDialogPeer::void show ()) |
|
371 |
||
372 |
X (WCheckboxPeer::void setState (boolean)) |
|
373 |
X (WCheckboxPeer::void setCheckboxGroup (java.awt.CheckboxGroup)) |
|
374 |
(WCheckboxPeer::void setLabel (java.lang.String)) |
|
375 |
X (WCheckboxPeer::void create (sun.awt.windows.WComponentPeer)) |
|
376 |
||
377 |
X (WClipboard::void init ()) |
|
378 |
(WClipboard::void setClipboardText (java.awt.datatransfer.StringSelection)) |
|
379 |
(WClipboard::java.lang.String getClipboardText ()) |
|
380 |
||
342 | 381 |
X (WListPeer::void addItem (java.lang.String int)) |
382 |
X (WListPeer::void delItems (int int)) |
|
383 |
X (WListPeer::void select (int)) |
|
261 | 384 |
(WListPeer::void deselect (int)) |
385 |
(WListPeer::void makeVisible (int)) |
|
342 | 386 |
X (WListPeer::void setMultipleSelections (boolean)) |
387 |
X (WListPeer::void create (sun.awt.windows.WComponentPeer)) |
|
388 |
X (WListPeer::boolean isSelected (int)) |
|
389 |
||
390 |
x (WScrollbarPeer::void _setValues (int int int int)) |
|
391 |
x (WScrollbarPeer::void setLineIncrement (int)) |
|
392 |
x (WScrollbarPeer::void setPageIncrement (int)) |
|
393 |
x (WScrollbarPeer::void create (sun.awt.windows.WComponentPeer)) |
|
394 |
||
395 |
x (ImageRepresentation::void offscreenInit (java.awt.Color)) |
|
261 | 396 |
x (ImageRepresentation::boolean setBytePixels (int int int int java.awt.image.ColorModel byte[] int int)) |
342 | 397 |
x (ImageRepresentation::boolean setIntPixels (int int int int java.awt.image.ColorModel int[] int int)) |
261 | 398 |
x (ImageRepresentation::boolean finish (boolean)) |
399 |
X (ImageRepresentation::void imageDraw (java.awt.Graphics int int java.awt.Color)) |
|
400 |
x (ImageRepresentation::void imageStretch (java.awt.Graphics int int int int int int int int java.awt.Color)) |
|
401 |
x (ImageRepresentation::void disposeImage ()) |
|
402 |
||
403 |
X (WTextFieldPeer::void create (sun.awt.windows.WComponentPeer)) |
|
342 | 404 |
X (WTextFieldPeer::void setEchoCharacter (char)) |
405 |
||
406 |
X (WScrollPanePeer::void create (sun.awt.windows.WComponentPeer)) |
|
407 |
o (WScrollPanePeer::int getOffset (int)) |
|
261 | 408 |
(WScrollPanePeer::void setInsets ()) |
409 |
(WScrollPanePeer::void setScrollPosition (int int)) |
|
342 | 410 |
x (WScrollPanePeer::int _getHScrollbarHeight ()) |
411 |
x (WScrollPanePeer::int _getVScrollbarWidth ()) |
|
412 |
o (WScrollPanePeer::void setSpans (int int int int)) |
|
261 | 413 |
(WScrollPanePeer::java.awt.Component getScrollChild ()) |
414 |
||
415 |
(WEmbeddedFramePeer::void create (sun.awt.windows.WComponentPeer)) |
|
342 | 416 |
X (WButtonPeer::void setLabel (java.lang.String)) |
261 | 417 |
X (WButtonPeer::void create (sun.awt.windows.WComponentPeer)) |
418 |
||
419 |
x (WColor::java.awt.Color getDefaultColor (int)) |
|
420 |
||
421 |
x (GifImageDecoder::boolean parseImage (int int int int boolean int byte[] byte[] java.awt.image.IndexColorModel)) |
|
422 |
||
423 |
x (WGraphics::void createFromComponent (sun.awt.windows.WComponentPeer)) |
|
424 |
x (WGraphics::void createFromGraphics (sun.awt.windows.WGraphics)) |
|
425 |
(WGraphics::void createFromPrintJob (sun.awt.windows.WPrintJob)) |
|
426 |
(WGraphics::void createFromHDC (int)) |
|
427 |
x (WGraphics::void imageCreate (sun.awt.image.ImageRepresentation)) |
|
428 |
x (WGraphics::void pSetFont (java.awt.Font)) |
|
429 |
X (WGraphics::void pSetForeground (int)) |
|
430 |
(WGraphics::void _dispose ()) |
|
431 |
x (WGraphics::void dispose ()) |
|
432 |
x (WGraphics::void setPaintMode ()) |
|
342 | 433 |
x (WGraphics::void setXORMode (java.awt.Color)) |
261 | 434 |
o (WGraphics::java.awt.Rectangle getClipBounds ()) |
435 |
o (WGraphics::void changeClip (int int int int boolean)) |
|
436 |
(WGraphics::void removeClip ()) |
|
437 |
X (WGraphics::void clearRect (int int int int)) |
|
438 |
X (WGraphics::void fillRect (int int int int)) |
|
439 |
X (WGraphics::void drawRect (int int int int)) |
|
440 |
(WGraphics::void drawSFChars (char[] int int int int)) |
|
441 |
x (WGraphics::int drawMFCharsSegment (java.awt.Font sun.awt.FontDescriptor char[] int int int int)) |
|
442 |
(WGraphics::int drawMFCharsConvertedSegment (java.awt.Font sun.awt.FontDescriptor byte[] int int int)) |
|
443 |
(WGraphics::void drawBytes (byte[] int int int int)) |
|
444 |
X (WGraphics::void drawLine (int int int int)) |
|
342 | 445 |
X (WGraphics::void copyArea (int int int int int int)) |
261 | 446 |
o (WGraphics::void drawRoundRect (int int int int int int)) |
447 |
o (WGraphics::void fillRoundRect (int int int int int int)) |
|
448 |
X (WGraphics::void drawPolygon (int[] int[] int)) |
|
449 |
(WGraphics::void drawPolyline (int[] int[] int)) |
|
450 |
X (WGraphics::void fillPolygon (int[] int[] int)) |
|
451 |
x (WGraphics::void drawOval (int int int int)) |
|
452 |
x (WGraphics::void fillOval (int int int int)) |
|
453 |
x (WGraphics::void drawArc (int int int int int int)) |
|
454 |
x (WGraphics::void fillArc (int int int int int int)) |
|
455 |
(WGraphics::void print (sun.awt.windows.WComponentPeer)) |
|
456 |
(WGraphics::void close (sun.awt.windows.WPrintJob)) |
|
457 |
(JPEGImageDecoder::void readImage (java.io.InputStream byte[])) |
|
342 | 458 |
o (OffScreenImageSource::void sendPixels ()) |
457 | 459 |
|
460 |
||
461 |
additional native methods added by microsoft (sigh): |
|
462 |
||
463 |
X (java.lang.String::boolean equals (java.lang.String)) |
|
464 |
X (java.lang.String::int length (java.lang.String)) |
|
465 |
o (java.lang.Runtime::void setInputStreamLocalised (java.io.DataInputStream)) |
|
466 |
o (java.lang.Runtime::void setOutputStreamLocalised (java.io.DataOutputStream)) |
|
467 |
||
468 |
(java.lang.String::int compareTo (java.lang.String)) |
|
469 |
(java.lang.String::boolean equalsIgnoreCase (java.lang.String)) |
|
470 |
(java.lang.String::int indexOf (java.lang.String int)) |
|
471 |
(java.lang.String::boolean startsWith (java.lang.String int)) |
|
472 |
(java.lang.String::boolean regionMatches (int java.lang.String int int)) |
|
473 |
(java.lang.String::boolean regionMatches (boolean int java.lang.String int int)) |
|
474 |
(java.lang.String::int lastIndexOf (java.lang.String int)) |
|
475 |
(java.lang.ClassLoader::void resolveClass (java.lang.Class)) |
|
476 |
(java.lang.ClassLoader::java.lang.Class createArrayClass (java.lang.String java.lang.Class)) |
|
477 |
(java.io.PrintStream::boolean isOutputStreamLocalised (java.io.DataOutputStream)) |
|
478 |
(java.lang.Runtime::boolean isOutputStreamLocalised (java.io.DataOutputStream)) |
|
479 |
(java.lang.Runtime::boolean isInputStreamLocalised (java.io.DataInputStream)) |
|
480 |
(java.lang.ThreadGroup::void initMainThreadGroup0 (java.lang.ThreadGroup)) |
|
481 |
(java.lang.System::void validateSecurityManager (java.lang.SecurityManager)) |
|
482 |
(java.lang.Class::java.lang.reflect.Method getMethod2 (int java.lang.String java.lang.String)) |
|
483 |
(java.io.ObjectOutputStream::void invokeDefaultWriteObject (java.lang.Object java.lang.Class)) |
|
484 |
(java.io.ObjectOutputStream::void invokeWriteObject (java.lang.Object java.lang.Class)) |
|
485 |
(java.io.ObjectInputStream::void invokeDefaultReadObject (java.lang.Object java.lang.Class)) |
|
486 |
(java.io.ObjectInputStream::void invokeReadObject (java.lang.Object java.lang.Class)) |
|
487 |
(java.util.TimeZone::java.util.TimeZone getWin32TimeZone ()) |
|
488 |
(java.net.InetAddress::java.lang.Object[] lookupHostByName (java.lang.String)) |
|
489 |
(java.net.InetAddress::java.lang.Object[] lookupHostByAddr (int)) |
|
490 |
(java.io.ObjectStreamClass::void doMismatchedRead (java.io.ObjectInputStream java.lang.Object)) |
|
491 |
(java.io.ObjectStreamClass::long getClassDefinedUID (java.lang.Class)) |
|
492 |
(java.io.ObjectStreamClass::boolean findObjectMethod0 (java.lang.Class int)) |
|
493 |
(java.lang.reflect.Method::java.lang.String getDescriptor ()) |
|
494 |
(java.lang.reflect.Array::void setShort (java.lang.Object int unsigned short)) |
|
495 |
(java.lang.reflect.Array::char getChar (java.lang.Object int)) |
|
496 |
(java.lang.reflect.Array::void setChar (java.lang.Object int char)) |
|
497 |
(java.lang.reflect.Array::void setDouble (java.lang.Object int double)) |
|
498 |
(java.lang.reflect.Array::java.lang.Object get (java.lang.Object int)) |
|
499 |
(java.lang.reflect.Array::void set (java.lang.Object int java.lang.Object)) |
|
500 |
(java.lang.reflect.Array::int getInt (java.lang.Object int)) |
|
501 |
(java.lang.reflect.Array::void setInt (java.lang.Object int int)) |
|
502 |
(java.lang.reflect.Array::java.lang.Object multiNewArray (java.lang.Class int[])) |
|
503 |
(java.lang.reflect.Array::boolean getBoolean (java.lang.Object int)) |
|
504 |
(java.lang.reflect.Array::byte getByte (java.lang.Object int)) |
|
505 |
(java.lang.reflect.Array::float getFloat (java.lang.Object int)) |
|
506 |
(java.lang.reflect.Array::void setBoolean (java.lang.Object int boolean)) |
|
507 |
(java.lang.reflect.Array::long getLong (java.lang.Object int)) |
|
508 |
(java.lang.reflect.Array::void setByte (java.lang.Object int byte)) |
|
509 |
(java.lang.reflect.Array::void setLong (java.lang.Object int long)) |
|
510 |
(java.lang.reflect.Array::void setFloat (java.lang.Object int float)) |
|
511 |
(java.lang.reflect.Array::java.lang.Object newArray (java.lang.Class int)) |
|
512 |
(java.lang.reflect.Array::int getLength (java.lang.Object)) |
|
513 |
(java.lang.reflect.Array::unsigned short getShort (java.lang.Object int)) |
|
514 |
(java.lang.reflect.Array::double getDouble (java.lang.Object int)) |
|
515 |
(java.lang.reflect.Field::void setShort (java.lang.Object unsigned short)) |
|
516 |
(java.lang.reflect.Field::char getChar (java.lang.Object)) |
|
517 |
(java.lang.reflect.Field::void setChar (java.lang.Object char)) |
|
518 |
(java.lang.reflect.Field::void setDouble (java.lang.Object double)) |
|
519 |
(java.lang.reflect.Field::java.lang.Object get (java.lang.Object)) |
|
520 |
(java.lang.reflect.Field::void set (java.lang.Object java.lang.Object)) |
|
521 |
(java.lang.reflect.Field::int getInt (java.lang.Object)) |
|
522 |
(java.lang.reflect.Field::void setInt (java.lang.Object int)) |
|
523 |
(java.lang.reflect.Field::boolean getBoolean (java.lang.Object)) |
|
524 |
(java.lang.reflect.Field::byte getByte (java.lang.Object)) |
|
525 |
(java.lang.reflect.Field::float getFloat (java.lang.Object)) |
|
526 |
(java.lang.reflect.Field::long getLong (java.lang.Object)) |
|
527 |
(java.lang.reflect.Field::void setBoolean (java.lang.Object boolean)) |
|
528 |
(java.lang.reflect.Field::void setByte (java.lang.Object byte)) |
|
529 |
(java.lang.reflect.Field::void setLong (java.lang.Object long)) |
|
530 |
(java.lang.reflect.Field::void setFloat (java.lang.Object float)) |
|
531 |
(java.lang.reflect.Field::int getModifiers ()) |
|
532 |
(java.lang.reflect.Field::unsigned short getShort (java.lang.Object)) |
|
533 |
(java.lang.reflect.Field::double getDouble (java.lang.Object)) |
|
534 |
(java.lang.reflect.Constructor::java.lang.Object newInstance (java.lang.Object[])) |
|
535 |
(java.lang.reflect.Constructor::int getModifiers ()) |
|
536 |
(java.util.zip.Inflater::void setDictionary0 (byte[] int int)) |
|
537 |
(java.util.zip.Inflater::int getTotalIn0 ()) |
|
538 |
(java.util.zip.Inflater::void reset0 ()) |
|
539 |
(java.util.zip.Inflater::void end0 ()) |
|
540 |
(java.util.zip.Inflater::int inflate0 (byte[] int int)) |
|
541 |
(java.util.zip.Inflater::int getTotalOut0 ()) |
|
542 |
(java.util.zip.Inflater::int getAdler0 ()) |
|
543 |
(java.util.zip.CRC32::void update1 (int)) |
|
544 |
(java.util.zip.CRC32::void update (byte[] int int)) |
|
545 |
||
546 |
(com.ms.security.PolicyEngine::boolean isSystemClass (java.lang.String)) |
|
547 |
(com.ms.security.PolicyEngine::void denyPermission (com.ms.security.PermissionID)) |
|
548 |
(com.ms.security.PolicyEngine::void revertPermission (com.ms.security.PermissionID)) |
|
549 |
(com.ms.security.PolicyEngine::void initPolicyEngine ()) |
|
550 |
(com.ms.security.PolicyEngine::java.lang.Class _getClassOfCaller (java.lang.Class[])) |
|
551 |
(com.ms.security.PolicyEngine::void internalCheckClass (java.lang.Class com.ms.security.PermissionID java.lang.Object)) |
|
552 |
(com.ms.security.PolicyEngine::com.ms.security.PermissionDataSet getPermissionsOfClass (java.lang.Class)) |
|
553 |
(com.ms.security.PolicyEngine::void assertPermission (com.ms.security.PermissionID)) |
|
554 |
(com.ms.security.PolicyEngine::void deepCheck (com.ms.security.PermissionID java.lang.Object)) |
|
555 |
(com.ms.security.PolicyEngine::void shallowCheck (com.ms.security.PermissionID java.lang.Object java.lang.Class[] int)) |
|
556 |
(com.ms.security.PolicyEngine::java.security.Principal getPrincipalOfClass (java.lang.Class)) |
|
557 |
(com.ms.security.permissions.ThreadPermission::boolean pDecodeAsn (byte[])) |
|
558 |
(com.ms.security.permissions.ThreadPermission::byte[] pEncodeAsn ()) |
|
559 |
(com.ms.security.permissions.RegistryPermission::boolean pDecodeAsn (byte[])) |
|
560 |
(com.ms.security.permissions.RegistryPermission::byte[] pEncodeAsn ()) |
|
561 |
(com.ms.security.management.ZonePermissions::byte[] pEncodeAsn ()) |
|
562 |
(com.ms.security.management.ZonePermissions::boolean pDecodeAsn (byte[])) |
|
563 |
(com.ms.security.permissions.UIPermission::byte[] pEncodeAsn ()) |
|
564 |
(com.ms.security.permissions.UIPermission::boolean pDecodeAsn (byte[])) |
|
565 |
(com.ms.security.permissions.NetIOPermission::byte[] pEncodeAsn ()) |
|
566 |
(com.ms.security.permissions.NetIOPermission::boolean pDecodeAsn (byte[])) |
|
567 |
(com.ms.security.permissions.ReflectionPermission::byte[] pEncodeAsn ()) |
|
568 |
(com.ms.security.permissions.ReflectionPermission::boolean pDecodeAsn (byte[])) |
|
569 |
(com.ms.vm.WeakReference::void storeRef (int java.lang.Object)) |
|
570 |
(com.ms.vm.WeakReference::int allocRef (java.lang.Object)) |
|
571 |
(com.ms.vm.WeakReference::void freeRef (int)) |
|
572 |
(com.ms.vm.WeakReference::java.lang.Object fetchRef (int)) |
|
573 |
(com.ms.dll.DllLib::void CoTaskMemFree (int)) |
|
574 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int float[] int int)) |
|
575 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int double[] int int)) |
|
576 |
(com.ms.dll.DllLib::int numParamBytes0 (java.lang.reflect.Method)) |
|
577 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int java.lang.Object int int)) |
|
578 |
(com.ms.dll.DllLib::void write2 (java.lang.Object int unsigned short)) |
|
579 |
(com.ms.dll.DllLib::void write2 (int int unsigned short)) |
|
580 |
(com.ms.dll.DllLib::void write2 (java.lang.Object int char)) |
|
581 |
(com.ms.dll.DllLib::void write2 (int int char)) |
|
582 |
(com.ms.dll.DllLib::int GlobalAlloc (int int)) |
|
583 |
(com.ms.dll.DllLib::void resize (java.lang.Object int)) |
|
584 |
(com.ms.dll.DllLib::long read8 (java.lang.Object int)) |
|
585 |
(com.ms.dll.DllLib::long read8 (int int)) |
|
586 |
(com.ms.dll.DllLib::int lstrcpy (java.lang.StringBuffer int)) |
|
587 |
(com.ms.dll.DllLib::int lstrlenA (int)) |
|
588 |
(com.ms.dll.DllLib::int read4 (java.lang.Object int)) |
|
589 |
(com.ms.dll.DllLib::int CoTaskMemAlloc (int)) |
|
590 |
(com.ms.dll.DllLib::void write8 (java.lang.Object int long)) |
|
591 |
(com.ms.dll.DllLib::int sizeOf0 (java.lang.Class)) |
|
592 |
(com.ms.dll.DllLib::int getSystemDefaultCharSize ()) |
|
593 |
(com.ms.dll.DllLib::void write8 (int int long)) |
|
594 |
(com.ms.dll.DllLib::int read4 (int int)) |
|
595 |
(com.ms.dll.DllLib::byte read1 (java.lang.Object int)) |
|
596 |
(com.ms.dll.DllLib::byte read1 (int int)) |
|
597 |
(com.ms.dll.DllLib::int lstrlen (int)) |
|
598 |
(com.ms.dll.DllLib::void CopyMemoryAnsi (int java.lang.String int)) |
|
599 |
(com.ms.dll.DllLib::void CopyMemoryAnsi (java.lang.StringBuffer int int)) |
|
600 |
(com.ms.dll.DllLib::boolean isStruct (java.lang.reflect.Field)) |
|
601 |
(com.ms.dll.DllLib::boolean GlobalFree (int)) |
|
602 |
(com.ms.dll.DllLib::void internalAttemptCopyPtrToStruct (int java.lang.Object int int)) |
|
603 |
(com.ms.dll.DllLib::int getLastError ()) |
|
604 |
(com.ms.dll.DllLib::void write4 (java.lang.Object int int)) |
|
605 |
(com.ms.dll.DllLib::void write4 (int int int)) |
|
606 |
(com.ms.dll.DllLib::unsigned short read2 (java.lang.Object int)) |
|
607 |
(com.ms.dll.DllLib::unsigned short read2 (int int)) |
|
608 |
(com.ms.dll.DllLib::void release (java.lang.Object)) |
|
609 |
(com.ms.dll.DllLib::void write1 (java.lang.Object int byte)) |
|
610 |
(com.ms.dll.DllLib::void write1 (int int byte)) |
|
611 |
(com.ms.dll.DllLib::boolean isStructCls (java.lang.Class)) |
|
612 |
(com.ms.dll.DllLib::void prelink (java.lang.reflect.Method)) |
|
613 |
(com.ms.dll.DllLib::void CopyMemoryUni (int java.lang.String int)) |
|
614 |
(com.ms.dll.DllLib::void CopyMemoryUni (java.lang.StringBuffer int int)) |
|
615 |
(com.ms.dll.DllLib::void internalAttemptCopyStructToPtr (java.lang.Object int int int)) |
|
616 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (int int int int)) |
|
617 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (byte[] int int int)) |
|
618 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (char[] int int int)) |
|
619 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (unsigned short[] int int int)) |
|
620 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (int[] int int int)) |
|
621 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (long[] int int int)) |
|
622 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (float[] int int int)) |
|
623 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (double[] int int int)) |
|
624 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (java.lang.Object int int int)) |
|
625 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int int int int)) |
|
626 |
(com.ms.dll.DllLib::int lstrlenW (int)) |
|
627 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int byte[] int int)) |
|
628 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int char[] int int)) |
|
629 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int unsigned short[] int int)) |
|
630 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int int[] int int)) |
|
631 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int long[] int int)) |
|
632 |
(com.ms.dll.DllLib::int internalGetStructAddr (java.lang.Object)) |
|
633 |
(com.ms.dll.DllLib::int offsetOf (java.lang.reflect.Field)) |
|
634 |
(com.ms.dll.DllLib::int lstrcpy (int java.lang.String)) |
|
635 |
(com.ms.dll.DllLib::int sizeOf (java.lang.Object)) |
|
636 |
(com.ms.lang.RegKey::com.ms.lang.RegKeyEnumValue pRegEnumValue (int)) |
|
637 |
(com.ms.lang.RegKey::java.lang.String pRegQueryStringValue (java.lang.String)) |
|
638 |
(com.ms.lang.RegKey::byte[] pRegQueryBinaryValue (java.lang.String)) |
|
639 |
(com.ms.lang.RegKey::int pRegQueryIntValue (java.lang.String)) |
|
640 |
(com.ms.lang.RegKey::void pRegSetStringValue (java.lang.String java.lang.String)) |
|
641 |
(com.ms.lang.RegKey::void pRegSetIntValue (java.lang.String int)) |
|
642 |
(com.ms.lang.RegKey::void pRegSetBinaryValue (java.lang.String byte[])) |
|
643 |
(com.ms.lang.RegKey::void pRegDeleteValue (java.lang.String)) |
|
644 |
(com.ms.lang.RegKey::void pRegFlushKey ()) |
|
645 |
(com.ms.lang.RegKey::void pRegDeleteKey (java.lang.String)) |
|
646 |
(com.ms.lang.RegKey::void pRegOpenBaseKey (int)) |
|
647 |
(com.ms.lang.RegKey::void pRegOpenKey (com.ms.lang.RegKey java.lang.String int)) |
|
648 |
(com.ms.lang.RegKey::int pRegQueryInfoKey (com.ms.lang.RegQueryInfo)) |
|
649 |
(com.ms.lang.RegKey::void pRegUnLoadKey (java.lang.String)) |
|
650 |
(com.ms.lang.RegKey::void pRegCreateKey (com.ms.lang.RegKey java.lang.String)) |
|
651 |
(com.ms.lang.RegKey::void pRegRestoreKey (java.lang.String boolean)) |
|
652 |
(com.ms.lang.RegKey::void pRegLoadKey (java.lang.String java.lang.String)) |
|
653 |
(com.ms.lang.RegKey::void pRegCloseKey ()) |
|
654 |
(com.ms.lang.RegKey::java.lang.String pRegEnumKey (int)) |
|
655 |
(com.ms.lang.RegKey::void pRegReplaceKey (java.lang.String java.lang.String java.lang.String)) |
|
656 |
(com.ms.awt.peer.NativeServices::int pGetKeyboardLayouts (int[] int)) |
|
657 |
(com.ms.awt.peer.NativeServices::void jpegReadByte (com.ms.awt.peer.IjpegDecoderCallback byte[] int com.ms.awt.peer.jpegInfoHeader byte[] int)) |
|
658 |
(com.ms.awt.peer.NativeServices::int getColourDataDepth ()) |
|
659 |
(com.ms.awt.peer.NativeServices::java.lang.String pGetFontEnumeratedFamily (int)) |
|
660 |
(com.ms.awt.peer.NativeServices::int pNewFontEnumeration ()) |
|
661 |
(com.ms.awt.peer.NativeServices::int getScreenClipRgn (int)) |
|
662 |
(com.ms.awt.peer.NativeServices::int pSetKeyboardLayout (int int)) |
|
663 |
(com.ms.awt.peer.NativeServices::void ClipboardInit (com.ms.awt.peer.IToolkit)) |
|
664 |
(com.ms.awt.peer.NativeServices::void getDeviceCaps (int int[] int)) |
|
665 |
(com.ms.awt.peer.NativeServices::void getAfcMetrics (int[])) |
|
666 |
(com.ms.awt.peer.NativeServices::void setUserLocale (int int)) |
|
667 |
(com.ms.awt.peer.NativeServices::void getDCDI (com.ms.awt.peer.DirectColourDataInfo)) |
|
668 |
(com.ms.awt.peer.NativeServices::int pGetNumKeyboardLayouts ()) |
|
669 |
(com.ms.awt.peer.NativeServices::void getIndexedColours (byte[] byte[] byte[])) |
|
670 |
(com.ms.awt.peer.NativeServices::int getNativeFont (java.lang.String int int int)) |
|
671 |
(com.ms.awt.peer.NativeServices::int pGetKeyboardLayout ()) |
|
672 |
(com.ms.awt.peer.NativeServices::int getSystemLCID ()) |
|
673 |
(com.ms.awt.peer.NativeServices::void caretSetPos (int int int)) |
|
674 |
(com.ms.awt.peer.NativeServices::java.lang.String getLogFontFromIUnknown (com.ms.com.IUnknown com.ms.awt.peer.LogFontX)) |
|
675 |
(com.ms.awt.peer.NativeServices::java.lang.String ClipboardGetText ()) |
|
676 |
(com.ms.awt.peer.NativeServices::int systemMetric (int)) |
|
677 |
(com.ms.awt.peer.NativeServices::void jpegInit (com.ms.awt.peer.IjpegDecoderCallback byte[] int com.ms.awt.peer.jpegInfoHeader)) |
|
678 |
(com.ms.awt.peer.NativeServices::void caretHide (int)) |
|
679 |
(com.ms.awt.peer.NativeServices::int chooseColor (int int)) |
|
680 |
(com.ms.awt.peer.NativeServices::java.lang.String pGetKeyboardLayoutName (int)) |
|
681 |
(com.ms.awt.peer.NativeServices::int matchFontAndLanguage (int int)) |
|
682 |
(com.ms.awt.peer.NativeServices::java.lang.String chooseFont (com.ms.awt.peer.LogFontX java.lang.String int)) |
|
683 |
(com.ms.awt.peer.NativeServices::java.lang.String getSystemFont (int com.ms.awt.peer.LogFontX)) |
|
684 |
(com.ms.awt.peer.NativeServices::com.ms.com.IUnknown getIUnknownFromLogFont (java.lang.String com.ms.awt.peer.LogFontX)) |
|
685 |
(com.ms.awt.peer.NativeServices::void caretDispose (int)) |
|
686 |
(com.ms.awt.peer.NativeServices::void caretShow (int)) |
|
687 |
(com.ms.awt.peer.NativeServices::void deleteObject (int)) |
|
688 |
(com.ms.awt.peer.NativeServices::void setDebugOutput (com.ms.awt.peer.COMPrintCallback)) |
|
689 |
(com.ms.awt.peer.NativeServices::void jpegReadInt (com.ms.awt.peer.IjpegDecoderCallback byte[] int com.ms.awt.peer.jpegInfoHeader int[] int)) |
|
690 |
(com.ms.awt.peer.NativeServices::int getSystemColourValue (int)) |
|
691 |
(com.ms.awt.peer.NativeServices::void caretCreate (int int int)) |
|
692 |
(com.ms.awt.peer.NativeServices::void ClipboardSetText (java.lang.String)) |
|
693 |
(com.ms.awt.peer.NativeServices::void println (java.lang.String)) |
|
694 |
(com.ms.security.SecurityClassLoader::boolean getSecureState ()) |
|
695 |
(com.ms.security.SecurityClassLoader::void setSecureState (java.lang.String java.lang.String)) |
|
696 |
(com.ms.security.SecurityClassLoader::java.lang.Class internalDefineClass (java.lang.String byte[] int int)) |
|
697 |
(com.ms.security.SecurityClassLoader::void markClass (java.lang.Class com.ms.security.PermissionSet java.security.Principal)) |
|
698 |
(com.ms.security.SecurityClassLoader::java.util.Hashtable getHashTable ()) |
|
699 |
(com.ms.security.auditing.SecurityAuditor::boolean isThreadAuditingEnabled ()) |
|
700 |
(com.ms.security.auditing.SecurityAuditor::void disableThreadAuditing ()) |
|
701 |
(com.ms.security.auditing.SecurityAuditor::void enableThreadAuditing ()) |
|
702 |
(com.ms.security.auditing.SecurityAuditor::void initSecurityAuditor ()) |
|
703 |
(com.ms.security.PermissionDataSet::byte[] pEncodeAsn ()) |
|
704 |
(com.ms.security.PermissionDataSet::boolean pDecodeAsn (byte[])) |
|
705 |
(com.ms.lang.SystemX::int pAnsiToUnicode (byte[] char[] int int int)) |
|
706 |
(com.ms.lang.SystemX::int pQueryUnicodeToAnsi (char[] int int int)) |
|
707 |
(com.ms.lang.SystemX::void gc ()) |
|
708 |
(com.ms.lang.SystemX::boolean arrayCompare (java.lang.Object[] int java.lang.Object[] int int)) |
|
709 |
(com.ms.lang.SystemX::int pUnicodeToAnsi (char[] byte[] int int int)) |
|
710 |
(com.ms.lang.SystemX::boolean isLocalCharDBCSLeadByte (byte)) |
|
711 |
(com.ms.lang.SystemX::int pQueryAnsiToUnicode (byte[] int int int)) |
|
712 |
(com.ms.lang.SystemX::boolean isBaseDBCS ()) |
|
713 |
(com.ms.packagemanager.JavaPackage::byte[] nativeGetSigner (java.lang.Object)) |
|
714 |
(com.ms.packagemanager.JavaPackage::byte[] nativeGetCapabilities (java.lang.Object)) |
|
715 |
(com.ms.com._Guid::void IIDFromString (java.lang.String com.ms.com._Guid)) |
|
716 |
(com.ms.com._Guid::java.lang.String StringFromIID (com.ms.com._Guid)) |
|
717 |
(com.ms.security.auditing.PrintStreamAuditor::int GetModuleHandle (java.lang.String)) |
|
718 |
(com.ms.security.auditing.PrintStreamAuditor::int FormatMessage (int int int int java.lang.StringBuffer int int[])) |
|
719 |
(com.ms.security.permissions.CustomPermission::byte[] pEncodeAsn ()) |
|
720 |
(com.ms.security.permissions.CustomPermission::boolean pDecodeAsn (byte[])) |
|
721 |
(com.ms.security.permissions.X509Signer::boolean pLoad (byte[])) |
|
722 |
(com.ms.packagemanager.PackageManager::java.lang.Class nativeFindClassInNamespace (java.lang.String java.lang.String java.lang.ClassLoader)) |
|
723 |
(com.ms.packagemanager.PackageManager::java.lang.Object nativeGetPackage (java.lang.String java.lang.String)) |
|
724 |
(com.ms.packagemanager.PackageManager::java.lang.String[] nativeGetBeansList ()) |
|
725 |
(com.ms.packagemanager.PackageManager::com.ms.com.IStream nativeGetFileIStream (java.lang.String java.lang.String)) |
|
726 |
(com.ms.packagemanager.PackageManager::java.lang.Class nativeFindClass (java.lang.String java.lang.String java.lang.ClassLoader)) |
|
727 |
(com.ms.security.permissions.UserFileIOPermission::byte[] pEncodeAsn ()) |
|
728 |
(com.ms.security.permissions.UserFileIOPermission::boolean pDecodeAsn (byte[])) |
|
729 |
(com.ms.security.permissions.PropertyPermission::byte[] pEncodeAsn ()) |
|
730 |
(com.ms.security.permissions.PropertyPermission::boolean pDecodeAsn (byte[])) |
|
731 |
(com.ms.security.permissions.ClientStoragePermission::byte[] pEncodeAsn ()) |
|
732 |
(com.ms.security.permissions.ClientStoragePermission::boolean pDecodeAsn (byte[])) |
|
733 |
(com.ms.security.permissions.ExecutionPermission::byte[] pEncodeAsn ()) |
|
734 |
(com.ms.security.permissions.ExecutionPermission::boolean pDecodeAsn (byte[])) |
|
735 |
(com.ms.util.EventLog::boolean DeregisterEventSource (int)) |
|
736 |
(com.ms.util.EventLog::void reportEvent0 (unsigned short unsigned short int java.lang.String[] byte[])) |
|
737 |
(com.ms.util.EventLog::int RegisterEventSource (java.lang.String java.lang.String)) |
|
738 |
(com.ms.applet.BrowserAppletFrame::void signalViewChange (int)) |
|
739 |
(com.ms.applet.BrowserAppletFrame::java.lang.Object newInstance (int java.lang.Class boolean com.ms.security.PermissionSet)) |
|
740 |
(com.ms.applet.BrowserAppletFrame::void showSystemStatus (int int boolean java.lang.String)) |
|
741 |
(com.ms.applet.BrowserAppletFrame::com.ms.security.management.SecurityPolicy getSecurityPolicy0 (int java.lang.String)) |
|
742 |
(com.ms.applet.BrowserAppletFrame::void setDownloadState (int boolean)) |
|
743 |
(com.ms.applet.BrowserAppletFrame::int GetSystemDefaultLCID ()) |
|
744 |
(com.ms.applet.BrowserAppletFrame::void requestResize (int int int)) |
|
745 |
(com.ms.applet.BrowserAppletFrame::void signalObjectLoadDone (int boolean)) |
|
746 |
(com.ms.applet.BrowserAppletFrame::com.ms.applet.BrowserAppletFrame findOfflineContext ()) |
|
747 |
(com.ms.applet.BrowserAppletFrame::void showStatus0 (int java.lang.String)) |
|
748 |
(com.ms.applet.BrowserAppletFrame::boolean checkGlobalOfflineMode0 ()) |
|
749 |
(com.ms.applet.BrowserAppletFrame::void showDocument0 (int java.lang.String java.lang.String)) |
|
750 |
(com.ms.security.permissions.SystemStreamsPermission::byte[] pEncodeAsn ()) |
|
751 |
(com.ms.security.permissions.SystemStreamsPermission::boolean pDecodeAsn (byte[])) |
|
752 |
(com.ms.security.permissions.FileIOPermission::byte[] pEncodeAsn ()) |
|
753 |
(com.ms.security.permissions.FileIOPermission::boolean pDecodeAsn (byte[])) |
|
754 |
(com.ms.com.ComLib::int newGCHandle (java.lang.Object)) |
|
755 |
(com.ms.com.ComLib::java.lang.Object derefGCHandle (int)) |
|
756 |
(com.ms.com.ComLib::void dprinthelper (char[])) |
|
757 |
(com.ms.com.ComLib::void release (java.lang.Object)) |
|
758 |
(com.ms.com.ComLib::int jcdwClassSizeOf (java.lang.Class)) |
|
759 |
(com.ms.com.ComLib::int jcdwOffsetOf (java.lang.Object java.lang.String)) |
|
760 |
(com.ms.com.ComLib::int jcdwClassOffsetOf (java.lang.Class java.lang.String)) |
|
761 |
(com.ms.com.ComLib::boolean isJavaOwned (java.lang.Object)) |
|
762 |
(com.ms.com.ComLib::void brk (java.lang.Object)) |
|
763 |
(com.ms.com.ComLib::void setDataWrapperSize (java.lang.Object int)) |
|
764 |
(com.ms.com.ComLib::void brk (int)) |
|
765 |
(com.ms.com.ComLib::void setJCDWHomeThread (java.lang.Object java.lang.Object)) |
|
766 |
(com.ms.com.ComLib::void propagateOwnership (java.lang.Object int)) |
|
767 |
(com.ms.com.ComLib::void threadStartMTA (java.lang.Thread)) |
|
768 |
(com.ms.com.ComLib::void IENVNextMarshalerJ2C (int)) |
|
769 |
(com.ms.com.ComLib::boolean supportsInterface (java.lang.Object com.ms.com._Guid)) |
|
770 |
(com.ms.com.ComLib::java.lang.Object ptrToStruct (java.lang.Class int)) |
|
771 |
(com.ms.com.ComLib::int jcdwSizeOf (java.lang.Object)) |
|
772 |
(com.ms.com.ComLib::void declareMessagePumpThread ()) |
|
773 |
(com.ms.com.ComLib::void IENVNextMarshalerC2J (int)) |
|
774 |
(com.ms.com.ComLib::void freeGCHandle (int)) |
|
775 |
(com.ms.com.ComLib::boolean isEqualUnknown (java.lang.Object java.lang.Object)) |
|
776 |
(com.ms.com.Dispatch::boolean NIsArray (java.lang.Object)) |
|
777 |
(com.ms.com.Dispatch::java.lang.String NInvokeReal (java.lang.Object com.ms.com._Guid java.lang.String int int int int com.ms.com.Variant[] com.ms.com.Variant[] int[])) |
|
778 |
(com.ms.com.Dispatch::void NGetIDsOfNamesReal (java.lang.Object com.ms.com._Guid int java.lang.String[] int[])) |
|
779 |
(com.ms.com.ComException::int FormatMessage (int int int int java.lang.StringBuffer int int[])) |
|
780 |
(com.ms.com.Variant::int toInt ()) |
|
781 |
(com.ms.com.Variant::double toDate ()) |
|
782 |
(com.ms.com.Variant::boolean toBoolean ()) |
|
783 |
(com.ms.com.Variant::double toDouble ()) |
|
784 |
(com.ms.com.Variant::long toCurrency ()) |
|
785 |
(com.ms.com.Variant::void putVariantArray (com.ms.com.Variant[])) |
|
786 |
(com.ms.com.Variant::com.ms.com.Variant[] getVariantArray ()) |
|
787 |
(com.ms.com.Variant::void putByteArray (java.lang.Object)) |
|
788 |
(com.ms.com.Variant::void putShortRef (unsigned short)) |
|
789 |
(com.ms.com.Variant::void putIntRef (int)) |
|
790 |
(com.ms.com.Variant::void putDoubleRef (double)) |
|
791 |
(com.ms.com.Variant::void putDateRef (double)) |
|
792 |
(com.ms.com.Variant::void putStringRef (java.lang.String)) |
|
793 |
(com.ms.com.Variant::unsigned short getShortRef ()) |
|
794 |
(com.ms.com.Variant::int getIntRef ()) |
|
795 |
(com.ms.com.Variant::double getDoubleRef ()) |
|
796 |
(com.ms.com.Variant::double getDateRef ()) |
|
797 |
(com.ms.com.Variant::java.lang.String getStringRef ()) |
|
798 |
(com.ms.com.Variant::java.lang.String internalToString ()) |
|
799 |
(com.ms.com.Variant::void initSafeArrayByRef (com.ms.com.SafeArray int)) |
|
800 |
(com.ms.com.Variant::java.lang.Object toCharArray ()) |
|
801 |
(com.ms.com.Variant::java.lang.Object toDispatch ()) |
|
802 |
(com.ms.com.Variant::byte toByte ()) |
|
803 |
(com.ms.com.Variant::java.lang.Object getDispatch ()) |
|
804 |
(com.ms.com.Variant::void putDispatch (java.lang.Object)) |
|
805 |
(com.ms.com.Variant::boolean getBoolean ()) |
|
806 |
(com.ms.com.Variant::int toError ()) |
|
807 |
(com.ms.com.Variant::java.lang.Object toObject ()) |
|
808 |
(com.ms.com.Variant::void initSafeArrayByVal (com.ms.com.SafeArray int)) |
|
809 |
(com.ms.com.Variant::java.lang.Object getObject ()) |
|
810 |
(com.ms.com.Variant::void putObject (java.lang.Object)) |
|
811 |
(com.ms.com.Variant::com.ms.com.SafeArray toSafeArrayHelper (java.lang.Class)) |
|
812 |
(com.ms.com.Variant::void putFloatRef (float)) |
|
813 |
(com.ms.com.Variant::void putCurrencyRef (long)) |
|
814 |
(com.ms.com.Variant::void putErrorRef (int)) |
|
815 |
(com.ms.com.Variant::void putBooleanRef (boolean)) |
|
816 |
(com.ms.com.Variant::void putObjectRef (java.lang.Object)) |
|
817 |
(com.ms.com.Variant::void putByteRef (byte)) |
|
818 |
(com.ms.com.Variant::java.lang.String getString ()) |
|
819 |
(com.ms.com.Variant::void putString (java.lang.String)) |
|
820 |
(com.ms.com.Variant::float getFloatRef ()) |
|
821 |
(com.ms.com.Variant::long getCurrencyRef ()) |
|
822 |
(com.ms.com.Variant::int getErrorRef ()) |
|
823 |
(com.ms.com.Variant::boolean getBooleanRef ()) |
|
824 |
(com.ms.com.Variant::java.lang.Object getObjectRef ()) |
|
825 |
(com.ms.com.Variant::byte getByteRef ()) |
|
826 |
(com.ms.com.Variant::float toFloat ()) |
|
827 |
(com.ms.com.Variant::void putCharArray (java.lang.Object)) |
|
828 |
(com.ms.com.Variant::void putDispatchRef (java.lang.Object)) |
|
829 |
(com.ms.com.Variant::java.lang.Object getDispatchRef ()) |
|
830 |
(com.ms.com.Variant::void putVariantArrayRef (com.ms.com.Variant[])) |
|
831 |
(com.ms.com.Variant::com.ms.com.Variant[] getVariantArrayRef ()) |
|
832 |
(com.ms.com.Variant::void changeType (unsigned short)) |
|
833 |
(com.ms.com.Variant::void ncloneIndirect (com.ms.com.Variant)) |
|
834 |
(com.ms.com.Variant::void nFinalize (boolean)) |
|
835 |
(com.ms.com.Variant::void nclone (com.ms.com.Variant)) |
|
836 |
(com.ms.com.Variant::unsigned short toShort ()) |
|
837 |
(com.ms.com.Variant::void putSafeArrayRefHelper (int)) |
|
838 |
(com.ms.com.Variant::com.ms.com.Variant[] toVariantArray ()) |
|
839 |
(com.ms.com.Variant::java.lang.Object toByteArray ()) |
|
840 |
(com.ms.com.Variant::void TrueVariantClear ()) |
|
841 |
(com.ms.awt.WToolkit::boolean MessageBeep (int)) |
|
842 |
(com.ms.applet.AppletPanel::boolean StartCodeDownload (int java.lang.String java.lang.String java.lang.String)) |
|
843 |
(com.ms.applet.AppletPanel::void securedCall0 (int java.lang.Object)) |
|
844 |
(com.ms.applet.AppletPanel::com.ms.security.PermissionSet getDefaultPermissionsFromLoader (com.ms.vm.loader.URLClassLoader)) |
|
845 |
(com.ms.dll.Win32Exception::int FormatMessage (int int int int java.lang.StringBuffer int int[])) |
|
846 |
(com.ms.awt.WGuiCallback::boolean SetEvent (int)) |
|
847 |
(com.ms.awt.WGuiCallback::int CreateSemaphore (int int int int)) |
|
848 |
(com.ms.awt.WGuiCallback::int ReleaseSemaphore (int int int)) |
|
849 |
(com.ms.awt.WGuiCallback::void userYield (boolean)) |
|
850 |
(com.ms.awt.WGuiCallback::int MsgWaitForMultipleObjects (int int[] boolean int int)) |
|
851 |
(com.ms.awt.WGuiCallback::int CreateEvent (int boolean boolean int)) |
|
852 |
(com.ms.activeX.ActiveXToolkit::int GetSysColor (int)) |
|
853 |
(com.ms.awt.peer.NativeGraphics::void setPageDimension (int int)) |
|
854 |
(com.ms.awt.peer.NativeGraphics::void setBkColour (int int)) |
|
855 |
(com.ms.awt.peer.NativeGraphics::void getClipBounds (com.ms.awt.peer.NativeRect int int)) |
|
856 |
(com.ms.awt.peer.NativeGraphics::void pGetCharOutline (int byte[])) |
|
857 |
(com.ms.awt.peer.NativeGraphics::void drawLine (int int int int)) |
|
858 |
(com.ms.awt.peer.NativeGraphics::void setXORMode (int int int int)) |
|
859 |
(com.ms.awt.peer.NativeGraphics::int drawString (java.lang.String int int int int int int int int[] int[])) |
|
860 |
(com.ms.awt.peer.NativeGraphics::int getCoClass ()) |
|
861 |
(com.ms.awt.peer.NativeGraphics::void drawArc (int int int int int int int)) |
|
862 |
(com.ms.awt.peer.NativeGraphics::void getInitialPageDimension (com.ms.awt.peer.NativeRect)) |
|
863 |
(com.ms.awt.peer.NativeGraphics::void setVisRgn (int)) |
|
864 |
(com.ms.awt.peer.NativeGraphics::void pSetForeground (int int)) |
|
865 |
(com.ms.awt.peer.NativeGraphics::int pGetDC ()) |
|
866 |
(com.ms.awt.peer.NativeGraphics::void drawPixels (int[] int int int)) |
|
867 |
(com.ms.awt.peer.NativeGraphics::void drawPolygon (int[] int[] int int int int)) |
|
868 |
(com.ms.awt.peer.NativeGraphics::void createFromImage (com.ms.awt.peer.INativeImage)) |
|
869 |
(com.ms.awt.peer.NativeGraphics::void endPage ()) |
|
870 |
(com.ms.awt.peer.NativeGraphics::int pGetCharOutlineSize (int)) |
|
871 |
(com.ms.awt.peer.NativeGraphics::void pDrawBezier (int int int[] int)) |
|
872 |
(com.ms.awt.peer.NativeGraphics::int drawBytes (byte[] int int int int int)) |
|
873 |
(com.ms.awt.peer.NativeGraphics::void changeClip (int int int int boolean)) |
|
874 |
(com.ms.awt.peer.NativeGraphics::int drawChars (char[] int int int int int int int int int int[] int[])) |
|
875 |
(com.ms.awt.peer.NativeGraphics::void drawT2Curve (float float float float float float int int)) |
|
876 |
(com.ms.awt.peer.NativeGraphics::void createFromPrintJob (java.lang.String com.ms.awt.peer.SPJData)) |
|
877 |
(com.ms.awt.peer.NativeGraphics::void endPrintJob ()) |
|
878 |
(com.ms.awt.peer.NativeGraphics::void pSetOrigin (int int)) |
|
879 |
(com.ms.awt.peer.NativeGraphics::void createFromHDC (int)) |
|
880 |
(com.ms.awt.peer.NativeGraphics::void drawOval (int int int int int)) |
|
881 |
(com.ms.awt.peer.NativeGraphics::int pSetFont (java.lang.String int int int)) |
|
882 |
(com.ms.awt.peer.NativeGraphics::void setPaintMode (int int)) |
|
883 |
(com.ms.awt.peer.NativeGraphics::void startPage ()) |
|
884 |
(com.ms.awt.peer.NativeGraphics::void clearClip ()) |
|
885 |
(com.ms.awt.peer.NativeGraphics::void createFromCopy (com.ms.awt.peer.INativeGraphics)) |
|
886 |
(com.ms.awt.peer.NativeGraphics::void scanLines (int int[] int int int int)) |
|
887 |
(com.ms.awt.peer.NativeGraphics::void drawRoundRect (int int int int int int int)) |
|
888 |
(com.ms.awt.peer.NativeGraphics::void dispose ()) |
|
889 |
(com.ms.awt.peer.NativeGraphics::void clearRect (int int int int int)) |
|
890 |
(com.ms.awt.peer.NativeGraphics::void copyArea (int int int int int int)) |
|
891 |
(com.ms.awt.peer.NativeGraphics::void createFromWindow (int)) |
|
892 |
(com.ms.awt.peer.NativeGraphics::void drawPolyline (int[] int[] int int int)) |
|
893 |
(com.ms.awt.peer.NativeGraphics::void drawRect (int int int int int)) |
|
894 |
(com.ms.awt.peer.CToolkit::void callbackEventLoop (com.ms.awt.peer.IToolkitCallback)) |
|
895 |
(com.ms.awt.peer.CToolkit::int getToolkitHwnd ()) |
|
896 |
(com.ms.awt.peer.CToolkit::int createCompHwnd (int int)) |
|
897 |
(com.ms.awt.peer.CNativeSystemIME::void setCompositionFont (int int)) |
|
898 |
(com.ms.awt.peer.CNativeSystemIME::void setCompositionPos (int int int)) |
|
899 |
(com.ms.awt.peer.CNativeSystemIME::void setOpenStatus (int int)) |
|
900 |
(com.ms.awt.peer.CNativeSystemIME::int getOpenStatus (int)) |
|
901 |
(com.ms.awt.peer.CNativeSystemIME::java.lang.String getCompositionString (int)) |
|
902 |
(com.ms.awt.peer.CNativeSystemIME::java.lang.String getCompositionResultString (int)) |
|
903 |
(com.ms.net.wininet.WininetStreamHandlerFactory::int initNative (java.lang.String)) |
|
904 |
(com.ms.com.SafeArray::void rawGetVariantAs (int com.ms.com.Variant)) |
|
905 |
(com.ms.com.SafeArray::void NSafeArrayInit (int)) |
|
906 |
(com.ms.com.SafeArray::float rawGetDouble (int)) |
|
907 |
(com.ms.com.SafeArray::void NRawBoolCopyToJavaArray (int int boolean[] int)) |
|
908 |
(com.ms.com.SafeArray::void validateArray (int)) |
|
909 |
(com.ms.com.SafeArray::void NSafeArrayCreateFromString (java.lang.String)) |
|
910 |
(com.ms.com.SafeArray::void rawSetString (int java.lang.String)) |
|
911 |
(com.ms.com.SafeArray::int getInt (int)) |
|
912 |
(com.ms.com.SafeArray::void setInt (int int)) |
|
913 |
(com.ms.com.SafeArray::boolean getBoolean (int)) |
|
914 |
(com.ms.com.SafeArray::void setBoolean (int boolean)) |
|
915 |
(com.ms.com.SafeArray::int computeOffset (int)) |
|
916 |
(com.ms.com.SafeArray::void NSafeArrayNullInit ()) |
|
917 |
(com.ms.com.SafeArray::void rawSetVariant (int com.ms.com.Variant)) |
|
918 |
(com.ms.com.SafeArray::float rawGetFloat (int)) |
|
919 |
(com.ms.com.SafeArray::float getFloat (int)) |
|
920 |
(com.ms.com.SafeArray::void setFloat (int float)) |
|
921 |
(com.ms.com.SafeArray::int computeOffset2 (int int)) |
|
922 |
(com.ms.com.SafeArray::void rawSetDouble (int double)) |
|
923 |
(com.ms.com.SafeArray::java.lang.String asString ()) |
|
924 |
(com.ms.com.SafeArray::void NRawCopyToJavaArray (int int java.lang.Object int)) |
|
925 |
(com.ms.com.SafeArray::void NSafeArrayCreate (int int int[] int[])) |
|
926 |
(com.ms.com.SafeArray::void NRawBoolCopyFromJavaArray (boolean[] int int int)) |
|
927 |
(com.ms.com.SafeArray::void NSafeArrayDestroy (boolean boolean)) |
|
928 |
(com.ms.com.SafeArray::int NSafeArrayCopy ()) |
|
929 |
(com.ms.com.SafeArray::int rawGetInt (int)) |
|
930 |
(com.ms.com.SafeArray::boolean rawGetBoolean (int)) |
|
931 |
(com.ms.com.SafeArray::void rawSetFloat (int float)) |
|
932 |
(com.ms.com.SafeArray::java.lang.String rawGetString (int)) |
|
933 |
(com.ms.com.SafeArray::int NTotalNumElems ()) |
|
934 |
(com.ms.com.SafeArray::double getDouble (int)) |
|
935 |
(com.ms.com.SafeArray::void setDouble (int double)) |
|
936 |
(com.ms.com.SafeArray::void Nreinit (com.ms.com.SafeArray)) |
|
937 |
(com.ms.com.SafeArray::int getPhysicalSafeArray ()) |
|
938 |
(com.ms.com.SafeArray::int NgetdwordAt (int)) |
|
939 |
(com.ms.com.SafeArray::void NRawCopyFromJavaArray (java.lang.Object int int int)) |
|
940 |
(com.ms.com.SafeArray::void rawSetBoolean (int boolean)) |
|
941 |
(com.ms.com.SafeArray::void rawSetInt (int int)) |
|
942 |
(com.ms.awt.peer.CNativeComponent::void invalidate (int int int int)) |
|
943 |
(com.ms.awt.peer.CNativeComponent::void hideModal ()) |
|
944 |
(com.ms.awt.peer.CNativeComponent::void hide ()) |
|
945 |
(com.ms.awt.peer.CNativeComponent::void setOnTop (int)) |
|
946 |
(com.ms.awt.peer.CNativeComponent::void registerDragDrop ()) |
|
947 |
(com.ms.awt.peer.CNativeComponent::void endValidate ()) |
|
948 |
(com.ms.awt.peer.CNativeComponent::void enable ()) |
|
949 |
(com.ms.awt.peer.CNativeComponent::void disable ()) |
|
950 |
(com.ms.awt.peer.CNativeComponent::void setTitle (java.lang.String)) |
|
951 |
(com.ms.awt.peer.CNativeComponent::void getBounds (com.ms.awt.peer.NativeRect)) |
|
952 |
(com.ms.awt.peer.CNativeComponent::int gethwnd ()) |
|
953 |
(com.ms.awt.peer.CNativeComponent::void showModal ()) |
|
954 |
(com.ms.awt.peer.CNativeComponent::void setCursor (int)) |
|
955 |
(com.ms.awt.peer.CNativeComponent::void reshape (int int int int)) |
|
956 |
(com.ms.awt.peer.CNativeComponent::void requestFocus ()) |
|
957 |
(com.ms.awt.peer.CNativeComponent::void callDefWindowProc (int int int int)) |
|
958 |
(com.ms.awt.peer.CNativeComponent::void registerCustomDropTarget (com.ms.com.IUnknown)) |
|
959 |
(com.ms.awt.peer.CNativeComponent::void setNoActivate (boolean)) |
|
960 |
(com.ms.awt.peer.CNativeComponent::void getPlaceOnScreen (com.ms.awt.peer.NativeRect)) |
|
961 |
(com.ms.awt.peer.CNativeComponent::void beginValidate ()) |
|
962 |
(com.ms.awt.peer.CNativeComponent::void clippedReshape (int int int int int)) |
|
963 |
(com.ms.awt.peer.CNativeComponent::void setResizable (boolean)) |
|
964 |
(com.ms.awt.peer.CNativeComponent::void setIcon (int)) |
|
965 |
(com.ms.awt.peer.CNativeComponent::void toBack ()) |
|
966 |
(com.ms.awt.peer.CNativeComponent::void setFrameHost (com.ms.awt.peer.IBrowserAppletFrameCallback)) |
|
967 |
(com.ms.awt.peer.CNativeComponent::void toFront ()) |
|
968 |
(com.ms.awt.peer.CNativeComponent::void show ()) |
|
969 |
(com.ms.awt.peer.CNativeComponent::void updateInsets (com.ms.awt.peer.NativeInsets)) |
|
970 |
(com.ms.awt.peer.CNativeComponent::void dispose ()) |
|
971 |
(com.ms.awt.peer.CNativeComponent::void initFromJavaWindow (int com.ms.awt.peer.IComponentCallback com.ms.awt.peer.INativeComponent com.ms.awt.peer.IToolkit int)) |
|
972 |
(com.ms.awt.peer.CNativeComponent::void init (int com.ms.awt.peer.IComponentCallback com.ms.awt.peer.INativeComponent com.ms.awt.peer.IToolkit)) |
|
973 |
(com.ms.awt.peer.CNativeComponent::void beginDrag (com.ms.awt.peer.INativeDragCallback)) |
|
974 |
(com.ms.fx.RegionConverter::int computeNativeRegion (int[])) |
|
975 |
(com.ms.fx.RegionConverter::int[] computeJavaRegion (int)) |
|
976 |
(com.ms.net.wininet.URLUtils::java.lang.String canonicalizeURL (java.lang.String int)) |
|
977 |
(com.ms.net.wininet.URLUtils::java.lang.String combineURL (java.lang.String java.lang.String int)) |
|
978 |
(com.ms.awt.peer.NativeFontMetrics::int bytesWidth (byte[] int int)) |
|
979 |
(com.ms.awt.peer.NativeFontMetrics::int stringWidth (java.lang.String int int[])) |
|
980 |
(com.ms.awt.peer.NativeFontMetrics::int charsWidth (char[] int int int int[])) |
|
981 |
(com.ms.awt.peer.NativeFontMetrics::java.lang.String init (com.ms.awt.peer.INativeGraphics int[] java.lang.String int int int)) |
|
982 |
(com.ms.io.console.Console::int MessageBox (int java.lang.String java.lang.String int)) |
|
983 |
(com.ms.awt.peer.NativeFileDialog::void show (com.ms.awt.peer.IFileDialogCallback java.lang.String java.lang.String java.lang.String int com.ms.awt.peer.INativeComponent int int)) |
|
984 |
(com.ms.security.management.SecurityZone::byte[] pLoadCustomPermissions (int int java.lang.String)) |
|
985 |
(com.ms.awt.peer.NativeImage::int setBytePixelsDirected (int int int int com.ms.awt.peer.DirectColourModelData byte[] int int com.ms.awt.peer.INativeImageBufferDone)) |
|
986 |
(com.ms.awt.peer.NativeImage::void create (int int int int)) |
|
987 |
(com.ms.awt.peer.NativeImage::int setIntPixelsIndexed (int int int int int[] int int[] int int com.ms.awt.peer.INativeImageBufferDone)) |
|
988 |
(com.ms.awt.peer.NativeImage::int getCoClass ()) |
|
989 |
(com.ms.awt.peer.NativeImage::int getIcon (int int int)) |
|
990 |
(com.ms.awt.peer.NativeImage::int setBytePixelsIndexed (int int int int int[] int byte[] int int com.ms.awt.peer.INativeImageBufferDone)) |
|
991 |
(com.ms.awt.peer.NativeImage::void sendPixels (com.ms.awt.peer.SPData)) |
|
992 |
(com.ms.awt.peer.NativeImage::void fillPixels (com.ms.awt.peer.SPData byte[])) |
|
993 |
(com.ms.awt.peer.NativeImage::void dispose ()) |
|
994 |
(com.ms.awt.peer.NativeImage::void init (int int int int int)) |
|
995 |
(com.ms.awt.peer.NativeImage::int setIntPixelsDirected (int int int int com.ms.awt.peer.DirectColourModelData int[] int int com.ms.awt.peer.INativeImageBufferDone)) |
|
996 |
(com.ms.awt.peer.NativeImage::void imageDrawStretched (com.ms.awt.peer.INativeGraphics int int int int int int int int int int)) |
|
997 |
(com.ms.awt.peer.NativeImage::int finish (int)) |
|
998 |
(com.ms.awt.peer.NativeImage::void imageDraw (int int int int int)) |
|
999 |
(com.ms.awt.peer.NativeResource::java.lang.String loadString (int)) |
|
1000 |
(com.ms.awt.peer.NativeResource::int openDialogFromID (int)) |
|
1001 |
(com.ms.awt.peer.NativeResource::boolean attach (java.lang.String)) |
|
1002 |
(com.ms.awt.peer.NativeResource::void loadBytes (int int java.lang.String byte[] int)) |
|
1003 |
(com.ms.awt.peer.NativeResource::int getSize (int int java.lang.String)) |
|
1004 |
(com.ms.awt.peer.NativeResource::void detach ()) |
|
1005 |
(com.ms.awt.peer.NativeResource::int openDialogFromName (java.lang.String)) |
|
1006 |
(com.ms.net.wininet.WininetURLConnection::com.ms.applet.BrowserAppletFrame findOfflineContext ()) |
|
1007 |
(com.ms.com.DispatchProxy::void finalize ()) |
|
1008 |
(com.ms.com.DispatchProxy::void init (com.ms.com._Guid java.lang.reflect.Method[] int[])) |
|
1009 |
(com.ms.net.wininet.WininetInputStream::void close ()) |
|
1010 |
(com.ms.net.wininet.WininetInputStream::int read (byte[] int int)) |
|
1011 |
(com.ms.net.wininet.WininetInputStream::int available ()) |
|
1012 |
(com.ms.net.wininet.WininetInputStream::long skip (long)) |
|
1013 |
(com.ms.net.wininet.WininetInputStream::void connect (java.lang.String boolean boolean java.lang.SecurityManager)) |
|
1014 |
(com.ms.vm.loader.CabSignatureInfo::com.ms.vm.loader.CabSignatureInfo extractFromFile0 (java.lang.String com.ms.security.management.SecurityPolicy)) |
|
1015 |
(com.ms.net.wininet.http.HttpInputStream::byte[] getResponseHeaders ()) |
|
1016 |
(com.ms.net.wininet.http.HttpInputStream::void close0 ()) |
|
1017 |
(com.ms.net.wininet.http.HttpInputStream::void connect (java.lang.String int java.lang.String boolean boolean boolean boolean byte[] byte[] java.lang.SecurityManager)) |
|
1018 |
(com.ms.vm.loader.CabCracker::int GetTempFileName (java.lang.StringBuffer java.lang.String int java.lang.StringBuffer)) |
|
1019 |
(com.ms.vm.loader.CabCracker::void getBytes0 (int int byte[])) |
|
1020 |
(com.ms.vm.loader.CabCracker::void cleanup ()) |
|
1021 |
(com.ms.vm.loader.CabCracker::int GetTempPath (int java.lang.StringBuffer)) |
|
1022 |
(com.ms.vm.loader.CabCracker::void load0 ()) |
|
1023 |
||
1024 |
||
261 | 1025 |
" |
1026 |
||
432 | 1027 |
! |
1028 |
||
1029 |
performance |
|
1030 |
" |
|
447 | 1031 |
JAVA::BenchMark new loopmark |
432 | 1032 |
JAVA::BenchMark new logicmark |
447 | 1033 |
JAVA::BenchMark new sievemark |
1034 |
JAVA::BenchMark new methodmark |
|
432 | 1035 |
JAVA::BenchMark new stringmark |
1036 |
JAVA::BenchMark new newstringmark |
|
1037 |
JAVA::BenchMark new neweststringmark |
|
1038 |
||
1039 |
||
1040 |
" |
|
1041 |
" |
|
512 | 1042 |
caffmark loopmark logicmark sievemark methodmark stringmark float image graphic dialog newstringmark neweststringmark |
457 | 1043 |
linux: |
512 | 1044 |
P6/233 No JIT 84 87 90 40 22 17 10 |
520 | 1045 |
103 133 142 137 28 73 109 167 18 140 |
1046 |
||
512 | 1047 |
P6/233 JIT 479 2459 393 649 28 21 12 |
1048 |
P6/233 JIT 473 1805 3046 439 986 28 21 12 |
|
460 | 1049 |
533 1808 3382 613 1003 25 105 143 1 |
464 | 1050 |
668 3330 3644 740 |
503 | 1051 |
793 4116 3731 1243 1365 120 103 79 2 |
513 | 1052 |
914 4480 4061 2290 68 106 158 19 34 |
1053 |
941 4607 4149 1238 2434 75 101 152 18 32 |
|
532 | 1054 |
591 164 |
534 | 1055 |
1087 1836 800 110 35 |
457 | 1056 |
|
1057 |
w95 |
|
1058 |
P5/200 JIT 90 95 90 95 686 18 60 54 7 |
|
459 | 1059 |
428 1657 2385 684 957 21 61 62 9 |
465 | 1060 |
541 2886 2589 823 976 18 62 55 7 |
507 | 1061 |
583 3062 2635 842 861 223 65 57 8 |
1062 |
616 3075 2438 1081 1324 218 64 54 8 |
|
432 | 1063 |
" |
1064 |
||
441 | 1065 |
! |
1066 |
||
1067 |
performance2 |
|
1068 |
" |
|
1069 |
symantec benchmarks |
|
1070 |
||
1071 |
||
1072 |
" |
|
1073 |
" |
|
1074 |
BubbleSort BidirBubbleSort QuickSort Sieve Hanoi Dhry Fib Array Tree Total |
|
1075 |
||
499 | 1076 |
ST/X+J Linux |
455 | 1077 |
233Mhz P6 |
441 | 1078 |
No JIT 352767 354597 69585 43048 101638 28961 108839 48815 |
1079 |
||
499 | 1080 |
ST/X+J Linux |
455 | 1081 |
233Mhz P6 |
441 | 1082 |
JIT 128724 116810 20259 39733 83160 27613 52093 33166 43996 545554 |
447 | 1083 |
124744 101428 17239 10052 8264 14004 38821 23252 33709 374660 |
455 | 1084 |
+IINC 120324 7265 |
1085 |
+IADD op2 100173 90737 18128 6996 7423 17093 48559 44209 57056 390374 |
|
1086 |
+ISUB op2 90460 17547 5921 57056 390461 |
|
1087 |
+ICMPEQ/NE 99785 90147 5792 43482 56486 388255 |
|
460 | 1088 |
+ICMP 87398 78214 15784 7574 5628 12812 38481 24654 32252 302797 |
461 | 1089 |
+IFICMPLE 84198 74928 13814 5650 11674 23241 293118 |
1090 |
+IFICMPxx 76867 69738 12208 37505 21973 32104 273569 |
|
1091 |
+IFICMPEQ/NE 5580 11202 21723 |
|
1092 |
const IFICMPxx 11856 5463 11032 37372 272726 |
|
462 | 1093 |
+lea for add/sub |
463 | 1094 |
+BALOAD 11700 4600 5015 9431 |
1095 |
+BASTORE 3279 |
|
1096 |
+CALOAD/CASTORE 8907 |
|
466 | 1097 |
regSave change 66119 60365 9997 4917 15386 37851 38202 50027 286497 |
469 | 1098 |
64858 58360 9476 4889 15001 37211 36288 48313 278478 |
1099 |
63146 55949 9302 14899 |
|
1100 |
62970 56085 9352 3226 4837 8779 37573 22815 33899 241297 |
|
471 | 1101 |
-O 43662 40292 7181 2530 4696 8170 34555 22116 32337 195539 |
474 | 1102 |
|
471 | 1103 |
+IALOAD 39162 36347 |
1104 |
+IASTORE 32461 30663 4299 3667 19556 30563 166868 |
|
474 | 1105 |
|
1106 |
-IALOAD/IASTORE |
|
1107 |
34167 19347 |
|
1108 |
19232 29726 |
|
1109 |
18821 |
|
496 | 1110 |
+AALOAD/BALOAD |
1111 |
41490 39527 6776 3315 4077 8443 33895 19152 28018 184693 |
|
497 | 1112 |
41291 37034 6593 32682 |
1113 |
+ATHROW 6449 180079 |
|
498 | 1114 |
+IASTORE 38848 35601 6219 3796 6122 17869 30085 175106 |
503 | 1115 |
IINC delayed code |
1116 |
+ANEWARRAY 3263 |
|
1117 |
+LADD/LSUB const 38719 35256 6062 27071 172859 |
|
512 | 1118 |
|
1119 |
2837 22835 |
|
514 | 1120 |
+ISTORE into arg |
1121 |
3080 |
|
1122 |
quick L2I for ints 2774 21184 |
|
1123 |
+*ASTORE / *ALOAD |
|
1124 |
again 1621 3654 1525 |
|
533 | 1125 |
+CHECKCAST 3574 25810 |
1126 |
||
441 | 1127 |
------------------------------------------------------------------------------------------------------------ |
507 | 1128 |
BubbleSort BidirBubbleSort QuickSort Sieve Hanoi Dhry Fib Array Tree Total |
499 | 1129 |
ST/X+J Win95 |
498 | 1130 |
200Mhz P5 |
1131 |
JIT 78490 77060 15220 4840 6370 9180 73160 36080 351700 |
|
503 | 1132 |
76900 13560 5500 9010 35200 348600 |
507 | 1133 |
66080 69920 370750 |
1134 |
+IADD non consts 76620 73210 13180 3790 63550 58880 356900 |
|
1135 |
51740 |
|
1136 |
77390 72450 12520 3900 6040 8950 62450 34330 57780 335810 |
|
1137 |
77220 71950 5270 8840 338650 |
|
1138 |
72390 70690 48010 327370 |
|
1139 |
74910 66740 11420 8620 61730 33340 47350 313940 |
|
1140 |
+xALOAD/JMP_ZERO |
|
1141 |
71740 2800 |
|
1142 |
71460 65250 11540 2750 62180 33840 50750 311660 |
|
1143 |
+LCMP 59100 |
|
1144 |
better abs(I) |
|
1145 |
+xALOAD/IF_ICMPx 66130 61520 12080 3300 5280 8190 56510 33830 50310 297150 |
|
1146 |
elim dummy static 5210 48270 |
|
1147 |
methods 44160 |
|
498 | 1148 |
------------------------------------------------------------------------------------------------------------ |
507 | 1149 |
BubbleSort BidirBubbleSort QuickSort Sieve Hanoi Dhry Fib Array Tree Total |
498 | 1150 |
|
441 | 1151 |
|
1152 |
Sun JDK 274625 244461 52676 50653 65183 26668 78133 28572 61608 882583 |
|
455 | 1153 |
(90Mhz P5) |
441 | 1154 |
|
1155 |
Microsoft J++ 9684 8452 2874 1733 3535 3665 3836 4746 25717 64242 |
|
455 | 1156 |
(90Mhz P5) |
441 | 1157 |
|
1158 |
Symantec Cafe 14541 12198 3686 1922 4527 3325 3425 12969 26829 83422 |
|
1159 |
JIT 1.02 |
|
1160 |
(90Mhz P5) |
|
1161 |
||
1162 |
Symantec Cafe 8292 6970 2714 1613 3345 3235 2013 4516 13180 45878 |
|
1163 |
JIT 1.2 |
|
1164 |
(90Mhz P5) |
|
1165 |
" |
|
1166 |
||
471 | 1167 |
" |
1168 |
|b| |
|
1169 |
||
1170 |
b := JAVA::BubbleSortAlgorithm new. |
|
1171 |
b perform:#'setData(JJ)V' with:10000 with:0 with:0 with:0. |
|
1172 |
Time millisecondsToRun:[ |
|
1173 |
b performTest. |
|
1174 |
] |
|
1175 |
" |
|
1176 |
" |
|
1177 |
|b| |
|
1178 |
||
1179 |
b := JAVA::QSortAlgorithm new. |
|
1180 |
b perform:#'setData(JJ)V' with:500000 with:0 with:0 with:0. |
|
1181 |
Time millisecondsToRun:[ |
|
1182 |
b performTest. |
|
1183 |
] |
|
1184 |
" |
|
1185 |
" |
|
1186 |
|t| |
|
1187 |
||
1188 |
t := JAVA::Tree new. |
|
1189 |
t perform:#'setData(JJ)V' with:1000000 with:0 with:0 with:0. |
|
1190 |
Time millisecondsToRun:[ |
|
1191 |
t performTest. |
|
1192 |
] |
|
1193 |
" |
|
1194 |
" |
|
1195 |
|t| |
|
1196 |
||
1197 |
t := JAVA::Array new. |
|
1198 |
t perform:#'setData(JJ)V' with:1000000 with:0 with:0 with:0. |
|
1199 |
Time millisecondsToRun:[ |
|
1200 |
t performTest. |
|
1201 |
] |
|
1202 |
" |
|
1203 |
||
261 | 1204 |
! ! |
253 | 1205 |
|
1206 |
!JavaVM class methodsFor:'initialization'! |
|
1207 |
||
423 | 1208 |
compile:source selector:smalltalkSelector asJavaMethod:javaSelector fakedSource:fakedSource in:aClass |
1209 |
"install additional java protocol in smalltalk classes, req'd for java programs" |
|
1210 |
||
1211 |
|cloneCode| |
|
1212 |
||
1213 |
(aClass implements:javaSelector) ifFalse:[ |
|
1214 |
aClass |
|
1215 |
compile:source |
|
1216 |
classified:'java support' |
|
1217 |
logged:false. |
|
1218 |
||
1219 |
cloneCode := aClass compiledMethodAt:smalltalkSelector. |
|
1220 |
cloneCode source:fakedSource. |
|
1221 |
||
1222 |
Class withoutUpdatingChangesDo:[ |
|
1223 |
aClass removeSelector:smalltalkSelector. |
|
1224 |
aClass addSelector:javaSelector withMethod:cloneCode. |
|
1225 |
] |
|
1226 |
]. |
|
1227 |
||
1228 |
"Created: / 5.11.1998 / 19:30:22 / cg" |
|
1229 |
"Modified: / 5.11.1998 / 19:37:57 / cg" |
|
1230 |
! |
|
1231 |
||
253 | 1232 |
deinitialize |
1233 |
|table| |
|
1234 |
||
1235 |
StandardThreadGroup := nil. |
|
1236 |
self releaseAllMonitors. |
|
1237 |
||
480 | 1238 |
KnownWindows notNil ifTrue:[ |
1239 |
KnownWindows do:[:v | |
|
1240 |
v isTopView ifTrue:[ |
|
1241 |
v destroy |
|
1242 |
] |
|
1243 |
] |
|
1244 |
]. |
|
1245 |
||
253 | 1246 |
JavaWindowGroup := nil. |
1247 |
KnownWindows := nil. |
|
1248 |
OpenFileTable := nil. |
|
1249 |
JavaClasses := nil. |
|
380 | 1250 |
JavaMethods := nil. |
253 | 1251 |
|
1252 |
" |
|
1253 |
JavaVM deinitialize |
|
1254 |
" |
|
1255 |
||
1256 |
"Created: / 3.1.1998 / 21:28:14 / cg" |
|
480 | 1257 |
"Modified: / 3.12.1998 / 20:33:21 / cg" |
253 | 1258 |
! |
1259 |
||
307 | 1260 |
deinitializeAdditionalJavaProtocol |
1261 |
"install additional java protocol in smalltalk classes, req'd for java programs" |
|
1262 |
||
459 | 1263 |
#( |
1264 |
#'clone()Ljava/lang/Object;' |
|
1265 |
#'equals(Ljava/lang/Object;)Z' |
|
1266 |
#'toString()Ljava/lang/String;' |
|
489 | 1267 |
#'getClass()Ljava/lang/Class;' |
459 | 1268 |
) do:[:sel | |
1269 |
(Object implements:sel) ifTrue:[ |
|
1270 |
Class withoutUpdatingChangesDo:[ |
|
1271 |
Object removeSelector:sel. |
|
1272 |
] |
|
1273 |
]. |
|
307 | 1274 |
]. |
1275 |
||
1276 |
" |
|
1277 |
self deinitializeAdditionalJavaProtocol |
|
1278 |
" |
|
1279 |
||
1280 |
"Created: / 4.2.1998 / 21:37:10 / cg" |
|
489 | 1281 |
"Modified: / 5.12.1998 / 15:27:39 / cg" |
307 | 1282 |
! |
1283 |
||
253 | 1284 |
initialize |
1285 |
|table| |
|
1286 |
||
1287 |
DUMMY_LONG_HIGHWORD := 1. |
|
1288 |
DUMMY_DOUBLE_HIGHWORD := 2. |
|
1289 |
||
1290 |
StandardThreadGroup := nil. |
|
261 | 1291 |
NoAudio := true. |
262 | 1292 |
"/ NoAudio := false. |
253 | 1293 |
|
1294 |
JavaConsoleStream := Transcript. |
|
1295 |
||
1296 |
FullExceptionTrace := StackTrace := false. |
|
1297 |
WindowOPTrace := DrawOPTrace := EventTrace := ThreadTrace := false. |
|
1298 |
MonitorTrace := ExceptionTrace := FileOpenTrace := FileIOTrace := false. |
|
474 | 1299 |
ExceptionDebug := ExitDebug := false. |
253 | 1300 |
WindowCreationTrace := false. |
1301 |
||
1302 |
FileOpenConfirmation := true. |
|
390 | 1303 |
SocketConnectConfirmation := true. |
253 | 1304 |
|
255 | 1305 |
"/ WindowOPTrace := true. |
1306 |
"/ MonitorTrace := true. |
|
1307 |
"/ ThreadTrace := true. |
|
253 | 1308 |
|
1309 |
UnhandledJavaExceptionSignal := (Signal new) mayProceed:false. |
|
1310 |
UnhandledJavaExceptionSignal nameClass:self message:#unhandledJavaExceptionSignal. |
|
1311 |
UnhandledJavaExceptionSignal notifierString:'unhandled java exception'. |
|
1312 |
||
1313 |
JavaExceptionSignal := (Signal new) mayProceed:false. |
|
1314 |
JavaExceptionSignal nameClass:self message:#javaExceptionSignal. |
|
1315 |
JavaExceptionSignal notifierString:'java exception'. |
|
1316 |
||
1317 |
UnimplementedInstructionSignal := (Signal new) mayProceed:false. |
|
1318 |
UnimplementedInstructionSignal nameClass:self message:#unimplementedInstructionSignal. |
|
1319 |
UnimplementedInstructionSignal notifierString:'unimplemented instruction'. |
|
1320 |
||
1321 |
UnimplementedNativeMethodSignal := (Signal new) mayProceed:false. |
|
1322 |
UnimplementedNativeMethodSignal nameClass:self message:#unimplementedNativeMethodSignal. |
|
1323 |
UnimplementedNativeMethodSignal notifierString:'unimplemented native method'. |
|
1324 |
||
1325 |
BadMessageSignal := (Signal new) mayProceed:false. |
|
1326 |
BadMessageSignal nameClass:self message:#badMessageSignal. |
|
1327 |
BadMessageSignal notifierString:'invalid message to JAVA object'. |
|
1328 |
||
1329 |
InternalErrorSignal := (Signal new) mayProceed:false. |
|
1330 |
InternalErrorSignal nameClass:self message:#internalErrorSignal. |
|
1331 |
InternalErrorSignal notifierString:'internal error'. |
|
1332 |
||
1333 |
CallHandlerSignal := (Signal new) mayProceed:false. |
|
1334 |
CallHandlerSignal nameClass:self message:#callHandlerSignal. |
|
1335 |
CallHandlerSignal notifierString:'internal signal'. |
|
1336 |
||
1337 |
" |
|
1338 |
JavaVM initialize |
|
1339 |
" |
|
1340 |
||
1341 |
"Created: / 2.1.1998 / 18:02:34 / cg" |
|
474 | 1342 |
"Modified: / 2.12.1998 / 23:02:22 / cg" |
253 | 1343 |
! |
1344 |
||
307 | 1345 |
initializeAdditionalJavaProtocol |
1346 |
"install additional java protocol in smalltalk classes, req'd for java programs" |
|
1347 |
||
1348 |
"/ since we use smalltalk Arrays for JavaArray, some |
|
1349 |
"/ additional (java-) protocol is required. |
|
423 | 1350 |
"/ This is also useful, when Smalltalk objects are passed to |
1351 |
"/ java ... |
|
1352 |
"/ We should implement all of the java.lang.Object protocol in |
|
1353 |
"/ Object, to be on the bright side of life; more of this later ... |
|
1354 |
||
1355 |
self |
|
1356 |
compile:'__clone |
|
307 | 1357 |
"this is smalltalk code with a java selector ... |
430 | 1358 |
(This source cannot be accepted in the browser, |
1359 |
since it has a funny selector.) |
|
307 | 1360 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
1361 |
||
1362 |
^ self shallowCopy' |
|
423 | 1363 |
selector:#'__clone' |
1364 |
asJavaMethod:#'clone()Ljava/lang/Object;' |
|
1365 |
fakedSource:'#''clone()Ljava/lang/Object;'' |
|
307 | 1366 |
"this is smalltalk code with a java selector ... |
430 | 1367 |
(This source cannot be accepted in the browser, |
1368 |
since it has a funny selector.) |
|
307 | 1369 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
1370 |
||
423 | 1371 |
^ self shallowCopy' |
1372 |
in:Object. |
|
1373 |
||
489 | 1374 |
"/ ------------------------------------------------------------ |
1375 |
||
423 | 1376 |
self |
430 | 1377 |
compile:'__equals:arg |
1378 |
"this is smalltalk code with a java selector ... |
|
1379 |
(This source cannot be accepted in the browser, |
|
1380 |
since it has a funny selector.) |
|
1381 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
|
1382 |
||
1383 |
^ (arg = self) ifTrue:[1] ifFalse:[0]' |
|
1384 |
selector:#'__equals:' |
|
1385 |
asJavaMethod:#'equals(Ljava/lang/Object;)Z' |
|
1386 |
fakedSource:'#''equals(Ljava/lang/Object;)Z'' |
|
1387 |
"this is smalltalk code with a java selector ... |
|
1388 |
(This source cannot be accepted in the browser, |
|
1389 |
since it has a funny selector.) |
|
1390 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
|
1391 |
||
1392 |
^ (arg = self) ifTrue:[1] ifFalse:[0]' |
|
1393 |
in:Object. |
|
1394 |
||
489 | 1395 |
"/ ------------------------------------------------------------ |
1396 |
||
430 | 1397 |
self |
423 | 1398 |
compile:'__toString |
1399 |
"this is smalltalk code with a java selector ... |
|
430 | 1400 |
(This source cannot be accepted in the browser, |
1401 |
since it has a funny selector.) |
|
423 | 1402 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
1403 |
||
1404 |
^ Java as_String:(self displayString)' |
|
1405 |
selector:#'__toString' |
|
1406 |
asJavaMethod:#'toString()Ljava/lang/String;' |
|
1407 |
fakedSource:'#''toString()Ljava/lang/String;'' |
|
1408 |
"this is smalltalk code with a java selector ... |
|
430 | 1409 |
(This source cannot be accepted in the browser, |
1410 |
since it has a funny selector.) |
|
423 | 1411 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
1412 |
||
1413 |
^ Java as_String:(self displayString)' |
|
489 | 1414 |
in:Object. |
1415 |
||
1416 |
"/ ------------------------------------------------------------ |
|
1417 |
||
1418 |
self |
|
1419 |
compile:'__getClass |
|
1420 |
"this is smalltalk code with a java selector ... |
|
1421 |
(This source cannot be accepted in the browser, |
|
1422 |
since it has a funny selector.) |
|
1423 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
|
1424 |
||
508 | 1425 |
^ JavaVM javaClassObjectForClass:self class' |
489 | 1426 |
selector:#'__getClass' |
1427 |
asJavaMethod:#'getClass()Ljava/lang/Class;' |
|
1428 |
fakedSource:'#''getClass()Ljava/lang/Class;'' |
|
1429 |
"this is smalltalk code with a java selector ... |
|
1430 |
(This source cannot be accepted in the browser, |
|
1431 |
since it has a funny selector.) |
|
1432 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
|
1433 |
||
1434 |
^ JavaVM javaClassObjectForClass:self class' |
|
1435 |
in:Object. |
|
307 | 1436 |
|
1437 |
" |
|
1438 |
self initializeAdditionalJavaProtocol |
|
1439 |
" |
|
1440 |
||
1441 |
"Modified: / 28.1.1997 / 19:38:58 / stefan" |
|
1442 |
"Modified: / 22.1.1998 / 21:23:40 / av" |
|
1443 |
"Created: / 4.2.1998 / 21:35:46 / cg" |
|
508 | 1444 |
"Modified: / 30.12.1998 / 21:07:55 / cg" |
307 | 1445 |
! |
1446 |
||
253 | 1447 |
initializeBaseClasses |
1448 |
"load req'd base classes" |
|
1449 |
||
326 | 1450 |
#( |
1451 |
'java.lang.Object' |
|
1452 |
'java.lang.Class' |
|
1453 |
'java.lang.String' |
|
1454 |
'java.lang.System' |
|
1455 |
) do:[:cName | |
|
1456 |
(Java classForName:cName) isNil ifTrue:[ |
|
1457 |
self halt:('could not find required class:' , cName) |
|
1458 |
] |
|
1459 |
]. |
|
253 | 1460 |
|
1461 |
" |
|
1462 |
self initializeBaseClasses |
|
1463 |
" |
|
1464 |
||
1465 |
"Created: / 3.1.1998 / 21:13:28 / cg" |
|
326 | 1466 |
"Modified: / 30.3.1998 / 17:47:02 / cg" |
253 | 1467 |
! |
1468 |
||
1469 |
initializeOpenFileTable |
|
1470 |
OpenFileTable := OrderedCollection |
|
261 | 1471 |
with:Stdin |
1472 |
with:(JavaConsoleStream ? Stdout) |
|
1473 |
with:(JavaConsoleStream ? Stderr). |
|
253 | 1474 |
|
1475 |
" |
|
1476 |
JavaVM initializeOpenFileTable |
|
1477 |
" |
|
1478 |
||
1479 |
"Modified: / 6.8.1997 / 00:40:19 / cg" |
|
1480 |
"Created: / 2.1.1998 / 18:04:32 / cg" |
|
1481 |
! |
|
1482 |
||
1483 |
initializePrimitiveClasses |
|
1484 |
JavaClasses isNil ifTrue:[ |
|
405 | 1485 |
JavaClasses := Dictionary new. |
253 | 1486 |
]. |
1487 |
||
1488 |
#( |
|
405 | 1489 |
(#byte 'B' 1) |
1490 |
(#short 'S' 2) |
|
1491 |
(#int 'I' 4) |
|
1492 |
(#long 'J' 8) |
|
1493 |
(#boolean 'Z' 1) |
|
1494 |
(#char 'C' 2) |
|
1495 |
(#float 'F' 4) |
|
1496 |
(#double 'D' 8) |
|
1497 |
(#void 'V' 0) |
|
253 | 1498 |
) triplesDo:[:nm :sig :len | |
405 | 1499 |
|stClass jClass| |
1500 |
||
1501 |
"/ |
|
1502 |
"/ create a javaClass for it. |
|
1503 |
"/ |
|
1504 |
jClass := (Java at:'java.lang.Class') new. |
|
253 | 1505 |
"/ stClass := Class new. |
1506 |
"/ stClass setName:('JavaBase_' , nm) asSymbol. |
|
1507 |
"/ JavaClasses at:stClass put:jClass. |
|
1508 |
"/ JavaClasses at:jClass put:stClass. |
|
1509 |
||
405 | 1510 |
JavaClasses at:nm put:jClass |
253 | 1511 |
]. |
1512 |
||
1513 |
" |
|
1514 |
self initializePrimitiveClasses |
|
1515 |
" |
|
1516 |
||
405 | 1517 |
"Modified: / 22.10.1998 / 01:56:02 / cg" |
253 | 1518 |
! |
1519 |
||
1520 |
initializeSimulatedLibs |
|
277 | 1521 |
"return a collection of native libs which are considered |
1522 |
being already loaded. (used with jdk < 1.2)" |
|
1523 |
||
432 | 1524 |
LibPath := #( |
1525 |
'__builtIn__' |
|
1526 |
'/usr/local/lib' |
|
1527 |
'/usr/local/lib/java' |
|
1528 |
). |
|
1529 |
||
1530 |
SimulatedLibs := #( |
|
1531 |
'__builtIn__/net' |
|
1532 |
'__builtIn__/awt' |
|
1533 |
'__builtIn__/tawt' |
|
1534 |
'__builtIn__/winawt' |
|
1535 |
'__builtIn__/jpeg' |
|
1536 |
'__builtIn__/mmedia' |
|
1537 |
'__builtIn__/zip' |
|
1538 |
'__builtIn__/math' |
|
1539 |
||
1540 |
"/ KAVA ... |
|
1541 |
'__builtIn__/agent' |
|
457 | 1542 |
|
1543 |
"/ MS-java ... |
|
1544 |
'__builtIn__/msawt' |
|
1545 |
'__builtIn__/javart' |
|
277 | 1546 |
). |
253 | 1547 |
|
457 | 1548 |
" |
1549 |
self initializeSimulatedLibs |
|
1550 |
" |
|
1551 |
||
253 | 1552 |
"Created: / 4.1.1998 / 19:05:03 / cg" |
457 | 1553 |
"Modified: / 17.11.1998 / 23:53:02 / cg" |
277 | 1554 |
! |
1555 |
||
1556 |
initializeSimulatedNativeLibs |
|
1557 |
"return a collection of native libs which are considered |
|
1558 |
being already loaded (used with jdk >= 1.2)" |
|
1559 |
||
1560 |
SimulatedNativeLibs := #( |
|
1561 |
'/libawt.so' |
|
1562 |
). |
|
1563 |
||
1564 |
" |
|
1565 |
self initializeSimulatedNativeLibs |
|
1566 |
" |
|
1567 |
||
1568 |
"Modified: / 27.1.1998 / 18:43:10 / cg" |
|
253 | 1569 |
! |
1570 |
||
1571 |
initializeSystemPropertiesInto:props |
|
495 | 1572 |
|cpu os | |
253 | 1573 |
|
1574 |
"/ use JAVA compatible cpu-name |
|
1575 |
cpu := OperatingSystem getCPUType. |
|
1576 |
cpu = 'i386' ifTrue:[ |
|
280 | 1577 |
cpu := 'ix86' |
253 | 1578 |
]. |
475 | 1579 |
SimulatedOS notNil ifTrue:[ |
474 | 1580 |
os := SimulatedOS |
1581 |
] ifFalse:[ |
|
1582 |
os := OperatingSystem getOSType. |
|
1583 |
os := os asUppercaseFirst. |
|
1584 |
]. |
|
253 | 1585 |
|
1586 |
props at:'java.version' put:'1'. |
|
1587 |
props at:'java.vendor' put:'eXept Software AG'. |
|
342 | 1588 |
props at:'java.vendor.url' put:'http://www.exept.de'. |
253 | 1589 |
props at:'java.home' put:(self defaultJAVAHome). |
1590 |
props at:'java.class.version' put:'1'. |
|
1591 |
props at:'java.class.path' put:(self defaultCLASSPATH). |
|
1592 |
props at:'os.name' put:os. |
|
1593 |
props at:'os.arch' put:cpu. |
|
1594 |
props at:'os.version' put:'1'. |
|
1595 |
props at:'file.separator' put:(Filename separator asString). |
|
1596 |
props at:'path.separator' put:':'. |
|
1597 |
props at:'line.separator' put:(Character cr asString). |
|
1598 |
props at:'user.name' put:(OperatingSystem getLoginName). |
|
388 | 1599 |
props at:'user.home' put:(OperatingSystem getHomeDirectory ? Filename currentDirectory name). |
495 | 1600 |
props at:'user.dir' put:(OperatingSystem getHomeDirectory ? Filename currentDirectory name). |
1601 |
"/ props at:'user.dir' put:(Filename currentDirectory pathName). |
|
253 | 1602 |
|
1603 |
props at:'awt.toolkit' put:(self defaultWindowingToolKit). |
|
1604 |
||
1605 |
props at:'hotjava.home' put:(self defaultHotJavaHome). |
|
1606 |
||
1607 |
"/ undocumented ? |
|
255 | 1608 |
props at:'file.encoding.pkg' put:'sun.io'. |
253 | 1609 |
|
1610 |
"/ suppress copyright view in appletViewer ... |
|
1611 |
props at:'appletviewer.version' put:'1.1'. |
|
1612 |
||
280 | 1613 |
"/ new with jdk 1.2 |
1614 |
props at:'java.awt.graphicsenv' put:'sun.awt.X11GraphicsEnvironment'. |
|
284 | 1615 |
props at:'java.awt.fonts' put:'/usr/lib/X11/fonts'. |
280 | 1616 |
|
474 | 1617 |
"/ jws |
1618 |
props at:'jws.home' put:(self defaultJWSHome). |
|
1619 |
"/ new with jws 2.0 ... |
|
1620 |
props at:'jws.startcmd' put:'jws.showwin.mainide'. |
|
1621 |
||
253 | 1622 |
^ props |
1623 |
||
388 | 1624 |
" |
1625 |
self initializeSystemPropertiesInto:(Dictionary new) |
|
1626 |
" |
|
1627 |
||
253 | 1628 |
"Created: / 3.1.1998 / 14:26:39 / cg" |
495 | 1629 |
"Modified: / 11.12.1998 / 14:17:13 / cg" |
253 | 1630 |
! |
1631 |
||
1632 |
initializeVM |
|
307 | 1633 |
self initializeAdditionalJavaProtocol. |
1634 |
||
285 | 1635 |
self releaseAllJavaResources. |
255 | 1636 |
|
261 | 1637 |
JavaConsoleStream := Transcript. |
1638 |
||
255 | 1639 |
Java initAllStaticFields. |
1640 |
Java markAllClassesUninitialized. |
|
1641 |
||
429 | 1642 |
"/ force re-resolving; |
1643 |
"/ otherwise, class-inits would not be called |
|
1644 |
"/ by resolver ... (sigh) |
|
1645 |
||
1646 |
JavaMethod allSubInstancesDo:[:m | |
|
1647 |
m checked:false. |
|
1648 |
m code:nil. |
|
1649 |
]. |
|
1650 |
ObjectMemory flushCaches. "/ sigh - must flush inline caches. |
|
1651 |
||
434 | 1652 |
JavaClass startRememberingOrderOfClassInits. |
1653 |
||
277 | 1654 |
self initializeSimulatedLibs. "/ < jdk 1.2 |
1655 |
self initializeSimulatedNativeLibs. "/ >= jdk 1.2 |
|
253 | 1656 |
self initializeOpenFileTable. |
1657 |
||
1658 |
self initializeBaseClasses. |
|
1659 |
self initializePrimitiveClasses. |
|
1660 |
||
1661 |
Java initSystemClass. |
|
1662 |
||
255 | 1663 |
ObjectMemory addDependent:self. |
1664 |
||
253 | 1665 |
" |
285 | 1666 |
JavaVM initialize. |
1667 |
JavaVM initializeVM. |
|
253 | 1668 |
" |
1669 |
||
1670 |
"Created: / 3.1.1998 / 21:29:09 / cg" |
|
480 | 1671 |
"Modified: / 3.12.1998 / 20:33:02 / cg" |
261 | 1672 |
! |
1673 |
||
1674 |
initializeVMIfNoEventThreadRunning |
|
1675 |
(JavaEventThread isNil or:[JavaEventThread isDead]) ifTrue:[ |
|
270 | 1676 |
self initializeVM |
261 | 1677 |
]. |
1678 |
||
1679 |
" |
|
1680 |
JavaVM initializeVMIfNoEventThreadRunning |
|
1681 |
" |
|
1682 |
||
1683 |
"Modified: / 15.1.1998 / 17:29:34 / cg" |
|
1684 |
"Created: / 15.1.1998 / 17:32:27 / cg" |
|
255 | 1685 |
! |
1686 |
||
434 | 1687 |
reinitializeVM |
1688 |
|classesToInit| |
|
1689 |
||
1690 |
self releaseAllJavaResources. |
|
1691 |
||
1692 |
JavaConsoleStream := Transcript. |
|
1693 |
||
1694 |
Java initAllStaticFields. |
|
1695 |
Java markAllClassesUninitialized. |
|
1696 |
||
1697 |
self initializeOpenFileTable. |
|
1698 |
||
1699 |
classesToInit := JavaClass orderOfClassInits. |
|
1700 |
JavaClass startRememberingOrderOfClassInits. |
|
1701 |
||
451 | 1702 |
self initializePrimitiveClasses. |
455 | 1703 |
"/ Java initSystemClass. |
434 | 1704 |
|
1705 |
classesToInit do:[:jClass | |
|
455 | 1706 |
Transcript showCR:'classInit: ' , jClass name. |
434 | 1707 |
jClass classInit |
1708 |
]. |
|
455 | 1709 |
Java initSystemClass. |
434 | 1710 |
|
1711 |
"Created: / 12.11.1998 / 15:37:52 / cg" |
|
455 | 1712 |
"Modified: / 17.11.1998 / 16:10:11 / cg" |
434 | 1713 |
! |
1714 |
||
462 | 1715 |
reinitializeVMIfNoEventThreadRunning |
1716 |
(JavaEventThread isNil or:[JavaEventThread isDead]) ifTrue:[ |
|
1717 |
self reinitializeVM |
|
1718 |
]. |
|
1719 |
||
1720 |
" |
|
1721 |
JavaVM reinitializeVMIfNoEventThreadRunning |
|
1722 |
" |
|
1723 |
||
1724 |
"Created: / 24.11.1998 / 15:45:49 / cg" |
|
526 | 1725 |
"Modified: / 8.1.1999 / 17:06:31 / cg" |
462 | 1726 |
! |
1727 |
||
255 | 1728 |
releaseAllJavaResources |
380 | 1729 |
self deinitialize. |
1730 |
||
285 | 1731 |
FirstWindowCreationSemaphore := Semaphore new. |
526 | 1732 |
JavaScreenUpdaterThread := nil. |
285 | 1733 |
|
1734 |
LoadedLibs := nil. "/ gc will reclaim them ... |
|
1735 |
LoadedNativeLibs := nil. "/ gc will reclaim them ... |
|
1736 |
||
1737 |
ImageStretchCache := nil. |
|
504 | 1738 |
LastGraphics := LastGC := nil. |
285 | 1739 |
|
1740 |
self terminateAllThreads. |
|
1741 |
||
255 | 1742 |
self releaseAllWindows. |
1743 |
self releaseAllStreams. |
|
1744 |
||
1745 |
" |
|
1746 |
JavaVM releaseAllJavaResources |
|
1747 |
" |
|
1748 |
||
1749 |
"Created: / 7.1.1998 / 22:49:42 / cg" |
|
526 | 1750 |
"Modified: / 8.1.1999 / 17:09:45 / cg" |
253 | 1751 |
! |
1752 |
||
1753 |
releaseAllMonitors |
|
1754 |
LockTable := WeakIdentityDictionary new. |
|
1755 |
LockTableAccess := Semaphore forMutualExclusion. |
|
1756 |
WaitTable := IdentityDictionary new. |
|
1757 |
WaitTableAccess := Semaphore forMutualExclusion. |
|
1758 |
||
1759 |
EnteredMonitorsPerProcess := IdentityDictionary new. |
|
1760 |
||
1761 |
" |
|
1762 |
JavaVM releaseAllMonitors |
|
1763 |
" |
|
1764 |
||
1765 |
"Created: / 2.1.1998 / 18:04:05 / cg" |
|
255 | 1766 |
"Modified: / 7.1.1998 / 22:58:10 / cg" |
1767 |
! |
|
1768 |
||
1769 |
releaseAllStreams |
|
307 | 1770 |
OpenFileTable notNil ifTrue:[ |
1771 |
OpenFileTable do:[:aStream | |
|
1772 |
aStream notNil ifTrue:[ |
|
1773 |
aStream ~~ Stdin ifTrue:[ |
|
1774 |
aStream ~~ Stdout ifTrue:[ |
|
1775 |
aStream ~~ Stderr ifTrue:[ |
|
1776 |
aStream ~~ JavaConsoleStream ifTrue:[ |
|
1777 |
aStream isExternalStream ifTrue:[ |
|
1778 |
aStream shutDown |
|
1779 |
] |
|
1780 |
] |
|
1781 |
] |
|
1782 |
] |
|
1783 |
] |
|
1784 |
] |
|
1785 |
] |
|
1786 |
]. |
|
255 | 1787 |
self initializeOpenFileTable. |
1788 |
||
1789 |
" |
|
261 | 1790 |
JavaVM releaseAllStreams |
255 | 1791 |
" |
1792 |
||
1793 |
"Created: / 7.1.1998 / 22:57:04 / cg" |
|
307 | 1794 |
"Modified: / 4.2.1998 / 19:53:11 / cg" |
255 | 1795 |
! |
1796 |
||
1797 |
releaseAllWindows |
|
1798 |
KnownWindows notNil ifTrue:[ |
|
261 | 1799 |
KnownWindows do:[:aView | |
1800 |
aView destroy |
|
1801 |
]. |
|
1802 |
KnownWindows := nil. |
|
255 | 1803 |
] |
1804 |
||
1805 |
" |
|
1806 |
self releaseAllWindows |
|
1807 |
" |
|
1808 |
||
1809 |
"Created: / 7.1.1998 / 22:58:32 / cg" |
|
1810 |
! |
|
1811 |
||
1812 |
releaseLeftOverMonitors |
|
1813 |
"release monitors held by dead processes" |
|
1814 |
||
1815 |
|deadProcesses| |
|
1816 |
||
1817 |
deadProcesses := IdentitySet new. |
|
1818 |
||
1819 |
EnteredMonitorsPerProcess keysAndValuesDo:[:p :monitors | |
|
261 | 1820 |
p isDead ifTrue:[ |
1821 |
monitors do:[:mon | |
|
1822 |
Transcript showCR:'release leftover monitor ...'. |
|
1823 |
mon release |
|
1824 |
]. |
|
1825 |
deadProcesses add:p. |
|
1826 |
] |
|
255 | 1827 |
]. |
1828 |
deadProcesses do:[:p | |
|
261 | 1829 |
EnteredMonitorsPerProcess removeKey:p |
255 | 1830 |
]. |
1831 |
||
1832 |
" |
|
1833 |
JavaVM releaseLeftOverMonitors |
|
1834 |
" |
|
1835 |
||
1836 |
"Created: / 8.1.1998 / 17:29:26 / cg" |
|
1837 |
"Modified: / 8.1.1998 / 17:38:33 / cg" |
|
253 | 1838 |
! |
1839 |
||
1840 |
systemProperties |
|
1841 |
|props| |
|
1842 |
||
1843 |
props := Dictionary new. |
|
1844 |
self initializeSystemPropertiesInto:props. |
|
1845 |
^ props |
|
1846 |
||
1847 |
"Created: / 3.1.1998 / 14:25:58 / cg" |
|
1848 |
"Modified: / 3.1.1998 / 14:32:38 / cg" |
|
255 | 1849 |
! |
1850 |
||
1851 |
terminateAllThreads |
|
261 | 1852 |
Java terminateAllThreads. |
1853 |
JavaEventThread := nil. |
|
526 | 1854 |
JavaScreenUpdaterThread := nil. |
255 | 1855 |
|
1856 |
"Created: / 8.1.1998 / 17:43:54 / cg" |
|
526 | 1857 |
"Modified: / 8.1.1999 / 17:06:40 / cg" |
255 | 1858 |
! |
1859 |
||
1860 |
update:something with:aParameter from:changedObject |
|
1861 |
something == #returnFromSnapshot ifTrue:[ |
|
426 | 1862 |
"/ self initializeVM |
255 | 1863 |
]. |
1864 |
||
1865 |
" |
|
1866 |
JavaVM initializeVM |
|
1867 |
" |
|
1868 |
||
1869 |
"Created: / 9.1.1998 / 10:30:13 / cg" |
|
426 | 1870 |
"Modified: / 6.11.1998 / 00:40:53 / cg" |
253 | 1871 |
! ! |
1872 |
||
1873 |
!JavaVM class methodsFor:'Signal constants'! |
|
1874 |
||
1875 |
badMessageSignal |
|
1876 |
^ BadMessageSignal |
|
1877 |
||
1878 |
"Created: / 2.1.1998 / 18:06:52 / cg" |
|
1879 |
! |
|
1880 |
||
1881 |
callHandlerSignal |
|
1882 |
^ CallHandlerSignal |
|
1883 |
||
1884 |
"Created: / 2.1.1998 / 18:07:16 / cg" |
|
1885 |
! |
|
1886 |
||
1887 |
internalErrorSignal |
|
1888 |
^ InternalErrorSignal |
|
1889 |
||
1890 |
"Created: / 2.1.1998 / 18:07:05 / cg" |
|
1891 |
! |
|
1892 |
||
1893 |
javaExceptionSignal |
|
1894 |
^ JavaExceptionSignal |
|
1895 |
||
1896 |
"Created: / 2.1.1998 / 18:05:58 / cg" |
|
1897 |
! |
|
1898 |
||
1899 |
unhandledJavaExceptionSignal |
|
1900 |
^ UnhandledJavaExceptionSignal |
|
1901 |
||
1902 |
"Created: / 2.1.1998 / 18:05:19 / cg" |
|
1903 |
! |
|
1904 |
||
1905 |
unimplementedInstructionSignal |
|
1906 |
^ UnimplementedInstructionSignal |
|
1907 |
||
1908 |
"Created: / 2.1.1998 / 18:06:15 / cg" |
|
1909 |
! |
|
1910 |
||
1911 |
unimplementedNativeMethodSignal |
|
1912 |
^ UnimplementedNativeMethodSignal |
|
1913 |
||
1914 |
"Created: / 2.1.1998 / 18:06:40 / cg" |
|
1915 |
! ! |
|
1916 |
||
526 | 1917 |
!JavaVM class methodsFor:'accessing'! |
1918 |
||
1919 |
javaEventThread |
|
1920 |
^ JavaEventThread |
|
1921 |
||
1922 |
"Created: / 8.1.1999 / 17:05:02 / cg" |
|
1923 |
! |
|
1924 |
||
1925 |
javaScreenUpdaterThread |
|
1926 |
^ JavaScreenUpdaterThread |
|
1927 |
||
1928 |
"Created: / 8.1.1999 / 17:06:52 / cg" |
|
1929 |
! ! |
|
1930 |
||
253 | 1931 |
!JavaVM class methodsFor:'defaults'! |
1932 |
||
359 | 1933 |
audioEnabled |
1934 |
^ NoAudio not |
|
1935 |
||
1936 |
"Created: / 18.7.1998 / 22:31:36 / cg" |
|
1937 |
! |
|
1938 |
||
1939 |
audioEnabled:aBoolean |
|
1940 |
NoAudio := aBoolean not |
|
1941 |
||
1942 |
"Created: / 18.7.1998 / 22:31:20 / cg" |
|
1943 |
! |
|
1944 |
||
253 | 1945 |
defaultCLASSPATH |
1946 |
|s| |
|
1947 |
||
1948 |
s := '' writeStream. |
|
1949 |
Java classPath do:[:p | |
|
261 | 1950 |
s size == 0 ifFalse:[ |
1951 |
s nextPut:$: |
|
1952 |
]. |
|
1953 |
s nextPutAll:p. |
|
253 | 1954 |
]. |
1955 |
||
1956 |
^ s contents |
|
1957 |
||
1958 |
" |
|
1959 |
self defaultCLASSPATH |
|
1960 |
" |
|
1961 |
||
1962 |
"Modified: / 6.8.1997 / 00:51:17 / cg" |
|
1963 |
"Created: / 3.1.1998 / 14:27:21 / cg" |
|
1964 |
! |
|
1965 |
||
1966 |
defaultHotJavaHome |
|
1967 |
^ '/usr/local/java/hotjava'. |
|
1968 |
||
1969 |
"Modified: / 5.8.1997 / 04:13:36 / cg" |
|
1970 |
"Created: / 3.1.1998 / 14:27:34 / cg" |
|
1971 |
! |
|
1972 |
||
1973 |
defaultJAVAHome |
|
1974 |
^ Java javaHome |
|
1975 |
||
1976 |
"Modified: / 6.8.1997 / 00:54:44 / cg" |
|
1977 |
"Created: / 3.1.1998 / 14:27:01 / cg" |
|
1978 |
! |
|
1979 |
||
1980 |
defaultJWSHome |
|
474 | 1981 |
'/phys/idefix/home2/java/JWS2_0/Java-WorkShop2.0/JWS' asFilename exists ifTrue:[ |
479 | 1982 |
^ '/phys/idefix/home2/java/JWS2_0/Java-WorkShop2.0/JWS' |
474 | 1983 |
]. |
1984 |
||
253 | 1985 |
^ '/usr/local/java/JWS'. |
1986 |
||
1987 |
"Created: / 3.1.1998 / 14:27:42 / cg" |
|
479 | 1988 |
"Modified: / 3.12.1998 / 14:54:08 / cg" |
253 | 1989 |
! |
1990 |
||
1991 |
defaultWindowingToolKit |
|
1992 |
"/ prefer the windows toolkit ... |
|
1993 |
||
1994 |
(Java classForName:'sun.awt.windows.WToolkit') notNil ifTrue:[ |
|
277 | 1995 |
^ 'sun.awt.windows.WToolkit'. |
1996 |
]. |
|
1997 |
(Java classForName:'sun.awt.motif.MToolkit') notNil ifTrue:[ |
|
1998 |
^ 'sun.awt.motif.MToolkit'. |
|
1999 |
]. |
|
253 | 2000 |
|
2001 |
^ 'sun.awt.tiny.TinyToolkit'. |
|
2002 |
||
2003 |
||
2004 |
"/ ^ 'sun.awt.win32.MToolkit'. |
|
2005 |
"/ ^ 'sun.awt.motif.MToolkit'. |
|
2006 |
||
277 | 2007 |
" |
2008 |
self defaultWindowingToolKit |
|
2009 |
" |
|
2010 |
||
253 | 2011 |
"Created: / 3.1.1998 / 14:27:49 / cg" |
277 | 2012 |
"Modified: / 27.1.1998 / 21:52:52 / cg" |
253 | 2013 |
! |
2014 |
||
390 | 2015 |
fileOpenConfirmation |
2016 |
^ FileOpenConfirmation |
|
2017 |
||
2018 |
"Created: / 19.10.1998 / 16:01:44 / cg" |
|
2019 |
! |
|
2020 |
||
2021 |
fileOpenConfirmation:aBoolean |
|
2022 |
FileOpenConfirmation := aBoolean |
|
2023 |
||
2024 |
"Created: / 19.10.1998 / 16:01:56 / cg" |
|
2025 |
! |
|
2026 |
||
253 | 2027 |
javaConsole:aStream |
2028 |
JavaConsoleStream := aStream |
|
2029 |
||
2030 |
" |
|
261 | 2031 |
JavaVM javaConsole:Transcript |
253 | 2032 |
" |
2033 |
||
2034 |
"Modified: / 6.8.1997 / 00:34:13 / cg" |
|
2035 |
"Created: / 3.1.1998 / 14:27:58 / cg" |
|
2036 |
! |
|
2037 |
||
2038 |
javaConsoleStream |
|
2039 |
^ JavaConsoleStream |
|
2040 |
||
2041 |
"Created: / 3.1.1998 / 14:32:16 / cg" |
|
390 | 2042 |
! |
2043 |
||
2044 |
socketConnectConfirmation |
|
2045 |
^ SocketConnectConfirmation |
|
2046 |
||
2047 |
"Created: / 19.10.1998 / 16:02:15 / cg" |
|
2048 |
! |
|
2049 |
||
2050 |
socketConnectConfirmation:aBoolean |
|
2051 |
SocketConnectConfirmation := aBoolean |
|
2052 |
||
2053 |
"Created: / 19.10.1998 / 16:02:06 / cg" |
|
253 | 2054 |
! ! |
2055 |
||
2056 |
!JavaVM class methodsFor:'fileIO'! |
|
2057 |
||
2058 |
addOpenFile:aStream |
|
2059 |
OpenFileTable add:aStream. |
|
2060 |
^ OpenFileTable size - 1. |
|
2061 |
||
2062 |
"Created: / 2.1.1998 / 18:32:59 / cg" |
|
2063 |
! |
|
2064 |
||
2065 |
getOpenFileAt:idx |
|
2066 |
^ OpenFileTable at:idx+1 ifAbsent:nil. |
|
2067 |
||
2068 |
"Created: / 2.1.1998 / 18:28:01 / cg" |
|
2069 |
"Modified: / 2.1.1998 / 18:33:06 / cg" |
|
2070 |
! |
|
2071 |
||
2072 |
setOpenFile:aStream at:idx |
|
2073 |
OpenFileTable size < (idx+1) ifTrue:[ |
|
261 | 2074 |
OpenFileTable grow:idx+1. |
253 | 2075 |
]. |
2076 |
OpenFileTable at:idx+1 put:aStream. |
|
2077 |
||
2078 |
"Modified: / 2.1.1998 / 18:33:21 / cg" |
|
2079 |
! ! |
|
2080 |
||
2081 |
!JavaVM class methodsFor:'helpers'! |
|
2082 |
||
268
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2083 |
classForJavaClassObject:aJavaClassObject |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2084 |
"given java.lang.class instance, return the real class for it." |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2085 |
|
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2086 |
^ JavaClasses at:aJavaClassObject ifAbsent:nil. |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2087 |
|
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2088 |
"Created: / 23.1.1998 / 17:44:09 / cg" |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2089 |
! |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2090 |
|
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2091 |
javaClassObjectForClass:aClass |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2092 |
"given a real class, return the corresponding java.lang.class |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2093 |
instance for it." |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2094 |
|
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2095 |
|jClass| |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2096 |
|
489 | 2097 |
aClass == SignedIntegerArray ifTrue:[self halt]. |
2098 |
||
268
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2099 |
jClass := JavaClasses at:aClass ifAbsent:nil. |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2100 |
jClass isNil ifTrue:[ |
405 | 2101 |
"/ class must be initialized (with all of its superclasses ?). |
2102 |
aClass isJavaClass ifTrue:[ |
|
2103 |
aClass classInit. |
|
2104 |
]. |
|
2105 |
JavaClasses at:aClass put:(jClass := (Java at:'java.lang.Class') new). |
|
2106 |
JavaClasses at:jClass put:aClass. |
|
268
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2107 |
]. |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2108 |
^ jClass |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2109 |
|
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2110 |
"Created: / 23.1.1998 / 17:43:38 / cg" |
489 | 2111 |
"Modified: / 5.12.1998 / 15:29:32 / cg" |
268
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2112 |
! |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2113 |
|
321 | 2114 |
javaMethodObjectForMethod:aMethod |
2115 |
"given a real method, return the corresponding java.lang.reflect.Method |
|
2116 |
instance for it." |
|
2117 |
||
2118 |
|jMethod| |
|
2119 |
||
2120 |
jMethod := JavaMethods at:aMethod ifAbsent:nil. |
|
2121 |
jMethod isNil ifTrue:[ |
|
2122 |
"/ class must be initialized (with all of its superclasses ?). |
|
2123 |
||
2124 |
JavaMethods at:aMethod put:(jMethod := (Java at:'java.lang.reflect.Method') new). |
|
2125 |
JavaMethods at:jMethod put:aMethod. |
|
2126 |
]. |
|
2127 |
^ jMethod |
|
2128 |
||
2129 |
"Modified: / 23.1.1998 / 17:46:51 / cg" |
|
2130 |
"Created: / 9.2.1998 / 15:59:16 / cg" |
|
2131 |
! |
|
2132 |
||
253 | 2133 |
javaThreadForSTProcess:stProcess |
2134 |
|t| |
|
2135 |
||
2136 |
t := Java threads keyAtValue:stProcess ifAbsent:nil. |
|
2137 |
t == 0 ifTrue:[ |
|
261 | 2138 |
^ nil |
253 | 2139 |
]. |
2140 |
^ t |
|
2141 |
||
2142 |
"Modified: / 26.8.1997 / 19:56:31 / cg" |
|
2143 |
"Created: / 3.1.1998 / 01:53:41 / cg" |
|
2144 |
! |
|
2145 |
||
321 | 2146 |
methodForJavaMethodObject:aJavaMethodObject |
2147 |
"given java.lang.reflect.Method instance, return the real method for it." |
|
2148 |
||
2149 |
^ JavaMethods at:aJavaMethodObject ifAbsent:nil. |
|
2150 |
||
2151 |
"Created: / 9.2.1998 / 16:01:48 / cg" |
|
2152 |
! |
|
2153 |
||
253 | 2154 |
newThread:name |
274 | 2155 |
|thread threadClass i| |
253 | 2156 |
|
2157 |
threadClass := Java at:'java.lang.Thread'. |
|
2158 |
||
2159 |
thread := (Java at:'java.lang.Thread') basicNew. |
|
2160 |
thread instVarNamed:'name' put:(Java as_String:name). |
|
2161 |
thread instVarNamed:'priority' put:(threadClass instVarNamed:'NORM_PRIORITY'). |
|
2162 |
thread instVarNamed:'single_step' put:0. |
|
2163 |
thread instVarNamed:'daemon' put:0. |
|
2164 |
thread instVarNamed:'stillborn' put:0. |
|
2165 |
thread instVarNamed:'target' put:nil. |
|
274 | 2166 |
"/ |
2167 |
"/ that on was only temporarily present in JDK1.1.3 (sigh) |
|
2168 |
"/ |
|
2169 |
(i := thread class instVarOffsetOf:'initial_stack_memory') notNil ifTrue:[ |
|
2170 |
thread instVarAt:i put:0. |
|
2171 |
]. |
|
253 | 2172 |
thread instVarNamed:'group' put:(self standardThreadGroup). |
2173 |
^ thread |
|
2174 |
||
2175 |
"Created: / 3.1.1998 / 01:47:30 / cg" |
|
274 | 2176 |
"Modified: / 27.1.1998 / 00:54:33 / cg" |
253 | 2177 |
! |
2178 |
||
2179 |
stProcessForJavaThread:jThread |
|
2180 |
|p| |
|
2181 |
||
2182 |
p := Java threads at:jThread ifAbsent:nil. |
|
2183 |
p == 0 ifTrue:[ |
|
261 | 2184 |
^ nil |
253 | 2185 |
]. |
2186 |
^ p |
|
2187 |
||
2188 |
"Created: / 2.1.1998 / 21:48:27 / cg" |
|
2189 |
"Modified: / 3.1.1998 / 01:53:55 / cg" |
|
2190 |
! |
|
2191 |
||
2192 |
standardThreadGroup |
|
2193 |
|standardGroup threadClass| |
|
2194 |
||
2195 |
StandardThreadGroup isNil ifTrue:[ |
|
457 | 2196 |
threadClass := Java at:'java.lang.Thread'. |
2197 |
||
2198 |
standardGroup := (Java at:'java.lang.ThreadGroup') new. |
|
2199 |
standardGroup instVarNamed:'parent' put:nil. |
|
2200 |
standardGroup instVarNamed:'name' put:(Java as_String:'main'). |
|
2201 |
standardGroup instVarNamed:'maxPriority' put:(threadClass instVarNamed:'MAX_PRIORITY'). |
|
2202 |
standardGroup instVarNamed:'destroyed' put:0. |
|
2203 |
standardGroup instVarNamed:'daemon' put:nil. |
|
2204 |
(standardGroup class instVarOffsetOf:'vmAllowSuspension') notNil ifTrue:[ |
|
2205 |
standardGroup instVarNamed:'vmAllowSuspension' put:0. |
|
2206 |
]. |
|
2207 |
standardGroup instVarNamed:'nthreads' put:0. |
|
2208 |
standardGroup instVarNamed:'ngroups' put:0. |
|
2209 |
standardGroup instVarNamed:'groups' put:nil. |
|
2210 |
StandardThreadGroup := standardGroup. |
|
253 | 2211 |
]. |
2212 |
^ StandardThreadGroup |
|
2213 |
||
2214 |
"Created: / 3.1.1998 / 01:41:54 / cg" |
|
457 | 2215 |
"Modified: / 17.11.1998 / 22:55:30 / cg" |
253 | 2216 |
! |
2217 |
||
2218 |
wakeup:anObject |
|
2219 |
JavaVM releaseAndSignalSemaphoreFor:anObject. |
|
2220 |
||
2221 |
"Created: / 3.1.1998 / 02:29:27 / cg" |
|
2222 |
"Modified: / 3.1.1998 / 03:08:05 / cg" |
|
2223 |
! |
|
2224 |
||
2225 |
wakeupAll:anObject |
|
2226 |
JavaVM releaseAndSignalForAllSemaphoreFor:anObject. |
|
2227 |
||
2228 |
"Created: / 3.1.1998 / 03:07:48 / cg" |
|
2229 |
"Modified: / 3.1.1998 / 03:08:15 / cg" |
|
2230 |
! ! |
|
2231 |
||
2232 |
!JavaVM class methodsFor:'helpers - awt'! |
|
2233 |
||
2234 |
commonReshapeComponent:nativeContext |
|
277 | 2235 |
|view x y width height ext menu| |
2236 |
||
2237 |
view := self viewForWPeer:nativeContext. |
|
253 | 2238 |
|
2239 |
x := nativeContext argAt:1. |
|
2240 |
y := nativeContext argAt:2. |
|
2241 |
width := nativeContext argAt:3. |
|
2242 |
height := nativeContext argAt:4. |
|
261 | 2243 |
ext := width@height. |
253 | 2244 |
|
2245 |
"/ 'pReshape ' print. view print. |
|
2246 |
"/ ' ' print. x print. '/' print. y print. |
|
261 | 2247 |
"/ ' extent: ' print. ext printNL. |
483 | 2248 |
view isPopUpView ifTrue:[ |
2249 |
view origin:x@y extent:ext. |
|
2250 |
] ifFalse:[ |
|
2251 |
(view isTopView |
|
2252 |
or:[view isMemberOf:JavaEmbeddedFrameView]) ifTrue:[ |
|
2253 |
"/ |
|
2254 |
"/ dont allow setting the origin |
|
2255 |
"/ |
|
2256 |
menu := self topViewsMenu:view. |
|
2257 |
menu notNil ifTrue:[ |
|
2258 |
"/ must add the menus height |
|
2259 |
height := height + menu height. |
|
2260 |
ext := width@height. |
|
261 | 2261 |
]. |
483 | 2262 |
|
2263 |
"/ to prevent a view from not being visible/closable |
|
2264 |
"/ in case Java goes mad .. |
|
2265 |
||
2266 |
(width < 30 |
|
2267 |
or:[height < 10]) ifTrue:[ |
|
2268 |
"/ self halt. |
|
2269 |
width := 30. |
|
2270 |
height := 20. |
|
2271 |
ext := width@height. |
|
2272 |
]. |
|
2273 |
||
2274 |
view extent:ext. |
|
2275 |
(view isKindOf:ModalBox) ifTrue:[ |
|
2276 |
view preferredExtent:ext |
|
2277 |
]. |
|
2278 |
||
2279 |
"/ adjust non-resizable views min/max |
|
2280 |
||
2281 |
view isTopView ifTrue:[ |
|
2282 |
view minExtent notNil ifTrue:[ |
|
2283 |
view minExtent:ext. |
|
2284 |
view maxExtent:ext |
|
2285 |
]. |
|
253 | 2286 |
] |
261 | 2287 |
] ifFalse:[ |
483 | 2288 |
(view superView notNil |
2289 |
and:[view superView isTopView]) ifTrue:[ |
|
2290 |
menu := self topViewsMenu:view superView. |
|
2291 |
menu notNil ifTrue:[ |
|
2292 |
"/ must add menus height to yPos |
|
2293 |
y := y + menu height. |
|
2294 |
] |
|
2295 |
] ifFalse:[ |
|
2296 |
"/ post a configuration event |
|
2297 |
EventTrace == true ifTrue:[ |
|
2298 |
'JAVA: configure: need event' printCR. |
|
2299 |
] |
|
2300 |
]. |
|
2301 |
view origin:x@y extent:ext. |
|
253 | 2302 |
]. |
2303 |
]. |
|
2304 |
||
2305 |
^ nil |
|
2306 |
||
2307 |
"Created: / 4.1.1998 / 18:00:52 / cg" |
|
484 | 2308 |
"Modified: / 5.12.1998 / 13:34:20 / cg" |
253 | 2309 |
! |
2310 |
||
2311 |
createdWindowsView:aView for:aJavaPeer |
|
2312 |
"this is only sent with the sun.awt.windows toolkit" |
|
2313 |
||
2314 |
aJavaPeer instVarNamed:'pData' put:aView. |
|
2315 |
||
2316 |
JavaWindowGroup isNil ifTrue:[ |
|
284 | 2317 |
JavaWindowGroup := WindowGroup new. |
2318 |
JavaWindowGroup isForModalSubview:true. |
|
253 | 2319 |
]. |
2320 |
aView windowGroup:JavaWindowGroup. |
|
2321 |
JavaWindowGroup addView:aView. |
|
2322 |
||
2323 |
KnownWindows isNil ifTrue:[ |
|
284 | 2324 |
KnownWindows := IdentityDictionary new. |
253 | 2325 |
]. |
2326 |
KnownWindows at:aJavaPeer put:aView. |
|
2327 |
||
284 | 2328 |
FirstWindowCreationSemaphore signalIf. |
2329 |
||
261 | 2330 |
"/'*** ' print. aJavaPeer print. ' -> ' print. aView printCR. |
2331 |
"/(aView isKindOf:ModalBox) ifTrue:[ |
|
2332 |
"/ self halt. |
|
2333 |
"/]. |
|
2334 |
||
253 | 2335 |
"Created: / 4.1.1998 / 17:57:16 / cg" |
284 | 2336 |
"Modified: / 28.1.1998 / 22:40:19 / cg" |
253 | 2337 |
! |
2338 |
||
255 | 2339 |
gcForWGraphics:nativeContext |
504 | 2340 |
|jGraphics gc orgX orgY trans tX tY| |
255 | 2341 |
|
2342 |
jGraphics := nativeContext receiver. |
|
459 | 2343 |
O_WGgraphics_pData isNil ifTrue:[ |
2344 |
O_WGgraphics_pData := (jGraphics class instVarOffsetOf:'pData'). |
|
2345 |
]. |
|
2346 |
O_WGgraphics_originX isNil ifTrue:[ |
|
2347 |
O_WGgraphics_originX := (jGraphics class instVarOffsetOf:'originX'). |
|
2348 |
]. |
|
2349 |
O_WGgraphics_originY isNil ifTrue:[ |
|
2350 |
O_WGgraphics_originY := (jGraphics class instVarOffsetOf:'originY'). |
|
2351 |
]. |
|
2352 |
gc := jGraphics instVarAt:O_WGgraphics_pData. |
|
270 | 2353 |
|
505 | 2354 |
trans := gc translation. |
2355 |
tX := trans x. |
|
2356 |
tY := trans y. |
|
2357 |
"/ tX := gc translationX. |
|
2358 |
"/ tY := gc translationY. |
|
504 | 2359 |
|
459 | 2360 |
orgX := jGraphics instVarAt:O_WGgraphics_originX. |
2361 |
orgY := jGraphics instVarAt:O_WGgraphics_originY. |
|
504 | 2362 |
((orgX ~~ tX) or:[orgY ~~ tY]) ifTrue:[ |
270 | 2363 |
gc translation:orgX@orgY |
2364 |
]. |
|
255 | 2365 |
^ gc |
2366 |
||
2367 |
"Created: / 8.1.1998 / 00:16:38 / cg" |
|
505 | 2368 |
"Modified: / 23.12.1998 / 20:27:35 / cg" |
255 | 2369 |
! |
2370 |
||
261 | 2371 |
jPeerForView:aView |
2372 |
^ KnownWindows keyAtValue:aView ifAbsent:nil |
|
2373 |
||
2374 |
"Created: / 15.1.1998 / 13:48:01 / cg" |
|
2375 |
"Modified: / 15.1.1998 / 13:48:43 / cg" |
|
2376 |
! |
|
2377 |
||
255 | 2378 |
pReshape:nativeContext |
2379 |
|jFramePeer view x y width height menu| |
|
2380 |
||
2381 |
jFramePeer := nativeContext receiver. |
|
2382 |
view := jFramePeer instVarNamed:'pData'. |
|
2383 |
||
2384 |
x := nativeContext argAt:1. |
|
2385 |
y := nativeContext argAt:2. |
|
2386 |
width := nativeContext argAt:3. |
|
2387 |
height := nativeContext argAt:4. |
|
2388 |
||
2389 |
"/ 'pReshape ' print. view print. |
|
2390 |
"/ ' ' print. x print. '/' print. y print. |
|
2391 |
"/ ' extent: ' print. width print. '/' print. height printNL. |
|
2392 |
||
484 | 2393 |
view isPopUpView ifTrue:[ |
2394 |
self halt. |
|
2395 |
]. |
|
2396 |
||
255 | 2397 |
(view isTopView |
2398 |
or:[view isMemberOf:JavaEmbeddedFrameView]) ifTrue:[ |
|
484 | 2399 |
"/ |
2400 |
"/ dont allow setting the origin |
|
2401 |
"/ |
|
2402 |
menu := self topViewsMenu:view. |
|
2403 |
menu notNil ifTrue:[ |
|
2404 |
"/ must add the menus height |
|
2405 |
height := height + menu height |
|
2406 |
]. |
|
2407 |
view extent:width@height. |
|
255 | 2408 |
] ifFalse:[ |
484 | 2409 |
(view superView notNil |
2410 |
and:[view superView isTopView]) ifTrue:[ |
|
2411 |
menu := self topViewsMenu:view superView. |
|
2412 |
menu notNil ifTrue:[ |
|
2413 |
"/ must add menus height to yPos |
|
2414 |
y := y + menu height. |
|
2415 |
] |
|
2416 |
]. |
|
2417 |
view origin:x@y extent:width@height. |
|
255 | 2418 |
]. |
2419 |
||
2420 |
^ nil |
|
2421 |
||
2422 |
"Created: / 7.1.1998 / 21:47:11 / cg" |
|
484 | 2423 |
"Modified: / 5.12.1998 / 13:47:52 / cg" |
255 | 2424 |
! |
2425 |
||
253 | 2426 |
topViewsMenu:view |
2427 |
|idx| |
|
2428 |
||
2429 |
view isTopView ifTrue:[ |
|
261 | 2430 |
view subViews size > 0 ifTrue:[ |
2431 |
(idx := view subViews findFirst:[:v | v isMemberOf:MenuPanel]) ~~ 0 ifTrue:[ |
|
2432 |
"/ must add the menus height |
|
2433 |
^ view subViews at:idx |
|
2434 |
] |
|
2435 |
]. |
|
253 | 2436 |
]. |
2437 |
^ nil |
|
2438 |
||
2439 |
"Modified: / 4.8.1997 / 01:23:06 / cg" |
|
2440 |
"Created: / 4.1.1998 / 18:01:42 / cg" |
|
255 | 2441 |
! |
2442 |
||
2443 |
viewForWPeer:nativeContext |
|
459 | 2444 |
|jPeer| |
255 | 2445 |
|
2446 |
jPeer := nativeContext receiver. |
|
277 | 2447 |
|
2448 |
"/ sigh; pData was renamed to pNativeWidget in jdk1.2 ... |
|
459 | 2449 |
O_FramePeer_pNativeWidget isNil ifTrue:[ |
2450 |
O_FramePeer_pNativeWidget := (jPeer class instVarOffsetOf:'pNativeWidget'). |
|
2451 |
O_FramePeer_pNativeWidget isNil ifTrue:[ |
|
2452 |
O_FramePeer_pNativeWidget := 0. |
|
2453 |
O_FramePeer_pData isNil ifTrue:[ |
|
2454 |
O_FramePeer_pData := (jPeer class instVarOffsetOf:'pData'). |
|
2455 |
]. |
|
2456 |
] |
|
2457 |
]. |
|
2458 |
O_FramePeer_pNativeWidget > 0 ifTrue:[ |
|
277 | 2459 |
"/ ok, we are < 1.2 |
459 | 2460 |
^ jPeer instVarAt:O_FramePeer_pNativeWidget. |
2461 |
]. |
|
2462 |
^ jPeer instVarAt:O_FramePeer_pData. |
|
2463 |
||
2464 |
"Modified: / 19.11.1998 / 01:43:20 / cg" |
|
253 | 2465 |
! ! |
2466 |
||
2467 |
!JavaVM class methodsFor:'helpers - exceptions'! |
|
2468 |
||
261 | 2469 |
throwArrayIndexOutOfBoundsException:badIndex |
2470 |
|exClass ex| |
|
2471 |
||
2472 |
"/ self |
|
2473 |
"/ throwExceptionClassName:'java.lang.ArrayIndexOutOfBoundsException' |
|
2474 |
"/ withMessage:'bad array index: ' , badIndex printString |
|
2475 |
||
2476 |
exClass := Java classForName:'java.lang.ArrayIndexOutOfBoundsException'. |
|
459 | 2477 |
ex := exClass newWith_int:badIndex. |
261 | 2478 |
|
2479 |
self throwException:ex |
|
2480 |
||
2481 |
"Created: / 14.1.1998 / 21:36:05 / cg" |
|
459 | 2482 |
"Modified: / 20.11.1998 / 13:27:14 / cg" |
261 | 2483 |
! |
2484 |
||
524 | 2485 |
throwArrayIndexOutOfBoundsException:theArray _:badIndex |
2486 |
|exClass ex| |
|
2487 |
||
2488 |
"/ self |
|
2489 |
"/ throwExceptionClassName:'java.lang.ArrayIndexOutOfBoundsException' |
|
2490 |
"/ withMessage:'bad array index: ' , badIndex printString |
|
2491 |
||
2492 |
exClass := Java classForName:'java.lang.ArrayIndexOutOfBoundsException'. |
|
2493 |
ex := exClass newWith_int:badIndex. |
|
2494 |
||
2495 |
self throwException:ex |
|
2496 |
||
2497 |
"Modified: / 20.11.1998 / 13:27:14 / cg" |
|
2498 |
"Created: / 8.1.1999 / 15:03:59 / cg" |
|
2499 |
! |
|
2500 |
||
530 | 2501 |
throwClassCastException |
2502 |
self |
|
2503 |
throwExceptionClassName:'java.lang.ClassCastException' |
|
2504 |
withMessage:'cast failed' |
|
2505 |
||
2506 |
"Modified: / 7.1.1998 / 15:25:35 / cg" |
|
2507 |
"Created: / 8.1.1999 / 18:55:31 / cg" |
|
2508 |
! |
|
2509 |
||
253 | 2510 |
throwClassNotFoundException |
255 | 2511 |
self |
261 | 2512 |
throwExceptionClassName:'java.lang.ClassNotFoundException' |
2513 |
withMessage:'no such class' |
|
255 | 2514 |
|
253 | 2515 |
"Created: / 4.1.1998 / 22:25:26 / cg" |
255 | 2516 |
"Modified: / 7.1.1998 / 15:25:35 / cg" |
253 | 2517 |
! |
2518 |
||
2519 |
throwClassNotFoundException:className |
|
255 | 2520 |
self |
429 | 2521 |
throwExceptionClassName:'java.lang.ClassNotFoundException' |
2522 |
withMessage:'no such class: ' , className |
|
255 | 2523 |
|
253 | 2524 |
"Created: / 4.1.1998 / 22:26:09 / cg" |
429 | 2525 |
"Modified: / 10.11.1998 / 13:20:31 / cg" |
255 | 2526 |
! |
2527 |
||
524 | 2528 |
throwDivisionByZeroException |
2529 |
self halt:'division by zero'. |
|
2530 |
self |
|
2531 |
throwExceptionClassName:'java.lang.ArithmeticException' |
|
2532 |
withMessage:'division by zero' |
|
2533 |
||
2534 |
"Created: / 8.1.1999 / 14:28:15 / cg" |
|
2535 |
! |
|
2536 |
||
255 | 2537 |
throwException:aJavaException |
459 | 2538 |
|con jMsg msg exClass srchCon handlerContext handlerPC method pc hPC| |
255 | 2539 |
|
2540 |
ExceptionTrace ifTrue:[ |
|
508 | 2541 |
'JAVA: exception: ' print. aJavaException class fullName print. |
2542 |
msg := aJavaException instVarNamed:'detailMessage'. |
|
2543 |
msg notNil ifTrue:[ |
|
2544 |
' (' print. |
|
2545 |
(Java as_ST_String:msg) print. |
|
2546 |
')' print. |
|
2547 |
]. |
|
2548 |
'' printCR. |
|
255 | 2549 |
]. |
2550 |
ExceptionDebug ifTrue:[ |
|
347 | 2551 |
self halt:('JAVA: exception: ' , aJavaException class fullName). |
448 | 2552 |
"/ self internalError:('JAVA: exception: ' , aJavaException class fullName). |
255 | 2553 |
]. |
2554 |
||
459 | 2555 |
"/ |
2556 |
"/ search stack for a javaContext which handles that exception |
|
2557 |
"/ |
|
2558 |
srchCon := thisContext sender. |
|
2559 |
[handlerContext isNil and:[srchCon notNil]] whileTrue:[ |
|
2560 |
(srchCon isJavaContext) ifTrue:[ |
|
2561 |
method := srchCon method. |
|
2562 |
pc := srchCon pc. |
|
2563 |
(hPC := method handlerFor:aJavaException at:pc) notNil ifTrue:[ |
|
2564 |
handlerPC := hPC. |
|
2565 |
handlerContext := srchCon |
|
508 | 2566 |
] ifFalse:[ |
2567 |
"/ on the fly, release any monitor |
|
2568 |
method isSynchronized ifTrue:[ |
|
512 | 2569 |
method isStatic ifTrue:[ |
535 | 2570 |
self _MONITOREXIT:(method javaClass) |
512 | 2571 |
] ifFalse:[ |
535 | 2572 |
self _MONITOREXIT:(srchCon receiver) |
512 | 2573 |
] |
508 | 2574 |
] |
2575 |
] |
|
459 | 2576 |
]. |
2577 |
srchCon := srchCon sender. |
|
2578 |
]. |
|
2579 |
||
2580 |
handlerContext isNil ifTrue:[ |
|
2581 |
"/ |
|
2582 |
"/ no JavaHandler ... let smalltalk handle it |
|
2583 |
"/ |
|
347 | 2584 |
exClass := aJavaException class. |
459 | 2585 |
msg := 'Java ' , exClass name. |
347 | 2586 |
jMsg := aJavaException instVarNamed:'detailMessage'. |
2587 |
jMsg notNil ifTrue:[ |
|
459 | 2588 |
msg := msg , ': ' , (Java as_ST_String:jMsg). |
347 | 2589 |
]. |
2590 |
||
459 | 2591 |
"/ for our convenience: skip ST contexts |
2592 |
"/ (i.e. the handler or debugger will see the javaContext first ) |
|
2593 |
||
347 | 2594 |
con := thisContext sender. |
2595 |
[con isNil or:[con isJavaContext]] whileFalse:[ |
|
2596 |
con := con sender |
|
2597 |
]. |
|
2598 |
con isNil ifTrue:[con := thisContext sender]. |
|
2599 |
||
2600 |
JavaVM javaExceptionSignal |
|
2601 |
raiseWith:aJavaException |
|
2602 |
errorString:msg |
|
2603 |
in:con. |
|
459 | 2604 |
] ifFalse:[ |
2605 |
"/ |
|
2606 |
"/ found a java exceptionHandler |
|
2607 |
"/ |
|
2608 |
handlerContext setPC:handlerPC. |
|
515 | 2609 |
handlerContext exceptionArg:aJavaException pc:handlerPC. |
459 | 2610 |
handlerContext markForException. |
2611 |
handlerContext unwindAndRestart. |
|
2612 |
self halt:'should not be reached'. |
|
526 | 2613 |
]. |
2614 |
Processor activeProcess == JavaScreenUpdaterThread ifTrue:[self halt]. |
|
2615 |
Processor activeProcess terminate. |
|
255 | 2616 |
|
2617 |
"Created: / 7.1.1998 / 15:28:22 / cg" |
|
535 | 2618 |
"Modified: / 9.1.1999 / 00:41:46 / cg" |
255 | 2619 |
! |
2620 |
||
2621 |
throwExceptionClassName:aJavaExceptionClassName withMessage:someMessage |
|
261 | 2622 |
|exClass ex| |
2623 |
||
2624 |
exClass := Java classForName:aJavaExceptionClassName. |
|
2625 |
ex := exClass newCleared. |
|
2626 |
ex perform:#'<init>(Ljava/lang/String;)V' with:(Java as_String:someMessage). |
|
2627 |
||
2628 |
"/ ex := exClass new. |
|
2629 |
"/ ex instVarNamed:'detailMessage' put:(Java as_String:someMessage). |
|
255 | 2630 |
|
2631 |
self throwException:ex |
|
2632 |
||
2633 |
"Created: / 7.1.1998 / 15:25:09 / cg" |
|
261 | 2634 |
"Modified: / 14.1.1998 / 23:38:30 / cg" |
255 | 2635 |
! |
2636 |
||
2637 |
throwIOExceptionWithMessage:message |
|
2638 |
self |
|
261 | 2639 |
throwExceptionClassName:'java.io.IOException' |
2640 |
withMessage:message |
|
255 | 2641 |
|
2642 |
"Created: / 7.1.1998 / 10:34:24 / cg" |
|
2643 |
"Modified: / 7.1.1998 / 15:26:25 / cg" |
|
2644 |
! |
|
2645 |
||
261 | 2646 |
throwIllegalAccessException |
2647 |
self |
|
270 | 2648 |
throwExceptionClassName:'java.lang.IllegalAccessException' |
2649 |
withMessage:'illegal access' |
|
261 | 2650 |
|
2651 |
"Modified: / 7.1.1998 / 15:25:35 / cg" |
|
2652 |
"Created: / 14.1.1998 / 23:13:44 / cg" |
|
2653 |
! |
|
2654 |
||
2655 |
throwInstantiationException |
|
2656 |
self |
|
270 | 2657 |
throwExceptionClassName:'java.lang.InstantiationException' |
2658 |
withMessage:'cannot instantiate' |
|
261 | 2659 |
|
2660 |
"Modified: / 7.1.1998 / 15:25:35 / cg" |
|
2661 |
"Created: / 14.1.1998 / 23:15:01 / cg" |
|
2662 |
! |
|
2663 |
||
2664 |
throwInstantiationExceptionFor:aJavaClass |
|
2665 |
self |
|
270 | 2666 |
throwExceptionClassName:'java.lang.InstantiationException' |
2667 |
withMessage:('cannot instantiate ' , aJavaClass fullName) |
|
261 | 2668 |
|
2669 |
"Modified: / 7.1.1998 / 15:25:35 / cg" |
|
2670 |
"Created: / 14.1.1998 / 23:17:02 / cg" |
|
2671 |
! |
|
2672 |
||
255 | 2673 |
throwNullPointerException |
280 | 2674 |
self halt:'null pointer exception'. |
255 | 2675 |
self |
280 | 2676 |
throwExceptionClassName:'java.lang.NullPointerException' |
2677 |
withMessage:'null pointer' |
|
2678 |
||
255 | 2679 |
"Created: / 9.1.1998 / 02:26:08 / cg" |
280 | 2680 |
"Modified: / 28.1.1998 / 02:30:09 / cg" |
255 | 2681 |
! |
2682 |
||
2683 |
throwNumberFormatException |
|
2684 |
self |
|
261 | 2685 |
throwExceptionClassName:'java.lang.NumberFormatException' |
2686 |
withMessage:'bad number format' |
|
255 | 2687 |
|
2688 |
"Modified: / 7.1.1998 / 15:25:35 / cg" |
|
2689 |
"Created: / 11.1.1998 / 16:08:22 / cg" |
|
253 | 2690 |
! ! |
2691 |
||
2692 |
!JavaVM class methodsFor:'helpers - io'! |
|
2693 |
||
307 | 2694 |
anyStream_close:nativeContext |
2695 |
|jStream fileNo file| |
|
2696 |
||
2697 |
jStream := nativeContext receiver. |
|
2698 |
||
2699 |
fileNo := self validateFileNo:jStream. |
|
261 | 2700 |
fileNo == 0 ifTrue:[ |
280 | 2701 |
'JAVA: file is already closed' errorPrintCR. |
2702 |
^ self "/ already closed |
|
261 | 2703 |
]. |
253 | 2704 |
file := self getOpenFileAt:fileNo. |
2705 |
file isNil ifTrue:[ |
|
280 | 2706 |
self halt:'invalid fileNo in close'. |
2707 |
self internalError:'invalid fileNo in close'. |
|
2708 |
^ self |
|
253 | 2709 |
]. |
2710 |
||
2711 |
"/ should always be bytes |
|
2712 |
||
2713 |
(file ~~ Stdin |
|
2714 |
and:[file ~~ Stdout |
|
280 | 2715 |
and:[file ~~ Stderr |
2716 |
and:[file ~~ Transcript]]]) ifTrue:[ |
|
2717 |
file close. |
|
253 | 2718 |
]. |
2719 |
self setOpenFile:nil at:fileNo. |
|
2720 |
||
307 | 2721 |
fileNo := jStream instVarNamed:'fd'. |
261 | 2722 |
fileNo isInteger ifFalse:[ |
280 | 2723 |
"/ JDK 1.1.3 |
2724 |
fileNo instVarNamed:'fd' put:0. |
|
261 | 2725 |
] ifTrue:[ |
280 | 2726 |
"/ JDK 1.0 |
307 | 2727 |
jStream instVarNamed:'fd' put:0 |
2728 |
]. |
|
2729 |
||
2730 |
"Created: / 4.2.1998 / 15:22:03 / cg" |
|
374 | 2731 |
"Modified: / 14.10.1998 / 15:10:07 / cg" |
307 | 2732 |
! |
2733 |
||
2734 |
anyStream_readBytes:nativeContext |
|
2735 |
|bytes offset count stream nRead| |
|
2736 |
||
2737 |
bytes := nativeContext argAt:1. |
|
2738 |
offset := nativeContext argAt:2. |
|
2739 |
count := nativeContext argAt:3. |
|
2740 |
||
2741 |
stream := self validateFile:(nativeContext receiver). |
|
2742 |
||
2743 |
"/ should always be bytes |
|
2744 |
bytes class isBytes ifFalse:[ |
|
2745 |
self halt. |
|
2746 |
]. |
|
2747 |
stream == Stdin ifTrue:[ |
|
2748 |
self halt:'reading from standardInput ...'. |
|
432 | 2749 |
^ -1 "/ 0 |
307 | 2750 |
]. |
2751 |
||
2752 |
FileIOTrace ifTrue:[ |
|
2753 |
('JAVA: read ' , count printString , ' bytes from ' , stream pathName) infoPrintCR. |
|
2754 |
]. |
|
2755 |
||
2756 |
stream isPositionable ifFalse:[ |
|
2757 |
"/ mhmh - some kind of socket or pipe |
|
2758 |
||
2759 |
stream readWait. |
|
2760 |
]. |
|
2761 |
||
2762 |
Stream readErrorSignal handle:[:ex | |
|
2763 |
nRead := -1 |
|
2764 |
] do:[ |
|
2765 |
nRead := stream nextAvailableBytes:count into:bytes startingAt:offset+1. |
|
2766 |
]. |
|
2767 |
nRead == 0 ifTrue:[ |
|
2768 |
stream atEnd ifTrue:[ |
|
2769 |
FileIOTrace ifTrue:[ |
|
2770 |
('JAVA: at EOF ' , nRead printString) infoPrintCR. |
|
2771 |
]. |
|
2772 |
^ -1 |
|
2773 |
]. |
|
2774 |
]. |
|
2775 |
count ~~ nRead ifTrue:[ |
|
2776 |
FileIOTrace ifTrue:[ |
|
2777 |
('JAVA: only got ' , nRead printString) infoPrintCR. |
|
2778 |
] |
|
2779 |
]. |
|
2780 |
^ nRead |
|
2781 |
||
2782 |
"Created: / 4.2.1998 / 15:20:00 / cg" |
|
432 | 2783 |
"Modified: / 10.11.1998 / 19:56:47 / cg" |
307 | 2784 |
! |
2785 |
||
2786 |
anyStream_writeBytes:nativeContext |
|
2787 |
|bytes offset count stream| |
|
2788 |
||
2789 |
bytes := nativeContext argAt:1. |
|
2790 |
offset := nativeContext argAt:2. |
|
2791 |
count := nativeContext argAt:3. |
|
2792 |
||
2793 |
stream := self validateFile:(nativeContext receiver). |
|
2794 |
||
2795 |
FileIOTrace ifTrue:[ |
|
2796 |
stream isFileStream ifTrue:[ |
|
2797 |
('JAVA: write ' , count printString , ' bytes to ' , stream pathName) infoPrintCR. |
|
2798 |
] ifFalse:[ |
|
2799 |
stream ~~ Stdout ifTrue:[ |
|
2800 |
stream ~~ Stderr ifTrue:[ |
|
2801 |
('JAVA: write ' , count printString , ' bytes to ' , stream displayString) infoPrintCR. |
|
2802 |
] |
|
2803 |
] |
|
2804 |
] |
|
2805 |
]. |
|
2806 |
||
2807 |
"/ should always be bytes |
|
2808 |
Stream writeErrorSignal handle:[:ex | |
|
2809 |
ex return |
|
2810 |
] do:[ |
|
2811 |
Socket brokenConnectionSignal handle:[:ex | |
|
2812 |
ex return |
|
2813 |
] do:[ |
|
2814 |
stream nextPutBytes:count from:bytes startingAt:offset+1 |
|
507 | 2815 |
]. |
2816 |
stream == Transcript ifTrue:[ |
|
2817 |
Transcript endEntry |
|
307 | 2818 |
] |
2819 |
]. |
|
2820 |
||
2821 |
"Created: / 4.2.1998 / 15:23:58 / cg" |
|
507 | 2822 |
"Modified: / 16.2.1999 / 11:32:45 / cg" |
261 | 2823 |
! |
2824 |
||
479 | 2825 |
checkWritePermissionOfDirectory:dir message:msg |
2826 |
|answer| |
|
2827 |
||
2828 |
(PermittedDirectories notNil |
|
2829 |
and:[PermittedDirectories includes:dir]) ifFalse:[ |
|
2830 |
FileOpenConfirmation ifTrue:[ |
|
2831 |
answer := Dialog |
|
2832 |
confirmWithCancel:msg withCRs |
|
2833 |
labels:#('no' 'grant') |
|
2834 |
values:#(false true) |
|
2835 |
default:2. |
|
2836 |
answer == false ifTrue:[ |
|
2837 |
^ false |
|
2838 |
]. |
|
2839 |
||
2840 |
(self confirm:('JAVA Security check\\Always permit writes in this directory (''' , dir pathName , ''') ?') withCRs) |
|
2841 |
ifTrue:[ |
|
2842 |
PermittedDirectories isNil ifTrue:[ |
|
2843 |
PermittedDirectories := Set new |
|
2844 |
]. |
|
2845 |
PermittedDirectories add:dir. |
|
2846 |
] |
|
2847 |
] |
|
2848 |
]. |
|
2849 |
^ true |
|
2850 |
||
2851 |
"Created: / 3.12.1998 / 15:07:56 / cg" |
|
2852 |
"Modified: / 3.12.1998 / 15:16:55 / cg" |
|
2853 |
! |
|
2854 |
||
331 | 2855 |
commonOpen:nativeContext forAppend:forAppend |
442 | 2856 |
|fs fd fn name dir stream fileNo answer readonly| |
331 | 2857 |
|
2858 |
fs := nativeContext receiver. |
|
2859 |
fd := fs instVarNamed:'fd'. |
|
2860 |
(fd instVarNamed:'fd') ~~ 0 ifTrue:[ |
|
2861 |
self halt:'file already open'. |
|
2862 |
self internalError:'file already open'. |
|
2863 |
^ self. |
|
2864 |
]. |
|
2865 |
||
2866 |
name := nativeContext argAt:1. |
|
2867 |
name := Java as_ST_String:name. |
|
2868 |
||
2869 |
FileOpenTrace ifTrue:[ |
|
2870 |
('JAVA: opening ' , name) infoPrintCR. |
|
2871 |
]. |
|
2872 |
||
2873 |
fn := name asFilename. |
|
2874 |
dir := fn directory pathName. |
|
442 | 2875 |
|
508 | 2876 |
readonly := false. |
331 | 2877 |
(PermittedDirectories notNil |
2878 |
and:[PermittedDirectories includes:dir]) ifFalse:[ |
|
2879 |
FileOpenConfirmation ifTrue:[ |
|
442 | 2880 |
answer := Dialog |
2881 |
confirmWithCancel:('JAVA Security check\\Opening ''' , name , ''' for read/write.\Grant permission ?') withCRs |
|
2882 |
labels:#('no' 'grant' 'readonly') |
|
2883 |
values:#(false true #readonly) |
|
2884 |
default:3. |
|
2885 |
answer == false ifTrue:[ |
|
331 | 2886 |
self throwIOExceptionWithMessage:('no permission to open ' , name , ' for writing'). |
2887 |
^ self |
|
2888 |
]. |
|
442 | 2889 |
readonly := (answer == #readonly). |
2890 |
||
2891 |
readonly ifFalse:[ |
|
2892 |
(self confirm:('JAVA Security check\\Always permit writes in this directory (''' , dir , ''') ?') withCRs) |
|
2893 |
ifTrue:[ |
|
2894 |
PermittedDirectories isNil ifTrue:[ |
|
2895 |
PermittedDirectories := Set new |
|
2896 |
]. |
|
2897 |
PermittedDirectories add:dir. |
|
2898 |
] |
|
331 | 2899 |
] |
2900 |
] |
|
2901 |
]. |
|
2902 |
||
442 | 2903 |
readonly ifTrue:[ |
2904 |
stream := fn readStream. |
|
331 | 2905 |
] ifFalse:[ |
442 | 2906 |
forAppend ifTrue:[ |
2907 |
stream := fn appendingWriteStream. |
|
2908 |
] ifFalse:[ |
|
2909 |
stream := fn writeStream. |
|
2910 |
] |
|
331 | 2911 |
]. |
2912 |
stream isNil ifTrue:[ |
|
2913 |
self throwIOExceptionWithMessage:('cannot open ' , name , ' for writing'). |
|
2914 |
]. |
|
2915 |
||
2916 |
fileNo := self addOpenFile:stream. |
|
2917 |
||
2918 |
FileOpenTrace ifTrue:[ |
|
2919 |
('JAVA: opened ' , name , ' as FD ' , fileNo printString , ' for writing') infoPrintCR. |
|
2920 |
]. |
|
2921 |
||
2922 |
fd instVarNamed:'fd' put:fileNo. |
|
2923 |
||
2924 |
"Created: / 7.4.1998 / 19:14:09 / cg" |
|
508 | 2925 |
"Modified: / 4.1.1999 / 14:34:42 / cg" |
331 | 2926 |
! |
2927 |
||
261 | 2928 |
fileStreamForReading:name |
2929 |
|fn stream tryAlongClassPath| |
|
2930 |
||
2931 |
fn := name asFilename. |
|
2932 |
stream := fn readStream. |
|
2933 |
stream notNil ifTrue:[^ stream]. |
|
2934 |
||
2935 |
fn isAbsolute ifFalse:[ |
|
405 | 2936 |
"/ if not absolute, try along classPath |
2937 |
"/ This allows classes to open local files (JEdit) |
|
2938 |
"/ even if they have NOT been loaded by a Java classLoader. |
|
2939 |
"/ Only do this for image files |
|
2940 |
"/ (and maybe some other config files in the future), |
|
2941 |
"/ to avoid security holes. |
|
2942 |
tryAlongClassPath := true. |
|
2943 |
"/ tryAlongClassPath := false. |
|
2944 |
"/ (fn hasSuffix:'gif') ifTrue:[ |
|
2945 |
"/ tryAlongClassPath := true. |
|
2946 |
"/ ]. |
|
2947 |
"/ (fn hasSuffix:'jpg') ifTrue:[ |
|
2948 |
"/ tryAlongClassPath := true. |
|
2949 |
"/ ]. |
|
2950 |
||
2951 |
tryAlongClassPath ifTrue:[ |
|
2952 |
Java classPath do:[:dirName | |
|
2953 |
|fn| |
|
2954 |
||
2955 |
(fn := dirName asFilename construct:name) exists ifTrue:[ |
|
2956 |
stream := fn readStream. |
|
2957 |
stream notNil ifTrue:[^ stream]. |
|
2958 |
] |
|
2959 |
] |
|
2960 |
] |
|
261 | 2961 |
]. |
2962 |
^ nil. |
|
2963 |
||
405 | 2964 |
"Modified: / 21.10.1998 / 01:38:50 / cg" |
2965 |
! |
|
2966 |
||
2967 |
fixFilename:path |
|
2968 |
OperatingSystem isMSDOSlike ifTrue:[ |
|
2969 |
(#($/ $\) includes:(path at:1)) ifTrue:[ |
|
2970 |
(path at:3) == $: ifTrue:[ |
|
2971 |
^ path copyFrom:2 |
|
2972 |
] |
|
2973 |
] |
|
2974 |
]. |
|
2975 |
^ path |
|
2976 |
||
2977 |
"Created: / 20.10.1998 / 20:58:45 / cg" |
|
2978 |
"Modified: / 20.10.1998 / 21:06:49 / cg" |
|
253 | 2979 |
! |
2980 |
||
2981 |
validateFile:javaStream |
|
2982 |
|fileNo file descriptor| |
|
2983 |
||
2984 |
fileNo := self validateFileNo:javaStream. |
|
2985 |
fileNo isNil ifTrue:[ |
|
2986 |
"/ self halt:'invalid fileNo in read'. |
|
2987 |
"/ self internalError:'invalid fileNo in read'. |
|
261 | 2988 |
self throwIOExceptionWithMessage:'invalid fileNo in read'. |
2989 |
^ nil |
|
253 | 2990 |
]. |
2991 |
||
2992 |
file := self getOpenFileAt:fileNo. |
|
2993 |
||
2994 |
file isNil ifTrue:[ |
|
2995 |
"/ self halt:'invalid fileNo in read'. |
|
2996 |
"/ self internalError:'invalid fileNo in read'. |
|
261 | 2997 |
self throwIOExceptionWithMessage:'invalid fileNo in read'. |
2998 |
^ nil |
|
253 | 2999 |
]. |
3000 |
||
3001 |
^ file |
|
3002 |
||
3003 |
"Created: / 4.1.1998 / 16:50:38 / cg" |
|
3004 |
"Modified: / 4.1.1998 / 17:50:00 / cg" |
|
3005 |
! |
|
3006 |
||
3007 |
validateFileNo:javaStream |
|
3008 |
|fileNo file descriptor| |
|
3009 |
||
261 | 3010 |
"/ JDK 1.1.3 has fileDescriptor wrapped |
3011 |
"/ JDK 1.0 has it directly as integer |
|
3012 |
||
253 | 3013 |
fileNo := javaStream instVarNamed:'fd'. |
3014 |
fileNo isInteger ifFalse:[ |
|
261 | 3015 |
descriptor := fileNo. |
3016 |
fileNo := descriptor instVarNamed:'fd'. |
|
253 | 3017 |
]. |
3018 |
||
3019 |
fileNo isInteger ifFalse:[ |
|
3020 |
"/ self halt:'invalid fileNo in read'. |
|
3021 |
"/ self internalError:'invalid fileNo in read'. |
|
261 | 3022 |
self throwIOExceptionWithMessage:'invalid fileNo in read'. |
3023 |
^ nil |
|
253 | 3024 |
]. |
3025 |
||
3026 |
^ fileNo. |
|
3027 |
||
3028 |
"Created: / 4.1.1998 / 17:49:08 / cg" |
|
261 | 3029 |
"Modified: / 13.1.1998 / 14:07:47 / cg" |
253 | 3030 |
! ! |
3031 |
||
440 | 3032 |
!JavaVM class methodsFor:'native - java.awt.image'! |
3033 |
||
3034 |
_ColorModel_deletepData:nativeContext |
|
3035 |
"/ void deletepData () |
|
3036 |
UnimplementedNativeMethodSignal raise |
|
3037 |
||
3038 |
"Created: / 12.11.1998 / 19:22:05 / cg" |
|
3039 |
! ! |
|
3040 |
||
253 | 3041 |
!JavaVM class methodsFor:'native - java.io'! |
3042 |
||
3043 |
_FileDescriptor_initSystemFD:nativeContext |
|
3044 |
|descriptor fileNo idx myStream| |
|
3045 |
||
3046 |
descriptor := nativeContext argAt:1. |
|
3047 |
fileNo := nativeContext argAt:2. |
|
3048 |
||
3049 |
fileNo == 0 ifTrue:[ |
|
277 | 3050 |
myStream := Stdin |
253 | 3051 |
] ifFalse:[ |
277 | 3052 |
fileNo == 1 ifTrue:[ |
3053 |
myStream := JavaConsoleStream ? Stdout |
|
3054 |
] ifFalse:[ |
|
3055 |
fileNo == 2 ifTrue:[ |
|
3056 |
myStream := JavaConsoleStream ? Stderr |
|
3057 |
] ifFalse:[ |
|
3058 |
self halt:'invalid fileNo given'. |
|
3059 |
self internalError:'invalid fileNo given'. |
|
3060 |
] |
|
3061 |
] |
|
253 | 3062 |
]. |
3063 |
||
3064 |
self setOpenFile:myStream at:fileNo. |
|
3065 |
||
3066 |
descriptor instVarNamed:'fd' put:fileNo. |
|
3067 |
^ descriptor |
|
3068 |
||
277 | 3069 |
"Modified: / 27.1.1998 / 18:15:28 / cg" |
253 | 3070 |
! |
3071 |
||
440 | 3072 |
_FileDescriptor_sync:nativeContext |
3073 |
"/ void sync () |
|
3074 |
UnimplementedNativeMethodSignal raise |
|
3075 |
||
3076 |
"Modified: / 12.11.1998 / 18:57:39 / cg" |
|
3077 |
"Created: / 12.11.1998 / 19:26:25 / cg" |
|
3078 |
! |
|
3079 |
||
3080 |
_FileDescriptor_valid:nativeContext |
|
3081 |
"/ boolean valid () |
|
495 | 3082 |
|descriptor fileNo stream| |
3083 |
||
3084 |
descriptor := nativeContext receiver. |
|
3085 |
fileNo := descriptor instVarNamed:'fd'. |
|
3086 |
stream := self getOpenFileAt:fileNo. |
|
3087 |
stream isNil ifTrue:[^ 0]. "/ FALSE |
|
3088 |
stream isOpen ifFalse:[^ 0]. "/ FALSE |
|
3089 |
||
3090 |
^ 1 "/ TRUE |
|
3091 |
||
3092 |
"Modified: / 11.12.1998 / 13:02:47 / cg" |
|
440 | 3093 |
! |
3094 |
||
261 | 3095 |
_FileInputStream_available:nativeContext |
3096 |
|file| |
|
3097 |
||
3098 |
file := self validateFile:(nativeContext receiver). |
|
3099 |
file isNil ifTrue:[ |
|
3100 |
self throwIOExceptionWithMessage:'invalid fileNo in available'. |
|
3101 |
^ self |
|
3102 |
]. |
|
3103 |
file isFileStream ifTrue:[ |
|
3104 |
^ file size - file position + 1 |
|
3105 |
]. |
|
3106 |
file atEnd ifTrue:[ |
|
3107 |
^ 0. |
|
3108 |
]. |
|
3109 |
self halt. |
|
3110 |
^ 1 |
|
3111 |
||
3112 |
"Modified: / 14.1.1998 / 15:12:52 / cg" |
|
3113 |
! |
|
3114 |
||
253 | 3115 |
_FileInputStream_close:nativeContext |
307 | 3116 |
^ self anyStream_close:nativeContext |
3117 |
||
253 | 3118 |
"Created: / 4.1.1998 / 17:45:23 / cg" |
307 | 3119 |
"Modified: / 4.2.1998 / 15:20:46 / cg" |
253 | 3120 |
! |
3121 |
||
3122 |
_FileInputStream_open:nativeContext |
|
261 | 3123 |
|fs fd fn name stream fileNo| |
253 | 3124 |
|
3125 |
fs := nativeContext receiver. |
|
3126 |
fd := fs instVarNamed:'fd'. |
|
277 | 3127 |
(fileNo := fd instVarNamed:'fd') ~~ 0 ifTrue:[ |
3128 |
fileNo ~~ -1 ifTrue:[ |
|
3129 |
self halt:'file already open'. |
|
3130 |
self internalError:'file already open'. |
|
3131 |
^ self. |
|
3132 |
] |
|
253 | 3133 |
]. |
3134 |
||
3135 |
name := nativeContext argAt:1. |
|
3136 |
name := Java as_ST_String:name. |
|
3137 |
||
405 | 3138 |
name := self fixFilename:name. |
3139 |
||
253 | 3140 |
FileOpenTrace ifTrue:[ |
277 | 3141 |
('JAVA: opening ' , name) infoPrintCR. |
253 | 3142 |
]. |
3143 |
||
261 | 3144 |
stream := self fileStreamForReading:name. |
253 | 3145 |
stream isNil ifTrue:[ |
277 | 3146 |
FileOpenTrace ifTrue:[ |
479 | 3147 |
('JAVA: failed to open ''' , name , ''' for reading.') infoPrintCR. |
277 | 3148 |
]. |
3149 |
||
3150 |
self throwIOExceptionWithMessage:('cannot open ' , name , ' for reading'). |
|
3151 |
||
3152 |
^ self. |
|
253 | 3153 |
]. |
304 | 3154 |
stream buffered:false. |
253 | 3155 |
|
261 | 3156 |
"/ FileOpenConfirmation ifTrue:[ |
3157 |
"/ (self confirm:('JAVA Security check\\Opening ''' , name , ''' for reading.\Grant permission ?') withCRs) |
|
3158 |
"/ ifFalse:[ |
|
3159 |
"/ self throwIOExceptionWithMessage:('no permission to open ' , name , ' for reading'). |
|
3160 |
"/ ^ self |
|
3161 |
"/ ] |
|
3162 |
"/ ]. |
|
3163 |
||
253 | 3164 |
fileNo := self addOpenFile:stream. |
3165 |
||
3166 |
FileOpenTrace ifTrue:[ |
|
277 | 3167 |
('JAVA: opened ' , name , ' as FD ' , fileNo printString) infoPrintCR. |
253 | 3168 |
]. |
3169 |
||
3170 |
fd instVarNamed:'fd' put:fileNo. |
|
3171 |
||
3172 |
"Created: / 4.1.1998 / 16:47:12 / cg" |
|
479 | 3173 |
"Modified: / 3.12.1998 / 15:13:51 / cg" |
253 | 3174 |
! |
3175 |
||
3176 |
_FileInputStream_read:nativeContext |
|
3177 |
|file byte| |
|
3178 |
||
3179 |
file := self validateFile:(nativeContext receiver). |
|
3180 |
||
3181 |
FileIOTrace ifTrue:[ |
|
261 | 3182 |
('JAVA: read 1 byte from ' , file pathName) infoPrintCR. |
253 | 3183 |
]. |
3184 |
||
3185 |
byte := file nextByte. |
|
3186 |
byte isNil ifTrue:[ |
|
261 | 3187 |
^ -1 |
253 | 3188 |
]. |
3189 |
^ byte |
|
3190 |
||
3191 |
"Created: / 5.1.1998 / 02:17:08 / cg" |
|
3192 |
"Modified: / 5.1.1998 / 02:17:25 / cg" |
|
3193 |
! |
|
3194 |
||
3195 |
_FileInputStream_readBytes:nativeContext |
|
307 | 3196 |
^ self anyStream_readBytes:nativeContext |
3197 |
||
3198 |
"Modified: / 4.2.1998 / 15:23:08 / cg" |
|
261 | 3199 |
! |
3200 |
||
440 | 3201 |
_FileInputStream_skip:nativeContext |
3202 |
"/ long skip (long) |
|
3203 |
UnimplementedNativeMethodSignal raise |
|
3204 |
||
3205 |
"Created: / 12.11.1998 / 18:57:12 / cg" |
|
3206 |
"Modified: / 12.11.1998 / 18:57:48 / cg" |
|
3207 |
! |
|
3208 |
||
261 | 3209 |
_FileOutputStream_close:nativeContext |
307 | 3210 |
^ self anyStream_close:nativeContext |
3211 |
||
261 | 3212 |
"Created: / 13.1.1998 / 09:33:16 / cg" |
307 | 3213 |
"Modified: / 4.2.1998 / 15:20:53 / cg" |
261 | 3214 |
! |
3215 |
||
3216 |
_FileOutputStream_open:nativeContext |
|
331 | 3217 |
^ self commonOpen:nativeContext forAppend:false |
3218 |
||
3219 |
"Modified: / 7.4.1998 / 19:14:31 / cg" |
|
3220 |
! |
|
3221 |
||
3222 |
_FileOutputStream_openAppend:nativeContext |
|
3223 |
^ self commonOpen:nativeContext forAppend:true |
|
3224 |
||
3225 |
"Modified: / 7.4.1998 / 19:13:42 / cg" |
|
261 | 3226 |
! |
3227 |
||
3228 |
_FileOutputStream_write:nativeContext |
|
3229 |
|byte file| |
|
3230 |
||
3231 |
byte := nativeContext argAt:1. |
|
3232 |
||
3233 |
file := self validateFile:(nativeContext receiver). |
|
3234 |
||
3235 |
FileIOTrace ifTrue:[ |
|
3236 |
file isFileStream ifTrue:[ |
|
3237 |
('JAVA: write 1 byte to ' , file pathName) infoPrintCR. |
|
3238 |
] ifFalse:[ |
|
3239 |
file ~~ Stdout ifTrue:[ |
|
3240 |
file ~~ Stderr ifTrue:[ |
|
3241 |
('JAVA: write 1 byte to ' , file displayString) infoPrintCR. |
|
3242 |
] |
|
3243 |
] |
|
3244 |
] |
|
3245 |
]. |
|
3246 |
||
3247 |
"/ should always be bytes |
|
3248 |
||
3249 |
file nextPutByte:byte |
|
3250 |
||
3251 |
"Created: / 13.1.1998 / 09:32:13 / cg" |
|
3252 |
"Modified: / 13.1.1998 / 09:32:31 / cg" |
|
253 | 3253 |
! |
3254 |
||
255 | 3255 |
_FileOutputStream_writeBytes:nativeContext |
307 | 3256 |
^ self anyStream_writeBytes:nativeContext |
3257 |
||
3258 |
"Modified: / 4.2.1998 / 15:24:20 / cg" |
|
255 | 3259 |
! |
3260 |
||
253 | 3261 |
_File_canRead0:nativeContext |
3262 |
|file path f| |
|
3263 |
||
3264 |
file := nativeContext receiver. |
|
3265 |
path := file instVarNamed:'path'. |
|
3266 |
path notNil ifTrue:[ |
|
405 | 3267 |
path := Java as_ST_String:path. |
3268 |
path := self fixFilename:path. |
|
3269 |
(f := path asFilename) isReadable ifTrue:[ |
|
3270 |
^ 1 "/ TRUE |
|
3271 |
] |
|
253 | 3272 |
]. |
255 | 3273 |
^ 0 "/ FALSE |
3274 |
||
253 | 3275 |
"Created: / 4.1.1998 / 18:09:55 / cg" |
405 | 3276 |
"Modified: / 20.10.1998 / 20:59:39 / cg" |
253 | 3277 |
! |
3278 |
||
307 | 3279 |
_File_canWrite0:nativeContext |
3280 |
|file path f| |
|
3281 |
||
3282 |
file := nativeContext receiver. |
|
3283 |
path := file instVarNamed:'path'. |
|
3284 |
path notNil ifTrue:[ |
|
3285 |
path := Java as_ST_String:path. |
|
405 | 3286 |
path := self fixFilename:path. |
307 | 3287 |
(f := path asFilename) isWritable ifTrue:[ |
3288 |
^ 1 "/ TRUE |
|
3289 |
] |
|
3290 |
]. |
|
3291 |
^ 0 "/ FALSE |
|
3292 |
||
3293 |
"Created: / 4.2.1998 / 00:19:55 / cg" |
|
405 | 3294 |
"Modified: / 20.10.1998 / 20:59:45 / cg" |
307 | 3295 |
! |
3296 |
||
440 | 3297 |
_File_delete0:nativeContext |
3298 |
"/ boolean delete0 () |
|
480 | 3299 |
|oldFile oldPath oldF| |
3300 |
||
3301 |
oldFile := nativeContext receiver. |
|
3302 |
oldPath := oldFile instVarNamed:'path'. |
|
3303 |
oldPath isNil ifTrue:[^ 0]. "/ FALSE |
|
3304 |
||
3305 |
oldPath := Java as_ST_String:oldPath. |
|
3306 |
oldF := oldPath asFilename. |
|
3307 |
||
508 | 3308 |
oldF exists ifFalse:[ |
3309 |
^ 1 "/ TRUE |
|
3310 |
]. |
|
3311 |
||
480 | 3312 |
(self checkWritePermissionOfDirectory:oldF directory message:('JAVA Security check\\Delete of ''' , oldPath , '''.\Grant permission ?')) |
3313 |
ifFalse:[ |
|
3314 |
^ 0 "/ FALSE |
|
3315 |
]. |
|
3316 |
||
3317 |
OperatingSystem accessDeniedErrorSignal handle:[:ex | |
|
3318 |
^ 0 "/ FALSE |
|
3319 |
] do:[ |
|
3320 |
oldF delete. |
|
3321 |
^ 1 "/ TRUE |
|
3322 |
]. |
|
3323 |
^ 0 "/ FALSE |
|
3324 |
||
508 | 3325 |
"Modified: / 30.12.1998 / 20:15:06 / cg" |
440 | 3326 |
! |
3327 |
||
253 | 3328 |
_File_exists0:nativeContext |
3329 |
|file path f| |
|
3330 |
||
3331 |
file := nativeContext receiver. |
|
3332 |
path := file instVarNamed:'path'. |
|
3333 |
path notNil ifTrue:[ |
|
405 | 3334 |
path := Java as_ST_String:path. |
3335 |
path := self fixFilename:path. |
|
3336 |
(f := path asFilename) exists ifTrue:[ |
|
3337 |
^ 1 "TRUE" |
|
3338 |
] |
|
255 | 3339 |
]. |
3340 |
^ 0 "FALSE" |
|
3341 |
||
3342 |
"Created: / 5.1.1998 / 02:07:48 / cg" |
|
405 | 3343 |
"Modified: / 20.10.1998 / 20:59:49 / cg" |
255 | 3344 |
! |
3345 |
||
3346 |
_File_isAbsolute:nativeContext |
|
3347 |
|file path f| |
|
3348 |
||
3349 |
file := nativeContext receiver. |
|
3350 |
path := file instVarNamed:'path'. |
|
3351 |
path notNil ifTrue:[ |
|
405 | 3352 |
path := Java as_ST_String:path. |
3353 |
path := self fixFilename:path. |
|
3354 |
(f := path asFilename) isAbsolute ifTrue:[ |
|
3355 |
^ 1 "/ TRUE |
|
3356 |
] |
|
255 | 3357 |
]. |
3358 |
^ 0 "/ FALSE |
|
3359 |
||
3360 |
"Created: / 11.1.1998 / 09:54:38 / cg" |
|
405 | 3361 |
"Modified: / 20.10.1998 / 20:59:53 / cg" |
255 | 3362 |
! |
3363 |
||
3364 |
_File_isDirectory0:nativeContext |
|
3365 |
|file path f| |
|
3366 |
||
3367 |
file := nativeContext receiver. |
|
3368 |
path := file instVarNamed:'path'. |
|
3369 |
path notNil ifTrue:[ |
|
405 | 3370 |
path := Java as_ST_String:path. |
3371 |
path := self fixFilename:path. |
|
3372 |
(f := path asFilename) exists ifTrue:[ |
|
3373 |
f isDirectory ifTrue:[^ 1 "TRUE"] |
|
3374 |
] |
|
255 | 3375 |
]. |
3376 |
^ 0 "FALSE" |
|
3377 |
||
3378 |
"Created: / 7.1.1998 / 10:31:37 / cg" |
|
405 | 3379 |
"Modified: / 20.10.1998 / 20:59:56 / cg" |
255 | 3380 |
! |
3381 |
||
3382 |
_File_isFile0:nativeContext |
|
3383 |
|file path f| |
|
3384 |
||
3385 |
file := nativeContext receiver. |
|
3386 |
path := file instVarNamed:'path'. |
|
3387 |
path notNil ifTrue:[ |
|
405 | 3388 |
path := Java as_ST_String:path. |
3389 |
path := self fixFilename:path. |
|
3390 |
(f := path asFilename) exists ifTrue:[ |
|
3391 |
f isDirectory ifFalse:[^ 1 "TRUE"] |
|
3392 |
] |
|
255 | 3393 |
]. |
3394 |
^ 0 "/ FALSE |
|
3395 |
||
3396 |
"Created: / 11.1.1998 / 11:40:22 / cg" |
|
405 | 3397 |
"Modified: / 20.10.1998 / 21:00:00 / cg" |
255 | 3398 |
! |
3399 |
||
307 | 3400 |
_File_lastModified0:nativeContext |
3401 |
|file path f| |
|
3402 |
||
3403 |
file := nativeContext receiver. |
|
3404 |
path := file instVarNamed:'path'. |
|
3405 |
path notNil ifTrue:[ |
|
3406 |
path := Java as_ST_String:path. |
|
405 | 3407 |
path := self fixFilename:path. |
307 | 3408 |
(f := path asFilename) exists ifTrue:[ |
3409 |
^ f modificationTime getMilliseconds. |
|
3410 |
] |
|
3411 |
]. |
|
3412 |
^ 0 |
|
3413 |
||
3414 |
"Created: / 4.2.1998 / 16:50:30 / cg" |
|
405 | 3415 |
"Modified: / 20.10.1998 / 21:00:05 / cg" |
307 | 3416 |
! |
3417 |
||
255 | 3418 |
_File_length0:nativeContext |
3419 |
|file path f| |
|
3420 |
||
3421 |
file := nativeContext receiver. |
|
3422 |
path := file instVarNamed:'path'. |
|
3423 |
path notNil ifTrue:[ |
|
405 | 3424 |
path := Java as_ST_String:path. |
3425 |
path := self fixFilename:path. |
|
3426 |
(f := path asFilename) exists ifTrue:[ |
|
3427 |
^ f fileSize |
|
3428 |
] |
|
253 | 3429 |
]. |
261 | 3430 |
^ -1 |
3431 |
||
255 | 3432 |
"Created: / 7.1.1998 / 12:18:57 / cg" |
405 | 3433 |
"Modified: / 20.10.1998 / 21:00:18 / cg" |
261 | 3434 |
! |
3435 |
||
3436 |
_File_list0:nativeContext |
|
3437 |
|file path f files| |
|
3438 |
||
3439 |
file := nativeContext receiver. |
|
3440 |
path := file instVarNamed:'path'. |
|
3441 |
path notNil ifTrue:[ |
|
405 | 3442 |
path := Java as_ST_String:path. |
3443 |
path := self fixFilename:path. |
|
3444 |
(f := path asFilename) exists ifTrue:[ |
|
3445 |
f isDirectory ifTrue:[ |
|
3446 |
files := f directoryContents asArray. |
|
3447 |
files := files collect:[:nm | Java as_String:nm]. |
|
3448 |
^ files |
|
3449 |
] |
|
3450 |
] |
|
261 | 3451 |
]. |
3452 |
^ nil |
|
3453 |
||
3454 |
"Created: / 14.1.1998 / 21:30:22 / cg" |
|
405 | 3455 |
"Modified: / 20.10.1998 / 21:00:21 / cg" |
307 | 3456 |
! |
3457 |
||
3458 |
_File_mkdir0:nativeContext |
|
3459 |
|file path f| |
|
3460 |
||
3461 |
file := nativeContext receiver. |
|
3462 |
path := file instVarNamed:'path'. |
|
3463 |
path notNil ifTrue:[ |
|
3464 |
path := Java as_ST_String:path. |
|
405 | 3465 |
path := self fixFilename:path. |
482 | 3466 |
f := path asFilename. |
3467 |
(f exists and:[f isDirectory]) ifTrue:[ |
|
3468 |
^ 0 "/ FALSE |
|
3469 |
]. |
|
3470 |
||
307 | 3471 |
FileOpenConfirmation ifTrue:[ |
3472 |
(self confirm:('JAVA Security check\\Create directory ''' , path , '''.\Grant permission ?') withCRs) |
|
3473 |
ifFalse:[ |
|
3474 |
^ 0 "/ FALSE |
|
3475 |
] |
|
3476 |
]. |
|
3477 |
OperatingSystem accessDeniedErrorSignal handle:[:ex | |
|
3478 |
^ 0 "/ FALSE |
|
3479 |
] do:[ |
|
3480 |
f makeDirectory. |
|
3481 |
]. |
|
3482 |
f exists ifTrue:[ |
|
3483 |
f isDirectory ifTrue:[^ 1 "TRUE"] |
|
3484 |
] |
|
3485 |
]. |
|
3486 |
^ 0 "FALSE" |
|
3487 |
||
3488 |
"Created: / 4.2.1998 / 00:19:05 / cg" |
|
482 | 3489 |
"Modified: / 4.12.1998 / 14:04:03 / cg" |
307 | 3490 |
! |
3491 |
||
440 | 3492 |
_File_renameTo0:nativeContext |
479 | 3493 |
"/ void renameTo0 (java.io.File) |
3494 |
||
3495 |
|oldFile newFile oldPath newPath oldF newF| |
|
3496 |
||
3497 |
oldFile := nativeContext receiver. |
|
3498 |
oldPath := oldFile instVarNamed:'path'. |
|
480 | 3499 |
oldPath isNil ifTrue:[^ 0]. "/ FALSE |
3500 |
||
3501 |
oldPath := Java as_ST_String:oldPath. |
|
3502 |
oldF := oldPath asFilename. |
|
3503 |
||
3504 |
newFile := nativeContext argAt:1. |
|
3505 |
newPath := newFile instVarNamed:'path'. |
|
3506 |
newPath isNil ifTrue:[^ 0]. "/ FALSE |
|
3507 |
newPath := Java as_ST_String:newPath. |
|
3508 |
||
3509 |
newF := newPath asFilename. |
|
3510 |
||
3511 |
(self checkWritePermissionOfDirectory:oldF directory message:('JAVA Security check\\Rename of ''' , oldPath , ''' to ''' , newPath , '''.\Grant permission ?')) |
|
3512 |
ifFalse:[ |
|
3513 |
^ 0 "/ FALSE |
|
3514 |
]. |
|
3515 |
oldF directory pathName ~= newF directory pathName ifTrue:[ |
|
3516 |
(self checkWritePermissionOfDirectory:newF directory message:('JAVA Security check\\Rename of ''' , oldPath , ''' to ''' , newPath , '''.\Grant permission ?')) |
|
3517 |
ifFalse:[ |
|
3518 |
^ 0 "/ FALSE |
|
3519 |
]. |
|
3520 |
]. |
|
3521 |
||
3522 |
OperatingSystem accessDeniedErrorSignal handle:[:ex | |
|
3523 |
^ 0 "/ FALSE |
|
3524 |
] do:[ |
|
3525 |
oldF renameTo:newF. |
|
3526 |
^ 1 "/ TRUE |
|
3527 |
]. |
|
3528 |
^ 0 "/ FALSE |
|
3529 |
||
3530 |
"Modified: / 3.12.1998 / 21:01:08 / cg" |
|
440 | 3531 |
! |
3532 |
||
3533 |
_File_rmdir0:nativeContext |
|
3534 |
"/ boolean rmdir0 () |
|
3535 |
UnimplementedNativeMethodSignal raise |
|
3536 |
||
3537 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3538 |
"Created: / 12.11.1998 / 19:03:52 / cg" |
|
3539 |
! |
|
3540 |
||
3541 |
_ObjectInputStream_allocateNewArray:nativeContext |
|
3542 |
"/ java.lang.Object allocateNewArray (java.lang.Class int) |
|
3543 |
UnimplementedNativeMethodSignal raise |
|
3544 |
||
3545 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3546 |
"Created: / 12.11.1998 / 19:02:52 / cg" |
|
3547 |
! |
|
3548 |
||
3549 |
_ObjectInputStream_allocateNewObject:nativeContext |
|
3550 |
"/ java.lang.Object allocateNewObject (java.lang.Class java.lang.Class) |
|
3551 |
UnimplementedNativeMethodSignal raise |
|
3552 |
||
3553 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3554 |
"Created: / 12.11.1998 / 19:02:40 / cg" |
|
3555 |
! |
|
3556 |
||
3557 |
_ObjectInputStream_inputClassFields:nativeContext |
|
3558 |
"/ void inputClassFields (java.lang.Object java.lang.Class int[]) |
|
3559 |
UnimplementedNativeMethodSignal raise |
|
3560 |
||
3561 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3562 |
"Created: / 12.11.1998 / 19:02:22 / cg" |
|
3563 |
! |
|
3564 |
||
3565 |
_ObjectInputStream_invokeObjectReader:nativeContext |
|
3566 |
"/ boolean invokeObjectReader (java.lang.Object java.lang.Class) |
|
3567 |
UnimplementedNativeMethodSignal raise |
|
3568 |
||
3569 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3570 |
"Created: / 12.11.1998 / 19:03:06 / cg" |
|
3571 |
! |
|
3572 |
||
3573 |
_ObjectInputStream_loadClass0:nativeContext |
|
3574 |
"/ java.lang.Class loadClass0 (java.lang.Class java.lang.String) |
|
3575 |
UnimplementedNativeMethodSignal raise |
|
3576 |
||
3577 |
"Created: / 12.11.1998 / 19:01:15 / cg" |
|
3578 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3579 |
! |
|
3580 |
||
3581 |
_ObjectOutputStream_invokeObjectWriter:nativeContext |
|
3582 |
"/ boolean invokeObjectWriter (java.lang.Object java.lang.Class) |
|
3583 |
UnimplementedNativeMethodSignal raise |
|
3584 |
||
3585 |
"Created: / 12.11.1998 / 19:00:36 / cg" |
|
3586 |
"Modified: / 12.11.1998 / 19:01:45 / cg" |
|
3587 |
! |
|
3588 |
||
3589 |
_ObjectOutputStream_outputClassFields:nativeContext |
|
3590 |
"/ void outputClassFields (java.lang.Object java.lang.Class int[]) |
|
3591 |
UnimplementedNativeMethodSignal raise |
|
3592 |
||
3593 |
"Created: / 12.11.1998 / 19:00:09 / cg" |
|
3594 |
"Modified: / 12.11.1998 / 19:01:42 / cg" |
|
3595 |
! |
|
3596 |
||
3597 |
_ObjectStreamClass_getClassAccess:nativeContext |
|
3598 |
"/ int getClassAccess (java.lang.Class) |
|
3599 |
UnimplementedNativeMethodSignal raise |
|
3600 |
||
3601 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3602 |
"Created: / 12.11.1998 / 19:04:19 / cg" |
|
3603 |
! |
|
3604 |
||
3605 |
_ObjectStreamClass_getFieldAccess:nativeContext |
|
3606 |
"/ int getFieldAccess (java.lang.Class java.lang.String) |
|
3607 |
UnimplementedNativeMethodSignal raise |
|
3608 |
||
3609 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3610 |
"Created: / 12.11.1998 / 19:05:19 / cg" |
|
3611 |
! |
|
3612 |
||
3613 |
_ObjectStreamClass_getFieldSignatures:nativeContext |
|
3614 |
"/ java.lang.String[] getFieldSignatures (java.lang.Class) |
|
3615 |
UnimplementedNativeMethodSignal raise |
|
3616 |
||
3617 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3618 |
"Created: / 12.11.1998 / 19:05:04 / cg" |
|
3619 |
! |
|
3620 |
||
3621 |
_ObjectStreamClass_getFields0:nativeContext |
|
3622 |
"/ java.io.ObjectStreamField[] getFields0 (java.lang.Class) |
|
3623 |
UnimplementedNativeMethodSignal raise |
|
3624 |
||
3625 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3626 |
"Created: / 12.11.1998 / 19:05:32 / cg" |
|
3627 |
! |
|
3628 |
||
3629 |
_ObjectStreamClass_getMethodAccess:nativeContext |
|
3630 |
"/ int getMethodAccess (java.lang.Class java.lang.String) |
|
3631 |
UnimplementedNativeMethodSignal raise |
|
3632 |
||
3633 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3634 |
"Created: / 12.11.1998 / 19:04:51 / cg" |
|
3635 |
! |
|
3636 |
||
3637 |
_ObjectStreamClass_getMethodSignatures:nativeContext |
|
3638 |
"/ java.lang.String[] getMethodSignatures (java.lang.Class) |
|
3639 |
UnimplementedNativeMethodSignal raise |
|
3640 |
||
3641 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3642 |
"Created: / 12.11.1998 / 19:04:34 / cg" |
|
3643 |
! |
|
3644 |
||
3645 |
_ObjectStreamClass_getSerialVersionUID:nativeContext |
|
3646 |
"/ long getSerialVersionUID (java.lang.Class) |
|
3647 |
UnimplementedNativeMethodSignal raise |
|
3648 |
||
3649 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3650 |
"Created: / 12.11.1998 / 19:05:43 / cg" |
|
3651 |
! |
|
3652 |
||
3653 |
_ObjectStreamClass_hasWriteObject:nativeContext |
|
3654 |
"/ boolean hasWriteObject (java.lang.Class) |
|
3655 |
UnimplementedNativeMethodSignal raise |
|
3656 |
||
3657 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3658 |
"Created: / 12.11.1998 / 19:05:53 / cg" |
|
3659 |
! |
|
3660 |
||
307 | 3661 |
_RandomAccessFile_close:nativeContext |
3662 |
^ self anyStream_close:nativeContext |
|
3663 |
||
3664 |
"Created: / 4.2.1998 / 13:26:53 / cg" |
|
3665 |
"Modified: / 4.2.1998 / 15:21:08 / cg" |
|
3666 |
! |
|
3667 |
||
3668 |
_RandomAccessFile_length:nativeContext |
|
3669 |
|file sz| |
|
3670 |
||
3671 |
file := self validateFile:(nativeContext receiver). |
|
3672 |
||
3673 |
FileIOTrace ifTrue:[ |
|
3674 |
('JAVA: length of ' , file pathName) infoPrintCR. |
|
3675 |
]. |
|
3676 |
||
3677 |
sz := file size. |
|
3678 |
^ sz. |
|
3679 |
||
3680 |
"Created: / 4.2.1998 / 13:27:58 / cg" |
|
3681 |
! |
|
3682 |
||
3683 |
_RandomAccessFile_open:nativeContext |
|
442 | 3684 |
|fs fd name dir stream fileNo answer readonly| |
3685 |
||
3686 |
readonly := false. |
|
307 | 3687 |
|
3688 |
fs := nativeContext receiver. |
|
3689 |
fd := fs instVarNamed:'fd'. |
|
3690 |
(fd instVarNamed:'fd') ~~ 0 ifTrue:[ |
|
3691 |
self halt:'file already open'. |
|
3692 |
self internalError:'file already open'. |
|
3693 |
^ self. |
|
3694 |
]. |
|
3695 |
||
3696 |
name := nativeContext argAt:1. |
|
3697 |
name := Java as_ST_String:name. |
|
405 | 3698 |
name := self fixFilename:name. |
307 | 3699 |
|
3700 |
FileOpenTrace ifTrue:[ |
|
3701 |
('JAVA: opening ' , name) infoPrintCR. |
|
3702 |
]. |
|
3703 |
||
3704 |
dir := name asFilename directory pathName. |
|
442 | 3705 |
|
307 | 3706 |
(PermittedDirectories notNil |
3707 |
and:[PermittedDirectories includes:dir]) ifFalse:[ |
|
3708 |
FileOpenConfirmation ifTrue:[ |
|
442 | 3709 |
answer := Dialog |
3710 |
confirmWithCancel:('JAVA Security check\\Opening ''' , name , ''' for read/write.\Grant permission ?') withCRs |
|
3711 |
labels:#('no' 'grant' 'readonly') |
|
3712 |
values:#(false true #readonly) |
|
3713 |
default:3. |
|
3714 |
answer == false ifTrue:[ |
|
307 | 3715 |
self throwIOExceptionWithMessage:('no permission to open ' , name , ' for writing'). |
3716 |
^ self |
|
3717 |
]. |
|
442 | 3718 |
readonly := (answer == #readonly). |
3719 |
||
3720 |
readonly ifFalse:[ |
|
3721 |
(self confirm:('JAVA Security check\\Always permit writes in this directory (''' , dir , ''') ?') withCRs) |
|
3722 |
ifTrue:[ |
|
3723 |
PermittedDirectories isNil ifTrue:[ |
|
3724 |
PermittedDirectories := Set new |
|
3725 |
]. |
|
3726 |
PermittedDirectories add:dir. |
|
3727 |
] |
|
307 | 3728 |
] |
3729 |
] |
|
3730 |
]. |
|
3731 |
||
442 | 3732 |
readonly ifTrue:[ |
3733 |
stream := name asFilename readStream. |
|
3734 |
] ifFalse:[ |
|
3735 |
stream := name asFilename readWriteStream. |
|
3736 |
]. |
|
307 | 3737 |
stream isNil ifTrue:[ |
3738 |
self throwIOExceptionWithMessage:('cannot open ' , name , ' for writing'). |
|
3739 |
]. |
|
3740 |
||
3741 |
fileNo := self addOpenFile:stream. |
|
3742 |
||
3743 |
FileOpenTrace ifTrue:[ |
|
3744 |
('JAVA: opened ' , name , ' as FD ' , fileNo printString , ' for writing') infoPrintCR. |
|
3745 |
]. |
|
3746 |
||
3747 |
fd instVarNamed:'fd' put:fileNo. |
|
3748 |
||
3749 |
"Created: / 4.2.1998 / 00:14:48 / cg" |
|
442 | 3750 |
"Modified: / 12.11.1998 / 21:29:46 / cg" |
307 | 3751 |
! |
3752 |
||
3753 |
_RandomAccessFile_readBytes:nativeContext |
|
3754 |
^ self anyStream_readBytes:nativeContext |
|
3755 |
||
3756 |
"Modified: / 4.2.1998 / 15:23:27 / cg" |
|
3757 |
! |
|
3758 |
||
3759 |
_RandomAccessFile_seek:nativeContext |
|
3760 |
|file pos| |
|
3761 |
||
3762 |
file := self validateFile:(nativeContext receiver). |
|
3763 |
||
3764 |
FileIOTrace ifTrue:[ |
|
3765 |
('JAVA: seek on ' , file pathName) infoPrintCR. |
|
3766 |
]. |
|
3767 |
||
3768 |
pos := nativeContext argAt:1. |
|
3769 |
file position:pos+1 "/ ST/X position starts at 1 |
|
3770 |
||
3771 |
"Created: / 4.2.1998 / 13:25:38 / cg" |
|
3772 |
"Modified: / 4.2.1998 / 13:28:12 / cg" |
|
3773 |
! |
|
3774 |
||
3775 |
_RandomAccessFile_writeBytes:nativeContext |
|
3776 |
^ self anyStream_writeBytes:nativeContext |
|
3777 |
||
3778 |
"Modified: / 4.2.1998 / 15:24:20 / cg" |
|
3779 |
"Created: / 4.2.1998 / 15:24:35 / cg" |
|
253 | 3780 |
! ! |
3781 |
||
277 | 3782 |
!JavaVM class methodsFor:'native - java.io - jdk1.2'! |
3783 |
||
3784 |
_FileDescriptor_initIDs:nativeContext |
|
3785 |
"/ introduced with jdk1.2 ... (sigh) |
|
3786 |
||
3787 |
"Created: / 27.1.1998 / 18:16:29 / cg" |
|
3788 |
! |
|
3789 |
||
3790 |
_FileInputStream_initIDs:nativeContext |
|
3791 |
"/ introduced with jdk1.2 ... (sigh) |
|
3792 |
||
3793 |
"Created: / 27.1.1998 / 18:15:51 / cg" |
|
3794 |
! |
|
3795 |
||
3796 |
_FileOutputStream_initIDs:nativeContext |
|
3797 |
"/ introduced with jdk1.2 ... (sigh) |
|
3798 |
||
3799 |
"Created: / 27.1.1998 / 18:16:40 / cg" |
|
3800 |
! |
|
3801 |
||
3802 |
_File_canonPath:nativeContext |
|
3803 |
"/ introduced with jdk1.2 ... (sigh) |
|
3804 |
||
3805 |
|jPath path realPath| |
|
3806 |
||
3807 |
jPath := nativeContext argAt:1. |
|
3808 |
jPath isNil ifTrue:[^ jPath]. |
|
3809 |
||
3810 |
path := Java as_ST_String:jPath. |
|
3811 |
realPath := path asFilename pathName. |
|
3812 |
||
3813 |
^ Java as_String:realPath |
|
3814 |
||
3815 |
"Created: / 27.1.1998 / 18:35:58 / cg" |
|
3816 |
"Modified: / 27.1.1998 / 21:36:03 / cg" |
|
3817 |
! |
|
3818 |
||
3819 |
_File_initIDs:nativeContext |
|
3820 |
"/ introduced with jdk1.2 ... (sigh) |
|
3821 |
||
3822 |
"Created: / 27.1.1998 / 18:25:19 / cg" |
|
3823 |
! ! |
|
3824 |
||
253 | 3825 |
!JavaVM class methodsFor:'native - java.lang'! |
3826 |
||
255 | 3827 |
_ClassLoader_defineClass0:nativeContext |
3828 |
"create a new class from a given byteArray. |
|
3829 |
Here, construct a stream on it and pass the work to the |
|
3830 |
JavaClassReader." |
|
3831 |
||
3832 |
|jClassLoader jName name data offset length inStream newClass |
|
3833 |
loaderStub jClass| |
|
3834 |
||
3835 |
jClassLoader := nativeContext receiver. |
|
3836 |
jName := nativeContext argAt:1. |
|
3837 |
||
3838 |
"/ className is now optional ... |
|
3839 |
"/ jName isNil ifTrue:[ |
|
3840 |
"/ self internalError:'nil name in defineClass'. |
|
3841 |
"/ ^ nil |
|
3842 |
"/ ] ifFalse:[ |
|
3843 |
"/ name := Java as_ST_String:jName. |
|
3844 |
"/ ]. |
|
3845 |
||
3846 |
data := nativeContext argAt:2. |
|
3847 |
offset := nativeContext argAt:3. |
|
3848 |
length := nativeContext argAt:4. |
|
3849 |
||
3850 |
inStream := data readStream. |
|
3851 |
inStream position:offset + 1. |
|
3852 |
inStream readLimit:(offset + length). |
|
3853 |
||
270 | 3854 |
"/ loaderStub := Plug new. |
3855 |
"/ loaderStub respondTo:#loadClass: with:[:clsName | |
|
3856 |
"/ |jName| |
|
3857 |
"/ |
|
3858 |
"/self halt. |
|
3859 |
"/ jName := Java as_String:clsName. |
|
3860 |
"/ "/ jClassLoader loadClass:jName |
|
3861 |
"/ jClassLoader |
|
3862 |
"/ perform:#'loadClass(Ljava/lang/String;)Ljava/lang/Class;' |
|
3863 |
"/ with:jName. |
|
3864 |
"/ ]. |
|
255 | 3865 |
|
3866 |
('JAVA: defining class ...') infoPrintCR. |
|
3867 |
||
3868 |
"/ self internalError:'break'. |
|
3869 |
||
3870 |
newClass := JavaClassReader |
|
270 | 3871 |
readStream:inStream |
3872 |
loader:jClassLoader "loaderStub" |
|
3873 |
loadUnresolved:false. |
|
255 | 3874 |
|
3875 |
newClass isNil ifTrue:[ |
|
3876 |
('JAVA: defineClass failed') infoPrintCR. |
|
3877 |
^ nil. |
|
3878 |
]. |
|
3879 |
Transcript showCR:('defined class ' , newClass fullName , '.'). |
|
3880 |
newClass classLoader:jClassLoader. |
|
3881 |
||
3882 |
('Java: defined new class: ' , newClass fullName) infoPrintCR. |
|
3883 |
||
268
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
3884 |
jClass := self javaClassObjectForClass:newClass. |
255 | 3885 |
^ jClass |
3886 |
||
3887 |
"Created: / 7.1.1998 / 12:35:10 / cg" |
|
270 | 3888 |
"Modified: / 24.1.1998 / 15:26:21 / cg" |
255 | 3889 |
! |
3890 |
||
253 | 3891 |
_ClassLoader_findSystemClass0:nativeContext |
3892 |
|loader name class jClass| |
|
3893 |
||
3894 |
loader := nativeContext receiver. |
|
3895 |
name := nativeContext argAt:1. |
|
3896 |
name := Java as_ST_String:name. |
|
3897 |
||
399 | 3898 |
class := Java at:name. |
3899 |
class isNil ifTrue:[ |
|
318 | 3900 |
"/ ('JAVA: findSystemClass0 for ' , name , ' loader is ' , loader displayString) infoPrintCR. |
399 | 3901 |
loader class == (Java classForName:'java.util.SystemClassLoader') ifTrue:[ |
3902 |
"/ Java classForName:name. |
|
3903 |
"/ class := Java at:name. |
|
3904 |
class := JavaClassReader loadSystemClass:name. |
|
3905 |
] ifFalse:[ |
|
3906 |
"/ load using default (ST/X) loader |
|
3907 |
class := JavaClassReader loadSystemClass:name. |
|
3908 |
"/ JavaClassReader classLoaderQuerySignal answer:nil do:[ |
|
3909 |
"/ Java classForName:name. |
|
3910 |
"/ ] |
|
3911 |
]. |
|
253 | 3912 |
]. |
3913 |
||
255 | 3914 |
"/ JavaClassReader classLoaderQuerySignal answer:nil "loader" |
3915 |
"/ do:[ |
|
3916 |
"/ class := Java classForName:name. |
|
3917 |
"/ JavaClassReader postLoadActions:true. |
|
3918 |
"/ ]. |
|
399 | 3919 |
|
255 | 3920 |
(class isNil |
3921 |
"or:[class classLoader notNil]") ifTrue:[ |
|
253 | 3922 |
"/ self halt:'class: ' , name , ' not found.'. |
3923 |
"/ self internalError:'class: ' , name , ' not found.'. |
|
3924 |
||
318 | 3925 |
self |
3926 |
throwExceptionClassName:'java.lang.ClassNotFoundException' |
|
399 | 3927 |
withMessage:('class: ' , name , ' not found.'). |
318 | 3928 |
^ nil |
3929 |
]. |
|
3930 |
||
3931 |
"/ 'JAVA: findSystemClass0 - loaded: ' infoPrint. class fullName infoPrintCR. |
|
268
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
3932 |
jClass := self javaClassObjectForClass:class. |
253 | 3933 |
^ jClass |
3934 |
||
3935 |
"Created: / 5.1.1998 / 02:53:04 / cg" |
|
399 | 3936 |
"Modified: / 20.10.1998 / 17:28:34 / cg" |
255 | 3937 |
! |
3938 |
||
440 | 3939 |
_ClassLoader_getSystemResourceAsName0:nativeContext |
3940 |
"/ java.lang.String getSystemResourceAsName0 (java.lang.String) |
|
3941 |
UnimplementedNativeMethodSignal raise |
|
3942 |
||
3943 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
3944 |
"Created: / 12.11.1998 / 18:58:34 / cg" |
|
3945 |
! |
|
3946 |
||
255 | 3947 |
_ClassLoader_getSystemResourceAsStream0:nativeContext |
444 | 3948 |
|jString rString dir file text inStream| |
255 | 3949 |
|
3950 |
jString := nativeContext argAt:1. |
|
3951 |
rString := Java as_ST_String:jString. |
|
3952 |
Java classPath do:[:aPath | |
|
444 | 3953 |
|f zipFile zar data| |
3954 |
||
3955 |
f := aPath asFilename. |
|
3956 |
((zipFile := f withSuffix:'jar') exists |
|
3957 |
or:[(zipFile := f withSuffix:'zip') exists]) ifTrue:[ |
|
3958 |
zar := ZipArchive oldFileNamed:zipFile. |
|
3959 |
(Array |
|
3960 |
with:rString |
|
3961 |
with:rString asLowercase |
|
3962 |
with:rString asUppercase) |
|
3963 |
do:[:tryName | |
|
3964 |
data := zar extract:tryName. |
|
507 | 3965 |
data notNil ifTrue:[ |
3966 |
inStream := (Java classForName:'java.io.ByteArrayInputStream') newCleared. |
|
3967 |
inStream perform:#'<init>([B)V' with:data. |
|
3968 |
^ inStream. |
|
3969 |
] |
|
444 | 3970 |
] |
3971 |
] ifFalse:[ |
|
3972 |
f exists ifTrue:[ |
|
3973 |
(file := f construct:rString) exists ifTrue:[ |
|
3974 |
(Java isExcludedFromClassPath:file) ifFalse:[ |
|
3975 |
text := file contents asString. |
|
3976 |
||
3977 |
"/ Copy data from returned buffer into Java byte array. |
|
3978 |
||
3979 |
data := text asByteArray. |
|
3980 |
||
3981 |
"/ Create input stream using byte array |
|
3982 |
||
3983 |
inStream := (Java classForName:'java.io.ByteArrayInputStream') newCleared. |
|
3984 |
inStream perform:#'<init>([B)V' with:data. |
|
3985 |
^ inStream. |
|
3986 |
] |
|
277 | 3987 |
] |
3988 |
] |
|
3989 |
] |
|
255 | 3990 |
]. |
3991 |
^ nil |
|
3992 |
||
3993 |
"Created: / 8.1.1998 / 16:06:56 / cg" |
|
507 | 3994 |
"Modified: / 26.12.1998 / 17:14:52 / cg" |
253 | 3995 |
! |
3996 |
||
3997 |
_ClassLoader_init:nativeContext |
|
3998 |
^ nil |
|
3999 |
||
4000 |
"Created: / 5.1.1998 / 02:04:43 / cg" |
|
4001 |
! |
|
4002 |
||
255 | 4003 |
_ClassLoader_resolveClass0:nativeContext |
4004 |
"resolve a new class as previously created by defineClass0" |
|
4005 |
||
399 | 4006 |
|jClassLoader jCls cls loaderStub anyUnresolved| |
255 | 4007 |
|
4008 |
jClassLoader := nativeContext receiver. |
|
4009 |
jCls := nativeContext argAt:1. |
|
4010 |
jCls isNil ifTrue:[ |
|
361
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
4011 |
self halt. |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
4012 |
^ nil |
255 | 4013 |
]. |
4014 |
cls := JavaClasses at:jCls ifAbsent:nil. |
|
4015 |
cls isNil ifTrue:[ |
|
361
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
4016 |
self halt. |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
4017 |
^ nil |
255 | 4018 |
]. |
399 | 4019 |
('JavaVM [info]: resolving class ' , cls fullName , ' ...') infoPrintCR. |
255 | 4020 |
|
4021 |
JavaClassReader classLoaderQuerySignal answer:jClassLoader |
|
4022 |
do:[ |
|
399 | 4023 |
JavaClassReader resolveClass:cls. |
4024 |
"/ JavaClassReader postLoadActions:true. |
|
4025 |
anyUnresolved := false. |
|
361
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
4026 |
cls constantPool do:[:entry | |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
4027 |
(entry isMemberOf:JavaUnresolvedClassConstant) ifTrue:[ |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
4028 |
self halt:'debugHalt'. |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
4029 |
entry preResolve. |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
4030 |
self halt:'debugHalt'. |
399 | 4031 |
anyUnresolved := true. |
361
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
4032 |
] |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
4033 |
] |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
4034 |
]. |
399 | 4035 |
anyUnresolved ifTrue:[ |
361
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
4036 |
jClassLoader notNil ifTrue:[ |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
4037 |
"/ any unresolved left -> try resolving with standard loader |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
4038 |
JavaClassReader classLoaderQuerySignal answer:nil |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
4039 |
do:[ |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
4040 |
JavaClassReader postLoadActions:true. |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
4041 |
cls constantPool do:[:entry | |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
4042 |
(entry isMemberOf:JavaUnresolvedClassConstant) ifTrue:[ |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
4043 |
self halt:'debugHalt'. |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
4044 |
entry preResolve. |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
4045 |
self halt:'debugHalt'. |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
4046 |
] |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
4047 |
] |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
4048 |
] |
255 | 4049 |
]. |
399 | 4050 |
]. |
255 | 4051 |
|
4052 |
"Created: / 7.1.1998 / 13:12:27 / cg" |
|
400 | 4053 |
"Modified: / 20.10.1998 / 19:01:57 / cg" |
255 | 4054 |
! |
4055 |
||
253 | 4056 |
_Class_forName:nativeContext |
4057 |
"get a java.lang.Class by name" |
|
4058 |
||
255 | 4059 |
|jClassName className cls jClass s m c loader| |
253 | 4060 |
|
4061 |
jClassName := nativeContext argAt:1. |
|
4062 |
className := Java as_ST_String:jClassName. |
|
4063 |
||
255 | 4064 |
(s := nativeContext sender) notNil ifTrue:[ |
347 | 4065 |
(s isJavaContext) ifTrue:[ |
307 | 4066 |
c := s method javaClass. |
4067 |
loader := c classLoader. |
|
4068 |
loader isNil ifTrue:[ |
|
255 | 4069 |
"/ self halt. |
307 | 4070 |
] |
4071 |
] |
|
255 | 4072 |
]. |
4073 |
||
4074 |
JavaClassReader classLoaderQuerySignal answer:loader |
|
4075 |
do:[ |
|
307 | 4076 |
cls := Java classForName:className. |
255 | 4077 |
]. |
4078 |
||
4079 |
"/(className startsWith:'sun.awt') ifTrue:[self halt]. |
|
4080 |
"/('classForName: ' , className , ' -> ') print. |
|
4081 |
"/cls notNil ifTrue:[cls fullName printCR] ifFalse:['nil' printCR]. |
|
4082 |
||
253 | 4083 |
cls isNil ifTrue:[ |
307 | 4084 |
ExceptionTrace ifTrue:[ |
508 | 4085 |
('throwing exception: no such class:' , className) infoPrintCR. |
4086 |
]. |
|
4087 |
ExceptionDebug ifTrue:[ |
|
307 | 4088 |
self halt:'no such class:' , className. |
4089 |
]. |
|
4090 |
self throwClassNotFoundException:className. |
|
4091 |
"/ not proceedable |
|
4092 |
AbortSignal raise. |
|
4093 |
"/ not reached |
|
4094 |
^ self |
|
4095 |
]. |
|
4096 |
||
4097 |
^ self javaClassObjectForClass:cls. |
|
4098 |
||
508 | 4099 |
"Modified: / 30.12.1998 / 20:12:53 / cg" |
253 | 4100 |
! |
4101 |
||
4102 |
_Class_getClassLoader:nativeContext |
|
4103 |
"get a classes loader" |
|
4104 |
||
512 | 4105 |
|jClass cls loader| |
4106 |
||
4107 |
jClass := nativeContext receiver. |
|
4108 |
cls := self classForJavaClassObject:jClass. |
|
4109 |
loader := cls classLoader. |
|
4110 |
cls isNil ifTrue:[ |
|
4111 |
loader := JavaClassReader classLoaderQuerySignal raise. |
|
4112 |
"/ ('JAVA: getClassLoader - ' , loader printString) infoPrintCR. |
|
4113 |
]. |
|
4114 |
||
253 | 4115 |
^ loader |
4116 |
||
4117 |
"Created: / 5.1.1998 / 02:51:59 / cg" |
|
512 | 4118 |
"Modified: / 4.1.1999 / 17:50:15 / cg" |
253 | 4119 |
! |
4120 |
||
440 | 4121 |
_Class_getComponentType:nativeContext |
4122 |
UnimplementedNativeMethodSignal raise |
|
4123 |
||
4124 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
4125 |
"Created: / 12.11.1998 / 18:54:46 / cg" |
|
4126 |
! |
|
4127 |
||
4128 |
_Class_getConstructor0:nativeContext |
|
4129 |
UnimplementedNativeMethodSignal raise |
|
4130 |
||
4131 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
4132 |
"Created: / 12.11.1998 / 18:55:42 / cg" |
|
4133 |
! |
|
4134 |
||
4135 |
_Class_getConstructors0:nativeContext |
|
4136 |
UnimplementedNativeMethodSignal raise |
|
4137 |
||
4138 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
4139 |
"Created: / 12.11.1998 / 18:55:26 / cg" |
|
4140 |
! |
|
4141 |
||
4142 |
_Class_getField0:nativeContext |
|
4143 |
UnimplementedNativeMethodSignal raise |
|
4144 |
||
4145 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
4146 |
"Created: / 12.11.1998 / 18:55:37 / cg" |
|
4147 |
! |
|
4148 |
||
4149 |
_Class_getFields0:nativeContext |
|
4150 |
UnimplementedNativeMethodSignal raise |
|
4151 |
||
4152 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
4153 |
"Created: / 12.11.1998 / 18:55:18 / cg" |
|
4154 |
! |
|
4155 |
||
4156 |
_Class_getInterfaces:nativeContext |
|
4157 |
UnimplementedNativeMethodSignal raise |
|
4158 |
||
4159 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
4160 |
"Created: / 12.11.1998 / 18:54:34 / cg" |
|
4161 |
! |
|
4162 |
||
321 | 4163 |
_Class_getMethod0:nativeContext |
4164 |
"get a method, given a name and type spec" |
|
4165 |
||
322 | 4166 |
|jClass cls jmName mName mTypes whichAccess argSig sel| |
321 | 4167 |
|
4168 |
jClass := nativeContext receiver. |
|
4169 |
cls := JavaClasses at:jClass. |
|
4170 |
||
322 | 4171 |
jmName := nativeContext argAt:1. |
4172 |
mName := Java as_ST_String:jmName. |
|
321 | 4173 |
mTypes := nativeContext argAt:2. |
4174 |
whichAccess := nativeContext argAt:3. |
|
405 | 4175 |
self halt. |
322 | 4176 |
argSig := JavaMethod argSignatureFromArgTypeArray:mTypes. |
4177 |
cls methodDictionary keysAndValuesDo:[:sel :mthd | |
|
405 | 4178 |
|i1 i2 jMethod retTypeClass argTypes| |
322 | 4179 |
|
4180 |
JavaMethods notNil ifTrue:[ |
|
4181 |
(jMethod := JavaMethods at:mthd ifAbsent:nil) notNil ifTrue:[ |
|
4182 |
^ jMethod |
|
4183 |
] |
|
4184 |
]. |
|
4185 |
||
4186 |
mthd name printCR. |
|
4187 |
mName printCR. |
|
4188 |
||
4189 |
mthd name = mName ifTrue:[ |
|
4190 |
i1 := mthd signature indexOf:$(. |
|
4191 |
i2 := mthd signature indexOf:$) startingAt:(i1+1). |
|
4192 |
||
4193 |
(mthd signature copyFrom:i1+1 to:i2-1) = argSig ifTrue:[ |
|
4194 |
"/ found it - create a java.lang.reflect.Method for it. |
|
4195 |
jMethod := (Java at:'java.lang.reflect.Method') new. |
|
4196 |
jMethod instVarNamed:'clazz' put:jClass. |
|
4197 |
jMethod instVarNamed:'slot' put:sel. |
|
4198 |
jMethod instVarNamed:'name' put:jmName. |
|
405 | 4199 |
retTypeClass := mthd returnTypeClass. |
4200 |
retTypeClass isNil ifTrue:[ |
|
4201 |
retTypeClass := #void |
|
4202 |
]. |
|
4203 |
argTypes := mthd argSignature. |
|
4204 |
argTypes := argTypes collect:[:s | |
|
4205 |
|c| |
|
4206 |
||
4207 |
c := Java at:s. |
|
4208 |
self javaClassObjectForClass:(c ? s asSymbol) |
|
4209 |
]. |
|
4210 |
jMethod instVarNamed:'returnType' put:(self javaClassObjectForClass:retTypeClass). |
|
4211 |
jMethod instVarNamed:'parameterTypes' put:argTypes. |
|
322 | 4212 |
|
4213 |
JavaMethods isNil ifTrue:[ |
|
4214 |
JavaMethods := IdentityDictionary new |
|
4215 |
]. |
|
4216 |
JavaMethods at:jMethod put:mthd. |
|
4217 |
JavaMethods at:mthd put:jMethod. |
|
4218 |
||
4219 |
^ jMethod. |
|
4220 |
]. |
|
4221 |
]. |
|
4222 |
]. |
|
321 | 4223 |
|
4224 |
self halt. |
|
4225 |
self |
|
4226 |
throwExceptionClassName:'java.lang.NoSuchMethodException' |
|
4227 |
withMessage:'not yet implemented'. |
|
4228 |
||
4229 |
^ nil. |
|
4230 |
||
405 | 4231 |
"Modified: / 22.10.1998 / 01:54:38 / cg" |
321 | 4232 |
! |
4233 |
||
334 | 4234 |
_Class_getMethods0:nativeContext |
4235 |
"get a method, given a name and type spec" |
|
4236 |
||
4237 |
|jClass cls jmName mName mTypes whichAccess argSig sel |
|
4238 |
methods| |
|
4239 |
||
4240 |
jClass := nativeContext receiver. |
|
4241 |
cls := JavaClasses at:jClass. |
|
4242 |
||
405 | 4243 |
"/ 0 = PUBLIC (i.e. includes inherited) / 1 = DECLARED here |
334 | 4244 |
whichAccess := nativeContext argAt:1. |
4245 |
||
4246 |
methods := OrderedCollection new. |
|
4247 |
||
405 | 4248 |
[cls isJavaClass] whileTrue:[ |
4249 |
cls methodDictionary keysAndValuesDo:[:sel :mthd | |
|
4250 |
|i1 i2 jMethod argTypes retTypeClass| |
|
4251 |
||
4252 |
mthd name printCR. |
|
4253 |
||
4254 |
i1 := mthd signature indexOf:$(. |
|
4255 |
i2 := mthd signature indexOf:$) startingAt:(i1+1). |
|
4256 |
||
4257 |
"/ create a java.lang.reflect.Method for it. |
|
4258 |
jMethod := (Java at:'java.lang.reflect.Method') new. |
|
4259 |
jMethod instVarNamed:'clazz' put:jClass. |
|
4260 |
jMethod instVarNamed:'slot' put:sel. |
|
4261 |
jMethod instVarNamed:'name' put:(Java as_String:mthd name). |
|
4262 |
retTypeClass := mthd returnTypeClass. |
|
4263 |
retTypeClass isNil ifTrue:[ |
|
4264 |
retTypeClass := #void |
|
4265 |
]. |
|
4266 |
(name endsWith:')I') ifTrue:[self halt]. |
|
4267 |
argTypes := mthd argSignature. |
|
4268 |
argTypes := argTypes collect:[:s | |
|
4269 |
|c| |
|
4270 |
||
4271 |
c := Java at:s. |
|
4272 |
self javaClassObjectForClass:(c ? s asSymbol) |
|
4273 |
]. |
|
4274 |
||
4275 |
jMethod instVarNamed:'returnType' put:(self javaClassObjectForClass:retTypeClass). |
|
4276 |
jMethod instVarNamed:'parameterTypes' put:argTypes. |
|
334 | 4277 |
|
405 | 4278 |
(mthd name includesString:'setName') ifTrue:[self halt]. |
4279 |
JavaMethods isNil ifTrue:[ |
|
4280 |
JavaMethods := IdentityDictionary new |
|
4281 |
]. |
|
4282 |
JavaMethods at:jMethod put:mthd. |
|
4283 |
JavaMethods at:mthd put:jMethod. |
|
4284 |
||
4285 |
methods add:jMethod. |
|
334 | 4286 |
]. |
405 | 4287 |
whichAccess == 1 ifTrue:[ |
4288 |
"/ local methods only |
|
4289 |
cls := nil |
|
4290 |
] ifFalse:[ |
|
4291 |
cls := cls superclass. |
|
4292 |
] |
|
334 | 4293 |
]. |
4294 |
methods := methods asArray. |
|
4295 |
^ methods. |
|
4296 |
||
405 | 4297 |
"Modified: / 22.10.1998 / 01:53:58 / cg" |
334 | 4298 |
! |
4299 |
||
440 | 4300 |
_Class_getModifiers:nativeContext |
4301 |
UnimplementedNativeMethodSignal raise |
|
4302 |
||
4303 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
4304 |
"Created: / 12.11.1998 / 18:54:53 / cg" |
|
4305 |
! |
|
4306 |
||
255 | 4307 |
_Class_getName:nativeContext |
4308 |
"get a classes name" |
|
4309 |
||
508 | 4310 |
|jClass cls nm| |
255 | 4311 |
|
4312 |
jClass := nativeContext receiver. |
|
4313 |
cls := JavaClasses at:jClass. |
|
508 | 4314 |
cls isJavaClass ifTrue:[ |
4315 |
nm := (cls fullName copyReplaceAll:$/ with:$.) |
|
4316 |
] ifFalse:[ |
|
4317 |
nm := cls name |
|
4318 |
]. |
|
4319 |
^ Java as_String:nm. |
|
4320 |
||
4321 |
"Modified: / 30.12.1998 / 21:13:50 / cg" |
|
255 | 4322 |
! |
4323 |
||
253 | 4324 |
_Class_getPrimitiveClass:nativeContext |
4325 |
"get a primitive class by name" |
|
4326 |
||
4327 |
|jClassName className cls| |
|
4328 |
||
4329 |
jClassName := nativeContext argAt:1. |
|
4330 |
className := Java as_ST_String:jClassName. |
|
4331 |
||
4332 |
JavaClasses isNil ifTrue:[ |
|
261 | 4333 |
self initializePrimitiveClasses |
253 | 4334 |
]. |
4335 |
cls := JavaClasses at:className. |
|
4336 |
||
4337 |
"/ cls := Java classForName:className. |
|
4338 |
"/ cls isNil ifTrue:[ |
|
4339 |
"/ cls := JavaClasses at:('JavaBase_' , className) asSymbol ifAbsent:nil. |
|
4340 |
"/ #( |
|
4341 |
"/ 'boolean' #Boolean |
|
4342 |
"/ 'float' #ShortFloat |
|
4343 |
"/ 'double' #Float |
|
4344 |
"/ 'int' #Integer |
|
4345 |
"/ 'long' #Integer |
|
4346 |
"/ 'char' #Character |
|
4347 |
"/ 'short' #Integer |
|
4348 |
"/ 'byte' #Integer |
|
4349 |
"/ 'void' #UndefinedObject |
|
4350 |
"/ ) pairWiseDo:[:nm :sym | |
|
4351 |
"/ className = nm ifTrue:[ |
|
4352 |
"/ cls := Smalltalk at:sym. |
|
4353 |
"/ ] |
|
4354 |
"/ ]. |
|
4355 |
"/ |
|
4356 |
"/ cls isNil ifTrue:[ |
|
4357 |
"/ self internalError:'class: ' , className , ' not found.'. |
|
4358 |
"/ ]. |
|
4359 |
"/ ]. |
|
4360 |
^ cls |
|
4361 |
||
4362 |
"Created: / 4.1.1998 / 00:46:03 / cg" |
|
4363 |
"Modified: / 4.1.1998 / 01:12:27 / cg" |
|
4364 |
! |
|
4365 |
||
440 | 4366 |
_Class_getSigners:nativeContext |
4367 |
UnimplementedNativeMethodSignal raise |
|
4368 |
||
4369 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
4370 |
"Created: / 12.11.1998 / 18:55:01 / cg" |
|
4371 |
! |
|
4372 |
||
255 | 4373 |
_Class_getSuperclass:nativeContext |
4374 |
"return a classes superclass" |
|
4375 |
||
4376 |
|jClass cls superCls| |
|
4377 |
||
4378 |
jClass := nativeContext receiver. |
|
4379 |
cls := JavaClasses at:jClass. |
|
4380 |
superCls := cls superclass. |
|
4381 |
superCls == JavaObject ifTrue:[ |
|
307 | 4382 |
^ nil. |
4383 |
]. |
|
4384 |
^ self javaClassObjectForClass:superCls |
|
255 | 4385 |
|
4386 |
"Created: / 12.1.1998 / 12:38:36 / cg" |
|
307 | 4387 |
"Modified: / 4.2.1998 / 14:51:22 / cg" |
255 | 4388 |
! |
4389 |
||
440 | 4390 |
_Class_isArray:nativeContext |
4391 |
UnimplementedNativeMethodSignal raise |
|
4392 |
||
4393 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
4394 |
"Created: / 12.11.1998 / 18:54:24 / cg" |
|
4395 |
! |
|
4396 |
||
4397 |
_Class_isAssignableFrom:nativeContext |
|
4398 |
UnimplementedNativeMethodSignal raise |
|
4399 |
||
4400 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
4401 |
"Created: / 12.11.1998 / 18:54:16 / cg" |
|
4402 |
! |
|
4403 |
||
321 | 4404 |
_Class_isInstance:nativeContext |
4405 |
"return true, if something is an instance of a class. |
|
4406 |
(i.e. same as instanceOf - builtin bytecode)" |
|
4407 |
||
4408 |
|jClass cls obj| |
|
4409 |
||
4410 |
obj := nativeContext argAt:1. |
|
4411 |
obj isNil ifTrue:[^ 0 "FALSE"]. |
|
4412 |
||
4413 |
jClass := nativeContext receiver. |
|
4414 |
cls := JavaClasses at:jClass. |
|
4415 |
||
4416 |
(obj isMemberOf:cls) ifTrue:[^ 1 "TRUE"]. |
|
4417 |
(obj isKindOf:cls) ifTrue:[^ 1 "TRUE"]. |
|
4418 |
||
4419 |
cls isBehavior ifTrue:[ |
|
4420 |
cls isInterface ifTrue:[ |
|
4421 |
(obj class hasInterface:cls) ifTrue:[ |
|
4422 |
^ 1 "TRUE" |
|
4423 |
] |
|
4424 |
]. |
|
4425 |
^ (obj isKindOf:cls) ifTrue:[1 "TRUE"] ifFalse:[0 "FALSE"] |
|
4426 |
]. |
|
4427 |
(cls isMemberOf:JavaClassPointerRef) ifTrue:[ |
|
4428 |
"/ must be a pointer to an array of that class |
|
4429 |
||
4430 |
^ (obj isArray) ifTrue:[1 "TRUE"] ifFalse:[0 "FALSE"] |
|
4431 |
]. |
|
4432 |
(cls isMemberOf:JavaBuiltInClassPointerRef) ifTrue:[ |
|
4433 |
cls arrayClass == obj class ifTrue:[ |
|
4434 |
^ 1 "TRUE" |
|
4435 |
]. |
|
4436 |
]. |
|
4437 |
||
4438 |
(obj isMemberOf:Array) ifTrue:[ |
|
4439 |
obj size == 0 ifTrue:[ |
|
4440 |
^ 1 "TRUE" |
|
4441 |
]. |
|
4442 |
^ (self _checkCast:(obj at:1) class:(cls deref)) |
|
4443 |
ifTrue:[1 "TRUE"] ifFalse:[0 "FALSE"] |
|
4444 |
]. |
|
4445 |
self halt. |
|
4446 |
^ 0 "FALSE". |
|
4447 |
||
4448 |
"Modified: / 9.2.1998 / 14:56:23 / cg" |
|
4449 |
! |
|
4450 |
||
255 | 4451 |
_Class_isInterface:nativeContext |
4452 |
"return true, if this class is an interface" |
|
4453 |
||
4454 |
|jClass cls| |
|
4455 |
||
4456 |
jClass := nativeContext receiver. |
|
4457 |
cls := JavaClasses at:jClass. |
|
4458 |
cls isInterface ifTrue:[^ 1 "TRUE"]. |
|
4459 |
^ 0 "FALSE" |
|
4460 |
||
4461 |
"Created: / 12.1.1998 / 12:37:02 / cg" |
|
4462 |
! |
|
4463 |
||
321 | 4464 |
_Class_isPrimitive:nativeContext |
4465 |
"return true, if this class is builtin primitive class |
|
4466 |
(i.e. byteArray, array, string etc." |
|
4467 |
||
4468 |
|jClass cls| |
|
4469 |
||
4470 |
jClass := nativeContext receiver. |
|
4471 |
cls := JavaClasses at:jClass. |
|
4472 |
^ 0 "FALSE" |
|
4473 |
||
4474 |
"Created: / 9.2.1998 / 14:46:07 / cg" |
|
4475 |
! |
|
4476 |
||
253 | 4477 |
_Class_newInstance:nativeContext |
4478 |
"get an instance for a java.lang.Class" |
|
4479 |
||
4480 |
|jClass cls newInst| |
|
4481 |
||
4482 |
jClass := nativeContext receiver. |
|
4483 |
cls := JavaClasses at:jClass. |
|
261 | 4484 |
cls classInit. |
253 | 4485 |
newInst := cls newCleared. |
255 | 4486 |
newInst perform:#'<init>()V'. |
253 | 4487 |
|
4488 |
^ newInst |
|
4489 |
||
4490 |
"Created: / 2.1.1998 / 22:41:38 / cg" |
|
261 | 4491 |
"Modified: / 15.1.1998 / 00:57:37 / cg" |
253 | 4492 |
! |
4493 |
||
440 | 4494 |
_Class_setSigners:nativeContext |
4495 |
UnimplementedNativeMethodSignal raise |
|
4496 |
||
4497 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
4498 |
"Created: / 12.11.1998 / 18:55:08 / cg" |
|
4499 |
! |
|
4500 |
||
253 | 4501 |
_Double_doubleToLongBits:nativeContext |
4502 |
|f i| |
|
4503 |
||
4504 |
f := nativeContext argAt:1. |
|
4505 |
||
4506 |
UninterpretedBytes isBigEndian ifTrue:[ |
|
261 | 4507 |
i := f basicAt:8. |
4508 |
i := i bitOr:((f basicAt:7) bitShift:8). |
|
4509 |
i := i bitOr:((f basicAt:6) bitShift:16). |
|
4510 |
i := i bitOr:((f basicAt:5) bitShift:24). |
|
4511 |
i := i bitOr:((f basicAt:4) bitShift:32). |
|
4512 |
i := i bitOr:((f basicAt:3) bitShift:40). |
|
4513 |
i := i bitOr:((f basicAt:2) bitShift:48). |
|
4514 |
i := i bitOr:((f basicAt:1) bitShift:56). |
|
253 | 4515 |
] ifFalse:[ |
261 | 4516 |
i := f basicAt:1. |
4517 |
i := i bitOr:((f basicAt:2) bitShift:8). |
|
4518 |
i := i bitOr:((f basicAt:3) bitShift:16). |
|
4519 |
i := i bitOr:((f basicAt:4) bitShift:24). |
|
4520 |
i := i bitOr:((f basicAt:5) bitShift:32). |
|
4521 |
i := i bitOr:((f basicAt:6) bitShift:40). |
|
4522 |
i := i bitOr:((f basicAt:7) bitShift:48). |
|
4523 |
i := i bitOr:((f basicAt:8) bitShift:56). |
|
253 | 4524 |
]. |
4525 |
||
4526 |
^ i. |
|
4527 |
||
4528 |
"Created: / 4.1.1998 / 01:39:12 / cg" |
|
4529 |
! |
|
4530 |
||
4531 |
_Double_longBitsToDouble:nativeContext |
|
4532 |
|i aFloat| |
|
4533 |
||
4534 |
i := nativeContext argAt:1. |
|
4535 |
||
4536 |
aFloat := Float new. |
|
4537 |
UninterpretedBytes isBigEndian ifTrue:[ |
|
261 | 4538 |
aFloat basicAt:1 put:((i bitShift:-56) bitAnd:16rFF). |
4539 |
aFloat basicAt:2 put:((i bitShift:-48) bitAnd:16rFF). |
|
4540 |
aFloat basicAt:3 put:((i bitShift:-40) bitAnd:16rFF). |
|
4541 |
aFloat basicAt:4 put:((i bitShift:-32) bitAnd:16rFF). |
|
4542 |
aFloat basicAt:5 put:((i bitShift:-24) bitAnd:16rFF). |
|
4543 |
aFloat basicAt:6 put:((i bitShift:-16) bitAnd:16rFF). |
|
4544 |
aFloat basicAt:7 put:((i bitShift:-8) bitAnd:16rFF). |
|
4545 |
aFloat basicAt:8 put:(i bitAnd:16rFF). |
|
253 | 4546 |
] ifFalse:[ |
261 | 4547 |
aFloat basicAt:1 put:(i bitAnd:16rFF). |
4548 |
aFloat basicAt:2 put:((i bitShift:-8) bitAnd:16rFF). |
|
4549 |
aFloat basicAt:3 put:((i bitShift:-16) bitAnd:16rFF). |
|
4550 |
aFloat basicAt:4 put:((i bitShift:-24) bitAnd:16rFF). |
|
4551 |
aFloat basicAt:5 put:((i bitShift:-32) bitAnd:16rFF). |
|
4552 |
aFloat basicAt:6 put:((i bitShift:-40) bitAnd:16rFF). |
|
4553 |
aFloat basicAt:7 put:((i bitShift:-48) bitAnd:16rFF). |
|
4554 |
aFloat basicAt:8 put:((i bitShift:-56) bitAnd:16rFF). |
|
253 | 4555 |
]. |
4556 |
||
4557 |
^ aFloat. |
|
4558 |
||
4559 |
"Created: / 4.1.1998 / 01:45:00 / cg" |
|
4560 |
! |
|
4561 |
||
255 | 4562 |
_Double_valueOf0:nativeContext |
4563 |
|s d| |
|
4564 |
||
4565 |
s := nativeContext argAt:1. |
|
4566 |
s notNil ifTrue:[ |
|
261 | 4567 |
s := Java as_ST_String:s. |
4568 |
d := Float readFrom:s onError:nil. |
|
255 | 4569 |
]. |
4570 |
d isNil ifTrue:[ |
|
261 | 4571 |
self throwNumberFormatException. |
4572 |
"/ not reached |
|
255 | 4573 |
]. |
4574 |
||
4575 |
^ d |
|
4576 |
||
4577 |
"Modified: / 8.8.1997 / 12:03:55 / cg" |
|
4578 |
"Created: / 7.1.1998 / 11:09:43 / cg" |
|
4579 |
! |
|
4580 |
||
253 | 4581 |
_Float_floatToIntBits:nativeContext |
4582 |
|f i| |
|
4583 |
||
4584 |
f := nativeContext argAt:1. |
|
4585 |
||
4586 |
UninterpretedBytes isBigEndian ifTrue:[ |
|
261 | 4587 |
i := f basicAt:4. |
4588 |
i := i bitOr:((f basicAt:3) bitShift:8). |
|
4589 |
i := i bitOr:((f basicAt:2) bitShift:16). |
|
4590 |
i := i bitOr:((f basicAt:1) bitShift:24). |
|
253 | 4591 |
] ifFalse:[ |
261 | 4592 |
i := f basicAt:1. |
4593 |
i := i bitOr:((f basicAt:2) bitShift:8). |
|
4594 |
i := i bitOr:((f basicAt:3) bitShift:16). |
|
4595 |
i := i bitOr:((f basicAt:4) bitShift:24). |
|
253 | 4596 |
]. |
4597 |
||
4598 |
^ i. |
|
4599 |
||
4600 |
"Created: / 4.1.1998 / 01:25:50 / cg" |
|
4601 |
! |
|
4602 |
||
261 | 4603 |
_Float_intBitsToFloat:nativeContet |
4604 |
|i aFloat| |
|
4605 |
||
4606 |
i := nativeContet argAt:1. |
|
4607 |
||
4608 |
aFloat := ShortFloat basicNew. |
|
4609 |
UninterpretedBytes isBigEndian ifTrue:[ |
|
4610 |
aFloat basicAt:1 put:((i bitShift:-24) bitAnd:16rFF). |
|
4611 |
aFloat basicAt:2 put:((i bitShift:-16) bitAnd:16rFF). |
|
4612 |
aFloat basicAt:3 put:((i bitShift:-8) bitAnd:16rFF). |
|
4613 |
aFloat basicAt:4 put:(i bitAnd:16rFF). |
|
4614 |
] ifFalse:[ |
|
4615 |
aFloat basicAt:1 put:(i bitAnd:16rFF). |
|
4616 |
aFloat basicAt:2 put:((i bitShift:-8) bitAnd:16rFF). |
|
4617 |
aFloat basicAt:3 put:((i bitShift:-16) bitAnd:16rFF). |
|
4618 |
aFloat basicAt:4 put:((i bitShift:-24) bitAnd:16rFF). |
|
4619 |
]. |
|
4620 |
||
4621 |
^ aFloat. |
|
4622 |
||
4623 |
"Created: / 13.1.1998 / 23:03:36 / cg" |
|
4624 |
"Modified: / 13.1.1998 / 23:05:01 / cg" |
|
4625 |
! |
|
4626 |
||
440 | 4627 |
_Math_IEEEremainder:nativeContext |
4628 |
UnimplementedNativeMethodSignal raise |
|
4629 |
||
4630 |
"Created: / 12.11.1998 / 18:52:36 / cg" |
|
4631 |
! |
|
4632 |
||
342 | 4633 |
_Math_acos:nativeContext |
4634 |
"arc cosine" |
|
4635 |
||
4636 |
|dVal| |
|
4637 |
||
4638 |
dVal := nativeContext argAt:1. |
|
432 | 4639 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4640 |
"/ dVal isReal ifTrue:[ |
|
4641 |
"/ 'JAVAVM [info]: missing double flag in Math>>acos' infoPrintCR. |
|
4642 |
"/ ] ifFalse:[ |
|
4643 |
"/ self halt:'expected double arg' |
|
4644 |
"/ ] |
|
4645 |
"/ ]. |
|
342 | 4646 |
^ dVal arcCos |
4647 |
||
4648 |
"Created: / 7.5.1998 / 00:34:50 / cg" |
|
432 | 4649 |
"Modified: / 11.11.1998 / 15:08:20 / cg" |
342 | 4650 |
! |
4651 |
||
4652 |
_Math_asin:nativeContext |
|
4653 |
"arc sine" |
|
4654 |
||
4655 |
|dVal| |
|
4656 |
||
4657 |
dVal := nativeContext argAt:1. |
|
432 | 4658 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4659 |
"/ dVal isReal ifTrue:[ |
|
4660 |
"/ 'JAVAVM [info]: missing double flag in Math>>asin' infoPrintCR. |
|
4661 |
"/ ] ifFalse:[ |
|
4662 |
"/ self halt:'expected double arg' |
|
4663 |
"/ ] |
|
4664 |
"/ ]. |
|
342 | 4665 |
^ dVal arcSin |
4666 |
||
4667 |
"Created: / 7.5.1998 / 00:34:26 / cg" |
|
432 | 4668 |
"Modified: / 11.11.1998 / 15:08:15 / cg" |
342 | 4669 |
! |
4670 |
||
440 | 4671 |
_Math_atan2:nativeContext |
4672 |
UnimplementedNativeMethodSignal raise |
|
4673 |
||
4674 |
"Created: / 12.11.1998 / 18:52:52 / cg" |
|
4675 |
! |
|
4676 |
||
317 | 4677 |
_Math_atan:nativeContext |
4678 |
"arc tangens" |
|
4679 |
||
4680 |
|dVal| |
|
4681 |
||
4682 |
dVal := nativeContext argAt:1. |
|
432 | 4683 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4684 |
"/ dVal isReal ifTrue:[ |
|
4685 |
"/ 'JAVAVM [info]: missing double flag in Math>>atan' infoPrintCR. |
|
4686 |
"/ ] ifFalse:[ |
|
4687 |
"/ self halt:'expected double arg' |
|
4688 |
"/ ] |
|
4689 |
"/ ]. |
|
317 | 4690 |
^ dVal arcTan |
4691 |
||
4692 |
"Created: / 6.2.1998 / 01:24:12 / cg" |
|
432 | 4693 |
"Modified: / 11.11.1998 / 15:08:11 / cg" |
317 | 4694 |
! |
4695 |
||
255 | 4696 |
_Math_ceil:nativeContext |
4697 |
"ceiling" |
|
4698 |
||
4699 |
|dVal| |
|
4700 |
||
4701 |
dVal := nativeContext argAt:1. |
|
432 | 4702 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4703 |
"/ dVal isReal ifTrue:[ |
|
4704 |
"/ 'JAVAVM [info]: missing double flag in Math>>ceil' infoPrintCR. |
|
4705 |
"/ ] ifFalse:[ |
|
4706 |
"/ self halt:'expected double arg' |
|
4707 |
"/ ] |
|
4708 |
"/ ]. |
|
255 | 4709 |
^ dVal ceilingAsFloat |
4710 |
||
4711 |
"Created: / 7.1.1998 / 15:43:00 / cg" |
|
432 | 4712 |
"Modified: / 11.11.1998 / 15:08:04 / cg" |
255 | 4713 |
! |
4714 |
||
4715 |
_Math_cos:nativeContext |
|
4716 |
"cosine" |
|
4717 |
||
4718 |
|dVal| |
|
4719 |
||
4720 |
dVal := nativeContext argAt:1. |
|
432 | 4721 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4722 |
"/ dVal isReal ifTrue:[ |
|
4723 |
"/ 'JAVAVM [info]: missing double flag in Math>>cos' infoPrintCR. |
|
4724 |
"/ ] ifFalse:[ |
|
4725 |
"/ self halt:'expected double arg' |
|
4726 |
"/ ] |
|
4727 |
"/ ]. |
|
255 | 4728 |
^ dVal cos |
4729 |
||
4730 |
"Created: / 7.1.1998 / 15:41:30 / cg" |
|
432 | 4731 |
"Modified: / 11.11.1998 / 15:07:59 / cg" |
255 | 4732 |
! |
4733 |
||
342 | 4734 |
_Math_exp:nativeContext |
4735 |
"exponential" |
|
4736 |
||
4737 |
|dVal| |
|
4738 |
||
4739 |
dVal := nativeContext argAt:1. |
|
432 | 4740 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4741 |
"/ dVal isReal ifTrue:[ |
|
4742 |
"/ 'JAVAVM [info]: missing double flag in Math>>exp' infoPrintCR. |
|
4743 |
"/ ] ifFalse:[ |
|
4744 |
"/ self halt:'expected double arg' |
|
4745 |
"/ ] |
|
4746 |
"/ ]. |
|
342 | 4747 |
^ dVal exp |
4748 |
||
4749 |
"Created: / 7.5.1998 / 00:36:19 / cg" |
|
432 | 4750 |
"Modified: / 11.11.1998 / 15:07:50 / cg" |
342 | 4751 |
! |
4752 |
||
255 | 4753 |
_Math_floor:nativeContext |
4754 |
"floor" |
|
4755 |
||
4756 |
|dVal| |
|
4757 |
||
4758 |
dVal := nativeContext argAt:1. |
|
432 | 4759 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4760 |
"/ dVal isReal ifTrue:[ |
|
4761 |
"/ 'JAVAVM [info]: missing double flag in Math>>floor' infoPrintCR. |
|
4762 |
"/ ] ifFalse:[ |
|
4763 |
"/ self halt:'expected double arg' |
|
4764 |
"/ ] |
|
4765 |
"/ ]. |
|
255 | 4766 |
^ dVal floorAsFloat |
4767 |
||
4768 |
"Created: / 7.1.1998 / 19:09:21 / cg" |
|
432 | 4769 |
"Modified: / 11.11.1998 / 15:07:45 / cg" |
255 | 4770 |
! |
4771 |
||
4772 |
_Math_log:nativeContext |
|
510 | 4773 |
"natural logarithm" |
255 | 4774 |
|
4775 |
|dVal| |
|
4776 |
||
4777 |
dVal := nativeContext argAt:1. |
|
432 | 4778 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4779 |
"/ dVal isReal ifTrue:[ |
|
4780 |
"/ 'JAVAVM [info]: missing double flag in Math>>log' infoPrintCR. |
|
4781 |
"/ ] ifFalse:[ |
|
4782 |
"/ self halt:'expected double arg' |
|
4783 |
"/ ] |
|
4784 |
"/ ]. |
|
510 | 4785 |
^ dVal ln |
255 | 4786 |
|
4787 |
"Created: / 7.1.1998 / 15:42:19 / cg" |
|
510 | 4788 |
"Modified: / 30.12.1998 / 17:41:42 / cg" |
255 | 4789 |
! |
4790 |
||
4791 |
_Math_pow:nativeContext |
|
4792 |
"power" |
|
4793 |
||
4794 |
|dVal1 dVal2| |
|
4795 |
||
4796 |
dVal1 := nativeContext argAt:1. |
|
432 | 4797 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4798 |
"/ dVal1 isReal ifTrue:[ |
|
4799 |
"/ 'JAVAVM [info]: missing double flag in Math>>pow' infoPrintCR. |
|
4800 |
"/ ] ifFalse:[ |
|
4801 |
"/ self halt:'expected double arg' |
|
4802 |
"/ ] |
|
4803 |
"/ ]. |
|
255 | 4804 |
dVal2 := nativeContext argAt:3. |
432 | 4805 |
"/ (nativeContext argAt:4) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4806 |
"/ dVal2 isReal ifTrue:[ |
|
4807 |
"/ 'JAVAVM [info]: missing double flag in Math>>pow' infoPrintCR. |
|
4808 |
"/ ] ifFalse:[ |
|
4809 |
"/ self halt:'expected double arg' |
|
4810 |
"/ ] |
|
4811 |
"/ ]. |
|
255 | 4812 |
^ dVal1 raisedTo:dVal2 |
4813 |
||
4814 |
"Created: / 7.1.1998 / 15:44:13 / cg" |
|
432 | 4815 |
"Modified: / 11.11.1998 / 15:07:33 / cg" |
255 | 4816 |
! |
4817 |
||
440 | 4818 |
_Math_rint:nativeContext |
4819 |
UnimplementedNativeMethodSignal raise |
|
4820 |
||
4821 |
"Created: / 12.11.1998 / 18:52:47 / cg" |
|
4822 |
! |
|
4823 |
||
255 | 4824 |
_Math_sin:nativeContext |
4825 |
"sine" |
|
4826 |
||
4827 |
|dVal| |
|
4828 |
||
4829 |
dVal := nativeContext argAt:1. |
|
432 | 4830 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4831 |
"/ dVal isReal ifTrue:[ |
|
4832 |
"/ 'JAVAVM [info]: missing double flag in Math>>sin' infoPrintCR. |
|
4833 |
"/ ] ifFalse:[ |
|
4834 |
"/ self halt:'expected double arg' |
|
4835 |
"/ ] |
|
4836 |
"/ ]. |
|
255 | 4837 |
^ dVal sin |
4838 |
||
4839 |
"Created: / 7.1.1998 / 15:41:40 / cg" |
|
432 | 4840 |
"Modified: / 11.11.1998 / 15:07:09 / cg" |
255 | 4841 |
! |
4842 |
||
4843 |
_Math_sqrt:nativeContext |
|
4844 |
"square root" |
|
4845 |
||
4846 |
|dVal| |
|
4847 |
||
4848 |
dVal := nativeContext argAt:1. |
|
432 | 4849 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4850 |
"/ dVal isReal ifTrue:[ |
|
4851 |
"/ 'JAVAVM [info]: missing double flag in Math>>sqrt' infoPrintCR. |
|
4852 |
"/ ] ifFalse:[ |
|
4853 |
"/ self halt:'expected double arg' |
|
4854 |
"/ ] |
|
4855 |
"/ ]. |
|
4856 |
||
4857 |
"/ how about domain errors ? |
|
507 | 4858 |
dVal < 0 ifTrue:[ |
4859 |
^ 0.0 |
|
4860 |
]. |
|
255 | 4861 |
^ dVal sqrt |
4862 |
||
4863 |
"Created: / 7.1.1998 / 15:42:40 / cg" |
|
507 | 4864 |
"Modified: / 29.12.1998 / 13:22:36 / cg" |
255 | 4865 |
! |
4866 |
||
342 | 4867 |
_Math_tan:nativeContext |
4868 |
"tangent" |
|
4869 |
||
4870 |
|dVal| |
|
4871 |
||
4872 |
dVal := nativeContext argAt:1. |
|
432 | 4873 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4874 |
"/ dVal isReal ifTrue:[ |
|
4875 |
"/ 'JAVAVM [info]: missing double flag in Math>>tan' infoPrintCR. |
|
4876 |
"/ ] ifFalse:[ |
|
4877 |
"/ self halt:'expected double arg' |
|
4878 |
"/ ] |
|
4879 |
"/ ]. |
|
342 | 4880 |
^ dVal tan |
4881 |
||
4882 |
"Created: / 7.5.1998 / 00:34:03 / cg" |
|
432 | 4883 |
"Modified: / 11.11.1998 / 15:07:14 / cg" |
342 | 4884 |
! |
4885 |
||
334 | 4886 |
_Method_getModifiers:nativeContext |
4887 |
|jMethod mthd retVal| |
|
4888 |
||
4889 |
jMethod := nativeContext receiver. |
|
4890 |
||
4891 |
mthd := JavaMethods at:jMethod ifAbsent:nil. |
|
4892 |
mthd isNil ifTrue:[ |
|
4893 |
self halt. |
|
4894 |
^ 0 |
|
4895 |
]. |
|
4896 |
^ mthd accessFlags |
|
4897 |
||
4898 |
"Modified: / 9.4.1998 / 17:50:01 / cg" |
|
4899 |
! |
|
4900 |
||
322 | 4901 |
_Method_invoke:nativeContext |
4902 |
"invoke a javaMethod" |
|
4903 |
||
4904 |
|jMethod mthd rec args retVal| |
|
4905 |
||
4906 |
jMethod := nativeContext receiver. |
|
4907 |
rec := nativeContext argAt:1. |
|
4908 |
args := nativeContext argAt:2. |
|
4909 |
||
4910 |
mthd := JavaMethods at:jMethod ifAbsent:nil. |
|
4911 |
mthd isNil ifTrue:[ |
|
4912 |
self halt. |
|
4913 |
]. |
|
4914 |
||
4915 |
"/ check for arguments to match the expected types ... |
|
4916 |
||
4917 |
mthd argSignature keysAndValuesDo:[:index :argSig | |
|
4918 |
|cls arg| |
|
4919 |
||
4920 |
cls := Java at:argSig. |
|
4921 |
arg := args at:index. |
|
4922 |
(arg isKindOf:cls) ifFalse:[ |
|
4923 |
self halt. |
|
4924 |
] |
|
4925 |
]. |
|
4926 |
||
4927 |
mthd isStatic ifTrue:[ |
|
4928 |
retVal := mthd valueWithReceiver:(mthd javaClass) arguments:args selector:mthd selector. |
|
4929 |
^ retVal |
|
4930 |
] ifFalse:[ |
|
4931 |
self halt. |
|
4932 |
]. |
|
4933 |
||
4934 |
self halt. |
|
4935 |
||
4936 |
"Created: / 13.2.1998 / 15:15:28 / cg" |
|
4937 |
"Modified: / 13.2.1998 / 15:35:54 / cg" |
|
4938 |
! |
|
4939 |
||
253 | 4940 |
_Object_clone:nativeContext |
4941 |
"clone an object" |
|
4942 |
||
4943 |
|o rslt| |
|
4944 |
||
4945 |
o := nativeContext receiver. |
|
4946 |
rslt := o shallowCopy. |
|
4947 |
^ rslt |
|
4948 |
||
4949 |
"Created: / 4.1.1998 / 19:39:26 / cg" |
|
4950 |
! |
|
4951 |
||
255 | 4952 |
_Object_getClass:nativeContext |
4953 |
"return an objects class" |
|
4954 |
||
4955 |
|o cls jClass| |
|
4956 |
||
4957 |
o := nativeContext receiver. |
|
4958 |
cls := o class. |
|
4959 |
||
268
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
4960 |
jClass := self javaClassObjectForClass:cls. |
255 | 4961 |
^ jClass |
4962 |
||
4963 |
"Created: / 6.1.1998 / 18:28:27 / cg" |
|
268
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
4964 |
"Modified: / 23.1.1998 / 17:48:22 / cg" |
255 | 4965 |
! |
4966 |
||
253 | 4967 |
_Object_hashCode:nativeContext |
4968 |
"identityHash" |
|
4969 |
||
4970 |
|o rslt| |
|
4971 |
||
4972 |
o := nativeContext receiver. |
|
4973 |
rslt := o identityHash. |
|
4974 |
^ rslt |
|
4975 |
||
4976 |
"Created: / 4.1.1998 / 19:40:26 / cg" |
|
4977 |
! |
|
4978 |
||
255 | 4979 |
_Object_notify:nativeContext |
4980 |
"wakeup" |
|
4981 |
||
4982 |
self wakeup:(nativeContext receiver). |
|
4983 |
||
4984 |
"Created: / 6.1.1998 / 21:09:26 / cg" |
|
4985 |
! |
|
4986 |
||
253 | 4987 |
_Object_notifyAll:nativeContext |
4988 |
self wakeupAll:(nativeContext receiver). |
|
4989 |
||
4990 |
"Created: / 3.1.1998 / 03:06:56 / cg" |
|
4991 |
! |
|
4992 |
||
4993 |
_Object_wait:nativeMethodContext |
|
4994 |
"wait" |
|
4995 |
||
508 | 4996 |
|tmo handle sema| |
253 | 4997 |
|
4998 |
handle := nativeMethodContext receiver. |
|
4999 |
tmo := nativeMethodContext argAt:1. |
|
5000 |
||
5001 |
sema := JavaVM semaphoreFor:handle. |
|
5002 |
||
5003 |
[ |
|
508 | 5004 |
self waitFor:sema state:#javaWait timeOut:tmo. |
5005 |
] valueOnUnwindDo:[ |
|
306 | 5006 |
JavaVM releaseSemaphoreFor:handle. |
253 | 5007 |
]. |
5008 |
||
5009 |
ThreadTrace ifTrue:[ |
|
306 | 5010 |
'====> thread continues ...' printCR. |
253 | 5011 |
] |
5012 |
||
508 | 5013 |
"Modified: / 30.12.1998 / 19:20:43 / cg" |
253 | 5014 |
! |
5015 |
||
5016 |
_Runtime_buildLibName:nativeContext |
|
5017 |
|jPath jFileName path fileName libName| |
|
5018 |
||
5019 |
jPath := nativeContext argAt:1. |
|
5020 |
jFileName := nativeContext argAt:2. |
|
5021 |
||
5022 |
path := Java as_ST_String:jPath. |
|
5023 |
fileName := Java as_ST_String:jFileName. |
|
5024 |
||
5025 |
path = '__builtIn__' ifTrue:[ |
|
261 | 5026 |
libName := path , '/' , fileName |
253 | 5027 |
] ifFalse:[ |
261 | 5028 |
libName := path , '/lib' , fileName , '.so'. |
253 | 5029 |
]. |
5030 |
^ Java as_String:libName. |
|
5031 |
||
5032 |
"Modified: / 8.8.1997 / 12:05:05 / cg" |
|
5033 |
"Created: / 4.1.1998 / 19:07:14 / cg" |
|
5034 |
! |
|
5035 |
||
261 | 5036 |
_Runtime_execInternal:nativeContext |
5037 |
"Run a unix-command; return a process object." |
|
5038 |
||
5039 |
|cmdAndArgArray envArray cmd jProcessClass jProcess| |
|
5040 |
||
432 | 5041 |
cmdAndArgArray := nativeContext argAt:1. |
5042 |
envArray := nativeContext argAt:2. |
|
5043 |
||
5044 |
cmd := cmdAndArgArray at:1. |
|
5045 |
||
5046 |
OperatingSystem isUNIXlike ifTrue:[ |
|
5047 |
jProcessClass := Java classForName:'java.lang.UNIXProcess'. |
|
5048 |
] ifFalse:[ |
|
5049 |
jProcessClass := Java classForName:'java.lang.Win32Process'. |
|
5050 |
]. |
|
261 | 5051 |
"/ |
432 | 5052 |
jProcessClass notNil ifTrue:[ |
495 | 5053 |
self halt. |
432 | 5054 |
jProcess := jProcessClass newCleared. |
5055 |
jProcess |
|
5056 |
perform:#'<init>([Ljava/lang/String;[Ljava/lang/String;)V' |
|
5057 |
with:cmdAndArgArray |
|
5058 |
with:envArray. |
|
5059 |
^ jProcess |
|
5060 |
]. |
|
5061 |
self halt. |
|
261 | 5062 |
self throwIOExceptionWithMessage:'Process execution disabled/unimplemented'. |
5063 |
^ nil |
|
5064 |
||
5065 |
"Created: / 15.1.1998 / 01:50:31 / cg" |
|
495 | 5066 |
"Modified: / 11.12.1998 / 13:09:36 / cg" |
261 | 5067 |
! |
5068 |
||
255 | 5069 |
_Runtime_exitInternal:nativeContext |
5070 |
"exit - here, we only shut down java threads" |
|
5071 |
||
5072 |
|enteredMonitors| |
|
5073 |
||
474 | 5074 |
ExitDebug == true ifTrue:[ |
5075 |
self halt:'Java code called exit'. |
|
5076 |
]. |
|
5077 |
||
520 | 5078 |
self syncMonitorCache. |
255 | 5079 |
(enteredMonitors := self enteredMonitors) size > 0 ifTrue:[ |
306 | 5080 |
enteredMonitors do:[:handle | |
5081 |
| mon | |
|
5082 |
||
5083 |
mon := LockTable at:handle ifAbsent:nil. |
|
5084 |
mon isNil ifTrue:[ |
|
5085 |
self halt:'no monitor in exitInternal'. |
|
5086 |
] ifFalse:[ |
|
5087 |
mon exit. |
|
255 | 5088 |
('====> terminateThread - exit monitor for ' , handle displayString , ' in ' , Processor activeProcess name , ' ...') infoPrintCR. |
306 | 5089 |
]. |
5090 |
]. |
|
5091 |
]. |
|
5092 |
||
520 | 5093 |
"/ TODO: shut down all threads created by this one ... |
5094 |
||
255 | 5095 |
AbortSignal raise. |
5096 |
self halt. |
|
5097 |
||
5098 |
"Created: / 7.1.1998 / 22:48:51 / cg" |
|
520 | 5099 |
"Modified: / 8.1.1999 / 14:09:36 / cg" |
255 | 5100 |
! |
5101 |
||
5102 |
_Runtime_freeMemory:nativeContext |
|
5103 |
"free memory - Returns the number of free bytes" |
|
5104 |
||
5105 |
^ ObjectMemory freeListSpace + ObjectMemory freeSpace |
|
5106 |
||
5107 |
"Created: / 12.1.1998 / 12:59:53 / cg" |
|
5108 |
! |
|
5109 |
||
5110 |
_Runtime_gc:nativeContext |
|
5111 |
"Runs the garbage collector. |
|
5112 |
Ignored, since the ST-gc runs all the time." |
|
5113 |
||
5114 |
^ self |
|
5115 |
||
5116 |
"Modified: / 12.1.1998 / 12:58:32 / cg" |
|
5117 |
! |
|
5118 |
||
253 | 5119 |
_Runtime_initializeLinkerInternal:nativeContext |
5120 |
"init sharedLib linker, return searchPath as javaString" |
|
5121 |
||
5122 |
|path| |
|
5123 |
||
5124 |
"/ mhmh - what is done here ? |
|
5125 |
||
5126 |
path := ''. |
|
5127 |
LibPath do:[:comp | path size == 0 ifTrue:[ |
|
261 | 5128 |
path := path , comp |
5129 |
] ifFalse:[ |
|
5130 |
path := path , ':' , comp |
|
5131 |
] |
|
5132 |
]. |
|
253 | 5133 |
|
5134 |
^ Java as_String:path |
|
5135 |
||
5136 |
"Modified: / 7.8.1997 / 21:17:03 / cg" |
|
5137 |
"Created: / 4.1.1998 / 17:53:15 / cg" |
|
5138 |
! |
|
5139 |
||
5140 |
_Runtime_loadFileInternal:nativeContext |
|
5141 |
"load a sharedLib, return boolean 0 (false) if fail; 1 (true) if ok" |
|
5142 |
||
5143 |
|ret| |
|
5144 |
||
5145 |
ret := self _Runtime_loadFileInternalI:nativeContext. |
|
5146 |
ret < 0 ifTrue:[ ret := 0 ]. |
|
5147 |
^ ret |
|
5148 |
||
5149 |
"Created: / 4.1.1998 / 19:10:20 / cg" |
|
5150 |
"Modified: / 4.1.1998 / 19:11:04 / cg" |
|
5151 |
! |
|
5152 |
||
5153 |
_Runtime_loadFileInternalI:nativeContext |
|
5154 |
"1.1b3 change; load a sharedLib like 'loadFileInternal', |
|
5155 |
but return integer: |
|
319 | 5156 |
-1 outOfMemory error |
5157 |
0 failed to load |
|
5158 |
1 loaded or already loaded (i.e. ok)" |
|
253 | 5159 |
|
5160 |
|jLibName libName libHandle| |
|
5161 |
||
5162 |
jLibName := nativeContext argAt:1. |
|
5163 |
libName := Java as_ST_String:jLibName. |
|
5164 |
||
5165 |
(SimulatedLibs includes:libName) ifTrue:[ |
|
319 | 5166 |
"/ ('JAVA: builtIn libLoad simulated: ' , libName) printNL. |
5167 |
^ 1 |
|
253 | 5168 |
]. |
5169 |
(LoadedLibs notNil and:[LoadedLibs includesKey:libName]) ifTrue:[ |
|
319 | 5170 |
"/ ('JAVA: already loaded: ' , libName) printNL. |
5171 |
^ 1 |
|
253 | 5172 |
]. |
5173 |
||
5174 |
libName asFilename exists ifFalse:[ |
|
319 | 5175 |
('JAVA: no file to load: ' , libName) printNL. |
5176 |
^ 0 |
|
5177 |
]. |
|
5178 |
||
5179 |
(self confirm:'permission to load native library: ' , libName , ' ?') ifFalse:[ |
|
5180 |
^ 0 |
|
253 | 5181 |
]. |
5182 |
||
5183 |
libHandle := ObjectFileLoader loadLibrary:libName. |
|
5184 |
libHandle isNil ifTrue:[ |
|
319 | 5185 |
('JAVA: failed to load: ' , libName) printNL. |
5186 |
^ 0 |
|
253 | 5187 |
]. |
5188 |
||
5189 |
LoadedLibs isNil ifTrue:[ |
|
319 | 5190 |
LoadedLibs := Dictionary new. |
253 | 5191 |
]. |
5192 |
||
5193 |
LoadedLibs at:libName put:libHandle. |
|
5194 |
^ 1 |
|
5195 |
||
5196 |
"Created: / 4.1.1998 / 19:10:54 / cg" |
|
319 | 5197 |
"Modified: / 6.2.1998 / 03:11:59 / cg" |
253 | 5198 |
! |
5199 |
||
440 | 5200 |
_Runtime_runFinalization:nativeContext |
5201 |
"/ void runFinalization () |
|
5202 |
UnimplementedNativeMethodSignal raise |
|
5203 |
||
5204 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
5205 |
"Created: / 12.11.1998 / 18:59:01 / cg" |
|
5206 |
! |
|
5207 |
||
380 | 5208 |
_Runtime_runFinalizersOnExit0:nativeContext |
5209 |
"" |
|
5210 |
||
5211 |
|onOff| |
|
5212 |
||
5213 |
onOff := nativeContext argAt:1. |
|
5214 |
^ 1 |
|
5215 |
||
5216 |
"Modified: / 6.2.1998 / 03:11:59 / cg" |
|
5217 |
"Created: / 15.10.1998 / 23:34:55 / cg" |
|
5218 |
! |
|
5219 |
||
255 | 5220 |
_Runtime_totalMemory:nativeContext |
5221 |
"free memory - Returns the total number of bytes" |
|
5222 |
||
5223 |
^ ObjectMemory oldSpaceSize + ObjectMemory newSpaceSize |
|
5224 |
||
5225 |
"Created: / 12.1.1998 / 12:59:23 / cg" |
|
5226 |
! |
|
5227 |
||
440 | 5228 |
_Runtime_traceInstructions:nativeContext |
5229 |
"/ void traceInstructions (boolean) |
|
5230 |
UnimplementedNativeMethodSignal raise |
|
5231 |
||
5232 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
5233 |
"Created: / 12.11.1998 / 18:59:18 / cg" |
|
5234 |
! |
|
5235 |
||
5236 |
_Runtime_traceMethodCalls:nativeContext |
|
5237 |
"/ void traceMethodCalls (boolean) |
|
5238 |
UnimplementedNativeMethodSignal raise |
|
5239 |
||
5240 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
5241 |
"Created: / 12.11.1998 / 18:59:37 / cg" |
|
5242 |
! |
|
5243 |
||
5244 |
_SecurityManager_classDepth:nativeContext |
|
5245 |
UnimplementedNativeMethodSignal raise |
|
5246 |
||
5247 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
5248 |
"Created: / 12.11.1998 / 18:56:27 / cg" |
|
5249 |
! |
|
5250 |
||
261 | 5251 |
_SecurityManager_classLoaderDepth:nativeContext |
5252 |
|con depth| |
|
5253 |
||
5254 |
con := thisContext sender. |
|
5255 |
depth := 1. |
|
5256 |
[con notNil] whileTrue:[ |
|
5257 |
con receiver == JavaClassReader classLoaderQuerySignal ifTrue:[ |
|
5258 |
con selector == #handle:do: ifTrue:[ |
|
5259 |
depth := depth + 1 |
|
5260 |
] |
|
5261 |
]. |
|
5262 |
con := con sender. |
|
5263 |
]. |
|
5264 |
'JAVA: classLoaderDepth -> ' infoPrint. depth infoPrintCR. |
|
5265 |
^ depth. |
|
5266 |
||
5267 |
"Created: / 13.1.1998 / 09:21:46 / cg" |
|
5268 |
"Modified: / 13.1.1998 / 09:33:43 / cg" |
|
5269 |
! |
|
5270 |
||
5271 |
_SecurityManager_currentClassLoader:nativeContext |
|
5272 |
|loader| |
|
5273 |
||
5274 |
loader := JavaClassReader classLoaderQuerySignal raise. |
|
494 | 5275 |
"/ 'JAVA: currentClassLoader -> ' infoPrint. loader displayString infoPrintCR. |
261 | 5276 |
^ loader. |
5277 |
||
5278 |
"Created: / 13.1.1998 / 09:23:28 / cg" |
|
494 | 5279 |
"Modified: / 11.12.1998 / 12:39:59 / cg" |
261 | 5280 |
! |
5281 |
||
440 | 5282 |
_SecurityManager_currentLoadedClass0:nativeContext |
5283 |
UnimplementedNativeMethodSignal raise |
|
5284 |
||
5285 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
5286 |
"Created: / 12.11.1998 / 18:56:41 / cg" |
|
5287 |
! |
|
5288 |
||
5289 |
_SecurityManager_getClassContext:nativeContext |
|
5290 |
UnimplementedNativeMethodSignal raise |
|
5291 |
||
5292 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
5293 |
"Created: / 12.11.1998 / 18:56:06 / cg" |
|
5294 |
! |
|
5295 |
||
5296 |
_String_intern:nativeContext |
|
5297 |
UnimplementedNativeMethodSignal raise |
|
5298 |
||
5299 |
"Created: / 12.11.1998 / 18:50:56 / cg" |
|
5300 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
5301 |
! |
|
5302 |
||
253 | 5303 |
_System_arraycopy:nativeContext |
398 | 5304 |
|srcArray srcIdx dstArray dstIdx count dstEndIdx| |
253 | 5305 |
|
5306 |
srcArray := nativeContext argAt:1. |
|
5307 |
srcIdx := nativeContext argAt:2. |
|
5308 |
dstArray := nativeContext argAt:3. |
|
5309 |
dstIdx := nativeContext argAt:4. |
|
5310 |
count := nativeContext argAt:5. |
|
5311 |
||
398 | 5312 |
dstEndIdx := dstIdx + count. |
5313 |
dstIdx := dstIdx + 1. "/ ST uses 1-based indexing |
|
5314 |
srcIdx := srcIdx + 1. "/ ST uses 1-based indexing |
|
5315 |
||
253 | 5316 |
srcArray class isBytes ifTrue:[ |
398 | 5317 |
dstArray class isBytes ifFalse:[ |
5318 |
self halt:'incompatible arraycopy collections'. |
|
5319 |
]. |
|
5320 |
dstArray replaceBytesFrom:dstIdx to:dstEndIdx with:srcArray startingAt:srcIdx. |
|
253 | 5321 |
] ifFalse:[ |
398 | 5322 |
dstArray replaceFrom:dstIdx to:dstEndIdx with:srcArray startingAt:srcIdx. |
253 | 5323 |
]. |
5324 |
^ nil. |
|
5325 |
||
5326 |
"Created: / 3.1.1998 / 01:56:44 / cg" |
|
398 | 5327 |
"Modified: / 20.10.1998 / 16:22:46 / cg" |
253 | 5328 |
! |
5329 |
||
5330 |
_System_currentTimeMillis:nativeContext |
|
5331 |
"return the milliseconds since 1.jan.1970" |
|
5332 |
||
368 | 5333 |
|seconds delta| |
5334 |
||
5335 |
"/ workaround win32 bug (use 01:01:01 as base) |
|
5336 |
delta := AbsoluteTime now millisecondDeltaFrom:(AbsoluteTime day:1 month:1 year:1970 hour:1 minutes:1 seconds:1). |
|
5337 |
delta := delta - 3600 - 60 - 1. |
|
507 | 5338 |
"/ "/ make certain, it fits 64 signed bits |
5339 |
"/ delta := delta bitAnd:16r7FFFFFFFFFFFFFFF. |
|
5340 |
"/ ^ delta max:0 |
|
5341 |
^ delta |
|
5342 |
||
5343 |
" |
|
5344 |
JavaVM _System_currentTimeMillis:nil |
|
5345 |
" |
|
5346 |
||
5347 |
"Modified: / 23.12.1998 / 21:54:50 / cg" |
|
253 | 5348 |
! |
5349 |
||
440 | 5350 |
_System_identityHashCode:nativeContext |
5351 |
UnimplementedNativeMethodSignal raise |
|
5352 |
||
5353 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
5354 |
"Created: / 12.11.1998 / 18:54:00 / cg" |
|
5355 |
! |
|
5356 |
||
253 | 5357 |
_System_initProperties:nativeContext |
5358 |
|props stProps| |
|
5359 |
||
5360 |
props := nativeContext argAt:1. |
|
5361 |
stProps := self systemProperties. |
|
5362 |
||
5363 |
"/ recursively invoke myself on the Java HashTable. |
|
5364 |
"/ calling 'put' to stuff in the values ... |
|
5365 |
||
5366 |
stProps keysAndValuesDo:[:key :value | |
|
270 | 5367 |
|keyObj valueObj| |
5368 |
||
5369 |
keyObj := Java as_String:key. |
|
5370 |
valueObj := Java as_String:value. |
|
5371 |
||
5372 |
props |
|
5373 |
perform:#'put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;' |
|
5374 |
with:keyObj |
|
5375 |
with:valueObj. |
|
253 | 5376 |
]. |
5377 |
^ props |
|
5378 |
||
5379 |
"Created: / 3.1.1998 / 14:25:22 / cg" |
|
5380 |
"Modified: / 4.1.1998 / 14:23:18 / cg" |
|
5381 |
! |
|
5382 |
||
5383 |
_System_setErr0:nativeContext |
|
5384 |
|stream| |
|
5385 |
||
5386 |
stream := nativeContext argAt:1. |
|
5387 |
||
5388 |
self setOpenFile:(self javaConsoleStream ? Stderr) at:2. |
|
5389 |
||
5390 |
nativeContext receiver instVarNamed:'err' put:stream. |
|
5391 |
||
5392 |
"Created: / 18.3.1997 / 15:02:05 / cg" |
|
5393 |
"Modified: / 4.1.1998 / 16:21:15 / cg" |
|
5394 |
! |
|
5395 |
||
5396 |
_System_setIn0:nativeContext |
|
5397 |
|stream| |
|
5398 |
||
5399 |
stream := nativeContext argAt:1. |
|
5400 |
||
5401 |
self setOpenFile:Stdin at:0. |
|
5402 |
||
5403 |
nativeContext receiver instVarNamed:'in' put:stream. |
|
5404 |
||
5405 |
"Created: / 4.1.1998 / 16:16:38 / cg" |
|
5406 |
"Modified: / 4.1.1998 / 16:20:44 / cg" |
|
5407 |
! |
|
5408 |
||
5409 |
_System_setOut0:nativeContext |
|
5410 |
|stream| |
|
5411 |
||
5412 |
stream := nativeContext argAt:1. |
|
5413 |
||
5414 |
self setOpenFile:(self javaConsoleStream ? Stdout) at:1. |
|
5415 |
||
5416 |
nativeContext receiver instVarNamed:'out' put:stream. |
|
5417 |
||
5418 |
"Created: / 4.1.1998 / 16:18:26 / cg" |
|
5419 |
"Modified: / 4.1.1998 / 16:20:23 / cg" |
|
5420 |
! |
|
5421 |
||
440 | 5422 |
_Thread_countStackFrames:nativeContext |
5423 |
"/ int countStackFrames () |
|
5424 |
UnimplementedNativeMethodSignal raise |
|
5425 |
||
5426 |
"Created: / 12.11.1998 / 19:06:21 / cg" |
|
5427 |
! |
|
5428 |
||
253 | 5429 |
_Thread_currentThread:nativeMethodContext |
5430 |
|t p prio| |
|
5431 |
||
5432 |
p := Processor activeProcess. |
|
5433 |
t := self javaThreadForSTProcess:p. |
|
5434 |
t notNil ifTrue:[ |
|
261 | 5435 |
^ t |
253 | 5436 |
]. |
5437 |
t := self newThread:'main'. |
|
5438 |
Java threads at:t put:p. |
|
5439 |
^ t |
|
5440 |
||
5441 |
"Created: / 3.1.1998 / 01:42:28 / cg" |
|
5442 |
"Modified: / 4.1.1998 / 14:59:13 / cg" |
|
5443 |
! |
|
5444 |
||
339 | 5445 |
_Thread_interrupt0:nativeContext |
5446 |
"ask if a thread is interrupted (clear interruptState if arg is true)" |
|
5447 |
||
5448 |
|jThread stProcess| |
|
5449 |
||
5450 |
jThread := nativeContext receiver. |
|
5451 |
stProcess := self stProcessForJavaThread:jThread. |
|
5452 |
stProcess isNil ifTrue:[ |
|
5453 |
self halt. |
|
5454 |
^ 0 |
|
5455 |
]. |
|
5456 |
||
5457 |
stProcess markInterrupted |
|
5458 |
||
5459 |
"Modified: / 2.1.1998 / 21:49:06 / cg" |
|
5460 |
"Created: / 10.4.1998 / 15:21:43 / cg" |
|
5461 |
! |
|
5462 |
||
253 | 5463 |
_Thread_isAlive:nativeContext |
5464 |
"is it alive ?" |
|
5465 |
||
5466 |
|jThread stProcess| |
|
5467 |
||
5468 |
jThread := nativeContext receiver. |
|
5469 |
stProcess := JavaVM stProcessForJavaThread:jThread. |
|
5470 |
stProcess isNil ifTrue:[ |
|
318 | 5471 |
ThreadTrace == true ifTrue:[ |
5472 |
('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL. |
|
5473 |
]. |
|
5474 |
^ 0 "FALSE" |
|
255 | 5475 |
]. |
5476 |
stProcess isDead ifTrue:[^ 0 "FALSE"]. |
|
5477 |
^ 1 "TRUE" |
|
5478 |
||
5479 |
"Created: / 5.1.1998 / 02:03:51 / cg" |
|
318 | 5480 |
"Modified: / 6.2.1998 / 02:15:01 / cg" |
255 | 5481 |
! |
5482 |
||
5483 |
_Thread_isInterrupted:nativeContext |
|
5484 |
"ask if a thread is interrupted (clear interruptState if arg is true)" |
|
5485 |
||
5486 |
|jThread stProcess clearInterrupt rslt| |
|
5487 |
||
5488 |
jThread := nativeContext receiver. |
|
5489 |
stProcess := self stProcessForJavaThread:jThread. |
|
5490 |
stProcess isNil ifTrue:[ |
|
261 | 5491 |
self halt. |
5492 |
^ 0 |
|
253 | 5493 |
]. |
255 | 5494 |
|
5495 |
clearInterrupt := nativeContext argAt:1. |
|
5496 |
rslt := stProcess isInterrupted ifTrue:[1] ifFalse:[0]. |
|
5497 |
clearInterrupt ~~ 0 ifTrue:[stProcess clearInterruptActions]. |
|
5498 |
^ rslt |
|
5499 |
||
5500 |
"Modified: / 2.1.1998 / 21:49:06 / cg" |
|
5501 |
"Created: / 7.1.1998 / 18:50:26 / cg" |
|
5502 |
! |
|
5503 |
||
5504 |
_Thread_resume0:nativeContext |
|
5505 |
"yield" |
|
5506 |
||
5507 |
|jThread stProcess| |
|
5508 |
||
5509 |
jThread := nativeContext receiver. |
|
5510 |
stProcess := JavaVM stProcessForJavaThread:jThread. |
|
5511 |
stProcess isNil ifTrue:[ |
|
318 | 5512 |
ThreadTrace == true ifTrue:[ |
5513 |
('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL. |
|
5514 |
]. |
|
5515 |
^ nil "void" |
|
255 | 5516 |
]. |
5517 |
stProcess resume |
|
5518 |
||
5519 |
"Created: / 8.1.1998 / 01:06:27 / cg" |
|
318 | 5520 |
"Modified: / 6.2.1998 / 02:15:08 / cg" |
253 | 5521 |
! |
5522 |
||
5523 |
_Thread_setPriority0:nativeMethodContext |
|
5524 |
|t p prio| |
|
5525 |
||
5526 |
t := nativeMethodContext receiver. |
|
5527 |
p := JavaVM stProcessForJavaThread:t. |
|
5528 |
prio := nativeMethodContext argAt:1. |
|
5529 |
||
5530 |
p isNil ifTrue:[ |
|
318 | 5531 |
ThreadTrace == true ifTrue:[ |
5532 |
'JAVA [info]: no process yet (in setPriority)' infoPrintCR. |
|
5533 |
]. |
|
5534 |
^ nil |
|
253 | 5535 |
]. |
5536 |
||
5537 |
ThreadTrace ifTrue:[ |
|
318 | 5538 |
'JAVA [info]: setPrio: ' print. t print. ' pri= ' print. prio print. ' p= ' print. p printNL. |
253 | 5539 |
]. |
5540 |
^ nil |
|
5541 |
||
5542 |
"Created: / 2.1.1998 / 19:05:55 / cg" |
|
318 | 5543 |
"Modified: / 6.2.1998 / 02:28:18 / cg" |
253 | 5544 |
! |
5545 |
||
255 | 5546 |
_Thread_sleep:nativeContext |
5547 |
"sleep for some milliseconds " |
|
5548 |
||
5549 |
|millis| |
|
5550 |
||
432 | 5551 |
millis := nativeContext argAt:1. |
526 | 5552 |
self waitFor:nil state:nil timeOut:(millis max:50) |
5553 |
||
5554 |
"Modified: / 8.1.1999 / 16:42:52 / cg" |
|
255 | 5555 |
! |
5556 |
||
253 | 5557 |
_Thread_start:nativeContext |
5558 |
"start the thread" |
|
5559 |
||
526 | 5560 |
|jThread jName name stProcess screenUpdaterClass| |
253 | 5561 |
|
5562 |
jThread := nativeContext receiver. |
|
5563 |
(jThread instVarNamed:'priority') < 1 ifTrue:[ |
|
297 | 5564 |
self halt. |
5565 |
jThread instVarNamed:'priority' put:1. |
|
253 | 5566 |
]. |
5567 |
||
5568 |
stProcess := JavaProcess |
|
297 | 5569 |
for:[ |
405 | 5570 |
|procName| |
5571 |
||
5572 |
Object abortSignal handle:[:ex | |
|
5573 |
procName := stProcess name. |
|
483 | 5574 |
(procName startsWith:'JAVA-AWT-EventQueue') ifTrue:[ |
5575 |
('JAVA: thread ' , procName , ' aborted - restarting process.') infoPrintCR. |
|
5576 |
ex restart. |
|
5577 |
] ifFalse:[ |
|
526 | 5578 |
stProcess == JavaScreenUpdaterThread ifTrue:[ |
5579 |
('JAVA: thread ' , procName , ' aborted - restarting process.') infoPrintCR. |
|
5580 |
ex restart |
|
5581 |
] ifFalse:[ |
|
5582 |
('JAVA: thread ' , procName , ' aborted.') infoPrintCR. |
|
5583 |
] |
|
483 | 5584 |
]. |
405 | 5585 |
] do:[ |
297 | 5586 |
[ |
5587 |
JavaVM javaExceptionSignal handle:[:ex | |
|
405 | 5588 |
|exClass| |
297 | 5589 |
|
5590 |
procName := stProcess name. |
|
5591 |
exClass := ex parameter class. |
|
5592 |
||
5593 |
exClass == (Java at:'java.lang.ThreadDeath') ifTrue:[ |
|
5594 |
('JAVA: thread ' , procName , ' terminated') infoPrintCR. |
|
5595 |
] ifFalse:[ |
|
5596 |
Transcript |
|
5597 |
showCR:('JAVA: thread ''' |
|
5598 |
, procName |
|
5599 |
, ''' terminated with exception: ' |
|
5600 |
, exClass name). |
|
5601 |
]. |
|
5602 |
ex return. |
|
5603 |
] do:[ |
|
495 | 5604 |
Object messageNotUnderstoodSignal handle:[:ex | |
5605 |
"/ remap doesNotUnderstand with nil-receiver to |
|
5606 |
"/ a nullPointerException ... |
|
5607 |
|con| |
|
5608 |
||
5609 |
con := ex suspendedContext. |
|
5610 |
con receiver isNil ifTrue:[ |
|
507 | 5611 |
con sender method isJavaMethod ifTrue:[ |
5612 |
self throwNullPointerException. |
|
5613 |
AbortSignal raise. "/ ex proceed. |
|
5614 |
] |
|
495 | 5615 |
]. |
5616 |
ex reject. |
|
5617 |
] do:[ |
|
5618 |
jThread perform:#'run()V'. |
|
5619 |
ThreadTrace == true ifTrue:[ |
|
5620 |
('JAVA: thread ' , stProcess name , ' terminated') infoPrintCR. |
|
5621 |
]. |
|
5622 |
jThread perform:#'exit()V'. |
|
5623 |
ThreadTrace == true ifTrue:[ |
|
5624 |
('JAVA: after exit of thread ' , stProcess name) infoPrintCR. |
|
5625 |
] |
|
316 | 5626 |
] |
297 | 5627 |
] |
5628 |
] valueNowOrOnUnwindDo:[ |
|
495 | 5629 |
|monitors| |
5630 |
||
5631 |
monitors := EnteredMonitorsPerProcess at:stProcess ifAbsent:nil. |
|
5632 |
monitors notNil ifTrue:[ |
|
5633 |
monitors do:[:obj | |
|
5634 |
| mon | |
|
5635 |
||
5636 |
mon := self monitorFor:obj. |
|
5637 |
mon notNil ifTrue:[ |
|
5638 |
mon owningProcess == stProcess ifTrue:[ |
|
5639 |
('JAVA: release monitor owned by dying thread: ' , stProcess name) infoPrintCR. |
|
5640 |
mon exit |
|
5641 |
]. |
|
5642 |
]. |
|
5643 |
]. |
|
5644 |
EnteredMonitorsPerProcess removeKey:stProcess. |
|
526 | 5645 |
|
5646 |
stProcess == JavaScreenUpdaterThread ifTrue:[ |
|
5647 |
JavaScreenUpdaterThread := nil. |
|
5648 |
]. |
|
5649 |
"/ screenUpdaterClass := Java at:'sun.awt.ScreenUpdater'. |
|
5650 |
"/ screenUpdaterClass notNil ifTrue:[ |
|
5651 |
"/ screenUpdaterClass instVarNamed:'updater' put:nil. |
|
5652 |
"/ ]. |
|
495 | 5653 |
]. |
297 | 5654 |
Java threads removeKey:jThread ifAbsent:[]. |
5655 |
] |
|
405 | 5656 |
] |
297 | 5657 |
] |
5658 |
priority:(Processor activePriority). |
|
253 | 5659 |
|
5660 |
jName := jThread instVarNamed:'name'. |
|
5661 |
jName isString ifFalse:[ |
|
297 | 5662 |
name := Java as_ST_String:jName. |
253 | 5663 |
] ifTrue:[ |
297 | 5664 |
name := jName |
5665 |
]. |
|
5666 |
||
5667 |
"/ kludge - remember the ScreenUpdater ... |
|
5668 |
name = 'Screen Updater' ifTrue:[ |
|
526 | 5669 |
JavaScreenUpdaterThread := stProcess. |
253 | 5670 |
]. |
5671 |
||
508 | 5672 |
"/name = 'UserDialogShowThread' ifTrue:[ |
5673 |
"/self halt |
|
5674 |
"/]. |
|
253 | 5675 |
"/ when that process terminates, wakup any waiters |
5676 |
stProcess addExitAction:[self wakeup:jThread]. |
|
5677 |
||
5678 |
stProcess name:'JAVA-' , name. |
|
5679 |
stProcess resume. |
|
5680 |
||
5681 |
Java threads at:jThread put:stProcess. |
|
5682 |
||
5683 |
^ nil |
|
5684 |
||
5685 |
"Created: / 3.1.1998 / 02:05:52 / cg" |
|
526 | 5686 |
"Modified: / 8.1.1999 / 17:44:10 / cg" |
255 | 5687 |
! |
5688 |
||
5689 |
_Thread_stop0:nativeContext |
|
5690 |
"terminate a thread" |
|
5691 |
||
5692 |
|jThread stProcess death| |
|
5693 |
||
5694 |
jThread := nativeContext receiver. |
|
5695 |
||
5696 |
stProcess := JavaVM stProcessForJavaThread:jThread. |
|
5697 |
stProcess isNil ifTrue:[ |
|
318 | 5698 |
ThreadTrace == true ifTrue:[ |
5699 |
('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL. |
|
5700 |
]. |
|
5701 |
^ nil "void" |
|
255 | 5702 |
]. |
526 | 5703 |
stProcess == JavaScreenUpdaterThread ifTrue:[self halt]. |
255 | 5704 |
death := nativeContext argAt:1. |
5705 |
stProcess |
|
318 | 5706 |
interruptWith:[ |
5707 |
JavaVM javaExceptionSignal handle:[:ex | |
|
526 | 5708 |
Processor activeProcess == JavaScreenUpdaterThread ifTrue:[self halt]. |
318 | 5709 |
Processor activeProcess terminate |
5710 |
] do:[ |
|
5711 |
ThreadTrace == true ifTrue:[ |
|
5712 |
('JAVA: thread exit: ' , jThread displayString) infoPrintNL. |
|
5713 |
]. |
|
5714 |
jThread perform:#'exit()V'. |
|
5715 |
self throwException:death. |
|
5716 |
] |
|
5717 |
]. |
|
255 | 5718 |
stProcess resume. |
5719 |
||
5720 |
[stProcess isDead] whileFalse:[ |
|
318 | 5721 |
stProcess resume. |
466 | 5722 |
'JavaVM: wait for death' infoPrintCR. |
318 | 5723 |
Delay waitForSeconds:0.1 |
255 | 5724 |
]. |
5725 |
stProcess terminate |
|
5726 |
||
5727 |
"Created: / 8.1.1998 / 13:11:17 / cg" |
|
526 | 5728 |
"Modified: / 8.1.1999 / 17:16:54 / cg" |
255 | 5729 |
! |
5730 |
||
5731 |
_Thread_suspend0:nativeContext |
|
5732 |
"yield" |
|
5733 |
||
5734 |
|jThread stProcess| |
|
5735 |
||
5736 |
jThread := nativeContext receiver. |
|
5737 |
stProcess := JavaVM stProcessForJavaThread:jThread. |
|
5738 |
stProcess isNil ifTrue:[ |
|
318 | 5739 |
ThreadTrace == true ifTrue:[ |
5740 |
('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL. |
|
5741 |
]. |
|
5742 |
^ nil "void" |
|
255 | 5743 |
]. |
5744 |
stProcess suspend |
|
5745 |
||
5746 |
"Created: / 8.1.1998 / 01:05:49 / cg" |
|
318 | 5747 |
"Modified: / 6.2.1998 / 02:15:23 / cg" |
255 | 5748 |
! |
5749 |
||
5750 |
_Thread_yield:nativeContext |
|
5751 |
"yield" |
|
5752 |
||
5753 |
|jThread stProcess| |
|
5754 |
||
504 | 5755 |
Processor yield. |
5756 |
"/ jThread := nativeContext receiver. |
|
5757 |
"/ stProcess := JavaVM stProcessForJavaThread:jThread. |
|
5758 |
"/ stProcess isNil ifTrue:[ |
|
5759 |
"/ ThreadTrace == true ifTrue:[ |
|
5760 |
"/ ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL. |
|
5761 |
"/ ]. |
|
5762 |
"/ ^ nil "void" |
|
5763 |
"/ ]. |
|
5764 |
"/ stProcess == Processor activeProcess ifTrue:[ |
|
5765 |
"/ Processor yield. |
|
5766 |
"/ ] ifFalse:[ |
|
5767 |
"/ self halt. |
|
5768 |
"/ ]. |
|
255 | 5769 |
|
5770 |
"Created: / 5.1.1998 / 02:03:51 / cg" |
|
504 | 5771 |
"Modified: / 23.12.1998 / 19:19:17 / cg" |
253 | 5772 |
! |
5773 |
||
5774 |
_Throwable_fillInStackTrace:nativeContext |
|
255 | 5775 |
|exClass exceptionObject list con| |
253 | 5776 |
|
5777 |
exClass := Java classNamed:'java.lang.Throwable'. |
|
5778 |
||
5779 |
exceptionObject := nativeContext receiver. |
|
5780 |
||
5781 |
"/ |
|
5782 |
"/ debugging only |
|
5783 |
"/ |
|
5784 |
(exceptionObject isKindOf:(Java classNamed:'java.lang.Throwable')) ifFalse:[ |
|
347 | 5785 |
self halt |
253 | 5786 |
]. |
5787 |
||
5788 |
con := thisContext sender. |
|
5789 |
||
5790 |
"/ |
|
5791 |
"/ we are not interrested in all intermediate Exception frames ... |
|
5792 |
"/ |
|
5793 |
FullExceptionTrace ifFalse:[ |
|
347 | 5794 |
"/ first, skip any JavaVM contexts |
5795 |
[con receiver == exceptionObject] whileFalse:[ |
|
5796 |
con := con sender |
|
5797 |
]. |
|
5798 |
"/ then, all exception-init contexts |
|
5799 |
[con receiver == exceptionObject] whileTrue:[ |
|
5800 |
con := con sender |
|
5801 |
]. |
|
253 | 5802 |
]. |
5803 |
||
255 | 5804 |
list := OrderedCollection new. |
5805 |
[con notNil] whileTrue:[ |
|
347 | 5806 |
(con isJavaContext) ifTrue:[ |
5807 |
"/ add a copy, in case the context continues with some |
|
5808 |
"/ cleanup ... |
|
5809 |
list add:con shallowCopy |
|
5810 |
]. |
|
5811 |
con := con sender |
|
255 | 5812 |
]. |
5813 |
||
5814 |
exceptionObject instVarNamed:'backtrace' put:(list asArray). |
|
253 | 5815 |
|
5816 |
^ nil. |
|
5817 |
||
5818 |
"Created: / 4.1.1998 / 14:27:40 / cg" |
|
347 | 5819 |
"Modified: / 8.5.1998 / 21:29:53 / cg" |
255 | 5820 |
! |
5821 |
||
5822 |
_Throwable_printStackTrace0:nativeContext |
|
261 | 5823 |
|out outStream exceptionObject contextList| |
255 | 5824 |
|
5825 |
outStream := nativeContext argAt:1. |
|
5826 |
exceptionObject := nativeContext receiver. |
|
5827 |
||
5828 |
contextList := exceptionObject instVarNamed:'backtrace'. |
|
5829 |
||
261 | 5830 |
out := self javaConsoleStream. |
5831 |
out cr. |
|
5832 |
out nextPutLine:'JAVA: stackTrace:'. |
|
255 | 5833 |
|
5834 |
contextList do:[:con | |
|
429 | 5835 |
out |
5836 |
nextPutAll:' '; |
|
5837 |
nextPutAll:(con method javaClass fullName); |
|
5838 |
nextPutAll:'.'; |
|
5839 |
nextPutAll:(con method selector); |
|
5840 |
nextPutAll:' ['; |
|
5841 |
nextPutAll:(con method javaClass sourceFile); |
|
5842 |
nextPutAll:' '; |
|
5843 |
nextPutAll:(con quickLineNumber displayString); |
|
5844 |
nextPutAll:']'. |
|
5845 |
out cr |
|
261 | 5846 |
]. |
5847 |
out nextPutLine:'----------------------------------------------------' |
|
255 | 5848 |
|
5849 |
"Created: / 4.1.1998 / 14:27:40 / cg" |
|
429 | 5850 |
"Modified: / 10.11.1998 / 14:19:32 / cg" |
432 | 5851 |
! |
5852 |
||
5853 |
_Win32Process_create:nativeContext |
|
5854 |
"really create a win32 process" |
|
5855 |
||
5856 |
|env cmd jProcess p inPipe outPipe errorPipe| |
|
5857 |
||
5858 |
jProcess := nativeContext receiver. |
|
5859 |
cmd := nativeContext argAt:1. |
|
5860 |
cmd := Java as_ST_String:cmd. |
|
5861 |
||
5862 |
env := nativeContext argAt:2. |
|
5863 |
env notNil ifTrue:[ |
|
5864 |
self halt |
|
5865 |
]. |
|
5866 |
self halt. |
|
5867 |
||
5868 |
p := Win32Process new. |
|
5869 |
p command:cmd. |
|
5870 |
p environment:env. |
|
5871 |
p inStream:inPipe. |
|
5872 |
p outStream:outPipe. |
|
5873 |
p errorStream:errorPipe. |
|
5874 |
p directory:nil. |
|
5875 |
p startProcess. |
|
5876 |
self halt. |
|
5877 |
||
5878 |
jProcess instVarNamed:'handle' put:p. |
|
5879 |
||
5880 |
"Created: / 10.11.1998 / 19:50:31 / cg" |
|
5881 |
"Modified: / 10.11.1998 / 21:34:18 / cg" |
|
255 | 5882 |
! ! |
5883 |
||
277 | 5884 |
!JavaVM class methodsFor:'native - java.lang - jdk1.2'! |
5885 |
||
5886 |
_AccessController_beginPrivileged:nativeContext |
|
5887 |
"/ introduced with jdk1.2 |
|
5888 |
||
5889 |
"Created: / 27.1.1998 / 18:18:11 / cg" |
|
5890 |
! |
|
5891 |
||
5892 |
_AccessController_endPrivileged:nativeContext |
|
5893 |
"/ introduced with jdk1.2 |
|
5894 |
||
5895 |
"Created: / 27.1.1998 / 18:18:32 / cg" |
|
5896 |
! |
|
5897 |
||
5898 |
_AccessController_getStackAccessControlContext:nativeContext |
|
5899 |
"/ introduced with jdk1.2 |
|
5900 |
||
5901 |
"/ supposed to do more here ... |
|
5902 |
||
5903 |
^ nil |
|
5904 |
||
5905 |
"Created: / 27.1.1998 / 18:22:15 / cg" |
|
5906 |
! |
|
5907 |
||
5908 |
_ClassLoader$NativeLibrary_load:nativeContext |
|
5909 |
"/ introduced with jdk1.2 ... (sigh) |
|
5910 |
||
5911 |
|nativeLoader jLibName libName libHandle index| |
|
5912 |
||
5913 |
nativeLoader := nativeContext receiver. |
|
5914 |
jLibName := nativeContext argAt:1. |
|
5915 |
libName := Java as_ST_String:jLibName. |
|
5916 |
||
5917 |
(index := SimulatedNativeLibs indexOf:libName) ~~ 0 ifTrue:[ |
|
319 | 5918 |
"/ ('JAVA: builtIn nativeLibLoad simulated: ' , libName) printNL. |
277 | 5919 |
nativeLoader instVarNamed:'handle' put:index. |
5920 |
^ self "/ void |
|
5921 |
]. |
|
5922 |
(LoadedNativeLibs notNil |
|
5923 |
and:[LoadedNativeLibs includesKey:libName]) ifTrue:[ |
|
319 | 5924 |
"/ ('JAVA: native library already loaded: ' , libName) printNL. |
277 | 5925 |
nativeLoader instVarNamed:'handle' put:(LoadedNativeLibs at:libName). |
5926 |
^ self "/ void |
|
5927 |
]. |
|
319 | 5928 |
|
5929 |
(self confirm:'permission to load native library: ' , libName , ' ?') ifFalse:[ |
|
5930 |
^ self |
|
5931 |
]. |
|
284 | 5932 |
self halt. |
277 | 5933 |
|
5934 |
libName asFilename exists ifFalse:[ |
|
5935 |
('JAVA: no file to load nativeLib: ' , libName) printNL. |
|
5936 |
^ self "/ void |
|
5937 |
]. |
|
5938 |
||
5939 |
libHandle := ObjectFileLoader loadLibrary:libName. |
|
5940 |
libHandle isNil ifTrue:[ |
|
5941 |
('JAVA: failed to load nativeLib: ' , libName) printNL. |
|
5942 |
^ self "/ void |
|
5943 |
]. |
|
5944 |
||
5945 |
LoadedNativeLibs isNil ifTrue:[ |
|
5946 |
LoadedNativeLibs := Dictionary new. |
|
5947 |
]. |
|
5948 |
||
5949 |
LoadedNativeLibs at:libName put:libHandle. |
|
5950 |
nativeLoader instVarNamed:'handle' put:(LoadedNativeLibs at:libName). |
|
5951 |
^ self "/ void |
|
5952 |
||
5953 |
"Created: / 27.1.1998 / 18:38:37 / cg" |
|
319 | 5954 |
"Modified: / 6.2.1998 / 03:12:17 / cg" |
277 | 5955 |
! |
5956 |
||
5957 |
_ClassLoader_initIDs:nativeContext |
|
5958 |
"/ introduced with jdk1.2 ... (sigh) |
|
5959 |
||
5960 |
"Created: / 27.1.1998 / 18:37:08 / cg" |
|
5961 |
! |
|
5962 |
||
5963 |
_Component_initIDs:nativeContext |
|
5964 |
"/ introduced with jdk1.2 ... (sigh) |
|
5965 |
||
5966 |
"Created: / 27.1.1998 / 19:53:29 / cg" |
|
5967 |
! |
|
5968 |
||
5969 |
_System_getCallerClass:nativeContext |
|
5970 |
"/ introduced with jdk1.2 |
|
5971 |
||
5972 |
|senderContext cls| |
|
5973 |
||
5974 |
senderContext := nativeContext sender. |
|
5975 |
[senderContext receiver == (Java at:'java.lang.System')] whileTrue:[ |
|
5976 |
senderContext := senderContext sender. |
|
5977 |
]. |
|
5978 |
||
5979 |
senderContext method isStatic ifTrue:[ |
|
5980 |
cls := senderContext receiver |
|
5981 |
] ifFalse:[ |
|
5982 |
cls := senderContext receiver class |
|
5983 |
]. |
|
5984 |
cls isJavaClass ifTrue:[ |
|
5985 |
^ self javaClassObjectForClass:cls |
|
5986 |
]. |
|
5987 |
(cls isMemberOf:(Java at:'java.lang.Class')) ifTrue:[ |
|
5988 |
^ Java at:'java.lang.Class' |
|
5989 |
]. |
|
5990 |
self halt. |
|
5991 |
^ nil |
|
5992 |
||
5993 |
"Modified: / 27.1.1998 / 18:33:13 / cg" |
|
5994 |
! |
|
5995 |
||
5996 |
_Toolkit_initIDs:nativeContext |
|
5997 |
"/ introduced with jdk1.2 ... (sigh) |
|
5998 |
||
5999 |
"Created: / 27.1.1998 / 19:53:50 / cg" |
|
6000 |
! ! |
|
6001 |
||
457 | 6002 |
!JavaVM class methodsFor:'native - java.lang - ms'! |
6003 |
||
6004 |
_Runtime_setInputStreamLocalised:nativeContext |
|
6005 |
||
6006 |
"Created: / 18.11.1998 / 00:48:24 / cg" |
|
6007 |
"Modified: / 18.11.1998 / 00:55:01 / cg" |
|
6008 |
! |
|
6009 |
||
6010 |
_Runtime_setOutputStreamLocalised:nativeContext |
|
6011 |
||
6012 |
"Created: / 18.11.1998 / 00:50:15 / cg" |
|
6013 |
"Modified: / 18.11.1998 / 00:55:06 / cg" |
|
6014 |
! |
|
6015 |
||
6016 |
_String_equals:nativeContext |
|
6017 |
|jString1 jString2| |
|
6018 |
||
6019 |
jString1 := nativeContext receiver. |
|
6020 |
jString2 := nativeContext argAt:1. |
|
6021 |
^ (jString1 instVarAt:1) = (jString2 instVarAt:1) |
|
6022 |
||
6023 |
"Created: / 18.11.1998 / 00:52:03 / cg" |
|
6024 |
"Modified: / 18.11.1998 / 00:53:01 / cg" |
|
6025 |
! |
|
6026 |
||
6027 |
_String_length:nativeContext |
|
6028 |
|jString| |
|
6029 |
||
6030 |
jString := nativeContext receiver. |
|
6031 |
^ (jString instVarAt:3) |
|
6032 |
||
6033 |
"Created: / 18.11.1998 / 00:53:50 / cg" |
|
6034 |
"Modified: / 18.11.1998 / 00:54:18 / cg" |
|
6035 |
! ! |
|
6036 |
||
255 | 6037 |
!JavaVM class methodsFor:'native - java.math'! |
6038 |
||
6039 |
_BigInteger_plumbInit:nativeContext |
|
440 | 6040 |
UnimplementedNativeMethodSignal raise |
6041 |
||
6042 |
"Modified: / 12.11.1998 / 19:23:00 / cg" |
|
253 | 6043 |
! ! |
6044 |
||
6045 |
!JavaVM class methodsFor:'native - java.net'! |
|
6046 |
||
440 | 6047 |
_InetAddressImpl_getHostByAddr:nativeContext |
6048 |
"/ java.lang.String getHostByAddr (int) |
|
6049 |
UnimplementedNativeMethodSignal raise |
|
6050 |
||
6051 |
"Created: / 12.11.1998 / 19:08:04 / cg" |
|
6052 |
! |
|
6053 |
||
253 | 6054 |
_InetAddressImpl_getInetFamily:nativeContext |
6055 |
"/ self unimplementedNativeMethod. |
|
6056 |
^ 0 |
|
6057 |
||
6058 |
"Modified: / 15.8.1997 / 17:04:43 / cg" |
|
6059 |
"Created: / 5.1.1998 / 02:05:48 / cg" |
|
6060 |
! |
|
6061 |
||
6062 |
_InetAddressImpl_getLocalHostName:nativeContext |
|
6063 |
"" |
|
6064 |
||
6065 |
|hostName| |
|
6066 |
||
6067 |
hostName := OperatingSystem getHostName. |
|
6068 |
||
6069 |
^ (Java as_String:hostName). |
|
6070 |
||
6071 |
"Modified: / 7.8.1997 / 21:16:55 / cg" |
|
6072 |
"Created: / 5.1.1998 / 02:07:03 / cg" |
|
6073 |
! |
|
6074 |
||
255 | 6075 |
_InetAddressImpl_lookupAllHostAddr:nativeContext |
6076 |
"" |
|
6077 |
||
6078 |
|jAddrImpl jHostName hostName addrBytes| |
|
6079 |
||
6080 |
jAddrImpl := nativeContext receiver. |
|
6081 |
jHostName := nativeContext argAt:1. |
|
6082 |
||
6083 |
hostName := Java as_ST_String:jHostName. |
|
6084 |
addrBytes := Socket ipAddressOfHost:hostName. |
|
6085 |
addrBytes isNil ifTrue:[ |
|
261 | 6086 |
addrBytes := #[0 0 0 0] copy |
255 | 6087 |
]. |
6088 |
^ Array with:addrBytes |
|
6089 |
||
6090 |
"Modified: / 8.8.1997 / 12:04:25 / cg" |
|
6091 |
"Created: / 7.1.1998 / 18:51:31 / cg" |
|
6092 |
! |
|
6093 |
||
253 | 6094 |
_InetAddressImpl_makeAnyLocalAddress:nativeContext |
6095 |
"" |
|
6096 |
||
6097 |
|jAddrImpl jAddr hostName addrBytes address| |
|
6098 |
||
6099 |
jAddrImpl := nativeContext receiver. |
|
6100 |
jAddr := nativeContext argAt:1. |
|
6101 |
||
6102 |
hostName := OperatingSystem getHostName. |
|
6103 |
addrBytes := Socket ipAddressOfHost:hostName. |
|
405 | 6104 |
addrBytes isNil ifTrue:[ |
6105 |
addrBytes := #[127 0 0 0]. |
|
6106 |
]. |
|
253 | 6107 |
"/ MSB first into an integer. |
6108 |
address := (addrBytes at:1). |
|
6109 |
address := (address bitShift:8) bitOr:(addrBytes at:2). |
|
6110 |
address := (address bitShift:8) bitOr:(addrBytes at:3). |
|
6111 |
address := (address bitShift:8) bitOr:(addrBytes at:4). |
|
6112 |
||
6113 |
jAddr instVarNamed:'hostName' put:(Java as_String:hostName). |
|
6114 |
jAddr instVarNamed:'address' put:address. |
|
6115 |
jAddr instVarNamed:'family' put:0. |
|
6116 |
||
6117 |
^ nil |
|
6118 |
||
6119 |
"Created: / 5.1.1998 / 02:06:27 / cg" |
|
405 | 6120 |
"Modified: / 21.10.1998 / 03:30:29 / cg" |
255 | 6121 |
! |
6122 |
||
6123 |
_PlainSocketImpl_initProto:nativeContext |
|
6124 |
||
6125 |
"Created: / 12.1.1998 / 12:56:52 / cg" |
|
271 | 6126 |
! |
6127 |
||
307 | 6128 |
_PlainSocketImpl_socketAccept:nativeContext |
6129 |
|jsock fd newJSock sock newSock fileNo| |
|
6130 |
||
6131 |
jsock := nativeContext receiver. |
|
6132 |
||
6133 |
sock := self validateFile:jsock. |
|
6134 |
sock isNil ifTrue:[ |
|
508 | 6135 |
self throwIOExceptionWithMessage:'nil socket in accept'. |
307 | 6136 |
^ self. |
6137 |
]. |
|
6138 |
||
6139 |
newJSock := nativeContext argAt:1. |
|
6140 |
fd := newJSock instVarNamed:'fd'. |
|
6141 |
(fd instVarNamed:'fd') ~~ 0 ifTrue:[ |
|
6142 |
self halt:'file already open'. |
|
6143 |
self internalError:'file already open'. |
|
508 | 6144 |
self throwIOExceptionWithMessage:'socket already open in socketAccept'. |
307 | 6145 |
^ self. |
6146 |
]. |
|
6147 |
FileIOTrace ifTrue:[ |
|
6148 |
'JAVA: socket accept' infoPrintCR |
|
6149 |
]. |
|
6150 |
newSock := sock accept. |
|
6151 |
newSock isNil ifTrue:[ |
|
508 | 6152 |
self throwIOExceptionWithMessage:'accept failed'. |
307 | 6153 |
]. |
6154 |
fileNo := self addOpenFile:newSock. |
|
6155 |
fd instVarNamed:'fd' put:fileNo. |
|
6156 |
||
6157 |
"Created: / 4.2.1998 / 15:26:49 / cg" |
|
508 | 6158 |
"Modified: / 30.12.1998 / 20:10:01 / cg" |
307 | 6159 |
! |
6160 |
||
6161 |
_PlainSocketImpl_socketAvailable:nativeContext |
|
6162 |
|jSock sock n| |
|
6163 |
||
6164 |
jSock := nativeContext receiver. |
|
6165 |
||
6166 |
sock := self validateFile:jSock. |
|
6167 |
sock isNil ifTrue:[ |
|
508 | 6168 |
self throwIOExceptionWithMessage:'socketAvailable on closed socket'. |
307 | 6169 |
^ self. |
6170 |
]. |
|
6171 |
||
6172 |
n := sock numAvailable. |
|
6173 |
^ n |
|
6174 |
||
6175 |
"Created: / 4.2.1998 / 16:58:49 / cg" |
|
508 | 6176 |
"Modified: / 30.12.1998 / 20:10:08 / cg" |
307 | 6177 |
! |
6178 |
||
6179 |
_PlainSocketImpl_socketBind:nativeContext |
|
6180 |
|jsock jaddr port sock hostName ok err| |
|
6181 |
||
6182 |
jsock := nativeContext receiver. |
|
6183 |
jaddr := nativeContext argAt:1. |
|
6184 |
port := nativeContext argAt:2. |
|
6185 |
||
6186 |
hostName := jaddr instVarNamed:'hostName'. |
|
6187 |
hostName isNil ifTrue:[ |
|
6188 |
self halt. |
|
6189 |
] ifFalse:[ |
|
6190 |
hostName := Java as_ST_String:hostName |
|
6191 |
]. |
|
6192 |
||
6193 |
sock := self validateFile:jsock. |
|
6194 |
sock notNil ifTrue:[ |
|
6195 |
FileIOTrace ifTrue:[ |
|
6196 |
('JAVA: socket bind to ' , hostName printString, ' port ' , port printString) infoPrintCR |
|
6197 |
]. |
|
6198 |
||
6199 |
ok := sock bindTo:port address:nil "hostName". |
|
6200 |
ok ifFalse:[ |
|
6201 |
err := OperatingSystem lastErrorString. |
|
6202 |
Transcript showCR:'sock err: ' , err printString. |
|
508 | 6203 |
self throwIOExceptionWithMessage:'bind failed'. |
307 | 6204 |
] |
6205 |
]. |
|
6206 |
||
6207 |
"Created: / 4.2.1998 / 15:06:20 / cg" |
|
508 | 6208 |
"Modified: / 30.12.1998 / 20:10:16 / cg" |
307 | 6209 |
! |
6210 |
||
271 | 6211 |
_PlainSocketImpl_socketClose:nativeContext |
6212 |
|jsock sock| |
|
6213 |
||
6214 |
jsock := nativeContext receiver. |
|
6215 |
||
6216 |
sock := self validateFile:jsock. |
|
6217 |
sock notNil ifTrue:[ |
|
6218 |
FileIOTrace ifTrue:[ |
|
6219 |
'JAVA: close socket' infoPrintCR |
|
6220 |
]. |
|
6221 |
sock close. |
|
6222 |
]. |
|
6223 |
||
6224 |
"Modified: / 21.8.1997 / 17:09:40 / cg" |
|
6225 |
"Created: / 25.1.1998 / 20:04:24 / cg" |
|
6226 |
! |
|
6227 |
||
6228 |
_PlainSocketImpl_socketConnect:nativeContext |
|
272 | 6229 |
|jsock jaddr port sock addr hostName ok| |
271 | 6230 |
|
6231 |
jsock := nativeContext receiver. |
|
6232 |
jaddr := nativeContext argAt:1. |
|
6233 |
port := nativeContext argAt:2. |
|
6234 |
||
6235 |
hostName := jaddr instVarNamed:'hostName'. |
|
6236 |
hostName notNil ifTrue:[ |
|
6237 |
hostName := Java as_ST_String:hostName |
|
6238 |
] ifFalse:[ |
|
272 | 6239 |
addr := jaddr instVarNamed:'address'. |
6240 |
addr notNil ifTrue:[ |
|
6241 |
hostName := ByteArray new:4. |
|
6242 |
hostName at:4 put:(addr bitAnd:16rFF). |
|
6243 |
addr := addr bitShift:-8. |
|
6244 |
hostName at:3 put:(addr bitAnd:16rFF). |
|
6245 |
addr := addr bitShift:-8. |
|
6246 |
hostName at:2 put:(addr bitAnd:16rFF). |
|
6247 |
addr := addr bitShift:-8. |
|
6248 |
hostName at:1 put:(addr bitAnd:16rFF). |
|
6249 |
]. |
|
271 | 6250 |
]. |
6251 |
hostName isNil ifTrue:[ |
|
6252 |
self halt. |
|
6253 |
]. |
|
6254 |
||
6255 |
sock := self validateFile:jsock. |
|
6256 |
sock notNil ifTrue:[ |
|
6257 |
FileIOTrace ifTrue:[ |
|
6258 |
('JAVA: socket connect to ' , hostName printString , ' port ' , port printString) infoPrintCR |
|
6259 |
]. |
|
390 | 6260 |
SocketConnectConfirmation ifTrue:[ |
495 | 6261 |
(PermittedHostConnects isNil |
6262 |
or:[(PermittedHostConnects includes:hostName) not]) ifTrue:[ |
|
6263 |
(self confirm:'connect to host: ' , hostName printString , ' - ok ?') |
|
6264 |
ifFalse:[ |
|
508 | 6265 |
self throwIOExceptionWithMessage:'connect permission denied'. |
495 | 6266 |
]. |
6267 |
||
6268 |
(self confirm:('JAVA Security check\\Always permit connects to this host (''' , hostName printString , ''') ?') withCRs) |
|
6269 |
ifTrue:[ |
|
6270 |
PermittedHostConnects isNil ifTrue:[ |
|
6271 |
PermittedHostConnects := Set new |
|
6272 |
]. |
|
6273 |
PermittedHostConnects add:hostName. |
|
6274 |
] |
|
6275 |
] |
|
271 | 6276 |
]. |
6277 |
||
6278 |
ok := sock connectTo:hostName port:port. |
|
6279 |
ok ifFalse:[ |
|
508 | 6280 |
self throwIOExceptionWithMessage:'connect failed'. |
271 | 6281 |
] |
6282 |
]. |
|
6283 |
||
6284 |
"Created: / 25.1.1998 / 20:02:27 / cg" |
|
508 | 6285 |
"Modified: / 30.12.1998 / 20:10:28 / cg" |
271 | 6286 |
! |
6287 |
||
6288 |
_PlainSocketImpl_socketCreate:nativeContext |
|
6289 |
|jsock isStream fd sock fileNo| |
|
6290 |
||
6291 |
jsock := nativeContext receiver. |
|
6292 |
isStream := (nativeContext argAt:1) == 1. |
|
6293 |
||
6294 |
fd := jsock instVarNamed:'fd'. |
|
6295 |
(fd instVarNamed:'fd') ~~ 0 ifTrue:[ |
|
6296 |
self halt:'file already open'. |
|
6297 |
self internalError:'file already open'. |
|
508 | 6298 |
self throwIOExceptionWithMessage:'file already open in socketCreate'. |
271 | 6299 |
^ self. |
6300 |
]. |
|
6301 |
||
6302 |
FileOpenTrace ifTrue:[ |
|
6303 |
('JAVA: create socket') infoPrintCR. |
|
6304 |
]. |
|
6305 |
||
6306 |
isStream ifTrue:[ |
|
6307 |
sock := Socket newTCP |
|
6308 |
] ifFalse:[ |
|
6309 |
sock := Socket newUDP |
|
6310 |
]. |
|
6311 |
sock isNil ifTrue:[ |
|
508 | 6312 |
self throwIOExceptionWithMessage:'socketCreate failed'. |
271 | 6313 |
]. |
6314 |
||
6315 |
fileNo := self addOpenFile:sock. |
|
6316 |
fd instVarNamed:'fd' put:fileNo. |
|
6317 |
||
6318 |
"Created: / 25.1.1998 / 19:59:25 / cg" |
|
508 | 6319 |
"Modified: / 30.12.1998 / 20:10:38 / cg" |
272 | 6320 |
! |
6321 |
||
307 | 6322 |
_PlainSocketImpl_socketListen:nativeContext |
6323 |
|jSock time sock ok| |
|
6324 |
||
6325 |
jSock := nativeContext receiver. |
|
6326 |
time := nativeContext argAt:1. |
|
6327 |
||
6328 |
sock := self validateFile:jSock. |
|
6329 |
sock notNil ifTrue:[ |
|
6330 |
FileIOTrace ifTrue:[ |
|
6331 |
('JAVA: socket listen with timeout ' , time printString) infoPrintCR. |
|
6332 |
]. |
|
6333 |
ok := sock listenWithBacklog:5. |
|
6334 |
ok ifFalse:[ |
|
508 | 6335 |
self throwIOExceptionWithMessage:'listen failed'. |
307 | 6336 |
^ self. |
6337 |
]. |
|
6338 |
time ~~ 0 ifTrue:[ |
|
6339 |
sock readWaitWithTimeoutMs:time |
|
6340 |
] |
|
6341 |
]. |
|
6342 |
||
6343 |
"Created: / 4.2.1998 / 15:17:48 / cg" |
|
508 | 6344 |
"Modified: / 30.12.1998 / 20:10:46 / cg" |
307 | 6345 |
! |
6346 |
||
272 | 6347 |
_SocketInputStream_socketRead:nativeContext |
307 | 6348 |
^ self anyStream_readBytes:nativeContext |
272 | 6349 |
|
6350 |
"Created: / 25.1.1998 / 20:56:53 / cg" |
|
307 | 6351 |
"Modified: / 4.2.1998 / 15:52:31 / cg" |
272 | 6352 |
! |
6353 |
||
6354 |
_SocketOutputStream_socketWrite:nativeContext |
|
307 | 6355 |
^ self anyStream_writeBytes:nativeContext |
272 | 6356 |
|
6357 |
"Created: / 25.1.1998 / 21:06:55 / cg" |
|
307 | 6358 |
"Modified: / 4.2.1998 / 15:52:40 / cg" |
253 | 6359 |
! ! |
6360 |
||
457 | 6361 |
!JavaVM class methodsFor:'native - java.net - ms'! |
6362 |
||
6363 |
_ClassLoader_findSystemClass:nativeContext |
|
6364 |
^ self _ClassLoader_findSystemClass0:nativeContext |
|
6365 |
||
6366 |
"Created: / 18.11.1998 / 00:00:14 / cg" |
|
6367 |
! |
|
6368 |
||
6369 |
_InetAddress_getInetFamily:nativeContext |
|
6370 |
"/ self unimplementedNativeMethod. |
|
6371 |
^ 0 |
|
6372 |
||
6373 |
"Modified: / 15.8.1997 / 17:04:43 / cg" |
|
6374 |
"Created: / 17.11.1998 / 23:54:38 / cg" |
|
6375 |
! |
|
6376 |
||
6377 |
_InetAddress_getLocalHostName:nativeContext |
|
6378 |
"" |
|
6379 |
||
6380 |
|hostName| |
|
6381 |
||
6382 |
hostName := OperatingSystem getHostName. |
|
6383 |
||
6384 |
^ (Java as_String:hostName). |
|
6385 |
||
6386 |
"Modified: / 7.8.1997 / 21:16:55 / cg" |
|
6387 |
"Created: / 17.11.1998 / 23:54:54 / cg" |
|
6388 |
! |
|
6389 |
||
6390 |
_InetAddress_lookupAllHostAddr:nativeContext |
|
6391 |
"" |
|
6392 |
||
6393 |
|jAddrImpl jHostName hostName addrBytes| |
|
6394 |
||
6395 |
jAddrImpl := nativeContext receiver. |
|
6396 |
jHostName := nativeContext argAt:1. |
|
6397 |
||
6398 |
hostName := Java as_ST_String:jHostName. |
|
6399 |
addrBytes := Socket ipAddressOfHost:hostName. |
|
6400 |
addrBytes isNil ifTrue:[ |
|
6401 |
addrBytes := #[0 0 0 0] copy |
|
6402 |
]. |
|
6403 |
^ Array with:addrBytes |
|
6404 |
||
6405 |
"Modified: / 8.8.1997 / 12:04:25 / cg" |
|
6406 |
"Created: / 17.11.1998 / 23:56:10 / cg" |
|
6407 |
! |
|
6408 |
||
6409 |
_InetAddress_makeAnyLocalAddress:nativeContext |
|
6410 |
"" |
|
6411 |
||
6412 |
|jAddrImpl jAddr hostName addrBytes address| |
|
6413 |
||
6414 |
jAddrImpl := nativeContext receiver. |
|
6415 |
jAddr := nativeContext argAt:1. |
|
6416 |
||
6417 |
hostName := OperatingSystem getHostName. |
|
6418 |
addrBytes := Socket ipAddressOfHost:hostName. |
|
6419 |
addrBytes isNil ifTrue:[ |
|
6420 |
addrBytes := #[127 0 0 0]. |
|
6421 |
]. |
|
6422 |
"/ MSB first into an integer. |
|
6423 |
address := (addrBytes at:1). |
|
6424 |
address := (address bitShift:8) bitOr:(addrBytes at:2). |
|
6425 |
address := (address bitShift:8) bitOr:(addrBytes at:3). |
|
6426 |
address := (address bitShift:8) bitOr:(addrBytes at:4). |
|
6427 |
||
6428 |
jAddr instVarNamed:'hostName' put:(Java as_String:hostName). |
|
6429 |
jAddr instVarNamed:'address' put:address. |
|
6430 |
jAddr instVarNamed:'family' put:0. |
|
6431 |
||
6432 |
^ nil |
|
6433 |
||
6434 |
"Modified: / 21.10.1998 / 03:30:29 / cg" |
|
6435 |
"Created: / 17.11.1998 / 23:54:00 / cg" |
|
6436 |
! ! |
|
6437 |
||
253 | 6438 |
!JavaVM class methodsFor:'native - java.utils'! |
6439 |
||
6440 |
_ResourceBundle_getClassContext:nativeContext |
|
6441 |
"returns an array filled with the contextChain receivers classes. |
|
6442 |
What an ugly, messy interface." |
|
6443 |
||
6444 |
|chain con cls jClass| |
|
6445 |
||
6446 |
chain := OrderedCollection new. |
|
6447 |
con := thisContext sender. |
|
507 | 6448 |
[con notNil |
6449 |
and:[con receiver isMethod not |
|
6450 |
or:[con receiver isJavaMethod not]]] whileTrue:[ |
|
6451 |
con := con sender. |
|
6452 |
]. |
|
6453 |
con := con sender. |
|
6454 |
||
253 | 6455 |
[con notNil] whileTrue:[ |
507 | 6456 |
(true "con isJavaContext") ifTrue:[ |
347 | 6457 |
cls := con receiver class. |
6458 |
cls isMeta ifTrue:[ |
|
6459 |
"/ t'was a static method |
|
6460 |
cls := cls soleInstance |
|
6461 |
]. |
|
507 | 6462 |
cls isJavaClass ifTrue:[ |
6463 |
jClass := JavaClasses at:cls ifAbsent:nil. |
|
6464 |
jClass isNil ifTrue:[ |
|
6465 |
JavaClasses at:cls put:(jClass := (Java at:'java.lang.Class') new). |
|
6466 |
JavaClasses at:jClass put:cls. |
|
6467 |
]. |
|
6468 |
chain add:jClass. |
|
6469 |
] |
|
347 | 6470 |
]. |
6471 |
con := con sender. |
|
253 | 6472 |
]. |
6473 |
^ chain asArray |
|
6474 |
||
6475 |
"Created: / 5.1.1998 / 02:47:00 / cg" |
|
507 | 6476 |
"Modified: / 24.12.1998 / 00:34:57 / cg" |
253 | 6477 |
! ! |
6478 |
||
304 | 6479 |
!JavaVM class methodsFor:'native - java.utils.zip'! |
6480 |
||
6481 |
_Inflater_init:nativeContext |
|
6482 |
||
6483 |
"Created: / 1.2.1998 / 20:14:01 / cg" |
|
6484 |
! |
|
6485 |
||
6486 |
_Inflater_reset:nativeContext |
|
6487 |
||
6488 |
"Created: / 1.2.1998 / 20:14:13 / cg" |
|
6489 |
! ! |
|
6490 |
||
255 | 6491 |
!JavaVM class methodsFor:'native - netscape'! |
6492 |
||
6493 |
_MozillaAppletContext_pMochaOnLoad:nativeContext |
|
6494 |
|id| |
|
6495 |
||
6496 |
id := nativeContext argAt:1. |
|
318 | 6497 |
"/ 'JAVA: MozillaAppletContext_pMochaOnLoad: ' print. id printNL. |
255 | 6498 |
^ nil |
6499 |
||
6500 |
"Created: / 6.1.1998 / 20:37:13 / cg" |
|
318 | 6501 |
"Modified: / 6.2.1998 / 02:13:09 / cg" |
255 | 6502 |
! |
6503 |
||
325 | 6504 |
_MozillaAppletContext_pShowDocument:nativeContext |
507 | 6505 |
|jAppletContext s1 s2 s3 js| |
6506 |
||
6507 |
jAppletContext := nativeContext receiver. |
|
325 | 6508 |
js := nativeContext argAt:1. |
507 | 6509 |
s1 := Java as_ST_String:js. |
6510 |
js := nativeContext argAt:2. |
|
6511 |
s2 := Java as_ST_String:js. |
|
6512 |
js := nativeContext argAt:3. |
|
6513 |
s2 := Java as_ST_String:js. |
|
325 | 6514 |
|
6515 |
"/ somehow pass it to the html browser .... |
|
507 | 6516 |
Transcript show:'pShowDocument: '; show:s1; show:' / '; |
6517 |
show:s2; show:' / '; showCR:s3. |
|
6518 |
||
325 | 6519 |
^ nil |
6520 |
||
6521 |
"Created: / 29.3.1998 / 15:53:17 / cg" |
|
507 | 6522 |
"Modified: / 29.12.1998 / 13:32:41 / cg" |
325 | 6523 |
! |
6524 |
||
255 | 6525 |
_MozillaAppletContext_pShowStatus:nativeContext |
6526 |
|s js| |
|
6527 |
||
6528 |
js := nativeContext argAt:1. |
|
405 | 6529 |
js isNil ifTrue:[ |
6530 |
s := '' |
|
6531 |
] ifFalse:[ |
|
6532 |
s := Java as_ST_String:js. |
|
6533 |
]. |
|
255 | 6534 |
|
6535 |
self activityNotification:s. |
|
6536 |
"/ Transcript showCR:s. |
|
6537 |
^ nil |
|
6538 |
||
6539 |
"Created: / 6.1.1998 / 18:31:34 / cg" |
|
405 | 6540 |
"Modified: / 22.10.1998 / 01:17:46 / cg" |
255 | 6541 |
! |
6542 |
||
440 | 6543 |
_MozillaAppletContext_setConsoleState0:nativeContext |
6544 |
"/ void setConsoleState0 (int) |
|
6545 |
UnimplementedNativeMethodSignal raise |
|
6546 |
||
6547 |
"Created: / 12.11.1998 / 19:23:22 / cg" |
|
6548 |
! |
|
6549 |
||
6550 |
_URLConnection_close:nativeContext |
|
6551 |
"/ void close () |
|
6552 |
UnimplementedNativeMethodSignal raise |
|
6553 |
||
6554 |
"Created: / 12.11.1998 / 19:26:03 / cg" |
|
6555 |
! |
|
6556 |
||
6557 |
_URLConnection_finalize:nativeContext |
|
6558 |
"/ void finalize () |
|
6559 |
UnimplementedNativeMethodSignal raise |
|
6560 |
||
6561 |
"Created: / 12.11.1998 / 19:25:22 / cg" |
|
6562 |
! |
|
6563 |
||
6564 |
_URLConnection_getContentLength0:nativeContext |
|
6565 |
"/ int getContentLength0 () |
|
6566 |
UnimplementedNativeMethodSignal raise |
|
6567 |
||
6568 |
"Created: / 12.11.1998 / 19:25:34 / cg" |
|
6569 |
! |
|
6570 |
||
6571 |
_URLConnection_getContentType0:nativeContext |
|
6572 |
"/ java.lang.String getContentType0 () |
|
6573 |
UnimplementedNativeMethodSignal raise |
|
6574 |
||
6575 |
"Created: / 12.11.1998 / 19:25:42 / cg" |
|
6576 |
! |
|
6577 |
||
6578 |
_URLConnection_getHeaderField0:nativeContext |
|
6579 |
"/ java.lang.String getHeaderField0 (java.lang.String) |
|
6580 |
UnimplementedNativeMethodSignal raise |
|
6581 |
||
6582 |
"Created: / 12.11.1998 / 19:25:53 / cg" |
|
6583 |
! |
|
6584 |
||
6585 |
_URLConnection_pCreate:nativeContext |
|
6586 |
"/ void pCreate (java.lang.String java.lang.String) |
|
6587 |
UnimplementedNativeMethodSignal raise |
|
6588 |
||
6589 |
"Created: / 12.11.1998 / 19:25:14 / cg" |
|
6590 |
! |
|
6591 |
||
6592 |
_URLInputStream_available:nativeContext |
|
6593 |
"/ int available () |
|
6594 |
UnimplementedNativeMethodSignal raise |
|
6595 |
||
6596 |
"Created: / 12.11.1998 / 19:24:26 / cg" |
|
6597 |
! |
|
6598 |
||
6599 |
_URLInputStream_open:nativeContext |
|
6600 |
"/ void open () |
|
6601 |
UnimplementedNativeMethodSignal raise |
|
6602 |
||
6603 |
"Created: / 12.11.1998 / 19:24:01 / cg" |
|
6604 |
! |
|
6605 |
||
6606 |
_URLInputStream_read:nativeContext |
|
6607 |
"/ int read (byte[] int int) |
|
6608 |
UnimplementedNativeMethodSignal raise |
|
6609 |
||
6610 |
"Created: / 12.11.1998 / 19:24:12 / cg" |
|
6611 |
! |
|
6612 |
||
6613 |
_URLOutputStream_open:nativeContext |
|
6614 |
"/ void open () |
|
6615 |
UnimplementedNativeMethodSignal raise |
|
6616 |
||
6617 |
"Created: / 12.11.1998 / 19:24:38 / cg" |
|
6618 |
! |
|
6619 |
||
6620 |
_URLOutputStream_pClose:nativeContext |
|
6621 |
"/ void pClose () |
|
6622 |
UnimplementedNativeMethodSignal raise |
|
6623 |
||
6624 |
"Created: / 12.11.1998 / 19:25:02 / cg" |
|
6625 |
! |
|
6626 |
||
6627 |
_URLOutputStream_write:nativeContext |
|
6628 |
"/ void write (int) |
|
6629 |
UnimplementedNativeMethodSignal raise |
|
6630 |
||
6631 |
"Created: / 12.11.1998 / 19:24:45 / cg" |
|
6632 |
! |
|
6633 |
||
6634 |
_URLOutputStream_writeBytes:nativeContext |
|
6635 |
"/ void writeBytes (byte[] int int) |
|
6636 |
UnimplementedNativeMethodSignal raise |
|
6637 |
||
6638 |
"Created: / 12.11.1998 / 19:24:55 / cg" |
|
6639 |
! |
|
6640 |
||
255 | 6641 |
_URLStreamHandlerFactory_pInit:nativeContext |
6642 |
"/ self unimplementedNativeMethod. |
|
6643 |
||
6644 |
"Created: / 10.1.1998 / 15:47:24 / cg" |
|
440 | 6645 |
! |
6646 |
||
6647 |
_URLStreamHandlerFactory_pSupportsProtocol:nativeContext |
|
6648 |
"/ boolean pSupportsProtocol (java.lang.String) |
|
6649 |
UnimplementedNativeMethodSignal raise |
|
6650 |
||
6651 |
"Created: / 12.11.1998 / 19:23:43 / cg" |
|
255 | 6652 |
! ! |
6653 |
||
6654 |
!JavaVM class methodsFor:'native - sun.audio'! |
|
6655 |
||
6656 |
_AudioDevice_audioClose:nativeContext |
|
261 | 6657 |
|device fd stream| |
6658 |
||
6659 |
device := nativeContext receiver. |
|
6660 |
device notNil ifTrue:[ |
|
6661 |
fd := device instVarNamed:'dev'. |
|
6662 |
(fd notNil and:[fd > 0]) ifTrue:[ |
|
6663 |
stream := self getOpenFileAt:fd. |
|
6664 |
stream notNil ifTrue:[ |
|
6665 |
stream close. |
|
6666 |
device instVarNamed:'dev' put:0. |
|
6667 |
] |
|
6668 |
] |
|
6669 |
] |
|
255 | 6670 |
|
6671 |
"Created: / 10.1.1998 / 15:45:16 / cg" |
|
261 | 6672 |
"Modified: / 13.1.1998 / 18:08:20 / cg" |
255 | 6673 |
! |
6674 |
||
6675 |
_AudioDevice_audioOpen:nativeContext |
|
261 | 6676 |
|f stream fileNo| |
6677 |
||
6678 |
NoAudio ifTrue:[ |
|
374 | 6679 |
Transcript showCR:'JAVA: audio disabled'. |
6680 |
^ -1 |
|
6681 |
]. |
|
6682 |
||
261 | 6683 |
Stream streamErrorSignal handle:[:ex | |
374 | 6684 |
Stream streamErrorSignal handle:[:ex | |
6685 |
stream := nil. |
|
6686 |
ex return. |
|
6687 |
] do:[ |
|
6688 |
stream := SoundStream writing. |
|
6689 |
]. |
|
261 | 6690 |
] do:[ |
374 | 6691 |
stream := SoundStream writing. |
6692 |
stream notNil ifTrue:[ |
|
6693 |
stream setSampleRate:8000. |
|
6694 |
] |
|
261 | 6695 |
]. |
6696 |
stream isNil ifTrue:[ |
|
374 | 6697 |
"/ ^ -1. |
6698 |
||
6699 |
f := '/dev/audio' asFilename. |
|
6700 |
f exists ifFalse:[ |
|
6701 |
Transcript showCR:'JAVA: neither SoundStream nor /dev/audio available'. |
|
6702 |
^ -1 |
|
6703 |
]. |
|
6704 |
stream := f readWriteStream. |
|
6705 |
stream isNil ifTrue:[ |
|
6706 |
Transcript showCR:'JAVA: /dev/audio exists, but cannot be opened'. |
|
6707 |
^ -1 |
|
6708 |
]. |
|
6709 |
fileNo := self addOpenFile:stream. |
|
6710 |
]. |
|
6711 |
||
261 | 6712 |
fileNo := self addOpenFile:stream. |
6713 |
||
6714 |
FileOpenTrace ifTrue:[ |
|
374 | 6715 |
('JAVA: opened audioDevice as FD ' , fileNo printString) infoPrintCR. |
261 | 6716 |
]. |
6717 |
||
6718 |
^ fileNo |
|
255 | 6719 |
|
6720 |
"Created: / 10.1.1998 / 15:45:30 / cg" |
|
374 | 6721 |
"Modified: / 14.10.1998 / 15:20:52 / cg" |
261 | 6722 |
! |
6723 |
||
6724 |
_AudioDevice_audioWrite:nativeContext |
|
6725 |
|device fd stream bytes count| |
|
6726 |
||
6727 |
device := nativeContext receiver. |
|
6728 |
device notNil ifTrue:[ |
|
6729 |
fd := device instVarNamed:'dev'. |
|
6730 |
(fd notNil and:[fd > 0]) ifTrue:[ |
|
6731 |
stream := self getOpenFileAt:fd. |
|
6732 |
stream notNil ifTrue:[ |
|
6733 |
bytes := nativeContext argAt:1. |
|
6734 |
count := nativeContext argAt:2. |
|
6735 |
stream nextPutBytes:count from:bytes startingAt:1 |
|
6736 |
] |
|
6737 |
] |
|
6738 |
] |
|
6739 |
||
6740 |
"Created: / 10.1.1998 / 15:45:16 / cg" |
|
6741 |
"Modified: / 13.1.1998 / 18:07:20 / cg" |
|
255 | 6742 |
! ! |
6743 |
||
6744 |
!JavaVM class methodsFor:'native - sun.awt'! |
|
6745 |
||
6746 |
_GifImageDecoder_parseImage:nativeContext |
|
261 | 6747 |
|decoder width height bool1 depth subHdrBytes dstBytes i1 i2 colorModel |
6748 |
stream byte compressedData compressedSize index count data |
|
304 | 6749 |
leftOffs topOffs codeLen flags pixelStore clrModel t buffSize |
6750 |
countGot countGot2| |
|
255 | 6751 |
|
6752 |
decoder := nativeContext receiver. |
|
6753 |
||
6754 |
i1 := nativeContext argAt:1. |
|
6755 |
i2 := nativeContext argAt:2. |
|
6756 |
width := nativeContext argAt:3. |
|
6757 |
height := nativeContext argAt:4. |
|
6758 |
bool1 := nativeContext argAt:5. |
|
6759 |
depth := nativeContext argAt:6. |
|
261 | 6760 |
subHdrBytes := nativeContext argAt:7. |
255 | 6761 |
dstBytes := nativeContext argAt:8. |
6762 |
colorModel := nativeContext argAt:9. |
|
6763 |
||
261 | 6764 |
leftOffs := subHdrBytes wordAt:1 MSB:false. |
6765 |
topOffs := subHdrBytes wordAt:3 MSB:false. |
|
6766 |
width := subHdrBytes wordAt:5 MSB:false. |
|
6767 |
height := subHdrBytes wordAt:7 MSB:false. |
|
6768 |
flags := subHdrBytes at:9. |
|
6769 |
codeLen := subHdrBytes at:10. |
|
6770 |
||
6771 |
stream := decoder instVarNamed:'input'. |
|
6772 |
pixelStore := decoder instVarNamed:'store'. |
|
339 | 6773 |
pixelStore isNil ifTrue:[ |
6774 |
^ 0 |
|
6775 |
]. |
|
261 | 6776 |
|
6777 |
buffSize := (width * height // 2) max:4096. |
|
6778 |
compressedData := ByteArray uninitializedNew:buffSize. |
|
6779 |
"get compressed data" |
|
6780 |
index := 1. |
|
304 | 6781 |
count := stream perform:#'read()I'. |
261 | 6782 |
|
6783 |
[count notNil and:[count > 0]] whileTrue:[ |
|
304 | 6784 |
(index + count) > buffSize ifTrue:[ |
6785 |
t := ByteArray uninitializedNew:(buffSize * 2). |
|
6786 |
t replaceFrom:1 to:buffSize with:compressedData startingAt:1. |
|
6787 |
compressedData := t. |
|
6788 |
buffSize := buffSize * 2. |
|
6789 |
]. |
|
6790 |
[count ~~ 0] whileTrue:[ |
|
6791 |
countGot := stream |
|
6792 |
perform:#'read([BII)I' |
|
6793 |
with:compressedData |
|
6794 |
with:index-1 |
|
6795 |
with:count. |
|
6796 |
||
6797 |
countGot > 0 ifTrue:[ |
|
6798 |
count := count - countGot. |
|
6799 |
index := index + countGot. |
|
6800 |
] ifFalse:[ |
|
6801 |
count := -1. |
|
6802 |
] |
|
6803 |
]. |
|
6804 |
||
6805 |
count >= 0 ifTrue:[ |
|
6806 |
count := stream perform:#read. |
|
6807 |
] |
|
261 | 6808 |
]. |
6809 |
compressedSize := index - 1. |
|
6810 |
||
6811 |
data := pixelStore perform:#'allocateLines(I)Ljava/lang/Object;' with:height. |
|
6812 |
(data isMemberOf:ByteArray) ifFalse:[ |
|
304 | 6813 |
self halt. |
6814 |
^ 0. |
|
261 | 6815 |
]. |
6816 |
"/ 'GIFReader: decompressing ...' infoPrintCR. |
|
6817 |
||
6818 |
||
6819 |
GIFReader |
|
304 | 6820 |
decompressGIFFrom:compressedData |
6821 |
count:compressedSize |
|
6822 |
into:data |
|
6823 |
startingAt:1 |
|
6824 |
codeLen:(codeLen + 1). |
|
261 | 6825 |
|
6826 |
clrModel := pixelStore instVarNamed:'colormodel'. |
|
6827 |
||
6828 |
pixelStore |
|
304 | 6829 |
perform:#'setPixels(IIII[BII)Z' |
6830 |
withArguments: |
|
6831 |
(Array |
|
6832 |
with:0 "/ x |
|
6833 |
with:0 "/ y |
|
6834 |
with:width "/ w |
|
6835 |
with:height "/ h |
|
6836 |
with:data |
|
6837 |
with:0 "/ offs |
|
6838 |
with:width). "/ scanSize |
|
261 | 6839 |
|
6840 |
pixelStore perform:#'imageComplete()V'. |
|
6841 |
"/ perform:#'imageComplete(I)V' |
|
6842 |
"/ with:((Java at:'java.awt.image.ImageConsumer') instVarNamed:'STATICIMAGEDONE'). |
|
6843 |
||
255 | 6844 |
"/ self internalError:'breakPoint'. |
6845 |
^ 1 "/ true |
|
6846 |
||
339 | 6847 |
"Modified: / 10.4.1998 / 14:31:59 / cg" |
255 | 6848 |
! |
6849 |
||
6850 |
_ImageRepresentation_disposeImage:nativeContext |
|
262 | 6851 |
|imgRep img| |
255 | 6852 |
|
6853 |
imgRep := nativeContext receiver. |
|
262 | 6854 |
|
6855 |
img := imgRep instVarNamed:'pData'. |
|
6856 |
(img notNil and:[img ~~ 0]) ifTrue:[ |
|
270 | 6857 |
ImageStretchCache notNil ifTrue:[ |
6858 |
ImageStretchCache removeKey:img ifAbsent:nil. |
|
6859 |
] |
|
262 | 6860 |
]. |
6861 |
||
261 | 6862 |
imgRep instVarNamed:'pData' put:0. |
6863 |
"/ self halt. |
|
255 | 6864 |
|
6865 |
"Created: / 7.1.1998 / 22:31:46 / cg" |
|
262 | 6866 |
"Modified: / 17.1.1998 / 13:26:55 / cg" |
255 | 6867 |
! |
6868 |
||
6869 |
_ImageRepresentation_finish:nativeContext |
|
6870 |
|imgRep bool| |
|
6871 |
||
6872 |
imgRep := nativeContext receiver. |
|
6873 |
bool := nativeContext argAt:1. |
|
261 | 6874 |
"/ self halt. |
318 | 6875 |
"/ 'JAVA: ImageRepresentation_finish ignored for now' infoPrintCR. |
255 | 6876 |
|
6877 |
^ 1 "/ true |
|
6878 |
||
6879 |
"Created: / 8.1.1998 / 00:11:40 / cg" |
|
318 | 6880 |
"Modified: / 6.2.1998 / 02:12:54 / cg" |
261 | 6881 |
! |
6882 |
||
6883 |
_ImageRepresentation_imageDraw:nativeContext |
|
6884 |
|imgRep x y img deviceImage jGraphics gc clr| |
|
6885 |
||
6886 |
imgRep := nativeContext receiver. |
|
6887 |
img := imgRep instVarNamed:'pData'. |
|
6888 |
(img isNil or:[img == 0]) ifTrue:[ |
|
466 | 6889 |
"/ self halt. |
6890 |
^ self. |
|
261 | 6891 |
]. |
6892 |
jGraphics := nativeContext argAt:1. |
|
6893 |
gc := jGraphics instVarNamed:'pData'. |
|
6894 |
gc realized ifFalse:[^ self]. |
|
6895 |
||
6896 |
x := nativeContext argAt:2. |
|
6897 |
y := nativeContext argAt:3. |
|
6898 |
clr := nativeContext argAt:4. |
|
6899 |
deviceImage := img onDevice:gc device. |
|
6900 |
deviceImage ~~ img ifTrue:[ |
|
466 | 6901 |
imgRep instVarNamed:'pData' put:deviceImage. |
6902 |
]. |
|
6903 |
gc realized ifFalse:[^ self]. |
|
261 | 6904 |
deviceImage displayOn:gc x:x y:y. |
6905 |
^ 1. |
|
6906 |
||
6907 |
"Created: / 13.1.1998 / 13:32:28 / cg" |
|
466 | 6908 |
"Modified: / 25.11.1998 / 15:36:38 / cg" |
261 | 6909 |
! |
6910 |
||
6911 |
_ImageRepresentation_imageStretch:nativeContext |
|
6912 |
|imgRep x1 y1 x2 y2 srcX1 srcY1 w h |
|
6913 |
img deviceImage jGraphics gc clr stretchWidth stretchHeight| |
|
6914 |
||
6915 |
imgRep := nativeContext receiver. |
|
6916 |
img := imgRep instVarNamed:'pData'. |
|
6917 |
(img isNil or:[img == 0]) ifTrue:[ |
|
270 | 6918 |
"/ self halt. |
6919 |
^ self. |
|
261 | 6920 |
]. |
6921 |
||
6922 |
jGraphics := nativeContext argAt:1. |
|
6923 |
gc := jGraphics instVarNamed:'pData'. |
|
6924 |
gc realized ifFalse:[^ self]. |
|
6925 |
||
6926 |
x1 := nativeContext argAt:2. |
|
6927 |
y1 := nativeContext argAt:3. |
|
6928 |
x2 := nativeContext argAt:4. |
|
6929 |
y2:= nativeContext argAt:5. |
|
6930 |
srcX1 := nativeContext argAt:6. |
|
6931 |
srcY1 := nativeContext argAt:7. |
|
6932 |
w := nativeContext argAt:8. |
|
6933 |
h := nativeContext argAt:9. |
|
6934 |
clr := nativeContext argAt:10. |
|
6935 |
||
6936 |
(srcX1 ~~ 0 or:[srcY1 ~~ 0]) ifTrue:[ |
|
270 | 6937 |
self halt. |
6938 |
^ self. |
|
261 | 6939 |
]. |
6940 |
(w ~~ img width or:[h ~~ img height]) ifTrue:[ |
|
270 | 6941 |
self halt. |
6942 |
^ self |
|
261 | 6943 |
]. |
6944 |
||
6945 |
"/ TODO: remember magnified images somewhere for a while, |
|
6946 |
"/ to avoid repeated action ... |
|
6947 |
||
6948 |
stretchWidth := (x2-x1). |
|
6949 |
stretchHeight := (y2-y1). |
|
6950 |
||
6951 |
(stretchWidth == img width |
|
6952 |
and:[stretchHeight == img height]) ifTrue:[ |
|
270 | 6953 |
deviceImage := img onDevice:gc device. |
6954 |
deviceImage ~~ img ifTrue:[ |
|
6955 |
imgRep instVarNamed:'pData' put:deviceImage. |
|
6956 |
]. |
|
261 | 6957 |
] ifFalse:[ |
270 | 6958 |
ImageStretchCache notNil ifTrue:[ |
6959 |
deviceImage := ImageStretchCache at:img ifAbsent:nil. |
|
6960 |
]. |
|
6961 |
(deviceImage isNil |
|
6962 |
or:[deviceImage width ~~ stretchWidth |
|
6963 |
or:[deviceImage height ~~ stretchHeight]]) ifTrue:[ |
|
6964 |
deviceImage := (img magnifiedTo:stretchWidth@stretchHeight) onDevice:gc device. |
|
6965 |
ImageStretchCache isNil ifTrue:[ |
|
6966 |
ImageStretchCache := WeakIdentityDictionary new. |
|
6967 |
]. |
|
6968 |
ImageStretchCache at:img put:deviceImage |
|
6969 |
]. |
|
261 | 6970 |
]. |
6971 |
deviceImage displayOn:gc x:x1 y:y1 |
|
6972 |
||
6973 |
"Created: / 13.1.1998 / 13:32:28 / cg" |
|
6974 |
"Modified: / 15.1.1998 / 13:14:47 / cg" |
|
255 | 6975 |
! |
6976 |
||
6977 |
_ImageRepresentation_offscreenInit:nativeContext |
|
262 | 6978 |
|imgRep jclr w h form screenDevice| |
255 | 6979 |
|
6980 |
imgRep := nativeContext receiver. |
|
261 | 6981 |
jclr := nativeContext argAt:1. |
262 | 6982 |
|
6983 |
w := imgRep instVarNamed:'width'. |
|
6984 |
h := imgRep instVarNamed:'height'. |
|
6985 |
||
6986 |
screenDevice := Screen current. |
|
6987 |
form := Form width:w height:h depth:(screenDevice depth) on:screenDevice. |
|
6988 |
||
6989 |
imgRep instVarNamed:'pData' put:form. |
|
6990 |
"/ self halt. |
|
255 | 6991 |
|
6992 |
"Created: / 7.1.1998 / 22:31:46 / cg" |
|
262 | 6993 |
"Modified: / 17.1.1998 / 12:36:43 / cg" |
261 | 6994 |
! |
6995 |
||
6996 |
_ImageRepresentation_setBytePixels:nativeContext |
|
318 | 6997 |
|imgRep x y w h clrModel bytes offs i2 |
6998 |
img depth cmap rgbMap opaque transparentColorIndex |
|
6999 |
scanLineWidth nBytes srcIdx dstIdx| |
|
261 | 7000 |
|
7001 |
imgRep := nativeContext receiver. |
|
7002 |
x := nativeContext argAt:1. |
|
7003 |
y := nativeContext argAt:2. |
|
7004 |
w := nativeContext argAt:3. |
|
7005 |
h := nativeContext argAt:4. |
|
7006 |
clrModel := nativeContext argAt:5. |
|
7007 |
bytes := nativeContext argAt:6. |
|
318 | 7008 |
offs := nativeContext argAt:7. "/ offset ?? |
7009 |
scanLineWidth := nativeContext argAt:8. |
|
261 | 7010 |
|
7011 |
depth := clrModel instVarNamed:'pixel_bits'. |
|
7012 |
(clrModel instVarNamed:'map_size') ~~ 0 ifTrue:[ |
|
318 | 7013 |
rgbMap := clrModel instVarNamed:'rgb'. |
7014 |
cmap := Array new:rgbMap size. |
|
7015 |
rgbMap |
|
7016 |
keysAndValuesDo:[:idx :rgb | |
|
7017 |
cmap at:idx put:(Color rgbValue:(rgb bitAnd:16rFFFFFF)) |
|
7018 |
]. |
|
261 | 7019 |
]. |
7020 |
||
7021 |
opaque := (clrModel instVarNamed:'opaque') ~~ 0. |
|
7022 |
opaque ifFalse:[ |
|
318 | 7023 |
transparentColorIndex := clrModel instVarNamed:'transparent_index' |
261 | 7024 |
]. |
7025 |
||
7026 |
img := imgRep instVarNamed:'pData'. |
|
405 | 7027 |
(img isNil or:[img == 0]) ifFalse:[ |
7028 |
"/ self halt |
|
7029 |
]. |
|
7030 |
||
7031 |
(offs ~~ 0 or:[scanLineWidth ~~ w]) ifTrue:[ |
|
7032 |
nBytes := ByteArray new:w*h. |
|
7033 |
srcIdx := offs+1. |
|
7034 |
dstIdx := 1. |
|
7035 |
1 to:h do:[:y | |
|
7036 |
nBytes replaceFrom:dstIdx to:(dstIdx+w-1) with:bytes startingAt:srcIdx. |
|
7037 |
srcIdx := srcIdx + scanLineWidth. |
|
7038 |
dstIdx := dstIdx + w. |
|
318 | 7039 |
]. |
405 | 7040 |
bytes := nBytes. |
7041 |
]. |
|
7042 |
img := Image width:w height:h depth:depth fromArray:bytes. |
|
7043 |
cmap notNil ifTrue:[ |
|
7044 |
img colorMap:cmap. |
|
7045 |
img photometric:#palette |
|
7046 |
]. |
|
7047 |
opaque ifFalse:[ |
|
7048 |
img mask:(ImageReader |
|
7049 |
buildMaskFromColor:transparentColorIndex |
|
7050 |
for:bytes |
|
7051 |
width:w |
|
7052 |
height:h) |
|
7053 |
]. |
|
7054 |
||
7055 |
imgRep instVarNamed:'pData' put:img. |
|
261 | 7056 |
^ 1. |
7057 |
||
7058 |
"Created: / 7.1.1998 / 22:31:46 / cg" |
|
405 | 7059 |
"Modified: / 21.10.1998 / 00:35:45 / cg" |
262 | 7060 |
! |
7061 |
||
297 | 7062 |
_ImageRepresentation_setIntPixels:nativeContext |
318 | 7063 |
|imgRep x y w h clrModel ints offs scanLineWidth |
316 | 7064 |
img depth cmap rgbMap opaque transparentColorIndex |
373 | 7065 |
bytes srcIdx dstIdx val red green blue |
7066 |
redMask greenMask blueMask redShift greenShift blueShift| |
|
297 | 7067 |
|
7068 |
imgRep := nativeContext receiver. |
|
7069 |
x := nativeContext argAt:1. |
|
7070 |
y := nativeContext argAt:2. |
|
7071 |
w := nativeContext argAt:3. |
|
7072 |
h := nativeContext argAt:4. |
|
7073 |
clrModel := nativeContext argAt:5. |
|
7074 |
ints := nativeContext argAt:6. |
|
318 | 7075 |
offs := nativeContext argAt:7. "/ offset ?? |
7076 |
scanLineWidth := nativeContext argAt:8. "/ scanLineWidth ?? |
|
297 | 7077 |
opaque := false. |
373 | 7078 |
offs ~~ 0 ifTrue:[ |
7079 |
self halt |
|
7080 |
]. |
|
297 | 7081 |
|
7082 |
depth := clrModel instVarNamed:'pixel_bits'. |
|
7083 |
clrModel class == (Java at:'java.awt.image.DirectColorModel') ifTrue:[ |
|
7084 |
] ifFalse:[ |
|
7085 |
(clrModel instVarNamed:'map_size') ~~ 0 ifTrue:[ |
|
7086 |
rgbMap := clrModel instVarNamed:'rgb'. |
|
7087 |
cmap := Array new:rgbMap size. |
|
7088 |
rgbMap |
|
7089 |
keysAndValuesDo:[:idx :rgb | |
|
7090 |
cmap at:idx put:(Color rgbValue:(rgb bitAnd:16rFFFFFF)) |
|
7091 |
]. |
|
7092 |
]. |
|
7093 |
opaque := (clrModel instVarNamed:'opaque') ~~ 0. |
|
7094 |
opaque ifFalse:[ |
|
7095 |
transparentColorIndex := clrModel instVarNamed:'transparent_index' |
|
7096 |
]. |
|
7097 |
]. |
|
7098 |
||
7099 |
img := imgRep instVarNamed:'pData'. |
|
405 | 7100 |
(img isNil or:[img == 0]) ifFalse:[ |
7101 |
"/ self halt. |
|
7102 |
]. |
|
7103 |
||
7104 |
depth == 32 ifTrue:[ |
|
7105 |
"/ temporary kludge - ony use 24 bits/pixel |
|
7106 |
bytes := ByteArray new:w*h*3. |
|
7107 |
srcIdx := 1. |
|
7108 |
dstIdx := 1. |
|
7109 |
redMask := clrModel instVarNamed:'red_mask'. |
|
7110 |
greenMask := clrModel instVarNamed:'green_mask'. |
|
7111 |
blueMask := clrModel instVarNamed:'blue_mask'. |
|
7112 |
redShift := (clrModel instVarNamed:'red_offset') negated. |
|
7113 |
greenShift := (clrModel instVarNamed:'green_offset') negated. |
|
7114 |
blueShift := (clrModel instVarNamed:'blue_offset') negated. |
|
7115 |
1 to:h do:[:y | |
|
7116 |
1 to:w do:[:x | |
|
7117 |
val := ints at:srcIdx. |
|
7118 |
red := (val bitAnd:redMask) bitShift:redShift. |
|
7119 |
green := (val bitAnd:greenMask) bitShift:greenShift. |
|
7120 |
blue := (val bitAnd:blueMask) bitShift:blueShift. |
|
7121 |
bytes at:dstIdx put:red. |
|
7122 |
bytes at:dstIdx+1 put:green. |
|
7123 |
bytes at:dstIdx+2 put:blue. |
|
7124 |
dstIdx := dstIdx + 3. |
|
7125 |
srcIdx := srcIdx + 1. |
|
316 | 7126 |
]. |
405 | 7127 |
srcIdx := srcIdx + (scanLineWidth - w). |
316 | 7128 |
]. |
405 | 7129 |
img := Depth24Image width:w height:h depth:24 fromArray:bytes. |
7130 |
] ifFalse:[ |
|
7131 |
scanLineWidth ~~ w ifTrue:[ |
|
7132 |
self halt |
|
297 | 7133 |
]. |
405 | 7134 |
img := Image width:w height:h depth:depth fromArray:ints. |
7135 |
]. |
|
7136 |
cmap notNil ifTrue:[ |
|
7137 |
img colorMap:cmap. |
|
7138 |
img photometric:#palette |
|
297 | 7139 |
] ifFalse:[ |
405 | 7140 |
img photometric:#rgb |
7141 |
]. |
|
7142 |
opaque ifFalse:[ |
|
7143 |
img mask:(ImageReader |
|
7144 |
buildMaskFromColor:transparentColorIndex |
|
7145 |
for:ints |
|
7146 |
width:w |
|
7147 |
height:h) |
|
7148 |
]. |
|
7149 |
||
7150 |
imgRep instVarNamed:'pData' put:img. |
|
297 | 7151 |
^ 1. |
7152 |
||
7153 |
"Created: / 1.2.1998 / 17:38:47 / cg" |
|
405 | 7154 |
"Modified: / 21.10.1998 / 00:35:37 / cg" |
297 | 7155 |
! |
7156 |
||
440 | 7157 |
_JPEGImageDecoder_readImage:nativeContext |
7158 |
UnimplementedNativeMethodSignal raise |
|
7159 |
||
7160 |
"Created: / 12.11.1998 / 18:53:30 / cg" |
|
7161 |
"Modified: / 12.11.1998 / 18:53:40 / cg" |
|
7162 |
! |
|
7163 |
||
262 | 7164 |
_OffScreenImageSource_sendPixels:nativeContext |
7165 |
"/ self halt. |
|
7166 |
||
7167 |
"Modified: / 16.1.1998 / 18:22:23 / cg" |
|
7168 |
"Created: / 17.1.1998 / 12:36:25 / cg" |
|
255 | 7169 |
! ! |
7170 |
||
280 | 7171 |
!JavaVM class methodsFor:'native - sun.awt - jdk1.2'! |
7172 |
||
284 | 7173 |
_ColorModel_initIDs:nativeContext |
7174 |
"/ new with jdk1.2 ... |
|
7175 |
||
7176 |
"Created: / 28.1.1998 / 22:19:23 / cg" |
|
7177 |
! |
|
7178 |
||
7179 |
_FontDescriptor_initIDs:nativeContext |
|
7180 |
"/ new with jdk1.2 ... |
|
7181 |
||
7182 |
"Created: / 28.1.1998 / 22:30:52 / cg" |
|
7183 |
! |
|
7184 |
||
7185 |
_Font_initIDs:nativeContext |
|
7186 |
"/ new with jdk1.2 ... |
|
7187 |
||
7188 |
"Created: / 27.1.1998 / 21:43:25 / cg" |
|
7189 |
! |
|
7190 |
||
7191 |
_PackedColorModel_initIDs:nativeContext |
|
7192 |
"/ new with jdk1.2 ... |
|
7193 |
||
7194 |
"Created: / 28.1.1998 / 22:19:35 / cg" |
|
7195 |
! |
|
7196 |
||
7197 |
_PlatformFont_initIDs:nativeContext |
|
7198 |
"/ new with jdk1.2 ... |
|
7199 |
||
7200 |
"Created: / 28.1.1998 / 22:30:41 / cg" |
|
7201 |
! |
|
7202 |
||
7203 |
_X11GraphicsDevice_getConfigType:nativeContext |
|
7204 |
"/ new with jdk1.2 ... |
|
7205 |
||
7206 |
|configNr cls| |
|
7207 |
||
7208 |
"/ for now, only one config. |
|
7209 |
configNr := nativeContext argAt:1. |
|
7210 |
||
7211 |
cls := Java classNamed:'java.awt.GraphicsDevice'. |
|
7212 |
^ cls instVarNamed:'TYPE_RASTER_SCREEN'. |
|
7213 |
||
7214 |
"Created: / 28.1.1998 / 22:19:05 / cg" |
|
7215 |
! |
|
7216 |
||
7217 |
_X11GraphicsDevice_getNumConfigs:nativeContext |
|
7218 |
"/ new with jdk1.2 ... |
|
7219 |
||
7220 |
^ 1 |
|
7221 |
||
7222 |
"Created: / 28.1.1998 / 22:13:26 / cg" |
|
7223 |
"Modified: / 28.1.1998 / 22:14:33 / cg" |
|
7224 |
! |
|
7225 |
||
7226 |
_X11GraphicsEnvironment_getNumScreens:nativeContext |
|
7227 |
"/ new with jdk1.2 ... |
|
7228 |
||
7229 |
"/ could return the actual number of screens ... |
|
7230 |
||
7231 |
^ 1 |
|
7232 |
||
7233 |
"Created: / 28.1.1998 / 01:50:22 / cg" |
|
7234 |
"Modified: / 28.1.1998 / 22:12:32 / cg" |
|
7235 |
! |
|
7236 |
||
280 | 7237 |
_X11GraphicsEnvironment_initDisplay:nativeContext |
7238 |
"/ new with jdk1.2 ... |
|
7239 |
||
7240 |
"Created: / 28.1.1998 / 01:50:22 / cg" |
|
7241 |
! ! |
|
7242 |
||
284 | 7243 |
!JavaVM class methodsFor:'native - sun.awt.motif - jdk1.2'! |
7244 |
||
7245 |
_InputThread_run:nativeContext |
|
7246 |
self _WToolkit_eventLoop:nativeContext. |
|
7247 |
||
7248 |
"Created: / 28.1.1998 / 22:34:47 / cg" |
|
7249 |
"Modified: / 28.1.1998 / 22:35:16 / cg" |
|
7250 |
! |
|
7251 |
||
7252 |
_MComponentPeer_cacheInit:nativeContext |
|
7253 |
||
7254 |
"Created: / 28.1.1998 / 22:22:30 / cg" |
|
7255 |
! |
|
7256 |
||
457 | 7257 |
_MComponentPeer_pHide:nativeContext |
7258 |
^ self _WComponentPeer_hide:nativeContext |
|
7259 |
||
7260 |
"Created: / 18.11.1998 / 00:15:18 / cg" |
|
7261 |
! |
|
7262 |
||
284 | 7263 |
_MComponentPeer_pInitialize:nativeContext |
7264 |
||
7265 |
"Created: / 28.1.1998 / 22:27:25 / cg" |
|
7266 |
! |
|
7267 |
||
7268 |
_MComponentPeer_setCursor:nativeContext |
|
7269 |
||
7270 |
"Created: / 28.1.1998 / 22:27:35 / cg" |
|
7271 |
! |
|
7272 |
||
7273 |
_MFramePeer_create:nativeContext |
|
7274 |
^ self _WFramePeer_create:nativeContext |
|
7275 |
||
7276 |
"Created: / 28.1.1998 / 22:25:44 / cg" |
|
7277 |
! |
|
7278 |
||
7279 |
_MFramePeer_pHide:nativeContext |
|
7280 |
^ self _WComponentPeer_hide:nativeContext |
|
7281 |
||
7282 |
"Created: / 28.1.1998 / 22:27:04 / cg" |
|
7283 |
! |
|
7284 |
||
7285 |
_MFramePeer_pReshape:nativeContext |
|
7286 |
self commonReshapeComponent:nativeContext |
|
7287 |
||
7288 |
"Created: / 28.1.1998 / 22:28:00 / cg" |
|
7289 |
"Modified: / 28.1.1998 / 22:29:34 / cg" |
|
7290 |
! |
|
7291 |
||
7292 |
_MFramePeer_pSetTitle:nativeContext |
|
7293 |
self _WWindowPeer__setTitle:nativeContext |
|
7294 |
||
7295 |
"Created: / 28.1.1998 / 22:30:23 / cg" |
|
7296 |
! |
|
7297 |
||
7298 |
_MToolkit_init:nativeContext |
|
7299 |
||
7300 |
"Created: / 28.1.1998 / 22:21:54 / cg" |
|
7301 |
! |
|
7302 |
||
7303 |
_MToolkit_run:nativeContext |
|
7304 |
||
7305 |
"Created: / 28.1.1998 / 22:22:10 / cg" |
|
7306 |
! ! |
|
7307 |
||
7308 |
!JavaVM class methodsFor:'native - sun.awt.windows'! |
|
7309 |
||
457 | 7310 |
_MComponentPeer_handleEvent:nativeContext |
7311 |
^ self _WComponentPeer_handleEvent:nativeContext |
|
7312 |
||
7313 |
"Created: / 18.11.1998 / 00:21:17 / cg" |
|
7314 |
! |
|
7315 |
||
7316 |
_MComponentPeer_pShow:nativeContext |
|
7317 |
|view| |
|
7318 |
||
7319 |
view := self viewForWPeer:nativeContext. |
|
7320 |
||
7321 |
"/ frame views are under my browsers own control |
|
7322 |
(view isMemberOf:JavaEmbeddedFrameView) ifFalse:[ |
|
7323 |
view beVisible. |
|
7324 |
view realize. |
|
7325 |
]. |
|
7326 |
||
7327 |
"/ view windowGroup notNil ifTrue:[ |
|
7328 |
"/ windowServer addGroup:(view windowGroup) |
|
7329 |
"/ ]. |
|
7330 |
||
7331 |
^ nil |
|
7332 |
||
7333 |
"/ self halt. |
|
7334 |
||
7335 |
"Modified: / 25.1.1998 / 09:54:07 / cg" |
|
7336 |
"Created: / 18.11.1998 / 00:21:51 / cg" |
|
7337 |
! |
|
7338 |
||
284 | 7339 |
_WButtonPeer_create:nativeContext |
7340 |
|jButtonPeer jButton jFrame frame button |
|
7341 |
lbl| |
|
7342 |
||
7343 |
jButtonPeer := nativeContext receiver. |
|
7344 |
jButton := jButtonPeer instVarNamed:'target'. |
|
7345 |
||
7346 |
jFrame := nativeContext argAt:1. |
|
7347 |
frame := jFrame instVarNamed:'pData'. |
|
7348 |
||
7349 |
button := Button in:frame. |
|
493 | 7350 |
button action:[ |
448 | 7351 |
jButtonPeer perform:#'handleAction()V'. |
493 | 7352 |
]. |
284 | 7353 |
|
7354 |
lbl := jButton instVarNamed:'label'. |
|
7355 |
lbl notNil ifTrue:[ |
|
419 | 7356 |
lbl := Java as_ST_String:lbl. |
7357 |
button label:lbl |
|
284 | 7358 |
]. |
7359 |
self createdWindowsView:button for:jButtonPeer. |
|
7360 |
||
7361 |
WindowCreationTrace == true ifTrue:[ |
|
419 | 7362 |
'WButtonPeer_create: ' print. frame print. ' -> ' print. button printNL. |
284 | 7363 |
]. |
7364 |
||
7365 |
"Created: / 5.1.1998 / 01:53:30 / cg" |
|
493 | 7366 |
"Modified: / 11.12.1998 / 00:19:22 / cg" |
284 | 7367 |
! |
7368 |
||
297 | 7369 |
_WButtonPeer_setLabel:nativeContext |
7370 |
|label jString| |
|
7371 |
||
7372 |
jString := nativeContext argAt:1. |
|
7373 |
||
7374 |
label := self viewForWPeer:nativeContext. |
|
7375 |
label label:(Java as_ST_String:jString) |
|
7376 |
||
7377 |
"Modified: / 8.1.1998 / 17:35:50 / cg" |
|
7378 |
"Created: / 1.2.1998 / 17:05:47 / cg" |
|
7379 |
! |
|
7380 |
||
284 | 7381 |
_WCanvasPeer_create:nativeContext |
7382 |
|jCanvasPeer jFrame frame subView| |
|
7383 |
||
7384 |
jCanvasPeer := nativeContext receiver. |
|
7385 |
||
7386 |
jFrame := nativeContext argAt:1. |
|
7387 |
jFrame isNil ifTrue:[ |
|
7388 |
self halt:'no frame in canvasPeer create'. |
|
7389 |
self internalError:'no frame in canvasPeer create'. |
|
7390 |
^ self. |
|
7391 |
]. |
|
7392 |
frame := jFrame instVarNamed:'pData'. |
|
7393 |
||
7394 |
subView := JavaView in:frame. |
|
7395 |
subView delegate:self. |
|
7396 |
subView javaPeer:jCanvasPeer. |
|
7397 |
||
7398 |
self createdWindowsView:subView for:jCanvasPeer. |
|
7399 |
||
7400 |
WindowCreationTrace == true ifTrue:[ |
|
7401 |
'WCanvasPeer_create: ' print. frame print. ' -> ' print. subView printNL. |
|
7402 |
]. |
|
7403 |
||
7404 |
"Created: / 5.1.1998 / 00:59:19 / cg" |
|
7405 |
"Modified: / 16.1.1998 / 13:40:00 / cg" |
|
7406 |
! |
|
7407 |
||
440 | 7408 |
_WCheckboxMenuItemPeer_setState:nativeContext |
7409 |
"/ void setState (boolean) |
|
482 | 7410 |
"/ UnimplementedNativeMethodSignal raise |
440 | 7411 |
|
7412 |
"Created: / 12.11.1998 / 19:14:35 / cg" |
|
482 | 7413 |
"Modified: / 3.12.1998 / 21:41:13 / cg" |
440 | 7414 |
! |
7415 |
||
284 | 7416 |
_WCheckboxPeer_create:nativeContext |
7417 |
|jCheckboxPeer jCheckbox jFrame frame checkBox lbl| |
|
7418 |
||
7419 |
jCheckboxPeer := nativeContext receiver. |
|
7420 |
jCheckbox := jCheckboxPeer instVarNamed:'target'. |
|
7421 |
||
7422 |
jFrame := nativeContext argAt:1. |
|
7423 |
frame := jFrame instVarNamed:'pData'. |
|
7424 |
||
7425 |
checkBox := CheckBox in:frame. |
|
7426 |
checkBox action:[ |
|
7427 |
jCheckboxPeer |
|
7428 |
perform:#'handleAction(Z)V' |
|
7429 |
with:(checkBox isOn ifTrue:[1] ifFalse:[0]) |
|
7430 |
]. |
|
7431 |
||
7432 |
lbl := jCheckbox instVarNamed:'label'. |
|
7433 |
lbl notNil ifTrue:[ |
|
7434 |
lbl := Java as_ST_String:lbl. |
|
7435 |
checkBox label:lbl |
|
7436 |
]. |
|
7437 |
||
7438 |
self createdWindowsView:checkBox for:jCheckboxPeer. |
|
7439 |
||
7440 |
WindowCreationTrace == true ifTrue:[ |
|
7441 |
'WCheckboxPeer_create: ' print. frame print. ' -> ' print. checkBox printNL. |
|
7442 |
]. |
|
7443 |
||
7444 |
"Created: / 7.1.1998 / 21:48:03 / cg" |
|
7445 |
"Modified: / 15.1.1998 / 12:27:04 / cg" |
|
7446 |
! |
|
7447 |
||
7448 |
_WCheckboxPeer_setCheckboxGroup:nativeContext |
|
7449 |
|checkBox jGroup| |
|
7450 |
||
7451 |
checkBox := self viewForWPeer:nativeContext. |
|
7452 |
||
7453 |
jGroup := nativeContext argAt:1. |
|
7454 |
||
7455 |
"Created: / 7.1.1998 / 21:48:47 / cg" |
|
7456 |
"Modified: / 25.1.1998 / 01:20:42 / cg" |
|
7457 |
! |
|
7458 |
||
440 | 7459 |
_WCheckboxPeer_setLabel:nativeContext |
7460 |
"/ void setLabel (java.lang.String) |
|
7461 |
UnimplementedNativeMethodSignal raise |
|
7462 |
||
7463 |
"Created: / 12.11.1998 / 19:14:53 / cg" |
|
7464 |
! |
|
7465 |
||
284 | 7466 |
_WCheckboxPeer_setState:nativeContext |
7467 |
|checkBox state| |
|
7468 |
||
7469 |
checkBox := self viewForWPeer:nativeContext. |
|
7470 |
||
7471 |
state := nativeContext argAt:1. |
|
7472 |
state ~~ 0 ifTrue:[ |
|
7473 |
checkBox turnOn |
|
7474 |
] ifFalse:[ |
|
7475 |
checkBox turnOff |
|
7476 |
]. |
|
7477 |
||
7478 |
"Created: / 7.1.1998 / 21:49:13 / cg" |
|
7479 |
"Modified: / 25.1.1998 / 01:26:18 / cg" |
|
7480 |
! |
|
7481 |
||
7482 |
_WChoicePeer_addItem:nativeContext |
|
7483 |
|jString index comboBox| |
|
7484 |
||
7485 |
comboBox := self viewForWPeer:nativeContext. |
|
7486 |
||
7487 |
jString := nativeContext argAt:1. |
|
7488 |
index := nativeContext argAt:2. |
|
7489 |
||
7490 |
comboBox model list addLast:(Java as_ST_String:jString). |
|
7491 |
comboBox model changed:#list. |
|
7492 |
||
7493 |
"Created: / 7.1.1998 / 21:45:12 / cg" |
|
7494 |
"Modified: / 24.1.1998 / 18:51:32 / cg" |
|
7495 |
! |
|
7496 |
||
7497 |
_WChoicePeer_create:nativeContext |
|
7498 |
|jChoicePeer jChoice jFrame frame comboBox| |
|
7499 |
||
7500 |
jChoicePeer := nativeContext receiver. |
|
7501 |
jChoice := jChoicePeer instVarNamed:'target'. |
|
7502 |
||
7503 |
jFrame := nativeContext argAt:1. |
|
7504 |
frame := jFrame instVarNamed:'pData'. |
|
7505 |
||
7506 |
comboBox := ComboListView in:frame. |
|
7507 |
comboBox model:(SelectionInList new list:(OrderedCollection new)). |
|
285 | 7508 |
comboBox action:[:index | |
7509 |
jChoicePeer |
|
7510 |
perform:#'handleAction(I)V' |
|
7511 |
with:(comboBox model selectionIndex - 1) |
|
7512 |
]. |
|
284 | 7513 |
|
7514 |
self createdWindowsView:comboBox for:jChoicePeer. |
|
7515 |
||
7516 |
WindowCreationTrace == true ifTrue:[ |
|
7517 |
'WChoicePeer_create: ' print. frame print. ' -> ' print. comboBox printNL. |
|
7518 |
]. |
|
7519 |
||
7520 |
"Created: / 7.1.1998 / 21:44:31 / cg" |
|
285 | 7521 |
"Modified: / 28.1.1998 / 23:19:17 / cg" |
284 | 7522 |
! |
7523 |
||
440 | 7524 |
_WChoicePeer_remove:nativeContext |
7525 |
"/ void remove (int) |
|
7526 |
UnimplementedNativeMethodSignal raise |
|
7527 |
||
7528 |
"Created: / 12.11.1998 / 19:12:20 / cg" |
|
7529 |
! |
|
7530 |
||
284 | 7531 |
_WChoicePeer_reshape:nativeContext |
504 | 7532 |
self commonReshapeComponent:nativeContext. |
7533 |
"/ self pReshape:nativeContext. |
|
284 | 7534 |
^ self. |
7535 |
||
7536 |
"Created: / 7.1.1998 / 21:46:18 / cg" |
|
504 | 7537 |
"Modified: / 23.12.1998 / 19:08:07 / cg" |
284 | 7538 |
! |
7539 |
||
7540 |
_WChoicePeer_select:nativeContext |
|
7541 |
|comboBox index| |
|
7542 |
||
7543 |
comboBox := self viewForWPeer:nativeContext. |
|
7544 |
||
7545 |
index := nativeContext argAt:1. |
|
7546 |
comboBox model selectionIndex:(index + 1). "/ JAVA indexing starts at 0 |
|
7547 |
||
7548 |
"Created: / 7.1.1998 / 21:45:43 / cg" |
|
7549 |
"Modified: / 25.1.1998 / 09:55:05 / cg" |
|
7550 |
! |
|
7551 |
||
440 | 7552 |
_WClipboard_getClipboardText:nativeContext |
7553 |
"/ java.lang.String getClipboardText () |
|
493 | 7554 |
|
7555 |
|str| |
|
7556 |
||
7557 |
str := Screen current rootView getTextSelection. |
|
7558 |
str isNil ifTrue:[ |
|
7559 |
str := ''. |
|
7560 |
]. |
|
7561 |
^ Java as_String:''. |
|
7562 |
||
7563 |
"Modified: / 10.12.1998 / 21:28:29 / cg" |
|
440 | 7564 |
! |
7565 |
||
284 | 7566 |
_WClipboard_init:nativeContext |
7567 |
"/ self halt. |
|
7568 |
||
7569 |
"Modified: / 18.3.1997 / 18:43:18 / cg" |
|
7570 |
"Created: / 4.1.1998 / 19:03:59 / cg" |
|
7571 |
! |
|
7572 |
||
440 | 7573 |
_WClipboard_setClipboardText:nativeContext |
7574 |
"/ void setClipboardText (java.awt.datatransfer.StringSelection) |
|
493 | 7575 |
|
7576 |
|strSel data| |
|
7577 |
||
7578 |
strSel := nativeContext argAt:1. |
|
7579 |
data := strSel instVarNamed:'data'. |
|
7580 |
data class == (Java at:'java.lang.String') ifTrue:[ |
|
7581 |
Screen current rootView setTextSelection:(Java as_ST_String:data) |
|
7582 |
]. |
|
440 | 7583 |
UnimplementedNativeMethodSignal raise |
7584 |
||
7585 |
"Created: / 12.11.1998 / 19:15:31 / cg" |
|
493 | 7586 |
"Modified: / 10.12.1998 / 21:25:20 / cg" |
440 | 7587 |
! |
7588 |
||
284 | 7589 |
_WColor_getDefaultColor:nativeContext |
7590 |
|clrIndex jClr clr | |
|
7591 |
||
7592 |
clrIndex := nativeContext argAt:1. |
|
7593 |
"/ windows defaults: |
|
7594 |
"/ 1: view background |
|
7595 |
||
7596 |
clrIndex == 1 ifTrue:[ |
|
7597 |
clr := View defaultViewBackgroundColor. |
|
7598 |
clr isColor ifFalse:[ |
|
7599 |
clr := Color gray:50. |
|
7600 |
]. |
|
7601 |
]. |
|
7602 |
clrIndex == 2 ifTrue:[ |
|
7603 |
clr := Color black. |
|
7604 |
]. |
|
7605 |
clr isNil ifTrue:[ |
|
7606 |
self halt. |
|
7607 |
self internalError:'breakpoint'. |
|
7608 |
^ nil. |
|
7609 |
]. |
|
7610 |
||
7611 |
clr := clr on:(Screen current). |
|
7612 |
||
7613 |
jClr := (Java classForName:'java.awt.Color') new. |
|
7614 |
||
7615 |
jClr instVarNamed:'pData' put:clr. |
|
7616 |
jClr instVarNamed:'value' put:(clr rgbValue). |
|
7617 |
"/ self halt. |
|
7618 |
^ jClr. |
|
7619 |
||
7620 |
"Created: / 15.8.1997 / 15:38:10 / cg" |
|
7621 |
"Modified: / 4.1.1998 / 18:06:51 / cg" |
|
7622 |
! |
|
7623 |
||
440 | 7624 |
_WComponentPeer__beginValidate:nativeContext |
7625 |
"/ void _beginValidate () |
|
7626 |
UnimplementedNativeMethodSignal raise |
|
7627 |
||
7628 |
"Created: / 12.11.1998 / 19:10:08 / cg" |
|
7629 |
! |
|
7630 |
||
284 | 7631 |
_WComponentPeer__dispose:nativeContext |
7632 |
|view jPeer| |
|
7633 |
||
7634 |
view := self viewForWPeer:nativeContext. |
|
7635 |
||
7636 |
Object errorSignal catch:[ |
|
7637 |
view destroy. |
|
7638 |
]. |
|
7639 |
JavaWindowGroup removeView:view. |
|
7640 |
||
7641 |
jPeer := nativeContext receiver. |
|
7642 |
jPeer instVarNamed:'pData' put:0. |
|
7643 |
||
7644 |
"Created: / 7.1.1998 / 22:36:25 / cg" |
|
7645 |
"Modified: / 25.1.1998 / 16:43:06 / cg" |
|
7646 |
! |
|
7647 |
||
7648 |
_WComponentPeer__setBackground:nativeContext |
|
7649 |
|rgb clr view| |
|
7650 |
||
7651 |
view := self viewForWPeer:nativeContext. |
|
483 | 7652 |
view isNil ifTrue:[^ self]. |
284 | 7653 |
|
7654 |
rgb := nativeContext argAt:1. |
|
7655 |
clr := Color rgbValue:rgb. |
|
7656 |
||
7657 |
"/ self halt. |
|
7658 |
"/ self internalError:'breakPoint'. |
|
7659 |
||
7660 |
clr := clr on:(view device). |
|
7661 |
||
7662 |
"/ (view superView isMemberOf:JavaEmbeddedFrameView) ifTrue:[ |
|
7663 |
"/ view viewBackground:(view superView viewBackground). |
|
7664 |
"/ view backgroundPaint:(view superView viewBackground). |
|
7665 |
"/ ] ifFalse:[ |
|
7666 |
"/ (view isMemberOf:JavaView) ifTrue:[ |
|
7667 |
"/ view viewBackground:clr. |
|
7668 |
"/ view backgroundPaint:clr. |
|
7669 |
"/ ] |
|
7670 |
"/ ]. |
|
7671 |
||
7672 |
(view isKindOf:ScrollableView) ifTrue:[ |
|
483 | 7673 |
view := view scrolledView |
284 | 7674 |
]. |
7675 |
view viewBackground:clr. |
|
7676 |
view backgroundPaint:clr. |
|
7677 |
||
7678 |
"Created: / 4.1.1998 / 18:07:39 / cg" |
|
483 | 7679 |
"Modified: / 4.12.1998 / 17:26:06 / cg" |
284 | 7680 |
! |
7681 |
||
7682 |
_WComponentPeer__setForeground:nativeContext |
|
7683 |
|rgb clr view| |
|
7684 |
||
7685 |
view := self viewForWPeer:nativeContext. |
|
7686 |
||
7687 |
rgb := nativeContext argAt:1. |
|
7688 |
clr := Color rgbValue:rgb. |
|
7689 |
||
7690 |
"/ self halt. |
|
7691 |
"/ self internalError:'breakPoint'. |
|
7692 |
||
7693 |
clr := clr on:(view device). |
|
7694 |
||
7695 |
view paint:clr. |
|
7696 |
||
7697 |
"Created: / 4.1.1998 / 18:08:13 / cg" |
|
7698 |
"Modified: / 8.1.1998 / 17:32:45 / cg" |
|
7699 |
! |
|
7700 |
||
7701 |
_WComponentPeer_disable:nativeContext |
|
7702 |
|view| |
|
7703 |
||
7704 |
view := self viewForWPeer:nativeContext. |
|
7705 |
||
7706 |
Object errorSignal handle:[:ex | |
|
7707 |
] do:[ |
|
7708 |
view disable |
|
7709 |
] |
|
7710 |
||
7711 |
"Created: / 6.1.1998 / 18:26:36 / cg" |
|
7712 |
"Modified: / 8.1.1998 / 17:32:53 / cg" |
|
7713 |
! |
|
7714 |
||
7715 |
_WComponentPeer_enable:nativeContext |
|
7716 |
|view| |
|
7717 |
||
7718 |
view := self viewForWPeer:nativeContext. |
|
7719 |
||
7720 |
Object errorSignal handle:[:ex | |
|
7721 |
] do:[ |
|
7722 |
view enable |
|
7723 |
] |
|
7724 |
||
7725 |
"Modified: / 8.1.1998 / 17:32:53 / cg" |
|
7726 |
"Created: / 13.1.1998 / 23:08:05 / cg" |
|
7727 |
! |
|
7728 |
||
440 | 7729 |
_WComponentPeer_endValidate:nativeContext |
7730 |
"/ void endValidate () |
|
7731 |
UnimplementedNativeMethodSignal raise |
|
7732 |
||
7733 |
"Created: / 12.11.1998 / 19:10:20 / cg" |
|
7734 |
! |
|
7735 |
||
7736 |
_WComponentPeer_getLocationOnScreen:nativeContext |
|
7737 |
"/ java.awt.Point getLocationOnScreen () |
|
480 | 7738 |
|
7739 |
|view p jP| |
|
7740 |
||
7741 |
view := self viewForWPeer:nativeContext. |
|
7742 |
view isNil ifTrue:[^ nil]. |
|
7743 |
||
7744 |
p := view originRelativeTo:nil. |
|
484 | 7745 |
jP := (Java classForName:'java.awt.Point') basicNew. |
480 | 7746 |
jP instVarNamed:'x' put:p x. |
7747 |
jP instVarNamed:'y' put:p y. |
|
7748 |
^ jP |
|
7749 |
||
485 | 7750 |
"Modified: / 5.12.1998 / 14:44:31 / cg" |
440 | 7751 |
! |
7752 |
||
284 | 7753 |
_WComponentPeer_handleEvent:nativeContext |
7754 |
"this is invoked by java, to let a widget handle any event which |
|
7755 |
was not consumed (eaten) by java. |
|
7756 |
If the view in question is some ST-widget, forward it. |
|
7757 |
Ignore for JavaViews." |
|
7758 |
||
493 | 7759 |
|view jEv stEv ignore| |
284 | 7760 |
|
7761 |
view := self viewForWPeer:nativeContext. |
|
7762 |
view notNil ifTrue:[ |
|
474 | 7763 |
jEv := nativeContext argAt:1. |
7764 |
stEv := jEv instVarNamed:'data'. |
|
7765 |
(stEv notNil and:[stEv ~~ 0]) ifTrue:[ |
|
493 | 7766 |
ignore := true. |
483 | 7767 |
view isJavaView ifFalse:[ |
493 | 7768 |
ignore := false |
7769 |
] ifTrue:[ |
|
7770 |
view isTopView ifTrue:[ |
|
7771 |
stEv type == #terminate ifTrue:[ |
|
7772 |
ignore := false |
|
7773 |
]. |
|
7774 |
] |
|
7775 |
]. |
|
7776 |
||
7777 |
ignore ifFalse:[ |
|
316 | 7778 |
EventTrace == true ifTrue:[ |
7779 |
('JAVA: WComponent - handleEvent: ' , stEv type , ' for ' , view printString) infoPrintCR. |
|
7780 |
]. |
|
474 | 7781 |
view dispatchEvent:stEv. |
316 | 7782 |
^ self. |
493 | 7783 |
]. |
7784 |
||
7785 |
EventTrace == true ifTrue:[ |
|
7786 |
('JAVA: WComponent - handleEvent ignored:' , stEv type) infoPrintCR. |
|
7787 |
]. |
|
7788 |
^ self |
|
316 | 7789 |
] |
7790 |
]. |
|
7791 |
EventTrace == true ifTrue:[ |
|
7792 |
('JAVA: WComponent - handleEvent ignored') infoPrintCR. |
|
7793 |
] |
|
284 | 7794 |
|
7795 |
"Created: / 6.1.1998 / 21:10:17 / cg" |
|
493 | 7796 |
"Modified: / 11.12.1998 / 01:04:14 / cg" |
284 | 7797 |
! |
7798 |
||
7799 |
_WComponentPeer_hide:nativeContext |
|
7800 |
|view| |
|
7801 |
||
7802 |
view := self viewForWPeer:nativeContext. |
|
483 | 7803 |
"/ view isPopUpView ifTrue:[self halt]. |
284 | 7804 |
|
7805 |
Object errorSignal handle:[:ex | |
|
7806 |
] do:[ |
|
483 | 7807 |
view beInvisible |
284 | 7808 |
] |
7809 |
||
7810 |
"Created: / 7.1.1998 / 22:35:32 / cg" |
|
483 | 7811 |
"Modified: / 4.12.1998 / 17:53:41 / cg" |
284 | 7812 |
! |
7813 |
||
391 | 7814 |
_WComponentPeer_nativeHandleEvent:nativeContext |
7815 |
"this is invoked by java, to let a widget handle any event which |
|
7816 |
was not consumed (eaten) by java. |
|
7817 |
If the view in question is some ST-widget, forward it. |
|
7818 |
Ignore for JavaViews." |
|
7819 |
||
7820 |
|view jEv stEv| |
|
7821 |
||
7822 |
^self. |
|
7823 |
view := self viewForWPeer:nativeContext. |
|
7824 |
view notNil ifTrue:[ |
|
7825 |
(view isKindOf:JavaView) ifFalse:[ |
|
7826 |
jEv := nativeContext argAt:1. |
|
7827 |
stEv := jEv instVarNamed:'data'. |
|
7828 |
(stEv notNil and:[stEv ~~ 0]) ifTrue:[ |
|
7829 |
EventTrace == true ifTrue:[ |
|
7830 |
('JAVA: WComponent - handleEvent: ' , stEv type , ' for ' , view printString) infoPrintCR. |
|
7831 |
]. |
|
7832 |
stEv sendEventWithFocusOn:nil. |
|
7833 |
^ self. |
|
7834 |
] |
|
7835 |
] |
|
7836 |
]. |
|
7837 |
EventTrace == true ifTrue:[ |
|
7838 |
('JAVA: WComponent - handleEvent ignored') infoPrintCR. |
|
7839 |
] |
|
7840 |
||
7841 |
"Created: / 19.10.1998 / 21:26:16 / cg" |
|
7842 |
"Modified: / 19.10.1998 / 23:26:37 / cg" |
|
7843 |
! |
|
7844 |
||
284 | 7845 |
_WComponentPeer_requestFocus:nativeContext |
7846 |
|view| |
|
7847 |
||
7848 |
view := self viewForWPeer:nativeContext. |
|
318 | 7849 |
"/ 'getFocus - ' print. view displayString printCR. |
284 | 7850 |
|
483 | 7851 |
"/ view getKeyboardFocus |
284 | 7852 |
|
7853 |
"Created: / 7.1.1998 / 22:30:03 / cg" |
|
483 | 7854 |
"Modified: / 4.12.1998 / 19:42:18 / cg" |
284 | 7855 |
! |
7856 |
||
7857 |
_WComponentPeer_reshape:nativeContext |
|
7858 |
self commonReshapeComponent:nativeContext |
|
7859 |
||
7860 |
"Modified: / 18.3.1997 / 19:30:21 / cg" |
|
7861 |
"Created: / 4.1.1998 / 18:01:11 / cg" |
|
7862 |
! |
|
7863 |
||
7864 |
_WComponentPeer_setCursor:nativeContext |
|
7865 |
|view| |
|
7866 |
||
7867 |
view := self viewForWPeer:nativeContext. |
|
7868 |
"/ self halt. |
|
7869 |
||
7870 |
"Created: / 5.1.1998 / 01:52:30 / cg" |
|
7871 |
"Modified: / 25.1.1998 / 01:21:52 / cg" |
|
7872 |
! |
|
7873 |
||
7874 |
_WComponentPeer_setFont:nativeContext |
|
7875 |
|view| |
|
7876 |
||
7877 |
view := self viewForWPeer:nativeContext. |
|
7878 |
"/ self halt. |
|
7879 |
||
7880 |
"Created: / 5.1.1998 / 00:55:17 / cg" |
|
7881 |
"Modified: / 25.1.1998 / 01:22:19 / cg" |
|
7882 |
! |
|
7883 |
||
7884 |
_WComponentPeer_setZOrderPosition:nativeContext |
|
7885 |
|view| |
|
7886 |
||
7887 |
view := self viewForWPeer:nativeContext. |
|
7888 |
"/ self unimplementedNativeMethod. |
|
7889 |
"/ self halt. |
|
7890 |
"/ self internalError:'breakPoint' |
|
7891 |
||
7892 |
"Created: / 4.1.1998 / 17:59:26 / cg" |
|
7893 |
"Modified: / 25.1.1998 / 01:22:32 / cg" |
|
7894 |
! |
|
7895 |
||
7896 |
_WComponentPeer_show:nativeContext |
|
7897 |
|view| |
|
7898 |
||
7899 |
view := self viewForWPeer:nativeContext. |
|
7900 |
||
7901 |
"/ frame views are under my browsers own control |
|
7902 |
(view isMemberOf:JavaEmbeddedFrameView) ifFalse:[ |
|
7903 |
view beVisible. |
|
7904 |
view realize. |
|
7905 |
]. |
|
7906 |
||
7907 |
"/ view windowGroup notNil ifTrue:[ |
|
7908 |
"/ windowServer addGroup:(view windowGroup) |
|
7909 |
"/ ]. |
|
7910 |
||
7911 |
^ nil |
|
7912 |
||
7913 |
"/ self halt. |
|
7914 |
||
7915 |
"Created: / 5.1.1998 / 01:26:22 / cg" |
|
483 | 7916 |
"Modified: / 4.12.1998 / 17:43:53 / cg" |
284 | 7917 |
! |
7918 |
||
7919 |
_WComponentPeer_start:nativeContext |
|
7920 |
"/ self halt. |
|
7921 |
||
7922 |
"Modified: / 18.3.1997 / 18:43:18 / cg" |
|
7923 |
"Created: / 5.1.1998 / 00:58:40 / cg" |
|
7924 |
! |
|
7925 |
||
7926 |
_WDefaultFontCharset_canConvert:nativeContext |
|
7927 |
^ 1 |
|
7928 |
||
7929 |
"Modified: / 21.8.1997 / 15:56:57 / cg" |
|
7930 |
"Created: / 5.1.1998 / 01:55:47 / cg" |
|
7931 |
! |
|
7932 |
||
7933 |
_WDialogPeer__hide:nativeContext |
|
7934 |
|dialog| |
|
7935 |
||
7936 |
dialog := self viewForWPeer:nativeContext. |
|
7937 |
||
7938 |
dialog hide. |
|
7939 |
||
7940 |
"Created: / 7.1.1998 / 22:34:10 / cg" |
|
7941 |
"Modified: / 8.1.1998 / 17:34:10 / cg" |
|
7942 |
! |
|
7943 |
||
7944 |
_WDialogPeer__show:nativeContext |
|
7945 |
|dialog| |
|
7946 |
||
7947 |
dialog := self viewForWPeer:nativeContext. |
|
7948 |
"/ |
|
7949 |
"/ show does not work (yet); must setup windowgroup |
|
7950 |
"/ for it to get events ... |
|
480 | 7951 |
"/ dialog realize. |
7952 |
||
7953 |
dialog show. |
|
495 | 7954 |
"/dialog fixSize. |
7955 |
"/dialog makeFullyVisible. |
|
7956 |
"/dialog openModal:[true] inGroup:JavaWindowGroup |
|
284 | 7957 |
|
7958 |
"Created: / 7.1.1998 / 21:52:15 / cg" |
|
495 | 7959 |
"Modified: / 11.12.1998 / 14:43:05 / cg" |
284 | 7960 |
! |
7961 |
||
7962 |
_WDialogPeer_create:nativeContext |
|
7963 |
|jDialogPeer dialog| |
|
7964 |
||
7965 |
jDialogPeer := nativeContext receiver. |
|
7966 |
||
7967 |
dialog := ModalBox new. |
|
7968 |
jDialogPeer instVarNamed:'pData' put:dialog. |
|
7969 |
||
7970 |
self createdWindowsView:dialog for:jDialogPeer. |
|
7971 |
dialog windowGroup:JavaWindowGroup. |
|
7972 |
JavaWindowGroup addTopView:dialog. |
|
7973 |
||
7974 |
WindowCreationTrace == true ifTrue:[ |
|
7975 |
'WDialogPeer_create: ' print. dialog printNL. |
|
7976 |
]. |
|
7977 |
||
7978 |
"Created: / 7.1.1998 / 21:51:00 / cg" |
|
7979 |
"Modified: / 15.1.1998 / 16:12:44 / cg" |
|
7980 |
! |
|
7981 |
||
440 | 7982 |
_WDrawingSurfaceInfo_getDepth:nativeContext |
7983 |
"/ int getDepth () |
|
7984 |
UnimplementedNativeMethodSignal raise |
|
7985 |
||
7986 |
"Created: / 12.11.1998 / 19:21:00 / cg" |
|
7987 |
! |
|
7988 |
||
7989 |
_WDrawingSurfaceInfo_getHBitmap:nativeContext |
|
7990 |
"/ int getHBitmap () |
|
7991 |
UnimplementedNativeMethodSignal raise |
|
7992 |
||
7993 |
"Created: / 12.11.1998 / 19:20:32 / cg" |
|
7994 |
! |
|
7995 |
||
7996 |
_WDrawingSurfaceInfo_getHDC:nativeContext |
|
7997 |
"/ int getHDC () |
|
7998 |
UnimplementedNativeMethodSignal raise |
|
7999 |
||
8000 |
"Created: / 12.11.1998 / 19:20:50 / cg" |
|
8001 |
! |
|
8002 |
||
8003 |
_WDrawingSurfaceInfo_getHPalette:nativeContext |
|
8004 |
"/ int getHPalette () |
|
8005 |
UnimplementedNativeMethodSignal raise |
|
8006 |
||
8007 |
"Created: / 12.11.1998 / 19:21:07 / cg" |
|
8008 |
! |
|
8009 |
||
8010 |
_WDrawingSurfaceInfo_getHWnd:nativeContext |
|
8011 |
"/ int getHWnd () |
|
8012 |
UnimplementedNativeMethodSignal raise |
|
8013 |
||
8014 |
"Created: / 12.11.1998 / 19:20:23 / cg" |
|
8015 |
! |
|
8016 |
||
8017 |
_WDrawingSurfaceInfo_getPBits:nativeContext |
|
8018 |
"/ int getPBits () |
|
8019 |
UnimplementedNativeMethodSignal raise |
|
8020 |
||
8021 |
"Created: / 12.11.1998 / 19:20:41 / cg" |
|
8022 |
! |
|
8023 |
||
8024 |
_WDrawingSurfaceInfo_lock:nativeContext |
|
8025 |
"/ int lock () |
|
8026 |
UnimplementedNativeMethodSignal raise |
|
8027 |
||
8028 |
"Created: / 12.11.1998 / 19:20:00 / cg" |
|
8029 |
! |
|
8030 |
||
8031 |
_WDrawingSurfaceInfo_unlock:nativeContext |
|
8032 |
"/ void unlock () |
|
8033 |
UnimplementedNativeMethodSignal raise |
|
8034 |
||
8035 |
"Created: / 12.11.1998 / 19:20:13 / cg" |
|
8036 |
! |
|
8037 |
||
8038 |
_WEmbeddedFramePeer_create:nativeContext |
|
8039 |
"/ void create (sun.awt.windows.WComponentPeer) |
|
8040 |
UnimplementedNativeMethodSignal raise |
|
8041 |
||
8042 |
"Created: / 12.11.1998 / 19:16:09 / cg" |
|
8043 |
! |
|
8044 |
||
284 | 8045 |
_WFileDialogPeer_show:nativeContext |
8046 |
|jDialogPeer jDialog dialogView stDialog |
|
8047 |
title dir pattern f| |
|
8048 |
||
8049 |
jDialogPeer := nativeContext receiver. |
|
8050 |
jDialog := jDialogPeer instVarNamed:'target'. |
|
8051 |
dialogView := jDialogPeer instVarNamed:'pData'. |
|
8052 |
||
8053 |
stDialog := FileSelectionBox new. |
|
8054 |
||
8055 |
dir := jDialog instVarNamed:'dir'. |
|
8056 |
dir notNil ifTrue:[ |
|
8057 |
stDialog directory:(Java as_ST_String:dir). |
|
8058 |
]. |
|
8059 |
pattern := jDialog instVarNamed:'file'. |
|
8060 |
pattern notNil ifTrue:[ |
|
8061 |
stDialog pattern:(Java as_ST_String:pattern). |
|
8062 |
]. |
|
8063 |
title := jDialog instVarNamed:'title'. |
|
8064 |
title notNil ifTrue:[ |
|
8065 |
stDialog title:(Java as_ST_String:title). |
|
8066 |
stDialog label:(Java as_ST_String:title). |
|
8067 |
]. |
|
8068 |
||
8069 |
stDialog show. |
|
8070 |
||
8071 |
stDialog accepted ifTrue:[ |
|
8072 |
f := stDialog pathName. |
|
8073 |
||
8074 |
"/ cannot use the one below - it has a builtIn fileSeparator if '\' (sigh) |
|
8075 |
"/ jDialogPeer perform:#'handleSelected(Ljava/lang/String;)V' with:(Java as_String:f). |
|
8076 |
||
8077 |
jDialog |
|
8078 |
perform:#'setFile(Ljava/lang/String;)V' |
|
8079 |
with:(Java as_String:(f asFilename baseName)). |
|
8080 |
jDialog |
|
8081 |
perform:#'setDirectory(Ljava/lang/String;)V' |
|
8082 |
with:(Java as_String:(f asFilename directoryName , Filename separator asString)). |
|
8083 |
jDialog |
|
8084 |
perform:#'setVisible(Z)V' |
|
8085 |
with:0. |
|
8086 |
] ifFalse:[ |
|
8087 |
jDialogPeer |
|
8088 |
perform:#'handleCancel()V' |
|
8089 |
]. |
|
8090 |
"/ self halt. |
|
8091 |
||
8092 |
"Created: / 7.1.1998 / 22:38:45 / cg" |
|
8093 |
"Modified: / 15.1.1998 / 13:04:05 / cg" |
|
8094 |
! |
|
8095 |
||
440 | 8096 |
_WFontMetrics_bytesWidth:nativeContext |
8097 |
"/ int bytesWidth (byte[] int int) |
|
8098 |
UnimplementedNativeMethodSignal raise |
|
8099 |
||
8100 |
"Created: / 12.11.1998 / 19:11:46 / cg" |
|
8101 |
! |
|
8102 |
||
284 | 8103 |
_WFontMetrics_getMFCharSegmentWidth:nativeContext |
8104 |
"get multi-font string-segment width. |
|
8105 |
Not yet supported - use standard strings width" |
|
8106 |
||
8107 |
|jMetrics jFont jFontDescr stFont w |
|
8108 |
bool1 cp offs lenght bp int1| |
|
8109 |
||
8110 |
jMetrics := nativeContext receiver. |
|
8111 |
jFont := nativeContext argAt:1. |
|
8112 |
jFontDescr := nativeContext argAt:2. |
|
8113 |
bool1 := nativeContext argAt:3. |
|
8114 |
cp := nativeContext argAt:4. |
|
8115 |
offs := nativeContext argAt:5. |
|
8116 |
lenght := nativeContext argAt:6. |
|
8117 |
bp := nativeContext argAt:7. |
|
8118 |
int1 := nativeContext argAt:8. |
|
8119 |
||
8120 |
stFont := jFont instVarNamed:'pData'. |
|
8121 |
(stFont isNil or:[stFont == 0]) ifTrue:[ |
|
8122 |
self halt |
|
8123 |
]. |
|
8124 |
||
8125 |
stFont device isNil ifTrue:[ |
|
8126 |
stFont := stFont on:Display. |
|
8127 |
jFont instVarNamed:'pData' put:stFont. |
|
8128 |
]. |
|
8129 |
w := stFont widthOf:cp from:offs+1 to:offs+lenght. |
|
8130 |
^ w. |
|
8131 |
||
8132 |
"Created: / 5.1.1998 / 01:57:45 / cg" |
|
8133 |
"Modified: / 13.1.1998 / 23:44:03 / cg" |
|
8134 |
! |
|
8135 |
||
8136 |
_WFontMetrics_init:nativeContext |
|
8137 |
|jMetrics jFont stFont widths family name style size| |
|
8138 |
||
8139 |
jMetrics := nativeContext receiver. |
|
8140 |
jFont := jMetrics instVarNamed:'font'. |
|
8141 |
||
8142 |
family := jFont instVarNamed:'family'. |
|
8143 |
family := Java as_ST_String:family. |
|
8144 |
||
8145 |
name := jFont instVarNamed:'name'. |
|
8146 |
name := Java as_ST_String:name. |
|
8147 |
||
8148 |
style := jFont instVarNamed:'style'. |
|
8149 |
size := jFont instVarNamed:'size'. |
|
8150 |
||
8151 |
stFont := Font family:family size:size. |
|
8152 |
stFont isNil ifTrue:[ |
|
8153 |
stFont := Font family:'helvetica' size:size. |
|
8154 |
]. |
|
8155 |
stFont := stFont on:Display. |
|
8156 |
||
8157 |
"/ stFont := jFont instVarNamed:'pData'. |
|
8158 |
"/ stFont isNil ifTrue:[ |
|
8159 |
"/ self halt |
|
8160 |
"/ ]. |
|
8161 |
||
8162 |
stFont := stFont on:Display. |
|
8163 |
jFont instVarNamed:'pData' put:stFont. |
|
8164 |
||
8165 |
jMetrics instVarNamed:'ascent' put:stFont ascent. |
|
8166 |
jMetrics instVarNamed:'descent' put:stFont descent. |
|
8167 |
jMetrics instVarNamed:'leading' put:0. |
|
8168 |
jMetrics instVarNamed:'height' put:stFont height. |
|
8169 |
jMetrics instVarNamed:'maxAscent' put:stFont maxAscent. |
|
8170 |
jMetrics instVarNamed:'maxDescent' put:stFont maxDescent. |
|
8171 |
jMetrics instVarNamed:'maxHeight' put:stFont maxHeight. |
|
8172 |
jMetrics instVarNamed:'maxAdvance' put:stFont maxWidth. |
|
8173 |
||
8174 |
widths := Array new:256. |
|
8175 |
0 to:255 do:[:i | |
|
8176 |
widths at:(i+1) put:(stFont widthOf:(Character value:i)) |
|
8177 |
]. |
|
8178 |
jMetrics instVarNamed:'widths' put:widths. |
|
8179 |
"/ self halt. |
|
8180 |
||
8181 |
"Modified: / 8.8.1997 / 12:06:53 / cg" |
|
8182 |
"Created: / 5.1.1998 / 01:54:29 / cg" |
|
8183 |
! |
|
8184 |
||
8185 |
_WFontMetrics_needsConversion:nativeContext |
|
8186 |
|jFont jFontDescr stFont| |
|
8187 |
||
8188 |
jFont := nativeContext argAt:1. |
|
8189 |
jFontDescr := nativeContext argAt:2. |
|
8190 |
||
8191 |
stFont := jFont instVarNamed:'pData'. |
|
8192 |
"/ stFont isNil ifTrue:[ |
|
8193 |
"/ self halt |
|
8194 |
"/ ]. |
|
8195 |
"/ stFont device isNil ifTrue:[ |
|
8196 |
"/ stFont := stFont on:Display. |
|
8197 |
"/ jFont instVarNamed:'pData' put:stFont. |
|
8198 |
"/ ]. |
|
8199 |
"/ |
|
8200 |
||
8201 |
^ 0 |
|
8202 |
||
8203 |
"Modified: / 17.8.1997 / 17:16:29 / cg" |
|
8204 |
"Created: / 5.1.1998 / 01:56:42 / cg" |
|
8205 |
! |
|
8206 |
||
341 | 8207 |
_WFramePeer__setIconImage:nativeContext |
8208 |
|frame imgRep image| |
|
8209 |
||
8210 |
frame := self viewForWPeer:nativeContext. |
|
8211 |
imgRep := nativeContext argAt:1. |
|
8212 |
imgRep notNil ifTrue:[ |
|
8213 |
image := imgRep instVarNamed:'pData'. |
|
8214 |
image notNil ifTrue:[ |
|
8215 |
frame icon:image. |
|
8216 |
] |
|
8217 |
]. |
|
8218 |
||
8219 |
"Created: / 27.4.1998 / 17:15:09 / cg" |
|
8220 |
"Modified: / 27.4.1998 / 17:18:24 / cg" |
|
8221 |
! |
|
8222 |
||
284 | 8223 |
_WFramePeer_create:nativeContext |
474 | 8224 |
|jFramePeer jFrame top frame pDataIdx| |
284 | 8225 |
|
8226 |
jFramePeer := nativeContext receiver. |
|
8227 |
||
8228 |
"/ for now: a kludge to create an embedded frame for |
|
8229 |
"/ mozillaFrames |
|
8230 |
||
8231 |
jFrame := jFramePeer instVarNamed:'target'. |
|
8232 |
(jFrame notNil |
|
8233 |
and:[(pDataIdx := jFrame class instVarOffsetOf:'pData') notNil]) |
|
8234 |
ifTrue:[ |
|
8235 |
((frame := jFrame instVarAt:pDataIdx) notNil |
|
8236 |
and:[frame ~~ 0]) ifTrue:[ |
|
318 | 8237 |
WindowCreationTrace == true ifTrue:[ |
8238 |
'JAVA: targetFrame view already created: ' infoPrintCR. |
|
8239 |
]. |
|
284 | 8240 |
"/ sigh; pData was renamed to pNativeWidget in jdk1.2 ... |
8241 |
pDataIdx := jFramePeer class instVarOffsetOf:'pNativeWidget'. |
|
8242 |
pDataIdx isNil ifTrue:[ |
|
8243 |
"/ ok, we are < 1.2 |
|
8244 |
pDataIdx := jFramePeer class instVarOffsetOf:'pData'. |
|
8245 |
]. |
|
8246 |
jFramePeer instVarAt:pDataIdx put:frame. |
|
8247 |
] |
|
8248 |
] ifFalse:[ |
|
8249 |
frame := jFramePeer instVarNamed:'pData' |
|
8250 |
]. |
|
8251 |
||
8252 |
(frame notNil and:[frame ~~ 0]) ifTrue:[ |
|
318 | 8253 |
WindowCreationTrace == true ifTrue:[ |
8254 |
'JAVA: frame view already created: ' infoPrint. |
|
8255 |
jFramePeer class name infoPrintCR. |
|
8256 |
]. |
|
284 | 8257 |
] ifFalse:[ |
474 | 8258 |
"/ OLD |
8259 |
"/ frame := StandardSystemView new. |
|
8260 |
"/ self createdWindowsView:frame for:jFramePeer. |
|
8261 |
"/ JavaWindowGroup addTopView:frame. |
|
8262 |
||
8263 |
frame := JavaTopView new. |
|
8264 |
frame delegate:self. |
|
8265 |
frame javaPeer:jFramePeer. |
|
284 | 8266 |
self createdWindowsView:frame for:jFramePeer. |
8267 |
JavaWindowGroup addTopView:frame. |
|
474 | 8268 |
|
8269 |
"/ top := StandardSystemView new. |
|
8270 |
"/ frame := JavaView origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
8271 |
"/ frame delegate:self. |
|
8272 |
"/ frame javaPeer:jFramePeer. |
|
8273 |
"/ self createdWindowsView:frame for:jFramePeer. |
|
8274 |
"/ JavaWindowGroup addTopView:top. |
|
8275 |
||
284 | 8276 |
]. |
8277 |
||
8278 |
WindowCreationTrace == true ifTrue:[ |
|
8279 |
'JAVA: WFramePeer_create: ' print. jFramePeer displayString print. |
|
8280 |
' frame: ' print. frame printNL. |
|
8281 |
]. |
|
8282 |
||
8283 |
"Created: / 4.1.1998 / 17:56:39 / cg" |
|
474 | 8284 |
"Modified: / 3.12.1998 / 00:10:21 / cg" |
284 | 8285 |
! |
8286 |
||
8287 |
_WFramePeer_setMenuBar0:nativeContext |
|
8288 |
|frame jMenuBarPeer menuPanel| |
|
8289 |
||
8290 |
frame := self viewForWPeer:nativeContext. |
|
8291 |
||
8292 |
jMenuBarPeer := nativeContext argAt:1. |
|
8293 |
jMenuBarPeer isNil ifTrue:[ |
|
8294 |
"/ mhmh - JAVA wants to remove the frames menuPanel. |
|
8295 |
"/ but I have no handle on it (for destroy). |
|
8296 |
"/ search it in subViews of the frame. |
|
8297 |
frame subViews copy do:[:v | |
|
8298 |
(v isKindOf:MenuPanel) ifTrue:[ |
|
8299 |
v destroy |
|
8300 |
] |
|
8301 |
] |
|
8302 |
] ifFalse:[ |
|
8303 |
menuPanel := jMenuBarPeer instVarNamed:'pData'. |
|
8304 |
||
8305 |
menuPanel origin:0.0@0.0 corner:1.0@(menuPanel preferredExtent y). |
|
8306 |
frame addSubView:menuPanel. |
|
8307 |
]. |
|
8308 |
^ nil |
|
8309 |
||
8310 |
"Created: / 7.1.1998 / 21:41:35 / cg" |
|
8311 |
"Modified: / 8.1.1998 / 17:35:04 / cg" |
|
8312 |
! |
|
8313 |
||
440 | 8314 |
_WGraphics__dispose:nativeContext |
8315 |
"/ void _dispose() |
|
8316 |
UnimplementedNativeMethodSignal raise |
|
8317 |
||
8318 |
"Created: / 12.11.1998 / 19:17:51 / cg" |
|
8319 |
! |
|
8320 |
||
284 | 8321 |
_WGraphics_changeClip:nativeContext |
391 | 8322 |
|gc x y w h r bool| |
284 | 8323 |
|
8324 |
gc := self gcForWGraphics:nativeContext. |
|
8325 |
||
8326 |
x := nativeContext argAt:1. |
|
8327 |
y := nativeContext argAt:2. |
|
8328 |
w := nativeContext argAt:3. |
|
8329 |
h := nativeContext argAt:4. |
|
8330 |
bool := (nativeContext argAt:5) ~~ 0. |
|
8331 |
||
391 | 8332 |
r := Rectangle left:x top:y width:w height:h. |
401 | 8333 |
"/ 'WGraphics_changeClip: ' infoPrint. r infoPrintCR. |
391 | 8334 |
gc clippingRectangle:r. |
284 | 8335 |
|
8336 |
"Created: / 6.1.1998 / 20:57:21 / cg" |
|
401 | 8337 |
"Modified: / 20.10.1998 / 19:40:10 / cg" |
284 | 8338 |
! |
8339 |
||
8340 |
_WGraphics_clearRect:nativeContext |
|
8341 |
|gc x y w h| |
|
8342 |
||
8343 |
gc := self gcForWGraphics:nativeContext. |
|
8344 |
"/ gc isNil ifTrue:[^ self]. |
|
8345 |
||
8346 |
gc realized ifFalse:[ |
|
8347 |
'JAVA: drawing on unrealized gc - ignored' infoPrintCR. |
|
8348 |
^ self |
|
8349 |
]. |
|
8350 |
||
8351 |
x := nativeContext argAt:1. |
|
8352 |
y := nativeContext argAt:2. |
|
8353 |
w := nativeContext argAt:3. |
|
8354 |
h := nativeContext argAt:4. |
|
8355 |
||
8356 |
"/ self halt. |
|
8357 |
"/ self internalError:'breakPoint'. |
|
8358 |
||
8359 |
gc clearRectangleX:x y:y width:w height:h. |
|
8360 |
||
8361 |
"Created: / 8.1.1998 / 00:16:00 / cg" |
|
8362 |
"Modified: / 8.1.1998 / 00:21:09 / cg" |
|
8363 |
! |
|
8364 |
||
440 | 8365 |
_WGraphics_close:nativeContext |
8366 |
"/ void close (sun.awt.windows.WPrintJob) |
|
8367 |
UnimplementedNativeMethodSignal raise |
|
8368 |
||
8369 |
"Created: / 12.11.1998 / 19:19:40 / cg" |
|
8370 |
! |
|
8371 |
||
337 | 8372 |
_WGraphics_copyArea:nativeContext |
8373 |
|gc srcX srcY w h deltaX deltaY| |
|
8374 |
||
8375 |
gc := self gcForWGraphics:nativeContext. |
|
8376 |
"/ gc isNil ifTrue:[^ self]. |
|
8377 |
||
8378 |
gc realized ifFalse:[ |
|
8379 |
'JAVA: copyArea on unrealized gc - ignored' infoPrintCR. |
|
8380 |
^ self |
|
8381 |
]. |
|
8382 |
||
8383 |
srcX := nativeContext argAt:1. |
|
8384 |
srcY := nativeContext argAt:2. |
|
8385 |
w := nativeContext argAt:3. |
|
8386 |
h := nativeContext argAt:4. |
|
8387 |
deltaX := nativeContext argAt:5. |
|
8388 |
deltaY := nativeContext argAt:6. |
|
8389 |
||
8390 |
gc |
|
8391 |
copyFrom:gc |
|
8392 |
x:srcX y:srcY |
|
8393 |
toX:srcX+deltaX y:srcY+deltaY |
|
8394 |
width:w height:h |
|
8395 |
||
8396 |
"Created: / 8.1.1998 / 00:16:00 / cg" |
|
8397 |
"Modified: / 9.4.1998 / 22:01:32 / cg" |
|
8398 |
! |
|
8399 |
||
284 | 8400 |
_WGraphics_createFromComponent:nativeContext |
8401 |
|jGraphics jWin view| |
|
8402 |
||
8403 |
jGraphics := nativeContext receiver. |
|
8404 |
jWin := nativeContext argAt:1. |
|
8405 |
||
8406 |
view := KnownWindows at:jWin ifAbsent:nil. |
|
8407 |
view isNil ifTrue:[ |
|
401 | 8408 |
self halt. |
8409 |
^ self |
|
8410 |
]. |
|
8411 |
view clippingRectangle:nil. |
|
284 | 8412 |
|
8413 |
"/ "/ just a consistency check ... |
|
8414 |
"/ (jWin instVarNamed:'xid') ~~ view ifTrue:[ |
|
8415 |
"/ self halt:'consistency check' |
|
8416 |
"/ ]. |
|
8417 |
||
8418 |
jGraphics instVarNamed:'pData' put:view. |
|
8419 |
||
8420 |
"Created: / 6.1.1998 / 20:55:18 / cg" |
|
401 | 8421 |
"Modified: / 20.10.1998 / 19:38:18 / cg" |
284 | 8422 |
! |
8423 |
||
8424 |
_WGraphics_createFromGraphics:nativeContext |
|
8425 |
|jGraphics graphics gc| |
|
8426 |
||
8427 |
jGraphics := nativeContext receiver. |
|
8428 |
graphics := nativeContext argAt:1. |
|
8429 |
gc := graphics instVarNamed:'pData'. |
|
8430 |
||
8431 |
jGraphics instVarNamed:'pData' put:gc. |
|
401 | 8432 |
gc clippingRectangle:nil. |
284 | 8433 |
|
8434 |
"Created: / 8.1.1998 / 00:47:39 / cg" |
|
401 | 8435 |
"Modified: / 20.10.1998 / 19:37:58 / cg" |
284 | 8436 |
! |
8437 |
||
440 | 8438 |
_WGraphics_createFromHDC:nativeContext |
8439 |
"/ void createFromHDC (int) |
|
8440 |
UnimplementedNativeMethodSignal raise |
|
8441 |
||
8442 |
"Created: / 12.11.1998 / 19:17:32 / cg" |
|
8443 |
! |
|
8444 |
||
8445 |
_WGraphics_createFromPrintJob:nativeContext |
|
8446 |
"/ void createFromPrintJob (sun.awt.windows.WPrintJob) |
|
8447 |
UnimplementedNativeMethodSignal raise |
|
8448 |
||
8449 |
"Created: / 12.11.1998 / 19:17:20 / cg" |
|
8450 |
! |
|
8451 |
||
284 | 8452 |
_WGraphics_dispose:nativeContext |
8453 |
|gc| |
|
8454 |
||
8455 |
gc := self gcForWGraphics:nativeContext. |
|
8456 |
gc isNil ifTrue:[^ self]. |
|
401 | 8457 |
gc clippingRectangle:nil. |
284 | 8458 |
|
8459 |
"Created: / 6.1.1998 / 20:58:38 / cg" |
|
401 | 8460 |
"Modified: / 20.10.1998 / 19:35:05 / cg" |
284 | 8461 |
! |
8462 |
||
8463 |
_WGraphics_drawArc:nativeContext |
|
8464 |
|gc x y w h startAngle endAngle| |
|
8465 |
||
8466 |
gc := self gcForWGraphics:nativeContext. |
|
8467 |
"/ gc isNil ifTrue:[^ self]. |
|
8468 |
gc realized ifFalse:[^ self]. |
|
8469 |
||
8470 |
x := nativeContext argAt:1. |
|
8471 |
y := nativeContext argAt:2. |
|
8472 |
w := nativeContext argAt:3. |
|
8473 |
h := nativeContext argAt:4. |
|
8474 |
startAngle := nativeContext argAt:5. |
|
8475 |
endAngle := nativeContext argAt:6. |
|
8476 |
||
8477 |
DrawOPTrace ifTrue:[ |
|
285 | 8478 |
'drawArc x/y= ' print. x print. '@' print. y print. |
8479 |
' w/h= ' print. w print. '@' print. h print. |
|
8480 |
' startAngle= ' print. startAngle print. ' endAngle= ' print. endAngle printCR. |
|
8481 |
]. |
|
8482 |
gc |
|
8483 |
displayArcX:x y:y |
|
8484 |
width:w height:h |
|
8485 |
from:startAngle angle:(endAngle - startAngle). |
|
284 | 8486 |
|
8487 |
"Created: / 6.1.1998 / 21:00:15 / cg" |
|
285 | 8488 |
"Modified: / 28.1.1998 / 23:23:42 / cg" |
284 | 8489 |
! |
8490 |
||
440 | 8491 |
_WGraphics_drawBytes:nativeContext |
8492 |
"/ void drawBytes (byte[] int int int int) |
|
8493 |
UnimplementedNativeMethodSignal raise |
|
8494 |
||
8495 |
"Created: / 12.11.1998 / 19:18:56 / cg" |
|
8496 |
! |
|
8497 |
||
284 | 8498 |
_WGraphics_drawLine:nativeContext |
8499 |
|gc x y x2 y2| |
|
8500 |
||
8501 |
gc := self gcForWGraphics:nativeContext. |
|
8502 |
"/ gc isNil ifTrue:[^ self]. |
|
8503 |
gc realized ifFalse:[^ self]. |
|
8504 |
||
8505 |
x := nativeContext argAt:1. |
|
8506 |
y := nativeContext argAt:2. |
|
8507 |
x2 := nativeContext argAt:3. |
|
8508 |
y2 := nativeContext argAt:4. |
|
8509 |
||
8510 |
DrawOPTrace ifTrue:[ |
|
8511 |
'drawLine x/y= ' print. x print. '@' print. y print. ' x2/y2= ' print. x2 print. '@' print. y2 printCR. |
|
8512 |
]. |
|
8513 |
gc displayLineFromX:x y:y toX:x2 y:y2 |
|
8514 |
||
8515 |
"Created: / 6.1.1998 / 20:59:27 / cg" |
|
8516 |
"Modified: / 8.1.1998 / 00:34:23 / cg" |
|
8517 |
! |
|
8518 |
||
440 | 8519 |
_WGraphics_drawMFCharsConvertedSegment:nativeContext |
8520 |
"/ int drawMFCharsConvertedSegment (java.awt.Font sun.awt.FontDescriptor byte[] int int int) |
|
8521 |
UnimplementedNativeMethodSignal raise |
|
8522 |
||
8523 |
"Created: / 12.11.1998 / 19:18:44 / cg" |
|
8524 |
! |
|
8525 |
||
284 | 8526 |
_WGraphics_drawMFCharsSegment:nativeContext |
8527 |
|jFont jFontDescr s gc x y offs len| |
|
8528 |
||
8529 |
gc := self gcForWGraphics:nativeContext. |
|
8530 |
gc realized ifFalse:[^ self]. |
|
8531 |
||
8532 |
jFont := nativeContext argAt:1. |
|
8533 |
jFontDescr := nativeContext argAt:2. |
|
8534 |
s := nativeContext argAt:3. |
|
8535 |
offs := nativeContext argAt:4. |
|
8536 |
len := nativeContext argAt:5. |
|
8537 |
x := nativeContext argAt:6. |
|
8538 |
y := nativeContext argAt:7. |
|
8539 |
||
8540 |
DrawOPTrace ifTrue:[ |
|
8541 |
'drawMFCharsSegment x/y= ' print. x print. '@' print. y print. ' s= ' print. s printCR. |
|
8542 |
]. |
|
8543 |
gc displayString:s from:offs+1 to:offs+len x:x y:y. |
|
8544 |
^ (gc font onDevice:(gc graphicsDevice)) widthOf:s. |
|
8545 |
||
8546 |
"Created: / 6.1.1998 / 21:01:07 / cg" |
|
8547 |
"Modified: / 25.1.1998 / 20:45:55 / cg" |
|
8548 |
! |
|
8549 |
||
8550 |
_WGraphics_drawOval:nativeContext |
|
8551 |
|gc x y w h| |
|
8552 |
||
8553 |
gc := self gcForWGraphics:nativeContext. |
|
8554 |
"/ gc isNil ifTrue:[^ self]. |
|
8555 |
gc realized ifFalse:[^ self]. |
|
8556 |
||
8557 |
x := nativeContext argAt:1. |
|
8558 |
y := nativeContext argAt:2. |
|
8559 |
w := nativeContext argAt:3. |
|
8560 |
h := nativeContext argAt:4. |
|
8561 |
||
337 | 8562 |
DrawOPTrace ifTrue:[ |
285 | 8563 |
'drawOval x/y= ' print. x print. '@' print. y print. |
8564 |
' w/h= ' print. w print. '@' print. h printCR. |
|
8565 |
]. |
|
8566 |
gc displayArcX:x y:y width:w height:h from:0 angle:360. |
|
284 | 8567 |
|
8568 |
"Created: / 8.1.1998 / 00:44:31 / cg" |
|
337 | 8569 |
"Modified: / 9.4.1998 / 22:10:23 / cg" |
284 | 8570 |
! |
8571 |
||
8572 |
_WGraphics_drawPolygon:nativeContext |
|
8573 |
|gc xVector yVector count points| |
|
8574 |
||
8575 |
gc := self gcForWGraphics:nativeContext. |
|
8576 |
"/ gc isNil ifTrue:[^ self]. |
|
8577 |
gc realized ifFalse:[^ self]. |
|
8578 |
||
8579 |
xVector := nativeContext argAt:1. |
|
8580 |
yVector := nativeContext argAt:2. |
|
8581 |
count := nativeContext argAt:3. |
|
8582 |
||
8583 |
DrawOPTrace ifTrue:[ |
|
8584 |
'drawPolgon' printCR. |
|
8585 |
]. |
|
8586 |
||
8587 |
points := (1 to:count) collect:[:i | (xVector at:i) @ (yVector at:i)]. |
|
8588 |
gc displayPolygon:points |
|
8589 |
||
8590 |
"Created: / 8.1.1998 / 00:57:28 / cg" |
|
8591 |
"Modified: / 8.1.1998 / 00:57:49 / cg" |
|
8592 |
! |
|
8593 |
||
440 | 8594 |
_WGraphics_drawPolyline:nativeContext |
8595 |
"/ void drawPolyline (int[] int[] int) |
|
8596 |
UnimplementedNativeMethodSignal raise |
|
8597 |
||
8598 |
"Created: / 12.11.1998 / 19:19:07 / cg" |
|
8599 |
! |
|
8600 |
||
284 | 8601 |
_WGraphics_drawRect:nativeContext |
8602 |
|gc x y w h| |
|
8603 |
||
8604 |
gc := self gcForWGraphics:nativeContext. |
|
8605 |
"/ gc isNil ifTrue:[^ self]. |
|
8606 |
gc realized ifFalse:[^ self]. |
|
8607 |
||
8608 |
x := nativeContext argAt:1. |
|
8609 |
y := nativeContext argAt:2. |
|
8610 |
w := nativeContext argAt:3. |
|
8611 |
h := nativeContext argAt:4. |
|
8612 |
||
8613 |
"/ self halt. |
|
8614 |
"/ self internalError:'breakPoint'. |
|
8615 |
||
8616 |
gc displayRectangleX:x y:y width:w height:h. |
|
8617 |
||
8618 |
"Modified: / 8.1.1998 / 00:34:33 / cg" |
|
8619 |
"Created: / 8.1.1998 / 00:59:05 / cg" |
|
8620 |
! |
|
8621 |
||
8622 |
_WGraphics_drawRoundRect:nativeContext |
|
8623 |
|gc x y w h| |
|
8624 |
||
8625 |
gc := self gcForWGraphics:nativeContext. |
|
8626 |
"/ gc isNil ifTrue:[^ self]. |
|
8627 |
gc realized ifFalse:[^ self]. |
|
8628 |
||
8629 |
x := nativeContext argAt:1. |
|
8630 |
y := nativeContext argAt:2. |
|
8631 |
w := nativeContext argAt:3. |
|
8632 |
h := nativeContext argAt:4. |
|
8633 |
||
8634 |
"/ self halt. |
|
8635 |
"/ self internalError:'breakPoint'. |
|
8636 |
||
8637 |
gc displayRectangleX:x y:y width:w height:h. |
|
8638 |
||
8639 |
"Modified: / 8.1.1998 / 00:34:33 / cg" |
|
8640 |
"Created: / 8.1.1998 / 00:59:26 / cg" |
|
8641 |
! |
|
8642 |
||
440 | 8643 |
_WGraphics_drawSFChars:nativeContext |
8644 |
"/ void drawSFChars (char[] int int int int) |
|
8645 |
UnimplementedNativeMethodSignal raise |
|
8646 |
||
8647 |
"Created: / 12.11.1998 / 19:18:20 / cg" |
|
8648 |
! |
|
8649 |
||
284 | 8650 |
_WGraphics_fillArc:nativeContext |
8651 |
|gc x y w h startAngle endAngle| |
|
8652 |
||
8653 |
gc := self gcForWGraphics:nativeContext. |
|
8654 |
"/ gc isNil ifTrue:[^ self]. |
|
8655 |
gc realized ifFalse:[^ self]. |
|
8656 |
||
8657 |
x := nativeContext argAt:1. |
|
8658 |
y := nativeContext argAt:2. |
|
8659 |
w := nativeContext argAt:3. |
|
8660 |
h := nativeContext argAt:4. |
|
8661 |
startAngle := nativeContext argAt:5. |
|
8662 |
endAngle := nativeContext argAt:6. |
|
8663 |
||
8664 |
DrawOPTrace ifTrue:[ |
|
8665 |
'fillArc x/y= ' print. x print. '@' print. y print. |
|
8666 |
' w/h= ' print. w print. '@' print. h print. |
|
8667 |
' startAngle= ' print. startAngle print. ' endAngle= ' print. endAngle printCR. |
|
8668 |
]. |
|
8669 |
gc fillArcX:x y:y width:w height:h from:startAngle angle:(endAngle - startAngle) |
|
8670 |
||
8671 |
"Created: / 6.1.1998 / 21:11:31 / cg" |
|
8672 |
"Modified: / 8.1.1998 / 00:33:59 / cg" |
|
8673 |
! |
|
8674 |
||
8675 |
_WGraphics_fillOval:nativeContext |
|
8676 |
|gc x y w h| |
|
8677 |
||
8678 |
gc := self gcForWGraphics:nativeContext. |
|
8679 |
"/ gc isNil ifTrue:[^ self]. |
|
8680 |
gc realized ifFalse:[^ self]. |
|
8681 |
||
8682 |
x := nativeContext argAt:1. |
|
8683 |
y := nativeContext argAt:2. |
|
8684 |
w := nativeContext argAt:3. |
|
8685 |
h := nativeContext argAt:4. |
|
8686 |
||
8687 |
DrawOPTrace ifTrue:[ |
|
8688 |
'drawOval x/y= ' print. x print. '@' print. y print. |
|
8689 |
' w/h= ' print. w print. '@' print. h printCR. |
|
8690 |
]. |
|
8691 |
gc fillArcX:x y:y width:w height:h from:0 angle:360 |
|
8692 |
||
8693 |
"Created: / 8.1.1998 / 00:46:00 / cg" |
|
8694 |
"Modified: / 8.1.1998 / 00:46:20 / cg" |
|
8695 |
! |
|
8696 |
||
8697 |
_WGraphics_fillPolygon:nativeContext |
|
8698 |
|gc xVector yVector count points| |
|
8699 |
||
8700 |
gc := self gcForWGraphics:nativeContext. |
|
8701 |
"/ gc isNil ifTrue:[^ self]. |
|
8702 |
gc realized ifFalse:[^ self]. |
|
8703 |
||
8704 |
xVector := nativeContext argAt:1. |
|
8705 |
yVector := nativeContext argAt:2. |
|
8706 |
count := nativeContext argAt:3. |
|
8707 |
||
8708 |
DrawOPTrace ifTrue:[ |
|
8709 |
'fillPolgon' printCR. |
|
8710 |
]. |
|
8711 |
||
8712 |
points := (1 to:count-1) collect:[:i | (xVector at:i) @ (yVector at:i)]. |
|
8713 |
gc fillPolygon:points |
|
8714 |
||
8715 |
"Created: / 8.1.1998 / 00:58:09 / cg" |
|
8716 |
"Modified: / 25.1.1998 / 11:03:19 / cg" |
|
8717 |
! |
|
8718 |
||
8719 |
_WGraphics_fillRect:nativeContext |
|
8720 |
|gc x y w h| |
|
8721 |
||
8722 |
gc := self gcForWGraphics:nativeContext. |
|
8723 |
"/ gc isNil ifTrue:[^ self]. |
|
8724 |
gc realized ifFalse:[^ self]. |
|
8725 |
||
8726 |
x := nativeContext argAt:1. |
|
8727 |
y := nativeContext argAt:2. |
|
8728 |
w := nativeContext argAt:3. |
|
8729 |
h := nativeContext argAt:4. |
|
8730 |
||
8731 |
"/ self halt. |
|
8732 |
"/ self internalError:'breakPoint'. |
|
8733 |
||
8734 |
gc fillRectangleX:x y:y width:w height:h. |
|
8735 |
||
8736 |
"Created: / 15.8.1997 / 15:43:10 / cg" |
|
8737 |
"Modified: / 8.1.1998 / 00:34:33 / cg" |
|
8738 |
! |
|
8739 |
||
8740 |
_WGraphics_fillRoundRect:nativeContext |
|
8741 |
|gc x y w h| |
|
8742 |
||
8743 |
gc := self gcForWGraphics:nativeContext. |
|
8744 |
"/ gc isNil ifTrue:[^ self]. |
|
8745 |
gc realized ifFalse:[^ self]. |
|
8746 |
||
8747 |
x := nativeContext argAt:1. |
|
8748 |
y := nativeContext argAt:2. |
|
8749 |
w := nativeContext argAt:3. |
|
8750 |
h := nativeContext argAt:4. |
|
8751 |
||
8752 |
"/ self halt. |
|
8753 |
"/ self internalError:'breakPoint'. |
|
8754 |
||
8755 |
gc displayRectangleX:x y:y width:w height:h. |
|
8756 |
||
8757 |
"Modified: / 8.1.1998 / 00:34:33 / cg" |
|
8758 |
"Created: / 8.1.1998 / 00:59:36 / cg" |
|
8759 |
! |
|
8760 |
||
8761 |
_WGraphics_getClipBounds:nativeContext |
|
8762 |
|gc rect r x y w h| |
|
8763 |
||
8764 |
gc := self gcForWGraphics:nativeContext. |
|
391 | 8765 |
"/ gc isNil ifTrue:[^ nil]. |
284 | 8766 |
|
8767 |
rect := (Java classForName:'java.awt.Rectangle') basicNew. |
|
8768 |
||
8769 |
(gc isMemberOf:JavaView) ifTrue:[ |
|
391 | 8770 |
"/ r := gc clippingRectangleOrNil. |
8771 |
r := gc getNextUpdateRectangle. |
|
401 | 8772 |
]. |
8773 |
r isNil ifTrue:[ |
|
8774 |
r := gc clippingRectangleOrNil. |
|
8775 |
]. |
|
8776 |
||
8777 |
r isNil ifTrue:[ |
|
391 | 8778 |
x := y := 0. |
8779 |
w := (gc width). |
|
8780 |
h := (gc height). |
|
401 | 8781 |
] ifFalse:[ |
8782 |
x := (r left). |
|
8783 |
y := (r top). |
|
8784 |
w := (r width). |
|
8785 |
h := (r height). |
|
284 | 8786 |
]. |
8787 |
rect instVarNamed:'x' put:x. |
|
8788 |
rect instVarNamed:'y' put:y. |
|
8789 |
rect instVarNamed:'width' put:w. |
|
8790 |
rect instVarNamed:'height' put:h. |
|
8791 |
||
495 | 8792 |
"/ 'WGraphics__getClipBounds ' infoPrint. (x@y extent:w@h) infoPrintCR. |
284 | 8793 |
|
8794 |
^ rect |
|
8795 |
||
8796 |
"Created: / 6.1.1998 / 20:58:07 / cg" |
|
504 | 8797 |
"Modified: / 23.12.1998 / 20:14:09 / cg" |
284 | 8798 |
! |
8799 |
||
8800 |
_WGraphics_imageCreate:nativeContext |
|
8801 |
|jGraphics imgRep| |
|
8802 |
||
8803 |
jGraphics := nativeContext receiver. |
|
8804 |
imgRep := nativeContext argAt:1. |
|
8805 |
||
8806 |
jGraphics instVarNamed:'pData' put:(imgRep instVarNamed:'pData'). |
|
8807 |
"/ self halt. |
|
8808 |
||
8809 |
"Created: / 11.1.1998 / 16:34:30 / cg" |
|
8810 |
"Modified: / 17.1.1998 / 12:37:18 / cg" |
|
8811 |
! |
|
8812 |
||
8813 |
_WGraphics_pSetFont:nativeContext |
|
8814 |
|gc jFont stFont| |
|
8815 |
||
8816 |
gc := self gcForWGraphics:nativeContext. |
|
8817 |
jFont := nativeContext argAt:1. |
|
8818 |
||
8819 |
stFont := jFont instVarNamed:'pData'. |
|
8820 |
(stFont isNil or:[stFont == 0]) ifTrue:[ |
|
8821 |
"/ self halt. |
|
8822 |
] ifFalse:[ |
|
8823 |
gc font:stFont |
|
8824 |
]. |
|
8825 |
||
8826 |
"Created: / 6.1.1998 / 20:56:47 / cg" |
|
8827 |
"Modified: / 15.1.1998 / 12:31:20 / cg" |
|
8828 |
! |
|
8829 |
||
8830 |
_WGraphics_pSetForeground:nativeContext |
|
8831 |
|gc rgb clr| |
|
8832 |
||
8833 |
gc := self gcForWGraphics:nativeContext. |
|
8834 |
||
8835 |
rgb := nativeContext argAt:1. |
|
8836 |
||
8837 |
clr := Color rgbValue:rgb. |
|
504 | 8838 |
gc paint:(clr nearestOn:gc device). |
284 | 8839 |
|
8840 |
"/ self halt. |
|
8841 |
"/ self internalError:'breakPoint'. |
|
8842 |
||
8843 |
"Created: / 6.1.1998 / 20:56:14 / cg" |
|
504 | 8844 |
"Modified: / 23.12.1998 / 20:10:49 / cg" |
284 | 8845 |
! |
8846 |
||
440 | 8847 |
_WGraphics_print:nativeContext |
8848 |
"/ void print (sun.awt.windows.WComponentPeer) |
|
8849 |
UnimplementedNativeMethodSignal raise |
|
8850 |
||
8851 |
"Created: / 12.11.1998 / 19:19:25 / cg" |
|
8852 |
! |
|
8853 |
||
8854 |
_WGraphics_removeClip:nativeContext |
|
8855 |
"/ void removeClip () |
|
8856 |
UnimplementedNativeMethodSignal raise |
|
8857 |
||
8858 |
"Created: / 12.11.1998 / 19:18:05 / cg" |
|
8859 |
! |
|
8860 |
||
284 | 8861 |
_WGraphics_setPaintMode:nativeContext |
8862 |
|gc| |
|
8863 |
||
8864 |
gc := self gcForWGraphics:nativeContext. |
|
8865 |
gc function:#copy. |
|
285 | 8866 |
|
8867 |
true "DrawOPTrace" ifTrue:[ |
|
8868 |
'copyMode' infoPrintCR. |
|
8869 |
]. |
|
284 | 8870 |
|
8871 |
"Created: / 8.1.1998 / 00:33:44 / cg" |
|
285 | 8872 |
"Modified: / 28.1.1998 / 23:25:56 / cg" |
284 | 8873 |
! |
8874 |
||
8875 |
_WGraphics_setXORMode:nativeContext |
|
8876 |
|gc jColor rgb invColor device| |
|
8877 |
||
8878 |
gc := self gcForWGraphics:nativeContext. |
|
8879 |
jColor := nativeContext argAt:1. |
|
8880 |
device := gc graphicsDevice. |
|
285 | 8881 |
|
8882 |
"/ "/ on trueColor systems, use the provided |
|
8883 |
"/ "/ rgb value for inverting. |
|
8884 |
"/ "/ on palette systems, use white ^ black |
|
8885 |
"/ |
|
8886 |
"/ device visualType == #TrueColor ifTrue:[ |
|
8887 |
"/ rgb := jColor instVarNamed:'value'. |
|
8888 |
"/ rgb := rgb bitAnd:16rFFFFFF. |
|
8889 |
"/ rgb == 0 ifTrue:[ |
|
8890 |
"/ rgb := 16rFFFFFF. |
|
8891 |
"/ ]. |
|
8892 |
"/ invColor := rgb |
|
8893 |
"/ ] ifFalse:[ |
|
8894 |
"/ invColor := device blackpixel bitXor:device whitepixel. |
|
8895 |
"/ ]. |
|
8896 |
||
8897 |
invColor := device blackpixel bitXor:device whitepixel. |
|
8898 |
||
8899 |
"/ gc foreground:(Color colorId:invColor) |
|
8900 |
"/ background:device blackColor. |
|
8901 |
device |
|
8902 |
setForeground:invColor background:0 |
|
8903 |
in:gc gcId. |
|
284 | 8904 |
gc function:#xor. |
285 | 8905 |
|
8906 |
true "DrawOPTrace" ifTrue:[ |
|
8907 |
'xorMode' infoPrintCR. |
|
8908 |
]. |
|
284 | 8909 |
|
8910 |
"Created: / 8.1.1998 / 00:36:17 / cg" |
|
285 | 8911 |
"Modified: / 28.1.1998 / 23:45:03 / cg" |
284 | 8912 |
! |
8913 |
||
8914 |
_WLabelPeer_create:nativeContext |
|
8915 |
|jLabelPeer jLabel jFrame frame label |
|
8916 |
lbl| |
|
8917 |
||
8918 |
jLabelPeer := nativeContext receiver. |
|
8919 |
jLabel := jLabelPeer instVarNamed:'target'. |
|
8920 |
||
8921 |
lbl := jLabel instVarNamed:'text'. |
|
8922 |
lbl notNil ifTrue:[ |
|
8923 |
lbl := Java as_ST_String:lbl |
|
8924 |
]. |
|
8925 |
||
8926 |
jFrame := nativeContext argAt:1. |
|
8927 |
frame := jFrame instVarNamed:'pData'. |
|
8928 |
||
8929 |
label := Label in:frame. |
|
8930 |
lbl notNil ifTrue:[ |
|
8931 |
label label:lbl |
|
8932 |
]. |
|
8933 |
self createdWindowsView:label for:jLabelPeer. |
|
8934 |
||
8935 |
WindowCreationTrace == true ifTrue:[ |
|
8936 |
'WLabelPeer_create: ' print. frame print. ' -> ' print. label printNL. |
|
8937 |
]. |
|
8938 |
||
8939 |
"Created: / 7.1.1998 / 21:42:31 / cg" |
|
8940 |
"Modified: / 13.1.1998 / 22:10:47 / cg" |
|
8941 |
! |
|
8942 |
||
8943 |
_WLabelPeer_setAlignment:nativeContext |
|
8944 |
|label alignNr| |
|
8945 |
||
8946 |
alignNr := nativeContext argAt:1. |
|
8947 |
label := self viewForWPeer:nativeContext. |
|
8948 |
label notNil ifTrue:[ |
|
8949 |
]. |
|
8950 |
||
8951 |
"Created: / 7.1.1998 / 21:43:12 / cg" |
|
8952 |
"Modified: / 8.1.1998 / 17:35:29 / cg" |
|
8953 |
! |
|
8954 |
||
8955 |
_WLabelPeer_setText:nativeContext |
|
479 | 8956 |
|label jString str| |
284 | 8957 |
|
8958 |
jString := nativeContext argAt:1. |
|
8959 |
||
8960 |
label := self viewForWPeer:nativeContext. |
|
479 | 8961 |
str := jString. |
8962 |
str notNil ifTrue:[ |
|
8963 |
str := Java as_ST_String:str |
|
8964 |
]. |
|
8965 |
label label:str |
|
284 | 8966 |
|
8967 |
"Created: / 7.1.1998 / 21:43:51 / cg" |
|
479 | 8968 |
"Modified: / 3.12.1998 / 14:59:18 / cg" |
284 | 8969 |
! |
8970 |
||
408 | 8971 |
_WListPeer__addItem:nativeContext |
448 | 8972 |
|jString index1 length selListView m| |
408 | 8973 |
|
8974 |
selListView := self viewForWPeer:nativeContext. |
|
8975 |
||
8976 |
jString := nativeContext argAt:1. |
|
8977 |
index1 := nativeContext argAt:2. |
|
8978 |
length := nativeContext argAt:3. |
|
8979 |
||
448 | 8980 |
(m := selListView model) notNil ifTrue:[ |
8981 |
m list addLast:(Java as_ST_String:jString). |
|
8982 |
m changed:#list. |
|
8983 |
]. |
|
408 | 8984 |
|
8985 |
"Created: / 26.10.1998 / 20:11:30 / cg" |
|
448 | 8986 |
"Modified: / 14.11.1998 / 01:21:03 / cg" |
408 | 8987 |
! |
8988 |
||
284 | 8989 |
_WListPeer_addItem:nativeContext |
410 | 8990 |
|jString index selListView m| |
284 | 8991 |
|
8992 |
selListView := self viewForWPeer:nativeContext. |
|
8993 |
||
8994 |
jString := nativeContext argAt:1. |
|
8995 |
index := nativeContext argAt:2. |
|
8996 |
||
410 | 8997 |
m := selListView model. |
8998 |
m isNil ifTrue:[ |
|
8999 |
Transcript showCR:'JAVA: access to listModel of closed view'. |
|
9000 |
] ifFalse:[ |
|
9001 |
m list addLast:(Java as_ST_String:jString). |
|
9002 |
m changed:#list. |
|
9003 |
] |
|
9004 |
||
284 | 9005 |
"Created: / 24.1.1998 / 21:10:05 / cg" |
410 | 9006 |
"Modified: / 2.11.1998 / 17:12:52 / cg" |
284 | 9007 |
! |
9008 |
||
9009 |
_WListPeer_create:nativeContext |
|
9010 |
|jListPeer jFrame frame selectionInListView| |
|
9011 |
||
9012 |
jListPeer := nativeContext receiver. |
|
9013 |
||
9014 |
jFrame := nativeContext argAt:1. |
|
9015 |
frame := jFrame instVarNamed:'pData'. |
|
9016 |
||
9017 |
selectionInListView := ScrollableView for:SelectionInListView in:frame. |
|
9018 |
selectionInListView action:[:index | jListPeer perform:#'handleListChanged(I)V' with:(index - 1)]. |
|
9019 |
selectionInListView doubleClickAction:[:index | jListPeer perform:#'handleAction(I)V' with:(index - 1)]. |
|
337 | 9020 |
selectionInListView model:(SelectionInList new list:(List new)). |
284 | 9021 |
selectionInListView useIndex:true. |
9022 |
||
9023 |
self createdWindowsView:selectionInListView for:jListPeer. |
|
9024 |
||
9025 |
WindowCreationTrace == true ifTrue:[ |
|
9026 |
'WTextAreaPeer_create: ' print. frame print. ' -> ' print. selectionInListView printNL. |
|
9027 |
]. |
|
9028 |
||
9029 |
"Created: / 24.1.1998 / 19:58:54 / cg" |
|
337 | 9030 |
"Modified: / 9.4.1998 / 22:19:07 / cg" |
9031 |
! |
|
9032 |
||
9033 |
_WListPeer_delItems:nativeContext |
|
494 | 9034 |
|jString index1 index2 selListView model list| |
337 | 9035 |
|
9036 |
selListView := self viewForWPeer:nativeContext. |
|
9037 |
||
494 | 9038 |
index1 := (nativeContext argAt:1) + 1. "/ java indices are 0-based. |
9039 |
index2 := (nativeContext argAt:2) + 1. "/ st indices are 1-based. |
|
9040 |
||
9041 |
model := selListView model. |
|
508 | 9042 |
model isNil ifTrue:[^ self]. |
494 | 9043 |
list := model list. |
9044 |
list size >= index1 ifTrue:[ |
|
9045 |
list removeFromIndex:index1 toIndex:(index2 min:list size). |
|
9046 |
model changed:#list. |
|
9047 |
]. |
|
337 | 9048 |
|
9049 |
"Created: / 9.4.1998 / 22:19:25 / cg" |
|
508 | 9050 |
"Modified: / 30.12.1998 / 20:00:50 / cg" |
284 | 9051 |
! |
9052 |
||
440 | 9053 |
_WListPeer_deselect:nativeContext |
9054 |
"/ void deselect (int) |
|
9055 |
UnimplementedNativeMethodSignal raise |
|
9056 |
||
9057 |
"Created: / 12.11.1998 / 19:15:10 / cg" |
|
9058 |
! |
|
9059 |
||
448 | 9060 |
_WListPeer_getMaxWidth:nativeContext |
9061 |
"/ int getMaxWidth () |
|
9062 |
UnimplementedNativeMethodSignal raise |
|
9063 |
||
9064 |
"Created: / 14.11.1998 / 10:44:29 / cg" |
|
9065 |
! |
|
9066 |
||
284 | 9067 |
_WListPeer_isSelected:nativeContext |
9068 |
|selectionInListView index model| |
|
9069 |
||
9070 |
selectionInListView := self viewForWPeer:nativeContext. |
|
9071 |
||
9072 |
index := nativeContext argAt:1. |
|
9073 |
(model := selectionInListView model) notNil ifTrue:[ |
|
9074 |
(model selectionIndex == (index + 1)) "/ JAVA indexing starts at 0 |
|
9075 |
ifTrue:[ |
|
9076 |
^ 1 |
|
9077 |
] |
|
9078 |
]. |
|
9079 |
^ 0. |
|
9080 |
||
9081 |
"Created: / 24.1.1998 / 22:42:31 / cg" |
|
9082 |
"Modified: / 25.1.1998 / 01:35:32 / cg" |
|
9083 |
! |
|
9084 |
||
396 | 9085 |
_WListPeer_makeVisible:nativeContext |
9086 |
|selectionInListView lineNr| |
|
9087 |
||
9088 |
selectionInListView := self viewForWPeer:nativeContext. |
|
9089 |
||
9090 |
lineNr := nativeContext argAt:1. |
|
9091 |
||
9092 |
selectionInListView makeLineVisible:(lineNr + 1) |
|
9093 |
||
9094 |
"Modified: / 24.1.1998 / 20:01:06 / cg" |
|
9095 |
"Created: / 20.10.1998 / 14:14:50 / cg" |
|
9096 |
! |
|
9097 |
||
284 | 9098 |
_WListPeer_select:nativeContext |
9099 |
|selectionInListView index model| |
|
9100 |
||
9101 |
selectionInListView := self viewForWPeer:nativeContext. |
|
9102 |
||
9103 |
index := nativeContext argAt:1. |
|
9104 |
(model := selectionInListView model) notNil ifTrue:[ |
|
9105 |
model selectionIndex:(index + 1). "/ JAVA indexing starts at 0 |
|
9106 |
] |
|
9107 |
||
9108 |
"Created: / 24.1.1998 / 22:32:35 / cg" |
|
9109 |
"Modified: / 25.1.1998 / 01:28:46 / cg" |
|
9110 |
! |
|
9111 |
||
9112 |
_WListPeer_setMultipleSelections:nativeContext |
|
9113 |
|selectionInListView onOff| |
|
9114 |
||
9115 |
selectionInListView := self viewForWPeer:nativeContext. |
|
9116 |
||
9117 |
onOff := (nativeContext argAt:1) ~~ 0. |
|
9118 |
||
9119 |
selectionInListView multipleSelectOk:onOff. |
|
9120 |
||
9121 |
"Modified: / 24.1.1998 / 20:01:06 / cg" |
|
9122 |
! |
|
9123 |
||
408 | 9124 |
_WListPeer_updateMaxItemWidth:nativeContext |
9125 |
|selectionInListView lineNr| |
|
9126 |
||
9127 |
selectionInListView := self viewForWPeer:nativeContext. |
|
9128 |
||
9129 |
"Created: / 26.10.1998 / 20:09:46 / cg" |
|
9130 |
! |
|
9131 |
||
440 | 9132 |
_WMenuBarPeer_addMenu:nativeContext |
9133 |
"/ void addMenu (java.awt.Menu) |
|
9134 |
UnimplementedNativeMethodSignal raise |
|
9135 |
||
9136 |
"Created: / 12.11.1998 / 19:14:00 / cg" |
|
9137 |
! |
|
9138 |
||
284 | 9139 |
_WMenuBarPeer_create:nativeContext |
9140 |
|jMenuBarPeer jMenuBar jFrame frame menuBar| |
|
9141 |
||
9142 |
jMenuBarPeer := nativeContext receiver. |
|
9143 |
jMenuBar := jMenuBarPeer instVarNamed:'target'. |
|
9144 |
||
9145 |
jFrame := nativeContext argAt:1. |
|
9146 |
frame := jFrame instVarNamed:'pData'. |
|
9147 |
||
9148 |
menuBar := MenuPanel in:frame. |
|
9149 |
menuBar verticalLayout:false. |
|
9150 |
menuBar realize. |
|
9151 |
||
9152 |
self createdWindowsView:menuBar for:jMenuBarPeer. |
|
9153 |
||
9154 |
WindowCreationTrace == true ifTrue:[ |
|
9155 |
'WMenuBarPeer_create: ' print. frame print. ' -> ' print. menuBar printNL. |
|
9156 |
]. |
|
9157 |
||
9158 |
"Created: / 7.1.1998 / 21:38:31 / cg" |
|
9159 |
"Modified: / 25.1.1998 / 13:19:03 / cg" |
|
9160 |
! |
|
9161 |
||
440 | 9162 |
_WMenuBarPeer_delMenu:nativeContext |
9163 |
"/ void delMenu (int) |
|
9164 |
UnimplementedNativeMethodSignal raise |
|
9165 |
||
9166 |
"Created: / 12.11.1998 / 19:14:11 / cg" |
|
9167 |
! |
|
9168 |
||
325 | 9169 |
_WMenuItemPeer__dispose:nativeContext |
9170 |
|jMenuItemPeer item| |
|
9171 |
||
9172 |
jMenuItemPeer := nativeContext receiver. |
|
9173 |
item := jMenuItemPeer instVarNamed:'pData'. |
|
9174 |
||
9175 |
"/ what should be done here ? |
|
9176 |
||
9177 |
"Created: / 29.3.1998 / 17:16:05 / cg" |
|
9178 |
"Modified: / 29.3.1998 / 17:16:35 / cg" |
|
9179 |
! |
|
9180 |
||
440 | 9181 |
_WMenuItemPeer__setLabel:nativeContext |
9182 |
"/ void _setLabel (java.lang.String) |
|
495 | 9183 |
|
9184 |
|jMenuItemPeer item label| |
|
9185 |
||
9186 |
jMenuItemPeer := nativeContext receiver. |
|
9187 |
item := jMenuItemPeer instVarNamed:'pData'. |
|
9188 |
(item isNil or:[item == 0]) ifTrue:[ |
|
9189 |
'JAVA [warning]: NULL menu item in setLabel' infoPrintCR. |
|
9190 |
^ self |
|
9191 |
]. |
|
9192 |
||
9193 |
label := nativeContext argAt:1. |
|
9194 |
label isNil ifTrue:[ |
|
9195 |
label := '' |
|
9196 |
] ifFalse:[ |
|
9197 |
label := Java as_ST_String:label |
|
9198 |
]. |
|
9199 |
item label:label. |
|
9200 |
||
9201 |
"Modified: / 11.12.1998 / 16:40:18 / cg" |
|
440 | 9202 |
! |
9203 |
||
284 | 9204 |
_WMenuItemPeer_create:nativeContext |
9205 |
|jMenuItemPeer jMenuItem jMenuPeer menu item lbl| |
|
9206 |
||
9207 |
jMenuItemPeer := nativeContext receiver. |
|
9208 |
jMenuItem := jMenuItemPeer instVarNamed:'target'. |
|
9209 |
||
9210 |
jMenuPeer := nativeContext argAt:1. |
|
9211 |
menu := jMenuPeer instVarNamed:'pData'. |
|
480 | 9212 |
(menu isNil or:[menu == 0]) ifTrue:[ |
9213 |
'JAVA: no menu to create item in' infoPrintCR. |
|
9214 |
^ self |
|
9215 |
]. |
|
284 | 9216 |
item := menu createAtIndex:nil. |
325 | 9217 |
item value:[ |
9218 |
jMenuItemPeer perform:#'handleAction(I)V' with:0 |
|
9219 |
]. |
|
284 | 9220 |
|
9221 |
lbl := jMenuItem instVarNamed:'label'. |
|
9222 |
lbl notNil ifTrue:[ |
|
325 | 9223 |
lbl := Java as_ST_String:lbl. |
9224 |
item label:lbl |
|
284 | 9225 |
]. |
9226 |
||
9227 |
jMenuItemPeer instVarNamed:'pData' put:item. |
|
9228 |
||
9229 |
WindowOPTrace == true ifTrue:[ |
|
325 | 9230 |
'WMenuItem_create: ' print. menu print. ' -> ' print. item printNL. |
284 | 9231 |
]. |
9232 |
||
9233 |
"Created: / 7.1.1998 / 21:40:44 / cg" |
|
480 | 9234 |
"Modified: / 3.12.1998 / 20:43:20 / cg" |
284 | 9235 |
! |
9236 |
||
9237 |
_WMenuItemPeer_enable:nativeContext |
|
9238 |
|jMenuItemPeer item state| |
|
9239 |
||
9240 |
jMenuItemPeer := nativeContext receiver. |
|
9241 |
item := jMenuItemPeer instVarNamed:'pData'. |
|
480 | 9242 |
(item isNil or:[item == 0]) ifTrue:[ |
495 | 9243 |
'JAVA [warning]: NULL menu item in enable' infoPrintCR. |
480 | 9244 |
^ self |
9245 |
]. |
|
284 | 9246 |
|
9247 |
state := nativeContext argAt:1. |
|
495 | 9248 |
item enabled:(state ~~ 0) |
284 | 9249 |
|
9250 |
"Created: / 7.1.1998 / 22:41:38 / cg" |
|
495 | 9251 |
"Modified: / 11.12.1998 / 16:40:26 / cg" |
284 | 9252 |
! |
9253 |
||
440 | 9254 |
_WMenuPeer_addSeparator:nativeContext |
9255 |
"/ void addSeparator () |
|
9256 |
UnimplementedNativeMethodSignal raise |
|
9257 |
||
9258 |
"Created: / 12.11.1998 / 19:13:14 / cg" |
|
9259 |
! |
|
9260 |
||
284 | 9261 |
_WMenuPeer_createMenu:nativeContext |
9262 |
|jMenuPeer jMenu jMenuBarPeer menuPanel menu |
|
9263 |
lbl item| |
|
9264 |
||
9265 |
jMenuPeer := nativeContext receiver. |
|
9266 |
jMenu := jMenuPeer instVarNamed:'target'. |
|
9267 |
||
9268 |
jMenuBarPeer := nativeContext argAt:1. |
|
9269 |
menuPanel := jMenuBarPeer instVarNamed:'pData'. |
|
9270 |
||
9271 |
item := menuPanel createAtIndex:nil. |
|
9272 |
lbl := jMenu instVarNamed:'label'. |
|
9273 |
lbl notNil ifTrue:[ |
|
9274 |
lbl := Java as_ST_String:lbl. |
|
9275 |
item label:lbl |
|
9276 |
]. |
|
9277 |
||
9278 |
menu := MenuPanel new. |
|
9279 |
item submenu:menu. |
|
9280 |
||
9281 |
jMenuPeer instVarNamed:'pData' put:menu. |
|
9282 |
||
9283 |
'createMenuPeer: ' print. menuPanel print. ' -> ' print. menu printNL. |
|
9284 |
||
9285 |
"Created: / 7.1.1998 / 21:39:50 / cg" |
|
9286 |
"Modified: / 13.1.1998 / 22:11:09 / cg" |
|
9287 |
! |
|
9288 |
||
440 | 9289 |
_WMenuPeer_createSubMenu:nativeContext |
9290 |
"/ void createSubMenu (sun.awt.windows.WMenuPeer) |
|
482 | 9291 |
"/ UnimplementedNativeMethodSignal raise |
440 | 9292 |
|
9293 |
"Created: / 12.11.1998 / 19:13:43 / cg" |
|
482 | 9294 |
"Modified: / 3.12.1998 / 21:41:07 / cg" |
440 | 9295 |
! |
9296 |
||
9297 |
_WMenuPeer_delItem:nativeContext |
|
9298 |
"/ void delItem (int) |
|
493 | 9299 |
|jMenuPeer jMenu menuPanel itemIndex| |
9300 |
||
9301 |
jMenuPeer := nativeContext receiver. |
|
9302 |
menuPanel := jMenuPeer instVarNamed:'pData'. |
|
9303 |
||
9304 |
itemIndex := nativeContext argAt:1. |
|
9305 |
menuPanel remove:itemIndex. |
|
9306 |
||
9307 |
"/ UnimplementedNativeMethodSignal raise |
|
440 | 9308 |
|
9309 |
"Created: / 12.11.1998 / 19:13:30 / cg" |
|
493 | 9310 |
"Modified: / 10.12.1998 / 21:12:29 / cg" |
440 | 9311 |
! |
9312 |
||
9313 |
_WPopupMenuPeer__show:nativeContext |
|
9314 |
"/ void _show (java.awt.Event) |
|
9315 |
UnimplementedNativeMethodSignal raise |
|
9316 |
||
9317 |
"Created: / 12.11.1998 / 19:12:53 / cg" |
|
9318 |
! |
|
9319 |
||
9320 |
_WPopupMenuPeer_createMenu:nativeContext |
|
9321 |
"/ void createMenu (sun.awt.windows.WComponentPeer) |
|
9322 |
UnimplementedNativeMethodSignal raise |
|
9323 |
||
9324 |
"Created: / 12.11.1998 / 19:12:43 / cg" |
|
9325 |
! |
|
9326 |
||
9327 |
_WPrintJob_end:nativeContext |
|
9328 |
"/ void end () |
|
9329 |
UnimplementedNativeMethodSignal raise |
|
9330 |
||
9331 |
"Created: / 12.11.1998 / 19:11:28 / cg" |
|
9332 |
! |
|
9333 |
||
334 | 9334 |
_WScrollPanePeer__getHScrollbarHeight:nativeContext |
9335 |
|scrollPane| |
|
9336 |
||
9337 |
scrollPane := self viewForWPeer:nativeContext. |
|
339 | 9338 |
^ HorizontalScrollBar new preferredExtent y. |
9339 |
||
334 | 9340 |
"Created: / 9.4.1998 / 17:30:56 / cg" |
339 | 9341 |
"Modified: / 10.4.1998 / 14:59:28 / cg" |
341 | 9342 |
! |
334 | 9343 |
|
9344 |
_WScrollPanePeer__getVScrollbarWidth:nativeContext |
|
9345 |
|scrollPane| |
|
9346 |
||
9347 |
scrollPane := self viewForWPeer:nativeContext. |
|
339 | 9348 |
^ ScrollBar new preferredExtent x. |
334 | 9349 |
|
9350 |
"Created: / 9.4.1998 / 17:29:48 / cg" |
|
339 | 9351 |
"Modified: / 10.4.1998 / 15:00:33 / cg" |
334 | 9352 |
! |
9353 |
||
9354 |
_WScrollPanePeer_create:nativeContext |
|
9355 |
|jScrollPanePeer jScrollPane jFrame frame scrollPane |
|
9356 |
lbl| |
|
9357 |
||
9358 |
jScrollPanePeer := nativeContext receiver. |
|
9359 |
jScrollPane := jScrollPanePeer instVarNamed:'target'. |
|
9360 |
||
9361 |
jFrame := nativeContext argAt:1. |
|
9362 |
frame := jFrame instVarNamed:'pData'. |
|
9363 |
||
9364 |
"/ create with a simple view ... |
|
337 | 9365 |
scrollPane := ScrollableView for:JavaView in:frame. |
334 | 9366 |
|
9367 |
self createdWindowsView:scrollPane for:jScrollPanePeer. |
|
9368 |
||
9369 |
WindowCreationTrace == true ifTrue:[ |
|
9370 |
'WScrollPanePeer_create: ' print. frame print. ' -> ' print. scrollPane printNL. |
|
9371 |
]. |
|
9372 |
||
9373 |
"Created: / 9.4.1998 / 17:25:08 / cg" |
|
337 | 9374 |
"Modified: / 9.4.1998 / 22:06:09 / cg" |
334 | 9375 |
! |
9376 |
||
440 | 9377 |
_WScrollPanePeer_getOffset:nativeContext |
9378 |
"/ int getOffset (int) |
|
9379 |
UnimplementedNativeMethodSignal raise |
|
9380 |
||
9381 |
"Created: / 12.11.1998 / 19:16:29 / cg" |
|
9382 |
! |
|
9383 |
||
9384 |
_WScrollPanePeer_getScrollChild:nativeContext |
|
9385 |
"/ java.awt.Component getScrollChild () |
|
9386 |
UnimplementedNativeMethodSignal raise |
|
9387 |
||
9388 |
"Created: / 12.11.1998 / 19:17:00 / cg" |
|
9389 |
! |
|
9390 |
||
334 | 9391 |
_WScrollPanePeer_setInsets:nativeContext |
9392 |
||
9393 |
"Modified: / 9.4.1998 / 17:26:11 / cg" |
|
9394 |
"Created: / 9.4.1998 / 17:29:10 / cg" |
|
9395 |
! |
|
9396 |
||
440 | 9397 |
_WScrollPanePeer_setScrollPosition:nativeContext |
9398 |
"/ void setScrollPosition (int int) |
|
9399 |
UnimplementedNativeMethodSignal raise |
|
9400 |
||
9401 |
"Created: / 12.11.1998 / 19:16:44 / cg" |
|
9402 |
! |
|
9403 |
||
334 | 9404 |
_WScrollPanePeer_setSpans:nativeContext |
9405 |
||
9406 |
"Created: / 9.4.1998 / 17:31:44 / cg" |
|
9407 |
! |
|
9408 |
||
284 | 9409 |
_WScrollbarPeer__setValues:nativeContext |
9410 |
|scrollBar value visibleAmount min max| |
|
9411 |
||
9412 |
scrollBar := self viewForWPeer:nativeContext. |
|
9413 |
||
9414 |
value := nativeContext argAt:1. |
|
9415 |
visibleAmount := nativeContext argAt:2. |
|
9416 |
min := nativeContext argAt:3. |
|
9417 |
max := nativeContext argAt:4. |
|
9418 |
||
374 | 9419 |
(min ~~ 0 or:[max ~~ 100]) ifTrue:[ |
284 | 9420 |
scrollBar thumb start:min stop:max. |
9421 |
]. |
|
9422 |
||
9423 |
scrollBar thumbOrigin:value thumbHeight:visibleAmount. |
|
9424 |
||
9425 |
"Created: / 13.1.1998 / 22:13:57 / cg" |
|
374 | 9426 |
"Modified: / 14.10.1998 / 14:53:00 / cg" |
284 | 9427 |
! |
9428 |
||
9429 |
_WScrollbarPeer_create:nativeContext |
|
9430 |
|jScrollbarPeer jScrollbar jFrame frame scrollBar |
|
334 | 9431 |
min max| |
284 | 9432 |
|
9433 |
jScrollbarPeer := nativeContext receiver. |
|
9434 |
jScrollbar := jScrollbarPeer instVarNamed:'target'. |
|
9435 |
||
9436 |
jFrame := nativeContext argAt:1. |
|
9437 |
frame := jFrame instVarNamed:'pData'. |
|
9438 |
||
9439 |
(jScrollbar instVarNamed:'orientation') == 0 "HORIZONTAL" ifTrue:[ |
|
9440 |
scrollBar := HorizontalScrollBar in:frame. |
|
9441 |
] ifFalse:[ |
|
9442 |
scrollBar := ScrollBar in:frame. |
|
9443 |
]. |
|
9444 |
min := jScrollbar instVarNamed:'minimum'. |
|
9445 |
max := jScrollbar instVarNamed:'maximum'. |
|
9446 |
||
374 | 9447 |
scrollBar scrollDownAction:[ |
9448 |
scrollBar thumbOrigin:(scrollBar thumbOrigin + ((max-min)/10) min:max). |
|
9449 |
jScrollbarPeer perform:#'dragAbsolute(I)V' with:scrollBar thumbOrigin rounded. |
|
9450 |
]. |
|
9451 |
scrollBar scrollUpAction:[ |
|
9452 |
scrollBar thumbOrigin:(scrollBar thumbOrigin - ((max-min)/10) max:min). |
|
9453 |
jScrollbarPeer perform:#'dragAbsolute(I)V' with:scrollBar thumbOrigin rounded. |
|
9454 |
]. |
|
9455 |
scrollBar scrollAction:[:org | |
|
9456 |
jScrollbarPeer perform:#'dragAbsolute(I)V' with:org rounded. |
|
9457 |
]. |
|
284 | 9458 |
self createdWindowsView:scrollBar for:jScrollbarPeer. |
9459 |
||
9460 |
WindowCreationTrace == true ifTrue:[ |
|
9461 |
'WScrollbarPeer_create: ' print. frame print. ' -> ' print. scrollBar printNL. |
|
9462 |
]. |
|
9463 |
||
9464 |
"Created: / 5.1.1998 / 01:53:30 / cg" |
|
374 | 9465 |
"Modified: / 14.10.1998 / 15:36:19 / cg" |
284 | 9466 |
! |
9467 |
||
9468 |
_WScrollbarPeer_setLineIncrement:nativeContext |
|
9469 |
|scrollBar inc| |
|
9470 |
||
374 | 9471 |
Transcript showCR:'JavaVM: WScrollbarPeer_setLineIncrement unimplemented'. |
9472 |
||
284 | 9473 |
scrollBar := self viewForWPeer:nativeContext. |
9474 |
||
9475 |
inc := nativeContext argAt:1. |
|
9476 |
"/ scrollBar thumb lineIncrement:inc. |
|
9477 |
||
9478 |
"Created: / 25.1.1998 / 11:52:19 / cg" |
|
374 | 9479 |
"Modified: / 14.10.1998 / 14:53:56 / cg" |
284 | 9480 |
! |
9481 |
||
9482 |
_WScrollbarPeer_setPageIncrement:nativeContext |
|
9483 |
|scrollBar inc| |
|
9484 |
||
374 | 9485 |
Transcript showCR:'JavaVM: WScrollbarPeer_setPageIncrement unimplemented'. |
9486 |
||
284 | 9487 |
scrollBar := self viewForWPeer:nativeContext. |
9488 |
||
9489 |
inc := nativeContext argAt:1. |
|
9490 |
"/ scrollBar thumb pageIncrement:inc. |
|
9491 |
||
9492 |
"Created: / 25.1.1998 / 11:52:01 / cg" |
|
374 | 9493 |
"Modified: / 14.10.1998 / 14:54:04 / cg" |
284 | 9494 |
! |
9495 |
||
9496 |
_WTextAreaPeer_create:nativeContext |
|
9497 |
|jTextAreaPeer jFrame frame editTextView| |
|
9498 |
||
9499 |
jTextAreaPeer := nativeContext receiver. |
|
9500 |
||
9501 |
jFrame := nativeContext argAt:1. |
|
9502 |
frame := jFrame instVarNamed:'pData'. |
|
9503 |
||
9504 |
editTextView := HVScrollableView for:EditTextView in:frame. |
|
9505 |
||
9506 |
self createdWindowsView:editTextView for:jTextAreaPeer. |
|
9507 |
||
9508 |
WindowCreationTrace == true ifTrue:[ |
|
9509 |
'WTextAreaPeer_create: ' print. frame print. ' -> ' print. editTextView printNL. |
|
9510 |
]. |
|
9511 |
||
9512 |
"Created: / 7.1.1998 / 21:49:49 / cg" |
|
9513 |
"Modified: / 15.1.1998 / 12:56:18 / cg" |
|
9514 |
! |
|
9515 |
||
9516 |
_WTextAreaPeer_insertText:nativeContext |
|
9517 |
|textView pos string jstring| |
|
9518 |
||
9519 |
textView := self viewForWPeer:nativeContext. |
|
329 | 9520 |
(textView isKindOf:ScrollableView) ifTrue:[ |
9521 |
textView := textView scrolledView |
|
9522 |
]. |
|
284 | 9523 |
|
9524 |
jstring := nativeContext argAt:1. |
|
9525 |
string := Java as_ST_String:jstring. |
|
9526 |
pos := nativeContext argAt:2. |
|
9527 |
||
9528 |
textView insert:string at:pos. |
|
329 | 9529 |
textView cursorToCharacterPosition:pos + string size. |
9530 |
textView makeCursorVisible. |
|
9531 |
"/ textView invalidateRepairNow:true. |
|
284 | 9532 |
^ nil |
9533 |
||
9534 |
"Created: / 7.1.1998 / 21:50:23 / cg" |
|
329 | 9535 |
"Modified: / 5.4.1998 / 17:37:24 / cg" |
284 | 9536 |
! |
9537 |
||
440 | 9538 |
_WTextAreaPeer_replaceText:nativeContext |
9539 |
"/ void replaceText (java.lang.String int int) |
|
9540 |
UnimplementedNativeMethodSignal raise |
|
9541 |
||
9542 |
"Created: / 12.11.1998 / 19:11:14 / cg" |
|
9543 |
! |
|
9544 |
||
284 | 9545 |
_WTextComponentPeer_enableEditing:nativeContext |
9546 |
|textView enabled| |
|
9547 |
||
9548 |
textView := self viewForWPeer:nativeContext. |
|
9549 |
enabled := (nativeContext argAt:1) ~~ 0. |
|
9550 |
||
9551 |
^ textView readOnly:enabled not |
|
9552 |
||
9553 |
"Created: / 5.1.1998 / 01:29:38 / cg" |
|
9554 |
"Modified: / 25.1.1998 / 16:29:56 / cg" |
|
9555 |
! |
|
9556 |
||
9557 |
_WTextComponentPeer_getSelectionEnd:nativeContext |
|
9558 |
|textView| |
|
9559 |
||
9560 |
textView := self viewForWPeer:nativeContext. |
|
9561 |
||
9562 |
^ textView characterPositionOfSelectionEnd |
|
9563 |
||
9564 |
"Created: / 8.1.1998 / 17:41:56 / cg" |
|
9565 |
"Modified: / 15.1.1998 / 15:47:18 / cg" |
|
9566 |
! |
|
9567 |
||
9568 |
_WTextComponentPeer_getSelectionStart:nativeContext |
|
9569 |
|textView| |
|
9570 |
||
9571 |
textView := self viewForWPeer:nativeContext. |
|
9572 |
||
9573 |
^ textView characterPositionOfSelection - 1 |
|
9574 |
||
9575 |
"Created: / 15.8.1997 / 15:45:45 / cg" |
|
9576 |
"Modified: / 15.1.1998 / 15:46:51 / cg" |
|
9577 |
! |
|
9578 |
||
9579 |
_WTextComponentPeer_getText:nativeContext |
|
9580 |
|textView string jString| |
|
9581 |
||
9582 |
textView := self viewForWPeer:nativeContext. |
|
9583 |
||
9584 |
string := textView contents asString. |
|
9585 |
jString := Java as_String:string. |
|
9586 |
^ jString |
|
9587 |
||
9588 |
"Created: / 6.1.1998 / 21:05:15 / cg" |
|
9589 |
"Modified: / 8.1.1998 / 17:36:52 / cg" |
|
9590 |
! |
|
9591 |
||
9592 |
_WTextComponentPeer_select:nativeContext |
|
9593 |
|textView selStart selEnd| |
|
9594 |
||
9595 |
textView := self viewForWPeer:nativeContext. |
|
9596 |
selStart := nativeContext argAt:1. |
|
9597 |
selEnd := nativeContext argAt:2. |
|
9598 |
||
9599 |
selStart == selEnd ifTrue:[ |
|
9600 |
"/ clear selection |
|
9601 |
textView unselect. |
|
9602 |
"/ and set caret |
|
9603 |
textView cursorToCharacterPosition:selStart + 1 |
|
9604 |
] ifFalse:[ |
|
9605 |
"/ change selection |
|
9606 |
textView selectFromCharacterPosition:selStart+1 to:selEnd |
|
9607 |
]. |
|
9608 |
||
9609 |
"Created: / 15.8.1997 / 15:45:58 / cg" |
|
9610 |
"Modified: / 15.1.1998 / 21:55:57 / cg" |
|
9611 |
! |
|
9612 |
||
9613 |
_WTextComponentPeer_setText:nativeContext |
|
9614 |
|textView string jstring| |
|
9615 |
||
9616 |
textView := self viewForWPeer:nativeContext. |
|
9617 |
||
9618 |
jstring := nativeContext argAt:1. |
|
494 | 9619 |
string := jstring notNil ifTrue:[Java as_ST_String:jstring] ifFalse:[nil]. |
284 | 9620 |
|
9621 |
textView contents:string. |
|
9622 |
||
9623 |
"Created: / 5.1.1998 / 01:28:23 / cg" |
|
494 | 9624 |
"Modified: / 11.12.1998 / 12:16:46 / cg" |
284 | 9625 |
! |
9626 |
||
9627 |
_WTextFieldPeer_create:nativeContext |
|
9628 |
|jTextFieldPeer jFrame frame editField| |
|
9629 |
||
9630 |
jTextFieldPeer := nativeContext receiver. |
|
9631 |
||
9632 |
jFrame := nativeContext argAt:1. |
|
9633 |
frame := jFrame instVarNamed:'pData'. |
|
9634 |
||
9635 |
editField := EditField in:frame. |
|
9636 |
||
9637 |
self createdWindowsView:editField for:jTextFieldPeer. |
|
9638 |
||
9639 |
editField crAction:[ |
|
419 | 9640 |
jTextFieldPeer perform:#handleAction. |
284 | 9641 |
]. |
9642 |
WindowCreationTrace == true ifTrue:[ |
|
9643 |
'WTextFieldPeer_create: ' print. frame print. ' -> ' print. editField printNL. |
|
9644 |
]. |
|
9645 |
||
9646 |
"Created: / 5.1.1998 / 01:27:37 / cg" |
|
419 | 9647 |
"Modified: / 4.11.1998 / 21:07:30 / cg" |
284 | 9648 |
! |
9649 |
||
9650 |
_WTextFieldPeer_setEchoCharacter:nativeContext |
|
9651 |
|editField char| |
|
9652 |
||
9653 |
editField := self viewForWPeer:nativeContext. |
|
9654 |
||
9655 |
char := nativeContext argAt:1. |
|
9656 |
editField passwordCharacter:(Character value:char). |
|
9657 |
||
9658 |
"Created: / 25.1.1998 / 16:28:30 / cg" |
|
9659 |
! |
|
9660 |
||
440 | 9661 |
_WToolkit_beep:nativeContext |
9662 |
"/ void beep () |
|
494 | 9663 |
|
9664 |
Screen current beep |
|
440 | 9665 |
|
9666 |
"Created: / 12.11.1998 / 19:09:23 / cg" |
|
494 | 9667 |
"Modified: / 11.12.1998 / 12:15:23 / cg" |
440 | 9668 |
! |
9669 |
||
284 | 9670 |
_WToolkit_eventLoop:nativeContext |
526 | 9671 |
(JavaEventThread notNil and:[JavaEventThread isDead not]) ifTrue:[ |
9672 |
'JavaVM [warning]: oops - two threads executing eventLoop' errorPrintCR. |
|
9673 |
]. |
|
9674 |
||
284 | 9675 |
JavaEventThread := Processor activeProcess. |
9676 |
[ |
|
526 | 9677 |
[true] whileTrue:[ |
9678 |
AbortSignal handle:[:ex | |
|
9679 |
ex return |
|
9680 |
] do:[ |
|
9681 |
self doWindowsEventThread. |
|
9682 |
] |
|
9683 |
]. |
|
284 | 9684 |
] valueNowOrOnUnwindDo:[ |
526 | 9685 |
JavaEventThread := nil. |
284 | 9686 |
]. |
9687 |
||
9688 |
"Created: / 6.1.1998 / 21:01:44 / cg" |
|
526 | 9689 |
"Modified: / 8.1.1999 / 17:08:00 / cg" |
284 | 9690 |
! |
9691 |
||
405 | 9692 |
_WToolkit_getComboHeightOffset:nativeContext |
9693 |
^ 0 |
|
9694 |
||
9695 |
"Modified: / 20.3.1997 / 13:50:04 / cg" |
|
9696 |
"Created: / 22.10.1998 / 00:59:14 / cg" |
|
9697 |
! |
|
9698 |
||
284 | 9699 |
_WToolkit_getScreenHeight:nativeContext |
9700 |
^ Screen current height |
|
9701 |
||
9702 |
"Modified: / 20.3.1997 / 13:50:04 / cg" |
|
9703 |
"Created: / 13.1.1998 / 09:24:45 / cg" |
|
9704 |
! |
|
9705 |
||
9706 |
_WToolkit_getScreenResolution:nativeContext |
|
9707 |
^ Screen current resolution x rounded |
|
9708 |
||
9709 |
"Modified: / 20.3.1997 / 13:50:04 / cg" |
|
9710 |
"Created: / 17.1.1998 / 21:54:48 / cg" |
|
9711 |
! |
|
9712 |
||
9713 |
_WToolkit_getScreenWidth:nativeContext |
|
9714 |
^ Screen current width |
|
9715 |
||
9716 |
"Modified: / 20.3.1997 / 13:50:04 / cg" |
|
9717 |
"Created: / 13.1.1998 / 09:24:37 / cg" |
|
9718 |
! |
|
9719 |
||
9720 |
_WToolkit_init:nativeContext |
|
9721 |
||
9722 |
"Created: / 3.1.1998 / 02:30:57 / cg" |
|
9723 |
! |
|
9724 |
||
9725 |
_WToolkit_loadSystemColors:nativeContext |
|
9726 |
"/ self halt. |
|
9727 |
||
9728 |
"Modified: / 18.3.1997 / 18:43:26 / cg" |
|
9729 |
"Created: / 5.1.1998 / 02:19:09 / cg" |
|
9730 |
! |
|
9731 |
||
440 | 9732 |
_WToolkit_makeColorModel:nativeContext |
9733 |
"/ java.awt.image.ColorModel makeColorModel () |
|
9734 |
UnimplementedNativeMethodSignal raise |
|
9735 |
||
9736 |
"Created: / 12.11.1998 / 19:08:47 / cg" |
|
9737 |
! |
|
9738 |
||
9739 |
_WToolkit_sync:nativeContext |
|
9740 |
"/ void sync () |
|
9741 |
UnimplementedNativeMethodSignal raise |
|
9742 |
||
9743 |
"Created: / 12.11.1998 / 19:09:14 / cg" |
|
9744 |
! |
|
9745 |
||
284 | 9746 |
_WWindowPeer__setResizable:nativeContext |
9747 |
|view onOff| |
|
9748 |
||
9749 |
view := self viewForWPeer:nativeContext. |
|
9750 |
||
9751 |
onOff := (nativeContext argAt:1) == 1. |
|
9752 |
view isTopView ifTrue:[ |
|
9753 |
onOff ifTrue:[ |
|
9754 |
view minExtent:10@10. |
|
9755 |
view maxExtent:(Screen current extent). |
|
9756 |
] ifFalse:[ |
|
9757 |
view minExtent:view extent. |
|
9758 |
view maxExtent:view extent. |
|
9759 |
] |
|
9760 |
] ifFalse:[ |
|
9761 |
(view isMemberOf:JavaEmbeddedFrameView) ifFalse:[ |
|
9762 |
self halt. |
|
9763 |
] |
|
9764 |
]. |
|
9765 |
||
9766 |
"/ 'JAVA: WWindowPeer_setResizable: ' print. view print. ' yes/no: ' print. onOff printNL. |
|
9767 |
||
9768 |
^ nil |
|
9769 |
||
9770 |
"Created: / 5.1.1998 / 00:57:59 / cg" |
|
9771 |
"Modified: / 16.1.1998 / 18:08:00 / cg" |
|
9772 |
! |
|
9773 |
||
9774 |
_WWindowPeer__setTitle:nativeContext |
|
9775 |
|view jString string| |
|
9776 |
||
9777 |
view := self viewForWPeer:nativeContext. |
|
9778 |
||
9779 |
jString := nativeContext argAt:1. |
|
9780 |
string := Java as_ST_String:jString. |
|
9781 |
||
9782 |
"/ 'JAVA: WWindowPeer_pSetTitle: ' print. string print. ' ' print. view printNL. |
|
9783 |
||
9784 |
view label:string. |
|
9785 |
^ nil |
|
9786 |
||
9787 |
"Created: / 5.1.1998 / 00:57:17 / cg" |
|
9788 |
"Modified: / 8.1.1998 / 17:37:41 / cg" |
|
9789 |
! |
|
9790 |
||
440 | 9791 |
_WWindowPeer_create:nativeContext |
9792 |
"/ void create (sun.awt.windows.WComponentPeer) |
|
482 | 9793 |
|jWindowPeer jWindow top window pDataIdx| |
9794 |
||
9795 |
jWindowPeer := nativeContext receiver. |
|
9796 |
||
9797 |
jWindow := jWindowPeer instVarNamed:'target'. |
|
9798 |
window := jWindowPeer instVarNamed:'pData'. |
|
9799 |
||
9800 |
(window notNil and:[window ~~ 0]) ifTrue:[ |
|
9801 |
WindowCreationTrace == true ifTrue:[ |
|
9802 |
'JAVA: window view already created: ' infoPrint. |
|
9803 |
jWindowPeer class name infoPrintCR. |
|
9804 |
]. |
|
9805 |
] ifFalse:[ |
|
9806 |
"/ OLD |
|
9807 |
"/ window := StandardSystemView new. |
|
9808 |
"/ self createdWindowsView:window for:jWindowPeer. |
|
9809 |
"/ JavaWindowGroup addTopView:window. |
|
9810 |
||
9811 |
window := JavaPopUpView new. |
|
483 | 9812 |
window borderWidth:0. |
9813 |
window level:0. |
|
482 | 9814 |
window delegate:self. |
9815 |
window javaPeer:jWindowPeer. |
|
9816 |
self createdWindowsView:window for:jWindowPeer. |
|
9817 |
JavaWindowGroup addTopView:window. |
|
9818 |
||
9819 |
"/ top := StandardSystemView new. |
|
9820 |
"/ window := JavaView origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
9821 |
"/ window delegate:self. |
|
9822 |
"/ window javaPeer:jWindowPeer. |
|
9823 |
"/ self createdWindowsView:window for:jWindowPeer. |
|
9824 |
"/ JavaWindowGroup addTopView:top. |
|
9825 |
||
9826 |
]. |
|
9827 |
||
9828 |
WindowCreationTrace == true ifTrue:[ |
|
9829 |
'JAVA: WWindowPeer_create: ' print. jWindowPeer displayString print. |
|
9830 |
' window: ' print. window printNL. |
|
9831 |
]. |
|
9832 |
||
9833 |
"Created: / 4.1.1998 / 17:56:39 / cg" |
|
483 | 9834 |
"Modified: / 4.12.1998 / 17:37:59 / cg" |
440 | 9835 |
! |
9836 |
||
9837 |
_WWindowPeer_getContainerElement:nativeContext |
|
9838 |
"/ java.awt.Component getContainerElement (java.awt.Container int) |
|
9839 |
UnimplementedNativeMethodSignal raise |
|
9840 |
||
9841 |
"Created: / 12.11.1998 / 19:10:54 / cg" |
|
9842 |
! |
|
9843 |
||
342 | 9844 |
_WWindowPeer_toBack:nativeContext |
9845 |
|view| |
|
9846 |
||
9847 |
view := self viewForWPeer:nativeContext. |
|
9848 |
view lower. |
|
9849 |
||
9850 |
"Created: / 7.5.1998 / 00:23:03 / cg" |
|
9851 |
! |
|
9852 |
||
337 | 9853 |
_WWindowPeer_toFront:nativeContext |
9854 |
|view| |
|
9855 |
||
9856 |
view := self viewForWPeer:nativeContext. |
|
9857 |
view raise. |
|
9858 |
||
9859 |
"Created: / 9.4.1998 / 22:17:28 / cg" |
|
9860 |
! |
|
9861 |
||
284 | 9862 |
_WWindowPeer_updateInsets:nativeContext |
9863 |
"/ self halt. |
|
9864 |
||
9865 |
"Modified: / 18.3.1997 / 18:43:18 / cg" |
|
9866 |
"Created: / 4.1.1998 / 18:09:04 / cg" |
|
9867 |
! ! |
|
9868 |
||
9869 |
!JavaVM class methodsFor:'native - sun.awt.windows - jdk1.2'! |
|
9870 |
||
9871 |
_WFramePeer_setTitle:nativeContext |
|
9872 |
|view jString string| |
|
9873 |
||
9874 |
view := self viewForWPeer:nativeContext. |
|
9875 |
||
9876 |
jString := nativeContext argAt:1. |
|
9877 |
string := Java as_ST_String:jString. |
|
9878 |
||
9879 |
"/ 'JAVA: WFramePeer_pSetTitle: ' print. string print. ' ' print. view printNL. |
|
9880 |
||
9881 |
view label:string. |
|
9882 |
^ nil |
|
9883 |
||
9884 |
"Modified: / 8.1.1998 / 17:37:41 / cg" |
|
9885 |
"Created: / 27.1.1998 / 21:42:57 / cg" |
|
9886 |
! |
|
9887 |
||
9888 |
_WPanelPeer_calculateInsets:nativeContext |
|
9889 |
"/ new with jdk1.2 ... |
|
9890 |
||
9891 |
"Created: / 27.1.1998 / 21:40:00 / cg" |
|
9892 |
! ! |
|
9893 |
||
457 | 9894 |
!JavaVM class methodsFor:'native - sun.awt.windows - ms'! |
9895 |
||
9896 |
_MCanvasPeer_create:nativeContext |
|
9897 |
|jCanvasPeer jFrame frame subView| |
|
9898 |
||
9899 |
jCanvasPeer := nativeContext receiver. |
|
9900 |
||
9901 |
jFrame := nativeContext argAt:1. |
|
9902 |
jFrame isNil ifTrue:[ |
|
9903 |
self halt:'no frame in canvasPeer create'. |
|
9904 |
self internalError:'no frame in canvasPeer create'. |
|
9905 |
^ self. |
|
9906 |
]. |
|
9907 |
frame := jFrame instVarNamed:'pData'. |
|
9908 |
||
9909 |
subView := JavaView in:frame. |
|
9910 |
subView delegate:self. |
|
9911 |
subView javaPeer:jCanvasPeer. |
|
9912 |
||
9913 |
self createdWindowsView:subView for:jCanvasPeer. |
|
9914 |
||
9915 |
WindowCreationTrace == true ifTrue:[ |
|
9916 |
'WCanvasPeer_create: ' print. frame print. ' -> ' print. subView printNL. |
|
9917 |
]. |
|
9918 |
||
9919 |
"Modified: / 16.1.1998 / 13:40:00 / cg" |
|
9920 |
"Created: / 18.11.1998 / 00:14:44 / cg" |
|
9921 |
! |
|
9922 |
||
9923 |
_MComponentPeer_pReshape:nativeContext |
|
9924 |
self commonReshapeComponent:nativeContext |
|
9925 |
||
9926 |
"Created: / 18.11.1998 / 00:18:17 / cg" |
|
9927 |
! |
|
9928 |
||
9929 |
_MComponentPeer_setBackground:nativeContext |
|
9930 |
|jClr rgb clr view| |
|
9931 |
||
9932 |
view := self viewForWPeer:nativeContext. |
|
9933 |
||
9934 |
jClr := nativeContext argAt:1. |
|
9935 |
rgb := jClr instVarNamed:'value'. |
|
9936 |
"/ self halt. |
|
9937 |
clr := Color rgbValue:rgb. |
|
9938 |
||
9939 |
||
9940 |
clr := clr on:(view device). |
|
9941 |
||
9942 |
(view isKindOf:ScrollableView) ifTrue:[ |
|
9943 |
view := view scrolledView |
|
9944 |
]. |
|
9945 |
view viewBackground:clr. |
|
9946 |
view backgroundPaint:clr. |
|
9947 |
||
9948 |
"Created: / 17.11.1998 / 23:49:41 / cg" |
|
9949 |
! |
|
9950 |
||
9951 |
_MComponentPeer_setFont:nativeContext |
|
9952 |
|view| |
|
9953 |
||
9954 |
view := self viewForWPeer:nativeContext. |
|
9955 |
"/ self halt. |
|
9956 |
||
9957 |
"Modified: / 25.1.1998 / 01:22:19 / cg" |
|
9958 |
"Created: / 17.11.1998 / 23:43:48 / cg" |
|
9959 |
! |
|
9960 |
||
9961 |
_MComponentPeer_setForeground:nativeContext |
|
9962 |
|jClr rgb clr view| |
|
9963 |
||
9964 |
view := self viewForWPeer:nativeContext. |
|
9965 |
||
9966 |
jClr := nativeContext argAt:1. |
|
9967 |
rgb := jClr instVarNamed:'value'. |
|
9968 |
"/ self halt. |
|
9969 |
clr := Color rgbValue:rgb. |
|
9970 |
||
9971 |
clr := clr on:(view device). |
|
9972 |
||
9973 |
view paint:clr. |
|
9974 |
||
9975 |
"Created: / 17.11.1998 / 23:50:31 / cg" |
|
9976 |
"Modified: / 17.11.1998 / 23:57:29 / cg" |
|
9977 |
! |
|
9978 |
||
9979 |
_MFramePeer_getWindowBackgroundColor:nativeContext |
|
9980 |
^ View defaultViewBackgroundColor rgbValue. |
|
9981 |
||
9982 |
"Created: / 17.11.1998 / 23:55:42 / cg" |
|
9983 |
! |
|
9984 |
||
9985 |
_MFramePeer_pShow:nativeContext |
|
9986 |
|view| |
|
9987 |
||
9988 |
view := self viewForWPeer:nativeContext. |
|
9989 |
||
9990 |
"/ frame views are under my browsers own control |
|
9991 |
(view isMemberOf:JavaEmbeddedFrameView) ifFalse:[ |
|
9992 |
view beVisible. |
|
9993 |
view realize. |
|
9994 |
]. |
|
9995 |
||
9996 |
"/ view windowGroup notNil ifTrue:[ |
|
9997 |
"/ windowServer addGroup:(view windowGroup) |
|
9998 |
"/ ]. |
|
9999 |
||
10000 |
^ nil |
|
10001 |
||
10002 |
"/ self halt. |
|
10003 |
||
10004 |
"Modified: / 25.1.1998 / 09:54:07 / cg" |
|
10005 |
"Created: / 18.11.1998 / 00:19:59 / cg" |
|
10006 |
! |
|
10007 |
||
10008 |
_MFramePeer_setInsets:nativeContext |
|
10009 |
||
10010 |
"Created: / 17.11.1998 / 23:55:32 / cg" |
|
10011 |
! |
|
10012 |
||
10013 |
_MFramePeer_setResizable:nativeContext |
|
10014 |
|view onOff| |
|
10015 |
||
10016 |
view := self viewForWPeer:nativeContext. |
|
10017 |
||
10018 |
onOff := (nativeContext argAt:1) == 1. |
|
10019 |
view isTopView ifTrue:[ |
|
10020 |
onOff ifTrue:[ |
|
10021 |
view minExtent:10@10. |
|
10022 |
view maxExtent:(Screen current extent). |
|
10023 |
] ifFalse:[ |
|
10024 |
view minExtent:view extent. |
|
10025 |
view maxExtent:view extent. |
|
10026 |
] |
|
10027 |
] ifFalse:[ |
|
10028 |
(view isMemberOf:JavaEmbeddedFrameView) ifFalse:[ |
|
10029 |
self halt. |
|
10030 |
] |
|
10031 |
]. |
|
10032 |
||
10033 |
"/ 'JAVA: WWindowPeer_setResizable: ' print. view print. ' yes/no: ' print. onOff printNL. |
|
10034 |
||
10035 |
^ nil |
|
10036 |
||
10037 |
"Modified: / 16.1.1998 / 18:08:00 / cg" |
|
10038 |
"Created: / 17.11.1998 / 23:51:45 / cg" |
|
10039 |
! |
|
10040 |
||
10041 |
_MToolkit_callbackLoop:nativeContext |
|
10042 |
|toolKit| |
|
10043 |
||
10044 |
toolKit := nativeContext receiver. |
|
10045 |
^ self. |
|
10046 |
self halt. |
|
10047 |
self wakeup:toolKit. |
|
10048 |
self halt. |
|
10049 |
||
526 | 10050 |
(JavaEventThread notNil and:[JavaEventThread isDead not]) ifTrue:[ |
10051 |
'JavaVM [warning]: oops - two threads executing eventLoop' errorPrintCR. |
|
10052 |
]. |
|
10053 |
||
457 | 10054 |
JavaEventThread := Processor activeProcess. |
10055 |
[ |
|
10056 |
[true] whileTrue:[ |
|
10057 |
AbortSignal handle:[:ex | |
|
10058 |
ex return |
|
10059 |
] do:[ |
|
10060 |
self doWindowsEventThread. |
|
10061 |
] |
|
10062 |
]. |
|
10063 |
] valueNowOrOnUnwindDo:[ |
|
10064 |
JavaEventThread := nil. |
|
10065 |
]. |
|
10066 |
||
10067 |
"Created: / 17.11.1998 / 23:58:33 / cg" |
|
526 | 10068 |
"Modified: / 8.1.1999 / 17:08:35 / cg" |
457 | 10069 |
! |
10070 |
||
10071 |
_MToolkit_eventLoop:nativeContext |
|
10072 |
|toolKit| |
|
10073 |
||
526 | 10074 |
(JavaEventThread notNil and:[JavaEventThread isDead not]) ifTrue:[ |
10075 |
'JavaVM [warning]: oops - two threads executing eventLoop' errorPrintCR. |
|
10076 |
]. |
|
10077 |
||
457 | 10078 |
toolKit := nativeContext receiver. |
10079 |
||
10080 |
self wakeup:toolKit. |
|
10081 |
self halt. |
|
10082 |
||
10083 |
JavaEventThread := Processor activeProcess. |
|
10084 |
[ |
|
10085 |
[true] whileTrue:[ |
|
10086 |
AbortSignal handle:[:ex | |
|
10087 |
ex return |
|
10088 |
] do:[ |
|
10089 |
self doWindowsEventThread. |
|
10090 |
] |
|
10091 |
]. |
|
10092 |
] valueNowOrOnUnwindDo:[ |
|
10093 |
JavaEventThread := nil. |
|
10094 |
]. |
|
10095 |
||
10096 |
"Created: / 17.11.1998 / 23:04:29 / cg" |
|
526 | 10097 |
"Modified: / 8.1.1999 / 17:08:21 / cg" |
457 | 10098 |
! ! |
10099 |
||
380 | 10100 |
!JavaVM class methodsFor:'native - sun.awt.windows - ns4.0'! |
10101 |
||
10102 |
_WComponentPeer_setBackground:nativeContext |
|
10103 |
|jClr rgb clr view| |
|
10104 |
||
10105 |
view := self viewForWPeer:nativeContext. |
|
10106 |
||
10107 |
jClr := nativeContext argAt:1. |
|
10108 |
rgb := jClr instVarNamed:'value'. |
|
10109 |
"/ self halt. |
|
10110 |
clr := Color rgbValue:rgb. |
|
10111 |
||
10112 |
||
10113 |
clr := clr on:(view device). |
|
10114 |
||
10115 |
"/ (view superView isMemberOf:JavaEmbeddedFrameView) ifTrue:[ |
|
10116 |
"/ view viewBackground:(view superView viewBackground). |
|
10117 |
"/ view backgroundPaint:(view superView viewBackground). |
|
10118 |
"/ ] ifFalse:[ |
|
10119 |
"/ (view isMemberOf:JavaView) ifTrue:[ |
|
10120 |
"/ view viewBackground:clr. |
|
10121 |
"/ view backgroundPaint:clr. |
|
10122 |
"/ ] |
|
10123 |
"/ ]. |
|
10124 |
||
10125 |
(view isKindOf:ScrollableView) ifTrue:[ |
|
10126 |
view := view scrolledView |
|
10127 |
]. |
|
10128 |
view viewBackground:clr. |
|
10129 |
view backgroundPaint:clr. |
|
10130 |
||
10131 |
"Created: / 16.10.1998 / 02:16:31 / cg" |
|
10132 |
"Modified: / 16.10.1998 / 02:26:29 / cg" |
|
10133 |
! |
|
10134 |
||
10135 |
_WComponentPeer_setForeground:nativeContext |
|
10136 |
|jClr rgb clr view| |
|
10137 |
||
10138 |
view := self viewForWPeer:nativeContext. |
|
10139 |
||
10140 |
jClr := nativeContext argAt:1. |
|
10141 |
rgb := jClr instVarNamed:'value'. |
|
10142 |
"/ self halt. |
|
10143 |
clr := Color rgbValue:rgb. |
|
10144 |
||
10145 |
||
10146 |
clr := clr on:(view device). |
|
10147 |
||
10148 |
(view isKindOf:ScrollableView) ifTrue:[ |
|
10149 |
view := view scrolledView |
|
10150 |
]. |
|
10151 |
view paint:clr. |
|
10152 |
||
10153 |
"Created: / 16.10.1998 / 02:18:58 / cg" |
|
10154 |
"Modified: / 16.10.1998 / 02:26:37 / cg" |
|
10155 |
! |
|
10156 |
||
10157 |
_WContainerPeer_calculateInsets:nativeContext |
|
10158 |
"/ new with ns4.0 ... |
|
10159 |
||
10160 |
"Created: / 16.10.1998 / 02:12:59 / cg" |
|
10161 |
! |
|
10162 |
||
10163 |
_WFramePeer_setResizable:nativeContext |
|
10164 |
|view onOff| |
|
10165 |
||
10166 |
view := self viewForWPeer:nativeContext. |
|
10167 |
||
10168 |
onOff := (nativeContext argAt:1) == 1. |
|
10169 |
view isTopView ifTrue:[ |
|
10170 |
onOff ifTrue:[ |
|
10171 |
view minExtent:10@10. |
|
10172 |
view maxExtent:(Screen current extent). |
|
10173 |
] ifFalse:[ |
|
10174 |
view minExtent:view extent. |
|
10175 |
view maxExtent:view extent. |
|
10176 |
] |
|
10177 |
] ifFalse:[ |
|
10178 |
(view isMemberOf:JavaEmbeddedFrameView) ifFalse:[ |
|
10179 |
self halt. |
|
10180 |
] |
|
10181 |
]. |
|
10182 |
||
10183 |
"/ 'JAVA: WWindowPeer_setResizable: ' print. view print. ' yes/no: ' print. onOff printNL. |
|
10184 |
||
10185 |
^ nil |
|
10186 |
||
10187 |
"Modified: / 16.1.1998 / 18:08:00 / cg" |
|
10188 |
"Created: / 16.10.1998 / 02:21:34 / cg" |
|
10189 |
! ! |
|
10190 |
||
440 | 10191 |
!JavaVM class methodsFor:'native - sun.misc'! |
10192 |
||
10193 |
_VM_getState:nativeContext |
|
10194 |
"/ int getState () |
|
10195 |
UnimplementedNativeMethodSignal raise |
|
10196 |
||
10197 |
"Created: / 12.11.1998 / 19:06:44 / cg" |
|
10198 |
! |
|
10199 |
||
448 | 10200 |
_VM_resetJavaMonitor:nativeContext |
10201 |
"/ void resetJavaMonitor () |
|
10202 |
UnimplementedNativeMethodSignal raise |
|
10203 |
||
10204 |
"Created: / 14.11.1998 / 10:43:23 / cg" |
|
10205 |
! |
|
10206 |
||
10207 |
_VM_resumeJavaMonitor:nativeContext |
|
10208 |
"/ void resumeJavaMonitor () |
|
10209 |
UnimplementedNativeMethodSignal raise |
|
10210 |
||
10211 |
"Created: / 14.11.1998 / 10:42:49 / cg" |
|
10212 |
! |
|
10213 |
||
10214 |
_VM_suspendJavaMonitor:nativeContext |
|
10215 |
"/ void suspendJavaMonitor () |
|
10216 |
UnimplementedNativeMethodSignal raise |
|
10217 |
||
10218 |
"Created: / 14.11.1998 / 10:43:07 / cg" |
|
10219 |
! |
|
10220 |
||
440 | 10221 |
_VM_threadsSuspended:nativeContext |
10222 |
"/ boolean threadsSuspended () |
|
10223 |
UnimplementedNativeMethodSignal raise |
|
10224 |
||
10225 |
"Created: / 12.11.1998 / 19:07:10 / cg" |
|
10226 |
! |
|
10227 |
||
10228 |
_VM_unsuspendSomeThreads:nativeContext |
|
10229 |
"/ void unsuspendSomeThreads () |
|
10230 |
UnimplementedNativeMethodSignal raise |
|
10231 |
||
10232 |
"Created: / 12.11.1998 / 19:07:29 / cg" |
|
10233 |
! |
|
10234 |
||
10235 |
_VM_unsuspendThreads:nativeContext |
|
10236 |
"/ void unsuspendThreads () |
|
10237 |
UnimplementedNativeMethodSignal raise |
|
10238 |
||
10239 |
"Created: / 12.11.1998 / 19:07:20 / cg" |
|
448 | 10240 |
! |
10241 |
||
10242 |
_VM_writeJavaMonitorReport:nativeContext |
|
10243 |
"/ void writeJavaMonitorReport () |
|
10244 |
UnimplementedNativeMethodSignal raise |
|
10245 |
||
10246 |
"Created: / 14.11.1998 / 10:43:37 / cg" |
|
440 | 10247 |
! ! |
10248 |
||
253 | 10249 |
!JavaVM class methodsFor:'semaphores & monitors'! |
10250 |
||
520 | 10251 |
enteredMonitors |
10252 |
^ self enteredMonitorsOfProcess:(Processor activeProcess) |
|
10253 |
||
10254 |
"Modified: / 8.1.1999 / 14:02:15 / cg" |
|
10255 |
! |
|
10256 |
||
10257 |
enteredMonitorsOfProcess:aProcess |
|
10258 |
|monitors| |
|
10259 |
||
10260 |
monitors := EnteredMonitorsPerProcess at:aProcess ifAbsent:nil. |
|
10261 |
monitors isNil ifTrue:[ |
|
10262 |
monitors := OrderedCollection new. |
|
10263 |
EnteredMonitorsPerProcess at:aProcess put:monitors. |
|
10264 |
]. |
|
10265 |
^ monitors |
|
10266 |
||
10267 |
"Created: / 8.1.1999 / 14:02:02 / cg" |
|
10268 |
! |
|
10269 |
||
253 | 10270 |
monitorFor:someObject |
10271 |
|mon| |
|
10272 |
||
10273 |
LockTableAccess critical:[ |
|
261 | 10274 |
mon := LockTable at:someObject ifAbsent:nil. |
10275 |
mon isNil ifTrue:[ |
|
10276 |
LockTable at:someObject put:(mon := Monitor new) |
|
10277 |
] |
|
253 | 10278 |
]. |
10279 |
^ mon |
|
10280 |
||
10281 |
"Created: / 2.1.1998 / 19:01:52 / cg" |
|
10282 |
! |
|
10283 |
||
10284 |
releaseAndSignalForAllSemaphoreFor:someObject |
|
10285 |
|sema| |
|
10286 |
||
10287 |
WaitTableAccess critical:[ |
|
306 | 10288 |
sema := WaitTable at:someObject ifAbsent:nil. |
10289 |
"/ sema notNil ifTrue:[ |
|
10290 |
"/ WaitTable removeKey:someObject |
|
10291 |
"/ ] |
|
253 | 10292 |
]. |
10293 |
||
10294 |
sema notNil ifTrue:[ |
|
306 | 10295 |
sema signalForAll |
253 | 10296 |
] |
10297 |
||
10298 |
"Created: / 2.1.1998 / 18:21:51 / cg" |
|
306 | 10299 |
"Modified: / 3.2.1998 / 16:11:58 / cg" |
253 | 10300 |
! |
10301 |
||
10302 |
releaseAndSignalSemaphoreFor:someObject |
|
10303 |
|sema| |
|
10304 |
||
10305 |
WaitTableAccess critical:[ |
|
306 | 10306 |
sema := WaitTable at:someObject ifAbsent:nil. |
10307 |
"/ sema notNil ifTrue:[ |
|
10308 |
"/ WaitTable removeKey:someObject |
|
10309 |
"/ ] |
|
253 | 10310 |
]. |
10311 |
||
10312 |
sema notNil ifTrue:[ |
|
306 | 10313 |
sema signal |
253 | 10314 |
] |
10315 |
||
10316 |
"Created: / 2.1.1998 / 18:20:20 / cg" |
|
306 | 10317 |
"Modified: / 3.2.1998 / 16:11:51 / cg" |
253 | 10318 |
! |
10319 |
||
10320 |
releaseSemaphoreFor:someObject |
|
10321 |
WaitTableAccess critical:[ |
|
261 | 10322 |
WaitTable removeKey:someObject ifAbsent:nil |
253 | 10323 |
] |
10324 |
||
10325 |
"Created: / 2.1.1998 / 18:17:14 / cg" |
|
10326 |
"Modified: / 2.1.1998 / 21:52:03 / cg" |
|
10327 |
! |
|
10328 |
||
10329 |
semaphoreFor:someObject |
|
10330 |
|sema| |
|
10331 |
||
10332 |
WaitTableAccess critical:[ |
|
261 | 10333 |
sema := WaitTable at:someObject ifAbsent:nil. |
10334 |
sema isNil ifTrue:[ |
|
10335 |
WaitTable at:someObject put:(sema := Semaphore new) |
|
10336 |
] |
|
253 | 10337 |
]. |
10338 |
^ sema |
|
10339 |
||
10340 |
"Created: / 2.1.1998 / 18:15:59 / cg" |
|
10341 |
"Modified: / 2.1.1998 / 18:20:31 / cg" |
|
508 | 10342 |
! |
10343 |
||
520 | 10344 |
syncMonitorCache |
535 | 10345 |
|mO mC mP mon wasBlocked enteredMonitors| |
520 | 10346 |
|
10347 |
wasBlocked := OperatingSystem blockInterrupts. |
|
535 | 10348 |
(mO := EnteredMonitorObject) notNil ifTrue:[ |
10349 |
mC := EnteredMonitorObjectCount. |
|
10350 |
mP := EnteredMonitorProcess. |
|
10351 |
mon := self monitorFor:mO. |
|
10352 |
mon fakeEnter:mP count:mC. |
|
10353 |
enteredMonitors := self enteredMonitorsOfProcess:mP. |
|
10354 |
mC timesRepeat:[ |
|
10355 |
enteredMonitors addLast:mO |
|
10356 |
]. |
|
10357 |
EnteredMonitorObject := EnteredMonitorProcess := LeftMonitorObject := nil. |
|
520 | 10358 |
]. |
10359 |
wasBlocked ifTrue:[ OperatingSystem unblockInterrupts]. |
|
10360 |
||
10361 |
"Created: / 8.1.1999 / 13:59:17 / cg" |
|
535 | 10362 |
"Modified: / 9.1.1999 / 00:39:55 / cg" |
520 | 10363 |
! |
10364 |
||
508 | 10365 |
waitFor:sema state:pState timeOut:tmo |
10366 |
"wait" |
|
10367 |
||
526 | 10368 |
|wasBlocked thisProcess enteredMonitors| |
508 | 10369 |
|
520 | 10370 |
self syncMonitorCache. |
10371 |
||
526 | 10372 |
thisProcess := Processor activeProcess. |
10373 |
||
508 | 10374 |
"/ temporarily leave all entered monitors. |
10375 |
||
526 | 10376 |
wasBlocked := OperatingSystem blockInterrupts. |
10377 |
||
10378 |
enteredMonitors := self enteredMonitorsOfProcess:thisProcess. |
|
508 | 10379 |
enteredMonitors size > 0 ifTrue:[ |
10380 |
MonitorTrace ifTrue:[ |
|
10381 |
('====> wait - exit ' , enteredMonitors size printString , ' monitors in ' , Processor activeProcess name , ' ...') infoPrintCR. |
|
10382 |
]. |
|
10383 |
enteredMonitors do:[:handle | |
|
10384 |
|mon| |
|
10385 |
||
10386 |
mon := LockTable at:handle ifAbsent:nil. |
|
10387 |
mon isNil ifTrue:[ |
|
10388 |
self halt:'no monitor in wait'. |
|
10389 |
] ifFalse:[ |
|
10390 |
MonitorTrace ifTrue:[ |
|
10391 |
('====> wait - exit monitor for ' , handle displayString , ' in ' , Processor activeProcess name , ' ...') infoPrintCR. |
|
10392 |
]. |
|
10393 |
mon exit. |
|
10394 |
]. |
|
10395 |
]. |
|
526 | 10396 |
EnteredMonitorsPerProcess removeKey:thisProcess. |
10397 |
]. |
|
10398 |
||
10399 |
wasBlocked ifTrue:[ OperatingSystem unblockInterrupts]. |
|
10400 |
||
10401 |
pState notNil ifTrue:[thisProcess state:pState]. |
|
10402 |
sema isNil ifTrue:[ |
|
10403 |
Delay waitForMilliseconds:tmo |
|
508 | 10404 |
] ifFalse:[ |
526 | 10405 |
(tmo isNil or:[tmo = 0]) ifTrue:[ |
10406 |
sema wait. |
|
10407 |
] ifFalse:[ |
|
10408 |
sema waitWithTimeout:tmo / 1000. |
|
10409 |
]. |
|
508 | 10410 |
]. |
10411 |
||
10412 |
"/ re-enter monitors. |
|
10413 |
||
10414 |
enteredMonitors size > 0 ifTrue:[ |
|
526 | 10415 |
wasBlocked := OperatingSystem blockInterrupts. |
10416 |
||
508 | 10417 |
MonitorTrace ifTrue:[ |
10418 |
('====> wait - reenter ' , enteredMonitors size printString , ' monitors in ' , Processor activeProcess name , ' ...') infoPrintCR. |
|
10419 |
]. |
|
10420 |
enteredMonitors do:[:handle | |
|
10421 |
|mon| |
|
10422 |
||
10423 |
LockTableAccess critical:[ |
|
10424 |
mon := LockTable at:handle ifAbsent:nil. |
|
10425 |
mon isNil ifTrue:[ |
|
10426 |
LockTable at:handle put:(mon := Monitor new) |
|
10427 |
] |
|
10428 |
]. |
|
10429 |
MonitorTrace ifTrue:[ |
|
10430 |
('====> wait - reenter monitor for ' , handle displayString , ' in ' , Processor activeProcess name , ' ...') infoPrintCR. |
|
10431 |
]. |
|
10432 |
mon enter. |
|
526 | 10433 |
]. |
10434 |
EnteredMonitorsPerProcess at:thisProcess put:enteredMonitors. |
|
10435 |
wasBlocked ifTrue:[ OperatingSystem unblockInterrupts]. |
|
508 | 10436 |
]. |
10437 |
||
10438 |
"Created: / 30.12.1998 / 19:19:35 / cg" |
|
526 | 10439 |
"Modified: / 8.1.1999 / 17:29:24 / cg" |
253 | 10440 |
! ! |
10441 |
||
10442 |
!JavaVM class methodsFor:'vm support'! |
|
10443 |
||
524 | 10444 |
_ARRAYLENGTH:arr |
10445 |
^ arr size |
|
10446 |
||
10447 |
"Created: / 8.1.1999 / 14:38:27 / cg" |
|
10448 |
! |
|
10449 |
||
523 | 10450 |
_ATHROW:aJavaException |
519 | 10451 |
self throwException:aJavaException. |
10452 |
||
523 | 10453 |
"Created: / 8.1.1999 / 14:15:36 / cg" |
10454 |
! |
|
10455 |
||
524 | 10456 |
_CHECKCAST:anObject _:aClassOrInterface |
10457 |
"trampouline for unhandled cases ..." |
|
10458 |
||
10459 |
aClassOrInterface isBehavior ifTrue:[ |
|
535 | 10460 |
anObject class == aClassOrInterface ifTrue:[ |
10461 |
^ true |
|
10462 |
]. |
|
524 | 10463 |
aClassOrInterface == ByteArray ifTrue:[ |
535 | 10464 |
^ false |
10465 |
]. |
|
10466 |
aClassOrInterface == SignedIntegerArray ifTrue:[ |
|
10467 |
^ false |
|
524 | 10468 |
]. |
10469 |
||
10470 |
aClassOrInterface isInterface ifTrue:[ |
|
10471 |
(anObject class hasInterface:aClassOrInterface) ifTrue:[ |
|
10472 |
^ true |
|
10473 |
] |
|
10474 |
]. |
|
10475 |
(anObject isKindOf:aClassOrInterface) ifTrue:[ |
|
10476 |
^ true |
|
10477 |
]. |
|
10478 |
anObject isArray ifTrue:[ |
|
10479 |
^ true |
|
10480 |
]. |
|
10481 |
self halt. |
|
10482 |
^ false. |
|
10483 |
]. |
|
10484 |
(aClassOrInterface isMemberOf:JavaClassPointerRef) ifTrue:[ |
|
10485 |
"/ must be a pointer to an array of that class |
|
10486 |
||
10487 |
anObject isArray ifTrue:[ |
|
10488 |
^ true |
|
10489 |
]. |
|
10490 |
self halt. |
|
10491 |
^ false. |
|
10492 |
]. |
|
10493 |
(aClassOrInterface isMemberOf:JavaBuiltInClassPointerRef) ifTrue:[ |
|
10494 |
aClassOrInterface arrayClass == anObject class ifTrue:[ |
|
10495 |
^ true |
|
10496 |
]. |
|
10497 |
]. |
|
10498 |
||
10499 |
(anObject isMemberOf:Array) ifTrue:[ |
|
10500 |
anObject size == 0 ifTrue:[ |
|
10501 |
^ true |
|
10502 |
]. |
|
10503 |
(self _CHECKCAST:(anObject at:1) _:(aClassOrInterface deref)) ifTrue:[ |
|
10504 |
^ true |
|
10505 |
]. |
|
10506 |
self halt. |
|
10507 |
^ false |
|
10508 |
]. |
|
10509 |
self halt. |
|
10510 |
^ false. |
|
10511 |
||
10512 |
"Created: / 8.1.1999 / 14:53:51 / cg" |
|
535 | 10513 |
"Modified: / 9.1.1999 / 00:45:21 / cg" |
524 | 10514 |
! |
10515 |
||
10516 |
_D2I:op1 |
|
10517 |
|v| |
|
10518 |
||
10519 |
v := op1 asInteger. |
|
10520 |
v > 16r7FFFFFFF ifTrue:[ |
|
10521 |
self halt. |
|
10522 |
v := 16r7FFFFFFF |
|
10523 |
] ifFalse:[ |
|
10524 |
v < 16r80000000 negated ifTrue:[ |
|
10525 |
self halt. |
|
10526 |
v := 16r80000000 negated |
|
10527 |
] |
|
10528 |
]. |
|
10529 |
^ v |
|
10530 |
||
10531 |
"Modified: / 17.10.1998 / 21:55:49 / cg" |
|
10532 |
"Created: / 8.1.1999 / 14:47:13 / cg" |
|
10533 |
! |
|
10534 |
||
10535 |
_D2L:op1 |
|
10536 |
|v| |
|
10537 |
||
10538 |
v := op1 asInteger. |
|
10539 |
v > 16r7FFFFFFFFFFFFFFF ifTrue:[ |
|
10540 |
self halt. |
|
10541 |
v := 16r7FFFFFFFFFFFFFFF |
|
10542 |
] ifFalse:[ |
|
10543 |
v < 16r8000000000000000 negated ifTrue:[ |
|
10544 |
self halt. |
|
10545 |
v := 16r8000000000000000 negated |
|
10546 |
] |
|
10547 |
]. |
|
10548 |
^ v |
|
10549 |
||
10550 |
"Modified: / 17.10.1998 / 21:55:49 / cg" |
|
10551 |
"Created: / 8.1.1999 / 14:46:44 / cg" |
|
10552 |
! |
|
10553 |
||
10554 |
_DADD:op1 _:op2 |
|
10555 |
^ op1 asFloat + op2 asFloat |
|
10556 |
||
10557 |
"Created: / 8.1.1999 / 15:11:59 / cg" |
|
10558 |
! |
|
10559 |
||
10560 |
_DDIV:op1 _:op2 |
|
10561 |
^ op1 asFloat / op2 asFloat. |
|
10562 |
||
10563 |
"Created: / 8.1.1999 / 15:09:10 / cg" |
|
10564 |
! |
|
10565 |
||
10566 |
_DMUL:op1 _:op2 |
|
10567 |
^ op1 asFloat * op2 asFloat |
|
10568 |
||
10569 |
"Created: / 8.1.1999 / 14:49:52 / cg" |
|
10570 |
! |
|
10571 |
||
10572 |
_DNEG:op |
|
10573 |
^ op asFloat negated |
|
10574 |
||
10575 |
"Created: / 8.1.1999 / 15:06:15 / cg" |
|
10576 |
! |
|
10577 |
||
10578 |
_DSUB:op1 _:op2 |
|
10579 |
^ op1 asFloat - op2 asFloat |
|
10580 |
||
10581 |
"Created: / 8.1.1999 / 15:10:59 / cg" |
|
10582 |
! |
|
10583 |
||
10584 |
_F2I:op1 |
|
10585 |
^ self _D2I:op1 |
|
10586 |
||
10587 |
"Created: / 8.1.1999 / 14:47:42 / cg" |
|
10588 |
! |
|
10589 |
||
10590 |
_F2L:op1 |
|
10591 |
^ self _D2L:op1 |
|
10592 |
||
10593 |
"Created: / 8.1.1999 / 14:47:53 / cg" |
|
10594 |
! |
|
10595 |
||
10596 |
_FADD:op1 _:op2 |
|
10597 |
^ op1 asShortFloat + op2 asShortFloat |
|
10598 |
||
10599 |
"Created: / 8.1.1999 / 15:11:36 / cg" |
|
10600 |
! |
|
10601 |
||
10602 |
_FDIV:op1 _:op2 |
|
10603 |
^ op1 asShortFloat / op2 asShortFloat. |
|
10604 |
||
10605 |
"Created: / 8.1.1999 / 15:09:32 / cg" |
|
10606 |
! |
|
10607 |
||
10608 |
_FMUL:op1 _:op2 |
|
10609 |
^ op1 asShortFloat * op2 asShortFloat |
|
10610 |
||
10611 |
"Created: / 8.1.1999 / 14:50:10 / cg" |
|
10612 |
! |
|
10613 |
||
10614 |
_FNEG:op |
|
10615 |
^ op asShortFloat negated |
|
10616 |
||
10617 |
"Created: / 8.1.1999 / 15:06:33 / cg" |
|
10618 |
! |
|
10619 |
||
10620 |
_FSUB:op1 _:op2 |
|
10621 |
^ op1 asShortFloat - op2 asShortFloat |
|
10622 |
||
10623 |
"Created: / 8.1.1999 / 15:08:17 / cg" |
|
10624 |
! |
|
10625 |
||
10626 |
_INSTANCEOF:anObject _:aClassOrInterface |
|
10627 |
"trampouline for unhandled cases ..." |
|
10628 |
||
10629 |
"/ aClassOrInterface isInterface ifTrue:[ |
|
10630 |
"/ (anObject class hasInterface:aClassOrInterface) ifTrue:[ |
|
10631 |
"/(aClassOrInterface name includesString:'LightweightPeer') ifTrue:[self halt]. |
|
10632 |
"/ ^ 1 |
|
10633 |
"/ ]. |
|
10634 |
"/ ]. |
|
10635 |
"/ (aClassOrInterface name includesString:'LightweightPeer') ifTrue:[self halt]. |
|
10636 |
||
10637 |
^ 0. |
|
10638 |
||
10639 |
"Modified: / 13.2.1998 / 18:03:03 / cg" |
|
10640 |
"Created: / 8.1.1999 / 14:52:54 / cg" |
|
10641 |
! |
|
10642 |
||
10643 |
_L2D:op1 |
|
10644 |
^ op1 asFloat |
|
10645 |
||
10646 |
"Created: / 8.1.1999 / 14:46:09 / cg" |
|
10647 |
! |
|
10648 |
||
10649 |
_L2F:op1 |
|
10650 |
^ op1 asShortFloat |
|
10651 |
||
10652 |
"Created: / 8.1.1999 / 14:46:18 / cg" |
|
10653 |
"Modified: / 8.1.1999 / 14:50:18 / cg" |
|
10654 |
! |
|
10655 |
||
10656 |
_LADD:op1 _:op2 |
|
10657 |
|sum| |
|
10658 |
||
10659 |
sum := (op1 + op2) bitAnd:16rFFFFFFFFFFFFFFFF. |
|
10660 |
^ sum |
|
10661 |
||
10662 |
"Created: / 8.1.1999 / 15:07:39 / cg" |
|
10663 |
! |
|
10664 |
||
10665 |
_LAND:op1 _:op2 |
|
10666 |
|rslt| |
|
10667 |
||
10668 |
(op1 < 0 or:[op2 < 0]) ifTrue:[ |
|
10669 |
self halt. |
|
10670 |
]. |
|
10671 |
rslt := op1 bitAnd: op2. |
|
10672 |
^ rslt |
|
10673 |
||
10674 |
"Modified: / 7.1.1998 / 21:21:53 / cg" |
|
10675 |
"Created: / 8.1.1999 / 14:54:22 / cg" |
|
10676 |
! |
|
10677 |
||
10678 |
_LDIV:op1 _:op2 |
|
10679 |
|quo| |
|
10680 |
||
10681 |
quo := op1 quo: op2. |
|
10682 |
^ quo |
|
10683 |
||
10684 |
"Created: / 8.1.1999 / 15:04:47 / cg" |
|
10685 |
! |
|
10686 |
||
10687 |
_LMUL:op1 _:op2 |
|
10688 |
|prod o1 o2 sign| |
|
10689 |
||
10690 |
"/ self halt. |
|
10691 |
"/ ST's largeIntegers compute a correct result; |
|
10692 |
"/ but here, we want the overflow to flow into the |
|
10693 |
"/ sign bit ... (sigh) |
|
10694 |
||
10695 |
sign := 1. |
|
10696 |
(o1 := op1) < 0 ifTrue:[ |
|
10697 |
sign := -1. |
|
10698 |
o1 := o1 negated. |
|
10699 |
]. |
|
10700 |
(o2 := op2) < 0 ifTrue:[ |
|
10701 |
sign := sign negated. |
|
10702 |
o2 := o2 negated. |
|
10703 |
]. |
|
10704 |
||
10705 |
prod := (o1 * o2) bitAnd:16rFFFFFFFFFFFFFFFF. |
|
10706 |
(prod bitAnd:16r8000000000000000) ~~ 0 ifTrue:[ |
|
10707 |
]. |
|
10708 |
sign == -1 ifTrue:[ |
|
10709 |
prod := prod negated |
|
10710 |
]. |
|
10711 |
^ prod |
|
10712 |
||
10713 |
"Created: / 8.1.1999 / 15:10:04 / cg" |
|
10714 |
! |
|
10715 |
||
10716 |
_LNEG:op |
|
10717 |
^ op asInteger negated |
|
10718 |
||
10719 |
"Created: / 8.1.1999 / 15:06:59 / cg" |
|
10720 |
! |
|
10721 |
||
10722 |
_LOR:op1 _:op2 |
|
10723 |
|rslt| |
|
10724 |
||
10725 |
(op1 < 0 or:[op2 < 0]) ifTrue:[ |
|
10726 |
self halt. |
|
10727 |
]. |
|
10728 |
rslt := op1 bitOr: op2. |
|
10729 |
^ rslt |
|
10730 |
||
10731 |
"Created: / 8.1.1999 / 15:05:10 / cg" |
|
10732 |
! |
|
10733 |
||
10734 |
_LREM:op1 _:op2 |
|
10735 |
|rem| |
|
10736 |
||
10737 |
rem := op1 rem: op2. |
|
10738 |
^ rem |
|
10739 |
||
10740 |
"Modified: / 7.1.1998 / 00:23:11 / cg" |
|
10741 |
"Created: / 8.1.1999 / 15:04:23 / cg" |
|
10742 |
! |
|
10743 |
||
10744 |
_LSHL:op1 _:op2 |
|
10745 |
|rslt| |
|
10746 |
||
10747 |
(op1 < 0) ifTrue:[ |
|
10748 |
self halt. |
|
10749 |
]. |
|
10750 |
rslt := (op1 bitShift:op2) bitAnd:16rFFFFFFFFFFFFFFFF. |
|
10751 |
^ rslt |
|
10752 |
||
10753 |
"Created: / 8.1.1999 / 14:51:08 / cg" |
|
10754 |
! |
|
10755 |
||
10756 |
_LSHR:op1 _:op2 |
|
10757 |
|rslt| |
|
10758 |
||
10759 |
op1 < 0 ifTrue:[ |
|
10760 |
self halt |
|
10761 |
]. |
|
10762 |
||
10763 |
(op1 < 0) ifTrue:[ |
|
10764 |
self halt. |
|
10765 |
]. |
|
10766 |
rslt := (op1 bitShift:op2 negated) bitAnd:16rFFFFFFFFFFFFFFFF. |
|
10767 |
^ rslt |
|
10768 |
||
10769 |
"Created: / 8.1.1999 / 14:51:57 / cg" |
|
10770 |
! |
|
10771 |
||
10772 |
_LSUB:op1 _:op2 |
|
10773 |
|diff| |
|
10774 |
||
10775 |
diff := (op1 - op2) bitAnd:16rFFFFFFFFFFFFFFFF. |
|
10776 |
^ diff |
|
10777 |
||
10778 |
"Created: / 8.1.1999 / 15:10:33 / cg" |
|
10779 |
! |
|
10780 |
||
10781 |
_LUSHR:op1 _:op2 |
|
10782 |
|rslt| |
|
10783 |
||
10784 |
op1 < 0 ifTrue:[ |
|
10785 |
self halt |
|
10786 |
]. |
|
10787 |
||
10788 |
(op1 < 0) ifTrue:[ |
|
10789 |
self halt. |
|
10790 |
]. |
|
10791 |
rslt := (op1 bitShift:op2 negated) bitAnd:16rFFFFFFFFFFFFFFFF. |
|
10792 |
^ rslt |
|
10793 |
||
10794 |
"Modified: / 7.1.1998 / 21:22:17 / cg" |
|
10795 |
"Created: / 8.1.1999 / 14:51:32 / cg" |
|
10796 |
! |
|
10797 |
||
10798 |
_LXOR:op1 _:op2 |
|
10799 |
|rslt| |
|
10800 |
||
10801 |
(op1 < 0 or:[op2 < 0]) ifTrue:[ |
|
10802 |
self halt. |
|
10803 |
]. |
|
10804 |
rslt := op1 bitXor: op2. |
|
10805 |
^ rslt |
|
10806 |
||
10807 |
"Created: / 8.1.1999 / 15:12:28 / cg" |
|
10808 |
! |
|
10809 |
||
523 | 10810 |
_MONITORENTER:someObject |
520 | 10811 |
|mon thisProcess| |
10812 |
||
529 | 10813 |
self syncMonitorCache. |
10814 |
||
10815 |
LeftMonitorObject := nil. |
|
10816 |
||
520 | 10817 |
thisProcess := Processor activeProcess. |
253 | 10818 |
|
10819 |
someObject isNil ifTrue:[ |
|
520 | 10820 |
self halt |
253 | 10821 |
]. |
10822 |
||
10823 |
mon := self monitorFor:someObject. |
|
10824 |
||
10825 |
MonitorTrace ifTrue:[ |
|
520 | 10826 |
('====> entering monitor for ' , someObject displayString , ' in ' , thisProcess name , ' ...') printCR. |
253 | 10827 |
]. |
10828 |
mon enter. |
|
10829 |
MonitorTrace ifTrue:[ |
|
520 | 10830 |
('====> entered it in ' , thisProcess name , ' ...') printCR. |
10831 |
]. |
|
10832 |
||
10833 |
(self enteredMonitorsOfProcess:thisProcess) add:someObject. |
|
253 | 10834 |
|
523 | 10835 |
"Created: / 8.1.1999 / 14:23:10 / cg" |
529 | 10836 |
"Modified: / 8.1.1999 / 18:47:26 / cg" |
523 | 10837 |
! |
10838 |
||
10839 |
_MONITOREXIT:someObject |
|
528 | 10840 |
|mon thisProcess wasBlocked| |
520 | 10841 |
|
529 | 10842 |
self syncMonitorCache. |
10843 |
||
520 | 10844 |
thisProcess := Processor activeProcess. |
253 | 10845 |
|
10846 |
someObject isNil ifTrue:[ |
|
520 | 10847 |
self halt |
253 | 10848 |
]. |
10849 |
||
10850 |
mon := self monitorFor:someObject. |
|
10851 |
||
10852 |
MonitorTrace ifTrue:[ |
|
520 | 10853 |
('====> leaving monitor for ' , someObject displayString , ' in ' , thisProcess name , ' ...') printCR. |
253 | 10854 |
]. |
10855 |
mon exit. |
|
10856 |
MonitorTrace ifTrue:[ |
|
520 | 10857 |
('====> left it in ' , thisProcess name , ' ...') printCR. |
10858 |
]. |
|
10859 |
||
10860 |
(self enteredMonitorsOfProcess:thisProcess) removeLast ~~ someObject ifTrue:[ |
|
10861 |
self halt:'oops - monitor enter/exit nesting wrong' |
|
253 | 10862 |
]. |
10863 |
||
528 | 10864 |
wasBlocked := OperatingSystem blockInterrupts. |
10865 |
mon count == 0 ifTrue:[ |
|
10866 |
LeftMonitorObject := someObject |
|
10867 |
]. |
|
10868 |
wasBlocked ifFalse:[ OperatingSystem unblockInterrupts ] |
|
10869 |
||
523 | 10870 |
"Created: / 8.1.1999 / 14:23:19 / cg" |
529 | 10871 |
"Modified: / 8.1.1999 / 18:47:08 / cg" |
523 | 10872 |
! |
10873 |
||
10874 |
_MULTINEW:typeRef _:dim1 |
|
10875 |
|clsRef cls arr elType elSizes| |
|
10876 |
||
10877 |
typeRef == DoubleArray ifTrue:[ |
|
10878 |
cls := typeRef. |
|
10879 |
] ifFalse:[ |
|
528 | 10880 |
typeRef == Array ifTrue:[ |
10881 |
cls := typeRef. |
|
10882 |
] ifFalse:[ |
|
10883 |
clsRef := typeRef asClassPointerRef. |
|
10884 |
cls := clsRef arrayClass. |
|
10885 |
] |
|
523 | 10886 |
]. |
10887 |
||
10888 |
arr := cls new:dim1. |
|
10889 |
||
10890 |
^ arr |
|
10891 |
||
10892 |
"Created: / 8.1.1999 / 14:15:42 / cg" |
|
528 | 10893 |
"Modified: / 8.1.1999 / 18:03:05 / cg" |
523 | 10894 |
! |
10895 |
||
10896 |
_MULTINEW:typeRef _:dim1 _:dim2 |
|
10897 |
|clsRef cls arr elType elSizes| |
|
10898 |
||
10899 |
typeRef == Array ifTrue:[ |
|
10900 |
cls := Array. |
|
10901 |
elType := typeRef |
|
10902 |
] ifFalse:[ |
|
528 | 10903 |
typeRef == DoubleArray ifTrue:[ |
10904 |
cls := Array. |
|
10905 |
elType := typeRef |
|
10906 |
] ifFalse:[ |
|
10907 |
clsRef := typeRef asClassPointerRef. |
|
523 | 10908 |
"/ cls := clsRef arrayClass. |
528 | 10909 |
cls := Array. |
10910 |
elType := typeRef deref. |
|
10911 |
] |
|
523 | 10912 |
]. |
10913 |
||
10914 |
arr := cls new:dim2. |
|
10915 |
||
10916 |
1 to:dim2 do:[:idx | |
|
10917 |
arr at:idx put:(self _MULTINEW:elType _:dim1) |
|
10918 |
]. |
|
10919 |
||
10920 |
^ arr |
|
10921 |
||
10922 |
"Created: / 8.1.1999 / 14:15:46 / cg" |
|
528 | 10923 |
"Modified: / 8.1.1999 / 17:58:11 / cg" |
523 | 10924 |
! |
10925 |
||
10926 |
_MULTINEW:typeRef _:dim1 _:dim2 _:dim3 |
|
10927 |
|clsRef cls arr elType elSizes| |
|
10928 |
||
10929 |
clsRef := typeRef asClassPointerRef. |
|
10930 |
cls := clsRef arrayClass. |
|
10931 |
arr := cls new:dim3. |
|
10932 |
||
10933 |
elType := typeRef deref. |
|
10934 |
||
10935 |
1 to:dim3 do:[:idx | |
|
10936 |
arr at:idx put:(self _MULTINEW:elType _:dim1 _:dim2) |
|
10937 |
]. |
|
10938 |
||
10939 |
"/ self halt. |
|
10940 |
^ arr |
|
10941 |
||
10942 |
"Modified: / 6.1.1998 / 23:34:35 / cg" |
|
10943 |
"Created: / 8.1.1999 / 14:15:49 / cg" |
|
253 | 10944 |
! ! |
10945 |
||
255 | 10946 |
!JavaVM class methodsFor:'windows - events'! |
10947 |
||
10948 |
awtEventsForEvent:anEvent javaWindow:jWin |
|
10949 |
"given an ST/X event, create corresponding AWT event(s) for it" |
|
10950 |
||
10951 |
|jEv jEv1 jEv2 |
|
261 | 10952 |
modifiers key keyChar untranslatedKey id |
466 | 10953 |
type x y w h view menu resized moved |
255 | 10954 |
eventArgs clickCount jRect |
10955 |
jKeyEventClass jInputEventClass jMouseEventClass |
|
10956 |
jWindowEventClass jPaintEventClass jComponentEventClass| |
|
10957 |
||
10958 |
type := anEvent type. |
|
10959 |
eventArgs := anEvent arguments. |
|
10960 |
||
10961 |
key := 0. |
|
10962 |
modifiers := 0. |
|
10963 |
x := 0. |
|
10964 |
y := 0. |
|
10965 |
||
476 | 10966 |
|
10967 |
((type == #'exposeX:y:width:height:') |
|
10968 |
or:[(type == #'graphicExposeX:y:width:height:') |
|
10969 |
or:[(type == #damage)]]) ifTrue:[ |
|
10970 |
"/ jWindowEventClass := Java classForName:'java.awt.event.WindowEvent'. |
|
10971 |
"/ id := (jPaintEventClass instVarNamed:'PAINT'). |
|
10972 |
||
10973 |
jPaintEventClass := Java classForName:'java.awt.event.PaintEvent'. |
|
10974 |
id := (jPaintEventClass instVarNamed:'UPDATE'). |
|
10975 |
||
10976 |
((type == #'exposeX:y:width:height:') |
|
10977 |
or:[(type == #'graphicExposeX:y:width:height:')]) ifTrue:[ |
|
10978 |
x := eventArgs at:1. |
|
10979 |
y := eventArgs at:2. |
|
10980 |
w := eventArgs at:3. |
|
10981 |
h := eventArgs at:4. |
|
10982 |
] ifFalse:[ |
|
10983 |
x := eventArgs left. |
|
10984 |
y := eventArgs top. |
|
10985 |
w := eventArgs width. |
|
10986 |
h := eventArgs height. |
|
10987 |
]. |
|
10988 |
jRect := (Java classForName:'java.awt.Rectangle') basicNew. |
|
10989 |
jRect instVarNamed:'x' put:x. |
|
10990 |
jRect instVarNamed:'y' put:y. |
|
10991 |
jRect instVarNamed:'width' put:w. |
|
10992 |
jRect instVarNamed:'height' put:h. |
|
10993 |
||
10994 |
jEv := jPaintEventClass newCleared "basicNew". |
|
10995 |
jEv instVarNamed:'id' put:id. |
|
10996 |
jEv instVarNamed:'updateRect' put:jRect. |
|
10997 |
||
10998 |
"/ jEv instVarNamed:'g' put:jWin. |
|
10999 |
||
11000 |
^ Array with:jEv. |
|
11001 |
]. |
|
11002 |
||
255 | 11003 |
(anEvent isKeyEvent |
11004 |
or:[anEvent isButtonEvent |
|
11005 |
or:[anEvent isPointerEnterLeaveEvent]]) ifTrue:[ |
|
439 | 11006 |
jInputEventClass := Java classForName:'java.awt.event.InputEvent'. |
11007 |
||
255 | 11008 |
anEvent hasAlt ifTrue:[ |
11009 |
modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'ALT_MASK') |
|
11010 |
]. |
|
11011 |
anEvent hasCtrl ifTrue:[ |
|
11012 |
modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'CTRL_MASK') |
|
11013 |
]. |
|
11014 |
anEvent hasMeta ifTrue:[ |
|
11015 |
modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'META_MASK') |
|
11016 |
]. |
|
11017 |
anEvent hasShift ifTrue:[ |
|
11018 |
modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'SHIFT_MASK') |
|
11019 |
]. |
|
11020 |
anEvent hasButton1 ifTrue:[ |
|
11021 |
modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'BUTTON1_MASK') |
|
11022 |
]. |
|
11023 |
anEvent hasButton2 ifTrue:[ |
|
11024 |
modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'BUTTON2_MASK') |
|
11025 |
]. |
|
11026 |
anEvent hasButton3 ifTrue:[ |
|
11027 |
modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'BUTTON3_MASK') |
|
11028 |
]. |
|
11029 |
||
11030 |
anEvent isPointerEnterLeaveEvent ifFalse:[ |
|
11031 |
"/ ST/X does not (yet) record this information |
|
11032 |
"/ with pointerLeave events. |
|
11033 |
||
11034 |
x := anEvent x. |
|
11035 |
y := anEvent y. |
|
11036 |
]. |
|
11037 |
]. |
|
11038 |
||
11039 |
anEvent isKeyEvent ifTrue:[ |
|
11040 |
jKeyEventClass := Java classForName:'java.awt.event.KeyEvent'. |
|
11041 |
||
11042 |
key := 0. |
|
11043 |
keyChar := 0. |
|
11044 |
||
11045 |
key := anEvent key. |
|
11046 |
key isCharacter ifTrue:[ |
|
11047 |
key := keyChar := key asciiValue |
|
11048 |
] ifFalse:[ |
|
11049 |
untranslatedKey := anEvent view device keyboardMap keyAtValue:key ifAbsent:key. |
|
482 | 11050 |
untranslatedKey == #Insert ifTrue:[ |
11051 |
key := jKeyEventClass instVarNamed:'VK_INSERT' |
|
11052 |
]. |
|
255 | 11053 |
untranslatedKey == #Delete ifTrue:[ |
11054 |
key := jKeyEventClass instVarNamed:'VK_DELETE' "/ 127 |
|
11055 |
]. |
|
11056 |
untranslatedKey == #BackSpace ifTrue:[ |
|
11057 |
key := jKeyEventClass instVarNamed:'VK_BACK_SPACE' "/ 8 |
|
11058 |
]. |
|
11059 |
untranslatedKey == #Return ifTrue:[ |
|
11060 |
key := jKeyEventClass instVarNamed:'VK_ENTER' "/ 13 |
|
11061 |
]. |
|
11062 |
untranslatedKey == #Tab ifTrue:[ |
|
11063 |
key := jKeyEventClass instVarNamed:'VK_TAB' "/ 9 |
|
11064 |
]. |
|
11065 |
untranslatedKey == #Home ifTrue:[ |
|
11066 |
key := jKeyEventClass instVarNamed:'VK_HOME' |
|
11067 |
]. |
|
11068 |
untranslatedKey == #End ifTrue:[ |
|
11069 |
key := jKeyEventClass instVarNamed:'VK_END' |
|
11070 |
]. |
|
482 | 11071 |
(key == #PreviousPage or:[untranslatedKey == #Prior]) ifTrue:[ |
255 | 11072 |
key := jKeyEventClass instVarNamed:'VK_PAGE_UP' |
11073 |
]. |
|
482 | 11074 |
(key == #NextPage or:[key == #EndOfText]) ifTrue:[ |
255 | 11075 |
key := jKeyEventClass instVarNamed:'VK_PAGE_DOWN' |
11076 |
]. |
|
11077 |
untranslatedKey == #CursorUp ifTrue:[ |
|
11078 |
key := jKeyEventClass instVarNamed:'VK_UP' |
|
11079 |
]. |
|
11080 |
untranslatedKey == #CursorDown ifTrue:[ |
|
11081 |
key := jKeyEventClass instVarNamed:'VK_DOWN' |
|
11082 |
]. |
|
11083 |
untranslatedKey == #CursorLeft ifTrue:[ |
|
11084 |
key := jKeyEventClass instVarNamed:'VK_LEFT' |
|
11085 |
]. |
|
11086 |
untranslatedKey == #CursorRight ifTrue:[ |
|
11087 |
key := jKeyEventClass instVarNamed:'VK_RIGHT' |
|
11088 |
]. |
|
482 | 11089 |
(#( F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12) |
255 | 11090 |
includes:untranslatedKey) ifTrue:[ |
11091 |
key := jKeyEventClass instVarNamed:('VK_' , untranslatedKey) |
|
11092 |
]. |
|
11093 |
]. |
|
11094 |
(type == #'keyPress:x:y:') ifTrue:[ |
|
11095 |
id := jKeyEventClass instVarNamed:'KEY_PRESSED' |
|
11096 |
] ifFalse:[ |
|
11097 |
id := jKeyEventClass instVarNamed:'KEY_RELEASED' |
|
11098 |
]. |
|
261 | 11099 |
jEv := jKeyEventClass newCleared "basicNew". |
255 | 11100 |
jEv instVarNamed:'modifiers' put:modifiers. |
11101 |
jEv instVarNamed:'keyCode' put:key. |
|
11102 |
jEv instVarNamed:'keyChar' put:keyChar. |
|
11103 |
jEv instVarNamed:'id' put:id. |
|
11104 |
"/ jEv instVarNamed:'x' put:x. |
|
11105 |
"/ jEv instVarNamed:'y' put:y. |
|
11106 |
jEv instVarNamed:'when' put:(OperatingSystem getMillisecondTime). |
|
11107 |
^ Array with:jEv |
|
11108 |
]. |
|
11109 |
||
11110 |
(anEvent isButtonEvent |
|
11111 |
or:[anEvent isPointerEnterLeaveEvent]) ifTrue:[ |
|
11112 |
jMouseEventClass := Java classForName:'java.awt.event.MouseEvent'. |
|
11113 |
clickCount := 1. |
|
11114 |
||
11115 |
(type == #'buttonPress:x:y:') ifTrue:[ |
|
270 | 11116 |
id := jMouseEventClass instVarNamed:'MOUSE_PRESSED'. |
255 | 11117 |
] ifFalse:[ |
11118 |
(type == #'buttonRelease:x:y:') ifTrue:[ |
|
270 | 11119 |
id := jMouseEventClass instVarNamed:'MOUSE_RELEASED'. |
255 | 11120 |
] ifFalse:[ |
11121 |
(type == #'buttonMotion:x:y:') ifTrue:[ |
|
439 | 11122 |
anEvent state == 0 ifTrue:[ |
270 | 11123 |
id := jMouseEventClass instVarNamed:'MOUSE_MOVED'. |
11124 |
] ifFalse:[ |
|
11125 |
id := jMouseEventClass instVarNamed:'MOUSE_DRAGGED'. |
|
11126 |
]. |
|
255 | 11127 |
] ifFalse:[ |
11128 |
"/ (type == #'pointerMotion:x:y:') ifTrue:[ |
|
270 | 11129 |
"/ id := jMouseEventClass instVarNamed:'MOUSE_MOVED'. |
255 | 11130 |
"/ ] ifFalse:[ |
11131 |
(type == #'pointerEnter:x:y:') ifTrue:[ |
|
270 | 11132 |
id := jMouseEventClass instVarNamed:'MOUSE_ENTERED'. |
255 | 11133 |
] ifFalse:[ |
11134 |
(type == #'pointerLeave:') ifTrue:[ |
|
270 | 11135 |
id := jMouseEventClass instVarNamed:'MOUSE_EXITED'. |
255 | 11136 |
] ifFalse:[ |
11137 |
(type == #'buttonMultiPress:x:y:') ifTrue:[ |
|
11138 |
id := jMouseEventClass instVarNamed:'MOUSE_PRESSED'. |
|
11139 |
clickCount := 2. |
|
11140 |
] ifFalse:[ |
|
11141 |
self halt. |
|
11142 |
] |
|
11143 |
] |
|
11144 |
"/ ] |
|
11145 |
] |
|
11146 |
] |
|
11147 |
] |
|
11148 |
]. |
|
261 | 11149 |
jEv := jMouseEventClass newCleared "basicNew". |
255 | 11150 |
jEv instVarNamed:'modifiers' put:modifiers. |
11151 |
jEv instVarNamed:'id' put:id. |
|
11152 |
jEv instVarNamed:'x' put:x. |
|
11153 |
jEv instVarNamed:'y' put:y. |
|
11154 |
jEv instVarNamed:'when' put:(OperatingSystem getMillisecondTime). |
|
11155 |
^ Array with:jEv |
|
11156 |
]. |
|
11157 |
||
11158 |
||
11159 |
(type == #'configureX:y:width:height:') ifTrue:[ |
|
261 | 11160 |
view := anEvent view. |
466 | 11161 |
x := eventArgs at:1. |
11162 |
y := eventArgs at:2. |
|
261 | 11163 |
w := eventArgs at:3. |
11164 |
h := eventArgs at:4. |
|
11165 |
||
493 | 11166 |
resized := (w ~~ view width or:[h ~~ view height]). |
11167 |
moved := (x ~~ view left or:[y ~~ view top]). |
|
11168 |
||
11169 |
"/ (view isTopView or:[view isPopUpView]) ifTrue:[ |
|
484 | 11170 |
"/ view must update its origin/extent. |
11171 |
view dispatchEvent:anEvent. |
|
493 | 11172 |
"/ ]. |
466 | 11173 |
|
261 | 11174 |
"/ |
11175 |
"/ must change the components extent |
|
11176 |
"/ is there no cleaner way to do this ? |
|
11177 |
"/ |
|
11178 |
view isTopView ifTrue:[ |
|
484 | 11179 |
view isPopUpView ifFalse:[ |
11180 |
"/ |
|
11181 |
"/ sigh - don't include the menu. |
|
11182 |
"/ |
|
11183 |
menu := self topViewsMenu:view. |
|
11184 |
menu notNil ifTrue:[ |
|
11185 |
"/ must add the menus height |
|
11186 |
h := h - menu height |
|
11187 |
] |
|
261 | 11188 |
] |
11189 |
]. |
|
466 | 11190 |
|
261 | 11191 |
jWin instVarNamed:'width' put:w. |
11192 |
jWin instVarNamed:'height' put:h. |
|
484 | 11193 |
jWin instVarNamed:'x' put:x. |
11194 |
jWin instVarNamed:'y' put:y. |
|
261 | 11195 |
|
255 | 11196 |
jComponentEventClass := Java classForName:'java.awt.event.ComponentEvent'. |
466 | 11197 |
moved ifTrue:[ |
11198 |
id := (jComponentEventClass instVarNamed:'COMPONENT_MOVED'). |
|
11199 |
jEv1 := jComponentEventClass newCleared "basicNew". |
|
11200 |
jEv1 instVarNamed:'id' put:id. |
|
11201 |
]. |
|
11202 |
resized ifTrue:[ |
|
11203 |
id := (jComponentEventClass instVarNamed:'COMPONENT_RESIZED'). |
|
11204 |
jEv2 := jComponentEventClass newCleared "basicNew". |
|
11205 |
jEv2 instVarNamed:'id' put:id. |
|
11206 |
]. |
|
11207 |
jEv1 isNil ifTrue:[ |
|
11208 |
jEv2 isNil ifTrue:[^ nil]. |
|
11209 |
^ Array with:jEv2 |
|
11210 |
] ifFalse:[ |
|
11211 |
jEv2 isNil ifTrue:[ |
|
11212 |
^ Array with:jEv1 |
|
11213 |
] |
|
11214 |
]. |
|
255 | 11215 |
^ Array with:jEv1 with:jEv2. |
11216 |
]. |
|
11217 |
(type == #'focusIn') ifTrue:[ |
|
318 | 11218 |
"/ 'focusIn' printCR. |
255 | 11219 |
jComponentEventClass := Java classForName:'java.awt.event.FocusEvent'. |
11220 |
id := (jComponentEventClass instVarNamed:'FOCUS_GAINED'). |
|
261 | 11221 |
jEv := jComponentEventClass newCleared "basicNew". |
255 | 11222 |
jEv instVarNamed:'id' put:id. |
11223 |
^ Array with:jEv. |
|
11224 |
]. |
|
11225 |
(type == #'focusOut') ifTrue:[ |
|
318 | 11226 |
"/ 'focusOut' printCR. |
255 | 11227 |
jComponentEventClass := Java classForName:'java.awt.event.FocusEvent'. |
11228 |
id := (jComponentEventClass instVarNamed:'FOCUS_LOST'). |
|
261 | 11229 |
jEv := jComponentEventClass newCleared "basicNew". |
255 | 11230 |
jEv instVarNamed:'id' put:id. |
11231 |
^ Array with:jEv. |
|
11232 |
]. |
|
11233 |
(type == #'mapped') ifTrue:[ |
|
318 | 11234 |
"/ 'mapped' printCR. |
255 | 11235 |
jComponentEventClass := Java classForName:'java.awt.event.ComponentEvent'. |
11236 |
id := (jComponentEventClass instVarNamed:'COMPONENT_SHOWN'). |
|
11237 |
"/ x := eventArgs at:1. |
|
11238 |
"/ y := eventArgs at:2. |
|
261 | 11239 |
jEv := jComponentEventClass newCleared "basicNew". |
255 | 11240 |
jEv instVarNamed:'id' put:id. |
11241 |
^ Array with:jEv. |
|
11242 |
]. |
|
11243 |
(type == #'unmapped') ifTrue:[ |
|
318 | 11244 |
"/ 'unmapped' printCR. |
255 | 11245 |
jComponentEventClass := Java classForName:'java.awt.event.ComponentEvent'. |
11246 |
id := (jComponentEventClass instVarNamed:'COMPONENT_HIDDEN'). |
|
11247 |
"/ x := eventArgs at:1. |
|
11248 |
"/ y := eventArgs at:2. |
|
261 | 11249 |
jEv := jComponentEventClass newCleared "basicNew". |
255 | 11250 |
jEv instVarNamed:'id' put:id. |
11251 |
^ Array with:jEv. |
|
11252 |
]. |
|
11253 |
||
11254 |
(type == #terminate) ifTrue:[ |
|
11255 |
jWindowEventClass := Java classForName:'java.awt.event.WindowEvent'. |
|
493 | 11256 |
"NEW |
474 | 11257 |
id := (jWindowEventClass instVarNamed:'WINDOW_CLOSING'). |
493 | 11258 |
" |
11259 |
"OLD " |
|
11260 |
id := (jWindowEventClass instVarNamed:'WINDOW_CLOSED'). |
|
11261 |
" " |
|
261 | 11262 |
jEv := jWindowEventClass newCleared "basicNew". |
255 | 11263 |
jEv instVarNamed:'id' put:id. |
11264 |
^ Array with:jEv. |
|
11265 |
]. |
|
439 | 11266 |
|
319 | 11267 |
EventTrace == true ifTrue:[ |
11268 |
('JAVA: unhandled event:' , type) infoPrintCR. |
|
11269 |
]. |
|
255 | 11270 |
^ nil. |
11271 |
||
11272 |
"Created: / 6.1.1998 / 20:38:58 / cg" |
|
493 | 11273 |
"Modified: / 11.12.1998 / 01:02:08 / cg" |
255 | 11274 |
! |
11275 |
||
11276 |
doWindowsEventThread |
|
11277 |
"invoked in an endless loop by the WToolkit-eventLoop |
|
11278 |
native method." |
|
11279 |
||
270 | 11280 |
|sensor event more| |
255 | 11281 |
|
508 | 11282 |
(JavaWindowGroup isNil or:[KnownWindows isNil]) ifTrue:[ |
11283 |
"/ '*** eventThread: no windowGroup / views ...' printCR. |
|
11284 |
self waitFor:FirstWindowCreationSemaphore state:#eventWait timeOut:nil. |
|
284 | 11285 |
"/ Delay waitForSeconds:0.1. |
270 | 11286 |
^ self |
255 | 11287 |
]. |
11288 |
||
11289 |
"/ wait for an event to arrive ... |
|
11290 |
||
11291 |
sensor := JavaWindowGroup sensor. |
|
329 | 11292 |
[sensor hasEvents or:[sensor damageCount ~~ 0]] whileFalse:[ |
270 | 11293 |
EventTrace ifTrue:[ |
11294 |
'*** eventThread waiting ...' printCR. |
|
11295 |
]. |
|
11296 |
Processor activeProcess state:#eventWait. |
|
508 | 11297 |
self waitFor:sensor eventSemaphore state:#eventWait timeOut:nil. |
255 | 11298 |
]. |
11299 |
||
11300 |
EventTrace ifTrue:[ |
|
270 | 11301 |
'*** eventThread event arrived ...' printCR. |
255 | 11302 |
]. |
11303 |
||
11304 |
"/ EventTrace := true |
|
270 | 11305 |
more := true. |
11306 |
[more] whileTrue:[ |
|
11307 |
sensor hasDamage ifTrue:[ |
|
11308 |
EventTrace ifTrue:[ |
|
11309 |
'*** eventThread: damage arrived ...' printCR. |
|
11310 |
]. |
|
11311 |
event := sensor nextDamage. |
|
11312 |
] ifFalse:[ |
|
11313 |
event := sensor nextEvent. |
|
11314 |
]. |
|
11315 |
event isNil ifTrue:[ |
|
319 | 11316 |
EventTrace == true ifTrue:[ |
11317 |
'*** eventThread: nil event ignored' printCR. |
|
11318 |
]. |
|
270 | 11319 |
^ self |
11320 |
]. |
|
11321 |
||
11322 |
more := self processEvent:event |
|
11323 |
] |
|
255 | 11324 |
|
11325 |
"Created: / 6.1.1998 / 21:02:40 / cg" |
|
508 | 11326 |
"Modified: / 30.12.1998 / 19:21:36 / cg" |
255 | 11327 |
! |
11328 |
||
11329 |
processEvent:event |
|
439 | 11330 |
|evQ jEvents jWToolKitClass jWToolKit jWinPeer jWin v eventConsumed| |
255 | 11331 |
|
11332 |
KnownWindows isNil ifTrue:[ |
|
270 | 11333 |
^ false |
255 | 11334 |
]. |
11335 |
||
11336 |
v := event view. |
|
261 | 11337 |
jWinPeer := self jPeerForView:v. |
255 | 11338 |
jWinPeer isNil ifTrue:[ |
482 | 11339 |
v isJavaView ifTrue:[ |
261 | 11340 |
"/ mhmh - an event for a JavaView, |
11341 |
"/ which has no peer (anyMore ?) |
|
11342 |
"/ should not happen. |
|
11343 |
] ifFalse:[ |
|
11344 |
"/ mhmh - an event for a subcomponent of an ST widget. |
|
11345 |
"/ let it be handled normally. |
|
255 | 11346 |
EventTrace ifTrue:[ |
261 | 11347 |
('*** eventThread: ' , event type , '-event for unknown java-view - passed to view.') printCR. |
255 | 11348 |
]. |
359 | 11349 |
event view dispatchEvent:event. |
255 | 11350 |
]. |
270 | 11351 |
^ true |
261 | 11352 |
]. |
11353 |
||
11354 |
"/ change: |
|
11355 |
"/ in the previous version, events for ST/X widgets (i.e. buttons etc) |
|
11356 |
"/ where not passed to java, but instead forwarded directly to the widget |
|
11357 |
"/ by the code below. |
|
11358 |
"/ This has changed, to pass it to Java, which eventually passes it to the |
|
11359 |
"/ peer via the handleEvent native method (unless the event got consumed). |
|
11360 |
"/ This is req'd to let java keep track of keyboard/mouse input for widgets. |
|
11361 |
||
11362 |
false ifTrue:[ |
|
11363 |
"/ "/ most views handle their events themself (being ST/X views) ... |
|
11364 |
"/ |
|
11365 |
"/ v class ~~ JavaView ifTrue:[ |
|
11366 |
"/"/ v class ~~ StandardSystemView ifTrue:[ |
|
11367 |
"/"/ EventTrace ifTrue:[ |
|
11368 |
"/"/ ('*** eventThread: event handled by view itself (' , v class name , ')') printCR. |
|
11369 |
"/"/ ]. |
|
11370 |
"/"/ event sendEventWithFocusOn:nil. |
|
11371 |
"/"/ ^ self. |
|
11372 |
"/"/ ]. |
|
11373 |
"/ (event type == #'exposeX:y:width:height' |
|
11374 |
"/ or:[event type == #'graphicsExposeX:y:width:height']) ifTrue:[ |
|
11375 |
"/ "/ send to view, but also handle in JAVA |
|
11376 |
"/ event sendEventWithFocusOn:nil. |
|
11377 |
"/ ] |
|
11378 |
"/ ]. |
|
11379 |
||
11380 |
(#( |
|
11381 |
#'mapped' |
|
11382 |
#'unmapped' |
|
11383 |
#'configureX:y:width:height:' |
|
11384 |
#'exposeX:y:width:height:' |
|
11385 |
#'graphicsExposeX:y:width:height:' |
|
11386 |
) includes:event type) ifTrue:[ |
|
255 | 11387 |
event sendEventWithFocusOn:nil. |
11388 |
]. |
|
261 | 11389 |
]. |
11390 |
||
11391 |
"/ what a kludge - some events are passed back to |
|
11392 |
"/ ST via the WComponent-handleEvent native method. |
|
11393 |
"/ However, repaints are not. |
|
11394 |
"/ In order to let ST widgets do the drawing, |
|
11395 |
"/ selectively filter exposeEvents from Java ... |
|
11396 |
||
11397 |
eventConsumed := false. |
|
482 | 11398 |
v isJavaView ifTrue:[ |
261 | 11399 |
"/ all events handled by Java ... |
11400 |
] ifFalse:[ |
|
11401 |
eventConsumed := true. |
|
11402 |
||
11403 |
"/ let widget handle it. |
|
359 | 11404 |
event view dispatchEvent:event. |
261 | 11405 |
|
11406 |
"/ some are not passed to Java ... |
|
11407 |
event isDamage ifTrue:[ |
|
480 | 11408 |
(v isKindOf:Button) ifTrue:[ |
11409 |
^ true |
|
11410 |
]. |
|
261 | 11411 |
(v isKindOf:TextView) ifTrue:[ |
270 | 11412 |
^ true |
11413 |
]. |
|
11414 |
(v isKindOf:Label) ifTrue:[ |
|
11415 |
^ true |
|
11416 |
]. |
|
11417 |
(v isKindOf:ComboBoxView) ifTrue:[ |
|
11418 |
^ true |
|
11419 |
]. |
|
11420 |
(v isKindOf:ScrollBar) ifTrue:[ |
|
482 | 11421 |
^ true |
261 | 11422 |
]. |
270 | 11423 |
(v isKindOf:Scroller) ifTrue:[ |
482 | 11424 |
^ true |
261 | 11425 |
]. |
270 | 11426 |
(v isKindOf:MenuPanel) ifTrue:[ |
11427 |
^ true |
|
11428 |
]. |
|
261 | 11429 |
]. |
11430 |
]. |
|
255 | 11431 |
|
11432 |
jWin := jWinPeer instVarNamed:'target'. |
|
11433 |
||
11434 |
EventTrace ifTrue:[ |
|
11435 |
('*** eventThread: event (' , event type , ') handled by JAVA: ') infoPrint. |
|
11436 |
jWinPeer class name infoPrint. ' (' infoPrint. |
|
11437 |
jWin class name infoPrint. ')' infoPrintCR. |
|
11438 |
]. |
|
11439 |
||
11440 |
"/ create an event |
|
11441 |
||
11442 |
jEvents := self awtEventsForEvent:event javaWindow:jWin. |
|
11443 |
jEvents isNil ifTrue:[ |
|
11444 |
EventTrace ifTrue:[ |
|
11445 |
('*** eventThread: event ignored: ' , event type) printCR. |
|
11446 |
]. |
|
270 | 11447 |
^ true |
255 | 11448 |
]. |
11449 |
||
11450 |
"/ v superView isNil ifTrue:[ |
|
11451 |
"/ ('*** eventThread: event ignored for topView: ' , event type) printCR. |
|
11452 |
"/ ^ self |
|
11453 |
"/ ]. |
|
11454 |
||
439 | 11455 |
jWToolKitClass := Java classForName:'java.awt.Toolkit'. |
11456 |
"/ jWToolKit := jWToolKitClass perform:#getDefaultToolkit. |
|
11457 |
jWToolKit := jWToolKitClass performStatic:#'getDefaultToolkit()Ljava/awt/Toolkit;'. |
|
255 | 11458 |
|
11459 |
jEvents do:[:jEv | |
|
11460 |
jEv instVarNamed:'source' put:jWin. |
|
11461 |
jEv instVarNamed:'consumed' put:0. |
|
261 | 11462 |
eventConsumed ifFalse:[ |
11463 |
"/ the first gets the original event as data |
|
11464 |
jEv instVarNamed:'data' put:event. |
|
11465 |
eventConsumed := true |
|
11466 |
]. |
|
255 | 11467 |
|
11468 |
"/ post it (them) to the event queue |
|
318 | 11469 |
EventTrace == true ifTrue:[ |
11470 |
'postEvent to Java ...' printCR. |
|
11471 |
]. |
|
439 | 11472 |
jWToolKit "class" perform:#'postEvent(Ljava/awt/AWTEvent;)V' with:jEv. |
255 | 11473 |
]. |
11474 |
||
270 | 11475 |
^ false |
11476 |
||
255 | 11477 |
"Created: / 6.1.1998 / 20:36:36 / cg" |
493 | 11478 |
"Modified: / 10.12.1998 / 19:36:59 / cg" |
255 | 11479 |
! ! |
11480 |
||
253 | 11481 |
!JavaVM class methodsFor:'documentation'! |
11482 |
||
11483 |
version |
|
535 | 11484 |
^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaVM.st,v 1.129 1999/01/09 00:12:22 cg Exp $' |
253 | 11485 |
! ! |
11486 |
JavaVM initialize! |