Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
att
GitHub Repository: att/ast
Path: blob/master/src/lib/libtk/unix/tkAppInit.c
1811 views
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
* Copyright (c) 1994 Sun Microsystems, Inc.
9
*
10
* See the file "license.terms" for information on usage and redistribution
11
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
12
*
13
* SCCS: @(#) tkAppInit.c 1.21 96/03/26 16:47:07
14
*/
15
16
#include "tk.h"
17
18
/*
19
* The following variable is a special hack that is needed in order for
20
* Sun shared libraries to be used for Tcl.
21
*/
22
23
extern int matherr();
24
int *tclDummyMathPtr = (int *) matherr;
25
26
#ifdef TK_TEST
27
EXTERN int Tktest_Init _ANSI_ARGS_((Tcl_Interp *interp));
28
#endif /* TK_TEST */
29
30
/*
31
*----------------------------------------------------------------------
32
*
33
* main --
34
*
35
* This is the main program for the application.
36
*
37
* Results:
38
* None: Tk_Main never returns here, so this procedure never
39
* returns either.
40
*
41
* Side effects:
42
* Whatever the application does.
43
*
44
*----------------------------------------------------------------------
45
*/
46
47
int
48
main(argc, argv)
49
int argc; /* Number of command-line arguments. */
50
char **argv; /* Values of command-line arguments. */
51
{
52
Tk_Main(argc, argv, Tcl_AppInit);
53
return 0; /* Needed only to prevent compiler warning. */
54
}
55
56
/*
57
*----------------------------------------------------------------------
58
*
59
* Tcl_AppInit --
60
*
61
* This procedure performs application-specific initialization.
62
* Most applications, especially those that incorporate additional
63
* packages, will have their own version of this procedure.
64
*
65
* Results:
66
* Returns a standard Tcl completion code, and leaves an error
67
* message in interp->result if an error occurs.
68
*
69
* Side effects:
70
* Depends on the startup script.
71
*
72
*----------------------------------------------------------------------
73
*/
74
75
int
76
Tcl_AppInit(interp)
77
Tcl_Interp *interp; /* Interpreter for application. */
78
{
79
if (Tcl_Init(interp) == TCL_ERROR) {
80
return TCL_ERROR;
81
}
82
if (Tk_Init(interp) == TCL_ERROR) {
83
return TCL_ERROR;
84
}
85
Tcl_StaticPackage(interp, "Tk", Tk_Init, (Tcl_PackageInitProc *) NULL);
86
#ifdef TK_TEST
87
if (Tktest_Init(interp) == TCL_ERROR) {
88
return TCL_ERROR;
89
}
90
Tcl_StaticPackage(interp, "Tktest", Tktest_Init,
91
(Tcl_PackageInitProc *) NULL);
92
#endif /* TK_TEST */
93
94
95
/*
96
* Call the init procedures for included packages. Each call should
97
* look like this:
98
*
99
* if (Mod_Init(interp) == TCL_ERROR) {
100
* return TCL_ERROR;
101
* }
102
*
103
* where "Mod" is the name of the module.
104
*/
105
106
/*
107
* Call Tcl_CreateCommand for application-specific commands, if
108
* they weren't already created by the init procedures called above.
109
*/
110
111
/*
112
* Specify a user-specific startup file to invoke if the application
113
* is run interactively. Typically the startup file is "~/.apprc"
114
* where "app" is the name of the application. If this line is deleted
115
* then no user-specific startup file will be run under any conditions.
116
*/
117
118
Tcl_SetVar(interp, "tcl_rcFileName", "~/.wishrc", TCL_GLOBAL_ONLY);
119
return TCL_OK;
120
}
121
122