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

jelmer at samba.org jelmer at samba.org
Fri Feb 18 11:45:27 GMT 2005


Author: jelmer
Date: 2005-02-18 11:45:26 +0000 (Fri, 18 Feb 2005)
New Revision: 5442

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

Log:
Use argument list generator functions from NdrParser in NdrHeader

Modified:
   branches/SAMBA_4_0/source/build/pidl/header.pm
   branches/SAMBA_4_0/source/build/pidl/ndr.pm


Changeset:
Modified: branches/SAMBA_4_0/source/build/pidl/header.pm
===================================================================
--- branches/SAMBA_4_0/source/build/pidl/header.pm	2005-02-18 11:39:52 UTC (rev 5441)
+++ branches/SAMBA_4_0/source/build/pidl/header.pm	2005-02-18 11:45:26 UTC (rev 5442)
@@ -239,38 +239,16 @@
 	    return;
     }
 
-    if ($d->{DATA}{TYPE} eq "STRUCT") {
-	    pidl "NTSTATUS ndr_push_$d->{NAME}(struct ndr_push *ndr, int ndr_flags, struct $d->{NAME} *r);\n";
-	    pidl "NTSTATUS ndr_pull_$d->{NAME}(struct ndr_pull *ndr, int ndr_flags, struct $d->{NAME} *r);\n";
-	    if (!util::has_property($d, "noprint")) {
-		    pidl "void ndr_print_$d->{NAME}(struct ndr_print *ndr, const char *name, struct $d->{NAME} *r);\n";
-	    }
+	my $tf = NdrParser::get_typefamily($d->{DATA}{TYPE});
 
+	my $pull_args = $tf->{PULL_FN_ARGS}->($d);
+	my $push_args = $tf->{PUSH_FN_ARGS}->($d);
+	my $print_args = $tf->{PRINT_FN_ARGS}->($d);
+	pidl "NTSTATUS ndr_push_$d->{NAME}($push_args);\n";
+    pidl "NTSTATUS ndr_pull_$d->{NAME}($pull_args);\n";
+    if (!util::has_property($d, "noprint")) {
+	    pidl "void ndr_print_$d->{NAME}($print_args);\n";
     }
-    if ($d->{DATA}{TYPE} eq "UNION") {
-	    pidl "NTSTATUS ndr_push_$d->{NAME}(struct ndr_push *ndr, int ndr_flags, int level, union $d->{NAME} *r);\n";
-	    pidl "NTSTATUS ndr_pull_$d->{NAME}(struct ndr_pull *ndr, int ndr_flags, int level, union $d->{NAME} *r);\n";
-	    if (!util::has_property($d, "noprint")) {
-		    pidl "void ndr_print_$d->{NAME}(struct ndr_print *ndr, const char *name, int level, union $d->{NAME} *r);\n";
-	    }
-    }
-
-    if ($d->{DATA}{TYPE} eq "ENUM") {
-	    pidl "NTSTATUS ndr_push_$d->{NAME}(struct ndr_push *ndr, int ndr_flags, enum $d->{NAME} r);\n";
-	    pidl "NTSTATUS ndr_pull_$d->{NAME}(struct ndr_pull *ndr, int ndr_flags, enum $d->{NAME} *r);\n";
-	    if (!util::has_property($d, "noprint")) {
-		    pidl "void ndr_print_$d->{NAME}(struct ndr_print *ndr, const char *name, enum $d->{NAME} r);\n";
-	    }
-    }
-
-    if ($d->{DATA}{TYPE} eq "BITMAP") {
-    	    my $type_decl = util::bitmap_type_decl($d->{DATA});
-	    pidl "NTSTATUS ndr_push_$d->{NAME}(struct ndr_push *ndr, int ndr_flags, $type_decl r);\n";
-	    pidl "NTSTATUS ndr_pull_$d->{NAME}(struct ndr_pull *ndr, int ndr_flags, $type_decl *r);\n";
-	    if (!util::has_property($d, "noprint")) {
-		    pidl "void ndr_print_$d->{NAME}(struct ndr_print *ndr, const char *name, $type_decl r);\n";
-	    }
-    }
 }
 
 #####################################################################

Modified: branches/SAMBA_4_0/source/build/pidl/ndr.pm
===================================================================
--- branches/SAMBA_4_0/source/build/pidl/ndr.pm	2005-02-18 11:39:52 UTC (rev 5441)
+++ branches/SAMBA_4_0/source/build/pidl/ndr.pm	2005-02-18 11:45:26 UTC (rev 5442)
@@ -20,6 +20,12 @@
 	return $typedefs{$n};
 }
 
+sub get_typefamily($)
+{
+	my $n = shift;
+	return $typefamily{$n};
+}
+
 sub RegisterPrimitives()
 {
 	my %type_alignments = 



More information about the samba-cvs mailing list