JavaVM.st
author cg
Mon, 05 Oct 1998 14:31:54 +0000
changeset 373 fceafec7ae61
parent 368 e8c16a76826f
child 374 946599670402
permissions -rw-r--r--
checkin from browser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
     1
Object subclass:#JavaVM
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
     2
	instanceVariableNames:''
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
     3
	classVariableNames:'UnhandledJavaExceptionSignal JavaExceptionSignal
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
     4
		UnimplementedInstructionSignal UnimplementedNativeMethodSignal
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
     5
		BadMessageSignal InternalErrorSignal CallHandlerSignal
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
     6
		FullExceptionTrace StackTrace TraceHistory LockTable
277
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
     7
		LockTableAccess LibPath SimulatedLibs LoadedLibs
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
     8
		SimulatedNativeLibs LoadedNativeLibs WaitTable WaitTableAccess
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
     9
		JavaWindowGroup KnownWindows DrawOPTrace WindowOPTrace
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
    10
		WindowCreationTrace EventTrace ThreadTrace MonitorTrace
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
    11
		ExceptionTrace InsnCount InsnCounts FileOpenTrace
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
    12
		FileOpenConfirmation FileIOTrace OpenFileTable
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
    13
		CachedNativeMethodTable ExceptionDebug JavaConsoleStream
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
    14
		StandardThreadGroup EnteredMonitorsPerProcess JavaClasses
321
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
    15
		JavaMethods DUMMY_LONG_HIGHWORD DUMMY_DOUBLE_HIGHWORD NoAudio
297
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
    16
		FirstWindowCreationSemaphore ScreenUpdaterProcess'
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
    17
	poolDictionaries:''
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
    18
	category:'Java-Support'
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
    19
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
    20
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    21
!JavaVM class methodsFor:'documentation'!
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    22
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    23
nativeMethods
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    24
"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    25
    list of all native methods as in jdk1.1.3:
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    26
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    27
      X - implemented
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    28
      x - implemented with limited functionality
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    29
      o - implemented as dummy (no functionality)
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    30
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    31
    X (Math::double sin (double))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    32
    X (Math::double cos (double))
342
18284bd570b5 more math natives
cg
parents: 341
diff changeset
    33
    X (Math::double tan (double))
18284bd570b5 more math natives
cg
parents: 341
diff changeset
    34
    X (Math::double asin (double))
18284bd570b5 more math natives
cg
parents: 341
diff changeset
    35
    X (Math::double acos (double))
18284bd570b5 more math natives
cg
parents: 341
diff changeset
    36
    X (Math::double atan (double))
18284bd570b5 more math natives
cg
parents: 341
diff changeset
    37
    X (Math::double exp (double))
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    38
    X (Math::double log (double))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    39
    X (Math::double sqrt (double))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    40
      (Math::double IEEEremainder (double double))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    41
    X (Math::double ceil (double))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    42
    X (Math::double floor (double))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    43
      (Math::double rint (double))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    44
      (Math::double atan2 (double double))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    45
    X (Math::double pow (double double))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    46
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    47
    X (Class::java.lang.Class forName (java.lang.String))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    48
    X (Class::java.lang.Object newInstance ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    49
      (Class::boolean isInstance (java.lang.Object))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    50
      (Class::boolean isAssignableFrom (java.lang.Class))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    51
    X (Class::boolean isInterface ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    52
      (Class::boolean isArray ())
342
18284bd570b5 more math natives
cg
parents: 341
diff changeset
    53
    X (Class::boolean isPrimitive ())
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    54
    X (Class::java.lang.String getName ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    55
    X (Class::java.lang.ClassLoader getClassLoader ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    56
    X (Class::java.lang.Class getSuperclass ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    57
      (Class::java.lang.Class[] getInterfaces ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    58
      (Class::java.lang.Class getComponentType ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    59
      (Class::int getModifiers ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    60
      (Class::java.lang.Object[] getSigners ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    61
      (Class::void setSigners (java.lang.Object[]))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    62
    X (Class::java.lang.Class getPrimitiveClass (java.lang.String))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    63
      (Class::java.lang.reflect.Field[] getFields0 (int))
342
18284bd570b5 more math natives
cg
parents: 341
diff changeset
    64
    X (Class::java.lang.reflect.Method[] getMethods0 (int))
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    65
      (Class::java.lang.reflect.Constructor[] getConstructors0 (int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    66
      (Class::java.lang.reflect.Field getField0 (java.lang.String int))
342
18284bd570b5 more math natives
cg
parents: 341
diff changeset
    67
    X (Class::java.lang.reflect.Method getMethod0 (java.lang.String java.lang.Class[] int))
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    68
      (Class::java.lang.reflect.Constructor getConstructor0 (java.lang.Class[] int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    69
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    70
    X (InetAddressImpl::java.lang.String getLocalHostName ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    71
    X (InetAddressImpl::void makeAnyLocalAddress (java.net.InetAddress))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    72
    X (InetAddressImpl::byte[][] lookupAllHostAddr (java.lang.String))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    73
      (InetAddressImpl::java.lang.String getHostByAddr (int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    74
    X (InetAddressImpl::int getInetFamily ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    75
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    76
    X (ResourceBundle::java.lang.Class[] getClassContext ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    77
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    78
    X (System::void setIn0 (java.io.InputStream))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    79
    X (System::void setOut0 (java.io.PrintStream))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    80
    X (System::void setErr0 (java.io.PrintStream))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    81
    X (System::long currentTimeMillis ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    82
    X (System::void arraycopy (java.lang.Object int java.lang.Object int int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    83
      (System::int identityHashCode (java.lang.Object))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    84
    X (System::java.util.Properties initProperties (java.util.Properties))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    85
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    86
    X (Thread::java.lang.Thread currentThread ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    87
    X (Thread::void yield ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    88
    X (Thread::void sleep (long))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    89
    X (Thread::void start ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    90
    X (Thread::boolean isInterrupted (boolean))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    91
    X (Thread::boolean isAlive ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    92
      (Thread::int countStackFrames ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    93
    X (Thread::void setPriority0 (int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    94
    X (Thread::void stop0 (java.lang.Object))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    95
    X (Thread::void suspend0 ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    96
    X (Thread::void resume0 ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    97
      (Thread::void interrupt0 ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
    98
342
18284bd570b5 more math natives
cg
parents: 341
diff changeset
    99
      (String::java.lang.String intern ())
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   100
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   101
    X (Float::int floatToIntBits (float))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   102
    X (Float::float intBitsToFloat (int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   103
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   104
      (ObjectStreamClass::int getClassAccess (java.lang.Class))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   105
      (ObjectStreamClass::java.lang.String[] getMethodSignatures (java.lang.Class))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   106
      (ObjectStreamClass::int getMethodAccess (java.lang.Class java.lang.String))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   107
      (ObjectStreamClass::java.lang.String[] getFieldSignatures (java.lang.Class))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   108
      (ObjectStreamClass::int getFieldAccess (java.lang.Class java.lang.String))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   109
      (ObjectStreamClass::java.io.ObjectStreamField[] getFields0 (java.lang.Class))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   110
      (ObjectStreamClass::long getSerialVersionUID (java.lang.Class))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   111
      (ObjectStreamClass::boolean hasWriteObject (java.lang.Class))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   112
      (ObjectInputStream::java.lang.Class loadClass0 (java.lang.Class java.lang.String))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   113
      (ObjectInputStream::void inputClassFields (java.lang.Object java.lang.Class int[]))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   114
      (ObjectInputStream::java.lang.Object allocateNewObject (java.lang.Class java.lang.Class))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   115
      (ObjectInputStream::java.lang.Object allocateNewArray (java.lang.Class int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   116
      (ObjectInputStream::boolean invokeObjectReader (java.lang.Object java.lang.Class))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   117
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   118
      (SecurityManager::java.lang.Class[] getClassContext ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   119
    X (SecurityManager::java.lang.ClassLoader currentClassLoader ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   120
      (SecurityManager::int classDepth (java.lang.String))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   121
    X (SecurityManager::int classLoaderDepth ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   122
      (SecurityManager::java.lang.Class currentLoadedClass0 ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   123
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   124
    X (ClassLoader::void init ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   125
    X (ClassLoader::java.lang.Class defineClass0 (java.lang.String byte[] int int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   126
    X (ClassLoader::void resolveClass0 (java.lang.Class))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   127
    X (ClassLoader::java.lang.Class findSystemClass0 (java.lang.String))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   128
    X (ClassLoader::java.io.InputStream getSystemResourceAsStream0 (java.lang.String))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   129
      (ClassLoader::java.lang.String getSystemResourceAsName0 (java.lang.String))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   130
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   131
      (FileDescriptor::boolean valid ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   132
      (FileDescriptor::void sync ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   133
    X (FileDescriptor::java.io.FileDescriptor initSystemFD (java.io.FileDescriptor int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   134
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   135
    X (Object::java.lang.Class getClass ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   136
    X (Object::int hashCode ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   137
    X (Object::java.lang.Object clone ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   138
    X (Object::void notify ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   139
    X (Object::void notifyAll ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   140
    X (Object::void wait (long))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   141
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   142
    X (FileOutputStream::void open (java.lang.String))
342
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   143
    X (FileOutputStream::void openAppend (java.lang.String))
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   144
    X (FileOutputStream::void write (int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   145
    X (FileOutputStream::void writeBytes (byte[] int int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   146
    X (FileOutputStream::void close ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   147
    X (FileInputStream::void open (java.lang.String))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   148
    X (FileInputStream::int read ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   149
    X (FileInputStream::int readBytes (byte[] int int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   150
      (FileInputStream::long skip (long))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   151
    X (FileInputStream::int available ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   152
    X (FileInputStream::void close ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   153
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   154
      (VM::int getState ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   155
      (VM::boolean threadsSuspended ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   156
      (VM::void unsuspendThreads ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   157
      (VM::void unsuspendSomeThreads ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   158
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   159
    X (File::boolean exists0 ())
342
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   160
    X (File::boolean canWrite0 ())
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   161
    X (File::boolean canRead0 ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   162
    X (File::boolean isFile0 ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   163
    X (File::boolean isDirectory0 ())
342
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   164
    X (File::long lastModified0 ())
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   165
    X (File::long length0 ())
342
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   166
    X (File::boolean mkdir0 ())
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   167
      (File::boolean renameTo0 (java.io.File))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   168
      (File::boolean delete0 ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   169
      (File::boolean rmdir0 ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   170
    X (File::java.lang.String[] list0 ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   171
      (File::java.lang.String canonPath (java.lang.String))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   172
    X (File::boolean isAbsolute ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   173
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   174
      (ObjectOutputStream::void outputClassFields (java.lang.Object java.lang.Class int[]))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   175
      (ObjectOutputStream::boolean invokeObjectWriter (java.lang.Object java.lang.Class))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   176
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   177
    X (Throwable::void printStackTrace0 (java.lang.Object))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   178
    X (Throwable::java.lang.Throwable fillInStackTrace ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   179
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   180
    X (Double::long doubleToLongBits (double))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   181
    X (Double::double longBitsToDouble (long))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   182
    X (Double::double valueOf0 (java.lang.String))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   183
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   184
    X (Runtime::void exitInternal (int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   185
      (Runtime::void runFinalizersOnExit0 (boolean))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   186
    o (Runtime::java.lang.Process execInternal (java.lang.String[] java.lang.String[]))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   187
    X (Runtime::long freeMemory ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   188
    X (Runtime::long totalMemory ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   189
    X (Runtime::void gc ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   190
      (Runtime::void runFinalization ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   191
      (Runtime::void traceInstructions (boolean))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   192
      (Runtime::void traceMethodCalls (boolean))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   193
    X (Runtime::java.lang.String initializeLinkerInternal ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   194
    X (Runtime::java.lang.String buildLibName (java.lang.String java.lang.String))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   195
    X (Runtime::int loadFileInternal (java.lang.String))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   196
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   197
      (WDrawingSurfaceInfo::int lock ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   198
      (WDrawingSurfaceInfo::void unlock ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   199
      (WDrawingSurfaceInfo::int getHWnd ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   200
      (WDrawingSurfaceInfo::int getHBitmap ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   201
      (WDrawingSurfaceInfo::int getPBits ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   202
      (WDrawingSurfaceInfo::int getHDC ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   203
      (WDrawingSurfaceInfo::int getDepth ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   204
      (WDrawingSurfaceInfo::int getHPalette ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   205
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   206
    X (WDefaultFontCharset::boolean canConvert (char))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   207
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   208
      (ColorModel::void deletepData ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   209
    X (WToolkit::void init (java.lang.Thread))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   210
    X (WToolkit::void eventLoop ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   211
      (WToolkit::java.awt.image.ColorModel makeColorModel ())
342
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   212
    X (WToolkit::int getScreenResolution ())
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   213
    X (WToolkit::int getScreenWidth ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   214
    X (WToolkit::int getScreenHeight ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   215
      (WToolkit::void sync ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   216
      (WToolkit::void beep ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   217
    X (WToolkit::void loadSystemColors (int[]))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   218
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   219
      (WPrintJob::void end ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   220
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   221
    X (WDialogPeer::void create (sun.awt.windows.WComponentPeer))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   222
    X (WDialogPeer::void _show ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   223
    X (WDialogPeer::void _hide ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   224
342
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   225
    X (WWindowPeer::void toFront ())
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   226
    X (WWindowPeer::void toBack ())
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   227
    X (WWindowPeer::void _setTitle (java.lang.String))
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   228
    X (WWindowPeer::void _setResizable (boolean))
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   229
      (WWindowPeer::void create (sun.awt.windows.WComponentPeer))
342
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   230
    o (WWindowPeer::void updateInsets (java.awt.Insets))
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   231
      (WWindowPeer::java.awt.Component getContainerElement (java.awt.Container int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   232
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   233
    X (WCanvasPeer::void create (sun.awt.windows.WComponentPeer))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   234
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   235
    X (WTextAreaPeer::void create (sun.awt.windows.WComponentPeer))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   236
    X (WTextAreaPeer::void insertText (java.lang.String int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   237
      (WTextAreaPeer::void replaceText (java.lang.String int int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   238
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   239
    X (WTextComponentPeer::java.lang.String getText ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   240
    X (WTextComponentPeer::void setText (java.lang.String))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   241
    X (WTextComponentPeer::int getSelectionStart ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   242
    X (WTextComponentPeer::int getSelectionEnd ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   243
    X (WTextComponentPeer::void select (int int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   244
    X (WTextComponentPeer::void enableEditing (boolean))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   245
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   246
    X (WComponentPeer::void show ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   247
    X (WComponentPeer::void hide ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   248
    X (WComponentPeer::void enable ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   249
    X (WComponentPeer::void disable ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   250
      (WComponentPeer::java.awt.Point getLocationOnScreen ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   251
    X (WComponentPeer::void reshape (int int int int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   252
    o (WComponentPeer::void handleEvent (java.awt.AWTEvent))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   253
    o (WComponentPeer::void _dispose ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   254
    X (WComponentPeer::void _setForeground (int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   255
    X (WComponentPeer::void _setBackground (int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   256
    o (WComponentPeer::void setFont (java.awt.Font))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   257
    o (WComponentPeer::void requestFocus ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   258
    o (WComponentPeer::void setCursor (java.awt.Cursor))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   259
    o (WComponentPeer::void start ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   260
      (WComponentPeer::void _beginValidate ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   261
      (WComponentPeer::void endValidate ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   262
    o (WComponentPeer::void setZOrderPosition (sun.awt.windows.WComponentPeer))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   263
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   264
    X (WFramePeer::void setMenuBar0 (sun.awt.windows.WMenuBarPeer))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   265
    X (WFramePeer::void create (sun.awt.windows.WComponentPeer))
342
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   266
    X (WFramePeer::void _setIconImage (sun.awt.image.ImageRepresentation))
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   267
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   268
    o (WFontMetrics::boolean needsConversion (java.awt.Font sun.awt.FontDescriptor))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   269
    o (WFontMetrics::int getMFCharSegmentWidth (java.awt.Font sun.awt.FontDescriptor boolean char[] int int byte[] int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   270
      (WFontMetrics::int bytesWidth (byte[] int int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   271
      (WFontMetrics::void init ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   272
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   273
    o (WChoicePeer::void select (int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   274
    o (WChoicePeer::void remove (int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   275
    o (WChoicePeer::void addItem (java.lang.String int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   276
    X (WChoicePeer::void reshape (int int int int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   277
    X (WChoicePeer::void create (sun.awt.windows.WComponentPeer))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   278
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   279
    X (WLabelPeer::void setText (java.lang.String))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   280
    o (WLabelPeer::void setAlignment (int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   281
    X (WLabelPeer::void create (sun.awt.windows.WComponentPeer))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   282
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   283
    X (WMenuItemPeer::void _setLabel (java.lang.String))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   284
    X (WMenuItemPeer::void create (sun.awt.windows.WMenuPeer))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   285
    X (WMenuItemPeer::void enable (boolean))
342
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   286
    o (WMenuItemPeer::void _dispose ())
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   287
      (WMenuPeer::void addSeparator ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   288
      (WMenuPeer::void delItem (int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   289
    X (WMenuPeer::void createMenu (sun.awt.windows.WMenuBarPeer))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   290
      (WMenuPeer::void createSubMenu (sun.awt.windows.WMenuPeer))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   291
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   292
      (WPopupMenuPeer::void createMenu (sun.awt.windows.WComponentPeer))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   293
      (WPopupMenuPeer::void _show (java.awt.Event))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   294
      (WMenuBarPeer::void addMenu (java.awt.Menu))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   295
      (WMenuBarPeer::void delMenu (int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   296
    X (WMenuBarPeer::void create (sun.awt.windows.WFramePeer))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   297
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   298
      (WCheckboxMenuItemPeer::void setState (boolean))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   299
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   300
    X (WFileDialogPeer::void show ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   301
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   302
    X (WCheckboxPeer::void setState (boolean))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   303
    X (WCheckboxPeer::void setCheckboxGroup (java.awt.CheckboxGroup))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   304
      (WCheckboxPeer::void setLabel (java.lang.String))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   305
    X (WCheckboxPeer::void create (sun.awt.windows.WComponentPeer))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   306
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   307
    X (WClipboard::void init ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   308
      (WClipboard::void setClipboardText (java.awt.datatransfer.StringSelection))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   309
      (WClipboard::java.lang.String getClipboardText ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   310
342
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   311
    X (WListPeer::void addItem (java.lang.String int))
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   312
    X (WListPeer::void delItems (int int))
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   313
    X (WListPeer::void select (int))
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   314
      (WListPeer::void deselect (int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   315
      (WListPeer::void makeVisible (int))
342
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   316
    X (WListPeer::void setMultipleSelections (boolean))
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   317
    X (WListPeer::void create (sun.awt.windows.WComponentPeer))
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   318
    X (WListPeer::boolean isSelected (int))
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   319
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   320
    x (WScrollbarPeer::void _setValues (int int int int))
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   321
    x (WScrollbarPeer::void setLineIncrement (int))
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   322
    x (WScrollbarPeer::void setPageIncrement (int))
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   323
    x (WScrollbarPeer::void create (sun.awt.windows.WComponentPeer))
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   324
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   325
    x (ImageRepresentation::void offscreenInit (java.awt.Color))
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   326
    x (ImageRepresentation::boolean setBytePixels (int int int int java.awt.image.ColorModel byte[] int int))
342
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   327
    x (ImageRepresentation::boolean setIntPixels (int int int int java.awt.image.ColorModel int[] int int))
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   328
    x (ImageRepresentation::boolean finish (boolean))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   329
    X (ImageRepresentation::void imageDraw (java.awt.Graphics int int java.awt.Color))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   330
    x (ImageRepresentation::void imageStretch (java.awt.Graphics int int int int int int int int java.awt.Color))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   331
    x (ImageRepresentation::void disposeImage ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   332
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   333
    X (WTextFieldPeer::void create (sun.awt.windows.WComponentPeer))
342
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   334
    X (WTextFieldPeer::void setEchoCharacter (char))
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   335
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   336
    X (WScrollPanePeer::void create (sun.awt.windows.WComponentPeer))
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   337
    o (WScrollPanePeer::int getOffset (int))
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   338
      (WScrollPanePeer::void setInsets ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   339
      (WScrollPanePeer::void setScrollPosition (int int))
342
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   340
    x (WScrollPanePeer::int _getHScrollbarHeight ())
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   341
    x (WScrollPanePeer::int _getVScrollbarWidth ())
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   342
    o (WScrollPanePeer::void setSpans (int int int int))
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   343
      (WScrollPanePeer::java.awt.Component getScrollChild ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   344
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   345
      (WEmbeddedFramePeer::void create (sun.awt.windows.WComponentPeer))
342
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   346
    X (WButtonPeer::void setLabel (java.lang.String))
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   347
    X (WButtonPeer::void create (sun.awt.windows.WComponentPeer))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   348
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   349
    x (WColor::java.awt.Color getDefaultColor (int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   350
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   351
    x (GifImageDecoder::boolean parseImage (int int int int boolean int byte[] byte[] java.awt.image.IndexColorModel))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   352
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   353
    x (WGraphics::void createFromComponent (sun.awt.windows.WComponentPeer))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   354
    x (WGraphics::void createFromGraphics (sun.awt.windows.WGraphics))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   355
      (WGraphics::void createFromPrintJob (sun.awt.windows.WPrintJob))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   356
      (WGraphics::void createFromHDC (int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   357
    x (WGraphics::void imageCreate (sun.awt.image.ImageRepresentation))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   358
    x (WGraphics::void pSetFont (java.awt.Font))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   359
    X (WGraphics::void pSetForeground (int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   360
      (WGraphics::void _dispose ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   361
    x (WGraphics::void dispose ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   362
    x (WGraphics::void setPaintMode ())
342
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   363
    x (WGraphics::void setXORMode (java.awt.Color))
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   364
    o (WGraphics::java.awt.Rectangle getClipBounds ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   365
    o (WGraphics::void changeClip (int int int int boolean))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   366
      (WGraphics::void removeClip ())
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   367
    X (WGraphics::void clearRect (int int int int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   368
    X (WGraphics::void fillRect (int int int int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   369
    X (WGraphics::void drawRect (int int int int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   370
      (WGraphics::void drawSFChars (char[] int int int int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   371
    x (WGraphics::int drawMFCharsSegment (java.awt.Font sun.awt.FontDescriptor char[] int int int int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   372
      (WGraphics::int drawMFCharsConvertedSegment (java.awt.Font sun.awt.FontDescriptor byte[] int int int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   373
      (WGraphics::void drawBytes (byte[] int int int int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   374
    X (WGraphics::void drawLine (int int int int))
342
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   375
    X (WGraphics::void copyArea (int int int int int int))
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   376
    o (WGraphics::void drawRoundRect (int int int int int int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   377
    o (WGraphics::void fillRoundRect (int int int int int int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   378
    X (WGraphics::void drawPolygon (int[] int[] int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   379
      (WGraphics::void drawPolyline (int[] int[] int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   380
    X (WGraphics::void fillPolygon (int[] int[] int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   381
    x (WGraphics::void drawOval (int int int int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   382
    x (WGraphics::void fillOval (int int int int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   383
    x (WGraphics::void drawArc (int int int int int int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   384
    x (WGraphics::void fillArc (int int int int int int))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   385
      (WGraphics::void print (sun.awt.windows.WComponentPeer))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   386
      (WGraphics::void close (sun.awt.windows.WPrintJob))
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   387
      (JPEGImageDecoder::void readImage (java.io.InputStream byte[]))
342
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   388
    o (OffScreenImageSource::void sendPixels ())
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   389
"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   390
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   391
! !
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   392
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   393
!JavaVM class methodsFor:'initialization'!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   394
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   395
deinitialize
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   396
    |table|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   397
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   398
    StandardThreadGroup := nil.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   399
    self releaseAllMonitors.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   400
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   401
    LockTable := nil.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   402
    WaitTable := nil.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   403
    WaitTableAccess := nil.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   404
    JavaWindowGroup := nil.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   405
    KnownWindows := nil.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   406
    OpenFileTable := nil.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   407
    EnteredMonitorsPerProcess := nil.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   408
    JavaClasses := nil.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   409
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   410
    "
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   411
     JavaVM deinitialize
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   412
    "
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   413
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   414
    "Modified: / 3.1.1998 / 21:25:27 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   415
    "Created: / 3.1.1998 / 21:28:14 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   416
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   417
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   418
deinitializeAdditionalJavaProtocol
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   419
    "install additional java protocol in smalltalk classes, req'd for java programs"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   420
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   421
    (Object implements:#'clone()Ljava/lang/Object;') ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   422
        Class withoutUpdatingChangesDo:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   423
            Object removeSelector:#'clone()Ljava/lang/Object;'.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   424
        ]
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   425
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   426
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   427
    "
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   428
     self deinitializeAdditionalJavaProtocol
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   429
    "
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   430
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   431
    "Created: / 4.2.1998 / 21:37:10 / cg"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   432
!
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   433
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   434
initialize
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   435
    |table|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   436
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   437
    DUMMY_LONG_HIGHWORD := 1.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   438
    DUMMY_DOUBLE_HIGHWORD := 2.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   439
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   440
    StandardThreadGroup := nil.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   441
    NoAudio := true.
262
8edf97e626c8 offscreen images & better exception handling
cg
parents: 261
diff changeset
   442
    "/ NoAudio := false.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   443
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   444
    JavaConsoleStream := Transcript.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   445
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   446
    FullExceptionTrace := StackTrace := false.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   447
    WindowOPTrace := DrawOPTrace := EventTrace := ThreadTrace := false.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   448
    MonitorTrace := ExceptionTrace := FileOpenTrace := FileIOTrace := false.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   449
    ExceptionDebug := false.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   450
    WindowCreationTrace := false.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   451
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   452
    FileOpenConfirmation := true.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   453
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   454
"/ WindowOPTrace := true.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   455
"/ MonitorTrace := true.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   456
"/ ThreadTrace := true.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   457
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   458
    UnhandledJavaExceptionSignal := (Signal new) mayProceed:false.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   459
    UnhandledJavaExceptionSignal nameClass:self message:#unhandledJavaExceptionSignal.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   460
    UnhandledJavaExceptionSignal notifierString:'unhandled java exception'.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   461
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   462
    JavaExceptionSignal := (Signal new) mayProceed:false.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   463
    JavaExceptionSignal nameClass:self message:#javaExceptionSignal.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   464
    JavaExceptionSignal notifierString:'java exception'.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   465
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   466
    UnimplementedInstructionSignal := (Signal new) mayProceed:false.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   467
    UnimplementedInstructionSignal nameClass:self message:#unimplementedInstructionSignal.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   468
    UnimplementedInstructionSignal notifierString:'unimplemented instruction'.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   469
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   470
    UnimplementedNativeMethodSignal := (Signal new) mayProceed:false.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   471
    UnimplementedNativeMethodSignal nameClass:self message:#unimplementedNativeMethodSignal.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   472
    UnimplementedNativeMethodSignal notifierString:'unimplemented native method'.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   473
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   474
    BadMessageSignal := (Signal new) mayProceed:false.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   475
    BadMessageSignal nameClass:self message:#badMessageSignal.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   476
    BadMessageSignal notifierString:'invalid message to JAVA object'.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   477
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   478
    InternalErrorSignal := (Signal new) mayProceed:false.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   479
    InternalErrorSignal nameClass:self message:#internalErrorSignal.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   480
    InternalErrorSignal notifierString:'internal error'.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   481
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   482
    CallHandlerSignal := (Signal new) mayProceed:false.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   483
    CallHandlerSignal nameClass:self message:#callHandlerSignal.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   484
    CallHandlerSignal notifierString:'internal signal'.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   485
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   486
    "
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   487
     JavaVM initialize
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   488
    "
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   489
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   490
    "Created: / 2.1.1998 / 18:02:34 / cg"
262
8edf97e626c8 offscreen images & better exception handling
cg
parents: 261
diff changeset
   491
    "Modified: / 17.1.1998 / 13:21:41 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   492
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   493
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   494
initializeAdditionalJavaProtocol
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   495
    "install additional java protocol in smalltalk classes, req'd for java programs"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   496
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   497
    |cloneCode|
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   498
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   499
    "/ since we use smalltalk Arrays for JavaArray, some
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   500
    "/ additional (java-) protocol is required.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   501
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   502
    (Object implements:#'clone()Ljava/lang/Object;') ifFalse:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   503
        Object 
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   504
            compile:'__clone
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   505
    "this is smalltalk code with a java selector ...
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   506
     Has been added by JavaVM>>initializeAdditionalJavaProtocol"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   507
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   508
    ^ self shallowCopy'
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   509
            classified:'java support'
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   510
            logged:false.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   511
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   512
        cloneCode := Object compiledMethodAt:#'__clone'.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   513
        cloneCode source:'#''clone()Ljava/lang/Object;''
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   514
    "this is smalltalk code with a java selector ...
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   515
     Has been added by JavaVM>>initializeAdditionalJavaProtocol"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   516
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   517
    ^ self shallowCopy'.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   518
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   519
        Class withoutUpdatingChangesDo:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   520
            Object removeSelector:#'__clone'.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   521
            Object addSelector:#'clone()Ljava/lang/Object;' withMethod:cloneCode.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   522
        ]
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   523
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   524
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   525
    "
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   526
     self initializeAdditionalJavaProtocol
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   527
    "
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   528
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   529
    "Modified: / 28.1.1997 / 19:38:58 / stefan"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   530
    "Modified: / 22.1.1998 / 21:23:40 / av"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   531
    "Created: / 4.2.1998 / 21:35:46 / cg"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   532
    "Modified: / 4.2.1998 / 21:42:47 / cg"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   533
!
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   534
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   535
initializeBaseClasses
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   536
    "load req'd base classes"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   537
326
d1a591aac993 checkin from browser
cg
parents: 325
diff changeset
   538
    #(
d1a591aac993 checkin from browser
cg
parents: 325
diff changeset
   539
        'java.lang.Object'
d1a591aac993 checkin from browser
cg
parents: 325
diff changeset
   540
        'java.lang.Class'
d1a591aac993 checkin from browser
cg
parents: 325
diff changeset
   541
        'java.lang.String'      
d1a591aac993 checkin from browser
cg
parents: 325
diff changeset
   542
        'java.lang.System'
d1a591aac993 checkin from browser
cg
parents: 325
diff changeset
   543
    ) do:[:cName |
d1a591aac993 checkin from browser
cg
parents: 325
diff changeset
   544
        (Java classForName:cName) isNil ifTrue:[
d1a591aac993 checkin from browser
cg
parents: 325
diff changeset
   545
            self halt:('could not find required class:' , cName)
d1a591aac993 checkin from browser
cg
parents: 325
diff changeset
   546
        ]
d1a591aac993 checkin from browser
cg
parents: 325
diff changeset
   547
    ].
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   548
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   549
    "
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   550
     self initializeBaseClasses
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   551
    "
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   552
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   553
    "Created: / 3.1.1998 / 21:13:28 / cg"
326
d1a591aac993 checkin from browser
cg
parents: 325
diff changeset
   554
    "Modified: / 30.3.1998 / 17:47:02 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   555
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   556
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   557
initializeOpenFileTable
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   558
    OpenFileTable := OrderedCollection 
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   559
			with:Stdin 
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   560
			with:(JavaConsoleStream ? Stdout)
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   561
			with:(JavaConsoleStream ? Stderr).
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   562
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   563
    "
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   564
     JavaVM initializeOpenFileTable
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   565
    "
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   566
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   567
    "Modified: / 6.8.1997 / 00:40:19 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   568
    "Created: / 2.1.1998 / 18:04:32 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   569
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   570
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   571
initializePrimitiveClasses
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   572
    JavaClasses isNil ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   573
	JavaClasses := Dictionary new.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   574
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   575
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   576
    #(
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   577
	('byte'    'B' 1)
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   578
	('short'   'S' 2)
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   579
	('int'     'I' 4)
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   580
	('long'    'J' 8)
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   581
	('boolean' 'Z' 1)
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   582
	('char'    'C' 2)
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   583
	('float'   'F' 4)
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   584
	('double'  'D' 8)
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   585
	('void'    'V' 0)
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   586
    ) triplesDo:[:nm :sig :len |
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   587
	|stClass jClass|
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   588
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   589
	"/
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   590
	"/ create a javaClass for it.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   591
	"/
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   592
	jClass := (Java at:'java.lang.Class') new.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   593
"/        stClass := Class new.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   594
"/        stClass setName:('JavaBase_' , nm) asSymbol.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   595
"/        JavaClasses at:stClass put:jClass.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   596
"/        JavaClasses at:jClass put:stClass.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   597
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   598
	JavaClasses at:nm put:jClass
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   599
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   600
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   601
    "
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   602
     self initializePrimitiveClasses
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   603
    "
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   604
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   605
    "Modified: / 4.1.1998 / 00:56:05 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   606
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   607
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   608
initializeSimulatedLibs
277
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   609
    "return a collection of native libs which are considered 
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   610
     being already loaded. (used with jdk < 1.2)"
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   611
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   612
    LibPath := #('__builtIn__' '/usr/local/lib' '/usr/local/lib/java'). 
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   613
    SimulatedLibs := #('__builtIn__/net' 
277
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   614
                       '__builtIn__/awt' 
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   615
                       '__builtIn__/tawt' 
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   616
                       '__builtIn__/winawt' 
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   617
                       '__builtIn__/jpeg'
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   618
                       '__builtIn__/mmedia'
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   619
                       '__builtIn__/zip'
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   620
                       '__builtIn__/math'
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   621
                      ).
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   622
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   623
    "Created: / 4.1.1998 / 19:05:03 / cg"
277
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   624
    "Modified: / 27.1.1998 / 18:43:03 / cg"
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   625
!
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   626
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   627
initializeSimulatedNativeLibs
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   628
    "return a collection of native libs which are considered 
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   629
     being already loaded (used with jdk >= 1.2)"
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   630
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   631
    SimulatedNativeLibs := #(
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   632
                             '/libawt.so' 
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   633
                            ).
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   634
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   635
    "
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   636
     self initializeSimulatedNativeLibs
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   637
    "
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   638
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   639
    "Modified: / 27.1.1998 / 18:43:10 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   640
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   641
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   642
initializeSystemPropertiesInto:props
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   643
    |cpu os|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   644
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   645
    "/ use JAVA compatible cpu-name
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   646
    cpu := OperatingSystem getCPUType.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   647
    cpu = 'i386' ifTrue:[
280
274951f1502c checkin from browser
cg
parents: 277
diff changeset
   648
        cpu := 'ix86'
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   649
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   650
    os := OperatingSystem getOSType.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   651
    os := os asUppercaseFirst.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   652
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   653
    props at:'java.version'       put:'1'.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   654
    props at:'java.vendor'        put:'eXept Software AG'.
342
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   655
    props at:'java.vendor.url'    put:'http://www.exept.de'.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   656
    props at:'java.home'          put:(self defaultJAVAHome).
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   657
    props at:'java.class.version' put:'1'.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   658
    props at:'java.class.path'    put:(self defaultCLASSPATH).
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   659
    props at:'os.name'            put:os.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   660
    props at:'os.arch'            put:cpu.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   661
    props at:'os.version'         put:'1'.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   662
    props at:'file.separator'     put:(Filename separator asString).
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   663
    props at:'path.separator'     put:':'.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   664
    props at:'line.separator'     put:(Character cr asString).
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   665
    props at:'user.name'          put:(OperatingSystem getLoginName).
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   666
    props at:'user.home'          put:(OperatingSystem getHomeDirectory).
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   667
    props at:'user.dir'           put:(Filename currentDirectory pathName).
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   668
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   669
    props at:'awt.toolkit'        put:(self defaultWindowingToolKit).
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   670
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   671
    props at:'jws.home'           put:(self defaultJWSHome).
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   672
    props at:'hotjava.home'       put:(self defaultHotJavaHome).
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   673
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   674
    "/ undocumented ?
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   675
    props at:'file.encoding.pkg'  put:'sun.io'.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   676
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   677
    "/ suppress copyright view in appletViewer ...
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   678
    props at:'appletviewer.version' put:'1.1'.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   679
280
274951f1502c checkin from browser
cg
parents: 277
diff changeset
   680
    "/ new with jdk 1.2
274951f1502c checkin from browser
cg
parents: 277
diff changeset
   681
274951f1502c checkin from browser
cg
parents: 277
diff changeset
   682
    props at:'java.awt.graphicsenv' put:'sun.awt.X11GraphicsEnvironment'.
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
   683
    props at:'java.awt.fonts'       put:'/usr/lib/X11/fonts'.
280
274951f1502c checkin from browser
cg
parents: 277
diff changeset
   684
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   685
    ^ props
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   686
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   687
    "Created: / 3.1.1998 / 14:26:39 / cg"
342
18284bd570b5 more math natives
cg
parents: 341
diff changeset
   688
    "Modified: / 7.5.1998 / 11:58:20 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   689
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   690
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   691
initializeVM
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   692
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   693
    self initializeAdditionalJavaProtocol.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   694
285
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
   695
    self releaseAllJavaResources.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   696
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   697
    JavaConsoleStream := Transcript.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   698
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   699
    Java initAllStaticFields.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   700
    Java markAllClassesUninitialized.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   701
277
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   702
    self initializeSimulatedLibs.       "/ < jdk 1.2
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   703
    self initializeSimulatedNativeLibs. "/ >= jdk 1.2
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   704
    self initializeOpenFileTable.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   705
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   706
    self initializeBaseClasses.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   707
    self initializePrimitiveClasses.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   708
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   709
    (Java classForName:'java.lang.System') classInit.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   710
    Java initSystemClass.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   711
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   712
    ObjectMemory addDependent:self.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   713
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   714
    "
285
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
   715
     JavaVM initialize.
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
   716
     JavaVM initializeVM.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   717
    "
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   718
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   719
    "Created: / 3.1.1998 / 21:29:09 / cg"
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   720
    "Modified: / 4.2.1998 / 23:08:06 / cg"
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   721
!
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   722
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   723
initializeVMIfNoEventThreadRunning
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   724
    (JavaEventThread isNil or:[JavaEventThread isDead]) ifTrue:[
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
   725
	self initializeVM
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   726
    ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   727
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   728
    "
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   729
     JavaVM initializeVMIfNoEventThreadRunning
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   730
    "
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   731
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   732
    "Modified: / 15.1.1998 / 17:29:34 / cg"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   733
    "Created: / 15.1.1998 / 17:32:27 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   734
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   735
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   736
releaseAllJavaResources
285
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
   737
    KnownWindows := nil.
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
   738
    JavaWindowGroup := nil.
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
   739
    FirstWindowCreationSemaphore := Semaphore new.
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
   740
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
   741
    LoadedLibs := nil.             "/ gc will reclaim them ...
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
   742
    LoadedNativeLibs := nil.       "/ gc will reclaim them ...
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
   743
    
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
   744
    ImageStretchCache := nil.
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
   745
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
   746
    self terminateAllThreads.
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
   747
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   748
    self releaseAllMonitors.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   749
    self releaseAllWindows.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   750
    self releaseAllStreams.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   751
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   752
    "
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   753
     JavaVM releaseAllJavaResources
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   754
    "
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   755
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   756
    "Created: / 7.1.1998 / 22:49:42 / cg"
285
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
   757
    "Modified: / 28.1.1998 / 23:11:44 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   758
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   759
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   760
releaseAllMonitors
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   761
    LockTable := WeakIdentityDictionary new.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   762
    LockTableAccess := Semaphore forMutualExclusion.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   763
    WaitTable := IdentityDictionary new.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   764
    WaitTableAccess := Semaphore forMutualExclusion.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   765
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   766
    EnteredMonitorsPerProcess := IdentityDictionary new.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   767
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   768
    "
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   769
     JavaVM releaseAllMonitors
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   770
    "
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   771
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   772
    "Created: / 2.1.1998 / 18:04:05 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   773
    "Modified: / 7.1.1998 / 22:58:10 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   774
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   775
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   776
releaseAllStreams
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   777
    OpenFileTable notNil ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   778
        OpenFileTable do:[:aStream |
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   779
            aStream notNil ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   780
                aStream ~~ Stdin ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   781
                    aStream ~~ Stdout ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   782
                        aStream ~~ Stderr ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   783
                            aStream ~~ JavaConsoleStream ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   784
                                aStream isExternalStream ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   785
                                    aStream shutDown
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   786
                                ]
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   787
                            ]
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   788
                        ]
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   789
                    ]
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   790
                ]
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   791
            ]
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   792
        ]
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   793
    ].
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   794
    self initializeOpenFileTable.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   795
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   796
    "
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   797
     JavaVM releaseAllStreams
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   798
    "
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   799
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   800
    "Created: / 7.1.1998 / 22:57:04 / cg"
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
   801
    "Modified: / 4.2.1998 / 19:53:11 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   802
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   803
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   804
releaseAllWindows
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   805
    KnownWindows notNil ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   806
	KnownWindows do:[:aView |
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   807
	    aView destroy
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   808
	].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   809
	KnownWindows := nil.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   810
    ]
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   811
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   812
    "
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   813
     self releaseAllWindows
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   814
    "
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   815
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   816
    "Created: / 7.1.1998 / 22:58:32 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   817
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   818
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   819
releaseLeftOverMonitors
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   820
    "release monitors held by dead processes"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   821
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   822
    |deadProcesses|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   823
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   824
    deadProcesses := IdentitySet new.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   825
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   826
    EnteredMonitorsPerProcess keysAndValuesDo:[:p :monitors |
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   827
	p isDead ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   828
	    monitors do:[:mon |
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   829
		Transcript showCR:'release leftover monitor ...'.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   830
		mon release
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   831
	    ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   832
	    deadProcesses add:p.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   833
	]
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   834
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   835
    deadProcesses do:[:p |
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   836
	EnteredMonitorsPerProcess removeKey:p
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   837
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   838
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   839
    "
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   840
     JavaVM releaseLeftOverMonitors
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   841
    "
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   842
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   843
    "Created: / 8.1.1998 / 17:29:26 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   844
    "Modified: / 8.1.1998 / 17:38:33 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   845
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   846
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   847
systemProperties
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   848
    |props|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   849
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   850
    props := Dictionary new.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   851
    self initializeSystemPropertiesInto:props.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   852
    ^ props
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   853
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   854
    "Created: / 3.1.1998 / 14:25:58 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   855
    "Modified: / 3.1.1998 / 14:32:38 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   856
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   857
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   858
terminateAllThreads
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   859
    Java terminateAllThreads.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   860
    JavaEventThread := nil.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   861
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   862
    "Created: / 8.1.1998 / 17:43:54 / cg"
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   863
    "Modified: / 15.1.1998 / 17:29:00 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   864
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   865
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   866
update:something with:aParameter from:changedObject
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   867
    something == #returnFromSnapshot ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   868
	 self initializeVM
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   869
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   870
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   871
    "
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   872
     JavaVM initializeVM
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   873
    "
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   874
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   875
    "Modified: / 8.1.1998 / 17:44:16 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
   876
    "Created: / 9.1.1998 / 10:30:13 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   877
! !
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   878
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   879
!JavaVM class methodsFor:'Signal constants'!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   880
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   881
badMessageSignal
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   882
    ^ BadMessageSignal
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   883
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   884
    "Created: / 2.1.1998 / 18:06:52 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   885
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   886
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   887
callHandlerSignal
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   888
    ^ CallHandlerSignal
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   889
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   890
    "Created: / 2.1.1998 / 18:07:16 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   891
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   892
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   893
internalErrorSignal
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   894
    ^ InternalErrorSignal
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   895
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   896
    "Created: / 2.1.1998 / 18:07:05 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   897
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   898
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   899
javaExceptionSignal
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   900
    ^ JavaExceptionSignal
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   901
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   902
    "Created: / 2.1.1998 / 18:05:58 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   903
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   904
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   905
unhandledJavaExceptionSignal
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   906
    ^ UnhandledJavaExceptionSignal
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   907
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   908
    "Created: / 2.1.1998 / 18:05:19 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   909
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   910
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   911
unimplementedInstructionSignal
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   912
    ^ UnimplementedInstructionSignal
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   913
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   914
    "Created: / 2.1.1998 / 18:06:15 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   915
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   916
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   917
unimplementedNativeMethodSignal
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   918
    ^ UnimplementedNativeMethodSignal
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   919
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   920
    "Created: / 2.1.1998 / 18:06:40 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   921
! !
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   922
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   923
!JavaVM class methodsFor:'defaults'!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   924
359
bcad9c97d2e5 use #copyReplaceAll:with:
cg
parents: 347
diff changeset
   925
audioEnabled
bcad9c97d2e5 use #copyReplaceAll:with:
cg
parents: 347
diff changeset
   926
    ^ NoAudio not
bcad9c97d2e5 use #copyReplaceAll:with:
cg
parents: 347
diff changeset
   927
bcad9c97d2e5 use #copyReplaceAll:with:
cg
parents: 347
diff changeset
   928
    "Created: / 18.7.1998 / 22:31:36 / cg"
bcad9c97d2e5 use #copyReplaceAll:with:
cg
parents: 347
diff changeset
   929
!
bcad9c97d2e5 use #copyReplaceAll:with:
cg
parents: 347
diff changeset
   930
bcad9c97d2e5 use #copyReplaceAll:with:
cg
parents: 347
diff changeset
   931
audioEnabled:aBoolean
bcad9c97d2e5 use #copyReplaceAll:with:
cg
parents: 347
diff changeset
   932
    NoAudio := aBoolean not
bcad9c97d2e5 use #copyReplaceAll:with:
cg
parents: 347
diff changeset
   933
bcad9c97d2e5 use #copyReplaceAll:with:
cg
parents: 347
diff changeset
   934
    "Created: / 18.7.1998 / 22:31:20 / cg"
bcad9c97d2e5 use #copyReplaceAll:with:
cg
parents: 347
diff changeset
   935
!
bcad9c97d2e5 use #copyReplaceAll:with:
cg
parents: 347
diff changeset
   936
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   937
defaultCLASSPATH
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   938
    |s|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   939
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   940
    s := '' writeStream.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   941
    Java classPath do:[:p |
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   942
	s size == 0 ifFalse:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   943
	    s nextPut:$:
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   944
	].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
   945
	s nextPutAll:p.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   946
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   947
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   948
    ^ s contents
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   949
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   950
    "
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   951
     self defaultCLASSPATH
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   952
    "
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   953
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   954
    "Modified: / 6.8.1997 / 00:51:17 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   955
    "Created: / 3.1.1998 / 14:27:21 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   956
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   957
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   958
defaultHotJavaHome
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   959
    ^ '/usr/local/java/hotjava'.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   960
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   961
    "Modified: / 5.8.1997 / 04:13:36 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   962
    "Created: / 3.1.1998 / 14:27:34 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   963
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   964
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   965
defaultJAVAHome
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   966
    ^ Java javaHome
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   967
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   968
    "Modified: / 6.8.1997 / 00:54:44 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   969
    "Created: / 3.1.1998 / 14:27:01 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   970
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   971
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   972
defaultJWSHome
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   973
    ^ '/usr/local/java/JWS'.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   974
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   975
    "Modified: / 5.8.1997 / 04:14:34 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   976
    "Created: / 3.1.1998 / 14:27:42 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   977
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   978
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   979
defaultWindowingToolKit
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   980
    "/ prefer the windows toolkit ...
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   981
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   982
    (Java classForName:'sun.awt.windows.WToolkit') notNil ifTrue:[
277
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   983
        ^ 'sun.awt.windows.WToolkit'.
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   984
    ].
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   985
    (Java classForName:'sun.awt.motif.MToolkit') notNil ifTrue:[
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   986
        ^ 'sun.awt.motif.MToolkit'.
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   987
    ].
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   988
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   989
    ^ 'sun.awt.tiny.TinyToolkit'.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   990
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   991
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   992
"/    ^ 'sun.awt.win32.MToolkit'.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   993
"/    ^ 'sun.awt.motif.MToolkit'.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   994
277
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   995
    "
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   996
     self defaultWindowingToolKit
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   997
    "
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
   998
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
   999
    "Created: / 3.1.1998 / 14:27:49 / cg"
277
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1000
    "Modified: / 27.1.1998 / 21:52:52 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1001
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1002
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1003
javaConsole:aStream
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1004
    JavaConsoleStream := aStream
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1005
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1006
    "
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1007
     JavaVM javaConsole:Transcript
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1008
    "
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1009
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1010
    "Modified: / 6.8.1997 / 00:34:13 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1011
    "Created: / 3.1.1998 / 14:27:58 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1012
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1013
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1014
javaConsoleStream
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1015
    ^ JavaConsoleStream
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1016
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1017
    "Created: / 3.1.1998 / 14:32:16 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1018
! !
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1019
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1020
!JavaVM class methodsFor:'fileIO'!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1021
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1022
addOpenFile:aStream
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1023
    OpenFileTable add:aStream.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1024
    ^ OpenFileTable size - 1.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1025
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1026
    "Created: / 2.1.1998 / 18:32:59 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1027
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1028
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1029
getOpenFileAt:idx
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1030
    ^ OpenFileTable at:idx+1 ifAbsent:nil.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1031
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1032
    "Created: / 2.1.1998 / 18:28:01 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1033
    "Modified: / 2.1.1998 / 18:33:06 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1034
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1035
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1036
setOpenFile:aStream at:idx
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1037
    OpenFileTable size < (idx+1) ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1038
	OpenFileTable grow:idx+1.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1039
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1040
    OpenFileTable at:idx+1 put:aStream.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1041
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1042
    "Modified: / 2.1.1998 / 18:33:21 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1043
! !
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1044
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1045
!JavaVM class methodsFor:'helpers'!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1046
268
f7357f1142c8 provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents: 266
diff changeset
  1047
classForJavaClassObject:aJavaClassObject
f7357f1142c8 provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents: 266
diff changeset
  1048
    "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
  1049
f7357f1142c8 provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents: 266
diff changeset
  1050
    ^ JavaClasses at:aJavaClassObject ifAbsent:nil.
f7357f1142c8 provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents: 266
diff changeset
  1051
f7357f1142c8 provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents: 266
diff changeset
  1052
    "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
  1053
!
f7357f1142c8 provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents: 266
diff changeset
  1054
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1055
enteredMonitors
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1056
    |p monitors|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1057
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1058
    p := Processor activeProcess.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1059
    monitors := EnteredMonitorsPerProcess at:p ifAbsent:nil.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1060
    monitors isNil ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1061
	monitors := OrderedCollection new.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1062
	EnteredMonitorsPerProcess at:p put:monitors.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1063
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1064
    ^ monitors
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1065
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1066
    "Created: / 2.1.1998 / 21:26:19 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1067
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1068
268
f7357f1142c8 provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents: 266
diff changeset
  1069
javaClassObjectForClass:aClass
f7357f1142c8 provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents: 266
diff changeset
  1070
    "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
  1071
     instance for it."
f7357f1142c8 provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents: 266
diff changeset
  1072
f7357f1142c8 provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents: 266
diff changeset
  1073
    |jClass|
f7357f1142c8 provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents: 266
diff changeset
  1074
f7357f1142c8 provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents: 266
diff changeset
  1075
    jClass := JavaClasses at:aClass ifAbsent:nil.
f7357f1142c8 provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents: 266
diff changeset
  1076
    jClass isNil ifTrue:[
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1077
	"/ class must be initialized (with all of its superclasses ?).
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1078
	aClass classInit.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1079
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1080
	JavaClasses at:aClass put:(jClass := (Java at:'java.lang.Class') new).
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1081
	JavaClasses at:jClass put:aClass.
268
f7357f1142c8 provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents: 266
diff changeset
  1082
    ].
f7357f1142c8 provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents: 266
diff changeset
  1083
    ^ jClass
f7357f1142c8 provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents: 266
diff changeset
  1084
f7357f1142c8 provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents: 266
diff changeset
  1085
    "Created: / 23.1.1998 / 17:43:38 / cg"
f7357f1142c8 provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents: 266
diff changeset
  1086
    "Modified: / 23.1.1998 / 17:46:51 / cg"
f7357f1142c8 provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents: 266
diff changeset
  1087
!
f7357f1142c8 provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents: 266
diff changeset
  1088
321
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  1089
javaMethodObjectForMethod:aMethod
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  1090
    "given a real method, return the corresponding java.lang.reflect.Method
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  1091
     instance for it."
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  1092
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  1093
    |jMethod|
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  1094
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  1095
    jMethod := JavaMethods at:aMethod ifAbsent:nil.
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  1096
    jMethod isNil ifTrue:[
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  1097
        "/ class must be initialized (with all of its superclasses ?).
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  1098
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  1099
        JavaMethods at:aMethod put:(jMethod := (Java at:'java.lang.reflect.Method') new).
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  1100
        JavaMethods at:jMethod put:aMethod.
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  1101
    ].
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  1102
    ^ jMethod
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  1103
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  1104
    "Modified: / 23.1.1998 / 17:46:51 / cg"
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  1105
    "Created: / 9.2.1998 / 15:59:16 / cg"
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  1106
!
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  1107
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1108
javaThreadForSTProcess:stProcess
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1109
    |t|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1110
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1111
    t := Java threads keyAtValue:stProcess ifAbsent:nil.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1112
    t == 0 ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1113
	^ nil
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1114
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1115
    ^ t
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1116
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1117
    "Modified: / 26.8.1997 / 19:56:31 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1118
    "Created: / 3.1.1998 / 01:53:41 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1119
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1120
321
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  1121
methodForJavaMethodObject:aJavaMethodObject
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  1122
    "given java.lang.reflect.Method instance, return the real method for it."
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  1123
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  1124
    ^ JavaMethods at:aJavaMethodObject ifAbsent:nil.
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  1125
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  1126
    "Created: / 9.2.1998 / 16:01:48 / cg"
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  1127
!
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  1128
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1129
newThread:name
274
0a9193e3f2be *** empty log message ***
cg
parents: 272
diff changeset
  1130
    |thread threadClass i|
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1131
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1132
    threadClass := Java at:'java.lang.Thread'.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1133
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1134
    thread := (Java at:'java.lang.Thread') basicNew.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1135
    thread instVarNamed:'name'        put:(Java as_String:name).
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1136
    thread instVarNamed:'priority'    put:(threadClass instVarNamed:'NORM_PRIORITY').
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1137
    thread instVarNamed:'single_step' put:0.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1138
    thread instVarNamed:'daemon'      put:0.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1139
    thread instVarNamed:'stillborn'   put:0.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1140
    thread instVarNamed:'target'      put:nil.
274
0a9193e3f2be *** empty log message ***
cg
parents: 272
diff changeset
  1141
    "/
0a9193e3f2be *** empty log message ***
cg
parents: 272
diff changeset
  1142
    "/ that on was only temporarily present in JDK1.1.3 (sigh)
0a9193e3f2be *** empty log message ***
cg
parents: 272
diff changeset
  1143
    "/
0a9193e3f2be *** empty log message ***
cg
parents: 272
diff changeset
  1144
    (i := thread class instVarOffsetOf:'initial_stack_memory') notNil ifTrue:[
0a9193e3f2be *** empty log message ***
cg
parents: 272
diff changeset
  1145
        thread instVarAt:i put:0.
0a9193e3f2be *** empty log message ***
cg
parents: 272
diff changeset
  1146
    ].
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1147
    thread instVarNamed:'group'       put:(self standardThreadGroup).
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1148
    ^ thread
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1149
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1150
    "Created: / 3.1.1998 / 01:47:30 / cg"
274
0a9193e3f2be *** empty log message ***
cg
parents: 272
diff changeset
  1151
    "Modified: / 27.1.1998 / 00:54:33 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1152
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1153
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1154
stProcessForJavaThread:jThread
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1155
    |p|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1156
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1157
    p := Java threads at:jThread ifAbsent:nil.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1158
    p == 0 ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1159
	^ nil
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1160
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1161
    ^ p
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1162
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1163
    "Created: / 2.1.1998 / 21:48:27 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1164
    "Modified: / 3.1.1998 / 01:53:55 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1165
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1166
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1167
standardThreadGroup
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1168
    |standardGroup threadClass|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1169
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1170
    StandardThreadGroup isNil ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1171
	threadClass := Java at:'java.lang.Thread'.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1172
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1173
	standardGroup := (Java at:'java.lang.ThreadGroup') new.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1174
	standardGroup instVarNamed:'parent'      put:nil.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1175
	standardGroup instVarNamed:'name'        put:(Java as_String:'main').
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1176
	standardGroup instVarNamed:'maxPriority' put:(threadClass instVarNamed:'MAX_PRIORITY').
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1177
	standardGroup instVarNamed:'destroyed'   put:0.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1178
	standardGroup instVarNamed:'daemon'      put:nil.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1179
	standardGroup instVarNamed:'vmAllowSuspension' put:0.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1180
	standardGroup instVarNamed:'nthreads'    put:0.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1181
	standardGroup instVarNamed:'ngroups'     put:0.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1182
	standardGroup instVarNamed:'groups'      put:nil.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1183
	StandardThreadGroup := standardGroup.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1184
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1185
    ^ StandardThreadGroup
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1186
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1187
    "Created: / 3.1.1998 / 01:41:54 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1188
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1189
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1190
wakeup:anObject
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1191
    JavaVM releaseAndSignalSemaphoreFor:anObject.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1192
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1193
    "Created: / 3.1.1998 / 02:29:27 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1194
    "Modified: / 3.1.1998 / 03:08:05 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1195
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1196
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1197
wakeupAll:anObject
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1198
    JavaVM releaseAndSignalForAllSemaphoreFor:anObject.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1199
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1200
    "Created: / 3.1.1998 / 03:07:48 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1201
    "Modified: / 3.1.1998 / 03:08:15 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1202
! !
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1203
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1204
!JavaVM class methodsFor:'helpers - awt'!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1205
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1206
commonReshapeComponent:nativeContext
277
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1207
    |view x y width height ext menu|
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1208
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1209
    view := self viewForWPeer:nativeContext.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1210
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1211
    x := nativeContext argAt:1.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1212
    y := nativeContext argAt:2.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1213
    width := nativeContext argAt:3.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1214
    height := nativeContext argAt:4.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1215
    ext := width@height.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1216
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1217
"/    'pReshape ' print. view print. 
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1218
"/    ' ' print. x print. '/' print. y print.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1219
"/    ' extent: ' print. ext printNL.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1220
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1221
    (view isTopView 
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1222
    or:[view isMemberOf:JavaEmbeddedFrameView]) ifTrue:[
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1223
        "/
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1224
        "/ dont allow setting the origin
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1225
        "/
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1226
        menu := self topViewsMenu:view.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1227
        menu notNil ifTrue:[
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1228
            "/ must add the menus height
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1229
            height := height + menu height.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1230
            ext := width@height.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1231
        ].
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1232
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1233
        "/ to prevent a view from not being visible/closable
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1234
        "/ in case Java goes mad ..
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1235
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1236
        (width < 30
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1237
        or:[height < 10]) ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1238
            "/ self halt.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1239
            width := 30.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1240
            height := 20.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1241
            ext := width@height.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1242
        ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1243
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1244
        view extent:ext.
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1245
        (view isKindOf:ModalBox) ifTrue:[
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1246
            view preferredExtent:ext
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1247
        ].
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1248
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1249
        "/ adjust non-resizable views min/max
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1250
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1251
        view isTopView ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1252
            view minExtent notNil ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1253
                view minExtent:ext.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1254
                view maxExtent:ext
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1255
            ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1256
        ]
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1257
    ] ifFalse:[
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1258
        (view superView notNil
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1259
        and:[view superView isTopView]) ifTrue:[
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1260
            menu := self topViewsMenu:view superView.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1261
            menu notNil ifTrue:[
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1262
                "/ must add menus height to yPos
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1263
                y := y + menu height.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1264
            ]
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1265
        ] ifFalse:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1266
            "/ post a configuration event
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  1267
            EventTrace == true ifTrue:[
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  1268
                'JAVA: configure: need event' printCR.
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  1269
            ]
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1270
        ].
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1271
        view origin:x@y extent:ext.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1272
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1273
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1274
    ^ nil
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1275
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1276
    "Created: / 4.1.1998 / 18:00:52 / cg"
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  1277
    "Modified: / 6.2.1998 / 01:45:46 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1278
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1279
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1280
createdWindowsView:aView for:aJavaPeer
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1281
    "this is only sent with the sun.awt.windows toolkit"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1282
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1283
    aJavaPeer instVarNamed:'pData' put:aView.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1284
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1285
    JavaWindowGroup isNil ifTrue:[
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  1286
        JavaWindowGroup := WindowGroup new.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  1287
        JavaWindowGroup isForModalSubview:true.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1288
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1289
    aView windowGroup:JavaWindowGroup.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1290
    JavaWindowGroup addView:aView.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1291
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1292
    KnownWindows isNil ifTrue:[
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  1293
        KnownWindows := IdentityDictionary new.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1294
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1295
    KnownWindows at:aJavaPeer put:aView.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1296
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  1297
    FirstWindowCreationSemaphore signalIf.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  1298
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1299
"/'*** ' print. aJavaPeer print. ' -> ' print. aView printCR.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1300
"/(aView isKindOf:ModalBox) ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1301
"/    self halt.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1302
"/].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1303
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1304
    "Created: / 4.1.1998 / 17:57:16 / cg"
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  1305
    "Modified: / 28.1.1998 / 22:40:19 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1306
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1307
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1308
gcForWGraphics:nativeContext
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1309
    |jGraphics gc orgX orgY trans|
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1310
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1311
    jGraphics := nativeContext receiver.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1312
    gc := jGraphics instVarNamed:'pData'.
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1313
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1314
    trans := gc translation.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1315
    orgX := jGraphics instVarNamed:'originX'.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1316
    orgY := jGraphics instVarNamed:'originY'.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1317
    ((orgX ~~ trans x) or:[orgY ~~ trans y]) ifTrue:[
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1318
        gc translation:orgX@orgY
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1319
    ].
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1320
    ^ gc
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1321
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1322
    "Created: / 8.1.1998 / 00:16:38 / cg"
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1323
    "Modified: / 25.1.1998 / 11:11:42 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1324
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1325
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1326
jPeerForView:aView
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1327
    ^ KnownWindows keyAtValue:aView ifAbsent:nil
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1328
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1329
    "Created: / 15.1.1998 / 13:48:01 / cg"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1330
    "Modified: / 15.1.1998 / 13:48:43 / cg"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1331
!
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1332
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1333
pReshape:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1334
    |jFramePeer view x y width height menu|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1335
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1336
    jFramePeer := nativeContext receiver.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1337
    view := jFramePeer instVarNamed:'pData'.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1338
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1339
    x := nativeContext argAt:1.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1340
    y := nativeContext argAt:2.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1341
    width := nativeContext argAt:3.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1342
    height := nativeContext argAt:4.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1343
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1344
"/    'pReshape ' print. view print. 
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1345
"/    ' ' print. x print. '/' print. y print.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1346
"/    ' extent: ' print. width print. '/' print. height printNL.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1347
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1348
    (view isTopView 
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1349
    or:[view isMemberOf:JavaEmbeddedFrameView]) ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1350
	"/
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1351
	"/ dont allow setting the origin
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1352
	"/
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1353
	menu := self topViewsMenu:view.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1354
	menu notNil ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1355
	    "/ must add the menus height
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1356
	    height := height + menu height
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1357
	].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1358
	view extent:width@height.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1359
    ] ifFalse:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1360
	(view superView notNil
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1361
	and:[view superView isTopView]) ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1362
	    menu := self topViewsMenu:view superView.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1363
	    menu notNil ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1364
		"/ must add menus height to yPos
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1365
		y := y + menu height.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1366
	    ]
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1367
	].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1368
	view origin:x@y extent:width@height.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1369
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1370
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1371
    ^ nil
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1372
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1373
    "Modified: / 21.8.1997 / 19:34:16 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1374
    "Created: / 7.1.1998 / 21:47:11 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1375
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1376
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1377
topViewsMenu:view
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1378
    |idx|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1379
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1380
    view isTopView ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1381
	view subViews size > 0 ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1382
	    (idx := view subViews findFirst:[:v | v isMemberOf:MenuPanel]) ~~ 0 ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1383
		"/ must add the menus height
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1384
		^ view subViews at:idx
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1385
	    ]
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1386
	].
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1387
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1388
    ^ nil
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1389
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1390
    "Modified: / 4.8.1997 / 01:23:06 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1391
    "Created: / 4.1.1998 / 18:01:42 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1392
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1393
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1394
viewForWPeer:nativeContext
277
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1395
    |jPeer view pDataIdx|
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1396
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1397
    jPeer := nativeContext receiver.
277
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1398
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1399
    "/ sigh; pData was renamed to pNativeWidget in jdk1.2 ...
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1400
    pDataIdx := jPeer class instVarOffsetOf:'pNativeWidget'.
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1401
    pDataIdx isNil ifTrue:[
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1402
        "/ ok, we are < 1.2
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1403
        pDataIdx := jPeer class instVarOffsetOf:'pData'.
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1404
    ].
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1405
    
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1406
    view := jPeer instVarAt:pDataIdx.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1407
    ^ view
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1408
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1409
    "Created: / 8.1.1998 / 17:31:25 / cg"
277
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1410
    "Modified: / 27.1.1998 / 21:37:43 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1411
! !
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1412
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1413
!JavaVM class methodsFor:'helpers - exceptions'!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1414
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1415
findJavaHandlerFor:aJavaException
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1416
    |con method pc hPC|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1417
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1418
    con := thisContext sender.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1419
    [con notNil] whileTrue:[
347
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1420
        (con isJavaContext) ifTrue:[
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1421
            method := con method.
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1422
            pc := con pc.
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1423
            (hPC := method handlerFor:aJavaException at:pc) notNil ifTrue:[
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1424
                con setPC:hPC.
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1425
                ^ con
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1426
            ].
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1427
        ].
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1428
        con := con sender.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1429
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1430
    ^ nil
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1431
347
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1432
    "Modified: / 8.5.1998 / 21:29:48 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1433
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1434
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1435
throwArrayIndexOutOfBoundsException:badIndex
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1436
    |exClass ex|
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1437
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1438
"/    self 
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1439
"/        throwExceptionClassName:'java.lang.ArrayIndexOutOfBoundsException' 
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1440
"/        withMessage:'bad array index: ' , badIndex printString
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1441
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1442
    exClass := Java classForName:'java.lang.ArrayIndexOutOfBoundsException'.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1443
    ex := exClass newCleared.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1444
    ex perform:#'<init>(I)V' with:badIndex.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1445
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1446
    self throwException:ex
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1447
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1448
    "Created: / 14.1.1998 / 21:36:05 / cg"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1449
    "Modified: / 14.1.1998 / 23:32:52 / cg"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1450
!
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1451
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1452
throwClassNotFoundException
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1453
    self 
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1454
	throwExceptionClassName:'java.lang.ClassNotFoundException' 
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1455
	withMessage:'no such class'
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1456
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1457
    "Created: / 4.1.1998 / 22:25:26 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1458
    "Modified: / 7.1.1998 / 15:25:35 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1459
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1460
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1461
throwClassNotFoundException:className
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1462
    self 
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1463
	throwExceptionClassName:'java.lang.ClassNotFoundException' 
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1464
	withMessage:'no such class: ' , className
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1465
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1466
    "Created: / 4.1.1998 / 22:26:09 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1467
    "Modified: / 7.1.1998 / 15:25:58 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1468
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1469
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1470
throwException:aJavaException
262
8edf97e626c8 offscreen images & better exception handling
cg
parents: 261
diff changeset
  1471
    |con jMsg msg exClass|
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1472
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1473
    ExceptionTrace ifTrue:[
347
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1474
        'JAVA: exception: ' print. aJavaException class fullName printCR.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1475
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1476
    ExceptionDebug ifTrue:[
347
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1477
        self halt:('JAVA: exception: ' , aJavaException class fullName).
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1478
        self internalError:('JAVA: exception: ' , aJavaException class fullName).
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1479
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1480
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1481
    con := self findJavaHandlerFor:aJavaException.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1482
    con isNil ifTrue:[
347
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1483
        exClass := aJavaException class.
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1484
        jMsg := aJavaException instVarNamed:'detailMessage'.
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1485
        jMsg notNil ifTrue:[
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1486
            msg := Java as_ST_String:jMsg.
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1487
            msg := 'Java ' , exClass name , ': ' , msg.
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1488
        ] ifFalse:[
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1489
            msg := 'Java ' , exClass name
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1490
        ].
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1491
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1492
        "/ for our convenience: skip ST contexts
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1493
        con := thisContext sender.
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1494
        [con isNil or:[con isJavaContext]] whileFalse:[
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1495
            con := con sender
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1496
        ].
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1497
        con isNil ifTrue:[con := thisContext sender].
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1498
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1499
        "/
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1500
        "/ no JavaHandler ... let smalltalk handle it
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1501
        "/
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1502
        JavaVM javaExceptionSignal 
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1503
                raiseWith:aJavaException
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1504
                errorString:msg
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1505
                in:con.
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1506
        Processor activeProcess terminate.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1507
    ].
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1508
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1509
    "/
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1510
    "/ found a java exceptionHandler
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1511
    "/
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1512
    con exceptionArg:aJavaException.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1513
    con markForException.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1514
    con unwindAndRestart.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1515
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1516
    self halt:'should not be reached'.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1517
    Processor activeProcess terminate.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1518
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1519
    "Created: / 7.1.1998 / 15:28:22 / cg"
347
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  1520
    "Modified: / 8.5.1998 / 21:29:41 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1521
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1522
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1523
throwExceptionClassName:aJavaExceptionClassName withMessage:someMessage
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1524
    |exClass ex|
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1525
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1526
    exClass := Java classForName:aJavaExceptionClassName.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1527
    ex := exClass newCleared.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1528
    ex perform:#'<init>(Ljava/lang/String;)V' with:(Java as_String:someMessage).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1529
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1530
    "/ ex := exClass new.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1531
    "/ ex instVarNamed:'detailMessage' put:(Java as_String:someMessage).
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1532
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1533
    self throwException:ex
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1534
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1535
    "Created: / 7.1.1998 / 15:25:09 / cg"
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1536
    "Modified: / 14.1.1998 / 23:38:30 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1537
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1538
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1539
throwIOExceptionWithMessage:message
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1540
    self 
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1541
	throwExceptionClassName:'java.io.IOException' 
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1542
	withMessage:message
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1543
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1544
    "Created: / 7.1.1998 / 10:34:24 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1545
    "Modified: / 7.1.1998 / 15:26:25 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1546
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1547
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1548
throwIllegalAccessException
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1549
    self 
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1550
	throwExceptionClassName:'java.lang.IllegalAccessException' 
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1551
	withMessage:'illegal access'
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1552
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1553
    "Modified: / 7.1.1998 / 15:25:35 / cg"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1554
    "Created: / 14.1.1998 / 23:13:44 / cg"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1555
!
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1556
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1557
throwInstantiationException
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1558
    self 
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1559
	throwExceptionClassName:'java.lang.InstantiationException' 
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1560
	withMessage:'cannot instantiate'
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1561
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1562
    "Modified: / 7.1.1998 / 15:25:35 / cg"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1563
    "Created: / 14.1.1998 / 23:15:01 / cg"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1564
!
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1565
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1566
throwInstantiationExceptionFor:aJavaClass
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1567
    self 
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1568
	throwExceptionClassName:'java.lang.InstantiationException' 
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1569
	withMessage:('cannot instantiate ' , aJavaClass fullName)
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1570
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1571
    "Modified: / 7.1.1998 / 15:25:35 / cg"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1572
    "Created: / 14.1.1998 / 23:17:02 / cg"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1573
!
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1574
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1575
throwNullPointerException
280
274951f1502c checkin from browser
cg
parents: 277
diff changeset
  1576
    self halt:'null pointer exception'.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1577
    self 
280
274951f1502c checkin from browser
cg
parents: 277
diff changeset
  1578
        throwExceptionClassName:'java.lang.NullPointerException' 
274951f1502c checkin from browser
cg
parents: 277
diff changeset
  1579
        withMessage:'null pointer'
274951f1502c checkin from browser
cg
parents: 277
diff changeset
  1580
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1581
    "Created: / 9.1.1998 / 02:26:08 / cg"
280
274951f1502c checkin from browser
cg
parents: 277
diff changeset
  1582
    "Modified: / 28.1.1998 / 02:30:09 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1583
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1584
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1585
throwNumberFormatException 
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1586
    self 
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1587
	throwExceptionClassName:'java.lang.NumberFormatException' 
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1588
	withMessage:'bad number format'
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1589
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1590
    "Modified: / 7.1.1998 / 15:25:35 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  1591
    "Created: / 11.1.1998 / 16:08:22 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1592
! !
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1593
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1594
!JavaVM class methodsFor:'helpers - io'!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1595
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1596
anyStream_close:nativeContext
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1597
    |jStream fileNo file|
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1598
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1599
    jStream := nativeContext receiver.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1600
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1601
    fileNo := self validateFileNo:jStream.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1602
    fileNo == 0 ifTrue:[
280
274951f1502c checkin from browser
cg
parents: 277
diff changeset
  1603
        'JAVA: file is already closed' errorPrintCR.
274951f1502c checkin from browser
cg
parents: 277
diff changeset
  1604
        ^ self    "/ already closed
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1605
    ].
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1606
    file := self getOpenFileAt:fileNo.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1607
    file isNil ifTrue:[
280
274951f1502c checkin from browser
cg
parents: 277
diff changeset
  1608
        self halt:'invalid fileNo in close'.
274951f1502c checkin from browser
cg
parents: 277
diff changeset
  1609
        self internalError:'invalid fileNo in close'.
274951f1502c checkin from browser
cg
parents: 277
diff changeset
  1610
        ^ self
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1611
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1612
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1613
    "/ should always be bytes
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1614
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1615
    (file ~~ Stdin
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1616
    and:[file ~~ Stdout
280
274951f1502c checkin from browser
cg
parents: 277
diff changeset
  1617
    and:[file ~~ Stderr
274951f1502c checkin from browser
cg
parents: 277
diff changeset
  1618
    and:[file ~~ Transcript]]]) ifTrue:[
274951f1502c checkin from browser
cg
parents: 277
diff changeset
  1619
        file close.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1620
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1621
    self setOpenFile:nil at:fileNo.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1622
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1623
    fileNo := jStream instVarNamed:'fd'.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1624
    fileNo isInteger ifFalse:[
280
274951f1502c checkin from browser
cg
parents: 277
diff changeset
  1625
        "/ JDK 1.1.3
274951f1502c checkin from browser
cg
parents: 277
diff changeset
  1626
        fileNo instVarNamed:'fd' put:0.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1627
    ] ifTrue:[
280
274951f1502c checkin from browser
cg
parents: 277
diff changeset
  1628
        "/ JDK 1.0
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1629
        jStream instVarNamed:'fd' put:0
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1630
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1631
280
274951f1502c checkin from browser
cg
parents: 277
diff changeset
  1632
    "Modified: / 28.1.1998 / 02:15:24 / cg"
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1633
    "Created: / 4.2.1998 / 15:22:03 / cg"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1634
!
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1635
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1636
anyStream_readBytes:nativeContext
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1637
    |bytes offset count stream nRead|
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1638
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1639
    bytes := nativeContext argAt:1.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1640
    offset := nativeContext argAt:2.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1641
    count := nativeContext argAt:3.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1642
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1643
    stream := self validateFile:(nativeContext receiver).
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1644
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1645
    "/ should always be bytes
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1646
    bytes class isBytes ifFalse:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1647
        self halt.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1648
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1649
    stream == Stdin ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1650
        self halt:'reading from standardInput ...'.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1651
        ^ 0
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1652
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1653
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1654
    FileIOTrace ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1655
        ('JAVA: read ' , count printString , ' bytes from ' , stream pathName) infoPrintCR.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1656
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1657
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1658
    stream isPositionable ifFalse:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1659
        "/ mhmh - some kind of socket or pipe
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1660
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1661
        stream readWait.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1662
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1663
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1664
    Stream readErrorSignal handle:[:ex |
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1665
        nRead := -1
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1666
    ] do:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1667
        nRead := stream nextAvailableBytes:count into:bytes startingAt:offset+1.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1668
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1669
    nRead == 0 ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1670
        stream atEnd ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1671
            FileIOTrace ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1672
                ('JAVA: at EOF ' , nRead printString) infoPrintCR.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1673
            ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1674
            ^ -1
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1675
        ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1676
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1677
    count ~~ nRead ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1678
        FileIOTrace ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1679
            ('JAVA: only got ' , nRead printString) infoPrintCR.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1680
        ]
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1681
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1682
    ^ nRead
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1683
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1684
    "Created: / 4.2.1998 / 15:20:00 / cg"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1685
    "Modified: / 4.2.1998 / 19:42:40 / cg"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1686
!
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1687
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1688
anyStream_writeBytes:nativeContext
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1689
    |bytes offset count stream|
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1690
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1691
    bytes := nativeContext argAt:1.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1692
    offset := nativeContext argAt:2.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1693
    count := nativeContext argAt:3.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1694
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1695
    stream := self validateFile:(nativeContext receiver).
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1696
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1697
    FileIOTrace ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1698
        stream isFileStream ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1699
            ('JAVA: write ' , count printString , ' bytes to ' , stream pathName) infoPrintCR.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1700
        ] ifFalse:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1701
            stream ~~ Stdout ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1702
                stream ~~ Stderr ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1703
                    ('JAVA: write ' , count printString , ' bytes to ' , stream displayString) infoPrintCR.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1704
                ]
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1705
            ]
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1706
        ]
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1707
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1708
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1709
    "/ should always be bytes
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1710
    Stream writeErrorSignal handle:[:ex |
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1711
        ex return
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1712
    ] do:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1713
        Socket brokenConnectionSignal handle:[:ex |
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1714
            ex return
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1715
        ] do:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1716
            stream nextPutBytes:count from:bytes startingAt:offset+1
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1717
        ]
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1718
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1719
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1720
    "Created: / 4.2.1998 / 15:23:58 / cg"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1721
    "Modified: / 4.2.1998 / 19:38:26 / cg"
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1722
!
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1723
331
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1724
commonOpen:nativeContext forAppend:forAppend
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1725
    |fs fd fn name dir stream fileNo|
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1726
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1727
    fs := nativeContext receiver.
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1728
    fd := fs instVarNamed:'fd'.
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1729
    (fd instVarNamed:'fd') ~~ 0 ifTrue:[
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1730
        self halt:'file already open'.
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1731
        self internalError:'file already open'.
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1732
        ^ self.
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1733
    ].
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1734
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1735
    name := nativeContext argAt:1.
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1736
    name := Java as_ST_String:name.
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1737
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1738
    FileOpenTrace ifTrue:[
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1739
        ('JAVA: opening ' , name) infoPrintCR.
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1740
    ].
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1741
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1742
    fn := name asFilename.
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1743
    dir := fn directory pathName.
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1744
    (PermittedDirectories notNil
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1745
    and:[PermittedDirectories includes:dir]) ifFalse:[
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1746
        FileOpenConfirmation ifTrue:[
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1747
            (self confirm:('JAVA Security check\\Opening ''' , name , ''' for writing.\Grant permission ?') withCRs)
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1748
            ifFalse:[
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1749
                self throwIOExceptionWithMessage:('no permission to open ' , name , ' for writing').
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1750
                ^ self
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1751
            ].
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1752
            (self confirm:('JAVA Security check\\Always permit writes in this directory (''' , dir , ''') ?') withCRs)
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1753
            ifTrue:[
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1754
                PermittedDirectories isNil ifTrue:[
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1755
                    PermittedDirectories := Set new
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1756
                ].
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1757
                PermittedDirectories add:dir.
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1758
            ]
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1759
        ]
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1760
    ].
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1761
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1762
    forAppend ifTrue:[
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1763
        stream := fn appendingWriteStream.
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1764
    ] ifFalse:[
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1765
        stream := fn writeStream.
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1766
    ].
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1767
    stream isNil ifTrue:[
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1768
        self throwIOExceptionWithMessage:('cannot open ' , name , ' for writing').
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1769
    ].
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1770
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1771
    fileNo := self addOpenFile:stream.
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1772
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1773
    FileOpenTrace ifTrue:[
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1774
        ('JAVA: opened ' , name , ' as FD ' , fileNo printString , ' for writing') infoPrintCR.
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1775
    ].
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1776
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1777
    fd instVarNamed:'fd' put:fileNo.
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1778
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1779
    "Created: / 7.4.1998 / 19:14:09 / cg"
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1780
    "Modified: / 7.4.1998 / 19:19:21 / cg"
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1781
!
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  1782
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1783
fileStreamForReading:name
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1784
    |fn stream tryAlongClassPath|
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1785
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1786
    fn := name asFilename.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1787
    stream := fn readStream.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1788
    stream notNil ifTrue:[^ stream].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1789
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1790
    fn isAbsolute ifFalse:[
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1791
	"/ if not absolute, try along classPath
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1792
	"/ This allows classes to open local files (JEdit)
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1793
	"/ even if they have NOT been loaded by a Java classLoader.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1794
	"/ Only do this for image files 
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1795
	"/ (and maybe some other config files in the future),
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1796
	"/ to avoid security holes.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1797
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1798
	tryAlongClassPath := false.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1799
	(fn hasSuffix:'gif') ifTrue:[
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1800
	    tryAlongClassPath := true.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1801
	].
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1802
	(fn hasSuffix:'jpg') ifTrue:[
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1803
	    tryAlongClassPath := true.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1804
	].
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1805
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1806
	tryAlongClassPath ifTrue:[
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1807
	    Java classPath do:[:dirName |
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1808
		|fn|
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1809
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1810
		(fn := dirName asFilename construct:name) exists ifTrue:[
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1811
		    stream := fn readStream.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1812
		    stream notNil ifTrue:[^ stream].
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1813
		]
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1814
	    ]
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  1815
	]
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1816
    ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1817
    ^ nil.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1818
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1819
    "Modified: / 15.1.1998 / 13:01:34 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1820
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1821
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1822
validateFile:javaStream
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1823
    |fileNo file descriptor|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1824
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1825
    fileNo := self validateFileNo:javaStream.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1826
    fileNo isNil ifTrue:[
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1827
"/        self halt:'invalid fileNo in read'.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1828
"/        self internalError:'invalid fileNo in read'.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1829
	self throwIOExceptionWithMessage:'invalid fileNo in read'.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1830
	^ nil
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1831
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1832
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1833
    file := self getOpenFileAt:fileNo.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1834
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1835
    file isNil ifTrue:[
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1836
"/        self halt:'invalid fileNo in read'.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1837
"/        self internalError:'invalid fileNo in read'.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1838
	self throwIOExceptionWithMessage:'invalid fileNo in read'.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1839
	^ nil
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1840
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1841
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1842
    ^ file
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1843
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1844
    "Created: / 4.1.1998 / 16:50:38 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1845
    "Modified: / 4.1.1998 / 17:50:00 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1846
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1847
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1848
validateFileNo:javaStream
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1849
    |fileNo file descriptor|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1850
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1851
    "/ JDK 1.1.3 has fileDescriptor wrapped
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1852
    "/ JDK 1.0 has it directly as integer
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1853
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1854
    fileNo := javaStream instVarNamed:'fd'.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1855
    fileNo isInteger ifFalse:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1856
	descriptor := fileNo.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1857
	fileNo := descriptor instVarNamed:'fd'.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1858
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1859
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1860
    fileNo isInteger ifFalse:[
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1861
"/        self halt:'invalid fileNo in read'.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1862
"/        self internalError:'invalid fileNo in read'.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1863
	self throwIOExceptionWithMessage:'invalid fileNo in read'.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1864
	^ nil
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1865
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1866
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1867
    ^ fileNo.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1868
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1869
    "Created: / 4.1.1998 / 17:49:08 / cg"
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1870
    "Modified: / 13.1.1998 / 14:07:47 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1871
! !
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1872
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1873
!JavaVM class methodsFor:'native - java.io'!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1874
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1875
_FileDescriptor_initSystemFD:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1876
    |descriptor fileNo idx myStream|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1877
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1878
    descriptor := nativeContext argAt:1.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1879
    fileNo := nativeContext argAt:2.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1880
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1881
    fileNo == 0 ifTrue:[
277
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1882
        myStream := Stdin
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1883
    ] ifFalse:[
277
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1884
        fileNo == 1 ifTrue:[
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1885
           myStream := JavaConsoleStream ? Stdout
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1886
        ] ifFalse:[
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1887
            fileNo == 2 ifTrue:[
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1888
                myStream := JavaConsoleStream ? Stderr
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1889
            ] ifFalse:[
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1890
                self halt:'invalid fileNo given'.
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1891
                self internalError:'invalid fileNo given'.
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1892
            ]
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1893
        ]
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1894
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1895
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1896
    self setOpenFile:myStream at:fileNo.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1897
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1898
    descriptor instVarNamed:'fd' put:fileNo.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1899
    ^ descriptor
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1900
277
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1901
    "Modified: / 27.1.1998 / 18:15:28 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1902
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1903
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1904
_FileInputStream_available:nativeContext
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1905
    |file|
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1906
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1907
    file := self validateFile:(nativeContext receiver).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1908
    file isNil ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1909
	self throwIOExceptionWithMessage:'invalid fileNo in available'.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1910
	^ self
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1911
    ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1912
    file isFileStream ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1913
	^ file size - file position + 1
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1914
    ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1915
    file atEnd ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1916
	^ 0.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1917
    ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1918
    self halt.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1919
    ^ 1
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1920
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1921
    "Modified: / 14.1.1998 / 15:12:52 / cg"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1922
!
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1923
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1924
_FileInputStream_close:nativeContext
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1925
    ^ self anyStream_close:nativeContext
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1926
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1927
    "Created: / 4.1.1998 / 17:45:23 / cg"
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  1928
    "Modified: / 4.2.1998 / 15:20:46 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1929
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1930
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1931
_FileInputStream_open:nativeContext
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1932
    |fs fd fn name stream fileNo|
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1933
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1934
    fs := nativeContext receiver.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1935
    fd := fs instVarNamed:'fd'.
277
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1936
    (fileNo := fd instVarNamed:'fd') ~~ 0 ifTrue:[
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1937
        fileNo ~~ -1 ifTrue:[
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1938
            self halt:'file already open'.
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1939
            self internalError:'file already open'.
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1940
            ^ self.
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1941
        ]
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1942
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1943
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1944
    name := nativeContext argAt:1.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1945
    name := Java as_ST_String:name.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1946
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1947
    FileOpenTrace ifTrue:[
277
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1948
        ('JAVA: opening ' , name) infoPrintCR.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1949
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1950
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1951
    stream := self fileStreamForReading:name.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1952
    stream isNil ifTrue:[
277
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1953
        FileOpenTrace ifTrue:[
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1954
            ('JAVA: failed to open ' , name , ' for reading.') infoPrintCR.
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1955
        ].
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1956
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1957
        self throwIOExceptionWithMessage:('cannot open ' , name , ' for reading').
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1958
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1959
        ^ self.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1960
    ].
304
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  1961
    stream buffered:false.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1962
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1963
"/    FileOpenConfirmation ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1964
"/        (self confirm:('JAVA Security check\\Opening ''' , name , ''' for reading.\Grant permission ?') withCRs)
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1965
"/        ifFalse:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1966
"/            self throwIOExceptionWithMessage:('no permission to open ' , name , ' for reading').
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1967
"/            ^ self
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1968
"/        ]
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1969
"/    ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1970
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1971
    fileNo := self addOpenFile:stream.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1972
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1973
    FileOpenTrace ifTrue:[
277
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  1974
        ('JAVA: opened ' , name , ' as FD ' , fileNo printString) infoPrintCR.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1975
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1976
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1977
    fd instVarNamed:'fd' put:fileNo.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1978
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1979
    "Created: / 4.1.1998 / 16:47:12 / cg"
304
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  1980
    "Modified: / 1.2.1998 / 20:35:16 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1981
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1982
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1983
_FileInputStream_read:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1984
    |file byte|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1985
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1986
    file := self validateFile:(nativeContext receiver).
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1987
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1988
    FileIOTrace ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1989
	('JAVA: read 1 byte from ' , file pathName) infoPrintCR.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1990
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1991
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1992
    byte := file nextByte.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1993
    byte isNil ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  1994
	^ -1
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1995
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1996
    ^ byte
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1997
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1998
    "Created: / 5.1.1998 / 02:17:08 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  1999
    "Modified: / 5.1.1998 / 02:17:25 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2000
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2001
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2002
_FileInputStream_readBytes:nativeContext
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2003
    ^ self anyStream_readBytes:nativeContext
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2004
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2005
    "Modified: / 4.2.1998 / 15:23:08 / cg"
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2006
!
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2007
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2008
_FileOutputStream_close:nativeContext
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2009
    ^ self anyStream_close:nativeContext
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2010
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2011
    "Created: / 13.1.1998 / 09:33:16 / cg"
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2012
    "Modified: / 4.2.1998 / 15:20:53 / cg"
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2013
!
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2014
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2015
_FileOutputStream_open:nativeContext
331
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  2016
    ^ self commonOpen:nativeContext forAppend:false
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  2017
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  2018
    "Modified: / 7.4.1998 / 19:14:31 / cg"
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  2019
!
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  2020
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  2021
_FileOutputStream_openAppend:nativeContext
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  2022
    ^ self commonOpen:nativeContext forAppend:true
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  2023
2c319ce4ac92 checkin from browser
cg
parents: 329
diff changeset
  2024
    "Modified: / 7.4.1998 / 19:13:42 / cg"
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2025
!
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2026
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2027
_FileOutputStream_write:nativeContext
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2028
    |byte file|
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2029
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2030
    byte := nativeContext argAt:1.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2031
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2032
    file := self validateFile:(nativeContext receiver).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2033
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2034
    FileIOTrace ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2035
	file isFileStream ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2036
	    ('JAVA: write 1 byte to ' , file pathName) infoPrintCR.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2037
	] ifFalse:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2038
	    file ~~ Stdout ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2039
		file ~~ Stderr ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2040
		    ('JAVA: write 1 byte to ' , file displayString) infoPrintCR.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2041
		]
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2042
	    ]
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2043
	]
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2044
    ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2045
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2046
    "/ should always be bytes
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2047
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2048
    file nextPutByte:byte
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2049
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2050
    "Created: / 13.1.1998 / 09:32:13 / cg"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2051
    "Modified: / 13.1.1998 / 09:32:31 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2052
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2053
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2054
_FileOutputStream_writeBytes:nativeContext
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2055
    ^ self anyStream_writeBytes:nativeContext
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2056
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2057
    "Modified: / 4.2.1998 / 15:24:20 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2058
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2059
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2060
_File_canRead0:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2061
    |file path f|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2062
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2063
    file := nativeContext receiver.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2064
    path := file instVarNamed:'path'.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2065
    path notNil ifTrue:[
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2066
	path := Java as_ST_String:path.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2067
	(f := path asFilename) isReadable ifTrue:[
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2068
	    ^ 1 "/ TRUE
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2069
	]
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2070
    ].
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2071
    ^ 0 "/ FALSE
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2072
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2073
    "Created: / 4.1.1998 / 18:09:55 / cg"
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2074
    "Modified: / 15.1.1998 / 12:10:34 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2075
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2076
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2077
_File_canWrite0:nativeContext
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2078
    |file path f|
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2079
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2080
    file := nativeContext receiver.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2081
    path := file instVarNamed:'path'.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2082
    path notNil ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2083
        path := Java as_ST_String:path.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2084
        (f := path asFilename) isWritable ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2085
            ^ 1 "/ TRUE
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2086
        ]
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2087
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2088
    ^ 0 "/ FALSE
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2089
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2090
    "Modified: / 15.1.1998 / 12:10:34 / cg"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2091
    "Created: / 4.2.1998 / 00:19:55 / cg"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2092
!
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2093
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2094
_File_exists0:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2095
    |file path f|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2096
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2097
    file := nativeContext receiver.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2098
    path := file instVarNamed:'path'.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2099
    path notNil ifTrue:[
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2100
	path := Java as_ST_String:path.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2101
	(f := path asFilename) exists ifTrue:[
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2102
	    ^ 1 "TRUE"
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2103
	]
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2104
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2105
    ^ 0 "FALSE"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2106
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2107
    "Created: / 5.1.1998 / 02:07:48 / cg"
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2108
    "Modified: / 15.1.1998 / 12:10:27 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2109
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2110
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2111
_File_isAbsolute:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2112
    |file path f|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2113
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2114
    file := nativeContext receiver.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2115
    path := file instVarNamed:'path'.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2116
    path notNil ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2117
	path := Java as_ST_String:path.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2118
	(f := path asFilename) isAbsolute ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2119
	    ^ 1 "/ TRUE
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2120
	]
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2121
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2122
    ^ 0 "/ FALSE
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2123
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2124
    "Modified: / 8.8.1997 / 12:04:05 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2125
    "Created: / 11.1.1998 / 09:54:38 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2126
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2127
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2128
_File_isDirectory0:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2129
    |file path f|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2130
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2131
    file := nativeContext receiver.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2132
    path := file instVarNamed:'path'.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2133
    path notNil ifTrue:[
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2134
	path := Java as_ST_String:path.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2135
	(f := path asFilename) exists ifTrue:[
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2136
	    f isDirectory ifTrue:[^ 1 "TRUE"]
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2137
	]
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2138
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2139
    ^ 0 "FALSE"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2140
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2141
    "Created: / 7.1.1998 / 10:31:37 / cg"
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2142
    "Modified: / 15.1.1998 / 12:10:20 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2143
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2144
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2145
_File_isFile0:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2146
    |file path f|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2147
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2148
    file := nativeContext receiver.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2149
    path := file instVarNamed:'path'.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2150
    path notNil ifTrue:[
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2151
	path := Java as_ST_String:path.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2152
	(f := path asFilename) exists ifTrue:[
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2153
	    f isDirectory ifFalse:[^ 1 "TRUE"]
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2154
	]
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2155
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2156
    ^ 0 "/ FALSE
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2157
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2158
    "Created: / 11.1.1998 / 11:40:22 / cg"
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2159
    "Modified: / 15.1.1998 / 12:10:13 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2160
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2161
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2162
_File_lastModified0:nativeContext
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2163
    |file path f|
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2164
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2165
    file := nativeContext receiver.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2166
    path := file instVarNamed:'path'.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2167
    path notNil ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2168
        path := Java as_ST_String:path.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2169
        (f := path asFilename) exists ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2170
            ^ f modificationTime getMilliseconds.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2171
        ]
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2172
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2173
    ^ 0
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2174
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2175
    "Modified: / 8.8.1997 / 12:04:13 / cg"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2176
    "Created: / 4.2.1998 / 16:50:30 / cg"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2177
!
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2178
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2179
_File_length0:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2180
    |file path f|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2181
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2182
    file := nativeContext receiver.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2183
    path := file instVarNamed:'path'.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2184
    path notNil ifTrue:[
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2185
	path := Java as_ST_String:path.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2186
	(f := path asFilename) exists ifTrue:[
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2187
	    ^ f fileSize
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2188
	]
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2189
    ].
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2190
    ^ -1
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2191
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2192
    "Created: / 7.1.1998 / 12:18:57 / cg"
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2193
    "Modified: / 15.1.1998 / 12:10:06 / cg"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2194
!
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2195
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2196
_File_list0:nativeContext
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2197
    |file path f files|
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2198
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2199
    file := nativeContext receiver.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2200
    path := file instVarNamed:'path'.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2201
    path notNil ifTrue:[
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2202
	path := Java as_ST_String:path.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2203
	(f := path asFilename) exists ifTrue:[
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2204
	    f isDirectory ifTrue:[
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2205
		files := f directoryContents asArray.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2206
		files := files collect:[:nm | Java as_String:nm].
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2207
		^ files
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2208
	    ]
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2209
	]
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2210
    ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2211
    ^ nil
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2212
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2213
    "Created: / 14.1.1998 / 21:30:22 / cg"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2214
    "Modified: / 14.1.1998 / 21:32:09 / cg"
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2215
!
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2216
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2217
_File_mkdir0:nativeContext
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2218
    |file path f|
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2219
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2220
    file := nativeContext receiver.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2221
    path := file instVarNamed:'path'.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2222
    path notNil ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2223
        path := Java as_ST_String:path.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2224
        FileOpenConfirmation ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2225
            (self confirm:('JAVA Security check\\Create directory ''' , path , '''.\Grant permission ?') withCRs)
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2226
            ifFalse:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2227
                ^ 0 "/ FALSE
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2228
            ]
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2229
        ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2230
        f := path asFilename.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2231
        OperatingSystem accessDeniedErrorSignal handle:[:ex |
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2232
            ^ 0 "/ FALSE
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2233
        ] do:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2234
            f makeDirectory.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2235
        ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2236
        f  exists ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2237
            f isDirectory ifTrue:[^ 1 "TRUE"]
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2238
        ]
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2239
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2240
    ^ 0 "FALSE"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2241
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2242
    "Modified: / 15.1.1998 / 12:10:20 / cg"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2243
    "Created: / 4.2.1998 / 00:19:05 / cg"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2244
!
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2245
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2246
_RandomAccessFile_close:nativeContext
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2247
    ^ self anyStream_close:nativeContext
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2248
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2249
    "Created: / 4.2.1998 / 13:26:53 / cg"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2250
    "Modified: / 4.2.1998 / 15:21:08 / cg"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2251
!
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2252
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2253
_RandomAccessFile_length:nativeContext
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2254
    |file sz|
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2255
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2256
    file := self validateFile:(nativeContext receiver).
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2257
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2258
    FileIOTrace ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2259
        ('JAVA: length of ' , file pathName) infoPrintCR.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2260
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2261
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2262
    sz := file size.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2263
    ^ sz.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2264
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2265
    "Created: / 4.2.1998 / 13:27:58 / cg"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2266
!
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2267
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2268
_RandomAccessFile_open:nativeContext
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2269
    |fs fd name dir stream fileNo|
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2270
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2271
    fs := nativeContext receiver.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2272
    fd := fs instVarNamed:'fd'.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2273
    (fd instVarNamed:'fd') ~~ 0 ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2274
        self halt:'file already open'.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2275
        self internalError:'file already open'.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2276
        ^ self.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2277
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2278
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2279
    name := nativeContext argAt:1.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2280
    name := Java as_ST_String:name.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2281
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2282
    FileOpenTrace ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2283
        ('JAVA: opening ' , name) infoPrintCR.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2284
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2285
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2286
    dir := name asFilename directory pathName.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2287
    (PermittedDirectories notNil
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2288
    and:[PermittedDirectories includes:dir]) ifFalse:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2289
        FileOpenConfirmation ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2290
            (self confirm:('JAVA Security check\\Opening ''' , name , ''' for read/write.\Grant permission ?') withCRs)
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2291
            ifFalse:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2292
                self throwIOExceptionWithMessage:('no permission to open ' , name , ' for writing').
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2293
                ^ self
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2294
            ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2295
            (self confirm:('JAVA Security check\\Always permit writes in this directory (''' , dir , ''') ?') withCRs)
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2296
            ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2297
                PermittedDirectories isNil ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2298
                    PermittedDirectories := Set new
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2299
                ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2300
                PermittedDirectories add:dir.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2301
            ]
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2302
        ]
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2303
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2304
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2305
    stream := name asFilename readWriteStream.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2306
    stream isNil ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2307
        self throwIOExceptionWithMessage:('cannot open ' , name , ' for writing').
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2308
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2309
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2310
    fileNo := self addOpenFile:stream.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2311
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2312
    FileOpenTrace ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2313
        ('JAVA: opened ' , name , ' as FD ' , fileNo printString , ' for writing') infoPrintCR.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2314
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2315
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2316
    fd instVarNamed:'fd' put:fileNo.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2317
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2318
    "Created: / 4.2.1998 / 00:14:48 / cg"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2319
    "Modified: / 4.2.1998 / 17:15:55 / cg"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2320
!
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2321
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2322
_RandomAccessFile_readBytes:nativeContext
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2323
    ^ self anyStream_readBytes:nativeContext
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2324
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2325
    "Modified: / 4.2.1998 / 15:23:27 / cg"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2326
!
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2327
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2328
_RandomAccessFile_seek:nativeContext
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2329
    |file pos|
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2330
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2331
    file := self validateFile:(nativeContext receiver).
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2332
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2333
    FileIOTrace ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2334
        ('JAVA: seek on ' , file pathName) infoPrintCR.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2335
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2336
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2337
    pos := nativeContext argAt:1.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2338
    file position:pos+1 "/ ST/X position starts at 1
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2339
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2340
    "Created: / 4.2.1998 / 13:25:38 / cg"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2341
    "Modified: / 4.2.1998 / 13:28:12 / cg"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2342
!
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2343
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2344
_RandomAccessFile_writeBytes:nativeContext
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2345
    ^ self anyStream_writeBytes:nativeContext
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2346
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2347
    "Modified: / 4.2.1998 / 15:24:20 / cg"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2348
    "Created: / 4.2.1998 / 15:24:35 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2349
! !
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2350
277
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2351
!JavaVM class methodsFor:'native - java.io - jdk1.2'!
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2352
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2353
_FileDescriptor_initIDs:nativeContext
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2354
    "/ introduced with jdk1.2 ... (sigh)
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2355
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2356
    "Created: / 27.1.1998 / 18:16:29 / cg"
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2357
!
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2358
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2359
_FileInputStream_initIDs:nativeContext
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2360
    "/ introduced with jdk1.2 ... (sigh)
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2361
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2362
    "Created: / 27.1.1998 / 18:15:51 / cg"
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2363
!
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2364
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2365
_FileOutputStream_initIDs:nativeContext
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2366
    "/ introduced with jdk1.2 ... (sigh)
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2367
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2368
    "Created: / 27.1.1998 / 18:16:40 / cg"
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2369
!
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2370
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2371
_File_canonPath:nativeContext
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2372
    "/ introduced with jdk1.2 ... (sigh)
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2373
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2374
    |jPath path realPath|
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2375
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2376
    jPath := nativeContext argAt:1.
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2377
    jPath isNil ifTrue:[^ jPath].
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2378
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2379
    path := Java as_ST_String:jPath.
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2380
    realPath := path asFilename pathName.
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2381
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2382
    ^ Java as_String:realPath
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2383
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2384
    "Created: / 27.1.1998 / 18:35:58 / cg"
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2385
    "Modified: / 27.1.1998 / 21:36:03 / cg"
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2386
!
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2387
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2388
_File_initIDs:nativeContext
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2389
    "/ introduced with jdk1.2 ... (sigh)
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2390
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2391
    "Created: / 27.1.1998 / 18:25:19 / cg"
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2392
! !
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2393
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2394
!JavaVM class methodsFor:'native - java.lang'!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2395
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2396
_ClassLoader_defineClass0:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2397
    "create a new class from a given byteArray.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2398
     Here, construct a stream on it and pass the work to the
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2399
     JavaClassReader."
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2400
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2401
    |jClassLoader jName name data offset length inStream newClass
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2402
     loaderStub jClass|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2403
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2404
    jClassLoader := nativeContext receiver.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2405
    jName := nativeContext argAt:1.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2406
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2407
    "/ className is now optional ...
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2408
"/    jName isNil ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2409
"/        self internalError:'nil name in defineClass'.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2410
"/        ^ nil
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2411
"/    ] ifFalse:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2412
"/        name := Java as_ST_String:jName.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2413
"/    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2414
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2415
    data := nativeContext argAt:2.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2416
    offset := nativeContext argAt:3.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2417
    length := nativeContext argAt:4.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2418
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2419
    inStream := data readStream.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2420
    inStream position:offset + 1.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2421
    inStream readLimit:(offset + length).
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2422
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2423
"/    loaderStub := Plug new.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2424
"/    loaderStub respondTo:#loadClass: with:[:clsName |
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2425
"/                                                |jName|
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2426
"/
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2427
"/self halt.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2428
"/                                                jName := Java as_String:clsName.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2429
"/                                                "/ jClassLoader loadClass:jName
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2430
"/                                                jClassLoader 
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2431
"/                                                    perform:#'loadClass(Ljava/lang/String;)Ljava/lang/Class;'
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2432
"/                                                    with:jName.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2433
"/                                          ].
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2434
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2435
    ('JAVA: defining class ...') infoPrintCR.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2436
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2437
"/    self internalError:'break'.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2438
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2439
    newClass := JavaClassReader 
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2440
		    readStream:inStream 
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2441
		    loader:jClassLoader "loaderStub"
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2442
		    loadUnresolved:false.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2443
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2444
newClass isNil ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2445
    ('JAVA: defineClass failed') infoPrintCR.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2446
    ^ nil.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2447
].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2448
    Transcript showCR:('defined class ' , newClass fullName , '.').
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2449
    newClass classLoader:jClassLoader.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2450
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2451
    ('Java: defined new class: ' , newClass fullName) infoPrintCR.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2452
268
f7357f1142c8 provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents: 266
diff changeset
  2453
    jClass := self javaClassObjectForClass:newClass.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2454
    ^ jClass
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2455
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2456
    "Created: / 7.1.1998 / 12:35:10 / cg"
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  2457
    "Modified: / 24.1.1998 / 15:26:21 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2458
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2459
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2460
_ClassLoader_findSystemClass0:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2461
    |loader name class jClass|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2462
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2463
    loader := nativeContext receiver.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2464
    name := nativeContext argAt:1.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2465
    name := Java as_ST_String:name.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2466
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  2467
"/    ('JAVA: findSystemClass0 for ' , name , ' loader is ' , loader displayString) infoPrintCR.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2468
    loader class == (Java classForName:'java.util.SystemClassLoader') ifTrue:[
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  2469
        Java classForName:name.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2470
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2471
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2472
"/    JavaClassReader classLoaderQuerySignal answer:nil "loader"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2473
"/    do:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2474
"/        class := Java classForName:name.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2475
"/        JavaClassReader postLoadActions:true.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2476
"/    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2477
    class := Java at:name.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2478
    (class isNil 
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2479
    "or:[class classLoader notNil]") ifTrue:[
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2480
"/        self halt:'class: ' , name , ' not found.'.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2481
"/        self internalError:'class: ' , name , ' not found.'.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2482
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  2483
        self 
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  2484
            throwExceptionClassName:'java.lang.ClassNotFoundException'
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  2485
            withMessage:'class: ' , name , ' not found.'.
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  2486
        ^ nil
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  2487
    ].
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  2488
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  2489
"/    '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
  2490
    jClass := self javaClassObjectForClass:class.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2491
    ^ jClass
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2492
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2493
    "Created: / 5.1.1998 / 02:53:04 / cg"
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  2494
    "Modified: / 6.2.1998 / 02:16:50 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2495
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2496
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2497
_ClassLoader_getSystemResourceAsStream0:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2498
    |jString rString dir file text data inStream|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2499
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2500
    jString := nativeContext argAt:1.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2501
    rString := Java as_ST_String:jString.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2502
    Java classPath do:[:aPath |
277
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2503
        (dir := aPath asFilename) exists ifTrue:[
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2504
            (file := dir construct:rString) exists ifTrue:[
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2505
                (Java isExcludedFromClassPath:file) ifFalse:[
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2506
                    text := file contents asString.
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2507
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2508
                    "/ Copy data from returned buffer into Java byte array. 
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2509
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2510
                    data := text asByteArray.
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2511
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2512
                    "/ Create input stream using byte array 
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2513
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2514
                    inStream := (Java classForName:'java.io.ByteArrayInputStream') basicNew.
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2515
                    inStream invoke:'<init>([B)V' with:data.
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2516
                    ^ inStream.
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2517
                ]
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2518
            ]
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2519
        ]
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2520
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2521
    ^ nil
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2522
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2523
    "Created: / 8.1.1998 / 16:06:56 / cg"
277
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  2524
    "Modified: / 27.1.1998 / 21:58:54 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2525
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2526
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2527
_ClassLoader_init:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2528
     ^ nil
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2529
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2530
    "Created: / 5.1.1998 / 02:04:43 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2531
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2532
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2533
_ClassLoader_resolveClass0:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2534
    "resolve a new class as previously created by defineClass0"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2535
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2536
    |jClassLoader jCls cls loaderStub|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2537
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2538
    jClassLoader := nativeContext receiver.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2539
    jCls := nativeContext argAt:1.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2540
    jCls isNil ifTrue:[
361
466623e0a2d6 with private classLoader - also try using standard loader
cg
parents: 359
diff changeset
  2541
        self halt.
466623e0a2d6 with private classLoader - also try using standard loader
cg
parents: 359
diff changeset
  2542
        ^ nil
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2543
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2544
    cls := JavaClasses at:jCls ifAbsent:nil.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2545
    cls isNil ifTrue:[
361
466623e0a2d6 with private classLoader - also try using standard loader
cg
parents: 359
diff changeset
  2546
        self halt.
466623e0a2d6 with private classLoader - also try using standard loader
cg
parents: 359
diff changeset
  2547
        ^ nil
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2548
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2549
    Transcript showCR:('resolving class ' , cls fullName , ' ...').
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2550
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2551
    JavaClassReader classLoaderQuerySignal answer:jClassLoader 
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2552
    do:[
361
466623e0a2d6 with private classLoader - also try using standard loader
cg
parents: 359
diff changeset
  2553
        JavaClassReader postLoadActions:true.
466623e0a2d6 with private classLoader - also try using standard loader
cg
parents: 359
diff changeset
  2554
        cls constantPool do:[:entry |
466623e0a2d6 with private classLoader - also try using standard loader
cg
parents: 359
diff changeset
  2555
            (entry isMemberOf:JavaUnresolvedClassConstant) ifTrue:[
466623e0a2d6 with private classLoader - also try using standard loader
cg
parents: 359
diff changeset
  2556
                self halt:'debugHalt'.
466623e0a2d6 with private classLoader - also try using standard loader
cg
parents: 359
diff changeset
  2557
                entry preResolve.
466623e0a2d6 with private classLoader - also try using standard loader
cg
parents: 359
diff changeset
  2558
                self halt:'debugHalt'.
466623e0a2d6 with private classLoader - also try using standard loader
cg
parents: 359
diff changeset
  2559
            ]
466623e0a2d6 with private classLoader - also try using standard loader
cg
parents: 359
diff changeset
  2560
        ]
466623e0a2d6 with private classLoader - also try using standard loader
cg
parents: 359
diff changeset
  2561
    ].
466623e0a2d6 with private classLoader - also try using standard loader
cg
parents: 359
diff changeset
  2562
466623e0a2d6 with private classLoader - also try using standard loader
cg
parents: 359
diff changeset
  2563
    jClassLoader notNil ifTrue:[
466623e0a2d6 with private classLoader - also try using standard loader
cg
parents: 359
diff changeset
  2564
        "/ any unresolved left -> try resolving with standard loader
466623e0a2d6 with private classLoader - also try using standard loader
cg
parents: 359
diff changeset
  2565
        JavaClassReader classLoaderQuerySignal answer:nil 
466623e0a2d6 with private classLoader - also try using standard loader
cg
parents: 359
diff changeset
  2566
        do:[
466623e0a2d6 with private classLoader - also try using standard loader
cg
parents: 359
diff changeset
  2567
            JavaClassReader postLoadActions:true.
466623e0a2d6 with private classLoader - also try using standard loader
cg
parents: 359
diff changeset
  2568
            cls constantPool do:[:entry |
466623e0a2d6 with private classLoader - also try using standard loader
cg
parents: 359
diff changeset
  2569
                (entry isMemberOf:JavaUnresolvedClassConstant) ifTrue:[
466623e0a2d6 with private classLoader - also try using standard loader
cg
parents: 359
diff changeset
  2570
                    self halt:'debugHalt'.
466623e0a2d6 with private classLoader - also try using standard loader
cg
parents: 359
diff changeset
  2571
                    entry preResolve.
466623e0a2d6 with private classLoader - also try using standard loader
cg
parents: 359
diff changeset
  2572
                    self halt:'debugHalt'.
466623e0a2d6 with private classLoader - also try using standard loader
cg
parents: 359
diff changeset
  2573
                ]
466623e0a2d6 with private classLoader - also try using standard loader
cg
parents: 359
diff changeset
  2574
            ]
466623e0a2d6 with private classLoader - also try using standard loader
cg
parents: 359
diff changeset
  2575
        ]
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2576
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2577
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2578
    "Created: / 7.1.1998 / 13:12:27 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2579
    "Modified: / 8.1.1998 / 16:13:57 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2580
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2581
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2582
_Class_forName:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2583
    "get a java.lang.Class by name"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2584
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2585
    |jClassName className cls jClass s m c loader|
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2586
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2587
    jClassName := nativeContext argAt:1.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2588
    className := Java as_ST_String:jClassName.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2589
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2590
    (s := nativeContext sender) notNil ifTrue:[
347
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  2591
        (s isJavaContext) ifTrue:[
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2592
            c := s method javaClass.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2593
            loader := c classLoader.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2594
            loader isNil ifTrue:[
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2595
"/ self halt.
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2596
            ]
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2597
        ]
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2598
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2599
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2600
    JavaClassReader classLoaderQuerySignal answer:loader
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2601
    do:[
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2602
        cls := Java classForName:className.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2603
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2604
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2605
"/(className startsWith:'sun.awt') ifTrue:[self halt].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2606
"/('classForName: ' , className , ' -> ') print.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2607
"/cls notNil ifTrue:[cls fullName printCR] ifFalse:['nil' printCR].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2608
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2609
    cls isNil ifTrue:[
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2610
        ExceptionTrace ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2611
            self halt:'no such class:' , className.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2612
        ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2613
        self throwClassNotFoundException:className.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2614
        "/ not proceedable
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2615
        AbortSignal raise.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2616
        "/ not reached
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2617
        ^ self
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2618
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2619
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2620
    ^ self javaClassObjectForClass:cls.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2621
347
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  2622
    "Modified: / 8.5.1998 / 21:30:03 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2623
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2624
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2625
_Class_getClassLoader:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2626
    "get a classes loader"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2627
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2628
    |loader|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2629
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2630
    loader := JavaClassReader classLoaderQuerySignal raise.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2631
    ('JAVA: getClassLoader - ' , loader printString) infoPrintCR.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2632
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2633
    "/ self unimplementedNativeMethod.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2634
    ^ loader
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2635
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2636
    "Modified: / 21.8.1997 / 16:32:02 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2637
    "Created: / 5.1.1998 / 02:51:59 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2638
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2639
321
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2640
_Class_getMethod0:nativeContext
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2641
    "get a method, given a name and type spec"
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2642
322
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2643
    |jClass cls jmName mName mTypes whichAccess argSig sel|
321
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2644
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2645
    jClass := nativeContext receiver.
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2646
    cls := JavaClasses at:jClass.
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2647
322
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2648
    jmName := nativeContext argAt:1.
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2649
    mName := Java as_ST_String:jmName.
321
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2650
    mTypes := nativeContext argAt:2.
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2651
    whichAccess := nativeContext argAt:3.
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2652
322
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2653
    argSig := JavaMethod argSignatureFromArgTypeArray:mTypes.
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2654
    cls methodDictionary keysAndValuesDo:[:sel :mthd |
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2655
        |i1 i2 jMethod|
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2656
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2657
        JavaMethods notNil ifTrue:[
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2658
            (jMethod := JavaMethods at:mthd ifAbsent:nil) notNil ifTrue:[
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2659
                ^ jMethod
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2660
            ]
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2661
        ].
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2662
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2663
        mthd name printCR.
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2664
        mName printCR.
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2665
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2666
        mthd name = mName ifTrue:[
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2667
            i1 := mthd signature indexOf:$(.
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2668
            i2 := mthd signature indexOf:$) startingAt:(i1+1).
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2669
            
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2670
            (mthd signature copyFrom:i1+1 to:i2-1) = argSig ifTrue:[
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2671
                "/ found it - create a java.lang.reflect.Method for it.
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2672
                jMethod := (Java at:'java.lang.reflect.Method') new.
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2673
                jMethod instVarNamed:'clazz' put:jClass.
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2674
                jMethod instVarNamed:'slot' put:sel.
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2675
                jMethod instVarNamed:'name' put:jmName.
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2676
                jMethod instVarNamed:'returnType' put:(self javaClassObjectForClass:mthd returnTypeClass).
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2677
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2678
                JavaMethods isNil ifTrue:[
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2679
                    JavaMethods := IdentityDictionary new
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2680
                ].
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2681
                JavaMethods at:jMethod put:mthd.
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2682
                JavaMethods at:mthd put:jMethod.
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2683
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2684
                ^ jMethod.
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2685
            ].
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2686
        ].
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2687
    ].
321
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2688
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2689
self halt.
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2690
    self 
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2691
        throwExceptionClassName:'java.lang.NoSuchMethodException'
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2692
        withMessage:'not yet implemented'.
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2693
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2694
    ^ nil.
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2695
322
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  2696
    "Modified: / 13.2.1998 / 15:23:07 / cg"
321
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2697
!
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2698
334
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2699
_Class_getMethods0:nativeContext
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2700
    "get a method, given a name and type spec"
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2701
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2702
    |jClass cls jmName mName mTypes whichAccess argSig sel 
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2703
     methods|
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2704
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2705
    jClass := nativeContext receiver.
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2706
    cls := JavaClasses at:jClass.
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2707
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2708
    "/ 0 = PUBLIC / 1 = ANY
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2709
    whichAccess := nativeContext argAt:1.
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2710
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2711
    methods := OrderedCollection new.
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2712
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2713
    cls methodDictionary keysAndValuesDo:[:sel :mthd |
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2714
        |i1 i2 jMethod retTypeClass|
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2715
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2716
        mthd name printCR.
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2717
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2718
        i1 := mthd signature indexOf:$(.
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2719
        i2 := mthd signature indexOf:$) startingAt:(i1+1).
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2720
        
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2721
        "/ create a java.lang.reflect.Method for it.
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2722
        jMethod := (Java at:'java.lang.reflect.Method') new.
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2723
        jMethod instVarNamed:'clazz' put:jClass.
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2724
        jMethod instVarNamed:'slot' put:sel.
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2725
        jMethod instVarNamed:'name' put:(Java as_String:mthd name).
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2726
        retTypeClass := mthd returnTypeClass.
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2727
        retTypeClass notNil ifTrue:[
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2728
            jMethod instVarNamed:'returnType' put:(self javaClassObjectForClass:retTypeClass).
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2729
        ].
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2730
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2731
        JavaMethods isNil ifTrue:[
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2732
            JavaMethods := IdentityDictionary new
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2733
        ].
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2734
        JavaMethods at:jMethod put:mthd.
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2735
        JavaMethods at:mthd put:jMethod.
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2736
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2737
        methods add:jMethod.
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2738
    ].
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2739
    methods := methods asArray.
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2740
self halt.
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2741
    ^ methods.
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2742
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2743
    "Modified: / 9.4.1998 / 17:42:35 / cg"
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2744
!
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  2745
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2746
_Class_getName:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2747
    "get a classes name"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2748
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2749
    |jClass cls|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2750
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2751
    jClass := nativeContext receiver.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2752
    cls := JavaClasses at:jClass.
359
bcad9c97d2e5 use #copyReplaceAll:with:
cg
parents: 347
diff changeset
  2753
    ^ Java as_String:(cls fullName copyReplaceAll:$/ with:$.).
bcad9c97d2e5 use #copyReplaceAll:with:
cg
parents: 347
diff changeset
  2754
bcad9c97d2e5 use #copyReplaceAll:with:
cg
parents: 347
diff changeset
  2755
    "Modified: / 18.7.1998 / 22:59:05 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2756
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2757
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2758
_Class_getPrimitiveClass:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2759
    "get a primitive class by name"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2760
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2761
    |jClassName className cls|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2762
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2763
    jClassName := nativeContext argAt:1.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2764
    className := Java as_ST_String:jClassName.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2765
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2766
    JavaClasses isNil ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2767
	self initializePrimitiveClasses
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2768
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2769
    cls := JavaClasses at:className.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2770
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2771
"/    cls := Java classForName:className.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2772
"/    cls isNil ifTrue:[
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2773
"/       cls := JavaClasses at:('JavaBase_' , className) asSymbol ifAbsent:nil.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2774
"/        #(
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2775
"/          'boolean' #Boolean
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2776
"/          'float'   #ShortFloat
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2777
"/          'double'  #Float
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2778
"/          'int'     #Integer
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2779
"/          'long'    #Integer
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2780
"/          'char'    #Character
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2781
"/          'short'   #Integer
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2782
"/          'byte'    #Integer
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2783
"/          'void'    #UndefinedObject
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2784
"/        ) pairWiseDo:[:nm :sym |
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2785
"/            className = nm ifTrue:[
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2786
"/                cls := Smalltalk at:sym.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2787
"/            ]
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2788
"/        ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2789
"/
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2790
"/        cls isNil ifTrue:[
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2791
"/            self internalError:'class: ' , className , ' not found.'.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2792
"/        ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2793
"/    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2794
    ^ cls
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2795
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2796
    "Created: / 4.1.1998 / 00:46:03 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2797
    "Modified: / 4.1.1998 / 01:12:27 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2798
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2799
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2800
_Class_getSuperclass:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2801
    "return a classes superclass"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2802
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2803
    |jClass cls superCls|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2804
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2805
    jClass := nativeContext receiver.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2806
    cls := JavaClasses at:jClass.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2807
    superCls := cls superclass.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2808
    superCls == JavaObject ifTrue:[
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2809
        ^ nil.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2810
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2811
    ^ self javaClassObjectForClass:superCls
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2812
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2813
    "Created: / 12.1.1998 / 12:38:36 / cg"
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  2814
    "Modified: / 4.2.1998 / 14:51:22 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2815
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2816
321
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2817
_Class_isInstance:nativeContext
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2818
    "return true, if something is an instance of a class.
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2819
     (i.e. same as instanceOf - builtin bytecode)"
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2820
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2821
    |jClass cls obj|
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2822
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2823
    obj := nativeContext argAt:1.
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2824
    obj isNil ifTrue:[^ 0 "FALSE"].
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2825
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2826
    jClass := nativeContext receiver.
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2827
    cls := JavaClasses at:jClass.
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2828
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2829
    (obj isMemberOf:cls) ifTrue:[^ 1 "TRUE"].
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2830
    (obj isKindOf:cls) ifTrue:[^ 1 "TRUE"].
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2831
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2832
    cls isBehavior ifTrue:[
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2833
        cls isInterface ifTrue:[
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2834
            (obj class hasInterface:cls) ifTrue:[
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2835
                ^ 1 "TRUE"
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2836
            ]
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2837
        ].
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2838
        ^ (obj isKindOf:cls) ifTrue:[1 "TRUE"] ifFalse:[0 "FALSE"]
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2839
    ].
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2840
    (cls isMemberOf:JavaClassPointerRef) ifTrue:[
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2841
        "/ must be a pointer to an array of that class
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2842
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2843
        ^ (obj isArray) ifTrue:[1 "TRUE"] ifFalse:[0 "FALSE"]
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2844
    ].
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2845
    (cls isMemberOf:JavaBuiltInClassPointerRef) ifTrue:[
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2846
        cls arrayClass == obj class ifTrue:[
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2847
            ^ 1 "TRUE"
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2848
        ].
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2849
    ].
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2850
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2851
    (obj isMemberOf:Array) ifTrue:[
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2852
        obj size == 0 ifTrue:[
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2853
            ^ 1 "TRUE"
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2854
        ].
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2855
        ^ (self _checkCast:(obj at:1) class:(cls deref))        
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2856
                 ifTrue:[1 "TRUE"] ifFalse:[0 "FALSE"]
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2857
    ].
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2858
    self halt.
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2859
    ^ 0 "FALSE".
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2860
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2861
    "Modified: / 9.2.1998 / 14:56:23 / cg"
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2862
!
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2863
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2864
_Class_isInterface:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2865
    "return true, if this class is an interface"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2866
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2867
    |jClass cls|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2868
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2869
    jClass := nativeContext receiver.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2870
    cls := JavaClasses at:jClass.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2871
    cls isInterface ifTrue:[^ 1 "TRUE"].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2872
    ^ 0 "FALSE"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2873
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2874
    "Created: / 12.1.1998 / 12:37:02 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2875
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2876
321
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2877
_Class_isPrimitive:nativeContext
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2878
    "return true, if this class is builtin primitive class
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2879
     (i.e. byteArray, array, string etc."
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2880
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2881
    |jClass cls|
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2882
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2883
    jClass := nativeContext receiver.
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2884
    cls := JavaClasses at:jClass.
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2885
    ^ 0 "FALSE"
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2886
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2887
    "Created: / 9.2.1998 / 14:46:07 / cg"
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2888
!
1fc4570fb914 preps for getMethod nativeCall
cg
parents: 319
diff changeset
  2889
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2890
_Class_newInstance:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2891
    "get an instance for a java.lang.Class"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2892
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2893
    |jClass cls newInst|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2894
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2895
    jClass := nativeContext receiver.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2896
    cls := JavaClasses at:jClass.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2897
    cls classInit.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2898
    newInst := cls newCleared.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2899
    newInst perform:#'<init>()V'.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2900
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2901
    ^ newInst
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2902
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2903
    "Created: / 2.1.1998 / 22:41:38 / cg"
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2904
    "Modified: / 15.1.1998 / 00:57:37 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2905
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2906
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2907
_Double_doubleToLongBits:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2908
    |f i|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2909
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2910
    f := nativeContext argAt:1.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2911
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2912
    UninterpretedBytes isBigEndian ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2913
	i := f basicAt:8. 
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2914
	i := i bitOr:((f basicAt:7) bitShift:8).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2915
	i := i bitOr:((f basicAt:6) bitShift:16).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2916
	i := i bitOr:((f basicAt:5) bitShift:24).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2917
	i := i bitOr:((f basicAt:4) bitShift:32).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2918
	i := i bitOr:((f basicAt:3) bitShift:40).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2919
	i := i bitOr:((f basicAt:2) bitShift:48).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2920
	i := i bitOr:((f basicAt:1) bitShift:56).
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2921
    ] ifFalse:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2922
	i := f basicAt:1. 
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2923
	i := i bitOr:((f basicAt:2) bitShift:8).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2924
	i := i bitOr:((f basicAt:3) bitShift:16).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2925
	i := i bitOr:((f basicAt:4) bitShift:24).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2926
	i := i bitOr:((f basicAt:5) bitShift:32).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2927
	i := i bitOr:((f basicAt:6) bitShift:40).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2928
	i := i bitOr:((f basicAt:7) bitShift:48).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2929
	i := i bitOr:((f basicAt:8) bitShift:56).
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2930
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2931
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2932
    ^ i.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2933
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2934
    "Created: / 4.1.1998 / 01:39:12 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2935
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2936
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2937
_Double_longBitsToDouble:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2938
    |i aFloat|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2939
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2940
    i := nativeContext argAt:1.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2941
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2942
    aFloat := Float new.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2943
    UninterpretedBytes isBigEndian ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2944
	aFloat basicAt:1 put:((i bitShift:-56) bitAnd:16rFF).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2945
	aFloat basicAt:2 put:((i bitShift:-48) bitAnd:16rFF).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2946
	aFloat basicAt:3 put:((i bitShift:-40) bitAnd:16rFF).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2947
	aFloat basicAt:4 put:((i bitShift:-32) bitAnd:16rFF).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2948
	aFloat basicAt:5 put:((i bitShift:-24) bitAnd:16rFF).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2949
	aFloat basicAt:6 put:((i bitShift:-16) bitAnd:16rFF).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2950
	aFloat basicAt:7 put:((i bitShift:-8) bitAnd:16rFF).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2951
	aFloat basicAt:8 put:(i bitAnd:16rFF).
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2952
    ] ifFalse:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2953
	aFloat basicAt:1 put:(i bitAnd:16rFF).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2954
	aFloat basicAt:2 put:((i bitShift:-8) bitAnd:16rFF).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2955
	aFloat basicAt:3 put:((i bitShift:-16) bitAnd:16rFF).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2956
	aFloat basicAt:4 put:((i bitShift:-24) bitAnd:16rFF).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2957
	aFloat basicAt:5 put:((i bitShift:-32) bitAnd:16rFF).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2958
	aFloat basicAt:6 put:((i bitShift:-40) bitAnd:16rFF).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2959
	aFloat basicAt:7 put:((i bitShift:-48) bitAnd:16rFF).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2960
	aFloat basicAt:8 put:((i bitShift:-56) bitAnd:16rFF).
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2961
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2962
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2963
    ^ aFloat.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2964
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2965
    "Created: / 4.1.1998 / 01:45:00 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2966
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2967
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2968
_Double_valueOf0:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2969
    |s d|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2970
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2971
    s := nativeContext argAt:1.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2972
    s notNil ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2973
	s := Java as_ST_String:s.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2974
	d := Float readFrom:s onError:nil.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2975
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2976
    d isNil ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2977
	self throwNumberFormatException.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2978
	"/ not reached
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2979
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2980
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2981
    ^ d
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2982
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2983
    "Modified: / 8.8.1997 / 12:03:55 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2984
    "Created: / 7.1.1998 / 11:09:43 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2985
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  2986
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2987
_Float_floatToIntBits:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2988
    |f i|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2989
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2990
    f := nativeContext argAt:1.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2991
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2992
    UninterpretedBytes isBigEndian ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2993
	i := f basicAt:4. 
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2994
	i := i bitOr:((f basicAt:3) bitShift:8).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2995
	i := i bitOr:((f basicAt:2) bitShift:16).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2996
	i := i bitOr:((f basicAt:1) bitShift:24).
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  2997
    ] ifFalse:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2998
	i := f basicAt:1. 
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  2999
	i := i bitOr:((f basicAt:2) bitShift:8).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3000
	i := i bitOr:((f basicAt:3) bitShift:16).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3001
	i := i bitOr:((f basicAt:4) bitShift:24).
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3002
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3003
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3004
    ^ i.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3005
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3006
    "Created: / 4.1.1998 / 01:25:50 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3007
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3008
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3009
_Float_intBitsToFloat:nativeContet
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3010
    |i aFloat|
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3011
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3012
    i := nativeContet argAt:1.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3013
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3014
    aFloat := ShortFloat basicNew.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3015
    UninterpretedBytes isBigEndian ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3016
	aFloat basicAt:1 put:((i bitShift:-24) bitAnd:16rFF).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3017
	aFloat basicAt:2 put:((i bitShift:-16) bitAnd:16rFF).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3018
	aFloat basicAt:3 put:((i bitShift:-8) bitAnd:16rFF).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3019
	aFloat basicAt:4 put:(i bitAnd:16rFF).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3020
    ] ifFalse:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3021
	aFloat basicAt:1 put:(i bitAnd:16rFF).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3022
	aFloat basicAt:2 put:((i bitShift:-8) bitAnd:16rFF).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3023
	aFloat basicAt:3 put:((i bitShift:-16) bitAnd:16rFF).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3024
	aFloat basicAt:4 put:((i bitShift:-24) bitAnd:16rFF).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3025
    ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3026
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3027
    ^ aFloat.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3028
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3029
    "Created: / 13.1.1998 / 23:03:36 / cg"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3030
    "Modified: / 13.1.1998 / 23:05:01 / cg"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3031
!
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3032
342
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3033
_Math_acos:nativeContext
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3034
    "arc cosine"
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3035
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3036
    |dVal|
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3037
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3038
    dVal := nativeContext argAt:1.
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3039
    (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3040
        self halt:'expected double arg'
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3041
    ].
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3042
    ^ dVal arcCos
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3043
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3044
    "Created: / 7.5.1998 / 00:34:50 / cg"
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3045
    "Modified: / 7.5.1998 / 00:36:38 / cg"
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3046
!
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3047
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3048
_Math_asin:nativeContext
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3049
    "arc sine"
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3050
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3051
    |dVal|
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3052
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3053
    dVal := nativeContext argAt:1.
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3054
    (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3055
        self halt:'expected double arg'
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3056
    ].
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3057
    ^ dVal arcSin
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3058
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3059
    "Created: / 7.5.1998 / 00:34:26 / cg"
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3060
    "Modified: / 7.5.1998 / 00:36:43 / cg"
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3061
!
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3062
317
40ef89f043c1 checkin from browser
cg
parents: 316
diff changeset
  3063
_Math_atan:nativeContext
40ef89f043c1 checkin from browser
cg
parents: 316
diff changeset
  3064
    "arc tangens"
40ef89f043c1 checkin from browser
cg
parents: 316
diff changeset
  3065
40ef89f043c1 checkin from browser
cg
parents: 316
diff changeset
  3066
    |dVal|
40ef89f043c1 checkin from browser
cg
parents: 316
diff changeset
  3067
40ef89f043c1 checkin from browser
cg
parents: 316
diff changeset
  3068
    dVal := nativeContext argAt:1.
40ef89f043c1 checkin from browser
cg
parents: 316
diff changeset
  3069
    (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
40ef89f043c1 checkin from browser
cg
parents: 316
diff changeset
  3070
        self halt:'expected double arg'
40ef89f043c1 checkin from browser
cg
parents: 316
diff changeset
  3071
    ].
40ef89f043c1 checkin from browser
cg
parents: 316
diff changeset
  3072
    ^ dVal arcTan
40ef89f043c1 checkin from browser
cg
parents: 316
diff changeset
  3073
40ef89f043c1 checkin from browser
cg
parents: 316
diff changeset
  3074
    "Created: / 6.2.1998 / 01:24:12 / cg"
40ef89f043c1 checkin from browser
cg
parents: 316
diff changeset
  3075
!
40ef89f043c1 checkin from browser
cg
parents: 316
diff changeset
  3076
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3077
_Math_ceil:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3078
    "ceiling"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3079
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3080
    |dVal|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3081
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3082
    dVal := nativeContext argAt:1.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3083
    (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3084
	self halt:'expected double arg'
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3085
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3086
    ^ dVal ceilingAsFloat
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3087
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3088
    "Created: / 7.1.1998 / 15:43:00 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3089
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3090
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3091
_Math_cos:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3092
    "cosine"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3093
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3094
    |dVal|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3095
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3096
    dVal := nativeContext argAt:1.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3097
    (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3098
	self halt:'expected double arg'
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3099
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3100
    ^ dVal cos
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3101
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3102
    "Created: / 7.1.1998 / 15:41:30 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3103
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3104
342
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3105
_Math_exp:nativeContext
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3106
    "exponential"
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3107
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3108
    |dVal|
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3109
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3110
    dVal := nativeContext argAt:1.
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3111
    (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3112
        self halt:'expected double arg'
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3113
    ].
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3114
    ^ dVal exp
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3115
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3116
    "Created: / 7.5.1998 / 00:36:19 / cg"
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3117
!
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3118
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3119
_Math_floor:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3120
    "floor"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3121
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3122
    |dVal|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3123
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3124
    dVal := nativeContext argAt:1.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3125
    (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3126
	self halt:'expected double arg'
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3127
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3128
    ^ dVal floorAsFloat
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3129
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3130
    "Created: / 7.1.1998 / 19:09:21 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3131
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3132
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3133
_Math_log:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3134
    "logarithm"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3135
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3136
    |dVal|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3137
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3138
    dVal := nativeContext argAt:1.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3139
    (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3140
	self halt:'expected double arg'
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3141
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3142
    ^ dVal log
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3143
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3144
    "Created: / 7.1.1998 / 15:42:19 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3145
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3146
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3147
_Math_pow:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3148
    "power"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3149
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3150
    |dVal1 dVal2|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3151
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3152
    dVal1 := nativeContext argAt:1.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3153
    (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3154
	self halt:'expected double arg'
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3155
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3156
    dVal2 := nativeContext argAt:3.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3157
    (nativeContext argAt:4) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3158
	self halt:'expected double arg'
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3159
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3160
    ^ dVal1 raisedTo:dVal2
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3161
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3162
    "Modified: / 15.8.1997 / 05:24:27 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3163
    "Created: / 7.1.1998 / 15:44:13 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3164
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3165
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3166
_Math_sin:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3167
    "sine"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3168
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3169
    |dVal|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3170
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3171
    dVal := nativeContext argAt:1.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3172
    (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3173
	self halt:'expected double arg'
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3174
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3175
    ^ dVal sin
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3176
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3177
    "Created: / 7.1.1998 / 15:41:40 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3178
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3179
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3180
_Math_sqrt:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3181
    "square root"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3182
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3183
    |dVal|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3184
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3185
    dVal := nativeContext argAt:1.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3186
    (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3187
	self halt:'expected double arg'
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3188
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3189
    ^ dVal sqrt
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3190
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3191
    "Created: / 7.1.1998 / 15:42:40 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3192
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3193
342
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3194
_Math_tan:nativeContext
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3195
    "tangent"
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3196
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3197
    |dVal|
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3198
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3199
    dVal := nativeContext argAt:1.
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3200
    (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3201
        self halt:'expected double arg'
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3202
    ].
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3203
    ^ dVal tan
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3204
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3205
    "Created: / 7.5.1998 / 00:34:03 / cg"
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3206
    "Modified: / 7.5.1998 / 00:37:04 / cg"
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3207
!
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  3208
334
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  3209
_Method_getModifiers:nativeContext
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  3210
    |jMethod mthd retVal|
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  3211
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  3212
    jMethod := nativeContext receiver.
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  3213
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  3214
    mthd := JavaMethods at:jMethod ifAbsent:nil.
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  3215
    mthd isNil ifTrue:[
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  3216
        self halt.
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  3217
        ^ 0
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  3218
    ].
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  3219
    ^ mthd accessFlags
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  3220
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  3221
    "Modified: / 9.4.1998 / 17:50:01 / cg"
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  3222
!
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  3223
322
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3224
_Method_invoke:nativeContext
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3225
    "invoke a javaMethod"
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3226
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3227
    |jMethod mthd rec args retVal|
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3228
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3229
    jMethod := nativeContext receiver.
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3230
    rec := nativeContext argAt:1.
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3231
    args := nativeContext argAt:2.
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3232
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3233
    mthd := JavaMethods at:jMethod ifAbsent:nil.
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3234
    mthd isNil ifTrue:[
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3235
        self halt.
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3236
    ].
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3237
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3238
    "/ check for arguments to match the expected types ...
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3239
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3240
    mthd argSignature keysAndValuesDo:[:index :argSig |
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3241
        |cls arg|
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3242
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3243
        cls := Java at:argSig.
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3244
        arg := args at:index.
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3245
        (arg isKindOf:cls) ifFalse:[
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3246
            self halt.
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3247
        ]
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3248
    ].
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3249
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3250
    mthd isStatic ifTrue:[
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3251
        retVal := mthd valueWithReceiver:(mthd javaClass) arguments:args selector:mthd selector.        
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3252
        ^ retVal
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3253
    ] ifFalse:[
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3254
        self halt.
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3255
    ].
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3256
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3257
    self halt.
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3258
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3259
    "Created: / 13.2.1998 / 15:15:28 / cg"
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3260
    "Modified: / 13.2.1998 / 15:35:54 / cg"
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3261
!
567088a5a1b0 partial support for getMethod0 & invokeMethod.
cg
parents: 321
diff changeset
  3262
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3263
_Object_clone:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3264
    "clone an object"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3265
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3266
    |o rslt|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3267
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3268
    o := nativeContext receiver.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3269
    rslt := o shallowCopy.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3270
    ^ rslt
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3271
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3272
    "Created: / 4.1.1998 / 19:39:26 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3273
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3274
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3275
_Object_getClass:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3276
    "return an objects class"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3277
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3278
    |o cls jClass|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3279
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3280
    o := nativeContext receiver.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3281
    cls := o class.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3282
268
f7357f1142c8 provide & use a helper to associate java.lang.class insts to javaClasses
cg
parents: 266
diff changeset
  3283
    jClass := self javaClassObjectForClass:cls.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3284
    ^ jClass
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3285
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3286
    "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
  3287
    "Modified: / 23.1.1998 / 17:48:22 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3288
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3289
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3290
_Object_hashCode:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3291
    "identityHash"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3292
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3293
    |o rslt|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3294
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3295
    o := nativeContext receiver.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3296
    rslt := o identityHash.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3297
    ^ rslt
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3298
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3299
    "Created: / 4.1.1998 / 19:40:26 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3300
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3301
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3302
_Object_notify:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3303
    "wakeup"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3304
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3305
    self wakeup:(nativeContext receiver).
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3306
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3307
    "Created: / 6.1.1998 / 21:09:26 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3308
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3309
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3310
_Object_notifyAll:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3311
    self wakeupAll:(nativeContext receiver).
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3312
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3313
    "Created: / 3.1.1998 / 03:06:56 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3314
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3315
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3316
_Object_wait:nativeMethodContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3317
    "wait"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3318
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3319
    |tmo handle sema enteredMonitors|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3320
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3321
    handle := nativeMethodContext receiver.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3322
    tmo := nativeMethodContext argAt:1.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3323
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3324
"/ DEBUG BEGIN
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3325
    (nativeMethodContext argAt:2) == DUMMY_LONG_HIGHWORD ifFalse:[
306
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3326
        self halt:'expected long arg'
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3327
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3328
"/ DEBUG END
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3329
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3330
    sema := JavaVM semaphoreFor:handle.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3331
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3332
    "/ temporarily leave all entered monitors.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3333
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3334
    enteredMonitors := self enteredMonitors.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3335
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3336
    enteredMonitors size > 0 ifTrue:[
306
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3337
        MonitorTrace ifTrue:[
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3338
            ('====> wait - exit ' , enteredMonitors size printString , ' monitors in ' , Processor activeProcess name , ' ...') infoPrintCR.
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3339
        ].
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3340
        enteredMonitors do:[:handle | 
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3341
            |mon|
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3342
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3343
            mon := LockTable at:handle ifAbsent:nil.
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3344
            mon isNil ifTrue:[
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3345
                self halt:'no monitor in wait'.
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3346
            ] ifFalse:[
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3347
                MonitorTrace ifTrue:[
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3348
                    ('====> wait - exit monitor for ' , handle displayString , ' in ' , Processor activeProcess name , ' ...') infoPrintCR. 
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3349
                ].
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3350
                mon exit.
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3351
            ].
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3352
        ].
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3353
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3354
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3355
    [
306
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3356
        ThreadTrace ifTrue:[
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3357
            ('====> thread ' , Processor activeProcess name , ' waiting ...') infoPrintCR.
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3358
        ].
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  3359
        Processor activeProcess state:#javaWait.
306
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3360
        tmo = 0 ifTrue:[
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3361
            sema wait.
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3362
        ] ifFalse:[
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3363
            sema waitWithTimeout:tmo / 1000.
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3364
        ].
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3365
    ] valueOnUnwindDo: "valueNowOrOnUnwindDo:" [
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3366
        JavaVM releaseSemaphoreFor:handle.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3367
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3368
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3369
    "/ re-enter monitors.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3370
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3371
    enteredMonitors size > 0 ifTrue:[
306
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3372
        MonitorTrace ifTrue:[
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3373
            ('====> wait - reenter ' , enteredMonitors size printString , ' monitors in ' , Processor activeProcess name , ' ...') infoPrintCR.
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3374
        ].
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3375
        enteredMonitors do:[:handle | 
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3376
            |mon|
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3377
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3378
            LockTableAccess critical:[
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3379
                mon := LockTable at:handle ifAbsent:nil.
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3380
                mon isNil ifTrue:[
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3381
                    LockTable at:handle put:(mon := Monitor new)
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3382
                ]
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3383
            ].
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3384
            MonitorTrace ifTrue:[
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3385
                ('====> wait - reenter monitor for ' , handle displayString , ' in ' , Processor activeProcess name , ' ...') infoPrintCR. 
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3386
            ].
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3387
            mon enter.
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3388
        ]
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3389
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3390
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3391
    ThreadTrace ifTrue:[
306
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3392
        '====> thread continues ...' printCR.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3393
    ]
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3394
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  3395
    "Modified: / 5.2.1998 / 10:26:48 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3396
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3397
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3398
_Runtime_buildLibName:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3399
    |jPath jFileName path fileName libName|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3400
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3401
    jPath := nativeContext argAt:1.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3402
    jFileName := nativeContext argAt:2.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3403
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3404
    path := Java as_ST_String:jPath.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3405
    fileName := Java as_ST_String:jFileName.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3406
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3407
    path = '__builtIn__' ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3408
	libName := path , '/' , fileName
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3409
    ] ifFalse:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3410
	libName := path , '/lib' , fileName , '.so'.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3411
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3412
    ^ Java as_String:libName.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3413
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3414
    "Modified: / 8.8.1997 / 12:05:05 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3415
    "Created: / 4.1.1998 / 19:07:14 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3416
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3417
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3418
_Runtime_execInternal:nativeContext
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3419
    "Run a unix-command; return a process object."
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3420
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3421
    |cmdAndArgArray envArray cmd jProcessClass jProcess|
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3422
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3423
"/    cmdAndArgArray := nativeContext argAt:1.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3424
"/    envArray := nativeContext argAt:2.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3425
"/
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3426
"/    cmd := cmdAndArgArray at:1.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3427
"/
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3428
"/    jProcessClass := Java classForName:'java.lang.UNIXProcess'.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3429
"/    jProcessClass notNil ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3430
"/        jProcess := jProcessClass newCleared.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3431
"/        jProcess
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3432
"/            perform:#'<init>([Ljava/lang/String;[Ljava/lang/String;)V'
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3433
"/            with:cmdAndArgArray
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3434
"/            with:envArray.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3435
"/        ^ jProcess
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3436
"/    ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3437
    self throwIOExceptionWithMessage:'Process execution disabled/unimplemented'.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3438
    ^ nil
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3439
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3440
    "Created: / 15.1.1998 / 01:50:31 / cg"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3441
    "Modified: / 15.1.1998 / 02:09:29 / cg"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3442
!
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3443
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3444
_Runtime_exitInternal:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3445
    "exit - here, we only shut down java threads"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3446
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3447
    |enteredMonitors|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3448
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3449
    (enteredMonitors := self enteredMonitors) size > 0 ifTrue:[
306
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3450
        enteredMonitors do:[:handle | 
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3451
            | mon |
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3452
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3453
            mon := LockTable at:handle ifAbsent:nil.
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3454
            mon isNil ifTrue:[
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3455
                self halt:'no monitor in exitInternal'.
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3456
            ] ifFalse:[
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3457
                mon exit.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3458
('====> terminateThread - exit monitor for ' , handle displayString , ' in ' , Processor activeProcess name , ' ...') infoPrintCR. 
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3459
"/                LockTableAccess critical:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3460
"/                    mon isFree ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3461
"/                        LockTable removeKey:handle
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3462
"/                    ]
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3463
"/                ]
306
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3464
            ].
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3465
        ].
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3466
    ].
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3467
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3468
"/    JavaVM releaseAllJavaResources.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3469
    AbortSignal raise.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3470
    self halt.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3471
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3472
    "Created: / 7.1.1998 / 22:48:51 / cg"
306
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  3473
    "Modified: / 3.2.1998 / 16:13:39 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3474
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3475
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3476
_Runtime_freeMemory:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3477
    "free memory - Returns the number of free bytes"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3478
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3479
    ^ ObjectMemory freeListSpace + ObjectMemory freeSpace
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3480
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3481
    "Created: / 12.1.1998 / 12:59:53 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3482
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3483
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3484
_Runtime_gc:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3485
    "Runs the garbage collector.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3486
     Ignored, since the ST-gc runs all the time."
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3487
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3488
    ^ self
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3489
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3490
    "Modified: / 12.1.1998 / 12:58:32 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3491
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3492
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3493
_Runtime_initializeLinkerInternal:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3494
    "init sharedLib linker, return searchPath as javaString"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3495
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3496
    |path|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3497
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3498
    "/ mhmh - what is done here ?
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3499
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3500
    path := ''.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3501
    LibPath do:[:comp | path size == 0 ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3502
			    path := path , comp
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3503
			] ifFalse:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3504
			    path := path , ':' , comp
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3505
			]
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3506
	       ].
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3507
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3508
    ^ Java as_String:path
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3509
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3510
    "Modified: / 7.8.1997 / 21:17:03 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3511
    "Created: / 4.1.1998 / 17:53:15 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3512
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3513
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3514
_Runtime_loadFileInternal:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3515
    "load a sharedLib, return boolean 0 (false) if fail; 1 (true) if ok"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3516
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3517
    |ret|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3518
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3519
    ret := self _Runtime_loadFileInternalI:nativeContext.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3520
    ret < 0 ifTrue:[ ret := 0 ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3521
    ^ ret
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3522
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3523
    "Created: / 4.1.1998 / 19:10:20 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3524
    "Modified: / 4.1.1998 / 19:11:04 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3525
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3526
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3527
_Runtime_loadFileInternalI:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3528
    "1.1b3 change; load a sharedLib like 'loadFileInternal',
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3529
     but return integer:
319
6396dea8902f checkin from browser
cg
parents: 318
diff changeset
  3530
        -1   outOfMemory error
6396dea8902f checkin from browser
cg
parents: 318
diff changeset
  3531
        0    failed to load
6396dea8902f checkin from browser
cg
parents: 318
diff changeset
  3532
        1    loaded or already loaded (i.e. ok)"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3533
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3534
    |jLibName libName libHandle|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3535
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3536
    jLibName := nativeContext argAt:1.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3537
    libName := Java as_ST_String:jLibName.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3538
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3539
    (SimulatedLibs includes:libName) ifTrue:[
319
6396dea8902f checkin from browser
cg
parents: 318
diff changeset
  3540
"/        ('JAVA: builtIn libLoad simulated: ' , libName) printNL.
6396dea8902f checkin from browser
cg
parents: 318
diff changeset
  3541
        ^ 1
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3542
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3543
    (LoadedLibs notNil and:[LoadedLibs includesKey:libName]) ifTrue:[
319
6396dea8902f checkin from browser
cg
parents: 318
diff changeset
  3544
"/        ('JAVA: already loaded: ' , libName) printNL.
6396dea8902f checkin from browser
cg
parents: 318
diff changeset
  3545
        ^ 1
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3546
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3547
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3548
    libName asFilename exists ifFalse:[
319
6396dea8902f checkin from browser
cg
parents: 318
diff changeset
  3549
        ('JAVA: no file to load: ' , libName) printNL.
6396dea8902f checkin from browser
cg
parents: 318
diff changeset
  3550
        ^ 0
6396dea8902f checkin from browser
cg
parents: 318
diff changeset
  3551
    ].
6396dea8902f checkin from browser
cg
parents: 318
diff changeset
  3552
6396dea8902f checkin from browser
cg
parents: 318
diff changeset
  3553
    (self confirm:'permission to load native library: ' , libName , ' ?') ifFalse:[
6396dea8902f checkin from browser
cg
parents: 318
diff changeset
  3554
        ^ 0
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3555
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3556
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3557
    libHandle := ObjectFileLoader loadLibrary:libName.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3558
    libHandle isNil ifTrue:[
319
6396dea8902f checkin from browser
cg
parents: 318
diff changeset
  3559
        ('JAVA: failed to load: ' , libName) printNL.
6396dea8902f checkin from browser
cg
parents: 318
diff changeset
  3560
        ^ 0
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3561
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3562
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3563
    LoadedLibs isNil ifTrue:[
319
6396dea8902f checkin from browser
cg
parents: 318
diff changeset
  3564
        LoadedLibs := Dictionary new.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3565
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3566
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3567
    LoadedLibs at:libName put:libHandle.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3568
    ^ 1
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3569
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3570
    "Created: / 4.1.1998 / 19:10:54 / cg"
319
6396dea8902f checkin from browser
cg
parents: 318
diff changeset
  3571
    "Modified: / 6.2.1998 / 03:11:59 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3572
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3573
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3574
_Runtime_totalMemory:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3575
    "free memory - Returns the total number of bytes"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3576
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3577
    ^ ObjectMemory oldSpaceSize + ObjectMemory newSpaceSize
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3578
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3579
    "Created: / 12.1.1998 / 12:59:23 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3580
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3581
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3582
_SecurityManager_classLoaderDepth:nativeContext
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3583
    |con depth|
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3584
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3585
    con := thisContext sender.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3586
    depth := 1.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3587
    [con notNil] whileTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3588
	con receiver == JavaClassReader classLoaderQuerySignal ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3589
	    con selector == #handle:do: ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3590
		depth := depth + 1
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3591
	    ]
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3592
	].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3593
	con := con sender.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3594
    ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3595
'JAVA: classLoaderDepth -> ' infoPrint. depth infoPrintCR.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3596
    ^ depth.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3597
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3598
    "Created: / 13.1.1998 / 09:21:46 / cg"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3599
    "Modified: / 13.1.1998 / 09:33:43 / cg"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3600
!
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3601
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3602
_SecurityManager_currentClassLoader:nativeContext
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3603
    |loader|
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3604
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3605
    loader := JavaClassReader classLoaderQuerySignal raise.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3606
'JAVA: currentClassLoader -> ' infoPrint. loader displayString infoPrintCR.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3607
    ^ loader.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3608
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3609
    "Created: / 13.1.1998 / 09:23:28 / cg"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3610
!
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3611
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3612
_System_arraycopy:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3613
    |srcArray srcIdx dstArray dstIdx count|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3614
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3615
    srcArray := nativeContext argAt:1.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3616
    srcIdx := nativeContext argAt:2.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3617
    dstArray := nativeContext argAt:3.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3618
    dstIdx := nativeContext argAt:4.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3619
    count := nativeContext argAt:5.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3620
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3621
    srcArray class isBytes ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3622
	dstArray class isBytes ifFalse:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3623
	    self halt:'incompatible arraycopy collections'.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3624
	].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3625
	dstArray replaceBytesFrom:(dstIdx+1) to:(dstIdx+count) with:srcArray startingAt:(srcIdx+1).
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3626
    ] ifFalse:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3627
	dstArray replaceFrom:(dstIdx+1) to:(dstIdx+count) with:srcArray startingAt:(srcIdx+1).
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3628
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3629
    ^ nil.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3630
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3631
    "Created: / 3.1.1998 / 01:56:44 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3632
    "Modified: / 3.1.1998 / 02:01:37 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3633
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3634
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3635
_System_currentTimeMillis:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3636
    "return the milliseconds since 1.jan.1970"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3637
368
e8c16a76826f checkin from browser
cg
parents: 361
diff changeset
  3638
    |seconds delta|
e8c16a76826f checkin from browser
cg
parents: 361
diff changeset
  3639
e8c16a76826f checkin from browser
cg
parents: 361
diff changeset
  3640
    "/ workaround win32 bug (use 01:01:01 as base)
e8c16a76826f checkin from browser
cg
parents: 361
diff changeset
  3641
    delta := AbsoluteTime now millisecondDeltaFrom:(AbsoluteTime day:1 month:1 year:1970 hour:1 minutes:1 seconds:1).
e8c16a76826f checkin from browser
cg
parents: 361
diff changeset
  3642
    delta := delta - 3600 - 60 - 1.
e8c16a76826f checkin from browser
cg
parents: 361
diff changeset
  3643
    ^ delta max:0
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3644
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3645
    "Created: / 3.1.1998 / 03:25:50 / cg"
368
e8c16a76826f checkin from browser
cg
parents: 361
diff changeset
  3646
    "Modified: / 12.9.1998 / 16:53:09 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3647
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3648
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3649
_System_initProperties:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3650
    |props stProps|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3651
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3652
    props := nativeContext argAt:1.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3653
    stProps := self systemProperties.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3654
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3655
    "/ recursively invoke myself on the Java HashTable.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3656
    "/ calling 'put' to stuff in the values ...
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3657
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3658
    stProps keysAndValuesDo:[:key :value |
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  3659
	|keyObj valueObj|
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  3660
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  3661
	keyObj := Java as_String:key.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  3662
	valueObj := Java as_String:value.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  3663
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  3664
	props 
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  3665
	    perform:#'put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;'
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  3666
	    with:keyObj 
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  3667
	    with:valueObj.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3668
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3669
    ^ props
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3670
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3671
    "Created: / 3.1.1998 / 14:25:22 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3672
    "Modified: / 4.1.1998 / 14:23:18 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3673
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3674
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3675
_System_setErr0:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3676
    |stream|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3677
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3678
    stream := nativeContext argAt:1.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3679
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3680
    self setOpenFile:(self javaConsoleStream ? Stderr) at:2.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3681
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3682
    nativeContext receiver instVarNamed:'err' put:stream.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3683
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3684
    "Created: / 18.3.1997 / 15:02:05 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3685
    "Modified: / 4.1.1998 / 16:21:15 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3686
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3687
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3688
_System_setIn0:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3689
    |stream|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3690
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3691
    stream := nativeContext argAt:1.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3692
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3693
    self setOpenFile:Stdin at:0.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3694
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3695
    nativeContext receiver instVarNamed:'in' put:stream.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3696
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3697
    "Created: / 4.1.1998 / 16:16:38 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3698
    "Modified: / 4.1.1998 / 16:20:44 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3699
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3700
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3701
_System_setOut0:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3702
    |stream|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3703
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3704
    stream := nativeContext argAt:1.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3705
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3706
    self setOpenFile:(self javaConsoleStream ? Stdout) at:1.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3707
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3708
    nativeContext receiver instVarNamed:'out' put:stream.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3709
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3710
    "Created: / 4.1.1998 / 16:18:26 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3711
    "Modified: / 4.1.1998 / 16:20:23 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3712
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3713
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3714
_Thread_currentThread:nativeMethodContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3715
    |t p prio|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3716
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3717
    p := Processor activeProcess.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3718
    t := self javaThreadForSTProcess:p.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3719
    t notNil ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3720
	^ t
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3721
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3722
    t := self newThread:'main'.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3723
    Java threads at:t put:p.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3724
    ^ t
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3725
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3726
    "Created: / 3.1.1998 / 01:42:28 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3727
    "Modified: / 4.1.1998 / 14:59:13 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3728
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3729
339
fb1f09d2af62 *** empty log message ***
cg
parents: 337
diff changeset
  3730
_Thread_interrupt0:nativeContext
fb1f09d2af62 *** empty log message ***
cg
parents: 337
diff changeset
  3731
    "ask if a thread is interrupted (clear interruptState if arg is true)"
fb1f09d2af62 *** empty log message ***
cg
parents: 337
diff changeset
  3732
fb1f09d2af62 *** empty log message ***
cg
parents: 337
diff changeset
  3733
    |jThread stProcess|
fb1f09d2af62 *** empty log message ***
cg
parents: 337
diff changeset
  3734
fb1f09d2af62 *** empty log message ***
cg
parents: 337
diff changeset
  3735
    jThread := nativeContext receiver.
fb1f09d2af62 *** empty log message ***
cg
parents: 337
diff changeset
  3736
    stProcess := self stProcessForJavaThread:jThread.
fb1f09d2af62 *** empty log message ***
cg
parents: 337
diff changeset
  3737
    stProcess isNil ifTrue:[
fb1f09d2af62 *** empty log message ***
cg
parents: 337
diff changeset
  3738
        self halt.
fb1f09d2af62 *** empty log message ***
cg
parents: 337
diff changeset
  3739
        ^ 0
fb1f09d2af62 *** empty log message ***
cg
parents: 337
diff changeset
  3740
    ].
fb1f09d2af62 *** empty log message ***
cg
parents: 337
diff changeset
  3741
fb1f09d2af62 *** empty log message ***
cg
parents: 337
diff changeset
  3742
    stProcess markInterrupted
fb1f09d2af62 *** empty log message ***
cg
parents: 337
diff changeset
  3743
fb1f09d2af62 *** empty log message ***
cg
parents: 337
diff changeset
  3744
    "Modified: / 2.1.1998 / 21:49:06 / cg"
fb1f09d2af62 *** empty log message ***
cg
parents: 337
diff changeset
  3745
    "Created: / 10.4.1998 / 15:21:43 / cg"
fb1f09d2af62 *** empty log message ***
cg
parents: 337
diff changeset
  3746
!
fb1f09d2af62 *** empty log message ***
cg
parents: 337
diff changeset
  3747
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3748
_Thread_isAlive:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3749
    "is it alive ?"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3750
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3751
    |jThread stProcess|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3752
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3753
    jThread := nativeContext receiver.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3754
    stProcess := JavaVM stProcessForJavaThread:jThread.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3755
    stProcess isNil ifTrue:[
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3756
        ThreadTrace == true ifTrue:[
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3757
            ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL.
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3758
        ].
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3759
        ^ 0 "FALSE"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3760
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3761
    stProcess isDead ifTrue:[^ 0 "FALSE"].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3762
    ^ 1 "TRUE"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3763
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3764
    "Created: / 5.1.1998 / 02:03:51 / cg"
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3765
    "Modified: / 6.2.1998 / 02:15:01 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3766
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3767
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3768
_Thread_isInterrupted:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3769
    "ask if a thread is interrupted (clear interruptState if arg is true)"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3770
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3771
    |jThread stProcess clearInterrupt rslt|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3772
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3773
    jThread := nativeContext receiver.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3774
    stProcess := self stProcessForJavaThread:jThread.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3775
    stProcess isNil ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3776
	self halt.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3777
	^ 0
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3778
    ].
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3779
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3780
    clearInterrupt := nativeContext argAt:1.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3781
    rslt := stProcess isInterrupted ifTrue:[1] ifFalse:[0].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3782
    clearInterrupt ~~ 0 ifTrue:[stProcess clearInterruptActions].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3783
    ^ rslt
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3784
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3785
    "Modified: / 2.1.1998 / 21:49:06 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3786
    "Created: / 7.1.1998 / 18:50:26 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3787
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3788
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3789
_Thread_resume0:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3790
    "yield"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3791
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3792
    |jThread stProcess|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3793
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3794
    jThread := nativeContext receiver.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3795
    stProcess := JavaVM stProcessForJavaThread:jThread.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3796
    stProcess isNil ifTrue:[
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3797
        ThreadTrace == true ifTrue:[
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3798
            ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL.
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3799
        ].
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3800
        ^ nil "void"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3801
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3802
    stProcess resume
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3803
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3804
    "Created: / 8.1.1998 / 01:06:27 / cg"
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3805
    "Modified: / 6.2.1998 / 02:15:08 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3806
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3807
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3808
_Thread_setPriority0:nativeMethodContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3809
    |t p prio|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3810
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3811
    t := nativeMethodContext receiver.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3812
    p := JavaVM stProcessForJavaThread:t.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3813
    prio := nativeMethodContext argAt:1.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3814
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3815
    p isNil ifTrue:[
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3816
        ThreadTrace == true ifTrue:[
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3817
            'JAVA [info]: no process yet (in setPriority)' infoPrintCR.
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3818
        ].
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3819
        ^ nil
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3820
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3821
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3822
    ThreadTrace ifTrue:[
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3823
        'JAVA [info]: setPrio: ' print. t print. ' pri= ' print. prio print. ' p= ' print. p printNL.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3824
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3825
    ^ nil
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3826
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3827
    "Created: / 2.1.1998 / 19:05:55 / cg"
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3828
    "Modified: / 6.2.1998 / 02:28:18 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3829
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3830
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3831
_Thread_sleep:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3832
    "sleep for some milliseconds "
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3833
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3834
    |millis|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3835
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3836
    (nativeContext argAt:2) ~~ DUMMY_LONG_HIGHWORD ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3837
	self internalError:'expected long arg'.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3838
    ] ifFalse:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3839
	millis := nativeContext argAt:1.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3840
	Delay waitForMilliseconds:(millis max:50)
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3841
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3842
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3843
    "Created: / 7.1.1998 / 15:34:23 / cg"
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  3844
    "Modified: / 13.1.1998 / 13:48:25 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3845
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3846
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3847
_Thread_start:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3848
    "start the thread"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3849
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3850
    |jThread jName name stProcess|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3851
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3852
    jThread := nativeContext receiver.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3853
    (jThread instVarNamed:'priority') < 1 ifTrue:[
297
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3854
        self halt.
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3855
        jThread instVarNamed:'priority' put:1.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3856
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3857
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3858
    stProcess := JavaProcess 
297
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3859
                    for:[   
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3860
                            [
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3861
                                JavaVM javaExceptionSignal handle:[:ex |
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3862
                                    |procName exClass|
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3863
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3864
                                    procName := stProcess name.
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3865
                                    exClass := ex parameter class.
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3866
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3867
                                    exClass == (Java at:'java.lang.ThreadDeath') ifTrue:[
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3868
                                        ('JAVA: thread ' , procName , ' terminated') infoPrintCR.
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3869
                                    ] ifFalse:[
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3870
                                        Transcript 
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3871
                                            showCR:('JAVA: thread ''' 
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3872
                                                    , procName 
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3873
                                                    , ''' terminated with exception: ' 
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3874
                                                    , exClass name).
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3875
                                    ].
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3876
                                    ex return.
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3877
                                ] do:[
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3878
                                    jThread perform:#'run()V'.
316
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  3879
                                    ThreadTrace == true ifTrue:[
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  3880
                                        ('JAVA: thread ' , stProcess name , ' terminated') infoPrintCR.
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  3881
                                    ].
297
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3882
                                    jThread perform:#'exit()V'.
316
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  3883
                                    ThreadTrace == true ifTrue:[
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  3884
                                        ('JAVA: after exit of thread ' , stProcess name) infoPrintCR.
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  3885
                                    ]
297
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3886
                                ]
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3887
                            ] valueNowOrOnUnwindDo:[
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3888
                                Java threads removeKey:jThread ifAbsent:[].
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3889
                            ]
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3890
                        ] 
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3891
                    priority:(Processor activePriority).
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3892
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3893
    jName := jThread instVarNamed:'name'.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3894
    jName isString ifFalse:[
297
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3895
        name := Java as_ST_String:jName.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3896
    ] ifTrue:[
297
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3897
        name := jName
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3898
    ].
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3899
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3900
    "/ kludge - remember the ScreenUpdater ...
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3901
    name = 'Screen Updater' ifTrue:[
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  3902
        ScreenUpdaterProcess := stProcess.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3903
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3904
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3905
    "/ when that process terminates, wakup any waiters
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3906
    stProcess addExitAction:[self wakeup:jThread].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3907
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3908
    stProcess name:'JAVA-' , name.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3909
    stProcess resume.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3910
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3911
    Java threads at:jThread put:stProcess.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3912
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3913
    ^ nil
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3914
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3915
    "Created: / 3.1.1998 / 02:05:52 / cg"
316
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  3916
    "Modified: / 6.2.1998 / 00:55:26 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3917
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3918
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3919
_Thread_stop0:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3920
    "terminate a thread"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3921
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3922
    |jThread stProcess death|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3923
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3924
    jThread := nativeContext receiver.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3925
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3926
    stProcess := JavaVM stProcessForJavaThread:jThread.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3927
    stProcess isNil ifTrue:[
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3928
        ThreadTrace == true ifTrue:[
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3929
            ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL.
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3930
        ].
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3931
        ^ nil "void"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3932
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3933
    death := nativeContext argAt:1.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3934
    stProcess 
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3935
        interruptWith:[
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3936
                        JavaVM javaExceptionSignal handle:[:ex |
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3937
                            Processor activeProcess terminate
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3938
                        ] do:[
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3939
                            ThreadTrace == true ifTrue:[
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3940
                                ('JAVA: thread exit: ' , jThread displayString) infoPrintNL.
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3941
                            ].
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3942
                            jThread perform:#'exit()V'.
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3943
                            self throwException:death.
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3944
                        ]
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3945
                      ].
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3946
    stProcess resume.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3947
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3948
    [stProcess isDead] whileFalse:[
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3949
        stProcess resume.
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3950
        Delay waitForSeconds:0.1
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3951
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3952
    stProcess terminate
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3953
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3954
    "Created: / 8.1.1998 / 13:11:17 / cg"
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3955
    "Modified: / 6.2.1998 / 02:18:15 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3956
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3957
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3958
_Thread_suspend0:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3959
    "yield"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3960
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3961
    |jThread stProcess|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3962
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3963
    jThread := nativeContext receiver.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3964
    stProcess := JavaVM stProcessForJavaThread:jThread.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3965
    stProcess isNil ifTrue:[
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3966
        ThreadTrace == true ifTrue:[
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3967
            ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL.
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3968
        ].
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3969
        ^ nil "void"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3970
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3971
    stProcess suspend
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3972
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3973
    "Created: / 8.1.1998 / 01:05:49 / cg"
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3974
    "Modified: / 6.2.1998 / 02:15:23 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3975
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3976
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3977
_Thread_yield:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3978
    "yield"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3979
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3980
    |jThread stProcess|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3981
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3982
    jThread := nativeContext receiver.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3983
    stProcess := JavaVM stProcessForJavaThread:jThread.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3984
    stProcess isNil ifTrue:[
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3985
        ThreadTrace == true ifTrue:[
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3986
            ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL.
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3987
        ].
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3988
        ^ nil "void"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3989
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3990
    stProcess == Processor activeProcess ifTrue:[
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3991
        Processor yield.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3992
    ] ifFalse:[
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3993
        self halt.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3994
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3995
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  3996
    "Created: / 5.1.1998 / 02:03:51 / cg"
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  3997
    "Modified: / 6.2.1998 / 02:15:29 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3998
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  3999
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4000
_Throwable_fillInStackTrace:nativeContext
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4001
    |exClass exceptionObject list con|
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4002
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4003
    exClass := Java classNamed:'java.lang.Throwable'.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4004
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4005
    exceptionObject := nativeContext receiver.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4006
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4007
    "/
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4008
    "/ debugging only
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4009
    "/
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4010
    (exceptionObject isKindOf:(Java classNamed:'java.lang.Throwable')) ifFalse:[
347
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  4011
        self halt
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4012
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4013
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4014
    con := thisContext sender.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4015
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4016
    "/
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4017
    "/ we are not interrested in all intermediate Exception frames ...
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4018
    "/
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4019
    FullExceptionTrace ifFalse:[
347
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  4020
        "/ first, skip any JavaVM contexts
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  4021
        [con receiver == exceptionObject] whileFalse:[
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  4022
            con := con sender
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  4023
        ].
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  4024
        "/ then, all exception-init contexts
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  4025
        [con receiver == exceptionObject] whileTrue:[
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  4026
            con := con sender
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  4027
        ].
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4028
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4029
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4030
    list := OrderedCollection new.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4031
    [con notNil] whileTrue:[
347
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  4032
        (con isJavaContext) ifTrue:[
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  4033
            "/ add a copy, in case the context continues with some
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  4034
            "/ cleanup ...
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  4035
            list add:con shallowCopy
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  4036
        ].
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  4037
        con := con sender
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4038
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4039
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4040
    exceptionObject instVarNamed:'backtrace' put:(list asArray).
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4041
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4042
    ^ nil.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4043
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4044
    "Created: / 4.1.1998 / 14:27:40 / cg"
347
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  4045
    "Modified: / 8.5.1998 / 21:29:53 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4046
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4047
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4048
_Throwable_printStackTrace0:nativeContext
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4049
    |out outStream exceptionObject contextList|
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4050
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4051
    outStream := nativeContext argAt:1.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4052
    exceptionObject := nativeContext receiver.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4053
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4054
    contextList := exceptionObject instVarNamed:'backtrace'.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4055
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4056
    out := self javaConsoleStream.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4057
    out cr.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4058
    out nextPutLine:'JAVA: stackTrace:'.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4059
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4060
    contextList do:[:con |
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4061
	out 
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4062
	    nextPutAll:'  '; 
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4063
	    nextPutAll:(con method javaClass fullName);
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4064
	    nextPutAll:'.';
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4065
	    nextPutAll:(con method selector);
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4066
	    nextPutAll:' ['; 
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4067
	    nextPutAll:(con method javaClass sourceFile); 
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4068
	    nextPutAll:' '; 
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4069
	    nextPutAll:(con lineNumber displayString); 
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4070
	    nextPutAll:']'.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4071
	out cr
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4072
    ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4073
    out nextPutLine:'----------------------------------------------------'
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4074
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4075
    "Created: / 4.1.1998 / 14:27:40 / cg"
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4076
    "Modified: / 15.1.1998 / 00:14:40 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4077
! !
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4078
277
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4079
!JavaVM class methodsFor:'native - java.lang - jdk1.2'!
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4080
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4081
_AccessController_beginPrivileged:nativeContext
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4082
    "/ introduced with jdk1.2
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4083
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4084
    "Created: / 27.1.1998 / 18:18:11 / cg"
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4085
!
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4086
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4087
_AccessController_endPrivileged:nativeContext
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4088
    "/ introduced with jdk1.2
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4089
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4090
    "Created: / 27.1.1998 / 18:18:32 / cg"
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4091
!
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4092
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4093
_AccessController_getStackAccessControlContext:nativeContext
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4094
    "/ introduced with jdk1.2
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4095
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4096
    "/ supposed to do more here ...
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4097
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4098
    ^ nil
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4099
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4100
    "Created: / 27.1.1998 / 18:22:15 / cg"
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4101
!
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4102
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4103
_ClassLoader$NativeLibrary_load:nativeContext
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4104
    "/ introduced with jdk1.2 ... (sigh)
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4105
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4106
    |nativeLoader jLibName libName libHandle index|
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4107
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4108
    nativeLoader := nativeContext receiver.
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4109
    jLibName := nativeContext argAt:1.
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4110
    libName := Java as_ST_String:jLibName.
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4111
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4112
    (index := SimulatedNativeLibs indexOf:libName) ~~ 0 ifTrue:[
319
6396dea8902f checkin from browser
cg
parents: 318
diff changeset
  4113
"/        ('JAVA: builtIn nativeLibLoad simulated: ' , libName) printNL.
277
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4114
        nativeLoader instVarNamed:'handle' put:index.
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4115
        ^ self "/ void
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4116
    ].
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4117
    (LoadedNativeLibs notNil 
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4118
    and:[LoadedNativeLibs includesKey:libName]) ifTrue:[
319
6396dea8902f checkin from browser
cg
parents: 318
diff changeset
  4119
"/        ('JAVA: native library already loaded: ' , libName) printNL.
277
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4120
        nativeLoader instVarNamed:'handle' put:(LoadedNativeLibs at:libName).
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4121
        ^ self "/ void
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4122
    ].
319
6396dea8902f checkin from browser
cg
parents: 318
diff changeset
  4123
6396dea8902f checkin from browser
cg
parents: 318
diff changeset
  4124
    (self confirm:'permission to load native library: ' , libName , ' ?') ifFalse:[
6396dea8902f checkin from browser
cg
parents: 318
diff changeset
  4125
        ^ self
6396dea8902f checkin from browser
cg
parents: 318
diff changeset
  4126
    ].
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  4127
self halt.
277
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4128
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4129
    libName asFilename exists ifFalse:[
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4130
        ('JAVA: no file to load nativeLib: ' , libName) printNL.
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4131
        ^ self "/ void
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4132
    ].
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4133
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4134
    libHandle := ObjectFileLoader loadLibrary:libName.
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4135
    libHandle isNil ifTrue:[
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4136
        ('JAVA: failed to load nativeLib: ' , libName) printNL.
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4137
        ^ self "/ void
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4138
    ].
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4139
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4140
    LoadedNativeLibs isNil ifTrue:[
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4141
        LoadedNativeLibs := Dictionary new.
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4142
    ].
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4143
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4144
    LoadedNativeLibs at:libName put:libHandle.
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4145
    nativeLoader instVarNamed:'handle' put:(LoadedNativeLibs at:libName).
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4146
    ^ self "/ void
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4147
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4148
    "Created: / 27.1.1998 / 18:38:37 / cg"
319
6396dea8902f checkin from browser
cg
parents: 318
diff changeset
  4149
    "Modified: / 6.2.1998 / 03:12:17 / cg"
277
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4150
!
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4151
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4152
_ClassLoader_initIDs:nativeContext
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4153
    "/ introduced with jdk1.2 ... (sigh)
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4154
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4155
    "Created: / 27.1.1998 / 18:37:08 / cg"
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4156
!
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4157
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4158
_Component_initIDs:nativeContext
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4159
    "/ introduced with jdk1.2 ... (sigh)
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4160
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4161
    "Created: / 27.1.1998 / 19:53:29 / cg"
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4162
!
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4163
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4164
_System_getCallerClass:nativeContext
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4165
    "/ introduced with jdk1.2
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4166
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4167
    |senderContext cls|
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4168
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4169
    senderContext := nativeContext sender.
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4170
    [senderContext receiver == (Java at:'java.lang.System')] whileTrue:[
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4171
        senderContext := senderContext sender.
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4172
    ].
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4173
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4174
    senderContext method isStatic ifTrue:[
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4175
        cls := senderContext receiver
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4176
    ] ifFalse:[
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4177
        cls := senderContext receiver class
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4178
    ].
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4179
    cls isJavaClass ifTrue:[
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4180
        ^ self javaClassObjectForClass:cls
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4181
    ].
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4182
    (cls isMemberOf:(Java at:'java.lang.Class')) ifTrue:[
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4183
        ^ Java at:'java.lang.Class'
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4184
    ].
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4185
    self halt.
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4186
    ^ nil
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4187
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4188
    "Modified: / 27.1.1998 / 18:33:13 / cg"
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4189
!
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4190
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4191
_Toolkit_initIDs:nativeContext
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4192
    "/ introduced with jdk1.2 ... (sigh)
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4193
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4194
    "Created: / 27.1.1998 / 19:53:50 / cg"
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4195
! !
511c3bb153b7 jdk1.2 stuff.
cg
parents: 274
diff changeset
  4196
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4197
!JavaVM class methodsFor:'native - java.math'!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4198
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4199
_BigInteger_plumbInit:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4200
    "/ self unimplementedNativeMethod.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4201
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4202
    "Created: / 12.1.1998 / 12:55:53 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4203
! !
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4204
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4205
!JavaVM class methodsFor:'native - java.net'!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4206
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4207
_InetAddressImpl_getInetFamily:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4208
    "/ self unimplementedNativeMethod.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4209
    ^ 0
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4210
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4211
    "Modified: / 15.8.1997 / 17:04:43 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4212
    "Created: / 5.1.1998 / 02:05:48 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4213
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4214
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4215
_InetAddressImpl_getLocalHostName:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4216
    ""
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4217
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4218
    |hostName|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4219
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4220
    hostName := OperatingSystem getHostName.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4221
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4222
    ^ (Java as_String:hostName).
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4223
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4224
    "Modified: / 7.8.1997 / 21:16:55 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4225
    "Created: / 5.1.1998 / 02:07:03 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4226
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4227
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4228
_InetAddressImpl_lookupAllHostAddr:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4229
    ""
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4230
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4231
    |jAddrImpl jHostName hostName addrBytes|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4232
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4233
    jAddrImpl := nativeContext receiver.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4234
    jHostName := nativeContext argAt:1.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4235
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4236
    hostName := Java as_ST_String:jHostName.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4237
    addrBytes := Socket ipAddressOfHost:hostName.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4238
    addrBytes isNil ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4239
	addrBytes := #[0 0 0 0] copy
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4240
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4241
    ^ Array with:addrBytes
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4242
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4243
    "Modified: / 8.8.1997 / 12:04:25 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4244
    "Created: / 7.1.1998 / 18:51:31 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4245
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4246
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4247
_InetAddressImpl_makeAnyLocalAddress:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4248
    ""
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4249
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4250
    |jAddrImpl jAddr hostName addrBytes address|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4251
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4252
    jAddrImpl := nativeContext receiver.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4253
    jAddr := nativeContext argAt:1.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4254
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4255
    hostName := OperatingSystem getHostName.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4256
    addrBytes := Socket ipAddressOfHost:hostName.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4257
    "/ MSB first into an integer.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4258
    address := (addrBytes at:1).
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4259
    address := (address bitShift:8) bitOr:(addrBytes at:2).
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4260
    address := (address bitShift:8) bitOr:(addrBytes at:3).
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4261
    address := (address bitShift:8) bitOr:(addrBytes at:4).
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4262
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4263
    jAddr instVarNamed:'hostName' put:(Java as_String:hostName).
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4264
    jAddr instVarNamed:'address' put:address.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4265
    jAddr instVarNamed:'family' put:0.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4266
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4267
    ^ nil
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4268
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4269
    "Modified: / 7.8.1997 / 21:16:57 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4270
    "Created: / 5.1.1998 / 02:06:27 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4271
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4272
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4273
_PlainSocketImpl_initProto:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4274
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4275
    "Created: / 12.1.1998 / 12:56:52 / cg"
271
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4276
!
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4277
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4278
_PlainSocketImpl_socketAccept:nativeContext
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4279
    |jsock fd newJSock sock newSock fileNo|
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4280
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4281
    jsock := nativeContext receiver.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4282
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4283
    sock := self validateFile:jsock.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4284
    sock isNil ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4285
        self
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4286
            throwExceptionClassName:'java.io.IOException'
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4287
            withMessage:'nil socket in accept'.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4288
        ^ self.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4289
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4290
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4291
    newJSock := nativeContext argAt:1.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4292
    fd := newJSock instVarNamed:'fd'.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4293
    (fd instVarNamed:'fd') ~~ 0 ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4294
        self halt:'file already open'.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4295
        self internalError:'file already open'.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4296
        self 
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4297
            throwExceptionClassName:'java.io.IOException'
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4298
            withMessage:'socket already open in socketAccept'.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4299
        ^ self.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4300
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4301
    FileIOTrace ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4302
        'JAVA: socket accept' infoPrintCR
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4303
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4304
    newSock := sock accept.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4305
    newSock isNil ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4306
        self
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4307
            throwExceptionClassName:'java.io.IOException'
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4308
            withMessage:'accept failed'.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4309
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4310
    fileNo := self addOpenFile:newSock.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4311
    fd instVarNamed:'fd' put:fileNo.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4312
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4313
    "Created: / 4.2.1998 / 15:26:49 / cg"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4314
    "Modified: / 4.2.1998 / 15:45:20 / cg"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4315
!
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4316
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4317
_PlainSocketImpl_socketAvailable:nativeContext
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4318
    |jSock sock n|
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4319
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4320
    jSock := nativeContext receiver.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4321
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4322
    sock := self validateFile:jSock.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4323
    sock isNil ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4324
        self
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4325
            throwExceptionClassName:'java.io.IOException'
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4326
            withMessage:'socketAvailable on closed socket'.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4327
        ^ self.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4328
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4329
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4330
    n := sock numAvailable.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4331
    ^ n
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4332
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4333
    "Created: / 4.2.1998 / 16:58:49 / cg"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4334
!
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4335
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4336
_PlainSocketImpl_socketBind:nativeContext
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4337
    |jsock jaddr port sock hostName ok err|
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4338
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4339
    jsock := nativeContext receiver.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4340
    jaddr := nativeContext argAt:1.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4341
    port := nativeContext argAt:2.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4342
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4343
    hostName := jaddr instVarNamed:'hostName'.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4344
    hostName isNil ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4345
        self halt.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4346
    ] ifFalse:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4347
        hostName := Java as_ST_String:hostName
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4348
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4349
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4350
    sock := self validateFile:jsock.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4351
    sock notNil ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4352
        FileIOTrace ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4353
            ('JAVA: socket bind to ' , hostName printString, ' port ' , port printString) infoPrintCR
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4354
        ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4355
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4356
        ok := sock bindTo:port address:nil "hostName".
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4357
        ok ifFalse:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4358
            err := OperatingSystem lastErrorString.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4359
            Transcript showCR:'sock err: ' , err printString.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4360
            self
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4361
                throwExceptionClassName:'java.io.IOException'
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4362
                withMessage:'bind failed'.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4363
        ]
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4364
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4365
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4366
    "Created: / 4.2.1998 / 15:06:20 / cg"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4367
    "Modified: / 4.2.1998 / 15:34:08 / cg"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4368
!
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4369
271
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4370
_PlainSocketImpl_socketClose:nativeContext
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4371
    |jsock sock|
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4372
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4373
    jsock := nativeContext receiver.
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4374
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4375
    sock := self validateFile:jsock.
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4376
    sock notNil ifTrue:[
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4377
        FileIOTrace ifTrue:[
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4378
            'JAVA: close socket' infoPrintCR
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4379
        ].
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4380
        sock close.
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4381
    ].
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4382
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4383
    "Modified: / 21.8.1997 / 17:09:40 / cg"
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4384
    "Created: / 25.1.1998 / 20:04:24 / cg"
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4385
!
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4386
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4387
_PlainSocketImpl_socketConnect:nativeContext
272
256377db7309 checkin from browser
cg
parents: 271
diff changeset
  4388
    |jsock jaddr port sock addr hostName ok|
271
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4389
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4390
    jsock := nativeContext receiver.
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4391
    jaddr := nativeContext argAt:1.
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4392
    port := nativeContext argAt:2.
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4393
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4394
    hostName := jaddr instVarNamed:'hostName'.
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4395
    hostName notNil ifTrue:[
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4396
        hostName := Java as_ST_String:hostName
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4397
    ] ifFalse:[
272
256377db7309 checkin from browser
cg
parents: 271
diff changeset
  4398
        addr := jaddr instVarNamed:'address'.
256377db7309 checkin from browser
cg
parents: 271
diff changeset
  4399
        addr notNil ifTrue:[
256377db7309 checkin from browser
cg
parents: 271
diff changeset
  4400
            hostName := ByteArray new:4.
256377db7309 checkin from browser
cg
parents: 271
diff changeset
  4401
            hostName at:4 put:(addr bitAnd:16rFF).
256377db7309 checkin from browser
cg
parents: 271
diff changeset
  4402
            addr := addr bitShift:-8.
256377db7309 checkin from browser
cg
parents: 271
diff changeset
  4403
            hostName at:3 put:(addr bitAnd:16rFF).
256377db7309 checkin from browser
cg
parents: 271
diff changeset
  4404
            addr := addr bitShift:-8.
256377db7309 checkin from browser
cg
parents: 271
diff changeset
  4405
            hostName at:2 put:(addr bitAnd:16rFF).
256377db7309 checkin from browser
cg
parents: 271
diff changeset
  4406
            addr := addr bitShift:-8.
256377db7309 checkin from browser
cg
parents: 271
diff changeset
  4407
            hostName at:1 put:(addr bitAnd:16rFF).
256377db7309 checkin from browser
cg
parents: 271
diff changeset
  4408
        ].
271
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4409
    ].
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4410
    hostName isNil ifTrue:[
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4411
        self halt.
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4412
    ].
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4413
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4414
    sock := self validateFile:jsock.
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4415
    sock notNil ifTrue:[
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4416
        FileIOTrace ifTrue:[
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4417
            ('JAVA: socket connect to ' , hostName printString , ' port ' , port printString) infoPrintCR
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4418
        ].
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4419
        (self confirm:'connect to host: ' , hostName printString , ' - ok ?')
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4420
        ifFalse:[
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4421
            self 
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4422
                throwExceptionClassName:'java.io.IOException'
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4423
                withMessage:'connect permission denied'.
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4424
        ].
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4425
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4426
        ok := sock connectTo:hostName port:port.
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4427
        ok ifFalse:[
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4428
            self 
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4429
                throwExceptionClassName:'java.io.IOException'
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4430
                withMessage:'connect failed'.
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4431
        ]
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4432
    ].
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4433
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4434
    "Created: / 25.1.1998 / 20:02:27 / cg"
272
256377db7309 checkin from browser
cg
parents: 271
diff changeset
  4435
    "Modified: / 25.1.1998 / 20:57:59 / cg"
271
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4436
!
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4437
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4438
_PlainSocketImpl_socketCreate:nativeContext
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4439
    |jsock isStream fd sock fileNo|
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4440
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4441
    jsock := nativeContext receiver.
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4442
    isStream := (nativeContext argAt:1) == 1.
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4443
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4444
    fd := jsock instVarNamed:'fd'.
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4445
    (fd instVarNamed:'fd') ~~ 0 ifTrue:[
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4446
        self halt:'file already open'.
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4447
        self internalError:'file already open'.
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4448
        self 
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4449
            throwExceptionClassName:'java.io.IOException'
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4450
            withMessage:'file already open in socketCreate'.
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4451
        ^ self.
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4452
    ].
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4453
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4454
    FileOpenTrace ifTrue:[
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4455
        ('JAVA: create socket') infoPrintCR.
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4456
    ].
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4457
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4458
    isStream ifTrue:[
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4459
        sock := Socket newTCP
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4460
    ] ifFalse:[
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4461
        sock := Socket newUDP
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4462
    ].
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4463
    sock isNil ifTrue:[
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4464
        self 
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4465
            throwExceptionClassName:'java.io.IOException'
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4466
            withMessage:'socketCreate failed'.
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4467
    ].
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4468
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4469
    fileNo := self addOpenFile:sock.
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4470
    fd instVarNamed:'fd' put:fileNo.
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4471
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4472
    "Created: / 25.1.1998 / 19:59:25 / cg"
a69c9491d69b checkin from browser
cg
parents: 270
diff changeset
  4473
    "Modified: / 25.1.1998 / 19:59:45 / cg"
272
256377db7309 checkin from browser
cg
parents: 271
diff changeset
  4474
!
256377db7309 checkin from browser
cg
parents: 271
diff changeset
  4475
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4476
_PlainSocketImpl_socketListen:nativeContext
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4477
    |jSock time sock ok|
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4478
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4479
    jSock := nativeContext receiver.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4480
    time := nativeContext argAt:1.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4481
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4482
    sock := self validateFile:jSock.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4483
    sock notNil ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4484
        FileIOTrace ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4485
            ('JAVA: socket listen with timeout ' , time printString) infoPrintCR.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4486
        ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4487
        ok := sock listenWithBacklog:5.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4488
        ok ifFalse:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4489
            self
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4490
                throwExceptionClassName:'java.io.IOException'
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4491
                withMessage:'listen failed'.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4492
            ^ self.
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4493
        ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4494
        time ~~ 0 ifTrue:[
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4495
            sock readWaitWithTimeoutMs:time
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4496
        ]
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4497
    ].
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4498
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4499
    "Created: / 4.2.1998 / 15:17:48 / cg"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4500
    "Modified: / 4.2.1998 / 15:18:26 / cg"
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4501
!
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4502
272
256377db7309 checkin from browser
cg
parents: 271
diff changeset
  4503
_SocketInputStream_socketRead:nativeContext
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4504
    ^ self anyStream_readBytes:nativeContext
272
256377db7309 checkin from browser
cg
parents: 271
diff changeset
  4505
256377db7309 checkin from browser
cg
parents: 271
diff changeset
  4506
    "Created: / 25.1.1998 / 20:56:53 / cg"
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4507
    "Modified: / 4.2.1998 / 15:52:31 / cg"
272
256377db7309 checkin from browser
cg
parents: 271
diff changeset
  4508
!
256377db7309 checkin from browser
cg
parents: 271
diff changeset
  4509
256377db7309 checkin from browser
cg
parents: 271
diff changeset
  4510
_SocketOutputStream_socketWrite:nativeContext
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4511
    ^ self anyStream_writeBytes:nativeContext
272
256377db7309 checkin from browser
cg
parents: 271
diff changeset
  4512
256377db7309 checkin from browser
cg
parents: 271
diff changeset
  4513
    "Created: / 25.1.1998 / 21:06:55 / cg"
307
d009b196caa7 more stuff (mostly sockets)
cg
parents: 306
diff changeset
  4514
    "Modified: / 4.2.1998 / 15:52:40 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4515
! !
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4516
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4517
!JavaVM class methodsFor:'native - java.utils'!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4518
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4519
_ResourceBundle_getClassContext:nativeContext
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4520
    "returns an array filled with the contextChain receivers classes.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4521
     What an ugly, messy interface."
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4522
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4523
    |chain con cls jClass|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4524
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4525
    chain := OrderedCollection new.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4526
    con := thisContext sender.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4527
    [con notNil] whileTrue:[
347
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  4528
        (con isJavaContext) ifTrue:[
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  4529
            cls := con receiver class.
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  4530
            cls isMeta ifTrue:[
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  4531
                "/ t'was a static method
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  4532
                cls := cls soleInstance
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  4533
            ].
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  4534
            jClass := JavaClasses at:cls ifAbsent:nil.
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  4535
            jClass isNil ifTrue:[
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  4536
                JavaClasses at:cls put:(jClass := (Java at:'java.lang.Class') new).
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  4537
                JavaClasses at:jClass put:cls.
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  4538
            ].
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  4539
            chain add:jClass.
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  4540
        ].
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  4541
        con := con sender.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4542
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4543
    ^ chain asArray
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4544
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4545
    "Created: / 5.1.1998 / 02:47:00 / cg"
347
3585e74e6e86 use #isJavaContext (instead of #isMember or #isKindOf)
cg
parents: 342
diff changeset
  4546
    "Modified: / 8.5.1998 / 21:29:57 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4547
! !
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  4548
304
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4549
!JavaVM class methodsFor:'native - java.utils.zip'!
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4550
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4551
_Inflater_init:nativeContext
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4552
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4553
    "Created: / 1.2.1998 / 20:14:01 / cg"
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4554
!
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4555
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4556
_Inflater_reset:nativeContext
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4557
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4558
    "Created: / 1.2.1998 / 20:14:13 / cg"
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4559
! !
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4560
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4561
!JavaVM class methodsFor:'native - netscape'!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4562
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4563
_MozillaAppletContext_pMochaOnLoad:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4564
    |id|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4565
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4566
    id := nativeContext argAt:1.
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4567
"/ 'JAVA: MozillaAppletContext_pMochaOnLoad: ' print. id printNL.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4568
    ^ nil
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4569
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4570
    "Created: / 6.1.1998 / 20:37:13 / cg"
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4571
    "Modified: / 6.2.1998 / 02:13:09 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4572
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4573
325
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  4574
_MozillaAppletContext_pShowDocument:nativeContext
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  4575
    |s js|
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  4576
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  4577
    js := nativeContext argAt:1.
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  4578
    s := Java as_ST_String:js.
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  4579
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  4580
    "/ somehow pass it to the html browser ....
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  4581
"/ Transcript showCR:s.
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  4582
    ^ nil
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  4583
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  4584
    "Modified: / 8.1.1998 / 17:06:13 / cg"
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  4585
    "Created: / 29.3.1998 / 15:53:17 / cg"
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  4586
!
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  4587
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4588
_MozillaAppletContext_pShowStatus:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4589
    |s js|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4590
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4591
    js := nativeContext argAt:1.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4592
    s := Java as_ST_String:js.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4593
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4594
    self activityNotification:s.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4595
"/ Transcript showCR:s.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4596
    ^ nil
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4597
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4598
    "Created: / 6.1.1998 / 18:31:34 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4599
    "Modified: / 8.1.1998 / 17:06:13 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4600
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4601
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4602
_URLStreamHandlerFactory_pInit:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4603
    "/ self unimplementedNativeMethod.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4604
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4605
    "Created: / 10.1.1998 / 15:47:24 / cg"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4606
! !
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4607
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4608
!JavaVM class methodsFor:'native - sun.audio'!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4609
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4610
_AudioDevice_audioClose:nativeContext
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4611
    |device fd stream|
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4612
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4613
    device := nativeContext receiver.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4614
    device notNil ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4615
	fd := device instVarNamed:'dev'.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4616
	(fd notNil and:[fd > 0]) ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4617
	    stream := self getOpenFileAt:fd.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4618
	    stream notNil ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4619
		stream close.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4620
		device instVarNamed:'dev' put:0.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4621
	    ]
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4622
	]
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4623
    ]
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4624
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4625
    "Created: / 10.1.1998 / 15:45:16 / cg"
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4626
    "Modified: / 13.1.1998 / 18:08:20 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4627
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4628
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4629
_AudioDevice_audioOpen:nativeContext
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4630
    |f stream fileNo|
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4631
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4632
    NoAudio ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4633
	^ -1
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4634
    ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4635
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4636
    f := '/dev/audio' asFilename.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4637
"/    stream := f readWriteStream.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4638
    Stream streamErrorSignal handle:[:ex |
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4639
	Stream streamErrorSignal handle:[:ex |
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4640
	    stream := nil.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4641
	    ex return.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4642
	] do:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4643
	    stream := SoundStream writing.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4644
	].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4645
    ] do:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4646
	stream := SoundStream writing.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4647
    ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4648
    stream isNil ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4649
	f exists ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4650
	   ^ 0
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4651
	].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4652
	^ -1
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4653
    ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4654
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4655
    stream setSampleRate:8000.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4656
    fileNo := self addOpenFile:stream.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4657
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4658
    FileOpenTrace ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4659
	('JAVA: opened audioDevice as FD ' , fileNo printString) infoPrintCR.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4660
    ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4661
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4662
    ^ fileNo
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4663
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4664
    "Created: / 10.1.1998 / 15:45:30 / cg"
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4665
    "Modified: / 14.1.1998 / 14:57:16 / cg"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4666
!
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4667
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4668
_AudioDevice_audioWrite:nativeContext
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4669
    |device fd stream bytes count|
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4670
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4671
    device := nativeContext receiver.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4672
    device notNil ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4673
	fd := device instVarNamed:'dev'.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4674
	(fd notNil and:[fd > 0]) ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4675
	    stream := self getOpenFileAt:fd.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4676
	    stream notNil ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4677
		bytes := nativeContext argAt:1.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4678
		count := nativeContext argAt:2.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4679
		stream nextPutBytes:count from:bytes startingAt:1
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4680
	    ]
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4681
	]
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4682
    ]
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4683
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4684
    "Created: / 10.1.1998 / 15:45:16 / cg"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4685
    "Modified: / 13.1.1998 / 18:07:20 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4686
! !
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4687
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4688
!JavaVM class methodsFor:'native - sun.awt'!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4689
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4690
_GifImageDecoder_parseImage:nativeContext
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4691
    |decoder width height bool1 depth subHdrBytes dstBytes i1 i2 colorModel
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4692
     stream byte compressedData compressedSize index count data 
304
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4693
     leftOffs topOffs codeLen flags pixelStore clrModel t buffSize 
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4694
     countGot countGot2|
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4695
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4696
    decoder := nativeContext receiver.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4697
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4698
    i1 := nativeContext argAt:1.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4699
    i2 := nativeContext argAt:2.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4700
    width := nativeContext argAt:3.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4701
    height := nativeContext argAt:4.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4702
    bool1 := nativeContext argAt:5.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4703
    depth := nativeContext argAt:6.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4704
    subHdrBytes := nativeContext argAt:7.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4705
    dstBytes := nativeContext argAt:8.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4706
    colorModel := nativeContext argAt:9.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4707
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4708
    leftOffs := subHdrBytes wordAt:1 MSB:false.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4709
    topOffs := subHdrBytes wordAt:3 MSB:false.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4710
    width := subHdrBytes wordAt:5 MSB:false.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4711
    height := subHdrBytes wordAt:7 MSB:false.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4712
    flags := subHdrBytes at:9.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4713
    codeLen := subHdrBytes at:10.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4714
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4715
    stream := decoder instVarNamed:'input'.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4716
    pixelStore := decoder instVarNamed:'store'.
339
fb1f09d2af62 *** empty log message ***
cg
parents: 337
diff changeset
  4717
    pixelStore isNil ifTrue:[
fb1f09d2af62 *** empty log message ***
cg
parents: 337
diff changeset
  4718
        ^ 0
fb1f09d2af62 *** empty log message ***
cg
parents: 337
diff changeset
  4719
    ].
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4720
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4721
    buffSize := (width * height // 2) max:4096.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4722
    compressedData := ByteArray uninitializedNew:buffSize.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4723
    "get compressed data"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4724
    index := 1.
304
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4725
    count := stream perform:#'read()I'.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4726
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4727
    [count notNil and:[count > 0]] whileTrue:[
304
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4728
        (index + count) > buffSize ifTrue:[
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4729
            t := ByteArray uninitializedNew:(buffSize * 2).
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4730
            t replaceFrom:1 to:buffSize with:compressedData startingAt:1.
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4731
            compressedData := t.
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4732
            buffSize := buffSize * 2.
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4733
        ].
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4734
        [count ~~ 0] whileTrue:[
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4735
            countGot := stream 
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4736
                        perform:#'read([BII)I' 
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4737
                        with:compressedData
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4738
                        with:index-1
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4739
                        with:count.
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4740
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4741
            countGot > 0 ifTrue:[
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4742
                count := count - countGot.
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4743
                index := index + countGot.
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4744
            ] ifFalse:[
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4745
                count := -1.
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4746
            ]
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4747
        ].
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4748
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4749
        count >= 0 ifTrue:[
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4750
            count := stream perform:#read.
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4751
        ]
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4752
    ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4753
    compressedSize := index - 1.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4754
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4755
    data := pixelStore perform:#'allocateLines(I)Ljava/lang/Object;' with:height.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4756
    (data isMemberOf:ByteArray) ifFalse:[
304
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4757
        self halt.
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4758
        ^ 0.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4759
    ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4760
"/    'GIFReader: decompressing ...' infoPrintCR.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4761
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4762
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4763
    GIFReader 
304
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4764
        decompressGIFFrom:compressedData
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4765
        count:compressedSize
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4766
        into:data
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4767
        startingAt:1
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4768
        codeLen:(codeLen + 1).
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4769
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4770
    clrModel := pixelStore instVarNamed:'colormodel'.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4771
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4772
    pixelStore 
304
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4773
        perform:#'setPixels(IIII[BII)Z'
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4774
        withArguments:
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4775
            (Array 
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4776
                with:0        "/ x
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4777
                with:0        "/ y
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4778
                with:width    "/ w
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4779
                with:height   "/ h
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4780
                with:data
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4781
                with:0        "/ offs
2053052418d8 fixed gifParsing
cg
parents: 297
diff changeset
  4782
                with:width).   "/ scanSize
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4783
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4784
    pixelStore  perform:#'imageComplete()V'.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4785
"/        perform:#'imageComplete(I)V' 
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4786
"/        with:((Java at:'java.awt.image.ImageConsumer') instVarNamed:'STATICIMAGEDONE').
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4787
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4788
"/ self internalError:'breakPoint'.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4789
    ^ 1 "/ true
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4790
339
fb1f09d2af62 *** empty log message ***
cg
parents: 337
diff changeset
  4791
    "Modified: / 10.4.1998 / 14:31:59 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4792
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4793
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4794
_ImageRepresentation_disposeImage:nativeContext
262
8edf97e626c8 offscreen images & better exception handling
cg
parents: 261
diff changeset
  4795
    |imgRep img|
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4796
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4797
    imgRep := nativeContext receiver.
262
8edf97e626c8 offscreen images & better exception handling
cg
parents: 261
diff changeset
  4798
8edf97e626c8 offscreen images & better exception handling
cg
parents: 261
diff changeset
  4799
    img := imgRep instVarNamed:'pData'.
8edf97e626c8 offscreen images & better exception handling
cg
parents: 261
diff changeset
  4800
    (img notNil and:[img ~~ 0]) ifTrue:[
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4801
	ImageStretchCache notNil ifTrue:[
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4802
	    ImageStretchCache removeKey:img ifAbsent:nil.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4803
	]
262
8edf97e626c8 offscreen images & better exception handling
cg
parents: 261
diff changeset
  4804
    ].
8edf97e626c8 offscreen images & better exception handling
cg
parents: 261
diff changeset
  4805
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4806
    imgRep instVarNamed:'pData' put:0.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4807
"/    self halt.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4808
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4809
    "Created: / 7.1.1998 / 22:31:46 / cg"
262
8edf97e626c8 offscreen images & better exception handling
cg
parents: 261
diff changeset
  4810
    "Modified: / 17.1.1998 / 13:26:55 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4811
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4812
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4813
_ImageRepresentation_finish:nativeContext
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4814
    |imgRep bool|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4815
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4816
    imgRep := nativeContext receiver.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4817
    bool := nativeContext argAt:1.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4818
"/ self halt.
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4819
"/    'JAVA: ImageRepresentation_finish ignored for now' infoPrintCR.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4820
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4821
    ^ 1 "/ true
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4822
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4823
    "Created: / 8.1.1998 / 00:11:40 / cg"
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4824
    "Modified: / 6.2.1998 / 02:12:54 / cg"
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4825
!
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4826
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4827
_ImageRepresentation_imageDraw:nativeContext
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4828
    |imgRep x y img deviceImage jGraphics gc clr|
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4829
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4830
    imgRep := nativeContext receiver.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4831
    img := imgRep instVarNamed:'pData'.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4832
    (img isNil or:[img == 0]) ifTrue:[
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4833
	"/ self halt.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4834
	^ self.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4835
    ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4836
    jGraphics := nativeContext argAt:1.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4837
    gc := jGraphics instVarNamed:'pData'.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4838
    gc realized ifFalse:[^ self].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4839
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4840
    x := nativeContext argAt:2.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4841
    y := nativeContext argAt:3.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4842
    clr := nativeContext argAt:4.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4843
    deviceImage := img onDevice:gc device.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4844
    deviceImage ~~ img ifTrue:[
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4845
	imgRep instVarNamed:'pData' put:deviceImage.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4846
    ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4847
    deviceImage displayOn:gc x:x y:y.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4848
    ^ 1.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4849
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4850
    "Created: / 13.1.1998 / 13:32:28 / cg"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4851
    "Modified: / 15.1.1998 / 12:21:27 / cg"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4852
!
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4853
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4854
_ImageRepresentation_imageStretch:nativeContext
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4855
    |imgRep x1 y1 x2 y2 srcX1 srcY1 w h 
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4856
     img deviceImage jGraphics gc clr stretchWidth stretchHeight|
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4857
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4858
    imgRep := nativeContext receiver.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4859
    img := imgRep instVarNamed:'pData'.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4860
    (img isNil or:[img == 0]) ifTrue:[
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4861
	"/ self halt.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4862
	^ self.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4863
    ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4864
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4865
    jGraphics := nativeContext argAt:1.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4866
    gc := jGraphics instVarNamed:'pData'.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4867
    gc realized ifFalse:[^ self].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4868
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4869
    x1 := nativeContext argAt:2.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4870
    y1 := nativeContext argAt:3.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4871
    x2 := nativeContext argAt:4.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4872
    y2:= nativeContext argAt:5.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4873
    srcX1 := nativeContext argAt:6.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4874
    srcY1 := nativeContext argAt:7.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4875
    w := nativeContext argAt:8.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4876
    h := nativeContext argAt:9.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4877
    clr := nativeContext argAt:10.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4878
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4879
    (srcX1 ~~ 0 or:[srcY1 ~~ 0]) ifTrue:[
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4880
	self halt.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4881
	^ self.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4882
    ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4883
    (w ~~ img width or:[h ~~ img height]) ifTrue:[
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4884
	self halt.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4885
	^ self
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4886
    ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4887
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4888
    "/ TODO: remember magnified images somewhere for a while,
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4889
    "/ to avoid repeated action ...
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4890
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4891
    stretchWidth := (x2-x1).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4892
    stretchHeight := (y2-y1).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4893
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4894
    (stretchWidth == img width
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4895
    and:[stretchHeight == img height]) ifTrue:[
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4896
	deviceImage := img onDevice:gc device.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4897
	deviceImage ~~ img ifTrue:[
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4898
	    imgRep instVarNamed:'pData' put:deviceImage.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4899
	].
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4900
    ] ifFalse:[
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4901
	ImageStretchCache notNil ifTrue:[
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4902
	    deviceImage := ImageStretchCache at:img ifAbsent:nil.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4903
	].
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4904
	(deviceImage isNil 
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4905
	or:[deviceImage width ~~ stretchWidth
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4906
	or:[deviceImage height ~~ stretchHeight]]) ifTrue:[
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4907
	    deviceImage := (img magnifiedTo:stretchWidth@stretchHeight) onDevice:gc device.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4908
	    ImageStretchCache isNil ifTrue:[
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4909
		ImageStretchCache := WeakIdentityDictionary new.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4910
	    ].
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4911
	    ImageStretchCache at:img put:deviceImage
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  4912
	].
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4913
    ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4914
    deviceImage displayOn:gc x:x1 y:y1
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4915
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4916
    "Created: / 13.1.1998 / 13:32:28 / cg"
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4917
    "Modified: / 15.1.1998 / 13:14:47 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4918
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4919
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4920
_ImageRepresentation_offscreenInit:nativeContext
262
8edf97e626c8 offscreen images & better exception handling
cg
parents: 261
diff changeset
  4921
    |imgRep jclr w h form screenDevice|
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4922
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4923
    imgRep := nativeContext receiver.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4924
    jclr := nativeContext argAt:1.
262
8edf97e626c8 offscreen images & better exception handling
cg
parents: 261
diff changeset
  4925
8edf97e626c8 offscreen images & better exception handling
cg
parents: 261
diff changeset
  4926
    w := imgRep instVarNamed:'width'.
8edf97e626c8 offscreen images & better exception handling
cg
parents: 261
diff changeset
  4927
    h := imgRep instVarNamed:'height'.
8edf97e626c8 offscreen images & better exception handling
cg
parents: 261
diff changeset
  4928
8edf97e626c8 offscreen images & better exception handling
cg
parents: 261
diff changeset
  4929
    screenDevice := Screen current.
8edf97e626c8 offscreen images & better exception handling
cg
parents: 261
diff changeset
  4930
    form := Form width:w height:h depth:(screenDevice depth) on:screenDevice.
8edf97e626c8 offscreen images & better exception handling
cg
parents: 261
diff changeset
  4931
8edf97e626c8 offscreen images & better exception handling
cg
parents: 261
diff changeset
  4932
    imgRep instVarNamed:'pData' put:form.
8edf97e626c8 offscreen images & better exception handling
cg
parents: 261
diff changeset
  4933
    "/ self halt.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4934
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  4935
    "Created: / 7.1.1998 / 22:31:46 / cg"
262
8edf97e626c8 offscreen images & better exception handling
cg
parents: 261
diff changeset
  4936
    "Modified: / 17.1.1998 / 12:36:43 / cg"
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4937
!
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4938
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4939
_ImageRepresentation_setBytePixels:nativeContext
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4940
    |imgRep x y w h clrModel bytes offs i2
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4941
     img depth cmap rgbMap opaque transparentColorIndex
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4942
     scanLineWidth nBytes srcIdx dstIdx|
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4943
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4944
    imgRep := nativeContext receiver.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4945
    x := nativeContext argAt:1.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4946
    y := nativeContext argAt:2.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4947
    w := nativeContext argAt:3.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4948
    h := nativeContext argAt:4.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4949
    clrModel := nativeContext argAt:5.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4950
    bytes := nativeContext argAt:6.
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4951
    offs := nativeContext argAt:7.  "/ offset ??
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4952
    scanLineWidth := nativeContext argAt:8.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4953
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4954
    depth := clrModel instVarNamed:'pixel_bits'.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4955
    (clrModel instVarNamed:'map_size') ~~ 0 ifTrue:[
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4956
        rgbMap := clrModel instVarNamed:'rgb'.
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4957
        cmap := Array new:rgbMap size.
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4958
        rgbMap 
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4959
            keysAndValuesDo:[:idx :rgb |
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4960
                cmap at:idx put:(Color rgbValue:(rgb bitAnd:16rFFFFFF))
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4961
            ].        
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4962
    ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4963
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4964
    opaque := (clrModel instVarNamed:'opaque') ~~ 0.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4965
    opaque ifFalse:[
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4966
        transparentColorIndex := clrModel instVarNamed:'transparent_index'
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4967
    ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4968
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4969
    img := imgRep instVarNamed:'pData'.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4970
    (img isNil or:[img == 0]) ifTrue:[
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4971
        (offs ~~ 0 or:[scanLineWidth ~~ w]) ifTrue:[
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4972
            nBytes := ByteArray new:w*h.
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4973
            srcIdx := offs+1.
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4974
            dstIdx := 1.
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4975
            1 to:h do:[:y |
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4976
                nBytes replaceFrom:dstIdx to:(dstIdx+w-1) with:bytes startingAt:srcIdx.
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4977
                srcIdx := srcIdx + scanLineWidth.
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4978
                dstIdx := dstIdx + w.
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4979
            ].
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4980
            bytes := nBytes.
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4981
        ].
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4982
        img := Image width:w height:h depth:depth fromArray:bytes.
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4983
        cmap notNil ifTrue:[
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4984
            img colorMap:cmap.
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4985
            img photometric:#palette
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4986
        ].
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4987
        opaque ifFalse:[
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4988
            img mask:(ImageReader 
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4989
                        buildMaskFromColor:transparentColorIndex 
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4990
                        for:bytes
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4991
                        width:w
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4992
                        height:h)
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4993
        ].
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4994
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4995
        imgRep instVarNamed:'pData' put:img.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4996
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4997
    ] ifFalse:[
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  4998
        self halt.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  4999
    ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  5000
    ^ 1.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  5001
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  5002
    "Created: / 7.1.1998 / 22:31:46 / cg"
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  5003
    "Modified: / 6.2.1998 / 02:50:13 / cg"
262
8edf97e626c8 offscreen images & better exception handling
cg
parents: 261
diff changeset
  5004
!
8edf97e626c8 offscreen images & better exception handling
cg
parents: 261
diff changeset
  5005
297
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5006
_ImageRepresentation_setIntPixels:nativeContext
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  5007
    |imgRep x y w h clrModel ints offs scanLineWidth
316
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5008
     img depth cmap rgbMap opaque transparentColorIndex
373
fceafec7ae61 checkin from browser
cg
parents: 368
diff changeset
  5009
     bytes srcIdx dstIdx val red green blue
fceafec7ae61 checkin from browser
cg
parents: 368
diff changeset
  5010
     redMask greenMask blueMask redShift greenShift blueShift|
297
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5011
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5012
    imgRep := nativeContext receiver.
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5013
    x := nativeContext argAt:1.
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5014
    y := nativeContext argAt:2.
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5015
    w := nativeContext argAt:3.
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5016
    h := nativeContext argAt:4.
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5017
    clrModel := nativeContext argAt:5.
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5018
    ints := nativeContext argAt:6.
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  5019
    offs := nativeContext argAt:7.  "/ offset ??
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  5020
    scanLineWidth := nativeContext argAt:8.  "/ scanLineWidth ??
297
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5021
    opaque := false.
373
fceafec7ae61 checkin from browser
cg
parents: 368
diff changeset
  5022
offs ~~ 0 ifTrue:[
fceafec7ae61 checkin from browser
cg
parents: 368
diff changeset
  5023
 self halt
fceafec7ae61 checkin from browser
cg
parents: 368
diff changeset
  5024
].
297
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5025
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5026
    depth := clrModel instVarNamed:'pixel_bits'.
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5027
    clrModel class == (Java at:'java.awt.image.DirectColorModel') ifTrue:[
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5028
    ] ifFalse:[
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5029
        (clrModel instVarNamed:'map_size') ~~ 0 ifTrue:[
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5030
            rgbMap := clrModel instVarNamed:'rgb'.
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5031
            cmap := Array new:rgbMap size.
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5032
            rgbMap 
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5033
                keysAndValuesDo:[:idx :rgb |
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5034
                    cmap at:idx put:(Color rgbValue:(rgb bitAnd:16rFFFFFF))
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5035
                ].        
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5036
        ].
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5037
        opaque := (clrModel instVarNamed:'opaque') ~~ 0.
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5038
        opaque ifFalse:[
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5039
            transparentColorIndex := clrModel instVarNamed:'transparent_index'
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5040
        ].
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5041
    ].
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5042
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5043
    img := imgRep instVarNamed:'pData'.
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5044
    (img isNil or:[img == 0]) ifTrue:[
373
fceafec7ae61 checkin from browser
cg
parents: 368
diff changeset
  5045
316
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5046
        depth == 32 ifTrue:[
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5047
            "/ temporary kludge - ony use 24 bits/pixel
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5048
            bytes := ByteArray new:w*h*3.
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5049
            srcIdx := 1.
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5050
            dstIdx := 1.
373
fceafec7ae61 checkin from browser
cg
parents: 368
diff changeset
  5051
            redMask := clrModel instVarNamed:'red_mask'.
fceafec7ae61 checkin from browser
cg
parents: 368
diff changeset
  5052
            greenMask := clrModel instVarNamed:'green_mask'.
fceafec7ae61 checkin from browser
cg
parents: 368
diff changeset
  5053
            blueMask := clrModel instVarNamed:'blue_mask'.
fceafec7ae61 checkin from browser
cg
parents: 368
diff changeset
  5054
            redShift := (clrModel instVarNamed:'red_offset') negated.
fceafec7ae61 checkin from browser
cg
parents: 368
diff changeset
  5055
            greenShift := (clrModel instVarNamed:'green_offset') negated.
fceafec7ae61 checkin from browser
cg
parents: 368
diff changeset
  5056
            blueShift := (clrModel instVarNamed:'blue_offset') negated.
316
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5057
            1 to:h do:[:y |
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5058
                1 to:w do:[:x |
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5059
                    val := ints at:srcIdx.
373
fceafec7ae61 checkin from browser
cg
parents: 368
diff changeset
  5060
                    red := (val bitAnd:redMask) bitShift:redShift.
fceafec7ae61 checkin from browser
cg
parents: 368
diff changeset
  5061
                    green := (val bitAnd:greenMask) bitShift:greenShift.
fceafec7ae61 checkin from browser
cg
parents: 368
diff changeset
  5062
                    blue := (val bitAnd:blueMask) bitShift:blueShift.
316
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5063
                    bytes at:dstIdx put:red.
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5064
                    bytes at:dstIdx+1 put:green.
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5065
                    bytes at:dstIdx+2 put:blue.
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5066
                    dstIdx := dstIdx + 3.
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5067
                    srcIdx := srcIdx + 1.
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5068
                ].
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  5069
                srcIdx := srcIdx + (scanLineWidth - w).
316
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5070
            ].
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5071
            img := Depth24Image width:w height:h depth:24 fromArray:bytes.
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5072
        ] ifFalse:[
373
fceafec7ae61 checkin from browser
cg
parents: 368
diff changeset
  5073
scanLineWidth ~~ w ifTrue:[
fceafec7ae61 checkin from browser
cg
parents: 368
diff changeset
  5074
    self halt
fceafec7ae61 checkin from browser
cg
parents: 368
diff changeset
  5075
].
316
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5076
            img := Image width:w height:h depth:depth fromArray:ints.
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5077
        ].
297
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5078
        cmap notNil ifTrue:[
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5079
            img colorMap:cmap.
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5080
            img photometric:#palette
316
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5081
        ] ifFalse:[
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5082
            img photometric:#rgb
297
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5083
        ].
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5084
        opaque ifFalse:[
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5085
            img mask:(ImageReader 
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5086
                        buildMaskFromColor:transparentColorIndex 
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5087
                        for:ints
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5088
                        width:w
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5089
                        height:h)
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5090
        ].
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5091
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5092
        imgRep instVarNamed:'pData' put:img.
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5093
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5094
    ] ifFalse:[
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5095
        self halt.
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5096
    ].
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5097
    ^ 1.
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5098
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5099
    "Created: / 1.2.1998 / 17:38:47 / cg"
373
fceafec7ae61 checkin from browser
cg
parents: 368
diff changeset
  5100
    "Modified: / 5.10.1998 / 15:29:01 / cg"
297
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5101
!
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5102
262
8edf97e626c8 offscreen images & better exception handling
cg
parents: 261
diff changeset
  5103
_OffScreenImageSource_sendPixels:nativeContext
8edf97e626c8 offscreen images & better exception handling
cg
parents: 261
diff changeset
  5104
    "/ self halt.
8edf97e626c8 offscreen images & better exception handling
cg
parents: 261
diff changeset
  5105
8edf97e626c8 offscreen images & better exception handling
cg
parents: 261
diff changeset
  5106
    "Modified: / 16.1.1998 / 18:22:23 / cg"
8edf97e626c8 offscreen images & better exception handling
cg
parents: 261
diff changeset
  5107
    "Created: / 17.1.1998 / 12:36:25 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  5108
! !
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  5109
280
274951f1502c checkin from browser
cg
parents: 277
diff changeset
  5110
!JavaVM class methodsFor:'native - sun.awt - jdk1.2'!
274951f1502c checkin from browser
cg
parents: 277
diff changeset
  5111
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5112
_ColorModel_initIDs:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5113
    "/ new with jdk1.2 ...
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5114
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5115
    "Created: / 28.1.1998 / 22:19:23 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5116
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5117
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5118
_FontDescriptor_initIDs:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5119
    "/ new with jdk1.2 ...
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5120
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5121
    "Created: / 28.1.1998 / 22:30:52 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5122
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5123
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5124
_Font_initIDs:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5125
    "/ new with jdk1.2 ...
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5126
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5127
    "Created: / 27.1.1998 / 21:43:25 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5128
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5129
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5130
_PackedColorModel_initIDs:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5131
    "/ new with jdk1.2 ...
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5132
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5133
    "Created: / 28.1.1998 / 22:19:35 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5134
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5135
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5136
_PlatformFont_initIDs:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5137
    "/ new with jdk1.2 ...
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5138
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5139
    "Created: / 28.1.1998 / 22:30:41 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5140
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5141
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5142
_X11GraphicsDevice_getConfigType:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5143
    "/ new with jdk1.2 ...
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5144
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5145
    |configNr cls|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5146
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5147
    "/ for now, only one config.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5148
    configNr := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5149
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5150
    cls := Java classNamed:'java.awt.GraphicsDevice'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5151
    ^ cls instVarNamed:'TYPE_RASTER_SCREEN'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5152
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5153
    "Created: / 28.1.1998 / 22:19:05 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5154
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5155
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5156
_X11GraphicsDevice_getNumConfigs:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5157
    "/ new with jdk1.2 ...
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5158
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5159
    ^ 1
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5160
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5161
    "Created: / 28.1.1998 / 22:13:26 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5162
    "Modified: / 28.1.1998 / 22:14:33 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5163
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5164
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5165
_X11GraphicsEnvironment_getNumScreens:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5166
    "/ new with jdk1.2 ...
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5167
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5168
    "/ could return the actual number of screens ...
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5169
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5170
    ^ 1
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5171
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5172
    "Created: / 28.1.1998 / 01:50:22 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5173
    "Modified: / 28.1.1998 / 22:12:32 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5174
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5175
280
274951f1502c checkin from browser
cg
parents: 277
diff changeset
  5176
_X11GraphicsEnvironment_initDisplay:nativeContext
274951f1502c checkin from browser
cg
parents: 277
diff changeset
  5177
    "/ new with jdk1.2 ...
274951f1502c checkin from browser
cg
parents: 277
diff changeset
  5178
274951f1502c checkin from browser
cg
parents: 277
diff changeset
  5179
    "Created: / 28.1.1998 / 01:50:22 / cg"
274951f1502c checkin from browser
cg
parents: 277
diff changeset
  5180
! !
274951f1502c checkin from browser
cg
parents: 277
diff changeset
  5181
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5182
!JavaVM class methodsFor:'native - sun.awt.motif - jdk1.2'!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5183
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5184
_InputThread_run:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5185
    self _WToolkit_eventLoop:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5186
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5187
    "Created: / 28.1.1998 / 22:34:47 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5188
    "Modified: / 28.1.1998 / 22:35:16 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5189
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5190
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5191
_MComponentPeer_cacheInit:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5192
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5193
    "Created: / 28.1.1998 / 22:22:30 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5194
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5195
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5196
_MComponentPeer_pInitialize:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5197
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5198
    "Created: / 28.1.1998 / 22:27:25 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5199
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5200
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5201
_MComponentPeer_setCursor:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5202
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5203
    "Created: / 28.1.1998 / 22:27:35 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5204
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5205
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5206
_MFramePeer_create:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5207
    ^ self _WFramePeer_create:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5208
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5209
    "Created: / 28.1.1998 / 22:25:44 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5210
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5211
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5212
_MFramePeer_pHide:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5213
    ^ self _WComponentPeer_hide:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5214
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5215
    "Created: / 28.1.1998 / 22:27:04 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5216
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5217
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5218
_MFramePeer_pReshape:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5219
    self commonReshapeComponent:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5220
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5221
    "Created: / 28.1.1998 / 22:28:00 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5222
    "Modified: / 28.1.1998 / 22:29:34 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5223
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5224
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5225
_MFramePeer_pSetTitle:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5226
    self _WWindowPeer__setTitle:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5227
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5228
    "Created: / 28.1.1998 / 22:30:23 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5229
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5230
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5231
_MToolkit_init:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5232
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5233
    "Created: / 28.1.1998 / 22:21:54 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5234
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5235
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5236
_MToolkit_run:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5237
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5238
    "Created: / 28.1.1998 / 22:22:10 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5239
! !
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5240
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5241
!JavaVM class methodsFor:'native - sun.awt.windows'!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5242
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5243
_WButtonPeer_create:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5244
    |jButtonPeer jButton jFrame frame button
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5245
     lbl|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5246
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5247
    jButtonPeer := nativeContext receiver.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5248
    jButton := jButtonPeer instVarNamed:'target'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5249
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5250
    jFrame := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5251
    frame := jFrame instVarNamed:'pData'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5252
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5253
    button := Button in:frame.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5254
    button action:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5255
			jButtonPeer invoke:#handleAction.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5256
		  ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5257
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5258
    lbl := jButton instVarNamed:'label'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5259
    lbl notNil ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5260
	lbl := Java as_ST_String:lbl.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5261
	button label:lbl
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5262
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5263
    self createdWindowsView:button for:jButtonPeer.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5264
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5265
    WindowCreationTrace == true ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5266
	'WButtonPeer_create: ' print. frame print. ' -> ' print. button printNL.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5267
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5268
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5269
    "Created: / 5.1.1998 / 01:53:30 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5270
    "Modified: / 13.1.1998 / 22:09:15 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5271
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5272
297
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5273
_WButtonPeer_setLabel:nativeContext
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5274
    |label jString|
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5275
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5276
    jString := nativeContext argAt:1.
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5277
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5278
    label := self viewForWPeer:nativeContext.
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5279
    label label:(Java as_ST_String:jString)
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5280
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5281
    "Modified: / 8.1.1998 / 17:35:50 / cg"
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5282
    "Created: / 1.2.1998 / 17:05:47 / cg"
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5283
!
fc59bf939294 checkin from browser
cg
parents: 285
diff changeset
  5284
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5285
_WCanvasPeer_create:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5286
    |jCanvasPeer jFrame frame subView|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5287
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5288
    jCanvasPeer := nativeContext receiver.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5289
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5290
    jFrame := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5291
    jFrame isNil ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5292
	self halt:'no frame in canvasPeer create'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5293
	self internalError:'no frame in canvasPeer create'.     
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5294
	^ self.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5295
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5296
    frame := jFrame instVarNamed:'pData'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5297
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5298
    subView := JavaView in:frame.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5299
    subView delegate:self.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5300
    subView javaPeer:jCanvasPeer.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5301
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5302
    self createdWindowsView:subView for:jCanvasPeer.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5303
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5304
    WindowCreationTrace == true ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5305
	'WCanvasPeer_create: ' print. frame print. ' -> ' print. subView printNL.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5306
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5307
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5308
    "Created: / 5.1.1998 / 00:59:19 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5309
    "Modified: / 16.1.1998 / 13:40:00 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5310
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5311
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5312
_WCheckboxPeer_create:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5313
    |jCheckboxPeer jCheckbox jFrame frame checkBox lbl|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5314
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5315
    jCheckboxPeer := nativeContext receiver.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5316
    jCheckbox := jCheckboxPeer instVarNamed:'target'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5317
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5318
    jFrame := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5319
    frame := jFrame instVarNamed:'pData'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5320
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5321
    checkBox := CheckBox in:frame.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5322
    checkBox action:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5323
			jCheckboxPeer 
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5324
			    perform:#'handleAction(Z)V' 
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5325
			    with:(checkBox isOn ifTrue:[1] ifFalse:[0])
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5326
		    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5327
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5328
    lbl := jCheckbox instVarNamed:'label'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5329
    lbl notNil ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5330
	lbl := Java as_ST_String:lbl.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5331
	checkBox label:lbl
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5332
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5333
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5334
    self createdWindowsView:checkBox for:jCheckboxPeer.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5335
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5336
    WindowCreationTrace == true ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5337
	'WCheckboxPeer_create: ' print. frame print. ' -> ' print. checkBox printNL.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5338
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5339
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5340
    "Created: / 7.1.1998 / 21:48:03 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5341
    "Modified: / 15.1.1998 / 12:27:04 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5342
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5343
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5344
_WCheckboxPeer_setCheckboxGroup:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5345
    |checkBox jGroup|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5346
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5347
    checkBox := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5348
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5349
    jGroup := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5350
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5351
    "Created: / 7.1.1998 / 21:48:47 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5352
    "Modified: / 25.1.1998 / 01:20:42 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5353
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5354
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5355
_WCheckboxPeer_setState:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5356
    |checkBox state|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5357
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5358
    checkBox := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5359
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5360
    state := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5361
    state ~~ 0 ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5362
        checkBox turnOn
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5363
    ] ifFalse:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5364
        checkBox turnOff
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5365
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5366
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5367
    "Created: / 7.1.1998 / 21:49:13 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5368
    "Modified: / 25.1.1998 / 01:26:18 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5369
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5370
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5371
_WChoicePeer_addItem:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5372
    |jString index comboBox|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5373
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5374
    comboBox := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5375
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5376
    jString := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5377
    index := nativeContext argAt:2.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5378
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5379
    comboBox model list addLast:(Java as_ST_String:jString).
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5380
    comboBox model changed:#list.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5381
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5382
    "Created: / 7.1.1998 / 21:45:12 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5383
    "Modified: / 24.1.1998 / 18:51:32 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5384
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5385
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5386
_WChoicePeer_create:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5387
    |jChoicePeer jChoice jFrame frame comboBox|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5388
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5389
    jChoicePeer := nativeContext receiver.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5390
    jChoice := jChoicePeer instVarNamed:'target'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5391
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5392
    jFrame := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5393
    frame := jFrame instVarNamed:'pData'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5394
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5395
    comboBox := ComboListView in:frame.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5396
    comboBox model:(SelectionInList new list:(OrderedCollection new)).
285
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  5397
    comboBox action:[:index | 
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  5398
                        jChoicePeer 
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  5399
                            perform:#'handleAction(I)V' 
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  5400
                            with:(comboBox model selectionIndex - 1)
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  5401
                    ].
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5402
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5403
    self createdWindowsView:comboBox for:jChoicePeer.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5404
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5405
    WindowCreationTrace == true ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5406
        'WChoicePeer_create: ' print. frame print. ' -> ' print. comboBox printNL.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5407
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5408
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5409
    "Created: / 7.1.1998 / 21:44:31 / cg"
285
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  5410
    "Modified: / 28.1.1998 / 23:19:17 / cg"
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5411
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5412
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5413
_WChoicePeer_reshape:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5414
    self pReshape:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5415
    ^ self.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5416
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5417
    "Modified: / 15.8.1997 / 15:36:29 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5418
    "Created: / 7.1.1998 / 21:46:18 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5419
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5420
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5421
_WChoicePeer_select:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5422
    |comboBox index|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5423
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5424
    comboBox := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5425
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5426
    index := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5427
    comboBox model selectionIndex:(index + 1).  "/ JAVA indexing starts at 0
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5428
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5429
    "Created: / 7.1.1998 / 21:45:43 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5430
    "Modified: / 25.1.1998 / 09:55:05 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5431
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5432
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5433
_WClipboard_init:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5434
"/ self halt.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5435
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5436
    "Modified: / 18.3.1997 / 18:43:18 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5437
    "Created: / 4.1.1998 / 19:03:59 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5438
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5439
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5440
_WColor_getDefaultColor:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5441
    |clrIndex jClr clr |
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5442
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5443
    clrIndex := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5444
    "/ windows defaults:
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5445
    "/  1: view background
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5446
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5447
    clrIndex == 1 ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5448
	clr := View defaultViewBackgroundColor.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5449
	clr isColor ifFalse:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5450
	    clr := Color gray:50.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5451
	].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5452
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5453
    clrIndex == 2 ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5454
	clr := Color black.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5455
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5456
    clr isNil ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5457
	self halt.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5458
	self internalError:'breakpoint'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5459
	^ nil.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5460
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5461
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5462
    clr := clr on:(Screen current).
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5463
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5464
    jClr := (Java classForName:'java.awt.Color') new.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5465
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5466
    jClr instVarNamed:'pData' put:clr.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5467
    jClr instVarNamed:'value' put:(clr rgbValue).
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5468
"/ self halt.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5469
    ^ jClr.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5470
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5471
    "Created: / 15.8.1997 / 15:38:10 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5472
    "Modified: / 4.1.1998 / 18:06:51 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5473
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5474
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5475
_WComponentPeer__dispose:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5476
    |view jPeer|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5477
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5478
    view := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5479
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5480
    Object errorSignal catch:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5481
        view destroy.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5482
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5483
    JavaWindowGroup removeView:view.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5484
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5485
    jPeer := nativeContext receiver.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5486
    jPeer instVarNamed:'pData' put:0.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5487
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5488
    "Created: / 7.1.1998 / 22:36:25 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5489
    "Modified: / 25.1.1998 / 16:43:06 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5490
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5491
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5492
_WComponentPeer__setBackground:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5493
    |rgb clr view|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5494
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5495
    view := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5496
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5497
    rgb := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5498
    clr := Color rgbValue:rgb.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5499
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5500
"/ self halt.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5501
"/ self internalError:'breakPoint'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5502
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5503
    clr := clr on:(view device).
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5504
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5505
"/    (view superView isMemberOf:JavaEmbeddedFrameView) ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5506
"/        view viewBackground:(view superView viewBackground).
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5507
"/        view backgroundPaint:(view superView viewBackground).
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5508
"/    ] ifFalse:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5509
"/        (view isMemberOf:JavaView) ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5510
"/            view viewBackground:clr.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5511
"/            view backgroundPaint:clr.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5512
"/        ]
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5513
"/    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5514
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5515
    (view isKindOf:ScrollableView) ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5516
	view := view scrolledView
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5517
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5518
    view viewBackground:clr.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5519
    view backgroundPaint:clr.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5520
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5521
    "Created: / 4.1.1998 / 18:07:39 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5522
    "Modified: / 15.1.1998 / 13:06:44 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5523
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5524
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5525
_WComponentPeer__setForeground:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5526
    |rgb clr view|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5527
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5528
    view := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5529
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5530
    rgb := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5531
    clr := Color rgbValue:rgb.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5532
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5533
"/ self halt.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5534
"/ self internalError:'breakPoint'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5535
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5536
    clr := clr on:(view device).
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5537
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5538
    view paint:clr.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5539
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5540
    "Created: / 4.1.1998 / 18:08:13 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5541
    "Modified: / 8.1.1998 / 17:32:45 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5542
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5543
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5544
_WComponentPeer_disable:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5545
    |view|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5546
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5547
    view := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5548
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5549
    Object errorSignal handle:[:ex |
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5550
    ] do:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5551
	view disable
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5552
    ]
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5553
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5554
    "Created: / 6.1.1998 / 18:26:36 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5555
    "Modified: / 8.1.1998 / 17:32:53 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5556
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5557
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5558
_WComponentPeer_enable:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5559
    |view|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5560
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5561
    view := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5562
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5563
    Object errorSignal handle:[:ex |
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5564
    ] do:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5565
	view enable
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5566
    ]
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5567
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5568
    "Modified: / 8.1.1998 / 17:32:53 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5569
    "Created: / 13.1.1998 / 23:08:05 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5570
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5571
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5572
_WComponentPeer_handleEvent:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5573
    "this is invoked by java, to let a widget handle any event which
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5574
     was not consumed (eaten) by java.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5575
     If the view in question is some ST-widget, forward it.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5576
     Ignore for JavaViews."
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5577
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5578
    |view jEv stEv|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5579
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5580
    view := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5581
    view notNil ifTrue:[
316
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5582
        (view isKindOf:JavaView) ifFalse:[
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5583
            jEv := nativeContext argAt:1.
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5584
            stEv := jEv instVarNamed:'data'.
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5585
            (stEv notNil and:[stEv ~~ 0]) ifTrue:[
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5586
                EventTrace == true ifTrue:[
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5587
                    ('JAVA: WComponent - handleEvent: ' , stEv type , ' for ' , view printString) infoPrintCR.
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5588
                ].
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5589
                stEv sendEventWithFocusOn:nil.
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5590
                ^ self.
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5591
            ]
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5592
        ]
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5593
    ].
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5594
    EventTrace == true ifTrue:[
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5595
        ('JAVA: WComponent - handleEvent ignored') infoPrintCR.
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5596
    ]
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5597
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5598
    "Created: / 6.1.1998 / 21:10:17 / cg"
316
beb8e55ba106 removed debugPrints
cg
parents: 307
diff changeset
  5599
    "Modified: / 6.2.1998 / 00:54:42 / cg"
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5600
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5601
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5602
_WComponentPeer_hide:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5603
    |view|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5604
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5605
    view := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5606
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5607
    Object errorSignal handle:[:ex |
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5608
    ] do:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5609
	view beInvisible
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5610
    ]
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5611
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5612
    "Created: / 7.1.1998 / 22:35:32 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5613
    "Modified: / 8.1.1998 / 17:33:08 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5614
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5615
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5616
_WComponentPeer_requestFocus:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5617
    |view|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5618
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5619
    view := self viewForWPeer:nativeContext.
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  5620
"/ 'getFocus - ' print. view displayString printCR.
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5621
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5622
    view getKeyboardFocus
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5623
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5624
    "Created: / 7.1.1998 / 22:30:03 / cg"
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  5625
    "Modified: / 6.2.1998 / 02:22:17 / cg"
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5626
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5627
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5628
_WComponentPeer_reshape:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5629
    self commonReshapeComponent:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5630
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5631
    "Modified: / 18.3.1997 / 19:30:21 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5632
    "Created: / 4.1.1998 / 18:01:11 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5633
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5634
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5635
_WComponentPeer_setCursor:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5636
    |view|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5637
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5638
    view := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5639
"/ self halt.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5640
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5641
    "Created: / 5.1.1998 / 01:52:30 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5642
    "Modified: / 25.1.1998 / 01:21:52 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5643
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5644
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5645
_WComponentPeer_setFont:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5646
    |view|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5647
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5648
    view := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5649
"/ self halt.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5650
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5651
    "Created: / 5.1.1998 / 00:55:17 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5652
    "Modified: / 25.1.1998 / 01:22:19 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5653
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5654
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5655
_WComponentPeer_setZOrderPosition:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5656
    |view|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5657
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5658
    view := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5659
"/    self unimplementedNativeMethod.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5660
"/ self halt.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5661
"/ self internalError:'breakPoint'
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5662
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5663
    "Created: / 4.1.1998 / 17:59:26 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5664
    "Modified: / 25.1.1998 / 01:22:32 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5665
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5666
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5667
_WComponentPeer_show:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5668
    |view|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5669
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5670
    view := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5671
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5672
    "/ frame views are under my browsers own control
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5673
    (view isMemberOf:JavaEmbeddedFrameView) ifFalse:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5674
        view beVisible.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5675
        view realize.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5676
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5677
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5678
"/    view windowGroup notNil ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5679
"/        windowServer addGroup:(view windowGroup)
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5680
"/    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5681
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5682
    ^ nil
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5683
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5684
"/ self halt.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5685
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5686
    "Created: / 5.1.1998 / 01:26:22 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5687
    "Modified: / 25.1.1998 / 09:54:07 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5688
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5689
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5690
_WComponentPeer_start:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5691
"/ self halt.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5692
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5693
    "Modified: / 18.3.1997 / 18:43:18 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5694
    "Created: / 5.1.1998 / 00:58:40 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5695
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5696
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5697
_WDefaultFontCharset_canConvert:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5698
    ^ 1
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5699
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5700
    "Modified: / 21.8.1997 / 15:56:57 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5701
    "Created: / 5.1.1998 / 01:55:47 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5702
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5703
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5704
_WDialogPeer__hide:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5705
    |dialog|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5706
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5707
    dialog := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5708
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5709
    dialog hide.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5710
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5711
    "Created: / 7.1.1998 / 22:34:10 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5712
    "Modified: / 8.1.1998 / 17:34:10 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5713
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5714
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5715
_WDialogPeer__show:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5716
    |dialog|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5717
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5718
    dialog := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5719
"/
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5720
"/ show does not work (yet); must setup windowgroup
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5721
"/ for it to get events ...
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5722
"/    dialog show.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5723
    dialog realize.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5724
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5725
    "Created: / 7.1.1998 / 21:52:15 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5726
    "Modified: / 15.1.1998 / 15:57:03 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5727
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5728
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5729
_WDialogPeer_create:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5730
    |jDialogPeer dialog|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5731
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5732
    jDialogPeer := nativeContext receiver.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5733
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5734
    dialog := ModalBox new.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5735
    jDialogPeer instVarNamed:'pData' put:dialog.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5736
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5737
    self createdWindowsView:dialog for:jDialogPeer.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5738
    dialog windowGroup:JavaWindowGroup.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5739
    JavaWindowGroup addTopView:dialog.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5740
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5741
    WindowCreationTrace == true ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5742
	'WDialogPeer_create: ' print. dialog printNL.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5743
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5744
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5745
    "Created: / 7.1.1998 / 21:51:00 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5746
    "Modified: / 15.1.1998 / 16:12:44 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5747
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5748
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5749
_WFileDialogPeer_show:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5750
    |jDialogPeer jDialog dialogView stDialog 
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5751
     title dir pattern f|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5752
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5753
    jDialogPeer := nativeContext receiver.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5754
    jDialog := jDialogPeer instVarNamed:'target'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5755
    dialogView := jDialogPeer instVarNamed:'pData'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5756
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5757
    stDialog := FileSelectionBox new.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5758
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5759
    dir := jDialog instVarNamed:'dir'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5760
    dir notNil ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5761
	stDialog directory:(Java as_ST_String:dir).
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5762
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5763
    pattern := jDialog instVarNamed:'file'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5764
    pattern notNil ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5765
	stDialog pattern:(Java as_ST_String:pattern).
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5766
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5767
    title := jDialog instVarNamed:'title'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5768
    title notNil ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5769
	stDialog title:(Java as_ST_String:title).
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5770
	stDialog label:(Java as_ST_String:title).
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5771
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5772
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5773
    stDialog show.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5774
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5775
    stDialog accepted ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5776
	f := stDialog pathName.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5777
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5778
	"/ cannot use the one below - it has a builtIn fileSeparator if '\' (sigh)
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5779
	"/ jDialogPeer perform:#'handleSelected(Ljava/lang/String;)V' with:(Java as_String:f).
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5780
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5781
	jDialog 
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5782
	    perform:#'setFile(Ljava/lang/String;)V' 
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5783
	    with:(Java as_String:(f asFilename baseName)).
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5784
	jDialog 
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5785
	    perform:#'setDirectory(Ljava/lang/String;)V'
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5786
	    with:(Java as_String:(f asFilename directoryName , Filename separator asString)).
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5787
	jDialog 
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5788
	    perform:#'setVisible(Z)V'
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5789
	    with:0.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5790
    ] ifFalse:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5791
	jDialogPeer 
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5792
	    perform:#'handleCancel()V'
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5793
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5794
"/ self halt.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5795
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5796
    "Created: / 7.1.1998 / 22:38:45 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5797
    "Modified: / 15.1.1998 / 13:04:05 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5798
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5799
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5800
_WFontMetrics_getMFCharSegmentWidth:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5801
    "get multi-font string-segment width.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5802
     Not yet supported - use standard strings width"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5803
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5804
    |jMetrics jFont jFontDescr stFont w
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5805
     bool1 cp offs lenght bp int1|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5806
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5807
    jMetrics := nativeContext receiver.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5808
    jFont := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5809
    jFontDescr := nativeContext argAt:2.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5810
    bool1 := nativeContext argAt:3.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5811
    cp := nativeContext argAt:4.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5812
    offs := nativeContext argAt:5.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5813
    lenght := nativeContext argAt:6.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5814
    bp := nativeContext argAt:7.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5815
    int1 := nativeContext argAt:8.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5816
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5817
    stFont := jFont instVarNamed:'pData'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5818
    (stFont isNil or:[stFont == 0]) ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5819
	self halt
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5820
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5821
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5822
    stFont device isNil ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5823
	stFont := stFont on:Display.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5824
	jFont instVarNamed:'pData' put:stFont.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5825
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5826
    w := stFont widthOf:cp from:offs+1 to:offs+lenght.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5827
    ^ w.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5828
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5829
    "Created: / 5.1.1998 / 01:57:45 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5830
    "Modified: / 13.1.1998 / 23:44:03 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5831
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5832
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5833
_WFontMetrics_init:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5834
    |jMetrics jFont stFont widths family name style size|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5835
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5836
    jMetrics := nativeContext receiver.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5837
    jFont := jMetrics instVarNamed:'font'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5838
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5839
    family := jFont instVarNamed:'family'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5840
    family := Java as_ST_String:family.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5841
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5842
    name := jFont instVarNamed:'name'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5843
    name := Java as_ST_String:name.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5844
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5845
    style := jFont instVarNamed:'style'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5846
    size := jFont instVarNamed:'size'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5847
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5848
    stFont := Font family:family size:size.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5849
    stFont isNil ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5850
	stFont := Font family:'helvetica' size:size.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5851
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5852
    stFont := stFont on:Display.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5853
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5854
"/    stFont := jFont instVarNamed:'pData'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5855
"/    stFont isNil ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5856
"/        self halt
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5857
"/    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5858
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5859
    stFont := stFont on:Display.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5860
    jFont instVarNamed:'pData' put:stFont.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5861
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5862
    jMetrics instVarNamed:'ascent'     put:stFont ascent.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5863
    jMetrics instVarNamed:'descent'    put:stFont descent.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5864
    jMetrics instVarNamed:'leading'    put:0.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5865
    jMetrics instVarNamed:'height'     put:stFont height.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5866
    jMetrics instVarNamed:'maxAscent'  put:stFont maxAscent.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5867
    jMetrics instVarNamed:'maxDescent' put:stFont maxDescent.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5868
    jMetrics instVarNamed:'maxHeight'  put:stFont maxHeight.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5869
    jMetrics instVarNamed:'maxAdvance' put:stFont maxWidth.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5870
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5871
    widths := Array new:256.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5872
    0 to:255 do:[:i |
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5873
	widths at:(i+1) put:(stFont widthOf:(Character value:i))
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5874
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5875
    jMetrics instVarNamed:'widths' put:widths.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5876
"/ self halt.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5877
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5878
    "Modified: / 8.8.1997 / 12:06:53 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5879
    "Created: / 5.1.1998 / 01:54:29 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5880
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5881
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5882
_WFontMetrics_needsConversion:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5883
    |jFont jFontDescr stFont|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5884
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5885
    jFont := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5886
    jFontDescr := nativeContext argAt:2.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5887
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5888
    stFont := jFont instVarNamed:'pData'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5889
"/    stFont isNil ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5890
"/        self halt
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5891
"/    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5892
"/    stFont device isNil ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5893
"/        stFont := stFont on:Display.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5894
"/        jFont instVarNamed:'pData' put:stFont.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5895
"/    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5896
"/
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5897
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5898
    ^ 0
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5899
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5900
    "Modified: / 17.8.1997 / 17:16:29 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5901
    "Created: / 5.1.1998 / 01:56:42 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5902
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5903
341
a11a6523de53 checkin from browser
cg
parents: 339
diff changeset
  5904
_WFramePeer__setIconImage:nativeContext
a11a6523de53 checkin from browser
cg
parents: 339
diff changeset
  5905
    |frame imgRep image|
a11a6523de53 checkin from browser
cg
parents: 339
diff changeset
  5906
a11a6523de53 checkin from browser
cg
parents: 339
diff changeset
  5907
    frame := self viewForWPeer:nativeContext.
a11a6523de53 checkin from browser
cg
parents: 339
diff changeset
  5908
    imgRep := nativeContext argAt:1.
a11a6523de53 checkin from browser
cg
parents: 339
diff changeset
  5909
    imgRep notNil ifTrue:[
a11a6523de53 checkin from browser
cg
parents: 339
diff changeset
  5910
        image := imgRep instVarNamed:'pData'.
a11a6523de53 checkin from browser
cg
parents: 339
diff changeset
  5911
        image notNil ifTrue:[
a11a6523de53 checkin from browser
cg
parents: 339
diff changeset
  5912
            frame icon:image.
a11a6523de53 checkin from browser
cg
parents: 339
diff changeset
  5913
        ]
a11a6523de53 checkin from browser
cg
parents: 339
diff changeset
  5914
    ].
a11a6523de53 checkin from browser
cg
parents: 339
diff changeset
  5915
a11a6523de53 checkin from browser
cg
parents: 339
diff changeset
  5916
    "Created: / 27.4.1998 / 17:15:09 / cg"
a11a6523de53 checkin from browser
cg
parents: 339
diff changeset
  5917
    "Modified: / 27.4.1998 / 17:18:24 / cg"
a11a6523de53 checkin from browser
cg
parents: 339
diff changeset
  5918
!
a11a6523de53 checkin from browser
cg
parents: 339
diff changeset
  5919
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5920
_WFramePeer_create:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5921
    |jFramePeer jFrame frame pDataIdx|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5922
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5923
    jFramePeer := nativeContext receiver.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5924
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5925
    "/ for now: a kludge to create an embedded frame for
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5926
    "/ mozillaFrames
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5927
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5928
    jFrame := jFramePeer instVarNamed:'target'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5929
    (jFrame notNil 
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5930
    and:[(pDataIdx := jFrame class instVarOffsetOf:'pData') notNil])
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5931
    ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5932
        ((frame := jFrame instVarAt:pDataIdx) notNil 
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5933
        and:[frame ~~ 0]) ifTrue:[
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  5934
            WindowCreationTrace == true ifTrue:[
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  5935
                'JAVA: targetFrame view already created: ' infoPrintCR.
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  5936
            ].
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5937
            "/ sigh; pData was renamed to pNativeWidget in jdk1.2 ...
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5938
            pDataIdx := jFramePeer class instVarOffsetOf:'pNativeWidget'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5939
            pDataIdx isNil ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5940
                "/ ok, we are < 1.2
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5941
                pDataIdx := jFramePeer class instVarOffsetOf:'pData'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5942
            ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5943
            jFramePeer instVarAt:pDataIdx put:frame.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5944
        ]
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5945
    ] ifFalse:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5946
        frame := jFramePeer instVarNamed:'pData'
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5947
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5948
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5949
    (frame notNil and:[frame ~~ 0]) ifTrue:[
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  5950
        WindowCreationTrace == true ifTrue:[
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  5951
            'JAVA: frame view already created: ' infoPrint.
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  5952
            jFramePeer class name infoPrintCR.
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  5953
        ].
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5954
    ] ifFalse:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5955
        frame := StandardSystemView new.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5956
        self createdWindowsView:frame for:jFramePeer.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5957
        JavaWindowGroup addTopView:frame.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5958
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5959
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5960
    WindowCreationTrace == true ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5961
        'JAVA: WFramePeer_create: ' print. jFramePeer displayString print.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5962
        ' frame: ' print. frame printNL.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5963
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5964
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5965
    "Created: / 4.1.1998 / 17:56:39 / cg"
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  5966
    "Modified: / 6.2.1998 / 02:29:00 / cg"
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5967
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5968
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5969
_WFramePeer_setMenuBar0:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5970
    |frame jMenuBarPeer menuPanel|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5971
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5972
    frame := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5973
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5974
    jMenuBarPeer := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5975
    jMenuBarPeer isNil ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5976
	"/ mhmh - JAVA wants to remove the frames menuPanel.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5977
	"/ but I have no handle on it (for destroy).
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5978
	"/ search it in subViews of the frame.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5979
	frame subViews copy do:[:v |
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5980
	    (v isKindOf:MenuPanel) ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5981
		v destroy
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5982
	    ]
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5983
	]
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5984
    ] ifFalse:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5985
	menuPanel := jMenuBarPeer instVarNamed:'pData'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5986
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5987
	menuPanel origin:0.0@0.0 corner:1.0@(menuPanel preferredExtent y).
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5988
	frame addSubView:menuPanel.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5989
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5990
    ^ nil
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5991
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5992
    "Created: / 7.1.1998 / 21:41:35 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5993
    "Modified: / 8.1.1998 / 17:35:04 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5994
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5995
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5996
_WGraphics_changeClip:nativeContext        
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5997
    |gc x y w h bool|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5998
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  5999
    gc := self gcForWGraphics:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6000
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6001
"/ ignored for now;
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6002
"/ Clock does incorrect repaints if enabled.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6003
"/ TODO: fix that ...
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6004
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6005
    x := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6006
    y := nativeContext argAt:2.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6007
    w := nativeContext argAt:3.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6008
    h := nativeContext argAt:4.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6009
    bool := (nativeContext argAt:5) ~~ 0.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6010
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6011
"/    gc clipRect:(Rectangle left:x top:y width:w height:h).
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6012
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6013
    "Created: / 6.1.1998 / 20:57:21 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6014
    "Modified: / 25.1.1998 / 12:51:55 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6015
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6016
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6017
_WGraphics_clearRect:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6018
    |gc x y w h|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6019
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6020
    gc := self gcForWGraphics:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6021
"/    gc isNil ifTrue:[^ self].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6022
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6023
    gc realized ifFalse:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6024
	'JAVA: drawing on unrealized gc - ignored' infoPrintCR.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6025
	^ self
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6026
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6027
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6028
    x := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6029
    y := nativeContext argAt:2.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6030
    w := nativeContext argAt:3.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6031
    h := nativeContext argAt:4.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6032
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6033
"/ self halt.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6034
"/ self internalError:'breakPoint'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6035
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6036
    gc clearRectangleX:x y:y width:w height:h.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6037
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6038
    "Created: / 8.1.1998 / 00:16:00 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6039
    "Modified: / 8.1.1998 / 00:21:09 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6040
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6041
337
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6042
_WGraphics_copyArea:nativeContext
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6043
    |gc srcX srcY w h deltaX deltaY|
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6044
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6045
    gc := self gcForWGraphics:nativeContext.
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6046
"/    gc isNil ifTrue:[^ self].
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6047
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6048
    gc realized ifFalse:[
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6049
        'JAVA: copyArea on unrealized gc - ignored' infoPrintCR.
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6050
        ^ self
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6051
    ].
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6052
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6053
    srcX := nativeContext argAt:1.
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6054
    srcY := nativeContext argAt:2.
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6055
    w := nativeContext argAt:3.
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6056
    h := nativeContext argAt:4.
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6057
    deltaX := nativeContext argAt:5.
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6058
    deltaY := nativeContext argAt:6.
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6059
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6060
    gc
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6061
        copyFrom:gc
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6062
        x:srcX y:srcY 
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6063
        toX:srcX+deltaX y:srcY+deltaY 
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6064
        width:w height:h
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6065
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6066
    "Created: / 8.1.1998 / 00:16:00 / cg"
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6067
    "Modified: / 9.4.1998 / 22:01:32 / cg"
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6068
!
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6069
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6070
_WGraphics_createFromComponent:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6071
    |jGraphics jWin view|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6072
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6073
    jGraphics := nativeContext receiver.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6074
    jWin := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6075
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6076
    view := KnownWindows at:jWin ifAbsent:nil.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6077
    view isNil ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6078
	self halt.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6079
	^ self
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6080
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6081
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6082
"/    "/ just a consistency check ...
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6083
"/    (jWin instVarNamed:'xid') ~~ view ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6084
"/        self halt:'consistency check'
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6085
"/    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6086
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6087
    jGraphics instVarNamed:'pData' put:view.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6088
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6089
    "Created: / 6.1.1998 / 20:55:18 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6090
    "Modified: / 15.1.1998 / 13:49:56 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6091
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6092
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6093
_WGraphics_createFromGraphics:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6094
    |jGraphics graphics gc|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6095
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6096
    jGraphics := nativeContext receiver.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6097
    graphics := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6098
    gc := graphics instVarNamed:'pData'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6099
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6100
    jGraphics instVarNamed:'pData' put:gc.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6101
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6102
    "Created: / 8.1.1998 / 00:47:39 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6103
    "Modified: / 25.1.1998 / 10:57:25 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6104
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6105
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6106
_WGraphics_dispose:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6107
    |gc|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6108
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6109
    gc := self gcForWGraphics:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6110
    gc isNil ifTrue:[^ self].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6111
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6112
    "Created: / 6.1.1998 / 20:58:38 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6113
    "Modified: / 8.1.1998 / 00:19:09 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6114
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6115
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6116
_WGraphics_drawArc:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6117
    |gc x y w h startAngle endAngle|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6118
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6119
    gc := self gcForWGraphics:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6120
"/    gc isNil ifTrue:[^ self].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6121
    gc realized ifFalse:[^ self].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6122
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6123
    x := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6124
    y := nativeContext argAt:2.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6125
    w := nativeContext argAt:3.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6126
    h := nativeContext argAt:4.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6127
    startAngle := nativeContext argAt:5.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6128
    endAngle := nativeContext argAt:6.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6129
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6130
    DrawOPTrace ifTrue:[
285
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6131
        'drawArc x/y= ' print. x print. '@' print. y print. 
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6132
               ' w/h= ' print. w print. '@' print. h print.
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6133
               ' startAngle= ' print. startAngle print. ' endAngle= ' print. endAngle printCR.
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6134
    ].
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6135
    gc 
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6136
        displayArcX:x y:y 
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6137
        width:w height:h 
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6138
        from:startAngle angle:(endAngle - startAngle).
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6139
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6140
    "Created: / 6.1.1998 / 21:00:15 / cg"
285
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6141
    "Modified: / 28.1.1998 / 23:23:42 / cg"
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6142
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6143
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6144
_WGraphics_drawLine:nativeContext        
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6145
    |gc x y x2 y2|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6146
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6147
    gc := self gcForWGraphics:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6148
"/    gc isNil ifTrue:[^ self].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6149
    gc realized ifFalse:[^ self].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6150
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6151
    x := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6152
    y := nativeContext argAt:2.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6153
    x2 := nativeContext argAt:3.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6154
    y2 := nativeContext argAt:4.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6155
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6156
    DrawOPTrace ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6157
	'drawLine x/y= ' print. x print. '@' print. y print. ' x2/y2= ' print. x2 print. '@' print. y2 printCR.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6158
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6159
    gc displayLineFromX:x y:y toX:x2 y:y2
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6160
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6161
    "Created: / 6.1.1998 / 20:59:27 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6162
    "Modified: / 8.1.1998 / 00:34:23 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6163
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6164
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6165
_WGraphics_drawMFCharsSegment:nativeContext       
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6166
    |jFont jFontDescr s gc x y offs len|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6167
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6168
    gc := self gcForWGraphics:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6169
    gc realized ifFalse:[^ self].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6170
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6171
    jFont := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6172
    jFontDescr := nativeContext argAt:2.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6173
    s := nativeContext argAt:3.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6174
    offs := nativeContext argAt:4.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6175
    len := nativeContext argAt:5.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6176
    x := nativeContext argAt:6.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6177
    y := nativeContext argAt:7.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6178
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6179
    DrawOPTrace ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6180
        'drawMFCharsSegment x/y= ' print. x print. '@' print. y print. ' s= ' print. s printCR.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6181
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6182
    gc displayString:s from:offs+1 to:offs+len x:x y:y.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6183
    ^ (gc font onDevice:(gc graphicsDevice)) widthOf:s.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6184
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6185
    "Created: / 6.1.1998 / 21:01:07 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6186
    "Modified: / 25.1.1998 / 20:45:55 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6187
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6188
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6189
_WGraphics_drawOval:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6190
    |gc x y w h|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6191
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6192
    gc := self gcForWGraphics:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6193
"/    gc isNil ifTrue:[^ self].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6194
    gc realized ifFalse:[^ self].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6195
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6196
    x := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6197
    y := nativeContext argAt:2.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6198
    w := nativeContext argAt:3.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6199
    h := nativeContext argAt:4.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6200
337
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6201
    DrawOPTrace ifTrue:[
285
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6202
        'drawOval x/y= ' print. x print. '@' print. y print. 
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6203
                ' w/h= ' print. w print. '@' print. h printCR.
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6204
    ].
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6205
    gc displayArcX:x y:y width:w height:h from:0 angle:360.
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6206
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6207
    "Created: / 8.1.1998 / 00:44:31 / cg"
337
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6208
    "Modified: / 9.4.1998 / 22:10:23 / cg"
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6209
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6210
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6211
_WGraphics_drawPolygon:nativeContext        
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6212
    |gc xVector yVector count points|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6213
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6214
    gc := self gcForWGraphics:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6215
"/    gc isNil ifTrue:[^ self].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6216
    gc realized ifFalse:[^ self].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6217
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6218
    xVector := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6219
    yVector := nativeContext argAt:2.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6220
    count := nativeContext argAt:3.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6221
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6222
    DrawOPTrace ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6223
	'drawPolgon' printCR.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6224
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6225
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6226
    points := (1 to:count) collect:[:i | (xVector at:i) @ (yVector at:i)].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6227
    gc displayPolygon:points
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6228
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6229
    "Created: / 8.1.1998 / 00:57:28 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6230
    "Modified: / 8.1.1998 / 00:57:49 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6231
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6232
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6233
_WGraphics_drawRect:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6234
    |gc x y w h|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6235
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6236
    gc := self gcForWGraphics:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6237
"/    gc isNil ifTrue:[^ self].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6238
    gc realized ifFalse:[^ self].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6239
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6240
    x := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6241
    y := nativeContext argAt:2.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6242
    w := nativeContext argAt:3.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6243
    h := nativeContext argAt:4.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6244
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6245
"/ self halt.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6246
"/ self internalError:'breakPoint'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6247
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6248
    gc displayRectangleX:x y:y width:w height:h.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6249
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6250
    "Modified: / 8.1.1998 / 00:34:33 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6251
    "Created: / 8.1.1998 / 00:59:05 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6252
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6253
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6254
_WGraphics_drawRoundRect:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6255
    |gc x y w h|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6256
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6257
    gc := self gcForWGraphics:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6258
"/    gc isNil ifTrue:[^ self].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6259
    gc realized ifFalse:[^ self].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6260
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6261
    x := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6262
    y := nativeContext argAt:2.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6263
    w := nativeContext argAt:3.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6264
    h := nativeContext argAt:4.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6265
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6266
"/ self halt.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6267
"/ self internalError:'breakPoint'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6268
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6269
    gc displayRectangleX:x y:y width:w height:h.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6270
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6271
    "Modified: / 8.1.1998 / 00:34:33 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6272
    "Created: / 8.1.1998 / 00:59:26 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6273
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6274
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6275
_WGraphics_fillArc:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6276
    |gc x y w h startAngle endAngle|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6277
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6278
    gc := self gcForWGraphics:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6279
"/    gc isNil ifTrue:[^ self].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6280
    gc realized ifFalse:[^ self].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6281
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6282
    x := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6283
    y := nativeContext argAt:2.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6284
    w := nativeContext argAt:3.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6285
    h := nativeContext argAt:4.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6286
    startAngle := nativeContext argAt:5.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6287
    endAngle := nativeContext argAt:6.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6288
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6289
    DrawOPTrace ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6290
	'fillArc x/y= ' print. x print. '@' print. y print. 
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6291
	       ' w/h= ' print. w print. '@' print. h print.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6292
	       ' startAngle= ' print. startAngle print. ' endAngle= ' print. endAngle printCR.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6293
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6294
    gc fillArcX:x y:y width:w height:h from:startAngle angle:(endAngle - startAngle)
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6295
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6296
    "Created: / 6.1.1998 / 21:11:31 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6297
    "Modified: / 8.1.1998 / 00:33:59 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6298
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6299
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6300
_WGraphics_fillOval:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6301
    |gc x y w h|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6302
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6303
    gc := self gcForWGraphics:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6304
"/    gc isNil ifTrue:[^ self].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6305
    gc realized ifFalse:[^ self].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6306
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6307
    x := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6308
    y := nativeContext argAt:2.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6309
    w := nativeContext argAt:3.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6310
    h := nativeContext argAt:4.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6311
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6312
    DrawOPTrace ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6313
	'drawOval x/y= ' print. x print. '@' print. y print. 
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6314
		' w/h= ' print. w print. '@' print. h printCR.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6315
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6316
    gc fillArcX:x y:y width:w height:h from:0 angle:360
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6317
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6318
    "Created: / 8.1.1998 / 00:46:00 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6319
    "Modified: / 8.1.1998 / 00:46:20 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6320
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6321
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6322
_WGraphics_fillPolygon:nativeContext        
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6323
    |gc xVector yVector count points|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6324
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6325
    gc := self gcForWGraphics:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6326
"/    gc isNil ifTrue:[^ self].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6327
    gc realized ifFalse:[^ self].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6328
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6329
    xVector := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6330
    yVector := nativeContext argAt:2.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6331
    count := nativeContext argAt:3.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6332
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6333
    DrawOPTrace ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6334
        'fillPolgon' printCR.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6335
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6336
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6337
    points := (1 to:count-1) collect:[:i | (xVector at:i) @ (yVector at:i)].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6338
    gc fillPolygon:points
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6339
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6340
    "Created: / 8.1.1998 / 00:58:09 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6341
    "Modified: / 25.1.1998 / 11:03:19 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6342
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6343
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6344
_WGraphics_fillRect:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6345
    |gc x y w h|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6346
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6347
    gc := self gcForWGraphics:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6348
"/    gc isNil ifTrue:[^ self].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6349
    gc realized ifFalse:[^ self].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6350
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6351
    x := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6352
    y := nativeContext argAt:2.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6353
    w := nativeContext argAt:3.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6354
    h := nativeContext argAt:4.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6355
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6356
"/ self halt.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6357
"/ self internalError:'breakPoint'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6358
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6359
    gc fillRectangleX:x y:y width:w height:h.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6360
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6361
    "Created: / 15.8.1997 / 15:43:10 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6362
    "Modified: / 8.1.1998 / 00:34:33 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6363
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6364
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6365
_WGraphics_fillRoundRect:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6366
    |gc x y w h|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6367
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6368
    gc := self gcForWGraphics:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6369
"/    gc isNil ifTrue:[^ self].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6370
    gc realized ifFalse:[^ self].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6371
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6372
    x := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6373
    y := nativeContext argAt:2.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6374
    w := nativeContext argAt:3.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6375
    h := nativeContext argAt:4.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6376
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6377
"/ self halt.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6378
"/ self internalError:'breakPoint'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6379
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6380
    gc displayRectangleX:x y:y width:w height:h.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6381
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6382
    "Modified: / 8.1.1998 / 00:34:33 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6383
    "Created: / 8.1.1998 / 00:59:36 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6384
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6385
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6386
_WGraphics_getClipBounds:nativeContext        
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6387
    |gc rect r x y w h|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6388
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6389
    gc := self gcForWGraphics:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6390
"/    gc isNil ifTrue:[^ self].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6391
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6392
    rect := (Java classForName:'java.awt.Rectangle') basicNew.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6393
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6394
    (gc isMemberOf:JavaView) ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6395
	r := gc getNextUpdateRectangle.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6396
	r isNil ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6397
	    x := y := 0.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6398
	    w := (gc width).
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6399
	    h := (gc height).
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6400
	] ifFalse:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6401
	    x := (r left).
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6402
	    y := (r top).
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6403
	    w := (r width).
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6404
	    h := (r height).
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6405
	]
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6406
    ] ifFalse:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6407
	x := y := 0.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6408
"/        w := h := 9999.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6409
	w := (gc width).
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6410
	h := (gc height).
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6411
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6412
    rect instVarNamed:'x' put:x.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6413
    rect instVarNamed:'y' put:y.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6414
    rect instVarNamed:'width' put:w.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6415
    rect instVarNamed:'height' put:h.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6416
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6417
"/ 'JAVA: getClipBounds' infoPrintCR.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6418
"/ self halt.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6419
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6420
    ^ rect
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6421
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6422
    "Created: / 6.1.1998 / 20:58:07 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6423
    "Modified: / 17.1.1998 / 12:08:48 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6424
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6425
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6426
_WGraphics_imageCreate:nativeContext        
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6427
    |jGraphics imgRep|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6428
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6429
    jGraphics := nativeContext receiver.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6430
    imgRep := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6431
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6432
    jGraphics instVarNamed:'pData' put:(imgRep instVarNamed:'pData').
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6433
"/ self halt.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6434
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6435
    "Created: / 11.1.1998 / 16:34:30 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6436
    "Modified: / 17.1.1998 / 12:37:18 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6437
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6438
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6439
_WGraphics_pSetFont:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6440
    |gc jFont stFont|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6441
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6442
    gc := self gcForWGraphics:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6443
    jFont := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6444
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6445
    stFont := jFont instVarNamed:'pData'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6446
    (stFont isNil or:[stFont == 0]) ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6447
"/ self halt.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6448
    ] ifFalse:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6449
	gc font:stFont
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6450
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6451
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6452
    "Created: / 6.1.1998 / 20:56:47 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6453
    "Modified: / 15.1.1998 / 12:31:20 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6454
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6455
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6456
_WGraphics_pSetForeground:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6457
    |gc rgb clr|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6458
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6459
    gc := self gcForWGraphics:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6460
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6461
    rgb := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6462
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6463
    clr := Color rgbValue:rgb.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6464
    gc paint:clr.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6465
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6466
"/ self halt.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6467
"/ self internalError:'breakPoint'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6468
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6469
    "Created: / 6.1.1998 / 20:56:14 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6470
    "Modified: / 8.1.1998 / 00:34:51 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6471
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6472
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6473
_WGraphics_setPaintMode:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6474
    |gc|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6475
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6476
    gc := self gcForWGraphics:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6477
    gc function:#copy.
285
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6478
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6479
    true "DrawOPTrace" ifTrue:[
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6480
        'copyMode' infoPrintCR.
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6481
    ].
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6482
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6483
    "Created: / 8.1.1998 / 00:33:44 / cg"
285
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6484
    "Modified: / 28.1.1998 / 23:25:56 / cg"
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6485
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6486
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6487
_WGraphics_setXORMode:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6488
    |gc jColor rgb invColor device|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6489
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6490
    gc := self gcForWGraphics:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6491
    jColor := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6492
    device := gc graphicsDevice.
285
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6493
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6494
"/    "/ on trueColor systems, use the provided
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6495
"/    "/ rgb value for inverting.
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6496
"/    "/ on palette systems, use white ^ black
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6497
"/
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6498
"/    device visualType == #TrueColor ifTrue:[
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6499
"/        rgb := jColor instVarNamed:'value'.
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6500
"/        rgb := rgb bitAnd:16rFFFFFF.
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6501
"/        rgb == 0 ifTrue:[
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6502
"/            rgb := 16rFFFFFF.
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6503
"/        ].
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6504
"/        invColor := rgb
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6505
"/    ] ifFalse:[
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6506
"/        invColor := device blackpixel bitXor:device whitepixel.
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6507
"/    ].
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6508
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6509
    invColor := device blackpixel bitXor:device whitepixel.
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6510
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6511
"/    gc foreground:(Color colorId:invColor)
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6512
"/       background:device blackColor.
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6513
    device 
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6514
        setForeground:invColor background:0
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6515
        in:gc gcId.
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6516
    gc function:#xor.
285
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6517
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6518
    true "DrawOPTrace" ifTrue:[
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6519
        'xorMode' infoPrintCR.
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6520
    ].
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6521
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6522
    "Created: / 8.1.1998 / 00:36:17 / cg"
285
10bf4fdcd02f allow multiple java applets to be open
cg
parents: 284
diff changeset
  6523
    "Modified: / 28.1.1998 / 23:45:03 / cg"
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6524
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6525
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6526
_WLabelPeer_create:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6527
    |jLabelPeer jLabel jFrame frame label
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6528
     lbl|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6529
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6530
    jLabelPeer := nativeContext receiver.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6531
    jLabel := jLabelPeer instVarNamed:'target'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6532
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6533
    lbl := jLabel instVarNamed:'text'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6534
    lbl notNil ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6535
	lbl := Java as_ST_String:lbl
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6536
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6537
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6538
    jFrame := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6539
    frame := jFrame instVarNamed:'pData'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6540
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6541
    label := Label in:frame.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6542
    lbl notNil ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6543
	label label:lbl
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6544
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6545
    self createdWindowsView:label for:jLabelPeer.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6546
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6547
    WindowCreationTrace == true ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6548
	'WLabelPeer_create: ' print. frame print. ' -> ' print. label printNL.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6549
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6550
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6551
    "Created: / 7.1.1998 / 21:42:31 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6552
    "Modified: / 13.1.1998 / 22:10:47 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6553
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6554
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6555
_WLabelPeer_setAlignment:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6556
    |label alignNr|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6557
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6558
    alignNr := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6559
    label := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6560
    label notNil ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6561
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6562
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6563
    "Created: / 7.1.1998 / 21:43:12 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6564
    "Modified: / 8.1.1998 / 17:35:29 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6565
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6566
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6567
_WLabelPeer_setText:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6568
    |label jString|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6569
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6570
    jString := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6571
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6572
    label := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6573
    label label:(Java as_ST_String:jString)
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6574
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6575
    "Created: / 7.1.1998 / 21:43:51 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6576
    "Modified: / 8.1.1998 / 17:35:50 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6577
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6578
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6579
_WListPeer_addItem:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6580
    |jString index selListView|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6581
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6582
    selListView := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6583
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6584
    jString := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6585
    index := nativeContext argAt:2.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6586
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6587
    selListView model list addLast:(Java as_ST_String:jString).
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6588
    selListView model changed:#list.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6589
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6590
    "Modified: / 24.1.1998 / 18:51:32 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6591
    "Created: / 24.1.1998 / 21:10:05 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6592
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6593
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6594
_WListPeer_create:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6595
    |jListPeer jFrame frame selectionInListView|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6596
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6597
    jListPeer := nativeContext receiver.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6598
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6599
    jFrame := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6600
    frame := jFrame instVarNamed:'pData'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6601
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6602
    selectionInListView := ScrollableView for:SelectionInListView in:frame.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6603
    selectionInListView action:[:index | jListPeer perform:#'handleListChanged(I)V' with:(index - 1)].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6604
    selectionInListView doubleClickAction:[:index | jListPeer perform:#'handleAction(I)V' with:(index - 1)].
337
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6605
    selectionInListView model:(SelectionInList new list:(List new)).
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6606
    selectionInListView useIndex:true.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6607
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6608
    self createdWindowsView:selectionInListView for:jListPeer.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6609
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6610
    WindowCreationTrace == true ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6611
        'WTextAreaPeer_create: ' print. frame print. ' -> ' print. selectionInListView printNL.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6612
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6613
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6614
    "Created: / 24.1.1998 / 19:58:54 / cg"
337
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6615
    "Modified: / 9.4.1998 / 22:19:07 / cg"
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6616
!
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6617
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6618
_WListPeer_delItems:nativeContext
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6619
    |jString index1 index2 selListView|
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6620
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6621
    selListView := self viewForWPeer:nativeContext.
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6622
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6623
    index1 := nativeContext argAt:1.
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6624
    index2 := nativeContext argAt:2.
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6625
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6626
    selListView model list removeFromIndex:(index1+1) toIndex:(index2+1).
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6627
    selListView model changed:#list.
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6628
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6629
    "Created: / 9.4.1998 / 22:19:25 / cg"
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6630
    "Modified: / 9.4.1998 / 22:20:08 / cg"
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6631
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6632
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6633
_WListPeer_isSelected:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6634
    |selectionInListView index model|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6635
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6636
    selectionInListView := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6637
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6638
    index := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6639
    (model := selectionInListView model) notNil ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6640
        (model selectionIndex == (index + 1))  "/ JAVA indexing starts at 0
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6641
        ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6642
            ^ 1
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6643
        ]
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6644
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6645
    ^ 0.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6646
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6647
    "Created: / 24.1.1998 / 22:42:31 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6648
    "Modified: / 25.1.1998 / 01:35:32 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6649
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6650
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6651
_WListPeer_select:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6652
    |selectionInListView index model|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6653
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6654
    selectionInListView := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6655
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6656
    index := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6657
    (model := selectionInListView model) notNil ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6658
        model selectionIndex:(index + 1).  "/ JAVA indexing starts at 0
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6659
    ]
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6660
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6661
    "Created: / 24.1.1998 / 22:32:35 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6662
    "Modified: / 25.1.1998 / 01:28:46 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6663
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6664
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6665
_WListPeer_setMultipleSelections:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6666
    |selectionInListView onOff|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6667
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6668
    selectionInListView := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6669
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6670
    onOff := (nativeContext argAt:1) ~~ 0.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6671
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6672
    selectionInListView multipleSelectOk:onOff.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6673
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6674
    "Modified: / 24.1.1998 / 20:01:06 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6675
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6676
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6677
_WMenuBarPeer_create:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6678
    |jMenuBarPeer jMenuBar jFrame frame menuBar|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6679
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6680
    jMenuBarPeer := nativeContext receiver.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6681
    jMenuBar := jMenuBarPeer instVarNamed:'target'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6682
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6683
    jFrame := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6684
    frame := jFrame instVarNamed:'pData'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6685
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6686
    menuBar := MenuPanel in:frame.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6687
    menuBar verticalLayout:false.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6688
    menuBar realize.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6689
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6690
    self createdWindowsView:menuBar for:jMenuBarPeer.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6691
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6692
    WindowCreationTrace == true ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6693
        'WMenuBarPeer_create: ' print. frame print. ' -> ' print. menuBar printNL.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6694
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6695
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6696
    "Created: / 7.1.1998 / 21:38:31 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6697
    "Modified: / 25.1.1998 / 13:19:03 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6698
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6699
325
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  6700
_WMenuItemPeer__dispose:nativeContext
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  6701
    |jMenuItemPeer item|
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  6702
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  6703
    jMenuItemPeer := nativeContext receiver.
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  6704
    item := jMenuItemPeer instVarNamed:'pData'.
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  6705
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  6706
"/ what should be done here ?
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  6707
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  6708
    "Created: / 29.3.1998 / 17:16:05 / cg"
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  6709
    "Modified: / 29.3.1998 / 17:16:35 / cg"
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  6710
!
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  6711
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6712
_WMenuItemPeer_create:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6713
    |jMenuItemPeer jMenuItem jMenuPeer menu item lbl|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6714
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6715
    jMenuItemPeer := nativeContext receiver.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6716
    jMenuItem := jMenuItemPeer instVarNamed:'target'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6717
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6718
    jMenuPeer := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6719
    menu := jMenuPeer instVarNamed:'pData'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6720
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6721
    item := menu createAtIndex:nil.
325
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  6722
    item value:[
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  6723
                jMenuItemPeer perform:#'handleAction(I)V' with:0
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  6724
               ].
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6725
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6726
    lbl := jMenuItem instVarNamed:'label'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6727
    lbl notNil ifTrue:[
325
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  6728
        lbl := Java as_ST_String:lbl.
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  6729
        item label:lbl
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6730
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6731
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6732
    jMenuItemPeer instVarNamed:'pData' put:item.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6733
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6734
    WindowOPTrace == true ifTrue:[
325
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  6735
        'WMenuItem_create: ' print. menu print. ' -> ' print. item printNL.
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6736
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6737
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6738
    "Created: / 7.1.1998 / 21:40:44 / cg"
325
947460ac3496 *** empty log message ***
cg
parents: 322
diff changeset
  6739
    "Modified: / 29.3.1998 / 15:44:13 / cg"
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6740
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6741
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6742
_WMenuItemPeer_enable:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6743
    |jMenuItemPeer item state|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6744
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6745
    jMenuItemPeer := nativeContext receiver.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6746
    item := jMenuItemPeer instVarNamed:'pData'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6747
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6748
    state := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6749
    item enabled:(state == 0) not
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6750
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6751
    "Modified: / 4.8.1997 / 03:05:50 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6752
    "Created: / 7.1.1998 / 22:41:38 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6753
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6754
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6755
_WMenuPeer_createMenu:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6756
    |jMenuPeer jMenu jMenuBarPeer menuPanel menu
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6757
     lbl item|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6758
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6759
    jMenuPeer := nativeContext receiver.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6760
    jMenu := jMenuPeer instVarNamed:'target'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6761
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6762
    jMenuBarPeer := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6763
    menuPanel := jMenuBarPeer instVarNamed:'pData'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6764
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6765
    item := menuPanel createAtIndex:nil.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6766
    lbl := jMenu instVarNamed:'label'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6767
    lbl notNil ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6768
	lbl := Java as_ST_String:lbl.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6769
	item label:lbl
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6770
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6771
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6772
    menu := MenuPanel new.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6773
    item submenu:menu.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6774
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6775
    jMenuPeer instVarNamed:'pData' put:menu.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6776
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6777
'createMenuPeer: ' print. menuPanel print. ' -> ' print. menu printNL.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6778
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6779
    "Created: / 7.1.1998 / 21:39:50 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6780
    "Modified: / 13.1.1998 / 22:11:09 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6781
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6782
334
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6783
_WScrollPanePeer__getHScrollbarHeight:nativeContext
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6784
    |scrollPane|
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6785
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6786
    scrollPane := self viewForWPeer:nativeContext.
339
fb1f09d2af62 *** empty log message ***
cg
parents: 337
diff changeset
  6787
    ^ HorizontalScrollBar new preferredExtent y.
fb1f09d2af62 *** empty log message ***
cg
parents: 337
diff changeset
  6788
334
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6789
    "Created: / 9.4.1998 / 17:30:56 / cg"
339
fb1f09d2af62 *** empty log message ***
cg
parents: 337
diff changeset
  6790
    "Modified: / 10.4.1998 / 14:59:28 / cg"
341
a11a6523de53 checkin from browser
cg
parents: 339
diff changeset
  6791
!
334
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6792
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6793
_WScrollPanePeer__getVScrollbarWidth:nativeContext
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6794
    |scrollPane|
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6795
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6796
    scrollPane := self viewForWPeer:nativeContext.
339
fb1f09d2af62 *** empty log message ***
cg
parents: 337
diff changeset
  6797
    ^ ScrollBar new preferredExtent x.
334
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6798
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6799
    "Created: / 9.4.1998 / 17:29:48 / cg"
339
fb1f09d2af62 *** empty log message ***
cg
parents: 337
diff changeset
  6800
    "Modified: / 10.4.1998 / 15:00:33 / cg"
334
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6801
!
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6802
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6803
_WScrollPanePeer_create:nativeContext
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6804
    |jScrollPanePeer jScrollPane jFrame frame scrollPane
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6805
     lbl|
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6806
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6807
    jScrollPanePeer := nativeContext receiver.
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6808
    jScrollPane := jScrollPanePeer instVarNamed:'target'.
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6809
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6810
    jFrame := nativeContext argAt:1.
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6811
    frame := jFrame instVarNamed:'pData'.
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6812
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6813
    "/ create with a simple view ...
337
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6814
    scrollPane := ScrollableView for:JavaView in:frame.
334
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6815
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6816
    self createdWindowsView:scrollPane for:jScrollPanePeer.
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6817
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6818
    WindowCreationTrace == true ifTrue:[
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6819
        'WScrollPanePeer_create: ' print. frame print. ' -> ' print. scrollPane printNL.
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6820
    ].
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6821
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6822
    "Created: / 9.4.1998 / 17:25:08 / cg"
337
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  6823
    "Modified: / 9.4.1998 / 22:06:09 / cg"
334
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6824
!
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6825
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6826
_WScrollPanePeer_setInsets:nativeContext
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6827
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6828
    "Modified: / 9.4.1998 / 17:26:11 / cg"
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6829
    "Created: / 9.4.1998 / 17:29:10 / cg"
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6830
!
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6831
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6832
_WScrollPanePeer_setSpans:nativeContext
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6833
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6834
    "Created: / 9.4.1998 / 17:31:44 / cg"
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6835
!
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6836
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6837
_WScrollbarPeer__setValues:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6838
    |scrollBar value visibleAmount min max|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6839
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6840
    scrollBar := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6841
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6842
    value := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6843
    visibleAmount := nativeContext argAt:2.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6844
    min := nativeContext argAt:3.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6845
    max := nativeContext argAt:4.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6846
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6847
    (min ~~ 0
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6848
    or:[max ~~ 100]) ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6849
        scrollBar thumb start:min stop:max.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6850
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6851
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6852
    scrollBar thumbOrigin:value thumbHeight:visibleAmount.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6853
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6854
    "Created: / 13.1.1998 / 22:13:57 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6855
    "Modified: / 25.1.1998 / 11:51:14 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6856
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6857
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6858
_WScrollbarPeer_create:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6859
    |jScrollbarPeer jScrollbar jFrame frame scrollBar
334
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6860
     min max|
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6861
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6862
    jScrollbarPeer := nativeContext receiver.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6863
    jScrollbar := jScrollbarPeer instVarNamed:'target'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6864
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6865
    jFrame := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6866
    frame := jFrame instVarNamed:'pData'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6867
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6868
    (jScrollbar instVarNamed:'orientation') == 0 "HORIZONTAL" ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6869
        scrollBar := HorizontalScrollBar in:frame.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6870
    ] ifFalse:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6871
        scrollBar := ScrollBar in:frame.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6872
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6873
    min := jScrollbar instVarNamed:'minimum'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6874
    max := jScrollbar instVarNamed:'maximum'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6875
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6876
    self createdWindowsView:scrollBar for:jScrollbarPeer.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6877
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6878
    WindowCreationTrace == true ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6879
        'WScrollbarPeer_create: ' print. frame print. ' -> ' print. scrollBar printNL.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6880
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6881
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6882
    "Created: / 5.1.1998 / 01:53:30 / cg"
334
638045537cf7 *** empty log message ***
cg
parents: 331
diff changeset
  6883
    "Modified: / 9.4.1998 / 17:25:14 / cg"
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6884
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6885
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6886
_WScrollbarPeer_setLineIncrement:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6887
    |scrollBar inc|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6888
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6889
    scrollBar := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6890
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6891
    inc := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6892
"/    scrollBar thumb lineIncrement:inc.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6893
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6894
    "Created: / 25.1.1998 / 11:52:19 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6895
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6896
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6897
_WScrollbarPeer_setPageIncrement:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6898
    |scrollBar inc|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6899
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6900
    scrollBar := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6901
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6902
    inc := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6903
"/    scrollBar thumb pageIncrement:inc.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6904
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6905
    "Created: / 25.1.1998 / 11:52:01 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6906
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6907
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6908
_WTextAreaPeer_create:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6909
    |jTextAreaPeer jFrame frame editTextView|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6910
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6911
    jTextAreaPeer := nativeContext receiver.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6912
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6913
    jFrame := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6914
    frame := jFrame instVarNamed:'pData'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6915
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6916
    editTextView := HVScrollableView for:EditTextView in:frame.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6917
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6918
    self createdWindowsView:editTextView for:jTextAreaPeer.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6919
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6920
    WindowCreationTrace == true ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6921
	'WTextAreaPeer_create: ' print. frame print. ' -> ' print. editTextView printNL.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6922
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6923
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6924
    "Created: / 7.1.1998 / 21:49:49 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6925
    "Modified: / 15.1.1998 / 12:56:18 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6926
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6927
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6928
_WTextAreaPeer_insertText:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6929
    |textView pos string jstring|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6930
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6931
    textView := self viewForWPeer:nativeContext.
329
937c1473f85a no yield when checking for events;
cg
parents: 326
diff changeset
  6932
    (textView isKindOf:ScrollableView) ifTrue:[
937c1473f85a no yield when checking for events;
cg
parents: 326
diff changeset
  6933
        textView := textView scrolledView
937c1473f85a no yield when checking for events;
cg
parents: 326
diff changeset
  6934
    ].
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6935
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6936
    jstring := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6937
    string := Java as_ST_String:jstring.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6938
    pos := nativeContext argAt:2.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6939
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6940
    textView insert:string at:pos.
329
937c1473f85a no yield when checking for events;
cg
parents: 326
diff changeset
  6941
    textView cursorToCharacterPosition:pos + string size.
937c1473f85a no yield when checking for events;
cg
parents: 326
diff changeset
  6942
    textView makeCursorVisible.
937c1473f85a no yield when checking for events;
cg
parents: 326
diff changeset
  6943
"/ textView invalidateRepairNow:true.
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6944
    ^ nil
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6945
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6946
    "Created: / 7.1.1998 / 21:50:23 / cg"
329
937c1473f85a no yield when checking for events;
cg
parents: 326
diff changeset
  6947
    "Modified: / 5.4.1998 / 17:37:24 / cg"
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6948
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6949
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6950
_WTextComponentPeer_enableEditing:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6951
    |textView enabled|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6952
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6953
    textView := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6954
    enabled := (nativeContext argAt:1) ~~ 0.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6955
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6956
    ^ textView readOnly:enabled not
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6957
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6958
    "Created: / 5.1.1998 / 01:29:38 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6959
    "Modified: / 25.1.1998 / 16:29:56 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6960
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6961
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6962
_WTextComponentPeer_getSelectionEnd:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6963
    |textView|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6964
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6965
    textView := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6966
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6967
    ^ textView characterPositionOfSelectionEnd
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6968
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6969
    "Created: / 8.1.1998 / 17:41:56 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6970
    "Modified: / 15.1.1998 / 15:47:18 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6971
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6972
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6973
_WTextComponentPeer_getSelectionStart:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6974
    |textView|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6975
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6976
    textView := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6977
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6978
    ^ textView characterPositionOfSelection - 1
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6979
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6980
    "Created: / 15.8.1997 / 15:45:45 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6981
    "Modified: / 15.1.1998 / 15:46:51 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6982
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6983
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6984
_WTextComponentPeer_getText:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6985
    |textView string jString|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6986
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6987
    textView := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6988
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6989
    string := textView contents asString.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6990
    jString := Java as_String:string.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6991
    ^ jString
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6992
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6993
    "Created: / 6.1.1998 / 21:05:15 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6994
    "Modified: / 8.1.1998 / 17:36:52 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6995
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6996
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6997
_WTextComponentPeer_select:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6998
    |textView selStart selEnd|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  6999
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7000
    textView := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7001
    selStart := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7002
    selEnd := nativeContext argAt:2.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7003
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7004
    selStart == selEnd ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7005
	"/ clear selection
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7006
	textView unselect.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7007
	"/ and set caret
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7008
	textView cursorToCharacterPosition:selStart + 1
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7009
    ] ifFalse:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7010
	"/ change selection
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7011
	textView selectFromCharacterPosition:selStart+1 to:selEnd
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7012
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7013
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7014
    "Created: / 15.8.1997 / 15:45:58 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7015
    "Modified: / 15.1.1998 / 21:55:57 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7016
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7017
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7018
_WTextComponentPeer_setText:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7019
    |textView string jstring|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7020
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7021
    textView := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7022
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7023
    jstring := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7024
    string := Java as_ST_String:jstring.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7025
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7026
    textView contents:string.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7027
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7028
    "Created: / 5.1.1998 / 01:28:23 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7029
    "Modified: / 15.1.1998 / 15:59:57 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7030
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7031
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7032
_WTextFieldPeer_create:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7033
    |jTextFieldPeer jFrame frame editField|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7034
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7035
    jTextFieldPeer := nativeContext receiver.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7036
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7037
    jFrame := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7038
    frame := jFrame instVarNamed:'pData'.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7039
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7040
    editField := EditField in:frame.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7041
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7042
    self createdWindowsView:editField for:jTextFieldPeer.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7043
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7044
    editField crAction:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7045
                        jTextFieldPeer invoke:#handleAction.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7046
                  ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7047
    WindowCreationTrace == true ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7048
        'WTextFieldPeer_create: ' print. frame print. ' -> ' print. editField printNL.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7049
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7050
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7051
    "Created: / 5.1.1998 / 01:27:37 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7052
    "Modified: / 25.1.1998 / 20:34:45 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7053
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7054
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7055
_WTextFieldPeer_setEchoCharacter:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7056
    |editField char|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7057
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7058
    editField := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7059
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7060
    char := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7061
    editField passwordCharacter:(Character value:char).
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7062
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7063
    "Created: / 25.1.1998 / 16:28:30 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7064
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7065
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7066
_WToolkit_eventLoop:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7067
    JavaEventThread := Processor activeProcess.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7068
    [
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7069
	[true] whileTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7070
	    AbortSignal handle:[:ex |
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7071
		ex return
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7072
	    ] do:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7073
		self doWindowsEventThread.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7074
	    ]
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7075
	].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7076
    ] valueNowOrOnUnwindDo:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7077
	JavaEventThread := nil.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7078
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7079
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7080
    "Created: / 6.1.1998 / 21:01:44 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7081
    "Modified: / 15.1.1998 / 19:48:55 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7082
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7083
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7084
_WToolkit_getScreenHeight:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7085
    ^ Screen current height
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7086
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7087
    "Modified: / 20.3.1997 / 13:50:04 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7088
    "Created: / 13.1.1998 / 09:24:45 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7089
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7090
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7091
_WToolkit_getScreenResolution:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7092
    ^ Screen current resolution x rounded
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7093
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7094
    "Modified: / 20.3.1997 / 13:50:04 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7095
    "Created: / 17.1.1998 / 21:54:48 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7096
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7097
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7098
_WToolkit_getScreenWidth:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7099
    ^ Screen current width
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7100
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7101
    "Modified: / 20.3.1997 / 13:50:04 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7102
    "Created: / 13.1.1998 / 09:24:37 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7103
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7104
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7105
_WToolkit_init:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7106
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7107
    "Created: / 3.1.1998 / 02:30:57 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7108
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7109
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7110
_WToolkit_loadSystemColors:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7111
"/ self halt.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7112
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7113
    "Modified: / 18.3.1997 / 18:43:26 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7114
    "Created: / 5.1.1998 / 02:19:09 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7115
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7116
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7117
_WWindowPeer__setResizable:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7118
    |view onOff|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7119
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7120
    view := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7121
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7122
    onOff := (nativeContext argAt:1) == 1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7123
    view isTopView ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7124
	onOff ifTrue:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7125
	    view minExtent:10@10.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7126
	    view maxExtent:(Screen current extent).
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7127
	] ifFalse:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7128
	    view minExtent:view extent.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7129
	    view maxExtent:view extent.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7130
	]
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7131
    ] ifFalse:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7132
	(view isMemberOf:JavaEmbeddedFrameView) ifFalse:[
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7133
	    self halt.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7134
	]
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7135
    ].
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7136
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7137
"/ 'JAVA: WWindowPeer_setResizable: ' print. view print. ' yes/no: ' print. onOff printNL.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7138
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7139
    ^ nil
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7140
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7141
    "Created: / 5.1.1998 / 00:57:59 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7142
    "Modified: / 16.1.1998 / 18:08:00 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7143
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7144
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7145
_WWindowPeer__setTitle:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7146
    |view jString string|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7147
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7148
    view := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7149
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7150
    jString := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7151
    string := Java as_ST_String:jString.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7152
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7153
"/ 'JAVA: WWindowPeer_pSetTitle: ' print. string print. ' ' print. view printNL.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7154
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7155
    view label:string.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7156
    ^ nil
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7157
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7158
    "Created: / 5.1.1998 / 00:57:17 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7159
    "Modified: / 8.1.1998 / 17:37:41 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7160
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7161
342
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  7162
_WWindowPeer_toBack:nativeContext
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  7163
    |view|
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  7164
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  7165
    view := self viewForWPeer:nativeContext.
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  7166
    view lower.
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  7167
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  7168
    "Created: / 7.5.1998 / 00:23:03 / cg"
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  7169
!
18284bd570b5 more math natives
cg
parents: 341
diff changeset
  7170
337
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  7171
_WWindowPeer_toFront:nativeContext
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  7172
    |view|
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  7173
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  7174
    view := self viewForWPeer:nativeContext.
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  7175
    view raise.
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  7176
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  7177
    "Created: / 9.4.1998 / 22:17:28 / cg"
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  7178
!
aa36aa78b71f *** empty log message ***
cg
parents: 334
diff changeset
  7179
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7180
_WWindowPeer_updateInsets:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7181
"/ self halt.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7182
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7183
    "Modified: / 18.3.1997 / 18:43:18 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7184
    "Created: / 4.1.1998 / 18:09:04 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7185
! !
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7186
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7187
!JavaVM class methodsFor:'native - sun.awt.windows - jdk1.2'!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7188
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7189
_WFramePeer_setTitle:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7190
    |view jString string|
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7191
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7192
    view := self viewForWPeer:nativeContext.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7193
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7194
    jString := nativeContext argAt:1.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7195
    string := Java as_ST_String:jString.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7196
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7197
"/ 'JAVA: WFramePeer_pSetTitle: ' print. string print. ' ' print. view printNL.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7198
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7199
    view label:string.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7200
    ^ nil
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7201
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7202
    "Modified: / 8.1.1998 / 17:37:41 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7203
    "Created: / 27.1.1998 / 21:42:57 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7204
!
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7205
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7206
_WPanelPeer_calculateInsets:nativeContext
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7207
    "/ new with jdk1.2 ...
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7208
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7209
    "Created: / 27.1.1998 / 21:40:00 / cg"
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7210
! !
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7211
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7212
!JavaVM class methodsFor:'semaphores & monitors'!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7213
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7214
monitorFor:someObject
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7215
    |mon|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7216
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7217
    LockTableAccess critical:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7218
	mon := LockTable at:someObject ifAbsent:nil.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7219
	mon isNil ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7220
	    LockTable at:someObject put:(mon := Monitor new)
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7221
	]
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7222
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7223
    ^ mon
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7224
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7225
    "Created: / 2.1.1998 / 19:01:52 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7226
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7227
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7228
releaseAndSignalForAllSemaphoreFor:someObject
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7229
    |sema|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7230
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7231
    WaitTableAccess critical:[
306
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  7232
        sema := WaitTable at:someObject ifAbsent:nil.
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  7233
"/        sema notNil ifTrue:[
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  7234
"/            WaitTable removeKey:someObject
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  7235
"/        ]
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7236
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7237
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7238
    sema notNil ifTrue:[
306
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  7239
        sema signalForAll
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7240
    ]
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7241
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7242
    "Created: / 2.1.1998 / 18:21:51 / cg"
306
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  7243
    "Modified: / 3.2.1998 / 16:11:58 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7244
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7245
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7246
releaseAndSignalSemaphoreFor:someObject
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7247
    |sema|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7248
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7249
    WaitTableAccess critical:[
306
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  7250
        sema := WaitTable at:someObject ifAbsent:nil.
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  7251
"/        sema notNil ifTrue:[
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  7252
"/            WaitTable removeKey:someObject
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  7253
"/        ]
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7254
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7255
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7256
    sema notNil ifTrue:[
306
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  7257
        sema signal
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7258
    ]
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7259
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7260
    "Created: / 2.1.1998 / 18:20:20 / cg"
306
1060b0c3f4c5 done release semas - need to be identical per object.
cg
parents: 304
diff changeset
  7261
    "Modified: / 3.2.1998 / 16:11:51 / cg"
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7262
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7263
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7264
releaseSemaphoreFor:someObject
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7265
    WaitTableAccess critical:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7266
	WaitTable removeKey:someObject ifAbsent:nil
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7267
    ]
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7268
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7269
    "Created: / 2.1.1998 / 18:17:14 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7270
    "Modified: / 2.1.1998 / 21:52:03 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7271
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7272
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7273
semaphoreFor:someObject
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7274
    |sema|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7275
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7276
    WaitTableAccess critical:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7277
	sema := WaitTable at:someObject ifAbsent:nil.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7278
	sema isNil ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7279
	    WaitTable at:someObject put:(sema := Semaphore new)
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7280
	]
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7281
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7282
    ^ sema
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7283
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7284
    "Created: / 2.1.1998 / 18:15:59 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7285
    "Modified: / 2.1.1998 / 18:20:31 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7286
! !
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7287
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7288
!JavaVM class methodsFor:'vm support'!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7289
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7290
monitorEnter:someObject
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7291
    | mon thisProcess|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7292
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7293
    someObject isNil ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7294
	self halt
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7295
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7296
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7297
    mon := self monitorFor:someObject.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7298
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7299
    MonitorTrace ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7300
	('====> entering monitor for ' , someObject displayString , ' in ' , Processor activeProcess name , ' ...') printCR.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7301
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7302
    mon enter.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7303
    MonitorTrace ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7304
	('====> entered it in ' , Processor activeProcess name , ' ...') printCR.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7305
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7306
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7307
    self enteredMonitors add:someObject.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7308
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7309
    "Created: / 2.1.1998 / 23:44:49 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7310
    "Modified: / 3.1.1998 / 03:05:02 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7311
!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7312
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7313
monitorExit:someObject
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7314
    | mon thisProcess|
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7315
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7316
    someObject isNil ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7317
	self halt
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7318
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7319
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7320
    mon := self monitorFor:someObject.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7321
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7322
    MonitorTrace ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7323
	('====> leaving monitor for ' , someObject displayString , ' in ' , Processor activeProcess name , ' ...') printCR.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7324
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7325
    mon exit.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7326
    MonitorTrace ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7327
	('====> left it in ' , Processor activeProcess name , ' ...') printCR.
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7328
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7329
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7330
"/    enteredMonitorHandles isNil ifTrue:[
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7331
"/        self halt:'oops - no monitor entered'.
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7332
"/    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7333
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7334
    self enteredMonitors removeLast ~~ someObject ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7335
	self halt:'oops - monitor enter/exit nesting wrong'
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7336
    ].
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7337
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7338
    "Created: / 2.1.1998 / 23:47:28 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7339
    "Modified: / 3.1.1998 / 03:05:18 / cg"
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7340
! !
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7341
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7342
!JavaVM class methodsFor:'windows - events'!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7343
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7344
awtEventsForEvent:anEvent javaWindow:jWin
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7345
    "given an ST/X event, create corresponding AWT event(s) for it"
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7346
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7347
    |jEv jEv1 jEv2
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7348
     modifiers key keyChar untranslatedKey id 
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7349
     type x y w h view menu
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7350
     eventArgs clickCount jRect
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7351
     jKeyEventClass jInputEventClass jMouseEventClass
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7352
     jWindowEventClass jPaintEventClass jComponentEventClass|
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7353
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7354
    type := anEvent type.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7355
    eventArgs := anEvent arguments.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7356
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7357
    key := 0.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7358
    modifiers := 0.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7359
    x := 0.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7360
    y := 0.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7361
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7362
    jInputEventClass := Java classForName:'java.awt.event.InputEvent'.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7363
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7364
    (anEvent isKeyEvent 
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7365
    or:[anEvent isButtonEvent
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7366
    or:[anEvent isPointerEnterLeaveEvent]]) ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7367
        anEvent hasAlt ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7368
            modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'ALT_MASK')
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7369
        ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7370
        anEvent hasCtrl ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7371
            modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'CTRL_MASK')
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7372
        ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7373
        anEvent hasMeta ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7374
            modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'META_MASK')
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7375
        ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7376
        anEvent hasShift ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7377
            modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'SHIFT_MASK')
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7378
        ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7379
        anEvent hasButton1 ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7380
            modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'BUTTON1_MASK')
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7381
        ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7382
        anEvent hasButton2 ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7383
            modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'BUTTON2_MASK')
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7384
        ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7385
        anEvent hasButton3 ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7386
            modifiers := modifiers bitOr:(jInputEventClass instVarNamed:'BUTTON3_MASK')
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7387
        ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7388
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7389
        anEvent isPointerEnterLeaveEvent ifFalse:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7390
            "/ ST/X does not (yet) record this information
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7391
            "/ with pointerLeave events.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7392
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7393
            x := anEvent x.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7394
            y := anEvent y.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7395
        ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7396
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7397
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7398
    anEvent isKeyEvent ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7399
        jKeyEventClass := Java classForName:'java.awt.event.KeyEvent'.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7400
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7401
        key := 0.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7402
        keyChar := 0.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7403
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7404
        key := anEvent key.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7405
        key isCharacter ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7406
            key := keyChar := key asciiValue
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7407
        ] ifFalse:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7408
            untranslatedKey := anEvent view device keyboardMap keyAtValue:key ifAbsent:key.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7409
            untranslatedKey == #Delete ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7410
                key := jKeyEventClass instVarNamed:'VK_DELETE' "/ 127
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7411
            ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7412
            untranslatedKey == #BackSpace ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7413
                key := jKeyEventClass instVarNamed:'VK_BACK_SPACE' "/ 8
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7414
            ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7415
            untranslatedKey == #Return ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7416
                key := jKeyEventClass instVarNamed:'VK_ENTER' "/ 13
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7417
            ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7418
            untranslatedKey == #Tab ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7419
                key := jKeyEventClass instVarNamed:'VK_TAB' "/ 9
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7420
            ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7421
            untranslatedKey == #Home ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7422
                key := jKeyEventClass instVarNamed:'VK_HOME'
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7423
            ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7424
            untranslatedKey == #End ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7425
                key := jKeyEventClass instVarNamed:'VK_END'
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7426
            ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7427
            untranslatedKey == #Prior ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7428
                key := jKeyEventClass instVarNamed:'VK_PAGE_UP'
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7429
            ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7430
            key == #EndOfText ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7431
                key := jKeyEventClass instVarNamed:'VK_PAGE_DOWN'
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7432
            ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7433
            untranslatedKey == #CursorUp ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7434
                key := jKeyEventClass instVarNamed:'VK_UP'
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7435
            ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7436
            untranslatedKey == #CursorDown ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7437
                key := jKeyEventClass instVarNamed:'VK_DOWN'
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7438
            ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7439
            untranslatedKey == #CursorLeft ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7440
                key := jKeyEventClass instVarNamed:'VK_LEFT'
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7441
            ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7442
            untranslatedKey == #CursorRight ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7443
                key := jKeyEventClass instVarNamed:'VK_RIGHT'
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7444
            ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7445
            (#( F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11)
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7446
            includes:untranslatedKey) ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7447
                key := jKeyEventClass instVarNamed:('VK_' , untranslatedKey)
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7448
            ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7449
        ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7450
        (type == #'keyPress:x:y:') ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7451
            id := jKeyEventClass instVarNamed:'KEY_PRESSED'
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7452
        ] ifFalse:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7453
            id := jKeyEventClass instVarNamed:'KEY_RELEASED'
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7454
        ].
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7455
        jEv := jKeyEventClass newCleared "basicNew".
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7456
        jEv instVarNamed:'modifiers' put:modifiers.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7457
        jEv instVarNamed:'keyCode'   put:key.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7458
        jEv instVarNamed:'keyChar'   put:keyChar.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7459
        jEv instVarNamed:'id'        put:id.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7460
"/        jEv instVarNamed:'x'         put:x.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7461
"/        jEv instVarNamed:'y'         put:y.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7462
        jEv instVarNamed:'when'      put:(OperatingSystem getMillisecondTime).
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7463
        ^ Array with:jEv
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7464
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7465
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7466
    (anEvent isButtonEvent 
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7467
    or:[anEvent isPointerEnterLeaveEvent]) ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7468
        jMouseEventClass := Java classForName:'java.awt.event.MouseEvent'.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7469
        clickCount := 1.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7470
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7471
        (type == #'buttonPress:x:y:') ifTrue:[
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7472
            id := jMouseEventClass instVarNamed:'MOUSE_PRESSED'.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7473
        ] ifFalse:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7474
            (type == #'buttonRelease:x:y:') ifTrue:[
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7475
                id := jMouseEventClass instVarNamed:'MOUSE_RELEASED'.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7476
            ] ifFalse:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7477
                (type == #'buttonMotion:x:y:') ifTrue:[
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7478
                    (anEvent arguments at:1) == 0 ifTrue:[
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7479
                        id := jMouseEventClass instVarNamed:'MOUSE_MOVED'.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7480
                    ] ifFalse:[
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7481
                        id := jMouseEventClass instVarNamed:'MOUSE_DRAGGED'.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7482
                    ].
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7483
                ] ifFalse:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7484
"/                    (type == #'pointerMotion:x:y:') ifTrue:[
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7485
"/                        id := jMouseEventClass instVarNamed:'MOUSE_MOVED'.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7486
"/                    ] ifFalse:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7487
                        (type == #'pointerEnter:x:y:') ifTrue:[
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7488
                            id := jMouseEventClass instVarNamed:'MOUSE_ENTERED'.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7489
                        ] ifFalse:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7490
                            (type == #'pointerLeave:') ifTrue:[
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7491
                                id := jMouseEventClass instVarNamed:'MOUSE_EXITED'.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7492
                            ] ifFalse:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7493
                                (type == #'buttonMultiPress:x:y:') ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7494
                                    id := jMouseEventClass instVarNamed:'MOUSE_PRESSED'.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7495
                                    clickCount := 2.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7496
                                ] ifFalse:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7497
                                    self halt.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7498
                                ]
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7499
                            ]
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7500
"/                        ]
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7501
                    ]
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7502
                ]
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7503
            ]
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7504
        ].
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7505
        jEv := jMouseEventClass newCleared "basicNew".
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7506
        jEv instVarNamed:'modifiers' put:modifiers.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7507
        jEv instVarNamed:'id'        put:id.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7508
        jEv instVarNamed:'x'         put:x.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7509
        jEv instVarNamed:'y'         put:y.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7510
        jEv instVarNamed:'when'      put:(OperatingSystem getMillisecondTime).
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7511
        ^ Array with:jEv
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7512
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7513
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7514
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7515
    ((type == #'exposeX:y:width:height:') 
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7516
    or:[(type == #'graphicExposeX:y:width:height:')
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7517
    or:[(type == #damage)]]) ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7518
        jPaintEventClass := Java classForName:'java.awt.event.PaintEvent'.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7519
        jWindowEventClass := Java classForName:'java.awt.event.WindowEvent'.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7520
"/        id := (jPaintEventClass instVarNamed:'PAINT').
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7521
        id := (jPaintEventClass instVarNamed:'UPDATE').
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7522
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7523
        ((type == #'exposeX:y:width:height:') 
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7524
        or:[(type == #'graphicExposeX:y:width:height:')]) ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7525
            x := eventArgs at:1.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7526
            y := eventArgs at:2.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7527
            w := eventArgs at:3.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7528
            h := eventArgs at:4.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7529
        ] ifFalse:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7530
            x := eventArgs left.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7531
            y := eventArgs top.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7532
            w := eventArgs width.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7533
            h := eventArgs height.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7534
        ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7535
        jRect := (Java classForName:'java.awt.Rectangle') basicNew.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7536
        jRect instVarNamed:'x' put:x.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7537
        jRect instVarNamed:'y' put:y.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7538
        jRect instVarNamed:'width' put:w.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7539
        jRect instVarNamed:'height' put:h.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7540
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7541
        jEv := jPaintEventClass newCleared "basicNew".
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7542
        jEv instVarNamed:'id'        put:id.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7543
        jEv instVarNamed:'updateRect' put:jRect.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7544
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7545
"/        jEv instVarNamed:'g'         put:jWin.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7546
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7547
        ^ Array with:jEv.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7548
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7549
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7550
    (type == #'configureX:y:width:height:') ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7551
"/        x := eventArgs at:1.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7552
"/        y := eventArgs at:2.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7553
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7554
        view := anEvent view.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7555
        w := eventArgs at:3.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7556
        h := eventArgs at:4.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7557
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7558
        "/
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7559
        "/ must change the components extent
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7560
        "/ is there no cleaner way to do this ?
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7561
        "/
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7562
        view isTopView ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7563
            "/
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7564
            "/ sigh - don't include the menu.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7565
            "/
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7566
            menu := self topViewsMenu:view.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7567
            menu notNil ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7568
                "/ must add the menus height
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7569
                h := h - menu height
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7570
            ]
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7571
        ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7572
        jWin instVarNamed:'width' put:w.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7573
        jWin instVarNamed:'height' put:h.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7574
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7575
        jComponentEventClass := Java classForName:'java.awt.event.ComponentEvent'.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7576
        id := (jComponentEventClass instVarNamed:'COMPONENT_MOVED').
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7577
        jEv1 := jComponentEventClass newCleared "basicNew".
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7578
        jEv1 instVarNamed:'id'        put:id.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7579
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7580
        id := (jComponentEventClass instVarNamed:'COMPONENT_RESIZED').
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7581
        jEv2 := jComponentEventClass newCleared "basicNew".
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7582
        jEv2 instVarNamed:'id'        put:id.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7583
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7584
        ^ Array with:jEv1 with:jEv2.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7585
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7586
    (type == #'focusIn') ifTrue:[
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  7587
"/ 'focusIn' printCR.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7588
        jComponentEventClass := Java classForName:'java.awt.event.FocusEvent'.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7589
        id := (jComponentEventClass instVarNamed:'FOCUS_GAINED').
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7590
        jEv := jComponentEventClass newCleared "basicNew".
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7591
        jEv instVarNamed:'id'        put:id.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7592
        ^ Array with:jEv.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7593
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7594
    (type == #'focusOut') ifTrue:[
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  7595
"/ 'focusOut' printCR.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7596
        jComponentEventClass := Java classForName:'java.awt.event.FocusEvent'.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7597
        id := (jComponentEventClass instVarNamed:'FOCUS_LOST').
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7598
        jEv := jComponentEventClass newCleared "basicNew".
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7599
        jEv instVarNamed:'id'        put:id.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7600
        ^ Array with:jEv.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7601
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7602
    (type == #'mapped') ifTrue:[
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  7603
"/ 'mapped' printCR.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7604
        jComponentEventClass := Java classForName:'java.awt.event.ComponentEvent'.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7605
        id := (jComponentEventClass instVarNamed:'COMPONENT_SHOWN').
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7606
"/        x := eventArgs at:1.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7607
"/        y := eventArgs at:2.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7608
        jEv := jComponentEventClass newCleared "basicNew".
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7609
        jEv instVarNamed:'id'        put:id.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7610
        ^ Array with:jEv.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7611
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7612
    (type == #'unmapped') ifTrue:[
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  7613
"/ 'unmapped' printCR.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7614
        jComponentEventClass := Java classForName:'java.awt.event.ComponentEvent'.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7615
        id := (jComponentEventClass instVarNamed:'COMPONENT_HIDDEN').
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7616
"/        x := eventArgs at:1.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7617
"/        y := eventArgs at:2.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7618
        jEv := jComponentEventClass newCleared "basicNew".
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7619
        jEv instVarNamed:'id'        put:id.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7620
        ^ Array with:jEv.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7621
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7622
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7623
    (type == #terminate) ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7624
        jWindowEventClass := Java classForName:'java.awt.event.WindowEvent'.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7625
        id := (jWindowEventClass instVarNamed:'WINDOW_CLOSED').
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7626
        jEv := jWindowEventClass newCleared "basicNew".
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7627
        jEv instVarNamed:'id'        put:id.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7628
        ^ Array with:jEv.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7629
    ].
319
6396dea8902f checkin from browser
cg
parents: 318
diff changeset
  7630
    EventTrace == true ifTrue:[
6396dea8902f checkin from browser
cg
parents: 318
diff changeset
  7631
        ('JAVA: unhandled event:' , type) infoPrintCR.
6396dea8902f checkin from browser
cg
parents: 318
diff changeset
  7632
    ].
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7633
    ^ nil.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7634
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7635
    "Created: / 6.1.1998 / 20:38:58 / cg"
319
6396dea8902f checkin from browser
cg
parents: 318
diff changeset
  7636
    "Modified: / 6.2.1998 / 03:07:00 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7637
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7638
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7639
doWindowsEventThread
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7640
    "invoked in an endless loop by the WToolkit-eventLoop
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7641
     native method."
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7642
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7643
    |sensor event more|
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7644
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7645
    JavaWindowGroup isNil ifTrue:[
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7646
        "/ '*** eventThread: no windowGroup ...' printCR.
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7647
        FirstWindowCreationSemaphore wait.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7648
        "/ Delay waitForSeconds:0.1.
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7649
        ^ self
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7650
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7651
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7652
    KnownWindows isNil ifTrue:[
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7653
        "/ '*** eventThread: no views ...' printCR.
284
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7654
        FirstWindowCreationSemaphore wait.
a4216f13deac more jdk1.2 stuff
cg
parents: 280
diff changeset
  7655
        "/ Delay waitForSeconds:0.1.
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7656
        ^ self
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7657
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7658
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7659
    "/ wait for an event to arrive ...
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7660
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7661
    sensor := JavaWindowGroup sensor.
329
937c1473f85a no yield when checking for events;
cg
parents: 326
diff changeset
  7662
    [sensor hasEvents or:[sensor damageCount ~~ 0]] whileFalse:[
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7663
        EventTrace ifTrue:[
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7664
            '*** eventThread waiting ...' printCR.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7665
        ].
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7666
        Processor activeProcess state:#eventWait.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7667
        sensor eventSemaphore wait.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7668
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7669
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7670
    EventTrace ifTrue:[
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7671
        '*** eventThread event arrived ...' printCR.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7672
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7673
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7674
    "/ EventTrace := true
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7675
    more := true.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7676
    [more] whileTrue:[
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7677
        sensor hasDamage ifTrue:[
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7678
            EventTrace ifTrue:[
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7679
                '*** eventThread: damage arrived ...' printCR.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7680
            ].
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7681
            event := sensor nextDamage.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7682
        ] ifFalse:[
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7683
            event := sensor nextEvent.
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7684
        ].
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7685
        event isNil ifTrue:[
319
6396dea8902f checkin from browser
cg
parents: 318
diff changeset
  7686
            EventTrace == true ifTrue:[
6396dea8902f checkin from browser
cg
parents: 318
diff changeset
  7687
                '*** eventThread: nil event ignored' printCR.
6396dea8902f checkin from browser
cg
parents: 318
diff changeset
  7688
            ].
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7689
            ^ self
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7690
        ].
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7691
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7692
        more := self processEvent:event
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7693
    ]
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7694
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7695
    "Created: / 6.1.1998 / 21:02:40 / cg"
329
937c1473f85a no yield when checking for events;
cg
parents: 326
diff changeset
  7696
    "Modified: / 5.4.1998 / 16:10:53 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7697
!
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7698
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7699
processEvent:event
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7700
    |evQ jEvents jWToolKit jWinPeer jWin v eventConsumed|
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7701
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7702
    KnownWindows isNil ifTrue:[
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7703
        ^ false
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7704
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7705
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7706
    v := event view.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7707
    jWinPeer := self jPeerForView:v.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7708
    jWinPeer isNil ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7709
        (v isKindOf:JavaView) ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7710
            "/ mhmh - an event for a JavaView,
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7711
            "/ which has no peer (anyMore ?)
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7712
            "/ should not happen.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7713
        ] ifFalse:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7714
            "/ mhmh - an event for a subcomponent of an ST widget.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7715
            "/ let it be handled normally.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7716
            EventTrace ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7717
                ('*** eventThread: ' , event type , '-event for unknown java-view - passed to view.') printCR.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7718
            ].
359
bcad9c97d2e5 use #copyReplaceAll:with:
cg
parents: 347
diff changeset
  7719
            event view dispatchEvent:event.
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7720
        ].
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7721
        ^ true
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7722
    ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7723
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7724
    "/ change:
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7725
    "/ in the previous version, events for ST/X widgets (i.e. buttons etc)
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7726
    "/ where not passed to java, but instead forwarded directly to the widget
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7727
    "/ by the code below.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7728
    "/ This has changed, to pass it to Java, which eventually passes it to the
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7729
    "/ peer via the handleEvent native method (unless the event got consumed).
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7730
    "/ This is req'd to let java keep track of keyboard/mouse input for widgets.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7731
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7732
false ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7733
"/    "/ most views handle their events themself (being ST/X views) ...
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7734
"/
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7735
"/    v class ~~ JavaView ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7736
"/"/        v class ~~ StandardSystemView ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7737
"/"/            EventTrace ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7738
"/"/                    ('*** eventThread: event handled by view itself (' , v class name , ')') printCR.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7739
"/"/            ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7740
"/"/            event sendEventWithFocusOn:nil.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7741
"/"/            ^ self.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7742
"/"/        ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7743
"/        (event type == #'exposeX:y:width:height'
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7744
"/        or:[event type == #'graphicsExposeX:y:width:height']) ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7745
"/            "/ send to view, but also handle in JAVA
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7746
"/            event sendEventWithFocusOn:nil.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7747
"/        ]
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7748
"/    ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7749
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7750
    (#(
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7751
        #'mapped'
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7752
        #'unmapped'
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7753
        #'configureX:y:width:height:'
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7754
        #'exposeX:y:width:height:'
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7755
        #'graphicsExposeX:y:width:height:'
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7756
     ) includes:event type) ifTrue:[
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7757
        event sendEventWithFocusOn:nil.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7758
    ].
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7759
].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7760
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7761
    "/ what a kludge - some events are passed back to
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7762
    "/ ST via the WComponent-handleEvent native method.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7763
    "/ However, repaints are not.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7764
    "/ In order to let ST widgets do the drawing,
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7765
    "/ selectively filter exposeEvents from Java ...
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7766
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7767
    eventConsumed := false.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7768
    v class == JavaView ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7769
        "/ all events handled by Java ...
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7770
    ] ifFalse:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7771
        eventConsumed := true.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7772
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7773
        "/ let widget handle it.
359
bcad9c97d2e5 use #copyReplaceAll:with:
cg
parents: 347
diff changeset
  7774
        event view dispatchEvent:event.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7775
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7776
        "/ some are not passed to Java ...
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7777
        event isDamage ifTrue:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7778
            (v isKindOf:TextView) ifTrue:[
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7779
                ^ true
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7780
            ].
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7781
            (v isKindOf:Label) ifTrue:[
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7782
                ^ true
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7783
            ].
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7784
            (v isKindOf:ComboBoxView) ifTrue:[
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7785
                ^ true
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7786
            ].
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7787
            (v isKindOf:ScrollBar) ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7788
                ^ self
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7789
            ].
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7790
            (v isKindOf:Scroller) ifTrue:[
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7791
                ^ self
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7792
            ].
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7793
            (v isKindOf:MenuPanel) ifTrue:[
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7794
                ^ true
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7795
            ].
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7796
        ].
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7797
    ].
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7798
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7799
    jWin := jWinPeer instVarNamed:'target'.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7800
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7801
    EventTrace ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7802
        ('*** eventThread: event (' , event type , ') handled by JAVA: ') infoPrint.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7803
        jWinPeer class name infoPrint. ' (' infoPrint.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7804
        jWin class name infoPrint. ')' infoPrintCR.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7805
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7806
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7807
    "/ create an event
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7808
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7809
    jEvents := self awtEventsForEvent:event javaWindow:jWin.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7810
    jEvents isNil ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7811
        EventTrace ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7812
            ('*** eventThread: event ignored: ' , event type) printCR.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7813
        ].
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7814
        ^ true
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7815
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7816
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7817
"/    v superView isNil ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7818
"/        ('*** eventThread: event ignored for topView: ' , event type) printCR.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7819
"/        ^ self
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7820
"/    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7821
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7822
    jWToolKit := (Java classForName:'java.awt.Toolkit') invoke:#getDefaultToolkit.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7823
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7824
    jEvents do:[:jEv |
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7825
        jEv instVarNamed:'source'   put:jWin.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7826
        jEv instVarNamed:'consumed' put:0.
261
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7827
        eventConsumed ifFalse:[
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7828
            "/ the first gets the original event as data
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7829
            jEv instVarNamed:'data' put:event.
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7830
            eventConsumed := true
d95d5a3cc475 lots of new stuff
cg
parents: 255
diff changeset
  7831
        ].
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7832
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7833
        "/ post it (them) to the event queue
318
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  7834
        EventTrace == true ifTrue:[
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  7835
            'postEvent to Java ...' printCR.
8720093188f7 debugPrints
cg
parents: 317
diff changeset
  7836
        ].
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7837
        jWToolKit class
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7838
            invoke:#'postEvent(Ljava/awt/AWTEvent;)V' 
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7839
            with:jEv.
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7840
    ].
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7841
270
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7842
    ^ false
6f21225aab53 *** empty log message ***
cg
parents: 268
diff changeset
  7843
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7844
    "Created: / 6.1.1998 / 20:36:36 / cg"
359
bcad9c97d2e5 use #copyReplaceAll:with:
cg
parents: 347
diff changeset
  7845
    "Modified: / 18.7.1998 / 22:09:33 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7846
! !
2d8b3948a08a *** empty log message ***
cg
parents: 253
diff changeset
  7847
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7848
!JavaVM class methodsFor:'documentation'!
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7849
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7850
version
373
fceafec7ae61 checkin from browser
cg
parents: 368
diff changeset
  7851
    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaVM.st,v 1.38 1998/10/05 14:31:54 cg Exp $'
253
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7852
! !
de483f561c9e *** empty log message ***
cg
parents:
diff changeset
  7853
JavaVM initialize!