summaryrefslogtreecommitdiff
path: root/source4/build/pidl/util.pm
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-01-27 06:16:59 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:09:15 -0500
commit3dd17f128831e09c230a8d56e34495d3b31dbacb (patch)
tree962c0357cf7e14bf2c7950461185d0a9d35b1c96 /source4/build/pidl/util.pm
parent00169404eddd859262ef6f0684143efbedcd7bf7 (diff)
downloadsamba-3dd17f128831e09c230a8d56e34495d3b31dbacb.tar.gz
samba-3dd17f128831e09c230a8d56e34495d3b31dbacb.tar.bz2
samba-3dd17f128831e09c230a8d56e34495d3b31dbacb.zip
r5034: - added a type mapping function in pidl, so the type names in our IDL
files don't need to match the type names in the generated headers - with this type mapping we no longer need definitions for the deprecated "int32", "uint8" etc form of types. We can now force everyone to use the standard types int32_t, uint8_t etc. - fixed all the code that used the deprecated types - converted the IDL types "int64" and "uint64" to "dlong" and "udlong". These are the 4 byte aligned 64 bit integers that Microsoft internally define as two 32 bit integers in a structure. After discussions with Ronnie Sahlberg we decided that calling these "int64" was confusing, as it implied a true 8 byte aligned type - fixed all the cases where we incorrectly used things like "NTTIME_hyper" in our C code. The generated API now uses a NTTIME for those. The fact that it is hyper-aligned on the wire is not relevant to the API, and should remain just a IDL property (This used to be commit f86521677d7ff16bdc4815f9524e5286026f10f3)
Diffstat (limited to 'source4/build/pidl/util.pm')
-rw-r--r--source4/build/pidl/util.pm45
1 files changed, 40 insertions, 5 deletions
diff --git a/source4/build/pidl/util.pm b/source4/build/pidl/util.pm
index 48fd9469b8..277c6c0253 100644
--- a/source4/build/pidl/util.pm
+++ b/source4/build/pidl/util.pm
@@ -259,7 +259,7 @@ sub get_bitmap($)
return $bitmap_list{$name};
}
-sub bitmap_type_decl($)
+sub bitmap_type_fn($)
{
my $bitmap = shift;
@@ -273,12 +273,13 @@ sub bitmap_type_decl($)
return "uint32";
}
-sub bitmap_type_fn($)
+sub bitmap_type_decl($)
{
my $bitmap = shift;
- return bitmap_type_decl($bitmap);
+ return map_type(bitmap_type_fn($bitmap));
}
+
my %type_alignments =
(
"char" => 1,
@@ -291,8 +292,8 @@ my %type_alignments =
"long" => 4,
"int32" => 4,
"uint32" => 4,
- "int64" => 4,
- "uint64" => 4,
+ "dlong" => 4,
+ "udlong" => 4,
"NTTIME" => 4,
"NTTIME_1sec" => 4,
"time_t" => 4,
@@ -301,6 +302,7 @@ my %type_alignments =
"WERROR" => 4,
"boolean32" => 4,
"unsigned32" => 4,
+ "hyper" => 8,
"HYPER_T" => 8,
"NTTIME_hyper" => 8
);
@@ -519,5 +521,38 @@ sub make_str($)
return "\"" . $str . "\"";
}
+
+# provide mappings between IDL base types and types in our headers
+my %type_mappings =
+ (
+ "int8" => "int8_t",
+ "uint8" => "uint8_t",
+ "short" => "int16_t",
+ "wchar_t" => "uint16_t",
+ "int16" => "int16_t",
+ "uint16" => "uint16_t",
+ "int32" => "int32_t",
+ "uint32" => "uint32_t",
+ "int64" => "int64_t",
+ "uint64" => "uint64_t",
+ "dlong" => "int64_t",
+ "udlong" => "uint64_t",
+ "hyper" => "uint64_t",
+ "HYPER_T" => "uint64_t",
+ "hyper" => "uint64_t",
+ "NTTIME_1sec" => "NTTIME",
+ "NTTIME_hyper" => "NTTIME"
+ );
+
+# map from a IDL type to a C header type
+sub map_type($)
+{
+ my $name = shift;
+ if (my $ret = $type_mappings{$name}) {
+ return $ret;
+ }
+ return $name;
+}
+
1;