next up previous index
Next: Decomposing ECLiPSe terms in Up: Summary of C Interface Previous: Summary of C Interface   Index

Constructing ECLiPSe terms in C

All these functions return (volatile) pwords, which can be used as input to other constructor functions, or which can be stored in (non-volatile) ec_refs.

pword ec_string(const char*)

converts a C string to an ECLiPSe string. The string is copied.

pword ec_length_string(int, const char*)

converts a C string of given length to an ECLiPSe string. The string is copied and can contain NUL bytes.

pword ec_atom(const dident)

creates an ECLiPSe atom. A dident (dictionary identifier) can be obtained either via ec_did() or ec_get_atom().

pword ec_long(const long)

converts a C long to an ECLiPSe integer.

pword ec_double(const double)

converts a C double to an ECLiPSe float.

pword ec_term(dident,pword,pword,...)

creates an ECLiPSe term from the given components.

pword ec_term_array(const dident,const pword[])

creates an ECLiPSe term from the arguments given in the array.

pword ec_list(const pword,const pword)

creates a single ECLiPSe list cell with the given head (car) and tail (cdr).

pword ec_listofrefs(ec_refs)

creates an ECLiPSe list containing the elements of the ec_refs array.

pword ec_listoflong(int, const long*)

creates an ECLiPSe list of integers containing the longs in the given array. The data is copied.

pword ec_listofchar(int, const char*)

creates an ECLiPSe list of integers containing the chars in the given array. The data is copied.

pword ec_listofdouble(int, const double*)

creates an ECLiPSe list of doubles containing the doubles in the given array. The data is copied.

pword ec_arrayofdouble(int, const double*)

creates an ECLiPSe array (a structure with functor []of appropriate arity) of doubles from the given C array. The data is copied.

pword ec_matrixofdouble(int rows, int cols, const double*)

creates an ECLiPSe array (size rows) of arrays (size cols) of doubles from the given C array. The data is copied.

pword ec_handle(const t_ext_type*,const t_ext_ptr)

creates an ECLiPSe handle that refers to the given C data and its method table.

pword ec_newvar()

creates a fresh ECLiPSe variable.

pword ec_nil()

creates an ECLiPSe nil ie. the empty list [].

Auxiliary functions to access the ECLiPSe dictionary.

dident ec_did(char*,int)

looks up or enters the given string with arity into the ECLiPSe dictionary and returns a unique identifier for it.
char* DidName(dident)

returns the name string of the given dictionary identifier.
int DidArity(dident)

returns the arity of the given dictionary identifier.


next up previous index
Next: Decomposing ECLiPSe terms in Up: Summary of C Interface Previous: Summary of C Interface   Index
Warwick Harvey
2004-08-07