PageRenderTime 56ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/ttn-post-libtool-1-4-3-upgrade/SWIG/Lib/tcl/wish.i

#
Swig | 166 lines | 81 code | 27 blank | 58 comment | 0 complexity | 86f3ca673aa7e1f046f368486917fb4d MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. //
  2. // $Header$
  3. //
  4. // SWIG File for making wish
  5. // Dave Beazley
  6. // April 25, 1996
  7. //
  8. /* Revision History
  9. * $Log$
  10. * Revision 1.1.2.1 2001/06/20 11:47:29 mkoeppe
  11. * Portability fixes
  12. *
  13. * Revision 1.1 2000/01/11 21:15:54 beazley
  14. * Added files
  15. *
  16. * Revision 1.2 1999/11/05 21:45:14 beazley
  17. * Minor Changes
  18. *
  19. * Revision 1.1.1.1 1999/02/28 02:00:56 beazley
  20. * Swig1.1
  21. *
  22. * Revision 1.1 1996/05/22 19:47:45 beazley
  23. * Initial revision
  24. *
  25. */
  26. #ifdef AUTODOC
  27. %subsection "wish.i"
  28. %text %{
  29. This module provides the Tk_AppInit() function needed to build a
  30. new version of the wish executable. Like tclsh.i, this file should
  31. not be used with dynamic loading. To make an interface file work with
  32. both static and dynamic loading, put something like this in your
  33. interface file :
  34. #ifdef STATIC
  35. %include wish.i
  36. #endif
  37. A startup file may be specified by defining the symbol SWIG_RcFileName
  38. as follows (this should be included in a code-block) :
  39. #define SWIG_RcFileName "~/.mywishrc"
  40. %}
  41. #endif
  42. %{
  43. /* Initialization code for wish */
  44. #include <tk.h>
  45. #ifndef SWIG_RcFileName
  46. char *SWIG_RcFileName = "~/.wishrc";
  47. #endif
  48. #ifdef MAC_TCL
  49. extern int MacintoshInit _ANSI_ARGS_((void));
  50. extern int SetupMainInterp _ANSI_ARGS_((Tcl_Interp *interp));
  51. #endif
  52. /*
  53. *----------------------------------------------------------------------
  54. *
  55. * Tcl_AppInit --
  56. *
  57. * This procedure performs application-specific initialization.
  58. * Most applications, especially those that incorporate additional
  59. * packages, will have their own version of this procedure.
  60. *
  61. * Results:
  62. * Returns a standard Tcl completion code, and leaves an error
  63. * message in interp->result if an error occurs.
  64. *
  65. * Side effects:
  66. * Depends on the startup script.
  67. *
  68. *----------------------------------------------------------------------
  69. */
  70. int Tcl_AppInit(Tcl_Interp *interp)
  71. {
  72. #ifndef MAC_TCL
  73. Tk_Window main;
  74. main = Tk_MainWindow(interp);
  75. #endif
  76. /*
  77. * Call the init procedures for included packages. Each call should
  78. * look like this:
  79. *
  80. * if (Mod_Init(interp) == TCL_ERROR) {
  81. * return TCL_ERROR;
  82. * }
  83. *
  84. * where "Mod" is the name of the module.
  85. */
  86. if (Tcl_Init(interp) == TCL_ERROR) {
  87. return TCL_ERROR;
  88. }
  89. if (Tk_Init(interp) == TCL_ERROR) {
  90. return TCL_ERROR;
  91. }
  92. /*
  93. * Call Tcl_CreateCommand for application-specific commands, if
  94. * they weren't already created by the init procedures called above.
  95. */
  96. if (SWIG_init(interp) == TCL_ERROR) {
  97. return TCL_ERROR;
  98. }
  99. #ifdef MAC_TCL
  100. SetupMainInterp(interp);
  101. #endif
  102. /*
  103. * Specify a user-specific startup file to invoke if the application
  104. * is run interactively. Typically the startup file is "~/.apprc"
  105. * where "app" is the name of the application. If this line is deleted
  106. * then no user-specific startup file will be run under any conditions.
  107. */
  108. #if TCL_MAJOR_VERSION >= 8 || TCL_MAJOR_VERSION == 7 && TCL_MINOR_VERSION >= 5
  109. Tcl_SetVar(interp, (char *) "tcl_rcFileName",SWIG_RcFileName,TCL_GLOBAL_ONLY);
  110. #else
  111. tcl_RcFileName = SWIG_RcFileName;
  112. #endif
  113. /* For Macintosh might also want this */
  114. #ifdef MAC_TCL
  115. #ifdef SWIG_RcRsrcName
  116. Tcl_SetVar(interp, (char *) "tcl_rcRsrcName",SWIG_RcRsrcName,TCL_GLOBAL_ONLY);
  117. #endif
  118. #endif
  119. return TCL_OK;
  120. }
  121. #if TK_MAJOR_VERSION >= 4
  122. int main(int argc, char **argv) {
  123. #ifdef MAC_TCL
  124. char *newArgv[2];
  125. if (MacintoshInit() != TCL_OK) {
  126. Tcl_Exit(1);
  127. }
  128. argc = 1;
  129. newArgv[0] = "Wish";
  130. newArgv[1] = NULL;
  131. argv = newArgv;
  132. #endif
  133. Tk_Main(argc, argv, Tcl_AppInit);
  134. return(0);
  135. }
  136. #else
  137. extern int main();
  138. #endif
  139. %}