mirror of
https://github.com/samba-team/samba.git
synced 2025-01-12 09:18:10 +03:00
r9205: Generate more stub code for smb_raw ejs functions.
(This used to be commit 3407490121
)
This commit is contained in:
parent
febfcd33ec
commit
16cc2aa58e
@ -57,6 +57,9 @@ sub flatten_structs($) {
|
||||
# Generate implementation
|
||||
#
|
||||
|
||||
my $basename = basename($file, ".h");
|
||||
stat "libcli/gen_raw" || mkdir("libcli/gen_raw") || die("mkdir");
|
||||
|
||||
open(FILE, ">libcli/gen_raw/ejs_${basename}.c");
|
||||
|
||||
print FILE "/* EJS wrapper functions auto-generated by build_smb_interfaces.pl */\n\n";
|
||||
@ -74,9 +77,38 @@ foreach my $s (@newheader) {
|
||||
|
||||
# Top level struct
|
||||
|
||||
print FILE "static NTSTATUS ejs_$s->{TYPE_DEFINED}(int eid, int argc, struct MprVar **argv)\n";
|
||||
print FILE "static int ejs_$s->{TYPE_DEFINED}(int eid, int argc, struct MprVar **argv)\n";
|
||||
print FILE "{\n";
|
||||
print FILE "\treturn NT_STATUS_OK;\n";
|
||||
print FILE "\tstruct $s->{TYPE_DEFINED} params;\n";
|
||||
print FILE "\tstruct smbcli_tree *tree;\n";
|
||||
print FILE "\tNTSTATUS result;\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";
|
||||
|
||||
foreach my $field (@{$s->{FIELDS}}) {
|
||||
next if $field->{NAME} eq "out";
|
||||
print FILE "\t// pull params.$field->{NAME}\n";
|
||||
}
|
||||
|
||||
my $fn = $s->{TYPE_DEFINED};
|
||||
$fn =~ s/^smb_/smb_raw_/;
|
||||
|
||||
print FILE "\n\tresult = $fn(tree, ¶ms);\n\n";
|
||||
|
||||
foreach my $field (@{$s->{FIELDS}}) {
|
||||
next if $field->{NAME} eq "in";
|
||||
print FILE "\t// push params.$field->{NAME}\n";
|
||||
}
|
||||
|
||||
print FILE "\n\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";
|
||||
print FILE "\treturn 0;\n";
|
||||
|
||||
print FILE "}\n\n";
|
||||
|
||||
} else {
|
||||
@ -85,9 +117,38 @@ foreach my $s (@newheader) {
|
||||
|
||||
foreach my $arm (@{$s->{FIELDS}}) {
|
||||
|
||||
print FILE "static NTSTATUS ejs_$s->{TYPE_DEFINED}_$arm->{NAME}(int eid, int argc, struct MprVar **argv)\n";
|
||||
print FILE "static int ejs_$s->{TYPE_DEFINED}_$arm->{NAME}(int eid, int argc, struct MprVar **argv)\n";
|
||||
print FILE "{\n";
|
||||
print FILE "\treturn NT_STATUS_OK;\n";
|
||||
print FILE "\tunion $s->{TYPE_DEFINED} params;\n";
|
||||
print FILE "\tstruct smbcli_tree *tree;\n";
|
||||
print FILE "\tNTSTATUS result;\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";
|
||||
|
||||
foreach my $field (@{$arm->{FIELDS}}) {
|
||||
next if $field->{NAME} eq "out";
|
||||
print FILE "\t// pull params.$arm->{NAME}.$field->{NAME}\n";
|
||||
}
|
||||
|
||||
my $fn = $s->{TYPE_DEFINED};
|
||||
$fn =~ s/^smb_/smb_raw_/;
|
||||
|
||||
print FILE "\n\tresult = $fn(tree, ¶ms);\n\n";
|
||||
|
||||
foreach my $field (@{$arm->{FIELDS}}) {
|
||||
next if $field->{NAME} eq "in";
|
||||
print FILE "\t// push params.$arm->{NAME}.$field->{NAME}\n";
|
||||
}
|
||||
|
||||
print FILE "\n\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";
|
||||
print FILE "\treturn 0;\n";
|
||||
|
||||
print FILE "}\n\n";
|
||||
}
|
||||
}
|
||||
@ -119,43 +180,3 @@ print FILE "}\n";
|
||||
close(FILE);
|
||||
|
||||
exit;
|
||||
|
||||
foreach my $x (@{$header}) {
|
||||
next, if $x->{STRUCT_NAME} eq "";
|
||||
|
||||
$raw_name = $x->{STRUCT_NAME};
|
||||
$raw_name =~ s/smb_/smb_raw_/;
|
||||
|
||||
print FILE "static int ejs_$x->{STRUCT_NAME}(int eid, int argc, struct MprVar **argv)\n";
|
||||
print FILE "{\n";
|
||||
print FILE "\tstruct $x->{STRUCT_NAME} params;\n";
|
||||
print FILE "\tstruct smbcli_tree *tree;\n";
|
||||
print FILE "\tNTSTATUS result;\n\n";
|
||||
|
||||
$output = << "__HERE__";
|
||||
if (argc != 1 || argv[0]->type != MPR_TYPE_OBJECT) {
|
||||
ejsSetErrorMsg(eid, "invalid arguments");
|
||||
return -1;
|
||||
}
|
||||
|
||||
tree = mprGetThisPtr(eid, "tree");
|
||||
|
||||
if (!tree) {
|
||||
ejsSetErrorMsg(eid, "invalid tree");
|
||||
return -1;
|
||||
}
|
||||
|
||||
__HERE__
|
||||
|
||||
print FILE $output;
|
||||
print FILE "\tresult = $raw_name(tree, ¶ms);\n\n";
|
||||
|
||||
print FILE "\tmpr_Return(eid, mprNTSTATUS(status));\n";
|
||||
print FILE "\tif (NT_STATUS_EQUAL(status, NT_STATUS_INTERNAL_ERROR)) {\n";
|
||||
print FILE "\t\treturn -1;\n";
|
||||
print FILE "\t}\n\n";
|
||||
print FILE "\treturn 0;\n";
|
||||
|
||||
print FILE "}\n\n";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user