summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2004-05-15 12:26:46 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:53:47 -0500
commitdc0228df6b82a0782ea505755f371a8318d36f9c (patch)
treed0cfc34221fbe56bf4e106d7e8fc3420753b920e
parent82306753e26558d8fd6c1452bfa08ec9b361fba9 (diff)
downloadsamba-dc0228df6b82a0782ea505755f371a8318d36f9c.tar.gz
samba-dc0228df6b82a0782ea505755f371a8318d36f9c.tar.bz2
samba-dc0228df6b82a0782ea505755f371a8318d36f9c.zip
r746: Add entry in proto tree when we don't handle an IDL type.
Start parsing for parsing unions, structs and enums. Don't display field type in display name. (This used to be commit e170d9c3dc5d7abcdba9af98f61f36bb118a96fd)
-rw-r--r--source4/build/pidl/eparser.pm54
1 files changed, 50 insertions, 4 deletions
diff --git a/source4/build/pidl/eparser.pm b/source4/build/pidl/eparser.pm
index 102e05e29d..baad7c6489 100644
--- a/source4/build/pidl/eparser.pm
+++ b/source4/build/pidl/eparser.pm
@@ -63,10 +63,9 @@ sub ParseParameter($)
return $res;
}
- $res .= "\t/* Unhandled IDL type '$p->{TYPE}' in $p->{PARENT}->{NAME} */\n";
+ $res .= "\tproto_tree_add_text(tree, tvb, offset, -1, \"Unhandled IDL type '$p->{TYPE}'\");\n";
return $res;
- # exit(1);
}
#####################################################################
@@ -113,6 +112,51 @@ sub ParseFunction($)
}
#####################################################################
+# parse a function
+sub ParseEnum($$)
+{
+ my($name) = shift;
+ my($enum) = shift;
+
+ return "/* Enum $name */\n\n";
+}
+
+#####################################################################
+# parse a function
+sub ParseStruct($$)
+{
+ my($name) = shift;
+ my($struct) = shift;
+
+ return "/* Struct $name */\n\n";
+}
+
+#####################################################################
+# parse a function
+sub ParseUnion($$)
+{
+ my($name) = shift;
+ my($union) = shift;
+
+ return "/* Union $name */\n\n";
+}
+
+#####################################################################
+# parse a function
+sub ParseTypedef($)
+{
+ my($typedef) = shift;
+ my($data) = $typedef->{DATA};
+ my($res) = "";
+
+ $res .= ParseEnum($typedef->{NAME}, $data), if $data->{TYPE} eq "ENUM";
+ $res .= ParseStruct($typedef->{NAME}, $data), if $data->{TYPE} eq "STRUCT";
+ $res .= ParseUnion($typedef->{NAME}, $data), if $data->{TYPE} eq "UNION";
+
+ return $res;
+}
+
+#####################################################################
# parse the interface definitions
sub Pass2Interface($)
{
@@ -122,6 +166,7 @@ sub Pass2Interface($)
foreach my $d (@{$data}) {
$res .= ParseFunction($d), if $d->{TYPE} eq "FUNCTION";
+ $res .= ParseTypedef($d), if $d->{TYPE} eq "TYPEDEF";
}
return $res;
@@ -226,7 +271,8 @@ EOF
$res .= "static int hf_$hf_name = -1;\n";
$hf_info{$hf_name} = {
'ft' => type2ft($params->{TYPE}),
- 'base' => type2base($params->{TYPE})
+ 'base' => type2base($params->{TYPE}),
+ 'name' => $params->{NAME}
};
}
}
@@ -312,7 +358,7 @@ EOF
foreach my $hf (keys(%hf_info)) {
$hf_register_info .= "\t{ &hf_$hf,\n";
- $hf_register_info .= "\t { \"$hf\", \"$hf\", $hf_info{$hf}{ft}, $hf_info{$hf}{base},\n";
+ $hf_register_info .= "\t { \"$hf_info{$hf}{name}\", \"$hf\", $hf_info{$hf}{ft}, $hf_info{$hf}{base},\n";
$hf_register_info .= "\t NULL, 0, \"$hf\", HFILL }},\n";
}