Skip to content
Browse files

[package require] should load at the global level

Signed-off-by: Steve Bennett <steveb@workware.net.au>
  • Loading branch information...
1 parent 780ea16 commit c8428e13c4fc0afcf3b43ed9581cab92cd58384e @msteveb msteveb committed
Showing with 14 additions and 1 deletion.
  1. +1 −1 jim-package.c
  2. +12 −0 jim.c
  3. +1 −0 jim.h
View
2 jim-package.c
@@ -102,7 +102,7 @@ static int JimLoadPackage(Jim_Interp *interp, const char *name, int flags)
/* Try to load/source it */
if (p && strcmp(p, ".tcl") == 0) {
- retCode = Jim_EvalFile(interp, path);
+ retCode = Jim_EvalFileGlobal(interp, path);
}
#ifdef jim_ext_load
else {
View
12 jim.c
@@ -9970,6 +9970,18 @@ int Jim_EvalGlobal(Jim_Interp *interp, const char *script)
return retval;
}
+int Jim_EvalFileGlobal(Jim_Interp *interp, const char *filename)
+{
+ int retval;
+ Jim_CallFrame *savedFramePtr = interp->framePtr;
+
+ interp->framePtr = interp->topFramePtr;
+ retval = Jim_EvalFile(interp, filename);
+ interp->framePtr = savedFramePtr;
+
+ return retval;
+}
+
#include <sys/stat.h>
int Jim_EvalFile(Jim_Interp *interp, const char *filename)
View
1 jim.h
@@ -622,6 +622,7 @@ JIM_EXPORT int Jim_Eval(Jim_Interp *interp, const char *script);
JIM_EXPORT int Jim_Eval_Named(Jim_Interp *interp, const char *script,const char *filename, int lineno);
JIM_EXPORT int Jim_EvalGlobal(Jim_Interp *interp, const char *script);
JIM_EXPORT int Jim_EvalFile(Jim_Interp *interp, const char *filename);
+JIM_EXPORT int Jim_EvalFileGlobal(Jim_Interp *interp, const char *filename);
JIM_EXPORT int Jim_EvalObj (Jim_Interp *interp, Jim_Obj *scriptObjPtr);
JIM_EXPORT int Jim_EvalObjVector (Jim_Interp *interp, int objc,
Jim_Obj *const *objv);

0 comments on commit c8428e1

Please sign in to comment.
Something went wrong with that request. Please try again.