svn commit: samba r2298 - in branches/SAMBA_4_0/source/build/pidl: .
tpot at samba.org
tpot at samba.org
Sun Sep 12 10:56:11 GMT 2004
Author: tpot
Date: 2004-09-12 10:56:11 +0000 (Sun, 12 Sep 2004)
New Revision: 2298
WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source/build/pidl&rev=2298&nolog=1
Log:
Convert to and from string parameters.
Correct function name used when generating function to convert in
typemap so it is consistent with the others.
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-12 10:50:23 UTC (rev 2297)
+++ branches/SAMBA_4_0/source/build/pidl/swig.pm 2004-09-12 10:56:11 UTC (rev 2298)
@@ -42,21 +42,29 @@
my($e) = shift;
my($prefix) = shift;
my($result) = "";
+ my($obj) = "PyDict_GetItem(obj, PyString_FromString(\"$e->{NAME}\"))";
# Special cases
- if ($e->{TYPE} eq "policy_handle" && $e->{POINTERS} == 1) {
- $result .= "\ts->$prefix$e->{NAME} = policy_handle_from_python(obj);";
+ if (($e->{TYPE} eq "policy_handle" || $e->{TYPE} eq "string") && $e->{POINTERS} == 1) {
+ $result .= "\ts->$prefix$e->{NAME} = $e->{TYPE}_from_python($obj);\n";
return $result;
}
+ if ($e->{TYPE} eq "string" && $e->{POINTERS} == 1) {
+ $result .= "\ts->$prefix$e->{NAME} = policy_handle_from_python($obj);\n";
+ return $result;
+ }
+
+ # Generate conversion for element
+
if (util::is_scalar_type($e->{TYPE})) {
if ($e->{POINTERS} == 0) {
if ($e->{ARRAY_LEN}) {
# pointer to scalar with array len property
$result .= DebugElement($e);
} else {
- $result .= "\ts->$prefix$e->{NAME} = $e->{TYPE}_from_python(obj);\n";
+ $result .= "\ts->$prefix$e->{NAME} = $e->{TYPE}_from_python($obj);\n";
}
} else {
# Pointer to scalar
@@ -83,6 +91,13 @@
return $result;
}
+ if ($e->{TYPE} eq "string" && $e->{POINTERS} == 1) {
+ $result .= "\tPyDict_SetItem(obj, PyString_FromString(\"$e->{NAME}\"), string_to_python(s->$prefix$e->{NAME}));\n";
+ return $result;
+ }
+
+ # Generate conversion for element
+
if (util::is_scalar_type($e->{TYPE})) {
if ($e->{POINTERS} == 0) {
if ($e->{ARRAY_LEN}) {
@@ -111,7 +126,7 @@
$res .= "/* Convert Python dict to struct $fn->{NAME}.in */\n\n";
- $res .= "int python_to_$fn->{NAME}(TALLOC_CTX *mem_ctx, struct $fn->{NAME} *s, PyObject *obj)\n";
+ $res .= "int $fn->{NAME}_from_python(TALLOC_CTX *mem_ctx, struct $fn->{NAME} *s, PyObject *obj)\n";
$res .= "{\n";
foreach my $e (@{$fn->{DATA}}) {
@@ -141,7 +156,7 @@
$res .= "%typemap(in) struct $fn->{NAME} * (struct $fn->{NAME} temp) {\n";
$res .= "\tTALLOC_CTX *mem_ctx = talloc_init(\"typemap(int) $fn->{NAME}\");\n\n";
- $res .= "\tpython_to_$fn->{NAME}(mem_ctx, &temp, \$input);\n";
+ $res .= "\t$fn->{NAME}_from_python(mem_ctx, &temp, \$input);\n";
$res .= "\t\$1 = &temp;\n";
$res .= "}\n\n";
More information about the samba-cvs
mailing list