diff options
author | Tim Potter <tpot@samba.org> | 2004-09-10 12:18:56 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:58:37 -0500 |
commit | b79d97414db99ddd83b6de6390080aa56e0d5ae3 (patch) | |
tree | 3dd815669b0adb0834d7725c90ea218edf81218e /source4 | |
parent | 91222c6029274623d8f595dbedfa06e5fa7830a8 (diff) | |
download | samba-b79d97414db99ddd83b6de6390080aa56e0d5ae3.tar.gz samba-b79d97414db99ddd83b6de6390080aa56e0d5ae3.tar.bz2 samba-b79d97414db99ddd83b6de6390080aa56e0d5ae3.zip |
r2277: Generate stubs for input and output typemaps.
(This used to be commit 69710bbcb8123e5f9cb882723350506e77307419)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/build/pidl/swig.pm | 55 |
1 files changed, 45 insertions, 10 deletions
diff --git a/source4/build/pidl/swig.pm b/source4/build/pidl/swig.pm index 71b28ccfb7..459826dd9d 100644 --- a/source4/build/pidl/swig.pm +++ b/source4/build/pidl/swig.pm @@ -15,17 +15,21 @@ sub ParseFunction($) { my($fn) = shift; -# print Dumper($fn); - # Input typemap $res .= "%typemap(in) struct $fn->{NAME} * (struct $fn->{NAME} temp) {\n"; - $res .= "\tif (!PyDict_Check(\$input)) {\n"; - $res .= "\t\tPyErr_SetString(PyExc_TypeError, \"dict arg expected\");\n"; - $res .= "\t\treturn NULL;\n"; - $res .= "\t}\n\n"; - $res .= "\tmemset(&temp, 0, sizeof(temp));\n\n"; - $res .= "\t/* store input params in dict */\n\n"; +# $res .= "\tif (!PyDict_Check(\$input)) {\n"; +# $res .= "\t\tPyErr_SetString(PyExc_TypeError, \"dict arg expected\");\n"; +# $res .= "\t\treturn NULL;\n"; +# $res .= "\t}\n\n"; + $res .= "\tmemset(&temp, 0, sizeof(temp));\n"; +# foreach my $e (@{$fn->{DATA}}) { +# if (util::has_property($e, "in")) { +# $res .= "\ttemp.in.$e->{NAME} = $e->{TYPE}_from_python(PyDict_GetItem(\$input, PyString_FromString(\"$e->{NAME}\")));\n"; +# } +# } + +# $res .= "\n"; $res .= "\t\$1 = &temp;\n"; $res .= "}\n\n"; @@ -40,8 +44,16 @@ sub ParseFunction($) $res .= "\t\treturn NULL;\n"; $res .= "\t}\n"; $res .= "\n"; - $res .= "\tdict = PyDict_New();\n\n"; - $res .= "\t/* store output params in dict */\n\n"; + $res .= "\tdict = PyDict_New();\n"; + +# foreach my $e (@{$fn->{DATA}}) { +# if (util::has_property($e, "out")) { +# $res .= "\t// PyDict_SetItem(dict, PyString_FromString(\"$e->{NAME}\"),\n"; +# $res .= "\t//\t$e->{TYPE}_to_python(\$1->out.$e->{NAME}));\n"; +# } +# } + + $res .= "\n"; $res .= "\tresultobj = dict;\n"; $res .= "}\n\n"; @@ -51,12 +63,35 @@ sub ParseFunction($) $res .= "$fn->{RETURN_TYPE} dcerpc_$fn->{NAME}(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $fn->{NAME} *r);\n\n"; } +sub ParseStruct($) +{ + my($s) = shift; + + $res .= "%{\n\n"; + $res .= "\t/* $s->{NAME} */\n\n"; + + foreach my $e (@{$s->{DATA}{ELEMENTS}}) { + } + + $res .= "\n%}\n\n"; +} + +sub ParseTypedef($) +{ + my($t) = shift; + + foreach my $e ($t) { + ($e->{DATA}{TYPE} eq "STRUCT") && ParseStruct($e); + } +} + sub ParseInheritedData($) { my($data) = shift; foreach my $e (@{$data}) { ($e->{TYPE} eq "FUNCTION") && ParseFunction($e); + ($e->{TYPE} eq "TYPEDEF") && ParseTypedef($e); } } |