summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libguile/symbols.c15
-rw-r--r--libguile/symbols.h1
2 files changed, 16 insertions, 0 deletions
diff --git a/libguile/symbols.c b/libguile/symbols.c
index 657723cc6..375ce8cf7 100644
--- a/libguile/symbols.c
+++ b/libguile/symbols.c
@@ -34,6 +34,8 @@
#include "libguile/hashtab.h"
#include "libguile/weaks.h"
#include "libguile/modules.h"
+#include "libguile/read.h"
+#include "libguile/srfi-13.h"
#include "libguile/validate.h"
#include "libguile/symbols.h"
@@ -245,6 +247,19 @@ SCM_DEFINE (scm_string_to_symbol, "string->symbol", 1, 0, 0,
}
#undef FUNC_NAME
+SCM_DEFINE (scm_string_ci_to_symbol, "string-ci->symbol", 1, 0, 0,
+ (SCM str),
+ "Return the symbol whose name is @var{str}. @var{str} is\n"
+ "converted to lowercase before the conversion is done, if Guile\n"
+ "is currently reading symbols case-insensitively.")
+#define FUNC_NAME s_scm_string_ci_to_symbol
+{
+ return scm_string_to_symbol (SCM_CASE_INSENSITIVE_P
+ ? scm_string_downcase(str)
+ : str);
+}
+#undef FUNC_NAME
+
#define MAX_PREFIX_LENGTH 30
SCM_DEFINE (scm_gensym, "gensym", 0, 1, 0,
diff --git a/libguile/symbols.h b/libguile/symbols.h
index a96d786e9..84a8df1f7 100644
--- a/libguile/symbols.h
+++ b/libguile/symbols.h
@@ -41,6 +41,7 @@ SCM_API SCM scm_symbol_interned_p (SCM sym);
SCM_API SCM scm_make_symbol (SCM name);
SCM_API SCM scm_symbol_to_string (SCM s);
SCM_API SCM scm_string_to_symbol (SCM s);
+SCM_API SCM scm_string_ci_to_symbol (SCM s);
SCM_API SCM scm_symbol_fref (SCM s);
SCM_API SCM scm_symbol_pref (SCM s);