unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* scm_i_* in Snd
@ 2008-06-01 18:18 Bill Schottstaedt
  0 siblings, 0 replies; 9+ messages in thread
From: Bill Schottstaedt @ 2008-06-01 18:18 UTC (permalink / raw)
  To: guile-devel

> `scm_i_string_chars ()' is used by Mailutils, Lilypond, AutoGen, SND 

I'm not knowingly using any scm_i_* entities in Snd.  I removed the
scm_i_procedure_arity use, and I think the SCM_STRING_CHARS macro
is only used if it is defined.






^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: scm_i_* in Snd
       [not found] <cmu-lmtpd-11096-1212351961-0@mail-imap1.uio.no>
@ 2008-06-01 20:31 ` Kjetil S. Matheussen
  2008-06-01 20:55   ` Clinton Ebadi
  0 siblings, 1 reply; 9+ messages in thread
From: Kjetil S. Matheussen @ 2008-06-01 20:31 UTC (permalink / raw)
  To: guile-devel


Bill Schottstaedt:
>
>> `scm_i_string_chars ()' is used by Mailutils, Lilypond, AutoGen, SND
>
> I'm not knowingly using any scm_i_* entities in Snd.  I removed the
> scm_i_procedure_arity use, and I think the SCM_STRING_CHARS macro
> is only used if it is defined.
>

Well, I'm using scm_i_string_chars in eval-c.scm, so that's probably
explains Ludovic's hit. eval-c.scm contains these lines:

"#ifdef SCM_STRING_CHARS"
"#  define GET_STRING(a) (scm_is_false(a)?NULL:(char*)SCM_STRING_CHARS(a))"
"#else"
"#  define GET_STRING(a) (scm_is_false(a)?NULL:(char*)scm_i_string_chars(a))"
"#endif"

Is this okay, and in case not, is there a better way to convert a char* 
into a guile string?





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: scm_i_* in Snd
  2008-06-01 20:31 ` scm_i_* in Snd Kjetil S. Matheussen
@ 2008-06-01 20:55   ` Clinton Ebadi
  2008-06-01 21:17     ` Clinton Ebadi
  2008-06-02  7:42     ` Sergey Poznyakoff
  0 siblings, 2 replies; 9+ messages in thread
From: Clinton Ebadi @ 2008-06-01 20:55 UTC (permalink / raw)
  To: Kjetil S. Matheussen; +Cc: guile-devel

"Kjetil S. Matheussen" <k.s.matheussen@notam02.no> writes:

> Bill Schottstaedt:
>>
>>> `scm_i_string_chars ()' is used by Mailutils, Lilypond, AutoGen, SND
>>
>> I'm not knowingly using any scm_i_* entities in Snd.  I removed the
>> scm_i_procedure_arity use, and I think the SCM_STRING_CHARS macro
>> is only used if it is defined.
>>
>
> Well, I'm using scm_i_string_chars in eval-c.scm, so that's probably
> explains Ludovic's hit. eval-c.scm contains these lines:
>
> "#ifdef SCM_STRING_CHARS"
> "#  define GET_STRING(a) (scm_is_false(a)?NULL:(char*)SCM_STRING_CHARS(a))"
> "#else"
> "#  define GET_STRING(a) (scm_is_false(a)?NULL:(char*)scm_i_string_chars(a))"
> "#endif"
>
> 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);

-- 
                       No seed of hope nor ray of light,                       
                    Scant succour from the blighted epoch.                     
                         Rise like Socrates and fight;                         
                    Take hate's chalice laced with hemlock.                    




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: scm_i_* in Snd
  2008-06-01 20:55   ` Clinton Ebadi
@ 2008-06-01 21:17     ` Clinton Ebadi
  2008-06-02  7:42     ` Sergey Poznyakoff
  1 sibling, 0 replies; 9+ messages in thread
From: Clinton Ebadi @ 2008-06-01 21:17 UTC (permalink / raw)
  To: guile-devel

Clinton Ebadi <clinton@unknownlamer.org> 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                 




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: scm_i_* in Snd
  2008-06-01 20:55   ` Clinton Ebadi
  2008-06-01 21:17     ` Clinton Ebadi
@ 2008-06-02  7:42     ` Sergey Poznyakoff
  2008-06-02  9:52       ` Ludovic Courtès
  1 sibling, 1 reply; 9+ messages in thread
From: Sergey Poznyakoff @ 2008-06-02  7:42 UTC (permalink / raw)
  To: Clinton Ebadi; +Cc: guile-devel, Kjetil S. Matheussen

Clinton Ebadi <clinton@unknownlamer.org> ha escrit:

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

