1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-10 14:00:21 +02:00

Add `scm_c_symbol_length ()'.

This commit is contained in:
Ludovic Courtès 2008-07-05 20:10:44 +02:00
parent 3f324bb3b8
commit 47463c8fd7
6 changed files with 29 additions and 0 deletions

4
NEWS
View file

@ -7,6 +7,10 @@ Please send Guile bug reports to bug-guile@gnu.org.
Changes in 1.8.6 (since 1.8.5)
* New features (see the manual for details)
** New convenience function `scm_c_symbol_length ()'
* Bugs fixed
** Internal `scm_i_' functions now have "hidden" linkage with GCC/ELF

View file

@ -1,3 +1,7 @@
2008-07-05 Ludovic Courtès <ludo@gnu.org>
* api-data.texi (Symbol Primitives): Add `scm_c_symbol_length ()'.
2008-06-28 Ludovic Courtès <ludo@gnu.org>
* api-modules.texi (Using Guile Modules): Substitute "syntax

View file

@ -4640,6 +4640,11 @@ immediately after creating the Scheme string. In certain cases, Guile
can then use @var{str} directly as its internal representation.
@end deftypefn
The size of a symbol can also be obtained from C:
@deftypefn {C Function} size_t scm_c_symbol_length (SCM sym)
Return the number of characters in @var{sym}.
@end deftypefn
Finally, some applications, especially those that generate new Scheme
code dynamically, need to generate symbols for use in the generated

View file

@ -1,3 +1,8 @@
2008-07-05 Ludovic Courtès <ludo@gnu.org>
* strings.c (scm_c_symbol_length): New function.
* strings.h (scm_c_symbol_length): New declaration.
2008-07-04 Ludovic Courtès <ludo@gnu.org>
* __scm.h (SCM_INTERNAL): Add `extern' so that these symbols are

View file

@ -452,6 +452,16 @@ scm_i_symbol_length (SCM sym)
return STRINGBUF_LENGTH (SYMBOL_STRINGBUF (sym));
}
size_t
scm_c_symbol_length (SCM sym)
#define FUNC_NAME "scm_c_symbol_length"
{
SCM_VALIDATE_SYMBOL (1, sym);
return STRINGBUF_LENGTH (SYMBOL_STRINGBUF (sym));
}
#undef FUNC_NAME
const char *
scm_i_symbol_chars (SCM sym)
{

View file

@ -90,6 +90,7 @@ SCM_API SCM scm_string_append (SCM args);
SCM_API SCM scm_c_make_string (size_t len, SCM chr);
SCM_API size_t scm_c_string_length (SCM str);
SCM_API size_t scm_c_symbol_length (SCM sym);
SCM_API SCM scm_c_string_ref (SCM str, size_t pos);
SCM_API void scm_c_string_set_x (SCM str, size_t pos, SCM chr);
SCM_API SCM scm_c_substring (SCM str, size_t start, size_t end);