From c7d465ecaaeb9787a2fc06a85cb1f0ba6f79e86c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20K=C3=B6ppe?= Date: Mon, 30 Jan 2006 18:07:00 +0000 Subject: [PATCH] New string encoding method, "schemify". git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8631 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Source/Swig/misc.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/SWIG/Source/Swig/misc.c b/SWIG/Source/Swig/misc.c index 57354a4e4..b4a4868c7 100644 --- a/SWIG/Source/Swig/misc.c +++ b/SWIG/Source/Swig/misc.c @@ -255,6 +255,21 @@ String *Swig_string_first_lower(String *s) { return ns; } +/* ----------------------------------------------------------------------------- + * Swig_string_schemify() + * + * Replace underscores with dashes, to make identifiers look nice to Schemers. + * + * under_scores -> under-scores + * ----------------------------------------------------------------------------- */ + +String *Swig_string_schemify(String *s) { + String *ns = NewString(s); + Replaceall(ns, "_", "-"); + return ns; +} + + /* ----------------------------------------------------------------------------- * Swig_string_typecode() * @@ -898,6 +913,7 @@ Swig_init() { DohEncoding("mangle", Swig_string_emangle); DohEncoding("command", Swig_string_command); DohEncoding("rxspencer", Swig_string_rxspencer); + DohEncoding("schemify", Swig_string_schemify); /* aliases for the case encoders */ DohEncoding("uppercase", Swig_string_upper); @@ -907,7 +923,6 @@ Swig_init() { DohEncoding("firstuppercase", Swig_string_first_upper); DohEncoding("firstlowercase", Swig_string_first_lower); - /* Initialize the swig keys */ Swig_keys_init();