summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2005-08-09 00:34:24 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:31:32 -0500
commit4b93e377cd9809199487e20fa53d8a2c98ad32ea (patch)
tree7ca6e0ef6985a80a65e7ac765c3aefdd3088f923 /source4
parent78750230a2e676e6f7d621504a9aff61d63649ea (diff)
downloadsamba-4b93e377cd9809199487e20fa53d8a2c98ad32ea.tar.gz
samba-4b93e377cd9809199487e20fa53d8a2c98ad32ea.tar.bz2
samba-4b93e377cd9809199487e20fa53d8a2c98ad32ea.zip
r9220: Start trying to get autogenerated code to compile.
- Split out push/pull of top level elements into separate functions. - Remove _t from simple type names. (This used to be commit c419eef1c93afb51cf2fb42f87c0e5d29d2348ea)
Diffstat (limited to 'source4')
-rwxr-xr-xsource4/script/build_smb_interfaces.pl55
1 files changed, 44 insertions, 11 deletions
diff --git a/source4/script/build_smb_interfaces.pl b/source4/script/build_smb_interfaces.pl
index 8dfa52d0eb..511d03e0d7 100755
--- a/source4/script/build_smb_interfaces.pl
+++ b/source4/script/build_smb_interfaces.pl
@@ -74,7 +74,10 @@ sub transfer_element($$$) {
my $prefix = shift;
my $elt = shift;
- print FILE "\tejs_${dir}_$elt->{TYPE}(ejs, v, \"$prefix.$elt->{NAME}\")\n";
+ $type = $elt->{TYPE};
+ $type =~ s/_t$//;
+
+ print FILE "\tejs_${dir}_$type(ejs, v, \"$prefix.$elt->{NAME}\")\n";
}
sub transfer_struct($$) {
@@ -101,29 +104,44 @@ foreach my $s (@newheader) {
if ($s->{TYPE} eq "struct") {
- # Top level struct
+ # Push/pull top level struct
+
+ print FILE "NTSTATUS ejs_pull_$s->{TYPE_DEFINED}(struct ejs_rpc *ejs, struct MprVar *v, struct $s->{TYPE_DEFINED} *r)\n";
+ print FILE "{\n";
+ print FILE "\treturn NT_STATUS_OK;\n";
+ print FILE "}\n\n";
+
+ print FILE "NTSTATUS ejs_push_$s->{TYPE_DEFINED}(struct ejs_rpc *ejs, struct MprVar *v, const struct $s->{TYPE_DEFINED} *r)\n";
+ print FILE "{\n";
+ print FILE "\treturn NT_STATUS_OK;\n";
+ print FILE "}\n\n";
+
+ # Top level ejs function
print FILE "static int ejs_$s->{TYPE_DEFINED}(int eid, int argc, struct MprVar **argv)\n";
print FILE "{\n";
print FILE "\tstruct $s->{TYPE_DEFINED} params;\n";
print FILE "\tstruct smbcli_tree *tree;\n";
- print FILE "\tNTSTATUS result;\n\n";
+ print FILE "\tNTSTATUS status;\n\n";
print FILE "\tif (argc != 1 || argv[0]->type != MPR_TYPE_OBJECT) {\n";
print FILE "\t\tejsSetErrorMsg(eid, \"invalid arguments\");\n";
print FILE "\t\treturn -1;\n";
print FILE "\t}\n\n";
- transfer_struct("pull", $s);
+ print FILE "\tstatus = ejs_pull_$s->{TYPE_DEFINED}(ejs, io, ptr);\n";
+ print FILE "\tif (!NT_STATUS_IS_OK(status)) {\n";
+ print FILE "\t\treturn -1;\n";
+ print FILE "\t}\n\n";
my $fn = $s->{TYPE_DEFINED};
$fn =~ s/^smb_/smb_raw_/;
- print FILE "\n\tresult = $fn(tree, &params);\n\n";
+ print FILE "\tresult = $fn(tree, &params);\n\n";
- transfer_struct("push", $s);
+ print FILE "\tstatus = ejs_push_$s->{TYPE_DEFINED}(ejs, io, ptr);\n\n";
- print FILE "\n\tmpr_Return(eid, mprNTSTATUS(result));\n\n";
+ print FILE "\tmpr_Return(eid, mprNTSTATUS(result));\n\n";
print FILE "\tif (NT_STATUS_EQUAL(status, NT_STATUS_INTERNAL_ERROR)) {\n";
print FILE "\t\treturn -1;\n";
print FILE "\t}\n\n";
@@ -137,6 +155,18 @@ foreach my $s (@newheader) {
foreach my $arm (@{$s->{FIELDS}}) {
+ # Push/pull union arm
+
+ print FILE "NTSTATUS ejs_pull_$s->{TYPE_DEFINED}_$arm->{NAME}(struct ejs_rpc *ejs, struct MprVar *v, struct $s->{TYPE_DEFINED}_$arm->{NAME} *r)\n";
+ print FILE "{\n";
+ print FILE "\treturn NT_STATUS_OK;\n";
+ print FILE "}\n\n";
+
+ print FILE "NTSTATUS ejs_push_$s->{TYPE_DEFINED}_$arm->{NAME}(struct ejs_rpc *ejs, struct MprVar *v, const struct $s->{TYPE_DEFINED}_$arm->{NAME} *r)\n";
+ print FILE "{\n";
+ print FILE "\treturn NT_STATUS_OK;\n";
+ print FILE "}\n\n";
+
print FILE "static int ejs_$s->{TYPE_DEFINED}_$arm->{NAME}(int eid, int argc, struct MprVar **argv)\n";
print FILE "{\n";
print FILE "\tunion $s->{TYPE_DEFINED} params;\n";
@@ -148,16 +178,19 @@ foreach my $s (@newheader) {
print FILE "\t\treturn -1;\n";
print FILE "\t}\n\n";
- transfer_struct("pull", $arm);
+ print FILE "\tstatus = ejs_pull_$s->{TYPE_DEFINED}_$arm->{NAME}(ejs, io, ptr);\n";
+ print FILE "\tif (!NT_STATUS_IS_OK(status)) {\n";
+ print FILE "\t\treturn -1;\n";
+ print FILE "\t}\n\n";
my $fn = $s->{TYPE_DEFINED};
$fn =~ s/^smb_/smb_raw_/;
- print FILE "\n\tresult = $fn(tree, &params);\n\n";
+ print FILE "\tresult = $fn(tree, &params);\n\n";
- transfer_struct("push", $arm);
+ print FILE "\tstatus = ejs_push_$s->{TYPE_DEFINED}_$arm->{NAME}(ejs, io, ptr);\n\n";
- print FILE "\n\tmpr_Return(eid, mprNTSTATUS(result));\n\n";
+ print FILE "\tmpr_Return(eid, mprNTSTATUS(result));\n\n";
print FILE "\tif (NT_STATUS_EQUAL(status, NT_STATUS_INTERNAL_ERROR)) {\n";
print FILE "\t\treturn -1;\n";
print FILE "\t}\n\n";