Functions to deal with indirect pointers


Functions

SatAddr directPtr (SatAddr src)
 Get the direct pointer from a possible indirect pointer.
bool obStorePtr (SatAddr obj)
 Can you store an object as an indirect pointer?obj Saturn address of an object.
int objOrPtrNibbles (SatAddr obj)
 how many nibbles are in an object or pointer?
int copyObjOrPtr (SatAddr src, SatAddr dst)
 Copy an object or indirect pointer.

Detailed Description

sys RPL and UserRPL programs can contain objects or pointers to objects. Indeed, this is a key property of RPL programs. The same property is true of other composite objects like lists and matrixes. This section contains support functions for dealing with indirect pointers.

You probably won't need to use these. The library already contains functions that will tunnel through indirect pointer. See LISTfirstOb() and LISTnextOb() for example.


Function Documentation

int copyObjOrPtr ( SatAddr  src,
SatAddr  dst 
)

Copy an object or indirect pointer.

This decides whether the object can be copied as a pointer and then copies the object or the pointer.

Parameters:
src Saturn address of an object
dst Saturn address of the destination
Returns:
The number of nibbles copied (5 if its a pointer, obSize(src) otherwise). Returns -1 on error.

SatAddr directPtr ( SatAddr  src  ) 

Get the direct pointer from a possible indirect pointer.

Given an address that contains either an object or a pointer to an object, get the address of the object. directPtr() is used in much of the code that processes composite objects like lists and matrixes.

Parameters:
src Saturn address of an object or a pointer to an object
Returns:
Saturn address of the object.

int objOrPtrNibbles ( SatAddr  obj  ) 

how many nibbles are in an object or pointer?

Parameters:
obj Saturn address of an object or indirect pointer
Returns:
the size of the object or pointer.

bool obStorePtr ( SatAddr  obj  ) 

Can you store an object as an indirect pointer?obj Saturn address of an object.

If you add a ROM object to a composite then there's no need to store the object itself, you can store a pointer to it instead. This function tells you whether you can store the pointer. Its function is currently quite simple. Any object below 0x40000 is in ROM and be stored as a pointer.

Returns:
true if you can store the pointer.


Generated on Sat Apr 3 16:38:31 2010 for HPObjects by  doxygen 1.5.0