aboutsummaryrefslogtreecommitdiff
path: root/tcl_loader.c
diff options
context:
space:
mode:
authormescalinum <mescalinum@users.sourceforge.net>2011-10-14 21:32:49 +0000
committermescalinum <mescalinum@users.sourceforge.net>2011-10-14 21:32:49 +0000
commit9ea4e9fc1b4775a0e6b1c387a2a0965686c1c20e (patch)
tree1e34e08655343287c27aed8ecfc1ff7a1f630191 /tcl_loader.c
parent27e3734f86554c31a4593b998ca5312cf1b1af5b (diff)
reorder tcl land into namespaces and streamline and standardize syntax
svn path=/trunk/externals/loaders/tclpd/; revision=15600
Diffstat (limited to 'tcl_loader.c')
-rw-r--r--tcl_loader.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/tcl_loader.c b/tcl_loader.c
index 95d0232..0766a8c 100644
--- a/tcl_loader.c
+++ b/tcl_loader.c
@@ -47,8 +47,13 @@ gotone:
strncat(filename, nameptr, MAXPDSTRING-strlen(filename));
filename[MAXPDSTRING-1] = 0;
+ int result;
+
+ // create the required tcl namespace for the class
+ tclpd_class_namespace_init(classname);
+
// load tcl external:
- int result = Tcl_EvalFile(tcl_for_pd, filename);
+ result = Tcl_EvalFile(tcl_for_pd, filename);
if(result == TCL_OK) {
post("Tcl loader: loaded %s", filename);
} else {
@@ -57,6 +62,19 @@ gotone:
return 0;
}
+#ifdef TCLPD_CALL_SETUP
+ // call the setup method:
+ char cmd[64];
+ snprintf(cmd, 64, "::%s::setup", classname);
+ result = Tcl_Eval(tcl_for_pd, cmd);
+ if(result == TCL_OK) {
+ } else {
+ post("Tcl loader: error in %s %s::setup", filename, classname);
+ tclpd_interp_error(NULL, result);
+ return 0;
+ }
+#endif // TCLPD_CALL_SETUP
+
class_set_extern_dir(&s_);
sys_putonloadlist(objectname);
return 1;