svn commit: samba r2418 - in branches/SAMBA_4_0/source/build/pidl: .
tpot at samba.org
tpot at samba.org
Sun Sep 19 12:37:33 GMT 2004
Author: tpot
Date: 2004-09-19 12:37:32 +0000 (Sun, 19 Sep 2004)
New Revision: 2418
WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source/build/pidl&rev=2418&nolog=1
Log:
Handle a pointer to a scalar when converting a field from Python.
Handle a pointer to an array of structures when converting to Python.
Modified:
branches/SAMBA_4_0/source/build/pidl/swig.pm
Changeset:
Modified: branches/SAMBA_4_0/source/build/pidl/swig.pm
===================================================================
--- branches/SAMBA_4_0/source/build/pidl/swig.pm 2004-09-19 11:41:19 UTC (rev 2417)
+++ branches/SAMBA_4_0/source/build/pidl/swig.pm 2004-09-19 12:37:32 UTC (rev 2418)
@@ -102,6 +102,7 @@
# Generate conversion for element
if (util::is_scalar_type($e->{TYPE})) {
+
if ($e->{POINTERS} == 0) {
if ($e->{ARRAY_LEN}) {
$result .= ArrayFromPython($e, $prefix);
@@ -109,8 +110,8 @@
$result .= "\ts->$prefix$e->{NAME} = $e->{TYPE}_from_python($obj, \"$e->{NAME}\");\n";
}
} else {
- $result .= "\t// Pointer to scalar\n";
- $result .= DebugField($e);
+ $result .= "\ts->$prefix$e->{NAME} = talloc(mem_ctx, sizeof($e->{TYPE}));\n";
+ $result .= "\t*s->$prefix$e->{NAME} = $e->{TYPE}_from_python($obj, \"$e->{NAME}\");\n";
}
} else {
if ($e->{POINTERS} == 0) {
@@ -137,7 +138,7 @@
my($array_len) = $e->{ARRAY_LEN};
- if ($array_len eq "*") {
+ if ($array_len eq "*" or util::has_property($e, "size_is")) {
$array_len = util::has_property($e, "size_is");
}
@@ -207,7 +208,11 @@
$result .= "\tPyDict_SetItem(obj, PyString_FromString(\"$e->{NAME}\"), $e->{TYPE}_ptr_to_python(mem_ctx, &s->$prefix$e->{NAME}));\n";
}
} else {
- $result .= "\tPyDict_SetItem(obj, PyString_FromString(\"$e->{NAME}\"), $e->{TYPE}_ptr_to_python(mem_ctx, s->$prefix$e->{NAME}));\n";
+ if ($e->{ARRAY_LEN} or util::has_property($e, "size_is")) {
+ $result .= ArrayToPython($e, $prefix);
+ } else {
+ $result .= "\tPyDict_SetItem(obj, PyString_FromString(\"$e->{NAME}\"), $e->{TYPE}_ptr_to_python(mem_ctx, s->$prefix$e->{NAME}));\n";
+ }
}
}
More information about the samba-cvs
mailing list