summaryrefslogtreecommitdiff
path: root/source4/build
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2004-06-10 06:56:36 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:56:38 -0500
commit0f36c59a95b3e2b63c0be2c4d3e0017c248c02bf (patch)
tree49264f1e62c36864eddd603b640129ad676752ca /source4/build
parent02079ccc2eb83eec3c81aad29c15532c121dfb4c (diff)
downloadsamba-0f36c59a95b3e2b63c0be2c4d3e0017c248c02bf.tar.gz
samba-0f36c59a95b3e2b63c0be2c4d3e0017c248c02bf.tar.bz2
samba-0f36c59a95b3e2b63c0be2c4d3e0017c248c02bf.zip
r1099: Set $module variable to name of module.
Only generate code for module registration if we could find a UUID. Tweaks to get [relative] compiling. (This used to be commit 19442e07d080f4965ece5eacd8724e325266ec0c)
Diffstat (limited to 'source4/build')
-rw-r--r--source4/build/pidl/eparser.pm104
1 files changed, 58 insertions, 46 deletions
diff --git a/source4/build/pidl/eparser.pm b/source4/build/pidl/eparser.pm
index fd2f721f36..562797c9ea 100644
--- a/source4/build/pidl/eparser.pm
+++ b/source4/build/pidl/eparser.pm
@@ -12,7 +12,7 @@ use strict;
my %needed;
my %structs;
-my $module = "samr";
+my $module;
my $if_uuid;
my $if_version;
my $if_endpoints;
@@ -358,7 +358,7 @@ sub ParseElementPullScalar($$$)
start_flags($e);
if (util::has_property($e, "relative")) {
- pidl "\tndr_pull_relative(ndr, (const void **)&$var_prefix$e->{NAME}, sizeof(*$var_prefix$e->{NAME}), (ndr_pull_flags_fn_t)ndr_pull_$e->{TYPE});\n";
+ pidl "\tndr_pull_relative(ndr, ndr_pull_$e->{TYPE});\n";
} elsif (util::is_inline_array($e)) {
ParseArrayPull($e, "r->", "NDR_SCALARS");
} elsif (util::need_wire_pointer($e)) {
@@ -933,6 +933,16 @@ sub Parse($$)
open(OUT, ">$filename") || die "can't open $filename";
+ foreach my $x (@{$idl}) {
+ ($x->{TYPE} eq "MODULEHEADER") &&
+ ModuleHeader($x);
+
+ if ($x->{TYPE} eq "INTERFACE") {
+ $module = $x->{NAME};
+ BuildNeeded($x);
+ }
+ }
+
pidl "/* parser auto-generated by pidl */\n\n";
pidl "#ifdef HAVE_CONFIG_H\n";
pidl "#include \"config.h\"\n";
@@ -954,77 +964,79 @@ sub Parse($$)
pidl "static int hf_array_size = -1;\n";
pidl "static int hf_level = -1;\n";
- foreach my $x (@{$idl}) {
- ($x->{TYPE} eq "MODULEHEADER") &&
- ModuleHeader($x);
-
- if ($x->{TYPE} eq "INTERFACE") {
- BuildNeeded($x);
-
- # Declarations for hf variables
+ # Declarations for hf variables
- foreach my $y (keys(%needed)) {
- pidl "static int $y = -1;\n", if $y =~ /^hf_/;
- }
+ foreach my $y (keys(%needed)) {
+ pidl "static int $y = -1;\n", if $y =~ /^hf_/;
+ }
- ParseInterface($x);
- }
+ for my $x (@{$idl}) {
+ ParseInterface($x);
}
- pidl "static e_uuid_t uuid_dcerpc_$module = {\n";
- pidl "\t0x" . substr($if_uuid, 0, 8);
- pidl ", 0x" . substr($if_uuid, 9, 4);
- pidl ", 0x" . substr($if_uuid, 14, 4) . ",\n";
- pidl "\t{ 0x" . substr($if_uuid, 19, 2);
- pidl ", 0x" . substr($if_uuid, 21, 2);
- pidl ", 0x" . substr($if_uuid, 24, 2);
- pidl ", 0x" . substr($if_uuid, 26, 2);
- pidl ", 0x" . substr($if_uuid, 28, 2);
- pidl ", 0x" . substr($if_uuid, 30, 2);
- pidl ", 0x" . substr($if_uuid, 32, 2);
- pidl ", 0x" . substr($if_uuid, 34, 2) . " }\n";
- pidl "};\n\n";
+ # Only perform module initialisation if we found a uuid
- pidl "static guint16 ver_dcerpc_$module = " . $if_version . ";\n\n";
+ if (defined($if_uuid)) {
+ pidl "static e_uuid_t uuid_dcerpc_$module = {\n";
+ pidl "\t0x" . substr($if_uuid, 0, 8);
+ pidl ", 0x" . substr($if_uuid, 9, 4);
+ pidl ", 0x" . substr($if_uuid, 14, 4) . ",\n";
+ pidl "\t{ 0x" . substr($if_uuid, 19, 2);
+ pidl ", 0x" . substr($if_uuid, 21, 2);
+ pidl ", 0x" . substr($if_uuid, 24, 2);
+ pidl ", 0x" . substr($if_uuid, 26, 2);
+ pidl ", 0x" . substr($if_uuid, 28, 2);
+ pidl ", 0x" . substr($if_uuid, 30, 2);
+ pidl ", 0x" . substr($if_uuid, 32, 2);
+ pidl ", 0x" . substr($if_uuid, 34, 2) . " }\n";
+ pidl "};\n\n";
- pidl "void proto_register_dcerpc_samr(void)\n";
- pidl "{\n";
- pidl "\tstatic hf_register_info hf[] = {\n";
+ pidl "static guint16 ver_dcerpc_$module = " . $if_version . ";\n\n";
+ pidl "void proto_register_dcerpc_$module(void)\n";
+ pidl "{\n";
+
+ }
+ pidl "\tstatic hf_register_info hf[] = {\n";
+
pidl "\t{ &hf_opnum, { \"Operation\", \"$module.opnum\", FT_UINT16, BASE_DEC, NULL, 0x0, \"Operation\", HFILL }},\n";
pidl "\t{ &hf_rc, { \"Return code\", \"$module.rc\", FT_UINT32, BASE_HEX, VALS(NT_errors), 0x0, \"Return status code\", HFILL }},\n";
pidl "\t{ &hf_array_size, { \"Array size\", \"$module.array_size\", FT_UINT32, BASE_DEC, NULL, 0x0, \"Array size\", HFILL }},\n";
pidl "\t{ &hf_level, { \"Level\", \"$module.level\", FT_UINT32, BASE_DEC, NULL, 0x0, \"Level\", HFILL }},\n";
pidl "\t{ &hf_ptr, { \"Pointer\", \"$module.ptr\", FT_UINT32, BASE_HEX, NULL, 0x0, \"Pointer\", HFILL }},\n";
-
+
foreach my $x (keys(%needed)) {
next, if !($x =~ /^hf_/);
-
+
pidl "\t{ &$x,\n";
pidl "\t { \"$needed{$x}{name}\", \"$x\", $needed{$x}{ft}, $needed{$x}{base},\n";
pidl"\t NULL, 0, \"$x\", HFILL }},\n";
}
-
+
pidl "\t};\n\n";
- pidl "\tstatic gint *ett[] = {\n";
+ pidl "\tstatic gint *ett[] = {\n";
pidl "\t\t&ett_dcerpc_$module,\n";
pidl "\t};\n\n";
+
+ if (defined($if_uuid)) {
- pidl "\tproto_dcerpc_$module = proto_register_protocol(\"$module\", \"$module\", \"$module\");\n\n";
+ pidl "\tproto_dcerpc_$module = proto_register_protocol(\"$module\", \"$module\", \"$module\");\n\n";
- pidl "\tproto_register_field_array(proto_dcerpc_$module, hf, array_length (hf));\n";
- pidl "\tproto_register_subtree_array(ett, array_length(ett));\n";
+ pidl "\tproto_register_field_array(proto_dcerpc_$module, hf, array_length (hf));\n";
+ pidl "\tproto_register_subtree_array(ett, array_length(ett));\n";
- pidl "}\n\n";
+ pidl "}\n\n";
- pidl "void proto_reg_handoff_dcerpc_$module(void)\n";
- pidl "{\n";
- pidl "\tdcerpc_init_uuid(proto_dcerpc_$module, ett_dcerpc_$module, \n";
- pidl "\t\t&uuid_dcerpc_$module, ver_dcerpc_$module, \n";
- pidl "\t\tdcerpc_dissectors, hf_opnum);\n";
- pidl "}\n";
+ pidl "void proto_reg_handoff_dcerpc_$module(void)\n";
+ pidl "{\n";
+ pidl "\tdcerpc_init_uuid(proto_dcerpc_$module, ett_dcerpc_$module, \n";
+ pidl "\t\t&uuid_dcerpc_$module, ver_dcerpc_$module, \n";
+ pidl "\t\tdcerpc_dissectors, hf_opnum);\n";
+ pidl "}\n";
+
+ }
close(OUT);
}