/*1* tkAppInit.c --2*3* Provides a default version of the Tcl_AppInit procedure for4* use in wish and similar Tk-based applications.5*6* Copyright (c) 1993 The Regents of the University of California.7* Copyright (c) 1994 Sun Microsystems, Inc.8*9* See the file "license.terms" for information on usage and redistribution10* of this file, and for a DISCLAIMER OF ALL WARRANTIES.11*12* SCCS: @(#) tkAppInit.c 1.21 96/03/26 16:47:0713*/1415#include "tk.h"1617/*18* The following variable is a special hack that is needed in order for19* Sun shared libraries to be used for Tcl.20*/2122extern int matherr();23int *tclDummyMathPtr = (int *) matherr;2425#ifdef TK_TEST26EXTERN int Tktest_Init _ANSI_ARGS_((Tcl_Interp *interp));27#endif /* TK_TEST */2829/*30*----------------------------------------------------------------------31*32* main --33*34* This is the main program for the application.35*36* Results:37* None: Tk_Main never returns here, so this procedure never38* returns either.39*40* Side effects:41* Whatever the application does.42*43*----------------------------------------------------------------------44*/4546int47main(argc, argv)48int argc; /* Number of command-line arguments. */49char **argv; /* Values of command-line arguments. */50{51Tk_Main(argc, argv, Tcl_AppInit);52return 0; /* Needed only to prevent compiler warning. */53}5455/*56*----------------------------------------------------------------------57*58* Tcl_AppInit --59*60* This procedure performs application-specific initialization.61* Most applications, especially those that incorporate additional62* packages, will have their own version of this procedure.63*64* Results:65* Returns a standard Tcl completion code, and leaves an error66* message in interp->result if an error occurs.67*68* Side effects:69* Depends on the startup script.70*71*----------------------------------------------------------------------72*/7374int75Tcl_AppInit(interp)76Tcl_Interp *interp; /* Interpreter for application. */77{78if (Tcl_Init(interp) == TCL_ERROR) {79return TCL_ERROR;80}81if (Tk_Init(interp) == TCL_ERROR) {82return TCL_ERROR;83}84Tcl_StaticPackage(interp, "Tk", Tk_Init, (Tcl_PackageInitProc *) NULL);85#ifdef TK_TEST86if (Tktest_Init(interp) == TCL_ERROR) {87return TCL_ERROR;88}89Tcl_StaticPackage(interp, "Tktest", Tktest_Init,90(Tcl_PackageInitProc *) NULL);91#endif /* TK_TEST */929394/*95* Call the init procedures for included packages. Each call should96* look like this:97*98* if (Mod_Init(interp) == TCL_ERROR) {99* return TCL_ERROR;100* }101*102* where "Mod" is the name of the module.103*/104105/*106* Call Tcl_CreateCommand for application-specific commands, if107* they weren't already created by the init procedures called above.108*/109110/*111* Specify a user-specific startup file to invoke if the application112* is run interactively. Typically the startup file is "~/.apprc"113* where "app" is the name of the application. If this line is deleted114* then no user-specific startup file will be run under any conditions.115*/116117Tcl_SetVar(interp, "tcl_rcFileName", "~/.wishrc", TCL_GLOBAL_ONLY);118return TCL_OK;119}120121122