]>
git.zerfleddert.de Git - micropolis/blob - src/tclx/src/main.c
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.
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
15 *-----------------------------------------------------------------------------
16 * $Id: main.c,v 2.1 1992/11/10 03:54:12 markd Exp $
17 *-----------------------------------------------------------------------------
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
35 return Tcl_RecordAndEval(interp
, cmd
, flags
);
39 main (int argc
, CONST
char **argv
)
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.
49 tclShellCmdEvalProc
= TclX_RecordAndEval
;
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
58 interp
= Tcl_CreateExtendedInterp();
61 * >>>>>> INITIALIZE APPLICATION SPECIFIC COMMANDS HERE <<<<<<
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
71 Tcl_Startup (interp
, argc
, argv
, NULL
, 0);
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)
80 Tcl_DeleteInterp(interp
);
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
));