5785 _Class_getSigners:nativeContext |
6145 _Class_getSigners:nativeContext |
5786 UnimplementedNativeMethodSignal raiseRequest |
6146 UnimplementedNativeMethodSignal raiseRequest |
5787 |
6147 |
5788 "Modified: / 12.11.1998 / 18:52:07 / cg" |
6148 "Modified: / 12.11.1998 / 18:52:07 / cg" |
5789 "Created: / 12.11.1998 / 18:55:01 / cg" |
6149 "Created: / 12.11.1998 / 18:55:01 / cg" |
|
6150 ! |
|
6151 |
|
6152 _Class_newInstance:nativeContext |
|
6153 "get an instance for a java.lang.Class" |
|
6154 |
|
6155 |jClass cls newInst| |
|
6156 |
|
6157 jClass := nativeContext receiver. |
|
6158 cls := self reflection javaClassObjectForClass:jClass. |
|
6159 cls classInit. |
|
6160 newInst := cls newCleared. |
|
6161 newInst perform:#'<init>()V'. |
|
6162 ^ newInst |
|
6163 |
|
6164 "Created: / 02-01-1998 / 22:41:38 / cg" |
|
6165 "Modified: / 15-01-1998 / 00:57:37 / cg" |
|
6166 "Modified: / 28-01-2011 / 14:12:25 / Marcel Hlopko <hlopik@gmail.com>" |
|
6167 ! |
|
6168 |
|
6169 _Class_setSigners:nativeContext |
|
6170 UnimplementedNativeMethodSignal raiseRequest |
|
6171 |
|
6172 "Modified: / 12.11.1998 / 18:52:07 / cg" |
|
6173 "Created: / 12.11.1998 / 18:55:08 / cg" |
|
6174 ! |
|
6175 |
|
6176 _ColorModel_deletepData:nativeContext |
|
6177 "/ void deletepData () |
|
6178 UnimplementedNativeMethodSignal raiseRequest |
|
6179 |
|
6180 "Created: / 12.11.1998 / 19:22:05 / cg" |
|
6181 ! |
|
6182 |
|
6183 _ColorModel_initIDs:nativeContext |
|
6184 "/ new with jdk1.2 ... |
|
6185 |
|
6186 "Created: / 28.1.1998 / 22:19:23 / cg" |
|
6187 ! |
|
6188 |
|
6189 _Color_initIDs:nativeContext |
|
6190 "/ new with jdk1.2 ... |
|
6191 |
|
6192 "Created: / 28.1.1998 / 22:19:23 / cg" |
|
6193 ! |
|
6194 |
|
6195 _Component_initIDs:nativeContext |
|
6196 "/ introduced with jdk1.2 ... (sigh) |
|
6197 |
|
6198 "Created: / 27.1.1998 / 19:53:29 / cg" |
|
6199 ! |
|
6200 |
|
6201 _ConstantPool_getDoubleAt0:nativeContext |
|
6202 | cpool index double | |
|
6203 |
|
6204 cpool := self reflection constantPoolFor:(nativeContext receiver). |
|
6205 self breakPoint:#mh. |
|
6206 index := nativeContext at:3. |
|
6207 "TODO: why 3?" |
|
6208 double := cpool at:index. |
|
6209 self assert:double isFloat description:'Not a float constant!!'. |
|
6210 ^ double |
|
6211 |
|
6212 "Modified: / 25-02-2011 / 18:40:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6213 "Created: / 28-02-2011 / 17:24:17 / Marcel Hlopko <hlopik@gmail.com>" |
|
6214 ! |
|
6215 |
|
6216 _ConstantPool_getIntAt0:nativeContext |
|
6217 | cpool index int | |
|
6218 |
|
6219 cpool := self reflection constantPoolFor:(nativeContext receiver). |
|
6220 index := nativeContext at:3. |
|
6221 "TODO: why 3?" |
|
6222 int := cpool at:index. |
|
6223 self assert:int isInteger description:'Not an integer constant!!'. |
|
6224 ^ int |
|
6225 |
|
6226 "Modified: / 25-02-2011 / 18:40:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6227 "Created: / 28-02-2011 / 17:28:10 / Marcel Hlopko <hlopik@gmail.com>" |
|
6228 ! |
|
6229 |
|
6230 _ConstantPool_getLongAt0:nativeContext |
|
6231 | cpool index long | |
|
6232 |
|
6233 cpool := self reflection constantPoolFor:(nativeContext receiver). |
|
6234 index := nativeContext at:3. |
|
6235 "TODO: why 3?" |
|
6236 long := cpool at:index. |
|
6237 self assert:long isInteger description:'Not a float constant!!'. |
|
6238 ^ long |
|
6239 |
|
6240 "Modified: / 28-02-2011 / 17:40:02 / Marcel Hlopko <hlopik@gmail.com>" |
|
6241 "Modified: / 28-02-2011 / 18:54:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6242 ! |
|
6243 |
|
6244 _ConstantPool_getUTF8At0: nativeContext |
|
6245 |
|
6246 | cpool index string | |
|
6247 cpool := self reflection constantPoolFor: (nativeContext receiver). |
|
6248 index := nativeContext at: 3. |
|
6249 "TODO: why 3?" |
|
6250 |
|
6251 string := cpool at: index. |
|
6252 self assert: string isString description: 'Not an UTF8 constant!!'. |
|
6253 ^Java as_String: string |
|
6254 |
|
6255 "Created: / 06-02-2011 / 12:56:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
6256 ! |
|
6257 |
|
6258 _Constructor_getModifiers:nativeContext |
|
6259 "/ int getModifiers () |
|
6260 |
|
6261 UnimplementedNativeMethodSignal raiseRequest. |
|
6262 |
|
6263 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6264 "Created: / 27.1.2000 / 02:54:38 / cg" |
|
6265 ! |
|
6266 |
|
6267 _Constructor_newInstance:nativeContext |
|
6268 "/ java.lang.Object newInstance (java.lang.Object[]) |
|
6269 |
|
6270 UnimplementedNativeMethodSignal raiseRequest. |
|
6271 |
|
6272 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6273 ! |
|
6274 |
|
6275 _Double_doubleToLongBits:nativeContext |
|
6276 |f i| |
|
6277 |
|
6278 f := nativeContext argAt:1. |
|
6279 |
|
6280 UninterpretedBytes isBigEndian ifTrue:[ |
|
6281 i := f basicAt:8. |
|
6282 i := i bitOr:((f basicAt:7) bitShift:8). |
|
6283 i := i bitOr:((f basicAt:6) bitShift:16). |
|
6284 i := i bitOr:((f basicAt:5) bitShift:24). |
|
6285 i := i bitOr:((f basicAt:4) bitShift:32). |
|
6286 i := i bitOr:((f basicAt:3) bitShift:40). |
|
6287 i := i bitOr:((f basicAt:2) bitShift:48). |
|
6288 i := i bitOr:((f basicAt:1) bitShift:56). |
|
6289 ] ifFalse:[ |
|
6290 i := f basicAt:1. |
|
6291 i := i bitOr:((f basicAt:2) bitShift:8). |
|
6292 i := i bitOr:((f basicAt:3) bitShift:16). |
|
6293 i := i bitOr:((f basicAt:4) bitShift:24). |
|
6294 i := i bitOr:((f basicAt:5) bitShift:32). |
|
6295 i := i bitOr:((f basicAt:6) bitShift:40). |
|
6296 i := i bitOr:((f basicAt:7) bitShift:48). |
|
6297 i := i bitOr:((f basicAt:8) bitShift:56). |
|
6298 ]. |
|
6299 |
|
6300 ^ i. |
|
6301 |
|
6302 "Created: / 4.1.1998 / 01:39:12 / cg" |
|
6303 ! |
|
6304 |
|
6305 _Double_valueOf0:nativeContext |
|
6306 |s d| |
|
6307 |
|
6308 s := nativeContext argAt:1. |
|
6309 s notNil ifTrue:[ |
|
6310 s := Java as_ST_String:s. |
|
6311 d := Float readFrom:s onError:nil. |
|
6312 ]. |
|
6313 d isNil ifTrue:[ |
|
6314 self throwNumberFormatException. |
|
6315 "/ not reached |
|
6316 ]. |
|
6317 |
|
6318 ^ d |
|
6319 |
|
6320 "Modified: / 8.8.1997 / 12:03:55 / cg" |
|
6321 "Created: / 7.1.1998 / 11:09:43 / cg" |
|
6322 ! |
|
6323 |
|
6324 _Field_get:nativeContext |
|
6325 "/ java.lang.Object get (java.lang.Object) |
|
6326 |
|
6327 UnimplementedNativeMethodSignal raiseRequest. |
|
6328 |
|
6329 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6330 "Created: / 27.1.2000 / 03:04:18 / cg" |
|
6331 ! |
|
6332 |
|
6333 _Field_getBoolean:nativeContext |
|
6334 "/ boolean getBoolean (java.lang.Object) |
|
6335 |
|
6336 UnimplementedNativeMethodSignal raiseRequest. |
|
6337 |
|
6338 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6339 "Created: / 27.1.2000 / 03:05:16 / cg" |
|
6340 ! |
|
6341 |
|
6342 _Field_getByte:nativeContext |
|
6343 "/ byte getByte (java.lang.Object) |
|
6344 |
|
6345 UnimplementedNativeMethodSignal raiseRequest. |
|
6346 |
|
6347 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6348 "Created: / 27.1.2000 / 03:05:30 / cg" |
|
6349 ! |
|
6350 |
|
6351 _Field_getChar:nativeContext |
|
6352 "/ char getChar (java.lang.Object) |
|
6353 |
|
6354 UnimplementedNativeMethodSignal raiseRequest. |
|
6355 |
|
6356 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6357 "Created: / 27.1.2000 / 03:03:37 / cg" |
|
6358 ! |
|
6359 |
|
6360 _Field_getDouble:nativeContext |
|
6361 "/ double getDouble (java.lang.Object) |
|
6362 |
|
6363 UnimplementedNativeMethodSignal raiseRequest. |
|
6364 |
|
6365 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6366 "Created: / 27.1.2000 / 03:07:49 / cg" |
|
6367 ! |
|
6368 |
|
6369 _Field_getFloat:nativeContext |
|
6370 "/ float getFloat (java.lang.Object) |
|
6371 |
|
6372 UnimplementedNativeMethodSignal raiseRequest. |
|
6373 |
|
6374 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6375 "Created: / 27.1.2000 / 03:05:41 / cg" |
|
6376 ! |
|
6377 |
|
6378 _Field_getInt:nativeContext |
|
6379 "/ int getInt (java.lang.Object) |
|
6380 |
|
6381 UnimplementedNativeMethodSignal raiseRequest. |
|
6382 |
|
6383 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6384 "Created: / 27.1.2000 / 03:04:47 / cg" |
|
6385 ! |
|
6386 |
|
6387 _Field_getLong:nativeContext |
|
6388 "/ long getLong (java.lang.Object) |
|
6389 |
|
6390 UnimplementedNativeMethodSignal raiseRequest. |
|
6391 |
|
6392 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6393 "Created: / 27.1.2000 / 03:05:54 / cg" |
|
6394 ! |
|
6395 |
|
6396 _Field_getModifiers:nativeContext |
|
6397 "/ int getModifiers () |
|
6398 |
|
6399 UnimplementedNativeMethodSignal raiseRequest. |
|
6400 |
|
6401 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6402 "Created: / 27.1.2000 / 03:07:03 / cg" |
|
6403 ! |
|
6404 |
|
6405 _Field_getShort:nativeContext |
|
6406 "/ unsigned short getShort (java.lang.Object) |
|
6407 |
|
6408 UnimplementedNativeMethodSignal raiseRequest. |
|
6409 |
|
6410 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6411 "Created: / 27.1.2000 / 03:07:35 / cg" |
|
6412 ! |
|
6413 |
|
6414 _Field_set:nativeContext |
|
6415 "/ void set (java.lang.Object java.lang.Object) |
|
6416 |
|
6417 UnimplementedNativeMethodSignal raiseRequest. |
|
6418 |
|
6419 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6420 "Created: / 27.1.2000 / 03:04:33 / cg" |
|
6421 ! |
|
6422 |
|
6423 _Field_setBoolean:nativeContext |
|
6424 "/ void setBoolean (java.lang.Object boolean) |
|
6425 |
|
6426 UnimplementedNativeMethodSignal raiseRequest. |
|
6427 |
|
6428 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6429 "Created: / 27.1.2000 / 03:06:06 / cg" |
|
6430 ! |
|
6431 |
|
6432 _Field_setByte:nativeContext |
|
6433 "/ void setByte (java.lang.Object byte) |
|
6434 |
|
6435 UnimplementedNativeMethodSignal raiseRequest. |
|
6436 |
|
6437 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6438 "Created: / 27.1.2000 / 03:06:20 / cg" |
|
6439 ! |
|
6440 |
|
6441 _Field_setChar:nativeContext |
|
6442 "/ void setChar (java.lang.Object char) |
|
6443 |
|
6444 UnimplementedNativeMethodSignal raiseRequest. |
|
6445 |
|
6446 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6447 "Created: / 27.1.2000 / 03:03:48 / cg" |
|
6448 ! |
|
6449 |
|
6450 _Field_setDouble:nativeContext |
|
6451 "/ void setDouble (java.lang.Object double) |
|
6452 |
|
6453 UnimplementedNativeMethodSignal raiseRequest. |
|
6454 |
|
6455 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6456 "Created: / 27.1.2000 / 03:04:02 / cg" |
|
6457 ! |
|
6458 |
|
6459 _Field_setFloat:nativeContext |
|
6460 "/ void setFloat (java.lang.Object float) |
|
6461 |
|
6462 UnimplementedNativeMethodSignal raiseRequest. |
|
6463 |
|
6464 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6465 "Created: / 27.1.2000 / 03:06:48 / cg" |
|
6466 ! |
|
6467 |
|
6468 _Field_setInt:nativeContext |
|
6469 "/ void setInt (java.lang.Object int) |
|
6470 |
|
6471 UnimplementedNativeMethodSignal raiseRequest. |
|
6472 |
|
6473 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6474 "Created: / 27.1.2000 / 03:05:04 / cg" |
|
6475 ! |
|
6476 |
|
6477 _Field_setLong:nativeContext |
|
6478 "/ void setLong (java.lang.Object long) |
|
6479 |
|
6480 UnimplementedNativeMethodSignal raiseRequest. |
|
6481 |
|
6482 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6483 "Created: / 27.1.2000 / 03:06:37 / cg" |
|
6484 ! |
|
6485 |
|
6486 _Field_setShort:nativeContext |
|
6487 "/ void setShort (java.lang.Object unsigned short) |
|
6488 |
|
6489 UnimplementedNativeMethodSignal raiseRequest. |
|
6490 |
|
6491 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6492 "Created: / 27.1.2000 / 03:03:23 / cg" |
|
6493 ! |
|
6494 |
|
6495 _FileDescriptor_initSystemFD:nativeContext |
|
6496 |descriptor fileNo idx myStream| |
|
6497 |
|
6498 descriptor := nativeContext argAt:1. |
|
6499 fileNo := nativeContext argAt:2. |
|
6500 |
|
6501 fileNo == 0 ifTrue:[ |
|
6502 myStream := Stdin |
|
6503 ] ifFalse:[ |
|
6504 fileNo == 1 ifTrue:[ |
|
6505 myStream := JavaConsoleStream ? Stdout |
|
6506 ] ifFalse:[ |
|
6507 fileNo == 2 ifTrue:[ |
|
6508 myStream := JavaConsoleStream ? Stderr |
|
6509 ] ifFalse:[ |
|
6510 self halt:'invalid fileNo given'. |
|
6511 self internalError:'invalid fileNo given'. |
|
6512 ] |
|
6513 ] |
|
6514 ]. |
|
6515 |
|
6516 self setOpenFile:myStream at:fileNo. |
|
6517 |
|
6518 descriptor instVarNamed:'fd' put:fileNo. |
|
6519 ^ descriptor |
|
6520 |
|
6521 "Modified: / 27.1.1998 / 18:15:28 / cg" |
|
6522 ! |
|
6523 |
|
6524 _FileDescriptor_sync:nativeContext |
|
6525 "/ void sync () |
|
6526 UnimplementedNativeMethodSignal raiseRequest |
|
6527 |
|
6528 "Modified: / 12.11.1998 / 18:57:39 / cg" |
|
6529 "Created: / 12.11.1998 / 19:26:25 / cg" |
|
6530 ! |
|
6531 |
|
6532 _FileDescriptor_valid:nativeContext |
|
6533 "/ boolean valid () |
|
6534 |descriptor fileNo stream| |
|
6535 |
|
6536 descriptor := nativeContext receiver. |
|
6537 fileNo := descriptor instVarNamed:'fd'. |
|
6538 stream := self getOpenFileAt:fileNo. |
|
6539 stream isNil ifTrue:[^ 0]. "/ FALSE |
|
6540 stream isOpen ifFalse:[^ 0]. "/ FALSE |
|
6541 |
|
6542 ^ 1 "/ TRUE |
|
6543 |
|
6544 "Modified: / 11.12.1998 / 13:02:47 / cg" |
|
6545 ! |
|
6546 |
|
6547 _FileInputStream_available:nativeContext |
|
6548 |file| |
|
6549 |
|
6550 file := self validateFile:(nativeContext receiver). |
|
6551 file isNil ifTrue:[ |
|
6552 self throwIOExceptionWithMessage:'invalid fileNo in available'. |
|
6553 ^ self |
|
6554 ]. |
|
6555 file == Stdin ifTrue:[ |
|
6556 file := StdinReplacementFileQuerySignal raiseRequest. |
|
6557 file isNil ifTrue:[ |
|
6558 ^ 1 |
|
6559 ] |
|
6560 ]. |
|
6561 file isFileStream ifTrue:[ |
|
6562 ^ file size - file position + 1 |
|
6563 ]. |
|
6564 file atEnd ifTrue:[ |
|
6565 ^ 0. |
|
6566 ]. |
|
6567 self halt. |
|
6568 ^ 1 |
|
6569 |
|
6570 "Modified: / 14.1.1998 / 15:12:52 / cg" |
|
6571 ! |
|
6572 |
|
6573 _FileInputStream_close:nativeContext |
|
6574 ^ self anyStream_close:nativeContext |
|
6575 |
|
6576 "Created: / 4.1.1998 / 17:45:23 / cg" |
|
6577 "Modified: / 4.2.1998 / 15:20:46 / cg" |
|
6578 ! |
|
6579 |
|
6580 _FileInputStream_read:nativeContext |
|
6581 |file byte| |
|
6582 |
|
6583 file := self validateFile:(nativeContext receiver). |
|
6584 |
|
6585 file == Stdin ifTrue:[ |
|
6586 file := StdinReplacementFileQuerySignal raiseRequest. |
|
6587 file isNil ifTrue:[ |
|
6588 ^ -1 |
|
6589 ] |
|
6590 ]. |
|
6591 |
|
6592 FileIOTrace ifTrue:[ |
|
6593 ('JAVA: read 1 byte from ' , file pathName) infoPrintCR. |
|
6594 ]. |
|
6595 |
|
6596 byte := file nextByte. |
|
6597 byte isNil ifTrue:[ |
|
6598 ^ -1 |
|
6599 ]. |
|
6600 ^ byte |
|
6601 |
|
6602 "Created: / 5.1.1998 / 02:17:08 / cg" |
|
6603 "Modified: / 5.1.1998 / 02:17:25 / cg" |
|
6604 ! |
|
6605 |
|
6606 _FileInputStream_readBytes:nativeContext |
|
6607 ^ self anyStream_readBytes:nativeContext |
|
6608 |
|
6609 "Modified: / 4.2.1998 / 15:23:08 / cg" |
|
6610 ! |
|
6611 |
|
6612 _FileInputStream_skip:nativeContext |
|
6613 "/ long skip (long) |
|
6614 |file nSkip nSkipped| |
|
6615 |
|
6616 file := self validateFile:(nativeContext receiver). |
|
6617 nSkip := nativeContext argAt:1. |
|
6618 |
|
6619 file == Stdin ifTrue:[ |
|
6620 file := StdinReplacementFileQuerySignal raiseRequest. |
|
6621 file isNil ifTrue:[ |
|
6622 ^ -1 |
|
6623 ] |
|
6624 ]. |
|
6625 |
|
6626 FileIOTrace ifTrue:[ |
|
6627 (('JAVA: skip %1 byte(s) from ' bindWith:nSkip printString) , file pathName) infoPrintCR. |
|
6628 ]. |
|
6629 |
|
6630 file skip:nSkip. |
|
6631 ^ nSkip |
|
6632 |
|
6633 "Modified: / 27.1.1999 / 20:36:11 / cg" |
|
6634 ! |
|
6635 |
|
6636 _FileOutputStream_close:nativeContext |
|
6637 ^ self anyStream_close:nativeContext |
|
6638 |
|
6639 "Created: / 13.1.1998 / 09:33:16 / cg" |
|
6640 "Modified: / 4.2.1998 / 15:20:53 / cg" |
|
6641 ! |
|
6642 |
|
6643 _FileOutputStream_openAppend:nativeContext |
|
6644 ^ self commonOpen:nativeContext forAppend:true |
|
6645 |
|
6646 "Modified: / 7.4.1998 / 19:13:42 / cg" |
|
6647 ! |
|
6648 |
|
6649 _File_canRead0:nativeContext |
|
6650 |file path f| |
|
6651 |
|
6652 file := nativeContext receiver. |
|
6653 path := file instVarNamed:'path'. |
|
6654 path notNil ifTrue:[ |
|
6655 path := Java as_ST_String:path. |
|
6656 |
|
6657 FileAccessTrace == true ifTrue:[ |
|
6658 path storeString print. ' ' print. thisContext printCR |
|
6659 ]. |
|
6660 |
|
6661 path := self fixFilename:path. |
|
6662 (f := path asFilename) isReadable ifTrue:[ |
|
6663 ^ 1 "/ TRUE |
|
6664 ] |
|
6665 ]. |
|
6666 ^ 0 "/ FALSE |
|
6667 |
|
6668 "Created: / 4.1.1998 / 18:09:55 / cg" |
|
6669 "Modified: / 27.1.1999 / 18:57:55 / cg" |
|
6670 ! |
|
6671 |
|
6672 _File_canWrite0:nativeContext |
|
6673 |file path f| |
|
6674 |
|
6675 file := nativeContext receiver. |
|
6676 path := file instVarNamed:'path'. |
|
6677 path notNil ifTrue:[ |
|
6678 FileAccessTrace == true ifTrue:[ |
|
6679 path storeString print. ' ' print. thisContext printCR |
|
6680 ]. |
|
6681 path := Java as_ST_String:path. |
|
6682 path := self fixFilename:path. |
|
6683 (f := path asFilename) isWritable ifTrue:[ |
|
6684 ^ 1 "/ TRUE |
|
6685 ] |
|
6686 ]. |
|
6687 ^ 0 "/ FALSE |
|
6688 |
|
6689 "Created: / 4.2.1998 / 00:19:55 / cg" |
|
6690 "Modified: / 27.1.1999 / 18:57:52 / cg" |
|
6691 ! |
|
6692 |
|
6693 _File_canonPath:nativeContext |
|
6694 "/ introduced with jdk1.2 ... (sigh) |
|
6695 |
|
6696 |jPath path realPath| |
|
6697 |
|
6698 jPath := nativeContext argAt:1. |
|
6699 jPath isNil ifTrue:[^ jPath]. |
|
6700 |
|
6701 path := Java as_ST_String:jPath. |
|
6702 realPath := path asFilename pathName. |
|
6703 |
|
6704 ^ Java as_String:realPath |
|
6705 |
|
6706 "Created: / 27.1.1998 / 18:35:58 / cg" |
|
6707 "Modified: / 27.1.1998 / 21:36:03 / cg" |
|
6708 ! |
|
6709 |
|
6710 _File_delete0:nativeContext |
|
6711 "/ boolean delete0 () |
|
6712 |oldFile oldPath oldF| |
|
6713 |
|
6714 oldFile := nativeContext receiver. |
|
6715 oldPath := oldFile instVarNamed:'path'. |
|
6716 oldPath isNil ifTrue:[^ 0]. "/ FALSE |
|
6717 |
|
6718 oldPath := Java as_ST_String:oldPath. |
|
6719 oldF := oldPath asFilename. |
|
6720 |
|
6721 oldF exists ifFalse:[ |
|
6722 ^ 1 "/ TRUE |
|
6723 ]. |
|
6724 |
|
6725 (self checkWritePermissionOfDirectory:oldF directory message:('JAVA Security check\\Delete of ''' , oldPath , '''.\Grant permission ?')) |
|
6726 ifFalse:[ |
|
6727 ^ 0 "/ FALSE |
|
6728 ]. |
|
6729 |
|
6730 OperatingSystem accessDeniedErrorSignal handle:[:ex | |
|
6731 ^ 0 "/ FALSE |
|
6732 ] do:[ |
|
6733 oldF delete. |
|
6734 ^ 1 "/ TRUE |
|
6735 ]. |
|
6736 ^ 0 "/ FALSE |
|
6737 |
|
6738 "Modified: / 30.12.1998 / 20:15:06 / cg" |
|
6739 ! |
|
6740 |
|
6741 _File_exists0:nativeContext |
|
6742 |file path f| |
|
6743 |
|
6744 file := nativeContext receiver. |
|
6745 path := file instVarNamed:'path'. |
|
6746 path notNil ifTrue:[ |
|
6747 path := Java as_ST_String:path. |
|
6748 path := self fixFilename:path. |
|
6749 FileAccessTrace == true ifTrue:[ |
|
6750 path storeString print. ' ' print. thisContext printCR |
|
6751 ]. |
|
6752 (f := path asFilename) exists ifTrue:[ |
|
6753 ^ 1 "TRUE" |
|
6754 ] |
|
6755 ]. |
|
6756 ^ 0 "FALSE" |
|
6757 |
|
6758 "Created: / 5.1.1998 / 02:07:48 / cg" |
|
6759 "Modified: / 27.1.1999 / 18:57:46 / cg" |
|
6760 ! |
|
6761 |
|
6762 _File_initIDs:nativeContext |
|
6763 "/ introduced with jdk1.2 ... (sigh) |
|
6764 |
|
6765 "Created: / 27.1.1998 / 18:25:19 / cg" |
|
6766 ! |
|
6767 |
|
6768 _File_isAbsolute:nativeContext |
|
6769 |file path f| |
|
6770 |
|
6771 file := nativeContext receiver. |
|
6772 path := file instVarNamed:'path'. |
|
6773 path notNil ifTrue:[ |
|
6774 path := Java as_ST_String:path. |
|
6775 path := self fixFilename:path. |
|
6776 (f := path asFilename) isAbsolute ifTrue:[ |
|
6777 ^ 1 "/ TRUE |
|
6778 ] |
|
6779 ]. |
|
6780 ^ 0 "/ FALSE |
|
6781 |
|
6782 "Created: / 11.1.1998 / 09:54:38 / cg" |
|
6783 "Modified: / 20.10.1998 / 20:59:53 / cg" |
|
6784 ! |
|
6785 |
|
6786 _File_isDirectory0:nativeContext |
|
6787 |file path f| |
|
6788 |
|
6789 file := nativeContext receiver. |
|
6790 path := file instVarNamed:'path'. |
|
6791 path notNil ifTrue:[ |
|
6792 FileAccessTrace == true ifTrue:[ |
|
6793 path storeString print. ' ' print. thisContext printCR |
|
6794 ]. |
|
6795 path := Java as_ST_String:path. |
|
6796 path := self fixFilename:path. |
|
6797 (f := path asFilename) exists ifTrue:[ |
|
6798 f isDirectory ifTrue:[^ 1 "TRUE"] |
|
6799 ] |
|
6800 ]. |
|
6801 ^ 0 "FALSE" |
|
6802 |
|
6803 "Created: / 7.1.1998 / 10:31:37 / cg" |
|
6804 "Modified: / 27.1.1999 / 18:58:01 / cg" |
|
6805 ! |
|
6806 |
|
6807 _File_isFile0:nativeContext |
|
6808 |file path f| |
|
6809 |
|
6810 file := nativeContext receiver. |
|
6811 path := file instVarNamed:'path'. |
|
6812 path notNil ifTrue:[ |
|
6813 FileAccessTrace == true ifTrue:[ |
|
6814 path storeString print. ' ' print. thisContext printCR |
|
6815 ]. |
|
6816 path := Java as_ST_String:path. |
|
6817 path := self fixFilename:path. |
|
6818 (f := path asFilename) exists ifTrue:[ |
|
6819 f isDirectory ifFalse:[^ 1 "TRUE"] |
|
6820 ] |
|
6821 ]. |
|
6822 ^ 0 "/ FALSE |
|
6823 |
|
6824 "Created: / 11.1.1998 / 11:40:22 / cg" |
|
6825 "Modified: / 27.1.1999 / 18:58:04 / cg" |
|
6826 ! |
|
6827 |
|
6828 _File_lastModified0:nativeContext |
|
6829 |file path f| |
|
6830 |
|
6831 file := nativeContext receiver. |
|
6832 path := file instVarNamed:'path'. |
|
6833 path notNil ifTrue:[ |
|
6834 path := Java as_ST_String:path. |
|
6835 path := self fixFilename:path. |
|
6836 (f := path asFilename) exists ifTrue:[ |
|
6837 ^ f modificationTime getMilliseconds. |
|
6838 ] |
|
6839 ]. |
|
6840 ^ 0 |
|
6841 |
|
6842 "Created: / 4.2.1998 / 16:50:30 / cg" |
|
6843 "Modified: / 20.10.1998 / 21:00:05 / cg" |
|
6844 ! |
|
6845 |
|
6846 _File_length0:nativeContext |
|
6847 |file path f| |
|
6848 |
|
6849 file := nativeContext receiver. |
|
6850 path := file instVarNamed:'path'. |
|
6851 path notNil ifTrue:[ |
|
6852 FileAccessTrace == true ifTrue:[ |
|
6853 thisContext printCR |
|
6854 ]. |
|
6855 path := Java as_ST_String:path. |
|
6856 path := self fixFilename:path. |
|
6857 (f := path asFilename) exists ifTrue:[ |
|
6858 ^ f fileSize |
|
6859 ] |
|
6860 ]. |
|
6861 ^ -1 |
|
6862 |
|
6863 "Created: / 7.1.1998 / 12:18:57 / cg" |
|
6864 "Modified: / 27.1.1999 / 18:57:06 / cg" |
|
6865 ! |
|
6866 |
|
6867 _File_list0:nativeContext |
|
6868 |file path f files| |
|
6869 |
|
6870 file := nativeContext receiver. |
|
6871 path := file instVarNamed:'path'. |
|
6872 path notNil ifTrue:[ |
|
6873 path := Java as_ST_String:path. |
|
6874 path := self fixFilename:path. |
|
6875 (f := path asFilename) exists ifTrue:[ |
|
6876 f isDirectory ifTrue:[ |
|
6877 files := f directoryContents asArray. |
|
6878 files := files collect:[:nm | Java as_String:nm]. |
|
6879 ^ files |
|
6880 ] |
|
6881 ] |
|
6882 ]. |
|
6883 ^ nil |
|
6884 |
|
6885 "Created: / 14.1.1998 / 21:30:22 / cg" |
|
6886 "Modified: / 20.10.1998 / 21:00:21 / cg" |
|
6887 ! |
|
6888 |
|
6889 _File_mkdir0:nativeContext |
|
6890 |file path f| |
|
6891 |
|
6892 file := nativeContext receiver. |
|
6893 path := file instVarNamed:'path'. |
|
6894 path notNil ifTrue:[ |
|
6895 path := Java as_ST_String:path. |
|
6896 path := self fixFilename:path. |
|
6897 f := path asFilename. |
|
6898 (f exists and:[f isDirectory]) ifTrue:[ |
|
6899 ^ 0 "/ FALSE |
|
6900 ]. |
|
6901 |
|
6902 FileOpenConfirmation ifTrue:[ |
|
6903 (self confirm:('JAVA Security check\\Create directory ''' , path , '''.\Grant permission ?') withCRs) |
|
6904 ifFalse:[ |
|
6905 ^ 0 "/ FALSE |
|
6906 ] |
|
6907 ]. |
|
6908 OperatingSystem accessDeniedErrorSignal handle:[:ex | |
|
6909 ^ 0 "/ FALSE |
|
6910 ] do:[ |
|
6911 f makeDirectory. |
|
6912 ]. |
|
6913 f exists ifTrue:[ |
|
6914 f isDirectory ifTrue:[^ 1 "TRUE"] |
|
6915 ] |
|
6916 ]. |
|
6917 ^ 0 "FALSE" |
|
6918 |
|
6919 "Created: / 4.2.1998 / 00:19:05 / cg" |
|
6920 "Modified: / 4.12.1998 / 14:04:03 / cg" |
|
6921 ! |
|
6922 |
|
6923 _File_renameTo0:nativeContext |
|
6924 "/ void renameTo0 (java.io.File) |
|
6925 |
|
6926 |oldFile newFile oldPath newPath oldF newF| |
|
6927 |
|
6928 oldFile := nativeContext receiver. |
|
6929 oldPath := oldFile instVarNamed:'path'. |
|
6930 oldPath isNil ifTrue:[^ 0]. "/ FALSE |
|
6931 |
|
6932 oldPath := Java as_ST_String:oldPath. |
|
6933 oldF := oldPath asFilename. |
|
6934 |
|
6935 newFile := nativeContext argAt:1. |
|
6936 newPath := newFile instVarNamed:'path'. |
|
6937 newPath isNil ifTrue:[^ 0]. "/ FALSE |
|
6938 newPath := Java as_ST_String:newPath. |
|
6939 |
|
6940 newF := newPath asFilename. |
|
6941 |
|
6942 (self checkWritePermissionOfDirectory:oldF directory message:('JAVA Security check\\Rename of ''' , oldPath , ''' to ''' , newPath , '''.\Grant permission ?')) |
|
6943 ifFalse:[ |
|
6944 ^ 0 "/ FALSE |
|
6945 ]. |
|
6946 oldF directory pathName ~= newF directory pathName ifTrue:[ |
|
6947 (self checkWritePermissionOfDirectory:newF directory message:('JAVA Security check\\Rename of ''' , oldPath , ''' to ''' , newPath , '''.\Grant permission ?')) |
|
6948 ifFalse:[ |
|
6949 ^ 0 "/ FALSE |
|
6950 ]. |
|
6951 ]. |
|
6952 |
|
6953 OperatingSystem accessDeniedErrorSignal handle:[:ex | |
|
6954 ^ 0 "/ FALSE |
|
6955 ] do:[ |
|
6956 oldF renameTo:newF. |
|
6957 ^ 1 "/ TRUE |
|
6958 ]. |
|
6959 ^ 0 "/ FALSE |
|
6960 |
|
6961 "Modified: / 3.12.1998 / 21:01:08 / cg" |
|
6962 ! |
|
6963 |
|
6964 _File_rmdir0:nativeContext |
|
6965 "/ boolean rmdir0 () |
|
6966 UnimplementedNativeMethodSignal raiseRequest |
|
6967 |
|
6968 "Modified: / 12.11.1998 / 19:01:48 / cg" |
|
6969 "Created: / 12.11.1998 / 19:03:52 / cg" |
|
6970 ! |
|
6971 |
|
6972 _Float_floatToIntBits:nativeContext |
|
6973 |f i| |
|
6974 |
|
6975 f := nativeContext argAt:1. |
|
6976 |
|
6977 UninterpretedBytes isBigEndian ifTrue:[ |
|
6978 i := f basicAt:4. |
|
6979 i := i bitOr:((f basicAt:3) bitShift:8). |
|
6980 i := i bitOr:((f basicAt:2) bitShift:16). |
|
6981 i := i bitOr:((f basicAt:1) bitShift:24). |
|
6982 ] ifFalse:[ |
|
6983 i := f basicAt:1. |
|
6984 i := i bitOr:((f basicAt:2) bitShift:8). |
|
6985 i := i bitOr:((f basicAt:3) bitShift:16). |
|
6986 i := i bitOr:((f basicAt:4) bitShift:24). |
|
6987 ]. |
|
6988 |
|
6989 ^ i. |
|
6990 |
|
6991 "Created: / 4.1.1998 / 01:25:50 / cg" |
|
6992 ! |
|
6993 |
|
6994 _Float_intBitsToFloat:nativeContet |
|
6995 |i aFloat| |
|
6996 |
|
6997 i := nativeContet argAt:1. |
|
6998 |
|
6999 aFloat := ShortFloat basicNew. |
|
7000 UninterpretedBytes isBigEndian ifTrue:[ |
|
7001 aFloat basicAt:1 put:((i bitShift:-24) bitAnd:16rFF). |
|
7002 aFloat basicAt:2 put:((i bitShift:-16) bitAnd:16rFF). |
|
7003 aFloat basicAt:3 put:((i bitShift:-8) bitAnd:16rFF). |
|
7004 aFloat basicAt:4 put:(i bitAnd:16rFF). |
|
7005 ] ifFalse:[ |
|
7006 aFloat basicAt:1 put:(i bitAnd:16rFF). |
|
7007 aFloat basicAt:2 put:((i bitShift:-8) bitAnd:16rFF). |
|
7008 aFloat basicAt:3 put:((i bitShift:-16) bitAnd:16rFF). |
|
7009 aFloat basicAt:4 put:((i bitShift:-24) bitAnd:16rFF). |
|
7010 ]. |
|
7011 |
|
7012 ^ aFloat. |
|
7013 |
|
7014 "Created: / 13.1.1998 / 23:03:36 / cg" |
|
7015 "Modified: / 13.1.1998 / 23:05:01 / cg" |
|
7016 ! |
|
7017 |
|
7018 _FontDescriptor_initIDs:nativeContext |
|
7019 "/ new with jdk1.2 ... |
|
7020 |
|
7021 "Created: / 28.1.1998 / 22:30:52 / cg" |
|
7022 ! |
|
7023 |
|
7024 _Font_initIDs:nativeContext |
|
7025 "/ new with jdk1.2 ... |
|
7026 |
|
7027 "Created: / 27.1.1998 / 21:43:25 / cg" |
|
7028 ! |
|
7029 |
|
7030 _GifImageDecoder_parseImage:nativeContext |
|
7031 |decoder width height bool1 depth subHdrBytes dstBytes i1 i2 colorModel |
|
7032 stream byte compressedData compressedSize index count data |
|
7033 leftOffs topOffs codeLen flags pixelStore clrModel t buffSize |
|
7034 countGot countGot2| |
|
7035 |
|
7036 decoder := nativeContext receiver. |
|
7037 |
|
7038 i1 := nativeContext argAt:1. |
|
7039 i2 := nativeContext argAt:2. |
|
7040 width := nativeContext argAt:3. |
|
7041 height := nativeContext argAt:4. |
|
7042 bool1 := nativeContext argAt:5. |
|
7043 depth := nativeContext argAt:6. |
|
7044 subHdrBytes := nativeContext argAt:7. |
|
7045 dstBytes := nativeContext argAt:8. |
|
7046 colorModel := nativeContext argAt:9. |
|
7047 |
|
7048 leftOffs := subHdrBytes wordAt:1 MSB:false. |
|
7049 topOffs := subHdrBytes wordAt:3 MSB:false. |
|
7050 width := subHdrBytes wordAt:5 MSB:false. |
|
7051 height := subHdrBytes wordAt:7 MSB:false. |
|
7052 flags := subHdrBytes at:9. |
|
7053 codeLen := subHdrBytes at:10. |
|
7054 |
|
7055 stream := decoder instVarNamed:'input'. |
|
7056 pixelStore := decoder instVarNamed:'store'. |
|
7057 pixelStore isNil ifTrue:[ |
|
7058 ^ 0 |
|
7059 ]. |
|
7060 |
|
7061 buffSize := (width * height // 2) max:4096. |
|
7062 compressedData := ByteArray uninitializedNew:buffSize. |
|
7063 "get compressed data" |
|
7064 index := 1. |
|
7065 count := stream perform:#'read()I'. |
|
7066 |
|
7067 [count notNil and:[count > 0]] whileTrue:[ |
|
7068 (index + count) > buffSize ifTrue:[ |
|
7069 t := ByteArray uninitializedNew:(buffSize * 2). |
|
7070 t replaceFrom:1 to:buffSize with:compressedData startingAt:1. |
|
7071 compressedData := t. |
|
7072 buffSize := buffSize * 2. |
|
7073 ]. |
|
7074 [count ~~ 0] whileTrue:[ |
|
7075 countGot := stream |
|
7076 perform:#'read([BII)I' |
|
7077 with:compressedData |
|
7078 with:index-1 |
|
7079 with:count. |
|
7080 |
|
7081 countGot > 0 ifTrue:[ |
|
7082 count := count - countGot. |
|
7083 index := index + countGot. |
|
7084 ] ifFalse:[ |
|
7085 count := -1. |
|
7086 ] |
|
7087 ]. |
|
7088 |
|
7089 count >= 0 ifTrue:[ |
|
7090 count := stream perform:#read. |
|
7091 ] |
|
7092 ]. |
|
7093 compressedSize := index - 1. |
|
7094 |
|
7095 data := pixelStore perform:#'allocateLines(I)Ljava/lang/Object;' with:height. |
|
7096 (data isMemberOf:ByteArray) ifFalse:[ |
|
7097 self halt. |
|
7098 ^ 0. |
|
7099 ]. |
|
7100 "/ 'GIFReader: decompressing ...' infoPrintCR. |
|
7101 |
|
7102 |
|
7103 GIFReader |
|
7104 decompressGIFFrom:compressedData |
|
7105 count:compressedSize |
|
7106 into:data |
|
7107 startingAt:1 |
|
7108 codeLen:(codeLen + 1). |
|
7109 |
|
7110 clrModel := pixelStore instVarNamed:'colormodel'. |
|
7111 |
|
7112 pixelStore |
|
7113 perform:#'setPixels(IIII[BII)Z' |
|
7114 withArguments: |
|
7115 (Array |
|
7116 with:0 "/ x |
|
7117 with:0 "/ y |
|
7118 with:width "/ w |
|
7119 with:height "/ h |
|
7120 with:data |
|
7121 with:0 "/ offs |
|
7122 with:width). "/ scanSize |
|
7123 |
|
7124 pixelStore perform:#'imageComplete()V'. |
|
7125 "/ perform:#'imageComplete(I)V' |
|
7126 "/ with:((Java at:'java.awt.image.ImageConsumer') instVarNamed:'STATICIMAGEDONE'). |
|
7127 |
|
7128 "/ self internalError:'breakPoint'. |
|
7129 ^ 1 "/ true |
|
7130 |
|
7131 "Modified: / 10.4.1998 / 14:31:59 / cg" |
|
7132 ! |
|
7133 |
|
7134 _ImageRepresentation_disposeImage:nativeContext |
|
7135 |imgRep img| |
|
7136 |
|
7137 imgRep := nativeContext receiver. |
|
7138 |
|
7139 img := imgRep instVarNamed:'pData'. |
|
7140 (img notNil and:[img ~~ 0]) ifTrue:[ |
|
7141 ImageStretchCache notNil ifTrue:[ |
|
7142 ImageStretchCache removeKey:img ifAbsent:nil. |
|
7143 ] |
|
7144 ]. |
|
7145 |
|
7146 imgRep instVarNamed:'pData' put:0. |
|
7147 "/ self halt. |
|
7148 |
|
7149 "Created: / 7.1.1998 / 22:31:46 / cg" |
|
7150 "Modified: / 17.1.1998 / 13:26:55 / cg" |
|
7151 ! |
|
7152 |
|
7153 _ImageRepresentation_finish:nativeContext |
|
7154 |imgRep bool| |
|
7155 |
|
7156 imgRep := nativeContext receiver. |
|
7157 bool := nativeContext argAt:1. |
|
7158 "/ self halt. |
|
7159 "/ 'JAVA: ImageRepresentation_finish ignored for now' infoPrintCR. |
|
7160 |
|
7161 ^ 1 "/ true |
|
7162 |
|
7163 "Created: / 8.1.1998 / 00:11:40 / cg" |
|
7164 "Modified: / 6.2.1998 / 02:12:54 / cg" |
|
7165 ! |
|
7166 |
|
7167 _ImageRepresentation_imageDraw:nativeContext |
|
7168 |imgRep x y img deviceImage jGraphics gc clr| |
|
7169 |
|
7170 imgRep := nativeContext receiver. |
|
7171 img := imgRep instVarNamed:'pData'. |
|
7172 (img isNil or:[img == 0]) ifTrue:[ |
|
7173 "/ self halt. |
|
7174 ^ self. |
|
7175 ]. |
|
7176 jGraphics := nativeContext argAt:1. |
|
7177 gc := jGraphics instVarNamed:'pData'. |
|
7178 gc realized ifFalse:[^ self]. |
|
7179 |
|
7180 x := nativeContext argAt:2. |
|
7181 y := nativeContext argAt:3. |
|
7182 clr := nativeContext argAt:4. |
|
7183 |
|
7184 deviceImage := img onDevice:gc device. |
|
7185 deviceImage ~~ img ifTrue:[ |
|
7186 imgRep instVarNamed:'pData' put:deviceImage. |
|
7187 ]. |
|
7188 gc realized ifFalse:[^ self]. |
|
7189 deviceImage displayOn:gc x:x y:y. |
|
7190 ^ 1. |
|
7191 |
|
7192 "Created: / 13.1.1998 / 13:32:28 / cg" |
|
7193 "Modified: / 25.11.1998 / 15:36:38 / cg" |
|
7194 ! |
|
7195 |
|
7196 _ImageRepresentation_imageStretch:nativeContext |
|
7197 |imgRep x1 y1 x2 y2 srcX1 srcY1 w h |
|
7198 img deviceImage jGraphics gc clr stretchWidth stretchHeight| |
|
7199 |
|
7200 imgRep := nativeContext receiver. |
|
7201 img := imgRep instVarNamed:'pData'. |
|
7202 (img isNil or:[img == 0]) ifTrue:[ |
|
7203 "/ self halt. |
|
7204 ^ self. |
|
7205 ]. |
|
7206 |
|
7207 jGraphics := nativeContext argAt:1. |
|
7208 gc := jGraphics instVarNamed:'pData'. |
|
7209 gc realized ifFalse:[^ self]. |
|
7210 |
|
7211 x1 := nativeContext argAt:2. |
|
7212 y1 := nativeContext argAt:3. |
|
7213 x2 := nativeContext argAt:4. |
|
7214 y2:= nativeContext argAt:5. |
|
7215 srcX1 := nativeContext argAt:6. |
|
7216 srcY1 := nativeContext argAt:7. |
|
7217 w := nativeContext argAt:8. |
|
7218 h := nativeContext argAt:9. |
|
7219 clr := nativeContext argAt:10. |
|
7220 |
|
7221 (srcX1 ~~ 0 or:[srcY1 ~~ 0]) ifTrue:[ |
|
7222 self halt. |
|
7223 ^ self. |
|
7224 ]. |
|
7225 (w ~~ img width or:[h ~~ img height]) ifTrue:[ |
|
7226 self halt. |
|
7227 ^ self |
|
7228 ]. |
|
7229 |
|
7230 "/ TODO: remember magnified images somewhere for a while, |
|
7231 "/ to avoid repeated action ... |
|
7232 |
|
7233 stretchWidth := (x2-x1). |
|
7234 stretchHeight := (y2-y1). |
|
7235 |
|
7236 (stretchWidth == img width |
|
7237 and:[stretchHeight == img height]) ifTrue:[ |
|
7238 deviceImage := img onDevice:gc device. |
|
7239 deviceImage ~~ img ifTrue:[ |
|
7240 imgRep instVarNamed:'pData' put:deviceImage. |
|
7241 ]. |
|
7242 ] ifFalse:[ |
|
7243 ImageStretchCache notNil ifTrue:[ |
|
7244 deviceImage := ImageStretchCache at:img ifAbsent:nil. |
|
7245 ]. |
|
7246 (deviceImage isNil |
|
7247 or:[deviceImage width ~~ stretchWidth |
|
7248 or:[deviceImage height ~~ stretchHeight]]) ifTrue:[ |
|
7249 deviceImage := (img magnifiedTo:stretchWidth@stretchHeight) onDevice:gc device. |
|
7250 ImageStretchCache isNil ifTrue:[ |
|
7251 ImageStretchCache := WeakIdentityDictionary new. |
|
7252 ]. |
|
7253 ImageStretchCache at:img put:deviceImage |
|
7254 ]. |
|
7255 ]. |
|
7256 deviceImage displayOn:gc x:x1 y:y1 |
|
7257 |
|
7258 "Created: / 13.1.1998 / 13:32:28 / cg" |
|
7259 "Modified: / 15.1.1998 / 13:14:47 / cg" |
|
7260 ! |
|
7261 |
|
7262 _ImageRepresentation_offscreenInit:nativeContext |
|
7263 |imgRep jclr w h form screenDevice| |
|
7264 |
|
7265 imgRep := nativeContext receiver. |
|
7266 jclr := nativeContext argAt:1. |
|
7267 |
|
7268 w := imgRep instVarNamed:'width'. |
|
7269 h := imgRep instVarNamed:'height'. |
|
7270 |
|
7271 screenDevice := Screen current. |
|
7272 form := Form width:w height:h depth:(screenDevice depth) on:screenDevice. |
|
7273 |
|
7274 imgRep instVarNamed:'pData' put:form. |
|
7275 "/ self halt. |
|
7276 |
|
7277 "Created: / 7.1.1998 / 22:31:46 / cg" |
|
7278 "Modified: / 17.1.1998 / 12:36:43 / cg" |
|
7279 ! |
|
7280 |
|
7281 _ImageRepresentation_setBytePixels:nativeContext |
|
7282 |imgRep x y w h clrModel bytes offs i2 |
|
7283 img depth cmap rgbMap opaque transparentColorIndex |
|
7284 scanLineWidth nBytes srcIdx dstIdx| |
|
7285 |
|
7286 imgRep := nativeContext receiver. |
|
7287 x := nativeContext argAt:1. |
|
7288 y := nativeContext argAt:2. |
|
7289 w := nativeContext argAt:3. |
|
7290 h := nativeContext argAt:4. |
|
7291 clrModel := nativeContext argAt:5. |
|
7292 bytes := nativeContext argAt:6. |
|
7293 offs := nativeContext argAt:7. "/ offset ?? |
|
7294 scanLineWidth := nativeContext argAt:8. |
|
7295 |
|
7296 depth := clrModel instVarNamed:'pixel_bits'. |
|
7297 (clrModel instVarNamed:'map_size') ~~ 0 ifTrue:[ |
|
7298 rgbMap := clrModel instVarNamed:'rgb'. |
|
7299 cmap := Array new:rgbMap size. |
|
7300 rgbMap |
|
7301 keysAndValuesDo:[:idx :rgb | |
|
7302 cmap at:idx put:(Color rgbValue:(rgb bitAnd:16rFFFFFF)) |
|
7303 ]. |
|
7304 ]. |
|
7305 |
|
7306 opaque := (clrModel instVarNamed:'opaque') ~~ 0. |
|
7307 opaque ifFalse:[ |
|
7308 transparentColorIndex := clrModel instVarNamed:'transparent_index' |
|
7309 ]. |
|
7310 |
|
7311 img := imgRep instVarNamed:'pData'. |
|
7312 (img isNil or:[img == 0]) ifFalse:[ |
|
7313 "/ self halt |
|
7314 ]. |
|
7315 |
|
7316 (offs ~~ 0 or:[scanLineWidth ~~ w]) ifTrue:[ |
|
7317 nBytes := ByteArray new:w*h. |
|
7318 srcIdx := offs+1. |
|
7319 dstIdx := 1. |
|
7320 1 to:h do:[:y | |
|
7321 nBytes replaceFrom:dstIdx to:(dstIdx+w-1) with:bytes startingAt:srcIdx. |
|
7322 srcIdx := srcIdx + scanLineWidth. |
|
7323 dstIdx := dstIdx + w. |
|
7324 ]. |
|
7325 bytes := nBytes. |
|
7326 ]. |
|
7327 img := Image width:w height:h depth:depth fromArray:bytes. |
|
7328 cmap notNil ifTrue:[ |
|
7329 img colorMap:cmap. |
|
7330 img photometric:#palette |
|
7331 ]. |
|
7332 opaque ifFalse:[ |
|
7333 img mask:(ImageReader |
|
7334 buildMaskFromColor:transparentColorIndex |
|
7335 for:bytes |
|
7336 width:w |
|
7337 height:h) |
|
7338 ]. |
|
7339 |
|
7340 imgRep instVarNamed:'pData' put:img. |
|
7341 ^ 1. |
|
7342 |
|
7343 "Created: / 7.1.1998 / 22:31:46 / cg" |
|
7344 "Modified: / 21.10.1998 / 00:35:45 / cg" |
|
7345 ! |
|
7346 |
|
7347 _ImageRepresentation_setIntPixels:nativeContext |
|
7348 |imgRep x y w h clrModel ints offs scanLineWidth |
|
7349 img depth cmap rgbMap opaque transparentColorIndex |
|
7350 bytes srcIdx dstIdx val red green blue |
|
7351 redMask greenMask blueMask redShift greenShift blueShift| |
|
7352 |
|
7353 imgRep := nativeContext receiver. |
|
7354 x := nativeContext argAt:1. |
|
7355 y := nativeContext argAt:2. |
|
7356 w := nativeContext argAt:3. |
|
7357 h := nativeContext argAt:4. |
|
7358 clrModel := nativeContext argAt:5. |
|
7359 ints := nativeContext argAt:6. |
|
7360 offs := nativeContext argAt:7. "/ offset ?? |
|
7361 scanLineWidth := nativeContext argAt:8. "/ scanLineWidth ?? |
|
7362 opaque := false. |
|
7363 offs ~~ 0 ifTrue:[ |
|
7364 self halt |
|
7365 ]. |
|
7366 |
|
7367 depth := clrModel instVarNamed:'pixel_bits'. |
|
7368 clrModel class == (Java at:'java.awt.image.DirectColorModel') ifTrue:[ |
|
7369 ] ifFalse:[ |
|
7370 (clrModel instVarNamed:'map_size') ~~ 0 ifTrue:[ |
|
7371 rgbMap := clrModel instVarNamed:'rgb'. |
|
7372 cmap := Array new:rgbMap size. |
|
7373 rgbMap |
|
7374 keysAndValuesDo:[:idx :rgb | |
|
7375 cmap at:idx put:(Color rgbValue:(rgb bitAnd:16rFFFFFF)) |
|
7376 ]. |
|
7377 ]. |
|
7378 opaque := (clrModel instVarNamed:'opaque') ~~ 0. |
|
7379 opaque ifFalse:[ |
|
7380 transparentColorIndex := clrModel instVarNamed:'transparent_index' |
|
7381 ]. |
|
7382 ]. |
|
7383 |
|
7384 img := imgRep instVarNamed:'pData'. |
|
7385 (img isNil or:[img == 0]) ifFalse:[ |
|
7386 "/ self halt. |
|
7387 ]. |
|
7388 |
|
7389 depth == 32 ifTrue:[ |
|
7390 "/ temporary kludge - ony use 24 bits/pixel |
|
7391 bytes := ByteArray new:w*h*3. |
|
7392 srcIdx := 1. |
|
7393 dstIdx := 1. |
|
7394 redMask := clrModel instVarNamed:'red_mask'. |
|
7395 greenMask := clrModel instVarNamed:'green_mask'. |
|
7396 blueMask := clrModel instVarNamed:'blue_mask'. |
|
7397 redShift := (clrModel instVarNamed:'red_offset') negated. |
|
7398 greenShift := (clrModel instVarNamed:'green_offset') negated. |
|
7399 blueShift := (clrModel instVarNamed:'blue_offset') negated. |
|
7400 |
|
7401 1 to:h do:[:y | |
|
7402 1 to:w do:[:x | |
|
7403 val := ints at:srcIdx. |
|
7404 red := (val bitAnd:redMask) bitShift:redShift. |
|
7405 green := (val bitAnd:greenMask) bitShift:greenShift. |
|
7406 blue := (val bitAnd:blueMask) bitShift:blueShift. |
|
7407 bytes at:dstIdx put:red. |
|
7408 bytes at:dstIdx+1 put:green. |
|
7409 bytes at:dstIdx+2 put:blue. |
|
7410 dstIdx := dstIdx + 3. |
|
7411 srcIdx := srcIdx + 1. |
|
7412 ]. |
|
7413 srcIdx := srcIdx + (scanLineWidth - w). |
|
7414 ]. |
|
7415 img := Depth24Image width:w height:h depth:24 fromArray:bytes. |
|
7416 img photometric:#rgb. |
|
7417 ] ifFalse:[ |
|
7418 scanLineWidth ~~ w ifTrue:[ |
|
7419 self halt |
|
7420 ]. |
|
7421 img := Image width:w height:h depth:depth fromArray:ints. |
|
7422 cmap notNil ifTrue:[ |
|
7423 img colorMap:cmap. |
|
7424 img photometric:#palette |
|
7425 ] ifFalse:[ |
|
7426 img photometric:#rgb |
|
7427 ]. |
|
7428 ]. |
|
7429 opaque ifFalse:[ |
|
7430 img mask:(ImageReader |
|
7431 buildMaskFromColor:transparentColorIndex |
|
7432 for:ints |
|
7433 width:w |
|
7434 height:h) |
|
7435 ]. |
|
7436 |
|
7437 imgRep instVarNamed:'pData' put:img. |
|
7438 ^ 1. |
|
7439 |
|
7440 "Created: / 1.2.1998 / 17:38:47 / cg" |
|
7441 "Modified: / 21.10.1998 / 00:35:37 / cg" |
|
7442 ! |
|
7443 |
|
7444 _InetAddressImpl_getHostByAddr:nativeContext |
|
7445 "/ java.lang.String getHostByAddr (int) |
|
7446 UnimplementedNativeMethodSignal raise |
|
7447 |
|
7448 "Created: / 12.11.1998 / 19:08:04 / cg" |
|
7449 ! |
|
7450 |
|
7451 _InetAddressImpl_getInetFamily:nativeContext |
|
7452 "/ self unimplementedNativeMethod. |
|
7453 ^ 0 |
|
7454 |
|
7455 "Modified: / 15.8.1997 / 17:04:43 / cg" |
|
7456 "Created: / 5.1.1998 / 02:05:48 / cg" |
|
7457 ! |
|
7458 |
|
7459 _InetAddressImpl_getLocalHostName:nativeContext |
|
7460 "" |
|
7461 |
|
7462 |hostName| |
|
7463 |
|
7464 hostName := OperatingSystem getHostName. |
|
7465 |
|
7466 ^ (Java as_String:hostName). |
|
7467 |
|
7468 "Modified: / 7.8.1997 / 21:16:55 / cg" |
|
7469 "Created: / 5.1.1998 / 02:07:03 / cg" |
|
7470 ! |
|
7471 |
|
7472 _InetAddressImpl_lookupAllHostAddr:nativeContext |
|
7473 "" |
|
7474 |
|
7475 |jAddrImpl jHostName hostName addrBytes| |
|
7476 |
|
7477 jAddrImpl := nativeContext receiver. |
|
7478 jHostName := nativeContext argAt:1. |
|
7479 |
|
7480 hostName := Java as_ST_String:jHostName. |
|
7481 addrBytes := Socket ipAddressOfHost:hostName. |
|
7482 addrBytes isNil ifTrue:[ |
|
7483 addrBytes := #[0 0 0 0] copy |
|
7484 ]. |
|
7485 ^ Array with:addrBytes |
|
7486 |
|
7487 "Modified: / 8.8.1997 / 12:04:25 / cg" |
|
7488 "Created: / 7.1.1998 / 18:51:31 / cg" |
|
7489 ! |
|
7490 |
|
7491 _InetAddressImpl_makeAnyLocalAddress:nativeContext |
|
7492 "" |
|
7493 |
|
7494 |jAddrImpl jAddr hostName addrBytes address| |
|
7495 |
|
7496 jAddrImpl := nativeContext receiver. |
|
7497 jAddr := nativeContext argAt:1. |
|
7498 |
|
7499 hostName := OperatingSystem getHostName. |
|
7500 addrBytes := Socket ipAddressOfHost:hostName. |
|
7501 addrBytes isNil ifTrue:[ |
|
7502 addrBytes := #[127 0 0 0]. |
|
7503 ]. |
|
7504 "/ MSB first into an integer. |
|
7505 address := (addrBytes at:1). |
|
7506 address := (address bitShift:8) bitOr:(addrBytes at:2). |
|
7507 address := (address bitShift:8) bitOr:(addrBytes at:3). |
|
7508 address := (address bitShift:8) bitOr:(addrBytes at:4). |
|
7509 |
|
7510 jAddr instVarNamed:'hostName' put:(Java as_String:hostName). |
|
7511 jAddr instVarNamed:'address' put:address. |
|
7512 jAddr instVarNamed:'family' put:0. |
|
7513 |
|
7514 ^ nil |
|
7515 |
|
7516 "Created: / 5.1.1998 / 02:06:27 / cg" |
|
7517 "Modified: / 21.10.1998 / 03:30:29 / cg" |
|
7518 ! |
|
7519 |
|
7520 _InetAddress_getInetFamily:nativeContext |
|
7521 "/ self unimplementedNativeMethod. |
|
7522 ^ 0 |
|
7523 |
|
7524 "Modified: / 15.8.1997 / 17:04:43 / cg" |
|
7525 "Created: / 17.11.1998 / 23:54:38 / cg" |
|
7526 ! |
|
7527 |
|
7528 _InetAddress_getLocalHostName:nativeContext |
|
7529 "" |
|
7530 |
|
7531 |hostName| |
|
7532 |
|
7533 hostName := OperatingSystem getHostName. |
|
7534 |
|
7535 ^ Java as_String:hostName. |
|
7536 |
|
7537 "Modified: / 7.8.1997 / 21:16:55 / cg" |
|
7538 "Created: / 17.11.1998 / 23:54:54 / cg" |
|
7539 ! |
|
7540 |
|
7541 _InetAddress_init:nativeContext |
|
7542 "/ introduced with jdk1.2 ... (sigh) |
|
7543 |
|
7544 "Created: / 27.1.1998 / 18:16:40 / cg" |
|
7545 |
|
7546 |
|
7547 ! |
|
7548 |
|
7549 _InetAddress_lookupAllHostAddr:nativeContext |
|
7550 "" |
|
7551 |
|
7552 |jAddrImpl jHostName hostName addrBytes| |
|
7553 |
|
7554 jAddrImpl := nativeContext receiver. |
|
7555 jHostName := nativeContext argAt:1. |
|
7556 |
|
7557 hostName := Java as_ST_String:jHostName. |
|
7558 addrBytes := Socket ipAddressOfHost:hostName. |
|
7559 addrBytes isNil ifTrue:[ |
|
7560 addrBytes := #[0 0 0 0] copy |
|
7561 ]. |
|
7562 ^ Array with:addrBytes |
|
7563 |
|
7564 "Modified: / 8.8.1997 / 12:04:25 / cg" |
|
7565 "Created: / 17.11.1998 / 23:56:10 / cg" |
|
7566 ! |
|
7567 |
|
7568 _InetAddress_lookupHostByAddr:nativeContext |
|
7569 "java.lang.Object[] lookupHostByAddr (int)" |
|
7570 |
|
7571 UnimplementedNativeMethodSignal raise. |
|
7572 |
|
7573 "Created: / 27.1.2000 / 02:59:22 / cg" |
|
7574 ! |
|
7575 |
|
7576 _InetAddress_lookupHostByName:nativeContext |
|
7577 "java.lang.Object[] lookupHostByName (java.lang.String)" |
|
7578 |
|
7579 UnimplementedNativeMethodSignal raise. |
|
7580 |
|
7581 "Modified: / 27.1.2000 / 02:58:53 / cg" |
|
7582 ! |
|
7583 |
|
7584 _InetAddress_makeAnyLocalAddress:nativeContext |
|
7585 "" |
|
7586 |
|
7587 |jAddrImpl jAddr hostName addrBytes address| |
|
7588 |
|
7589 jAddrImpl := nativeContext receiver. |
|
7590 jAddr := nativeContext argAt:1. |
|
7591 |
|
7592 hostName := OperatingSystem getHostName. |
|
7593 addrBytes := Socket ipAddressOfHost:hostName. |
|
7594 addrBytes isNil ifTrue:[ |
|
7595 addrBytes := #[127 0 0 0]. |
|
7596 ]. |
|
7597 "/ MSB first into an integer. |
|
7598 address := (addrBytes at:1). |
|
7599 address := (address bitShift:8) bitOr:(addrBytes at:2). |
|
7600 address := (address bitShift:8) bitOr:(addrBytes at:3). |
|
7601 address := (address bitShift:8) bitOr:(addrBytes at:4). |
|
7602 |
|
7603 jAddr instVarNamed:'hostName' put:(Java as_String:hostName). |
|
7604 jAddr instVarNamed:'address' put:address. |
|
7605 jAddr instVarNamed:'family' put:0. |
|
7606 |
|
7607 ^ nil |
|
7608 |
|
7609 "Modified: / 21.10.1998 / 03:30:29 / cg" |
|
7610 "Created: / 17.11.1998 / 23:54:00 / cg" |
|
7611 ! |
|
7612 |
|
7613 _Inflater_end0:nativeContext |
|
7614 "/ void end0 () |
|
7615 |
|
7616 UnimplementedNativeMethodSignal raise. |
|
7617 |
|
7618 "Modified: / 27.1.2000 / 03:08:47 / cg" |
|
7619 "Created: / 27.1.2000 / 03:11:21 / cg" |
|
7620 ! |
|
7621 |
|
7622 _Inflater_getAdler0:nativeContext |
|
7623 "/ int getAdler0 () |
|
7624 |
|
7625 UnimplementedNativeMethodSignal raise. |
|
7626 |
|
7627 "Modified: / 27.1.2000 / 03:08:47 / cg" |
|
7628 "Created: / 27.1.2000 / 03:12:15 / cg" |
|
7629 ! |
|
7630 |
|
7631 _Inflater_getTotalIn0:nativeContext |
|
7632 "/ int getTotalIn0 () |
|
7633 |
|
7634 UnimplementedNativeMethodSignal raise. |
|
7635 |
|
7636 "Created: / 27.1.2000 / 03:10:50 / cg" |
|
7637 "Modified: / 27.1.2000 / 03:11:08 / cg" |
|
7638 ! |
|
7639 |
|
7640 _Inflater_getTotalOut0:nativeContext |
|
7641 "/ int getTotalOut0 () |
|
7642 |
|
7643 UnimplementedNativeMethodSignal raise. |
|
7644 |
|
7645 "Modified: / 27.1.2000 / 03:08:47 / cg" |
|
7646 "Created: / 27.1.2000 / 03:12:01 / cg" |
|
7647 ! |
|
7648 |
|
7649 _Inflater_inflate0:nativeContext |
|
7650 "/ int inflate0 (byte[] int int) |
|
7651 |
|
7652 UnimplementedNativeMethodSignal raise. |
|
7653 |
|
7654 "Modified: / 27.1.2000 / 03:08:47 / cg" |
|
7655 "Created: / 27.1.2000 / 03:11:39 / cg" |
|
7656 ! |
|
7657 |
|
7658 _Inflater_reset0:nativeContext |
|
7659 "/ void reset0 () |
|
7660 |
|
7661 UnimplementedNativeMethodSignal raise. |
|
7662 |
|
7663 "Modified: / 27.1.2000 / 03:08:47 / cg" |
|
7664 "Created: / 27.1.2000 / 03:11:02 / cg" |
|
7665 ! |
|
7666 |
|
7667 _Inflater_reset:nativeContext |
|
7668 |
|
7669 UnimplementedNativeMethodSignal raise. |
|
7670 |
|
7671 "Created: / 01-02-1998 / 20:14:13 / cg" |
|
7672 "Modified: / 30-04-2011 / 22:56:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
7673 ! |
|
7674 |
|
7675 _Inflater_setDictionary0:nativeContext |
|
7676 "/ void setDictionary0 (byte[] int int) |
|
7677 |
|
7678 UnimplementedNativeMethodSignal raise. |
|
7679 |
|
7680 "Modified: / 27.1.2000 / 03:08:47 / cg" |
|
7681 "Created: / 27.1.2000 / 03:10:33 / cg" |
|
7682 ! |
|
7683 |
|
7684 _InputThread_run:nativeContext |
|
7685 self _WToolkit_eventLoop:nativeContext. |
|
7686 |
|
7687 "Created: / 28.1.1998 / 22:34:47 / cg" |
|
7688 "Modified: / 28.1.1998 / 22:35:16 / cg" |
|
7689 ! |
|
7690 |
|
7691 _Introspector_getMethodDescriptor:nativeContext |
|
7692 "java.lang.String getMethodDescriptor (java.lang.reflect.Method)" |
|
7693 |
|
7694 UnimplementedNativeMethodSignal raise. |
|
7695 |
|
7696 "Created: / 27.1.2000 / 02:47:43 / cg" |
|
7697 ! |
|
7698 |
|
7699 _Introspector_getMethodParameterCount:nativeContext |
|
7700 "int getMethodParameterCount (java.lang.reflect.Method)" |
|
7701 |
|
7702 UnimplementedNativeMethodSignal raise. |
|
7703 |
|
7704 "Created: / 27.1.2000 / 02:49:15 / cg" |
|
7705 ! |
|
7706 |
|
7707 _Introspector_getPublicDeclaredMethods0:nativeContext |
|
7708 "java.lang.reflect.Method[] getPublicDeclaredMethods0 (java.lang.Class)" |
|
7709 |
|
7710 UnimplementedNativeMethodSignal raise. |
|
7711 |
|
7712 "Created: / 27.1.2000 / 02:48:49 / cg" |
|
7713 ! |
|
7714 |
|
7715 _JPEGImageDecoder_readImage:nativeContext |
|
7716 UnimplementedNativeMethodSignal raise |
|
7717 |
|
7718 "Created: / 12.11.1998 / 18:53:30 / cg" |
|
7719 "Modified: / 12.11.1998 / 18:53:40 / cg" |
|
7720 ! |
|
7721 |
|
7722 _MButtonPeer_create:nativeContext |
|
7723 ^ self _WButtonPeer_create:nativeContext |
|
7724 ! |
|
7725 |
|
7726 _MCanvasPeer_create:nativeContext |
|
7727 |jCanvasPeer jFrame frame subView| |
|
7728 |
|
7729 jCanvasPeer := nativeContext receiver. |
|
7730 |
|
7731 jFrame := nativeContext argAt:1. |
|
7732 jFrame isNil ifTrue:[ |
|
7733 self halt:'no frame in canvasPeer create'. |
|
7734 self internalError:'no frame in canvasPeer create'. |
|
7735 ^ self. |
|
7736 ]. |
|
7737 frame := jFrame instVarNamed:'pData'. |
|
7738 |
|
7739 subView := JavaView in:frame. |
|
7740 subView delegate:self. |
|
7741 subView javaPeer:jCanvasPeer. |
|
7742 |
|
7743 self createdWindowsView:subView for:jCanvasPeer. |
|
7744 |
|
7745 WindowCreationTrace == true ifTrue:[ |
|
7746 'WCanvasPeer_create: ' print. frame print. ' -> ' print. subView printNL. |
|
7747 ]. |
|
7748 |
|
7749 "Modified: / 16.1.1998 / 13:40:00 / cg" |
|
7750 "Created: / 18.11.1998 / 00:14:44 / cg" |
|
7751 ! |
|
7752 |
|
7753 _MComponentPeer_cacheInit:nativeContext |
|
7754 |
|
7755 "Created: / 28.1.1998 / 22:22:30 / cg" |
|
7756 ! |
|
7757 |
|
7758 _MComponentPeer_handleEvent:nativeContext |
|
7759 ^ self _WComponentPeer_handleEvent:nativeContext |
|
7760 |
|
7761 "Created: / 18.11.1998 / 00:21:17 / cg" |
|
7762 ! |
|
7763 |
|
7764 _MComponentPeer_nativeHandleEvent:nativeContext |
|
7765 ^ self _WComponentPeer_nativeHandleEvent:nativeContext |
|
7766 ! |
|
7767 |
|
7768 _MComponentPeer_pHide:nativeContext |
|
7769 ^ self _WComponentPeer_hide:nativeContext |
|
7770 |
|
7771 "Created: / 18.11.1998 / 00:15:18 / cg" |
|
7772 ! |
|
7773 |
|
7774 _MComponentPeer_pInitialize:nativeContext |
|
7775 |
|
7776 "Created: / 28.1.1998 / 22:27:25 / cg" |
|
7777 ! |
|
7778 |
|
7779 _MComponentPeer_pReshape:nativeContext |
|
7780 self commonReshapeComponent:nativeContext |
|
7781 |
|
7782 "Created: / 18.11.1998 / 00:18:17 / cg" |
|
7783 ! |
|
7784 |
|
7785 _MComponentPeer_pSetBackground:nativeContext |
|
7786 |view jClr rgb clr| |
|
7787 |
|
7788 view := self viewForWPeer:nativeContext. |
|
7789 jClr := nativeContext argAt:1. |
|
7790 rgb := jClr instVarNamed:'value'. |
|
7791 |
|
7792 clr := Color rgbValue:rgb. |
|
7793 |
|
7794 clr := clr on:(view device). |
|
7795 (view isKindOf:ScrollableView) ifTrue:[ |
|
7796 view := view scrolledView |
|
7797 ]. |
|
7798 view viewBackground:clr. |
|
7799 view backgroundPaint:clr. |
|
7800 ! |
|
7801 |
|
7802 _MComponentPeer_pSetFont:nativeContext |
|
7803 |view jFont stFont name style size| |
|
7804 |
|
7805 view := self viewForWPeer:nativeContext. |
|
7806 jFont := nativeContext argAt:1. |
|
7807 |
|
7808 stFont := jFont instVarNamed:'pData'. |
|
7809 (stFont isNil or:[stFont == 0]) ifTrue:[ |
|
7810 name := jFont instVarNamed:'name'. |
|
7811 style := jFont instVarNamed:'style'. |
|
7812 size := jFont instVarNamed:'size'. |
|
7813 |
|
7814 stFont := self replacementFontFor:(Java as_ST_String:name) style:style size:size. |
|
7815 jFont instVarNamed:'pData' put:stFont. |
|
7816 ]. |
|
7817 view font:stFont. |
|
7818 |
|
7819 ^ nil |
|
7820 ! |
|
7821 |
|
7822 _MComponentPeer_pSetForeground:nativeContext |
|
7823 |view jClr rgb clr| |
|
7824 |
|
7825 view := self viewForWPeer:nativeContext. |
|
7826 jClr := nativeContext argAt:1. |
|
7827 rgb := jClr instVarNamed:'value'. |
|
7828 |
|
7829 clr := Color rgbValue:rgb. |
|
7830 |
|
7831 clr := clr on:(view device). |
|
7832 |
|
7833 (view isKindOf:ScrollableView) ifTrue:[ |
|
7834 view := view scrolledView |
|
7835 ]. |
|
7836 view foregroundColor:clr. |
|
7837 ! |
|
7838 |
|
7839 _MComponentPeer_pShow:nativeContext |
|
7840 |view| |
|
7841 |
|
7842 view := self viewForWPeer:nativeContext. |
|
7843 |
|
7844 "/ frame views are under my browsers own control |
|
7845 (view isMemberOf:JavaEmbeddedFrameView) ifFalse:[ |
|
7846 view beVisible. |
|
7847 view realize. |
|
7848 ]. |
|
7849 |
|
7850 "/ view windowGroup notNil ifTrue:[ |
|
7851 "/ windowServer addGroup:(view windowGroup) |
|
7852 "/ ]. |
|
7853 |
|
7854 ^ nil |
|
7855 |
|
7856 "/ self halt. |
|
7857 |
|
7858 "Modified: / 25.1.1998 / 09:54:07 / cg" |
|
7859 "Created: / 18.11.1998 / 00:21:51 / cg" |
|
7860 ! |
|
7861 |
|
7862 _MComponentPeer_setBackground:nativeContext |
|
7863 |jClr rgb clr view| |
|
7864 |
|
7865 view := self viewForWPeer:nativeContext. |
|
7866 |
|
7867 jClr := nativeContext argAt:1. |
|
7868 rgb := jClr instVarNamed:'value'. |
|
7869 "/ self halt. |
|
7870 clr := Color rgbValue:rgb. |
|
7871 |
|
7872 |
|
7873 clr := clr on:(view device). |
|
7874 |
|
7875 (view isKindOf:ScrollableView) ifTrue:[ |
|
7876 view := view scrolledView |
|
7877 ]. |
|
7878 view viewBackground:clr. |
|
7879 view backgroundPaint:clr. |
|
7880 |
|
7881 "Created: / 17.11.1998 / 23:49:41 / cg" |
|
7882 ! |
|
7883 |
|
7884 _MComponentPeer_setCursor:nativeContext |
|
7885 |
|
7886 "Created: / 28.1.1998 / 22:27:35 / cg" |
|
7887 ! |
|
7888 |
|
7889 _MComponentPeer_setFont:nativeContext |
|
7890 |view| |
|
7891 |
|
7892 view := self viewForWPeer:nativeContext. |
|
7893 "/ self halt. |
|
7894 |
|
7895 "Modified: / 25.1.1998 / 01:22:19 / cg" |
|
7896 "Created: / 17.11.1998 / 23:43:48 / cg" |
|
7897 ! |
|
7898 |
|
7899 _MComponentPeer_setForeground:nativeContext |
|
7900 |jClr rgb clr view| |
|
7901 |
|
7902 view := self viewForWPeer:nativeContext. |
|
7903 |
|
7904 jClr := nativeContext argAt:1. |
|
7905 rgb := jClr instVarNamed:'value'. |
|
7906 "/ self halt. |
|
7907 clr := Color rgbValue:rgb. |
|
7908 |
|
7909 clr := clr on:(view device). |
|
7910 |
|
7911 view paint:clr. |
|
7912 |
|
7913 "Created: / 17.11.1998 / 23:50:31 / cg" |
|
7914 "Modified: / 17.11.1998 / 23:57:29 / cg" |
|
7915 ! |
|
7916 |
|
7917 _MFramePeer_create:nativeContext |
|
7918 ^ self _WFramePeer_create:nativeContext |
|
7919 |
|
7920 "Created: / 28.1.1998 / 22:25:44 / cg" |
|
7921 ! |
|
7922 |
|
7923 _MFramePeer_getWindowBackgroundColor:nativeContext |
|
7924 ^ View defaultViewBackgroundColor rgbValue. |
|
7925 |
|
7926 "Created: / 17.11.1998 / 23:55:42 / cg" |
|
7927 ! |
|
7928 |
|
7929 _MFramePeer_pHide:nativeContext |
|
7930 ^ self _WComponentPeer_hide:nativeContext |
|
7931 |
|
7932 "Created: / 28.1.1998 / 22:27:04 / cg" |
|
7933 ! |
|
7934 |
|
7935 _MFramePeer_pReshape:nativeContext |
|
7936 self commonReshapeComponent:nativeContext |
|
7937 |
|
7938 "Created: / 28.1.1998 / 22:28:00 / cg" |
|
7939 "Modified: / 28.1.1998 / 22:29:34 / cg" |
|
7940 ! |
|
7941 |
|
7942 _MFramePeer_pSetTitle:nativeContext |
|
7943 self _WWindowPeer__setTitle:nativeContext |
|
7944 |
|
7945 "Created: / 28.1.1998 / 22:30:23 / cg" |
|
7946 ! |
|
7947 |
|
7948 _MFramePeer_pShow:nativeContext |
|
7949 |view| |
|
7950 |
|
7951 view := self viewForWPeer:nativeContext. |
|
7952 |
|
7953 "/ frame views are under my browsers own control |
|
7954 (view isMemberOf:JavaEmbeddedFrameView) ifFalse:[ |
|
7955 view beVisible. |
|
7956 view realize. |
|
7957 ]. |
|
7958 |
|
7959 "/ view windowGroup notNil ifTrue:[ |
|
7960 "/ windowServer addGroup:(view windowGroup) |
|
7961 "/ ]. |
|
7962 |
|
7963 ^ nil |
|
7964 |
|
7965 "/ self halt. |
|
7966 |
|
7967 "Modified: / 25.1.1998 / 09:54:07 / cg" |
|
7968 "Created: / 18.11.1998 / 00:19:59 / cg" |
|
7969 ! |
|
7970 |
|
7971 _MFramePeer_setInsets:nativeContext |
|
7972 |
|
7973 "Created: / 17.11.1998 / 23:55:32 / cg" |
|
7974 ! |
|
7975 |
|
7976 _MFramePeer_setResizable:nativeContext |
|
7977 |view onOff| |
|
7978 |
|
7979 view := self viewForWPeer:nativeContext. |
|
7980 |
|
7981 onOff := (nativeContext argAt:1) == 1. |
|
7982 view isTopView ifTrue:[ |
|
7983 onOff ifTrue:[ |
|
7984 view minExtent:10@10. |
|
7985 view maxExtent:(Screen current extent). |
|
7986 ] ifFalse:[ |
|
7987 view minExtent:view extent. |
|
7988 view maxExtent:view extent. |
|
7989 ] |
|
7990 ] ifFalse:[ |
|
7991 (view isMemberOf:JavaEmbeddedFrameView) ifFalse:[ |
|
7992 self halt. |
|
7993 ] |
|
7994 ]. |
|
7995 |
|
7996 "/ 'JAVA: WWindowPeer_setResizable: ' print. view print. ' yes/no: ' print. onOff printNL. |
|
7997 |
|
7998 ^ nil |
|
7999 |
|
8000 "Modified: / 16.1.1998 / 18:08:00 / cg" |
|
8001 "Created: / 17.11.1998 / 23:51:45 / cg" |
|
8002 ! |
|
8003 |
|
8004 _MToolkit_callbackLoop:nativeContext |
|
8005 |toolKit| |
|
8006 |
|
8007 toolKit := nativeContext receiver. |
|
8008 ^ self. |
|
8009 self halt. |
|
8010 self wakeup:toolKit. |
|
8011 self halt. |
|
8012 |
|
8013 (JavaEventThread notNil and:[JavaEventThread isDead not]) ifTrue:[ |
|
8014 'JavaVM [warning]: oops - two threads executing eventLoop' errorPrintCR. |
|
8015 ]. |
|
8016 |
|
8017 JavaEventThread := Processor activeProcess. |
|
8018 [ |
|
8019 [true] whileTrue:[ |
|
8020 AbortSignal handle:[:ex | |
|
8021 ex return |
|
8022 ] do:[ |
|
8023 self doWindowsEventThread. |
|
8024 ] |
|
8025 ]. |
|
8026 ] valueNowOrOnUnwindDo:[ |
|
8027 JavaEventThread := nil. |
|
8028 ]. |
|
8029 |
|
8030 "Created: / 17.11.1998 / 23:58:33 / cg" |
|
8031 "Modified: / 8.1.1999 / 17:08:35 / cg" |
|
8032 ! |
|
8033 |
|
8034 _MToolkit_eventLoop:nativeContext |
|
8035 |toolKit| |
|
8036 |
|
8037 (JavaEventThread notNil and:[JavaEventThread isDead not]) ifTrue:[ |
|
8038 'JavaVM [warning]: oops - two threads executing eventLoop' errorPrintCR. |
|
8039 ]. |
|
8040 |
|
8041 toolKit := nativeContext receiver. |
|
8042 |
|
8043 self wakeup:toolKit. |
|
8044 self halt. |
|
8045 |
|
8046 JavaEventThread := Processor activeProcess. |
|
8047 [ |
|
8048 [true] whileTrue:[ |
|
8049 AbortSignal handle:[:ex | |
|
8050 ex return |
|
8051 ] do:[ |
|
8052 self doWindowsEventThread. |
|
8053 ] |
|
8054 ]. |
|
8055 ] valueNowOrOnUnwindDo:[ |
|
8056 JavaEventThread := nil. |
|
8057 ]. |
|
8058 |
|
8059 "Created: / 17.11.1998 / 23:04:29 / cg" |
|
8060 "Modified: / 8.1.1999 / 17:08:21 / cg" |
|
8061 ! |
|
8062 |
|
8063 _MToolkit_init:nativeContext |
|
8064 |
|
8065 "Created: / 28.1.1998 / 22:21:54 / cg" |
|
8066 ! |
|
8067 |
|
8068 _MToolkit_loadSystemColors:nativeContext |
|
8069 ^ self _WToolkit_loadSystemColors:nativeContext |
|
8070 ! |
|
8071 |
|
8072 _MToolkit_run:nativeContext |
|
8073 |
|
8074 "Created: / 28.1.1998 / 22:22:10 / cg" |
|
8075 ! |
|
8076 |
|
8077 _Math_IEEEremainder:nativeContext |
|
8078 UnimplementedNativeMethodSignal raise |
|
8079 |
|
8080 "Created: / 12.11.1998 / 18:52:36 / cg" |
|
8081 ! |
|
8082 |
|
8083 _Math_acos:nativeContext |
|
8084 "arc cosine" |
|
8085 |
|
8086 |dVal| |
|
8087 |
|
8088 dVal := nativeContext argAt:1. |
|
8089 "/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
|
8090 "/ dVal isReal ifTrue:[ |
|
8091 "/ 'JAVAVM [info]: missing double flag in Math>>acos' infoPrintCR. |
|
8092 "/ ] ifFalse:[ |
|
8093 "/ self halt:'expected double arg' |
|
8094 "/ ] |
|
8095 "/ ]. |
|
8096 ^ dVal arcCos |
|
8097 |
|
8098 "Created: / 7.5.1998 / 00:34:50 / cg" |
|
8099 "Modified: / 11.11.1998 / 15:08:20 / cg" |
|
8100 ! |
|
8101 |
|
8102 _Math_asin:nativeContext |
|
8103 "arc sine" |
|
8104 |
|
8105 |dVal| |
|
8106 |
|
8107 dVal := nativeContext argAt:1. |
|
8108 "/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
|
8109 "/ dVal isReal ifTrue:[ |
|
8110 "/ 'JAVAVM [info]: missing double flag in Math>>asin' infoPrintCR. |
|
8111 "/ ] ifFalse:[ |
|
8112 "/ self halt:'expected double arg' |
|
8113 "/ ] |
|
8114 "/ ]. |
|
8115 ^ dVal arcSin |
|
8116 |
|
8117 "Created: / 7.5.1998 / 00:34:26 / cg" |
|
8118 "Modified: / 11.11.1998 / 15:08:15 / cg" |
|
8119 ! |
|
8120 |
|
8121 _Math_atan2:nativeContext |
|
8122 UnimplementedNativeMethodSignal raise |
|
8123 |
|
8124 "Created: / 12.11.1998 / 18:52:52 / cg" |
|
8125 ! |
|
8126 |
|
8127 _Math_atan:nativeContext |
|
8128 "arc tangens" |
|
8129 |
|
8130 |dVal| |
|
8131 |
|
8132 dVal := nativeContext argAt:1. |
|
8133 "/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
|
8134 "/ dVal isReal ifTrue:[ |
|
8135 "/ 'JAVAVM [info]: missing double flag in Math>>atan' infoPrintCR. |
|
8136 "/ ] ifFalse:[ |
|
8137 "/ self halt:'expected double arg' |
|
8138 "/ ] |
|
8139 "/ ]. |
|
8140 ^ dVal arcTan |
|
8141 |
|
8142 "Created: / 6.2.1998 / 01:24:12 / cg" |
|
8143 "Modified: / 11.11.1998 / 15:08:11 / cg" |
|
8144 ! |
|
8145 |
|
8146 _Math_ceil:nativeContext |
|
8147 "ceiling" |
|
8148 |
|
8149 |dVal| |
|
8150 |
|
8151 dVal := nativeContext argAt:1. |
|
8152 "/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
|
8153 "/ dVal isReal ifTrue:[ |
|
8154 "/ 'JAVAVM [info]: missing double flag in Math>>ceil' infoPrintCR. |
|
8155 "/ ] ifFalse:[ |
|
8156 "/ self halt:'expected double arg' |
|
8157 "/ ] |
|
8158 "/ ]. |
|
8159 ^ dVal ceilingAsFloat |
|
8160 |
|
8161 "Created: / 7.1.1998 / 15:43:00 / cg" |
|
8162 "Modified: / 11.11.1998 / 15:08:04 / cg" |
|
8163 ! |
|
8164 |
|
8165 _Math_cos:nativeContext |
|
8166 "cosine" |
|
8167 |
|
8168 |dVal| |
|
8169 |
|
8170 dVal := nativeContext argAt:1. |
|
8171 "/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
|
8172 "/ dVal isReal ifTrue:[ |
|
8173 "/ 'JAVAVM [info]: missing double flag in Math>>cos' infoPrintCR. |
|
8174 "/ ] ifFalse:[ |
|
8175 "/ self halt:'expected double arg' |
|
8176 "/ ] |
|
8177 "/ ]. |
|
8178 ^ dVal cos |
|
8179 |
|
8180 "Created: / 7.1.1998 / 15:41:30 / cg" |
|
8181 "Modified: / 11.11.1998 / 15:07:59 / cg" |
|
8182 ! |
|
8183 |
|
8184 _Math_exp:nativeContext |
|
8185 "exponential" |
|
8186 |
|
8187 |dVal| |
|
8188 |
|
8189 dVal := nativeContext argAt:1. |
|
8190 "/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
|
8191 "/ dVal isReal ifTrue:[ |
|
8192 "/ 'JAVAVM [info]: missing double flag in Math>>exp' infoPrintCR. |
|
8193 "/ ] ifFalse:[ |
|
8194 "/ self halt:'expected double arg' |
|
8195 "/ ] |
|
8196 "/ ]. |
|
8197 ^ dVal exp |
|
8198 |
|
8199 "Created: / 7.5.1998 / 00:36:19 / cg" |
|
8200 "Modified: / 11.11.1998 / 15:07:50 / cg" |
|
8201 ! |
|
8202 |
|
8203 _Math_floor:nativeContext |
|
8204 "floor" |
|
8205 |
|
8206 |dVal| |
|
8207 |
|
8208 dVal := nativeContext argAt:1. |
|
8209 "/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
|
8210 "/ dVal isReal ifTrue:[ |
|
8211 "/ 'JAVAVM [info]: missing double flag in Math>>floor' infoPrintCR. |
|
8212 "/ ] ifFalse:[ |
|
8213 "/ self halt:'expected double arg' |
|
8214 "/ ] |
|
8215 "/ ]. |
|
8216 ^ dVal floorAsFloat |
|
8217 |
|
8218 "Created: / 7.1.1998 / 19:09:21 / cg" |
|
8219 "Modified: / 11.11.1998 / 15:07:45 / cg" |
|
8220 ! |
|
8221 |
|
8222 _Math_log:nativeContext |
|
8223 "natural logarithm" |
|
8224 |
|
8225 |dVal| |
|
8226 |
|
8227 dVal := nativeContext argAt:1. |
|
8228 "/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
|
8229 "/ dVal isReal ifTrue:[ |
|
8230 "/ 'JAVAVM [info]: missing double flag in Math>>log' infoPrintCR. |
|
8231 "/ ] ifFalse:[ |
|
8232 "/ self halt:'expected double arg' |
|
8233 "/ ] |
|
8234 "/ ]. |
|
8235 ^ dVal ln |
|
8236 |
|
8237 "Created: / 7.1.1998 / 15:42:19 / cg" |
|
8238 "Modified: / 30.12.1998 / 17:41:42 / cg" |
|
8239 ! |
|
8240 |
|
8241 _Math_pow:nativeContext |
|
8242 "power" |
|
8243 |
|
8244 |dVal1 dVal2| |
|
8245 |
|
8246 dVal1 := nativeContext argAt:1. |
|
8247 "/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
|
8248 "/ dVal1 isReal ifTrue:[ |
|
8249 "/ 'JAVAVM [info]: missing double flag in Math>>pow' infoPrintCR. |
|
8250 "/ ] ifFalse:[ |
|
8251 "/ self halt:'expected double arg' |
|
8252 "/ ] |
|
8253 "/ ]. |
|
8254 dVal2 := nativeContext argAt:3. |
|
8255 "/ (nativeContext argAt:4) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
|
8256 "/ dVal2 isReal ifTrue:[ |
|
8257 "/ 'JAVAVM [info]: missing double flag in Math>>pow' infoPrintCR. |
|
8258 "/ ] ifFalse:[ |
|
8259 "/ self halt:'expected double arg' |
|
8260 "/ ] |
|
8261 "/ ]. |
|
8262 ^ dVal1 raisedTo:dVal2 |
|
8263 |
|
8264 "Created: / 7.1.1998 / 15:44:13 / cg" |
|
8265 "Modified: / 11.11.1998 / 15:07:33 / cg" |
|
8266 ! |
|
8267 |
|
8268 _Math_rint:nativeContext |
|
8269 |dVal| |
|
8270 |
|
8271 dVal := nativeContext argAt:1. |
|
8272 ^ dVal rounded asFloat. |
|
8273 ! |
|
8274 |
|
8275 _Math_sin:nativeContext |
|
8276 "sine" |
|
8277 |
|
8278 |dVal| |
|
8279 |
|
8280 dVal := nativeContext argAt:1. |
|
8281 "/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
|
8282 "/ dVal isReal ifTrue:[ |
|
8283 "/ 'JAVAVM [info]: missing double flag in Math>>sin' infoPrintCR. |
|
8284 "/ ] ifFalse:[ |
|
8285 "/ self halt:'expected double arg' |
|
8286 "/ ] |
|
8287 "/ ]. |
|
8288 ^ dVal sin |
|
8289 |
|
8290 "Created: / 7.1.1998 / 15:41:40 / cg" |
|
8291 "Modified: / 11.11.1998 / 15:07:09 / cg" |
|
8292 ! |
|
8293 |
|
8294 _Math_sqrt:nativeContext |
|
8295 "square root" |
|
8296 |
|
8297 |dVal| |
|
8298 |
|
8299 dVal := nativeContext argAt:1. |
|
8300 "/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
|
8301 "/ dVal isReal ifTrue:[ |
|
8302 "/ 'JAVAVM [info]: missing double flag in Math>>sqrt' infoPrintCR. |
|
8303 "/ ] ifFalse:[ |
|
8304 "/ self halt:'expected double arg' |
|
8305 "/ ] |
|
8306 "/ ]. |
|
8307 |
|
8308 "/ how about domain errors ? |
|
8309 dVal < 0 ifTrue:[ |
|
8310 ^ 0.0 |
|
8311 ]. |
|
8312 ^ dVal sqrt |
|
8313 |
|
8314 "Created: / 7.1.1998 / 15:42:40 / cg" |
|
8315 "Modified: / 29.12.1998 / 13:22:36 / cg" |
|
8316 ! |
|
8317 |
|
8318 _Math_tan:nativeContext |
|
8319 "tangent" |
|
8320 |
|
8321 |dVal| |
|
8322 |
|
8323 dVal := nativeContext argAt:1. |
|
8324 "/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
|
8325 "/ dVal isReal ifTrue:[ |
|
8326 "/ 'JAVAVM [info]: missing double flag in Math>>tan' infoPrintCR. |
|
8327 "/ ] ifFalse:[ |
|
8328 "/ self halt:'expected double arg' |
|
8329 "/ ] |
|
8330 "/ ]. |
|
8331 ^ dVal tan |
|
8332 |
|
8333 "Created: / 7.5.1998 / 00:34:03 / cg" |
|
8334 "Modified: / 11.11.1998 / 15:07:14 / cg" |
|
8335 ! |
|
8336 |
|
8337 _MemoryAdvice_register0:nativeContext |
|
8338 "private native void register0()" |
|
8339 |
|
8340 "/ UnimplementedNativeMethodSignal raise |
|
8341 ! |
|
8342 |
|
8343 _Method_getModifiers:nativeContext |
|
8344 |jMethod mthd retVal| |
|
8345 |
|
8346 jMethod := nativeContext receiver. |
|
8347 |
|
8348 mthd := JavaMethods at:jMethod ifAbsent:nil. |
|
8349 mthd isNil ifTrue:[ |
|
8350 self halt. |
|
8351 ^ 0 |
|
8352 ]. |
|
8353 ^ mthd accessFlags |
|
8354 |
|
8355 "Modified: / 9.4.1998 / 17:50:01 / cg" |
|
8356 ! |
|
8357 |
|
8358 _Method_invoke:nativeContext |
|
8359 "invoke a javaMethod" |
|
8360 |
|
8361 |jMethod mthd rec args retVal| |
|
8362 |
|
8363 jMethod := nativeContext receiver. |
|
8364 rec := nativeContext argAt:1. |
|
8365 args := nativeContext argAt:2. |
|
8366 |
|
8367 mthd := JavaMethods at:jMethod ifAbsent:nil. |
|
8368 mthd isNil ifTrue:[ |
|
8369 self halt. |
|
8370 ]. |
|
8371 |
|
8372 "/ check for arguments to match the expected types ... |
|
8373 |
|
8374 mthd argSignature keysAndValuesDo:[:index :argSig | |
|
8375 |cls arg| |
|
8376 |
|
8377 cls := Java at:argSig. |
|
8378 arg := args at:index. |
|
8379 (arg isKindOf:cls) ifFalse:[ |
|
8380 self halt. |
|
8381 ] |
|
8382 ]. |
|
8383 |
|
8384 mthd isStatic ifTrue:[ |
|
8385 retVal := mthd valueWithReceiver:(mthd javaClass) arguments:args selector:mthd selector. |
|
8386 ^ retVal |
|
8387 ] ifFalse:[ |
|
8388 self halt. |
|
8389 ]. |
|
8390 |
|
8391 self halt. |
|
8392 |
|
8393 "Created: / 13.2.1998 / 15:15:28 / cg" |
|
8394 "Modified: / 13.2.1998 / 15:35:54 / cg" |
|
8395 ! |
|
8396 |
|
8397 _MozillaAppletContext_pMochaOnLoad:nativeContext |
|
8398 |id| |
|
8399 |
|
8400 id := nativeContext argAt:1. |
|
8401 "/ 'JAVA: MozillaAppletContext_pMochaOnLoad: ' print. id printNL. |
|
8402 ^ nil |
|
8403 |
|
8404 "Created: / 6.1.1998 / 20:37:13 / cg" |
|
8405 "Modified: / 6.2.1998 / 02:13:09 / cg" |
|
8406 ! |
|
8407 |
|
8408 _MozillaAppletContext_pShowDocument:nativeContext |
|
8409 |jAppletContext s1 s2 s3 js| |
|
8410 |
|
8411 jAppletContext := nativeContext receiver. |
|
8412 js := nativeContext argAt:1. |
|
8413 s1 := Java as_ST_String:js. |
|
8414 js := nativeContext argAt:2. |
|
8415 s2 := Java as_ST_String:js. |
|
8416 js := nativeContext argAt:3. |
|
8417 s2 := Java as_ST_String:js. |
|
8418 |
|
8419 "/ somehow pass it to the html browser .... |
|
8420 Transcript show:'pShowDocument: '; show:s1; show:' / '; |
|
8421 show:s2; show:' / '; showCR:s3. |
|
8422 |
|
8423 ^ nil |
|
8424 |
|
8425 "Created: / 29.3.1998 / 15:53:17 / cg" |
|
8426 "Modified: / 29.12.1998 / 13:32:41 / cg" |
|
8427 ! |
|
8428 |
|
8429 _MozillaAppletContext_pShowStatus:nativeContext |
|
8430 |s js| |
|
8431 |
|
8432 js := nativeContext argAt:1. |
|
8433 js isNil ifTrue:[ |
|
8434 s := '' |
|
8435 ] ifFalse:[ |
|
8436 s := Java as_ST_String:js. |
|
8437 ]. |
|
8438 |
|
8439 self activityNotification:s. |
|
8440 "/ Transcript showCR:s. |
|
8441 ^ nil |
|
8442 |
|
8443 "Created: / 6.1.1998 / 18:31:34 / cg" |
|
8444 "Modified: / 22.10.1998 / 01:17:46 / cg" |
|
8445 ! |
|
8446 |
|
8447 _MozillaAppletContext_setConsoleState0:nativeContext |
|
8448 "/ void setConsoleState0 (int) |
|
8449 UnimplementedNativeMethodSignal raise |
|
8450 |
|
8451 "Created: / 12.11.1998 / 19:23:22 / cg" |
|
8452 ! |
|
8453 |
|
8454 _ObjectInputStream_allocateNewArray:nativeContext |
|
8455 "/ java.lang.Object allocateNewArray (java.lang.Class int) |
|
8456 UnimplementedNativeMethodSignal raise |
|
8457 |
|
8458 "Modified: / 12.11.1998 / 19:01:48 / cg" |
|
8459 "Created: / 12.11.1998 / 19:02:52 / cg" |
|
8460 ! |
|
8461 |
|
8462 _ObjectInputStream_allocateNewObject:nativeContext |
|
8463 "/ java.lang.Object allocateNewObject (java.lang.Class java.lang.Class) |
|
8464 UnimplementedNativeMethodSignal raise |
|
8465 |
|
8466 "Modified: / 12.11.1998 / 19:01:48 / cg" |
|
8467 "Created: / 12.11.1998 / 19:02:40 / cg" |
|
8468 ! |
|
8469 |
|
8470 _ObjectInputStream_inputClassFields:nativeContext |
|
8471 "/ void inputClassFields (java.lang.Object java.lang.Class int[]) |
|
8472 UnimplementedNativeMethodSignal raise |
|
8473 |
|
8474 "Modified: / 12.11.1998 / 19:01:48 / cg" |
|
8475 "Created: / 12.11.1998 / 19:02:22 / cg" |
|
8476 ! |
|
8477 |
|
8478 _ObjectInputStream_invokeDefaultReadObject:nativeContext |
|
8479 "/ void invokeDefaultReadObject (java.lang.Object java.lang.Class) |
|
8480 |
|
8481 UnimplementedNativeMethodSignal raise |
|
8482 |
|
8483 "Created: / 27.1.2000 / 03:00:47 / cg" |
|
8484 ! |
|
8485 |
|
8486 _ObjectInputStream_invokeObjectReader:nativeContext |
|
8487 "/ boolean invokeObjectReader (java.lang.Object java.lang.Class) |
|
8488 UnimplementedNativeMethodSignal raise |
|
8489 |
|
8490 "Modified: / 12.11.1998 / 19:01:48 / cg" |
|
8491 "Created: / 12.11.1998 / 19:03:06 / cg" |
|
8492 ! |
|
8493 |
|
8494 _ObjectInputStream_invokeReadObject:nativeContext |
|
8495 "/ void invokeReadObject (java.lang.Object java.lang.Class) |
|
8496 |
|
8497 UnimplementedNativeMethodSignal raise |
|
8498 |
|
8499 "Created: / 27.1.2000 / 03:01:02 / cg" |
|
8500 ! |
|
8501 |
|
8502 _ObjectInputStream_loadClass0:nativeContext |
|
8503 "/ java.lang.Class loadClass0 (java.lang.Class java.lang.String) |
|
8504 UnimplementedNativeMethodSignal raise |
|
8505 |
|
8506 "Created: / 12.11.1998 / 19:01:15 / cg" |
|
8507 "Modified: / 12.11.1998 / 19:01:48 / cg" |
|
8508 ! |
|
8509 |
|
8510 _ObjectOutputStream_invokeDefaultWriteObject:nativeContext |
|
8511 "/ void invokeDefaultWriteObject (java.lang.Object java.lang.Class) |
|
8512 |
|
8513 UnimplementedNativeMethodSignal raise |
|
8514 |
|
8515 "Created: / 27.1.2000 / 03:01:36 / cg" |
|
8516 ! |
|
8517 |
|
8518 _ObjectOutputStream_invokeObjectWriter:nativeContext |
|
8519 "/ boolean invokeObjectWriter (java.lang.Object java.lang.Class) |
|
8520 UnimplementedNativeMethodSignal raise |
|
8521 |
|
8522 "Created: / 12.11.1998 / 19:00:36 / cg" |
|
8523 "Modified: / 12.11.1998 / 19:01:45 / cg" |
|
8524 ! |
|
8525 |
|
8526 _ObjectOutputStream_invokeWriteObject:nativeContext |
|
8527 "/ void invokeWriteObject (java.lang.Object java.lang.Class) |
|
8528 |
|
8529 UnimplementedNativeMethodSignal raise |
|
8530 |
|
8531 "Created: / 27.1.2000 / 03:01:52 / cg" |
|
8532 ! |
|
8533 |
|
8534 _ObjectOutputStream_outputClassFields:nativeContext |
|
8535 "/ void outputClassFields (java.lang.Object java.lang.Class int[]) |
|
8536 UnimplementedNativeMethodSignal raise |
|
8537 |
|
8538 "Created: / 12.11.1998 / 19:00:09 / cg" |
|
8539 "Modified: / 12.11.1998 / 19:01:42 / cg" |
|
8540 ! |
|
8541 |
|
8542 _ObjectStreamClass_doMismatchedRead:nativeContext |
|
8543 "/ void doMismatchedRead (java.io.ObjectInputStream java.lang.Object) |
|
8544 |
|
8545 UnimplementedNativeMethodSignal raise |
|
8546 |
|
8547 "Created: / 27.1.2000 / 02:50:55 / cg" |
|
8548 ! |
|
8549 |
|
8550 _ObjectStreamClass_findObjectMethod0:nativeContext |
|
8551 "/ boolean findObjectMethod0 (java.lang.Class int) |
|
8552 |
|
8553 UnimplementedNativeMethodSignal raise |
|
8554 |
|
8555 "Created: / 27.1.2000 / 02:51:50 / cg" |
|
8556 ! |
|
8557 |
|
8558 _ObjectStreamClass_getClassAccess:nativeContext |
|
8559 "/ int getClassAccess (java.lang.Class) |
|
8560 UnimplementedNativeMethodSignal raise |
|
8561 |
|
8562 "Modified: / 12.11.1998 / 19:01:48 / cg" |
|
8563 "Created: / 12.11.1998 / 19:04:19 / cg" |
|
8564 ! |
|
8565 |
|
8566 _ObjectStreamClass_getClassDefinedUID:nativeContext |
|
8567 "/ long getClassDefinedUID (java.lang.Class) |
|
8568 |
|
8569 UnimplementedNativeMethodSignal raise |
|
8570 |
|
8571 "Created: / 27.1.2000 / 02:51:33 / cg" |
|
8572 ! |
|
8573 |
|
8574 _ObjectStreamClass_getFieldAccess:nativeContext |
|
8575 "/ int getFieldAccess (java.lang.Class java.lang.String) |
|
8576 UnimplementedNativeMethodSignal raise |
|
8577 |
|
8578 "Modified: / 12.11.1998 / 19:01:48 / cg" |
|
8579 "Created: / 12.11.1998 / 19:05:19 / cg" |
|
8580 ! |
|
8581 |
|
8582 _ObjectStreamClass_getFieldSignatures:nativeContext |
|
8583 "/ java.lang.String[] getFieldSignatures (java.lang.Class) |
|
8584 UnimplementedNativeMethodSignal raise |
|
8585 |
|
8586 "Modified: / 12.11.1998 / 19:01:48 / cg" |
|
8587 "Created: / 12.11.1998 / 19:05:04 / cg" |
|
8588 ! |
|
8589 |
|
8590 _ObjectStreamClass_getFields0:nativeContext |
|
8591 "/ java.io.ObjectStreamField[] getFields0 (java.lang.Class) |
|
8592 UnimplementedNativeMethodSignal raise |
|
8593 |
|
8594 "Modified: / 12.11.1998 / 19:01:48 / cg" |
|
8595 "Created: / 12.11.1998 / 19:05:32 / cg" |
|
8596 ! |
|
8597 |
|
8598 _ObjectStreamClass_getMethodAccess:nativeContext |
|
8599 "/ int getMethodAccess (java.lang.Class java.lang.String) |
|
8600 UnimplementedNativeMethodSignal raise |
|
8601 |
|
8602 "Modified: / 12.11.1998 / 19:01:48 / cg" |
|
8603 "Created: / 12.11.1998 / 19:04:51 / cg" |
|
8604 ! |
|
8605 |
|
8606 _ObjectStreamClass_getMethodSignatures:nativeContext |
|
8607 "/ java.lang.String[] getMethodSignatures (java.lang.Class) |
|
8608 UnimplementedNativeMethodSignal raise |
|
8609 |
|
8610 "Modified: / 12.11.1998 / 19:01:48 / cg" |
|
8611 "Created: / 12.11.1998 / 19:04:34 / cg" |
|
8612 ! |
|
8613 |
|
8614 _ObjectStreamClass_getSerialVersionUID:nativeContext |
|
8615 "/ long getSerialVersionUID (java.lang.Class) |
|
8616 UnimplementedNativeMethodSignal raise |
|
8617 |
|
8618 "Modified: / 12.11.1998 / 19:01:48 / cg" |
|
8619 "Created: / 12.11.1998 / 19:05:43 / cg" |
|
8620 ! |
|
8621 |
|
8622 _ObjectStreamClass_hasWriteObject:nativeContext |
|
8623 "/ boolean hasWriteObject (java.lang.Class) |
|
8624 UnimplementedNativeMethodSignal raise |
|
8625 |
|
8626 "Modified: / 12.11.1998 / 19:01:48 / cg" |
|
8627 "Created: / 12.11.1998 / 19:05:53 / cg" |
|
8628 ! |
|
8629 |
|
8630 _OffScreenImageSource_sendPixels:nativeContext |
|
8631 "/ self halt. |
|
8632 "/ UnimplementedNativeMethodSignal raise |
|
8633 |
|
8634 "Modified: / 16.1.1998 / 18:22:23 / cg" |
|
8635 "Created: / 17.1.1998 / 12:36:25 / cg" |
|
8636 ! |
|
8637 |
|
8638 _PackedColorModel_initIDs:nativeContext |
|
8639 "/ new with jdk1.2 ... |
|
8640 |
|
8641 "Created: / 28.1.1998 / 22:19:35 / cg" |
|
8642 ! |
|
8643 |
|
8644 _PlainDatagramSocketImpl_bind:nativeContext |
|
8645 |jsock jaddr port sock hostName ok err| |
|
8646 |
|
8647 jsock := nativeContext receiver. |
|
8648 port := nativeContext argAt:1. |
|
8649 jaddr := nativeContext argAt:2. |
|
8650 |
|
8651 hostName := jaddr instVarNamed:'hostName'. |
|
8652 hostName isNil ifTrue:[ |
|
8653 self halt. |
|
8654 ] ifFalse:[ |
|
8655 hostName := Java as_ST_String:hostName |
|
8656 ]. |
|
8657 |
|
8658 sock := self validateFile:jsock. |
|
8659 sock notNil ifTrue:[ |
|
8660 FileIOTrace ifTrue:[ |
|
8661 ('JAVA: socket bind to ' , hostName printString, ' port ' , port printString) infoPrintCR |
|
8662 ]. |
|
8663 |
|
8664 ok := sock bindTo:port address:nil "hostName". |
|
8665 ok ifFalse:[ |
|
8666 err := OperatingSystem lastErrorString. |
|
8667 Transcript showCR:'sock err: ' , err printString. |
|
8668 self throwIOExceptionWithMessage:'bind failed'. |
|
8669 ] |
|
8670 ]. |
|
8671 |
|
8672 "Created: / 4.2.1998 / 15:06:20 / cg" |
|
8673 "Modified: / 30.12.1998 / 20:10:16 / cg" |
|
8674 ! |
|
8675 |
|
8676 _PlainDatagramSocketImpl_datagramSocketClose:nativeContext |
|
8677 |jsock sock| |
|
8678 |
|
8679 jsock := nativeContext receiver. |
|
8680 |
|
8681 sock := self validateFile:jsock. |
|
8682 sock notNil ifTrue:[ |
|
8683 FileIOTrace ifTrue:[ |
|
8684 'JAVA: datagram close socket' infoPrintCR |
|
8685 ]. |
|
8686 sock close. |
|
8687 ]. |
|
8688 |
|
8689 "Modified: / 21.8.1997 / 17:09:40 / cg" |
|
8690 "Created: / 25.1.1998 / 20:04:24 / cg" |
|
8691 ! |
|
8692 |
|
8693 _PlainDatagramSocketImpl_datagramSocketCreate:nativeContext |
|
8694 |jsock fd sock fileNo| |
|
8695 |
|
8696 jsock := nativeContext receiver. |
|
8697 |
|
8698 fd := jsock instVarNamed:'fd'. |
|
8699 (fd instVarNamed:'fd') ~~ 0 ifTrue:[ |
|
8700 self halt:'file already open'. |
|
8701 self internalError:'file already open'. |
|
8702 self throwIOExceptionWithMessage:'file already open in socketCreate'. |
|
8703 ^ self. |
|
8704 ]. |
|
8705 |
|
8706 FileOpenTrace ifTrue:[ |
|
8707 ('JAVA: create datagram socket') infoPrintCR. |
|
8708 ]. |
|
8709 |
|
8710 sock := Socket newUDP. |
|
8711 sock isNil ifTrue:[ |
|
8712 self throwIOExceptionWithMessage:'socketCreate failed'. |
|
8713 ]. |
|
8714 |
|
8715 fileNo := self addOpenFile:sock. |
|
8716 fd instVarNamed:'fd' put:fileNo. |
|
8717 |
|
8718 "Created: / 25.1.1998 / 19:59:25 / cg" |
|
8719 "Modified: / 30.12.1998 / 20:10:38 / cg" |
|
8720 ! |
|
8721 |
|
8722 _PlainDatagramSocketImpl_join:nativeContext |
|
8723 "/ native void join (InetAddress arg1) |
|
8724 |
|
8725 |jsock addr sock ok err| |
|
8726 |
|
8727 jsock := nativeContext receiver. |
|
8728 addr := nativeContext argAt:1. |
|
8729 |
|
8730 sock := self validateFile:jsock. |
|
8731 sock notNil ifTrue:[ |
|
8732 FileIOTrace ifTrue:[ |
|
8733 ('JAVA: socket join ' , addr printString) infoPrintCR |
|
8734 ]. |
|
8735 self throwIOExceptionWithMessage:'unimplemented: join'. |
|
8736 self halt. |
|
8737 ^ nil. "/ void |
|
8738 ]. |
|
8739 |
|
8740 "Created: / 4.2.1998 / 15:06:20 / cg" |
|
8741 "Modified: / 30.12.1998 / 20:10:16 / cg" |
|
8742 ! |
|
8743 |
|
8744 _PlainDatagramSocketImpl_receive:nativeContext |
|
8745 |jsock jdatagramPacket sock ok| |
|
8746 |
|
8747 jsock := nativeContext receiver. |
|
8748 jdatagramPacket := nativeContext argAt:1. |
|
8749 |
|
8750 sock := self validateFile:jsock. |
|
8751 sock notNil ifTrue:[ |
|
8752 FileIOTrace ifTrue:[ |
|
8753 ('JAVA: socket receive') infoPrintCR |
|
8754 ]. |
|
8755 ^ -1. |
|
8756 ]. |
|
8757 ^ -1 |
|
8758 |
|
8759 "Created: / 4.2.1998 / 15:06:20 / cg" |
|
8760 "Modified: / 30.12.1998 / 20:10:16 / cg" |
|
8761 ! |
|
8762 |
|
8763 _PlainDatagramSocketImpl_send:nativeContext |
|
8764 |jsock jdatagramPacket sock ok| |
|
8765 |
|
8766 jsock := nativeContext receiver. |
|
8767 jdatagramPacket := nativeContext argAt:1. |
|
8768 |
|
8769 sock := self validateFile:jsock. |
|
8770 sock notNil ifTrue:[ |
|
8771 FileIOTrace ifTrue:[ |
|
8772 ('JAVA: socket send') infoPrintCR |
|
8773 ]. |
|
8774 ^ -1. |
|
8775 ]. |
|
8776 ^ -1 |
|
8777 |
|
8778 "Created: / 4.2.1998 / 15:06:20 / cg" |
|
8779 "Modified: / 30.12.1998 / 20:10:16 / cg" |
|
8780 ! |
|
8781 |
|
8782 _PlainDatagramSocketImpl_socketGetOption:nativeContext |
|
8783 |jsock opt port sock hostName ok err| |
|
8784 |
|
8785 jsock := nativeContext receiver. |
|
8786 opt := nativeContext argAt:1. |
|
8787 |
|
8788 sock := self validateFile:jsock. |
|
8789 sock notNil ifTrue:[ |
|
8790 FileIOTrace ifTrue:[ |
|
8791 ('JAVA: socket getOption ' , opt printString) infoPrintCR |
|
8792 ]. |
|
8793 self throwIOExceptionWithMessage:'unimplemented: getOption'. |
|
8794 self halt. |
|
8795 ^ -1. |
|
8796 ]. |
|
8797 ^ -1. |
|
8798 |
|
8799 "Created: / 4.2.1998 / 15:06:20 / cg" |
|
8800 "Modified: / 30.12.1998 / 20:10:16 / cg" |
|
8801 ! |
|
8802 |
|
8803 _PlainDatagramSocketImpl_socketSetOption:nativeContext |
|
8804 "/ native void socketSetOption (int arg1, java.lang.Object arg2) |
|
8805 |
|
8806 |jsock opt optVal sock ok err jSocketOptions| |
|
8807 |
|
8808 jsock := nativeContext receiver. |
|
8809 opt := nativeContext argAt:1. |
|
8810 optVal := nativeContext argAt:2. |
|
8811 |
|
8812 sock := self validateFile:jsock. |
|
8813 sock notNil ifTrue:[ |
|
8814 FileIOTrace ifTrue:[ |
|
8815 ('JAVA: socket setOption ' , opt printString) infoPrintCR |
|
8816 ]. |
|
8817 |
|
8818 jSocketOptions := Java at:'java.net.SocketOptions'. |
|
8819 (opt == (jSocketOptions instVarNamed:'TCP_NODELAY')) ifTrue:[ |
|
8820 ] ifFalse:[ |
|
8821 (opt == (jSocketOptions instVarNamed:'SO_BINDADDR')) ifTrue:[ |
|
8822 ] ifFalse:[ |
|
8823 (opt == (jSocketOptions instVarNamed:'SO_REUSEADDR')) ifTrue:[ |
|
8824 ] ifFalse:[ |
|
8825 (opt == (jSocketOptions instVarNamed:'IP_MULTICAST_IF')) ifTrue:[ |
|
8826 ] ifFalse:[ |
|
8827 (opt == (jSocketOptions instVarNamed:'SO_LINGER')) ifTrue:[ |
|
8828 ] ifFalse:[ |
|
8829 (opt == (jSocketOptions instVarNamed:'SO_TIMEOUT')) ifTrue:[ |
|
8830 ] ifFalse:[ |
|
8831 self throwIOExceptionWithMessage:'bad arg to setOption'. |
|
8832 ] |
|
8833 ] |
|
8834 ] |
|
8835 ] |
|
8836 ] |
|
8837 ]. |
|
8838 self throwIOExceptionWithMessage:'unimplemented: setOption'. |
|
8839 self halt. |
|
8840 ^ nil. "/ void |
|
8841 ]. |
|
8842 |
|
8843 "Created: / 4.2.1998 / 15:06:20 / cg" |
|
8844 "Modified: / 30.12.1998 / 20:10:16 / cg" |
|
8845 ! |
|
8846 |
|
8847 _PlainSocketImpl_initProto:nativeContext |
|
8848 |
|
8849 "Created: / 12.1.1998 / 12:56:52 / cg" |
|
8850 ! |
|
8851 |
|
8852 _PlainSocketImpl_socketAccept:nativeContext |
|
8853 |jsock fd newJSock sock newSock fileNo| |
|
8854 |
|
8855 jsock := nativeContext receiver. |
|
8856 |
|
8857 sock := self validateFile:jsock. |
|
8858 sock isNil ifTrue:[ |
|
8859 self throwIOExceptionWithMessage:'nil socket in accept'. |
|
8860 ^ self. |
|
8861 ]. |
|
8862 |
|
8863 newJSock := nativeContext argAt:1. |
|
8864 fd := newJSock instVarNamed:'fd'. |
|
8865 (fd instVarNamed:'fd') ~~ 0 ifTrue:[ |
|
8866 self halt:'file already open'. |
|
8867 self internalError:'file already open'. |
|
8868 self throwIOExceptionWithMessage:'socket already open in socketAccept'. |
|
8869 ^ self. |
|
8870 ]. |
|
8871 FileIOTrace ifTrue:[ |
|
8872 'JAVA: socket accept' infoPrintCR |
|
8873 ]. |
|
8874 newSock := sock accept. |
|
8875 newSock isNil ifTrue:[ |
|
8876 self throwIOExceptionWithMessage:'accept failed'. |
|
8877 ]. |
|
8878 fileNo := self addOpenFile:newSock. |
|
8879 fd instVarNamed:'fd' put:fileNo. |
|
8880 |
|
8881 "Created: / 4.2.1998 / 15:26:49 / cg" |
|
8882 "Modified: / 30.12.1998 / 20:10:01 / cg" |
|
8883 ! |
|
8884 |
|
8885 _PlainSocketImpl_socketAvailable:nativeContext |
|
8886 |jSock sock n| |
|
8887 |
|
8888 jSock := nativeContext receiver. |
|
8889 |
|
8890 sock := self validateFile:jSock. |
|
8891 sock isNil ifTrue:[ |
|
8892 self throwIOExceptionWithMessage:'socketAvailable on closed socket'. |
|
8893 ^ self. |
|
8894 ]. |
|
8895 |
|
8896 n := sock numAvailable. |
|
8897 ^ n |
|
8898 |
|
8899 "Created: / 4.2.1998 / 16:58:49 / cg" |
|
8900 "Modified: / 30.12.1998 / 20:10:08 / cg" |
|
8901 ! |
|
8902 |
|
8903 _PlainSocketImpl_socketBind:nativeContext |
|
8904 |jsock jaddr port sock hostName ok err| |
|
8905 |
|
8906 jsock := nativeContext receiver. |
|
8907 jaddr := nativeContext argAt:1. |
|
8908 port := nativeContext argAt:2. |
|
8909 |
|
8910 hostName := jaddr instVarNamed:'hostName'. |
|
8911 hostName isNil ifTrue:[ |
|
8912 self halt. |
|
8913 ] ifFalse:[ |
|
8914 hostName := Java as_ST_String:hostName |
|
8915 ]. |
|
8916 |
|
8917 sock := self validateFile:jsock. |
|
8918 sock notNil ifTrue:[ |
|
8919 FileIOTrace ifTrue:[ |
|
8920 ('JAVA: socket bind to ' , hostName printString, ' port ' , port printString) infoPrintCR |
|
8921 ]. |
|
8922 |
|
8923 ok := sock bindTo:port address:nil "hostName". |
|
8924 ok ifFalse:[ |
|
8925 err := OperatingSystem lastErrorString. |
|
8926 Transcript showCR:'sock err: ' , err printString. |
|
8927 self throwIOExceptionWithMessage:'bind failed'. |
|
8928 ] |
|
8929 ]. |
|
8930 |
|
8931 "Created: / 4.2.1998 / 15:06:20 / cg" |
|
8932 "Modified: / 30.12.1998 / 20:10:16 / cg" |
|
8933 ! |
|
8934 |
|
8935 _PlainSocketImpl_socketClose:nativeContext |
|
8936 |jsock sock| |
|
8937 |
|
8938 jsock := nativeContext receiver. |
|
8939 |
|
8940 sock := self validateFile:jsock. |
|
8941 sock notNil ifTrue:[ |
|
8942 FileIOTrace ifTrue:[ |
|
8943 'JAVA: close socket' infoPrintCR |
|
8944 ]. |
|
8945 sock close. |
|
8946 ]. |
|
8947 |
|
8948 "Modified: / 21.8.1997 / 17:09:40 / cg" |
|
8949 "Created: / 25.1.1998 / 20:04:24 / cg" |
|
8950 ! |
|
8951 |
|
8952 _PlainSocketImpl_socketConnect:nativeContext |
|
8953 |jsock jaddr port sock addr hostName ok| |
|
8954 |
|
8955 jsock := nativeContext receiver. |
|
8956 jaddr := nativeContext argAt:1. |
|
8957 port := nativeContext argAt:2. |
|
8958 |
|
8959 hostName := jaddr instVarNamed:'hostName'. |
|
8960 hostName notNil ifTrue:[ |
|
8961 hostName := Java as_ST_String:hostName |
|
8962 ] ifFalse:[ |
|
8963 addr := jaddr instVarNamed:'address'. |
|
8964 addr notNil ifTrue:[ |
|
8965 hostName := ByteArray new:4. |
|
8966 hostName at:4 put:(addr bitAnd:16rFF). |
|
8967 addr := addr bitShift:-8. |
|
8968 hostName at:3 put:(addr bitAnd:16rFF). |
|
8969 addr := addr bitShift:-8. |
|
8970 hostName at:2 put:(addr bitAnd:16rFF). |
|
8971 addr := addr bitShift:-8. |
|
8972 hostName at:1 put:(addr bitAnd:16rFF). |
|
8973 ]. |
|
8974 ]. |
|
8975 hostName isNil ifTrue:[ |
|
8976 self halt. |
|
8977 ]. |
|
8978 |
|
8979 sock := self validateFile:jsock. |
|
8980 sock notNil ifTrue:[ |
|
8981 FileIOTrace ifTrue:[ |
|
8982 ('JAVA: socket connect to ' , hostName printString , ' port ' , port printString) infoPrintCR |
|
8983 ]. |
|
8984 SocketConnectConfirmation ifTrue:[ |
|
8985 (PermittedHostConnects isNil |
|
8986 or:[(PermittedHostConnects includes:hostName) not]) ifTrue:[ |
|
8987 (self confirm:'connect to host: ' , hostName printString , ' - ok ?') |
|
8988 ifFalse:[ |
|
8989 self throwIOExceptionWithMessage:'connect permission denied'. |
|
8990 ]. |
|
8991 |
|
8992 (self confirm:('JAVA Security check\\Always permit connects to this host (''' , hostName printString , ''') ?') withCRs) |
|
8993 ifTrue:[ |
|
8994 PermittedHostConnects isNil ifTrue:[ |
|
8995 PermittedHostConnects := Set new |
|
8996 ]. |
|
8997 PermittedHostConnects add:hostName. |
|
8998 ] |
|
8999 ] |
|
9000 ]. |
|
9001 |
|
9002 ok := sock connectTo:hostName port:port. |
|
9003 ok ifFalse:[ |
|
9004 self throwIOExceptionWithMessage:'connect failed'. |
|
9005 ] |
|
9006 ]. |
|
9007 |
|
9008 "Created: / 25.1.1998 / 20:02:27 / cg" |
|
9009 "Modified: / 30.12.1998 / 20:10:28 / cg" |
|
9010 ! |
|
9011 |
|
9012 _PlainSocketImpl_socketCreate:nativeContext |
|
9013 |jsock isStream fd sock fileNo| |
|
9014 |
|
9015 jsock := nativeContext receiver. |
|
9016 isStream := (nativeContext argAt:1) == 1. |
|
9017 |
|
9018 fd := jsock instVarNamed:'fd'. |
|
9019 (fd instVarNamed:'fd') ~~ 0 ifTrue:[ |
|
9020 self halt:'file already open'. |
|
9021 self internalError:'file already open'. |
|
9022 self throwIOExceptionWithMessage:'file already open in socketCreate'. |
|
9023 ^ self. |
|
9024 ]. |
|
9025 |
|
9026 FileOpenTrace ifTrue:[ |
|
9027 ('JAVA: create socket') infoPrintCR. |
|
9028 ]. |
|
9029 |
|
9030 isStream ifTrue:[ |
|
9031 sock := Socket newTCP |
|
9032 ] ifFalse:[ |
|
9033 sock := Socket newUDP |
|
9034 ]. |
|
9035 sock isNil ifTrue:[ |
|
9036 self throwIOExceptionWithMessage:'socketCreate failed'. |
|
9037 ]. |
|
9038 |
|
9039 fileNo := self addOpenFile:sock. |
|
9040 fd instVarNamed:'fd' put:fileNo. |
|
9041 |
|
9042 "Created: / 25.1.1998 / 19:59:25 / cg" |
|
9043 "Modified: / 30.12.1998 / 20:10:38 / cg" |
|
9044 ! |
|
9045 |
|
9046 _PlainSocketImpl_socketListen:nativeContext |
|
9047 |jSock time sock ok| |
|
9048 |
|
9049 jSock := nativeContext receiver. |
|
9050 time := nativeContext argAt:1. |
|
9051 |
|
9052 sock := self validateFile:jSock. |
|
9053 sock notNil ifTrue:[ |
|
9054 FileIOTrace ifTrue:[ |
|
9055 ('JAVA: socket listen with timeout ' , time printString) infoPrintCR. |
|
9056 ]. |
|
9057 ok := sock listenWithBacklog:5. |
|
9058 ok ifFalse:[ |
|
9059 self throwIOExceptionWithMessage:'listen failed'. |
|
9060 ^ self. |
|
9061 ]. |
|
9062 time ~~ 0 ifTrue:[ |
|
9063 sock readWaitWithTimeoutMs:time |
|
9064 ] |
|
9065 ]. |
|
9066 |
|
9067 "Created: / 4.2.1998 / 15:17:48 / cg" |
|
9068 "Modified: / 30.12.1998 / 20:10:46 / cg" |
|
9069 ! |
|
9070 |
|
9071 _PlatformFont_initIDs:nativeContext |
|
9072 "/ new with jdk1.2 ... |
|
9073 |
|
9074 "Created: / 28.1.1998 / 22:30:41 / cg" |
|
9075 ! |
|
9076 |
|
9077 _PrintStream_isOutputStreamLocalised:nativeContext |
|
9078 "/ boolean isOutputStreamLocalised (java.io.DataOutputStream) |
|
9079 |
|
9080 UnimplementedNativeMethodSignal raise |
|
9081 |
|
9082 "Created: / 27.1.2000 / 03:00:20 / cg" |
|
9083 ! |
|
9084 |
|
9085 _RandomAccessFile_close:nativeContext |
|
9086 ^ self anyStream_close:nativeContext |
|
9087 |
|
9088 "Created: / 4.2.1998 / 13:26:53 / cg" |
|
9089 "Modified: / 4.2.1998 / 15:21:08 / cg" |
|
9090 ! |
|
9091 |
|
9092 _RandomAccessFile_length:nativeContext |
|
9093 |file sz| |
|
9094 |
|
9095 file := self validateFile:(nativeContext receiver). |
|
9096 |
|
9097 FileIOTrace ifTrue:[ |
|
9098 ('JAVA: length of ' , file pathName) infoPrintCR. |
|
9099 ]. |
|
9100 |
|
9101 sz := file size. |
|
9102 ^ sz. |
|
9103 |
|
9104 "Created: / 4.2.1998 / 13:27:58 / cg" |
|
9105 ! |
|
9106 |
|
9107 _RandomAccessFile_open:nativeContext |
|
9108 |fs fd name dir stream fileNo answer readonly| |
|
9109 |
|
9110 readonly := false. |
|
9111 |
|
9112 fs := nativeContext receiver. |
|
9113 fd := fs instVarNamed:'fd'. |
|
9114 (fd instVarNamed:'fd') ~~ 0 ifTrue:[ |
|
9115 self halt:'file already open'. |
|
9116 self internalError:'file already open'. |
|
9117 ^ self. |
|
9118 ]. |
|
9119 |
|
9120 name := nativeContext argAt:1. |
|
9121 name := Java as_ST_String:name. |
|
9122 name := self fixFilename:name. |
|
9123 |
|
9124 FileOpenTrace ifTrue:[ |
|
9125 ('JAVA: opening ' , name) infoPrintCR. |
|
9126 ]. |
|
9127 |
|
9128 dir := name asFilename directory pathName. |
|
9129 |
|
9130 (PermittedDirectories notNil |
|
9131 and:[PermittedDirectories includes:dir]) ifFalse:[ |
|
9132 FileOpenConfirmation ifTrue:[ |
|
9133 answer := Dialog |
|
9134 confirmWithCancel:('JAVA Security check\\Opening ''' , name , ''' for read/write.\Grant permission ?') withCRs |
|
9135 labels:#('no' 'grant' 'readonly') |
|
9136 values:#(false true #readonly) |
|
9137 default:3. |
|
9138 answer == false ifTrue:[ |
|
9139 self throwIOExceptionWithMessage:('no permission to open ' , name , ' for writing'). |
|
9140 ^ self |
|
9141 ]. |
|
9142 readonly := (answer == #readonly). |
|
9143 |
|
9144 readonly ifFalse:[ |
|
9145 (self confirm:('JAVA Security check\\Always permit writes in this directory (''' , dir , ''') ?') withCRs) |
|
9146 ifTrue:[ |
|
9147 PermittedDirectories isNil ifTrue:[ |
|
9148 PermittedDirectories := Set new |
|
9149 ]. |
|
9150 PermittedDirectories add:dir. |
|
9151 ] |
|
9152 ] |
|
9153 ] |
|
9154 ]. |
|
9155 |
|
9156 readonly ifTrue:[ |
|
9157 stream := name asFilename readStream. |
|
9158 ] ifFalse:[ |
|
9159 stream := name asFilename readWriteStream. |
|
9160 ]. |
|
9161 stream isNil ifTrue:[ |
|
9162 self throwIOExceptionWithMessage:('cannot open ' , name , ' for writing'). |
|
9163 ]. |
|
9164 |
|
9165 fileNo := self addOpenFile:stream. |
|
9166 |
|
9167 FileOpenTrace ifTrue:[ |
|
9168 ('JAVA: opened ' , name , ' as FD ' , fileNo printString , ' for writing') infoPrintCR. |
|
9169 ]. |
|
9170 |
|
9171 fd instVarNamed:'fd' put:fileNo. |
|
9172 |
|
9173 "Created: / 4.2.1998 / 00:14:48 / cg" |
|
9174 "Modified: / 12.11.1998 / 21:29:46 / cg" |
|
9175 ! |
|
9176 |
|
9177 _RandomAccessFile_read:nativeContext |
|
9178 |file byte| |
|
9179 |
|
9180 file := self validateFile:(nativeContext receiver). |
|
9181 |
|
9182 FileIOTrace ifTrue:[ |
|
9183 ('JAVA: read 1 byte from ' , file pathName) infoPrintCR. |
|
9184 ]. |
|
9185 |
|
9186 byte := file nextByte. |
|
9187 byte isNil ifTrue:[ |
|
9188 ^ -1 |
|
9189 ]. |
|
9190 ^ byte |
|
9191 |
|
9192 "Modified: / 5.1.1998 / 02:17:25 / cg" |
|
9193 "Created: / 27.1.1999 / 19:01:15 / cg" |
|
9194 ! |
|
9195 |
|
9196 _RandomAccessFile_readBytes:nativeContext |
|
9197 ^ self anyStream_readBytes:nativeContext |
|
9198 |
|
9199 "Modified: / 4.2.1998 / 15:23:27 / cg" |
|
9200 ! |
|
9201 |
|
9202 _RandomAccessFile_seek:nativeContext |
|
9203 |file pos| |
|
9204 |
|
9205 file := self validateFile:(nativeContext receiver). |
|
9206 |
|
9207 FileIOTrace ifTrue:[ |
|
9208 ('JAVA: seek on ' , file pathName) infoPrintCR. |
|
9209 ]. |
|
9210 |
|
9211 pos := nativeContext argAt:1. |
|
9212 file position:pos+1 "/ ST/X position starts at 1 |
|
9213 |
|
9214 "Created: / 4.2.1998 / 13:25:38 / cg" |
|
9215 "Modified: / 4.2.1998 / 13:28:12 / cg" |
|
9216 ! |
|
9217 |
|
9218 _RandomAccessFile_writeBytes:nativeContext |
|
9219 ^ self anyStream_writeBytes:nativeContext |
|
9220 |
|
9221 "Modified: / 4.2.1998 / 15:24:20 / cg" |
|
9222 "Created: / 4.2.1998 / 15:24:35 / cg" |
|
9223 ! |
|
9224 |
|
9225 _ResourceBundle_getClassContext:nativeContext |
|
9226 "returns an array filled with the contextChain receivers classes. |
|
9227 What an ugly, messy interface." |
|
9228 |
|
9229 |chain con cls jClass| |
|
9230 |
|
9231 chain := OrderedCollection new. |
|
9232 con := thisContext sender. |
|
9233 [ |
|
9234 con notNil |
|
9235 and:[con receiver isMethod not or:[con receiver isJavaMethod not]] |
|
9236 ] whileTrue:[con := con sender.]. |
|
9237 con := con sender. |
|
9238 [con notNil] whileTrue:[ |
|
9239 (true) "con isJavaContext" ifTrue:[ |
|
9240 cls := con receiver class. |
|
9241 cls isMeta ifTrue:[ |
|
9242 "/ t'was a static method |
|
9243 cls := cls soleInstance |
|
9244 ]. |
|
9245 cls isJavaClass ifTrue:[ |
|
9246 jClass := self reflection javaClassObjectForClass:cls. |
|
9247 chain add:jClass. |
|
9248 ] |
|
9249 ]. |
|
9250 con := con sender. |
|
9251 ]. |
|
9252 ^ chain asArray |
|
9253 |
|
9254 "Created: / 05-01-1998 / 02:47:00 / cg" |
|
9255 "Modified: / 24-12-1998 / 00:34:57 / cg" |
|
9256 "Modified: / 28-01-2011 / 15:31:28 / Marcel Hlopko <hlopik@gmail.com>" |
|
9257 "Modified: / 03-02-2011 / 21:31:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9258 ! |
|
9259 |
|
9260 _Runtime_buildLibName:nativeContext |
|
9261 |jPath jFileName path fileName libName| |
|
9262 |
|
9263 jPath := nativeContext argAt:1. |
|
9264 jFileName := nativeContext argAt:2. |
|
9265 |
|
9266 path := Java as_ST_String:jPath. |
|
9267 fileName := Java as_ST_String:jFileName. |
|
9268 |
|
9269 path = '__builtIn__' ifTrue:[ |
|
9270 libName := path , '/' , fileName |
|
9271 ] ifFalse:[ |
|
9272 libName := path , '/lib' , fileName , '.so'. |
|
9273 ]. |
|
9274 ^ Java as_String:libName. |
|
9275 |
|
9276 "Modified: / 8.8.1997 / 12:05:05 / cg" |
|
9277 "Created: / 4.1.1998 / 19:07:14 / cg" |
|
9278 ! |
|
9279 |
|
9280 _Runtime_execInternal:nativeContext |
|
9281 "Run a unix-command; return a process object." |
|
9282 |
|
9283 |cmdAndArgArray envArray cmd jProcessClass jProcess| |
|
9284 |
|
9285 cmdAndArgArray := nativeContext argAt:1. |
|
9286 envArray := nativeContext argAt:2. |
|
9287 |
|
9288 cmd := cmdAndArgArray at:1. |
|
9289 |
|
9290 OperatingSystem isUNIXlike ifTrue:[ |
|
9291 jProcessClass := Java classForName:'java.lang.UNIXProcess'. |
|
9292 ] ifFalse:[ |
|
9293 jProcessClass := Java classForName:'java.lang.Win32Process'. |
|
9294 ]. |
|
9295 "/ |
|
9296 jProcessClass notNil ifTrue:[ |
|
9297 self halt. |
|
9298 jProcess := jProcessClass newCleared. |
|
9299 jProcess |
|
9300 perform:#'<init>([Ljava/lang/String;[Ljava/lang/String;)V' |
|
9301 with:cmdAndArgArray |
|
9302 with:envArray. |
|
9303 ^ jProcess |
|
9304 ]. |
|
9305 self halt. |
|
9306 self throwIOExceptionWithMessage:'Process execution disabled/unimplemented'. |
|
9307 ^ nil |
|
9308 |
|
9309 "Created: / 15.1.1998 / 01:50:31 / cg" |
|
9310 "Modified: / 11.12.1998 / 13:09:36 / cg" |
|
9311 ! |
|
9312 |
|
9313 _Runtime_exitInternal:nativeContext |
|
9314 "exit - here, we only shut down java threads" |
|
9315 |
|
9316 |enteredMonitors| |
|
9317 |
|
9318 ExitDebug == true ifTrue:[ |
|
9319 self halt:'Java code called exit'. |
|
9320 ]. |
|
9321 |
|
9322 self syncMonitorCache. |
|
9323 (enteredMonitors := self enteredMonitors) size > 0 ifTrue:[ |
|
9324 enteredMonitors do:[:handle | |
|
9325 | mon | |
|
9326 |
|
9327 mon := LockTable at:handle ifAbsent:nil. |
|
9328 mon isNil ifTrue:[ |
|
9329 self halt:'no monitor in exitInternal'. |
|
9330 ] ifFalse:[ |
|
9331 mon exit. |
|
9332 ('====> terminateThread - exit monitor for ' , handle displayString , ' in ' , Processor activeProcess name , ' ...') infoPrintCR. |
|
9333 ]. |
|
9334 ]. |
|
9335 ]. |
|
9336 |
|
9337 "/ TODO: shut down all threads created by this one ... |
|
9338 |
|
9339 AbortSignal raise. |
|
9340 self halt. |
|
9341 |
|
9342 "Created: / 7.1.1998 / 22:48:51 / cg" |
|
9343 "Modified: / 8.1.1999 / 14:09:36 / cg" |
|
9344 ! |
|
9345 |
|
9346 _Runtime_freeMemory:nativeContext |
|
9347 "free memory - Returns the number of free bytes" |
|
9348 |
|
9349 ^ ObjectMemory freeListSpace + ObjectMemory freeSpace |
|
9350 |
|
9351 "Created: / 12.1.1998 / 12:59:53 / cg" |
|
9352 ! |
|
9353 |
|
9354 _Runtime_initializeLinkerInternal:nativeContext |
|
9355 "init sharedLib linker, return searchPath as javaString" |
|
9356 |
|
9357 |path| |
|
9358 |
|
9359 "/ mhmh - what is done here ? |
|
9360 |
|
9361 path := ''. |
|
9362 LibPath do:[:comp | path size == 0 ifTrue:[ |
|
9363 path := path , comp |
|
9364 ] ifFalse:[ |
|
9365 path := path , ':' , comp |
|
9366 ] |
|
9367 ]. |
|
9368 |
|
9369 ^ Java as_String:path |
|
9370 |
|
9371 "Modified: / 7.8.1997 / 21:17:03 / cg" |
|
9372 "Created: / 4.1.1998 / 17:53:15 / cg" |
|
9373 ! |
|
9374 |
|
9375 _Runtime_isInputStreamLocalised:nativeContext |
|
9376 "/ boolean isInputStreamLocalised (java.io.DataInputStream) |
|
9377 |
|
9378 UnimplementedNativeMethodSignal raise. |
|
9379 |
|
9380 "Created: / 27.1.2000 / 03:03:01 / cg" |
|
9381 ! |
|
9382 |
|
9383 _Runtime_isOutputStreamLocalised:nativeContext |
|
9384 "/ boolean isOutputStreamLocalised (java.io.DataOutputStream) |
|
9385 |
|
9386 UnimplementedNativeMethodSignal raise. |
|
9387 |
|
9388 "Created: / 27.1.2000 / 03:02:49 / cg" |
|
9389 ! |
|
9390 |
|
9391 _Runtime_loadFileInternal:nativeContext |
|
9392 "load a sharedLib, return boolean 0 (false) if fail; 1 (true) if ok" |
|
9393 |
|
9394 |ret| |
|
9395 |
|
9396 ret := self _Runtime_loadFileInternalI:nativeContext. |
|
9397 ret < 0 ifTrue:[ ret := 0 ]. |
|
9398 ^ ret |
|
9399 |
|
9400 "Created: / 4.1.1998 / 19:10:20 / cg" |
|
9401 "Modified: / 4.1.1998 / 19:11:04 / cg" |
|
9402 ! |
|
9403 |
|
9404 _Runtime_loadFileInternalI:nativeContext |
|
9405 "1.1b3 change; load a sharedLib like 'loadFileInternal', |
|
9406 but return integer: |
|
9407 -1 outOfMemory error |
|
9408 0 failed to load |
|
9409 1 loaded or already loaded (i.e. ok)" |
|
9410 |
|
9411 |jLibName libName libHandle| |
|
9412 |
|
9413 jLibName := nativeContext argAt:1. |
|
9414 libName := Java as_ST_String:jLibName. |
|
9415 |
|
9416 (SimulatedLibs includes:libName) ifTrue:[ |
|
9417 "/ ('JAVA: builtIn libLoad simulated: ' , libName) printNL. |
|
9418 ^ 1 |
|
9419 ]. |
|
9420 (LoadedLibs notNil and:[LoadedLibs includesKey:libName]) ifTrue:[ |
|
9421 "/ ('JAVA: already loaded: ' , libName) printNL. |
|
9422 ^ 1 |
|
9423 ]. |
|
9424 |
|
9425 libName asFilename exists ifFalse:[ |
|
9426 ('JAVA: no file to load: ' , libName) printNL. |
|
9427 ^ 0 |
|
9428 ]. |
|
9429 |
|
9430 (self confirm:'permission to load native library: ' , libName , ' ?') ifFalse:[ |
|
9431 ^ 0 |
|
9432 ]. |
|
9433 |
|
9434 libHandle := ObjectFileLoader loadLibrary:libName. |
|
9435 libHandle isNil ifTrue:[ |
|
9436 ('JAVA: failed to load: ' , libName) printNL. |
|
9437 ^ 0 |
|
9438 ]. |
|
9439 |
|
9440 LoadedLibs isNil ifTrue:[ |
|
9441 LoadedLibs := Dictionary new. |
|
9442 ]. |
|
9443 |
|
9444 LoadedLibs at:libName put:libHandle. |
|
9445 ^ 1 |
|
9446 |
|
9447 "Created: / 4.1.1998 / 19:10:54 / cg" |
|
9448 "Modified: / 6.2.1998 / 03:11:59 / cg" |
|
9449 ! |
|
9450 |
|
9451 _Runtime_runFinalization:nativeContext |
|
9452 "/ void runFinalization () |
|
9453 "/ UnimplementedNativeMethodSignal raise |
|
9454 |
|
9455 "Modified: / 12.11.1998 / 18:52:07 / cg" |
|
9456 "Created: / 12.11.1998 / 18:59:01 / cg" |
|
9457 ! |
|
9458 |
|
9459 _Runtime_runFinalizersOnExit0:nativeContext |
|
9460 "" |
|
9461 |
|
9462 |onOff| |
|
9463 |
|
9464 onOff := nativeContext argAt:1. |
|
9465 ^ 1 |
|
9466 |
|
9467 "Modified: / 6.2.1998 / 03:11:59 / cg" |
|
9468 "Created: / 15.10.1998 / 23:34:55 / cg" |
|
9469 ! |
|
9470 |
|
9471 _Runtime_setInputStreamLocalised:nativeContext |
|
9472 |
|
9473 UnimplementedNativeMethodSignal raise. |
|
9474 |
|
9475 "Modified: / 27.1.2000 / 03:02:27 / cg" |
|
9476 ! |
|
9477 |
|
9478 _Runtime_setOutputStreamLocalised:nativeContext |
|
9479 |
|
9480 UnimplementedNativeMethodSignal raise. |
|
9481 |
|
9482 "Modified: / 27.1.2000 / 03:02:32 / cg" |
|
9483 ! |
|
9484 |
|
9485 _Runtime_totalMemory:nativeContext |
|
9486 "free memory - Returns the total number of bytes" |
|
9487 |
|
9488 ^ ObjectMemory oldSpaceSize + ObjectMemory newSpaceSize |
|
9489 |
|
9490 "Created: / 12.1.1998 / 12:59:23 / cg" |
|
9491 ! |
|
9492 |
|
9493 _Runtime_traceInstructions:nativeContext |
|
9494 "/ void traceInstructions (boolean) |
|
9495 UnimplementedNativeMethodSignal raise |
|
9496 |
|
9497 "Modified: / 12.11.1998 / 18:52:07 / cg" |
|
9498 "Created: / 12.11.1998 / 18:59:18 / cg" |
|
9499 ! |
|
9500 |
|
9501 _Runtime_traceMethodCalls:nativeContext |
|
9502 "/ void traceMethodCalls (boolean) |
|
9503 UnimplementedNativeMethodSignal raise |
|
9504 |
|
9505 "Modified: / 12.11.1998 / 18:52:07 / cg" |
|
9506 "Created: / 12.11.1998 / 18:59:37 / cg" |
|
9507 ! |
|
9508 |
|
9509 _ScrollPane_initIDs:nativeContext |
|
9510 "/ new with jdk1.2 ... |
|
9511 |
|
9512 "Created: / 28.1.1998 / 22:19:23 / cg" |
|
9513 ! |
|
9514 |
|
9515 _SecurityManager_classDepth:nativeContext |
|
9516 UnimplementedNativeMethodSignal raise |
|
9517 |
|
9518 "Modified: / 12.11.1998 / 18:52:07 / cg" |
|
9519 "Created: / 12.11.1998 / 18:56:27 / cg" |
|
9520 ! |
|
9521 |
|
9522 _SecurityManager_classLoaderDepth:nativeContext |
|
9523 |con depth| |
|
9524 |
|
9525 con := thisContext sender. |
|
9526 depth := 1. |
|
9527 [con notNil] whileTrue:[ |
|
9528 con receiver == JavaClassReader classLoaderQuerySignal ifTrue:[ |
|
9529 con selector == #handle:do: ifTrue:[ |
|
9530 depth := depth + 1 |
|
9531 ] |
|
9532 ]. |
|
9533 con := con sender. |
|
9534 ]. |
|
9535 'JAVA: classLoaderDepth -> ' infoPrint. depth infoPrintCR. |
|
9536 ^ depth. |
|
9537 |
|
9538 "Created: / 13.1.1998 / 09:21:46 / cg" |
|
9539 "Modified: / 13.1.1998 / 09:33:43 / cg" |
|
9540 ! |
|
9541 |
|
9542 _SecurityManager_currentClassLoader:nativeContext |
|
9543 |loader| |
|
9544 |
|
9545 loader := JavaClassReader classLoaderQuerySignal query. |
|
9546 "/ 'JAVA: currentClassLoader -> ' infoPrint. loader displayString infoPrintCR. |
|
9547 ^ loader. |
|
9548 |
|
9549 "Created: / 13.1.1998 / 09:23:28 / cg" |
|
9550 "Modified: / 11.12.1998 / 12:39:59 / cg" |
|
9551 ! |
|
9552 |
|
9553 _SecurityManager_currentLoadedClass0:nativeContext |
|
9554 UnimplementedNativeMethodSignal raise |
|
9555 |
|
9556 "Modified: / 12.11.1998 / 18:52:07 / cg" |
|
9557 "Created: / 12.11.1998 / 18:56:41 / cg" |
|
9558 ! |
|
9559 |
|
9560 _SecurityManager_getClassContext:nativeContext |
|
9561 UnimplementedNativeMethodSignal raise |
|
9562 |
|
9563 "Modified: / 12.11.1998 / 18:52:07 / cg" |
|
9564 "Created: / 12.11.1998 / 18:56:06 / cg" |
|
9565 ! |
|
9566 |
|
9567 _SocketInputStream_socketRead:nativeContext |
|
9568 ^ self anyStream_readBytes:nativeContext |
|
9569 |
|
9570 "Created: / 25.1.1998 / 20:56:53 / cg" |
|
9571 "Modified: / 4.2.1998 / 15:52:31 / cg" |
|
9572 ! |
|
9573 |
|
9574 _SocketOutputStream_socketWrite:nativeContext |
|
9575 ^ self anyStream_writeBytes:nativeContext |
|
9576 |
|
9577 "Created: / 25.1.1998 / 21:06:55 / cg" |
|
9578 "Modified: / 4.2.1998 / 15:52:40 / cg" |
|
9579 ! |
|
9580 |
|
9581 _String_compareTo:nativeContext |
|
9582 "int compareTo (java.lang.String)" |
|
9583 |
|
9584 |jString1 jString2| |
|
9585 |
|
9586 jString1 := nativeContext receiver. |
|
9587 jString2 := nativeContext argAt:1. |
|
9588 UnimplementedNativeMethodSignal raise. |
|
9589 |
|
9590 "Created: / 27.1.2000 / 02:28:59 / cg" |
|
9591 ! |
|
9592 |
|
9593 _String_equals:nativeContext |
|
9594 |jString1 jString2| |
|
9595 |
|
9596 jString1 := nativeContext receiver. |
|
9597 jString2 := nativeContext argAt:1. |
|
9598 ^ (jString1 instVarAt:1) = (jString2 instVarAt:1) |
|
9599 |
|
9600 "Created: / 18.11.1998 / 00:52:03 / cg" |
|
9601 "Modified: / 18.11.1998 / 00:53:01 / cg" |
|
9602 ! |
|
9603 |
|
9604 _String_equalsIgnoreCase:nativeContext |
|
9605 "boolean equalsIgnoreCase (java.lang.String)" |
|
9606 |
|
9607 |jString1 jString2| |
|
9608 |
|
9609 self halt:'untested'. |
|
9610 |
|
9611 jString1 := nativeContext receiver. |
|
9612 jString2 := nativeContext argAt:1. |
|
9613 ^ (jString1 instVarAt:1) sameAs: (jString2 instVarAt:1) |
|
9614 |
|
9615 "Modified: / 18.11.1998 / 00:53:01 / cg" |
|
9616 "Created: / 27.1.2000 / 02:27:46 / cg" |
|
9617 ! |
|
9618 |
|
9619 _String_indexOf:nativeContext |
|
9620 "int indexOf (java.lang.String int)" |
|
9621 |
|
9622 |jString1 jString2 idx| |
|
9623 |
|
9624 jString1 := nativeContext receiver. |
|
9625 jString2 := nativeContext argAt:1. |
|
9626 idx := nativeContext argAt:2. |
|
9627 UnimplementedNativeMethodSignal raise. |
|
9628 |
|
9629 "Created: / 27.1.2000 / 02:30:22 / cg" |
|
9630 ! |
|
9631 |
|
9632 _String_lastIndexOf:nativeContext |
|
9633 "int lastIndexOf (java.lang.String int)" |
|
9634 |
|
9635 |jString1 jString2 idx| |
|
9636 |
|
9637 jString1 := nativeContext receiver. |
|
9638 jString2 := nativeContext argAt:1. |
|
9639 idx := nativeContext argAt:2. |
|
9640 UnimplementedNativeMethodSignal raise. |
|
9641 |
|
9642 "Created: / 27.1.2000 / 02:33:59 / cg" |
|
9643 ! |
|
9644 |
|
9645 _String_length:nativeContext |
|
9646 |jString| |
|
9647 |
|
9648 jString := nativeContext receiver. |
|
9649 ^ (jString instVarAt:3) |
|
9650 |
|
9651 "Created: / 18.11.1998 / 00:53:50 / cg" |
|
9652 "Modified: / 18.11.1998 / 00:54:18 / cg" |
|
9653 ! |
|
9654 |
|
9655 _String_regionMatches2:nativeContext |
|
9656 "boolean regionMatches (boolean int java.lang.String int int)" |
|
9657 |
|
9658 |jString1 bool jString2 idx1 idx2| |
|
9659 |
|
9660 jString1 := nativeContext receiver. |
|
9661 bool := nativeContext argAt:1. |
|
9662 jString2 := nativeContext argAt:2. |
|
9663 idx1 := nativeContext argAt:3. |
|
9664 idx2 := nativeContext argAt:4. |
|
9665 UnimplementedNativeMethodSignal raise. |
|
9666 |
|
9667 "Created: / 27.1.2000 / 02:33:40 / cg" |
|
9668 ! |
|
9669 |
|
9670 _String_regionMatches:nativeContext |
|
9671 "boolean regionMatches (int java.lang.String int int)" |
|
9672 |
|
9673 |jString1 jString2 idx1 idx2| |
|
9674 |
|
9675 jString1 := nativeContext receiver. |
|
9676 jString2 := nativeContext argAt:1. |
|
9677 idx1 := nativeContext argAt:2. |
|
9678 idx2 := nativeContext argAt:3. |
|
9679 UnimplementedNativeMethodSignal raise. |
|
9680 |
|
9681 "Created: / 27.1.2000 / 02:32:29 / cg" |
|
9682 ! |
|
9683 |
|
9684 _String_startsWith:nativeContext |
|
9685 "boolean startsWith (java.lang.String int)" |
|
9686 |
|
9687 |jString1 jString2 idx| |
|
9688 |
|
9689 jString1 := nativeContext receiver. |
|
9690 jString2 := nativeContext argAt:1. |
|
9691 idx := nativeContext argAt:2. |
|
9692 UnimplementedNativeMethodSignal raise. |
|
9693 |
|
9694 "Created: / 27.1.2000 / 02:31:40 / cg" |
|
9695 ! |
|
9696 |
|
9697 _SystemColor_GetSysColor:nativeContext |
|
9698 "/ int GetSysColor (int) |
|
9699 UnimplementedNativeMethodSignal raise |
|
9700 |
|
9701 "Created: / 27.1.2000 / 02:44:41 / cg" |
|
9702 ! |
|
9703 |
|
9704 _SystemResourceManager_getEntryFromKey:nativeContext |
|
9705 "get a resource by name" |
|
9706 |
|
9707 |key s| |
|
9708 |
|
9709 key := nativeContext argAt:1. |
|
9710 |
|
9711 s := Java effectiveClassPath at:(key+1) ifAbsent:nil. |
|
9712 s isNil ifTrue:[^ nil]. |
|
9713 ^ Java as_String:s |
|
9714 |
|
9715 "Modified: / 22-11-2010 / 13:44:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9716 ! |
|
9717 |
|
9718 _SystemResourceManager_validateSystemResource:nativeContext |
|
9719 "check a resource" |
|
9720 |
|
9721 |bool str1 str2| |
|
9722 |
|
9723 bool := nativeContext argAt:1. |
|
9724 str1 := nativeContext argAt:2. |
|
9725 str2 := nativeContext argAt:3. |
|
9726 ^ 1 "/ true |
|
9727 ! |
|
9728 |
|
9729 _System_getCallerClass:nativeContext |
|
9730 "/ introduced with jdk1.2 |
|
9731 |
|
9732 |senderContext cls| |
|
9733 |
|
9734 senderContext := nativeContext sender. |
|
9735 [senderContext receiver == (Java at:'java.lang.System')] whileTrue:[ |
|
9736 senderContext := senderContext sender. |
|
9737 ]. |
|
9738 |
|
9739 senderContext method isStatic ifTrue:[ |
|
9740 cls := senderContext receiver |
|
9741 ] ifFalse:[ |
|
9742 cls := senderContext receiver class |
|
9743 ]. |
|
9744 cls isJavaClass ifTrue:[ |
|
9745 ^ self javaClassObjectForClass:cls |
|
9746 ]. |
|
9747 (cls isMemberOf:(Java at:'java.lang.Class')) ifTrue:[ |
|
9748 ^ Java at:'java.lang.Class' |
|
9749 ]. |
|
9750 self halt. |
|
9751 ^ nil |
|
9752 |
|
9753 "Modified: / 27.1.1998 / 18:33:13 / cg" |
|
9754 ! |
|
9755 |
|
9756 _System_validateSecurityManager:nativeContext |
|
9757 "void validateSecurityManager (java.lang.SecurityManager)" |
|
9758 |
|
9759 UnimplementedNativeMethodSignal raise. |
|
9760 |
|
9761 "Created: / 27.1.2000 / 02:43:25 / cg" |
|
9762 ! |
|
9763 |
|
9764 _ThreadGroup_initMainThreadGroup0:nativeContext |
|
9765 "void initMainThreadGroup0 (java.lang.ThreadGroup)" |
|
9766 |
|
9767 UnimplementedNativeMethodSignal raise. |
|
9768 |
|
9769 "Created: / 27.1.2000 / 02:45:52 / cg" |
|
9770 ! |
|
9771 |
|
9772 _Thread_countStackFrames:nativeContext |
|
9773 "/ int countStackFrames () |
|
9774 UnimplementedNativeMethodSignal raise |
|
9775 |
|
9776 "Created: / 12.11.1998 / 19:06:21 / cg" |
|
9777 ! |
|
9778 |
|
9779 _Thread_interrupt0:nativeContext |
|
9780 "ask if a thread is interrupted (clear interruptState if arg is true)" |
|
9781 |
|
9782 |jThread stProcess| |
|
9783 |
|
9784 jThread := nativeContext receiver. |
|
9785 stProcess := self stProcessForJavaThread:jThread. |
|
9786 stProcess isNil ifTrue:[ |
|
9787 self halt. |
|
9788 ^ 0 |
|
9789 ]. |
|
9790 |
|
9791 stProcess markInterrupted |
|
9792 |
|
9793 "Modified: / 2.1.1998 / 21:49:06 / cg" |
|
9794 "Created: / 10.4.1998 / 15:21:43 / cg" |
|
9795 ! |
|
9796 |
|
9797 _Thread_isInterrupted:nativeContext |
|
9798 "ask if a thread is interrupted (clear interruptState if arg is true)" |
|
9799 |
|
9800 |jThread stProcess clearInterrupt rslt| |
|
9801 |
|
9802 jThread := nativeContext receiver. |
|
9803 stProcess := self stProcessForJavaThread:jThread. |
|
9804 stProcess isNil ifTrue:[ |
|
9805 self halt. |
|
9806 ^ 0 |
|
9807 ]. |
|
9808 |
|
9809 clearInterrupt := nativeContext argAt:1. |
|
9810 rslt := stProcess isInterrupted ifTrue:[1] ifFalse:[0]. |
|
9811 clearInterrupt ~~ 0 ifTrue:[stProcess clearInterruptActions]. |
|
9812 ^ rslt |
|
9813 |
|
9814 "Modified: / 2.1.1998 / 21:49:06 / cg" |
|
9815 "Created: / 7.1.1998 / 18:50:26 / cg" |
|
9816 ! |
|
9817 |
|
9818 _Thread_resume0:nativeContext |
|
9819 "yield" |
|
9820 |
|
9821 |jThread stProcess| |
|
9822 |
|
9823 jThread := nativeContext receiver. |
|
9824 stProcess := JavaVM stProcessForJavaThread:jThread. |
|
9825 stProcess isNil ifTrue:[ |
|
9826 ThreadTrace == true ifTrue:[ |
|
9827 ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL. |
|
9828 ]. |
|
9829 ^ nil "void" |
|
9830 ]. |
|
9831 stProcess resume |
|
9832 |
|
9833 "Created: / 8.1.1998 / 01:06:27 / cg" |
|
9834 "Modified: / 6.2.1998 / 02:15:08 / cg" |
|
9835 ! |
|
9836 |
|
9837 _Thread_start:nativeContext |
|
9838 "start the thread" |
|
9839 |
|
9840 |jThread jName name stProcess| |
|
9841 |
|
9842 jThread := nativeContext receiver. |
|
9843 (jThread instVarNamed:'priority') < 1 ifTrue:[ |
|
9844 self halt. |
|
9845 jThread instVarNamed:'priority' put:1. |
|
9846 ]. |
|
9847 |
|
9848 stProcess := JavaProcess |
|
9849 for:[ |
|
9850 |procName| |
|
9851 |
|
9852 Object abortSignal handle:[:ex | |
|
9853 procName := stProcess name. |
|
9854 (procName startsWith:'JAVA-AWT-EventQueue') ifTrue:[ |
|
9855 ('JAVA [info]: thread ' , procName , ' aborted - restarting process.') infoPrintCR. |
|
9856 ex restart. |
|
9857 ] ifFalse:[ |
|
9858 (stProcess == JavaScreenUpdaterThread |
|
9859 or:[stProcess == JavaEventQueueThread]) ifTrue:[ |
|
9860 ('JAVA [info]: thread ' , procName , ' aborted - restarting process.') infoPrintCR. |
|
9861 ex restart |
|
9862 ] ifFalse:[ |
|
9863 ('JAVA [info]: thread ' , procName , ' aborted.') infoPrintCR. |
|
9864 ] |
|
9865 ]. |
|
9866 ] do:[ |
|
9867 [ |
|
9868 JavaVM javaExceptionSignal handle:[:ex | |
|
9869 |exClass| |
|
9870 |
|
9871 procName := stProcess name. |
|
9872 exClass := ex parameter class. |
|
9873 |
|
9874 exClass == (Java at:'java.lang.ThreadDeath') ifTrue:[ |
|
9875 ('JAVA: thread ' , procName , ' terminated') infoPrintCR. |
|
9876 ] ifFalse:[ |
|
9877 Transcript |
|
9878 showCR:('JAVA: thread ''' |
|
9879 , procName |
|
9880 , ''' terminated with exception: ' |
|
9881 , exClass name). |
|
9882 ]. |
|
9883 ex return. |
|
9884 ] do:[ |
|
9885 Object messageNotUnderstoodSignal handle:[:ex | |
|
9886 "/ remap doesNotUnderstand with nil-receiver to |
|
9887 "/ a nullPointerException ... |
|
9888 |con m| |
|
9889 |
|
9890 con := ex suspendedContext. |
|
9891 con receiver isNil ifTrue:[ |
|
9892 ((m := con sender method) notNil |
|
9893 and:[m isJavaMethod]) ifTrue:[ |
|
9894 self throwNullPointerException. |
|
9895 AbortSignal raise. "/ ex proceed. |
|
9896 ] |
|
9897 ]. |
|
9898 ex reject. |
|
9899 ] do:[ |
|
9900 "/ Transcript showCR:(Timestamp now printString , 'start thread: ', stProcess name). |
|
9901 jThread perform:#'run()V'. |
|
9902 ThreadTrace == true ifTrue:[ |
|
9903 ('JAVA: thread ' , stProcess name , ' terminated') infoPrintCR. |
|
9904 ]. |
|
9905 jThread perform:#'exit()V'. |
|
9906 ThreadTrace == true ifTrue:[ |
|
9907 ('JAVA: after exit of thread ' , stProcess name) infoPrintCR. |
|
9908 ] |
|
9909 ] |
|
9910 ] |
|
9911 ] ensure:[ |
|
9912 |monitors| |
|
9913 |
|
9914 monitors := EnteredMonitorsPerProcess at:stProcess ifAbsent:nil. |
|
9915 monitors notNil ifTrue:[ |
|
9916 monitors do:[:obj | |
|
9917 | mon | |
|
9918 |
|
9919 mon := self monitorFor:obj. |
|
9920 mon notNil ifTrue:[ |
|
9921 mon owningProcess == stProcess ifTrue:[ |
|
9922 ('JAVA: release monitor owned by dying thread: ' , stProcess name) infoPrintCR. |
|
9923 mon exit |
|
9924 ]. |
|
9925 ]. |
|
9926 ]. |
|
9927 EnteredMonitorsPerProcess removeKey:stProcess. |
|
9928 |
|
9929 stProcess == JavaScreenUpdaterThread ifTrue:[ |
|
9930 JavaScreenUpdaterThread := nil. |
|
9931 ]. |
|
9932 stProcess == JavaEventQueueThread ifTrue:[ |
|
9933 JavaEventQueueThread := nil. |
|
9934 ]. |
|
9935 "/ screenUpdaterClass := Java at:'sun.awt.ScreenUpdater'. |
|
9936 "/ screenUpdaterClass notNil ifTrue:[ |
|
9937 "/ screenUpdaterClass instVarNamed:'updater' put:nil. |
|
9938 "/ ]. |
|
9939 ]. |
|
9940 Java threads removeKey:jThread ifAbsent:[]. |
|
9941 ] |
|
9942 ] |
|
9943 ] |
|
9944 priority:(Processor activePriority). |
|
9945 |
|
9946 jName := jThread instVarNamed:'name'. |
|
9947 jName isString ifFalse:[ |
|
9948 name := Java as_ST_String:jName. |
|
9949 ] ifTrue:[ |
|
9950 name := jName |
|
9951 ]. |
|
9952 |
|
9953 "/ kludge - remember the ScreenUpdater ... |
|
9954 name = 'Screen Updater' ifTrue:[ |
|
9955 JavaScreenUpdaterThread := stProcess. |
|
9956 ] ifFalse:[ |
|
9957 name = 'AWT-Windows' ifTrue:[ |
|
9958 JavaEventThread := stProcess. |
|
9959 ] ifFalse:[ |
|
9960 (name startsWith:'AWT-EventQueue') ifTrue:[ |
|
9961 JavaEventQueueThread := stProcess. |
|
9962 ]. |
|
9963 ] |
|
9964 ]. |
|
9965 |
|
9966 "/name = 'UserDialogShowThread' ifTrue:[ |
|
9967 "/self halt |
|
9968 "/]. |
|
9969 "/ when that process terminates, wakup any waiters |
|
9970 stProcess addExitAction:[self wakeup:jThread]. |
|
9971 |
|
9972 stProcess name:'JAVA-' , name. |
|
9973 stProcess restartable:true. |
|
9974 stProcess resume. |
|
9975 |
|
9976 Java threads at:jThread put:stProcess. |
|
9977 |
|
9978 ^ nil |
|
9979 |
|
9980 "Created: / 3.1.1998 / 02:05:52 / cg" |
|
9981 "Modified: / 24.12.1999 / 03:14:33 / cg" |
|
9982 ! |
|
9983 |
|
9984 _Thread_stop0:nativeContext |
|
9985 "terminate a thread" |
|
9986 |
|
9987 |jThread stProcess death| |
|
9988 |
|
9989 jThread := nativeContext receiver. |
|
9990 |
|
9991 stProcess := JavaVM stProcessForJavaThread:jThread. |
|
9992 stProcess isNil ifTrue:[ |
|
9993 ThreadTrace == true ifTrue:[ |
|
9994 ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL. |
|
9995 ]. |
|
9996 ^ nil "void" |
|
9997 ]. |
|
9998 stProcess == JavaScreenUpdaterThread ifTrue:[self halt]. |
|
9999 stProcess == JavaEventQueueThread ifTrue:[self halt]. |
|
10000 |
|
10001 death := nativeContext argAt:1. |
|
10002 stProcess |
|
10003 interruptWith:[ |
|
10004 JavaVM javaExceptionSignal handle:[:ex | |
|
10005 Processor activeProcess == JavaScreenUpdaterThread ifTrue:[self halt]. |
|
10006 Processor activeProcess == JavaEventQueueThread ifTrue:[self halt]. |
|
10007 Processor activeProcess terminate |
|
10008 ] do:[ |
|
10009 ThreadTrace == true ifTrue:[ |
|
10010 ('JAVA: thread exit: ' , jThread displayString) infoPrintNL. |
|
10011 ]. |
|
10012 jThread perform:#'exit()V'. |
|
10013 self throwException:death. |
|
10014 ] |
|
10015 ]. |
|
10016 stProcess resume. |
|
10017 |
|
10018 [stProcess isDead] whileFalse:[ |
|
10019 stProcess resume. |
|
10020 'JavaVM: wait for death' infoPrintCR. |
|
10021 Delay waitForSeconds:0.1 |
|
10022 ]. |
|
10023 stProcess terminate |
|
10024 |
|
10025 "Created: / 8.1.1998 / 13:11:17 / cg" |
|
10026 "Modified: / 24.12.1999 / 02:32:45 / cg" |
|
10027 ! |
|
10028 |
|
10029 _Thread_suspend0:nativeContext |
|
10030 "yield" |
|
10031 |
|
10032 |jThread stProcess| |
|
10033 |
|
10034 jThread := nativeContext receiver. |
|
10035 stProcess := JavaVM stProcessForJavaThread:jThread. |
|
10036 stProcess isNil ifTrue:[ |
|
10037 ThreadTrace == true ifTrue:[ |
|
10038 ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL. |
|
10039 ]. |
|
10040 ^ nil "void" |
|
10041 ]. |
|
10042 stProcess suspend |
|
10043 |
|
10044 "Created: / 8.1.1998 / 01:05:49 / cg" |
|
10045 "Modified: / 6.2.1998 / 02:15:23 / cg" |
|
10046 ! |
|
10047 |
|
10048 _Thread_yield:nativeContext |
|
10049 "yield" |
|
10050 |
|
10051 |jThread stProcess| |
|
10052 |
|
10053 Processor yield. |
|
10054 "/ jThread := nativeContext receiver. |
|
10055 "/ stProcess := JavaVM stProcessForJavaThread:jThread. |
|
10056 "/ stProcess isNil ifTrue:[ |
|
10057 "/ ThreadTrace == true ifTrue:[ |
|
10058 "/ ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL. |
|
10059 "/ ]. |
|
10060 "/ ^ nil "void" |
|
10061 "/ ]. |
|
10062 "/ stProcess == Processor activeProcess ifTrue:[ |
|
10063 "/ Processor yield. |
|
10064 "/ ] ifFalse:[ |
|
10065 "/ self halt. |
|
10066 "/ ]. |
|
10067 |
|
10068 "Created: / 5.1.1998 / 02:03:51 / cg" |
|
10069 "Modified: / 23.12.1998 / 19:19:17 / cg" |
|
10070 ! |
|
10071 |
|
10072 _Throwable_printStackTrace0:nativeContext |
|
10073 |out outStream exceptionObject contextList| |
|
10074 |
|
10075 outStream := nativeContext argAt:1. |
|
10076 exceptionObject := nativeContext receiver. |
|
10077 |
|
10078 contextList := exceptionObject instVarNamed:'backtrace'. |
|
10079 |
|
10080 out := self javaConsoleStream. |
|
10081 out cr. |
|
10082 out nextPutLine:'JAVA: stackTrace:'. |
|
10083 |
|
10084 contextList do:[:con | |
|
10085 out |
|
10086 nextPutAll:' '; |
|
10087 nextPutAll:(con method javaClass fullName); |
|
10088 nextPutAll:'.'; |
|
10089 nextPutAll:(con method selector); |
|
10090 nextPutAll:' ['; |
|
10091 nextPutAll:(con method javaClass sourceFile); |
|
10092 nextPutAll:' '; |
|
10093 nextPutAll:(con quickLineNumber displayString); |
|
10094 nextPutAll:']'. |
|
10095 out cr |
|
10096 ]. |
|
10097 out nextPutLine:'----------------------------------------------------' |
|
10098 |
|
10099 "Created: / 4.1.1998 / 14:27:40 / cg" |
|
10100 "Modified: / 10.11.1998 / 14:19:32 / cg" |
|
10101 ! |
|
10102 |
|
10103 _Toolkit_initIDs:nativeContext |
|
10104 "/ introduced with jdk1.2 ... (sigh) |
|
10105 |
|
10106 "Created: / 27.1.1998 / 19:53:50 / cg" |
|
10107 ! |
|
10108 |
|
10109 _URLConnection_close:nativeContext |
|
10110 "/ void close () |
|
10111 UnimplementedNativeMethodSignal raise |
|
10112 |
|
10113 "Created: / 12.11.1998 / 19:26:03 / cg" |
|
10114 ! |
|
10115 |
|
10116 _URLConnection_finalize:nativeContext |
|
10117 "/ void finalize () |
|
10118 UnimplementedNativeMethodSignal raise |
|
10119 |
|
10120 "Created: / 12.11.1998 / 19:25:22 / cg" |
|
10121 ! |
|
10122 |
|
10123 _URLConnection_getContentLength0:nativeContext |
|
10124 "/ int getContentLength0 () |
|
10125 UnimplementedNativeMethodSignal raise |
|
10126 |
|
10127 "Created: / 12.11.1998 / 19:25:34 / cg" |
|
10128 ! |
|
10129 |
|
10130 _URLConnection_getContentType0:nativeContext |
|
10131 "/ java.lang.String getContentType0 () |
|
10132 UnimplementedNativeMethodSignal raise |
|
10133 |
|
10134 "Created: / 12.11.1998 / 19:25:42 / cg" |
|
10135 ! |
|
10136 |
|
10137 _URLConnection_getHeaderField0:nativeContext |
|
10138 "/ java.lang.String getHeaderField0 (java.lang.String) |
|
10139 UnimplementedNativeMethodSignal raise |
|
10140 |
|
10141 "Created: / 12.11.1998 / 19:25:53 / cg" |
|
10142 ! |
|
10143 |
|
10144 _URLConnection_pCreate:nativeContext |
|
10145 "/ void pCreate (java.lang.String java.lang.String) |
|
10146 UnimplementedNativeMethodSignal raise |
|
10147 |
|
10148 "Created: / 12.11.1998 / 19:25:14 / cg" |
|
10149 ! |
|
10150 |
|
10151 _URLInputStream_available:nativeContext |
|
10152 "/ int available () |
|
10153 UnimplementedNativeMethodSignal raise |
|
10154 |
|
10155 "Created: / 12.11.1998 / 19:24:26 / cg" |
|
10156 ! |
|
10157 |
|
10158 _URLInputStream_open:nativeContext |
|
10159 "/ void open () |
|
10160 UnimplementedNativeMethodSignal raise |
|
10161 |
|
10162 "Created: / 12.11.1998 / 19:24:01 / cg" |
|
10163 ! |
|
10164 |
|
10165 _URLInputStream_read:nativeContext |
|
10166 "/ int read (byte[] int int) |
|
10167 UnimplementedNativeMethodSignal raise |
|
10168 |
|
10169 "Created: / 12.11.1998 / 19:24:12 / cg" |
|
10170 ! |
|
10171 |
|
10172 _URLOutputStream_open:nativeContext |
|
10173 "/ void open () |
|
10174 UnimplementedNativeMethodSignal raise |
|
10175 |
|
10176 "Created: / 12.11.1998 / 19:24:38 / cg" |
|
10177 ! |
|
10178 |
|
10179 _URLOutputStream_pClose:nativeContext |
|
10180 "/ void pClose () |
|
10181 UnimplementedNativeMethodSignal raise |
|
10182 |
|
10183 "Created: / 12.11.1998 / 19:25:02 / cg" |
|
10184 ! |
|
10185 |
|
10186 _URLOutputStream_write:nativeContext |
|
10187 "/ void write (int) |
|
10188 UnimplementedNativeMethodSignal raise |
|
10189 |
|
10190 "Created: / 12.11.1998 / 19:24:45 / cg" |
|
10191 ! |
|
10192 |
|
10193 _URLOutputStream_writeBytes:nativeContext |
|
10194 "/ void writeBytes (byte[] int int) |
|
10195 UnimplementedNativeMethodSignal raise |
|
10196 |
|
10197 "Created: / 12.11.1998 / 19:24:55 / cg" |
|
10198 ! |
|
10199 |
|
10200 _URLStreamHandlerFactory_pInit:nativeContext |
|
10201 "/ self unimplementedNativeMethod. |
|
10202 |
|
10203 "Created: / 10.1.1998 / 15:47:24 / cg" |
|
10204 ! |
|
10205 |
|
10206 _URLStreamHandlerFactory_pSupportsProtocol:nativeContext |
|
10207 "/ boolean pSupportsProtocol (java.lang.String) |
|
10208 UnimplementedNativeMethodSignal raise |
|
10209 |
|
10210 "Created: / 12.11.1998 / 19:23:43 / cg" |
|
10211 ! |
|
10212 |
|
10213 _VM_getState:nativeContext |
|
10214 "/ int getState () |
|
10215 UnimplementedNativeMethodSignal raise |
|
10216 |
|
10217 "Created: / 12.11.1998 / 19:06:44 / cg" |
|
10218 ! |
|
10219 |
|
10220 _VM_resetJavaMonitor:nativeContext |
|
10221 "/ void resetJavaMonitor () |
|
10222 UnimplementedNativeMethodSignal raise |
|
10223 |
|
10224 "Created: / 14.11.1998 / 10:43:23 / cg" |
|
10225 ! |
|
10226 |
|
10227 _VM_resumeJavaMonitor:nativeContext |
|
10228 "/ void resumeJavaMonitor () |
|
10229 UnimplementedNativeMethodSignal raise |
|
10230 |
|
10231 "Created: / 14.11.1998 / 10:42:49 / cg" |
|
10232 ! |
|
10233 |
|
10234 _VM_suspendJavaMonitor:nativeContext |
|
10235 "/ void suspendJavaMonitor () |
|
10236 UnimplementedNativeMethodSignal raise |
|
10237 |
|
10238 "Created: / 14.11.1998 / 10:43:07 / cg" |
|
10239 ! |
|
10240 |
|
10241 _VM_threadsSuspended:nativeContext |
|
10242 "/ boolean threadsSuspended () |
|
10243 UnimplementedNativeMethodSignal raise |
|
10244 |
|
10245 "Created: / 12.11.1998 / 19:07:10 / cg" |
|
10246 ! |
|
10247 |
|
10248 _VM_unsuspendSomeThreads:nativeContext |
|
10249 "/ void unsuspendSomeThreads () |
|
10250 UnimplementedNativeMethodSignal raise |
|
10251 |
|
10252 "Created: / 12.11.1998 / 19:07:29 / cg" |
|
10253 ! |
|
10254 |
|
10255 _VM_unsuspendThreads:nativeContext |
|
10256 "/ void unsuspendThreads () |
|
10257 UnimplementedNativeMethodSignal raise |
|
10258 |
|
10259 "Created: / 12.11.1998 / 19:07:20 / cg" |
|
10260 ! |
|
10261 |
|
10262 _VM_writeJavaMonitorReport:nativeContext |
|
10263 "/ void writeJavaMonitorReport () |
|
10264 UnimplementedNativeMethodSignal raise |
|
10265 |
|
10266 "Created: / 14.11.1998 / 10:43:37 / cg" |
|
10267 ! |
|
10268 |
|
10269 _WButtonPeer_create:nativeContext |
|
10270 |jButtonPeer jButton jFrame frame button |
|
10271 lbl| |
|
10272 |
|
10273 jButtonPeer := nativeContext receiver. |
|
10274 jButton := jButtonPeer instVarNamed:'target'. |
|
10275 |
|
10276 jFrame := nativeContext argAt:1. |
|
10277 frame := jFrame instVarNamed:'pData'. |
|
10278 |
|
10279 button := Button in:frame. |
|
10280 button sizeFixed:true. |
|
10281 button action:[ |
|
10282 jButtonPeer perform:#'handleAction()V'. |
|
10283 ]. |
|
10284 |
|
10285 lbl := jButton instVarNamed:'label'. |
|
10286 lbl notNil ifTrue:[ |
|
10287 lbl := Java as_ST_String:lbl. |
|
10288 button label:lbl |
|
10289 ]. |
|
10290 self createdWindowsView:button for:jButtonPeer. |
|
10291 |
|
10292 WindowCreationTrace == true ifTrue:[ |
|
10293 'WButtonPeer_create: ' print. frame print. ' -> ' print. button printNL. |
|
10294 ]. |
|
10295 |
|
10296 "Created: / 5.1.1998 / 01:53:30 / cg" |
|
10297 "Modified: / 11.12.1998 / 00:19:22 / cg" |
|
10298 ! |
|
10299 |
|
10300 _WButtonPeer_setLabel:nativeContext |
|
10301 |label jString| |
|
10302 |
|
10303 jString := nativeContext argAt:1. |
|
10304 |
|
10305 label := self viewForWPeer:nativeContext. |
|
10306 label label:(Java as_ST_String:jString) |
|
10307 |
|
10308 "Modified: / 8.1.1998 / 17:35:50 / cg" |
|
10309 "Created: / 1.2.1998 / 17:05:47 / cg" |
|
10310 ! |
|
10311 |
|
10312 _WCanvasPeer_create:nativeContext |
|
10313 |jCanvasPeer jFrame frame subView| |
|
10314 |
|
10315 jCanvasPeer := nativeContext receiver. |
|
10316 |
|
10317 jFrame := nativeContext argAt:1. |
|
10318 jFrame isNil ifTrue:[ |
|
10319 self halt:'no frame in canvasPeer create'. |
|
10320 subView := JavaView new. |
|
10321 "/ self internalError:'no frame in canvasPeer create'. |
|
10322 "/ ^ self. |
|
10323 ] ifFalse:[ |
|
10324 frame := jFrame instVarNamed:'pData'. |
|
10325 subView := JavaView in:frame. |
|
10326 ]. |
|
10327 |
|
10328 subView delegate:self. |
|
10329 subView javaPeer:jCanvasPeer. |
|
10330 |
|
10331 self createdWindowsView:subView for:jCanvasPeer. |
|
10332 |
|
10333 WindowCreationTrace == true ifTrue:[ |
|
10334 'WCanvasPeer_create: ' print. frame print. ' -> ' print. subView printNL. |
|
10335 ]. |
|
10336 |
|
10337 "Created: / 5.1.1998 / 00:59:19 / cg" |
|
10338 "Modified: / 16.1.1998 / 13:40:00 / cg" |
|
10339 ! |
|
10340 |
|
10341 _WCheckboxMenuItemPeer_setState:nativeContext |
|
10342 "/ void setState (boolean) |
|
10343 "/ UnimplementedNativeMethodSignal raise |
|
10344 |
|
10345 "Created: / 12.11.1998 / 19:14:35 / cg" |
|
10346 "Modified: / 3.12.1998 / 21:41:13 / cg" |
|
10347 ! |
|
10348 |
|
10349 _WCheckboxPeer_create:nativeContext |
|
10350 |jCheckboxPeer jCheckbox jFrame frame checkBox lbl| |
|
10351 |
|
10352 jCheckboxPeer := nativeContext receiver. |
|
10353 jCheckbox := jCheckboxPeer instVarNamed:'target'. |
|
10354 |
|
10355 jFrame := nativeContext argAt:1. |
|
10356 frame := jFrame instVarNamed:'pData'. |
|
10357 |
|
10358 checkBox := CheckBox in:frame. |
|
10359 checkBox action:[ |
|
10360 jCheckboxPeer |
|
10361 perform:#'handleAction(Z)V' |
|
10362 with:(checkBox isOn ifTrue:[1] ifFalse:[0]) |
|
10363 ]. |
|
10364 |
|
10365 lbl := jCheckbox instVarNamed:'label'. |
|
10366 lbl notNil ifTrue:[ |
|
10367 lbl := Java as_ST_String:lbl. |
|
10368 checkBox label:lbl |
|
10369 ]. |
|
10370 |
|
10371 self createdWindowsView:checkBox for:jCheckboxPeer. |
|
10372 |
|
10373 WindowCreationTrace == true ifTrue:[ |
|
10374 'WCheckboxPeer_create: ' print. frame print. ' -> ' print. checkBox printNL. |
|
10375 ]. |
|
10376 |
|
10377 "Created: / 7.1.1998 / 21:48:03 / cg" |
|
10378 "Modified: / 15.1.1998 / 12:27:04 / cg" |
|
10379 ! |
|
10380 |
|
10381 _WCheckboxPeer_setCheckboxGroup:nativeContext |
|
10382 |checkBox jGroup| |
|
10383 |
|
10384 checkBox := self viewForWPeer:nativeContext. |
|
10385 |
|
10386 jGroup := nativeContext argAt:1. |
|
10387 |
|
10388 "Created: / 7.1.1998 / 21:48:47 / cg" |
|
10389 "Modified: / 25.1.1998 / 01:20:42 / cg" |
|
10390 ! |
|
10391 |
|
10392 _WCheckboxPeer_setLabel:nativeContext |
|
10393 "/ void setLabel (java.lang.String) |
|
10394 UnimplementedNativeMethodSignal raise |
|
10395 |
|
10396 "Created: / 12.11.1998 / 19:14:53 / cg" |
|
10397 ! |
|
10398 |
|
10399 _WCheckboxPeer_setState:nativeContext |
|
10400 |checkBox state| |
|
10401 |
|
10402 checkBox := self viewForWPeer:nativeContext. |
|
10403 |
|
10404 state := nativeContext argAt:1. |
|
10405 state ~~ 0 ifTrue:[ |
|
10406 checkBox turnOn |
|
10407 ] ifFalse:[ |
|
10408 checkBox turnOff |
|
10409 ]. |
|
10410 |
|
10411 "Created: / 7.1.1998 / 21:49:13 / cg" |
|
10412 "Modified: / 25.1.1998 / 01:26:18 / cg" |
|
10413 ! |
|
10414 |
|
10415 _WChoicePeer_addItem:nativeContext |
|
10416 |jString index comboBox| |
|
10417 |
|
10418 comboBox := self viewForWPeer:nativeContext. |
|
10419 |
|
10420 jString := nativeContext argAt:1. |
|
10421 index := nativeContext argAt:2. |
|
10422 |
|
10423 comboBox model list addLast:(Java as_ST_String:jString). |
|
10424 comboBox model changed:#list. |
|
10425 |
|
10426 "Created: / 7.1.1998 / 21:45:12 / cg" |
|
10427 "Modified: / 24.1.1998 / 18:51:32 / cg" |
|
10428 ! |
|
10429 |
|
10430 _WChoicePeer_create:nativeContext |
|
10431 |jChoicePeer jChoice jFrame frame comboBox| |
|
10432 |
|
10433 jChoicePeer := nativeContext receiver. |
|
10434 jChoice := jChoicePeer instVarNamed:'target'. |
|
10435 |
|
10436 jFrame := nativeContext argAt:1. |
|
10437 frame := jFrame instVarNamed:'pData'. |
|
10438 |
|
10439 comboBox := ComboListView in:frame. |
|
10440 comboBox model:(SelectionInList new list:(OrderedCollection new)). |
|
10441 comboBox action:[:index | |
|
10442 jChoicePeer |
|
10443 perform:#'handleAction(I)V' |
|
10444 with:(comboBox model selectionIndex - 1) |
|
10445 ]. |
|
10446 |
|
10447 self createdWindowsView:comboBox for:jChoicePeer. |
|
10448 |
|
10449 WindowCreationTrace == true ifTrue:[ |
|
10450 'WChoicePeer_create: ' print. frame print. ' -> ' print. comboBox printNL. |
|
10451 ]. |
|
10452 |
|
10453 "Created: / 7.1.1998 / 21:44:31 / cg" |
|
10454 "Modified: / 28.1.1998 / 23:19:17 / cg" |
|
10455 ! |
|
10456 |
|
10457 _WChoicePeer_remove:nativeContext |
|
10458 "/ void remove (int) |
|
10459 UnimplementedNativeMethodSignal raise |
|
10460 |
|
10461 "Created: / 12.11.1998 / 19:12:20 / cg" |
|
10462 ! |
|
10463 |
|
10464 _WChoicePeer_reshape:nativeContext |
|
10465 self commonReshapeComponent:nativeContext. |
|
10466 "/ self pReshape:nativeContext. |
|
10467 ^ self. |
|
10468 |
|
10469 "Created: / 7.1.1998 / 21:46:18 / cg" |
|
10470 "Modified: / 23.12.1998 / 19:08:07 / cg" |
|
10471 ! |
|
10472 |
|
10473 _WChoicePeer_select:nativeContext |
|
10474 |comboBox index| |
|
10475 |
|
10476 comboBox := self viewForWPeer:nativeContext. |
|
10477 |
|
10478 index := nativeContext argAt:1. |
|
10479 comboBox model selectionIndex:(index + 1). "/ JAVA indexing starts at 0 |
|
10480 |
|
10481 "Created: / 7.1.1998 / 21:45:43 / cg" |
|
10482 "Modified: / 25.1.1998 / 09:55:05 / cg" |
|
10483 ! |
|
10484 |
|
10485 _WClipboard_getClipboardText:nativeContext |
|
10486 "/ java.lang.String getClipboardText () |
|
10487 |
|
10488 |str| |
|
10489 |
|
10490 str := Screen current rootView getTextSelection. |
|
10491 str isNil ifTrue:[ |
|
10492 str := ''. |
|
10493 ]. |
|
10494 ^ Java as_String:''. |
|
10495 |
|
10496 "Modified: / 10.12.1998 / 21:28:29 / cg" |
|
10497 ! |
|
10498 |
|
10499 _WClipboard_init:nativeContext |
|
10500 "/ self halt. |
|
10501 |
|
10502 "Modified: / 18.3.1997 / 18:43:18 / cg" |
|
10503 "Created: / 4.1.1998 / 19:03:59 / cg" |
|
10504 ! |
|
10505 |
|
10506 _WClipboard_setClipboardText:nativeContext |
|
10507 "/ void setClipboardText (java.awt.datatransfer.StringSelection) |
|
10508 |
|
10509 |strSel data| |
|
10510 |
|
10511 strSel := nativeContext argAt:1. |
|
10512 data := strSel instVarNamed:'data'. |
|
10513 data class == (Java at:'java.lang.String') ifTrue:[ |
|
10514 Screen current rootView setTextSelection:(Java as_ST_String:data) |
|
10515 ]. |
|
10516 UnimplementedNativeMethodSignal raise |
|
10517 |
|
10518 "Created: / 12.11.1998 / 19:15:31 / cg" |
|
10519 "Modified: / 10.12.1998 / 21:25:20 / cg" |
|
10520 ! |
|
10521 |
|
10522 _WColor_getDefaultColor:nativeContext |
|
10523 |clrIndex jClr clr | |
|
10524 |
|
10525 clrIndex := nativeContext argAt:1. |
|
10526 "/ windows defaults: |
|
10527 "/ 1: view background |
|
10528 |
|
10529 clrIndex == 1 ifTrue:[ |
|
10530 clr := View defaultViewBackgroundColor. |
|
10531 clr isColor ifFalse:[ |
|
10532 clr := Color gray:50. |
|
10533 ]. |
|
10534 ]. |
|
10535 clrIndex == 2 ifTrue:[ |
|
10536 clr := Color black. |
|
10537 ]. |
|
10538 clr isNil ifTrue:[ |
|
10539 self halt. |
|
10540 self internalError:'breakpoint'. |
|
10541 ^ nil. |
|
10542 ]. |
|
10543 |
|
10544 clr := clr on:(Screen current). |
|
10545 |
|
10546 jClr := (Java classForName:'java.awt.Color') new. |
|
10547 |
|
10548 jClr instVarNamed:'pData' put:clr. |
|
10549 jClr instVarNamed:'value' put:(clr rgbValue). |
|
10550 "/ self halt. |
|
10551 ^ jClr. |
|
10552 |
|
10553 "Created: / 15.8.1997 / 15:38:10 / cg" |
|
10554 "Modified: / 4.1.1998 / 18:06:51 / cg" |
|
10555 ! |
|
10556 |
|
10557 _WComponentPeer__beginValidate:nativeContext |
|
10558 "/ void _beginValidate () |
|
10559 UnimplementedNativeMethodSignal raise |
|
10560 |
|
10561 "Created: / 12.11.1998 / 19:10:08 / cg" |
|
10562 ! |
|
10563 |
|
10564 _WComponentPeer__dispose:nativeContext |
|
10565 |view jPeer| |
|
10566 |
|
10567 view := self viewForWPeer:nativeContext. |
|
10568 |
|
10569 Object errorSignal catch:[ |
|
10570 view destroy. |
|
10571 ]. |
|
10572 JavaWindowGroup removeView:view. |
|
10573 |
|
10574 jPeer := nativeContext receiver. |
|
10575 jPeer instVarNamed:'pData' put:0. |
|
10576 |
|
10577 "Created: / 7.1.1998 / 22:36:25 / cg" |
|
10578 "Modified: / 25.1.1998 / 16:43:06 / cg" |
|
10579 ! |
|
10580 |
|
10581 _WComponentPeer__setBackground:nativeContext |
|
10582 |rgb clr view| |
|
10583 |
|
10584 view := self viewForWPeer:nativeContext. |
|
10585 view isNil ifTrue:[^ self]. |
|
10586 |
|
10587 rgb := nativeContext argAt:1. |
|
10588 clr := Color rgbValue:rgb. |
|
10589 |
|
10590 "/ self halt. |
|
10591 "/ self internalError:'breakPoint'. |
|
10592 |
|
10593 clr := clr on:(view device). |
|
10594 |
|
10595 "/ (view superView isMemberOf:JavaEmbeddedFrameView) ifTrue:[ |
|
10596 "/ view viewBackground:(view superView viewBackground). |
|
10597 "/ view backgroundPaint:(view superView viewBackground). |
|
10598 "/ ] ifFalse:[ |
|
10599 "/ (view isMemberOf:JavaView) ifTrue:[ |
|
10600 "/ view viewBackground:clr. |
|
10601 "/ view backgroundPaint:clr. |
|
10602 "/ ] |
|
10603 "/ ]. |
|
10604 |
|
10605 (view isKindOf:ScrollableView) ifTrue:[ |
|
10606 view := view scrolledView |
|
10607 ]. |
|
10608 view viewBackground:clr. |
|
10609 view backgroundPaint:clr. |
|
10610 |
|
10611 "Created: / 4.1.1998 / 18:07:39 / cg" |
|
10612 "Modified: / 4.12.1998 / 17:26:06 / cg" |
|
10613 ! |
|
10614 |
|
10615 _WComponentPeer__setForeground:nativeContext |
|
10616 |rgb clr view| |
|
10617 |
|
10618 view := self viewForWPeer:nativeContext. |
|
10619 |
|
10620 rgb := nativeContext argAt:1. |
|
10621 clr := Color rgbValue:rgb. |
|
10622 |
|
10623 "/ self halt. |
|
10624 "/ self internalError:'breakPoint'. |
|
10625 |
|
10626 clr := clr on:(view device). |
|
10627 |
|
10628 view paint:clr. |
|
10629 |
|
10630 "Created: / 4.1.1998 / 18:08:13 / cg" |
|
10631 "Modified: / 8.1.1998 / 17:32:45 / cg" |
|
10632 ! |
|
10633 |
|
10634 _WComponentPeer_disable:nativeContext |
|
10635 |view| |
|
10636 |
|
10637 view := self viewForWPeer:nativeContext. |
|
10638 |
|
10639 Object errorSignal handle:[:ex | |
|
10640 ] do:[ |
|
10641 view disable |
|
10642 ] |
|
10643 |
|
10644 "Created: / 6.1.1998 / 18:26:36 / cg" |
|
10645 "Modified: / 8.1.1998 / 17:32:53 / cg" |
|
10646 ! |
|
10647 |
|
10648 _WComponentPeer_enable:nativeContext |
|
10649 |view| |
|
10650 |
|
10651 view := self viewForWPeer:nativeContext. |
|
10652 |
|
10653 Object errorSignal handle:[:ex | |
|
10654 ] do:[ |
|
10655 view enable |
|
10656 ] |
|
10657 |
|
10658 "Modified: / 8.1.1998 / 17:32:53 / cg" |
|
10659 "Created: / 13.1.1998 / 23:08:05 / cg" |
|
10660 ! |
|
10661 |
|
10662 _WComponentPeer_endValidate:nativeContext |
|
10663 "/ void endValidate () |
|
10664 UnimplementedNativeMethodSignal raise |
|
10665 |
|
10666 "Created: / 12.11.1998 / 19:10:20 / cg" |
|
10667 ! |
|
10668 |
|
10669 _WComponentPeer_getLocationOnScreen:nativeContext |
|
10670 "/ java.awt.Point getLocationOnScreen () |
|
10671 |
|
10672 |view p jP| |
|
10673 |
|
10674 view := self viewForWPeer:nativeContext. |
|
10675 view isNil ifTrue:[^ nil]. |
|
10676 |
|
10677 p := view originRelativeTo:nil. |
|
10678 jP := (Java classForName:'java.awt.Point') basicNew. |
|
10679 jP instVarNamed:'x' put:p x. |
|
10680 jP instVarNamed:'y' put:p y. |
|
10681 ^ jP |
|
10682 |
|
10683 "Modified: / 5.12.1998 / 14:44:31 / cg" |
|
10684 ! |
|
10685 |
|
10686 _WComponentPeer_handleEvent:nativeContext |
|
10687 "this is invoked by java, to let a widget handle any event which |
|
10688 was not consumed (eaten) by java. |
|
10689 If the view in question is some ST-widget, forward it. |
|
10690 Ignore for JavaViews." |
|
10691 |
|
10692 |view jEv stEv ignore| |
|
10693 |
|
10694 view := self viewForWPeer:nativeContext. |
|
10695 view notNil ifTrue:[ |
|
10696 jEv := nativeContext argAt:1. |
|
10697 stEv := jEv instVarNamed:'data'. |
|
10698 (stEv notNil and:[stEv ~~ 0]) ifTrue:[ |
|
10699 ignore := true. |
|
10700 view isJavaView ifFalse:[ |
|
10701 ignore := false |
|
10702 ] ifTrue:[ |
|
10703 view isTopView ifTrue:[ |
|
10704 stEv type == #terminate ifTrue:[ |
|
10705 ignore := false |
|
10706 ]. |
|
10707 ] |
|
10708 ]. |
|
10709 |
|
10710 ignore ifFalse:[ |
|
10711 EventTrace == true ifTrue:[ |
|
10712 ('JAVA: WComponent - handleEvent: ' , stEv type , ' for ' , view printString) infoPrintCR. |
|
10713 ]. |
|
10714 view dispatchEvent:stEv. |
|
10715 ^ self. |
|
10716 ]. |
|
10717 |
|
10718 EventTrace == true ifTrue:[ |
|
10719 ('JAVA: WComponent - handleEvent ignored:' , stEv type) infoPrintCR. |
|
10720 ]. |
|
10721 ^ self |
|
10722 ] |
|
10723 ]. |
|
10724 EventTrace == true ifTrue:[ |
|
10725 ('JAVA: WComponent - handleEvent ignored') infoPrintCR. |
|
10726 ] |
|
10727 |
|
10728 "Created: / 6.1.1998 / 21:10:17 / cg" |
|
10729 "Modified: / 11.12.1998 / 01:04:14 / cg" |
|
10730 ! |
|
10731 |
|
10732 _WComponentPeer_hide:nativeContext |
|
10733 |view| |
|
10734 |
|
10735 view := self viewForWPeer:nativeContext. |
|
10736 "/ view isPopUpView ifTrue:[self halt]. |
|
10737 |
|
10738 Object errorSignal handle:[:ex | |
|
10739 ] do:[ |
|
10740 view beInvisible |
|
10741 ] |
|
10742 |
|
10743 "Created: / 7.1.1998 / 22:35:32 / cg" |
|
10744 "Modified: / 4.12.1998 / 17:53:41 / cg" |
|
10745 ! |
|
10746 |
|
10747 _WComponentPeer_nativeHandleEvent:nativeContext |
|
10748 "this is invoked by java, to let a widget handle any event which |
|
10749 was not consumed (eaten) by java. |
|
10750 If the view in question is some ST-widget, forward it. |
|
10751 Ignore for JavaViews." |
|
10752 |
|
10753 |view jEv stEv| |
|
10754 |
|
10755 ^self. |
|
10756 view := self viewForWPeer:nativeContext. |
|
10757 view notNil ifTrue:[ |
|
10758 (view isKindOf:JavaView) ifFalse:[ |
|
10759 jEv := nativeContext argAt:1. |
|
10760 stEv := jEv instVarNamed:'data'. |
|
10761 (stEv notNil and:[stEv ~~ 0]) ifTrue:[ |
|
10762 EventTrace == true ifTrue:[ |
|
10763 ('JAVA: WComponent - handleEvent: ' , stEv type , ' for ' , view printString) infoPrintCR. |
|
10764 ]. |
|
10765 stEv sendEventWithFocusOn:nil. |
|
10766 ^ self. |
|
10767 ] |
|
10768 ] |
|
10769 ]. |
|
10770 EventTrace == true ifTrue:[ |
|
10771 ('JAVA: WComponent - handleEvent ignored') infoPrintCR. |
|
10772 ] |
|
10773 |
|
10774 "Created: / 19.10.1998 / 21:26:16 / cg" |
|
10775 "Modified: / 19.10.1998 / 23:26:37 / cg" |
|
10776 ! |
|
10777 |
|
10778 _WComponentPeer_requestFocus:nativeContext |
|
10779 |view| |
|
10780 |
|
10781 view := self viewForWPeer:nativeContext. |
|
10782 "/ 'getFocus - ' print. view displayString printCR. |
|
10783 |
|
10784 "/ view getKeyboardFocus |
|
10785 |
|
10786 "Created: / 7.1.1998 / 22:30:03 / cg" |
|
10787 "Modified: / 4.12.1998 / 19:42:18 / cg" |
|
10788 ! |
|
10789 |
|
10790 _WComponentPeer_reshape:nativeContext |
|
10791 self commonReshapeComponent:nativeContext |
|
10792 |
|
10793 "Modified: / 18.3.1997 / 19:30:21 / cg" |
|
10794 "Created: / 4.1.1998 / 18:01:11 / cg" |
|
10795 ! |
|
10796 |
|
10797 _WComponentPeer_setBackground:nativeContext |
|
10798 |jClr rgb clr view| |
|
10799 |
|
10800 view := self viewForWPeer:nativeContext. |
|
10801 |
|
10802 jClr := nativeContext argAt:1. |
|
10803 rgb := jClr instVarNamed:'value'. |
|
10804 "/ self halt. |
|
10805 clr := Color rgbValue:rgb. |
|
10806 |
|
10807 |
|
10808 clr := clr on:(view device). |
|
10809 |
|
10810 "/ (view superView isMemberOf:JavaEmbeddedFrameView) ifTrue:[ |
|
10811 "/ view viewBackground:(view superView viewBackground). |
|
10812 "/ view backgroundPaint:(view superView viewBackground). |
|
10813 "/ ] ifFalse:[ |
|
10814 "/ (view isMemberOf:JavaView) ifTrue:[ |
|
10815 "/ view viewBackground:clr. |
|
10816 "/ view backgroundPaint:clr. |
|
10817 "/ ] |
|
10818 "/ ]. |
|
10819 |
|
10820 (view isKindOf:ScrollableView) ifTrue:[ |
|
10821 view := view scrolledView |
|
10822 ]. |
|
10823 view viewBackground:clr. |
|
10824 view backgroundPaint:clr. |
|
10825 |
|
10826 "Created: / 16.10.1998 / 02:16:31 / cg" |
|
10827 "Modified: / 16.10.1998 / 02:26:29 / cg" |
|
10828 ! |
|
10829 |
|
10830 _WComponentPeer_setCursor:nativeContext |
|
10831 |view| |
|
10832 |
|
10833 view := self viewForWPeer:nativeContext. |
|
10834 "/ self halt. |
|
10835 |
|
10836 "Created: / 5.1.1998 / 01:52:30 / cg" |
|
10837 "Modified: / 25.1.1998 / 01:21:52 / cg" |
|
10838 ! |
|
10839 |
|
10840 _WComponentPeer_setFont:nativeContext |
|
10841 |view| |
|
10842 |
|
10843 view := self viewForWPeer:nativeContext. |
|
10844 "/ self halt. |
|
10845 |
|
10846 "Created: / 5.1.1998 / 00:55:17 / cg" |
|
10847 "Modified: / 25.1.1998 / 01:22:19 / cg" |
|
10848 ! |
|
10849 |
|
10850 _WComponentPeer_setForeground:nativeContext |
|
10851 |jClr rgb clr view| |
|
10852 |
|
10853 view := self viewForWPeer:nativeContext. |
|
10854 |
|
10855 jClr := nativeContext argAt:1. |
|
10856 rgb := jClr instVarNamed:'value'. |
|
10857 "/ self halt. |
|
10858 clr := Color rgbValue:rgb. |
|
10859 |
|
10860 |
|
10861 clr := clr on:(view device). |
|
10862 |
|
10863 (view isKindOf:ScrollableView) ifTrue:[ |
|
10864 view := view scrolledView |
|
10865 ]. |
|
10866 view paint:clr. |
|
10867 |
|
10868 "Created: / 16.10.1998 / 02:18:58 / cg" |
|
10869 "Modified: / 16.10.1998 / 02:26:37 / cg" |
|
10870 ! |
|
10871 |
|
10872 _WComponentPeer_setZOrderPosition:nativeContext |
|
10873 |view| |
|
10874 |
|
10875 view := self viewForWPeer:nativeContext. |
|
10876 "/ self unimplementedNativeMethod. |
|
10877 "/ self halt. |
|
10878 "/ self internalError:'breakPoint' |
|
10879 |
|
10880 "Created: / 4.1.1998 / 17:59:26 / cg" |
|
10881 "Modified: / 25.1.1998 / 01:22:32 / cg" |
|
10882 ! |
|
10883 |
|
10884 _WComponentPeer_show:nativeContext |
|
10885 |view| |
|
10886 |
|
10887 view := self viewForWPeer:nativeContext. |
|
10888 |
|
10889 "/ frame views are under my browsers own control |
|
10890 (view isMemberOf:JavaEmbeddedFrameView) ifFalse:[ |
|
10891 view beVisible. |
|
10892 view realize. |
|
10893 ]. |
|
10894 |
|
10895 "/ view windowGroup notNil ifTrue:[ |
|
10896 "/ windowServer addGroup:(view windowGroup) |
|
10897 "/ ]. |
|
10898 |
|
10899 ^ nil |
|
10900 |
|
10901 "/ self halt. |
|
10902 |
|
10903 "Created: / 5.1.1998 / 01:26:22 / cg" |
|
10904 "Modified: / 4.12.1998 / 17:43:53 / cg" |
|
10905 ! |
|
10906 |
|
10907 _WComponentPeer_start:nativeContext |
|
10908 "/ self halt. |
|
10909 |
|
10910 "Modified: / 18.3.1997 / 18:43:18 / cg" |
|
10911 "Created: / 5.1.1998 / 00:58:40 / cg" |
|
10912 ! |
|
10913 |
|
10914 _WContainerPeer_calculateInsets:nativeContext |
|
10915 "/ new with ns4.0 ... |
|
10916 |
|
10917 "Created: / 16.10.1998 / 02:12:59 / cg" |
|
10918 ! |
|
10919 |
|
10920 _WDefaultFontCharset_canConvert:nativeContext |
|
10921 ^ 1 |
|
10922 |
|
10923 "Modified: / 21.8.1997 / 15:56:57 / cg" |
|
10924 "Created: / 5.1.1998 / 01:55:47 / cg" |
|
10925 ! |
|
10926 |
|
10927 _WDialogPeer__hide:nativeContext |
|
10928 |dialog| |
|
10929 |
|
10930 dialog := self viewForWPeer:nativeContext. |
|
10931 |
|
10932 dialog hide. |
|
10933 |
|
10934 "Created: / 7.1.1998 / 22:34:10 / cg" |
|
10935 "Modified: / 8.1.1998 / 17:34:10 / cg" |
|
10936 ! |
|
10937 |
|
10938 _WDialogPeer__show:nativeContext |
|
10939 |dialog| |
|
10940 |
|
10941 dialog := self viewForWPeer:nativeContext. |
|
10942 "/ |
|
10943 "/ show does not work (yet); must setup windowgroup |
|
10944 "/ for it to get events ... |
|
10945 "/ dialog realize. |
|
10946 |
|
10947 dialog show. |
|
10948 "/dialog fixSize. |
|
10949 "/dialog makeFullyVisible. |
|
10950 "/dialog openModal:[true] inGroup:JavaWindowGroup |
|
10951 |
|
10952 "Created: / 7.1.1998 / 21:52:15 / cg" |
|
10953 "Modified: / 11.12.1998 / 14:43:05 / cg" |
|
10954 ! |
|
10955 |
|
10956 _WDialogPeer_create:nativeContext |
|
10957 |jDialogPeer dialog| |
|
10958 |
|
10959 jDialogPeer := nativeContext receiver. |
|
10960 |
|
10961 dialog := ModalBox new. |
|
10962 jDialogPeer instVarNamed:'pData' put:dialog. |
|
10963 |
|
10964 self createdWindowsView:dialog for:jDialogPeer. |
|
10965 dialog windowGroup:JavaWindowGroup. |
|
10966 JavaWindowGroup addTopView:dialog. |
|
10967 |
|
10968 WindowCreationTrace == true ifTrue:[ |
|
10969 'WDialogPeer_create: ' print. dialog printNL. |
|
10970 ]. |
|
10971 |
|
10972 "Created: / 7.1.1998 / 21:51:00 / cg" |
|
10973 "Modified: / 15.1.1998 / 16:12:44 / cg" |
|
10974 ! |
|
10975 |
|
10976 _WDrawingSurfaceInfo_getDepth:nativeContext |
|
10977 "/ int getDepth () |
|
10978 UnimplementedNativeMethodSignal raise |
|
10979 |
|
10980 "Created: / 12.11.1998 / 19:21:00 / cg" |
|
10981 ! |
|
10982 |
|
10983 _WDrawingSurfaceInfo_getHBitmap:nativeContext |
|
10984 "/ int getHBitmap () |
|
10985 UnimplementedNativeMethodSignal raise |
|
10986 |
|
10987 "Created: / 12.11.1998 / 19:20:32 / cg" |
|
10988 ! |
|
10989 |
|
10990 _WDrawingSurfaceInfo_getHDC:nativeContext |
|
10991 "/ int getHDC () |
|
10992 UnimplementedNativeMethodSignal raise |
|
10993 |
|
10994 "Created: / 12.11.1998 / 19:20:50 / cg" |
|
10995 ! |
|
10996 |
|
10997 _WDrawingSurfaceInfo_getHPalette:nativeContext |
|
10998 "/ int getHPalette () |
|
10999 UnimplementedNativeMethodSignal raise |
|
11000 |
|
11001 "Created: / 12.11.1998 / 19:21:07 / cg" |
|
11002 ! |
|
11003 |
|
11004 _WDrawingSurfaceInfo_getHWnd:nativeContext |
|
11005 "/ int getHWnd () |
|
11006 UnimplementedNativeMethodSignal raise |
|
11007 |
|
11008 "Created: / 12.11.1998 / 19:20:23 / cg" |
|
11009 ! |
|
11010 |
|
11011 _WDrawingSurfaceInfo_getPBits:nativeContext |
|
11012 "/ int getPBits () |
|
11013 UnimplementedNativeMethodSignal raise |
|
11014 |
|
11015 "Created: / 12.11.1998 / 19:20:41 / cg" |
|
11016 ! |
|
11017 |
|
11018 _WDrawingSurfaceInfo_lock:nativeContext |
|
11019 "/ int lock () |
|
11020 UnimplementedNativeMethodSignal raise |
|
11021 |
|
11022 "Created: / 12.11.1998 / 19:20:00 / cg" |
|
11023 ! |
|
11024 |
|
11025 _WDrawingSurfaceInfo_unlock:nativeContext |
|
11026 "/ void unlock () |
|
11027 UnimplementedNativeMethodSignal raise |
|
11028 |
|
11029 "Created: / 12.11.1998 / 19:20:13 / cg" |
|
11030 ! |
|
11031 |
|
11032 _WEmbeddedFramePeer_create:nativeContext |
|
11033 "/ void create (sun.awt.windows.WComponentPeer) |
|
11034 UnimplementedNativeMethodSignal raise |
|
11035 |
|
11036 "Created: / 12.11.1998 / 19:16:09 / cg" |
|
11037 ! |
|
11038 |
|
11039 _WFileDialogPeer_show:nativeContext |
|
11040 |jDialogPeer jDialog dialogView stDialog |
|
11041 title dir pattern f| |
|
11042 |
|
11043 jDialogPeer := nativeContext receiver. |
|
11044 jDialog := jDialogPeer instVarNamed:'target'. |
|
11045 dialogView := jDialogPeer instVarNamed:'pData'. |
|
11046 |
|
11047 stDialog := FileSelectionBox new. |
|
11048 |
|
11049 dir := jDialog instVarNamed:'dir'. |
|
11050 dir notNil ifTrue:[ |
|
11051 stDialog directory:(Java as_ST_String:dir). |
|
11052 ]. |
|
11053 pattern := jDialog instVarNamed:'file'. |
|
11054 pattern notNil ifTrue:[ |
|
11055 stDialog pattern:(Java as_ST_String:pattern). |
|
11056 ]. |
|
11057 title := jDialog instVarNamed:'title'. |
|
11058 title notNil ifTrue:[ |
|
11059 stDialog title:(Java as_ST_String:title). |
|
11060 stDialog label:(Java as_ST_String:title). |
|
11061 ]. |
|
11062 |
|
11063 stDialog show. |
|
11064 |
|
11065 stDialog accepted ifTrue:[ |
|
11066 f := stDialog pathName. |
|
11067 |
|
11068 "/ cannot use the one below - it has a builtIn fileSeparator if '\' (sigh) |
|
11069 "/ jDialogPeer perform:#'handleSelected(Ljava/lang/String;)V' with:(Java as_String:f). |
|
11070 |
|
11071 jDialog |
|
11072 perform:#'setFile(Ljava/lang/String;)V' |
|
11073 with:(Java as_String:(f asFilename baseName)). |
|
11074 jDialog |
|
11075 perform:#'setDirectory(Ljava/lang/String;)V' |
|
11076 with:(Java as_String:(f asFilename directoryName , Filename separator asString)). |
|
11077 jDialog |
|
11078 perform:#'setVisible(Z)V' |
|
11079 with:0. |
|
11080 ] ifFalse:[ |
|
11081 jDialogPeer |
|
11082 perform:#'handleCancel()V' |
|
11083 ]. |
|
11084 "/ self halt. |
|
11085 |
|
11086 "Created: / 7.1.1998 / 22:38:45 / cg" |
|
11087 "Modified: / 15.1.1998 / 13:04:05 / cg" |
|
11088 ! |
|
11089 |
|
11090 _WFontMetrics_bytesWidth:nativeContext |
|
11091 "/ int bytesWidth (byte[] int int) |
|
11092 UnimplementedNativeMethodSignal raise |
|
11093 |
|
11094 "Created: / 12.11.1998 / 19:11:46 / cg" |
|
11095 ! |
|
11096 |
|
11097 _WFontMetrics_getMFCharSegmentWidth:nativeContext |
|
11098 "get multi-font string-segment width. |
|
11099 Not yet supported - use standard strings width" |
|
11100 |
|
11101 |jMetrics jFont jFontDescr stFont w |
|
11102 bool1 cp offs lenght bp int1| |
|
11103 |
|
11104 jMetrics := nativeContext receiver. |
|
11105 jFont := nativeContext argAt:1. |
|
11106 jFontDescr := nativeContext argAt:2. |
|
11107 bool1 := nativeContext argAt:3. |
|
11108 cp := nativeContext argAt:4. |
|
11109 offs := nativeContext argAt:5. |
|
11110 lenght := nativeContext argAt:6. |
|
11111 bp := nativeContext argAt:7. |
|
11112 int1 := nativeContext argAt:8. |
|
11113 |
|
11114 stFont := jFont instVarNamed:'pData'. |
|
11115 (stFont isNil or:[stFont == 0]) ifTrue:[ |
|
11116 self halt |
|
11117 ]. |
|
11118 |
|
11119 stFont device isNil ifTrue:[ |
|
11120 stFont := stFont on:Display. |
|
11121 jFont instVarNamed:'pData' put:stFont. |
|
11122 ]. |
|
11123 w := stFont widthOf:cp from:offs+1 to:offs+lenght. |
|
11124 ^ w. |
|
11125 |
|
11126 "Created: / 5.1.1998 / 01:57:45 / cg" |
|
11127 "Modified: / 13.1.1998 / 23:44:03 / cg" |
|
11128 ! |
|
11129 |
|
11130 _WFontMetrics_init:nativeContext |
|
11131 |jMetrics jFont stFont widths family name style size| |
|
11132 |
|
11133 jMetrics := nativeContext receiver. |
|
11134 jFont := jMetrics instVarNamed:'font'. |
|
11135 |
|
11136 family := jFont instVarNamed:'family'. |
|
11137 family := Java as_ST_String:family. |
|
11138 |
|
11139 name := jFont instVarNamed:'name'. |
|
11140 name := Java as_ST_String:name. |
|
11141 |
|
11142 style := jFont instVarNamed:'style'. |
|
11143 size := jFont instVarNamed:'size'. |
|
11144 |
|
11145 stFont := Font family:family size:size. |
|
11146 stFont isNil ifTrue:[ |
|
11147 stFont := Font family:'helvetica' size:size. |
|
11148 ]. |
|
11149 stFont := stFont on:Display. |
|
11150 self halt. |
|
11151 "/ stFont := jFont instVarNamed:'pData'. |
|
11152 "/ stFont isNil ifTrue:[ |
|
11153 "/ self halt |
|
11154 "/ ]. |
|
11155 |
|
11156 stFont := stFont on:Display. |
|
11157 jFont instVarNamed:'pData' put:stFont. |
|
11158 |
|
11159 jMetrics instVarNamed:'ascent' put:stFont ascent. |
|
11160 jMetrics instVarNamed:'descent' put:stFont descent. |
|
11161 jMetrics instVarNamed:'leading' put:0. |
|
11162 jMetrics instVarNamed:'height' put:stFont height. |
|
11163 jMetrics instVarNamed:'maxAscent' put:stFont maxAscent. |
|
11164 jMetrics instVarNamed:'maxDescent' put:stFont maxDescent. |
|
11165 jMetrics instVarNamed:'maxHeight' put:stFont maxHeight. |
|
11166 jMetrics instVarNamed:'maxAdvance' put:stFont maxWidth. |
|
11167 |
|
11168 widths := Array new:256. |
|
11169 0 to:255 do:[:i | |
|
11170 widths at:(i+1) put:(stFont widthOf:(Character value:i)) |
|
11171 ]. |
|
11172 jMetrics instVarNamed:'widths' put:widths. |
|
11173 "/ self halt. |
|
11174 |
|
11175 "Modified: / 8.8.1997 / 12:06:53 / cg" |
|
11176 "Created: / 5.1.1998 / 01:54:29 / cg" |
|
11177 ! |
|
11178 |
|
11179 _WFontMetrics_needsConversion:nativeContext |
|
11180 |jFont jFontDescr stFont| |
|
11181 |
|
11182 jFont := nativeContext argAt:1. |
|
11183 jFontDescr := nativeContext argAt:2. |
|
11184 |
|
11185 stFont := jFont instVarNamed:'pData'. |
|
11186 "/ stFont isNil ifTrue:[ |
|
11187 "/ self halt |
|
11188 "/ ]. |
|
11189 "/ stFont device isNil ifTrue:[ |
|
11190 "/ stFont := stFont on:Display. |
|
11191 "/ jFont instVarNamed:'pData' put:stFont. |
|
11192 "/ ]. |
|
11193 "/ |
|
11194 |
|
11195 ^ 0 |
|
11196 |
|
11197 "Modified: / 17.8.1997 / 17:16:29 / cg" |
|
11198 "Created: / 5.1.1998 / 01:56:42 / cg" |
|
11199 ! |
|
11200 |
|
11201 _WFramePeer__setIconImage:nativeContext |
|
11202 |frame imgRep image| |
|
11203 |
|
11204 frame := self viewForWPeer:nativeContext. |
|
11205 imgRep := nativeContext argAt:1. |
|
11206 imgRep notNil ifTrue:[ |
|
11207 image := imgRep instVarNamed:'pData'. |
|
11208 (image notNil and:[image ~~ 0]) ifTrue:[ |
|
11209 frame icon:image. |
|
11210 ] |
|
11211 ]. |
|
11212 |
|
11213 "Created: / 27.4.1998 / 17:15:09 / cg" |
|
11214 "Modified: / 27.4.1998 / 17:18:24 / cg" |
|
11215 ! |
|
11216 |
|
11217 _WFramePeer_create:nativeContext |
|
11218 |jFramePeer jFrame top frame pDataIdx| |
|
11219 |
|
11220 jFramePeer := nativeContext receiver. |
|
11221 |
|
11222 "/ for now: a kludge to create an embedded frame for |
|
11223 "/ mozillaFrames |
|
11224 |
|
11225 jFrame := jFramePeer instVarNamed:'target'. |
|
11226 (jFrame notNil |
|
11227 and:[(pDataIdx := jFrame class instVarOffsetOf:'pData') notNil]) |
|
11228 ifTrue:[ |
|
11229 ((frame := jFrame instVarAt:pDataIdx) notNil |
|
11230 and:[frame ~~ 0]) ifTrue:[ |
|
11231 WindowCreationTrace == true ifTrue:[ |
|
11232 'JAVA: targetFrame view already created: ' infoPrintCR. |
|
11233 ]. |
|
11234 "/ sigh; pData was renamed to pNativeWidget in jdk1.2 ... |
|
11235 pDataIdx := jFramePeer class instVarOffsetOf:'pNativeWidget'. |
|
11236 pDataIdx isNil ifTrue:[ |
|
11237 "/ ok, we are < 1.2 |
|
11238 pDataIdx := jFramePeer class instVarOffsetOf:'pData'. |
|
11239 ]. |
|
11240 jFramePeer instVarAt:pDataIdx put:frame. |
|
11241 ] |
|
11242 ] ifFalse:[ |
|
11243 frame := jFramePeer instVarNamed:'pData' |
|
11244 ]. |
|
11245 |
|
11246 (frame notNil and:[frame ~~ 0]) ifTrue:[ |
|
11247 WindowCreationTrace == true ifTrue:[ |
|
11248 'JAVA: frame view already created: ' infoPrint. |
|
11249 jFramePeer class name infoPrintCR. |
|
11250 ]. |
|
11251 ] ifFalse:[ |
|
11252 "/ OLD |
|
11253 "/ frame := StandardSystemView new. |
|
11254 "/ self createdWindowsView:frame for:jFramePeer. |
|
11255 "/ JavaWindowGroup addTopView:frame. |
|
11256 |
|
11257 frame := JavaTopView new. |
|
11258 frame delegate:self. |
|
11259 frame javaPeer:jFramePeer. |
|
11260 self createdWindowsView:frame for:jFramePeer. |
|
11261 JavaWindowGroup addTopView:frame. |
|
11262 |
|
11263 "/ top := StandardSystemView new. |
|
11264 "/ frame := JavaView origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
11265 "/ frame delegate:self. |
|
11266 "/ frame javaPeer:jFramePeer. |
|
11267 "/ self createdWindowsView:frame for:jFramePeer. |
|
11268 "/ JavaWindowGroup addTopView:top. |
|
11269 |
|
11270 ]. |
|
11271 |
|
11272 WindowCreationTrace == true ifTrue:[ |
|
11273 'JAVA: WFramePeer_create: ' print. jFramePeer displayString print. |
|
11274 ' frame: ' print. frame printNL. |
|
11275 ]. |
|
11276 |
|
11277 "Created: / 4.1.1998 / 17:56:39 / cg" |
|
11278 "Modified: / 3.12.1998 / 00:10:21 / cg" |
|
11279 ! |
|
11280 |
|
11281 _WFramePeer_setMenuBar0:nativeContext |
|
11282 |frame jMenuBarPeer menuPanel| |
|
11283 |
|
11284 frame := self viewForWPeer:nativeContext. |
|
11285 |
|
11286 jMenuBarPeer := nativeContext argAt:1. |
|
11287 jMenuBarPeer isNil ifTrue:[ |
|
11288 "/ mhmh - JAVA wants to remove the frames menuPanel. |
|
11289 "/ but I have no handle on it (for destroy). |
|
11290 "/ search it in subViews of the frame. |
|
11291 frame subViews copy do:[:v | |
|
11292 (v isKindOf:MenuPanel) ifTrue:[ |
|
11293 v destroy |
|
11294 ] |
|
11295 ] |
|
11296 ] ifFalse:[ |
|
11297 menuPanel := jMenuBarPeer instVarNamed:'pData'. |
|
11298 |
|
11299 menuPanel origin:0.0@0.0 corner:1.0@(menuPanel preferredExtent y). |
|
11300 frame addSubView:menuPanel. |
|
11301 ]. |
|
11302 ^ nil |
|
11303 |
|
11304 "Created: / 7.1.1998 / 21:41:35 / cg" |
|
11305 "Modified: / 8.1.1998 / 17:35:04 / cg" |
|
11306 ! |
|
11307 |
|
11308 _WFramePeer_setResizable:nativeContext |
|
11309 |view onOff| |
|
11310 |
|
11311 view := self viewForWPeer:nativeContext. |
|
11312 |
|
11313 onOff := (nativeContext argAt:1) == 1. |
|
11314 view isTopView ifTrue:[ |
|
11315 onOff ifTrue:[ |
|
11316 view minExtent:10@10. |
|
11317 view maxExtent:(Screen current extent). |
|
11318 ] ifFalse:[ |
|
11319 view minExtent:view extent. |
|
11320 view maxExtent:view extent. |
|
11321 ] |
|
11322 ] ifFalse:[ |
|
11323 (view isMemberOf:JavaEmbeddedFrameView) ifFalse:[ |
|
11324 self halt. |
|
11325 ] |
|
11326 ]. |
|
11327 |
|
11328 "/ 'JAVA: WWindowPeer_setResizable: ' print. view print. ' yes/no: ' print. onOff printNL. |
|
11329 |
|
11330 ^ nil |
|
11331 |
|
11332 "Modified: / 16.1.1998 / 18:08:00 / cg" |
|
11333 "Created: / 16.10.1998 / 02:21:34 / cg" |
|
11334 ! |
|
11335 |
|
11336 _WFramePeer_setTitle:nativeContext |
|
11337 |view jString string| |
|
11338 |
|
11339 view := self viewForWPeer:nativeContext. |
|
11340 |
|
11341 jString := nativeContext argAt:1. |
|
11342 string := Java as_ST_String:jString. |
|
11343 |
|
11344 "/ 'JAVA: WFramePeer_pSetTitle: ' print. string print. ' ' print. view printNL. |
|
11345 |
|
11346 view label:string. |
|
11347 ^ nil |
|
11348 |
|
11349 "Modified: / 8.1.1998 / 17:37:41 / cg" |
|
11350 "Created: / 27.1.1998 / 21:42:57 / cg" |
|
11351 ! |
|
11352 |
|
11353 _WGraphics__dispose:nativeContext |
|
11354 "/ void _dispose() |
|
11355 UnimplementedNativeMethodSignal raise |
|
11356 |
|
11357 "Created: / 12.11.1998 / 19:17:51 / cg" |
|
11358 ! |
|
11359 |
|
11360 _WGraphics_changeClip:nativeContext |
|
11361 |gc x y w h r bool| |
|
11362 |
|
11363 gc := self gcForWGraphics:nativeContext. |
|
11364 |
|
11365 x := nativeContext argAt:1. |
|
11366 y := nativeContext argAt:2. |
|
11367 w := nativeContext argAt:3. |
|
11368 h := nativeContext argAt:4. |
|
11369 bool := (nativeContext argAt:5) ~~ 0. |
|
11370 |
|
11371 r := Rectangle left:x top:y width:w height:h. |
|
11372 "/ 'WGraphics_changeClip: ' infoPrint. r infoPrintCR. |
|
11373 gc clippingRectangle:r. |
|
11374 |
|
11375 "Created: / 6.1.1998 / 20:57:21 / cg" |
|
11376 "Modified: / 20.10.1998 / 19:40:10 / cg" |
|
11377 ! |
|
11378 |
|
11379 _WGraphics_clearRect:nativeContext |
|
11380 |gc x y w h| |
|
11381 |
|
11382 gc := self gcForWGraphics:nativeContext. |
|
11383 "/ gc isNil ifTrue:[^ self]. |
|
11384 |
|
11385 gc realized ifFalse:[ |
|
11386 'JAVA: drawing on unrealized gc - ignored' infoPrintCR. |
|
11387 ^ self |
|
11388 ]. |
|
11389 |
|
11390 x := nativeContext argAt:1. |
|
11391 y := nativeContext argAt:2. |
|
11392 w := nativeContext argAt:3. |
|
11393 h := nativeContext argAt:4. |
|
11394 |
|
11395 "/ self halt. |
|
11396 "/ self internalError:'breakPoint'. |
|
11397 |
|
11398 gc clearRectangleX:x y:y width:w height:h. |
|
11399 |
|
11400 "Created: / 8.1.1998 / 00:16:00 / cg" |
|
11401 "Modified: / 8.1.1998 / 00:21:09 / cg" |
|
11402 ! |
|
11403 |
|
11404 _WGraphics_close:nativeContext |
|
11405 "/ void close (sun.awt.windows.WPrintJob) |
|
11406 UnimplementedNativeMethodSignal raise |
|
11407 |
|
11408 "Created: / 12.11.1998 / 19:19:40 / cg" |
|
11409 ! |
|
11410 |
|
11411 _WGraphics_copyArea:nativeContext |
|
11412 |gc srcX srcY w h deltaX deltaY| |
|
11413 |
|
11414 gc := self gcForWGraphics:nativeContext. |
|
11415 "/ gc isNil ifTrue:[^ self]. |
|
11416 |
|
11417 gc realized ifFalse:[ |
|
11418 'JAVA: copyArea on unrealized gc - ignored' infoPrintCR. |
|
11419 ^ self |
|
11420 ]. |
|
11421 |
|
11422 srcX := nativeContext argAt:1. |
|
11423 srcY := nativeContext argAt:2. |
|
11424 w := nativeContext argAt:3. |
|
11425 h := nativeContext argAt:4. |
|
11426 deltaX := nativeContext argAt:5. |
|
11427 deltaY := nativeContext argAt:6. |
|
11428 |
|
11429 gc |
|
11430 copyFrom:gc |
|
11431 x:srcX y:srcY |
|
11432 toX:srcX+deltaX y:srcY+deltaY |
|
11433 width:w height:h |
|
11434 |
|
11435 "Created: / 8.1.1998 / 00:16:00 / cg" |
|
11436 "Modified: / 9.4.1998 / 22:01:32 / cg" |
|
11437 ! |
|
11438 |
|
11439 _WGraphics_createFromComponent:nativeContext |
|
11440 |jGraphics jWin view| |
|
11441 |
|
11442 jGraphics := nativeContext receiver. |
|
11443 jWin := nativeContext argAt:1. |
|
11444 |
|
11445 view := KnownWindows at:jWin ifAbsent:nil. |
|
11446 view isNil ifTrue:[ |
|
11447 self halt. |
|
11448 ^ self |
|
11449 ]. |
|
11450 view clippingRectangle:nil. |
|
11451 |
|
11452 "/ "/ just a consistency check ... |
|
11453 "/ (jWin instVarNamed:'xid') ~~ view ifTrue:[ |
|
11454 "/ self halt:'consistency check' |
|
11455 "/ ]. |
|
11456 |
|
11457 jGraphics instVarNamed:'pData' put:view. |
|
11458 |
|
11459 "Created: / 6.1.1998 / 20:55:18 / cg" |
|
11460 "Modified: / 20.10.1998 / 19:38:18 / cg" |
|
11461 ! |
|
11462 |
|
11463 _WGraphics_createFromGraphics:nativeContext |
|
11464 |jGraphics graphics gc| |
|
11465 |
|
11466 jGraphics := nativeContext receiver. |
|
11467 graphics := nativeContext argAt:1. |
|
11468 gc := graphics instVarNamed:'pData'. |
|
11469 |
|
11470 jGraphics instVarNamed:'pData' put:gc. |
|
11471 gc clippingRectangle:nil. |
|
11472 |
|
11473 "Created: / 8.1.1998 / 00:47:39 / cg" |
|
11474 "Modified: / 20.10.1998 / 19:37:58 / cg" |
|
11475 ! |
|
11476 |
|
11477 _WGraphics_createFromHDC:nativeContext |
|
11478 "/ void createFromHDC (int) |
|
11479 UnimplementedNativeMethodSignal raise |
|
11480 |
|
11481 "Created: / 12.11.1998 / 19:17:32 / cg" |
|
11482 ! |
|
11483 |
|
11484 _WGraphics_createFromPrintJob:nativeContext |
|
11485 "/ void createFromPrintJob (sun.awt.windows.WPrintJob) |
|
11486 UnimplementedNativeMethodSignal raise |
|
11487 |
|
11488 "Created: / 12.11.1998 / 19:17:20 / cg" |
|
11489 ! |
|
11490 |
|
11491 _WGraphics_dispose:nativeContext |
|
11492 |gc| |
|
11493 |
|
11494 gc := self gcForWGraphics:nativeContext. |
|
11495 gc isNil ifTrue:[^ self]. |
|
11496 gc clippingRectangle:nil. |
|
11497 |
|
11498 "Created: / 6.1.1998 / 20:58:38 / cg" |
|
11499 "Modified: / 20.10.1998 / 19:35:05 / cg" |
|
11500 ! |
|
11501 |
|
11502 _WGraphics_drawArc:nativeContext |
|
11503 |gc x y w h startAngle endAngle| |
|
11504 |
|
11505 gc := self gcForWGraphics:nativeContext. |
|
11506 "/ gc isNil ifTrue:[^ self]. |
|
11507 gc realized ifFalse:[^ self]. |
|
11508 |
|
11509 x := nativeContext argAt:1. |
|
11510 y := nativeContext argAt:2. |
|
11511 w := nativeContext argAt:3. |
|
11512 h := nativeContext argAt:4. |
|
11513 startAngle := nativeContext argAt:5. |
|
11514 endAngle := nativeContext argAt:6. |
|
11515 |
|
11516 DrawOPTrace ifTrue:[ |
|
11517 'drawArc x/y= ' print. x print. '@' print. y print. |
|
11518 ' w/h= ' print. w print. '@' print. h print. |
|
11519 ' startAngle= ' print. startAngle print. ' endAngle= ' print. endAngle printCR. |
|
11520 ]. |
|
11521 gc |
|
11522 displayArcX:x y:y |
|
11523 width:w height:h |
|
11524 from:startAngle angle:(endAngle - startAngle). |
|
11525 |
|
11526 "Created: / 6.1.1998 / 21:00:15 / cg" |
|
11527 "Modified: / 28.1.1999 / 17:38:45 / cg" |
|
11528 ! |
|
11529 |
|
11530 _WGraphics_drawBytes:nativeContext |
|
11531 "/ void drawBytes (byte[] int int int int) |
|
11532 UnimplementedNativeMethodSignal raise |
|
11533 |
|
11534 "Created: / 12.11.1998 / 19:18:56 / cg" |
|
11535 ! |
|
11536 |
|
11537 _WGraphics_drawLine:nativeContext |
|
11538 |gc x y x2 y2| |
|
11539 |
|
11540 gc := self gcForWGraphics:nativeContext. |
|
11541 "/ gc isNil ifTrue:[^ self]. |
|
11542 gc realized ifFalse:[^ self]. |
|
11543 |
|
11544 x := nativeContext argAt:1. |
|
11545 y := nativeContext argAt:2. |
|
11546 x2 := nativeContext argAt:3. |
|
11547 y2 := nativeContext argAt:4. |
|
11548 |
|
11549 DrawOPTrace ifTrue:[ |
|
11550 'drawLine x/y= ' print. x print. '@' print. y print. ' x2/y2= ' print. x2 print. '@' print. y2 printCR. |
|
11551 ]. |
|
11552 gc displayLineFromX:x y:y toX:x2 y:y2 |
|
11553 |
|
11554 "Created: / 6.1.1998 / 20:59:27 / cg" |
|
11555 "Modified: / 8.1.1998 / 00:34:23 / cg" |
|
11556 ! |
|
11557 |
|
11558 _WGraphics_drawMFCharsConvertedSegment:nativeContext |
|
11559 "/ int drawMFCharsConvertedSegment (java.awt.Font sun.awt.FontDescriptor byte[] int int int) |
|
11560 UnimplementedNativeMethodSignal raise |
|
11561 |
|
11562 "Created: / 12.11.1998 / 19:18:44 / cg" |
|
11563 ! |
|
11564 |
|
11565 _WGraphics_drawMFCharsSegment:nativeContext |
|
11566 |jFont jFontDescr s gc x y offs len| |
|
11567 |
|
11568 gc := self gcForWGraphics:nativeContext. |
|
11569 gc realized ifFalse:[^ self]. |
|
11570 |
|
11571 jFont := nativeContext argAt:1. |
|
11572 jFontDescr := nativeContext argAt:2. |
|
11573 s := nativeContext argAt:3. |
|
11574 offs := nativeContext argAt:4. |
|
11575 len := nativeContext argAt:5. |
|
11576 x := nativeContext argAt:6. |
|
11577 y := nativeContext argAt:7. |
|
11578 |
|
11579 DrawOPTrace ifTrue:[ |
|
11580 'drawMFCharsSegment x/y= ' print. x print. '@' print. y print. ' s= ' print. s printCR. |
|
11581 ]. |
|
11582 gc displayString:s from:offs+1 to:offs+len x:x y:y. |
|
11583 ^ (gc font onDevice:(gc graphicsDevice)) widthOf:s. |
|
11584 |
|
11585 "Created: / 6.1.1998 / 21:01:07 / cg" |
|
11586 "Modified: / 25.1.1998 / 20:45:55 / cg" |
|
11587 ! |
|
11588 |
|
11589 _WGraphics_drawOval:nativeContext |
|
11590 |gc x y w h| |
|
11591 |
|
11592 gc := self gcForWGraphics:nativeContext. |
|
11593 "/ gc isNil ifTrue:[^ self]. |
|
11594 gc realized ifFalse:[^ self]. |
|
11595 |
|
11596 x := nativeContext argAt:1. |
|
11597 y := nativeContext argAt:2. |
|
11598 w := nativeContext argAt:3. |
|
11599 h := nativeContext argAt:4. |
|
11600 |
|
11601 DrawOPTrace ifTrue:[ |
|
11602 'drawOval x/y= ' print. x print. '@' print. y print. |
|
11603 ' w/h= ' print. w print. '@' print. h printCR. |
|
11604 ]. |
|
11605 gc displayArcX:x y:y width:w height:h from:0 angle:360. |
|
11606 |
|
11607 "Created: / 8.1.1998 / 00:44:31 / cg" |
|
11608 "Modified: / 9.4.1998 / 22:10:23 / cg" |
|
11609 ! |
|
11610 |
|
11611 _WGraphics_drawPolygon:nativeContext |
|
11612 |gc xVector yVector count points| |
|
11613 |
|
11614 gc := self gcForWGraphics:nativeContext. |
|
11615 "/ gc isNil ifTrue:[^ self]. |
|
11616 gc realized ifFalse:[^ self]. |
|
11617 |
|
11618 xVector := nativeContext argAt:1. |
|
11619 yVector := nativeContext argAt:2. |
|
11620 count := nativeContext argAt:3. |
|
11621 |
|
11622 DrawOPTrace ifTrue:[ |
|
11623 'drawPolgon' printCR. |
|
11624 ]. |
|
11625 |
|
11626 points := (1 to:count) collect:[:i | (xVector at:i) @ (yVector at:i)]. |
|
11627 gc displayPolygon:points |
|
11628 |
|
11629 "Created: / 8.1.1998 / 00:57:28 / cg" |
|
11630 "Modified: / 8.1.1998 / 00:57:49 / cg" |
|
11631 ! |
|
11632 |
|
11633 _WGraphics_drawPolyline:nativeContext |
|
11634 "/ void drawPolyline (int[] int[] int) |
|
11635 UnimplementedNativeMethodSignal raise |
|
11636 |
|
11637 "Created: / 12.11.1998 / 19:19:07 / cg" |
|
11638 ! |
|
11639 |
|
11640 _WGraphics_drawRect:nativeContext |
|
11641 |gc x y w h| |
|
11642 |
|
11643 gc := self gcForWGraphics:nativeContext. |
|
11644 "/ gc isNil ifTrue:[^ self]. |
|
11645 gc realized ifFalse:[^ self]. |
|
11646 |
|
11647 x := nativeContext argAt:1. |
|
11648 y := nativeContext argAt:2. |
|
11649 w := nativeContext argAt:3. |
|
11650 h := nativeContext argAt:4. |
|
11651 |
|
11652 "/ self halt. |
|
11653 "/ self internalError:'breakPoint'. |
|
11654 |
|
11655 gc displayRectangleX:x y:y width:w height:h. |
|
11656 |
|
11657 "Modified: / 8.1.1998 / 00:34:33 / cg" |
|
11658 "Created: / 8.1.1998 / 00:59:05 / cg" |
|
11659 ! |
|
11660 |
|
11661 _WGraphics_drawRoundRect:nativeContext |
|
11662 |gc x y w h| |
|
11663 |
|
11664 gc := self gcForWGraphics:nativeContext. |
|
11665 "/ gc isNil ifTrue:[^ self]. |
|
11666 gc realized ifFalse:[^ self]. |
|
11667 |
|
11668 x := nativeContext argAt:1. |
|
11669 y := nativeContext argAt:2. |
|
11670 w := nativeContext argAt:3. |
|
11671 h := nativeContext argAt:4. |
|
11672 |
|
11673 "/ self halt. |
|
11674 "/ self internalError:'breakPoint'. |
|
11675 |
|
11676 gc displayRectangleX:x y:y width:w height:h. |
|
11677 |
|
11678 "Modified: / 8.1.1998 / 00:34:33 / cg" |
|
11679 "Created: / 8.1.1998 / 00:59:26 / cg" |
|
11680 ! |
|
11681 |
|
11682 _WGraphics_drawSFChars:nativeContext |
|
11683 "/ void drawSFChars (char[]s, int pos1, int len, int x, int y) |
|
11684 |
|
11685 |gc str x y idx1 nChars| |
|
11686 |
|
11687 gc := self gcForWGraphics:nativeContext. |
|
11688 gc realized ifFalse:[^ self]. |
|
11689 |
|
11690 str := nativeContext argAt:1. |
|
11691 idx1 := nativeContext argAt:2. |
|
11692 nChars := nativeContext argAt:3. |
|
11693 x := nativeContext argAt:4. |
|
11694 y := nativeContext argAt:5. |
|
11695 |
|
11696 DrawOPTrace ifTrue:[ |
|
11697 'drawSFChars x/y= ' print. x print. '@' print. y print. |
|
11698 ' s= ' print. str printCR. |
|
11699 ]. |
|
11700 gc displayString:str from:idx1+1 to:idx1+nChars x:x y:y |
|
11701 |
|
11702 "Created: / 6.1.1998 / 21:11:31 / cg" |
|
11703 "Modified: / 8.1.1998 / 00:33:59 / cg" |
|
11704 |
|
11705 ! |
|
11706 |
|
11707 _WGraphics_fillArc:nativeContext |
|
11708 |gc x y w h startAngle endAngle| |
|
11709 |
|
11710 gc := self gcForWGraphics:nativeContext. |
|
11711 "/ gc isNil ifTrue:[^ self]. |
|
11712 gc realized ifFalse:[^ self]. |
|
11713 |
|
11714 x := nativeContext argAt:1. |
|
11715 y := nativeContext argAt:2. |
|
11716 w := nativeContext argAt:3. |
|
11717 h := nativeContext argAt:4. |
|
11718 startAngle := nativeContext argAt:5. |
|
11719 endAngle := nativeContext argAt:6. |
|
11720 |
|
11721 DrawOPTrace ifTrue:[ |
|
11722 'fillArc x/y= ' print. x print. '@' print. y print. |
|
11723 ' w/h= ' print. w print. '@' print. h print. |
|
11724 ' startAngle= ' print. startAngle print. ' endAngle= ' print. endAngle printCR. |
|
11725 ]. |
|
11726 gc fillArcX:x y:y width:w height:h from:startAngle angle:(endAngle - startAngle) |
|
11727 |
|
11728 "Created: / 6.1.1998 / 21:11:31 / cg" |
|
11729 "Modified: / 8.1.1998 / 00:33:59 / cg" |
|
11730 ! |
|
11731 |
|
11732 _WGraphics_fillOval:nativeContext |
|
11733 |gc x y w h| |
|
11734 |
|
11735 gc := self gcForWGraphics:nativeContext. |
|
11736 "/ gc isNil ifTrue:[^ self]. |
|
11737 gc realized ifFalse:[^ self]. |
|
11738 |
|
11739 x := nativeContext argAt:1. |
|
11740 y := nativeContext argAt:2. |
|
11741 w := nativeContext argAt:3. |
|
11742 h := nativeContext argAt:4. |
|
11743 |
|
11744 DrawOPTrace ifTrue:[ |
|
11745 'drawOval x/y= ' print. x print. '@' print. y print. |
|
11746 ' w/h= ' print. w print. '@' print. h printCR. |
|
11747 ]. |
|
11748 gc fillArcX:x y:y width:w height:h from:0 angle:360 |
|
11749 |
|
11750 "Created: / 8.1.1998 / 00:46:00 / cg" |
|
11751 "Modified: / 8.1.1998 / 00:46:20 / cg" |
|
11752 ! |
|
11753 |
|
11754 _WGraphics_fillPolygon:nativeContext |
|
11755 |gc xVector yVector count points| |
|
11756 |
|
11757 gc := self gcForWGraphics:nativeContext. |
|
11758 "/ gc isNil ifTrue:[^ self]. |
|
11759 gc realized ifFalse:[^ self]. |
|
11760 |
|
11761 xVector := nativeContext argAt:1. |
|
11762 yVector := nativeContext argAt:2. |
|
11763 count := nativeContext argAt:3. |
|
11764 |
|
11765 DrawOPTrace ifTrue:[ |
|
11766 'fillPolgon' printCR. |
|
11767 ]. |
|
11768 |
|
11769 points := (1 to:count) collect:[:i | (xVector at:i) @ (yVector at:i)]. |
|
11770 gc fillPolygon:points |
|
11771 |
|
11772 "Created: / 8.1.1998 / 00:58:09 / cg" |
|
11773 "Modified: / 25.1.1998 / 11:03:19 / cg" |
|
11774 ! |
|
11775 |
|
11776 _WGraphics_fillRect:nativeContext |
|
11777 |gc x y w h| |
|
11778 |
|
11779 gc := self gcForWGraphics:nativeContext. |
|
11780 "/ gc isNil ifTrue:[^ self]. |
|
11781 gc realized ifFalse:[^ self]. |
|
11782 |
|
11783 x := nativeContext argAt:1. |
|
11784 y := nativeContext argAt:2. |
|
11785 w := nativeContext argAt:3. |
|
11786 h := nativeContext argAt:4. |
|
11787 |
|
11788 "/ self halt. |
|
11789 "/ self internalError:'breakPoint'. |
|
11790 |
|
11791 gc fillRectangleX:x y:y width:w height:h. |
|
11792 |
|
11793 "Created: / 15.8.1997 / 15:43:10 / cg" |
|
11794 "Modified: / 8.1.1998 / 00:34:33 / cg" |
|
11795 ! |
|
11796 |
|
11797 _WGraphics_fillRoundRect:nativeContext |
|
11798 |gc x y w h| |
|
11799 |
|
11800 gc := self gcForWGraphics:nativeContext. |
|
11801 "/ gc isNil ifTrue:[^ self]. |
|
11802 gc realized ifFalse:[^ self]. |
|
11803 |
|
11804 x := nativeContext argAt:1. |
|
11805 y := nativeContext argAt:2. |
|
11806 w := nativeContext argAt:3. |
|
11807 h := nativeContext argAt:4. |
|
11808 |
|
11809 "/ self halt. |
|
11810 "/ self internalError:'breakPoint'. |
|
11811 |
|
11812 gc displayRectangleX:x y:y width:w height:h. |
|
11813 |
|
11814 "Modified: / 8.1.1998 / 00:34:33 / cg" |
|
11815 "Created: / 8.1.1998 / 00:59:36 / cg" |
|
11816 ! |
|
11817 |
|
11818 _WGraphics_getClipBounds:nativeContext |
|
11819 |gc rect r x y w h| |
|
11820 |
|
11821 gc := self gcForWGraphics:nativeContext. |
|
11822 "/ gc isNil ifTrue:[^ nil]. |
|
11823 |
|
11824 rect := (Java classForName:'java.awt.Rectangle') basicNew. |
|
11825 |
|
11826 (gc isMemberOf:JavaView) ifTrue:[ |
|
11827 "/ r := gc clippingRectangleOrNil. |
|
11828 r := gc getNextUpdateRectangle. |
|
11829 ]. |
|
11830 r isNil ifTrue:[ |
|
11831 r := gc clippingRectangleOrNil. |
|
11832 ]. |
|
11833 |
|
11834 r isNil ifTrue:[ |
|
11835 x := y := 0. |
|
11836 w := (gc width). |
|
11837 h := (gc height). |
|
11838 ] ifFalse:[ |
|
11839 x := (r left). |
|
11840 y := (r top). |
|
11841 w := (r width). |
|
11842 h := (r height). |
|
11843 ]. |
|
11844 rect instVarNamed:'x' put:x. |
|
11845 rect instVarNamed:'y' put:y. |
|
11846 rect instVarNamed:'width' put:w. |
|
11847 rect instVarNamed:'height' put:h. |
|
11848 |
|
11849 "/ 'WGraphics__getClipBounds ' infoPrint. (x@y extent:w@h) infoPrintCR. |
|
11850 |
|
11851 ^ rect |
|
11852 |
|
11853 "Created: / 6.1.1998 / 20:58:07 / cg" |
|
11854 "Modified: / 23.12.1998 / 20:14:09 / cg" |
|
11855 ! |
|
11856 |
|
11857 _WGraphics_imageCreate:nativeContext |
|
11858 |jGraphics imgRep| |
|
11859 |
|
11860 jGraphics := nativeContext receiver. |
|
11861 imgRep := nativeContext argAt:1. |
|
11862 |
|
11863 jGraphics instVarNamed:'pData' put:(imgRep instVarNamed:'pData'). |
|
11864 "/ self halt. |
|
11865 |
|
11866 "Created: / 11.1.1998 / 16:34:30 / cg" |
|
11867 "Modified: / 17.1.1998 / 12:37:18 / cg" |
|
11868 ! |
|
11869 |
|
11870 _WGraphics_pSetFont:nativeContext |
|
11871 |gc jFont stFont| |
|
11872 |
|
11873 gc := self gcForWGraphics:nativeContext. |
|
11874 jFont := nativeContext argAt:1. |
|
11875 |
|
11876 stFont := jFont instVarNamed:'pData'. |
|
11877 (stFont isNil or:[stFont == 0]) ifTrue:[ |
|
11878 "/ self halt. |
|
11879 ] ifFalse:[ |
|
11880 gc font:stFont |
|
11881 ]. |
|
11882 |
|
11883 "Created: / 6.1.1998 / 20:56:47 / cg" |
|
11884 "Modified: / 15.1.1998 / 12:31:20 / cg" |
|
11885 ! |
|
11886 |
|
11887 _WGraphics_pSetForeground:nativeContext |
|
11888 |gc rgb clr| |
|
11889 |
|
11890 gc := self gcForWGraphics:nativeContext. |
|
11891 |
|
11892 rgb := nativeContext argAt:1. |
|
11893 rgb isInteger ifFalse:[ |
|
11894 "/ its a java.awt.Color |
|
11895 rgb := rgb instVarNamed:'value'. |
|
11896 ]. |
|
11897 clr := Color rgbValue:rgb. |
|
11898 gc paint:(clr nearestOn:gc device). |
|
11899 |
|
11900 "/ self halt. |
|
11901 "/ self internalError:'breakPoint'. |
|
11902 |
|
11903 "Created: / 6.1.1998 / 20:56:14 / cg" |
|
11904 "Modified: / 23.12.1998 / 20:10:49 / cg" |
|
11905 ! |
|
11906 |
|
11907 _WGraphics_print:nativeContext |
|
11908 "/ void print (sun.awt.windows.WComponentPeer) |
|
11909 UnimplementedNativeMethodSignal raise |
|
11910 |
|
11911 "Created: / 12.11.1998 / 19:19:25 / cg" |
|
11912 ! |
|
11913 |
|
11914 _WGraphics_removeClip:nativeContext |
|
11915 "/ void removeClip () |
|
11916 UnimplementedNativeMethodSignal raise |
|
11917 |
|
11918 "Created: / 12.11.1998 / 19:18:05 / cg" |
|
11919 ! |
|
11920 |
|
11921 _WGraphics_setPaintMode:nativeContext |
|
11922 |gc| |
|
11923 |
|
11924 gc := self gcForWGraphics:nativeContext. |
|
11925 gc function:#copy. |
|
11926 |
|
11927 true "DrawOPTrace" ifTrue:[ |
|
11928 'copyMode' infoPrintCR. |
|
11929 ]. |
|
11930 |
|
11931 "Created: / 8.1.1998 / 00:33:44 / cg" |
|
11932 "Modified: / 28.1.1998 / 23:25:56 / cg" |
|
11933 ! |
|
11934 |
|
11935 _WGraphics_setXORMode:nativeContext |
|
11936 |gc jColor rgb invColor device| |
|
11937 |
|
11938 gc := self gcForWGraphics:nativeContext. |
|
11939 jColor := nativeContext argAt:1. |
|
11940 device := gc graphicsDevice. |
|
11941 |
|
11942 "/ "/ on trueColor systems, use the provided |
|
11943 "/ "/ rgb value for inverting. |
|
11944 "/ "/ on palette systems, use white ^ black |
|
11945 "/ |
|
11946 "/ device visualType == #TrueColor ifTrue:[ |
|
11947 "/ rgb := jColor instVarNamed:'value'. |
|
11948 "/ rgb := rgb bitAnd:16rFFFFFF. |
|
11949 "/ rgb == 0 ifTrue:[ |
|
11950 "/ rgb := 16rFFFFFF. |
|
11951 "/ ]. |
|
11952 "/ invColor := rgb |
|
11953 "/ ] ifFalse:[ |
|
11954 "/ invColor := device blackpixel bitXor:device whitepixel. |
|
11955 "/ ]. |
|
11956 |
|
11957 invColor := device blackpixel bitXor:device whitepixel. |
|
11958 |
|
11959 "/ gc foreground:(Color colorId:invColor) |
|
11960 "/ background:device blackColor. |
|
11961 device |
|
11962 setForeground:invColor background:0 |
|
11963 in:gc gcId. |
|
11964 gc function:#xor. |
|
11965 |
|
11966 true "DrawOPTrace" ifTrue:[ |
|
11967 'xorMode' infoPrintCR. |
|
11968 ]. |
|
11969 |
|
11970 "Created: / 8.1.1998 / 00:36:17 / cg" |
|
11971 "Modified: / 28.1.1998 / 23:45:03 / cg" |
|
11972 ! |
|
11973 |
|
11974 _WLabelPeer_create:nativeContext |
|
11975 |jLabelPeer jLabel jFrame frame label |
|
11976 lbl| |
|
11977 |
|
11978 jLabelPeer := nativeContext receiver. |
|
11979 jLabel := jLabelPeer instVarNamed:'target'. |
|
11980 |
|
11981 lbl := jLabel instVarNamed:'text'. |
|
11982 lbl notNil ifTrue:[ |
|
11983 lbl := Java as_ST_String:lbl |
|
11984 ]. |
|
11985 |
|
11986 jFrame := nativeContext argAt:1. |
|
11987 frame := jFrame instVarNamed:'pData'. |
|
11988 |
|
11989 label := Label in:frame. |
|
11990 label sizeFixed:true. |
|
11991 lbl notNil ifTrue:[ |
|
11992 label label:lbl |
|
11993 ]. |
|
11994 self createdWindowsView:label for:jLabelPeer. |
|
11995 |
|
11996 WindowCreationTrace == true ifTrue:[ |
|
11997 'WLabelPeer_create: ' print. frame print. ' -> ' print. label printNL. |
|
11998 ]. |
|
11999 |
|
12000 "Created: / 7.1.1998 / 21:42:31 / cg" |
|
12001 "Modified: / 13.1.1998 / 22:10:47 / cg" |
|
12002 ! |
|
12003 |
|
12004 _WLabelPeer_setAlignment:nativeContext |
|
12005 |label alignNr| |
|
12006 |
|
12007 alignNr := nativeContext argAt:1. |
|
12008 label := self viewForWPeer:nativeContext. |
|
12009 label notNil ifTrue:[ |
|
12010 ]. |
|
12011 |
|
12012 "Created: / 7.1.1998 / 21:43:12 / cg" |
|
12013 "Modified: / 8.1.1998 / 17:35:29 / cg" |
|
12014 ! |
|
12015 |
|
12016 _WLabelPeer_setText:nativeContext |
|
12017 |label jString str| |
|
12018 |
|
12019 jString := nativeContext argAt:1. |
|
12020 |
|
12021 label := self viewForWPeer:nativeContext. |
|
12022 jString notNil ifTrue:[ |
|
12023 str := Java as_ST_String:jString |
|
12024 ]. |
|
12025 label label:str |
|
12026 |
|
12027 "Created: / 7.1.1998 / 21:43:51 / cg" |
|
12028 "Modified: / 3.12.1998 / 14:59:18 / cg" |
|
12029 ! |
|
12030 |
|
12031 _WListPeer__addItem:nativeContext |
|
12032 |jString index1 length selListView m| |
|
12033 |
|
12034 selListView := self viewForWPeer:nativeContext. |
|
12035 |
|
12036 jString := nativeContext argAt:1. |
|
12037 index1 := nativeContext argAt:2. |
|
12038 length := nativeContext argAt:3. |
|
12039 |
|
12040 (m := selListView model) notNil ifTrue:[ |
|
12041 m list addLast:(Java as_ST_String:jString). |
|
12042 m changed:#list. |
|
12043 ]. |
|
12044 |
|
12045 "Created: / 26.10.1998 / 20:11:30 / cg" |
|
12046 "Modified: / 14.11.1998 / 01:21:03 / cg" |
|
12047 ! |
|
12048 |
|
12049 _WListPeer_addItem:nativeContext |
|
12050 |jString index selListView m| |
|
12051 |
|
12052 selListView := self viewForWPeer:nativeContext. |
|
12053 |
|
12054 jString := nativeContext argAt:1. |
|
12055 index := nativeContext argAt:2. |
|
12056 |
|
12057 m := selListView model. |
|
12058 m isNil ifTrue:[ |
|
12059 Transcript showCR:'JAVA: access to listModel of closed view'. |
|
12060 ] ifFalse:[ |
|
12061 m list addLast:(Java as_ST_String:jString). |
|
12062 m changed:#list. |
|
12063 ] |
|
12064 |
|
12065 "Created: / 24.1.1998 / 21:10:05 / cg" |
|
12066 "Modified: / 2.11.1998 / 17:12:52 / cg" |
|
12067 ! |
|
12068 |
|
12069 _WListPeer_create:nativeContext |
|
12070 |jListPeer jFrame frame selectionInListView| |
|
12071 |
|
12072 jListPeer := nativeContext receiver. |
|
12073 |
|
12074 jFrame := nativeContext argAt:1. |
|
12075 frame := jFrame instVarNamed:'pData'. |
|
12076 |
|
12077 selectionInListView := ScrollableView for:SelectionInListView in:frame. |
|
12078 selectionInListView action:[:index | jListPeer perform:#'handleListChanged(I)V' with:(index - 1)]. |
|
12079 selectionInListView doubleClickAction:[:index | jListPeer perform:#'handleAction(I)V' with:(index - 1)]. |
|
12080 selectionInListView model:(SelectionInList new list:(List new)). |
|
12081 selectionInListView useIndex:true. |
|
12082 |
|
12083 self createdWindowsView:selectionInListView for:jListPeer. |
|
12084 |
|
12085 WindowCreationTrace == true ifTrue:[ |
|
12086 'WTextAreaPeer_create: ' print. frame print. ' -> ' print. selectionInListView printNL. |
|
12087 ]. |
|
12088 |
|
12089 "Created: / 24.1.1998 / 19:58:54 / cg" |
|
12090 "Modified: / 9.4.1998 / 22:19:07 / cg" |
|
12091 ! |
|
12092 |
|
12093 _WListPeer_delItems:nativeContext |
|
12094 |jString index1 index2 selListView model list| |
|
12095 |
|
12096 selListView := self viewForWPeer:nativeContext. |
|
12097 |
|
12098 index1 := (nativeContext argAt:1) + 1. "/ java indices are 0-based. |
|
12099 index2 := (nativeContext argAt:2) + 1. "/ st indices are 1-based. |
|
12100 |
|
12101 model := selListView model. |
|
12102 model isNil ifTrue:[^ self]. |
|
12103 list := model list. |
|
12104 list size >= index1 ifTrue:[ |
|
12105 list removeFromIndex:index1 toIndex:(index2 min:list size). |
|
12106 model changed:#list. |
|
12107 ]. |
|
12108 |
|
12109 "Created: / 9.4.1998 / 22:19:25 / cg" |
|
12110 "Modified: / 30.12.1998 / 20:00:50 / cg" |
|
12111 ! |
|
12112 |
|
12113 _WListPeer_deselect:nativeContext |
|
12114 "/ void deselect (int) |
|
12115 UnimplementedNativeMethodSignal raise |
|
12116 |
|
12117 "Created: / 12.11.1998 / 19:15:10 / cg" |
|
12118 ! |
|
12119 |
|
12120 _WListPeer_getMaxWidth:nativeContext |
|
12121 "/ int getMaxWidth () |
|
12122 |
|
12123 ^ 1000 "/ a dummy value |
|
12124 |
|
12125 "/ UnimplementedNativeMethodSignal raise |
|
12126 |
|
12127 "Created: / 14.11.1998 / 10:44:29 / cg" |
|
12128 ! |
|
12129 |
|
12130 _WListPeer_isSelected:nativeContext |
|
12131 |selectionInListView index model| |
|
12132 |
|
12133 selectionInListView := self viewForWPeer:nativeContext. |
|
12134 |
|
12135 index := nativeContext argAt:1. |
|
12136 (model := selectionInListView model) notNil ifTrue:[ |
|
12137 (model selectionIndex == (index + 1)) "/ JAVA indexing starts at 0 |
|
12138 ifTrue:[ |
|
12139 ^ 1 |
|
12140 ] |
|
12141 ]. |
|
12142 ^ 0. |
|
12143 |
|
12144 "Created: / 24.1.1998 / 22:42:31 / cg" |
|
12145 "Modified: / 25.1.1998 / 01:35:32 / cg" |
|
12146 ! |
|
12147 |
|
12148 _WListPeer_makeVisible:nativeContext |
|
12149 |selectionInListView lineNr| |
|
12150 |
|
12151 selectionInListView := self viewForWPeer:nativeContext. |
|
12152 |
|
12153 lineNr := nativeContext argAt:1. |
|
12154 |
|
12155 selectionInListView makeLineVisible:(lineNr + 1) |
|
12156 |
|
12157 "Modified: / 24.1.1998 / 20:01:06 / cg" |
|
12158 "Created: / 20.10.1998 / 14:14:50 / cg" |
|
12159 ! |
|
12160 |
|
12161 _WListPeer_select:nativeContext |
|
12162 |selectionInListView index model| |
|
12163 |
|
12164 selectionInListView := self viewForWPeer:nativeContext. |
|
12165 |
|
12166 index := nativeContext argAt:1. |
|
12167 (model := selectionInListView model) notNil ifTrue:[ |
|
12168 model selectionIndex:(index + 1). "/ JAVA indexing starts at 0 |
|
12169 ] |
|
12170 |
|
12171 "Created: / 24.1.1998 / 22:32:35 / cg" |
|
12172 "Modified: / 25.1.1998 / 01:28:46 / cg" |
|
12173 ! |
|
12174 |
|
12175 _WListPeer_setMultipleSelections:nativeContext |
|
12176 |selectionInListView onOff| |
|
12177 |
|
12178 selectionInListView := self viewForWPeer:nativeContext. |
|
12179 |
|
12180 onOff := (nativeContext argAt:1) ~~ 0. |
|
12181 |
|
12182 selectionInListView multipleSelectOk:onOff. |
|
12183 |
|
12184 "Modified: / 24.1.1998 / 20:01:06 / cg" |
|
12185 ! |
|
12186 |
|
12187 _WListPeer_updateMaxItemWidth:nativeContext |
|
12188 |selectionInListView lineNr| |
|
12189 |
|
12190 selectionInListView := self viewForWPeer:nativeContext. |
|
12191 |
|
12192 "Created: / 26.10.1998 / 20:09:46 / cg" |
|
12193 ! |
|
12194 |
|
12195 _WMenuBarPeer_addMenu:nativeContext |
|
12196 "/ void addMenu (java.awt.Menu) |
|
12197 UnimplementedNativeMethodSignal raise |
|
12198 |
|
12199 "Created: / 12.11.1998 / 19:14:00 / cg" |
|
12200 ! |
|
12201 |
|
12202 _WMenuBarPeer_create:nativeContext |
|
12203 |jMenuBarPeer jMenuBar jFrame frame menuBar| |
|
12204 |
|
12205 jMenuBarPeer := nativeContext receiver. |
|
12206 jMenuBar := jMenuBarPeer instVarNamed:'target'. |
|
12207 |
|
12208 jFrame := nativeContext argAt:1. |
|
12209 frame := jFrame instVarNamed:'pData'. |
|
12210 |
|
12211 menuBar := MenuPanel in:frame. |
|
12212 menuBar verticalLayout:false. |
|
12213 menuBar realize. |
|
12214 |
|
12215 self createdWindowsView:menuBar for:jMenuBarPeer. |
|
12216 |
|
12217 WindowCreationTrace == true ifTrue:[ |
|
12218 'WMenuBarPeer_create: ' print. frame print. ' -> ' print. menuBar printNL. |
|
12219 ]. |
|
12220 |
|
12221 "Created: / 7.1.1998 / 21:38:31 / cg" |
|
12222 "Modified: / 25.1.1998 / 13:19:03 / cg" |
|
12223 ! |
|
12224 |
|
12225 _WMenuBarPeer_delMenu:nativeContext |
|
12226 "/ void delMenu (int) |
|
12227 UnimplementedNativeMethodSignal raise |
|
12228 |
|
12229 "Created: / 12.11.1998 / 19:14:11 / cg" |
|
12230 ! |
|
12231 |
|
12232 _WMenuItemPeer__dispose:nativeContext |
|
12233 |jMenuItemPeer item| |
|
12234 |
|
12235 jMenuItemPeer := nativeContext receiver. |
|
12236 item := jMenuItemPeer instVarNamed:'pData'. |
|
12237 |
|
12238 "/ what should be done here ? |
|
12239 |
|
12240 "Created: / 29.3.1998 / 17:16:05 / cg" |
|
12241 "Modified: / 29.3.1998 / 17:16:35 / cg" |
|
12242 ! |
|
12243 |
|
12244 _WMenuItemPeer__setLabel:nativeContext |
|
12245 "/ void _setLabel (java.lang.String) |
|
12246 |
|
12247 |jMenuItemPeer item label| |
|
12248 |
|
12249 jMenuItemPeer := nativeContext receiver. |
|
12250 item := jMenuItemPeer instVarNamed:'pData'. |
|
12251 (item isNil or:[item == 0]) ifTrue:[ |
|
12252 'JAVA [warning]: NULL menu item in setLabel' infoPrintCR. |
|
12253 ^ self |
|
12254 ]. |
|
12255 |
|
12256 label := nativeContext argAt:1. |
|
12257 label isNil ifTrue:[ |
|
12258 label := '' |
|
12259 ] ifFalse:[ |
|
12260 label := Java as_ST_String:label |
|
12261 ]. |
|
12262 item label:label. |
|
12263 |
|
12264 "Modified: / 11.12.1998 / 16:40:18 / cg" |
|
12265 ! |
|
12266 |
|
12267 _WMenuItemPeer_create:nativeContext |
|
12268 |jMenuItemPeer jMenuItem jMenuPeer menu item lbl| |
|
12269 |
|
12270 jMenuItemPeer := nativeContext receiver. |
|
12271 jMenuItem := jMenuItemPeer instVarNamed:'target'. |
|
12272 |
|
12273 jMenuPeer := nativeContext argAt:1. |
|
12274 menu := jMenuPeer instVarNamed:'pData'. |
|
12275 (menu isNil or:[menu == 0]) ifTrue:[ |
|
12276 'JAVA: no menu to create item in' infoPrintCR. |
|
12277 ^ self |
|
12278 ]. |
|
12279 item := menu createAtIndex:nil. |
|
12280 item value:[ |
|
12281 jMenuItemPeer perform:#'handleAction(I)V' with:0 |
|
12282 ]. |
|
12283 |
|
12284 lbl := jMenuItem instVarNamed:'label'. |
|
12285 lbl notNil ifTrue:[ |
|
12286 lbl := Java as_ST_String:lbl. |
|
12287 item label:lbl |
|
12288 ]. |
|
12289 |
|
12290 jMenuItemPeer instVarNamed:'pData' put:item. |
|
12291 |
|
12292 WindowOPTrace == true ifTrue:[ |
|
12293 'WMenuItem_create: ' print. menu print. ' -> ' print. item printNL. |
|
12294 ]. |
|
12295 |
|
12296 "Created: / 7.1.1998 / 21:40:44 / cg" |
|
12297 "Modified: / 3.12.1998 / 20:43:20 / cg" |
|
12298 ! |
|
12299 |
|
12300 _WMenuItemPeer_enable:nativeContext |
|
12301 |jMenuItemPeer item state| |
|
12302 |
|
12303 jMenuItemPeer := nativeContext receiver. |
|
12304 item := jMenuItemPeer instVarNamed:'pData'. |
|
12305 (item isNil or:[item == 0]) ifTrue:[ |
|
12306 'JAVA [warning]: NULL menu item in enable' infoPrintCR. |
|
12307 ^ self |
|
12308 ]. |
|
12309 |
|
12310 state := nativeContext argAt:1. |
|
12311 item enabled:(state ~~ 0) |
|
12312 |
|
12313 "Created: / 7.1.1998 / 22:41:38 / cg" |
|
12314 "Modified: / 11.12.1998 / 16:40:26 / cg" |
|
12315 ! |
|
12316 |
|
12317 _WMenuPeer_addSeparator:nativeContext |
|
12318 "/ void addSeparator () |
|
12319 UnimplementedNativeMethodSignal raise |
|
12320 |
|
12321 "Created: / 12.11.1998 / 19:13:14 / cg" |
|
12322 ! |
|
12323 |
|
12324 _WMenuPeer_createMenu:nativeContext |
|
12325 |jMenuPeer jMenu jMenuBarPeer menuPanel menu |
|
12326 lbl item| |
|
12327 |
|
12328 jMenuPeer := nativeContext receiver. |
|
12329 jMenu := jMenuPeer instVarNamed:'target'. |
|
12330 |
|
12331 jMenuBarPeer := nativeContext argAt:1. |
|
12332 menuPanel := jMenuBarPeer instVarNamed:'pData'. |
|
12333 |
|
12334 item := menuPanel createAtIndex:nil. |
|
12335 lbl := jMenu instVarNamed:'label'. |
|
12336 lbl notNil ifTrue:[ |
|
12337 lbl := Java as_ST_String:lbl. |
|
12338 item label:lbl |
|
12339 ]. |
|
12340 |
|
12341 menu := MenuPanel new. |
|
12342 item submenu:menu. |
|
12343 |
|
12344 jMenuPeer instVarNamed:'pData' put:menu. |
|
12345 |
|
12346 'createMenuPeer: ' print. menuPanel print. ' -> ' print. menu printNL. |
|
12347 |
|
12348 "Created: / 7.1.1998 / 21:39:50 / cg" |
|
12349 "Modified: / 13.1.1998 / 22:11:09 / cg" |
|
12350 ! |
|
12351 |
|
12352 _WMenuPeer_createSubMenu:nativeContext |
|
12353 "/ void createSubMenu (sun.awt.windows.WMenuPeer) |
|
12354 "/ UnimplementedNativeMethodSignal raise |
|
12355 |
|
12356 "Created: / 12.11.1998 / 19:13:43 / cg" |
|
12357 "Modified: / 3.12.1998 / 21:41:07 / cg" |
|
12358 ! |
|
12359 |
|
12360 _WMenuPeer_delItem:nativeContext |
|
12361 "/ void delItem (int) |
|
12362 |jMenuPeer jMenu menuPanel itemIndex| |
|
12363 |
|
12364 jMenuPeer := nativeContext receiver. |
|
12365 menuPanel := jMenuPeer instVarNamed:'pData'. |
|
12366 |
|
12367 itemIndex := nativeContext argAt:1. |
|
12368 menuPanel remove:itemIndex. |
|
12369 |
|
12370 "/ UnimplementedNativeMethodSignal raise |
|
12371 |
|
12372 "Created: / 12.11.1998 / 19:13:30 / cg" |
|
12373 "Modified: / 10.12.1998 / 21:12:29 / cg" |
|
12374 ! |
|
12375 |
|
12376 _WPanelPeer_calculateInsets:nativeContext |
|
12377 "/ new with jdk1.2 ... |
|
12378 |
|
12379 "Created: / 27.1.1998 / 21:40:00 / cg" |
|
12380 ! |
|
12381 |
|
12382 _WPopupMenuPeer__show:nativeContext |
|
12383 "/ void _show (java.awt.Event) |
|
12384 UnimplementedNativeMethodSignal raise |
|
12385 |
|
12386 "Created: / 12.11.1998 / 19:12:53 / cg" |
|
12387 ! |
|
12388 |
|
12389 _WPopupMenuPeer_createMenu:nativeContext |
|
12390 "/ void createMenu (sun.awt.windows.WComponentPeer) |
|
12391 UnimplementedNativeMethodSignal raise |
|
12392 |
|
12393 "Created: / 12.11.1998 / 19:12:43 / cg" |
|
12394 ! |
|
12395 |
|
12396 _WPrintJob_end:nativeContext |
|
12397 "/ void end () |
|
12398 UnimplementedNativeMethodSignal raise |
|
12399 |
|
12400 "Created: / 12.11.1998 / 19:11:28 / cg" |
|
12401 ! |
|
12402 |
|
12403 _WScrollPanePeer__getHScrollbarHeight:nativeContext |
|
12404 |scrollPane| |
|
12405 |
|
12406 scrollPane := self viewForWPeer:nativeContext. |
|
12407 ^ HorizontalScrollBar new preferredExtent y. |
|
12408 |
|
12409 "Created: / 9.4.1998 / 17:30:56 / cg" |
|
12410 "Modified: / 10.4.1998 / 14:59:28 / cg" |
|
12411 ! |
|
12412 |
|
12413 _WScrollPanePeer__getVScrollbarWidth:nativeContext |
|
12414 |scrollPane| |
|
12415 |
|
12416 scrollPane := self viewForWPeer:nativeContext. |
|
12417 ^ ScrollBar new preferredExtent x. |
|
12418 |
|
12419 "Created: / 9.4.1998 / 17:29:48 / cg" |
|
12420 "Modified: / 10.4.1998 / 15:00:33 / cg" |
|
12421 ! |
|
12422 |
|
12423 _WScrollPanePeer_create:nativeContext |
|
12424 |jScrollPanePeer jScrollPane jFrame frame scrollPane |
|
12425 lbl| |
|
12426 |
|
12427 jScrollPanePeer := nativeContext receiver. |
|
12428 jScrollPane := jScrollPanePeer instVarNamed:'target'. |
|
12429 |
|
12430 jFrame := nativeContext argAt:1. |
|
12431 frame := jFrame instVarNamed:'pData'. |
|
12432 |
|
12433 "/ create with a simple view ... |
|
12434 scrollPane := ScrollableView for:JavaView in:frame. |
|
12435 |
|
12436 self createdWindowsView:scrollPane for:jScrollPanePeer. |
|
12437 |
|
12438 WindowCreationTrace == true ifTrue:[ |
|
12439 'WScrollPanePeer_create: ' print. frame print. ' -> ' print. scrollPane printNL. |
|
12440 ]. |
|
12441 |
|
12442 "Created: / 9.4.1998 / 17:25:08 / cg" |
|
12443 "Modified: / 9.4.1998 / 22:06:09 / cg" |
|
12444 ! |
|
12445 |
|
12446 _WScrollPanePeer_getOffset:nativeContext |
|
12447 "/ int getOffset (int) |
|
12448 UnimplementedNativeMethodSignal raise |
|
12449 |
|
12450 "Created: / 12.11.1998 / 19:16:29 / cg" |
|
12451 ! |
|
12452 |
|
12453 _WScrollPanePeer_getScrollChild:nativeContext |
|
12454 "/ java.awt.Component getScrollChild () |
|
12455 UnimplementedNativeMethodSignal raise |
|
12456 |
|
12457 "Created: / 12.11.1998 / 19:17:00 / cg" |
|
12458 ! |
|
12459 |
|
12460 _WScrollPanePeer_setInsets:nativeContext |
|
12461 |
|
12462 "Modified: / 9.4.1998 / 17:26:11 / cg" |
|
12463 "Created: / 9.4.1998 / 17:29:10 / cg" |
|
12464 ! |
|
12465 |
|
12466 _WScrollPanePeer_setScrollPosition:nativeContext |
|
12467 "/ void setScrollPosition (int int) |
|
12468 UnimplementedNativeMethodSignal raise |
|
12469 |
|
12470 "Created: / 12.11.1998 / 19:16:44 / cg" |
|
12471 ! |
|
12472 |
|
12473 _WScrollPanePeer_setSpans:nativeContext |
|
12474 |
|
12475 "Created: / 9.4.1998 / 17:31:44 / cg" |
|
12476 ! |
|
12477 |
|
12478 _WScrollbarPeer__setValues:nativeContext |
|
12479 |scrollBar value visibleAmount min max| |
|
12480 |
|
12481 scrollBar := self viewForWPeer:nativeContext. |
|
12482 |
|
12483 value := nativeContext argAt:1. |
|
12484 visibleAmount := nativeContext argAt:2. |
|
12485 min := nativeContext argAt:3. |
|
12486 max := nativeContext argAt:4. |
|
12487 |
|
12488 (min ~~ 0 or:[max ~~ 100]) ifTrue:[ |
|
12489 scrollBar thumb start:min stop:max. |
|
12490 ]. |
|
12491 |
|
12492 scrollBar thumbOrigin:value thumbHeight:visibleAmount. |
|
12493 |
|
12494 "Created: / 13.1.1998 / 22:13:57 / cg" |
|
12495 "Modified: / 14.10.1998 / 14:53:00 / cg" |
|
12496 ! |
|
12497 |
|
12498 _WScrollbarPeer_create:nativeContext |
|
12499 |jScrollbarPeer jScrollbar jFrame frame scrollBar |
|
12500 min max| |
|
12501 |
|
12502 jScrollbarPeer := nativeContext receiver. |
|
12503 jScrollbar := jScrollbarPeer instVarNamed:'target'. |
|
12504 |
|
12505 jFrame := nativeContext argAt:1. |
|
12506 frame := jFrame instVarNamed:'pData'. |
|
12507 |
|
12508 (jScrollbar instVarNamed:'orientation') == 0 "HORIZONTAL" ifTrue:[ |
|
12509 scrollBar := HorizontalScrollBar in:frame. |
|
12510 ] ifFalse:[ |
|
12511 scrollBar := ScrollBar in:frame. |
|
12512 ]. |
|
12513 min := jScrollbar instVarNamed:'minimum'. |
|
12514 max := jScrollbar instVarNamed:'maximum'. |
|
12515 |
|
12516 scrollBar scrollDownAction:[ |
|
12517 scrollBar thumbOrigin:(scrollBar thumbOrigin + ((max-min)/10) min:max). |
|
12518 jScrollbarPeer perform:#'dragAbsolute(I)V' with:scrollBar thumbOrigin rounded. |
|
12519 ]. |
|
12520 scrollBar scrollUpAction:[ |
|
12521 scrollBar thumbOrigin:(scrollBar thumbOrigin - ((max-min)/10) max:min). |
|
12522 jScrollbarPeer perform:#'dragAbsolute(I)V' with:scrollBar thumbOrigin rounded. |
|
12523 ]. |
|
12524 scrollBar scrollAction:[:org | |
|
12525 jScrollbarPeer perform:#'dragAbsolute(I)V' with:org rounded. |
|
12526 ]. |
|
12527 self createdWindowsView:scrollBar for:jScrollbarPeer. |
|
12528 |
|
12529 WindowCreationTrace == true ifTrue:[ |
|
12530 'WScrollbarPeer_create: ' print. frame print. ' -> ' print. scrollBar printNL. |
|
12531 ]. |
|
12532 |
|
12533 "Created: / 5.1.1998 / 01:53:30 / cg" |
|
12534 "Modified: / 14.10.1998 / 15:36:19 / cg" |
|
12535 ! |
|
12536 |
|
12537 _WScrollbarPeer_setLineIncrement:nativeContext |
|
12538 |scrollBar inc| |
|
12539 |
|
12540 Transcript showCR:'JavaVM: WScrollbarPeer_setLineIncrement unimplemented'. |
|
12541 |
|
12542 scrollBar := self viewForWPeer:nativeContext. |
|
12543 |
|
12544 inc := nativeContext argAt:1. |
|
12545 "/ scrollBar thumb lineIncrement:inc. |
|
12546 |
|
12547 "Created: / 25.1.1998 / 11:52:19 / cg" |
|
12548 "Modified: / 14.10.1998 / 14:53:56 / cg" |
|
12549 ! |
|
12550 |
|
12551 _WScrollbarPeer_setPageIncrement:nativeContext |
|
12552 |scrollBar inc| |
|
12553 |
|
12554 Transcript showCR:'JavaVM: WScrollbarPeer_setPageIncrement unimplemented'. |
|
12555 |
|
12556 scrollBar := self viewForWPeer:nativeContext. |
|
12557 |
|
12558 inc := nativeContext argAt:1. |
|
12559 "/ scrollBar thumb pageIncrement:inc. |
|
12560 |
|
12561 "Created: / 25.1.1998 / 11:52:01 / cg" |
|
12562 "Modified: / 14.10.1998 / 14:54:04 / cg" |
|
12563 ! |
|
12564 |
|
12565 _WTextAreaPeer_create:nativeContext |
|
12566 |jTextAreaPeer jFrame frame editTextView| |
|
12567 |
|
12568 jTextAreaPeer := nativeContext receiver. |
|
12569 |
|
12570 jFrame := nativeContext argAt:1. |
|
12571 frame := jFrame instVarNamed:'pData'. |
|
12572 |
|
12573 editTextView := HVScrollableView for:EditTextView in:frame. |
|
12574 |
|
12575 self createdWindowsView:editTextView for:jTextAreaPeer. |
|
12576 |
|
12577 WindowCreationTrace == true ifTrue:[ |
|
12578 'WTextAreaPeer_create: ' print. frame print. ' -> ' print. editTextView printNL. |
|
12579 ]. |
|
12580 |
|
12581 "Created: / 7.1.1998 / 21:49:49 / cg" |
|
12582 "Modified: / 15.1.1998 / 12:56:18 / cg" |
|
12583 ! |
|
12584 |
|
12585 _WTextAreaPeer_insertText:nativeContext |
|
12586 |textView pos string jstring| |
|
12587 |
|
12588 textView := self viewForWPeer:nativeContext. |
|
12589 (textView isKindOf:ScrollableView) ifTrue:[ |
|
12590 textView := textView scrolledView |
|
12591 ]. |
|
12592 |
|
12593 jstring := nativeContext argAt:1. |
|
12594 string := Java as_ST_String:jstring. |
|
12595 pos := nativeContext argAt:2. |
|
12596 |
|
12597 textView insert:string at:pos. |
|
12598 textView cursorToCharacterPosition:pos + string size. |
|
12599 textView makeCursorVisible. |
|
12600 "/ textView invalidateRepairNow:true. |
|
12601 ^ nil |
|
12602 |
|
12603 "Created: / 7.1.1998 / 21:50:23 / cg" |
|
12604 "Modified: / 5.4.1998 / 17:37:24 / cg" |
|
12605 ! |
|
12606 |
|
12607 _WTextAreaPeer_replaceText:nativeContext |
|
12608 "/ void replaceText (java.lang.String int int) |
|
12609 UnimplementedNativeMethodSignal raise |
|
12610 |
|
12611 "Created: / 12.11.1998 / 19:11:14 / cg" |
|
12612 ! |
|
12613 |
|
12614 _WTextComponentPeer_enableEditing:nativeContext |
|
12615 |textView enabled| |
|
12616 |
|
12617 textView := self viewForWPeer:nativeContext. |
|
12618 enabled := (nativeContext argAt:1) ~~ 0. |
|
12619 |
|
12620 ^ textView readOnly:enabled not |
|
12621 |
|
12622 "Created: / 5.1.1998 / 01:29:38 / cg" |
|
12623 "Modified: / 25.1.1998 / 16:29:56 / cg" |
|
12624 ! |
|
12625 |
|
12626 _WTextComponentPeer_getSelectionEnd:nativeContext |
|
12627 |textView| |
|
12628 |
|
12629 textView := self viewForWPeer:nativeContext. |
|
12630 |
|
12631 ^ textView characterPositionOfSelectionEnd |
|
12632 |
|
12633 "Created: / 8.1.1998 / 17:41:56 / cg" |
|
12634 "Modified: / 15.1.1998 / 15:47:18 / cg" |
|
12635 ! |
|
12636 |
|
12637 _WTextComponentPeer_getSelectionStart:nativeContext |
|
12638 |textView| |
|
12639 |
|
12640 textView := self viewForWPeer:nativeContext. |
|
12641 |
|
12642 ^ textView characterPositionOfSelection - 1 |
|
12643 |
|
12644 "Created: / 15.8.1997 / 15:45:45 / cg" |
|
12645 "Modified: / 15.1.1998 / 15:46:51 / cg" |
|
12646 ! |
|
12647 |
|
12648 _WTextComponentPeer_getText:nativeContext |
|
12649 |textView string jString| |
|
12650 |
|
12651 textView := self viewForWPeer:nativeContext. |
|
12652 |
|
12653 string := textView contents asString. |
|
12654 jString := Java as_String:string. |
|
12655 ^ jString |
|
12656 |
|
12657 "Created: / 6.1.1998 / 21:05:15 / cg" |
|
12658 "Modified: / 8.1.1998 / 17:36:52 / cg" |
|
12659 ! |
|
12660 |
|
12661 _WTextComponentPeer_select:nativeContext |
|
12662 |textView selStart selEnd| |
|
12663 |
|
12664 textView := self viewForWPeer:nativeContext. |
|
12665 selStart := nativeContext argAt:1. |
|
12666 selEnd := nativeContext argAt:2. |
|
12667 |
|
12668 selStart == selEnd ifTrue:[ |
|
12669 "/ clear selection |
|
12670 textView unselect. |
|
12671 "/ and set caret |
|
12672 textView cursorToCharacterPosition:selStart + 1 |
|
12673 ] ifFalse:[ |
|
12674 "/ change selection |
|
12675 textView selectFromCharacterPosition:selStart+1 to:selEnd |
|
12676 ]. |
|
12677 |
|
12678 "Created: / 15.8.1997 / 15:45:58 / cg" |
|
12679 "Modified: / 15.1.1998 / 21:55:57 / cg" |
|
12680 ! |
|
12681 |
|
12682 _WTextComponentPeer_setText:nativeContext |
|
12683 |textView string jstring| |
|
12684 |
|
12685 textView := self viewForWPeer:nativeContext. |
|
12686 |
|
12687 jstring := nativeContext argAt:1. |
|
12688 jstring notNil ifTrue:[ |
|
12689 string := Java as_ST_String:jstring |
|
12690 ]. |
|
12691 |
|
12692 textView contents:string. |
|
12693 |
|
12694 "Created: / 5.1.1998 / 01:28:23 / cg" |
|
12695 "Modified: / 11.12.1998 / 12:16:46 / cg" |
|
12696 ! |
|
12697 |
|
12698 _WTextFieldPeer_create:nativeContext |
|
12699 |jTextFieldPeer jFrame frame editField| |
|
12700 |
|
12701 jTextFieldPeer := nativeContext receiver. |
|
12702 |
|
12703 jFrame := nativeContext argAt:1. |
|
12704 frame := jFrame instVarNamed:'pData'. |
|
12705 |
|
12706 editField := EditField in:frame. |
|
12707 |
|
12708 self createdWindowsView:editField for:jTextFieldPeer. |
|
12709 |
|
12710 editField crAction:[ |
|
12711 jTextFieldPeer perform:#handleAction. |
|
12712 ]. |
|
12713 WindowCreationTrace == true ifTrue:[ |
|
12714 'WTextFieldPeer_create: ' print. frame print. ' -> ' print. editField printNL. |
|
12715 ]. |
|
12716 |
|
12717 "Created: / 5.1.1998 / 01:27:37 / cg" |
|
12718 "Modified: / 4.11.1998 / 21:07:30 / cg" |
|
12719 ! |
|
12720 |
|
12721 _WTextFieldPeer_setEchoCharacter:nativeContext |
|
12722 |editField char| |
|
12723 |
|
12724 editField := self viewForWPeer:nativeContext. |
|
12725 |
|
12726 char := nativeContext argAt:1. |
|
12727 editField passwordCharacter:(Character value:char). |
|
12728 |
|
12729 "Created: / 25.1.1998 / 16:28:30 / cg" |
|
12730 ! |
|
12731 |
|
12732 _WToolkit_beep:nativeContext |
|
12733 "/ void beep () |
|
12734 |
|
12735 Screen current beep |
|
12736 |
|
12737 "Created: / 12.11.1998 / 19:09:23 / cg" |
|
12738 "Modified: / 11.12.1998 / 12:15:23 / cg" |
|
12739 ! |
|
12740 |
|
12741 _WToolkit_eventLoop:nativeContext |
|
12742 (JavaEventThread notNil and:[JavaEventThread isDead not]) ifTrue:[ |
|
12743 'JavaVM [warning]: oops - two threads executing eventLoop' errorPrintCR. |
|
12744 ]. |
|
12745 |
|
12746 JavaEventThread := Processor activeProcess. |
|
12747 [ |
|
12748 [true] whileTrue:[ |
|
12749 AbortSignal handle:[:ex | |
|
12750 ex return |
|
12751 ] do:[ |
|
12752 self doWindowsEventThread. |
|
12753 ] |
|
12754 ]. |
|
12755 ] valueNowOrOnUnwindDo:[ |
|
12756 JavaEventThread := nil. |
|
12757 ]. |
|
12758 |
|
12759 "Created: / 6.1.1998 / 21:01:44 / cg" |
|
12760 "Modified: / 8.1.1999 / 17:08:00 / cg" |
|
12761 ! |
|
12762 |
|
12763 _WToolkit_getComboHeightOffset:nativeContext |
|
12764 ^ 0 |
|
12765 |
|
12766 "Modified: / 20.3.1997 / 13:50:04 / cg" |
|
12767 "Created: / 22.10.1998 / 00:59:14 / cg" |
|
12768 ! |
|
12769 |
|
12770 _WToolkit_getScreenHeight:nativeContext |
|
12771 ^ Screen current height |
|
12772 |
|
12773 "Modified: / 20.3.1997 / 13:50:04 / cg" |
|
12774 "Created: / 13.1.1998 / 09:24:45 / cg" |
|
12775 ! |
|
12776 |
|
12777 _WToolkit_getScreenResolution:nativeContext |
|
12778 ^ Screen current resolution x rounded |
|
12779 |
|
12780 "Modified: / 20.3.1997 / 13:50:04 / cg" |
|
12781 "Created: / 17.1.1998 / 21:54:48 / cg" |
|
12782 ! |
|
12783 |
|
12784 _WToolkit_getScreenWidth:nativeContext |
|
12785 ^ Screen current width |
|
12786 |
|
12787 "Modified: / 20.3.1997 / 13:50:04 / cg" |
|
12788 "Created: / 13.1.1998 / 09:24:37 / cg" |
|
12789 ! |
|
12790 |
|
12791 _WToolkit_init:nativeContext |
|
12792 |
|
12793 "Created: / 3.1.1998 / 02:30:57 / cg" |
|
12794 ! |
|
12795 |
|
12796 _WToolkit_loadSystemColors:nativeContext |
|
12797 "/ self halt. |
|
12798 |
|
12799 "Modified: / 18.3.1997 / 18:43:26 / cg" |
|
12800 "Created: / 5.1.1998 / 02:19:09 / cg" |
|
12801 ! |
|
12802 |
|
12803 _WToolkit_makeColorModel:nativeContext |
|
12804 "/ java.awt.image.ColorModel makeColorModel () |
|
12805 UnimplementedNativeMethodSignal raise |
|
12806 |
|
12807 "Created: / 12.11.1998 / 19:08:47 / cg" |
|
12808 ! |
|
12809 |
|
12810 _WToolkit_sync:nativeContext |
|
12811 "/ void sync () |
|
12812 UnimplementedNativeMethodSignal raise |
|
12813 |
|
12814 "Created: / 12.11.1998 / 19:09:14 / cg" |
|
12815 ! |
|
12816 |
|
12817 _WWindowPeer__setResizable:nativeContext |
|
12818 |view onOff| |
|
12819 |
|
12820 view := self viewForWPeer:nativeContext. |
|
12821 |
|
12822 onOff := (nativeContext argAt:1) == 1. |
|
12823 view isTopView ifTrue:[ |
|
12824 onOff ifTrue:[ |
|
12825 view minExtent:10@10. |
|
12826 view maxExtent:(Screen current extent). |
|
12827 ] ifFalse:[ |
|
12828 view minExtent:view extent. |
|
12829 view maxExtent:view extent. |
|
12830 ] |
|
12831 ] ifFalse:[ |
|
12832 (view isMemberOf:JavaEmbeddedFrameView) ifFalse:[ |
|
12833 self halt. |
|
12834 ] |
|
12835 ]. |
|
12836 |
|
12837 "/ 'JAVA: WWindowPeer_setResizable: ' print. view print. ' yes/no: ' print. onOff printNL. |
|
12838 |
|
12839 ^ nil |
|
12840 |
|
12841 "Created: / 5.1.1998 / 00:57:59 / cg" |
|
12842 "Modified: / 16.1.1998 / 18:08:00 / cg" |
|
12843 ! |
|
12844 |
|
12845 _WWindowPeer__setTitle:nativeContext |
|
12846 |view jString string| |
|
12847 |
|
12848 view := self viewForWPeer:nativeContext. |
|
12849 |
|
12850 jString := nativeContext argAt:1. |
|
12851 string := Java as_ST_String:jString. |
|
12852 |
|
12853 "/ 'JAVA: WWindowPeer_pSetTitle: ' print. string print. ' ' print. view printNL. |
|
12854 |
|
12855 view label:string. |
|
12856 ^ nil |
|
12857 |
|
12858 "Created: / 5.1.1998 / 00:57:17 / cg" |
|
12859 "Modified: / 8.1.1998 / 17:37:41 / cg" |
|
12860 ! |
|
12861 |
|
12862 _WWindowPeer_create:nativeContext |
|
12863 "/ void create (sun.awt.windows.WComponentPeer) |
|
12864 |jWindowPeer jWindow top window pDataIdx| |
|
12865 |
|
12866 jWindowPeer := nativeContext receiver. |
|
12867 |
|
12868 jWindow := jWindowPeer instVarNamed:'target'. |
|
12869 window := jWindowPeer instVarNamed:'pData'. |
|
12870 |
|
12871 (window notNil and:[window ~~ 0]) ifTrue:[ |
|
12872 WindowCreationTrace == true ifTrue:[ |
|
12873 'JAVA: window view already created: ' infoPrint. |
|
12874 jWindowPeer class name infoPrintCR. |
|
12875 ]. |
|
12876 ] ifFalse:[ |
|
12877 "/ OLD |
|
12878 "/ window := StandardSystemView new. |
|
12879 "/ self createdWindowsView:window for:jWindowPeer. |
|
12880 "/ JavaWindowGroup addTopView:window. |
|
12881 |
|
12882 window := JavaPopUpView new. |
|
12883 window borderWidth:0. |
|
12884 window level:0. |
|
12885 window delegate:self. |
|
12886 window javaPeer:jWindowPeer. |
|
12887 self createdWindowsView:window for:jWindowPeer. |
|
12888 JavaWindowGroup addTopView:window. |
|
12889 |
|
12890 "/ top := StandardSystemView new. |
|
12891 "/ window := JavaView origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
12892 "/ window delegate:self. |
|
12893 "/ window javaPeer:jWindowPeer. |
|
12894 "/ self createdWindowsView:window for:jWindowPeer. |
|
12895 "/ JavaWindowGroup addTopView:top. |
|
12896 |
|
12897 ]. |
|
12898 |
|
12899 WindowCreationTrace == true ifTrue:[ |
|
12900 'JAVA: WWindowPeer_create: ' print. jWindowPeer displayString print. |
|
12901 ' window: ' print. window printNL. |
|
12902 ]. |
|
12903 |
|
12904 "Created: / 4.1.1998 / 17:56:39 / cg" |
|
12905 "Modified: / 4.12.1998 / 17:37:59 / cg" |
|
12906 ! |
|
12907 |
|
12908 _WWindowPeer_getContainerElement:nativeContext |
|
12909 "/ java.awt.Component getContainerElement (java.awt.Container int) |
|
12910 UnimplementedNativeMethodSignal raise |
|
12911 |
|
12912 "Created: / 12.11.1998 / 19:10:54 / cg" |
|
12913 ! |
|
12914 |
|
12915 _WWindowPeer_toBack:nativeContext |
|
12916 |view| |
|
12917 |
|
12918 view := self viewForWPeer:nativeContext. |
|
12919 view lower. |
|
12920 |
|
12921 "Created: / 7.5.1998 / 00:23:03 / cg" |
|
12922 ! |
|
12923 |
|
12924 _WWindowPeer_toFront:nativeContext |
|
12925 |view| |
|
12926 |
|
12927 view := self viewForWPeer:nativeContext. |
|
12928 view raise. |
|
12929 |
|
12930 "Created: / 9.4.1998 / 22:17:28 / cg" |
|
12931 ! |
|
12932 |
|
12933 _WWindowPeer_updateInsets:nativeContext |
|
12934 "/ self halt. |
|
12935 |
|
12936 "Modified: / 18.3.1997 / 18:43:18 / cg" |
|
12937 "Created: / 4.1.1998 / 18:09:04 / cg" |
|
12938 ! |
|
12939 |
|
12940 _Win32Process_create:nativeContext |
|
12941 "really create a win32 process" |
|
12942 |
|
12943 |env cmd jProcess p inPipe outPipe errorPipe| |
|
12944 |
|
12945 jProcess := nativeContext receiver. |
|
12946 cmd := nativeContext argAt:1. |
|
12947 cmd := Java as_ST_String:cmd. |
|
12948 |
|
12949 env := nativeContext argAt:2. |
|
12950 env notNil ifTrue:[ |
|
12951 self halt |
|
12952 ]. |
|
12953 self halt. |
|
12954 |
|
12955 p := Win32Process new. |
|
12956 p command:cmd. |
|
12957 p environment:env. |
|
12958 p inStream:inPipe. |
|
12959 p outStream:outPipe. |
|
12960 p errorStream:errorPipe. |
|
12961 p directory:nil. |
|
12962 p startProcess. |
|
12963 self halt. |
|
12964 |
|
12965 jProcess instVarNamed:'handle' put:p. |
|
12966 |
|
12967 "Created: / 10.11.1998 / 19:50:31 / cg" |
|
12968 "Modified: / 10.11.1998 / 21:34:18 / cg" |
|
12969 ! |
|
12970 |
|
12971 _WinNTFileSystem_canonicalize0:aJavaContext |
|
12972 |
|
12973 | path | |
|
12974 |
|
12975 path := Java as_ST_String: (aJavaContext argAt: 1). |
|
12976 ^(Java as_String: path asFilename asAbsoluteFilename pathName) |
|
12977 |
|
12978 "Created: / 01-04-2011 / 23:00:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12979 ! |
|
12980 |
|
12981 _WinNTFileSystem_getBooleanAttributes:aJavaContext |
|
12982 |
|
12983 ^ self _UnixFileSystem_getBooleanAttributes0:aJavaContext |
|
12984 |
|
12985 "Created: / 01-04-2011 / 18:10:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12986 ! |
|
12987 |
|
12988 _X11FontMetrics_getMFCharSegmentWidth:nativeContext |
|
12989 "get multi-font string-segment width. |
|
12990 Not yet supported - use standard strings width" |
|
12991 |
|
12992 |jMetrics jFont jFontDescr stFont w |
|
12993 bool1 cp offs lenght bp int1| |
|
12994 |
|
12995 jMetrics := nativeContext receiver. |
|
12996 jFont := nativeContext argAt:1. |
|
12997 jFontDescr := nativeContext argAt:2. |
|
12998 cp := nativeContext argAt:3. |
|
12999 lenght := nativeContext argAt:4. |
|
13000 |
|
13001 stFont := jFont instVarNamed:'pData'. |
|
13002 (stFont isNil or:[stFont == 0]) ifTrue:[ |
|
13003 self halt |
|
13004 ]. |
|
13005 |
|
13006 stFont device isNil ifTrue:[ |
|
13007 stFont := stFont on:Display. |
|
13008 jFont instVarNamed:'pData' put:stFont. |
|
13009 ]. |
|
13010 w := stFont widthOf:cp from:1 to:lenght. |
|
13011 ^ w. |
|
13012 ! |
|
13013 |
|
13014 _X11FontMetrics_init:nativeContext |
|
13015 ^ self _WFontMetrics_init:nativeContext |
|
13016 ! |
|
13017 |
|
13018 _X11GraphicsDevice_getConfigType:nativeContext |
|
13019 "/ new with jdk1.2 ... |
|
13020 |
|
13021 |configNr cls| |
|
13022 |
|
13023 "/ for now, only one config. |
|
13024 configNr := nativeContext argAt:1. |
|
13025 |
|
13026 cls := Java classNamed:'java.awt.GraphicsDevice'. |
|
13027 ^ cls instVarNamed:'TYPE_RASTER_SCREEN'. |
|
13028 |
|
13029 "Created: / 28.1.1998 / 22:19:05 / cg" |
|
13030 ! |
|
13031 |
|
13032 _X11GraphicsDevice_getNumConfigs:nativeContext |
|
13033 "/ new with jdk1.2 ... |
|
13034 |
|
13035 ^ 1 |
|
13036 |
|
13037 "Created: / 28.1.1998 / 22:13:26 / cg" |
|
13038 "Modified: / 28.1.1998 / 22:14:33 / cg" |
|
13039 ! |
|
13040 |
|
13041 _X11GraphicsEnvironment_getNumScreens:nativeContext |
|
13042 "/ new with jdk1.2 ... |
|
13043 |
|
13044 "/ could return the actual number of screens ... |
|
13045 |
|
13046 ^ 1 |
|
13047 |
|
13048 "Created: / 28.1.1998 / 01:50:22 / cg" |
|
13049 "Modified: / 28.1.1998 / 22:12:32 / cg" |
|
13050 ! |
|
13051 |
|
13052 _X11GraphicsEnvironment_initDisplay:nativeContext |
|
13053 "/ new with jdk1.2 ... |
|
13054 |
|
13055 "Created: / 28.1.1998 / 01:50:22 / cg" |
|
13056 ! |
|
13057 |
|
13058 _X11Graphics_changeClip:nativeContext |
|
13059 ^ self _WGraphics_changeClip:nativeContext |
|
13060 ! |
|
13061 |
|
13062 _X11Graphics_createFromComponent:nativeContext |
|
13063 ^ self _WGraphics_createFromComponent:nativeContext |
|
13064 ! |
|
13065 |
|
13066 _X11Graphics_disposeImpl:nativeContext |
|
13067 ^ self _WGraphics_dispose:nativeContext |
|
13068 ! |
|
13069 |
|
13070 _X11Graphics_drawMFCharsSegment:nativeContext |
|
13071 ^ self _WGraphics_drawMFCharsSegment:nativeContext |
|
13072 ! |
|
13073 |
|
13074 _X11Graphics_drawRect:nativeContext |
|
13075 ^ self _WGraphics_drawRect:nativeContext |
|
13076 ! |
|
13077 |
|
13078 _X11Graphics_fillOval:nativeContext |
|
13079 ^ self _WGraphics_fillOval:nativeContext |
|
13080 ! |
|
13081 |
|
13082 _X11Graphics_fillRect:nativeContext |
|
13083 ^ self _WGraphics_fillRect:nativeContext |
|
13084 ! |
|
13085 |
|
13086 _X11Graphics_pSetFont:nativeContext |
|
13087 ^ self _WGraphics_pSetFont:nativeContext |
|
13088 ! |
|
13089 |
|
13090 _X11Graphics_pSetForeground:nativeContext |
|
13091 ^ self _WGraphics_pSetForeground:nativeContext |
|
13092 ! ! |
|
13093 |
|
13094 !JavaVM class methodsFor:'native - old-style (converted)'! |
|
13095 |
|
13096 _AccessController_doPrivileged:aJavaContext |
|
13097 |
|
13098 "Don't care about permissions :-)" |
|
13099 |
|
13100 ^(aJavaContext argAt:1) perform: #'run()Ljava/lang/Object;' |
|
13101 |
|
13102 "Created: / 20-10-2010 / 12:31:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13103 ! |
|
13104 |
|
13105 _AccessController_getStackAccessControlContext:nativeContext |
|
13106 "/ introduced with jdk1.2 |
|
13107 |
|
13108 "/ supposed to do more here ... |
|
13109 |
|
13110 ^ nil |
|
13111 |
|
13112 "Created: / 27.1.1998 / 18:22:15 / cg" |
|
13113 ! |
|
13114 |
|
13115 _Array_newArray:aJavaContext |
|
13116 |componentClass size| |
|
13117 |
|
13118 componentClass := self reflection |
|
13119 classForJavaClassObject:(aJavaContext argAt:1). |
|
13120 size := aJavaContext argAt:2. |
|
13121 ^ componentClass arrayClass new:size |
|
13122 |
|
13123 "Created: / 17-12-2010 / 14:49:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13124 "Modified: / 19-12-2010 / 17:54:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13125 "Modified: / 28-01-2011 / 15:18:50 / Marcel Hlopko <hlopik@gmail.com>" |
|
13126 ! |
|
13127 |
|
13128 _ClassLoader_NativeLibrary_load:nativeContext |
|
13129 "/ introduced with jdk1.2 ... (sigh) |
|
13130 |
|
13131 |nativeLoader jLibName libName libHandle index| |
|
13132 |
|
13133 nativeLoader := nativeContext receiver. |
|
13134 jLibName := nativeContext argAt:1. |
|
13135 libName := (Java as_ST_String:jLibName) asFilename baseName. |
|
13136 |
|
13137 (index := SimulatedNativeLibs indexOf:libName) ~~ 0 ifTrue:[ |
|
13138 "/ ('JAVA: builtIn nativeLibLoad simulated: ' , libName) printNL. |
|
13139 nativeLoader instVarNamed:'handle' put:index. |
|
13140 ^ self "/ void |
|
13141 ]. |
|
13142 (LoadedNativeLibs notNil |
|
13143 and:[LoadedNativeLibs includesKey:libName]) ifTrue:[ |
|
13144 "/ ('JAVA: native library already loaded: ' , libName) printNL. |
|
13145 nativeLoader instVarNamed:'handle' put:(LoadedNativeLibs at:libName). |
|
13146 ^ self "/ void |
|
13147 ]. |
|
13148 |
|
13149 (self confirm:'permission to load native library: ' , libName , ' ?') ifFalse:[ |
|
13150 ^ self |
|
13151 ]. |
|
13152 self halt. |
|
13153 |
|
13154 libName asFilename exists ifFalse:[ |
|
13155 ('JAVA: no file to load nativeLib: ' , libName) printNL. |
|
13156 ^ self "/ void |
|
13157 ]. |
|
13158 |
|
13159 libHandle := ObjectFileLoader loadLibrary:libName. |
|
13160 libHandle isNil ifTrue:[ |
|
13161 ('JAVA: failed to load nativeLib: ' , libName) printNL. |
|
13162 ^ self "/ void |
|
13163 ]. |
|
13164 |
|
13165 LoadedNativeLibs isNil ifTrue:[ |
|
13166 LoadedNativeLibs := Dictionary new. |
|
13167 ]. |
|
13168 |
|
13169 LoadedNativeLibs at:libName put:libHandle. |
|
13170 nativeLoader instVarNamed:'handle' put:(LoadedNativeLibs at:libName). |
|
13171 ^ self "/ void |
|
13172 |
|
13173 "Modified: / 06-02-1998 / 03:12:17 / cg" |
|
13174 "Created: / 10-12-2010 / 15:11:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13175 ! |
|
13176 |
|
13177 _ClassLoader_registerNatives:aJavaContext |
|
13178 |
|
13179 "Nothing to do" |
|
13180 |
|
13181 "Created: / 09-11-2010 / 20:55:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13182 ! |
|
13183 |
|
13184 _Class_desiredAssertionStatus0:aJavaContext |
|
13185 |
|
13186 ^AssertionsEnabled == true |
|
13187 |
|
13188 "Created: / 24-11-2010 / 08:58:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13189 ! |
|
13190 |
|
13191 _Class_forName0:aJavaContext |
|
13192 |
|
13193 | name initialize loader class | |
|
13194 name := Java as_ST_String: (aJavaContext argAt: 1). |
|
13195 initialize := aJavaContext argAt: 2. |
|
13196 loader := aJavaContext argAt: 3. |
|
13197 JavaClassReader classLoaderQuerySignal answer: loader do: |
|
13198 [class := Java classForName: name]. |
|
13199 class isNil ifTrue: |
|
13200 [^self throwClassNotFoundException: name]. |
|
13201 initialize ifTrue: |
|
13202 [[class classInit] on: Error do:[self throwExceptionInInitializerError:name]]. |
|
13203 ^JavaVM javaClassObjectForClass: class. |
|
13204 |
|
13205 "Created: / 24-11-2010 / 09:03:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13206 ! |
|
13207 |
|
13208 _Class_getClassLoader0:aJavaContext |
|
13209 "get a classes loader" |
|
13210 |
|
13211 |jClass cls loader| |
|
13212 |
|
13213 jClass := aJavaContext receiver. |
|
13214 cls := self reflection classForJavaClassObject:jClass. |
|
13215 loader := cls classLoader. |
|
13216 cls isNil ifTrue:[ |
|
13217 loader := (Java classForName:'java/lang/ClassLoader') |
|
13218 perform:#'getSystemClassLoader()Ljava/lang/ClassLoader;'. |
|
13219 |
|
13220 "/ ('JAVA: getClassLoader - ' , loader printString) infoPrintCR. |
|
13221 ]. |
|
13222 ^ loader |
|
13223 |
|
13224 "Created: / 25-10-2010 / 22:49:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13225 "Modified: / 09-11-2010 / 23:37:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13226 "Modified: / 28-01-2011 / 15:18:54 / Marcel Hlopko <hlopik@gmail.com>" |
|
13227 ! |
|
13228 |
|
13229 _Class_getComponentType:nativeContext |
|
13230 |cls| |
|
13231 |
|
13232 cls := self reflection classForJavaClassObject:(nativeContext receiver). |
|
13233 cls isJavaPrimitiveType ifTrue:[ |
|
13234 self breakPoint:#jv. |
|
13235 ^ nil |
|
13236 ]. |
|
13237 ^ self javaClassObjectForClass:cls javaComponentClass |
|
13238 |
|
13239 "Created: / 12-11-1998 / 18:54:46 / cg" |
|
13240 "Modified: / 20-12-2010 / 22:56:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13241 "Modified: / 28-01-2011 / 15:18:59 / Marcel Hlopko <hlopik@gmail.com>" |
|
13242 ! |
|
13243 |
|
13244 _Class_getConstantPool:aJavaContext |
|
13245 | class | |
|
13246 |
|
13247 class := self reflection classForJavaClassObject:aJavaContext receiver. |
|
13248 ^ self reflection javaConstantPoolObjectFor:class constantPool. |
|
13249 |
|
13250 "Created: / 21-12-2010 / 20:00:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13251 "Modified: / 28-02-2011 / 18:05:13 / Marcel Hlopko <hlopik@gmail.com>" |
|
13252 ! |
|
13253 |
|
13254 _Class_getDeclaredConstructors0:aJavaContext |
|
13255 |class publicOnly constructors| |
|
13256 |
|
13257 class := self reflection classForJavaClassObject:(aJavaContext receiver). |
|
13258 publicOnly := (aJavaContext argAt:1) == 1. |
|
13259 constructors := OrderedCollection new. |
|
13260 class |
|
13261 selectorsAndMethodsDo:[:selector :method | |
|
13262 (method isJavaMethod |
|
13263 and:[ |
|
13264 (selector at:1) == $< |
|
13265 and:[ |
|
13266 (selector startsWith:'<init>(') and:[publicOnly not or:[method isPublic]] |
|
13267 ] |
|
13268 ]) |
|
13269 ifTrue:[constructors add:(self reflection javaConstructorObjectForMethod:method)] |
|
13270 ]. |
|
13271 ^ (self classForName: 'java.lang.reflect.Constructor') |
|
13272 arrayClass withAll: constructors |
|
13273 |
|
13274 "Created: / 24-11-2010 / 09:25:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13275 "Modified: / 09-02-2011 / 01:24:03 / Marcel Hlopko <hlopik@gmail.com>" |
|
13276 "Modified: / 11-02-2011 / 08:55:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13277 ! |
|
13278 |
|
13279 _Class_getDeclaredFields0:aJavaContext |
|
13280 |javaClassObject class fields publicOnly| |
|
13281 |
|
13282 class := self reflection classForJavaClassObject:(javaClassObject := aJavaContext argAt:0). |
|
13283 publicOnly := (aJavaContext argAt:1) == 1. |
|
13284 fields := class fields. |
|
13285 publicOnly ifTrue: |
|
13286 [fields := fields select:[:f|f isPublic]]. |
|
13287 fields := fields collect:[:f | self javaFieldObjectForField:f in:javaClassObject]. |
|
13288 |
|
13289 ^ (self classForName: 'java.lang.reflect.Field') arrayClass |
|
13290 withAll:fields |
|
13291 |
|
13292 "Created: / 10-11-2010 / 16:22:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13293 "Modified: / 28-01-2011 / 15:19:06 / Marcel Hlopko <hlopik@gmail.com>" |
|
13294 "Modified: / 16-03-2011 / 15:43:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13295 ! |
|
13296 |
|
13297 _Class_getDeclaredMethods0:aJavaContext |
|
13298 |class publicOnly methods| |
|
13299 |
|
13300 class := self reflection classForJavaClassObject:(aJavaContext receiver). |
|
13301 publicOnly := (aJavaContext argAt:1) == 1. |
|
13302 methods := OrderedCollection new. |
|
13303 class |
|
13304 selectorsAndMethodsDo:[:selector :method | |
|
13305 (method isJavaMethod |
|
13306 and:[ |
|
13307 (selector at:1) ~~ $< |
|
13308 and:[ |
|
13309 (selector startsWith:'<init>(') not |
|
13310 and:[publicOnly not or:[method isPublic]] |
|
13311 ] |
|
13312 ]) |
|
13313 ifTrue:[methods add:(self javaMethodObjectForMethod:method)] |
|
13314 ]. |
|
13315 ^ (self classForName: 'java.lang.reflect.Method') |
|
13316 arrayClass withAll: methods asArray |
|
13317 |
|
13318 "Created: / 21-12-2010 / 22:39:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13319 "Modified: / 28-01-2011 / 15:19:09 / Marcel Hlopko <hlopik@gmail.com>" |
|
13320 "Modified: / 11-02-2011 / 08:35:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13321 ! |
|
13322 |
|
13323 _Class_getInterfaces:nativeContext |
|
13324 |jClass cls interfaces jInterfaces| |
|
13325 |
|
13326 jClass := nativeContext receiver. |
|
13327 cls := self reflection classForJavaClassObject:jClass. |
|
13328 cls isJavaPrimitiveType ifTrue:[ |
|
13329 ^ (self classForName:'java.lang.Class') arrayClass new |
|
13330 ]. |
|
13331 interfaces := cls interfaces. |
|
13332 interfaces ifNil:[^ (self classForName:'java.lang.Class') arrayClass new]. |
|
13333 jInterfaces := (self classForName:'java.lang.Class') arrayClass new:interfaces size. |
|
13334 interfaces withIndexDo: |
|
13335 [:iface :idx | jInterfaces at:idx put:(self javaClassObjectForClass:iface)]. |
|
13336 ^ jInterfaces |
|
13337 |
|
13338 "Modified: / 28-01-2011 / 15:19:11 / Marcel Hlopko <hlopik@gmail.com>" |
|
13339 "Modified: / 04-02-2011 / 09:43:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13340 ! |
|
13341 |
|
13342 _Class_getModifiers:aJavaContext |
|
13343 ^ (self reflection classForJavaClassObject:aJavaContext receiver) accessFlags |
|
13344 |
|
13345 "Created: / 12-11-1998 / 18:54:53 / cg" |
|
13346 "Modified: / 26-11-2010 / 10:25:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13347 "Modified: / 28-01-2011 / 15:19:14 / Marcel Hlopko <hlopik@gmail.com>" |
|
13348 ! |
|
13349 |
|
13350 _Class_getName0:aJavaContext |
|
13351 |class| |
|
13352 |
|
13353 class := aJavaContext receiver. |
|
13354 class := self reflection classForJavaClassObject:aJavaContext receiver. |
|
13355 ^ self reflection |
|
13356 javaStringObjectForString:class javaName |
|
13357 interned:true. |
|
13358 |
|
13359 "Created: / 22-11-2010 / 17:50:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13360 "Modified: / 09-02-2011 / 01:06:53 / Marcel Hlopko <hlopik@gmail.com>" |
|
13361 "Modified: / 25-02-2011 / 19:00:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13362 ! |
|
13363 |
|
13364 _Class_getPrimitiveClass:nativeContext |
|
13365 "get a primitive class by name" |
|
13366 |
|
13367 |jClassName className| |
|
13368 |
|
13369 jClassName := nativeContext argAt:1. |
|
13370 className := Java as_ST_String:jClassName. |
|
13371 (JavaDescriptor baseTypesByTypeName keys includes: className) |
|
13372 ifFalse:[self throwClassNotFoundException:className]. |
|
13373 ^self reflection javaClassObjectForClassNamed: className |
|
13374 |
|
13375 "Created: / 04-01-1998 / 00:46:03 / cg" |
|
13376 "Modified: / 28-01-2011 / 15:30:45 / Marcel Hlopko <hlopik@gmail.com>" |
|
13377 "Modified: / 03-02-2011 / 21:43:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13378 ! |
|
13379 |
|
13380 _Class_getRawAnnotations:aJavaContext |
|
13381 |class | |
|
13382 |
|
13383 class := self reflection classForJavaClassObject:aJavaContext receiver. |
|
13384 ^ class runtimeVisibleAnnotationsAsBytesOrNil |
|
13385 |
|
13386 "Created: / 21-12-2010 / 19:35:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13387 "Modified: / 28-01-2011 / 15:19:20 / Marcel Hlopko <hlopik@gmail.com>" |
|
13388 "Modified: / 25-02-2011 / 16:48:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13389 ! |
|
13390 |
|
13391 _Class_getSuperclass:nativeContext |
|
13392 "return a classes superclass" |
|
13393 |
|
13394 |jClass cls superCls| |
|
13395 |
|
13396 jClass := nativeContext receiver. |
|
13397 cls := self reflection classForJavaClassObject:jClass. |
|
13398 superCls := cls superclass. |
|
13399 superCls == JavaObject ifTrue:[ |
|
13400 ^ nil. |
|
13401 ]. |
|
13402 ^ self javaClassObjectForClass:superCls |
|
13403 |
|
13404 "Created: / 12-01-1998 / 12:38:36 / cg" |
|
13405 "Modified: / 04-02-1998 / 14:51:22 / cg" |
|
13406 "Modified: / 28-01-2011 / 14:12:47 / Marcel Hlopko <hlopik@gmail.com>" |
|
13407 "Modified: / 03-02-2011 / 22:53:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13408 ! |
|
13409 |
|
13410 _Class_isArray:nativeContext |
|
13411 ^ (self reflection classForJavaClassObject:nativeContext receiver) isJavaArrayClass |
|
13412 ifTrue:[1] |
|
13413 ifFalse:[0] |
|
13414 |
|
13415 "Created: / 12-11-1998 / 18:54:24 / cg" |
|
13416 "Modified: / 20-12-2010 / 23:20:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13417 "Modified: / 28-01-2011 / 15:19:24 / Marcel Hlopko <hlopik@gmail.com>" |
|
13418 ! |
|
13419 |
|
13420 _Class_isAssignableFrom:nativeContext |
|
13421 " |
|
13422 /** |
|
13423 * Determines if the class or interface represented by this |
|
13424 * {@code Class} object is either the same as, or is a superclass or |
|
13425 * superinterface of, the class or interface represented by the specified |
|
13426 * {@code Class} parameter. It returns {@code true} if so; |
|
13427 * otherwise it returns {@code false}. If this {@code Class} |
|
13428 * object represents a primitive type, this method returns |
|
13429 * {@code true} if the specified {@code Class} parameter is |
|
13430 * exactly this {@code Class} object; otherwise it returns |
|
13431 * {@code false}. |
|
13432 * |
|
13433 * <p> Specifically, this method tests whether the type represented by the |
|
13434 * specified {@code Class} parameter can be converted to the type |
|
13435 * represented by this {@code Class} object via an identity conversion |
|
13436 * or via a widening reference conversion. See <em>The Java Language |
|
13437 * Specification</em>, sections 5.1.1 and 5.1.4 , for details. |
|
13438 * |
|
13439 * @param cls the {@code Class} object to be checked |
|
13440 * @return the {@code boolean} value indicating whether objects of the |
|
13441 * type {@code cls} can be assigned to objects of this class |
|
13442 * @exception NullPointerException if the specified Class parameter is |
|
13443 * null. |
|
13444 * @since JDK1.1 |
|
13445 */ |
|
13446 " |
|
13447 | clsObj me other | |
|
13448 clsObj := nativeContext argAt: 1. |
|
13449 clsObj ifNil:[^self throwNullPointerException]. |
|
13450 me := self reflection classForJavaClassObject: nativeContext receiver. |
|
13451 other := self reflection classForJavaClassObject: clsObj. |
|
13452 |
|
13453 "/ Determines if the class or interface represented by this |
|
13454 "/ @code Class} object is either the same as, or is a superclass or |
|
13455 "/ superinterface of, the class or interface represented by the specified |
|
13456 "/ {@code Class} parameter. |
|
13457 |
|
13458 ^(other includesBehavior: me) |
|
13459 ifTrue:[1] |
|
13460 ifFalse:[0] |
|
13461 |
|
13462 "Created: / 12-11-1998 / 18:54:16 / cg" |
|
13463 "Modified: / 05-02-2011 / 23:38:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5790 ! |
13464 ! |
5791 |
13465 |
5792 _Class_isInstance:nativeContext |
13466 _Class_isInstance:nativeContext |
5793 " |
13467 " |
5794 /** |
13468 /** |
5833 ^self _INSTANCEOF:obj _:cls |
13507 ^self _INSTANCEOF:obj _:cls |
5834 |
13508 |
5835 "Modified: / 09-02-1998 / 14:56:23 / cg" |
13509 "Modified: / 09-02-1998 / 14:56:23 / cg" |
5836 "Modified: / 28-01-2011 / 14:12:42 / Marcel Hlopko <hlopik@gmail.com>" |
13510 "Modified: / 28-01-2011 / 14:12:42 / Marcel Hlopko <hlopik@gmail.com>" |
5837 "Modified: / 25-02-2011 / 18:37:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
13511 "Modified: / 25-02-2011 / 18:37:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5838 ! |
|
5839 |
|
5840 _Class_newInstance:nativeContext |
|
5841 "get an instance for a java.lang.Class" |
|
5842 |
|
5843 |jClass cls newInst| |
|
5844 |
|
5845 jClass := nativeContext receiver. |
|
5846 cls := self reflection javaClassObjectForClass:jClass. |
|
5847 cls classInit. |
|
5848 newInst := cls newCleared. |
|
5849 newInst perform:#'<init>()V'. |
|
5850 ^ newInst |
|
5851 |
|
5852 "Created: / 02-01-1998 / 22:41:38 / cg" |
|
5853 "Modified: / 15-01-1998 / 00:57:37 / cg" |
|
5854 "Modified: / 28-01-2011 / 14:12:25 / Marcel Hlopko <hlopik@gmail.com>" |
|
5855 ! |
|
5856 |
|
5857 _Class_setSigners:nativeContext |
|
5858 UnimplementedNativeMethodSignal raiseRequest |
|
5859 |
|
5860 "Modified: / 12.11.1998 / 18:52:07 / cg" |
|
5861 "Created: / 12.11.1998 / 18:55:08 / cg" |
|
5862 ! |
|
5863 |
|
5864 _ColorModel_deletepData:nativeContext |
|
5865 "/ void deletepData () |
|
5866 UnimplementedNativeMethodSignal raiseRequest |
|
5867 |
|
5868 "Created: / 12.11.1998 / 19:22:05 / cg" |
|
5869 ! |
|
5870 |
|
5871 _ColorModel_initIDs:nativeContext |
|
5872 "/ new with jdk1.2 ... |
|
5873 |
|
5874 "Created: / 28.1.1998 / 22:19:23 / cg" |
|
5875 ! |
|
5876 |
|
5877 _Color_initIDs:nativeContext |
|
5878 "/ new with jdk1.2 ... |
|
5879 |
|
5880 "Created: / 28.1.1998 / 22:19:23 / cg" |
|
5881 ! |
|
5882 |
|
5883 _Component_initIDs:nativeContext |
|
5884 "/ introduced with jdk1.2 ... (sigh) |
|
5885 |
|
5886 "Created: / 27.1.1998 / 19:53:29 / cg" |
|
5887 ! |
|
5888 |
|
5889 _ConstantPool_getDoubleAt0:nativeContext |
|
5890 | cpool index double | |
|
5891 |
|
5892 cpool := self reflection constantPoolFor:(nativeContext receiver). |
|
5893 self breakPoint:#mh. |
|
5894 index := nativeContext at:3. |
|
5895 "TODO: why 3?" |
|
5896 double := cpool at:index. |
|
5897 self assert:double isFloat description:'Not a float constant!!'. |
|
5898 ^ double |
|
5899 |
|
5900 "Modified: / 25-02-2011 / 18:40:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
5901 "Created: / 28-02-2011 / 17:24:17 / Marcel Hlopko <hlopik@gmail.com>" |
|
5902 ! |
|
5903 |
|
5904 _ConstantPool_getIntAt0:nativeContext |
|
5905 | cpool index int | |
|
5906 |
|
5907 cpool := self reflection constantPoolFor:(nativeContext receiver). |
|
5908 index := nativeContext at:3. |
|
5909 "TODO: why 3?" |
|
5910 int := cpool at:index. |
|
5911 self assert:int isInteger description:'Not an integer constant!!'. |
|
5912 ^ int |
|
5913 |
|
5914 "Modified: / 25-02-2011 / 18:40:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
5915 "Created: / 28-02-2011 / 17:28:10 / Marcel Hlopko <hlopik@gmail.com>" |
|
5916 ! |
|
5917 |
|
5918 _ConstantPool_getLongAt0:nativeContext |
|
5919 | cpool index long | |
|
5920 |
|
5921 cpool := self reflection constantPoolFor:(nativeContext receiver). |
|
5922 index := nativeContext at:3. |
|
5923 "TODO: why 3?" |
|
5924 long := cpool at:index. |
|
5925 self assert:long isInteger description:'Not a float constant!!'. |
|
5926 ^ long |
|
5927 |
|
5928 "Modified: / 28-02-2011 / 17:40:02 / Marcel Hlopko <hlopik@gmail.com>" |
|
5929 "Modified: / 28-02-2011 / 18:54:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
5930 ! |
|
5931 |
|
5932 _ConstantPool_getUTF8At0: nativeContext |
|
5933 |
|
5934 | cpool index string | |
|
5935 cpool := self reflection constantPoolFor: (nativeContext receiver). |
|
5936 index := nativeContext at: 3. |
|
5937 "TODO: why 3?" |
|
5938 |
|
5939 string := cpool at: index. |
|
5940 self assert: string isString description: 'Not an UTF8 constant!!'. |
|
5941 ^Java as_String: string |
|
5942 |
|
5943 "Created: / 06-02-2011 / 12:56:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
5944 ! |
|
5945 |
|
5946 _Constructor_getModifiers:nativeContext |
|
5947 "/ int getModifiers () |
|
5948 |
|
5949 UnimplementedNativeMethodSignal raiseRequest. |
|
5950 |
|
5951 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
5952 "Created: / 27.1.2000 / 02:54:38 / cg" |
|
5953 ! |
|
5954 |
|
5955 _Constructor_newInstance:nativeContext |
|
5956 "/ java.lang.Object newInstance (java.lang.Object[]) |
|
5957 |
|
5958 UnimplementedNativeMethodSignal raiseRequest. |
|
5959 |
|
5960 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
5961 ! |
|
5962 |
|
5963 _Double_doubleToLongBits:nativeContext |
|
5964 |f i| |
|
5965 |
|
5966 f := nativeContext argAt:1. |
|
5967 |
|
5968 UninterpretedBytes isBigEndian ifTrue:[ |
|
5969 i := f basicAt:8. |
|
5970 i := i bitOr:((f basicAt:7) bitShift:8). |
|
5971 i := i bitOr:((f basicAt:6) bitShift:16). |
|
5972 i := i bitOr:((f basicAt:5) bitShift:24). |
|
5973 i := i bitOr:((f basicAt:4) bitShift:32). |
|
5974 i := i bitOr:((f basicAt:3) bitShift:40). |
|
5975 i := i bitOr:((f basicAt:2) bitShift:48). |
|
5976 i := i bitOr:((f basicAt:1) bitShift:56). |
|
5977 ] ifFalse:[ |
|
5978 i := f basicAt:1. |
|
5979 i := i bitOr:((f basicAt:2) bitShift:8). |
|
5980 i := i bitOr:((f basicAt:3) bitShift:16). |
|
5981 i := i bitOr:((f basicAt:4) bitShift:24). |
|
5982 i := i bitOr:((f basicAt:5) bitShift:32). |
|
5983 i := i bitOr:((f basicAt:6) bitShift:40). |
|
5984 i := i bitOr:((f basicAt:7) bitShift:48). |
|
5985 i := i bitOr:((f basicAt:8) bitShift:56). |
|
5986 ]. |
|
5987 |
|
5988 ^ i. |
|
5989 |
|
5990 "Created: / 4.1.1998 / 01:39:12 / cg" |
|
5991 ! |
|
5992 |
|
5993 _Double_longBitsToDouble:nativeContext |
|
5994 |i aFloat| |
|
5995 |
|
5996 i := nativeContext argAt:1. |
|
5997 |
|
5998 aFloat := Float new. |
|
5999 UninterpretedBytes isBigEndian ifTrue:[ |
|
6000 aFloat basicAt:1 put:((i bitShift:-56) bitAnd:16rFF). |
|
6001 aFloat basicAt:2 put:((i bitShift:-48) bitAnd:16rFF). |
|
6002 aFloat basicAt:3 put:((i bitShift:-40) bitAnd:16rFF). |
|
6003 aFloat basicAt:4 put:((i bitShift:-32) bitAnd:16rFF). |
|
6004 aFloat basicAt:5 put:((i bitShift:-24) bitAnd:16rFF). |
|
6005 aFloat basicAt:6 put:((i bitShift:-16) bitAnd:16rFF). |
|
6006 aFloat basicAt:7 put:((i bitShift:-8) bitAnd:16rFF). |
|
6007 aFloat basicAt:8 put:(i bitAnd:16rFF). |
|
6008 ] ifFalse:[ |
|
6009 aFloat basicAt:1 put:(i bitAnd:16rFF). |
|
6010 aFloat basicAt:2 put:((i bitShift:-8) bitAnd:16rFF). |
|
6011 aFloat basicAt:3 put:((i bitShift:-16) bitAnd:16rFF). |
|
6012 aFloat basicAt:4 put:((i bitShift:-24) bitAnd:16rFF). |
|
6013 aFloat basicAt:5 put:((i bitShift:-32) bitAnd:16rFF). |
|
6014 aFloat basicAt:6 put:((i bitShift:-40) bitAnd:16rFF). |
|
6015 aFloat basicAt:7 put:((i bitShift:-48) bitAnd:16rFF). |
|
6016 aFloat basicAt:8 put:((i bitShift:-56) bitAnd:16rFF). |
|
6017 ]. |
|
6018 |
|
6019 ^ aFloat. |
|
6020 |
|
6021 "Created: / 4.1.1998 / 01:45:00 / cg" |
|
6022 ! |
|
6023 |
|
6024 _Double_valueOf0:nativeContext |
|
6025 |s d| |
|
6026 |
|
6027 s := nativeContext argAt:1. |
|
6028 s notNil ifTrue:[ |
|
6029 s := Java as_ST_String:s. |
|
6030 d := Float readFrom:s onError:nil. |
|
6031 ]. |
|
6032 d isNil ifTrue:[ |
|
6033 self throwNumberFormatException. |
|
6034 "/ not reached |
|
6035 ]. |
|
6036 |
|
6037 ^ d |
|
6038 |
|
6039 "Modified: / 8.8.1997 / 12:03:55 / cg" |
|
6040 "Created: / 7.1.1998 / 11:09:43 / cg" |
|
6041 ! |
|
6042 |
|
6043 _Field_get:nativeContext |
|
6044 "/ java.lang.Object get (java.lang.Object) |
|
6045 |
|
6046 UnimplementedNativeMethodSignal raiseRequest. |
|
6047 |
|
6048 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6049 "Created: / 27.1.2000 / 03:04:18 / cg" |
|
6050 ! |
|
6051 |
|
6052 _Field_getBoolean:nativeContext |
|
6053 "/ boolean getBoolean (java.lang.Object) |
|
6054 |
|
6055 UnimplementedNativeMethodSignal raiseRequest. |
|
6056 |
|
6057 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6058 "Created: / 27.1.2000 / 03:05:16 / cg" |
|
6059 ! |
|
6060 |
|
6061 _Field_getByte:nativeContext |
|
6062 "/ byte getByte (java.lang.Object) |
|
6063 |
|
6064 UnimplementedNativeMethodSignal raiseRequest. |
|
6065 |
|
6066 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6067 "Created: / 27.1.2000 / 03:05:30 / cg" |
|
6068 ! |
|
6069 |
|
6070 _Field_getChar:nativeContext |
|
6071 "/ char getChar (java.lang.Object) |
|
6072 |
|
6073 UnimplementedNativeMethodSignal raiseRequest. |
|
6074 |
|
6075 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6076 "Created: / 27.1.2000 / 03:03:37 / cg" |
|
6077 ! |
|
6078 |
|
6079 _Field_getDouble:nativeContext |
|
6080 "/ double getDouble (java.lang.Object) |
|
6081 |
|
6082 UnimplementedNativeMethodSignal raiseRequest. |
|
6083 |
|
6084 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6085 "Created: / 27.1.2000 / 03:07:49 / cg" |
|
6086 ! |
|
6087 |
|
6088 _Field_getFloat:nativeContext |
|
6089 "/ float getFloat (java.lang.Object) |
|
6090 |
|
6091 UnimplementedNativeMethodSignal raiseRequest. |
|
6092 |
|
6093 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6094 "Created: / 27.1.2000 / 03:05:41 / cg" |
|
6095 ! |
|
6096 |
|
6097 _Field_getInt:nativeContext |
|
6098 "/ int getInt (java.lang.Object) |
|
6099 |
|
6100 UnimplementedNativeMethodSignal raiseRequest. |
|
6101 |
|
6102 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6103 "Created: / 27.1.2000 / 03:04:47 / cg" |
|
6104 ! |
|
6105 |
|
6106 _Field_getLong:nativeContext |
|
6107 "/ long getLong (java.lang.Object) |
|
6108 |
|
6109 UnimplementedNativeMethodSignal raiseRequest. |
|
6110 |
|
6111 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6112 "Created: / 27.1.2000 / 03:05:54 / cg" |
|
6113 ! |
|
6114 |
|
6115 _Field_getModifiers:nativeContext |
|
6116 "/ int getModifiers () |
|
6117 |
|
6118 UnimplementedNativeMethodSignal raiseRequest. |
|
6119 |
|
6120 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6121 "Created: / 27.1.2000 / 03:07:03 / cg" |
|
6122 ! |
|
6123 |
|
6124 _Field_getShort:nativeContext |
|
6125 "/ unsigned short getShort (java.lang.Object) |
|
6126 |
|
6127 UnimplementedNativeMethodSignal raiseRequest. |
|
6128 |
|
6129 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6130 "Created: / 27.1.2000 / 03:07:35 / cg" |
|
6131 ! |
|
6132 |
|
6133 _Field_set:nativeContext |
|
6134 "/ void set (java.lang.Object java.lang.Object) |
|
6135 |
|
6136 UnimplementedNativeMethodSignal raiseRequest. |
|
6137 |
|
6138 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6139 "Created: / 27.1.2000 / 03:04:33 / cg" |
|
6140 ! |
|
6141 |
|
6142 _Field_setBoolean:nativeContext |
|
6143 "/ void setBoolean (java.lang.Object boolean) |
|
6144 |
|
6145 UnimplementedNativeMethodSignal raiseRequest. |
|
6146 |
|
6147 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6148 "Created: / 27.1.2000 / 03:06:06 / cg" |
|
6149 ! |
|
6150 |
|
6151 _Field_setByte:nativeContext |
|
6152 "/ void setByte (java.lang.Object byte) |
|
6153 |
|
6154 UnimplementedNativeMethodSignal raiseRequest. |
|
6155 |
|
6156 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6157 "Created: / 27.1.2000 / 03:06:20 / cg" |
|
6158 ! |
|
6159 |
|
6160 _Field_setChar:nativeContext |
|
6161 "/ void setChar (java.lang.Object char) |
|
6162 |
|
6163 UnimplementedNativeMethodSignal raiseRequest. |
|
6164 |
|
6165 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6166 "Created: / 27.1.2000 / 03:03:48 / cg" |
|
6167 ! |
|
6168 |
|
6169 _Field_setDouble:nativeContext |
|
6170 "/ void setDouble (java.lang.Object double) |
|
6171 |
|
6172 UnimplementedNativeMethodSignal raiseRequest. |
|
6173 |
|
6174 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6175 "Created: / 27.1.2000 / 03:04:02 / cg" |
|
6176 ! |
|
6177 |
|
6178 _Field_setFloat:nativeContext |
|
6179 "/ void setFloat (java.lang.Object float) |
|
6180 |
|
6181 UnimplementedNativeMethodSignal raiseRequest. |
|
6182 |
|
6183 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6184 "Created: / 27.1.2000 / 03:06:48 / cg" |
|
6185 ! |
|
6186 |
|
6187 _Field_setInt:nativeContext |
|
6188 "/ void setInt (java.lang.Object int) |
|
6189 |
|
6190 UnimplementedNativeMethodSignal raiseRequest. |
|
6191 |
|
6192 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6193 "Created: / 27.1.2000 / 03:05:04 / cg" |
|
6194 ! |
|
6195 |
|
6196 _Field_setLong:nativeContext |
|
6197 "/ void setLong (java.lang.Object long) |
|
6198 |
|
6199 UnimplementedNativeMethodSignal raiseRequest. |
|
6200 |
|
6201 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6202 "Created: / 27.1.2000 / 03:06:37 / cg" |
|
6203 ! |
|
6204 |
|
6205 _Field_setShort:nativeContext |
|
6206 "/ void setShort (java.lang.Object unsigned short) |
|
6207 |
|
6208 UnimplementedNativeMethodSignal raiseRequest. |
|
6209 |
|
6210 "Modified: / 27.1.2000 / 02:53:55 / cg" |
|
6211 "Created: / 27.1.2000 / 03:03:23 / cg" |
|
6212 ! |
|
6213 |
|
6214 _FileDescriptor_initSystemFD:nativeContext |
|
6215 |descriptor fileNo idx myStream| |
|
6216 |
|
6217 descriptor := nativeContext argAt:1. |
|
6218 fileNo := nativeContext argAt:2. |
|
6219 |
|
6220 fileNo == 0 ifTrue:[ |
|
6221 myStream := Stdin |
|
6222 ] ifFalse:[ |
|
6223 fileNo == 1 ifTrue:[ |
|
6224 myStream := JavaConsoleStream ? Stdout |
|
6225 ] ifFalse:[ |
|
6226 fileNo == 2 ifTrue:[ |
|
6227 myStream := JavaConsoleStream ? Stderr |
|
6228 ] ifFalse:[ |
|
6229 self halt:'invalid fileNo given'. |
|
6230 self internalError:'invalid fileNo given'. |
|
6231 ] |
|
6232 ] |
|
6233 ]. |
|
6234 |
|
6235 self setOpenFile:myStream at:fileNo. |
|
6236 |
|
6237 descriptor instVarNamed:'fd' put:fileNo. |
|
6238 ^ descriptor |
|
6239 |
|
6240 "Modified: / 27.1.1998 / 18:15:28 / cg" |
|
6241 ! |
|
6242 |
|
6243 _FileDescriptor_sync:nativeContext |
|
6244 "/ void sync () |
|
6245 UnimplementedNativeMethodSignal raiseRequest |
|
6246 |
|
6247 "Modified: / 12.11.1998 / 18:57:39 / cg" |
|
6248 "Created: / 12.11.1998 / 19:26:25 / cg" |
|
6249 ! |
|
6250 |
|
6251 _FileDescriptor_valid:nativeContext |
|
6252 "/ boolean valid () |
|
6253 |descriptor fileNo stream| |
|
6254 |
|
6255 descriptor := nativeContext receiver. |
|
6256 fileNo := descriptor instVarNamed:'fd'. |
|
6257 stream := self getOpenFileAt:fileNo. |
|
6258 stream isNil ifTrue:[^ 0]. "/ FALSE |
|
6259 stream isOpen ifFalse:[^ 0]. "/ FALSE |
|
6260 |
|
6261 ^ 1 "/ TRUE |
|
6262 |
|
6263 "Modified: / 11.12.1998 / 13:02:47 / cg" |
|
6264 ! |
|
6265 |
|
6266 _FileInputStream_available:nativeContext |
|
6267 |file| |
|
6268 |
|
6269 file := self validateFile:(nativeContext receiver). |
|
6270 file isNil ifTrue:[ |
|
6271 self throwIOExceptionWithMessage:'invalid fileNo in available'. |
|
6272 ^ self |
|
6273 ]. |
|
6274 file == Stdin ifTrue:[ |
|
6275 file := StdinReplacementFileQuerySignal raiseRequest. |
|
6276 file isNil ifTrue:[ |
|
6277 ^ 1 |
|
6278 ] |
|
6279 ]. |
|
6280 file isFileStream ifTrue:[ |
|
6281 ^ file size - file position + 1 |
|
6282 ]. |
|
6283 file atEnd ifTrue:[ |
|
6284 ^ 0. |
|
6285 ]. |
|
6286 self halt. |
|
6287 ^ 1 |
|
6288 |
|
6289 "Modified: / 14.1.1998 / 15:12:52 / cg" |
|
6290 ! |
|
6291 |
|
6292 _FileInputStream_close:nativeContext |
|
6293 ^ self anyStream_close:nativeContext |
|
6294 |
|
6295 "Created: / 4.1.1998 / 17:45:23 / cg" |
|
6296 "Modified: / 4.2.1998 / 15:20:46 / cg" |
|
6297 ! |
|
6298 |
|
6299 _FileInputStream_open:nativeContext |
|
6300 |fs fd fn name stream fileNo| |
|
6301 |
|
6302 fs := nativeContext receiver. |
|
6303 fd := fs instVarNamed:'fd'. |
|
6304 (fileNo := fd instVarNamed:'fd') ~~ 0 ifTrue:[ |
|
6305 fileNo ~~ -1 ifTrue:[ |
|
6306 self halt:'file already open'. |
|
6307 self internalError:'file already open'. |
|
6308 ^ self. |
|
6309 ] |
|
6310 ]. |
|
6311 |
|
6312 name := nativeContext argAt:1. |
|
6313 name := Java as_ST_String:name. |
|
6314 |
|
6315 name := self fixFilename:name. |
|
6316 |
|
6317 FileOpenTrace ifTrue:[ |
|
6318 ('JAVA: opening ' , name) infoPrintCR. |
|
6319 ]. |
|
6320 |
|
6321 stream := self fileStreamForReading:name. |
|
6322 stream isNil ifTrue:[ |
|
6323 FileOpenTrace ifTrue:[ |
|
6324 ('JAVA: failed to open ''' , name , ''' for reading.') infoPrintCR. |
|
6325 ]. |
|
6326 |
|
6327 self throwIOExceptionWithMessage:('cannot open ' , name , ' for reading'). |
|
6328 |
|
6329 ^ self. |
|
6330 ]. |
|
6331 stream buffered:false. |
|
6332 |
|
6333 "/ FileOpenConfirmation ifTrue:[ |
|
6334 "/ (self confirm:('JAVA Security check\\Opening ''' , name , ''' for reading.\Grant permission ?') withCRs) |
|
6335 "/ ifFalse:[ |
|
6336 "/ self throwIOExceptionWithMessage:('no permission to open ' , name , ' for reading'). |
|
6337 "/ ^ self |
|
6338 "/ ] |
|
6339 "/ ]. |
|
6340 |
|
6341 fileNo := self addOpenFile:stream. |
|
6342 |
|
6343 FileOpenTrace ifTrue:[ |
|
6344 ('JAVA: opened ' , name , ' as FD ' , fileNo printString) infoPrintCR. |
|
6345 ]. |
|
6346 |
|
6347 fd instVarNamed:'fd' put:fileNo. |
|
6348 |
|
6349 "Created: / 4.1.1998 / 16:47:12 / cg" |
|
6350 "Modified: / 28.1.1999 / 17:24:07 / cg" |
|
6351 ! |
|
6352 |
|
6353 _FileInputStream_read:nativeContext |
|
6354 |file byte| |
|
6355 |
|
6356 file := self validateFile:(nativeContext receiver). |
|
6357 |
|
6358 file == Stdin ifTrue:[ |
|
6359 file := StdinReplacementFileQuerySignal raiseRequest. |
|
6360 file isNil ifTrue:[ |
|
6361 ^ -1 |
|
6362 ] |
|
6363 ]. |
|
6364 |
|
6365 FileIOTrace ifTrue:[ |
|
6366 ('JAVA: read 1 byte from ' , file pathName) infoPrintCR. |
|
6367 ]. |
|
6368 |
|
6369 byte := file nextByte. |
|
6370 byte isNil ifTrue:[ |
|
6371 ^ -1 |
|
6372 ]. |
|
6373 ^ byte |
|
6374 |
|
6375 "Created: / 5.1.1998 / 02:17:08 / cg" |
|
6376 "Modified: / 5.1.1998 / 02:17:25 / cg" |
|
6377 ! |
|
6378 |
|
6379 _FileInputStream_readBytes:nativeContext |
|
6380 ^ self anyStream_readBytes:nativeContext |
|
6381 |
|
6382 "Modified: / 4.2.1998 / 15:23:08 / cg" |
|
6383 ! |
|
6384 |
|
6385 _FileInputStream_skip:nativeContext |
|
6386 "/ long skip (long) |
|
6387 |file nSkip nSkipped| |
|
6388 |
|
6389 file := self validateFile:(nativeContext receiver). |
|
6390 nSkip := nativeContext argAt:1. |
|
6391 |
|
6392 file == Stdin ifTrue:[ |
|
6393 file := StdinReplacementFileQuerySignal raiseRequest. |
|
6394 file isNil ifTrue:[ |
|
6395 ^ -1 |
|
6396 ] |
|
6397 ]. |
|
6398 |
|
6399 FileIOTrace ifTrue:[ |
|
6400 (('JAVA: skip %1 byte(s) from ' bindWith:nSkip printString) , file pathName) infoPrintCR. |
|
6401 ]. |
|
6402 |
|
6403 file skip:nSkip. |
|
6404 ^ nSkip |
|
6405 |
|
6406 "Modified: / 27.1.1999 / 20:36:11 / cg" |
|
6407 ! |
|
6408 |
|
6409 _FileOutputStream_close:nativeContext |
|
6410 ^ self anyStream_close:nativeContext |
|
6411 |
|
6412 "Created: / 13.1.1998 / 09:33:16 / cg" |
|
6413 "Modified: / 4.2.1998 / 15:20:53 / cg" |
|
6414 ! |
|
6415 |
|
6416 _FileOutputStream_open:nativeContext |
|
6417 ^ self commonOpen:nativeContext forAppend:false |
|
6418 |
|
6419 "Modified: / 7.4.1998 / 19:14:31 / cg" |
|
6420 ! |
|
6421 |
|
6422 _FileOutputStream_openAppend:nativeContext |
|
6423 ^ self commonOpen:nativeContext forAppend:true |
|
6424 |
|
6425 "Modified: / 7.4.1998 / 19:13:42 / cg" |
|
6426 ! |
|
6427 |
|
6428 _File_canRead0:nativeContext |
|
6429 |file path f| |
|
6430 |
|
6431 file := nativeContext receiver. |
|
6432 path := file instVarNamed:'path'. |
|
6433 path notNil ifTrue:[ |
|
6434 path := Java as_ST_String:path. |
|
6435 |
|
6436 FileAccessTrace == true ifTrue:[ |
|
6437 path storeString print. ' ' print. thisContext printCR |
|
6438 ]. |
|
6439 |
|
6440 path := self fixFilename:path. |
|
6441 (f := path asFilename) isReadable ifTrue:[ |
|
6442 ^ 1 "/ TRUE |
|
6443 ] |
|
6444 ]. |
|
6445 ^ 0 "/ FALSE |
|
6446 |
|
6447 "Created: / 4.1.1998 / 18:09:55 / cg" |
|
6448 "Modified: / 27.1.1999 / 18:57:55 / cg" |
|
6449 ! |
|
6450 |
|
6451 _File_canWrite0:nativeContext |
|
6452 |file path f| |
|
6453 |
|
6454 file := nativeContext receiver. |
|
6455 path := file instVarNamed:'path'. |
|
6456 path notNil ifTrue:[ |
|
6457 FileAccessTrace == true ifTrue:[ |
|
6458 path storeString print. ' ' print. thisContext printCR |
|
6459 ]. |
|
6460 path := Java as_ST_String:path. |
|
6461 path := self fixFilename:path. |
|
6462 (f := path asFilename) isWritable ifTrue:[ |
|
6463 ^ 1 "/ TRUE |
|
6464 ] |
|
6465 ]. |
|
6466 ^ 0 "/ FALSE |
|
6467 |
|
6468 "Created: / 4.2.1998 / 00:19:55 / cg" |
|
6469 "Modified: / 27.1.1999 / 18:57:52 / cg" |
|
6470 ! |
|
6471 |
|
6472 _File_canonPath:nativeContext |
|
6473 "/ introduced with jdk1.2 ... (sigh) |
|
6474 |
|
6475 |jPath path realPath| |
|
6476 |
|
6477 jPath := nativeContext argAt:1. |
|
6478 jPath isNil ifTrue:[^ jPath]. |
|
6479 |
|
6480 path := Java as_ST_String:jPath. |
|
6481 realPath := path asFilename pathName. |
|
6482 |
|
6483 ^ Java as_String:realPath |
|
6484 |
|
6485 "Created: / 27.1.1998 / 18:35:58 / cg" |
|
6486 "Modified: / 27.1.1998 / 21:36:03 / cg" |
|
6487 ! |
|
6488 |
|
6489 _File_delete0:nativeContext |
|
6490 "/ boolean delete0 () |
|
6491 |oldFile oldPath oldF| |
|
6492 |
|
6493 oldFile := nativeContext receiver. |
|
6494 oldPath := oldFile instVarNamed:'path'. |
|
6495 oldPath isNil ifTrue:[^ 0]. "/ FALSE |
|
6496 |
|
6497 oldPath := Java as_ST_String:oldPath. |
|
6498 oldF := oldPath asFilename. |
|
6499 |
|
6500 oldF exists ifFalse:[ |
|
6501 ^ 1 "/ TRUE |
|
6502 ]. |
|
6503 |
|
6504 (self checkWritePermissionOfDirectory:oldF directory message:('JAVA Security check\\Delete of ''' , oldPath , '''.\Grant permission ?')) |
|
6505 ifFalse:[ |
|
6506 ^ 0 "/ FALSE |
|
6507 ]. |
|
6508 |
|
6509 OperatingSystem accessDeniedErrorSignal handle:[:ex | |
|
6510 ^ 0 "/ FALSE |
|
6511 ] do:[ |
|
6512 oldF delete. |
|
6513 ^ 1 "/ TRUE |
|
6514 ]. |
|
6515 ^ 0 "/ FALSE |
|
6516 |
|
6517 "Modified: / 30.12.1998 / 20:15:06 / cg" |
|
6518 ! |
|
6519 |
|
6520 _File_exists0:nativeContext |
|
6521 |file path f| |
|
6522 |
|
6523 file := nativeContext receiver. |
|
6524 path := file instVarNamed:'path'. |
|
6525 path notNil ifTrue:[ |
|
6526 path := Java as_ST_String:path. |
|
6527 path := self fixFilename:path. |
|
6528 FileAccessTrace == true ifTrue:[ |
|
6529 path storeString print. ' ' print. thisContext printCR |
|
6530 ]. |
|
6531 (f := path asFilename) exists ifTrue:[ |
|
6532 ^ 1 "TRUE" |
|
6533 ] |
|
6534 ]. |
|
6535 ^ 0 "FALSE" |
|
6536 |
|
6537 "Created: / 5.1.1998 / 02:07:48 / cg" |
|
6538 "Modified: / 27.1.1999 / 18:57:46 / cg" |
|
6539 ! |
|
6540 |
|
6541 _File_initIDs:nativeContext |
|
6542 "/ introduced with jdk1.2 ... (sigh) |
|
6543 |
|
6544 "Created: / 27.1.1998 / 18:25:19 / cg" |
|
6545 ! |
|
6546 |
|
6547 _File_isAbsolute:nativeContext |
|
6548 |file path f| |
|
6549 |
|
6550 file := nativeContext receiver. |
|
6551 path := file instVarNamed:'path'. |
|
6552 path notNil ifTrue:[ |
|
6553 path := Java as_ST_String:path. |
|
6554 path := self fixFilename:path. |
|
6555 (f := path asFilename) isAbsolute ifTrue:[ |
|
6556 ^ 1 "/ TRUE |
|
6557 ] |
|
6558 ]. |
|
6559 ^ 0 "/ FALSE |
|
6560 |
|
6561 "Created: / 11.1.1998 / 09:54:38 / cg" |
|
6562 "Modified: / 20.10.1998 / 20:59:53 / cg" |
|
6563 ! |
|
6564 |
|
6565 _File_isDirectory0:nativeContext |
|
6566 |file path f| |
|
6567 |
|
6568 file := nativeContext receiver. |
|
6569 path := file instVarNamed:'path'. |
|
6570 path notNil ifTrue:[ |
|
6571 FileAccessTrace == true ifTrue:[ |
|
6572 path storeString print. ' ' print. thisContext printCR |
|
6573 ]. |
|
6574 path := Java as_ST_String:path. |
|
6575 path := self fixFilename:path. |
|
6576 (f := path asFilename) exists ifTrue:[ |
|
6577 f isDirectory ifTrue:[^ 1 "TRUE"] |
|
6578 ] |
|
6579 ]. |
|
6580 ^ 0 "FALSE" |
|
6581 |
|
6582 "Created: / 7.1.1998 / 10:31:37 / cg" |
|
6583 "Modified: / 27.1.1999 / 18:58:01 / cg" |
|
6584 ! |
|
6585 |
|
6586 _File_isFile0:nativeContext |
|
6587 |file path f| |
|
6588 |
|
6589 file := nativeContext receiver. |
|
6590 path := file instVarNamed:'path'. |
|
6591 path notNil ifTrue:[ |
|
6592 FileAccessTrace == true ifTrue:[ |
|
6593 path storeString print. ' ' print. thisContext printCR |
|
6594 ]. |
|
6595 path := Java as_ST_String:path. |
|
6596 path := self fixFilename:path. |
|
6597 (f := path asFilename) exists ifTrue:[ |
|
6598 f isDirectory ifFalse:[^ 1 "TRUE"] |
|
6599 ] |
|
6600 ]. |
|
6601 ^ 0 "/ FALSE |
|
6602 |
|
6603 "Created: / 11.1.1998 / 11:40:22 / cg" |
|
6604 "Modified: / 27.1.1999 / 18:58:04 / cg" |
|
6605 ! |
|
6606 |
|
6607 _File_lastModified0:nativeContext |
|
6608 |file path f| |
|
6609 |
|
6610 file := nativeContext receiver. |
|
6611 path := file instVarNamed:'path'. |
|
6612 path notNil ifTrue:[ |
|
6613 path := Java as_ST_String:path. |
|
6614 path := self fixFilename:path. |
|
6615 (f := path asFilename) exists ifTrue:[ |
|
6616 ^ f modificationTime getMilliseconds. |
|
6617 ] |
|
6618 ]. |
|
6619 ^ 0 |
|
6620 |
|
6621 "Created: / 4.2.1998 / 16:50:30 / cg" |
|
6622 "Modified: / 20.10.1998 / 21:00:05 / cg" |
|
6623 ! |
|
6624 |
|
6625 _File_length0:nativeContext |
|
6626 |file path f| |
|
6627 |
|
6628 file := nativeContext receiver. |
|
6629 path := file instVarNamed:'path'. |
|
6630 path notNil ifTrue:[ |
|
6631 FileAccessTrace == true ifTrue:[ |
|
6632 thisContext printCR |
|
6633 ]. |
|
6634 path := Java as_ST_String:path. |
|
6635 path := self fixFilename:path. |
|
6636 (f := path asFilename) exists ifTrue:[ |
|
6637 ^ f fileSize |
|
6638 ] |
|
6639 ]. |
|
6640 ^ -1 |
|
6641 |
|
6642 "Created: / 7.1.1998 / 12:18:57 / cg" |
|
6643 "Modified: / 27.1.1999 / 18:57:06 / cg" |
|
6644 ! |
|
6645 |
|
6646 _File_list0:nativeContext |
|
6647 |file path f files| |
|
6648 |
|
6649 file := nativeContext receiver. |
|
6650 path := file instVarNamed:'path'. |
|
6651 path notNil ifTrue:[ |
|
6652 path := Java as_ST_String:path. |
|
6653 path := self fixFilename:path. |
|
6654 (f := path asFilename) exists ifTrue:[ |
|
6655 f isDirectory ifTrue:[ |
|
6656 files := f directoryContents asArray. |
|
6657 files := files collect:[:nm | Java as_String:nm]. |
|
6658 ^ files |
|
6659 ] |
|
6660 ] |
|
6661 ]. |
|
6662 ^ nil |
|
6663 |
|
6664 "Created: / 14.1.1998 / 21:30:22 / cg" |
|
6665 "Modified: / 20.10.1998 / 21:00:21 / cg" |
|
6666 ! |
|
6667 |
|
6668 _File_mkdir0:nativeContext |
|
6669 |file path f| |
|
6670 |
|
6671 file := nativeContext receiver. |
|
6672 path := file instVarNamed:'path'. |
|
6673 path notNil ifTrue:[ |
|
6674 path := Java as_ST_String:path. |
|
6675 path := self fixFilename:path. |
|
6676 f := path asFilename. |
|
6677 (f exists and:[f isDirectory]) ifTrue:[ |
|
6678 ^ 0 "/ FALSE |
|
6679 ]. |
|
6680 |
|
6681 FileOpenConfirmation ifTrue:[ |
|
6682 (self confirm:('JAVA Security check\\Create directory ''' , path , '''.\Grant permission ?') withCRs) |
|
6683 ifFalse:[ |
|
6684 ^ 0 "/ FALSE |
|
6685 ] |
|
6686 ]. |
|
6687 OperatingSystem accessDeniedErrorSignal handle:[:ex | |
|
6688 ^ 0 "/ FALSE |
|
6689 ] do:[ |
|
6690 f makeDirectory. |
|
6691 ]. |
|
6692 f exists ifTrue:[ |
|
6693 f isDirectory ifTrue:[^ 1 "TRUE"] |
|
6694 ] |
|
6695 ]. |
|
6696 ^ 0 "FALSE" |
|
6697 |
|
6698 "Created: / 4.2.1998 / 00:19:05 / cg" |
|
6699 "Modified: / 4.12.1998 / 14:04:03 / cg" |
|
6700 ! |
|
6701 |
|
6702 _File_renameTo0:nativeContext |
|
6703 "/ void renameTo0 (java.io.File) |
|
6704 |
|
6705 |oldFile newFile oldPath newPath oldF newF| |
|
6706 |
|
6707 oldFile := nativeContext receiver. |
|
6708 oldPath := oldFile instVarNamed:'path'. |
|
6709 oldPath isNil ifTrue:[^ 0]. "/ FALSE |
|
6710 |
|
6711 oldPath := Java as_ST_String:oldPath. |
|
6712 oldF := oldPath asFilename. |
|
6713 |
|
6714 newFile := nativeContext argAt:1. |
|
6715 newPath := newFile instVarNamed:'path'. |
|
6716 newPath isNil ifTrue:[^ 0]. "/ FALSE |
|
6717 newPath := Java as_ST_String:newPath. |
|
6718 |
|
6719 newF := newPath asFilename. |
|
6720 |
|
6721 (self checkWritePermissionOfDirectory:oldF directory message:('JAVA Security check\\Rename of ''' , oldPath , ''' to ''' , newPath , '''.\Grant permission ?')) |
|
6722 ifFalse:[ |
|
6723 ^ 0 "/ FALSE |
|
6724 ]. |
|
6725 oldF directory pathName ~= newF directory pathName ifTrue:[ |
|
6726 (self checkWritePermissionOfDirectory:newF directory message:('JAVA Security check\\Rename of ''' , oldPath , ''' to ''' , newPath , '''.\Grant permission ?')) |
|
6727 ifFalse:[ |
|
6728 ^ 0 "/ FALSE |
|
6729 ]. |
|
6730 ]. |
|
6731 |
|
6732 OperatingSystem accessDeniedErrorSignal handle:[:ex | |
|
6733 ^ 0 "/ FALSE |
|
6734 ] do:[ |
|
6735 oldF renameTo:newF. |
|
6736 ^ 1 "/ TRUE |
|
6737 ]. |
|
6738 ^ 0 "/ FALSE |
|
6739 |
|
6740 "Modified: / 3.12.1998 / 21:01:08 / cg" |
|
6741 ! |
|
6742 |
|
6743 _File_rmdir0:nativeContext |
|
6744 "/ boolean rmdir0 () |
|
6745 UnimplementedNativeMethodSignal raiseRequest |
|
6746 |
|
6747 "Modified: / 12.11.1998 / 19:01:48 / cg" |
|
6748 "Created: / 12.11.1998 / 19:03:52 / cg" |
|
6749 ! |
|
6750 |
|
6751 _Float_floatToIntBits:nativeContext |
|
6752 |f i| |
|
6753 |
|
6754 f := nativeContext argAt:1. |
|
6755 |
|
6756 UninterpretedBytes isBigEndian ifTrue:[ |
|
6757 i := f basicAt:4. |
|
6758 i := i bitOr:((f basicAt:3) bitShift:8). |
|
6759 i := i bitOr:((f basicAt:2) bitShift:16). |
|
6760 i := i bitOr:((f basicAt:1) bitShift:24). |
|
6761 ] ifFalse:[ |
|
6762 i := f basicAt:1. |
|
6763 i := i bitOr:((f basicAt:2) bitShift:8). |
|
6764 i := i bitOr:((f basicAt:3) bitShift:16). |
|
6765 i := i bitOr:((f basicAt:4) bitShift:24). |
|
6766 ]. |
|
6767 |
|
6768 ^ i. |
|
6769 |
|
6770 "Created: / 4.1.1998 / 01:25:50 / cg" |
|
6771 ! |
|
6772 |
|
6773 _Float_intBitsToFloat:nativeContet |
|
6774 |i aFloat| |
|
6775 |
|
6776 i := nativeContet argAt:1. |
|
6777 |
|
6778 aFloat := ShortFloat basicNew. |
|
6779 UninterpretedBytes isBigEndian ifTrue:[ |
|
6780 aFloat basicAt:1 put:((i bitShift:-24) bitAnd:16rFF). |
|
6781 aFloat basicAt:2 put:((i bitShift:-16) bitAnd:16rFF). |
|
6782 aFloat basicAt:3 put:((i bitShift:-8) bitAnd:16rFF). |
|
6783 aFloat basicAt:4 put:(i bitAnd:16rFF). |
|
6784 ] ifFalse:[ |
|
6785 aFloat basicAt:1 put:(i bitAnd:16rFF). |
|
6786 aFloat basicAt:2 put:((i bitShift:-8) bitAnd:16rFF). |
|
6787 aFloat basicAt:3 put:((i bitShift:-16) bitAnd:16rFF). |
|
6788 aFloat basicAt:4 put:((i bitShift:-24) bitAnd:16rFF). |
|
6789 ]. |
|
6790 |
|
6791 ^ aFloat. |
|
6792 |
|
6793 "Created: / 13.1.1998 / 23:03:36 / cg" |
|
6794 "Modified: / 13.1.1998 / 23:05:01 / cg" |
|
6795 ! |
|
6796 |
|
6797 _FontDescriptor_initIDs:nativeContext |
|
6798 "/ new with jdk1.2 ... |
|
6799 |
|
6800 "Created: / 28.1.1998 / 22:30:52 / cg" |
|
6801 ! |
|
6802 |
|
6803 _Font_initIDs:nativeContext |
|
6804 "/ new with jdk1.2 ... |
|
6805 |
|
6806 "Created: / 27.1.1998 / 21:43:25 / cg" |
|
6807 ! |
|
6808 |
|
6809 _GifImageDecoder_parseImage:nativeContext |
|
6810 |decoder width height bool1 depth subHdrBytes dstBytes i1 i2 colorModel |
|
6811 stream byte compressedData compressedSize index count data |
|
6812 leftOffs topOffs codeLen flags pixelStore clrModel t buffSize |
|
6813 countGot countGot2| |
|
6814 |
|
6815 decoder := nativeContext receiver. |
|
6816 |
|
6817 i1 := nativeContext argAt:1. |
|
6818 i2 := nativeContext argAt:2. |
|
6819 width := nativeContext argAt:3. |
|
6820 height := nativeContext argAt:4. |
|
6821 bool1 := nativeContext argAt:5. |
|
6822 depth := nativeContext argAt:6. |
|
6823 subHdrBytes := nativeContext argAt:7. |
|
6824 dstBytes := nativeContext argAt:8. |
|
6825 colorModel := nativeContext argAt:9. |
|
6826 |
|
6827 leftOffs := subHdrBytes wordAt:1 MSB:false. |
|
6828 topOffs := subHdrBytes wordAt:3 MSB:false. |
|
6829 width := subHdrBytes wordAt:5 MSB:false. |
|
6830 height := subHdrBytes wordAt:7 MSB:false. |
|
6831 flags := subHdrBytes at:9. |
|
6832 codeLen := subHdrBytes at:10. |
|
6833 |
|
6834 stream := decoder instVarNamed:'input'. |
|
6835 pixelStore := decoder instVarNamed:'store'. |
|
6836 pixelStore isNil ifTrue:[ |
|
6837 ^ 0 |
|
6838 ]. |
|
6839 |
|
6840 buffSize := (width * height // 2) max:4096. |
|
6841 compressedData := ByteArray uninitializedNew:buffSize. |
|
6842 "get compressed data" |
|
6843 index := 1. |
|
6844 count := stream perform:#'read()I'. |
|
6845 |
|
6846 [count notNil and:[count > 0]] whileTrue:[ |
|
6847 (index + count) > buffSize ifTrue:[ |
|
6848 t := ByteArray uninitializedNew:(buffSize * 2). |
|
6849 t replaceFrom:1 to:buffSize with:compressedData startingAt:1. |
|
6850 compressedData := t. |
|
6851 buffSize := buffSize * 2. |
|
6852 ]. |
|
6853 [count ~~ 0] whileTrue:[ |
|
6854 countGot := stream |
|
6855 perform:#'read([BII)I' |
|
6856 with:compressedData |
|
6857 with:index-1 |
|
6858 with:count. |
|
6859 |
|
6860 countGot > 0 ifTrue:[ |
|
6861 count := count - countGot. |
|
6862 index := index + countGot. |
|
6863 ] ifFalse:[ |
|
6864 count := -1. |
|
6865 ] |
|
6866 ]. |
|
6867 |
|
6868 count >= 0 ifTrue:[ |
|
6869 count := stream perform:#read. |
|
6870 ] |
|
6871 ]. |
|
6872 compressedSize := index - 1. |
|
6873 |
|
6874 data := pixelStore perform:#'allocateLines(I)Ljava/lang/Object;' with:height. |
|
6875 (data isMemberOf:ByteArray) ifFalse:[ |
|
6876 self halt. |
|
6877 ^ 0. |
|
6878 ]. |
|
6879 "/ 'GIFReader: decompressing ...' infoPrintCR. |
|
6880 |
|
6881 |
|
6882 GIFReader |
|
6883 decompressGIFFrom:compressedData |
|
6884 count:compressedSize |
|
6885 into:data |
|
6886 startingAt:1 |
|
6887 codeLen:(codeLen + 1). |
|
6888 |
|
6889 clrModel := pixelStore instVarNamed:'colormodel'. |
|
6890 |
|
6891 pixelStore |
|
6892 perform:#'setPixels(IIII[BII)Z' |
|
6893 withArguments: |
|
6894 (Array |
|
6895 with:0 "/ x |
|
6896 with:0 "/ y |
|
6897 with:width "/ w |
|
6898 with:height "/ h |
|
6899 with:data |
|
6900 with:0 "/ offs |
|
6901 with:width). "/ scanSize |
|
6902 |
|
6903 pixelStore perform:#'imageComplete()V'. |
|
6904 "/ perform:#'imageComplete(I)V' |
|
6905 "/ with:((Java at:'java.awt.image.ImageConsumer') instVarNamed:'STATICIMAGEDONE'). |
|
6906 |
|
6907 "/ self internalError:'breakPoint'. |
|
6908 ^ 1 "/ true |
|
6909 |
|
6910 "Modified: / 10.4.1998 / 14:31:59 / cg" |
|
6911 ! |
|
6912 |
|
6913 _ImageRepresentation_disposeImage:nativeContext |
|
6914 |imgRep img| |
|
6915 |
|
6916 imgRep := nativeContext receiver. |
|
6917 |
|
6918 img := imgRep instVarNamed:'pData'. |
|
6919 (img notNil and:[img ~~ 0]) ifTrue:[ |
|
6920 ImageStretchCache notNil ifTrue:[ |
|
6921 ImageStretchCache removeKey:img ifAbsent:nil. |
|
6922 ] |
|
6923 ]. |
|
6924 |
|
6925 imgRep instVarNamed:'pData' put:0. |
|
6926 "/ self halt. |
|
6927 |
|
6928 "Created: / 7.1.1998 / 22:31:46 / cg" |
|
6929 "Modified: / 17.1.1998 / 13:26:55 / cg" |
|
6930 ! |
|
6931 |
|
6932 _ImageRepresentation_finish:nativeContext |
|
6933 |imgRep bool| |
|
6934 |
|
6935 imgRep := nativeContext receiver. |
|
6936 bool := nativeContext argAt:1. |
|
6937 "/ self halt. |
|
6938 "/ 'JAVA: ImageRepresentation_finish ignored for now' infoPrintCR. |
|
6939 |
|
6940 ^ 1 "/ true |
|
6941 |
|
6942 "Created: / 8.1.1998 / 00:11:40 / cg" |
|
6943 "Modified: / 6.2.1998 / 02:12:54 / cg" |
|
6944 ! |
|
6945 |
|
6946 _ImageRepresentation_imageDraw:nativeContext |
|
6947 |imgRep x y img deviceImage jGraphics gc clr| |
|
6948 |
|
6949 imgRep := nativeContext receiver. |
|
6950 img := imgRep instVarNamed:'pData'. |
|
6951 (img isNil or:[img == 0]) ifTrue:[ |
|
6952 "/ self halt. |
|
6953 ^ self. |
|
6954 ]. |
|
6955 jGraphics := nativeContext argAt:1. |
|
6956 gc := jGraphics instVarNamed:'pData'. |
|
6957 gc realized ifFalse:[^ self]. |
|
6958 |
|
6959 x := nativeContext argAt:2. |
|
6960 y := nativeContext argAt:3. |
|
6961 clr := nativeContext argAt:4. |
|
6962 |
|
6963 deviceImage := img onDevice:gc device. |
|
6964 deviceImage ~~ img ifTrue:[ |
|
6965 imgRep instVarNamed:'pData' put:deviceImage. |
|
6966 ]. |
|
6967 gc realized ifFalse:[^ self]. |
|
6968 deviceImage displayOn:gc x:x y:y. |
|
6969 ^ 1. |
|
6970 |
|
6971 "Created: / 13.1.1998 / 13:32:28 / cg" |
|
6972 "Modified: / 25.11.1998 / 15:36:38 / cg" |
|
6973 ! |
|
6974 |
|
6975 _ImageRepresentation_imageStretch:nativeContext |
|
6976 |imgRep x1 y1 x2 y2 srcX1 srcY1 w h |
|
6977 img deviceImage jGraphics gc clr stretchWidth stretchHeight| |
|
6978 |
|
6979 imgRep := nativeContext receiver. |
|
6980 img := imgRep instVarNamed:'pData'. |
|
6981 (img isNil or:[img == 0]) ifTrue:[ |
|
6982 "/ self halt. |
|
6983 ^ self. |
|
6984 ]. |
|
6985 |
|
6986 jGraphics := nativeContext argAt:1. |
|
6987 gc := jGraphics instVarNamed:'pData'. |
|
6988 gc realized ifFalse:[^ self]. |
|
6989 |
|
6990 x1 := nativeContext argAt:2. |
|
6991 y1 := nativeContext argAt:3. |
|
6992 x2 := nativeContext argAt:4. |
|
6993 y2:= nativeContext argAt:5. |
|
6994 srcX1 := nativeContext argAt:6. |
|
6995 srcY1 := nativeContext argAt:7. |
|
6996 w := nativeContext argAt:8. |
|
6997 h := nativeContext argAt:9. |
|
6998 clr := nativeContext argAt:10. |
|
6999 |
|
7000 (srcX1 ~~ 0 or:[srcY1 ~~ 0]) ifTrue:[ |
|
7001 self halt. |
|
7002 ^ self. |
|
7003 ]. |
|
7004 (w ~~ img width or:[h ~~ img height]) ifTrue:[ |
|
7005 self halt. |
|
7006 ^ self |
|
7007 ]. |
|
7008 |
|
7009 "/ TODO: remember magnified images somewhere for a while, |
|
7010 "/ to avoid repeated action ... |
|
7011 |
|
7012 stretchWidth := (x2-x1). |
|
7013 stretchHeight := (y2-y1). |
|
7014 |
|
7015 (stretchWidth == img width |
|
7016 and:[stretchHeight == img height]) ifTrue:[ |
|
7017 deviceImage := img onDevice:gc device. |
|
7018 deviceImage ~~ img ifTrue:[ |
|
7019 imgRep instVarNamed:'pData' put:deviceImage. |
|
7020 ]. |
|
7021 ] ifFalse:[ |
|
7022 ImageStretchCache notNil ifTrue:[ |
|
7023 deviceImage := ImageStretchCache at:img ifAbsent:nil. |
|
7024 ]. |
|
7025 (deviceImage isNil |
|
7026 or:[deviceImage width ~~ stretchWidth |
|
7027 or:[deviceImage height ~~ stretchHeight]]) ifTrue:[ |
|
7028 deviceImage := (img magnifiedTo:stretchWidth@stretchHeight) onDevice:gc device. |
|
7029 ImageStretchCache isNil ifTrue:[ |
|
7030 ImageStretchCache := WeakIdentityDictionary new. |
|
7031 ]. |
|
7032 ImageStretchCache at:img put:deviceImage |
|
7033 ]. |
|
7034 ]. |
|
7035 deviceImage displayOn:gc x:x1 y:y1 |
|
7036 |
|
7037 "Created: / 13.1.1998 / 13:32:28 / cg" |
|
7038 "Modified: / 15.1.1998 / 13:14:47 / cg" |
|
7039 ! |
|
7040 |
|
7041 _ImageRepresentation_offscreenInit:nativeContext |
|
7042 |imgRep jclr w h form screenDevice| |
|
7043 |
|
7044 imgRep := nativeContext receiver. |
|
7045 jclr := nativeContext argAt:1. |
|
7046 |
|
7047 w := imgRep instVarNamed:'width'. |
|
7048 h := imgRep instVarNamed:'height'. |
|
7049 |
|
7050 screenDevice := Screen current. |
|
7051 form := Form width:w height:h depth:(screenDevice depth) on:screenDevice. |
|
7052 |
|
7053 imgRep instVarNamed:'pData' put:form. |
|
7054 "/ self halt. |
|
7055 |
|
7056 "Created: / 7.1.1998 / 22:31:46 / cg" |
|
7057 "Modified: / 17.1.1998 / 12:36:43 / cg" |
|
7058 ! |
|
7059 |
|
7060 _ImageRepresentation_setBytePixels:nativeContext |
|
7061 |imgRep x y w h clrModel bytes offs i2 |
|
7062 img depth cmap rgbMap opaque transparentColorIndex |
|
7063 scanLineWidth nBytes srcIdx dstIdx| |
|
7064 |
|
7065 imgRep := nativeContext receiver. |
|
7066 x := nativeContext argAt:1. |
|
7067 y := nativeContext argAt:2. |
|
7068 w := nativeContext argAt:3. |
|
7069 h := nativeContext argAt:4. |
|
7070 clrModel := nativeContext argAt:5. |
|
7071 bytes := nativeContext argAt:6. |
|
7072 offs := nativeContext argAt:7. "/ offset ?? |
|
7073 scanLineWidth := nativeContext argAt:8. |
|
7074 |
|
7075 depth := clrModel instVarNamed:'pixel_bits'. |
|
7076 (clrModel instVarNamed:'map_size') ~~ 0 ifTrue:[ |
|
7077 rgbMap := clrModel instVarNamed:'rgb'. |
|
7078 cmap := Array new:rgbMap size. |
|
7079 rgbMap |
|
7080 keysAndValuesDo:[:idx :rgb | |
|
7081 cmap at:idx put:(Color rgbValue:(rgb bitAnd:16rFFFFFF)) |
|
7082 ]. |
|
7083 ]. |
|
7084 |
|
7085 opaque := (clrModel instVarNamed:'opaque') ~~ 0. |
|
7086 opaque ifFalse:[ |
|
7087 transparentColorIndex := clrModel instVarNamed:'transparent_index' |
|
7088 ]. |
|
7089 |
|
7090 img := imgRep instVarNamed:'pData'. |
|
7091 (img isNil or:[img == 0]) ifFalse:[ |
|
7092 "/ self halt |
|
7093 ]. |
|
7094 |
|
7095 (offs ~~ 0 or:[scanLineWidth ~~ w]) ifTrue:[ |
|
7096 nBytes := ByteArray new:w*h. |
|
7097 srcIdx := offs+1. |
|
7098 dstIdx := 1. |
|
7099 1 to:h do:[:y | |
|
7100 nBytes replaceFrom:dstIdx to:(dstIdx+w-1) with:bytes startingAt:srcIdx. |
|
7101 srcIdx := srcIdx + scanLineWidth. |
|
7102 dstIdx := dstIdx + w. |
|
7103 ]. |
|
7104 bytes := nBytes. |
|
7105 ]. |
|
7106 img := Image width:w height:h depth:depth fromArray:bytes. |
|
7107 cmap notNil ifTrue:[ |
|
7108 img colorMap:cmap. |
|
7109 img photometric:#palette |
|
7110 ]. |
|
7111 opaque ifFalse:[ |
|
7112 img mask:(ImageReader |
|
7113 buildMaskFromColor:transparentColorIndex |
|
7114 for:bytes |
|
7115 width:w |
|
7116 height:h) |
|
7117 ]. |
|
7118 |
|
7119 imgRep instVarNamed:'pData' put:img. |
|
7120 ^ 1. |
|
7121 |
|
7122 "Created: / 7.1.1998 / 22:31:46 / cg" |
|
7123 "Modified: / 21.10.1998 / 00:35:45 / cg" |
|
7124 ! |
|
7125 |
|
7126 _ImageRepresentation_setIntPixels:nativeContext |
|
7127 |imgRep x y w h clrModel ints offs scanLineWidth |
|
7128 img depth cmap rgbMap opaque transparentColorIndex |
|
7129 bytes srcIdx dstIdx val red green blue |
|
7130 redMask greenMask blueMask redShift greenShift blueShift| |
|
7131 |
|
7132 imgRep := nativeContext receiver. |
|
7133 x := nativeContext argAt:1. |
|
7134 y := nativeContext argAt:2. |
|
7135 w := nativeContext argAt:3. |
|
7136 h := nativeContext argAt:4. |
|
7137 clrModel := nativeContext argAt:5. |
|
7138 ints := nativeContext argAt:6. |
|
7139 offs := nativeContext argAt:7. "/ offset ?? |
|
7140 scanLineWidth := nativeContext argAt:8. "/ scanLineWidth ?? |
|
7141 opaque := false. |
|
7142 offs ~~ 0 ifTrue:[ |
|
7143 self halt |
|
7144 ]. |
|
7145 |
|
7146 depth := clrModel instVarNamed:'pixel_bits'. |
|
7147 clrModel class == (Java at:'java.awt.image.DirectColorModel') ifTrue:[ |
|
7148 ] ifFalse:[ |
|
7149 (clrModel instVarNamed:'map_size') ~~ 0 ifTrue:[ |
|
7150 rgbMap := clrModel instVarNamed:'rgb'. |
|
7151 cmap := Array new:rgbMap size. |
|
7152 rgbMap |
|
7153 keysAndValuesDo:[:idx :rgb | |
|
7154 cmap at:idx put:(Color rgbValue:(rgb bitAnd:16rFFFFFF)) |
|
7155 ]. |
|
7156 ]. |
|
7157 opaque := (clrModel instVarNamed:'opaque') ~~ 0. |
|
7158 opaque ifFalse:[ |
|
7159 transparentColorIndex := clrModel instVarNamed:'transparent_index' |
|
7160 ]. |
|
7161 ]. |
|
7162 |
|
7163 img := imgRep instVarNamed:'pData'. |
|
7164 (img isNil or:[img == 0]) ifFalse:[ |
|
7165 "/ self halt. |
|
7166 ]. |
|
7167 |
|
7168 depth == 32 ifTrue:[ |
|
7169 "/ temporary kludge - ony use 24 bits/pixel |
|
7170 bytes := ByteArray new:w*h*3. |
|
7171 srcIdx := 1. |
|
7172 dstIdx := 1. |
|
7173 redMask := clrModel instVarNamed:'red_mask'. |
|
7174 greenMask := clrModel instVarNamed:'green_mask'. |
|
7175 blueMask := clrModel instVarNamed:'blue_mask'. |
|
7176 redShift := (clrModel instVarNamed:'red_offset') negated. |
|
7177 greenShift := (clrModel instVarNamed:'green_offset') negated. |
|
7178 blueShift := (clrModel instVarNamed:'blue_offset') negated. |
|
7179 |
|
7180 1 to:h do:[:y | |
|
7181 1 to:w do:[:x | |
|
7182 val := ints at:srcIdx. |
|
7183 red := (val bitAnd:redMask) bitShift:redShift. |
|
7184 green := (val bitAnd:greenMask) bitShift:greenShift. |
|
7185 blue := (val bitAnd:blueMask) bitShift:blueShift. |
|
7186 bytes at:dstIdx put:red. |
|
7187 bytes at:dstIdx+1 put:green. |
|
7188 bytes at:dstIdx+2 put:blue. |
|
7189 dstIdx := dstIdx + 3. |
|
7190 srcIdx := srcIdx + 1. |
|
7191 ]. |
|
7192 srcIdx := srcIdx + (scanLineWidth - w). |
|
7193 ]. |
|
7194 img := Depth24Image width:w height:h depth:24 fromArray:bytes. |
|
7195 img photometric:#rgb. |
|
7196 ] ifFalse:[ |
|
7197 scanLineWidth ~~ w ifTrue:[ |
|
7198 self halt |
|
7199 ]. |
|
7200 img := Image width:w height:h depth:depth fromArray:ints. |
|
7201 cmap notNil ifTrue:[ |
|
7202 img colorMap:cmap. |
|
7203 img photometric:#palette |
|
7204 ] ifFalse:[ |
|
7205 img photometric:#rgb |
|
7206 ]. |
|
7207 ]. |
|
7208 opaque ifFalse:[ |
|
7209 img mask:(ImageReader |
|
7210 buildMaskFromColor:transparentColorIndex |
|
7211 for:ints |
|
7212 width:w |
|
7213 height:h) |
|
7214 ]. |
|
7215 |
|
7216 imgRep instVarNamed:'pData' put:img. |
|
7217 ^ 1. |
|
7218 |
|
7219 "Created: / 1.2.1998 / 17:38:47 / cg" |
|
7220 "Modified: / 21.10.1998 / 00:35:37 / cg" |
|
7221 ! |
|
7222 |
|
7223 _InetAddressImpl_getHostByAddr:nativeContext |
|
7224 "/ java.lang.String getHostByAddr (int) |
|
7225 UnimplementedNativeMethodSignal raise |
|
7226 |
|
7227 "Created: / 12.11.1998 / 19:08:04 / cg" |
|
7228 ! |
|
7229 |
|
7230 _InetAddressImpl_getInetFamily:nativeContext |
|
7231 "/ self unimplementedNativeMethod. |
|
7232 ^ 0 |
|
7233 |
|
7234 "Modified: / 15.8.1997 / 17:04:43 / cg" |
|
7235 "Created: / 5.1.1998 / 02:05:48 / cg" |
|
7236 ! |
|
7237 |
|
7238 _InetAddressImpl_getLocalHostName:nativeContext |
|
7239 "" |
|
7240 |
|
7241 |hostName| |
|
7242 |
|
7243 hostName := OperatingSystem getHostName. |
|
7244 |
|
7245 ^ (Java as_String:hostName). |
|
7246 |
|
7247 "Modified: / 7.8.1997 / 21:16:55 / cg" |
|
7248 "Created: / 5.1.1998 / 02:07:03 / cg" |
|
7249 ! |
|
7250 |
|
7251 _InetAddressImpl_lookupAllHostAddr:nativeContext |
|
7252 "" |
|
7253 |
|
7254 |jAddrImpl jHostName hostName addrBytes| |
|
7255 |
|
7256 jAddrImpl := nativeContext receiver. |
|
7257 jHostName := nativeContext argAt:1. |
|
7258 |
|
7259 hostName := Java as_ST_String:jHostName. |
|
7260 addrBytes := Socket ipAddressOfHost:hostName. |
|
7261 addrBytes isNil ifTrue:[ |
|
7262 addrBytes := #[0 0 0 0] copy |
|
7263 ]. |
|
7264 ^ Array with:addrBytes |
|
7265 |
|
7266 "Modified: / 8.8.1997 / 12:04:25 / cg" |
|
7267 "Created: / 7.1.1998 / 18:51:31 / cg" |
|
7268 ! |
|
7269 |
|
7270 _InetAddressImpl_makeAnyLocalAddress:nativeContext |
|
7271 "" |
|
7272 |
|
7273 |jAddrImpl jAddr hostName addrBytes address| |
|
7274 |
|
7275 jAddrImpl := nativeContext receiver. |
|
7276 jAddr := nativeContext argAt:1. |
|
7277 |
|
7278 hostName := OperatingSystem getHostName. |
|
7279 addrBytes := Socket ipAddressOfHost:hostName. |
|
7280 addrBytes isNil ifTrue:[ |
|
7281 addrBytes := #[127 0 0 0]. |
|
7282 ]. |
|
7283 "/ MSB first into an integer. |
|
7284 address := (addrBytes at:1). |
|
7285 address := (address bitShift:8) bitOr:(addrBytes at:2). |
|
7286 address := (address bitShift:8) bitOr:(addrBytes at:3). |
|
7287 address := (address bitShift:8) bitOr:(addrBytes at:4). |
|
7288 |
|
7289 jAddr instVarNamed:'hostName' put:(Java as_String:hostName). |
|
7290 jAddr instVarNamed:'address' put:address. |
|
7291 jAddr instVarNamed:'family' put:0. |
|
7292 |
|
7293 ^ nil |
|
7294 |
|
7295 "Created: / 5.1.1998 / 02:06:27 / cg" |
|
7296 "Modified: / 21.10.1998 / 03:30:29 / cg" |
|
7297 ! |
|
7298 |
|
7299 _InetAddress_getInetFamily:nativeContext |
|
7300 "/ self unimplementedNativeMethod. |
|
7301 ^ 0 |
|
7302 |
|
7303 "Modified: / 15.8.1997 / 17:04:43 / cg" |
|
7304 "Created: / 17.11.1998 / 23:54:38 / cg" |
|
7305 ! |
|
7306 |
|
7307 _InetAddress_getLocalHostName:nativeContext |
|
7308 "" |
|
7309 |
|
7310 |hostName| |
|
7311 |
|
7312 hostName := OperatingSystem getHostName. |
|
7313 |
|
7314 ^ Java as_String:hostName. |
|
7315 |
|
7316 "Modified: / 7.8.1997 / 21:16:55 / cg" |
|
7317 "Created: / 17.11.1998 / 23:54:54 / cg" |
|
7318 ! |
|
7319 |
|
7320 _InetAddress_init:nativeContext |
|
7321 "/ introduced with jdk1.2 ... (sigh) |
|
7322 |
|
7323 "Created: / 27.1.1998 / 18:16:40 / cg" |
|
7324 |
|
7325 |
|
7326 ! |
|
7327 |
|
7328 _InetAddress_lookupAllHostAddr:nativeContext |
|
7329 "" |
|
7330 |
|
7331 |jAddrImpl jHostName hostName addrBytes| |
|
7332 |
|
7333 jAddrImpl := nativeContext receiver. |
|
7334 jHostName := nativeContext argAt:1. |
|
7335 |
|
7336 hostName := Java as_ST_String:jHostName. |
|
7337 addrBytes := Socket ipAddressOfHost:hostName. |
|
7338 addrBytes isNil ifTrue:[ |
|
7339 addrBytes := #[0 0 0 0] copy |
|
7340 ]. |
|
7341 ^ Array with:addrBytes |
|
7342 |
|
7343 "Modified: / 8.8.1997 / 12:04:25 / cg" |
|
7344 "Created: / 17.11.1998 / 23:56:10 / cg" |
|
7345 ! |
|
7346 |
|
7347 _InetAddress_lookupHostByAddr:nativeContext |
|
7348 "java.lang.Object[] lookupHostByAddr (int)" |
|
7349 |
|
7350 UnimplementedNativeMethodSignal raise. |
|
7351 |
|
7352 "Created: / 27.1.2000 / 02:59:22 / cg" |
|
7353 ! |
|
7354 |
|
7355 _InetAddress_lookupHostByName:nativeContext |
|
7356 "java.lang.Object[] lookupHostByName (java.lang.String)" |
|
7357 |
|
7358 UnimplementedNativeMethodSignal raise. |
|
7359 |
|
7360 "Modified: / 27.1.2000 / 02:58:53 / cg" |
|
7361 ! |
|
7362 |
|
7363 _InetAddress_makeAnyLocalAddress:nativeContext |
|
7364 "" |
|
7365 |
|
7366 |jAddrImpl jAddr hostName addrBytes address| |
|
7367 |
|
7368 jAddrImpl := nativeContext receiver. |
|
7369 jAddr := nativeContext argAt:1. |
|
7370 |
|
7371 hostName := OperatingSystem getHostName. |
|
7372 addrBytes := Socket ipAddressOfHost:hostName. |
|
7373 addrBytes isNil ifTrue:[ |
|
7374 addrBytes := #[127 0 0 0]. |
|
7375 ]. |
|
7376 "/ MSB first into an integer. |
|
7377 address := (addrBytes at:1). |
|
7378 address := (address bitShift:8) bitOr:(addrBytes at:2). |
|
7379 address := (address bitShift:8) bitOr:(addrBytes at:3). |
|
7380 address := (address bitShift:8) bitOr:(addrBytes at:4). |
|
7381 |
|
7382 jAddr instVarNamed:'hostName' put:(Java as_String:hostName). |
|
7383 jAddr instVarNamed:'address' put:address. |
|
7384 jAddr instVarNamed:'family' put:0. |
|
7385 |
|
7386 ^ nil |
|
7387 |
|
7388 "Modified: / 21.10.1998 / 03:30:29 / cg" |
|
7389 "Created: / 17.11.1998 / 23:54:00 / cg" |
|
7390 ! |
|
7391 |
|
7392 _Inflater_end0:nativeContext |
|
7393 "/ void end0 () |
|
7394 |
|
7395 UnimplementedNativeMethodSignal raise. |
|
7396 |
|
7397 "Modified: / 27.1.2000 / 03:08:47 / cg" |
|
7398 "Created: / 27.1.2000 / 03:11:21 / cg" |
|
7399 ! |
|
7400 |
|
7401 _Inflater_getAdler0:nativeContext |
|
7402 "/ int getAdler0 () |
|
7403 |
|
7404 UnimplementedNativeMethodSignal raise. |
|
7405 |
|
7406 "Modified: / 27.1.2000 / 03:08:47 / cg" |
|
7407 "Created: / 27.1.2000 / 03:12:15 / cg" |
|
7408 ! |
|
7409 |
|
7410 _Inflater_getTotalIn0:nativeContext |
|
7411 "/ int getTotalIn0 () |
|
7412 |
|
7413 UnimplementedNativeMethodSignal raise. |
|
7414 |
|
7415 "Created: / 27.1.2000 / 03:10:50 / cg" |
|
7416 "Modified: / 27.1.2000 / 03:11:08 / cg" |
|
7417 ! |
|
7418 |
|
7419 _Inflater_getTotalOut0:nativeContext |
|
7420 "/ int getTotalOut0 () |
|
7421 |
|
7422 UnimplementedNativeMethodSignal raise. |
|
7423 |
|
7424 "Modified: / 27.1.2000 / 03:08:47 / cg" |
|
7425 "Created: / 27.1.2000 / 03:12:01 / cg" |
|
7426 ! |
|
7427 |
|
7428 _Inflater_inflate0:nativeContext |
|
7429 "/ int inflate0 (byte[] int int) |
|
7430 |
|
7431 UnimplementedNativeMethodSignal raise. |
|
7432 |
|
7433 "Modified: / 27.1.2000 / 03:08:47 / cg" |
|
7434 "Created: / 27.1.2000 / 03:11:39 / cg" |
|
7435 ! |
|
7436 |
|
7437 _Inflater_reset0:nativeContext |
|
7438 "/ void reset0 () |
|
7439 |
|
7440 UnimplementedNativeMethodSignal raise. |
|
7441 |
|
7442 "Modified: / 27.1.2000 / 03:08:47 / cg" |
|
7443 "Created: / 27.1.2000 / 03:11:02 / cg" |
|
7444 ! |
|
7445 |
|
7446 _Inflater_reset:nativeContext |
|
7447 |
|
7448 UnimplementedNativeMethodSignal raise. |
|
7449 |
|
7450 "Created: / 01-02-1998 / 20:14:13 / cg" |
|
7451 "Modified: / 30-04-2011 / 22:56:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
7452 ! |
|
7453 |
|
7454 _Inflater_setDictionary0:nativeContext |
|
7455 "/ void setDictionary0 (byte[] int int) |
|
7456 |
|
7457 UnimplementedNativeMethodSignal raise. |
|
7458 |
|
7459 "Modified: / 27.1.2000 / 03:08:47 / cg" |
|
7460 "Created: / 27.1.2000 / 03:10:33 / cg" |
|
7461 ! |
|
7462 |
|
7463 _InputThread_run:nativeContext |
|
7464 self _WToolkit_eventLoop:nativeContext. |
|
7465 |
|
7466 "Created: / 28.1.1998 / 22:34:47 / cg" |
|
7467 "Modified: / 28.1.1998 / 22:35:16 / cg" |
|
7468 ! |
|
7469 |
|
7470 _Introspector_getMethodDescriptor:nativeContext |
|
7471 "java.lang.String getMethodDescriptor (java.lang.reflect.Method)" |
|
7472 |
|
7473 UnimplementedNativeMethodSignal raise. |
|
7474 |
|
7475 "Created: / 27.1.2000 / 02:47:43 / cg" |
|
7476 ! |
|
7477 |
|
7478 _Introspector_getMethodParameterCount:nativeContext |
|
7479 "int getMethodParameterCount (java.lang.reflect.Method)" |
|
7480 |
|
7481 UnimplementedNativeMethodSignal raise. |
|
7482 |
|
7483 "Created: / 27.1.2000 / 02:49:15 / cg" |
|
7484 ! |
|
7485 |
|
7486 _Introspector_getPublicDeclaredMethods0:nativeContext |
|
7487 "java.lang.reflect.Method[] getPublicDeclaredMethods0 (java.lang.Class)" |
|
7488 |
|
7489 UnimplementedNativeMethodSignal raise. |
|
7490 |
|
7491 "Created: / 27.1.2000 / 02:48:49 / cg" |
|
7492 ! |
|
7493 |
|
7494 _JPEGImageDecoder_readImage:nativeContext |
|
7495 UnimplementedNativeMethodSignal raise |
|
7496 |
|
7497 "Created: / 12.11.1998 / 18:53:30 / cg" |
|
7498 "Modified: / 12.11.1998 / 18:53:40 / cg" |
|
7499 ! |
|
7500 |
|
7501 _MButtonPeer_create:nativeContext |
|
7502 ^ self _WButtonPeer_create:nativeContext |
|
7503 ! |
|
7504 |
|
7505 _MCanvasPeer_create:nativeContext |
|
7506 |jCanvasPeer jFrame frame subView| |
|
7507 |
|
7508 jCanvasPeer := nativeContext receiver. |
|
7509 |
|
7510 jFrame := nativeContext argAt:1. |
|
7511 jFrame isNil ifTrue:[ |
|
7512 self halt:'no frame in canvasPeer create'. |
|
7513 self internalError:'no frame in canvasPeer create'. |
|
7514 ^ self. |
|
7515 ]. |
|
7516 frame := jFrame instVarNamed:'pData'. |
|
7517 |
|
7518 subView := JavaView in:frame. |
|
7519 subView delegate:self. |
|
7520 subView javaPeer:jCanvasPeer. |
|
7521 |
|
7522 self createdWindowsView:subView for:jCanvasPeer. |
|
7523 |
|
7524 WindowCreationTrace == true ifTrue:[ |
|
7525 'WCanvasPeer_create: ' print. frame print. ' -> ' print. subView printNL. |
|
7526 ]. |
|
7527 |
|
7528 "Modified: / 16.1.1998 / 13:40:00 / cg" |
|
7529 "Created: / 18.11.1998 / 00:14:44 / cg" |
|
7530 ! |
|
7531 |
|
7532 _MComponentPeer_cacheInit:nativeContext |
|
7533 |
|
7534 "Created: / 28.1.1998 / 22:22:30 / cg" |
|
7535 ! |
|
7536 |
|
7537 _MComponentPeer_handleEvent:nativeContext |
|
7538 ^ self _WComponentPeer_handleEvent:nativeContext |
|
7539 |
|
7540 "Created: / 18.11.1998 / 00:21:17 / cg" |
|
7541 ! |
|
7542 |
|
7543 _MComponentPeer_nativeHandleEvent:nativeContext |
|
7544 ^ self _WComponentPeer_nativeHandleEvent:nativeContext |
|
7545 ! |
|
7546 |
|
7547 _MComponentPeer_pHide:nativeContext |
|
7548 ^ self _WComponentPeer_hide:nativeContext |
|
7549 |
|
7550 "Created: / 18.11.1998 / 00:15:18 / cg" |
|
7551 ! |
|
7552 |
|
7553 _MComponentPeer_pInitialize:nativeContext |
|
7554 |
|
7555 "Created: / 28.1.1998 / 22:27:25 / cg" |
|
7556 ! |
|
7557 |
|
7558 _MComponentPeer_pReshape:nativeContext |
|
7559 self commonReshapeComponent:nativeContext |
|
7560 |
|
7561 "Created: / 18.11.1998 / 00:18:17 / cg" |
|
7562 ! |
|
7563 |
|
7564 _MComponentPeer_pSetBackground:nativeContext |
|
7565 |view jClr rgb clr| |
|
7566 |
|
7567 view := self viewForWPeer:nativeContext. |
|
7568 jClr := nativeContext argAt:1. |
|
7569 rgb := jClr instVarNamed:'value'. |
|
7570 |
|
7571 clr := Color rgbValue:rgb. |
|
7572 |
|
7573 clr := clr on:(view device). |
|
7574 (view isKindOf:ScrollableView) ifTrue:[ |
|
7575 view := view scrolledView |
|
7576 ]. |
|
7577 view viewBackground:clr. |
|
7578 view backgroundPaint:clr. |
|
7579 ! |
|
7580 |
|
7581 _MComponentPeer_pSetFont:nativeContext |
|
7582 |view jFont stFont name style size| |
|
7583 |
|
7584 view := self viewForWPeer:nativeContext. |
|
7585 jFont := nativeContext argAt:1. |
|
7586 |
|
7587 stFont := jFont instVarNamed:'pData'. |
|
7588 (stFont isNil or:[stFont == 0]) ifTrue:[ |
|
7589 name := jFont instVarNamed:'name'. |
|
7590 style := jFont instVarNamed:'style'. |
|
7591 size := jFont instVarNamed:'size'. |
|
7592 |
|
7593 stFont := self replacementFontFor:(Java as_ST_String:name) style:style size:size. |
|
7594 jFont instVarNamed:'pData' put:stFont. |
|
7595 ]. |
|
7596 view font:stFont. |
|
7597 |
|
7598 ^ nil |
|
7599 ! |
|
7600 |
|
7601 _MComponentPeer_pSetForeground:nativeContext |
|
7602 |view jClr rgb clr| |
|
7603 |
|
7604 view := self viewForWPeer:nativeContext. |
|
7605 jClr := nativeContext argAt:1. |
|
7606 rgb := jClr instVarNamed:'value'. |
|
7607 |
|
7608 clr := Color rgbValue:rgb. |
|
7609 |
|
7610 clr := clr on:(view device). |
|
7611 |
|
7612 (view isKindOf:ScrollableView) ifTrue:[ |
|
7613 view := view scrolledView |
|
7614 ]. |
|
7615 view foregroundColor:clr. |
|
7616 ! |
|
7617 |
|
7618 _MComponentPeer_pShow:nativeContext |
|
7619 |view| |
|
7620 |
|
7621 view := self viewForWPeer:nativeContext. |
|
7622 |
|
7623 "/ frame views are under my browsers own control |
|
7624 (view isMemberOf:JavaEmbeddedFrameView) ifFalse:[ |
|
7625 view beVisible. |
|
7626 view realize. |
|
7627 ]. |
|
7628 |
|
7629 "/ view windowGroup notNil ifTrue:[ |
|
7630 "/ windowServer addGroup:(view windowGroup) |
|
7631 "/ ]. |
|
7632 |
|
7633 ^ nil |
|
7634 |
|
7635 "/ self halt. |
|
7636 |
|
7637 "Modified: / 25.1.1998 / 09:54:07 / cg" |
|
7638 "Created: / 18.11.1998 / 00:21:51 / cg" |
|
7639 ! |
|
7640 |
|
7641 _MComponentPeer_setBackground:nativeContext |
|
7642 |jClr rgb clr view| |
|
7643 |
|
7644 view := self viewForWPeer:nativeContext. |
|
7645 |
|
7646 jClr := nativeContext argAt:1. |
|
7647 rgb := jClr instVarNamed:'value'. |
|
7648 "/ self halt. |
|
7649 clr := Color rgbValue:rgb. |
|
7650 |
|
7651 |
|
7652 clr := clr on:(view device). |
|
7653 |
|
7654 (view isKindOf:ScrollableView) ifTrue:[ |
|
7655 view := view scrolledView |
|
7656 ]. |
|
7657 view viewBackground:clr. |
|
7658 view backgroundPaint:clr. |
|
7659 |
|
7660 "Created: / 17.11.1998 / 23:49:41 / cg" |
|
7661 ! |
|
7662 |
|
7663 _MComponentPeer_setCursor:nativeContext |
|
7664 |
|
7665 "Created: / 28.1.1998 / 22:27:35 / cg" |
|
7666 ! |
|
7667 |
|
7668 _MComponentPeer_setFont:nativeContext |
|
7669 |view| |
|
7670 |
|
7671 view := self viewForWPeer:nativeContext. |
|
7672 "/ self halt. |
|
7673 |
|
7674 "Modified: / 25.1.1998 / 01:22:19 / cg" |
|
7675 "Created: / 17.11.1998 / 23:43:48 / cg" |
|
7676 ! |
|
7677 |
|
7678 _MComponentPeer_setForeground:nativeContext |
|
7679 |jClr rgb clr view| |
|
7680 |
|
7681 view := self viewForWPeer:nativeContext. |
|
7682 |
|
7683 jClr := nativeContext argAt:1. |
|
7684 rgb := jClr instVarNamed:'value'. |
|
7685 "/ self halt. |
|
7686 clr := Color rgbValue:rgb. |
|
7687 |
|
7688 clr := clr on:(view device). |
|
7689 |
|
7690 view paint:clr. |
|
7691 |
|
7692 "Created: / 17.11.1998 / 23:50:31 / cg" |
|
7693 "Modified: / 17.11.1998 / 23:57:29 / cg" |
|
7694 ! |
|
7695 |
|
7696 _MFramePeer_create:nativeContext |
|
7697 ^ self _WFramePeer_create:nativeContext |
|
7698 |
|
7699 "Created: / 28.1.1998 / 22:25:44 / cg" |
|
7700 ! |
|
7701 |
|
7702 _MFramePeer_getWindowBackgroundColor:nativeContext |
|
7703 ^ View defaultViewBackgroundColor rgbValue. |
|
7704 |
|
7705 "Created: / 17.11.1998 / 23:55:42 / cg" |
|
7706 ! |
|
7707 |
|
7708 _MFramePeer_pHide:nativeContext |
|
7709 ^ self _WComponentPeer_hide:nativeContext |
|
7710 |
|
7711 "Created: / 28.1.1998 / 22:27:04 / cg" |
|
7712 ! |
|
7713 |
|
7714 _MFramePeer_pReshape:nativeContext |
|
7715 self commonReshapeComponent:nativeContext |
|
7716 |
|
7717 "Created: / 28.1.1998 / 22:28:00 / cg" |
|
7718 "Modified: / 28.1.1998 / 22:29:34 / cg" |
|
7719 ! |
|
7720 |
|
7721 _MFramePeer_pSetTitle:nativeContext |
|
7722 self _WWindowPeer__setTitle:nativeContext |
|
7723 |
|
7724 "Created: / 28.1.1998 / 22:30:23 / cg" |
|
7725 ! |
|
7726 |
|
7727 _MFramePeer_pShow:nativeContext |
|
7728 |view| |
|
7729 |
|
7730 view := self viewForWPeer:nativeContext. |
|
7731 |
|
7732 "/ frame views are under my browsers own control |
|
7733 (view isMemberOf:JavaEmbeddedFrameView) ifFalse:[ |
|
7734 view beVisible. |
|
7735 view realize. |
|
7736 ]. |
|
7737 |
|
7738 "/ view windowGroup notNil ifTrue:[ |
|
7739 "/ windowServer addGroup:(view windowGroup) |
|
7740 "/ ]. |
|
7741 |
|
7742 ^ nil |
|
7743 |
|
7744 "/ self halt. |
|
7745 |
|
7746 "Modified: / 25.1.1998 / 09:54:07 / cg" |
|
7747 "Created: / 18.11.1998 / 00:19:59 / cg" |
|
7748 ! |
|
7749 |
|
7750 _MFramePeer_setInsets:nativeContext |
|
7751 |
|
7752 "Created: / 17.11.1998 / 23:55:32 / cg" |
|
7753 ! |
|
7754 |
|
7755 _MFramePeer_setResizable:nativeContext |
|
7756 |view onOff| |
|
7757 |
|
7758 view := self viewForWPeer:nativeContext. |
|
7759 |
|
7760 onOff := (nativeContext argAt:1) == 1. |
|
7761 view isTopView ifTrue:[ |
|
7762 onOff ifTrue:[ |
|
7763 view minExtent:10@10. |
|
7764 view maxExtent:(Screen current extent). |
|
7765 ] ifFalse:[ |
|
7766 view minExtent:view extent. |
|
7767 view maxExtent:view extent. |
|
7768 ] |
|
7769 ] ifFalse:[ |
|
7770 (view isMemberOf:JavaEmbeddedFrameView) ifFalse:[ |
|
7771 self halt. |
|
7772 ] |
|
7773 ]. |
|
7774 |
|
7775 "/ 'JAVA: WWindowPeer_setResizable: ' print. view print. ' yes/no: ' print. onOff printNL. |
|
7776 |
|
7777 ^ nil |
|
7778 |
|
7779 "Modified: / 16.1.1998 / 18:08:00 / cg" |
|
7780 "Created: / 17.11.1998 / 23:51:45 / cg" |
|
7781 ! |
|
7782 |
|
7783 _MToolkit_callbackLoop:nativeContext |
|
7784 |toolKit| |
|
7785 |
|
7786 toolKit := nativeContext receiver. |
|
7787 ^ self. |
|
7788 self halt. |
|
7789 self wakeup:toolKit. |
|
7790 self halt. |
|
7791 |
|
7792 (JavaEventThread notNil and:[JavaEventThread isDead not]) ifTrue:[ |
|
7793 'JavaVM [warning]: oops - two threads executing eventLoop' errorPrintCR. |
|
7794 ]. |
|
7795 |
|
7796 JavaEventThread := Processor activeProcess. |
|
7797 [ |
|
7798 [true] whileTrue:[ |
|
7799 AbortSignal handle:[:ex | |
|
7800 ex return |
|
7801 ] do:[ |
|
7802 self doWindowsEventThread. |
|
7803 ] |
|
7804 ]. |
|
7805 ] valueNowOrOnUnwindDo:[ |
|
7806 JavaEventThread := nil. |
|
7807 ]. |
|
7808 |
|
7809 "Created: / 17.11.1998 / 23:58:33 / cg" |
|
7810 "Modified: / 8.1.1999 / 17:08:35 / cg" |
|
7811 ! |
|
7812 |
|
7813 _MToolkit_eventLoop:nativeContext |
|
7814 |toolKit| |
|
7815 |
|
7816 (JavaEventThread notNil and:[JavaEventThread isDead not]) ifTrue:[ |
|
7817 'JavaVM [warning]: oops - two threads executing eventLoop' errorPrintCR. |
|
7818 ]. |
|
7819 |
|
7820 toolKit := nativeContext receiver. |
|
7821 |
|
7822 self wakeup:toolKit. |
|
7823 self halt. |
|
7824 |
|
7825 JavaEventThread := Processor activeProcess. |
|
7826 [ |
|
7827 [true] whileTrue:[ |
|
7828 AbortSignal handle:[:ex | |
|
7829 ex return |
|
7830 ] do:[ |
|
7831 self doWindowsEventThread. |
|
7832 ] |
|
7833 ]. |
|
7834 ] valueNowOrOnUnwindDo:[ |
|
7835 JavaEventThread := nil. |
|
7836 ]. |
|
7837 |
|
7838 "Created: / 17.11.1998 / 23:04:29 / cg" |
|
7839 "Modified: / 8.1.1999 / 17:08:21 / cg" |
|
7840 ! |
|
7841 |
|
7842 _MToolkit_init:nativeContext |
|
7843 |
|
7844 "Created: / 28.1.1998 / 22:21:54 / cg" |
|
7845 ! |
|
7846 |
|
7847 _MToolkit_loadSystemColors:nativeContext |
|
7848 ^ self _WToolkit_loadSystemColors:nativeContext |
|
7849 ! |
|
7850 |
|
7851 _MToolkit_run:nativeContext |
|
7852 |
|
7853 "Created: / 28.1.1998 / 22:22:10 / cg" |
|
7854 ! |
|
7855 |
|
7856 _Math_IEEEremainder:nativeContext |
|
7857 UnimplementedNativeMethodSignal raise |
|
7858 |
|
7859 "Created: / 12.11.1998 / 18:52:36 / cg" |
|
7860 ! |
|
7861 |
|
7862 _Math_acos:nativeContext |
|
7863 "arc cosine" |
|
7864 |
|
7865 |dVal| |
|
7866 |
|
7867 dVal := nativeContext argAt:1. |
|
7868 "/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
|
7869 "/ dVal isReal ifTrue:[ |
|
7870 "/ 'JAVAVM [info]: missing double flag in Math>>acos' infoPrintCR. |
|
7871 "/ ] ifFalse:[ |
|
7872 "/ self halt:'expected double arg' |
|
7873 "/ ] |
|
7874 "/ ]. |
|
7875 ^ dVal arcCos |
|
7876 |
|
7877 "Created: / 7.5.1998 / 00:34:50 / cg" |
|
7878 "Modified: / 11.11.1998 / 15:08:20 / cg" |
|
7879 ! |
|
7880 |
|
7881 _Math_asin:nativeContext |
|
7882 "arc sine" |
|
7883 |
|
7884 |dVal| |
|
7885 |
|
7886 dVal := nativeContext argAt:1. |
|
7887 "/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
|
7888 "/ dVal isReal ifTrue:[ |
|
7889 "/ 'JAVAVM [info]: missing double flag in Math>>asin' infoPrintCR. |
|
7890 "/ ] ifFalse:[ |
|
7891 "/ self halt:'expected double arg' |
|
7892 "/ ] |
|
7893 "/ ]. |
|
7894 ^ dVal arcSin |
|
7895 |
|
7896 "Created: / 7.5.1998 / 00:34:26 / cg" |
|
7897 "Modified: / 11.11.1998 / 15:08:15 / cg" |
|
7898 ! |
|
7899 |
|
7900 _Math_atan2:nativeContext |
|
7901 UnimplementedNativeMethodSignal raise |
|
7902 |
|
7903 "Created: / 12.11.1998 / 18:52:52 / cg" |
|
7904 ! |
|
7905 |
|
7906 _Math_atan:nativeContext |
|
7907 "arc tangens" |
|
7908 |
|
7909 |dVal| |
|
7910 |
|
7911 dVal := nativeContext argAt:1. |
|
7912 "/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
|
7913 "/ dVal isReal ifTrue:[ |
|
7914 "/ 'JAVAVM [info]: missing double flag in Math>>atan' infoPrintCR. |
|
7915 "/ ] ifFalse:[ |
|
7916 "/ self halt:'expected double arg' |
|
7917 "/ ] |
|
7918 "/ ]. |
|
7919 ^ dVal arcTan |
|
7920 |
|
7921 "Created: / 6.2.1998 / 01:24:12 / cg" |
|
7922 "Modified: / 11.11.1998 / 15:08:11 / cg" |
|
7923 ! |
|
7924 |
|
7925 _Math_ceil:nativeContext |
|
7926 "ceiling" |
|
7927 |
|
7928 |dVal| |
|
7929 |
|
7930 dVal := nativeContext argAt:1. |
|
7931 "/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
|
7932 "/ dVal isReal ifTrue:[ |
|
7933 "/ 'JAVAVM [info]: missing double flag in Math>>ceil' infoPrintCR. |
|
7934 "/ ] ifFalse:[ |
|
7935 "/ self halt:'expected double arg' |
|
7936 "/ ] |
|
7937 "/ ]. |
|
7938 ^ dVal ceilingAsFloat |
|
7939 |
|
7940 "Created: / 7.1.1998 / 15:43:00 / cg" |
|
7941 "Modified: / 11.11.1998 / 15:08:04 / cg" |
|
7942 ! |
|
7943 |
|
7944 _Math_cos:nativeContext |
|
7945 "cosine" |
|
7946 |
|
7947 |dVal| |
|
7948 |
|
7949 dVal := nativeContext argAt:1. |
|
7950 "/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
|
7951 "/ dVal isReal ifTrue:[ |
|
7952 "/ 'JAVAVM [info]: missing double flag in Math>>cos' infoPrintCR. |
|
7953 "/ ] ifFalse:[ |
|
7954 "/ self halt:'expected double arg' |
|
7955 "/ ] |
|
7956 "/ ]. |
|
7957 ^ dVal cos |
|
7958 |
|
7959 "Created: / 7.1.1998 / 15:41:30 / cg" |
|
7960 "Modified: / 11.11.1998 / 15:07:59 / cg" |
|
7961 ! |
|
7962 |
|
7963 _Math_exp:nativeContext |
|
7964 "exponential" |
|
7965 |
|
7966 |dVal| |
|
7967 |
|
7968 dVal := nativeContext argAt:1. |
|
7969 "/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
|
7970 "/ dVal isReal ifTrue:[ |
|
7971 "/ 'JAVAVM [info]: missing double flag in Math>>exp' infoPrintCR. |
|
7972 "/ ] ifFalse:[ |
|
7973 "/ self halt:'expected double arg' |
|
7974 "/ ] |
|
7975 "/ ]. |
|
7976 ^ dVal exp |
|
7977 |
|
7978 "Created: / 7.5.1998 / 00:36:19 / cg" |
|
7979 "Modified: / 11.11.1998 / 15:07:50 / cg" |
|
7980 ! |
|
7981 |
|
7982 _Math_floor:nativeContext |
|
7983 "floor" |
|
7984 |
|
7985 |dVal| |
|
7986 |
|
7987 dVal := nativeContext argAt:1. |
|
7988 "/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
|
7989 "/ dVal isReal ifTrue:[ |
|
7990 "/ 'JAVAVM [info]: missing double flag in Math>>floor' infoPrintCR. |
|
7991 "/ ] ifFalse:[ |
|
7992 "/ self halt:'expected double arg' |
|
7993 "/ ] |
|
7994 "/ ]. |
|
7995 ^ dVal floorAsFloat |
|
7996 |
|
7997 "Created: / 7.1.1998 / 19:09:21 / cg" |
|
7998 "Modified: / 11.11.1998 / 15:07:45 / cg" |
|
7999 ! |
|
8000 |
|
8001 _Math_log:nativeContext |
|
8002 "natural logarithm" |
|
8003 |
|
8004 |dVal| |
|
8005 |
|
8006 dVal := nativeContext argAt:1. |
|
8007 "/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
|
8008 "/ dVal isReal ifTrue:[ |
|
8009 "/ 'JAVAVM [info]: missing double flag in Math>>log' infoPrintCR. |
|
8010 "/ ] ifFalse:[ |
|
8011 "/ self halt:'expected double arg' |
|
8012 "/ ] |
|
8013 "/ ]. |
|
8014 ^ dVal ln |
|
8015 |
|
8016 "Created: / 7.1.1998 / 15:42:19 / cg" |
|
8017 "Modified: / 30.12.1998 / 17:41:42 / cg" |
|
8018 ! |
|
8019 |
|
8020 _Math_pow:nativeContext |
|
8021 "power" |
|
8022 |
|
8023 |dVal1 dVal2| |
|
8024 |
|
8025 dVal1 := nativeContext argAt:1. |
|
8026 "/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
|
8027 "/ dVal1 isReal ifTrue:[ |
|
8028 "/ 'JAVAVM [info]: missing double flag in Math>>pow' infoPrintCR. |
|
8029 "/ ] ifFalse:[ |
|
8030 "/ self halt:'expected double arg' |
|
8031 "/ ] |
|
8032 "/ ]. |
|
8033 dVal2 := nativeContext argAt:3. |
|
8034 "/ (nativeContext argAt:4) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
|
8035 "/ dVal2 isReal ifTrue:[ |
|
8036 "/ 'JAVAVM [info]: missing double flag in Math>>pow' infoPrintCR. |
|
8037 "/ ] ifFalse:[ |
|
8038 "/ self halt:'expected double arg' |
|
8039 "/ ] |
|
8040 "/ ]. |
|
8041 ^ dVal1 raisedTo:dVal2 |
|
8042 |
|
8043 "Created: / 7.1.1998 / 15:44:13 / cg" |
|
8044 "Modified: / 11.11.1998 / 15:07:33 / cg" |
|
8045 ! |
|
8046 |
|
8047 _Math_rint:nativeContext |
|
8048 |dVal| |
|
8049 |
|
8050 dVal := nativeContext argAt:1. |
|
8051 ^ dVal rounded asFloat. |
|
8052 ! |
|
8053 |
|
8054 _Math_sin:nativeContext |
|
8055 "sine" |
|
8056 |
|
8057 |dVal| |
|
8058 |
|
8059 dVal := nativeContext argAt:1. |
|
8060 "/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
|
8061 "/ dVal isReal ifTrue:[ |
|
8062 "/ 'JAVAVM [info]: missing double flag in Math>>sin' infoPrintCR. |
|
8063 "/ ] ifFalse:[ |
|
8064 "/ self halt:'expected double arg' |
|
8065 "/ ] |
|
8066 "/ ]. |
|
8067 ^ dVal sin |
|
8068 |
|
8069 "Created: / 7.1.1998 / 15:41:40 / cg" |
|
8070 "Modified: / 11.11.1998 / 15:07:09 / cg" |
|
8071 ! |
|
8072 |
|
8073 _Math_sqrt:nativeContext |
|
8074 "square root" |
|
8075 |
|
8076 |dVal| |
|
8077 |
|
8078 dVal := nativeContext argAt:1. |
|
8079 "/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
|
8080 "/ dVal isReal ifTrue:[ |
|
8081 "/ 'JAVAVM [info]: missing double flag in Math>>sqrt' infoPrintCR. |
|
8082 "/ ] ifFalse:[ |
|
8083 "/ self halt:'expected double arg' |
|
8084 "/ ] |
|
8085 "/ ]. |
|
8086 |
|
8087 "/ how about domain errors ? |
|
8088 dVal < 0 ifTrue:[ |
|
8089 ^ 0.0 |
|
8090 ]. |
|
8091 ^ dVal sqrt |
|
8092 |
|
8093 "Created: / 7.1.1998 / 15:42:40 / cg" |
|
8094 "Modified: / 29.12.1998 / 13:22:36 / cg" |
|
8095 ! |
|
8096 |
|
8097 _Math_tan:nativeContext |
|
8098 "tangent" |
|
8099 |
|
8100 |dVal| |
|
8101 |
|
8102 dVal := nativeContext argAt:1. |
|
8103 "/ (nativeContext argAt:2) ~~ DUMMY_DOUBLE_HIGHWORD ifTrue:[ |
|
8104 "/ dVal isReal ifTrue:[ |
|
8105 "/ 'JAVAVM [info]: missing double flag in Math>>tan' infoPrintCR. |
|
8106 "/ ] ifFalse:[ |
|
8107 "/ self halt:'expected double arg' |
|
8108 "/ ] |
|
8109 "/ ]. |
|
8110 ^ dVal tan |
|
8111 |
|
8112 "Created: / 7.5.1998 / 00:34:03 / cg" |
|
8113 "Modified: / 11.11.1998 / 15:07:14 / cg" |
|
8114 ! |
|
8115 |
|
8116 _MemoryAdvice_register0:nativeContext |
|
8117 "private native void register0()" |
|
8118 |
|
8119 "/ UnimplementedNativeMethodSignal raise |
|
8120 ! |
|
8121 |
|
8122 _Method_getModifiers:nativeContext |
|
8123 |jMethod mthd retVal| |
|
8124 |
|
8125 jMethod := nativeContext receiver. |
|
8126 |
|
8127 mthd := JavaMethods at:jMethod ifAbsent:nil. |
|
8128 mthd isNil ifTrue:[ |
|
8129 self halt. |
|
8130 ^ 0 |
|
8131 ]. |
|
8132 ^ mthd accessFlags |
|
8133 |
|
8134 "Modified: / 9.4.1998 / 17:50:01 / cg" |
|
8135 ! |
|
8136 |
|
8137 _Method_invoke:nativeContext |
|
8138 "invoke a javaMethod" |
|
8139 |
|
8140 |jMethod mthd rec args retVal| |
|
8141 |
|
8142 jMethod := nativeContext receiver. |
|
8143 rec := nativeContext argAt:1. |
|
8144 args := nativeContext argAt:2. |
|
8145 |
|
8146 mthd := JavaMethods at:jMethod ifAbsent:nil. |
|
8147 mthd isNil ifTrue:[ |
|
8148 self halt. |
|
8149 ]. |
|
8150 |
|
8151 "/ check for arguments to match the expected types ... |
|
8152 |
|
8153 mthd argSignature keysAndValuesDo:[:index :argSig | |
|
8154 |cls arg| |
|
8155 |
|
8156 cls := Java at:argSig. |
|
8157 arg := args at:index. |
|
8158 (arg isKindOf:cls) ifFalse:[ |
|
8159 self halt. |
|
8160 ] |
|
8161 ]. |
|
8162 |
|
8163 mthd isStatic ifTrue:[ |
|
8164 retVal := mthd valueWithReceiver:(mthd javaClass) arguments:args selector:mthd selector. |
|
8165 ^ retVal |
|
8166 ] ifFalse:[ |
|
8167 self halt. |
|
8168 ]. |
|
8169 |
|
8170 self halt. |
|
8171 |
|
8172 "Created: / 13.2.1998 / 15:15:28 / cg" |
|
8173 "Modified: / 13.2.1998 / 15:35:54 / cg" |
|
8174 ! |
|
8175 |
|
8176 _MozillaAppletContext_pMochaOnLoad:nativeContext |
|
8177 |id| |
|
8178 |
|
8179 id := nativeContext argAt:1. |
|
8180 "/ 'JAVA: MozillaAppletContext_pMochaOnLoad: ' print. id printNL. |
|
8181 ^ nil |
|
8182 |
|
8183 "Created: / 6.1.1998 / 20:37:13 / cg" |
|
8184 "Modified: / 6.2.1998 / 02:13:09 / cg" |
|
8185 ! |
|
8186 |
|
8187 _MozillaAppletContext_pShowDocument:nativeContext |
|
8188 |jAppletContext s1 s2 s3 js| |
|
8189 |
|
8190 jAppletContext := nativeContext receiver. |
|
8191 js := nativeContext argAt:1. |
|
8192 s1 := Java as_ST_String:js. |
|
8193 js := nativeContext argAt:2. |
|
8194 s2 := Java as_ST_String:js. |
|
8195 js := nativeContext argAt:3. |
|
8196 s2 := Java as_ST_String:js. |
|
8197 |
|
8198 "/ somehow pass it to the html browser .... |
|
8199 Transcript show:'pShowDocument: '; show:s1; show:' / '; |
|
8200 show:s2; show:' / '; showCR:s3. |
|
8201 |
|
8202 ^ nil |
|
8203 |
|
8204 "Created: / 29.3.1998 / 15:53:17 / cg" |
|
8205 "Modified: / 29.12.1998 / 13:32:41 / cg" |
|
8206 ! |
|
8207 |
|
8208 _MozillaAppletContext_pShowStatus:nativeContext |
|
8209 |s js| |
|
8210 |
|
8211 js := nativeContext argAt:1. |
|
8212 js isNil ifTrue:[ |
|
8213 s := '' |
|
8214 ] ifFalse:[ |
|
8215 s := Java as_ST_String:js. |
|
8216 ]. |
|
8217 |
|
8218 self activityNotification:s. |
|
8219 "/ Transcript showCR:s. |
|
8220 ^ nil |
|
8221 |
|
8222 "Created: / 6.1.1998 / 18:31:34 / cg" |
|
8223 "Modified: / 22.10.1998 / 01:17:46 / cg" |
|
8224 ! |
|
8225 |
|
8226 _MozillaAppletContext_setConsoleState0:nativeContext |
|
8227 "/ void setConsoleState0 (int) |
|
8228 UnimplementedNativeMethodSignal raise |
|
8229 |
|
8230 "Created: / 12.11.1998 / 19:23:22 / cg" |
|
8231 ! |
|
8232 |
|
8233 _ObjectInputStream_allocateNewArray:nativeContext |
|
8234 "/ java.lang.Object allocateNewArray (java.lang.Class int) |
|
8235 UnimplementedNativeMethodSignal raise |
|
8236 |
|
8237 "Modified: / 12.11.1998 / 19:01:48 / cg" |
|
8238 "Created: / 12.11.1998 / 19:02:52 / cg" |
|
8239 ! |
|
8240 |
|
8241 _ObjectInputStream_allocateNewObject:nativeContext |
|
8242 "/ java.lang.Object allocateNewObject (java.lang.Class java.lang.Class) |
|
8243 UnimplementedNativeMethodSignal raise |
|
8244 |
|
8245 "Modified: / 12.11.1998 / 19:01:48 / cg" |
|
8246 "Created: / 12.11.1998 / 19:02:40 / cg" |
|
8247 ! |
|
8248 |
|
8249 _ObjectInputStream_inputClassFields:nativeContext |
|
8250 "/ void inputClassFields (java.lang.Object java.lang.Class int[]) |
|
8251 UnimplementedNativeMethodSignal raise |
|
8252 |
|
8253 "Modified: / 12.11.1998 / 19:01:48 / cg" |
|
8254 "Created: / 12.11.1998 / 19:02:22 / cg" |
|
8255 ! |
|
8256 |
|
8257 _ObjectInputStream_invokeDefaultReadObject:nativeContext |
|
8258 "/ void invokeDefaultReadObject (java.lang.Object java.lang.Class) |
|
8259 |
|
8260 UnimplementedNativeMethodSignal raise |
|
8261 |
|
8262 "Created: / 27.1.2000 / 03:00:47 / cg" |
|
8263 ! |
|
8264 |
|
8265 _ObjectInputStream_invokeObjectReader:nativeContext |
|
8266 "/ boolean invokeObjectReader (java.lang.Object java.lang.Class) |
|
8267 UnimplementedNativeMethodSignal raise |
|
8268 |
|
8269 "Modified: / 12.11.1998 / 19:01:48 / cg" |
|
8270 "Created: / 12.11.1998 / 19:03:06 / cg" |
|
8271 ! |
|
8272 |
|
8273 _ObjectInputStream_invokeReadObject:nativeContext |
|
8274 "/ void invokeReadObject (java.lang.Object java.lang.Class) |
|
8275 |
|
8276 UnimplementedNativeMethodSignal raise |
|
8277 |
|
8278 "Created: / 27.1.2000 / 03:01:02 / cg" |
|
8279 ! |
|
8280 |
|
8281 _ObjectInputStream_loadClass0:nativeContext |
|
8282 "/ java.lang.Class loadClass0 (java.lang.Class java.lang.String) |
|
8283 UnimplementedNativeMethodSignal raise |
|
8284 |
|
8285 "Created: / 12.11.1998 / 19:01:15 / cg" |
|
8286 "Modified: / 12.11.1998 / 19:01:48 / cg" |
|
8287 ! |
|
8288 |
|
8289 _ObjectOutputStream_invokeDefaultWriteObject:nativeContext |
|
8290 "/ void invokeDefaultWriteObject (java.lang.Object java.lang.Class) |
|
8291 |
|
8292 UnimplementedNativeMethodSignal raise |
|
8293 |
|
8294 "Created: / 27.1.2000 / 03:01:36 / cg" |
|
8295 ! |
|
8296 |
|
8297 _ObjectOutputStream_invokeObjectWriter:nativeContext |
|
8298 "/ boolean invokeObjectWriter (java.lang.Object java.lang.Class) |
|
8299 UnimplementedNativeMethodSignal raise |
|
8300 |
|
8301 "Created: / 12.11.1998 / 19:00:36 / cg" |
|
8302 "Modified: / 12.11.1998 / 19:01:45 / cg" |
|
8303 ! |
|
8304 |
|
8305 _ObjectOutputStream_invokeWriteObject:nativeContext |
|
8306 "/ void invokeWriteObject (java.lang.Object java.lang.Class) |
|
8307 |
|
8308 UnimplementedNativeMethodSignal raise |
|
8309 |
|
8310 "Created: / 27.1.2000 / 03:01:52 / cg" |
|
8311 ! |
|
8312 |
|
8313 _ObjectOutputStream_outputClassFields:nativeContext |
|
8314 "/ void outputClassFields (java.lang.Object java.lang.Class int[]) |
|
8315 UnimplementedNativeMethodSignal raise |
|
8316 |
|
8317 "Created: / 12.11.1998 / 19:00:09 / cg" |
|
8318 "Modified: / 12.11.1998 / 19:01:42 / cg" |
|
8319 ! |
|
8320 |
|
8321 _ObjectStreamClass_doMismatchedRead:nativeContext |
|
8322 "/ void doMismatchedRead (java.io.ObjectInputStream java.lang.Object) |
|
8323 |
|
8324 UnimplementedNativeMethodSignal raise |
|
8325 |
|
8326 "Created: / 27.1.2000 / 02:50:55 / cg" |
|
8327 ! |
|
8328 |
|
8329 _ObjectStreamClass_findObjectMethod0:nativeContext |
|
8330 "/ boolean findObjectMethod0 (java.lang.Class int) |
|
8331 |
|
8332 UnimplementedNativeMethodSignal raise |
|
8333 |
|
8334 "Created: / 27.1.2000 / 02:51:50 / cg" |
|
8335 ! |
|
8336 |
|
8337 _ObjectStreamClass_getClassAccess:nativeContext |
|
8338 "/ int getClassAccess (java.lang.Class) |
|
8339 UnimplementedNativeMethodSignal raise |
|
8340 |
|
8341 "Modified: / 12.11.1998 / 19:01:48 / cg" |
|
8342 "Created: / 12.11.1998 / 19:04:19 / cg" |
|
8343 ! |
|
8344 |
|
8345 _ObjectStreamClass_getClassDefinedUID:nativeContext |
|
8346 "/ long getClassDefinedUID (java.lang.Class) |
|
8347 |
|
8348 UnimplementedNativeMethodSignal raise |
|
8349 |
|
8350 "Created: / 27.1.2000 / 02:51:33 / cg" |
|
8351 ! |
|
8352 |
|
8353 _ObjectStreamClass_getFieldAccess:nativeContext |
|
8354 "/ int getFieldAccess (java.lang.Class java.lang.String) |
|
8355 UnimplementedNativeMethodSignal raise |
|
8356 |
|
8357 "Modified: / 12.11.1998 / 19:01:48 / cg" |
|
8358 "Created: / 12.11.1998 / 19:05:19 / cg" |
|
8359 ! |
|
8360 |
|
8361 _ObjectStreamClass_getFieldSignatures:nativeContext |
|
8362 "/ java.lang.String[] getFieldSignatures (java.lang.Class) |
|
8363 UnimplementedNativeMethodSignal raise |
|
8364 |
|
8365 "Modified: / 12.11.1998 / 19:01:48 / cg" |
|
8366 "Created: / 12.11.1998 / 19:05:04 / cg" |
|
8367 ! |
|
8368 |
|
8369 _ObjectStreamClass_getFields0:nativeContext |
|
8370 "/ java.io.ObjectStreamField[] getFields0 (java.lang.Class) |
|
8371 UnimplementedNativeMethodSignal raise |
|
8372 |
|
8373 "Modified: / 12.11.1998 / 19:01:48 / cg" |
|
8374 "Created: / 12.11.1998 / 19:05:32 / cg" |
|
8375 ! |
|
8376 |
|
8377 _ObjectStreamClass_getMethodAccess:nativeContext |
|
8378 "/ int getMethodAccess (java.lang.Class java.lang.String) |
|
8379 UnimplementedNativeMethodSignal raise |
|
8380 |
|
8381 "Modified: / 12.11.1998 / 19:01:48 / cg" |
|
8382 "Created: / 12.11.1998 / 19:04:51 / cg" |
|
8383 ! |
|
8384 |
|
8385 _ObjectStreamClass_getMethodSignatures:nativeContext |
|
8386 "/ java.lang.String[] getMethodSignatures (java.lang.Class) |
|
8387 UnimplementedNativeMethodSignal raise |
|
8388 |
|
8389 "Modified: / 12.11.1998 / 19:01:48 / cg" |
|
8390 "Created: / 12.11.1998 / 19:04:34 / cg" |
|
8391 ! |
|
8392 |
|
8393 _ObjectStreamClass_getSerialVersionUID:nativeContext |
|
8394 "/ long getSerialVersionUID (java.lang.Class) |
|
8395 UnimplementedNativeMethodSignal raise |
|
8396 |
|
8397 "Modified: / 12.11.1998 / 19:01:48 / cg" |
|
8398 "Created: / 12.11.1998 / 19:05:43 / cg" |
|
8399 ! |
|
8400 |
|
8401 _ObjectStreamClass_hasWriteObject:nativeContext |
|
8402 "/ boolean hasWriteObject (java.lang.Class) |
|
8403 UnimplementedNativeMethodSignal raise |
|
8404 |
|
8405 "Modified: / 12.11.1998 / 19:01:48 / cg" |
|
8406 "Created: / 12.11.1998 / 19:05:53 / cg" |
|
8407 ! |
|
8408 |
|
8409 _Object_notify:nativeContext |
|
8410 "wakeup" |
|
8411 |
|
8412 self wakeup:(nativeContext receiver). |
|
8413 |
|
8414 "Created: / 6.1.1998 / 21:09:26 / cg" |
|
8415 ! |
|
8416 |
|
8417 _Object_notifyAll:nativeContext |
|
8418 self wakeupAll:(nativeContext receiver). |
|
8419 |
|
8420 "Created: / 3.1.1998 / 03:06:56 / cg" |
|
8421 ! |
|
8422 |
|
8423 _OffScreenImageSource_sendPixels:nativeContext |
|
8424 "/ self halt. |
|
8425 "/ UnimplementedNativeMethodSignal raise |
|
8426 |
|
8427 "Modified: / 16.1.1998 / 18:22:23 / cg" |
|
8428 "Created: / 17.1.1998 / 12:36:25 / cg" |
|
8429 ! |
|
8430 |
|
8431 _PackedColorModel_initIDs:nativeContext |
|
8432 "/ new with jdk1.2 ... |
|
8433 |
|
8434 "Created: / 28.1.1998 / 22:19:35 / cg" |
|
8435 ! |
|
8436 |
|
8437 _PlainDatagramSocketImpl_bind:nativeContext |
|
8438 |jsock jaddr port sock hostName ok err| |
|
8439 |
|
8440 jsock := nativeContext receiver. |
|
8441 port := nativeContext argAt:1. |
|
8442 jaddr := nativeContext argAt:2. |
|
8443 |
|
8444 hostName := jaddr instVarNamed:'hostName'. |
|
8445 hostName isNil ifTrue:[ |
|
8446 self halt. |
|
8447 ] ifFalse:[ |
|
8448 hostName := Java as_ST_String:hostName |
|
8449 ]. |
|
8450 |
|
8451 sock := self validateFile:jsock. |
|
8452 sock notNil ifTrue:[ |
|
8453 FileIOTrace ifTrue:[ |
|
8454 ('JAVA: socket bind to ' , hostName printString, ' port ' , port printString) infoPrintCR |
|
8455 ]. |
|
8456 |
|
8457 ok := sock bindTo:port address:nil "hostName". |
|
8458 ok ifFalse:[ |
|
8459 err := OperatingSystem lastErrorString. |
|
8460 Transcript showCR:'sock err: ' , err printString. |
|
8461 self throwIOExceptionWithMessage:'bind failed'. |
|
8462 ] |
|
8463 ]. |
|
8464 |
|
8465 "Created: / 4.2.1998 / 15:06:20 / cg" |
|
8466 "Modified: / 30.12.1998 / 20:10:16 / cg" |
|
8467 ! |
|
8468 |
|
8469 _PlainDatagramSocketImpl_datagramSocketClose:nativeContext |
|
8470 |jsock sock| |
|
8471 |
|
8472 jsock := nativeContext receiver. |
|
8473 |
|
8474 sock := self validateFile:jsock. |
|
8475 sock notNil ifTrue:[ |
|
8476 FileIOTrace ifTrue:[ |
|
8477 'JAVA: datagram close socket' infoPrintCR |
|
8478 ]. |
|
8479 sock close. |
|
8480 ]. |
|
8481 |
|
8482 "Modified: / 21.8.1997 / 17:09:40 / cg" |
|
8483 "Created: / 25.1.1998 / 20:04:24 / cg" |
|
8484 ! |
|
8485 |
|
8486 _PlainDatagramSocketImpl_datagramSocketCreate:nativeContext |
|
8487 |jsock fd sock fileNo| |
|
8488 |
|
8489 jsock := nativeContext receiver. |
|
8490 |
|
8491 fd := jsock instVarNamed:'fd'. |
|
8492 (fd instVarNamed:'fd') ~~ 0 ifTrue:[ |
|
8493 self halt:'file already open'. |
|
8494 self internalError:'file already open'. |
|
8495 self throwIOExceptionWithMessage:'file already open in socketCreate'. |
|
8496 ^ self. |
|
8497 ]. |
|
8498 |
|
8499 FileOpenTrace ifTrue:[ |
|
8500 ('JAVA: create datagram socket') infoPrintCR. |
|
8501 ]. |
|
8502 |
|
8503 sock := Socket newUDP. |
|
8504 sock isNil ifTrue:[ |
|
8505 self throwIOExceptionWithMessage:'socketCreate failed'. |
|
8506 ]. |
|
8507 |
|
8508 fileNo := self addOpenFile:sock. |
|
8509 fd instVarNamed:'fd' put:fileNo. |
|
8510 |
|
8511 "Created: / 25.1.1998 / 19:59:25 / cg" |
|
8512 "Modified: / 30.12.1998 / 20:10:38 / cg" |
|
8513 ! |
|
8514 |
|
8515 _PlainDatagramSocketImpl_join:nativeContext |
|
8516 "/ native void join (InetAddress arg1) |
|
8517 |
|
8518 |jsock addr sock ok err| |
|
8519 |
|
8520 jsock := nativeContext receiver. |
|
8521 addr := nativeContext argAt:1. |
|
8522 |
|
8523 sock := self validateFile:jsock. |
|
8524 sock notNil ifTrue:[ |
|
8525 FileIOTrace ifTrue:[ |
|
8526 ('JAVA: socket join ' , addr printString) infoPrintCR |
|
8527 ]. |
|
8528 self throwIOExceptionWithMessage:'unimplemented: join'. |
|
8529 self halt. |
|
8530 ^ nil. "/ void |
|
8531 ]. |
|
8532 |
|
8533 "Created: / 4.2.1998 / 15:06:20 / cg" |
|
8534 "Modified: / 30.12.1998 / 20:10:16 / cg" |
|
8535 ! |
|
8536 |
|
8537 _PlainDatagramSocketImpl_receive:nativeContext |
|
8538 |jsock jdatagramPacket sock ok| |
|
8539 |
|
8540 jsock := nativeContext receiver. |
|
8541 jdatagramPacket := nativeContext argAt:1. |
|
8542 |
|
8543 sock := self validateFile:jsock. |
|
8544 sock notNil ifTrue:[ |
|
8545 FileIOTrace ifTrue:[ |
|
8546 ('JAVA: socket receive') infoPrintCR |
|
8547 ]. |
|
8548 ^ -1. |
|
8549 ]. |
|
8550 ^ -1 |
|
8551 |
|
8552 "Created: / 4.2.1998 / 15:06:20 / cg" |
|
8553 "Modified: / 30.12.1998 / 20:10:16 / cg" |
|
8554 ! |
|
8555 |
|
8556 _PlainDatagramSocketImpl_send:nativeContext |
|
8557 |jsock jdatagramPacket sock ok| |
|
8558 |
|
8559 jsock := nativeContext receiver. |
|
8560 jdatagramPacket := nativeContext argAt:1. |
|
8561 |
|
8562 sock := self validateFile:jsock. |
|
8563 sock notNil ifTrue:[ |
|
8564 FileIOTrace ifTrue:[ |
|
8565 ('JAVA: socket send') infoPrintCR |
|
8566 ]. |
|
8567 ^ -1. |
|
8568 ]. |
|
8569 ^ -1 |
|
8570 |
|
8571 "Created: / 4.2.1998 / 15:06:20 / cg" |
|
8572 "Modified: / 30.12.1998 / 20:10:16 / cg" |
|
8573 ! |
|
8574 |
|
8575 _PlainDatagramSocketImpl_socketGetOption:nativeContext |
|
8576 |jsock opt port sock hostName ok err| |
|
8577 |
|
8578 jsock := nativeContext receiver. |
|
8579 opt := nativeContext argAt:1. |
|
8580 |
|
8581 sock := self validateFile:jsock. |
|
8582 sock notNil ifTrue:[ |
|
8583 FileIOTrace ifTrue:[ |
|
8584 ('JAVA: socket getOption ' , opt printString) infoPrintCR |
|
8585 ]. |
|
8586 self throwIOExceptionWithMessage:'unimplemented: getOption'. |
|
8587 self halt. |
|
8588 ^ -1. |
|
8589 ]. |
|
8590 ^ -1. |
|
8591 |
|
8592 "Created: / 4.2.1998 / 15:06:20 / cg" |
|
8593 "Modified: / 30.12.1998 / 20:10:16 / cg" |
|
8594 ! |
|
8595 |
|
8596 _PlainDatagramSocketImpl_socketSetOption:nativeContext |
|
8597 "/ native void socketSetOption (int arg1, java.lang.Object arg2) |
|
8598 |
|
8599 |jsock opt optVal sock ok err jSocketOptions| |
|
8600 |
|
8601 jsock := nativeContext receiver. |
|
8602 opt := nativeContext argAt:1. |
|
8603 optVal := nativeContext argAt:2. |
|
8604 |
|
8605 sock := self validateFile:jsock. |
|
8606 sock notNil ifTrue:[ |
|
8607 FileIOTrace ifTrue:[ |
|
8608 ('JAVA: socket setOption ' , opt printString) infoPrintCR |
|
8609 ]. |
|
8610 |
|
8611 jSocketOptions := Java at:'java.net.SocketOptions'. |
|
8612 (opt == (jSocketOptions instVarNamed:'TCP_NODELAY')) ifTrue:[ |
|
8613 ] ifFalse:[ |
|
8614 (opt == (jSocketOptions instVarNamed:'SO_BINDADDR')) ifTrue:[ |
|
8615 ] ifFalse:[ |
|
8616 (opt == (jSocketOptions instVarNamed:'SO_REUSEADDR')) ifTrue:[ |
|
8617 ] ifFalse:[ |
|
8618 (opt == (jSocketOptions instVarNamed:'IP_MULTICAST_IF')) ifTrue:[ |
|
8619 ] ifFalse:[ |
|
8620 (opt == (jSocketOptions instVarNamed:'SO_LINGER')) ifTrue:[ |
|
8621 ] ifFalse:[ |
|
8622 (opt == (jSocketOptions instVarNamed:'SO_TIMEOUT')) ifTrue:[ |
|
8623 ] ifFalse:[ |
|
8624 self throwIOExceptionWithMessage:'bad arg to setOption'. |
|
8625 ] |
|
8626 ] |
|
8627 ] |
|
8628 ] |
|
8629 ] |
|
8630 ]. |
|
8631 self throwIOExceptionWithMessage:'unimplemented: setOption'. |
|
8632 self halt. |
|
8633 ^ nil. "/ void |
|
8634 ]. |
|
8635 |
|
8636 "Created: / 4.2.1998 / 15:06:20 / cg" |
|
8637 "Modified: / 30.12.1998 / 20:10:16 / cg" |
|
8638 ! |
|
8639 |
|
8640 _PlainSocketImpl_initProto:nativeContext |
|
8641 |
|
8642 "Created: / 12.1.1998 / 12:56:52 / cg" |
|
8643 ! |
|
8644 |
|
8645 _PlainSocketImpl_socketAccept:nativeContext |
|
8646 |jsock fd newJSock sock newSock fileNo| |
|
8647 |
|
8648 jsock := nativeContext receiver. |
|
8649 |
|
8650 sock := self validateFile:jsock. |
|
8651 sock isNil ifTrue:[ |
|
8652 self throwIOExceptionWithMessage:'nil socket in accept'. |
|
8653 ^ self. |
|
8654 ]. |
|
8655 |
|
8656 newJSock := nativeContext argAt:1. |
|
8657 fd := newJSock instVarNamed:'fd'. |
|
8658 (fd instVarNamed:'fd') ~~ 0 ifTrue:[ |
|
8659 self halt:'file already open'. |
|
8660 self internalError:'file already open'. |
|
8661 self throwIOExceptionWithMessage:'socket already open in socketAccept'. |
|
8662 ^ self. |
|
8663 ]. |
|
8664 FileIOTrace ifTrue:[ |
|
8665 'JAVA: socket accept' infoPrintCR |
|
8666 ]. |
|
8667 newSock := sock accept. |
|
8668 newSock isNil ifTrue:[ |
|
8669 self throwIOExceptionWithMessage:'accept failed'. |
|
8670 ]. |
|
8671 fileNo := self addOpenFile:newSock. |
|
8672 fd instVarNamed:'fd' put:fileNo. |
|
8673 |
|
8674 "Created: / 4.2.1998 / 15:26:49 / cg" |
|
8675 "Modified: / 30.12.1998 / 20:10:01 / cg" |
|
8676 ! |
|
8677 |
|
8678 _PlainSocketImpl_socketAvailable:nativeContext |
|
8679 |jSock sock n| |
|
8680 |
|
8681 jSock := nativeContext receiver. |
|
8682 |
|
8683 sock := self validateFile:jSock. |
|
8684 sock isNil ifTrue:[ |
|
8685 self throwIOExceptionWithMessage:'socketAvailable on closed socket'. |
|
8686 ^ self. |
|
8687 ]. |
|
8688 |
|
8689 n := sock numAvailable. |
|
8690 ^ n |
|
8691 |
|
8692 "Created: / 4.2.1998 / 16:58:49 / cg" |
|
8693 "Modified: / 30.12.1998 / 20:10:08 / cg" |
|
8694 ! |
|
8695 |
|
8696 _PlainSocketImpl_socketBind:nativeContext |
|
8697 |jsock jaddr port sock hostName ok err| |
|
8698 |
|
8699 jsock := nativeContext receiver. |
|
8700 jaddr := nativeContext argAt:1. |
|
8701 port := nativeContext argAt:2. |
|
8702 |
|
8703 hostName := jaddr instVarNamed:'hostName'. |
|
8704 hostName isNil ifTrue:[ |
|
8705 self halt. |
|
8706 ] ifFalse:[ |
|
8707 hostName := Java as_ST_String:hostName |
|
8708 ]. |
|
8709 |
|
8710 sock := self validateFile:jsock. |
|
8711 sock notNil ifTrue:[ |
|
8712 FileIOTrace ifTrue:[ |
|
8713 ('JAVA: socket bind to ' , hostName printString, ' port ' , port printString) infoPrintCR |
|
8714 ]. |
|
8715 |
|
8716 ok := sock bindTo:port address:nil "hostName". |
|
8717 ok ifFalse:[ |
|
8718 err := OperatingSystem lastErrorString. |
|
8719 Transcript showCR:'sock err: ' , err printString. |
|
8720 self throwIOExceptionWithMessage:'bind failed'. |
|
8721 ] |
|
8722 ]. |
|
8723 |
|
8724 "Created: / 4.2.1998 / 15:06:20 / cg" |
|
8725 "Modified: / 30.12.1998 / 20:10:16 / cg" |
|
8726 ! |
|
8727 |
|
8728 _PlainSocketImpl_socketClose:nativeContext |
|
8729 |jsock sock| |
|
8730 |
|
8731 jsock := nativeContext receiver. |
|
8732 |
|
8733 sock := self validateFile:jsock. |
|
8734 sock notNil ifTrue:[ |
|
8735 FileIOTrace ifTrue:[ |
|
8736 'JAVA: close socket' infoPrintCR |
|
8737 ]. |
|
8738 sock close. |
|
8739 ]. |
|
8740 |
|
8741 "Modified: / 21.8.1997 / 17:09:40 / cg" |
|
8742 "Created: / 25.1.1998 / 20:04:24 / cg" |
|
8743 ! |
|
8744 |
|
8745 _PlainSocketImpl_socketConnect:nativeContext |
|
8746 |jsock jaddr port sock addr hostName ok| |
|
8747 |
|
8748 jsock := nativeContext receiver. |
|
8749 jaddr := nativeContext argAt:1. |
|
8750 port := nativeContext argAt:2. |
|
8751 |
|
8752 hostName := jaddr instVarNamed:'hostName'. |
|
8753 hostName notNil ifTrue:[ |
|
8754 hostName := Java as_ST_String:hostName |
|
8755 ] ifFalse:[ |
|
8756 addr := jaddr instVarNamed:'address'. |
|
8757 addr notNil ifTrue:[ |
|
8758 hostName := ByteArray new:4. |
|
8759 hostName at:4 put:(addr bitAnd:16rFF). |
|
8760 addr := addr bitShift:-8. |
|
8761 hostName at:3 put:(addr bitAnd:16rFF). |
|
8762 addr := addr bitShift:-8. |
|
8763 hostName at:2 put:(addr bitAnd:16rFF). |
|
8764 addr := addr bitShift:-8. |
|
8765 hostName at:1 put:(addr bitAnd:16rFF). |
|
8766 ]. |
|
8767 ]. |
|
8768 hostName isNil ifTrue:[ |
|
8769 self halt. |
|
8770 ]. |
|
8771 |
|
8772 sock := self validateFile:jsock. |
|
8773 sock notNil ifTrue:[ |
|
8774 FileIOTrace ifTrue:[ |
|
8775 ('JAVA: socket connect to ' , hostName printString , ' port ' , port printString) infoPrintCR |
|
8776 ]. |
|
8777 SocketConnectConfirmation ifTrue:[ |
|
8778 (PermittedHostConnects isNil |
|
8779 or:[(PermittedHostConnects includes:hostName) not]) ifTrue:[ |
|
8780 (self confirm:'connect to host: ' , hostName printString , ' - ok ?') |
|
8781 ifFalse:[ |
|
8782 self throwIOExceptionWithMessage:'connect permission denied'. |
|
8783 ]. |
|
8784 |
|
8785 (self confirm:('JAVA Security check\\Always permit connects to this host (''' , hostName printString , ''') ?') withCRs) |
|
8786 ifTrue:[ |
|
8787 PermittedHostConnects isNil ifTrue:[ |
|
8788 PermittedHostConnects := Set new |
|
8789 ]. |
|
8790 PermittedHostConnects add:hostName. |
|
8791 ] |
|
8792 ] |
|
8793 ]. |
|
8794 |
|
8795 ok := sock connectTo:hostName port:port. |
|
8796 ok ifFalse:[ |
|
8797 self throwIOExceptionWithMessage:'connect failed'. |
|
8798 ] |
|
8799 ]. |
|
8800 |
|
8801 "Created: / 25.1.1998 / 20:02:27 / cg" |
|
8802 "Modified: / 30.12.1998 / 20:10:28 / cg" |
|
8803 ! |
|
8804 |
|
8805 _PlainSocketImpl_socketCreate:nativeContext |
|
8806 |jsock isStream fd sock fileNo| |
|
8807 |
|
8808 jsock := nativeContext receiver. |
|
8809 isStream := (nativeContext argAt:1) == 1. |
|
8810 |
|
8811 fd := jsock instVarNamed:'fd'. |
|
8812 (fd instVarNamed:'fd') ~~ 0 ifTrue:[ |
|
8813 self halt:'file already open'. |
|
8814 self internalError:'file already open'. |
|
8815 self throwIOExceptionWithMessage:'file already open in socketCreate'. |
|
8816 ^ self. |
|
8817 ]. |
|
8818 |
|
8819 FileOpenTrace ifTrue:[ |
|
8820 ('JAVA: create socket') infoPrintCR. |
|
8821 ]. |
|
8822 |
|
8823 isStream ifTrue:[ |
|
8824 sock := Socket newTCP |
|
8825 ] ifFalse:[ |
|
8826 sock := Socket newUDP |
|
8827 ]. |
|
8828 sock isNil ifTrue:[ |
|
8829 self throwIOExceptionWithMessage:'socketCreate failed'. |
|
8830 ]. |
|
8831 |
|
8832 fileNo := self addOpenFile:sock. |
|
8833 fd instVarNamed:'fd' put:fileNo. |
|
8834 |
|
8835 "Created: / 25.1.1998 / 19:59:25 / cg" |
|
8836 "Modified: / 30.12.1998 / 20:10:38 / cg" |
|
8837 ! |
|
8838 |
|
8839 _PlainSocketImpl_socketListen:nativeContext |
|
8840 |jSock time sock ok| |
|
8841 |
|
8842 jSock := nativeContext receiver. |
|
8843 time := nativeContext argAt:1. |
|
8844 |
|
8845 sock := self validateFile:jSock. |
|
8846 sock notNil ifTrue:[ |
|
8847 FileIOTrace ifTrue:[ |
|
8848 ('JAVA: socket listen with timeout ' , time printString) infoPrintCR. |
|
8849 ]. |
|
8850 ok := sock listenWithBacklog:5. |
|
8851 ok ifFalse:[ |
|
8852 self throwIOExceptionWithMessage:'listen failed'. |
|
8853 ^ self. |
|
8854 ]. |
|
8855 time ~~ 0 ifTrue:[ |
|
8856 sock readWaitWithTimeoutMs:time |
|
8857 ] |
|
8858 ]. |
|
8859 |
|
8860 "Created: / 4.2.1998 / 15:17:48 / cg" |
|
8861 "Modified: / 30.12.1998 / 20:10:46 / cg" |
|
8862 ! |
|
8863 |
|
8864 _PlatformFont_initIDs:nativeContext |
|
8865 "/ new with jdk1.2 ... |
|
8866 |
|
8867 "Created: / 28.1.1998 / 22:30:41 / cg" |
|
8868 ! |
|
8869 |
|
8870 _PrintStream_isOutputStreamLocalised:nativeContext |
|
8871 "/ boolean isOutputStreamLocalised (java.io.DataOutputStream) |
|
8872 |
|
8873 UnimplementedNativeMethodSignal raise |
|
8874 |
|
8875 "Created: / 27.1.2000 / 03:00:20 / cg" |
|
8876 ! |
|
8877 |
|
8878 _Proxy_defineClass0:nativeContext |
|
8879 " |
|
8880 private static native Class defineClass0(ClassLoader loader, String name, |
|
8881 byte[] b, int off, int len); |
|
8882 " |
|
8883 | loader name b off len bs cls | |
|
8884 loader := nativeContext argAt: 1. |
|
8885 name := nativeContext argAt: 2. |
|
8886 b := nativeContext argAt: 3. |
|
8887 off := nativeContext argAt: 4. |
|
8888 len := nativeContext argAt: 5. |
|
8889 |
|
8890 bs := (off = 0 and: [len = b size]) |
|
8891 ifTrue:[b readStream] |
|
8892 ifFalse:[(b copyFrom: off + 1 to: off + len) readStream]. |
|
8893 |
|
8894 cls := JavaClassReader readStream: bs. |
|
8895 cls classLoader: loader. |
|
8896 |
|
8897 ^self reflection javaClassObjectForClass: cls. |
|
8898 |
|
8899 "Created: / 06-02-2011 / 16:55:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
8900 ! |
|
8901 |
|
8902 _RandomAccessFile_close:nativeContext |
|
8903 ^ self anyStream_close:nativeContext |
|
8904 |
|
8905 "Created: / 4.2.1998 / 13:26:53 / cg" |
|
8906 "Modified: / 4.2.1998 / 15:21:08 / cg" |
|
8907 ! |
|
8908 |
|
8909 _RandomAccessFile_length:nativeContext |
|
8910 |file sz| |
|
8911 |
|
8912 file := self validateFile:(nativeContext receiver). |
|
8913 |
|
8914 FileIOTrace ifTrue:[ |
|
8915 ('JAVA: length of ' , file pathName) infoPrintCR. |
|
8916 ]. |
|
8917 |
|
8918 sz := file size. |
|
8919 ^ sz. |
|
8920 |
|
8921 "Created: / 4.2.1998 / 13:27:58 / cg" |
|
8922 ! |
|
8923 |
|
8924 _RandomAccessFile_open:nativeContext |
|
8925 |fs fd name dir stream fileNo answer readonly| |
|
8926 |
|
8927 readonly := false. |
|
8928 |
|
8929 fs := nativeContext receiver. |
|
8930 fd := fs instVarNamed:'fd'. |
|
8931 (fd instVarNamed:'fd') ~~ 0 ifTrue:[ |
|
8932 self halt:'file already open'. |
|
8933 self internalError:'file already open'. |
|
8934 ^ self. |
|
8935 ]. |
|
8936 |
|
8937 name := nativeContext argAt:1. |
|
8938 name := Java as_ST_String:name. |
|
8939 name := self fixFilename:name. |
|
8940 |
|
8941 FileOpenTrace ifTrue:[ |
|
8942 ('JAVA: opening ' , name) infoPrintCR. |
|
8943 ]. |
|
8944 |
|
8945 dir := name asFilename directory pathName. |
|
8946 |
|
8947 (PermittedDirectories notNil |
|
8948 and:[PermittedDirectories includes:dir]) ifFalse:[ |
|
8949 FileOpenConfirmation ifTrue:[ |
|
8950 answer := Dialog |
|
8951 confirmWithCancel:('JAVA Security check\\Opening ''' , name , ''' for read/write.\Grant permission ?') withCRs |
|
8952 labels:#('no' 'grant' 'readonly') |
|
8953 values:#(false true #readonly) |
|
8954 default:3. |
|
8955 answer == false ifTrue:[ |
|
8956 self throwIOExceptionWithMessage:('no permission to open ' , name , ' for writing'). |
|
8957 ^ self |
|
8958 ]. |
|
8959 readonly := (answer == #readonly). |
|
8960 |
|
8961 readonly ifFalse:[ |
|
8962 (self confirm:('JAVA Security check\\Always permit writes in this directory (''' , dir , ''') ?') withCRs) |
|
8963 ifTrue:[ |
|
8964 PermittedDirectories isNil ifTrue:[ |
|
8965 PermittedDirectories := Set new |
|
8966 ]. |
|
8967 PermittedDirectories add:dir. |
|
8968 ] |
|
8969 ] |
|
8970 ] |
|
8971 ]. |
|
8972 |
|
8973 readonly ifTrue:[ |
|
8974 stream := name asFilename readStream. |
|
8975 ] ifFalse:[ |
|
8976 stream := name asFilename readWriteStream. |
|
8977 ]. |
|
8978 stream isNil ifTrue:[ |
|
8979 self throwIOExceptionWithMessage:('cannot open ' , name , ' for writing'). |
|
8980 ]. |
|
8981 |
|
8982 fileNo := self addOpenFile:stream. |
|
8983 |
|
8984 FileOpenTrace ifTrue:[ |
|
8985 ('JAVA: opened ' , name , ' as FD ' , fileNo printString , ' for writing') infoPrintCR. |
|
8986 ]. |
|
8987 |
|
8988 fd instVarNamed:'fd' put:fileNo. |
|
8989 |
|
8990 "Created: / 4.2.1998 / 00:14:48 / cg" |
|
8991 "Modified: / 12.11.1998 / 21:29:46 / cg" |
|
8992 ! |
|
8993 |
|
8994 _RandomAccessFile_read:nativeContext |
|
8995 |file byte| |
|
8996 |
|
8997 file := self validateFile:(nativeContext receiver). |
|
8998 |
|
8999 FileIOTrace ifTrue:[ |
|
9000 ('JAVA: read 1 byte from ' , file pathName) infoPrintCR. |
|
9001 ]. |
|
9002 |
|
9003 byte := file nextByte. |
|
9004 byte isNil ifTrue:[ |
|
9005 ^ -1 |
|
9006 ]. |
|
9007 ^ byte |
|
9008 |
|
9009 "Modified: / 5.1.1998 / 02:17:25 / cg" |
|
9010 "Created: / 27.1.1999 / 19:01:15 / cg" |
|
9011 ! |
|
9012 |
|
9013 _RandomAccessFile_readBytes:nativeContext |
|
9014 ^ self anyStream_readBytes:nativeContext |
|
9015 |
|
9016 "Modified: / 4.2.1998 / 15:23:27 / cg" |
|
9017 ! |
|
9018 |
|
9019 _RandomAccessFile_seek:nativeContext |
|
9020 |file pos| |
|
9021 |
|
9022 file := self validateFile:(nativeContext receiver). |
|
9023 |
|
9024 FileIOTrace ifTrue:[ |
|
9025 ('JAVA: seek on ' , file pathName) infoPrintCR. |
|
9026 ]. |
|
9027 |
|
9028 pos := nativeContext argAt:1. |
|
9029 file position:pos+1 "/ ST/X position starts at 1 |
|
9030 |
|
9031 "Created: / 4.2.1998 / 13:25:38 / cg" |
|
9032 "Modified: / 4.2.1998 / 13:28:12 / cg" |
|
9033 ! |
|
9034 |
|
9035 _RandomAccessFile_writeBytes:nativeContext |
|
9036 ^ self anyStream_writeBytes:nativeContext |
|
9037 |
|
9038 "Modified: / 4.2.1998 / 15:24:20 / cg" |
|
9039 "Created: / 4.2.1998 / 15:24:35 / cg" |
|
9040 ! |
|
9041 |
|
9042 _ResourceBundle_getClassContext:nativeContext |
|
9043 "returns an array filled with the contextChain receivers classes. |
|
9044 What an ugly, messy interface." |
|
9045 |
|
9046 |chain con cls jClass| |
|
9047 |
|
9048 chain := OrderedCollection new. |
|
9049 con := thisContext sender. |
|
9050 [ |
|
9051 con notNil |
|
9052 and:[con receiver isMethod not or:[con receiver isJavaMethod not]] |
|
9053 ] whileTrue:[con := con sender.]. |
|
9054 con := con sender. |
|
9055 [con notNil] whileTrue:[ |
|
9056 (true) "con isJavaContext" ifTrue:[ |
|
9057 cls := con receiver class. |
|
9058 cls isMeta ifTrue:[ |
|
9059 "/ t'was a static method |
|
9060 cls := cls soleInstance |
|
9061 ]. |
|
9062 cls isJavaClass ifTrue:[ |
|
9063 jClass := self reflection javaClassObjectForClass:cls. |
|
9064 chain add:jClass. |
|
9065 ] |
|
9066 ]. |
|
9067 con := con sender. |
|
9068 ]. |
|
9069 ^ chain asArray |
|
9070 |
|
9071 "Created: / 05-01-1998 / 02:47:00 / cg" |
|
9072 "Modified: / 24-12-1998 / 00:34:57 / cg" |
|
9073 "Modified: / 28-01-2011 / 15:31:28 / Marcel Hlopko <hlopik@gmail.com>" |
|
9074 "Modified: / 03-02-2011 / 21:31:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9075 ! |
|
9076 |
|
9077 _Runtime_buildLibName:nativeContext |
|
9078 |jPath jFileName path fileName libName| |
|
9079 |
|
9080 jPath := nativeContext argAt:1. |
|
9081 jFileName := nativeContext argAt:2. |
|
9082 |
|
9083 path := Java as_ST_String:jPath. |
|
9084 fileName := Java as_ST_String:jFileName. |
|
9085 |
|
9086 path = '__builtIn__' ifTrue:[ |
|
9087 libName := path , '/' , fileName |
|
9088 ] ifFalse:[ |
|
9089 libName := path , '/lib' , fileName , '.so'. |
|
9090 ]. |
|
9091 ^ Java as_String:libName. |
|
9092 |
|
9093 "Modified: / 8.8.1997 / 12:05:05 / cg" |
|
9094 "Created: / 4.1.1998 / 19:07:14 / cg" |
|
9095 ! |
|
9096 |
|
9097 _Runtime_execInternal:nativeContext |
|
9098 "Run a unix-command; return a process object." |
|
9099 |
|
9100 |cmdAndArgArray envArray cmd jProcessClass jProcess| |
|
9101 |
|
9102 cmdAndArgArray := nativeContext argAt:1. |
|
9103 envArray := nativeContext argAt:2. |
|
9104 |
|
9105 cmd := cmdAndArgArray at:1. |
|
9106 |
|
9107 OperatingSystem isUNIXlike ifTrue:[ |
|
9108 jProcessClass := Java classForName:'java.lang.UNIXProcess'. |
|
9109 ] ifFalse:[ |
|
9110 jProcessClass := Java classForName:'java.lang.Win32Process'. |
|
9111 ]. |
|
9112 "/ |
|
9113 jProcessClass notNil ifTrue:[ |
|
9114 self halt. |
|
9115 jProcess := jProcessClass newCleared. |
|
9116 jProcess |
|
9117 perform:#'<init>([Ljava/lang/String;[Ljava/lang/String;)V' |
|
9118 with:cmdAndArgArray |
|
9119 with:envArray. |
|
9120 ^ jProcess |
|
9121 ]. |
|
9122 self halt. |
|
9123 self throwIOExceptionWithMessage:'Process execution disabled/unimplemented'. |
|
9124 ^ nil |
|
9125 |
|
9126 "Created: / 15.1.1998 / 01:50:31 / cg" |
|
9127 "Modified: / 11.12.1998 / 13:09:36 / cg" |
|
9128 ! |
|
9129 |
|
9130 _Runtime_exitInternal:nativeContext |
|
9131 "exit - here, we only shut down java threads" |
|
9132 |
|
9133 |enteredMonitors| |
|
9134 |
|
9135 ExitDebug == true ifTrue:[ |
|
9136 self halt:'Java code called exit'. |
|
9137 ]. |
|
9138 |
|
9139 self syncMonitorCache. |
|
9140 (enteredMonitors := self enteredMonitors) size > 0 ifTrue:[ |
|
9141 enteredMonitors do:[:handle | |
|
9142 | mon | |
|
9143 |
|
9144 mon := LockTable at:handle ifAbsent:nil. |
|
9145 mon isNil ifTrue:[ |
|
9146 self halt:'no monitor in exitInternal'. |
|
9147 ] ifFalse:[ |
|
9148 mon exit. |
|
9149 ('====> terminateThread - exit monitor for ' , handle displayString , ' in ' , Processor activeProcess name , ' ...') infoPrintCR. |
|
9150 ]. |
|
9151 ]. |
|
9152 ]. |
|
9153 |
|
9154 "/ TODO: shut down all threads created by this one ... |
|
9155 |
|
9156 AbortSignal raise. |
|
9157 self halt. |
|
9158 |
|
9159 "Created: / 7.1.1998 / 22:48:51 / cg" |
|
9160 "Modified: / 8.1.1999 / 14:09:36 / cg" |
|
9161 ! |
|
9162 |
|
9163 _Runtime_freeMemory:nativeContext |
|
9164 "free memory - Returns the number of free bytes" |
|
9165 |
|
9166 ^ ObjectMemory freeListSpace + ObjectMemory freeSpace |
|
9167 |
|
9168 "Created: / 12.1.1998 / 12:59:53 / cg" |
|
9169 ! |
|
9170 |
|
9171 _Runtime_gc:nativeContext |
|
9172 "Runs the garbage collector. |
|
9173 Ignored, since the ST-gc runs all the time." |
|
9174 |
|
9175 ^ self |
|
9176 |
|
9177 "Modified: / 12.1.1998 / 12:58:32 / cg" |
|
9178 ! |
|
9179 |
|
9180 _Runtime_initializeLinkerInternal:nativeContext |
|
9181 "init sharedLib linker, return searchPath as javaString" |
|
9182 |
|
9183 |path| |
|
9184 |
|
9185 "/ mhmh - what is done here ? |
|
9186 |
|
9187 path := ''. |
|
9188 LibPath do:[:comp | path size == 0 ifTrue:[ |
|
9189 path := path , comp |
|
9190 ] ifFalse:[ |
|
9191 path := path , ':' , comp |
|
9192 ] |
|
9193 ]. |
|
9194 |
|
9195 ^ Java as_String:path |
|
9196 |
|
9197 "Modified: / 7.8.1997 / 21:17:03 / cg" |
|
9198 "Created: / 4.1.1998 / 17:53:15 / cg" |
|
9199 ! |
|
9200 |
|
9201 _Runtime_isInputStreamLocalised:nativeContext |
|
9202 "/ boolean isInputStreamLocalised (java.io.DataInputStream) |
|
9203 |
|
9204 UnimplementedNativeMethodSignal raise. |
|
9205 |
|
9206 "Created: / 27.1.2000 / 03:03:01 / cg" |
|
9207 ! |
|
9208 |
|
9209 _Runtime_isOutputStreamLocalised:nativeContext |
|
9210 "/ boolean isOutputStreamLocalised (java.io.DataOutputStream) |
|
9211 |
|
9212 UnimplementedNativeMethodSignal raise. |
|
9213 |
|
9214 "Created: / 27.1.2000 / 03:02:49 / cg" |
|
9215 ! |
|
9216 |
|
9217 _Runtime_loadFileInternal:nativeContext |
|
9218 "load a sharedLib, return boolean 0 (false) if fail; 1 (true) if ok" |
|
9219 |
|
9220 |ret| |
|
9221 |
|
9222 ret := self _Runtime_loadFileInternalI:nativeContext. |
|
9223 ret < 0 ifTrue:[ ret := 0 ]. |
|
9224 ^ ret |
|
9225 |
|
9226 "Created: / 4.1.1998 / 19:10:20 / cg" |
|
9227 "Modified: / 4.1.1998 / 19:11:04 / cg" |
|
9228 ! |
|
9229 |
|
9230 _Runtime_loadFileInternalI:nativeContext |
|
9231 "1.1b3 change; load a sharedLib like 'loadFileInternal', |
|
9232 but return integer: |
|
9233 -1 outOfMemory error |
|
9234 0 failed to load |
|
9235 1 loaded or already loaded (i.e. ok)" |
|
9236 |
|
9237 |jLibName libName libHandle| |
|
9238 |
|
9239 jLibName := nativeContext argAt:1. |
|
9240 libName := Java as_ST_String:jLibName. |
|
9241 |
|
9242 (SimulatedLibs includes:libName) ifTrue:[ |
|
9243 "/ ('JAVA: builtIn libLoad simulated: ' , libName) printNL. |
|
9244 ^ 1 |
|
9245 ]. |
|
9246 (LoadedLibs notNil and:[LoadedLibs includesKey:libName]) ifTrue:[ |
|
9247 "/ ('JAVA: already loaded: ' , libName) printNL. |
|
9248 ^ 1 |
|
9249 ]. |
|
9250 |
|
9251 libName asFilename exists ifFalse:[ |
|
9252 ('JAVA: no file to load: ' , libName) printNL. |
|
9253 ^ 0 |
|
9254 ]. |
|
9255 |
|
9256 (self confirm:'permission to load native library: ' , libName , ' ?') ifFalse:[ |
|
9257 ^ 0 |
|
9258 ]. |
|
9259 |
|
9260 libHandle := ObjectFileLoader loadLibrary:libName. |
|
9261 libHandle isNil ifTrue:[ |
|
9262 ('JAVA: failed to load: ' , libName) printNL. |
|
9263 ^ 0 |
|
9264 ]. |
|
9265 |
|
9266 LoadedLibs isNil ifTrue:[ |
|
9267 LoadedLibs := Dictionary new. |
|
9268 ]. |
|
9269 |
|
9270 LoadedLibs at:libName put:libHandle. |
|
9271 ^ 1 |
|
9272 |
|
9273 "Created: / 4.1.1998 / 19:10:54 / cg" |
|
9274 "Modified: / 6.2.1998 / 03:11:59 / cg" |
|
9275 ! |
|
9276 |
|
9277 _Runtime_runFinalization:nativeContext |
|
9278 "/ void runFinalization () |
|
9279 "/ UnimplementedNativeMethodSignal raise |
|
9280 |
|
9281 "Modified: / 12.11.1998 / 18:52:07 / cg" |
|
9282 "Created: / 12.11.1998 / 18:59:01 / cg" |
|
9283 ! |
|
9284 |
|
9285 _Runtime_runFinalizersOnExit0:nativeContext |
|
9286 "" |
|
9287 |
|
9288 |onOff| |
|
9289 |
|
9290 onOff := nativeContext argAt:1. |
|
9291 ^ 1 |
|
9292 |
|
9293 "Modified: / 6.2.1998 / 03:11:59 / cg" |
|
9294 "Created: / 15.10.1998 / 23:34:55 / cg" |
|
9295 ! |
|
9296 |
|
9297 _Runtime_setInputStreamLocalised:nativeContext |
|
9298 |
|
9299 UnimplementedNativeMethodSignal raise. |
|
9300 |
|
9301 "Modified: / 27.1.2000 / 03:02:27 / cg" |
|
9302 ! |
|
9303 |
|
9304 _Runtime_setOutputStreamLocalised:nativeContext |
|
9305 |
|
9306 UnimplementedNativeMethodSignal raise. |
|
9307 |
|
9308 "Modified: / 27.1.2000 / 03:02:32 / cg" |
|
9309 ! |
|
9310 |
|
9311 _Runtime_totalMemory:nativeContext |
|
9312 "free memory - Returns the total number of bytes" |
|
9313 |
|
9314 ^ ObjectMemory oldSpaceSize + ObjectMemory newSpaceSize |
|
9315 |
|
9316 "Created: / 12.1.1998 / 12:59:23 / cg" |
|
9317 ! |
|
9318 |
|
9319 _Runtime_traceInstructions:nativeContext |
|
9320 "/ void traceInstructions (boolean) |
|
9321 UnimplementedNativeMethodSignal raise |
|
9322 |
|
9323 "Modified: / 12.11.1998 / 18:52:07 / cg" |
|
9324 "Created: / 12.11.1998 / 18:59:18 / cg" |
|
9325 ! |
|
9326 |
|
9327 _Runtime_traceMethodCalls:nativeContext |
|
9328 "/ void traceMethodCalls (boolean) |
|
9329 UnimplementedNativeMethodSignal raise |
|
9330 |
|
9331 "Modified: / 12.11.1998 / 18:52:07 / cg" |
|
9332 "Created: / 12.11.1998 / 18:59:37 / cg" |
|
9333 ! |
|
9334 |
|
9335 _ScrollPane_initIDs:nativeContext |
|
9336 "/ new with jdk1.2 ... |
|
9337 |
|
9338 "Created: / 28.1.1998 / 22:19:23 / cg" |
|
9339 ! |
|
9340 |
|
9341 _SecurityManager_classDepth:nativeContext |
|
9342 UnimplementedNativeMethodSignal raise |
|
9343 |
|
9344 "Modified: / 12.11.1998 / 18:52:07 / cg" |
|
9345 "Created: / 12.11.1998 / 18:56:27 / cg" |
|
9346 ! |
|
9347 |
|
9348 _SecurityManager_classLoaderDepth:nativeContext |
|
9349 |con depth| |
|
9350 |
|
9351 con := thisContext sender. |
|
9352 depth := 1. |
|
9353 [con notNil] whileTrue:[ |
|
9354 con receiver == JavaClassReader classLoaderQuerySignal ifTrue:[ |
|
9355 con selector == #handle:do: ifTrue:[ |
|
9356 depth := depth + 1 |
|
9357 ] |
|
9358 ]. |
|
9359 con := con sender. |
|
9360 ]. |
|
9361 'JAVA: classLoaderDepth -> ' infoPrint. depth infoPrintCR. |
|
9362 ^ depth. |
|
9363 |
|
9364 "Created: / 13.1.1998 / 09:21:46 / cg" |
|
9365 "Modified: / 13.1.1998 / 09:33:43 / cg" |
|
9366 ! |
|
9367 |
|
9368 _SecurityManager_currentClassLoader:nativeContext |
|
9369 |loader| |
|
9370 |
|
9371 loader := JavaClassReader classLoaderQuerySignal query. |
|
9372 "/ 'JAVA: currentClassLoader -> ' infoPrint. loader displayString infoPrintCR. |
|
9373 ^ loader. |
|
9374 |
|
9375 "Created: / 13.1.1998 / 09:23:28 / cg" |
|
9376 "Modified: / 11.12.1998 / 12:39:59 / cg" |
|
9377 ! |
|
9378 |
|
9379 _SecurityManager_currentLoadedClass0:nativeContext |
|
9380 UnimplementedNativeMethodSignal raise |
|
9381 |
|
9382 "Modified: / 12.11.1998 / 18:52:07 / cg" |
|
9383 "Created: / 12.11.1998 / 18:56:41 / cg" |
|
9384 ! |
|
9385 |
|
9386 _SecurityManager_getClassContext:nativeContext |
|
9387 UnimplementedNativeMethodSignal raise |
|
9388 |
|
9389 "Modified: / 12.11.1998 / 18:52:07 / cg" |
|
9390 "Created: / 12.11.1998 / 18:56:06 / cg" |
|
9391 ! |
|
9392 |
|
9393 _SocketInputStream_socketRead:nativeContext |
|
9394 ^ self anyStream_readBytes:nativeContext |
|
9395 |
|
9396 "Created: / 25.1.1998 / 20:56:53 / cg" |
|
9397 "Modified: / 4.2.1998 / 15:52:31 / cg" |
|
9398 ! |
|
9399 |
|
9400 _SocketOutputStream_socketWrite:nativeContext |
|
9401 ^ self anyStream_writeBytes:nativeContext |
|
9402 |
|
9403 "Created: / 25.1.1998 / 21:06:55 / cg" |
|
9404 "Modified: / 4.2.1998 / 15:52:40 / cg" |
|
9405 ! |
|
9406 |
|
9407 _String_compareTo:nativeContext |
|
9408 "int compareTo (java.lang.String)" |
|
9409 |
|
9410 |jString1 jString2| |
|
9411 |
|
9412 jString1 := nativeContext receiver. |
|
9413 jString2 := nativeContext argAt:1. |
|
9414 UnimplementedNativeMethodSignal raise. |
|
9415 |
|
9416 "Created: / 27.1.2000 / 02:28:59 / cg" |
|
9417 ! |
|
9418 |
|
9419 _String_equals:nativeContext |
|
9420 |jString1 jString2| |
|
9421 |
|
9422 jString1 := nativeContext receiver. |
|
9423 jString2 := nativeContext argAt:1. |
|
9424 ^ (jString1 instVarAt:1) = (jString2 instVarAt:1) |
|
9425 |
|
9426 "Created: / 18.11.1998 / 00:52:03 / cg" |
|
9427 "Modified: / 18.11.1998 / 00:53:01 / cg" |
|
9428 ! |
|
9429 |
|
9430 _String_equalsIgnoreCase:nativeContext |
|
9431 "boolean equalsIgnoreCase (java.lang.String)" |
|
9432 |
|
9433 |jString1 jString2| |
|
9434 |
|
9435 self halt:'untested'. |
|
9436 |
|
9437 jString1 := nativeContext receiver. |
|
9438 jString2 := nativeContext argAt:1. |
|
9439 ^ (jString1 instVarAt:1) sameAs: (jString2 instVarAt:1) |
|
9440 |
|
9441 "Modified: / 18.11.1998 / 00:53:01 / cg" |
|
9442 "Created: / 27.1.2000 / 02:27:46 / cg" |
|
9443 ! |
|
9444 |
|
9445 _String_indexOf:nativeContext |
|
9446 "int indexOf (java.lang.String int)" |
|
9447 |
|
9448 |jString1 jString2 idx| |
|
9449 |
|
9450 jString1 := nativeContext receiver. |
|
9451 jString2 := nativeContext argAt:1. |
|
9452 idx := nativeContext argAt:2. |
|
9453 UnimplementedNativeMethodSignal raise. |
|
9454 |
|
9455 "Created: / 27.1.2000 / 02:30:22 / cg" |
|
9456 ! |
|
9457 |
|
9458 _String_lastIndexOf:nativeContext |
|
9459 "int lastIndexOf (java.lang.String int)" |
|
9460 |
|
9461 |jString1 jString2 idx| |
|
9462 |
|
9463 jString1 := nativeContext receiver. |
|
9464 jString2 := nativeContext argAt:1. |
|
9465 idx := nativeContext argAt:2. |
|
9466 UnimplementedNativeMethodSignal raise. |
|
9467 |
|
9468 "Created: / 27.1.2000 / 02:33:59 / cg" |
|
9469 ! |
|
9470 |
|
9471 _String_length:nativeContext |
|
9472 |jString| |
|
9473 |
|
9474 jString := nativeContext receiver. |
|
9475 ^ (jString instVarAt:3) |
|
9476 |
|
9477 "Created: / 18.11.1998 / 00:53:50 / cg" |
|
9478 "Modified: / 18.11.1998 / 00:54:18 / cg" |
|
9479 ! |
|
9480 |
|
9481 _String_regionMatches2:nativeContext |
|
9482 "boolean regionMatches (boolean int java.lang.String int int)" |
|
9483 |
|
9484 |jString1 bool jString2 idx1 idx2| |
|
9485 |
|
9486 jString1 := nativeContext receiver. |
|
9487 bool := nativeContext argAt:1. |
|
9488 jString2 := nativeContext argAt:2. |
|
9489 idx1 := nativeContext argAt:3. |
|
9490 idx2 := nativeContext argAt:4. |
|
9491 UnimplementedNativeMethodSignal raise. |
|
9492 |
|
9493 "Created: / 27.1.2000 / 02:33:40 / cg" |
|
9494 ! |
|
9495 |
|
9496 _String_regionMatches:nativeContext |
|
9497 "boolean regionMatches (int java.lang.String int int)" |
|
9498 |
|
9499 |jString1 jString2 idx1 idx2| |
|
9500 |
|
9501 jString1 := nativeContext receiver. |
|
9502 jString2 := nativeContext argAt:1. |
|
9503 idx1 := nativeContext argAt:2. |
|
9504 idx2 := nativeContext argAt:3. |
|
9505 UnimplementedNativeMethodSignal raise. |
|
9506 |
|
9507 "Created: / 27.1.2000 / 02:32:29 / cg" |
|
9508 ! |
|
9509 |
|
9510 _String_startsWith:nativeContext |
|
9511 "boolean startsWith (java.lang.String int)" |
|
9512 |
|
9513 |jString1 jString2 idx| |
|
9514 |
|
9515 jString1 := nativeContext receiver. |
|
9516 jString2 := nativeContext argAt:1. |
|
9517 idx := nativeContext argAt:2. |
|
9518 UnimplementedNativeMethodSignal raise. |
|
9519 |
|
9520 "Created: / 27.1.2000 / 02:31:40 / cg" |
|
9521 ! |
|
9522 |
|
9523 _SystemColor_GetSysColor:nativeContext |
|
9524 "/ int GetSysColor (int) |
|
9525 UnimplementedNativeMethodSignal raise |
|
9526 |
|
9527 "Created: / 27.1.2000 / 02:44:41 / cg" |
|
9528 ! |
|
9529 |
|
9530 _SystemResourceManager_getEntryFromKey:nativeContext |
|
9531 "get a resource by name" |
|
9532 |
|
9533 |key s| |
|
9534 |
|
9535 key := nativeContext argAt:1. |
|
9536 |
|
9537 s := Java effectiveClassPath at:(key+1) ifAbsent:nil. |
|
9538 s isNil ifTrue:[^ nil]. |
|
9539 ^ Java as_String:s |
|
9540 |
|
9541 "Modified: / 22-11-2010 / 13:44:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
9542 ! |
|
9543 |
|
9544 _SystemResourceManager_validateSystemResource:nativeContext |
|
9545 "check a resource" |
|
9546 |
|
9547 |bool str1 str2| |
|
9548 |
|
9549 bool := nativeContext argAt:1. |
|
9550 str1 := nativeContext argAt:2. |
|
9551 str2 := nativeContext argAt:3. |
|
9552 ^ 1 "/ true |
|
9553 ! |
|
9554 |
|
9555 _System_getCallerClass:nativeContext |
|
9556 "/ introduced with jdk1.2 |
|
9557 |
|
9558 |senderContext cls| |
|
9559 |
|
9560 senderContext := nativeContext sender. |
|
9561 [senderContext receiver == (Java at:'java.lang.System')] whileTrue:[ |
|
9562 senderContext := senderContext sender. |
|
9563 ]. |
|
9564 |
|
9565 senderContext method isStatic ifTrue:[ |
|
9566 cls := senderContext receiver |
|
9567 ] ifFalse:[ |
|
9568 cls := senderContext receiver class |
|
9569 ]. |
|
9570 cls isJavaClass ifTrue:[ |
|
9571 ^ self javaClassObjectForClass:cls |
|
9572 ]. |
|
9573 (cls isMemberOf:(Java at:'java.lang.Class')) ifTrue:[ |
|
9574 ^ Java at:'java.lang.Class' |
|
9575 ]. |
|
9576 self halt. |
|
9577 ^ nil |
|
9578 |
|
9579 "Modified: / 27.1.1998 / 18:33:13 / cg" |
|
9580 ! |
|
9581 |
|
9582 _System_identityHashCode:nativeContext |
|
9583 |obj| |
|
9584 |
|
9585 obj := nativeContext argAt:1. |
|
9586 ^ obj identityHash |
|
9587 |
|
9588 "Modified: / 12.11.1998 / 18:52:07 / cg" |
|
9589 "Created: / 12.11.1998 / 18:54:00 / cg" |
|
9590 ! |
|
9591 |
|
9592 _System_validateSecurityManager:nativeContext |
|
9593 "void validateSecurityManager (java.lang.SecurityManager)" |
|
9594 |
|
9595 UnimplementedNativeMethodSignal raise. |
|
9596 |
|
9597 "Created: / 27.1.2000 / 02:43:25 / cg" |
|
9598 ! |
|
9599 |
|
9600 _ThreadGroup_initMainThreadGroup0:nativeContext |
|
9601 "void initMainThreadGroup0 (java.lang.ThreadGroup)" |
|
9602 |
|
9603 UnimplementedNativeMethodSignal raise. |
|
9604 |
|
9605 "Created: / 27.1.2000 / 02:45:52 / cg" |
|
9606 ! |
|
9607 |
|
9608 _Thread_countStackFrames:nativeContext |
|
9609 "/ int countStackFrames () |
|
9610 UnimplementedNativeMethodSignal raise |
|
9611 |
|
9612 "Created: / 12.11.1998 / 19:06:21 / cg" |
|
9613 ! |
|
9614 |
|
9615 _Thread_interrupt0:nativeContext |
|
9616 "ask if a thread is interrupted (clear interruptState if arg is true)" |
|
9617 |
|
9618 |jThread stProcess| |
|
9619 |
|
9620 jThread := nativeContext receiver. |
|
9621 stProcess := self stProcessForJavaThread:jThread. |
|
9622 stProcess isNil ifTrue:[ |
|
9623 self halt. |
|
9624 ^ 0 |
|
9625 ]. |
|
9626 |
|
9627 stProcess markInterrupted |
|
9628 |
|
9629 "Modified: / 2.1.1998 / 21:49:06 / cg" |
|
9630 "Created: / 10.4.1998 / 15:21:43 / cg" |
|
9631 ! |
|
9632 |
|
9633 _Thread_isInterrupted:nativeContext |
|
9634 "ask if a thread is interrupted (clear interruptState if arg is true)" |
|
9635 |
|
9636 |jThread stProcess clearInterrupt rslt| |
|
9637 |
|
9638 jThread := nativeContext receiver. |
|
9639 stProcess := self stProcessForJavaThread:jThread. |
|
9640 stProcess isNil ifTrue:[ |
|
9641 self halt. |
|
9642 ^ 0 |
|
9643 ]. |
|
9644 |
|
9645 clearInterrupt := nativeContext argAt:1. |
|
9646 rslt := stProcess isInterrupted ifTrue:[1] ifFalse:[0]. |
|
9647 clearInterrupt ~~ 0 ifTrue:[stProcess clearInterruptActions]. |
|
9648 ^ rslt |
|
9649 |
|
9650 "Modified: / 2.1.1998 / 21:49:06 / cg" |
|
9651 "Created: / 7.1.1998 / 18:50:26 / cg" |
|
9652 ! |
|
9653 |
|
9654 _Thread_resume0:nativeContext |
|
9655 "yield" |
|
9656 |
|
9657 |jThread stProcess| |
|
9658 |
|
9659 jThread := nativeContext receiver. |
|
9660 stProcess := JavaVM stProcessForJavaThread:jThread. |
|
9661 stProcess isNil ifTrue:[ |
|
9662 ThreadTrace == true ifTrue:[ |
|
9663 ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL. |
|
9664 ]. |
|
9665 ^ nil "void" |
|
9666 ]. |
|
9667 stProcess resume |
|
9668 |
|
9669 "Created: / 8.1.1998 / 01:06:27 / cg" |
|
9670 "Modified: / 6.2.1998 / 02:15:08 / cg" |
|
9671 ! |
|
9672 |
|
9673 _Thread_sleep:nativeContext |
|
9674 "sleep for some milliseconds " |
|
9675 |
|
9676 |millis| |
|
9677 |
|
9678 millis := nativeContext argAt:1. |
|
9679 self waitFor:nil state:nil timeOut:(millis max:50) |
|
9680 |
|
9681 "Modified: / 8.1.1999 / 16:42:52 / cg" |
|
9682 ! |
|
9683 |
|
9684 _Thread_start:nativeContext |
|
9685 "start the thread" |
|
9686 |
|
9687 |jThread jName name stProcess| |
|
9688 |
|
9689 jThread := nativeContext receiver. |
|
9690 (jThread instVarNamed:'priority') < 1 ifTrue:[ |
|
9691 self halt. |
|
9692 jThread instVarNamed:'priority' put:1. |
|
9693 ]. |
|
9694 |
|
9695 stProcess := JavaProcess |
|
9696 for:[ |
|
9697 |procName| |
|
9698 |
|
9699 Object abortSignal handle:[:ex | |
|
9700 procName := stProcess name. |
|
9701 (procName startsWith:'JAVA-AWT-EventQueue') ifTrue:[ |
|
9702 ('JAVA [info]: thread ' , procName , ' aborted - restarting process.') infoPrintCR. |
|
9703 ex restart. |
|
9704 ] ifFalse:[ |
|
9705 (stProcess == JavaScreenUpdaterThread |
|
9706 or:[stProcess == JavaEventQueueThread]) ifTrue:[ |
|
9707 ('JAVA [info]: thread ' , procName , ' aborted - restarting process.') infoPrintCR. |
|
9708 ex restart |
|
9709 ] ifFalse:[ |
|
9710 ('JAVA [info]: thread ' , procName , ' aborted.') infoPrintCR. |
|
9711 ] |
|
9712 ]. |
|
9713 ] do:[ |
|
9714 [ |
|
9715 JavaVM javaExceptionSignal handle:[:ex | |
|
9716 |exClass| |
|
9717 |
|
9718 procName := stProcess name. |
|
9719 exClass := ex parameter class. |
|
9720 |
|
9721 exClass == (Java at:'java.lang.ThreadDeath') ifTrue:[ |
|
9722 ('JAVA: thread ' , procName , ' terminated') infoPrintCR. |
|
9723 ] ifFalse:[ |
|
9724 Transcript |
|
9725 showCR:('JAVA: thread ''' |
|
9726 , procName |
|
9727 , ''' terminated with exception: ' |
|
9728 , exClass name). |
|
9729 ]. |
|
9730 ex return. |
|
9731 ] do:[ |
|
9732 Object messageNotUnderstoodSignal handle:[:ex | |
|
9733 "/ remap doesNotUnderstand with nil-receiver to |
|
9734 "/ a nullPointerException ... |
|
9735 |con m| |
|
9736 |
|
9737 con := ex suspendedContext. |
|
9738 con receiver isNil ifTrue:[ |
|
9739 ((m := con sender method) notNil |
|
9740 and:[m isJavaMethod]) ifTrue:[ |
|
9741 self throwNullPointerException. |
|
9742 AbortSignal raise. "/ ex proceed. |
|
9743 ] |
|
9744 ]. |
|
9745 ex reject. |
|
9746 ] do:[ |
|
9747 "/ Transcript showCR:(Timestamp now printString , 'start thread: ', stProcess name). |
|
9748 jThread perform:#'run()V'. |
|
9749 ThreadTrace == true ifTrue:[ |
|
9750 ('JAVA: thread ' , stProcess name , ' terminated') infoPrintCR. |
|
9751 ]. |
|
9752 jThread perform:#'exit()V'. |
|
9753 ThreadTrace == true ifTrue:[ |
|
9754 ('JAVA: after exit of thread ' , stProcess name) infoPrintCR. |
|
9755 ] |
|
9756 ] |
|
9757 ] |
|
9758 ] ensure:[ |
|
9759 |monitors| |
|
9760 |
|
9761 monitors := EnteredMonitorsPerProcess at:stProcess ifAbsent:nil. |
|
9762 monitors notNil ifTrue:[ |
|
9763 monitors do:[:obj | |
|
9764 | mon | |
|
9765 |
|
9766 mon := self monitorFor:obj. |
|
9767 mon notNil ifTrue:[ |
|
9768 mon owningProcess == stProcess ifTrue:[ |
|
9769 ('JAVA: release monitor owned by dying thread: ' , stProcess name) infoPrintCR. |
|
9770 mon exit |
|
9771 ]. |
|
9772 ]. |
|
9773 ]. |
|
9774 EnteredMonitorsPerProcess removeKey:stProcess. |
|
9775 |
|
9776 stProcess == JavaScreenUpdaterThread ifTrue:[ |
|
9777 JavaScreenUpdaterThread := nil. |
|
9778 ]. |
|
9779 stProcess == JavaEventQueueThread ifTrue:[ |
|
9780 JavaEventQueueThread := nil. |
|
9781 ]. |
|
9782 "/ screenUpdaterClass := Java at:'sun.awt.ScreenUpdater'. |
|
9783 "/ screenUpdaterClass notNil ifTrue:[ |
|
9784 "/ screenUpdaterClass instVarNamed:'updater' put:nil. |
|
9785 "/ ]. |
|
9786 ]. |
|
9787 Java threads removeKey:jThread ifAbsent:[]. |
|
9788 ] |
|
9789 ] |
|
9790 ] |
|
9791 priority:(Processor activePriority). |
|
9792 |
|
9793 jName := jThread instVarNamed:'name'. |
|
9794 jName isString ifFalse:[ |
|
9795 name := Java as_ST_String:jName. |
|
9796 ] ifTrue:[ |
|
9797 name := jName |
|
9798 ]. |
|
9799 |
|
9800 "/ kludge - remember the ScreenUpdater ... |
|
9801 name = 'Screen Updater' ifTrue:[ |
|
9802 JavaScreenUpdaterThread := stProcess. |
|
9803 ] ifFalse:[ |
|
9804 name = 'AWT-Windows' ifTrue:[ |
|
9805 JavaEventThread := stProcess. |
|
9806 ] ifFalse:[ |
|
9807 (name startsWith:'AWT-EventQueue') ifTrue:[ |
|
9808 JavaEventQueueThread := stProcess. |
|
9809 ]. |
|
9810 ] |
|
9811 ]. |
|
9812 |
|
9813 "/name = 'UserDialogShowThread' ifTrue:[ |
|
9814 "/self halt |
|
9815 "/]. |
|
9816 "/ when that process terminates, wakup any waiters |
|
9817 stProcess addExitAction:[self wakeup:jThread]. |
|
9818 |
|
9819 stProcess name:'JAVA-' , name. |
|
9820 stProcess restartable:true. |
|
9821 stProcess resume. |
|
9822 |
|
9823 Java threads at:jThread put:stProcess. |
|
9824 |
|
9825 ^ nil |
|
9826 |
|
9827 "Created: / 3.1.1998 / 02:05:52 / cg" |
|
9828 "Modified: / 24.12.1999 / 03:14:33 / cg" |
|
9829 ! |
|
9830 |
|
9831 _Thread_stop0:nativeContext |
|
9832 "terminate a thread" |
|
9833 |
|
9834 |jThread stProcess death| |
|
9835 |
|
9836 jThread := nativeContext receiver. |
|
9837 |
|
9838 stProcess := JavaVM stProcessForJavaThread:jThread. |
|
9839 stProcess isNil ifTrue:[ |
|
9840 ThreadTrace == true ifTrue:[ |
|
9841 ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL. |
|
9842 ]. |
|
9843 ^ nil "void" |
|
9844 ]. |
|
9845 stProcess == JavaScreenUpdaterThread ifTrue:[self halt]. |
|
9846 stProcess == JavaEventQueueThread ifTrue:[self halt]. |
|
9847 |
|
9848 death := nativeContext argAt:1. |
|
9849 stProcess |
|
9850 interruptWith:[ |
|
9851 JavaVM javaExceptionSignal handle:[:ex | |
|
9852 Processor activeProcess == JavaScreenUpdaterThread ifTrue:[self halt]. |
|
9853 Processor activeProcess == JavaEventQueueThread ifTrue:[self halt]. |
|
9854 Processor activeProcess terminate |
|
9855 ] do:[ |
|
9856 ThreadTrace == true ifTrue:[ |
|
9857 ('JAVA: thread exit: ' , jThread displayString) infoPrintNL. |
|
9858 ]. |
|
9859 jThread perform:#'exit()V'. |
|
9860 self throwException:death. |
|
9861 ] |
|
9862 ]. |
|
9863 stProcess resume. |
|
9864 |
|
9865 [stProcess isDead] whileFalse:[ |
|
9866 stProcess resume. |
|
9867 'JavaVM: wait for death' infoPrintCR. |
|
9868 Delay waitForSeconds:0.1 |
|
9869 ]. |
|
9870 stProcess terminate |
|
9871 |
|
9872 "Created: / 8.1.1998 / 13:11:17 / cg" |
|
9873 "Modified: / 24.12.1999 / 02:32:45 / cg" |
|
9874 ! |
|
9875 |
|
9876 _Thread_suspend0:nativeContext |
|
9877 "yield" |
|
9878 |
|
9879 |jThread stProcess| |
|
9880 |
|
9881 jThread := nativeContext receiver. |
|
9882 stProcess := JavaVM stProcessForJavaThread:jThread. |
|
9883 stProcess isNil ifTrue:[ |
|
9884 ThreadTrace == true ifTrue:[ |
|
9885 ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL. |
|
9886 ]. |
|
9887 ^ nil "void" |
|
9888 ]. |
|
9889 stProcess suspend |
|
9890 |
|
9891 "Created: / 8.1.1998 / 01:05:49 / cg" |
|
9892 "Modified: / 6.2.1998 / 02:15:23 / cg" |
|
9893 ! |
|
9894 |
|
9895 _Thread_yield:nativeContext |
|
9896 "yield" |
|
9897 |
|
9898 |jThread stProcess| |
|
9899 |
|
9900 Processor yield. |
|
9901 "/ jThread := nativeContext receiver. |
|
9902 "/ stProcess := JavaVM stProcessForJavaThread:jThread. |
|
9903 "/ stProcess isNil ifTrue:[ |
|
9904 "/ ThreadTrace == true ifTrue:[ |
|
9905 "/ ('JAVA: no stProcess for javaThread: ' , jThread displayString) printNL. |
|
9906 "/ ]. |
|
9907 "/ ^ nil "void" |
|
9908 "/ ]. |
|
9909 "/ stProcess == Processor activeProcess ifTrue:[ |
|
9910 "/ Processor yield. |
|
9911 "/ ] ifFalse:[ |
|
9912 "/ self halt. |
|
9913 "/ ]. |
|
9914 |
|
9915 "Created: / 5.1.1998 / 02:03:51 / cg" |
|
9916 "Modified: / 23.12.1998 / 19:19:17 / cg" |
|
9917 ! |
|
9918 |
|
9919 _Throwable_printStackTrace0:nativeContext |
|
9920 |out outStream exceptionObject contextList| |
|
9921 |
|
9922 outStream := nativeContext argAt:1. |
|
9923 exceptionObject := nativeContext receiver. |
|
9924 |
|
9925 contextList := exceptionObject instVarNamed:'backtrace'. |
|
9926 |
|
9927 out := self javaConsoleStream. |
|
9928 out cr. |
|
9929 out nextPutLine:'JAVA: stackTrace:'. |
|
9930 |
|
9931 contextList do:[:con | |
|
9932 out |
|
9933 nextPutAll:' '; |
|
9934 nextPutAll:(con method javaClass fullName); |
|
9935 nextPutAll:'.'; |
|
9936 nextPutAll:(con method selector); |
|
9937 nextPutAll:' ['; |
|
9938 nextPutAll:(con method javaClass sourceFile); |
|
9939 nextPutAll:' '; |
|
9940 nextPutAll:(con quickLineNumber displayString); |
|
9941 nextPutAll:']'. |
|
9942 out cr |
|
9943 ]. |
|
9944 out nextPutLine:'----------------------------------------------------' |
|
9945 |
|
9946 "Created: / 4.1.1998 / 14:27:40 / cg" |
|
9947 "Modified: / 10.11.1998 / 14:19:32 / cg" |
|
9948 ! |
|
9949 |
|
9950 _Toolkit_initIDs:nativeContext |
|
9951 "/ introduced with jdk1.2 ... (sigh) |
|
9952 |
|
9953 "Created: / 27.1.1998 / 19:53:50 / cg" |
|
9954 ! |
|
9955 |
|
9956 _URLConnection_close:nativeContext |
|
9957 "/ void close () |
|
9958 UnimplementedNativeMethodSignal raise |
|
9959 |
|
9960 "Created: / 12.11.1998 / 19:26:03 / cg" |
|
9961 ! |
|
9962 |
|
9963 _URLConnection_finalize:nativeContext |
|
9964 "/ void finalize () |
|
9965 UnimplementedNativeMethodSignal raise |
|
9966 |
|
9967 "Created: / 12.11.1998 / 19:25:22 / cg" |
|
9968 ! |
|
9969 |
|
9970 _URLConnection_getContentLength0:nativeContext |
|
9971 "/ int getContentLength0 () |
|
9972 UnimplementedNativeMethodSignal raise |
|
9973 |
|
9974 "Created: / 12.11.1998 / 19:25:34 / cg" |
|
9975 ! |
|
9976 |
|
9977 _URLConnection_getContentType0:nativeContext |
|
9978 "/ java.lang.String getContentType0 () |
|
9979 UnimplementedNativeMethodSignal raise |
|
9980 |
|
9981 "Created: / 12.11.1998 / 19:25:42 / cg" |
|
9982 ! |
|
9983 |
|
9984 _URLConnection_getHeaderField0:nativeContext |
|
9985 "/ java.lang.String getHeaderField0 (java.lang.String) |
|
9986 UnimplementedNativeMethodSignal raise |
|
9987 |
|
9988 "Created: / 12.11.1998 / 19:25:53 / cg" |
|
9989 ! |
|
9990 |
|
9991 _URLConnection_pCreate:nativeContext |
|
9992 "/ void pCreate (java.lang.String java.lang.String) |
|
9993 UnimplementedNativeMethodSignal raise |
|
9994 |
|
9995 "Created: / 12.11.1998 / 19:25:14 / cg" |
|
9996 ! |
|
9997 |
|
9998 _URLInputStream_available:nativeContext |
|
9999 "/ int available () |
|
10000 UnimplementedNativeMethodSignal raise |
|
10001 |
|
10002 "Created: / 12.11.1998 / 19:24:26 / cg" |
|
10003 ! |
|
10004 |
|
10005 _URLInputStream_open:nativeContext |
|
10006 "/ void open () |
|
10007 UnimplementedNativeMethodSignal raise |
|
10008 |
|
10009 "Created: / 12.11.1998 / 19:24:01 / cg" |
|
10010 ! |
|
10011 |
|
10012 _URLInputStream_read:nativeContext |
|
10013 "/ int read (byte[] int int) |
|
10014 UnimplementedNativeMethodSignal raise |
|
10015 |
|
10016 "Created: / 12.11.1998 / 19:24:12 / cg" |
|
10017 ! |
|
10018 |
|
10019 _URLOutputStream_open:nativeContext |
|
10020 "/ void open () |
|
10021 UnimplementedNativeMethodSignal raise |
|
10022 |
|
10023 "Created: / 12.11.1998 / 19:24:38 / cg" |
|
10024 ! |
|
10025 |
|
10026 _URLOutputStream_pClose:nativeContext |
|
10027 "/ void pClose () |
|
10028 UnimplementedNativeMethodSignal raise |
|
10029 |
|
10030 "Created: / 12.11.1998 / 19:25:02 / cg" |
|
10031 ! |
|
10032 |
|
10033 _URLOutputStream_write:nativeContext |
|
10034 "/ void write (int) |
|
10035 UnimplementedNativeMethodSignal raise |
|
10036 |
|
10037 "Created: / 12.11.1998 / 19:24:45 / cg" |
|
10038 ! |
|
10039 |
|
10040 _URLOutputStream_writeBytes:nativeContext |
|
10041 "/ void writeBytes (byte[] int int) |
|
10042 UnimplementedNativeMethodSignal raise |
|
10043 |
|
10044 "Created: / 12.11.1998 / 19:24:55 / cg" |
|
10045 ! |
|
10046 |
|
10047 _URLStreamHandlerFactory_pInit:nativeContext |
|
10048 "/ self unimplementedNativeMethod. |
|
10049 |
|
10050 "Created: / 10.1.1998 / 15:47:24 / cg" |
|
10051 ! |
|
10052 |
|
10053 _URLStreamHandlerFactory_pSupportsProtocol:nativeContext |
|
10054 "/ boolean pSupportsProtocol (java.lang.String) |
|
10055 UnimplementedNativeMethodSignal raise |
|
10056 |
|
10057 "Created: / 12.11.1998 / 19:23:43 / cg" |
|
10058 ! |
|
10059 |
|
10060 _Unsafe_allocateInstance:nativeContext |
|
10061 " |
|
10062 /** Allocate an instance but do not run any constructor. |
|
10063 Initializes the class if it has not yet been. */ |
|
10064 public native Object allocateInstance(Class cls) |
|
10065 throws InstantiationException; |
|
10066 " |
|
10067 | cls | |
|
10068 cls := self reflection classForJavaClassObject: (nativeContext argAt:1). |
|
10069 cls classInit. |
|
10070 ^cls newCleared |
|
10071 |
|
10072 "Created: / 05-02-2011 / 23:10:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10073 ! |
|
10074 |
|
10075 _Unsafe_defineClass: nativeContext |
|
10076 " |
|
10077 /** |
|
10078 * Tell the VM to define a class, without security checks. By default, the |
|
10079 * class loader and protection domain come from the caller's class. |
|
10080 */ |
|
10081 public native Class defineClass(String name, byte[] b, int off, int len, |
|
10082 ClassLoader loader, |
|
10083 ProtectionDomain protectionDomain); |
|
10084 " |
|
10085 | name b off len loader protectionDomain bs cls | |
|
10086 name := nativeContext argAt: 1. |
|
10087 b := nativeContext argAt: 2. |
|
10088 off := nativeContext argAt: 3. |
|
10089 len := nativeContext argAt: 4. |
|
10090 loader := nativeContext argAt: 5. |
|
10091 protectionDomain := nativeContext argAt: 6. |
|
10092 |
|
10093 bs := (off = 0 and: [len = b size]) |
|
10094 ifTrue:[b readStream] |
|
10095 ifFalse:[(b copyFrom: off + 1 to: off + len) readStream]. |
|
10096 |
|
10097 cls := JavaClassReader readStream: bs. |
|
10098 cls classLoader: loader. |
|
10099 |
|
10100 ^self reflection javaClassObjectForClass: cls. |
|
10101 |
|
10102 "Created: / 05-02-2011 / 22:57:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10103 ! |
|
10104 |
|
10105 _VM_getState:nativeContext |
|
10106 "/ int getState () |
|
10107 UnimplementedNativeMethodSignal raise |
|
10108 |
|
10109 "Created: / 12.11.1998 / 19:06:44 / cg" |
|
10110 ! |
|
10111 |
|
10112 _VM_resetJavaMonitor:nativeContext |
|
10113 "/ void resetJavaMonitor () |
|
10114 UnimplementedNativeMethodSignal raise |
|
10115 |
|
10116 "Created: / 14.11.1998 / 10:43:23 / cg" |
|
10117 ! |
|
10118 |
|
10119 _VM_resumeJavaMonitor:nativeContext |
|
10120 "/ void resumeJavaMonitor () |
|
10121 UnimplementedNativeMethodSignal raise |
|
10122 |
|
10123 "Created: / 14.11.1998 / 10:42:49 / cg" |
|
10124 ! |
|
10125 |
|
10126 _VM_suspendJavaMonitor:nativeContext |
|
10127 "/ void suspendJavaMonitor () |
|
10128 UnimplementedNativeMethodSignal raise |
|
10129 |
|
10130 "Created: / 14.11.1998 / 10:43:07 / cg" |
|
10131 ! |
|
10132 |
|
10133 _VM_threadsSuspended:nativeContext |
|
10134 "/ boolean threadsSuspended () |
|
10135 UnimplementedNativeMethodSignal raise |
|
10136 |
|
10137 "Created: / 12.11.1998 / 19:07:10 / cg" |
|
10138 ! |
|
10139 |
|
10140 _VM_unsuspendSomeThreads:nativeContext |
|
10141 "/ void unsuspendSomeThreads () |
|
10142 UnimplementedNativeMethodSignal raise |
|
10143 |
|
10144 "Created: / 12.11.1998 / 19:07:29 / cg" |
|
10145 ! |
|
10146 |
|
10147 _VM_unsuspendThreads:nativeContext |
|
10148 "/ void unsuspendThreads () |
|
10149 UnimplementedNativeMethodSignal raise |
|
10150 |
|
10151 "Created: / 12.11.1998 / 19:07:20 / cg" |
|
10152 ! |
|
10153 |
|
10154 _VM_writeJavaMonitorReport:nativeContext |
|
10155 "/ void writeJavaMonitorReport () |
|
10156 UnimplementedNativeMethodSignal raise |
|
10157 |
|
10158 "Created: / 14.11.1998 / 10:43:37 / cg" |
|
10159 ! |
|
10160 |
|
10161 _WButtonPeer_create:nativeContext |
|
10162 |jButtonPeer jButton jFrame frame button |
|
10163 lbl| |
|
10164 |
|
10165 jButtonPeer := nativeContext receiver. |
|
10166 jButton := jButtonPeer instVarNamed:'target'. |
|
10167 |
|
10168 jFrame := nativeContext argAt:1. |
|
10169 frame := jFrame instVarNamed:'pData'. |
|
10170 |
|
10171 button := Button in:frame. |
|
10172 button sizeFixed:true. |
|
10173 button action:[ |
|
10174 jButtonPeer perform:#'handleAction()V'. |
|
10175 ]. |
|
10176 |
|
10177 lbl := jButton instVarNamed:'label'. |
|
10178 lbl notNil ifTrue:[ |
|
10179 lbl := Java as_ST_String:lbl. |
|
10180 button label:lbl |
|
10181 ]. |
|
10182 self createdWindowsView:button for:jButtonPeer. |
|
10183 |
|
10184 WindowCreationTrace == true ifTrue:[ |
|
10185 'WButtonPeer_create: ' print. frame print. ' -> ' print. button printNL. |
|
10186 ]. |
|
10187 |
|
10188 "Created: / 5.1.1998 / 01:53:30 / cg" |
|
10189 "Modified: / 11.12.1998 / 00:19:22 / cg" |
|
10190 ! |
|
10191 |
|
10192 _WButtonPeer_setLabel:nativeContext |
|
10193 |label jString| |
|
10194 |
|
10195 jString := nativeContext argAt:1. |
|
10196 |
|
10197 label := self viewForWPeer:nativeContext. |
|
10198 label label:(Java as_ST_String:jString) |
|
10199 |
|
10200 "Modified: / 8.1.1998 / 17:35:50 / cg" |
|
10201 "Created: / 1.2.1998 / 17:05:47 / cg" |
|
10202 ! |
|
10203 |
|
10204 _WCanvasPeer_create:nativeContext |
|
10205 |jCanvasPeer jFrame frame subView| |
|
10206 |
|
10207 jCanvasPeer := nativeContext receiver. |
|
10208 |
|
10209 jFrame := nativeContext argAt:1. |
|
10210 jFrame isNil ifTrue:[ |
|
10211 self halt:'no frame in canvasPeer create'. |
|
10212 subView := JavaView new. |
|
10213 "/ self internalError:'no frame in canvasPeer create'. |
|
10214 "/ ^ self. |
|
10215 ] ifFalse:[ |
|
10216 frame := jFrame instVarNamed:'pData'. |
|
10217 subView := JavaView in:frame. |
|
10218 ]. |
|
10219 |
|
10220 subView delegate:self. |
|
10221 subView javaPeer:jCanvasPeer. |
|
10222 |
|
10223 self createdWindowsView:subView for:jCanvasPeer. |
|
10224 |
|
10225 WindowCreationTrace == true ifTrue:[ |
|
10226 'WCanvasPeer_create: ' print. frame print. ' -> ' print. subView printNL. |
|
10227 ]. |
|
10228 |
|
10229 "Created: / 5.1.1998 / 00:59:19 / cg" |
|
10230 "Modified: / 16.1.1998 / 13:40:00 / cg" |
|
10231 ! |
|
10232 |
|
10233 _WCheckboxMenuItemPeer_setState:nativeContext |
|
10234 "/ void setState (boolean) |
|
10235 "/ UnimplementedNativeMethodSignal raise |
|
10236 |
|
10237 "Created: / 12.11.1998 / 19:14:35 / cg" |
|
10238 "Modified: / 3.12.1998 / 21:41:13 / cg" |
|
10239 ! |
|
10240 |
|
10241 _WCheckboxPeer_create:nativeContext |
|
10242 |jCheckboxPeer jCheckbox jFrame frame checkBox lbl| |
|
10243 |
|
10244 jCheckboxPeer := nativeContext receiver. |
|
10245 jCheckbox := jCheckboxPeer instVarNamed:'target'. |
|
10246 |
|
10247 jFrame := nativeContext argAt:1. |
|
10248 frame := jFrame instVarNamed:'pData'. |
|
10249 |
|
10250 checkBox := CheckBox in:frame. |
|
10251 checkBox action:[ |
|
10252 jCheckboxPeer |
|
10253 perform:#'handleAction(Z)V' |
|
10254 with:(checkBox isOn ifTrue:[1] ifFalse:[0]) |
|
10255 ]. |
|
10256 |
|
10257 lbl := jCheckbox instVarNamed:'label'. |
|
10258 lbl notNil ifTrue:[ |
|
10259 lbl := Java as_ST_String:lbl. |
|
10260 checkBox label:lbl |
|
10261 ]. |
|
10262 |
|
10263 self createdWindowsView:checkBox for:jCheckboxPeer. |
|
10264 |
|
10265 WindowCreationTrace == true ifTrue:[ |
|
10266 'WCheckboxPeer_create: ' print. frame print. ' -> ' print. checkBox printNL. |
|
10267 ]. |
|
10268 |
|
10269 "Created: / 7.1.1998 / 21:48:03 / cg" |
|
10270 "Modified: / 15.1.1998 / 12:27:04 / cg" |
|
10271 ! |
|
10272 |
|
10273 _WCheckboxPeer_setCheckboxGroup:nativeContext |
|
10274 |checkBox jGroup| |
|
10275 |
|
10276 checkBox := self viewForWPeer:nativeContext. |
|
10277 |
|
10278 jGroup := nativeContext argAt:1. |
|
10279 |
|
10280 "Created: / 7.1.1998 / 21:48:47 / cg" |
|
10281 "Modified: / 25.1.1998 / 01:20:42 / cg" |
|
10282 ! |
|
10283 |
|
10284 _WCheckboxPeer_setLabel:nativeContext |
|
10285 "/ void setLabel (java.lang.String) |
|
10286 UnimplementedNativeMethodSignal raise |
|
10287 |
|
10288 "Created: / 12.11.1998 / 19:14:53 / cg" |
|
10289 ! |
|
10290 |
|
10291 _WCheckboxPeer_setState:nativeContext |
|
10292 |checkBox state| |
|
10293 |
|
10294 checkBox := self viewForWPeer:nativeContext. |
|
10295 |
|
10296 state := nativeContext argAt:1. |
|
10297 state ~~ 0 ifTrue:[ |
|
10298 checkBox turnOn |
|
10299 ] ifFalse:[ |
|
10300 checkBox turnOff |
|
10301 ]. |
|
10302 |
|
10303 "Created: / 7.1.1998 / 21:49:13 / cg" |
|
10304 "Modified: / 25.1.1998 / 01:26:18 / cg" |
|
10305 ! |
|
10306 |
|
10307 _WChoicePeer_addItem:nativeContext |
|
10308 |jString index comboBox| |
|
10309 |
|
10310 comboBox := self viewForWPeer:nativeContext. |
|
10311 |
|
10312 jString := nativeContext argAt:1. |
|
10313 index := nativeContext argAt:2. |
|
10314 |
|
10315 comboBox model list addLast:(Java as_ST_String:jString). |
|
10316 comboBox model changed:#list. |
|
10317 |
|
10318 "Created: / 7.1.1998 / 21:45:12 / cg" |
|
10319 "Modified: / 24.1.1998 / 18:51:32 / cg" |
|
10320 ! |
|
10321 |
|
10322 _WChoicePeer_create:nativeContext |
|
10323 |jChoicePeer jChoice jFrame frame comboBox| |
|
10324 |
|
10325 jChoicePeer := nativeContext receiver. |
|
10326 jChoice := jChoicePeer instVarNamed:'target'. |
|
10327 |
|
10328 jFrame := nativeContext argAt:1. |
|
10329 frame := jFrame instVarNamed:'pData'. |
|
10330 |
|
10331 comboBox := ComboListView in:frame. |
|
10332 comboBox model:(SelectionInList new list:(OrderedCollection new)). |
|
10333 comboBox action:[:index | |
|
10334 jChoicePeer |
|
10335 perform:#'handleAction(I)V' |
|
10336 with:(comboBox model selectionIndex - 1) |
|
10337 ]. |
|
10338 |
|
10339 self createdWindowsView:comboBox for:jChoicePeer. |
|
10340 |
|
10341 WindowCreationTrace == true ifTrue:[ |
|
10342 'WChoicePeer_create: ' print. frame print. ' -> ' print. comboBox printNL. |
|
10343 ]. |
|
10344 |
|
10345 "Created: / 7.1.1998 / 21:44:31 / cg" |
|
10346 "Modified: / 28.1.1998 / 23:19:17 / cg" |
|
10347 ! |
|
10348 |
|
10349 _WChoicePeer_remove:nativeContext |
|
10350 "/ void remove (int) |
|
10351 UnimplementedNativeMethodSignal raise |
|
10352 |
|
10353 "Created: / 12.11.1998 / 19:12:20 / cg" |
|
10354 ! |
|
10355 |
|
10356 _WChoicePeer_reshape:nativeContext |
|
10357 self commonReshapeComponent:nativeContext. |
|
10358 "/ self pReshape:nativeContext. |
|
10359 ^ self. |
|
10360 |
|
10361 "Created: / 7.1.1998 / 21:46:18 / cg" |
|
10362 "Modified: / 23.12.1998 / 19:08:07 / cg" |
|
10363 ! |
|
10364 |
|
10365 _WChoicePeer_select:nativeContext |
|
10366 |comboBox index| |
|
10367 |
|
10368 comboBox := self viewForWPeer:nativeContext. |
|
10369 |
|
10370 index := nativeContext argAt:1. |
|
10371 comboBox model selectionIndex:(index + 1). "/ JAVA indexing starts at 0 |
|
10372 |
|
10373 "Created: / 7.1.1998 / 21:45:43 / cg" |
|
10374 "Modified: / 25.1.1998 / 09:55:05 / cg" |
|
10375 ! |
|
10376 |
|
10377 _WClipboard_getClipboardText:nativeContext |
|
10378 "/ java.lang.String getClipboardText () |
|
10379 |
|
10380 |str| |
|
10381 |
|
10382 str := Screen current rootView getTextSelection. |
|
10383 str isNil ifTrue:[ |
|
10384 str := ''. |
|
10385 ]. |
|
10386 ^ Java as_String:''. |
|
10387 |
|
10388 "Modified: / 10.12.1998 / 21:28:29 / cg" |
|
10389 ! |
|
10390 |
|
10391 _WClipboard_init:nativeContext |
|
10392 "/ self halt. |
|
10393 |
|
10394 "Modified: / 18.3.1997 / 18:43:18 / cg" |
|
10395 "Created: / 4.1.1998 / 19:03:59 / cg" |
|
10396 ! |
|
10397 |
|
10398 _WClipboard_setClipboardText:nativeContext |
|
10399 "/ void setClipboardText (java.awt.datatransfer.StringSelection) |
|
10400 |
|
10401 |strSel data| |
|
10402 |
|
10403 strSel := nativeContext argAt:1. |
|
10404 data := strSel instVarNamed:'data'. |
|
10405 data class == (Java at:'java.lang.String') ifTrue:[ |
|
10406 Screen current rootView setTextSelection:(Java as_ST_String:data) |
|
10407 ]. |
|
10408 UnimplementedNativeMethodSignal raise |
|
10409 |
|
10410 "Created: / 12.11.1998 / 19:15:31 / cg" |
|
10411 "Modified: / 10.12.1998 / 21:25:20 / cg" |
|
10412 ! |
|
10413 |
|
10414 _WColor_getDefaultColor:nativeContext |
|
10415 |clrIndex jClr clr | |
|
10416 |
|
10417 clrIndex := nativeContext argAt:1. |
|
10418 "/ windows defaults: |
|
10419 "/ 1: view background |
|
10420 |
|
10421 clrIndex == 1 ifTrue:[ |
|
10422 clr := View defaultViewBackgroundColor. |
|
10423 clr isColor ifFalse:[ |
|
10424 clr := Color gray:50. |
|
10425 ]. |
|
10426 ]. |
|
10427 clrIndex == 2 ifTrue:[ |
|
10428 clr := Color black. |
|
10429 ]. |
|
10430 clr isNil ifTrue:[ |
|
10431 self halt. |
|
10432 self internalError:'breakpoint'. |
|
10433 ^ nil. |
|
10434 ]. |
|
10435 |
|
10436 clr := clr on:(Screen current). |
|
10437 |
|
10438 jClr := (Java classForName:'java.awt.Color') new. |
|
10439 |
|
10440 jClr instVarNamed:'pData' put:clr. |
|
10441 jClr instVarNamed:'value' put:(clr rgbValue). |
|
10442 "/ self halt. |
|
10443 ^ jClr. |
|
10444 |
|
10445 "Created: / 15.8.1997 / 15:38:10 / cg" |
|
10446 "Modified: / 4.1.1998 / 18:06:51 / cg" |
|
10447 ! |
|
10448 |
|
10449 _WComponentPeer__beginValidate:nativeContext |
|
10450 "/ void _beginValidate () |
|
10451 UnimplementedNativeMethodSignal raise |
|
10452 |
|
10453 "Created: / 12.11.1998 / 19:10:08 / cg" |
|
10454 ! |
|
10455 |
|
10456 _WComponentPeer__dispose:nativeContext |
|
10457 |view jPeer| |
|
10458 |
|
10459 view := self viewForWPeer:nativeContext. |
|
10460 |
|
10461 Object errorSignal catch:[ |
|
10462 view destroy. |
|
10463 ]. |
|
10464 JavaWindowGroup removeView:view. |
|
10465 |
|
10466 jPeer := nativeContext receiver. |
|
10467 jPeer instVarNamed:'pData' put:0. |
|
10468 |
|
10469 "Created: / 7.1.1998 / 22:36:25 / cg" |
|
10470 "Modified: / 25.1.1998 / 16:43:06 / cg" |
|
10471 ! |
|
10472 |
|
10473 _WComponentPeer__setBackground:nativeContext |
|
10474 |rgb clr view| |
|
10475 |
|
10476 view := self viewForWPeer:nativeContext. |
|
10477 view isNil ifTrue:[^ self]. |
|
10478 |
|
10479 rgb := nativeContext argAt:1. |
|
10480 clr := Color rgbValue:rgb. |
|
10481 |
|
10482 "/ self halt. |
|
10483 "/ self internalError:'breakPoint'. |
|
10484 |
|
10485 clr := clr on:(view device). |
|
10486 |
|
10487 "/ (view superView isMemberOf:JavaEmbeddedFrameView) ifTrue:[ |
|
10488 "/ view viewBackground:(view superView viewBackground). |
|
10489 "/ view backgroundPaint:(view superView viewBackground). |
|
10490 "/ ] ifFalse:[ |
|
10491 "/ (view isMemberOf:JavaView) ifTrue:[ |
|
10492 "/ view viewBackground:clr. |
|
10493 "/ view backgroundPaint:clr. |
|
10494 "/ ] |
|
10495 "/ ]. |
|
10496 |
|
10497 (view isKindOf:ScrollableView) ifTrue:[ |
|
10498 view := view scrolledView |
|
10499 ]. |
|
10500 view viewBackground:clr. |
|
10501 view backgroundPaint:clr. |
|
10502 |
|
10503 "Created: / 4.1.1998 / 18:07:39 / cg" |
|
10504 "Modified: / 4.12.1998 / 17:26:06 / cg" |
|
10505 ! |
|
10506 |
|
10507 _WComponentPeer__setForeground:nativeContext |
|
10508 |rgb clr view| |
|
10509 |
|
10510 view := self viewForWPeer:nativeContext. |
|
10511 |
|
10512 rgb := nativeContext argAt:1. |
|
10513 clr := Color rgbValue:rgb. |
|
10514 |
|
10515 "/ self halt. |
|
10516 "/ self internalError:'breakPoint'. |
|
10517 |
|
10518 clr := clr on:(view device). |
|
10519 |
|
10520 view paint:clr. |
|
10521 |
|
10522 "Created: / 4.1.1998 / 18:08:13 / cg" |
|
10523 "Modified: / 8.1.1998 / 17:32:45 / cg" |
|
10524 ! |
|
10525 |
|
10526 _WComponentPeer_disable:nativeContext |
|
10527 |view| |
|
10528 |
|
10529 view := self viewForWPeer:nativeContext. |
|
10530 |
|
10531 Object errorSignal handle:[:ex | |
|
10532 ] do:[ |
|
10533 view disable |
|
10534 ] |
|
10535 |
|
10536 "Created: / 6.1.1998 / 18:26:36 / cg" |
|
10537 "Modified: / 8.1.1998 / 17:32:53 / cg" |
|
10538 ! |
|
10539 |
|
10540 _WComponentPeer_enable:nativeContext |
|
10541 |view| |
|
10542 |
|
10543 view := self viewForWPeer:nativeContext. |
|
10544 |
|
10545 Object errorSignal handle:[:ex | |
|
10546 ] do:[ |
|
10547 view enable |
|
10548 ] |
|
10549 |
|
10550 "Modified: / 8.1.1998 / 17:32:53 / cg" |
|
10551 "Created: / 13.1.1998 / 23:08:05 / cg" |
|
10552 ! |
|
10553 |
|
10554 _WComponentPeer_endValidate:nativeContext |
|
10555 "/ void endValidate () |
|
10556 UnimplementedNativeMethodSignal raise |
|
10557 |
|
10558 "Created: / 12.11.1998 / 19:10:20 / cg" |
|
10559 ! |
|
10560 |
|
10561 _WComponentPeer_getLocationOnScreen:nativeContext |
|
10562 "/ java.awt.Point getLocationOnScreen () |
|
10563 |
|
10564 |view p jP| |
|
10565 |
|
10566 view := self viewForWPeer:nativeContext. |
|
10567 view isNil ifTrue:[^ nil]. |
|
10568 |
|
10569 p := view originRelativeTo:nil. |
|
10570 jP := (Java classForName:'java.awt.Point') basicNew. |
|
10571 jP instVarNamed:'x' put:p x. |
|
10572 jP instVarNamed:'y' put:p y. |
|
10573 ^ jP |
|
10574 |
|
10575 "Modified: / 5.12.1998 / 14:44:31 / cg" |
|
10576 ! |
|
10577 |
|
10578 _WComponentPeer_handleEvent:nativeContext |
|
10579 "this is invoked by java, to let a widget handle any event which |
|
10580 was not consumed (eaten) by java. |
|
10581 If the view in question is some ST-widget, forward it. |
|
10582 Ignore for JavaViews." |
|
10583 |
|
10584 |view jEv stEv ignore| |
|
10585 |
|
10586 view := self viewForWPeer:nativeContext. |
|
10587 view notNil ifTrue:[ |
|
10588 jEv := nativeContext argAt:1. |
|
10589 stEv := jEv instVarNamed:'data'. |
|
10590 (stEv notNil and:[stEv ~~ 0]) ifTrue:[ |
|
10591 ignore := true. |
|
10592 view isJavaView ifFalse:[ |
|
10593 ignore := false |
|
10594 ] ifTrue:[ |
|
10595 view isTopView ifTrue:[ |
|
10596 stEv type == #terminate ifTrue:[ |
|
10597 ignore := false |
|
10598 ]. |
|
10599 ] |
|
10600 ]. |
|
10601 |
|
10602 ignore ifFalse:[ |
|
10603 EventTrace == true ifTrue:[ |
|
10604 ('JAVA: WComponent - handleEvent: ' , stEv type , ' for ' , view printString) infoPrintCR. |
|
10605 ]. |
|
10606 view dispatchEvent:stEv. |
|
10607 ^ self. |
|
10608 ]. |
|
10609 |
|
10610 EventTrace == true ifTrue:[ |
|
10611 ('JAVA: WComponent - handleEvent ignored:' , stEv type) infoPrintCR. |
|
10612 ]. |
|
10613 ^ self |
|
10614 ] |
|
10615 ]. |
|
10616 EventTrace == true ifTrue:[ |
|
10617 ('JAVA: WComponent - handleEvent ignored') infoPrintCR. |
|
10618 ] |
|
10619 |
|
10620 "Created: / 6.1.1998 / 21:10:17 / cg" |
|
10621 "Modified: / 11.12.1998 / 01:04:14 / cg" |
|
10622 ! |
|
10623 |
|
10624 _WComponentPeer_hide:nativeContext |
|
10625 |view| |
|
10626 |
|
10627 view := self viewForWPeer:nativeContext. |
|
10628 "/ view isPopUpView ifTrue:[self halt]. |
|
10629 |
|
10630 Object errorSignal handle:[:ex | |
|
10631 ] do:[ |
|
10632 view beInvisible |
|
10633 ] |
|
10634 |
|
10635 "Created: / 7.1.1998 / 22:35:32 / cg" |
|
10636 "Modified: / 4.12.1998 / 17:53:41 / cg" |
|
10637 ! |
|
10638 |
|
10639 _WComponentPeer_nativeHandleEvent:nativeContext |
|
10640 "this is invoked by java, to let a widget handle any event which |
|
10641 was not consumed (eaten) by java. |
|
10642 If the view in question is some ST-widget, forward it. |
|
10643 Ignore for JavaViews." |
|
10644 |
|
10645 |view jEv stEv| |
|
10646 |
|
10647 ^self. |
|
10648 view := self viewForWPeer:nativeContext. |
|
10649 view notNil ifTrue:[ |
|
10650 (view isKindOf:JavaView) ifFalse:[ |
|
10651 jEv := nativeContext argAt:1. |
|
10652 stEv := jEv instVarNamed:'data'. |
|
10653 (stEv notNil and:[stEv ~~ 0]) ifTrue:[ |
|
10654 EventTrace == true ifTrue:[ |
|
10655 ('JAVA: WComponent - handleEvent: ' , stEv type , ' for ' , view printString) infoPrintCR. |
|
10656 ]. |
|
10657 stEv sendEventWithFocusOn:nil. |
|
10658 ^ self. |
|
10659 ] |
|
10660 ] |
|
10661 ]. |
|
10662 EventTrace == true ifTrue:[ |
|
10663 ('JAVA: WComponent - handleEvent ignored') infoPrintCR. |
|
10664 ] |
|
10665 |
|
10666 "Created: / 19.10.1998 / 21:26:16 / cg" |
|
10667 "Modified: / 19.10.1998 / 23:26:37 / cg" |
|
10668 ! |
|
10669 |
|
10670 _WComponentPeer_requestFocus:nativeContext |
|
10671 |view| |
|
10672 |
|
10673 view := self viewForWPeer:nativeContext. |
|
10674 "/ 'getFocus - ' print. view displayString printCR. |
|
10675 |
|
10676 "/ view getKeyboardFocus |
|
10677 |
|
10678 "Created: / 7.1.1998 / 22:30:03 / cg" |
|
10679 "Modified: / 4.12.1998 / 19:42:18 / cg" |
|
10680 ! |
|
10681 |
|
10682 _WComponentPeer_reshape:nativeContext |
|
10683 self commonReshapeComponent:nativeContext |
|
10684 |
|
10685 "Modified: / 18.3.1997 / 19:30:21 / cg" |
|
10686 "Created: / 4.1.1998 / 18:01:11 / cg" |
|
10687 ! |
|
10688 |
|
10689 _WComponentPeer_setBackground:nativeContext |
|
10690 |jClr rgb clr view| |
|
10691 |
|
10692 view := self viewForWPeer:nativeContext. |
|
10693 |
|
10694 jClr := nativeContext argAt:1. |
|
10695 rgb := jClr instVarNamed:'value'. |
|
10696 "/ self halt. |
|
10697 clr := Color rgbValue:rgb. |
|
10698 |
|
10699 |
|
10700 clr := clr on:(view device). |
|
10701 |
|
10702 "/ (view superView isMemberOf:JavaEmbeddedFrameView) ifTrue:[ |
|
10703 "/ view viewBackground:(view superView viewBackground). |
|
10704 "/ view backgroundPaint:(view superView viewBackground). |
|
10705 "/ ] ifFalse:[ |
|
10706 "/ (view isMemberOf:JavaView) ifTrue:[ |
|
10707 "/ view viewBackground:clr. |
|
10708 "/ view backgroundPaint:clr. |
|
10709 "/ ] |
|
10710 "/ ]. |
|
10711 |
|
10712 (view isKindOf:ScrollableView) ifTrue:[ |
|
10713 view := view scrolledView |
|
10714 ]. |
|
10715 view viewBackground:clr. |
|
10716 view backgroundPaint:clr. |
|
10717 |
|
10718 "Created: / 16.10.1998 / 02:16:31 / cg" |
|
10719 "Modified: / 16.10.1998 / 02:26:29 / cg" |
|
10720 ! |
|
10721 |
|
10722 _WComponentPeer_setCursor:nativeContext |
|
10723 |view| |
|
10724 |
|
10725 view := self viewForWPeer:nativeContext. |
|
10726 "/ self halt. |
|
10727 |
|
10728 "Created: / 5.1.1998 / 01:52:30 / cg" |
|
10729 "Modified: / 25.1.1998 / 01:21:52 / cg" |
|
10730 ! |
|
10731 |
|
10732 _WComponentPeer_setFont:nativeContext |
|
10733 |view| |
|
10734 |
|
10735 view := self viewForWPeer:nativeContext. |
|
10736 "/ self halt. |
|
10737 |
|
10738 "Created: / 5.1.1998 / 00:55:17 / cg" |
|
10739 "Modified: / 25.1.1998 / 01:22:19 / cg" |
|
10740 ! |
|
10741 |
|
10742 _WComponentPeer_setForeground:nativeContext |
|
10743 |jClr rgb clr view| |
|
10744 |
|
10745 view := self viewForWPeer:nativeContext. |
|
10746 |
|
10747 jClr := nativeContext argAt:1. |
|
10748 rgb := jClr instVarNamed:'value'. |
|
10749 "/ self halt. |
|
10750 clr := Color rgbValue:rgb. |
|
10751 |
|
10752 |
|
10753 clr := clr on:(view device). |
|
10754 |
|
10755 (view isKindOf:ScrollableView) ifTrue:[ |
|
10756 view := view scrolledView |
|
10757 ]. |
|
10758 view paint:clr. |
|
10759 |
|
10760 "Created: / 16.10.1998 / 02:18:58 / cg" |
|
10761 "Modified: / 16.10.1998 / 02:26:37 / cg" |
|
10762 ! |
|
10763 |
|
10764 _WComponentPeer_setZOrderPosition:nativeContext |
|
10765 |view| |
|
10766 |
|
10767 view := self viewForWPeer:nativeContext. |
|
10768 "/ self unimplementedNativeMethod. |
|
10769 "/ self halt. |
|
10770 "/ self internalError:'breakPoint' |
|
10771 |
|
10772 "Created: / 4.1.1998 / 17:59:26 / cg" |
|
10773 "Modified: / 25.1.1998 / 01:22:32 / cg" |
|
10774 ! |
|
10775 |
|
10776 _WComponentPeer_show:nativeContext |
|
10777 |view| |
|
10778 |
|
10779 view := self viewForWPeer:nativeContext. |
|
10780 |
|
10781 "/ frame views are under my browsers own control |
|
10782 (view isMemberOf:JavaEmbeddedFrameView) ifFalse:[ |
|
10783 view beVisible. |
|
10784 view realize. |
|
10785 ]. |
|
10786 |
|
10787 "/ view windowGroup notNil ifTrue:[ |
|
10788 "/ windowServer addGroup:(view windowGroup) |
|
10789 "/ ]. |
|
10790 |
|
10791 ^ nil |
|
10792 |
|
10793 "/ self halt. |
|
10794 |
|
10795 "Created: / 5.1.1998 / 01:26:22 / cg" |
|
10796 "Modified: / 4.12.1998 / 17:43:53 / cg" |
|
10797 ! |
|
10798 |
|
10799 _WComponentPeer_start:nativeContext |
|
10800 "/ self halt. |
|
10801 |
|
10802 "Modified: / 18.3.1997 / 18:43:18 / cg" |
|
10803 "Created: / 5.1.1998 / 00:58:40 / cg" |
|
10804 ! |
|
10805 |
|
10806 _WContainerPeer_calculateInsets:nativeContext |
|
10807 "/ new with ns4.0 ... |
|
10808 |
|
10809 "Created: / 16.10.1998 / 02:12:59 / cg" |
|
10810 ! |
|
10811 |
|
10812 _WDefaultFontCharset_canConvert:nativeContext |
|
10813 ^ 1 |
|
10814 |
|
10815 "Modified: / 21.8.1997 / 15:56:57 / cg" |
|
10816 "Created: / 5.1.1998 / 01:55:47 / cg" |
|
10817 ! |
|
10818 |
|
10819 _WDialogPeer__hide:nativeContext |
|
10820 |dialog| |
|
10821 |
|
10822 dialog := self viewForWPeer:nativeContext. |
|
10823 |
|
10824 dialog hide. |
|
10825 |
|
10826 "Created: / 7.1.1998 / 22:34:10 / cg" |
|
10827 "Modified: / 8.1.1998 / 17:34:10 / cg" |
|
10828 ! |
|
10829 |
|
10830 _WDialogPeer__show:nativeContext |
|
10831 |dialog| |
|
10832 |
|
10833 dialog := self viewForWPeer:nativeContext. |
|
10834 "/ |
|
10835 "/ show does not work (yet); must setup windowgroup |
|
10836 "/ for it to get events ... |
|
10837 "/ dialog realize. |
|
10838 |
|
10839 dialog show. |
|
10840 "/dialog fixSize. |
|
10841 "/dialog makeFullyVisible. |
|
10842 "/dialog openModal:[true] inGroup:JavaWindowGroup |
|
10843 |
|
10844 "Created: / 7.1.1998 / 21:52:15 / cg" |
|
10845 "Modified: / 11.12.1998 / 14:43:05 / cg" |
|
10846 ! |
|
10847 |
|
10848 _WDialogPeer_create:nativeContext |
|
10849 |jDialogPeer dialog| |
|
10850 |
|
10851 jDialogPeer := nativeContext receiver. |
|
10852 |
|
10853 dialog := ModalBox new. |
|
10854 jDialogPeer instVarNamed:'pData' put:dialog. |
|
10855 |
|
10856 self createdWindowsView:dialog for:jDialogPeer. |
|
10857 dialog windowGroup:JavaWindowGroup. |
|
10858 JavaWindowGroup addTopView:dialog. |
|
10859 |
|
10860 WindowCreationTrace == true ifTrue:[ |
|
10861 'WDialogPeer_create: ' print. dialog printNL. |
|
10862 ]. |
|
10863 |
|
10864 "Created: / 7.1.1998 / 21:51:00 / cg" |
|
10865 "Modified: / 15.1.1998 / 16:12:44 / cg" |
|
10866 ! |
|
10867 |
|
10868 _WDrawingSurfaceInfo_getDepth:nativeContext |
|
10869 "/ int getDepth () |
|
10870 UnimplementedNativeMethodSignal raise |
|
10871 |
|
10872 "Created: / 12.11.1998 / 19:21:00 / cg" |
|
10873 ! |
|
10874 |
|
10875 _WDrawingSurfaceInfo_getHBitmap:nativeContext |
|
10876 "/ int getHBitmap () |
|
10877 UnimplementedNativeMethodSignal raise |
|
10878 |
|
10879 "Created: / 12.11.1998 / 19:20:32 / cg" |
|
10880 ! |
|
10881 |
|
10882 _WDrawingSurfaceInfo_getHDC:nativeContext |
|
10883 "/ int getHDC () |
|
10884 UnimplementedNativeMethodSignal raise |
|
10885 |
|
10886 "Created: / 12.11.1998 / 19:20:50 / cg" |
|
10887 ! |
|
10888 |
|
10889 _WDrawingSurfaceInfo_getHPalette:nativeContext |
|
10890 "/ int getHPalette () |
|
10891 UnimplementedNativeMethodSignal raise |
|
10892 |
|
10893 "Created: / 12.11.1998 / 19:21:07 / cg" |
|
10894 ! |
|
10895 |
|
10896 _WDrawingSurfaceInfo_getHWnd:nativeContext |
|
10897 "/ int getHWnd () |
|
10898 UnimplementedNativeMethodSignal raise |
|
10899 |
|
10900 "Created: / 12.11.1998 / 19:20:23 / cg" |
|
10901 ! |
|
10902 |
|
10903 _WDrawingSurfaceInfo_getPBits:nativeContext |
|
10904 "/ int getPBits () |
|
10905 UnimplementedNativeMethodSignal raise |
|
10906 |
|
10907 "Created: / 12.11.1998 / 19:20:41 / cg" |
|
10908 ! |
|
10909 |
|
10910 _WDrawingSurfaceInfo_lock:nativeContext |
|
10911 "/ int lock () |
|
10912 UnimplementedNativeMethodSignal raise |
|
10913 |
|
10914 "Created: / 12.11.1998 / 19:20:00 / cg" |
|
10915 ! |
|
10916 |
|
10917 _WDrawingSurfaceInfo_unlock:nativeContext |
|
10918 "/ void unlock () |
|
10919 UnimplementedNativeMethodSignal raise |
|
10920 |
|
10921 "Created: / 12.11.1998 / 19:20:13 / cg" |
|
10922 ! |
|
10923 |
|
10924 _WEmbeddedFramePeer_create:nativeContext |
|
10925 "/ void create (sun.awt.windows.WComponentPeer) |
|
10926 UnimplementedNativeMethodSignal raise |
|
10927 |
|
10928 "Created: / 12.11.1998 / 19:16:09 / cg" |
|
10929 ! |
|
10930 |
|
10931 _WFileDialogPeer_show:nativeContext |
|
10932 |jDialogPeer jDialog dialogView stDialog |
|
10933 title dir pattern f| |
|
10934 |
|
10935 jDialogPeer := nativeContext receiver. |
|
10936 jDialog := jDialogPeer instVarNamed:'target'. |
|
10937 dialogView := jDialogPeer instVarNamed:'pData'. |
|
10938 |
|
10939 stDialog := FileSelectionBox new. |
|
10940 |
|
10941 dir := jDialog instVarNamed:'dir'. |
|
10942 dir notNil ifTrue:[ |
|
10943 stDialog directory:(Java as_ST_String:dir). |
|
10944 ]. |
|
10945 pattern := jDialog instVarNamed:'file'. |
|
10946 pattern notNil ifTrue:[ |
|
10947 stDialog pattern:(Java as_ST_String:pattern). |
|
10948 ]. |
|
10949 title := jDialog instVarNamed:'title'. |
|
10950 title notNil ifTrue:[ |
|
10951 stDialog title:(Java as_ST_String:title). |
|
10952 stDialog label:(Java as_ST_String:title). |
|
10953 ]. |
|
10954 |
|
10955 stDialog show. |
|
10956 |
|
10957 stDialog accepted ifTrue:[ |
|
10958 f := stDialog pathName. |
|
10959 |
|
10960 "/ cannot use the one below - it has a builtIn fileSeparator if '\' (sigh) |
|
10961 "/ jDialogPeer perform:#'handleSelected(Ljava/lang/String;)V' with:(Java as_String:f). |
|
10962 |
|
10963 jDialog |
|
10964 perform:#'setFile(Ljava/lang/String;)V' |
|
10965 with:(Java as_String:(f asFilename baseName)). |
|
10966 jDialog |
|
10967 perform:#'setDirectory(Ljava/lang/String;)V' |
|
10968 with:(Java as_String:(f asFilename directoryName , Filename separator asString)). |
|
10969 jDialog |
|
10970 perform:#'setVisible(Z)V' |
|
10971 with:0. |
|
10972 ] ifFalse:[ |
|
10973 jDialogPeer |
|
10974 perform:#'handleCancel()V' |
|
10975 ]. |
|
10976 "/ self halt. |
|
10977 |
|
10978 "Created: / 7.1.1998 / 22:38:45 / cg" |
|
10979 "Modified: / 15.1.1998 / 13:04:05 / cg" |
|
10980 ! |
|
10981 |
|
10982 _WFontMetrics_bytesWidth:nativeContext |
|
10983 "/ int bytesWidth (byte[] int int) |
|
10984 UnimplementedNativeMethodSignal raise |
|
10985 |
|
10986 "Created: / 12.11.1998 / 19:11:46 / cg" |
|
10987 ! |
|
10988 |
|
10989 _WFontMetrics_getMFCharSegmentWidth:nativeContext |
|
10990 "get multi-font string-segment width. |
|
10991 Not yet supported - use standard strings width" |
|
10992 |
|
10993 |jMetrics jFont jFontDescr stFont w |
|
10994 bool1 cp offs lenght bp int1| |
|
10995 |
|
10996 jMetrics := nativeContext receiver. |
|
10997 jFont := nativeContext argAt:1. |
|
10998 jFontDescr := nativeContext argAt:2. |
|
10999 bool1 := nativeContext argAt:3. |
|
11000 cp := nativeContext argAt:4. |
|
11001 offs := nativeContext argAt:5. |
|
11002 lenght := nativeContext argAt:6. |
|
11003 bp := nativeContext argAt:7. |
|
11004 int1 := nativeContext argAt:8. |
|
11005 |
|
11006 stFont := jFont instVarNamed:'pData'. |
|
11007 (stFont isNil or:[stFont == 0]) ifTrue:[ |
|
11008 self halt |
|
11009 ]. |
|
11010 |
|
11011 stFont device isNil ifTrue:[ |
|
11012 stFont := stFont on:Display. |
|
11013 jFont instVarNamed:'pData' put:stFont. |
|
11014 ]. |
|
11015 w := stFont widthOf:cp from:offs+1 to:offs+lenght. |
|
11016 ^ w. |
|
11017 |
|
11018 "Created: / 5.1.1998 / 01:57:45 / cg" |
|
11019 "Modified: / 13.1.1998 / 23:44:03 / cg" |
|
11020 ! |
|
11021 |
|
11022 _WFontMetrics_init:nativeContext |
|
11023 |jMetrics jFont stFont widths family name style size| |
|
11024 |
|
11025 jMetrics := nativeContext receiver. |
|
11026 jFont := jMetrics instVarNamed:'font'. |
|
11027 |
|
11028 family := jFont instVarNamed:'family'. |
|
11029 family := Java as_ST_String:family. |
|
11030 |
|
11031 name := jFont instVarNamed:'name'. |
|
11032 name := Java as_ST_String:name. |
|
11033 |
|
11034 style := jFont instVarNamed:'style'. |
|
11035 size := jFont instVarNamed:'size'. |
|
11036 |
|
11037 stFont := Font family:family size:size. |
|
11038 stFont isNil ifTrue:[ |
|
11039 stFont := Font family:'helvetica' size:size. |
|
11040 ]. |
|
11041 stFont := stFont on:Display. |
|
11042 self halt. |
|
11043 "/ stFont := jFont instVarNamed:'pData'. |
|
11044 "/ stFont isNil ifTrue:[ |
|
11045 "/ self halt |
|
11046 "/ ]. |
|
11047 |
|
11048 stFont := stFont on:Display. |
|
11049 jFont instVarNamed:'pData' put:stFont. |
|
11050 |
|
11051 jMetrics instVarNamed:'ascent' put:stFont ascent. |
|
11052 jMetrics instVarNamed:'descent' put:stFont descent. |
|
11053 jMetrics instVarNamed:'leading' put:0. |
|
11054 jMetrics instVarNamed:'height' put:stFont height. |
|
11055 jMetrics instVarNamed:'maxAscent' put:stFont maxAscent. |
|
11056 jMetrics instVarNamed:'maxDescent' put:stFont maxDescent. |
|
11057 jMetrics instVarNamed:'maxHeight' put:stFont maxHeight. |
|
11058 jMetrics instVarNamed:'maxAdvance' put:stFont maxWidth. |
|
11059 |
|
11060 widths := Array new:256. |
|
11061 0 to:255 do:[:i | |
|
11062 widths at:(i+1) put:(stFont widthOf:(Character value:i)) |
|
11063 ]. |
|
11064 jMetrics instVarNamed:'widths' put:widths. |
|
11065 "/ self halt. |
|
11066 |
|
11067 "Modified: / 8.8.1997 / 12:06:53 / cg" |
|
11068 "Created: / 5.1.1998 / 01:54:29 / cg" |
|
11069 ! |
|
11070 |
|
11071 _WFontMetrics_needsConversion:nativeContext |
|
11072 |jFont jFontDescr stFont| |
|
11073 |
|
11074 jFont := nativeContext argAt:1. |
|
11075 jFontDescr := nativeContext argAt:2. |
|
11076 |
|
11077 stFont := jFont instVarNamed:'pData'. |
|
11078 "/ stFont isNil ifTrue:[ |
|
11079 "/ self halt |
|
11080 "/ ]. |
|
11081 "/ stFont device isNil ifTrue:[ |
|
11082 "/ stFont := stFont on:Display. |
|
11083 "/ jFont instVarNamed:'pData' put:stFont. |
|
11084 "/ ]. |
|
11085 "/ |
|
11086 |
|
11087 ^ 0 |
|
11088 |
|
11089 "Modified: / 17.8.1997 / 17:16:29 / cg" |
|
11090 "Created: / 5.1.1998 / 01:56:42 / cg" |
|
11091 ! |
|
11092 |
|
11093 _WFramePeer__setIconImage:nativeContext |
|
11094 |frame imgRep image| |
|
11095 |
|
11096 frame := self viewForWPeer:nativeContext. |
|
11097 imgRep := nativeContext argAt:1. |
|
11098 imgRep notNil ifTrue:[ |
|
11099 image := imgRep instVarNamed:'pData'. |
|
11100 (image notNil and:[image ~~ 0]) ifTrue:[ |
|
11101 frame icon:image. |
|
11102 ] |
|
11103 ]. |
|
11104 |
|
11105 "Created: / 27.4.1998 / 17:15:09 / cg" |
|
11106 "Modified: / 27.4.1998 / 17:18:24 / cg" |
|
11107 ! |
|
11108 |
|
11109 _WFramePeer_create:nativeContext |
|
11110 |jFramePeer jFrame top frame pDataIdx| |
|
11111 |
|
11112 jFramePeer := nativeContext receiver. |
|
11113 |
|
11114 "/ for now: a kludge to create an embedded frame for |
|
11115 "/ mozillaFrames |
|
11116 |
|
11117 jFrame := jFramePeer instVarNamed:'target'. |
|
11118 (jFrame notNil |
|
11119 and:[(pDataIdx := jFrame class instVarOffsetOf:'pData') notNil]) |
|
11120 ifTrue:[ |
|
11121 ((frame := jFrame instVarAt:pDataIdx) notNil |
|
11122 and:[frame ~~ 0]) ifTrue:[ |
|
11123 WindowCreationTrace == true ifTrue:[ |
|
11124 'JAVA: targetFrame view already created: ' infoPrintCR. |
|
11125 ]. |
|
11126 "/ sigh; pData was renamed to pNativeWidget in jdk1.2 ... |
|
11127 pDataIdx := jFramePeer class instVarOffsetOf:'pNativeWidget'. |
|
11128 pDataIdx isNil ifTrue:[ |
|
11129 "/ ok, we are < 1.2 |
|
11130 pDataIdx := jFramePeer class instVarOffsetOf:'pData'. |
|
11131 ]. |
|
11132 jFramePeer instVarAt:pDataIdx put:frame. |
|
11133 ] |
|
11134 ] ifFalse:[ |
|
11135 frame := jFramePeer instVarNamed:'pData' |
|
11136 ]. |
|
11137 |
|
11138 (frame notNil and:[frame ~~ 0]) ifTrue:[ |
|
11139 WindowCreationTrace == true ifTrue:[ |
|
11140 'JAVA: frame view already created: ' infoPrint. |
|
11141 jFramePeer class name infoPrintCR. |
|
11142 ]. |
|
11143 ] ifFalse:[ |
|
11144 "/ OLD |
|
11145 "/ frame := StandardSystemView new. |
|
11146 "/ self createdWindowsView:frame for:jFramePeer. |
|
11147 "/ JavaWindowGroup addTopView:frame. |
|
11148 |
|
11149 frame := JavaTopView new. |
|
11150 frame delegate:self. |
|
11151 frame javaPeer:jFramePeer. |
|
11152 self createdWindowsView:frame for:jFramePeer. |
|
11153 JavaWindowGroup addTopView:frame. |
|
11154 |
|
11155 "/ top := StandardSystemView new. |
|
11156 "/ frame := JavaView origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
11157 "/ frame delegate:self. |
|
11158 "/ frame javaPeer:jFramePeer. |
|
11159 "/ self createdWindowsView:frame for:jFramePeer. |
|
11160 "/ JavaWindowGroup addTopView:top. |
|
11161 |
|
11162 ]. |
|
11163 |
|
11164 WindowCreationTrace == true ifTrue:[ |
|
11165 'JAVA: WFramePeer_create: ' print. jFramePeer displayString print. |
|
11166 ' frame: ' print. frame printNL. |
|
11167 ]. |
|
11168 |
|
11169 "Created: / 4.1.1998 / 17:56:39 / cg" |
|
11170 "Modified: / 3.12.1998 / 00:10:21 / cg" |
|
11171 ! |
|
11172 |
|
11173 _WFramePeer_setMenuBar0:nativeContext |
|
11174 |frame jMenuBarPeer menuPanel| |
|
11175 |
|
11176 frame := self viewForWPeer:nativeContext. |
|
11177 |
|
11178 jMenuBarPeer := nativeContext argAt:1. |
|
11179 jMenuBarPeer isNil ifTrue:[ |
|
11180 "/ mhmh - JAVA wants to remove the frames menuPanel. |
|
11181 "/ but I have no handle on it (for destroy). |
|
11182 "/ search it in subViews of the frame. |
|
11183 frame subViews copy do:[:v | |
|
11184 (v isKindOf:MenuPanel) ifTrue:[ |
|
11185 v destroy |
|
11186 ] |
|
11187 ] |
|
11188 ] ifFalse:[ |
|
11189 menuPanel := jMenuBarPeer instVarNamed:'pData'. |
|
11190 |
|
11191 menuPanel origin:0.0@0.0 corner:1.0@(menuPanel preferredExtent y). |
|
11192 frame addSubView:menuPanel. |
|
11193 ]. |
|
11194 ^ nil |
|
11195 |
|
11196 "Created: / 7.1.1998 / 21:41:35 / cg" |
|
11197 "Modified: / 8.1.1998 / 17:35:04 / cg" |
|
11198 ! |
|
11199 |
|
11200 _WFramePeer_setResizable:nativeContext |
|
11201 |view onOff| |
|
11202 |
|
11203 view := self viewForWPeer:nativeContext. |
|
11204 |
|
11205 onOff := (nativeContext argAt:1) == 1. |
|
11206 view isTopView ifTrue:[ |
|
11207 onOff ifTrue:[ |
|
11208 view minExtent:10@10. |
|
11209 view maxExtent:(Screen current extent). |
|
11210 ] ifFalse:[ |
|
11211 view minExtent:view extent. |
|
11212 view maxExtent:view extent. |
|
11213 ] |
|
11214 ] ifFalse:[ |
|
11215 (view isMemberOf:JavaEmbeddedFrameView) ifFalse:[ |
|
11216 self halt. |
|
11217 ] |
|
11218 ]. |
|
11219 |
|
11220 "/ 'JAVA: WWindowPeer_setResizable: ' print. view print. ' yes/no: ' print. onOff printNL. |
|
11221 |
|
11222 ^ nil |
|
11223 |
|
11224 "Modified: / 16.1.1998 / 18:08:00 / cg" |
|
11225 "Created: / 16.10.1998 / 02:21:34 / cg" |
|
11226 ! |
|
11227 |
|
11228 _WFramePeer_setTitle:nativeContext |
|
11229 |view jString string| |
|
11230 |
|
11231 view := self viewForWPeer:nativeContext. |
|
11232 |
|
11233 jString := nativeContext argAt:1. |
|
11234 string := Java as_ST_String:jString. |
|
11235 |
|
11236 "/ 'JAVA: WFramePeer_pSetTitle: ' print. string print. ' ' print. view printNL. |
|
11237 |
|
11238 view label:string. |
|
11239 ^ nil |
|
11240 |
|
11241 "Modified: / 8.1.1998 / 17:37:41 / cg" |
|
11242 "Created: / 27.1.1998 / 21:42:57 / cg" |
|
11243 ! |
|
11244 |
|
11245 _WGraphics__dispose:nativeContext |
|
11246 "/ void _dispose() |
|
11247 UnimplementedNativeMethodSignal raise |
|
11248 |
|
11249 "Created: / 12.11.1998 / 19:17:51 / cg" |
|
11250 ! |
|
11251 |
|
11252 _WGraphics_changeClip:nativeContext |
|
11253 |gc x y w h r bool| |
|
11254 |
|
11255 gc := self gcForWGraphics:nativeContext. |
|
11256 |
|
11257 x := nativeContext argAt:1. |
|
11258 y := nativeContext argAt:2. |
|
11259 w := nativeContext argAt:3. |
|
11260 h := nativeContext argAt:4. |
|
11261 bool := (nativeContext argAt:5) ~~ 0. |
|
11262 |
|
11263 r := Rectangle left:x top:y width:w height:h. |
|
11264 "/ 'WGraphics_changeClip: ' infoPrint. r infoPrintCR. |
|
11265 gc clippingRectangle:r. |
|
11266 |
|
11267 "Created: / 6.1.1998 / 20:57:21 / cg" |
|
11268 "Modified: / 20.10.1998 / 19:40:10 / cg" |
|
11269 ! |
|
11270 |
|
11271 _WGraphics_clearRect:nativeContext |
|
11272 |gc x y w h| |
|
11273 |
|
11274 gc := self gcForWGraphics:nativeContext. |
|
11275 "/ gc isNil ifTrue:[^ self]. |
|
11276 |
|
11277 gc realized ifFalse:[ |
|
11278 'JAVA: drawing on unrealized gc - ignored' infoPrintCR. |
|
11279 ^ self |
|
11280 ]. |
|
11281 |
|
11282 x := nativeContext argAt:1. |
|
11283 y := nativeContext argAt:2. |
|
11284 w := nativeContext argAt:3. |
|
11285 h := nativeContext argAt:4. |
|
11286 |
|
11287 "/ self halt. |
|
11288 "/ self internalError:'breakPoint'. |
|
11289 |
|
11290 gc clearRectangleX:x y:y width:w height:h. |
|
11291 |
|
11292 "Created: / 8.1.1998 / 00:16:00 / cg" |
|
11293 "Modified: / 8.1.1998 / 00:21:09 / cg" |
|
11294 ! |
|
11295 |
|
11296 _WGraphics_close:nativeContext |
|
11297 "/ void close (sun.awt.windows.WPrintJob) |
|
11298 UnimplementedNativeMethodSignal raise |
|
11299 |
|
11300 "Created: / 12.11.1998 / 19:19:40 / cg" |
|
11301 ! |
|
11302 |
|
11303 _WGraphics_copyArea:nativeContext |
|
11304 |gc srcX srcY w h deltaX deltaY| |
|
11305 |
|
11306 gc := self gcForWGraphics:nativeContext. |
|
11307 "/ gc isNil ifTrue:[^ self]. |
|
11308 |
|
11309 gc realized ifFalse:[ |
|
11310 'JAVA: copyArea on unrealized gc - ignored' infoPrintCR. |
|
11311 ^ self |
|
11312 ]. |
|
11313 |
|
11314 srcX := nativeContext argAt:1. |
|
11315 srcY := nativeContext argAt:2. |
|
11316 w := nativeContext argAt:3. |
|
11317 h := nativeContext argAt:4. |
|
11318 deltaX := nativeContext argAt:5. |
|
11319 deltaY := nativeContext argAt:6. |
|
11320 |
|
11321 gc |
|
11322 copyFrom:gc |
|
11323 x:srcX y:srcY |
|
11324 toX:srcX+deltaX y:srcY+deltaY |
|
11325 width:w height:h |
|
11326 |
|
11327 "Created: / 8.1.1998 / 00:16:00 / cg" |
|
11328 "Modified: / 9.4.1998 / 22:01:32 / cg" |
|
11329 ! |
|
11330 |
|
11331 _WGraphics_createFromComponent:nativeContext |
|
11332 |jGraphics jWin view| |
|
11333 |
|
11334 jGraphics := nativeContext receiver. |
|
11335 jWin := nativeContext argAt:1. |
|
11336 |
|
11337 view := KnownWindows at:jWin ifAbsent:nil. |
|
11338 view isNil ifTrue:[ |
|
11339 self halt. |
|
11340 ^ self |
|
11341 ]. |
|
11342 view clippingRectangle:nil. |
|
11343 |
|
11344 "/ "/ just a consistency check ... |
|
11345 "/ (jWin instVarNamed:'xid') ~~ view ifTrue:[ |
|
11346 "/ self halt:'consistency check' |
|
11347 "/ ]. |
|
11348 |
|
11349 jGraphics instVarNamed:'pData' put:view. |
|
11350 |
|
11351 "Created: / 6.1.1998 / 20:55:18 / cg" |
|
11352 "Modified: / 20.10.1998 / 19:38:18 / cg" |
|
11353 ! |
|
11354 |
|
11355 _WGraphics_createFromGraphics:nativeContext |
|
11356 |jGraphics graphics gc| |
|
11357 |
|
11358 jGraphics := nativeContext receiver. |
|
11359 graphics := nativeContext argAt:1. |
|
11360 gc := graphics instVarNamed:'pData'. |
|
11361 |
|
11362 jGraphics instVarNamed:'pData' put:gc. |
|
11363 gc clippingRectangle:nil. |
|
11364 |
|
11365 "Created: / 8.1.1998 / 00:47:39 / cg" |
|
11366 "Modified: / 20.10.1998 / 19:37:58 / cg" |
|
11367 ! |
|
11368 |
|
11369 _WGraphics_createFromHDC:nativeContext |
|
11370 "/ void createFromHDC (int) |
|
11371 UnimplementedNativeMethodSignal raise |
|
11372 |
|
11373 "Created: / 12.11.1998 / 19:17:32 / cg" |
|
11374 ! |
|
11375 |
|
11376 _WGraphics_createFromPrintJob:nativeContext |
|
11377 "/ void createFromPrintJob (sun.awt.windows.WPrintJob) |
|
11378 UnimplementedNativeMethodSignal raise |
|
11379 |
|
11380 "Created: / 12.11.1998 / 19:17:20 / cg" |
|
11381 ! |
|
11382 |
|
11383 _WGraphics_dispose:nativeContext |
|
11384 |gc| |
|
11385 |
|
11386 gc := self gcForWGraphics:nativeContext. |
|
11387 gc isNil ifTrue:[^ self]. |
|
11388 gc clippingRectangle:nil. |
|
11389 |
|
11390 "Created: / 6.1.1998 / 20:58:38 / cg" |
|
11391 "Modified: / 20.10.1998 / 19:35:05 / cg" |
|
11392 ! |
|
11393 |
|
11394 _WGraphics_drawArc:nativeContext |
|
11395 |gc x y w h startAngle endAngle| |
|
11396 |
|
11397 gc := self gcForWGraphics:nativeContext. |
|
11398 "/ gc isNil ifTrue:[^ self]. |
|
11399 gc realized ifFalse:[^ self]. |
|
11400 |
|
11401 x := nativeContext argAt:1. |
|
11402 y := nativeContext argAt:2. |
|
11403 w := nativeContext argAt:3. |
|
11404 h := nativeContext argAt:4. |
|
11405 startAngle := nativeContext argAt:5. |
|
11406 endAngle := nativeContext argAt:6. |
|
11407 |
|
11408 DrawOPTrace ifTrue:[ |
|
11409 'drawArc x/y= ' print. x print. '@' print. y print. |
|
11410 ' w/h= ' print. w print. '@' print. h print. |
|
11411 ' startAngle= ' print. startAngle print. ' endAngle= ' print. endAngle printCR. |
|
11412 ]. |
|
11413 gc |
|
11414 displayArcX:x y:y |
|
11415 width:w height:h |
|
11416 from:startAngle angle:(endAngle - startAngle). |
|
11417 |
|
11418 "Created: / 6.1.1998 / 21:00:15 / cg" |
|
11419 "Modified: / 28.1.1999 / 17:38:45 / cg" |
|
11420 ! |
|
11421 |
|
11422 _WGraphics_drawBytes:nativeContext |
|
11423 "/ void drawBytes (byte[] int int int int) |
|
11424 UnimplementedNativeMethodSignal raise |
|
11425 |
|
11426 "Created: / 12.11.1998 / 19:18:56 / cg" |
|
11427 ! |
|
11428 |
|
11429 _WGraphics_drawLine:nativeContext |
|
11430 |gc x y x2 y2| |
|
11431 |
|
11432 gc := self gcForWGraphics:nativeContext. |
|
11433 "/ gc isNil ifTrue:[^ self]. |
|
11434 gc realized ifFalse:[^ self]. |
|
11435 |
|
11436 x := nativeContext argAt:1. |
|
11437 y := nativeContext argAt:2. |
|
11438 x2 := nativeContext argAt:3. |
|
11439 y2 := nativeContext argAt:4. |
|
11440 |
|
11441 DrawOPTrace ifTrue:[ |
|
11442 'drawLine x/y= ' print. x print. '@' print. y print. ' x2/y2= ' print. x2 print. '@' print. y2 printCR. |
|
11443 ]. |
|
11444 gc displayLineFromX:x y:y toX:x2 y:y2 |
|
11445 |
|
11446 "Created: / 6.1.1998 / 20:59:27 / cg" |
|
11447 "Modified: / 8.1.1998 / 00:34:23 / cg" |
|
11448 ! |
|
11449 |
|
11450 _WGraphics_drawMFCharsConvertedSegment:nativeContext |
|
11451 "/ int drawMFCharsConvertedSegment (java.awt.Font sun.awt.FontDescriptor byte[] int int int) |
|
11452 UnimplementedNativeMethodSignal raise |
|
11453 |
|
11454 "Created: / 12.11.1998 / 19:18:44 / cg" |
|
11455 ! |
|
11456 |
|
11457 _WGraphics_drawMFCharsSegment:nativeContext |
|
11458 |jFont jFontDescr s gc x y offs len| |
|
11459 |
|
11460 gc := self gcForWGraphics:nativeContext. |
|
11461 gc realized ifFalse:[^ self]. |
|
11462 |
|
11463 jFont := nativeContext argAt:1. |
|
11464 jFontDescr := nativeContext argAt:2. |
|
11465 s := nativeContext argAt:3. |
|
11466 offs := nativeContext argAt:4. |
|
11467 len := nativeContext argAt:5. |
|
11468 x := nativeContext argAt:6. |
|
11469 y := nativeContext argAt:7. |
|
11470 |
|
11471 DrawOPTrace ifTrue:[ |
|
11472 'drawMFCharsSegment x/y= ' print. x print. '@' print. y print. ' s= ' print. s printCR. |
|
11473 ]. |
|
11474 gc displayString:s from:offs+1 to:offs+len x:x y:y. |
|
11475 ^ (gc font onDevice:(gc graphicsDevice)) widthOf:s. |
|
11476 |
|
11477 "Created: / 6.1.1998 / 21:01:07 / cg" |
|
11478 "Modified: / 25.1.1998 / 20:45:55 / cg" |
|
11479 ! |
|
11480 |
|
11481 _WGraphics_drawOval:nativeContext |
|
11482 |gc x y w h| |
|
11483 |
|
11484 gc := self gcForWGraphics:nativeContext. |
|
11485 "/ gc isNil ifTrue:[^ self]. |
|
11486 gc realized ifFalse:[^ self]. |
|
11487 |
|
11488 x := nativeContext argAt:1. |
|
11489 y := nativeContext argAt:2. |
|
11490 w := nativeContext argAt:3. |
|
11491 h := nativeContext argAt:4. |
|
11492 |
|
11493 DrawOPTrace ifTrue:[ |
|
11494 'drawOval x/y= ' print. x print. '@' print. y print. |
|
11495 ' w/h= ' print. w print. '@' print. h printCR. |
|
11496 ]. |
|
11497 gc displayArcX:x y:y width:w height:h from:0 angle:360. |
|
11498 |
|
11499 "Created: / 8.1.1998 / 00:44:31 / cg" |
|
11500 "Modified: / 9.4.1998 / 22:10:23 / cg" |
|
11501 ! |
|
11502 |
|
11503 _WGraphics_drawPolygon:nativeContext |
|
11504 |gc xVector yVector count points| |
|
11505 |
|
11506 gc := self gcForWGraphics:nativeContext. |
|
11507 "/ gc isNil ifTrue:[^ self]. |
|
11508 gc realized ifFalse:[^ self]. |
|
11509 |
|
11510 xVector := nativeContext argAt:1. |
|
11511 yVector := nativeContext argAt:2. |
|
11512 count := nativeContext argAt:3. |
|
11513 |
|
11514 DrawOPTrace ifTrue:[ |
|
11515 'drawPolgon' printCR. |
|
11516 ]. |
|
11517 |
|
11518 points := (1 to:count) collect:[:i | (xVector at:i) @ (yVector at:i)]. |
|
11519 gc displayPolygon:points |
|
11520 |
|
11521 "Created: / 8.1.1998 / 00:57:28 / cg" |
|
11522 "Modified: / 8.1.1998 / 00:57:49 / cg" |
|
11523 ! |
|
11524 |
|
11525 _WGraphics_drawPolyline:nativeContext |
|
11526 "/ void drawPolyline (int[] int[] int) |
|
11527 UnimplementedNativeMethodSignal raise |
|
11528 |
|
11529 "Created: / 12.11.1998 / 19:19:07 / cg" |
|
11530 ! |
|
11531 |
|
11532 _WGraphics_drawRect:nativeContext |
|
11533 |gc x y w h| |
|
11534 |
|
11535 gc := self gcForWGraphics:nativeContext. |
|
11536 "/ gc isNil ifTrue:[^ self]. |
|
11537 gc realized ifFalse:[^ self]. |
|
11538 |
|
11539 x := nativeContext argAt:1. |
|
11540 y := nativeContext argAt:2. |
|
11541 w := nativeContext argAt:3. |
|
11542 h := nativeContext argAt:4. |
|
11543 |
|
11544 "/ self halt. |
|
11545 "/ self internalError:'breakPoint'. |
|
11546 |
|
11547 gc displayRectangleX:x y:y width:w height:h. |
|
11548 |
|
11549 "Modified: / 8.1.1998 / 00:34:33 / cg" |
|
11550 "Created: / 8.1.1998 / 00:59:05 / cg" |
|
11551 ! |
|
11552 |
|
11553 _WGraphics_drawRoundRect:nativeContext |
|
11554 |gc x y w h| |
|
11555 |
|
11556 gc := self gcForWGraphics:nativeContext. |
|
11557 "/ gc isNil ifTrue:[^ self]. |
|
11558 gc realized ifFalse:[^ self]. |
|
11559 |
|
11560 x := nativeContext argAt:1. |
|
11561 y := nativeContext argAt:2. |
|
11562 w := nativeContext argAt:3. |
|
11563 h := nativeContext argAt:4. |
|
11564 |
|
11565 "/ self halt. |
|
11566 "/ self internalError:'breakPoint'. |
|
11567 |
|
11568 gc displayRectangleX:x y:y width:w height:h. |
|
11569 |
|
11570 "Modified: / 8.1.1998 / 00:34:33 / cg" |
|
11571 "Created: / 8.1.1998 / 00:59:26 / cg" |
|
11572 ! |
|
11573 |
|
11574 _WGraphics_drawSFChars:nativeContext |
|
11575 "/ void drawSFChars (char[]s, int pos1, int len, int x, int y) |
|
11576 |
|
11577 |gc str x y idx1 nChars| |
|
11578 |
|
11579 gc := self gcForWGraphics:nativeContext. |
|
11580 gc realized ifFalse:[^ self]. |
|
11581 |
|
11582 str := nativeContext argAt:1. |
|
11583 idx1 := nativeContext argAt:2. |
|
11584 nChars := nativeContext argAt:3. |
|
11585 x := nativeContext argAt:4. |
|
11586 y := nativeContext argAt:5. |
|
11587 |
|
11588 DrawOPTrace ifTrue:[ |
|
11589 'drawSFChars x/y= ' print. x print. '@' print. y print. |
|
11590 ' s= ' print. str printCR. |
|
11591 ]. |
|
11592 gc displayString:str from:idx1+1 to:idx1+nChars x:x y:y |
|
11593 |
|
11594 "Created: / 6.1.1998 / 21:11:31 / cg" |
|
11595 "Modified: / 8.1.1998 / 00:33:59 / cg" |
|
11596 |
|
11597 ! |
|
11598 |
|
11599 _WGraphics_fillArc:nativeContext |
|
11600 |gc x y w h startAngle endAngle| |
|
11601 |
|
11602 gc := self gcForWGraphics:nativeContext. |
|
11603 "/ gc isNil ifTrue:[^ self]. |
|
11604 gc realized ifFalse:[^ self]. |
|
11605 |
|
11606 x := nativeContext argAt:1. |
|
11607 y := nativeContext argAt:2. |
|
11608 w := nativeContext argAt:3. |
|
11609 h := nativeContext argAt:4. |
|
11610 startAngle := nativeContext argAt:5. |
|
11611 endAngle := nativeContext argAt:6. |
|
11612 |
|
11613 DrawOPTrace ifTrue:[ |
|
11614 'fillArc x/y= ' print. x print. '@' print. y print. |
|
11615 ' w/h= ' print. w print. '@' print. h print. |
|
11616 ' startAngle= ' print. startAngle print. ' endAngle= ' print. endAngle printCR. |
|
11617 ]. |
|
11618 gc fillArcX:x y:y width:w height:h from:startAngle angle:(endAngle - startAngle) |
|
11619 |
|
11620 "Created: / 6.1.1998 / 21:11:31 / cg" |
|
11621 "Modified: / 8.1.1998 / 00:33:59 / cg" |
|
11622 ! |
|
11623 |
|
11624 _WGraphics_fillOval:nativeContext |
|
11625 |gc x y w h| |
|
11626 |
|
11627 gc := self gcForWGraphics:nativeContext. |
|
11628 "/ gc isNil ifTrue:[^ self]. |
|
11629 gc realized ifFalse:[^ self]. |
|
11630 |
|
11631 x := nativeContext argAt:1. |
|
11632 y := nativeContext argAt:2. |
|
11633 w := nativeContext argAt:3. |
|
11634 h := nativeContext argAt:4. |
|
11635 |
|
11636 DrawOPTrace ifTrue:[ |
|
11637 'drawOval x/y= ' print. x print. '@' print. y print. |
|
11638 ' w/h= ' print. w print. '@' print. h printCR. |
|
11639 ]. |
|
11640 gc fillArcX:x y:y width:w height:h from:0 angle:360 |
|
11641 |
|
11642 "Created: / 8.1.1998 / 00:46:00 / cg" |
|
11643 "Modified: / 8.1.1998 / 00:46:20 / cg" |
|
11644 ! |
|
11645 |
|
11646 _WGraphics_fillPolygon:nativeContext |
|
11647 |gc xVector yVector count points| |
|
11648 |
|
11649 gc := self gcForWGraphics:nativeContext. |
|
11650 "/ gc isNil ifTrue:[^ self]. |
|
11651 gc realized ifFalse:[^ self]. |
|
11652 |
|
11653 xVector := nativeContext argAt:1. |
|
11654 yVector := nativeContext argAt:2. |
|
11655 count := nativeContext argAt:3. |
|
11656 |
|
11657 DrawOPTrace ifTrue:[ |
|
11658 'fillPolgon' printCR. |
|
11659 ]. |
|
11660 |
|
11661 points := (1 to:count) collect:[:i | (xVector at:i) @ (yVector at:i)]. |
|
11662 gc fillPolygon:points |
|
11663 |
|
11664 "Created: / 8.1.1998 / 00:58:09 / cg" |
|
11665 "Modified: / 25.1.1998 / 11:03:19 / cg" |
|
11666 ! |
|
11667 |
|
11668 _WGraphics_fillRect:nativeContext |
|
11669 |gc x y w h| |
|
11670 |
|
11671 gc := self gcForWGraphics:nativeContext. |
|
11672 "/ gc isNil ifTrue:[^ self]. |
|
11673 gc realized ifFalse:[^ self]. |
|
11674 |
|
11675 x := nativeContext argAt:1. |
|
11676 y := nativeContext argAt:2. |
|
11677 w := nativeContext argAt:3. |
|
11678 h := nativeContext argAt:4. |
|
11679 |
|
11680 "/ self halt. |
|
11681 "/ self internalError:'breakPoint'. |
|
11682 |
|
11683 gc fillRectangleX:x y:y width:w height:h. |
|
11684 |
|
11685 "Created: / 15.8.1997 / 15:43:10 / cg" |
|
11686 "Modified: / 8.1.1998 / 00:34:33 / cg" |
|
11687 ! |
|
11688 |
|
11689 _WGraphics_fillRoundRect:nativeContext |
|
11690 |gc x y w h| |
|
11691 |
|
11692 gc := self gcForWGraphics:nativeContext. |
|
11693 "/ gc isNil ifTrue:[^ self]. |
|
11694 gc realized ifFalse:[^ self]. |
|
11695 |
|
11696 x := nativeContext argAt:1. |
|
11697 y := nativeContext argAt:2. |
|
11698 w := nativeContext argAt:3. |
|
11699 h := nativeContext argAt:4. |
|
11700 |
|
11701 "/ self halt. |
|
11702 "/ self internalError:'breakPoint'. |
|
11703 |
|
11704 gc displayRectangleX:x y:y width:w height:h. |
|
11705 |
|
11706 "Modified: / 8.1.1998 / 00:34:33 / cg" |
|
11707 "Created: / 8.1.1998 / 00:59:36 / cg" |
|
11708 ! |
|
11709 |
|
11710 _WGraphics_getClipBounds:nativeContext |
|
11711 |gc rect r x y w h| |
|
11712 |
|
11713 gc := self gcForWGraphics:nativeContext. |
|
11714 "/ gc isNil ifTrue:[^ nil]. |
|
11715 |
|
11716 rect := (Java classForName:'java.awt.Rectangle') basicNew. |
|
11717 |
|
11718 (gc isMemberOf:JavaView) ifTrue:[ |
|
11719 "/ r := gc clippingRectangleOrNil. |
|
11720 r := gc getNextUpdateRectangle. |
|
11721 ]. |
|
11722 r isNil ifTrue:[ |
|
11723 r := gc clippingRectangleOrNil. |
|
11724 ]. |
|
11725 |
|
11726 r isNil ifTrue:[ |
|
11727 x := y := 0. |
|
11728 w := (gc width). |
|
11729 h := (gc height). |
|
11730 ] ifFalse:[ |
|
11731 x := (r left). |
|
11732 y := (r top). |
|
11733 w := (r width). |
|
11734 h := (r height). |
|
11735 ]. |
|
11736 rect instVarNamed:'x' put:x. |
|
11737 rect instVarNamed:'y' put:y. |
|
11738 rect instVarNamed:'width' put:w. |
|
11739 rect instVarNamed:'height' put:h. |
|
11740 |
|
11741 "/ 'WGraphics__getClipBounds ' infoPrint. (x@y extent:w@h) infoPrintCR. |
|
11742 |
|
11743 ^ rect |
|
11744 |
|
11745 "Created: / 6.1.1998 / 20:58:07 / cg" |
|
11746 "Modified: / 23.12.1998 / 20:14:09 / cg" |
|
11747 ! |
|
11748 |
|
11749 _WGraphics_imageCreate:nativeContext |
|
11750 |jGraphics imgRep| |
|
11751 |
|
11752 jGraphics := nativeContext receiver. |
|
11753 imgRep := nativeContext argAt:1. |
|
11754 |
|
11755 jGraphics instVarNamed:'pData' put:(imgRep instVarNamed:'pData'). |
|
11756 "/ self halt. |
|
11757 |
|
11758 "Created: / 11.1.1998 / 16:34:30 / cg" |
|
11759 "Modified: / 17.1.1998 / 12:37:18 / cg" |
|
11760 ! |
|
11761 |
|
11762 _WGraphics_pSetFont:nativeContext |
|
11763 |gc jFont stFont| |
|
11764 |
|
11765 gc := self gcForWGraphics:nativeContext. |
|
11766 jFont := nativeContext argAt:1. |
|
11767 |
|
11768 stFont := jFont instVarNamed:'pData'. |
|
11769 (stFont isNil or:[stFont == 0]) ifTrue:[ |
|
11770 "/ self halt. |
|
11771 ] ifFalse:[ |
|
11772 gc font:stFont |
|
11773 ]. |
|
11774 |
|
11775 "Created: / 6.1.1998 / 20:56:47 / cg" |
|
11776 "Modified: / 15.1.1998 / 12:31:20 / cg" |
|
11777 ! |
|
11778 |
|
11779 _WGraphics_pSetForeground:nativeContext |
|
11780 |gc rgb clr| |
|
11781 |
|
11782 gc := self gcForWGraphics:nativeContext. |
|
11783 |
|
11784 rgb := nativeContext argAt:1. |
|
11785 rgb isInteger ifFalse:[ |
|
11786 "/ its a java.awt.Color |
|
11787 rgb := rgb instVarNamed:'value'. |
|
11788 ]. |
|
11789 clr := Color rgbValue:rgb. |
|
11790 gc paint:(clr nearestOn:gc device). |
|
11791 |
|
11792 "/ self halt. |
|
11793 "/ self internalError:'breakPoint'. |
|
11794 |
|
11795 "Created: / 6.1.1998 / 20:56:14 / cg" |
|
11796 "Modified: / 23.12.1998 / 20:10:49 / cg" |
|
11797 ! |
|
11798 |
|
11799 _WGraphics_print:nativeContext |
|
11800 "/ void print (sun.awt.windows.WComponentPeer) |
|
11801 UnimplementedNativeMethodSignal raise |
|
11802 |
|
11803 "Created: / 12.11.1998 / 19:19:25 / cg" |
|
11804 ! |
|
11805 |
|
11806 _WGraphics_removeClip:nativeContext |
|
11807 "/ void removeClip () |
|
11808 UnimplementedNativeMethodSignal raise |
|
11809 |
|
11810 "Created: / 12.11.1998 / 19:18:05 / cg" |
|
11811 ! |
|
11812 |
|
11813 _WGraphics_setPaintMode:nativeContext |
|
11814 |gc| |
|
11815 |
|
11816 gc := self gcForWGraphics:nativeContext. |
|
11817 gc function:#copy. |
|
11818 |
|
11819 true "DrawOPTrace" ifTrue:[ |
|
11820 'copyMode' infoPrintCR. |
|
11821 ]. |
|
11822 |
|
11823 "Created: / 8.1.1998 / 00:33:44 / cg" |
|
11824 "Modified: / 28.1.1998 / 23:25:56 / cg" |
|
11825 ! |
|
11826 |
|
11827 _WGraphics_setXORMode:nativeContext |
|
11828 |gc jColor rgb invColor device| |
|
11829 |
|
11830 gc := self gcForWGraphics:nativeContext. |
|
11831 jColor := nativeContext argAt:1. |
|
11832 device := gc graphicsDevice. |
|
11833 |
|
11834 "/ "/ on trueColor systems, use the provided |
|
11835 "/ "/ rgb value for inverting. |
|
11836 "/ "/ on palette systems, use white ^ black |
|
11837 "/ |
|
11838 "/ device visualType == #TrueColor ifTrue:[ |
|
11839 "/ rgb := jColor instVarNamed:'value'. |
|
11840 "/ rgb := rgb bitAnd:16rFFFFFF. |
|
11841 "/ rgb == 0 ifTrue:[ |
|
11842 "/ rgb := 16rFFFFFF. |
|
11843 "/ ]. |
|
11844 "/ invColor := rgb |
|
11845 "/ ] ifFalse:[ |
|
11846 "/ invColor := device blackpixel bitXor:device whitepixel. |
|
11847 "/ ]. |
|
11848 |
|
11849 invColor := device blackpixel bitXor:device whitepixel. |
|
11850 |
|
11851 "/ gc foreground:(Color colorId:invColor) |
|
11852 "/ background:device blackColor. |
|
11853 device |
|
11854 setForeground:invColor background:0 |
|
11855 in:gc gcId. |
|
11856 gc function:#xor. |
|
11857 |
|
11858 true "DrawOPTrace" ifTrue:[ |
|
11859 'xorMode' infoPrintCR. |
|
11860 ]. |
|
11861 |
|
11862 "Created: / 8.1.1998 / 00:36:17 / cg" |
|
11863 "Modified: / 28.1.1998 / 23:45:03 / cg" |
|
11864 ! |
|
11865 |
|
11866 _WLabelPeer_create:nativeContext |
|
11867 |jLabelPeer jLabel jFrame frame label |
|
11868 lbl| |
|
11869 |
|
11870 jLabelPeer := nativeContext receiver. |
|
11871 jLabel := jLabelPeer instVarNamed:'target'. |
|
11872 |
|
11873 lbl := jLabel instVarNamed:'text'. |
|
11874 lbl notNil ifTrue:[ |
|
11875 lbl := Java as_ST_String:lbl |
|
11876 ]. |
|
11877 |
|
11878 jFrame := nativeContext argAt:1. |
|
11879 frame := jFrame instVarNamed:'pData'. |
|
11880 |
|
11881 label := Label in:frame. |
|
11882 label sizeFixed:true. |
|
11883 lbl notNil ifTrue:[ |
|
11884 label label:lbl |
|
11885 ]. |
|
11886 self createdWindowsView:label for:jLabelPeer. |
|
11887 |
|
11888 WindowCreationTrace == true ifTrue:[ |
|
11889 'WLabelPeer_create: ' print. frame print. ' -> ' print. label printNL. |
|
11890 ]. |
|
11891 |
|
11892 "Created: / 7.1.1998 / 21:42:31 / cg" |
|
11893 "Modified: / 13.1.1998 / 22:10:47 / cg" |
|
11894 ! |
|
11895 |
|
11896 _WLabelPeer_setAlignment:nativeContext |
|
11897 |label alignNr| |
|
11898 |
|
11899 alignNr := nativeContext argAt:1. |
|
11900 label := self viewForWPeer:nativeContext. |
|
11901 label notNil ifTrue:[ |
|
11902 ]. |
|
11903 |
|
11904 "Created: / 7.1.1998 / 21:43:12 / cg" |
|
11905 "Modified: / 8.1.1998 / 17:35:29 / cg" |
|
11906 ! |
|
11907 |
|
11908 _WLabelPeer_setText:nativeContext |
|
11909 |label jString str| |
|
11910 |
|
11911 jString := nativeContext argAt:1. |
|
11912 |
|
11913 label := self viewForWPeer:nativeContext. |
|
11914 jString notNil ifTrue:[ |
|
11915 str := Java as_ST_String:jString |
|
11916 ]. |
|
11917 label label:str |
|
11918 |
|
11919 "Created: / 7.1.1998 / 21:43:51 / cg" |
|
11920 "Modified: / 3.12.1998 / 14:59:18 / cg" |
|
11921 ! |
|
11922 |
|
11923 _WListPeer__addItem:nativeContext |
|
11924 |jString index1 length selListView m| |
|
11925 |
|
11926 selListView := self viewForWPeer:nativeContext. |
|
11927 |
|
11928 jString := nativeContext argAt:1. |
|
11929 index1 := nativeContext argAt:2. |
|
11930 length := nativeContext argAt:3. |
|
11931 |
|
11932 (m := selListView model) notNil ifTrue:[ |
|
11933 m list addLast:(Java as_ST_String:jString). |
|
11934 m changed:#list. |
|
11935 ]. |
|
11936 |
|
11937 "Created: / 26.10.1998 / 20:11:30 / cg" |
|
11938 "Modified: / 14.11.1998 / 01:21:03 / cg" |
|
11939 ! |
|
11940 |
|
11941 _WListPeer_addItem:nativeContext |
|
11942 |jString index selListView m| |
|
11943 |
|
11944 selListView := self viewForWPeer:nativeContext. |
|
11945 |
|
11946 jString := nativeContext argAt:1. |
|
11947 index := nativeContext argAt:2. |
|
11948 |
|
11949 m := selListView model. |
|
11950 m isNil ifTrue:[ |
|
11951 Transcript showCR:'JAVA: access to listModel of closed view'. |
|
11952 ] ifFalse:[ |
|
11953 m list addLast:(Java as_ST_String:jString). |
|
11954 m changed:#list. |
|
11955 ] |
|
11956 |
|
11957 "Created: / 24.1.1998 / 21:10:05 / cg" |
|
11958 "Modified: / 2.11.1998 / 17:12:52 / cg" |
|
11959 ! |
|
11960 |
|
11961 _WListPeer_create:nativeContext |
|
11962 |jListPeer jFrame frame selectionInListView| |
|
11963 |
|
11964 jListPeer := nativeContext receiver. |
|
11965 |
|
11966 jFrame := nativeContext argAt:1. |
|
11967 frame := jFrame instVarNamed:'pData'. |
|
11968 |
|
11969 selectionInListView := ScrollableView for:SelectionInListView in:frame. |
|
11970 selectionInListView action:[:index | jListPeer perform:#'handleListChanged(I)V' with:(index - 1)]. |
|
11971 selectionInListView doubleClickAction:[:index | jListPeer perform:#'handleAction(I)V' with:(index - 1)]. |
|
11972 selectionInListView model:(SelectionInList new list:(List new)). |
|
11973 selectionInListView useIndex:true. |
|
11974 |
|
11975 self createdWindowsView:selectionInListView for:jListPeer. |
|
11976 |
|
11977 WindowCreationTrace == true ifTrue:[ |
|
11978 'WTextAreaPeer_create: ' print. frame print. ' -> ' print. selectionInListView printNL. |
|
11979 ]. |
|
11980 |
|
11981 "Created: / 24.1.1998 / 19:58:54 / cg" |
|
11982 "Modified: / 9.4.1998 / 22:19:07 / cg" |
|
11983 ! |
|
11984 |
|
11985 _WListPeer_delItems:nativeContext |
|
11986 |jString index1 index2 selListView model list| |
|
11987 |
|
11988 selListView := self viewForWPeer:nativeContext. |
|
11989 |
|
11990 index1 := (nativeContext argAt:1) + 1. "/ java indices are 0-based. |
|
11991 index2 := (nativeContext argAt:2) + 1. "/ st indices are 1-based. |
|
11992 |
|
11993 model := selListView model. |
|
11994 model isNil ifTrue:[^ self]. |
|
11995 list := model list. |
|
11996 list size >= index1 ifTrue:[ |
|
11997 list removeFromIndex:index1 toIndex:(index2 min:list size). |
|
11998 model changed:#list. |
|
11999 ]. |
|
12000 |
|
12001 "Created: / 9.4.1998 / 22:19:25 / cg" |
|
12002 "Modified: / 30.12.1998 / 20:00:50 / cg" |
|
12003 ! |
|
12004 |
|
12005 _WListPeer_deselect:nativeContext |
|
12006 "/ void deselect (int) |
|
12007 UnimplementedNativeMethodSignal raise |
|
12008 |
|
12009 "Created: / 12.11.1998 / 19:15:10 / cg" |
|
12010 ! |
|
12011 |
|
12012 _WListPeer_getMaxWidth:nativeContext |
|
12013 "/ int getMaxWidth () |
|
12014 |
|
12015 ^ 1000 "/ a dummy value |
|
12016 |
|
12017 "/ UnimplementedNativeMethodSignal raise |
|
12018 |
|
12019 "Created: / 14.11.1998 / 10:44:29 / cg" |
|
12020 ! |
|
12021 |
|
12022 _WListPeer_isSelected:nativeContext |
|
12023 |selectionInListView index model| |
|
12024 |
|
12025 selectionInListView := self viewForWPeer:nativeContext. |
|
12026 |
|
12027 index := nativeContext argAt:1. |
|
12028 (model := selectionInListView model) notNil ifTrue:[ |
|
12029 (model selectionIndex == (index + 1)) "/ JAVA indexing starts at 0 |
|
12030 ifTrue:[ |
|
12031 ^ 1 |
|
12032 ] |
|
12033 ]. |
|
12034 ^ 0. |
|
12035 |
|
12036 "Created: / 24.1.1998 / 22:42:31 / cg" |
|
12037 "Modified: / 25.1.1998 / 01:35:32 / cg" |
|
12038 ! |
|
12039 |
|
12040 _WListPeer_makeVisible:nativeContext |
|
12041 |selectionInListView lineNr| |
|
12042 |
|
12043 selectionInListView := self viewForWPeer:nativeContext. |
|
12044 |
|
12045 lineNr := nativeContext argAt:1. |
|
12046 |
|
12047 selectionInListView makeLineVisible:(lineNr + 1) |
|
12048 |
|
12049 "Modified: / 24.1.1998 / 20:01:06 / cg" |
|
12050 "Created: / 20.10.1998 / 14:14:50 / cg" |
|
12051 ! |
|
12052 |
|
12053 _WListPeer_select:nativeContext |
|
12054 |selectionInListView index model| |
|
12055 |
|
12056 selectionInListView := self viewForWPeer:nativeContext. |
|
12057 |
|
12058 index := nativeContext argAt:1. |
|
12059 (model := selectionInListView model) notNil ifTrue:[ |
|
12060 model selectionIndex:(index + 1). "/ JAVA indexing starts at 0 |
|
12061 ] |
|
12062 |
|
12063 "Created: / 24.1.1998 / 22:32:35 / cg" |
|
12064 "Modified: / 25.1.1998 / 01:28:46 / cg" |
|
12065 ! |
|
12066 |
|
12067 _WListPeer_setMultipleSelections:nativeContext |
|
12068 |selectionInListView onOff| |
|
12069 |
|
12070 selectionInListView := self viewForWPeer:nativeContext. |
|
12071 |
|
12072 onOff := (nativeContext argAt:1) ~~ 0. |
|
12073 |
|
12074 selectionInListView multipleSelectOk:onOff. |
|
12075 |
|
12076 "Modified: / 24.1.1998 / 20:01:06 / cg" |
|
12077 ! |
|
12078 |
|
12079 _WListPeer_updateMaxItemWidth:nativeContext |
|
12080 |selectionInListView lineNr| |
|
12081 |
|
12082 selectionInListView := self viewForWPeer:nativeContext. |
|
12083 |
|
12084 "Created: / 26.10.1998 / 20:09:46 / cg" |
|
12085 ! |
|
12086 |
|
12087 _WMenuBarPeer_addMenu:nativeContext |
|
12088 "/ void addMenu (java.awt.Menu) |
|
12089 UnimplementedNativeMethodSignal raise |
|
12090 |
|
12091 "Created: / 12.11.1998 / 19:14:00 / cg" |
|
12092 ! |
|
12093 |
|
12094 _WMenuBarPeer_create:nativeContext |
|
12095 |jMenuBarPeer jMenuBar jFrame frame menuBar| |
|
12096 |
|
12097 jMenuBarPeer := nativeContext receiver. |
|
12098 jMenuBar := jMenuBarPeer instVarNamed:'target'. |
|
12099 |
|
12100 jFrame := nativeContext argAt:1. |
|
12101 frame := jFrame instVarNamed:'pData'. |
|
12102 |
|
12103 menuBar := MenuPanel in:frame. |
|
12104 menuBar verticalLayout:false. |
|
12105 menuBar realize. |
|
12106 |
|
12107 self createdWindowsView:menuBar for:jMenuBarPeer. |
|
12108 |
|
12109 WindowCreationTrace == true ifTrue:[ |
|
12110 'WMenuBarPeer_create: ' print. frame print. ' -> ' print. menuBar printNL. |
|
12111 ]. |
|
12112 |
|
12113 "Created: / 7.1.1998 / 21:38:31 / cg" |
|
12114 "Modified: / 25.1.1998 / 13:19:03 / cg" |
|
12115 ! |
|
12116 |
|
12117 _WMenuBarPeer_delMenu:nativeContext |
|
12118 "/ void delMenu (int) |
|
12119 UnimplementedNativeMethodSignal raise |
|
12120 |
|
12121 "Created: / 12.11.1998 / 19:14:11 / cg" |
|
12122 ! |
|
12123 |
|
12124 _WMenuItemPeer__dispose:nativeContext |
|
12125 |jMenuItemPeer item| |
|
12126 |
|
12127 jMenuItemPeer := nativeContext receiver. |
|
12128 item := jMenuItemPeer instVarNamed:'pData'. |
|
12129 |
|
12130 "/ what should be done here ? |
|
12131 |
|
12132 "Created: / 29.3.1998 / 17:16:05 / cg" |
|
12133 "Modified: / 29.3.1998 / 17:16:35 / cg" |
|
12134 ! |
|
12135 |
|
12136 _WMenuItemPeer__setLabel:nativeContext |
|
12137 "/ void _setLabel (java.lang.String) |
|
12138 |
|
12139 |jMenuItemPeer item label| |
|
12140 |
|
12141 jMenuItemPeer := nativeContext receiver. |
|
12142 item := jMenuItemPeer instVarNamed:'pData'. |
|
12143 (item isNil or:[item == 0]) ifTrue:[ |
|
12144 'JAVA [warning]: NULL menu item in setLabel' infoPrintCR. |
|
12145 ^ self |
|
12146 ]. |
|
12147 |
|
12148 label := nativeContext argAt:1. |
|
12149 label isNil ifTrue:[ |
|
12150 label := '' |
|
12151 ] ifFalse:[ |
|
12152 label := Java as_ST_String:label |
|
12153 ]. |
|
12154 item label:label. |
|
12155 |
|
12156 "Modified: / 11.12.1998 / 16:40:18 / cg" |
|
12157 ! |
|
12158 |
|
12159 _WMenuItemPeer_create:nativeContext |
|
12160 |jMenuItemPeer jMenuItem jMenuPeer menu item lbl| |
|
12161 |
|
12162 jMenuItemPeer := nativeContext receiver. |
|
12163 jMenuItem := jMenuItemPeer instVarNamed:'target'. |
|
12164 |
|
12165 jMenuPeer := nativeContext argAt:1. |
|
12166 menu := jMenuPeer instVarNamed:'pData'. |
|
12167 (menu isNil or:[menu == 0]) ifTrue:[ |
|
12168 'JAVA: no menu to create item in' infoPrintCR. |
|
12169 ^ self |
|
12170 ]. |
|
12171 item := menu createAtIndex:nil. |
|
12172 item value:[ |
|
12173 jMenuItemPeer perform:#'handleAction(I)V' with:0 |
|
12174 ]. |
|
12175 |
|
12176 lbl := jMenuItem instVarNamed:'label'. |
|
12177 lbl notNil ifTrue:[ |
|
12178 lbl := Java as_ST_String:lbl. |
|
12179 item label:lbl |
|
12180 ]. |
|
12181 |
|
12182 jMenuItemPeer instVarNamed:'pData' put:item. |
|
12183 |
|
12184 WindowOPTrace == true ifTrue:[ |
|
12185 'WMenuItem_create: ' print. menu print. ' -> ' print. item printNL. |
|
12186 ]. |
|
12187 |
|
12188 "Created: / 7.1.1998 / 21:40:44 / cg" |
|
12189 "Modified: / 3.12.1998 / 20:43:20 / cg" |
|
12190 ! |
|
12191 |
|
12192 _WMenuItemPeer_enable:nativeContext |
|
12193 |jMenuItemPeer item state| |
|
12194 |
|
12195 jMenuItemPeer := nativeContext receiver. |
|
12196 item := jMenuItemPeer instVarNamed:'pData'. |
|
12197 (item isNil or:[item == 0]) ifTrue:[ |
|
12198 'JAVA [warning]: NULL menu item in enable' infoPrintCR. |
|
12199 ^ self |
|
12200 ]. |
|
12201 |
|
12202 state := nativeContext argAt:1. |
|
12203 item enabled:(state ~~ 0) |
|
12204 |
|
12205 "Created: / 7.1.1998 / 22:41:38 / cg" |
|
12206 "Modified: / 11.12.1998 / 16:40:26 / cg" |
|
12207 ! |
|
12208 |
|
12209 _WMenuPeer_addSeparator:nativeContext |
|
12210 "/ void addSeparator () |
|
12211 UnimplementedNativeMethodSignal raise |
|
12212 |
|
12213 "Created: / 12.11.1998 / 19:13:14 / cg" |
|
12214 ! |
|
12215 |
|
12216 _WMenuPeer_createMenu:nativeContext |
|
12217 |jMenuPeer jMenu jMenuBarPeer menuPanel menu |
|
12218 lbl item| |
|
12219 |
|
12220 jMenuPeer := nativeContext receiver. |
|
12221 jMenu := jMenuPeer instVarNamed:'target'. |
|
12222 |
|
12223 jMenuBarPeer := nativeContext argAt:1. |
|
12224 menuPanel := jMenuBarPeer instVarNamed:'pData'. |
|
12225 |
|
12226 item := menuPanel createAtIndex:nil. |
|
12227 lbl := jMenu instVarNamed:'label'. |
|
12228 lbl notNil ifTrue:[ |
|
12229 lbl := Java as_ST_String:lbl. |
|
12230 item label:lbl |
|
12231 ]. |
|
12232 |
|
12233 menu := MenuPanel new. |
|
12234 item submenu:menu. |
|
12235 |
|
12236 jMenuPeer instVarNamed:'pData' put:menu. |
|
12237 |
|
12238 'createMenuPeer: ' print. menuPanel print. ' -> ' print. menu printNL. |
|
12239 |
|
12240 "Created: / 7.1.1998 / 21:39:50 / cg" |
|
12241 "Modified: / 13.1.1998 / 22:11:09 / cg" |
|
12242 ! |
|
12243 |
|
12244 _WMenuPeer_createSubMenu:nativeContext |
|
12245 "/ void createSubMenu (sun.awt.windows.WMenuPeer) |
|
12246 "/ UnimplementedNativeMethodSignal raise |
|
12247 |
|
12248 "Created: / 12.11.1998 / 19:13:43 / cg" |
|
12249 "Modified: / 3.12.1998 / 21:41:07 / cg" |
|
12250 ! |
|
12251 |
|
12252 _WMenuPeer_delItem:nativeContext |
|
12253 "/ void delItem (int) |
|
12254 |jMenuPeer jMenu menuPanel itemIndex| |
|
12255 |
|
12256 jMenuPeer := nativeContext receiver. |
|
12257 menuPanel := jMenuPeer instVarNamed:'pData'. |
|
12258 |
|
12259 itemIndex := nativeContext argAt:1. |
|
12260 menuPanel remove:itemIndex. |
|
12261 |
|
12262 "/ UnimplementedNativeMethodSignal raise |
|
12263 |
|
12264 "Created: / 12.11.1998 / 19:13:30 / cg" |
|
12265 "Modified: / 10.12.1998 / 21:12:29 / cg" |
|
12266 ! |
|
12267 |
|
12268 _WPanelPeer_calculateInsets:nativeContext |
|
12269 "/ new with jdk1.2 ... |
|
12270 |
|
12271 "Created: / 27.1.1998 / 21:40:00 / cg" |
|
12272 ! |
|
12273 |
|
12274 _WPopupMenuPeer__show:nativeContext |
|
12275 "/ void _show (java.awt.Event) |
|
12276 UnimplementedNativeMethodSignal raise |
|
12277 |
|
12278 "Created: / 12.11.1998 / 19:12:53 / cg" |
|
12279 ! |
|
12280 |
|
12281 _WPopupMenuPeer_createMenu:nativeContext |
|
12282 "/ void createMenu (sun.awt.windows.WComponentPeer) |
|
12283 UnimplementedNativeMethodSignal raise |
|
12284 |
|
12285 "Created: / 12.11.1998 / 19:12:43 / cg" |
|
12286 ! |
|
12287 |
|
12288 _WPrintJob_end:nativeContext |
|
12289 "/ void end () |
|
12290 UnimplementedNativeMethodSignal raise |
|
12291 |
|
12292 "Created: / 12.11.1998 / 19:11:28 / cg" |
|
12293 ! |
|
12294 |
|
12295 _WScrollPanePeer__getHScrollbarHeight:nativeContext |
|
12296 |scrollPane| |
|
12297 |
|
12298 scrollPane := self viewForWPeer:nativeContext. |
|
12299 ^ HorizontalScrollBar new preferredExtent y. |
|
12300 |
|
12301 "Created: / 9.4.1998 / 17:30:56 / cg" |
|
12302 "Modified: / 10.4.1998 / 14:59:28 / cg" |
|
12303 ! |
|
12304 |
|
12305 _WScrollPanePeer__getVScrollbarWidth:nativeContext |
|
12306 |scrollPane| |
|
12307 |
|
12308 scrollPane := self viewForWPeer:nativeContext. |
|
12309 ^ ScrollBar new preferredExtent x. |
|
12310 |
|
12311 "Created: / 9.4.1998 / 17:29:48 / cg" |
|
12312 "Modified: / 10.4.1998 / 15:00:33 / cg" |
|
12313 ! |
|
12314 |
|
12315 _WScrollPanePeer_create:nativeContext |
|
12316 |jScrollPanePeer jScrollPane jFrame frame scrollPane |
|
12317 lbl| |
|
12318 |
|
12319 jScrollPanePeer := nativeContext receiver. |
|
12320 jScrollPane := jScrollPanePeer instVarNamed:'target'. |
|
12321 |
|
12322 jFrame := nativeContext argAt:1. |
|
12323 frame := jFrame instVarNamed:'pData'. |
|
12324 |
|
12325 "/ create with a simple view ... |
|
12326 scrollPane := ScrollableView for:JavaView in:frame. |
|
12327 |
|
12328 self createdWindowsView:scrollPane for:jScrollPanePeer. |
|
12329 |
|
12330 WindowCreationTrace == true ifTrue:[ |
|
12331 'WScrollPanePeer_create: ' print. frame print. ' -> ' print. scrollPane printNL. |
|
12332 ]. |
|
12333 |
|
12334 "Created: / 9.4.1998 / 17:25:08 / cg" |
|
12335 "Modified: / 9.4.1998 / 22:06:09 / cg" |
|
12336 ! |
|
12337 |
|
12338 _WScrollPanePeer_getOffset:nativeContext |
|
12339 "/ int getOffset (int) |
|
12340 UnimplementedNativeMethodSignal raise |
|
12341 |
|
12342 "Created: / 12.11.1998 / 19:16:29 / cg" |
|
12343 ! |
|
12344 |
|
12345 _WScrollPanePeer_getScrollChild:nativeContext |
|
12346 "/ java.awt.Component getScrollChild () |
|
12347 UnimplementedNativeMethodSignal raise |
|
12348 |
|
12349 "Created: / 12.11.1998 / 19:17:00 / cg" |
|
12350 ! |
|
12351 |
|
12352 _WScrollPanePeer_setInsets:nativeContext |
|
12353 |
|
12354 "Modified: / 9.4.1998 / 17:26:11 / cg" |
|
12355 "Created: / 9.4.1998 / 17:29:10 / cg" |
|
12356 ! |
|
12357 |
|
12358 _WScrollPanePeer_setScrollPosition:nativeContext |
|
12359 "/ void setScrollPosition (int int) |
|
12360 UnimplementedNativeMethodSignal raise |
|
12361 |
|
12362 "Created: / 12.11.1998 / 19:16:44 / cg" |
|
12363 ! |
|
12364 |
|
12365 _WScrollPanePeer_setSpans:nativeContext |
|
12366 |
|
12367 "Created: / 9.4.1998 / 17:31:44 / cg" |
|
12368 ! |
|
12369 |
|
12370 _WScrollbarPeer__setValues:nativeContext |
|
12371 |scrollBar value visibleAmount min max| |
|
12372 |
|
12373 scrollBar := self viewForWPeer:nativeContext. |
|
12374 |
|
12375 value := nativeContext argAt:1. |
|
12376 visibleAmount := nativeContext argAt:2. |
|
12377 min := nativeContext argAt:3. |
|
12378 max := nativeContext argAt:4. |
|
12379 |
|
12380 (min ~~ 0 or:[max ~~ 100]) ifTrue:[ |
|
12381 scrollBar thumb start:min stop:max. |
|
12382 ]. |
|
12383 |
|
12384 scrollBar thumbOrigin:value thumbHeight:visibleAmount. |
|
12385 |
|
12386 "Created: / 13.1.1998 / 22:13:57 / cg" |
|
12387 "Modified: / 14.10.1998 / 14:53:00 / cg" |
|
12388 ! |
|
12389 |
|
12390 _WScrollbarPeer_create:nativeContext |
|
12391 |jScrollbarPeer jScrollbar jFrame frame scrollBar |
|
12392 min max| |
|
12393 |
|
12394 jScrollbarPeer := nativeContext receiver. |
|
12395 jScrollbar := jScrollbarPeer instVarNamed:'target'. |
|
12396 |
|
12397 jFrame := nativeContext argAt:1. |
|
12398 frame := jFrame instVarNamed:'pData'. |
|
12399 |
|
12400 (jScrollbar instVarNamed:'orientation') == 0 "HORIZONTAL" ifTrue:[ |
|
12401 scrollBar := HorizontalScrollBar in:frame. |
|
12402 ] ifFalse:[ |
|
12403 scrollBar := ScrollBar in:frame. |
|
12404 ]. |
|
12405 min := jScrollbar instVarNamed:'minimum'. |
|
12406 max := jScrollbar instVarNamed:'maximum'. |
|
12407 |
|
12408 scrollBar scrollDownAction:[ |
|
12409 scrollBar thumbOrigin:(scrollBar thumbOrigin + ((max-min)/10) min:max). |
|
12410 jScrollbarPeer perform:#'dragAbsolute(I)V' with:scrollBar thumbOrigin rounded. |
|
12411 ]. |
|
12412 scrollBar scrollUpAction:[ |
|
12413 scrollBar thumbOrigin:(scrollBar thumbOrigin - ((max-min)/10) max:min). |
|
12414 jScrollbarPeer perform:#'dragAbsolute(I)V' with:scrollBar thumbOrigin rounded. |
|
12415 ]. |
|
12416 scrollBar scrollAction:[:org | |
|
12417 jScrollbarPeer perform:#'dragAbsolute(I)V' with:org rounded. |
|
12418 ]. |
|
12419 self createdWindowsView:scrollBar for:jScrollbarPeer. |
|
12420 |
|
12421 WindowCreationTrace == true ifTrue:[ |
|
12422 'WScrollbarPeer_create: ' print. frame print. ' -> ' print. scrollBar printNL. |
|
12423 ]. |
|
12424 |
|
12425 "Created: / 5.1.1998 / 01:53:30 / cg" |
|
12426 "Modified: / 14.10.1998 / 15:36:19 / cg" |
|
12427 ! |
|
12428 |
|
12429 _WScrollbarPeer_setLineIncrement:nativeContext |
|
12430 |scrollBar inc| |
|
12431 |
|
12432 Transcript showCR:'JavaVM: WScrollbarPeer_setLineIncrement unimplemented'. |
|
12433 |
|
12434 scrollBar := self viewForWPeer:nativeContext. |
|
12435 |
|
12436 inc := nativeContext argAt:1. |
|
12437 "/ scrollBar thumb lineIncrement:inc. |
|
12438 |
|
12439 "Created: / 25.1.1998 / 11:52:19 / cg" |
|
12440 "Modified: / 14.10.1998 / 14:53:56 / cg" |
|
12441 ! |
|
12442 |
|
12443 _WScrollbarPeer_setPageIncrement:nativeContext |
|
12444 |scrollBar inc| |
|
12445 |
|
12446 Transcript showCR:'JavaVM: WScrollbarPeer_setPageIncrement unimplemented'. |
|
12447 |
|
12448 scrollBar := self viewForWPeer:nativeContext. |
|
12449 |
|
12450 inc := nativeContext argAt:1. |
|
12451 "/ scrollBar thumb pageIncrement:inc. |
|
12452 |
|
12453 "Created: / 25.1.1998 / 11:52:01 / cg" |
|
12454 "Modified: / 14.10.1998 / 14:54:04 / cg" |
|
12455 ! |
|
12456 |
|
12457 _WTextAreaPeer_create:nativeContext |
|
12458 |jTextAreaPeer jFrame frame editTextView| |
|
12459 |
|
12460 jTextAreaPeer := nativeContext receiver. |
|
12461 |
|
12462 jFrame := nativeContext argAt:1. |
|
12463 frame := jFrame instVarNamed:'pData'. |
|
12464 |
|
12465 editTextView := HVScrollableView for:EditTextView in:frame. |
|
12466 |
|
12467 self createdWindowsView:editTextView for:jTextAreaPeer. |
|
12468 |
|
12469 WindowCreationTrace == true ifTrue:[ |
|
12470 'WTextAreaPeer_create: ' print. frame print. ' -> ' print. editTextView printNL. |
|
12471 ]. |
|
12472 |
|
12473 "Created: / 7.1.1998 / 21:49:49 / cg" |
|
12474 "Modified: / 15.1.1998 / 12:56:18 / cg" |
|
12475 ! |
|
12476 |
|
12477 _WTextAreaPeer_insertText:nativeContext |
|
12478 |textView pos string jstring| |
|
12479 |
|
12480 textView := self viewForWPeer:nativeContext. |
|
12481 (textView isKindOf:ScrollableView) ifTrue:[ |
|
12482 textView := textView scrolledView |
|
12483 ]. |
|
12484 |
|
12485 jstring := nativeContext argAt:1. |
|
12486 string := Java as_ST_String:jstring. |
|
12487 pos := nativeContext argAt:2. |
|
12488 |
|
12489 textView insert:string at:pos. |
|
12490 textView cursorToCharacterPosition:pos + string size. |
|
12491 textView makeCursorVisible. |
|
12492 "/ textView invalidateRepairNow:true. |
|
12493 ^ nil |
|
12494 |
|
12495 "Created: / 7.1.1998 / 21:50:23 / cg" |
|
12496 "Modified: / 5.4.1998 / 17:37:24 / cg" |
|
12497 ! |
|
12498 |
|
12499 _WTextAreaPeer_replaceText:nativeContext |
|
12500 "/ void replaceText (java.lang.String int int) |
|
12501 UnimplementedNativeMethodSignal raise |
|
12502 |
|
12503 "Created: / 12.11.1998 / 19:11:14 / cg" |
|
12504 ! |
|
12505 |
|
12506 _WTextComponentPeer_enableEditing:nativeContext |
|
12507 |textView enabled| |
|
12508 |
|
12509 textView := self viewForWPeer:nativeContext. |
|
12510 enabled := (nativeContext argAt:1) ~~ 0. |
|
12511 |
|
12512 ^ textView readOnly:enabled not |
|
12513 |
|
12514 "Created: / 5.1.1998 / 01:29:38 / cg" |
|
12515 "Modified: / 25.1.1998 / 16:29:56 / cg" |
|
12516 ! |
|
12517 |
|
12518 _WTextComponentPeer_getSelectionEnd:nativeContext |
|
12519 |textView| |
|
12520 |
|
12521 textView := self viewForWPeer:nativeContext. |
|
12522 |
|
12523 ^ textView characterPositionOfSelectionEnd |
|
12524 |
|
12525 "Created: / 8.1.1998 / 17:41:56 / cg" |
|
12526 "Modified: / 15.1.1998 / 15:47:18 / cg" |
|
12527 ! |
|
12528 |
|
12529 _WTextComponentPeer_getSelectionStart:nativeContext |
|
12530 |textView| |
|
12531 |
|
12532 textView := self viewForWPeer:nativeContext. |
|
12533 |
|
12534 ^ textView characterPositionOfSelection - 1 |
|
12535 |
|
12536 "Created: / 15.8.1997 / 15:45:45 / cg" |
|
12537 "Modified: / 15.1.1998 / 15:46:51 / cg" |
|
12538 ! |
|
12539 |
|
12540 _WTextComponentPeer_getText:nativeContext |
|
12541 |textView string jString| |
|
12542 |
|
12543 textView := self viewForWPeer:nativeContext. |
|
12544 |
|
12545 string := textView contents asString. |
|
12546 jString := Java as_String:string. |
|
12547 ^ jString |
|
12548 |
|
12549 "Created: / 6.1.1998 / 21:05:15 / cg" |
|
12550 "Modified: / 8.1.1998 / 17:36:52 / cg" |
|
12551 ! |
|
12552 |
|
12553 _WTextComponentPeer_select:nativeContext |
|
12554 |textView selStart selEnd| |
|
12555 |
|
12556 textView := self viewForWPeer:nativeContext. |
|
12557 selStart := nativeContext argAt:1. |
|
12558 selEnd := nativeContext argAt:2. |
|
12559 |
|
12560 selStart == selEnd ifTrue:[ |
|
12561 "/ clear selection |
|
12562 textView unselect. |
|
12563 "/ and set caret |
|
12564 textView cursorToCharacterPosition:selStart + 1 |
|
12565 ] ifFalse:[ |
|
12566 "/ change selection |
|
12567 textView selectFromCharacterPosition:selStart+1 to:selEnd |
|
12568 ]. |
|
12569 |
|
12570 "Created: / 15.8.1997 / 15:45:58 / cg" |
|
12571 "Modified: / 15.1.1998 / 21:55:57 / cg" |
|
12572 ! |
|
12573 |
|
12574 _WTextComponentPeer_setText:nativeContext |
|
12575 |textView string jstring| |
|
12576 |
|
12577 textView := self viewForWPeer:nativeContext. |
|
12578 |
|
12579 jstring := nativeContext argAt:1. |
|
12580 jstring notNil ifTrue:[ |
|
12581 string := Java as_ST_String:jstring |
|
12582 ]. |
|
12583 |
|
12584 textView contents:string. |
|
12585 |
|
12586 "Created: / 5.1.1998 / 01:28:23 / cg" |
|
12587 "Modified: / 11.12.1998 / 12:16:46 / cg" |
|
12588 ! |
|
12589 |
|
12590 _WTextFieldPeer_create:nativeContext |
|
12591 |jTextFieldPeer jFrame frame editField| |
|
12592 |
|
12593 jTextFieldPeer := nativeContext receiver. |
|
12594 |
|
12595 jFrame := nativeContext argAt:1. |
|
12596 frame := jFrame instVarNamed:'pData'. |
|
12597 |
|
12598 editField := EditField in:frame. |
|
12599 |
|
12600 self createdWindowsView:editField for:jTextFieldPeer. |
|
12601 |
|
12602 editField crAction:[ |
|
12603 jTextFieldPeer perform:#handleAction. |
|
12604 ]. |
|
12605 WindowCreationTrace == true ifTrue:[ |
|
12606 'WTextFieldPeer_create: ' print. frame print. ' -> ' print. editField printNL. |
|
12607 ]. |
|
12608 |
|
12609 "Created: / 5.1.1998 / 01:27:37 / cg" |
|
12610 "Modified: / 4.11.1998 / 21:07:30 / cg" |
|
12611 ! |
|
12612 |
|
12613 _WTextFieldPeer_setEchoCharacter:nativeContext |
|
12614 |editField char| |
|
12615 |
|
12616 editField := self viewForWPeer:nativeContext. |
|
12617 |
|
12618 char := nativeContext argAt:1. |
|
12619 editField passwordCharacter:(Character value:char). |
|
12620 |
|
12621 "Created: / 25.1.1998 / 16:28:30 / cg" |
|
12622 ! |
|
12623 |
|
12624 _WToolkit_beep:nativeContext |
|
12625 "/ void beep () |
|
12626 |
|
12627 Screen current beep |
|
12628 |
|
12629 "Created: / 12.11.1998 / 19:09:23 / cg" |
|
12630 "Modified: / 11.12.1998 / 12:15:23 / cg" |
|
12631 ! |
|
12632 |
|
12633 _WToolkit_eventLoop:nativeContext |
|
12634 (JavaEventThread notNil and:[JavaEventThread isDead not]) ifTrue:[ |
|
12635 'JavaVM [warning]: oops - two threads executing eventLoop' errorPrintCR. |
|
12636 ]. |
|
12637 |
|
12638 JavaEventThread := Processor activeProcess. |
|
12639 [ |
|
12640 [true] whileTrue:[ |
|
12641 AbortSignal handle:[:ex | |
|
12642 ex return |
|
12643 ] do:[ |
|
12644 self doWindowsEventThread. |
|
12645 ] |
|
12646 ]. |
|
12647 ] valueNowOrOnUnwindDo:[ |
|
12648 JavaEventThread := nil. |
|
12649 ]. |
|
12650 |
|
12651 "Created: / 6.1.1998 / 21:01:44 / cg" |
|
12652 "Modified: / 8.1.1999 / 17:08:00 / cg" |
|
12653 ! |
|
12654 |
|
12655 _WToolkit_getComboHeightOffset:nativeContext |
|
12656 ^ 0 |
|
12657 |
|
12658 "Modified: / 20.3.1997 / 13:50:04 / cg" |
|
12659 "Created: / 22.10.1998 / 00:59:14 / cg" |
|
12660 ! |
|
12661 |
|
12662 _WToolkit_getScreenHeight:nativeContext |
|
12663 ^ Screen current height |
|
12664 |
|
12665 "Modified: / 20.3.1997 / 13:50:04 / cg" |
|
12666 "Created: / 13.1.1998 / 09:24:45 / cg" |
|
12667 ! |
|
12668 |
|
12669 _WToolkit_getScreenResolution:nativeContext |
|
12670 ^ Screen current resolution x rounded |
|
12671 |
|
12672 "Modified: / 20.3.1997 / 13:50:04 / cg" |
|
12673 "Created: / 17.1.1998 / 21:54:48 / cg" |
|
12674 ! |
|
12675 |
|
12676 _WToolkit_getScreenWidth:nativeContext |
|
12677 ^ Screen current width |
|
12678 |
|
12679 "Modified: / 20.3.1997 / 13:50:04 / cg" |
|
12680 "Created: / 13.1.1998 / 09:24:37 / cg" |
|
12681 ! |
|
12682 |
|
12683 _WToolkit_init:nativeContext |
|
12684 |
|
12685 "Created: / 3.1.1998 / 02:30:57 / cg" |
|
12686 ! |
|
12687 |
|
12688 _WToolkit_loadSystemColors:nativeContext |
|
12689 "/ self halt. |
|
12690 |
|
12691 "Modified: / 18.3.1997 / 18:43:26 / cg" |
|
12692 "Created: / 5.1.1998 / 02:19:09 / cg" |
|
12693 ! |
|
12694 |
|
12695 _WToolkit_makeColorModel:nativeContext |
|
12696 "/ java.awt.image.ColorModel makeColorModel () |
|
12697 UnimplementedNativeMethodSignal raise |
|
12698 |
|
12699 "Created: / 12.11.1998 / 19:08:47 / cg" |
|
12700 ! |
|
12701 |
|
12702 _WToolkit_sync:nativeContext |
|
12703 "/ void sync () |
|
12704 UnimplementedNativeMethodSignal raise |
|
12705 |
|
12706 "Created: / 12.11.1998 / 19:09:14 / cg" |
|
12707 ! |
|
12708 |
|
12709 _WWindowPeer__setResizable:nativeContext |
|
12710 |view onOff| |
|
12711 |
|
12712 view := self viewForWPeer:nativeContext. |
|
12713 |
|
12714 onOff := (nativeContext argAt:1) == 1. |
|
12715 view isTopView ifTrue:[ |
|
12716 onOff ifTrue:[ |
|
12717 view minExtent:10@10. |
|
12718 view maxExtent:(Screen current extent). |
|
12719 ] ifFalse:[ |
|
12720 view minExtent:view extent. |
|
12721 view maxExtent:view extent. |
|
12722 ] |
|
12723 ] ifFalse:[ |
|
12724 (view isMemberOf:JavaEmbeddedFrameView) ifFalse:[ |
|
12725 self halt. |
|
12726 ] |
|
12727 ]. |
|
12728 |
|
12729 "/ 'JAVA: WWindowPeer_setResizable: ' print. view print. ' yes/no: ' print. onOff printNL. |
|
12730 |
|
12731 ^ nil |
|
12732 |
|
12733 "Created: / 5.1.1998 / 00:57:59 / cg" |
|
12734 "Modified: / 16.1.1998 / 18:08:00 / cg" |
|
12735 ! |
|
12736 |
|
12737 _WWindowPeer__setTitle:nativeContext |
|
12738 |view jString string| |
|
12739 |
|
12740 view := self viewForWPeer:nativeContext. |
|
12741 |
|
12742 jString := nativeContext argAt:1. |
|
12743 string := Java as_ST_String:jString. |
|
12744 |
|
12745 "/ 'JAVA: WWindowPeer_pSetTitle: ' print. string print. ' ' print. view printNL. |
|
12746 |
|
12747 view label:string. |
|
12748 ^ nil |
|
12749 |
|
12750 "Created: / 5.1.1998 / 00:57:17 / cg" |
|
12751 "Modified: / 8.1.1998 / 17:37:41 / cg" |
|
12752 ! |
|
12753 |
|
12754 _WWindowPeer_create:nativeContext |
|
12755 "/ void create (sun.awt.windows.WComponentPeer) |
|
12756 |jWindowPeer jWindow top window pDataIdx| |
|
12757 |
|
12758 jWindowPeer := nativeContext receiver. |
|
12759 |
|
12760 jWindow := jWindowPeer instVarNamed:'target'. |
|
12761 window := jWindowPeer instVarNamed:'pData'. |
|
12762 |
|
12763 (window notNil and:[window ~~ 0]) ifTrue:[ |
|
12764 WindowCreationTrace == true ifTrue:[ |
|
12765 'JAVA: window view already created: ' infoPrint. |
|
12766 jWindowPeer class name infoPrintCR. |
|
12767 ]. |
|
12768 ] ifFalse:[ |
|
12769 "/ OLD |
|
12770 "/ window := StandardSystemView new. |
|
12771 "/ self createdWindowsView:window for:jWindowPeer. |
|
12772 "/ JavaWindowGroup addTopView:window. |
|
12773 |
|
12774 window := JavaPopUpView new. |
|
12775 window borderWidth:0. |
|
12776 window level:0. |
|
12777 window delegate:self. |
|
12778 window javaPeer:jWindowPeer. |
|
12779 self createdWindowsView:window for:jWindowPeer. |
|
12780 JavaWindowGroup addTopView:window. |
|
12781 |
|
12782 "/ top := StandardSystemView new. |
|
12783 "/ window := JavaView origin:0.0@0.0 corner:1.0@1.0 in:top. |
|
12784 "/ window delegate:self. |
|
12785 "/ window javaPeer:jWindowPeer. |
|
12786 "/ self createdWindowsView:window for:jWindowPeer. |
|
12787 "/ JavaWindowGroup addTopView:top. |
|
12788 |
|
12789 ]. |
|
12790 |
|
12791 WindowCreationTrace == true ifTrue:[ |
|
12792 'JAVA: WWindowPeer_create: ' print. jWindowPeer displayString print. |
|
12793 ' window: ' print. window printNL. |
|
12794 ]. |
|
12795 |
|
12796 "Created: / 4.1.1998 / 17:56:39 / cg" |
|
12797 "Modified: / 4.12.1998 / 17:37:59 / cg" |
|
12798 ! |
|
12799 |
|
12800 _WWindowPeer_getContainerElement:nativeContext |
|
12801 "/ java.awt.Component getContainerElement (java.awt.Container int) |
|
12802 UnimplementedNativeMethodSignal raise |
|
12803 |
|
12804 "Created: / 12.11.1998 / 19:10:54 / cg" |
|
12805 ! |
|
12806 |
|
12807 _WWindowPeer_toBack:nativeContext |
|
12808 |view| |
|
12809 |
|
12810 view := self viewForWPeer:nativeContext. |
|
12811 view lower. |
|
12812 |
|
12813 "Created: / 7.5.1998 / 00:23:03 / cg" |
|
12814 ! |
|
12815 |
|
12816 _WWindowPeer_toFront:nativeContext |
|
12817 |view| |
|
12818 |
|
12819 view := self viewForWPeer:nativeContext. |
|
12820 view raise. |
|
12821 |
|
12822 "Created: / 9.4.1998 / 22:17:28 / cg" |
|
12823 ! |
|
12824 |
|
12825 _WWindowPeer_updateInsets:nativeContext |
|
12826 "/ self halt. |
|
12827 |
|
12828 "Modified: / 18.3.1997 / 18:43:18 / cg" |
|
12829 "Created: / 4.1.1998 / 18:09:04 / cg" |
|
12830 ! |
|
12831 |
|
12832 _Win32Process_create:nativeContext |
|
12833 "really create a win32 process" |
|
12834 |
|
12835 |env cmd jProcess p inPipe outPipe errorPipe| |
|
12836 |
|
12837 jProcess := nativeContext receiver. |
|
12838 cmd := nativeContext argAt:1. |
|
12839 cmd := Java as_ST_String:cmd. |
|
12840 |
|
12841 env := nativeContext argAt:2. |
|
12842 env notNil ifTrue:[ |
|
12843 self halt |
|
12844 ]. |
|
12845 self halt. |
|
12846 |
|
12847 p := Win32Process new. |
|
12848 p command:cmd. |
|
12849 p environment:env. |
|
12850 p inStream:inPipe. |
|
12851 p outStream:outPipe. |
|
12852 p errorStream:errorPipe. |
|
12853 p directory:nil. |
|
12854 p startProcess. |
|
12855 self halt. |
|
12856 |
|
12857 jProcess instVarNamed:'handle' put:p. |
|
12858 |
|
12859 "Created: / 10.11.1998 / 19:50:31 / cg" |
|
12860 "Modified: / 10.11.1998 / 21:34:18 / cg" |
|
12861 ! |
|
12862 |
|
12863 _WinNTFileSystem_canonicalize0:aJavaContext |
|
12864 |
|
12865 | path | |
|
12866 |
|
12867 path := Java as_ST_String: (aJavaContext argAt: 1). |
|
12868 ^(Java as_String: path asFilename asAbsoluteFilename pathName) |
|
12869 |
|
12870 "Created: / 01-04-2011 / 23:00:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12871 ! |
|
12872 |
|
12873 _WinNTFileSystem_getBooleanAttributes:aJavaContext |
|
12874 |
|
12875 ^ self _UnixFileSystem_getBooleanAttributes0:aJavaContext |
|
12876 |
|
12877 "Created: / 01-04-2011 / 18:10:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12878 ! |
|
12879 |
|
12880 _X11FontMetrics_getMFCharSegmentWidth:nativeContext |
|
12881 "get multi-font string-segment width. |
|
12882 Not yet supported - use standard strings width" |
|
12883 |
|
12884 |jMetrics jFont jFontDescr stFont w |
|
12885 bool1 cp offs lenght bp int1| |
|
12886 |
|
12887 jMetrics := nativeContext receiver. |
|
12888 jFont := nativeContext argAt:1. |
|
12889 jFontDescr := nativeContext argAt:2. |
|
12890 cp := nativeContext argAt:3. |
|
12891 lenght := nativeContext argAt:4. |
|
12892 |
|
12893 stFont := jFont instVarNamed:'pData'. |
|
12894 (stFont isNil or:[stFont == 0]) ifTrue:[ |
|
12895 self halt |
|
12896 ]. |
|
12897 |
|
12898 stFont device isNil ifTrue:[ |
|
12899 stFont := stFont on:Display. |
|
12900 jFont instVarNamed:'pData' put:stFont. |
|
12901 ]. |
|
12902 w := stFont widthOf:cp from:1 to:lenght. |
|
12903 ^ w. |
|
12904 ! |
|
12905 |
|
12906 _X11FontMetrics_init:nativeContext |
|
12907 ^ self _WFontMetrics_init:nativeContext |
|
12908 ! |
|
12909 |
|
12910 _X11GraphicsDevice_getConfigType:nativeContext |
|
12911 "/ new with jdk1.2 ... |
|
12912 |
|
12913 |configNr cls| |
|
12914 |
|
12915 "/ for now, only one config. |
|
12916 configNr := nativeContext argAt:1. |
|
12917 |
|
12918 cls := Java classNamed:'java.awt.GraphicsDevice'. |
|
12919 ^ cls instVarNamed:'TYPE_RASTER_SCREEN'. |
|
12920 |
|
12921 "Created: / 28.1.1998 / 22:19:05 / cg" |
|
12922 ! |
|
12923 |
|
12924 _X11GraphicsDevice_getNumConfigs:nativeContext |
|
12925 "/ new with jdk1.2 ... |
|
12926 |
|
12927 ^ 1 |
|
12928 |
|
12929 "Created: / 28.1.1998 / 22:13:26 / cg" |
|
12930 "Modified: / 28.1.1998 / 22:14:33 / cg" |
|
12931 ! |
|
12932 |
|
12933 _X11GraphicsEnvironment_getNumScreens:nativeContext |
|
12934 "/ new with jdk1.2 ... |
|
12935 |
|
12936 "/ could return the actual number of screens ... |
|
12937 |
|
12938 ^ 1 |
|
12939 |
|
12940 "Created: / 28.1.1998 / 01:50:22 / cg" |
|
12941 "Modified: / 28.1.1998 / 22:12:32 / cg" |
|
12942 ! |
|
12943 |
|
12944 _X11GraphicsEnvironment_initDisplay:nativeContext |
|
12945 "/ new with jdk1.2 ... |
|
12946 |
|
12947 "Created: / 28.1.1998 / 01:50:22 / cg" |
|
12948 ! |
|
12949 |
|
12950 _X11Graphics_changeClip:nativeContext |
|
12951 ^ self _WGraphics_changeClip:nativeContext |
|
12952 ! |
|
12953 |
|
12954 _X11Graphics_createFromComponent:nativeContext |
|
12955 ^ self _WGraphics_createFromComponent:nativeContext |
|
12956 ! |
|
12957 |
|
12958 _X11Graphics_disposeImpl:nativeContext |
|
12959 ^ self _WGraphics_dispose:nativeContext |
|
12960 ! |
|
12961 |
|
12962 _X11Graphics_drawMFCharsSegment:nativeContext |
|
12963 ^ self _WGraphics_drawMFCharsSegment:nativeContext |
|
12964 ! |
|
12965 |
|
12966 _X11Graphics_drawRect:nativeContext |
|
12967 ^ self _WGraphics_drawRect:nativeContext |
|
12968 ! |
|
12969 |
|
12970 _X11Graphics_fillOval:nativeContext |
|
12971 ^ self _WGraphics_fillOval:nativeContext |
|
12972 ! |
|
12973 |
|
12974 _X11Graphics_fillRect:nativeContext |
|
12975 ^ self _WGraphics_fillRect:nativeContext |
|
12976 ! |
|
12977 |
|
12978 _X11Graphics_pSetFont:nativeContext |
|
12979 ^ self _WGraphics_pSetFont:nativeContext |
|
12980 ! |
|
12981 |
|
12982 _X11Graphics_pSetForeground:nativeContext |
|
12983 ^ self _WGraphics_pSetForeground:nativeContext |
|
12984 ! ! |
|
12985 |
|
12986 !JavaVM class methodsFor:'native - old-style (converted)'! |
|
12987 |
|
12988 _AccessController_doPrivileged:aJavaContext |
|
12989 |
|
12990 "Don't care about permissions :-)" |
|
12991 |
|
12992 ^(aJavaContext argAt:1) perform: #'run()Ljava/lang/Object;' |
|
12993 |
|
12994 "Created: / 20-10-2010 / 12:31:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
12995 ! |
|
12996 |
|
12997 _AccessController_getStackAccessControlContext:nativeContext |
|
12998 "/ introduced with jdk1.2 |
|
12999 |
|
13000 "/ supposed to do more here ... |
|
13001 |
|
13002 ^ nil |
|
13003 |
|
13004 "Created: / 27.1.1998 / 18:22:15 / cg" |
|
13005 ! |
|
13006 |
|
13007 _Array_newArray:aJavaContext |
|
13008 |componentClass size| |
|
13009 |
|
13010 componentClass := self reflection |
|
13011 classForJavaClassObject:(aJavaContext argAt:1). |
|
13012 size := aJavaContext argAt:2. |
|
13013 ^ componentClass arrayClass new:size |
|
13014 |
|
13015 "Created: / 17-12-2010 / 14:49:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13016 "Modified: / 19-12-2010 / 17:54:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13017 "Modified: / 28-01-2011 / 15:18:50 / Marcel Hlopko <hlopik@gmail.com>" |
|
13018 ! |
|
13019 |
|
13020 _ClassLoader_NativeLibrary_load:nativeContext |
|
13021 "/ introduced with jdk1.2 ... (sigh) |
|
13022 |
|
13023 |nativeLoader jLibName libName libHandle index| |
|
13024 |
|
13025 nativeLoader := nativeContext receiver. |
|
13026 jLibName := nativeContext argAt:1. |
|
13027 libName := (Java as_ST_String:jLibName) asFilename baseName. |
|
13028 |
|
13029 (index := SimulatedNativeLibs indexOf:libName) ~~ 0 ifTrue:[ |
|
13030 "/ ('JAVA: builtIn nativeLibLoad simulated: ' , libName) printNL. |
|
13031 nativeLoader instVarNamed:'handle' put:index. |
|
13032 ^ self "/ void |
|
13033 ]. |
|
13034 (LoadedNativeLibs notNil |
|
13035 and:[LoadedNativeLibs includesKey:libName]) ifTrue:[ |
|
13036 "/ ('JAVA: native library already loaded: ' , libName) printNL. |
|
13037 nativeLoader instVarNamed:'handle' put:(LoadedNativeLibs at:libName). |
|
13038 ^ self "/ void |
|
13039 ]. |
|
13040 |
|
13041 (self confirm:'permission to load native library: ' , libName , ' ?') ifFalse:[ |
|
13042 ^ self |
|
13043 ]. |
|
13044 self halt. |
|
13045 |
|
13046 libName asFilename exists ifFalse:[ |
|
13047 ('JAVA: no file to load nativeLib: ' , libName) printNL. |
|
13048 ^ self "/ void |
|
13049 ]. |
|
13050 |
|
13051 libHandle := ObjectFileLoader loadLibrary:libName. |
|
13052 libHandle isNil ifTrue:[ |
|
13053 ('JAVA: failed to load nativeLib: ' , libName) printNL. |
|
13054 ^ self "/ void |
|
13055 ]. |
|
13056 |
|
13057 LoadedNativeLibs isNil ifTrue:[ |
|
13058 LoadedNativeLibs := Dictionary new. |
|
13059 ]. |
|
13060 |
|
13061 LoadedNativeLibs at:libName put:libHandle. |
|
13062 nativeLoader instVarNamed:'handle' put:(LoadedNativeLibs at:libName). |
|
13063 ^ self "/ void |
|
13064 |
|
13065 "Modified: / 06-02-1998 / 03:12:17 / cg" |
|
13066 "Created: / 10-12-2010 / 15:11:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13067 ! |
|
13068 |
|
13069 _ClassLoader_registerNatives:aJavaContext |
|
13070 |
|
13071 "Nothing to do" |
|
13072 |
|
13073 "Created: / 09-11-2010 / 20:55:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13074 ! |
|
13075 |
|
13076 _Class_desiredAssertionStatus0:aJavaContext |
|
13077 |
|
13078 ^AssertionsEnabled == true |
|
13079 |
|
13080 "Created: / 24-11-2010 / 08:58:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13081 ! |
|
13082 |
|
13083 _Class_forName0:aJavaContext |
|
13084 |
|
13085 | name initialize loader class | |
|
13086 name := Java as_ST_String: (aJavaContext argAt: 1). |
|
13087 initialize := aJavaContext argAt: 2. |
|
13088 loader := aJavaContext argAt: 3. |
|
13089 JavaClassReader classLoaderQuerySignal answer: loader do: |
|
13090 [class := Java classForName: name]. |
|
13091 class isNil ifTrue: |
|
13092 [^self throwClassNotFoundException: name]. |
|
13093 initialize ifTrue: |
|
13094 [[class classInit] on: Error do:[self throwExceptionInInitializerError:name]]. |
|
13095 ^JavaVM javaClassObjectForClass: class. |
|
13096 |
|
13097 "Created: / 24-11-2010 / 09:03:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13098 ! |
|
13099 |
|
13100 _Class_getClassLoader0:aJavaContext |
|
13101 "get a classes loader" |
|
13102 |
|
13103 |jClass cls loader| |
|
13104 |
|
13105 jClass := aJavaContext receiver. |
|
13106 cls := self reflection classForJavaClassObject:jClass. |
|
13107 loader := cls classLoader. |
|
13108 cls isNil ifTrue:[ |
|
13109 loader := (Java classForName:'java/lang/ClassLoader') |
|
13110 perform:#'getSystemClassLoader()Ljava/lang/ClassLoader;'. |
|
13111 |
|
13112 "/ ('JAVA: getClassLoader - ' , loader printString) infoPrintCR. |
|
13113 ]. |
|
13114 ^ loader |
|
13115 |
|
13116 "Created: / 25-10-2010 / 22:49:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13117 "Modified: / 09-11-2010 / 23:37:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13118 "Modified: / 28-01-2011 / 15:18:54 / Marcel Hlopko <hlopik@gmail.com>" |
|
13119 ! |
|
13120 |
|
13121 _Class_getComponentType:nativeContext |
|
13122 |cls| |
|
13123 |
|
13124 cls := self reflection classForJavaClassObject:(nativeContext receiver). |
|
13125 cls isJavaPrimitiveType ifTrue:[ |
|
13126 self breakPoint:#jv. |
|
13127 ^ nil |
|
13128 ]. |
|
13129 ^ self javaClassObjectForClass:cls javaComponentClass |
|
13130 |
|
13131 "Created: / 12-11-1998 / 18:54:46 / cg" |
|
13132 "Modified: / 20-12-2010 / 22:56:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13133 "Modified: / 28-01-2011 / 15:18:59 / Marcel Hlopko <hlopik@gmail.com>" |
|
13134 ! |
|
13135 |
|
13136 _Class_getConstantPool:aJavaContext |
|
13137 | class | |
|
13138 |
|
13139 class := self reflection classForJavaClassObject:aJavaContext receiver. |
|
13140 ^ self reflection javaConstantPoolObjectFor:class constantPool. |
|
13141 |
|
13142 "Created: / 21-12-2010 / 20:00:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13143 "Modified: / 28-02-2011 / 18:05:13 / Marcel Hlopko <hlopik@gmail.com>" |
|
13144 ! |
|
13145 |
|
13146 _Class_getDeclaredConstructors0:aJavaContext |
|
13147 |class publicOnly constructors| |
|
13148 |
|
13149 class := self reflection classForJavaClassObject:(aJavaContext receiver). |
|
13150 publicOnly := (aJavaContext argAt:1) == 1. |
|
13151 constructors := OrderedCollection new. |
|
13152 class |
|
13153 selectorsAndMethodsDo:[:selector :method | |
|
13154 (method isJavaMethod |
|
13155 and:[ |
|
13156 (selector at:1) == $< |
|
13157 and:[ |
|
13158 (selector startsWith:'<init>(') and:[publicOnly not or:[method isPublic]] |
|
13159 ] |
|
13160 ]) |
|
13161 ifTrue:[constructors add:(self reflection javaConstructorObjectForMethod:method)] |
|
13162 ]. |
|
13163 ^ (self classForName: 'java.lang.reflect.Constructor') |
|
13164 arrayClass withAll: constructors |
|
13165 |
|
13166 "Created: / 24-11-2010 / 09:25:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13167 "Modified: / 09-02-2011 / 01:24:03 / Marcel Hlopko <hlopik@gmail.com>" |
|
13168 "Modified: / 11-02-2011 / 08:55:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13169 ! |
|
13170 |
|
13171 _Class_getDeclaredFields0:aJavaContext |
|
13172 |javaClassObject class fields publicOnly| |
|
13173 |
|
13174 class := self reflection classForJavaClassObject:(javaClassObject := aJavaContext argAt:0). |
|
13175 publicOnly := (aJavaContext argAt:1) == 1. |
|
13176 fields := class fields. |
|
13177 publicOnly ifTrue: |
|
13178 [fields := fields select:[:f|f isPublic]]. |
|
13179 fields := fields collect:[:f | self javaFieldObjectForField:f in:javaClassObject]. |
|
13180 |
|
13181 ^ (self classForName: 'java.lang.reflect.Field') arrayClass |
|
13182 withAll:fields |
|
13183 |
|
13184 "Created: / 10-11-2010 / 16:22:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13185 "Modified: / 28-01-2011 / 15:19:06 / Marcel Hlopko <hlopik@gmail.com>" |
|
13186 "Modified: / 16-03-2011 / 15:43:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13187 ! |
|
13188 |
|
13189 _Class_getDeclaredMethods0:aJavaContext |
|
13190 |class publicOnly methods| |
|
13191 |
|
13192 class := self reflection classForJavaClassObject:(aJavaContext receiver). |
|
13193 publicOnly := (aJavaContext argAt:1) == 1. |
|
13194 methods := OrderedCollection new. |
|
13195 class |
|
13196 selectorsAndMethodsDo:[:selector :method | |
|
13197 (method isJavaMethod |
|
13198 and:[ |
|
13199 (selector at:1) ~~ $< |
|
13200 and:[ |
|
13201 (selector startsWith:'<init>(') not |
|
13202 and:[publicOnly not or:[method isPublic]] |
|
13203 ] |
|
13204 ]) |
|
13205 ifTrue:[methods add:(self javaMethodObjectForMethod:method)] |
|
13206 ]. |
|
13207 ^ (self classForName: 'java.lang.reflect.Method') |
|
13208 arrayClass withAll: methods asArray |
|
13209 |
|
13210 "Created: / 21-12-2010 / 22:39:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13211 "Modified: / 28-01-2011 / 15:19:09 / Marcel Hlopko <hlopik@gmail.com>" |
|
13212 "Modified: / 11-02-2011 / 08:35:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13213 ! |
|
13214 |
|
13215 _Class_getInterfaces:nativeContext |
|
13216 |jClass cls interfaces jInterfaces| |
|
13217 |
|
13218 jClass := nativeContext receiver. |
|
13219 cls := self reflection classForJavaClassObject:jClass. |
|
13220 cls isJavaPrimitiveType ifTrue:[ |
|
13221 ^ (self classForName:'java.lang.Class') arrayClass new |
|
13222 ]. |
|
13223 interfaces := cls interfaces. |
|
13224 interfaces ifNil:[^ (self classForName:'java.lang.Class') arrayClass new]. |
|
13225 jInterfaces := (self classForName:'java.lang.Class') arrayClass new:interfaces size. |
|
13226 interfaces withIndexDo: |
|
13227 [:iface :idx | jInterfaces at:idx put:(self javaClassObjectForClass:iface)]. |
|
13228 ^ jInterfaces |
|
13229 |
|
13230 "Modified: / 28-01-2011 / 15:19:11 / Marcel Hlopko <hlopik@gmail.com>" |
|
13231 "Modified: / 04-02-2011 / 09:43:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13232 ! |
|
13233 |
|
13234 _Class_getModifiers:aJavaContext |
|
13235 ^ (self reflection classForJavaClassObject:aJavaContext receiver) accessFlags |
|
13236 |
|
13237 "Created: / 12-11-1998 / 18:54:53 / cg" |
|
13238 "Modified: / 26-11-2010 / 10:25:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13239 "Modified: / 28-01-2011 / 15:19:14 / Marcel Hlopko <hlopik@gmail.com>" |
|
13240 ! |
|
13241 |
|
13242 _Class_getName0:aJavaContext |
|
13243 |class| |
|
13244 |
|
13245 class := aJavaContext receiver. |
|
13246 class := self reflection classForJavaClassObject:aJavaContext receiver. |
|
13247 ^ self reflection |
|
13248 javaStringObjectForString:class javaName |
|
13249 interned:true. |
|
13250 |
|
13251 "Created: / 22-11-2010 / 17:50:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13252 "Modified: / 09-02-2011 / 01:06:53 / Marcel Hlopko <hlopik@gmail.com>" |
|
13253 "Modified: / 25-02-2011 / 19:00:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13254 ! |
|
13255 |
|
13256 _Class_getPrimitiveClass:nativeContext |
|
13257 "get a primitive class by name" |
|
13258 |
|
13259 |jClassName className| |
|
13260 |
|
13261 jClassName := nativeContext argAt:1. |
|
13262 className := Java as_ST_String:jClassName. |
|
13263 (JavaDescriptor baseTypesByTypeName keys includes: className) |
|
13264 ifFalse:[self throwClassNotFoundException:className]. |
|
13265 ^self reflection javaClassObjectForClassNamed: className |
|
13266 |
|
13267 "Created: / 04-01-1998 / 00:46:03 / cg" |
|
13268 "Modified: / 28-01-2011 / 15:30:45 / Marcel Hlopko <hlopik@gmail.com>" |
|
13269 "Modified: / 03-02-2011 / 21:43:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13270 ! |
|
13271 |
|
13272 _Class_getRawAnnotations:aJavaContext |
|
13273 |class | |
|
13274 |
|
13275 class := self reflection classForJavaClassObject:aJavaContext receiver. |
|
13276 ^ class runtimeVisibleAnnotationsAsBytesOrNil |
|
13277 |
|
13278 "Created: / 21-12-2010 / 19:35:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13279 "Modified: / 28-01-2011 / 15:19:20 / Marcel Hlopko <hlopik@gmail.com>" |
|
13280 "Modified: / 25-02-2011 / 16:48:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13281 ! |
|
13282 |
|
13283 _Class_getSuperclass:nativeContext |
|
13284 "return a classes superclass" |
|
13285 |
|
13286 |jClass cls superCls| |
|
13287 |
|
13288 jClass := nativeContext receiver. |
|
13289 cls := self reflection classForJavaClassObject:jClass. |
|
13290 superCls := cls superclass. |
|
13291 superCls == JavaObject ifTrue:[ |
|
13292 ^ nil. |
|
13293 ]. |
|
13294 ^ self javaClassObjectForClass:superCls |
|
13295 |
|
13296 "Created: / 12-01-1998 / 12:38:36 / cg" |
|
13297 "Modified: / 04-02-1998 / 14:51:22 / cg" |
|
13298 "Modified: / 28-01-2011 / 14:12:47 / Marcel Hlopko <hlopik@gmail.com>" |
|
13299 "Modified: / 03-02-2011 / 22:53:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13300 ! |
|
13301 |
|
13302 _Class_isArray:nativeContext |
|
13303 ^ (self reflection classForJavaClassObject:nativeContext receiver) isJavaArrayClass |
|
13304 ifTrue:[1] |
|
13305 ifFalse:[0] |
|
13306 |
|
13307 "Created: / 12-11-1998 / 18:54:24 / cg" |
|
13308 "Modified: / 20-12-2010 / 23:20:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13309 "Modified: / 28-01-2011 / 15:19:24 / Marcel Hlopko <hlopik@gmail.com>" |
|
13310 ! |
|
13311 |
|
13312 _Class_isAssignableFrom:nativeContext |
|
13313 " |
|
13314 /** |
|
13315 * Determines if the class or interface represented by this |
|
13316 * {@code Class} object is either the same as, or is a superclass or |
|
13317 * superinterface of, the class or interface represented by the specified |
|
13318 * {@code Class} parameter. It returns {@code true} if so; |
|
13319 * otherwise it returns {@code false}. If this {@code Class} |
|
13320 * object represents a primitive type, this method returns |
|
13321 * {@code true} if the specified {@code Class} parameter is |
|
13322 * exactly this {@code Class} object; otherwise it returns |
|
13323 * {@code false}. |
|
13324 * |
|
13325 * <p> Specifically, this method tests whether the type represented by the |
|
13326 * specified {@code Class} parameter can be converted to the type |
|
13327 * represented by this {@code Class} object via an identity conversion |
|
13328 * or via a widening reference conversion. See <em>The Java Language |
|
13329 * Specification</em>, sections 5.1.1 and 5.1.4 , for details. |
|
13330 * |
|
13331 * @param cls the {@code Class} object to be checked |
|
13332 * @return the {@code boolean} value indicating whether objects of the |
|
13333 * type {@code cls} can be assigned to objects of this class |
|
13334 * @exception NullPointerException if the specified Class parameter is |
|
13335 * null. |
|
13336 * @since JDK1.1 |
|
13337 */ |
|
13338 " |
|
13339 | clsObj me other | |
|
13340 clsObj := nativeContext argAt: 1. |
|
13341 clsObj ifNil:[^self throwNullPointerException]. |
|
13342 me := self reflection classForJavaClassObject: nativeContext receiver. |
|
13343 other := self reflection classForJavaClassObject: clsObj. |
|
13344 |
|
13345 "/ Determines if the class or interface represented by this |
|
13346 "/ @code Class} object is either the same as, or is a superclass or |
|
13347 "/ superinterface of, the class or interface represented by the specified |
|
13348 "/ {@code Class} parameter. |
|
13349 |
|
13350 ^(other includesBehavior: me) |
|
13351 ifTrue:[1] |
|
13352 ifFalse:[0] |
|
13353 |
|
13354 "Created: / 12-11-1998 / 18:54:16 / cg" |
|
13355 "Modified: / 05-02-2011 / 23:38:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13356 ! |
13512 ! |
13357 |
13513 |
13358 _Class_isInterface:nativeContext |
13514 _Class_isInterface:nativeContext |
13359 "return true, if this class is an interface" |
13515 "return true, if this class is an interface" |
13360 |
13516 |