diff options
author | Tim Potter <tpot@samba.org> | 2004-07-27 10:56:34 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:57:43 -0500 |
commit | 42304f6a8f74c8d7d5f8559e5b164301f6cd3c7f (patch) | |
tree | 7d504b8f10a28b0a2e014ab17aa522f154508ec4 /source4/build/pidl | |
parent | 8ded5420e3312f19c85e65eaa7464ce4de160a3f (diff) | |
download | samba-42304f6a8f74c8d7d5f8559e5b164301f6cd3c7f.tar.gz samba-42304f6a8f74c8d7d5f8559e5b164301f6cd3c7f.tar.bz2 samba-42304f6a8f74c8d7d5f8559e5b164301f6cd3c7f.zip |
r1592: Fix up subtrees for non-scalar types instead of hardcoding module subtree.
Arrays currently broken though. )-:
(This used to be commit 8fad205c51d270cdf7f84a8cec6ebea7ccf4cead)
Diffstat (limited to 'source4/build/pidl')
-rw-r--r-- | source4/build/pidl/eparser.pm | 54 |
1 files changed, 37 insertions, 17 deletions
diff --git a/source4/build/pidl/eparser.pm b/source4/build/pidl/eparser.pm index fca359d41d..d279a7c661 100644 --- a/source4/build/pidl/eparser.pm +++ b/source4/build/pidl/eparser.pm @@ -354,7 +354,7 @@ sub ParseElementPullScalar($$) start_flags($e); if (util::has_property($e, "relative")) { - pidl "\tndr_pull_relative(ndr, get_subtree(tree, \"$e->{NAME}\", ndr, ett_dcerpc_$module), ndr_pull_$e->{TYPE});\n"; + pidl "\tndr_pull_relative(ndr, get_subtree(tree, \"$e->{NAME}\", ndr, ett_$e->{TYPE}), ndr_pull_$e->{TYPE});\n"; } elsif (util::is_inline_array($e)) { ParseArrayPull($e, "NDR_SCALARS"); } elsif (util::need_wire_pointer($e)) { @@ -370,14 +370,14 @@ sub ParseElementPullScalar($$) ParseElementPullSwitch($e, $ndr_flags, $switch); } elsif (defined $sub_size) { if (util::is_builtin_type($e->{TYPE})) { - pidl "\tndr_pull_subcontext_fn(ndr, get_subtree(tree, \"$e->{NAME}\", ndr, ett_dcerpc_$module), $sub_size, (ndr_pull_fn_t) ndr_pull_$e->{TYPE});\n"; + pidl "\tndr_pull_subcontext_fn(ndr, get_subtree(tree, \"$e->{NAME}\", ndr, ett_$e->{TYPE}), $sub_size, (ndr_pull_fn_t) ndr_pull_$e->{TYPE});\n"; } else { - pidl "\tndr_pull_subcontext_flags_fn(ndr, get_subtree(tree, \"$e->{NAME}\", ndr, ett_dcerpc_$module), $sub_size, (ndr_pull_flags_fn_t) ndr_pull_$e->{TYPE});\n"; + pidl "\tndr_pull_subcontext_flags_fn(ndr, get_subtree(tree, \"$e->{NAME}\", ndr, ett_$e->{TYPE}), $sub_size, (ndr_pull_flags_fn_t) ndr_pull_$e->{TYPE});\n"; } } elsif (util::is_builtin_type($e->{TYPE})) { pidl "\tndr_pull_$e->{TYPE}(ndr, tree, hf_$e->{NAME}_$e->{TYPE}, &elt_$e->{NAME});\n"; } else { - pidl "\tndr_pull_$e->{TYPE}(ndr, get_subtree(tree, \"$e->{NAME}\", ndr, ett_dcerpc_$module), $ndr_flags);\n"; + pidl "\tndr_pull_$e->{TYPE}(ndr, get_subtree(tree, \"$e->{NAME}\", ndr, ett_$e->{TYPE}), $ndr_flags);\n"; } end_flags($e); @@ -419,17 +419,17 @@ sub ParseElementPullBuffer($$) } elsif (defined $sub_size) { if ($e->{POINTERS}) { if (util::is_builtin_type($e->{TYPE})) { - pidl "\tndr_pull_subcontext_fn(ndr, get_subtree(tree, \"$e->{NAME}\", ndr, ett_dcerpc_$module), $sub_size, _pull_$e->{TYPE});\n"; + pidl "\tndr_pull_subcontext_fn(ndr, get_subtree(tree, \"$e->{NAME}\", ndr, ett_$e->{TYPE}), $sub_size, _pull_$e->{TYPE});\n"; } else { - pidl "\tndr_pull_subcontext_flags_fn(ndr, get_subtree(tree, \"$e->{NAME}\", ndr, ett_dcerpc_$module), $sub_size, ndr_pull_$e->{TYPE});\n"; + pidl "\tndr_pull_subcontext_flags_fn(ndr, get_subtree(tree, \"$e->{NAME}\", ndr, ett_$e->{TYPE}), $sub_size, ndr_pull_$e->{TYPE});\n"; } } } elsif (util::is_builtin_type($e->{TYPE})) { pidl "\tndr_pull_$e->{TYPE}(ndr, tree, hf_$e->{NAME}_$e->{TYPE}, &elt_$e->{NAME});\n"; } elsif ($e->{POINTERS}) { - pidl "\tndr_pull_$e->{TYPE}(ndr, get_subtree(tree, \"$e->{NAME}\", ndr, ett_dcerpc_$module), NDR_SCALARS|NDR_BUFFERS);\n"; + pidl "\tndr_pull_$e->{TYPE}(ndr, get_subtree(tree, \"$e->{NAME}\", ndr, ett_$e->{TYPE}), NDR_SCALARS|NDR_BUFFERS);\n"; } else { - pidl "\tndr_pull_$e->{TYPE}(ndr, get_subtree(tree, \"$e->{NAME}\", ndr, ett_dcerpc_$module), $ndr_flags);\n"; + pidl "\tndr_pull_$e->{TYPE}(ndr, get_subtree(tree, \"$e->{NAME}\", ndr, ett_$e->{TYPE}), $ndr_flags);\n"; } if (util::need_wire_pointer($e)) { @@ -644,7 +644,6 @@ sub ParseTypedefPull($) pidl "*/\n\n"; if ($e->{DATA}->{TYPE} eq "STRUCT") { - pidl "static gint ett_$e->{NAME} = -1;\n\n"; pidl $static . "void ndr_pull_$e->{NAME}(struct e_ndr_pull *ndr, proto_tree *tree, int ndr_flags)"; pidl "\n{\n"; ParseTypePull($e->{DATA}); @@ -652,7 +651,6 @@ sub ParseTypedefPull($) } if ($e->{DATA}->{TYPE} eq "UNION") { - pidl "static gint ett_$e->{NAME} = -1;\n\n"; pidl $static . "void ndr_pull_$e->{NAME}(struct e_ndr_pull *ndr, proto_tree *tree, int ndr_flags, int level)"; pidl "\n{\n"; pidl "\tproto_item *item = NULL;\n"; @@ -868,6 +866,9 @@ sub NeededFunction($) { my $fn = shift; foreach my $e (@{$fn->{DATA}}) { + + if (util::is_scalar_type($e->{TYPE})) { + $needed{"hf_$e->{NAME}_$e->{TYPE}"} = { 'name' => $e->{NAME}, 'type' => $e->{TYPE}, @@ -875,6 +876,9 @@ sub NeededFunction($) 'base' => type2base($e->{TYPE}) }; $e->{PARENT} = $fn; + } else { + $needed{"ett_$e->{TYPE}"} = 1; + } } } @@ -892,17 +896,25 @@ sub NeededTypedef($) for my $e (@{$t->{DATA}->{ELEMENTS}}) { - $needed{"hf_$e->{NAME}_$e->{TYPE}"} = { - 'name' => $e->{NAME}, - 'type' => $e->{TYPE}, - 'ft' => type2ft($e->{TYPE}), - 'base' => type2base($e->{TYPE}) - }; + if (util::is_scalar_type($e->{TYPE})) { + $needed{"hf_$e->{NAME}_$e->{TYPE}"} = { + 'name' => $e->{NAME}, + 'type' => $e->{TYPE}, + 'ft' => type2ft($e->{TYPE}), + 'base' => type2base($e->{TYPE}) + }; + $e->{PARENT} = $t->{DATA}; + if ($needed{"pull_$t->{NAME}"}) { - $needed{"pull_$e->{TYPE}"} = 1; + $needed{"pull_$e->{TYPE}"} = 1; } + } else { + + $needed{"ett_$e->{TYPE}"} = 1; + + } } } if ($t->{DATA}->{TYPE} eq "UNION") { @@ -1033,6 +1045,14 @@ sub Parse($$) pidl "\n"; + # Declarations for ett variables + + foreach my $y (keys(%needed)) { + pidl "static gint $y = -1;\n", if $y =~ /^ett_/; + } + + pidl "\n"; + for my $x (@{$idl}) { ParseInterface($x); } |