head	1.12;
access;
symbols
	core-8-5-9:1.8
	core-8-5-8:1.8
	macosx-cocoa-merge:1.9
	macosx-cocoa-premerge:1.9
	macosx-carbon-freeze:1.9
	core-8-5-7:1.8
	core-8-5-6:1.8
	core-8-6-b1:1.9
	core-8-6-a3:1.9
	core-8-5-5:1.8
	core-8-6-a2:1.9
	core-8-5-4:1.8
	core-8-5-3:1.8
	core-8-6-a1:1.9
	core-8-4-19:1.7
	core-8-5-branch:1.8.0.4
	core-8-5-2:1.8
	core-8-4-18:1.7
	core-8-5-1:1.8
	core-8-4-17:1.7
	core-8-5-0:1.8
	core-8-5-b3:1.8
	core-8-5-b2:1.8
	core-8-4-16:1.7
	core-8-5-b1:1.8
	core-stablilizer-merge:1.8
	core-stabilizer-branch:1.8.0.2
	core-stabilizer-merge:1.8
	core-8-4-15:1.7
	core-8-5-a6:1.8
	core-8-5-a5:1.7
	core-8-4-14:1.7
	core-8-5-a4:1.7
	core-8-4-13:1.7
	core-8-4-12:1.7
	core-8-4-11:1.7
	core-8-5-a3:1.7
	core-8-4-10:1.7
	core-8-4-9-branch:1.7.0.6
	core-8-5-a2:1.7
	core-8-4-9:1.7
	core-8-4-8:1.7
	core-8-4-7:1.7
	core-8-5-a1:1.7
	core-8-4-6:1.7
	core-8-4-5:1.7
	mistachkin-dev-branch:1.7.0.4
	core-8-4-4:1.7
	core-8-4-3:1.7
	core-8-4-branch:1.7.0.2
	core-8-4-2:1.7
	core-8-4-1:1.7
	core-8-3-5:1.5.2.1
	core-8-4-0:1.7
	macosx-8-4-merge-2002-08-31-trunk:1.7
	macosx-8-4-premerge-2002-08-31-branch:1.5.8.1
	macosx-8-4-premerge-2002-08-31-trunk:1.7
	macosx-8-4-merge-2002-08-30-branch:1.5.8.1
	macosx-8-4-merge-2002-08-30-trunk:1.7
	macosx-8-4-merge-2002-08-20-branch:1.5.8.1
	macosx-8-4-merge-2002-08-20-trunk:1.7
	core-8-4-b2:1.7
	core-8-4-b1:1.7
	macosx-premerge-6-9-02:1.5
	core-8-4-a4:1.5
	core-8-3-4:1.5
	macosx-8-4-branch:1.5.0.8
	macosx-8-4-branchpoint:1.5
	core-8-4-a3:1.5
	core-8-3-3:1.5
	dgp-privates-into-namespace:1.5.0.6
	tclpro-1-5-0:1.5
	core-8-4-win-speedup:1.5.0.4
	core-8-4-a2:1.5
	tclpro-1-4-1:1.5
	tclpro-1-4-0:1.5
	core-8-3-2:1.5
	ajuba-ajuba2-2-1-base:1.5
	ajuba-ajuba2-2-0:1.5
	core-8-4-a1:1.5
	core-8-3-1-branch:1.5.0.2
	core-8-3-1:1.5
	scriptics-sc-2-0-b5:1.5
	scriptics-sc-2-0-fixed:1.5
	scriptics-sc-2-0-b2:1.5
	scriptics-sc-2-0-b1:1.5
	core-8-3-0:1.5
	core-8-3-b2:1.5
	core-8-3-b1:1.5
	scriptics-sc-1-1:1.4
	scriptics-sc-1-1-b1:1.4
	core-8-2-3:1.4
	scriptics-sc-1-1-branch:1.4.0.10
	scriptics-sc-1-1-base:1.4
	scriptics-sc-1-0:1.4
	scriptics-sc-1-0-branch:1.4.0.8
	scriptics-sc-1-0-base:1.4
	core-8-2-2:1.4
	core-8-2-1:1.4
	scriptics-bc-1-0-b1:1.4
	core-8-2-1-branch:1.4.0.6
	scriptics-tclpro-1-3-0:1.4
	core-8-2-0:1.4
	core-8-2-b3-branch:1.4.0.4
	core-8-2-b3-base:1.4
	scriptics-tclpro-1-3-b4:1.4
	core-8-2-b2:1.4
	scriptics-tclpro-1-3-b3:1.4
	core-8-2-b1:1.4
	scriptics-tclpro-1-3-b2:1.4
	merge-to-mainline-5/21/99:1.4
	scriptics-tclpro-1-3-b2-branch:1.4.0.2
	core-8-1-1:1.4
	scriptics-tclpro-1-3-b1:1.4
	core-8-1-1-base:1.4
	core-8-1-0:1.4
	merge-to-mainline-4-29-99:1.4
	merge-to-mainline-4-23-99:1.4
	core-8-1-branch-old:1.1.0.4
	core-8-0-6-branch:1.3.0.6
	core-8-0-6-base:1.3
	core-8-0-5:1.3
	core-8-1-b3:1.1.4.3
	core-8-1-b2:1.1.4.3
	dev-8-1-stubs-branch:1.1.4.3.0.2
	dev-stubs-branch:1.3.0.4
	scriptics-tclpro-1-2:1.3
	scriptics-tclpro-1-2-b2:1.3
	core-8-1-merge-2/10/99:1.3
	core-8-0-5-branch:1.3.0.2
	core-8-0-5-base:1.3
	scriptics-tclpro-1-2-b1:1.2
	scriptics-tclpro-1-2-a1:1.2
	core-8-1-b1:1.1.4.2
	core-8-0-4:1.2
	core-8-1-a2:1.1.4.1
	core-8-0-2:1.1
	core-8-0-3:1.2;
