home *** CD-ROM | disk | FTP | other *** search
/ PC World 2002 May / PCWorld_2002-05_cd.bin / Software / TemaCD / activetcltk / ActiveTcl8.3.4.1-8.win32-ix86.exe / ActiveTcl8.3.4.1-win32-ix86 / lib / tkX8.3 / tkXAppInit.c < prev   
Encoding:
C/C++ Source or Header  |  2001-10-22  |  3.4 KB  |  108 lines

  1. /* 
  2.  * tkXAppInit.c --
  3.  *
  4.  * Provides a default version of the Tcl_AppInit procedure for use with
  5.  * applications built with Extended Tcl and Tk on Unix systems.  This is based
  6.  * on the the UCB Tk file tkAppInit.c
  7.  *-----------------------------------------------------------------------------
  8.  * Copyright 1991-1999 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 and
  13.  * Mark Diekhans make no representations about the suitability of this
  14.  * software for any purpose.  It is provided "as is" without express or
  15.  * implied warranty.
  16.  *-----------------------------------------------------------------------------
  17.  * $Id: tkXAppInit.c,v 8.6 1999/03/31 06:37:56 markd Exp $
  18.  *-----------------------------------------------------------------------------
  19.  */
  20.  
  21. #include "tclExtend.h"
  22. #include "tk.h"
  23.  
  24. /*
  25.  * The following variable is a special hack that insures the tcl
  26.  * version of matherr() is used when linking against shared libraries
  27.  * Even if matherr is not used on this system, there is a dummy version
  28.  * in libtcl.
  29.  */
  30. extern int matherr ();
  31. int (*tclDummyMathPtr)() = matherr;
  32.  
  33.  
  34. /*-----------------------------------------------------------------------------
  35.  * main --
  36.  *
  37.  * This is the main program for the application.
  38.  *-----------------------------------------------------------------------------
  39.  */
  40. #ifdef __cplusplus
  41. int
  42. main (int    argc,
  43.       char **argv)
  44. #else
  45. int
  46. main (argc, argv)
  47.     int    argc;
  48.     char **argv;
  49. #endif
  50. {
  51.     TkX_Main(argc, argv, Tcl_AppInit);
  52.     return 0;                   /* Needed only to prevent compiler warning. */
  53. }
  54.  
  55. /*-----------------------------------------------------------------------------
  56.  * Tcl_AppInit --
  57.  *
  58.  * This procedure performs application-specific initialization. Most
  59.  * applications, especially those that incorporate additional packages, will
  60.  * have their own version of this procedure.
  61.  *
  62.  * Results:
  63.  *    Returns a standard Tcl completion code, and leaves an error message in
  64.  * interp->result if an error occurs.
  65.  *-----------------------------------------------------------------------------
  66.  */
  67. #ifdef __cplusplus
  68. int
  69. Tcl_AppInit (Tcl_Interp *interp)
  70. #else
  71. int
  72. Tcl_AppInit (interp)
  73.     Tcl_Interp *interp;
  74. #endif
  75. {
  76.     if (Tcl_Init (interp) == TCL_ERROR) {
  77.         return TCL_ERROR;
  78.     }
  79.     if (Tclx_Init (interp) == TCL_ERROR) {
  80.         return TCL_ERROR;
  81.     }
  82.     Tcl_StaticPackage (interp, "Tclx", Tclx_Init, Tclx_SafeInit);
  83.     if (Tk_Init (interp) == TCL_ERROR) {
  84.         return TCL_ERROR;
  85.     }
  86.     Tcl_StaticPackage (interp, "Tk", Tk_Init, Tk_SafeInit);
  87.     if (Tkx_Init (interp) == TCL_ERROR) {
  88.         return TCL_ERROR;
  89.     }
  90.     Tcl_StaticPackage (interp, "Tkx", Tkx_Init, Tkx_SafeInit);
  91.  
  92.     /*
  93.      * Call Tcl_CreateCommand for application-specific commands, if
  94.      * they weren't already created by the init procedures called above.
  95.      */
  96.  
  97.     /*
  98.      * Specify a user-specific startup file to invoke if the application
  99.      * is run interactively.  Typically the startup file is "~/.apprc"
  100.      * where "app" is the name of the application.  If this line is deleted
  101.      * then no user-specific startup file will be run under any conditions.
  102.      */
  103.     Tcl_SetVar (interp, "tcl_rcFileName", "~/.wishxrc", TCL_GLOBAL_ONLY);
  104.     return TCL_OK;
  105. }
  106.  
  107.  
  108.