wxScript

Categories: wrapper,miscellaneousStatus: BETAComponent logo
Author: Francesco MontorsiwxWidgets supported ports: all
Current maintainer: Francesco MontorsiwxWidgets supported versions: 2.4, 2.5, 2.6
Latest version: 1.0Build system: Bakefile-based
Programming language: C++Samples provided: 2
External dependencies: python, lua and tolua, underc, cint (all optional)Documentation: doxygen

Description: A set of abstract classes to add a script-interpreter support to your wxWidgets applications/libraries. The implementation of these interfaces for the Lua, Python, UnderC and CINT interpreters (these two are C/C++ intepreters) are provided. The advantage of a single basic interface makes extremely easy for the programmer not only to add scripting support to its program but also to give the user multi-scripting languages support, learning how to use a single set of powerful classes: wxPython, wxLua, wxUnderC and wxCINT. These classes are easily extensible and they support Unicode as well.

Links for wxScript:


wxScript usage sample

^ TOP

// load the script
wxString filename(basepath + wxT("myscript"));
wxScriptFile *pf = wxScriptInterpreter::Load(filename, wxRECOGNIZE_FROM_EXTENSION);
if (pf == NULL) {
        wxPrintf(wxT(">Failed to load '%s'.\n"), filename.c_str());
        return;
}

// get the list of the functions
wxScriptFunctionArray arr;
wxScriptInterpreter::GetTotalFunctionList(arr);

// now, check for the presence of the "main" function...
wxScriptFunction *func = arr.Get(wxT("main"));
if (func == NULL) return; // no such function is present ?

// ...and run it with a string as argument
wxScriptVar result;
wxScriptVar args[2];
args[0].Set(wxT("char*"), wxT("my string"));
if (!func->Exec(result, args)) return;

// last, get the result...
wxString str(result.GetContentString());

Documentation

^ TOP

The doxygen-generated documentation for this component is available online here. Please let me know if you think something is missing.


Known bugs

^ TOP

None. To submit a bug report please look at wxCode FAQ.


Future enhancements

^ TOP

None. To submit a feature request please look at wxCode FAQ.