home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 15 / AACD15.ISO / AACD / Programming / Python2 / Python20_source / Modules / tkappinit.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-10-25  |  2.3 KB  |  89 lines

  1. /* appinit.c -- Tcl and Tk application initialization.
  2.  
  3.    The function Tcl_AppInit() below initializes various Tcl packages.
  4.    It is called for each Tcl interpreter created by _tkinter.create().
  5.    It needs to be compiled with -DWITH_<package> flags for each package
  6.    that you are statically linking with.  You may have to add sections
  7.    for packages not yet listed below.
  8.  
  9.    Note that those packages for which Tcl_StaticPackage() is called with
  10.    a NULL first argument are known as "static loadable" packages to
  11.    Tcl but not actually initialized.  To use these, you have to load
  12.    it explicitly, e.g. tkapp.eval("load {} Blt").
  13.  */
  14.  
  15. #include <tcl.h>
  16. #include <tk.h>
  17.  
  18. int
  19. Tcl_AppInit(Tcl_Interp *interp)
  20. {
  21.     Tk_Window main_window;
  22.  
  23.     if (Tcl_Init (interp) == TCL_ERROR)
  24.         return TCL_ERROR;
  25.     if (Tk_Init (interp) == TCL_ERROR)
  26.         return TCL_ERROR;
  27.  
  28.     main_window = Tk_MainWindow(interp);
  29.  
  30. #ifdef WITH_MOREBUTTONS
  31.     {
  32.         extern Tcl_CmdProc studButtonCmd;
  33.         extern Tcl_CmdProc triButtonCmd;
  34.  
  35.         Tcl_CreateCommand(interp, "studbutton", studButtonCmd,
  36.                   (ClientData) main_window, NULL);
  37.         Tcl_CreateCommand(interp, "tributton", triButtonCmd,
  38.                   (ClientData) main_window, NULL);
  39.     }
  40. #endif
  41.  
  42. #ifdef WITH_PIL /* 0.2b5 and later -- not yet released as of May 14 */
  43.     {
  44.         extern void TkImaging_Init(Tcl_Interp *);
  45.         TkImaging_Init(interp);
  46.         /* XXX TkImaging_Init() doesn't have the right return type */
  47.         /*Tcl_StaticPackage(interp, "Imaging", TkImaging_Init, NULL);*/
  48.     }
  49. #endif
  50.  
  51. #ifdef WITH_PIL_OLD /* 0.2b4 and earlier */
  52.     {
  53.         extern void TkImaging_Init(void);
  54.         /* XXX TkImaging_Init() doesn't have the right prototype */
  55.         /*Tcl_StaticPackage(interp, "Imaging", TkImaging_Init, NULL);*/
  56.     }
  57. #endif
  58.  
  59. #ifdef WITH_TIX
  60.         {
  61.                 extern int Tix_Init(Tcl_Interp *interp);
  62.                 extern int Tix_SafeInit(Tcl_Interp *interp);
  63.                 Tcl_StaticPackage(NULL, "Tix", Tix_Init, Tix_SafeInit);
  64.         }
  65. #endif
  66.  
  67. #ifdef WITH_BLT
  68.     {
  69.         extern int Blt_Init(Tcl_Interp *);
  70.         extern int Blt_SafeInit(Tcl_Interp *);
  71.         Tcl_StaticPackage(NULL, "Blt", Blt_Init, Blt_SafeInit);
  72.     }
  73. #endif
  74.  
  75. #ifdef WITH_TOGL
  76.     {
  77.         /* XXX I've heard rumors that this doesn't work */
  78.         extern int Togl_Init(Tcl_Interp *);
  79.         /* XXX Is there no Togl_SafeInit? */
  80.         Tcl_StaticPackage(NULL, "Togl", Togl_Init, NULL);
  81.     }
  82. #endif
  83.  
  84. #ifdef WITH_XXX
  85.  
  86. #endif
  87.     return TCL_OK;
  88. }
  89.