locks; strict;
comment	@ * @;


1.12
date	2010.09.23.21.45.14;	author nijtmans;	state Exp;
branches;
next	1.11;

1.11
date	2010.09.23.10.01.57;	author nijtmans;	state Exp;
branches;
next	1.10;

1.10
date	2009.10.21.20.28.54;	author nijtmans;	state Exp;
branches;
next	1.9;

1.9
date	2008.04.27.22.39.12;	author dkf;	state Exp;
branches;
next	1.8;

1.8
date	2007.02.22.13.56.33;	author dkf;	state Exp;
branches;
next	1.7;

1.7
date	2002.06.21.20.24.29;	author dgp;	state Exp;
branches;
next	1.6;

1.6
date	2002.06.14.22.01.37;	author andreas_kupries;	state Exp;
branches;
next	1.5;

1.5
date	99.12.02.02.05.39;	author redman;	state Exp;
branches
	1.5.2.1
	1.5.8.1;
next	1.4;

1.4
date	99.04.16.01.51.45;	author stanton;	state Exp;
branches;
next	1.3;

1.3
date	99.02.04.20.57.18;	author stanton;	state Exp;
branches;
next	1.2;

1.2
date	98.09.14.18.23.54;	author stanton;	state Exp;
branches;
next	1.1;

1.1
date	98.04.01.09.59.33;	author rjohnson;	state Exp;
branches
	1.1.4.1;
next	;

1.1.4.1
date	98.09.29.00.25.59;	author stanton;	state Exp;
branches;
next	1.1.4.2;

1.1.4.2
date	98.09.30.02.19.12;	author stanton;	state Exp;
branches;
next	1.1.4.3;

1.1.4.3
date	99.02.11.04.13.50;	author stanton;	state Exp;
branches;
next	;

1.5.2.1
date	2002.06.21.20.27.23;	author dgp;	state Exp;
branches;
next	;

1.5.8.1
date	2002.08.20.20.27.18;	author das;	state Exp;
branches;
next	;


desc
@@


1.12
log
@Make Tcl_SetPanicProc and Tcl_GetStringResult  callable without stubs, just as Tcl_SetVar.
@
text
@/*
 * tkAppInit.c --
 *
 *	Provides a default version of the main program and Tcl_AppInit
 *	procedure for wish and other Tk-based applications.
 *
 * Copyright (c) 1993 The Regents of the University of California.
 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
 * Copyright (c) 1998-1999 Scriptics Corporation.
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @@(#) $Id: tkAppInit.c,v 1.11 2010/09/23 10:01:57 nijtmans Exp $
 */

#include "tk.h"

#ifdef TK_TEST
extern Tcl_PackageInitProc Tktest_Init;
#endif /* TK_TEST */

/*
 * The following #if block allows you to change the AppInit function by using
 * a #define of TCL_LOCAL_APPINIT instead of rewriting this entire file. The
 * #if checks for that #define and uses Tcl_AppInit if it doesn't exist.
 */

#ifndef TK_LOCAL_APPINIT
#define TK_LOCAL_APPINIT Tcl_AppInit
#endif
extern int TK_LOCAL_APPINIT(Tcl_Interp *interp);

