- Timestamp:
- Feb 8, 2014, 1:01:18 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XmlTools2/trunk/xmlpatch.cpp
r935 r947 210 210 211 211 UtilXmlTools::displaySuccessMessage(1,"@COMMAND"); 212 } 213 214 QScriptValue echo(QScriptContext *context, QScriptEngine *engine) 215 { 216 std::cout << context->argument(0).toString().toUtf8().constData() << std::endl; 217 218 return ""; 212 219 } 213 220 … … 229 236 QFile jsxmlfile(":/resources/libs/jsxml.js"); 230 237 238 // Add echo function so user can debug the code 239 QScriptValue echoFunction = engine.newFunction(echo); 240 engine.globalObject().setProperty("echo", echoFunction); 241 231 242 filesToProcess=UtilXmlTools::getAllXmlFilesByWildcard(filesWildcard); 232 243 … … 263 274 engine.globalObject().setProperty("$xmlData",currXmlFileString); 264 275 265 engineResult=engine.evaluate(jsString); 276 // main needs to be called so the user code is evaluated 277 engineResult=engine.evaluate("main(); function main() {"+jsString+"}"); // main funtion allows to use return to exit prematurely from user code 266 278 267 279 #ifdef _USE_OLD_JS_ENGINE
Note:
See TracChangeset
for help on using the changeset viewer.