pidl:NDR: add ReturnTypeElement() helper function
authorStefan Metzmacher <metze@samba.org>
Tue, 13 Sep 2016 07:06:50 +0000 (09:06 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Wed, 26 Oct 2016 09:20:19 +0000 (11:20 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
pidl/lib/Parse/Pidl/NDR.pm

index 2e48c2a70b335220f091a051f35076b3ab0cee22..4659e312691d0619922dd850d3dab976d436eb1b 100644 (file)
@@ -35,7 +35,7 @@ use vars qw($VERSION);
 $VERSION = '0.01';
 @ISA = qw(Exporter);
 @EXPORT = qw(GetPrevLevel GetNextLevel ContainsDeferred ContainsPipe ContainsString);
-@EXPORT_OK = qw(GetElementLevelTable ParseElement ValidElement align_type mapToScalar ParseType can_contain_deferred is_charset_array);
+@EXPORT_OK = qw(GetElementLevelTable ParseElement ReturnTypeElement ValidElement align_type mapToScalar ParseType can_contain_deferred is_charset_array);
 
 use strict;
 use Parse::Pidl qw(warning fatal);
@@ -805,6 +805,25 @@ sub ParseFunction($$$$)
                };
 }
 
+sub ReturnTypeElement($)
+{
+       my ($fn) = @_;
+
+       return undef unless defined($fn->{RETURN_TYPE});
+
+       my $e = {
+               "NAME" => "result",
+               "TYPE" => $fn->{RETURN_TYPE},
+               "PROPERTIES" => undef,
+               "POINTERS" => 0,
+               "ARRAY_LEN" => [],
+               "FILE" => $fn->{FILE},
+               "LINE" => $fn->{LINE},
+       };
+
+       return ParseElement($e, 0, 0);
+}
+
 sub CheckPointerTypes($$)
 {
        my ($s,$default) = @_;