aboutsummaryrefslogtreecommitdiff
path: root/jim.h
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2023-01-13 10:23:19 +1000
committerSteve Bennett <steveb@workware.net.au>2023-02-13 10:43:00 +1000
commit517d85974c7cf8d4f894f46251462e14b6fc562f (patch)
tree2e4eebd4f75671687827d484803e1a2da1d60d88 /jim.h
parentdb26fe46ea9a35d403067498f4b85eee82b431b0 (diff)
downloadjimtcl-517d85974c7cf8d4f894f46251462e14b6fc562f.zip
jimtcl-517d85974c7cf8d4f894f46251462e14b6fc562f.tar.gz
jimtcl-517d85974c7cf8d4f894f46251462e14b6fc562f.tar.bz2
Tcl-compatible 'info frame'
Returns a dictionary with file, line, cmd, (possibly) proc and level. And support 'info frame 0' for the current command. Note that now all evaluation frames are captured, not just call frames. Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'jim.h')
-rw-r--r--jim.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/jim.h b/jim.h
index 2ce3312..763c456 100644
--- a/jim.h
+++ b/jim.h
@@ -446,6 +446,18 @@ typedef struct Jim_CallFrame {
struct Jim_Cmd *tailcallCmd; /* Resolved command for pending tailcall invocation */
} Jim_CallFrame;
+/* Evaluation frame */
+typedef struct Jim_EvalFrame {
+ const char *type; /* "cmd", "source", etc. */
+ int level; /* Level of this evaluation frame. 0 = global */
+ int callFrameLevel; /* corresponding call frame level */
+ struct Jim_Cmd *cmd; /* The currently executing command */
+ struct Jim_EvalFrame *parent; /* The parent frame or NULL if at top */
+ Jim_Obj *const *argv; /* object vector of the current command . */
+ int argc; /* number of args */
+ Jim_Obj *scriptObj;
+} Jim_EvalFrame;
+
/* The var structure. It just holds the pointer of the referenced
* object. If linkFramePtr is not NULL the variable is a link
* to a variable of name stored in objPtr living in the given callframe
@@ -488,6 +500,7 @@ typedef struct Jim_Cmd {
int inUse; /* Reference count */
int isproc; /* Is this a procedure? */
struct Jim_Cmd *prevCmd; /* Previous command defn if cmd created 'local' */
+ Jim_Obj *cmdNameObj; /* The fully resolved command name - just a pointer, not a reference */
union {
struct {
/* native (C) command */
@@ -555,6 +568,10 @@ typedef struct Jim_Interp {
Jim_Obj *liveList; /* Linked list of all the live objects. */
Jim_Obj *freeList; /* Linked list of all the unused objects. */
Jim_Obj *currentScriptObj; /* Script currently in execution. */
+ Jim_EvalFrame topEvalFrame; /* dummy top evaluation frame */
+ Jim_EvalFrame *evalFrame; /* evaluation stack */
+ int argc;
+ Jim_Obj * const *argv;
Jim_Obj *nullScriptObj; /* script representation of an empty string */
Jim_Obj *emptyObj; /* Shared empty string object. */
Jim_Obj *trueObj; /* Shared true int object. */