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