summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2001-11-26 05:27:32 +0000
committerTim Potter <tpot@samba.org>2001-11-26 05:27:32 +0000
commit07aed4b599ebd5436a0005804ce800aa46ad5ff5 (patch)
treebc20a65e7adefab5ce7c157642e7f386d6d0c793
parenta402ea46abe18ba689f0f06ddcd617fdcd645a75 (diff)
downloadsamba-07aed4b599ebd5436a0005804ce800aa46ad5ff5.tar.gz
samba-07aed4b599ebd5436a0005804ce800aa46ad5ff5.tar.bz2
samba-07aed4b599ebd5436a0005804ce800aa46ad5ff5.zip
Start generating code for unions.
(This used to be commit ac71046754b3a4bee53dab64ed73c176074482a0)
-rw-r--r--source4/build/pidl/eparser.pm27
1 files changed, 22 insertions, 5 deletions
diff --git a/source4/build/pidl/eparser.pm b/source4/build/pidl/eparser.pm
index 835173a66f..672768d457 100644
--- a/source4/build/pidl/eparser.pm
+++ b/source4/build/pidl/eparser.pm
@@ -80,9 +80,17 @@ sub ParseStruct($)
sub ParseUnionElement($)
{
my($element) = shift;
- $res .= "[case($element->{CASE})] ";
- ParseElement($element->{DATA});
- $res .= ";\n";
+
+# $res .= "void prs_$element->{DATA}->{TYPE}()\n{\n";
+
+# $res .= "}\n\n";
+
+ $res .= "\tcase $element->{DATA}->{NAME}: \n";
+ $res .= "\t\tprs_$element->{DATA}->{TYPE}();\n\t\tbreak;\n";
+
+# $res .= "[case($element->{CASE})] ";
+# ParseElement($element->{DATA});
+# $res .= ";\n";
}
#####################################################################
@@ -90,12 +98,17 @@ sub ParseUnionElement($)
sub ParseUnion($)
{
my($union) = shift;
+
+# print Dumper($union);
+
+ $res .= "\tswitch (level) {\n";
+
(defined $union->{PROPERTIES}) && ParseProperties($union->{PROPERTIES});
- $res .= "union {\n";
foreach my $e (@{$union->{DATA}}) {
ParseUnionElement($e);
}
- $res .= "}";
+
+ $res .= "\t}\n";
}
#####################################################################
@@ -103,6 +116,9 @@ sub ParseUnion($)
sub ParseType($)
{
my($data) = shift;
+
+ print Dumper $data;
+
if (ref($data) eq "HASH") {
($data->{TYPE} eq "STRUCT") &&
ParseStruct($data);
@@ -118,6 +134,7 @@ sub ParseType($)
sub ParseTypedef($)
{
my($typedef) = shift;
+
$res .= "void prs_$typedef->{NAME}(void)\n{\n";
ParseType($typedef->{DATA});
$res .= "}\n\n";