summaryrefslogtreecommitdiff
path: root/source4/build
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-06-01 00:00:50 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:21 -0500
commit03c2d642a620380d96a9e745ceb1cd19ffea2160 (patch)
tree351938707b57f8f3ed29a966d48d858f562d250d /source4/build
parent5ec5e7aa29ef4abf6b60a0de4947693d3e587f74 (diff)
downloadsamba-03c2d642a620380d96a9e745ceb1cd19ffea2160.tar.gz
samba-03c2d642a620380d96a9e745ceb1cd19ffea2160.tar.bz2
samba-03c2d642a620380d96a9e745ceb1cd19ffea2160.zip
r7159: Improve the messages from pidl's validator module.
Change the IDL file for the echo interface to match the one we use for Windows. The only thing different between the two files currently is the names of the scalar types and the handling of strings. (This used to be commit b264c61061d222347919837600adf809fbadfb13)
Diffstat (limited to 'source4/build')
-rw-r--r--source4/build/pidl/pidl.1.xml23
-rw-r--r--source4/build/pidl/validator.pm34
2 files changed, 42 insertions, 15 deletions
diff --git a/source4/build/pidl/pidl.1.xml b/source4/build/pidl/pidl.1.xml
index 18ef97772b..e60889e895 100644
--- a/source4/build/pidl/pidl.1.xml
+++ b/source4/build/pidl/pidl.1.xml
@@ -19,15 +19,17 @@
<arg choice="opt">--output OUTNAME</arg>
<arg choice="opt">--parse</arg>
<arg choice="opt">--dump</arg>
- <arg choice="opt">--header</arg>
- <arg choice="opt">--parser</arg>
+ <arg choice="opt">--header[=OUTPUT]</arg>
+ <arg choice="opt">--parser[=OUTPUT]</arg>
<arg choice="opt">--server</arg>
<arg choice="opt">--template</arg>
- <arg choice="opt">--eth-parser</arg>
- <arg choice="opt">--eth-header</arg>
+ <arg choice="opt">--eth-parser[=OUTPUT]</arg>
+ <arg choice="opt">--eth-header[=OUTPUT]</arg>
<arg choice="opt">--diff</arg>
<arg choice="opt">--keep</arg>
<arg choice="req">idlfile</arg>
+ <arg choice="opt">idlfile2</arg>
+ <arg choice="opt">...</arg>
</cmdsynopsis>
</refsynopsisdiv>
@@ -49,16 +51,17 @@
dissectors that can parse data sent over the
wire by these interfaces. </para>
- <para>pidl takes IDL files in the same format that is used by midl,
+ <para>pidl takes IDL files in the same format as is used by midl,
converts it to a .pidl file (which contains pidl's internal representation of the interface) and can then generate whatever output you need.
.pidl files should be used for debugging purposes only. Write your
- interface definitions in (midl) .idl format.
+ interface definitions in .idl format.
</para>
<para>
The goal of pidl is to implement a IDL compiler that can be used
while developing the RPC subsystem in Samba (for
- both marshalling/un-marshalling and debugging purposes).</para>
+ both marshalling/unmarshalling and debugging purposes).
+ </para>
</refsect1>
@@ -378,12 +381,6 @@ embedded structures in security descriptors and spoolss.
</refsect2>
<refsect2>
- <title>Pointers</title>
-
- <para>Pidl does not support "full" pointers in the DCE meaning of the word. However, its "unique" pointer is compatible with MIDL's full ("ptr") pointer support. </para>
- </refsect2>
-
- <refsect2>
<title>Datagram support</title>
<para>ncadg is not supported yet.</para>
diff --git a/source4/build/pidl/validator.pm b/source4/build/pidl/validator.pm
index ec4ad4503b..8fedef5ce8 100644
--- a/source4/build/pidl/validator.pm
+++ b/source4/build/pidl/validator.pm
@@ -149,6 +149,25 @@ sub ValidProperties($$)
}
}
+sub mapToScalar($)
+{
+ my $t = shift;
+ my $ti = typelist::getType($t);
+
+ if (not defined ($ti)) {
+ return undef;
+ } elsif ($ti->{DATA}->{TYPE} eq "ENUM") {
+ return typelist::enum_type_fn($ti->{DATA});
+ } elsif ($ti->{DATA}->{TYPE} eq "BITMAP") {
+ return typelist::enum_type_fn($ti->{DATA});
+ } elsif ($ti->{DATA}->{TYPE} eq "SCALAR") {
+ return $t;
+ }
+
+ return undef;
+}
+
+
#####################################################################
# parse a struct
sub ValidElement($)
@@ -174,8 +193,19 @@ sub ValidElement($)
my $discriminator_type = util::has_property($type, "switch_type");
$discriminator_type = "uint32" unless defined ($discriminator_type);
- if ($e2->{TYPE} ne $discriminator_type) {
- print el_name($e) . ": Warning: switch_is() is of type $e2->{TYPE}, while discriminator type for union $type->{NAME} is $discriminator_type\n";
+ my $t1 = mapToScalar($discriminator_type);
+
+ if (not defined($t1)) {
+ fatal($e, el_name($e) . ": unable to map discriminator type '$discriminator_type' to scalar");
+ }
+
+ my $t2 = mapToScalar($e2->{TYPE});
+ if (not defined($t2)) {
+ fatal($e, el_name($e) . ": unable to map variable used for switch_is() to scalar");
+ }
+
+ if ($t1 ne $t2) {
+ nonfatal($e, el_name($e) . ": switch_is() is of type $e2->{TYPE} ($t2), while discriminator type for union $type->{NAME} is $discriminator_type ($t1)");
}
}
}