~ubuntu-branches/ubuntu/vivid/gcl/vivid

« back to all changes in this revision

Viewing changes to gcl-tk/tkXAppInit.c

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2002-03-04 14:29:59 UTC
  • Revision ID: james.westby@ubuntu.com-20020304142959-dey14w08kr7lldu3
Tags: upstream-2.5.0.cvs20020219
ImportĀ upstreamĀ versionĀ 2.5.0.cvs20020219

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* 
 
2
 * tkXAppInit.c --
 
3
 *
 
4
 *      Provides a default version of the Tcl_AppInit procedure for use with
 
5
 *      applications built with Extended Tcl and Tk.  This is based on the
 
6
 *      the UCB Tk file tkAppInit.c
 
7
 *
 
8
 *-----------------------------------------------------------------------------
 
9
 * Copyright 1991-1993 Karl Lehenbauer and Mark Diekhans.
 
10
 *
 
11
 * Permission to use, copy, modify, and distribute this software and its
 
12
 * documentation for any purpose and without fee is hereby granted, provided
 
13
 * that the above copyright notice appear in all copies.  Karl Lehenbauer and
 
14
 * Mark Diekhans make no representations about the suitability of this
 
15
 * software for any purpose.  It is provided "as is" without express or
 
16
 * implied warranty.
 
17
 *-----------------------------------------------------------------------------
 
18
 * $Id: tkXAppInit.c,v 3.1 1993/11/21 01:19:20 markd Exp $
 
19
 *-----------------------------------------------------------------------------
 
20
 * Copyright (c) 1993 The Regents of the University of California.
 
21
 * All rights reserved.
 
22
 *
 
23
 * Permission is hereby granted, without written agreement and without
 
24
 * license or royalty fees, to use, copy, modify, and distribute this
 
25
 * software and its documentation for any purpose, provided that the
 
26
 * above copyright notice and the following two paragraphs appear in
 
27
 * all copies of this software.
 
28
 * 
 
29
 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
 
30
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
 
31
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
 
32
 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
33
 *
 
34
 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
 
35
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 
36
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 
37
 * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 
38
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 
39
 */
 
40
 
 
41
#ifndef lint
 
42
static char rcsid[] = "$Header: /u/markd/tcl/develop/extended/tksrc/RCS/tkXAppInit.c,v 3.1 1993/11/21 01:19:20 markd Exp $ SPRITE (Berkeley)";
 
43
#endif /* not lint */
 
44
 
 
45
#include "tclExtend.h"
 
46
#include "tk.h"
 
47
#include <math.h>
 
48
 
 
49
/*
 
50
 * The following variable is a special hack that allows applications
 
51
 * to be linked using the procedure "main" from the Tk library.  The
 
52
 * variable generates a reference to "main", which causes main to
 
53
 * be brought in from the library (and all of Tk and Tcl with it).
 
54
 */
 
55
 
 
56
EXTERN int main _ANSI_ARGS_((int     argc,
 
57
                             char  **argv));
 
58
int *tclDummyMainPtr = (int *) main;
 
59
 
 
60
/*
 
61
 * The following variable is a special hack that insures the tcl
 
62
 * version of matherr() is used when linking against shared libraries
 
63
 * Only define if matherr is used on this system.
 
64
 */
 
65
 
 
66
#if defined(DOMAIN) && defined(SING)
 
67
EXTERN int matherr _ANSI_ARGS_((struct exception *));
 
68
int *tclDummyMathPtr = (int *) matherr;
 
69
#endif
 
70
 
 
71
 
 
72
/*
 
73
 *----------------------------------------------------------------------
 
74
 *
 
75
 * Tcl_AppInit --
 
76
 *
 
77
 *      This procedure performs application-specific initialization.
 
78
 *      Most applications, especially those that incorporate additional
 
79
 *      packages, will have their own version of this procedure.
 
80
 *
 
81
 * Results:
 
82
 *      Returns a standard Tcl completion code, and leaves an error
 
83
 *      message in interp->result if an error occurs.
 
84
 *
 
85
 * Side effects:
 
86
 *      Depends on the startup script.
 
87
 *
 
88
 *----------------------------------------------------------------------
 
89
 */
 
90
 
 
91
int
 
92
Tcl_AppInit(interp)
 
93
    Tcl_Interp *interp;         /* Interpreter for application. */
 
94
{
 
95
    Tk_Window main;
 
96
 
 
97
    main = Tk_MainWindow(interp);
 
98
 
 
99
    /*
 
100
     * Call the init procedures for included packages.  Each call should
 
101
     * look like this:
 
102
     *
 
103
     * if (Mod_Init(interp) == TCL_ERROR) {
 
104
     *     return TCL_ERROR;
 
105
     * }
 
106
     *
 
107
     * where "Mod" is the name of the module.
 
108
     */
 
109
 
 
110
    if (TclX_Init(interp) == TCL_ERROR) {
 
111
        return TCL_ERROR;
 
112
    }
 
113
    if (TkX_Init(interp) == TCL_ERROR) {
 
114
        return TCL_ERROR;
 
115
    }
 
116
 
 
117
    /*
 
118
     * Call Tcl_CreateCommand for application-specific commands, if
 
119
     * they weren't already created by the init procedures called above.
 
120
     */
 
121
 
 
122
    /*
 
123
     * Specify a user-specific startup file to invoke if the application
 
124
     * is run interactively.  Typically the startup file is "~/.apprc"
 
125
     * where "app" is the name of the application.  If this line is deleted
 
126
     * then no user-specific startup file will be run under any conditions.
 
127
     */
 
128
 
 
129
    tcl_RcFileName = "~/.tclrc";
 
130
    return TCL_OK;
 
131
}