summaryrefslogtreecommitdiff
path: root/source4/pidl/lib/Parse/Pidl/Samba4.pm
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-05-13 22:03:44 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:06:01 -0500
commit8d6249814f45e95a9941dfc7d6d3d2a93811efb0 (patch)
tree73a3f7d8c0d05a59606cd1e9ae6ac7f05798c9c4 /source4/pidl/lib/Parse/Pidl/Samba4.pm
parentaa533f3ea0837f531d270ca2e0a9c4aa389fd349 (diff)
downloadsamba-8d6249814f45e95a9941dfc7d6d3d2a93811efb0.tar.gz
samba-8d6249814f45e95a9941dfc7d6d3d2a93811efb0.tar.bz2
samba-8d6249814f45e95a9941dfc7d6d3d2a93811efb0.zip
r15587: Generate stubs for the SWIG functions
(This used to be commit 746d0a7fa7a43685e6ebb4877bb5459101e51ed1)
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;