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.3 KB  |  76 lines  |  [TEXT/MPS ]

  1. /*
  2.  * tclXmain++.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-1993 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: tclXmain++.C,v 2.4 1993/08/31 23:03:20 markd Exp $
  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.      * Create a Tcl interpreter for the session, with all extended commands
  38.      * initialized.  This can be replaced with Tcl_CreateInterp followed
  39.      * by a subset of the extended command initializaton procedures if 
  40.      * desired.
  41.      */
  42.     interpPtr = new TclInterp_cl;
  43.  
  44.     /*
  45.      *   >>>>>> INITIALIZE APPLICATION SPECIFIC COMMANDS HERE <<<<<<
  46.      */
  47.  
  48.     /*
  49.      * Load the tcl startup code, this should pull in all of the tcl
  50.      * procs, paths, command line processing, autoloads, packages, etc.
  51.      * If Tcl was invoked interactively, Tcl_Startup will give it
  52.      * a command loop.
  53.      */
  54.  
  55.     interpPtr->Startup (0, argc, argv);
  56.  
  57.     /* 
  58.      * Delete the interpreter (not neccessary under Unix, but we do
  59.      * it if TCL_MEM_DEBUG is set to better enable us to catch memory
  60.      * corruption problems)
  61.      */
  62.  
  63. #ifdef TCL_MEM_DEBUG
  64.     delete interpPtr;
  65. #endif
  66.  
  67. #ifdef TCL_SHELL_MEM_LEAK
  68.     printf (" >>> Dumping active memory list to mem.lst <<<\n");
  69.     if (Tcl_DumpActiveMemory ("mem.lst") != TCL_OK)
  70.         panic ("error accessing `mem.lst': %s", strerror (errno));
  71. #endif
  72.  
  73.     exit(0);
  74. }
  75.  
  76.