diff options
author | Ludovic Courtès <ludo@gnu.org> | 2008-07-05 20:10:44 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2008-07-05 20:16:12 +0200 |
commit | 071bb6a84061dd8fba278219797fd376b0a54e10 (patch) | |
tree | 7010d07119758e684d9c7344a91993e03bb694dc | |
parent | b6137ed741eb0f14a4fb68c98879b91ec8250039 (diff) | |
download | guile-071bb6a84061dd8fba278219797fd376b0a54e10.tar.gz |
Add `scm_c_symbol_length ()'.
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | doc/ref/ChangeLog | 4 | ||||
-rwxr-xr-x | doc/ref/api-data.texi | 5 | ||||
-rw-r--r-- | libguile/ChangeLog | 5 | ||||
-rw-r--r-- | libguile/strings.c | 10 | ||||
-rw-r--r-- | libguile/strings.h | 1 |
6 files changed, 29 insertions, 0 deletions
@@ -39,6 +39,10 @@ indicating length of the `scm_t_option' array. 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 diff --git a/doc/ref/ChangeLog b/doc/ref/ChangeLog index 1eb153987..5812d656c 100644 --- a/doc/ref/ChangeLog +++ b/doc/ref/ChangeLog @@ -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-30 Julian Graham <joolean@gmail.com> * srfi-modules.texi (SRFI-18): New section. diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi index b2b5b076f..e1db2a612 100755 --- a/doc/ref/api-data.texi +++ b/doc/ref/api-data.texi @@ -4647,6 +4647,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 diff --git a/libguile/ChangeLog b/libguile/ChangeLog index f6fcdc61e..0223b0b41 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -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> * posix.h (scm_i_locale_mutex): Don't declare as `SCM_INTERNAL' diff --git a/libguile/strings.c b/libguile/strings.c index c322132fd..c9b08a05b 100644 --- a/libguile/strings.c +++ b/libguile/strings.c @@ -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) { diff --git a/libguile/strings.h b/libguile/strings.h index 04ae552f9..ca5f52cd2 100644 --- a/libguile/strings.h +++ b/libguile/strings.h @@ -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); |