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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tk/] [unix/] [tkAppInit.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
/*
2
 * tkAppInit.c --
3
 *
4
 *      Provides a default version of the Tcl_AppInit procedure for
5
 *      use in wish and similar Tk-based applications.
6
 *
7
 * Copyright (c) 1993 The Regents of the University of California.
8
 * Copyright (c) 1994 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: tkAppInit.c,v 1.1.1.1 2002-01-16 10:26:01 markom Exp $
14
 */
15
 
16
#include "tk.h"
17
 
18
/*
19
 * The following variable is a special hack that is needed in order for
20
 * Sun shared libraries to be used for Tcl.
21
 */
22
 
23
extern int matherr();
24
int *tclDummyMathPtr = (int *) matherr;
25
 
26
#ifdef TK_TEST
27
EXTERN int              Tktest_Init _ANSI_ARGS_((Tcl_Interp *interp));
28
#endif /* TK_TEST */
29
 
30
/*
31
 *----------------------------------------------------------------------
32
 *
33
 * main --
34
 *
35
 *      This is the main program for the application.
36
 *
37
 * Results:
38
 *      None: Tk_Main never returns here, so this procedure never
39
 *      returns either.
40
 *
41
 * Side effects:
42
 *      Whatever the application does.
43
 *
44
 *----------------------------------------------------------------------
45
 */
46
 
47
int
48
main(argc, argv)
49
    int argc;                   /* Number of command-line arguments. */
50
    char **argv;                /* Values of command-line arguments. */
51
{
52
    Tk_Main(argc, argv, Tcl_AppInit);
53
    return 0;                    /* Needed only to prevent compiler warning. */
54
}
55
 
56
/*
57
 *----------------------------------------------------------------------
58
 *
59
 * Tcl_AppInit --
60
 *
61
 *      This procedure performs application-specific initialization.
62
 *      Most applications, especially those that incorporate additional
63
 *      packages, will have their own version of this procedure.
64
 *
65
 * Results:
66
 *      Returns a standard Tcl completion code, and leaves an error
67
 *      message in interp->result if an error occurs.
68
 *
69
 * Side effects:
70
 *      Depends on the startup script.
71
 *
72
 *----------------------------------------------------------------------
73
 */
74
 
75
int
76
Tcl_AppInit(interp)
77
    Tcl_Interp *interp;         /* Interpreter for application. */
78
{
79
    if (Tcl_Init(interp) == TCL_ERROR) {
80
        return TCL_ERROR;
81
    }
82
    if (Tk_Init(interp) == TCL_ERROR) {
83
        return TCL_ERROR;
84
    }
85
    Tcl_StaticPackage(interp, "Tk", Tk_Init, Tk_SafeInit);
86
#ifdef TK_TEST
87
    if (Tktest_Init(interp) == TCL_ERROR) {
88
        return TCL_ERROR;
89
    }
90
    Tcl_StaticPackage(interp, "Tktest", Tktest_Init,
91
            (Tcl_PackageInitProc *) NULL);
92
#endif /* TK_TEST */
93
 
94
 
95
    /*
96
     * Call the init procedures for included packages.  Each call should
97
     * look like this:
98
     *
99
     * if (Mod_Init(interp) == TCL_ERROR) {
100
     *     return TCL_ERROR;
101
     * }
102
     *
103
     * where "Mod" is the name of the module.
104
     */
105
 
106
    /*
107
     * Call Tcl_CreateCommand for application-specific commands, if
108
     * they weren't already created by the init procedures called above.
109
     */
110
 
111
    /*
112
     * Specify a user-specific startup file to invoke if the application
113
     * is run interactively.  Typically the startup file is "~/.apprc"
114
     * where "app" is the name of the application.  If this line is deleted
115
     * then no user-specific startup file will be run under any conditions.
116
     */
117
 
118
    Tcl_SetVar(interp, "tcl_rcFileName", "~/.wishrc", TCL_GLOBAL_ONLY);
119
    return TCL_OK;
120
}

powered by: WebSVN 2.1.0

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