r5442: Use argument list generator functions from NdrParser in NdrHeader
authorJelmer Vernooij <jelmer@samba.org>
Fri, 18 Feb 2005 11:45:26 +0000 (11:45 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:10:46 +0000 (13:10 -0500)
source/build/pidl/header.pm
source/build/pidl/ndr.pm

index 00321fef934e185d78cf0aaa4f6d5f952d6842a5..57689c616581307acbf85f30cff97017cdb60956 100644 (file)
@@ -239,37 +239,15 @@ sub HeaderTypedefProto($)
            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";
-           }
-
-    }
-    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";
-           }
+       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";
     }
 }
 
index effaaf499545f1393629180e671a07d956598b1b..d63af9202ca642097211412a2839fbb282ecfe37 100644 (file)
@@ -20,6 +20,12 @@ sub get_typedef($)
        return $typedefs{$n};
 }
 
+sub get_typefamily($)
+{
+       my $n = shift;
+       return $typefamily{$n};
+}
+
 sub RegisterPrimitives()
 {
        my %type_alignments =