From dc0228df6b82a0782ea505755f371a8318d36f9c Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Sat, 15 May 2004 12:26:46 +0000 Subject: 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) --- source4/build/pidl/eparser.pm | 54 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 4 deletions(-) (limited to 'source4/build/pidl/eparser.pm') 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); } ##################################################################### @@ -112,6 +111,51 @@ sub ParseFunction($) return $res; } +##################################################################### +# 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"; } -- cgit