summaryrefslogtreecommitdiff
path: root/source4/pidl/lib/Parse/Pidl/Samba4.pm
diff options
context:
space:
mode:
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl/Samba4.pm')
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4.pm41
1 files changed, 39 insertions, 2 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4.pm b/source4/pidl/lib/Parse/Pidl/Samba4.pm
index 0a284aa85b..2d710f3eb6 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4.pm
@@ -7,9 +7,10 @@ package Parse::Pidl::Samba4;
require Exporter;
@ISA = qw(Exporter);
-@EXPORT = qw(is_intree choose_header);
+@EXPORT = qw(is_intree choose_header DeclLong);
-use Parse::Pidl::Util qw(has_property);
+use Parse::Pidl::Util qw(has_property is_constant);
+use Parse::Pidl::Typelist qw(mapType scalar_is_reference);
use strict;
use vars qw($VERSION);
@@ -29,4 +30,40 @@ sub choose_header($$)
return "#include <$out>";
}
+sub DeclLong($)
+{
+ my($element) = shift;
+ my $ret = "";
+
+ if (has_property($element, "represent_as")) {
+ $ret.=mapType($element->{PROPERTIES}->{represent_as})." ";
+ } else {
+ if (has_property($element, "charset")) {
+ $ret.="const char";
+ } else {
+ $ret.=mapType($element->{TYPE});
+ }
+
+ $ret.=" ";
+ my $numstar = $element->{ORIGINAL}->{POINTERS};
+ if ($numstar >= 1) {
+ $numstar-- if scalar_is_reference($element->{TYPE});
+ }
+ foreach (@{$element->{ORIGINAL}->{ARRAY_LEN}})
+ {
+ next if is_constant($_) and
+ not has_property($element, "charset");
+ $numstar++;
+ }
+ $ret.="*" foreach (1..$numstar);
+ }
+ $ret.=$element->{NAME};
+ foreach (@{$element->{ARRAY_LEN}}) {
+ next unless (is_constant($_) and not has_property($element, "charset"));
+ $ret.="[$_]";
+ }
+
+ return $ret;
+}
+
1;