QP_string_from_atom(
), QP_padded_string_from_atom()
#include <quintus/quintus.h> char *QP_string_from_atom(atom) QP_atom atom;
int QP_padded_string_from_atom(p_atom, p_string, p_length) QP_atom *p_atom; char *p_string; int *p_length;
QP_string_from_atom()
returns a pointer to a string representing
atom. This string should not be overwritten by the foreign function.
QP_padded_string_from_atom()
is useful for Pascal and FORTRAN
and can be used for any language that has a C-compatible calling convention for
passing integers and pointers (on the users platform). This is true
for many Pascal and FORTRAN compilers running under UNIX.
p_atom and p_length can be seen as integers passed by reference. Fills in the character array of length length with the string representation of atom. The string is truncated or blank-padded to length. The length of the atom (not length) is returned as the function value. In the above description atom refers to the argument passed by reference corresponding to the declared argument p_atom and similarly for p_string and p_length.
rev_atom()
is a C function that takes an atom and returns an atom
whose string representation is the reverse of the string representation
of the atom passed in.
foo.plforeign(rev_atom, c, rev_atom(+atom, [-atom])).
foo.cQP_atom rev_atom(atom) QP_atom atom; { char * string[MAX_ATOM_LEN]; strcpy(string, QP_string_from_atom(atom)); reverse(string); /* reverses string in place */ return QP_atom_from_string(string); } | ?- rev_atom(draw, X). X = ward yes | ?-
QP_atom_from_string()
,
QP_atom_from_padded_string()
fli-p2f-atm