[rkward-cvs] SF.net SVN: rkward:[3673] trunk/rkward/rkward/scriptbackends
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Sun Jun 5 13:23:33 UTC 2011
Revision: 3673
http://rkward.svn.sourceforge.net/rkward/?rev=3673&view=rev
Author: tfry
Date: 2011-06-05 13:23:33 +0000 (Sun, 05 Jun 2011)
Log Message:
-----------
Allow to use the 'common' JS functions in the GUI-logic.
Modified Paths:
--------------
trunk/rkward/rkward/scriptbackends/common.js
trunk/rkward/rkward/scriptbackends/rkcomponentscripting.cpp
trunk/rkward/rkward/scriptbackends/rkcomponentscripting.js
Modified: trunk/rkward/rkward/scriptbackends/common.js
===================================================================
--- trunk/rkward/rkward/scriptbackends/common.js 2011-06-04 11:48:57 UTC (rev 3672)
+++ trunk/rkward/rkward/scriptbackends/common.js 2011-06-05 13:23:33 UTC (rev 3673)
@@ -1,26 +1,27 @@
_script_output = "";
-function echo (text) {
+/* NOTE: for compatibility with Kross, we can't write this as 'function echo (text)...', somehow. */
+echo = function (text) {
_script_output += text;
}
-function printIndented (indentation, lines) {
+printIndented = function (indentation, lines) {
/** More complex than may seem necessary at first glance. The point is that the
final linebreak in the input should *not* be replaced by linebreak + indentation. */
echo (indentation + lines.replace (/\n(.)/g, "\n" + indentation + "$1"));
}
-function noquote (text) {
+noquote = function (text) {
var ret = new String (text);
ret.noquote = 1;
return (ret);
}
-function quote (text) {
+quote = function (text) {
if (text.noquote) return text;
return ("\"" + text.replace (/\"/g, "\\\"") + "\"");
}
-function makeHeaderCode (title, parameters) {
+makeHeaderCode = function (title, parameters) {
echo ("rk.header(" + quote (title));
if (parameters.length) {
echo (", parameters=list(");
@@ -36,55 +37,55 @@
echo (")\n");
}
-function getValue (id) {
+getValue = function (id) {
return (_RK_backend.getValue (id));
}
-function printValue (id) {
+printValue = function (id) {
echo (getValue (id));
}
-function include (file) {
+include = function (file) {
_RK_backend.includeFile (file);
}
-function flushOutput () {
+flushOutput = function () {
var string = _script_output;
_script_output = "";
return (string);
}
-function do_preprocess () {
+do_preprocess = function () {
if (typeof (preprocess) == "undefined") return ("");
preprocess ();
return (flushOutput ());
}
-function do_calculate () {
+do_calculate = function () {
if (typeof (calculate) == "undefined") return ("");
calculate ();
return (flushOutput ());
}
-function do_printout () {
+do_printout = function () {
if (typeof (printout) == "undefined") return ("");
printout ();
return (flushOutput ());
}
-function do_preview () {
+do_preview = function () {
if (typeof (preview) == "undefined") return ("");
preview ();
return (flushOutput ());
}
// for compatibility with the converted PHP code
-function trim (text) {
+trim = function (text) {
var ret = text.replace (/^\s*/, "").replace (/\s*$/, "");
return (ret);
}
-function split (by, text) {
+split = function (by, text) {
return (text.split (by));
}
Modified: trunk/rkward/rkward/scriptbackends/rkcomponentscripting.cpp
===================================================================
--- trunk/rkward/rkward/scriptbackends/rkcomponentscripting.cpp 2011-06-04 11:48:57 UTC (rev 3672)
+++ trunk/rkward/rkward/scriptbackends/rkcomponentscripting.cpp 2011-06-05 13:23:33 UTC (rev 3673)
@@ -47,11 +47,12 @@
QString _command = command;
if (!file.isEmpty ()) {
- _command.prepend ("include('" + file + "');\n");
+ _command.prepend ("_rkward.include('" + file + "');\n");
_scriptfile = file;
}
QDir files_path (RKCommonFunctions::getRKWardDataDir () + "phpfiles/");
_command.prepend ("_rkward.include('" + files_path.absoluteFilePath ("rkcomponentscripting.js") + "');\n");
+ _command.prepend ("_rkward.include('" + files_path.absoluteFilePath ("common.js") + "');\n");
#if not KDE_IS_VERSION(4,3,0)
_command.prepend ("_rk_eval = function (x) { eval (x); }\n");
#endif
Modified: trunk/rkward/rkward/scriptbackends/rkcomponentscripting.js
===================================================================
--- trunk/rkward/rkward/scriptbackends/rkcomponentscripting.js 2011-06-04 11:48:57 UTC (rev 3672)
+++ trunk/rkward/rkward/scriptbackends/rkcomponentscripting.js 2011-06-05 13:23:33 UTC (rev 3673)
@@ -139,7 +139,7 @@
this._objects = new Array ();
objs = names.split ('\n');
- while (objs.length () > 0) {
+ while (objs.count > 0) {
this._objects.push (new RObject (objs.shift ()));
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the rkward-tracker
mailing list