PageRenderTime 51ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/rel-1-3-15/SWIG/Lib/tcl/tclsh.i

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