svn commit: samba r9129 - in branches/SAMBA_4_0/source/script: .
tpot at samba.org
tpot at samba.org
Fri Aug 5 18:06:15 GMT 2005
Author: tpot
Date: 2005-08-05 18:06:15 +0000 (Fri, 05 Aug 2005)
New Revision: 9129
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=9129
Log:
Start working on nested anonymous structures and unions. A better
design is starting to become clearer. (-:
Modified:
branches/SAMBA_4_0/source/script/build_smb_interfaces.pl
Changeset:
Modified: branches/SAMBA_4_0/source/script/build_smb_interfaces.pl
===================================================================
--- branches/SAMBA_4_0/source/script/build_smb_interfaces.pl 2005-08-05 18:03:52 UTC (rev 9128)
+++ branches/SAMBA_4_0/source/script/build_smb_interfaces.pl 2005-08-05 18:06:15 UTC (rev 9129)
@@ -45,13 +45,32 @@
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 @@
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 @@
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 @@
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 @@
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 "";
More information about the samba-cvs
mailing list