diff --git a/SWIG/Lib/guile/std_string.i b/SWIG/Lib/guile/std_string.i index 3272592bd..588976acc 100644 --- a/SWIG/Lib/guile/std_string.i +++ b/SWIG/Lib/guile/std_string.i @@ -49,6 +49,16 @@ namespace std { } } + %typemap(in) string * (char* tempptr) { + if (gh_string_p($input)) { + tempptr = SWIG_scm2str($input); + $1 = new std::string(tempptr); + if (tempptr) SWIG_free(tempptr); + } else { + SWIG_exception(SWIG_TypeError, "string expected"); + } + } + %typemap(out) string { $result = gh_str02scm($1.c_str()); } @@ -57,4 +67,22 @@ namespace std { $result = gh_str02scm($1->c_str()); } + %typemap(out) string * { + $result = gh_str02scm($1->c_str()); + } + + %typemap(varin) string { + if (gh_string_p($input)) { + char *tempptr = SWIG_scm2str($input); + $1 = std::string(tempptr); + if (tempptr) SWIG_free(tempptr); + } else { + SWIG_exception(SWIG_TypeError, "string expected"); + } + } + + %typemap(varout) string { + $result = gh_str02scm($1.c_str()); + } + }