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 / tclX8.3 / tclXAppInit.c < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-22  |  3.0 KB  |  100 lines

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