Diff

Differences From Artifact [ae720616f1]:

To Artifact [108a80f35a]:


82
83
84
85
86
87
88

89
90

91
92
93
94
95
96
97
#endif
#ifdef _WIN32
Tcl_AppInitProc	Dde_Init, Registry_Init;
#endif

#ifdef TCLKIT_DLL
#  define TCLKIT_MOUNTPOINT "/.KITDLL_TCL"

#else
#  define TCLKIT_MOUNTPOINT "[info nameofexecutable]"

#endif /* TCLKIT_DLL */

#ifdef HAVE_ACCEPTABLE_DLADDR
#  ifdef KITSH_NEED_WINMAIN
#    ifdef _WIN32_WCE
int wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow);
#    else







>


>







82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#endif
#ifdef _WIN32
Tcl_AppInitProc	Dde_Init, Registry_Init;
#endif

#ifdef TCLKIT_DLL
#  define TCLKIT_MOUNTPOINT "/.KITDLL_TCL"
#  define TCLKIT_VFSSOURCE "$::tclKitFilename"
#else
#  define TCLKIT_MOUNTPOINT "[info nameofexecutable]"
#  define TCLKIT_VFSSOURCE "[info nameofexecutable]"
#endif /* TCLKIT_DLL */

#ifdef HAVE_ACCEPTABLE_DLADDR
#  ifdef KITSH_NEED_WINMAIN
#    ifdef _WIN32_WCE
int wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow);
#    else
139
140
141
142
143
144
145


146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203





204




205
206
207
208
209
210
211
	"catch { load {} zlib }\n"
#endif
#ifdef KIT_INCLUDES_MK4TCL
	"catch { load {} Mk4tcl }\n"
#endif
#ifdef TCLKIT_DLL
	"load {} tclkit::init\n"


#endif
	"set bootfile [file join " TCLKIT_MOUNTPOINT " boot.tcl]\n"
	"if {[file exists $bootfile]} {\n"
		"catch {\n"
			"set f [open $bootfile]\n"
			"set s [read $f]\n"
			"close $f\n"
		"}\n"
	"}\n"
#ifdef KIT_STORAGE_MK4
	"set ::tclKitStorage \"mk4\"\n"
	"if {![info exists s]} {\n"
		"mk::file open exe [info nameofexecutable] -readonly\n"
		"set n [mk::select exe.dirs!0.files name boot.tcl]\n"
		"if {$n != \"\"} {\n"
			"set s [mk::get exe.dirs!0.files!$n contents]\n"
			"if {![string length $s]} { error \"empty boot.tcl\" }\n"
			"catch {load {} zlib}\n"
			"if {[mk::get exe.dirs!0.files!$n size] != [string length $s]} {\n"
				"set s [zlib decompress $s]\n"
			"}\n"
		"}\n"
	"}\n"
#endif /* KIT_STORAGE_MK4 */
#ifdef KIT_STORAGE_ZIP
	"set ::tclKitStorage \"zip\"\n"
	"catch { load {} vfs }\n"
	"if {![info exists s]} {\n"
#  include "zipvfs.tcl.h"
		"catch {\n"
			"set ::tclKitStorage_fd [::zip::open [info nameofexecutable]]\n"
			"::zip::stat $::tclKitStorage_fd boot.tcl sb\n"
			"seek $::tclKitStorage_fd $sb(ino)\n"
			"::zip::Data $::tclKitStorage_fd sb s\n"
		"}\n"
	"}\n"
#endif /* KIT_STORAGE_ZIP */
#ifdef KIT_STORAGE_CVFS
	"set ::tclKitStorage \"cvfs\"\n"
	"load {} rechan\n"
	"load {} vfs\n"
	"load {} vfs_kitdll_data_tcl\n"
#include "vfs_kitdll.tcl.h"
	"if {![info exists s]} {\n"
		"catch {\n"
			"set s [::vfs::kitdll::data::getData tcl boot.tcl]\n"
		"}\n"
	"}\n"
#endif /* KIT_STORAGE_CVFS */
#ifdef TCLKIT_DLL
	"::tclkit::init::initInterp\n"
	"rename ::tclkit::init::initInterp {}\n"
#else
	"if {![info exists s]} {\n"
		"set f [open setup.tcl]\n"
		"set s [read $f]\n"
		"close $f\n"
	"}\n"





#endif /* TCLKIT_DLL */




	"uplevel #0 $s\n"
