guile-devel
[Top][All Lists]
Advanced

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

Re: scm_i_* in Snd


From: Clinton Ebadi
Subject: Re: scm_i_* in Snd
Date: Sun, 01 Jun 2008 17:17:33 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

Clinton Ebadi <address@hidden> writes:

>> Is this okay, and in case not, is there a better way to convert a
>> char* into a guile string?
>
> SCM_API SCM scm_from_locale_string (const char *str);
> SCM_API SCM scm_from_locale_stringn (const char *str, size_t len);
> SCM_API SCM scm_take_locale_string (char *str);
> SCM_API SCM scm_take_locale_stringn (char *str, size_t len);

Err, the other way around

SCM_API char *scm_to_locale_string (SCM str);
SCM_API char *scm_to_locale_stringn (SCM str, size_t *lenp);
SCM_API size_t scm_to_locale_stringbuf (SCM str, char *buf, size_t
                                        max_len);

Granted they all return a fresh string (or store a copy into a
preallocated buffer), but this allows the internal Guile string
representation to be fancier than a byte array if needed by hiding the
internal representation. This will be important when Guile supports
things like Unicode (e.g. like SBCL does by using UCS-32 internally
and converting into an external encoding such as UTF-8 when needed so
as to preserve O(1) string operations and still work with the outside
world).

-- 
                     How can you accept social supression                      
                      This weak state of mind in our time                      
                        I demand release from hypocrisy                        
                 I'd rather die than be held down, forced down                 




reply via email to

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