home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / tls / tls085.solintel.Z / tls085.solintel / lib / vtcl / main.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-20  |  4.8 KB  |  135 lines

  1. /* CVS $Id: main.c,v 1.2 1994/04/28 16:35:29 shonagh Exp $ */
  2. /*-------------------------------------------------------------------------
  3.   Copyright (c) 1992                   The Santa Cruz Operation, Inc.
  4.   -------------------------------------------------------------------------
  5.   All rights reserved.  No part of this  program or publication may be
  6.   reproduced, transmitted, transcribed, stored  in a retrieval system,
  7.   or translated into any language or computer language, in any form or
  8.   by any  means,  electronic, mechanical, magnetic, optical, chemical,
  9.   biological, or otherwise, without the  prior written  permission of:
  10.  
  11.            The Santa Cruz Operation, Inc.  (408) 425-7222
  12.            400 Encinal St, Santa Cruz, CA  95060 USA
  13.   -------------------------------------------------------------------------
  14.  
  15.   SCCS  : @(#) main.c 10.1 93/10/04 
  16.   Author: wing
  17.   Date  : 04-Oct-93
  18.   File  : main.c
  19.  
  20.   Modification History:
  21.   M002, 03-Jan-94, wing
  22.     Removed old main.c and replaced with 7.2 dist fake main.
  23.   M001, 11-Oct-93, wing
  24.     removed commands and moved to commands.c
  25.   M000,    04-Oct-93, wing
  26.     created
  27.   -----------------------------------------------------------------------*/
  28. /* 
  29.  * tclXAppInit.c --
  30.  *
  31.  *      Provides a default version of the Tcl_AppInit procedure for use with
  32.  *      applications built with Extended Tcl.  This is based on the the UCB
  33.  *      Tcl file tclAppInit.c
  34.  *
  35.  *-----------------------------------------------------------------------------
  36.  * Copyright 1991-1993 Karl Lehenbauer and Mark Diekhans.
  37.  *
  38.  * Permission to use, copy, modify, and distribute this software and its
  39.  * documentation for any purpose and without fee is hereby granted, provided
  40.  * that the above copyright notice appear in all copies.  Karl Lehenbauer and
  41.  * Mark Diekhans make no representations about the suitability of this
  42.  * software for any purpose.  It is provided "as is" without express or
  43.  * implied warranty.
  44.  *-----------------------------------------------------------------------------
  45.  * $Id: main.c,v 1.2 1994/04/28 16:35:29 shonagh Exp $
  46.  *-----------------------------------------------------------------------------
  47.  * Copyright (c) 1993 The Regents of the University of California.
  48.  * All rights reserved.
  49.  *
  50.  * Permission is hereby granted, without written agreement and without
  51.  * license or royalty fees, to use, copy, modify, and distribute this
  52.  * software and its documentation for any purpose, provided that the
  53.  * above copyright notice and the following two paragraphs appear in
  54.  * all copies of this software.
  55.  * 
  56.  * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
  57.  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
  58.  * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  59.  * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  60.  *
  61.  * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  62.  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  63.  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  64.  * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  65.  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  66.  */
  67.  
  68. #include "tclExtend.h"
  69.  
  70.  
  71. /*
  72.  * The following variable is a special hack that allows applications
  73.  * to be linked using the procedure "main" from the Tcl library.  The
  74.  * variable generates a reference to "main", which causes main to
  75.  * be brought in from the library (and all of Tcl with it).
  76.  */
  77.  
  78. extern int main();
  79. int *tclXDummyMainPtr = (int *) main;
  80.  
  81. /*
  82.  *----------------------------------------------------------------------
  83.  *
  84.  * Tcl_AppInit --
  85.  *
  86.  *      This procedure performs application-specific initialization.
  87.  *      Most applications, especially those that incorporate additional
  88.  *      packages, will have their own version of this procedure.
  89.  *
  90.  * Results:
  91.  *      Returns a standard Tcl completion code, and leaves an error
  92.  *      message in interp->result if an error occurs.
  93.  *
  94.  * Side effects:
  95.  *      Depends on the startup script.
  96.  *
  97.  *----------------------------------------------------------------------
  98.  */
  99.  
  100. int
  101. Tcl_AppInit(interp)
  102.     Tcl_Interp *interp;         /* Interpreter for application. */
  103. {
  104.     /*
  105.      * Call the init procedures for included packages.  Each call should
  106.      * look like this:
  107.      *
  108.      * if (Mod_Init(interp) == TCL_ERROR) {
  109.      *     return TCL_ERROR;
  110.      * }
  111.      *
  112.      * where "Mod" is the name of the module.
  113.      */
  114.  
  115.     /*
  116.      * Add in Extended Tcl commands and source TclX initialization file.
  117.      */
  118.     if (TclX_Init (interp) == TCL_ERROR) {
  119.         return TCL_ERROR;
  120.     }
  121.  
  122.     if (Tcl_InitWServer (interp) == TCL_ERROR) {
  123.         return TCL_ERROR;
  124.     }
  125.     
  126.     /*
  127.      * Call Tcl_CreateCommand for application-specific commands, if
  128.      * they weren't already created by the init procedures called above.
  129.      */
  130.  
  131.     return TCL_OK;
  132. }
  133.  
  134.  
  135.