summaryrefslogtreecommitdiff
path: root/source4/build/pidl/header.pm
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-01-05 15:36:26 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:08:19 -0500
commitd0da601ff78c1df7422e3a558db5a4c4862eb785 (patch)
tree1c1f1fa2893a369e8671de83eec4ba37f7f21e06 /source4/build/pidl/header.pm
parent31de71f0a2fd8cbd9c75c6573a02189178ebabe8 (diff)
downloadsamba-d0da601ff78c1df7422e3a558db5a4c4862eb785.tar.gz
samba-d0da601ff78c1df7422e3a558db5a4c4862eb785.tar.bz2
samba-d0da601ff78c1df7422e3a558db5a4c4862eb785.zip
r4535: add full support for
typedef bitmap { FLAG1 = 0x01 } fooflags; typedef struct { fooflags flags; } metze (This used to be commit 052a7d4f9a3a178149c65a616fdfd87152dff7eb)
Diffstat (limited to 'source4/build/pidl/header.pm')
-rw-r--r--source4/build/pidl/header.pm29
1 files changed, 27 insertions, 2 deletions
diff --git a/source4/build/pidl/header.pm b/source4/build/pidl/header.pm
index 85ccbcd814..15a0bd4276 100644
--- a/source4/build/pidl/header.pm
+++ b/source4/build/pidl/header.pm
@@ -92,7 +92,7 @@ sub HeaderStruct($$)
}
#####################################################################
-# parse a struct
+# parse a enum
sub HeaderEnum($$)
{
my($enum) = shift;
@@ -121,6 +121,26 @@ sub HeaderEnum($$)
$res .= "}";
}
+#####################################################################
+# parse a bitmap
+sub HeaderBitmap($$)
+{
+ my($bitmap) = shift;
+ my($name) = shift;
+
+ util::register_bitmap($bitmap, $name);
+
+ $res .= "\n/* bitmap $name */\n";
+
+ my $els = \@{$bitmap->{ELEMENTS}};
+ foreach my $i (0 .. $#{$els}) {
+ my $e = ${$els}[$i];
+ chomp $e;
+ $res .= "#define $e\n";
+ }
+
+ $res .= "\n";
+}
#####################################################################
# parse a union
@@ -155,6 +175,8 @@ sub HeaderType($$$)
if (ref($data) eq "HASH") {
($data->{TYPE} eq "ENUM") &&
HeaderEnum($data, $name);
+ ($data->{TYPE} eq "BITMAP") &&
+ HeaderBitmap($data, $name);
($data->{TYPE} eq "STRUCT") &&
HeaderStruct($data, $name);
($data->{TYPE} eq "UNION") &&
@@ -165,6 +187,9 @@ sub HeaderType($$$)
$res .= "const char *";
} elsif (util::is_enum($e->{TYPE})) {
$res .= "enum $data";
+ } elsif (util::is_bitmap($e->{TYPE})) {
+ my $bitmap = util::get_bitmap($e->{TYPE});
+ $res .= util::bitmap_type_decl($bitmap);
} elsif (util::is_scalar_type($data)) {
$res .= "$data";
} elsif (util::has_property($e, "switch_is")) {
@@ -180,7 +205,7 @@ sub HeaderTypedef($)
{
my($typedef) = shift;
HeaderType($typedef, $typedef->{DATA}, $typedef->{NAME});
- $res .= ";\n";
+ $res .= ";\n" unless ($typedef->{DATA}->{TYPE} eq "BITMAP");
}
#####################################################################