Go to the documentation of this file.
82 if (argc == 0 || argv == NULL) {
87 char* args = Tcl_Merge(argc-1, (
char **)argv+1);
88 char* argvStr =
const_cast<char*
>(
"argv");
89 Tcl_SetVar(
interpreter_, argvStr, args, TCL_GLOBAL_ONLY);
107 const std::string& name,
const DataObject& value) {
110 Tcl_SetVar(
interpreter_, cName, cValue, TCL_GLOBAL_ONLY);
125 string value = Tcl_GetVar(
interpreter_, cName, TCL_GLOBAL_ONLY);
127 object.setString(value);
143 if (!command.empty() && command.substr(command.length() - 1, 1) ==
"{" &&
153 command +=
"\n" + line;
154 }
while (!line.empty() && line.substr(line.length() - 1, 1) !=
"}");
159 delete[] cCommandLine;
165 if (code == TCL_OK) {
194 Tcl_CreateObjCommand(
223 dObj.
setString(Tcl_GetStringFromObj(
object, NULL));
237 Tcl_Obj* obj = Tcl_NewStringObj(cName, -1);
251 string command =
"source " + scriptFileName;
274 Tcl_Obj *CONST objv[]) {
276 vector<DataObject> args;
278 for (
int i = 0; i < objc; i++) {
280 args.push_back(dObj);
286 if (targetCommand->
execute(args)) {
virtual void addCustomCommandToInterpreter(const CustomCommand &command)
virtual void removeCustomCommandFromInterpreter(const CustomCommand &command)
virtual DataObject variable(const std::string &name)
virtual std::string stringValue() const
Tcl_Interp * interpreter_
Interpreter instance.
static std::string toString(const T &source)
virtual std::string readLine(std::string prompt="")=0
InterpreterContext * context_
Context for interpreter.
virtual bool execute(const std::vector< DataObject > &arguments)=0
#define assert(condition)
virtual void setLineReader(LineReader *reader)
virtual bool interpret(const std::string &commandLine)
virtual void setResultToInterpreter(const DataObject &value)
virtual void setResult(DataObject *result)
virtual InterpreterContext & context() const
virtual ~TclInterpreter()
virtual void setVariableToInterpreter(const std::string &name, const DataObject &value)
static Tcl_Obj * dataObjectToTclObj(const DataObject &object)
virtual void initialize(int argc, char *argv[], InterpreterContext *context, LineReader *reader)
virtual void setVariable(const std::string &interpreterVariableName, const std::string &value)
virtual void setError(bool state)
virtual void setString(std::string value)
static int customCommandRedirector(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
virtual LineReader * lineReader() const
static DataObject tclObjToDataObject(Tcl_Obj *object)
virtual bool processScriptFile(const std::string &scriptFileName)