Node:Scheme to C, Previous:C to Scheme, Up:Converting data between C and Scheme
|int gh_scm2bool (SCM obj)||Function|
|unsigned long gh_scm2ulong (SCM obj)||Function|
|long gh_scm2long (SCM obj)||Function|
|double gh_scm2double (SCM obj)||Function|
|int gh_scm2char (SCM obj)||Function|
|These routines convert the Scheme object to the given C type.|
|char *gh_scm2newstr (SCM str, int *lenp)||Function|
Given a Scheme string str, return a pointer to a new copy of its
contents, followed by a null byte. If lenp is non-null, set
This function uses malloc to obtain storage for the copy; the caller is responsible for freeing it.
Note that Scheme strings may contain arbitrary data, including null characters. This means that null termination is not a reliable way to determine the length of the returned value. However, the function always copies the complete contents of str, and sets *lenp to the true length of the string (when lenp is non-null).
|void gh_get_substr (SCM str, char *return_str, int *lenp)||Function|
Copy len characters at start from the Scheme string
src to memory at dst. start is an index into
src; zero means the beginning of the string. dst has
already been allocated by the caller.
If start + len is off the end of src, signal an out-of-range error.
|char *gh_symbol2newstr (SCM sym, int *lenp)||Function|
Takes a Scheme symbol and returns a string of the form
This function uses malloc to obtain storage for the returned string; the caller is responsible for freeing it.
|char *gh_scm2chars (SCM vector, chars *result)||Function|
|short *gh_scm2shorts (SCM vector, short *result)||Function|
|long *gh_scm2longs (SCM vector, long *result)||Function|
|float *gh_scm2floats (SCM vector, float *result)||Function|
|double *gh_scm2doubles (SCM vector, double *result)||Function|
Copy the numbers in vector to the array pointed to by result
and return it. If result is NULL, allocate a double array large
vector can be an ordinary vector, a weak vector, or a signed or unsigned uniform vector of the same type as the result array. For chars, vector can be a string or substring. For floats and doubles, vector can contain a mix of inexact and integer values.
If vector is of unsigned type and contains values too large to fit in the signed destination array, those values will be wrapped around, that is, data will be copied as if the destination array was unsigned.