]> git.zerfleddert.de Git - micropolis/blob - src/tclx/src/mainplus.cc
Import Micropolis from http://www.donhopkins.com/home/micropolis/
[micropolis] / src / tclx / src / mainplus.cc
1 /*
2 * main++.C --
3 *
4 * C++ based main. It is an alternative to the existing main.c to set up
5 * the Tcl shell and may be used as a example on how to use tcl++.h
6 *
7 *---------------------------------------------------------------------------
8 * Copyright 1992 Karl Lehenbauer and Mark Diekhans.
9 *
10 * Permission to use, copy, modify, and distribute this software and its
11 * documentation for any purpose and without fee is hereby granted, provided
12 * that the above copyright notice appear in all copies. Karl Lehenbauer,
13 * Mark Diekhans, and Peter da Silva make no representations about the
14 * suitability of this software for any purpose. It is provided "as is"
15 * without express or implied warranty.
16 *---------------------------------------------------------------------------
17 * Based on Tcl C++ classes developed by Parag Patel.
18 *-----------------------------------------------------------------------------
19 * $Id: main++.C,v 2.0 1992/10/16 04:51:31 markd Rel $
20 *-----------------------------------------------------------------------------
21 */
22 #include <stdlib.h>
23
24 #include "tcl++.h"
25 /*
26 * This file is optional.
27 */
28 #include "patchlevel.h"
29
30 int
31 main (int argc,
32 char **argv)
33 {
34 TclInterp_cl *interpPtr;
35
36 /*
37 * If history is to be used, then set the eval procedure pointer that
38 * Tcl_CommandLoop so that history will be recorded. This reference
39 * also brings in history from Tcl.a.
40 */
41 #ifndef TCL_NOHISTORY
42 tclShellCmdEvalProc = (int (*)())Tcl_RecordAndEval;
43 #endif
44
45 /*
46 * Create a Tcl interpreter for the session, with all extended commands
47 * initialized. This can be replaced with Tcl_CreateInterp followed
48 * by a subset of the extended command initializaton procedures if
49 * desired.
50 */
51 interpPtr = new TclInterp_cl;
52
53 /*
54 * >>>>>> INITIALIZE APPLICATION SPECIFIC COMMANDS HERE <<<<<<
55 */
56
57 /*
58 * Load the tcl startup code, this should pull in all of the tcl
59 * procs, paths, command line processing, autoloads, packages, etc.
60 * If Tcl was invoked interactively, Tcl_Startup will give it
61 * a command loop.
62 */
63
64 interpPtr->Startup (argc, argv, NULL, 0);
65
66 /*
67 * Delete the interpreter (not neccessary under Unix, but we do
68 * it if TCL_MEM_DEBUG is set to better enable us to catch memory
69 * corruption problems)
70 */
71
72 #ifdef TCL_MEM_DEBUG
73 delete interpPtr;
74 #endif
75
76 #ifdef TCL_SHELL_MEM_LEAK
77 printf (" >>> Dumping active memory list to mem.lst <<<\n");
78 if (Tcl_DumpActiveMemory ("mem.lst") != TCL_OK)
79 panic ("error accessing `mem.lst': %s", strerror (errno));
80 #endif
81
82 exit(0);
83 }
84
Impressum, Datenschutz