ExternalAddress.st
changeset 6491 6976d9b69e01
parent 4673 39fa7949617b
child 7018 5ceb0daa7b1b
--- a/ExternalAddress.st	Tue Apr 09 17:41:30 2002 +0200
+++ b/ExternalAddress.st	Tue Apr 09 20:58:14 2002 +0200
@@ -10,6 +10,8 @@
  hereby transferred.
 "
 
+"{ Package: 'stx:libbasic' }"
+
 Object subclass:#ExternalAddress
 	instanceVariableNames:'address*'
 	classVariableNames:''
@@ -112,6 +114,18 @@
     ^ self == ExternalAddress
 
     "Modified: / 11.6.1998 / 17:12:40 / cg"
+!
+
+pointerSize
+    "answer the size in bytes of a pointer"
+
+%{ /* NOCONTEXT */
+    RETURN(__mkSmallInteger(sizeof(void *)));
+%}.
+
+    "
+     self pointerSize
+    "
 ! !
 
 !ExternalAddress methodsFor:'accessing'!
@@ -200,13 +214,37 @@
 
 !ExternalAddress methodsFor:'converting'!
 
+asExternalAddress
+    "convert to an ExternalAddress.
+     Useful to convert subclasses"
+
+%{ /* NOCONTEXT */
+
+    if (__qClass(self) == @global(ExternalAddress)) {
+        RETURN(self)
+    }
+    RETURN(__MKEXTERNALADDRESS(__INST(address_)));
+%}.
+
+    "
+      (ExternalAddress newAddress:16r12345678) asExternalAddress
+    "
+!
+
 asExternalBytes
     "return an ExternalBytes object pointing to where the receiver points to.
      Use of this is not recommended; primitives which return externalAddresses
      dont think that access to the memory is required/useful, while primitives
      which do think so should return an externalBytes instance right away."
 
-    ^ ExternalBytes address:(self address)
+%{ /* NOCONTEXT */
+
+    RETURN(__MKEXTERNALBYTES(__INST(address_)));
+%}
+
+    "
+      (ExternalAddress newAddress:16r12345678) asExternalBytes
+    "
 ! !
 
 !ExternalAddress methodsFor:'printing & storing'!
@@ -240,5 +278,5 @@
 !ExternalAddress class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ExternalAddress.st,v 1.15 1999-09-03 12:33:50 ps Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ExternalAddress.st,v 1.16 2002-04-09 18:58:14 stefan Exp $'
 ! !