Check-in [be67e6913f]
Overview
SHA1:be67e6913f53dc726aa8e174772098979db2ca05
Date: 2014-02-25 02:59:35
User: rkeene
Comment:Updated to use single routine for initializing interpreters
Timelines: family | ancestors | tk-win32-noconsole-fix
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2014-03-03
21:58
[4ae3806806] Merged console fixes in (user: rkeene, tags: trunk)
2014-02-25
02:59
[be67e6913f] Closed-Leaf: Updated to use single routine for initializing interpreters (user: rkeene, tags: tk-win32-noconsole-fix)
2014-02-24
17:22
[9481ffeac5] Added start of test for Tk on Win32 with noconsole (user: rkeene, tags: tk-win32-noconsole-fix)
Changes

Modified kitsh/buildsrc/kitsh-0.0/kitInit.c from [35c2f17362] to [8905d676cc].

99
100
101
102
103
104
105






106
107
108
109
110
111
112
...
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
...
393
394
395
396
397
398
399

400
401
402
403
404
405
406
...
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
...
514
515
516
517
518
519
520



521
522
523
524
525
526
527
...
558
559
560
561
562
563
564

565



566
567
568
569
570
571
572
#      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.
................................................................................
	"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"
................................................................................

	/* 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
................................................................................
#    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
................................................................................
	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;
................................................................................
	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







>
>
>
>
>
>







 







<



<







 







>







 







<
<
|







 







>
>
>







 







>

>
>
>






<
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
...
145
146
147
148
149
150
151

152
153
154

155
156
157
158
159
160
161
...
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
...
415
416
417
418
419
420
421


422
423
424
425
426
427
428
429
...
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
...
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581

#      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.
................................................................................
	"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"
................................................................................

	/* 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
................................................................................
#    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
................................................................................
	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;
................................................................................
	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;
}