mirror of
https://github.com/samba-team/samba.git
synced 2025-12-20 16:23:51 +03:00
r15652: Fix aliases mechanism (fixes #3710)
(This used to be commit 3e89ef0875)
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
76aa75abc6
commit
fda645af50
@@ -37,7 +37,7 @@ $VERSION = '0.01';
|
|||||||
@EXPORT = qw(GetPrevLevel GetNextLevel ContainsDeferred ContainsString);
|
@EXPORT = qw(GetPrevLevel GetNextLevel ContainsDeferred ContainsString);
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use Parse::Pidl::Typelist qw(hasType getType);
|
use Parse::Pidl::Typelist qw(hasType getType expandAlias);
|
||||||
use Parse::Pidl::Util qw(has_property property_matches);
|
use Parse::Pidl::Util qw(has_property property_matches);
|
||||||
|
|
||||||
# Alignment of the built-in scalar types
|
# Alignment of the built-in scalar types
|
||||||
@@ -364,6 +364,8 @@ sub ParseElement($)
|
|||||||
{
|
{
|
||||||
my $e = shift;
|
my $e = shift;
|
||||||
|
|
||||||
|
$e->{TYPE} = expandAlias($e->{TYPE});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
NAME => $e->{NAME},
|
NAME => $e->{NAME},
|
||||||
TYPE => $e->{TYPE},
|
TYPE => $e->{TYPE},
|
||||||
@@ -549,7 +551,7 @@ sub ParseFunction($$$)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($d->{RETURN_TYPE} ne "void") {
|
if ($d->{RETURN_TYPE} ne "void") {
|
||||||
$rettype = $d->{RETURN_TYPE};
|
$rettype = expandAlias($d->{RETURN_TYPE});
|
||||||
}
|
}
|
||||||
|
|
||||||
my $async = 0;
|
my $async = 0;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ package Parse::Pidl::Typelist;
|
|||||||
|
|
||||||
require Exporter;
|
require Exporter;
|
||||||
@ISA = qw(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);
|
use vars qw($VERSION);
|
||||||
$VERSION = '0.01';
|
$VERSION = '0.01';
|
||||||
|
|
||||||
@@ -72,6 +72,29 @@ my %scalars = (
|
|||||||
"ipv4address" => "const char *",
|
"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
|
# map from a IDL type to a C header type
|
||||||
sub mapScalarType($)
|
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($)
|
sub enum_type_fn($)
|
||||||
{
|
{
|
||||||
my $enum = shift;
|
my $enum = shift;
|
||||||
@@ -196,6 +201,7 @@ sub mapType($)
|
|||||||
my $t = shift;
|
my $t = shift;
|
||||||
return "void" unless defined($t);
|
return "void" unless defined($t);
|
||||||
my $dt;
|
my $dt;
|
||||||
|
$t = expandAlias($t);
|
||||||
|
|
||||||
unless ($dt or ($dt = getType($t))) {
|
unless ($dt or ($dt = getType($t))) {
|
||||||
# Best guess
|
# Best guess
|
||||||
@@ -237,6 +243,5 @@ sub LoadIdl($)
|
|||||||
}
|
}
|
||||||
|
|
||||||
RegisterScalars();
|
RegisterScalars();
|
||||||
RegisterAliases();
|
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|||||||
Reference in New Issue
Block a user