home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tcl2-73c.zip / tcl7.3 / tclappinit.c < prev    next >
C/C++ Source or Header  |  1994-03-12  |  3KB  |  96 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: /user6/ouster/tcl/RCS/tclAppInit.c,v 1.6 93/08/26 14:34:55 ouster Exp $ SPRITE (Berkeley)";
  29. #endif /* not lint */
  30.  
  31. #include "tcl.h"
  32.  
  33. /*
  34.  * The following variable is a special hack that allows applications
  35.  * to be linked using the procedure "main" from the Tcl library.  The
  36.  * variable generates a reference to "main", which causes main to
  37.  * be brought in from the library (and all of Tcl with it).
  38.  */
  39.  
  40. extern int main();
  41. int *tclDummyMainPtr = (int *) main;
  42.  
  43. /*
  44.  *----------------------------------------------------------------------
  45.  *
  46.  * Tcl_AppInit --
  47.  *
  48.  *    This procedure performs application-specific initialization.
  49.  *    Most applications, especially those that incorporate additional
  50.  *    packages, will have their own version of this procedure.
  51.  *
  52.  * Results:
  53.  *    Returns a standard Tcl completion code, and leaves an error
  54.  *    message in interp->result if an error occurs.
  55.  *
  56.  * Side effects:
  57.  *    Depends on the startup script.
  58.  *
  59.  *----------------------------------------------------------------------
  60.  */
  61.  
  62. int
  63. Tcl_AppInit(interp)
  64.     Tcl_Interp *interp;        /* Interpreter for application. */
  65. {
  66.     /*
  67.      * Call the init procedures for included packages.  Each call should
  68.      * look like this:
  69.      *
  70.      * if (Mod_Init(interp) == TCL_ERROR) {
  71.      *     return TCL_ERROR;
  72.      * }
  73.      *
  74.      * where "Mod" is the name of the module.
  75.      */
  76.  
  77.     if (Tcl_Init(interp) == TCL_ERROR) {
  78.     return TCL_ERROR;
  79.     }
  80.  
  81.     /*
  82.      * Call Tcl_CreateCommand for application-specific commands, if
  83.      * they weren't already created by the init procedures called above.
  84.      */
  85.  
  86.     /*
  87.      * Specify a user-specific startup file to invoke if the application
  88.      * is run interactively.  Typically the startup file is "~/.apprc"
  89.      * where "app" is the name of the application.  If this line is deleted
  90.      * then no user-specific startup file will be run under any conditions.
  91.      */
  92.  
  93.     tcl_RcFileName = "~/.tclshrc";
  94.     return TCL_OK;
  95. }
  96.