summaryrefslogtreecommitdiff
path: root/source4/build/pidl
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-07-08 10:29:18 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:19:23 -0500
commit987e67df52ad906db5c80df736eea762d52814b6 (patch)
tree7862fade8c3332b5c0404451bff36899508ee8f2 /source4/build/pidl
parentd1298d9c81979da73be30f4b38f592636c81607b (diff)
downloadsamba-987e67df52ad906db5c80df736eea762d52814b6.tar.gz
samba-987e67df52ad906db5c80df736eea762d52814b6.tar.bz2
samba-987e67df52ad906db5c80df736eea762d52814b6.zip
r8238: - fixed handling of NULL pointers from ejs
- added automatic creation of all constants in IDL as ejs variables (This used to be commit 9398b02e4ba51145e447668e321ca927f44c0078)
Diffstat (limited to 'source4/build/pidl')
-rw-r--r--source4/build/pidl/ejs.pm23
1 files changed, 23 insertions, 0 deletions
diff --git a/source4/build/pidl/ejs.pm b/source4/build/pidl/ejs.pm
index 751f7f326e..750c53e95f 100644
--- a/source4/build/pidl/ejs.pm
+++ b/source4/build/pidl/ejs.pm
@@ -103,6 +103,9 @@ sub fn_prefix($)
sub EjsPullScalar($$$$$)
{
my ($e, $l, $var, $name, $env) = @_;
+
+ return if (util::has_property($e, "value"));
+
$var = get_pointer_to($var);
# have to handle strings specially :(
if ($e->{TYPE} eq "string") {
@@ -116,9 +119,13 @@ sub EjsPullScalar($$$$$)
sub EjsPullPointer($$$$$)
{
my ($e, $l, $var, $name, $env) = @_;
+ pidl "\tif (ejs_pull_null(ejs, v, $name)) {\n";
+ pidl "\t$var = NULL;\n";
+ pidl "\t} else {\n";
pidl "\tEJS_ALLOC(ejs, $var);\n";
$var = get_value_of($var);
EjsPullElement($e, Ndr::GetNextLevel($e, $l), $var, $name, $env);
+ pidl "}\n";
}
###########################
@@ -335,8 +342,12 @@ sub EjsPushString($$$$$)
sub EjsPushPointer($$$$$)
{
my ($e, $l, $var, $name, $env) = @_;
+ pidl "\tif (NULL == $var) {\n";
+ pidl "\tNDR_CHECK(ejs_push_null(ejs, v, $name));\n";
+ pidl "\t} else {\n";
$var = get_value_of($var);
EjsPushElement($e, Ndr::GetNextLevel($e, $l), $var, $name, $env);
+ pidl "}\n";
}
###########################
@@ -540,6 +551,14 @@ sub EjsFunction($)
pidl "}\n\n";
}
+###################
+# handle a constant
+sub EjsConst($)
+{
+ my $const = shift;
+ $constants{$const->{NAME}} = $const->{VALUE};
+}
+
#####################################################################
# parse the interface definitions
sub EjsInterface($)
@@ -565,6 +584,10 @@ sub EjsInterface($)
push (@fns, $d->{NAME});
}
+ foreach my $d (@{$interface->{CONSTS}}) {
+ EjsConst($d);
+ }
+
pidl "void setup_ejs_$name(void)\n";
pidl "{\n";
foreach (@fns) {