Enable Perl automatic stringification (see 2004/05/13 post from J.Slade)
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5909 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
fea32002a2
commit
f6a474cafa
1 changed files with 9 additions and 11 deletions
|
|
@ -28,24 +28,22 @@ namespace std {
|
||||||
%typemap(typecheck) const string & = char *;
|
%typemap(typecheck) const string & = char *;
|
||||||
|
|
||||||
%typemap(in) string {
|
%typemap(in) string {
|
||||||
if (!SvPOK((SV*) $input)) {
|
STRLEN len;
|
||||||
SWIG_croak("Type error in argument $argnum of $symname. "
|
const char *ptr = SvPV($input, len);
|
||||||
"Expected a string");
|
if (!ptr) {
|
||||||
|
SWIG_croak("Undefined variable in argument $argnum of $symname.");
|
||||||
} else {
|
} else {
|
||||||
STRLEN len;
|
|
||||||
const char *ptr = SvPV($input, len);
|
|
||||||
$1.assign(ptr, len);
|
$1.assign(ptr, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(in) string *INPUT(std::string temp),
|
%typemap(in) string *INPUT(std::string temp),
|
||||||
const string & (std::string temp) {
|
const string & (std::string temp) {
|
||||||
if (!SvPOK((SV*) $input)) {
|
STRLEN len;
|
||||||
SWIG_croak("Type error in argument $argnum of $symname. "
|
const char *ptr = SvPV($input, len);
|
||||||
"Expected a string");
|
if (!ptr) {
|
||||||
|
SWIG_croak("Undefined variable in argument $argnum of $symname.");
|
||||||
} else {
|
} else {
|
||||||
STRLEN len;
|
|
||||||
const char *ptr = SvPV($input, len);
|
|
||||||
temp.assign(ptr, len);
|
temp.assign(ptr, len);
|
||||||
$1 = &temp;
|
$1 = &temp;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue