From 8d6249814f45e95a9941dfc7d6d3d2a93811efb0 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 13 May 2006 22:03:44 +0000 Subject: r15587: Generate stubs for the SWIG functions (This used to be commit 746d0a7fa7a43685e6ebb4877bb5459101e51ed1) --- source4/pidl/lib/Parse/Pidl/Samba4.pm | 41 +++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) (limited to 'source4/pidl/lib/Parse/Pidl/Samba4.pm') 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; -- cgit