summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2005-08-05 18:06:15 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:31:19 -0500
commit53c38c5ca658d8bdb33943992bf1a5cd3451686f (patch)
tree28f60dacd2c8ae89a554443caa5057e2e0834214 /source4
parent959c75c2ae0c7bab32fc40a13fe5fb03350123f5 (diff)
downloadsamba-53c38c5ca658d8bdb33943992bf1a5cd3451686f.tar.gz
samba-53c38c5ca658d8bdb33943992bf1a5cd3451686f.tar.bz2
samba-53c38c5ca658d8bdb33943992bf1a5cd3451686f.zip
r9129: Start working on nested anonymous structures and unions. A better
design is starting to become clearer. (-: (This used to be commit 23b9f8f3b59cc497fc7368c40ca7fce474370ed3)
Diffstat (limited to 'source4')
-rwxr-xr-xsource4/script/build_smb_interfaces.pl59
1 files changed, 55 insertions, 4 deletions
diff --git a/source4/script/build_smb_interfaces.pl b/source4/script/build_smb_interfaces.pl
index 3aacc6df55..7358eab85a 100755
--- a/source4/script/build_smb_interfaces.pl
+++ b/source4/script/build_smb_interfaces.pl
@@ -45,13 +45,32 @@ foreach my $x (@{$header}) {
prototypes_for($x);
- # Prototypes for non-anonymous nested structures and unions
-
foreach my $e1 (@{$x->{DATA}}) {
foreach my $e2 (@{$e1->{DATA}}) {
+
+ # Prototypes for non-anonymous nested structures and unions:
+ #
+ # e.g struct foo {...};
+
if (defined($e2->{STRUCT_NAME}) or defined($e2->{UNION_NAME})) {
prototypes_for($e2);
}
+
+ # We also would like to push/pull nested structures and unions:
+ #
+ # e.g struct foo {
+ # struct {...} bar;
+ # };
+
+ if ($e2->{TYPE} eq "struct") {
+ if (defined($e2->{NAME}) and !defined($e2->{STRUCT_NAME})) {
+ foreach my $x (@{$e2->{NAME}}) {
+ $name = "$e1->{NAME}[0]_$x";
+ print FILE "NTSTATUS ejs_push_$name(struct ejs_rpc *, struct MprVar *, const char *, const uint32_t *);\n";
+ print FILE "NTSTATUS ejs_pull_$name(struct ejs_rpc *, struct MprVar *, const char *, const uint32_t *);\n";
+ }
+ }
+ }
}
}
}
@@ -97,6 +116,11 @@ sub print_field($$) {
if ($f->{POINTERS} > 0) {
print FILE "\t// alloc $x?\n";
}
+
+ if ($f->{TYPE} eq "struct") {
+ $type = $f->{STRUCT_NAME};
+ }
+
print FILE "\tNDR_CHECK(ejs_pull_$type(ejs, v, \"$x\", ${deref}r->$suffix.$x));\n";
}
}
@@ -138,6 +162,33 @@ foreach my $x (@{$header}) {
print FILE "}\n\n";
}
+# Nested anonymous structures
+
+foreach my $x (@{$header}) {
+ foreach my $e1 (@{$x->{DATA}}) {
+ foreach my $e2 (@{$e1->{DATA}}) {
+ if ($e2->{TYPE} eq "struct") {
+ if (defined($e2->{NAME}) and !defined($e2->{STRUCT_NAME})) {
+ foreach my $x (@{$e2->{NAME}}) {
+
+ $name = "$e1->{NAME}[0]_$x";
+
+ print FILE "static NTSTATUS ejs_push_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, const uint32_t *r)\n";
+ print FILE "{\n";
+ print FILE "\treturn NT_STATUS_OK;\n";
+ print FILE "}\n\n";
+
+ print FILE "static NTSTATUS ejs_pull_$name(struct ejs_rpc *ejs, struct MprVar *v, const char *name, const uint32_t *r)\n";
+ print FILE "{\n";
+ print FILE "\treturn NT_STATUS_OK;\n";
+ print FILE "}\n\n";
+ }
+ }
+ }
+ }
+ }
+}
+
# Top level call functions
foreach my $x (@{$header}) {
@@ -148,7 +199,7 @@ foreach my $x (@{$header}) {
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} parms;\n";
+ print FILE "\tstruct $x->{STRUCT_NAME} params;\n";
print FILE "\tstruct smbcli_tree *tree;\n";
print FILE "\tNTSTATUS result;\n\n";
@@ -183,7 +234,7 @@ __HERE__
print FILE "static int ejs_${basename}_init(int eid, int argc, struct MprVar **argv)\n";
print FILE "{\n";
-print FILE "\tstruct MprVar *obj = mprInitObject(eid, \"${basename}\", argc, argtv);\n\n";
+print FILE "\tstruct MprVar *obj = mprInitObject(eid, \"${basename}\", argc, argv);\n\n";
foreach my $x (@{$header}) {
next, if $x->{STRUCT_NAME} eq "";