#if defined(KIT_INCLUDES_TK) && defined(KIT_TK_VERSION)
	"package ifneeded Tk " KIT_TK_VERSION " {\n"
		"load {} Tk\n"
	"}\n"
#endif
#ifdef _WIN32







>
>
|











|

















|


















|
<
<
<





>
>
>
>
>

>
>
>
>







141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199



200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
	"catch { load {} zlib }\n"
#endif
#ifdef KIT_INCLUDES_MK4TCL
	"catch { load {} Mk4tcl }\n"
#endif
#ifdef TCLKIT_DLL
	"load {} tclkit::init\n"
	"::tclkit::init::initInterp\n"
	"rename ::tclkit::init::initInterp {}\n"
#endif /* TCLKIT_DLL */
	"set bootfile [file join " TCLKIT_MOUNTPOINT " boot.tcl]\n"
	"if {[file exists $bootfile]} {\n"
		"catch {\n"
			"set f [open $bootfile]\n"
			"set s [read $f]\n"
			"close $f\n"
		"}\n"
	"}\n"
#ifdef KIT_STORAGE_MK4
	"set ::tclKitStorage \"mk4\"\n"
	"if {![info exists s]} {\n"
		"mk::file open exe " TCLKIT_VFSSOURCE " -readonly\n"
		"set n [mk::select exe.dirs!0.files name boot.tcl]\n"
		"if {$n != \"\"} {\n"
			"set s [mk::get exe.dirs!0.files!$n contents]\n"
			"if {![string length $s]} { error \"empty boot.tcl\" }\n"
			"catch {load {} zlib}\n"
			"if {[mk::get exe.dirs!0.files!$n size] != [string length $s]} {\n"
				"set s [zlib decompress $s]\n"
			"}\n"
		"}\n"
	"}\n"
#endif /* KIT_STORAGE_MK4 */
#ifdef KIT_STORAGE_ZIP
	"set ::tclKitStorage \"zip\"\n"
	"catch { load {} vfs }\n"
	"if {![info exists s]} {\n"
#  include "zipvfs.tcl.h"
		"catch {\n"
			"set ::tclKitStorage_fd [::zip::open " TCLKIT_VFSSOURCE "]\n"
			"::zip::stat $::tclKitStorage_fd boot.tcl sb\n"
			"seek $::tclKitStorage_fd $sb(ino)\n"
			"::zip::Data $::tclKitStorage_fd sb s\n"
		"}\n"
	"}\n"
#endif /* KIT_STORAGE_ZIP */
#ifdef KIT_STORAGE_CVFS
	"set ::tclKitStorage \"cvfs\"\n"
	"load {} rechan\n"
	"load {} vfs\n"
	"load {} vfs_kitdll_data_tcl\n"
#include "vfs_kitdll.tcl.h"
	"if {![info exists s]} {\n"
		"catch {\n"
			"set s [::vfs::kitdll::data::getData tcl boot.tcl]\n"
		"}\n"
	"}\n"
#endif /* KIT_STORAGE_CVFS */
#ifndef TCLKIT_DLL



	"if {![info exists s]} {\n"
		"set f [open setup.tcl]\n"
		"set s [read $f]\n"
		"close $f\n"
	"}\n"
#endif /* !TCLKIT_DLL */
#ifdef TCLKIT_DLL
	"set ::TCLKIT_TYPE \"kitdll\"\n"
#else
	"set ::TCLKIT_TYPE \"tclkit\"\n"
#endif /* TCLKIT_DLL */
	"set ::TCLKIT_MOUNTPOINT " TCLKIT_MOUNTPOINT "\n"
	"set ::TCLKIT_VFSSOURCE " TCLKIT_VFSSOURCE "\n"
	"set ::TCLKIT_MOUNTPOINT_VAR {" TCLKIT_MOUNTPOINT "}\n"
	"set ::TCLKIT_VFSSOURCE_VAR {" TCLKIT_VFSSOURCE "}\n"
	"uplevel #0 $s\n"
#if defined(KIT_INCLUDES_TK) && defined(KIT_TK_VERSION)
	"package ifneeded Tk " KIT_TK_VERSION " {\n"
		"load {} Tk\n"
	"}\n"
#endif
#ifdef _WIN32
364
365
366
367
368
369
370

371
372
373
374
375

376

377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393

394
395
396
397
398
399
400
}

