/[dtapublic]/projs/ets/trunk/src/c_tcl_base_7_5_w_mods/tclinitscript.h
ViewVC logotype

Annotation of /projs/ets/trunk/src/c_tcl_base_7_5_w_mods/tclinitscript.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 44 - (hide annotations) (download)
Fri Oct 14 02:09:58 2016 UTC (7 years, 9 months ago) by dashley
Original Path: projs/trunk/shared_source/c_tcl_base_7_5_w_mods/tclinitscript.h
File MIME type: text/plain
File size: 3762 byte(s)
Rename for reorganization.
1 dashley 25 /* $Header: /cvsroot/esrg/sfesrg/esrgpcpj/shared/tcl_base/tclinitscript.h,v 1.1.1.1 2001/06/13 04:39:33 dtashley Exp $ */
2    
3     /*
4     * tclInitScript.h --
5     *
6     * This file contains Unix & Windows common init script
7     * It is not used on the Mac. (the mac init script is in tclMacInit.c)
8     *
9     * Copyright (c) 1998 Sun Microsystems, Inc.
10     * Copyright (c) 1999 by Scriptics Corporation.
11     * All rights reserved.
12     *
13     * RCS: @(#) $Id: tclinitscript.h,v 1.1.1.1 2001/06/13 04:39:33 dtashley Exp $
14     */
15    
16     /*
17     * In order to find init.tcl during initialization, the following script
18     * is invoked by Tcl_Init(). It looks in several different directories:
19     *
20     * $tcl_library - can specify a primary location, if set
21     * no other locations will be checked
22     *
23     * $env(TCL_LIBRARY) - highest priority so user can always override
24     * the search path unless the application has
25     * specified an exact directory above
26     *
27     * $tclDefaultLibrary - this value is initialized by TclPlatformInit
28     * from a static C variable that was set at
29     * compile time
30     *
31     * $tcl_libPath - this value is initialized by a call to
32     * TclGetLibraryPath called from Tcl_Init.
33     *
34     * The first directory on this path that contains a valid init.tcl script
35     * will be set as the value of tcl_library.
36     *
37     * Note that this entire search mechanism can be bypassed by defining an
38     * alternate tclInit procedure before calling Tcl_Init().
39     */
40    
41     static char initScript[] = "if {[info proc tclInit]==\"\"} {\n\
42     proc tclInit {} {\n\
43     global tcl_libPath tcl_library errorInfo\n\
44     global env tclDefaultLibrary\n\
45     rename tclInit {}\n\
46     set errors {}\n\
47     set dirs {}\n\
48     if {[info exists tcl_library]} {\n\
49     lappend dirs $tcl_library\n\
50     } else {\n\
51     if {[info exists env(TCL_LIBRARY)]} {\n\
52     lappend dirs $env(TCL_LIBRARY)\n\
53     }\n\
54     lappend dirs $tclDefaultLibrary\n\
55     unset tclDefaultLibrary\n\
56     set dirs [concat $dirs $tcl_libPath]\n\
57     }\n\
58     foreach i $dirs {\n\
59     set tcl_library $i\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\
63     return\n\
64     } else {\n\
65     append errors \"$tclfile: $msg\n$errorInfo\n\"\n\
66     }\n\
67     }\n\
68     }\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\
73     error $msg\n\
74     }\n\
75     }\n\
76     tclInit";
77    
78    
79     /*
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.
83     */
84    
85     static char * tclPreInitScript = NULL;
86    
87    
88     /*
89     *----------------------------------------------------------------------
90     *
91     * TclSetPreInitScript --
92     *
93     * This routine is used to change the value of the internal
94     * variable, tclPreInitScript.
95     *
96     * Results:
97     * Returns the current value of tclPreInitScript.
98     *
99     * Side effects:
100     * Changes the way Tcl_Init() routine behaves.
101     *
102     *----------------------------------------------------------------------
103     */
104    
105     char *
106     TclSetPreInitScript (string)
107     char *string; /* Pointer to a script. */
108     {
109     char *prevString = tclPreInitScript;
110     tclPreInitScript = string;
111     return(prevString);
112     }
113    
114    
115     /* $History: tclinitscript.h $
116     *
117     * ***************** Version 1 *****************
118     * User: Dtashley Date: 1/02/01 Time: 1:29a
119     * Created in $/IjuScripter, IjuConsole/Source/Tcl Base
120     * Initial check-in.
121     */
122    
123     /* End of TCLINITSCRIPT.H */

dashley@gmail.com
ViewVC Help
Powered by ViewVC 1.1.25