Author: tpot Date: 2005-06-04 03:32:18 +0000 (Sat, 04 Jun 2005) New Revision: 7261
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7261 Log: Pass by reference is done in js via MPR_TYPE_OBJECT. Update argument parsing and example for resolveName(). Modified: branches/SAMBA_4_0/source/scripting/ejs/smbcalls.c branches/SAMBA_4_0/testprogs/ejs/resolveName.js Changeset: Modified: branches/SAMBA_4_0/source/scripting/ejs/smbcalls.c =================================================================== --- branches/SAMBA_4_0/source/scripting/ejs/smbcalls.c 2005-06-04 02:31:45 UTC (rev 7260) +++ branches/SAMBA_4_0/source/scripting/ejs/smbcalls.c 2005-06-04 03:32:18 UTC (rev 7261) @@ -271,6 +271,11 @@ goto done; } + if (argv[0]->type != MPR_TYPE_OBJECT) { + ejsSetErrorMsg(eid, "resolvename invalid arguments"); + goto done; + } + if (argv[1]->type != MPR_TYPE_STRING) { ejsSetErrorMsg(eid, "resolveName invalid arguments"); goto done; @@ -291,8 +296,8 @@ nt_status = resolve_name(&name, tmp_ctx, &reply_addr); if (NT_STATUS_IS_OK(nt_status)) { - mprDestroyAllVars(argv[0]); - *argv[0] = mprCreateStringVar(reply_addr, True); + mprSetPropertyValue(argv[0], "value", + mprCreateStringVar(reply_addr, 1)); } ejsSetReturnValue(eid, mprNTSTATUS(nt_status)); Modified: branches/SAMBA_4_0/testprogs/ejs/resolveName.js =================================================================== --- branches/SAMBA_4_0/testprogs/ejs/resolveName.js 2005-06-04 02:31:45 UTC (rev 7260) +++ branches/SAMBA_4_0/testprogs/ejs/resolveName.js 2005-06-04 03:32:18 UTC (rev 7261) @@ -2,11 +2,12 @@ Demonstrate use of resolveName() js function */ -var result; -res = resolveName(result, "frogurt"); +var result = new Object(); -if (!res.is_ok) { +res = resolveName(result, ARGV[0]); + +if (res.is_ok) { + println(result.value); +} else { println(res.errstr); -} else { - println(result); }