That's great, but what if I need to get a "raw" string contents,
that is a string of bytes as it is?

Regards,
Sergey




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: scm_i_* in Snd
  2008-06-02  7:42     ` Sergey Poznyakoff
@ 2008-06-02  9:52       ` Ludovic Courtès
  2008-06-04  3:43         ` Han-Wen Nienhuys
  0 siblings, 1 reply; 9+ messages in thread
From: Ludovic Courtès @ 2008-06-02  9:52 UTC (permalink / raw)
  To: guile-devel

Hi,

"Sergey Poznyakoff" <gray@gnu.org.ua> writes:

> That's great, but what if I need to get a "raw" string contents,
> that is a string of bytes as it is?

"Raw string contents" is undefined, as Clinton said.  I could be
whatever internal representation Guile chooses.

What application or issue do you have in mind?

Thanks,
Ludovic.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: scm_i_* in Snd
       [not found] <cmu-lmtpd-30334-1212422819-0@mail-imap1.uio.no>
@ 2008-06-03 22:42 ` Kjetil S. Matheussen
  0 siblings, 0 replies; 9+ messages in thread
From: Kjetil S. Matheussen @ 2008-06-03 22:42 UTC (permalink / raw)
  To: guile-devel



Clinton Ebadi;
>
> Clinton Ebadi <clinton@unknownlamer.org> 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);
>

Thanks for both answers. First time you answered my question,
second time you answered what I wanted to know. :-)





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: scm_i_* in Snd
  2008-06-02  9:52       ` Ludovic Courtès
@ 2008-06-04  3:43         ` Han-Wen Nienhuys
  2008-06-04  7:27           ` Ludovic Courtès
  0 siblings, 1 reply; 9+ messages in thread
From: Han-Wen Nienhuys @ 2008-06-04  3:43 UTC (permalink / raw)
  To: guile-devel


Ludovic Courtès escreveu:
>> That's great, but what if I need to get a "raw" string contents,
>> that is a string of bytes as it is?
> 
> "Raw string contents" is undefined, as Clinton said.  I could be
> whatever internal representation Guile chooses.

Please explain what the canonical representation for a byte array
is. Are we expected to do all our 8-bit data manipulations on uniform
vectors or similar?

-- 
 Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: scm_i_* in Snd
  2008-06-04  3:43         ` Han-Wen Nienhuys
@ 2008-06-04  7:27           ` Ludovic Courtès
  0 siblings, 0 replies; 9+ messages in thread
From: Ludovic Courtès @ 2008-06-04  7:27 UTC (permalink / raw)
  To: guile-devel

Hi,

Han-Wen Nienhuys <hanwen@xs4all.nl> writes:

> Ludovic Courtès escreveu:
>>> That's great, but what if I need to get a "raw" string contents,
>>> that is a string of bytes as it is?
>> 
>> "Raw string contents" is undefined, as Clinton said.  I could be
>> whatever internal representation Guile chooses.
>
> Please explain what the canonical representation for a byte array
> is. Are we expected to do all our 8-bit data manipulations on uniform
> vectors or similar?

I'm not sure I understand your question.

As suggested earlier, strings are *not* "byte arrays".  In the future,
we will (hopefully) support Unicode, and we'll have to choose one or
several internal representations, which we do not want to expose so as
to keep freedom precisely about what implementation strategy and string
representation we choose.

The manual reads this:

  Right now, Guile simply equates Scheme characters and bytes, ignoring
  the possibility of multi-byte encodings completely.  This will change
  in the future, where Guile will use Unicode codepoints as its
  characters and UTF-8 or some other encoding as its internal encoding.
  When you exclusively use the functions listed in this section, you are
  `future-proof'.

  http://www.gnu.org/software/guile/manual/html_node/Conversion-to_002ffrom-C.html

Thanks,
Ludovic.





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-06-04  7:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cmu-lmtpd-11096-1212351961-0@mail-imap1.uio.no>
2008-06-01 20:31 ` scm_i_* in Snd Kjetil S. Matheussen
2008-06-01 20:55   ` Clinton Ebadi
2008-06-01 21:17     ` Clinton Ebadi
2008-06-02  7:42     ` Sergey Poznyakoff
2008-06-02  9:52       ` Ludovic Courtès
2008-06-04  3:43         ` Han-Wen Nienhuys
2008-06-04  7:27           ` Ludovic Courtès
     [not found] <cmu-lmtpd-30334-1212422819-0@mail-imap1.uio.no>
2008-06-03 22:42 ` Kjetil S. Matheussen
2008-06-01 18:18 Bill Schottstaedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).