diff options
author | Stefan Metzmacher <metze@samba.org> | 2005-01-05 15:36:26 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:08:19 -0500 |
commit | d0da601ff78c1df7422e3a558db5a4c4862eb785 (patch) | |
tree | 1c1f1fa2893a369e8671de83eec4ba37f7f21e06 /source4/build/pidl/util.pm | |
parent | 31de71f0a2fd8cbd9c75c6573a02189178ebabe8 (diff) | |
download | samba-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/util.pm')
-rw-r--r-- | source4/build/pidl/util.pm | 83 |
1 files changed, 74 insertions, 9 deletions
diff --git a/source4/build/pidl/util.pm b/source4/build/pidl/util.pm index 0f09a8571f..1b00bdea1b 100644 --- a/source4/build/pidl/util.pm +++ b/source4/build/pidl/util.pm @@ -4,8 +4,6 @@ # released under the GNU GPL package util; -my %is_enum; - ##################################################################### # load a data structure from a file (as saved with SaveStructure) sub LoadStructure($) @@ -216,6 +214,59 @@ sub is_enum($) return defined $enum_list{$name} } +sub enum_type_decl($) +{ + my $e = shift; + return "enum $e->{TYPE}"; +} + +sub enum_type_fn($) +{ + my $e = shift; + return "$e->{TYPE}"; +} + +my %bitmap_list; + +sub register_bitmap($$) +{ + my $bitmap = shift; + my $name = shift; + $bitmap_list{$name} = $bitmap; +} + +sub is_bitmap($) +{ + my $name = shift; + return defined $bitmap_list{$name}; +} + +sub get_bitmap($) +{ + my $name = shift; + return $bitmap_list{$name}; +} + +sub bitmap_type_decl($) +{ + my $bitmap = shift; + + if (util::has_property($bitmap->{PARENT}, "bitmap8bit")) { + return "uint8"; + } elsif (util::has_property($bitmap->{PARENT}, "bitmap16bit")) { + return "uint16"; + } elsif (util::has_property($bitmap->{PARENT}, "bitmap64bit")) { + return "uint64"; + } + return "uint32"; +} + +sub bitmap_type_fn($) +{ + my $bitmap = shift; + return bitmap_type_decl($bitmap); +} + sub is_scalar_type($) { my($type) = shift; @@ -232,7 +283,11 @@ sub is_scalar_type($) if (is_enum($type)) { return 1; } - + + if (is_bitmap($type)) { + return 1; + } + return 0; } @@ -246,19 +301,29 @@ sub type_align($) return 4; } - return 4, if ($type eq "uint32"); - return 4, if ($type eq "long"); - return 2, if ($type eq "short"); return 1, if ($type eq "char"); + return 1, if ($type eq "int8"); return 1, if ($type eq "uint8"); + + return 2, if ($type eq "short"); + return 2, if ($type eq "wchar_t"); + return 2, if ($type eq "int16"); return 2, if ($type eq "uint16"); + + return 4, if ($type eq "long"); + return 4, if ($type eq "int32"); + return 4, if ($type eq "uint32"); + + return 4, if ($type eq "int64"); + return 4, if ($type eq "uint64"); + return 4, if ($type eq "NTTIME"); return 4, if ($type eq "NTTIME_1sec"); return 4, if ($type eq "time_t"); - return 8, if ($type eq "HYPER_T"); - return 2, if ($type eq "wchar_t"); + return 4, if ($type eq "DATA_BLOB"); - return 4, if ($type eq "int32"); + + return 8, if ($type eq "HYPER_T"); # it must be an external type - all we can do is guess return 4; |