diff options
author | Tim Potter <tpot@samba.org> | 2004-09-02 11:54:13 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:58:29 -0500 |
commit | c6dd8f9c9a919c52fe6583277bbe07f2c6c72dc7 (patch) | |
tree | b99f70d45caa71dbadfd072682cb072507a86f89 /source4/build | |
parent | 3a899d9a92923b93f60a0b83507775ad052624b4 (diff) | |
download | samba-c6dd8f9c9a919c52fe6583277bbe07f2c6c72dc7.tar.gz samba-c6dd8f9c9a919c52fe6583277bbe07f2c6c72dc7.tar.bz2 samba-c6dd8f9c9a919c52fe6583277bbe07f2c6c72dc7.zip |
r2183: Tidy up naming of ethereal fields. The field names are taken from the
structure elements with underscores replaced with spaces and words
capitalised.
Fix small buglet where we confuse the name of the interface with the name
of the idl file.
Just discovered security descriptors don't display property anymore. )-:
(This used to be commit a6f830cfecee9ec256924aa9df0cb1503b2072ab)
Diffstat (limited to 'source4/build')
-rw-r--r-- | source4/build/pidl/eparser.pm | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/source4/build/pidl/eparser.pm b/source4/build/pidl/eparser.pm index 7d2ac1df1a..faaf34fe27 100644 --- a/source4/build/pidl/eparser.pm +++ b/source4/build/pidl/eparser.pm @@ -292,9 +292,9 @@ sub ParseArrayPull($$$) } if (util::is_scalar_type($e->{TYPE})) { - pidl "\t\tndr_pull_array_$e->{TYPE}(ndr, $ndr_flags, tree, \"$e->{NAME}\", hf_$e->{NAME}_$e->{TYPE}, $var_prefix$e->{NAME}, $size);\n"; + pidl "\t\tndr_pull_array_$e->{TYPE}(ndr, $ndr_flags, tree, \"" . field2name($e->{NAME}) . "\", hf_$e->{NAME}_$e->{TYPE}, $var_prefix$e->{NAME}, $size);\n"; } else { - pidl "\t\tndr_pull_array(ndr, $ndr_flags, tree, \"$e->{NAME}\", (void **)$var_prefix$e->{NAME}, sizeof($var_prefix$e->{NAME}\[0]), $size, (ndr_pull_flags_fn_t)ndr_pull_$e->{TYPE});\n"; + pidl "\t\tndr_pull_array(ndr, $ndr_flags, tree, \"" . field2name($e->{NAME}) . "\", (void **)$var_prefix$e->{NAME}, sizeof($var_prefix$e->{NAME}\[0]), $size, (ndr_pull_flags_fn_t)ndr_pull_$e->{TYPE});\n"; } pidl "\t}\n"; @@ -379,7 +379,7 @@ sub ParseElementPullScalar($$$) } elsif (util::is_builtin_type($e->{TYPE})) { pidl "\tndr_pull_$e->{TYPE}(ndr, tree, hf_$e->{NAME}_$e->{TYPE}, $cprefix$var_prefix$e->{NAME});\n"; } else { - pidl "\tndr_pull_$e->{TYPE}(ndr, $ndr_flags, get_subtree(tree, \"$e->{NAME}\", ndr, ett_$e->{TYPE}), $cprefix$var_prefix$e->{NAME});\n"; + pidl "\tndr_pull_$e->{TYPE}(ndr, $ndr_flags, get_subtree(tree, \"" . field2name($e->{NAME}) . "\", ndr, ett_$e->{TYPE}), $cprefix$var_prefix$e->{NAME});\n"; } end_flags($e); @@ -430,9 +430,9 @@ sub ParseElementPullBuffer($$$) } elsif (util::is_builtin_type($e->{TYPE})) { pidl "\t\tndr_pull_$e->{TYPE}(ndr, tree, hf_$e->{NAME}_$e->{TYPE}, $cprefix$var_prefix$e->{NAME});\n"; } elsif ($e->{POINTERS}) { - pidl "\t\tndr_pull_$e->{TYPE}(ndr, NDR_SCALARS|NDR_BUFFERS, get_subtree(tree, \"$e->{NAME}\", ndr, ett_$e->{TYPE}), $cprefix$var_prefix$e->{NAME});\n"; + pidl "\t\tndr_pull_$e->{TYPE}(ndr, NDR_SCALARS|NDR_BUFFERS, get_subtree(tree, \"" . field2name($e->{NAME}) . "\", ndr, ett_$e->{TYPE}), $cprefix$var_prefix$e->{NAME});\n"; } else { - pidl "\t\tndr_pull_$e->{TYPE}(ndr, $ndr_flags, get_subtree(tree, \"$e->{NAME}\", ndr, ett_$e->{TYPE}), $cprefix$var_prefix$e->{NAME});\n"; + pidl "\t\tndr_pull_$e->{TYPE}(ndr, $ndr_flags, get_subtree(tree, \"" . field2name($e->{NAME}) . "\", ndr, ett_$e->{TYPE}), $cprefix$var_prefix$e->{NAME});\n"; } if (util::need_wire_pointer($e)) { @@ -831,6 +831,19 @@ sub type2base($) return "BASE_NONE"; } +# Convert a IDL structure field name (e.g access_mask) to a prettier +# string like 'Access Mask'. + +sub field2name($) +{ + my($field) = shift; + + $field =~ s/_/ /g; # Replace underscores with spaces + $field =~ s/(\w+)/\u\L$1/g; # Capitalise each word + + return $field; +} + sub NeededFunction($) { my $fn = shift; @@ -841,7 +854,7 @@ sub NeededFunction($) if (util::is_scalar_type($e->{TYPE})) { $needed{"hf_$e->{NAME}_$e->{TYPE}"} = { - 'name' => $e->{NAME}, + 'name' => field2name($e->{NAME}), 'type' => $e->{TYPE}, 'ft' => type2ft($e->{TYPE}), 'base' => type2base($e->{TYPE}) @@ -871,7 +884,7 @@ sub NeededTypedef($) if (util::is_scalar_type($e->{TYPE})) { $needed{"hf_$e->{NAME}_$e->{TYPE}"} = { - 'name' => $e->{NAME}, + 'name' => field2name($e->{NAME}), 'type' => $e->{TYPE}, 'ft' => type2ft($e->{TYPE}), 'base' => type2base($e->{TYPE}) @@ -944,8 +957,6 @@ sub ParseHeader($$) pidl "/* parser auto-generated by pidl */\n\n"; - pidl "#include \"ndr_$module.h\"\n\n"; - foreach my $x (@{$idl}) { if ($x->{TYPE} eq "INTERFACE") { foreach my $d (@{$x->{DATA}}) { |