Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
2.0 KiB

  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. #ifdef AUTODOC
  10. %subsection "tclsh.i"
  11. %text %{
  12. This module provides the Tcl_AppInit() function needed to build a
  13. new version of the tclsh executable. This file should not be used
  14. when using dynamic loading. To make an interface file work with
  15. both static and dynamic loading, put something like this in your
  16. interface file :
  17. #ifdef STATIC
  18. %include <tclsh.i>
  19. #endif
  20. %}
  21. #endif
  22. %{
  23. /* A TCL_AppInit() function that lets you build a new copy
  24. * of tclsh.
  25. *
  26. * The macro SWIG_init contains the name of the initialization
  27. * function in the wrapper file.
  28. */
  29. #ifndef SWIG_RcFileName
  30. char *SWIG_RcFileName = "~/.myapprc";
  31. #endif
  32. #ifdef MAC_TCL
  33. extern int MacintoshInit _ANSI_ARGS_((void));
  34. #endif
  35. int Tcl_AppInit(Tcl_Interp *interp){
  36. if (Tcl_Init(interp) == TCL_ERROR)
  37. return TCL_ERROR;
  38. /* Now initialize our functions */
  39. if (SWIG_init(interp) == TCL_ERROR)
  40. return TCL_ERROR;
  41. #if TCL_MAJOR_VERSION > 7 || TCL_MAJOR_VERSION == 7 && TCL_MINOR_VERSION >= 5
  42. Tcl_SetVar(interp, (char *) "tcl_rcFileName",SWIG_RcFileName,TCL_GLOBAL_ONLY);
  43. #else
  44. tcl_RcFileName = SWIG_RcFileName;
  45. #endif
  46. #ifdef SWIG_RcRsrcName
  47. Tcl_SetVar(interp, (char *) "tcl_rcRsrcName",SWIG_RcRsrcName,TCL_GLOBAL);
  48. #endif
  49. return TCL_OK;
  50. }
  51. #if TCL_MAJOR_VERSION > 7 || TCL_MAJOR_VERSION == 7 && TCL_MINOR_VERSION >= 4
  52. int main(int argc, char **argv) {
  53. #ifdef MAC_TCL
  54. char *newArgv[2];
  55. if (MacintoshInit() != TCL_OK) {
  56. Tcl_Exit(1);
  57. }
  58. argc = 1;
  59. newArgv[0] = "tclsh";
  60. newArgv[1] = NULL;
  61. argv = newArgv;
  62. #endif
  63. Tcl_Main(argc, argv, Tcl_AppInit);
  64. return(0);
  65. }
  66. #else
  67. extern int main();
  68. #endif
  69. %}