guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: proposal: scm_string2str() and scm_symbol2str()


From: stefan
Subject: Re: proposal: scm_string2str() and scm_symbol2str()
Date: Fri, 16 Nov 2001 00:06:56 +0100 (CET)

On Wed, 14 Nov 2001, Thien-Thi Nguyen wrote:

> i've just checked in devel/policy/api.text, which generalizes your
> question somewhat, therein (this is how to do it correctly :-).  before
> answering the questions, i'd like to request a list of such kinds of
> functions -- feel free to add the list to api.text directly.

If noone objects I would like to put the following piece into the
"Decisions" section:

 * To have sane memory allocation interface between C and libguile
   put scm_c_free(), scm_c_malloc() and scm_c_realloc() into `gc.[ch]'.

 * Convert and implement these gh_*() functionality:
   gh_scm2newstr() -> 
   char *scm_c_string2str (SCM obj, char *str, size_t *lenp)
   gh_scm2newsymbol() -> 
   char *scm_c_symbol2str (SCM obj, char *str, size_t *lenp)
   gh_get_substr() -> 
   char *scm_c_string2substr (SCM obj, char *str, size_t start, size_t len)
   gh_scm2chars() -> 
   char *scm_c_scm2chars (SCM obj, char *dst) 
   gh_scm2shorts() -> 
   short *scm_2_scm2shorts (SCM obj, short *dst)
   gh_scm2longs() -> 
   long *scm_c_scm2longs (SCM obj, long *dst)
   gh_scm2floats() -> 
   float *scm_c_scm2floats (SCM obj, float *dst)
   gh_scm2doubles() -> 
   double *scm_c_scm2doubles (SCM obj, double *dst)

   Each of these can receive a "destination pointer" and returns it.  If
   this pointer is NULL, the user needs to scm_c_free() the return value
   because it got allocated by scm_c_malloc().

Cheers,
        address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]