Programmer's Reference
This section describes the protocols supported by OSBaseType,
OSObjectPointer, and OSStructure.
- +
- Answer a new instance of the receiver, with the same indirection level,
pointing to the data element at index anInteger from the data
element referenced by the receiver.
- -
- Answer a new instance of the receiver, with the same indirection level,
pointing to the data element at index anInteger before the data
element referenced by the receiver.
- decrement
- Decrease the pointer by one to point to the previous data element.
- decrementBy:
- Decrease the pointer by anInteger to point to the previous data
element.
- increment
- Increase the pointer by one to point to the next data element.
- incrementBy:
- Increase the pointer by anInteger to point to the next data
element.
These methods enable you to access the contents of an
OSBaseType, OSStructure, or
OSObjectPointer. All offsets are zero-relative.
Accessing non-aligned addresses is valid but might be slower on processors
that do not directly support this style of access.
- address
- Answer the operating system memory address of the start of the data
element referenced by the receiver. This message is invalid for objects
whose data element is stored in Smalltalk memory.
- bool16At: anInteger
- Answer the 16-bit Boolean at byte offset anInteger
from the start of the storage area referenced by the receiver.
- bool16At: anInteger put: aValue
- Set the 16-bit Boolean at byte offset anInteger from
the start of the storage area referenced by the receiver to the integer value
of aValue. aValue may be nil,
true, false, an Integer, a
Character, or an OSObject. aValue is
converted using the same rules as the pointer call-out conversion.
There is one exception--instances are not allowed of OSObject
that point to Smalltalk memory that is not fixed.
- bool32At: anInteger
- Answer the 32-bit Boolean at byte offset anInteger
from the start of the storage area referenced by the receiver.
- bool32At: anInteger put: aValue
- Set the 32-bit Boolean at byte offset anInteger from
the start of the storage area referenced by the receiver to the integer value
of aValue. aValue may be nil,
true, false, an Integer, a
Character, or an OSObject. aValue is
converted using the same rules as the pointer call-out conversion.
There is one exception--instances are not allowed of OSObject
that point to Smalltalk memory that is not fixed.
- bool8At: anInteger
- Answer the 8-bit Boolean at byte offset anInteger from the
start of the storage area referenced by the receiver.
- bool8At: anInteger put: aValue
- Set the 8-bit Boolean at byte offset anInteger from
the start of the storage area referenced by the receiver to the integer value
of aValue. aValue might be nil,
true, false, an Integer, a
Character, or an OSObject. aValue is converted
using the same rules as the pointer call-out conversion. There is one
exception--instances are not allowed of OSObject that point
to Smalltalk memory that is not fixed.
- char16At: anInteger
- Similar to bool16At:.
- char16At anInteger put: aValue
- Similar to bool16At:put:.
- char8At: anInteger
- Similar to bool8At:.
- char8At anInteger put: aValue
- Similar to bool8At:put:.
- float32At: anInteger
- Answer an instance of Float representing the 32-bit
floating-point value at byte offset anInteger from the start of the
storage area referenced by the receiver.
- float32At: anInteger put: aValue
- Set the 32-bit floating-point value at byte offset anInteger
from the start of the storage area referenced by the receiver to
aValue. aValue must be an instance of
Float.
- float64At: anInteger
- Answer an instance of Float representing the 64-bit
floating-point value at byte offset anInteger from the start of the
storage area referenced by the receiver.
- float64At: anInteger put: aValue
- Set the 64-bit floating-point value at byte offset anInteger
from the start of the storage area referenced by the receiver to
aValue. aValue must be an instance of
Float.
- int16At: anInteger
- Similar to bool16At:.
- int16At anInteger put: aValue
- Similar to bool16At:put:.
- int32At: anInteger
- Similar to bool32At:.
- int32At anInteger put: aValue
- Similar to bool32At:put:.
- int64At: anInteger
- Answer the 64-bit Integer at byte offset anInteger from the
start of the storage area referenced by the receiver.
- int64At anInteger put: aValue
- Set the 64-bit Integer at byte offset anInteger from
the start of the storage area referenced by the receiver to the integer value
of aValue. aValue may be nil,
true, false, an Integer, a
Character, or an OSObject. aValue is
converted using the same rules as the pointer call-out conversion.
There is one exception--instances are not allowed of OSObject
that point to Smalltalk memory that is not fixed.
- int8At: anInteger
- Similar to bool8At:.
- int8At anInteger put: aValue
- Similar to bool8At:put:.
- pointerAt: anInteger type: anOSObjectSubclass
- Create and answer a new struct instance of anOSObjectSubclass
that points to the storage of the receiver starting at
anInteger. An error is signaled if anInteger is
less than anOSObjectSubclass fixedSize bytes from the end of the
receiver's storage.
- reference
- Answer the Smalltalk memory referenced by the receiver. This
message is invalid for objects whose data element is stored in operating
system memory.
- structAt: anInteger type: anOSObjectSubclass
- Create and answer a new struct instance of anOSObjectSubclass
and copies enough bytes to fill it from the receiver starting at
anInteger. An error is signaled if anInteger is
less than anOSObjectSubclass fixedSize bytes from the end of the
receiver's storage.
- structAt: anInteger put: anOSObject
- Copy the storage referenced by anOSObject over the storage for
the receiver starting at anInteger. An error is signaled if
anInteger is less than anOSObject class fixedSize bytes
from the end of the receiver's storage.
- memcpyFrom: start to: stop
- Answer a ByteArray containing a copy of the bytes pointed to by
the receiver from byte offset start up to and including byte offset
stop.
- memcpyStringFrom: start to: stop
- Answer a String containing a copy of the bytes pointed to by
the receiver from byte offset start up to and including byte offset
stop.
- memcpyFrom: start to: stop into: anOSOrBitObject
startingAt: repStart
- Copy bytes from byte offset start in the receiver up to and
including byte offset stop into anOSOrBitObject starting
at byte index repStart. Answer
anOSOrBitObject. anOSOrBitObject might be a byte,
word, or long object, or an OSObject.
- uint16At: anInteger
- Similar to bool16At:.
- uint16At anInteger put: aValue
- Similar to bool16At:put:.
- uint32At: anInteger
- Similar to bool32At:.
- uint32At anInteger put: aValue
- Similar to bool32At:put:.
- uint64At: anInteger
- Similar to int64At:.
- uint64At anInteger put: aValue
- Similar to int64At:put:.
- int8At: anInteger
- Similar to bool8At:.
- int8At anInteger put: aValue
- Similar to bool8At:put:.
- free
- Free the storage for the receiver. If the receiver does not
represent a pointer to operating system memory, do nothing.
- =
- Answer a Boolean indicating whether the receiver and
anOSObject are equal. Two instances of OSObject
are considered to be equal if they represent the identical storage in
operating system or Smalltalk memory.
- memcmpFrom: start to: stop with: anOSOrBitObject
startingAt: repStart
- Compare the bytes in the receiver from offset start to
stop with the bytes in aCollection starting at
repStart. If the bytes are all equal, answer 0. If
the bytes are not all equal, the result is based on the first bytes that are
not equal. If the byte from the receiver is less than the byte from
aCollection, answer -1. If the byte from the receiver is
greater than the byte from aCollection, answer 1.
anOSOrBitObject might be a byte, word, or long object, or an
OSObject.
- isImmediate
- Answer true if the receiver is an immediate.
- isAddress
- Answer true if the receiver represents a pointer to operating
system memory.
- isNull
- Answer true if the receiver is a NULL value; that is, if
the receiver is a pointer to location 0 in memory.
- isAddress
- Answer true if the receiver represents a pointer to Smalltalk
memory.
- notNull
- Answer true if the receiver is not a NULL value.
- address: anInteger
- Answer a new instance of the receiver referring to operating system memory
at address anInteger.
- calloc
- Answer a new instance of the receiver referring to storage in operating
system memory large enough to hold the fixedSize of the receiver in
bytes.
- alloc: anInteger
- Answer a new instance of the receiver referring to storage in operating
system memory large enough to hold anInteger times the
fixedSize of the receiver in bytes.
- new
- Answer a new instance of the receiver referring to Smalltalk storage large
enough to hold the fixedSize of the receiver in bytes.
- reference: aByteArray
- Answer a new instance of the receiver referring to the start of
aByteArray.
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]