465 |
467 |
466 "Modified: / 23.4.1996 / 15:56:25 / cg" |
468 "Modified: / 23.4.1996 / 15:56:25 / cg" |
467 "Modified: / 5.3.1998 / 14:56:22 / stefan" |
469 "Modified: / 5.3.1998 / 14:56:22 / stefan" |
468 ! ! |
470 ! ! |
469 |
471 |
|
472 !UninterpretedBytes methodsFor:'@ OLE Extensions'! |
|
473 |
|
474 addressAtOffset: index0Based |
|
475 "Answer the bytes starting at index0Based (0 based offset) |
|
476 as anExternalAddress. Answer nil if there is no address. |
|
477 Notice: Offsets are zero relative." |
|
478 |
|
479 | address | |
|
480 |
|
481 address := self pointerValueAt: index0Based + 1. |
|
482 ^ address = 0 |
|
483 ifTrue: [ nil ] |
|
484 ifFalse: [ ExternalAddress newAddress: address ] |
|
485 |
|
486 "Modified: / 30-03-2016 / 11:00:19 / cg" |
|
487 ! |
|
488 |
|
489 addressAtOffset: index0Based put: anExternalAddress |
|
490 "Set the bytes starting at index0Based (0 based offset) |
|
491 from the contents of anExternalAddress. |
|
492 Notice: Offsets are zero relative." |
|
493 |
|
494 |anAddress | |
|
495 |
|
496 anAddress := anExternalAddress isNil |
|
497 ifTrue:[0] |
|
498 ifFalse:[anExternalAddress address]. |
|
499 self pointerAt: index0Based + 1 put: anAddress |
|
500 ! |
|
501 |
|
502 addressValueAtOffset: index0Based |
|
503 "Answer the pointer-value starting at index0Based (0 based offset) |
|
504 as unsigned integer. |
|
505 Notice: Offsets are zero relative." |
|
506 |
|
507 ^ self pointerValueAt: index0Based + 1. |
|
508 ! |
|
509 |
|
510 addressValueAtOffset: index0Based put:anAddress |
|
511 "Set the pointer-value starting at index0Based (0 based offset) |
|
512 as unsigned integer. |
|
513 Notice: Offsets are zero relative." |
|
514 |
|
515 self pointerAt: index0Based + 1 put:anAddress. |
|
516 ! |
|
517 |
|
518 byteAtOffset:index0Based |
|
519 "return the byte at index0Based. |
|
520 For ByteArray, this is the same as basicAt: |
|
521 however, for strings or symbols, |
|
522 this returns a numeric byteValue instead of a character. |
|
523 Notice: Offsets are zero relative." |
|
524 |
|
525 ^ self byteAt:(index0Based + 1) |
|
526 ! |
|
527 |
|
528 byteAtOffset:index0Based put:value |
|
529 "set the byte at index. For ByteArray, this is the same as basicAt:put:. |
|
530 However, for Strings, this expects a byteValue to be stored. |
|
531 Notice: Offsets are zero relative." |
|
532 |
|
533 ^ self byteAt:(index0Based + 1) put:value |
|
534 ! |
|
535 |
|
536 bytesAtOffset: index0Based count: count |
|
537 "Answer a ByteArray with count bytes copied |
|
538 from the receiver starting at index0Based. |
|
539 Notice: Offsets are zero relative." |
|
540 |
|
541 |newBytes | |
|
542 |
|
543 newBytes := ByteArray new: count. |
|
544 newBytes replaceBytesFrom:1 to:count with:self startingAt:(index0Based + 1). |
|
545 ^newBytes |
|
546 |
|
547 " |
|
548 #[83 0 0 0 0 0 0 0 120 237 14 0 4 0 0 ] bytesAtOffset: 9 count: 3 |
|
549 " |
|
550 |
|
551 "Modified (comment): / 30-03-2016 / 11:24:41 / cg" |
|
552 ! |
|
553 |
|
554 bytesAtOffset: index0Based put: aByteObject |
|
555 "Store aByteObject at anInteger in the receiver. |
|
556 Notice: Offsets are zero relative." |
|
557 |
|
558 ^ self |
|
559 replaceBytesFrom:(index0Based + 1) to:(index0Based + aByteObject size) |
|
560 with:aByteObject startingAt:1. |
|
561 ! |
|
562 |
|
563 fillFromAddress: anAddress |
|
564 "Fill the receiver by copying mySize bytes from host memory at anAddress. |
|
565 Warning: because anAddress might not know, how big it is, |
|
566 the size of the receiver must already be correct. |
|
567 (i.e. the receiver must have been allocated from a returned size value)" |
|
568 |
|
569 self |
|
570 replaceFrom:1 to:self size |
|
571 with:anAddress asExternalBytes |
|
572 startingAt:1 |
|
573 ! |
|
574 |
|
575 longAtOffset: index0Based |
|
576 "same as longAt:, but with a 0-based offset. |
|
577 Notice: Offsets are zero relative." |
|
578 |
|
579 ^self signedInt32At:(index0Based + 1) |
|
580 ! |
|
581 |
|
582 longAtOffset: index0Based put: value |
|
583 "same as longAtput::, but with a 0-based offset. |
|
584 Notice: Offsets are zero relative." |
|
585 |
|
586 ^self signedInt32At:index0Based +1 put:value |
|
587 ! |
|
588 |
|
589 shortAtOffset: index0Based |
|
590 "same as shortAt:, but with a 0-based offset. |
|
591 Notice: Offsets are zero relative." |
|
592 |
|
593 ^self signedInt16At: index0Based + 1 |
|
594 ! |
|
595 |
|
596 shortAtOffset: index0Based put: value |
|
597 "same as shortAt:put:, but with a 0-based offset. |
|
598 Notice: Offsets are zero relative." |
|
599 |
|
600 ^self signedInt16At: index0Based + 1 put: value |
|
601 ! |
|
602 |
|
603 uLongAtOffset: index0Based |
|
604 "same as unsignedLongAt:, but with a 0-based offset. |
|
605 Notice: Offsets are zero relative." |
|
606 |
|
607 ^ self unsignedInt32At:(index0Based + 1) |
|
608 ! |
|
609 |
|
610 uLongAtOffset: index0Based put: value |
|
611 "same as unsignedLongAt:put:, but with a 0-based offset. |
|
612 Notice: Offsets are zero relative." |
|
613 |
|
614 ^ self unsignedInt32At:(index0Based + 1) put: value |
|
615 ! |
|
616 |
|
617 uShortAtOffset: index0Based |
|
618 "same as unsignedShortAt:, but with a 0-based offset. |
|
619 Notice: Offsets are zero relative." |
|
620 |
|
621 ^ self unsignedInt16At:(index0Based + 1) |
|
622 ! |
|
623 |
|
624 uShortAtOffset: index0Based put: value |
|
625 "same as unsignedShortAt:put:, but with a 0-based offset. |
|
626 Notice: Offsets are zero relative." |
|
627 |
|
628 ^ self unsignedInt16At:(index0Based + 1) put: value |
|
629 ! |
|
630 |
|
631 unsignedLongAtOffset: index0Based |
|
632 "same as unsignedLongAt:, but with a 0-based offset. |
|
633 Notice: Offsets are zero relative." |
|
634 |
|
635 ^self unsignedInt32At: index0Based + 1 |
|
636 ! |
|
637 |
|
638 unsignedLongAtOffset: index0Based put: value |
|
639 "same as unsignedLongAt:put:, but with a 0-based offset. |
|
640 Notice: Offsets are zero relative." |
|
641 |
|
642 ^self unsignedInt32At: index0Based + 1 put: value |
|
643 ! |
|
644 |
|
645 unsignedShortAtOffset: index0Based |
|
646 "same as unsignedShortAt:, but with a 0-based offset. |
|
647 Notice: Offsets are zero relative." |
|
648 |
|
649 ^self unsignedInt16At: index0Based + 1 |
|
650 ! |
|
651 |
|
652 unsignedShortAtOffset: index0Based put: value |
|
653 "same as unsignedShortAt:put:, but with a 0-based offset. |
|
654 Notice: Offsets are zero relative." |
|
655 |
|
656 ^self unsignedInt16At:(index0Based + 1) put: value |
|
657 ! ! |
|
658 |
470 !UninterpretedBytes methodsFor:'Compatibility'! |
659 !UninterpretedBytes methodsFor:'Compatibility'! |
471 |
660 |
472 doubleWordAt:index |
661 doubleWordAt:index |
473 "return the 4-bytes starting at index as an (unsigned) Integer. |
662 "return the 4-bytes starting at index as an (unsigned) Integer. |
474 The index is a smalltalk index (i.e. 1-based). |
663 The index is a smalltalk index (i.e. 1-based). |
2549 |
2738 |
2550 ^ self unsignedInt64At:byteIndex put:anInteger MSB:true |
2739 ^ self unsignedInt64At:byteIndex put:anInteger MSB:true |
2551 ! ! |
2740 ! ! |
2552 |
2741 |
2553 !UninterpretedBytes methodsFor:'accessing-longs (32bit)'! |
2742 !UninterpretedBytes methodsFor:'accessing-longs (32bit)'! |
2554 |
|
2555 pointerAt:index |
|
2556 "get a pointer starting at index as ExternalAddress. |
|
2557 The index is a smalltalk index (i.e. 1-based). |
|
2558 Only aligned accesses are allowed." |
|
2559 |
|
2560 %{ |
|
2561 if (__isSmallInteger(index)) { |
|
2562 unsigned char *cp; |
|
2563 INT sz; |
|
2564 |
|
2565 __fetchBytePointerAndSize__(self, &cp, &sz); |
|
2566 if (cp) { |
|
2567 INT idx = __smallIntegerVal(index) - 1; |
|
2568 char *pointer; |
|
2569 |
|
2570 if ((idx >= 0) && ((idx+(sizeof(pointer)-1)) < sz)) { |
|
2571 cp += idx; |
|
2572 /* |
|
2573 * aligned |
|
2574 */ |
|
2575 if (((INT)cp & (sizeof(pointer)-1)) == 0) { |
|
2576 pointer = ((char **)cp)[0]; |
|
2577 RETURN (__MKEXTERNALADDRESS(pointer)); |
|
2578 } else { |
|
2579 #if 0 |
|
2580 printf("cp UNALIGNED (%"_lx_")\n", (INT)cp); |
|
2581 #endif |
|
2582 } |
|
2583 } else { |
|
2584 #if 0 |
|
2585 printf("idx(%"_ld_")+(sizeof(pointer)-1) (%d) >= sz (%"_ld_")\n", |
|
2586 idx, (int)(sizeof(pointer)-1), sz); |
|
2587 #endif |
|
2588 } |
|
2589 } else { |
|
2590 #if 0 |
|
2591 printf("cp is NULL\n"); |
|
2592 #endif |
|
2593 } |
|
2594 } else { |
|
2595 #if 0 |
|
2596 printf("bad index\n"); |
|
2597 #endif |
|
2598 } |
|
2599 bad:; |
|
2600 %}. |
|
2601 |
|
2602 self primitiveFailed. |
|
2603 |
|
2604 " |
|
2605 |b| |
|
2606 b := ByteArray new:(ExternalAddress pointerSize). |
|
2607 b pointerAt:1 put:(ExternalAddress newAddress:16r12345678). |
|
2608 Transcript showCR:((b unsignedInt32At:1) printStringRadix:16). |
|
2609 Transcript showCR:((b pointerAt:1)). |
|
2610 |
|
2611 |b| |
|
2612 b := ByteArray new:(ExternalAddress pointerSize). |
|
2613 b pointerAt:1 put:(ExternalAddress newAddress:16r12345678abcdef). |
|
2614 Transcript showCR:((b unsignedInt64At:1) printStringRadix:16). |
|
2615 Transcript showCR:((b pointerAt:1)). |
|
2616 " |
|
2617 ! |
|
2618 |
|
2619 pointerAt:index put:value |
|
2620 "set the pointer starting at index from the integer or externalAddress value. |
|
2621 The index is a smalltalk index (i.e. 1-based). |
|
2622 Only aligned accesses are allowed. |
|
2623 The value is either an ExternalAddress, ExternalBytes or an Integer" |
|
2624 |
|
2625 %{ |
|
2626 OBJ *pointer; |
|
2627 |
|
2628 if (__isExternalAddressLike(value)) { |
|
2629 pointer = __externalAddressVal(value); |
|
2630 } else if (__isExternalBytesLike(value)) { |
|
2631 pointer = __externalBytesVal(value); |
|
2632 if (pointer == (OBJ *)0) |
|
2633 pointer = 0; |
|
2634 } else if (value == nil) { |
|
2635 pointer = 0; |
|
2636 } else if (__isSmallInteger(value)) { |
|
2637 pointer = (OBJ *)__intVal(value); |
|
2638 } else { |
|
2639 if ((pointer = (OBJ *)__unsignedLongIntVal(value)) == 0) { |
|
2640 goto bad; |
|
2641 } |
|
2642 } |
|
2643 |
|
2644 if (__isSmallInteger(index)) { |
|
2645 unsigned char *cp; |
|
2646 INT sz; |
|
2647 |
|
2648 __fetchBytePointerAndSize__(self, &cp, &sz); |
|
2649 if (cp) { |
|
2650 INT idx = __smallIntegerVal(index) - 1; |
|
2651 |
|
2652 if ((idx >= 0) && ((idx+(sizeof(pointer)-1)) < sz)) { |
|
2653 cp += idx; |
|
2654 /* |
|
2655 * aligned |
|
2656 */ |
|
2657 if (((INT)cp & (sizeof(pointer)-1)) == 0) { |
|
2658 ((char **)cp)[0] = (char *) pointer; |
|
2659 RETURN (value); |
|
2660 } |
|
2661 } |
|
2662 } |
|
2663 } |
|
2664 bad:; |
|
2665 %}. |
|
2666 |
|
2667 self primitiveFailed. |
|
2668 |
|
2669 " |
|
2670 |b| |
|
2671 b := ByteArray new:ExternalAddress pointerSize. |
|
2672 b pointerAt:1 put:(ExternalAddress newAddress:16r12345678). |
|
2673 (b unsignedLongAt:1) printStringRadix:16 |
|
2674 " |
|
2675 |
|
2676 "Modified: / 1.7.1996 / 21:11:39 / cg" |
|
2677 "Created: / 5.3.1998 / 10:57:18 / stefan" |
|
2678 ! |
|
2679 |
|
2680 pointerValueAt:index |
|
2681 "get a pointer value starting at index as unsigned integer. |
|
2682 The index is a smalltalk index (i.e. 1-based). |
|
2683 Only aligned accesses are allowed. |
|
2684 This returns an int with sizeof the machines's native pointer (4 or 8 bytes)" |
|
2685 |
|
2686 %{ |
|
2687 if (__isSmallInteger(index)) { |
|
2688 unsigned char *cp; |
|
2689 INT sz; |
|
2690 |
|
2691 __fetchBytePointerAndSize__(self, &cp, &sz); |
|
2692 if (cp) { |
|
2693 INT idx = __smallIntegerVal(index) - 1; |
|
2694 char *pointer; |
|
2695 |
|
2696 if ((idx >= 0) && ((idx+(sizeof(pointer)-1)) < sz)) { |
|
2697 cp += idx; |
|
2698 /* |
|
2699 * aligned |
|
2700 */ |
|
2701 if (((INT)cp & (sizeof(pointer)-1)) == 0) { |
|
2702 pointer = ((char **)cp)[0]; |
|
2703 RETURN (__MKUINT((INT)(pointer))); |
|
2704 } else { |
|
2705 // printf("cp UNALIGNED (%"_lx_")\n", (INT)cp); |
|
2706 } |
|
2707 } else { |
|
2708 // printf("idx(%"_ld_")+(sizeof(pointer)-1) (%d) >= sz (%"_ld_")\n", |
|
2709 // idx, (int)(sizeof(pointer)-1), sz); |
|
2710 } |
|
2711 } else { |
|
2712 // printf("cp is NULL\n"); |
|
2713 } |
|
2714 } else { |
|
2715 // printf("bad index\n"); |
|
2716 } |
|
2717 bad:; |
|
2718 %}. |
|
2719 |
|
2720 self primitiveFailed. |
|
2721 |
|
2722 " |
|
2723 |b| |
|
2724 b := ByteArray new:(ExternalAddress pointerSize). |
|
2725 b pointerAt:1 put:(ExternalAddress newAddress:16r12345678). |
|
2726 Transcript showCR:((b unsignedLongAt:1) printStringRadix:16). |
|
2727 Transcript showCR:((b pointerAt:1)). |
|
2728 Transcript showCR:((b pointerValueAt:1)). |
|
2729 " |
|
2730 |
|
2731 "Modified (comment): / 30-03-2016 / 11:01:55 / cg" |
|
2732 ! |
|
2733 |
2743 |
2734 signedInt32At:byteIndex |
2744 signedInt32At:byteIndex |
2735 "return the 4-bytes starting at byteIndex as a signed Integer. |
2745 "return the 4-bytes starting at byteIndex as a signed Integer. |
2736 The index is a smalltalk index (i.e. 1-based). |
2746 The index is a smalltalk index (i.e. 1-based). |
2737 The value is retrieved in the machine's natural byte order, |
2747 The value is retrieved in the machine's natural byte order, |
3347 The integer is stored with most significant byte first." |
3357 The integer is stored with most significant byte first." |
3348 |
3358 |
3349 ^ self unsignedInt32At:byteIndex put:anInteger MSB:true |
3359 ^ self unsignedInt32At:byteIndex put:anInteger MSB:true |
3350 ! ! |
3360 ! ! |
3351 |
3361 |
|
3362 !UninterpretedBytes methodsFor:'accessing-pointers'! |
|
3363 |
|
3364 pointerAt:byteIndex |
|
3365 "get a pointer starting at byteIndex as ExternalAddress. |
|
3366 The byteIndex is a smalltalk index (i.e. 1-based). |
|
3367 Only aligned accesses are allowed. |
|
3368 The pointer is of native cpu's size (4 or 8 bytes)" |
|
3369 |
|
3370 %{ |
|
3371 if (__isSmallInteger(byteIndex)) { |
|
3372 unsigned char *cp; |
|
3373 INT sz; |
|
3374 |
|
3375 __fetchBytePointerAndSize__(self, &cp, &sz); |
|
3376 if (cp) { |
|
3377 INT idx = __smallIntegerVal(byteIndex) - 1; |
|
3378 char *pointer; |
|
3379 |
|
3380 if ((idx >= 0) && ((idx+(sizeof(pointer)-1)) < sz)) { |
|
3381 cp += idx; |
|
3382 /* |
|
3383 * aligned |
|
3384 */ |
|
3385 if (((INT)cp & (sizeof(pointer)-1)) == 0) { |
|
3386 pointer = ((char **)cp)[0]; |
|
3387 RETURN (__MKEXTERNALADDRESS(pointer)); |
|
3388 } else { |
|
3389 #if 0 |
|
3390 printf("cp UNALIGNED (%"_lx_")\n", (INT)cp); |
|
3391 #endif |
|
3392 } |
|
3393 } else { |
|
3394 #if 0 |
|
3395 printf("idx(%"_ld_")+(sizeof(pointer)-1) (%d) >= sz (%"_ld_")\n", |
|
3396 idx, (int)(sizeof(pointer)-1), sz); |
|
3397 #endif |
|
3398 } |
|
3399 } else { |
|
3400 #if 0 |
|
3401 printf("cp is NULL\n"); |
|
3402 #endif |
|
3403 } |
|
3404 } else { |
|
3405 #if 0 |
|
3406 printf("bad index\n"); |
|
3407 #endif |
|
3408 } |
|
3409 bad:; |
|
3410 %}. |
|
3411 |
|
3412 self primitiveFailed. |
|
3413 |
|
3414 " |
|
3415 |b| |
|
3416 b := ByteArray new:(ExternalAddress pointerSize). |
|
3417 b pointerAt:1 put:(ExternalAddress newAddress:16r12345678). |
|
3418 Transcript showCR:((b unsignedInt32At:1) printStringRadix:16). |
|
3419 Transcript showCR:((b pointerAt:1)). |
|
3420 |
|
3421 |b| |
|
3422 b := ByteArray new:(ExternalAddress pointerSize). |
|
3423 b pointerAt:1 put:(ExternalAddress newAddress:16r12345678abcdef). |
|
3424 Transcript showCR:((b unsignedInt64At:1) printStringRadix:16). |
|
3425 Transcript showCR:((b pointerAt:1)). |
|
3426 " |
|
3427 |
|
3428 "Modified (comment): / 14-11-2016 / 17:32:23 / cg" |
|
3429 ! |
|
3430 |
|
3431 pointerAt:byteIndex put:value |
|
3432 "set the pointer starting at byteIndex from the integer or externalAddress value. |
|
3433 The byteIndex is a smalltalk index (i.e. 1-based). |
|
3434 Only aligned accesses are allowed. |
|
3435 The pointer is of native cpu's size (4 or 8 bytes). |
|
3436 The value may be either an ExternalAddress, ExternalBytes or an Integer" |
|
3437 |
|
3438 %{ |
|
3439 OBJ *pointer; |
|
3440 |
|
3441 if (__isExternalAddressLike(value)) { |
|
3442 pointer = __externalAddressVal(value); |
|
3443 } else if (__isExternalBytesLike(value)) { |
|
3444 pointer = __externalBytesVal(value); |
|
3445 if (pointer == (OBJ *)0) |
|
3446 pointer = 0; |
|
3447 } else if (value == nil) { |
|
3448 pointer = 0; |
|
3449 } else if (__isSmallInteger(value)) { |
|
3450 pointer = (OBJ *)__intVal(value); |
|
3451 } else { |
|
3452 if ((pointer = (OBJ *)__unsignedLongIntVal(value)) == 0) { |
|
3453 goto bad; |
|
3454 } |
|
3455 } |
|
3456 |
|
3457 if (__isSmallInteger(byteIndex)) { |
|
3458 unsigned char *cp; |
|
3459 INT sz; |
|
3460 |
|
3461 __fetchBytePointerAndSize__(self, &cp, &sz); |
|
3462 if (cp) { |
|
3463 INT idx = __smallIntegerVal(byteIndex) - 1; |
|
3464 |
|
3465 if ((idx >= 0) && ((idx+(sizeof(pointer)-1)) < sz)) { |
|
3466 cp += idx; |
|
3467 /* |
|
3468 * aligned |
|
3469 */ |
|
3470 if (((INT)cp & (sizeof(pointer)-1)) == 0) { |
|
3471 ((char **)cp)[0] = (char *) pointer; |
|
3472 RETURN (value); |
|
3473 } |
|
3474 } |
|
3475 } |
|
3476 } |
|
3477 bad:; |
|
3478 %}. |
|
3479 |
|
3480 self primitiveFailed. |
|
3481 |
|
3482 " |
|
3483 |b| |
|
3484 b := ByteArray new:ExternalAddress pointerSize. |
|
3485 b pointerAt:1 put:(ExternalAddress newAddress:16r12345678). |
|
3486 (b unsignedLongAt:1) printStringRadix:16 |
|
3487 " |
|
3488 |
|
3489 "Created: / 05-03-1998 / 10:57:18 / stefan" |
|
3490 "Modified (comment): / 14-11-2016 / 17:28:27 / cg" |
|
3491 ! |
|
3492 |
|
3493 pointerValueAt:byteIndex |
|
3494 "get a pointer value starting at byteIndex as unsigned integer. |
|
3495 The byteIndex is a smalltalk index (i.e. 1-based). |
|
3496 Only aligned accesses are allowed. |
|
3497 The pointer is of native cpu's size (4 or 8 bytes). |
|
3498 This returns an int with sizeof the machines's native pointer (4 or 8 bytes)" |
|
3499 |
|
3500 %{ |
|
3501 if (__isSmallInteger(byteIndex)) { |
|
3502 unsigned char *cp; |
|
3503 INT sz; |
|
3504 |
|
3505 __fetchBytePointerAndSize__(self, &cp, &sz); |
|
3506 if (cp) { |
|
3507 INT idx = __smallIntegerVal(byteIndex) - 1; |
|
3508 char *pointer; |
|
3509 |
|
3510 if ((idx >= 0) && ((idx+(sizeof(pointer)-1)) < sz)) { |
|
3511 cp += idx; |
|
3512 /* |
|
3513 * aligned |
|
3514 */ |
|
3515 if (((INT)cp & (sizeof(pointer)-1)) == 0) { |
|
3516 pointer = ((char **)cp)[0]; |
|
3517 RETURN (__MKUINT((INT)(pointer))); |
|
3518 } else { |
|
3519 // printf("cp UNALIGNED (%"_lx_")\n", (INT)cp); |
|
3520 } |
|
3521 } else { |
|
3522 // printf("idx(%"_ld_")+(sizeof(pointer)-1) (%d) >= sz (%"_ld_")\n", |
|
3523 // idx, (int)(sizeof(pointer)-1), sz); |
|
3524 } |
|
3525 } else { |
|
3526 // printf("cp is NULL\n"); |
|
3527 } |
|
3528 } else { |
|
3529 // printf("bad index\n"); |
|
3530 } |
|
3531 bad:; |
|
3532 %}. |
|
3533 |
|
3534 self primitiveFailed. |
|
3535 |
|
3536 " |
|
3537 |b| |
|
3538 b := ByteArray new:(ExternalAddress pointerSize). |
|
3539 b pointerAt:1 put:(ExternalAddress newAddress:16r12345678). |
|
3540 Transcript showCR:((b unsignedLongAt:1) printStringRadix:16). |
|
3541 Transcript showCR:((b pointerAt:1)). |
|
3542 Transcript showCR:((b pointerValueAt:1)). |
|
3543 " |
|
3544 |
|
3545 "Modified (comment): / 14-11-2016 / 17:28:33 / cg" |
|
3546 ! ! |
|
3547 |
3352 !UninterpretedBytes methodsFor:'accessing-shorts (16bit)'! |
3548 !UninterpretedBytes methodsFor:'accessing-shorts (16bit)'! |
3353 |
3549 |
3354 signedInt16At:byteIndex |
3550 signedInt16At:byteIndex |
3355 "return the 2-bytes starting at index as a signed Integer. |
3551 "return the 2-bytes starting at index as a signed Integer. |
3356 The index is a smalltalk index (i.e. 1-based). |
3552 The index is a smalltalk index (i.e. 1-based). |