OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tcl/] [unix/] [tclAppInit.c] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
/*
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
 *
10
 * See the file "license.terms" for information on usage and redistribution
11
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
12
 *
13
 * RCS: @(#) $Id: tclAppInit.c,v 1.1.1.1 2002-01-16 10:25:37 markom Exp $
14
 */
15
 
16
#ifdef TCL_XT_TEST
17
#include <X11/Intrinsic.h>
18
#endif
19
 
20
#include "tcl.h"
21
 
22
/*
23
 * The following variable is a special hack that is needed in order for
24
 * Sun shared libraries to be used for Tcl.
25
 */
26
 
27
extern int matherr();
28
int *tclDummyMathPtr = (int *) matherr;
29
 
30
 
31
#ifdef TCL_TEST
32
EXTERN int              Procbodytest_Init _ANSI_ARGS_((Tcl_Interp *interp));
33
EXTERN int              Procbodytest_SafeInit _ANSI_ARGS_((Tcl_Interp *interp));
34
EXTERN int              TclObjTest_Init _ANSI_ARGS_((Tcl_Interp *interp));
35
EXTERN int              Tcltest_Init _ANSI_ARGS_((Tcl_Interp *interp));
36
#endif /* TCL_TEST */
37
#ifdef TCL_XT_TEST
38
EXTERN int              Tclxttest_Init _ANSI_ARGS_((Tcl_Interp *interp));
39
#endif
40
 
41
/*
42
 *----------------------------------------------------------------------
43
 *
44
 * main --
45
 *
46
 *      This is the main program for the application.
47
 *
48
 * Results:
49
 *      None: Tcl_Main never returns here, so this procedure never
50
 *      returns either.
51
 *
52
 * Side effects:
53
 *      Whatever the application does.
54
 *
55
 *----------------------------------------------------------------------
56
 */
57
 
58
int
59
main(argc, argv)
60
    int argc;                   /* Number of command-line arguments. */
61
    char **argv;                /* Values of command-line arguments. */
62
{
63
#ifdef TCL_XT_TEST
64
    XtToolkitInitialize();
65
#endif
66
    Tcl_Main(argc, argv, Tcl_AppInit);
67
    return 0;                    /* Needed only to prevent compiler warning. */
68
}
69
 
70
/*
71
 *----------------------------------------------------------------------
72
 *
73
 * Tcl_AppInit --
74
 *
75
 *      This procedure performs application-specific initialization.
76
 *      Most applications, especially those that incorporate additional
77
 *      packages, will have their own version of this procedure.
78
 *
79
 * Results:
80
 *      Returns a standard Tcl completion code, and leaves an error
81
 *      message in interp->result if an error occurs.
82
 *
83
 * Side effects:
84
 *      Depends on the startup script.
85
 *
86
 *----------------------------------------------------------------------
87
 */
88
 
89
int
90
Tcl_AppInit(interp)
91
    Tcl_Interp *interp;         /* Interpreter for application. */
92
{
93
    if (Tcl_Init(interp) == TCL_ERROR) {
94
        return TCL_ERROR;
95
    }
96
 
97
#ifdef TCL_TEST
98
#ifdef TCL_XT_TEST
99
     if (Tclxttest_Init(interp) == TCL_ERROR) {
100
         return TCL_ERROR;
101
     }
102
#endif
103
    if (Tcltest_Init(interp) == TCL_ERROR) {
104
        return TCL_ERROR;
105
    }
106
    Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init,
107
            (Tcl_PackageInitProc *) NULL);
108
    if (TclObjTest_Init(interp) == TCL_ERROR) {
109
        return TCL_ERROR;
110
    }
111
    if (Procbodytest_Init(interp) == TCL_ERROR) {
112
        return TCL_ERROR;
113
    }
114
    Tcl_StaticPackage(interp, "procbodytest", Procbodytest_Init,
115
            Procbodytest_SafeInit);
116
#endif /* TCL_TEST */
117
 
118
    /*
119
     * Call the init procedures for included packages.  Each call should
120
     * look like this:
121
     *
122
     * if (Mod_Init(interp) == TCL_ERROR) {
123
     *     return TCL_ERROR;
124
     * }
125
     *
126
     * where "Mod" is the name of the module.
127
     */
128
 
129
    /*
130
     * Call Tcl_CreateCommand for application-specific commands, if
131
     * they weren't already created by the init procedures called above.
132
     */
133
 
134
    /*
135
     * Specify a user-specific startup file to invoke if the application
136
     * is run interactively.  Typically the startup file is "~/.apprc"
137
     * where "app" is the name of the application.  If this line is deleted
138
     * then no user-specific startup file will be run under any conditions.
139
     */
140
 
141
    Tcl_SetVar(interp, "tcl_rcFileName", "~/.tclshrc", TCL_GLOBAL_ONLY);
142
    return TCL_OK;
143
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.