/*
 * The following #if block allows you to change how Tcl finds the startup
 * script, prime the library or encoding paths, fiddle with the argv, etc.,
 * without needing to rewrite Tk_Main()
 */

#ifdef TK_LOCAL_MAIN_HOOK
extern int TK_LOCAL_MAIN_HOOK(int *argc, char ***argv);
#endif

/*
 *----------------------------------------------------------------------
 *
 * main --
 *
 *	This is the main program for the application.
 *
 * Results:
 *	None: Tk_Main never returns here, so this procedure never returns
 *	either.
 *
 * Side effects:
 *	Just about anything, since from here we call arbitrary Tcl code.
 *
 *----------------------------------------------------------------------
 */

int
main(
    int argc,			/* Number of command-line arguments. */
    char **argv)		/* Values of command-line arguments. */
{
#ifdef TK_LOCAL_MAIN_HOOK
    TK_LOCAL_MAIN_HOOK(&argc, &argv);
#endif

    Tk_Main(argc, argv, TK_LOCAL_APPINIT);
    return 0;			/* Needed only to prevent compiler warning. */
}

/*
 *----------------------------------------------------------------------
 *
 * Tcl_AppInit --
 *
 *	This procedure performs application-specific initialization. Most
 *	applications, especially those that incorporate additional packages,
 *	will have their own version of this procedure.
 *
 * Results:
 *	Returns a standard Tcl completion code, and leaves an error message in
 *	the interp's result if an error occurs.
 *
 * Side effects:
 *	Depends on the startup script.
 *
 *----------------------------------------------------------------------
 */

int
Tcl_AppInit(
    Tcl_Interp *interp)		/* Interpreter for application. */
{
    if ((Tcl_Init)(interp) == TCL_ERROR) {
	return TCL_ERROR;
    }

    if (Tk_Init(interp) == TCL_ERROR) {
	return TCL_ERROR;
    }
    Tcl_StaticPackage(interp, "Tk", Tk_Init, Tk_SafeInit);

#ifdef TK_TEST
    if (Tktest_Init(interp) == TCL_ERROR) {
	return TCL_ERROR;
    }
    Tcl_StaticPackage(interp, "Tktest", Tktest_Init, 0);
#endif /* TK_TEST */

    /*
     * Call the init procedures for included packages. Each call should look
     * like this:
     *
     * if (Mod_Init(interp) == TCL_ERROR) {
     *     return TCL_ERROR;
     * }
     *
     * where "Mod" is the name of the module. (Dynamically-loadable packages
     * should have the same entry-point name.)
     */

    /*
     * Call Tcl_CreateCommand for application-specific commands, if they
     * weren't already created by the init procedures called above.
     */

    /*
     * Specify a user-specific startup file to invoke if the application is
     * run interactively. Typically the startup file is "~/.apprc" where "app"
     * is the name of the application. If this line is deleted then no user-
     * specific startup file will be run under any conditions.
     */

    (Tcl_SetVar)(interp, "tcl_rcFileName", "~/.wishrc", TCL_GLOBAL_ONLY);
    return TCL_OK;
}

/*
 * Local Variables:
 * mode: c
 * c-basic-offset: 4
 * fill-column: 78
 * End:
 */
@


