author | cg |
Fri, 04 Dec 1998 18:48:13 +0000 | |
changeset 483 | bdb1ad03c3f1 |
parent 482 | 08fd07acb9b7 |
child 484 | 9748fd077801 |
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 |
474 | 31 |
PermittedDirectories SimulatedOS O_WGgraphics_originX |
32 |
O_WGgraphics_originY O_WGgraphics_pData O_FramePeer_pNativeWidget |
|
33 |
O_FramePeer_pData' |
|
253 | 34 |
poolDictionaries:'' |
35 |
category:'Java-Support' |
|
36 |
! |
|
37 |
||
261 | 38 |
!JavaVM class methodsFor:'documentation'! |
39 |
||
454 | 40 |
copyright |
41 |
" |
|
42 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
43 |
All Rights Reserved |
|
44 |
||
45 |
This software is furnished under a license and may be used |
|
46 |
only in accordance with the terms of that license and with the |
|
47 |
inclusion of the above copyright notice. This software may not |
|
48 |
be provided or otherwise made available to, or used by, any |
|
49 |
other person. No title to or ownership of the software is |
|
50 |
hereby transferred. |
|
51 |
" |
|
52 |
||
53 |
||
54 |
! |
|
55 |
||
261 | 56 |
nativeMethods |
57 |
" |
|
440 | 58 |
all native methods: |
59 |
||
60 |
JavaMethod allSubInstances select:[:m | |
|
61 |
m isNative |
|
62 |
] |
|
63 |
||
64 |
implemented methods: |
|
65 |
||
66 |
JavaMethod allSubInstances select:[:m | |
|
67 |
|sel| |
|
68 |
||
69 |
m isNative ifTrue:[ |
|
70 |
sel := ('_' , m javaClass lastName , '_' , m name , ':') asSymbol. |
|
71 |
JavaVM class implements:sel. |
|
72 |
] ifFalse:[ |
|
73 |
false |
|
74 |
] |
|
75 |
] |
|
76 |
||
77 |
unimplemented methods: |
|
78 |
||
79 |
JavaMethod allSubInstances select:[:m | |
|
80 |
|sel| |
|
81 |
||
82 |
m isNative ifTrue:[ |
|
83 |
sel := ('_' , m javaClass lastName , '_' , m name , ':') asSymbol. |
|
84 |
(JavaVM class implements:sel) not |
|
85 |
] ifFalse:[ |
|
86 |
false |
|
87 |
] |
|
88 |
] |
|
89 |
||
90 |
||
261 | 91 |
list of all native methods as in jdk1.1.3: |
92 |
||
93 |
X - implemented |
|
94 |
x - implemented with limited functionality |
|
95 |
o - implemented as dummy (no functionality) |
|
96 |
||
97 |
X (Math::double sin (double)) |
|
98 |
X (Math::double cos (double)) |
|
342 | 99 |
X (Math::double tan (double)) |
100 |
X (Math::double asin (double)) |
|
101 |
X (Math::double acos (double)) |
|
102 |
X (Math::double atan (double)) |
|
103 |
X (Math::double exp (double)) |
|
261 | 104 |
X (Math::double log (double)) |
105 |
X (Math::double sqrt (double)) |
|
106 |
(Math::double IEEEremainder (double double)) |
|
107 |
X (Math::double ceil (double)) |
|
108 |
X (Math::double floor (double)) |
|
109 |
(Math::double rint (double)) |
|
110 |
(Math::double atan2 (double double)) |
|
111 |
X (Math::double pow (double double)) |
|
112 |
||
113 |
X (Class::java.lang.Class forName (java.lang.String)) |
|
114 |
X (Class::java.lang.Object newInstance ()) |
|
115 |
(Class::boolean isInstance (java.lang.Object)) |
|
116 |
(Class::boolean isAssignableFrom (java.lang.Class)) |
|
117 |
X (Class::boolean isInterface ()) |
|
118 |
(Class::boolean isArray ()) |
|
342 | 119 |
X (Class::boolean isPrimitive ()) |
261 | 120 |
X (Class::java.lang.String getName ()) |
121 |
X (Class::java.lang.ClassLoader getClassLoader ()) |
|
122 |
X (Class::java.lang.Class getSuperclass ()) |
|
123 |
(Class::java.lang.Class[] getInterfaces ()) |
|
124 |
(Class::java.lang.Class getComponentType ()) |
|
125 |
(Class::int getModifiers ()) |
|
126 |
(Class::java.lang.Object[] getSigners ()) |
|
127 |
(Class::void setSigners (java.lang.Object[])) |
|
128 |
X (Class::java.lang.Class getPrimitiveClass (java.lang.String)) |
|
129 |
(Class::java.lang.reflect.Field[] getFields0 (int)) |
|
342 | 130 |
X (Class::java.lang.reflect.Method[] getMethods0 (int)) |
261 | 131 |
(Class::java.lang.reflect.Constructor[] getConstructors0 (int)) |
132 |
(Class::java.lang.reflect.Field getField0 (java.lang.String int)) |
|
342 | 133 |
X (Class::java.lang.reflect.Method getMethod0 (java.lang.String java.lang.Class[] int)) |
261 | 134 |
(Class::java.lang.reflect.Constructor getConstructor0 (java.lang.Class[] int)) |
135 |
||
136 |
X (InetAddressImpl::java.lang.String getLocalHostName ()) |
|
137 |
X (InetAddressImpl::void makeAnyLocalAddress (java.net.InetAddress)) |
|
138 |
X (InetAddressImpl::byte[][] lookupAllHostAddr (java.lang.String)) |
|
139 |
(InetAddressImpl::java.lang.String getHostByAddr (int)) |
|
140 |
X (InetAddressImpl::int getInetFamily ()) |
|
141 |
||
142 |
X (ResourceBundle::java.lang.Class[] getClassContext ()) |
|
143 |
||
144 |
X (System::void setIn0 (java.io.InputStream)) |
|
145 |
X (System::void setOut0 (java.io.PrintStream)) |
|
146 |
X (System::void setErr0 (java.io.PrintStream)) |
|
147 |
X (System::long currentTimeMillis ()) |
|
148 |
X (System::void arraycopy (java.lang.Object int java.lang.Object int int)) |
|
149 |
(System::int identityHashCode (java.lang.Object)) |
|
150 |
X (System::java.util.Properties initProperties (java.util.Properties)) |
|
151 |
||
152 |
X (Thread::java.lang.Thread currentThread ()) |
|
153 |
X (Thread::void yield ()) |
|
154 |
X (Thread::void sleep (long)) |
|
155 |
X (Thread::void start ()) |
|
156 |
X (Thread::boolean isInterrupted (boolean)) |
|
157 |
X (Thread::boolean isAlive ()) |
|
158 |
(Thread::int countStackFrames ()) |
|
159 |
X (Thread::void setPriority0 (int)) |
|
160 |
X (Thread::void stop0 (java.lang.Object)) |
|
161 |
X (Thread::void suspend0 ()) |
|
162 |
X (Thread::void resume0 ()) |
|
163 |
(Thread::void interrupt0 ()) |
|
164 |
||
342 | 165 |
(String::java.lang.String intern ()) |
261 | 166 |
|
167 |
X (Float::int floatToIntBits (float)) |
|
168 |
X (Float::float intBitsToFloat (int)) |
|
169 |
||
170 |
(ObjectStreamClass::int getClassAccess (java.lang.Class)) |
|
171 |
(ObjectStreamClass::java.lang.String[] getMethodSignatures (java.lang.Class)) |
|
172 |
(ObjectStreamClass::int getMethodAccess (java.lang.Class java.lang.String)) |
|
173 |
(ObjectStreamClass::java.lang.String[] getFieldSignatures (java.lang.Class)) |
|
174 |
(ObjectStreamClass::int getFieldAccess (java.lang.Class java.lang.String)) |
|
175 |
(ObjectStreamClass::java.io.ObjectStreamField[] getFields0 (java.lang.Class)) |
|
176 |
(ObjectStreamClass::long getSerialVersionUID (java.lang.Class)) |
|
177 |
(ObjectStreamClass::boolean hasWriteObject (java.lang.Class)) |
|
178 |
(ObjectInputStream::java.lang.Class loadClass0 (java.lang.Class java.lang.String)) |
|
179 |
(ObjectInputStream::void inputClassFields (java.lang.Object java.lang.Class int[])) |
|
180 |
(ObjectInputStream::java.lang.Object allocateNewObject (java.lang.Class java.lang.Class)) |
|
181 |
(ObjectInputStream::java.lang.Object allocateNewArray (java.lang.Class int)) |
|
182 |
(ObjectInputStream::boolean invokeObjectReader (java.lang.Object java.lang.Class)) |
|
183 |
||
184 |
(SecurityManager::java.lang.Class[] getClassContext ()) |
|
185 |
X (SecurityManager::java.lang.ClassLoader currentClassLoader ()) |
|
186 |
(SecurityManager::int classDepth (java.lang.String)) |
|
187 |
X (SecurityManager::int classLoaderDepth ()) |
|
188 |
(SecurityManager::java.lang.Class currentLoadedClass0 ()) |
|
189 |
||
190 |
X (ClassLoader::void init ()) |
|
191 |
X (ClassLoader::java.lang.Class defineClass0 (java.lang.String byte[] int int)) |
|
192 |
X (ClassLoader::void resolveClass0 (java.lang.Class)) |
|
193 |
X (ClassLoader::java.lang.Class findSystemClass0 (java.lang.String)) |
|
194 |
X (ClassLoader::java.io.InputStream getSystemResourceAsStream0 (java.lang.String)) |
|
195 |
(ClassLoader::java.lang.String getSystemResourceAsName0 (java.lang.String)) |
|
196 |
||
197 |
(FileDescriptor::boolean valid ()) |
|
198 |
(FileDescriptor::void sync ()) |
|
199 |
X (FileDescriptor::java.io.FileDescriptor initSystemFD (java.io.FileDescriptor int)) |
|
200 |
||
201 |
X (Object::java.lang.Class getClass ()) |
|
202 |
X (Object::int hashCode ()) |
|
203 |
X (Object::java.lang.Object clone ()) |
|
204 |
X (Object::void notify ()) |
|
205 |
X (Object::void notifyAll ()) |
|
206 |
X (Object::void wait (long)) |
|
207 |
||
208 |
X (FileOutputStream::void open (java.lang.String)) |
|
342 | 209 |
X (FileOutputStream::void openAppend (java.lang.String)) |
261 | 210 |
X (FileOutputStream::void write (int)) |
211 |
X (FileOutputStream::void writeBytes (byte[] int int)) |
|
212 |
X (FileOutputStream::void close ()) |
|
213 |
X (FileInputStream::void open (java.lang.String)) |
|
214 |
X (FileInputStream::int read ()) |
|
215 |
X (FileInputStream::int readBytes (byte[] int int)) |
|
216 |
(FileInputStream::long skip (long)) |
|
217 |
X (FileInputStream::int available ()) |
|
218 |
X (FileInputStream::void close ()) |
|
219 |
||
220 |
(VM::int getState ()) |
|
221 |
(VM::boolean threadsSuspended ()) |
|
222 |
(VM::void unsuspendThreads ()) |
|
223 |
(VM::void unsuspendSomeThreads ()) |
|
224 |
||
225 |
X (File::boolean exists0 ()) |
|
342 | 226 |
X (File::boolean canWrite0 ()) |
261 | 227 |
X (File::boolean canRead0 ()) |
228 |
X (File::boolean isFile0 ()) |
|
229 |
X (File::boolean isDirectory0 ()) |
|
342 | 230 |
X (File::long lastModified0 ()) |
261 | 231 |
X (File::long length0 ()) |
342 | 232 |
X (File::boolean mkdir0 ()) |
261 | 233 |
(File::boolean renameTo0 (java.io.File)) |
234 |
(File::boolean delete0 ()) |
|
235 |
(File::boolean rmdir0 ()) |
|
236 |
X (File::java.lang.String[] list0 ()) |
|
237 |
(File::java.lang.String canonPath (java.lang.String)) |
|
238 |
X (File::boolean isAbsolute ()) |
|
239 |
||
240 |
(ObjectOutputStream::void outputClassFields (java.lang.Object java.lang.Class int[])) |
|
241 |
(ObjectOutputStream::boolean invokeObjectWriter (java.lang.Object java.lang.Class)) |
|
242 |
||
243 |
X (Throwable::void printStackTrace0 (java.lang.Object)) |
|
244 |
X (Throwable::java.lang.Throwable fillInStackTrace ()) |
|
245 |
||
246 |
X (Double::long doubleToLongBits (double)) |
|
247 |
X (Double::double longBitsToDouble (long)) |
|
248 |
X (Double::double valueOf0 (java.lang.String)) |
|
249 |
||
250 |
X (Runtime::void exitInternal (int)) |
|
251 |
(Runtime::void runFinalizersOnExit0 (boolean)) |
|
252 |
o (Runtime::java.lang.Process execInternal (java.lang.String[] java.lang.String[])) |
|
253 |
X (Runtime::long freeMemory ()) |
|
254 |
X (Runtime::long totalMemory ()) |
|
255 |
X (Runtime::void gc ()) |
|
256 |
(Runtime::void runFinalization ()) |
|
257 |
(Runtime::void traceInstructions (boolean)) |
|
258 |
(Runtime::void traceMethodCalls (boolean)) |
|
259 |
X (Runtime::java.lang.String initializeLinkerInternal ()) |
|
260 |
X (Runtime::java.lang.String buildLibName (java.lang.String java.lang.String)) |
|
261 |
X (Runtime::int loadFileInternal (java.lang.String)) |
|
262 |
||
263 |
(WDrawingSurfaceInfo::int lock ()) |
|
264 |
(WDrawingSurfaceInfo::void unlock ()) |
|
265 |
(WDrawingSurfaceInfo::int getHWnd ()) |
|
266 |
(WDrawingSurfaceInfo::int getHBitmap ()) |
|
267 |
(WDrawingSurfaceInfo::int getPBits ()) |
|
268 |
(WDrawingSurfaceInfo::int getHDC ()) |
|
269 |
(WDrawingSurfaceInfo::int getDepth ()) |
|
270 |
(WDrawingSurfaceInfo::int getHPalette ()) |
|
271 |
||
272 |
X (WDefaultFontCharset::boolean canConvert (char)) |
|
273 |
||
274 |
(ColorModel::void deletepData ()) |
|
275 |
X (WToolkit::void init (java.lang.Thread)) |
|
276 |
X (WToolkit::void eventLoop ()) |
|
277 |
(WToolkit::java.awt.image.ColorModel makeColorModel ()) |
|
342 | 278 |
X (WToolkit::int getScreenResolution ()) |
261 | 279 |
X (WToolkit::int getScreenWidth ()) |
280 |
X (WToolkit::int getScreenHeight ()) |
|
281 |
(WToolkit::void sync ()) |
|
282 |
(WToolkit::void beep ()) |
|
283 |
X (WToolkit::void loadSystemColors (int[])) |
|
284 |
||
285 |
(WPrintJob::void end ()) |
|
286 |
||
287 |
X (WDialogPeer::void create (sun.awt.windows.WComponentPeer)) |
|
288 |
X (WDialogPeer::void _show ()) |
|
289 |
X (WDialogPeer::void _hide ()) |
|
290 |
||
342 | 291 |
X (WWindowPeer::void toFront ()) |
292 |
X (WWindowPeer::void toBack ()) |
|
293 |
X (WWindowPeer::void _setTitle (java.lang.String)) |
|
294 |
X (WWindowPeer::void _setResizable (boolean)) |
|
261 | 295 |
(WWindowPeer::void create (sun.awt.windows.WComponentPeer)) |
342 | 296 |
o (WWindowPeer::void updateInsets (java.awt.Insets)) |
261 | 297 |
(WWindowPeer::java.awt.Component getContainerElement (java.awt.Container int)) |
298 |
||
299 |
X (WCanvasPeer::void create (sun.awt.windows.WComponentPeer)) |
|
300 |
||
301 |
X (WTextAreaPeer::void create (sun.awt.windows.WComponentPeer)) |
|
302 |
X (WTextAreaPeer::void insertText (java.lang.String int)) |
|
303 |
(WTextAreaPeer::void replaceText (java.lang.String int int)) |
|
304 |
||
305 |
X (WTextComponentPeer::java.lang.String getText ()) |
|
306 |
X (WTextComponentPeer::void setText (java.lang.String)) |
|
307 |
X (WTextComponentPeer::int getSelectionStart ()) |
|
308 |
X (WTextComponentPeer::int getSelectionEnd ()) |
|
309 |
X (WTextComponentPeer::void select (int int)) |
|
310 |
X (WTextComponentPeer::void enableEditing (boolean)) |
|
311 |
||
312 |
X (WComponentPeer::void show ()) |
|
313 |
X (WComponentPeer::void hide ()) |
|
314 |
X (WComponentPeer::void enable ()) |
|
315 |
X (WComponentPeer::void disable ()) |
|
316 |
(WComponentPeer::java.awt.Point getLocationOnScreen ()) |
|
317 |
X (WComponentPeer::void reshape (int int int int)) |
|
318 |
o (WComponentPeer::void handleEvent (java.awt.AWTEvent)) |
|
319 |
o (WComponentPeer::void _dispose ()) |
|
320 |
X (WComponentPeer::void _setForeground (int)) |
|
321 |
X (WComponentPeer::void _setBackground (int)) |
|
322 |
o (WComponentPeer::void setFont (java.awt.Font)) |
|
323 |
o (WComponentPeer::void requestFocus ()) |
|
324 |
o (WComponentPeer::void setCursor (java.awt.Cursor)) |
|
325 |
o (WComponentPeer::void start ()) |
|
326 |
(WComponentPeer::void _beginValidate ()) |
|
327 |
(WComponentPeer::void endValidate ()) |
|
328 |
o (WComponentPeer::void setZOrderPosition (sun.awt.windows.WComponentPeer)) |
|
329 |
||
330 |
X (WFramePeer::void setMenuBar0 (sun.awt.windows.WMenuBarPeer)) |
|
331 |
X (WFramePeer::void create (sun.awt.windows.WComponentPeer)) |
|
342 | 332 |
X (WFramePeer::void _setIconImage (sun.awt.image.ImageRepresentation)) |
261 | 333 |
|
334 |
o (WFontMetrics::boolean needsConversion (java.awt.Font sun.awt.FontDescriptor)) |
|
335 |
o (WFontMetrics::int getMFCharSegmentWidth (java.awt.Font sun.awt.FontDescriptor boolean char[] int int byte[] int)) |
|
336 |
(WFontMetrics::int bytesWidth (byte[] int int)) |
|
337 |
(WFontMetrics::void init ()) |
|
338 |
||
339 |
o (WChoicePeer::void select (int)) |
|
340 |
o (WChoicePeer::void remove (int)) |
|
341 |
o (WChoicePeer::void addItem (java.lang.String int)) |
|
342 |
X (WChoicePeer::void reshape (int int int int)) |
|
343 |
X (WChoicePeer::void create (sun.awt.windows.WComponentPeer)) |
|
344 |
||
345 |
X (WLabelPeer::void setText (java.lang.String)) |
|
346 |
o (WLabelPeer::void setAlignment (int)) |
|
347 |
X (WLabelPeer::void create (sun.awt.windows.WComponentPeer)) |
|
348 |
||
349 |
X (WMenuItemPeer::void _setLabel (java.lang.String)) |
|
350 |
X (WMenuItemPeer::void create (sun.awt.windows.WMenuPeer)) |
|
351 |
X (WMenuItemPeer::void enable (boolean)) |
|
342 | 352 |
o (WMenuItemPeer::void _dispose ()) |
261 | 353 |
(WMenuPeer::void addSeparator ()) |
354 |
(WMenuPeer::void delItem (int)) |
|
355 |
X (WMenuPeer::void createMenu (sun.awt.windows.WMenuBarPeer)) |
|
356 |
(WMenuPeer::void createSubMenu (sun.awt.windows.WMenuPeer)) |
|
357 |
||
358 |
(WPopupMenuPeer::void createMenu (sun.awt.windows.WComponentPeer)) |
|
359 |
(WPopupMenuPeer::void _show (java.awt.Event)) |
|
360 |
(WMenuBarPeer::void addMenu (java.awt.Menu)) |
|
361 |
(WMenuBarPeer::void delMenu (int)) |
|
362 |
X (WMenuBarPeer::void create (sun.awt.windows.WFramePeer)) |
|
363 |
||
364 |
(WCheckboxMenuItemPeer::void setState (boolean)) |
|
365 |
||
366 |
X (WFileDialogPeer::void show ()) |
|
367 |
||
368 |
X (WCheckboxPeer::void setState (boolean)) |
|
369 |
X (WCheckboxPeer::void setCheckboxGroup (java.awt.CheckboxGroup)) |
|
370 |
(WCheckboxPeer::void setLabel (java.lang.String)) |
|
371 |
X (WCheckboxPeer::void create (sun.awt.windows.WComponentPeer)) |
|
372 |
||
373 |
X (WClipboard::void init ()) |
|
374 |
(WClipboard::void setClipboardText (java.awt.datatransfer.StringSelection)) |
|
375 |
(WClipboard::java.lang.String getClipboardText ()) |
|
376 |
||
342 | 377 |
X (WListPeer::void addItem (java.lang.String int)) |
378 |
X (WListPeer::void delItems (int int)) |
|
379 |
X (WListPeer::void select (int)) |
|
261 | 380 |
(WListPeer::void deselect (int)) |
381 |
(WListPeer::void makeVisible (int)) |
|
342 | 382 |
X (WListPeer::void setMultipleSelections (boolean)) |
383 |
X (WListPeer::void create (sun.awt.windows.WComponentPeer)) |
|
384 |
X (WListPeer::boolean isSelected (int)) |
|
385 |
||
386 |
x (WScrollbarPeer::void _setValues (int int int int)) |
|
387 |
x (WScrollbarPeer::void setLineIncrement (int)) |
|
388 |
x (WScrollbarPeer::void setPageIncrement (int)) |
|
389 |
x (WScrollbarPeer::void create (sun.awt.windows.WComponentPeer)) |
|
390 |
||
391 |
x (ImageRepresentation::void offscreenInit (java.awt.Color)) |
|
261 | 392 |
x (ImageRepresentation::boolean setBytePixels (int int int int java.awt.image.ColorModel byte[] int int)) |
342 | 393 |
x (ImageRepresentation::boolean setIntPixels (int int int int java.awt.image.ColorModel int[] int int)) |
261 | 394 |
x (ImageRepresentation::boolean finish (boolean)) |
395 |
X (ImageRepresentation::void imageDraw (java.awt.Graphics int int java.awt.Color)) |
|
396 |
x (ImageRepresentation::void imageStretch (java.awt.Graphics int int int int int int int int java.awt.Color)) |
|
397 |
x (ImageRepresentation::void disposeImage ()) |
|
398 |
||
399 |
X (WTextFieldPeer::void create (sun.awt.windows.WComponentPeer)) |
|
342 | 400 |
X (WTextFieldPeer::void setEchoCharacter (char)) |
401 |
||
402 |
X (WScrollPanePeer::void create (sun.awt.windows.WComponentPeer)) |
|
403 |
o (WScrollPanePeer::int getOffset (int)) |
|
261 | 404 |
(WScrollPanePeer::void setInsets ()) |
405 |
(WScrollPanePeer::void setScrollPosition (int int)) |
|
342 | 406 |
x (WScrollPanePeer::int _getHScrollbarHeight ()) |
407 |
x (WScrollPanePeer::int _getVScrollbarWidth ()) |
|
408 |
o (WScrollPanePeer::void setSpans (int int int int)) |
|
261 | 409 |
(WScrollPanePeer::java.awt.Component getScrollChild ()) |
410 |
||
411 |
(WEmbeddedFramePeer::void create (sun.awt.windows.WComponentPeer)) |
|
342 | 412 |
X (WButtonPeer::void setLabel (java.lang.String)) |
261 | 413 |
X (WButtonPeer::void create (sun.awt.windows.WComponentPeer)) |
414 |
||
415 |
x (WColor::java.awt.Color getDefaultColor (int)) |
|
416 |
||
417 |
x (GifImageDecoder::boolean parseImage (int int int int boolean int byte[] byte[] java.awt.image.IndexColorModel)) |
|
418 |
||
419 |
x (WGraphics::void createFromComponent (sun.awt.windows.WComponentPeer)) |
|
420 |
x (WGraphics::void createFromGraphics (sun.awt.windows.WGraphics)) |
|
421 |
(WGraphics::void createFromPrintJob (sun.awt.windows.WPrintJob)) |
|
422 |
(WGraphics::void createFromHDC (int)) |
|
423 |
x (WGraphics::void imageCreate (sun.awt.image.ImageRepresentation)) |
|
424 |
x (WGraphics::void pSetFont (java.awt.Font)) |
|
425 |
X (WGraphics::void pSetForeground (int)) |
|
426 |
(WGraphics::void _dispose ()) |
|
427 |
x (WGraphics::void dispose ()) |
|
428 |
x (WGraphics::void setPaintMode ()) |
|
342 | 429 |
x (WGraphics::void setXORMode (java.awt.Color)) |
261 | 430 |
o (WGraphics::java.awt.Rectangle getClipBounds ()) |
431 |
o (WGraphics::void changeClip (int int int int boolean)) |
|
432 |
(WGraphics::void removeClip ()) |
|
433 |
X (WGraphics::void clearRect (int int int int)) |
|
434 |
X (WGraphics::void fillRect (int int int int)) |
|
435 |
X (WGraphics::void drawRect (int int int int)) |
|
436 |
(WGraphics::void drawSFChars (char[] int int int int)) |
|
437 |
x (WGraphics::int drawMFCharsSegment (java.awt.Font sun.awt.FontDescriptor char[] int int int int)) |
|
438 |
(WGraphics::int drawMFCharsConvertedSegment (java.awt.Font sun.awt.FontDescriptor byte[] int int int)) |
|
439 |
(WGraphics::void drawBytes (byte[] int int int int)) |
|
440 |
X (WGraphics::void drawLine (int int int int)) |
|
342 | 441 |
X (WGraphics::void copyArea (int int int int int int)) |
261 | 442 |
o (WGraphics::void drawRoundRect (int int int int int int)) |
443 |
o (WGraphics::void fillRoundRect (int int int int int int)) |
|
444 |
X (WGraphics::void drawPolygon (int[] int[] int)) |
|
445 |
(WGraphics::void drawPolyline (int[] int[] int)) |
|
446 |
X (WGraphics::void fillPolygon (int[] int[] int)) |
|
447 |
x (WGraphics::void drawOval (int int int int)) |
|
448 |
x (WGraphics::void fillOval (int int int int)) |
|
449 |
x (WGraphics::void drawArc (int int int int int int)) |
|
450 |
x (WGraphics::void fillArc (int int int int int int)) |
|
451 |
(WGraphics::void print (sun.awt.windows.WComponentPeer)) |
|
452 |
(WGraphics::void close (sun.awt.windows.WPrintJob)) |
|
453 |
(JPEGImageDecoder::void readImage (java.io.InputStream byte[])) |
|
342 | 454 |
o (OffScreenImageSource::void sendPixels ()) |
457 | 455 |
|
456 |
||
457 |
additional native methods added by microsoft (sigh): |
|
458 |
||
459 |
X (java.lang.String::boolean equals (java.lang.String)) |
|
460 |
X (java.lang.String::int length (java.lang.String)) |
|
461 |
o (java.lang.Runtime::void setInputStreamLocalised (java.io.DataInputStream)) |
|
462 |
o (java.lang.Runtime::void setOutputStreamLocalised (java.io.DataOutputStream)) |
|
463 |
||
464 |
(java.lang.String::int compareTo (java.lang.String)) |
|
465 |
(java.lang.String::boolean equalsIgnoreCase (java.lang.String)) |
|
466 |
(java.lang.String::int indexOf (java.lang.String int)) |
|
467 |
(java.lang.String::boolean startsWith (java.lang.String int)) |
|
468 |
(java.lang.String::boolean regionMatches (int java.lang.String int int)) |
|
469 |
(java.lang.String::boolean regionMatches (boolean int java.lang.String int int)) |
|
470 |
(java.lang.String::int lastIndexOf (java.lang.String int)) |
|
471 |
(java.lang.ClassLoader::void resolveClass (java.lang.Class)) |
|
472 |
(java.lang.ClassLoader::java.lang.Class createArrayClass (java.lang.String java.lang.Class)) |
|
473 |
(java.io.PrintStream::boolean isOutputStreamLocalised (java.io.DataOutputStream)) |
|
474 |
(java.lang.Runtime::boolean isOutputStreamLocalised (java.io.DataOutputStream)) |
|
475 |
(java.lang.Runtime::boolean isInputStreamLocalised (java.io.DataInputStream)) |
|
476 |
(java.lang.ThreadGroup::void initMainThreadGroup0 (java.lang.ThreadGroup)) |
|
477 |
(java.lang.System::void validateSecurityManager (java.lang.SecurityManager)) |
|
478 |
(java.lang.Class::java.lang.reflect.Method getMethod2 (int java.lang.String java.lang.String)) |
|
479 |
(java.io.ObjectOutputStream::void invokeDefaultWriteObject (java.lang.Object java.lang.Class)) |
|
480 |
(java.io.ObjectOutputStream::void invokeWriteObject (java.lang.Object java.lang.Class)) |
|
481 |
(java.io.ObjectInputStream::void invokeDefaultReadObject (java.lang.Object java.lang.Class)) |
|
482 |
(java.io.ObjectInputStream::void invokeReadObject (java.lang.Object java.lang.Class)) |
|
483 |
(java.util.TimeZone::java.util.TimeZone getWin32TimeZone ()) |
|
484 |
(java.net.InetAddress::java.lang.Object[] lookupHostByName (java.lang.String)) |
|
485 |
(java.net.InetAddress::java.lang.Object[] lookupHostByAddr (int)) |
|
486 |
(java.io.ObjectStreamClass::void doMismatchedRead (java.io.ObjectInputStream java.lang.Object)) |
|
487 |
(java.io.ObjectStreamClass::long getClassDefinedUID (java.lang.Class)) |
|
488 |
(java.io.ObjectStreamClass::boolean findObjectMethod0 (java.lang.Class int)) |
|
489 |
(java.lang.reflect.Method::java.lang.String getDescriptor ()) |
|
490 |
(java.lang.reflect.Array::void setShort (java.lang.Object int unsigned short)) |
|
491 |
(java.lang.reflect.Array::char getChar (java.lang.Object int)) |
|
492 |
(java.lang.reflect.Array::void setChar (java.lang.Object int char)) |
|
493 |
(java.lang.reflect.Array::void setDouble (java.lang.Object int double)) |
|
494 |
(java.lang.reflect.Array::java.lang.Object get (java.lang.Object int)) |
|
495 |
(java.lang.reflect.Array::void set (java.lang.Object int java.lang.Object)) |
|
496 |
(java.lang.reflect.Array::int getInt (java.lang.Object int)) |
|
497 |
(java.lang.reflect.Array::void setInt (java.lang.Object int int)) |
|
498 |
(java.lang.reflect.Array::java.lang.Object multiNewArray (java.lang.Class int[])) |
|
499 |
(java.lang.reflect.Array::boolean getBoolean (java.lang.Object int)) |
|
500 |
(java.lang.reflect.Array::byte getByte (java.lang.Object int)) |
|
501 |
(java.lang.reflect.Array::float getFloat (java.lang.Object int)) |
|
502 |
(java.lang.reflect.Array::void setBoolean (java.lang.Object int boolean)) |
|
503 |
(java.lang.reflect.Array::long getLong (java.lang.Object int)) |
|
504 |
(java.lang.reflect.Array::void setByte (java.lang.Object int byte)) |
|
505 |
(java.lang.reflect.Array::void setLong (java.lang.Object int long)) |
|
506 |
(java.lang.reflect.Array::void setFloat (java.lang.Object int float)) |
|
507 |
(java.lang.reflect.Array::java.lang.Object newArray (java.lang.Class int)) |
|
508 |
(java.lang.reflect.Array::int getLength (java.lang.Object)) |
|
509 |
(java.lang.reflect.Array::unsigned short getShort (java.lang.Object int)) |
|
510 |
(java.lang.reflect.Array::double getDouble (java.lang.Object int)) |
|
511 |
(java.lang.reflect.Field::void setShort (java.lang.Object unsigned short)) |
|
512 |
(java.lang.reflect.Field::char getChar (java.lang.Object)) |
|
513 |
(java.lang.reflect.Field::void setChar (java.lang.Object char)) |
|
514 |
(java.lang.reflect.Field::void setDouble (java.lang.Object double)) |
|
515 |
(java.lang.reflect.Field::java.lang.Object get (java.lang.Object)) |
|
516 |
(java.lang.reflect.Field::void set (java.lang.Object java.lang.Object)) |
|
517 |
(java.lang.reflect.Field::int getInt (java.lang.Object)) |
|
518 |
(java.lang.reflect.Field::void setInt (java.lang.Object int)) |
|
519 |
(java.lang.reflect.Field::boolean getBoolean (java.lang.Object)) |
|
520 |
(java.lang.reflect.Field::byte getByte (java.lang.Object)) |
|
521 |
(java.lang.reflect.Field::float getFloat (java.lang.Object)) |
|
522 |
(java.lang.reflect.Field::long getLong (java.lang.Object)) |
|
523 |
(java.lang.reflect.Field::void setBoolean (java.lang.Object boolean)) |
|
524 |
(java.lang.reflect.Field::void setByte (java.lang.Object byte)) |
|
525 |
(java.lang.reflect.Field::void setLong (java.lang.Object long)) |
|
526 |
(java.lang.reflect.Field::void setFloat (java.lang.Object float)) |
|
527 |
(java.lang.reflect.Field::int getModifiers ()) |
|
528 |
(java.lang.reflect.Field::unsigned short getShort (java.lang.Object)) |
|
529 |
(java.lang.reflect.Field::double getDouble (java.lang.Object)) |
|
530 |
(java.lang.reflect.Constructor::java.lang.Object newInstance (java.lang.Object[])) |
|
531 |
(java.lang.reflect.Constructor::int getModifiers ()) |
|
532 |
(java.util.zip.Inflater::void setDictionary0 (byte[] int int)) |
|
533 |
(java.util.zip.Inflater::int getTotalIn0 ()) |
|
534 |
(java.util.zip.Inflater::void reset0 ()) |
|
535 |
(java.util.zip.Inflater::void end0 ()) |
|
536 |
(java.util.zip.Inflater::int inflate0 (byte[] int int)) |
|
537 |
(java.util.zip.Inflater::int getTotalOut0 ()) |
|
538 |
(java.util.zip.Inflater::int getAdler0 ()) |
|
539 |
(java.util.zip.CRC32::void update1 (int)) |
|
540 |
(java.util.zip.CRC32::void update (byte[] int int)) |
|
541 |
||
542 |
(com.ms.security.PolicyEngine::boolean isSystemClass (java.lang.String)) |
|
543 |
(com.ms.security.PolicyEngine::void denyPermission (com.ms.security.PermissionID)) |
|
544 |
(com.ms.security.PolicyEngine::void revertPermission (com.ms.security.PermissionID)) |
|
545 |
(com.ms.security.PolicyEngine::void initPolicyEngine ()) |
|
546 |
(com.ms.security.PolicyEngine::java.lang.Class _getClassOfCaller (java.lang.Class[])) |
|
547 |
(com.ms.security.PolicyEngine::void internalCheckClass (java.lang.Class com.ms.security.PermissionID java.lang.Object)) |
|
548 |
(com.ms.security.PolicyEngine::com.ms.security.PermissionDataSet getPermissionsOfClass (java.lang.Class)) |
|
549 |
(com.ms.security.PolicyEngine::void assertPermission (com.ms.security.PermissionID)) |
|
550 |
(com.ms.security.PolicyEngine::void deepCheck (com.ms.security.PermissionID java.lang.Object)) |
|
551 |
(com.ms.security.PolicyEngine::void shallowCheck (com.ms.security.PermissionID java.lang.Object java.lang.Class[] int)) |
|
552 |
(com.ms.security.PolicyEngine::java.security.Principal getPrincipalOfClass (java.lang.Class)) |
|
553 |
(com.ms.security.permissions.ThreadPermission::boolean pDecodeAsn (byte[])) |
|
554 |
(com.ms.security.permissions.ThreadPermission::byte[] pEncodeAsn ()) |
|
555 |
(com.ms.security.permissions.RegistryPermission::boolean pDecodeAsn (byte[])) |
|
556 |
(com.ms.security.permissions.RegistryPermission::byte[] pEncodeAsn ()) |
|
557 |
(com.ms.security.management.ZonePermissions::byte[] pEncodeAsn ()) |
|
558 |
(com.ms.security.management.ZonePermissions::boolean pDecodeAsn (byte[])) |
|
559 |
(com.ms.security.permissions.UIPermission::byte[] pEncodeAsn ()) |
|
560 |
(com.ms.security.permissions.UIPermission::boolean pDecodeAsn (byte[])) |
|
561 |
(com.ms.security.permissions.NetIOPermission::byte[] pEncodeAsn ()) |
|
562 |
(com.ms.security.permissions.NetIOPermission::boolean pDecodeAsn (byte[])) |
|
563 |
(com.ms.security.permissions.ReflectionPermission::byte[] pEncodeAsn ()) |
|
564 |
(com.ms.security.permissions.ReflectionPermission::boolean pDecodeAsn (byte[])) |
|
565 |
(com.ms.vm.WeakReference::void storeRef (int java.lang.Object)) |
|
566 |
(com.ms.vm.WeakReference::int allocRef (java.lang.Object)) |
|
567 |
(com.ms.vm.WeakReference::void freeRef (int)) |
|
568 |
(com.ms.vm.WeakReference::java.lang.Object fetchRef (int)) |
|
569 |
(com.ms.dll.DllLib::void CoTaskMemFree (int)) |
|
570 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int float[] int int)) |
|
571 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int double[] int int)) |
|
572 |
(com.ms.dll.DllLib::int numParamBytes0 (java.lang.reflect.Method)) |
|
573 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int java.lang.Object int int)) |
|
574 |
(com.ms.dll.DllLib::void write2 (java.lang.Object int unsigned short)) |
|
575 |
(com.ms.dll.DllLib::void write2 (int int unsigned short)) |
|
576 |
(com.ms.dll.DllLib::void write2 (java.lang.Object int char)) |
|
577 |
(com.ms.dll.DllLib::void write2 (int int char)) |
|
578 |
(com.ms.dll.DllLib::int GlobalAlloc (int int)) |
|
579 |
(com.ms.dll.DllLib::void resize (java.lang.Object int)) |
|
580 |
(com.ms.dll.DllLib::long read8 (java.lang.Object int)) |
|
581 |
(com.ms.dll.DllLib::long read8 (int int)) |
|
582 |
(com.ms.dll.DllLib::int lstrcpy (java.lang.StringBuffer int)) |
|
583 |
(com.ms.dll.DllLib::int lstrlenA (int)) |
|
584 |
(com.ms.dll.DllLib::int read4 (java.lang.Object int)) |
|
585 |
(com.ms.dll.DllLib::int CoTaskMemAlloc (int)) |
|
586 |
(com.ms.dll.DllLib::void write8 (java.lang.Object int long)) |
|
587 |
(com.ms.dll.DllLib::int sizeOf0 (java.lang.Class)) |
|
588 |
(com.ms.dll.DllLib::int getSystemDefaultCharSize ()) |
|
589 |
(com.ms.dll.DllLib::void write8 (int int long)) |
|
590 |
(com.ms.dll.DllLib::int read4 (int int)) |
|
591 |
(com.ms.dll.DllLib::byte read1 (java.lang.Object int)) |
|
592 |
(com.ms.dll.DllLib::byte read1 (int int)) |
|
593 |
(com.ms.dll.DllLib::int lstrlen (int)) |
|
594 |
(com.ms.dll.DllLib::void CopyMemoryAnsi (int java.lang.String int)) |
|
595 |
(com.ms.dll.DllLib::void CopyMemoryAnsi (java.lang.StringBuffer int int)) |
|
596 |
(com.ms.dll.DllLib::boolean isStruct (java.lang.reflect.Field)) |
|
597 |
(com.ms.dll.DllLib::boolean GlobalFree (int)) |
|
598 |
(com.ms.dll.DllLib::void internalAttemptCopyPtrToStruct (int java.lang.Object int int)) |
|
599 |
(com.ms.dll.DllLib::int getLastError ()) |
|
600 |
(com.ms.dll.DllLib::void write4 (java.lang.Object int int)) |
|
601 |
(com.ms.dll.DllLib::void write4 (int int int)) |
|
602 |
(com.ms.dll.DllLib::unsigned short read2 (java.lang.Object int)) |
|
603 |
(com.ms.dll.DllLib::unsigned short read2 (int int)) |
|
604 |
(com.ms.dll.DllLib::void release (java.lang.Object)) |
|
605 |
(com.ms.dll.DllLib::void write1 (java.lang.Object int byte)) |
|
606 |
(com.ms.dll.DllLib::void write1 (int int byte)) |
|
607 |
(com.ms.dll.DllLib::boolean isStructCls (java.lang.Class)) |
|
608 |
(com.ms.dll.DllLib::void prelink (java.lang.reflect.Method)) |
|
609 |
(com.ms.dll.DllLib::void CopyMemoryUni (int java.lang.String int)) |
|
610 |
(com.ms.dll.DllLib::void CopyMemoryUni (java.lang.StringBuffer int int)) |
|
611 |
(com.ms.dll.DllLib::void internalAttemptCopyStructToPtr (java.lang.Object int int int)) |
|
612 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (int int int int)) |
|
613 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (byte[] int int int)) |
|
614 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (char[] int int int)) |
|
615 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (unsigned short[] int int int)) |
|
616 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (int[] int int int)) |
|
617 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (long[] int int int)) |
|
618 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (float[] int int int)) |
|
619 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (double[] int int int)) |
|
620 |
(com.ms.dll.DllLib::void CopyWithSrcOffset (java.lang.Object int int int)) |
|
621 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int int int int)) |
|
622 |
(com.ms.dll.DllLib::int lstrlenW (int)) |
|
623 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int byte[] int int)) |
|
624 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int char[] int int)) |
|
625 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int unsigned short[] int int)) |
|
626 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int int[] int int)) |
|
627 |
(com.ms.dll.DllLib::void CopyWithDstOffset (int long[] int int)) |
|
628 |
(com.ms.dll.DllLib::int internalGetStructAddr (java.lang.Object)) |
|
629 |
(com.ms.dll.DllLib::int offsetOf (java.lang.reflect.Field)) |
|
630 |
(com.ms.dll.DllLib::int lstrcpy (int java.lang.String)) |
|
631 |
(com.ms.dll.DllLib::int sizeOf (java.lang.Object)) |
|
632 |
(com.ms.lang.RegKey::com.ms.lang.RegKeyEnumValue pRegEnumValue (int)) |
|
633 |
(com.ms.lang.RegKey::java.lang.String pRegQueryStringValue (java.lang.String)) |
|
634 |
(com.ms.lang.RegKey::byte[] pRegQueryBinaryValue (java.lang.String)) |
|
635 |
(com.ms.lang.RegKey::int pRegQueryIntValue (java.lang.String)) |
|
636 |
(com.ms.lang.RegKey::void pRegSetStringValue (java.lang.String java.lang.String)) |
|
637 |
(com.ms.lang.RegKey::void pRegSetIntValue (java.lang.String int)) |
|
638 |
(com.ms.lang.RegKey::void pRegSetBinaryValue (java.lang.String byte[])) |
|
639 |
(com.ms.lang.RegKey::void pRegDeleteValue (java.lang.String)) |
|
640 |
(com.ms.lang.RegKey::void pRegFlushKey ()) |
|
641 |
(com.ms.lang.RegKey::void pRegDeleteKey (java.lang.String)) |
|
642 |
(com.ms.lang.RegKey::void pRegOpenBaseKey (int)) |
|
643 |
(com.ms.lang.RegKey::void pRegOpenKey (com.ms.lang.RegKey java.lang.String int)) |
|
644 |
(com.ms.lang.RegKey::int pRegQueryInfoKey (com.ms.lang.RegQueryInfo)) |
|
645 |
(com.ms.lang.RegKey::void pRegUnLoadKey (java.lang.String)) |
|
646 |
(com.ms.lang.RegKey::void pRegCreateKey (com.ms.lang.RegKey java.lang.String)) |
|
647 |
(com.ms.lang.RegKey::void pRegRestoreKey (java.lang.String boolean)) |
|
648 |
(com.ms.lang.RegKey::void pRegLoadKey (java.lang.String java.lang.String)) |
|
649 |
(com.ms.lang.RegKey::void pRegCloseKey ()) |
|
650 |
(com.ms.lang.RegKey::java.lang.String pRegEnumKey (int)) |
|
651 |
(com.ms.lang.RegKey::void pRegReplaceKey (java.lang.String java.lang.String java.lang.String)) |
|
652 |
(com.ms.awt.peer.NativeServices::int pGetKeyboardLayouts (int[] int)) |
|
653 |
(com.ms.awt.peer.NativeServices::void jpegReadByte (com.ms.awt.peer.IjpegDecoderCallback byte[] int com.ms.awt.peer.jpegInfoHeader byte[] int)) |
|
654 |
(com.ms.awt.peer.NativeServices::int getColourDataDepth ()) |
|
655 |
(com.ms.awt.peer.NativeServices::java.lang.String pGetFontEnumeratedFamily (int)) |
|
656 |
(com.ms.awt.peer.NativeServices::int pNewFontEnumeration ()) |
|
657 |
(com.ms.awt.peer.NativeServices::int getScreenClipRgn (int)) |
|
658 |
(com.ms.awt.peer.NativeServices::int pSetKeyboardLayout (int int)) |
|
659 |
(com.ms.awt.peer.NativeServices::void ClipboardInit (com.ms.awt.peer.IToolkit)) |
|
660 |
(com.ms.awt.peer.NativeServices::void getDeviceCaps (int int[] int)) |
|
661 |
(com.ms.awt.peer.NativeServices::void getAfcMetrics (int[])) |
|
662 |
(com.ms.awt.peer.NativeServices::void setUserLocale (int int)) |
|
663 |
(com.ms.awt.peer.NativeServices::void getDCDI (com.ms.awt.peer.DirectColourDataInfo)) |
|
664 |
(com.ms.awt.peer.NativeServices::int pGetNumKeyboardLayouts ()) |
|
665 |
(com.ms.awt.peer.NativeServices::void getIndexedColours (byte[] byte[] byte[])) |
|
666 |
(com.ms.awt.peer.NativeServices::int getNativeFont (java.lang.String int int int)) |
|
667 |
(com.ms.awt.peer.NativeServices::int pGetKeyboardLayout ()) |
|
668 |
(com.ms.awt.peer.NativeServices::int getSystemLCID ()) |
|
669 |
(com.ms.awt.peer.NativeServices::void caretSetPos (int int int)) |
|
670 |
(com.ms.awt.peer.NativeServices::java.lang.String getLogFontFromIUnknown (com.ms.com.IUnknown com.ms.awt.peer.LogFontX)) |
|
671 |
(com.ms.awt.peer.NativeServices::java.lang.String ClipboardGetText ()) |
|
672 |
(com.ms.awt.peer.NativeServices::int systemMetric (int)) |
|
673 |
(com.ms.awt.peer.NativeServices::void jpegInit (com.ms.awt.peer.IjpegDecoderCallback byte[] int com.ms.awt.peer.jpegInfoHeader)) |
|
674 |
(com.ms.awt.peer.NativeServices::void caretHide (int)) |
|
675 |
(com.ms.awt.peer.NativeServices::int chooseColor (int int)) |
|
676 |
(com.ms.awt.peer.NativeServices::java.lang.String pGetKeyboardLayoutName (int)) |
|
677 |
(com.ms.awt.peer.NativeServices::int matchFontAndLanguage (int int)) |
|
678 |
(com.ms.awt.peer.NativeServices::java.lang.String chooseFont (com.ms.awt.peer.LogFontX java.lang.String int)) |
|
679 |
(com.ms.awt.peer.NativeServices::java.lang.String getSystemFont (int com.ms.awt.peer.LogFontX)) |
|
680 |
(com.ms.awt.peer.NativeServices::com.ms.com.IUnknown getIUnknownFromLogFont (java.lang.String com.ms.awt.peer.LogFontX)) |
|
681 |
(com.ms.awt.peer.NativeServices::void caretDispose (int)) |
|
682 |
(com.ms.awt.peer.NativeServices::void caretShow (int)) |
|
683 |
(com.ms.awt.peer.NativeServices::void deleteObject (int)) |
|
684 |
(com.ms.awt.peer.NativeServices::void setDebugOutput (com.ms.awt.peer.COMPrintCallback)) |
|
685 |
(com.ms.awt.peer.NativeServices::void jpegReadInt (com.ms.awt.peer.IjpegDecoderCallback byte[] int com.ms.awt.peer.jpegInfoHeader int[] int)) |
|
686 |
(com.ms.awt.peer.NativeServices::int getSystemColourValue (int)) |
|
687 |
(com.ms.awt.peer.NativeServices::void caretCreate (int int int)) |
|
688 |
(com.ms.awt.peer.NativeServices::void ClipboardSetText (java.lang.String)) |
|
689 |
(com.ms.awt.peer.NativeServices::void println (java.lang.String)) |
|
690 |
(com.ms.security.SecurityClassLoader::boolean getSecureState ()) |
|
691 |
(com.ms.security.SecurityClassLoader::void setSecureState (java.lang.String java.lang.String)) |
|
692 |
(com.ms.security.SecurityClassLoader::java.lang.Class internalDefineClass (java.lang.String byte[] int int)) |
|
693 |
(com.ms.security.SecurityClassLoader::void markClass (java.lang.Class com.ms.security.PermissionSet java.security.Principal)) |
|
694 |
(com.ms.security.SecurityClassLoader::java.util.Hashtable getHashTable ()) |
|
695 |
(com.ms.security.auditing.SecurityAuditor::boolean isThreadAuditingEnabled ()) |
|
696 |
(com.ms.security.auditing.SecurityAuditor::void disableThreadAuditing ()) |
|
697 |
(com.ms.security.auditing.SecurityAuditor::void enableThreadAuditing ()) |
|
698 |
(com.ms.security.auditing.SecurityAuditor::void initSecurityAuditor ()) |
|
699 |
(com.ms.security.PermissionDataSet::byte[] pEncodeAsn ()) |
|
700 |
(com.ms.security.PermissionDataSet::boolean pDecodeAsn (byte[])) |
|
701 |
(com.ms.lang.SystemX::int pAnsiToUnicode (byte[] char[] int int int)) |
|
702 |
(com.ms.lang.SystemX::int pQueryUnicodeToAnsi (char[] int int int)) |
|
703 |
(com.ms.lang.SystemX::void gc ()) |
|
704 |
(com.ms.lang.SystemX::boolean arrayCompare (java.lang.Object[] int java.lang.Object[] int int)) |
|
705 |
(com.ms.lang.SystemX::int pUnicodeToAnsi (char[] byte[] int int int)) |
|
706 |
(com.ms.lang.SystemX::boolean isLocalCharDBCSLeadByte (byte)) |
|
707 |
(com.ms.lang.SystemX::int pQueryAnsiToUnicode (byte[] int int int)) |
|
708 |
(com.ms.lang.SystemX::boolean isBaseDBCS ()) |
|
709 |
(com.ms.packagemanager.JavaPackage::byte[] nativeGetSigner (java.lang.Object)) |
|
710 |
(com.ms.packagemanager.JavaPackage::byte[] nativeGetCapabilities (java.lang.Object)) |
|
711 |
(com.ms.com._Guid::void IIDFromString (java.lang.String com.ms.com._Guid)) |
|
712 |
(com.ms.com._Guid::java.lang.String StringFromIID (com.ms.com._Guid)) |
|
713 |
(com.ms.security.auditing.PrintStreamAuditor::int GetModuleHandle (java.lang.String)) |
|
714 |
(com.ms.security.auditing.PrintStreamAuditor::int FormatMessage (int int int int java.lang.StringBuffer int int[])) |
|
715 |
(com.ms.security.permissions.CustomPermission::byte[] pEncodeAsn ()) |
|
716 |
(com.ms.security.permissions.CustomPermission::boolean pDecodeAsn (byte[])) |
|
717 |
(com.ms.security.permissions.X509Signer::boolean pLoad (byte[])) |
|
718 |
(com.ms.packagemanager.PackageManager::java.lang.Class nativeFindClassInNamespace (java.lang.String java.lang.String java.lang.ClassLoader)) |
|
719 |
(com.ms.packagemanager.PackageManager::java.lang.Object nativeGetPackage (java.lang.String java.lang.String)) |
|
720 |
(com.ms.packagemanager.PackageManager::java.lang.String[] nativeGetBeansList ()) |
|
721 |
(com.ms.packagemanager.PackageManager::com.ms.com.IStream nativeGetFileIStream (java.lang.String java.lang.String)) |
|
722 |
(com.ms.packagemanager.PackageManager::java.lang.Class nativeFindClass (java.lang.String java.lang.String java.lang.ClassLoader)) |
|
723 |
(com.ms.security.permissions.UserFileIOPermission::byte[] pEncodeAsn ()) |
|
724 |
(com.ms.security.permissions.UserFileIOPermission::boolean pDecodeAsn (byte[])) |
|
725 |
(com.ms.security.permissions.PropertyPermission::byte[] pEncodeAsn ()) |
|
726 |
(com.ms.security.permissions.PropertyPermission::boolean pDecodeAsn (byte[])) |
|
727 |
(com.ms.security.permissions.ClientStoragePermission::byte[] pEncodeAsn ()) |
|
728 |
(com.ms.security.permissions.ClientStoragePermission::boolean pDecodeAsn (byte[])) |
|
729 |
(com.ms.security.permissions.ExecutionPermission::byte[] pEncodeAsn ()) |
|
730 |
(com.ms.security.permissions.ExecutionPermission::boolean pDecodeAsn (byte[])) |
|
731 |
(com.ms.util.EventLog::boolean DeregisterEventSource (int)) |
|
732 |
(com.ms.util.EventLog::void reportEvent0 (unsigned short unsigned short int java.lang.String[] byte[])) |
|
733 |
(com.ms.util.EventLog::int RegisterEventSource (java.lang.String java.lang.String)) |
|
734 |
(com.ms.applet.BrowserAppletFrame::void signalViewChange (int)) |
|
735 |
(com.ms.applet.BrowserAppletFrame::java.lang.Object newInstance (int java.lang.Class boolean com.ms.security.PermissionSet)) |
|
736 |
(com.ms.applet.BrowserAppletFrame::void showSystemStatus (int int boolean java.lang.String)) |
|
737 |
(com.ms.applet.BrowserAppletFrame::com.ms.security.management.SecurityPolicy getSecurityPolicy0 (int java.lang.String)) |
|
738 |
(com.ms.applet.BrowserAppletFrame::void setDownloadState (int boolean)) |
|
739 |
(com.ms.applet.BrowserAppletFrame::int GetSystemDefaultLCID ()) |
|
740 |
(com.ms.applet.BrowserAppletFrame::void requestResize (int int int)) |
|
741 |
(com.ms.applet.BrowserAppletFrame::void signalObjectLoadDone (int boolean)) |
|
742 |
(com.ms.applet.BrowserAppletFrame::com.ms.applet.BrowserAppletFrame findOfflineContext ()) |
|
743 |
(com.ms.applet.BrowserAppletFrame::void showStatus0 (int java.lang.String)) |
|
744 |
(com.ms.applet.BrowserAppletFrame::boolean checkGlobalOfflineMode0 ()) |
|
745 |
(com.ms.applet.BrowserAppletFrame::void showDocument0 (int java.lang.String java.lang.String)) |
|
746 |
(com.ms.security.permissions.SystemStreamsPermission::byte[] pEncodeAsn ()) |
|
747 |
(com.ms.security.permissions.SystemStreamsPermission::boolean pDecodeAsn (byte[])) |
|
748 |
(com.ms.security.permissions.FileIOPermission::byte[] pEncodeAsn ()) |
|
749 |
(com.ms.security.permissions.FileIOPermission::boolean pDecodeAsn (byte[])) |
|
750 |
(com.ms.com.ComLib::int newGCHandle (java.lang.Object)) |
|
751 |
(com.ms.com.ComLib::java.lang.Object derefGCHandle (int)) |
|
752 |
(com.ms.com.ComLib::void dprinthelper (char[])) |
|
753 |
(com.ms.com.ComLib::void release (java.lang.Object)) |
|
754 |
(com.ms.com.ComLib::int jcdwClassSizeOf (java.lang.Class)) |
|
755 |
(com.ms.com.ComLib::int jcdwOffsetOf (java.lang.Object java.lang.String)) |
|
756 |
(com.ms.com.ComLib::int jcdwClassOffsetOf (java.lang.Class java.lang.String)) |
|
757 |
(com.ms.com.ComLib::boolean isJavaOwned (java.lang.Object)) |
|
758 |
(com.ms.com.ComLib::void brk (java.lang.Object)) |
|
759 |
(com.ms.com.ComLib::void setDataWrapperSize (java.lang.Object int)) |
|
760 |
(com.ms.com.ComLib::void brk (int)) |
|
761 |
(com.ms.com.ComLib::void setJCDWHomeThread (java.lang.Object java.lang.Object)) |
|
762 |
(com.ms.com.ComLib::void propagateOwnership (java.lang.Object int)) |
|
763 |
(com.ms.com.ComLib::void threadStartMTA (java.lang.Thread)) |
|
764 |
(com.ms.com.ComLib::void IENVNextMarshalerJ2C (int)) |
|
765 |
(com.ms.com.ComLib::boolean supportsInterface (java.lang.Object com.ms.com._Guid)) |
|
766 |
(com.ms.com.ComLib::java.lang.Object ptrToStruct (java.lang.Class int)) |
|
767 |
(com.ms.com.ComLib::int jcdwSizeOf (java.lang.Object)) |
|
768 |
(com.ms.com.ComLib::void declareMessagePumpThread ()) |
|
769 |
(com.ms.com.ComLib::void IENVNextMarshalerC2J (int)) |
|
770 |
(com.ms.com.ComLib::void freeGCHandle (int)) |
|
771 |
(com.ms.com.ComLib::boolean isEqualUnknown (java.lang.Object java.lang.Object)) |
|
772 |
(com.ms.com.Dispatch::boolean NIsArray (java.lang.Object)) |
|
773 |
(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[])) |
|
774 |
(com.ms.com.Dispatch::void NGetIDsOfNamesReal (java.lang.Object com.ms.com._Guid int java.lang.String[] int[])) |
|
775 |
(com.ms.com.ComException::int FormatMessage (int int int int java.lang.StringBuffer int int[])) |
|
776 |
(com.ms.com.Variant::int toInt ()) |
|
777 |
(com.ms.com.Variant::double toDate ()) |
|
778 |
(com.ms.com.Variant::boolean toBoolean ()) |
|
779 |
(com.ms.com.Variant::double toDouble ()) |
|
780 |
(com.ms.com.Variant::long toCurrency ()) |
|
781 |
(com.ms.com.Variant::void putVariantArray (com.ms.com.Variant[])) |
|
782 |
(com.ms.com.Variant::com.ms.com.Variant[] getVariantArray ()) |
|
783 |
(com.ms.com.Variant::void putByteArray (java.lang.Object)) |
|
784 |
(com.ms.com.Variant::void putShortRef (unsigned short)) |
|
785 |
(com.ms.com.Variant::void putIntRef (int)) |
|
786 |
(com.ms.com.Variant::void putDoubleRef (double)) |
|
787 |
(com.ms.com.Variant::void putDateRef (double)) |
|
788 |
(com.ms.com.Variant::void putStringRef (java.lang.String)) |
|
789 |
(com.ms.com.Variant::unsigned short getShortRef ()) |
|
790 |
(com.ms.com.Variant::int getIntRef ()) |
|
791 |
(com.ms.com.Variant::double getDoubleRef ()) |
|
792 |
(com.ms.com.Variant::double getDateRef ()) |
|
793 |
(com.ms.com.Variant::java.lang.String getStringRef ()) |
|
794 |
(com.ms.com.Variant::java.lang.String internalToString ()) |
|
795 |
(com.ms.com.Variant::void initSafeArrayByRef (com.ms.com.SafeArray int)) |
|
796 |
(com.ms.com.Variant::java.lang.Object toCharArray ()) |
|
797 |
(com.ms.com.Variant::java.lang.Object toDispatch ()) |
|
798 |
(com.ms.com.Variant::byte toByte ()) |
|
799 |
(com.ms.com.Variant::java.lang.Object getDispatch ()) |
|
800 |
(com.ms.com.Variant::void putDispatch (java.lang.Object)) |
|
801 |
(com.ms.com.Variant::boolean getBoolean ()) |
|
802 |
(com.ms.com.Variant::int toError ()) |
|
803 |
(com.ms.com.Variant::java.lang.Object toObject ()) |
|
804 |
(com.ms.com.Variant::void initSafeArrayByVal (com.ms.com.SafeArray int)) |
|
805 |
(com.ms.com.Variant::java.lang.Object getObject ()) |
|
806 |
(com.ms.com.Variant::void putObject (java.lang.Object)) |
|
807 |
(com.ms.com.Variant::com.ms.com.SafeArray toSafeArrayHelper (java.lang.Class)) |
|
808 |
(com.ms.com.Variant::void putFloatRef (float)) |
|
809 |
(com.ms.com.Variant::void putCurrencyRef (long)) |
|
810 |
(com.ms.com.Variant::void putErrorRef (int)) |
|
811 |
(com.ms.com.Variant::void putBooleanRef (boolean)) |
|
812 |
(com.ms.com.Variant::void putObjectRef (java.lang.Object)) |
|
813 |
(com.ms.com.Variant::void putByteRef (byte)) |
|
814 |
(com.ms.com.Variant::java.lang.String getString ()) |
|
815 |
(com.ms.com.Variant::void putString (java.lang.String)) |
|
816 |
(com.ms.com.Variant::float getFloatRef ()) |
|
817 |
(com.ms.com.Variant::long getCurrencyRef ()) |
|
818 |
(com.ms.com.Variant::int getErrorRef ()) |
|
819 |
(com.ms.com.Variant::boolean getBooleanRef ()) |
|
820 |
(com.ms.com.Variant::java.lang.Object getObjectRef ()) |
|
821 |
(com.ms.com.Variant::byte getByteRef ()) |
|
822 |
(com.ms.com.Variant::float toFloat ()) |
|
823 |
(com.ms.com.Variant::void putCharArray (java.lang.Object)) |
|
824 |
(com.ms.com.Variant::void putDispatchRef (java.lang.Object)) |
|
825 |
(com.ms.com.Variant::java.lang.Object getDispatchRef ()) |
|
826 |
(com.ms.com.Variant::void putVariantArrayRef (com.ms.com.Variant[])) |
|
827 |
(com.ms.com.Variant::com.ms.com.Variant[] getVariantArrayRef ()) |
|
828 |
(com.ms.com.Variant::void changeType (unsigned short)) |
|
829 |
(com.ms.com.Variant::void ncloneIndirect (com.ms.com.Variant)) |
|
830 |
(com.ms.com.Variant::void nFinalize (boolean)) |
|
831 |
(com.ms.com.Variant::void nclone (com.ms.com.Variant)) |
|
832 |
(com.ms.com.Variant::unsigned short toShort ()) |
|
833 |
(com.ms.com.Variant::void putSafeArrayRefHelper (int)) |
|
834 |
(com.ms.com.Variant::com.ms.com.Variant[] toVariantArray ()) |
|
835 |
(com.ms.com.Variant::java.lang.Object toByteArray ()) |
|
836 |
(com.ms.com.Variant::void TrueVariantClear ()) |
|
837 |
(com.ms.awt.WToolkit::boolean MessageBeep (int)) |
|
838 |
(com.ms.applet.AppletPanel::boolean StartCodeDownload (int java.lang.String java.lang.String java.lang.String)) |
|
839 |
(com.ms.applet.AppletPanel::void securedCall0 (int java.lang.Object)) |
|
840 |
(com.ms.applet.AppletPanel::com.ms.security.PermissionSet getDefaultPermissionsFromLoader (com.ms.vm.loader.URLClassLoader)) |
|
841 |
(com.ms.dll.Win32Exception::int FormatMessage (int int int int java.lang.StringBuffer int int[])) |
|
842 |
(com.ms.awt.WGuiCallback::boolean SetEvent (int)) |
|
843 |
(com.ms.awt.WGuiCallback::int CreateSemaphore (int int int int)) |
|
844 |
(com.ms.awt.WGuiCallback::int ReleaseSemaphore (int int int)) |
|
845 |
(com.ms.awt.WGuiCallback::void userYield (boolean)) |
|
846 |
(com.ms.awt.WGuiCallback::int MsgWaitForMultipleObjects (int int[] boolean int int)) |
|
847 |
(com.ms.awt.WGuiCallback::int CreateEvent (int boolean boolean int)) |
|
848 |
(com.ms.activeX.ActiveXToolkit::int GetSysColor (int)) |
|
849 |
(com.ms.awt.peer.NativeGraphics::void setPageDimension (int int)) |
|
850 |
(com.ms.awt.peer.NativeGraphics::void setBkColour (int int)) |
|
851 |
(com.ms.awt.peer.NativeGraphics::void getClipBounds (com.ms.awt.peer.NativeRect int int)) |
|
852 |
(com.ms.awt.peer.NativeGraphics::void pGetCharOutline (int byte[])) |
|
853 |
(com.ms.awt.peer.NativeGraphics::void drawLine (int int int int)) |
|
854 |
(com.ms.awt.peer.NativeGraphics::void setXORMode (int int int int)) |
|
855 |
(com.ms.awt.peer.NativeGraphics::int drawString (java.lang.String int int int int int int int int[] int[])) |
|
856 |
(com.ms.awt.peer.NativeGraphics::int getCoClass ()) |
|
857 |
(com.ms.awt.peer.NativeGraphics::void drawArc (int int int int int int int)) |
|
858 |
(com.ms.awt.peer.NativeGraphics::void getInitialPageDimension (com.ms.awt.peer.NativeRect)) |
|
859 |
(com.ms.awt.peer.NativeGraphics::void setVisRgn (int)) |
|
860 |
(com.ms.awt.peer.NativeGraphics::void pSetForeground (int int)) |
|
861 |
(com.ms.awt.peer.NativeGraphics::int pGetDC ()) |
|
862 |
(com.ms.awt.peer.NativeGraphics::void drawPixels (int[] int int int)) |
|
863 |
(com.ms.awt.peer.NativeGraphics::void drawPolygon (int[] int[] int int int int)) |
|
864 |
(com.ms.awt.peer.NativeGraphics::void createFromImage (com.ms.awt.peer.INativeImage)) |
|
865 |
(com.ms.awt.peer.NativeGraphics::void endPage ()) |
|
866 |
(com.ms.awt.peer.NativeGraphics::int pGetCharOutlineSize (int)) |
|
867 |
(com.ms.awt.peer.NativeGraphics::void pDrawBezier (int int int[] int)) |
|
868 |
(com.ms.awt.peer.NativeGraphics::int drawBytes (byte[] int int int int int)) |
|
869 |
(com.ms.awt.peer.NativeGraphics::void changeClip (int int int int boolean)) |
|
870 |
(com.ms.awt.peer.NativeGraphics::int drawChars (char[] int int int int int int int int int int[] int[])) |
|
871 |
(com.ms.awt.peer.NativeGraphics::void drawT2Curve (float float float float float float int int)) |
|
872 |
(com.ms.awt.peer.NativeGraphics::void createFromPrintJob (java.lang.String com.ms.awt.peer.SPJData)) |
|
873 |
(com.ms.awt.peer.NativeGraphics::void endPrintJob ()) |
|
874 |
(com.ms.awt.peer.NativeGraphics::void pSetOrigin (int int)) |
|
875 |
(com.ms.awt.peer.NativeGraphics::void createFromHDC (int)) |
|
876 |
(com.ms.awt.peer.NativeGraphics::void drawOval (int int int int int)) |
|
877 |
(com.ms.awt.peer.NativeGraphics::int pSetFont (java.lang.String int int int)) |
|
878 |
(com.ms.awt.peer.NativeGraphics::void setPaintMode (int int)) |
|
879 |
(com.ms.awt.peer.NativeGraphics::void startPage ()) |
|
880 |
(com.ms.awt.peer.NativeGraphics::void clearClip ()) |
|
881 |
(com.ms.awt.peer.NativeGraphics::void createFromCopy (com.ms.awt.peer.INativeGraphics)) |
|
882 |
(com.ms.awt.peer.NativeGraphics::void scanLines (int int[] int int int int)) |
|
883 |
(com.ms.awt.peer.NativeGraphics::void drawRoundRect (int int int int int int int)) |
|
884 |
(com.ms.awt.peer.NativeGraphics::void dispose ()) |
|
885 |
(com.ms.awt.peer.NativeGraphics::void clearRect (int int int int int)) |
|
886 |
(com.ms.awt.peer.NativeGraphics::void copyArea (int int int int int int)) |
|
887 |
(com.ms.awt.peer.NativeGraphics::void createFromWindow (int)) |
|
888 |
(com.ms.awt.peer.NativeGraphics::void drawPolyline (int[] int[] int int int)) |
|
889 |
(com.ms.awt.peer.NativeGraphics::void drawRect (int int int int int)) |
|
890 |
(com.ms.awt.peer.CToolkit::void callbackEventLoop (com.ms.awt.peer.IToolkitCallback)) |
|
891 |
(com.ms.awt.peer.CToolkit::int getToolkitHwnd ()) |
|
892 |
(com.ms.awt.peer.CToolkit::int createCompHwnd (int int)) |
|
893 |
(com.ms.awt.peer.CNativeSystemIME::void setCompositionFont (int int)) |
|
894 |
(com.ms.awt.peer.CNativeSystemIME::void setCompositionPos (int int int)) |
|
895 |
(com.ms.awt.peer.CNativeSystemIME::void setOpenStatus (int int)) |
|
896 |
(com.ms.awt.peer.CNativeSystemIME::int getOpenStatus (int)) |
|
897 |
(com.ms.awt.peer.CNativeSystemIME::java.lang.String getCompositionString (int)) |
|
898 |
(com.ms.awt.peer.CNativeSystemIME::java.lang.String getCompositionResultString (int)) |
|
899 |
(com.ms.net.wininet.WininetStreamHandlerFactory::int initNative (java.lang.String)) |
|
900 |
(com.ms.com.SafeArray::void rawGetVariantAs (int com.ms.com.Variant)) |
|
901 |
(com.ms.com.SafeArray::void NSafeArrayInit (int)) |
|
902 |
(com.ms.com.SafeArray::float rawGetDouble (int)) |
|
903 |
(com.ms.com.SafeArray::void NRawBoolCopyToJavaArray (int int boolean[] int)) |
|
904 |
(com.ms.com.SafeArray::void validateArray (int)) |
|
905 |
(com.ms.com.SafeArray::void NSafeArrayCreateFromString (java.lang.String)) |
|
906 |
(com.ms.com.SafeArray::void rawSetString (int java.lang.String)) |
|
907 |
(com.ms.com.SafeArray::int getInt (int)) |
|
908 |
(com.ms.com.SafeArray::void setInt (int int)) |
|
909 |
(com.ms.com.SafeArray::boolean getBoolean (int)) |
|
910 |
(com.ms.com.SafeArray::void setBoolean (int boolean)) |
|
911 |
(com.ms.com.SafeArray::int computeOffset (int)) |
|
912 |
(com.ms.com.SafeArray::void NSafeArrayNullInit ()) |
|
913 |
(com.ms.com.SafeArray::void rawSetVariant (int com.ms.com.Variant)) |
|
914 |
(com.ms.com.SafeArray::float rawGetFloat (int)) |
|
915 |
(com.ms.com.SafeArray::float getFloat (int)) |
|
916 |
(com.ms.com.SafeArray::void setFloat (int float)) |
|
917 |
(com.ms.com.SafeArray::int computeOffset2 (int int)) |
|
918 |
(com.ms.com.SafeArray::void rawSetDouble (int double)) |
|
919 |
(com.ms.com.SafeArray::java.lang.String asString ()) |
|
920 |
(com.ms.com.SafeArray::void NRawCopyToJavaArray (int int java.lang.Object int)) |
|
921 |
(com.ms.com.SafeArray::void NSafeArrayCreate (int int int[] int[])) |
|
922 |
(com.ms.com.SafeArray::void NRawBoolCopyFromJavaArray (boolean[] int int int)) |
|
923 |
(com.ms.com.SafeArray::void NSafeArrayDestroy (boolean boolean)) |
|
924 |
(com.ms.com.SafeArray::int NSafeArrayCopy ()) |
|
925 |
(com.ms.com.SafeArray::int rawGetInt (int)) |
|
926 |
(com.ms.com.SafeArray::boolean rawGetBoolean (int)) |
|
927 |
(com.ms.com.SafeArray::void rawSetFloat (int float)) |
|
928 |
(com.ms.com.SafeArray::java.lang.String rawGetString (int)) |
|
929 |
(com.ms.com.SafeArray::int NTotalNumElems ()) |
|
930 |
(com.ms.com.SafeArray::double getDouble (int)) |
|
931 |
(com.ms.com.SafeArray::void setDouble (int double)) |
|
932 |
(com.ms.com.SafeArray::void Nreinit (com.ms.com.SafeArray)) |
|
933 |
(com.ms.com.SafeArray::int getPhysicalSafeArray ()) |
|
934 |
(com.ms.com.SafeArray::int NgetdwordAt (int)) |
|
935 |
(com.ms.com.SafeArray::void NRawCopyFromJavaArray (java.lang.Object int int int)) |
|
936 |
(com.ms.com.SafeArray::void rawSetBoolean (int boolean)) |
|
937 |
(com.ms.com.SafeArray::void rawSetInt (int int)) |
|
938 |
(com.ms.awt.peer.CNativeComponent::void invalidate (int int int int)) |
|
939 |
(com.ms.awt.peer.CNativeComponent::void hideModal ()) |
|
940 |
(com.ms.awt.peer.CNativeComponent::void hide ()) |
|
941 |
(com.ms.awt.peer.CNativeComponent::void setOnTop (int)) |
|
942 |
(com.ms.awt.peer.CNativeComponent::void registerDragDrop ()) |
|
943 |
(com.ms.awt.peer.CNativeComponent::void endValidate ()) |
|
944 |
(com.ms.awt.peer.CNativeComponent::void enable ()) |
|
945 |
(com.ms.awt.peer.CNativeComponent::void disable ()) |
|
946 |
(com.ms.awt.peer.CNativeComponent::void setTitle (java.lang.String)) |
|
947 |
(com.ms.awt.peer.CNativeComponent::void getBounds (com.ms.awt.peer.NativeRect)) |
|
948 |
(com.ms.awt.peer.CNativeComponent::int gethwnd ()) |
|
949 |
(com.ms.awt.peer.CNativeComponent::void showModal ()) |
|
950 |
(com.ms.awt.peer.CNativeComponent::void setCursor (int)) |
|
951 |
(com.ms.awt.peer.CNativeComponent::void reshape (int int int int)) |
|
952 |
(com.ms.awt.peer.CNativeComponent::void requestFocus ()) |
|
953 |
(com.ms.awt.peer.CNativeComponent::void callDefWindowProc (int int int int)) |
|
954 |
(com.ms.awt.peer.CNativeComponent::void registerCustomDropTarget (com.ms.com.IUnknown)) |
|
955 |
(com.ms.awt.peer.CNativeComponent::void setNoActivate (boolean)) |
|
956 |
(com.ms.awt.peer.CNativeComponent::void getPlaceOnScreen (com.ms.awt.peer.NativeRect)) |
|
957 |
(com.ms.awt.peer.CNativeComponent::void beginValidate ()) |
|
958 |
(com.ms.awt.peer.CNativeComponent::void clippedReshape (int int int int int)) |
|
959 |
(com.ms.awt.peer.CNativeComponent::void setResizable (boolean)) |
|
960 |
(com.ms.awt.peer.CNativeComponent::void setIcon (int)) |
|
961 |
(com.ms.awt.peer.CNativeComponent::void toBack ()) |
|
962 |
(com.ms.awt.peer.CNativeComponent::void setFrameHost (com.ms.awt.peer.IBrowserAppletFrameCallback)) |
|
963 |
(com.ms.awt.peer.CNativeComponent::void toFront ()) |
|
964 |
(com.ms.awt.peer.CNativeComponent::void show ()) |
|
965 |
(com.ms.awt.peer.CNativeComponent::void updateInsets (com.ms.awt.peer.NativeInsets)) |
|
966 |
(com.ms.awt.peer.CNativeComponent::void dispose ()) |
|
967 |
(com.ms.awt.peer.CNativeComponent::void initFromJavaWindow (int com.ms.awt.peer.IComponentCallback com.ms.awt.peer.INativeComponent com.ms.awt.peer.IToolkit int)) |
|
968 |
(com.ms.awt.peer.CNativeComponent::void init (int com.ms.awt.peer.IComponentCallback com.ms.awt.peer.INativeComponent com.ms.awt.peer.IToolkit)) |
|
969 |
(com.ms.awt.peer.CNativeComponent::void beginDrag (com.ms.awt.peer.INativeDragCallback)) |
|
970 |
(com.ms.fx.RegionConverter::int computeNativeRegion (int[])) |
|
971 |
(com.ms.fx.RegionConverter::int[] computeJavaRegion (int)) |
|
972 |
(com.ms.net.wininet.URLUtils::java.lang.String canonicalizeURL (java.lang.String int)) |
|
973 |
(com.ms.net.wininet.URLUtils::java.lang.String combineURL (java.lang.String java.lang.String int)) |
|
974 |
(com.ms.awt.peer.NativeFontMetrics::int bytesWidth (byte[] int int)) |
|
975 |
(com.ms.awt.peer.NativeFontMetrics::int stringWidth (java.lang.String int int[])) |
|
976 |
(com.ms.awt.peer.NativeFontMetrics::int charsWidth (char[] int int int int[])) |
|
977 |
(com.ms.awt.peer.NativeFontMetrics::java.lang.String init (com.ms.awt.peer.INativeGraphics int[] java.lang.String int int int)) |
|
978 |
(com.ms.io.console.Console::int MessageBox (int java.lang.String java.lang.String int)) |
|
979 |
(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)) |
|
980 |
(com.ms.security.management.SecurityZone::byte[] pLoadCustomPermissions (int int java.lang.String)) |
|
981 |
(com.ms.awt.peer.NativeImage::int setBytePixelsDirected (int int int int com.ms.awt.peer.DirectColourModelData byte[] int int com.ms.awt.peer.INativeImageBufferDone)) |
|
982 |
(com.ms.awt.peer.NativeImage::void create (int int int int)) |
|
983 |
(com.ms.awt.peer.NativeImage::int setIntPixelsIndexed (int int int int int[] int int[] int int com.ms.awt.peer.INativeImageBufferDone)) |
|
984 |
(com.ms.awt.peer.NativeImage::int getCoClass ()) |
|
985 |
(com.ms.awt.peer.NativeImage::int getIcon (int int int)) |
|
986 |
(com.ms.awt.peer.NativeImage::int setBytePixelsIndexed (int int int int int[] int byte[] int int com.ms.awt.peer.INativeImageBufferDone)) |
|
987 |
(com.ms.awt.peer.NativeImage::void sendPixels (com.ms.awt.peer.SPData)) |
|
988 |
(com.ms.awt.peer.NativeImage::void fillPixels (com.ms.awt.peer.SPData byte[])) |
|
989 |
(com.ms.awt.peer.NativeImage::void dispose ()) |
|
990 |
(com.ms.awt.peer.NativeImage::void init (int int int int int)) |
|
991 |
(com.ms.awt.peer.NativeImage::int setIntPixelsDirected (int int int int com.ms.awt.peer.DirectColourModelData int[] int int com.ms.awt.peer.INativeImageBufferDone)) |
|
992 |
(com.ms.awt.peer.NativeImage::void imageDrawStretched (com.ms.awt.peer.INativeGraphics int int int int int int int int int int)) |
|
993 |
(com.ms.awt.peer.NativeImage::int finish (int)) |
|
994 |
(com.ms.awt.peer.NativeImage::void imageDraw (int int int int int)) |
|
995 |
(com.ms.awt.peer.NativeResource::java.lang.String loadString (int)) |
|
996 |
(com.ms.awt.peer.NativeResource::int openDialogFromID (int)) |
|
997 |
(com.ms.awt.peer.NativeResource::boolean attach (java.lang.String)) |
|
998 |
(com.ms.awt.peer.NativeResource::void loadBytes (int int java.lang.String byte[] int)) |
|
999 |
(com.ms.awt.peer.NativeResource::int getSize (int int java.lang.String)) |
|
1000 |
(com.ms.awt.peer.NativeResource::void detach ()) |
|
1001 |
(com.ms.awt.peer.NativeResource::int openDialogFromName (java.lang.String)) |
|
1002 |
(com.ms.net.wininet.WininetURLConnection::com.ms.applet.BrowserAppletFrame findOfflineContext ()) |
|
1003 |
(com.ms.com.DispatchProxy::void finalize ()) |
|
1004 |
(com.ms.com.DispatchProxy::void init (com.ms.com._Guid java.lang.reflect.Method[] int[])) |
|
1005 |
(com.ms.net.wininet.WininetInputStream::void close ()) |
|
1006 |
(com.ms.net.wininet.WininetInputStream::int read (byte[] int int)) |
|
1007 |
(com.ms.net.wininet.WininetInputStream::int available ()) |
|
1008 |
(com.ms.net.wininet.WininetInputStream::long skip (long)) |
|
1009 |
(com.ms.net.wininet.WininetInputStream::void connect (java.lang.String boolean boolean java.lang.SecurityManager)) |
|
1010 |
(com.ms.vm.loader.CabSignatureInfo::com.ms.vm.loader.CabSignatureInfo extractFromFile0 (java.lang.String com.ms.security.management.SecurityPolicy)) |
|
1011 |
(com.ms.net.wininet.http.HttpInputStream::byte[] getResponseHeaders ()) |
|
1012 |
(com.ms.net.wininet.http.HttpInputStream::void close0 ()) |
|
1013 |
(com.ms.net.wininet.http.HttpInputStream::void connect (java.lang.String int java.lang.String boolean boolean boolean boolean byte[] byte[] java.lang.SecurityManager)) |
|
1014 |
(com.ms.vm.loader.CabCracker::int GetTempFileName (java.lang.StringBuffer java.lang.String int java.lang.StringBuffer)) |
|
1015 |
(com.ms.vm.loader.CabCracker::void getBytes0 (int int byte[])) |
|
1016 |
(com.ms.vm.loader.CabCracker::void cleanup ()) |
|
1017 |
(com.ms.vm.loader.CabCracker::int GetTempPath (int java.lang.StringBuffer)) |
|
1018 |
(com.ms.vm.loader.CabCracker::void load0 ()) |
|
1019 |
||
1020 |
||
261 | 1021 |
" |
1022 |
||
432 | 1023 |
! |
1024 |
||
1025 |
performance |
|
1026 |
" |
|
447 | 1027 |
JAVA::BenchMark new loopmark |
432 | 1028 |
JAVA::BenchMark new logicmark |
447 | 1029 |
JAVA::BenchMark new sievemark |
1030 |
JAVA::BenchMark new methodmark |
|
432 | 1031 |
JAVA::BenchMark new stringmark |
1032 |
JAVA::BenchMark new newstringmark |
|
1033 |
JAVA::BenchMark new neweststringmark |
|
1034 |
||
1035 |
||
1036 |
" |
|
1037 |
" |
|
457 | 1038 |
caffmark loopmark logicmark sievemark methodmark stringmark float image graphic newstringmark neweststringmark |
1039 |
linux: |
|
1040 |
P6/233 No JIT 84 87 90 40 22 17 10 |
|
1041 |
P6/233 JIT 479 2459 393 649 28 21 12 |
|
1042 |
P6/233 JIT 473 1805 3046 439 986 28 21 12 |
|
460 | 1043 |
533 1808 3382 613 1003 25 105 143 1 |
464 | 1044 |
668 3330 3644 740 |
457 | 1045 |
|
1046 |
w95 |
|
1047 |
P5/200 JIT 90 95 90 95 686 18 60 54 7 |
|
459 | 1048 |
428 1657 2385 684 957 21 61 62 9 |
465 | 1049 |
541 2886 2589 823 976 18 62 55 7 |
432 | 1050 |
" |
1051 |
||
441 | 1052 |
! |
1053 |
||
1054 |
performance2 |
|
1055 |
" |
|
1056 |
symantec benchmarks |
|
1057 |
||
1058 |
||
1059 |
" |
|
1060 |
" |
|
1061 |
BubbleSort BidirBubbleSort QuickSort Sieve Hanoi Dhry Fib Array Tree Total |
|
1062 |
||
1063 |
ST/X+J |
|
455 | 1064 |
233Mhz P6 |
441 | 1065 |
No JIT 352767 354597 69585 43048 101638 28961 108839 48815 |
1066 |
||
1067 |
ST/X+J |
|
455 | 1068 |
233Mhz P6 |
441 | 1069 |
JIT 128724 116810 20259 39733 83160 27613 52093 33166 43996 545554 |
447 | 1070 |
124744 101428 17239 10052 8264 14004 38821 23252 33709 374660 |
455 | 1071 |
+IINC 120324 7265 |
1072 |
+IADD op2 100173 90737 18128 6996 7423 17093 48559 44209 57056 390374 |
|
1073 |
+ISUB op2 90460 17547 5921 57056 390461 |
|
1074 |
+ICMPEQ/NE 99785 90147 5792 43482 56486 388255 |
|
460 | 1075 |
+ICMP 87398 78214 15784 7574 5628 12812 38481 24654 32252 302797 |
461 | 1076 |
+IFICMPLE 84198 74928 13814 5650 11674 23241 293118 |
1077 |
+IFICMPxx 76867 69738 12208 37505 21973 32104 273569 |
|
1078 |
+IFICMPEQ/NE 5580 11202 21723 |
|
1079 |
const IFICMPxx 11856 5463 11032 37372 272726 |
|
462 | 1080 |
+lea for add/sub |
463 | 1081 |
+BALOAD 11700 4600 5015 9431 |
1082 |
+BASTORE 3279 |
|
1083 |
+CALOAD/CASTORE 8907 |
|
466 | 1084 |
regSave change 66119 60365 9997 4917 15386 37851 38202 50027 286497 |
469 | 1085 |
64858 58360 9476 4889 15001 37211 36288 48313 278478 |
1086 |
63146 55949 9302 14899 |
|
1087 |
62970 56085 9352 3226 4837 8779 37573 22815 33899 241297 |
|
471 | 1088 |
-O 43662 40292 7181 2530 4696 8170 34555 22116 32337 195539 |
474 | 1089 |
|
471 | 1090 |
+IALOAD 39162 36347 |
1091 |
+IASTORE 32461 30663 4299 3667 19556 30563 166868 |
|
474 | 1092 |
|
1093 |
-IALOAD/IASTORE |
|
1094 |
34167 19347 |
|
1095 |
19232 29726 |
|
1096 |
18821 |
|
441 | 1097 |
------------------------------------------------------------------------------------------------------------ |
1098 |
||
1099 |
Sun JDK 274625 244461 52676 50653 65183 26668 78133 28572 61608 882583 |
|
455 | 1100 |
(90Mhz P5) |
441 | 1101 |
|
1102 |
Microsoft J++ 9684 8452 2874 1733 3535 3665 3836 4746 25717 64242 |
|
455 | 1103 |
(90Mhz P5) |
441 | 1104 |
|
1105 |
Symantec Cafe 14541 12198 3686 1922 4527 3325 3425 12969 26829 83422 |
|
1106 |
JIT 1.02 |
|
1107 |
(90Mhz P5) |
|
1108 |
||
1109 |
Symantec Cafe 8292 6970 2714 1613 3345 3235 2013 4516 13180 45878 |
|
1110 |
JIT 1.2 |
|
1111 |
(90Mhz P5) |
|
1112 |
" |
|
1113 |
||
471 | 1114 |
" |
1115 |
|b| |
|
1116 |
||
1117 |
b := JAVA::BubbleSortAlgorithm new. |
|
1118 |
b perform:#'setData(JJ)V' with:10000 with:0 with:0 with:0. |
|
1119 |
Time millisecondsToRun:[ |
|
1120 |
b performTest. |
|
1121 |
] |
|
1122 |
" |
|
1123 |
" |
|
1124 |
|b| |
|
1125 |
||
1126 |
b := JAVA::QSortAlgorithm new. |
|
1127 |
b perform:#'setData(JJ)V' with:500000 with:0 with:0 with:0. |
|
1128 |
Time millisecondsToRun:[ |
|
1129 |
b performTest. |
|
1130 |
] |
|
1131 |
" |
|
1132 |
" |
|
1133 |
|t| |
|
1134 |
||
1135 |
t := JAVA::Tree new. |
|
1136 |
t perform:#'setData(JJ)V' with:1000000 with:0 with:0 with:0. |
|
1137 |
Time millisecondsToRun:[ |
|
1138 |
t performTest. |
|
1139 |
] |
|
1140 |
" |
|
1141 |
" |
|
1142 |
|t| |
|
1143 |
||
1144 |
t := JAVA::Array new. |
|
1145 |
t perform:#'setData(JJ)V' with:1000000 with:0 with:0 with:0. |
|
1146 |
Time millisecondsToRun:[ |
|
1147 |
t performTest. |
|
1148 |
] |
|
1149 |
" |
|
1150 |
||
261 | 1151 |
! ! |
253 | 1152 |
|
1153 |
!JavaVM class methodsFor:'initialization'! |
|
1154 |
||
423 | 1155 |
compile:source selector:smalltalkSelector asJavaMethod:javaSelector fakedSource:fakedSource in:aClass |
1156 |
"install additional java protocol in smalltalk classes, req'd for java programs" |
|
1157 |
||
1158 |
|cloneCode| |
|
1159 |
||
1160 |
(aClass implements:javaSelector) ifFalse:[ |
|
1161 |
aClass |
|
1162 |
compile:source |
|
1163 |
classified:'java support' |
|
1164 |
logged:false. |
|
1165 |
||
1166 |
cloneCode := aClass compiledMethodAt:smalltalkSelector. |
|
1167 |
cloneCode source:fakedSource. |
|
1168 |
||
1169 |
Class withoutUpdatingChangesDo:[ |
|
1170 |
aClass removeSelector:smalltalkSelector. |
|
1171 |
aClass addSelector:javaSelector withMethod:cloneCode. |
|
1172 |
] |
|
1173 |
]. |
|
1174 |
||
1175 |
"Created: / 5.11.1998 / 19:30:22 / cg" |
|
1176 |
"Modified: / 5.11.1998 / 19:37:57 / cg" |
|
1177 |
! |
|
1178 |
||
253 | 1179 |
deinitialize |
1180 |
|table| |
|
1181 |
||
1182 |
StandardThreadGroup := nil. |
|
1183 |
self releaseAllMonitors. |
|
1184 |
||
480 | 1185 |
KnownWindows notNil ifTrue:[ |
1186 |
KnownWindows do:[:v | |
|
1187 |
v isTopView ifTrue:[ |
|
1188 |
v destroy |
|
1189 |
] |
|
1190 |
] |
|
1191 |
]. |
|
1192 |
||
253 | 1193 |
JavaWindowGroup := nil. |
1194 |
KnownWindows := nil. |
|
1195 |
OpenFileTable := nil. |
|
1196 |
JavaClasses := nil. |
|
380 | 1197 |
JavaMethods := nil. |
253 | 1198 |
|
1199 |
" |
|
1200 |
JavaVM deinitialize |
|
1201 |
" |
|
1202 |
||
1203 |
"Created: / 3.1.1998 / 21:28:14 / cg" |
|
480 | 1204 |
"Modified: / 3.12.1998 / 20:33:21 / cg" |
253 | 1205 |
! |
1206 |
||
307 | 1207 |
deinitializeAdditionalJavaProtocol |
1208 |
"install additional java protocol in smalltalk classes, req'd for java programs" |
|
1209 |
||
459 | 1210 |
#( |
1211 |
#'clone()Ljava/lang/Object;' |
|
1212 |
#'equals(Ljava/lang/Object;)Z' |
|
1213 |
#'toString()Ljava/lang/String;' |
|
1214 |
) do:[:sel | |
|
1215 |
(Object implements:sel) ifTrue:[ |
|
1216 |
Class withoutUpdatingChangesDo:[ |
|
1217 |
Object removeSelector:sel. |
|
1218 |
] |
|
1219 |
]. |
|
307 | 1220 |
]. |
1221 |
||
1222 |
" |
|
1223 |
self deinitializeAdditionalJavaProtocol |
|
1224 |
" |
|
1225 |
||
1226 |
"Created: / 4.2.1998 / 21:37:10 / cg" |
|
459 | 1227 |
"Modified: / 19.11.1998 / 01:18:36 / cg" |
307 | 1228 |
! |
1229 |
||
253 | 1230 |
initialize |
1231 |
|table| |
|
1232 |
||
1233 |
DUMMY_LONG_HIGHWORD := 1. |
|
1234 |
DUMMY_DOUBLE_HIGHWORD := 2. |
|
1235 |
||
1236 |
StandardThreadGroup := nil. |
|
261 | 1237 |
NoAudio := true. |
262 | 1238 |
"/ NoAudio := false. |
253 | 1239 |
|
1240 |
JavaConsoleStream := Transcript. |
|
1241 |
||
1242 |
FullExceptionTrace := StackTrace := false. |
|
1243 |
WindowOPTrace := DrawOPTrace := EventTrace := ThreadTrace := false. |
|
1244 |
MonitorTrace := ExceptionTrace := FileOpenTrace := FileIOTrace := false. |
|
474 | 1245 |
ExceptionDebug := ExitDebug := false. |
253 | 1246 |
WindowCreationTrace := false. |
1247 |
||
1248 |
FileOpenConfirmation := true. |
|
390 | 1249 |
SocketConnectConfirmation := true. |
253 | 1250 |
|
255 | 1251 |
"/ WindowOPTrace := true. |
1252 |
"/ MonitorTrace := true. |
|
1253 |
"/ ThreadTrace := true. |
|
253 | 1254 |
|
1255 |
UnhandledJavaExceptionSignal := (Signal new) mayProceed:false. |
|
1256 |
UnhandledJavaExceptionSignal nameClass:self message:#unhandledJavaExceptionSignal. |
|
1257 |
UnhandledJavaExceptionSignal notifierString:'unhandled java exception'. |
|
1258 |
||
1259 |
JavaExceptionSignal := (Signal new) mayProceed:false. |
|
1260 |
JavaExceptionSignal nameClass:self message:#javaExceptionSignal. |
|
1261 |
JavaExceptionSignal notifierString:'java exception'. |
|
1262 |
||
1263 |
UnimplementedInstructionSignal := (Signal new) mayProceed:false. |
|
1264 |
UnimplementedInstructionSignal nameClass:self message:#unimplementedInstructionSignal. |
|
1265 |
UnimplementedInstructionSignal notifierString:'unimplemented instruction'. |
|
1266 |
||
1267 |
UnimplementedNativeMethodSignal := (Signal new) mayProceed:false. |
|
1268 |
UnimplementedNativeMethodSignal nameClass:self message:#unimplementedNativeMethodSignal. |
|
1269 |
UnimplementedNativeMethodSignal notifierString:'unimplemented native method'. |
|
1270 |
||
1271 |
BadMessageSignal := (Signal new) mayProceed:false. |
|
1272 |
BadMessageSignal nameClass:self message:#badMessageSignal. |
|
1273 |
BadMessageSignal notifierString:'invalid message to JAVA object'. |
|
1274 |
||
1275 |
InternalErrorSignal := (Signal new) mayProceed:false. |
|
1276 |
InternalErrorSignal nameClass:self message:#internalErrorSignal. |
|
1277 |
InternalErrorSignal notifierString:'internal error'. |
|
1278 |
||
1279 |
CallHandlerSignal := (Signal new) mayProceed:false. |
|
1280 |
CallHandlerSignal nameClass:self message:#callHandlerSignal. |
|
1281 |
CallHandlerSignal notifierString:'internal signal'. |
|
1282 |
||
1283 |
" |
|
1284 |
JavaVM initialize |
|
1285 |
" |
|
1286 |
||
1287 |
"Created: / 2.1.1998 / 18:02:34 / cg" |
|
474 | 1288 |
"Modified: / 2.12.1998 / 23:02:22 / cg" |
253 | 1289 |
! |
1290 |
||
307 | 1291 |
initializeAdditionalJavaProtocol |
1292 |
"install additional java protocol in smalltalk classes, req'd for java programs" |
|
1293 |
||
1294 |
"/ since we use smalltalk Arrays for JavaArray, some |
|
1295 |
"/ additional (java-) protocol is required. |
|
423 | 1296 |
"/ This is also useful, when Smalltalk objects are passed to |
1297 |
"/ java ... |
|
1298 |
"/ We should implement all of the java.lang.Object protocol in |
|
1299 |
"/ Object, to be on the bright side of life; more of this later ... |
|
1300 |
||
1301 |
self |
|
1302 |
compile:'__clone |
|
307 | 1303 |
"this is smalltalk code with a java selector ... |
430 | 1304 |
(This source cannot be accepted in the browser, |
1305 |
since it has a funny selector.) |
|
307 | 1306 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
1307 |
||
1308 |
^ self shallowCopy' |
|
423 | 1309 |
selector:#'__clone' |
1310 |
asJavaMethod:#'clone()Ljava/lang/Object;' |
|
1311 |
fakedSource:'#''clone()Ljava/lang/Object;'' |
|
307 | 1312 |
"this is smalltalk code with a java selector ... |
430 | 1313 |
(This source cannot be accepted in the browser, |
1314 |
since it has a funny selector.) |
|
307 | 1315 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
1316 |
||
423 | 1317 |
^ self shallowCopy' |
1318 |
in:Object. |
|
1319 |
||
1320 |
self |
|
430 | 1321 |
compile:'__equals:arg |
1322 |
"this is smalltalk code with a java selector ... |
|
1323 |
(This source cannot be accepted in the browser, |
|
1324 |
since it has a funny selector.) |
|
1325 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
|
1326 |
||
1327 |
^ (arg = self) ifTrue:[1] ifFalse:[0]' |
|
1328 |
selector:#'__equals:' |
|
1329 |
asJavaMethod:#'equals(Ljava/lang/Object;)Z' |
|
1330 |
fakedSource:'#''equals(Ljava/lang/Object;)Z'' |
|
1331 |
"this is smalltalk code with a java selector ... |
|
1332 |
(This source cannot be accepted in the browser, |
|
1333 |
since it has a funny selector.) |
|
1334 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
|
1335 |
||
1336 |
^ (arg = self) ifTrue:[1] ifFalse:[0]' |
|
1337 |
in:Object. |
|
1338 |
||
1339 |
self |
|
423 | 1340 |
compile:'__toString |
1341 |
"this is smalltalk code with a java selector ... |
|
430 | 1342 |
(This source cannot be accepted in the browser, |
1343 |
since it has a funny selector.) |
|
423 | 1344 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
1345 |
||
1346 |
^ Java as_String:(self displayString)' |
|
1347 |
selector:#'__toString' |
|
1348 |
asJavaMethod:#'toString()Ljava/lang/String;' |
|
1349 |
fakedSource:'#''toString()Ljava/lang/String;'' |
|
1350 |
"this is smalltalk code with a java selector ... |
|
430 | 1351 |
(This source cannot be accepted in the browser, |
1352 |
since it has a funny selector.) |
|
423 | 1353 |
Has been added by JavaVM>>initializeAdditionalJavaProtocol" |
1354 |
||
1355 |
^ Java as_String:(self displayString)' |
|
1356 |
in:Object |
|
307 | 1357 |
|
1358 |
" |
|
1359 |
self initializeAdditionalJavaProtocol |
|
1360 |
" |
|
1361 |
||
1362 |
"Modified: / 28.1.1997 / 19:38:58 / stefan" |
|
1363 |
"Modified: / 22.1.1998 / 21:23:40 / av" |
|
1364 |
"Created: / 4.2.1998 / 21:35:46 / cg" |
|
430 | 1365 |
"Modified: / 10.11.1998 / 16:54:51 / cg" |
307 | 1366 |
! |
1367 |
||
253 | 1368 |
initializeBaseClasses |
1369 |
"load req'd base classes" |
|
1370 |
||
326 | 1371 |
#( |
1372 |
'java.lang.Object' |
|
1373 |
'java.lang.Class' |
|
1374 |
'java.lang.String' |
|
1375 |
'java.lang.System' |
|
1376 |
) do:[:cName | |
|
1377 |
(Java classForName:cName) isNil ifTrue:[ |
|
1378 |
self halt:('could not find required class:' , cName) |
|
1379 |
] |
|
1380 |
]. |
|
253 | 1381 |
|
1382 |
" |
|
1383 |
self initializeBaseClasses |
|
1384 |
" |
|
1385 |
||
1386 |
"Created: / 3.1.1998 / 21:13:28 / cg" |
|
326 | 1387 |
"Modified: / 30.3.1998 / 17:47:02 / cg" |
253 | 1388 |
! |
1389 |
||
1390 |
initializeOpenFileTable |
|
1391 |
OpenFileTable := OrderedCollection |
|
261 | 1392 |
with:Stdin |
1393 |
with:(JavaConsoleStream ? Stdout) |
|
1394 |
with:(JavaConsoleStream ? Stderr). |
|
253 | 1395 |
|
1396 |
" |
|
1397 |
JavaVM initializeOpenFileTable |
|
1398 |
" |
|
1399 |
||
1400 |
"Modified: / 6.8.1997 / 00:40:19 / cg" |
|
1401 |
"Created: / 2.1.1998 / 18:04:32 / cg" |
|
1402 |
! |
|
1403 |
||
1404 |
initializePrimitiveClasses |
|
1405 |
JavaClasses isNil ifTrue:[ |
|
405 | 1406 |
JavaClasses := Dictionary new. |
253 | 1407 |
]. |
1408 |
||
1409 |
#( |
|
405 | 1410 |
(#byte 'B' 1) |
1411 |
(#short 'S' 2) |
|
1412 |
(#int 'I' 4) |
|
1413 |
(#long 'J' 8) |
|
1414 |
(#boolean 'Z' 1) |
|
1415 |
(#char 'C' 2) |
|
1416 |
(#float 'F' 4) |
|
1417 |
(#double 'D' 8) |
|
1418 |
(#void 'V' 0) |
|
253 | 1419 |
) triplesDo:[:nm :sig :len | |
405 | 1420 |
|stClass jClass| |
1421 |
||
1422 |
"/ |
|
1423 |
"/ create a javaClass for it. |
|
1424 |
"/ |
|
1425 |
jClass := (Java at:'java.lang.Class') new. |
|
253 | 1426 |
"/ stClass := Class new. |
1427 |
"/ stClass setName:('JavaBase_' , nm) asSymbol. |
|
1428 |
"/ JavaClasses at:stClass put:jClass. |
|
1429 |
"/ JavaClasses at:jClass put:stClass. |
|
1430 |
||
405 | 1431 |
JavaClasses at:nm put:jClass |
253 | 1432 |
]. |
1433 |
||
1434 |
" |
|
1435 |
self initializePrimitiveClasses |
|
1436 |
" |
|
1437 |
||
405 | 1438 |
"Modified: / 22.10.1998 / 01:56:02 / cg" |
253 | 1439 |
! |
1440 |
||
1441 |
initializeSimulatedLibs |
|
277 | 1442 |
"return a collection of native libs which are considered |
1443 |
being already loaded. (used with jdk < 1.2)" |
|
1444 |
||
432 | 1445 |
LibPath := #( |
1446 |
'__builtIn__' |
|
1447 |
'/usr/local/lib' |
|
1448 |
'/usr/local/lib/java' |
|
1449 |
). |
|
1450 |
||
1451 |
SimulatedLibs := #( |
|
1452 |
'__builtIn__/net' |
|
1453 |
'__builtIn__/awt' |
|
1454 |
'__builtIn__/tawt' |
|
1455 |
'__builtIn__/winawt' |
|
1456 |
'__builtIn__/jpeg' |
|
1457 |
'__builtIn__/mmedia' |
|
1458 |
'__builtIn__/zip' |
|
1459 |
'__builtIn__/math' |
|
1460 |
||
1461 |
"/ KAVA ... |
|
1462 |
'__builtIn__/agent' |
|
457 | 1463 |
|
1464 |
"/ MS-java ... |
|
1465 |
'__builtIn__/msawt' |
|
1466 |
'__builtIn__/javart' |
|
277 | 1467 |
). |
253 | 1468 |
|
457 | 1469 |
" |
1470 |
self initializeSimulatedLibs |
|
1471 |
" |
|
1472 |
||
253 | 1473 |
"Created: / 4.1.1998 / 19:05:03 / cg" |
457 | 1474 |
"Modified: / 17.11.1998 / 23:53:02 / cg" |
277 | 1475 |
! |
1476 |
||
1477 |
initializeSimulatedNativeLibs |
|
1478 |
"return a collection of native libs which are considered |
|
1479 |
being already loaded (used with jdk >= 1.2)" |
|
1480 |
||
1481 |
SimulatedNativeLibs := #( |
|
1482 |
'/libawt.so' |
|
1483 |
). |
|
1484 |
||
1485 |
" |
|
1486 |
self initializeSimulatedNativeLibs |
|
1487 |
" |
|
1488 |
||
1489 |
"Modified: / 27.1.1998 / 18:43:10 / cg" |
|
253 | 1490 |
! |
1491 |
||
1492 |
initializeSystemPropertiesInto:props |
|
1493 |
|cpu os| |
|
1494 |
||
1495 |
"/ use JAVA compatible cpu-name |
|
1496 |
cpu := OperatingSystem getCPUType. |
|
1497 |
cpu = 'i386' ifTrue:[ |
|
280 | 1498 |
cpu := 'ix86' |
253 | 1499 |
]. |
475 | 1500 |
SimulatedOS notNil ifTrue:[ |
474 | 1501 |
os := SimulatedOS |
1502 |
] ifFalse:[ |
|
1503 |
os := OperatingSystem getOSType. |
|
1504 |
os := os asUppercaseFirst. |
|
1505 |
]. |
|
253 | 1506 |
|
1507 |
props at:'java.version' put:'1'. |
|
1508 |
props at:'java.vendor' put:'eXept Software AG'. |
|
342 | 1509 |
props at:'java.vendor.url' put:'http://www.exept.de'. |
253 | 1510 |
props at:'java.home' put:(self defaultJAVAHome). |
1511 |
props at:'java.class.version' put:'1'. |
|
1512 |
props at:'java.class.path' put:(self defaultCLASSPATH). |
|
1513 |
props at:'os.name' put:os. |
|
1514 |
props at:'os.arch' put:cpu. |
|
1515 |
props at:'os.version' put:'1'. |
|
1516 |
props at:'file.separator' put:(Filename separator asString). |
|
1517 |
props at:'path.separator' put:':'. |
|
1518 |
props at:'line.separator' put:(Character cr asString). |
|
1519 |
props at:'user.name' put:(OperatingSystem getLoginName). |
|
388 | 1520 |
props at:'user.home' put:(OperatingSystem getHomeDirectory ? Filename currentDirectory name). |
253 | 1521 |
props at:'user.dir' put:(Filename currentDirectory pathName). |
1522 |
||
1523 |
props at:'awt.toolkit' put:(self defaultWindowingToolKit). |
|
1524 |
||
1525 |
props at:'hotjava.home' put:(self defaultHotJavaHome). |
|
1526 |
||
1527 |
"/ undocumented ? |
|
255 | 1528 |
props at:'file.encoding.pkg' put:'sun.io'. |
253 | 1529 |
|
1530 |
"/ suppress copyright view in appletViewer ... |
|
1531 |
props at:'appletviewer.version' put:'1.1'. |
|
1532 |
||
280 | 1533 |
"/ new with jdk 1.2 |
1534 |
props at:'java.awt.graphicsenv' put:'sun.awt.X11GraphicsEnvironment'. |
|
284 | 1535 |
props at:'java.awt.fonts' put:'/usr/lib/X11/fonts'. |
280 | 1536 |
|
474 | 1537 |
"/ jws |
1538 |
props at:'jws.home' put:(self defaultJWSHome). |
|
1539 |
"/ new with jws 2.0 ... |
|
1540 |
props at:'jws.startcmd' put:'jws.showwin.mainide'. |
|
1541 |
||
253 | 1542 |
^ props |
1543 |
||
388 | 1544 |
" |
1545 |
self initializeSystemPropertiesInto:(Dictionary new) |
|
1546 |
" |
|
1547 |
||
253 | 1548 |
"Created: / 3.1.1998 / 14:26:39 / cg" |
475 | 1549 |
"Modified: / 3.12.1998 / 00:28:21 / cg" |
253 | 1550 |
! |
1551 |
||
1552 |
initializeVM |
|
307 | 1553 |
self initializeAdditionalJavaProtocol. |
1554 |
||
285 | 1555 |
self releaseAllJavaResources. |
255 | 1556 |
|
261 | 1557 |
JavaConsoleStream := Transcript. |
1558 |
||
255 | 1559 |
Java initAllStaticFields. |
1560 |
Java markAllClassesUninitialized. |
|
1561 |
||
429 | 1562 |
"/ force re-resolving; |
1563 |
"/ otherwise, class-inits would not be called |
|
1564 |
"/ by resolver ... (sigh) |
|
1565 |
||
1566 |
JavaMethod allSubInstancesDo:[:m | |
|
1567 |
m checked:false. |
|
1568 |
m code:nil. |
|
1569 |
]. |
|
1570 |
ObjectMemory flushCaches. "/ sigh - must flush inline caches. |
|
1571 |
||
434 | 1572 |
JavaClass startRememberingOrderOfClassInits. |
1573 |
||
277 | 1574 |
self initializeSimulatedLibs. "/ < jdk 1.2 |
1575 |
self initializeSimulatedNativeLibs. "/ >= jdk 1.2 |
|
253 | 1576 |
self initializeOpenFileTable. |
1577 |
||
1578 |
self initializeBaseClasses. |
|
1579 |
self initializePrimitiveClasses. |
|
1580 |
||
1581 |
Java initSystemClass. |
|
1582 |
||
255 | 1583 |
ObjectMemory addDependent:self. |
1584 |
||
253 | 1585 |
" |
285 | 1586 |
JavaVM initialize. |
1587 |
JavaVM initializeVM. |
|
253 | 1588 |
" |
1589 |
||
1590 |
"Created: / 3.1.1998 / 21:29:09 / cg" |
|
480 | 1591 |
"Modified: / 3.12.1998 / 20:33:02 / cg" |
261 | 1592 |
! |
1593 |
||
1594 |
initializeVMIfNoEventThreadRunning |
|
1595 |
(JavaEventThread isNil or:[JavaEventThread isDead]) ifTrue:[ |
|
270 | 1596 |
self initializeVM |
261 | 1597 |
]. |
1598 |
||
1599 |
" |
|
1600 |
JavaVM initializeVMIfNoEventThreadRunning |
|
1601 |
" |
|
1602 |
||
1603 |
"Modified: / 15.1.1998 / 17:29:34 / cg" |
|
1604 |
"Created: / 15.1.1998 / 17:32:27 / cg" |
|
255 | 1605 |
! |
1606 |
||
434 | 1607 |
reinitializeVM |
1608 |
|classesToInit| |
|
1609 |
||
1610 |
self releaseAllJavaResources. |
|
1611 |
||
1612 |
JavaConsoleStream := Transcript. |
|
1613 |
||
1614 |
Java initAllStaticFields. |
|
1615 |
Java markAllClassesUninitialized. |
|
1616 |
||
1617 |
self initializeOpenFileTable. |
|
1618 |
||
1619 |
classesToInit := JavaClass orderOfClassInits. |
|
1620 |
JavaClass startRememberingOrderOfClassInits. |
|
1621 |
||
451 | 1622 |
self initializePrimitiveClasses. |
455 | 1623 |
"/ Java initSystemClass. |
434 | 1624 |
|
1625 |
classesToInit do:[:jClass | |
|
455 | 1626 |
Transcript showCR:'classInit: ' , jClass name. |
434 | 1627 |
jClass classInit |
1628 |
]. |
|
455 | 1629 |
Java initSystemClass. |
434 | 1630 |
|
1631 |
"Created: / 12.11.1998 / 15:37:52 / cg" |
|
455 | 1632 |
"Modified: / 17.11.1998 / 16:10:11 / cg" |
434 | 1633 |
! |
1634 |
||
462 | 1635 |
reinitializeVMIfNoEventThreadRunning |
1636 |
(JavaEventThread isNil or:[JavaEventThread isDead]) ifTrue:[ |
|
1637 |
self reinitializeVM |
|
1638 |
]. |
|
1639 |
||
1640 |
" |
|
1641 |
JavaVM reinitializeVMIfNoEventThreadRunning |
|
1642 |
" |
|
1643 |
||
1644 |
"Modified: / 15.1.1998 / 17:29:34 / cg" |
|
1645 |
"Created: / 24.11.1998 / 15:45:49 / cg" |
|
1646 |
! |
|
1647 |
||
255 | 1648 |
releaseAllJavaResources |
380 | 1649 |
self deinitialize. |
1650 |
||
285 | 1651 |
FirstWindowCreationSemaphore := Semaphore new. |
423 | 1652 |
ScreenUpdaterProcess := nil. |
285 | 1653 |
|
1654 |
LoadedLibs := nil. "/ gc will reclaim them ... |
|
1655 |
LoadedNativeLibs := nil. "/ gc will reclaim them ... |
|
1656 |
||
1657 |
ImageStretchCache := nil. |
|
1658 |
||
1659 |
self terminateAllThreads. |
|
1660 |
||
255 | 1661 |
self releaseAllWindows. |
1662 |
self releaseAllStreams. |
|
1663 |
||
1664 |
" |
|
1665 |
JavaVM releaseAllJavaResources |
|
1666 |
" |
|
1667 |
||
1668 |
"Created: / 7.1.1998 / 22:49:42 / cg" |
|
423 | 1669 |
"Modified: / 5.11.1998 / 20:07:02 / cg" |
253 | 1670 |
! |
1671 |
||
1672 |
releaseAllMonitors |
|
1673 |
LockTable := WeakIdentityDictionary new. |
|
1674 |
LockTableAccess := Semaphore forMutualExclusion. |
|
1675 |
WaitTable := IdentityDictionary new. |
|
1676 |
WaitTableAccess := Semaphore forMutualExclusion. |
|
1677 |
||
1678 |
EnteredMonitorsPerProcess := IdentityDictionary new. |
|
1679 |
||
1680 |
" |
|
1681 |
JavaVM releaseAllMonitors |
|
1682 |
" |
|
1683 |
||
1684 |
"Created: / 2.1.1998 / 18:04:05 / cg" |
|
255 | 1685 |
"Modified: / 7.1.1998 / 22:58:10 / cg" |
1686 |
! |
|
1687 |
||
1688 |
releaseAllStreams |
|
307 | 1689 |
OpenFileTable notNil ifTrue:[ |
1690 |
OpenFileTable do:[:aStream | |
|
1691 |
aStream notNil ifTrue:[ |
|
1692 |
aStream ~~ Stdin ifTrue:[ |
|
1693 |
aStream ~~ Stdout ifTrue:[ |
|
1694 |
aStream ~~ Stderr ifTrue:[ |
|
1695 |
aStream ~~ JavaConsoleStream ifTrue:[ |
|
1696 |
aStream isExternalStream ifTrue:[ |
|
1697 |
aStream shutDown |
|
1698 |
] |
|
1699 |
] |
|
1700 |
] |
|
1701 |
] |
|
1702 |
] |
|
1703 |
] |
|
1704 |
] |
|
1705 |
]. |
|
255 | 1706 |
self initializeOpenFileTable. |
1707 |
||
1708 |
" |
|
261 | 1709 |
JavaVM releaseAllStreams |
255 | 1710 |
" |
1711 |
||
1712 |
"Created: / 7.1.1998 / 22:57:04 / cg" |
|
307 | 1713 |
"Modified: / 4.2.1998 / 19:53:11 / cg" |
255 | 1714 |
! |
1715 |
||
1716 |
releaseAllWindows |
|
1717 |
KnownWindows notNil ifTrue:[ |
|
261 | 1718 |
KnownWindows do:[:aView | |
1719 |
aView destroy |
|
1720 |
]. |
|
1721 |
KnownWindows := nil. |
|
255 | 1722 |
] |
1723 |
||
1724 |
" |
|
1725 |
self releaseAllWindows |
|
1726 |
" |
|
1727 |
||
1728 |
"Created: / 7.1.1998 / 22:58:32 / cg" |
|
1729 |
! |
|
1730 |
||
1731 |
releaseLeftOverMonitors |
|
1732 |
"release monitors held by dead processes" |
|
1733 |
||
1734 |
|deadProcesses| |
|
1735 |
||
1736 |
deadProcesses := IdentitySet new. |
|
1737 |
||
1738 |
EnteredMonitorsPerProcess keysAndValuesDo:[:p :monitors | |
|
261 | 1739 |
p isDead ifTrue:[ |
1740 |
monitors do:[:mon | |
|
1741 |
Transcript showCR:'release leftover monitor ...'. |
|
1742 |
mon release |
|
1743 |
]. |
|
1744 |
deadProcesses add:p. |
|
1745 |
] |
|
255 | 1746 |
]. |
1747 |
deadProcesses do:[:p | |
|
261 | 1748 |
EnteredMonitorsPerProcess removeKey:p |
255 | 1749 |
]. |
1750 |
||
1751 |
" |
|
1752 |
JavaVM releaseLeftOverMonitors |
|
1753 |
" |
|
1754 |
||
1755 |
"Created: / 8.1.1998 / 17:29:26 / cg" |
|
1756 |
"Modified: / 8.1.1998 / 17:38:33 / cg" |
|
253 | 1757 |
! |
1758 |
||
1759 |
systemProperties |
|
1760 |
|props| |
|
1761 |
||
1762 |
props := Dictionary new. |
|
1763 |
self initializeSystemPropertiesInto:props. |
|
1764 |
^ props |
|
1765 |
||
1766 |
"Created: / 3.1.1998 / 14:25:58 / cg" |
|
1767 |
"Modified: / 3.1.1998 / 14:32:38 / cg" |
|
255 | 1768 |
! |
1769 |
||
1770 |
terminateAllThreads |
|
261 | 1771 |
Java terminateAllThreads. |
1772 |
JavaEventThread := nil. |
|
255 | 1773 |
|
1774 |
"Created: / 8.1.1998 / 17:43:54 / cg" |
|
261 | 1775 |
"Modified: / 15.1.1998 / 17:29:00 / cg" |
255 | 1776 |
! |
1777 |
||
1778 |
update:something with:aParameter from:changedObject |
|
1779 |
something == #returnFromSnapshot ifTrue:[ |
|
426 | 1780 |
"/ self initializeVM |
255 | 1781 |
]. |
1782 |
||
1783 |
" |
|
1784 |
JavaVM initializeVM |
|
1785 |
" |
|
1786 |
||
1787 |
"Created: / 9.1.1998 / 10:30:13 / cg" |
|
426 | 1788 |
"Modified: / 6.11.1998 / 00:40:53 / cg" |
253 | 1789 |
! ! |
1790 |
||
1791 |
!JavaVM class methodsFor:'Signal constants'! |
|
1792 |
||
1793 |
badMessageSignal |
|
1794 |
^ BadMessageSignal |
|
1795 |
||
1796 |
"Created: / 2.1.1998 / 18:06:52 / cg" |
|
1797 |
! |
|
1798 |
||
1799 |
callHandlerSignal |
|
1800 |
^ CallHandlerSignal |
|
1801 |
||
1802 |
"Created: / 2.1.1998 / 18:07:16 / cg" |
|
1803 |
! |
|
1804 |
||
1805 |
internalErrorSignal |
|
1806 |
^ InternalErrorSignal |
|
1807 |
||
1808 |
"Created: / 2.1.1998 / 18:07:05 / cg" |
|
1809 |
! |
|
1810 |
||
1811 |
javaExceptionSignal |
|
1812 |
^ JavaExceptionSignal |
|
1813 |
||
1814 |
"Created: / 2.1.1998 / 18:05:58 / cg" |
|
1815 |
! |
|
1816 |
||
1817 |
unhandledJavaExceptionSignal |
|
1818 |
^ UnhandledJavaExceptionSignal |
|
1819 |
||
1820 |
"Created: / 2.1.1998 / 18:05:19 / cg" |
|
1821 |
! |
|
1822 |
||
1823 |
unimplementedInstructionSignal |
|
1824 |
^ UnimplementedInstructionSignal |
|
1825 |
||
1826 |
"Created: / 2.1.1998 / 18:06:15 / cg" |
|
1827 |
! |
|
1828 |
||
1829 |
unimplementedNativeMethodSignal |
|
1830 |
^ UnimplementedNativeMethodSignal |
|
1831 |
||
1832 |
"Created: / 2.1.1998 / 18:06:40 / cg" |
|
1833 |
! ! |
|
1834 |
||
1835 |
!JavaVM class methodsFor:'defaults'! |
|
1836 |
||
359 | 1837 |
audioEnabled |
1838 |
^ NoAudio not |
|
1839 |
||
1840 |
"Created: / 18.7.1998 / 22:31:36 / cg" |
|
1841 |
! |
|
1842 |
||
1843 |
audioEnabled:aBoolean |
|
1844 |
NoAudio := aBoolean not |
|
1845 |
||
1846 |
"Created: / 18.7.1998 / 22:31:20 / cg" |
|
1847 |
! |
|
1848 |
||
253 | 1849 |
defaultCLASSPATH |
1850 |
|s| |
|
1851 |
||
1852 |
s := '' writeStream. |
|
1853 |
Java classPath do:[:p | |
|
261 | 1854 |
s size == 0 ifFalse:[ |
1855 |
s nextPut:$: |
|
1856 |
]. |
|
1857 |
s nextPutAll:p. |
|
253 | 1858 |
]. |
1859 |
||
1860 |
^ s contents |
|
1861 |
||
1862 |
" |
|
1863 |
self defaultCLASSPATH |
|
1864 |
" |
|
1865 |
||
1866 |
"Modified: / 6.8.1997 / 00:51:17 / cg" |
|
1867 |
"Created: / 3.1.1998 / 14:27:21 / cg" |
|
1868 |
! |
|
1869 |
||
1870 |
defaultHotJavaHome |
|
1871 |
^ '/usr/local/java/hotjava'. |
|
1872 |
||
1873 |
"Modified: / 5.8.1997 / 04:13:36 / cg" |
|
1874 |
"Created: / 3.1.1998 / 14:27:34 / cg" |
|
1875 |
! |
|
1876 |
||
1877 |
defaultJAVAHome |
|
1878 |
^ Java javaHome |
|
1879 |
||
1880 |
"Modified: / 6.8.1997 / 00:54:44 / cg" |
|
1881 |
"Created: / 3.1.1998 / 14:27:01 / cg" |
|
1882 |
! |
|
1883 |
||
1884 |
defaultJWSHome |
|
474 | 1885 |
'/phys/idefix/home2/java/JWS2_0/Java-WorkShop2.0/JWS' asFilename exists ifTrue:[ |
479 | 1886 |
^ '/phys/idefix/home2/java/JWS2_0/Java-WorkShop2.0/JWS' |
474 | 1887 |
]. |
1888 |
||
253 | 1889 |
^ '/usr/local/java/JWS'. |
1890 |
||
1891 |
"Created: / 3.1.1998 / 14:27:42 / cg" |
|
479 | 1892 |
"Modified: / 3.12.1998 / 14:54:08 / cg" |
253 | 1893 |
! |
1894 |
||
1895 |
defaultWindowingToolKit |
|
1896 |
"/ prefer the windows toolkit ... |
|
1897 |
||
1898 |
(Java classForName:'sun.awt.windows.WToolkit') notNil ifTrue:[ |
|
277 | 1899 |
^ 'sun.awt.windows.WToolkit'. |
1900 |
]. |
|
1901 |
(Java classForName:'sun.awt.motif.MToolkit') notNil ifTrue:[ |
|
1902 |
^ 'sun.awt.motif.MToolkit'. |
|
1903 |
]. |
|
253 | 1904 |
|
1905 |
^ 'sun.awt.tiny.TinyToolkit'. |
|
1906 |
||
1907 |
||
1908 |
"/ ^ 'sun.awt.win32.MToolkit'. |
|
1909 |
"/ ^ 'sun.awt.motif.MToolkit'. |
|
1910 |
||
277 | 1911 |
" |
1912 |
self defaultWindowingToolKit |
|
1913 |
" |
|
1914 |
||
253 | 1915 |
"Created: / 3.1.1998 / 14:27:49 / cg" |
277 | 1916 |
"Modified: / 27.1.1998 / 21:52:52 / cg" |
253 | 1917 |
! |
1918 |
||
390 | 1919 |
fileOpenConfirmation |
1920 |
^ FileOpenConfirmation |
|
1921 |
||
1922 |
"Created: / 19.10.1998 / 16:01:44 / cg" |
|
1923 |
! |
|
1924 |
||
1925 |
fileOpenConfirmation:aBoolean |
|
1926 |
FileOpenConfirmation := aBoolean |
|
1927 |
||
1928 |
"Created: / 19.10.1998 / 16:01:56 / cg" |
|
1929 |
! |
|
1930 |
||
253 | 1931 |
javaConsole:aStream |
1932 |
JavaConsoleStream := aStream |
|
1933 |
||
1934 |
" |
|
261 | 1935 |
JavaVM javaConsole:Transcript |
253 | 1936 |
" |
1937 |
||
1938 |
"Modified: / 6.8.1997 / 00:34:13 / cg" |
|
1939 |
"Created: / 3.1.1998 / 14:27:58 / cg" |
|
1940 |
! |
|
1941 |
||
1942 |
javaConsoleStream |
|
1943 |
^ JavaConsoleStream |
|
1944 |
||
1945 |
"Created: / 3.1.1998 / 14:32:16 / cg" |
|
390 | 1946 |
! |
1947 |
||
1948 |
socketConnectConfirmation |
|
1949 |
^ SocketConnectConfirmation |
|
1950 |
||
1951 |
"Created: / 19.10.1998 / 16:02:15 / cg" |
|
1952 |
! |
|
1953 |
||
1954 |
socketConnectConfirmation:aBoolean |
|
1955 |
SocketConnectConfirmation := aBoolean |
|
1956 |
||
1957 |
"Created: / 19.10.1998 / 16:02:06 / cg" |
|
253 | 1958 |
! ! |
1959 |
||
1960 |
!JavaVM class methodsFor:'fileIO'! |
|
1961 |
||
1962 |
addOpenFile:aStream |
|
1963 |
OpenFileTable add:aStream. |
|
1964 |
^ OpenFileTable size - 1. |
|
1965 |
||
1966 |
"Created: / 2.1.1998 / 18:32:59 / cg" |
|
1967 |
! |
|
1968 |
||
1969 |
getOpenFileAt:idx |
|
1970 |
^ OpenFileTable at:idx+1 ifAbsent:nil. |
|
1971 |
||
1972 |
"Created: / 2.1.1998 / 18:28:01 / cg" |
|
1973 |
"Modified: / 2.1.1998 / 18:33:06 / cg" |
|
1974 |
! |
|
1975 |
||
1976 |
setOpenFile:aStream at:idx |
|
1977 |
OpenFileTable size < (idx+1) ifTrue:[ |
|
261 | 1978 |
OpenFileTable grow:idx+1. |
253 | 1979 |
]. |
1980 |
OpenFileTable at:idx+1 put:aStream. |
|
1981 |
||
1982 |
"Modified: / 2.1.1998 / 18:33:21 / cg" |
|
1983 |
! ! |
|
1984 |
||
1985 |
!JavaVM class methodsFor:'helpers'! |
|
1986 |
||
268
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
1987 |
classForJavaClassObject:aJavaClassObject |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
1988 |
"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
|
1989 |
|
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
1990 |
^ JavaClasses at:aJavaClassObject ifAbsent:nil. |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
1991 |
|
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
1992 |
"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
|
1993 |
! |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
1994 |
|
253 | 1995 |
enteredMonitors |
1996 |
|p monitors| |
|
1997 |
||
1998 |
p := Processor activeProcess. |
|
1999 |
monitors := EnteredMonitorsPerProcess at:p ifAbsent:nil. |
|
2000 |
monitors isNil ifTrue:[ |
|
261 | 2001 |
monitors := OrderedCollection new. |
2002 |
EnteredMonitorsPerProcess at:p put:monitors. |
|
253 | 2003 |
]. |
2004 |
^ monitors |
|
2005 |
||
2006 |
"Created: / 2.1.1998 / 21:26:19 / cg" |
|
2007 |
! |
|
2008 |
||
268
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2009 |
javaClassObjectForClass:aClass |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2010 |
"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
|
2011 |
instance for it." |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2012 |
|
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2013 |
|jClass| |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2014 |
|
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2015 |
jClass := JavaClasses at:aClass ifAbsent:nil. |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2016 |
jClass isNil ifTrue:[ |
405 | 2017 |
"/ class must be initialized (with all of its superclasses ?). |
2018 |
aClass isJavaClass ifTrue:[ |
|
2019 |
aClass classInit. |
|
2020 |
]. |
|
2021 |
JavaClasses at:aClass put:(jClass := (Java at:'java.lang.Class') new). |
|
2022 |
JavaClasses at:jClass put:aClass. |
|
268
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2023 |
]. |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2024 |
^ jClass |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2025 |
|
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2026 |
"Created: / 23.1.1998 / 17:43:38 / cg" |
405 | 2027 |
"Modified: / 21.10.1998 / 02:50:15 / cg" |
268
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2028 |
! |
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
2029 |
|
321 | 2030 |
javaMethodObjectForMethod:aMethod |
2031 |
"given a real method, return the corresponding java.lang.reflect.Method |
|
2032 |
instance for it." |
|
2033 |
||
2034 |
|jMethod| |
|
2035 |
||
2036 |
jMethod := JavaMethods at:aMethod ifAbsent:nil. |
|
2037 |
jMethod isNil ifTrue:[ |
|
2038 |
"/ class must be initialized (with all of its superclasses ?). |
|
2039 |
||
2040 |
JavaMethods at:aMethod put:(jMethod := (Java at:'java.lang.reflect.Method') new). |
|
2041 |
JavaMethods at:jMethod put:aMethod. |
|
2042 |
]. |
|
2043 |
^ jMethod |
|
2044 |
||
2045 |
"Modified: / 23.1.1998 / 17:46:51 / cg" |
|
2046 |
"Created: / 9.2.1998 / 15:59:16 / cg" |
|
2047 |
! |
|
2048 |
||
253 | 2049 |
javaThreadForSTProcess:stProcess |
2050 |
|t| |
|
2051 |
||
2052 |
t := Java threads keyAtValue:stProcess ifAbsent:nil. |
|
2053 |
t == 0 ifTrue:[ |
|
261 | 2054 |
^ nil |
253 | 2055 |
]. |
2056 |
^ t |
|
2057 |
||
2058 |
"Modified: / 26.8.1997 / 19:56:31 / cg" |
|
2059 |
"Created: / 3.1.1998 / 01:53:41 / cg" |
|
2060 |
! |
|
2061 |
||
321 | 2062 |
methodForJavaMethodObject:aJavaMethodObject |
2063 |
"given java.lang.reflect.Method instance, return the real method for it." |
|
2064 |
||
2065 |
^ JavaMethods at:aJavaMethodObject ifAbsent:nil. |
|
2066 |
||
2067 |
"Created: / 9.2.1998 / 16:01:48 / cg" |
|
2068 |
! |
|
2069 |
||
253 | 2070 |
newThread:name |
274 | 2071 |
|thread threadClass i| |
253 | 2072 |
|
2073 |
threadClass := Java at:'java.lang.Thread'. |
|
2074 |
||
2075 |
thread := (Java at:'java.lang.Thread') basicNew. |
|
2076 |
thread instVarNamed:'name' put:(Java as_String:name). |
|
2077 |
thread instVarNamed:'priority' put:(threadClass instVarNamed:'NORM_PRIORITY'). |
|
2078 |
thread instVarNamed:'single_step' put:0. |
|
2079 |
thread instVarNamed:'daemon' put:0. |
|
2080 |
thread instVarNamed:'stillborn' put:0. |
|
2081 |
thread instVarNamed:'target' put:nil. |
|
274 | 2082 |
"/ |
2083 |
"/ that on was only temporarily present in JDK1.1.3 (sigh) |
|
2084 |
"/ |
|
2085 |
(i := thread class instVarOffsetOf:'initial_stack_memory') notNil ifTrue:[ |
|
2086 |
thread instVarAt:i put:0. |
|
2087 |
]. |
|
253 | 2088 |
thread instVarNamed:'group' put:(self standardThreadGroup). |
2089 |
^ thread |
|
2090 |
||
2091 |
"Created: / 3.1.1998 / 01:47:30 / cg" |
|
274 | 2092 |
"Modified: / 27.1.1998 / 00:54:33 / cg" |
253 | 2093 |
! |
2094 |
||
2095 |
stProcessForJavaThread:jThread |
|
2096 |
|p| |
|
2097 |
||
2098 |
p := Java threads at:jThread ifAbsent:nil. |
|
2099 |
p == 0 ifTrue:[ |
|
261 | 2100 |
^ nil |
253 | 2101 |
]. |
2102 |
^ p |
|
2103 |
||
2104 |
"Created: / 2.1.1998 / 21:48:27 / cg" |
|
2105 |
"Modified: / 3.1.1998 / 01:53:55 / cg" |
|
2106 |
! |
|
2107 |
||
2108 |
standardThreadGroup |
|
2109 |
|standardGroup threadClass| |
|
2110 |
||
2111 |
StandardThreadGroup isNil ifTrue:[ |
|
457 | 2112 |
threadClass := Java at:'java.lang.Thread'. |
2113 |
||
2114 |
standardGroup := (Java at:'java.lang.ThreadGroup') new. |
|
2115 |
standardGroup instVarNamed:'parent' put:nil. |
|
2116 |
standardGroup instVarNamed:'name' put:(Java as_String:'main'). |
|
2117 |
standardGroup instVarNamed:'maxPriority' put:(threadClass instVarNamed:'MAX_PRIORITY'). |
|
2118 |
standardGroup instVarNamed:'destroyed' put:0. |
|
2119 |
standardGroup instVarNamed:'daemon' put:nil. |
|
2120 |
(standardGroup class instVarOffsetOf:'vmAllowSuspension') notNil ifTrue:[ |
|
2121 |
standardGroup instVarNamed:'vmAllowSuspension' put:0. |
|
2122 |
]. |
|
2123 |
standardGroup instVarNamed:'nthreads' put:0. |
|
2124 |
standardGroup instVarNamed:'ngroups' put:0. |
|
2125 |
standardGroup instVarNamed:'groups' put:nil. |
|
2126 |
StandardThreadGroup := standardGroup. |
|
253 | 2127 |
]. |
2128 |
^ StandardThreadGroup |
|
2129 |
||
2130 |
"Created: / 3.1.1998 / 01:41:54 / cg" |
|
457 | 2131 |
"Modified: / 17.11.1998 / 22:55:30 / cg" |
253 | 2132 |
! |
2133 |
||
2134 |
wakeup:anObject |
|
2135 |
JavaVM releaseAndSignalSemaphoreFor:anObject. |
|
2136 |
||
2137 |
"Created: / 3.1.1998 / 02:29:27 / cg" |
|
2138 |
"Modified: / 3.1.1998 / 03:08:05 / cg" |
|
2139 |
! |
|
2140 |
||
2141 |
wakeupAll:anObject |
|
2142 |
JavaVM releaseAndSignalForAllSemaphoreFor:anObject. |
|
2143 |
||
2144 |
"Created: / 3.1.1998 / 03:07:48 / cg" |
|
2145 |
"Modified: / 3.1.1998 / 03:08:15 / cg" |
|
2146 |
! ! |
|
2147 |
||
2148 |
!JavaVM class methodsFor:'helpers - awt'! |
|
2149 |
||
2150 |
commonReshapeComponent:nativeContext |
|
277 | 2151 |
|view x y width height ext menu| |
2152 |
||
2153 |
view := self viewForWPeer:nativeContext. |
|
253 | 2154 |
|
2155 |
x := nativeContext argAt:1. |
|
2156 |
y := nativeContext argAt:2. |
|
2157 |
width := nativeContext argAt:3. |
|
2158 |
height := nativeContext argAt:4. |
|
261 | 2159 |
ext := width@height. |
253 | 2160 |
|
2161 |
"/ 'pReshape ' print. view print. |
|
2162 |
"/ ' ' print. x print. '/' print. y print. |
|
261 | 2163 |
"/ ' extent: ' print. ext printNL. |
483 | 2164 |
view isPopUpView ifTrue:[ |
2165 |
view origin:x@y extent:ext. |
|
2166 |
] ifFalse:[ |
|
2167 |
(view isTopView |
|
2168 |
or:[view isMemberOf:JavaEmbeddedFrameView]) ifTrue:[ |
|
2169 |
"/ |
|
2170 |
"/ dont allow setting the origin |
|
2171 |
"/ |
|
2172 |
menu := self topViewsMenu:view. |
|
2173 |
menu notNil ifTrue:[ |
|
2174 |
"/ must add the menus height |
|
2175 |
height := height + menu height. |
|
2176 |
ext := width@height. |
|
261 | 2177 |
]. |
483 | 2178 |
|
2179 |
"/ to prevent a view from not being visible/closable |
|
2180 |
"/ in case Java goes mad .. |
|
2181 |
||
2182 |
(width < 30 |
|
2183 |
or:[height < 10]) ifTrue:[ |
|
2184 |
"/ self halt. |
|
2185 |
width := 30. |
|
2186 |
height := 20. |
|
2187 |
ext := width@height. |
|
2188 |
]. |
|
2189 |
||
2190 |
view extent:ext. |
|
2191 |
(view isKindOf:ModalBox) ifTrue:[ |
|
2192 |
view preferredExtent:ext |
|
2193 |
]. |
|
2194 |
||
2195 |
"/ adjust non-resizable views min/max |
|
2196 |
||
2197 |
view isTopView ifTrue:[ |
|
2198 |
view minExtent notNil ifTrue:[ |
|
2199 |
view minExtent:ext. |
|
2200 |
view maxExtent:ext |
|
2201 |
]. |
|
253 | 2202 |
] |
261 | 2203 |
] ifFalse:[ |
483 | 2204 |
(view superView notNil |
2205 |
and:[view superView isTopView]) ifTrue:[ |
|
2206 |
menu := self topViewsMenu:view superView. |
|
2207 |
menu notNil ifTrue:[ |
|
2208 |
"/ must add menus height to yPos |
|
2209 |
y := y + menu height. |
|
2210 |
] |
|
2211 |
] ifFalse:[ |
|
2212 |
"/ post a configuration event |
|
2213 |
EventTrace == true ifTrue:[ |
|
2214 |
'JAVA: configure: need event' printCR. |
|
2215 |
] |
|
2216 |
]. |
|
2217 |
view origin:x@y extent:ext. |
|
253 | 2218 |
]. |
2219 |
]. |
|
2220 |
||
2221 |
^ nil |
|
2222 |
||
2223 |
"Created: / 4.1.1998 / 18:00:52 / cg" |
|
483 | 2224 |
"Modified: / 4.12.1998 / 17:35:30 / cg" |
253 | 2225 |
! |
2226 |
||
2227 |
createdWindowsView:aView for:aJavaPeer |
|
2228 |
"this is only sent with the sun.awt.windows toolkit" |
|
2229 |
||
2230 |
aJavaPeer instVarNamed:'pData' put:aView. |
|
2231 |
||
2232 |
JavaWindowGroup isNil ifTrue:[ |
|
284 | 2233 |
JavaWindowGroup := WindowGroup new. |
2234 |
JavaWindowGroup isForModalSubview:true. |
|
253 | 2235 |
]. |
2236 |
aView windowGroup:JavaWindowGroup. |
|
2237 |
JavaWindowGroup addView:aView. |
|
2238 |
||
2239 |
KnownWindows isNil ifTrue:[ |
|
284 | 2240 |
KnownWindows := IdentityDictionary new. |
253 | 2241 |
]. |
2242 |
KnownWindows at:aJavaPeer put:aView. |
|
2243 |
||
284 | 2244 |
FirstWindowCreationSemaphore signalIf. |
2245 |
||
261 | 2246 |
"/'*** ' print. aJavaPeer print. ' -> ' print. aView printCR. |
2247 |
"/(aView isKindOf:ModalBox) ifTrue:[ |
|
2248 |
"/ self halt. |
|
2249 |
"/]. |
|
2250 |
||
253 | 2251 |
"Created: / 4.1.1998 / 17:57:16 / cg" |
284 | 2252 |
"Modified: / 28.1.1998 / 22:40:19 / cg" |
253 | 2253 |
! |
2254 |
||
255 | 2255 |
gcForWGraphics:nativeContext |
270 | 2256 |
|jGraphics gc orgX orgY trans| |
255 | 2257 |
|
2258 |
jGraphics := nativeContext receiver. |
|
459 | 2259 |
O_WGgraphics_pData isNil ifTrue:[ |
2260 |
O_WGgraphics_pData := (jGraphics class instVarOffsetOf:'pData'). |
|
2261 |
]. |
|
2262 |
O_WGgraphics_originX isNil ifTrue:[ |
|
2263 |
O_WGgraphics_originX := (jGraphics class instVarOffsetOf:'originX'). |
|
2264 |
]. |
|
2265 |
O_WGgraphics_originY isNil ifTrue:[ |
|
2266 |
O_WGgraphics_originY := (jGraphics class instVarOffsetOf:'originY'). |
|
2267 |
]. |
|
2268 |
gc := jGraphics instVarAt:O_WGgraphics_pData. |
|
270 | 2269 |
|
2270 |
trans := gc translation. |
|
459 | 2271 |
orgX := jGraphics instVarAt:O_WGgraphics_originX. |
2272 |
orgY := jGraphics instVarAt:O_WGgraphics_originY. |
|
270 | 2273 |
((orgX ~~ trans x) or:[orgY ~~ trans y]) ifTrue:[ |
2274 |
gc translation:orgX@orgY |
|
2275 |
]. |
|
255 | 2276 |
^ gc |
2277 |
||
2278 |
"Created: / 8.1.1998 / 00:16:38 / cg" |
|
459 | 2279 |
"Modified: / 19.11.1998 / 01:44:12 / cg" |
255 | 2280 |
! |
2281 |
||
261 | 2282 |
jPeerForView:aView |
2283 |
^ KnownWindows keyAtValue:aView ifAbsent:nil |
|
2284 |
||
2285 |
"Created: / 15.1.1998 / 13:48:01 / cg" |
|
2286 |
"Modified: / 15.1.1998 / 13:48:43 / cg" |
|
2287 |
! |
|
2288 |
||
255 | 2289 |
pReshape:nativeContext |
2290 |
|jFramePeer view x y width height menu| |
|
2291 |
||
2292 |
jFramePeer := nativeContext receiver. |
|
2293 |
view := jFramePeer instVarNamed:'pData'. |
|
2294 |
||
2295 |
x := nativeContext argAt:1. |
|
2296 |
y := nativeContext argAt:2. |
|
2297 |
width := nativeContext argAt:3. |
|
2298 |
height := nativeContext argAt:4. |
|
2299 |
||
2300 |
"/ 'pReshape ' print. view print. |
|
2301 |
"/ ' ' print. x print. '/' print. y print. |
|
2302 |
"/ ' extent: ' print. width print. '/' print. height printNL. |
|
2303 |
||
2304 |
(view isTopView |
|
2305 |
or:[view isMemberOf:JavaEmbeddedFrameView]) ifTrue:[ |
|
261 | 2306 |
"/ |
2307 |
"/ dont allow setting the origin |
|
2308 |
"/ |
|
2309 |
menu := self topViewsMenu:view. |
|
2310 |
menu notNil ifTrue:[ |
|
2311 |
"/ must add the menus height |
|
2312 |
height := height + menu height |
|
2313 |
]. |
|
2314 |
view extent:width@height. |
|
255 | 2315 |
] ifFalse:[ |
261 | 2316 |
(view superView notNil |
2317 |
and:[view superView isTopView]) ifTrue:[ |
|
2318 |
menu := self topViewsMenu:view superView. |
|
2319 |
menu notNil ifTrue:[ |
|
2320 |
"/ must add menus height to yPos |
|
2321 |
y := y + menu height. |
|
2322 |
] |
|
2323 |
]. |
|
2324 |
view origin:x@y extent:width@height. |
|
255 | 2325 |
]. |
2326 |
||
2327 |
^ nil |
|
2328 |
||
2329 |
"Modified: / 21.8.1997 / 19:34:16 / cg" |
|
2330 |
"Created: / 7.1.1998 / 21:47:11 / cg" |
|
2331 |
! |
|
2332 |
||
253 | 2333 |
topViewsMenu:view |
2334 |
|idx| |
|
2335 |
||
2336 |
view isTopView ifTrue:[ |
|
261 | 2337 |
view subViews size > 0 ifTrue:[ |
2338 |
(idx := view subViews findFirst:[:v | v isMemberOf:MenuPanel]) ~~ 0 ifTrue:[ |
|
2339 |
"/ must add the menus height |
|
2340 |
^ view subViews at:idx |
|
2341 |
] |
|
2342 |
]. |
|
253 | 2343 |
]. |
2344 |
^ nil |
|
2345 |
||
2346 |
"Modified: / 4.8.1997 / 01:23:06 / cg" |
|
2347 |
"Created: / 4.1.1998 / 18:01:42 / cg" |
|
255 | 2348 |
! |
2349 |
||
2350 |
viewForWPeer:nativeContext |
|
459 | 2351 |
|jPeer| |
255 | 2352 |
|
2353 |
jPeer := nativeContext receiver. |
|
277 | 2354 |
|
2355 |
"/ sigh; pData was renamed to pNativeWidget in jdk1.2 ... |
|
459 | 2356 |
O_FramePeer_pNativeWidget isNil ifTrue:[ |
2357 |
O_FramePeer_pNativeWidget := (jPeer class instVarOffsetOf:'pNativeWidget'). |
|
2358 |
O_FramePeer_pNativeWidget isNil ifTrue:[ |
|
2359 |
O_FramePeer_pNativeWidget := 0. |
|
2360 |
O_FramePeer_pData isNil ifTrue:[ |
|
2361 |
O_FramePeer_pData := (jPeer class instVarOffsetOf:'pData'). |
|
2362 |
]. |
|
2363 |
] |
|
2364 |
]. |
|
2365 |
O_FramePeer_pNativeWidget > 0 ifTrue:[ |
|
277 | 2366 |
"/ ok, we are < 1.2 |
459 | 2367 |
^ jPeer instVarAt:O_FramePeer_pNativeWidget. |
2368 |
]. |
|
2369 |
^ jPeer instVarAt:O_FramePeer_pData. |
|
2370 |
||
2371 |
"Modified: / 19.11.1998 / 01:43:20 / cg" |
|
253 | 2372 |
! ! |
2373 |
||
2374 |
!JavaVM class methodsFor:'helpers - exceptions'! |
|
2375 |
||
261 | 2376 |
throwArrayIndexOutOfBoundsException:badIndex |
2377 |
|exClass ex| |
|
2378 |
||
2379 |
"/ self |
|
2380 |
"/ throwExceptionClassName:'java.lang.ArrayIndexOutOfBoundsException' |
|
2381 |
"/ withMessage:'bad array index: ' , badIndex printString |
|
2382 |
||
2383 |
exClass := Java classForName:'java.lang.ArrayIndexOutOfBoundsException'. |
|
459 | 2384 |
ex := exClass newWith_int:badIndex. |
261 | 2385 |
|
2386 |
self throwException:ex |
|
2387 |
||
2388 |
"Created: / 14.1.1998 / 21:36:05 / cg" |
|
459 | 2389 |
"Modified: / 20.11.1998 / 13:27:14 / cg" |
261 | 2390 |
! |
2391 |
||
253 | 2392 |
throwClassNotFoundException |
255 | 2393 |
self |
261 | 2394 |
throwExceptionClassName:'java.lang.ClassNotFoundException' |
2395 |
withMessage:'no such class' |
|
255 | 2396 |
|
253 | 2397 |
"Created: / 4.1.1998 / 22:25:26 / cg" |
255 | 2398 |
"Modified: / 7.1.1998 / 15:25:35 / cg" |
253 | 2399 |
! |
2400 |
||
2401 |
throwClassNotFoundException:className |
|
255 | 2402 |
self |
429 | 2403 |
throwExceptionClassName:'java.lang.ClassNotFoundException' |
2404 |
withMessage:'no such class: ' , className |
|
255 | 2405 |
|
253 | 2406 |
"Created: / 4.1.1998 / 22:26:09 / cg" |
429 | 2407 |
"Modified: / 10.11.1998 / 13:20:31 / cg" |
255 | 2408 |
! |
2409 |
||
2410 |
throwException:aJavaException |
|
459 | 2411 |
|con jMsg msg exClass srchCon handlerContext handlerPC method pc hPC| |
255 | 2412 |
|
2413 |
ExceptionTrace ifTrue:[ |
|
347 | 2414 |
'JAVA: exception: ' print. aJavaException class fullName printCR. |
255 | 2415 |
]. |
2416 |
ExceptionDebug ifTrue:[ |
|
347 | 2417 |
self halt:('JAVA: exception: ' , aJavaException class fullName). |
448 | 2418 |
"/ self internalError:('JAVA: exception: ' , aJavaException class fullName). |
255 | 2419 |
]. |
2420 |
||
459 | 2421 |
"/ |
2422 |
"/ search stack for a javaContext which handles that exception |
|
2423 |
"/ |
|
2424 |
srchCon := thisContext sender. |
|
2425 |
[handlerContext isNil and:[srchCon notNil]] whileTrue:[ |
|
2426 |
(srchCon isJavaContext) ifTrue:[ |
|
2427 |
method := srchCon method. |
|
2428 |
pc := srchCon pc. |
|
2429 |
(hPC := method handlerFor:aJavaException at:pc) notNil ifTrue:[ |
|
2430 |
handlerPC := hPC. |
|
2431 |
handlerContext := srchCon |
|
2432 |
]. |
|
2433 |
]. |
|
2434 |
srchCon := srchCon sender. |
|
2435 |
]. |
|
2436 |
||
2437 |
handlerContext isNil ifTrue:[ |
|
2438 |
"/ |
|
2439 |
"/ no JavaHandler ... let smalltalk handle it |
|
2440 |
"/ |
|
347 | 2441 |
exClass := aJavaException class. |
459 | 2442 |
msg := 'Java ' , exClass name. |
347 | 2443 |
jMsg := aJavaException instVarNamed:'detailMessage'. |
2444 |
jMsg notNil ifTrue:[ |
|
459 | 2445 |
msg := msg , ': ' , (Java as_ST_String:jMsg). |
347 | 2446 |
]. |
2447 |
||
459 | 2448 |
"/ for our convenience: skip ST contexts |
2449 |
"/ (i.e. the handler or debugger will see the javaContext first ) |
|
2450 |
||
347 | 2451 |
con := thisContext sender. |
2452 |
[con isNil or:[con isJavaContext]] whileFalse:[ |
|
2453 |
con := con sender |
|
2454 |
]. |
|
2455 |
con isNil ifTrue:[con := thisContext sender]. |
|
2456 |
||
2457 |
JavaVM javaExceptionSignal |
|
2458 |
raiseWith:aJavaException |
|
2459 |
errorString:msg |
|
2460 |
in:con. |
|
2461 |
Processor activeProcess terminate. |
|
459 | 2462 |
] ifFalse:[ |
2463 |
"/ |
|
2464 |
"/ found a java exceptionHandler |
|
2465 |
"/ |
|
2466 |
handlerContext setPC:handlerPC. |
|
2467 |
handlerContext exceptionArg:aJavaException. |
|
2468 |
handlerContext markForException. |
|
2469 |
handlerContext unwindAndRestart. |
|
2470 |
self halt:'should not be reached'. |
|
2471 |
Processor activeProcess terminate. |
|
2472 |
]. |
|
255 | 2473 |
|
2474 |
"Created: / 7.1.1998 / 15:28:22 / cg" |
|
459 | 2475 |
"Modified: / 20.11.1998 / 13:25:22 / cg" |
255 | 2476 |
! |
2477 |
||
2478 |
throwExceptionClassName:aJavaExceptionClassName withMessage:someMessage |
|
261 | 2479 |
|exClass ex| |
2480 |
||
2481 |
exClass := Java classForName:aJavaExceptionClassName. |
|
2482 |
ex := exClass newCleared. |
|
2483 |
ex perform:#'<init>(Ljava/lang/String;)V' with:(Java as_String:someMessage). |
|
2484 |
||
2485 |
"/ ex := exClass new. |
|
2486 |
"/ ex instVarNamed:'detailMessage' put:(Java as_String:someMessage). |
|
255 | 2487 |
|
2488 |
self throwException:ex |
|
2489 |
||
2490 |
"Created: / 7.1.1998 / 15:25:09 / cg" |
|
261 | 2491 |
"Modified: / 14.1.1998 / 23:38:30 / cg" |
255 | 2492 |
! |
2493 |
||
2494 |
throwIOExceptionWithMessage:message |
|
2495 |
self |
|
261 | 2496 |
throwExceptionClassName:'java.io.IOException' |
2497 |
withMessage:message |
|
255 | 2498 |
|
2499 |
"Created: / 7.1.1998 / 10:34:24 / cg" |
|
2500 |
"Modified: / 7.1.1998 / 15:26:25 / cg" |
|
2501 |
! |
|
2502 |
||
261 | 2503 |
throwIllegalAccessException |
2504 |
self |
|
270 | 2505 |
throwExceptionClassName:'java.lang.IllegalAccessException' |
2506 |
withMessage:'illegal access' |
|
261 | 2507 |
|
2508 |
"Modified: / 7.1.1998 / 15:25:35 / cg" |
|
2509 |
"Created: / 14.1.1998 / 23:13:44 / cg" |
|
2510 |
! |
|
2511 |
||
2512 |
throwInstantiationException |
|
2513 |
self |
|
270 | 2514 |
throwExceptionClassName:'java.lang.InstantiationException' |
2515 |
withMessage:'cannot instantiate' |
|
261 | 2516 |
|
2517 |
"Modified: / 7.1.1998 / 15:25:35 / cg" |
|
2518 |
"Created: / 14.1.1998 / 23:15:01 / cg" |
|
2519 |
! |
|
2520 |
||
2521 |
throwInstantiationExceptionFor:aJavaClass |
|
2522 |
self |
|
270 | 2523 |
throwExceptionClassName:'java.lang.InstantiationException' |
2524 |
withMessage:('cannot instantiate ' , aJavaClass fullName) |
|
261 | 2525 |
|
2526 |
"Modified: / 7.1.1998 / 15:25:35 / cg" |
|
2527 |
"Created: / 14.1.1998 / 23:17:02 / cg" |
|
2528 |
! |
|
2529 |
||
255 | 2530 |
throwNullPointerException |
280 | 2531 |
self halt:'null pointer exception'. |
255 | 2532 |
self |
280 | 2533 |
throwExceptionClassName:'java.lang.NullPointerException' |
2534 |
withMessage:'null pointer' |
|
2535 |
||
255 | 2536 |
"Created: / 9.1.1998 / 02:26:08 / cg" |
280 | 2537 |
"Modified: / 28.1.1998 / 02:30:09 / cg" |
255 | 2538 |
! |
2539 |
||
2540 |
throwNumberFormatException |
|
2541 |
self |
|
261 | 2542 |
throwExceptionClassName:'java.lang.NumberFormatException' |
2543 |
withMessage:'bad number format' |
|
255 | 2544 |
|
2545 |
"Modified: / 7.1.1998 / 15:25:35 / cg" |
|
2546 |
"Created: / 11.1.1998 / 16:08:22 / cg" |
|
253 | 2547 |
! ! |
2548 |
||
2549 |
!JavaVM class methodsFor:'helpers - io'! |
|
2550 |
||
307 | 2551 |
anyStream_close:nativeContext |
2552 |
|jStream fileNo file| |
|
2553 |
||
2554 |
jStream := nativeContext receiver. |
|
2555 |
||
2556 |
fileNo := self validateFileNo:jStream. |
|
261 | 2557 |
fileNo == 0 ifTrue:[ |
280 | 2558 |
'JAVA: file is already closed' errorPrintCR. |
2559 |
^ self "/ already closed |
|
261 | 2560 |
]. |
253 | 2561 |
file := self getOpenFileAt:fileNo. |
2562 |
file isNil ifTrue:[ |
|
280 | 2563 |
self halt:'invalid fileNo in close'. |
2564 |
self internalError:'invalid fileNo in close'. |
|
2565 |
^ self |
|
253 | 2566 |
]. |
2567 |
||
2568 |
"/ should always be bytes |
|
2569 |
||
2570 |
(file ~~ Stdin |
|
2571 |
and:[file ~~ Stdout |
|
280 | 2572 |
and:[file ~~ Stderr |
2573 |
and:[file ~~ Transcript]]]) ifTrue:[ |
|
2574 |
file close. |
|
253 | 2575 |
]. |
2576 |
self setOpenFile:nil at:fileNo. |
|
2577 |
||
307 | 2578 |
fileNo := jStream instVarNamed:'fd'. |
261 | 2579 |
fileNo isInteger ifFalse:[ |
280 | 2580 |
"/ JDK 1.1.3 |
2581 |
fileNo instVarNamed:'fd' put:0. |
|
261 | 2582 |
] ifTrue:[ |
280 | 2583 |
"/ JDK 1.0 |
307 | 2584 |
jStream instVarNamed:'fd' put:0 |
2585 |
]. |
|
2586 |
||
2587 |
"Created: / 4.2.1998 / 15:22:03 / cg" |
|
374 | 2588 |
"Modified: / 14.10.1998 / 15:10:07 / cg" |
307 | 2589 |
! |
2590 |
||
2591 |
anyStream_readBytes:nativeContext |
|
2592 |
|bytes offset count stream nRead| |
|
2593 |
||
2594 |
bytes := nativeContext argAt:1. |
|
2595 |
offset := nativeContext argAt:2. |
|
2596 |
count := nativeContext argAt:3. |
|
2597 |
||
2598 |
stream := self validateFile:(nativeContext receiver). |
|
2599 |
||
2600 |
"/ should always be bytes |
|
2601 |
bytes class isBytes ifFalse:[ |
|
2602 |
self halt. |
|
2603 |
]. |
|
2604 |
stream == Stdin ifTrue:[ |
|
2605 |
self halt:'reading from standardInput ...'. |
|
432 | 2606 |
^ -1 "/ 0 |
307 | 2607 |
]. |
2608 |
||
2609 |
FileIOTrace ifTrue:[ |
|
2610 |
('JAVA: read ' , count printString , ' bytes from ' , stream pathName) infoPrintCR. |
|
2611 |
]. |
|
2612 |
||
2613 |
stream isPositionable ifFalse:[ |
|
2614 |
"/ mhmh - some kind of socket or pipe |
|
2615 |
||
2616 |
stream readWait. |
|
2617 |
]. |
|
2618 |
||
2619 |
Stream readErrorSignal handle:[:ex | |
|
2620 |
nRead := -1 |
|
2621 |
] do:[ |
|
2622 |
nRead := stream nextAvailableBytes:count into:bytes startingAt:offset+1. |
|
2623 |
]. |
|
2624 |
nRead == 0 ifTrue:[ |
|
2625 |
stream atEnd ifTrue:[ |
|
2626 |
FileIOTrace ifTrue:[ |
|
2627 |
('JAVA: at EOF ' , nRead printString) infoPrintCR. |
|
2628 |
]. |
|
2629 |
^ -1 |
|
2630 |
]. |
|
2631 |
]. |
|
2632 |
count ~~ nRead ifTrue:[ |
|
2633 |
FileIOTrace ifTrue:[ |
|
2634 |
('JAVA: only got ' , nRead printString) infoPrintCR. |
|
2635 |
] |
|
2636 |
]. |
|
2637 |
^ nRead |
|
2638 |
||
2639 |
"Created: / 4.2.1998 / 15:20:00 / cg" |
|
432 | 2640 |
"Modified: / 10.11.1998 / 19:56:47 / cg" |
307 | 2641 |
! |
2642 |
||
2643 |
anyStream_writeBytes:nativeContext |
|
2644 |
|bytes offset count stream| |
|
2645 |
||
2646 |
bytes := nativeContext argAt:1. |
|
2647 |
offset := nativeContext argAt:2. |
|
2648 |
count := nativeContext argAt:3. |
|
2649 |
||
2650 |
stream := self validateFile:(nativeContext receiver). |
|
2651 |
||
2652 |
FileIOTrace ifTrue:[ |
|
2653 |
stream isFileStream ifTrue:[ |
|
2654 |
('JAVA: write ' , count printString , ' bytes to ' , stream pathName) infoPrintCR. |
|
2655 |
] ifFalse:[ |
|
2656 |
stream ~~ Stdout ifTrue:[ |
|
2657 |
stream ~~ Stderr ifTrue:[ |
|
2658 |
('JAVA: write ' , count printString , ' bytes to ' , stream displayString) infoPrintCR. |
|
2659 |
] |
|
2660 |
] |
|
2661 |
] |
|
2662 |
]. |
|
2663 |
||
2664 |
"/ should always be bytes |
|
2665 |
Stream writeErrorSignal handle:[:ex | |
|
2666 |
ex return |
|
2667 |
] do:[ |
|
2668 |
Socket brokenConnectionSignal handle:[:ex | |
|
2669 |
ex return |
|
2670 |
] do:[ |
|
2671 |
stream nextPutBytes:count from:bytes startingAt:offset+1 |
|
2672 |
] |
|
2673 |
]. |
|
2674 |
||
2675 |
"Created: / 4.2.1998 / 15:23:58 / cg" |
|
2676 |
"Modified: / 4.2.1998 / 19:38:26 / cg" |
|
261 | 2677 |
! |
2678 |
||
479 | 2679 |
checkWritePermissionOfDirectory:dir message:msg |
2680 |
|answer| |
|
2681 |
||
2682 |
(PermittedDirectories notNil |
|
2683 |
and:[PermittedDirectories includes:dir]) ifFalse:[ |
|
2684 |
FileOpenConfirmation ifTrue:[ |
|
2685 |
answer := Dialog |
|
2686 |
confirmWithCancel:msg withCRs |
|
2687 |
labels:#('no' 'grant') |
|
2688 |
values:#(false true) |
|
2689 |
default:2. |
|
2690 |
answer == false ifTrue:[ |
|
2691 |
^ false |
|
2692 |
]. |
|
2693 |
||
2694 |
(self confirm:('JAVA Security check\\Always permit writes in this directory (''' , dir pathName , ''') ?') withCRs) |
|
2695 |
ifTrue:[ |
|
2696 |
PermittedDirectories isNil ifTrue:[ |
|
2697 |
PermittedDirectories := Set new |
|
2698 |
]. |
|
2699 |
PermittedDirectories add:dir. |
|
2700 |
] |
|
2701 |
] |
|
2702 |
]. |
|
2703 |
^ true |
|
2704 |
||
2705 |
"Created: / 3.12.1998 / 15:07:56 / cg" |
|
2706 |
"Modified: / 3.12.1998 / 15:16:55 / cg" |
|
2707 |
! |
|
2708 |
||
331 | 2709 |
commonOpen:nativeContext forAppend:forAppend |
442 | 2710 |
|fs fd fn name dir stream fileNo answer readonly| |
331 | 2711 |
|
2712 |
fs := nativeContext receiver. |
|
2713 |
fd := fs instVarNamed:'fd'. |
|
2714 |
(fd instVarNamed:'fd') ~~ 0 ifTrue:[ |
|
2715 |
self halt:'file already open'. |
|
2716 |
self internalError:'file already open'. |
|
2717 |
^ self. |
|
2718 |
]. |
|
2719 |
||
2720 |
name := nativeContext argAt:1. |
|
2721 |
name := Java as_ST_String:name. |
|
2722 |
||
2723 |
FileOpenTrace ifTrue:[ |
|
2724 |
('JAVA: opening ' , name) infoPrintCR. |
|
2725 |
]. |
|
2726 |
||
2727 |
fn := name asFilename. |
|
2728 |
dir := fn directory pathName. |
|
442 | 2729 |
|
331 | 2730 |
(PermittedDirectories notNil |
2731 |
and:[PermittedDirectories includes:dir]) ifFalse:[ |
|
2732 |
FileOpenConfirmation ifTrue:[ |
|
442 | 2733 |
answer := Dialog |
2734 |
confirmWithCancel:('JAVA Security check\\Opening ''' , name , ''' for read/write.\Grant permission ?') withCRs |
|
2735 |
labels:#('no' 'grant' 'readonly') |
|
2736 |
values:#(false true #readonly) |
|
2737 |
default:3. |
|
2738 |
answer == false ifTrue:[ |
|
331 | 2739 |
self throwIOExceptionWithMessage:('no permission to open ' , name , ' for writing'). |
2740 |
^ self |
|
2741 |
]. |
|
442 | 2742 |
readonly := (answer == #readonly). |
2743 |
||
2744 |
readonly ifFalse:[ |
|
2745 |
(self confirm:('JAVA Security check\\Always permit writes in this directory (''' , dir , ''') ?') withCRs) |
|
2746 |
ifTrue:[ |
|
2747 |
PermittedDirectories isNil ifTrue:[ |
|
2748 |
PermittedDirectories := Set new |
|
2749 |
]. |
|
2750 |
PermittedDirectories add:dir. |
|
2751 |
] |
|
331 | 2752 |
] |
2753 |
] |
|
2754 |
]. |
|
2755 |
||
442 | 2756 |
readonly ifTrue:[ |
2757 |
stream := fn readStream. |
|
331 | 2758 |
] ifFalse:[ |
442 | 2759 |
forAppend ifTrue:[ |
2760 |
stream := fn appendingWriteStream. |
|
2761 |
] ifFalse:[ |
|
2762 |
stream := fn writeStream. |
|
2763 |
] |
|
331 | 2764 |
]. |
2765 |
stream isNil ifTrue:[ |
|
2766 |
self throwIOExceptionWithMessage:('cannot open ' , name , ' for writing'). |
|
2767 |
]. |
|
2768 |
||
2769 |
fileNo := self addOpenFile:stream. |
|
2770 |
||
2771 |
FileOpenTrace ifTrue:[ |
|
2772 |
('JAVA: opened ' , name , ' as FD ' , fileNo printString , ' for writing') infoPrintCR. |
|
2773 |
]. |
|
2774 |
||
2775 |
fd instVarNamed:'fd' put:fileNo. |
|
2776 |
||
2777 |
"Created: / 7.4.1998 / 19:14:09 / cg" |
|
442 | 2778 |
"Modified: / 12.11.1998 / 21:31:24 / cg" |
331 | 2779 |
! |
2780 |
||
261 | 2781 |
fileStreamForReading:name |
2782 |
|fn stream tryAlongClassPath| |
|
2783 |
||
2784 |
fn := name asFilename. |
|
2785 |
stream := fn readStream. |
|
2786 |
stream notNil ifTrue:[^ stream]. |
|
2787 |
||
2788 |
fn isAbsolute ifFalse:[ |
|
405 | 2789 |
"/ if not absolute, try along classPath |
2790 |
"/ This allows classes to open local files (JEdit) |
|
2791 |
"/ even if they have NOT been loaded by a Java classLoader. |
|
2792 |
"/ Only do this for image files |
|
2793 |
"/ (and maybe some other config files in the future), |
|
2794 |
"/ to avoid security holes. |
|
2795 |
tryAlongClassPath := true. |
|
2796 |
"/ tryAlongClassPath := false. |
|
2797 |
"/ (fn hasSuffix:'gif') ifTrue:[ |
|
2798 |
"/ tryAlongClassPath := true. |
|
2799 |
"/ ]. |
|
2800 |
"/ (fn hasSuffix:'jpg') ifTrue:[ |
|
2801 |
"/ tryAlongClassPath := true. |
|
2802 |
"/ ]. |
|
2803 |
||
2804 |
tryAlongClassPath ifTrue:[ |
|
2805 |
Java classPath do:[:dirName | |
|
2806 |
|fn| |
|
2807 |
||
2808 |
(fn := dirName asFilename construct:name) exists ifTrue:[ |
|
2809 |
stream := fn readStream. |
|
2810 |
stream notNil ifTrue:[^ stream]. |
|
2811 |
] |
|
2812 |
] |
|
2813 |
] |
|
261 | 2814 |
]. |
2815 |
^ nil. |
|
2816 |
||
405 | 2817 |
"Modified: / 21.10.1998 / 01:38:50 / cg" |
2818 |
! |
|
2819 |
||
2820 |
fixFilename:path |
|
2821 |
OperatingSystem isMSDOSlike ifTrue:[ |
|
2822 |
(#($/ $\) includes:(path at:1)) ifTrue:[ |
|
2823 |
(path at:3) == $: ifTrue:[ |
|
2824 |
^ path copyFrom:2 |
|
2825 |
] |
|
2826 |
] |
|
2827 |
]. |
|
2828 |
^ path |
|
2829 |
||
2830 |
"Created: / 20.10.1998 / 20:58:45 / cg" |
|
2831 |
"Modified: / 20.10.1998 / 21:06:49 / cg" |
|
253 | 2832 |
! |
2833 |
||
2834 |
validateFile:javaStream |
|
2835 |
|fileNo file descriptor| |
|
2836 |
||
2837 |
fileNo := self validateFileNo:javaStream. |
|
2838 |
fileNo isNil ifTrue:[ |
|
2839 |
"/ self halt:'invalid fileNo in read'. |
|
2840 |
"/ self internalError:'invalid fileNo in read'. |
|
261 | 2841 |
self throwIOExceptionWithMessage:'invalid fileNo in read'. |
2842 |
^ nil |
|
253 | 2843 |
]. |
2844 |
||
2845 |
file := self getOpenFileAt:fileNo. |
|
2846 |
||
2847 |
file isNil ifTrue:[ |
|
2848 |
"/ self halt:'invalid fileNo in read'. |
|
2849 |
"/ self internalError:'invalid fileNo in read'. |
|
261 | 2850 |
self throwIOExceptionWithMessage:'invalid fileNo in read'. |
2851 |
^ nil |
|
253 | 2852 |
]. |
2853 |
||
2854 |
^ file |
|
2855 |
||
2856 |
"Created: / 4.1.1998 / 16:50:38 / cg" |
|
2857 |
"Modified: / 4.1.1998 / 17:50:00 / cg" |
|
2858 |
! |
|
2859 |
||
2860 |
validateFileNo:javaStream |
|
2861 |
|fileNo file descriptor| |
|
2862 |
||
261 | 2863 |
"/ JDK 1.1.3 has fileDescriptor wrapped |
2864 |
"/ JDK 1.0 has it directly as integer |
|
2865 |
||
253 | 2866 |
fileNo := javaStream instVarNamed:'fd'. |
2867 |
fileNo isInteger ifFalse:[ |
|
261 | 2868 |
descriptor := fileNo. |
2869 |
fileNo := descriptor instVarNamed:'fd'. |
|
253 | 2870 |
]. |
2871 |
||
2872 |
fileNo isInteger ifFalse:[ |
|
2873 |
"/ self halt:'invalid fileNo in read'. |
|
2874 |
"/ self internalError:'invalid fileNo in read'. |
|
261 | 2875 |
self throwIOExceptionWithMessage:'invalid fileNo in read'. |
2876 |
^ nil |
|
253 | 2877 |
]. |
2878 |
||
2879 |
^ fileNo. |
|
2880 |
||
2881 |
"Created: / 4.1.1998 / 17:49:08 / cg" |
|
261 | 2882 |
"Modified: / 13.1.1998 / 14:07:47 / cg" |
253 | 2883 |
! ! |
2884 |
||
440 | 2885 |
!JavaVM class methodsFor:'native - java.awt.image'! |
2886 |
||
2887 |
_ColorModel_deletepData:nativeContext |
|
2888 |
"/ void deletepData () |
|
2889 |
UnimplementedNativeMethodSignal raise |
|
2890 |
||
2891 |
"Created: / 12.11.1998 / 19:22:05 / cg" |
|
2892 |
! ! |
|
2893 |
||
253 | 2894 |
!JavaVM class methodsFor:'native - java.io'! |
2895 |
||
2896 |
_FileDescriptor_initSystemFD:nativeContext |
|
2897 |
|descriptor fileNo idx myStream| |
|
2898 |
||
2899 |
descriptor := nativeContext argAt:1. |
|
2900 |
fileNo := nativeContext argAt:2. |
|
2901 |
||
2902 |
fileNo == 0 ifTrue:[ |
|
277 | 2903 |
myStream := Stdin |
253 | 2904 |
] ifFalse:[ |
277 | 2905 |
fileNo == 1 ifTrue:[ |
2906 |
myStream := JavaConsoleStream ? Stdout |
|
2907 |
] ifFalse:[ |
|
2908 |
fileNo == 2 ifTrue:[ |
|
2909 |
myStream := JavaConsoleStream ? Stderr |
|
2910 |
] ifFalse:[ |
|
2911 |
self halt:'invalid fileNo given'. |
|
2912 |
self internalError:'invalid fileNo given'. |
|
2913 |
] |
|
2914 |
] |
|
253 | 2915 |
]. |
2916 |
||
2917 |
self setOpenFile:myStream at:fileNo. |
|
2918 |
||
2919 |
descriptor instVarNamed:'fd' put:fileNo. |
|
2920 |
^ descriptor |
|
2921 |
||
277 | 2922 |
"Modified: / 27.1.1998 / 18:15:28 / cg" |
253 | 2923 |
! |
2924 |
||
440 | 2925 |
_FileDescriptor_sync:nativeContext |
2926 |
"/ void sync () |
|
2927 |
UnimplementedNativeMethodSignal raise |
|
2928 |
||
2929 |
"Modified: / 12.11.1998 / 18:57:39 / cg" |
|
2930 |
"Created: / 12.11.1998 / 19:26:25 / cg" |
|
2931 |
! |
|
2932 |
||
2933 |
_FileDescriptor_valid:nativeContext |
|
2934 |
"/ boolean valid () |
|
2935 |
UnimplementedNativeMethodSignal raise |
|
2936 |
||
2937 |
"Modified: / 12.11.1998 / 18:57:39 / cg" |
|
2938 |
! |
|
2939 |
||
261 | 2940 |
_FileInputStream_available:nativeContext |
2941 |
|file| |
|
2942 |
||
2943 |
file := self validateFile:(nativeContext receiver). |
|
2944 |
file isNil ifTrue:[ |
|
2945 |
self throwIOExceptionWithMessage:'invalid fileNo in available'. |
|
2946 |
^ self |
|
2947 |
]. |
|
2948 |
file isFileStream ifTrue:[ |
|
2949 |
^ file size - file position + 1 |
|
2950 |
]. |
|
2951 |
file atEnd ifTrue:[ |
|
2952 |
^ 0. |
|
2953 |
]. |
|
2954 |
self halt. |
|
2955 |
^ 1 |
|
2956 |
||
2957 |
"Modified: / 14.1.1998 / 15:12:52 / cg" |
|
2958 |
! |
|
2959 |
||
253 | 2960 |
_FileInputStream_close:nativeContext |
307 | 2961 |
^ self anyStream_close:nativeContext |
2962 |
||
253 | 2963 |
"Created: / 4.1.1998 / 17:45:23 / cg" |
307 | 2964 |
"Modified: / 4.2.1998 / 15:20:46 / cg" |
253 | 2965 |
! |
2966 |
||
2967 |
_FileInputStream_open:nativeContext |
|
261 | 2968 |
|fs fd fn name stream fileNo| |
253 | 2969 |
|
2970 |
fs := nativeContext receiver. |
|
2971 |
fd := fs instVarNamed:'fd'. |
|
277 | 2972 |
(fileNo := fd instVarNamed:'fd') ~~ 0 ifTrue:[ |
2973 |
fileNo ~~ -1 ifTrue:[ |
|
2974 |
self halt:'file already open'. |
|
2975 |
self internalError:'file already open'. |
|
2976 |
^ self. |
|
2977 |
] |
|
253 | 2978 |
]. |
2979 |
||
2980 |
name := nativeContext argAt:1. |
|
2981 |
name := Java as_ST_String:name. |
|
2982 |
||
405 | 2983 |
name := self fixFilename:name. |
2984 |
||
253 | 2985 |
FileOpenTrace ifTrue:[ |
277 | 2986 |
('JAVA: opening ' , name) infoPrintCR. |
253 | 2987 |
]. |
2988 |
||
261 | 2989 |
stream := self fileStreamForReading:name. |
253 | 2990 |
stream isNil ifTrue:[ |
277 | 2991 |
FileOpenTrace ifTrue:[ |
479 | 2992 |
('JAVA: failed to open ''' , name , ''' for reading.') infoPrintCR. |
277 | 2993 |
]. |
2994 |
||
2995 |
self throwIOExceptionWithMessage:('cannot open ' , name , ' for reading'). |
|
2996 |
||
2997 |
^ self. |
|
253 | 2998 |
]. |
304 | 2999 |
stream buffered:false. |
253 | 3000 |
|
261 | 3001 |
"/ FileOpenConfirmation ifTrue:[ |
3002 |
"/ (self confirm:('JAVA Security check\\Opening ''' , name , ''' for reading.\Grant permission ?') withCRs) |
|
3003 |
"/ ifFalse:[ |
|
3004 |
"/ self throwIOExceptionWithMessage:('no permission to open ' , name , ' for reading'). |
|
3005 |
"/ ^ self |
|
3006 |
"/ ] |
|
3007 |
"/ ]. |
|
3008 |
||
253 | 3009 |
fileNo := self addOpenFile:stream. |
3010 |
||
3011 |
FileOpenTrace ifTrue:[ |
|
277 | 3012 |
('JAVA: opened ' , name , ' as FD ' , fileNo printString) infoPrintCR. |
253 | 3013 |
]. |
3014 |
||
3015 |
fd instVarNamed:'fd' put:fileNo. |
|
3016 |
||
3017 |
"Created: / 4.1.1998 / 16:47:12 / cg" |
|
479 | 3018 |
"Modified: / 3.12.1998 / 15:13:51 / cg" |
253 | 3019 |
! |
3020 |
||
3021 |
_FileInputStream_read:nativeContext |
|
3022 |
|file byte| |
|
3023 |
||
3024 |
file := self validateFile:(nativeContext receiver). |
|
3025 |
||
3026 |
FileIOTrace ifTrue:[ |
|
261 | 3027 |
('JAVA: read 1 byte from ' , file pathName) infoPrintCR. |
253 | 3028 |
]. |
3029 |
||
3030 |
byte := file nextByte. |
|
3031 |
byte isNil ifTrue:[ |
|
261 | 3032 |
^ -1 |
253 | 3033 |
]. |
3034 |
^ byte |
|
3035 |
||
3036 |
"Created: / 5.1.1998 / 02:17:08 / cg" |
|
3037 |
"Modified: / 5.1.1998 / 02:17:25 / cg" |
|
3038 |
! |
|
3039 |
||
3040 |
_FileInputStream_readBytes:nativeContext |
|
307 | 3041 |
^ self anyStream_readBytes:nativeContext |
3042 |
||
3043 |
"Modified: / 4.2.1998 / 15:23:08 / cg" |
|
261 | 3044 |
! |
3045 |
||
440 | 3046 |
_FileInputStream_skip:nativeContext |
3047 |
"/ long skip (long) |
|
3048 |
UnimplementedNativeMethodSignal raise |
|
3049 |
||
3050 |
"Created: / 12.11.1998 / 18:57:12 / cg" |
|
3051 |
"Modified: / 12.11.1998 / 18:57:48 / cg" |
|
3052 |
! |
|
3053 |
||
261 | 3054 |
_FileOutputStream_close:nativeContext |
307 | 3055 |
^ self anyStream_close:nativeContext |
3056 |
||
261 | 3057 |
"Created: / 13.1.1998 / 09:33:16 / cg" |
307 | 3058 |
"Modified: / 4.2.1998 / 15:20:53 / cg" |
261 | 3059 |
! |
3060 |
||
3061 |
_FileOutputStream_open:nativeContext |
|
331 | 3062 |
^ self commonOpen:nativeContext forAppend:false |
3063 |
||
3064 |
"Modified: / 7.4.1998 / 19:14:31 / cg" |
|
3065 |
! |
|
3066 |
||
3067 |
_FileOutputStream_openAppend:nativeContext |
|
3068 |
^ self commonOpen:nativeContext forAppend:true |
|
3069 |
||
3070 |
"Modified: / 7.4.1998 / 19:13:42 / cg" |
|
261 | 3071 |
! |
3072 |
||
3073 |
_FileOutputStream_write:nativeContext |
|
3074 |
|byte file| |
|
3075 |
||
3076 |
byte := nativeContext argAt:1. |
|
3077 |
||
3078 |
file := self validateFile:(nativeContext receiver). |
|
3079 |
||
3080 |
FileIOTrace ifTrue:[ |
|
3081 |
file isFileStream ifTrue:[ |
|
3082 |
('JAVA: write 1 byte to ' , file pathName) infoPrintCR. |
|
3083 |
] ifFalse:[ |
|
3084 |
file ~~ Stdout ifTrue:[ |
|
3085 |
file ~~ Stderr ifTrue:[ |
|
3086 |
('JAVA: write 1 byte to ' , file displayString) infoPrintCR. |
|
3087 |
] |
|
3088 |
] |
|
3089 |
] |
|
3090 |
]. |
|
3091 |
||
3092 |
"/ should always be bytes |
|
3093 |
||
3094 |
file nextPutByte:byte |
|
3095 |
||
3096 |
"Created: / 13.1.1998 / 09:32:13 / cg" |
|
3097 |
"Modified: / 13.1.1998 / 09:32:31 / cg" |
|
253 | 3098 |
! |
3099 |
||
255 | 3100 |
_FileOutputStream_writeBytes:nativeContext |
307 | 3101 |
^ self anyStream_writeBytes:nativeContext |
3102 |
||
3103 |
"Modified: / 4.2.1998 / 15:24:20 / cg" |
|
255 | 3104 |
! |
3105 |
||
253 | 3106 |
_File_canRead0:nativeContext |
3107 |
|file path f| |
|
3108 |
||
3109 |
file := nativeContext receiver. |
|
3110 |
path := file instVarNamed:'path'. |
|
3111 |
path notNil ifTrue:[ |
|
405 | 3112 |
path := Java as_ST_String:path. |
3113 |
path := self fixFilename:path. |
|
3114 |
(f := path asFilename) isReadable ifTrue:[ |
|
3115 |
^ 1 "/ TRUE |
|
3116 |
] |
|
253 | 3117 |
]. |
255 | 3118 |
^ 0 "/ FALSE |
3119 |
||
253 | 3120 |
"Created: / 4.1.1998 / 18:09:55 / cg" |
405 | 3121 |
"Modified: / 20.10.1998 / 20:59:39 / cg" |
253 | 3122 |
! |
3123 |
||
307 | 3124 |
_File_canWrite0:nativeContext |
3125 |
|file path f| |
|
3126 |
||
3127 |
file := nativeContext receiver. |
|
3128 |
path := file instVarNamed:'path'. |
|
3129 |
path notNil ifTrue:[ |
|
3130 |
path := Java as_ST_String:path. |
|
405 | 3131 |
path := self fixFilename:path. |
307 | 3132 |
(f := path asFilename) isWritable ifTrue:[ |
3133 |
^ 1 "/ TRUE |
|
3134 |
] |
|
3135 |
]. |
|
3136 |
^ 0 "/ FALSE |
|
3137 |
||
3138 |
"Created: / 4.2.1998 / 00:19:55 / cg" |
|
405 | 3139 |
"Modified: / 20.10.1998 / 20:59:45 / cg" |
307 | 3140 |
! |
3141 |
||
440 | 3142 |
_File_delete0:nativeContext |
3143 |
"/ boolean delete0 () |
|
480 | 3144 |
|oldFile oldPath oldF| |
3145 |
||
3146 |
oldFile := nativeContext receiver. |
|
3147 |
oldPath := oldFile instVarNamed:'path'. |
|
3148 |
oldPath isNil ifTrue:[^ 0]. "/ FALSE |
|
3149 |
||
3150 |
oldPath := Java as_ST_String:oldPath. |
|
3151 |
oldF := oldPath asFilename. |
|
3152 |
||
3153 |
(self checkWritePermissionOfDirectory:oldF directory message:('JAVA Security check\\Delete of ''' , oldPath , '''.\Grant permission ?')) |
|
3154 |
ifFalse:[ |
|
3155 |
^ 0 "/ FALSE |
|
3156 |
]. |
|
3157 |
||
3158 |
OperatingSystem accessDeniedErrorSignal handle:[:ex | |
|
3159 |
^ 0 "/ FALSE |
|
3160 |
] do:[ |
|
3161 |
oldF delete. |
|
3162 |
^ 1 "/ TRUE |
|
3163 |
]. |
|
3164 |
^ 0 "/ FALSE |
|
3165 |
||
3166 |
"Modified: / 3.12.1998 / 21:02:03 / cg" |
|
440 | 3167 |
! |
3168 |
||
253 | 3169 |
_File_exists0:nativeContext |
3170 |
|file path f| |
|
3171 |
||
3172 |
file := nativeContext receiver. |
|
3173 |
path := file instVarNamed:'path'. |
|
3174 |
path notNil ifTrue:[ |
|
405 | 3175 |
path := Java as_ST_String:path. |
3176 |
path := self fixFilename:path. |
|
3177 |
(f := path asFilename) exists ifTrue:[ |
|
3178 |
^ 1 "TRUE" |
|
3179 |
] |
|
255 | 3180 |
]. |
3181 |
^ 0 "FALSE" |
|
3182 |
||
3183 |
"Created: / 5.1.1998 / 02:07:48 / cg" |
|
405 | 3184 |
"Modified: / 20.10.1998 / 20:59:49 / cg" |
255 | 3185 |
! |
3186 |
||
3187 |
_File_isAbsolute:nativeContext |
|
3188 |
|file path f| |
|
3189 |
||
3190 |
file := nativeContext receiver. |
|
3191 |
path := file instVarNamed:'path'. |
|
3192 |
path notNil ifTrue:[ |
|
405 | 3193 |
path := Java as_ST_String:path. |
3194 |
path := self fixFilename:path. |
|
3195 |
(f := path asFilename) isAbsolute ifTrue:[ |
|
3196 |
^ 1 "/ TRUE |
|
3197 |
] |
|
255 | 3198 |
]. |
3199 |
^ 0 "/ FALSE |
|
3200 |
||
3201 |
"Created: / 11.1.1998 / 09:54:38 / cg" |
|
405 | 3202 |
"Modified: / 20.10.1998 / 20:59:53 / cg" |
255 | 3203 |
! |
3204 |
||
3205 |
_File_isDirectory0:nativeContext |
|
3206 |
|file path f| |
|
3207 |
||
3208 |
file := nativeContext receiver. |
|
3209 |
path := file instVarNamed:'path'. |
|
3210 |
path notNil ifTrue:[ |
|
405 | 3211 |
path := Java as_ST_String:path. |
3212 |
path := self fixFilename:path. |
|
3213 |
(f := path asFilename) exists ifTrue:[ |
|
3214 |
f isDirectory ifTrue:[^ 1 "TRUE"] |
|
3215 |
] |
|
255 | 3216 |
]. |
3217 |
^ 0 "FALSE" |
|
3218 |
||
3219 |
"Created: / 7.1.1998 / 10:31:37 / cg" |
|
405 | 3220 |
"Modified: / 20.10.1998 / 20:59:56 / cg" |
255 | 3221 |
! |
3222 |
||
3223 |
_File_isFile0:nativeContext |
|
3224 |
|file path f| |
|
3225 |
||
3226 |
file := nativeContext receiver. |
|
3227 |
path := file instVarNamed:'path'. |
|
3228 |
path notNil ifTrue:[ |
|
405 | 3229 |
path := Java as_ST_String:path. |
3230 |
path := self fixFilename:path. |
|
3231 |
(f := path asFilename) exists ifTrue:[ |
|
3232 |
f isDirectory ifFalse:[^ 1 "TRUE"] |
|
3233 |
] |
|
255 | 3234 |
]. |
3235 |
^ 0 "/ FALSE |
|
3236 |
||
3237 |
"Created: / 11.1.1998 / 11:40:22 / cg" |
|
405 | 3238 |
"Modified: / 20.10.1998 / 21:00:00 / cg" |
255 | 3239 |
! |
3240 |
||
307 | 3241 |
_File_lastModified0:nativeContext |
3242 |
|file path f| |
|
3243 |
||
3244 |
file := nativeContext receiver. |
|
3245 |
path := file instVarNamed:'path'. |
|
3246 |
path notNil ifTrue:[ |
|
3247 |
path := Java as_ST_String:path. |
|
405 | 3248 |
path := self fixFilename:path. |
307 | 3249 |
(f := path asFilename) exists ifTrue:[ |
3250 |
^ f modificationTime getMilliseconds. |
|
3251 |
] |
|
3252 |
]. |
|
3253 |
^ 0 |
|
3254 |
||
3255 |
"Created: / 4.2.1998 / 16:50:30 / cg" |
|
405 | 3256 |
"Modified: / 20.10.1998 / 21:00:05 / cg" |
307 | 3257 |
! |
3258 |
||
255 | 3259 |
_File_length0:nativeContext |
3260 |
|file path f| |
|
3261 |
||
3262 |
file := nativeContext receiver. |
|
3263 |
path := file instVarNamed:'path'. |
|
3264 |
path notNil ifTrue:[ |
|
405 | 3265 |
path := Java as_ST_String:path. |
3266 |
path := self fixFilename:path. |
|
3267 |
(f := path asFilename) exists ifTrue:[ |
|
3268 |
^ f fileSize |
|
3269 |
] |
|
253 | 3270 |
]. |
261 | 3271 |
^ -1 |
3272 |
||
255 | 3273 |
"Created: / 7.1.1998 / 12:18:57 / cg" |
405 | 3274 |
"Modified: / 20.10.1998 / 21:00:18 / cg" |
261 | 3275 |
! |
3276 |
||
3277 |
_File_list0:nativeContext |
|
3278 |
|file path f files| |
|
3279 |
||
3280 |
file := nativeContext receiver. |
|
3281 |
path := file instVarNamed:'path'. |
|
3282 |
path notNil ifTrue:[ |
|
405 | 3283 |
path := Java as_ST_String:path. |
3284 |
path := self fixFilename:path. |
|
3285 |
(f := path asFilename) exists ifTrue:[ |
|
3286 |
f isDirectory ifTrue:[ |
|
3287 |
files := f directoryContents asArray. |
|
3288 |
files := files collect:[:nm | Java as_String:nm]. |
|
3289 |
^ files |
|
3290 |
] |
|
3291 |
] |
|
261 | 3292 |
]. |
3293 |
^ nil |
|
3294 |
||
3295 |
"Created: / 14.1.1998 / 21:30:22 / cg" |
|
405 | 3296 |
"Modified: / 20.10.1998 / 21:00:21 / cg" |
307 | 3297 |
! |
3298 |
||
3299 |
_File_mkdir0:nativeContext |
|
3300 |
|file path f| |
|
3301 |
||
3302 |
file := nativeContext receiver. |
|
3303 |
path := file instVarNamed:'path'. |
|
3304 |
path notNil ifTrue:[ |
|
3305 |
path := Java as_ST_String:path. |
|
405 | 3306 |
path := self fixFilename:path. |
482 | 3307 |
f := path asFilename. |
3308 |
(f exists and:[f isDirectory]) ifTrue:[ |
|
3309 |
^ 0 "/ FALSE |
|
3310 |
]. |
|
3311 |
||
307 | 3312 |
FileOpenConfirmation ifTrue:[ |
3313 |
(self confirm:('JAVA Security check\\Create directory ''' , path , '''.\Grant permission ?') withCRs) |
|
3314 |
ifFalse:[ |
|
3315 |
^ 0 "/ FALSE |
|
3316 |
] |
|
3317 |
]. |
|
3318 |
OperatingSystem accessDeniedErrorSignal handle:[:ex | |
|
3319 |
^ 0 "/ FALSE |
|
3320 |
] do:[ |
|
3321 |
f makeDirectory. |
|
3322 |
]. |
|
3323 |
f exists ifTrue:[ |
|
3324 |
f isDirectory ifTrue:[^ 1 "TRUE"] |
|
3325 |
] |
|
3326 |
]. |
|
3327 |
^ 0 "FALSE" |
|
3328 |
||
3329 |
"Created: / 4.2.1998 / 00:19:05 / cg" |
|
482 | 3330 |
"Modified: / 4.12.1998 / 14:04:03 / cg" |
307 | 3331 |
! |
3332 |
||
440 | 3333 |
_File_renameTo0:nativeContext |
479 | 3334 |
"/ void renameTo0 (java.io.File) |
3335 |
||
3336 |
|oldFile newFile oldPath newPath oldF newF| |
|
3337 |
||
3338 |
oldFile := nativeContext receiver. |
|
3339 |
oldPath := oldFile instVarNamed:'path'. |
|
480 | 3340 |
oldPath isNil ifTrue:[^ 0]. "/ FALSE |
3341 |
||
3342 |
oldPath := Java as_ST_String:oldPath. |
|
3343 |
oldF := oldPath asFilename. |
|
3344 |
||
3345 |
newFile := nativeContext argAt:1. |
|
3346 |
newPath := newFile instVarNamed:'path'. |
|
3347 |
newPath isNil ifTrue:[^ 0]. "/ FALSE |
|
3348 |
newPath := Java as_ST_String:newPath. |
|
3349 |
||
3350 |
newF := newPath asFilename. |
|
3351 |
||
3352 |
(self checkWritePermissionOfDirectory:oldF directory message:('JAVA Security check\\Rename of ''' , oldPath , ''' to ''' , newPath , '''.\Grant permission ?')) |
|
3353 |
ifFalse:[ |
|
3354 |
^ 0 "/ FALSE |
|
3355 |
]. |
|
3356 |
oldF directory pathName ~= newF directory pathName ifTrue:[ |
|
3357 |
(self checkWritePermissionOfDirectory:newF directory message:('JAVA Security check\\Rename of ''' , oldPath , ''' to ''' , newPath , '''.\Grant permission ?')) |
|
3358 |
ifFalse:[ |
|
3359 |
^ 0 "/ FALSE |
|
3360 |
]. |
|
3361 |
]. |
|
3362 |
||
3363 |
OperatingSystem accessDeniedErrorSignal handle:[:ex | |
|
3364 |
^ 0 "/ FALSE |
|
3365 |
] do:[ |
|
3366 |
oldF renameTo:newF. |
|
3367 |
^ 1 "/ TRUE |
|
3368 |
]. |
|
3369 |
^ 0 "/ FALSE |
|
3370 |
||
3371 |
"Modified: / 3.12.1998 / 21:01:08 / cg" |
|
440 | 3372 |
! |
3373 |
||
3374 |
_File_rmdir0:nativeContext |
|
3375 |
"/ boolean rmdir0 () |
|
3376 |
UnimplementedNativeMethodSignal raise |
|
3377 |
||
3378 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3379 |
"Created: / 12.11.1998 / 19:03:52 / cg" |
|
3380 |
! |
|
3381 |
||
3382 |
_ObjectInputStream_allocateNewArray:nativeContext |
|
3383 |
"/ java.lang.Object allocateNewArray (java.lang.Class int) |
|
3384 |
UnimplementedNativeMethodSignal raise |
|
3385 |
||
3386 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3387 |
"Created: / 12.11.1998 / 19:02:52 / cg" |
|
3388 |
! |
|
3389 |
||
3390 |
_ObjectInputStream_allocateNewObject:nativeContext |
|
3391 |
"/ java.lang.Object allocateNewObject (java.lang.Class java.lang.Class) |
|
3392 |
UnimplementedNativeMethodSignal raise |
|
3393 |
||
3394 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3395 |
"Created: / 12.11.1998 / 19:02:40 / cg" |
|
3396 |
! |
|
3397 |
||
3398 |
_ObjectInputStream_inputClassFields:nativeContext |
|
3399 |
"/ void inputClassFields (java.lang.Object java.lang.Class int[]) |
|
3400 |
UnimplementedNativeMethodSignal raise |
|
3401 |
||
3402 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3403 |
"Created: / 12.11.1998 / 19:02:22 / cg" |
|
3404 |
! |
|
3405 |
||
3406 |
_ObjectInputStream_invokeObjectReader:nativeContext |
|
3407 |
"/ boolean invokeObjectReader (java.lang.Object java.lang.Class) |
|
3408 |
UnimplementedNativeMethodSignal raise |
|
3409 |
||
3410 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3411 |
"Created: / 12.11.1998 / 19:03:06 / cg" |
|
3412 |
! |
|
3413 |
||
3414 |
_ObjectInputStream_loadClass0:nativeContext |
|
3415 |
"/ java.lang.Class loadClass0 (java.lang.Class java.lang.String) |
|
3416 |
UnimplementedNativeMethodSignal raise |
|
3417 |
||
3418 |
"Created: / 12.11.1998 / 19:01:15 / cg" |
|
3419 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3420 |
! |
|
3421 |
||
3422 |
_ObjectOutputStream_invokeObjectWriter:nativeContext |
|
3423 |
"/ boolean invokeObjectWriter (java.lang.Object java.lang.Class) |
|
3424 |
UnimplementedNativeMethodSignal raise |
|
3425 |
||
3426 |
"Created: / 12.11.1998 / 19:00:36 / cg" |
|
3427 |
"Modified: / 12.11.1998 / 19:01:45 / cg" |
|
3428 |
! |
|
3429 |
||
3430 |
_ObjectOutputStream_outputClassFields:nativeContext |
|
3431 |
"/ void outputClassFields (java.lang.Object java.lang.Class int[]) |
|
3432 |
UnimplementedNativeMethodSignal raise |
|
3433 |
||
3434 |
"Created: / 12.11.1998 / 19:00:09 / cg" |
|
3435 |
"Modified: / 12.11.1998 / 19:01:42 / cg" |
|
3436 |
! |
|
3437 |
||
3438 |
_ObjectStreamClass_getClassAccess:nativeContext |
|
3439 |
"/ int getClassAccess (java.lang.Class) |
|
3440 |
UnimplementedNativeMethodSignal raise |
|
3441 |
||
3442 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3443 |
"Created: / 12.11.1998 / 19:04:19 / cg" |
|
3444 |
! |
|
3445 |
||
3446 |
_ObjectStreamClass_getFieldAccess:nativeContext |
|
3447 |
"/ int getFieldAccess (java.lang.Class java.lang.String) |
|
3448 |
UnimplementedNativeMethodSignal raise |
|
3449 |
||
3450 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3451 |
"Created: / 12.11.1998 / 19:05:19 / cg" |
|
3452 |
! |
|
3453 |
||
3454 |
_ObjectStreamClass_getFieldSignatures:nativeContext |
|
3455 |
"/ java.lang.String[] getFieldSignatures (java.lang.Class) |
|
3456 |
UnimplementedNativeMethodSignal raise |
|
3457 |
||
3458 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3459 |
"Created: / 12.11.1998 / 19:05:04 / cg" |
|
3460 |
! |
|
3461 |
||
3462 |
_ObjectStreamClass_getFields0:nativeContext |
|
3463 |
"/ java.io.ObjectStreamField[] getFields0 (java.lang.Class) |
|
3464 |
UnimplementedNativeMethodSignal raise |
|
3465 |
||
3466 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3467 |
"Created: / 12.11.1998 / 19:05:32 / cg" |
|
3468 |
! |
|
3469 |
||
3470 |
_ObjectStreamClass_getMethodAccess:nativeContext |
|
3471 |
"/ int getMethodAccess (java.lang.Class java.lang.String) |
|
3472 |
UnimplementedNativeMethodSignal raise |
|
3473 |
||
3474 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3475 |
"Created: / 12.11.1998 / 19:04:51 / cg" |
|
3476 |
! |
|
3477 |
||
3478 |
_ObjectStreamClass_getMethodSignatures:nativeContext |
|
3479 |
"/ java.lang.String[] getMethodSignatures (java.lang.Class) |
|
3480 |
UnimplementedNativeMethodSignal raise |
|
3481 |
||
3482 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3483 |
"Created: / 12.11.1998 / 19:04:34 / cg" |
|
3484 |
! |
|
3485 |
||
3486 |
_ObjectStreamClass_getSerialVersionUID:nativeContext |
|
3487 |
"/ long getSerialVersionUID (java.lang.Class) |
|
3488 |
UnimplementedNativeMethodSignal raise |
|
3489 |
||
3490 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3491 |
"Created: / 12.11.1998 / 19:05:43 / cg" |
|
3492 |
! |
|
3493 |
||
3494 |
_ObjectStreamClass_hasWriteObject:nativeContext |
|
3495 |
"/ boolean hasWriteObject (java.lang.Class) |
|
3496 |
UnimplementedNativeMethodSignal raise |
|
3497 |
||
3498 |
"Modified: / 12.11.1998 / 19:01:48 / cg" |
|
3499 |
"Created: / 12.11.1998 / 19:05:53 / cg" |
|
3500 |
! |
|
3501 |
||
307 | 3502 |
_RandomAccessFile_close:nativeContext |
3503 |
^ self anyStream_close:nativeContext |
|
3504 |
||
3505 |
"Created: / 4.2.1998 / 13:26:53 / cg" |
|
3506 |
"Modified: / 4.2.1998 / 15:21:08 / cg" |
|
3507 |
! |
|
3508 |
||
3509 |
_RandomAccessFile_length:nativeContext |
|
3510 |
|file sz| |
|
3511 |
||
3512 |
file := self validateFile:(nativeContext receiver). |
|
3513 |
||
3514 |
FileIOTrace ifTrue:[ |
|
3515 |
('JAVA: length of ' , file pathName) infoPrintCR. |
|
3516 |
]. |
|
3517 |
||
3518 |
sz := file size. |
|
3519 |
^ sz. |
|
3520 |
||
3521 |
"Created: / 4.2.1998 / 13:27:58 / cg" |
|
3522 |
! |
|
3523 |
||
3524 |
_RandomAccessFile_open:nativeContext |
|
442 | 3525 |
|fs fd name dir stream fileNo answer readonly| |
3526 |
||
3527 |
readonly := false. |
|
307 | 3528 |
|
3529 |
fs := nativeContext receiver. |
|
3530 |
fd := fs instVarNamed:'fd'. |
|
3531 |
(fd instVarNamed:'fd') ~~ 0 ifTrue:[ |
|
3532 |
self halt:'file already open'. |
|
3533 |
self internalError:'file already open'. |
|
3534 |
^ self. |
|
3535 |
]. |
|
3536 |
||
3537 |
name := nativeContext argAt:1. |
|
3538 |
name := Java as_ST_String:name. |
|
405 | 3539 |
name := self fixFilename:name. |
307 | 3540 |
|
3541 |
FileOpenTrace ifTrue:[ |
|
3542 |
('JAVA: opening ' , name) infoPrintCR. |
|
3543 |
]. |
|
3544 |
||
3545 |
dir := name asFilename directory pathName. |
|
442 | 3546 |
|
307 | 3547 |
(PermittedDirectories notNil |
3548 |
and:[PermittedDirectories includes:dir]) ifFalse:[ |
|
3549 |
FileOpenConfirmation ifTrue:[ |
|
442 | 3550 |
answer := Dialog |
3551 |
confirmWithCancel:('JAVA Security check\\Opening ''' , name , ''' for read/write.\Grant permission ?') withCRs |
|
3552 |
labels:#('no' 'grant' 'readonly') |
|
3553 |
values:#(false true #readonly) |
|
3554 |
default:3. |
|
3555 |
answer == false ifTrue:[ |
|
307 | 3556 |
self throwIOExceptionWithMessage:('no permission to open ' , name , ' for writing'). |
3557 |
^ self |
|
3558 |
]. |
|
442 | 3559 |
readonly := (answer == #readonly). |
3560 |
||
3561 |
readonly ifFalse:[ |
|
3562 |
(self confirm:('JAVA Security check\\Always permit writes in this directory (''' , dir , ''') ?') withCRs) |
|
3563 |
ifTrue:[ |
|
3564 |
PermittedDirectories isNil ifTrue:[ |
|
3565 |
PermittedDirectories := Set new |
|
3566 |
]. |
|
3567 |
PermittedDirectories add:dir. |
|
3568 |
] |
|
307 | 3569 |
] |
3570 |
] |
|
3571 |
]. |
|
3572 |
||
442 | 3573 |
readonly ifTrue:[ |
3574 |
stream := name asFilename readStream. |
|
3575 |
] ifFalse:[ |
|
3576 |
stream := name asFilename readWriteStream. |
|
3577 |
]. |
|
307 | 3578 |
stream isNil ifTrue:[ |
3579 |
self throwIOExceptionWithMessage:('cannot open ' , name , ' for writing'). |
|
3580 |
]. |
|
3581 |
||
3582 |
fileNo := self addOpenFile:stream. |
|
3583 |
||
3584 |
FileOpenTrace ifTrue:[ |
|
3585 |
('JAVA: opened ' , name , ' as FD ' , fileNo printString , ' for writing') infoPrintCR. |
|
3586 |
]. |
|
3587 |
||
3588 |
fd instVarNamed:'fd' put:fileNo. |
|
3589 |
||
3590 |
"Created: / 4.2.1998 / 00:14:48 / cg" |
|
442 | 3591 |
"Modified: / 12.11.1998 / 21:29:46 / cg" |
307 | 3592 |
! |
3593 |
||
3594 |
_RandomAccessFile_readBytes:nativeContext |
|
3595 |
^ self anyStream_readBytes:nativeContext |
|
3596 |
||
3597 |
"Modified: / 4.2.1998 / 15:23:27 / cg" |
|
3598 |
! |
|
3599 |
||
3600 |
_RandomAccessFile_seek:nativeContext |
|
3601 |
|file pos| |
|
3602 |
||
3603 |
file := self validateFile:(nativeContext receiver). |
|
3604 |
||
3605 |
FileIOTrace ifTrue:[ |
|
3606 |
('JAVA: seek on ' , file pathName) infoPrintCR. |
|
3607 |
]. |
|
3608 |
||
3609 |
pos := nativeContext argAt:1. |
|
3610 |
file position:pos+1 "/ ST/X position starts at 1 |
|
3611 |
||
3612 |
"Created: / 4.2.1998 / 13:25:38 / cg" |
|
3613 |
"Modified: / 4.2.1998 / 13:28:12 / cg" |
|
3614 |
! |
|
3615 |
||
3616 |
_RandomAccessFile_writeBytes:nativeContext |
|
3617 |
^ self anyStream_writeBytes:nativeContext |
|
3618 |
||
3619 |
"Modified: / 4.2.1998 / 15:24:20 / cg" |
|
3620 |
"Created: / 4.2.1998 / 15:24:35 / cg" |
|
253 | 3621 |
! ! |
3622 |
||
277 | 3623 |
!JavaVM class methodsFor:'native - java.io - jdk1.2'! |
3624 |
||
3625 |
_FileDescriptor_initIDs:nativeContext |
|
3626 |
"/ introduced with jdk1.2 ... (sigh) |
|
3627 |
||
3628 |
"Created: / 27.1.1998 / 18:16:29 / cg" |
|
3629 |
! |
|
3630 |
||
3631 |
_FileInputStream_initIDs:nativeContext |
|
3632 |
"/ introduced with jdk1.2 ... (sigh) |
|
3633 |
||
3634 |
"Created: / 27.1.1998 / 18:15:51 / cg" |
|
3635 |
! |
|
3636 |
||
3637 |
_FileOutputStream_initIDs:nativeContext |
|
3638 |
"/ introduced with jdk1.2 ... (sigh) |
|
3639 |
||
3640 |
"Created: / 27.1.1998 / 18:16:40 / cg" |
|
3641 |
! |
|
3642 |
||
3643 |
_File_canonPath:nativeContext |
|
3644 |
"/ introduced with jdk1.2 ... (sigh) |
|
3645 |
||
3646 |
|jPath path realPath| |
|
3647 |
||
3648 |
jPath := nativeContext argAt:1. |
|
3649 |
jPath isNil ifTrue:[^ jPath]. |
|
3650 |
||
3651 |
path := Java as_ST_String:jPath. |
|
3652 |
realPath := path asFilename pathName. |
|
3653 |
||
3654 |
^ Java as_String:realPath |
|
3655 |
||
3656 |
"Created: / 27.1.1998 / 18:35:58 / cg" |
|
3657 |
"Modified: / 27.1.1998 / 21:36:03 / cg" |
|
3658 |
! |
|
3659 |
||
3660 |
_File_initIDs:nativeContext |
|
3661 |
"/ introduced with jdk1.2 ... (sigh) |
|
3662 |
||
3663 |
"Created: / 27.1.1998 / 18:25:19 / cg" |
|
3664 |
! ! |
|
3665 |
||
253 | 3666 |
!JavaVM class methodsFor:'native - java.lang'! |
3667 |
||
255 | 3668 |
_ClassLoader_defineClass0:nativeContext |
3669 |
"create a new class from a given byteArray. |
|
3670 |
Here, construct a stream on it and pass the work to the |
|
3671 |
JavaClassReader." |
|
3672 |
||
3673 |
|jClassLoader jName name data offset length inStream newClass |
|
3674 |
loaderStub jClass| |
|
3675 |
||
3676 |
jClassLoader := nativeContext receiver. |
|
3677 |
jName := nativeContext argAt:1. |
|
3678 |
||
3679 |
"/ className is now optional ... |
|
3680 |
"/ jName isNil ifTrue:[ |
|
3681 |
"/ self internalError:'nil name in defineClass'. |
|
3682 |
"/ ^ nil |
|
3683 |
"/ ] ifFalse:[ |
|
3684 |
"/ name := Java as_ST_String:jName. |
|
3685 |
"/ ]. |
|
3686 |
||
3687 |
data := nativeContext argAt:2. |
|
3688 |
offset := nativeContext argAt:3. |
|
3689 |
length := nativeContext argAt:4. |
|
3690 |
||
3691 |
inStream := data readStream. |
|
3692 |
inStream position:offset + 1. |
|
3693 |
inStream readLimit:(offset + length). |
|
3694 |
||
270 | 3695 |
"/ loaderStub := Plug new. |
3696 |
"/ loaderStub respondTo:#loadClass: with:[:clsName | |
|
3697 |
"/ |jName| |
|
3698 |
"/ |
|
3699 |
"/self halt. |
|
3700 |
"/ jName := Java as_String:clsName. |
|
3701 |
"/ "/ jClassLoader loadClass:jName |
|
3702 |
"/ jClassLoader |
|
3703 |
"/ perform:#'loadClass(Ljava/lang/String;)Ljava/lang/Class;' |
|
3704 |
"/ with:jName. |
|
3705 |
"/ ]. |
|
255 | 3706 |
|
3707 |
('JAVA: defining class ...') infoPrintCR. |
|
3708 |
||
3709 |
"/ self internalError:'break'. |
|
3710 |
||
3711 |
newClass := JavaClassReader |
|
270 | 3712 |
readStream:inStream |
3713 |
loader:jClassLoader "loaderStub" |
|
3714 |
loadUnresolved:false. |
|
255 | 3715 |
|
3716 |
newClass isNil ifTrue:[ |
|
3717 |
('JAVA: defineClass failed') infoPrintCR. |
|
3718 |
^ nil. |
|
3719 |
]. |
|
3720 |
Transcript showCR:('defined class ' , newClass fullName , '.'). |
|
3721 |
newClass classLoader:jClassLoader. |
|
3722 |
||
3723 |
('Java: defined new class: ' , newClass fullName) infoPrintCR. |
|
3724 |
||
268
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
3725 |
jClass := self javaClassObjectForClass:newClass. |
255 | 3726 |
^ jClass |
3727 |
||
3728 |
"Created: / 7.1.1998 / 12:35:10 / cg" |
|
270 | 3729 |
"Modified: / 24.1.1998 / 15:26:21 / cg" |
255 | 3730 |
! |
3731 |
||
253 | 3732 |
_ClassLoader_findSystemClass0:nativeContext |
3733 |
|loader name class jClass| |
|
3734 |
||
3735 |
loader := nativeContext receiver. |
|
3736 |
name := nativeContext argAt:1. |
|
3737 |
name := Java as_ST_String:name. |
|
3738 |
||
399 | 3739 |
class := Java at:name. |
3740 |
class isNil ifTrue:[ |
|
318 | 3741 |
"/ ('JAVA: findSystemClass0 for ' , name , ' loader is ' , loader displayString) infoPrintCR. |
399 | 3742 |
loader class == (Java classForName:'java.util.SystemClassLoader') ifTrue:[ |
3743 |
"/ Java classForName:name. |
|
3744 |
"/ class := Java at:name. |
|
3745 |
class := JavaClassReader loadSystemClass:name. |
|
3746 |
] ifFalse:[ |
|
3747 |
"/ load using default (ST/X) loader |
|
3748 |
class := JavaClassReader loadSystemClass:name. |
|
3749 |
"/ JavaClassReader classLoaderQuerySignal answer:nil do:[ |
|
3750 |
"/ Java classForName:name. |
|
3751 |
"/ ] |
|
3752 |
]. |
|
253 | 3753 |
]. |
3754 |
||
255 | 3755 |
"/ JavaClassReader classLoaderQuerySignal answer:nil "loader" |
3756 |
"/ do:[ |
|
3757 |
"/ class := Java classForName:name. |
|
3758 |
"/ JavaClassReader postLoadActions:true. |
|
3759 |
"/ ]. |
|
399 | 3760 |
|
255 | 3761 |
(class isNil |
3762 |
"or:[class classLoader notNil]") ifTrue:[ |
|
253 | 3763 |
"/ self halt:'class: ' , name , ' not found.'. |
3764 |
"/ self internalError:'class: ' , name , ' not found.'. |
|
3765 |
||
318 | 3766 |
self |
3767 |
throwExceptionClassName:'java.lang.ClassNotFoundException' |
|
399 | 3768 |
withMessage:('class: ' , name , ' not found.'). |
318 | 3769 |
^ nil |
3770 |
]. |
|
3771 |
||
3772 |
"/ '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
|
3773 |
jClass := self javaClassObjectForClass:class. |
253 | 3774 |
^ jClass |
3775 |
||
3776 |
"Created: / 5.1.1998 / 02:53:04 / cg" |
|
399 | 3777 |
"Modified: / 20.10.1998 / 17:28:34 / cg" |
255 | 3778 |
! |
3779 |
||
440 | 3780 |
_ClassLoader_getSystemResourceAsName0:nativeContext |
3781 |
"/ java.lang.String getSystemResourceAsName0 (java.lang.String) |
|
3782 |
UnimplementedNativeMethodSignal raise |
|
3783 |
||
3784 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
3785 |
"Created: / 12.11.1998 / 18:58:34 / cg" |
|
3786 |
! |
|
3787 |
||
255 | 3788 |
_ClassLoader_getSystemResourceAsStream0:nativeContext |
444 | 3789 |
|jString rString dir file text inStream| |
255 | 3790 |
|
3791 |
jString := nativeContext argAt:1. |
|
3792 |
rString := Java as_ST_String:jString. |
|
3793 |
Java classPath do:[:aPath | |
|
444 | 3794 |
|f zipFile zar data| |
3795 |
||
3796 |
f := aPath asFilename. |
|
3797 |
((zipFile := f withSuffix:'jar') exists |
|
3798 |
or:[(zipFile := f withSuffix:'zip') exists]) ifTrue:[ |
|
3799 |
zar := ZipArchive oldFileNamed:zipFile. |
|
3800 |
(Array |
|
3801 |
with:rString |
|
3802 |
with:rString asLowercase |
|
3803 |
with:rString asUppercase) |
|
3804 |
do:[:tryName | |
|
3805 |
data := zar extract:tryName. |
|
3806 |
||
3807 |
inStream := (Java classForName:'java.io.ByteArrayInputStream') newCleared. |
|
3808 |
inStream perform:#'<init>([B)V' with:data. |
|
3809 |
^ inStream. |
|
3810 |
] |
|
3811 |
] ifFalse:[ |
|
3812 |
f exists ifTrue:[ |
|
3813 |
(file := f construct:rString) exists ifTrue:[ |
|
3814 |
(Java isExcludedFromClassPath:file) ifFalse:[ |
|
3815 |
text := file contents asString. |
|
3816 |
||
3817 |
"/ Copy data from returned buffer into Java byte array. |
|
3818 |
||
3819 |
data := text asByteArray. |
|
3820 |
||
3821 |
"/ Create input stream using byte array |
|
3822 |
||
3823 |
inStream := (Java classForName:'java.io.ByteArrayInputStream') newCleared. |
|
3824 |
inStream perform:#'<init>([B)V' with:data. |
|
3825 |
^ inStream. |
|
3826 |
] |
|
277 | 3827 |
] |
3828 |
] |
|
3829 |
] |
|
255 | 3830 |
]. |
3831 |
^ nil |
|
3832 |
||
3833 |
"Created: / 8.1.1998 / 16:06:56 / cg" |
|
444 | 3834 |
"Modified: / 12.11.1998 / 21:51:35 / cg" |
253 | 3835 |
! |
3836 |
||
3837 |
_ClassLoader_init:nativeContext |
|
3838 |
^ nil |
|
3839 |
||
3840 |
"Created: / 5.1.1998 / 02:04:43 / cg" |
|
3841 |
! |
|
3842 |
||
255 | 3843 |
_ClassLoader_resolveClass0:nativeContext |
3844 |
"resolve a new class as previously created by defineClass0" |
|
3845 |
||
399 | 3846 |
|jClassLoader jCls cls loaderStub anyUnresolved| |
255 | 3847 |
|
3848 |
jClassLoader := nativeContext receiver. |
|
3849 |
jCls := nativeContext argAt:1. |
|
3850 |
jCls isNil ifTrue:[ |
|
361
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3851 |
self halt. |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3852 |
^ nil |
255 | 3853 |
]. |
3854 |
cls := JavaClasses at:jCls ifAbsent:nil. |
|
3855 |
cls isNil ifTrue:[ |
|
361
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3856 |
self halt. |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3857 |
^ nil |
255 | 3858 |
]. |
399 | 3859 |
('JavaVM [info]: resolving class ' , cls fullName , ' ...') infoPrintCR. |
255 | 3860 |
|
3861 |
JavaClassReader classLoaderQuerySignal answer:jClassLoader |
|
3862 |
do:[ |
|
399 | 3863 |
JavaClassReader resolveClass:cls. |
3864 |
"/ JavaClassReader postLoadActions:true. |
|
3865 |
anyUnresolved := false. |
|
361
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3866 |
cls constantPool do:[:entry | |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3867 |
(entry isMemberOf:JavaUnresolvedClassConstant) ifTrue:[ |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3868 |
self halt:'debugHalt'. |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3869 |
entry preResolve. |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3870 |
self halt:'debugHalt'. |
399 | 3871 |
anyUnresolved := true. |
361
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3872 |
] |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3873 |
] |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3874 |
]. |
399 | 3875 |
anyUnresolved ifTrue:[ |
361
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3876 |
jClassLoader notNil ifTrue:[ |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3877 |
"/ any unresolved left -> try resolving with standard loader |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3878 |
JavaClassReader classLoaderQuerySignal answer:nil |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3879 |
do:[ |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3880 |
JavaClassReader postLoadActions:true. |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3881 |
cls constantPool do:[:entry | |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3882 |
(entry isMemberOf:JavaUnresolvedClassConstant) ifTrue:[ |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3883 |
self halt:'debugHalt'. |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3884 |
entry preResolve. |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3885 |
self halt:'debugHalt'. |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3886 |
] |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3887 |
] |
466623e0a2d6
with private classLoader - also try using standard loader
cg
parents:
359
diff
changeset
|
3888 |
] |
255 | 3889 |
]. |
399 | 3890 |
]. |
255 | 3891 |
|
3892 |
"Created: / 7.1.1998 / 13:12:27 / cg" |
|
400 | 3893 |
"Modified: / 20.10.1998 / 19:01:57 / cg" |
255 | 3894 |
! |
3895 |
||
253 | 3896 |
_Class_forName:nativeContext |
3897 |
"get a java.lang.Class by name" |
|
3898 |
||
255 | 3899 |
|jClassName className cls jClass s m c loader| |
253 | 3900 |
|
3901 |
jClassName := nativeContext argAt:1. |
|
3902 |
className := Java as_ST_String:jClassName. |
|
3903 |
||
255 | 3904 |
(s := nativeContext sender) notNil ifTrue:[ |
347 | 3905 |
(s isJavaContext) ifTrue:[ |
307 | 3906 |
c := s method javaClass. |
3907 |
loader := c classLoader. |
|
3908 |
loader isNil ifTrue:[ |
|
255 | 3909 |
"/ self halt. |
307 | 3910 |
] |
3911 |
] |
|
255 | 3912 |
]. |
3913 |
||
3914 |
JavaClassReader classLoaderQuerySignal answer:loader |
|
3915 |
do:[ |
|
307 | 3916 |
cls := Java classForName:className. |
255 | 3917 |
]. |
3918 |
||
3919 |
"/(className startsWith:'sun.awt') ifTrue:[self halt]. |
|
3920 |
"/('classForName: ' , className , ' -> ') print. |
|
3921 |
"/cls notNil ifTrue:[cls fullName printCR] ifFalse:['nil' printCR]. |
|
3922 |
||
253 | 3923 |
cls isNil ifTrue:[ |
307 | 3924 |
ExceptionTrace ifTrue:[ |
3925 |
self halt:'no such class:' , className. |
|
3926 |
]. |
|
3927 |
self throwClassNotFoundException:className. |
|
3928 |
"/ not proceedable |
|
3929 |
AbortSignal raise. |
|
3930 |
"/ not reached |
|
3931 |
^ self |
|
3932 |
]. |
|
3933 |
||
3934 |
^ self javaClassObjectForClass:cls. |
|
3935 |
||
347 | 3936 |
"Modified: / 8.5.1998 / 21:30:03 / cg" |
253 | 3937 |
! |
3938 |
||
3939 |
_Class_getClassLoader:nativeContext |
|
3940 |
"get a classes loader" |
|
3941 |
||
3942 |
|loader| |
|
3943 |
||
3944 |
loader := JavaClassReader classLoaderQuerySignal raise. |
|
3945 |
('JAVA: getClassLoader - ' , loader printString) infoPrintCR. |
|
3946 |
||
3947 |
"/ self unimplementedNativeMethod. |
|
3948 |
^ loader |
|
3949 |
||
3950 |
"Modified: / 21.8.1997 / 16:32:02 / cg" |
|
3951 |
"Created: / 5.1.1998 / 02:51:59 / cg" |
|
3952 |
! |
|
3953 |
||
440 | 3954 |
_Class_getComponentType:nativeContext |
3955 |
UnimplementedNativeMethodSignal raise |
|
3956 |
||
3957 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
3958 |
"Created: / 12.11.1998 / 18:54:46 / cg" |
|
3959 |
! |
|
3960 |
||
3961 |
_Class_getConstructor0:nativeContext |
|
3962 |
UnimplementedNativeMethodSignal raise |
|
3963 |
||
3964 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
3965 |
"Created: / 12.11.1998 / 18:55:42 / cg" |
|
3966 |
! |
|
3967 |
||
3968 |
_Class_getConstructors0:nativeContext |
|
3969 |
UnimplementedNativeMethodSignal raise |
|
3970 |
||
3971 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
3972 |
"Created: / 12.11.1998 / 18:55:26 / cg" |
|
3973 |
! |
|
3974 |
||
3975 |
_Class_getField0:nativeContext |
|
3976 |
UnimplementedNativeMethodSignal raise |
|
3977 |
||
3978 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
3979 |
"Created: / 12.11.1998 / 18:55:37 / cg" |
|
3980 |
! |
|
3981 |
||
3982 |
_Class_getFields0:nativeContext |
|
3983 |
UnimplementedNativeMethodSignal raise |
|
3984 |
||
3985 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
3986 |
"Created: / 12.11.1998 / 18:55:18 / cg" |
|
3987 |
! |
|
3988 |
||
3989 |
_Class_getInterfaces:nativeContext |
|
3990 |
UnimplementedNativeMethodSignal raise |
|
3991 |
||
3992 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
3993 |
"Created: / 12.11.1998 / 18:54:34 / cg" |
|
3994 |
! |
|
3995 |
||
321 | 3996 |
_Class_getMethod0:nativeContext |
3997 |
"get a method, given a name and type spec" |
|
3998 |
||
322 | 3999 |
|jClass cls jmName mName mTypes whichAccess argSig sel| |
321 | 4000 |
|
4001 |
jClass := nativeContext receiver. |
|
4002 |
cls := JavaClasses at:jClass. |
|
4003 |
||
322 | 4004 |
jmName := nativeContext argAt:1. |
4005 |
mName := Java as_ST_String:jmName. |
|
321 | 4006 |
mTypes := nativeContext argAt:2. |
4007 |
whichAccess := nativeContext argAt:3. |
|
405 | 4008 |
self halt. |
322 | 4009 |
argSig := JavaMethod argSignatureFromArgTypeArray:mTypes. |
4010 |
cls methodDictionary keysAndValuesDo:[:sel :mthd | |
|
405 | 4011 |
|i1 i2 jMethod retTypeClass argTypes| |
322 | 4012 |
|
4013 |
JavaMethods notNil ifTrue:[ |
|
4014 |
(jMethod := JavaMethods at:mthd ifAbsent:nil) notNil ifTrue:[ |
|
4015 |
^ jMethod |
|
4016 |
] |
|
4017 |
]. |
|
4018 |
||
4019 |
mthd name printCR. |
|
4020 |
mName printCR. |
|
4021 |
||
4022 |
mthd name = mName ifTrue:[ |
|
4023 |
i1 := mthd signature indexOf:$(. |
|
4024 |
i2 := mthd signature indexOf:$) startingAt:(i1+1). |
|
4025 |
||
4026 |
(mthd signature copyFrom:i1+1 to:i2-1) = argSig ifTrue:[ |
|
4027 |
"/ found it - create a java.lang.reflect.Method for it. |
|
4028 |
jMethod := (Java at:'java.lang.reflect.Method') new. |
|
4029 |
jMethod instVarNamed:'clazz' put:jClass. |
|
4030 |
jMethod instVarNamed:'slot' put:sel. |
|
4031 |
jMethod instVarNamed:'name' put:jmName. |
|
405 | 4032 |
retTypeClass := mthd returnTypeClass. |
4033 |
retTypeClass isNil ifTrue:[ |
|
4034 |
retTypeClass := #void |
|
4035 |
]. |
|
4036 |
argTypes := mthd argSignature. |
|
4037 |
argTypes := argTypes collect:[:s | |
|
4038 |
|c| |
|
4039 |
||
4040 |
c := Java at:s. |
|
4041 |
self javaClassObjectForClass:(c ? s asSymbol) |
|
4042 |
]. |
|
4043 |
jMethod instVarNamed:'returnType' put:(self javaClassObjectForClass:retTypeClass). |
|
4044 |
jMethod instVarNamed:'parameterTypes' put:argTypes. |
|
322 | 4045 |
|
4046 |
JavaMethods isNil ifTrue:[ |
|
4047 |
JavaMethods := IdentityDictionary new |
|
4048 |
]. |
|
4049 |
JavaMethods at:jMethod put:mthd. |
|
4050 |
JavaMethods at:mthd put:jMethod. |
|
4051 |
||
4052 |
^ jMethod. |
|
4053 |
]. |
|
4054 |
]. |
|
4055 |
]. |
|
321 | 4056 |
|
4057 |
self halt. |
|
4058 |
self |
|
4059 |
throwExceptionClassName:'java.lang.NoSuchMethodException' |
|
4060 |
withMessage:'not yet implemented'. |
|
4061 |
||
4062 |
^ nil. |
|
4063 |
||
405 | 4064 |
"Modified: / 22.10.1998 / 01:54:38 / cg" |
321 | 4065 |
! |
4066 |
||
334 | 4067 |
_Class_getMethods0:nativeContext |
4068 |
"get a method, given a name and type spec" |
|
4069 |
||
4070 |
|jClass cls jmName mName mTypes whichAccess argSig sel |
|
4071 |
methods| |
|
4072 |
||
4073 |
jClass := nativeContext receiver. |
|
4074 |
cls := JavaClasses at:jClass. |
|
4075 |
||
405 | 4076 |
"/ 0 = PUBLIC (i.e. includes inherited) / 1 = DECLARED here |
334 | 4077 |
whichAccess := nativeContext argAt:1. |
4078 |
||
4079 |
methods := OrderedCollection new. |
|
4080 |
||
405 | 4081 |
[cls isJavaClass] whileTrue:[ |
4082 |
cls methodDictionary keysAndValuesDo:[:sel :mthd | |
|
4083 |
|i1 i2 jMethod argTypes retTypeClass| |
|
4084 |
||
4085 |
mthd name printCR. |
|
4086 |
||
4087 |
i1 := mthd signature indexOf:$(. |
|
4088 |
i2 := mthd signature indexOf:$) startingAt:(i1+1). |
|
4089 |
||
4090 |
"/ create a java.lang.reflect.Method for it. |
|
4091 |
jMethod := (Java at:'java.lang.reflect.Method') new. |
|
4092 |
jMethod instVarNamed:'clazz' put:jClass. |
|
4093 |
jMethod instVarNamed:'slot' put:sel. |
|
4094 |
jMethod instVarNamed:'name' put:(Java as_String:mthd name). |
|
4095 |
retTypeClass := mthd returnTypeClass. |
|
4096 |
retTypeClass isNil ifTrue:[ |
|
4097 |
retTypeClass := #void |
|
4098 |
]. |
|
4099 |
(name endsWith:')I') ifTrue:[self halt]. |
|
4100 |
argTypes := mthd argSignature. |
|
4101 |
argTypes := argTypes collect:[:s | |
|
4102 |
|c| |
|
4103 |
||
4104 |
c := Java at:s. |
|
4105 |
self javaClassObjectForClass:(c ? s asSymbol) |
|
4106 |
]. |
|
4107 |
||
4108 |
jMethod instVarNamed:'returnType' put:(self javaClassObjectForClass:retTypeClass). |
|
4109 |
jMethod instVarNamed:'parameterTypes' put:argTypes. |
|
334 | 4110 |
|
405 | 4111 |
(mthd name includesString:'setName') ifTrue:[self halt]. |
4112 |
JavaMethods isNil ifTrue:[ |
|
4113 |
JavaMethods := IdentityDictionary new |
|
4114 |
]. |
|
4115 |
JavaMethods at:jMethod put:mthd. |
|
4116 |
JavaMethods at:mthd put:jMethod. |
|
4117 |
||
4118 |
methods add:jMethod. |
|
334 | 4119 |
]. |
405 | 4120 |
whichAccess == 1 ifTrue:[ |
4121 |
"/ local methods only |
|
4122 |
cls := nil |
|
4123 |
] ifFalse:[ |
|
4124 |
cls := cls superclass. |
|
4125 |
] |
|
334 | 4126 |
]. |
4127 |
methods := methods asArray. |
|
4128 |
^ methods. |
|
4129 |
||
405 | 4130 |
"Modified: / 22.10.1998 / 01:53:58 / cg" |
334 | 4131 |
! |
4132 |
||
440 | 4133 |
_Class_getModifiers:nativeContext |
4134 |
UnimplementedNativeMethodSignal raise |
|
4135 |
||
4136 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
4137 |
"Created: / 12.11.1998 / 18:54:53 / cg" |
|
4138 |
! |
|
4139 |
||
255 | 4140 |
_Class_getName:nativeContext |
4141 |
"get a classes name" |
|
4142 |
||
4143 |
|jClass cls| |
|
4144 |
||
4145 |
jClass := nativeContext receiver. |
|
4146 |
cls := JavaClasses at:jClass. |
|
359 | 4147 |
^ Java as_String:(cls fullName copyReplaceAll:$/ with:$.). |
4148 |
||
4149 |
"Modified: / 18.7.1998 / 22:59:05 / cg" |
|
255 | 4150 |
! |
4151 |
||
253 | 4152 |
_Class_getPrimitiveClass:nativeContext |
4153 |
"get a primitive class by name" |
|
4154 |
||
4155 |
|jClassName className cls| |
|
4156 |
||
4157 |
jClassName := nativeContext argAt:1. |
|
4158 |
className := Java as_ST_String:jClassName. |
|
4159 |
||
4160 |
JavaClasses isNil ifTrue:[ |
|
261 | 4161 |
self initializePrimitiveClasses |
253 | 4162 |
]. |
4163 |
cls := JavaClasses at:className. |
|
4164 |
||
4165 |
"/ cls := Java classForName:className. |
|
4166 |
"/ cls isNil ifTrue:[ |
|
4167 |
"/ cls := JavaClasses at:('JavaBase_' , className) asSymbol ifAbsent:nil. |
|
4168 |
"/ #( |
|
4169 |
"/ 'boolean' #Boolean |
|
4170 |
"/ 'float' #ShortFloat |
|
4171 |
"/ 'double' #Float |
|
4172 |
"/ 'int' #Integer |
|
4173 |
"/ 'long' #Integer |
|
4174 |
"/ 'char' #Character |
|
4175 |
"/ 'short' #Integer |
|
4176 |
"/ 'byte' #Integer |
|
4177 |
"/ 'void' #UndefinedObject |
|
4178 |
"/ ) pairWiseDo:[:nm :sym | |
|
4179 |
"/ className = nm ifTrue:[ |
|
4180 |
"/ cls := Smalltalk at:sym. |
|
4181 |
"/ ] |
|
4182 |
"/ ]. |
|
4183 |
"/ |
|
4184 |
"/ cls isNil ifTrue:[ |
|
4185 |
"/ self internalError:'class: ' , className , ' not found.'. |
|
4186 |
"/ ]. |
|
4187 |
"/ ]. |
|
4188 |
^ cls |
|
4189 |
||
4190 |
"Created: / 4.1.1998 / 00:46:03 / cg" |
|
4191 |
"Modified: / 4.1.1998 / 01:12:27 / cg" |
|
4192 |
! |
|
4193 |
||
440 | 4194 |
_Class_getSigners:nativeContext |
4195 |
UnimplementedNativeMethodSignal raise |
|
4196 |
||
4197 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
4198 |
"Created: / 12.11.1998 / 18:55:01 / cg" |
|
4199 |
! |
|
4200 |
||
255 | 4201 |
_Class_getSuperclass:nativeContext |
4202 |
"return a classes superclass" |
|
4203 |
||
4204 |
|jClass cls superCls| |
|
4205 |
||
4206 |
jClass := nativeContext receiver. |
|
4207 |
cls := JavaClasses at:jClass. |
|
4208 |
superCls := cls superclass. |
|
4209 |
superCls == JavaObject ifTrue:[ |
|
307 | 4210 |
^ nil. |
4211 |
]. |
|
4212 |
^ self javaClassObjectForClass:superCls |
|
255 | 4213 |
|
4214 |
"Created: / 12.1.1998 / 12:38:36 / cg" |
|
307 | 4215 |
"Modified: / 4.2.1998 / 14:51:22 / cg" |
255 | 4216 |
! |
4217 |
||
440 | 4218 |
_Class_isArray:nativeContext |
4219 |
UnimplementedNativeMethodSignal raise |
|
4220 |
||
4221 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
4222 |
"Created: / 12.11.1998 / 18:54:24 / cg" |
|
4223 |
! |
|
4224 |
||
4225 |
_Class_isAssignableFrom:nativeContext |
|
4226 |
UnimplementedNativeMethodSignal raise |
|
4227 |
||
4228 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
4229 |
"Created: / 12.11.1998 / 18:54:16 / cg" |
|
4230 |
! |
|
4231 |
||
321 | 4232 |
_Class_isInstance:nativeContext |
4233 |
"return true, if something is an instance of a class. |
|
4234 |
(i.e. same as instanceOf - builtin bytecode)" |
|
4235 |
||
4236 |
|jClass cls obj| |
|
4237 |
||
4238 |
obj := nativeContext argAt:1. |
|
4239 |
obj isNil ifTrue:[^ 0 "FALSE"]. |
|
4240 |
||
4241 |
jClass := nativeContext receiver. |
|
4242 |
cls := JavaClasses at:jClass. |
|
4243 |
||
4244 |
(obj isMemberOf:cls) ifTrue:[^ 1 "TRUE"]. |
|
4245 |
(obj isKindOf:cls) ifTrue:[^ 1 "TRUE"]. |
|
4246 |
||
4247 |
cls isBehavior ifTrue:[ |
|
4248 |
cls isInterface ifTrue:[ |
|
4249 |
(obj class hasInterface:cls) ifTrue:[ |
|
4250 |
^ 1 "TRUE" |
|
4251 |
] |
|
4252 |
]. |
|
4253 |
^ (obj isKindOf:cls) ifTrue:[1 "TRUE"] ifFalse:[0 "FALSE"] |
|
4254 |
]. |
|
4255 |
(cls isMemberOf:JavaClassPointerRef) ifTrue:[ |
|
4256 |
"/ must be a pointer to an array of that class |
|
4257 |
||
4258 |
^ (obj isArray) ifTrue:[1 "TRUE"] ifFalse:[0 "FALSE"] |
|
4259 |
]. |
|
4260 |
(cls isMemberOf:JavaBuiltInClassPointerRef) ifTrue:[ |
|
4261 |
cls arrayClass == obj class ifTrue:[ |
|
4262 |
^ 1 "TRUE" |
|
4263 |
]. |
|
4264 |
]. |
|
4265 |
||
4266 |
(obj isMemberOf:Array) ifTrue:[ |
|
4267 |
obj size == 0 ifTrue:[ |
|
4268 |
^ 1 "TRUE" |
|
4269 |
]. |
|
4270 |
^ (self _checkCast:(obj at:1) class:(cls deref)) |
|
4271 |
ifTrue:[1 "TRUE"] ifFalse:[0 "FALSE"] |
|
4272 |
]. |
|
4273 |
self halt. |
|
4274 |
^ 0 "FALSE". |
|
4275 |
||
4276 |
"Modified: / 9.2.1998 / 14:56:23 / cg" |
|
4277 |
! |
|
4278 |
||
255 | 4279 |
_Class_isInterface:nativeContext |
4280 |
"return true, if this class is an interface" |
|
4281 |
||
4282 |
|jClass cls| |
|
4283 |
||
4284 |
jClass := nativeContext receiver. |
|
4285 |
cls := JavaClasses at:jClass. |
|
4286 |
cls isInterface ifTrue:[^ 1 "TRUE"]. |
|
4287 |
^ 0 "FALSE" |
|
4288 |
||
4289 |
"Created: / 12.1.1998 / 12:37:02 / cg" |
|
4290 |
! |
|
4291 |
||
321 | 4292 |
_Class_isPrimitive:nativeContext |
4293 |
"return true, if this class is builtin primitive class |
|
4294 |
(i.e. byteArray, array, string etc." |
|
4295 |
||
4296 |
|jClass cls| |
|
4297 |
||
4298 |
jClass := nativeContext receiver. |
|
4299 |
cls := JavaClasses at:jClass. |
|
4300 |
^ 0 "FALSE" |
|
4301 |
||
4302 |
"Created: / 9.2.1998 / 14:46:07 / cg" |
|
4303 |
! |
|
4304 |
||
253 | 4305 |
_Class_newInstance:nativeContext |
4306 |
"get an instance for a java.lang.Class" |
|
4307 |
||
4308 |
|jClass cls newInst| |
|
4309 |
||
4310 |
jClass := nativeContext receiver. |
|
4311 |
cls := JavaClasses at:jClass. |
|
261 | 4312 |
cls classInit. |
253 | 4313 |
newInst := cls newCleared. |
255 | 4314 |
newInst perform:#'<init>()V'. |
253 | 4315 |
|
4316 |
^ newInst |
|
4317 |
||
4318 |
"Created: / 2.1.1998 / 22:41:38 / cg" |
|
261 | 4319 |
"Modified: / 15.1.1998 / 00:57:37 / cg" |
253 | 4320 |
! |
4321 |
||
440 | 4322 |
_Class_setSigners:nativeContext |
4323 |
UnimplementedNativeMethodSignal raise |
|
4324 |
||
4325 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
4326 |
"Created: / 12.11.1998 / 18:55:08 / cg" |
|
4327 |
! |
|
4328 |
||
253 | 4329 |
_Double_doubleToLongBits:nativeContext |
4330 |
|f i| |
|
4331 |
||
4332 |
f := nativeContext argAt:1. |
|
4333 |
||
4334 |
UninterpretedBytes isBigEndian ifTrue:[ |
|
261 | 4335 |
i := f basicAt:8. |
4336 |
i := i bitOr:((f basicAt:7) bitShift:8). |
|
4337 |
i := i bitOr:((f basicAt:6) bitShift:16). |
|
4338 |
i := i bitOr:((f basicAt:5) bitShift:24). |
|
4339 |
i := i bitOr:((f basicAt:4) bitShift:32). |
|
4340 |
i := i bitOr:((f basicAt:3) bitShift:40). |
|
4341 |
i := i bitOr:((f basicAt:2) bitShift:48). |
|
4342 |
i := i bitOr:((f basicAt:1) bitShift:56). |
|
253 | 4343 |
] ifFalse:[ |
261 | 4344 |
i := f basicAt:1. |
4345 |
i := i bitOr:((f basicAt:2) bitShift:8). |
|
4346 |
i := i bitOr:((f basicAt:3) bitShift:16). |
|
4347 |
i := i bitOr:((f basicAt:4) bitShift:24). |
|
4348 |
i := i bitOr:((f basicAt:5) bitShift:32). |
|
4349 |
i := i bitOr:((f basicAt:6) bitShift:40). |
|
4350 |
i := i bitOr:((f basicAt:7) bitShift:48). |
|
4351 |
i := i bitOr:((f basicAt:8) bitShift:56). |
|
253 | 4352 |
]. |
4353 |
||
4354 |
^ i. |
|
4355 |
||
4356 |
"Created: / 4.1.1998 / 01:39:12 / cg" |
|
4357 |
! |
|
4358 |
||
4359 |
_Double_longBitsToDouble:nativeContext |
|
4360 |
|i aFloat| |
|
4361 |
||
4362 |
i := nativeContext argAt:1. |
|
4363 |
||
4364 |
aFloat := Float new. |
|
4365 |
UninterpretedBytes isBigEndian ifTrue:[ |
|
261 | 4366 |
aFloat basicAt:1 put:((i bitShift:-56) bitAnd:16rFF). |
4367 |
aFloat basicAt:2 put:((i bitShift:-48) bitAnd:16rFF). |
|
4368 |
aFloat basicAt:3 put:((i bitShift:-40) bitAnd:16rFF). |
|
4369 |
aFloat basicAt:4 put:((i bitShift:-32) bitAnd:16rFF). |
|
4370 |
aFloat basicAt:5 put:((i bitShift:-24) bitAnd:16rFF). |
|
4371 |
aFloat basicAt:6 put:((i bitShift:-16) bitAnd:16rFF). |
|
4372 |
aFloat basicAt:7 put:((i bitShift:-8) bitAnd:16rFF). |
|
4373 |
aFloat basicAt:8 put:(i bitAnd:16rFF). |
|
253 | 4374 |
] ifFalse:[ |
261 | 4375 |
aFloat basicAt:1 put:(i bitAnd:16rFF). |
4376 |
aFloat basicAt:2 put:((i bitShift:-8) bitAnd:16rFF). |
|
4377 |
aFloat basicAt:3 put:((i bitShift:-16) bitAnd:16rFF). |
|
4378 |
aFloat basicAt:4 put:((i bitShift:-24) bitAnd:16rFF). |
|
4379 |
aFloat basicAt:5 put:((i bitShift:-32) bitAnd:16rFF). |
|
4380 |
aFloat basicAt:6 put:((i bitShift:-40) bitAnd:16rFF). |
|
4381 |
aFloat basicAt:7 put:((i bitShift:-48) bitAnd:16rFF). |
|
4382 |
aFloat basicAt:8 put:((i bitShift:-56) bitAnd:16rFF). |
|
253 | 4383 |
]. |
4384 |
||
4385 |
^ aFloat. |
|
4386 |
||
4387 |
"Created: / 4.1.1998 / 01:45:00 / cg" |
|
4388 |
! |
|
4389 |
||
255 | 4390 |
_Double_valueOf0:nativeContext |
4391 |
|s d| |
|
4392 |
||
4393 |
s := nativeContext argAt:1. |
|
4394 |
s notNil ifTrue:[ |
|
261 | 4395 |
s := Java as_ST_String:s. |
4396 |
d := Float readFrom:s onError:nil. |
|
255 | 4397 |
]. |
4398 |
d isNil ifTrue:[ |
|
261 | 4399 |
self throwNumberFormatException. |
4400 |
"/ not reached |
|
255 | 4401 |
]. |
4402 |
||
4403 |
^ d |
|
4404 |
||
4405 |
"Modified: / 8.8.1997 / 12:03:55 / cg" |
|
4406 |
"Created: / 7.1.1998 / 11:09:43 / cg" |
|
4407 |
! |
|
4408 |
||
253 | 4409 |
_Float_floatToIntBits:nativeContext |
4410 |
|f i| |
|
4411 |
||
4412 |
f := nativeContext argAt:1. |
|
4413 |
||
4414 |
UninterpretedBytes isBigEndian ifTrue:[ |
|
261 | 4415 |
i := f basicAt:4. |
4416 |
i := i bitOr:((f basicAt:3) bitShift:8). |
|
4417 |
i := i bitOr:((f basicAt:2) bitShift:16). |
|
4418 |
i := i bitOr:((f basicAt:1) bitShift:24). |
|
253 | 4419 |
] ifFalse:[ |
261 | 4420 |
i := f basicAt:1. |
4421 |
i := i bitOr:((f basicAt:2) bitShift:8). |
|
4422 |
i := i bitOr:((f basicAt:3) bitShift:16). |
|
4423 |
i := i bitOr:((f basicAt:4) bitShift:24). |
|
253 | 4424 |
]. |
4425 |
||
4426 |
^ i. |
|
4427 |
||
4428 |
"Created: / 4.1.1998 / 01:25:50 / cg" |
|
4429 |
! |
|
4430 |
||
261 | 4431 |
_Float_intBitsToFloat:nativeContet |
4432 |
|i aFloat| |
|
4433 |
||
4434 |
i := nativeContet argAt:1. |
|
4435 |
||
4436 |
aFloat := ShortFloat basicNew. |
|
4437 |
UninterpretedBytes isBigEndian ifTrue:[ |
|
4438 |
aFloat basicAt:1 put:((i bitShift:-24) bitAnd:16rFF). |
|
4439 |
aFloat basicAt:2 put:((i bitShift:-16) bitAnd:16rFF). |
|
4440 |
aFloat basicAt:3 put:((i bitShift:-8) bitAnd:16rFF). |
|
4441 |
aFloat basicAt:4 put:(i bitAnd:16rFF). |
|
4442 |
] ifFalse:[ |
|
4443 |
aFloat basicAt:1 put:(i bitAnd:16rFF). |
|
4444 |
aFloat basicAt:2 put:((i bitShift:-8) bitAnd:16rFF). |
|
4445 |
aFloat basicAt:3 put:((i bitShift:-16) bitAnd:16rFF). |
|
4446 |
aFloat basicAt:4 put:((i bitShift:-24) bitAnd:16rFF). |
|
4447 |
]. |
|
4448 |
||
4449 |
^ aFloat. |
|
4450 |
||
4451 |
"Created: / 13.1.1998 / 23:03:36 / cg" |
|
4452 |
"Modified: / 13.1.1998 / 23:05:01 / cg" |
|
4453 |
! |
|
4454 |
||
440 | 4455 |
_Math_IEEEremainder:nativeContext |
4456 |
UnimplementedNativeMethodSignal raise |
|
4457 |
||
4458 |
"Created: / 12.11.1998 / 18:52:36 / cg" |
|
4459 |
! |
|
4460 |
||
342 | 4461 |
_Math_acos:nativeContext |
4462 |
"arc cosine" |
|
4463 |
||
4464 |
|dVal| |
|
4465 |
||
4466 |
dVal := nativeContext argAt:1. |
|
432 | 4467 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4468 |
"/ dVal isReal ifTrue:[ |
|
4469 |
"/ 'JAVAVM [info]: missing double flag in Math>>acos' infoPrintCR. |
|
4470 |
"/ ] ifFalse:[ |
|
4471 |
"/ self halt:'expected double arg' |
|
4472 |
"/ ] |
|
4473 |
"/ ]. |
|
342 | 4474 |
^ dVal arcCos |
4475 |
||
4476 |
"Created: / 7.5.1998 / 00:34:50 / cg" |
|
432 | 4477 |
"Modified: / 11.11.1998 / 15:08:20 / cg" |
342 | 4478 |
! |
4479 |
||
4480 |
_Math_asin:nativeContext |
|
4481 |
"arc sine" |
|
4482 |
||
4483 |
|dVal| |
|
4484 |
||
4485 |
dVal := nativeContext argAt:1. |
|
432 | 4486 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4487 |
"/ dVal isReal ifTrue:[ |
|
4488 |
"/ 'JAVAVM [info]: missing double flag in Math>>asin' infoPrintCR. |
|
4489 |
"/ ] ifFalse:[ |
|
4490 |
"/ self halt:'expected double arg' |
|
4491 |
"/ ] |
|
4492 |
"/ ]. |
|
342 | 4493 |
^ dVal arcSin |
4494 |
||
4495 |
"Created: / 7.5.1998 / 00:34:26 / cg" |
|
432 | 4496 |
"Modified: / 11.11.1998 / 15:08:15 / cg" |
342 | 4497 |
! |
4498 |
||
440 | 4499 |
_Math_atan2:nativeContext |
4500 |
UnimplementedNativeMethodSignal raise |
|
4501 |
||
4502 |
"Created: / 12.11.1998 / 18:52:52 / cg" |
|
4503 |
! |
|
4504 |
||
317 | 4505 |
_Math_atan:nativeContext |
4506 |
"arc tangens" |
|
4507 |
||
4508 |
|dVal| |
|
4509 |
||
4510 |
dVal := nativeContext argAt:1. |
|
432 | 4511 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4512 |
"/ dVal isReal ifTrue:[ |
|
4513 |
"/ 'JAVAVM [info]: missing double flag in Math>>atan' infoPrintCR. |
|
4514 |
"/ ] ifFalse:[ |
|
4515 |
"/ self halt:'expected double arg' |
|
4516 |
"/ ] |
|
4517 |
"/ ]. |
|
317 | 4518 |
^ dVal arcTan |
4519 |
||
4520 |
"Created: / 6.2.1998 / 01:24:12 / cg" |
|
432 | 4521 |
"Modified: / 11.11.1998 / 15:08:11 / cg" |
317 | 4522 |
! |
4523 |
||
255 | 4524 |
_Math_ceil:nativeContext |
4525 |
"ceiling" |
|
4526 |
||
4527 |
|dVal| |
|
4528 |
||
4529 |
dVal := nativeContext argAt:1. |
|
432 | 4530 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4531 |
"/ dVal isReal ifTrue:[ |
|
4532 |
"/ 'JAVAVM [info]: missing double flag in Math>>ceil' infoPrintCR. |
|
4533 |
"/ ] ifFalse:[ |
|
4534 |
"/ self halt:'expected double arg' |
|
4535 |
"/ ] |
|
4536 |
"/ ]. |
|
255 | 4537 |
^ dVal ceilingAsFloat |
4538 |
||
4539 |
"Created: / 7.1.1998 / 15:43:00 / cg" |
|
432 | 4540 |
"Modified: / 11.11.1998 / 15:08:04 / cg" |
255 | 4541 |
! |
4542 |
||
4543 |
_Math_cos:nativeContext |
|
4544 |
"cosine" |
|
4545 |
||
4546 |
|dVal| |
|
4547 |
||
4548 |
dVal := nativeContext argAt:1. |
|
432 | 4549 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4550 |
"/ dVal isReal ifTrue:[ |
|
4551 |
"/ 'JAVAVM [info]: missing double flag in Math>>cos' infoPrintCR. |
|
4552 |
"/ ] ifFalse:[ |
|
4553 |
"/ self halt:'expected double arg' |
|
4554 |
"/ ] |
|
4555 |
"/ ]. |
|
255 | 4556 |
^ dVal cos |
4557 |
||
4558 |
"Created: / 7.1.1998 / 15:41:30 / cg" |
|
432 | 4559 |
"Modified: / 11.11.1998 / 15:07:59 / cg" |
255 | 4560 |
! |
4561 |
||
342 | 4562 |
_Math_exp:nativeContext |
4563 |
"exponential" |
|
4564 |
||
4565 |
|dVal| |
|
4566 |
||
4567 |
dVal := nativeContext argAt:1. |
|
432 | 4568 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4569 |
"/ dVal isReal ifTrue:[ |
|
4570 |
"/ 'JAVAVM [info]: missing double flag in Math>>exp' infoPrintCR. |
|
4571 |
"/ ] ifFalse:[ |
|
4572 |
"/ self halt:'expected double arg' |
|
4573 |
"/ ] |
|
4574 |
"/ ]. |
|
342 | 4575 |
^ dVal exp |
4576 |
||
4577 |
"Created: / 7.5.1998 / 00:36:19 / cg" |
|
432 | 4578 |
"Modified: / 11.11.1998 / 15:07:50 / cg" |
342 | 4579 |
! |
4580 |
||
255 | 4581 |
_Math_floor:nativeContext |
4582 |
"floor" |
|
4583 |
||
4584 |
|dVal| |
|
4585 |
||
4586 |
dVal := nativeContext argAt:1. |
|
432 | 4587 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4588 |
"/ dVal isReal ifTrue:[ |
|
4589 |
"/ 'JAVAVM [info]: missing double flag in Math>>floor' infoPrintCR. |
|
4590 |
"/ ] ifFalse:[ |
|
4591 |
"/ self halt:'expected double arg' |
|
4592 |
"/ ] |
|
4593 |
"/ ]. |
|
255 | 4594 |
^ dVal floorAsFloat |
4595 |
||
4596 |
"Created: / 7.1.1998 / 19:09:21 / cg" |
|
432 | 4597 |
"Modified: / 11.11.1998 / 15:07:45 / cg" |
255 | 4598 |
! |
4599 |
||
4600 |
_Math_log:nativeContext |
|
4601 |
"logarithm" |
|
4602 |
||
4603 |
|dVal| |
|
4604 |
||
4605 |
dVal := nativeContext argAt:1. |
|
432 | 4606 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4607 |
"/ dVal isReal ifTrue:[ |
|
4608 |
"/ 'JAVAVM [info]: missing double flag in Math>>log' infoPrintCR. |
|
4609 |
"/ ] ifFalse:[ |
|
4610 |
"/ self halt:'expected double arg' |
|
4611 |
"/ ] |
|
4612 |
"/ ]. |
|
255 | 4613 |
^ dVal log |
4614 |
||
4615 |
"Created: / 7.1.1998 / 15:42:19 / cg" |
|
432 | 4616 |
"Modified: / 11.11.1998 / 15:07:38 / cg" |
255 | 4617 |
! |
4618 |
||
4619 |
_Math_pow:nativeContext |
|
4620 |
"power" |
|
4621 |
||
4622 |
|dVal1 dVal2| |
|
4623 |
||
4624 |
dVal1 := nativeContext argAt:1. |
|
432 | 4625 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4626 |
"/ dVal1 isReal ifTrue:[ |
|
4627 |
"/ 'JAVAVM [info]: missing double flag in Math>>pow' infoPrintCR. |
|
4628 |
"/ ] ifFalse:[ |
|
4629 |
"/ self halt:'expected double arg' |
|
4630 |
"/ ] |
|
4631 |
"/ ]. |
|
255 | 4632 |
dVal2 := nativeContext argAt:3. |
432 | 4633 |
"/ (nativeContext argAt:4) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4634 |
"/ dVal2 isReal ifTrue:[ |
|
4635 |
"/ 'JAVAVM [info]: missing double flag in Math>>pow' infoPrintCR. |
|
4636 |
"/ ] ifFalse:[ |
|
4637 |
"/ self halt:'expected double arg' |
|
4638 |
"/ ] |
|
4639 |
"/ ]. |
|
255 | 4640 |
^ dVal1 raisedTo:dVal2 |
4641 |
||
4642 |
"Created: / 7.1.1998 / 15:44:13 / cg" |
|
432 | 4643 |
"Modified: / 11.11.1998 / 15:07:33 / cg" |
255 | 4644 |
! |
4645 |
||
440 | 4646 |
_Math_rint:nativeContext |
4647 |
UnimplementedNativeMethodSignal raise |
|
4648 |
||
4649 |
"Created: / 12.11.1998 / 18:52:47 / cg" |
|
4650 |
! |
|
4651 |
||
255 | 4652 |
_Math_sin:nativeContext |
4653 |
"sine" |
|
4654 |
||
4655 |
|dVal| |
|
4656 |
||
4657 |
dVal := nativeContext argAt:1. |
|
432 | 4658 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4659 |
"/ dVal isReal ifTrue:[ |
|
4660 |
"/ 'JAVAVM [info]: missing double flag in Math>>sin' infoPrintCR. |
|
4661 |
"/ ] ifFalse:[ |
|
4662 |
"/ self halt:'expected double arg' |
|
4663 |
"/ ] |
|
4664 |
"/ ]. |
|
255 | 4665 |
^ dVal sin |
4666 |
||
4667 |
"Created: / 7.1.1998 / 15:41:40 / cg" |
|
432 | 4668 |
"Modified: / 11.11.1998 / 15:07:09 / cg" |
255 | 4669 |
! |
4670 |
||
4671 |
_Math_sqrt:nativeContext |
|
4672 |
"square root" |
|
4673 |
||
4674 |
|dVal| |
|
4675 |
||
4676 |
dVal := nativeContext argAt:1. |
|
432 | 4677 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4678 |
"/ dVal isReal ifTrue:[ |
|
4679 |
"/ 'JAVAVM [info]: missing double flag in Math>>sqrt' infoPrintCR. |
|
4680 |
"/ ] ifFalse:[ |
|
4681 |
"/ self halt:'expected double arg' |
|
4682 |
"/ ] |
|
4683 |
"/ ]. |
|
4684 |
||
4685 |
"/ how about domain errors ? |
|
4686 |
dVal < 0 ifTrue:[ |
|
4687 |
"/ ^ 0.0 |
|
255 | 4688 |
]. |
4689 |
^ dVal sqrt |
|
4690 |
||
4691 |
"Created: / 7.1.1998 / 15:42:40 / cg" |
|
432 | 4692 |
"Modified: / 11.11.1998 / 15:06:55 / cg" |
255 | 4693 |
! |
4694 |
||
342 | 4695 |
_Math_tan:nativeContext |
4696 |
"tangent" |
|
4697 |
||
4698 |
|dVal| |
|
4699 |
||
4700 |
dVal := nativeContext argAt:1. |
|
432 | 4701 |
"/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
4702 |
"/ dVal isReal ifTrue:[ |
|
4703 |
"/ 'JAVAVM [info]: missing double flag in Math>>tan' infoPrintCR. |
|
4704 |
"/ ] ifFalse:[ |
|
4705 |
"/ self halt:'expected double arg' |
|
4706 |
"/ ] |
|
4707 |
"/ ]. |
|
342 | 4708 |
^ dVal tan |
4709 |
||
4710 |
"Created: / 7.5.1998 / 00:34:03 / cg" |
|
432 | 4711 |
"Modified: / 11.11.1998 / 15:07:14 / cg" |
342 | 4712 |
! |
4713 |
||
334 | 4714 |
_Method_getModifiers:nativeContext |
4715 |
|jMethod mthd retVal| |
|
4716 |
||
4717 |
jMethod := nativeContext receiver. |
|
4718 |
||
4719 |
mthd := JavaMethods at:jMethod ifAbsent:nil. |
|
4720 |
mthd isNil ifTrue:[ |
|
4721 |
self halt. |
|
4722 |
^ 0 |
|
4723 |
]. |
|
4724 |
^ mthd accessFlags |
|
4725 |
||
4726 |
"Modified: / 9.4.1998 / 17:50:01 / cg" |
|
4727 |
! |
|
4728 |
||
322 | 4729 |
_Method_invoke:nativeContext |
4730 |
"invoke a javaMethod" |
|
4731 |
||
4732 |
|jMethod mthd rec args retVal| |
|
4733 |
||
4734 |
jMethod := nativeContext receiver. |
|
4735 |
rec := nativeContext argAt:1. |
|
4736 |
args := nativeContext argAt:2. |
|
4737 |
||
4738 |
mthd := JavaMethods at:jMethod ifAbsent:nil. |
|
4739 |
mthd isNil ifTrue:[ |
|
4740 |
self halt. |
|
4741 |
]. |
|
4742 |
||
4743 |
"/ check for arguments to match the expected types ... |
|
4744 |
||
4745 |
mthd argSignature keysAndValuesDo:[:index :argSig | |
|
4746 |
|cls arg| |
|
4747 |
||
4748 |
cls := Java at:argSig. |
|
4749 |
arg := args at:index. |
|
4750 |
(arg isKindOf:cls) ifFalse:[ |
|
4751 |
self halt. |
|
4752 |
] |
|
4753 |
]. |
|
4754 |
||
4755 |
mthd isStatic ifTrue:[ |
|
4756 |
retVal := mthd valueWithReceiver:(mthd javaClass) arguments:args selector:mthd selector. |
|
4757 |
^ retVal |
|
4758 |
] ifFalse:[ |
|
4759 |
self halt. |
|
4760 |
]. |
|
4761 |
||
4762 |
self halt. |
|
4763 |
||
4764 |
"Created: / 13.2.1998 / 15:15:28 / cg" |
|
4765 |
"Modified: / 13.2.1998 / 15:35:54 / cg" |
|
4766 |
! |
|
4767 |
||
253 | 4768 |
_Object_clone:nativeContext |
4769 |
"clone an object" |
|
4770 |
||
4771 |
|o rslt| |
|
4772 |
||
4773 |
o := nativeContext receiver. |
|
4774 |
rslt := o shallowCopy. |
|
4775 |
^ rslt |
|
4776 |
||
4777 |
"Created: / 4.1.1998 / 19:39:26 / cg" |
|
4778 |
! |
|
4779 |
||
255 | 4780 |
_Object_getClass:nativeContext |
4781 |
"return an objects class" |
|
4782 |
||
4783 |
|o cls jClass| |
|
4784 |
||
4785 |
o := nativeContext receiver. |
|
4786 |
cls := o class. |
|
4787 |
||
268
f7357f1142c8
provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents:
266
diff
changeset
|
4788 |
jClass := self javaClassObjectForClass:cls. |
255 | 4789 |
^ jClass |
4790 |
||
4791 |
"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
|
4792 |
"Modified: / 23.1.1998 / 17:48:22 / cg" |
255 | 4793 |
! |
4794 |
||
253 | 4795 |
_Object_hashCode:nativeContext |
4796 |
"identityHash" |
|
4797 |
||
4798 |
|o rslt| |
|
4799 |
||
4800 |
o := nativeContext receiver. |
|
4801 |
rslt := o identityHash. |
|
4802 |
^ rslt |
|
4803 |
||
4804 |
"Created: / 4.1.1998 / 19:40:26 / cg" |
|
4805 |
! |
|
4806 |
||
255 | 4807 |
_Object_notify:nativeContext |
4808 |
"wakeup" |
|
4809 |
||
4810 |
self wakeup:(nativeContext receiver). |
|
4811 |
||
4812 |
"Created: / 6.1.1998 / 21:09:26 / cg" |
|
4813 |
! |
|
4814 |
||
253 | 4815 |
_Object_notifyAll:nativeContext |
4816 |
self wakeupAll:(nativeContext receiver). |
|
4817 |
||
4818 |
"Created: / 3.1.1998 / 03:06:56 / cg" |
|
4819 |
! |
|
4820 |
||
4821 |
_Object_wait:nativeMethodContext |
|
4822 |
"wait" |
|
4823 |
||
4824 |
|tmo handle sema enteredMonitors| |
|
4825 |
||
4826 |
handle := nativeMethodContext receiver. |
|
4827 |
tmo := nativeMethodContext argAt:1. |
|
4828 |
||
4829 |
sema := JavaVM semaphoreFor:handle. |
|
4830 |
||
4831 |
"/ temporarily leave all entered monitors. |
|
4832 |
||
4833 |
enteredMonitors := self enteredMonitors. |
|
4834 |
||
4835 |
enteredMonitors size > 0 ifTrue:[ |
|
306 | 4836 |
MonitorTrace ifTrue:[ |
4837 |
('====> wait - exit ' , enteredMonitors size printString , ' monitors in ' , Processor activeProcess name , ' ...') infoPrintCR. |
|
4838 |
]. |
|
4839 |
enteredMonitors do:[:handle | |
|
4840 |
|mon| |
|
4841 |
||
4842 |
mon := LockTable at:handle ifAbsent:nil. |
|
4843 |
mon isNil ifTrue:[ |
|
4844 |
self halt:'no monitor in wait'. |
|
4845 |
] ifFalse:[ |
|
4846 |
MonitorTrace ifTrue:[ |
|
4847 |
('====> wait - exit monitor for ' , handle displayString , ' in ' , Processor activeProcess name , ' ...') infoPrintCR. |
|
4848 |
]. |
|
4849 |
mon exit. |
|
4850 |
]. |
|
4851 |
]. |
|
253 | 4852 |
]. |
4853 |
||
4854 |
[ |
|
306 | 4855 |
ThreadTrace ifTrue:[ |
4856 |
('====> thread ' , Processor activeProcess name , ' waiting ...') infoPrintCR. |
|
4857 |
]. |
|
307 | 4858 |
Processor activeProcess state:#javaWait. |
306 | 4859 |
tmo = 0 ifTrue:[ |
4860 |
sema wait. |
|
4861 |
] ifFalse:[ |
|
4862 |
sema waitWithTimeout:tmo / 1000. |
|
4863 |
]. |
|
4864 |
] valueOnUnwindDo: "valueNowOrOnUnwindDo:" [ |
|
4865 |
JavaVM releaseSemaphoreFor:handle. |
|
253 | 4866 |
]. |
4867 |
||
4868 |
"/ re-enter monitors. |
|
4869 |
||
4870 |
enteredMonitors size > 0 ifTrue:[ |
|
306 | 4871 |
MonitorTrace ifTrue:[ |
4872 |
('====> wait - reenter ' , enteredMonitors size printString , ' monitors in ' , Processor activeProcess name , ' ...') infoPrintCR. |
|
4873 |
]. |
|
4874 |
enteredMonitors do:[:handle | |
|
4875 |
|mon| |
|
4876 |
||
4877 |
LockTableAccess critical:[ |
|
4878 |
mon := LockTable at:handle ifAbsent:nil. |
|
4879 |
mon isNil ifTrue:[ |
|
4880 |
LockTable at:handle put:(mon := Monitor new) |
|
4881 |
] |
|
4882 |
]. |
|
4883 |
MonitorTrace ifTrue:[ |
|
4884 |
('====> wait - reenter monitor for ' , handle displayString , ' in ' , Processor activeProcess name , ' ...') infoPrintCR. |
|
4885 |
]. |
|
4886 |
mon enter. |
|
4887 |
] |
|
253 | 4888 |
]. |
4889 |
||
4890 |
ThreadTrace ifTrue:[ |
|
306 | 4891 |
'====> thread continues ...' printCR. |
253 | 4892 |
] |
4893 |
||
426 | 4894 |
"Modified: / 5.11.1998 / 20:42:46 / cg" |
253 | 4895 |
! |
4896 |
||
4897 |
_Runtime_buildLibName:nativeContext |
|
4898 |
|jPath jFileName path fileName libName| |
|
4899 |
||
4900 |
jPath := nativeContext argAt:1. |
|
4901 |
jFileName := nativeContext argAt:2. |
|
4902 |
||
4903 |
path := Java as_ST_String:jPath. |
|
4904 |
fileName := Java as_ST_String:jFileName. |
|
4905 |
||
4906 |
path = '__builtIn__' ifTrue:[ |
|
261 | 4907 |
libName := path , '/' , fileName |
253 | 4908 |
] ifFalse:[ |
261 | 4909 |
libName := path , '/lib' , fileName , '.so'. |
253 | 4910 |
]. |
4911 |
^ Java as_String:libName. |
|
4912 |
||
4913 |
"Modified: / 8.8.1997 / 12:05:05 / cg" |
|
4914 |
"Created: / 4.1.1998 / 19:07:14 / cg" |
|
4915 |
! |
|
4916 |
||
261 | 4917 |
_Runtime_execInternal:nativeContext |
4918 |
"Run a unix-command; return a process object." |
|
4919 |
||
4920 |
|cmdAndArgArray envArray cmd jProcessClass jProcess| |
|
4921 |
||
432 | 4922 |
cmdAndArgArray := nativeContext argAt:1. |
4923 |
envArray := nativeContext argAt:2. |
|
4924 |
||
4925 |
cmd := cmdAndArgArray at:1. |
|
4926 |
||
4927 |
OperatingSystem isUNIXlike ifTrue:[ |
|
4928 |
jProcessClass := Java classForName:'java.lang.UNIXProcess'. |
|
4929 |
] ifFalse:[ |
|
4930 |
jProcessClass := Java classForName:'java.lang.Win32Process'. |
|
4931 |
]. |
|
261 | 4932 |
"/ |
432 | 4933 |
jProcessClass notNil ifTrue:[ |
4934 |
jProcess := jProcessClass newCleared. |
|
4935 |
jProcess |
|
4936 |
perform:#'<init>([Ljava/lang/String;[Ljava/lang/String;)V' |
|
4937 |
with:cmdAndArgArray |
|
4938 |
with:envArray. |
|
4939 |
^ jProcess |
|
4940 |
]. |
|
4941 |
self halt. |
|
261 | 4942 |
self throwIOExceptionWithMessage:'Process execution disabled/unimplemented'. |
4943 |
^ nil |
|
4944 |
||
4945 |
"Created: / 15.1.1998 / 01:50:31 / cg" |
|
432 | 4946 |
"Modified: / 10.11.1998 / 19:54:29 / cg" |
261 | 4947 |
! |
4948 |
||
255 | 4949 |
_Runtime_exitInternal:nativeContext |
4950 |
"exit - here, we only shut down java threads" |
|
4951 |
||
4952 |
|enteredMonitors| |
|
4953 |
||
474 | 4954 |
ExitDebug == true ifTrue:[ |
4955 |
self halt:'Java code called exit'. |
|
4956 |
]. |
|
4957 |
||
255 | 4958 |
(enteredMonitors := self enteredMonitors) size > 0 ifTrue:[ |
306 | 4959 |
enteredMonitors do:[:handle | |
4960 |
| mon | |
|
4961 |
||
4962 |
mon := LockTable at:handle ifAbsent:nil. |
|
4963 |
mon isNil ifTrue:[ |
|
4964 |
self halt:'no monitor in exitInternal'. |
|
4965 |
] ifFalse:[ |
|
4966 |
mon exit. |
|
255 | 4967 |
('====> terminateThread - exit monitor for ' , handle displayString , ' in ' , Processor activeProcess name , ' ...') infoPrintCR. |
4968 |
"/ LockTableAccess critical:[ |
|
4969 |
"/ mon isFree ifTrue:[ |
|
4970 |
"/ LockTable removeKey:handle |
|
4971 |
"/ ] |
|
4972 |
"/ ] |
|
306 | 4973 |
]. |
4974 |
]. |
|
4975 |
]. |
|
4976 |
||
4977 |
"/ JavaVM releaseAllJavaResources. |
|
255 | 4978 |
AbortSignal raise. |
4979 |
self halt. |
|
4980 |
||
4981 |
"Created: / 7.1.1998 / 22:48:51 / cg" |
|
474 | 4982 |
"Modified: / 2.12.1998 / 23:03:18 / cg" |
255 | 4983 |
! |
4984 |
||
4985 |
_Runtime_freeMemory:nativeContext |
|
4986 |
"free memory - Returns the number of free bytes" |
|
4987 |
||
4988 |
^ ObjectMemory freeListSpace + ObjectMemory freeSpace |
|
4989 |
||
4990 |
"Created: / 12.1.1998 / 12:59:53 / cg" |
|
4991 |
! |
|
4992 |
||
4993 |
_Runtime_gc:nativeContext |
|
4994 |
"Runs the garbage collector. |
|
4995 |
Ignored, since the ST-gc runs all the time." |
|
4996 |
||
4997 |
^ self |
|
4998 |
||
4999 |
"Modified: / 12.1.1998 / 12:58:32 / cg" |
|
5000 |
! |
|
5001 |
||
253 | 5002 |
_Runtime_initializeLinkerInternal:nativeContext |
5003 |
"init sharedLib linker, return searchPath as javaString" |
|
5004 |
||
5005 |
|path| |
|
5006 |
||
5007 |
"/ mhmh - what is done here ? |
|
5008 |
||
5009 |
path := ''. |
|
5010 |
LibPath do:[:comp | path size == 0 ifTrue:[ |
|
261 | 5011 |
path := path , comp |
5012 |
] ifFalse:[ |
|
5013 |
path := path , ':' , comp |
|
5014 |
] |
|
5015 |
]. |
|
253 | 5016 |
|
5017 |
^ Java as_String:path |
|
5018 |
||
5019 |
"Modified: / 7.8.1997 / 21:17:03 / cg" |
|
5020 |
"Created: / 4.1.1998 / 17:53:15 / cg" |
|
5021 |
! |
|
5022 |
||
5023 |
_Runtime_loadFileInternal:nativeContext |
|
5024 |
"load a sharedLib, return boolean 0 (false) if fail; 1 (true) if ok" |
|
5025 |
||
5026 |
|ret| |
|
5027 |
||
5028 |
ret := self _Runtime_loadFileInternalI:nativeContext. |
|
5029 |
ret < 0 ifTrue:[ ret := 0 ]. |
|
5030 |
^ ret |
|
5031 |
||
5032 |
"Created: / 4.1.1998 / 19:10:20 / cg" |
|
5033 |
"Modified: / 4.1.1998 / 19:11:04 / cg" |
|
5034 |
! |
|
5035 |
||
5036 |
_Runtime_loadFileInternalI:nativeContext |
|
5037 |
"1.1b3 change; load a sharedLib like 'loadFileInternal', |
|
5038 |
but return integer: |
|
319 | 5039 |
-1 outOfMemory error |
5040 |
0 failed to load |
|
5041 |
1 loaded or already loaded (i.e. ok)" |
|
253 | 5042 |
|
5043 |
|jLibName libName libHandle| |
|
5044 |
||
5045 |
jLibName := nativeContext argAt:1. |
|
5046 |
libName := Java as_ST_String:jLibName. |
|
5047 |
||
5048 |
(SimulatedLibs includes:libName) ifTrue:[ |
|
319 | 5049 |
"/ ('JAVA: builtIn libLoad simulated: ' , libName) printNL. |
5050 |
^ 1 |
|
253 | 5051 |
]. |
5052 |
(LoadedLibs notNil and:[LoadedLibs includesKey:libName]) ifTrue:[ |
|
319 | 5053 |
"/ ('JAVA: already loaded: ' , libName) printNL. |
5054 |
^ 1 |
|
253 | 5055 |
]. |
5056 |
||
5057 |
libName asFilename exists ifFalse:[ |
|
319 | 5058 |
('JAVA: no file to load: ' , libName) printNL. |
5059 |
^ 0 |
|
5060 |
]. |
|
5061 |
||
5062 |
(self confirm:'permission to load native library: ' , libName , ' ?') ifFalse:[ |
|
5063 |
^ 0 |
|
253 | 5064 |
]. |
5065 |
||
5066 |
libHandle := ObjectFileLoader loadLibrary:libName. |
|
5067 |
libHandle isNil ifTrue:[ |
|
319 | 5068 |
('JAVA: failed to load: ' , libName) printNL. |
5069 |
^ 0 |
|
253 | 5070 |
]. |
5071 |
||
5072 |
LoadedLibs isNil ifTrue:[ |
|
319 | 5073 |
LoadedLibs := Dictionary new. |
253 | 5074 |
]. |
5075 |
||
5076 |
LoadedLibs at:libName put:libHandle. |
|
5077 |
^ 1 |
|
5078 |
||
5079 |
"Created: / 4.1.1998 / 19:10:54 / cg" |
|
319 | 5080 |
"Modified: / 6.2.1998 / 03:11:59 / cg" |
253 | 5081 |
! |
5082 |
||
440 | 5083 |
_Runtime_runFinalization:nativeContext |
5084 |
"/ void runFinalization () |
|
5085 |
UnimplementedNativeMethodSignal raise |
|
5086 |
||
5087 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
5088 |
"Created: / 12.11.1998 / 18:59:01 / cg" |
|
5089 |
! |
|
5090 |
||
380 | 5091 |
_Runtime_runFinalizersOnExit0:nativeContext |
5092 |
"" |
|
5093 |
||
5094 |
|onOff| |
|
5095 |
||
5096 |
onOff := nativeContext argAt:1. |
|
5097 |
^ 1 |
|
5098 |
||
5099 |
"Modified: / 6.2.1998 / 03:11:59 / cg" |
|
5100 |
"Created: / 15.10.1998 / 23:34:55 / cg" |
|
5101 |
! |
|
5102 |
||
255 | 5103 |
_Runtime_totalMemory:nativeContext |
5104 |
"free memory - Returns the total number of bytes" |
|
5105 |
||
5106 |
^ ObjectMemory oldSpaceSize + ObjectMemory newSpaceSize |
|
5107 |
||
5108 |
"Created: / 12.1.1998 / 12:59:23 / cg" |
|
5109 |
! |
|
5110 |
||
440 | 5111 |
_Runtime_traceInstructions:nativeContext |
5112 |
"/ void traceInstructions (boolean) |
|
5113 |
UnimplementedNativeMethodSignal raise |
|
5114 |
||
5115 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
5116 |
"Created: / 12.11.1998 / 18:59:18 / cg" |
|
5117 |
! |
|
5118 |
||
5119 |
_Runtime_traceMethodCalls:nativeContext |
|
5120 |
"/ void traceMethodCalls (boolean) |
|
5121 |
UnimplementedNativeMethodSignal raise |
|
5122 |
||
5123 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
5124 |
"Created: / 12.11.1998 / 18:59:37 / cg" |
|
5125 |
! |
|
5126 |
||
5127 |
_SecurityManager_classDepth:nativeContext |
|
5128 |
UnimplementedNativeMethodSignal raise |
|
5129 |
||
5130 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
5131 |
"Created: / 12.11.1998 / 18:56:27 / cg" |
|
5132 |
! |
|
5133 |
||
261 | 5134 |
_SecurityManager_classLoaderDepth:nativeContext |
5135 |
|con depth| |
|
5136 |
||
5137 |
con := thisContext sender. |
|
5138 |
depth := 1. |
|
5139 |
[con notNil] whileTrue:[ |
|
5140 |
con receiver == JavaClassReader classLoaderQuerySignal ifTrue:[ |
|
5141 |
con selector == #handle:do: ifTrue:[ |
|
5142 |
depth := depth + 1 |
|
5143 |
] |
|
5144 |
]. |
|
5145 |
con := con sender. |
|
5146 |
]. |
|
5147 |
'JAVA: classLoaderDepth -> ' infoPrint. depth infoPrintCR. |
|
5148 |
^ depth. |
|
5149 |
||
5150 |
"Created: / 13.1.1998 / 09:21:46 / cg" |
|
5151 |
"Modified: / 13.1.1998 / 09:33:43 / cg" |
|
5152 |
! |
|
5153 |
||
5154 |
_SecurityManager_currentClassLoader:nativeContext |
|
5155 |
|loader| |
|
5156 |
||
5157 |
loader := JavaClassReader classLoaderQuerySignal raise. |
|
5158 |
'JAVA: currentClassLoader -> ' infoPrint. loader displayString infoPrintCR. |
|
5159 |
^ loader. |
|
5160 |
||
5161 |
"Created: / 13.1.1998 / 09:23:28 / cg" |
|
5162 |
! |
|
5163 |
||
440 | 5164 |
_SecurityManager_currentLoadedClass0:nativeContext |
5165 |
UnimplementedNativeMethodSignal raise |
|
5166 |
||
5167 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
5168 |
"Created: / 12.11.1998 / 18:56:41 / cg" |
|
5169 |
! |
|
5170 |
||
5171 |
_SecurityManager_getClassContext:nativeContext |
|
5172 |
UnimplementedNativeMethodSignal raise |
|
5173 |
||
5174 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
5175 |
"Created: / 12.11.1998 / 18:56:06 / cg" |
|
5176 |
! |
|
5177 |
||
5178 |
_String_intern:nativeContext |
|
5179 |
UnimplementedNativeMethodSignal raise |
|
5180 |
||
5181 |
"Created: / 12.11.1998 / 18:50:56 / cg" |
|
5182 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
5183 |
! |
|
5184 |
||
253 | 5185 |
_System_arraycopy:nativeContext |
398 | 5186 |
|srcArray srcIdx dstArray dstIdx count dstEndIdx| |
253 | 5187 |
|
5188 |
srcArray := nativeContext argAt:1. |
|
5189 |
srcIdx := nativeContext argAt:2. |
|
5190 |
dstArray := nativeContext argAt:3. |
|
5191 |
dstIdx := nativeContext argAt:4. |
|
5192 |
count := nativeContext argAt:5. |
|
5193 |
||
398 | 5194 |
dstEndIdx := dstIdx + count. |
5195 |
dstIdx := dstIdx + 1. "/ ST uses 1-based indexing |
|
5196 |
srcIdx := srcIdx + 1. "/ ST uses 1-based indexing |
|
5197 |
||
253 | 5198 |
srcArray class isBytes ifTrue:[ |
398 | 5199 |
dstArray class isBytes ifFalse:[ |
5200 |
self halt:'incompatible arraycopy collections'. |
|
5201 |
]. |
|
5202 |
dstArray replaceBytesFrom:dstIdx to:dstEndIdx with:srcArray startingAt:srcIdx. |
|
253 | 5203 |
] ifFalse:[ |
398 | 5204 |
dstArray replaceFrom:dstIdx to:dstEndIdx with:srcArray startingAt:srcIdx. |
253 | 5205 |
]. |
5206 |
^ nil. |
|
5207 |
||
5208 |
"Created: / 3.1.1998 / 01:56:44 / cg" |
|
398 | 5209 |
"Modified: / 20.10.1998 / 16:22:46 / cg" |
253 | 5210 |
! |
5211 |
||
5212 |
_System_currentTimeMillis:nativeContext |
|
5213 |
"return the milliseconds since 1.jan.1970" |
|
5214 |
||
368 | 5215 |
|seconds delta| |
5216 |
||
5217 |
"/ workaround win32 bug (use 01:01:01 as base) |
|
5218 |
delta := AbsoluteTime now millisecondDeltaFrom:(AbsoluteTime day:1 month:1 year:1970 hour:1 minutes:1 seconds:1). |
|
5219 |
delta := delta - 3600 - 60 - 1. |
|
409 | 5220 |
"/ make certain, it fits 64 signed bits |
5221 |
delta := delta bitAnd:16r7FFFFFFFFFFFFFFF. |
|
368 | 5222 |
^ delta max:0 |
253 | 5223 |
|
5224 |
"Created: / 3.1.1998 / 03:25:50 / cg" |
|
409 | 5225 |
"Modified: / 2.11.1998 / 16:42:00 / cg" |
253 | 5226 |
! |
5227 |
||
440 | 5228 |
_System_identityHashCode:nativeContext |
5229 |
UnimplementedNativeMethodSignal raise |
|
5230 |
||
5231 |
"Modified: / 12.11.1998 / 18:52:07 / cg" |
|
5232 |
"Created: / 12.11.1998 / 18:54:00 / cg" |
|
5233 |
! |
|
5234 |
||
253 | 5235 |
_System_initProperties:nativeContext |
5236 |
|props stProps| |
|
5237 |
||
5238 |
props := nativeContext argAt:1. |
|
5239 |
stProps := self systemProperties. |
|
5240 |
||
5241 |
"/ recursively invoke myself on the Java HashTable. |
|
5242 |
"/ calling 'put' to stuff in the values ... |
|
5243 |
||
5244 |
stProps keysAndValuesDo:[:key :value | |
|
270 | 5245 |
|keyObj valueObj| |
5246 |
||
5247 |
keyObj := Java as_String:key. |
|
5248 |
valueObj := Java as_String:value. |
|
5249 |
||
5250 |
props |
|
5251 |
perform:#'put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;' |
|
5252 |
with:keyObj |
|
5253 |
with:valueObj. |
|
253 | 5254 |
]. |
5255 |
^ props |
|
5256 |
||
5257 |
"Created: / 3.1.1998 / 14:25:22 / cg" |
|
5258 |
"Modified: / 4.1.1998 / 14:23:18 / cg" |
|
5259 |
! |
|
5260 |
||
5261 |
_System_setErr0:nativeContext |
|
5262 |
|stream| |
|
5263 |
||
5264 |
stream := nativeContext argAt:1. |
|
5265 |
||
5266 |
self setOpenFile:(self javaConsoleStream ? Stderr) at:2. |
|
5267 |
||
5268 |
nativeContext receiver instVarNamed:'err' put:stream. |
|
5269 |
||
5270 |
"Created: / 18.3.1997 / 15:02:05 / cg" |
|
5271 |
"Modified: / 4.1.1998 / 16:21:15 / cg" |
|
5272 |
! |
|
5273 |
||
5274 |
_System_setIn0:nativeContext |
|
5275 |
|stream| |
|
5276 |
||
5277 |
stream := nativeContext argAt:1. |
|
5278 |
||
5279 |
self setOpenFile:Stdin at:0. |
|
5280 |
||
5281 |
nativeContext receiver instVarNamed:'in' put:stream. |
|
5282 |
||
5283 |
"Created: / 4.1.1998 / 16:16:38 / cg" |
|
5284 |
"Modified: / 4.1.1998 / 16:20:44 / cg" |
|
5285 |
! |
|
5286 |
||
5287 |
_System_setOut0:nativeContext |
|
5288 |
|stream| |
|
5289 |
||
5290 |
stream := nativeContext argAt:1. |
|
5291 |
||
5292 |
self setOpenFile:(self javaConsoleStream ? Stdout) at:1. |
|
5293 |
||
5294 |
nativeContext receiver instVarNamed:'out' put:stream. |
|
5295 |
||
5296 |
"Created: / 4.1.1998 / 16:18:26 / cg" |
|
5297 |
"Modified: / 4.1.1998 / 16:20:23 / cg" |
|
5298 |
! |
|
5299 |
||
440 | 5300 |
_Thread_countStackFrames:nativeContext |
5301 |
"/ int countStackFrames () |
|
5302 |
UnimplementedNativeMethodSignal raise |
|
5303 |
||
5304 |
"Created: / 12.11.1998 / 19:06:21 / cg" |
|
5305 |
! |
|
5306 |
||
253 | 5307 |
_Thread_currentThread:nativeMethodContext |
5308 |
|t p prio| |
|
5309 |
||
5310 |
p := Processor activeProcess. |
|
5311 |
t := self javaThreadForSTProcess:p. |
|
5312 |
t notNil ifTrue:[ |
|
261 | 5313 |
^ t |
253 | 5314 |
]. |
5315 |
t := self newThread:'main'. |
|
5316 |
Java threads at:t put:p. |
|
5317 |
^ t |
|
5318 |
||
5319 |
"Created: / 3.1.1998 / 01:42:28 / cg" |
|
5320 |
"Modified: / 4.1.1998 / 14:59:13 / cg" |
|
5321 |
! |
|
5322 |
||
339 | 5323 |
_Thread_interrupt0:nativeContext |
5324 |
"ask if a thread is interrupted (clear interruptState if arg is true)" |
|
5325 |
||
5326 |
|jThread stProcess| |
|
5327 |
||
5328 |
jThread := nativeContext receiver. |
|
5329 |
stProcess := self stProcessForJavaThread:jThread. |
|
5330 |
stProcess isNil ifTrue:[ |
|
5331 |
self halt. |
|
5332 |
^ 0 |
|
5333 |
]. |
|
5334 |
||
5335 |
stProcess markInterrupted |
|
5336 |
||
5337 |
"Modified: / 2.1.1998 / 21:49:06 / cg" |
|
5338 |
"Created: / 10.4.1998 / 15:21:43 / cg" |
|
5339 |
! |
|
5340 |
||
253 | 5341 |
_Thread_isAlive:nativeContext |
5342 |
"is it alive ?" |
|
5343 |
||
5344 |
|jThread stProcess| |
|
5345 |
||
5346 |
jThread := nativeContext receiver. |
|
5347 |
stProcess := JavaVM stProcessForJavaThread:jThread. |
|
5348 |
stProcess isNil ifTrue:[ |
|
318 | 5349 |
ThreadTrace == true ifTrue:[ |
5350 |
('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL. |
|
5351 |
]. |
|
5352 |
^ 0 "FALSE" |
|
255 | 5353 |
]. |
5354 |
stProcess isDead ifTrue:[^ 0 "FALSE"]. |
|
5355 |
^ 1 "TRUE" |
|
5356 |
||
5357 |
"Created: / 5.1.1998 / 02:03:51 / cg" |
|
318 | 5358 |
"Modified: / 6.2.1998 / 02:15:01 / cg" |
255 | 5359 |
! |
5360 |
||
5361 |
_Thread_isInterrupted:nativeContext |
|
5362 |
"ask if a thread is interrupted (clear interruptState if arg is true)" |
|
5363 |
||
5364 |
|jThread stProcess clearInterrupt rslt| |
|
5365 |
||
5366 |
jThread := nativeContext receiver. |
|
5367 |
stProcess := self stProcessForJavaThread:jThread. |
|
5368 |
stProcess isNil ifTrue:[ |
|
261 | 5369 |
self halt. |
5370 |
^ 0 |
|
253 | 5371 |
]. |
255 | 5372 |
|
5373 |
clearInterrupt := nativeContext argAt:1. |
|
5374 |
rslt := stProcess isInterrupted ifTrue:[1] ifFalse:[0]. |
|
5375 |
clearInterrupt ~~ 0 ifTrue:[stProcess clearInterruptActions]. |
|
5376 |
^ rslt |
|
5377 |
||
5378 |
"Modified: / 2.1.1998 / 21:49:06 / cg" |
|
5379 |
"Created: / 7.1.1998 / 18:50:26 / cg" |
|
5380 |
! |
|
5381 |
||
5382 |
_Thread_resume0:nativeContext |
|
5383 |
"yield" |
|
5384 |
||
5385 |
|jThread stProcess| |
|
5386 |
||
5387 |
jThread := nativeContext receiver. |
|
5388 |
stProcess := JavaVM stProcessForJavaThread:jThread. |
|
5389 |
stProcess isNil ifTrue:[ |
|
318 | 5390 |
ThreadTrace == true ifTrue:[ |
5391 |
('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL. |
|
5392 |
]. |
|
5393 |
^ nil "void" |
|
255 | 5394 |
]. |
5395 |
stProcess resume |
|
5396 |
||
5397 |
"Created: / 8.1.1998 / 01:06:27 / cg" |
|
318 | 5398 |
"Modified: / 6.2.1998 / 02:15:08 / cg" |
253 | 5399 |
! |
5400 |
||
5401 |
_Thread_setPriority0:nativeMethodContext |
|
5402 |
|t p prio| |
|
5403 |
||
5404 |
t := nativeMethodContext receiver. |
|
5405 |
p := JavaVM stProcessForJavaThread:t. |
|
5406 |
prio := nativeMethodContext argAt:1. |
|
5407 |
||
5408 |
p isNil ifTrue:[ |
|
318 | 5409 |
ThreadTrace == true ifTrue:[ |
5410 |
'JAVA [info]: no process yet (in setPriority)' infoPrintCR. |
|
5411 |
]. |
|
5412 |
^ nil |
|
253 | 5413 |
]. |
5414 |
||
5415 |
ThreadTrace ifTrue:[ |
|
318 | 5416 |
'JAVA [info]: setPrio: ' print. t print. ' pri= ' print. prio print. ' p= ' print. p printNL. |
253 | 5417 |
]. |
5418 |
^ nil |
|
5419 |
||
5420 |
"Created: / 2.1.1998 / 19:05:55 / cg" |
|
318 | 5421 |
"Modified: / 6.2.1998 / 02:28:18 / cg" |
253 | 5422 |
! |
5423 |
||
255 | 5424 |
_Thread_sleep:nativeContext |
5425 |
"sleep for some milliseconds " |
|
5426 |
||
5427 |
|millis| |
|
5428 |
||
432 | 5429 |
millis := nativeContext argAt:1. |
5430 |
Delay waitForMilliseconds:(millis max:50) |
|
255 | 5431 |
|
5432 |
"Created: / 7.1.1998 / 15:34:23 / cg" |
|
432 | 5433 |
"Modified: / 10.11.1998 / 22:28:04 / cg" |
255 | 5434 |
! |
5435 |
||
253 | 5436 |
_Thread_start:nativeContext |
5437 |
"start the thread" |
|
5438 |
||
5439 |
|jThread jName name stProcess| |
|
5440 |
||
5441 |
jThread := nativeContext receiver. |
|
5442 |
(jThread instVarNamed:'priority') < 1 ifTrue:[ |
|
297 | 5443 |
self halt. |
5444 |
jThread instVarNamed:'priority' put:1. |
|
253 | 5445 |
]. |
5446 |
||
5447 |
stProcess := JavaProcess |
|
297 | 5448 |
for:[ |
405 | 5449 |
|procName| |
5450 |
||
5451 |
Object abortSignal handle:[:ex | |
|
5452 |
procName := stProcess name. |
|
483 | 5453 |
(procName startsWith:'JAVA-AWT-EventQueue') ifTrue:[ |
5454 |
('JAVA: thread ' , procName , ' aborted - restarting process.') infoPrintCR. |
|
5455 |
ex restart. |
|
5456 |
] ifFalse:[ |
|
5457 |
('JAVA: thread ' , procName , ' aborted.') infoPrintCR. |
|
5458 |
]. |
|
405 | 5459 |
] do:[ |
297 | 5460 |
[ |
5461 |
JavaVM javaExceptionSignal handle:[:ex | |
|
405 | 5462 |
|exClass| |
297 | 5463 |
|
5464 |
procName := stProcess name. |
|
5465 |
exClass := ex parameter class. |
|
5466 |
||
5467 |
exClass == (Java at:'java.lang.ThreadDeath') ifTrue:[ |
|
5468 |
('JAVA: thread ' , procName , ' terminated') infoPrintCR. |
|
5469 |
] ifFalse:[ |
|
5470 |
Transcript |
|
5471 |
showCR:('JAVA: thread ''' |
|
5472 |
, procName |
|
5473 |
, ''' terminated with exception: ' |
|
5474 |
, exClass name). |
|
5475 |
]. |
|
5476 |
ex return. |
|
5477 |
] do:[ |
|
5478 |
jThread perform:#'run()V'. |
|
316 | 5479 |
ThreadTrace == true ifTrue:[ |
5480 |
('JAVA: thread ' , stProcess name , ' terminated') infoPrintCR. |
|
5481 |
]. |
|
297 | 5482 |
jThread perform:#'exit()V'. |
316 | 5483 |
ThreadTrace == true ifTrue:[ |
5484 |
('JAVA: after exit of thread ' , stProcess name) infoPrintCR. |
|
5485 |
] |
|
297 | 5486 |
] |
5487 |
] valueNowOrOnUnwindDo:[ |
|
5488 |
Java threads removeKey:jThread ifAbsent:[]. |
|
5489 |
] |
|
405 | 5490 |
] |
297 | 5491 |
] |
5492 |
priority:(Processor activePriority). |
|
253 | 5493 |
|
5494 |
jName := jThread instVarNamed:'name'. |
|
5495 |
jName isString ifFalse:[ |
|
297 | 5496 |
name := Java as_ST_String:jName. |
253 | 5497 |
] ifTrue:[ |
297 | 5498 |
name := jName |
5499 |
]. |
|
5500 |
||
5501 |
"/ kludge - remember the ScreenUpdater ... |
|
5502 |
name = 'Screen Updater' ifTrue:[ |
|
5503 |
ScreenUpdaterProcess := stProcess. |
|
253 | 5504 |
]. |
5505 |
||
5506 |
"/ when that process terminates, wakup any waiters |
|
5507 |
stProcess addExitAction:[self wakeup:jThread]. |
|
5508 |
||
5509 |
stProcess name:'JAVA-' , name. |
|
5510 |
stProcess resume. |
|
5511 |
||
5512 |
Java threads at:jThread put:stProcess. |
|
5513 |
||
5514 |
^ nil |
|
5515 |
||
5516 |
"Created: / 3.1.1998 / 02:05:52 / cg" |
|
483 | 5517 |
"Modified: / 4.12.1998 / 17:29:55 / cg" |
255 | 5518 |
! |
5519 |
||
5520 |
_Thread_stop0:nativeContext |
|
5521 |
"terminate a thread" |
|
5522 |
||
5523 |
|jThread stProcess death| |
|
5524 |
||
5525 |
jThread := nativeContext receiver. |
|
5526 |
||
5527 |
stProcess := JavaVM stProcessForJavaThread:jThread. |
|
5528 |
stProcess isNil ifTrue:[ |
|
318 | 5529 |
ThreadTrace == true ifTrue:[ |
5530 |
('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL. |
|
5531 |
]. |
|
5532 |
^ nil "void" |
|
255 | 5533 |
]. |
5534 |
death := nativeContext argAt:1. |
|
5535 |
stProcess |
|
318 | 5536 |
interruptWith:[ |
5537 |
JavaVM javaExceptionSignal handle:[:ex | |
|
5538 |
Processor activeProcess terminate |
|
5539 |
] do:[ |
|
5540 |
ThreadTrace == true ifTrue:[ |
|
5541 |
('JAVA: thread exit: ' , jThread displayString) infoPrintNL. |
|
5542 |
]. |
|
5543 |
jThread perform:#'exit()V'. |
|
5544 |
self throwException:death. |
|
5545 |
] |
|
5546 |
]. |
|
255 | 5547 |
stProcess resume. |
5548 |
||
5549 |
[stProcess isDead] whileFalse:[ |
|
318 | 5550 |
stProcess resume. |
466 | 5551 |
'JavaVM: wait for death' infoPrintCR. |
318 | 5552 |
Delay waitForSeconds:0.1 |
255 | 5553 |
]. |
5554 |
stProcess terminate |
|
5555 |
||
5556 |
"Created: / 8.1.1998 / 13:11:17 / cg" |
|
466 | 5557 |
"Modified: / 25.11.1998 / 20:21:19 / cg" |
255 | 5558 |
! |
5559 |
||
5560 |
_Thread_suspend0:nativeContext |
|
5561 |
"yield" |
|
5562 |
||
5563 |
|jThread stProcess| |
|
5564 |
||
5565 |
jThread := nativeContext receiver. |
|
5566 |
stProcess := JavaVM stProcessForJavaThread:jThread. |
|
5567 |
stProcess isNil ifTrue:[ |
|
318 | 5568 |
ThreadTrace == true ifTrue:[ |
5569 |
('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL. |
|
5570 |
]. |
|
5571 |
^ nil "void" |
|
255 | 5572 |
]. |
5573 |
stProcess suspend |
|
5574 |
||
5575 |
"Created: / 8.1.1998 / 01:05:49 / cg" |
|
318 | 5576 |
"Modified: / 6.2.1998 / 02:15:23 / cg" |
255 | 5577 |
! |
5578 |
||
5579 |
_Thread_yield:nativeContext |
|
5580 |
"yield" |
|
5581 |
||
5582 |
|jThread stProcess| |
|
5583 |
||
5584 |
jThread := nativeContext receiver. |
|
5585 |
stProcess := JavaVM stProcessForJavaThread:jThread. |
|
5586 |
stProcess isNil ifTrue:[ |
|
318 | 5587 |
ThreadTrace == true ifTrue:[ |
5588 |
('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL. |
|
5589 |
]. |
|
5590 |
^ nil "void" |
|
255 | 5591 |
]. |
5592 |
stProcess == Processor activeProcess ifTrue:[ |
|
318 | 5593 |
Processor yield. |
255 | 5594 |
] ifFalse:[ |
318 | 5595 |
self halt. |
255 | 5596 |
]. |
5597 |
||
5598 |
"Created: / 5.1.1998 / 02:03:51 / cg" |
|
318 | 5599 |
"Modified: / 6.2.1998 / 02:15:29 / cg" |
253 | 5600 |
! |
5601 |
||
5602 |
_Throwable_fillInStackTrace:nativeContext |
|
255 | 5603 |
|exClass exceptionObject list con| |
253 | 5604 |
|
5605 |
exClass := Java classNamed:'java.lang.Throwable'. |
|
5606 |
||
5607 |
exceptionObject := nativeContext receiver. |
|
5608 |
||
5609 |
"/ |
|
5610 |
"/ debugging only |
|
5611 |
"/ |
|
5612 |
(exceptionObject isKindOf:(Java classNamed:'java.lang.Throwable')) ifFalse:[ |
|
347 | 5613 |
self halt |
253 | 5614 |
]. |
5615 |
||
5616 |
con := thisContext sender. |
|
5617 |
||
5618 |
"/ |
|
5619 |
"/ we are not interrested in all intermediate Exception frames ... |
|
5620 |
"/ |
|
5621 |
FullExceptionTrace ifFalse:[ |
|
347 | 5622 |
"/ first, skip any JavaVM contexts |
5623 |
[con receiver == exceptionObject] whileFalse:[ |
|
5624 |
con := con sender |
|
5625 |
]. |
|
5626 |
"/ then, all exception-init contexts |
|
5627 |
[con receiver == exceptionObject] whileTrue:[ |
|
5628 |
con := con sender |
|
5629 |
]. |
|
253 | 5630 |
]. |
5631 |
||
255 | 5632 |
list := OrderedCollection new. |
5633 |
[con notNil] whileTrue:[ |
|
347 | 5634 |
(con isJavaContext) ifTrue:[ |
5635 |
"/ add a copy, in case the context continues with some |
|
5636 |
"/ cleanup ... |
|
5637 |
list add:con shallowCopy |
|
5638 |
]. |
|
5639 |
con := con sender |
|
255 | 5640 |
]. |
5641 |
||
5642 |
exceptionObject instVarNamed:'backtrace' put:(list asArray). |
|
253 | 5643 |
|
5644 |
^ nil. |
|
5645 |
||
5646 |
"Created: / 4.1.1998 / 14:27:40 / cg" |
|
347 | 5647 |
"Modified: / 8.5.1998 / 21:29:53 / cg" |
255 | 5648 |
! |
5649 |
||
5650 |
_Throwable_printStackTrace0:nativeContext |
|
261 | 5651 |
|out outStream exceptionObject contextList| |
255 | 5652 |
|
5653 |
outStream := nativeContext argAt:1. |
|
5654 |
exceptionObject := nativeContext receiver. |
|
5655 |
||
5656 |
contextList := exceptionObject instVarNamed:'backtrace'. |
|
5657 |
||
261 | 5658 |
out := self javaConsoleStream. |
5659 |
out cr. |
|
5660 |
out nextPutLine:'JAVA: stackTrace:'. |
|
255 | 5661 |
|
5662 |
contextList do:[:con | |
|
429 | 5663 |
out |
5664 |
nextPutAll:' '; |
|
5665 |
nextPutAll:(con method javaClass fullName); |
|
5666 |
nextPutAll:'.'; |
|
5667 |
nextPutAll:(con method selector); |
|
5668 |
nextPutAll:' ['; |
|
5669 |
nextPutAll:(con method javaClass sourceFile); |
|
5670 |
nextPutAll:' '; |
|
5671 |
nextPutAll:(con quickLineNumber displayString); |
|
5672 |
nextPutAll:']'. |
|
5673 |
out cr |
|
261 | 5674 |
]. |
5675 |
out nextPutLine:'----------------------------------------------------' |
|
255 | 5676 |
|
5677 |
"Created: / 4.1.1998 / 14:27:40 / cg" |
|
429 | 5678 |
"Modified: / 10.11.1998 / 14:19:32 / cg" |
432 | 5679 |
! |
5680 |
||
5681 |
_Win32Process_create:nativeContext |
|
5682 |
"really create a win32 process" |
|
5683 |
||
5684 |
|env cmd jProcess p inPipe outPipe errorPipe| |
|
5685 |
||
5686 |
jProcess := nativeContext receiver. |
|
5687 |
cmd := nativeContext argAt:1. |
|
5688 |
cmd := Java as_ST_String:cmd. |
|
5689 |
||
5690 |
env := nativeContext argAt:2. |
|
5691 |
env notNil ifTrue:[ |
|
5692 |
self halt |
|
5693 |
]. |
|
5694 |
self halt. |
|
5695 |
||
5696 |
p := Win32Process new. |
|
5697 |
p command:cmd. |
|
5698 |
p environment:env. |
|
5699 |
p inStream:inPipe. |
|
5700 |
p outStream:outPipe. |
|
5701 |
p errorStream:errorPipe. |
|
5702 |
p directory:nil. |
|
5703 |
p startProcess. |
|
5704 |
self halt. |
|
5705 |
||
5706 |
jProcess instVarNamed:'handle' put:p. |
|
5707 |
||
5708 |
"Created: / 10.11.1998 / 19:50:31 / cg" |
|
5709 |
"Modified: / 10.11.1998 / 21:34:18 / cg" |
|
255 | 5710 |
! ! |
5711 |
||
277 | 5712 |
!JavaVM class methodsFor:'native - java.lang - jdk1.2'! |
5713 |
||
5714 |
_AccessController_beginPrivileged:nativeContext |
|
5715 |
"/ introduced with jdk1.2 |
|
5716 |
||
5717 |
"Created: / 27.1.1998 / 18:18:11 / cg" |
|
5718 |
! |
|
5719 |
||
5720 |
_AccessController_endPrivileged:nativeContext |
|
5721 |
"/ introduced with jdk1.2 |
|
5722 |
||
5723 |
"Created: / 27.1.1998 / 18:18:32 / cg" |
|
5724 |
! |
|
5725 |
||
5726 |
_AccessController_getStackAccessControlContext:nativeContext |
|
5727 |
"/ introduced with jdk1.2 |
|
5728 |
||
5729 |
"/ supposed to do more here ... |
|
5730 |
||
5731 |
^ nil |
|
5732 |
||
5733 |
"Created: / 27.1.1998 / 18:22:15 / cg" |
|
5734 |
! |
|
5735 |
||
5736 |
_ClassLoader$NativeLibrary_load:nativeContext |
|
5737 |
"/ introduced with jdk1.2 ... (sigh) |
|
5738 |
||
5739 |
|nativeLoader jLibName libName libHandle index| |
|
5740 |
||
5741 |
nativeLoader := nativeContext receiver. |
|
5742 |
jLibName := nativeContext argAt:1. |
|
5743 |
libName := Java as_ST_String:jLibName. |
|
5744 |
||
5745 |
(index := SimulatedNativeLibs indexOf:libName) ~~ 0 ifTrue:[ |
|
319 | 5746 |
"/ ('JAVA: builtIn nativeLibLoad simulated: ' , libName) printNL. |
277 | 5747 |
nativeLoader instVarNamed:'handle' put:index. |
5748 |
^ self "/ void |
|
5749 |
]. |
|
5750 |
(LoadedNativeLibs notNil |
|
5751 |
and:[LoadedNativeLibs includesKey:libName]) ifTrue:[ |
|
319 | 5752 |
"/ ('JAVA: native library already loaded: ' , libName) printNL. |
277 | 5753 |
nativeLoader instVarNamed:'handle' put:(LoadedNativeLibs at:libName). |
5754 |
^ self "/ void |
|
5755 |
]. |
|
319 | 5756 |
|
5757 |
(self confirm:'permission to load native library: ' , libName , ' ?') ifFalse:[ |
|
5758 |
^ self |
|
5759 |
]. |
|
284 | 5760 |
self halt. |
277 | 5761 |
|
5762 |
libName asFilename exists ifFalse:[ |
|
5763 |
('JAVA: no file to load nativeLib: ' , libName) printNL. |
|
5764 |
^ self "/ void |
|
5765 |
]. |
|
5766 |
||
5767 |
libHandle := ObjectFileLoader loadLibrary:libName. |
|
5768 |
libHandle isNil ifTrue:[ |
|
5769 |
('JAVA: failed to load nativeLib: ' , libName) printNL. |
|
5770 |
^ self "/ void |
|
5771 |
]. |
|
5772 |
||
5773 |
LoadedNativeLibs isNil ifTrue:[ |
|
5774 |
LoadedNativeLibs := Dictionary new. |
|
5775 |
]. |
|
5776 |
||
5777 |
LoadedNativeLibs at:libName put:libHandle. |
|
5778 |
nativeLoader instVarNamed:'handle' put:(LoadedNativeLibs at:libName). |
|
5779 |
^ self "/ void |
|
5780 |
||
5781 |
"Created: / 27.1.1998 / 18:38:37 / cg" |
|
319 | 5782 |
"Modified: / 6.2.1998 / 03:12:17 / cg" |
277 | 5783 |
! |
5784 |
||
5785 |
_ClassLoader_initIDs:nativeContext |
|
5786 |
"/ introduced with jdk1.2 ... (sigh) |
|
5787 |
||
5788 |
"Created: / 27.1.1998 / 18:37:08 / cg" |
|
5789 |
! |
|
5790 |
||
5791 |
_Component_initIDs:nativeContext |
|
5792 |
"/ introduced with jdk1.2 ... (sigh) |
|
5793 |
||
5794 |
"Created: / 27.1.1998 / 19:53:29 / cg" |
|
5795 |
! |
|
5796 |
||
5797 |
_System_getCallerClass:nativeContext |
|
5798 |
"/ introduced with jdk1.2 |
|
5799 |
||
5800 |
|senderContext cls| |
|
5801 |
||
5802 |
senderContext := nativeContext sender. |
|
5803 |
[senderContext receiver == (Java at:'java.lang.System')] whileTrue:[ |
|
5804 |
senderContext := senderContext sender. |
|
5805 |
]. |
|
5806 |
||
5807 |
senderContext method isStatic ifTrue:[ |
|
5808 |
cls := senderContext receiver |
|
5809 |
] ifFalse:[ |
|
5810 |
cls := senderContext receiver class |
|
5811 |
]. |
|
5812 |
cls isJavaClass ifTrue:[ |
|
5813 |
^ self javaClassObjectForClass:cls |
|
5814 |
]. |
|
5815 |
(cls isMemberOf:(Java at:'java.lang.Class')) ifTrue:[ |
|
5816 |
^ Java at:'java.lang.Class' |
|
5817 |
]. |
|
5818 |
self halt. |
|
5819 |
^ nil |
|
5820 |
||
5821 |
"Modified: / 27.1.1998 / 18:33:13 / cg" |
|
5822 |
! |
|
5823 |
||
5824 |
_Toolkit_initIDs:nativeContext |
|
5825 |
"/ introduced with jdk1.2 ... (sigh) |
|
5826 |
||
5827 |
"Created: / 27.1.1998 / 19:53:50 / cg" |
|
5828 |
! ! |
|
5829 |
||
457 | 5830 |
!JavaVM class methodsFor:'native - java.lang - ms'! |
5831 |
||
5832 |
_Runtime_setInputStreamLocalised:nativeContext |
|
5833 |
||
5834 |
"Created: / 18.11.1998 / 00:48:24 / cg" |
|
5835 |
"Modified: / 18.11.1998 / 00:55:01 / cg" |
|
5836 |
! |
|
5837 |
||
5838 |
_Runtime_setOutputStreamLocalised:nativeContext |
|
5839 |
||
5840 |
"Created: / 18.11.1998 / 00:50:15 / cg" |
|
5841 |
"Modified: / 18.11.1998 / 00:55:06 / cg" |
|
5842 |
! |
|
5843 |
||
5844 |
_String_equals:nativeContext |
|
5845 |
|jString1 jString2| |
|
5846 |
||
5847 |
jString1 := nativeContext receiver. |
|
5848 |
jString2 := nativeContext argAt:1. |
|
5849 |
^ (jString1 instVarAt:1) = (jString2 instVarAt:1) |
|
5850 |
||
5851 |
"Created: / 18.11.1998 / 00:52:03 / cg" |
|
5852 |
"Modified: / 18.11.1998 / 00:53:01 / cg" |
|
5853 |
! |
|
5854 |
||
5855 |
_String_length:nativeContext |
|
5856 |
|jString| |
|
5857 |
||
5858 |
jString := nativeContext receiver. |
|
5859 |
^ (jString instVarAt:3) |
|
5860 |
||
5861 |
"Created: / 18.11.1998 / 00:53:50 / cg" |
|
5862 |
"Modified: / 18.11.1998 / 00:54:18 / cg" |
|
5863 |
! ! |
|
5864 |
||
255 | 5865 |
!JavaVM class methodsFor:'native - java.math'! |
5866 |
||
5867 |
_BigInteger_plumbInit:nativeContext |
|
440 | 5868 |
UnimplementedNativeMethodSignal raise |
5869 |
||
5870 |
"Modified: / 12.11.1998 / 19:23:00 / cg" |
|
253 | 5871 |
! ! |
5872 |
||
5873 |
!JavaVM class methodsFor:'native - java.net'! |
|
5874 |
||
440 | 5875 |
_InetAddressImpl_getHostByAddr:nativeContext |
5876 |
"/ java.lang.String getHostByAddr (int) |
|
5877 |
UnimplementedNativeMethodSignal raise |
|
5878 |
||
5879 |
"Created: / 12.11.1998 / 19:08:04 / cg" |
|
5880 |
! |
|
5881 |
||
253 | 5882 |
_InetAddressImpl_getInetFamily:nativeContext |
5883 |
"/ self unimplementedNativeMethod. |
|
5884 |
^ 0 |
|
5885 |
||
5886 |
"Modified: / 15.8.1997 / 17:04:43 / cg" |
|
5887 |
"Created: / 5.1.1998 / 02:05:48 / cg" |
|
5888 |
! |
|
5889 |
||
5890 |
_InetAddressImpl_getLocalHostName:nativeContext |
|
5891 |
"" |
|
5892 |
||
5893 |
|hostName| |
|
5894 |
||
5895 |
hostName := OperatingSystem getHostName. |
|
5896 |
||
5897 |
^ (Java as_String:hostName). |
|
5898 |
||
5899 |
"Modified: / 7.8.1997 / 21:16:55 / cg" |
|
5900 |
"Created: / 5.1.1998 / 02:07:03 / cg" |
|
5901 |
! |
|
5902 |
||
255 | 5903 |
_InetAddressImpl_lookupAllHostAddr:nativeContext |
5904 |
"" |
|
5905 |
||
5906 |
|jAddrImpl jHostName hostName addrBytes| |
|
5907 |
||
5908 |
jAddrImpl := nativeContext receiver. |
|
5909 |
jHostName := nativeContext argAt:1. |
|
5910 |
||
5911 |
hostName := Java as_ST_String:jHostName. |
|
5912 |
addrBytes := Socket ipAddressOfHost:hostName. |
|
5913 |
addrBytes isNil ifTrue:[ |
|
261 | 5914 |
addrBytes := #[0 0 0 0] copy |
255 | 5915 |
]. |
5916 |
^ Array with:addrBytes |
|
5917 |
||
5918 |
"Modified: / 8.8.1997 / 12:04:25 / cg" |
|
5919 |
"Created: / 7.1.1998 / 18:51:31 / cg" |
|
5920 |
! |
|
5921 |
||
253 | 5922 |
_InetAddressImpl_makeAnyLocalAddress:nativeContext |
5923 |
"" |
|
5924 |
||
5925 |
|jAddrImpl jAddr hostName addrBytes address| |
|
5926 |
||
5927 |
jAddrImpl := nativeContext receiver. |
|
5928 |
jAddr := nativeContext argAt:1. |
|
5929 |
||
5930 |
hostName := OperatingSystem getHostName. |
|
5931 |
addrBytes := Socket ipAddressOfHost:hostName. |
|
405 | 5932 |
addrBytes isNil ifTrue:[ |
5933 |
addrBytes := #[127 0 0 0]. |
|
5934 |
]. |
|
253 | 5935 |
"/ MSB first into an integer. |
5936 |
address := (addrBytes at:1). |
|
5937 |
address := (address bitShift:8) bitOr:(addrBytes at:2). |
|
5938 |
address := (address bitShift:8) bitOr:(addrBytes at:3). |
|
5939 |
address := (address bitShift:8) bitOr:(addrBytes at:4). |
|
5940 |
||
5941 |
jAddr instVarNamed:'hostName' put:(Java as_String:hostName). |
|
5942 |
jAddr instVarNamed:'address' put:address. |
|
5943 |
jAddr instVarNamed:'family' put:0. |
|
5944 |
||
5945 |
^ nil |
|
5946 |
||
5947 |
"Created: / 5.1.1998 / 02:06:27 / cg" |
|
405 | 5948 |
"Modified: / 21.10.1998 / 03:30:29 / cg" |
255 | 5949 |
! |
5950 |
||
5951 |
_PlainSocketImpl_initProto:nativeContext |
|
5952 |
||
5953 |
"Created: / 12.1.1998 / 12:56:52 / cg" |
|
271 | 5954 |
! |
5955 |
||
307 | 5956 |
_PlainSocketImpl_socketAccept:nativeContext |
5957 |
|jsock fd newJSock sock newSock fileNo| |
|
5958 |
||
5959 |
jsock := nativeContext receiver. |
|
5960 |
||
5961 |
sock := self validateFile:jsock. |
|
5962 |
sock isNil ifTrue:[ |
|
5963 |
self |
|
5964 |
throwExceptionClassName:'java.io.IOException' |
|
5965 |
withMessage:'nil socket in accept'. |
|
5966 |
^ self. |
|
5967 |
]. |
|
5968 |
||
5969 |
newJSock := nativeContext argAt:1. |
|
5970 |
fd := newJSock instVarNamed:'fd'. |
|
5971 |
(fd instVarNamed:'fd') ~~ 0 ifTrue:[ |
|
5972 |
self halt:'file already open'. |
|
5973 |
self internalError:'file already open'. |
|
5974 |
self |
|
5975 |
throwExceptionClassName:'java.io.IOException' |
|
5976 |
withMessage:'socket already open in socketAccept'. |
|
5977 |
^ self. |
|
5978 |
]. |
|
5979 |
FileIOTrace ifTrue:[ |
|
5980 |
'JAVA: socket accept' infoPrintCR |
|
5981 |
]. |
|
5982 |
newSock := sock accept. |
|
5983 |
newSock isNil ifTrue:[ |
|
5984 |
self |
|
5985 |
throwExceptionClassName:'java.io.IOException' |
|
5986 |
withMessage:'accept failed'. |
|
5987 |
]. |
|
5988 |
fileNo := self addOpenFile:newSock. |
|
5989 |
fd instVarNamed:'fd' put:fileNo. |
|
5990 |
||
5991 |
"Created: / 4.2.1998 / 15:26:49 / cg" |
|
5992 |
"Modified: / 4.2.1998 / 15:45:20 / cg" |
|
5993 |
! |
|
5994 |
||
5995 |
_PlainSocketImpl_socketAvailable:nativeContext |
|
5996 |
|jSock sock n| |
|
5997 |
||
5998 |
jSock := nativeContext receiver. |
|
5999 |
||
6000 |
sock := self validateFile:jSock. |
|
6001 |
sock isNil ifTrue:[ |
|
6002 |
self |
|
6003 |
throwExceptionClassName:'java.io.IOException' |
|
6004 |
withMessage:'socketAvailable on closed socket'. |
|
6005 |
^ self. |
|
6006 |
]. |
|
6007 |
||
6008 |
n := sock numAvailable. |
|
6009 |
^ n |
|
6010 |
||
6011 |
"Created: / 4.2.1998 / 16:58:49 / cg" |
|
6012 |
! |
|
6013 |
||
6014 |
_PlainSocketImpl_socketBind:nativeContext |
|
6015 |
|jsock jaddr port sock hostName ok err| |
|
6016 |
||
6017 |
jsock := nativeContext receiver. |
|
6018 |
jaddr := nativeContext argAt:1. |
|
6019 |
port := nativeContext argAt:2. |
|
6020 |
||
6021 |
hostName := jaddr instVarNamed:'hostName'. |
|
6022 |
hostName isNil ifTrue:[ |
|
6023 |
self halt. |
|
6024 |
] ifFalse:[ |
|
6025 |
hostName := Java as_ST_String:hostName |
|
6026 |
]. |
|
6027 |
||
6028 |
sock := self validateFile:jsock. |
|
6029 |
sock notNil ifTrue:[ |
|
6030 |
FileIOTrace ifTrue:[ |
|
6031 |
('JAVA: socket bind to ' , hostName printString, ' port ' , port printString) infoPrintCR |
|
6032 |
]. |
|
6033 |
||
6034 |
ok := sock bindTo:port address:nil "hostName". |
|
6035 |
ok ifFalse:[ |
|
6036 |
err := OperatingSystem lastErrorString. |
|
6037 |
Transcript showCR:'sock err: ' , err printString. |
|
6038 |
self |
|
6039 |
throwExceptionClassName:'java.io.IOException' |
|
6040 |
withMessage:'bind failed'. |
|
6041 |
] |
|
6042 |
]. |
|
6043 |
||
6044 |
"Created: / 4.2.1998 / 15:06:20 / cg" |
|
6045 |
"Modified: / 4.2.1998 / 15:34:08 / cg" |
|
6046 |
! |
|
6047 |
||
271 | 6048 |
_PlainSocketImpl_socketClose:nativeContext |
6049 |
|jsock sock| |
|
6050 |
||
6051 |
jsock := nativeContext receiver. |
|
6052 |
||
6053 |
sock := self validateFile:jsock. |
|
6054 |
sock notNil ifTrue:[ |
|
6055 |
FileIOTrace ifTrue:[ |
|
6056 |
'JAVA: close socket' infoPrintCR |
|
6057 |
]. |
|
6058 |
sock close. |
|
6059 |
]. |
|
6060 |
||
6061 |
"Modified: / 21.8.1997 / 17:09:40 / cg" |
|
6062 |
"Created: / 25.1.1998 / 20:04:24 / cg" |
|
6063 |
! |
|
6064 |
||
6065 |
_PlainSocketImpl_socketConnect:nativeContext |
|
272 | 6066 |
|jsock jaddr port sock addr hostName ok| |
271 | 6067 |
|
6068 |
jsock := nativeContext receiver. |
|
6069 |
jaddr := nativeContext argAt:1. |
|
6070 |
port := nativeContext argAt:2. |
|
6071 |
||
6072 |
hostName := jaddr instVarNamed:'hostName'. |
|
6073 |
hostName notNil ifTrue:[ |
|
6074 |
hostName := Java as_ST_String:hostName |
|
6075 |
] ifFalse:[ |
|
272 | 6076 |
addr := jaddr instVarNamed:'address'. |
6077 |
addr notNil ifTrue:[ |
|
6078 |
hostName := ByteArray new:4. |
|
6079 |
hostName at:4 put:(addr bitAnd:16rFF). |
|
6080 |
addr := addr bitShift:-8. |
|
6081 |
hostName at:3 put:(addr bitAnd:16rFF). |
|
6082 |
addr := addr bitShift:-8. |
|
6083 |
hostName at:2 put:(addr bitAnd:16rFF). |
|
6084 |
addr := addr bitShift:-8. |
|
6085 |
hostName at:1 put:(addr bitAnd:16rFF). |
|
6086 |
]. |
|
271 | 6087 |
]. |
6088 |
hostName isNil ifTrue:[ |
|
6089 |
self halt. |
|
6090 |
]. |
|
6091 |
||
6092 |
sock := self validateFile:jsock. |
|
6093 |
sock notNil ifTrue:[ |
|
6094 |
FileIOTrace ifTrue:[ |
|
6095 |
('JAVA: socket connect to ' , hostName printString , ' port ' , port printString) infoPrintCR |
|
6096 |
]. |
|
390 | 6097 |
SocketConnectConfirmation ifTrue:[ |
6098 |
(self confirm:'connect to host: ' , hostName printString , ' - ok ?') |
|
6099 |
ifFalse:[ |
|
6100 |
self |
|
6101 |
throwExceptionClassName:'java.io.IOException' |
|
6102 |
withMessage:'connect permission denied'. |
|
6103 |
]. |
|
271 | 6104 |
]. |
6105 |
||
6106 |
ok := sock connectTo:hostName port:port. |
|
6107 |
ok ifFalse:[ |
|
6108 |
self |
|
6109 |
throwExceptionClassName:'java.io.IOException' |
|
6110 |
withMessage:'connect failed'. |
|
6111 |
] |
|
6112 |
]. |
|
6113 |
||
6114 |
"Created: / 25.1.1998 / 20:02:27 / cg" |
|
390 | 6115 |
"Modified: / 19.10.1998 / 16:24:48 / cg" |
271 | 6116 |
! |
6117 |
||
6118 |
_PlainSocketImpl_socketCreate:nativeContext |
|
6119 |
|jsock isStream fd sock fileNo| |
|
6120 |
||
6121 |
jsock := nativeContext receiver. |
|
6122 |
isStream := (nativeContext argAt:1) == 1. |
|
6123 |
||
6124 |
fd := jsock instVarNamed:'fd'. |
|
6125 |
(fd instVarNamed:'fd') ~~ 0 ifTrue:[ |
|
6126 |
self halt:'file already open'. |
|
6127 |
self internalError:'file already open'. |
|
6128 |
self |
|
6129 |
throwExceptionClassName:'java.io.IOException' |
|
6130 |
withMessage:'file already open in socketCreate'. |
|
6131 |
^ self. |
|
6132 |
]. |
|
6133 |
||
6134 |
FileOpenTrace ifTrue:[ |
|
6135 |
('JAVA: create socket') infoPrintCR. |
|
6136 |
]. |
|
6137 |
||
6138 |
isStream ifTrue:[ |
|
6139 |
sock := Socket newTCP |
|
6140 |
] ifFalse:[ |
|
6141 |
sock := Socket newUDP |
|
6142 |
]. |
|
6143 |
sock isNil ifTrue:[ |
|
6144 |
self |
|
6145 |
throwExceptionClassName:'java.io.IOException' |
|
6146 |
withMessage:'socketCreate failed'. |
|
6147 |
]. |
|
6148 |
||
6149 |
fileNo := self addOpenFile:sock. |
|
6150 |
fd instVarNamed:'fd' put:fileNo. |
|
6151 |
||
6152 |
"Created: / 25.1.1998 / 19:59:25 / cg" |
|
6153 |
"Modified: / 25.1.1998 / 19:59:45 / cg" |
|
272 | 6154 |
! |
6155 |
||
307 | 6156 |
_PlainSocketImpl_socketListen:nativeContext |
6157 |
|jSock time sock ok| |
|
6158 |
||
6159 |
jSock := nativeContext receiver. |
|
6160 |
time := nativeContext argAt:1. |
|
6161 |
||
6162 |
sock := self validateFile:jSock. |
|
6163 |
sock notNil ifTrue:[ |
|
6164 |
FileIOTrace ifTrue:[ |
|
6165 |
('JAVA: socket listen with timeout ' , time printString) infoPrintCR. |
|
6166 |
]. |
|
6167 |
ok := sock listenWithBacklog:5. |
|
6168 |
ok ifFalse:[ |
|
6169 |
self |
|
6170 |
throwExceptionClassName:'java.io.IOException' |
|
6171 |
withMessage:'listen failed'. |
|
6172 |
^ self. |
|
6173 |
]. |
|
6174 |
time ~~ 0 ifTrue:[ |
|
6175 |
sock readWaitWithTimeoutMs:time |
|
6176 |
] |
|
6177 |
]. |
|
6178 |
||
6179 |
"Created: / 4.2.1998 / 15:17:48 / cg" |
|
6180 |
"Modified: / 4.2.1998 / 15:18:26 / cg" |
|
6181 |
! |
|
6182 |
||
272 | 6183 |
_SocketInputStream_socketRead:nativeContext |
307 | 6184 |
^ self anyStream_readBytes:nativeContext |
272 | 6185 |
|
6186 |
"Created: / 25.1.1998 / 20:56:53 / cg" |
|
307 | 6187 |
"Modified: / 4.2.1998 / 15:52:31 / cg" |
272 | 6188 |
! |
6189 |
||
6190 |
_SocketOutputStream_socketWrite:nativeContext |
|
307 | 6191 |
^ self anyStream_writeBytes:nativeContext |
272 | 6192 |
|
6193 |
"Created: / 25.1.1998 / 21:06:55 / cg" |
|
307 | 6194 |
"Modified: / 4.2.1998 / 15:52:40 / cg" |
253 | 6195 |
! ! |
6196 |
||
457 | 6197 |
!JavaVM class methodsFor:'native - java.net - ms'! |
6198 |
||
6199 |
_ClassLoader_findSystemClass:nativeContext |
|
6200 |
^ self _ClassLoader_findSystemClass0:nativeContext |
|
6201 |
||
6202 |
"Created: / 18.11.1998 / 00:00:14 / cg" |
|
6203 |
! |
|
6204 |
||
6205 |
_InetAddress_getInetFamily:nativeContext |
|
6206 |
"/ self unimplementedNativeMethod. |
|
6207 |
^ 0 |
|
6208 |
||
6209 |
"Modified: / 15.8.1997 / 17:04:43 / cg" |
|
6210 |
"Created: / 17.11.1998 / 23:54:38 / cg" |
|
6211 |
! |
|
6212 |
||
6213 |
_InetAddress_getLocalHostName:nativeContext |
|
6214 |
"" |
|
6215 |
||
6216 |
|hostName| |
|
6217 |
||
6218 |
hostName := OperatingSystem getHostName. |
|
6219 |
||
6220 |
^ (Java as_String:hostName). |
|
6221 |
||
6222 |
"Modified: / 7.8.1997 / 21:16:55 / cg" |
|
6223 |
"Created: / 17.11.1998 / 23:54:54 / cg" |
|
6224 |
! |
|
6225 |
||
6226 |
_InetAddress_lookupAllHostAddr:nativeContext |
|
6227 |
"" |
|
6228 |
||
6229 |
|jAddrImpl jHostName hostName addrBytes| |
|
6230 |
||
6231 |
jAddrImpl := nativeContext receiver. |
|
6232 |
jHostName := nativeContext argAt:1. |
|
6233 |
||
6234 |
hostName := Java as_ST_String:jHostName. |
|
6235 |
addrBytes := Socket ipAddressOfHost:hostName. |
|
6236 |
addrBytes isNil ifTrue:[ |
|
6237 |
addrBytes := #[0 0 0 0] copy |
|
6238 |
]. |
|
6239 |
^ Array with:addrBytes |
|
6240 |
||
6241 |
"Modified: / 8.8.1997 / 12:04:25 / cg" |
|
6242 |
"Created: / 17.11.1998 / 23:56:10 / cg" |
|
6243 |
! |
|
6244 |
||
6245 |
_InetAddress_makeAnyLocalAddress:nativeContext |
|
6246 |
"" |
|
6247 |
||
6248 |
|jAddrImpl jAddr hostName addrBytes address| |
|
6249 |
||
6250 |
jAddrImpl := nativeContext receiver. |
|
6251 |
jAddr := nativeContext argAt:1. |
|
6252 |
||
6253 |
hostName := OperatingSystem getHostName. |
|
6254 |
addrBytes := Socket ipAddressOfHost:hostName. |
|
6255 |
addrBytes isNil ifTrue:[ |
|
6256 |
addrBytes := #[127 0 0 0]. |
|
6257 |
]. |
|
6258 |
"/ MSB first into an integer. |
|
6259 |
address := (addrBytes at:1). |
|
6260 |
address := (address bitShift:8) bitOr:(addrBytes at:2). |
|
6261 |
address := (address bitShift:8) bitOr:(addrBytes at:3). |
|
6262 |
address := (address bitShift:8) bitOr:(addrBytes at:4). |
|
6263 |
||
6264 |
jAddr instVarNamed:'hostName' put:(Java as_String:hostName). |
|
6265 |
jAddr instVarNamed:'address' put:address. |
|
6266 |
jAddr instVarNamed:'family' put:0. |
|
6267 |
||
6268 |
^ nil |
|
6269 |
||
6270 |
"Modified: / 21.10.1998 / 03:30:29 / cg" |
|
6271 |
"Created: / 17.11.1998 / 23:54:00 / cg" |
|
6272 |
! ! |
|
6273 |
||
253 | 6274 |
!JavaVM class methodsFor:'native - java.utils'! |
6275 |
||
6276 |
_ResourceBundle_getClassContext:nativeContext |
|
6277 |
"returns an array filled with the contextChain receivers classes. |
|
6278 |
What an ugly, messy interface." |
|
6279 |
||
6280 |
|chain con cls jClass| |
|
6281 |
||
6282 |
chain := OrderedCollection new. |
|
6283 |
con := thisContext sender. |
|
6284 |
[con notNil] whileTrue:[ |
|
347 | 6285 |
(con isJavaContext) ifTrue:[ |
6286 |
cls := con receiver class. |
|
6287 |
cls isMeta ifTrue:[ |
|
6288 |
"/ t'was a static method |
|
6289 |
cls := cls soleInstance |
|
6290 |
]. |
|
6291 |
jClass := JavaClasses at:cls ifAbsent:nil. |
|
6292 |
jClass isNil ifTrue:[ |
|
6293 |
JavaClasses at:cls put:(jClass := (Java at:'java.lang.Class') new). |
|
6294 |
JavaClasses at:jClass put:cls. |
|
6295 |
]. |
|
6296 |
chain add:jClass. |
|
6297 |
]. |
|
6298 |
con := con sender. |
|
253 | 6299 |
]. |
6300 |
^ chain asArray |
|
6301 |
||
6302 |
"Created: / 5.1.1998 / 02:47:00 / cg" |
|
347 | 6303 |
"Modified: / 8.5.1998 / 21:29:57 / cg" |
253 | 6304 |
! ! |
6305 |
||
304 | 6306 |
!JavaVM class methodsFor:'native - java.utils.zip'! |
6307 |
||
6308 |
_Inflater_init:nativeContext |
|
6309 |
||
6310 |
"Created: / 1.2.1998 / 20:14:01 / cg" |
|
6311 |
! |
|
6312 |
||
6313 |
_Inflater_reset:nativeContext |
|
6314 |
||
6315 |
"Created: / 1.2.1998 / 20:14:13 / cg" |
|
6316 |
! ! |
|
6317 |
||
255 | 6318 |
!JavaVM class methodsFor:'native - netscape'! |
6319 |
||
6320 |
_MozillaAppletContext_pMochaOnLoad:nativeContext |
|
6321 |
|id| |
|
6322 |
||
6323 |
id := nativeContext argAt:1. |
|
318 | 6324 |
"/ 'JAVA: MozillaAppletContext_pMochaOnLoad: ' print. id printNL. |
255 | 6325 |
^ nil |
6326 |
||
6327 |
"Created: / 6.1.1998 / 20:37:13 / cg" |
|
318 | 6328 |
"Modified: / 6.2.1998 / 02:13:09 / cg" |
255 | 6329 |
! |
6330 |
||
325 | 6331 |
_MozillaAppletContext_pShowDocument:nativeContext |
6332 |
|s js| |
|
6333 |
||
6334 |
js := nativeContext argAt:1. |
|
6335 |
s := Java as_ST_String:js. |
|
6336 |
||
6337 |
"/ somehow pass it to the html browser .... |
|
6338 |
"/ Transcript showCR:s. |
|
6339 |
^ nil |
|
6340 |
||
6341 |
"Modified: / 8.1.1998 / 17:06:13 / cg" |
|
6342 |
"Created: / 29.3.1998 / 15:53:17 / cg" |
|
6343 |
! |
|
6344 |
||
255 | 6345 |
_MozillaAppletContext_pShowStatus:nativeContext |
6346 |
|s js| |
|
6347 |
||
6348 |
js := nativeContext argAt:1. |
|
405 | 6349 |
js isNil ifTrue:[ |
6350 |
s := '' |
|
6351 |
] ifFalse:[ |
|
6352 |
s := Java as_ST_String:js. |
|
6353 |
]. |
|
255 | 6354 |
|
6355 |
self activityNotification:s. |
|
6356 |
"/ Transcript showCR:s. |
|
6357 |
^ nil |
|
6358 |
||
6359 |
"Created: / 6.1.1998 / 18:31:34 / cg" |
|
405 | 6360 |
"Modified: / 22.10.1998 / 01:17:46 / cg" |
255 | 6361 |
! |
6362 |
||
440 | 6363 |
_MozillaAppletContext_setConsoleState0:nativeContext |
6364 |
"/ void setConsoleState0 (int) |
|
6365 |
UnimplementedNativeMethodSignal raise |
|
6366 |
||
6367 |
"Created: / 12.11.1998 / 19:23:22 / cg" |
|
6368 |
! |
|
6369 |
||
6370 |
_URLConnection_close:nativeContext |
|
6371 |
"/ void close () |
|
6372 |
UnimplementedNativeMethodSignal raise |
|
6373 |
||
6374 |
"Created: / 12.11.1998 / 19:26:03 / cg" |
|
6375 |
! |
|
6376 |
||
6377 |
_URLConnection_finalize:nativeContext |
|
6378 |
"/ void finalize () |
|
6379 |
UnimplementedNativeMethodSignal raise |
|
6380 |
||
6381 |
"Created: / 12.11.1998 / 19:25:22 / cg" |
|
6382 |
! |
|
6383 |
||
6384 |
_URLConnection_getContentLength0:nativeContext |
|
6385 |
"/ int getContentLength0 () |
|
6386 |
UnimplementedNativeMethodSignal raise |
|
6387 |
||
6388 |
"Created: / 12.11.1998 / 19:25:34 / cg" |
|
6389 |
! |
|
6390 |
||
6391 |
_URLConnection_getContentType0:nativeContext |
|
6392 |
"/ java.lang.String getContentType0 () |
|
6393 |
UnimplementedNativeMethodSignal raise |
|
6394 |
||
6395 |
"Created: / 12.11.1998 / 19:25:42 / cg" |
|
6396 |
! |
|
6397 |
||
6398 |
_URLConnection_getHeaderField0:nativeContext |
|
6399 |
"/ java.lang.String getHeaderField0 (java.lang.String) |
|
6400 |
UnimplementedNativeMethodSignal raise |
|
6401 |
||
6402 |
"Created: / 12.11.1998 / 19:25:53 / cg" |
|
6403 |
! |
|
6404 |
||
6405 |
_URLConnection_pCreate:nativeContext |
|
6406 |
"/ void pCreate (java.lang.String java.lang.String) |
|
6407 |
UnimplementedNativeMethodSignal raise |
|
6408 |
||
6409 |
"Created: / 12.11.1998 / 19:25:14 / cg" |
|
6410 |
! |
|
6411 |
||
6412 |
_URLInputStream_available:nativeContext |
|
6413 |
"/ int available () |
|
6414 |
UnimplementedNativeMethodSignal raise |
|
6415 |
||
6416 |
"Created: / 12.11.1998 / 19:24:26 / cg" |
|
6417 |
! |
|
6418 |
||
6419 |
_URLInputStream_open:nativeContext |
|
6420 |
"/ void open () |
|
6421 |
UnimplementedNativeMethodSignal raise |
|
6422 |
||
6423 |
"Created: / 12.11.1998 / 19:24:01 / cg" |
|
6424 |
! |
|
6425 |
||
6426 |
_URLInputStream_read:nativeContext |
|
6427 |
"/ int read (byte[] int int) |
|
6428 |
UnimplementedNativeMethodSignal raise |
|
6429 |
||
6430 |
"Created: / 12.11.1998 / 19:24:12 / cg" |
|
6431 |
! |
|
6432 |
||
6433 |
_URLOutputStream_open:nativeContext |
|
6434 |
"/ void open () |
|
6435 |
UnimplementedNativeMethodSignal raise |
|
6436 |
||
6437 |
"Created: / 12.11.1998 / 19:24:38 / cg" |
|
6438 |
! |
|
6439 |
||
6440 |
_URLOutputStream_pClose:nativeContext |
|
6441 |
"/ void pClose () |
|
6442 |
UnimplementedNativeMethodSignal raise |
|
6443 |
||
6444 |
"Created: / 12.11.1998 / 19:25:02 / cg" |
|
6445 |
! |
|
6446 |
||
6447 |
_URLOutputStream_write:nativeContext |
|
6448 |
"/ void write (int) |
|
6449 |
UnimplementedNativeMethodSignal raise |
|
6450 |
||
6451 |
"Created: / 12.11.1998 / 19:24:45 / cg" |
|
6452 |
! |
|
6453 |
||
6454 |
_URLOutputStream_writeBytes:nativeContext |
|
6455 |
"/ void writeBytes (byte[] int int) |
|
6456 |
UnimplementedNativeMethodSignal raise |
|
6457 |
||
6458 |
"Created: / 12.11.1998 / 19:24:55 / cg" |
|
6459 |
! |
|
6460 |
||
255 | 6461 |
_URLStreamHandlerFactory_pInit:nativeContext |
6462 |
"/ self unimplementedNativeMethod. |
|
6463 |
||
6464 |
"Created: / 10.1.1998 / 15:47:24 / cg" |
|
440 | 6465 |
! |
6466 |
||
6467 |
_URLStreamHandlerFactory_pSupportsProtocol:nativeContext |
|
6468 |
"/ boolean pSupportsProtocol (java.lang.String) |
|
6469 |
UnimplementedNativeMethodSignal raise |
|
6470 |
||
6471 |
"Created: / 12.11.1998 / 19:23:43 / cg" |
|
255 | 6472 |
! ! |
6473 |
||
6474 |
!JavaVM class methodsFor:'native - sun.audio'! |
|
6475 |
||
6476 |
_AudioDevice_audioClose:nativeContext |
|
261 | 6477 |
|device fd stream| |
6478 |
||
6479 |
device := nativeContext receiver. |
|
6480 |
device notNil ifTrue:[ |
|
6481 |
fd := device instVarNamed:'dev'. |
|
6482 |
(fd notNil and:[fd > 0]) ifTrue:[ |
|
6483 |
stream := self getOpenFileAt:fd. |
|
6484 |
stream notNil ifTrue:[ |
|
6485 |
stream close. |
|
6486 |
device instVarNamed:'dev' put:0. |
|
6487 |
] |
|
6488 |
] |
|
6489 |
] |
|
255 | 6490 |
|
6491 |
"Created: / 10.1.1998 / 15:45:16 / cg" |
|
261 | 6492 |
"Modified: / 13.1.1998 / 18:08:20 / cg" |
255 | 6493 |
! |
6494 |
||
6495 |
_AudioDevice_audioOpen:nativeContext |
|
261 | 6496 |
|f stream fileNo| |
6497 |
||
6498 |
NoAudio ifTrue:[ |
|
374 | 6499 |
Transcript showCR:'JAVA: audio disabled'. |
6500 |
^ -1 |
|
6501 |
]. |
|
6502 |
||
261 | 6503 |
Stream streamErrorSignal handle:[:ex | |
374 | 6504 |
Stream streamErrorSignal handle:[:ex | |
6505 |
stream := nil. |
|
6506 |
ex return. |
|
6507 |
] do:[ |
|
6508 |
stream := SoundStream writing. |
|
6509 |
]. |
|
261 | 6510 |
] do:[ |
374 | 6511 |
stream := SoundStream writing. |
6512 |
stream notNil ifTrue:[ |
|
6513 |
stream setSampleRate:8000. |
|
6514 |
] |
|
261 | 6515 |
]. |
6516 |
stream isNil ifTrue:[ |
|
374 | 6517 |
"/ ^ -1. |
6518 |
||
6519 |
f := '/dev/audio' asFilename. |
|
6520 |
f exists ifFalse:[ |
|
6521 |
Transcript showCR:'JAVA: neither SoundStream nor /dev/audio available'. |
|
6522 |
^ -1 |
|
6523 |
]. |
|
6524 |
stream := f readWriteStream. |
|
6525 |
stream isNil ifTrue:[ |
|
6526 |
Transcript showCR:'JAVA: /dev/audio exists, but cannot be opened'. |
|
6527 |
^ -1 |
|
6528 |
]. |
|
6529 |
fileNo := self addOpenFile:stream. |
|
6530 |
]. |
|
6531 |
||
261 | 6532 |
fileNo := self addOpenFile:stream. |
6533 |
||
6534 |
FileOpenTrace ifTrue:[ |
|
374 | 6535 |
('JAVA: opened audioDevice as FD ' , fileNo printString) infoPrintCR. |
261 | 6536 |
]. |
6537 |
||
6538 |
^ fileNo |
|
255 | 6539 |
|
6540 |
"Created: / 10.1.1998 / 15:45:30 / cg" |
|
374 | 6541 |
"Modified: / 14.10.1998 / 15:20:52 / cg" |
261 | 6542 |
! |
6543 |
||
6544 |
_AudioDevice_audioWrite:nativeContext |
|
6545 |
|device fd stream bytes count| |
|
6546 |
||
6547 |
device := nativeContext receiver. |
|
6548 |
device notNil ifTrue:[ |
|
6549 |
fd := device instVarNamed:'dev'. |
|
6550 |
(fd notNil and:[fd > 0]) ifTrue:[ |
|
6551 |
stream := self getOpenFileAt:fd. |
|
6552 |
stream notNil ifTrue:[ |
|
6553 |
bytes := nativeContext argAt:1. |
|
6554 |
count := nativeContext argAt:2. |
|
6555 |
stream nextPutBytes:count from:bytes startingAt:1 |
|
6556 |
] |
|
6557 |
] |
|
6558 |
] |
|
6559 |
||
6560 |
"Created: / 10.1.1998 / 15:45:16 / cg" |
|
6561 |
"Modified: / 13.1.1998 / 18:07:20 / cg" |
|
255 | 6562 |
! ! |
6563 |
||
6564 |
!JavaVM class methodsFor:'native - sun.awt'! |
|
6565 |
||
6566 |
_GifImageDecoder_parseImage:nativeContext |
|
261 | 6567 |
|decoder width height bool1 depth subHdrBytes dstBytes i1 i2 colorModel |
6568 |
stream byte compressedData compressedSize index count data |
|
304 | 6569 |
leftOffs topOffs codeLen flags pixelStore clrModel t buffSize |
6570 |
countGot countGot2| |
|
255 | 6571 |
|
6572 |
decoder := nativeContext receiver. |
|
6573 |
||
6574 |
i1 := nativeContext argAt:1. |
|
6575 |
i2 := nativeContext argAt:2. |
|
6576 |
width := nativeContext argAt:3. |
|
6577 |
height := nativeContext argAt:4. |
|
6578 |
bool1 := nativeContext argAt:5. |
|
6579 |
depth := nativeContext argAt:6. |
|
261 | 6580 |
subHdrBytes := nativeContext argAt:7. |
255 | 6581 |
dstBytes := nativeContext argAt:8. |
6582 |
colorModel := nativeContext argAt:9. |
|
6583 |
||
261 | 6584 |
leftOffs := subHdrBytes wordAt:1 MSB:false. |
6585 |
topOffs := subHdrBytes wordAt:3 MSB:false. |
|
6586 |
width := subHdrBytes wordAt:5 MSB:false. |
|
6587 |
height := subHdrBytes wordAt:7 MSB:false. |
|
6588 |
flags := subHdrBytes at:9. |
|
6589 |
codeLen := subHdrBytes at:10. |
|
6590 |
||
6591 |
stream := decoder instVarNamed:'input'. |
|
6592 |
pixelStore := decoder instVarNamed:'store'. |
|
339 | 6593 |
pixelStore isNil ifTrue:[ |
6594 |
^ 0 |
|
6595 |
]. |
|
261 | 6596 |
|
6597 |
buffSize := (width * height // 2) max:4096. |
|
6598 |
compressedData := ByteArray uninitializedNew:buffSize. |
|
6599 |
"get compressed data" |
|
6600 |
index := 1. |
|
304 | 6601 |
count := stream perform:#'read()I'. |
261 | 6602 |
|
6603 |
[count notNil and:[count > 0]] whileTrue:[ |
|
304 | 6604 |
(index + count) > buffSize ifTrue:[ |
6605 |
t := ByteArray uninitializedNew:(buffSize * 2). |
|
6606 |
t replaceFrom:1 to:buffSize with:compressedData startingAt:1. |
|
6607 |
compressedData := t. |
|
6608 |
buffSize := buffSize * 2. |
|
6609 |
]. |
|
6610 |
[count ~~ 0] whileTrue:[ |
|
6611 |
countGot := stream |
|
6612 |
perform:#'read([BII)I' |
|
6613 |
with:compressedData |
|
6614 |
with:index-1 |
|
6615 |
with:count. |
|
6616 |
||
6617 |
countGot > 0 ifTrue:[ |
|
6618 |
count := count - countGot. |
|
6619 |
index := index + countGot. |
|
6620 |
] ifFalse:[ |
|
6621 |
count := -1. |
|
6622 |
] |
|
6623 |
]. |
|
6624 |
||
6625 |
count >= 0 ifTrue:[ |
|
6626 |
count := stream perform:#read. |
|
6627 |
] |
|
261 | 6628 |
]. |
6629 |
compressedSize := index - 1. |
|
6630 |
||
6631 |
data := pixelStore perform:#'allocateLines(I)Ljava/lang/Object;' with:height. |
|
6632 |
(data isMemberOf:ByteArray) ifFalse:[ |
|
304 | 6633 |
self halt. |
6634 |
^ 0. |
|
261 | 6635 |
]. |
6636 |
"/ 'GIFReader: decompressing ...' infoPrintCR. |
|
6637 |
||
6638 |
||
6639 |
GIFReader |
|
304 | 6640 |
decompressGIFFrom:compressedData |
6641 |
count:compressedSize |
|
6642 |
into:data |
|
6643 |
startingAt:1 |
|
6644 |
codeLen:(codeLen + 1). |
|
261 | 6645 |
|
6646 |
clrModel := pixelStore instVarNamed:'colormodel'. |
|
6647 |
||
6648 |
pixelStore |
|
304 | 6649 |
perform:#'setPixels(IIII[BII)Z' |
6650 |
withArguments: |
|
6651 |
(Array |
|
6652 |
with:0 "/ x |
|
6653 |
with:0 "/ y |
|
6654 |
with:width "/ w |
|
6655 |
with:height "/ h |
|
6656 |
with:data |
|
6657 |
with:0 "/ offs |
|
6658 |
with:width). "/ scanSize |
|
261 | 6659 |
|
6660 |
pixelStore perform:#'imageComplete()V'. |
|
6661 |
"/ perform:#'imageComplete(I)V' |
|
6662 |
"/ with:((Java at:'java.awt.image.ImageConsumer') instVarNamed:'STATICIMAGEDONE'). |
|
6663 |
||
255 | 6664 |
"/ self internalError:'breakPoint'. |
6665 |
^ 1 "/ true |
|
6666 |
||
339 | 6667 |
"Modified: / 10.4.1998 / 14:31:59 / cg" |
255 | 6668 |
! |
6669 |
||
6670 |
_ImageRepresentation_disposeImage:nativeContext |
|
262 | 6671 |
|imgRep img| |
255 | 6672 |
|
6673 |
imgRep := nativeContext receiver. |
|
262 | 6674 |
|
6675 |
img := imgRep instVarNamed:'pData'. |
|
6676 |
(img notNil and:[img ~~ 0]) ifTrue:[ |
|
270 | 6677 |
ImageStretchCache notNil ifTrue:[ |
6678 |
ImageStretchCache removeKey:img ifAbsent:nil. |
|
6679 |
] |
|
262 | 6680 |
]. |
6681 |
||
261 | 6682 |
imgRep instVarNamed:'pData' put:0. |
6683 |
"/ self halt. |
|
255 | 6684 |
|
6685 |
"Created: / 7.1.1998 / 22:31:46 / cg" |
|
262 | 6686 |
"Modified: / 17.1.1998 / 13:26:55 / cg" |
255 | 6687 |
! |
6688 |
||
6689 |
_ImageRepresentation_finish:nativeContext |
|
6690 |
|imgRep bool| |
|
6691 |
||
6692 |
imgRep := nativeContext receiver. |
|
6693 |
bool := nativeContext argAt:1. |
|
261 | 6694 |
"/ self halt. |
318 | 6695 |
"/ 'JAVA: ImageRepresentation_finish ignored for now' infoPrintCR. |
255 | 6696 |
|
6697 |
^ 1 "/ true |
|
6698 |
||
6699 |
"Created: / 8.1.1998 / 00:11:40 / cg" |
|
318 | 6700 |
"Modified: / 6.2.1998 / 02:12:54 / cg" |
261 | 6701 |
! |
6702 |
||
6703 |
_ImageRepresentation_imageDraw:nativeContext |
|
6704 |
|imgRep x y img deviceImage jGraphics gc clr| |
|
6705 |
||
6706 |
imgRep := nativeContext receiver. |
|
6707 |
img := imgRep instVarNamed:'pData'. |
|
6708 |
(img isNil or:[img == 0]) ifTrue:[ |
|
466 | 6709 |
"/ self halt. |
6710 |
^ self. |
|
261 | 6711 |
]. |
6712 |
jGraphics := nativeContext argAt:1. |
|
6713 |
gc := jGraphics instVarNamed:'pData'. |
|
6714 |
gc realized ifFalse:[^ self]. |
|
6715 |
||
6716 |
x := nativeContext argAt:2. |
|
6717 |
y := nativeContext argAt:3. |
|
6718 |
clr := nativeContext argAt:4. |
|
6719 |
deviceImage := img onDevice:gc device. |
|
6720 |
deviceImage ~~ img ifTrue:[ |
|
466 | 6721 |
imgRep instVarNamed:'pData' put:deviceImage. |
6722 |
]. |
|
6723 |
gc realized ifFalse:[^ self]. |
|
261 | 6724 |
deviceImage displayOn:gc x:x y:y. |
6725 |
^ 1. |
|
6726 |
||
6727 |
"Created: / 13.1.1998 / 13:32:28 / cg" |
|
466 | 6728 |
"Modified: / 25.11.1998 / 15:36:38 / cg" |
261 | 6729 |
! |
6730 |
||
6731 |
_ImageRepresentation_imageStretch:nativeContext |
|
6732 |
|imgRep x1 y1 x2 y2 srcX1 srcY1 w h |
|
6733 |
img deviceImage jGraphics gc clr stretchWidth stretchHeight| |
|
6734 |
||
6735 |
imgRep := nativeContext receiver. |
|
6736 |
img := imgRep instVarNamed:'pData'. |
|
6737 |
(img isNil or:[img == 0]) ifTrue:[ |
|
270 | 6738 |
"/ self halt. |
6739 |
^ self. |
|
261 | 6740 |
]. |
6741 |
||
6742 |
jGraphics := nativeContext argAt:1. |
|
6743 |
gc := jGraphics instVarNamed:'pData'. |
|
6744 |
gc realized ifFalse:[^ self]. |
|
6745 |
||
6746 |
x1 := nativeContext argAt:2. |
|
6747 |
y1 := nativeContext argAt:3. |
|
6748 |
x2 := nativeContext argAt:4. |
|
6749 |
y2:= nativeContext argAt:5. |
|
6750 |
srcX1 := nativeContext argAt:6. |
|
6751 |
srcY1 := nativeContext argAt:7. |
|
6752 |
w := nativeContext argAt:8. |
|
6753 |
h := nativeContext argAt:9. |
|
6754 |
clr := nativeContext argAt:10. |
|
6755 |
||
6756 |
(srcX1 ~~ 0 or:[srcY1 ~~ 0]) ifTrue:[ |
|
270 | 6757 |
self halt. |
6758 |
^ self. |
|
261 | 6759 |
]. |
6760 |
(w ~~ img width or:[h ~~ img height]) ifTrue:[ |
|
270 | 6761 |
self halt. |
6762 |
^ self |
|
261 | 6763 |
]. |
6764 |
||
6765 |
"/ TODO: remember magnified images somewhere for a while, |
|
6766 |
"/ to avoid repeated action ... |
|
6767 |
||
6768 |
stretchWidth := (x2-x1). |
|
6769 |
stretchHeight := (y2-y1). |
|
6770 |
||
6771 |
(stretchWidth == img width |
|
6772 |
and:[stretchHeight == img height]) ifTrue:[ |
|
270 | 6773 |
deviceImage := img onDevice:gc device. |
6774 |
deviceImage ~~ img ifTrue:[ |
|
6775 |
imgRep instVarNamed:'pData' put:deviceImage. |
|
6776 |
]. |
|
261 | 6777 |
] ifFalse:[ |
270 | 6778 |
ImageStretchCache notNil ifTrue:[ |
6779 |
deviceImage := ImageStretchCache at:img ifAbsent:nil. |
|
6780 |
]. |
|
6781 |
(deviceImage isNil |
|
6782 |
or:[deviceImage width ~~ stretchWidth |
|
6783 |
or:[deviceImage height ~~ stretchHeight]]) ifTrue:[ |
|
6784 |
deviceImage := (img magnifiedTo:stretchWidth@stretchHeight) onDevice:gc device. |
|
6785 |
ImageStretchCache isNil ifTrue:[ |
|
6786 |
ImageStretchCache := WeakIdentityDictionary new. |
|
6787 |
]. |
|
6788 |
ImageStretchCache at:img put:deviceImage |
|
6789 |
]. |
|
261 | 6790 |
]. |
6791 |
deviceImage displayOn:gc x:x1 y:y1 |
|
6792 |
||
6793 |
"Created: / 13.1.1998 / 13:32:28 / cg" |
|
6794 |
"Modified: / 15.1.1998 / 13:14:47 / cg" |
|
255 | 6795 |
! |
6796 |
||
6797 |
_ImageRepresentation_offscreenInit:nativeContext |
|
262 | 6798 |
|imgRep jclr w h form screenDevice| |
255 | 6799 |
|
6800 |
imgRep := nativeContext receiver. |
|
261 | 6801 |
jclr := nativeContext argAt:1. |
262 | 6802 |
|
6803 |
w := imgRep instVarNamed:'width'. |
|
6804 |
h := imgRep instVarNamed:'height'. |
|
6805 |
||
6806 |
screenDevice := Screen current. |
|
6807 |
form := Form width:w height:h depth:(screenDevice depth) on:screenDevice. |
|
6808 |
||
6809 |
imgRep instVarNamed:'pData' put:form. |
|
6810 |
"/ self halt. |
|
255 | 6811 |
|
6812 |
"Created: / 7.1.1998 / 22:31:46 / cg" |
|
262 | 6813 |
"Modified: / 17.1.1998 / 12:36:43 / cg" |
261 | 6814 |
! |
6815 |
||
6816 |
_ImageRepresentation_setBytePixels:nativeContext |
|
318 | 6817 |
|imgRep x y w h clrModel bytes offs i2 |
6818 |
img depth cmap rgbMap opaque transparentColorIndex |
|
6819 |
scanLineWidth nBytes srcIdx dstIdx| |
|
261 | 6820 |
|
6821 |
imgRep := nativeContext receiver. |
|
6822 |
x := nativeContext argAt:1. |
|
6823 |
y := nativeContext argAt:2. |
|
6824 |
w := nativeContext argAt:3. |
|
6825 |
h := nativeContext argAt:4. |
|
6826 |
clrModel := nativeContext argAt:5. |
|
6827 |
bytes := nativeContext argAt:6. |
|
318 | 6828 |
offs := nativeContext argAt:7. "/ offset ?? |
6829 |
scanLineWidth := nativeContext argAt:8. |
|
261 | 6830 |
|
6831 |
depth := clrModel instVarNamed:'pixel_bits'. |
|
6832 |
(clrModel instVarNamed:'map_size') ~~ 0 ifTrue:[ |
|
318 | 6833 |
rgbMap := clrModel instVarNamed:'rgb'. |
6834 |
cmap := Array new:rgbMap size. |
|
6835 |
rgbMap |
|
6836 |
keysAndValuesDo:[:idx :rgb | |
|
6837 |
cmap at:idx put:(Color rgbValue:(rgb bitAnd:16rFFFFFF)) |
|
6838 |
]. |
|
261 | 6839 |
]. |
6840 |
||
6841 |
opaque := (clrModel instVarNamed:'opaque') ~~ 0. |
|
6842 |
opaque ifFalse:[ |
|
318 | 6843 |
transparentColorIndex := clrModel instVarNamed:'transparent_index' |
261 | 6844 |
]. |
6845 |
||
6846 |
img := imgRep instVarNamed:'pData'. |
|
405 | 6847 |
(img isNil or:[img == 0]) ifFalse:[ |
6848 |
"/ self halt |
|
6849 |
]. |
|
6850 |
||
6851 |
(offs ~~ 0 or:[scanLineWidth ~~ w]) ifTrue:[ |
|
6852 |
nBytes := ByteArray new:w*h. |
|
6853 |
srcIdx := offs+1. |
|
6854 |
dstIdx := 1. |
|
6855 |
1 to:h do:[:y | |
|
6856 |
nBytes replaceFrom:dstIdx to:(dstIdx+w-1) with:bytes startingAt:srcIdx. |
|
6857 |
srcIdx := srcIdx + scanLineWidth. |
|
6858 |
dstIdx := dstIdx + w. |
|
318 | 6859 |
]. |
405 | 6860 |
bytes := nBytes. |
6861 |
]. |
|
6862 |
img := Image width:w height:h depth:depth fromArray:bytes. |
|
6863 |
cmap notNil ifTrue:[ |
|
6864 |
img colorMap:cmap. |
|
6865 |
img photometric:#palette |
|
6866 |
]. |
|
6867 |
opaque ifFalse:[ |
|
6868 |
img mask:(ImageReader |
|
6869 |
buildMaskFromColor:transparentColorIndex |
|
6870 |
for:bytes |
|
6871 |
width:w |
|
6872 |
height:h) |
|
6873 |
]. |
|
6874 |
||
6875 |
imgRep instVarNamed:'pData' put:img. |
|
261 | 6876 |
^ 1. |
6877 |
||
6878 |
"Created: / 7.1.1998 / 22:31:46 / cg" |
|
405 | 6879 |
"Modified: / 21.10.1998 / 00:35:45 / cg" |
262 | 6880 |
! |
6881 |
||
297 | 6882 |
_ImageRepresentation_setIntPixels:nativeContext |
318 | 6883 |
|imgRep x y w h clrModel ints offs scanLineWidth |
316 | 6884 |
img depth cmap rgbMap opaque transparentColorIndex |
373 | 6885 |
bytes srcIdx dstIdx val red green blue |
6886 |
redMask greenMask blueMask redShift greenShift blueShift| |
|
297 | 6887 |
|
6888 |
imgRep := nativeContext receiver. |
|
6889 |
x := nativeContext argAt:1. |
|
6890 |
y := nativeContext argAt:2. |
|
6891 |
w := nativeContext argAt:3. |
|
6892 |
h := nativeContext argAt:4. |
|
6893 |
clrModel := nativeContext argAt:5. |
|
6894 |
ints := nativeContext argAt:6. |
|
318 | 6895 |
offs := nativeContext argAt:7. "/ offset ?? |
6896 |
scanLineWidth := nativeContext argAt:8. "/ scanLineWidth ?? |
|
297 | 6897 |
opaque := false. |
373 | 6898 |
offs ~~ 0 ifTrue:[ |
6899 |
self halt |
|
6900 |
]. |
|
297 | 6901 |
|
6902 |
depth := clrModel instVarNamed:'pixel_bits'. |
|
6903 |
clrModel class == (Java at:'java.awt.image.DirectColorModel') ifTrue:[ |
|
6904 |
] ifFalse:[ |
|
6905 |
(clrModel instVarNamed:'map_size') ~~ 0 ifTrue:[ |
|
6906 |
rgbMap := clrModel instVarNamed:'rgb'. |
|
6907 |
cmap := Array new:rgbMap size. |
|
6908 |
rgbMap |
|
6909 |
keysAndValuesDo:[:idx :rgb | |
|
6910 |
cmap at:idx put:(Color rgbValue:(rgb bitAnd:16rFFFFFF)) |
|
6911 |
]. |
|
6912 |
]. |
|
6913 |
opaque := (clrModel instVarNamed:'opaque') ~~ 0. |
|
6914 |
opaque ifFalse:[ |
|
6915 |
transparentColorIndex := clrModel instVarNamed:'transparent_index' |
|
6916 |
]. |
|
6917 |
]. |
|
6918 |
||
6919 |
img := imgRep instVarNamed:'pData'. |
|
405 | 6920 |
(img isNil or:[img == 0]) ifFalse:[ |
6921 |
"/ self halt. |
|
6922 |
]. |
|
6923 |
||
6924 |
depth == 32 ifTrue:[ |
|
6925 |
"/ temporary kludge - ony use 24 bits/pixel |
|
6926 |
bytes := ByteArray new:w*h*3. |
|
6927 |
srcIdx := 1. |
|
6928 |
dstIdx := 1. |
|
6929 |
redMask := clrModel instVarNamed:'red_mask'. |
|
6930 |
greenMask := clrModel instVarNamed:'green_mask'. |
|
6931 |
blueMask := clrModel instVarNamed:'blue_mask'. |
|
6932 |
redShift := (clrModel instVarNamed:'red_offset') negated. |
|
6933 |
greenShift := (clrModel instVarNamed:'green_offset') negated. |
|
6934 |
blueShift := (clrModel instVarNamed:'blue_offset') negated. |
|
6935 |
1 to:h do:[:y | |
|
6936 |
1 to:w do:[:x | |
|
6937 |
val := ints at:srcIdx. |
|
6938 |
red := (val bitAnd:redMask) bitShift:redShift. |
|
6939 |
green := (val bitAnd:greenMask) bitShift:greenShift. |
|
6940 |
blue := (val bitAnd:blueMask) bitShift:blueShift. |
|
6941 |
bytes at:dstIdx put:red. |
|
6942 |
bytes at:dstIdx+1 put:green. |
|
6943 |
bytes at:dstIdx+2 put:blue. |
|
6944 |
dstIdx := dstIdx + 3. |
|
6945 |
srcIdx := srcIdx + 1. |
|
316 | 6946 |
]. |
405 | 6947 |
srcIdx := srcIdx + (scanLineWidth - w). |
316 | 6948 |
]. |
405 | 6949 |
img := Depth24Image width:w height:h depth:24 fromArray:bytes. |
6950 |
] ifFalse:[ |
|
6951 |
scanLineWidth ~~ w ifTrue:[ |
|
6952 |
self halt |
|
297 | 6953 |
]. |
405 | 6954 |
img := Image width:w height:h depth:depth fromArray:ints. |
6955 |
]. |
|
6956 |
cmap notNil ifTrue:[ |
|
6957 |
img colorMap:cmap. |
|
6958 |
img photometric:#palette |
|
297 | 6959 |
] ifFalse:[ |
405 | 6960 |
img photometric:#rgb |
6961 |
]. |
|
6962 |
opaque ifFalse:[ |
|
6963 |
img mask:(ImageReader |
|
6964 |
buildMaskFromColor:transparentColorIndex |
|
6965 |
for:ints |
|
6966 |
width:w |
|
6967 |
height:h) |
|
6968 |
]. |
|
6969 |
||
6970 |
imgRep instVarNamed:'pData' put:img. |
|
297 | 6971 |
^ 1. |
6972 |
||
6973 |
"Created: / 1.2.1998 / 17:38:47 / cg" |
|
405 | 6974 |
"Modified: / 21.10.1998 / 00:35:37 / cg" |
297 | 6975 |
! |
6976 |
||
440 | 6977 |
_JPEGImageDecoder_readImage:nativeContext |
6978 |
UnimplementedNativeMethodSignal raise |
|
6979 |
||
6980 |
"Created: / 12.11.1998 / 18:53:30 / cg" |
|
6981 |
"Modified: / 12.11.1998 / 18:53:40 / cg" |
|
6982 |
! |
|
6983 |
||
262 | 6984 |
_OffScreenImageSource_sendPixels:nativeContext |
6985 |
"/ self halt. |
|
6986 |
||
6987 |
"Modified: / 16.1.1998 / 18:22:23 / cg" |
|
6988 |
"Created: / 17.1.1998 / 12:36:25 / cg" |
|
255 | 6989 |
! ! |
6990 |
||
280 | 6991 |
!JavaVM class methodsFor:'native - sun.awt - jdk1.2'! |
6992 |
||
284 | 6993 |
_ColorModel_initIDs:nativeContext |
6994 |
"/ new with jdk1.2 ... |
|
6995 |
||
6996 |
"Created: / 28.1.1998 / 22:19:23 / cg" |
|
6997 |
! |
|
6998 |
||
6999 |
_FontDescriptor_initIDs:nativeContext |
|
7000 |
"/ new with jdk1.2 ... |
|
7001 |
||
7002 |
"Created: / 28.1.1998 / 22:30:52 / cg" |
|
7003 |
! |
|
7004 |
||
7005 |
_Font_initIDs:nativeContext |
|
7006 |
"/ new with jdk1.2 ... |
|
7007 |
||
7008 |
"Created: / 27.1.1998 / 21:43:25 / cg" |
|
7009 |
! |
|
7010 |
||
7011 |
_PackedColorModel_initIDs:nativeContext |
|
7012 |
"/ new with jdk1.2 ... |
|
7013 |
||
7014 |
"Created: / 28.1.1998 / 22:19:35 / cg" |
|
7015 |
! |
|
7016 |
||
7017 |
_PlatformFont_initIDs:nativeContext |
|
7018 |
"/ new with jdk1.2 ... |
|
7019 |
||
7020 |
"Created: / 28.1.1998 / 22:30:41 / cg" |
|
7021 |
! |
|
7022 |
||
7023 |
_X11GraphicsDevice_getConfigType:nativeContext |
|
7024 |
"/ new with jdk1.2 ... |
|
7025 |
||
7026 |
|configNr cls| |
|
7027 |
||
7028 |
"/ for now, only one config. |
|
7029 |
configNr := nativeContext argAt:1. |
|
7030 |
||
7031 |
cls := Java classNamed:'java.awt.GraphicsDevice'. |
|
7032 |
^ cls instVarNamed:'TYPE_RASTER_SCREEN'. |
|
7033 |
||
7034 |
"Created: / 28.1.1998 / 22:19:05 / cg" |
|
7035 |
! |
|
7036 |
||
7037 |
_X11GraphicsDevice_getNumConfigs:nativeContext |
|
7038 |
"/ new with jdk1.2 ... |
|
7039 |
||
7040 |
^ 1 |
|
7041 |
||
7042 |
"Created: / 28.1.1998 / 22:13:26 / cg" |
|
7043 |
"Modified: / 28.1.1998 / 22:14:33 / cg" |
|
7044 |
! |
|
7045 |
||
7046 |
_X11GraphicsEnvironment_getNumScreens:nativeContext |
|
7047 |
"/ new with jdk1.2 ... |
|
7048 |
||
7049 |
"/ could return the actual number of screens ... |
|
7050 |
||
7051 |
^ 1 |
|
7052 |
||
7053 |
"Created: / 28.1.1998 / 01:50:22 / cg" |
|
7054 |
"Modified: / 28.1.1998 / 22:12:32 / cg" |
|
7055 |
! |
|
7056 |
||
280 | 7057 |
_X11GraphicsEnvironment_initDisplay:nativeContext |
7058 |
"/ new with jdk1.2 ... |
|
7059 |
||
7060 |
"Created: / 28.1.1998 / 01:50:22 / cg" |
|
7061 |
! ! |
|
7062 |
||
284 | 7063 |
!JavaVM class methodsFor:'native - sun.awt.motif - jdk1.2'! |
7064 |
||
7065 |
_InputThread_run:nativeContext |
|
7066 |
self _WToolkit_eventLoop:nativeContext. |
|
7067 |
||
7068 |
"Created: / 28.1.1998 / 22:34:47 / cg" |
|
7069 |
"Modified: / 28.1.1998 / 22:35:16 / cg" |
|
7070 |
! |
|
7071 |
||
7072 |
_MComponentPeer_cacheInit:nativeContext |
|
7073 |
||
7074 |
"Created: / 28.1.1998 / 22:22:30 / cg" |
|
7075 |
! |
|
7076 |
||
457 | 7077 |
_MComponentPeer_pHide:nativeContext |
7078 |
^ self _WComponentPeer_hide:nativeContext |
|
7079 |
||
7080 |
"Created: / 18.11.1998 / 00:15:18 / cg" |
|
7081 |
! |
|
7082 |
||
284 | 7083 |
_MComponentPeer_pInitialize:nativeContext |
7084 |
||
7085 |
"Created: / 28.1.1998 / 22:27:25 / cg" |
|
7086 |
! |
|
7087 |
||
7088 |
_MComponentPeer_setCursor:nativeContext |
|
7089 |
||
7090 |
"Created: / 28.1.1998 / 22:27:35 / cg" |
|
7091 |
! |
|
7092 |
||
7093 |
_MFramePeer_create:nativeContext |
|
7094 |
^ self _WFramePeer_create:nativeContext |
|
7095 |
||
7096 |
"Created: / 28.1.1998 / 22:25:44 / cg" |
|
7097 |
! |
|
7098 |
||
7099 |
_MFramePeer_pHide:nativeContext |
|
7100 |
^ self _WComponentPeer_hide:nativeContext |
|
7101 |
||
7102 |
"Created: / 28.1.1998 / 22:27:04 / cg" |
|
7103 |
! |
|
7104 |
||
7105 |
_MFramePeer_pReshape:nativeContext |
|
7106 |
self commonReshapeComponent:nativeContext |
|
7107 |
||
7108 |
"Created: / 28.1.1998 / 22:28:00 / cg" |
|
7109 |
"Modified: / 28.1.1998 / 22:29:34 / cg" |
|
7110 |
! |
|
7111 |
||
7112 |
_MFramePeer_pSetTitle:nativeContext |
|
7113 |
self _WWindowPeer__setTitle:nativeContext |
|
7114 |
||
7115 |
"Created: / 28.1.1998 / 22:30:23 / cg" |
|
7116 |
! |
|
7117 |
||
7118 |
_MToolkit_init:nativeContext |
|
7119 |
||
7120 |
"Created: / 28.1.1998 / 22:21:54 / cg" |
|
7121 |
! |
|
7122 |
||
7123 |
_MToolkit_run:nativeContext |
|
7124 |
||
7125 |
"Created: / 28.1.1998 / 22:22:10 / cg" |
|
7126 |
! ! |
|
7127 |
||
7128 |
!JavaVM class methodsFor:'native - sun.awt.windows'! |
|
7129 |
||
457 | 7130 |
_MComponentPeer_handleEvent:nativeContext |
7131 |
^ self _WComponentPeer_handleEvent:nativeContext |
|
7132 |
||
7133 |
"Created: / 18.11.1998 / 00:21:17 / cg" |
|
7134 |
! |
|
7135 |
||
7136 |
_MComponentPeer_pShow:nativeContext |
|
7137 |
|view| |
|
7138 |
||
7139 |
view := self viewForWPeer:nativeContext. |
|
7140 |
||
7141 |
"/ frame views are under my browsers own control |
|
7142 |
(view isMemberOf:JavaEmbeddedFrameView) ifFalse:[ |
|
7143 |
view beVisible. |
|
7144 |
view realize. |
|
7145 |
]. |
|
7146 |
||
7147 |
"/ view windowGroup notNil ifTrue:[ |
|
7148 |
"/ windowServer addGroup:(view windowGroup) |
|
7149 |
"/ ]. |
|
7150 |
||
7151 |
^ nil |
|
7152 |
||
7153 |
"/ self halt. |
|
7154 |
||
7155 |
"Modified: / 25.1.1998 / 09:54:07 / cg" |
|
7156 |
"Created: / 18.11.1998 / 00:21:51 / cg" |
|
7157 |
! |
|
7158 |
||
284 | 7159 |
_WButtonPeer_create:nativeContext |
7160 |
|jButtonPeer jButton jFrame frame button |
|
7161 |
lbl| |
|
7162 |
||
7163 |
jButtonPeer := nativeContext receiver. |
|
7164 |
jButton := jButtonPeer instVarNamed:'target'. |
|
7165 |
||
7166 |
jFrame := nativeContext argAt:1. |
|
7167 |
frame := jFrame instVarNamed:'pData'. |
|
7168 |
||
7169 |
button := Button in:frame. |
|
483 | 7170 |
button action:[ |
448 | 7171 |
jButtonPeer perform:#'handleAction()V'. |
7172 |
]. |
|
284 | 7173 |
|
7174 |
lbl := jButton instVarNamed:'label'. |
|
7175 |
lbl notNil ifTrue:[ |
|
419 | 7176 |
lbl := Java as_ST_String:lbl. |
7177 |
button label:lbl |
|
284 | 7178 |
]. |
7179 |
self createdWindowsView:button for:jButtonPeer. |
|
7180 |
||
7181 |
WindowCreationTrace == true ifTrue:[ |
|
419 | 7182 |
'WButtonPeer_create: ' print. frame print. ' -> ' print. button printNL. |
284 | 7183 |
]. |
7184 |
||
7185 |
"Created: / 5.1.1998 / 01:53:30 / cg" |
|
483 | 7186 |
"Modified: / 4.12.1998 / 19:47:40 / cg" |
284 | 7187 |
! |
7188 |
||
297 | 7189 |
_WButtonPeer_setLabel:nativeContext |
7190 |
|label jString| |
|
7191 |
||
7192 |
jString := nativeContext argAt:1. |
|
7193 |
||
7194 |
label := self viewForWPeer:nativeContext. |
|
7195 |
label label:(Java as_ST_String:jString) |
|
7196 |
||
7197 |
"Modified: / 8.1.1998 / 17:35:50 / cg" |
|
7198 |
"Created: / 1.2.1998 / 17:05:47 / cg" |
|
7199 |
! |
|
7200 |
||
284 | 7201 |
_WCanvasPeer_create:nativeContext |
7202 |
|jCanvasPeer jFrame frame subView| |
|
7203 |
||
7204 |
jCanvasPeer := nativeContext receiver. |
|
7205 |
||
7206 |
jFrame := nativeContext argAt:1. |
|
7207 |
jFrame isNil ifTrue:[ |
|
7208 |
self halt:'no frame in canvasPeer create'. |
|
7209 |
self internalError:'no frame in canvasPeer create'. |
|
7210 |
^ self. |
|
7211 |
]. |
|
7212 |
frame := jFrame instVarNamed:'pData'. |
|
7213 |
||
7214 |
subView := JavaView in:frame. |
|
7215 |
subView delegate:self. |
|
7216 |
subView javaPeer:jCanvasPeer. |
|
7217 |
||
7218 |
self createdWindowsView:subView for:jCanvasPeer. |
|
7219 |
||
7220 |
WindowCreationTrace == true ifTrue:[ |
|
7221 |
'WCanvasPeer_create: ' print. frame print. ' -> ' print. subView printNL. |
|
7222 |
]. |
|
7223 |
||
7224 |
"Created: / 5.1.1998 / 00:59:19 / cg" |
|
7225 |
"Modified: / 16.1.1998 / 13:40:00 / cg" |
|
7226 |
! |
|
7227 |
||
440 | 7228 |
_WCheckboxMenuItemPeer_setState:nativeContext |
7229 |
"/ void setState (boolean) |
|
482 | 7230 |
"/ UnimplementedNativeMethodSignal raise |
440 | 7231 |
|
7232 |
"Created: / 12.11.1998 / 19:14:35 / cg" |
|
482 | 7233 |
"Modified: / 3.12.1998 / 21:41:13 / cg" |
440 | 7234 |
! |
7235 |
||
284 | 7236 |
_WCheckboxPeer_create:nativeContext |
7237 |
|jCheckboxPeer jCheckbox jFrame frame checkBox lbl| |
|
7238 |
||
7239 |
jCheckboxPeer := nativeContext receiver. |
|
7240 |
jCheckbox := jCheckboxPeer instVarNamed:'target'. |
|
7241 |
||
7242 |
jFrame := nativeContext argAt:1. |
|
7243 |
frame := jFrame instVarNamed:'pData'. |
|
7244 |
||
7245 |
checkBox := CheckBox in:frame. |
|
7246 |
checkBox action:[ |
|
7247 |
jCheckboxPeer |
|
7248 |
perform:#'handleAction(Z)V' |
|
7249 |
with:(checkBox isOn ifTrue:[1] ifFalse:[0]) |
|
7250 |
]. |
|
7251 |
||
7252 |
lbl := jCheckbox instVarNamed:'label'. |
|
7253 |
lbl notNil ifTrue:[ |
|
7254 |
lbl := Java as_ST_String:lbl. |
|
7255 |
checkBox label:lbl |
|
7256 |
]. |
|
7257 |
||
7258 |
self createdWindowsView:checkBox for:jCheckboxPeer. |
|
7259 |
||
7260 |
WindowCreationTrace == true ifTrue:[ |
|
7261 |
'WCheckboxPeer_create: ' print. frame print. ' -> ' print. checkBox printNL. |
|
7262 |
]. |
|
7263 |
||
7264 |
"Created: / 7.1.1998 / 21:48:03 / cg" |
|
7265 |
"Modified: / 15.1.1998 / 12:27:04 / cg" |
|
7266 |
! |
|
7267 |
||
7268 |
_WCheckboxPeer_setCheckboxGroup:nativeContext |
|
7269 |
|checkBox jGroup| |
|
7270 |
||
7271 |
checkBox := self viewForWPeer:nativeContext. |
|
7272 |
||
7273 |
jGroup := nativeContext argAt:1. |
|
7274 |
||
7275 |
"Created: / 7.1.1998 / 21:48:47 / cg" |
|
7276 |
"Modified: / 25.1.1998 / 01:20:42 / cg" |
|
7277 |
! |
|
7278 |
||
440 | 7279 |
_WCheckboxPeer_setLabel:nativeContext |
7280 |
"/ void setLabel (java.lang.String) |
|
7281 |
UnimplementedNativeMethodSignal raise |
|
7282 |
||
7283 |
"Created: / 12.11.1998 / 19:14:53 / cg" |
|
7284 |
! |
|
7285 |
||
284 | 7286 |
_WCheckboxPeer_setState:nativeContext |
7287 |
|checkBox state| |
|
7288 |
||
7289 |
checkBox := self viewForWPeer:nativeContext. |
|
7290 |
||
7291 |
state := nativeContext argAt:1. |
|
7292 |
state ~~ 0 ifTrue:[ |
|
7293 |
checkBox turnOn |
|
7294 |
] ifFalse:[ |
|
7295 |
checkBox turnOff |
|
7296 |
]. |
|
7297 |
||
7298 |
"Created: / 7.1.1998 / 21:49:13 / cg" |
|
7299 |
"Modified: / 25.1.1998 / 01:26:18 / cg" |
|
7300 |
! |
|
7301 |
||
7302 |
_WChoicePeer_addItem:nativeContext |
|
7303 |
|jString index comboBox| |
|
7304 |
||
7305 |
comboBox := self viewForWPeer:nativeContext. |
|
7306 |
||
7307 |
jString := nativeContext argAt:1. |
|
7308 |
index := nativeContext argAt:2. |
|
7309 |
||
7310 |
comboBox model list addLast:(Java as_ST_String:jString). |
|
7311 |
comboBox model changed:#list. |
|
7312 |
||
7313 |
"Created: / 7.1.1998 / 21:45:12 / cg" |
|
7314 |
"Modified: / 24.1.1998 / 18:51:32 / cg" |
|
7315 |
! |
|
7316 |
||
7317 |
_WChoicePeer_create:nativeContext |
|
7318 |
|jChoicePeer jChoice jFrame frame comboBox| |
|
7319 |
||
7320 |
jChoicePeer := nativeContext receiver. |
|
7321 |
jChoice := jChoicePeer instVarNamed:'target'. |
|
7322 |
||
7323 |
jFrame := nativeContext argAt:1. |
|
7324 |
frame := jFrame instVarNamed:'pData'. |
|
7325 |
||
7326 |
comboBox := ComboListView in:frame. |
|
7327 |
comboBox model:(SelectionInList new list:(OrderedCollection new)). |
|
285 | 7328 |
comboBox action:[:index | |
7329 |
jChoicePeer |
|
7330 |
perform:#'handleAction(I)V' |
|
7331 |
with:(comboBox model selectionIndex - 1) |
|
7332 |
]. |
|
284 | 7333 |
|
7334 |
self createdWindowsView:comboBox for:jChoicePeer. |
|
7335 |
||
7336 |
WindowCreationTrace == true ifTrue:[ |
|
7337 |
'WChoicePeer_create: ' print. frame print. ' -> ' print. comboBox printNL. |
|
7338 |
]. |
|
7339 |
||
7340 |
"Created: / 7.1.1998 / 21:44:31 / cg" |
|
285 | 7341 |
"Modified: / 28.1.1998 / 23:19:17 / cg" |
284 | 7342 |
! |
7343 |
||
440 | 7344 |
_WChoicePeer_remove:nativeContext |
7345 |
"/ void remove (int) |
|
7346 |
UnimplementedNativeMethodSignal raise |
|
7347 |
||
7348 |
"Created: / 12.11.1998 / 19:12:20 / cg" |
|
7349 |
! |
|
7350 |
||
284 | 7351 |
_WChoicePeer_reshape:nativeContext |
7352 |
self pReshape:nativeContext. |
|
7353 |
^ self. |
|
7354 |
||
7355 |
"Modified: / 15.8.1997 / 15:36:29 / cg" |
|
7356 |
"Created: / 7.1.1998 / 21:46:18 / cg" |
|
7357 |
! |
|
7358 |
||
7359 |
_WChoicePeer_select:nativeContext |
|
7360 |
|comboBox index| |
|
7361 |
||
7362 |
comboBox := self viewForWPeer:nativeContext. |
|
7363 |
||
7364 |
index := nativeContext argAt:1. |
|
7365 |
comboBox model selectionIndex:(index + 1). "/ JAVA indexing starts at 0 |
|
7366 |
||
7367 |
"Created: / 7.1.1998 / 21:45:43 / cg" |
|
7368 |
"Modified: / 25.1.1998 / 09:55:05 / cg" |
|
7369 |
! |
|
7370 |
||
440 | 7371 |
_WClipboard_getClipboardText:nativeContext |
7372 |
"/ java.lang.String getClipboardText () |
|
7373 |
UnimplementedNativeMethodSignal raise |
|
7374 |
||
7375 |
"Created: / 12.11.1998 / 19:15:45 / cg" |
|
7376 |
! |
|
7377 |
||
284 | 7378 |
_WClipboard_init:nativeContext |
7379 |
"/ self halt. |
|
7380 |
||
7381 |
"Modified: / 18.3.1997 / 18:43:18 / cg" |
|
7382 |
"Created: / 4.1.1998 / 19:03:59 / cg" |
|
7383 |
! |
|
7384 |
||
440 | 7385 |
_WClipboard_setClipboardText:nativeContext |
7386 |
"/ void setClipboardText (java.awt.datatransfer.StringSelection) |
|
7387 |
UnimplementedNativeMethodSignal raise |
|
7388 |
||
7389 |
"Created: / 12.11.1998 / 19:15:31 / cg" |
|
7390 |
! |
|
7391 |
||
284 | 7392 |
_WColor_getDefaultColor:nativeContext |
7393 |
|clrIndex jClr clr | |
|
7394 |
||
7395 |
clrIndex := nativeContext argAt:1. |
|
7396 |
"/ windows defaults: |
|
7397 |
"/ 1: view background |
|
7398 |
||
7399 |
clrIndex == 1 ifTrue:[ |
|
7400 |
clr := View defaultViewBackgroundColor. |
|
7401 |
clr isColor ifFalse:[ |
|
7402 |
clr := Color gray:50. |
|
7403 |
]. |
|
7404 |
]. |
|
7405 |
clrIndex == 2 ifTrue:[ |
|
7406 |
clr := Color black. |
|
7407 |
]. |
|
7408 |
clr isNil ifTrue:[ |
|
7409 |
self halt. |
|
7410 |
self internalError:'breakpoint'. |
|
7411 |
^ nil. |
|
7412 |
]. |
|
7413 |
||
7414 |
clr := clr on:(Screen current). |
|
7415 |
||
7416 |
jClr := (Java classForName:'java.awt.Color') new. |
|
7417 |
||
7418 |
jClr instVarNamed:'pData' put:clr. |
|
7419 |
jClr instVarNamed:'value' put:(clr rgbValue). |
|
7420 |
"/ self halt. |
|
7421 |
^ jClr. |
|
7422 |
||
7423 |
"Created: / 15.8.1997 / 15:38:10 / cg" |
|
7424 |
"Modified: / 4.1.1998 / 18:06:51 / cg" |
|
7425 |
! |
|
7426 |
||
440 | 7427 |
_WComponentPeer__beginValidate:nativeContext |
7428 |
"/ void _beginValidate () |
|
7429 |
UnimplementedNativeMethodSignal raise |
|
7430 |
||
7431 |
"Created: / 12.11.1998 / 19:10:08 / cg" |
|
7432 |
! |
|
7433 |
||
284 | 7434 |
_WComponentPeer__dispose:nativeContext |
7435 |
|view jPeer| |
|
7436 |
||
7437 |
view := self viewForWPeer:nativeContext. |
|
7438 |
||
7439 |
Object errorSignal catch:[ |
|
7440 |
view destroy. |
|
7441 |
]. |
|
7442 |
JavaWindowGroup removeView:view. |
|
7443 |
||
7444 |
jPeer := nativeContext receiver. |
|
7445 |
jPeer instVarNamed:'pData' put:0. |
|
7446 |
||
7447 |
"Created: / 7.1.1998 / 22:36:25 / cg" |
|
7448 |
"Modified: / 25.1.1998 / 16:43:06 / cg" |
|
7449 |
! |
|
7450 |
||
7451 |
_WComponentPeer__setBackground:nativeContext |
|
7452 |
|rgb clr view| |
|
7453 |
||
7454 |
view := self viewForWPeer:nativeContext. |
|
483 | 7455 |
view isNil ifTrue:[^ self]. |
284 | 7456 |
|
7457 |
rgb := nativeContext argAt:1. |
|
7458 |
clr := Color rgbValue:rgb. |
|
7459 |
||
7460 |
"/ self halt. |
|
7461 |
"/ self internalError:'breakPoint'. |
|
7462 |
||
7463 |
clr := clr on:(view device). |
|
7464 |
||
7465 |
"/ (view superView isMemberOf:JavaEmbeddedFrameView) ifTrue:[ |
|
7466 |
"/ view viewBackground:(view superView viewBackground). |
|
7467 |
"/ view backgroundPaint:(view superView viewBackground). |
|
7468 |
"/ ] ifFalse:[ |
|
7469 |
"/ (view isMemberOf:JavaView) ifTrue:[ |
|
7470 |
"/ view viewBackground:clr. |
|
7471 |
"/ view backgroundPaint:clr. |
|
7472 |
"/ ] |
|
7473 |
"/ ]. |
|
7474 |
||
7475 |
(view isKindOf:ScrollableView) ifTrue:[ |
|
483 | 7476 |
view := view scrolledView |
284 | 7477 |
]. |
7478 |
view viewBackground:clr. |
|
7479 |
view backgroundPaint:clr. |
|
7480 |
||
7481 |
"Created: / 4.1.1998 / 18:07:39 / cg" |
|
483 | 7482 |
"Modified: / 4.12.1998 / 17:26:06 / cg" |
284 | 7483 |
! |
7484 |
||
7485 |
_WComponentPeer__setForeground:nativeContext |
|
7486 |
|rgb clr view| |
|
7487 |
||
7488 |
view := self viewForWPeer:nativeContext. |
|
7489 |
||
7490 |
rgb := nativeContext argAt:1. |
|
7491 |
clr := Color rgbValue:rgb. |
|
7492 |
||
7493 |
"/ self halt. |
|
7494 |
"/ self internalError:'breakPoint'. |
|
7495 |
||
7496 |
clr := clr on:(view device). |
|
7497 |
||
7498 |
view paint:clr. |
|
7499 |
||
7500 |
"Created: / 4.1.1998 / 18:08:13 / cg" |
|
7501 |
"Modified: / 8.1.1998 / 17:32:45 / cg" |
|
7502 |
! |
|
7503 |
||
7504 |
_WComponentPeer_disable:nativeContext |
|
7505 |
|view| |
|
7506 |
||
7507 |
view := self viewForWPeer:nativeContext. |
|
7508 |
||
7509 |
Object errorSignal handle:[:ex | |
|
7510 |
] do:[ |
|
7511 |
view disable |
|
7512 |
] |
|
7513 |
||
7514 |
"Created: / 6.1.1998 / 18:26:36 / cg" |
|
7515 |
"Modified: / 8.1.1998 / 17:32:53 / cg" |
|
7516 |
! |
|
7517 |
||
7518 |
_WComponentPeer_enable:nativeContext |
|
7519 |
|view| |
|
7520 |
||
7521 |
view := self viewForWPeer:nativeContext. |
|
7522 |
||
7523 |
Object errorSignal handle:[:ex | |
|
7524 |
] do:[ |
|
7525 |
view enable |
|
7526 |
] |
|
7527 |
||
7528 |
"Modified: / 8.1.1998 / 17:32:53 / cg" |
|
7529 |
"Created: / 13.1.1998 / 23:08:05 / cg" |
|
7530 |
! |
|
7531 |
||
440 | 7532 |
_WComponentPeer_endValidate:nativeContext |
7533 |
"/ void endValidate () |
|
7534 |
UnimplementedNativeMethodSignal raise |
|
7535 |
||
7536 |
"Created: / 12.11.1998 / 19:10:20 / cg" |
|
7537 |
! |
|
7538 |
||
7539 |
_WComponentPeer_getLocationOnScreen:nativeContext |
|
7540 |
"/ java.awt.Point getLocationOnScreen () |
|
480 | 7541 |
|
7542 |
|view p jP| |
|
7543 |
||
7544 |
view := self viewForWPeer:nativeContext. |
|
7545 |
view isNil ifTrue:[^ nil]. |
|
7546 |
||
7547 |
p := view originRelativeTo:nil. |
|
7548 |
jP := (Java classForName:'java.awt.Point') newCleared. |
|
7549 |
jP instVarNamed:'x' put:p x. |
|
7550 |
jP instVarNamed:'y' put:p y. |
|
7551 |
^ jP |
|
7552 |
||
7553 |
"Modified: / 3.12.1998 / 21:16:05 / cg" |
|
440 | 7554 |
! |
7555 |
||
284 | 7556 |
_WComponentPeer_handleEvent:nativeContext |
7557 |
"this is invoked by java, to let a widget handle any event which |
|
7558 |
was not consumed (eaten) by java. |
|
7559 |
If the view in question is some ST-widget, forward it. |
|
7560 |
Ignore for JavaViews." |
|
7561 |
||
7562 |
|view jEv stEv| |
|
7563 |
||
7564 |
view := self viewForWPeer:nativeContext. |
|
7565 |
view notNil ifTrue:[ |
|
474 | 7566 |
jEv := nativeContext argAt:1. |
7567 |
stEv := jEv instVarNamed:'data'. |
|
7568 |
(stEv notNil and:[stEv ~~ 0]) ifTrue:[ |
|
483 | 7569 |
view isJavaView ifFalse:[ |
316 | 7570 |
EventTrace == true ifTrue:[ |
7571 |
('JAVA: WComponent - handleEvent: ' , stEv type , ' for ' , view printString) infoPrintCR. |
|
7572 |
]. |
|
474 | 7573 |
view dispatchEvent:stEv. |
316 | 7574 |
^ self. |
7575 |
] |
|
7576 |
] |
|
7577 |
]. |
|
7578 |
EventTrace == true ifTrue:[ |
|
7579 |
('JAVA: WComponent - handleEvent ignored') infoPrintCR. |
|
7580 |
] |
|
284 | 7581 |
|
7582 |
"Created: / 6.1.1998 / 21:10:17 / cg" |
|
483 | 7583 |
"Modified: / 4.12.1998 / 19:42:54 / cg" |
284 | 7584 |
! |
7585 |
||
7586 |
_WComponentPeer_hide:nativeContext |
|
7587 |
|view| |
|
7588 |
||
7589 |
view := self viewForWPeer:nativeContext. |
|
483 | 7590 |
"/ view isPopUpView ifTrue:[self halt]. |
284 | 7591 |
|
7592 |
Object errorSignal handle:[:ex | |
|
7593 |
] do:[ |
|
483 | 7594 |
view beInvisible |
284 | 7595 |
] |
7596 |
||
7597 |
"Created: / 7.1.1998 / 22:35:32 / cg" |
|
483 | 7598 |
"Modified: / 4.12.1998 / 17:53:41 / cg" |
284 | 7599 |
! |
7600 |
||
391 | 7601 |
_WComponentPeer_nativeHandleEvent:nativeContext |
7602 |
"this is invoked by java, to let a widget handle any event which |
|
7603 |
was not consumed (eaten) by java. |
|
7604 |
If the view in question is some ST-widget, forward it. |
|
7605 |
Ignore for JavaViews." |
|
7606 |
||
7607 |
|view jEv stEv| |
|
7608 |
||
7609 |
^self. |
|
7610 |
view := self viewForWPeer:nativeContext. |
|
7611 |
view notNil ifTrue:[ |
|
7612 |
(view isKindOf:JavaView) ifFalse:[ |
|
7613 |
jEv := nativeContext argAt:1. |
|
7614 |
stEv := jEv instVarNamed:'data'. |
|
7615 |
(stEv notNil and:[stEv ~~ 0]) ifTrue:[ |
|
7616 |
EventTrace == true ifTrue:[ |
|
7617 |
('JAVA: WComponent - handleEvent: ' , stEv type , ' for ' , view printString) infoPrintCR. |
|
7618 |
]. |
|
7619 |
stEv sendEventWithFocusOn:nil. |
|
7620 |
^ self. |
|
7621 |
] |
|
7622 |
] |
|
7623 |
]. |
|
7624 |
EventTrace == true ifTrue:[ |
|
7625 |
('JAVA: WComponent - handleEvent ignored') infoPrintCR. |
|
7626 |
] |
|
7627 |
||
7628 |
"Created: / 19.10.1998 / 21:26:16 / cg" |
|
7629 |
"Modified: / 19.10.1998 / 23:26:37 / cg" |
|
7630 |
! |
|
7631 |
||
284 | 7632 |
_WComponentPeer_requestFocus:nativeContext |
7633 |
|view| |
|
7634 |
||
7635 |
view := self viewForWPeer:nativeContext. |
|
318 | 7636 |
"/ 'getFocus - ' print. view displayString printCR. |
284 | 7637 |
|
483 | 7638 |
"/ view getKeyboardFocus |
284 | 7639 |
|
7640 |
"Created: / 7.1.1998 / 22:30:03 / cg" |
|
483 | 7641 |
"Modified: / 4.12.1998 / 19:42:18 / cg" |
284 | 7642 |
! |
7643 |
||
7644 |
_WComponentPeer_reshape:nativeContext |
|
7645 |
self commonReshapeComponent:nativeContext |
|
7646 |
||
7647 |
"Modified: / 18.3.1997 / 19:30:21 / cg" |
|
7648 |
"Created: / 4.1.1998 / 18:01:11 / cg" |
|
7649 |
! |
|
7650 |
||
7651 |
_WComponentPeer_setCursor:nativeContext |
|
7652 |
|view| |
|
7653 |
||
7654 |
view := self viewForWPeer:nativeContext. |
|
7655 |
"/ self halt. |
|
7656 |
||
7657 |
"Created: / 5.1.1998 / 01:52:30 / cg" |
|
7658 |
"Modified: / 25.1.1998 / 01:21:52 / cg" |
|
7659 |
! |
|
7660 |
||
7661 |
_WComponentPeer_setFont:nativeContext |
|
7662 |
|view| |
|
7663 |
||
7664 |
view := self viewForWPeer:nativeContext. |
|
7665 |
"/ self halt. |
|
7666 |
||
7667 |
"Created: / 5.1.1998 / 00:55:17 / cg" |
|
7668 |
"Modified: / 25.1.1998 / 01:22:19 / cg" |
|
7669 |
! |
|
7670 |
||
7671 |
_WComponentPeer_setZOrderPosition:nativeContext |
|
7672 |
|view| |
|
7673 |
||
7674 |
view := self viewForWPeer:nativeContext. |
|
7675 |
"/ self unimplementedNativeMethod. |
|
7676 |
"/ self halt. |
|
7677 |
"/ self internalError:'breakPoint' |
|
7678 |
||
7679 |
"Created: / 4.1.1998 / 17:59:26 / cg" |
|
7680 |
"Modified: / 25.1.1998 / 01:22:32 / cg" |
|
7681 |
! |
|
7682 |
||
7683 |
_WComponentPeer_show:nativeContext |
|
7684 |
|view| |
|
7685 |
||
7686 |
view := self viewForWPeer:nativeContext. |
|
7687 |
||
7688 |
"/ frame views are under my browsers own control |
|
7689 |
(view isMemberOf:JavaEmbeddedFrameView) ifFalse:[ |
|
7690 |
view beVisible. |
|
7691 |
view realize. |
|
7692 |
]. |
|
7693 |
||
7694 |
"/ view windowGroup notNil ifTrue:[ |
|
7695 |
"/ windowServer addGroup:(view windowGroup) |
|
7696 |
"/ ]. |
|
7697 |
||
7698 |
^ nil |
|
7699 |
||
7700 |
"/ self halt. |
|
7701 |
||
7702 |
"Created: / 5.1.1998 / 01:26:22 / cg" |
|
483 | 7703 |
"Modified: / 4.12.1998 / 17:43:53 / cg" |
284 | 7704 |
! |
7705 |
||
7706 |
_WComponentPeer_start:nativeContext |
|
7707 |
"/ self halt. |
|
7708 |
||
7709 |
"Modified: / 18.3.1997 / 18:43:18 / cg" |
|
7710 |
"Created: / 5.1.1998 / 00:58:40 / cg" |
|
7711 |
! |
|
7712 |
||
7713 |
_WDefaultFontCharset_canConvert:nativeContext |
|
7714 |
^ 1 |
|
7715 |
||
7716 |
"Modified: / 21.8.1997 / 15:56:57 / cg" |
|
7717 |
"Created: / 5.1.1998 / 01:55:47 / cg" |
|
7718 |
! |
|
7719 |
||
7720 |
_WDialogPeer__hide:nativeContext |
|
7721 |
|dialog| |
|
7722 |
||
7723 |
dialog := self viewForWPeer:nativeContext. |
|
7724 |
||
7725 |
dialog hide. |
|
7726 |
||
7727 |
"Created: / 7.1.1998 / 22:34:10 / cg" |
|
7728 |
"Modified: / 8.1.1998 / 17:34:10 / cg" |
|
7729 |
! |
|
7730 |
||
7731 |
_WDialogPeer__show:nativeContext |
|
7732 |
|dialog| |
|
7733 |
||
7734 |
dialog := self viewForWPeer:nativeContext. |
|
7735 |
"/ |
|
7736 |
"/ show does not work (yet); must setup windowgroup |
|
7737 |
"/ for it to get events ... |
|
480 | 7738 |
"/ dialog realize. |
7739 |
||
7740 |
dialog show. |
|
284 | 7741 |
|
7742 |
"Created: / 7.1.1998 / 21:52:15 / cg" |
|
480 | 7743 |
"Modified: / 3.12.1998 / 20:40:05 / cg" |
284 | 7744 |
! |
7745 |
||
7746 |
_WDialogPeer_create:nativeContext |
|
7747 |
|jDialogPeer dialog| |
|
7748 |
||
7749 |
jDialogPeer := nativeContext receiver. |
|
7750 |
||
7751 |
dialog := ModalBox new. |
|
7752 |
jDialogPeer instVarNamed:'pData' put:dialog. |
|
7753 |
||
7754 |
self createdWindowsView:dialog for:jDialogPeer. |
|
7755 |
dialog windowGroup:JavaWindowGroup. |
|
7756 |
JavaWindowGroup addTopView:dialog. |
|
7757 |
||
7758 |
WindowCreationTrace == true ifTrue:[ |
|
7759 |
'WDialogPeer_create: ' print. dialog printNL. |
|
7760 |
]. |
|
7761 |
||
7762 |
"Created: / 7.1.1998 / 21:51:00 / cg" |
|
7763 |
"Modified: / 15.1.1998 / 16:12:44 / cg" |
|
7764 |
! |
|
7765 |
||
440 | 7766 |
_WDrawingSurfaceInfo_getDepth:nativeContext |
7767 |
"/ int getDepth () |
|
7768 |
UnimplementedNativeMethodSignal raise |
|
7769 |
||
7770 |
"Created: / 12.11.1998 / 19:21:00 / cg" |
|
7771 |
! |
|
7772 |
||
7773 |
_WDrawingSurfaceInfo_getHBitmap:nativeContext |
|
7774 |
"/ int getHBitmap () |
|
7775 |
UnimplementedNativeMethodSignal raise |
|
7776 |
||
7777 |
"Created: / 12.11.1998 / 19:20:32 / cg" |
|
7778 |
! |
|
7779 |
||
7780 |
_WDrawingSurfaceInfo_getHDC:nativeContext |
|
7781 |
"/ int getHDC () |
|
7782 |
UnimplementedNativeMethodSignal raise |
|
7783 |
||
7784 |
"Created: / 12.11.1998 / 19:20:50 / cg" |
|
7785 |
! |
|
7786 |
||
7787 |
_WDrawingSurfaceInfo_getHPalette:nativeContext |
|
7788 |
"/ int getHPalette () |
|
7789 |
UnimplementedNativeMethodSignal raise |
|
7790 |
||
7791 |
"Created: / 12.11.1998 / 19:21:07 / cg" |
|
7792 |
! |
|
7793 |
||
7794 |
_WDrawingSurfaceInfo_getHWnd:nativeContext |
|
7795 |
"/ int getHWnd () |
|
7796 |
UnimplementedNativeMethodSignal raise |
|
7797 |
||
7798 |
"Created: / 12.11.1998 / 19:20:23 / cg" |
|
7799 |
! |
|
7800 |
||
7801 |
_WDrawingSurfaceInfo_getPBits:nativeContext |
|
7802 |
"/ int getPBits () |
|
7803 |
UnimplementedNativeMethodSignal raise |
|
7804 |
||
7805 |
"Created: / 12.11.1998 / 19:20:41 / cg" |
|
7806 |
! |
|
7807 |
||
7808 |
_WDrawingSurfaceInfo_lock:nativeContext |
|
7809 |
"/ int lock () |
|
7810 |
UnimplementedNativeMethodSignal raise |
|
7811 |
||
7812 |
"Created: / 12.11.1998 / 19:20:00 / cg" |
|
7813 |
! |
|
7814 |
||
7815 |
_WDrawingSurfaceInfo_unlock:nativeContext |
|
7816 |
"/ void unlock () |
|
7817 |
UnimplementedNativeMethodSignal raise |
|
7818 |
||
7819 |
"Created: / 12.11.1998 / 19:20:13 / cg" |
|
7820 |
! |
|
7821 |
||
7822 |
_WEmbeddedFramePeer_create:nativeContext |
|
7823 |
"/ void create (sun.awt.windows.WComponentPeer) |
|
7824 |
UnimplementedNativeMethodSignal raise |
|
7825 |
||
7826 |
"Created: / 12.11.1998 / 19:16:09 / cg" |
|
7827 |
! |
|
7828 |
||
284 | 7829 |
_WFileDialogPeer_show:nativeContext |
7830 |
|jDialogPeer jDialog dialogView stDialog |
|
7831 |
title dir pattern f| |
|
7832 |
||
7833 |
jDialogPeer := nativeContext receiver. |
|
7834 |
jDialog := jDialogPeer instVarNamed:'target'. |
|
7835 |
dialogView := jDialogPeer instVarNamed:'pData'. |
|
7836 |
||
7837 |
stDialog := FileSelectionBox new. |
|
7838 |
||
7839 |
dir := jDialog instVarNamed:'dir'. |
|
7840 |
dir notNil ifTrue:[ |
|
7841 |
stDialog directory:(Java as_ST_String:dir). |
|
7842 |
]. |
|
7843 |
pattern := jDialog instVarNamed:'file'. |
|
7844 |
pattern notNil ifTrue:[ |
|
7845 |
stDialog pattern:(Java as_ST_String:pattern). |
|
7846 |
]. |
|
7847 |
title := jDialog instVarNamed:'title'. |
|
7848 |
title notNil ifTrue:[ |
|
7849 |
stDialog title:(Java as_ST_String:title). |
|
7850 |
stDialog label:(Java as_ST_String:title). |
|
7851 |
]. |
|
7852 |
||
7853 |
stDialog show. |
|
7854 |
||
7855 |
stDialog accepted ifTrue:[ |
|
7856 |
f := stDialog pathName. |
|
7857 |
||
7858 |
"/ cannot use the one below - it has a builtIn fileSeparator if '\' (sigh) |
|
7859 |
"/ jDialogPeer perform:#'handleSelected(Ljava/lang/String;)V' with:(Java as_String:f). |
|
7860 |
||
7861 |
jDialog |
|
7862 |
perform:#'setFile(Ljava/lang/String;)V' |
|
7863 |
with:(Java as_String:(f asFilename baseName)). |
|
7864 |
jDialog |
|
7865 |
perform:#'setDirectory(Ljava/lang/String;)V' |
|
7866 |
with:(Java as_String:(f asFilename directoryName , Filename separator asString)). |
|
7867 |
jDialog |
|
7868 |
perform:#'setVisible(Z)V' |
|
7869 |
with:0. |
|
7870 |
] ifFalse:[ |
|
7871 |
jDialogPeer |
|
7872 |
perform:#'handleCancel()V' |
|
7873 |
]. |
|
7874 |
"/ self halt. |
|
7875 |
||
7876 |
"Created: / 7.1.1998 / 22:38:45 / cg" |
|
7877 |
"Modified: / 15.1.1998 / 13:04:05 / cg" |
|
7878 |
! |
|
7879 |
||
440 | 7880 |
_WFontMetrics_bytesWidth:nativeContext |
7881 |
"/ int bytesWidth (byte[] int int) |
|
7882 |
UnimplementedNativeMethodSignal raise |
|
7883 |
||
7884 |
"Created: / 12.11.1998 / 19:11:46 / cg" |
|
7885 |
! |
|
7886 |
||
284 | 7887 |
_WFontMetrics_getMFCharSegmentWidth:nativeContext |
7888 |
"get multi-font string-segment width. |
|
7889 |
Not yet supported - use standard strings width" |
|
7890 |
||
7891 |
|jMetrics jFont jFontDescr stFont w |
|
7892 |
bool1 cp offs lenght bp int1| |
|
7893 |
||
7894 |
jMetrics := nativeContext receiver. |
|
7895 |
jFont := nativeContext argAt:1. |
|
7896 |
jFontDescr := nativeContext argAt:2. |
|
7897 |
bool1 := nativeContext argAt:3. |
|
7898 |
cp := nativeContext argAt:4. |
|
7899 |
offs := nativeContext argAt:5. |
|
7900 |
lenght := nativeContext argAt:6. |
|
7901 |
bp := nativeContext argAt:7. |
|
7902 |
int1 := nativeContext argAt:8. |
|
7903 |
||
7904 |
stFont := jFont instVarNamed:'pData'. |
|
7905 |
(stFont isNil or:[stFont == 0]) ifTrue:[ |
|
7906 |
self halt |
|
7907 |
]. |
|
7908 |
||
7909 |
stFont device isNil ifTrue:[ |
|
7910 |
stFont := stFont on:Display. |
|
7911 |
jFont instVarNamed:'pData' put:stFont. |
|
7912 |
]. |
|
7913 |
w := stFont widthOf:cp from:offs+1 to:offs+lenght. |
|
7914 |
^ w. |
|
7915 |
||
7916 |
"Created: / 5.1.1998 / 01:57:45 / cg" |
|
7917 |
"Modified: / 13.1.1998 / 23:44:03 / cg" |
|
7918 |
! |
|
7919 |
||
7920 |
_WFontMetrics_init:nativeContext |
|
7921 |
|jMetrics jFont stFont widths family name style size| |
|
7922 |
||
7923 |
jMetrics := nativeContext receiver. |
|
7924 |
jFont := jMetrics instVarNamed:'font'. |
|
7925 |
||
7926 |
family := jFont instVarNamed:'family'. |
|
7927 |
family := Java as_ST_String:family. |
|
7928 |
||
7929 |
name := jFont instVarNamed:'name'. |
|
7930 |
name := Java as_ST_String:name. |
|
7931 |
||
7932 |
style := jFont instVarNamed:'style'. |
|
7933 |
size := jFont instVarNamed:'size'. |
|
7934 |
||
7935 |
stFont := Font family:family size:size. |
|
7936 |
stFont isNil ifTrue:[ |
|
7937 |
stFont := Font family:'helvetica' size:size. |
|
7938 |
]. |
|
7939 |
stFont := stFont on:Display. |
|
7940 |
||
7941 |
"/ stFont := jFont instVarNamed:'pData'. |
|
7942 |
"/ stFont isNil ifTrue:[ |
|
7943 |
"/ self halt |
|
7944 |
"/ ]. |
|
7945 |
||
7946 |
stFont := stFont on:Display. |
|
7947 |
jFont instVarNamed:'pData' put:stFont. |
|
7948 |
||
7949 |
jMetrics instVarNamed:'ascent' put:stFont ascent. |
|
7950 |
jMetrics instVarNamed:'descent' put:stFont descent. |
|
7951 |
jMetrics instVarNamed:'leading' put:0. |
|
7952 |
jMetrics instVarNamed:'height' put:stFont height. |
|
7953 |
jMetrics instVarNamed:'maxAscent' put:stFont maxAscent. |
|
7954 |
jMetrics instVarNamed:'maxDescent' put:stFont maxDescent. |
|
7955 |
jMetrics instVarNamed:'maxHeight' put:stFont maxHeight. |
|
7956 |
jMetrics instVarNamed:'maxAdvance' put:stFont maxWidth. |
|
7957 |
||
7958 |
widths := Array new:256. |
|
7959 |
0 to:255 do:[:i | |
|
7960 |
widths at:(i+1) put:(stFont widthOf:(Character value:i)) |
|
7961 |
]. |
|
7962 |
jMetrics instVarNamed:'widths' put:widths. |
|
7963 |
"/ self halt. |
|
7964 |
||
7965 |
"Modified: / 8.8.1997 / 12:06:53 / cg" |
|
7966 |
"Created: / 5.1.1998 / 01:54:29 / cg" |
|
7967 |
! |
|
7968 |
||
7969 |
_WFontMetrics_needsConversion:nativeContext |
|
7970 |
|jFont jFontDescr stFont| |
|
7971 |
||
7972 |
jFont := nativeContext argAt:1. |
|
7973 |
jFontDescr := nativeContext argAt:2. |
|
7974 |
||
7975 |
stFont := jFont instVarNamed:'pData'. |
|
7976 |
"/ stFont isNil ifTrue:[ |
|
7977 |
"/ self halt |
|
7978 |
"/ ]. |
|
7979 |
"/ stFont device isNil ifTrue:[ |
|
7980 |
"/ stFont := stFont on:Display. |
|
7981 |
"/ jFont instVarNamed:'pData' put:stFont. |
|
7982 |
"/ ]. |
|
7983 |
"/ |
|
7984 |
||
7985 |
^ 0 |
|
7986 |
||
7987 |
"Modified: / 17.8.1997 / 17:16:29 / cg" |
|
7988 |
"Created: / 5.1.1998 / 01:56:42 / cg" |
|
7989 |
! |
|
7990 |
||
341 | 7991 |
_WFramePeer__setIconImage:nativeContext |
7992 |
|frame imgRep image| |
|
7993 |
||
7994 |
frame := self viewForWPeer:nativeContext. |
|
7995 |
imgRep := nativeContext argAt:1. |
|
7996 |
imgRep notNil ifTrue:[ |
|
7997 |
image := imgRep instVarNamed:'pData'. |
|
7998 |
image notNil ifTrue:[ |
|
7999 |
frame icon:image. |
|
8000 |
] |
|
8001 |
]. |
|
8002 |
||
8003 |
"Created: / 27.4.1998 / 17:15:09 / cg" |
|
8004 |
"Modified: / 27.4.1998 / 17:18:24 / cg" |
|
8005 |
! |
|
8006 |
||
284 | 8007 |
_WFramePeer_create:nativeContext |
474 | 8008 |
|jFramePeer jFrame top frame pDataIdx| |
284 | 8009 |
|
8010 |
jFramePeer := nativeContext receiver. |
|
8011 |
||
8012 |
"/ for now: a kludge to create an embedded frame for |
|
8013 |
"/ mozillaFrames |
|
8014 |
||
8015 |
jFrame := jFramePeer instVarNamed:'target'. |
|
8016 |
(jFrame notNil |
|
8017 |
and:[(pDataIdx := jFrame class instVarOffsetOf:'pData') notNil]) |
|
8018 |
ifTrue:[ |
|
8019 |
((frame := jFrame instVarAt:pDataIdx) notNil |
|
8020 |
and:[frame ~~ 0]) ifTrue:[ |
|
318 | 8021 |
WindowCreationTrace == true ifTrue:[ |
8022 |
'JAVA: targetFrame view already created: ' infoPrintCR. |
|
8023 |
]. |
|
284 | 8024 |
"/ sigh; pData was renamed to pNativeWidget in jdk1.2 ... |
8025 |
pDataIdx := jFramePeer class instVarOffsetOf:'pNativeWidget'. |
|
8026 |
pDataIdx isNil ifTrue:[ |
|
8027 |
"/ ok, we are < 1.2 |
|
8028 |
pDataIdx := jFramePeer class instVarOffsetOf:'pData'. |
|
8029 |
]. |
|
8030 |
jFramePeer instVarAt:pDataIdx put:frame. |
|
8031 |
] |
|
8032 |
] ifFalse:[ |
|
8033 |
frame := jFramePeer instVarNamed:'pData' |
|
8034 |
]. |
|
8035 |
||
8036 |
(frame notNil and:[frame ~~ 0]) ifTrue:[ |
|
318 | 8037 |
WindowCreationTrace == true ifTrue:[ |
8038 |
'JAVA: frame view already created: ' infoPrint. |
|
8039 |
jFramePeer class name infoPrintCR. |
|
8040 |
]. |
|
284 | 8041 |
] ifFalse:[ |
474 | 8042 |
"/ OLD |
8043 |
"/ frame := StandardSystemView new. |
|
8044 |
"/ self createdWindowsView:frame for:jFramePeer. |
|
8045 |
"/ JavaWindowGroup addTopView:frame. |
|
8046 |
||
8047 |
frame := JavaTopView new. |
|
8048 |
frame delegate:self. |
|
8049 |
frame javaPeer:jFramePeer. |
|
284 | 8050 |
self createdWindowsView:frame for:jFramePeer. |
8051 |
JavaWindowGroup addTopView:frame. |
|
474 | 8052 |
|
8053 |
"/ top := StandardSystemView new. |
|
8054 |
"/ frame := JavaView origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
8055 |
"/ frame delegate:self. |
|
8056 |
"/ frame javaPeer:jFramePeer. |
|
8057 |
"/ self createdWindowsView:frame for:jFramePeer. |
|
8058 |
"/ JavaWindowGroup addTopView:top. |
|
8059 |
||
284 | 8060 |
]. |
8061 |
||
8062 |
WindowCreationTrace == true ifTrue:[ |
|
8063 |
'JAVA: WFramePeer_create: ' print. jFramePeer displayString print. |
|
8064 |
' frame: ' print. frame printNL. |
|
8065 |
]. |
|
8066 |
||
8067 |
"Created: / 4.1.1998 / 17:56:39 / cg" |
|
474 | 8068 |
"Modified: / 3.12.1998 / 00:10:21 / cg" |
284 | 8069 |
! |
8070 |
||
8071 |
_WFramePeer_setMenuBar0:nativeContext |
|
8072 |
|frame jMenuBarPeer menuPanel| |
|
8073 |
||
8074 |
frame := self viewForWPeer:nativeContext. |
|
8075 |
||
8076 |
jMenuBarPeer := nativeContext argAt:1. |
|
8077 |
jMenuBarPeer isNil ifTrue:[ |
|
8078 |
"/ mhmh - JAVA wants to remove the frames menuPanel. |
|
8079 |
"/ but I have no handle on it (for destroy). |
|
8080 |
"/ search it in subViews of the frame. |
|
8081 |
frame subViews copy do:[:v | |
|
8082 |
(v isKindOf:MenuPanel) ifTrue:[ |
|
8083 |
v destroy |
|
8084 |
] |
|
8085 |
] |
|
8086 |
] ifFalse:[ |
|
8087 |
menuPanel := jMenuBarPeer instVarNamed:'pData'. |
|
8088 |
||
8089 |
menuPanel origin:0.0@0.0 corner:1.0@(menuPanel preferredExtent y). |
|
8090 |
frame addSubView:menuPanel. |
|
8091 |
]. |
|
8092 |
^ nil |
|
8093 |
||
8094 |
"Created: / 7.1.1998 / 21:41:35 / cg" |
|
8095 |
"Modified: / 8.1.1998 / 17:35:04 / cg" |
|
8096 |
! |
|
8097 |
||
440 | 8098 |
_WGraphics__dispose:nativeContext |
8099 |
"/ void _dispose() |
|
8100 |
UnimplementedNativeMethodSignal raise |
|
8101 |
||
8102 |
"Created: / 12.11.1998 / 19:17:51 / cg" |
|
8103 |
! |
|
8104 |
||
284 | 8105 |
_WGraphics_changeClip:nativeContext |
391 | 8106 |
|gc x y w h r bool| |
284 | 8107 |
|
8108 |
gc := self gcForWGraphics:nativeContext. |
|
8109 |
||
8110 |
x := nativeContext argAt:1. |
|
8111 |
y := nativeContext argAt:2. |
|
8112 |
w := nativeContext argAt:3. |
|
8113 |
h := nativeContext argAt:4. |
|
8114 |
bool := (nativeContext argAt:5) ~~ 0. |
|
8115 |
||
391 | 8116 |
r := Rectangle left:x top:y width:w height:h. |
401 | 8117 |
"/ 'WGraphics_changeClip: ' infoPrint. r infoPrintCR. |
391 | 8118 |
gc clippingRectangle:r. |
284 | 8119 |
|
8120 |
"Created: / 6.1.1998 / 20:57:21 / cg" |
|
401 | 8121 |
"Modified: / 20.10.1998 / 19:40:10 / cg" |
284 | 8122 |
! |
8123 |
||
8124 |
_WGraphics_clearRect:nativeContext |
|
8125 |
|gc x y w h| |
|
8126 |
||
8127 |
gc := self gcForWGraphics:nativeContext. |
|
8128 |
"/ gc isNil ifTrue:[^ self]. |
|
8129 |
||
8130 |
gc realized ifFalse:[ |
|
8131 |
'JAVA: drawing on unrealized gc - ignored' infoPrintCR. |
|
8132 |
^ self |
|
8133 |
]. |
|
8134 |
||
8135 |
x := nativeContext argAt:1. |
|
8136 |
y := nativeContext argAt:2. |
|
8137 |
w := nativeContext argAt:3. |
|
8138 |
h := nativeContext argAt:4. |
|
8139 |
||
8140 |
"/ self halt. |
|
8141 |
"/ self internalError:'breakPoint'. |
|
8142 |
||
8143 |
gc clearRectangleX:x y:y width:w height:h. |
|
8144 |
||
8145 |
"Created: / 8.1.1998 / 00:16:00 / cg" |
|
8146 |
"Modified: / 8.1.1998 / 00:21:09 / cg" |
|
8147 |
! |
|
8148 |
||
440 | 8149 |
_WGraphics_close:nativeContext |
8150 |
"/ void close (sun.awt.windows.WPrintJob) |
|
8151 |
UnimplementedNativeMethodSignal raise |
|
8152 |
||
8153 |
"Created: / 12.11.1998 / 19:19:40 / cg" |
|
8154 |
! |
|
8155 |
||
337 | 8156 |
_WGraphics_copyArea:nativeContext |
8157 |
|gc srcX srcY w h deltaX deltaY| |
|
8158 |
||
8159 |
gc := self gcForWGraphics:nativeContext. |
|
8160 |
"/ gc isNil ifTrue:[^ self]. |
|
8161 |
||
8162 |
gc realized ifFalse:[ |
|
8163 |
'JAVA: copyArea on unrealized gc - ignored' infoPrintCR. |
|
8164 |
^ self |
|
8165 |
]. |
|
8166 |
||
8167 |
srcX := nativeContext argAt:1. |
|
8168 |
srcY := nativeContext argAt:2. |
|
8169 |
w := nativeContext argAt:3. |
|
8170 |
h := nativeContext argAt:4. |
|
8171 |
deltaX := nativeContext argAt:5. |
|
8172 |
deltaY := nativeContext argAt:6. |
|
8173 |
||
8174 |
gc |
|
8175 |
copyFrom:gc |
|
8176 |
x:srcX y:srcY |
|
8177 |
toX:srcX+deltaX y:srcY+deltaY |
|
8178 |
width:w height:h |
|
8179 |
||
8180 |
"Created: / 8.1.1998 / 00:16:00 / cg" |
|
8181 |
"Modified: / 9.4.1998 / 22:01:32 / cg" |
|
8182 |
! |
|
8183 |
||
284 | 8184 |
_WGraphics_createFromComponent:nativeContext |
8185 |
|jGraphics jWin view| |
|
8186 |
||
8187 |
jGraphics := nativeContext receiver. |
|
8188 |
jWin := nativeContext argAt:1. |
|
8189 |
||
8190 |
view := KnownWindows at:jWin ifAbsent:nil. |
|
8191 |
view isNil ifTrue:[ |
|
401 | 8192 |
self halt. |
8193 |
^ self |
|
8194 |
]. |
|
8195 |
view clippingRectangle:nil. |
|
284 | 8196 |
|
8197 |
"/ "/ just a consistency check ... |
|
8198 |
"/ (jWin instVarNamed:'xid') ~~ view ifTrue:[ |
|
8199 |
"/ self halt:'consistency check' |
|
8200 |
"/ ]. |
|
8201 |
||
8202 |
jGraphics instVarNamed:'pData' put:view. |
|
8203 |
||
8204 |
"Created: / 6.1.1998 / 20:55:18 / cg" |
|
401 | 8205 |
"Modified: / 20.10.1998 / 19:38:18 / cg" |
284 | 8206 |
! |
8207 |
||
8208 |
_WGraphics_createFromGraphics:nativeContext |
|
8209 |
|jGraphics graphics gc| |
|
8210 |
||
8211 |
jGraphics := nativeContext receiver. |
|
8212 |
graphics := nativeContext argAt:1. |
|
8213 |
gc := graphics instVarNamed:'pData'. |
|
8214 |
||
8215 |
jGraphics instVarNamed:'pData' put:gc. |
|
401 | 8216 |
gc clippingRectangle:nil. |
284 | 8217 |
|
8218 |
"Created: / 8.1.1998 / 00:47:39 / cg" |
|
401 | 8219 |
"Modified: / 20.10.1998 / 19:37:58 / cg" |
284 | 8220 |
! |
8221 |
||
440 | 8222 |
_WGraphics_createFromHDC:nativeContext |
8223 |
"/ void createFromHDC (int) |
|
8224 |
UnimplementedNativeMethodSignal raise |
|
8225 |
||
8226 |
"Created: / 12.11.1998 / 19:17:32 / cg" |
|
8227 |
! |
|
8228 |
||
8229 |
_WGraphics_createFromPrintJob:nativeContext |
|
8230 |
"/ void createFromPrintJob (sun.awt.windows.WPrintJob) |
|
8231 |
UnimplementedNativeMethodSignal raise |
|
8232 |
||
8233 |
"Created: / 12.11.1998 / 19:17:20 / cg" |
|
8234 |
! |
|
8235 |
||
284 | 8236 |
_WGraphics_dispose:nativeContext |
8237 |
|gc| |
|
8238 |
||
8239 |
gc := self gcForWGraphics:nativeContext. |
|
8240 |
gc isNil ifTrue:[^ self]. |
|
401 | 8241 |
gc clippingRectangle:nil. |
284 | 8242 |
|
8243 |
"Created: / 6.1.1998 / 20:58:38 / cg" |
|
401 | 8244 |
"Modified: / 20.10.1998 / 19:35:05 / cg" |
284 | 8245 |
! |
8246 |
||
8247 |
_WGraphics_drawArc:nativeContext |
|
8248 |
|gc x y w h startAngle endAngle| |
|
8249 |
||
8250 |
gc := self gcForWGraphics:nativeContext. |
|
8251 |
"/ gc isNil ifTrue:[^ self]. |
|
8252 |
gc realized ifFalse:[^ self]. |
|
8253 |
||
8254 |
x := nativeContext argAt:1. |
|
8255 |
y := nativeContext argAt:2. |
|
8256 |
w := nativeContext argAt:3. |
|
8257 |
h := nativeContext argAt:4. |
|
8258 |
startAngle := nativeContext argAt:5. |
|
8259 |
endAngle := nativeContext argAt:6. |
|
8260 |
||
8261 |
DrawOPTrace ifTrue:[ |
|
285 | 8262 |
'drawArc x/y= ' print. x print. '@' print. y print. |
8263 |
' w/h= ' print. w print. '@' print. h print. |
|
8264 |
' startAngle= ' print. startAngle print. ' endAngle= ' print. endAngle printCR. |
|
8265 |
]. |
|
8266 |
gc |
|
8267 |
displayArcX:x y:y |
|
8268 |
width:w height:h |
|
8269 |
from:startAngle angle:(endAngle - startAngle). |
|
284 | 8270 |
|
8271 |
"Created: / 6.1.1998 / 21:00:15 / cg" |
|
285 | 8272 |
"Modified: / 28.1.1998 / 23:23:42 / cg" |
284 | 8273 |
! |
8274 |
||
440 | 8275 |
_WGraphics_drawBytes:nativeContext |
8276 |
"/ void drawBytes (byte[] int int int int) |
|
8277 |
UnimplementedNativeMethodSignal raise |
|
8278 |
||
8279 |
"Created: / 12.11.1998 / 19:18:56 / cg" |
|
8280 |
! |
|
8281 |
||
284 | 8282 |
_WGraphics_drawLine:nativeContext |
8283 |
|gc x y x2 y2| |
|
8284 |
||
8285 |
gc := self gcForWGraphics:nativeContext. |
|
8286 |
"/ gc isNil ifTrue:[^ self]. |
|
8287 |
gc realized ifFalse:[^ self]. |
|
8288 |
||
8289 |
x := nativeContext argAt:1. |
|
8290 |
y := nativeContext argAt:2. |
|
8291 |
x2 := nativeContext argAt:3. |
|
8292 |
y2 := nativeContext argAt:4. |
|
8293 |
||
8294 |
DrawOPTrace ifTrue:[ |
|
8295 |
'drawLine x/y= ' print. x print. '@' print. y print. ' x2/y2= ' print. x2 print. '@' print. y2 printCR. |
|
8296 |
]. |
|
8297 |
gc displayLineFromX:x y:y toX:x2 y:y2 |
|
8298 |
||
8299 |
"Created: / 6.1.1998 / 20:59:27 / cg" |
|
8300 |
"Modified: / 8.1.1998 / 00:34:23 / cg" |
|
8301 |
! |
|
8302 |
||
440 | 8303 |
_WGraphics_drawMFCharsConvertedSegment:nativeContext |
8304 |
"/ int drawMFCharsConvertedSegment (java.awt.Font sun.awt.FontDescriptor byte[] int int int) |
|
8305 |
UnimplementedNativeMethodSignal raise |
|
8306 |
||
8307 |
"Created: / 12.11.1998 / 19:18:44 / cg" |
|
8308 |
! |
|
8309 |
||
284 | 8310 |
_WGraphics_drawMFCharsSegment:nativeContext |
8311 |
|jFont jFontDescr s gc x y offs len| |
|
8312 |
||
8313 |
gc := self gcForWGraphics:nativeContext. |
|
8314 |
gc realized ifFalse:[^ self]. |
|
8315 |
||
8316 |
jFont := nativeContext argAt:1. |
|
8317 |
jFontDescr := nativeContext argAt:2. |
|
8318 |
s := nativeContext argAt:3. |
|
8319 |
offs := nativeContext argAt:4. |
|
8320 |
len := nativeContext argAt:5. |
|
8321 |
x := nativeContext argAt:6. |
|
8322 |
y := nativeContext argAt:7. |
|
8323 |
||
8324 |
DrawOPTrace ifTrue:[ |
|
8325 |
'drawMFCharsSegment x/y= ' print. x print. '@' print. y print. ' s= ' print. s printCR. |
|
8326 |
]. |
|
8327 |
gc displayString:s from:offs+1 to:offs+len x:x y:y. |
|
8328 |
^ (gc font onDevice:(gc graphicsDevice)) widthOf:s. |
|
8329 |
||
8330 |
"Created: / 6.1.1998 / 21:01:07 / cg" |
|
8331 |
"Modified: / 25.1.1998 / 20:45:55 / cg" |
|
8332 |
! |
|
8333 |
||
8334 |
_WGraphics_drawOval:nativeContext |
|
8335 |
|gc x y w h| |
|
8336 |
||
8337 |
gc := self gcForWGraphics:nativeContext. |
|
8338 |
"/ gc isNil ifTrue:[^ self]. |
|
8339 |
gc realized ifFalse:[^ self]. |
|
8340 |
||
8341 |
x := nativeContext argAt:1. |
|
8342 |
y := nativeContext argAt:2. |
|
8343 |
w := nativeContext argAt:3. |
|
8344 |
h := nativeContext argAt:4. |
|
8345 |
||
337 | 8346 |
DrawOPTrace ifTrue:[ |
285 | 8347 |
'drawOval x/y= ' print. x print. '@' print. y print. |
8348 |
' w/h= ' print. w print. '@' print. h printCR. |
|
8349 |
]. |
|
8350 |
gc displayArcX:x y:y width:w height:h from:0 angle:360. |
|
284 | 8351 |
|
8352 |
"Created: / 8.1.1998 / 00:44:31 / cg" |
|
337 | 8353 |
"Modified: / 9.4.1998 / 22:10:23 / cg" |
284 | 8354 |
! |
8355 |
||
8356 |
_WGraphics_drawPolygon:nativeContext |
|
8357 |
|gc xVector yVector count points| |
|
8358 |
||
8359 |
gc := self gcForWGraphics:nativeContext. |
|
8360 |
"/ gc isNil ifTrue:[^ self]. |
|
8361 |
gc realized ifFalse:[^ self]. |
|
8362 |
||
8363 |
xVector := nativeContext argAt:1. |
|
8364 |
yVector := nativeContext argAt:2. |
|
8365 |
count := nativeContext argAt:3. |
|
8366 |
||
8367 |
DrawOPTrace ifTrue:[ |
|
8368 |
'drawPolgon' printCR. |
|
8369 |
]. |
|
8370 |
||
8371 |
points := (1 to:count) collect:[:i | (xVector at:i) @ (yVector at:i)]. |
|
8372 |
gc displayPolygon:points |
|
8373 |
||
8374 |
"Created: / 8.1.1998 / 00:57:28 / cg" |
|
8375 |
"Modified: / 8.1.1998 / 00:57:49 / cg" |
|
8376 |
! |
|
8377 |
||
440 | 8378 |
_WGraphics_drawPolyline:nativeContext |
8379 |
"/ void drawPolyline (int[] int[] int) |
|
8380 |
UnimplementedNativeMethodSignal raise |
|
8381 |
||
8382 |
"Created: / 12.11.1998 / 19:19:07 / cg" |
|
8383 |
! |
|
8384 |
||
284 | 8385 |
_WGraphics_drawRect:nativeContext |
8386 |
|gc x y w h| |
|
8387 |
||
8388 |
gc := self gcForWGraphics:nativeContext. |
|
8389 |
"/ gc isNil ifTrue:[^ self]. |
|
8390 |
gc realized ifFalse:[^ self]. |
|
8391 |
||
8392 |
x := nativeContext argAt:1. |
|
8393 |
y := nativeContext argAt:2. |
|
8394 |
w := nativeContext argAt:3. |
|
8395 |
h := nativeContext argAt:4. |
|
8396 |
||
8397 |
"/ self halt. |
|
8398 |
"/ self internalError:'breakPoint'. |
|
8399 |
||
8400 |
gc displayRectangleX:x y:y width:w height:h. |
|
8401 |
||
8402 |
"Modified: / 8.1.1998 / 00:34:33 / cg" |
|
8403 |
"Created: / 8.1.1998 / 00:59:05 / cg" |
|
8404 |
! |
|
8405 |
||
8406 |
_WGraphics_drawRoundRect:nativeContext |
|
8407 |
|gc x y w h| |
|
8408 |
||
8409 |
gc := self gcForWGraphics:nativeContext. |
|
8410 |
"/ gc isNil ifTrue:[^ self]. |
|
8411 |
gc realized ifFalse:[^ self]. |
|
8412 |
||
8413 |
x := nativeContext argAt:1. |
|
8414 |
y := nativeContext argAt:2. |
|
8415 |
w := nativeContext argAt:3. |
|
8416 |
h := nativeContext argAt:4. |
|
8417 |
||
8418 |
"/ self halt. |
|
8419 |
"/ self internalError:'breakPoint'. |
|
8420 |
||
8421 |
gc displayRectangleX:x y:y width:w height:h. |
|
8422 |
||
8423 |
"Modified: / 8.1.1998 / 00:34:33 / cg" |
|
8424 |
"Created: / 8.1.1998 / 00:59:26 / cg" |
|
8425 |
! |
|
8426 |
||
440 | 8427 |
_WGraphics_drawSFChars:nativeContext |
8428 |
"/ void drawSFChars (char[] int int int int) |
|
8429 |
UnimplementedNativeMethodSignal raise |
|
8430 |
||
8431 |
"Created: / 12.11.1998 / 19:18:20 / cg" |
|
8432 |
! |
|
8433 |
||
284 | 8434 |
_WGraphics_fillArc:nativeContext |
8435 |
|gc x y w h startAngle endAngle| |
|
8436 |
||
8437 |
gc := self gcForWGraphics:nativeContext. |
|
8438 |
"/ gc isNil ifTrue:[^ self]. |
|
8439 |
gc realized ifFalse:[^ self]. |
|
8440 |
||
8441 |
x := nativeContext argAt:1. |
|
8442 |
y := nativeContext argAt:2. |
|
8443 |
w := nativeContext argAt:3. |
|
8444 |
h := nativeContext argAt:4. |
|
8445 |
startAngle := nativeContext argAt:5. |
|
8446 |
endAngle := nativeContext argAt:6. |
|
8447 |
||
8448 |
DrawOPTrace ifTrue:[ |
|
8449 |
'fillArc x/y= ' print. x print. '@' print. y print. |
|
8450 |
' w/h= ' print. w print. '@' print. h print. |
|
8451 |
' startAngle= ' print. startAngle print. ' endAngle= ' print. endAngle printCR. |
|
8452 |
]. |
|
8453 |
gc fillArcX:x y:y width:w height:h from:startAngle angle:(endAngle - startAngle) |
|
8454 |
||
8455 |
"Created: / 6.1.1998 / 21:11:31 / cg" |
|
8456 |
"Modified: / 8.1.1998 / 00:33:59 / cg" |
|
8457 |
! |
|
8458 |
||
8459 |
_WGraphics_fillOval:nativeContext |
|
8460 |
|gc x y w h| |
|
8461 |
||
8462 |
gc := self gcForWGraphics:nativeContext. |
|
8463 |
"/ gc isNil ifTrue:[^ self]. |
|
8464 |
gc realized ifFalse:[^ self]. |
|
8465 |
||
8466 |
x := nativeContext argAt:1. |
|
8467 |
y := nativeContext argAt:2. |
|
8468 |
w := nativeContext argAt:3. |
|
8469 |
h := nativeContext argAt:4. |
|
8470 |
||
8471 |
DrawOPTrace ifTrue:[ |
|
8472 |
'drawOval x/y= ' print. x print. '@' print. y print. |
|
8473 |
' w/h= ' print. w print. '@' print. h printCR. |
|
8474 |
]. |
|
8475 |
gc fillArcX:x y:y width:w height:h from:0 angle:360 |
|
8476 |
||
8477 |
"Created: / 8.1.1998 / 00:46:00 / cg" |
|
8478 |
"Modified: / 8.1.1998 / 00:46:20 / cg" |
|
8479 |
! |
|
8480 |
||
8481 |
_WGraphics_fillPolygon:nativeContext |
|
8482 |
|gc xVector yVector count points| |
|
8483 |
||
8484 |
gc := self gcForWGraphics:nativeContext. |
|
8485 |
"/ gc isNil ifTrue:[^ self]. |
|
8486 |
gc realized ifFalse:[^ self]. |
|
8487 |
||
8488 |
xVector := nativeContext argAt:1. |
|
8489 |
yVector := nativeContext argAt:2. |
|
8490 |
count := nativeContext argAt:3. |
|
8491 |
||
8492 |
DrawOPTrace ifTrue:[ |
|
8493 |
'fillPolgon' printCR. |
|
8494 |
]. |
|
8495 |
||
8496 |
points := (1 to:count-1) collect:[:i | (xVector at:i) @ (yVector at:i)]. |
|
8497 |
gc fillPolygon:points |
|
8498 |
||
8499 |
"Created: / 8.1.1998 / 00:58:09 / cg" |
|
8500 |
"Modified: / 25.1.1998 / 11:03:19 / cg" |
|
8501 |
! |
|
8502 |
||
8503 |
_WGraphics_fillRect:nativeContext |
|
8504 |
|gc x y w h| |
|
8505 |
||
8506 |
gc := self gcForWGraphics:nativeContext. |
|
8507 |
"/ gc isNil ifTrue:[^ self]. |
|
8508 |
gc realized ifFalse:[^ self]. |
|
8509 |
||
8510 |
x := nativeContext argAt:1. |
|
8511 |
y := nativeContext argAt:2. |
|
8512 |
w := nativeContext argAt:3. |
|
8513 |
h := nativeContext argAt:4. |
|
8514 |
||
8515 |
"/ self halt. |
|
8516 |
"/ self internalError:'breakPoint'. |
|
8517 |
||
8518 |
gc fillRectangleX:x y:y width:w height:h. |
|
8519 |
||
8520 |
"Created: / 15.8.1997 / 15:43:10 / cg" |
|
8521 |
"Modified: / 8.1.1998 / 00:34:33 / cg" |
|
8522 |
! |
|
8523 |
||
8524 |
_WGraphics_fillRoundRect:nativeContext |
|
8525 |
|gc x y w h| |
|
8526 |
||
8527 |
gc := self gcForWGraphics:nativeContext. |
|
8528 |
"/ gc isNil ifTrue:[^ self]. |
|
8529 |
gc realized ifFalse:[^ self]. |
|
8530 |
||
8531 |
x := nativeContext argAt:1. |
|
8532 |
y := nativeContext argAt:2. |
|
8533 |
w := nativeContext argAt:3. |
|
8534 |
h := nativeContext argAt:4. |
|
8535 |
||
8536 |
"/ self halt. |
|
8537 |
"/ self internalError:'breakPoint'. |
|
8538 |
||
8539 |
gc displayRectangleX:x y:y width:w height:h. |
|
8540 |
||
8541 |
"Modified: / 8.1.1998 / 00:34:33 / cg" |
|
8542 |
"Created: / 8.1.1998 / 00:59:36 / cg" |
|
8543 |
! |
|
8544 |
||
8545 |
_WGraphics_getClipBounds:nativeContext |
|
8546 |
|gc rect r x y w h| |
|
8547 |
||
8548 |
gc := self gcForWGraphics:nativeContext. |
|
391 | 8549 |
"/ gc isNil ifTrue:[^ nil]. |
284 | 8550 |
|
8551 |
rect := (Java classForName:'java.awt.Rectangle') basicNew. |
|
8552 |
||
8553 |
(gc isMemberOf:JavaView) ifTrue:[ |
|
391 | 8554 |
"/ r := gc clippingRectangleOrNil. |
8555 |
r := gc getNextUpdateRectangle. |
|
401 | 8556 |
]. |
8557 |
r isNil ifTrue:[ |
|
8558 |
r := gc clippingRectangleOrNil. |
|
8559 |
]. |
|
8560 |
||
8561 |
r isNil ifTrue:[ |
|
391 | 8562 |
x := y := 0. |
8563 |
w := (gc width). |
|
8564 |
h := (gc height). |
|
401 | 8565 |
] ifFalse:[ |
8566 |
x := (r left). |
|
8567 |
y := (r top). |
|
8568 |
w := (r width). |
|
8569 |
h := (r height). |
|
284 | 8570 |
]. |
8571 |
rect instVarNamed:'x' put:x. |
|
8572 |
rect instVarNamed:'y' put:y. |
|
8573 |
rect instVarNamed:'width' put:w. |
|
8574 |
rect instVarNamed:'height' put:h. |
|
8575 |
||
401 | 8576 |
'WGraphics__getClipBounds ' infoPrint. (x@y extent:w@h) infoPrintCR. |
284 | 8577 |
"/ self halt. |
8578 |
||
8579 |
^ rect |
|
8580 |
||
8581 |
"Created: / 6.1.1998 / 20:58:07 / cg" |
|
401 | 8582 |
"Modified: / 20.10.1998 / 19:26:34 / cg" |
284 | 8583 |
! |
8584 |
||
8585 |
_WGraphics_imageCreate:nativeContext |
|
8586 |
|jGraphics imgRep| |
|
8587 |
||
8588 |
jGraphics := nativeContext receiver. |
|
8589 |
imgRep := nativeContext argAt:1. |
|
8590 |
||
8591 |
jGraphics instVarNamed:'pData' put:(imgRep instVarNamed:'pData'). |
|
8592 |
"/ self halt. |
|
8593 |
||
8594 |
"Created: / 11.1.1998 / 16:34:30 / cg" |
|
8595 |
"Modified: / 17.1.1998 / 12:37:18 / cg" |
|
8596 |
! |
|
8597 |
||
8598 |
_WGraphics_pSetFont:nativeContext |
|
8599 |
|gc jFont stFont| |
|
8600 |
||
8601 |
gc := self gcForWGraphics:nativeContext. |
|
8602 |
jFont := nativeContext argAt:1. |
|
8603 |
||
8604 |
stFont := jFont instVarNamed:'pData'. |
|
8605 |
(stFont isNil or:[stFont == 0]) ifTrue:[ |
|
8606 |
"/ self halt. |
|
8607 |
] ifFalse:[ |
|
8608 |
gc font:stFont |
|
8609 |
]. |
|
8610 |
||
8611 |
"Created: / 6.1.1998 / 20:56:47 / cg" |
|
8612 |
"Modified: / 15.1.1998 / 12:31:20 / cg" |
|
8613 |
! |
|
8614 |
||
8615 |
_WGraphics_pSetForeground:nativeContext |
|
8616 |
|gc rgb clr| |
|
8617 |
||
8618 |
gc := self gcForWGraphics:nativeContext. |
|
8619 |
||
8620 |
rgb := nativeContext argAt:1. |
|
8621 |
||
8622 |
clr := Color rgbValue:rgb. |
|
8623 |
gc paint:clr. |
|
8624 |
||
8625 |
"/ self halt. |
|
8626 |
"/ self internalError:'breakPoint'. |
|
8627 |
||
8628 |
"Created: / 6.1.1998 / 20:56:14 / cg" |
|
8629 |
"Modified: / 8.1.1998 / 00:34:51 / cg" |
|
8630 |
! |
|
8631 |
||
440 | 8632 |
_WGraphics_print:nativeContext |
8633 |
"/ void print (sun.awt.windows.WComponentPeer) |
|
8634 |
UnimplementedNativeMethodSignal raise |
|
8635 |
||
8636 |
"Created: / 12.11.1998 / 19:19:25 / cg" |
|
8637 |
! |
|
8638 |
||
8639 |
_WGraphics_removeClip:nativeContext |
|
8640 |
"/ void removeClip () |
|
8641 |
UnimplementedNativeMethodSignal raise |
|
8642 |
||
8643 |
"Created: / 12.11.1998 / 19:18:05 / cg" |
|
8644 |
! |
|
8645 |
||
284 | 8646 |
_WGraphics_setPaintMode:nativeContext |
8647 |
|gc| |
|
8648 |
||
8649 |
gc := self gcForWGraphics:nativeContext. |
|
8650 |
gc function:#copy. |
|
285 | 8651 |
|
8652 |
true "DrawOPTrace" ifTrue:[ |
|
8653 |
'copyMode' infoPrintCR. |
|
8654 |
]. |
|
284 | 8655 |
|
8656 |
"Created: / 8.1.1998 / 00:33:44 / cg" |
|
285 | 8657 |
"Modified: / 28.1.1998 / 23:25:56 / cg" |
284 | 8658 |
! |
8659 |
||
8660 |
_WGraphics_setXORMode:nativeContext |
|
8661 |
|gc jColor rgb invColor device| |
|
8662 |
||
8663 |
gc := self gcForWGraphics:nativeContext. |
|
8664 |
jColor := nativeContext argAt:1. |
|
8665 |
device := gc graphicsDevice. |
|
285 | 8666 |
|
8667 |
"/ "/ on trueColor systems, use the provided |
|
8668 |
"/ "/ rgb value for inverting. |
|
8669 |
"/ "/ on palette systems, use white ^ black |
|
8670 |
"/ |
|
8671 |
"/ device visualType == #TrueColor ifTrue:[ |
|
8672 |
"/ rgb := jColor instVarNamed:'value'. |
|
8673 |
"/ rgb := rgb bitAnd:16rFFFFFF. |
|
8674 |
"/ rgb == 0 ifTrue:[ |
|
8675 |
"/ rgb := 16rFFFFFF. |
|
8676 |
"/ ]. |
|
8677 |
"/ invColor := rgb |
|
8678 |
"/ ] ifFalse:[ |
|
8679 |
"/ invColor := device blackpixel bitXor:device whitepixel. |
|
8680 |
"/ ]. |
|
8681 |
||
8682 |
invColor := device blackpixel bitXor:device whitepixel. |
|
8683 |
||
8684 |
"/ gc foreground:(Color colorId:invColor) |
|
8685 |
"/ background:device blackColor. |
|
8686 |
device |
|
8687 |
setForeground:invColor background:0 |
|
8688 |
in:gc gcId. |
|
284 | 8689 |
gc function:#xor. |
285 | 8690 |
|
8691 |
true "DrawOPTrace" ifTrue:[ |
|
8692 |
'xorMode' infoPrintCR. |
|
8693 |
]. |
|
284 | 8694 |
|
8695 |
"Created: / 8.1.1998 / 00:36:17 / cg" |
|
285 | 8696 |
"Modified: / 28.1.1998 / 23:45:03 / cg" |
284 | 8697 |
! |
8698 |
||
8699 |
_WLabelPeer_create:nativeContext |
|
8700 |
|jLabelPeer jLabel jFrame frame label |
|
8701 |
lbl| |
|
8702 |
||
8703 |
jLabelPeer := nativeContext receiver. |
|
8704 |
jLabel := jLabelPeer instVarNamed:'target'. |
|
8705 |
||
8706 |
lbl := jLabel instVarNamed:'text'. |
|
8707 |
lbl notNil ifTrue:[ |
|
8708 |
lbl := Java as_ST_String:lbl |
|
8709 |
]. |
|
8710 |
||
8711 |
jFrame := nativeContext argAt:1. |
|
8712 |
frame := jFrame instVarNamed:'pData'. |
|
8713 |
||
8714 |
label := Label in:frame. |
|
8715 |
lbl notNil ifTrue:[ |
|
8716 |
label label:lbl |
|
8717 |
]. |
|
8718 |
self createdWindowsView:label for:jLabelPeer. |
|
8719 |
||
8720 |
WindowCreationTrace == true ifTrue:[ |
|
8721 |
'WLabelPeer_create: ' print. frame print. ' -> ' print. label printNL. |
|
8722 |
]. |
|
8723 |
||
8724 |
"Created: / 7.1.1998 / 21:42:31 / cg" |
|
8725 |
"Modified: / 13.1.1998 / 22:10:47 / cg" |
|
8726 |
! |
|
8727 |
||
8728 |
_WLabelPeer_setAlignment:nativeContext |
|
8729 |
|label alignNr| |
|
8730 |
||
8731 |
alignNr := nativeContext argAt:1. |
|
8732 |
label := self viewForWPeer:nativeContext. |
|
8733 |
label notNil ifTrue:[ |
|
8734 |
]. |
|
8735 |
||
8736 |
"Created: / 7.1.1998 / 21:43:12 / cg" |
|
8737 |
"Modified: / 8.1.1998 / 17:35:29 / cg" |
|
8738 |
! |
|
8739 |
||
8740 |
_WLabelPeer_setText:nativeContext |
|
479 | 8741 |
|label jString str| |
284 | 8742 |
|
8743 |
jString := nativeContext argAt:1. |
|
8744 |
||
8745 |
label := self viewForWPeer:nativeContext. |
|
479 | 8746 |
str := jString. |
8747 |
str notNil ifTrue:[ |
|
8748 |
str := Java as_ST_String:str |
|
8749 |
]. |
|
8750 |
label label:str |
|
284 | 8751 |
|
8752 |
"Created: / 7.1.1998 / 21:43:51 / cg" |
|
479 | 8753 |
"Modified: / 3.12.1998 / 14:59:18 / cg" |
284 | 8754 |
! |
8755 |
||
408 | 8756 |
_WListPeer__addItem:nativeContext |
448 | 8757 |
|jString index1 length selListView m| |
408 | 8758 |
|
8759 |
selListView := self viewForWPeer:nativeContext. |
|
8760 |
||
8761 |
jString := nativeContext argAt:1. |
|
8762 |
index1 := nativeContext argAt:2. |
|
8763 |
length := nativeContext argAt:3. |
|
8764 |
||
448 | 8765 |
(m := selListView model) notNil ifTrue:[ |
8766 |
m list addLast:(Java as_ST_String:jString). |
|
8767 |
m changed:#list. |
|
8768 |
]. |
|
408 | 8769 |
|
8770 |
"Created: / 26.10.1998 / 20:11:30 / cg" |
|
448 | 8771 |
"Modified: / 14.11.1998 / 01:21:03 / cg" |
408 | 8772 |
! |
8773 |
||
284 | 8774 |
_WListPeer_addItem:nativeContext |
410 | 8775 |
|jString index selListView m| |
284 | 8776 |
|
8777 |
selListView := self viewForWPeer:nativeContext. |
|
8778 |
||
8779 |
jString := nativeContext argAt:1. |
|
8780 |
index := nativeContext argAt:2. |
|
8781 |
||
410 | 8782 |
m := selListView model. |
8783 |
m isNil ifTrue:[ |
|
8784 |
Transcript showCR:'JAVA: access to listModel of closed view'. |
|
8785 |
] ifFalse:[ |
|
8786 |
m list addLast:(Java as_ST_String:jString). |
|
8787 |
m changed:#list. |
|
8788 |
] |
|
8789 |
||
284 | 8790 |
"Created: / 24.1.1998 / 21:10:05 / cg" |
410 | 8791 |
"Modified: / 2.11.1998 / 17:12:52 / cg" |
284 | 8792 |
! |
8793 |
||
8794 |
_WListPeer_create:nativeContext |
|
8795 |
|jListPeer jFrame frame selectionInListView| |
|
8796 |
||
8797 |
jListPeer := nativeContext receiver. |
|
8798 |
||
8799 |
jFrame := nativeContext argAt:1. |
|
8800 |
frame := jFrame instVarNamed:'pData'. |
|
8801 |
||
8802 |
selectionInListView := ScrollableView for:SelectionInListView in:frame. |
|
8803 |
selectionInListView action:[:index | jListPeer perform:#'handleListChanged(I)V' with:(index - 1)]. |
|
8804 |
selectionInListView doubleClickAction:[:index | jListPeer perform:#'handleAction(I)V' with:(index - 1)]. |
|
337 | 8805 |
selectionInListView model:(SelectionInList new list:(List new)). |
284 | 8806 |
selectionInListView useIndex:true. |
8807 |
||
8808 |
self createdWindowsView:selectionInListView for:jListPeer. |
|
8809 |
||
8810 |
WindowCreationTrace == true ifTrue:[ |
|
8811 |
'WTextAreaPeer_create: ' print. frame print. ' -> ' print. selectionInListView printNL. |
|
8812 |
]. |
|
8813 |
||
8814 |
"Created: / 24.1.1998 / 19:58:54 / cg" |
|
337 | 8815 |
"Modified: / 9.4.1998 / 22:19:07 / cg" |
8816 |
! |
|
8817 |
||
8818 |
_WListPeer_delItems:nativeContext |
|
8819 |
|jString index1 index2 selListView| |
|
8820 |
||
8821 |
selListView := self viewForWPeer:nativeContext. |
|
8822 |
||
8823 |
index1 := nativeContext argAt:1. |
|
8824 |
index2 := nativeContext argAt:2. |
|
8825 |
||
8826 |
selListView model list removeFromIndex:(index1+1) toIndex:(index2+1). |
|
8827 |
selListView model changed:#list. |
|
8828 |
||
8829 |
"Created: / 9.4.1998 / 22:19:25 / cg" |
|
8830 |
"Modified: / 9.4.1998 / 22:20:08 / cg" |
|
284 | 8831 |
! |
8832 |
||
440 | 8833 |
_WListPeer_deselect:nativeContext |
8834 |
"/ void deselect (int) |
|
8835 |
UnimplementedNativeMethodSignal raise |
|
8836 |
||
8837 |
"Created: / 12.11.1998 / 19:15:10 / cg" |
|
8838 |
! |
|
8839 |
||
448 | 8840 |
_WListPeer_getMaxWidth:nativeContext |
8841 |
"/ int getMaxWidth () |
|
8842 |
UnimplementedNativeMethodSignal raise |
|
8843 |
||
8844 |
"Created: / 14.11.1998 / 10:44:29 / cg" |
|
8845 |
! |
|
8846 |
||
284 | 8847 |
_WListPeer_isSelected:nativeContext |
8848 |
|selectionInListView index model| |
|
8849 |
||
8850 |
selectionInListView := self viewForWPeer:nativeContext. |
|
8851 |
||
8852 |
index := nativeContext argAt:1. |
|
8853 |
(model := selectionInListView model) notNil ifTrue:[ |
|
8854 |
(model selectionIndex == (index + 1)) "/ JAVA indexing starts at 0 |
|
8855 |
ifTrue:[ |
|
8856 |
^ 1 |
|
8857 |
] |
|
8858 |
]. |
|
8859 |
^ 0. |
|
8860 |
||
8861 |
"Created: / 24.1.1998 / 22:42:31 / cg" |
|
8862 |
"Modified: / 25.1.1998 / 01:35:32 / cg" |
|
8863 |
! |
|
8864 |
||
396 | 8865 |
_WListPeer_makeVisible:nativeContext |
8866 |
|selectionInListView lineNr| |
|
8867 |
||
8868 |
selectionInListView := self viewForWPeer:nativeContext. |
|
8869 |
||
8870 |
lineNr := nativeContext argAt:1. |
|
8871 |
||
8872 |
selectionInListView makeLineVisible:(lineNr + 1) |
|
8873 |
||
8874 |
"Modified: / 24.1.1998 / 20:01:06 / cg" |
|
8875 |
"Created: / 20.10.1998 / 14:14:50 / cg" |
|
8876 |
! |
|
8877 |
||
284 | 8878 |
_WListPeer_select:nativeContext |
8879 |
|selectionInListView index model| |
|
8880 |
||
8881 |
selectionInListView := self viewForWPeer:nativeContext. |
|
8882 |
||
8883 |
index := nativeContext argAt:1. |
|
8884 |
(model := selectionInListView model) notNil ifTrue:[ |
|
8885 |
model selectionIndex:(index + 1). "/ JAVA indexing starts at 0 |
|
8886 |
] |
|
8887 |
||
8888 |
"Created: / 24.1.1998 / 22:32:35 / cg" |
|
8889 |
"Modified: / 25.1.1998 / 01:28:46 / cg" |
|
8890 |
! |
|
8891 |
||
8892 |
_WListPeer_setMultipleSelections:nativeContext |
|
8893 |
|selectionInListView onOff| |
|
8894 |
||
8895 |
selectionInListView := self viewForWPeer:nativeContext. |
|
8896 |
||
8897 |
onOff := (nativeContext argAt:1) ~~ 0. |
|
8898 |
||
8899 |
selectionInListView multipleSelectOk:onOff. |
|
8900 |
||
8901 |
"Modified: / 24.1.1998 / 20:01:06 / cg" |
|
8902 |
! |
|
8903 |
||
408 | 8904 |
_WListPeer_updateMaxItemWidth:nativeContext |
8905 |
|selectionInListView lineNr| |
|
8906 |
||
8907 |
selectionInListView := self viewForWPeer:nativeContext. |
|
8908 |
||
8909 |
"Created: / 26.10.1998 / 20:09:46 / cg" |
|
8910 |
! |
|
8911 |
||
440 | 8912 |
_WMenuBarPeer_addMenu:nativeContext |
8913 |
"/ void addMenu (java.awt.Menu) |
|
8914 |
UnimplementedNativeMethodSignal raise |
|
8915 |
||
8916 |
"Created: / 12.11.1998 / 19:14:00 / cg" |
|
8917 |
! |
|
8918 |
||
284 | 8919 |
_WMenuBarPeer_create:nativeContext |
8920 |
|jMenuBarPeer jMenuBar jFrame frame menuBar| |
|
8921 |
||
8922 |
jMenuBarPeer := nativeContext receiver. |
|
8923 |
jMenuBar := jMenuBarPeer instVarNamed:'target'. |
|
8924 |
||
8925 |
jFrame := nativeContext argAt:1. |
|
8926 |
frame := jFrame instVarNamed:'pData'. |
|
8927 |
||
8928 |
menuBar := MenuPanel in:frame. |
|
8929 |
menuBar verticalLayout:false. |
|
8930 |
menuBar realize. |
|
8931 |
||
8932 |
self createdWindowsView:menuBar for:jMenuBarPeer. |
|
8933 |
||
8934 |
WindowCreationTrace == true ifTrue:[ |
|
8935 |
'WMenuBarPeer_create: ' print. frame print. ' -> ' print. menuBar printNL. |
|
8936 |
]. |
|
8937 |
||
8938 |
"Created: / 7.1.1998 / 21:38:31 / cg" |
|
8939 |
"Modified: / 25.1.1998 / 13:19:03 / cg" |
|
8940 |
! |
|
8941 |
||
440 | 8942 |
_WMenuBarPeer_delMenu:nativeContext |
8943 |
"/ void delMenu (int) |
|
8944 |
UnimplementedNativeMethodSignal raise |
|
8945 |
||
8946 |
"Created: / 12.11.1998 / 19:14:11 / cg" |
|
8947 |
! |
|
8948 |
||
325 | 8949 |
_WMenuItemPeer__dispose:nativeContext |
8950 |
|jMenuItemPeer item| |
|
8951 |
||
8952 |
jMenuItemPeer := nativeContext receiver. |
|
8953 |
item := jMenuItemPeer instVarNamed:'pData'. |
|
8954 |
||
8955 |
"/ what should be done here ? |
|
8956 |
||
8957 |
"Created: / 29.3.1998 / 17:16:05 / cg" |
|
8958 |
"Modified: / 29.3.1998 / 17:16:35 / cg" |
|
8959 |
! |
|
8960 |
||
440 | 8961 |
_WMenuItemPeer__setLabel:nativeContext |
8962 |
"/ void _setLabel (java.lang.String) |
|
480 | 8963 |
'JAVA: unimplemented: _WMenuItemPeer__setLabel' infoPrintCR. |
8964 |
"/ UnimplementedNativeMethodSignal raise |
|
440 | 8965 |
|
8966 |
"Created: / 12.11.1998 / 19:12:06 / cg" |
|
480 | 8967 |
"Modified: / 3.12.1998 / 21:06:44 / cg" |
440 | 8968 |
! |
8969 |
||
284 | 8970 |
_WMenuItemPeer_create:nativeContext |
8971 |
|jMenuItemPeer jMenuItem jMenuPeer menu item lbl| |
|
8972 |
||
8973 |
jMenuItemPeer := nativeContext receiver. |
|
8974 |
jMenuItem := jMenuItemPeer instVarNamed:'target'. |
|
8975 |
||
8976 |
jMenuPeer := nativeContext argAt:1. |
|
8977 |
menu := jMenuPeer instVarNamed:'pData'. |
|
480 | 8978 |
(menu isNil or:[menu == 0]) ifTrue:[ |
8979 |
'JAVA: no menu to create item in' infoPrintCR. |
|
8980 |
^ self |
|
8981 |
]. |
|
284 | 8982 |
item := menu createAtIndex:nil. |
325 | 8983 |
item value:[ |
8984 |
jMenuItemPeer perform:#'handleAction(I)V' with:0 |
|
8985 |
]. |
|
284 | 8986 |
|
8987 |
lbl := jMenuItem instVarNamed:'label'. |
|
8988 |
lbl notNil ifTrue:[ |
|
325 | 8989 |
lbl := Java as_ST_String:lbl. |
8990 |
item label:lbl |
|
284 | 8991 |
]. |
8992 |
||
8993 |
jMenuItemPeer instVarNamed:'pData' put:item. |
|
8994 |
||
8995 |
WindowOPTrace == true ifTrue:[ |
|
325 | 8996 |
'WMenuItem_create: ' print. menu print. ' -> ' print. item printNL. |
284 | 8997 |
]. |
8998 |
||
8999 |
"Created: / 7.1.1998 / 21:40:44 / cg" |
|
480 | 9000 |
"Modified: / 3.12.1998 / 20:43:20 / cg" |
284 | 9001 |
! |
9002 |
||
9003 |
_WMenuItemPeer_enable:nativeContext |
|
9004 |
|jMenuItemPeer item state| |
|
9005 |
||
9006 |
jMenuItemPeer := nativeContext receiver. |
|
9007 |
item := jMenuItemPeer instVarNamed:'pData'. |
|
480 | 9008 |
(item isNil or:[item == 0]) ifTrue:[ |
9009 |
'JAVA [warning]: enabling NULL menu item' infoPrintCR. |
|
9010 |
^ self |
|
9011 |
]. |
|
284 | 9012 |
|
9013 |
state := nativeContext argAt:1. |
|
9014 |
item enabled:(state == 0) not |
|
9015 |
||
9016 |
"Created: / 7.1.1998 / 22:41:38 / cg" |
|
480 | 9017 |
"Modified: / 3.12.1998 / 21:04:10 / cg" |
284 | 9018 |
! |
9019 |
||
440 | 9020 |
_WMenuPeer_addSeparator:nativeContext |
9021 |
"/ void addSeparator () |
|
9022 |
UnimplementedNativeMethodSignal raise |
|
9023 |
||
9024 |
"Created: / 12.11.1998 / 19:13:14 / cg" |
|
9025 |
! |
|
9026 |
||
284 | 9027 |
_WMenuPeer_createMenu:nativeContext |
9028 |
|jMenuPeer jMenu jMenuBarPeer menuPanel menu |
|
9029 |
lbl item| |
|
9030 |
||
9031 |
jMenuPeer := nativeContext receiver. |
|
9032 |
jMenu := jMenuPeer instVarNamed:'target'. |
|
9033 |
||
9034 |
jMenuBarPeer := nativeContext argAt:1. |
|
9035 |
menuPanel := jMenuBarPeer instVarNamed:'pData'. |
|
9036 |
||
9037 |
item := menuPanel createAtIndex:nil. |
|
9038 |
lbl := jMenu instVarNamed:'label'. |
|
9039 |
lbl notNil ifTrue:[ |
|
9040 |
lbl := Java as_ST_String:lbl. |
|
9041 |
item label:lbl |
|
9042 |
]. |
|
9043 |
||
9044 |
menu := MenuPanel new. |
|
9045 |
item submenu:menu. |
|
9046 |
||
9047 |
jMenuPeer instVarNamed:'pData' put:menu. |
|
9048 |
||
9049 |
'createMenuPeer: ' print. menuPanel print. ' -> ' print. menu printNL. |
|
9050 |
||
9051 |
"Created: / 7.1.1998 / 21:39:50 / cg" |
|
9052 |
"Modified: / 13.1.1998 / 22:11:09 / cg" |
|
9053 |
! |
|
9054 |
||
440 | 9055 |
_WMenuPeer_createSubMenu:nativeContext |
9056 |
"/ void createSubMenu (sun.awt.windows.WMenuPeer) |
|
482 | 9057 |
"/ UnimplementedNativeMethodSignal raise |
440 | 9058 |
|
9059 |
"Created: / 12.11.1998 / 19:13:43 / cg" |
|
482 | 9060 |
"Modified: / 3.12.1998 / 21:41:07 / cg" |
440 | 9061 |
! |
9062 |
||
9063 |
_WMenuPeer_delItem:nativeContext |
|
9064 |
"/ void delItem (int) |
|
9065 |
UnimplementedNativeMethodSignal raise |
|
9066 |
||
9067 |
"Created: / 12.11.1998 / 19:13:30 / cg" |
|
9068 |
! |
|
9069 |
||
9070 |
_WPopupMenuPeer__show:nativeContext |
|
9071 |
"/ void _show (java.awt.Event) |
|
9072 |
UnimplementedNativeMethodSignal raise |
|
9073 |
||
9074 |
"Created: / 12.11.1998 / 19:12:53 / cg" |
|
9075 |
! |
|
9076 |
||
9077 |
_WPopupMenuPeer_createMenu:nativeContext |
|
9078 |
"/ void createMenu (sun.awt.windows.WComponentPeer) |
|
9079 |
UnimplementedNativeMethodSignal raise |
|
9080 |
||
9081 |
"Created: / 12.11.1998 / 19:12:43 / cg" |
|
9082 |
! |
|
9083 |
||
9084 |
_WPrintJob_end:nativeContext |
|
9085 |
"/ void end () |
|
9086 |
UnimplementedNativeMethodSignal raise |
|
9087 |
||
9088 |
"Created: / 12.11.1998 / 19:11:28 / cg" |
|
9089 |
! |
|
9090 |
||
334 | 9091 |
_WScrollPanePeer__getHScrollbarHeight:nativeContext |
9092 |
|scrollPane| |
|
9093 |
||
9094 |
scrollPane := self viewForWPeer:nativeContext. |
|
339 | 9095 |
^ HorizontalScrollBar new preferredExtent y. |
9096 |
||
334 | 9097 |
"Created: / 9.4.1998 / 17:30:56 / cg" |
339 | 9098 |
"Modified: / 10.4.1998 / 14:59:28 / cg" |
341 | 9099 |
! |
334 | 9100 |
|
9101 |
_WScrollPanePeer__getVScrollbarWidth:nativeContext |
|
9102 |
|scrollPane| |
|
9103 |
||
9104 |
scrollPane := self viewForWPeer:nativeContext. |
|
339 | 9105 |
^ ScrollBar new preferredExtent x. |
334 | 9106 |
|
9107 |
"Created: / 9.4.1998 / 17:29:48 / cg" |
|
339 | 9108 |
"Modified: / 10.4.1998 / 15:00:33 / cg" |
334 | 9109 |
! |
9110 |
||
9111 |
_WScrollPanePeer_create:nativeContext |
|
9112 |
|jScrollPanePeer jScrollPane jFrame frame scrollPane |
|
9113 |
lbl| |
|
9114 |
||
9115 |
jScrollPanePeer := nativeContext receiver. |
|
9116 |
jScrollPane := jScrollPanePeer instVarNamed:'target'. |
|
9117 |
||
9118 |
jFrame := nativeContext argAt:1. |
|
9119 |
frame := jFrame instVarNamed:'pData'. |
|
9120 |
||
9121 |
"/ create with a simple view ... |
|
337 | 9122 |
scrollPane := ScrollableView for:JavaView in:frame. |
334 | 9123 |
|
9124 |
self createdWindowsView:scrollPane for:jScrollPanePeer. |
|
9125 |
||
9126 |
WindowCreationTrace == true ifTrue:[ |
|
9127 |
'WScrollPanePeer_create: ' print. frame print. ' -> ' print. scrollPane printNL. |
|
9128 |
]. |
|
9129 |
||
9130 |
"Created: / 9.4.1998 / 17:25:08 / cg" |
|
337 | 9131 |
"Modified: / 9.4.1998 / 22:06:09 / cg" |
334 | 9132 |
! |
9133 |
||
440 | 9134 |
_WScrollPanePeer_getOffset:nativeContext |
9135 |
"/ int getOffset (int) |
|
9136 |
UnimplementedNativeMethodSignal raise |
|
9137 |
||
9138 |
"Created: / 12.11.1998 / 19:16:29 / cg" |
|
9139 |
! |
|
9140 |
||
9141 |
_WScrollPanePeer_getScrollChild:nativeContext |
|
9142 |
"/ java.awt.Component getScrollChild () |
|
9143 |
UnimplementedNativeMethodSignal raise |
|
9144 |
||
9145 |
"Created: / 12.11.1998 / 19:17:00 / cg" |
|
9146 |
! |
|
9147 |
||
334 | 9148 |
_WScrollPanePeer_setInsets:nativeContext |
9149 |
||
9150 |
"Modified: / 9.4.1998 / 17:26:11 / cg" |
|
9151 |
"Created: / 9.4.1998 / 17:29:10 / cg" |
|
9152 |
! |
|
9153 |
||
440 | 9154 |
_WScrollPanePeer_setScrollPosition:nativeContext |
9155 |
"/ void setScrollPosition (int int) |
|
9156 |
UnimplementedNativeMethodSignal raise |
|
9157 |
||
9158 |
"Created: / 12.11.1998 / 19:16:44 / cg" |
|
9159 |
! |
|
9160 |
||
334 | 9161 |
_WScrollPanePeer_setSpans:nativeContext |
9162 |
||
9163 |
"Created: / 9.4.1998 / 17:31:44 / cg" |
|
9164 |
! |
|
9165 |
||
284 | 9166 |
_WScrollbarPeer__setValues:nativeContext |
9167 |
|scrollBar value visibleAmount min max| |
|
9168 |
||
9169 |
scrollBar := self viewForWPeer:nativeContext. |
|
9170 |
||
9171 |
value := nativeContext argAt:1. |
|
9172 |
visibleAmount := nativeContext argAt:2. |
|
9173 |
min := nativeContext argAt:3. |
|
9174 |
max := nativeContext argAt:4. |
|
9175 |
||
374 | 9176 |
(min ~~ 0 or:[max ~~ 100]) ifTrue:[ |
284 | 9177 |
scrollBar thumb start:min stop:max. |
9178 |
]. |
|
9179 |
||
9180 |
scrollBar thumbOrigin:value thumbHeight:visibleAmount. |
|
9181 |
||
9182 |
"Created: / 13.1.1998 / 22:13:57 / cg" |
|
374 | 9183 |
"Modified: / 14.10.1998 / 14:53:00 / cg" |
284 | 9184 |
! |
9185 |
||
9186 |
_WScrollbarPeer_create:nativeContext |
|
9187 |
|jScrollbarPeer jScrollbar jFrame frame scrollBar |
|
334 | 9188 |
min max| |
284 | 9189 |
|
9190 |
jScrollbarPeer := nativeContext receiver. |
|
9191 |
jScrollbar := jScrollbarPeer instVarNamed:'target'. |
|
9192 |
||
9193 |
jFrame := nativeContext argAt:1. |
|
9194 |
frame := jFrame instVarNamed:'pData'. |
|
9195 |
||
9196 |
(jScrollbar instVarNamed:'orientation') == 0 "HORIZONTAL" ifTrue:[ |
|
9197 |
scrollBar := HorizontalScrollBar in:frame. |
|
9198 |
] ifFalse:[ |
|
9199 |
scrollBar := ScrollBar in:frame. |
|
9200 |
]. |
|
9201 |
min := jScrollbar instVarNamed:'minimum'. |
|
9202 |
max := jScrollbar instVarNamed:'maximum'. |
|
9203 |
||
374 | 9204 |
scrollBar scrollDownAction:[ |
9205 |
scrollBar thumbOrigin:(scrollBar thumbOrigin + ((max-min)/10) min:max). |
|
9206 |
jScrollbarPeer perform:#'dragAbsolute(I)V' with:scrollBar thumbOrigin rounded. |
|
9207 |
]. |
|
9208 |
scrollBar scrollUpAction:[ |
|
9209 |
scrollBar thumbOrigin:(scrollBar thumbOrigin - ((max-min)/10) max:min). |
|
9210 |
jScrollbarPeer perform:#'dragAbsolute(I)V' with:scrollBar thumbOrigin rounded. |
|
9211 |
]. |
|
9212 |
scrollBar scrollAction:[:org | |
|
9213 |
jScrollbarPeer perform:#'dragAbsolute(I)V' with:org rounded. |
|
9214 |
]. |
|
284 | 9215 |
self createdWindowsView:scrollBar for:jScrollbarPeer. |
9216 |
||
9217 |
WindowCreationTrace == true ifTrue:[ |
|
9218 |
'WScrollbarPeer_create: ' print. frame print. ' -> ' print. scrollBar printNL. |
|
9219 |
]. |
|
9220 |
||
9221 |
"Created: / 5.1.1998 / 01:53:30 / cg" |
|
374 | 9222 |
"Modified: / 14.10.1998 / 15:36:19 / cg" |
284 | 9223 |
! |
9224 |
||
9225 |
_WScrollbarPeer_setLineIncrement:nativeContext |
|
9226 |
|scrollBar inc| |
|
9227 |
||
374 | 9228 |
Transcript showCR:'JavaVM: WScrollbarPeer_setLineIncrement unimplemented'. |
9229 |
||
284 | 9230 |
scrollBar := self viewForWPeer:nativeContext. |
9231 |
||
9232 |
inc := nativeContext argAt:1. |
|
9233 |
"/ scrollBar thumb lineIncrement:inc. |
|
9234 |
||
9235 |
"Created: / 25.1.1998 / 11:52:19 / cg" |
|
374 | 9236 |
"Modified: / 14.10.1998 / 14:53:56 / cg" |
284 | 9237 |
! |
9238 |
||
9239 |
_WScrollbarPeer_setPageIncrement:nativeContext |
|
9240 |
|scrollBar inc| |
|
9241 |
||
374 | 9242 |
Transcript showCR:'JavaVM: WScrollbarPeer_setPageIncrement unimplemented'. |
9243 |
||
284 | 9244 |
scrollBar := self viewForWPeer:nativeContext. |
9245 |
||
9246 |
inc := nativeContext argAt:1. |
|
9247 |
"/ scrollBar thumb pageIncrement:inc. |
|
9248 |
||
9249 |
"Created: / 25.1.1998 / 11:52:01 / cg" |
|
374 | 9250 |
"Modified: / 14.10.1998 / 14:54:04 / cg" |
284 | 9251 |
! |
9252 |
||
9253 |
_WTextAreaPeer_create:nativeContext |
|
9254 |
|jTextAreaPeer jFrame frame editTextView| |
|
9255 |
||
9256 |
jTextAreaPeer := nativeContext receiver. |
|
9257 |
||
9258 |
jFrame := nativeContext argAt:1. |
|
9259 |
frame := jFrame instVarNamed:'pData'. |
|
9260 |
||
9261 |
editTextView := HVScrollableView for:EditTextView in:frame. |
|
9262 |
||
9263 |
self createdWindowsView:editTextView for:jTextAreaPeer. |
|
9264 |
||
9265 |
WindowCreationTrace == true ifTrue:[ |
|
9266 |
'WTextAreaPeer_create: ' print. frame print. ' -> ' print. editTextView printNL. |
|
9267 |
]. |
|
9268 |
||
9269 |
"Created: / 7.1.1998 / 21:49:49 / cg" |
|
9270 |
"Modified: / 15.1.1998 / 12:56:18 / cg" |
|
9271 |
! |
|
9272 |
||
9273 |
_WTextAreaPeer_insertText:nativeContext |
|
9274 |
|textView pos string jstring| |
|
9275 |
||
9276 |
textView := self viewForWPeer:nativeContext. |
|
329 | 9277 |
(textView isKindOf:ScrollableView) ifTrue:[ |
9278 |
textView := textView scrolledView |
|
9279 |
]. |
|
284 | 9280 |
|
9281 |
jstring := nativeContext argAt:1. |
|
9282 |
string := Java as_ST_String:jstring. |
|
9283 |
pos := nativeContext argAt:2. |
|
9284 |
||
9285 |
textView insert:string at:pos. |
|
329 | 9286 |
textView cursorToCharacterPosition:pos + string size. |
9287 |
textView makeCursorVisible. |
|
9288 |
"/ textView invalidateRepairNow:true. |
|
284 | 9289 |
^ nil |
9290 |
||
9291 |
"Created: / 7.1.1998 / 21:50:23 / cg" |
|
329 | 9292 |
"Modified: / 5.4.1998 / 17:37:24 / cg" |
284 | 9293 |
! |
9294 |
||
440 | 9295 |
_WTextAreaPeer_replaceText:nativeContext |
9296 |
"/ void replaceText (java.lang.String int int) |
|
9297 |
UnimplementedNativeMethodSignal raise |
|
9298 |
||
9299 |
"Created: / 12.11.1998 / 19:11:14 / cg" |
|
9300 |
! |
|
9301 |
||
284 | 9302 |
_WTextComponentPeer_enableEditing:nativeContext |
9303 |
|textView enabled| |
|
9304 |
||
9305 |
textView := self viewForWPeer:nativeContext. |
|
9306 |
enabled := (nativeContext argAt:1) ~~ 0. |
|
9307 |
||
9308 |
^ textView readOnly:enabled not |
|
9309 |
||
9310 |
"Created: / 5.1.1998 / 01:29:38 / cg" |
|
9311 |
"Modified: / 25.1.1998 / 16:29:56 / cg" |
|
9312 |
! |
|
9313 |
||
9314 |
_WTextComponentPeer_getSelectionEnd:nativeContext |
|
9315 |
|textView| |
|
9316 |
||
9317 |
textView := self viewForWPeer:nativeContext. |
|
9318 |
||
9319 |
^ textView characterPositionOfSelectionEnd |
|
9320 |
||
9321 |
"Created: / 8.1.1998 / 17:41:56 / cg" |
|
9322 |
"Modified: / 15.1.1998 / 15:47:18 / cg" |
|
9323 |
! |
|
9324 |
||
9325 |
_WTextComponentPeer_getSelectionStart:nativeContext |
|
9326 |
|textView| |
|
9327 |
||
9328 |
textView := self viewForWPeer:nativeContext. |
|
9329 |
||
9330 |
^ textView characterPositionOfSelection - 1 |
|
9331 |
||
9332 |
"Created: / 15.8.1997 / 15:45:45 / cg" |
|
9333 |
"Modified: / 15.1.1998 / 15:46:51 / cg" |
|
9334 |
! |
|
9335 |
||
9336 |
_WTextComponentPeer_getText:nativeContext |
|
9337 |
|textView string jString| |
|
9338 |
||
9339 |
textView := self viewForWPeer:nativeContext. |
|
9340 |
||
9341 |
string := textView contents asString. |
|
9342 |
jString := Java as_String:string. |
|
9343 |
^ jString |
|
9344 |
||
9345 |
"Created: / 6.1.1998 / 21:05:15 / cg" |
|
9346 |
"Modified: / 8.1.1998 / 17:36:52 / cg" |
|
9347 |
! |
|
9348 |
||
9349 |
_WTextComponentPeer_select:nativeContext |
|
9350 |
|textView selStart selEnd| |
|
9351 |
||
9352 |
textView := self viewForWPeer:nativeContext. |
|
9353 |
selStart := nativeContext argAt:1. |
|
9354 |
selEnd := nativeContext argAt:2. |
|
9355 |
||
9356 |
selStart == selEnd ifTrue:[ |
|
9357 |
"/ clear selection |
|
9358 |
textView unselect. |
|
9359 |
"/ and set caret |
|
9360 |
textView cursorToCharacterPosition:selStart + 1 |
|
9361 |
] ifFalse:[ |
|
9362 |
"/ change selection |
|
9363 |
textView selectFromCharacterPosition:selStart+1 to:selEnd |
|
9364 |
]. |
|
9365 |
||
9366 |
"Created: / 15.8.1997 / 15:45:58 / cg" |
|
9367 |
"Modified: / 15.1.1998 / 21:55:57 / cg" |
|
9368 |
! |
|
9369 |
||
9370 |
_WTextComponentPeer_setText:nativeContext |
|
9371 |
|textView string jstring| |
|
9372 |
||
9373 |
textView := self viewForWPeer:nativeContext. |
|
9374 |
||
9375 |
jstring := nativeContext argAt:1. |
|
9376 |
string := Java as_ST_String:jstring. |
|
9377 |
||
9378 |
textView contents:string. |
|
9379 |
||
9380 |
"Created: / 5.1.1998 / 01:28:23 / cg" |
|
9381 |
"Modified: / 15.1.1998 / 15:59:57 / cg" |
|
9382 |
! |
|
9383 |
||
9384 |
_WTextFieldPeer_create:nativeContext |
|
9385 |
|jTextFieldPeer jFrame frame editField| |
|
9386 |
||
9387 |
jTextFieldPeer := nativeContext receiver. |
|
9388 |
||
9389 |
jFrame := nativeContext argAt:1. |
|
9390 |
frame := jFrame instVarNamed:'pData'. |
|
9391 |
||
9392 |
editField := EditField in:frame. |
|
9393 |
||
9394 |
self createdWindowsView:editField for:jTextFieldPeer. |
|
9395 |
||
9396 |
editField crAction:[ |
|
419 | 9397 |
jTextFieldPeer perform:#handleAction. |
284 | 9398 |
]. |
9399 |
WindowCreationTrace == true ifTrue:[ |
|
9400 |
'WTextFieldPeer_create: ' print. frame print. ' -> ' print. editField printNL. |
|
9401 |
]. |
|
9402 |
||
9403 |
"Created: / 5.1.1998 / 01:27:37 / cg" |
|
419 | 9404 |
"Modified: / 4.11.1998 / 21:07:30 / cg" |
284 | 9405 |
! |
9406 |
||
9407 |
_WTextFieldPeer_setEchoCharacter:nativeContext |
|
9408 |
|editField char| |
|
9409 |
||
9410 |
editField := self viewForWPeer:nativeContext. |
|
9411 |
||
9412 |
char := nativeContext argAt:1. |
|
9413 |
editField passwordCharacter:(Character value:char). |
|
9414 |
||
9415 |
"Created: / 25.1.1998 / 16:28:30 / cg" |
|
9416 |
! |
|
9417 |
||
440 | 9418 |
_WToolkit_beep:nativeContext |
9419 |
"/ void beep () |
|
9420 |
UnimplementedNativeMethodSignal raise |
|
9421 |
||
9422 |
"Created: / 12.11.1998 / 19:09:23 / cg" |
|
9423 |
! |
|
9424 |
||
284 | 9425 |
_WToolkit_eventLoop:nativeContext |
9426 |
JavaEventThread := Processor activeProcess. |
|
9427 |
[ |
|
9428 |
[true] whileTrue:[ |
|
9429 |
AbortSignal handle:[:ex | |
|
9430 |
ex return |
|
9431 |
] do:[ |
|
9432 |
self doWindowsEventThread. |
|
9433 |
] |
|
9434 |
]. |
|
9435 |
] valueNowOrOnUnwindDo:[ |
|
9436 |
JavaEventThread := nil. |
|
9437 |
]. |
|
9438 |
||
9439 |
"Created: / 6.1.1998 / 21:01:44 / cg" |
|
9440 |
"Modified: / 15.1.1998 / 19:48:55 / cg" |
|
9441 |
! |
|
9442 |
||
405 | 9443 |
_WToolkit_getComboHeightOffset:nativeContext |
9444 |
^ 0 |
|
9445 |
||
9446 |
"Modified: / 20.3.1997 / 13:50:04 / cg" |
|
9447 |
"Created: / 22.10.1998 / 00:59:14 / cg" |
|
9448 |
! |
|
9449 |
||
284 | 9450 |
_WToolkit_getScreenHeight:nativeContext |
9451 |
^ Screen current height |
|
9452 |
||
9453 |
"Modified: / 20.3.1997 / 13:50:04 / cg" |
|
9454 |
"Created: / 13.1.1998 / 09:24:45 / cg" |
|
9455 |
! |
|
9456 |
||
9457 |
_WToolkit_getScreenResolution:nativeContext |
|
9458 |
^ Screen current resolution x rounded |
|
9459 |
||
9460 |
"Modified: / 20.3.1997 / 13:50:04 / cg" |
|
9461 |
"Created: / 17.1.1998 / 21:54:48 / cg" |
|
9462 |
! |
|
9463 |
||
9464 |
_WToolkit_getScreenWidth:nativeContext |
|
9465 |
^ Screen current width |
|
9466 |
||
9467 |
"Modified: / 20.3.1997 / 13:50:04 / cg" |
|
9468 |
"Created: / 13.1.1998 / 09:24:37 / cg" |
|
9469 |
! |
|
9470 |
||
9471 |
_WToolkit_init:nativeContext |
|
9472 |
||
9473 |
"Created: / 3.1.1998 / 02:30:57 / cg" |
|
9474 |
! |
|
9475 |
||
9476 |
_WToolkit_loadSystemColors:nativeContext |
|
9477 |
"/ self halt. |
|
9478 |
||
9479 |
"Modified: / 18.3.1997 / 18:43:26 / cg" |
|
9480 |
"Created: / 5.1.1998 / 02:19:09 / cg" |
|
9481 |
! |
|
9482 |
||
440 | 9483 |
_WToolkit_makeColorModel:nativeContext |
9484 |
"/ java.awt.image.ColorModel makeColorModel () |
|
9485 |
UnimplementedNativeMethodSignal raise |
|
9486 |
||
9487 |
"Created: / 12.11.1998 / 19:08:47 / cg" |
|
9488 |
! |
|
9489 |
||
9490 |
_WToolkit_sync:nativeContext |
|
9491 |
"/ void sync () |
|
9492 |
UnimplementedNativeMethodSignal raise |
|
9493 |
||
9494 |
"Created: / 12.11.1998 / 19:09:14 / cg" |
|
9495 |
! |
|
9496 |
||
284 | 9497 |
_WWindowPeer__setResizable:nativeContext |
9498 |
|view onOff| |
|
9499 |
||
9500 |
view := self viewForWPeer:nativeContext. |
|
9501 |
||
9502 |
onOff := (nativeContext argAt:1) == 1. |
|
9503 |
view isTopView ifTrue:[ |
|
9504 |
onOff ifTrue:[ |
|
9505 |
view minExtent:10@10. |
|
9506 |
view maxExtent:(Screen current extent). |
|
9507 |
] ifFalse:[ |
|
9508 |
view minExtent:view extent. |
|
9509 |
view maxExtent:view extent. |
|
9510 |
] |
|
9511 |
] ifFalse:[ |
|
9512 |
(view isMemberOf:JavaEmbeddedFrameView) ifFalse:[ |
|
9513 |
self halt. |
|
9514 |
] |
|
9515 |
]. |
|
9516 |
||
9517 |
"/ 'JAVA: WWindowPeer_setResizable: ' print. view print. ' yes/no: ' print. onOff printNL. |
|
9518 |
||
9519 |
^ nil |
|
9520 |
||
9521 |
"Created: / 5.1.1998 / 00:57:59 / cg" |
|
9522 |
"Modified: / 16.1.1998 / 18:08:00 / cg" |
|
9523 |
! |
|
9524 |
||
9525 |
_WWindowPeer__setTitle:nativeContext |
|
9526 |
|view jString string| |
|
9527 |
||
9528 |
view := self viewForWPeer:nativeContext. |
|
9529 |
||
9530 |
jString := nativeContext argAt:1. |
|
9531 |
string := Java as_ST_String:jString. |
|
9532 |
||
9533 |
"/ 'JAVA: WWindowPeer_pSetTitle: ' print. string print. ' ' print. view printNL. |
|
9534 |
||
9535 |
view label:string. |
|
9536 |
^ nil |
|
9537 |
||
9538 |
"Created: / 5.1.1998 / 00:57:17 / cg" |
|
9539 |
"Modified: / 8.1.1998 / 17:37:41 / cg" |
|
9540 |
! |
|
9541 |
||
440 | 9542 |
_WWindowPeer_create:nativeContext |
9543 |
"/ void create (sun.awt.windows.WComponentPeer) |
|
482 | 9544 |
|jWindowPeer jWindow top window pDataIdx| |
9545 |
||
9546 |
jWindowPeer := nativeContext receiver. |
|
9547 |
||
9548 |
jWindow := jWindowPeer instVarNamed:'target'. |
|
9549 |
window := jWindowPeer instVarNamed:'pData'. |
|
9550 |
||
9551 |
(window notNil and:[window ~~ 0]) ifTrue:[ |
|
9552 |
WindowCreationTrace == true ifTrue:[ |
|
9553 |
'JAVA: window view already created: ' infoPrint. |
|
9554 |
jWindowPeer class name infoPrintCR. |
|
9555 |
]. |
|
9556 |
] ifFalse:[ |
|
9557 |
"/ OLD |
|
9558 |
"/ window := StandardSystemView new. |
|
9559 |
"/ self createdWindowsView:window for:jWindowPeer. |
|
9560 |
"/ JavaWindowGroup addTopView:window. |
|
9561 |
||
9562 |
window := JavaPopUpView new. |
|
483 | 9563 |
window borderWidth:0. |
9564 |
window level:0. |
|
482 | 9565 |
window delegate:self. |
9566 |
window javaPeer:jWindowPeer. |
|
9567 |
self createdWindowsView:window for:jWindowPeer. |
|
9568 |
JavaWindowGroup addTopView:window. |
|
9569 |
||
9570 |
"/ top := StandardSystemView new. |
|
9571 |
"/ window := JavaView origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
9572 |
"/ window delegate:self. |
|
9573 |
"/ window javaPeer:jWindowPeer. |
|
9574 |
"/ self createdWindowsView:window for:jWindowPeer. |
|
9575 |
"/ JavaWindowGroup addTopView:top. |
|
9576 |
||
9577 |
]. |
|
9578 |
||
9579 |
WindowCreationTrace == true ifTrue:[ |
|
9580 |
'JAVA: WWindowPeer_create: ' print. jWindowPeer displayString print. |
|
9581 |
' window: ' print. window printNL. |
|
9582 |
]. |
|
9583 |
||
9584 |
"Created: / 4.1.1998 / 17:56:39 / cg" |
|
483 | 9585 |
"Modified: / 4.12.1998 / 17:37:59 / cg" |
440 | 9586 |
! |
9587 |
||
9588 |
_WWindowPeer_getContainerElement:nativeContext |
|
9589 |
"/ java.awt.Component getContainerElement (java.awt.Container int) |
|
9590 |
UnimplementedNativeMethodSignal raise |
|
9591 |
||
9592 |
"Created: / 12.11.1998 / 19:10:54 / cg" |
|
9593 |
! |
|
9594 |
||
342 | 9595 |
_WWindowPeer_toBack:nativeContext |
9596 |
|view| |
|
9597 |
||
9598 |
view := self viewForWPeer:nativeContext. |
|
9599 |
view lower. |
|
9600 |
||
9601 |
"Created: / 7.5.1998 / 00:23:03 / cg" |
|
9602 |
! |
|
9603 |
||
337 | 9604 |
_WWindowPeer_toFront:nativeContext |
9605 |
|view| |
|
9606 |
||
9607 |
view := self viewForWPeer:nativeContext. |
|
9608 |
view raise. |
|
9609 |
||
9610 |
"Created: / 9.4.1998 / 22:17:28 / cg" |
|
9611 |
! |
|
9612 |
||
284 | 9613 |
_WWindowPeer_updateInsets:nativeContext |
9614 |
"/ self halt. |
|
9615 |
||
9616 |
"Modified: / 18.3.1997 / 18:43:18 / cg" |
|
9617 |
"Created: / 4.1.1998 / 18:09:04 / cg" |
|
9618 |
! ! |
|
9619 |
||
9620 |
!JavaVM class methodsFor:'native - sun.awt.windows - jdk1.2'! |
|
9621 |
||
9622 |
_WFramePeer_setTitle:nativeContext |
|
9623 |
|view jString string| |
|
9624 |
||
9625 |
view := self viewForWPeer:nativeContext. |
|
9626 |
||
9627 |
jString := nativeContext argAt:1. |
|
9628 |
string := Java as_ST_String:jString. |
|
9629 |
||
9630 |
"/ 'JAVA: WFramePeer_pSetTitle: ' print. string print. ' ' print. view printNL. |
|
9631 |
||
9632 |
view label:string. |
|
9633 |
^ nil |
|
9634 |
||
9635 |
"Modified: / 8.1.1998 / 17:37:41 / cg" |
|
9636 |
"Created: / 27.1.1998 / 21:42:57 / cg" |
|
9637 |
! |
|
9638 |
||
9639 |
_WPanelPeer_calculateInsets:nativeContext |
|
9640 |
"/ new with jdk1.2 ... |
|
9641 |
||
9642 |
"Created: / 27.1.1998 / 21:40:00 / cg" |
|
9643 |
! ! |
|
9644 |
||
457 | 9645 |
!JavaVM class methodsFor:'native - sun.awt.windows - ms'! |
9646 |
||
9647 |
_MCanvasPeer_create:nativeContext |
|
9648 |
|jCanvasPeer jFrame frame subView| |
|
9649 |
||
9650 |
jCanvasPeer := nativeContext receiver. |
|
9651 |
||
9652 |
jFrame := nativeContext argAt:1. |
|
9653 |
jFrame isNil ifTrue:[ |
|
9654 |
self halt:'no frame in canvasPeer create'. |
|
9655 |
self internalError:'no frame in canvasPeer create'. |
|
9656 |
^ self. |
|
9657 |
]. |
|
9658 |
frame := jFrame instVarNamed:'pData'. |
|
9659 |
||
9660 |
subView := JavaView in:frame. |
|
9661 |
subView delegate:self. |
|
9662 |
subView javaPeer:jCanvasPeer. |
|
9663 |
||
9664 |
self createdWindowsView:subView for:jCanvasPeer. |
|
9665 |
||
9666 |
WindowCreationTrace == true ifTrue:[ |
|
9667 |
'WCanvasPeer_create: ' print. frame print. ' -> ' print. subView printNL. |
|
9668 |
]. |
|
9669 |
||
9670 |
"Modified: / 16.1.1998 / 13:40:00 / cg" |
|
9671 |
"Created: / 18.11.1998 / 00:14:44 / cg" |
|
9672 |
! |
|
9673 |
||
9674 |
_MComponentPeer_pReshape:nativeContext |
|
9675 |
self commonReshapeComponent:nativeContext |
|
9676 |
||
9677 |
"Created: / 18.11.1998 / 00:18:17 / cg" |
|
9678 |
! |
|
9679 |
||
9680 |
_MComponentPeer_setBackground:nativeContext |
|
9681 |
|jClr rgb clr view| |
|
9682 |
||
9683 |
view := self viewForWPeer:nativeContext. |
|
9684 |
||
9685 |
jClr := nativeContext argAt:1. |
|
9686 |
rgb := jClr instVarNamed:'value'. |
|
9687 |
"/ self halt. |
|
9688 |
clr := Color rgbValue:rgb. |
|
9689 |
||
9690 |
||
9691 |
clr := clr on:(view device). |
|
9692 |
||
9693 |
(view isKindOf:ScrollableView) ifTrue:[ |
|
9694 |
view := view scrolledView |
|
9695 |
]. |
|
9696 |
view viewBackground:clr. |
|
9697 |
view backgroundPaint:clr. |
|
9698 |
||
9699 |
"Created: / 17.11.1998 / 23:49:41 / cg" |
|
9700 |
! |
|
9701 |
||
9702 |
_MComponentPeer_setFont:nativeContext |
|
9703 |
|view| |
|
9704 |
||
9705 |
view := self viewForWPeer:nativeContext. |
|
9706 |
"/ self halt. |
|
9707 |
||
9708 |
"Modified: / 25.1.1998 / 01:22:19 / cg" |
|
9709 |
"Created: / 17.11.1998 / 23:43:48 / cg" |
|
9710 |
! |
|
9711 |
||
9712 |
_MComponentPeer_setForeground:nativeContext |
|
9713 |
|jClr rgb clr view| |
|
9714 |
||
9715 |
view := self viewForWPeer:nativeContext. |
|
9716 |
||
9717 |
jClr := nativeContext argAt:1. |
|
9718 |
rgb := jClr instVarNamed:'value'. |
|
9719 |
"/ self halt. |
|
9720 |
clr := Color rgbValue:rgb. |
|
9721 |
||
9722 |
clr := clr on:(view device). |
|
9723 |
||
9724 |
view paint:clr. |
|
9725 |
||
9726 |
"Created: / 17.11.1998 / 23:50:31 / cg" |
|
9727 |
"Modified: / 17.11.1998 / 23:57:29 / cg" |
|
9728 |
! |
|
9729 |
||
9730 |
_MFramePeer_getWindowBackgroundColor:nativeContext |
|
9731 |
^ View defaultViewBackgroundColor rgbValue. |
|
9732 |
||
9733 |
"Created: / 17.11.1998 / 23:55:42 / cg" |
|
9734 |
! |
|
9735 |
||
9736 |
_MFramePeer_pShow:nativeContext |
|
9737 |
|view| |
|
9738 |
||
9739 |
view := self viewForWPeer:nativeContext. |
|
9740 |
||
9741 |
"/ frame views are under my browsers own control |
|
9742 |
(view isMemberOf:JavaEmbeddedFrameView) ifFalse:[ |
|
9743 |
view beVisible. |
|
9744 |
view realize. |
|
9745 |
]. |
|
9746 |
||
9747 |
"/ view windowGroup notNil ifTrue:[ |
|
9748 |
"/ windowServer addGroup:(view windowGroup) |
|
9749 |
"/ ]. |
|
9750 |
||
9751 |
^ nil |
|
9752 |
||
9753 |
"/ self halt. |
|
9754 |
||
9755 |
"Modified: / 25.1.1998 / 09:54:07 / cg" |
|
9756 |
"Created: / 18.11.1998 / 00:19:59 / cg" |
|
9757 |
! |
|
9758 |
||
9759 |
_MFramePeer_setInsets:nativeContext |
|
9760 |
||
9761 |
"Created: / 17.11.1998 / 23:55:32 / cg" |
|
9762 |
! |
|
9763 |
||
9764 |
_MFramePeer_setResizable:nativeContext |
|
9765 |
|view onOff| |
|
9766 |
||
9767 |
view := self viewForWPeer:nativeContext. |
|
9768 |
||
9769 |
onOff := (nativeContext argAt:1) == 1. |
|
9770 |
view isTopView ifTrue:[ |
|
9771 |
onOff ifTrue:[ |
|
9772 |
view minExtent:10@10. |
|
9773 |
view maxExtent:(Screen current extent). |
|
9774 |
] ifFalse:[ |
|
9775 |
view minExtent:view extent. |
|
9776 |
view maxExtent:view extent. |
|
9777 |
] |
|
9778 |
] ifFalse:[ |
|
9779 |
(view isMemberOf:JavaEmbeddedFrameView) ifFalse:[ |
|
9780 |
self halt. |
|
9781 |
] |
|
9782 |
]. |
|
9783 |
||
9784 |
"/ 'JAVA: WWindowPeer_setResizable: ' print. view print. ' yes/no: ' print. onOff printNL. |
|
9785 |
||
9786 |
^ nil |
|
9787 |
||
9788 |
"Modified: / 16.1.1998 / 18:08:00 / cg" |
|
9789 |
"Created: / 17.11.1998 / 23:51:45 / cg" |
|
9790 |
! |
|
9791 |
||
9792 |
_MToolkit_callbackLoop:nativeContext |
|
9793 |
|toolKit| |
|
9794 |
||
9795 |
toolKit := nativeContext receiver. |
|
9796 |
^ self. |
|
9797 |
self halt. |
|
9798 |
self wakeup:toolKit. |
|
9799 |
self halt. |
|
9800 |
||
9801 |
JavaEventThread := Processor activeProcess. |
|
9802 |
[ |
|
9803 |
[true] whileTrue:[ |
|
9804 |
AbortSignal handle:[:ex | |
|
9805 |
ex return |
|
9806 |
] do:[ |
|
9807 |
self doWindowsEventThread. |
|
9808 |
] |
|
9809 |
]. |
|
9810 |
] valueNowOrOnUnwindDo:[ |
|
9811 |
JavaEventThread := nil. |
|
9812 |
]. |
|
9813 |
||
9814 |
"Created: / 17.11.1998 / 23:58:33 / cg" |
|
9815 |
"Modified: / 18.11.1998 / 00:13:19 / cg" |
|
9816 |
! |
|
9817 |
||
9818 |
_MToolkit_eventLoop:nativeContext |
|
9819 |
|toolKit| |
|
9820 |
||
9821 |
toolKit := nativeContext receiver. |
|
9822 |
||
9823 |
self wakeup:toolKit. |
|
9824 |
self halt. |
|
9825 |
||
9826 |
JavaEventThread := Processor activeProcess. |
|
9827 |
[ |
|
9828 |
[true] whileTrue:[ |
|
9829 |
AbortSignal handle:[:ex | |
|
9830 |
ex return |
|
9831 |
] do:[ |
|
9832 |
self doWindowsEventThread. |
|
9833 |
] |
|
9834 |
]. |
|
9835 |
] valueNowOrOnUnwindDo:[ |
|
9836 |
JavaEventThread := nil. |
|
9837 |
]. |
|
9838 |
||
9839 |
"Created: / 17.11.1998 / 23:04:29 / cg" |
|
9840 |
"Modified: / 18.11.1998 / 00:11:29 / cg" |
|
9841 |
! ! |
|
9842 |
||
380 | 9843 |
!JavaVM class methodsFor:'native - sun.awt.windows - ns4.0'! |
9844 |
||
9845 |
_WComponentPeer_setBackground:nativeContext |
|
9846 |
|jClr rgb clr view| |
|
9847 |
||
9848 |
view := self viewForWPeer:nativeContext. |
|
9849 |
||
9850 |
jClr := nativeContext argAt:1. |
|
9851 |
rgb := jClr instVarNamed:'value'. |
|
9852 |
"/ self halt. |
|
9853 |
clr := Color rgbValue:rgb. |
|
9854 |
||
9855 |
||
9856 |
clr := clr on:(view device). |
|
9857 |
||
9858 |
"/ (view superView isMemberOf:JavaEmbeddedFrameView) ifTrue:[ |
|
9859 |
"/ view viewBackground:(view superView viewBackground). |
|
9860 |
"/ view backgroundPaint:(view superView viewBackground). |
|
9861 |
"/ ] ifFalse:[ |
|
9862 |
"/ (view isMemberOf:JavaView) ifTrue:[ |
|
9863 |
"/ view viewBackground:clr. |
|
9864 |
"/ view backgroundPaint:clr. |
|
9865 |
"/ ] |
|
9866 |
"/ ]. |
|
9867 |
||
9868 |
(view isKindOf:ScrollableView) ifTrue:[ |
|
9869 |
view := view scrolledView |
|
9870 |
]. |
|
9871 |
view viewBackground:clr. |
|
9872 |
view backgroundPaint:clr. |
|
9873 |
||
9874 |
"Created: / 16.10.1998 / 02:16:31 / cg" |
|
9875 |
"Modified: / 16.10.1998 / 02:26:29 / cg" |
|
9876 |
! |
|
9877 |
||
9878 |
_WComponentPeer_setForeground:nativeContext |
|
9879 |
|jClr rgb clr view| |
|
9880 |
||
9881 |
view := self viewForWPeer:nativeContext. |
|
9882 |
||
9883 |
jClr := nativeContext argAt:1. |
|
9884 |
rgb := jClr instVarNamed:'value'. |
|
9885 |
"/ self halt. |
|
9886 |
clr := Color rgbValue:rgb. |
|
9887 |
||
9888 |
||
9889 |
clr := clr on:(view device). |
|
9890 |
||
9891 |
(view isKindOf:ScrollableView) ifTrue:[ |
|
9892 |
view := view scrolledView |
|
9893 |
]. |
|
9894 |
view paint:clr. |
|
9895 |
||
9896 |
"Created: / 16.10.1998 / 02:18:58 / cg" |
|
9897 |
"Modified: / 16.10.1998 / 02:26:37 / cg" |
|
9898 |
! |
|
9899 |
||
9900 |
_WContainerPeer_calculateInsets:nativeContext |
|
9901 |
"/ new with ns4.0 ... |
|
9902 |
||
9903 |
"Created: / 16.10.1998 / 02:12:59 / cg" |
|
9904 |
! |
|
9905 |
||
9906 |
_WFramePeer_setResizable:nativeContext |
|
9907 |
|view onOff| |
|
9908 |
||
9909 |
view := self viewForWPeer:nativeContext. |
|
9910 |
||
9911 |
onOff := (nativeContext argAt:1) == 1. |
|
9912 |
view isTopView ifTrue:[ |
|
9913 |
onOff ifTrue:[ |
|
9914 |
view minExtent:10@10. |
|
9915 |
view maxExtent:(Screen current extent). |
|
9916 |
] ifFalse:[ |
|
9917 |
view minExtent:view extent. |
|
9918 |
view maxExtent:view extent. |
|
9919 |
] |
|
9920 |
] ifFalse:[ |
|
9921 |
(view isMemberOf:JavaEmbeddedFrameView) ifFalse:[ |
|
9922 |
self halt. |
|
9923 |
] |
|
9924 |
]. |
|
9925 |
||
9926 |
"/ 'JAVA: WWindowPeer_setResizable: ' print. view print. ' yes/no: ' print. onOff printNL. |
|
9927 |
||
9928 |
^ nil |
|
9929 |
||
9930 |
"Modified: / 16.1.1998 / 18:08:00 / cg" |
|
9931 |
"Created: / 16.10.1998 / 02:21:34 / cg" |
|
9932 |
! ! |
|
9933 |
||
440 | 9934 |
!JavaVM class methodsFor:'native - sun.misc'! |
9935 |
||
9936 |
_VM_getState:nativeContext |
|
9937 |
"/ int getState () |
|
9938 |
UnimplementedNativeMethodSignal raise |
|
9939 |
||
9940 |
"Created: / 12.11.1998 / 19:06:44 / cg" |
|
9941 |
! |
|
9942 |
||
448 | 9943 |
_VM_resetJavaMonitor:nativeContext |
9944 |
"/ void resetJavaMonitor () |
|
9945 |
UnimplementedNativeMethodSignal raise |
|
9946 |
||
9947 |
"Created: / 14.11.1998 / 10:43:23 / cg" |
|
9948 |
! |
|
9949 |
||
9950 |
_VM_resumeJavaMonitor:nativeContext |
|
9951 |
"/ void resumeJavaMonitor () |
|
9952 |
UnimplementedNativeMethodSignal raise |
|
9953 |
||
9954 |
"Created: / 14.11.1998 / 10:42:49 / cg" |
|
9955 |
! |
|
9956 |
||
9957 |
_VM_suspendJavaMonitor:nativeContext |
|
9958 |
"/ void suspendJavaMonitor () |
|
9959 |
UnimplementedNativeMethodSignal raise |
|
9960 |
||
9961 |
"Created: / 14.11.1998 / 10:43:07 / cg" |
|
9962 |
! |
|
9963 |
||
440 | 9964 |
_VM_threadsSuspended:nativeContext |
9965 |
"/ boolean threadsSuspended () |
|
9966 |
UnimplementedNativeMethodSignal raise |
|
9967 |
||
9968 |
"Created: / 12.11.1998 / 19:07:10 / cg" |
|
9969 |
! |
|
9970 |
||
9971 |
_VM_unsuspendSomeThreads:nativeContext |
|
9972 |
"/ void unsuspendSomeThreads () |
|
9973 |
UnimplementedNativeMethodSignal raise |
|
9974 |
||
9975 |
"Created: / 12.11.1998 / 19:07:29 / cg" |
|
9976 |
! |
|
9977 |
||
9978 |
_VM_unsuspendThreads:nativeContext |
|
9979 |
"/ void unsuspendThreads () |
|
9980 |
UnimplementedNativeMethodSignal raise |
|
9981 |
||
9982 |
"Created: / 12.11.1998 / 19:07:20 / cg" |
|
448 | 9983 |
! |
9984 |
||
9985 |
_VM_writeJavaMonitorReport:nativeContext |
|
9986 |
"/ void writeJavaMonitorReport () |
|
9987 |
UnimplementedNativeMethodSignal raise |
|
9988 |
||
9989 |
"Created: / 14.11.1998 / 10:43:37 / cg" |
|
440 | 9990 |
! ! |
9991 |
||
253 | 9992 |
!JavaVM class methodsFor:'semaphores & monitors'! |
9993 |
||
9994 |
monitorFor:someObject |
|
9995 |
|mon| |
|
9996 |
||
9997 |
LockTableAccess critical:[ |
|
261 | 9998 |
mon := LockTable at:someObject ifAbsent:nil. |
9999 |
mon isNil ifTrue:[ |
|
10000 |
LockTable at:someObject put:(mon := Monitor new) |
|
10001 |
] |
|
253 | 10002 |
]. |
10003 |
^ mon |
|
10004 |
||
10005 |
"Created: / 2.1.1998 / 19:01:52 / cg" |
|
10006 |
! |
|
10007 |
||
10008 |
releaseAndSignalForAllSemaphoreFor:someObject |
|
10009 |
|sema| |
|
10010 |
||
10011 |
WaitTableAccess critical:[ |
|
306 | 10012 |
sema := WaitTable at:someObject ifAbsent:nil. |
10013 |
"/ sema notNil ifTrue:[ |
|
10014 |
"/ WaitTable removeKey:someObject |
|
10015 |
"/ ] |
|
253 | 10016 |
]. |
10017 |
||
10018 |
sema notNil ifTrue:[ |
|
306 | 10019 |
sema signalForAll |
253 | 10020 |
] |
10021 |
||
10022 |
"Created: / 2.1.1998 / 18:21:51 / cg" |
|
306 | 10023 |
"Modified: / 3.2.1998 / 16:11:58 / cg" |
253 | 10024 |
! |
10025 |
||
10026 |
releaseAndSignalSemaphoreFor:someObject |
|
10027 |
|sema| |
|
10028 |
||
10029 |
WaitTableAccess critical:[ |
|
306 | 10030 |
sema := WaitTable at:someObject ifAbsent:nil. |
10031 |
"/ sema notNil ifTrue:[ |
|
10032 |
"/ WaitTable removeKey:someObject |
|
10033 |
"/ ] |
|
253 | 10034 |
]. |
10035 |
||
10036 |
sema notNil ifTrue:[ |
|
306 | 10037 |
sema signal |
253 | 10038 |
] |
10039 |
||
10040 |
"Created: / 2.1.1998 / 18:20:20 / cg" |
|
306 | 10041 |
"Modified: / 3.2.1998 / 16:11:51 / cg" |
253 | 10042 |
! |
10043 |
||
10044 |
releaseSemaphoreFor:someObject |
|
10045 |
WaitTableAccess critical:[ |
|
261 | 10046 |
WaitTable removeKey:someObject ifAbsent:nil |
253 | 10047 |
] |
10048 |
||
10049 |
"Created: / 2.1.1998 / 18:17:14 / cg" |
|
10050 |
"Modified: / 2.1.1998 / 21:52:03 / cg" |
|
10051 |
! |
|
10052 |
||
10053 |
semaphoreFor:someObject |
|
10054 |
|sema| |
|
10055 |
||
10056 |
WaitTableAccess critical:[ |
|
261 | 10057 |
sema := WaitTable at:someObject ifAbsent:nil. |
10058 |
sema isNil ifTrue:[ |
|
10059 |
WaitTable at:someObject put:(sema := Semaphore new) |
|
10060 |
] |
|
253 | 10061 |
]. |
10062 |
^ sema |
|
10063 |
||
10064 |
"Created: / 2.1.1998 / 18:15:59 / cg" |
|
10065 |
"Modified: / 2.1.1998 / 18:20:31 / cg" |
|
10066 |
! ! |
|
10067 |
||
10068 |
!JavaVM class methodsFor:'vm support'! |
|
10069 |
||
10070 |
monitorEnter:someObject |
|
10071 |
| mon thisProcess| |
|
10072 |
||
10073 |
someObject isNil ifTrue:[ |
|
261 | 10074 |
self halt |
253 | 10075 |
]. |
10076 |
||
10077 |
mon := self monitorFor:someObject. |
|
10078 |
||
10079 |
MonitorTrace ifTrue:[ |
|
261 | 10080 |
('====> entering monitor for ' , someObject displayString , ' in ' , Processor activeProcess name , ' ...') printCR. |
253 | 10081 |
]. |
10082 |
mon enter. |
|
10083 |
MonitorTrace ifTrue:[ |
|
261 | 10084 |
('====> entered it in ' , Processor activeProcess name , ' ...') printCR. |
253 | 10085 |
]. |
10086 |
||
10087 |
self enteredMonitors add:someObject. |
|
10088 |
||
10089 |
"Created: / 2.1.1998 / 23:44:49 / cg" |
|
10090 |
"Modified: / 3.1.1998 / 03:05:02 / cg" |
|
10091 |
! |
|
10092 |
||
10093 |
monitorExit:someObject |
|
10094 |
| mon thisProcess| |
|
10095 |
||
10096 |
someObject isNil ifTrue:[ |
|
261 | 10097 |
self halt |
253 | 10098 |
]. |
10099 |
||
10100 |
mon := self monitorFor:someObject. |
|
10101 |
||
10102 |
MonitorTrace ifTrue:[ |
|
261 | 10103 |
('====> leaving monitor for ' , someObject displayString , ' in ' , Processor activeProcess name , ' ...') printCR. |
253 | 10104 |
]. |
10105 |
mon exit. |
|
10106 |
MonitorTrace ifTrue:[ |
|
261 | 10107 |
('====> left it in ' , Processor activeProcess name , ' ...') printCR. |
253 | 10108 |
]. |
10109 |
||
10110 |
"/ enteredMonitorHandles isNil ifTrue:[ |
|
10111 |
"/ self halt:'oops - no monitor entered'. |
|
10112 |
"/ ]. |
|
10113 |
||
10114 |
self enteredMonitors removeLast ~~ someObject ifTrue:[ |
|
261 | 10115 |
self halt:'oops - monitor enter/exit nesting wrong' |
253 | 10116 |
]. |
10117 |
||
10118 |
"Created: / 2.1.1998 / 23:47:28 / cg" |
|
10119 |
"Modified: / 3.1.1998 / 03:05:18 / cg" |
|
10120 |
! ! |
|
10121 |
||
255 | 10122 |
!JavaVM class methodsFor:'windows - events'! |
10123 |
||
10124 |
awtEventsForEvent:anEvent javaWindow:jWin |
|
10125 |
"given an ST/X event, create corresponding AWT event(s) for it" |
|
10126 |
||
10127 |
|jEv jEv1 jEv2 |
|
261 | 10128 |
modifiers key keyChar untranslatedKey id |
466 | 10129 |
type x y w h view menu resized moved |
255 | 10130 |
eventArgs clickCount jRect |
10131 |
jKeyEventClass jInputEventClass jMouseEventClass |
|
10132 |
jWindowEventClass jPaintEventClass jComponentEventClass| |
|
10133 |
||
10134 |
type := anEvent type. |
|
10135 |
eventArgs := anEvent arguments. |
|
10136 |
||
10137 |
key := 0. |
|
10138 |
modifiers := 0. |
|
10139 |
x := 0. |
|
10140 |
y := 0. |
|
10141 |
||
476 | 10142 |
|
10143 |
((type == #'exposeX:y:width:height:') |
|
10144 |
or:[(type == #'graphicExposeX:y:width:height:') |
|
10145 |
or:[(type == #damage)]]) ifTrue:[ |
|
10146 |
"/ jWindowEventClass := Java classForName:'java.awt.event.WindowEvent'. |
|
10147 |
"/ id := (jPaintEventClass instVarNamed:'PAINT'). |
|
10148 |
||
10149 |
jPaintEventClass := Java classForName:'java.awt.event.PaintEvent'. |
|
10150 |
id := (jPaintEventClass instVarNamed:'UPDATE'). |
|
10151 |
||
10152 |
((type == #'exposeX:y:width:height:') |
|
10153 |
or:[(type == #'graphicExposeX:y:width:height:')]) ifTrue:[ |
|
10154 |
x := eventArgs at:1. |
|
10155 |
y := eventArgs at:2. |
|
10156 |
w := eventArgs at:3. |
|
10157 |
h := eventArgs at:4. |
|
10158 |
] ifFalse:[ |
|
10159 |
x := eventArgs left. |
|
10160 |
y := eventArgs top. |
|
10161 |
w := eventArgs width. |
|
10162 |
h := eventArgs height. |
|
10163 |
]. |
|
10164 |
jRect := (Java classForName:'java.awt.Rectangle') basicNew. |
|
10165 |
jRect instVarNamed:'x' put:x. |
|
10166 |
jRect instVarNamed:'y' put:y. |
|
10167 |
jRect instVarNamed:'width' put:w. |
|
10168 |
jRect instVarNamed:'height' put:h. |
|
10169 |
||
10170 |
jEv := jPaintEventClass newCleared "basicNew". |
|
10171 |
jEv instVarNamed:'id' put:id. |
|
10172 |
jEv instVarNamed:'updateRect' put:jRect. |
|
10173 |
||
10174 |
"/ jEv instVarNamed:'g' put:jWin. |
|
10175 |
||
10176 |
^ Array with:jEv. |
|
10177 |
]. |
|
10178 |
||
255 | 10179 |
(anEvent isKeyEvent |
10180 |
or:[anEvent isButtonEvent |
|
10181 |
or:[anEvent isPointerEnterLeaveEvent]]) ifTrue:[ |
|
439 | 10182 |
jInputEventClass := Java classForName:'java.awt.event.InputEvent'. |
10183 |
||
255 | 10184 |
anEvent hasAlt ifTrue:[ |
10185 |
modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'ALT_MASK') |
|
10186 |
]. |
|
10187 |
anEvent hasCtrl ifTrue:[ |
|
10188 |
modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'CTRL_MASK') |
|
10189 |
]. |
|
10190 |
anEvent hasMeta ifTrue:[ |
|
10191 |
modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'META_MASK') |
|
10192 |
]. |
|
10193 |
anEvent hasShift ifTrue:[ |
|
10194 |
modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'SHIFT_MASK') |
|
10195 |
]. |
|
10196 |
anEvent hasButton1 ifTrue:[ |
|
10197 |
modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'BUTTON1_MASK') |
|
10198 |
]. |
|
10199 |
anEvent hasButton2 ifTrue:[ |
|
10200 |
modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'BUTTON2_MASK') |
|
10201 |
]. |
|
10202 |
anEvent hasButton3 ifTrue:[ |
|
10203 |
modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'BUTTON3_MASK') |
|
10204 |
]. |
|
10205 |
||
10206 |
anEvent isPointerEnterLeaveEvent ifFalse:[ |
|
10207 |
"/ ST/X does not (yet) record this information |
|
10208 |
"/ with pointerLeave events. |
|
10209 |
||
10210 |
x := anEvent x. |
|
10211 |
y := anEvent y. |
|
10212 |
]. |
|
10213 |
]. |
|
10214 |
||
10215 |
anEvent isKeyEvent ifTrue:[ |
|
10216 |
jKeyEventClass := Java classForName:'java.awt.event.KeyEvent'. |
|
10217 |
||
10218 |
key := 0. |
|
10219 |
keyChar := 0. |
|
10220 |
||
10221 |
key := anEvent key. |
|
10222 |
key isCharacter ifTrue:[ |
|
10223 |
key := keyChar := key asciiValue |
|
10224 |
] ifFalse:[ |
|
10225 |
untranslatedKey := anEvent view device keyboardMap keyAtValue:key ifAbsent:key. |
|
482 | 10226 |
untranslatedKey == #Insert ifTrue:[ |
10227 |
key := jKeyEventClass instVarNamed:'VK_INSERT' |
|
10228 |
]. |
|
255 | 10229 |
untranslatedKey == #Delete ifTrue:[ |
10230 |
key := jKeyEventClass instVarNamed:'VK_DELETE' "/ 127 |
|
10231 |
]. |
|
10232 |
untranslatedKey == #BackSpace ifTrue:[ |
|
10233 |
key := jKeyEventClass instVarNamed:'VK_BACK_SPACE' "/ 8 |
|
10234 |
]. |
|
10235 |
untranslatedKey == #Return ifTrue:[ |
|
10236 |
key := jKeyEventClass instVarNamed:'VK_ENTER' "/ 13 |
|
10237 |
]. |
|
10238 |
untranslatedKey == #Tab ifTrue:[ |
|
10239 |
key := jKeyEventClass instVarNamed:'VK_TAB' "/ 9 |
|
10240 |
]. |
|
10241 |
untranslatedKey == #Home ifTrue:[ |
|
10242 |
key := jKeyEventClass instVarNamed:'VK_HOME' |
|
10243 |
]. |
|
10244 |
untranslatedKey == #End ifTrue:[ |
|
10245 |
key := jKeyEventClass instVarNamed:'VK_END' |
|
10246 |
]. |
|
482 | 10247 |
(key == #PreviousPage or:[untranslatedKey == #Prior]) ifTrue:[ |
255 | 10248 |
key := jKeyEventClass instVarNamed:'VK_PAGE_UP' |
10249 |
]. |
|
482 | 10250 |
(key == #NextPage or:[key == #EndOfText]) ifTrue:[ |
255 | 10251 |
key := jKeyEventClass instVarNamed:'VK_PAGE_DOWN' |
10252 |
]. |
|
10253 |
untranslatedKey == #CursorUp ifTrue:[ |
|
10254 |
key := jKeyEventClass instVarNamed:'VK_UP' |
|
10255 |
]. |
|
10256 |
untranslatedKey == #CursorDown ifTrue:[ |
|
10257 |
key := jKeyEventClass instVarNamed:'VK_DOWN' |
|
10258 |
]. |
|
10259 |
untranslatedKey == #CursorLeft ifTrue:[ |
|
10260 |
key := jKeyEventClass instVarNamed:'VK_LEFT' |
|
10261 |
]. |
|
10262 |
untranslatedKey == #CursorRight ifTrue:[ |
|
10263 |
key := jKeyEventClass instVarNamed:'VK_RIGHT' |
|
10264 |
]. |
|
482 | 10265 |
(#( F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12) |
255 | 10266 |
includes:untranslatedKey) ifTrue:[ |
10267 |
key := jKeyEventClass instVarNamed:('VK_' , untranslatedKey) |
|
10268 |
]. |
|
10269 |
]. |
|
10270 |
(type == #'keyPress:x:y:') ifTrue:[ |
|
10271 |
id := jKeyEventClass instVarNamed:'KEY_PRESSED' |
|
10272 |
] ifFalse:[ |
|
10273 |
id := jKeyEventClass instVarNamed:'KEY_RELEASED' |
|
10274 |
]. |
|
261 | 10275 |
jEv := jKeyEventClass newCleared "basicNew". |
255 | 10276 |
jEv instVarNamed:'modifiers' put:modifiers. |
10277 |
jEv instVarNamed:'keyCode' put:key. |
|
10278 |
jEv instVarNamed:'keyChar' put:keyChar. |
|
10279 |
jEv instVarNamed:'id' put:id. |
|
10280 |
"/ jEv instVarNamed:'x' put:x. |
|
10281 |
"/ jEv instVarNamed:'y' put:y. |
|
10282 |
jEv instVarNamed:'when' put:(OperatingSystem getMillisecondTime). |
|
10283 |
^ Array with:jEv |
|
10284 |
]. |
|
10285 |
||
10286 |
(anEvent isButtonEvent |
|
10287 |
or:[anEvent isPointerEnterLeaveEvent]) ifTrue:[ |
|
10288 |
jMouseEventClass := Java classForName:'java.awt.event.MouseEvent'. |
|
10289 |
clickCount := 1. |
|
10290 |
||
10291 |
(type == #'buttonPress:x:y:') ifTrue:[ |
|
270 | 10292 |
id := jMouseEventClass instVarNamed:'MOUSE_PRESSED'. |
255 | 10293 |
] ifFalse:[ |
10294 |
(type == #'buttonRelease:x:y:') ifTrue:[ |
|
270 | 10295 |
id := jMouseEventClass instVarNamed:'MOUSE_RELEASED'. |
255 | 10296 |
] ifFalse:[ |
10297 |
(type == #'buttonMotion:x:y:') ifTrue:[ |
|
439 | 10298 |
anEvent state == 0 ifTrue:[ |
270 | 10299 |
id := jMouseEventClass instVarNamed:'MOUSE_MOVED'. |
10300 |
] ifFalse:[ |
|
10301 |
id := jMouseEventClass instVarNamed:'MOUSE_DRAGGED'. |
|
10302 |
]. |
|
255 | 10303 |
] ifFalse:[ |
10304 |
"/ (type == #'pointerMotion:x:y:') ifTrue:[ |
|
270 | 10305 |
"/ id := jMouseEventClass instVarNamed:'MOUSE_MOVED'. |
255 | 10306 |
"/ ] ifFalse:[ |
10307 |
(type == #'pointerEnter:x:y:') ifTrue:[ |
|
270 | 10308 |
id := jMouseEventClass instVarNamed:'MOUSE_ENTERED'. |
255 | 10309 |
] ifFalse:[ |
10310 |
(type == #'pointerLeave:') ifTrue:[ |
|
270 | 10311 |
id := jMouseEventClass instVarNamed:'MOUSE_EXITED'. |
255 | 10312 |
] ifFalse:[ |
10313 |
(type == #'buttonMultiPress:x:y:') ifTrue:[ |
|
10314 |
id := jMouseEventClass instVarNamed:'MOUSE_PRESSED'. |
|
10315 |
clickCount := 2. |
|
10316 |
] ifFalse:[ |
|
10317 |
self halt. |
|
10318 |
] |
|
10319 |
] |
|
10320 |
"/ ] |
|
10321 |
] |
|
10322 |
] |
|
10323 |
] |
|
10324 |
]. |
|
261 | 10325 |
jEv := jMouseEventClass newCleared "basicNew". |
255 | 10326 |
jEv instVarNamed:'modifiers' put:modifiers. |
10327 |
jEv instVarNamed:'id' put:id. |
|
10328 |
jEv instVarNamed:'x' put:x. |
|
10329 |
jEv instVarNamed:'y' put:y. |
|
10330 |
jEv instVarNamed:'when' put:(OperatingSystem getMillisecondTime). |
|
10331 |
^ Array with:jEv |
|
10332 |
]. |
|
10333 |
||
10334 |
||
10335 |
(type == #'configureX:y:width:height:') ifTrue:[ |
|
261 | 10336 |
"/ x := eventArgs at:1. |
10337 |
"/ y := eventArgs at:2. |
|
10338 |
||
10339 |
view := anEvent view. |
|
466 | 10340 |
x := eventArgs at:1. |
10341 |
y := eventArgs at:2. |
|
261 | 10342 |
w := eventArgs at:3. |
10343 |
h := eventArgs at:4. |
|
10344 |
||
466 | 10345 |
resized := moved := true. |
10346 |
(w == view width and:[h == view height]) ifTrue:[ |
|
10347 |
resized := false. |
|
10348 |
]. |
|
10349 |
(x == view left and:[y == view top]) ifTrue:[ |
|
10350 |
moved := false. |
|
10351 |
]. |
|
10352 |
||
261 | 10353 |
"/ |
10354 |
"/ must change the components extent |
|
10355 |
"/ is there no cleaner way to do this ? |
|
10356 |
"/ |
|
10357 |
view isTopView ifTrue:[ |
|
466 | 10358 |
|
261 | 10359 |
"/ |
10360 |
"/ sigh - don't include the menu. |
|
10361 |
"/ |
|
10362 |
menu := self topViewsMenu:view. |
|
10363 |
menu notNil ifTrue:[ |
|
10364 |
"/ must add the menus height |
|
10365 |
h := h - menu height |
|
10366 |
] |
|
10367 |
]. |
|
466 | 10368 |
|
261 | 10369 |
jWin instVarNamed:'width' put:w. |
10370 |
jWin instVarNamed:'height' put:h. |
|
10371 |
||
255 | 10372 |
jComponentEventClass := Java classForName:'java.awt.event.ComponentEvent'. |
466 | 10373 |
moved ifTrue:[ |
10374 |
id := (jComponentEventClass instVarNamed:'COMPONENT_MOVED'). |
|
10375 |
jEv1 := jComponentEventClass newCleared "basicNew". |
|
10376 |
jEv1 instVarNamed:'id' put:id. |
|
10377 |
]. |
|
10378 |
resized ifTrue:[ |
|
10379 |
id := (jComponentEventClass instVarNamed:'COMPONENT_RESIZED'). |
|
10380 |
jEv2 := jComponentEventClass newCleared "basicNew". |
|
10381 |
jEv2 instVarNamed:'id' put:id. |
|
10382 |
]. |
|
10383 |
jEv1 isNil ifTrue:[ |
|
10384 |
jEv2 isNil ifTrue:[^ nil]. |
|
10385 |
^ Array with:jEv2 |
|
10386 |
] ifFalse:[ |
|
10387 |
jEv2 isNil ifTrue:[ |
|
10388 |
^ Array with:jEv1 |
|
10389 |
] |
|
10390 |
]. |
|
255 | 10391 |
^ Array with:jEv1 with:jEv2. |
10392 |
]. |
|
10393 |
(type == #'focusIn') ifTrue:[ |
|
318 | 10394 |
"/ 'focusIn' printCR. |
255 | 10395 |
jComponentEventClass := Java classForName:'java.awt.event.FocusEvent'. |
10396 |
id := (jComponentEventClass instVarNamed:'FOCUS_GAINED'). |
|
261 | 10397 |
jEv := jComponentEventClass newCleared "basicNew". |
255 | 10398 |
jEv instVarNamed:'id' put:id. |
10399 |
^ Array with:jEv. |
|
10400 |
]. |
|
10401 |
(type == #'focusOut') ifTrue:[ |
|
318 | 10402 |
"/ 'focusOut' printCR. |
255 | 10403 |
jComponentEventClass := Java classForName:'java.awt.event.FocusEvent'. |
10404 |
id := (jComponentEventClass instVarNamed:'FOCUS_LOST'). |
|
261 | 10405 |
jEv := jComponentEventClass newCleared "basicNew". |
255 | 10406 |
jEv instVarNamed:'id' put:id. |
10407 |
^ Array with:jEv. |
|
10408 |
]. |
|
10409 |
(type == #'mapped') ifTrue:[ |
|
318 | 10410 |
"/ 'mapped' printCR. |
255 | 10411 |
jComponentEventClass := Java classForName:'java.awt.event.ComponentEvent'. |
10412 |
id := (jComponentEventClass instVarNamed:'COMPONENT_SHOWN'). |
|
10413 |
"/ x := eventArgs at:1. |
|
10414 |
"/ y := eventArgs at:2. |
|
261 | 10415 |
jEv := jComponentEventClass newCleared "basicNew". |
255 | 10416 |
jEv instVarNamed:'id' put:id. |
10417 |
^ Array with:jEv. |
|
10418 |
]. |
|
10419 |
(type == #'unmapped') ifTrue:[ |
|
318 | 10420 |
"/ 'unmapped' printCR. |
255 | 10421 |
jComponentEventClass := Java classForName:'java.awt.event.ComponentEvent'. |
10422 |
id := (jComponentEventClass instVarNamed:'COMPONENT_HIDDEN'). |
|
10423 |
"/ x := eventArgs at:1. |
|
10424 |
"/ y := eventArgs at:2. |
|
261 | 10425 |
jEv := jComponentEventClass newCleared "basicNew". |
255 | 10426 |
jEv instVarNamed:'id' put:id. |
10427 |
^ Array with:jEv. |
|
10428 |
]. |
|
10429 |
||
10430 |
(type == #terminate) ifTrue:[ |
|
10431 |
jWindowEventClass := Java classForName:'java.awt.event.WindowEvent'. |
|
474 | 10432 |
id := (jWindowEventClass instVarNamed:'WINDOW_CLOSING'). |
10433 |
"/OLD id := (jWindowEventClass instVarNamed:'WINDOW_CLOSED'). |
|
261 | 10434 |
jEv := jWindowEventClass newCleared "basicNew". |
255 | 10435 |
jEv instVarNamed:'id' put:id. |
10436 |
^ Array with:jEv. |
|
10437 |
]. |
|
439 | 10438 |
|
319 | 10439 |
EventTrace == true ifTrue:[ |
10440 |
('JAVA: unhandled event:' , type) infoPrintCR. |
|
10441 |
]. |
|
255 | 10442 |
^ nil. |
10443 |
||
10444 |
"Created: / 6.1.1998 / 20:38:58 / cg" |
|
482 | 10445 |
"Modified: / 4.12.1998 / 15:27:47 / cg" |
255 | 10446 |
! |
10447 |
||
10448 |
doWindowsEventThread |
|
10449 |
"invoked in an endless loop by the WToolkit-eventLoop |
|
10450 |
native method." |
|
10451 |
||
270 | 10452 |
|sensor event more| |
255 | 10453 |
|
10454 |
JavaWindowGroup isNil ifTrue:[ |
|
270 | 10455 |
"/ '*** eventThread: no windowGroup ...' printCR. |
284 | 10456 |
FirstWindowCreationSemaphore wait. |
10457 |
"/ Delay waitForSeconds:0.1. |
|
270 | 10458 |
^ self |
255 | 10459 |
]. |
10460 |
||
10461 |
KnownWindows isNil ifTrue:[ |
|
270 | 10462 |
"/ '*** eventThread: no views ...' printCR. |
284 | 10463 |
FirstWindowCreationSemaphore wait. |
10464 |
"/ Delay waitForSeconds:0.1. |
|
270 | 10465 |
^ self |
255 | 10466 |
]. |
10467 |
||
10468 |
"/ wait for an event to arrive ... |
|
10469 |
||
10470 |
sensor := JavaWindowGroup sensor. |
|
329 | 10471 |
[sensor hasEvents or:[sensor damageCount ~~ 0]] whileFalse:[ |
270 | 10472 |
EventTrace ifTrue:[ |
10473 |
'*** eventThread waiting ...' printCR. |
|
10474 |
]. |
|
10475 |
Processor activeProcess state:#eventWait. |
|
10476 |
sensor eventSemaphore wait. |
|
255 | 10477 |
]. |
10478 |
||
10479 |
EventTrace ifTrue:[ |
|
270 | 10480 |
'*** eventThread event arrived ...' printCR. |
255 | 10481 |
]. |
10482 |
||
10483 |
"/ EventTrace := true |
|
270 | 10484 |
more := true. |
10485 |
[more] whileTrue:[ |
|
10486 |
sensor hasDamage ifTrue:[ |
|
10487 |
EventTrace ifTrue:[ |
|
10488 |
'*** eventThread: damage arrived ...' printCR. |
|
10489 |
]. |
|
10490 |
event := sensor nextDamage. |
|
10491 |
] ifFalse:[ |
|
10492 |
event := sensor nextEvent. |
|
10493 |
]. |
|
10494 |
event isNil ifTrue:[ |
|
319 | 10495 |
EventTrace == true ifTrue:[ |
10496 |
'*** eventThread: nil event ignored' printCR. |
|
10497 |
]. |
|
270 | 10498 |
^ self |
10499 |
]. |
|
10500 |
||
10501 |
more := self processEvent:event |
|
10502 |
] |
|
255 | 10503 |
|
10504 |
"Created: / 6.1.1998 / 21:02:40 / cg" |
|
329 | 10505 |
"Modified: / 5.4.1998 / 16:10:53 / cg" |
255 | 10506 |
! |
10507 |
||
10508 |
processEvent:event |
|
439 | 10509 |
|evQ jEvents jWToolKitClass jWToolKit jWinPeer jWin v eventConsumed| |
255 | 10510 |
|
10511 |
KnownWindows isNil ifTrue:[ |
|
270 | 10512 |
^ false |
255 | 10513 |
]. |
10514 |
||
10515 |
v := event view. |
|
261 | 10516 |
jWinPeer := self jPeerForView:v. |
255 | 10517 |
jWinPeer isNil ifTrue:[ |
482 | 10518 |
v isJavaView ifTrue:[ |
261 | 10519 |
"/ mhmh - an event for a JavaView, |
10520 |
"/ which has no peer (anyMore ?) |
|
10521 |
"/ should not happen. |
|
10522 |
] ifFalse:[ |
|
10523 |
"/ mhmh - an event for a subcomponent of an ST widget. |
|
10524 |
"/ let it be handled normally. |
|
255 | 10525 |
EventTrace ifTrue:[ |
261 | 10526 |
('*** eventThread: ' , event type , '-event for unknown java-view - passed to view.') printCR. |
255 | 10527 |
]. |
359 | 10528 |
event view dispatchEvent:event. |
255 | 10529 |
]. |
270 | 10530 |
^ true |
261 | 10531 |
]. |
10532 |
||
10533 |
"/ change: |
|
10534 |
"/ in the previous version, events for ST/X widgets (i.e. buttons etc) |
|
10535 |
"/ where not passed to java, but instead forwarded directly to the widget |
|
10536 |
"/ by the code below. |
|
10537 |
"/ This has changed, to pass it to Java, which eventually passes it to the |
|
10538 |
"/ peer via the handleEvent native method (unless the event got consumed). |
|
10539 |
"/ This is req'd to let java keep track of keyboard/mouse input for widgets. |
|
10540 |
||
10541 |
false ifTrue:[ |
|
10542 |
"/ "/ most views handle their events themself (being ST/X views) ... |
|
10543 |
"/ |
|
10544 |
"/ v class ~~ JavaView ifTrue:[ |
|
10545 |
"/"/ v class ~~ StandardSystemView ifTrue:[ |
|
10546 |
"/"/ EventTrace ifTrue:[ |
|
10547 |
"/"/ ('*** eventThread: event handled by view itself (' , v class name , ')') printCR. |
|
10548 |
"/"/ ]. |
|
10549 |
"/"/ event sendEventWithFocusOn:nil. |
|
10550 |
"/"/ ^ self. |
|
10551 |
"/"/ ]. |
|
10552 |
"/ (event type == #'exposeX:y:width:height' |
|
10553 |
"/ or:[event type == #'graphicsExposeX:y:width:height']) ifTrue:[ |
|
10554 |
"/ "/ send to view, but also handle in JAVA |
|
10555 |
"/ event sendEventWithFocusOn:nil. |
|
10556 |
"/ ] |
|
10557 |
"/ ]. |
|
10558 |
||
10559 |
(#( |
|
10560 |
#'mapped' |
|
10561 |
#'unmapped' |
|
10562 |
#'configureX:y:width:height:' |
|
10563 |
#'exposeX:y:width:height:' |
|
10564 |
#'graphicsExposeX:y:width:height:' |
|
10565 |
) includes:event type) ifTrue:[ |
|
255 | 10566 |
event sendEventWithFocusOn:nil. |
10567 |
]. |
|
261 | 10568 |
]. |
10569 |
||
10570 |
"/ what a kludge - some events are passed back to |
|
10571 |
"/ ST via the WComponent-handleEvent native method. |
|
10572 |
"/ However, repaints are not. |
|
10573 |
"/ In order to let ST widgets do the drawing, |
|
10574 |
"/ selectively filter exposeEvents from Java ... |
|
10575 |
||
10576 |
eventConsumed := false. |
|
482 | 10577 |
v isJavaView ifTrue:[ |
261 | 10578 |
"/ all events handled by Java ... |
10579 |
] ifFalse:[ |
|
10580 |
eventConsumed := true. |
|
10581 |
||
10582 |
"/ let widget handle it. |
|
359 | 10583 |
event view dispatchEvent:event. |
261 | 10584 |
|
10585 |
"/ some are not passed to Java ... |
|
10586 |
event isDamage ifTrue:[ |
|
480 | 10587 |
(v isKindOf:Button) ifTrue:[ |
10588 |
^ true |
|
10589 |
]. |
|
261 | 10590 |
(v isKindOf:TextView) ifTrue:[ |
270 | 10591 |
^ true |
10592 |
]. |
|
10593 |
(v isKindOf:Label) ifTrue:[ |
|
10594 |
^ true |
|
10595 |
]. |
|
10596 |
(v isKindOf:ComboBoxView) ifTrue:[ |
|
10597 |
^ true |
|
10598 |
]. |
|
10599 |
(v isKindOf:ScrollBar) ifTrue:[ |
|
482 | 10600 |
^ true |
261 | 10601 |
]. |
270 | 10602 |
(v isKindOf:Scroller) ifTrue:[ |
482 | 10603 |
^ true |
261 | 10604 |
]. |
270 | 10605 |
(v isKindOf:MenuPanel) ifTrue:[ |
10606 |
^ true |
|
10607 |
]. |
|
261 | 10608 |
]. |
10609 |
]. |
|
255 | 10610 |
|
10611 |
jWin := jWinPeer instVarNamed:'target'. |
|
10612 |
||
10613 |
EventTrace ifTrue:[ |
|
10614 |
('*** eventThread: event (' , event type , ') handled by JAVA: ') infoPrint. |
|
10615 |
jWinPeer class name infoPrint. ' (' infoPrint. |
|
10616 |
jWin class name infoPrint. ')' infoPrintCR. |
|
10617 |
]. |
|
10618 |
||
10619 |
"/ create an event |
|
10620 |
||
10621 |
jEvents := self awtEventsForEvent:event javaWindow:jWin. |
|
10622 |
jEvents isNil ifTrue:[ |
|
10623 |
EventTrace ifTrue:[ |
|
10624 |
('*** eventThread: event ignored: ' , event type) printCR. |
|
10625 |
]. |
|
270 | 10626 |
^ true |
255 | 10627 |
]. |
10628 |
||
10629 |
"/ v superView isNil ifTrue:[ |
|
10630 |
"/ ('*** eventThread: event ignored for topView: ' , event type) printCR. |
|
10631 |
"/ ^ self |
|
10632 |
"/ ]. |
|
10633 |
||
439 | 10634 |
jWToolKitClass := Java classForName:'java.awt.Toolkit'. |
10635 |
"/ jWToolKit := jWToolKitClass perform:#getDefaultToolkit. |
|
10636 |
jWToolKit := jWToolKitClass performStatic:#'getDefaultToolkit()Ljava/awt/Toolkit;'. |
|
255 | 10637 |
|
10638 |
jEvents do:[:jEv | |
|
10639 |
jEv instVarNamed:'source' put:jWin. |
|
10640 |
jEv instVarNamed:'consumed' put:0. |
|
261 | 10641 |
eventConsumed ifFalse:[ |
10642 |
"/ the first gets the original event as data |
|
10643 |
jEv instVarNamed:'data' put:event. |
|
10644 |
eventConsumed := true |
|
10645 |
]. |
|
255 | 10646 |
|
10647 |
"/ post it (them) to the event queue |
|
318 | 10648 |
EventTrace == true ifTrue:[ |
10649 |
'postEvent to Java ...' printCR. |
|
10650 |
]. |
|
439 | 10651 |
jWToolKit "class" perform:#'postEvent(Ljava/awt/AWTEvent;)V' with:jEv. |
255 | 10652 |
]. |
10653 |
||
270 | 10654 |
^ false |
10655 |
||
255 | 10656 |
"Created: / 6.1.1998 / 20:36:36 / cg" |
482 | 10657 |
"Modified: / 4.12.1998 / 15:25:09 / cg" |
255 | 10658 |
! ! |
10659 |
||
253 | 10660 |
!JavaVM class methodsFor:'documentation'! |
10661 |
||
10662 |
version |
|
483 | 10663 |
^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaVM.st,v 1.91 1998/12/04 18:48:13 cg Exp $' |
253 | 10664 |
! ! |
10665 |
JavaVM initialize! |