]> git.zerfleddert.de Git - micropolis/blob - src/tclx/src/main.c
Import Micropolis from http://www.donhopkins.com/home/micropolis/
[micropolis] / src / tclx / src / main.c
1 /*
2 * main.c --
3 *
4 * Main to run the Tcl shell. This file is a useful template for custom
5 * applications that wish to have Tcl as the top level command language.
6 *-----------------------------------------------------------------------------
7 * Copyright 1992 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: main.c,v 2.1 1992/11/10 03:54:12 markd Exp $
17 *-----------------------------------------------------------------------------
18 */
19
20 #include <unistd.h>
21
22 #include "tclxtend.h"
23
24 int
25 main(argc, argv)
26 int argc;
27 CONST char **argv;
28 {
29 Tcl_Interp *interp;
30
31 /*
32 * If history is to be used, then set the eval procedure pointer that
33 * Tcl_CommandLoop so that history will be recorded. This reference
34 * also brings in history from libtcl.a.
35 */
36 #ifndef TCL_NOHISTORY
37 tclShellCmdEvalProc = Tcl_RecordAndEval;
38 #endif
39
40 /*
41 * Create a Tcl interpreter for the session, with all extended commands
42 * initialized. This can be replaced with Tcl_CreateInterp followed
43 * by a subset of the extended command initializaton procedures if
44 * desired.
45 */
46 interp = Tcl_CreateExtendedInterp();
47
48 /*
49 * >>>>>> INITIALIZE APPLICATION SPECIFIC COMMANDS HERE <<<<<<
50 */
51
52 /*
53 * Load the tcl startup code, this should pull in all of the tcl
54 * procs, paths, command line processing, autoloads, packages, etc.
55 * If Tcl was invoked interactively, Tcl_Startup will give it
56 * a command loop.
57 */
58
59 Tcl_Startup (interp, argc, argv, NULL, 0);
60
61 /*
62 * Delete the interpreter (not neccessary under Unix, but we do
63 * it if TCL_MEM_DEBUG is set to better enable us to catch memory
64 * corruption problems)
65 */
66
67 #ifdef TCL_MEM_DEBUG
68 Tcl_DeleteInterp(interp);
69 #endif
70
71 #ifdef TCL_SHELL_MEM_LEAK
72 printf (" >>> Dumping active memory list to mem.lst <<<\n");
73 if (Tcl_DumpActiveMemory ("mem.lst") != TCL_OK)
74 panic ("error accessing `mem.lst': %s", strerror (errno));
75 #endif
76
77 _exit(0);
78 }
79
Impressum, Datenschutz