Updated version to 0.2.1.
[tclrobot.git] / tclmain.c
1 /* 
2  * $Id: tclmain.c,v 1.2 1998/10/15 12:31:04 adam Exp $
3  */
4
5 #include "tclrobot.h"
6
7 /*
8  * The following variable is a special hack that is needed in order for
9  * Sun shared libraries to be used for Tcl.
10  */
11
12 extern int matherr();
13 int *tclDummyMathPtr = (int *) matherr;
14
15 int main(int argc, char **argv)
16 {
17     Tcl_Main(argc, argv, Tcl_AppInit);
18     return 0;                   /* Needed only to prevent compiler warning. */
19 }
20
21 int Tcl_AppInit(Tcl_Interp *interp)
22 {
23     if (Tcl_Init(interp) == TCL_ERROR) {
24         return TCL_ERROR;
25     }
26
27     if (Tclrobot_Init(interp) == TCL_ERROR) {
28         return TCL_ERROR;
29     }
30     Tcl_StaticPackage(interp, "TclRobot", Tclrobot_Init,
31             (Tcl_PackageInitProc *) NULL);
32
33     /*
34      * Call the init procedures for included packages.  Each call should
35      * look like this:
36      *
37      * if (Mod_Init(interp) == TCL_ERROR) {
38      *     return TCL_ERROR;
39      * }
40      *
41      * where "Mod" is the name of the module.
42      */
43
44     /*
45      * Call Tcl_CreateCommand for application-specific commands, if
46      * they weren't already created by the init procedures called above.
47      */
48
49     /*
50      * Specify a user-specific startup file to invoke if the application
51      * is run interactively.  Typically the startup file is "~/.apprc"
52      * where "app" is the name of the application.  If this line is deleted
53      * then no user-specific startup file will be run under any conditions.
54      */
55
56     Tcl_SetVar(interp, "tcl_rcFileName", "~/.tclshrc", TCL_GLOBAL_ONLY);
57     return TCL_OK;
58 }