PageRenderTime 44ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/Lib/tcl/tclsh.i

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