1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00

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 commit is contained in:
Tim Potter 2004-09-02 11:54:13 +00:00 committed by Gerald (Jerry) Carter
parent ad8d54fd7d
commit a6f830cfec

View File

@ -292,9 +292,9 @@ sub ParseArrayPull($$$)
} }
if (util::is_scalar_type($e->{TYPE})) { 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 { } 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"; pidl "\t}\n";
@ -379,7 +379,7 @@ sub ParseElementPullScalar($$$)
} elsif (util::is_builtin_type($e->{TYPE})) { } 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"; pidl "\tndr_pull_$e->{TYPE}(ndr, tree, hf_$e->{NAME}_$e->{TYPE}, $cprefix$var_prefix$e->{NAME});\n";
} else { } 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); end_flags($e);
@ -430,9 +430,9 @@ sub ParseElementPullBuffer($$$)
} elsif (util::is_builtin_type($e->{TYPE})) { } 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"; pidl "\t\tndr_pull_$e->{TYPE}(ndr, tree, hf_$e->{NAME}_$e->{TYPE}, $cprefix$var_prefix$e->{NAME});\n";
} elsif ($e->{POINTERS}) { } 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 { } 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)) { if (util::need_wire_pointer($e)) {
@ -831,6 +831,19 @@ sub type2base($)
return "BASE_NONE"; 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($) sub NeededFunction($)
{ {
my $fn = shift; my $fn = shift;
@ -841,7 +854,7 @@ sub NeededFunction($)
if (util::is_scalar_type($e->{TYPE})) { if (util::is_scalar_type($e->{TYPE})) {
$needed{"hf_$e->{NAME}_$e->{TYPE}"} = { $needed{"hf_$e->{NAME}_$e->{TYPE}"} = {
'name' => $e->{NAME}, 'name' => field2name($e->{NAME}),
'type' => $e->{TYPE}, 'type' => $e->{TYPE},
'ft' => type2ft($e->{TYPE}), 'ft' => type2ft($e->{TYPE}),
'base' => type2base($e->{TYPE}) 'base' => type2base($e->{TYPE})
@ -871,7 +884,7 @@ sub NeededTypedef($)
if (util::is_scalar_type($e->{TYPE})) { if (util::is_scalar_type($e->{TYPE})) {
$needed{"hf_$e->{NAME}_$e->{TYPE}"} = { $needed{"hf_$e->{NAME}_$e->{TYPE}"} = {
'name' => $e->{NAME}, 'name' => field2name($e->{NAME}),
'type' => $e->{TYPE}, 'type' => $e->{TYPE},
'ft' => type2ft($e->{TYPE}), 'ft' => type2ft($e->{TYPE}),
'base' => type2base($e->{TYPE}) 'base' => type2base($e->{TYPE})
@ -944,8 +957,6 @@ sub ParseHeader($$)
pidl "/* parser auto-generated by pidl */\n\n"; pidl "/* parser auto-generated by pidl */\n\n";
pidl "#include \"ndr_$module.h\"\n\n";
foreach my $x (@{$idl}) { foreach my $x (@{$idl}) {
if ($x->{TYPE} eq "INTERFACE") { if ($x->{TYPE} eq "INTERFACE") {
foreach my $d (@{$x->{DATA}}) { foreach my $d (@{$x->{DATA}}) {