FTS atom
[FTS Basic Data Structures]


Detailed Description

FTS atom support.

Atoms are arbitary values.


Set atom values

void fts_set_void (fts_atom_t *atom)
 Set atom value to void.
void fts_set_int (fts_atom_t *atom, int value)
 Set atom value to given int.
void fts_set_float (fts_atom_t *atom, float value)
 Set atom value to given float.
void fts_set_symbol (fts_atom_t *atom, fts_symbol_t sym)
 Set atom value to given symbol.
void fts_set_object (fts_atom_t *atom, fts_object_t *obj)
 Set atom value to given FTS object (reference).
void fts_set_pointer (fts_atom_t *atom, void *ptr)
 Set atom value to given pointer.
void fts_set_string (fts_atom_t *atom, char *string)
 Set atom value to given string.

Get atom values

int fts_get_int (const fts_atom_t *atom)
 Get int from given atom.
float fts_get_float (const fts_atom_t *atom)
 Get float from given atom.
int fts_get_number_int (const fts_atom_t *atom)
 Get int from given atom.
float fts_get_number_float (const fts_atom_t *atom)
 Get float from given atom.
fts_symbol_t fts_get_symbol (const fts_atom_t *atom)
 Get symbol from given atom.
fts_object_tfts_get_object (const fts_atom_t *atom)
 Get object from given atom.
void * fts_get_pointer (const fts_atom_t *atom)
 Get pointer from given atom.
char * fts_get_string (const fts_atom_t *atom)
 Get string from given atom.

Get and test atom type/class

int fts_is_void (const fts_atom_t *atom)
 Tests whether the given atom contains a void value.
int fts_is_int (const fts_atom_t *atom)
 Tests whether the given atom contains a int value.
int fts_is_float (const fts_atom_t *atom)
 Tests whether the given atom contains a float value.
int fts_is_number (const fts_atom_t *atom)
 Tests whether the given atom contains a number value.
int fts_is_symbol (const fts_atom_t *atom)
 Tests whether the given atom contains a symbol value.
int fts_is_object (const fts_atom_t *atom)
 Tests whether the given atom contains an fts_object value.
int fts_is_pointer (const fts_atom_t *atom)
 Tests whether the given atom contains a pointer value.
int fts_is_string (const fts_atom_t *atom)
 Tests whether the given atom contains a string value.
fts_class_tfts_get_class (const fts_atom_t *atom)
 Get FTS class of the atom value.
fts_symbol_t fts_get_class_name (const fts_atom_t *atom)
 Get FTS class name of the atom value.
int fts_get_class_id (const fts_atom_t *atom)
 Get FTS class id of the atom value.
int fts_is_a (const fts_atom_t *atom, fts_class_t *type)
 Tests whether the atom value is of the given type (FTS class).

Misc atom functions

void fts_atom_void (const fts_atom_t *p)
 Sets atom value to void (releases FTS object reference).
void fts_atom_refer (const fts_atom_t *atom)
 Adds reference to atom of FTS object reference.
void fts_atom_release (const fts_atom_t *atom)
 Release reference to atom of FTS object reference.
void fts_atom_assign (const fts_atom_t *dest, const fts_atom_t *src)
 Assign the value of one atom to another.
FTS_API void fts_atom_copy (const fts_atom_t *from, fts_atom_t *to)
 Copies atom value or object (not just reference) from one atom to another.
int fts_atom_same_type (const fts_atom_t *atom1, const fts_atom_t *atom2)
 Tests whether two atoms values are of the same type (class).
FTS_API int fts_atom_identical (const fts_atom_t *atom1, const fts_atom_t *atom2)
 Tests whether two atoms values have identical values.
FTS_API int fts_atom_equals (const fts_atom_t *atom1, const fts_atom_t *atom2)
 Tests whether two atoms have equal values.
FTS_API int fts_atom_compare (const fts_atom_t *atom1, const fts_atom_t *atom2)
 Compares atoms of number, symbol, and FTS objects (compares the references).

Variables

FTS_API fts_atom_t * fts_null
 Constant representing a 'void' atom.
FTS_API fts_atom_t * fts_zero
 Constant representing an int 0 (zero) atom.
FTS_API fts_atom_t * fts_nix
 Constant representing a useless dummy atom for various occasions (might change to any value).


Function Documentation

void fts_atom_assign ( const fts_atom_t *  dest,
const fts_atom_t *  src 
)

Assign the value of one atom to another.

Assigns src atom value to dest atom (handles references to FTS object). For atoms containing FTS objects only the reference is copied. The function properly handles references to FTS objects and requires initialized atoms.

Parameters:
dest destination atom pointer
src source atom pointer

FTS_API int fts_atom_compare ( const fts_atom_t *  atom1,
const fts_atom_t *  atom2 
)

Compares atoms of number, symbol, and FTS objects (compares the references).

Parameters:
atom1 pointer to atom
atom2 pointer to atom
Returns:
a value < 0, 0, > 0 if atom1 < atom2, atom1 == atom2, atom1 > atom2 respectively

FTS_API void fts_atom_copy ( const fts_atom_t *  from,
fts_atom_t *  to 
)

Copies atom value or object (not just reference) from one atom to another.

For FTM objects the copy function of the class is used. The function properly handles references to FTS objects and requires initialized atoms.

Parameters:
from pointer to original atom
to pointer to destination atom

FTS_API int fts_atom_equals ( const fts_atom_t *  atom1,
const fts_atom_t *  atom2 
)

Tests whether two atoms have equal values.

For atoms containing FTS objects the class dependent comparison function is used.

Parameters:
atom1 first atom
atom2 second atom
Returns:
1 if equals

FTS_API int fts_atom_identical ( const fts_atom_t *  atom1,
const fts_atom_t *  atom2 
)

