diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2005-02-18 11:45:26 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:10:46 -0500 |
commit | 06a19b39d1cb217ac725464ae185bd29517d78bf (patch) | |
tree | 552bb1654164178b61c96485fbf9a176e1062c63 /source4 | |
parent | f42376b725556dd60bff3519db62e0020bdee449 (diff) | |
download | samba-06a19b39d1cb217ac725464ae185bd29517d78bf.tar.gz samba-06a19b39d1cb217ac725464ae185bd29517d78bf.tar.bz2 samba-06a19b39d1cb217ac725464ae185bd29517d78bf.zip |
r5442: Use argument list generator functions from NdrParser in NdrHeader
(This used to be commit e912f36dc827d7ad38994b93967fe48aade27b2b)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/build/pidl/header.pm | 40 | ||||
-rw-r--r-- | source4/build/pidl/ndr.pm | 6 |
2 files changed, 15 insertions, 31 deletions
diff --git a/source4/build/pidl/header.pm b/source4/build/pidl/header.pm index 00321fef93..57689c6165 100644 --- a/source4/build/pidl/header.pm +++ b/source4/build/pidl/header.pm @@ -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"; } } diff --git a/source4/build/pidl/ndr.pm b/source4/build/pidl/ndr.pm index effaaf4995..d63af9202c 100644 --- a/source4/build/pidl/ndr.pm +++ b/source4/build/pidl/ndr.pm @@ -20,6 +20,12 @@ sub get_typedef($) return $typedefs{$n}; } +sub get_typefamily($) +{ + my $n = shift; + return $typefamily{$n}; +} + sub RegisterPrimitives() { my %type_alignments = |