1/* ----------------------------------------------------------------------------- 2 * See the LICENSE file for information on copyright, usage and redistribution 3 * of SWIG, and the README file for authors - http://www.swig.org/release.html. 4 * 5 * tclsh.i 6 * 7 * SWIG File for building new tclsh program 8 * ----------------------------------------------------------------------------- */ 9 10#ifdef AUTODOC 11%subsection "tclsh.i" 12%text %{ 13This module provides the Tcl_AppInit() function needed to build a 14new version of the tclsh executable. This file should not be used 15when using dynamic loading. To make an interface file work with 16both static and dynamic loading, put something like this in your 17interface file : 18 19 #ifdef STATIC 20 %include <tclsh.i> 21 #endif 22%} 23#endif 24 25%{ 26 27/* A TCL_AppInit() function that lets you build a new copy 28 * of tclsh. 29 * 30 * The macro SWIG_init contains the name of the initialization 31 * function in the wrapper file. 32 */ 33 34#ifndef SWIG_RcFileName 35char *SWIG_RcFileName = "~/.myapprc"; 36#endif 37 38 39#ifdef MAC_TCL 40extern int MacintoshInit _ANSI_ARGS_((void)); 41#endif 42 43int Tcl_AppInit(Tcl_Interp *interp){ 44 45 if (Tcl_Init(interp) == TCL_ERROR) 46 return TCL_ERROR; 47 48 /* Now initialize our functions */ 49 50 if (SWIG_init(interp) == TCL_ERROR) 51 return TCL_ERROR; 52#if TCL_MAJOR_VERSION > 7 || TCL_MAJOR_VERSION == 7 && TCL_MINOR_VERSION >= 5 53 Tcl_SetVar(interp, (char *) "tcl_rcFileName",SWIG_RcFileName,TCL_GLOBAL_ONLY); 54#else 55 tcl_RcFileName = SWIG_RcFileName; 56#endif 57#ifdef SWIG_RcRsrcName 58 Tcl_SetVar(interp, (char *) "tcl_rcRsrcName",SWIG_RcRsrcName,TCL_GLOBAL); 59#endif 60 61 return TCL_OK; 62} 63 64#if TCL_MAJOR_VERSION > 7 || TCL_MAJOR_VERSION == 7 && TCL_MINOR_VERSION >= 4 65int main(int argc, char **argv) { 66#ifdef MAC_TCL 67 char *newArgv[2]; 68 69 if (MacintoshInit() != TCL_OK) { 70 Tcl_Exit(1); 71 } 72 73 argc = 1; 74 newArgv[0] = "tclsh"; 75 newArgv[1] = NULL; 76 argv = newArgv; 77#endif 78 79 Tcl_Main(argc, argv, Tcl_AppInit); 80 return(0); 81 82} 83#else 84extern int main(); 85#endif 86 87%} 88 89