summaryrefslogtreecommitdiffstats
path: root/generic/tclInitScript.h
diff options
context:
space:
mode:
authorwelch <welch@noemail.net>1998-06-27 22:11:40 (GMT)
committerwelch <welch@noemail.net>1998-06-27 22:11:40 (GMT)
commitae2a34957b64d0a31efc3a5756b2582be01a3499 (patch)
treed6acbd6c89b7ac83d44408067b05a2a7709abeab /generic/tclInitScript.h
parentbad23c30f183e85acf85ab5c18da435fbf5c8fc2 (diff)
downloadtcl-ae2a34957b64d0a31efc3a5756b2582be01a3499.zip
tcl-ae2a34957b64d0a31efc3a5756b2582be01a3499.tar.gz
tcl-ae2a34957b64d0a31efc3a5756b2582be01a3499.tar.bz2
Initial revision
FossilOrigin-Name: 03212445acff381617a2744e22e3fb46e796541e
Diffstat (limited to 'generic/tclInitScript.h')
-rw-r--r--generic/tclInitScript.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/generic/tclInitScript.h b/generic/tclInitScript.h
new file mode 100644
index 0000000..c3b21a3
--- /dev/null
+++ b/generic/tclInitScript.h
@@ -0,0 +1,65 @@
+/*
+ * tclInitScript.h --
+ *
+ * This file contains Unix & Windows common init script
+ * It is not used on the Mac. (the mac init script is in tclMacInit.c)
+ *
+ * Copyright (c) 1998 Sun Microsystems, Inc.
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ *
+ * SCCS: %Z% $Id: tclInitScript.h,v 1.1 1998/06/27 22:11:40 welch Exp $
+ */
+
+/*
+ * The following string is the startup script executed in new
+ * interpreters. It looks on disk in (way too many) different directories
+ * for a script "init.tcl" that is compatible with this version
+ * of Tcl. The init.tcl script does all of the real work of
+ * initialization.
+ */
+
+static char initScript[] = "if {[info proc tclInit]==\"\"} {\n\
+ proc tclInit {} {\n\
+ global tcl_library tcl_version tcl_patchLevel errorInfo\n\
+ global tcl_pkgPath\n\
+ rename tclInit {}\n\
+ set errors {}\n\
+ set dirs {}\n\
+ if {[info exists env(TCL_LIBRARY)]} {\n\
+ lappend dirs $env(TCL_LIBRARY)\n\
+ }\n\
+ lappend dirs $tcl_library\n\
+ set parentDir [file dirname [file dirname [info nameofexecutable]]]\n\
+ lappend dirs [file join $parentDir lib/tcl$tcl_version]\n\
+ if {[string match {*[ab]*} $tcl_patchLevel]} {\n\
+ set lib tcl$tcl_patchLevel\n\
+ } else {\n\
+ set lib tcl$tcl_version\n\
+ }\n\
+ lappend dirs [file join [file dirname [file dirname [pwd]]] $lib/library]\n\
+ lappend dirs [file join [file dirname [pwd]] library]\n\
+ lappend dirs [file join [file dirname $parentDir] $lib/library]\n\
+ lappend dirs [file join $parentDir library]\n\
+ foreach i $dirs {\n\
+ set tcl_library $i\n\
+ set tclfile [file join $i init.tcl]\n\
+ if {[file exists $tclfile]} {\n\
+ if {![catch {uplevel #0 [list source $tclfile]} msg]} {\n\
+ lappend tcl_pkgPath [file dirname $i]\n\
+ return\n\
+ } else {\n\
+ append errors \"$tclfile: $msg\n$errorInfo\n\"\n\
+ }\n\
+ }\n\
+ }\n\
+ set msg \"Can't find a usable init.tcl in the following directories: \n\"\n\
+ append msg \" $dirs\n\n\"\n\
+ append msg \"$errors\n\n\"\n\
+ append msg \"This probably means that Tcl wasn't installed properly.\n\"\n\
+ error $msg\n\
+ }\n\
+}\n\
+tclInit";
+