Diff

Differences From Artifact [35c2f17362]:

To Artifact [8905d676cc]:


99
100
101
102
103
104
105






106
107
108
109
110
111
112
#      else
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow);
#      endif /* _WIN32_WCE */
#    endif /* KITSH_NEED_WINMAIN */
int main(int argc, char **argv);
#  endif /* HAVE_ACCEPTABLE_DLADDR */
#endif /* !TCLKIT_DLL */







#ifdef TCLKIT_REQUIRE_TCLEXECUTABLENAME
char *tclExecutableName;
#endif

/*
 *  Attempt to load a "boot.tcl" entry from the embedded MetaKit file.







>
>
>
>
>
>







99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#      else
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow);
#      endif /* _WIN32_WCE */
#    endif /* KITSH_NEED_WINMAIN */
int main(int argc, char **argv);
#  endif /* HAVE_ACCEPTABLE_DLADDR */
#endif /* !TCLKIT_DLL */

#ifdef TCLKIT_DLL
void __attribute__((constructor)) _Tclkit_Init(void);
#else
static void _Tclkit_Init(void);
#endif

#ifdef TCLKIT_REQUIRE_TCLEXECUTABLENAME
char *tclExecutableName;
#endif

/*
 *  Attempt to load a "boot.tcl" entry from the embedded MetaKit file.
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
	"catch { load {} vfs }\n"
#ifdef KIT_INCLUDES_ZLIB
	"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"







<



<







145
146
147
148
149
150
151

152
153
154

155
156
157
158
159
160
161
	"catch { load {} vfs }\n"
#ifdef KIT_INCLUDES_ZLIB
	"catch { load {} zlib }\n"
#endif
#ifdef KIT_INCLUDES_MK4TCL
	"catch { load {} Mk4tcl }\n"
#endif

	"load {} tclkit::init\n"
	"::tclkit::init::initInterp\n"
	"rename ::tclkit::init::initInterp {}\n"

	"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"
393
394
395
396
397
398
399

400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426

	/* 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);

#if defined(_WIN32) && defined(KIT_INCLUDES_TK)

	Tk_InitConsoleChannels(interp);
#endif /* _WIN32 and KIT_INCLUDES_TK */

	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 */
#endif /* KIT_INCLUDES_TK */

	/* Perform common initialization */
	_Tclkit_Generic_Init();

	_Tclkit_Interp_Init(interp);

	if (Tcl_Init(interp) == TCL_ERROR) {
		goto error;
	}

#ifdef KIT_INCLUDES_TK
#  ifdef _WIN32







>

















<
<
|







397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421


422
423
424
425
426
427
428
429

	/* 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);

#if defined(_WIN32) && defined(KIT_INCLUDES_TK)
	/* Every interpreter needs this done */
	Tk_InitConsoleChannels(interp);
#endif /* _WIN32 and KIT_INCLUDES_TK */

	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 */
#endif /* KIT_INCLUDES_TK */

	/* Perform common initialization */


	_Tclkit_Init();

	if (Tcl_Init(interp) == TCL_ERROR) {
		goto error;
	}

#ifdef KIT_INCLUDES_TK
#  ifdef _WIN32
514
515
516
517
518
519
520



521
522
523
524
525
526
527
	if (gmfn_ret != 0) {
		return(strdup(modulename));
	}
#endif /* _WIN32 */

	return(NULL);
}




/*
 * This function exists to allow C code to initialize a particular
 * interpreter.
 */
static int tclkit_init_initinterp(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
	char *kitdll_path;







>
>
>







517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
	if (gmfn_ret != 0) {
		return(strdup(modulename));
	}
#endif /* _WIN32 */

	return(NULL);
}
#else
# define find_tclkit_dll_path() NULL
#endif

/*
 * This function exists to allow C code to initialize a particular
 * interpreter.
 */
static int tclkit_init_initinterp(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
	char *kitdll_path;
558
559
560
561
562
563
564

565



566
567
568
569
570
571
572
	return(tclPkgProv_ret);
}

/*
 * Initialize the Tcl system when we are loaded, that way Tcl functions
 * are ready to be used when invoked.
 */

void __attribute__((constructor)) _Tclkit_Init(void) {



	Tcl_StaticPackage(0, "tclkit::init", Tclkit_init_Init, NULL);

	_Tclkit_Generic_Init();

	return;
}
#endif







>

>
>
>






<
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581

	return(tclPkgProv_ret);
}

/*
 * Initialize the Tcl system when we are loaded, that way Tcl functions
 * are ready to be used when invoked.
 */
#ifdef TCLKIT_DLL
void __attribute__((constructor)) _Tclkit_Init(void) {
#else
static void _Tclkit_Init(void) {
#endif
	Tcl_StaticPackage(0, "tclkit::init", Tclkit_init_Init, NULL);

	_Tclkit_Generic_Init();

	return;
}