os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/generic/tclInitScript.h
Update contrib.
4 * This file contains Unix & Windows common init script
5 * It is not used on the Mac. (the mac init script is in tclMacInit.c)
7 * Copyright (c) 1998 Sun Microsystems, Inc.
8 * Copyright (c) 1999 by Scriptics Corporation.
11 * RCS: @(#) $Id: tclInitScript.h,v 1.13 2001/09/10 21:06:55 dgp Exp $
15 * In order to find init.tcl during initialization, the following script
16 * is invoked by Tcl_Init(). It looks in several different directories:
18 * $tcl_library - can specify a primary location, if set
19 * no other locations will be checked
21 * $env(TCL_LIBRARY) - highest priority so user can always override
22 * the search path unless the application has
23 * specified an exact directory above
25 * $tclDefaultLibrary - this value is initialized by TclPlatformInit
26 * from a static C variable that was set at
29 * $tcl_libPath - this value is initialized by a call to
30 * TclGetLibraryPath called from Tcl_Init.
32 * The first directory on this path that contains a valid init.tcl script
33 * will be set as the value of tcl_library.
35 * Note that this entire search mechanism can be bypassed by defining an
36 * alternate tclInit procedure before calling Tcl_Init().
39 static char initScript[] = "if {[info proc tclInit]==\"\"} {\n\
41 global tcl_libPath tcl_library errorInfo\n\
42 global env tclDefaultLibrary\n\
46 if {[info exists tcl_library]} {\n\
47 lappend dirs $tcl_library\n\
49 if {[info exists env(TCL_LIBRARY)]} {\n\
50 lappend dirs $env(TCL_LIBRARY)\n\
53 lappend dirs $tclDefaultLibrary\n\
54 unset tclDefaultLibrary\n\
56 set dirs [concat $dirs $tcl_libPath]\n\
60 set tclfile [file join $i init.tcl]\n\
61 if {[file exists $tclfile]} {\n\
62 if {![catch {uplevel #0 [list source $tclfile]} msg]} {\n\
65 append errors \"$tclfile: $msg\n$errorInfo\n\"\n\
69 set msg \"Can't find a usable init.tcl in the following directories: \n\"\n\
70 append msg \" $dirs\n\n\"\n\
71 append msg \"$errors\n\n\"\n\
72 append msg \"This probably means that Tcl wasn't installed properly.\n\"\n\
80 * A pointer to a string that holds an initialization script that if non-NULL
81 * is evaluated in Tcl_Init() prior to the the built-in initialization script
82 * above. This variable can be modified by the procedure below.
85 static char * tclPreInitScript = NULL;
89 *----------------------------------------------------------------------
91 * TclSetPreInitScript --
93 * This routine is used to change the value of the internal
94 * variable, tclPreInitScript.
97 * Returns the current value of tclPreInitScript.
100 * Changes the way Tcl_Init() routine behaves.
102 *----------------------------------------------------------------------
106 TclSetPreInitScript (string)
107 char *string; /* Pointer to a script. */
109 char *prevString = tclPreInitScript;
110 tclPreInitScript = string;