home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / ObjectTcl-1.1 / tclAppInit.C < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-30  |  3.2 KB  |  111 lines

  1. /* 
  2.  * tclAppInit.c --
  3.  *
  4.  *    Provides a default version of the Tcl_AppInit procedure.
  5.  *
  6.  * Copyright (c) 1993 The Regents of the University of California.
  7.  * All rights reserved.
  8.  *
  9.  * Permission is hereby granted, without written agreement and without
  10.  * license or royalty fees, to use, copy, modify, and distribute this
  11.  * software and its documentation for any purpose, provided that the
  12.  * above copyright notice and the following two paragraphs appear in
  13.  * all copies of this software.
  14.  * 
  15.  * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
  16.  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
  17.  * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  18.  * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  19.  *
  20.  * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  21.  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  22.  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  23.  * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  24.  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  25.  */
  26.  
  27. #ifndef lint
  28. static char rcsid[] = "$Header: /e/WESE/ObjectTcl/tclAppInit.C,v 1.4 1995/05/11 09:59:50 deans Exp $ SPRITE (Berkeley)";
  29. #endif /* not lint */
  30.  
  31. #include <tcl.h>
  32. #include "Otcl.H"
  33.  
  34. extern "C" void Tcl_Main (int, char **);
  35.  
  36. /*
  37.  
  38. /*
  39.  *----------------------------------------------------------------------
  40.  *
  41.  * Tcl_AppInit --
  42.  *
  43.  *    This procedure performs application-specific initialization.
  44.  *    Most applications, especially those that incorporate additional
  45.  *    packages, will have their own version of this procedure.
  46.  *
  47.  * Results:
  48.  *    Returns a standard Tcl completion code, and leaves an error
  49.  *    message in interp->result if an error occurs.
  50.  *
  51.  * Side effects:
  52.  *    Depends on the startup script.
  53.  *
  54.  *----------------------------------------------------------------------
  55.  */
  56.  
  57. int
  58. Tcl_AppInit(Tcl_Interp *interp)
  59. {
  60.     /*
  61.      * Call the init procedures for included packages.  Each call should
  62.      * look like this:
  63.      *
  64.      * if (Mod_Init(interp) == TCL_ERROR) {
  65.      *     return TCL_ERROR;
  66.      * }
  67.      *
  68.      * where "Mod" is the name of the module.
  69.      */
  70.  
  71.     if (Tcl_Init(interp) == TCL_ERROR) {
  72.     return TCL_ERROR;
  73.     }
  74.  
  75.     if (Otcl_Init (interp) == TCL_ERROR) {
  76.         return TCL_ERROR;
  77.     }
  78.  
  79.     /*
  80.      * Call Tcl_CreateCommand for application-specific commands, if
  81.      * they weren't already created by the init procedures called above.
  82.      */
  83.  
  84.     /*
  85.      * Specify a user-specific startup file to invoke if the application
  86.      * is run interactively.  Typically the startup file is "~/.apprc"
  87.      * where "app" is the name of the application.  If this line is deleted
  88.      * then no user-specific startup file will be run under any conditions.
  89.      */
  90.  
  91.     tcl_RcFileName = "~/.tclshrc";
  92.     return TCL_OK;
  93. }
  94.  
  95. /*
  96.  *----------------------------------------------------------------------
  97.  * main --
  98.  *
  99.  *  Since including main in the library causes major problems for
  100.  *  C++, we have it here.  This will all be fixed in tcl7.4.
  101.  *
  102.  *----------------------------------------------------------------------
  103.  */
  104.  
  105. int
  106. main (int argc, char **argv)
  107. {
  108.     Tcl_Main (argc, argv);
  109.     return 0;
  110. }
  111.