Tagged object (TAG)


Functions

bool isTAG (SatAddr src)
 is the object at src a TAG?
SatAddr TAGencode (const char *tag, SatAddr obj, SatAddr dst)
 Make a tagged object.
int TAGnumChars (SatAddr src)
 Return the number of tag characters in a TAG object.
bool TAGdecode (SatAddr src, char *tag, SatAddr *obj)
 Decode a TAG object.
SatAddr makeTAG (int nibbles)
 Create an empty tag object with "nibbles" space.
int TAGnibbles (SatAddr src)
 Return the size in nibbles of the TAG at src.

Detailed Description

A TAG object consists of an ASCII tag string and an arbitrary object.

Function Documentation

bool isTAG ( SatAddr  src  ) 

is the object at src a TAG?

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

SatAddr makeTAG ( int  nibbles  ) 

Create an empty tag object with "nibbles" space.

This isn't very useful since you need to populate the tag object with something. Use TAGencode() instead. This function is included for consistency with other objects.

Parameters:
nibbles The number of nibbles in the TAG object
Returns:
The new empty TAG object.

bool TAGdecode ( SatAddr  src,
char *  tag,
SatAddr obj 
)

Decode a TAG object.

Parameters:
src The Saturn address of a TAG object
tag If non-null, then the tag will be stored here as a null-terminated string. In this case tag must point to sufficient space to store it. 256 characters is enough, or you can create a buf with TAGnumChars(src)+1 bytes.
obj If non-null, then the address of the object within the TAG will be written here.
Returns:
true on success, false if src isn't a TAG object.

SatAddr TAGencode ( const char *  tag,
SatAddr  obj,
SatAddr  dst 
)

Make a tagged object.

Parameters:
tag A null-terminated string that is the tag.
obj The Saturn address of the object to be tagged
dst The Saturn address where the TAG should be stored. If dst is zero (the expected case) then space is allocated for the TAG. Otherwise dst must point to sufficient space for the TAG.
Returns:
The Saturn address of the TAG object, or zero on error.

int TAGnibbles ( SatAddr  src  ) 

Return the size in nibbles of the TAG at src.

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

int TAGnumChars ( SatAddr  src  ) 

Return the number of tag characters in a TAG object.

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


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