aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2016-04-04 05:24:45 +1000
committerSteve Bennett <steveb@workware.net.au>2016-08-17 15:57:39 +1000
commit97fd55353a2cc0b874e30a3c3ed63bf0ec2edc59 (patch)
treeaa646c63d7be3ae0e5fd99673fa0a7a500056682
parent0f35c013121121193b8f12e59015cf9c2da4ae10 (diff)
downloadjimtcl-97fd55353a2cc0b874e30a3c3ed63bf0ec2edc59.zip
jimtcl-97fd55353a2cc0b874e30a3c3ed63bf0ec2edc59.tar.gz
jimtcl-97fd55353a2cc0b874e30a3c3ed63bf0ec2edc59.tar.bz2
bootstrap: Add minimal package require support
Makes it easier to run the test suite if a minmal 'package require' is supported. Also omit SSL code from jim-aio.c Signed-off-by: Steve Bennett <steveb@workware.net.au>
-rw-r--r--bootstrap.tcl15
-rw-r--r--jim-aio.c20
-rwxr-xr-xmake-bootstrap-jim2
3 files changed, 23 insertions, 14 deletions
diff --git a/bootstrap.tcl b/bootstrap.tcl
index e7adf4b..f6c404f 100644
--- a/bootstrap.tcl
+++ b/bootstrap.tcl
@@ -1,3 +1,12 @@
-# No need for package support in the bootstrap jimsh, but
-# Tcl extensions call package require
-proc package {args} {}
+# Minimal support for package require
+# No error on failure since C extensions aren't handled
+proc package {cmd pkg} {
+ if {$cmd eq "require"} {
+ foreach path $::auto_path {
+ if {[file exists $path/$pkg.tcl]} {
+ uplevel #0 [list source $path/$pkg.tcl]
+ return
+ }
+ }
+ }
+}
diff --git a/jim-aio.c b/jim-aio.c
index 0d11648..cefcaf8 100644
--- a/jim-aio.c
+++ b/jim-aio.c
@@ -192,7 +192,7 @@ static const JimAioFopsType stdio_fops = {
NULL
};
-#if defined(JIM_SSL)
+#if defined(JIM_SSL) && !defined(JIM_BOOTSTRAP)
static SSL_CTX *JimAioSslCtx(Jim_Interp *interp);
@@ -270,7 +270,7 @@ static const JimAioFopsType ssl_fops = {
ssl_strerror,
ssl_verify
};
-#endif
+#endif /* JIM_BOOTSTRAP */
static int JimAioSubCmdProc(Jim_Interp *interp, int argc, Jim_Obj *const *argv);
static AioFile *JimMakeChannel(Jim_Interp *interp, FILE *fh, int fd, Jim_Obj *filename,
@@ -1053,7 +1053,7 @@ static int aio_cmd_onexception(Jim_Interp *interp, int argc, Jim_Obj *const *arg
}
#endif
-#if defined(JIM_SSL)
+#if defined(JIM_SSL) && !defined(JIM_BOOTSTRAP)
static int aio_cmd_ssl(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
AioFile *af = Jim_CmdPrivData(interp);
@@ -1156,7 +1156,7 @@ static int aio_cmd_verify(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
}
return ret;
}
-#endif
+#endif /* JIM_BOOTSTRAP */
static const jim_subcmd_type aio_command_table[] = {
{ "read",
@@ -1315,7 +1315,7 @@ static const jim_subcmd_type aio_command_table[] = {
/* Description: Returns script, or invoke exception-script when oob data, {} to remove */
},
#endif
-#if defined(JIM_SSL)
+#if defined(JIM_SSL) && !defined(JIM_BOOTSTRAP)
{ "ssl",
"?-server cert priv?",
aio_cmd_ssl,
@@ -1331,7 +1331,7 @@ static const jim_subcmd_type aio_command_table[] = {
0,
/* Description: Verifies the certificate of a SSL/TLS channel */
},
-#endif
+#endif /* JIM_BOOTSTRAP */
{ NULL }
};
@@ -1371,7 +1371,7 @@ static int JimAioOpenCommand(Jim_Interp *interp, int argc,
return JimMakeChannel(interp, NULL, -1, argv[1], "aio.handle%ld", 0, mode) ? JIM_OK : JIM_ERR;
}
-#if defined(JIM_SSL)
+#if defined(JIM_SSL) && !defined(JIM_BOOTSTRAP)
static void JimAioSslContextDelProc(struct Jim_Interp *interp, void *privData)
{
SSL_CTX_free((SSL_CTX *)privData);
@@ -1394,7 +1394,7 @@ static SSL_CTX *JimAioSslCtx(Jim_Interp *interp)
}
return ssl_ctx;
}
-#endif
+#endif /* JIM_BOOTSTRAP */
/**
* Creates a channel for fh/fd/filename.
@@ -1824,7 +1824,7 @@ int Jim_MakeTempFile(Jim_Interp *interp, const char *template)
#endif
}
-#if defined(JIM_SSL)
+#if defined(JIM_SSL) && !defined(JIM_BOOTSTRAP)
static int JimAioLoadSSLCertsCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
{
SSL_CTX *ssl_ctx;
@@ -1844,7 +1844,7 @@ static int JimAioLoadSSLCertsCommand(Jim_Interp *interp, int argc, Jim_Obj *cons
Jim_SetResultString(interp, ERR_error_string(ERR_get_error(), NULL), -1);
return JIM_ERR;
}
-#endif
+#endif /* JIM_BOOTSTRAP */
int Jim_aioInit(Jim_Interp *interp)
{
diff --git a/make-bootstrap-jim b/make-bootstrap-jim
index 929eb4e..ba3b2f8 100755
--- a/make-bootstrap-jim
+++ b/make-bootstrap-jim
@@ -44,7 +44,7 @@ cexts="aio readdir regexp file exec clock array"
tclexts="bootstrap initjimsh glob stdlib tclcompat"
# Note ordering
-allexts="bootstrap aio readdir glob regexp file exec clock array stdlib tclcompat"
+allexts="bootstrap aio readdir regexp file glob exec clock array stdlib tclcompat"
echo "/* This is single source file, bootstrap version of Jim Tcl. See http://jim.tcl.tk/ */"