GNU Info

Info Node: (guile.info)Scheme to C

(guile.info)Scheme to C


Prev: C to Scheme Up: Converting data between C and Scheme
Enter node , (file) or (file)node

Scheme to C
===========

 - Function: 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)
     These routines convert the Scheme object to the given C type.

 - Function: char *gh_scm2newstr (SCM STR, int *LENP)
     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
     `*LENP' to the string's length.

     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).

 - Function: void gh_get_substr (SCM str, char *return_str, int *lenp)
     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.

 - Function: char *gh_symbol2newstr (SCM SYM, int *LENP)
     Takes a Scheme symbol and returns a string of the form
     `"'symbol-name"'.  If LENP is non-null, the string's length is
     returned in `*LENP'.

     This function uses malloc to obtain storage for the returned
     string; the caller is responsible for freeing it.

 - Function: 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)
     Copy the numbers in VECTOR to the array pointed to by RESULT and
     return it.  If RESULT is NULL, allocate a double array large
     enough.

     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.


automatically generated by info2www version 1.2.2.9