home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / devel / tcl / tclx7_31.z / tclx7_31 / tcldev / tclX7.3a-p1 / tksrc / tkXinit.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-11-19  |  2.4 KB  |  79 lines

  1. /*
  2.  * tkXinit.c --
  3.  *
  4.  * Initialization code for the wishx and other Tk & Extended Tcl based
  5.  * applications.
  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: tkXinit.c,v 3.0 1993/11/19 07:01:31 markd Rel $
  17.  *-----------------------------------------------------------------------------
  18.  */
  19.  
  20. #include "tclExtdInt.h"
  21. #include "tk.h"
  22.  
  23. /*
  24.  * The following is used to force the version of tkWindow.c that was compiled
  25.  * for TclX to be brought in rather than the standard version.
  26.  */
  27. int *tclxDummyMainWindowPtr = (int *) Tk_MainWindow;
  28.  
  29.  
  30. /*
  31.  *-----------------------------------------------------------------------------
  32.  *
  33.  * TkX_Init --
  34.  *
  35.  *   Do Tk initialization for wishx.  This includes overriding the value
  36.  * of the variable "tk_library" so it points to our library instead of 
  37.  * the standard one.
  38.  *
  39.  * Parameters:
  40.  *   o interp - A pointer to the interpreter.
  41.  * Returns:
  42.  *   TCL_OK or TCL_ERROR.
  43.  *-----------------------------------------------------------------------------
  44.  */
  45. int
  46. TkX_Init (interp)
  47.     Tcl_Interp          *interp;
  48. {
  49.     char        *value;
  50.     Tcl_DString  libDir;
  51.  
  52.     tclAppName     = "Wishx";
  53.     tclAppLongname = "Extended Tk Shell - Wishx";
  54.     tclAppVersion  = TK_VERSION;
  55.  
  56.     Tcl_DStringInit (&libDir);
  57.  
  58.     /*
  59.      * Get the path to the master (library) directory.
  60.      */
  61.     value = Tcl_GetVar2 (interp, "env", "TK_LIBRARY", TCL_GLOBAL_ONLY);
  62.     if (value != NULL)
  63.         Tcl_DStringAppend (&libDir, value, -1);
  64.     else
  65.         Tcl_DStringAppend (&libDir, TK_MASTERDIR, -1);
  66.  
  67.     /*
  68.      * If we are going to be interactive, Setup SIGINT handling.
  69.      */
  70.     value = Tcl_GetVar (interp, "tcl_interactive", TCL_GLOBAL_ONLY);
  71.     if ((value != NULL) && (value [0] != '0'))
  72.         Tcl_SetupSigInt ();
  73.  
  74.     /*
  75.      * Run the initialization that comes with standard Tk.
  76.      */
  77.     return Tk_Init (interp);
  78. }
  79.