Is there any way to do this? It seems the only possible way to do this is by using ruby/tk and creating a tcl interpreter through that api. However, I'd like to use this on a system with no GUI (x windows). Am I out of options?
Thanks
Is there any way to do this? It seems the only possible way to do this is by using ruby/tk and creating a tcl interpreter through that api. However, I'd like to use this on a system with no GUI (x windows). Am I out of options?
Thanks
if you are on the command line you can shell out to tclsh. tcl also has a C api so you should be able to use this to embed tcl in ruby if there is no preexisting way?
If you can invoke arbitrary simple functions in Tcl's C API, the key ones are:
Tcl_FindExecutable
– Call this first to initialize the libraryTcl_CreateInterp
– This returns a handle for a new execution contextTcl_Eval
– This evaluates a script; returns constants TCL_OK
(0) or TCL_ERROR
(1) (or a few others which are rare in general code)Tcl_GetResult
– This returns the result value (or error message)Tcl_ResetResult
– This clears the result valueTcl_DeleteInterp
– Maybe you can guess what this does…You can also access "global" variables in the context with Tcl_GetVar
and Tcl_SetVar
; this is a very convenient way to pass in values that might not be valid scripts.