summaryrefslogtreecommitdiff
path: root/source4/pidl/lib/Parse/Pidl/Typelist.pm
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-05-16 23:49:31 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:08:03 -0500
commitfda645af50ea82c74d51ef76b37a6b38a826c56c (patch)
tree706d6597e5256890a10f55f95b9d02b26cacea06 /source4/pidl/lib/Parse/Pidl/Typelist.pm
parent76aa75abc6dde74d1d8d382fe8d1fa07750a90da (diff)
downloadsamba-fda645af50ea82c74d51ef76b37a6b38a826c56c.tar.gz
samba-fda645af50ea82c74d51ef76b37a6b38a826c56c.tar.bz2
samba-fda645af50ea82c74d51ef76b37a6b38a826c56c.zip
r15652: Fix aliases mechanism (fixes #3710)
(This used to be commit 3e89ef0875c5c8ccaafa9694d27a8043930127e6)
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl/Typelist.pm')
-rw-r--r--source4/pidl/lib/Parse/Pidl/Typelist.pm45
1 files changed, 25 insertions, 20 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Typelist.pm b/source4/pidl/lib/Parse/Pidl/Typelist.pm
index ff8f18ee48..10a1e8136f 100644
--- a/source4/pidl/lib/Parse/Pidl/Typelist.pm
+++ b/source4/pidl/lib/Parse/Pidl/Typelist.pm
@@ -7,7 +7,7 @@ package Parse::Pidl::Typelist;
require Exporter;
@ISA = qw(Exporter);
-@EXPORT_OK = qw(hasType getType mapType scalar_is_reference);
+@EXPORT_OK = qw(hasType getType mapType scalar_is_reference expandAlias);
use vars qw($VERSION);
$VERSION = '0.01';
@@ -72,6 +72,29 @@ my %scalars = (
"ipv4address" => "const char *",
);
+my %aliases = (
+ "error_status_t" => "uint32",
+ "boolean8" => "uint8",
+ "boolean32" => "uint32",
+ "DWORD" => "uint32",
+ "int" => "int32",
+ "WORD" => "uint16",
+ "char" => "uint8",
+ "long" => "int32",
+ "short" => "int16",
+ "HYPER_T" => "hyper",
+ "HRESULT" => "COMRESULT",
+);
+
+sub expandAlias($)
+{
+ my $name = shift;
+
+ return $aliases{$name} if defined($aliases{$name});
+
+ return $name;
+}
+
# map from a IDL type to a C header type
sub mapScalarType($)
{
@@ -148,24 +171,6 @@ sub RegisterScalars()
}
}
-my %aliases = (
- "DWORD" => "uint32",
- "int" => "int32",
- "WORD" => "uint16",
- "char" => "uint8",
- "long" => "int32",
- "short" => "int16",
- "HYPER_T" => "hyper",
- "HRESULT" => "COMRESULT",
-);
-
-sub RegisterAliases()
-{
- foreach (keys %aliases) {
- $typedefs{$_} = $typedefs{$aliases{$_}};
- }
-}
-
sub enum_type_fn($)
{
my $enum = shift;
@@ -196,6 +201,7 @@ sub mapType($)
my $t = shift;
return "void" unless defined($t);
my $dt;
+ $t = expandAlias($t);
unless ($dt or ($dt = getType($t))) {
# Best guess
@@ -237,6 +243,5 @@ sub LoadIdl($)
}
RegisterScalars();
-RegisterAliases();
1;