// SWIG typemaps for std::string
// copied from the guile std_string.i and modified
%insert(closprefix) %{ (declare (hide <std-string>)) %}
%rename("std-string") string;
#define std_string_str_get(s) ((char *)((s)->c_str()))
#define std_string_str_set(s,v) (s->assign((char *)(v)))
%typemap(typecheck) string = char *;
%typemap(typecheck) const string & = char *;
%typemap(in) string (char* tempptr) {
if ($input == C_SCHEME_FALSE) {
if (!C_swig_is_string ($input)) {
swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE,
"Argument #$argnum is not a string");
tempptr = SWIG_MakeString($input);
$1 = std::string(tempptr);
if (tempptr) SWIG_free(tempptr);
%typemap(in) const string& (std::string temp,
if ($input == C_SCHEME_FALSE) {
if (!C_swig_is_string ($input)) {
swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE,
"Argument #$argnum is not a string");
tempptr = SWIG_MakeString($input);
temp = std::string(tempptr);
if (tempptr) SWIG_free(tempptr);
C_word *space = C_alloc (C_SIZEOF_STRING (size));
$result = C_string (&space, size, (char *) $1.c_str());
%typemap(out) const string& {
C_word *space = C_alloc (C_SIZEOF_STRING (size));
$result = C_string (&space, size, (char *) $1->c_str());
if ($input == C_SCHEME_FALSE) {
if (!C_swig_is_string ($input)) {
swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE,
"Argument #$argnum is not a string");
tempptr = SWIG_MakeString($input);
$1 = std::string(tempptr);
if (tempptr) SWIG_free(tempptr);
%typemap(varout) string {
C_word *space = C_alloc (C_SIZEOF_STRING (size));
$result = C_string (&space, size, (char *) $1.c_str());