]> git.zerfleddert.de Git - micropolis/blob - src/tclx/src/main.c
Fixes for compilation with gcc 15
[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 TclX_RecordAndEval (
26 Tcl_Interp *interp, /* Token for interpreter in which command
27 * will be executed. */
28 char *cmd, /* Command to record. */
29 int flags, /* Additional flags to pass to Tcl_Eval.
30 * TCL_NO_EVAL means only record: don't
31 * execute command. */
32 char **dummy
33 )
34 {
35 return Tcl_RecordAndEval(interp, cmd, flags);
36 }
37
38 int
39 main (int argc, CONST char **argv)
40 {
41 Tcl_Interp *interp;
42
43 /*
44 * If history is to be used, then set the eval procedure pointer that
45 * Tcl_CommandLoop so that history will be recorded. This reference
46 * also brings in history from libtcl.a.
47 */
48 #ifndef TCL_NOHISTORY
49 tclShellCmdEvalProc = TclX_RecordAndEval;
50 #endif
51
52 /*
53 * Create a Tcl interpreter for the session, with all extended commands
54 * initialized. This can be replaced with Tcl_CreateInterp followed
55 * by a subset of the extended command initializaton procedures if
56 * desired.
57 */
58 interp = Tcl_CreateExtendedInterp();
59
60 /*
61 * >>>>>> INITIALIZE APPLICATION SPECIFIC COMMANDS HERE <<<<<<
62 */
63
64 /*
65 * Load the tcl startup code, this should pull in all of the tcl
66 * procs, paths, command line processing, autoloads, packages, etc.
67 * If Tcl was invoked interactively, Tcl_Startup will give it
68 * a command loop.
69 */
70
71 Tcl_Startup (interp, argc, argv, NULL, 0);
72
73 /*
74 * Delete the interpreter (not neccessary under Unix, but we do
75 * it if TCL_MEM_DEBUG is set to better enable us to catch memory
76 * corruption problems)
77 */
78
79 #ifdef TCL_MEM_DEBUG
80 Tcl_DeleteInterp(interp);
81 #endif
82
83 #ifdef TCL_SHELL_MEM_LEAK
84 printf (" >>> Dumping active memory list to mem.lst <<<\n");
85 if (Tcl_DumpActiveMemory ("mem.lst") != TCL_OK)
86 panic ("error accessing `mem.lst': %s", strerror (errno));
87 #endif
88
89 _exit(0);
90 }
91
Impressum, Datenschutz