~ubuntu-branches/ubuntu/quantal/gclcvs/quantal

« back to all changes in this revision

Viewing changes to gcl-tk/tkAppInit.c

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2004-06-24 15:13:46 UTC
  • Revision ID: james.westby@ubuntu.com-20040624151346-xh0xaaktyyp7aorc
Tags: 2.7.0-26
C_GC_OFFSET is 2 on m68k-linux

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* 
 
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
 * All rights reserved.
 
9
 *
 
10
 * Permission is hereby granted, without written agreement and without
 
11
 * license or royalty fees, to use, copy, modify, and distribute this
 
12
 * software and its documentation for any purpose, provided that the
 
13
 * above copyright notice and the following two paragraphs appear in
 
14
 * all copies of this software.
 
15
 * 
 
16
 * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
 
17
 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
 
18
 * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
 
19
 * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
20
 *
 
21
 * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
 
22
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 
23
 * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
 
24
 * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
 
25
 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 
26
 */
 
27
 
 
28
/*  #ifndef lint */
 
29
/*  static char rcsid[] = "/usr/home/gah/repository/blt/tkAppInit.c,v 1.3 1994/04/02 04:37:26 gah Exp SPRITE (Berkeley) $Revision"; */
 
30
/*  #endif */
 
31
 
 
32
#include "tk.h"
 
33
 
 
34
/*
 
35
 * The following variable is a special hack that allows applications
 
36
 * to be linked using the procedure "main" from the Tk library.  The
 
37
 * variable generates a reference to "main", which causes main to
 
38
 * be brought in from the library (and all of Tk and Tcl with it).
 
39
 */
 
40
 
 
41
extern int main();
 
42
int *tclDummyMainPtr = (int *) main;
 
43
 
 
44
/*
 
45
 *----------------------------------------------------------------------
 
46
 *
 
47
 * Tcl_AppInit --
 
48
 *
 
49
 *      This procedure performs application-specific initialization.
 
50
 *      Most applications, especially those that incorporate additional
 
51
 *      packages, will have their own version of this procedure.
 
52
 *
 
53
 * Results:
 
54
 *      Returns a standard Tcl completion code, and leaves an error
 
55
 *      message in interp->result if an error occurs.
 
56
 *
 
57
 * Side effects:
 
58
 *      Depends on the startup script.
 
59
 *
 
60
 *----------------------------------------------------------------------
 
61
 */
 
62
 
 
63
int
 
64
Tcl_AppInit(interp)
 
65
    Tcl_Interp *interp;         /* Interpreter for application. */
 
66
{
 
67
    Tk_Window mmain;
 
68
/*
 
69
    extern int Blt_Init _ANSI_ARGS_((Tcl_Interp *interp));
 
70
*/
 
71
    mmain = Tk_MainWindow(interp);
 
72
 
 
73
    /*
 
74
     * Call the init procedures for included packages.  Each call should
 
75
     * look like this:
 
76
     *
 
77
     * if (Mod_Init(interp) == TCL_ERROR) {
 
78
     *     return TCL_ERROR;
 
79
     * }
 
80
     *
 
81
     * where "Mod" is the name of the module.
 
82
     */
 
83
/*
 
84
    if (Blt_Init(interp) == TCL_ERROR) {
 
85
        return TCL_ERROR;
 
86
    }
 
87
*/
 
88
    if (Tcl_Init(interp) == TCL_ERROR) {
 
89
        return TCL_ERROR;
 
90
    }
 
91
    if (Tk_Init(interp) == TCL_ERROR) {
 
92
        return TCL_ERROR;
 
93
    }
 
94
 
 
95
    /*
 
96
     * Call Tcl_CreateCommand for application-specific commands, if
 
97
     * they weren't already created by the init procedures called above.
 
98
     */
 
99
 
 
100
    /*
 
101
     * Specify a user-specific startup file to invoke if the application
 
102
     * is run interactively.  Typically the startup file is "~/.apprc"
 
103
     * where "app" is the name of the application.  If this line is deleted
 
104
     * then no user-specific startup file will be run under any conditions.
 
105
     */
 
106
 
 
107
    /* for version tk 3.5:
 
108
      tcl_RcFileName = "~/.wishrc";
 
109
      */ 
 
110
    Tcl_SetVar(interp, "tcl_rcFileName", "~/.wishrc", TCL_GLOBAL_ONLY);
 
111
    return TCL_OK;
 
112
}