svn commit: samba r6101 - in branches/SAMBA_4_0/source/build/pidl: .

metze at samba.org metze at samba.org
Mon Mar 28 18:28:16 GMT 2005


Author: metze
Date: 2005-03-28 18:28:16 +0000 (Mon, 28 Mar 2005)
New Revision: 6101

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=6101

Log:
only allow properties we know about, that helps to catch typos!

what does length_of() and id() do?

metze

Modified:
   branches/SAMBA_4_0/source/build/pidl/validator.pm


Changeset:
Modified: branches/SAMBA_4_0/source/build/pidl/validator.pm
===================================================================
--- branches/SAMBA_4_0/source/build/pidl/validator.pm	2005-03-28 18:25:47 UTC (rev 6100)
+++ branches/SAMBA_4_0/source/build/pidl/validator.pm	2005-03-28 18:28:16 UTC (rev 6101)
@@ -35,12 +35,99 @@
 	return $e->{NAME};
 }
 
+my %property_list = (
+	# interface
+	"helpstring"		=> {},
+	"version"		=> {},
+	"uuid"			=> {},
+	"endpoint"		=> {},
+	"pointer_default"	=> {},
+	"depends"		=> {},
+	"authservice"		=> {},
+
+	# dcom
+	"object"		=> {},
+	"local"			=> {},
+	"iid_is"		=> {},
+	"call_as"		=> {},
+	"iid_is"		=> {},
+	"idempotent"		=> {},
+
+	# function
+	"id"			=> {},# what is that? --metze 
+	"in"			=> {},
+	"out"			=> {},
+
+	# pointer
+	"ref"			=> {},
+	"ptr"			=> {},
+	"unique"		=> {},
+	"relative"		=> {},
+
+	# ndr_size
+	"gensize"		=> {},
+	"value"			=> {},
+	"flag"			=> {},
+
+	# generic
+	"public"		=> {},
+	"nopush"		=> {},
+	"nopull"		=> {},
+	"noprint"		=> {},
+
+	# union
+	"switch_is"		=> {},
+	"switch_type"		=> {},
+	"nodiscriminant"	=> {},
+	"case"			=> {},
+	"default"		=> {},
+
+	# subcontext
+	"subcontext"		=> {},
+	"subcontext_size"	=> {},
+	"compression"		=> {},
+
+	# enum
+	"enum8bit"		=> {},
+	"enum16bit"		=> {},
+	"v1_enum"		=> {},
+
+	# bitmap
+	"bitmap8bit"		=> {},
+	"bitmap16bit"		=> {},
+	"bitmap32bit"		=> {},
+	"bitmap64bit"		=> {},
+
+	# array
+	"range"			=> {},
+	"size_is"		=> {},
+	"length_is"		=> {},
+	"length_of"		=> {}, # what is that? --metze
+);
+
 #####################################################################
+# check for unknown properties
+sub ValidProperties($)
+{
+	my $e = shift;
+
+	return unless defined $e->{PROPERTIES};
+
+	foreach my $key (keys %{$e->{PROPERTIES}}) {
+		if (not defined $property_list{$key}) {
+			fatal(el_name($e) . ": unknown property '$key'\n");
+		}
+	}
+}
+
+#####################################################################
 # parse a struct
 sub ValidElement($)
 {
 	my $e = shift;
-	
+
+	ValidProperties($e);
+
 	if (util::has_property($e, "ptr")) {
 		fatal(el_name($e) . " : pidl does not support full NDR pointers yet\n");
 	}
@@ -95,6 +182,8 @@
 {
 	my($struct) = shift;
 
+	ValidProperties($struct);
+
 	foreach my $e (@{$struct->{ELEMENTS}}) {
 		$e->{PARENT} = $struct;
 		ValidElement($e);
@@ -107,6 +196,8 @@
 {
 	my($union) = shift;
 
+	ValidProperties($union);
+
 	if (util::has_property($union->{PARENT}, "nodiscriminant") and util::has_property($union->{PARENT}, "switch_type")) {
 		fatal($union->{PARENT}->{NAME} . ": switch_type() on union without discriminant");
 	}
@@ -140,6 +231,8 @@
 	my($typedef) = shift;
 	my $data = $typedef->{DATA};
 
+	ValidProperties($typedef);
+
 	$data->{PARENT} = $typedef;
 
 	if (ref($data) eq "HASH") {
@@ -159,6 +252,8 @@
 {
 	my($fn) = shift;
 
+	ValidProperties($fn);
+
 	foreach my $e (@{$fn->{ELEMENTS}}) {
 		$e->{PARENT} = $fn;
 		if (util::has_property($e, "ref") && !$e->{POINTERS}) {
@@ -175,6 +270,8 @@
 	my($interface) = shift;
 	my($data) = $interface->{DATA};
 
+	ValidProperties($interface);
+
 	if (util::has_property($interface, "pointer_default") && 
 		$interface->{PROPERTIES}->{pointer_default} eq "ptr") {
 		fatal "Full pointers are not supported yet\n";



More information about the samba-cvs mailing list