1.11
log
@Add -Wdeclaration-after-statement
tkWinX.c,winMain.c: Make compilable with -DUNICODE
tkAppInit.c,winMain.c: Many clean-ups in comments, so all (tcl|tk)AppInit.c variants use the same style.
@
text
@d14 1
a14 1
 * RCS: @@(#) $Id: tkAppInit.c,v 1.10 2009/10/21 20:28:54 nijtmans Exp $
d97 1
a97 1
    if (Tcl_Init(interp) == TCL_ERROR) {
@


1.10
log
@Bug fix for #2875562
@
text
@d4 2
a5 2
 *	Provides a default version of the Tcl_AppInit procedure for use in
 *	wish and similar Tk-based applications.
d9 1
d14 1
a14 1
 * RCS: @@(#) $Id: tkAppInit.c,v 1.9 2008/04/27 22:39:12 dkf Exp $
a16 3
/* Make sure this file is never compiled with Stubs! */
#undef USE_TCL_STUBS
#undef USE_TK_STUBS
a17 1
#include "locale.h"
d20 1
a20 1
extern int		Tktest_Init(Tcl_Interp *interp);
d22 21
d56 1
a56 1
 *	Whatever the application does.
a65 18
    /*
     * The following #if block allows you to change the AppInit function by
     * using a #define of TCL_LOCAL_APPINIT instead of rewriting this entire
     * file. The #if checks for that #define and uses Tcl_AppInit if it
     * doesn't exist.
     */

#ifndef TK_LOCAL_APPINIT
#define TK_LOCAL_APPINIT Tcl_AppInit
#endif
    extern int TK_LOCAL_APPINIT(Tcl_Interp *interp);

    /*
     * The following #if block allows you to change how Tcl finds the startup
     * script, prime the library or encoding paths, fiddle with the argv,
     * etc., without needing to rewrite Tk_Main()
     */

a66 1
    extern int TK_LOCAL_MAIN_HOOK(int *argc, char ***argv);
d100 1
d105 1
d110 1
a110 2
    Tcl_StaticPackage(interp, "Tktest", Tktest_Init,
            (Tcl_PackageInitProc *) NULL);
d121 2
a122 1
     * where "Mod" is the name of the module.
d134 1
a134 1
     * -specific startup file will be run under any conditions.
d137 1
a137 1
    Tcl_SetVar(interp, "tcl_rcFileName", "~/.wishrc", TCL_GLOBAL_ONLY);
@


1.9
log
@Get rid of pre-C89-isms (esp. CONST vs const).
@
text
@d13 1
a13 1
 * RCS: @@(#) $Id: tkAppInit.c,v 1.8 2007/02/22 13:56:33 dkf Exp $
d16 3
@


1.8
log
@Less of that K&R or wrongly indented function header style!
@
text
@d13 1
a13 1
 * RCS: @@(#) $Id: tkAppInit.c,v 1.7 2002/06/21 20:24:29 dgp Exp $
d20 1
a20 1
extern int		Tktest_Init _ANSI_ARGS_((Tcl_Interp *interp));
d55 1
a55 1
    extern int TK_LOCAL_APPINIT _ANSI_ARGS_((Tcl_Interp *interp));
d64 1
a64 1
    extern int TK_LOCAL_MAIN_HOOK _ANSI_ARGS_((int *argc, char ***argv));
@


1.7
log
@	* Removed unnecessary dependence of tktest executable on the tcltest
	executable on Unix.  If there are similar dependencies on other
	platforms, they can probably be removed as well.  [Bug 572134].
@
text
@d1 1
a1 1
/* 
d4 2
a5 2
 *	Provides a default version of the Tcl_AppInit procedure for
 *	use in wish and similar Tk-based applications.
d10 2
a11 2
 * See the file "license.terms" for information on usage and redistribution
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
d13 1
a13 1
 * RCS: @@(#) $Id: tkAppInit.c,v 1.6 2002/06/14 22:01:37 andreas_kupries Exp $
d31 2
a32 2
 *	None: Tk_Main never returns here, so this procedure never
 *	returns either.
d41 3
a43 3
main(argc, argv)
    int argc;			/* Number of command-line arguments. */
    char **argv;		/* Values of command-line arguments. */
d46 4
a49 4
     * The following #if block allows you to change the AppInit
     * function by using a #define of TCL_LOCAL_APPINIT instead
     * of rewriting this entire file.  The #if checks for that
     * #define and uses Tcl_AppInit if it doesn't exist.
d51 1
a51 1
    
d53 1
a53 1
#define TK_LOCAL_APPINIT Tcl_AppInit    
d56 1
a56 1
    
d62 1
a62 1
    
d77 3
a79 3
 *	This procedure performs application-specific initialization.
 *	Most applications, especially those that incorporate additional
 *	packages, will have their own version of this procedure.
d82 2
a83 2
 *	Returns a standard Tcl completion code, and leaves an error
 *	message in the interp's result if an error occurs.
d92 2
a93 2
Tcl_AppInit(interp)
    Tcl_Interp *interp;		/* Interpreter for application. */
a109 1

d111 2
a112 2
     * Call the init procedures for included packages.  Each call should
     * look like this:
d122 2
a123 2
     * Call Tcl_CreateCommand for application-specific commands, if
     * they weren't already created by the init procedures called above.
d127 4
a130 4
     * Specify a user-specific startup file to invoke if the application
     * is run interactively.  Typically the startup file is "~/.apprc"
     * where "app" is the name of the application.  If this line is deleted
     * then no user-specific startup file will be run under any conditions.
d136 8
@


1.6
log
@
	* unix/tkAppInit.c: Removed now unneeded and erroneous reference
	  to 'matherr'. See Tcl ChangeLog entry 2002-05-31 Don Porter.
@
text
@d13 1
a13 1
 * RCS: @@(#) $Id: tkAppInit.c,v 1.5 1999/12/02 02:05:39 redman Exp $
a19 1
extern int		Tcltest_Init _ANSI_ARGS_((Tcl_Interp *interp));
a102 5
    if (Tcltest_Init(interp) == TCL_ERROR) {
	return TCL_ERROR;
    }
    Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init,
            (Tcl_PackageInitProc *) NULL);
@


1.5
log
@
	* generic/tkMain.c :
	* unix/tkAppInit.c:
	* win/winMain.c: Added added hooks into the main() code for
	supporting TclPro and other "big" shells more easily without
	requiring a copy of the main() code.
@
text
@d13 1
a13 1
 * RCS: @@(#) $Id: tkAppInit.c,v 1.4 1999/04/16 01:51:45 stanton Exp $
a17 8

/*
 * The following variable is a special hack that is needed in order for
 * Sun shared libraries to be used for Tcl.
 */

extern int matherr();
int *tclDummyMathPtr = (int *) matherr;
@


1.5.8.1
log
@merged with trunk at tag macosx-8-4-merge-2002-08-20-trunk
@
text
@d13 1
a13 1
 * RCS: @@(#) $Id$
d19 8
d28 1
d112 5
@


1.5.2.1
log
@	* Removed unnecessary dependence of tktest executable on the tcltest
	executable on Unix.  If there are similar dependencies on other
	platforms, they can probably be removed as well.  [Bug 572134].
@
text
@d13 1
a13 1
 * RCS: @@(#) $Id: tkAppInit.c,v 1.5 1999/12/02 02:05:39 redman Exp $
d28 1
d112 5
@


1.4
log
@* Merged 8.1 branch into the main trunk
@
text
@d13 1
a13 1
 * RCS: @@(#) $Id$
d54 24
a77 1
    Tk_Main(argc, argv, Tcl_AppInit);
@


1.3
log
@* mac/tkMacAppInit.c:
* generic/tkTest.c:
* generic/tkAppInit.c:
* win/winMain.c: Changed some EXTERN declarations to extern
since they are not defining exported interfaces.  This avoids
generating useless declspec() attributes and makes the windows
makefile simpler.
@
text
@d8 1
a8 1
 * Copyright (c) 1994 Sun Microsystems, Inc.
d13 1
a13 1
 * RCS: @@(#) $Id: tkAppInit.c,v 1.2 1998/09/14 18:23:54 stanton Exp $
d17 1
d28 1
d69 1
a69 1
 *	message in interp->result if an error occurs.
d89 5
@


1.2
log
@Replaced SCCS strings, fixed binary files
@
text
@d13 1
a13 1
 * RCS: @@(#) $Id$
d27 1
a27 1
EXTERN int		Tktest_Init _ANSI_ARGS_((Tcl_Interp *interp));
@


1.1
log
@Initial revision
@
text
@d13 1
a13 1
 * SCCS: @@(#) tkAppInit.c 1.22 96/05/29 09:47:08
@


1.1.4.1
log
@initial tk8.1a2 version
@
text
@d8 1
a8 1
 * Copyright (c) 1994-1997 Sun Microsystems, Inc.
d13 1
a13 1
 * SCCS: @@(#) tkAppInit.c 1.24 98/01/13 17:21:40
a16 1
#include "locale.h"
a26 1
EXTERN int		Tcltest_Init _ANSI_ARGS_((Tcl_Interp *interp));
d67 1
a67 1
 *	message in the interp's result if an error occurs.
a86 5
    if (Tcltest_Init(interp) == TCL_ERROR) {
	return TCL_ERROR;
    }
    Tcl_StaticPackage(interp, "Tcltest", Tcltest_Init,
            (Tcl_PackageInitProc *) NULL);
@


1.1.4.2
log
@Merged 8.0.3 changes into 8.1
@
text
@d13 1
a13 1
 * RCS: @@(#) $Id: tkAppInit.c,v 1.2 1998/09/14 18:23:54 stanton Exp $
@


1.1.4.3
log
@* Various cleanup related to the Tcl_Eval and Tcl_ObjSetVar
changes in Tcl.

* Integrated patches from 8.0.5b2
@
text
@d13 1
a13 1
 * RCS: @@(#) $Id: tkAppInit.c,v 1.1.4.2 1998/09/30 02:19:12 stanton Exp $
d28 2
a29 2
extern int		Tcltest_Init _ANSI_ARGS_((Tcl_Interp *interp));
extern int		Tktest_Init _ANSI_ARGS_((Tcl_Interp *interp));
@


