source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/vrippack-0.31/lib/linux/tcl8.4/tclAppInit.c @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 4.8 KB
Line 
1/*
2 * tclAppInit.c --
3 *
4 *      Provides a default version of the main program and Tcl_AppInit
5 *      procedure for Tcl applications (without Tk).
6 *
7 * Copyright (c) 1993 The Regents of the University of California.
8 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
9 * Copyright (c) 1998-1999 by Scriptics Corporation.
10 *
11 * See the file "license.terms" for information on usage and redistribution
12 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
13 *
14 * RCS: @(#) $Id: tclAppInit.c,v 1.11 2002/05/31 22:20:22 dgp Exp $
15 */
16
17#include "tcl.h"
18
19#ifdef TCL_TEST
20
21#include "tclInt.h"
22
23extern int              Procbodytest_Init _ANSI_ARGS_((Tcl_Interp *interp));
24extern int              Procbodytest_SafeInit _ANSI_ARGS_((Tcl_Interp *interp));
25extern int              TclObjTest_Init _ANSI_ARGS_((Tcl_Interp *interp));
26extern int              Tcltest_Init _ANSI_ARGS_((Tcl_Interp *interp));
27#ifdef TCL_THREADS
28extern int              TclThread_Init _ANSI_ARGS_((Tcl_Interp *interp));
29#endif
30
31#endif /* TCL_TEST */
32
33#ifdef TCL_XT_TEST
34extern void             XtToolkitInitialize _ANSI_ARGS_((void));
35extern int              Tclxttest_Init _ANSI_ARGS_((Tcl_Interp *interp));
36#endif
37
38/*
39 *----------------------------------------------------------------------
40 *
41 * main --
42 *
43 *      This is the main program for the application.
44 *
45 * Results:
46 *      None: Tcl_Main never returns here, so this procedure never
47 *      returns either.
48 *
49 * Side effects:
50 *      Whatever the application does.
51 *
52 *----------------------------------------------------------------------
53 */
54
55int
56main(argc, argv)
57    int argc;                   /* Number of command-line arguments. */
58    char **argv;                /* Values of command-line arguments. */
59{
60    /*
61     * The following #if block allows you to change the AppInit
62     * function by using a #define of TCL_LOCAL_APPINIT instead
63     * of rewriting this entire file.  The #if checks for that
64     * #define and uses Tcl_AppInit if it doesn't exist.
65     */
66
67#ifndef TCL_LOCAL_APPINIT
68#define TCL_LOCAL_APPINIT Tcl_AppInit   
69#endif
70    extern int TCL_LOCAL_APPINIT _ANSI_ARGS_((Tcl_Interp *interp));
71
72    /*
73     * The following #if block allows you to change how Tcl finds the startup
74     * script, prime the library or encoding paths, fiddle with the argv,
75     * etc., without needing to rewrite Tcl_Main()
76     */
77
78#ifdef TCL_LOCAL_MAIN_HOOK
79    extern int TCL_LOCAL_MAIN_HOOK _ANSI_ARGS_((int *argc, char ***argv));
80#endif
81
82#ifdef TCL_XT_TEST
83    XtToolkitInitialize();
84#endif
85
86#ifdef TCL_LOCAL_MAIN_HOOK
87    TCL_LOCAL_MAIN_HOOK(&argc, &argv);
88#endif
89
90    Tcl_Main(argc, argv, TCL_LOCAL_APPINIT);
91
92    return 0;                   /* Needed only to prevent compiler warning. */
93}
94
95/*
96 *----------------------------------------------------------------------
97 *
98 * Tcl_AppInit --
99 *
100 *      This procedure performs application-specific initialization.
101 *      Most applications, especially those that incorporate additional
102 *      packages, will have their own version of this procedure.
103 *
104 * Results:
105 *      Returns a standard Tcl completion code, and leaves an error
106 *      message in the interp's result if an error occurs.
107 *
108 * Side effects:
109 *      Depends on the startup script.
110 *
111 *----------------------------------------------------------------------
112 */
113
114int
115Tcl_AppInit(interp)
116    Tcl_Interp *interp;         /* Interpreter for application. */
117{
118    if (Tcl_Init(interp) == TCL_ERROR) {
119        return TCL_ERROR;
120    }
121
122#ifdef TCL_TEST
123#ifdef TCL_XT_TEST
124     if (Tclxttest_Init(interp) == TCL_ERROR) {
125         return TCL_ERROR;
126     }
127#endif
128    if (Tcltest_Init(interp) == TCL_ERROR) {
129        return TCL_ERROR;
130    }
131    Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init,
132            (Tcl_PackageInitProc *) NULL);
133    if (TclObjTest_Init(interp) == TCL_ERROR) {
134        return TCL_ERROR;
135    }
136#ifdef TCL_THREADS
137    if (TclThread_Init(interp) == TCL_ERROR) {
138        return TCL_ERROR;
139    }
140#endif
141    if (Procbodytest_Init(interp) == TCL_ERROR) {
142        return TCL_ERROR;
143    }
144    Tcl_StaticPackage(interp, "procbodytest", Procbodytest_Init,
145            Procbodytest_SafeInit);
146#endif /* TCL_TEST */
147
148    /*
149     * Call the init procedures for included packages.  Each call should
150     * look like this:
151     *
152     * if (Mod_Init(interp) == TCL_ERROR) {
153     *     return TCL_ERROR;
154     * }
155     *
156     * where "Mod" is the name of the module.
157     */
158
159    /*
160     * Call Tcl_CreateCommand for application-specific commands, if
161     * they weren't already created by the init procedures called above.
162     */
163
164    /*
165     * Specify a user-specific startup file to invoke if the application
166     * is run interactively.  Typically the startup file is "~/.apprc"
167     * where "app" is the name of the application.  If this line is deleted
168     * then no user-specific startup file will be run under any conditions.
169     */
170
171#ifdef DJGPP
172    Tcl_SetVar(interp, "tcl_rcFileName", "~/tclsh.rc", TCL_GLOBAL_ONLY);
173#else
174    Tcl_SetVar(interp, "tcl_rcFileName", "~/.tclshrc", TCL_GLOBAL_ONLY);
175#endif
176    return TCL_OK;
177}
Note: See TracBrowser for help on using the repository browser.