summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2005-08-08 02:19:35 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:31:30 -0500
commitac4c941b77a2204c6f2eb75f7a28d8fb708909da (patch)
tree4d1a41d631a16153f5f8ebf4f379d681f2ffdc6a
parent16cc2aa58ebd56e117112d1856051f71a79976e8 (diff)
downloadsamba-ac4c941b77a2204c6f2eb75f7a28d8fb708909da.tar.gz
samba-ac4c941b77a2204c6f2eb75f7a28d8fb708909da.tar.bz2
samba-ac4c941b77a2204c6f2eb75f7a28d8fb708909da.zip
r9207: Start generating ejs_push/pull calls for structure elements.
(This used to be commit 8ff27a1effd2050733916569190264e347286c45)
-rwxr-xr-xsource4/script/build_smb_interfaces.pl48
1 files changed, 31 insertions, 17 deletions
diff --git a/source4/script/build_smb_interfaces.pl b/source4/script/build_smb_interfaces.pl
index 990151b2c8..8dfa52d0eb 100755
--- a/source4/script/build_smb_interfaces.pl
+++ b/source4/script/build_smb_interfaces.pl
@@ -41,7 +41,7 @@ sub flatten_structs($) {
foreach my $name (@{$elt->{NAME}}) {
my $new_elt = { %$elt };
$new_elt->{NAME} = $name;
- $new_elt->{PARENT} = $s;
+# $new_elt->{PARENT} = $s;
push(@{$s->{FIELDS}}, flatten_structs($new_elt));
}
}
@@ -69,6 +69,32 @@ print FILE "#include \"lib/appweb/ejs/ejs.h\"\n";
print FILE "#include \"scripting/ejs/ejsrpc.h\"\n"; # TODO: remove this
print FILE "\n";
+sub transfer_element($$$) {
+ my $dir = shift;
+ my $prefix = shift;
+ my $elt = shift;
+
+ print FILE "\tejs_${dir}_$elt->{TYPE}(ejs, v, \"$prefix.$elt->{NAME}\")\n";
+}
+
+sub transfer_struct($$) {
+ my $dir = shift;
+ my $struct = shift;
+
+ foreach my $field (@{$struct->{FIELDS}}) {
+ next if $dir eq "pull" and $field->{NAME} eq "out";
+ next if $dir eq "push" and $field->{NAME} eq "in";
+
+ if ($field->{TYPE} eq "struct") {
+ foreach $subfield (@{$field->{FIELDS}}) {
+ transfer_element($dir, $field->{NAME}, $subfield);
+ }
+ } else {
+ transfer_element($dir, $struct->{NAME}, $field);
+ }
+ }
+}
+
# Top level call functions
foreach my $s (@newheader) {
@@ -88,20 +114,14 @@ foreach my $s (@newheader) {
print FILE "\t\treturn -1;\n";
print FILE "\t}\n\n";
- foreach my $field (@{$s->{FIELDS}}) {
- next if $field->{NAME} eq "out";
- print FILE "\t// pull params.$field->{NAME}\n";
- }
+ transfer_struct("pull", $s);
my $fn = $s->{TYPE_DEFINED};
$fn =~ s/^smb_/smb_raw_/;
print FILE "\n\tresult = $fn(tree, &params);\n\n";
- foreach my $field (@{$s->{FIELDS}}) {
- next if $field->{NAME} eq "in";
- print FILE "\t// push params.$field->{NAME}\n";
- }
+ transfer_struct("push", $s);
print FILE "\n\tmpr_Return(eid, mprNTSTATUS(result));\n\n";
print FILE "\tif (NT_STATUS_EQUAL(status, NT_STATUS_INTERNAL_ERROR)) {\n";
@@ -128,20 +148,14 @@ foreach my $s (@newheader) {
print FILE "\t\treturn -1;\n";
print FILE "\t}\n\n";
- foreach my $field (@{$arm->{FIELDS}}) {
- next if $field->{NAME} eq "out";
- print FILE "\t// pull params.$arm->{NAME}.$field->{NAME}\n";
- }
+ transfer_struct("pull", $arm);
my $fn = $s->{TYPE_DEFINED};
$fn =~ s/^smb_/smb_raw_/;
print FILE "\n\tresult = $fn(tree, &params);\n\n";
- foreach my $field (@{$arm->{FIELDS}}) {
- next if $field->{NAME} eq "in";
- print FILE "\t// push params.$arm->{NAME}.$field->{NAME}\n";
- }
+ transfer_struct("push", $arm);
print FILE "\n\tmpr_Return(eid, mprNTSTATUS(result));\n\n";
print FILE "\tif (NT_STATUS_EQUAL(status, NT_STATUS_INTERNAL_ERROR)) {\n";