summaryrefslogtreecommitdiff
path: root/source4/build/pidl/util.pm
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-01-04 23:25:25 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:08:17 -0500
commit3acf026603944b2de6e55e1d3068f6c9cdde9429 (patch)
tree2bfcfb01cb8e1749d31b305dd3a604b2a26495f5 /source4/build/pidl/util.pm
parent328e260ca9378e83e253f5622ca84ea36b3ebf3a (diff)
downloadsamba-3acf026603944b2de6e55e1d3068f6c9cdde9429.tar.gz
samba-3acf026603944b2de6e55e1d3068f6c9cdde9429.tar.bz2
samba-3acf026603944b2de6e55e1d3068f6c9cdde9429.zip
r4518: added proper support for "typedef enum" in pidl. We can now use enums as types in switch
statements and variable types, and the value will be printed with its string name and value (This used to be commit 1852033f2ec7584657d586e44d25a280959e4d81)
Diffstat (limited to 'source4/build/pidl/util.pm')
-rw-r--r--source4/build/pidl/util.pm20
1 files changed, 20 insertions, 0 deletions
diff --git a/source4/build/pidl/util.pm b/source4/build/pidl/util.pm
index 7293a903d5..0f09a8571f 100644
--- a/source4/build/pidl/util.pm
+++ b/source4/build/pidl/util.pm
@@ -4,6 +4,8 @@
# released under the GNU GPL
package util;
+my %is_enum;
+
#####################################################################
# load a data structure from a file (as saved with SaveStructure)
sub LoadStructure($)
@@ -200,6 +202,20 @@ sub property_matches($$$)
return undef;
}
+my %enum_list;
+
+sub register_enum($)
+{
+ my $name = shift;
+ $enum_list{$name} = 1;
+}
+
+sub is_enum($)
+{
+ my $name = shift;
+ return defined $enum_list{$name}
+}
+
sub is_scalar_type($)
{
my($type) = shift;
@@ -213,6 +229,10 @@ sub is_scalar_type($)
return 1;
}
+ if (is_enum($type)) {
+ return 1;
+ }
+
return 0;
}