From 9f4444331a3c06c58c50ea10ab6ad84904c54339 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 7 Aug 2005 07:00:00 +0000 Subject: r9176: added a much neater method of calling printf on the server from client side js. Just use srv_printf() and normal printf arguments (This used to be commit 11c7e8db3d2501a6a439d3e3a63a5055cc577f51) --- swat/esptest/qooxdoo.esp | 5 ++--- swat/scripting/client/call.js | 47 ++++++++++++++++++++++++++++++++-------- swat/scripting/general_calls.esp | 26 ++++++++++++++++++++++ 3 files changed, 66 insertions(+), 12 deletions(-) create mode 100644 swat/scripting/general_calls.esp diff --git a/swat/esptest/qooxdoo.esp b/swat/esptest/qooxdoo.esp index dbdb4ddc7a..76d3236fc9 100644 --- a/swat/esptest/qooxdoo.esp +++ b/swat/esptest/qooxdoo.esp @@ -53,8 +53,7 @@ } function start_call() { - server_call('remote.esp', 'printf', null, - "Starting calls ... (stopit=%d)\\n", stopit); + srv_printf("Starting calls ... (stopit=%d)\\n", stopit); stopit = 0; shared.counter = 0; shared.start_time = 0; @@ -62,7 +61,7 @@ }; function stop_call() { - server_call('remote.esp', 'printf', null, "Stopping calls\\n"); + srv_printf("Stopping calls\\n"); stopit = 1; }; diff --git a/swat/scripting/client/call.js b/swat/scripting/client/call.js index d1671ef70f..3af6a5a876 100644 --- a/swat/scripting/client/call.js +++ b/swat/scripting/client/call.js @@ -40,7 +40,7 @@ function __http_object() { /* usage: - server_call(url, func, callback, ...); + vserver_call(url, func, callback, args); 'func' is a function name to call on the server any additional arguments are passed to func() on the server @@ -48,17 +48,17 @@ function __http_object() { The callback() function is called with the returned object. 'callback' may be null. */ -function server_call(url, func, callback) { +function vserver_call(url, func, callback, args) { + var args2 = new Object(); + args2.length = args.length; + var i; + for (i=0;i -- cgit