Diff

Differences From Artifact [a26486a2c9]:

To Artifact [8565374f0c]:


    28     28   #endif /* _WIN32 */
    29     29   
    30     30   #ifndef MB_TASKMODAL
    31     31   #  define MB_TASKMODAL 0
    32     32   #endif /* MB_TASKMODAL */
    33     33   
    34     34   #include "tclInt.h"
           35  +
           36  +#if defined(HAVE_TCL_GETENCODINGNAMEFROMENVIRONMENT) && defined(HAVE_TCL_SETSYSTEMENCODING)
           37  +#  define TCLKIT_CAN_SET_ENCODING 1
           38  +#endif
           39  +#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 85
           40  +#  define KIT_INCLUDES_PWB 1
           41  +#endif
           42  +#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 86
           43  +#  define KIT_INCLUDES_ZLIB 1
           44  +#endif
    35     45   
    36     46   #ifdef KIT_INCLUDES_ITCL
    37     47   Tcl_AppInitProc	Itcl_Init;
    38     48   #endif
    39     49   #ifdef KIT_INCLUDES_MK4TCL
    40     50   Tcl_AppInitProc	Mk4tcl_Init;
    41     51   #endif
    42     52   Tcl_AppInitProc Vfs_Init, Rechan_Init;
    43         -#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 85
           53  +#ifdef KIT_INCLUDES_PWB
    44     54   Tcl_AppInitProc	Pwb_Init;
    45     55   #endif
    46         -#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 86
           56  +#ifdef KIT_INCLUDES_ZLIB
    47     57   Tcl_AppInitProc Zlib_Init;
    48     58   #endif
    49     59   #ifdef TCL_THREADS
    50     60   Tcl_AppInitProc	Thread_Init;
    51     61   #endif
    52     62   #ifdef _WIN32
    53     63   Tcl_AppInitProc	Dde_Init, Registry_Init;
................................................................................
   160    170   		execNameObj = Tcl_FSJoinToPath(Tcl_FSGetCwd(interp), 1, lobjv);
   161    171   
   162    172   		tclExecutableName = strdup(Tcl_GetStringFromObj(execNameObj, &len));
   163    173   	}
   164    174   }
   165    175   
   166    176   int TclKit_AppInit(Tcl_Interp *interp) {
          177  +#ifdef TCLKIT_CAN_SET_ENCODING
          178  +	Tcl_DString encodingName;
          179  +#endif
          180  +
   167    181   #ifdef KIT_INCLUDES_ITCL
   168    182   	Tcl_StaticPackage(0, "Itcl", Itcl_Init, NULL);
   169    183   #endif 
   170    184   #ifdef KIT_INCLUDES_MK4TCL
   171    185   	Tcl_StaticPackage(0, "Mk4tcl", Mk4tcl_Init, NULL);
   172    186   #endif
   173         -#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 85
          187  +#ifdef KIT_INCLUDES_PWB
   174    188   	Tcl_StaticPackage(0, "pwb", Pwb_Init, NULL);
   175    189   #endif 
   176    190   	Tcl_StaticPackage(0, "rechan", Rechan_Init, NULL);
   177    191   	Tcl_StaticPackage(0, "vfs", Vfs_Init, NULL);
   178         -#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 86
          192  +#ifdef KIT_INCLUDES_ZLIB
   179    193   	Tcl_StaticPackage(0, "zlib", Zlib_Init, NULL);
   180    194   #endif
   181    195   #ifdef TCL_THREADS
   182    196   	Tcl_StaticPackage(0, "Thread", Thread_Init, NULL);
   183    197   #endif
   184    198   #ifdef _WIN32
   185    199   	Tcl_StaticPackage(0, "dde", Dde_Init, NULL);
................................................................................
   191    205   
   192    206   	/* the tcl_rcFileName variable only exists in the initial interpreter */
   193    207   #ifdef _WIN32
   194    208   	Tcl_SetVar(interp, "tcl_rcFileName", "~/tclkitrc.tcl", TCL_GLOBAL_ONLY);
   195    209   #else
   196    210   	Tcl_SetVar(interp, "tcl_rcFileName", "~/.tclkitrc", TCL_GLOBAL_ONLY);
   197    211   #endif
          212  +
          213  +#ifdef TCLKIT_CAN_SET_ENCODING
          214  +	/* Set the encoding from the Environment */
          215  +	Tcl_GetEncodingNameFromEnvironment(&encodingName);
          216  +	Tcl_SetSystemEncoding(NULL, Tcl_DStringValue(&encodingName));
          217  +	Tcl_SetVar(interp, "tclkit_system_encoding", Tcl_DStringValue(&encodingName), 0);
          218  +	Tcl_DStringFree(&encodingName);
          219  +#endif
   198    220   
   199    221   	/* Hack to get around Tcl bug 1224888.  This must be run here and
   200    222   	 * in LibraryPathObjCmd because this information is needed both
   201    223   	 * before and after that command is run. */
   202    224   	SetExecName(interp);
   203    225   
   204    226   	TclSetPreInitScript(preInitCmd);