home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / Other Langs / Tickle-4.0 (tcl) / tcl / extend / src.unused / tclXmain.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-26  |  2.1 KB  |  69 lines  |  [TEXT/MPS ]

  1. /* 
  2.  * tclXmain.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 1991-1993 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: tclXmain.c,v 2.6 1993/08/31 23:03:20 markd Exp $
  17.  *-----------------------------------------------------------------------------
  18.  */
  19.  
  20. #include "tclExtend.h"
  21.  
  22. int
  23. main(argc, argv)
  24.     int     argc;
  25.     char  **argv;
  26. {
  27.     Tcl_Interp *interp;
  28.  
  29.     /* 
  30.      * Create a Tcl interpreter for the session, with all extended commands
  31.      * initialized.  This can be replaced with Tcl_CreateInterp followed
  32.      * by a subset of the extended command initializaton procedures if 
  33.      * desired.
  34.      */
  35.     interp = Tcl_CreateExtendedInterp();
  36.  
  37.     /*
  38.      *   >>>>>> INITIALIZE APPLICATION SPECIFIC COMMANDS HERE <<<<<<
  39.      */
  40.  
  41.     /*
  42.      * Load the tcl startup code, this should pull in all of the tcl
  43.      * procs, paths, command line processing, autoloads, packages, etc.
  44.      * If Tcl was invoked interactively, Tcl_Startup will give it
  45.      * a command loop.
  46.      */
  47.  
  48.     Tcl_Startup (interp, 0, argc, argv);
  49.  
  50.     /* 
  51.      * Delete the interpreter (not neccessary under Unix, but we do
  52.      * it if TCL_MEM_DEBUG is set to better enable us to catch memory
  53.      * corruption problems)
  54.      */
  55.  
  56. #ifdef TCL_MEM_DEBUG
  57.     Tcl_DeleteInterp(interp);
  58. #endif
  59.  
  60. #ifdef TCL_SHELL_MEM_LEAK
  61.     printf (" >>> Dumping active memory list to mem.lst <<<\n");
  62.     if (Tcl_DumpActiveMemory ("mem.lst") != TCL_OK)
  63.         panic ("error accessing `mem.lst': %s", strerror (errno));
  64. #endif
  65.  
  66.     exit(0);
  67. }
  68.  
  69.