static void _Tclkit_Interp_Init(Tcl_Interp *interp) {
#ifdef TCLKIT_CAN_SET_ENCODING
	Tcl_DString encodingName;
#endif /* TCLKIT_CAN_SET_ENCODING */


	/* the tcl_rcFileName variable only exists in the initial interpreter */
#ifdef _WIN32
	Tcl_SetVar(interp, "tcl_rcFileName", "~/tclkitrc.tcl", TCL_GLOBAL_ONLY);
#else
	Tcl_SetVar(interp, "tcl_rcFileName", "~/.tclkitrc", TCL_GLOBAL_ONLY);

#endif


#ifdef TCLKIT_CAN_SET_ENCODING
	/* Set the encoding from the Environment */
	Tcl_GetEncodingNameFromEnvironment(&encodingName);
	Tcl_SetSystemEncoding(NULL, Tcl_DStringValue(&encodingName));
	Tcl_SetVar(interp, "tclkit_system_encoding", Tcl_DStringValue(&encodingName), 0);
	Tcl_DStringFree(&encodingName);
#endif

	/* Hack to get around Tcl bug 1224888.  This must be run here and
	 * in LibraryPathObjCmd because this information is needed both
	 * before and after that command is run. */
	FindAndSetExecName(interp);

	return;
}


int TclKit_AppInit(Tcl_Interp *interp) {
#ifdef KIT_INCLUDES_TK
#  ifdef _WIN32
#    ifndef _WIN32_WCE
	char msgBuf[2049];
#    endif /* !_WIN32_WCE */
#  endif /* _WIN32 */







>

|

|

>
|
>







|









>







374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
}

static void _Tclkit_Interp_Init(Tcl_Interp *interp) {
#ifdef TCLKIT_CAN_SET_ENCODING
	Tcl_DString encodingName;
#endif /* TCLKIT_CAN_SET_ENCODING */

#ifndef TCLKIT_DLL
	/* the tcl_rcFileName variable only exists in the initial interpreter */
#  ifdef _WIN32
	Tcl_SetVar(interp, "tcl_rcFileName", "~/tclkitrc.tcl", TCL_GLOBAL_ONLY);
#  else
	Tcl_SetVar(interp, "tcl_rcFileName", "~/.tclkitrc", TCL_GLOBAL_ONLY);
#  endif /* _WIN32 */
#endif /* !TCLKIT_DLL */
	Tcl_SetVar(interp, "TCLKIT_INITVFS", "1", TCL_GLOBAL_ONLY);

#ifdef TCLKIT_CAN_SET_ENCODING
	/* Set the encoding from the Environment */
	Tcl_GetEncodingNameFromEnvironment(&encodingName);
	Tcl_SetSystemEncoding(NULL, Tcl_DStringValue(&encodingName));
	Tcl_SetVar(interp, "tclkit_system_encoding", Tcl_DStringValue(&encodingName), 0);
	Tcl_DStringFree(&encodingName);
#endif /* TCLKIT_CAN_SET_ENCODING */

	/* Hack to get around Tcl bug 1224888.  This must be run here and
	 * in LibraryPathObjCmd because this information is needed both
	 * before and after that command is run. */
	FindAndSetExecName(interp);

	return;
}

#ifndef TCLKIT_DLL
int TclKit_AppInit(Tcl_Interp *interp) {
#ifdef KIT_INCLUDES_TK
#  ifdef _WIN32
#    ifndef _WIN32_WCE
	char msgBuf[2049];
#    endif /* !_WIN32_WCE */
#  endif /* _WIN32 */
457
458
459
460
461
462
463

464
465
466
467
468
469
470
#    endif /* !_WIN32_WCE */
    /* we won't reach this, but we need the return */
#  endif /* _WIN32 */
#endif /* KIT_INCLUDES_TK */

	return TCL_ERROR;
}



#ifdef TCLKIT_DLL
#  ifdef HAVE_ACCEPTABLE_DLADDR
/* Symbol to resolve against dladdr() */
static void _tclkit_dummy_func(void) {
	return;







>







471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
#    endif /* !_WIN32_WCE */
    /* we won't reach this, but we need the return */
#  endif /* _WIN32 */
#endif /* KIT_INCLUDES_TK */

	return TCL_ERROR;
}
#endif /* !TCLKIT_DLL */


#ifdef TCLKIT_DLL
#  ifdef HAVE_ACCEPTABLE_DLADDR
/* Symbol to resolve against dladdr() */
static void _tclkit_dummy_func(void) {
	return;