1/*
2 * tclXAppInit.c --
3 *
4 * Provides a default version of the Tcl_AppInit procedure for use with
5 * applications built with Extended Tcl on  Windows 95/NT systems.
6 *-----------------------------------------------------------------------------
7 * Copyright 1991-1999 Karl Lehenbauer and Mark Diekhans.
8 *
9 * Permission to use, copy, modify, and distribute this software and its
10 * documentation for any purpose and without fee is hereby granted, provided
11 * that the above copyright notice appear in all copies.  Karl Lehenbauer and
12 * Mark Diekhans make no representations about the suitability of this
13 * software for any purpose.  It is provided "as is" without express or
14 * implied warranty.
15 *-----------------------------------------------------------------------------
16 * $Id: tclXAppInit.c,v 1.1 2001/10/24 23:31:50 hobbs Exp $
17 *-----------------------------------------------------------------------------
18 */
19
20/*
21 * As a shell (i.e., the main program) we cannot be using the stubs table.
22 */
23#ifdef USE_TCL_STUBS
24#undef USE_TCL_STUBS
25#endif
26
27#include "tclExtend.h"
28
29/*-----------------------------------------------------------------------------
30 * TclX_AppInit --
31 *
32 * This procedure performs application-specific initialization.  Most
33 * applications, especially those that incorporate additional packages, will
34 * have their own version of this procedure.
35 *
36 * Results:
37 *   Returns a standard Tcl completion code, and leaves an error message in
38 *  interp result if an error occurs.
39 *-----------------------------------------------------------------------------
40 */
41int
42TclX_AppInit (Tcl_Interp *interp)
43{
44    if (Tcl_Init (interp) == TCL_ERROR) {
45        return TCL_ERROR;
46    }
47    if (Tclx_Init (interp) == TCL_ERROR) {
48        return TCL_ERROR;
49    }
50    Tcl_StaticPackage (interp, "Tclx", Tclx_Init, Tclx_SafeInit);
51
52    /*
53     * Call Tcl_CreateCommand for application-specific commands, if
54     * they weren't already created by the init procedures called above.
55     */
56
57    /*
58     * Specify a user-specific startup file to invoke if the application
59     * is run interactively.  Typically the startup file is "~/.apprc"
60     * where "app" is the name of the application.  If this line is deleted
61     * then no user-specific startup file will be run under any conditions.
62     */
63    Tcl_SetVar(interp, "tcl_rcFileName", "~/.tclrc", TCL_GLOBAL_ONLY);
64    return TCL_OK;
65}
66
67
68/*-----------------------------------------------------------------------------
69 * main --
70 *
71 * This is the main program for the application.
72 *-----------------------------------------------------------------------------
73 */
74int
75main (int    argc,
76      char **argv)
77{
78    TclX_MainEx (argc, argv, TclX_AppInit, Tcl_CreateInterp());
79
80    return 0;                   /* Needed only to prevent compiler warning. */
81}
82
83