author | cg |
Thu, 07 Jan 1999 16:19:23 +0000 | |
changeset 515 | 7255c2c14e91 |
parent 514 | a1f3d99a4194 |
child 516 | 363d2736f90d |
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 |
||
480 | 15 |
Object variableSubclass:#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 |
|
442 | 30 |
NoAudio FirstWindowCreationSemaphore ScreenUpdaterProcess |
495 | 31 |
PermittedDirectories PermittedHostConnects SimulatedOS |
32 |
O_WGgraphics_originX O_WGgraphics_originY O_WGgraphics_pData |
|
504 | 33 |
O_FramePeer_pNativeWidget O_FramePeer_pData ImageStretchCache |
34 |
LastGraphics LastGC' |
|
253 | 35 |
poolDictionaries:'' |
36 |
category:'Java-Support' |
|
37 |
! |
|
38 |
||
261 | 39 |
!JavaVM class methodsFor:'documentation'! |
40 |
||
454 | 41 |
copyright |
42 |
" |
|
43 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
44 |
All Rights Reserved |
|
45 |
||
46 |
This software is furnished under a license and may be used |
|
47 |
only in accordance with the terms of that license and with the |
|
48 |
inclusion of the above copyright notice. This software may not |
|
49 |
be provided or otherwise made available to, or used by, any |
|
50 |
other person. No title to or ownership of the software is |
|
51 |
hereby transferred. |
|
52 |
" |
|
53 |
||
54 |
||
55 |
! |
|
56 |
||
261 | 57 |
nativeMethods |
58 |
" |
|
440 | 59 |
all native methods: |
60 |
||
61 |
JavaMethod allSubInstances select:[:m | |
|
62 |
m isNative |
|
63 |
] |
|
64 |
||
65 |
implemented methods: |
|
66 |
||
67 |
JavaMethod allSubInstances select:[:m | |
|
68 |
|sel| |
|
69 |
||
70 |
m isNative ifTrue:[ |
|
71 |
sel := ('_' , m javaClass lastName , '_' , m name , ':') asSymbol. |
|
72 |
JavaVM class implements:sel. |
|
73 |
] ifFalse:[ |
|
74 |
false |
|
75 |
] |
|
76 |
] |
|
77 |
||
78 |
unimplemented methods: |
|
79 |
||
80 |
JavaMethod allSubInstances select:[:m | |
|
81 |
|sel| |
|
82 |
||
83 |
m isNative ifTrue:[ |
|
84 |
sel := ('_' , m javaClass lastName , '_' , m name , ':') asSymbol. |
|
85 |
(JavaVM class implements:sel) not |
|
86 |
] ifFalse:[ |
|
87 |
false |
|
88 |
] |
|
89 |
] |
|
90 |
||
91 |
||
261 | 92 |
list of all native methods as in jdk1.1.3: |
93 |
||
94 |
X - implemented |
|
494 | 95 |
* - implemented to be validated |
261 | 96 |
x - implemented with limited functionality |
97 |
o - implemented as dummy (no functionality) |
|
98 |
||
99 |
X (Math::double sin (double)) |
|
100 |
X (Math::double cos (double)) |
|
342 | 101 |
X (Math::double tan (double)) |
102 |
X (Math::double asin (double)) |
|
103 |
X (Math::double acos (double)) |
|
104 |
X (Math::double atan (double)) |
|
105 |
X (Math::double exp (double)) |
|
261 | 106 |
X (Math::double log (double)) |
107 |
X (Math::double sqrt (double)) |
|
108 |
(Math::double IEEEremainder (double double)) |
|
109 |
X (Math::double ceil (double)) |
|
110 |
X (Math::double floor (double)) |
|
111 |
(Math::double rint (double)) |
|
112 |
(Math::double atan2 (double double)) |
|
113 |
X (Math::double pow (double double)) |
|
114 |
||
115 |
X (Class::java.lang.Class forName (java.lang.String)) |
|
116 |
X (Class::java.lang.Object newInstance ()) |
|
494 | 117 |
* (Class::boolean isInstance (java.lang.Object)) |
118 |
X (Class::boolean isAssignableFrom (java.lang.Class)) |
|
261 | 119 |
X (Class::boolean isInterface ()) |
120 |
(Class::boolean isArray ()) |
|
342 | 121 |
X (Class::boolean isPrimitive ()) |
261 | 122 |
X (Class::java.lang.String getName ()) |
123 |
X (Class::java.lang.ClassLoader getClassLoader ()) |
|
124 |
X (Class::java.lang.Class getSuperclass ()) |
|
125 |
(Class::java.lang.Class[] getInterfaces ()) |
|
126 |
(Class::java.lang.Class getComponentType ()) |
|
127 |
(Class::int getModifiers ()) |
|
128 |
(Class::java.lang.Object[] getSigners ()) |
|
129 |
(Class::void setSigners (java.lang.Object[])) |
|
130 |
X (Class::java.lang.Class getPrimitiveClass (java.lang.String)) |
|
494 | 131 |
(Class::java.lang.reflect.Field getField0 (java.lang.String int)) |
261 | 132 |
(Class::java.lang.reflect.Field[] getFields0 (int)) |
494 | 133 |
X (Class::java.lang.reflect.Method getMethod0 (java.lang.String java.lang.Class[] int)) |
342 | 134 |
X (Class::java.lang.reflect.Method[] getMethods0 (int)) |
261 | 135 |
(Class::java.lang.reflect.Constructor[] getConstructors0 (int)) |
136 |
(Class::java.lang.reflect.Constructor getConstructor0 (java.lang.Class[] int)) |
|
137 |
||
138 |
X (InetAddressImpl::java.lang.String getLocalHostName ()) |
|
139 |
X (InetAddressImpl::void makeAnyLocalAddress (java.net.InetAddress)) |
|
140 |
X (InetAddressImpl::byte[][] lookupAllHostAddr (java.lang.String)) |
|
141 |
(InetAddressImpl::java.lang.String getHostByAddr (int)) |
|
142 |
X (InetAddressImpl::int getInetFamily ()) |
|
143 |
||
144 |
X (ResourceBundle::java.lang.Class[] getClassContext ()) |
|
145 |
||
146 |
X (System::void setIn0 (java.io.InputStream)) |
|
147 |
X (System::void setOut0 (java.io.PrintStream)) |
|
148 |
X (System::void setErr0 (java.io.PrintStream)) |
|
149 |
X (System::long currentTimeMillis ()) |
|
150 |
X (System::void arraycopy (java.lang.Object int java.lang.Object int int)) |
|
151 |
(System::int identityHashCode (java.lang.Object)) |
|
152 |
X (System::java.util.Properties initProperties (java.util.Properties)) |
|
153 |
||
154 |
X (Thread::java.lang.Thread currentThread ()) |
|
155 |
X (Thread::void yield ()) |
|
156 |
X (Thread::void sleep (long)) |
|
157 |
X (Thread::void start ()) |
|
158 |
X (Thread::boolean isInterrupted (boolean)) |
|
159 |
X (Thread::boolean isAlive ()) |
|
160 |
(Thread::int countStackFrames ()) |
|
161 |
X (Thread::void setPriority0 (int)) |
|
162 |
X (Thread::void stop0 (java.lang.Object)) |
|
163 |
X (Thread::void suspend0 ()) |
|
164 |
X (Thread::void resume0 ()) |
|
494 | 165 |
* (Thread::void interrupt0 ()) |
261 | 166 |
|
342 | 167 |
(String::java.lang.String intern ()) |
261 | 168 |
|
169 |
X (Float::int floatToIntBits (float)) |
|
170 |
X (Float::float intBitsToFloat (int)) |
|
171 |
||
172 |
(ObjectStreamClass::int getClassAccess (java.lang.Class)) |
|
173 |
(ObjectStreamClass::java.lang.String[] getMethodSignatures (java.lang.Class)) |
|
174 |
(ObjectStreamClass::int getMethodAccess (java.lang.Class java.lang.String)) |
|
175 |
(ObjectStreamClass::java.lang.String[] getFieldSignatures (java.lang.Class)) |
|
176 |
(ObjectStreamClass::int getFieldAccess (java.lang.Class java.lang.String)) |
|
177 |
(ObjectStreamClass::java.io.ObjectStreamField[] getFields0 (java.lang.Class)) |
|
178 |
(ObjectStreamClass::long getSerialVersionUID (java.lang.Class)) |
|
179 |
(ObjectStreamClass::boolean hasWriteObject (java.lang.Class)) |
|
180 |
(ObjectInputStream::java.lang.Class loadClass0 (java.lang.Class java.lang.String)) |
|
181 |
(ObjectInputStream::void inputClassFields (java.lang.Object java.lang.Class int[])) |
|
182 |
(ObjectInputStream::java.lang.Object allocateNewObject (java.lang.Class java.lang.Class)) |
|
183 |
(ObjectInputStream::java.lang.Object allocateNewArray (java.lang.Class int)) |
|
184 |
(ObjectInputStream::boolean invokeObjectReader (java.lang.Object java.lang.Class)) |
|
185 |
||
186 |
(SecurityManager::java.lang.Class[] getClassContext ()) |
|
187 |
X (SecurityManager::java.lang.ClassLoader currentClassLoader ()) |
|
188 |
(SecurityManager::int classDepth (java.lang.String)) |
|
189 |
X (SecurityManager::int classLoaderDepth ()) |
|
190 |
(SecurityManager::java.lang.Class currentLoadedClass0 ()) |
|
191 |
||
192 |
X (ClassLoader::void init ()) |
|
193 |
X (ClassLoader::java.lang.Class defineClass0 (java.lang.String byte[] int int)) |
|
194 |
X (ClassLoader::void resolveClass0 (java.lang.Class)) |
|
195 |
X (ClassLoader::java.lang.Class findSystemClass0 (java.lang.String)) |
|
196 |
X (ClassLoader::java.io.InputStream getSystemResourceAsStream0 (java.lang.String)) |
|
197 |
(ClassLoader::java.lang.String getSystemResourceAsName0 (java.lang.String)) |
|
198 |
||
199 |
(FileDescriptor::boolean valid ()) |
|
200 |
(FileDescriptor::void sync ()) |
|
201 |
X (FileDescriptor::java.io.FileDescriptor initSystemFD (java.io.FileDescriptor int)) |
|
202 |
||
203 |
X (Object::java.lang.Class getClass ()) |
|
204 |
X (Object::int hashCode ()) |
|
205 |
X (Object::java.lang.Object clone ()) |
|
206 |
X (Object::void notify ()) |
|
207 |
X (Object::void notifyAll ()) |
|
208 |
X (Object::void wait (long)) |
|
209 |
||
210 |
X (FileOutputStream::void open (java.lang.String)) |
|
342 | 211 |
X (FileOutputStream::void openAppend (java.lang.String)) |
261 | 212 |
X (FileOutputStream::void write (int)) |
213 |
X (FileOutputStream::void writeBytes (byte[] int int)) |
|
214 |
X (FileOutputStream::void close ()) |
|
215 |
X (FileInputStream::void open (java.lang.String)) |
|
216 |
X (FileInputStream::int read ()) |
|
217 |
X (FileInputStream::int readBytes (byte[] int int)) |
|
218 |
(FileInputStream::long skip (long)) |
|
219 |
X (FileInputStream::int available ()) |
|
220 |
X (FileInputStream::void close ()) |
|
221 |
||
222 |
(VM::int getState ()) |
|
223 |
(VM::boolean threadsSuspended ()) |
|
224 |
(VM::void unsuspendThreads ()) |
|
225 |
(VM::void unsuspendSomeThreads ()) |
|
226 |
||
227 |
X (File::boolean exists0 ()) |
|
342 | 228 |
X (File::boolean canWrite0 ()) |
261 | 229 |
X (File::boolean canRead0 ()) |
230 |
X (File::boolean isFile0 ()) |
|
231 |
X (File::boolean isDirectory0 ()) |
|
342 | 232 |
X (File::long lastModified0 ()) |
261 | 233 |
X (File::long length0 ()) |
342 | 234 |
X (File::boolean mkdir0 ()) |
494 | 235 |
X (File::boolean renameTo0 (java.io.File)) |
236 |
X (File::boolean delete0 ()) |
|
261 | 237 |
(File::boolean rmdir0 ()) |
238 |
X (File::java.lang.String[] list0 ()) |
|
239 |
(File::java.lang.String canonPath (java.lang.String)) |
|
240 |
X (File::boolean isAbsolute ()) |
|
241 |
||
242 |
(ObjectOutputStream::void outputClassFields (java.lang.Object java.lang.Class int[])) |
|
243 |
(ObjectOutputStream::boolean invokeObjectWriter (java.lang.Object java.lang.Class)) |
|
244 |
||
245 |
X (Throwable::void printStackTrace0 (java.lang.Object)) |
|
246 |
X (Throwable::java.lang.Throwable fillInStackTrace ()) |
|
247 |
||
248 |
X (Double::long doubleToLongBits (double)) |
|
249 |
X (Double::double longBitsToDouble (long)) |
|
250 |
X (Double::double valueOf0 (java.lang.String)) |
|
251 |
||
252 |
X (Runtime::void exitInternal (int)) |
|
494 | 253 |
o (Runtime::void runFinalizersOnExit0 (boolean)) |
261 | 254 |
o (Runtime::java.lang.Process execInternal (java.lang.String[] java.lang.String[])) |
255 |
X (Runtime::long freeMemory ()) |
|
256 |
X (Runtime::long totalMemory ()) |
|
257 |
X (Runtime::void gc ()) |
|
258 |
(Runtime::void runFinalization ()) |
|
259 |
(Runtime::void traceInstructions (boolean)) |
|
260 |
(Runtime::void traceMethodCalls (boolean)) |
|
261 |
X (Runtime::java.lang.String initializeLinkerInternal ()) |
|
262 |
X (Runtime::java.lang.String buildLibName (java.lang.String java.lang.String)) |
|
263 |
X (Runtime::int loadFileInternal (java.lang.String)) |
|
264 |
||
265 |
(WDrawingSurfaceInfo::int lock ()) |
|
266 |
(WDrawingSurfaceInfo::void unlock ()) |
|
267 |
(WDrawingSurfaceInfo::int getHWnd ()) |
|
268 |
(WDrawingSurfaceInfo::int getHBitmap ()) |
|
269 |
(WDrawingSurfaceInfo::int getPBits ()) |
|
270 |
(WDrawingSurfaceInfo::int getHDC ()) |
|
271 |
(WDrawingSurfaceInfo::int getDepth ()) |
|
272 |
(WDrawingSurfaceInfo::int getHPalette ()) |
|
273 |
||
274 |
X (WDefaultFontCharset::boolean canConvert (char)) |
|
275 |
||
276 |
(ColorModel::void deletepData ()) |
|
277 |
X (WToolkit::void init (java.lang.Thread)) |
|
278 |
X (WToolkit::void eventLoop ()) |
|
279 |
(WToolkit::java.awt.image.ColorModel makeColorModel ()) |
|
342 | 280 |
X (WToolkit::int getScreenResolution ()) |
261 | 281 |
X (WToolkit::int getScreenWidth ()) |
282 |
X (WToolkit::int getScreenHeight ()) |
|
283 |
(WToolkit::void sync ()) |
|
494 | 284 |
* (WToolkit::void beep ()) |
261 | 285 |
X (WToolkit::void loadSystemColors (int[])) |
286 |
||
287 |
(WPrintJob::void end ()) |
|
288 |
||
289 |
X (WDialogPeer::void create (sun.awt.windows.WComponentPeer)) |
|
290 |
X (WDialogPeer::void _show ()) |
|
291 |
X (WDialogPeer::void _hide ()) |
|
292 |
||
342 | 293 |
X (WWindowPeer::void toFront ()) |
294 |
X (WWindowPeer::void toBack ()) |
|
295 |
X (WWindowPeer::void _setTitle (java.lang.String)) |
|
296 |
X (WWindowPeer::void _setResizable (boolean)) |
|
494 | 297 |
X (WWindowPeer::void create (sun.awt.windows.WComponentPeer)) |
342 | 298 |
o (WWindowPeer::void updateInsets (java.awt.Insets)) |
261 | 299 |
(WWindowPeer::java.awt.Component getContainerElement (java.awt.Container int)) |
300 |
||
301 |
X (WCanvasPeer::void create (sun.awt.windows.WComponentPeer)) |
|
302 |
||
303 |
X (WTextAreaPeer::void create (sun.awt.windows.WComponentPeer)) |
|
304 |
X (WTextAreaPeer::void insertText (java.lang.String int)) |
|
305 |
(WTextAreaPeer::void replaceText (java.lang.String int int)) |
|
306 |
||
307 |
X (WTextComponentPeer::java.lang.String getText ()) |
|
308 |
X (WTextComponentPeer::void setText (java.lang.String)) |
|
309 |
X (WTextComponentPeer::int getSelectionStart ()) |
|
310 |
X (WTextComponentPeer::int getSelectionEnd ()) |
|
311 |
X (WTextComponentPeer::void select (int int)) |
|
312 |
X (WTextComponentPeer::void enableEditing (boolean)) |
|
313 |
||
314 |
X (WComponentPeer::void show ()) |
|
315 |
X (WComponentPeer::void hide ()) |
|
316 |
X (WComponentPeer::void enable ()) |
|
317 |
X (WComponentPeer::void disable ()) |
|
494 | 318 |
X (WComponentPeer::java.awt.Point getLocationOnScreen ()) |
261 | 319 |
X (WComponentPeer::void reshape (int int int int)) |
320 |
o (WComponentPeer::void handleEvent (java.awt.AWTEvent)) |
|
321 |
o (WComponentPeer::void _dispose ()) |
|
322 |
X (WComponentPeer::void _setForeground (int)) |
|
323 |
X (WComponentPeer::void _setBackground (int)) |
|
324 |
o (WComponentPeer::void setFont (java.awt.Font)) |
|
325 |
o (WComponentPeer::void requestFocus ()) |
|
326 |
o (WComponentPeer::void setCursor (java.awt.Cursor)) |
|
327 |
o (WComponentPeer::void start ()) |
|
328 |
(WComponentPeer::void _beginValidate ()) |
|
329 |
(WComponentPeer::void endValidate ()) |
|
330 |
o (WComponentPeer::void setZOrderPosition (sun.awt.windows.WComponentPeer)) |
|
331 |
||
332 |
X (WFramePeer::void setMenuBar0 (sun.awt.windows.WMenuBarPeer)) |
|
333 |
X (WFramePeer::void create (sun.awt.windows.WComponentPeer)) |
|
342 | 334 |
X (WFramePeer::void _setIconImage (sun.awt.image.ImageRepresentation)) |
261 | 335 |
|
336 |
o (WFontMetrics::boolean needsConversion (java.awt.Font sun.awt.FontDescriptor)) |
|
337 |
o (WFontMetrics::int getMFCharSegmentWidth (java.awt.Font sun.awt.FontDescriptor boolean char[] int int byte[] int)) |
|
338 |
(WFontMetrics::int bytesWidth (byte[] int int)) |
|
339 |
(WFontMetrics::void init ()) |
|
340 |
||
341 |
o (WChoicePeer::void select (int)) |
|
342 |
o (WChoicePeer::void remove (int)) |
|
343 |
o (WChoicePeer::void addItem (java.lang.String int)) |
|
344 |
X (WChoicePeer::void reshape (int int int int)) |
|
345 |
X (WChoicePeer::void create (sun.awt.windows.WComponentPeer)) |
|
346 |
||
347 |
X (WLabelPeer::void setText (java.lang.String)) |
|
348 |
o (WLabelPeer::void setAlignment (int)) |
|
349 |
X (WLabelPeer::void create (sun.awt.windows.WComponentPeer)) |
|
350 |
||
351 |
X (WMenuItemPeer::void _setLabel (java.lang.String)) |
|
352 |
X (WMenuItemPeer::void create (sun.awt.windows.WMenuPeer)) |
|
353 |
X (WMenuItemPeer::void enable (boolean)) |
|
342 | 354 |
o (WMenuItemPeer::void _dispose ()) |
261 | 355 |
(WMenuPeer::void addSeparator ()) |
356 |
(WMenuPeer::void delItem (int)) |
|
357 |
X (WMenuPeer::void createMenu (sun.awt.windows.WMenuBarPeer)) |
|
358 |
(WMenuPeer::void createSubMenu (sun.awt.windows.WMenuPeer)) |
|
359 |
||
360 |
(WPopupMenuPeer::void createMenu (sun.awt.windows.WComponentPeer)) |
|
361 |
(WPopupMenuPeer::void _show (java.awt.Event)) |
|
362 |
(WMenuBarPeer::void addMenu (java.awt.Menu)) |
|
363 |
(WMenuBarPeer::void delMenu (int)) |
|
364 |
X (WMenuBarPeer::void create (sun.awt.windows.WFramePeer)) |
|
365 |
||
366 |
(WCheckboxMenuItemPeer::void setState (boolean)) |
|
367 |
||
368 |
X (WFileDialogPeer::void show ()) |
|
369 |
||
370 |
X (WCheckboxPeer::void setState (boolean)) |
|
371 |
X (WCheckboxPeer::void setCheckboxGroup (java.awt.CheckboxGroup)) |
|
372 |
(WCheckboxPeer::void setLabel (java.lang.String)) |
|
373 |
X (WCheckboxPeer::void create (sun.awt.windows.WComponentPeer)) |
|
374 |
||
375 |
X (WClipboard::void init ()) |
|
376 |
(WClipboard::void setClipboardText (java.awt.datatransfer.StringSelection)) |
|
377 |
(WClipboard::java.lang.String getClipboardText ()) |
|
378 |
||
342 | 379 |
X (WListPeer::void addItem (java.lang.String int)) |
380 |
X (WListPeer::void delItems (int int)) |
|
381 |
X (WListPeer::void select (int)) |
|
261 | 382 |
(WListPeer::void deselect (int)) |
383 |
(WListPeer::void makeVisible (int)) |
|
342 | 384 |
X (WListPeer::void setMultipleSelections (boolean)) |
385 |
X (WListPeer::void create (sun.awt.windows.WComponentPeer)) |
|
386 |
X (WListPeer::boolean isSelected (int)) |
|
387 |
||
388 |
x (WScrollbarPeer::void _setValues (int int int int)) |
|
389 |
x (WScrollbarPeer::void setLineIncrement (int)) |
|
390 |
x (WScrollbarPeer::void setPageIncrement (int)) |
|
391 |
x (WScrollbarPeer::void create (sun.awt.windows.WComponentPeer)) |
|
392 |
||
393 |
x (ImageRepresentation::void offscreenInit (java.awt.Color)) |
|
261 | 394 |
x (ImageRepresentation::boolean setBytePixels (int int int int java.awt.image.ColorModel byte[] int int)) |
342 | 395 |
x (ImageRepresentation::boolean setIntPixels (int int int int java.awt.image.ColorModel int[] int int)) |
261 | 396 |
x (ImageRepresentation::boolean finish (boolean)) |
397 |
X (ImageRepresentation::void imageDraw (java.awt.Graphics int int java.awt.Color)) |
|
398 |
x (ImageRepresentation::void imageStretch (java.awt.Graphics int int int int int int int int java.awt.Color)) |
|
399 |
x (ImageRepresentation::void disposeImage ()) |
|
400 |
||
401 |
X (WTextFieldPeer::void create (sun.awt.windows.WComponentPeer)) |
|
342 | 402 |
X (WTextFieldPeer::void setEchoCharacter (char)) |
403 |
||
404 |
X (WScrollPanePeer::void create (sun.awt.windows.WComponentPeer)) |
|
405 |
o (WScrollPanePeer::int getOffset (int)) |
|
261 | 406 |
(WScrollPanePeer::void setInsets ()) |
407 |
(WScrollPanePeer::void setScrollPosition (int int)) |
|
342 | 408 |
x (WScrollPanePeer::int _getHScrollbarHeight ()) |
409 |
x (WScrollPanePeer::int _getVScrollbarWidth ()) |
|
410 |
o (WScrollPanePeer::void setSpans (int int int int)) |
|
261 | 411 |
(WScrollPanePeer::java.awt.Component getScrollChild ()) |
412 |
||
413 |
(WEmbeddedFramePeer::void create (sun.awt.windows.WComponentPeer)) |
|
342 | 414 |
X (WButtonPeer::void setLabel (java.lang.String)) |
261 | 415 |
X (WButtonPeer::void create (sun.awt.windows.WComponentPeer)) |
416 |
||
417 |
x (WColor::java.awt.Color getDefaultColor (int)) |
|
418 |
||
419 |
x (GifImageDecoder::boolean parseImage (int int int int boolean int byte[] byte[] java.awt.image.IndexColorModel)) |
|
420 |
||
421 |
x (WGraphics::void createFromComponent (sun.awt.windows.WComponentPeer)) |
|
422 |
x (WGraphics::void createFromGraphics (sun.awt.windows.WGraphics)) |
|
423 |
(WGraphics::void createFromPrintJob (sun.awt.windows.WPrintJob)) |
|
424 |
(WGraphics::void createFromHDC (int)) |
|
425 |
x (WGraphics::void imageCreate (sun.awt.image.ImageRepresentation)) |
|
426 |
x (WGraphics::void pSetFont (java.awt.Font)) |
|
427 |
X (WGraphics::void pSetForeground (int)) |
|
428 |
(WGraphics::void _dispose ()) |
|
429 |
x (WGraphics::void dispose ()) |
|
430 |
x (WGraphics::void setPaintMode ()) |
|
342 | 431 |
x (WGraphics::void setXORMode (java.awt.Color)) |
261 | 432 |
o (WGraphics::java.awt.Rectangle getClipBounds ()) |
433 |
o (WGraphics::void changeClip (int int int int boolean)) |
|
434 |
(WGraphics::void removeClip ()) |
|
435 |
X (WGraphics::void clearRect (int int int int)) |
|
436 |
X (WGraphics::void fillRect (int int int int)) |
|
437 |
X (WGraphics::void drawRect (int int int int)) |
|
438 |
(WGraphics::void drawSFChars (char[] int int int int)) |
|
439 |
x (WGraphics::int drawMFCharsSegment (java.awt.Font sun.awt.FontDescriptor char[] int int int int)) |
|
440 |
(WGraphics::int drawMFCharsConvertedSegment (java.awt.Font sun.awt.FontDescriptor byte[] int int int)) |
|
441 |
(WGraphics::void drawBytes (byte[] int int int int)) |
|
442 |
X (WGraphics::void drawLine (int int int int)) |
|
342 | 443 |
X (WGraphics::void copyArea (int int int int int int)) |
261 | 444 |
o (WGraphics::void drawRoundRect (int int int int int int)) |
445 |
o (WGraphics::void fillRoundRect (int int int int int int)) |
|
446 |
X (WGraphics::void drawPolygon (int[] int[] int)) |
|
447 |
(WGraphics::void drawPolyline (int[] int[] int)) |
|
448 |
X (WGraphics::void fillPolygon (int[] int[] int)) |
|
449 |
x (WGraphics::void drawOval (int int int int)) |
|
450 |
x (WGraphics::void fillOval (int int int int)) |
|
451 |
x (WGraphics::void drawArc (int int int int int int)) |
|
452 |
x (WGraphics::void fillArc (int int int int int int)) |
|
453 |
(WGraphics::void print (sun.awt.windows.WComponentPeer)) |
|
454 |
(WGraphics::void close (sun.awt.windows.WPrintJob)) |
|
455 |
(JPEGImageDecoder::void readImage (java.io.InputStream byte[])) |
|
342 | 456 |
o (OffScreenImageSource::void sendPixels ()) |
457 | 457 |
|
458 |
||
459 |
additional native methods added by microsoft (sigh): |
|
460 |
||
461 |
X (java.lang.String::boolean equals (java.lang.String)) |
|
462 |
X (java.lang.String::int length (java.lang.String)) |
|
463 |
o (java.lang.Runtime::void setInputStreamLocalised (java.io.DataInputStream)) |
|
464 |
o (java.lang.Runtime::void setOutputStreamLocalised (java.io.DataOutputStream)) |
|
465 |
||
466 |
(java.lang.String::int compareTo (java.lang.String)) |
|
467 |
(java.lang.String::boolean equalsIgnoreCase (java.lang.String)) |
|
468 |
(java.lang.String::int indexOf (java.lang.String int)) |
|
469 |
(java.lang.String::boolean startsWith (java.lang.String int)) |
|
470 |
(java.lang.String::boolean regionMatches (int java.lang.String int int)) |
|
471 |
(java.lang.String::boolean regionMatches (boolean int java.lang.String int int)) |
|
472 |
(java.lang.String::int lastIndexOf (java.lang.String int)) |
|
473 |
(java.lang.ClassLoader::void resolveClass (java.lang.Class)) |
|
474 |
(java.lang.ClassLoader::java.lang.Class createArrayClass (java.lang.String java.lang.Class)) |
|
475 |
(java.io.PrintStream::boolean isOutputStreamLocalised (java.io.DataOutputStream)) |
|
476 |
(java.lang.Runtime::boolean isOutputStreamLocalised (java.io.DataOutputStream)) |
|
477 |
(java.lang.Runtime::boolean isInputStreamLocalised (java.io.DataInputStream)) |
|
478 |
(java.lang.ThreadGroup::void initMainThreadGroup0 (java.lang.ThreadGroup)) |
|
479 |
(java.lang.System::void validateSecurityManager (java.lang.SecurityManager)) |
|
480 |
(java.lang.Class::java.lang.reflect.Method getMethod2 (int java.lang.String java.lang.String)) |
|
481 |
(java.io.ObjectOutputStream::void invokeDefaultWriteObject (java.lang.Object java.lang.Class)) |
|
482 |
(java.io.ObjectOutputStream::void invokeWriteObject (java.lang.Object java.lang.Class)) |
|
483 |
(java.io.ObjectInputStream::void invokeDefaultReadObject (java.lang.Object java.lang.Class)) |
|
484 |
(java.io.ObjectInputStream::void invokeReadObject (java.lang.Object java.lang.Class)) |
|
485 |
(java.util.TimeZone::java.util.TimeZone getWin32TimeZone ()) |
|
486 |
(java.net.InetAddress::java.lang.Object[] lookupHostByName (java.lang.String)) |
|
487 |
(java.net.InetAddress::java.lang.Object[] lookupHostByAddr (int)) |
|
488 |
(java.io.ObjectStreamClass::void doMismatchedRead (java.io.ObjectInputStream java.lang.Object)) |
|
489 |
(java.io.ObjectStreamClass::long getClassDefinedUID (java.lang.Class)) |
|
490 |
(java.io.ObjectStreamClass::boolean findObjectMethod0 (java.lang.Class int)) |
|
491 |
(java.lang.reflect.Method::java.lang.String getDescriptor ()) |
|
492 |
(java.lang.reflect.Array::void setShort (java.lang.Object int unsigned short)) |
|
493 |
(java.lang.reflect.Array::char getChar (java.lang.Object int)) |
|
494 |
(java.lang.reflect.Array::void setChar (java.lang.Object int char)) |
|
495 |
(java.lang.reflect.Array::void setDouble (java.lang.Object int double)) |
|
496 |
(java.lang.reflect.Array::java.lang.Object get (java.lang.Object int)) |
|
497 |
(java.lang.reflect.Array::void set (java.lang.Object int java.lang.Object)) |
|
498 |
(java.lang.reflect.Array::int getInt (java.lang.Object int)) |
|
499 |
(java.lang.reflect.Array::void setInt (java.lang.Object int int)) |
|
500 |
(java.lang.reflect.Array::java.lang.Object multiNewArray (java.lang.Class int[])) |
|
501 |
(java.lang.reflect.Array::boolean getBoolean (java.lang.Object int)) |
|
502 |
(java.lang.reflect.Array::byte getByte (java.lang.Object int)) |
|
503 |
(java.lang.reflect.Array::float getFloat (java.lang.Object int)) |
|
504 |
(java.lang.reflect.Array::void setBoolean (java.lang.Object int boolean)) |
|
505 |
(java.lang.reflect.Array::long getLong (java.lang.Object int)) |
|
506 |
(java.lang.reflect.Array::void setByte (java.lang.Object int byte)) |
|
507 |
(java.lang.reflect.Array::void setLong (java.lang.Object int long)) |
|
508 |
(java.lang.reflect.Array::void setFloat (java.lang.Object int float)) |
|
509 |
(java.lang.reflect.Array::java.lang.Object newArray (java.lang.Class int)) |
|
510 |
(java.lang.reflect.Array::int getLength (java.lang.Object)) |
|
511 |
(java.lang.reflect.Array::unsigned short getShort (java.lang.Object int)) |
|
512 |
(java.lang.reflect.Array::double getDouble (java.lang.Object int)) |
|
513 |
(java.lang.reflect.Field::void setShort (java.lang.Object unsigned short)) |
|
514 |
(java.lang.reflect.Field::char getChar (java.lang.Object)) |
|
515 |
(java.lang.reflect.Field::void setChar (java.lang.Object char)) |
|
516 |
(java.lang.reflect.Field::void setDouble (java.lang.Object double)) |
|
517 |
(java.lang.reflect.Field::java.lang.Object get (java.lang.Object)) |
|
518 |
(java.lang.reflect.Field::void set (java.lang.Object java.lang.Object)) |
|
519 |
(java.lang.reflect.Field::int getInt (java.lang.Object)) |
|
520 |
(java.lang.reflect.Field::void setInt (java.lang.Object int)) |
|
521 |
(java.lang.reflect.Field::boolean getBoolean (java.lang.Object)) |
|
522 |
(java.lang.reflect.Field::byte getByte (java.lang.Object)) |
|
523 |
(java.lang.reflect.Field::float getFloat (java.lang.Object)) |
|
524 |
(java.lang.reflect.Field::long getLong (java.lang.Object)) |
|
525 |
(java.lang.reflect.Field::void setBoolean (java.lang.Object boolean)) |
|
526 |
(java.lang.reflect.Field::void setByte (java.lang.Object byte)) |
|
527 |
(java.lang.reflect.Field::void setLong (java.lang.Object long)) |
|
528 |
(java.lang.reflect.Field::void setFloat (java.lang.Object float)) |
|
529 |
(java.lang.reflect.Field::int getModifiers ()) |
|
530 |
(java.lang.reflect.Field::unsigned short getShort (java.lang.Object)) |
|
531 |
(java.lang.reflect.Field::double getDouble (java.lang.Object)) |
|
532 |
(java.lang.reflect.Constructor::java.lang.Object newInstance (java.lang.Object[])) |
|
533 |
(java.lang.reflect.Constructor::int getModifiers ()) |
|
534 |
(java.util.zip.Inflater::void setDictionary0 (byte[] int int)) |
|
535 |
(java.util.zip.Inflater::int getTotalIn0 ()) |
|
536 |
(java.util.zip.Inflater::void reset0 ()) |
|
537 |
(java.util.zip.Inflater::void end0 ()) |
|
538 |
(java.util.zip.Inflater::int inflate0 (byte[] int int)) |
|
539 |
(java.util.zip.Inflater::int getTotalOut0 ()) |
|
540 |
(java.util.zip.Inflater::int getAdler0 ()) |
|
541 |
(java.util.zip.CRC32::void update1 (int)) |
|
542 |
(java.util.zip.CRC32::void update (byte[] int int)) |
|
543 |
||
544 |
(com.ms.security.PolicyEngine::boolean isSystemClass (java.lang.String)) |
|
545 |
(com.ms.security.PolicyEngine::void denyPermission (com.ms.security.PermissionID)) |
|
546 |
(com.ms.security.PolicyEngine::void revertPermission (com.ms.security.PermissionID)) |
|
547 |
(com.ms.security.PolicyEngine::void initPolicyEngine ()) |
|
548 |
(com.ms.security.PolicyEngine::java.lang.Class _getClassOfCaller (java.lang.Class[])) |
|
549 |
(com.ms.security.PolicyEngine::void internalCheckClass (java.lang.Class com.ms.security.PermissionID java.lang.Object)) |
|
550 |
(com.ms.security.PolicyEngine::com.ms.security.PermissionDataSet getPermissionsOfClass (java.lang.Class)) |
|
551 |
(com.ms.security.PolicyEngine::void assertPermission (com.ms.security.PermissionID)) |
|
552 |
(com.ms.security.PolicyEngine::void deepCheck (com.ms.security.PermissionID java.lang.Object)) |
|
553 |
(com.ms.security.PolicyEngine::void shallowCheck (com.ms.security.PermissionID java.lang.Object java.lang.Class[] int)) |
|
554 |
(com.ms.security.PolicyEngine::java.security.Principal getPrincipalOfClass (java.lang.Class)) |
|
555 |
(com.ms.security.permissions.ThreadPermission::boolean pDecodeAsn (byte[])) |
|
556 |
(com.ms.security.permissions.ThreadPermission::byte[] pEncodeAsn ()) |
|
557 |
(com.ms.security.permissions.RegistryPermission::boolean pDecodeAsn (byte[])) |
|
558 |
(com.ms.security.permissions.RegistryPermission::byte[] pEncodeAsn ()) |
|
559 |
(com.ms.security.management.ZonePermissions::byte[] pEncodeAsn ()) |
|
560 |
(com.ms.security.management.ZonePermissions::boolean pDecodeAsn (byte[])) |
|
561 |
(com.ms.security.permissions.UIPermission::byte[] pEncodeAsn ()) |
|
562 |
(com.ms.security.permissions.UIPermission::boolean pDecodeAsn (byte[])) |
|
563 |
(com.ms.security.permissions.NetIOPermission::byte[] pEncodeAsn ()) |
|
564 |
(com.ms.security.permissions.NetIOPermission::boolean pDecodeAsn (byte[])) |
|
565 |
(com.ms.security.permissions.ReflectionPermission::byte[] pEncodeAsn ()) |
|
566 |
(com.ms.security.permissions.ReflectionPermission::boolean pDecodeAsn (byte[])) |
|
567 |
(com.ms.vm.WeakReference::void storeRef (int java.lang.Object)) |
|
568 |
(com.ms.vm.WeakReference::int allocRef (java.lang.Object)) |
|
569 |
(com.ms.vm.WeakReference::void freeRef (int)) |
|
570 |
(com.ms.vm.WeakReference::java.lang.Object fetchRef (int)) |
|
571 |
(com.ms.dll.DllLib::void CoTaskMemFree (int)) |
|
572 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int float[] int int)) |
|
573 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int double[] int int)) |
|
574 |
(com.ms.dll.DllLib::int numParamBytes0 (java.lang.reflect.Method)) |
|
575 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int java.lang.Object int int)) |
|
576 |
(com.ms.dll.DllLib::void write2 (java.lang.Object int unsigned short)) |
|
577 |
(com.ms.dll.DllLib::void write2 (int int unsigned short)) |
|
578 |
(com.ms.dll.DllLib::void write2 (java.lang.Object int char)) |
|
579 |
(com.ms.dll.DllLib::void write2 (int int char)) |
|
580 |
(com.ms.dll.DllLib::int GlobalAlloc (int int)) |
|
581 |
(com.ms.dll.DllLib::void resize (java.lang.Object int)) |
|
582 |
(com.ms.dll.DllLib::long read8 (java.lang.Object int)) |
|
583 |
(com.ms.dll.DllLib::long read8 (int int)) |
|
584 |
(com.ms.dll.DllLib::int lstrcpy (java.lang.StringBuffer int)) |
|
585 |
(com.ms.dll.DllLib::int lstrlenA (int)) |
|
586 |
(com.ms.dll.DllLib::int read4 (java.lang.Object int)) |
|
587 |
(com.ms.dll.DllLib::int CoTaskMemAlloc (int)) |
|
588 |
(com.ms.dll.DllLib::void write8 (java.lang.Object int long)) |
|
589 |
(com.ms.dll.DllLib::int sizeOf0 (java.lang.Class)) |
|
590 |
(com.ms.dll.DllLib::int getSystemDefaultCharSize ()) |
|
591 |
(com.ms.dll.DllLib::void write8 (int int long)) |
|
592 |
(com.ms.dll.DllLib::int read4 (int int)) |
|
593 |
(com.ms.dll.DllLib::byte read1 (java.lang.Object int)) |
|
594 |
(com.ms.dll.DllLib::byte read1 (int int)) |
|
595 |
(com.ms.dll.DllLib::int lstrlen (int)) |
|
596 |
(com.ms.dll.DllLib::void CopyMemoryAnsi (int java.lang.String int)) |
|
597 |
(com.ms.dll.DllLib::void CopyMemoryAnsi (java.lang.StringBuffer int int)) |
|
598 |
(com.ms.dll.DllLib::boolean isStruct (java.lang.reflect.Field)) |
|
599 |
(com.ms.dll.DllLib::boolean GlobalFree (int)) |
|
600 |
(com.ms.dll.DllLib::void internalAttemptCopyPtrToStruct (int java.lang.Object int int)) |
|
601 |
(com.ms.dll.DllLib::int getLastError ()) |
|
602 |
(com.ms.dll.DllLib::void write4 (java.lang.Object int int)) |
|
603 |
(com.ms.dll.DllLib::void write4 (int int int)) |
|
604 |
(com.ms.dll.DllLib::unsigned short read2 (java.lang.Object int)) |
|
605 |
(com.ms.dll.DllLib::unsigned short read2 (int int)) |
|
606 |
(com.ms.dll.DllLib::void release (java.lang.Object)) |
|
607 |
(com.ms.dll.DllLib::void write1 (java.lang.Object int byte)) |
|
608 |
(com.ms.dll.DllLib::void write1 (int int byte)) |
|
609 |
(com.ms.dll.DllLib::boolean isStructCls (java.lang.Class)) |
|
610 |
(com.ms.dll.DllLib::void prelink (java.lang.reflect.Method)) |
|
611 |
(com.ms.dll.DllLib::void CopyMemoryUni (int java.lang.String int)) |
|
612 |
(com.ms.dll.DllLib::void CopyMemoryUni (java.lang.StringBuffer int int)) |
|
613 |
(com.ms.dll.DllLib::void internalAttemptCopyStructToPtr (java.lang.Object int int int)) |
|
614 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (int int int int)) |
|
615 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (byte[] int int int)) |
|
616 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (char[] int int int)) |
|
617 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (unsigned short[] int int int)) |
|
618 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (int[] int int int)) |
|
619 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (long[] int int int)) |
|
620 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (float[] int int int)) |
|
621 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (double[] int int int)) |
|
622 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (java.lang.Object int int int)) |
|
623 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int int int int)) |
|
624 |
(com.ms.dll.DllLib::int lstrlenW (int)) |
|
625 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int byte[] int int)) |
|
626 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int char[] int int)) |
|
627 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int unsigned short[] int int)) |
|
628 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int int[] int int)) |
|
629 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int long[] int int)) |
|
630 |
(com.ms.dll.DllLib::int internalGetStructAddr (java.lang.Object)) |
|
631 |
(com.ms.dll.DllLib::int offsetOf (java.lang.reflect.Field)) |
|
632 |
(com.ms.dll.DllLib::int lstrcpy (int java.lang.String)) |
|
633 |
(com.ms.dll.DllLib::int sizeOf (java.lang.Object)) |
|
634 |
(com.ms.lang.RegKey::com.ms.lang.RegKeyEnumValue pRegEnumValue (int)) |
|
635 |
(com.ms.lang.RegKey::java.lang.String pRegQueryStringValue (java.lang.String)) |
|
636 |
(com.ms.lang.RegKey::byte[] pRegQueryBinaryValue (java.lang.String)) |
|
637 |
(com.ms.lang.RegKey::int pRegQueryIntValue (java.lang.String)) |
|
638 |
(com.ms.lang.RegKey::void pRegSetStringValue (java.lang.String java.lang.String)) |
|
639 |
(com.ms.lang.RegKey::void pRegSetIntValue (java.lang.String int)) |
|
640 |
(com.ms.lang.RegKey::void pRegSetBinaryValue (java.lang.String byte[])) |
|
641 |
(com.ms.lang.RegKey::void pRegDeleteValue (java.lang.String)) |
|
642 |
(com.ms.lang.RegKey::void pRegFlushKey ()) |
|
643 |
(com.ms.lang.RegKey::void pRegDeleteKey (java.lang.String)) |
|
644 |
(com.ms.lang.RegKey::void pRegOpenBaseKey (int)) |
|
645 |
(com.ms.lang.RegKey::void pRegOpenKey (com.ms.lang.RegKey java.lang.String int)) |
|
646 |
(com.ms.lang.RegKey::int pRegQueryInfoKey (com.ms.lang.RegQueryInfo)) |
|
647 |
(com.ms.lang.RegKey::void pRegUnLoadKey (java.lang.String)) |
|
648 |
(com.ms.lang.RegKey::void pRegCreateKey (com.ms.lang.RegKey java.lang.String)) |
|
649 |
(com.ms.lang.RegKey::void pRegRestoreKey (java.lang.String boolean)) |
|
650 |
(com.ms.lang.RegKey::void pRegLoadKey (java.lang.String java.lang.String)) |
|
651 |
(com.ms.lang.RegKey::void pRegCloseKey ()) |
|
652 |
(com.ms.lang.RegKey::java.lang.String pRegEnumKey (int)) |
|
653 |
(com.ms.lang.RegKey::void pRegReplaceKey (java.lang.String java.lang.String java.lang.String)) |
|
654 |
(com.ms.awt.peer.NativeServices::int pGetKeyboardLayouts (int[] int)) |
|
655 |
(com.ms.awt.peer.NativeServices::void jpegReadByte (com.ms.awt.peer.IjpegDecoderCallback byte[] int com.ms.awt.peer.jpegInfoHeader byte[] int)) |
|
656 |
(com.ms.awt.peer.NativeServices::int getColourDataDepth ()) |
|
657 |
(com.ms.awt.peer.NativeServices::java.lang.String pGetFontEnumeratedFamily (int)) |
|
658 |
(com.ms.awt.peer.NativeServices::int pNewFontEnumeration ()) |
|
659 |
(com.ms.awt.peer.NativeServices::int getScreenClipRgn (int)) |
|
660 |
(com.ms.awt.peer.NativeServices::int pSetKeyboardLayout (int int)) |
|
661 |
(com.ms.awt.peer.NativeServices::void ClipboardInit (com.ms.awt.peer.IToolkit)) |
|
662 |
(com.ms.awt.peer.NativeServices::void getDeviceCaps (int int[] int)) |
|
663 |
(com.ms.awt.peer.NativeServices::void getAfcMetrics (int[])) |
|
664 |
(com.ms.awt.peer.NativeServices::void setUserLocale (int int)) |
|
665 |
(com.ms.awt.peer.NativeServices::void getDCDI (com.ms.awt.peer.DirectColourDataInfo)) |
|
666 |
(com.ms.awt.peer.NativeServices::int pGetNumKeyboardLayouts ()) |
|
667 |
(com.ms.awt.peer.NativeServices::void getIndexedColours (byte[] byte[] byte[])) |
|
668 |
(com.ms.awt.peer.NativeServices::int getNativeFont (java.lang.String int int int)) |
|
669 |
(com.ms.awt.peer.NativeServices::int pGetKeyboardLayout ()) |
|
670 |
(com.ms.awt.peer.NativeServices::int getSystemLCID ()) |
|
671 |
(com.ms.awt.peer.NativeServices::void caretSetPos (int int int)) |
|
672 |
(com.ms.awt.peer.NativeServices::java.lang.String getLogFontFromIUnknown (com.ms.com.IUnknown com.ms.awt.peer.LogFontX)) |
|
673 |
(com.ms.awt.peer.NativeServices::java.lang.String ClipboardGetText ()) |
|
674 |
(com.ms.awt.peer.NativeServices::int systemMetric (int)) |
|
675 |
(com.ms.awt.peer.NativeServices::void jpegInit (com.ms.awt.peer.IjpegDecoderCallback byte[] int com.ms.awt.peer.jpegInfoHeader)) |
|
676 |
(com.ms.awt.peer.NativeServices::void caretHide (int)) |
|
677 |
(com.ms.awt.peer.NativeServices::int chooseColor (int int)) |
|
678 |
(com.ms.awt.peer.NativeServices::java.lang.String pGetKeyboardLayoutName (int)) |
|
679 |
(com.ms.awt.peer.NativeServices::int matchFontAndLanguage (int int)) |
|
680 |
(com.ms.awt.peer.NativeServices::java.lang.String chooseFont (com.ms.awt.peer.LogFontX java.lang.String int)) |
|
681 |
(com.ms.awt.peer.NativeServices::java.lang.String getSystemFont (int com.ms.awt.peer.LogFontX)) |
|
682 |
(com.ms.awt.peer.NativeServices::com.ms.com.IUnknown getIUnknownFromLogFont (java.lang.String com.ms.awt.peer.LogFontX)) |
|
683 |
(com.ms.awt.peer.NativeServices::void caretDispose (int)) |
|
684 |
(com.ms.awt.peer.NativeServices::void caretShow (int)) |
|
685 |
(com.ms.awt.peer.NativeServices::void deleteObject (int)) |
|
686 |
(com.ms.awt.peer.NativeServices::void setDebugOutput (com.ms.awt.peer.COMPrintCallback)) |
|
687 |
(com.ms.awt.peer.NativeServices::void jpegReadInt (com.ms.awt.peer.IjpegDecoderCallback byte[] int com.ms.awt.peer.jpegInfoHeader int[] int)) |
|
688 |
(com.ms.awt.peer.NativeServices::int getSystemColourValue (int)) |
|
689 |
(com.ms.awt.peer.NativeServices::void caretCreate (int int int)) |
|
690 |
(com.ms.awt.peer.NativeServices::void ClipboardSetText (java.lang.String)) |
|
691 |
(com.ms.awt.peer.NativeServices::void println (java.lang.String)) |
|
692 |
(com.ms.security.SecurityClassLoader::boolean getSecureState ()) |
|
693 |
(com.ms.security.SecurityClassLoader::void setSecureState (java.lang.String java.lang.String)) |
|
694 |
(com.ms.security.SecurityClassLoader::java.lang.Class internalDefineClass (java.lang.String byte[] int int)) |
|
695 |
(com.ms.security.SecurityClassLoader::void markClass (java.lang.Class com.ms.security.PermissionSet java.security.Principal)) |
|
696 |
(com.ms.security.SecurityClassLoader::java.util.Hashtable getHashTable ()) |
|
697 |
(com.ms.security.auditing.SecurityAuditor::boolean isThreadAuditingEnabled ()) |
|
698 |
(com.ms.security.auditing.SecurityAuditor::void disableThreadAuditing ()) |
|
699 |
(com.ms.security.auditing.SecurityAuditor::void enableThreadAuditing ()) |
|
700 |
(com.ms.security.auditing.SecurityAuditor::void initSecurityAuditor ()) |
|
701 |
(com.ms.security.PermissionDataSet::byte[] pEncodeAsn ()) |
|
702 |
(com.ms.security.PermissionDataSet::boolean pDecodeAsn (byte[])) |
|
703 |
(com.ms.lang.SystemX::int pAnsiToUnicode (byte[] char[] int int int)) |
|
704 |
(com.ms.lang.SystemX::int pQueryUnicodeToAnsi (char[] int int int)) |
|
705 |
(com.ms.lang.SystemX::void gc ()) |
|
706 |
(com.ms.lang.SystemX::boolean arrayCompare (java.lang.Object[] int java.lang.Object[] int int)) |
|
707 |
(com.ms.lang.SystemX::int pUnicodeToAnsi (char[] byte[] int int int)) |
|
708 |
(com.ms.lang.SystemX::boolean isLocalCharDBCSLeadByte (byte)) |
|
709 |
(com.ms.lang.SystemX::int pQueryAnsiToUnicode (byte[] int int int)) |
|
710 |
(com.ms.lang.SystemX::boolean isBaseDBCS ()) |
|
711 |
(com.ms.packagemanager.JavaPackage::byte[] nativeGetSigner (java.lang.Object)) |
|
712 |
(com.ms.packagemanager.JavaPackage::byte[] nativeGetCapabilities (java.lang.Object)) |
|
713 |
(com.ms.com._Guid::void IIDFromString (java.lang.String com.ms.com._Guid)) |
|
714 |
(com.ms.com._Guid::java.lang.String StringFromIID (com.ms.com._Guid)) |
|
715 |
(com.ms.security.auditing.PrintStreamAuditor::int GetModuleHandle (java.lang.String)) |
|
716 |
(com.ms.security.auditing.PrintStreamAuditor::int FormatMessage (int int int int java.lang.StringBuffer int int[])) |
|
717 |
(com.ms.security.permissions.CustomPermission::byte[] pEncodeAsn ()) |
|
718 |
(com.ms.security.permissions.CustomPermission::boolean pDecodeAsn (byte[])) |
|
719 |
(com.ms.security.permissions.X509Signer::boolean pLoad (byte[])) |
|
720 |
(com.ms.packagemanager.PackageManager::java.lang.Class nativeFindClassInNamespace (java.lang.String java.lang.String java.lang.ClassLoader)) |
|
721 |
(com.ms.packagemanager.PackageManager::java.lang.Object nativeGetPackage (java.lang.String java.lang.String)) |
|
722 |
(com.ms.packagemanager.PackageManager::java.lang.String[] nativeGetBeansList ()) |
|
723 |
(com.ms.packagemanager.PackageManager::com.ms.com.IStream nativeGetFileIStream (java.lang.String java.lang.String)) |
|
724 |
(com.ms.packagemanager.PackageManager::java.lang.Class nativeFindClass (java.lang.String java.lang.String java.lang.ClassLoader)) |
|
725 |
(com.ms.security.permissions.UserFileIOPermission::byte[] pEncodeAsn ()) |
|
726 |
(com.ms.security.permissions.UserFileIOPermission::boolean pDecodeAsn (byte[])) |
|
727 |
(com.ms.security.permissions.PropertyPermission::byte[] pEncodeAsn ()) |
|
728 |
(com.ms.security.permissions.PropertyPermission::boolean pDecodeAsn (byte[])) |
|
729 |
(com.ms.security.permissions.ClientStoragePermission::byte[] pEncodeAsn ()) |
|
730 |
(com.ms.security.permissions.ClientStoragePermission::boolean pDecodeAsn (byte[])) |
|
731 |
(com.ms.security.permissions.ExecutionPermission::byte[] pEncodeAsn ()) |
|
732 |
(com.ms.security.permissions.ExecutionPermission::boolean pDecodeAsn (byte[])) |
|
733 |
(com.ms.util.EventLog::boolean DeregisterEventSource (int)) |
|
734 |
(com.ms.util.EventLog::void reportEvent0 (unsigned short unsigned short int java.lang.String[] byte[])) |
|
735 |
(com.ms.util.EventLog::int RegisterEventSource (java.lang.String java.lang.String)) |
|
736 |
(com.ms.applet.BrowserAppletFrame::void signalViewChange (int)) |
|
737 |
(com.ms.applet.BrowserAppletFrame::java.lang.Object newInstance (int java.lang.Class boolean com.ms.security.PermissionSet)) |
|
738 |
(com.ms.applet.BrowserAppletFrame::void showSystemStatus (int int boolean java.lang.String)) |
|
739 |
(com.ms.applet.BrowserAppletFrame::com.ms.security.management.SecurityPolicy getSecurityPolicy0 (int java.lang.String)) |
|
740 |
(com.ms.applet.BrowserAppletFrame::void setDownloadState (int boolean)) |
|
741 |
(com.ms.applet.BrowserAppletFrame::int GetSystemDefaultLCID ()) |
|
742 |
(com.ms.applet.BrowserAppletFrame::void requestResize (int int int)) |
|
743 |
(com.ms.applet.BrowserAppletFrame::void signalObjectLoadDone (int boolean)) |
|
744 |
(com.ms.applet.BrowserAppletFrame::com.ms.applet.BrowserAppletFrame findOfflineContext ()) |
|
745 |
(com.ms.applet.BrowserAppletFrame::void showStatus0 (int java.lang.String)) |
|
746 |
(com.ms.applet.BrowserAppletFrame::boolean checkGlobalOfflineMode0 ()) |
|
747 |
(com.ms.applet.BrowserAppletFrame::void showDocument0 (int java.lang.String java.lang.String)) |
|
748 |
(com.ms.security.permissions.SystemStreamsPermission::byte[] pEncodeAsn ()) |
|
749 |
(com.ms.security.permissions.SystemStreamsPermission::boolean pDecodeAsn (byte[])) |
|
750 |
(com.ms.security.permissions.FileIOPermission::byte[] pEncodeAsn ()) |
|
751 |
(com.ms.security.permissions.FileIOPermission::boolean pDecodeAsn (byte[])) |
|
752 |
(com.ms.com.ComLib::int newGCHandle (java.lang.Object)) |
|
753 |
(com.ms.com.ComLib::java.lang.Object derefGCHandle (int)) |
|
754 |
(com.ms.com.ComLib::void dprinthelper (char[])) |
|
755 |
(com.ms.com.ComLib::void release (java.lang.Object)) |
|
756 |
(com.ms.com.ComLib::int jcdwClassSizeOf (java.lang.Class)) |
|
757 |
(com.ms.com.ComLib::int jcdwOffsetOf (java.lang.Object java.lang.String)) |
|
758 |
(com.ms.com.ComLib::int jcdwClassOffsetOf (java.lang.Class java.lang.String)) |
|
759 |
(com.ms.com.ComLib::boolean isJavaOwned (java.lang.Object)) |
|
760 |
(com.ms.com.ComLib::void brk (java.lang.Object)) |
|
761 |
(com.ms.com.ComLib::void setDataWrapperSize (java.lang.Object int)) |
|
762 |
(com.ms.com.ComLib::void brk (int)) |
|
763 |
(com.ms.com.ComLib::void setJCDWHomeThread (java.lang.Object java.lang.Object)) |
|
764 |
(com.ms.com.ComLib::void propagateOwnership (java.lang.Object int)) |
|
765 |
(com.ms.com.ComLib::void threadStartMTA (java.lang.Thread)) |
|
766 |
(com.ms.com.ComLib::void IENVNextMarshalerJ2C (int)) |
|
767 |
(com.ms.com.ComLib::boolean supportsInterface (java.lang.Object com.ms.com._Guid)) |
|
768 |
(com.ms.com.ComLib::java.lang.Object ptrToStruct (java.lang.Class int)) |
|
769 |
(com.ms.com.ComLib::int jcdwSizeOf (java.lang.Object)) |
|
770 |
(com.ms.com.ComLib::void declareMessagePumpThread ()) |
|
771 |
(com.ms.com.ComLib::void IENVNextMarshalerC2J (int)) |
|
772 |
(com.ms.com.ComLib::void freeGCHandle (int)) |
|
773 |
(com.ms.com.ComLib::boolean isEqualUnknown (java.lang.Object java.lang.Object)) |
|
774 |
(com.ms.com.Dispatch::boolean NIsArray (java.lang.Object)) |
|
775 |
(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[])) |
|
776 |
(com.ms.com.Dispatch::void NGetIDsOfNamesReal (java.lang.Object com.ms.com._Guid int java.lang.String[] int[])) |
|
777 |
(com.ms.com.ComException::int FormatMessage (int int int int java.lang.StringBuffer int int[])) |
|
778 |
(com.ms.com.Variant::int toInt ()) |
|
779 |
(com.ms.com.Variant::double toDate ()) |
|
780 |
(com.ms.com.Variant::boolean toBoolean ()) |
|
781 |
(com.ms.com.Variant::double toDouble ()) |
|
782 |
(com.ms.com.Variant::long toCurrency ()) |
|
783 |
(com.ms.com.Variant::void putVariantArray (com.ms.com.Variant[])) |
|
784 |
(com.ms.com.Variant::com.ms.com.Variant[] getVariantArray ()) |
|
785 |
(com.ms.com.Variant::void putByteArray (java.lang.Object)) |
|
786 |
(com.ms.com.Variant::void putShortRef (unsigned short)) |
|
787 |
(com.ms.com.Variant::void putIntRef (int)) |
|
788 |
(com.ms.com.Variant::void putDoubleRef (double)) |
|
789 |
(com.ms.com.Variant::void putDateRef (double)) |
|
790 |
(com.ms.com.Variant::void putStringRef (java.lang.String)) |
|
791 |
(com.ms.com.Variant::unsigned short getShortRef ()) |
|
792 |
(com.ms.com.Variant::int getIntRef ()) |
|
793 |
(com.ms.com.Variant::double getDoubleRef ()) |
|
794 |
(com.ms.com.Variant::double getDateRef ()) |
|
795 |
(com.ms.com.Variant::java.lang.String getStringRef ()) |
|
796 |
(com.ms.com.Variant::java.lang.String internalToString ()) |
|
797 |
(com.ms.com.Variant::void initSafeArrayByRef (com.ms.com.SafeArray int)) |
|
798 |
(com.ms.com.Variant::java.lang.Object toCharArray ()) |
|
799 |
(com.ms.com.Variant::java.lang.Object toDispatch ()) |
|
800 |
(com.ms.com.Variant::byte toByte ()) |
|
801 |
(com.ms.com.Variant::java.lang.Object getDispatch ()) |
|
802 |
(com.ms.com.Variant::void putDispatch (java.lang.Object)) |
|
803 |
(com.ms.com.Variant::boolean getBoolean ()) |
|
804 |
(com.ms.com.Variant::int toError ()) |
|
805 |
(com.ms.com.Variant::java.lang.Object toObject ()) |
|
806 |
(com.ms.com.Variant::void initSafeArrayByVal (com.ms.com.SafeArray int)) |
|
807 |
(com.ms.com.Variant::java.lang.Object getObject ()) |
|
808 |
(com.ms.com.Variant::void putObject (java.lang.Object)) |
|
809 |
(com.ms.com.Variant::com.ms.com.SafeArray toSafeArrayHelper (java.lang.Class)) |
|
810 |
(com.ms.com.Variant::void putFloatRef (float)) |
|
811 |
(com.ms.com.Variant::void putCurrencyRef (long)) |
|
812 |
(com.ms.com.Variant::void putErrorRef (int)) |
|
813 |
(com.ms.com.Variant::void putBooleanRef (boolean)) |
|
814 |
(com.ms.com.Variant::void putObjectRef (java.lang.Object)) |
|
815 |
(com.ms.com.Variant::void putByteRef (byte)) |
|
816 |
(com.ms.com.Variant::java.lang.String getString ()) |
|
817 |
(com.ms.com.Variant::void putString (java.lang.String)) |
|
818 |
(com.ms.com.Variant::float getFloatRef ()) |
|
819 |
(com.ms.com.Variant::long getCurrencyRef ()) |
|
820 |
(com.ms.com.Variant::int getErrorRef ()) |
|
821 |
(com.ms.com.Variant::boolean getBooleanRef ()) |
|
822 |
(com.ms.com.Variant::java.lang.Object getObjectRef ()) |
|
823 |
(com.ms.com.Variant::byte getByteRef ()) |
|
824 |
(com.ms.com.Variant::float toFloat ()) |
|
825 |
(com.ms.com.Variant::void putCharArray (java.lang.Object)) |
|
826 |
(com.ms.com.Variant::void putDispatchRef (java.lang.Object)) |
|
827 |
(com.ms.com.Variant::java.lang.Object getDispatchRef ()) |
|
828 |
(com.ms.com.Variant::void putVariantArrayRef (com.ms.com.Variant[])) |
|
829 |
(com.ms.com.Variant::com.ms.com.Variant[] getVariantArrayRef ()) |
|
830 |
(com.ms.com.Variant::void changeType (unsigned short)) |
|
831 |
(com.ms.com.Variant::void ncloneIndirect (com.ms.com.Variant)) |
|
832 |
(com.ms.com.Variant::void nFinalize (boolean)) |
|
833 |
(com.ms.com.Variant::void nclone (com.ms.com.Variant)) |
|
834 |
(com.ms.com.Variant::unsigned short toShort ()) |
|
835 |
(com.ms.com.Variant::void putSafeArrayRefHelper (int)) |
|
836 |
(com.ms.com.Variant::com.ms.com.Variant[] toVariantArray ()) |
|
837 |
(com.ms.com.Variant::java.lang.Object toByteArray ()) |
|
838 |
(com.ms.com.Variant::void TrueVariantClear ()) |
|
839 |
(com.ms.awt.WToolkit::boolean MessageBeep (int)) |
|
840 |
(com.ms.applet.AppletPanel::boolean StartCodeDownload (int java.lang.String java.lang.String java.lang.String)) |
|
841 |
(com.ms.applet.AppletPanel::void securedCall0 (int java.lang.Object)) |
|
842 |
(com.ms.applet.AppletPanel::com.ms.security.PermissionSet getDefaultPermissionsFromLoader (com.ms.vm.loader.URLClassLoader)) |
|
843 |
(com.ms.dll.Win32Exception::int FormatMessage (int int int int java.lang.StringBuffer int int[])) |
|
844 |
(com.ms.awt.WGuiCallback::boolean SetEvent (int)) |
|
845 |
(com.ms.awt.WGuiCallback::int CreateSemaphore (int int int int)) |
|
846 |
(com.ms.awt.WGuiCallback::int ReleaseSemaphore (int int int)) |
|
847 |
(com.ms.awt.WGuiCallback::void userYield (boolean)) |
|
848 |
(com.ms.awt.WGuiCallback::int MsgWaitForMultipleObjects (int int[] boolean int int)) |
|
849 |
(com.ms.awt.WGuiCallback::int CreateEvent (int boolean boolean int)) |
|
850 |
(com.ms.activeX.ActiveXToolkit::int GetSysColor (int)) |
|
851 |
(com.ms.awt.peer.NativeGraphics::void setPageDimension (int int)) |
|
852 |
(com.ms.awt.peer.NativeGraphics::void setBkColour (int int)) |
|
853 |
(com.ms.awt.peer.NativeGraphics::void getClipBounds (com.ms.awt.peer.NativeRect int int)) |
|
854 |
(com.ms.awt.peer.NativeGraphics::void pGetCharOutline (int byte[])) |
|
855 |
(com.ms.awt.peer.NativeGraphics::void drawLine (int int int int)) |
|
856 |
(com.ms.awt.peer.NativeGraphics::void setXORMode (int int int int)) |
|
857 |
(com.ms.awt.peer.NativeGraphics::int drawString (java.lang.String int int int int int int int int[] int[])) |
|
858 |
(com.ms.awt.peer.NativeGraphics::int getCoClass ()) |
|
859 |
(com.ms.awt.peer.NativeGraphics::void drawArc (int int int int int int int)) |
|
860 |
(com.ms.awt.peer.NativeGraphics::void getInitialPageDimension (com.ms.awt.peer.NativeRect)) |
|
861 |
(com.ms.awt.peer.NativeGraphics::void setVisRgn (int)) |
|
862 |
(com.ms.awt.peer.NativeGraphics::void pSetForeground (int int)) |
|
863 |
(com.ms.awt.peer.NativeGraphics::int pGetDC ()) |
|
864 |
(com.ms.awt.peer.NativeGraphics::void drawPixels (int[] int int int)) |
|
865 |
(com.ms.awt.peer.NativeGraphics::void drawPolygon (int[] int[] int int int int)) |
|
866 |
(com.ms.awt.peer.NativeGraphics::void createFromImage (com.ms.awt.peer.INativeImage)) |
|
867 |
(com.ms.awt.peer.NativeGraphics::void endPage ()) |
|
868 |
(com.ms.awt.peer.NativeGraphics::int pGetCharOutlineSize (int)) |
|
869 |
(com.ms.awt.peer.NativeGraphics::void pDrawBezier (int int int[] int)) |
|
870 |
(com.ms.awt.peer.NativeGraphics::int drawBytes (byte[] int int int int int)) |
|
871 |
(com.ms.awt.peer.NativeGraphics::void changeClip (int int int int boolean)) |
|
872 |
(com.ms.awt.peer.NativeGraphics::int drawChars (char[] int int int int int int int int int int[] int[])) |
|
873 |
(com.ms.awt.peer.NativeGraphics::void drawT2Curve (float float float float float float int int)) |
|
874 |
(com.ms.awt.peer.NativeGraphics::void createFromPrintJob (java.lang.String com.ms.awt.peer.SPJData)) |
|
875 |
(com.ms.awt.peer.NativeGraphics::void endPrintJob ()) |
|
876 |
(com.ms.awt.peer.NativeGraphics::void pSetOrigin (int int)) |
|
877 |
(com.ms.awt.peer.NativeGraphics::void createFromHDC (int)) |
|
878 |
(com.ms.awt.peer.NativeGraphics::void drawOval (int int int int int)) |
|
879 |
(com.ms.awt.peer.NativeGraphics::int pSetFont (java.lang.String int int int)) |
|
880 |
(com.ms.awt.peer.NativeGraphics::void setPaintMode (int int)) |
|
881 |
(com.ms.awt.peer.NativeGraphics::void startPage ()) |
|
882 |
(com.ms.awt.peer.NativeGraphics::void clearClip ()) |
|
883 |
(com.ms.awt.peer.NativeGraphics::void createFromCopy (com.ms.awt.peer.INativeGraphics)) |
|
884 |
(com.ms.awt.peer.NativeGraphics::void scanLines (int int[] int int int int)) |
|
885 |
(com.ms.awt.peer.NativeGraphics::void drawRoundRect (int int int int int int int)) |
|
886 |
(com.ms.awt.peer.NativeGraphics::void dispose ()) |
|
887 |
(com.ms.awt.peer.NativeGraphics::void clearRect (int int int int int)) |
|
888 |
(com.ms.awt.peer.NativeGraphics::void copyArea (int int int int int int)) |
|
889 |
(com.ms.awt.peer.NativeGraphics::void createFromWindow (int)) |
|
890 |
(com.ms.awt.peer.NativeGraphics::void drawPolyline (int[] int[] int int int)) |
|
891 |
(com.ms.awt.peer.NativeGraphics::void drawRect (int int int int int)) |
|
892 |
(com.ms.awt.peer.CToolkit::void callbackEventLoop (com.ms.awt.peer.IToolkitCallback)) |
|
893 |
(com.ms.awt.peer.CToolkit::int getToolkitHwnd ()) |
|
894 |
(com.ms.awt.peer.CToolkit::int createCompHwnd (int int)) |
|
895 |
(com.ms.awt.peer.CNativeSystemIME::void setCompositionFont (int int)) |
|
896 |
(com.ms.awt.peer.CNativeSystemIME::void setCompositionPos (int int int)) |
|
897 |
(com.ms.awt.peer.CNativeSystemIME::void setOpenStatus (int int)) |
|
898 |
(com.ms.awt.peer.CNativeSystemIME::int getOpenStatus (int)) |
|
899 |
(com.ms.awt.peer.CNativeSystemIME::java.lang.String getCompositionString (int)) |
|
900 |
(com.ms.awt.peer.CNativeSystemIME::java.lang.String getCompositionResultString (int)) |
|
901 |
(com.ms.net.wininet.WininetStreamHandlerFactory::int initNative (java.lang.String)) |
|
902 |
(com.ms.com.SafeArray::void rawGetVariantAs (int com.ms.com.Variant)) |
|
903 |
(com.ms.com.SafeArray::void NSafeArrayInit (int)) |
|
904 |
(com.ms.com.SafeArray::float rawGetDouble (int)) |
|
905 |
(com.ms.com.SafeArray::void NRawBoolCopyToJavaArray (int int boolean[] int)) |
|
906 |
(com.ms.com.SafeArray::void validateArray (int)) |
|
907 |
(com.ms.com.SafeArray::void NSafeArrayCreateFromString (java.lang.String)) |
|
908 |
(com.ms.com.SafeArray::void rawSetString (int java.lang.String)) |
|
909 |
(com.ms.com.SafeArray::int getInt (int)) |
|
910 |
(com.ms.com.SafeArray::void setInt (int int)) |
|
911 |
(com.ms.com.SafeArray::boolean getBoolean (int)) |
|
912 |
(com.ms.com.SafeArray::void setBoolean (int boolean)) |
|
913 |
(com.ms.com.SafeArray::int computeOffset (int)) |
|
914 |
(com.ms.com.SafeArray::void NSafeArrayNullInit ()) |
|
915 |
(com.ms.com.SafeArray::void rawSetVariant (int com.ms.com.Variant)) |
|
916 |
(com.ms.com.SafeArray::float rawGetFloat (int)) |
|
917 |
(com.ms.com.SafeArray::float getFloat (int)) |
|
918 |
(com.ms.com.SafeArray::void setFloat (int float)) |
|
919 |
(com.ms.com.SafeArray::int computeOffset2 (int int)) |
|
920 |
(com.ms.com.SafeArray::void rawSetDouble (int double)) |
|
921 |
(com.ms.com.SafeArray::java.lang.String asString ()) |
|
922 |
(com.ms.com.SafeArray::void NRawCopyToJavaArray (int int java.lang.Object int)) |
|
923 |
(com.ms.com.SafeArray::void NSafeArrayCreate (int int int[] int[])) |
|
924 |
(com.ms.com.SafeArray::void NRawBoolCopyFromJavaArray (boolean[] int int int)) |
|
925 |
(com.ms.com.SafeArray::void NSafeArrayDestroy (boolean boolean)) |
|
926 |
(com.ms.com.SafeArray::int NSafeArrayCopy ()) |
|
927 |
(com.ms.com.SafeArray::int rawGetInt (int)) |
|
928 |
(com.ms.com.SafeArray::boolean rawGetBoolean (int)) |
|
929 |
(com.ms.com.SafeArray::void rawSetFloat (int float)) |
|
930 |
(com.ms.com.SafeArray::java.lang.String rawGetString (int)) |
|
931 |
(com.ms.com.SafeArray::int NTotalNumElems ()) |
|
932 |
(com.ms.com.SafeArray::double getDouble (int)) |
|
933 |
(com.ms.com.SafeArray::void setDouble (int double)) |
|
934 |
(com.ms.com.SafeArray::void Nreinit (com.ms.com.SafeArray)) |
|
935 |
(com.ms.com.SafeArray::int getPhysicalSafeArray ()) |
|
936 |
(com.ms.com.SafeArray::int NgetdwordAt (int)) |
|
937 |
(com.ms.com.SafeArray::void NRawCopyFromJavaArray (java.lang.Object int int int)) |
|
938 |
(com.ms.com.SafeArray::void rawSetBoolean (int boolean)) |
|
939 |
(com.ms.com.SafeArray::void rawSetInt (int int)) |
|
940 |
(com.ms.awt.peer.CNativeComponent::void invalidate (int int int int)) |
|
941 |
(com.ms.awt.peer.CNativeComponent::void hideModal ()) |
|
942 |
(com.ms.awt.peer.CNativeComponent::void hide ()) |
|
943 |
(com.ms.awt.peer.CNativeComponent::void setOnTop (int)) |
|
944 |
(com.ms.awt.peer.CNativeComponent::void registerDragDrop ()) |
|
945 |
(com.ms.awt.peer.CNativeComponent::void endValidate ()) |
|
946 |
(com.ms.awt.peer.CNativeComponent::void enable ()) |
|
947 |
(com.ms.awt.peer.CNativeComponent::void disable ()) |
|
948 |
(com.ms.awt.peer.CNativeComponent::void setTitle (java.lang.String)) |
|
949 |
(com.ms.awt.peer.CNativeComponent::void getBounds (com.ms.awt.peer.NativeRect)) |
|
950 |
(com.ms.awt.peer.CNativeComponent::int gethwnd ()) |
|
951 |
(com.ms.awt.peer.CNativeComponent::void showModal ()) |
|
952 |
(com.ms.awt.peer.CNativeComponent::void setCursor (int)) |
|
953 |
(com.ms.awt.peer.CNativeComponent::void reshape (int int int int)) |
|
954 |
(com.ms.awt.peer.CNativeComponent::void requestFocus ()) |
|
955 |
(com.ms.awt.peer.CNativeComponent::void callDefWindowProc (int int int int)) |
|
956 |
(com.ms.awt.peer.CNativeComponent::void registerCustomDropTarget (com.ms.com.IUnknown)) |
|
957 |
(com.ms.awt.peer.CNativeComponent::void setNoActivate (boolean)) |
|
958 |
(com.ms.awt.peer.CNativeComponent::void getPlaceOnScreen (com.ms.awt.peer.NativeRect)) |
|
959 |
(com.ms.awt.peer.CNativeComponent::void beginValidate ()) |
|
960 |
(com.ms.awt.peer.CNativeComponent::void clippedReshape (int int int int int)) |
|
961 |
(com.ms.awt.peer.CNativeComponent::void setResizable (boolean)) |
|
962 |
(com.ms.awt.peer.CNativeComponent::void setIcon (int)) |
|
963 |
(com.ms.awt.peer.CNativeComponent::void toBack ()) |
|
964 |
(com.ms.awt.peer.CNativeComponent::void setFrameHost (com.ms.awt.peer.IBrowserAppletFrameCallback)) |
|
965 |
(com.ms.awt.peer.CNativeComponent::void toFront ()) |
|
966 |
(com.ms.awt.peer.CNativeComponent::void show ()) |
|
967 |
(com.ms.awt.peer.CNativeComponent::void updateInsets (com.ms.awt.peer.NativeInsets)) |
|
968 |
(com.ms.awt.peer.CNativeComponent::void dispose ()) |
|
969 |
(com.ms.awt.peer.CNativeComponent::void initFromJavaWindow (int com.ms.awt.peer.IComponentCallback com.ms.awt.peer.INativeComponent com.ms.awt.peer.IToolkit int)) |
|
970 |
(com.ms.awt.peer.CNativeComponent::void init (int com.ms.awt.peer.IComponentCallback com.ms.awt.peer.INativeComponent com.ms.awt.peer.IToolkit)) |
|
971 |
(com.ms.awt.peer.CNativeComponent::void beginDrag (com.ms.awt.peer.INativeDragCallback)) |
|
972 |
(com.ms.fx.RegionConverter::int computeNativeRegion (int[])) |
|
973 |
(com.ms.fx.RegionConverter::int[] computeJavaRegion (int)) |
|
974 |
(com.ms.net.wininet.URLUtils::java.lang.String canonicalizeURL (java.lang.String int)) |
|
975 |
(com.ms.net.wininet.URLUtils::java.lang.String combineURL (java.lang.String java.lang.String int)) |
|
976 |
(com.ms.awt.peer.NativeFontMetrics::int bytesWidth (byte[] int int)) |
|
977 |
(com.ms.awt.peer.NativeFontMetrics::int stringWidth (java.lang.String int int[])) |
|
978 |
(com.ms.awt.peer.NativeFontMetrics::int charsWidth (char[] int int int int[])) |
|
979 |
(com.ms.awt.peer.NativeFontMetrics::java.lang.String init (com.ms.awt.peer.INativeGraphics int[] java.lang.String int int int)) |
|
980 |
(com.ms.io.console.Console::int MessageBox (int java.lang.String java.lang.String int)) |
|
981 |
(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)) |
|
982 |
(com.ms.security.management.SecurityZone::byte[] pLoadCustomPermissions (int int java.lang.String)) |
|
983 |
(com.ms.awt.peer.NativeImage::int setBytePixelsDirected (int int int int com.ms.awt.peer.DirectColourModelData byte[] int int com.ms.awt.peer.INativeImageBufferDone)) |
|
984 |
(com.ms.awt.peer.NativeImage::void create (int int int int)) |
|
985 |
(com.ms.awt.peer.NativeImage::int setIntPixelsIndexed (int int int int int[] int int[] int int com.ms.awt.peer.INativeImageBufferDone)) |
|
986 |
(com.ms.awt.peer.NativeImage::int getCoClass ()) |
|
987 |
(com.ms.awt.peer.NativeImage::int getIcon (int int int)) |
|
988 |
(com.ms.awt.peer.NativeImage::int setBytePixelsIndexed (int int int int int[] int byte[] int int com.ms.awt.peer.INativeImageBufferDone)) |
|
989 |
(com.ms.awt.peer.NativeImage::void sendPixels (com.ms.awt.peer.SPData)) |
|
990 |
(com.ms.awt.peer.NativeImage::void fillPixels (com.ms.awt.peer.SPData byte[])) |
|
991 |
(com.ms.awt.peer.NativeImage::void dispose ()) |
|
992 |
(com.ms.awt.peer.NativeImage::void init (int int int int int)) |
|
993 |
(com.ms.awt.peer.NativeImage::int setIntPixelsDirected (int int int int com.ms.awt.peer.DirectColourModelData int[] int int com.ms.awt.peer.INativeImageBufferDone)) |
|
994 |
(com.ms.awt.peer.NativeImage::void imageDrawStretched (com.ms.awt.peer.INativeGraphics int int int int int int int int int int)) |
|
995 |
(com.ms.awt.peer.NativeImage::int finish (int)) |
|
996 |
(com.ms.awt.peer.NativeImage::void imageDraw (int int int int int)) |
|
997 |
(com.ms.awt.peer.NativeResource::java.lang.String loadString (int)) |
|
998 |
(com.ms.awt.peer.NativeResource::int openDialogFromID (int)) |
|
999 |
(com.ms.awt.peer.NativeResource::boolean attach (java.lang.String)) |
|
1000 |
(com.ms.awt.peer.NativeResource::void loadBytes (int int java.lang.String byte[] int)) |
|
1001 |
(com.ms.awt.peer.NativeResource::int getSize (int int java.lang.String)) |
|
1002 |
(com.ms.awt.peer.NativeResource::void detach ()) |
|
1003 |
(com.ms.awt.peer.NativeResource::int openDialogFromName (java.lang.String)) |
|
1004 |
(com.ms.net.wininet.WininetURLConnection::com.ms.applet.BrowserAppletFrame findOfflineContext ()) |
|
1005 |
(com.ms.com.DispatchProxy::void finalize ()) |
|
1006 |
(com.ms.com.DispatchProxy::void init (com.ms.com._Guid java.lang.reflect.Method[] int[])) |
|
1007 |
(com.ms.net.wininet.WininetInputStream::void close ()) |
|
1008 |
(com.ms.net.wininet.WininetInputStream::int read (byte[] int int)) |
|
1009 |
(com.ms.net.wininet.WininetInputStream::int available ()) |
|
1010 |
(com.ms.net.wininet.WininetInputStream::long skip (long)) |
|
1011 |
(com.ms.net.wininet.WininetInputStream::void connect (java.lang.String boolean boolean java.lang.SecurityManager)) |
|
1012 |
(com.ms.vm.loader.CabSignatureInfo::com.ms.vm.loader.CabSignatureInfo extractFromFile0 (java.lang.String com.ms.security.management.SecurityPolicy)) |
|
1013 |
(com.ms.net.wininet.http.HttpInputStream::byte[] getResponseHeaders ()) |
|
1014 |
(com.ms.net.wininet.http.HttpInputStream::void close0 ()) |
|
1015 |
(com.ms.net.wininet.http.HttpInputStream::void connect (java.lang.String int java.lang.String boolean boolean boolean boolean byte[] byte[] java.lang.SecurityManager)) |
|
1016 |
(com.ms.vm.loader.CabCracker::int GetTempFileName (java.lang.StringBuffer java.lang.String int java.lang.StringBuffer)) |
|
1017 |
(com.ms.vm.loader.CabCracker::void getBytes0 (int int byte[])) |
|
1018 |
(com.ms.vm.loader.CabCracker::void cleanup ()) |
|
1019 |
(com.ms.vm.loader.CabCracker::int GetTempPath (int java.lang.StringBuffer)) |
|
1020 |
(com.ms.vm.loader.CabCracker::void load0 ()) |
|
1021 |
||
1022 |
||
261 | 1023 |
" |
1024 |
||
432 | 1025 |
! |
1026 |
||
1027 |
performance |
|
1028 |
" |
|
447 | 1029 |
JAVA::BenchMark new loopmark |
432 | 1030 |
JAVA::BenchMark new logicmark |
447 | 1031 |
JAVA::BenchMark new sievemark |
1032 |
JAVA::BenchMark new methodmark |
|
432 | 1033 |
JAVA::BenchMark new stringmark |
1034 |
JAVA::BenchMark new newstringmark |
|
1035 |
JAVA::BenchMark new neweststringmark |
|
1036 |
||
1037 |
||
1038 |
" |
|
1039 |
" |
|
512 | 1040 |
caffmark loopmark logicmark sievemark methodmark stringmark float image graphic dialog newstringmark neweststringmark |
457 | 1041 |
linux: |
512 | 1042 |
P6/233 No JIT 84 87 90 40 22 17 10 |
1043 |
P6/233 JIT 479 2459 393 649 28 21 12 |
|
1044 |
P6/233 JIT 473 1805 3046 439 986 28 21 12 |
|
460 | 1045 |
533 1808 3382 613 1003 25 105 143 1 |
464 | 1046 |
668 3330 3644 740 |
503 | 1047 |
793 4116 3731 1243 1365 120 103 79 2 |
513 | 1048 |
914 4480 4061 2290 68 106 158 19 34 |
1049 |
941 4607 4149 1238 2434 75 101 152 18 32 |
|
457 | 1050 |
|
1051 |
w95 |
|
1052 |
P5/200 JIT 90 95 90 95 686 18 60 54 7 |
|
459 | 1053 |
428 1657 2385 684 957 21 61 62 9 |
465 | 1054 |
541 2886 2589 823 976 18 62 55 7 |
507 | 1055 |
583 3062 2635 842 861 223 65 57 8 |
1056 |
616 3075 2438 1081 1324 218 64 54 8 |
|
432 | 1057 |
" |
1058 |
||
441 | 1059 |
! |
1060 |
||
1061 |
performance2 |
|
1062 |
" |
|
1063 |
symantec benchmarks |
|
1064 |
||
1065 |
||
1066 |
" |
|
1067 |
" |
|
1068 |
BubbleSort BidirBubbleSort QuickSort Sieve Hanoi Dhry Fib Array Tree Total |
|
1069 |
||
499 | 1070 |
ST/X+J Linux |
455 | 1071 |
233Mhz P6 |
441 | 1072 |
No JIT 352767 354597 69585 43048 101638 28961 108839 48815 |
1073 |
||
499 | 1074 |
ST/X+J Linux |
455 | 1075 |
233Mhz P6 |
441 | 1076 |
JIT 128724 116810 20259 39733 83160 27613 52093 33166 43996 545554 |
447 | 1077 |
124744 101428 17239 10052 8264 14004 38821 23252 33709 374660 |
455 | 1078 |
+IINC 120324 7265 |
1079 |
+IADD op2 100173 90737 18128 6996 7423 17093 48559 44209 57056 390374 |
|
1080 |
+ISUB op2 90460 17547 5921 57056 390461 |
|
1081 |
+ICMPEQ/NE 99785 90147 5792 43482 56486 388255 |
|
460 | 1082 |
+ICMP 87398 78214 15784 7574 5628 12812 38481 24654 32252 302797 |
461 | 1083 |
+IFICMPLE 84198 74928 13814 5650 11674 23241 293118 |
1084 |
+IFICMPxx 76867 69738 12208 37505 21973 32104 273569 |
|
1085 |
+IFICMPEQ/NE 5580 11202 21723 |
|
1086 |
const IFICMPxx 11856 5463 11032 37372 272726 |
|
462 | 1087 |
+lea for add/sub |
463 | 1088 |
+BALOAD 11700 4600 5015 9431 |
1089 |
+BASTORE 3279 |
|
1090 |
+CALOAD/CASTORE 8907 |
|
466 | 1091 |
regSave change 66119 60365 9997 4917 15386 37851 38202 50027 286497 |
469 | 1092 |
64858 58360 9476 4889 15001 37211 36288 48313 278478 |
1093 |
63146 55949 9302 14899 |
|
1094 |
62970 56085 9352 3226 4837 8779 37573 22815 33899 241297 |
|
471 | 1095 |
-O 43662 40292 7181 2530 4696 8170 34555 22116 32337 195539 |
474 | 1096 |
|
471 | 1097 |
+IALOAD 39162 36347 |
1098 |
+IASTORE 32461 30663 4299 3667 19556 30563 166868 |
|
474 | 1099 |
|
1100 |
-IALOAD/IASTORE |
|
1101 |
34167 19347 |
|
1102 |
19232 29726 |
|
1103 |
18821 |
|
496 | 1104 |
+AALOAD/BALOAD |
1105 |
41490 39527 6776 3315 4077 8443 33895 19152 28018 184693 |
|
497 | 1106 |
41291 37034 6593 32682 |
1107 |
+ATHROW 6449 180079 |
|
498 | 1108 |
+IASTORE 38848 35601 6219 3796 6122 17869 30085 175106 |
503 | 1109 |
IINC delayed code |
1110 |
+ANEWARRAY 3263 |
|
1111 |
+LADD/LSUB const 38719 35256 6062 27071 172859 |
|
512 | 1112 |
|
1113 |
2837 22835 |
|
514 | 1114 |
+ISTORE into arg |
1115 |
3080 |
|
1116 |
quick L2I for ints 2774 21184 |
|
1117 |
+*ASTORE / *ALOAD |
|
1118 |
again 1621 3654 1525 |
|
441 | 1119 |
------------------------------------------------------------------------------------------------------------ |
507 | 1120 |
BubbleSort BidirBubbleSort QuickSort Sieve Hanoi Dhry Fib Array Tree Total |
499 | 1121 |
ST/X+J Win95 |
498 | 1122 |
200Mhz P5 |
1123 |
JIT 78490 77060 15220 4840 6370 9180 73160 36080 351700 |
|
503 | 1124 |
76900 13560 5500 9010 35200 348600 |
507 | 1125 |
66080 69920 370750 |
1126 |
+IADD non consts 76620 73210 13180 3790 63550 58880 356900 |
|
1127 |
51740 |
|
1128 |
77390 72450 12520 3900 6040 8950 62450 34330 57780 335810 |
|
1129 |
77220 71950 5270 8840 338650 |
|
1130 |
72390 70690 48010 327370 |
|
1131 |
74910 66740 11420 8620 61730 33340 47350 313940 |
|
1132 |
+xALOAD/JMP_ZERO |
|
1133 |
71740 2800 |
|
1134 |
71460 65250 11540 2750 62180 33840 50750 311660 |
|
1135 |
+LCMP 59100 |
|
1136 |
better abs(I) |
|
1137 |
+xALOAD/IF_ICMPx 66130 61520 12080 3300 5280 8190 56510 33830 50310 297150 |
|
1138 |
elim dummy static 5210 48270 |
|
1139 |
methods 44160 |
|
498 | 1140 |
------------------------------------------------------------------------------------------------------------ |
507 | 1141 |
BubbleSort BidirBubbleSort QuickSort Sieve Hanoi Dhry Fib Array Tree Total |
498 | 1142 |
|
441 | 1143 |
|
1144 |
Sun JDK 274625 244461 52676 50653 65183 26668 78133 28572 61608 882583 |
|
455 | 1145 |
(90Mhz P5) |
441 | 1146 |
|
1147 |
Microsoft J++ 9684 8452 2874 1733 3535 3665 3836 4746 25717 64242 |
|
455 | 1148 |
(90Mhz P5) |
441 | 1149 |
|
1150 |
Symantec Cafe 14541 12198 3686 1922 4527 3325 3425 12969 26829 83422 |
|
1151 |
JIT 1.02 |
|
1152 |
(90Mhz P5) |
|
1153 |
||
1154 |
Symantec Cafe 8292 6970 2714 1613 3345 3235 2013 4516 13180 45878 |
|
1155 |
JIT 1.2 |
|
1156 |
(90Mhz P5) |
|
1157 |
" |
|
1158 |
||
471 | 1159 |
" |
1160 |
|b| |
|
1161 |
||
1162 |
b := JAVA::BubbleSortAlgorithm new. |
|
1163 |
b perform:#'setData(JJ)V' with:10000 with:0 with:0 with:0. |
|
1164 |
Time millisecondsToRun:[ |
|
1165 |
b performTest. |
|
1166 |
] |
|
1167 |
" |
|
1168 |
" |
|
1169 |
|b| |
|
1170 |
||
1171 |
b := JAVA::QSortAlgorithm new. |
|
1172 |
b perform:#'setData(JJ)V' with:500000 with:0 with:0 with:0. |
|
1173 |
Time millisecondsToRun:[ |
|
1174 |
b performTest. |
|
1175 |
] |
|
1176 |
" |
|
1177 |
" |
|
1178 |
|t| |
|
1179 |
||
1180 |
t := JAVA::Tree new. |
|
1181 |
t perform:#'setData(JJ)V' with:1000000 with:0 with:0 with:0. |
|
1182 |
Time millisecondsToRun:[ |
|
1183 |
t performTest. |
|
1184 |
] |
|
1185 |
" |
|
1186 |
" |
|
1187 |
|t| |
|
1188 |
||
1189 |
t := JAVA::Array new. |
|
1190 |
t perform:#'setData(JJ)V' with:1000000 with:0 with:0 with:0. |
|
1191 |
Time millisecondsToRun:[ |
|
1192 |
t performTest. |
|
1193 |
] |
|
1194 |
" |
|
1195 |
||
261 | 1196 |
! ! |
253 | 1197 |
|
1198 |
!JavaVM class methodsFor:'initialization'! |
|
1199 |
||
423 | 1200 |
compile:source selector:smalltalkSelector asJavaMethod:javaSelector fakedSource:fakedSource in:aClass |
1201 |
"install additional java protocol in smalltalk classes, req'd for java programs" |
|
1202 |
||
1203 |
|cloneCode| |
|
1204 |
||
1205 |
(aClass implements:javaSelector) ifFalse:[ |
|
1206 |
aClass |
|
1207 |
compile:source |
|
1208 |
classified:'java support' |
|
1209 |
logged:false. |
|
1210 |
||
1211 |
cloneCode := aClass compiledMethodAt:smalltalkSelector. |
|
1212 |
cloneCode source:fakedSource. |
|
1213 |
||
1214 |
Class withoutUpdatingChangesDo:[ |
|
1215 |
aClass removeSelector:smalltalkSelector. |
|
1216 |
aClass addSelector:javaSelector withMethod:cloneCode. |
|
1217 |
] |
|
1218 |
]. |
|
1219 |
||
1220 |
"Created: / 5.11.1998 / 19:30:22 / cg" |
|
1221 |
"Modified: / 5.11.1998 / 19:37:57 / cg" |
|
1222 |
! |
|
1223 |
||
253 | 1224 |
deinitialize |
1225 |
|table| |
|
1226 |
||
1227 |
StandardThreadGroup := nil. |
|
1228 |
self releaseAllMonitors. |
|
1229 |
||
480 | 1230 |
KnownWindows notNil ifTrue:[ |
1231 |
KnownWindows do:[:v | |
|
1232 |
v isTopView ifTrue:[ |
|
1233 |
v destroy |
|
1234 |
] |
|
1235 |
] |
|
1236 |
]. |
|
1237 |
||
253 | 1238 |
JavaWindowGroup := nil. |
1239 |
KnownWindows := nil. |
|
1240 |
OpenFileTable := nil. |
|
1241 |
JavaClasses := nil. |
|
380 | 1242 |
JavaMethods := nil. |
253 | 1243 |
|
1244 |
" |
|
1245 |
JavaVM deinitialize |
|
1246 |
" |
|
1247 |
||
1248 |
"Created: / 3.1.1998 / 21:28:14 / cg" |
|
480 | 1249 |
"Modified: / 3.12.1998 / 20:33:21 / cg" |
253 | 1250 |
! |
1251 |
||
307 | 1252 |
deinitializeAdditionalJavaProtocol |
1253 |
"install additional java protocol in smalltalk classes, req'd for java programs" |
|
1254 |
||
459 | 1255 |
#( |
1256 |
#'clone()Ljava/lang/Object;' |
|
1257 |
#'equals(Ljava/lang/Object;)Z' |
|
1258 |
#'toString()Ljava/lang/String;' |
|
489 | 1259 |
#'getClass()Ljava/lang/Class;' |
459 | 1260 |
) do:[:sel | |
1261 |
(Object implements:sel) ifTrue:[ |
|
1262 |
Class withoutUpdatingChangesDo:[ |
|
1263 |
Object removeSelector:sel. |
|
1264 |
] |
|
1265 |
]. |
|
307 | 1266 |
]. |
1267 |
||
1268 |
" |
|
1269 |
self deinitializeAdditionalJavaProtocol |
|
1270 |
" |
|
1271 |
||
1272 |
"Created: / 4.2.1998 / 21:37:10 / cg" |
|
489 | 1273 |
"Modified: / 5.12.1998 / 15:27:39 / cg" |
307 | 1274 |
! |
1275 |
||
253 | 1276 |
initialize |
1277 |
|table| |
|
1278 |
||
1279 |
DUMMY_LONG_HIGHWORD := 1. |
|
1280 |
DUMMY_DOUBLE_HIGHWORD := 2. |
|
1281 |
||
1282 |
StandardThreadGroup := nil. |
|
261 | 1283 |
NoAudio := true. |
262 | 1284 |
"/ NoAudio := false. |
253 | 1285 |
|
1286 |
JavaConsoleStream := Transcript. |
|
1287 |
||
1288 |
FullExceptionTrace := StackTrace := false. |
|
1289 |
WindowOPTrace := DrawOPTrace := EventTrace := ThreadTrace := false. |
|
1290 |
MonitorTrace := ExceptionTrace := FileOpenTrace := FileIOTrace := false. |
|
474 | 1291 |
ExceptionDebug := ExitDebug := false. |
253 | 1292 |
WindowCreationTrace := false. |
1293 |
||
1294 |
FileOpenConfirmation := true. |
|
390 | 1295 |
SocketConnectConfirmation := true. |
253 | 1296 |
|
255 | 1297 |
"/ WindowOPTrace := true. |
1298 |
"/ MonitorTrace := true. |
|
1299 |
"/ ThreadTrace := true. |
|
253 | 1300 |
|
1301 |
UnhandledJavaExceptionSignal := (Signal new) mayProceed:false. |
|
1302 |
UnhandledJavaExceptionSignal nameClass:self message:#unhandledJavaExceptionSignal. |
|
1303 |
UnhandledJavaExceptionSignal notifierString:'unhandled java exception'. |
|
1304 |
||
1305 |
JavaExceptionSignal := (Signal new) mayProceed:false. |
|
1306 |
JavaExceptionSignal nameClass:self message:#javaExceptionSignal. |
|
1307 |
JavaExceptionSignal notifierString:'java exception'. |
|
1308 |
||
1309 |
UnimplementedInstructionSignal := (Signal new) mayProceed:false. |
|
1310 |
UnimplementedInstructionSignal nameClass:self message:#unimplementedInstructionSignal. |
|
1311 |
UnimplementedInstructionSignal notifierString:'unimplemented instruction'. |
|
1312 |
||
1313 |
UnimplementedNativeMethodSignal := (Signal new) mayProceed:false. |
|
1314 |
UnimplementedNativeMethodSignal nameClass:self message:#unimplementedNativeMethodSignal. |
|
1315 |
UnimplementedNativeMethodSignal notifierString:'unimplemented native method'. |
|
1316 |
||
1317 |
BadMessageSignal := (Signal new) mayProceed:false. |
|
1318 |
BadMessageSignal nameClass:self message:#badMessageSignal. |
|
1319 |
BadMessageSignal notifierString:'invalid message to JAVA object'. |
|
1320 |
||
1321 |
InternalErrorSignal := (Signal new) mayProceed:false. |
|
1322 |
InternalErrorSignal nameClass:self message:#internalErrorSignal. |
|
1323 |
InternalErrorSignal notifierString:'internal error'. |
|
1324 |
||
1325 |
CallHandlerSignal := (Signal new) mayProceed:false. |
|
1326 |
CallHandlerSignal nameClass:self message:#callHandlerSignal. |
|
1327 |
CallHandlerSignal notifierString:'internal signal'. |
|
1328 |
||
1329 |
" |
|
1330 |
JavaVM initialize |
|
1331 |
" |
|
1332 |
||
1333 |
"Created: / 2.1.1998 / 18:02:34 / cg" |
|
474 | 1334 |
"Modified: / 2.12.1998 / 23:02:22 / cg" |
253 | 1335 |
! |
1336 |
||
307 | 1337 |
initializeAdditionalJavaProtocol |
1338 |
"install additional java protocol in smalltalk classes, req'd for java programs" |
|
1339 |
||
1340 |
"/ since we use smalltalk Arrays for JavaArray, some |
|
1341 |
"/ additional (java-) protocol is required. |
|
423 | 1342 |
"/ This is also useful, when Smalltalk objects are passed to |
1343 |
"/ java ... |
|
1344 |
"/ We should implement all of the java.lang.Object protocol in |
|
1345 |
"/ Object, to be on the bright side of life; more of this later ... |
|
1346 |
||
1347 |
self |
|
1348 |
compile:'__clone |
|
307 | 1349 |
"this is smalltalk code with a java selector ... |
430 | 1350 |
(This source cannot be accepted in the browser, |
1351 |
since it has a funny selector.) |
|
307 | 1352 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
1353 |
||
1354 |
^ self shallowCopy' |
|
423 | 1355 |
selector:#'__clone' |
1356 |
asJavaMethod:#'clone()Ljava/lang/Object;' |
|
1357 |
fakedSource:'#''clone()Ljava/lang/Object;'' |
|
307 | 1358 |
"this is smalltalk code with a java selector ... |
430 | 1359 |
(This source cannot be accepted in the browser, |
1360 |
since it has a funny selector.) |
|
307 | 1361 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
1362 |
||
423 | 1363 |
^ self shallowCopy' |
1364 |
in:Object. |
|
1365 |
||
489 | 1366 |
"/ ------------------------------------------------------------ |
1367 |
||
423 | 1368 |
self |
430 | 1369 |
compile:'__equals:arg |
1370 |
"this is smalltalk code with a java selector ... |
|
1371 |
(This source cannot be accepted in the browser, |
|
1372 |
since it has a funny selector.) |
|
1373 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
|
1374 |
||
1375 |
^ (arg = self) ifTrue:[1] ifFalse:[0]' |
|
1376 |
selector:#'__equals:' |
|
1377 |
asJavaMethod:#'equals(Ljava/lang/Object;)Z' |
|
1378 |
fakedSource:'#''equals(Ljava/lang/Object;)Z'' |
|
1379 |
"this is smalltalk code with a java selector ... |
|
1380 |
(This source cannot be accepted in the browser, |
|
1381 |
since it has a funny selector.) |
|
1382 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
|
1383 |
||
1384 |
^ (arg = self) ifTrue:[1] ifFalse:[0]' |
|
1385 |
in:Object. |
|
1386 |
||
489 | 1387 |
"/ ------------------------------------------------------------ |
1388 |
||
430 | 1389 |
self |
423 | 1390 |
compile:'__toString |
1391 |
"this is smalltalk code with a java selector ... |
|
430 | 1392 |
(This source cannot be accepted in the browser, |
1393 |
since it has a funny selector.) |
|
423 | 1394 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
1395 |
||
1396 |
^ Java as_String:(self displayString)' |
|
1397 |
selector:#'__toString' |
|
1398 |
asJavaMethod:#'toString()Ljava/lang/String;' |
|
1399 |
fakedSource:'#''toString()Ljava/lang/String;'' |
|
1400 |
"this is smalltalk code with a java selector ... |
|
430 | 1401 |
(This source cannot be accepted in the browser, |
1402 |
since it has a funny selector.) |
|
423 | 1403 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
1404 |
||
1405 |
^ Java as_String:(self displayString)' |
|
489 | 1406 |
in:Object. |
1407 |
||
1408 |
"/ ------------------------------------------------------------ |
|
1409 |
||
1410 |
self |
|
1411 |
compile:'__getClass |
|
1412 |
"this is smalltalk code with a java selector ... |
|
1413 |
(This source cannot be accepted in the browser, |
|
1414 |
since it has a funny selector.) |
|
1415 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
|
1416 |
||
508 | 1417 |
^ JavaVM javaClassObjectForClass:self class' |
489 | 1418 |
selector:#'__getClass' |
1419 |
asJavaMethod:#'getClass()Ljava/lang/Class;' |
|
1420 |
fakedSource:'#''getClass()Ljava/lang/Class;'' |
|
1421 |
"this is smalltalk code with a java selector ... |
|
1422 |
(This source cannot be accepted in the browser, |
|
1423 |
since it has a funny selector.) |
|
1424 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
|
1425 |
||
1426 |
^ JavaVM javaClassObjectForClass:self class' |
|
1427 |
in:Object. |
|
307 | 1428 |
|
1429 |
" |
|
1430 |
self initializeAdditionalJavaProtocol |
|
1431 |
" |
|
1432 |
||
1433 |
"Modified: / 28.1.1997 / 19:38:58 / stefan" |
|
1434 |
"Modified: / 22.1.1998 / 21:23:40 / av" |
|
1435 |
"Created: / 4.2.1998 / 21:35:46 / cg" |
|
508 | 1436 |
"Modified: / 30.12.1998 / 21:07:55 / cg" |
307 | 1437 |
! |
1438 |
||
253 | 1439 |
initializeBaseClasses |
1440 |
"load req'd base classes" |
|
1441 |
||
326 | 1442 |
#( |
1443 |
'java.lang.Object' |
|
1444 |
'java.lang.Class' |
|
1445 |
'java.lang.String' |
|
1446 |
'java.lang.System' |
|
1447 |
) do:[:cName | |
|
1448 |
(Java classForName:cName) isNil ifTrue:[ |
|
1449 |
self halt:('could not find required class:' , cName) |
|
1450 |
] |
|
1451 |
]. |
|
253 | 1452 |
|
1453 |
" |
|
1454 |
self initializeBaseClasses |
|
1455 |
" |
|
1456 |
||
1457 |
"Created: / 3.1.1998 / 21:13:28 / cg" |
|
326 | 1458 |
"Modified: / 30.3.1998 / 17:47:02 / cg" |
253 | 1459 |
! |
1460 |
||
1461 |
initializeOpenFileTable |
|
1462 |
OpenFileTable := OrderedCollection |
|
261 | 1463 |
with:Stdin |
1464 |
with:(JavaConsoleStream ? Stdout) |
|
1465 |
with:(JavaConsoleStream ? Stderr). |
|
253 | 1466 |
|
1467 |
" |
|
1468 |
JavaVM initializeOpenFileTable |
|
1469 |
" |
|
1470 |
||
1471 |
"Modified: / 6.8.1997 / 00:40:19 / cg" |
|
1472 |
"Created: / 2.1.1998 / 18:04:32 / cg" |
|
1473 |
! |
|
1474 |
||
1475 |
initializePrimitiveClasses |
|
1476 |
JavaClasses isNil ifTrue:[ |
|
405 | 1477 |
JavaClasses := Dictionary new. |
253 | 1478 |
]. |
1479 |
||
1480 |
#( |
|
405 | 1481 |
(#byte 'B' 1) |
1482 |
(#short 'S' 2) |
|
1483 |
(#int 'I' 4) |
|
1484 |
(#long 'J' 8) |
|
1485 |
(#boolean 'Z' 1) |
|
1486 |
(#char 'C' 2) |
|
1487 |
(#float 'F' 4) |
|
1488 |
(#double 'D' 8) |
|
1489 |
(#void 'V' 0) |
|
253 | 1490 |
) triplesDo:[:nm :sig :len | |
405 | 1491 |
|stClass jClass| |
1492 |
||
1493 |
"/ |
|
1494 |
"/ create a javaClass for it. |
|
1495 |
"/ |
|
1496 |
jClass := (Java at:'java.lang.Class') new. |
|
253 | 1497 |
"/ stClass := Class new. |
1498 |
"/ stClass setName:('JavaBase_' , nm) asSymbol. |
|
1499 |
"/ JavaClasses at:stClass put:jClass. |
|
1500 |
"/ JavaClasses at:jClass put:stClass. |
|
1501 |
||
405 | 1502 |
JavaClasses at:nm put:jClass |
253 | 1503 |
]. |
1504 |
||
1505 |
" |
|
1506 |
self initializePrimitiveClasses |
|
1507 |
" |
|
1508 |
||
405 | 1509 |
"Modified: / 22.10.1998 / 01:56:02 / cg" |
253 | 1510 |
! |
1511 |
||
1512 |
initializeSimulatedLibs |
|
277 | 1513 |
"return a collection of native libs which are considered |
1514 |
being already loaded. (used with jdk < 1.2)" |
|
1515 |
||
432 | 1516 |
LibPath := #( |
1517 |
'__builtIn__' |
|
1518 |
'/usr/local/lib' |
|
1519 |
'/usr/local/lib/java' |
|
1520 |
). |
|
1521 |
||
1522 |
SimulatedLibs := #( |
|
1523 |
'__builtIn__/net' |
|
1524 |
'__builtIn__/awt' |
|
1525 |
'__builtIn__/tawt' |
|
1526 |
'__builtIn__/winawt' |
|
1527 |
'__builtIn__/jpeg' |
|
1528 |
'__builtIn__/mmedia' |
|
1529 |
'__builtIn__/zip' |
|
1530 |
'__builtIn__/math' |
|
1531 |
||
1532 |
"/ KAVA ... |
|
1533 |
'__builtIn__/agent' |
|
457 | 1534 |
|
1535 |
"/ MS-java ... |
|
1536 |
'__builtIn__/msawt' |
|
1537 |
'__builtIn__/javart' |
|
277 | 1538 |
). |
253 | 1539 |
|
457 | 1540 |
" |
1541 |
self initializeSimulatedLibs |
|
1542 |
" |
|
1543 |
||
253 | 1544 |
"Created: / 4.1.1998 / 19:05:03 / cg" |
457 | 1545 |
"Modified: / 17.11.1998 / 23:53:02 / cg" |
277 | 1546 |
! |
1547 |
||
1548 |
initializeSimulatedNativeLibs |
|
1549 |
"return a collection of native libs which are considered |
|
1550 |
being already loaded (used with jdk >= 1.2)" |
|
1551 |
||
1552 |
SimulatedNativeLibs := #( |
|
1553 |
'/libawt.so' |
|
1554 |
). |
|
1555 |
||
1556 |
" |
|
1557 |
self initializeSimulatedNativeLibs |
|
1558 |
" |
|
1559 |
||
1560 |
"Modified: / 27.1.1998 / 18:43:10 / cg" |
|
253 | 1561 |
! |
1562 |
||
1563 |
initializeSystemPropertiesInto:props |
|
495 | 1564 |
|cpu os | |
253 | 1565 |
|
1566 |
"/ use JAVA compatible cpu-name |
|
1567 |
cpu := OperatingSystem getCPUType. |
|
1568 |
cpu = 'i386' ifTrue:[ |
|
280 | 1569 |
cpu := 'ix86' |
253 | 1570 |
]. |
475 | 1571 |
SimulatedOS notNil ifTrue:[ |
474 | 1572 |
os := SimulatedOS |
1573 |
] ifFalse:[ |
|
1574 |
os := OperatingSystem getOSType. |
|
1575 |
os := os asUppercaseFirst. |
|
1576 |
]. |
|
253 | 1577 |
|
1578 |
props at:'java.version' put:'1'. |
|
1579 |
props at:'java.vendor' put:'eXept Software AG'. |
|
342 | 1580 |
props at:'java.vendor.url' put:'http://www.exept.de'. |
253 | 1581 |
props at:'java.home' put:(self defaultJAVAHome). |
1582 |
props at:'java.class.version' put:'1'. |
|
1583 |
props at:'java.class.path' put:(self defaultCLASSPATH). |
|
1584 |
props at:'os.name' put:os. |
|
1585 |
props at:'os.arch' put:cpu. |
|
1586 |
props at:'os.version' put:'1'. |
|
1587 |
props at:'file.separator' put:(Filename separator asString). |
|
1588 |
props at:'path.separator' put:':'. |
|
1589 |
props at:'line.separator' put:(Character cr asString). |
|
1590 |
props at:'user.name' put:(OperatingSystem getLoginName). |
|
388 | 1591 |
props at:'user.home' put:(OperatingSystem getHomeDirectory ? Filename currentDirectory name). |
495 | 1592 |
props at:'user.dir' put:(OperatingSystem getHomeDirectory ? Filename currentDirectory name). |
1593 |
"/ props at:'user.dir' put:(Filename currentDirectory pathName). |
|
253 | 1594 |
|
1595 |
props at:'awt.toolkit' put:(self defaultWindowingToolKit). |
|
1596 |
||
1597 |
props at:'hotjava.home' put:(self defaultHotJavaHome). |
|
1598 |
||
1599 |
"/ undocumented ? |
|
255 | 1600 |
props at:'file.encoding.pkg' put:'sun.io'. |
253 | 1601 |
|
1602 |
"/ suppress copyright view in appletViewer ... |
|
1603 |
props at:'appletviewer.version' put:'1.1'. |
|
1604 |
||
280 | 1605 |
"/ new with jdk 1.2 |
1606 |
props at:'java.awt.graphicsenv' put:'sun.awt.X11GraphicsEnvironment'. |
|
284 | 1607 |
props at:'java.awt.fonts' put:'/usr/lib/X11/fonts'. |
280 | 1608 |
|
474 | 1609 |
"/ jws |
1610 |
props at:'jws.home' put:(self defaultJWSHome). |
|
1611 |
"/ new with jws 2.0 ... |
|
1612 |
props at:'jws.startcmd' put:'jws.showwin.mainide'. |
|
1613 |
||
253 | 1614 |
^ props |
1615 |
||
388 | 1616 |
" |
1617 |
self initializeSystemPropertiesInto:(Dictionary new) |
|
1618 |
" |
|
1619 |
||
253 | 1620 |
"Created: / 3.1.1998 / 14:26:39 / cg" |
495 | 1621 |
"Modified: / 11.12.1998 / 14:17:13 / cg" |
253 | 1622 |
! |
1623 |
||
1624 |
initializeVM |
|
307 | 1625 |
self initializeAdditionalJavaProtocol. |
1626 |
||
285 | 1627 |
self releaseAllJavaResources. |
255 | 1628 |
|
261 | 1629 |
JavaConsoleStream := Transcript. |
1630 |
||
255 | 1631 |
Java initAllStaticFields. |
1632 |
Java markAllClassesUninitialized. |
|
1633 |
||
429 | 1634 |
"/ force re-resolving; |
1635 |
"/ otherwise, class-inits would not be called |
|
1636 |
"/ by resolver ... (sigh) |
|
1637 |
||
1638 |
JavaMethod allSubInstancesDo:[:m | |
|
1639 |
m checked:false. |
|
1640 |
m code:nil. |
|
1641 |
]. |
|
1642 |
ObjectMemory flushCaches. "/ sigh - must flush inline caches. |
|
1643 |
||
434 | 1644 |
JavaClass startRememberingOrderOfClassInits. |
1645 |
||
277 | 1646 |
self initializeSimulatedLibs. "/ < jdk 1.2 |
1647 |
self initializeSimulatedNativeLibs. "/ >= jdk 1.2 |
|
253 | 1648 |
self initializeOpenFileTable. |
1649 |
||
1650 |
self initializeBaseClasses. |
|
1651 |
self initializePrimitiveClasses. |
|
1652 |
||
1653 |
Java initSystemClass. |
|
1654 |
||
255 | 1655 |
ObjectMemory addDependent:self. |
1656 |
||
253 | 1657 |
" |
285 | 1658 |
JavaVM initialize. |
1659 |
JavaVM initializeVM. |
|
253 | 1660 |
" |
1661 |
||
1662 |
"Created: / 3.1.1998 / 21:29:09 / cg" |
|
480 | 1663 |
"Modified: / 3.12.1998 / 20:33:02 / cg" |
261 | 1664 |
! |
1665 |
||
1666 |
initializeVMIfNoEventThreadRunning |
|
1667 |
(JavaEventThread isNil or:[JavaEventThread isDead]) ifTrue:[ |
|
270 | 1668 |
self initializeVM |
261 | 1669 |
]. |
1670 |
||
1671 |
" |
|
1672 |
JavaVM initializeVMIfNoEventThreadRunning |
|
1673 |
" |
|
1674 |
||
1675 |
"Modified: / 15.1.1998 / 17:29:34 / cg" |
|
1676 |
"Created: / 15.1.1998 / 17:32:27 / cg" |
|
255 | 1677 |
! |
1678 |
||
434 | 1679 |
reinitializeVM |
1680 |
|classesToInit| |
|
1681 |
||
1682 |
self releaseAllJavaResources. |
|
1683 |
||
1684 |
JavaConsoleStream := Transcript. |
|
1685 |
||
1686 |
Java initAllStaticFields. |
|
1687 |
Java markAllClassesUninitialized. |
|
1688 |
||
1689 |
self initializeOpenFileTable. |
|
1690 |
||
1691 |
classesToInit := JavaClass orderOfClassInits. |
|
1692 |
JavaClass startRememberingOrderOfClassInits. |
|
1693 |
||
451 | 1694 |
self initializePrimitiveClasses. |
455 | 1695 |
"/ Java initSystemClass. |
434 | 1696 |
|
1697 |
classesToInit do:[:jClass | |
|
455 | 1698 |
Transcript showCR:'classInit: ' , jClass name. |
434 | 1699 |
jClass classInit |
1700 |
]. |
|
455 | 1701 |
Java initSystemClass. |
434 | 1702 |
|
1703 |
"Created: / 12.11.1998 / 15:37:52 / cg" |
|
455 | 1704 |
"Modified: / 17.11.1998 / 16:10:11 / cg" |
434 | 1705 |
! |
1706 |
||
462 | 1707 |
reinitializeVMIfNoEventThreadRunning |
1708 |
(JavaEventThread isNil or:[JavaEventThread isDead]) ifTrue:[ |
|
1709 |
self reinitializeVM |
|
1710 |
]. |
|
1711 |
||
1712 |
" |
|
1713 |
JavaVM reinitializeVMIfNoEventThreadRunning |
|
1714 |
" |
|
1715 |
||
1716 |
"Modified: / 15.1.1998 / 17:29:34 / cg" |
|
1717 |
"Created: / 24.11.1998 / 15:45:49 / cg" |
|
1718 |
! |
|
1719 |
||
255 | 1720 |
releaseAllJavaResources |
380 | 1721 |
self deinitialize. |
1722 |
||
285 | 1723 |
FirstWindowCreationSemaphore := Semaphore new. |
423 | 1724 |
ScreenUpdaterProcess := nil. |
285 | 1725 |
|
1726 |
LoadedLibs := nil. "/ gc will reclaim them ... |
|
1727 |
LoadedNativeLibs := nil. "/ gc will reclaim them ... |
|
1728 |
||
1729 |
ImageStretchCache := nil. |
|
504 | 1730 |
LastGraphics := LastGC := nil. |
285 | 1731 |
|
1732 |
self terminateAllThreads. |
|
1733 |
||
255 | 1734 |
self releaseAllWindows. |
1735 |
self releaseAllStreams. |
|
1736 |
||
1737 |
" |
|
1738 |
JavaVM releaseAllJavaResources |
|
1739 |
" |
|
1740 |
||
1741 |
"Created: / 7.1.1998 / 22:49:42 / cg" |
|
504 | 1742 |
"Modified: / 23.12.1998 / 19:01:38 / cg" |
253 | 1743 |
! |
1744 |
||
1745 |
releaseAllMonitors |
|
1746 |
LockTable := WeakIdentityDictionary new. |
|
1747 |
LockTableAccess := Semaphore forMutualExclusion. |
|
1748 |
WaitTable := IdentityDictionary new. |
|
1749 |
WaitTableAccess := Semaphore forMutualExclusion. |
|
1750 |
||
1751 |
EnteredMonitorsPerProcess := IdentityDictionary new. |
|
1752 |
||
1753 |
" |
|
1754 |
JavaVM releaseAllMonitors |
|
1755 |
" |
|
1756 |
||
1757 |
"Created: / 2.1.1998 / 18:04:05 / cg" |
|
255 | 1758 |
"Modified: / 7.1.1998 / 22:58:10 / cg" |
1759 |
! |
|
1760 |
||
1761 |
releaseAllStreams |
|
307 | 1762 |
OpenFileTable notNil ifTrue:[ |
1763 |
OpenFileTable do:[:aStream | |
|
1764 |
aStream notNil ifTrue:[ |
|
1765 |
aStream ~~ Stdin ifTrue:[ |
|
1766 |
aStream ~~ Stdout ifTrue:[ |
|
1767 |
aStream ~~ Stderr ifTrue:[ |
|
1768 |
aStream ~~ JavaConsoleStream ifTrue:[ |
|
1769 |
aStream isExternalStream ifTrue:[ |
|
1770 |
aStream shutDown |
|
1771 |
] |
|
1772 |
] |
|
1773 |
] |
|
1774 |
] |
|
1775 |
] |
|
1776 |
] |
|
1777 |
] |
|
1778 |
]. |
|
255 | 1779 |
self initializeOpenFileTable. |
1780 |
||
1781 |
" |
|
261 | 1782 |
JavaVM releaseAllStreams |
255 | 1783 |
" |
1784 |
||
1785 |
"Created: / 7.1.1998 / 22:57:04 / cg" |
|
307 | 1786 |
"Modified: / 4.2.1998 / 19:53:11 / cg" |
255 | 1787 |
! |
1788 |
||
1789 |
releaseAllWindows |
|
1790 |
KnownWindows notNil ifTrue:[ |
|
261 | 1791 |
KnownWindows do:[:aView | |
1792 |
aView destroy |
|
1793 |
]. |
|
1794 |
KnownWindows := nil. |
|
255 | 1795 |
] |
1796 |
||
1797 |
" |
|
1798 |
self releaseAllWindows |
|
1799 |
" |
|
1800 |
||
1801 |
"Created: / 7.1.1998 / 22:58:32 / cg" |
|
1802 |
! |
|
1803 |
||
1804 |
releaseLeftOverMonitors |
|
1805 |
"release monitors held by dead processes" |
|
1806 |
||
1807 |
|deadProcesses| |
|
1808 |
||
1809 |
deadProcesses := IdentitySet new. |
|
1810 |
||
1811 |
EnteredMonitorsPerProcess keysAndValuesDo:[:p :monitors | |
|
261 | 1812 |
p isDead ifTrue:[ |
1813 |
monitors do:[:mon | |
|
1814 |
Transcript showCR:'release leftover monitor ...'. |
|
1815 |
mon release |
|
1816 |
]. |
|
1817 |
deadProcesses add:p. |
|
1818 |
] |
|
255 | 1819 |
]. |
1820 |
deadProcesses do:[:p | |
|
261 | 1821 |
EnteredMonitorsPerProcess removeKey:p |
255 | 1822 |
]. |
1823 |
||
1824 |
" |
|
1825 |
JavaVM releaseLeftOverMonitors |
|
1826 |
" |
|
1827 |
||
1828 |
"Created: / 8.1.1998 / 17:29:26 / cg" |
|
1829 |
"Modified: / 8.1.1998 / 17:38:33 / cg" |
|
253 | 1830 |
! |
1831 |
||
1832 |
systemProperties |
|
1833 |
|props| |
|
1834 |
||
1835 |
props := Dictionary new. |
|
1836 |
self initializeSystemPropertiesInto:props. |
|
1837 |
^ props |
|
1838 |
||
1839 |
"Created: / 3.1.1998 / 14:25:58 / cg" |
|
1840 |
"Modified: / 3.1.1998 / 14:32:38 / cg" |
|
255 | 1841 |
! |
1842 |
||
1843 |
terminateAllThreads |
|
261 | 1844 |
Java terminateAllThreads. |
1845 |
JavaEventThread := nil. |
|
255 | 1846 |
|
1847 |
"Created: / 8.1.1998 / 17:43:54 / cg" |
|
261 | 1848 |
"Modified: / 15.1.1998 / 17:29:00 / cg" |
255 | 1849 |
! |
1850 |
||
1851 |
update:something with:aParameter from:changedObject |
|
1852 |
something == #returnFromSnapshot ifTrue:[ |
|
426 | 1853 |
"/ self initializeVM |
255 | 1854 |
]. |
1855 |
||
1856 |
" |
|
1857 |
JavaVM initializeVM |
|
1858 |
" |
|
1859 |
||
1860 |
"Created: / 9.1.1998 / 10:30:13 / cg" |
|
426 | 1861 |
"Modified: / 6.11.1998 / 00:40:53 / cg" |
253 | 1862 |
! ! |
1863 |
||
1864 |
!JavaVM class methodsFor:'Signal constants'! |
|
1865 |
||
1866 |
badMessageSignal |
|
1867 |
^ BadMessageSignal |
|
1868 |
||
1869 |
"Created: / 2.1.1998 / 18:06:52 / cg" |
|
1870 |
! |
|
1871 |
||
1872 |
callHandlerSignal |
|
1873 |
^ CallHandlerSignal |
|
1874 |
||
1875 |
"Created: / 2.1.1998 / 18:07:16 / cg" |
|
1876 |
! |
|
1877 |
||
1878 |
internalErrorSignal |
|
1879 |
^ InternalErrorSignal |
|
1880 |
||
1881 |
"Created: / 2.1.1998 / 18:07:05 / cg" |
|
1882 |
! |
|
1883 |
||
1884 |
javaExceptionSignal |
|
1885 |
^ JavaExceptionSignal |
|
1886 |
||
1887 |
"Created: / 2.1.1998 / 18:05:58 / cg" |
|
1888 |
! |
|
1889 |
||
1890 |
unhandledJavaExceptionSignal |
|
1891 |
^ UnhandledJavaExceptionSignal |
|
1892 |
||
1893 |
"Created: / 2.1.1998 / 18:05:19 / cg" |
|
1894 |
! |
|
1895 |
||
1896 |
unimplementedInstructionSignal |
|
1897 |
^ UnimplementedInstructionSignal |
|
1898 |
||
1899 |
"Created: / 2.1.1998 / 18:06:15 / cg" |
|
1900 |
! |
|
1901 |
||
1902 |
unimplementedNativeMethodSignal |
|
1903 |
^ UnimplementedNativeMethodSignal |
|
1904 |
||
1905 |
"Created: / 2.1.1998 / 18:06:40 / cg" |
|
1906 |
! ! |
|
1907 |
||
1908 |
!JavaVM class methodsFor:'defaults'! |
|
1909 |
||
359 | 1910 |
audioEnabled |
1911 |
^ NoAudio not |
|
1912 |
||
1913 |
"Created: / 18.7.1998 / 22:31:36 / cg" |
|
1914 |
! |
|
1915 |
||
1916 |
audioEnabled:aBoolean |
|
1917 |
NoAudio := aBoolean not |
|
1918 |
||
1919 |
"Created: / 18.7.1998 / 22:31:20 / cg" |
|
1920 |
! |
|
1921 |
||
253 | 1922 |
defaultCLASSPATH |
1923 |
|s| |
|
1924 |
||
1925 |
s := '' writeStream. |
|
1926 |
Java classPath do:[:p | |
|
261 | 1927 |
s size == 0 ifFalse:[ |
1928 |
s nextPut:$: |
|
1929 |
]. |
|
1930 |
s nextPutAll:p. |
|
253 | 1931 |
]. |
1932 |
||
1933 |
^ s contents |
|
1934 |
||
1935 |
" |
|
1936 |
self defaultCLASSPATH |
|
1937 |
" |
|
1938 |
||
1939 |
"Modified: / 6.8.1997 / 00:51:17 / cg" |
|
1940 |
"Created: / 3.1.1998 / 14:27:21 / cg" |
|
1941 |
! |
|
1942 |
||
1943 |
defaultHotJavaHome |
|
1944 |
^ '/usr/local/java/hotjava'. |
|
1945 |
||
1946 |
"Modified: / 5.8.1997 / 04:13:36 / cg" |
|
1947 |
"Created: / 3.1.1998 / 14:27:34 / cg" |
|
1948 |
! |
|
1949 |
||
1950 |
defaultJAVAHome |
|
1951 |
^ Java javaHome |
|
1952 |
||
1953 |
"Modified: / 6.8.1997 / 00:54:44 / cg" |
|
1954 |
"Created: / 3.1.1998 / 14:27:01 / cg" |
|
1955 |
! |
|
1956 |
||
1957 |
defaultJWSHome |
|
474 | 1958 |
'/phys/idefix/home2/java/JWS2_0/Java-WorkShop2.0/JWS' asFilename exists ifTrue:[ |
479 | 1959 |
^ '/phys/idefix/home2/java/JWS2_0/Java-WorkShop2.0/JWS' |
474 | 1960 |
]. |
1961 |
||
253 | 1962 |
^ '/usr/local/java/JWS'. |
1963 |
||
1964 |
"Created: / 3.1.1998 / 14:27:42 / cg" |
|
479 | 1965 |
"Modified: / 3.12.1998 / 14:54:08 / cg" |
253 | 1966 |
! |
1967 |
||
1968 |
defaultWindowingToolKit |
|
1969 |
"/ prefer the windows toolkit ... |
|
1970 |
||
1971 |
(Java classForName:'sun.awt.windows.WToolkit') notNil ifTrue:[ |
|
277 | 1972 |
^ 'sun.awt.windows.WToolkit'. |
1973 |
]. |
|
1974 |
(Java classForName:'sun.awt.motif.MToolkit') notNil ifTrue:[ |
|
1975 |
^ 'sun.awt.motif.MToolkit'. |
|
1976 |
]. |
|
253 | 1977 |
|
1978 |
^ 'sun.awt.tiny.TinyToolkit'. |
|
1979 |
||
1980 |
||
1981 |
"/ ^ 'sun.awt.win32.MToolkit'. |
|
1982 |
"/ ^ 'sun.awt.motif.MToolkit'. |
|
1983 |
||
277 | 1984 |
" |
1985 |
self defaultWindowingToolKit |
|
1986 |
" |
|
1987 |
||
253 | 1988 |
"Created: / 3.1.1998 / 14:27:49 / cg" |
277 | 1989 |
"Modified: / 27.1.1998 / 21:52:52 / cg" |
253 | 1990 |
! |
1991 |
||
390 | 1992 |
fileOpenConfirmation |
1993 |
^ FileOpenConfirmation |
|
1994 |
||
1995 |
"Created: / 19.10.1998 / 16:01:44 / cg" |
|
1996 |
! |
|
1997 |
||
1998 |
fileOpenConfirmation:aBoolean |
|
1999 |
FileOpenConfirmation := aBoolean |
|
2000 |
||
2001 |
"Created: / 19.10.1998 / 16:01:56 / cg" |
|
2002 |
! |
|
2003 |
||
253 | 2004 |
javaConsole:aStream |
2005 |
JavaConsoleStream := aStream |
|
2006 |
||
2007 |
" |
|
261 | 2008 |
JavaVM javaConsole:Transcript |
253 | 2009 |
" |
2010 |
||
2011 |
"Modified: / 6.8.1997 / 00:34:13 / cg" |
|
2012 |
"Created: / 3.1.1998 / 14:27:58 / cg" |
|
2013 |
! |
|
2014 |
||
2015 |
javaConsoleStream |
|
2016 |
^ JavaConsoleStream |
|
2017 |
||
2018 |
"Created: / 3.1.1998 / 14:32:16 / cg" |
|
390 | 2019 |
! |
2020 |
||
2021 |
socketConnectConfirmation |
|
2022 |
^ SocketConnectConfirmation |
|
2023 |
||
2024 |
"Created: / 19.10.1998 / 16:02:15 / cg" |
|
2025 |
! |
|
2026 |
||
2027 |
socketConnectConfirmation:aBoolean |
|
2028 |
SocketConnectConfirmation := aBoolean |
|
2029 |
||
2030 |
"Created: / 19.10.1998 / 16:02:06 / cg" |
|
253 | 2031 |
! ! |
2032 |
||
2033 |
!JavaVM class methodsFor:'fileIO'! |
|
2034 |
||
2035 |
addOpenFile:aStream |
|
2036 |
OpenFileTable add:aStream. |
|
2037 |
^ OpenFileTable size - 1. |
|
2038 |
||
2039 |
"Created: / 2.1.1998 / 18:32:59 / cg" |
|
2040 |
! |
|
2041 |
||
2042 |
getOpenFileAt:idx |
|
2043 |
^ OpenFileTable at:idx+1 ifAbsent:nil. |
|
2044 |
||
2045 |
"Created: / 2.1.1998 / 18:28:01 / cg" |
|
2046 |
"Modified: / 2.1.1998 / 18:33:06 / cg" |
|
2047 |
! |
|
2048 |
||
2049 |
setOpenFile:aStream at:idx |
|
2050 |
OpenFileTable size < (idx+1) ifTrue:[ |
|
261 | 2051 |
OpenFileTable grow:idx+1. |
253 | 2052 |
]. |
2053 |
OpenFileTable at:idx+1 put:aStream. |
|
2054 |
||
2055 |
"Modified: / 2.1.1998 / 18:33:21 / cg" |
|
2056 |
! ! |
|
2057 |
||
2058 |
!JavaVM class methodsFor:'helpers'! |
|
2059 |
||
268
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2060 |
classForJavaClassObject:aJavaClassObject |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2061 |
"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
|
2062 |
|
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2063 |
^ JavaClasses at:aJavaClassObject ifAbsent:nil. |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2064 |
|
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2065 |
"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
|
2066 |
! |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2067 |
|
253 | 2068 |
enteredMonitors |
2069 |
|p monitors| |
|
2070 |
||
2071 |
p := Processor activeProcess. |
|
2072 |
monitors := EnteredMonitorsPerProcess at:p ifAbsent:nil. |
|
2073 |
monitors isNil ifTrue:[ |
|
261 | 2074 |
monitors := OrderedCollection new. |
2075 |
EnteredMonitorsPerProcess at:p put:monitors. |
|
253 | 2076 |
]. |
2077 |
^ monitors |
|
2078 |
||
2079 |
"Created: / 2.1.1998 / 21:26:19 / cg" |
|
2080 |
! |
|
2081 |
||
268
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2082 |
javaClassObjectForClass:aClass |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2083 |
"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
|
2084 |
instance 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 |
|jClass| |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2087 |
|
489 | 2088 |
aClass == SignedIntegerArray ifTrue:[self halt]. |
2089 |
||
268
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2090 |
jClass := JavaClasses at:aClass ifAbsent:nil. |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2091 |
jClass isNil ifTrue:[ |
405 | 2092 |
"/ class must be initialized (with all of its superclasses ?). |
2093 |
aClass isJavaClass ifTrue:[ |
|
2094 |
aClass classInit. |
|
2095 |
]. |
|
2096 |
JavaClasses at:aClass put:(jClass := (Java at:'java.lang.Class') new). |
|
2097 |
JavaClasses at:jClass put:aClass. |
|
268
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2098 |
]. |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2099 |
^ jClass |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2100 |
|
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2101 |
"Created: / 23.1.1998 / 17:43:38 / cg" |
489 | 2102 |
"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
|
2103 |
! |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2104 |
|
321 | 2105 |
javaMethodObjectForMethod:aMethod |
2106 |
"given a real method, return the corresponding java.lang.reflect.Method |
|
2107 |
instance for it." |
|
2108 |
||
2109 |
|jMethod| |
|
2110 |
||
2111 |
jMethod := JavaMethods at:aMethod ifAbsent:nil. |
|
2112 |
jMethod isNil ifTrue:[ |
|
2113 |
"/ class must be initialized (with all of its superclasses ?). |
|
2114 |
||
2115 |
JavaMethods at:aMethod put:(jMethod := (Java at:'java.lang.reflect.Method') new). |
|
2116 |
JavaMethods at:jMethod put:aMethod. |
|
2117 |
]. |
|
2118 |
^ jMethod |
|
2119 |
||
2120 |
"Modified: / 23.1.1998 / 17:46:51 / cg" |
|
2121 |
"Created: / 9.2.1998 / 15:59:16 / cg" |
|
2122 |
! |
|
2123 |
||
253 | 2124 |
javaThreadForSTProcess:stProcess |
2125 |
|t| |
|
2126 |
||
2127 |
t := Java threads keyAtValue:stProcess ifAbsent:nil. |
|
2128 |
t == 0 ifTrue:[ |
|
261 | 2129 |
^ nil |
253 | 2130 |
]. |
2131 |
^ t |
|
2132 |
||
2133 |
"Modified: / 26.8.1997 / 19:56:31 / cg" |
|
2134 |
"Created: / 3.1.1998 / 01:53:41 / cg" |
|
2135 |
! |
|
2136 |
||
321 | 2137 |
methodForJavaMethodObject:aJavaMethodObject |
2138 |
"given java.lang.reflect.Method instance, return the real method for it." |
|
2139 |
||
2140 |
^ JavaMethods at:aJavaMethodObject ifAbsent:nil. |
|
2141 |
||
2142 |
"Created: / 9.2.1998 / 16:01:48 / cg" |
|
2143 |
! |
|
2144 |
||
253 | 2145 |
newThread:name |
274 | 2146 |
|thread threadClass i| |
253 | 2147 |
|
2148 |
threadClass := Java at:'java.lang.Thread'. |
|
2149 |
||
2150 |
thread := (Java at:'java.lang.Thread') basicNew. |
|
2151 |
thread instVarNamed:'name' put:(Java as_String:name). |
|
2152 |
thread instVarNamed:'priority' put:(threadClass instVarNamed:'NORM_PRIORITY'). |
|
2153 |
thread instVarNamed:'single_step' put:0. |
|
2154 |
thread instVarNamed:'daemon' put:0. |
|
2155 |
thread instVarNamed:'stillborn' put:0. |
|
2156 |
thread instVarNamed:'target' put:nil. |
|
274 | 2157 |
"/ |
2158 |
"/ that on was only temporarily present in JDK1.1.3 (sigh) |
|
2159 |
"/ |
|
2160 |
(i := thread class instVarOffsetOf:'initial_stack_memory') notNil ifTrue:[ |
|
2161 |
thread instVarAt:i put:0. |
|
2162 |
]. |
|
253 | 2163 |
thread instVarNamed:'group' put:(self standardThreadGroup). |
2164 |
^ thread |
|
2165 |
||
2166 |
"Created: / 3.1.1998 / 01:47:30 / cg" |
|
274 | 2167 |
"Modified: / 27.1.1998 / 00:54:33 / cg" |
253 | 2168 |
! |
2169 |
||
2170 |
stProcessForJavaThread:jThread |
|
2171 |
|p| |
|
2172 |
||
2173 |
p := Java threads at:jThread ifAbsent:nil. |
|
2174 |
p == 0 ifTrue:[ |
|
261 | 2175 |
^ nil |
253 | 2176 |
]. |
2177 |
^ p |
|
2178 |
||
2179 |
"Created: / 2.1.1998 / 21:48:27 / cg" |
|
2180 |
"Modified: / 3.1.1998 / 01:53:55 / cg" |
|
2181 |
! |
|
2182 |
||
2183 |
standardThreadGroup |
|
2184 |
|standardGroup threadClass| |
|
2185 |
||
2186 |
StandardThreadGroup isNil ifTrue:[ |
|
457 | 2187 |
threadClass := Java at:'java.lang.Thread'. |
2188 |
||
2189 |
standardGroup := (Java at:'java.lang.ThreadGroup') new. |
|
2190 |
standardGroup instVarNamed:'parent' put:nil. |
|
2191 |
standardGroup instVarNamed:'name' put:(Java as_String:'main'). |
|
2192 |
standardGroup instVarNamed:'maxPriority' put:(threadClass instVarNamed:'MAX_PRIORITY'). |
|
2193 |
standardGroup instVarNamed:'destroyed' put:0. |
|
2194 |
standardGroup instVarNamed:'daemon' put:nil. |
|
2195 |
(standardGroup class instVarOffsetOf:'vmAllowSuspension') notNil ifTrue:[ |
|
2196 |
standardGroup instVarNamed:'vmAllowSuspension' put:0. |
|
2197 |
]. |
|
2198 |
standardGroup instVarNamed:'nthreads' put:0. |
|
2199 |
standardGroup instVarNamed:'ngroups' put:0. |
|
2200 |
standardGroup instVarNamed:'groups' put:nil. |
|
2201 |
StandardThreadGroup := standardGroup. |
|
253 | 2202 |
]. |
2203 |
^ StandardThreadGroup |
|
2204 |
||
2205 |
"Created: / 3.1.1998 / 01:41:54 / cg" |
|
457 | 2206 |
"Modified: / 17.11.1998 / 22:55:30 / cg" |
253 | 2207 |
! |
2208 |
||
2209 |
wakeup:anObject |
|
2210 |
JavaVM releaseAndSignalSemaphoreFor:anObject. |
|
2211 |
||
2212 |
"Created: / 3.1.1998 / 02:29:27 / cg" |
|
2213 |
"Modified: / 3.1.1998 / 03:08:05 / cg" |
|
2214 |
! |
|
2215 |
||
2216 |
wakeupAll:anObject |
|
2217 |
JavaVM releaseAndSignalForAllSemaphoreFor:anObject. |
|
2218 |
||
2219 |
"Created: / 3.1.1998 / 03:07:48 / cg" |
|
2220 |
"Modified: / 3.1.1998 / 03:08:15 / cg" |
|
2221 |
! ! |
|
2222 |
||
2223 |
!JavaVM class methodsFor:'helpers - awt'! |
|
2224 |
||
2225 |
commonReshapeComponent:nativeContext |
|
277 | 2226 |
|view x y width height ext menu| |
2227 |
||
2228 |
view := self viewForWPeer:nativeContext. |
|
253 | 2229 |
|
2230 |
x := nativeContext argAt:1. |
|
2231 |
y := nativeContext argAt:2. |
|
2232 |
width := nativeContext argAt:3. |
|
2233 |
height := nativeContext argAt:4. |
|
261 | 2234 |
ext := width@height. |
253 | 2235 |
|
2236 |
"/ 'pReshape ' print. view print. |
|
2237 |
"/ ' ' print. x print. '/' print. y print. |
|
261 | 2238 |
"/ ' extent: ' print. ext printNL. |
483 | 2239 |
view isPopUpView ifTrue:[ |
2240 |
view origin:x@y extent:ext. |
|
2241 |
] ifFalse:[ |
|
2242 |
(view isTopView |
|
2243 |
or:[view isMemberOf:JavaEmbeddedFrameView]) ifTrue:[ |
|
2244 |
"/ |
|
2245 |
"/ dont allow setting the origin |
|
2246 |
"/ |
|
2247 |
menu := self topViewsMenu:view. |
|
2248 |
menu notNil ifTrue:[ |
|
2249 |
"/ must add the menus height |
|
2250 |
height := height + menu height. |
|
2251 |
ext := width@height. |
|
261 | 2252 |
]. |
483 | 2253 |
|
2254 |
"/ to prevent a view from not being visible/closable |
|
2255 |
"/ in case Java goes mad .. |
|
2256 |
||
2257 |
(width < 30 |
|
2258 |
or:[height < 10]) ifTrue:[ |
|
2259 |
"/ self halt. |
|
2260 |
width := 30. |
|
2261 |
height := 20. |
|
2262 |
ext := width@height. |
|
2263 |
]. |
|
2264 |
||
2265 |
view extent:ext. |
|
2266 |
(view isKindOf:ModalBox) ifTrue:[ |
|
2267 |
view preferredExtent:ext |
|
2268 |
]. |
|
2269 |
||
2270 |
"/ adjust non-resizable views min/max |
|
2271 |
||
2272 |
view isTopView ifTrue:[ |
|
2273 |
view minExtent notNil ifTrue:[ |
|
2274 |
view minExtent:ext. |
|
2275 |
view maxExtent:ext |
|
2276 |
]. |
|
253 | 2277 |
] |
261 | 2278 |
] ifFalse:[ |
483 | 2279 |
(view superView notNil |
2280 |
and:[view superView isTopView]) ifTrue:[ |
|
2281 |
menu := self topViewsMenu:view superView. |
|
2282 |
menu notNil ifTrue:[ |
|
2283 |
"/ must add menus height to yPos |
|
2284 |
y := y + menu height. |
|
2285 |
] |
|
2286 |
] ifFalse:[ |
|
2287 |
"/ post a configuration event |
|
2288 |
EventTrace == true ifTrue:[ |
|
2289 |
'JAVA: configure: need event' printCR. |
|
2290 |
] |
|
2291 |
]. |
|
2292 |
view origin:x@y extent:ext. |
|
253 | 2293 |
]. |
2294 |
]. |
|
2295 |
||
2296 |
^ nil |
|
2297 |
||
2298 |
"Created: / 4.1.1998 / 18:00:52 / cg" |
|
484 | 2299 |
"Modified: / 5.12.1998 / 13:34:20 / cg" |
253 | 2300 |
! |
2301 |
||
2302 |
createdWindowsView:aView for:aJavaPeer |
|
2303 |
"this is only sent with the sun.awt.windows toolkit" |
|
2304 |
||
2305 |
aJavaPeer instVarNamed:'pData' put:aView. |
|
2306 |
||
2307 |
JavaWindowGroup isNil ifTrue:[ |
|
284 | 2308 |
JavaWindowGroup := WindowGroup new. |
2309 |
JavaWindowGroup isForModalSubview:true. |
|
253 | 2310 |
]. |
2311 |
aView windowGroup:JavaWindowGroup. |
|
2312 |
JavaWindowGroup addView:aView. |
|
2313 |
||
2314 |
KnownWindows isNil ifTrue:[ |
|
284 | 2315 |
KnownWindows := IdentityDictionary new. |
253 | 2316 |
]. |
2317 |
KnownWindows at:aJavaPeer put:aView. |
|
2318 |
||
284 | 2319 |
FirstWindowCreationSemaphore signalIf. |
2320 |
||
261 | 2321 |
"/'*** ' print. aJavaPeer print. ' -> ' print. aView printCR. |
2322 |
"/(aView isKindOf:ModalBox) ifTrue:[ |
|
2323 |
"/ self halt. |
|
2324 |
"/]. |
|
2325 |
||
253 | 2326 |
"Created: / 4.1.1998 / 17:57:16 / cg" |
284 | 2327 |
"Modified: / 28.1.1998 / 22:40:19 / cg" |
253 | 2328 |
! |
2329 |
||
255 | 2330 |
gcForWGraphics:nativeContext |
504 | 2331 |
|jGraphics gc orgX orgY trans tX tY| |
255 | 2332 |
|
2333 |
jGraphics := nativeContext receiver. |
|
459 | 2334 |
O_WGgraphics_pData isNil ifTrue:[ |
2335 |
O_WGgraphics_pData := (jGraphics class instVarOffsetOf:'pData'). |
|
2336 |
]. |
|
2337 |
O_WGgraphics_originX isNil ifTrue:[ |
|
2338 |
O_WGgraphics_originX := (jGraphics class instVarOffsetOf:'originX'). |
|
2339 |
]. |
|
2340 |
O_WGgraphics_originY isNil ifTrue:[ |
|
2341 |
O_WGgraphics_originY := (jGraphics class instVarOffsetOf:'originY'). |
|
2342 |
]. |
|
2343 |
gc := jGraphics instVarAt:O_WGgraphics_pData. |
|
270 | 2344 |
|
505 | 2345 |
trans := gc translation. |
2346 |
tX := trans x. |
|
2347 |
tY := trans y. |
|
2348 |
"/ tX := gc translationX. |
|
2349 |
"/ tY := gc translationY. |
|
504 | 2350 |
|
459 | 2351 |
orgX := jGraphics instVarAt:O_WGgraphics_originX. |
2352 |
orgY := jGraphics instVarAt:O_WGgraphics_originY. |
|
504 | 2353 |
((orgX ~~ tX) or:[orgY ~~ tY]) ifTrue:[ |
270 | 2354 |
gc translation:orgX@orgY |
2355 |
]. |
|
255 | 2356 |
^ gc |
2357 |
||
2358 |
"Created: / 8.1.1998 / 00:16:38 / cg" |
|
505 | 2359 |
"Modified: / 23.12.1998 / 20:27:35 / cg" |
255 | 2360 |
! |
2361 |
||
261 | 2362 |
jPeerForView:aView |
2363 |
^ KnownWindows keyAtValue:aView ifAbsent:nil |
|
2364 |
||
2365 |
"Created: / 15.1.1998 / 13:48:01 / cg" |
|
2366 |
"Modified: / 15.1.1998 / 13:48:43 / cg" |
|
2367 |
! |
|
2368 |
||
255 | 2369 |
pReshape:nativeContext |
2370 |
|jFramePeer view x y width height menu| |
|
2371 |
||
2372 |
jFramePeer := nativeContext receiver. |
|
2373 |
view := jFramePeer instVarNamed:'pData'. |
|
2374 |
||
2375 |
x := nativeContext argAt:1. |
|
2376 |
y := nativeContext argAt:2. |
|
2377 |
width := nativeContext argAt:3. |
|
2378 |
height := nativeContext argAt:4. |
|
2379 |
||
2380 |
"/ 'pReshape ' print. view print. |
|
2381 |
"/ ' ' print. x print. '/' print. y print. |
|
2382 |
"/ ' extent: ' print. width print. '/' print. height printNL. |
|
2383 |
||
484 | 2384 |
view isPopUpView ifTrue:[ |
2385 |
self halt. |
|
2386 |
]. |
|
2387 |
||
255 | 2388 |
(view isTopView |
2389 |
or:[view isMemberOf:JavaEmbeddedFrameView]) ifTrue:[ |
|
484 | 2390 |
"/ |
2391 |
"/ dont allow setting the origin |
|
2392 |
"/ |
|
2393 |
menu := self topViewsMenu:view. |
|
2394 |
menu notNil ifTrue:[ |
|
2395 |
"/ must add the menus height |
|
2396 |
height := height + menu height |
|
2397 |
]. |
|
2398 |
view extent:width@height. |
|
255 | 2399 |
] ifFalse:[ |
484 | 2400 |
(view superView notNil |
2401 |
and:[view superView isTopView]) ifTrue:[ |
|
2402 |
menu := self topViewsMenu:view superView. |
|
2403 |
menu notNil ifTrue:[ |
|
2404 |
"/ must add menus height to yPos |
|
2405 |
y := y + menu height. |
|
2406 |
] |
|
2407 |
]. |
|
2408 |
view origin:x@y extent:width@height. |
|
255 | 2409 |
]. |
2410 |
||
2411 |
^ nil |
|
2412 |
||
2413 |
"Created: / 7.1.1998 / 21:47:11 / cg" |
|
484 | 2414 |
"Modified: / 5.12.1998 / 13:47:52 / cg" |
255 | 2415 |
! |
2416 |
||
253 | 2417 |
topViewsMenu:view |
2418 |
|idx| |
|
2419 |
||
2420 |
view isTopView ifTrue:[ |
|
261 | 2421 |
view subViews size > 0 ifTrue:[ |
2422 |
(idx := view subViews findFirst:[:v | v isMemberOf:MenuPanel]) ~~ 0 ifTrue:[ |
|
2423 |
"/ must add the menus height |
|
2424 |
^ view subViews at:idx |
|
2425 |
] |
|
2426 |
]. |
|
253 | 2427 |
]. |
2428 |
^ nil |
|
2429 |
||
2430 |
"Modified: / 4.8.1997 / 01:23:06 / cg" |
|
2431 |
"Created: / 4.1.1998 / 18:01:42 / cg" |
|
255 | 2432 |
! |
2433 |
||
2434 |
viewForWPeer:nativeContext |
|
459 | 2435 |
|jPeer| |
255 | 2436 |
|
2437 |
jPeer := nativeContext receiver. |
|
277 | 2438 |
|
2439 |
"/ sigh; pData was renamed to pNativeWidget in jdk1.2 ... |
|
459 | 2440 |
O_FramePeer_pNativeWidget isNil ifTrue:[ |
2441 |
O_FramePeer_pNativeWidget := (jPeer class instVarOffsetOf:'pNativeWidget'). |
|
2442 |
O_FramePeer_pNativeWidget isNil ifTrue:[ |
|
2443 |
O_FramePeer_pNativeWidget := 0. |
|
2444 |
O_FramePeer_pData isNil ifTrue:[ |
|
2445 |
O_FramePeer_pData := (jPeer class instVarOffsetOf:'pData'). |
|
2446 |
]. |
|
2447 |
] |
|
2448 |
]. |
|
2449 |
O_FramePeer_pNativeWidget > 0 ifTrue:[ |
|
277 | 2450 |
"/ ok, we are < 1.2 |
459 | 2451 |
^ jPeer instVarAt:O_FramePeer_pNativeWidget. |
2452 |
]. |
|
2453 |
^ jPeer instVarAt:O_FramePeer_pData. |
|
2454 |
||
2455 |
"Modified: / 19.11.1998 / 01:43:20 / cg" |
|
253 | 2456 |
! ! |
2457 |
||
2458 |
!JavaVM class methodsFor:'helpers - exceptions'! |
|
2459 |
||
261 | 2460 |
throwArrayIndexOutOfBoundsException:badIndex |
2461 |
|exClass ex| |
|
2462 |
||
2463 |
"/ self |
|
2464 |
"/ throwExceptionClassName:'java.lang.ArrayIndexOutOfBoundsException' |
|
2465 |
"/ withMessage:'bad array index: ' , badIndex printString |
|
2466 |
||
2467 |
exClass := Java classForName:'java.lang.ArrayIndexOutOfBoundsException'. |
|
459 | 2468 |
ex := exClass newWith_int:badIndex. |
261 | 2469 |
|
2470 |
self throwException:ex |
|
2471 |
||
2472 |
"Created: / 14.1.1998 / 21:36:05 / cg" |
|
459 | 2473 |
"Modified: / 20.11.1998 / 13:27:14 / cg" |
261 | 2474 |
! |
2475 |
||
253 | 2476 |
throwClassNotFoundException |
255 | 2477 |
self |
261 | 2478 |
throwExceptionClassName:'java.lang.ClassNotFoundException' |
2479 |
withMessage:'no such class' |
|
255 | 2480 |
|
253 | 2481 |
"Created: / 4.1.1998 / 22:25:26 / cg" |
255 | 2482 |
"Modified: / 7.1.1998 / 15:25:35 / cg" |
253 | 2483 |
! |
2484 |
||
2485 |
throwClassNotFoundException:className |
|
255 | 2486 |
self |
429 | 2487 |
throwExceptionClassName:'java.lang.ClassNotFoundException' |
2488 |
withMessage:'no such class: ' , className |
|
255 | 2489 |
|
253 | 2490 |
"Created: / 4.1.1998 / 22:26:09 / cg" |
429 | 2491 |
"Modified: / 10.11.1998 / 13:20:31 / cg" |
255 | 2492 |
! |
2493 |
||
2494 |
throwException:aJavaException |
|
459 | 2495 |
|con jMsg msg exClass srchCon handlerContext handlerPC method pc hPC| |
255 | 2496 |
|
2497 |
ExceptionTrace ifTrue:[ |
|
508 | 2498 |
'JAVA: exception: ' print. aJavaException class fullName print. |
2499 |
msg := aJavaException instVarNamed:'detailMessage'. |
|
2500 |
msg notNil ifTrue:[ |
|
2501 |
' (' print. |
|
2502 |
(Java as_ST_String:msg) print. |
|
2503 |
')' print. |
|
2504 |
]. |
|
2505 |
'' printCR. |
|
255 | 2506 |
]. |
2507 |
ExceptionDebug ifTrue:[ |
|
347 | 2508 |
self halt:('JAVA: exception: ' , aJavaException class fullName). |
448 | 2509 |
"/ self internalError:('JAVA: exception: ' , aJavaException class fullName). |
255 | 2510 |
]. |
2511 |
||
459 | 2512 |
"/ |
2513 |
"/ search stack for a javaContext which handles that exception |
|
2514 |
"/ |
|
2515 |
srchCon := thisContext sender. |
|
2516 |
[handlerContext isNil and:[srchCon notNil]] whileTrue:[ |
|
2517 |
(srchCon isJavaContext) ifTrue:[ |
|
2518 |
method := srchCon method. |
|
2519 |
pc := srchCon pc. |
|
2520 |
(hPC := method handlerFor:aJavaException at:pc) notNil ifTrue:[ |
|
2521 |
handlerPC := hPC. |
|
2522 |
handlerContext := srchCon |
|
508 | 2523 |
] ifFalse:[ |
2524 |
"/ on the fly, release any monitor |
|
2525 |
method isSynchronized ifTrue:[ |
|
512 | 2526 |
method isStatic ifTrue:[ |
2527 |
self monitorExit:(method javaClass) |
|
2528 |
] ifFalse:[ |
|
2529 |
self monitorExit:(srchCon receiver) |
|
2530 |
] |
|
508 | 2531 |
] |
2532 |
] |
|
459 | 2533 |
]. |
2534 |
srchCon := srchCon sender. |
|
2535 |
]. |
|
2536 |
||
2537 |
handlerContext isNil ifTrue:[ |
|
2538 |
"/ |
|
2539 |
"/ no JavaHandler ... let smalltalk handle it |
|
2540 |
"/ |
|
347 | 2541 |
exClass := aJavaException class. |
459 | 2542 |
msg := 'Java ' , exClass name. |
347 | 2543 |
jMsg := aJavaException instVarNamed:'detailMessage'. |
2544 |
jMsg notNil ifTrue:[ |
|
459 | 2545 |
msg := msg , ': ' , (Java as_ST_String:jMsg). |
347 | 2546 |
]. |
2547 |
||
459 | 2548 |
"/ for our convenience: skip ST contexts |
2549 |
"/ (i.e. the handler or debugger will see the javaContext first ) |
|
2550 |
||
347 | 2551 |
con := thisContext sender. |
2552 |
[con isNil or:[con isJavaContext]] whileFalse:[ |
|
2553 |
con := con sender |
|
2554 |
]. |
|
2555 |
con isNil ifTrue:[con := thisContext sender]. |
|
2556 |
||
2557 |
JavaVM javaExceptionSignal |
|
2558 |
raiseWith:aJavaException |
|
2559 |
errorString:msg |
|
2560 |
in:con. |
|
2561 |
Processor activeProcess terminate. |
|
459 | 2562 |
] ifFalse:[ |
2563 |
"/ |
|
2564 |
"/ found a java exceptionHandler |
|
2565 |
"/ |
|
2566 |
handlerContext setPC:handlerPC. |
|
515 | 2567 |
handlerContext exceptionArg:aJavaException pc:handlerPC. |
459 | 2568 |
handlerContext markForException. |
2569 |
handlerContext unwindAndRestart. |
|
2570 |
self halt:'should not be reached'. |
|
2571 |
Processor activeProcess terminate. |
|
2572 |
]. |
|
255 | 2573 |
|
2574 |
"Created: / 7.1.1998 / 15:28:22 / cg" |
|
515 | 2575 |
"Modified: / 7.1.1999 / 17:18:39 / cg" |
255 | 2576 |
! |
2577 |
||
2578 |
throwExceptionClassName:aJavaExceptionClassName withMessage:someMessage |
|
261 | 2579 |
|exClass ex| |
2580 |
||
2581 |
exClass := Java classForName:aJavaExceptionClassName. |
|
2582 |
ex := exClass newCleared. |
|
2583 |
ex perform:#'<init>(Ljava/lang/String;)V' with:(Java as_String:someMessage). |
|
2584 |
||
2585 |
"/ ex := exClass new. |
|
2586 |
"/ ex instVarNamed:'detailMessage' put:(Java as_String:someMessage). |
|
255 | 2587 |
|
2588 |
self throwException:ex |
|
2589 |
||
2590 |
"Created: / 7.1.1998 / 15:25:09 / cg" |
|
261 | 2591 |
"Modified: / 14.1.1998 / 23:38:30 / cg" |
255 | 2592 |
! |
2593 |
||
2594 |
throwIOExceptionWithMessage:message |
|
2595 |
self |
|
261 | 2596 |
throwExceptionClassName:'java.io.IOException' |
2597 |
withMessage:message |
|
255 | 2598 |
|
2599 |
"Created: / 7.1.1998 / 10:34:24 / cg" |
|
2600 |
"Modified: / 7.1.1998 / 15:26:25 / cg" |
|
2601 |
! |
|
2602 |
||
261 | 2603 |
throwIllegalAccessException |
2604 |
self |
|
270 | 2605 |
throwExceptionClassName:'java.lang.IllegalAccessException' |
2606 |
withMessage:'illegal access' |
|
261 | 2607 |
|
2608 |
"Modified: / 7.1.1998 / 15:25:35 / cg" |
|
2609 |
"Created: / 14.1.1998 / 23:13:44 / cg" |
|
2610 |
! |
|
2611 |
||
2612 |
throwInstantiationException |
|
2613 |
self |
|
270 | 2614 |
throwExceptionClassName:'java.lang.InstantiationException' |
2615 |
withMessage:'cannot instantiate' |
|
261 | 2616 |
|
2617 |
"Modified: / 7.1.1998 / 15:25:35 / cg" |
|
2618 |
"Created: / 14.1.1998 / 23:15:01 / cg" |
|
2619 |
! |
|
2620 |
||
2621 |
throwInstantiationExceptionFor:aJavaClass |
|
2622 |
self |
|
270 | 2623 |
throwExceptionClassName:'java.lang.InstantiationException' |
2624 |
withMessage:('cannot instantiate ' , aJavaClass fullName) |
|
261 | 2625 |
|
2626 |
"Modified: / 7.1.1998 / 15:25:35 / cg" |
|
2627 |
"Created: / 14.1.1998 / 23:17:02 / cg" |
|
2628 |
! |
|
2629 |
||
255 | 2630 |
throwNullPointerException |
280 | 2631 |
self halt:'null pointer exception'. |
255 | 2632 |
self |
280 | 2633 |
throwExceptionClassName:'java.lang.NullPointerException' |
2634 |
withMessage:'null pointer' |
|
2635 |
||
255 | 2636 |
"Created: / 9.1.1998 / 02:26:08 / cg" |
280 | 2637 |
"Modified: / 28.1.1998 / 02:30:09 / cg" |
255 | 2638 |
! |
2639 |
||
2640 |
throwNumberFormatException |
|
2641 |
self |
|
261 | 2642 |
throwExceptionClassName:'java.lang.NumberFormatException' |
2643 |
withMessage:'bad number format' |
|
255 | 2644 |
|
2645 |
"Modified: / 7.1.1998 / 15:25:35 / cg" |
|
2646 |
"Created: / 11.1.1998 / 16:08:22 / cg" |
|
253 | 2647 |
! ! |
2648 |
||
2649 |
!JavaVM class methodsFor:'helpers - io'! |
|
2650 |
||
307 | 2651 |
anyStream_close:nativeContext |
2652 |
|jStream fileNo file| |
|
2653 |
||
2654 |
jStream := nativeContext receiver. |
|
2655 |
||
2656 |
fileNo := self validateFileNo:jStream. |
|
261 | 2657 |
fileNo == 0 ifTrue:[ |
280 | 2658 |
'JAVA: file is already closed' errorPrintCR. |
2659 |
^ self "/ already closed |
|
261 | 2660 |
]. |
253 | 2661 |
file := self getOpenFileAt:fileNo. |
2662 |
file isNil ifTrue:[ |
|
280 | 2663 |
self halt:'invalid fileNo in close'. |
2664 |
self internalError:'invalid fileNo in close'. |
|
2665 |
^ self |
|
253 | 2666 |
]. |
2667 |
||
2668 |
"/ should always be bytes |
|
2669 |
||
2670 |
(file ~~ Stdin |
|
2671 |
and:[file ~~ Stdout |
|
280 | 2672 |
and:[file ~~ Stderr |
2673 |
and:[file ~~ Transcript]]]) ifTrue:[ |
|
2674 |
file close. |
|
253 | 2675 |
]. |
2676 |
self setOpenFile:nil at:fileNo. |
|
2677 |
||
307 | 2678 |
fileNo := jStream instVarNamed:'fd'. |
261 | 2679 |
fileNo isInteger ifFalse:[ |
280 | 2680 |
"/ JDK 1.1.3 |
2681 |
fileNo instVarNamed:'fd' put:0. |
|
261 | 2682 |
] ifTrue:[ |
280 | 2683 |
"/ JDK 1.0 |
307 | 2684 |
jStream instVarNamed:'fd' put:0 |
2685 |
]. |
|
2686 |
||
2687 |
"Created: / 4.2.1998 / 15:22:03 / cg" |
|
374 | 2688 |
"Modified: / 14.10.1998 / 15:10:07 / cg" |
307 | 2689 |
! |
2690 |
||
2691 |
anyStream_readBytes:nativeContext |
|
2692 |
|bytes offset count stream nRead| |
|
2693 |
||
2694 |
bytes := nativeContext argAt:1. |
|
2695 |
offset := nativeContext argAt:2. |
|
2696 |
count := nativeContext argAt:3. |
|
2697 |
||
2698 |
stream := self validateFile:(nativeContext receiver). |
|
2699 |
||
2700 |
"/ should always be bytes |
|
2701 |
bytes class isBytes ifFalse:[ |
|
2702 |
self halt. |
|
2703 |
]. |
|
2704 |
stream == Stdin ifTrue:[ |
|
2705 |
self halt:'reading from standardInput ...'. |
|
432 | 2706 |
^ -1 "/ 0 |
307 | 2707 |
]. |
2708 |
||
2709 |
FileIOTrace ifTrue:[ |
|
2710 |
('JAVA: read ' , count printString , ' bytes from ' , stream pathName) infoPrintCR. |
|
2711 |
]. |
|
2712 |
||
2713 |
stream isPositionable ifFalse:[ |
|
2714 |
"/ mhmh - some kind of socket or pipe |
|
2715 |
||
2716 |
stream readWait. |
|
2717 |
]. |
|
2718 |
||
2719 |
Stream readErrorSignal handle:[:ex | |
|
2720 |
nRead := -1 |
|
2721 |
] do:[ |
|
2722 |
nRead := stream nextAvailableBytes:count into:bytes startingAt:offset+1. |
|
2723 |
]. |
|
2724 |
nRead == 0 ifTrue:[ |
|
2725 |
stream atEnd ifTrue:[ |
|
2726 |
FileIOTrace ifTrue:[ |
|
2727 |
('JAVA: at EOF ' , nRead printString) infoPrintCR. |
|
2728 |
]. |
|
2729 |
^ -1 |
|
2730 |
]. |
|
2731 |
]. |
|
2732 |
count ~~ nRead ifTrue:[ |
|
2733 |
FileIOTrace ifTrue:[ |
|
2734 |
('JAVA: only got ' , nRead printString) infoPrintCR. |
|
2735 |
] |
|
2736 |
]. |
|
2737 |
^ nRead |
|
2738 |
||
2739 |
"Created: / 4.2.1998 / 15:20:00 / cg" |
|
432 | 2740 |
"Modified: / 10.11.1998 / 19:56:47 / cg" |
307 | 2741 |
! |
2742 |
||
2743 |
anyStream_writeBytes:nativeContext |
|
2744 |
|bytes offset count stream| |
|
2745 |
||
2746 |
bytes := nativeContext argAt:1. |
|
2747 |
offset := nativeContext argAt:2. |
|
2748 |
count := nativeContext argAt:3. |
|
2749 |
||
2750 |
stream := self validateFile:(nativeContext receiver). |
|
2751 |
||
2752 |
FileIOTrace ifTrue:[ |
|
2753 |
stream isFileStream ifTrue:[ |
|
2754 |
('JAVA: write ' , count printString , ' bytes to ' , stream pathName) infoPrintCR. |
|
2755 |
] ifFalse:[ |
|
2756 |
stream ~~ Stdout ifTrue:[ |
|
2757 |
stream ~~ Stderr ifTrue:[ |
|
2758 |
('JAVA: write ' , count printString , ' bytes to ' , stream displayString) infoPrintCR. |
|
2759 |
] |
|
2760 |
] |
|
2761 |
] |
|
2762 |
]. |
|
2763 |
||
2764 |
"/ should always be bytes |
|
2765 |
Stream writeErrorSignal handle:[:ex | |
|
2766 |
ex return |
|
2767 |
] do:[ |
|
2768 |
Socket brokenConnectionSignal handle:[:ex | |
|
2769 |
ex return |
|
2770 |
] do:[ |
|
2771 |
stream nextPutBytes:count from:bytes startingAt:offset+1 |
|
507 | 2772 |
]. |
2773 |
stream == Transcript ifTrue:[ |
|
2774 |
Transcript endEntry |
|
307 | 2775 |
] |
2776 |
]. |
|
2777 |
||
2778 |
"Created: / 4.2.1998 / 15:23:58 / cg" |
|
507 | 2779 |
"Modified: / 16.2.1999 / 11:32:45 / cg" |
261 | 2780 |
! |
2781 |
||
479 | 2782 |
checkWritePermissionOfDirectory:dir message:msg |
2783 |
|answer| |
|
2784 |
||
2785 |
(PermittedDirectories notNil |
|
2786 |
and:[PermittedDirectories includes:dir]) ifFalse:[ |
|
2787 |
FileOpenConfirmation ifTrue:[ |
|
2788 |
answer := Dialog |
|
2789 |
confirmWithCancel:msg withCRs |
|
2790 |
labels:#('no' 'grant') |
|
2791 |
values:#(false true) |
|
2792 |
default:2. |
|
2793 |
answer == false ifTrue:[ |
|
2794 |
^ false |
|
2795 |
]. |
|
2796 |
||
2797 |
(self confirm:('JAVA Security check\\Always permit writes in this directory (''' , dir pathName , ''') ?') withCRs) |
|
2798 |
ifTrue:[ |
|
2799 |
PermittedDirectories isNil ifTrue:[ |
|
2800 |
PermittedDirectories := Set new |
|
2801 |
]. |
|
2802 |
PermittedDirectories add:dir. |
|
2803 |
] |
|
2804 |
] |
|
2805 |
]. |
|
2806 |
^ true |
|
2807 |
||
2808 |
"Created: / 3.12.1998 / 15:07:56 / cg" |
|
2809 |
"Modified: / 3.12.1998 / 15:16:55 / cg" |
|
2810 |
! |
|
2811 |
||
331 | 2812 |
commonOpen:nativeContext forAppend:forAppend |
442 | 2813 |
|fs fd fn name dir stream fileNo answer readonly| |
331 | 2814 |
|
2815 |
fs := nativeContext receiver. |
|
2816 |
fd := fs instVarNamed:'fd'. |
|
2817 |
(fd instVarNamed:'fd') ~~ 0 ifTrue:[ |
|
2818 |
self halt:'file already open'. |
|
2819 |
self internalError:'file already open'. |
|
2820 |
^ self. |
|
2821 |
]. |
|
2822 |
||
2823 |
name := nativeContext argAt:1. |
|
2824 |
name := Java as_ST_String:name. |
|
2825 |
||
2826 |
FileOpenTrace ifTrue:[ |
|
2827 |
('JAVA: opening ' , name) infoPrintCR. |
|
2828 |
]. |
|
2829 |
||
2830 |
fn := name asFilename. |
|
2831 |
dir := fn directory pathName. |
|
442 | 2832 |
|
508 | 2833 |
readonly := false. |
331 | 2834 |
(PermittedDirectories notNil |
2835 |
and:[PermittedDirectories includes:dir]) ifFalse:[ |
|
2836 |
FileOpenConfirmation ifTrue:[ |
|
442 | 2837 |
answer := Dialog |
2838 |
confirmWithCancel:('JAVA Security check\\Opening ''' , name , ''' for read/write.\Grant permission ?') withCRs |
|
2839 |
labels:#('no' 'grant' 'readonly') |
|
2840 |
values:#(false true #readonly) |
|
2841 |
default:3. |
|
2842 |
answer == false ifTrue:[ |
|
331 | 2843 |
self throwIOExceptionWithMessage:('no permission to open ' , name , ' for writing'). |
2844 |
^ self |
|
2845 |
]. |
|
442 | 2846 |
readonly := (answer == #readonly). |
2847 |
||
2848 |
readonly ifFalse:[ |
|
2849 |
(self confirm:('JAVA Security check\\Always permit writes in this directory (''' , dir , ''') ?') withCRs) |
|
2850 |
ifTrue:[ |
|
2851 |
PermittedDirectories isNil ifTrue:[ |
|
2852 |
PermittedDirectories := Set new |
|
2853 |
]. |
|
2854 |
PermittedDirectories add:dir. |
|
2855 |
] |
|
331 | 2856 |
] |
2857 |
] |
|
2858 |
]. |
|
2859 |
||
442 | 2860 |
readonly ifTrue:[ |
2861 |
stream := fn readStream. |
|
331 | 2862 |
] ifFalse:[ |
442 | 2863 |
forAppend ifTrue:[ |
2864 |
stream := fn appendingWriteStream. |
|
2865 |
] ifFalse:[ |
|
2866 |
stream := fn writeStream. |
|
2867 |
] |
|
331 | 2868 |
]. |
2869 |
stream isNil ifTrue:[ |
|
2870 |
self throwIOExceptionWithMessage:('cannot open ' , name , ' for writing'). |
|
2871 |
]. |
|
2872 |
||
2873 |
fileNo := self addOpenFile:stream. |
|
2874 |
||
2875 |
FileOpenTrace ifTrue:[ |
|
2876 |
('JAVA: opened ' , name , ' as FD ' , fileNo printString , ' for writing') infoPrintCR. |
|
2877 |
]. |
|
2878 |
||
2879 |
fd instVarNamed:'fd' put:fileNo. |
|
2880 |
||
2881 |
"Created: / 7.4.1998 / 19:14:09 / cg" |
|
508 | 2882 |
"Modified: / 4.1.1999 / 14:34:42 / cg" |
331 | 2883 |
! |
2884 |
||
261 | 2885 |
fileStreamForReading:name |
2886 |
|fn stream tryAlongClassPath| |
|
2887 |
||
2888 |
fn := name asFilename. |
|
2889 |
stream := fn readStream. |
|
2890 |
stream notNil ifTrue:[^ stream]. |
|
2891 |
||
2892 |
fn isAbsolute ifFalse:[ |
|
405 | 2893 |
"/ if not absolute, try along classPath |
2894 |
"/ This allows classes to open local files (JEdit) |
|
2895 |
"/ even if they have NOT been loaded by a Java classLoader. |
|
2896 |
"/ Only do this for image files |
|
2897 |
"/ (and maybe some other config files in the future), |
|
2898 |
"/ to avoid security holes. |
|
2899 |
tryAlongClassPath := true. |
|
2900 |
"/ tryAlongClassPath := false. |
|
2901 |
"/ (fn hasSuffix:'gif') ifTrue:[ |
|
2902 |
"/ tryAlongClassPath := true. |
|
2903 |
"/ ]. |
|
2904 |
"/ (fn hasSuffix:'jpg') ifTrue:[ |
|
2905 |
"/ tryAlongClassPath := true. |
|
2906 |
"/ ]. |
|
2907 |
||
2908 |
tryAlongClassPath ifTrue:[ |
|
2909 |
Java classPath do:[:dirName | |
|
2910 |
|fn| |
|
2911 |
||
2912 |
(fn := dirName asFilename construct:name) exists ifTrue:[ |
|
2913 |
stream := fn readStream. |
|
2914 |
stream notNil ifTrue:[^ stream]. |
|
2915 |
] |
|
2916 |
] |
|
2917 |
] |
|
261 | 2918 |
]. |
2919 |
^ nil. |
|
2920 |
||
405 | 2921 |
"Modified: / 21.10.1998 / 01:38:50 / cg" |
2922 |
! |
|
2923 |
||
2924 |
fixFilename:path |
|
2925 |
OperatingSystem isMSDOSlike ifTrue:[ |
|
2926 |
(#($/ $\) includes:(path at:1)) ifTrue:[ |
|
2927 |
(path at:3) == $: ifTrue:[ |
|
2928 |
^ path copyFrom:2 |
|
2929 |
] |
|
2930 |
] |
|
2931 |
]. |
|
2932 |
^ path |
|
2933 |
||
2934 |
"Created: / 20.10.1998 / 20:58:45 / cg" |
|
2935 |
"Modified: / 20.10.1998 / 21:06:49 / cg" |
|
253 | 2936 |
! |
2937 |
||
2938 |
validateFile:javaStream |
|
2939 |
|fileNo file descriptor| |
|
2940 |
||
2941 |
fileNo := self validateFileNo:javaStream. |
|
2942 |
fileNo isNil ifTrue:[ |
|
2943 |
"/ self halt:'invalid fileNo in read'. |
|
2944 |
"/ self internalError:'invalid fileNo in read'. |
|
261 | 2945 |
self throwIOExceptionWithMessage:'invalid fileNo in read'. |
2946 |
^ nil |
|
253 | 2947 |
]. |
2948 |
||
2949 |
file := self getOpenFileAt:fileNo. |
|
2950 |
||
2951 |
file isNil ifTrue:[ |
|
2952 |
"/ self halt:'invalid fileNo in read'. |
|
2953 |
"/ self internalError:'invalid fileNo in read'. |
|
261 | 2954 |
self throwIOExceptionWithMessage:'invalid fileNo in read'. |
2955 |
^ nil |
|
253 | 2956 |
]. |
2957 |
||
2958 |
^ file |
|
2959 |
||
2960 |
"Created: / 4.1.1998 / 16:50:38 / cg" |
|
2961 |
"Modified: / 4.1.1998 / 17:50:00 / cg" |
|
2962 |
! |
|
2963 |
||
2964 |
validateFileNo:javaStream |
|
2965 |
|fileNo file descriptor| |
|
2966 |
||
261 | 2967 |
"/ JDK 1.1.3 has fileDescriptor wrapped |
2968 |
"/ JDK 1.0 has it directly as integer |
|
2969 |
||
253 | 2970 |
fileNo := javaStream instVarNamed:'fd'. |
2971 |
fileNo isInteger ifFalse:[ |
|
261 | 2972 |
descriptor := fileNo. |
2973 |
fileNo := descriptor instVarNamed:'fd'. |
|
253 | 2974 |
]. |
2975 |
||
2976 |
fileNo isInteger ifFalse:[ |
|
2977 |
"/ self halt:'invalid fileNo in read'. |
|
2978 |
"/ self internalError:'invalid fileNo in read'. |
|
261 | 2979 |
self throwIOExceptionWithMessage:'invalid fileNo in read'. |
2980 |
^ nil |
|
253 | 2981 |
]. |
2982 |
||
2983 |
^ fileNo. |
|
2984 |
||
2985 |
"Created: / 4.1.1998 / 17:49:08 / cg" |
|
261 | 2986 |
"Modified: / 13.1.1998 / 14:07:47 / cg" |
253 | 2987 |
! ! |
2988 |
||
440 | 2989 |
!JavaVM class methodsFor:'native - java.awt.image'! |
2990 |
||
2991 |
_ColorModel_deletepData:nativeContext |
|
2992 |
"/ void deletepData () |
|
2993 |
UnimplementedNativeMethodSignal raise |
|
2994 |
||
2995 |
"Created: / 12.11.1998 / 19:22:05 / cg" |
|
2996 |
! ! |
|
2997 |
||
253 | 2998 |
!JavaVM class methodsFor:'native - java.io'! |
2999 |
||
3000 |
_FileDescriptor_initSystemFD:nativeContext |
|
3001 |
|descriptor fileNo idx myStream| |
|
3002 |
||
3003 |
descriptor := nativeContext argAt:1. |
|
3004 |
fileNo := nativeContext argAt:2. |
|
3005 |
||
3006 |
fileNo == 0 ifTrue:[ |
|
277 | 3007 |
myStream := Stdin |
253 | 3008 |
] ifFalse:[ |
277 | 3009 |
fileNo == 1 ifTrue:[ |
3010 |
myStream := JavaConsoleStream ? Stdout |
|
3011 |
] ifFalse:[ |
|
3012 |
fileNo == 2 ifTrue:[ |
|
3013 |
myStream := JavaConsoleStream ? Stderr |
|
3014 |
] ifFalse:[ |
|
3015 |
self halt:'invalid fileNo given'. |
|
3016 |
self internalError:'invalid fileNo given'. |
|
3017 |
] |
|
3018 |
] |
|
253 | 3019 |
]. |
3020 |
||
3021 |
self setOpenFile:myStream at:fileNo. |
|
3022 |
||
3023 |
descriptor instVarNamed:'fd' put:fileNo. |
|
3024 |
^ descriptor |
|
3025 |
||
277 | 3026 |
"Modified: / 27.1.1998 / 18:15:28 / cg" |
253 | 3027 |
! |
3028 |
||
440 | 3029 |
_FileDescriptor_sync:nativeContext |
3030 |
"/ void sync () |
|
3031 |
UnimplementedNativeMethodSignal raise |
|
3032 |
||
3033 |
"Modified: / 12.11.1998 / 18:57:39 / cg" |
|
3034 |
"Created: / 12.11.1998 / 19:26:25 / cg" |
|
3035 |
! |
|
3036 |
||
3037 |
_FileDescriptor_valid:nativeContext |
|
3038 |
"/ boolean valid () |
|
495 | 3039 |
|descriptor fileNo stream| |
3040 |
||
3041 |
descriptor := nativeContext receiver. |
|
3042 |
fileNo := descriptor instVarNamed:'fd'. |
|
3043 |
stream := self getOpenFileAt:fileNo. |
|
3044 |
stream isNil ifTrue:[^ 0]. "/ FALSE |
|
3045 |
stream isOpen ifFalse:[^ 0]. "/ FALSE |
|
3046 |
||
3047 |
^ 1 "/ TRUE |
|
3048 |
||
3049 |
"Modified: / 11.12.1998 / 13:02:47 / cg" |
|
440 | 3050 |
! |
3051 |
||
261 | 3052 |
_FileInputStream_available:nativeContext |
3053 |
|file| |
|
3054 |
||
3055 |
file := self validateFile:(nativeContext receiver). |
|
3056 |
file isNil ifTrue:[ |
|
3057 |
self throwIOExceptionWithMessage:'invalid fileNo in available'. |
|
3058 |
^ self |
|
3059 |
]. |
|
3060 |
file isFileStream ifTrue:[ |
|
3061 |
^ file size - file position + 1 |
|
3062 |
]. |
|
3063 |
file atEnd ifTrue:[ |
|
3064 |
^ 0. |
|
3065 |
]. |
|
3066 |
self halt. |
|
3067 |
^ 1 |
|
3068 |
||
3069 |
"Modified: / 14.1.1998 / 15:12:52 / cg" |
|
3070 |
! |
|
3071 |
||
253 | 3072 |
_FileInputStream_close:nativeContext |
307 | 3073 |
^ self anyStream_close:nativeContext |
3074 |
||
253 | 3075 |
"Created: / 4.1.1998 / 17:45:23 / cg" |
307 | 3076 |
"Modified: / 4.2.1998 / 15:20:46 / cg" |
253 | 3077 |
! |
3078 |
||
3079 |
_FileInputStream_open:nativeContext |
|
261 | 3080 |
|fs fd fn name stream fileNo| |
253 | 3081 |
|
3082 |
fs := nativeContext receiver. |
|
3083 |
fd := fs instVarNamed:'fd'. |
|
277 | 3084 |
(fileNo := fd instVarNamed:'fd') ~~ 0 ifTrue:[ |
3085 |
fileNo ~~ -1 ifTrue:[ |
|
3086 |
self halt:'file already open'. |
|
3087 |
self internalError:'file already open'. |
|
3088 |
^ self. |
|
3089 |
] |
|
253 | 3090 |
]. |
3091 |
||
3092 |
name := nativeContext argAt:1. |
|
3093 |
name := Java as_ST_String:name. |
|
3094 |
||
405 | 3095 |
name := self fixFilename:name. |
3096 |
||
253 | 3097 |
FileOpenTrace ifTrue:[ |
277 | 3098 |
('JAVA: opening ' , name) infoPrintCR. |
253 | 3099 |
]. |
3100 |
||
261 | 3101 |
stream := self fileStreamForReading:name. |
253 | 3102 |
stream isNil ifTrue:[ |
277 | 3103 |
FileOpenTrace ifTrue:[ |
479 | 3104 |
('JAVA: failed to open ''' , name , ''' for reading.') infoPrintCR. |
277 | 3105 |
]. |
3106 |
||
3107 |
self throwIOExceptionWithMessage:('cannot open ' , name , ' for reading'). |
|
3108 |
||
3109 |
^ self. |
|
253 | 3110 |
]. |
304 | 3111 |
stream buffered:false. |
253 | 3112 |
|
261 | 3113 |
"/ FileOpenConfirmation ifTrue:[ |
3114 |
"/ (self confirm:('JAVA Security check\\Opening ''' , name , ''' for reading.\Grant permission ?') withCRs) |
|
3115 |
"/ ifFalse:[ |
|
3116 |
"/ self throwIOExceptionWithMessage:('no permission to open ' , name , ' for reading'). |
|
3117 |
"/ ^ self |
|
3118 |
"/ ] |
|
3119 |
"/ ]. |
|
3120 |
||
253 | 3121 |
fileNo := self addOpenFile:stream. |
3122 |
||
3123 |
FileOpenTrace ifTrue:[ |
|
277 | 3124 |
('JAVA: opened ' , name , ' as FD ' , fileNo printString) infoPrintCR. |
253 | 3125 |
]. |
3126 |
||
3127 |
fd instVarNamed:'fd' put:fileNo. |
|
3128 |
||
3129 |
"Created: / 4.1.1998 / 16:47:12 / cg" |
|
479 | 3130 |
"Modified: / 3.12.1998 / 15:13:51 / cg" |
253 | 3131 |
! |
3132 |
||
3133 |
_FileInputStream_read:nativeContext |
|
3134 |
|file byte| |
|
3135 |
||
3136 |
file := self validateFile:(nativeContext receiver). |
|
3137 |
||
3138 |
FileIOTrace ifTrue:[ |
|
261 | 3139 |
('JAVA: read 1 byte from ' , file pathName) infoPrintCR. |
253 | 3140 |
]. |
3141 |
||
3142 |
byte := file nextByte. |
|
3143 |
byte isNil ifTrue:[ |
|
261 | 3144 |
^ -1 |
253 | 3145 |
]. |
3146 |
^ byte |
|
3147 |
||
3148 |
"Created: / 5.1.1998 / 02:17:08 / cg" |
|
3149 |
"Modified: / 5.1.1998 / 02:17:25 / cg" |
|
3150 |
! |
|
3151 |
||
3152 |
_FileInputStream_readBytes:nativeContext |
|
307 | 3153 |
^ self anyStream_readBytes:nativeContext |
3154 |
||
3155 |
"Modified: / 4.2.1998 / 15:23:08 / cg" |
|
261 | 3156 |
! |
3157 |
||
440 | 3158 |
_FileInputStream_skip:nativeContext |
3159 |
"/ long skip (long) |
|
3160 |
UnimplementedNativeMethodSignal raise |
|
3161 |
||
3162 |
"Created: / 12.11.1998 / 18:57:12 / cg" |
|
3163 |
"Modified: / 12.11.1998 / 18:57:48 / cg" |
|
3164 |
! |
|
3165 |
||
261 | 3166 |
_FileOutputStream_close:nativeContext |
307 | 3167 |
^ self anyStream_close:nativeContext |
3168 |
||
261 | 3169 |
"Created: / 13.1.1998 / 09:33:16 / cg" |
307 | 3170 |
"Modified: / 4.2.1998 / 15:20:53 / cg" |
261 | 3171 |
! |
3172 |
||
3173 |
_FileOutputStream_open:nativeContext |
|
331 | 3174 |
^ self commonOpen:nativeContext forAppend:false |
3175 |
||
3176 |
"Modified: / 7.4.1998 / 19:14:31 / cg" |
|
3177 |
! |
|
3178 |
||
3179 |
_FileOutputStream_openAppend:nativeContext |
|
3180 |
^ self commonOpen:nativeContext forAppend:true |
|
3181 |
||
3182 |
"Modified: / 7.4.1998 / 19:13:42 / cg" |
|
261 | 3183 |
! |
3184 |
||
3185 |
_FileOutputStream_write:nativeContext |
|
3186 |
|byte file| |
|
3187 |
||
3188 |
byte := nativeContext argAt:1. |
|
3189 |
||
3190 |
file := self validateFile:(nativeContext receiver). |
|
3191 |
||
3192 |
FileIOTrace ifTrue:[ |
|
3193 |
file isFileStream ifTrue:[ |
|
3194 |
('JAVA: write 1 byte to ' , file pathName) infoPrintCR. |
|
3195 |
] ifFalse:[ |
|
3196 |
file ~~ Stdout ifTrue:[ |
|
3197 |
file ~~ Stderr ifTrue:[ |
|
3198 |
('JAVA: write 1 byte to ' , file displayString) infoPrintCR. |
|
3199 |
] |
|
3200 |
] |
|
3201 |
] |
|
3202 |
]. |
|
3203 |
||
3204 |
"/ should always be bytes |
|
3205 |
||
3206 |
file nextPutByte:byte |
|
3207 |
||
3208 |
"Created: / 13.1.1998 / 09:32:13 / cg" |
|
3209 |
"Modified: / 13.1.1998 / 09:32:31 / cg" |
|
253 | 3210 |
! |
3211 |
||
255 | 3212 |
_FileOutputStream_writeBytes:nativeContext |
307 | 3213 |
^ self anyStream_writeBytes:nativeContext |
3214 |
||
3215 |
"Modified: / 4.2.1998 / 15:24:20 / cg" |
|
255 | 3216 |
! |
3217 |
||
253 | 3218 |
_File_canRead0:nativeContext |
3219 |
|file path f| |
|
3220 |
||
3221 |
file := nativeContext receiver. |
|
3222 |
path := file instVarNamed:'path'. |
|
3223 |
path notNil ifTrue:[ |
|
405 | 3224 |
path := Java as_ST_String:path. |
3225 |
path := self fixFilename:path. |
|
3226 |
(f := path asFilename) isReadable ifTrue:[ |
|
3227 |
^ 1 "/ TRUE |
|
3228 |
] |
|
253 | 3229 |
]. |
255 | 3230 |
^ 0 "/ FALSE |
3231 |
||
253 | 3232 |
"Created: / 4.1.1998 / 18:09:55 / cg" |
405 | 3233 |
"Modified: / 20.10.1998 / 20:59:39 / cg" |
253 | 3234 |
! |
3235 |
||
307 | 3236 |
_File_canWrite0:nativeContext |
3237 |
|file path f| |
|
3238 |
||
3239 |
file := nativeContext receiver. |
|
3240 |
path := file instVarNamed:'path'. |
|
3241 |
path notNil ifTrue:[ |
|
3242 |
path := Java as_ST_String:path. |
|
405 | 3243 |
path := self fixFilename:path. |
307 | 3244 |
(f := path asFilename) isWritable ifTrue:[ |
3245 |
^ 1 "/ TRUE |
|
3246 |
] |
|
3247 |
]. |
|
3248 |
^ 0 "/ FALSE |
|
3249 |
||
3250 |
"Created: / 4.2.1998 / 00:19:55 / cg" |
|
405 | 3251 |
"Modified: / 20.10.1998 / 20:59:45 / cg" |
307 | 3252 |
! |
3253 |
||
440 | 3254 |
_File_delete0:nativeContext |
3255 |
"/ boolean delete0 () |
|
480 | 3256 |
|oldFile oldPath oldF| |
3257 |
||
3258 |
oldFile := nativeContext receiver. |
|
3259 |
oldPath := oldFile instVarNamed:'path'. |
|
3260 |
oldPath isNil ifTrue:[^ 0]. "/ FALSE |
|
3261 |
||
3262 |
oldPath := Java as_ST_String:oldPath. |
|
3263 |
oldF := oldPath asFilename. |
|
3264 |
||
508 | 3265 |
oldF exists ifFalse:[ |
3266 |
^ 1 "/ TRUE |
|
3267 |
]. |
|
3268 |
||
480 | 3269 |
(self checkWritePermissionOfDirectory:oldF directory message:('JAVA Security check\\Delete of ''' , oldPath , '''.\Grant permission ?')) |
3270 |
ifFalse:[ |
|
3271 |
^ 0 "/ FALSE |
|
3272 |
]. |
|
3273 |
||
3274 |
OperatingSystem accessDeniedErrorSignal handle:[:ex | |
|
3275 |
^ 0 "/ FALSE |
|
3276 |
] do:[ |
|
3277 |
oldF delete. |
|
3278 |
^ 1 "/ TRUE |
|
3279 |
]. |
|
3280 |
^ 0 "/ FALSE |
|
3281 |
||
508 | 3282 |
"Modified: / 30.12.1998 / 20:15:06 / cg" |
440 | 3283 |
! |
3284 |
||
253 | 3285 |
_File_exists0:nativeContext |
3286 |
|file path f| |
|
3287 |
||
3288 |
file := nativeContext receiver. |
|
3289 |
path := file instVarNamed:'path'. |
|
3290 |
path notNil ifTrue:[ |
|
405 | 3291 |
path := Java as_ST_String:path. |
3292 |
path := self fixFilename:path. |
|
3293 |
(f := path asFilename) exists ifTrue:[ |
|
3294 |
^ 1 "TRUE" |
|
3295 |
] |
|
255 | 3296 |
]. |
3297 |
^ 0 "FALSE" |
|
3298 |
||
3299 |
"Created: / 5.1.1998 / 02:07:48 / cg" |
|
405 | 3300 |
"Modified: / 20.10.1998 / 20:59:49 / cg" |
255 | 3301 |
! |
3302 |
||
3303 |
_File_isAbsolute:nativeContext |
|
3304 |
|file path f| |
|
3305 |
||
3306 |
file := nativeContext receiver. |
|
3307 |
path := file instVarNamed:'path'. |
|
3308 |
path notNil ifTrue:[ |
|
405 | 3309 |
path := Java as_ST_String:path. |
3310 |
path := self fixFilename:path. |
|
3311 |
(f := path asFilename) isAbsolute ifTrue:[ |
|
3312 |
^ 1 "/ TRUE |
|
3313 |
] |
|
255 | 3314 |
]. |
3315 |
^ 0 "/ FALSE |
|
3316 |
||
3317 |
"Created: / 11.1.1998 / 09:54:38 / cg" |
|
405 | 3318 |
"Modified: / 20.10.1998 / 20:59:53 / cg" |
255 | 3319 |
! |
3320 |
||
3321 |
_File_isDirectory0:nativeContext |
|
3322 |
|file path f| |
|
3323 |
||
3324 |
file := nativeContext receiver. |
|
3325 |
path := file instVarNamed:'path'. |
|
3326 |
path notNil ifTrue:[ |
|
405 | 3327 |
path := Java as_ST_String:path. |
3328 |
path := self fixFilename:path. |
|
3329 |
(f := path asFilename) exists ifTrue:[ |
|
3330 |
f isDirectory ifTrue:[^ 1 "TRUE"] |
|
3331 |
] |
|
255 | 3332 |
]. |
3333 |
^ 0 "FALSE" |
|
3334 |
||
3335 |
"Created: / 7.1.1998 / 10:31:37 / cg" |
|
405 | 3336 |
"Modified: / 20.10.1998 / 20:59:56 / cg" |
255 | 3337 |
! |
3338 |
||
3339 |
_File_isFile0:nativeContext |
|
3340 |
|file path f| |
|
3341 |
||
3342 |
file := nativeContext receiver. |
|
3343 |
path := file instVarNamed:'path'. |
|
3344 |
path notNil ifTrue:[ |
|
405 | 3345 |
path := Java as_ST_String:path. |
3346 |
path := self fixFilename:path. |
|
3347 |
(f := path asFilename) exists ifTrue:[ |
|
3348 |
f isDirectory ifFalse:[^ 1 "TRUE"] |
|
3349 |
] |
|
255 | 3350 |
]. |
3351 |
^ 0 "/ FALSE |
|
3352 |
||
3353 |
"Created: / 11.1.1998 / 11:40:22 / cg" |
|
405 | 3354 |
"Modified: / 20.10.1998 / 21:00:00 / cg" |
255 | 3355 |
! |
3356 |
||
307 | 3357 |
_File_lastModified0:nativeContext |
3358 |
|file path f| |
|
3359 |
||
3360 |
file := nativeContext receiver. |
|
3361 |
path := file instVarNamed:'path'. |
|
3362 |
path notNil ifTrue:[ |
|
3363 |
path := Java as_ST_String:path. |
|
405 | 3364 |
path := self fixFilename:path. |
307 | 3365 |
(f := path asFilename) exists ifTrue:[ |
3366 |
^ f modificationTime getMilliseconds. |
|
3367 |
] |
|
3368 |
]. |
|
3369 |
^ 0 |
|
3370 |
||
3371 |
"Created: / 4.2.1998 / 16:50:30 / cg" |
|
405 | 3372 |
"Modified: / 20.10.1998 / 21:00:05 / cg" |
307 | 3373 |
! |
3374 |
||
255 | 3375 |
_File_length0:nativeContext |
3376 |
|file path f| |
|
3377 |
||
3378 |
file := nativeContext receiver. |
|
3379 |
path := file instVarNamed:'path'. |
|
3380 |
path notNil ifTrue:[ |
|
405 | 3381 |
path := Java as_ST_String:path. |
3382 |
path := self fixFilename:path. |
|
3383 |
(f := path asFilename) exists ifTrue:[ |
|
3384 |
^ f fileSize |
|
3385 |
] |
|
253 | 3386 |
]. |
261 | 3387 |
^ -1 |
3388 |
||
255 | 3389 |
"Created: / 7.1.1998 / 12:18:57 / cg" |
405 | 3390 |
"Modified: / 20.10.1998 / 21:00:18 / cg" |
261 | 3391 |
! |
3392 |
||
3393 |
_File_list0:nativeContext |
|
3394 |
|file path f files| |
|
3395 |
||
3396 |
file := nativeContext receiver. |
|
3397 |
path := file instVarNamed:'path'. |
|
3398 |
path notNil ifTrue:[ |
|
405 | 3399 |
path := Java as_ST_String:path. |
3400 |
path := self fixFilename:path. |
|
3401 |
(f := path asFilename) exists ifTrue:[ |
|
3402 |
f isDirectory ifTrue:[ |
|
3403 |
files := f directoryContents asArray. |
|
3404 |
files := files collect:[:nm | Java as_String:nm]. |
|
3405 |
^ files |
|
3406 |
] |
|
3407 |
] |
|
261 | 3408 |
]. |
3409 |
^ nil |
|
3410 |
||
3411 |
"Created: / 14.1.1998 / 21:30:22 / cg" |
|
405 | 3412 |
"Modified: / 20.10.1998 / 21:00:21 / cg" |
307 | 3413 |
! |
3414 |
||
3415 |
_File_mkdir0:nativeContext |
|
3416 |
|file path f| |
|
3417 |
||
3418 |
file := nativeContext receiver. |
|
3419 |
path := file instVarNamed:'path'. |
|
3420 |
path notNil ifTrue:[ |
|
3421 |
path := Java as_ST_String:path. |
|
405 | 3422 |
path := self fixFilename:path. |
482 | 3423 |
f := path asFilename. |
3424 |
(f exists and:[f isDirectory]) ifTrue:[ |
|
3425 |
^ 0 "/ FALSE |
|
3426 |
]. |
|
3427 |
||
307 | 3428 |
FileOpenConfirmation ifTrue:[ |
3429 |
(self confirm:('JAVA Security check\\Create directory ''' , path , '''.\Grant permission ?') withCRs) |
|
3430 |
ifFalse:[ |
|
3431 |
^ 0 "/ FALSE |
|
3432 |
] |
|
3433 |
]. |
|
3434 |
OperatingSystem accessDeniedErrorSignal handle:[:ex | |
|
3435 |
^ 0 "/ FALSE |
|
3436 |
] do:[ |
|
3437 |
f makeDirectory. |
|
3438 |
]. |
|
3439 |
f exists ifTrue:[ |
|
3440 |
f isDirectory ifTrue:[^ 1 "TRUE"] |
|
3441 |
] |
|
3442 |
]. |
|
3443 |
^ 0 "FALSE" |
|
3444 |
||
3445 |
"Created: / 4.2.1998 / 00:19:05 / cg" |
|
482 | 3446 |
"Modified: / 4.12.1998 / 14:04:03 / cg" |
307 | 3447 |
! |
3448 |
||
440 | 3449 |
_File_renameTo0:nativeContext |
479 | 3450 |
"/ void renameTo0 (java.io.File) |
3451 |
||
3452 |
|oldFile newFile oldPath newPath oldF newF| |
|
3453 |
||
3454 |
oldFile := nativeContext receiver. |
|
3455 |
oldPath := oldFile instVarNamed:'path'. |
|
480 | 3456 |
oldPath isNil ifTrue:[^ 0]. "/ FALSE |
3457 |
||
3458 |
oldPath := Java as_ST_String:oldPath. |
|
3459 |
oldF := oldPath asFilename. |
|
3460 |
||
3461 |
newFile := nativeContext argAt:1. |
|
3462 |
newPath := newFile instVarNamed:'path'. |
|
3463 |
newPath isNil ifTrue:[^ 0]. "/ FALSE |
|
3464 |
newPath := Java as_ST_String:newPath. |
|
3465 |
||
3466 |
newF := newPath asFilename. |
|
3467 |
||
3468 |
(self checkWritePermissionOfDirectory:oldF directory message:('JAVA Security check\\Rename of ''' , oldPath , ''' to ''' , newPath , '''.\Grant permission ?')) |
|
3469 |
ifFalse:[ |
|
3470 |
^ 0 "/ FALSE |
|
3471 |
]. |
|
3472 |
oldF directory pathName ~= newF directory pathName ifTrue:[ |
|
3473 |
(self checkWritePermissionOfDirectory:newF directory message:('JAVA Security check\\Rename of ''' , oldPath , ''' to ''' , newPath , '''.\Grant permission ?')) |
|
3474 |
ifFalse:[ |
|
3475 |
^ 0 "/ FALSE |
|
3476 |
]. |
|
3477 |
]. |
|
3478 |
||
3479 |
OperatingSystem accessDeniedErrorSignal handle:[:ex | |
|
3480 |
^ 0 "/ FALSE |
|
3481 |
] do:[ |
|
3482 |
oldF renameTo:newF. |
|
3483 |
^ 1 "/ TRUE |
|
3484 |
]. |
|
3485 |
^ 0 "/ FALSE |
|
3486 |
||
3487 |
"Modified: / 3.12.1998 / 21:01:08 / cg" |
|
440 | 3488 |
! |
3489 |
||
3490 |
_File_rmdir0:nativeContext |
|
3491 |
"/ boolean rmdir0 () |
|
3492 |
UnimplementedNativeMethodSignal raise |
|
3493 |
||
3494 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3495 |
"Created: / 12.11.1998 / 19:03:52 / cg" |
|
3496 |
! |
|
3497 |
||
3498 |
_ObjectInputStream_allocateNewArray:nativeContext |
|
3499 |
"/ java.lang.Object allocateNewArray (java.lang.Class int) |
|
3500 |
UnimplementedNativeMethodSignal raise |
|
3501 |
||
3502 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3503 |
"Created: / 12.11.1998 / 19:02:52 / cg" |
|
3504 |
! |
|
3505 |
||
3506 |
_ObjectInputStream_allocateNewObject:nativeContext |
|
3507 |
"/ java.lang.Object allocateNewObject (java.lang.Class java.lang.Class) |
|
3508 |
UnimplementedNativeMethodSignal raise |
|
3509 |
||
3510 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3511 |
"Created: / 12.11.1998 / 19:02:40 / cg" |
|
3512 |
! |
|
3513 |
||
3514 |
_ObjectInputStream_inputClassFields:nativeContext |
|
3515 |
"/ void inputClassFields (java.lang.Object java.lang.Class int[]) |
|
3516 |
UnimplementedNativeMethodSignal raise |
|
3517 |
||
3518 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3519 |
"Created: / 12.11.1998 / 19:02:22 / cg" |
|
3520 |
! |
|
3521 |
||
3522 |
_ObjectInputStream_invokeObjectReader:nativeContext |
|
3523 |
"/ boolean invokeObjectReader (java.lang.Object java.lang.Class) |
|
3524 |
UnimplementedNativeMethodSignal raise |
|
3525 |
||
3526 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3527 |
"Created: / 12.11.1998 / 19:03:06 / cg" |
|
3528 |
! |
|
3529 |
||
3530 |
_ObjectInputStream_loadClass0:nativeContext |
|
3531 |
"/ java.lang.Class loadClass0 (java.lang.Class java.lang.String) |
|
3532 |
UnimplementedNativeMethodSignal raise |
|
3533 |
||
3534 |
"Created: / 12.11.1998 / 19:01:15 / cg" |
|
3535 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3536 |
! |
|
3537 |
||
3538 |
_ObjectOutputStream_invokeObjectWriter:nativeContext |
|
3539 |
"/ boolean invokeObjectWriter (java.lang.Object java.lang.Class) |
|
3540 |
UnimplementedNativeMethodSignal raise |
|
3541 |
||
3542 |
"Created: / 12.11.1998 / 19:00:36 / cg" |
|
3543 |
"Modified: / 12.11.1998 / 19:01:45 / cg" |
|
3544 |
! |
|
3545 |
||
3546 |
_ObjectOutputStream_outputClassFields:nativeContext |
|
3547 |
"/ void outputClassFields (java.lang.Object java.lang.Class int[]) |
|
3548 |
UnimplementedNativeMethodSignal raise |
|
3549 |
||
3550 |
"Created: / 12.11.1998 / 19:00:09 / cg" |
|
3551 |
"Modified: / 12.11.1998 / 19:01:42 / cg" |
|
3552 |
! |
|
3553 |
||
3554 |
_ObjectStreamClass_getClassAccess:nativeContext |
|
3555 |
"/ int getClassAccess (java.lang.Class) |
|
3556 |
UnimplementedNativeMethodSignal raise |
|
3557 |
||
3558 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3559 |
"Created: / 12.11.1998 / 19:04:19 / cg" |
|
3560 |
! |
|
3561 |
||
3562 |
_ObjectStreamClass_getFieldAccess:nativeContext |
|
3563 |
"/ int getFieldAccess (java.lang.Class java.lang.String) |
|
3564 |
UnimplementedNativeMethodSignal raise |
|
3565 |
||
3566 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3567 |
"Created: / 12.11.1998 / 19:05:19 / cg" |
|
3568 |
! |
|
3569 |
||
3570 |
_ObjectStreamClass_getFieldSignatures:nativeContext |
|
3571 |
"/ java.lang.String[] getFieldSignatures (java.lang.Class) |
|
3572 |
UnimplementedNativeMethodSignal raise |
|
3573 |
||
3574 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3575 |
"Created: / 12.11.1998 / 19:05:04 / cg" |
|
3576 |
! |
|
3577 |
||
3578 |
_ObjectStreamClass_getFields0:nativeContext |
|
3579 |
"/ java.io.ObjectStreamField[] getFields0 (java.lang.Class) |
|
3580 |
UnimplementedNativeMethodSignal raise |
|
3581 |
||
3582 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3583 |
"Created: / 12.11.1998 / 19:05:32 / cg" |
|
3584 |
! |
|
3585 |
||
3586 |
_ObjectStreamClass_getMethodAccess:nativeContext |
|
3587 |
"/ int getMethodAccess (java.lang.Class java.lang.String) |
|
3588 |
UnimplementedNativeMethodSignal raise |
|
3589 |
||
3590 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3591 |
"Created: / 12.11.1998 / 19:04:51 / cg" |
|
3592 |
! |
|
3593 |
||
3594 |
_ObjectStreamClass_getMethodSignatures:nativeContext |
|
3595 |
"/ java.lang.String[] getMethodSignatures (java.lang.Class) |
|
3596 |
UnimplementedNativeMethodSignal raise |
|
3597 |
||
3598 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3599 |
"Created: / 12.11.1998 / 19:04:34 / cg" |
|
3600 |
! |
|
3601 |
||
3602 |
_ObjectStreamClass_getSerialVersionUID:nativeContext |
|
3603 |
"/ long getSerialVersionUID (java.lang.Class) |
|
3604 |
UnimplementedNativeMethodSignal raise |
|
3605 |
||
3606 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3607 |
"Created: / 12.11.1998 / 19:05:43 / cg" |
|
3608 |
! |
|
3609 |
||
3610 |
_ObjectStreamClass_hasWriteObject:nativeContext |
|
3611 |
"/ boolean hasWriteObject (java.lang.Class) |
|
3612 |
UnimplementedNativeMethodSignal raise |
|
3613 |
||
3614 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3615 |
"Created: / 12.11.1998 / 19:05:53 / cg" |
|
3616 |
! |
|
3617 |
||
307 | 3618 |
_RandomAccessFile_close:nativeContext |
3619 |
^ self anyStream_close:nativeContext |
|
3620 |
||
3621 |
"Created: / 4.2.1998 / 13:26:53 / cg" |
|
3622 |
"Modified: / 4.2.1998 / 15:21:08 / cg" |
|
3623 |
! |
|
3624 |
||
3625 |
_RandomAccessFile_length:nativeContext |
|
3626 |
|file sz| |
|
3627 |
||
3628 |
file := self validateFile:(nativeContext receiver). |
|
3629 |
||
3630 |
FileIOTrace ifTrue:[ |
|
3631 |
('JAVA: length of ' , file pathName) infoPrintCR. |
|
3632 |
]. |
|
3633 |
||
3634 |
sz := file size. |
|
3635 |
^ sz. |
|
3636 |
||
3637 |
"Created: / 4.2.1998 / 13:27:58 / cg" |
|
3638 |
! |
|
3639 |
||
3640 |
_RandomAccessFile_open:nativeContext |
|
442 | 3641 |
|fs fd name dir stream fileNo answer readonly| |
3642 |
||
3643 |
readonly := false. |
|
307 | 3644 |
|
3645 |
fs := nativeContext receiver. |
|
3646 |
fd := fs instVarNamed:'fd'. |
|
3647 |
(fd instVarNamed:'fd') ~~ 0 ifTrue:[ |
|
3648 |
self halt:'file already open'. |
|
3649 |
self internalError:'file already open'. |
|
3650 |
^ self. |
|
3651 |
]. |
|
3652 |
||
3653 |
name := nativeContext argAt:1. |
|
3654 |
name := Java as_ST_String:name. |
|
405 | 3655 |
name := self fixFilename:name. |
307 | 3656 |
|
3657 |
FileOpenTrace ifTrue:[ |
|
3658 |
('JAVA: opening ' , name) infoPrintCR. |
|
3659 |
]. |
|
3660 |
||
3661 |
dir := name asFilename directory pathName. |
|
442 | 3662 |
|
307 | 3663 |
(PermittedDirectories notNil |
3664 |
and:[PermittedDirectories includes:dir]) ifFalse:[ |
|
3665 |
FileOpenConfirmation ifTrue:[ |
|
442 | 3666 |
answer := Dialog |
3667 |
confirmWithCancel:('JAVA Security check\\Opening ''' , name , ''' for read/write.\Grant permission ?') withCRs |
|
3668 |
labels:#('no' 'grant' 'readonly') |
|
3669 |
values:#(false true #readonly) |
|
3670 |
default:3. |
|
3671 |
answer == false ifTrue:[ |
|
307 | 3672 |
self throwIOExceptionWithMessage:('no permission to open ' , name , ' for writing'). |
3673 |
^ self |
|
3674 |
]. |
|
442 | 3675 |
readonly := (answer == #readonly). |
3676 |
||
3677 |
readonly ifFalse:[ |
|
3678 |
(self confirm:('JAVA Security check\\Always permit writes in this directory (''' , dir , ''') ?') withCRs) |
|
3679 |
ifTrue:[ |
|
3680 |
PermittedDirectories isNil ifTrue:[ |
|
3681 |
PermittedDirectories := Set new |
|
3682 |
]. |
|
3683 |
PermittedDirectories add:dir. |
|
3684 |
] |
|
307 | 3685 |
] |
3686 |
] |
|
3687 |
]. |
|
3688 |
||
442 | 3689 |
readonly ifTrue:[ |
3690 |
stream := name asFilename readStream. |
|
3691 |
] ifFalse:[ |
|
3692 |
stream := name asFilename readWriteStream. |
|
3693 |
]. |
|
307 | 3694 |
stream isNil ifTrue:[ |
3695 |
self throwIOExceptionWithMessage:('cannot open ' , name , ' for writing'). |
|
3696 |
]. |
|
3697 |
||
3698 |
fileNo := self addOpenFile:stream. |
|
3699 |
||
3700 |
FileOpenTrace ifTrue:[ |
|
3701 |
('JAVA: opened ' , name , ' as FD ' , fileNo printString , ' for writing') infoPrintCR. |
|
3702 |
]. |
|
3703 |
||
3704 |
fd instVarNamed:'fd' put:fileNo. |
|
3705 |
||
3706 |
"Created: / 4.2.1998 / 00:14:48 / cg" |
|
442 | 3707 |
"Modified: / 12.11.1998 / 21:29:46 / cg" |
307 | 3708 |
! |
3709 |
||
3710 |
_RandomAccessFile_readBytes:nativeContext |
|
3711 |
^ self anyStream_readBytes:nativeContext |
|
3712 |
||
3713 |
"Modified: / 4.2.1998 / 15:23:27 / cg" |
|
3714 |
! |
|
3715 |
||
3716 |
_RandomAccessFile_seek:nativeContext |
|
3717 |
|file pos| |
|
3718 |
||
3719 |
file := self validateFile:(nativeContext receiver). |
|
3720 |
||
3721 |
FileIOTrace ifTrue:[ |
|
3722 |
('JAVA: seek on ' , file pathName) infoPrintCR. |
|
3723 |
]. |
|
3724 |
||
3725 |
pos := nativeContext argAt:1. |
|
3726 |
file position:pos+1 "/ ST/X position starts at 1 |
|
3727 |
||
3728 |
"Created: / 4.2.1998 / 13:25:38 / cg" |
|
3729 |
"Modified: / 4.2.1998 / 13:28:12 / cg" |
|
3730 |
! |
|
3731 |
||
3732 |
_RandomAccessFile_writeBytes:nativeContext |
|
3733 |
^ self anyStream_writeBytes:nativeContext |
|
3734 |
||
3735 |
"Modified: / 4.2.1998 / 15:24:20 / cg" |
|
3736 |
"Created: / 4.2.1998 / 15:24:35 / cg" |
|
253 | 3737 |
! ! |
3738 |
||
277 | 3739 |
!JavaVM class methodsFor:'native - java.io - jdk1.2'! |
3740 |
||
3741 |
_FileDescriptor_initIDs:nativeContext |
|
3742 |
"/ introduced with jdk1.2 ... (sigh) |
|
3743 |
||
3744 |
"Created: / 27.1.1998 / 18:16:29 / cg" |
|
3745 |
! |
|
3746 |
||
3747 |
_FileInputStream_initIDs:nativeContext |
|
3748 |
"/ introduced with jdk1.2 ... (sigh) |
|
3749 |
||
3750 |
"Created: / 27.1.1998 / 18:15:51 / cg" |
|
3751 |
! |
|
3752 |
||
3753 |
_FileOutputStream_initIDs:nativeContext |
|
3754 |
"/ introduced with jdk1.2 ... (sigh) |
|
3755 |
||
3756 |
"Created: / 27.1.1998 / 18:16:40 / cg" |
|
3757 |
! |
|
3758 |
||
3759 |
_File_canonPath:nativeContext |
|
3760 |
"/ introduced with jdk1.2 ... (sigh) |
|
3761 |
||
3762 |
|jPath path realPath| |
|
3763 |
||
3764 |
jPath := nativeContext argAt:1. |
|
3765 |
jPath isNil ifTrue:[^ jPath]. |
|
3766 |
||
3767 |
path := Java as_ST_String:jPath. |
|
3768 |
realPath := path asFilename pathName. |
|
3769 |
||
3770 |
^ Java as_String:realPath |
|
3771 |
||
3772 |
"Created: / 27.1.1998 / 18:35:58 / cg" |
|
3773 |
"Modified: / 27.1.1998 / 21:36:03 / cg" |
|
3774 |
! |
|
3775 |
||
3776 |
_File_initIDs:nativeContext |
|
3777 |
"/ introduced with jdk1.2 ... (sigh) |
|
3778 |
||
3779 |
"Created: / 27.1.1998 / 18:25:19 / cg" |
|
3780 |
! ! |
|
3781 |
||
253 | 3782 |
!JavaVM class methodsFor:'native - java.lang'! |
3783 |
||
255 | 3784 |
_ClassLoader_defineClass0:nativeContext |
3785 |
"create a new class from a given byteArray. |
|
3786 |
Here, construct a stream on it and pass the work to the |
|
3787 |
JavaClassReader." |
|
3788 |
||
3789 |
|jClassLoader jName name data offset length inStream newClass |
|
3790 |
loaderStub jClass| |
|
3791 |
||
3792 |
jClassLoader := nativeContext receiver. |
|
3793 |
jName := nativeContext argAt:1. |
|
3794 |
||
3795 |
"/ className is now optional ... |
|
3796 |
"/ jName isNil ifTrue:[ |
|
3797 |
"/ self internalError:'nil name in defineClass'. |
|
3798 |
"/ ^ nil |
|
3799 |
"/ ] ifFalse:[ |
|
3800 |
"/ name := Java as_ST_String:jName. |
|
3801 |
"/ ]. |
|
3802 |
||
3803 |
data := nativeContext argAt:2. |
|
3804 |
offset := nativeContext argAt:3. |
|
3805 |
length := nativeContext argAt:4. |
|
3806 |
||
3807 |
inStream := data readStream. |
|
3808 |
inStream position:offset + 1. |
|
3809 |
inStream readLimit:(offset + length). |
|
3810 |
||
270 | 3811 |
"/ loaderStub := Plug new. |
3812 |
"/ loaderStub respondTo:#loadClass: with:[:clsName | |
|
3813 |
"/ |jName| |
|
3814 |
"/ |
|
3815 |
"/self halt. |
|
3816 |
"/ jName := Java as_String:clsName. |
|
3817 |
"/ "/ jClassLoader loadClass:jName |
|
3818 |
"/ jClassLoader |
|
3819 |
"/ perform:#'loadClass(Ljava/lang/String;)Ljava/lang/Class;' |
|
3820 |
"/ with:jName. |
|
3821 |
"/ ]. |
|
255 | 3822 |
|
3823 |
('JAVA: defining class ...') infoPrintCR. |
|
3824 |
||
3825 |
"/ self internalError:'break'. |
|
3826 |
||
3827 |
newClass := JavaClassReader |
|
270 | 3828 |
readStream:inStream |
3829 |
loader:jClassLoader "loaderStub" |
|
3830 |
loadUnresolved:false. |
|
255 | 3831 |
|
3832 |
newClass isNil ifTrue:[ |
|
3833 |
('JAVA: defineClass failed') infoPrintCR. |
|
3834 |
^ nil. |
|
3835 |
]. |
|
3836 |
Transcript showCR:('defined class ' , newClass fullName , '.'). |
|
3837 |
newClass classLoader:jClassLoader. |
|
3838 |
||
3839 |
('Java: defined new class: ' , newClass fullName) infoPrintCR. |
|
3840 |
||
268
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
3841 |
jClass := self javaClassObjectForClass:newClass. |
255 | 3842 |
^ jClass |
3843 |
||
3844 |
"Created: / 7.1.1998 / 12:35:10 / cg" |
|
270 | 3845 |
"Modified: / 24.1.1998 / 15:26:21 / cg" |
255 | 3846 |
! |
3847 |
||
253 | 3848 |
_ClassLoader_findSystemClass0:nativeContext |
3849 |
|loader name class jClass| |
|
3850 |
||
3851 |
loader := nativeContext receiver. |
|
3852 |
name := nativeContext argAt:1. |
|
3853 |
name := Java as_ST_String:name. |
|
3854 |
||
399 | 3855 |
class := Java at:name. |
3856 |
class isNil ifTrue:[ |
|
318 | 3857 |
"/ ('JAVA: findSystemClass0 for ' , name , ' loader is ' , loader displayString) infoPrintCR. |
399 | 3858 |
loader class == (Java classForName:'java.util.SystemClassLoader') ifTrue:[ |
3859 |
"/ Java classForName:name. |
|
3860 |
"/ class := Java at:name. |
|
3861 |
class := JavaClassReader loadSystemClass:name. |
|
3862 |
] ifFalse:[ |
|
3863 |
"/ load using default (ST/X) loader |
|
3864 |
class := JavaClassReader loadSystemClass:name. |
|
3865 |
"/ JavaClassReader classLoaderQuerySignal answer:nil do:[ |
|
3866 |
"/ Java classForName:name. |
|
3867 |
"/ ] |
|
3868 |
]. |
|
253 | 3869 |
]. |
3870 |
||
255 | 3871 |
"/ JavaClassReader classLoaderQuerySignal answer:nil "loader" |
3872 |
"/ do:[ |
|
3873 |
"/ class := Java classForName:name. |
|
3874 |
"/ JavaClassReader postLoadActions:true. |
|
3875 |
"/ ]. |
|
399 | 3876 |
|
255 | 3877 |
(class isNil |
3878 |
"or:[class classLoader notNil]") ifTrue:[ |
|
253 | 3879 |
"/ self halt:'class: ' , name , ' not found.'. |
3880 |
"/ self internalError:'class: ' , name , ' not found.'. |
|
3881 |
||
318 | 3882 |
self |
3883 |
throwExceptionClassName:'java.lang.ClassNotFoundException' |
|
399 | 3884 |
withMessage:('class: ' , name , ' not found.'). |
318 | 3885 |
^ nil |
3886 |
]. |
|
3887 |
||
3888 |
"/ '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
|
3889 |
jClass := self javaClassObjectForClass:class. |
253 | 3890 |
^ jClass |
3891 |
||
3892 |
"Created: / 5.1.1998 / 02:53:04 / cg" |
|
399 | 3893 |
"Modified: / 20.10.1998 / 17:28:34 / cg" |
255 | 3894 |
! |
3895 |
||
440 | 3896 |
_ClassLoader_getSystemResourceAsName0:nativeContext |
3897 |
"/ java.lang.String getSystemResourceAsName0 (java.lang.String) |
|
3898 |
UnimplementedNativeMethodSignal raise |
|
3899 |
||
3900 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
3901 |
"Created: / 12.11.1998 / 18:58:34 / cg" |
|
3902 |
! |
|
3903 |
||
255 | 3904 |
_ClassLoader_getSystemResourceAsStream0:nativeContext |
444 | 3905 |
|jString rString dir file text inStream| |
255 | 3906 |
|
3907 |
jString := nativeContext argAt:1. |
|
3908 |
rString := Java as_ST_String:jString. |
|
3909 |
Java classPath do:[:aPath | |
|
444 | 3910 |
|f zipFile zar data| |
3911 |
||
3912 |
f := aPath asFilename. |
|
3913 |
((zipFile := f withSuffix:'jar') exists |
|
3914 |
or:[(zipFile := f withSuffix:'zip') exists]) ifTrue:[ |
|
3915 |
zar := ZipArchive oldFileNamed:zipFile. |
|
3916 |
(Array |
|
3917 |
with:rString |
|
3918 |
with:rString asLowercase |
|
3919 |
with:rString asUppercase) |
|
3920 |
do:[:tryName | |
|
3921 |
data := zar extract:tryName. |
|
507 | 3922 |
data notNil ifTrue:[ |
3923 |
inStream := (Java classForName:'java.io.ByteArrayInputStream') newCleared. |
|
3924 |
inStream perform:#'<init>([B)V' with:data. |
|
3925 |
^ inStream. |
|
3926 |
] |
|
444 | 3927 |
] |
3928 |
] ifFalse:[ |
|
3929 |
f exists ifTrue:[ |
|
3930 |
(file := f construct:rString) exists ifTrue:[ |
|
3931 |
(Java isExcludedFromClassPath:file) ifFalse:[ |
|
3932 |
text := file contents asString. |
|
3933 |
||
3934 |
"/ Copy data from returned buffer into Java byte array. |
|
3935 |
||
3936 |
data := text asByteArray. |
|
3937 |
||
3938 |
"/ Create input stream using byte array |
|
3939 |
||
3940 |
inStream := (Java classForName:'java.io.ByteArrayInputStream') newCleared. |
|
3941 |
inStream perform:#'<init>([B)V' with:data. |
|
3942 |
^ inStream. |
|
3943 |
] |
|
277 | 3944 |
] |
3945 |
] |
|
3946 |
] |
|
255 | 3947 |
]. |
3948 |
^ nil |
|
3949 |
||
3950 |
"Created: / 8.1.1998 / 16:06:56 / cg" |
|
507 | 3951 |
"Modified: / 26.12.1998 / 17:14:52 / cg" |
253 | 3952 |
! |
3953 |
||
3954 |
_ClassLoader_init:nativeContext |
|
3955 |
^ nil |
|
3956 |
||
3957 |
"Created: / 5.1.1998 / 02:04:43 / cg" |
|
3958 |
! |
|
3959 |
||
255 | 3960 |
_ClassLoader_resolveClass0:nativeContext |
3961 |
"resolve a new class as previously created by defineClass0" |
|
3962 |
||
399 | 3963 |
|jClassLoader jCls cls loaderStub anyUnresolved| |
255 | 3964 |
|
3965 |
jClassLoader := nativeContext receiver. |
|
3966 |
jCls := nativeContext argAt:1. |
|
3967 |
jCls isNil ifTrue:[ |
|
361
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3968 |
self halt. |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3969 |
^ nil |
255 | 3970 |
]. |
3971 |
cls := JavaClasses at:jCls ifAbsent:nil. |
|
3972 |
cls isNil ifTrue:[ |
|
361
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3973 |
self halt. |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3974 |
^ nil |
255 | 3975 |
]. |
399 | 3976 |
('JavaVM [info]: resolving class ' , cls fullName , ' ...') infoPrintCR. |
255 | 3977 |
|
3978 |
JavaClassReader classLoaderQuerySignal answer:jClassLoader |
|
3979 |
do:[ |
|
399 | 3980 |
JavaClassReader resolveClass:cls. |
3981 |
"/ JavaClassReader postLoadActions:true. |
|
3982 |
anyUnresolved := false. |
|
361
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3983 |
cls constantPool do:[:entry | |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3984 |
(entry isMemberOf:JavaUnresolvedClassConstant) ifTrue:[ |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3985 |
self halt:'debugHalt'. |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3986 |
entry preResolve. |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3987 |
self halt:'debugHalt'. |
399 | 3988 |
anyUnresolved := true. |
361
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3989 |
] |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3990 |
] |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3991 |
]. |
399 | 3992 |
anyUnresolved ifTrue:[ |
361
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3993 |
jClassLoader notNil ifTrue:[ |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3994 |
"/ any unresolved left -> try resolving with standard loader |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3995 |
JavaClassReader classLoaderQuerySignal answer:nil |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3996 |
do:[ |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3997 |
JavaClassReader postLoadActions:true. |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3998 |
cls constantPool do:[:entry | |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3999 |
(entry isMemberOf:JavaUnresolvedClassConstant) ifTrue:[ |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
4000 |
self halt:'debugHalt'. |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
4001 |
entry preResolve. |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
4002 |
self halt:'debugHalt'. |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
4003 |
] |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
4004 |
] |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
4005 |
] |
255 | 4006 |
]. |
399 | 4007 |
]. |
255 | 4008 |
|
4009 |
"Created: / 7.1.1998 / 13:12:27 / cg" |
|
400 | 4010 |
"Modified: / 20.10.1998 / 19:01:57 / cg" |
255 | 4011 |
! |
4012 |
||
253 | 4013 |
_Class_forName:nativeContext |
4014 |
"get a java.lang.Class by name" |
|
4015 |
||
255 | 4016 |
|jClassName className cls jClass s m c loader| |
253 | 4017 |
|
4018 |
jClassName := nativeContext argAt:1. |
|
4019 |
className := Java as_ST_String:jClassName. |
|
4020 |
||
255 | 4021 |
(s := nativeContext sender) notNil ifTrue:[ |
347 | 4022 |
(s isJavaContext) ifTrue:[ |
307 | 4023 |
c := s method javaClass. |
4024 |
loader := c classLoader. |
|
4025 |
loader isNil ifTrue:[ |
|
255 | 4026 |
"/ self halt. |
307 | 4027 |
] |
4028 |
] |
|
255 | 4029 |
]. |
4030 |
||
4031 |
JavaClassReader classLoaderQuerySignal answer:loader |
|
4032 |
do:[ |
|
307 | 4033 |
cls := Java classForName:className. |
255 | 4034 |
]. |
4035 |
||
4036 |
"/(className startsWith:'sun.awt') ifTrue:[self halt]. |
|
4037 |
"/('classForName: ' , className , ' -> ') print. |
|
4038 |
"/cls notNil ifTrue:[cls fullName printCR] ifFalse:['nil' printCR]. |
|
4039 |
||
253 | 4040 |
cls isNil ifTrue:[ |
307 | 4041 |
ExceptionTrace ifTrue:[ |
508 | 4042 |
('throwing exception: no such class:' , className) infoPrintCR. |
4043 |
]. |
|
4044 |
ExceptionDebug ifTrue:[ |
|
307 | 4045 |
self halt:'no such class:' , className. |
4046 |
]. |
|
4047 |
self throwClassNotFoundException:className. |
|
4048 |
"/ not proceedable |
|
4049 |
AbortSignal raise. |
|
4050 |
"/ not reached |
|
4051 |
^ self |
|
4052 |
]. |
|
4053 |
||
4054 |
^ self javaClassObjectForClass:cls. |
|
4055 |
||
508 | 4056 |
"Modified: / 30.12.1998 / 20:12:53 / cg" |
253 | 4057 |
! |
4058 |
||
4059 |
_Class_getClassLoader:nativeContext |
|
4060 |
"get a classes loader" |
|
4061 |
||
512 | 4062 |
|jClass cls loader| |
4063 |
||
4064 |
jClass := nativeContext receiver. |
|
4065 |
cls := self classForJavaClassObject:jClass. |
|
4066 |
loader := cls classLoader. |
|
4067 |
cls isNil ifTrue:[ |
|
4068 |
loader := JavaClassReader classLoaderQuerySignal raise. |
|
4069 |
"/ ('JAVA: getClassLoader - ' , loader printString) infoPrintCR. |
|
4070 |
]. |
|
4071 |
||
253 | 4072 |
^ loader |
4073 |
||
4074 |
"Created: / 5.1.1998 / 02:51:59 / cg" |
|
512 | 4075 |
"Modified: / 4.1.1999 / 17:50:15 / cg" |
253 | 4076 |
! |
4077 |
||
440 | 4078 |
_Class_getComponentType:nativeContext |
4079 |
UnimplementedNativeMethodSignal raise |
|
4080 |
||
4081 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
4082 |
"Created: / 12.11.1998 / 18:54:46 / cg" |
|
4083 |
! |
|
4084 |
||
4085 |
_Class_getConstructor0:nativeContext |
|
4086 |
UnimplementedNativeMethodSignal raise |
|
4087 |
||
4088 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
4089 |
"Created: / 12.11.1998 / 18:55:42 / cg" |
|
4090 |
! |
|
4091 |
||
4092 |
_Class_getConstructors0:nativeContext |
|
4093 |
UnimplementedNativeMethodSignal raise |
|
4094 |
||
4095 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
4096 |
"Created: / 12.11.1998 / 18:55:26 / cg" |
|
4097 |
! |
|
4098 |
||
4099 |
_Class_getField0:nativeContext |
|
4100 |
UnimplementedNativeMethodSignal raise |
|
4101 |
||
4102 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
4103 |
"Created: / 12.11.1998 / 18:55:37 / cg" |
|
4104 |
! |
|
4105 |
||
4106 |
_Class_getFields0:nativeContext |
|
4107 |
UnimplementedNativeMethodSignal raise |
|
4108 |
||
4109 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
4110 |
"Created: / 12.11.1998 / 18:55:18 / cg" |
|
4111 |
! |
|
4112 |
||
4113 |
_Class_getInterfaces:nativeContext |
|
4114 |
UnimplementedNativeMethodSignal raise |
|
4115 |
||
4116 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
4117 |
"Created: / 12.11.1998 / 18:54:34 / cg" |
|
4118 |
! |
|
4119 |
||
321 | 4120 |
_Class_getMethod0:nativeContext |
4121 |
"get a method, given a name and type spec" |
|
4122 |
||
322 | 4123 |
|jClass cls jmName mName mTypes whichAccess argSig sel| |
321 | 4124 |
|
4125 |
jClass := nativeContext receiver. |
|
4126 |
cls := JavaClasses at:jClass. |
|
4127 |
||
322 | 4128 |
jmName := nativeContext argAt:1. |
4129 |
mName := Java as_ST_String:jmName. |
|
321 | 4130 |
mTypes := nativeContext argAt:2. |
4131 |
whichAccess := nativeContext argAt:3. |
|
405 | 4132 |
self halt. |
322 | 4133 |
argSig := JavaMethod argSignatureFromArgTypeArray:mTypes. |
4134 |
cls methodDictionary keysAndValuesDo:[:sel :mthd | |
|
405 | 4135 |
|i1 i2 jMethod retTypeClass argTypes| |
322 | 4136 |
|
4137 |
JavaMethods notNil ifTrue:[ |
|
4138 |
(jMethod := JavaMethods at:mthd ifAbsent:nil) notNil ifTrue:[ |
|
4139 |
^ jMethod |
|
4140 |
] |
|
4141 |
]. |
|
4142 |
||
4143 |
mthd name printCR. |
|
4144 |
mName printCR. |
|
4145 |
||
4146 |
mthd name = mName ifTrue:[ |
|
4147 |
i1 := mthd signature indexOf:$(. |
|
4148 |
i2 := mthd signature indexOf:$) startingAt:(i1+1). |
|
4149 |
||
4150 |
(mthd signature copyFrom:i1+1 to:i2-1) = argSig ifTrue:[ |
|
4151 |
"/ found it - create a java.lang.reflect.Method for it. |
|
4152 |
jMethod := (Java at:'java.lang.reflect.Method') new. |
|
4153 |
jMethod instVarNamed:'clazz' put:jClass. |
|
4154 |
jMethod instVarNamed:'slot' put:sel. |
|
4155 |
jMethod instVarNamed:'name' put:jmName. |
|
405 | 4156 |
retTypeClass := mthd returnTypeClass. |
4157 |
retTypeClass isNil ifTrue:[ |
|
4158 |
retTypeClass := #void |
|
4159 |
]. |
|
4160 |
argTypes := mthd argSignature. |
|
4161 |
argTypes := argTypes collect:[:s | |
|
4162 |
|c| |
|
4163 |
||
4164 |
c := Java at:s. |
|
4165 |
self javaClassObjectForClass:(c ? s asSymbol) |
|
4166 |
]. |
|
4167 |
jMethod instVarNamed:'returnType' put:(self javaClassObjectForClass:retTypeClass). |
|
4168 |
jMethod instVarNamed:'parameterTypes' put:argTypes. |
|
322 | 4169 |
|
4170 |
JavaMethods isNil ifTrue:[ |
|
4171 |
JavaMethods := IdentityDictionary new |
|
4172 |
]. |
|
4173 |
JavaMethods at:jMethod put:mthd. |
|
4174 |
JavaMethods at:mthd put:jMethod. |
|
4175 |
||
4176 |
^ jMethod. |
|
4177 |
]. |
|
4178 |
]. |
|
4179 |
]. |
|
321 | 4180 |
|
4181 |
self halt. |
|
4182 |
self |
|
4183 |
throwExceptionClassName:'java.lang.NoSuchMethodException' |
|
4184 |
withMessage:'not yet implemented'. |
|
4185 |
||
4186 |
^ nil. |
|
4187 |
||
405 | 4188 |
"Modified: / 22.10.1998 / 01:54:38 / cg" |
321 | 4189 |
! |
4190 |
||
334 | 4191 |
_Class_getMethods0:nativeContext |
4192 |
"get a method, given a name and type spec" |
|
4193 |
||
4194 |
|jClass cls jmName mName mTypes whichAccess argSig sel |
|
4195 |
methods| |
|
4196 |
||
4197 |
jClass := nativeContext receiver. |
|
4198 |
cls := JavaClasses at:jClass. |
|
4199 |
||
405 | 4200 |
"/ 0 = PUBLIC (i.e. includes inherited) / 1 = DECLARED here |
334 | 4201 |
whichAccess := nativeContext argAt:1. |
4202 |
||
4203 |
methods := OrderedCollection new. |
|
4204 |
||
405 | 4205 |
[cls isJavaClass] whileTrue:[ |
4206 |
cls methodDictionary keysAndValuesDo:[:sel :mthd | |
|
4207 |
|i1 i2 jMethod argTypes retTypeClass| |
|
4208 |
||
4209 |
mthd name printCR. |
|
4210 |
||
4211 |
i1 := mthd signature indexOf:$(. |
|
4212 |
i2 := mthd signature indexOf:$) startingAt:(i1+1). |
|
4213 |
||
4214 |
"/ create a java.lang.reflect.Method for it. |
|
4215 |
jMethod := (Java at:'java.lang.reflect.Method') new. |
|
4216 |
jMethod instVarNamed:'clazz' put:jClass. |
|
4217 |
jMethod instVarNamed:'slot' put:sel. |
|
4218 |
jMethod instVarNamed:'name' put:(Java as_String:mthd name). |
|
4219 |
retTypeClass := mthd returnTypeClass. |
|
4220 |
retTypeClass isNil ifTrue:[ |
|
4221 |
retTypeClass := #void |
|
4222 |
]. |
|
4223 |
(name endsWith:')I') ifTrue:[self halt]. |
|
4224 |
argTypes := mthd argSignature. |
|
4225 |
argTypes := argTypes collect:[:s | |
|
4226 |
|c| |
|
4227 |
||
4228 |
c := Java at:s. |
|
4229 |
self javaClassObjectForClass:(c ? s asSymbol) |
|
4230 |
]. |
|
4231 |
||
4232 |
jMethod instVarNamed:'returnType' put:(self javaClassObjectForClass:retTypeClass). |
|
4233 |
jMethod instVarNamed:'parameterTypes' put:argTypes. |
|
334 | 4234 |
|
405 | 4235 |
(mthd name includesString:'setName') ifTrue:[self halt]. |
4236 |
JavaMethods isNil ifTrue:[ |
|
4237 |
JavaMethods := IdentityDictionary new |
|
4238 |
]. |
|
4239 |
JavaMethods at:jMethod put:mthd. |
|
4240 |
JavaMethods at:mthd put:jMethod. |
|
4241 |
||
4242 |
methods add:jMethod. |
|
334 | 4243 |
]. |
405 | 4244 |
whichAccess == 1 ifTrue:[ |
4245 |
"/ local methods only |
|
4246 |
cls := nil |
|
4247 |
] ifFalse:[ |
|
4248 |
cls := cls superclass. |
|
4249 |
] |
|
334 | 4250 |
]. |
4251 |
methods := methods asArray. |
|
4252 |
^ methods. |
|
4253 |
||
405 | 4254 |
"Modified: / 22.10.1998 / 01:53:58 / cg" |
334 | 4255 |
! |
4256 |
||
440 | 4257 |
_Class_getModifiers:nativeContext |
4258 |
UnimplementedNativeMethodSignal raise |
|
4259 |
||
4260 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
4261 |
"Created: / 12.11.1998 / 18:54:53 / cg" |
|
4262 |
! |
|
4263 |
||
255 | 4264 |
_Class_getName:nativeContext |
4265 |
"get a classes name" |
|
4266 |
||
508 | 4267 |
|jClass cls nm| |
255 | 4268 |
|
4269 |
jClass := nativeContext receiver. |
|
4270 |
cls := JavaClasses at:jClass. |
|
508 | 4271 |
cls isJavaClass ifTrue:[ |
4272 |
nm := (cls fullName copyReplaceAll:$/ with:$.) |
|
4273 |
] ifFalse:[ |
|
4274 |
nm := cls name |
|
4275 |
]. |
|
4276 |
^ Java as_String:nm. |
|
4277 |
||
4278 |
"Modified: / 30.12.1998 / 21:13:50 / cg" |
|
255 | 4279 |
! |
4280 |
||
253 | 4281 |
_Class_getPrimitiveClass:nativeContext |
4282 |
"get a primitive class by name" |
|
4283 |
||
4284 |
|jClassName className cls| |
|
4285 |
||
4286 |
jClassName := nativeContext argAt:1. |
|
4287 |
className := Java as_ST_String:jClassName. |
|
4288 |
||
4289 |
JavaClasses isNil ifTrue:[ |
|
261 | 4290 |
self initializePrimitiveClasses |
253 | 4291 |
]. |
4292 |
cls := JavaClasses at:className. |
|
4293 |
||
4294 |
"/ cls := Java classForName:className. |
|
4295 |
"/ cls isNil ifTrue:[ |
|
4296 |
"/ cls := JavaClasses at:('JavaBase_' , className) asSymbol ifAbsent:nil. |
|
4297 |
"/ #( |
|
4298 |
"/ 'boolean' #Boolean |
|
4299 |
"/ 'float' #ShortFloat |
|
4300 |
"/ 'double' #Float |
|
4301 |
"/ 'int' #Integer |
|
4302 |
"/ 'long' #Integer |
|
4303 |
"/ 'char' #Character |
|
4304 |
"/ 'short' #Integer |
|
4305 |
"/ 'byte' #Integer |
|
4306 |
"/ 'void' #UndefinedObject |
|
4307 |
"/ ) pairWiseDo:[:nm :sym | |
|
4308 |
"/ className = nm ifTrue:[ |
|
4309 |
"/ cls := Smalltalk at:sym. |
|
4310 |
"/ ] |
|
4311 |
"/ ]. |
|
4312 |
"/ |
|
4313 |
"/ cls isNil ifTrue:[ |
|
4314 |
"/ self internalError:'class: ' , className , ' not found.'. |
|
4315 |
"/ ]. |
|
4316 |
"/ ]. |
|
4317 |
^ cls |
|
4318 |
||
4319 |
"Created: / 4.1.1998 / 00:46:03 / cg" |
|
4320 |
"Modified: / 4.1.1998 / 01:12:27 / cg" |
|
4321 |
! |
|
4322 |
||
440 | 4323 |
_Class_getSigners:nativeContext |
4324 |
UnimplementedNativeMethodSignal raise |
|
4325 |
||
4326 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
4327 |
"Created: / 12.11.1998 / 18:55:01 / cg" |
|
4328 |
! |
|
4329 |
||
255 | 4330 |
_Class_getSuperclass:nativeContext |
4331 |
"return a classes superclass" |
|
4332 |
||
4333 |
|jClass cls superCls| |
|
4334 |
||
4335 |
jClass := nativeContext receiver. |
|
4336 |
cls := JavaClasses at:jClass. |
|
4337 |
superCls := cls superclass. |
|
4338 |
superCls == JavaObject ifTrue:[ |
|
307 | 4339 |
^ nil. |
4340 |
]. |
|
4341 |
^ self javaClassObjectForClass:superCls |
|
255 | 4342 |
|
4343 |
"Created: / 12.1.1998 / 12:38:36 / cg" |
|
307 | 4344 |
"Modified: / 4.2.1998 / 14:51:22 / cg" |
255 | 4345 |
! |
4346 |
||
440 | 4347 |
_Class_isArray:nativeContext |
4348 |
UnimplementedNativeMethodSignal raise |
|
4349 |
||
4350 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
4351 |
"Created: / 12.11.1998 / 18:54:24 / cg" |
|
4352 |
! |
|
4353 |
||
4354 |
_Class_isAssignableFrom:nativeContext |
|
4355 |
UnimplementedNativeMethodSignal raise |
|
4356 |
||
4357 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
4358 |
"Created: / 12.11.1998 / 18:54:16 / cg" |
|
4359 |
! |
|
4360 |
||
321 | 4361 |
_Class_isInstance:nativeContext |
4362 |
"return true, if something is an instance of a class. |
|
4363 |
(i.e. same as instanceOf - builtin bytecode)" |
|
4364 |
||
4365 |
|jClass cls obj| |
|
4366 |
||
4367 |
obj := nativeContext argAt:1. |
|
4368 |
obj isNil ifTrue:[^ 0 "FALSE"]. |
|
4369 |
||
4370 |
jClass := nativeContext receiver. |
|
4371 |
cls := JavaClasses at:jClass. |
|
4372 |
||
4373 |
(obj isMemberOf:cls) ifTrue:[^ 1 "TRUE"]. |
|
4374 |
(obj isKindOf:cls) ifTrue:[^ 1 "TRUE"]. |
|
4375 |
||
4376 |
cls isBehavior ifTrue:[ |
|
4377 |
cls isInterface ifTrue:[ |
|
4378 |
(obj class hasInterface:cls) ifTrue:[ |
|
4379 |
^ 1 "TRUE" |
|
4380 |
] |
|
4381 |
]. |
|
4382 |
^ (obj isKindOf:cls) ifTrue:[1 "TRUE"] ifFalse:[0 "FALSE"] |
|
4383 |
]. |
|
4384 |
(cls isMemberOf:JavaClassPointerRef) ifTrue:[ |
|
4385 |
"/ must be a pointer to an array of that class |
|
4386 |
||
4387 |
^ (obj isArray) ifTrue:[1 "TRUE"] ifFalse:[0 "FALSE"] |
|
4388 |
]. |
|
4389 |
(cls isMemberOf:JavaBuiltInClassPointerRef) ifTrue:[ |
|
4390 |
cls arrayClass == obj class ifTrue:[ |
|
4391 |
^ 1 "TRUE" |
|
4392 |
]. |
|
4393 |
]. |
|
4394 |
||
4395 |
(obj isMemberOf:Array) ifTrue:[ |
|
4396 |
obj size == 0 ifTrue:[ |
|
4397 |
^ 1 "TRUE" |
|
4398 |
]. |
|
4399 |
^ (self _checkCast:(obj at:1) class:(cls deref)) |
|
4400 |
ifTrue:[1 "TRUE"] ifFalse:[0 "FALSE"] |
|
4401 |
]. |
|
4402 |
self halt. |
|
4403 |
^ 0 "FALSE". |
|
4404 |
||
4405 |
"Modified: / 9.2.1998 / 14:56:23 / cg" |
|
4406 |
! |
|
4407 |
||
255 | 4408 |
_Class_isInterface:nativeContext |
4409 |
"return true, if this class is an interface" |
|
4410 |
||
4411 |
|jClass cls| |
|
4412 |
||
4413 |
jClass := nativeContext receiver. |
|
4414 |
cls := JavaClasses at:jClass. |
|
4415 |
cls isInterface ifTrue:[^ 1 "TRUE"]. |
|
4416 |
^ 0 "FALSE" |
|
4417 |
||
4418 |
"Created: / 12.1.1998 / 12:37:02 / cg" |
|
4419 |
! |
|
4420 |
||
321 | 4421 |
_Class_isPrimitive:nativeContext |
4422 |
"return true, if this class is builtin primitive class |
|
4423 |
(i.e. byteArray, array, string etc." |
|
4424 |
||
4425 |
|jClass cls| |
|
4426 |
||
4427 |
jClass := nativeContext receiver. |
|
4428 |
cls := JavaClasses at:jClass. |
|
4429 |
^ 0 "FALSE" |
|
4430 |
||
4431 |
"Created: / 9.2.1998 / 14:46:07 / cg" |
|
4432 |
! |
|
4433 |
||
253 | 4434 |
_Class_newInstance:nativeContext |
4435 |
"get an instance for a java.lang.Class" |
|
4436 |
||
4437 |
|jClass cls newInst| |
|
4438 |
||
4439 |
jClass := nativeContext receiver. |
|
4440 |
cls := JavaClasses at:jClass. |
|
261 | 4441 |
cls classInit. |
253 | 4442 |
newInst := cls newCleared. |
255 | 4443 |
newInst perform:#'<init>()V'. |
253 | 4444 |
|
4445 |
^ newInst |
|
4446 |
||
4447 |
"Created: / 2.1.1998 / 22:41:38 / cg" |
|
261 | 4448 |
"Modified: / 15.1.1998 / 00:57:37 / cg" |
253 | 4449 |
! |
4450 |
||
440 | 4451 |
_Class_setSigners:nativeContext |
4452 |
UnimplementedNativeMethodSignal raise |
|
4453 |
||
4454 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
4455 |
"Created: / 12.11.1998 / 18:55:08 / cg" |
|
4456 |
! |
|
4457 |
||
253 | 4458 |
_Double_doubleToLongBits:nativeContext |
4459 |
|f i| |
|
4460 |
||
4461 |
f := nativeContext argAt:1. |
|
4462 |
||
4463 |
UninterpretedBytes isBigEndian ifTrue:[ |
|
261 | 4464 |
i := f basicAt:8. |
4465 |
i := i bitOr:((f basicAt:7) bitShift:8). |
|
4466 |
i := i bitOr:((f basicAt:6) bitShift:16). |
|
4467 |
i := i bitOr:((f basicAt:5) bitShift:24). |
|
4468 |
i := i bitOr:((f basicAt:4) bitShift:32). |
|
4469 |
i := i bitOr:((f basicAt:3) bitShift:40). |
|
4470 |
i := i bitOr:((f basicAt:2) bitShift:48). |
|
4471 |
i := i bitOr:((f basicAt:1) bitShift:56). |
|
253 | 4472 |
] ifFalse:[ |
261 | 4473 |
i := f basicAt:1. |
4474 |
i := i bitOr:((f basicAt:2) bitShift:8). |
|
4475 |
i := i bitOr:((f basicAt:3) bitShift:16). |
|
4476 |
i := i bitOr:((f basicAt:4) bitShift:24). |
|
4477 |
i := i bitOr:((f basicAt:5) bitShift:32). |
|
4478 |
i := i bitOr:((f basicAt:6) bitShift:40). |
|
4479 |
i := i bitOr:((f basicAt:7) bitShift:48). |
|
4480 |
i := i bitOr:((f basicAt:8) bitShift:56). |
|
253 | 4481 |
]. |
4482 |
||
4483 |
^ i. |
|
4484 |
||
4485 |
"Created: / 4.1.1998 / 01:39:12 / cg" |
|
4486 |
! |
|
4487 |
||
4488 |
_Double_longBitsToDouble:nativeContext |
|
4489 |
|i aFloat| |
|
4490 |
||
4491 |
i := nativeContext argAt:1. |
|
4492 |
||
4493 |
aFloat := Float new. |
|
4494 |
UninterpretedBytes isBigEndian ifTrue:[ |
|
261 | 4495 |
aFloat basicAt:1 put:((i bitShift:-56) bitAnd:16rFF). |
4496 |
aFloat basicAt:2 put:((i bitShift:-48) bitAnd:16rFF). |
|
4497 |
aFloat basicAt:3 put:((i bitShift:-40) bitAnd:16rFF). |
|
4498 |
aFloat basicAt:4 put:((i bitShift:-32) bitAnd:16rFF). |
|
4499 |
aFloat basicAt:5 put:((i bitShift:-24) bitAnd:16rFF). |
|
4500 |
aFloat basicAt:6 put:((i bitShift:-16) bitAnd:16rFF). |
|
4501 |
aFloat basicAt:7 put:((i bitShift:-8) bitAnd:16rFF). |
|
4502 |
aFloat basicAt:8 put:(i bitAnd:16rFF). |
|
253 | 4503 |
] ifFalse:[ |
261 | 4504 |
aFloat basicAt:1 put:(i bitAnd:16rFF). |
4505 |
aFloat basicAt:2 put:((i bitShift:-8) bitAnd:16rFF). |
|
4506 |
aFloat basicAt:3 put:((i bitShift:-16) bitAnd:16rFF). |
|
4507 |
aFloat basicAt:4 put:((i bitShift:-24) bitAnd:16rFF). |
|
4508 |
aFloat basicAt:5 put:((i bitShift:-32) bitAnd:16rFF). |
|
4509 |
aFloat basicAt:6 put:((i bitShift:-40) bitAnd:16rFF). |
|
4510 |
aFloat basicAt:7 put:((i bitShift:-48) bitAnd:16rFF). |
|
4511 |
aFloat basicAt:8 put:((i bitShift:-56) bitAnd:16rFF). |
|
253 | 4512 |
]. |
4513 |
||
4514 |
^ aFloat. |
|
4515 |
||
4516 |
"Created: / 4.1.1998 / 01:45:00 / cg" |
|
4517 |
! |
|
4518 |
||
255 | 4519 |
_Double_valueOf0:nativeContext |
4520 |
|s d| |
|
4521 |
||
4522 |
s := nativeContext argAt:1. |
|
4523 |
s notNil ifTrue:[ |
|
261 | 4524 |
s := Java as_ST_String:s. |
4525 |
d := Float readFrom:s onError:nil. |
|
255 | 4526 |
]. |
4527 |
d isNil ifTrue:[ |
|
261 | 4528 |
self throwNumberFormatException. |
4529 |
"/ not reached |
|
255 | 4530 |
]. |
4531 |
||
4532 |
^ d |
|
4533 |
||
4534 |
"Modified: / 8.8.1997 / 12:03:55 / cg" |
|
4535 |
"Created: / 7.1.1998 / 11:09:43 / cg" |
|
4536 |
! |
|
4537 |
||
253 | 4538 |
_Float_floatToIntBits:nativeContext |
4539 |
|f i| |
|
4540 |
||
4541 |
f := nativeContext argAt:1. |
|
4542 |
||
4543 |
UninterpretedBytes isBigEndian ifTrue:[ |
|
261 | 4544 |
i := f basicAt:4. |
4545 |
i := i bitOr:((f basicAt:3) bitShift:8). |
|
4546 |
i := i bitOr:((f basicAt:2) bitShift:16). |
|
4547 |
i := i bitOr:((f basicAt:1) bitShift:24). |
|
253 | 4548 |
] ifFalse:[ |
261 | 4549 |
i := f basicAt:1. |
4550 |
i := i bitOr:((f basicAt:2) bitShift:8). |
|
4551 |
i := i bitOr:((f basicAt:3) bitShift:16). |
|
4552 |
i := i bitOr:((f basicAt:4) bitShift:24). |
|
253 | 4553 |
]. |
4554 |
||
4555 |
^ i. |
|
4556 |
||
4557 |
"Created: / 4.1.1998 / 01:25:50 / cg" |
|
4558 |
! |
|
4559 |
||
261 | 4560 |
_Float_intBitsToFloat:nativeContet |
4561 |
|i aFloat| |
|
4562 |
||
4563 |
i := nativeContet argAt:1. |
|
4564 |
||
4565 |
aFloat := ShortFloat basicNew. |
|
4566 |
UninterpretedBytes isBigEndian ifTrue:[ |
|
4567 |
aFloat basicAt:1 put:((i bitShift:-24) bitAnd:16rFF). |
|
4568 |
aFloat basicAt:2 put:((i bitShift:-16) bitAnd:16rFF). |
|
4569 |
aFloat basicAt:3 put:((i bitShift:-8) bitAnd:16rFF). |
|
4570 |
aFloat basicAt:4 put:(i bitAnd:16rFF). |
|
4571 |
] ifFalse:[ |
|
4572 |
aFloat basicAt:1 put:(i bitAnd:16rFF). |
|
4573 |
aFloat basicAt:2 put:((i bitShift:-8) bitAnd:16rFF). |
|
4574 |
aFloat basicAt:3 put:((i bitShift:-16) bitAnd:16rFF). |
|
4575 |
aFloat basicAt:4 put:((i bitShift:-24) bitAnd:16rFF). |
|
4576 |
]. |
|
4577 |
||
4578 |
^ aFloat. |
|
4579 |
||
4580 |
"Created: / 13.1.1998 / 23:03:36 / cg" |
|
4581 |
"Modified: / 13.1.1998 / 23:05:01 / cg" |
|
4582 |
! |
|
4583 |
||
440 | 4584 |
_Math_IEEEremainder:nativeContext |
4585 |
UnimplementedNativeMethodSignal raise |
|
4586 |
||
4587 |
"Created: / 12.11.1998 / 18:52:36 / cg" |
|
4588 |
! |
|
4589 |
||
342 | 4590 |
_Math_acos:nativeContext |
4591 |
"arc cosine" |
|
4592 |
||
4593 |
|dVal| |
|
4594 |
||
4595 |
dVal := nativeContext argAt:1. |
|
432 | 4596 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4597 |
"/ dVal isReal ifTrue:[ |
|
4598 |
"/ 'JAVAVM [info]: missing double flag in Math>>acos' infoPrintCR. |
|
4599 |
"/ ] ifFalse:[ |
|
4600 |
"/ self halt:'expected double arg' |
|
4601 |
"/ ] |
|
4602 |
"/ ]. |
|
342 | 4603 |
^ dVal arcCos |
4604 |
||
4605 |
"Created: / 7.5.1998 / 00:34:50 / cg" |
|
432 | 4606 |
"Modified: / 11.11.1998 / 15:08:20 / cg" |
342 | 4607 |
! |
4608 |
||
4609 |
_Math_asin:nativeContext |
|
4610 |
"arc sine" |
|
4611 |
||
4612 |
|dVal| |
|
4613 |
||
4614 |
dVal := nativeContext argAt:1. |
|
432 | 4615 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4616 |
"/ dVal isReal ifTrue:[ |
|
4617 |
"/ 'JAVAVM [info]: missing double flag in Math>>asin' infoPrintCR. |
|
4618 |
"/ ] ifFalse:[ |
|
4619 |
"/ self halt:'expected double arg' |
|
4620 |
"/ ] |
|
4621 |
"/ ]. |
|
342 | 4622 |
^ dVal arcSin |
4623 |
||
4624 |
"Created: / 7.5.1998 / 00:34:26 / cg" |
|
432 | 4625 |
"Modified: / 11.11.1998 / 15:08:15 / cg" |
342 | 4626 |
! |
4627 |
||
440 | 4628 |
_Math_atan2:nativeContext |
4629 |
UnimplementedNativeMethodSignal raise |
|
4630 |
||
4631 |
"Created: / 12.11.1998 / 18:52:52 / cg" |
|
4632 |
! |
|
4633 |
||
317 | 4634 |
_Math_atan:nativeContext |
4635 |
"arc tangens" |
|
4636 |
||
4637 |
|dVal| |
|
4638 |
||
4639 |
dVal := nativeContext argAt:1. |
|
432 | 4640 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4641 |
"/ dVal isReal ifTrue:[ |
|
4642 |
"/ 'JAVAVM [info]: missing double flag in Math>>atan' infoPrintCR. |
|
4643 |
"/ ] ifFalse:[ |
|
4644 |
"/ self halt:'expected double arg' |
|
4645 |
"/ ] |
|
4646 |
"/ ]. |
|
317 | 4647 |
^ dVal arcTan |
4648 |
||
4649 |
"Created: / 6.2.1998 / 01:24:12 / cg" |
|
432 | 4650 |
"Modified: / 11.11.1998 / 15:08:11 / cg" |
317 | 4651 |
! |
4652 |
||
255 | 4653 |
_Math_ceil:nativeContext |
4654 |
"ceiling" |
|
4655 |
||
4656 |
|dVal| |
|
4657 |
||
4658 |
dVal := nativeContext argAt:1. |
|
432 | 4659 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4660 |
"/ dVal isReal ifTrue:[ |
|
4661 |
"/ 'JAVAVM [info]: missing double flag in Math>>ceil' infoPrintCR. |
|
4662 |
"/ ] ifFalse:[ |
|
4663 |
"/ self halt:'expected double arg' |
|
4664 |
"/ ] |
|
4665 |
"/ ]. |
|
255 | 4666 |
^ dVal ceilingAsFloat |
4667 |
||
4668 |
"Created: / 7.1.1998 / 15:43:00 / cg" |
|
432 | 4669 |
"Modified: / 11.11.1998 / 15:08:04 / cg" |
255 | 4670 |
! |
4671 |
||
4672 |
_Math_cos:nativeContext |
|
4673 |
"cosine" |
|
4674 |
||
4675 |
|dVal| |
|
4676 |
||
4677 |
dVal := nativeContext argAt:1. |
|
432 | 4678 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4679 |
"/ dVal isReal ifTrue:[ |
|
4680 |
"/ 'JAVAVM [info]: missing double flag in Math>>cos' infoPrintCR. |
|
4681 |
"/ ] ifFalse:[ |
|
4682 |
"/ self halt:'expected double arg' |
|
4683 |
"/ ] |
|
4684 |
"/ ]. |
|
255 | 4685 |
^ dVal cos |
4686 |
||
4687 |
"Created: / 7.1.1998 / 15:41:30 / cg" |
|
432 | 4688 |
"Modified: / 11.11.1998 / 15:07:59 / cg" |
255 | 4689 |
! |
4690 |
||
342 | 4691 |
_Math_exp:nativeContext |
4692 |
"exponential" |
|
4693 |
||
4694 |
|dVal| |
|
4695 |
||
4696 |
dVal := nativeContext argAt:1. |
|
432 | 4697 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4698 |
"/ dVal isReal ifTrue:[ |
|
4699 |
"/ 'JAVAVM [info]: missing double flag in Math>>exp' infoPrintCR. |
|
4700 |
"/ ] ifFalse:[ |
|
4701 |
"/ self halt:'expected double arg' |
|
4702 |
"/ ] |
|
4703 |
"/ ]. |
|
342 | 4704 |
^ dVal exp |
4705 |
||
4706 |
"Created: / 7.5.1998 / 00:36:19 / cg" |
|
432 | 4707 |
"Modified: / 11.11.1998 / 15:07:50 / cg" |
342 | 4708 |
! |
4709 |
||
255 | 4710 |
_Math_floor:nativeContext |
4711 |
"floor" |
|
4712 |
||
4713 |
|dVal| |
|
4714 |
||
4715 |
dVal := nativeContext argAt:1. |
|
432 | 4716 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4717 |
"/ dVal isReal ifTrue:[ |
|
4718 |
"/ 'JAVAVM [info]: missing double flag in Math>>floor' infoPrintCR. |
|
4719 |
"/ ] ifFalse:[ |
|
4720 |
"/ self halt:'expected double arg' |
|
4721 |
"/ ] |
|
4722 |
"/ ]. |
|
255 | 4723 |
^ dVal floorAsFloat |
4724 |
||
4725 |
"Created: / 7.1.1998 / 19:09:21 / cg" |
|
432 | 4726 |
"Modified: / 11.11.1998 / 15:07:45 / cg" |
255 | 4727 |
! |
4728 |
||
4729 |
_Math_log:nativeContext |
|
510 | 4730 |
"natural logarithm" |
255 | 4731 |
|
4732 |
|dVal| |
|
4733 |
||
4734 |
dVal := nativeContext argAt:1. |
|
432 | 4735 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4736 |
"/ dVal isReal ifTrue:[ |
|
4737 |
"/ 'JAVAVM [info]: missing double flag in Math>>log' infoPrintCR. |
|
4738 |
"/ ] ifFalse:[ |
|
4739 |
"/ self halt:'expected double arg' |
|
4740 |
"/ ] |
|
4741 |
"/ ]. |
|
510 | 4742 |
^ dVal ln |
255 | 4743 |
|
4744 |
"Created: / 7.1.1998 / 15:42:19 / cg" |
|
510 | 4745 |
"Modified: / 30.12.1998 / 17:41:42 / cg" |
255 | 4746 |
! |
4747 |
||
4748 |
_Math_pow:nativeContext |
|
4749 |
"power" |
|
4750 |
||
4751 |
|dVal1 dVal2| |
|
4752 |
||
4753 |
dVal1 := nativeContext argAt:1. |
|
432 | 4754 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4755 |
"/ dVal1 isReal ifTrue:[ |
|
4756 |
"/ 'JAVAVM [info]: missing double flag in Math>>pow' infoPrintCR. |
|
4757 |
"/ ] ifFalse:[ |
|
4758 |
"/ self halt:'expected double arg' |
|
4759 |
"/ ] |
|
4760 |
"/ ]. |
|
255 | 4761 |
dVal2 := nativeContext argAt:3. |
432 | 4762 |
"/ (nativeContext argAt:4) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4763 |
"/ dVal2 isReal ifTrue:[ |
|
4764 |
"/ 'JAVAVM [info]: missing double flag in Math>>pow' infoPrintCR. |
|
4765 |
"/ ] ifFalse:[ |
|
4766 |
"/ self halt:'expected double arg' |
|
4767 |
"/ ] |
|
4768 |
"/ ]. |
|
255 | 4769 |
^ dVal1 raisedTo:dVal2 |
4770 |
||
4771 |
"Created: / 7.1.1998 / 15:44:13 / cg" |
|
432 | 4772 |
"Modified: / 11.11.1998 / 15:07:33 / cg" |
255 | 4773 |
! |
4774 |
||
440 | 4775 |
_Math_rint:nativeContext |
4776 |
UnimplementedNativeMethodSignal raise |
|
4777 |
||
4778 |
"Created: / 12.11.1998 / 18:52:47 / cg" |
|
4779 |
! |
|
4780 |
||
255 | 4781 |
_Math_sin:nativeContext |
4782 |
"sine" |
|
4783 |
||
4784 |
|dVal| |
|
4785 |
||
4786 |
dVal := nativeContext argAt:1. |
|
432 | 4787 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4788 |
"/ dVal isReal ifTrue:[ |
|
4789 |
"/ 'JAVAVM [info]: missing double flag in Math>>sin' infoPrintCR. |
|
4790 |
"/ ] ifFalse:[ |
|
4791 |
"/ self halt:'expected double arg' |
|
4792 |
"/ ] |
|
4793 |
"/ ]. |
|
255 | 4794 |
^ dVal sin |
4795 |
||
4796 |
"Created: / 7.1.1998 / 15:41:40 / cg" |
|
432 | 4797 |
"Modified: / 11.11.1998 / 15:07:09 / cg" |
255 | 4798 |
! |
4799 |
||
4800 |
_Math_sqrt:nativeContext |
|
4801 |
"square root" |
|
4802 |
||
4803 |
|dVal| |
|
4804 |
||
4805 |
dVal := nativeContext argAt:1. |
|
432 | 4806 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4807 |
"/ dVal isReal ifTrue:[ |
|
4808 |
"/ 'JAVAVM [info]: missing double flag in Math>>sqrt' infoPrintCR. |
|
4809 |
"/ ] ifFalse:[ |
|
4810 |
"/ self halt:'expected double arg' |
|
4811 |
"/ ] |
|
4812 |
"/ ]. |
|
4813 |
||
4814 |
"/ how about domain errors ? |
|
507 | 4815 |
dVal < 0 ifTrue:[ |
4816 |
^ 0.0 |
|
4817 |
]. |
|
255 | 4818 |
^ dVal sqrt |
4819 |
||
4820 |
"Created: / 7.1.1998 / 15:42:40 / cg" |
|
507 | 4821 |
"Modified: / 29.12.1998 / 13:22:36 / cg" |
255 | 4822 |
! |
4823 |
||
342 | 4824 |
_Math_tan:nativeContext |
4825 |
"tangent" |
|
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>>tan' infoPrintCR. |
|
4833 |
"/ ] ifFalse:[ |
|
4834 |
"/ self halt:'expected double arg' |
|
4835 |
"/ ] |
|
4836 |
"/ ]. |
|
342 | 4837 |
^ dVal tan |
4838 |
||
4839 |
"Created: / 7.5.1998 / 00:34:03 / cg" |
|
432 | 4840 |
"Modified: / 11.11.1998 / 15:07:14 / cg" |
342 | 4841 |
! |
4842 |
||
334 | 4843 |
_Method_getModifiers:nativeContext |
4844 |
|jMethod mthd retVal| |
|
4845 |
||
4846 |
jMethod := nativeContext receiver. |
|
4847 |
||
4848 |
mthd := JavaMethods at:jMethod ifAbsent:nil. |
|
4849 |
mthd isNil ifTrue:[ |
|
4850 |
self halt. |
|
4851 |
^ 0 |
|
4852 |
]. |
|
4853 |
^ mthd accessFlags |
|
4854 |
||
4855 |
"Modified: / 9.4.1998 / 17:50:01 / cg" |
|
4856 |
! |
|
4857 |
||
322 | 4858 |
_Method_invoke:nativeContext |
4859 |
"invoke a javaMethod" |
|
4860 |
||
4861 |
|jMethod mthd rec args retVal| |
|
4862 |
||
4863 |
jMethod := nativeContext receiver. |
|
4864 |
rec := nativeContext argAt:1. |
|
4865 |
args := nativeContext argAt:2. |
|
4866 |
||
4867 |
mthd := JavaMethods at:jMethod ifAbsent:nil. |
|
4868 |
mthd isNil ifTrue:[ |
|
4869 |
self halt. |
|
4870 |
]. |
|
4871 |
||
4872 |
"/ check for arguments to match the expected types ... |
|
4873 |
||
4874 |
mthd argSignature keysAndValuesDo:[:index :argSig | |
|
4875 |
|cls arg| |
|
4876 |
||
4877 |
cls := Java at:argSig. |
|
4878 |
arg := args at:index. |
|
4879 |
(arg isKindOf:cls) ifFalse:[ |
|
4880 |
self halt. |
|
4881 |
] |
|
4882 |
]. |
|
4883 |
||
4884 |
mthd isStatic ifTrue:[ |
|
4885 |
retVal := mthd valueWithReceiver:(mthd javaClass) arguments:args selector:mthd selector. |
|
4886 |
^ retVal |
|
4887 |
] ifFalse:[ |
|
4888 |
self halt. |
|
4889 |
]. |
|
4890 |
||
4891 |
self halt. |
|
4892 |
||
4893 |
"Created: / 13.2.1998 / 15:15:28 / cg" |
|
4894 |
"Modified: / 13.2.1998 / 15:35:54 / cg" |
|
4895 |
! |
|
4896 |
||
253 | 4897 |
_Object_clone:nativeContext |
4898 |
"clone an object" |
|
4899 |
||
4900 |
|o rslt| |
|
4901 |
||
4902 |
o := nativeContext receiver. |
|
4903 |
rslt := o shallowCopy. |
|
4904 |
^ rslt |
|
4905 |
||
4906 |
"Created: / 4.1.1998 / 19:39:26 / cg" |
|
4907 |
! |
|
4908 |
||
255 | 4909 |
_Object_getClass:nativeContext |
4910 |
"return an objects class" |
|
4911 |
||
4912 |
|o cls jClass| |
|
4913 |
||
4914 |
o := nativeContext receiver. |
|
4915 |
cls := o class. |
|
4916 |
||
268
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
4917 |
jClass := self javaClassObjectForClass:cls. |
255 | 4918 |
^ jClass |
4919 |
||
4920 |
"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
|
4921 |
"Modified: / 23.1.1998 / 17:48:22 / cg" |
255 | 4922 |
! |
4923 |
||
253 | 4924 |
_Object_hashCode:nativeContext |
4925 |
"identityHash" |
|
4926 |
||
4927 |
|o rslt| |
|
4928 |
||
4929 |
o := nativeContext receiver. |
|
4930 |
rslt := o identityHash. |
|
4931 |
^ rslt |
|
4932 |
||
4933 |
"Created: / 4.1.1998 / 19:40:26 / cg" |
|
4934 |
! |
|
4935 |
||
255 | 4936 |
_Object_notify:nativeContext |
4937 |
"wakeup" |
|
4938 |
||
4939 |
self wakeup:(nativeContext receiver). |
|
4940 |
||
4941 |
"Created: / 6.1.1998 / 21:09:26 / cg" |
|
4942 |
! |
|
4943 |
||
253 | 4944 |
_Object_notifyAll:nativeContext |
4945 |
self wakeupAll:(nativeContext receiver). |
|
4946 |
||
4947 |
"Created: / 3.1.1998 / 03:06:56 / cg" |
|
4948 |
! |
|
4949 |
||
4950 |
_Object_wait:nativeMethodContext |
|
4951 |
"wait" |
|
4952 |
||
508 | 4953 |
|tmo handle sema| |
253 | 4954 |
|
4955 |
handle := nativeMethodContext receiver. |
|
4956 |
tmo := nativeMethodContext argAt:1. |
|
4957 |
||
4958 |
sema := JavaVM semaphoreFor:handle. |
|
4959 |
||
4960 |
[ |
|
508 | 4961 |
self waitFor:sema state:#javaWait timeOut:tmo. |
4962 |
] valueOnUnwindDo:[ |
|
306 | 4963 |
JavaVM releaseSemaphoreFor:handle. |
253 | 4964 |
]. |
4965 |
||
4966 |
ThreadTrace ifTrue:[ |
|
306 | 4967 |
'====> thread continues ...' printCR. |
253 | 4968 |
] |
4969 |
||
508 | 4970 |
"Modified: / 30.12.1998 / 19:20:43 / cg" |
253 | 4971 |
! |
4972 |
||
4973 |
_Runtime_buildLibName:nativeContext |
|
4974 |
|jPath jFileName path fileName libName| |
|
4975 |
||
4976 |
jPath := nativeContext argAt:1. |
|
4977 |
jFileName := nativeContext argAt:2. |
|
4978 |
||
4979 |
path := Java as_ST_String:jPath. |
|
4980 |
fileName := Java as_ST_String:jFileName. |
|
4981 |
||
4982 |
path = '__builtIn__' ifTrue:[ |
|
261 | 4983 |
libName := path , '/' , fileName |
253 | 4984 |
] ifFalse:[ |
261 | 4985 |
libName := path , '/lib' , fileName , '.so'. |
253 | 4986 |
]. |
4987 |
^ Java as_String:libName. |
|
4988 |
||
4989 |
"Modified: / 8.8.1997 / 12:05:05 / cg" |
|
4990 |
"Created: / 4.1.1998 / 19:07:14 / cg" |
|
4991 |
! |
|
4992 |
||
261 | 4993 |
_Runtime_execInternal:nativeContext |
4994 |
"Run a unix-command; return a process object." |
|
4995 |
||
4996 |
|cmdAndArgArray envArray cmd jProcessClass jProcess| |
|
4997 |
||
432 | 4998 |
cmdAndArgArray := nativeContext argAt:1. |
4999 |
envArray := nativeContext argAt:2. |
|
5000 |
||
5001 |
cmd := cmdAndArgArray at:1. |
|
5002 |
||
5003 |
OperatingSystem isUNIXlike ifTrue:[ |
|
5004 |
jProcessClass := Java classForName:'java.lang.UNIXProcess'. |
|
5005 |
] ifFalse:[ |
|
5006 |
jProcessClass := Java classForName:'java.lang.Win32Process'. |
|
5007 |
]. |
|
261 | 5008 |
"/ |
432 | 5009 |
jProcessClass notNil ifTrue:[ |
495 | 5010 |
self halt. |
432 | 5011 |
jProcess := jProcessClass newCleared. |
5012 |
jProcess |
|
5013 |
perform:#'<init>([Ljava/lang/String;[Ljava/lang/String;)V' |
|
5014 |
with:cmdAndArgArray |
|
5015 |
with:envArray. |
|
5016 |
^ jProcess |
|
5017 |
]. |
|
5018 |
self halt. |
|
261 | 5019 |
self throwIOExceptionWithMessage:'Process execution disabled/unimplemented'. |
5020 |
^ nil |
|
5021 |
||
5022 |
"Created: / 15.1.1998 / 01:50:31 / cg" |
|
495 | 5023 |
"Modified: / 11.12.1998 / 13:09:36 / cg" |
261 | 5024 |
! |
5025 |
||
255 | 5026 |
_Runtime_exitInternal:nativeContext |
5027 |
"exit - here, we only shut down java threads" |
|
5028 |
||
5029 |
|enteredMonitors| |
|
5030 |
||
474 | 5031 |
ExitDebug == true ifTrue:[ |
5032 |
self halt:'Java code called exit'. |
|
5033 |
]. |
|
5034 |
||
255 | 5035 |
(enteredMonitors := self enteredMonitors) size > 0 ifTrue:[ |
306 | 5036 |
enteredMonitors do:[:handle | |
5037 |
| mon | |
|
5038 |
||
5039 |
mon := LockTable at:handle ifAbsent:nil. |
|
5040 |
mon isNil ifTrue:[ |
|
5041 |
self halt:'no monitor in exitInternal'. |
|
5042 |
] ifFalse:[ |
|
5043 |
mon exit. |
|
255 | 5044 |
('====> terminateThread - exit monitor for ' , handle displayString , ' in ' , Processor activeProcess name , ' ...') infoPrintCR. |
5045 |
"/ LockTableAccess critical:[ |
|
5046 |
"/ mon isFree ifTrue:[ |
|
5047 |
"/ LockTable removeKey:handle |
|
5048 |
"/ ] |
|
5049 |
"/ ] |
|
306 | 5050 |
]. |
5051 |
]. |
|
5052 |
]. |
|
5053 |
||
5054 |
"/ JavaVM releaseAllJavaResources. |
|
255 | 5055 |
AbortSignal raise. |
5056 |
self halt. |
|
5057 |
||
5058 |
"Created: / 7.1.1998 / 22:48:51 / cg" |
|
474 | 5059 |
"Modified: / 2.12.1998 / 23:03:18 / cg" |
255 | 5060 |
! |
5061 |
||
5062 |
_Runtime_freeMemory:nativeContext |
|
5063 |
"free memory - Returns the number of free bytes" |
|
5064 |
||
5065 |
^ ObjectMemory freeListSpace + ObjectMemory freeSpace |
|
5066 |
||
5067 |
"Created: / 12.1.1998 / 12:59:53 / cg" |
|
5068 |
! |
|
5069 |
||
5070 |
_Runtime_gc:nativeContext |
|
5071 |
"Runs the garbage collector. |
|
5072 |
Ignored, since the ST-gc runs all the time." |
|
5073 |
||
5074 |
^ self |
|
5075 |
||
5076 |
"Modified: / 12.1.1998 / 12:58:32 / cg" |
|
5077 |
! |
|
5078 |
||
253 | 5079 |
_Runtime_initializeLinkerInternal:nativeContext |
5080 |
"init sharedLib linker, return searchPath as javaString" |
|
5081 |
||
5082 |
|path| |
|
5083 |
||
5084 |
"/ mhmh - what is done here ? |
|
5085 |
||
5086 |
path := ''. |
|
5087 |
LibPath do:[:comp | path size == 0 ifTrue:[ |
|
261 | 5088 |
path := path , comp |
5089 |
] ifFalse:[ |
|
5090 |
path := path , ':' , comp |
|
5091 |
] |
|
5092 |
]. |
|
253 | 5093 |
|
5094 |
^ Java as_String:path |
|
5095 |
||
5096 |
"Modified: / 7.8.1997 / 21:17:03 / cg" |
|
5097 |
"Created: / 4.1.1998 / 17:53:15 / cg" |
|
5098 |
! |
|
5099 |
||
5100 |
_Runtime_loadFileInternal:nativeContext |
|
5101 |
"load a sharedLib, return boolean 0 (false) if fail; 1 (true) if ok" |
|
5102 |
||
5103 |
|ret| |
|
5104 |
||
5105 |
ret := self _Runtime_loadFileInternalI:nativeContext. |
|
5106 |
ret < 0 ifTrue:[ ret := 0 ]. |
|
5107 |
^ ret |
|
5108 |
||
5109 |
"Created: / 4.1.1998 / 19:10:20 / cg" |
|
5110 |
"Modified: / 4.1.1998 / 19:11:04 / cg" |
|
5111 |
! |
|
5112 |
||
5113 |
_Runtime_loadFileInternalI:nativeContext |
|
5114 |
"1.1b3 change; load a sharedLib like 'loadFileInternal', |
|
5115 |
but return integer: |
|
319 | 5116 |
-1 outOfMemory error |
5117 |
0 failed to load |
|
5118 |
1 loaded or already loaded (i.e. ok)" |
|
253 | 5119 |
|
5120 |
|jLibName libName libHandle| |
|
5121 |
||
5122 |
jLibName := nativeContext argAt:1. |
|
5123 |
libName := Java as_ST_String:jLibName. |
|
5124 |
||
5125 |
(SimulatedLibs includes:libName) ifTrue:[ |
|
319 | 5126 |
"/ ('JAVA: builtIn libLoad simulated: ' , libName) printNL. |
5127 |
^ 1 |
|
253 | 5128 |
]. |
5129 |
(LoadedLibs notNil and:[LoadedLibs includesKey:libName]) ifTrue:[ |
|
319 | 5130 |
"/ ('JAVA: already loaded: ' , libName) printNL. |
5131 |
^ 1 |
|
253 | 5132 |
]. |
5133 |
||
5134 |
libName asFilename exists ifFalse:[ |
|
319 | 5135 |
('JAVA: no file to load: ' , libName) printNL. |
5136 |
^ 0 |
|
5137 |
]. |
|
5138 |
||
5139 |
(self confirm:'permission to load native library: ' , libName , ' ?') ifFalse:[ |
|
5140 |
^ 0 |
|
253 | 5141 |
]. |
5142 |
||
5143 |
libHandle := ObjectFileLoader loadLibrary:libName. |
|
5144 |
libHandle isNil ifTrue:[ |
|
319 | 5145 |
('JAVA: failed to load: ' , libName) printNL. |
5146 |
^ 0 |
|
253 | 5147 |
]. |
5148 |
||
5149 |
LoadedLibs isNil ifTrue:[ |
|
319 | 5150 |
LoadedLibs := Dictionary new. |
253 | 5151 |
]. |
5152 |
||
5153 |
LoadedLibs at:libName put:libHandle. |
|
5154 |
^ 1 |
|
5155 |
||
5156 |
"Created: / 4.1.1998 / 19:10:54 / cg" |
|
319 | 5157 |
"Modified: / 6.2.1998 / 03:11:59 / cg" |
253 | 5158 |
! |
5159 |
||
440 | 5160 |
_Runtime_runFinalization:nativeContext |
5161 |
"/ void runFinalization () |
|
5162 |
UnimplementedNativeMethodSignal raise |
|
5163 |
||
5164 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
5165 |
"Created: / 12.11.1998 / 18:59:01 / cg" |
|
5166 |
! |
|
5167 |
||
380 | 5168 |
_Runtime_runFinalizersOnExit0:nativeContext |
5169 |
"" |
|
5170 |
||
5171 |
|onOff| |
|
5172 |
||
5173 |
onOff := nativeContext argAt:1. |
|
5174 |
^ 1 |
|
5175 |
||
5176 |
"Modified: / 6.2.1998 / 03:11:59 / cg" |
|
5177 |
"Created: / 15.10.1998 / 23:34:55 / cg" |
|
5178 |
! |
|
5179 |
||
255 | 5180 |
_Runtime_totalMemory:nativeContext |
5181 |
"free memory - Returns the total number of bytes" |
|
5182 |
||
5183 |
^ ObjectMemory oldSpaceSize + ObjectMemory newSpaceSize |
|
5184 |
||
5185 |
"Created: / 12.1.1998 / 12:59:23 / cg" |
|
5186 |
! |
|
5187 |
||
440 | 5188 |
_Runtime_traceInstructions:nativeContext |
5189 |
"/ void traceInstructions (boolean) |
|
5190 |
UnimplementedNativeMethodSignal raise |
|
5191 |
||
5192 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
5193 |
"Created: / 12.11.1998 / 18:59:18 / cg" |
|
5194 |
! |
|
5195 |
||
5196 |
_Runtime_traceMethodCalls:nativeContext |
|
5197 |
"/ void traceMethodCalls (boolean) |
|
5198 |
UnimplementedNativeMethodSignal raise |
|
5199 |
||
5200 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
5201 |
"Created: / 12.11.1998 / 18:59:37 / cg" |
|
5202 |
! |
|
5203 |
||
5204 |
_SecurityManager_classDepth:nativeContext |
|
5205 |
UnimplementedNativeMethodSignal raise |
|
5206 |
||
5207 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
5208 |
"Created: / 12.11.1998 / 18:56:27 / cg" |
|
5209 |
! |
|
5210 |
||
261 | 5211 |
_SecurityManager_classLoaderDepth:nativeContext |
5212 |
|con depth| |
|
5213 |
||
5214 |
con := thisContext sender. |
|
5215 |
depth := 1. |
|
5216 |
[con notNil] whileTrue:[ |
|
5217 |
con receiver == JavaClassReader classLoaderQuerySignal ifTrue:[ |
|
5218 |
con selector == #handle:do: ifTrue:[ |
|
5219 |
depth := depth + 1 |
|
5220 |
] |
|
5221 |
]. |
|
5222 |
con := con sender. |
|
5223 |
]. |
|
5224 |
'JAVA: classLoaderDepth -> ' infoPrint. depth infoPrintCR. |
|
5225 |
^ depth. |
|
5226 |
||
5227 |
"Created: / 13.1.1998 / 09:21:46 / cg" |
|
5228 |
"Modified: / 13.1.1998 / 09:33:43 / cg" |
|
5229 |
! |
|
5230 |
||
5231 |
_SecurityManager_currentClassLoader:nativeContext |
|
5232 |
|loader| |
|
5233 |
||
5234 |
loader := JavaClassReader classLoaderQuerySignal raise. |
|
494 | 5235 |
"/ 'JAVA: currentClassLoader -> ' infoPrint. loader displayString infoPrintCR. |
261 | 5236 |
^ loader. |
5237 |
||
5238 |
"Created: / 13.1.1998 / 09:23:28 / cg" |
|
494 | 5239 |
"Modified: / 11.12.1998 / 12:39:59 / cg" |
261 | 5240 |
! |
5241 |
||
440 | 5242 |
_SecurityManager_currentLoadedClass0:nativeContext |
5243 |
UnimplementedNativeMethodSignal raise |
|
5244 |
||
5245 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
5246 |
"Created: / 12.11.1998 / 18:56:41 / cg" |
|
5247 |
! |
|
5248 |
||
5249 |
_SecurityManager_getClassContext:nativeContext |
|
5250 |
UnimplementedNativeMethodSignal raise |
|
5251 |
||
5252 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
5253 |
"Created: / 12.11.1998 / 18:56:06 / cg" |
|
5254 |
! |
|
5255 |
||
5256 |
_String_intern:nativeContext |
|
5257 |
UnimplementedNativeMethodSignal raise |
|
5258 |
||
5259 |
"Created: / 12.11.1998 / 18:50:56 / cg" |
|
5260 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
5261 |
! |
|
5262 |
||
253 | 5263 |
_System_arraycopy:nativeContext |
398 | 5264 |
|srcArray srcIdx dstArray dstIdx count dstEndIdx| |
253 | 5265 |
|
5266 |
srcArray := nativeContext argAt:1. |
|
5267 |
srcIdx := nativeContext argAt:2. |
|
5268 |
dstArray := nativeContext argAt:3. |
|
5269 |
dstIdx := nativeContext argAt:4. |
|
5270 |
count := nativeContext argAt:5. |
|
5271 |
||
398 | 5272 |
dstEndIdx := dstIdx + count. |
5273 |
dstIdx := dstIdx + 1. "/ ST uses 1-based indexing |
|
5274 |
srcIdx := srcIdx + 1. "/ ST uses 1-based indexing |
|
5275 |
||
253 | 5276 |
srcArray class isBytes ifTrue:[ |
398 | 5277 |
dstArray class isBytes ifFalse:[ |
5278 |
self halt:'incompatible arraycopy collections'. |
|
5279 |
]. |
|
5280 |
dstArray replaceBytesFrom:dstIdx to:dstEndIdx with:srcArray startingAt:srcIdx. |
|
253 | 5281 |
] ifFalse:[ |
398 | 5282 |
dstArray replaceFrom:dstIdx to:dstEndIdx with:srcArray startingAt:srcIdx. |
253 | 5283 |
]. |
5284 |
^ nil. |
|
5285 |
||
5286 |
"Created: / 3.1.1998 / 01:56:44 / cg" |
|
398 | 5287 |
"Modified: / 20.10.1998 / 16:22:46 / cg" |
253 | 5288 |
! |
5289 |
||
5290 |
_System_currentTimeMillis:nativeContext |
|
5291 |
"return the milliseconds since 1.jan.1970" |
|
5292 |
||
368 | 5293 |
|seconds delta| |
5294 |
||
5295 |
"/ workaround win32 bug (use 01:01:01 as base) |
|
5296 |
delta := AbsoluteTime now millisecondDeltaFrom:(AbsoluteTime day:1 month:1 year:1970 hour:1 minutes:1 seconds:1). |
|
5297 |
delta := delta - 3600 - 60 - 1. |
|
507 | 5298 |
"/ "/ make certain, it fits 64 signed bits |
5299 |
"/ delta := delta bitAnd:16r7FFFFFFFFFFFFFFF. |
|
5300 |
"/ ^ delta max:0 |
|
5301 |
^ delta |
|
5302 |
||
5303 |
" |
|
5304 |
JavaVM _System_currentTimeMillis:nil |
|
5305 |
" |
|
5306 |
||
5307 |
"Modified: / 23.12.1998 / 21:54:50 / cg" |
|
253 | 5308 |
! |
5309 |
||
440 | 5310 |
_System_identityHashCode:nativeContext |
5311 |
UnimplementedNativeMethodSignal raise |
|
5312 |
||
5313 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
5314 |
"Created: / 12.11.1998 / 18:54:00 / cg" |
|
5315 |
! |
|
5316 |
||
253 | 5317 |
_System_initProperties:nativeContext |
5318 |
|props stProps| |
|
5319 |
||
5320 |
props := nativeContext argAt:1. |
|
5321 |
stProps := self systemProperties. |
|
5322 |
||
5323 |
"/ recursively invoke myself on the Java HashTable. |
|
5324 |
"/ calling 'put' to stuff in the values ... |
|
5325 |
||
5326 |
stProps keysAndValuesDo:[:key :value | |
|
270 | 5327 |
|keyObj valueObj| |
5328 |
||
5329 |
keyObj := Java as_String:key. |
|
5330 |
valueObj := Java as_String:value. |
|
5331 |
||
5332 |
props |
|
5333 |
perform:#'put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;' |
|
5334 |
with:keyObj |
|
5335 |
with:valueObj. |
|
253 | 5336 |
]. |
5337 |
^ props |
|
5338 |
||
5339 |
"Created: / 3.1.1998 / 14:25:22 / cg" |
|
5340 |
"Modified: / 4.1.1998 / 14:23:18 / cg" |
|
5341 |
! |
|
5342 |
||
5343 |
_System_setErr0:nativeContext |
|
5344 |
|stream| |
|
5345 |
||
5346 |
stream := nativeContext argAt:1. |
|
5347 |
||
5348 |
self setOpenFile:(self javaConsoleStream ? Stderr) at:2. |
|
5349 |
||
5350 |
nativeContext receiver instVarNamed:'err' put:stream. |
|
5351 |
||
5352 |
"Created: / 18.3.1997 / 15:02:05 / cg" |
|
5353 |
"Modified: / 4.1.1998 / 16:21:15 / cg" |
|
5354 |
! |
|
5355 |
||
5356 |
_System_setIn0:nativeContext |
|
5357 |
|stream| |
|
5358 |
||
5359 |
stream := nativeContext argAt:1. |
|
5360 |
||
5361 |
self setOpenFile:Stdin at:0. |
|
5362 |
||
5363 |
nativeContext receiver instVarNamed:'in' put:stream. |
|
5364 |
||
5365 |
"Created: / 4.1.1998 / 16:16:38 / cg" |
|
5366 |
"Modified: / 4.1.1998 / 16:20:44 / cg" |
|
5367 |
! |
|
5368 |
||
5369 |
_System_setOut0:nativeContext |
|
5370 |
|stream| |
|
5371 |
||
5372 |
stream := nativeContext argAt:1. |
|
5373 |
||
5374 |
self setOpenFile:(self javaConsoleStream ? Stdout) at:1. |
|
5375 |
||
5376 |
nativeContext receiver instVarNamed:'out' put:stream. |
|
5377 |
||
5378 |
"Created: / 4.1.1998 / 16:18:26 / cg" |
|
5379 |
"Modified: / 4.1.1998 / 16:20:23 / cg" |
|
5380 |
! |
|
5381 |
||
440 | 5382 |
_Thread_countStackFrames:nativeContext |
5383 |
"/ int countStackFrames () |
|
5384 |
UnimplementedNativeMethodSignal raise |
|
5385 |
||
5386 |
"Created: / 12.11.1998 / 19:06:21 / cg" |
|
5387 |
! |
|
5388 |
||
253 | 5389 |
_Thread_currentThread:nativeMethodContext |
5390 |
|t p prio| |
|
5391 |
||
5392 |
p := Processor activeProcess. |
|
5393 |
t := self javaThreadForSTProcess:p. |
|
5394 |
t notNil ifTrue:[ |
|
261 | 5395 |
^ t |
253 | 5396 |
]. |
5397 |
t := self newThread:'main'. |
|
5398 |
Java threads at:t put:p. |
|
5399 |
^ t |
|
5400 |
||
5401 |
"Created: / 3.1.1998 / 01:42:28 / cg" |
|
5402 |
"Modified: / 4.1.1998 / 14:59:13 / cg" |
|
5403 |
! |
|
5404 |
||
339 | 5405 |
_Thread_interrupt0:nativeContext |
5406 |
"ask if a thread is interrupted (clear interruptState if arg is true)" |
|
5407 |
||
5408 |
|jThread stProcess| |
|
5409 |
||
5410 |
jThread := nativeContext receiver. |
|
5411 |
stProcess := self stProcessForJavaThread:jThread. |
|
5412 |
stProcess isNil ifTrue:[ |
|
5413 |
self halt. |
|
5414 |
^ 0 |
|
5415 |
]. |
|
5416 |
||
5417 |
stProcess markInterrupted |
|
5418 |
||
5419 |
"Modified: / 2.1.1998 / 21:49:06 / cg" |
|
5420 |
"Created: / 10.4.1998 / 15:21:43 / cg" |
|
5421 |
! |
|
5422 |
||
253 | 5423 |
_Thread_isAlive:nativeContext |
5424 |
"is it alive ?" |
|
5425 |
||
5426 |
|jThread stProcess| |
|
5427 |
||
5428 |
jThread := nativeContext receiver. |
|
5429 |
stProcess := JavaVM stProcessForJavaThread:jThread. |
|
5430 |
stProcess isNil ifTrue:[ |
|
318 | 5431 |
ThreadTrace == true ifTrue:[ |
5432 |
('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL. |
|
5433 |
]. |
|
5434 |
^ 0 "FALSE" |
|
255 | 5435 |
]. |
5436 |
stProcess isDead ifTrue:[^ 0 "FALSE"]. |
|
5437 |
^ 1 "TRUE" |
|
5438 |
||
5439 |
"Created: / 5.1.1998 / 02:03:51 / cg" |
|
318 | 5440 |
"Modified: / 6.2.1998 / 02:15:01 / cg" |
255 | 5441 |
! |
5442 |
||
5443 |
_Thread_isInterrupted:nativeContext |
|
5444 |
"ask if a thread is interrupted (clear interruptState if arg is true)" |
|
5445 |
||
5446 |
|jThread stProcess clearInterrupt rslt| |
|
5447 |
||
5448 |
jThread := nativeContext receiver. |
|
5449 |
stProcess := self stProcessForJavaThread:jThread. |
|
5450 |
stProcess isNil ifTrue:[ |
|
261 | 5451 |
self halt. |
5452 |
^ 0 |
|
253 | 5453 |
]. |
255 | 5454 |
|
5455 |
clearInterrupt := nativeContext argAt:1. |
|
5456 |
rslt := stProcess isInterrupted ifTrue:[1] ifFalse:[0]. |
|
5457 |
clearInterrupt ~~ 0 ifTrue:[stProcess clearInterruptActions]. |
|
5458 |
^ rslt |
|
5459 |
||
5460 |
"Modified: / 2.1.1998 / 21:49:06 / cg" |
|
5461 |
"Created: / 7.1.1998 / 18:50:26 / cg" |
|
5462 |
! |
|
5463 |
||
5464 |
_Thread_resume0:nativeContext |
|
5465 |
"yield" |
|
5466 |
||
5467 |
|jThread stProcess| |
|
5468 |
||
5469 |
jThread := nativeContext receiver. |
|
5470 |
stProcess := JavaVM stProcessForJavaThread:jThread. |
|
5471 |
stProcess isNil ifTrue:[ |
|
318 | 5472 |
ThreadTrace == true ifTrue:[ |
5473 |
('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL. |
|
5474 |
]. |
|
5475 |
^ nil "void" |
|
255 | 5476 |
]. |
5477 |
stProcess resume |
|
5478 |
||
5479 |
"Created: / 8.1.1998 / 01:06:27 / cg" |
|
318 | 5480 |
"Modified: / 6.2.1998 / 02:15:08 / cg" |
253 | 5481 |
! |
5482 |
||
5483 |
_Thread_setPriority0:nativeMethodContext |
|
5484 |
|t p prio| |
|
5485 |
||
5486 |
t := nativeMethodContext receiver. |
|
5487 |
p := JavaVM stProcessForJavaThread:t. |
|
5488 |
prio := nativeMethodContext argAt:1. |
|
5489 |
||
5490 |
p isNil ifTrue:[ |
|
318 | 5491 |
ThreadTrace == true ifTrue:[ |
5492 |
'JAVA [info]: no process yet (in setPriority)' infoPrintCR. |
|
5493 |
]. |
|
5494 |
^ nil |
|
253 | 5495 |
]. |
5496 |
||
5497 |
ThreadTrace ifTrue:[ |
|
318 | 5498 |
'JAVA [info]: setPrio: ' print. t print. ' pri= ' print. prio print. ' p= ' print. p printNL. |
253 | 5499 |
]. |
5500 |
^ nil |
|
5501 |
||
5502 |
"Created: / 2.1.1998 / 19:05:55 / cg" |
|
318 | 5503 |
"Modified: / 6.2.1998 / 02:28:18 / cg" |
253 | 5504 |
! |
5505 |
||
255 | 5506 |
_Thread_sleep:nativeContext |
5507 |
"sleep for some milliseconds " |
|
5508 |
||
5509 |
|millis| |
|
5510 |
||
432 | 5511 |
millis := nativeContext argAt:1. |
5512 |
Delay waitForMilliseconds:(millis max:50) |
|
255 | 5513 |
|
5514 |
"Created: / 7.1.1998 / 15:34:23 / cg" |
|
432 | 5515 |
"Modified: / 10.11.1998 / 22:28:04 / cg" |
255 | 5516 |
! |
5517 |
||
253 | 5518 |
_Thread_start:nativeContext |
5519 |
"start the thread" |
|
5520 |
||
5521 |
|jThread jName name stProcess| |
|
5522 |
||
5523 |
jThread := nativeContext receiver. |
|
5524 |
(jThread instVarNamed:'priority') < 1 ifTrue:[ |
|
297 | 5525 |
self halt. |
5526 |
jThread instVarNamed:'priority' put:1. |
|
253 | 5527 |
]. |
5528 |
||
5529 |
stProcess := JavaProcess |
|
297 | 5530 |
for:[ |
405 | 5531 |
|procName| |
5532 |
||
5533 |
Object abortSignal handle:[:ex | |
|
5534 |
procName := stProcess name. |
|
483 | 5535 |
(procName startsWith:'JAVA-AWT-EventQueue') ifTrue:[ |
5536 |
('JAVA: thread ' , procName , ' aborted - restarting process.') infoPrintCR. |
|
5537 |
ex restart. |
|
5538 |
] ifFalse:[ |
|
5539 |
('JAVA: thread ' , procName , ' aborted.') infoPrintCR. |
|
5540 |
]. |
|
405 | 5541 |
] do:[ |
297 | 5542 |
[ |
5543 |
JavaVM javaExceptionSignal handle:[:ex | |
|
405 | 5544 |
|exClass| |
297 | 5545 |
|
5546 |
procName := stProcess name. |
|
5547 |
exClass := ex parameter class. |
|
5548 |
||
5549 |
exClass == (Java at:'java.lang.ThreadDeath') ifTrue:[ |
|
5550 |
('JAVA: thread ' , procName , ' terminated') infoPrintCR. |
|
5551 |
] ifFalse:[ |
|
5552 |
Transcript |
|
5553 |
showCR:('JAVA: thread ''' |
|
5554 |
, procName |
|
5555 |
, ''' terminated with exception: ' |
|
5556 |
, exClass name). |
|
5557 |
]. |
|
5558 |
ex return. |
|
5559 |
] do:[ |
|
495 | 5560 |
Object messageNotUnderstoodSignal handle:[:ex | |
5561 |
"/ remap doesNotUnderstand with nil-receiver to |
|
5562 |
"/ a nullPointerException ... |
|
5563 |
|con| |
|
5564 |
||
5565 |
con := ex suspendedContext. |
|
5566 |
con receiver isNil ifTrue:[ |
|
507 | 5567 |
con sender method isJavaMethod ifTrue:[ |
5568 |
self throwNullPointerException. |
|
5569 |
AbortSignal raise. "/ ex proceed. |
|
5570 |
] |
|
495 | 5571 |
]. |
5572 |
ex reject. |
|
5573 |
] do:[ |
|
5574 |
jThread perform:#'run()V'. |
|
5575 |
ThreadTrace == true ifTrue:[ |
|
5576 |
('JAVA: thread ' , stProcess name , ' terminated') infoPrintCR. |
|
5577 |
]. |
|
5578 |
jThread perform:#'exit()V'. |
|
5579 |
ThreadTrace == true ifTrue:[ |
|
5580 |
('JAVA: after exit of thread ' , stProcess name) infoPrintCR. |
|
5581 |
] |
|
316 | 5582 |
] |
297 | 5583 |
] |
5584 |
] valueNowOrOnUnwindDo:[ |
|
495 | 5585 |
|monitors| |
5586 |
||
5587 |
monitors := EnteredMonitorsPerProcess at:stProcess ifAbsent:nil. |
|
5588 |
monitors notNil ifTrue:[ |
|
5589 |
monitors do:[:obj | |
|
5590 |
| mon | |
|
5591 |
||
5592 |
mon := self monitorFor:obj. |
|
5593 |
mon notNil ifTrue:[ |
|
5594 |
mon owningProcess == stProcess ifTrue:[ |
|
5595 |
('JAVA: release monitor owned by dying thread: ' , stProcess name) infoPrintCR. |
|
5596 |
mon exit |
|
5597 |
]. |
|
5598 |
]. |
|
5599 |
]. |
|
5600 |
EnteredMonitorsPerProcess removeKey:stProcess. |
|
5601 |
]. |
|
297 | 5602 |
Java threads removeKey:jThread ifAbsent:[]. |
5603 |
] |
|
405 | 5604 |
] |
297 | 5605 |
] |
5606 |
priority:(Processor activePriority). |
|
253 | 5607 |
|
5608 |
jName := jThread instVarNamed:'name'. |
|
5609 |
jName isString ifFalse:[ |
|
297 | 5610 |
name := Java as_ST_String:jName. |
253 | 5611 |
] ifTrue:[ |
297 | 5612 |
name := jName |
5613 |
]. |
|
5614 |
||
5615 |
"/ kludge - remember the ScreenUpdater ... |
|
5616 |
name = 'Screen Updater' ifTrue:[ |
|
5617 |
ScreenUpdaterProcess := stProcess. |
|
253 | 5618 |
]. |
5619 |
||
508 | 5620 |
"/name = 'UserDialogShowThread' ifTrue:[ |
5621 |
"/self halt |
|
5622 |
"/]. |
|
253 | 5623 |
"/ when that process terminates, wakup any waiters |
5624 |
stProcess addExitAction:[self wakeup:jThread]. |
|
5625 |
||
5626 |
stProcess name:'JAVA-' , name. |
|
5627 |
stProcess resume. |
|
5628 |
||
5629 |
Java threads at:jThread put:stProcess. |
|
5630 |
||
5631 |
^ nil |
|
5632 |
||
5633 |
"Created: / 3.1.1998 / 02:05:52 / cg" |
|
508 | 5634 |
"Modified: / 4.1.1999 / 14:35:07 / cg" |
255 | 5635 |
! |
5636 |
||
5637 |
_Thread_stop0:nativeContext |
|
5638 |
"terminate a thread" |
|
5639 |
||
5640 |
|jThread stProcess death| |
|
5641 |
||
5642 |
jThread := nativeContext receiver. |
|
5643 |
||
5644 |
stProcess := JavaVM stProcessForJavaThread:jThread. |
|
5645 |
stProcess isNil ifTrue:[ |
|
318 | 5646 |
ThreadTrace == true ifTrue:[ |
5647 |
('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL. |
|
5648 |
]. |
|
5649 |
^ nil "void" |
|
255 | 5650 |
]. |
5651 |
death := nativeContext argAt:1. |
|
5652 |
stProcess |
|
318 | 5653 |
interruptWith:[ |
5654 |
JavaVM javaExceptionSignal handle:[:ex | |
|
5655 |
Processor activeProcess terminate |
|
5656 |
] do:[ |
|
5657 |
ThreadTrace == true ifTrue:[ |
|
5658 |
('JAVA: thread exit: ' , jThread displayString) infoPrintNL. |
|
5659 |
]. |
|
5660 |
jThread perform:#'exit()V'. |
|
5661 |
self throwException:death. |
|
5662 |
] |
|
5663 |
]. |
|
255 | 5664 |
stProcess resume. |
5665 |
||
5666 |
[stProcess isDead] whileFalse:[ |
|
318 | 5667 |
stProcess resume. |
466 | 5668 |
'JavaVM: wait for death' infoPrintCR. |
318 | 5669 |
Delay waitForSeconds:0.1 |
255 | 5670 |
]. |
5671 |
stProcess terminate |
|
5672 |
||
5673 |
"Created: / 8.1.1998 / 13:11:17 / cg" |
|
466 | 5674 |
"Modified: / 25.11.1998 / 20:21:19 / cg" |
255 | 5675 |
! |
5676 |
||
5677 |
_Thread_suspend0:nativeContext |
|
5678 |
"yield" |
|
5679 |
||
5680 |
|jThread stProcess| |
|
5681 |
||
5682 |
jThread := nativeContext receiver. |
|
5683 |
stProcess := JavaVM stProcessForJavaThread:jThread. |
|
5684 |
stProcess isNil ifTrue:[ |
|
318 | 5685 |
ThreadTrace == true ifTrue:[ |
5686 |
('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL. |
|
5687 |
]. |
|
5688 |
^ nil "void" |
|
255 | 5689 |
]. |
5690 |
stProcess suspend |
|
5691 |
||
5692 |
"Created: / 8.1.1998 / 01:05:49 / cg" |
|
318 | 5693 |
"Modified: / 6.2.1998 / 02:15:23 / cg" |
255 | 5694 |
! |
5695 |
||
5696 |
_Thread_yield:nativeContext |
|
5697 |
"yield" |
|
5698 |
||
5699 |
|jThread stProcess| |
|
5700 |
||
504 | 5701 |
Processor yield. |
5702 |
"/ jThread := nativeContext receiver. |
|
5703 |
"/ stProcess := JavaVM stProcessForJavaThread:jThread. |
|
5704 |
"/ stProcess isNil ifTrue:[ |
|
5705 |
"/ ThreadTrace == true ifTrue:[ |
|
5706 |
"/ ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL. |
|
5707 |
"/ ]. |
|
5708 |
"/ ^ nil "void" |
|
5709 |
"/ ]. |
|
5710 |
"/ stProcess == Processor activeProcess ifTrue:[ |
|
5711 |
"/ Processor yield. |
|
5712 |
"/ ] ifFalse:[ |
|
5713 |
"/ self halt. |
|
5714 |
"/ ]. |
|
255 | 5715 |
|
5716 |
"Created: / 5.1.1998 / 02:03:51 / cg" |
|
504 | 5717 |
"Modified: / 23.12.1998 / 19:19:17 / cg" |
253 | 5718 |
! |
5719 |
||
5720 |
_Throwable_fillInStackTrace:nativeContext |
|
255 | 5721 |
|exClass exceptionObject list con| |
253 | 5722 |
|
5723 |
exClass := Java classNamed:'java.lang.Throwable'. |
|
5724 |
||
5725 |
exceptionObject := nativeContext receiver. |
|
5726 |
||
5727 |
"/ |
|
5728 |
"/ debugging only |
|
5729 |
"/ |
|
5730 |
(exceptionObject isKindOf:(Java classNamed:'java.lang.Throwable')) ifFalse:[ |
|
347 | 5731 |
self halt |
253 | 5732 |
]. |
5733 |
||
5734 |
con := thisContext sender. |
|
5735 |
||
5736 |
"/ |
|
5737 |
"/ we are not interrested in all intermediate Exception frames ... |
|
5738 |
"/ |
|
5739 |
FullExceptionTrace ifFalse:[ |
|
347 | 5740 |
"/ first, skip any JavaVM contexts |
5741 |
[con receiver == exceptionObject] whileFalse:[ |
|
5742 |
con := con sender |
|
5743 |
]. |
|
5744 |
"/ then, all exception-init contexts |
|
5745 |
[con receiver == exceptionObject] whileTrue:[ |
|
5746 |
con := con sender |
|
5747 |
]. |
|
253 | 5748 |
]. |
5749 |
||
255 | 5750 |
list := OrderedCollection new. |
5751 |
[con notNil] whileTrue:[ |
|
347 | 5752 |
(con isJavaContext) ifTrue:[ |
5753 |
"/ add a copy, in case the context continues with some |
|
5754 |
"/ cleanup ... |
|
5755 |
list add:con shallowCopy |
|
5756 |
]. |
|
5757 |
con := con sender |
|
255 | 5758 |
]. |
5759 |
||
5760 |
exceptionObject instVarNamed:'backtrace' put:(list asArray). |
|
253 | 5761 |
|
5762 |
^ nil. |
|
5763 |
||
5764 |
"Created: / 4.1.1998 / 14:27:40 / cg" |
|
347 | 5765 |
"Modified: / 8.5.1998 / 21:29:53 / cg" |
255 | 5766 |
! |
5767 |
||
5768 |
_Throwable_printStackTrace0:nativeContext |
|
261 | 5769 |
|out outStream exceptionObject contextList| |
255 | 5770 |
|
5771 |
outStream := nativeContext argAt:1. |
|
5772 |
exceptionObject := nativeContext receiver. |
|
5773 |
||
5774 |
contextList := exceptionObject instVarNamed:'backtrace'. |
|
5775 |
||
261 | 5776 |
out := self javaConsoleStream. |
5777 |
out cr. |
|
5778 |
out nextPutLine:'JAVA: stackTrace:'. |
|
255 | 5779 |
|
5780 |
contextList do:[:con | |
|
429 | 5781 |
out |
5782 |
nextPutAll:' '; |
|
5783 |
nextPutAll:(con method javaClass fullName); |
|
5784 |
nextPutAll:'.'; |
|
5785 |
nextPutAll:(con method selector); |
|
5786 |
nextPutAll:' ['; |
|
5787 |
nextPutAll:(con method javaClass sourceFile); |
|
5788 |
nextPutAll:' '; |
|
5789 |
nextPutAll:(con quickLineNumber displayString); |
|
5790 |
nextPutAll:']'. |
|
5791 |
out cr |
|
261 | 5792 |
]. |
5793 |
out nextPutLine:'----------------------------------------------------' |
|
255 | 5794 |
|
5795 |
"Created: / 4.1.1998 / 14:27:40 / cg" |
|
429 | 5796 |
"Modified: / 10.11.1998 / 14:19:32 / cg" |
432 | 5797 |
! |
5798 |
||
5799 |
_Win32Process_create:nativeContext |
|
5800 |
"really create a win32 process" |
|
5801 |
||
5802 |
|env cmd jProcess p inPipe outPipe errorPipe| |
|
5803 |
||
5804 |
jProcess := nativeContext receiver. |
|
5805 |
cmd := nativeContext argAt:1. |
|
5806 |
cmd := Java as_ST_String:cmd. |
|
5807 |
||
5808 |
env := nativeContext argAt:2. |
|
5809 |
env notNil ifTrue:[ |
|
5810 |
self halt |
|
5811 |
]. |
|
5812 |
self halt. |
|
5813 |
||
5814 |
p := Win32Process new. |
|
5815 |
p command:cmd. |
|
5816 |
p environment:env. |
|
5817 |
p inStream:inPipe. |
|
5818 |
p outStream:outPipe. |
|
5819 |
p errorStream:errorPipe. |
|
5820 |
p directory:nil. |
|
5821 |
p startProcess. |
|
5822 |
self halt. |
|
5823 |
||
5824 |
jProcess instVarNamed:'handle' put:p. |
|
5825 |
||
5826 |
"Created: / 10.11.1998 / 19:50:31 / cg" |
|
5827 |
"Modified: / 10.11.1998 / 21:34:18 / cg" |
|
255 | 5828 |
! ! |
5829 |
||
277 | 5830 |
!JavaVM class methodsFor:'native - java.lang - jdk1.2'! |
5831 |
||
5832 |
_AccessController_beginPrivileged:nativeContext |
|
5833 |
"/ introduced with jdk1.2 |
|
5834 |
||
5835 |
"Created: / 27.1.1998 / 18:18:11 / cg" |
|
5836 |
! |
|
5837 |
||
5838 |
_AccessController_endPrivileged:nativeContext |
|
5839 |
"/ introduced with jdk1.2 |
|
5840 |
||
5841 |
"Created: / 27.1.1998 / 18:18:32 / cg" |
|
5842 |
! |
|
5843 |
||
5844 |
_AccessController_getStackAccessControlContext:nativeContext |
|
5845 |
"/ introduced with jdk1.2 |
|
5846 |
||
5847 |
"/ supposed to do more here ... |
|
5848 |
||
5849 |
^ nil |
|
5850 |
||
5851 |
"Created: / 27.1.1998 / 18:22:15 / cg" |
|
5852 |
! |
|
5853 |
||
5854 |
_ClassLoader$NativeLibrary_load:nativeContext |
|
5855 |
"/ introduced with jdk1.2 ... (sigh) |
|
5856 |
||
5857 |
|nativeLoader jLibName libName libHandle index| |
|
5858 |
||
5859 |
nativeLoader := nativeContext receiver. |
|
5860 |
jLibName := nativeContext argAt:1. |
|
5861 |
libName := Java as_ST_String:jLibName. |
|
5862 |
||
5863 |
(index := SimulatedNativeLibs indexOf:libName) ~~ 0 ifTrue:[ |
|
319 | 5864 |
"/ ('JAVA: builtIn nativeLibLoad simulated: ' , libName) printNL. |
277 | 5865 |
nativeLoader instVarNamed:'handle' put:index. |
5866 |
^ self "/ void |
|
5867 |
]. |
|
5868 |
(LoadedNativeLibs notNil |
|
5869 |
and:[LoadedNativeLibs includesKey:libName]) ifTrue:[ |
|
319 | 5870 |
"/ ('JAVA: native library already loaded: ' , libName) printNL. |
277 | 5871 |
nativeLoader instVarNamed:'handle' put:(LoadedNativeLibs at:libName). |
5872 |
^ self "/ void |
|
5873 |
]. |
|
319 | 5874 |
|
5875 |
(self confirm:'permission to load native library: ' , libName , ' ?') ifFalse:[ |
|
5876 |
^ self |
|
5877 |
]. |
|
284 | 5878 |
self halt. |
277 | 5879 |
|
5880 |
libName asFilename exists ifFalse:[ |
|
5881 |
('JAVA: no file to load nativeLib: ' , libName) printNL. |
|
5882 |
^ self "/ void |
|
5883 |
]. |
|
5884 |
||
5885 |
libHandle := ObjectFileLoader loadLibrary:libName. |
|
5886 |
libHandle isNil ifTrue:[ |
|
5887 |
('JAVA: failed to load nativeLib: ' , libName) printNL. |
|
5888 |
^ self "/ void |
|
5889 |
]. |
|
5890 |
||
5891 |
LoadedNativeLibs isNil ifTrue:[ |
|
5892 |
LoadedNativeLibs := Dictionary new. |
|
5893 |
]. |
|
5894 |
||
5895 |
LoadedNativeLibs at:libName put:libHandle. |
|
5896 |
nativeLoader instVarNamed:'handle' put:(LoadedNativeLibs at:libName). |
|
5897 |
^ self "/ void |
|
5898 |
||
5899 |
"Created: / 27.1.1998 / 18:38:37 / cg" |
|
319 | 5900 |
"Modified: / 6.2.1998 / 03:12:17 / cg" |
277 | 5901 |
! |
5902 |
||
5903 |
_ClassLoader_initIDs:nativeContext |
|
5904 |
"/ introduced with jdk1.2 ... (sigh) |
|
5905 |
||
5906 |
"Created: / 27.1.1998 / 18:37:08 / cg" |
|
5907 |
! |
|
5908 |
||
5909 |
_Component_initIDs:nativeContext |
|
5910 |
"/ introduced with jdk1.2 ... (sigh) |
|
5911 |
||
5912 |
"Created: / 27.1.1998 / 19:53:29 / cg" |
|
5913 |
! |
|
5914 |
||
5915 |
_System_getCallerClass:nativeContext |
|
5916 |
"/ introduced with jdk1.2 |
|
5917 |
||
5918 |
|senderContext cls| |
|
5919 |
||
5920 |
senderContext := nativeContext sender. |
|
5921 |
[senderContext receiver == (Java at:'java.lang.System')] whileTrue:[ |
|
5922 |
senderContext := senderContext sender. |
|
5923 |
]. |
|
5924 |
||
5925 |
senderContext method isStatic ifTrue:[ |
|
5926 |
cls := senderContext receiver |
|
5927 |
] ifFalse:[ |
|
5928 |
cls := senderContext receiver class |
|
5929 |
]. |
|
5930 |
cls isJavaClass ifTrue:[ |
|
5931 |
^ self javaClassObjectForClass:cls |
|
5932 |
]. |
|
5933 |
(cls isMemberOf:(Java at:'java.lang.Class')) ifTrue:[ |
|
5934 |
^ Java at:'java.lang.Class' |
|
5935 |
]. |
|
5936 |
self halt. |
|
5937 |
^ nil |
|
5938 |
||
5939 |
"Modified: / 27.1.1998 / 18:33:13 / cg" |
|
5940 |
! |
|
5941 |
||
5942 |
_Toolkit_initIDs:nativeContext |
|
5943 |
"/ introduced with jdk1.2 ... (sigh) |
|
5944 |
||
5945 |
"Created: / 27.1.1998 / 19:53:50 / cg" |
|
5946 |
! ! |
|
5947 |
||
457 | 5948 |
!JavaVM class methodsFor:'native - java.lang - ms'! |
5949 |
||
5950 |
_Runtime_setInputStreamLocalised:nativeContext |
|
5951 |
||
5952 |
"Created: / 18.11.1998 / 00:48:24 / cg" |
|
5953 |
"Modified: / 18.11.1998 / 00:55:01 / cg" |
|
5954 |
! |
|
5955 |
||
5956 |
_Runtime_setOutputStreamLocalised:nativeContext |
|
5957 |
||
5958 |
"Created: / 18.11.1998 / 00:50:15 / cg" |
|
5959 |
"Modified: / 18.11.1998 / 00:55:06 / cg" |
|
5960 |
! |
|
5961 |
||
5962 |
_String_equals:nativeContext |
|
5963 |
|jString1 jString2| |
|
5964 |
||
5965 |
jString1 := nativeContext receiver. |
|
5966 |
jString2 := nativeContext argAt:1. |
|
5967 |
^ (jString1 instVarAt:1) = (jString2 instVarAt:1) |
|
5968 |
||
5969 |
"Created: / 18.11.1998 / 00:52:03 / cg" |
|
5970 |
"Modified: / 18.11.1998 / 00:53:01 / cg" |
|
5971 |
! |
|
5972 |
||
5973 |
_String_length:nativeContext |
|
5974 |
|jString| |
|
5975 |
||
5976 |
jString := nativeContext receiver. |
|
5977 |
^ (jString instVarAt:3) |
|
5978 |
||
5979 |
"Created: / 18.11.1998 / 00:53:50 / cg" |
|
5980 |
"Modified: / 18.11.1998 / 00:54:18 / cg" |
|
5981 |
! ! |
|
5982 |
||
255 | 5983 |
!JavaVM class methodsFor:'native - java.math'! |
5984 |
||
5985 |
_BigInteger_plumbInit:nativeContext |
|
440 | 5986 |
UnimplementedNativeMethodSignal raise |
5987 |
||
5988 |
"Modified: / 12.11.1998 / 19:23:00 / cg" |
|
253 | 5989 |
! ! |
5990 |
||
5991 |
!JavaVM class methodsFor:'native - java.net'! |
|
5992 |
||
440 | 5993 |
_InetAddressImpl_getHostByAddr:nativeContext |
5994 |
"/ java.lang.String getHostByAddr (int) |
|
5995 |
UnimplementedNativeMethodSignal raise |
|
5996 |
||
5997 |
"Created: / 12.11.1998 / 19:08:04 / cg" |
|
5998 |
! |
|
5999 |
||
253 | 6000 |
_InetAddressImpl_getInetFamily:nativeContext |
6001 |
"/ self unimplementedNativeMethod. |
|
6002 |
^ 0 |
|
6003 |
||
6004 |
"Modified: / 15.8.1997 / 17:04:43 / cg" |
|
6005 |
"Created: / 5.1.1998 / 02:05:48 / cg" |
|
6006 |
! |
|
6007 |
||
6008 |
_InetAddressImpl_getLocalHostName:nativeContext |
|
6009 |
"" |
|
6010 |
||
6011 |
|hostName| |
|
6012 |
||
6013 |
hostName := OperatingSystem getHostName. |
|
6014 |
||
6015 |
^ (Java as_String:hostName). |
|
6016 |
||
6017 |
"Modified: / 7.8.1997 / 21:16:55 / cg" |
|
6018 |
"Created: / 5.1.1998 / 02:07:03 / cg" |
|
6019 |
! |
|
6020 |
||
255 | 6021 |
_InetAddressImpl_lookupAllHostAddr:nativeContext |
6022 |
"" |
|
6023 |
||
6024 |
|jAddrImpl jHostName hostName addrBytes| |
|
6025 |
||
6026 |
jAddrImpl := nativeContext receiver. |
|
6027 |
jHostName := nativeContext argAt:1. |
|
6028 |
||
6029 |
hostName := Java as_ST_String:jHostName. |
|
6030 |
addrBytes := Socket ipAddressOfHost:hostName. |
|
6031 |
addrBytes isNil ifTrue:[ |
|
261 | 6032 |
addrBytes := #[0 0 0 0] copy |
255 | 6033 |
]. |
6034 |
^ Array with:addrBytes |
|
6035 |
||
6036 |
"Modified: / 8.8.1997 / 12:04:25 / cg" |
|
6037 |
"Created: / 7.1.1998 / 18:51:31 / cg" |
|
6038 |
! |
|
6039 |
||
253 | 6040 |
_InetAddressImpl_makeAnyLocalAddress:nativeContext |
6041 |
"" |
|
6042 |
||
6043 |
|jAddrImpl jAddr hostName addrBytes address| |
|
6044 |
||
6045 |
jAddrImpl := nativeContext receiver. |
|
6046 |
jAddr := nativeContext argAt:1. |
|
6047 |
||
6048 |
hostName := OperatingSystem getHostName. |
|
6049 |
addrBytes := Socket ipAddressOfHost:hostName. |
|
405 | 6050 |
addrBytes isNil ifTrue:[ |
6051 |
addrBytes := #[127 0 0 0]. |
|
6052 |
]. |
|
253 | 6053 |
"/ MSB first into an integer. |
6054 |
address := (addrBytes at:1). |
|
6055 |
address := (address bitShift:8) bitOr:(addrBytes at:2). |
|
6056 |
address := (address bitShift:8) bitOr:(addrBytes at:3). |
|
6057 |
address := (address bitShift:8) bitOr:(addrBytes at:4). |
|
6058 |
||
6059 |
jAddr instVarNamed:'hostName' put:(Java as_String:hostName). |
|
6060 |
jAddr instVarNamed:'address' put:address. |
|
6061 |
jAddr instVarNamed:'family' put:0. |
|
6062 |
||
6063 |
^ nil |
|
6064 |
||
6065 |
"Created: / 5.1.1998 / 02:06:27 / cg" |
|
405 | 6066 |
"Modified: / 21.10.1998 / 03:30:29 / cg" |
255 | 6067 |
! |
6068 |
||
6069 |
_PlainSocketImpl_initProto:nativeContext |
|
6070 |
||
6071 |
"Created: / 12.1.1998 / 12:56:52 / cg" |
|
271 | 6072 |
! |
6073 |
||
307 | 6074 |
_PlainSocketImpl_socketAccept:nativeContext |
6075 |
|jsock fd newJSock sock newSock fileNo| |
|
6076 |
||
6077 |
jsock := nativeContext receiver. |
|
6078 |
||
6079 |
sock := self validateFile:jsock. |
|
6080 |
sock isNil ifTrue:[ |
|
508 | 6081 |
self throwIOExceptionWithMessage:'nil socket in accept'. |
307 | 6082 |
^ self. |
6083 |
]. |
|
6084 |
||
6085 |
newJSock := nativeContext argAt:1. |
|
6086 |
fd := newJSock instVarNamed:'fd'. |
|
6087 |
(fd instVarNamed:'fd') ~~ 0 ifTrue:[ |
|
6088 |
self halt:'file already open'. |
|
6089 |
self internalError:'file already open'. |
|
508 | 6090 |
self throwIOExceptionWithMessage:'socket already open in socketAccept'. |
307 | 6091 |
^ self. |
6092 |
]. |
|
6093 |
FileIOTrace ifTrue:[ |
|
6094 |
'JAVA: socket accept' infoPrintCR |
|
6095 |
]. |
|
6096 |
newSock := sock accept. |
|
6097 |
newSock isNil ifTrue:[ |
|
508 | 6098 |
self throwIOExceptionWithMessage:'accept failed'. |
307 | 6099 |
]. |
6100 |
fileNo := self addOpenFile:newSock. |
|
6101 |
fd instVarNamed:'fd' put:fileNo. |
|
6102 |
||
6103 |
"Created: / 4.2.1998 / 15:26:49 / cg" |
|
508 | 6104 |
"Modified: / 30.12.1998 / 20:10:01 / cg" |
307 | 6105 |
! |
6106 |
||
6107 |
_PlainSocketImpl_socketAvailable:nativeContext |
|
6108 |
|jSock sock n| |
|
6109 |
||
6110 |
jSock := nativeContext receiver. |
|
6111 |
||
6112 |
sock := self validateFile:jSock. |
|
6113 |
sock isNil ifTrue:[ |
|
508 | 6114 |
self throwIOExceptionWithMessage:'socketAvailable on closed socket'. |
307 | 6115 |
^ self. |
6116 |
]. |
|
6117 |
||
6118 |
n := sock numAvailable. |
|
6119 |
^ n |
|
6120 |
||
6121 |
"Created: / 4.2.1998 / 16:58:49 / cg" |
|
508 | 6122 |
"Modified: / 30.12.1998 / 20:10:08 / cg" |
307 | 6123 |
! |
6124 |
||
6125 |
_PlainSocketImpl_socketBind:nativeContext |
|
6126 |
|jsock jaddr port sock hostName ok err| |
|
6127 |
||
6128 |
jsock := nativeContext receiver. |
|
6129 |
jaddr := nativeContext argAt:1. |
|
6130 |
port := nativeContext argAt:2. |
|
6131 |
||
6132 |
hostName := jaddr instVarNamed:'hostName'. |
|
6133 |
hostName isNil ifTrue:[ |
|
6134 |
self halt. |
|
6135 |
] ifFalse:[ |
|
6136 |
hostName := Java as_ST_String:hostName |
|
6137 |
]. |
|
6138 |
||
6139 |
sock := self validateFile:jsock. |
|
6140 |
sock notNil ifTrue:[ |
|
6141 |
FileIOTrace ifTrue:[ |
|
6142 |
('JAVA: socket bind to ' , hostName printString, ' port ' , port printString) infoPrintCR |
|
6143 |
]. |
|
6144 |
||
6145 |
ok := sock bindTo:port address:nil "hostName". |
|
6146 |
ok ifFalse:[ |
|
6147 |
err := OperatingSystem lastErrorString. |
|
6148 |
Transcript showCR:'sock err: ' , err printString. |
|
508 | 6149 |
self throwIOExceptionWithMessage:'bind failed'. |
307 | 6150 |
] |
6151 |
]. |
|
6152 |
||
6153 |
"Created: / 4.2.1998 / 15:06:20 / cg" |
|
508 | 6154 |
"Modified: / 30.12.1998 / 20:10:16 / cg" |
307 | 6155 |
! |
6156 |
||
271 | 6157 |
_PlainSocketImpl_socketClose:nativeContext |
6158 |
|jsock sock| |
|
6159 |
||
6160 |
jsock := nativeContext receiver. |
|
6161 |
||
6162 |
sock := self validateFile:jsock. |
|
6163 |
sock notNil ifTrue:[ |
|
6164 |
FileIOTrace ifTrue:[ |
|
6165 |
'JAVA: close socket' infoPrintCR |
|
6166 |
]. |
|
6167 |
sock close. |
|
6168 |
]. |
|
6169 |
||
6170 |
"Modified: / 21.8.1997 / 17:09:40 / cg" |
|
6171 |
"Created: / 25.1.1998 / 20:04:24 / cg" |
|
6172 |
! |
|
6173 |
||
6174 |
_PlainSocketImpl_socketConnect:nativeContext |
|
272 | 6175 |
|jsock jaddr port sock addr hostName ok| |
271 | 6176 |
|
6177 |
jsock := nativeContext receiver. |
|
6178 |
jaddr := nativeContext argAt:1. |
|
6179 |
port := nativeContext argAt:2. |
|
6180 |
||
6181 |
hostName := jaddr instVarNamed:'hostName'. |
|
6182 |
hostName notNil ifTrue:[ |
|
6183 |
hostName := Java as_ST_String:hostName |
|
6184 |
] ifFalse:[ |
|
272 | 6185 |
addr := jaddr instVarNamed:'address'. |
6186 |
addr notNil ifTrue:[ |
|
6187 |
hostName := ByteArray new:4. |
|
6188 |
hostName at:4 put:(addr bitAnd:16rFF). |
|
6189 |
addr := addr bitShift:-8. |
|
6190 |
hostName at:3 put:(addr bitAnd:16rFF). |
|
6191 |
addr := addr bitShift:-8. |
|
6192 |
hostName at:2 put:(addr bitAnd:16rFF). |
|
6193 |
addr := addr bitShift:-8. |
|
6194 |
hostName at:1 put:(addr bitAnd:16rFF). |
|
6195 |
]. |
|
271 | 6196 |
]. |
6197 |
hostName isNil ifTrue:[ |
|
6198 |
self halt. |
|
6199 |
]. |
|
6200 |
||
6201 |
sock := self validateFile:jsock. |
|
6202 |
sock notNil ifTrue:[ |
|
6203 |
FileIOTrace ifTrue:[ |
|
6204 |
('JAVA: socket connect to ' , hostName printString , ' port ' , port printString) infoPrintCR |
|
6205 |
]. |
|
390 | 6206 |
SocketConnectConfirmation ifTrue:[ |
495 | 6207 |
(PermittedHostConnects isNil |
6208 |
or:[(PermittedHostConnects includes:hostName) not]) ifTrue:[ |
|
6209 |
(self confirm:'connect to host: ' , hostName printString , ' - ok ?') |
|
6210 |
ifFalse:[ |
|
508 | 6211 |
self throwIOExceptionWithMessage:'connect permission denied'. |
495 | 6212 |
]. |
6213 |
||
6214 |
(self confirm:('JAVA Security check\\Always permit connects to this host (''' , hostName printString , ''') ?') withCRs) |
|
6215 |
ifTrue:[ |
|
6216 |
PermittedHostConnects isNil ifTrue:[ |
|
6217 |
PermittedHostConnects := Set new |
|
6218 |
]. |
|
6219 |
PermittedHostConnects add:hostName. |
|
6220 |
] |
|
6221 |
] |
|
271 | 6222 |
]. |
6223 |
||
6224 |
ok := sock connectTo:hostName port:port. |
|
6225 |
ok ifFalse:[ |
|
508 | 6226 |
self throwIOExceptionWithMessage:'connect failed'. |
271 | 6227 |
] |
6228 |
]. |
|
6229 |
||
6230 |
"Created: / 25.1.1998 / 20:02:27 / cg" |
|
508 | 6231 |
"Modified: / 30.12.1998 / 20:10:28 / cg" |
271 | 6232 |
! |
6233 |
||
6234 |
_PlainSocketImpl_socketCreate:nativeContext |
|
6235 |
|jsock isStream fd sock fileNo| |
|
6236 |
||
6237 |
jsock := nativeContext receiver. |
|
6238 |
isStream := (nativeContext argAt:1) == 1. |
|
6239 |
||
6240 |
fd := jsock instVarNamed:'fd'. |
|
6241 |
(fd instVarNamed:'fd') ~~ 0 ifTrue:[ |
|
6242 |
self halt:'file already open'. |
|
6243 |
self internalError:'file already open'. |
|
508 | 6244 |
self throwIOExceptionWithMessage:'file already open in socketCreate'. |
271 | 6245 |
^ self. |
6246 |
]. |
|
6247 |
||
6248 |
FileOpenTrace ifTrue:[ |
|
6249 |
('JAVA: create socket') infoPrintCR. |
|
6250 |
]. |
|
6251 |
||
6252 |
isStream ifTrue:[ |
|
6253 |
sock := Socket newTCP |
|
6254 |
] ifFalse:[ |
|
6255 |
sock := Socket newUDP |
|
6256 |
]. |
|
6257 |
sock isNil ifTrue:[ |
|
508 | 6258 |
self throwIOExceptionWithMessage:'socketCreate failed'. |
271 | 6259 |
]. |
6260 |
||
6261 |
fileNo := self addOpenFile:sock. |
|
6262 |
fd instVarNamed:'fd' put:fileNo. |
|
6263 |
||
6264 |
"Created: / 25.1.1998 / 19:59:25 / cg" |
|
508 | 6265 |
"Modified: / 30.12.1998 / 20:10:38 / cg" |
272 | 6266 |
! |
6267 |
||
307 | 6268 |
_PlainSocketImpl_socketListen:nativeContext |
6269 |
|jSock time sock ok| |
|
6270 |
||
6271 |
jSock := nativeContext receiver. |
|
6272 |
time := nativeContext argAt:1. |
|
6273 |
||
6274 |
sock := self validateFile:jSock. |
|
6275 |
sock notNil ifTrue:[ |
|
6276 |
FileIOTrace ifTrue:[ |
|
6277 |
('JAVA: socket listen with timeout ' , time printString) infoPrintCR. |
|
6278 |
]. |
|
6279 |
ok := sock listenWithBacklog:5. |
|
6280 |
ok ifFalse:[ |
|
508 | 6281 |
self throwIOExceptionWithMessage:'listen failed'. |
307 | 6282 |
^ self. |
6283 |
]. |
|
6284 |
time ~~ 0 ifTrue:[ |
|
6285 |
sock readWaitWithTimeoutMs:time |
|
6286 |
] |
|
6287 |
]. |
|
6288 |
||
6289 |
"Created: / 4.2.1998 / 15:17:48 / cg" |
|
508 | 6290 |
"Modified: / 30.12.1998 / 20:10:46 / cg" |
307 | 6291 |
! |
6292 |
||
272 | 6293 |
_SocketInputStream_socketRead:nativeContext |
307 | 6294 |
^ self anyStream_readBytes:nativeContext |
272 | 6295 |
|
6296 |
"Created: / 25.1.1998 / 20:56:53 / cg" |
|
307 | 6297 |
"Modified: / 4.2.1998 / 15:52:31 / cg" |
272 | 6298 |
! |
6299 |
||
6300 |
_SocketOutputStream_socketWrite:nativeContext |
|
307 | 6301 |
^ self anyStream_writeBytes:nativeContext |
272 | 6302 |
|
6303 |
"Created: / 25.1.1998 / 21:06:55 / cg" |
|
307 | 6304 |
"Modified: / 4.2.1998 / 15:52:40 / cg" |
253 | 6305 |
! ! |
6306 |
||
457 | 6307 |
!JavaVM class methodsFor:'native - java.net - ms'! |
6308 |
||
6309 |
_ClassLoader_findSystemClass:nativeContext |
|
6310 |
^ self _ClassLoader_findSystemClass0:nativeContext |
|
6311 |
||
6312 |
"Created: / 18.11.1998 / 00:00:14 / cg" |
|
6313 |
! |
|
6314 |
||
6315 |
_InetAddress_getInetFamily:nativeContext |
|
6316 |
"/ self unimplementedNativeMethod. |
|
6317 |
^ 0 |
|
6318 |
||
6319 |
"Modified: / 15.8.1997 / 17:04:43 / cg" |
|
6320 |
"Created: / 17.11.1998 / 23:54:38 / cg" |
|
6321 |
! |
|
6322 |
||
6323 |
_InetAddress_getLocalHostName:nativeContext |
|
6324 |
"" |
|
6325 |
||
6326 |
|hostName| |
|
6327 |
||
6328 |
hostName := OperatingSystem getHostName. |
|
6329 |
||
6330 |
^ (Java as_String:hostName). |
|
6331 |
||
6332 |
"Modified: / 7.8.1997 / 21:16:55 / cg" |
|
6333 |
"Created: / 17.11.1998 / 23:54:54 / cg" |
|
6334 |
! |
|
6335 |
||
6336 |
_InetAddress_lookupAllHostAddr:nativeContext |
|
6337 |
"" |
|
6338 |
||
6339 |
|jAddrImpl jHostName hostName addrBytes| |
|
6340 |
||
6341 |
jAddrImpl := nativeContext receiver. |
|
6342 |
jHostName := nativeContext argAt:1. |
|
6343 |
||
6344 |
hostName := Java as_ST_String:jHostName. |
|
6345 |
addrBytes := Socket ipAddressOfHost:hostName. |
|
6346 |
addrBytes isNil ifTrue:[ |
|
6347 |
addrBytes := #[0 0 0 0] copy |
|
6348 |
]. |
|
6349 |
^ Array with:addrBytes |
|
6350 |
||
6351 |
"Modified: / 8.8.1997 / 12:04:25 / cg" |
|
6352 |
"Created: / 17.11.1998 / 23:56:10 / cg" |
|
6353 |
! |
|
6354 |
||
6355 |
_InetAddress_makeAnyLocalAddress:nativeContext |
|
6356 |
"" |
|
6357 |
||
6358 |
|jAddrImpl jAddr hostName addrBytes address| |
|
6359 |
||
6360 |
jAddrImpl := nativeContext receiver. |
|
6361 |
jAddr := nativeContext argAt:1. |
|
6362 |
||
6363 |
hostName := OperatingSystem getHostName. |
|
6364 |
addrBytes := Socket ipAddressOfHost:hostName. |
|
6365 |
addrBytes isNil ifTrue:[ |
|
6366 |
addrBytes := #[127 0 0 0]. |
|
6367 |
]. |
|
6368 |
"/ MSB first into an integer. |
|
6369 |
address := (addrBytes at:1). |
|
6370 |
address := (address bitShift:8) bitOr:(addrBytes at:2). |
|
6371 |
address := (address bitShift:8) bitOr:(addrBytes at:3). |
|
6372 |
address := (address bitShift:8) bitOr:(addrBytes at:4). |
|
6373 |
||
6374 |
jAddr instVarNamed:'hostName' put:(Java as_String:hostName). |
|
6375 |
jAddr instVarNamed:'address' put:address. |
|
6376 |
jAddr instVarNamed:'family' put:0. |
|
6377 |
||
6378 |
^ nil |
|
6379 |
||
6380 |
"Modified: / 21.10.1998 / 03:30:29 / cg" |
|
6381 |
"Created: / 17.11.1998 / 23:54:00 / cg" |
|
6382 |
! ! |
|
6383 |
||
253 | 6384 |
!JavaVM class methodsFor:'native - java.utils'! |
6385 |
||
6386 |
_ResourceBundle_getClassContext:nativeContext |
|
6387 |
"returns an array filled with the contextChain receivers classes. |
|
6388 |
What an ugly, messy interface." |
|
6389 |
||
6390 |
|chain con cls jClass| |
|
6391 |
||
6392 |
chain := OrderedCollection new. |
|
6393 |
con := thisContext sender. |
|
507 | 6394 |
[con notNil |
6395 |
and:[con receiver isMethod not |
|
6396 |
or:[con receiver isJavaMethod not]]] whileTrue:[ |
|
6397 |
con := con sender. |
|
6398 |
]. |
|
6399 |
con := con sender. |
|
6400 |
||
253 | 6401 |
[con notNil] whileTrue:[ |
507 | 6402 |
(true "con isJavaContext") ifTrue:[ |
347 | 6403 |
cls := con receiver class. |
6404 |
cls isMeta ifTrue:[ |
|
6405 |
"/ t'was a static method |
|
6406 |
cls := cls soleInstance |
|
6407 |
]. |
|
507 | 6408 |
cls isJavaClass ifTrue:[ |
6409 |
jClass := JavaClasses at:cls ifAbsent:nil. |
|
6410 |
jClass isNil ifTrue:[ |
|
6411 |
JavaClasses at:cls put:(jClass := (Java at:'java.lang.Class') new). |
|
6412 |
JavaClasses at:jClass put:cls. |
|
6413 |
]. |
|
6414 |
chain add:jClass. |
|
6415 |
] |
|
347 | 6416 |
]. |
6417 |
con := con sender. |
|
253 | 6418 |
]. |
6419 |
^ chain asArray |
|
6420 |
||
6421 |
"Created: / 5.1.1998 / 02:47:00 / cg" |
|
507 | 6422 |
"Modified: / 24.12.1998 / 00:34:57 / cg" |
253 | 6423 |
! ! |
6424 |
||
304 | 6425 |
!JavaVM class methodsFor:'native - java.utils.zip'! |
6426 |
||
6427 |
_Inflater_init:nativeContext |
|
6428 |
||
6429 |
"Created: / 1.2.1998 / 20:14:01 / cg" |
|
6430 |
! |
|
6431 |
||
6432 |
_Inflater_reset:nativeContext |
|
6433 |
||
6434 |
"Created: / 1.2.1998 / 20:14:13 / cg" |
|
6435 |
! ! |
|
6436 |
||
255 | 6437 |
!JavaVM class methodsFor:'native - netscape'! |
6438 |
||
6439 |
_MozillaAppletContext_pMochaOnLoad:nativeContext |
|
6440 |
|id| |
|
6441 |
||
6442 |
id := nativeContext argAt:1. |
|
318 | 6443 |
"/ 'JAVA: MozillaAppletContext_pMochaOnLoad: ' print. id printNL. |
255 | 6444 |
^ nil |
6445 |
||
6446 |
"Created: / 6.1.1998 / 20:37:13 / cg" |
|
318 | 6447 |
"Modified: / 6.2.1998 / 02:13:09 / cg" |
255 | 6448 |
! |
6449 |
||
325 | 6450 |
_MozillaAppletContext_pShowDocument:nativeContext |
507 | 6451 |
|jAppletContext s1 s2 s3 js| |
6452 |
||
6453 |
jAppletContext := nativeContext receiver. |
|
325 | 6454 |
js := nativeContext argAt:1. |
507 | 6455 |
s1 := Java as_ST_String:js. |
6456 |
js := nativeContext argAt:2. |
|
6457 |
s2 := Java as_ST_String:js. |
|
6458 |
js := nativeContext argAt:3. |
|
6459 |
s2 := Java as_ST_String:js. |
|
325 | 6460 |
|
6461 |
"/ somehow pass it to the html browser .... |
|
507 | 6462 |
Transcript show:'pShowDocument: '; show:s1; show:' / '; |
6463 |
show:s2; show:' / '; showCR:s3. |
|
6464 |
||
325 | 6465 |
^ nil |
6466 |
||
6467 |
"Created: / 29.3.1998 / 15:53:17 / cg" |
|
507 | 6468 |
"Modified: / 29.12.1998 / 13:32:41 / cg" |
325 | 6469 |
! |
6470 |
||
255 | 6471 |
_MozillaAppletContext_pShowStatus:nativeContext |
6472 |
|s js| |
|
6473 |
||
6474 |
js := nativeContext argAt:1. |
|
405 | 6475 |
js isNil ifTrue:[ |
6476 |
s := '' |
|
6477 |
] ifFalse:[ |
|
6478 |
s := Java as_ST_String:js. |
|
6479 |
]. |
|
255 | 6480 |
|
6481 |
self activityNotification:s. |
|
6482 |
"/ Transcript showCR:s. |
|
6483 |
^ nil |
|
6484 |
||
6485 |
"Created: / 6.1.1998 / 18:31:34 / cg" |
|
405 | 6486 |
"Modified: / 22.10.1998 / 01:17:46 / cg" |
255 | 6487 |
! |
6488 |
||
440 | 6489 |
_MozillaAppletContext_setConsoleState0:nativeContext |
6490 |
"/ void setConsoleState0 (int) |
|
6491 |
UnimplementedNativeMethodSignal raise |
|
6492 |
||
6493 |
"Created: / 12.11.1998 / 19:23:22 / cg" |
|
6494 |
! |
|
6495 |
||
6496 |
_URLConnection_close:nativeContext |
|
6497 |
"/ void close () |
|
6498 |
UnimplementedNativeMethodSignal raise |
|
6499 |
||
6500 |
"Created: / 12.11.1998 / 19:26:03 / cg" |
|
6501 |
! |
|
6502 |
||
6503 |
_URLConnection_finalize:nativeContext |
|
6504 |
"/ void finalize () |
|
6505 |
UnimplementedNativeMethodSignal raise |
|
6506 |
||
6507 |
"Created: / 12.11.1998 / 19:25:22 / cg" |
|
6508 |
! |
|
6509 |
||
6510 |
_URLConnection_getContentLength0:nativeContext |
|
6511 |
"/ int getContentLength0 () |
|
6512 |
UnimplementedNativeMethodSignal raise |
|
6513 |
||
6514 |
"Created: / 12.11.1998 / 19:25:34 / cg" |
|
6515 |
! |
|
6516 |
||
6517 |
_URLConnection_getContentType0:nativeContext |
|
6518 |
"/ java.lang.String getContentType0 () |
|
6519 |
UnimplementedNativeMethodSignal raise |
|
6520 |
||
6521 |
"Created: / 12.11.1998 / 19:25:42 / cg" |
|
6522 |
! |
|
6523 |
||
6524 |
_URLConnection_getHeaderField0:nativeContext |
|
6525 |
"/ java.lang.String getHeaderField0 (java.lang.String) |
|
6526 |
UnimplementedNativeMethodSignal raise |
|
6527 |
||
6528 |
"Created: / 12.11.1998 / 19:25:53 / cg" |
|
6529 |
! |
|
6530 |
||
6531 |
_URLConnection_pCreate:nativeContext |
|
6532 |
"/ void pCreate (java.lang.String java.lang.String) |
|
6533 |
UnimplementedNativeMethodSignal raise |
|
6534 |
||
6535 |
"Created: / 12.11.1998 / 19:25:14 / cg" |
|
6536 |
! |
|
6537 |
||
6538 |
_URLInputStream_available:nativeContext |
|
6539 |
"/ int available () |
|
6540 |
UnimplementedNativeMethodSignal raise |
|
6541 |
||
6542 |
"Created: / 12.11.1998 / 19:24:26 / cg" |
|
6543 |
! |
|
6544 |
||
6545 |
_URLInputStream_open:nativeContext |
|
6546 |
"/ void open () |
|
6547 |
UnimplementedNativeMethodSignal raise |
|
6548 |
||
6549 |
"Created: / 12.11.1998 / 19:24:01 / cg" |
|
6550 |
! |
|
6551 |
||
6552 |
_URLInputStream_read:nativeContext |
|
6553 |
"/ int read (byte[] int int) |
|
6554 |
UnimplementedNativeMethodSignal raise |
|
6555 |
||
6556 |
"Created: / 12.11.1998 / 19:24:12 / cg" |
|
6557 |
! |
|
6558 |
||
6559 |
_URLOutputStream_open:nativeContext |
|
6560 |
"/ void open () |
|
6561 |
UnimplementedNativeMethodSignal raise |
|
6562 |
||
6563 |
"Created: / 12.11.1998 / 19:24:38 / cg" |
|
6564 |
! |
|
6565 |
||
6566 |
_URLOutputStream_pClose:nativeContext |
|
6567 |
"/ void pClose () |
|
6568 |
UnimplementedNativeMethodSignal raise |
|
6569 |
||
6570 |
"Created: / 12.11.1998 / 19:25:02 / cg" |
|
6571 |
! |
|
6572 |
||
6573 |
_URLOutputStream_write:nativeContext |
|
6574 |
"/ void write (int) |
|
6575 |
UnimplementedNativeMethodSignal raise |
|
6576 |
||
6577 |
"Created: / 12.11.1998 / 19:24:45 / cg" |
|
6578 |
! |
|
6579 |
||
6580 |
_URLOutputStream_writeBytes:nativeContext |
|
6581 |
"/ void writeBytes (byte[] int int) |
|
6582 |
UnimplementedNativeMethodSignal raise |
|
6583 |
||
6584 |
"Created: / 12.11.1998 / 19:24:55 / cg" |
|
6585 |
! |
|
6586 |
||
255 | 6587 |
_URLStreamHandlerFactory_pInit:nativeContext |
6588 |
"/ self unimplementedNativeMethod. |
|
6589 |
||
6590 |
"Created: / 10.1.1998 / 15:47:24 / cg" |
|
440 | 6591 |
! |
6592 |
||
6593 |
_URLStreamHandlerFactory_pSupportsProtocol:nativeContext |
|
6594 |
"/ boolean pSupportsProtocol (java.lang.String) |
|
6595 |
UnimplementedNativeMethodSignal raise |
|
6596 |
||
6597 |
"Created: / 12.11.1998 / 19:23:43 / cg" |
|
255 | 6598 |
! ! |
6599 |
||
6600 |
!JavaVM class methodsFor:'native - sun.audio'! |
|
6601 |
||
6602 |
_AudioDevice_audioClose:nativeContext |
|
261 | 6603 |
|device fd stream| |
6604 |
||
6605 |
device := nativeContext receiver. |
|
6606 |
device notNil ifTrue:[ |
|
6607 |
fd := device instVarNamed:'dev'. |
|
6608 |
(fd notNil and:[fd > 0]) ifTrue:[ |
|
6609 |
stream := self getOpenFileAt:fd. |
|
6610 |
stream notNil ifTrue:[ |
|
6611 |
stream close. |
|
6612 |
device instVarNamed:'dev' put:0. |
|
6613 |
] |
|
6614 |
] |
|
6615 |
] |
|
255 | 6616 |
|
6617 |
"Created: / 10.1.1998 / 15:45:16 / cg" |
|
261 | 6618 |
"Modified: / 13.1.1998 / 18:08:20 / cg" |
255 | 6619 |
! |
6620 |
||
6621 |
_AudioDevice_audioOpen:nativeContext |
|
261 | 6622 |
|f stream fileNo| |
6623 |
||
6624 |
NoAudio ifTrue:[ |
|
374 | 6625 |
Transcript showCR:'JAVA: audio disabled'. |
6626 |
^ -1 |
|
6627 |
]. |
|
6628 |
||
261 | 6629 |
Stream streamErrorSignal handle:[:ex | |
374 | 6630 |
Stream streamErrorSignal handle:[:ex | |
6631 |
stream := nil. |
|
6632 |
ex return. |
|
6633 |
] do:[ |
|
6634 |
stream := SoundStream writing. |
|
6635 |
]. |
|
261 | 6636 |
] do:[ |
374 | 6637 |
stream := SoundStream writing. |
6638 |
stream notNil ifTrue:[ |
|
6639 |
stream setSampleRate:8000. |
|
6640 |
] |
|
261 | 6641 |
]. |
6642 |
stream isNil ifTrue:[ |
|
374 | 6643 |
"/ ^ -1. |
6644 |
||
6645 |
f := '/dev/audio' asFilename. |
|
6646 |
f exists ifFalse:[ |
|
6647 |
Transcript showCR:'JAVA: neither SoundStream nor /dev/audio available'. |
|
6648 |
^ -1 |
|
6649 |
]. |
|
6650 |
stream := f readWriteStream. |
|
6651 |
stream isNil ifTrue:[ |
|
6652 |
Transcript showCR:'JAVA: /dev/audio exists, but cannot be opened'. |
|
6653 |
^ -1 |
|
6654 |
]. |
|
6655 |
fileNo := self addOpenFile:stream. |
|
6656 |
]. |
|
6657 |
||
261 | 6658 |
fileNo := self addOpenFile:stream. |
6659 |
||
6660 |
FileOpenTrace ifTrue:[ |
|
374 | 6661 |
('JAVA: opened audioDevice as FD ' , fileNo printString) infoPrintCR. |
261 | 6662 |
]. |
6663 |
||
6664 |
^ fileNo |
|
255 | 6665 |
|
6666 |
"Created: / 10.1.1998 / 15:45:30 / cg" |
|
374 | 6667 |
"Modified: / 14.10.1998 / 15:20:52 / cg" |
261 | 6668 |
! |
6669 |
||
6670 |
_AudioDevice_audioWrite:nativeContext |
|
6671 |
|device fd stream bytes count| |
|
6672 |
||
6673 |
device := nativeContext receiver. |
|
6674 |
device notNil ifTrue:[ |
|
6675 |
fd := device instVarNamed:'dev'. |
|
6676 |
(fd notNil and:[fd > 0]) ifTrue:[ |
|
6677 |
stream := self getOpenFileAt:fd. |
|
6678 |
stream notNil ifTrue:[ |
|
6679 |
bytes := nativeContext argAt:1. |
|
6680 |
count := nativeContext argAt:2. |
|
6681 |
stream nextPutBytes:count from:bytes startingAt:1 |
|
6682 |
] |
|
6683 |
] |
|
6684 |
] |
|
6685 |
||
6686 |
"Created: / 10.1.1998 / 15:45:16 / cg" |
|
6687 |
"Modified: / 13.1.1998 / 18:07:20 / cg" |
|
255 | 6688 |
! ! |
6689 |
||
6690 |
!JavaVM class methodsFor:'native - sun.awt'! |
|
6691 |
||
6692 |
_GifImageDecoder_parseImage:nativeContext |
|
261 | 6693 |
|decoder width height bool1 depth subHdrBytes dstBytes i1 i2 colorModel |
6694 |
stream byte compressedData compressedSize index count data |
|
304 | 6695 |
leftOffs topOffs codeLen flags pixelStore clrModel t buffSize |
6696 |
countGot countGot2| |
|
255 | 6697 |
|
6698 |
decoder := nativeContext receiver. |
|
6699 |
||
6700 |
i1 := nativeContext argAt:1. |
|
6701 |
i2 := nativeContext argAt:2. |
|
6702 |
width := nativeContext argAt:3. |
|
6703 |
height := nativeContext argAt:4. |
|
6704 |
bool1 := nativeContext argAt:5. |
|
6705 |
depth := nativeContext argAt:6. |
|
261 | 6706 |
subHdrBytes := nativeContext argAt:7. |
255 | 6707 |
dstBytes := nativeContext argAt:8. |
6708 |
colorModel := nativeContext argAt:9. |
|
6709 |
||
261 | 6710 |
leftOffs := subHdrBytes wordAt:1 MSB:false. |
6711 |
topOffs := subHdrBytes wordAt:3 MSB:false. |
|
6712 |
width := subHdrBytes wordAt:5 MSB:false. |
|
6713 |
height := subHdrBytes wordAt:7 MSB:false. |
|
6714 |
flags := subHdrBytes at:9. |
|
6715 |
codeLen := subHdrBytes at:10. |
|
6716 |
||
6717 |
stream := decoder instVarNamed:'input'. |
|
6718 |
pixelStore := decoder instVarNamed:'store'. |
|
339 | 6719 |
pixelStore isNil ifTrue:[ |
6720 |
^ 0 |
|
6721 |
]. |
|
261 | 6722 |
|
6723 |
buffSize := (width * height // 2) max:4096. |
|
6724 |
compressedData := ByteArray uninitializedNew:buffSize. |
|
6725 |
"get compressed data" |
|
6726 |
index := 1. |
|
304 | 6727 |
count := stream perform:#'read()I'. |
261 | 6728 |
|
6729 |
[count notNil and:[count > 0]] whileTrue:[ |
|
304 | 6730 |
(index + count) > buffSize ifTrue:[ |
6731 |
t := ByteArray uninitializedNew:(buffSize * 2). |
|
6732 |
t replaceFrom:1 to:buffSize with:compressedData startingAt:1. |
|
6733 |
compressedData := t. |
|
6734 |
buffSize := buffSize * 2. |
|
6735 |
]. |
|
6736 |
[count ~~ 0] whileTrue:[ |
|
6737 |
countGot := stream |
|
6738 |
perform:#'read([BII)I' |
|
6739 |
with:compressedData |
|
6740 |
with:index-1 |
|
6741 |
with:count. |
|
6742 |
||
6743 |
countGot > 0 ifTrue:[ |
|
6744 |
count := count - countGot. |
|
6745 |
index := index + countGot. |
|
6746 |
] ifFalse:[ |
|
6747 |
count := -1. |
|
6748 |
] |
|
6749 |
]. |
|
6750 |
||
6751 |
count >= 0 ifTrue:[ |
|
6752 |
count := stream perform:#read. |
|
6753 |
] |
|
261 | 6754 |
]. |
6755 |
compressedSize := index - 1. |
|
6756 |
||
6757 |
data := pixelStore perform:#'allocateLines(I)Ljava/lang/Object;' with:height. |
|
6758 |
(data isMemberOf:ByteArray) ifFalse:[ |
|
304 | 6759 |
self halt. |
6760 |
^ 0. |
|
261 | 6761 |
]. |
6762 |
"/ 'GIFReader: decompressing ...' infoPrintCR. |
|
6763 |
||
6764 |
||
6765 |
GIFReader |
|
304 | 6766 |
decompressGIFFrom:compressedData |
6767 |
count:compressedSize |
|
6768 |
into:data |
|
6769 |
startingAt:1 |
|
6770 |
codeLen:(codeLen + 1). |
|
261 | 6771 |
|
6772 |
clrModel := pixelStore instVarNamed:'colormodel'. |
|
6773 |
||
6774 |
pixelStore |
|
304 | 6775 |
perform:#'setPixels(IIII[BII)Z' |
6776 |
withArguments: |
|
6777 |
(Array |
|
6778 |
with:0 "/ x |
|
6779 |
with:0 "/ y |
|
6780 |
with:width "/ w |
|
6781 |
with:height "/ h |
|
6782 |
with:data |
|
6783 |
with:0 "/ offs |
|
6784 |
with:width). "/ scanSize |
|
261 | 6785 |
|
6786 |
pixelStore perform:#'imageComplete()V'. |
|
6787 |
"/ perform:#'imageComplete(I)V' |
|
6788 |
"/ with:((Java at:'java.awt.image.ImageConsumer') instVarNamed:'STATICIMAGEDONE'). |
|
6789 |
||
255 | 6790 |
"/ self internalError:'breakPoint'. |
6791 |
^ 1 "/ true |
|
6792 |
||
339 | 6793 |
"Modified: / 10.4.1998 / 14:31:59 / cg" |
255 | 6794 |
! |
6795 |
||
6796 |
_ImageRepresentation_disposeImage:nativeContext |
|
262 | 6797 |
|imgRep img| |
255 | 6798 |
|
6799 |
imgRep := nativeContext receiver. |
|
262 | 6800 |
|
6801 |
img := imgRep instVarNamed:'pData'. |
|
6802 |
(img notNil and:[img ~~ 0]) ifTrue:[ |
|
270 | 6803 |
ImageStretchCache notNil ifTrue:[ |
6804 |
ImageStretchCache removeKey:img ifAbsent:nil. |
|
6805 |
] |
|
262 | 6806 |
]. |
6807 |
||
261 | 6808 |
imgRep instVarNamed:'pData' put:0. |
6809 |
"/ self halt. |
|
255 | 6810 |
|
6811 |
"Created: / 7.1.1998 / 22:31:46 / cg" |
|
262 | 6812 |
"Modified: / 17.1.1998 / 13:26:55 / cg" |
255 | 6813 |
! |
6814 |
||
6815 |
_ImageRepresentation_finish:nativeContext |
|
6816 |
|imgRep bool| |
|
6817 |
||
6818 |
imgRep := nativeContext receiver. |
|
6819 |
bool := nativeContext argAt:1. |
|
261 | 6820 |
"/ self halt. |
318 | 6821 |
"/ 'JAVA: ImageRepresentation_finish ignored for now' infoPrintCR. |
255 | 6822 |
|
6823 |
^ 1 "/ true |
|
6824 |
||
6825 |
"Created: / 8.1.1998 / 00:11:40 / cg" |
|
318 | 6826 |
"Modified: / 6.2.1998 / 02:12:54 / cg" |
261 | 6827 |
! |
6828 |
||
6829 |
_ImageRepresentation_imageDraw:nativeContext |
|
6830 |
|imgRep x y img deviceImage jGraphics gc clr| |
|
6831 |
||
6832 |
imgRep := nativeContext receiver. |
|
6833 |
img := imgRep instVarNamed:'pData'. |
|
6834 |
(img isNil or:[img == 0]) ifTrue:[ |
|
466 | 6835 |
"/ self halt. |
6836 |
^ self. |
|
261 | 6837 |
]. |
6838 |
jGraphics := nativeContext argAt:1. |
|
6839 |
gc := jGraphics instVarNamed:'pData'. |
|
6840 |
gc realized ifFalse:[^ self]. |
|
6841 |
||
6842 |
x := nativeContext argAt:2. |
|
6843 |
y := nativeContext argAt:3. |
|
6844 |
clr := nativeContext argAt:4. |
|
6845 |
deviceImage := img onDevice:gc device. |
|
6846 |
deviceImage ~~ img ifTrue:[ |
|
466 | 6847 |
imgRep instVarNamed:'pData' put:deviceImage. |
6848 |
]. |
|
6849 |
gc realized ifFalse:[^ self]. |
|
261 | 6850 |
deviceImage displayOn:gc x:x y:y. |
6851 |
^ 1. |
|
6852 |
||
6853 |
"Created: / 13.1.1998 / 13:32:28 / cg" |
|
466 | 6854 |
"Modified: / 25.11.1998 / 15:36:38 / cg" |
261 | 6855 |
! |
6856 |
||
6857 |
_ImageRepresentation_imageStretch:nativeContext |
|
6858 |
|imgRep x1 y1 x2 y2 srcX1 srcY1 w h |
|
6859 |
img deviceImage jGraphics gc clr stretchWidth stretchHeight| |
|
6860 |
||
6861 |
imgRep := nativeContext receiver. |
|
6862 |
img := imgRep instVarNamed:'pData'. |
|
6863 |
(img isNil or:[img == 0]) ifTrue:[ |
|
270 | 6864 |
"/ self halt. |
6865 |
^ self. |
|
261 | 6866 |
]. |
6867 |
||
6868 |
jGraphics := nativeContext argAt:1. |
|
6869 |
gc := jGraphics instVarNamed:'pData'. |
|
6870 |
gc realized ifFalse:[^ self]. |
|
6871 |
||
6872 |
x1 := nativeContext argAt:2. |
|
6873 |
y1 := nativeContext argAt:3. |
|
6874 |
x2 := nativeContext argAt:4. |
|
6875 |
y2:= nativeContext argAt:5. |
|
6876 |
srcX1 := nativeContext argAt:6. |
|
6877 |
srcY1 := nativeContext argAt:7. |
|
6878 |
w := nativeContext argAt:8. |
|
6879 |
h := nativeContext argAt:9. |
|
6880 |
clr := nativeContext argAt:10. |
|
6881 |
||
6882 |
(srcX1 ~~ 0 or:[srcY1 ~~ 0]) ifTrue:[ |
|
270 | 6883 |
self halt. |
6884 |
^ self. |
|
261 | 6885 |
]. |
6886 |
(w ~~ img width or:[h ~~ img height]) ifTrue:[ |
|
270 | 6887 |
self halt. |
6888 |
^ self |
|
261 | 6889 |
]. |
6890 |
||
6891 |
"/ TODO: remember magnified images somewhere for a while, |
|
6892 |
"/ to avoid repeated action ... |
|
6893 |
||
6894 |
stretchWidth := (x2-x1). |
|
6895 |
stretchHeight := (y2-y1). |
|
6896 |
||
6897 |
(stretchWidth == img width |
|
6898 |
and:[stretchHeight == img height]) ifTrue:[ |
|
270 | 6899 |
deviceImage := img onDevice:gc device. |
6900 |
deviceImage ~~ img ifTrue:[ |
|
6901 |
imgRep instVarNamed:'pData' put:deviceImage. |
|
6902 |
]. |
|
261 | 6903 |
] ifFalse:[ |
270 | 6904 |
ImageStretchCache notNil ifTrue:[ |
6905 |
deviceImage := ImageStretchCache at:img ifAbsent:nil. |
|
6906 |
]. |
|
6907 |
(deviceImage isNil |
|
6908 |
or:[deviceImage width ~~ stretchWidth |
|
6909 |
or:[deviceImage height ~~ stretchHeight]]) ifTrue:[ |
|
6910 |
deviceImage := (img magnifiedTo:stretchWidth@stretchHeight) onDevice:gc device. |
|
6911 |
ImageStretchCache isNil ifTrue:[ |
|
6912 |
ImageStretchCache := WeakIdentityDictionary new. |
|
6913 |
]. |
|
6914 |
ImageStretchCache at:img put:deviceImage |
|
6915 |
]. |
|
261 | 6916 |
]. |
6917 |
deviceImage displayOn:gc x:x1 y:y1 |
|
6918 |
||
6919 |
"Created: / 13.1.1998 / 13:32:28 / cg" |
|
6920 |
"Modified: / 15.1.1998 / 13:14:47 / cg" |
|
255 | 6921 |
! |
6922 |
||
6923 |
_ImageRepresentation_offscreenInit:nativeContext |
|
262 | 6924 |
|imgRep jclr w h form screenDevice| |
255 | 6925 |
|
6926 |
imgRep := nativeContext receiver. |
|
261 | 6927 |
jclr := nativeContext argAt:1. |
262 | 6928 |
|
6929 |
w := imgRep instVarNamed:'width'. |
|
6930 |
h := imgRep instVarNamed:'height'. |
|
6931 |
||
6932 |
screenDevice := Screen current. |
|
6933 |
form := Form width:w height:h depth:(screenDevice depth) on:screenDevice. |
|
6934 |
||
6935 |
imgRep instVarNamed:'pData' put:form. |
|
6936 |
"/ self halt. |
|
255 | 6937 |
|
6938 |
"Created: / 7.1.1998 / 22:31:46 / cg" |
|
262 | 6939 |
"Modified: / 17.1.1998 / 12:36:43 / cg" |
261 | 6940 |
! |
6941 |
||
6942 |
_ImageRepresentation_setBytePixels:nativeContext |
|
318 | 6943 |
|imgRep x y w h clrModel bytes offs i2 |
6944 |
img depth cmap rgbMap opaque transparentColorIndex |
|
6945 |
scanLineWidth nBytes srcIdx dstIdx| |
|
261 | 6946 |
|
6947 |
imgRep := nativeContext receiver. |
|
6948 |
x := nativeContext argAt:1. |
|
6949 |
y := nativeContext argAt:2. |
|
6950 |
w := nativeContext argAt:3. |
|
6951 |
h := nativeContext argAt:4. |
|
6952 |
clrModel := nativeContext argAt:5. |
|
6953 |
bytes := nativeContext argAt:6. |
|
318 | 6954 |
offs := nativeContext argAt:7. "/ offset ?? |
6955 |
scanLineWidth := nativeContext argAt:8. |
|
261 | 6956 |
|
6957 |
depth := clrModel instVarNamed:'pixel_bits'. |
|
6958 |
(clrModel instVarNamed:'map_size') ~~ 0 ifTrue:[ |
|
318 | 6959 |
rgbMap := clrModel instVarNamed:'rgb'. |
6960 |
cmap := Array new:rgbMap size. |
|
6961 |
rgbMap |
|
6962 |
keysAndValuesDo:[:idx :rgb | |
|
6963 |
cmap at:idx put:(Color rgbValue:(rgb bitAnd:16rFFFFFF)) |
|
6964 |
]. |
|
261 | 6965 |
]. |
6966 |
||
6967 |
opaque := (clrModel instVarNamed:'opaque') ~~ 0. |
|
6968 |
opaque ifFalse:[ |
|
318 | 6969 |
transparentColorIndex := clrModel instVarNamed:'transparent_index' |
261 | 6970 |
]. |
6971 |
||
6972 |
img := imgRep instVarNamed:'pData'. |
|
405 | 6973 |
(img isNil or:[img == 0]) ifFalse:[ |
6974 |
"/ self halt |
|
6975 |
]. |
|
6976 |
||
6977 |
(offs ~~ 0 or:[scanLineWidth ~~ w]) ifTrue:[ |
|
6978 |
nBytes := ByteArray new:w*h. |
|
6979 |
srcIdx := offs+1. |
|
6980 |
dstIdx := 1. |
|
6981 |
1 to:h do:[:y | |
|
6982 |
nBytes replaceFrom:dstIdx to:(dstIdx+w-1) with:bytes startingAt:srcIdx. |
|
6983 |
srcIdx := srcIdx + scanLineWidth. |
|
6984 |
dstIdx := dstIdx + w. |
|
318 | 6985 |
]. |
405 | 6986 |
bytes := nBytes. |
6987 |
]. |
|
6988 |
img := Image width:w height:h depth:depth fromArray:bytes. |
|
6989 |
cmap notNil ifTrue:[ |
|
6990 |
img colorMap:cmap. |
|
6991 |
img photometric:#palette |
|
6992 |
]. |
|
6993 |
opaque ifFalse:[ |
|
6994 |
img mask:(ImageReader |
|
6995 |
buildMaskFromColor:transparentColorIndex |
|
6996 |
for:bytes |
|
6997 |
width:w |
|
6998 |
height:h) |
|
6999 |
]. |
|
7000 |
||
7001 |
imgRep instVarNamed:'pData' put:img. |
|
261 | 7002 |
^ 1. |
7003 |
||
7004 |
"Created: / 7.1.1998 / 22:31:46 / cg" |
|
405 | 7005 |
"Modified: / 21.10.1998 / 00:35:45 / cg" |
262 | 7006 |
! |
7007 |
||
297 | 7008 |
_ImageRepresentation_setIntPixels:nativeContext |
318 | 7009 |
|imgRep x y w h clrModel ints offs scanLineWidth |
316 | 7010 |
img depth cmap rgbMap opaque transparentColorIndex |
373 | 7011 |
bytes srcIdx dstIdx val red green blue |
7012 |
redMask greenMask blueMask redShift greenShift blueShift| |
|
297 | 7013 |
|
7014 |
imgRep := nativeContext receiver. |
|
7015 |
x := nativeContext argAt:1. |
|
7016 |
y := nativeContext argAt:2. |
|
7017 |
w := nativeContext argAt:3. |
|
7018 |
h := nativeContext argAt:4. |
|
7019 |
clrModel := nativeContext argAt:5. |
|
7020 |
ints := nativeContext argAt:6. |
|
318 | 7021 |
offs := nativeContext argAt:7. "/ offset ?? |
7022 |
scanLineWidth := nativeContext argAt:8. "/ scanLineWidth ?? |
|
297 | 7023 |
opaque := false. |
373 | 7024 |
offs ~~ 0 ifTrue:[ |
7025 |
self halt |
|
7026 |
]. |
|
297 | 7027 |
|
7028 |
depth := clrModel instVarNamed:'pixel_bits'. |
|
7029 |
clrModel class == (Java at:'java.awt.image.DirectColorModel') ifTrue:[ |
|
7030 |
] ifFalse:[ |
|
7031 |
(clrModel instVarNamed:'map_size') ~~ 0 ifTrue:[ |
|
7032 |
rgbMap := clrModel instVarNamed:'rgb'. |
|
7033 |
cmap := Array new:rgbMap size. |
|
7034 |
rgbMap |
|
7035 |
keysAndValuesDo:[:idx :rgb | |
|
7036 |
cmap at:idx put:(Color rgbValue:(rgb bitAnd:16rFFFFFF)) |
|
7037 |
]. |
|
7038 |
]. |
|
7039 |
opaque := (clrModel instVarNamed:'opaque') ~~ 0. |
|
7040 |
opaque ifFalse:[ |
|
7041 |
transparentColorIndex := clrModel instVarNamed:'transparent_index' |
|
7042 |
]. |
|
7043 |
]. |
|
7044 |
||
7045 |
img := imgRep instVarNamed:'pData'. |
|
405 | 7046 |
(img isNil or:[img == 0]) ifFalse:[ |
7047 |
"/ self halt. |
|
7048 |
]. |
|
7049 |
||
7050 |
depth == 32 ifTrue:[ |
|
7051 |
"/ temporary kludge - ony use 24 bits/pixel |
|
7052 |
bytes := ByteArray new:w*h*3. |
|
7053 |
srcIdx := 1. |
|
7054 |
dstIdx := 1. |
|
7055 |
redMask := clrModel instVarNamed:'red_mask'. |
|
7056 |
greenMask := clrModel instVarNamed:'green_mask'. |
|
7057 |
blueMask := clrModel instVarNamed:'blue_mask'. |
|
7058 |
redShift := (clrModel instVarNamed:'red_offset') negated. |
|
7059 |
greenShift := (clrModel instVarNamed:'green_offset') negated. |
|
7060 |
blueShift := (clrModel instVarNamed:'blue_offset') negated. |
|
7061 |
1 to:h do:[:y | |
|
7062 |
1 to:w do:[:x | |
|
7063 |
val := ints at:srcIdx. |
|
7064 |
red := (val bitAnd:redMask) bitShift:redShift. |
|
7065 |
green := (val bitAnd:greenMask) bitShift:greenShift. |
|
7066 |
blue := (val bitAnd:blueMask) bitShift:blueShift. |
|
7067 |
bytes at:dstIdx put:red. |
|
7068 |
bytes at:dstIdx+1 put:green. |
|
7069 |
bytes at:dstIdx+2 put:blue. |
|
7070 |
dstIdx := dstIdx + 3. |
|
7071 |
srcIdx := srcIdx + 1. |
|
316 | 7072 |
]. |
405 | 7073 |
srcIdx := srcIdx + (scanLineWidth - w). |
316 | 7074 |
]. |
405 | 7075 |
img := Depth24Image width:w height:h depth:24 fromArray:bytes. |
7076 |
] ifFalse:[ |
|
7077 |
scanLineWidth ~~ w ifTrue:[ |
|
7078 |
self halt |
|
297 | 7079 |
]. |
405 | 7080 |
img := Image width:w height:h depth:depth fromArray:ints. |
7081 |
]. |
|
7082 |
cmap notNil ifTrue:[ |
|
7083 |
img colorMap:cmap. |
|
7084 |
img photometric:#palette |
|
297 | 7085 |
] ifFalse:[ |
405 | 7086 |
img photometric:#rgb |
7087 |
]. |
|
7088 |
opaque ifFalse:[ |
|
7089 |
img mask:(ImageReader |
|
7090 |
buildMaskFromColor:transparentColorIndex |
|
7091 |
for:ints |
|
7092 |
width:w |
|
7093 |
height:h) |
|
7094 |
]. |
|
7095 |
||
7096 |
imgRep instVarNamed:'pData' put:img. |
|
297 | 7097 |
^ 1. |
7098 |
||
7099 |
"Created: / 1.2.1998 / 17:38:47 / cg" |
|
405 | 7100 |
"Modified: / 21.10.1998 / 00:35:37 / cg" |
297 | 7101 |
! |
7102 |
||
440 | 7103 |
_JPEGImageDecoder_readImage:nativeContext |
7104 |
UnimplementedNativeMethodSignal raise |
|
7105 |
||
7106 |
"Created: / 12.11.1998 / 18:53:30 / cg" |
|
7107 |
"Modified: / 12.11.1998 / 18:53:40 / cg" |
|
7108 |
! |
|
7109 |
||
262 | 7110 |
_OffScreenImageSource_sendPixels:nativeContext |
7111 |
"/ self halt. |
|
7112 |
||
7113 |
"Modified: / 16.1.1998 / 18:22:23 / cg" |
|
7114 |
"Created: / 17.1.1998 / 12:36:25 / cg" |
|
255 | 7115 |
! ! |
7116 |
||
280 | 7117 |
!JavaVM class methodsFor:'native - sun.awt - jdk1.2'! |
7118 |
||
284 | 7119 |
_ColorModel_initIDs:nativeContext |
7120 |
"/ new with jdk1.2 ... |
|
7121 |
||
7122 |
"Created: / 28.1.1998 / 22:19:23 / cg" |
|
7123 |
! |
|
7124 |
||
7125 |
_FontDescriptor_initIDs:nativeContext |
|
7126 |
"/ new with jdk1.2 ... |
|
7127 |
||
7128 |
"Created: / 28.1.1998 / 22:30:52 / cg" |
|
7129 |
! |
|
7130 |
||
7131 |
_Font_initIDs:nativeContext |
|
7132 |
"/ new with jdk1.2 ... |
|
7133 |
||
7134 |
"Created: / 27.1.1998 / 21:43:25 / cg" |
|
7135 |
! |
|
7136 |
||
7137 |
_PackedColorModel_initIDs:nativeContext |
|
7138 |
"/ new with jdk1.2 ... |
|
7139 |
||
7140 |
"Created: / 28.1.1998 / 22:19:35 / cg" |
|
7141 |
! |
|
7142 |
||
7143 |
_PlatformFont_initIDs:nativeContext |
|
7144 |
"/ new with jdk1.2 ... |
|
7145 |
||
7146 |
"Created: / 28.1.1998 / 22:30:41 / cg" |
|
7147 |
! |
|
7148 |
||
7149 |
_X11GraphicsDevice_getConfigType:nativeContext |
|
7150 |
"/ new with jdk1.2 ... |
|
7151 |
||
7152 |
|configNr cls| |
|
7153 |
||
7154 |
"/ for now, only one config. |
|
7155 |
configNr := nativeContext argAt:1. |
|
7156 |
||
7157 |
cls := Java classNamed:'java.awt.GraphicsDevice'. |
|
7158 |
^ cls instVarNamed:'TYPE_RASTER_SCREEN'. |
|
7159 |
||
7160 |
"Created: / 28.1.1998 / 22:19:05 / cg" |
|
7161 |
! |
|
7162 |
||
7163 |
_X11GraphicsDevice_getNumConfigs:nativeContext |
|
7164 |
"/ new with jdk1.2 ... |
|
7165 |
||
7166 |
^ 1 |
|
7167 |
||
7168 |
"Created: / 28.1.1998 / 22:13:26 / cg" |
|
7169 |
"Modified: / 28.1.1998 / 22:14:33 / cg" |
|
7170 |
! |
|
7171 |
||
7172 |
_X11GraphicsEnvironment_getNumScreens:nativeContext |
|
7173 |
"/ new with jdk1.2 ... |
|
7174 |
||
7175 |
"/ could return the actual number of screens ... |
|
7176 |
||
7177 |
^ 1 |
|
7178 |
||
7179 |
"Created: / 28.1.1998 / 01:50:22 / cg" |
|
7180 |
"Modified: / 28.1.1998 / 22:12:32 / cg" |
|
7181 |
! |
|
7182 |
||
280 | 7183 |
_X11GraphicsEnvironment_initDisplay:nativeContext |
7184 |
"/ new with jdk1.2 ... |
|
7185 |
||
7186 |
"Created: / 28.1.1998 / 01:50:22 / cg" |
|
7187 |
! ! |
|
7188 |
||
284 | 7189 |
!JavaVM class methodsFor:'native - sun.awt.motif - jdk1.2'! |
7190 |
||
7191 |
_InputThread_run:nativeContext |
|
7192 |
self _WToolkit_eventLoop:nativeContext. |
|
7193 |
||
7194 |
"Created: / 28.1.1998 / 22:34:47 / cg" |
|
7195 |
"Modified: / 28.1.1998 / 22:35:16 / cg" |
|
7196 |
! |
|
7197 |
||
7198 |
_MComponentPeer_cacheInit:nativeContext |
|
7199 |
||
7200 |
"Created: / 28.1.1998 / 22:22:30 / cg" |
|
7201 |
! |
|
7202 |
||
457 | 7203 |
_MComponentPeer_pHide:nativeContext |
7204 |
^ self _WComponentPeer_hide:nativeContext |
|
7205 |
||
7206 |
"Created: / 18.11.1998 / 00:15:18 / cg" |
|
7207 |
! |
|
7208 |
||
284 | 7209 |
_MComponentPeer_pInitialize:nativeContext |
7210 |
||
7211 |
"Created: / 28.1.1998 / 22:27:25 / cg" |
|
7212 |
! |
|
7213 |
||
7214 |
_MComponentPeer_setCursor:nativeContext |
|
7215 |
||
7216 |
"Created: / 28.1.1998 / 22:27:35 / cg" |
|
7217 |
! |
|
7218 |
||
7219 |
_MFramePeer_create:nativeContext |
|
7220 |
^ self _WFramePeer_create:nativeContext |
|
7221 |
||
7222 |
"Created: / 28.1.1998 / 22:25:44 / cg" |
|
7223 |
! |
|
7224 |
||
7225 |
_MFramePeer_pHide:nativeContext |
|
7226 |
^ self _WComponentPeer_hide:nativeContext |
|
7227 |
||
7228 |
"Created: / 28.1.1998 / 22:27:04 / cg" |
|
7229 |
! |
|
7230 |
||
7231 |
_MFramePeer_pReshape:nativeContext |
|
7232 |
self commonReshapeComponent:nativeContext |
|
7233 |
||
7234 |
"Created: / 28.1.1998 / 22:28:00 / cg" |
|
7235 |
"Modified: / 28.1.1998 / 22:29:34 / cg" |
|
7236 |
! |
|
7237 |
||
7238 |
_MFramePeer_pSetTitle:nativeContext |
|
7239 |
self _WWindowPeer__setTitle:nativeContext |
|
7240 |
||
7241 |
"Created: / 28.1.1998 / 22:30:23 / cg" |
|
7242 |
! |
|
7243 |
||
7244 |
_MToolkit_init:nativeContext |
|
7245 |
||
7246 |
"Created: / 28.1.1998 / 22:21:54 / cg" |
|
7247 |
! |
|
7248 |
||
7249 |
_MToolkit_run:nativeContext |
|
7250 |
||
7251 |
"Created: / 28.1.1998 / 22:22:10 / cg" |
|
7252 |
! ! |
|
7253 |
||
7254 |
!JavaVM class methodsFor:'native - sun.awt.windows'! |
|
7255 |
||
457 | 7256 |
_MComponentPeer_handleEvent:nativeContext |
7257 |
^ self _WComponentPeer_handleEvent:nativeContext |
|
7258 |
||
7259 |
"Created: / 18.11.1998 / 00:21:17 / cg" |
|
7260 |
! |
|
7261 |
||
7262 |
_MComponentPeer_pShow:nativeContext |
|
7263 |
|view| |
|
7264 |
||
7265 |
view := self viewForWPeer:nativeContext. |
|
7266 |
||
7267 |
"/ frame views are under my browsers own control |
|
7268 |
(view isMemberOf:JavaEmbeddedFrameView) ifFalse:[ |
|
7269 |
view beVisible. |
|
7270 |
view realize. |
|
7271 |
]. |
|
7272 |
||
7273 |
"/ view windowGroup notNil ifTrue:[ |
|
7274 |
"/ windowServer addGroup:(view windowGroup) |
|
7275 |
"/ ]. |
|
7276 |
||
7277 |
^ nil |
|
7278 |
||
7279 |
"/ self halt. |
|
7280 |
||
7281 |
"Modified: / 25.1.1998 / 09:54:07 / cg" |
|
7282 |
"Created: / 18.11.1998 / 00:21:51 / cg" |
|
7283 |
! |
|
7284 |
||
284 | 7285 |
_WButtonPeer_create:nativeContext |
7286 |
|jButtonPeer jButton jFrame frame button |
|
7287 |
lbl| |
|
7288 |
||
7289 |
jButtonPeer := nativeContext receiver. |
|
7290 |
jButton := jButtonPeer instVarNamed:'target'. |
|
7291 |
||
7292 |
jFrame := nativeContext argAt:1. |
|
7293 |
frame := jFrame instVarNamed:'pData'. |
|
7294 |
||
7295 |
button := Button in:frame. |
|
493 | 7296 |
button action:[ |
448 | 7297 |
jButtonPeer perform:#'handleAction()V'. |
493 | 7298 |
]. |
284 | 7299 |
|
7300 |
lbl := jButton instVarNamed:'label'. |
|
7301 |
lbl notNil ifTrue:[ |
|
419 | 7302 |
lbl := Java as_ST_String:lbl. |
7303 |
button label:lbl |
|
284 | 7304 |
]. |
7305 |
self createdWindowsView:button for:jButtonPeer. |
|
7306 |
||
7307 |
WindowCreationTrace == true ifTrue:[ |
|
419 | 7308 |
'WButtonPeer_create: ' print. frame print. ' -> ' print. button printNL. |
284 | 7309 |
]. |
7310 |
||
7311 |
"Created: / 5.1.1998 / 01:53:30 / cg" |
|
493 | 7312 |
"Modified: / 11.12.1998 / 00:19:22 / cg" |
284 | 7313 |
! |
7314 |
||
297 | 7315 |
_WButtonPeer_setLabel:nativeContext |
7316 |
|label jString| |
|
7317 |
||
7318 |
jString := nativeContext argAt:1. |
|
7319 |
||
7320 |
label := self viewForWPeer:nativeContext. |
|
7321 |
label label:(Java as_ST_String:jString) |
|
7322 |
||
7323 |
"Modified: / 8.1.1998 / 17:35:50 / cg" |
|
7324 |
"Created: / 1.2.1998 / 17:05:47 / cg" |
|
7325 |
! |
|
7326 |
||
284 | 7327 |
_WCanvasPeer_create:nativeContext |
7328 |
|jCanvasPeer jFrame frame subView| |
|
7329 |
||
7330 |
jCanvasPeer := nativeContext receiver. |
|
7331 |
||
7332 |
jFrame := nativeContext argAt:1. |
|
7333 |
jFrame isNil ifTrue:[ |
|
7334 |
self halt:'no frame in canvasPeer create'. |
|
7335 |
self internalError:'no frame in canvasPeer create'. |
|
7336 |
^ self. |
|
7337 |
]. |
|
7338 |
frame := jFrame instVarNamed:'pData'. |
|
7339 |
||
7340 |
subView := JavaView in:frame. |
|
7341 |
subView delegate:self. |
|
7342 |
subView javaPeer:jCanvasPeer. |
|
7343 |
||
7344 |
self createdWindowsView:subView for:jCanvasPeer. |
|
7345 |
||
7346 |
WindowCreationTrace == true ifTrue:[ |
|
7347 |
'WCanvasPeer_create: ' print. frame print. ' -> ' print. subView printNL. |
|
7348 |
]. |
|
7349 |
||
7350 |
"Created: / 5.1.1998 / 00:59:19 / cg" |
|
7351 |
"Modified: / 16.1.1998 / 13:40:00 / cg" |
|
7352 |
! |
|
7353 |
||
440 | 7354 |
_WCheckboxMenuItemPeer_setState:nativeContext |
7355 |
"/ void setState (boolean) |
|
482 | 7356 |
"/ UnimplementedNativeMethodSignal raise |
440 | 7357 |
|
7358 |
"Created: / 12.11.1998 / 19:14:35 / cg" |
|
482 | 7359 |
"Modified: / 3.12.1998 / 21:41:13 / cg" |
440 | 7360 |
! |
7361 |
||
284 | 7362 |
_WCheckboxPeer_create:nativeContext |
7363 |
|jCheckboxPeer jCheckbox jFrame frame checkBox lbl| |
|
7364 |
||
7365 |
jCheckboxPeer := nativeContext receiver. |
|
7366 |
jCheckbox := jCheckboxPeer instVarNamed:'target'. |
|
7367 |
||
7368 |
jFrame := nativeContext argAt:1. |
|
7369 |
frame := jFrame instVarNamed:'pData'. |
|
7370 |
||
7371 |
checkBox := CheckBox in:frame. |
|
7372 |
checkBox action:[ |
|
7373 |
jCheckboxPeer |
|
7374 |
perform:#'handleAction(Z)V' |
|
7375 |
with:(checkBox isOn ifTrue:[1] ifFalse:[0]) |
|
7376 |
]. |
|
7377 |
||
7378 |
lbl := jCheckbox instVarNamed:'label'. |
|
7379 |
lbl notNil ifTrue:[ |
|
7380 |
lbl := Java as_ST_String:lbl. |
|
7381 |
checkBox label:lbl |
|
7382 |
]. |
|
7383 |
||
7384 |
self createdWindowsView:checkBox for:jCheckboxPeer. |
|
7385 |
||
7386 |
WindowCreationTrace == true ifTrue:[ |
|
7387 |
'WCheckboxPeer_create: ' print. frame print. ' -> ' print. checkBox printNL. |
|
7388 |
]. |
|
7389 |
||
7390 |
"Created: / 7.1.1998 / 21:48:03 / cg" |
|
7391 |
"Modified: / 15.1.1998 / 12:27:04 / cg" |
|
7392 |
! |
|
7393 |
||
7394 |
_WCheckboxPeer_setCheckboxGroup:nativeContext |
|
7395 |
|checkBox jGroup| |
|
7396 |
||
7397 |
checkBox := self viewForWPeer:nativeContext. |
|
7398 |
||
7399 |
jGroup := nativeContext argAt:1. |
|
7400 |
||
7401 |
"Created: / 7.1.1998 / 21:48:47 / cg" |
|
7402 |
"Modified: / 25.1.1998 / 01:20:42 / cg" |
|
7403 |
! |
|
7404 |
||
440 | 7405 |
_WCheckboxPeer_setLabel:nativeContext |
7406 |
"/ void setLabel (java.lang.String) |
|
7407 |
UnimplementedNativeMethodSignal raise |
|
7408 |
||
7409 |
"Created: / 12.11.1998 / 19:14:53 / cg" |
|
7410 |
! |
|
7411 |
||
284 | 7412 |
_WCheckboxPeer_setState:nativeContext |
7413 |
|checkBox state| |
|
7414 |
||
7415 |
checkBox := self viewForWPeer:nativeContext. |
|
7416 |
||
7417 |
state := nativeContext argAt:1. |
|
7418 |
state ~~ 0 ifTrue:[ |
|
7419 |
checkBox turnOn |
|
7420 |
] ifFalse:[ |
|
7421 |
checkBox turnOff |
|
7422 |
]. |
|
7423 |
||
7424 |
"Created: / 7.1.1998 / 21:49:13 / cg" |
|
7425 |
"Modified: / 25.1.1998 / 01:26:18 / cg" |
|
7426 |
! |
|
7427 |
||
7428 |
_WChoicePeer_addItem:nativeContext |
|
7429 |
|jString index comboBox| |
|
7430 |
||
7431 |
comboBox := self viewForWPeer:nativeContext. |
|
7432 |
||
7433 |
jString := nativeContext argAt:1. |
|
7434 |
index := nativeContext argAt:2. |
|
7435 |
||
7436 |
comboBox model list addLast:(Java as_ST_String:jString). |
|
7437 |
comboBox model changed:#list. |
|
7438 |
||
7439 |
"Created: / 7.1.1998 / 21:45:12 / cg" |
|
7440 |
"Modified: / 24.1.1998 / 18:51:32 / cg" |
|
7441 |
! |
|
7442 |
||
7443 |
_WChoicePeer_create:nativeContext |
|
7444 |
|jChoicePeer jChoice jFrame frame comboBox| |
|
7445 |
||
7446 |
jChoicePeer := nativeContext receiver. |
|
7447 |
jChoice := jChoicePeer instVarNamed:'target'. |
|
7448 |
||
7449 |
jFrame := nativeContext argAt:1. |
|
7450 |
frame := jFrame instVarNamed:'pData'. |
|
7451 |
||
7452 |
comboBox := ComboListView in:frame. |
|
7453 |
comboBox model:(SelectionInList new list:(OrderedCollection new)). |
|
285 | 7454 |
comboBox action:[:index | |
7455 |
jChoicePeer |
|
7456 |
perform:#'handleAction(I)V' |
|
7457 |
with:(comboBox model selectionIndex - 1) |
|
7458 |
]. |
|
284 | 7459 |
|
7460 |
self createdWindowsView:comboBox for:jChoicePeer. |
|
7461 |
||
7462 |
WindowCreationTrace == true ifTrue:[ |
|
7463 |
'WChoicePeer_create: ' print. frame print. ' -> ' print. comboBox printNL. |
|
7464 |
]. |
|
7465 |
||
7466 |
"Created: / 7.1.1998 / 21:44:31 / cg" |
|
285 | 7467 |
"Modified: / 28.1.1998 / 23:19:17 / cg" |
284 | 7468 |
! |
7469 |
||
440 | 7470 |
_WChoicePeer_remove:nativeContext |
7471 |
"/ void remove (int) |
|
7472 |
UnimplementedNativeMethodSignal raise |
|
7473 |
||
7474 |
"Created: / 12.11.1998 / 19:12:20 / cg" |
|
7475 |
! |
|
7476 |
||
284 | 7477 |
_WChoicePeer_reshape:nativeContext |
504 | 7478 |
self commonReshapeComponent:nativeContext. |
7479 |
"/ self pReshape:nativeContext. |
|
284 | 7480 |
^ self. |
7481 |
||
7482 |
"Created: / 7.1.1998 / 21:46:18 / cg" |
|
504 | 7483 |
"Modified: / 23.12.1998 / 19:08:07 / cg" |
284 | 7484 |
! |
7485 |
||
7486 |
_WChoicePeer_select:nativeContext |
|
7487 |
|comboBox index| |
|
7488 |
||
7489 |
comboBox := self viewForWPeer:nativeContext. |
|
7490 |
||
7491 |
index := nativeContext argAt:1. |
|
7492 |
comboBox model selectionIndex:(index + 1). "/ JAVA indexing starts at 0 |
|
7493 |
||
7494 |
"Created: / 7.1.1998 / 21:45:43 / cg" |
|
7495 |
"Modified: / 25.1.1998 / 09:55:05 / cg" |
|
7496 |
! |
|
7497 |
||
440 | 7498 |
_WClipboard_getClipboardText:nativeContext |
7499 |
"/ java.lang.String getClipboardText () |
|
493 | 7500 |
|
7501 |
|str| |
|
7502 |
||
7503 |
str := Screen current rootView getTextSelection. |
|
7504 |
str isNil ifTrue:[ |
|
7505 |
str := ''. |
|
7506 |
]. |
|
7507 |
^ Java as_String:''. |
|
7508 |
||
7509 |
"Modified: / 10.12.1998 / 21:28:29 / cg" |
|
440 | 7510 |
! |
7511 |
||
284 | 7512 |
_WClipboard_init:nativeContext |
7513 |
"/ self halt. |
|
7514 |
||
7515 |
"Modified: / 18.3.1997 / 18:43:18 / cg" |
|
7516 |
"Created: / 4.1.1998 / 19:03:59 / cg" |
|
7517 |
! |
|
7518 |
||
440 | 7519 |
_WClipboard_setClipboardText:nativeContext |
7520 |
"/ void setClipboardText (java.awt.datatransfer.StringSelection) |
|
493 | 7521 |
|
7522 |
|strSel data| |
|
7523 |
||
7524 |
strSel := nativeContext argAt:1. |
|
7525 |
data := strSel instVarNamed:'data'. |
|
7526 |
data class == (Java at:'java.lang.String') ifTrue:[ |
|
7527 |
Screen current rootView setTextSelection:(Java as_ST_String:data) |
|
7528 |
]. |
|
440 | 7529 |
UnimplementedNativeMethodSignal raise |
7530 |
||
7531 |
"Created: / 12.11.1998 / 19:15:31 / cg" |
|
493 | 7532 |
"Modified: / 10.12.1998 / 21:25:20 / cg" |
440 | 7533 |
! |
7534 |
||
284 | 7535 |
_WColor_getDefaultColor:nativeContext |
7536 |
|clrIndex jClr clr | |
|
7537 |
||
7538 |
clrIndex := nativeContext argAt:1. |
|
7539 |
"/ windows defaults: |
|
7540 |
"/ 1: view background |
|
7541 |
||
7542 |
clrIndex == 1 ifTrue:[ |
|
7543 |
clr := View defaultViewBackgroundColor. |
|
7544 |
clr isColor ifFalse:[ |
|
7545 |
clr := Color gray:50. |
|
7546 |
]. |
|
7547 |
]. |
|
7548 |
clrIndex == 2 ifTrue:[ |
|
7549 |
clr := Color black. |
|
7550 |
]. |
|
7551 |
clr isNil ifTrue:[ |
|
7552 |
self halt. |
|
7553 |
self internalError:'breakpoint'. |
|
7554 |
^ nil. |
|
7555 |
]. |
|
7556 |
||
7557 |
clr := clr on:(Screen current). |
|
7558 |
||
7559 |
jClr := (Java classForName:'java.awt.Color') new. |
|
7560 |
||
7561 |
jClr instVarNamed:'pData' put:clr. |
|
7562 |
jClr instVarNamed:'value' put:(clr rgbValue). |
|
7563 |
"/ self halt. |
|
7564 |
^ jClr. |
|
7565 |
||
7566 |
"Created: / 15.8.1997 / 15:38:10 / cg" |
|
7567 |
"Modified: / 4.1.1998 / 18:06:51 / cg" |
|
7568 |
! |
|
7569 |
||
440 | 7570 |
_WComponentPeer__beginValidate:nativeContext |
7571 |
"/ void _beginValidate () |
|
7572 |
UnimplementedNativeMethodSignal raise |
|
7573 |
||
7574 |
"Created: / 12.11.1998 / 19:10:08 / cg" |
|
7575 |
! |
|
7576 |
||
284 | 7577 |
_WComponentPeer__dispose:nativeContext |
7578 |
|view jPeer| |
|
7579 |
||
7580 |
view := self viewForWPeer:nativeContext. |
|
7581 |
||
7582 |
Object errorSignal catch:[ |
|
7583 |
view destroy. |
|
7584 |
]. |
|
7585 |
JavaWindowGroup removeView:view. |
|
7586 |
||
7587 |
jPeer := nativeContext receiver. |
|
7588 |
jPeer instVarNamed:'pData' put:0. |
|
7589 |
||
7590 |
"Created: / 7.1.1998 / 22:36:25 / cg" |
|
7591 |
"Modified: / 25.1.1998 / 16:43:06 / cg" |
|
7592 |
! |
|
7593 |
||
7594 |
_WComponentPeer__setBackground:nativeContext |
|
7595 |
|rgb clr view| |
|
7596 |
||
7597 |
view := self viewForWPeer:nativeContext. |
|
483 | 7598 |
view isNil ifTrue:[^ self]. |
284 | 7599 |
|
7600 |
rgb := nativeContext argAt:1. |
|
7601 |
clr := Color rgbValue:rgb. |
|
7602 |
||
7603 |
"/ self halt. |
|
7604 |
"/ self internalError:'breakPoint'. |
|
7605 |
||
7606 |
clr := clr on:(view device). |
|
7607 |
||
7608 |
"/ (view superView isMemberOf:JavaEmbeddedFrameView) ifTrue:[ |
|
7609 |
"/ view viewBackground:(view superView viewBackground). |
|
7610 |
"/ view backgroundPaint:(view superView viewBackground). |
|
7611 |
"/ ] ifFalse:[ |
|
7612 |
"/ (view isMemberOf:JavaView) ifTrue:[ |
|
7613 |
"/ view viewBackground:clr. |
|
7614 |
"/ view backgroundPaint:clr. |
|
7615 |
"/ ] |
|
7616 |
"/ ]. |
|
7617 |
||
7618 |
(view isKindOf:ScrollableView) ifTrue:[ |
|
483 | 7619 |
view := view scrolledView |
284 | 7620 |
]. |
7621 |
view viewBackground:clr. |
|
7622 |
view backgroundPaint:clr. |
|
7623 |
||
7624 |
"Created: / 4.1.1998 / 18:07:39 / cg" |
|
483 | 7625 |
"Modified: / 4.12.1998 / 17:26:06 / cg" |
284 | 7626 |
! |
7627 |
||
7628 |
_WComponentPeer__setForeground:nativeContext |
|
7629 |
|rgb clr view| |
|
7630 |
||
7631 |
view := self viewForWPeer:nativeContext. |
|
7632 |
||
7633 |
rgb := nativeContext argAt:1. |
|
7634 |
clr := Color rgbValue:rgb. |
|
7635 |
||
7636 |
"/ self halt. |
|
7637 |
"/ self internalError:'breakPoint'. |
|
7638 |
||
7639 |
clr := clr on:(view device). |
|
7640 |
||
7641 |
view paint:clr. |
|
7642 |
||
7643 |
"Created: / 4.1.1998 / 18:08:13 / cg" |
|
7644 |
"Modified: / 8.1.1998 / 17:32:45 / cg" |
|
7645 |
! |
|
7646 |
||
7647 |
_WComponentPeer_disable:nativeContext |
|
7648 |
|view| |
|
7649 |
||
7650 |
view := self viewForWPeer:nativeContext. |
|
7651 |
||
7652 |
Object errorSignal handle:[:ex | |
|
7653 |
] do:[ |
|
7654 |
view disable |
|
7655 |
] |
|
7656 |
||
7657 |
"Created: / 6.1.1998 / 18:26:36 / cg" |
|
7658 |
"Modified: / 8.1.1998 / 17:32:53 / cg" |
|
7659 |
! |
|
7660 |
||
7661 |
_WComponentPeer_enable:nativeContext |
|
7662 |
|view| |
|
7663 |
||
7664 |
view := self viewForWPeer:nativeContext. |
|
7665 |
||
7666 |
Object errorSignal handle:[:ex | |
|
7667 |
] do:[ |
|
7668 |
view enable |
|
7669 |
] |
|
7670 |
||
7671 |
"Modified: / 8.1.1998 / 17:32:53 / cg" |
|
7672 |
"Created: / 13.1.1998 / 23:08:05 / cg" |
|
7673 |
! |
|
7674 |
||
440 | 7675 |
_WComponentPeer_endValidate:nativeContext |
7676 |
"/ void endValidate () |
|
7677 |
UnimplementedNativeMethodSignal raise |
|
7678 |
||
7679 |
"Created: / 12.11.1998 / 19:10:20 / cg" |
|
7680 |
! |
|
7681 |
||
7682 |
_WComponentPeer_getLocationOnScreen:nativeContext |
|
7683 |
"/ java.awt.Point getLocationOnScreen () |
|
480 | 7684 |
|
7685 |
|view p jP| |
|
7686 |
||
7687 |
view := self viewForWPeer:nativeContext. |
|
7688 |
view isNil ifTrue:[^ nil]. |
|
7689 |
||
7690 |
p := view originRelativeTo:nil. |
|
484 | 7691 |
jP := (Java classForName:'java.awt.Point') basicNew. |
480 | 7692 |
jP instVarNamed:'x' put:p x. |
7693 |
jP instVarNamed:'y' put:p y. |
|
7694 |
^ jP |
|
7695 |
||
485 | 7696 |
"Modified: / 5.12.1998 / 14:44:31 / cg" |
440 | 7697 |
! |
7698 |
||
284 | 7699 |
_WComponentPeer_handleEvent:nativeContext |
7700 |
"this is invoked by java, to let a widget handle any event which |
|
7701 |
was not consumed (eaten) by java. |
|
7702 |
If the view in question is some ST-widget, forward it. |
|
7703 |
Ignore for JavaViews." |
|
7704 |
||
493 | 7705 |
|view jEv stEv ignore| |
284 | 7706 |
|
7707 |
view := self viewForWPeer:nativeContext. |
|
7708 |
view notNil ifTrue:[ |
|
474 | 7709 |
jEv := nativeContext argAt:1. |
7710 |
stEv := jEv instVarNamed:'data'. |
|
7711 |
(stEv notNil and:[stEv ~~ 0]) ifTrue:[ |
|
493 | 7712 |
ignore := true. |
483 | 7713 |
view isJavaView ifFalse:[ |
493 | 7714 |
ignore := false |
7715 |
] ifTrue:[ |
|
7716 |
view isTopView ifTrue:[ |
|
7717 |
stEv type == #terminate ifTrue:[ |
|
7718 |
ignore := false |
|
7719 |
]. |
|
7720 |
] |
|
7721 |
]. |
|
7722 |
||
7723 |
ignore ifFalse:[ |
|
316 | 7724 |
EventTrace == true ifTrue:[ |
7725 |
('JAVA: WComponent - handleEvent: ' , stEv type , ' for ' , view printString) infoPrintCR. |
|
7726 |
]. |
|
474 | 7727 |
view dispatchEvent:stEv. |
316 | 7728 |
^ self. |
493 | 7729 |
]. |
7730 |
||
7731 |
EventTrace == true ifTrue:[ |
|
7732 |
('JAVA: WComponent - handleEvent ignored:' , stEv type) infoPrintCR. |
|
7733 |
]. |
|
7734 |
^ self |
|
316 | 7735 |
] |
7736 |
]. |
|
7737 |
EventTrace == true ifTrue:[ |
|
7738 |
('JAVA: WComponent - handleEvent ignored') infoPrintCR. |
|
7739 |
] |
|
284 | 7740 |
|
7741 |
"Created: / 6.1.1998 / 21:10:17 / cg" |
|
493 | 7742 |
"Modified: / 11.12.1998 / 01:04:14 / cg" |
284 | 7743 |
! |
7744 |
||
7745 |
_WComponentPeer_hide:nativeContext |
|
7746 |
|view| |
|
7747 |
||
7748 |
view := self viewForWPeer:nativeContext. |
|
483 | 7749 |
"/ view isPopUpView ifTrue:[self halt]. |
284 | 7750 |
|
7751 |
Object errorSignal handle:[:ex | |
|
7752 |
] do:[ |
|
483 | 7753 |
view beInvisible |
284 | 7754 |
] |
7755 |
||
7756 |
"Created: / 7.1.1998 / 22:35:32 / cg" |
|
483 | 7757 |
"Modified: / 4.12.1998 / 17:53:41 / cg" |
284 | 7758 |
! |
7759 |
||
391 | 7760 |
_WComponentPeer_nativeHandleEvent:nativeContext |
7761 |
"this is invoked by java, to let a widget handle any event which |
|
7762 |
was not consumed (eaten) by java. |
|
7763 |
If the view in question is some ST-widget, forward it. |
|
7764 |
Ignore for JavaViews." |
|
7765 |
||
7766 |
|view jEv stEv| |
|
7767 |
||
7768 |
^self. |
|
7769 |
view := self viewForWPeer:nativeContext. |
|
7770 |
view notNil ifTrue:[ |
|
7771 |
(view isKindOf:JavaView) ifFalse:[ |
|
7772 |
jEv := nativeContext argAt:1. |
|
7773 |
stEv := jEv instVarNamed:'data'. |
|
7774 |
(stEv notNil and:[stEv ~~ 0]) ifTrue:[ |
|
7775 |
EventTrace == true ifTrue:[ |
|
7776 |
('JAVA: WComponent - handleEvent: ' , stEv type , ' for ' , view printString) infoPrintCR. |
|
7777 |
]. |
|
7778 |
stEv sendEventWithFocusOn:nil. |
|
7779 |
^ self. |
|
7780 |
] |
|
7781 |
] |
|
7782 |
]. |
|
7783 |
EventTrace == true ifTrue:[ |
|
7784 |
('JAVA: WComponent - handleEvent ignored') infoPrintCR. |
|
7785 |
] |
|
7786 |
||
7787 |
"Created: / 19.10.1998 / 21:26:16 / cg" |
|
7788 |
"Modified: / 19.10.1998 / 23:26:37 / cg" |
|
7789 |
! |
|
7790 |
||
284 | 7791 |
_WComponentPeer_requestFocus:nativeContext |
7792 |
|view| |
|
7793 |
||
7794 |
view := self viewForWPeer:nativeContext. |
|
318 | 7795 |
"/ 'getFocus - ' print. view displayString printCR. |
284 | 7796 |
|
483 | 7797 |
"/ view getKeyboardFocus |
284 | 7798 |
|
7799 |
"Created: / 7.1.1998 / 22:30:03 / cg" |
|
483 | 7800 |
"Modified: / 4.12.1998 / 19:42:18 / cg" |
284 | 7801 |
! |
7802 |
||
7803 |
_WComponentPeer_reshape:nativeContext |
|
7804 |
self commonReshapeComponent:nativeContext |
|
7805 |
||
7806 |
"Modified: / 18.3.1997 / 19:30:21 / cg" |
|
7807 |
"Created: / 4.1.1998 / 18:01:11 / cg" |
|
7808 |
! |
|
7809 |
||
7810 |
_WComponentPeer_setCursor:nativeContext |
|
7811 |
|view| |
|
7812 |
||
7813 |
view := self viewForWPeer:nativeContext. |
|
7814 |
"/ self halt. |
|
7815 |
||
7816 |
"Created: / 5.1.1998 / 01:52:30 / cg" |
|
7817 |
"Modified: / 25.1.1998 / 01:21:52 / cg" |
|
7818 |
! |
|
7819 |
||
7820 |
_WComponentPeer_setFont:nativeContext |
|
7821 |
|view| |
|
7822 |
||
7823 |
view := self viewForWPeer:nativeContext. |
|
7824 |
"/ self halt. |
|
7825 |
||
7826 |
"Created: / 5.1.1998 / 00:55:17 / cg" |
|
7827 |
"Modified: / 25.1.1998 / 01:22:19 / cg" |
|
7828 |
! |
|
7829 |
||
7830 |
_WComponentPeer_setZOrderPosition:nativeContext |
|
7831 |
|view| |
|
7832 |
||
7833 |
view := self viewForWPeer:nativeContext. |
|
7834 |
"/ self unimplementedNativeMethod. |
|
7835 |
"/ self halt. |
|
7836 |
"/ self internalError:'breakPoint' |
|
7837 |
||
7838 |
"Created: / 4.1.1998 / 17:59:26 / cg" |
|
7839 |
"Modified: / 25.1.1998 / 01:22:32 / cg" |
|
7840 |
! |
|
7841 |
||
7842 |
_WComponentPeer_show:nativeContext |
|
7843 |
|view| |
|
7844 |
||
7845 |
view := self viewForWPeer:nativeContext. |
|
7846 |
||
7847 |
"/ frame views are under my browsers own control |
|
7848 |
(view isMemberOf:JavaEmbeddedFrameView) ifFalse:[ |
|
7849 |
view beVisible. |
|
7850 |
view realize. |
|
7851 |
]. |
|
7852 |
||
7853 |
"/ view windowGroup notNil ifTrue:[ |
|
7854 |
"/ windowServer addGroup:(view windowGroup) |
|
7855 |
"/ ]. |
|
7856 |
||
7857 |
^ nil |
|
7858 |
||
7859 |
"/ self halt. |
|
7860 |
||
7861 |
"Created: / 5.1.1998 / 01:26:22 / cg" |
|
483 | 7862 |
"Modified: / 4.12.1998 / 17:43:53 / cg" |
284 | 7863 |
! |
7864 |
||
7865 |
_WComponentPeer_start:nativeContext |
|
7866 |
"/ self halt. |
|
7867 |
||
7868 |
"Modified: / 18.3.1997 / 18:43:18 / cg" |
|
7869 |
"Created: / 5.1.1998 / 00:58:40 / cg" |
|
7870 |
! |
|
7871 |
||
7872 |
_WDefaultFontCharset_canConvert:nativeContext |
|
7873 |
^ 1 |
|
7874 |
||
7875 |
"Modified: / 21.8.1997 / 15:56:57 / cg" |
|
7876 |
"Created: / 5.1.1998 / 01:55:47 / cg" |
|
7877 |
! |
|
7878 |
||
7879 |
_WDialogPeer__hide:nativeContext |
|
7880 |
|dialog| |
|
7881 |
||
7882 |
dialog := self viewForWPeer:nativeContext. |
|
7883 |
||
7884 |
dialog hide. |
|
7885 |
||
7886 |
"Created: / 7.1.1998 / 22:34:10 / cg" |
|
7887 |
"Modified: / 8.1.1998 / 17:34:10 / cg" |
|
7888 |
! |
|
7889 |
||
7890 |
_WDialogPeer__show:nativeContext |
|
7891 |
|dialog| |
|
7892 |
||
7893 |
dialog := self viewForWPeer:nativeContext. |
|
7894 |
"/ |
|
7895 |
"/ show does not work (yet); must setup windowgroup |
|
7896 |
"/ for it to get events ... |
|
480 | 7897 |
"/ dialog realize. |
7898 |
||
7899 |
dialog show. |
|
495 | 7900 |
"/dialog fixSize. |
7901 |
"/dialog makeFullyVisible. |
|
7902 |
"/dialog openModal:[true] inGroup:JavaWindowGroup |
|
284 | 7903 |
|
7904 |
"Created: / 7.1.1998 / 21:52:15 / cg" |
|
495 | 7905 |
"Modified: / 11.12.1998 / 14:43:05 / cg" |
284 | 7906 |
! |
7907 |
||
7908 |
_WDialogPeer_create:nativeContext |
|
7909 |
|jDialogPeer dialog| |
|
7910 |
||
7911 |
jDialogPeer := nativeContext receiver. |
|
7912 |
||
7913 |
dialog := ModalBox new. |
|
7914 |
jDialogPeer instVarNamed:'pData' put:dialog. |
|
7915 |
||
7916 |
self createdWindowsView:dialog for:jDialogPeer. |
|
7917 |
dialog windowGroup:JavaWindowGroup. |
|
7918 |
JavaWindowGroup addTopView:dialog. |
|
7919 |
||
7920 |
WindowCreationTrace == true ifTrue:[ |
|
7921 |
'WDialogPeer_create: ' print. dialog printNL. |
|
7922 |
]. |
|
7923 |
||
7924 |
"Created: / 7.1.1998 / 21:51:00 / cg" |
|
7925 |
"Modified: / 15.1.1998 / 16:12:44 / cg" |
|
7926 |
! |
|
7927 |
||
440 | 7928 |
_WDrawingSurfaceInfo_getDepth:nativeContext |
7929 |
"/ int getDepth () |
|
7930 |
UnimplementedNativeMethodSignal raise |
|
7931 |
||
7932 |
"Created: / 12.11.1998 / 19:21:00 / cg" |
|
7933 |
! |
|
7934 |
||
7935 |
_WDrawingSurfaceInfo_getHBitmap:nativeContext |
|
7936 |
"/ int getHBitmap () |
|
7937 |
UnimplementedNativeMethodSignal raise |
|
7938 |
||
7939 |
"Created: / 12.11.1998 / 19:20:32 / cg" |
|
7940 |
! |
|
7941 |
||
7942 |
_WDrawingSurfaceInfo_getHDC:nativeContext |
|
7943 |
"/ int getHDC () |
|
7944 |
UnimplementedNativeMethodSignal raise |
|
7945 |
||
7946 |
"Created: / 12.11.1998 / 19:20:50 / cg" |
|
7947 |
! |
|
7948 |
||
7949 |
_WDrawingSurfaceInfo_getHPalette:nativeContext |
|
7950 |
"/ int getHPalette () |
|
7951 |
UnimplementedNativeMethodSignal raise |
|
7952 |
||
7953 |
"Created: / 12.11.1998 / 19:21:07 / cg" |
|
7954 |
! |
|
7955 |
||
7956 |
_WDrawingSurfaceInfo_getHWnd:nativeContext |
|
7957 |
"/ int getHWnd () |
|
7958 |
UnimplementedNativeMethodSignal raise |
|
7959 |
||
7960 |
"Created: / 12.11.1998 / 19:20:23 / cg" |
|
7961 |
! |
|
7962 |
||
7963 |
_WDrawingSurfaceInfo_getPBits:nativeContext |
|
7964 |
"/ int getPBits () |
|
7965 |
UnimplementedNativeMethodSignal raise |
|
7966 |
||
7967 |
"Created: / 12.11.1998 / 19:20:41 / cg" |
|
7968 |
! |
|
7969 |
||
7970 |
_WDrawingSurfaceInfo_lock:nativeContext |
|
7971 |
"/ int lock () |
|
7972 |
UnimplementedNativeMethodSignal raise |
|
7973 |
||
7974 |
"Created: / 12.11.1998 / 19:20:00 / cg" |
|
7975 |
! |
|
7976 |
||
7977 |
_WDrawingSurfaceInfo_unlock:nativeContext |
|
7978 |
"/ void unlock () |
|
7979 |
UnimplementedNativeMethodSignal raise |
|
7980 |
||
7981 |
"Created: / 12.11.1998 / 19:20:13 / cg" |
|
7982 |
! |
|
7983 |
||
7984 |
_WEmbeddedFramePeer_create:nativeContext |
|
7985 |
"/ void create (sun.awt.windows.WComponentPeer) |
|
7986 |
UnimplementedNativeMethodSignal raise |
|
7987 |
||
7988 |
"Created: / 12.11.1998 / 19:16:09 / cg" |
|
7989 |
! |
|
7990 |
||
284 | 7991 |
_WFileDialogPeer_show:nativeContext |
7992 |
|jDialogPeer jDialog dialogView stDialog |
|
7993 |
title dir pattern f| |
|
7994 |
||
7995 |
jDialogPeer := nativeContext receiver. |
|
7996 |
jDialog := jDialogPeer instVarNamed:'target'. |
|
7997 |
dialogView := jDialogPeer instVarNamed:'pData'. |
|
7998 |
||
7999 |
stDialog := FileSelectionBox new. |
|
8000 |
||
8001 |
dir := jDialog instVarNamed:'dir'. |
|
8002 |
dir notNil ifTrue:[ |
|
8003 |
stDialog directory:(Java as_ST_String:dir). |
|
8004 |
]. |
|
8005 |
pattern := jDialog instVarNamed:'file'. |
|
8006 |
pattern notNil ifTrue:[ |
|
8007 |
stDialog pattern:(Java as_ST_String:pattern). |
|
8008 |
]. |
|
8009 |
title := jDialog instVarNamed:'title'. |
|
8010 |
title notNil ifTrue:[ |
|
8011 |
stDialog title:(Java as_ST_String:title). |
|
8012 |
stDialog label:(Java as_ST_String:title). |
|
8013 |
]. |
|
8014 |
||
8015 |
stDialog show. |
|
8016 |
||
8017 |
stDialog accepted ifTrue:[ |
|
8018 |
f := stDialog pathName. |
|
8019 |
||
8020 |
"/ cannot use the one below - it has a builtIn fileSeparator if '\' (sigh) |
|
8021 |
"/ jDialogPeer perform:#'handleSelected(Ljava/lang/String;)V' with:(Java as_String:f). |
|
8022 |
||
8023 |
jDialog |
|
8024 |
perform:#'setFile(Ljava/lang/String;)V' |
|
8025 |
with:(Java as_String:(f asFilename baseName)). |
|
8026 |
jDialog |
|
8027 |
perform:#'setDirectory(Ljava/lang/String;)V' |
|
8028 |
with:(Java as_String:(f asFilename directoryName , Filename separator asString)). |
|
8029 |
jDialog |
|
8030 |
perform:#'setVisible(Z)V' |
|
8031 |
with:0. |
|
8032 |
] ifFalse:[ |
|
8033 |
jDialogPeer |
|
8034 |
perform:#'handleCancel()V' |
|
8035 |
]. |
|
8036 |
"/ self halt. |
|
8037 |
||
8038 |
"Created: / 7.1.1998 / 22:38:45 / cg" |
|
8039 |
"Modified: / 15.1.1998 / 13:04:05 / cg" |
|
8040 |
! |
|
8041 |
||
440 | 8042 |
_WFontMetrics_bytesWidth:nativeContext |
8043 |
"/ int bytesWidth (byte[] int int) |
|
8044 |
UnimplementedNativeMethodSignal raise |
|
8045 |
||
8046 |
"Created: / 12.11.1998 / 19:11:46 / cg" |
|
8047 |
! |
|
8048 |
||
284 | 8049 |
_WFontMetrics_getMFCharSegmentWidth:nativeContext |
8050 |
"get multi-font string-segment width. |
|
8051 |
Not yet supported - use standard strings width" |
|
8052 |
||
8053 |
|jMetrics jFont jFontDescr stFont w |
|
8054 |
bool1 cp offs lenght bp int1| |
|
8055 |
||
8056 |
jMetrics := nativeContext receiver. |
|
8057 |
jFont := nativeContext argAt:1. |
|
8058 |
jFontDescr := nativeContext argAt:2. |
|
8059 |
bool1 := nativeContext argAt:3. |
|
8060 |
cp := nativeContext argAt:4. |
|
8061 |
offs := nativeContext argAt:5. |
|
8062 |
lenght := nativeContext argAt:6. |
|
8063 |
bp := nativeContext argAt:7. |
|
8064 |
int1 := nativeContext argAt:8. |
|
8065 |
||
8066 |
stFont := jFont instVarNamed:'pData'. |
|
8067 |
(stFont isNil or:[stFont == 0]) ifTrue:[ |
|
8068 |
self halt |
|
8069 |
]. |
|
8070 |
||
8071 |
stFont device isNil ifTrue:[ |
|
8072 |
stFont := stFont on:Display. |
|
8073 |
jFont instVarNamed:'pData' put:stFont. |
|
8074 |
]. |
|
8075 |
w := stFont widthOf:cp from:offs+1 to:offs+lenght. |
|
8076 |
^ w. |
|
8077 |
||
8078 |
"Created: / 5.1.1998 / 01:57:45 / cg" |
|
8079 |
"Modified: / 13.1.1998 / 23:44:03 / cg" |
|
8080 |
! |
|
8081 |
||
8082 |
_WFontMetrics_init:nativeContext |
|
8083 |
|jMetrics jFont stFont widths family name style size| |
|
8084 |
||
8085 |
jMetrics := nativeContext receiver. |
|
8086 |
jFont := jMetrics instVarNamed:'font'. |
|
8087 |
||
8088 |
family := jFont instVarNamed:'family'. |
|
8089 |
family := Java as_ST_String:family. |
|
8090 |
||
8091 |
name := jFont instVarNamed:'name'. |
|
8092 |
name := Java as_ST_String:name. |
|
8093 |
||
8094 |
style := jFont instVarNamed:'style'. |
|
8095 |
size := jFont instVarNamed:'size'. |
|
8096 |
||
8097 |
stFont := Font family:family size:size. |
|
8098 |
stFont isNil ifTrue:[ |
|
8099 |
stFont := Font family:'helvetica' size:size. |
|
8100 |
]. |
|
8101 |
stFont := stFont on:Display. |
|
8102 |
||
8103 |
"/ stFont := jFont instVarNamed:'pData'. |
|
8104 |
"/ stFont isNil ifTrue:[ |
|
8105 |
"/ self halt |
|
8106 |
"/ ]. |
|
8107 |
||
8108 |
stFont := stFont on:Display. |
|
8109 |
jFont instVarNamed:'pData' put:stFont. |
|
8110 |
||
8111 |
jMetrics instVarNamed:'ascent' put:stFont ascent. |
|
8112 |
jMetrics instVarNamed:'descent' put:stFont descent. |
|
8113 |
jMetrics instVarNamed:'leading' put:0. |
|
8114 |
jMetrics instVarNamed:'height' put:stFont height. |
|
8115 |
jMetrics instVarNamed:'maxAscent' put:stFont maxAscent. |
|
8116 |
jMetrics instVarNamed:'maxDescent' put:stFont maxDescent. |
|
8117 |
jMetrics instVarNamed:'maxHeight' put:stFont maxHeight. |
|
8118 |
jMetrics instVarNamed:'maxAdvance' put:stFont maxWidth. |
|
8119 |
||
8120 |
widths := Array new:256. |
|
8121 |
0 to:255 do:[:i | |
|
8122 |
widths at:(i+1) put:(stFont widthOf:(Character value:i)) |
|
8123 |
]. |
|
8124 |
jMetrics instVarNamed:'widths' put:widths. |
|
8125 |
"/ self halt. |
|
8126 |
||
8127 |
"Modified: / 8.8.1997 / 12:06:53 / cg" |
|
8128 |
"Created: / 5.1.1998 / 01:54:29 / cg" |
|
8129 |
! |
|
8130 |
||
8131 |
_WFontMetrics_needsConversion:nativeContext |
|
8132 |
|jFont jFontDescr stFont| |
|
8133 |
||
8134 |
jFont := nativeContext argAt:1. |
|
8135 |
jFontDescr := nativeContext argAt:2. |
|
8136 |
||
8137 |
stFont := jFont instVarNamed:'pData'. |
|
8138 |
"/ stFont isNil ifTrue:[ |
|
8139 |
"/ self halt |
|
8140 |
"/ ]. |
|
8141 |
"/ stFont device isNil ifTrue:[ |
|
8142 |
"/ stFont := stFont on:Display. |
|
8143 |
"/ jFont instVarNamed:'pData' put:stFont. |
|
8144 |
"/ ]. |
|
8145 |
"/ |
|
8146 |
||
8147 |
^ 0 |
|
8148 |
||
8149 |
"Modified: / 17.8.1997 / 17:16:29 / cg" |
|
8150 |
"Created: / 5.1.1998 / 01:56:42 / cg" |
|
8151 |
! |
|
8152 |
||
341 | 8153 |
_WFramePeer__setIconImage:nativeContext |
8154 |
|frame imgRep image| |
|
8155 |
||
8156 |
frame := self viewForWPeer:nativeContext. |
|
8157 |
imgRep := nativeContext argAt:1. |
|
8158 |
imgRep notNil ifTrue:[ |
|
8159 |
image := imgRep instVarNamed:'pData'. |
|
8160 |
image notNil ifTrue:[ |
|
8161 |
frame icon:image. |
|
8162 |
] |
|
8163 |
]. |
|
8164 |
||
8165 |
"Created: / 27.4.1998 / 17:15:09 / cg" |
|
8166 |
"Modified: / 27.4.1998 / 17:18:24 / cg" |
|
8167 |
! |
|
8168 |
||
284 | 8169 |
_WFramePeer_create:nativeContext |
474 | 8170 |
|jFramePeer jFrame top frame pDataIdx| |
284 | 8171 |
|
8172 |
jFramePeer := nativeContext receiver. |
|
8173 |
||
8174 |
"/ for now: a kludge to create an embedded frame for |
|
8175 |
"/ mozillaFrames |
|
8176 |
||
8177 |
jFrame := jFramePeer instVarNamed:'target'. |
|
8178 |
(jFrame notNil |
|
8179 |
and:[(pDataIdx := jFrame class instVarOffsetOf:'pData') notNil]) |
|
8180 |
ifTrue:[ |
|
8181 |
((frame := jFrame instVarAt:pDataIdx) notNil |
|
8182 |
and:[frame ~~ 0]) ifTrue:[ |
|
318 | 8183 |
WindowCreationTrace == true ifTrue:[ |
8184 |
'JAVA: targetFrame view already created: ' infoPrintCR. |
|
8185 |
]. |
|
284 | 8186 |
"/ sigh; pData was renamed to pNativeWidget in jdk1.2 ... |
8187 |
pDataIdx := jFramePeer class instVarOffsetOf:'pNativeWidget'. |
|
8188 |
pDataIdx isNil ifTrue:[ |
|
8189 |
"/ ok, we are < 1.2 |
|
8190 |
pDataIdx := jFramePeer class instVarOffsetOf:'pData'. |
|
8191 |
]. |
|
8192 |
jFramePeer instVarAt:pDataIdx put:frame. |
|
8193 |
] |
|
8194 |
] ifFalse:[ |
|
8195 |
frame := jFramePeer instVarNamed:'pData' |
|
8196 |
]. |
|
8197 |
||
8198 |
(frame notNil and:[frame ~~ 0]) ifTrue:[ |
|
318 | 8199 |
WindowCreationTrace == true ifTrue:[ |
8200 |
'JAVA: frame view already created: ' infoPrint. |
|
8201 |
jFramePeer class name infoPrintCR. |
|
8202 |
]. |
|
284 | 8203 |
] ifFalse:[ |
474 | 8204 |
"/ OLD |
8205 |
"/ frame := StandardSystemView new. |
|
8206 |
"/ self createdWindowsView:frame for:jFramePeer. |
|
8207 |
"/ JavaWindowGroup addTopView:frame. |
|
8208 |
||
8209 |
frame := JavaTopView new. |
|
8210 |
frame delegate:self. |
|
8211 |
frame javaPeer:jFramePeer. |
|
284 | 8212 |
self createdWindowsView:frame for:jFramePeer. |
8213 |
JavaWindowGroup addTopView:frame. |
|
474 | 8214 |
|
8215 |
"/ top := StandardSystemView new. |
|
8216 |
"/ frame := JavaView origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
8217 |
"/ frame delegate:self. |
|
8218 |
"/ frame javaPeer:jFramePeer. |
|
8219 |
"/ self createdWindowsView:frame for:jFramePeer. |
|
8220 |
"/ JavaWindowGroup addTopView:top. |
|
8221 |
||
284 | 8222 |
]. |
8223 |
||
8224 |
WindowCreationTrace == true ifTrue:[ |
|
8225 |
'JAVA: WFramePeer_create: ' print. jFramePeer displayString print. |
|
8226 |
' frame: ' print. frame printNL. |
|
8227 |
]. |
|
8228 |
||
8229 |
"Created: / 4.1.1998 / 17:56:39 / cg" |
|
474 | 8230 |
"Modified: / 3.12.1998 / 00:10:21 / cg" |
284 | 8231 |
! |
8232 |
||
8233 |
_WFramePeer_setMenuBar0:nativeContext |
|
8234 |
|frame jMenuBarPeer menuPanel| |
|
8235 |
||
8236 |
frame := self viewForWPeer:nativeContext. |
|
8237 |
||
8238 |
jMenuBarPeer := nativeContext argAt:1. |
|
8239 |
jMenuBarPeer isNil ifTrue:[ |
|
8240 |
"/ mhmh - JAVA wants to remove the frames menuPanel. |
|
8241 |
"/ but I have no handle on it (for destroy). |
|
8242 |
"/ search it in subViews of the frame. |
|
8243 |
frame subViews copy do:[:v | |
|
8244 |
(v isKindOf:MenuPanel) ifTrue:[ |
|
8245 |
v destroy |
|
8246 |
] |
|
8247 |
] |
|
8248 |
] ifFalse:[ |
|
8249 |
menuPanel := jMenuBarPeer instVarNamed:'pData'. |
|
8250 |
||
8251 |
menuPanel origin:0.0@0.0 corner:1.0@(menuPanel preferredExtent y). |
|
8252 |
frame addSubView:menuPanel. |
|
8253 |
]. |
|
8254 |
^ nil |
|
8255 |
||
8256 |
"Created: / 7.1.1998 / 21:41:35 / cg" |
|
8257 |
"Modified: / 8.1.1998 / 17:35:04 / cg" |
|
8258 |
! |
|
8259 |
||
440 | 8260 |
_WGraphics__dispose:nativeContext |
8261 |
"/ void _dispose() |
|
8262 |
UnimplementedNativeMethodSignal raise |
|
8263 |
||
8264 |
"Created: / 12.11.1998 / 19:17:51 / cg" |
|
8265 |
! |
|
8266 |
||
284 | 8267 |
_WGraphics_changeClip:nativeContext |
391 | 8268 |
|gc x y w h r bool| |
284 | 8269 |
|
8270 |
gc := self gcForWGraphics:nativeContext. |
|
8271 |
||
8272 |
x := nativeContext argAt:1. |
|
8273 |
y := nativeContext argAt:2. |
|
8274 |
w := nativeContext argAt:3. |
|
8275 |
h := nativeContext argAt:4. |
|
8276 |
bool := (nativeContext argAt:5) ~~ 0. |
|
8277 |
||
391 | 8278 |
r := Rectangle left:x top:y width:w height:h. |
401 | 8279 |
"/ 'WGraphics_changeClip: ' infoPrint. r infoPrintCR. |
391 | 8280 |
gc clippingRectangle:r. |
284 | 8281 |
|
8282 |
"Created: / 6.1.1998 / 20:57:21 / cg" |
|
401 | 8283 |
"Modified: / 20.10.1998 / 19:40:10 / cg" |
284 | 8284 |
! |
8285 |
||
8286 |
_WGraphics_clearRect:nativeContext |
|
8287 |
|gc x y w h| |
|
8288 |
||
8289 |
gc := self gcForWGraphics:nativeContext. |
|
8290 |
"/ gc isNil ifTrue:[^ self]. |
|
8291 |
||
8292 |
gc realized ifFalse:[ |
|
8293 |
'JAVA: drawing on unrealized gc - ignored' infoPrintCR. |
|
8294 |
^ self |
|
8295 |
]. |
|
8296 |
||
8297 |
x := nativeContext argAt:1. |
|
8298 |
y := nativeContext argAt:2. |
|
8299 |
w := nativeContext argAt:3. |
|
8300 |
h := nativeContext argAt:4. |
|
8301 |
||
8302 |
"/ self halt. |
|
8303 |
"/ self internalError:'breakPoint'. |
|
8304 |
||
8305 |
gc clearRectangleX:x y:y width:w height:h. |
|
8306 |
||
8307 |
"Created: / 8.1.1998 / 00:16:00 / cg" |
|
8308 |
"Modified: / 8.1.1998 / 00:21:09 / cg" |
|
8309 |
! |
|
8310 |
||
440 | 8311 |
_WGraphics_close:nativeContext |
8312 |
"/ void close (sun.awt.windows.WPrintJob) |
|
8313 |
UnimplementedNativeMethodSignal raise |
|
8314 |
||
8315 |
"Created: / 12.11.1998 / 19:19:40 / cg" |
|
8316 |
! |
|
8317 |
||
337 | 8318 |
_WGraphics_copyArea:nativeContext |
8319 |
|gc srcX srcY w h deltaX deltaY| |
|
8320 |
||
8321 |
gc := self gcForWGraphics:nativeContext. |
|
8322 |
"/ gc isNil ifTrue:[^ self]. |
|
8323 |
||
8324 |
gc realized ifFalse:[ |
|
8325 |
'JAVA: copyArea on unrealized gc - ignored' infoPrintCR. |
|
8326 |
^ self |
|
8327 |
]. |
|
8328 |
||
8329 |
srcX := nativeContext argAt:1. |
|
8330 |
srcY := nativeContext argAt:2. |
|
8331 |
w := nativeContext argAt:3. |
|
8332 |
h := nativeContext argAt:4. |
|
8333 |
deltaX := nativeContext argAt:5. |
|
8334 |
deltaY := nativeContext argAt:6. |
|
8335 |
||
8336 |
gc |
|
8337 |
copyFrom:gc |
|
8338 |
x:srcX y:srcY |
|
8339 |
toX:srcX+deltaX y:srcY+deltaY |
|
8340 |
width:w height:h |
|
8341 |
||
8342 |
"Created: / 8.1.1998 / 00:16:00 / cg" |
|
8343 |
"Modified: / 9.4.1998 / 22:01:32 / cg" |
|
8344 |
! |
|
8345 |
||
284 | 8346 |
_WGraphics_createFromComponent:nativeContext |
8347 |
|jGraphics jWin view| |
|
8348 |
||
8349 |
jGraphics := nativeContext receiver. |
|
8350 |
jWin := nativeContext argAt:1. |
|
8351 |
||
8352 |
view := KnownWindows at:jWin ifAbsent:nil. |
|
8353 |
view isNil ifTrue:[ |
|
401 | 8354 |
self halt. |
8355 |
^ self |
|
8356 |
]. |
|
8357 |
view clippingRectangle:nil. |
|
284 | 8358 |
|
8359 |
"/ "/ just a consistency check ... |
|
8360 |
"/ (jWin instVarNamed:'xid') ~~ view ifTrue:[ |
|
8361 |
"/ self halt:'consistency check' |
|
8362 |
"/ ]. |
|
8363 |
||
8364 |
jGraphics instVarNamed:'pData' put:view. |
|
8365 |
||
8366 |
"Created: / 6.1.1998 / 20:55:18 / cg" |
|
401 | 8367 |
"Modified: / 20.10.1998 / 19:38:18 / cg" |
284 | 8368 |
! |
8369 |
||
8370 |
_WGraphics_createFromGraphics:nativeContext |
|
8371 |
|jGraphics graphics gc| |
|
8372 |
||
8373 |
jGraphics := nativeContext receiver. |
|
8374 |
graphics := nativeContext argAt:1. |
|
8375 |
gc := graphics instVarNamed:'pData'. |
|
8376 |
||
8377 |
jGraphics instVarNamed:'pData' put:gc. |
|
401 | 8378 |
gc clippingRectangle:nil. |
284 | 8379 |
|
8380 |
"Created: / 8.1.1998 / 00:47:39 / cg" |
|
401 | 8381 |
"Modified: / 20.10.1998 / 19:37:58 / cg" |
284 | 8382 |
! |
8383 |
||
440 | 8384 |
_WGraphics_createFromHDC:nativeContext |
8385 |
"/ void createFromHDC (int) |
|
8386 |
UnimplementedNativeMethodSignal raise |
|
8387 |
||
8388 |
"Created: / 12.11.1998 / 19:17:32 / cg" |
|
8389 |
! |
|
8390 |
||
8391 |
_WGraphics_createFromPrintJob:nativeContext |
|
8392 |
"/ void createFromPrintJob (sun.awt.windows.WPrintJob) |
|
8393 |
UnimplementedNativeMethodSignal raise |
|
8394 |
||
8395 |
"Created: / 12.11.1998 / 19:17:20 / cg" |
|
8396 |
! |
|
8397 |
||
284 | 8398 |
_WGraphics_dispose:nativeContext |
8399 |
|gc| |
|
8400 |
||
8401 |
gc := self gcForWGraphics:nativeContext. |
|
8402 |
gc isNil ifTrue:[^ self]. |
|
401 | 8403 |
gc clippingRectangle:nil. |
284 | 8404 |
|
8405 |
"Created: / 6.1.1998 / 20:58:38 / cg" |
|
401 | 8406 |
"Modified: / 20.10.1998 / 19:35:05 / cg" |
284 | 8407 |
! |
8408 |
||
8409 |
_WGraphics_drawArc:nativeContext |
|
8410 |
|gc x y w h startAngle endAngle| |
|
8411 |
||
8412 |
gc := self gcForWGraphics:nativeContext. |
|
8413 |
"/ gc isNil ifTrue:[^ self]. |
|
8414 |
gc realized ifFalse:[^ self]. |
|
8415 |
||
8416 |
x := nativeContext argAt:1. |
|
8417 |
y := nativeContext argAt:2. |
|
8418 |
w := nativeContext argAt:3. |
|
8419 |
h := nativeContext argAt:4. |
|
8420 |
startAngle := nativeContext argAt:5. |
|
8421 |
endAngle := nativeContext argAt:6. |
|
8422 |
||
8423 |
DrawOPTrace ifTrue:[ |
|
285 | 8424 |
'drawArc x/y= ' print. x print. '@' print. y print. |
8425 |
' w/h= ' print. w print. '@' print. h print. |
|
8426 |
' startAngle= ' print. startAngle print. ' endAngle= ' print. endAngle printCR. |
|
8427 |
]. |
|
8428 |
gc |
|
8429 |
displayArcX:x y:y |
|
8430 |
width:w height:h |
|
8431 |
from:startAngle angle:(endAngle - startAngle). |
|
284 | 8432 |
|
8433 |
"Created: / 6.1.1998 / 21:00:15 / cg" |
|
285 | 8434 |
"Modified: / 28.1.1998 / 23:23:42 / cg" |
284 | 8435 |
! |
8436 |
||
440 | 8437 |
_WGraphics_drawBytes:nativeContext |
8438 |
"/ void drawBytes (byte[] int int int int) |
|
8439 |
UnimplementedNativeMethodSignal raise |
|
8440 |
||
8441 |
"Created: / 12.11.1998 / 19:18:56 / cg" |
|
8442 |
! |
|
8443 |
||
284 | 8444 |
_WGraphics_drawLine:nativeContext |
8445 |
|gc x y x2 y2| |
|
8446 |
||
8447 |
gc := self gcForWGraphics:nativeContext. |
|
8448 |
"/ gc isNil ifTrue:[^ self]. |
|
8449 |
gc realized ifFalse:[^ self]. |
|
8450 |
||
8451 |
x := nativeContext argAt:1. |
|
8452 |
y := nativeContext argAt:2. |
|
8453 |
x2 := nativeContext argAt:3. |
|
8454 |
y2 := nativeContext argAt:4. |
|
8455 |
||
8456 |
DrawOPTrace ifTrue:[ |
|
8457 |
'drawLine x/y= ' print. x print. '@' print. y print. ' x2/y2= ' print. x2 print. '@' print. y2 printCR. |
|
8458 |
]. |
|
8459 |
gc displayLineFromX:x y:y toX:x2 y:y2 |
|
8460 |
||
8461 |
"Created: / 6.1.1998 / 20:59:27 / cg" |
|
8462 |
"Modified: / 8.1.1998 / 00:34:23 / cg" |
|
8463 |
! |
|
8464 |
||
440 | 8465 |
_WGraphics_drawMFCharsConvertedSegment:nativeContext |
8466 |
"/ int drawMFCharsConvertedSegment (java.awt.Font sun.awt.FontDescriptor byte[] int int int) |
|
8467 |
UnimplementedNativeMethodSignal raise |
|
8468 |
||
8469 |
"Created: / 12.11.1998 / 19:18:44 / cg" |
|
8470 |
! |
|
8471 |
||
284 | 8472 |
_WGraphics_drawMFCharsSegment:nativeContext |
8473 |
|jFont jFontDescr s gc x y offs len| |
|
8474 |
||
8475 |
gc := self gcForWGraphics:nativeContext. |
|
8476 |
gc realized ifFalse:[^ self]. |
|
8477 |
||
8478 |
jFont := nativeContext argAt:1. |
|
8479 |
jFontDescr := nativeContext argAt:2. |
|
8480 |
s := nativeContext argAt:3. |
|
8481 |
offs := nativeContext argAt:4. |
|
8482 |
len := nativeContext argAt:5. |
|
8483 |
x := nativeContext argAt:6. |
|
8484 |
y := nativeContext argAt:7. |
|
8485 |
||
8486 |
DrawOPTrace ifTrue:[ |
|
8487 |
'drawMFCharsSegment x/y= ' print. x print. '@' print. y print. ' s= ' print. s printCR. |
|
8488 |
]. |
|
8489 |
gc displayString:s from:offs+1 to:offs+len x:x y:y. |
|
8490 |
^ (gc font onDevice:(gc graphicsDevice)) widthOf:s. |
|
8491 |
||
8492 |
"Created: / 6.1.1998 / 21:01:07 / cg" |
|
8493 |
"Modified: / 25.1.1998 / 20:45:55 / cg" |
|
8494 |
! |
|
8495 |
||
8496 |
_WGraphics_drawOval:nativeContext |
|
8497 |
|gc x y w h| |
|
8498 |
||
8499 |
gc := self gcForWGraphics:nativeContext. |
|
8500 |
"/ gc isNil ifTrue:[^ self]. |
|
8501 |
gc realized ifFalse:[^ self]. |
|
8502 |
||
8503 |
x := nativeContext argAt:1. |
|
8504 |
y := nativeContext argAt:2. |
|
8505 |
w := nativeContext argAt:3. |
|
8506 |
h := nativeContext argAt:4. |
|
8507 |
||
337 | 8508 |
DrawOPTrace ifTrue:[ |
285 | 8509 |
'drawOval x/y= ' print. x print. '@' print. y print. |
8510 |
' w/h= ' print. w print. '@' print. h printCR. |
|
8511 |
]. |
|
8512 |
gc displayArcX:x y:y width:w height:h from:0 angle:360. |
|
284 | 8513 |
|
8514 |
"Created: / 8.1.1998 / 00:44:31 / cg" |
|
337 | 8515 |
"Modified: / 9.4.1998 / 22:10:23 / cg" |
284 | 8516 |
! |
8517 |
||
8518 |
_WGraphics_drawPolygon:nativeContext |
|
8519 |
|gc xVector yVector count points| |
|
8520 |
||
8521 |
gc := self gcForWGraphics:nativeContext. |
|
8522 |
"/ gc isNil ifTrue:[^ self]. |
|
8523 |
gc realized ifFalse:[^ self]. |
|
8524 |
||
8525 |
xVector := nativeContext argAt:1. |
|
8526 |
yVector := nativeContext argAt:2. |
|
8527 |
count := nativeContext argAt:3. |
|
8528 |
||
8529 |
DrawOPTrace ifTrue:[ |
|
8530 |
'drawPolgon' printCR. |
|
8531 |
]. |
|
8532 |
||
8533 |
points := (1 to:count) collect:[:i | (xVector at:i) @ (yVector at:i)]. |
|
8534 |
gc displayPolygon:points |
|
8535 |
||
8536 |
"Created: / 8.1.1998 / 00:57:28 / cg" |
|
8537 |
"Modified: / 8.1.1998 / 00:57:49 / cg" |
|
8538 |
! |
|
8539 |
||
440 | 8540 |
_WGraphics_drawPolyline:nativeContext |
8541 |
"/ void drawPolyline (int[] int[] int) |
|
8542 |
UnimplementedNativeMethodSignal raise |
|
8543 |
||
8544 |
"Created: / 12.11.1998 / 19:19:07 / cg" |
|
8545 |
! |
|
8546 |
||
284 | 8547 |
_WGraphics_drawRect:nativeContext |
8548 |
|gc x y w h| |
|
8549 |
||
8550 |
gc := self gcForWGraphics:nativeContext. |
|
8551 |
"/ gc isNil ifTrue:[^ self]. |
|
8552 |
gc realized ifFalse:[^ self]. |
|
8553 |
||
8554 |
x := nativeContext argAt:1. |
|
8555 |
y := nativeContext argAt:2. |
|
8556 |
w := nativeContext argAt:3. |
|
8557 |
h := nativeContext argAt:4. |
|
8558 |
||
8559 |
"/ self halt. |
|
8560 |
"/ self internalError:'breakPoint'. |
|
8561 |
||
8562 |
gc displayRectangleX:x y:y width:w height:h. |
|
8563 |
||
8564 |
"Modified: / 8.1.1998 / 00:34:33 / cg" |
|
8565 |
"Created: / 8.1.1998 / 00:59:05 / cg" |
|
8566 |
! |
|
8567 |
||
8568 |
_WGraphics_drawRoundRect:nativeContext |
|
8569 |
|gc x y w h| |
|
8570 |
||
8571 |
gc := self gcForWGraphics:nativeContext. |
|
8572 |
"/ gc isNil ifTrue:[^ self]. |
|
8573 |
gc realized ifFalse:[^ self]. |
|
8574 |
||
8575 |
x := nativeContext argAt:1. |
|
8576 |
y := nativeContext argAt:2. |
|
8577 |
w := nativeContext argAt:3. |
|
8578 |
h := nativeContext argAt:4. |
|
8579 |
||
8580 |
"/ self halt. |
|
8581 |
"/ self internalError:'breakPoint'. |
|
8582 |
||
8583 |
gc displayRectangleX:x y:y width:w height:h. |
|
8584 |
||
8585 |
"Modified: / 8.1.1998 / 00:34:33 / cg" |
|
8586 |
"Created: / 8.1.1998 / 00:59:26 / cg" |
|
8587 |
! |
|
8588 |
||
440 | 8589 |
_WGraphics_drawSFChars:nativeContext |
8590 |
"/ void drawSFChars (char[] int int int int) |
|
8591 |
UnimplementedNativeMethodSignal raise |
|
8592 |
||
8593 |
"Created: / 12.11.1998 / 19:18:20 / cg" |
|
8594 |
! |
|
8595 |
||
284 | 8596 |
_WGraphics_fillArc:nativeContext |
8597 |
|gc x y w h startAngle endAngle| |
|
8598 |
||
8599 |
gc := self gcForWGraphics:nativeContext. |
|
8600 |
"/ gc isNil ifTrue:[^ self]. |
|
8601 |
gc realized ifFalse:[^ self]. |
|
8602 |
||
8603 |
x := nativeContext argAt:1. |
|
8604 |
y := nativeContext argAt:2. |
|
8605 |
w := nativeContext argAt:3. |
|
8606 |
h := nativeContext argAt:4. |
|
8607 |
startAngle := nativeContext argAt:5. |
|
8608 |
endAngle := nativeContext argAt:6. |
|
8609 |
||
8610 |
DrawOPTrace ifTrue:[ |
|
8611 |
'fillArc x/y= ' print. x print. '@' print. y print. |
|
8612 |
' w/h= ' print. w print. '@' print. h print. |
|
8613 |
' startAngle= ' print. startAngle print. ' endAngle= ' print. endAngle printCR. |
|
8614 |
]. |
|
8615 |
gc fillArcX:x y:y width:w height:h from:startAngle angle:(endAngle - startAngle) |
|
8616 |
||
8617 |
"Created: / 6.1.1998 / 21:11:31 / cg" |
|
8618 |
"Modified: / 8.1.1998 / 00:33:59 / cg" |
|
8619 |
! |
|
8620 |
||
8621 |
_WGraphics_fillOval:nativeContext |
|
8622 |
|gc x y w h| |
|
8623 |
||
8624 |
gc := self gcForWGraphics:nativeContext. |
|
8625 |
"/ gc isNil ifTrue:[^ self]. |
|
8626 |
gc realized ifFalse:[^ self]. |
|
8627 |
||
8628 |
x := nativeContext argAt:1. |
|
8629 |
y := nativeContext argAt:2. |
|
8630 |
w := nativeContext argAt:3. |
|
8631 |
h := nativeContext argAt:4. |
|
8632 |
||
8633 |
DrawOPTrace ifTrue:[ |
|
8634 |
'drawOval x/y= ' print. x print. '@' print. y print. |
|
8635 |
' w/h= ' print. w print. '@' print. h printCR. |
|
8636 |
]. |
|
8637 |
gc fillArcX:x y:y width:w height:h from:0 angle:360 |
|
8638 |
||
8639 |
"Created: / 8.1.1998 / 00:46:00 / cg" |
|
8640 |
"Modified: / 8.1.1998 / 00:46:20 / cg" |
|
8641 |
! |
|
8642 |
||
8643 |
_WGraphics_fillPolygon:nativeContext |
|
8644 |
|gc xVector yVector count points| |
|
8645 |
||
8646 |
gc := self gcForWGraphics:nativeContext. |
|
8647 |
"/ gc isNil ifTrue:[^ self]. |
|
8648 |
gc realized ifFalse:[^ self]. |
|
8649 |
||
8650 |
xVector := nativeContext argAt:1. |
|
8651 |
yVector := nativeContext argAt:2. |
|
8652 |
count := nativeContext argAt:3. |
|
8653 |
||
8654 |
DrawOPTrace ifTrue:[ |
|
8655 |
'fillPolgon' printCR. |
|
8656 |
]. |
|
8657 |
||
8658 |
points := (1 to:count-1) collect:[:i | (xVector at:i) @ (yVector at:i)]. |
|
8659 |
gc fillPolygon:points |
|
8660 |
||
8661 |
"Created: / 8.1.1998 / 00:58:09 / cg" |
|
8662 |
"Modified: / 25.1.1998 / 11:03:19 / cg" |
|
8663 |
! |
|
8664 |
||
8665 |
_WGraphics_fillRect:nativeContext |
|
8666 |
|gc x y w h| |
|
8667 |
||
8668 |
gc := self gcForWGraphics:nativeContext. |
|
8669 |
"/ gc isNil ifTrue:[^ self]. |
|
8670 |
gc realized ifFalse:[^ self]. |
|
8671 |
||
8672 |
x := nativeContext argAt:1. |
|
8673 |
y := nativeContext argAt:2. |
|
8674 |
w := nativeContext argAt:3. |
|
8675 |
h := nativeContext argAt:4. |
|
8676 |
||
8677 |
"/ self halt. |
|
8678 |
"/ self internalError:'breakPoint'. |
|
8679 |
||
8680 |
gc fillRectangleX:x y:y width:w height:h. |
|
8681 |
||
8682 |
"Created: / 15.8.1997 / 15:43:10 / cg" |
|
8683 |
"Modified: / 8.1.1998 / 00:34:33 / cg" |
|
8684 |
! |
|
8685 |
||
8686 |
_WGraphics_fillRoundRect:nativeContext |
|
8687 |
|gc x y w h| |
|
8688 |
||
8689 |
gc := self gcForWGraphics:nativeContext. |
|
8690 |
"/ gc isNil ifTrue:[^ self]. |
|
8691 |
gc realized ifFalse:[^ self]. |
|
8692 |
||
8693 |
x := nativeContext argAt:1. |
|
8694 |
y := nativeContext argAt:2. |
|
8695 |
w := nativeContext argAt:3. |
|
8696 |
h := nativeContext argAt:4. |
|
8697 |
||
8698 |
"/ self halt. |
|
8699 |
"/ self internalError:'breakPoint'. |
|
8700 |
||
8701 |
gc displayRectangleX:x y:y width:w height:h. |
|
8702 |
||
8703 |
"Modified: / 8.1.1998 / 00:34:33 / cg" |
|
8704 |
"Created: / 8.1.1998 / 00:59:36 / cg" |
|
8705 |
! |
|
8706 |
||
8707 |
_WGraphics_getClipBounds:nativeContext |
|
8708 |
|gc rect r x y w h| |
|
8709 |
||
8710 |
gc := self gcForWGraphics:nativeContext. |
|
391 | 8711 |
"/ gc isNil ifTrue:[^ nil]. |
284 | 8712 |
|
8713 |
rect := (Java classForName:'java.awt.Rectangle') basicNew. |
|
8714 |
||
8715 |
(gc isMemberOf:JavaView) ifTrue:[ |
|
391 | 8716 |
"/ r := gc clippingRectangleOrNil. |
8717 |
r := gc getNextUpdateRectangle. |
|
401 | 8718 |
]. |
8719 |
r isNil ifTrue:[ |
|
8720 |
r := gc clippingRectangleOrNil. |
|
8721 |
]. |
|
8722 |
||
8723 |
r isNil ifTrue:[ |
|
391 | 8724 |
x := y := 0. |
8725 |
w := (gc width). |
|
8726 |
h := (gc height). |
|
401 | 8727 |
] ifFalse:[ |
8728 |
x := (r left). |
|
8729 |
y := (r top). |
|
8730 |
w := (r width). |
|
8731 |
h := (r height). |
|
284 | 8732 |
]. |
8733 |
rect instVarNamed:'x' put:x. |
|
8734 |
rect instVarNamed:'y' put:y. |
|
8735 |
rect instVarNamed:'width' put:w. |
|
8736 |
rect instVarNamed:'height' put:h. |
|
8737 |
||
495 | 8738 |
"/ 'WGraphics__getClipBounds ' infoPrint. (x@y extent:w@h) infoPrintCR. |
284 | 8739 |
|
8740 |
^ rect |
|
8741 |
||
8742 |
"Created: / 6.1.1998 / 20:58:07 / cg" |
|
504 | 8743 |
"Modified: / 23.12.1998 / 20:14:09 / cg" |
284 | 8744 |
! |
8745 |
||
8746 |
_WGraphics_imageCreate:nativeContext |
|
8747 |
|jGraphics imgRep| |
|
8748 |
||
8749 |
jGraphics := nativeContext receiver. |
|
8750 |
imgRep := nativeContext argAt:1. |
|
8751 |
||
8752 |
jGraphics instVarNamed:'pData' put:(imgRep instVarNamed:'pData'). |
|
8753 |
"/ self halt. |
|
8754 |
||
8755 |
"Created: / 11.1.1998 / 16:34:30 / cg" |
|
8756 |
"Modified: / 17.1.1998 / 12:37:18 / cg" |
|
8757 |
! |
|
8758 |
||
8759 |
_WGraphics_pSetFont:nativeContext |
|
8760 |
|gc jFont stFont| |
|
8761 |
||
8762 |
gc := self gcForWGraphics:nativeContext. |
|
8763 |
jFont := nativeContext argAt:1. |
|
8764 |
||
8765 |
stFont := jFont instVarNamed:'pData'. |
|
8766 |
(stFont isNil or:[stFont == 0]) ifTrue:[ |
|
8767 |
"/ self halt. |
|
8768 |
] ifFalse:[ |
|
8769 |
gc font:stFont |
|
8770 |
]. |
|
8771 |
||
8772 |
"Created: / 6.1.1998 / 20:56:47 / cg" |
|
8773 |
"Modified: / 15.1.1998 / 12:31:20 / cg" |
|
8774 |
! |
|
8775 |
||
8776 |
_WGraphics_pSetForeground:nativeContext |
|
8777 |
|gc rgb clr| |
|
8778 |
||
8779 |
gc := self gcForWGraphics:nativeContext. |
|
8780 |
||
8781 |
rgb := nativeContext argAt:1. |
|
8782 |
||
8783 |
clr := Color rgbValue:rgb. |
|
504 | 8784 |
gc paint:(clr nearestOn:gc device). |
284 | 8785 |
|
8786 |
"/ self halt. |
|
8787 |
"/ self internalError:'breakPoint'. |
|
8788 |
||
8789 |
"Created: / 6.1.1998 / 20:56:14 / cg" |
|
504 | 8790 |
"Modified: / 23.12.1998 / 20:10:49 / cg" |
284 | 8791 |
! |
8792 |
||
440 | 8793 |
_WGraphics_print:nativeContext |
8794 |
"/ void print (sun.awt.windows.WComponentPeer) |
|
8795 |
UnimplementedNativeMethodSignal raise |
|
8796 |
||
8797 |
"Created: / 12.11.1998 / 19:19:25 / cg" |
|
8798 |
! |
|
8799 |
||
8800 |
_WGraphics_removeClip:nativeContext |
|
8801 |
"/ void removeClip () |
|
8802 |
UnimplementedNativeMethodSignal raise |
|
8803 |
||
8804 |
"Created: / 12.11.1998 / 19:18:05 / cg" |
|
8805 |
! |
|
8806 |
||
284 | 8807 |
_WGraphics_setPaintMode:nativeContext |
8808 |
|gc| |
|
8809 |
||
8810 |
gc := self gcForWGraphics:nativeContext. |
|
8811 |
gc function:#copy. |
|
285 | 8812 |
|
8813 |
true "DrawOPTrace" ifTrue:[ |
|
8814 |
'copyMode' infoPrintCR. |
|
8815 |
]. |
|
284 | 8816 |
|
8817 |
"Created: / 8.1.1998 / 00:33:44 / cg" |
|
285 | 8818 |
"Modified: / 28.1.1998 / 23:25:56 / cg" |
284 | 8819 |
! |
8820 |
||
8821 |
_WGraphics_setXORMode:nativeContext |
|
8822 |
|gc jColor rgb invColor device| |
|
8823 |
||
8824 |
gc := self gcForWGraphics:nativeContext. |
|
8825 |
jColor := nativeContext argAt:1. |
|
8826 |
device := gc graphicsDevice. |
|
285 | 8827 |
|
8828 |
"/ "/ on trueColor systems, use the provided |
|
8829 |
"/ "/ rgb value for inverting. |
|
8830 |
"/ "/ on palette systems, use white ^ black |
|
8831 |
"/ |
|
8832 |
"/ device visualType == #TrueColor ifTrue:[ |
|
8833 |
"/ rgb := jColor instVarNamed:'value'. |
|
8834 |
"/ rgb := rgb bitAnd:16rFFFFFF. |
|
8835 |
"/ rgb == 0 ifTrue:[ |
|
8836 |
"/ rgb := 16rFFFFFF. |
|
8837 |
"/ ]. |
|
8838 |
"/ invColor := rgb |
|
8839 |
"/ ] ifFalse:[ |
|
8840 |
"/ invColor := device blackpixel bitXor:device whitepixel. |
|
8841 |
"/ ]. |
|
8842 |
||
8843 |
invColor := device blackpixel bitXor:device whitepixel. |
|
8844 |
||
8845 |
"/ gc foreground:(Color colorId:invColor) |
|
8846 |
"/ background:device blackColor. |
|
8847 |
device |
|
8848 |
setForeground:invColor background:0 |
|
8849 |
in:gc gcId. |
|
284 | 8850 |
gc function:#xor. |
285 | 8851 |
|
8852 |
true "DrawOPTrace" ifTrue:[ |
|
8853 |
'xorMode' infoPrintCR. |
|
8854 |
]. |
|
284 | 8855 |
|
8856 |
"Created: / 8.1.1998 / 00:36:17 / cg" |
|
285 | 8857 |
"Modified: / 28.1.1998 / 23:45:03 / cg" |
284 | 8858 |
! |
8859 |
||
8860 |
_WLabelPeer_create:nativeContext |
|
8861 |
|jLabelPeer jLabel jFrame frame label |
|
8862 |
lbl| |
|
8863 |
||
8864 |
jLabelPeer := nativeContext receiver. |
|
8865 |
jLabel := jLabelPeer instVarNamed:'target'. |
|
8866 |
||
8867 |
lbl := jLabel instVarNamed:'text'. |
|
8868 |
lbl notNil ifTrue:[ |
|
8869 |
lbl := Java as_ST_String:lbl |
|
8870 |
]. |
|
8871 |
||
8872 |
jFrame := nativeContext argAt:1. |
|
8873 |
frame := jFrame instVarNamed:'pData'. |
|
8874 |
||
8875 |
label := Label in:frame. |
|
8876 |
lbl notNil ifTrue:[ |
|
8877 |
label label:lbl |
|
8878 |
]. |
|
8879 |
self createdWindowsView:label for:jLabelPeer. |
|
8880 |
||
8881 |
WindowCreationTrace == true ifTrue:[ |
|
8882 |
'WLabelPeer_create: ' print. frame print. ' -> ' print. label printNL. |
|
8883 |
]. |
|
8884 |
||
8885 |
"Created: / 7.1.1998 / 21:42:31 / cg" |
|
8886 |
"Modified: / 13.1.1998 / 22:10:47 / cg" |
|
8887 |
! |
|
8888 |
||
8889 |
_WLabelPeer_setAlignment:nativeContext |
|
8890 |
|label alignNr| |
|
8891 |
||
8892 |
alignNr := nativeContext argAt:1. |
|
8893 |
label := self viewForWPeer:nativeContext. |
|
8894 |
label notNil ifTrue:[ |
|
8895 |
]. |
|
8896 |
||
8897 |
"Created: / 7.1.1998 / 21:43:12 / cg" |
|
8898 |
"Modified: / 8.1.1998 / 17:35:29 / cg" |
|
8899 |
! |
|
8900 |
||
8901 |
_WLabelPeer_setText:nativeContext |
|
479 | 8902 |
|label jString str| |
284 | 8903 |
|
8904 |
jString := nativeContext argAt:1. |
|
8905 |
||
8906 |
label := self viewForWPeer:nativeContext. |
|
479 | 8907 |
str := jString. |
8908 |
str notNil ifTrue:[ |
|
8909 |
str := Java as_ST_String:str |
|
8910 |
]. |
|
8911 |
label label:str |
|
284 | 8912 |
|
8913 |
"Created: / 7.1.1998 / 21:43:51 / cg" |
|
479 | 8914 |
"Modified: / 3.12.1998 / 14:59:18 / cg" |
284 | 8915 |
! |
8916 |
||
408 | 8917 |
_WListPeer__addItem:nativeContext |
448 | 8918 |
|jString index1 length selListView m| |
408 | 8919 |
|
8920 |
selListView := self viewForWPeer:nativeContext. |
|
8921 |
||
8922 |
jString := nativeContext argAt:1. |
|
8923 |
index1 := nativeContext argAt:2. |
|
8924 |
length := nativeContext argAt:3. |
|
8925 |
||
448 | 8926 |
(m := selListView model) notNil ifTrue:[ |
8927 |
m list addLast:(Java as_ST_String:jString). |
|
8928 |
m changed:#list. |
|
8929 |
]. |
|
408 | 8930 |
|
8931 |
"Created: / 26.10.1998 / 20:11:30 / cg" |
|
448 | 8932 |
"Modified: / 14.11.1998 / 01:21:03 / cg" |
408 | 8933 |
! |
8934 |
||
284 | 8935 |
_WListPeer_addItem:nativeContext |
410 | 8936 |
|jString index selListView m| |
284 | 8937 |
|
8938 |
selListView := self viewForWPeer:nativeContext. |
|
8939 |
||
8940 |
jString := nativeContext argAt:1. |
|
8941 |
index := nativeContext argAt:2. |
|
8942 |
||
410 | 8943 |
m := selListView model. |
8944 |
m isNil ifTrue:[ |
|
8945 |
Transcript showCR:'JAVA: access to listModel of closed view'. |
|
8946 |
] ifFalse:[ |
|
8947 |
m list addLast:(Java as_ST_String:jString). |
|
8948 |
m changed:#list. |
|
8949 |
] |
|
8950 |
||
284 | 8951 |
"Created: / 24.1.1998 / 21:10:05 / cg" |
410 | 8952 |
"Modified: / 2.11.1998 / 17:12:52 / cg" |
284 | 8953 |
! |
8954 |
||
8955 |
_WListPeer_create:nativeContext |
|
8956 |
|jListPeer jFrame frame selectionInListView| |
|
8957 |
||
8958 |
jListPeer := nativeContext receiver. |
|
8959 |
||
8960 |
jFrame := nativeContext argAt:1. |
|
8961 |
frame := jFrame instVarNamed:'pData'. |
|
8962 |
||
8963 |
selectionInListView := ScrollableView for:SelectionInListView in:frame. |
|
8964 |
selectionInListView action:[:index | jListPeer perform:#'handleListChanged(I)V' with:(index - 1)]. |
|
8965 |
selectionInListView doubleClickAction:[:index | jListPeer perform:#'handleAction(I)V' with:(index - 1)]. |
|
337 | 8966 |
selectionInListView model:(SelectionInList new list:(List new)). |
284 | 8967 |
selectionInListView useIndex:true. |
8968 |
||
8969 |
self createdWindowsView:selectionInListView for:jListPeer. |
|
8970 |
||
8971 |
WindowCreationTrace == true ifTrue:[ |
|
8972 |
'WTextAreaPeer_create: ' print. frame print. ' -> ' print. selectionInListView printNL. |
|
8973 |
]. |
|
8974 |
||
8975 |
"Created: / 24.1.1998 / 19:58:54 / cg" |
|
337 | 8976 |
"Modified: / 9.4.1998 / 22:19:07 / cg" |
8977 |
! |
|
8978 |
||
8979 |
_WListPeer_delItems:nativeContext |
|
494 | 8980 |
|jString index1 index2 selListView model list| |
337 | 8981 |
|
8982 |
selListView := self viewForWPeer:nativeContext. |
|
8983 |
||
494 | 8984 |
index1 := (nativeContext argAt:1) + 1. "/ java indices are 0-based. |
8985 |
index2 := (nativeContext argAt:2) + 1. "/ st indices are 1-based. |
|
8986 |
||
8987 |
model := selListView model. |
|
508 | 8988 |
model isNil ifTrue:[^ self]. |
494 | 8989 |
list := model list. |
8990 |
list size >= index1 ifTrue:[ |
|
8991 |
list removeFromIndex:index1 toIndex:(index2 min:list size). |
|
8992 |
model changed:#list. |
|
8993 |
]. |
|
337 | 8994 |
|
8995 |
"Created: / 9.4.1998 / 22:19:25 / cg" |
|
508 | 8996 |
"Modified: / 30.12.1998 / 20:00:50 / cg" |
284 | 8997 |
! |
8998 |
||
440 | 8999 |
_WListPeer_deselect:nativeContext |
9000 |
"/ void deselect (int) |
|
9001 |
UnimplementedNativeMethodSignal raise |
|
9002 |
||
9003 |
"Created: / 12.11.1998 / 19:15:10 / cg" |
|
9004 |
! |
|
9005 |
||
448 | 9006 |
_WListPeer_getMaxWidth:nativeContext |
9007 |
"/ int getMaxWidth () |
|
9008 |
UnimplementedNativeMethodSignal raise |
|
9009 |
||
9010 |
"Created: / 14.11.1998 / 10:44:29 / cg" |
|
9011 |
! |
|
9012 |
||
284 | 9013 |
_WListPeer_isSelected:nativeContext |
9014 |
|selectionInListView index model| |
|
9015 |
||
9016 |
selectionInListView := self viewForWPeer:nativeContext. |
|
9017 |
||
9018 |
index := nativeContext argAt:1. |
|
9019 |
(model := selectionInListView model) notNil ifTrue:[ |
|
9020 |
(model selectionIndex == (index + 1)) "/ JAVA indexing starts at 0 |
|
9021 |
ifTrue:[ |
|
9022 |
^ 1 |
|
9023 |
] |
|
9024 |
]. |
|
9025 |
^ 0. |
|
9026 |
||
9027 |
"Created: / 24.1.1998 / 22:42:31 / cg" |
|
9028 |
"Modified: / 25.1.1998 / 01:35:32 / cg" |
|
9029 |
! |
|
9030 |
||
396 | 9031 |
_WListPeer_makeVisible:nativeContext |
9032 |
|selectionInListView lineNr| |
|
9033 |
||
9034 |
selectionInListView := self viewForWPeer:nativeContext. |
|
9035 |
||
9036 |
lineNr := nativeContext argAt:1. |
|
9037 |
||
9038 |
selectionInListView makeLineVisible:(lineNr + 1) |
|
9039 |
||
9040 |
"Modified: / 24.1.1998 / 20:01:06 / cg" |
|
9041 |
"Created: / 20.10.1998 / 14:14:50 / cg" |
|
9042 |
! |
|
9043 |
||
284 | 9044 |
_WListPeer_select:nativeContext |
9045 |
|selectionInListView index model| |
|
9046 |
||
9047 |
selectionInListView := self viewForWPeer:nativeContext. |
|
9048 |
||
9049 |
index := nativeContext argAt:1. |
|
9050 |
(model := selectionInListView model) notNil ifTrue:[ |
|
9051 |
model selectionIndex:(index + 1). "/ JAVA indexing starts at 0 |
|
9052 |
] |
|
9053 |
||
9054 |
"Created: / 24.1.1998 / 22:32:35 / cg" |
|
9055 |
"Modified: / 25.1.1998 / 01:28:46 / cg" |
|
9056 |
! |
|
9057 |
||
9058 |
_WListPeer_setMultipleSelections:nativeContext |
|
9059 |
|selectionInListView onOff| |
|
9060 |
||
9061 |
selectionInListView := self viewForWPeer:nativeContext. |
|
9062 |
||
9063 |
onOff := (nativeContext argAt:1) ~~ 0. |
|
9064 |
||
9065 |
selectionInListView multipleSelectOk:onOff. |
|
9066 |
||
9067 |
"Modified: / 24.1.1998 / 20:01:06 / cg" |
|
9068 |
! |
|
9069 |
||
408 | 9070 |
_WListPeer_updateMaxItemWidth:nativeContext |
9071 |
|selectionInListView lineNr| |
|
9072 |
||
9073 |
selectionInListView := self viewForWPeer:nativeContext. |
|
9074 |
||
9075 |
"Created: / 26.10.1998 / 20:09:46 / cg" |
|
9076 |
! |
|
9077 |
||
440 | 9078 |
_WMenuBarPeer_addMenu:nativeContext |
9079 |
"/ void addMenu (java.awt.Menu) |
|
9080 |
UnimplementedNativeMethodSignal raise |
|
9081 |
||
9082 |
"Created: / 12.11.1998 / 19:14:00 / cg" |
|
9083 |
! |
|
9084 |
||
284 | 9085 |
_WMenuBarPeer_create:nativeContext |
9086 |
|jMenuBarPeer jMenuBar jFrame frame menuBar| |
|
9087 |
||
9088 |
jMenuBarPeer := nativeContext receiver. |
|
9089 |
jMenuBar := jMenuBarPeer instVarNamed:'target'. |
|
9090 |
||
9091 |
jFrame := nativeContext argAt:1. |
|
9092 |
frame := jFrame instVarNamed:'pData'. |
|
9093 |
||
9094 |
menuBar := MenuPanel in:frame. |
|
9095 |
menuBar verticalLayout:false. |
|
9096 |
menuBar realize. |
|
9097 |
||
9098 |
self createdWindowsView:menuBar for:jMenuBarPeer. |
|
9099 |
||
9100 |
WindowCreationTrace == true ifTrue:[ |
|
9101 |
'WMenuBarPeer_create: ' print. frame print. ' -> ' print. menuBar printNL. |
|
9102 |
]. |
|
9103 |
||
9104 |
"Created: / 7.1.1998 / 21:38:31 / cg" |
|
9105 |
"Modified: / 25.1.1998 / 13:19:03 / cg" |
|
9106 |
! |
|
9107 |
||
440 | 9108 |
_WMenuBarPeer_delMenu:nativeContext |
9109 |
"/ void delMenu (int) |
|
9110 |
UnimplementedNativeMethodSignal raise |
|
9111 |
||
9112 |
"Created: / 12.11.1998 / 19:14:11 / cg" |
|
9113 |
! |
|
9114 |
||
325 | 9115 |
_WMenuItemPeer__dispose:nativeContext |
9116 |
|jMenuItemPeer item| |
|
9117 |
||
9118 |
jMenuItemPeer := nativeContext receiver. |
|
9119 |
item := jMenuItemPeer instVarNamed:'pData'. |
|
9120 |
||
9121 |
"/ what should be done here ? |
|
9122 |
||
9123 |
"Created: / 29.3.1998 / 17:16:05 / cg" |
|
9124 |
"Modified: / 29.3.1998 / 17:16:35 / cg" |
|
9125 |
! |
|
9126 |
||
440 | 9127 |
_WMenuItemPeer__setLabel:nativeContext |
9128 |
"/ void _setLabel (java.lang.String) |
|
495 | 9129 |
|
9130 |
|jMenuItemPeer item label| |
|
9131 |
||
9132 |
jMenuItemPeer := nativeContext receiver. |
|
9133 |
item := jMenuItemPeer instVarNamed:'pData'. |
|
9134 |
(item isNil or:[item == 0]) ifTrue:[ |
|
9135 |
'JAVA [warning]: NULL menu item in setLabel' infoPrintCR. |
|
9136 |
^ self |
|
9137 |
]. |
|
9138 |
||
9139 |
label := nativeContext argAt:1. |
|
9140 |
label isNil ifTrue:[ |
|
9141 |
label := '' |
|
9142 |
] ifFalse:[ |
|
9143 |
label := Java as_ST_String:label |
|
9144 |
]. |
|
9145 |
item label:label. |
|
9146 |
||
9147 |
"Modified: / 11.12.1998 / 16:40:18 / cg" |
|
440 | 9148 |
! |
9149 |
||
284 | 9150 |
_WMenuItemPeer_create:nativeContext |
9151 |
|jMenuItemPeer jMenuItem jMenuPeer menu item lbl| |
|
9152 |
||
9153 |
jMenuItemPeer := nativeContext receiver. |
|
9154 |
jMenuItem := jMenuItemPeer instVarNamed:'target'. |
|
9155 |
||
9156 |
jMenuPeer := nativeContext argAt:1. |
|
9157 |
menu := jMenuPeer instVarNamed:'pData'. |
|
480 | 9158 |
(menu isNil or:[menu == 0]) ifTrue:[ |
9159 |
'JAVA: no menu to create item in' infoPrintCR. |
|
9160 |
^ self |
|
9161 |
]. |
|
284 | 9162 |
item := menu createAtIndex:nil. |
325 | 9163 |
item value:[ |
9164 |
jMenuItemPeer perform:#'handleAction(I)V' with:0 |
|
9165 |
]. |
|
284 | 9166 |
|
9167 |
lbl := jMenuItem instVarNamed:'label'. |
|
9168 |
lbl notNil ifTrue:[ |
|
325 | 9169 |
lbl := Java as_ST_String:lbl. |
9170 |
item label:lbl |
|
284 | 9171 |
]. |
9172 |
||
9173 |
jMenuItemPeer instVarNamed:'pData' put:item. |
|
9174 |
||
9175 |
WindowOPTrace == true ifTrue:[ |
|
325 | 9176 |
'WMenuItem_create: ' print. menu print. ' -> ' print. item printNL. |
284 | 9177 |
]. |
9178 |
||
9179 |
"Created: / 7.1.1998 / 21:40:44 / cg" |
|
480 | 9180 |
"Modified: / 3.12.1998 / 20:43:20 / cg" |
284 | 9181 |
! |
9182 |
||
9183 |
_WMenuItemPeer_enable:nativeContext |
|
9184 |
|jMenuItemPeer item state| |
|
9185 |
||
9186 |
jMenuItemPeer := nativeContext receiver. |
|
9187 |
item := jMenuItemPeer instVarNamed:'pData'. |
|
480 | 9188 |
(item isNil or:[item == 0]) ifTrue:[ |
495 | 9189 |
'JAVA [warning]: NULL menu item in enable' infoPrintCR. |
480 | 9190 |
^ self |
9191 |
]. |
|
284 | 9192 |
|
9193 |
state := nativeContext argAt:1. |
|
495 | 9194 |
item enabled:(state ~~ 0) |
284 | 9195 |
|
9196 |
"Created: / 7.1.1998 / 22:41:38 / cg" |
|
495 | 9197 |
"Modified: / 11.12.1998 / 16:40:26 / cg" |
284 | 9198 |
! |
9199 |
||
440 | 9200 |
_WMenuPeer_addSeparator:nativeContext |
9201 |
"/ void addSeparator () |
|
9202 |
UnimplementedNativeMethodSignal raise |
|
9203 |
||
9204 |
"Created: / 12.11.1998 / 19:13:14 / cg" |
|
9205 |
! |
|
9206 |
||
284 | 9207 |
_WMenuPeer_createMenu:nativeContext |
9208 |
|jMenuPeer jMenu jMenuBarPeer menuPanel menu |
|
9209 |
lbl item| |
|
9210 |
||
9211 |
jMenuPeer := nativeContext receiver. |
|
9212 |
jMenu := jMenuPeer instVarNamed:'target'. |
|
9213 |
||
9214 |
jMenuBarPeer := nativeContext argAt:1. |
|
9215 |
menuPanel := jMenuBarPeer instVarNamed:'pData'. |
|
9216 |
||
9217 |
item := menuPanel createAtIndex:nil. |
|
9218 |
lbl := jMenu instVarNamed:'label'. |
|
9219 |
lbl notNil ifTrue:[ |
|
9220 |
lbl := Java as_ST_String:lbl. |
|
9221 |
item label:lbl |
|
9222 |
]. |
|
9223 |
||
9224 |
menu := MenuPanel new. |
|
9225 |
item submenu:menu. |
|
9226 |
||
9227 |
jMenuPeer instVarNamed:'pData' put:menu. |
|
9228 |
||
9229 |
'createMenuPeer: ' print. menuPanel print. ' -> ' print. menu printNL. |
|
9230 |
||
9231 |
"Created: / 7.1.1998 / 21:39:50 / cg" |
|
9232 |
"Modified: / 13.1.1998 / 22:11:09 / cg" |
|
9233 |
! |
|
9234 |
||
440 | 9235 |
_WMenuPeer_createSubMenu:nativeContext |
9236 |
"/ void createSubMenu (sun.awt.windows.WMenuPeer) |
|
482 | 9237 |
"/ UnimplementedNativeMethodSignal raise |
440 | 9238 |
|
9239 |
"Created: / 12.11.1998 / 19:13:43 / cg" |
|
482 | 9240 |
"Modified: / 3.12.1998 / 21:41:07 / cg" |
440 | 9241 |
! |
9242 |
||
9243 |
_WMenuPeer_delItem:nativeContext |
|
9244 |
"/ void delItem (int) |
|
493 | 9245 |
|jMenuPeer jMenu menuPanel itemIndex| |
9246 |
||
9247 |
jMenuPeer := nativeContext receiver. |
|
9248 |
menuPanel := jMenuPeer instVarNamed:'pData'. |
|
9249 |
||
9250 |
itemIndex := nativeContext argAt:1. |
|
9251 |
menuPanel remove:itemIndex. |
|
9252 |
||
9253 |
"/ UnimplementedNativeMethodSignal raise |
|
440 | 9254 |
|
9255 |
"Created: / 12.11.1998 / 19:13:30 / cg" |
|
493 | 9256 |
"Modified: / 10.12.1998 / 21:12:29 / cg" |
440 | 9257 |
! |
9258 |
||
9259 |
_WPopupMenuPeer__show:nativeContext |
|
9260 |
"/ void _show (java.awt.Event) |
|
9261 |
UnimplementedNativeMethodSignal raise |
|
9262 |
||
9263 |
"Created: / 12.11.1998 / 19:12:53 / cg" |
|
9264 |
! |
|
9265 |
||
9266 |
_WPopupMenuPeer_createMenu:nativeContext |
|
9267 |
"/ void createMenu (sun.awt.windows.WComponentPeer) |
|
9268 |
UnimplementedNativeMethodSignal raise |
|
9269 |
||
9270 |
"Created: / 12.11.1998 / 19:12:43 / cg" |
|
9271 |
! |
|
9272 |
||
9273 |
_WPrintJob_end:nativeContext |
|
9274 |
"/ void end () |
|
9275 |
UnimplementedNativeMethodSignal raise |
|
9276 |
||
9277 |
"Created: / 12.11.1998 / 19:11:28 / cg" |
|
9278 |
! |
|
9279 |
||
334 | 9280 |
_WScrollPanePeer__getHScrollbarHeight:nativeContext |
9281 |
|scrollPane| |
|
9282 |
||
9283 |
scrollPane := self viewForWPeer:nativeContext. |
|
339 | 9284 |
^ HorizontalScrollBar new preferredExtent y. |
9285 |
||
334 | 9286 |
"Created: / 9.4.1998 / 17:30:56 / cg" |
339 | 9287 |
"Modified: / 10.4.1998 / 14:59:28 / cg" |
341 | 9288 |
! |
334 | 9289 |
|
9290 |
_WScrollPanePeer__getVScrollbarWidth:nativeContext |
|
9291 |
|scrollPane| |
|
9292 |
||
9293 |
scrollPane := self viewForWPeer:nativeContext. |
|
339 | 9294 |
^ ScrollBar new preferredExtent x. |
334 | 9295 |
|
9296 |
"Created: / 9.4.1998 / 17:29:48 / cg" |
|
339 | 9297 |
"Modified: / 10.4.1998 / 15:00:33 / cg" |
334 | 9298 |
! |
9299 |
||
9300 |
_WScrollPanePeer_create:nativeContext |
|
9301 |
|jScrollPanePeer jScrollPane jFrame frame scrollPane |
|
9302 |
lbl| |
|
9303 |
||
9304 |
jScrollPanePeer := nativeContext receiver. |
|
9305 |
jScrollPane := jScrollPanePeer instVarNamed:'target'. |
|
9306 |
||
9307 |
jFrame := nativeContext argAt:1. |
|
9308 |
frame := jFrame instVarNamed:'pData'. |
|
9309 |
||
9310 |
"/ create with a simple view ... |
|
337 | 9311 |
scrollPane := ScrollableView for:JavaView in:frame. |
334 | 9312 |
|
9313 |
self createdWindowsView:scrollPane for:jScrollPanePeer. |
|
9314 |
||
9315 |
WindowCreationTrace == true ifTrue:[ |
|
9316 |
'WScrollPanePeer_create: ' print. frame print. ' -> ' print. scrollPane printNL. |
|
9317 |
]. |
|
9318 |
||
9319 |
"Created: / 9.4.1998 / 17:25:08 / cg" |
|
337 | 9320 |
"Modified: / 9.4.1998 / 22:06:09 / cg" |
334 | 9321 |
! |
9322 |
||
440 | 9323 |
_WScrollPanePeer_getOffset:nativeContext |
9324 |
"/ int getOffset (int) |
|
9325 |
UnimplementedNativeMethodSignal raise |
|
9326 |
||
9327 |
"Created: / 12.11.1998 / 19:16:29 / cg" |
|
9328 |
! |
|
9329 |
||
9330 |
_WScrollPanePeer_getScrollChild:nativeContext |
|
9331 |
"/ java.awt.Component getScrollChild () |
|
9332 |
UnimplementedNativeMethodSignal raise |
|
9333 |
||
9334 |
"Created: / 12.11.1998 / 19:17:00 / cg" |
|
9335 |
! |
|
9336 |
||
334 | 9337 |
_WScrollPanePeer_setInsets:nativeContext |
9338 |
||
9339 |
"Modified: / 9.4.1998 / 17:26:11 / cg" |
|
9340 |
"Created: / 9.4.1998 / 17:29:10 / cg" |
|
9341 |
! |
|
9342 |
||
440 | 9343 |
_WScrollPanePeer_setScrollPosition:nativeContext |
9344 |
"/ void setScrollPosition (int int) |
|
9345 |
UnimplementedNativeMethodSignal raise |
|
9346 |
||
9347 |
"Created: / 12.11.1998 / 19:16:44 / cg" |
|
9348 |
! |
|
9349 |
||
334 | 9350 |
_WScrollPanePeer_setSpans:nativeContext |
9351 |
||
9352 |
"Created: / 9.4.1998 / 17:31:44 / cg" |
|
9353 |
! |
|
9354 |
||
284 | 9355 |
_WScrollbarPeer__setValues:nativeContext |
9356 |
|scrollBar value visibleAmount min max| |
|
9357 |
||
9358 |
scrollBar := self viewForWPeer:nativeContext. |
|
9359 |
||
9360 |
value := nativeContext argAt:1. |
|
9361 |
visibleAmount := nativeContext argAt:2. |
|
9362 |
min := nativeContext argAt:3. |
|
9363 |
max := nativeContext argAt:4. |
|
9364 |
||
374 | 9365 |
(min ~~ 0 or:[max ~~ 100]) ifTrue:[ |
284 | 9366 |
scrollBar thumb start:min stop:max. |
9367 |
]. |
|
9368 |
||
9369 |
scrollBar thumbOrigin:value thumbHeight:visibleAmount. |
|
9370 |
||
9371 |
"Created: / 13.1.1998 / 22:13:57 / cg" |
|
374 | 9372 |
"Modified: / 14.10.1998 / 14:53:00 / cg" |
284 | 9373 |
! |
9374 |
||
9375 |
_WScrollbarPeer_create:nativeContext |
|
9376 |
|jScrollbarPeer jScrollbar jFrame frame scrollBar |
|
334 | 9377 |
min max| |
284 | 9378 |
|
9379 |
jScrollbarPeer := nativeContext receiver. |
|
9380 |
jScrollbar := jScrollbarPeer instVarNamed:'target'. |
|
9381 |
||
9382 |
jFrame := nativeContext argAt:1. |
|
9383 |
frame := jFrame instVarNamed:'pData'. |
|
9384 |
||
9385 |
(jScrollbar instVarNamed:'orientation') == 0 "HORIZONTAL" ifTrue:[ |
|
9386 |
scrollBar := HorizontalScrollBar in:frame. |
|
9387 |
] ifFalse:[ |
|
9388 |
scrollBar := ScrollBar in:frame. |
|
9389 |
]. |
|
9390 |
min := jScrollbar instVarNamed:'minimum'. |
|
9391 |
max := jScrollbar instVarNamed:'maximum'. |
|
9392 |
||
374 | 9393 |
scrollBar scrollDownAction:[ |
9394 |
scrollBar thumbOrigin:(scrollBar thumbOrigin + ((max-min)/10) min:max). |
|
9395 |
jScrollbarPeer perform:#'dragAbsolute(I)V' with:scrollBar thumbOrigin rounded. |
|
9396 |
]. |
|
9397 |
scrollBar scrollUpAction:[ |
|
9398 |
scrollBar thumbOrigin:(scrollBar thumbOrigin - ((max-min)/10) max:min). |
|
9399 |
jScrollbarPeer perform:#'dragAbsolute(I)V' with:scrollBar thumbOrigin rounded. |
|
9400 |
]. |
|
9401 |
scrollBar scrollAction:[:org | |
|
9402 |
jScrollbarPeer perform:#'dragAbsolute(I)V' with:org rounded. |
|
9403 |
]. |
|
284 | 9404 |
self createdWindowsView:scrollBar for:jScrollbarPeer. |
9405 |
||
9406 |
WindowCreationTrace == true ifTrue:[ |
|
9407 |
'WScrollbarPeer_create: ' print. frame print. ' -> ' print. scrollBar printNL. |
|
9408 |
]. |
|
9409 |
||
9410 |
"Created: / 5.1.1998 / 01:53:30 / cg" |
|
374 | 9411 |
"Modified: / 14.10.1998 / 15:36:19 / cg" |
284 | 9412 |
! |
9413 |
||
9414 |
_WScrollbarPeer_setLineIncrement:nativeContext |
|
9415 |
|scrollBar inc| |
|
9416 |
||
374 | 9417 |
Transcript showCR:'JavaVM: WScrollbarPeer_setLineIncrement unimplemented'. |
9418 |
||
284 | 9419 |
scrollBar := self viewForWPeer:nativeContext. |
9420 |
||
9421 |
inc := nativeContext argAt:1. |
|
9422 |
"/ scrollBar thumb lineIncrement:inc. |
|
9423 |
||
9424 |
"Created: / 25.1.1998 / 11:52:19 / cg" |
|
374 | 9425 |
"Modified: / 14.10.1998 / 14:53:56 / cg" |
284 | 9426 |
! |
9427 |
||
9428 |
_WScrollbarPeer_setPageIncrement:nativeContext |
|
9429 |
|scrollBar inc| |
|
9430 |
||
374 | 9431 |
Transcript showCR:'JavaVM: WScrollbarPeer_setPageIncrement unimplemented'. |
9432 |
||
284 | 9433 |
scrollBar := self viewForWPeer:nativeContext. |
9434 |
||
9435 |
inc := nativeContext argAt:1. |
|
9436 |
"/ scrollBar thumb pageIncrement:inc. |
|
9437 |
||
9438 |
"Created: / 25.1.1998 / 11:52:01 / cg" |
|
374 | 9439 |
"Modified: / 14.10.1998 / 14:54:04 / cg" |
284 | 9440 |
! |
9441 |
||
9442 |
_WTextAreaPeer_create:nativeContext |
|
9443 |
|jTextAreaPeer jFrame frame editTextView| |
|
9444 |
||
9445 |
jTextAreaPeer := nativeContext receiver. |
|
9446 |
||
9447 |
jFrame := nativeContext argAt:1. |
|
9448 |
frame := jFrame instVarNamed:'pData'. |
|
9449 |
||
9450 |
editTextView := HVScrollableView for:EditTextView in:frame. |
|
9451 |
||
9452 |
self createdWindowsView:editTextView for:jTextAreaPeer. |
|
9453 |
||
9454 |
WindowCreationTrace == true ifTrue:[ |
|
9455 |
'WTextAreaPeer_create: ' print. frame print. ' -> ' print. editTextView printNL. |
|
9456 |
]. |
|
9457 |
||
9458 |
"Created: / 7.1.1998 / 21:49:49 / cg" |
|
9459 |
"Modified: / 15.1.1998 / 12:56:18 / cg" |
|
9460 |
! |
|
9461 |
||
9462 |
_WTextAreaPeer_insertText:nativeContext |
|
9463 |
|textView pos string jstring| |
|
9464 |
||
9465 |
textView := self viewForWPeer:nativeContext. |
|
329 | 9466 |
(textView isKindOf:ScrollableView) ifTrue:[ |
9467 |
textView := textView scrolledView |
|
9468 |
]. |
|
284 | 9469 |
|
9470 |
jstring := nativeContext argAt:1. |
|
9471 |
string := Java as_ST_String:jstring. |
|
9472 |
pos := nativeContext argAt:2. |
|
9473 |
||
9474 |
textView insert:string at:pos. |
|
329 | 9475 |
textView cursorToCharacterPosition:pos + string size. |
9476 |
textView makeCursorVisible. |
|
9477 |
"/ textView invalidateRepairNow:true. |
|
284 | 9478 |
^ nil |
9479 |
||
9480 |
"Created: / 7.1.1998 / 21:50:23 / cg" |
|
329 | 9481 |
"Modified: / 5.4.1998 / 17:37:24 / cg" |
284 | 9482 |
! |
9483 |
||
440 | 9484 |
_WTextAreaPeer_replaceText:nativeContext |
9485 |
"/ void replaceText (java.lang.String int int) |
|
9486 |
UnimplementedNativeMethodSignal raise |
|
9487 |
||
9488 |
"Created: / 12.11.1998 / 19:11:14 / cg" |
|
9489 |
! |
|
9490 |
||
284 | 9491 |
_WTextComponentPeer_enableEditing:nativeContext |
9492 |
|textView enabled| |
|
9493 |
||
9494 |
textView := self viewForWPeer:nativeContext. |
|
9495 |
enabled := (nativeContext argAt:1) ~~ 0. |
|
9496 |
||
9497 |
^ textView readOnly:enabled not |
|
9498 |
||
9499 |
"Created: / 5.1.1998 / 01:29:38 / cg" |
|
9500 |
"Modified: / 25.1.1998 / 16:29:56 / cg" |
|
9501 |
! |
|
9502 |
||
9503 |
_WTextComponentPeer_getSelectionEnd:nativeContext |
|
9504 |
|textView| |
|
9505 |
||
9506 |
textView := self viewForWPeer:nativeContext. |
|
9507 |
||
9508 |
^ textView characterPositionOfSelectionEnd |
|
9509 |
||
9510 |
"Created: / 8.1.1998 / 17:41:56 / cg" |
|
9511 |
"Modified: / 15.1.1998 / 15:47:18 / cg" |
|
9512 |
! |
|
9513 |
||
9514 |
_WTextComponentPeer_getSelectionStart:nativeContext |
|
9515 |
|textView| |
|
9516 |
||
9517 |
textView := self viewForWPeer:nativeContext. |
|
9518 |
||
9519 |
^ textView characterPositionOfSelection - 1 |
|
9520 |
||
9521 |
"Created: / 15.8.1997 / 15:45:45 / cg" |
|
9522 |
"Modified: / 15.1.1998 / 15:46:51 / cg" |
|
9523 |
! |
|
9524 |
||
9525 |
_WTextComponentPeer_getText:nativeContext |
|
9526 |
|textView string jString| |
|
9527 |
||
9528 |
textView := self viewForWPeer:nativeContext. |
|
9529 |
||
9530 |
string := textView contents asString. |
|
9531 |
jString := Java as_String:string. |
|
9532 |
^ jString |
|
9533 |
||
9534 |
"Created: / 6.1.1998 / 21:05:15 / cg" |
|
9535 |
"Modified: / 8.1.1998 / 17:36:52 / cg" |
|
9536 |
! |
|
9537 |
||
9538 |
_WTextComponentPeer_select:nativeContext |
|
9539 |
|textView selStart selEnd| |
|
9540 |
||
9541 |
textView := self viewForWPeer:nativeContext. |
|
9542 |
selStart := nativeContext argAt:1. |
|
9543 |
selEnd := nativeContext argAt:2. |
|
9544 |
||
9545 |
selStart == selEnd ifTrue:[ |
|
9546 |
"/ clear selection |
|
9547 |
textView unselect. |
|
9548 |
"/ and set caret |
|
9549 |
textView cursorToCharacterPosition:selStart + 1 |
|
9550 |
] ifFalse:[ |
|
9551 |
"/ change selection |
|
9552 |
textView selectFromCharacterPosition:selStart+1 to:selEnd |
|
9553 |
]. |
|
9554 |
||
9555 |
"Created: / 15.8.1997 / 15:45:58 / cg" |
|
9556 |
"Modified: / 15.1.1998 / 21:55:57 / cg" |
|
9557 |
! |
|
9558 |
||
9559 |
_WTextComponentPeer_setText:nativeContext |
|
9560 |
|textView string jstring| |
|
9561 |
||
9562 |
textView := self viewForWPeer:nativeContext. |
|
9563 |
||
9564 |
jstring := nativeContext argAt:1. |
|
494 | 9565 |
string := jstring notNil ifTrue:[Java as_ST_String:jstring] ifFalse:[nil]. |
284 | 9566 |
|
9567 |
textView contents:string. |
|
9568 |
||
9569 |
"Created: / 5.1.1998 / 01:28:23 / cg" |
|
494 | 9570 |
"Modified: / 11.12.1998 / 12:16:46 / cg" |
284 | 9571 |
! |
9572 |
||
9573 |
_WTextFieldPeer_create:nativeContext |
|
9574 |
|jTextFieldPeer jFrame frame editField| |
|
9575 |
||
9576 |
jTextFieldPeer := nativeContext receiver. |
|
9577 |
||
9578 |
jFrame := nativeContext argAt:1. |
|
9579 |
frame := jFrame instVarNamed:'pData'. |
|
9580 |
||
9581 |
editField := EditField in:frame. |
|
9582 |
||
9583 |
self createdWindowsView:editField for:jTextFieldPeer. |
|
9584 |
||
9585 |
editField crAction:[ |
|
419 | 9586 |
jTextFieldPeer perform:#handleAction. |
284 | 9587 |
]. |
9588 |
WindowCreationTrace == true ifTrue:[ |
|
9589 |
'WTextFieldPeer_create: ' print. frame print. ' -> ' print. editField printNL. |
|
9590 |
]. |
|
9591 |
||
9592 |
"Created: / 5.1.1998 / 01:27:37 / cg" |
|
419 | 9593 |
"Modified: / 4.11.1998 / 21:07:30 / cg" |
284 | 9594 |
! |
9595 |
||
9596 |
_WTextFieldPeer_setEchoCharacter:nativeContext |
|
9597 |
|editField char| |
|
9598 |
||
9599 |
editField := self viewForWPeer:nativeContext. |
|
9600 |
||
9601 |
char := nativeContext argAt:1. |
|
9602 |
editField passwordCharacter:(Character value:char). |
|
9603 |
||
9604 |
"Created: / 25.1.1998 / 16:28:30 / cg" |
|
9605 |
! |
|
9606 |
||
440 | 9607 |
_WToolkit_beep:nativeContext |
9608 |
"/ void beep () |
|
494 | 9609 |
|
9610 |
Screen current beep |
|
440 | 9611 |
|
9612 |
"Created: / 12.11.1998 / 19:09:23 / cg" |
|
494 | 9613 |
"Modified: / 11.12.1998 / 12:15:23 / cg" |
440 | 9614 |
! |
9615 |
||
284 | 9616 |
_WToolkit_eventLoop:nativeContext |
9617 |
JavaEventThread := Processor activeProcess. |
|
9618 |
[ |
|
9619 |
[true] whileTrue:[ |
|
9620 |
AbortSignal handle:[:ex | |
|
9621 |
ex return |
|
9622 |
] do:[ |
|
9623 |
self doWindowsEventThread. |
|
9624 |
] |
|
9625 |
]. |
|
9626 |
] valueNowOrOnUnwindDo:[ |
|
9627 |
JavaEventThread := nil. |
|
9628 |
]. |
|
9629 |
||
9630 |
"Created: / 6.1.1998 / 21:01:44 / cg" |
|
9631 |
"Modified: / 15.1.1998 / 19:48:55 / cg" |
|
9632 |
! |
|
9633 |
||
405 | 9634 |
_WToolkit_getComboHeightOffset:nativeContext |
9635 |
^ 0 |
|
9636 |
||
9637 |
"Modified: / 20.3.1997 / 13:50:04 / cg" |
|
9638 |
"Created: / 22.10.1998 / 00:59:14 / cg" |
|
9639 |
! |
|
9640 |
||
284 | 9641 |
_WToolkit_getScreenHeight:nativeContext |
9642 |
^ Screen current height |
|
9643 |
||
9644 |
"Modified: / 20.3.1997 / 13:50:04 / cg" |
|
9645 |
"Created: / 13.1.1998 / 09:24:45 / cg" |
|
9646 |
! |
|
9647 |
||
9648 |
_WToolkit_getScreenResolution:nativeContext |
|
9649 |
^ Screen current resolution x rounded |
|
9650 |
||
9651 |
"Modified: / 20.3.1997 / 13:50:04 / cg" |
|
9652 |
"Created: / 17.1.1998 / 21:54:48 / cg" |
|
9653 |
! |
|
9654 |
||
9655 |
_WToolkit_getScreenWidth:nativeContext |
|
9656 |
^ Screen current width |
|
9657 |
||
9658 |
"Modified: / 20.3.1997 / 13:50:04 / cg" |
|
9659 |
"Created: / 13.1.1998 / 09:24:37 / cg" |
|
9660 |
! |
|
9661 |
||
9662 |
_WToolkit_init:nativeContext |
|
9663 |
||
9664 |
"Created: / 3.1.1998 / 02:30:57 / cg" |
|
9665 |
! |
|
9666 |
||
9667 |
_WToolkit_loadSystemColors:nativeContext |
|
9668 |
"/ self halt. |
|
9669 |
||
9670 |
"Modified: / 18.3.1997 / 18:43:26 / cg" |
|
9671 |
"Created: / 5.1.1998 / 02:19:09 / cg" |
|
9672 |
! |
|
9673 |
||
440 | 9674 |
_WToolkit_makeColorModel:nativeContext |
9675 |
"/ java.awt.image.ColorModel makeColorModel () |
|
9676 |
UnimplementedNativeMethodSignal raise |
|
9677 |
||
9678 |
"Created: / 12.11.1998 / 19:08:47 / cg" |
|
9679 |
! |
|
9680 |
||
9681 |
_WToolkit_sync:nativeContext |
|
9682 |
"/ void sync () |
|
9683 |
UnimplementedNativeMethodSignal raise |
|
9684 |
||
9685 |
"Created: / 12.11.1998 / 19:09:14 / cg" |
|
9686 |
! |
|
9687 |
||
284 | 9688 |
_WWindowPeer__setResizable:nativeContext |
9689 |
|view onOff| |
|
9690 |
||
9691 |
view := self viewForWPeer:nativeContext. |
|
9692 |
||
9693 |
onOff := (nativeContext argAt:1) == 1. |
|
9694 |
view isTopView ifTrue:[ |
|
9695 |
onOff ifTrue:[ |
|
9696 |
view minExtent:10@10. |
|
9697 |
view maxExtent:(Screen current extent). |
|
9698 |
] ifFalse:[ |
|
9699 |
view minExtent:view extent. |
|
9700 |
view maxExtent:view extent. |
|
9701 |
] |
|
9702 |
] ifFalse:[ |
|
9703 |
(view isMemberOf:JavaEmbeddedFrameView) ifFalse:[ |
|
9704 |
self halt. |
|
9705 |
] |
|
9706 |
]. |
|
9707 |
||
9708 |
"/ 'JAVA: WWindowPeer_setResizable: ' print. view print. ' yes/no: ' print. onOff printNL. |
|
9709 |
||
9710 |
^ nil |
|
9711 |
||
9712 |
"Created: / 5.1.1998 / 00:57:59 / cg" |
|
9713 |
"Modified: / 16.1.1998 / 18:08:00 / cg" |
|
9714 |
! |
|
9715 |
||
9716 |
_WWindowPeer__setTitle:nativeContext |
|
9717 |
|view jString string| |
|
9718 |
||
9719 |
view := self viewForWPeer:nativeContext. |
|
9720 |
||
9721 |
jString := nativeContext argAt:1. |
|
9722 |
string := Java as_ST_String:jString. |
|
9723 |
||
9724 |
"/ 'JAVA: WWindowPeer_pSetTitle: ' print. string print. ' ' print. view printNL. |
|
9725 |
||
9726 |
view label:string. |
|
9727 |
^ nil |
|
9728 |
||
9729 |
"Created: / 5.1.1998 / 00:57:17 / cg" |
|
9730 |
"Modified: / 8.1.1998 / 17:37:41 / cg" |
|
9731 |
! |
|
9732 |
||
440 | 9733 |
_WWindowPeer_create:nativeContext |
9734 |
"/ void create (sun.awt.windows.WComponentPeer) |
|
482 | 9735 |
|jWindowPeer jWindow top window pDataIdx| |
9736 |
||
9737 |
jWindowPeer := nativeContext receiver. |
|
9738 |
||
9739 |
jWindow := jWindowPeer instVarNamed:'target'. |
|
9740 |
window := jWindowPeer instVarNamed:'pData'. |
|
9741 |
||
9742 |
(window notNil and:[window ~~ 0]) ifTrue:[ |
|
9743 |
WindowCreationTrace == true ifTrue:[ |
|
9744 |
'JAVA: window view already created: ' infoPrint. |
|
9745 |
jWindowPeer class name infoPrintCR. |
|
9746 |
]. |
|
9747 |
] ifFalse:[ |
|
9748 |
"/ OLD |
|
9749 |
"/ window := StandardSystemView new. |
|
9750 |
"/ self createdWindowsView:window for:jWindowPeer. |
|
9751 |
"/ JavaWindowGroup addTopView:window. |
|
9752 |
||
9753 |
window := JavaPopUpView new. |
|
483 | 9754 |
window borderWidth:0. |
9755 |
window level:0. |
|
482 | 9756 |
window delegate:self. |
9757 |
window javaPeer:jWindowPeer. |
|
9758 |
self createdWindowsView:window for:jWindowPeer. |
|
9759 |
JavaWindowGroup addTopView:window. |
|
9760 |
||
9761 |
"/ top := StandardSystemView new. |
|
9762 |
"/ window := JavaView origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
9763 |
"/ window delegate:self. |
|
9764 |
"/ window javaPeer:jWindowPeer. |
|
9765 |
"/ self createdWindowsView:window for:jWindowPeer. |
|
9766 |
"/ JavaWindowGroup addTopView:top. |
|
9767 |
||
9768 |
]. |
|
9769 |
||
9770 |
WindowCreationTrace == true ifTrue:[ |
|
9771 |
'JAVA: WWindowPeer_create: ' print. jWindowPeer displayString print. |
|
9772 |
' window: ' print. window printNL. |
|
9773 |
]. |
|
9774 |
||
9775 |
"Created: / 4.1.1998 / 17:56:39 / cg" |
|
483 | 9776 |
"Modified: / 4.12.1998 / 17:37:59 / cg" |
440 | 9777 |
! |
9778 |
||
9779 |
_WWindowPeer_getContainerElement:nativeContext |
|
9780 |
"/ java.awt.Component getContainerElement (java.awt.Container int) |
|
9781 |
UnimplementedNativeMethodSignal raise |
|
9782 |
||
9783 |
"Created: / 12.11.1998 / 19:10:54 / cg" |
|
9784 |
! |
|
9785 |
||
342 | 9786 |
_WWindowPeer_toBack:nativeContext |
9787 |
|view| |
|
9788 |
||
9789 |
view := self viewForWPeer:nativeContext. |
|
9790 |
view lower. |
|
9791 |
||
9792 |
"Created: / 7.5.1998 / 00:23:03 / cg" |
|
9793 |
! |
|
9794 |
||
337 | 9795 |
_WWindowPeer_toFront:nativeContext |
9796 |
|view| |
|
9797 |
||
9798 |
view := self viewForWPeer:nativeContext. |
|
9799 |
view raise. |
|
9800 |
||
9801 |
"Created: / 9.4.1998 / 22:17:28 / cg" |
|
9802 |
! |
|
9803 |
||
284 | 9804 |
_WWindowPeer_updateInsets:nativeContext |
9805 |
"/ self halt. |
|
9806 |
||
9807 |
"Modified: / 18.3.1997 / 18:43:18 / cg" |
|
9808 |
"Created: / 4.1.1998 / 18:09:04 / cg" |
|
9809 |
! ! |
|
9810 |
||
9811 |
!JavaVM class methodsFor:'native - sun.awt.windows - jdk1.2'! |
|
9812 |
||
9813 |
_WFramePeer_setTitle:nativeContext |
|
9814 |
|view jString string| |
|
9815 |
||
9816 |
view := self viewForWPeer:nativeContext. |
|
9817 |
||
9818 |
jString := nativeContext argAt:1. |
|
9819 |
string := Java as_ST_String:jString. |
|
9820 |
||
9821 |
"/ 'JAVA: WFramePeer_pSetTitle: ' print. string print. ' ' print. view printNL. |
|
9822 |
||
9823 |
view label:string. |
|
9824 |
^ nil |
|
9825 |
||
9826 |
"Modified: / 8.1.1998 / 17:37:41 / cg" |
|
9827 |
"Created: / 27.1.1998 / 21:42:57 / cg" |
|
9828 |
! |
|
9829 |
||
9830 |
_WPanelPeer_calculateInsets:nativeContext |
|
9831 |
"/ new with jdk1.2 ... |
|
9832 |
||
9833 |
"Created: / 27.1.1998 / 21:40:00 / cg" |
|
9834 |
! ! |
|
9835 |
||
457 | 9836 |
!JavaVM class methodsFor:'native - sun.awt.windows - ms'! |
9837 |
||
9838 |
_MCanvasPeer_create:nativeContext |
|
9839 |
|jCanvasPeer jFrame frame subView| |
|
9840 |
||
9841 |
jCanvasPeer := nativeContext receiver. |
|
9842 |
||
9843 |
jFrame := nativeContext argAt:1. |
|
9844 |
jFrame isNil ifTrue:[ |
|
9845 |
self halt:'no frame in canvasPeer create'. |
|
9846 |
self internalError:'no frame in canvasPeer create'. |
|
9847 |
^ self. |
|
9848 |
]. |
|
9849 |
frame := jFrame instVarNamed:'pData'. |
|
9850 |
||
9851 |
subView := JavaView in:frame. |
|
9852 |
subView delegate:self. |
|
9853 |
subView javaPeer:jCanvasPeer. |
|
9854 |
||
9855 |
self createdWindowsView:subView for:jCanvasPeer. |
|
9856 |
||
9857 |
WindowCreationTrace == true ifTrue:[ |
|
9858 |
'WCanvasPeer_create: ' print. frame print. ' -> ' print. subView printNL. |
|
9859 |
]. |
|
9860 |
||
9861 |
"Modified: / 16.1.1998 / 13:40:00 / cg" |
|
9862 |
"Created: / 18.11.1998 / 00:14:44 / cg" |
|
9863 |
! |
|
9864 |
||
9865 |
_MComponentPeer_pReshape:nativeContext |
|
9866 |
self commonReshapeComponent:nativeContext |
|
9867 |
||
9868 |
"Created: / 18.11.1998 / 00:18:17 / cg" |
|
9869 |
! |
|
9870 |
||
9871 |
_MComponentPeer_setBackground:nativeContext |
|
9872 |
|jClr rgb clr view| |
|
9873 |
||
9874 |
view := self viewForWPeer:nativeContext. |
|
9875 |
||
9876 |
jClr := nativeContext argAt:1. |
|
9877 |
rgb := jClr instVarNamed:'value'. |
|
9878 |
"/ self halt. |
|
9879 |
clr := Color rgbValue:rgb. |
|
9880 |
||
9881 |
||
9882 |
clr := clr on:(view device). |
|
9883 |
||
9884 |
(view isKindOf:ScrollableView) ifTrue:[ |
|
9885 |
view := view scrolledView |
|
9886 |
]. |
|
9887 |
view viewBackground:clr. |
|
9888 |
view backgroundPaint:clr. |
|
9889 |
||
9890 |
"Created: / 17.11.1998 / 23:49:41 / cg" |
|
9891 |
! |
|
9892 |
||
9893 |
_MComponentPeer_setFont:nativeContext |
|
9894 |
|view| |
|
9895 |
||
9896 |
view := self viewForWPeer:nativeContext. |
|
9897 |
"/ self halt. |
|
9898 |
||
9899 |
"Modified: / 25.1.1998 / 01:22:19 / cg" |
|
9900 |
"Created: / 17.11.1998 / 23:43:48 / cg" |
|
9901 |
! |
|
9902 |
||
9903 |
_MComponentPeer_setForeground:nativeContext |
|
9904 |
|jClr rgb clr view| |
|
9905 |
||
9906 |
view := self viewForWPeer:nativeContext. |
|
9907 |
||
9908 |
jClr := nativeContext argAt:1. |
|
9909 |
rgb := jClr instVarNamed:'value'. |
|
9910 |
"/ self halt. |
|
9911 |
clr := Color rgbValue:rgb. |
|
9912 |
||
9913 |
clr := clr on:(view device). |
|
9914 |
||
9915 |
view paint:clr. |
|
9916 |
||
9917 |
"Created: / 17.11.1998 / 23:50:31 / cg" |
|
9918 |
"Modified: / 17.11.1998 / 23:57:29 / cg" |
|
9919 |
! |
|
9920 |
||
9921 |
_MFramePeer_getWindowBackgroundColor:nativeContext |
|
9922 |
^ View defaultViewBackgroundColor rgbValue. |
|
9923 |
||
9924 |
"Created: / 17.11.1998 / 23:55:42 / cg" |
|
9925 |
! |
|
9926 |
||
9927 |
_MFramePeer_pShow:nativeContext |
|
9928 |
|view| |
|
9929 |
||
9930 |
view := self viewForWPeer:nativeContext. |
|
9931 |
||
9932 |
"/ frame views are under my browsers own control |
|
9933 |
(view isMemberOf:JavaEmbeddedFrameView) ifFalse:[ |
|
9934 |
view beVisible. |
|
9935 |
view realize. |
|
9936 |
]. |
|
9937 |
||
9938 |
"/ view windowGroup notNil ifTrue:[ |
|
9939 |
"/ windowServer addGroup:(view windowGroup) |
|
9940 |
"/ ]. |
|
9941 |
||
9942 |
^ nil |
|
9943 |
||
9944 |
"/ self halt. |
|
9945 |
||
9946 |
"Modified: / 25.1.1998 / 09:54:07 / cg" |
|
9947 |
"Created: / 18.11.1998 / 00:19:59 / cg" |
|
9948 |
! |
|
9949 |
||
9950 |
_MFramePeer_setInsets:nativeContext |
|
9951 |
||
9952 |
"Created: / 17.11.1998 / 23:55:32 / cg" |
|
9953 |
! |
|
9954 |
||
9955 |
_MFramePeer_setResizable:nativeContext |
|
9956 |
|view onOff| |
|
9957 |
||
9958 |
view := self viewForWPeer:nativeContext. |
|
9959 |
||
9960 |
onOff := (nativeContext argAt:1) == 1. |
|
9961 |
view isTopView ifTrue:[ |
|
9962 |
onOff ifTrue:[ |
|
9963 |
view minExtent:10@10. |
|
9964 |
view maxExtent:(Screen current extent). |
|
9965 |
] ifFalse:[ |
|
9966 |
view minExtent:view extent. |
|
9967 |
view maxExtent:view extent. |
|
9968 |
] |
|
9969 |
] ifFalse:[ |
|
9970 |
(view isMemberOf:JavaEmbeddedFrameView) ifFalse:[ |
|
9971 |
self halt. |
|
9972 |
] |
|
9973 |
]. |
|
9974 |
||
9975 |
"/ 'JAVA: WWindowPeer_setResizable: ' print. view print. ' yes/no: ' print. onOff printNL. |
|
9976 |
||
9977 |
^ nil |
|
9978 |
||
9979 |
"Modified: / 16.1.1998 / 18:08:00 / cg" |
|
9980 |
"Created: / 17.11.1998 / 23:51:45 / cg" |
|
9981 |
! |
|
9982 |
||
9983 |
_MToolkit_callbackLoop:nativeContext |
|
9984 |
|toolKit| |
|
9985 |
||
9986 |
toolKit := nativeContext receiver. |
|
9987 |
^ self. |
|
9988 |
self halt. |
|
9989 |
self wakeup:toolKit. |
|
9990 |
self halt. |
|
9991 |
||
9992 |
JavaEventThread := Processor activeProcess. |
|
9993 |
[ |
|
9994 |
[true] whileTrue:[ |
|
9995 |
AbortSignal handle:[:ex | |
|
9996 |
ex return |
|
9997 |
] do:[ |
|
9998 |
self doWindowsEventThread. |
|
9999 |
] |
|
10000 |
]. |
|
10001 |
] valueNowOrOnUnwindDo:[ |
|
10002 |
JavaEventThread := nil. |
|
10003 |
]. |
|
10004 |
||
10005 |
"Created: / 17.11.1998 / 23:58:33 / cg" |
|
10006 |
"Modified: / 18.11.1998 / 00:13:19 / cg" |
|
10007 |
! |
|
10008 |
||
10009 |
_MToolkit_eventLoop:nativeContext |
|
10010 |
|toolKit| |
|
10011 |
||
10012 |
toolKit := nativeContext receiver. |
|
10013 |
||
10014 |
self wakeup:toolKit. |
|
10015 |
self halt. |
|
10016 |
||
10017 |
JavaEventThread := Processor activeProcess. |
|
10018 |
[ |
|
10019 |
[true] whileTrue:[ |
|
10020 |
AbortSignal handle:[:ex | |
|
10021 |
ex return |
|
10022 |
] do:[ |
|
10023 |
self doWindowsEventThread. |
|
10024 |
] |
|
10025 |
]. |
|
10026 |
] valueNowOrOnUnwindDo:[ |
|
10027 |
JavaEventThread := nil. |
|
10028 |
]. |
|
10029 |
||
10030 |
"Created: / 17.11.1998 / 23:04:29 / cg" |
|
10031 |
"Modified: / 18.11.1998 / 00:11:29 / cg" |
|
10032 |
! ! |
|
10033 |
||
380 | 10034 |
!JavaVM class methodsFor:'native - sun.awt.windows - ns4.0'! |
10035 |
||
10036 |
_WComponentPeer_setBackground:nativeContext |
|
10037 |
|jClr rgb clr view| |
|
10038 |
||
10039 |
view := self viewForWPeer:nativeContext. |
|
10040 |
||
10041 |
jClr := nativeContext argAt:1. |
|
10042 |
rgb := jClr instVarNamed:'value'. |
|
10043 |
"/ self halt. |
|
10044 |
clr := Color rgbValue:rgb. |
|
10045 |
||
10046 |
||
10047 |
clr := clr on:(view device). |
|
10048 |
||
10049 |
"/ (view superView isMemberOf:JavaEmbeddedFrameView) ifTrue:[ |
|
10050 |
"/ view viewBackground:(view superView viewBackground). |
|
10051 |
"/ view backgroundPaint:(view superView viewBackground). |
|
10052 |
"/ ] ifFalse:[ |
|
10053 |
"/ (view isMemberOf:JavaView) ifTrue:[ |
|
10054 |
"/ view viewBackground:clr. |
|
10055 |
"/ view backgroundPaint:clr. |
|
10056 |
"/ ] |
|
10057 |
"/ ]. |
|
10058 |
||
10059 |
(view isKindOf:ScrollableView) ifTrue:[ |
|
10060 |
view := view scrolledView |
|
10061 |
]. |
|
10062 |
view viewBackground:clr. |
|
10063 |
view backgroundPaint:clr. |
|
10064 |
||
10065 |
"Created: / 16.10.1998 / 02:16:31 / cg" |
|
10066 |
"Modified: / 16.10.1998 / 02:26:29 / cg" |
|
10067 |
! |
|
10068 |
||
10069 |
_WComponentPeer_setForeground:nativeContext |
|
10070 |
|jClr rgb clr view| |
|
10071 |
||
10072 |
view := self viewForWPeer:nativeContext. |
|
10073 |
||
10074 |
jClr := nativeContext argAt:1. |
|
10075 |
rgb := jClr instVarNamed:'value'. |
|
10076 |
"/ self halt. |
|
10077 |
clr := Color rgbValue:rgb. |
|
10078 |
||
10079 |
||
10080 |
clr := clr on:(view device). |
|
10081 |
||
10082 |
(view isKindOf:ScrollableView) ifTrue:[ |
|
10083 |
view := view scrolledView |
|
10084 |
]. |
|
10085 |
view paint:clr. |
|
10086 |
||
10087 |
"Created: / 16.10.1998 / 02:18:58 / cg" |
|
10088 |
"Modified: / 16.10.1998 / 02:26:37 / cg" |
|
10089 |
! |
|
10090 |
||
10091 |
_WContainerPeer_calculateInsets:nativeContext |
|
10092 |
"/ new with ns4.0 ... |
|
10093 |
||
10094 |
"Created: / 16.10.1998 / 02:12:59 / cg" |
|
10095 |
! |
|
10096 |
||
10097 |
_WFramePeer_setResizable:nativeContext |
|
10098 |
|view onOff| |
|
10099 |
||
10100 |
view := self viewForWPeer:nativeContext. |
|
10101 |
||
10102 |
onOff := (nativeContext argAt:1) == 1. |
|
10103 |
view isTopView ifTrue:[ |
|
10104 |
onOff ifTrue:[ |
|
10105 |
view minExtent:10@10. |
|
10106 |
view maxExtent:(Screen current extent). |
|
10107 |
] ifFalse:[ |
|
10108 |
view minExtent:view extent. |
|
10109 |
view maxExtent:view extent. |
|
10110 |
] |
|
10111 |
] ifFalse:[ |
|
10112 |
(view isMemberOf:JavaEmbeddedFrameView) ifFalse:[ |
|
10113 |
self halt. |
|
10114 |
] |
|
10115 |
]. |
|
10116 |
||
10117 |
"/ 'JAVA: WWindowPeer_setResizable: ' print. view print. ' yes/no: ' print. onOff printNL. |
|
10118 |
||
10119 |
^ nil |
|
10120 |
||
10121 |
"Modified: / 16.1.1998 / 18:08:00 / cg" |
|
10122 |
"Created: / 16.10.1998 / 02:21:34 / cg" |
|
10123 |
! ! |
|
10124 |
||
440 | 10125 |
!JavaVM class methodsFor:'native - sun.misc'! |
10126 |
||
10127 |
_VM_getState:nativeContext |
|
10128 |
"/ int getState () |
|
10129 |
UnimplementedNativeMethodSignal raise |
|
10130 |
||
10131 |
"Created: / 12.11.1998 / 19:06:44 / cg" |
|
10132 |
! |
|
10133 |
||
448 | 10134 |
_VM_resetJavaMonitor:nativeContext |
10135 |
"/ void resetJavaMonitor () |
|
10136 |
UnimplementedNativeMethodSignal raise |
|
10137 |
||
10138 |
"Created: / 14.11.1998 / 10:43:23 / cg" |
|
10139 |
! |
|
10140 |
||
10141 |
_VM_resumeJavaMonitor:nativeContext |
|
10142 |
"/ void resumeJavaMonitor () |
|
10143 |
UnimplementedNativeMethodSignal raise |
|
10144 |
||
10145 |
"Created: / 14.11.1998 / 10:42:49 / cg" |
|
10146 |
! |
|
10147 |
||
10148 |
_VM_suspendJavaMonitor:nativeContext |
|
10149 |
"/ void suspendJavaMonitor () |
|
10150 |
UnimplementedNativeMethodSignal raise |
|
10151 |
||
10152 |
"Created: / 14.11.1998 / 10:43:07 / cg" |
|
10153 |
! |
|
10154 |
||
440 | 10155 |
_VM_threadsSuspended:nativeContext |
10156 |
"/ boolean threadsSuspended () |
|
10157 |
UnimplementedNativeMethodSignal raise |
|
10158 |
||
10159 |
"Created: / 12.11.1998 / 19:07:10 / cg" |
|
10160 |
! |
|
10161 |
||
10162 |
_VM_unsuspendSomeThreads:nativeContext |
|
10163 |
"/ void unsuspendSomeThreads () |
|
10164 |
UnimplementedNativeMethodSignal raise |
|
10165 |
||
10166 |
"Created: / 12.11.1998 / 19:07:29 / cg" |
|
10167 |
! |
|
10168 |
||
10169 |
_VM_unsuspendThreads:nativeContext |
|
10170 |
"/ void unsuspendThreads () |
|
10171 |
UnimplementedNativeMethodSignal raise |
|
10172 |
||
10173 |
"Created: / 12.11.1998 / 19:07:20 / cg" |
|
448 | 10174 |
! |
10175 |
||
10176 |
_VM_writeJavaMonitorReport:nativeContext |
|
10177 |
"/ void writeJavaMonitorReport () |
|
10178 |
UnimplementedNativeMethodSignal raise |
|
10179 |
||
10180 |
"Created: / 14.11.1998 / 10:43:37 / cg" |
|
440 | 10181 |
! ! |
10182 |
||
253 | 10183 |
!JavaVM class methodsFor:'semaphores & monitors'! |
10184 |
||
10185 |
monitorFor:someObject |
|
10186 |
|mon| |
|
10187 |
||
10188 |
LockTableAccess critical:[ |
|
261 | 10189 |
mon := LockTable at:someObject ifAbsent:nil. |
10190 |
mon isNil ifTrue:[ |
|
10191 |
LockTable at:someObject put:(mon := Monitor new) |
|
10192 |
] |
|
253 | 10193 |
]. |
10194 |
^ mon |
|
10195 |
||
10196 |
"Created: / 2.1.1998 / 19:01:52 / cg" |
|
10197 |
! |
|
10198 |
||
10199 |
releaseAndSignalForAllSemaphoreFor:someObject |
|
10200 |
|sema| |
|
10201 |
||
10202 |
WaitTableAccess critical:[ |
|
306 | 10203 |
sema := WaitTable at:someObject ifAbsent:nil. |
10204 |
"/ sema notNil ifTrue:[ |
|
10205 |
"/ WaitTable removeKey:someObject |
|
10206 |
"/ ] |
|
253 | 10207 |
]. |
10208 |
||
10209 |
sema notNil ifTrue:[ |
|
306 | 10210 |
sema signalForAll |
253 | 10211 |
] |
10212 |
||
10213 |
"Created: / 2.1.1998 / 18:21:51 / cg" |
|
306 | 10214 |
"Modified: / 3.2.1998 / 16:11:58 / cg" |
253 | 10215 |
! |
10216 |
||
10217 |
releaseAndSignalSemaphoreFor:someObject |
|
10218 |
|sema| |
|
10219 |
||
10220 |
WaitTableAccess critical:[ |
|
306 | 10221 |
sema := WaitTable at:someObject ifAbsent:nil. |
10222 |
"/ sema notNil ifTrue:[ |
|
10223 |
"/ WaitTable removeKey:someObject |
|
10224 |
"/ ] |
|
253 | 10225 |
]. |
10226 |
||
10227 |
sema notNil ifTrue:[ |
|
306 | 10228 |
sema signal |
253 | 10229 |
] |
10230 |
||
10231 |
"Created: / 2.1.1998 / 18:20:20 / cg" |
|
306 | 10232 |
"Modified: / 3.2.1998 / 16:11:51 / cg" |
253 | 10233 |
! |
10234 |
||
10235 |
releaseSemaphoreFor:someObject |
|
10236 |
WaitTableAccess critical:[ |
|
261 | 10237 |
WaitTable removeKey:someObject ifAbsent:nil |
253 | 10238 |
] |
10239 |
||
10240 |
"Created: / 2.1.1998 / 18:17:14 / cg" |
|
10241 |
"Modified: / 2.1.1998 / 21:52:03 / cg" |
|
10242 |
! |
|
10243 |
||
10244 |
semaphoreFor:someObject |
|
10245 |
|sema| |
|
10246 |
||
10247 |
WaitTableAccess critical:[ |
|
261 | 10248 |
sema := WaitTable at:someObject ifAbsent:nil. |
10249 |
sema isNil ifTrue:[ |
|
10250 |
WaitTable at:someObject put:(sema := Semaphore new) |
|
10251 |
] |
|
253 | 10252 |
]. |
10253 |
^ sema |
|
10254 |
||
10255 |
"Created: / 2.1.1998 / 18:15:59 / cg" |
|
10256 |
"Modified: / 2.1.1998 / 18:20:31 / cg" |
|
508 | 10257 |
! |
10258 |
||
10259 |
waitFor:sema state:pState timeOut:tmo |
|
10260 |
"wait" |
|
10261 |
||
10262 |
|enteredMonitors| |
|
10263 |
||
10264 |
"/ temporarily leave all entered monitors. |
|
10265 |
||
10266 |
enteredMonitors := self enteredMonitors. |
|
10267 |
||
10268 |
enteredMonitors size > 0 ifTrue:[ |
|
10269 |
MonitorTrace ifTrue:[ |
|
10270 |
('====> wait - exit ' , enteredMonitors size printString , ' monitors in ' , Processor activeProcess name , ' ...') infoPrintCR. |
|
10271 |
]. |
|
10272 |
enteredMonitors do:[:handle | |
|
10273 |
|mon| |
|
10274 |
||
10275 |
mon := LockTable at:handle ifAbsent:nil. |
|
10276 |
mon isNil ifTrue:[ |
|
10277 |
self halt:'no monitor in wait'. |
|
10278 |
] ifFalse:[ |
|
10279 |
MonitorTrace ifTrue:[ |
|
10280 |
('====> wait - exit monitor for ' , handle displayString , ' in ' , Processor activeProcess name , ' ...') infoPrintCR. |
|
10281 |
]. |
|
10282 |
mon exit. |
|
10283 |
]. |
|
10284 |
]. |
|
10285 |
]. |
|
10286 |
||
10287 |
Processor activeProcess state:pState. |
|
10288 |
(tmo isNil or:[tmo = 0]) ifTrue:[ |
|
10289 |
sema wait. |
|
10290 |
] ifFalse:[ |
|
10291 |
sema waitWithTimeout:tmo / 1000. |
|
10292 |
]. |
|
10293 |
||
10294 |
"/ re-enter monitors. |
|
10295 |
||
10296 |
enteredMonitors size > 0 ifTrue:[ |
|
10297 |
MonitorTrace ifTrue:[ |
|
10298 |
('====> wait - reenter ' , enteredMonitors size printString , ' monitors in ' , Processor activeProcess name , ' ...') infoPrintCR. |
|
10299 |
]. |
|
10300 |
enteredMonitors do:[:handle | |
|
10301 |
|mon| |
|
10302 |
||
10303 |
LockTableAccess critical:[ |
|
10304 |
mon := LockTable at:handle ifAbsent:nil. |
|
10305 |
mon isNil ifTrue:[ |
|
10306 |
LockTable at:handle put:(mon := Monitor new) |
|
10307 |
] |
|
10308 |
]. |
|
10309 |
MonitorTrace ifTrue:[ |
|
10310 |
('====> wait - reenter monitor for ' , handle displayString , ' in ' , Processor activeProcess name , ' ...') infoPrintCR. |
|
10311 |
]. |
|
10312 |
mon enter. |
|
10313 |
] |
|
10314 |
]. |
|
10315 |
||
10316 |
"Created: / 30.12.1998 / 19:19:35 / cg" |
|
253 | 10317 |
! ! |
10318 |
||
10319 |
!JavaVM class methodsFor:'vm support'! |
|
10320 |
||
10321 |
monitorEnter:someObject |
|
10322 |
| mon thisProcess| |
|
10323 |
||
10324 |
someObject isNil ifTrue:[ |
|
261 | 10325 |
self halt |
253 | 10326 |
]. |
10327 |
||
10328 |
mon := self monitorFor:someObject. |
|
10329 |
||
10330 |
MonitorTrace ifTrue:[ |
|
261 | 10331 |
('====> entering monitor for ' , someObject displayString , ' in ' , Processor activeProcess name , ' ...') printCR. |
253 | 10332 |
]. |
10333 |
mon enter. |
|
10334 |
MonitorTrace ifTrue:[ |
|
261 | 10335 |
('====> entered it in ' , Processor activeProcess name , ' ...') printCR. |
253 | 10336 |
]. |
10337 |
||
10338 |
self enteredMonitors add:someObject. |
|
10339 |
||
10340 |
"Created: / 2.1.1998 / 23:44:49 / cg" |
|
10341 |
"Modified: / 3.1.1998 / 03:05:02 / cg" |
|
10342 |
! |
|
10343 |
||
10344 |
monitorExit:someObject |
|
10345 |
| mon thisProcess| |
|
10346 |
||
10347 |
someObject isNil ifTrue:[ |
|
261 | 10348 |
self halt |
253 | 10349 |
]. |
10350 |
||
10351 |
mon := self monitorFor:someObject. |
|
10352 |
||
10353 |
MonitorTrace ifTrue:[ |
|
261 | 10354 |
('====> leaving monitor for ' , someObject displayString , ' in ' , Processor activeProcess name , ' ...') printCR. |
253 | 10355 |
]. |
10356 |
mon exit. |
|
10357 |
MonitorTrace ifTrue:[ |
|
261 | 10358 |
('====> left it in ' , Processor activeProcess name , ' ...') printCR. |
253 | 10359 |
]. |
10360 |
||
10361 |
"/ enteredMonitorHandles isNil ifTrue:[ |
|
10362 |
"/ self halt:'oops - no monitor entered'. |
|
10363 |
"/ ]. |
|
10364 |
||
10365 |
self enteredMonitors removeLast ~~ someObject ifTrue:[ |
|
261 | 10366 |
self halt:'oops - monitor enter/exit nesting wrong' |
253 | 10367 |
]. |
10368 |
||
10369 |
"Created: / 2.1.1998 / 23:47:28 / cg" |
|
10370 |
"Modified: / 3.1.1998 / 03:05:18 / cg" |
|
10371 |
! ! |
|
10372 |
||
255 | 10373 |
!JavaVM class methodsFor:'windows - events'! |
10374 |
||
10375 |
awtEventsForEvent:anEvent javaWindow:jWin |
|
10376 |
"given an ST/X event, create corresponding AWT event(s) for it" |
|
10377 |
||
10378 |
|jEv jEv1 jEv2 |
|
261 | 10379 |
modifiers key keyChar untranslatedKey id |
466 | 10380 |
type x y w h view menu resized moved |
255 | 10381 |
eventArgs clickCount jRect |
10382 |
jKeyEventClass jInputEventClass jMouseEventClass |
|
10383 |
jWindowEventClass jPaintEventClass jComponentEventClass| |
|
10384 |
||
10385 |
type := anEvent type. |
|
10386 |
eventArgs := anEvent arguments. |
|
10387 |
||
10388 |
key := 0. |
|
10389 |
modifiers := 0. |
|
10390 |
x := 0. |
|
10391 |
y := 0. |
|
10392 |
||
476 | 10393 |
|
10394 |
((type == #'exposeX:y:width:height:') |
|
10395 |
or:[(type == #'graphicExposeX:y:width:height:') |
|
10396 |
or:[(type == #damage)]]) ifTrue:[ |
|
10397 |
"/ jWindowEventClass := Java classForName:'java.awt.event.WindowEvent'. |
|
10398 |
"/ id := (jPaintEventClass instVarNamed:'PAINT'). |
|
10399 |
||
10400 |
jPaintEventClass := Java classForName:'java.awt.event.PaintEvent'. |
|
10401 |
id := (jPaintEventClass instVarNamed:'UPDATE'). |
|
10402 |
||
10403 |
((type == #'exposeX:y:width:height:') |
|
10404 |
or:[(type == #'graphicExposeX:y:width:height:')]) ifTrue:[ |
|
10405 |
x := eventArgs at:1. |
|
10406 |
y := eventArgs at:2. |
|
10407 |
w := eventArgs at:3. |
|
10408 |
h := eventArgs at:4. |
|
10409 |
] ifFalse:[ |
|
10410 |
x := eventArgs left. |
|
10411 |
y := eventArgs top. |
|
10412 |
w := eventArgs width. |
|
10413 |
h := eventArgs height. |
|
10414 |
]. |
|
10415 |
jRect := (Java classForName:'java.awt.Rectangle') basicNew. |
|
10416 |
jRect instVarNamed:'x' put:x. |
|
10417 |
jRect instVarNamed:'y' put:y. |
|
10418 |
jRect instVarNamed:'width' put:w. |
|
10419 |
jRect instVarNamed:'height' put:h. |
|
10420 |
||
10421 |
jEv := jPaintEventClass newCleared "basicNew". |
|
10422 |
jEv instVarNamed:'id' put:id. |
|
10423 |
jEv instVarNamed:'updateRect' put:jRect. |
|
10424 |
||
10425 |
"/ jEv instVarNamed:'g' put:jWin. |
|
10426 |
||
10427 |
^ Array with:jEv. |
|
10428 |
]. |
|
10429 |
||
255 | 10430 |
(anEvent isKeyEvent |
10431 |
or:[anEvent isButtonEvent |
|
10432 |
or:[anEvent isPointerEnterLeaveEvent]]) ifTrue:[ |
|
439 | 10433 |
jInputEventClass := Java classForName:'java.awt.event.InputEvent'. |
10434 |
||
255 | 10435 |
anEvent hasAlt ifTrue:[ |
10436 |
modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'ALT_MASK') |
|
10437 |
]. |
|
10438 |
anEvent hasCtrl ifTrue:[ |
|
10439 |
modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'CTRL_MASK') |
|
10440 |
]. |
|
10441 |
anEvent hasMeta ifTrue:[ |
|
10442 |
modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'META_MASK') |
|
10443 |
]. |
|
10444 |
anEvent hasShift ifTrue:[ |
|
10445 |
modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'SHIFT_MASK') |
|
10446 |
]. |
|
10447 |
anEvent hasButton1 ifTrue:[ |
|
10448 |
modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'BUTTON1_MASK') |
|
10449 |
]. |
|
10450 |
anEvent hasButton2 ifTrue:[ |
|
10451 |
modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'BUTTON2_MASK') |
|
10452 |
]. |
|
10453 |
anEvent hasButton3 ifTrue:[ |
|
10454 |
modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'BUTTON3_MASK') |
|
10455 |
]. |
|
10456 |
||
10457 |
anEvent isPointerEnterLeaveEvent ifFalse:[ |
|
10458 |
"/ ST/X does not (yet) record this information |
|
10459 |
"/ with pointerLeave events. |
|
10460 |
||
10461 |
x := anEvent x. |
|
10462 |
y := anEvent y. |
|
10463 |
]. |
|
10464 |
]. |
|
10465 |
||
10466 |
anEvent isKeyEvent ifTrue:[ |
|
10467 |
jKeyEventClass := Java classForName:'java.awt.event.KeyEvent'. |
|
10468 |
||
10469 |
key := 0. |
|
10470 |
keyChar := 0. |
|
10471 |
||
10472 |
key := anEvent key. |
|
10473 |
key isCharacter ifTrue:[ |
|
10474 |
key := keyChar := key asciiValue |
|
10475 |
] ifFalse:[ |
|
10476 |
untranslatedKey := anEvent view device keyboardMap keyAtValue:key ifAbsent:key. |
|
482 | 10477 |
untranslatedKey == #Insert ifTrue:[ |
10478 |
key := jKeyEventClass instVarNamed:'VK_INSERT' |
|
10479 |
]. |
|
255 | 10480 |
untranslatedKey == #Delete ifTrue:[ |
10481 |
key := jKeyEventClass instVarNamed:'VK_DELETE' "/ 127 |
|
10482 |
]. |
|
10483 |
untranslatedKey == #BackSpace ifTrue:[ |
|
10484 |
key := jKeyEventClass instVarNamed:'VK_BACK_SPACE' "/ 8 |
|
10485 |
]. |
|
10486 |
untranslatedKey == #Return ifTrue:[ |
|
10487 |
key := jKeyEventClass instVarNamed:'VK_ENTER' "/ 13 |
|
10488 |
]. |
|
10489 |
untranslatedKey == #Tab ifTrue:[ |
|
10490 |
key := jKeyEventClass instVarNamed:'VK_TAB' "/ 9 |
|
10491 |
]. |
|
10492 |
untranslatedKey == #Home ifTrue:[ |
|
10493 |
key := jKeyEventClass instVarNamed:'VK_HOME' |
|
10494 |
]. |
|
10495 |
untranslatedKey == #End ifTrue:[ |
|
10496 |
key := jKeyEventClass instVarNamed:'VK_END' |
|
10497 |
]. |
|
482 | 10498 |
(key == #PreviousPage or:[untranslatedKey == #Prior]) ifTrue:[ |
255 | 10499 |
key := jKeyEventClass instVarNamed:'VK_PAGE_UP' |
10500 |
]. |
|
482 | 10501 |
(key == #NextPage or:[key == #EndOfText]) ifTrue:[ |
255 | 10502 |
key := jKeyEventClass instVarNamed:'VK_PAGE_DOWN' |
10503 |
]. |
|
10504 |
untranslatedKey == #CursorUp ifTrue:[ |
|
10505 |
key := jKeyEventClass instVarNamed:'VK_UP' |
|
10506 |
]. |
|
10507 |
untranslatedKey == #CursorDown ifTrue:[ |
|
10508 |
key := jKeyEventClass instVarNamed:'VK_DOWN' |
|
10509 |
]. |
|
10510 |
untranslatedKey == #CursorLeft ifTrue:[ |
|
10511 |
key := jKeyEventClass instVarNamed:'VK_LEFT' |
|
10512 |
]. |
|
10513 |
untranslatedKey == #CursorRight ifTrue:[ |
|
10514 |
key := jKeyEventClass instVarNamed:'VK_RIGHT' |
|
10515 |
]. |
|
482 | 10516 |
(#( F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12) |
255 | 10517 |
includes:untranslatedKey) ifTrue:[ |
10518 |
key := jKeyEventClass instVarNamed:('VK_' , untranslatedKey) |
|
10519 |
]. |
|
10520 |
]. |
|
10521 |
(type == #'keyPress:x:y:') ifTrue:[ |
|
10522 |
id := jKeyEventClass instVarNamed:'KEY_PRESSED' |
|
10523 |
] ifFalse:[ |
|
10524 |
id := jKeyEventClass instVarNamed:'KEY_RELEASED' |
|
10525 |
]. |
|
261 | 10526 |
jEv := jKeyEventClass newCleared "basicNew". |
255 | 10527 |
jEv instVarNamed:'modifiers' put:modifiers. |
10528 |
jEv instVarNamed:'keyCode' put:key. |
|
10529 |
jEv instVarNamed:'keyChar' put:keyChar. |
|
10530 |
jEv instVarNamed:'id' put:id. |
|
10531 |
"/ jEv instVarNamed:'x' put:x. |
|
10532 |
"/ jEv instVarNamed:'y' put:y. |
|
10533 |
jEv instVarNamed:'when' put:(OperatingSystem getMillisecondTime). |
|
10534 |
^ Array with:jEv |
|
10535 |
]. |
|
10536 |
||
10537 |
(anEvent isButtonEvent |
|
10538 |
or:[anEvent isPointerEnterLeaveEvent]) ifTrue:[ |
|
10539 |
jMouseEventClass := Java classForName:'java.awt.event.MouseEvent'. |
|
10540 |
clickCount := 1. |
|
10541 |
||
10542 |
(type == #'buttonPress:x:y:') ifTrue:[ |
|
270 | 10543 |
id := jMouseEventClass instVarNamed:'MOUSE_PRESSED'. |
255 | 10544 |
] ifFalse:[ |
10545 |
(type == #'buttonRelease:x:y:') ifTrue:[ |
|
270 | 10546 |
id := jMouseEventClass instVarNamed:'MOUSE_RELEASED'. |
255 | 10547 |
] ifFalse:[ |
10548 |
(type == #'buttonMotion:x:y:') ifTrue:[ |
|
439 | 10549 |
anEvent state == 0 ifTrue:[ |
270 | 10550 |
id := jMouseEventClass instVarNamed:'MOUSE_MOVED'. |
10551 |
] ifFalse:[ |
|
10552 |
id := jMouseEventClass instVarNamed:'MOUSE_DRAGGED'. |
|
10553 |
]. |
|
255 | 10554 |
] ifFalse:[ |
10555 |
"/ (type == #'pointerMotion:x:y:') ifTrue:[ |
|
270 | 10556 |
"/ id := jMouseEventClass instVarNamed:'MOUSE_MOVED'. |
255 | 10557 |
"/ ] ifFalse:[ |
10558 |
(type == #'pointerEnter:x:y:') ifTrue:[ |
|
270 | 10559 |
id := jMouseEventClass instVarNamed:'MOUSE_ENTERED'. |
255 | 10560 |
] ifFalse:[ |
10561 |
(type == #'pointerLeave:') ifTrue:[ |
|
270 | 10562 |
id := jMouseEventClass instVarNamed:'MOUSE_EXITED'. |
255 | 10563 |
] ifFalse:[ |
10564 |
(type == #'buttonMultiPress:x:y:') ifTrue:[ |
|
10565 |
id := jMouseEventClass instVarNamed:'MOUSE_PRESSED'. |
|
10566 |
clickCount := 2. |
|
10567 |
] ifFalse:[ |
|
10568 |
self halt. |
|
10569 |
] |
|
10570 |
] |
|
10571 |
"/ ] |
|
10572 |
] |
|
10573 |
] |
|
10574 |
] |
|
10575 |
]. |
|
261 | 10576 |
jEv := jMouseEventClass newCleared "basicNew". |
255 | 10577 |
jEv instVarNamed:'modifiers' put:modifiers. |
10578 |
jEv instVarNamed:'id' put:id. |
|
10579 |
jEv instVarNamed:'x' put:x. |
|
10580 |
jEv instVarNamed:'y' put:y. |
|
10581 |
jEv instVarNamed:'when' put:(OperatingSystem getMillisecondTime). |
|
10582 |
^ Array with:jEv |
|
10583 |
]. |
|
10584 |
||
10585 |
||
10586 |
(type == #'configureX:y:width:height:') ifTrue:[ |
|
261 | 10587 |
view := anEvent view. |
466 | 10588 |
x := eventArgs at:1. |
10589 |
y := eventArgs at:2. |
|
261 | 10590 |
w := eventArgs at:3. |
10591 |
h := eventArgs at:4. |
|
10592 |
||
493 | 10593 |
resized := (w ~~ view width or:[h ~~ view height]). |
10594 |
moved := (x ~~ view left or:[y ~~ view top]). |
|
10595 |
||
10596 |
"/ (view isTopView or:[view isPopUpView]) ifTrue:[ |
|
484 | 10597 |
"/ view must update its origin/extent. |
10598 |
view dispatchEvent:anEvent. |
|
493 | 10599 |
"/ ]. |
466 | 10600 |
|
261 | 10601 |
"/ |
10602 |
"/ must change the components extent |
|
10603 |
"/ is there no cleaner way to do this ? |
|
10604 |
"/ |
|
10605 |
view isTopView ifTrue:[ |
|
484 | 10606 |
view isPopUpView ifFalse:[ |
10607 |
"/ |
|
10608 |
"/ sigh - don't include the menu. |
|
10609 |
"/ |
|
10610 |
menu := self topViewsMenu:view. |
|
10611 |
menu notNil ifTrue:[ |
|
10612 |
"/ must add the menus height |
|
10613 |
h := h - menu height |
|
10614 |
] |
|
261 | 10615 |
] |
10616 |
]. |
|
466 | 10617 |
|
261 | 10618 |
jWin instVarNamed:'width' put:w. |
10619 |
jWin instVarNamed:'height' put:h. |
|
484 | 10620 |
jWin instVarNamed:'x' put:x. |
10621 |
jWin instVarNamed:'y' put:y. |
|
261 | 10622 |
|
255 | 10623 |
jComponentEventClass := Java classForName:'java.awt.event.ComponentEvent'. |
466 | 10624 |
moved ifTrue:[ |
10625 |
id := (jComponentEventClass instVarNamed:'COMPONENT_MOVED'). |
|
10626 |
jEv1 := jComponentEventClass newCleared "basicNew". |
|
10627 |
jEv1 instVarNamed:'id' put:id. |
|
10628 |
]. |
|
10629 |
resized ifTrue:[ |
|
10630 |
id := (jComponentEventClass instVarNamed:'COMPONENT_RESIZED'). |
|
10631 |
jEv2 := jComponentEventClass newCleared "basicNew". |
|
10632 |
jEv2 instVarNamed:'id' put:id. |
|
10633 |
]. |
|
10634 |
jEv1 isNil ifTrue:[ |
|
10635 |
jEv2 isNil ifTrue:[^ nil]. |
|
10636 |
^ Array with:jEv2 |
|
10637 |
] ifFalse:[ |
|
10638 |
jEv2 isNil ifTrue:[ |
|
10639 |
^ Array with:jEv1 |
|
10640 |
] |
|
10641 |
]. |
|
255 | 10642 |
^ Array with:jEv1 with:jEv2. |
10643 |
]. |
|
10644 |
(type == #'focusIn') ifTrue:[ |
|
318 | 10645 |
"/ 'focusIn' printCR. |
255 | 10646 |
jComponentEventClass := Java classForName:'java.awt.event.FocusEvent'. |
10647 |
id := (jComponentEventClass instVarNamed:'FOCUS_GAINED'). |
|
261 | 10648 |
jEv := jComponentEventClass newCleared "basicNew". |
255 | 10649 |
jEv instVarNamed:'id' put:id. |
10650 |
^ Array with:jEv. |
|
10651 |
]. |
|
10652 |
(type == #'focusOut') ifTrue:[ |
|
318 | 10653 |
"/ 'focusOut' printCR. |
255 | 10654 |
jComponentEventClass := Java classForName:'java.awt.event.FocusEvent'. |
10655 |
id := (jComponentEventClass instVarNamed:'FOCUS_LOST'). |
|
261 | 10656 |
jEv := jComponentEventClass newCleared "basicNew". |
255 | 10657 |
jEv instVarNamed:'id' put:id. |
10658 |
^ Array with:jEv. |
|
10659 |
]. |
|
10660 |
(type == #'mapped') ifTrue:[ |
|
318 | 10661 |
"/ 'mapped' printCR. |
255 | 10662 |
jComponentEventClass := Java classForName:'java.awt.event.ComponentEvent'. |
10663 |
id := (jComponentEventClass instVarNamed:'COMPONENT_SHOWN'). |
|
10664 |
"/ x := eventArgs at:1. |
|
10665 |
"/ y := eventArgs at:2. |
|
261 | 10666 |
jEv := jComponentEventClass newCleared "basicNew". |
255 | 10667 |
jEv instVarNamed:'id' put:id. |
10668 |
^ Array with:jEv. |
|
10669 |
]. |
|
10670 |
(type == #'unmapped') ifTrue:[ |
|
318 | 10671 |
"/ 'unmapped' printCR. |
255 | 10672 |
jComponentEventClass := Java classForName:'java.awt.event.ComponentEvent'. |
10673 |
id := (jComponentEventClass instVarNamed:'COMPONENT_HIDDEN'). |
|
10674 |
"/ x := eventArgs at:1. |
|
10675 |
"/ y := eventArgs at:2. |
|
261 | 10676 |
jEv := jComponentEventClass newCleared "basicNew". |
255 | 10677 |
jEv instVarNamed:'id' put:id. |
10678 |
^ Array with:jEv. |
|
10679 |
]. |
|
10680 |
||
10681 |
(type == #terminate) ifTrue:[ |
|
10682 |
jWindowEventClass := Java classForName:'java.awt.event.WindowEvent'. |
|
493 | 10683 |
"NEW |
474 | 10684 |
id := (jWindowEventClass instVarNamed:'WINDOW_CLOSING'). |
493 | 10685 |
" |
10686 |
"OLD " |
|
10687 |
id := (jWindowEventClass instVarNamed:'WINDOW_CLOSED'). |
|
10688 |
" " |
|
261 | 10689 |
jEv := jWindowEventClass newCleared "basicNew". |
255 | 10690 |
jEv instVarNamed:'id' put:id. |
10691 |
^ Array with:jEv. |
|
10692 |
]. |
|
439 | 10693 |
|
319 | 10694 |
EventTrace == true ifTrue:[ |
10695 |
('JAVA: unhandled event:' , type) infoPrintCR. |
|
10696 |
]. |
|
255 | 10697 |
^ nil. |
10698 |
||
10699 |
"Created: / 6.1.1998 / 20:38:58 / cg" |
|
493 | 10700 |
"Modified: / 11.12.1998 / 01:02:08 / cg" |
255 | 10701 |
! |
10702 |
||
10703 |
doWindowsEventThread |
|
10704 |
"invoked in an endless loop by the WToolkit-eventLoop |
|
10705 |
native method." |
|
10706 |
||
270 | 10707 |
|sensor event more| |
255 | 10708 |
|
508 | 10709 |
(JavaWindowGroup isNil or:[KnownWindows isNil]) ifTrue:[ |
10710 |
"/ '*** eventThread: no windowGroup / views ...' printCR. |
|
10711 |
self waitFor:FirstWindowCreationSemaphore state:#eventWait timeOut:nil. |
|
284 | 10712 |
"/ Delay waitForSeconds:0.1. |
270 | 10713 |
^ self |
255 | 10714 |
]. |
10715 |
||
10716 |
"/ wait for an event to arrive ... |
|
10717 |
||
10718 |
sensor := JavaWindowGroup sensor. |
|
329 | 10719 |
[sensor hasEvents or:[sensor damageCount ~~ 0]] whileFalse:[ |
270 | 10720 |
EventTrace ifTrue:[ |
10721 |
'*** eventThread waiting ...' printCR. |
|
10722 |
]. |
|
10723 |
Processor activeProcess state:#eventWait. |
|
508 | 10724 |
self waitFor:sensor eventSemaphore state:#eventWait timeOut:nil. |
255 | 10725 |
]. |
10726 |
||
10727 |
EventTrace ifTrue:[ |
|
270 | 10728 |
'*** eventThread event arrived ...' printCR. |
255 | 10729 |
]. |
10730 |
||
10731 |
"/ EventTrace := true |
|
270 | 10732 |
more := true. |
10733 |
[more] whileTrue:[ |
|
10734 |
sensor hasDamage ifTrue:[ |
|
10735 |
EventTrace ifTrue:[ |
|
10736 |
'*** eventThread: damage arrived ...' printCR. |
|
10737 |
]. |
|
10738 |
event := sensor nextDamage. |
|
10739 |
] ifFalse:[ |
|
10740 |
event := sensor nextEvent. |
|
10741 |
]. |
|
10742 |
event isNil ifTrue:[ |
|
319 | 10743 |
EventTrace == true ifTrue:[ |
10744 |
'*** eventThread: nil event ignored' printCR. |
|
10745 |
]. |
|
270 | 10746 |
^ self |
10747 |
]. |
|
10748 |
||
10749 |
more := self processEvent:event |
|
10750 |
] |
|
255 | 10751 |
|
10752 |
"Created: / 6.1.1998 / 21:02:40 / cg" |
|
508 | 10753 |
"Modified: / 30.12.1998 / 19:21:36 / cg" |
255 | 10754 |
! |
10755 |
||
10756 |
processEvent:event |
|
439 | 10757 |
|evQ jEvents jWToolKitClass jWToolKit jWinPeer jWin v eventConsumed| |
255 | 10758 |
|
10759 |
KnownWindows isNil ifTrue:[ |
|
270 | 10760 |
^ false |
255 | 10761 |
]. |
10762 |
||
10763 |
v := event view. |
|
261 | 10764 |
jWinPeer := self jPeerForView:v. |
255 | 10765 |
jWinPeer isNil ifTrue:[ |
482 | 10766 |
v isJavaView ifTrue:[ |
261 | 10767 |
"/ mhmh - an event for a JavaView, |
10768 |
"/ which has no peer (anyMore ?) |
|
10769 |
"/ should not happen. |
|
10770 |
] ifFalse:[ |
|
10771 |
"/ mhmh - an event for a subcomponent of an ST widget. |
|
10772 |
"/ let it be handled normally. |
|
255 | 10773 |
EventTrace ifTrue:[ |
261 | 10774 |
('*** eventThread: ' , event type , '-event for unknown java-view - passed to view.') printCR. |
255 | 10775 |
]. |
359 | 10776 |
event view dispatchEvent:event. |
255 | 10777 |
]. |
270 | 10778 |
^ true |
261 | 10779 |
]. |
10780 |
||
10781 |
"/ change: |
|
10782 |
"/ in the previous version, events for ST/X widgets (i.e. buttons etc) |
|
10783 |
"/ where not passed to java, but instead forwarded directly to the widget |
|
10784 |
"/ by the code below. |
|
10785 |
"/ This has changed, to pass it to Java, which eventually passes it to the |
|
10786 |
"/ peer via the handleEvent native method (unless the event got consumed). |
|
10787 |
"/ This is req'd to let java keep track of keyboard/mouse input for widgets. |
|
10788 |
||
10789 |
false ifTrue:[ |
|
10790 |
"/ "/ most views handle their events themself (being ST/X views) ... |
|
10791 |
"/ |
|
10792 |
"/ v class ~~ JavaView ifTrue:[ |
|
10793 |
"/"/ v class ~~ StandardSystemView ifTrue:[ |
|
10794 |
"/"/ EventTrace ifTrue:[ |
|
10795 |
"/"/ ('*** eventThread: event handled by view itself (' , v class name , ')') printCR. |
|
10796 |
"/"/ ]. |
|
10797 |
"/"/ event sendEventWithFocusOn:nil. |
|
10798 |
"/"/ ^ self. |
|
10799 |
"/"/ ]. |
|
10800 |
"/ (event type == #'exposeX:y:width:height' |
|
10801 |
"/ or:[event type == #'graphicsExposeX:y:width:height']) ifTrue:[ |
|
10802 |
"/ "/ send to view, but also handle in JAVA |
|
10803 |
"/ event sendEventWithFocusOn:nil. |
|
10804 |
"/ ] |
|
10805 |
"/ ]. |
|
10806 |
||
10807 |
(#( |
|
10808 |
#'mapped' |
|
10809 |
#'unmapped' |
|
10810 |
#'configureX:y:width:height:' |
|
10811 |
#'exposeX:y:width:height:' |
|
10812 |
#'graphicsExposeX:y:width:height:' |
|
10813 |
) includes:event type) ifTrue:[ |
|
255 | 10814 |
event sendEventWithFocusOn:nil. |
10815 |
]. |
|
261 | 10816 |
]. |
10817 |
||
10818 |
"/ what a kludge - some events are passed back to |
|
10819 |
"/ ST via the WComponent-handleEvent native method. |
|
10820 |
"/ However, repaints are not. |
|
10821 |
"/ In order to let ST widgets do the drawing, |
|
10822 |
"/ selectively filter exposeEvents from Java ... |
|
10823 |
||
10824 |
eventConsumed := false. |
|
482 | 10825 |
v isJavaView ifTrue:[ |
261 | 10826 |
"/ all events handled by Java ... |
10827 |
] ifFalse:[ |
|
10828 |
eventConsumed := true. |
|
10829 |
||
10830 |
"/ let widget handle it. |
|
359 | 10831 |
event view dispatchEvent:event. |
261 | 10832 |
|
10833 |
"/ some are not passed to Java ... |
|
10834 |
event isDamage ifTrue:[ |
|
480 | 10835 |
(v isKindOf:Button) ifTrue:[ |
10836 |
^ true |
|
10837 |
]. |
|
261 | 10838 |
(v isKindOf:TextView) ifTrue:[ |
270 | 10839 |
^ true |
10840 |
]. |
|
10841 |
(v isKindOf:Label) ifTrue:[ |
|
10842 |
^ true |
|
10843 |
]. |
|
10844 |
(v isKindOf:ComboBoxView) ifTrue:[ |
|
10845 |
^ true |
|
10846 |
]. |
|
10847 |
(v isKindOf:ScrollBar) ifTrue:[ |
|
482 | 10848 |
^ true |
261 | 10849 |
]. |
270 | 10850 |
(v isKindOf:Scroller) ifTrue:[ |
482 | 10851 |
^ true |
261 | 10852 |
]. |
270 | 10853 |
(v isKindOf:MenuPanel) ifTrue:[ |
10854 |
^ true |
|
10855 |
]. |
|
261 | 10856 |
]. |
10857 |
]. |
|
255 | 10858 |
|
10859 |
jWin := jWinPeer instVarNamed:'target'. |
|
10860 |
||
10861 |
EventTrace ifTrue:[ |
|
10862 |
('*** eventThread: event (' , event type , ') handled by JAVA: ') infoPrint. |
|
10863 |
jWinPeer class name infoPrint. ' (' infoPrint. |
|
10864 |
jWin class name infoPrint. ')' infoPrintCR. |
|
10865 |
]. |
|
10866 |
||
10867 |
"/ create an event |
|
10868 |
||
10869 |
jEvents := self awtEventsForEvent:event javaWindow:jWin. |
|
10870 |
jEvents isNil ifTrue:[ |
|
10871 |
EventTrace ifTrue:[ |
|
10872 |
('*** eventThread: event ignored: ' , event type) printCR. |
|
10873 |
]. |
|
270 | 10874 |
^ true |
255 | 10875 |
]. |
10876 |
||
10877 |
"/ v superView isNil ifTrue:[ |
|
10878 |
"/ ('*** eventThread: event ignored for topView: ' , event type) printCR. |
|
10879 |
"/ ^ self |
|
10880 |
"/ ]. |
|
10881 |
||
439 | 10882 |
jWToolKitClass := Java classForName:'java.awt.Toolkit'. |
10883 |
"/ jWToolKit := jWToolKitClass perform:#getDefaultToolkit. |
|
10884 |
jWToolKit := jWToolKitClass performStatic:#'getDefaultToolkit()Ljava/awt/Toolkit;'. |
|
255 | 10885 |
|
10886 |
jEvents do:[:jEv | |
|
10887 |
jEv instVarNamed:'source' put:jWin. |
|
10888 |
jEv instVarNamed:'consumed' put:0. |
|
261 | 10889 |
eventConsumed ifFalse:[ |
10890 |
"/ the first gets the original event as data |
|
10891 |
jEv instVarNamed:'data' put:event. |
|
10892 |
eventConsumed := true |
|
10893 |
]. |
|
255 | 10894 |
|
10895 |
"/ post it (them) to the event queue |
|
318 | 10896 |
EventTrace == true ifTrue:[ |
10897 |
'postEvent to Java ...' printCR. |
|
10898 |
]. |
|
439 | 10899 |
jWToolKit "class" perform:#'postEvent(Ljava/awt/AWTEvent;)V' with:jEv. |
255 | 10900 |
]. |
10901 |
||
270 | 10902 |
^ false |
10903 |
||
255 | 10904 |
"Created: / 6.1.1998 / 20:36:36 / cg" |
493 | 10905 |
"Modified: / 10.12.1998 / 19:36:59 / cg" |
255 | 10906 |
! ! |
10907 |
||
253 | 10908 |
!JavaVM class methodsFor:'documentation'! |
10909 |
||
10910 |
version |
|
515 | 10911 |
^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaVM.st,v 1.113 1999/01/07 16:19:23 cg Exp $' |
253 | 10912 |
! ! |
10913 |
JavaVM initialize! |