ASCII strings (STRING)


Functions

bool isSTRING (SatAddr src)
 is the object at src a STRING?
char * STRINGdecode (SatAddr src, char *dst)
 decode a STRING to a null-terminated C string.
SatAddr STRINGencode (const char *src, SatAddr dst)
 convert a null-terminated C string into an HP STRING object
bool STRINGadd (const char *src, SatAddr dst)
SatAddr makeSTRING (unsigned size)
 Allocate a STRING with numChars characters The initial contents of the string are undefined.
int STRINGnibbles (SatAddr src)
 Return the size in nibbles of the STRING object at src.
int STRINGnumChars (SatAddr src)
 return the number of characters in a STRING

Function Documentation

bool isSTRING ( SatAddr  src  ) 

is the object at src a STRING?

Parameters:
src Saturn address of an object
Returns:
true if the object at src is a STRING

SatAddr makeSTRING ( unsigned  size  ) 

Allocate a STRING with numChars characters The initial contents of the string are undefined.

Parameters:
size The number of characters that the string must hold.
Returns:
the Saturn address of the new STRING, or zero if sufficient space could not be allocated.

bool STRINGadd ( const char *  src,
SatAddr  dst 
)

brief append a null-terminated string to a STRING object

Parameters:
src a null-terminated C string to append
dst Saturn Address of an existing STRING object. There must be sufficient space after the object to hold the appended string
Returns:
true on success, false if dst isn't a STRING.
Warning:
Whatever space dst was allocated in must be completely filled before your program returns or your will corrupt the memory in your calculator! This is because all objects in the TEMPOB space must be contiguous with no empty space between them. The garbage collector relies on this property.
In retrospect, this function was a bad idea because it's so dangerous.

char* STRINGdecode ( SatAddr  src,
char *  dst 
)

decode a STRING to a null-terminated C string.

Parameters:
src The Saturn Address of a STRING object
dst Where to store the resulting C string. If dst is NULL then a new string will be malloc'ed. Otherwise, dst must have sufficient space for the string and it's null terminator.
Returns:
the C string, or NULL if src is not a STRING or an error occurs.

SatAddr STRINGencode ( const char *  src,
SatAddr  dst 
)

convert a null-terminated C string into an HP STRING object

Parameters:
src a null-terminated C string to convert
dst Where to store the resulting STRING. If zero then a new STRING will be created in TEMPOB. Otherwise dst must point to the right amount of space to hold the STRING.
Returns:
the Saturn address of the resulting STRING, or zero if an error occurs.

int STRINGnibbles ( SatAddr  src  ) 

Return the size in nibbles of the STRING object at src.

Parameters:
src the Saturn address of a STRING object
Returns:
the size of the STRING in nibbles, or zero if src is not a STRING.

int STRINGnumChars ( SatAddr  src  ) 

return the number of characters in a STRING

Parameters:
src the Saturn address of a STRING object
Returns:
The number of characters in the STRING, or -1 if src is not a STRING.


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