Add a whole bunch of chicken runme scripts, and fix the bugs exposed by those scripts

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7155 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
John Lenz 2005-04-15 05:23:14 +00:00
commit b599732cdc
72 changed files with 1085 additions and 412 deletions

View file

@ -7,7 +7,20 @@
namespace std {
class string;
%insert(closprefix) %{ (declare (hide <std-string>)) %}
%nodefault string;
%rename("std-string") string;
class string {
public:
~string() {}
};
%extend string {
char *str;
}
%{
#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 *;
@ -55,4 +68,25 @@ namespace std {
C_word *space = C_alloc (C_SIZEOF_STRING (size));
$result = C_string (&space, size, (char *) $1->c_str());
}
%typemap(varin) string {
if ($input == C_SCHEME_FALSE) {
$1 = std::string();
} else {
char *tempptr;
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 {
int size = $1.size();
C_word *space = C_alloc (C_SIZEOF_STRING (size));
$result = C_string (&space, size, (char *) $1.c_str());
}
}