Tests whether two atoms values have identical values.

For atoms containing FTS objects only the references are compared.

Parameters:
atom1 first atom
atom2 second atom
Returns:
boolean (0|1)

void fts_atom_refer ( const fts_atom_t *  atom  ) 

Adds reference to atom of FTS object reference.

Has no effect for primitive atom values.

Parameters:
atom atom pointer

void fts_atom_release ( const fts_atom_t *  atom  ) 

Release reference to atom of FTS object reference.

Has no effect for primitive atom values.

Parameters:
atom atom pointer

int fts_atom_same_type ( const fts_atom_t *  atom1,
const fts_atom_t *  atom2 
)

Tests whether two atoms values are of the same type (class).

Parameters:
atom1 pointer to an atom
atom2 another pointer to an atom
Returns:
boolean (0|1)

void fts_atom_void ( const fts_atom_t *  p  ) 

Sets atom value to void (releases FTS object reference).

Parameters:
p atom pointer

fts_class_t* fts_get_class ( const fts_atom_t *  atom  ) 

Get FTS class of the atom value.

Parameters:
atom pointer to the atom
Returns:
pointer to an FTS class

int fts_get_class_id ( const fts_atom_t *  atom  ) 

Get FTS class id of the atom value.

Parameters:
atom pointer to the atom
Returns:
FTS class id

fts_symbol_t fts_get_class_name ( const fts_atom_t *  atom  ) 

Get FTS class name of the atom value.

Parameters:
atom pointer to the atom
Returns:
class name

float fts_get_float ( const fts_atom_t *  atom  ) 

Get float from given atom.

Parameters:
atom pointer to the atom
Returns:
float value

int fts_get_int ( const fts_atom_t *  atom  ) 

Get int from given atom.

Parameters:
atom pointer to the atom
Returns:
int value

float fts_get_number_float ( const fts_atom_t *  atom  ) 

Get float from given atom.

Parameters:
atom pointer to the atom
Returns:
float value

int fts_get_number_int ( const fts_atom_t *  atom  ) 

Get int from given atom.

Parameters:
atom pointer to the atom
Returns:
int value

fts_object_t* fts_get_object ( const fts_atom_t *  atom  ) 

Get object from given atom.

Parameters:
atom pointer to the atom
Returns:
FTS object reference (pointer)

void* fts_get_pointer ( const fts_atom_t *  atom  ) 

Get pointer from given atom.

Parameters:
atom pointer to the atom
Returns:
pointer value as void *

char* fts_get_string ( const fts_atom_t *  atom  ) 

Get string from given atom.

Parameters:
atom pointer to the atom
Returns:
string value

fts_symbol_t fts_get_symbol ( const fts_atom_t *  atom  ) 

Get symbol from given atom.

Parameters:
atom pointer to the atom
Returns:
symbol value

int fts_is_a ( const fts_atom_t *  atom,
fts_class_t type 
)

Tests whether the atom value is of the given type (FTS class).

Parameters:
atom pointer to the atom
type pointer to FTS class
Returns:
boolean (0|1)

int fts_is_float ( const fts_atom_t *  atom  ) 

Tests whether the given atom contains a float value.

Parameters:
atom pointer to the atom
Returns:
boolean (0|1)

int fts_is_int ( const fts_atom_t *  atom  ) 

Tests whether the given atom contains a int value.

Parameters:
atom pointer to the atom
Returns:
boolean (0|1)

int fts_is_number ( const fts_atom_t *  atom  ) 

Tests whether the given atom contains a number value.

Parameters:
atom pointer to the atom
Returns:
boolean (0|1)

int fts_is_object ( const fts_atom_t *  atom  ) 

Tests whether the given atom contains an fts_object value.

Parameters:
atom pointer to the atom
Returns:
boolean (0|1)

int fts_is_pointer ( const fts_atom_t *  atom  ) 

Tests whether the given atom contains a pointer value.

Parameters:
atom pointer to the atom
Returns:
boolean (0|1)

int fts_is_string ( const fts_atom_t *  atom  ) 

Tests whether the given atom contains a string value.

Parameters:
atom pointer to the atom
Returns:
boolean (0|1)

int fts_is_symbol ( const fts_atom_t *  atom  ) 

Tests whether the given atom contains a symbol value.

Parameters:
atom pointer to the atom
Returns:
boolean (0|1)

int fts_is_void ( const fts_atom_t *  atom  ) 

Tests whether the given atom contains a void value.

Parameters:
atom pointer to the atom
Returns:
boolean (0|1)

void fts_set_float ( fts_atom_t *  atom,
float  value 
)

Set atom value to given float.

Parameters:
atom pointer to the atom
value float value

void fts_set_int ( fts_atom_t *  atom,
int  value 
)

Set atom value to given int.

Parameters:
atom pointer to the atom
value int value

void fts_set_object ( fts_atom_t *  atom,
fts_object_t obj 
)

Set atom value to given FTS object (reference).

Parameters:
atom pointer to the atom
obj FTS object value

void fts_set_pointer ( fts_atom_t *  atom,
void *  ptr 
)

Set atom value to given pointer.

Parameters:
atom pointer to the atom
ptr pointer value

void fts_set_string ( fts_atom_t *  atom,
char *  string 
)

Set atom value to given string.

Parameters:
atom pointer to the atom
string string value

void fts_set_symbol ( fts_atom_t *  atom,
fts_symbol_t  sym 
)

Set atom value to given symbol.

Parameters:
atom pointer to the atom
sym symbol value

void fts_set_void ( fts_atom_t *  atom  ) 

Set atom value to void.

Parameters:
atom pointer to the atom


Generated on Wed Aug 24 18:28:43 2011 for FTM API by  doxygen 1.5.6