0000: 2f 2a 20 0a 20 2a 20 74 63 6c 41 70 70 49 6e 69 /* . * tclAppIni
0010: 74 2e 63 20 2d 2d 0a 20 2a 0a 20 2a 20 20 50 72 t.c --. *. * Pr
0020: 6f 76 69 64 65 73 20 61 20 64 65 66 61 75 6c 74 ovides a default
0030: 20 76 65 72 73 69 6f 6e 20 6f 66 20 74 68 65 20 version of the
0040: 6d 61 69 6e 20 70 72 6f 67 72 61 6d 20 61 6e 64 main program and
0050: 20 54 63 6c 5f 41 70 70 49 6e 69 74 0a 20 2a 20 Tcl_AppInit. *
0060: 20 70 72 6f 63 65 64 75 72 65 20 66 6f 72 20 54 procedure for T
0070: 63 6c 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 20 cl applications
0080: 28 77 69 74 68 6f 75 74 20 54 6b 29 2e 20 20 4e (without Tk). N
0090: 6f 74 65 20 74 68 61 74 20 74 68 69 73 0a 20 2a ote that this. *
00a0: 20 20 70 72 6f 67 72 61 6d 20 6d 75 73 74 20 62 program must b
00b0: 65 20 62 75 69 6c 74 20 69 6e 20 57 69 6e 33 32 e built in Win32
00c0: 20 63 6f 6e 73 6f 6c 65 20 6d 6f 64 65 20 74 6f console mode to
00d0: 20 77 6f 72 6b 20 70 72 6f 70 65 72 6c 79 2e 0a work properly..
00e0: 20 2a 0a 20 2a 20 43 6f 70 79 72 69 67 68 74 20 *. * Copyright
00f0: 28 63 29 20 31 39 39 36 2d 31 39 39 37 20 62 79 (c) 1996-1997 by
0100: 20 53 75 6e 20 4d 69 63 72 6f 73 79 73 74 65 6d Sun Microsystem
0110: 73 2c 20 49 6e 63 2e 0a 20 2a 20 43 6f 70 79 72 s, Inc.. * Copyr
0120: 69 67 68 74 20 28 63 29 20 31 39 39 38 2d 31 39 ight (c) 1998-19
0130: 39 39 20 62 79 20 53 63 72 69 70 74 69 63 73 20 99 by Scriptics
0140: 43 6f 72 70 6f 72 61 74 69 6f 6e 2e 0a 20 2a 20 Corporation.. *
0150: 43 6f 70 79 72 69 67 68 74 20 28 63 29 20 32 30 Copyright (c) 20
0160: 30 30 2d 32 30 30 32 20 4a 65 61 6e 2d 43 6c 61 00-2002 Jean-Cla
0170: 75 64 65 20 57 69 70 70 6c 65 72 20 3c 6a 63 77 ude Wippler <jcw
0180: 40 65 71 75 69 34 2e 63 6f 6d 3e 0a 20 2a 0a 20 @equi4.com>. *.
0190: 2a 20 53 65 65 20 74 68 65 20 66 69 6c 65 20 22 * See the file "
01a0: 6c 69 63 65 6e 73 65 2e 74 65 72 6d 73 22 20 66 license.terms" f
01b0: 6f 72 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 6f or information o
01c0: 6e 20 75 73 61 67 65 20 61 6e 64 20 72 65 64 69 n usage and redi
01d0: 73 74 72 69 62 75 74 69 6f 6e 0a 20 2a 20 6f 66 stribution. * of
01e0: 20 74 68 69 73 20 66 69 6c 65 2c 20 61 6e 64 20 this file, and
01f0: 66 6f 72 20 61 20 44 49 53 43 4c 41 49 4d 45 52 for a DISCLAIMER
0200: 20 4f 46 20 41 4c 4c 20 57 41 52 52 41 4e 54 49 OF ALL WARRANTI
0210: 45 53 2e 0a 20 2a 0a 20 2a 20 52 43 53 3a 20 40 ES.. *. * RCS: @
0220: 28 23 29 20 24 49 64 24 0a 20 2a 2f 0a 0a 23 69 (#) $Id$. */..#i
0230: 66 64 65 66 20 4b 49 54 5f 49 4e 43 4c 55 44 45 fdef KIT_INCLUDE
0240: 53 5f 54 4b 0a 23 20 20 69 6e 63 6c 75 64 65 20 S_TK.# include
0250: 3c 74 6b 2e 68 3e 0a 23 65 6c 73 65 0a 23 20 20 <tk.h>.#else.#
0260: 69 6e 63 6c 75 64 65 20 3c 74 63 6c 2e 68 3e 0a include <tcl.h>.
0270: 23 65 6e 64 69 66 20 2f 2a 20 4b 49 54 5f 49 4e #endif /* KIT_IN
0280: 43 4c 55 44 45 53 5f 54 4b 20 2a 2f 0a 0a 23 69 CLUDES_TK */..#i
0290: 66 64 65 66 20 5f 57 49 4e 33 32 0a 23 20 20 64 fdef _WIN32.# d
02a0: 65 66 69 6e 65 20 57 49 4e 33 32 5f 4c 45 41 4e efine WIN32_LEAN
02b0: 5f 41 4e 44 5f 4d 45 41 4e 0a 23 20 20 69 6e 63 _AND_MEAN.# inc
02c0: 6c 75 64 65 20 3c 77 69 6e 64 6f 77 73 2e 68 3e lude <windows.h>
02d0: 0a 23 20 20 75 6e 64 65 66 20 57 49 4e 33 32 5f .# undef WIN32_
02e0: 4c 45 41 4e 5f 41 4e 44 5f 4d 45 41 4e 0a 23 65 LEAN_AND_MEAN.#e
02f0: 6e 64 69 66 20 2f 2a 20 5f 57 49 4e 33 32 20 2a ndif /* _WIN32 *
0300: 2f 0a 0a 23 69 66 6e 64 65 66 20 4d 42 5f 54 41 /..#ifndef MB_TA
0310: 53 4b 4d 4f 44 41 4c 0a 23 20 20 64 65 66 69 6e SKMODAL.# defin
0320: 65 20 4d 42 5f 54 41 53 4b 4d 4f 44 41 4c 20 30 e MB_TASKMODAL 0
0330: 0a 23 65 6e 64 69 66 20 2f 2a 20 4d 42 5f 54 41 .#endif /* MB_TA
0340: 53 4b 4d 4f 44 41 4c 20 2a 2f 0a 0a 23 69 6e 63 SKMODAL */..#inc
0350: 6c 75 64 65 20 22 74 63 6c 49 6e 74 2e 68 22 0a lude "tclInt.h".
0360: 0a 23 69 66 64 65 66 20 48 41 56 45 5f 55 4e 49 .#ifdef HAVE_UNI
0370: 53 54 44 5f 48 0a 23 20 20 69 6e 63 6c 75 64 65 STD_H.# include
0380: 20 3c 75 6e 69 73 74 64 2e 68 3e 0a 23 65 6e 64 <unistd.h>.#end
0390: 69 66 0a 23 69 66 64 65 66 20 48 41 56 45 5f 53 if.#ifdef HAVE_S
03a0: 54 52 49 4e 47 5f 48 0a 23 20 20 69 6e 63 6c 75 TRING_H.# inclu
03b0: 64 65 20 3c 73 74 72 69 6e 67 2e 68 3e 0a 23 65 de <string.h>.#e
03c0: 6e 64 69 66 0a 23 69 66 64 65 66 20 48 41 56 45 ndif.#ifdef HAVE
03d0: 5f 53 54 52 49 4e 47 53 5f 48 0a 23 20 20 69 6e _STRINGS_H.# in
03e0: 63 6c 75 64 65 20 3c 73 74 72 69 6e 67 73 2e 68 clude <strings.h
03f0: 3e 0a 23 65 6e 64 69 66 0a 0a 2f 2a 20 46 6f 72 >.#endif../* For
0400: 20 64 6c 61 64 64 72 28 29 20 61 6e 64 20 44 6c dladdr() and Dl
0410: 5f 69 6e 66 6f 20 2a 2f 0a 23 69 66 64 65 66 20 _info */.#ifdef
0420: 48 41 56 45 5f 44 4c 46 43 4e 5f 48 0a 23 20 20 HAVE_DLFCN_H.#
0430: 69 6e 63 6c 75 64 65 20 3c 64 6c 66 63 6e 2e 68 include <dlfcn.h
0440: 3e 0a 23 65 6e 64 69 66 0a 0a 23 69 66 20 64 65 >.#endif..#if de
0450: 66 69 6e 65 64 28 48 41 56 45 5f 54 43 4c 5f 47 fined(HAVE_TCL_G
0460: 45 54 45 4e 43 4f 44 49 4e 47 4e 41 4d 45 46 52 ETENCODINGNAMEFR
0470: 4f 4d 45 4e 56 49 52 4f 4e 4d 45 4e 54 29 20 26 OMENVIRONMENT) &
0480: 26 20 64 65 66 69 6e 65 64 28 48 41 56 45 5f 54 & defined(HAVE_T
0490: 43 4c 5f 53 45 54 53 59 53 54 45 4d 45 4e 43 4f CL_SETSYSTEMENCO
04a0: 44 49 4e 47 29 0a 23 20 20 64 65 66 69 6e 65 20 DING).# define
04b0: 54 43 4c 4b 49 54 5f 43 41 4e 5f 53 45 54 5f 45 TCLKIT_CAN_SET_E
04c0: 4e 43 4f 44 49 4e 47 20 31 0a 23 65 6e 64 69 66 NCODING 1.#endif
04d0: 0a 23 69 66 20 31 30 20 2a 20 54 43 4c 5f 4d 41 .#if 10 * TCL_MA
04e0: 4a 4f 52 5f 56 45 52 53 49 4f 4e 20 2b 20 54 43 JOR_VERSION + TC
04f0: 4c 5f 4d 49 4e 4f 52 5f 56 45 52 53 49 4f 4e 20 L_MINOR_VERSION
0500: 3c 20 38 35 0a 23 20 20 64 65 66 69 6e 65 20 54 < 85.# define T
0510: 43 4c 4b 49 54 5f 52 45 51 55 49 52 45 5f 54 43 CLKIT_REQUIRE_TC
0520: 4c 45 58 45 43 55 54 41 42 4c 45 4e 41 4d 45 20 LEXECUTABLENAME
0530: 31 0a 23 65 6e 64 69 66 0a 0a 23 69 66 20 31 30 1.#endif..#if 10
0540: 20 2a 20 54 43 4c 5f 4d 41 4a 4f 52 5f 56 45 52 * TCL_MAJOR_VER
0550: 53 49 4f 4e 20 2b 20 54 43 4c 5f 4d 49 4e 4f 52 SION + TCL_MINOR
0560: 5f 56 45 52 53 49 4f 4e 20 3c 20 38 35 0a 23 20 _VERSION < 85.#
0570: 20 64 65 66 69 6e 65 20 4b 49 54 5f 49 4e 43 4c define KIT_INCL
0580: 55 44 45 53 5f 50 57 42 20 31 0a 23 65 6e 64 69 UDES_PWB 1.#endi
0590: 66 0a 23 69 66 20 31 30 20 2a 20 54 43 4c 5f 4d f.#if 10 * TCL_M
05a0: 41 4a 4f 52 5f 56 45 52 53 49 4f 4e 20 2b 20 54 AJOR_VERSION + T
05b0: 43 4c 5f 4d 49 4e 4f 52 5f 56 45 52 53 49 4f 4e CL_MINOR_VERSION
05c0: 20 3c 20 38 36 0a 23 20 20 64 65 66 69 6e 65 20 < 86.# define
05d0: 4b 49 54 5f 49 4e 43 4c 55 44 45 53 5f 5a 4c 49 KIT_INCLUDES_ZLI
05e0: 42 20 31 0a 23 65 6e 64 69 66 0a 0a 23 69 66 64 B 1.#endif..#ifd
05f0: 65 66 20 4b 49 54 5f 49 4e 43 4c 55 44 45 53 5f ef KIT_INCLUDES_
0600: 49 54 43 4c 0a 54 63 6c 5f 41 70 70 49 6e 69 74 ITCL.Tcl_AppInit
0610: 50 72 6f 63 09 49 74 63 6c 5f 49 6e 69 74 3b 0a Proc.Itcl_Init;.
0620: 23 65 6e 64 69 66 0a 23 69 66 64 65 66 20 4b 49 #endif.#ifdef KI
0630: 54 5f 49 4e 43 4c 55 44 45 53 5f 4d 4b 34 54 43 T_INCLUDES_MK4TC
0640: 4c 0a 54 63 6c 5f 41 70 70 49 6e 69 74 50 72 6f L.Tcl_AppInitPro
0650: 63 09 4d 6b 34 74 63 6c 5f 49 6e 69 74 3b 0a 23 c.Mk4tcl_Init;.#
0660: 65 6e 64 69 66 0a 54 63 6c 5f 41 70 70 49 6e 69 endif.Tcl_AppIni
0670: 74 50 72 6f 63 20 56 66 73 5f 49 6e 69 74 2c 20 tProc Vfs_Init,
0680: 52 65 63 68 61 6e 5f 49 6e 69 74 3b 0a 23 69 66 Rechan_Init;.#if
0690: 64 65 66 20 4b 49 54 5f 49 4e 43 4c 55 44 45 53 def KIT_INCLUDES
06a0: 5f 50 57 42 0a 54 63 6c 5f 41 70 70 49 6e 69 74 _PWB.Tcl_AppInit
06b0: 50 72 6f 63 09 50 77 62 5f 49 6e 69 74 3b 0a 23 Proc.Pwb_Init;.#
06c0: 65 6e 64 69 66 0a 23 69 66 64 65 66 20 4b 49 54 endif.#ifdef KIT
06d0: 5f 49 4e 43 4c 55 44 45 53 5f 5a 4c 49 42 0a 54 _INCLUDES_ZLIB.T
06e0: 63 6c 5f 41 70 70 49 6e 69 74 50 72 6f 63 20 5a cl_AppInitProc Z
06f0: 6c 69 62 5f 49 6e 69 74 3b 0a 23 65 6e 64 69 66 lib_Init;.#endif
0700: 0a 23 69 66 64 65 66 20 54 43 4c 5f 54 48 52 45 .#ifdef TCL_THRE
0710: 41 44 53 0a 54 63 6c 5f 41 70 70 49 6e 69 74 50 ADS.Tcl_AppInitP
0720: 72 6f 63 09 54 68 72 65 61 64 5f 49 6e 69 74 3b roc.Thread_Init;
0730: 0a 23 65 6e 64 69 66 0a 23 69 66 64 65 66 20 5f .#endif.#ifdef _
0740: 57 49 4e 33 32 0a 54 63 6c 5f 41 70 70 49 6e 69 WIN32.Tcl_AppIni
0750: 74 50 72 6f 63 09 44 64 65 5f 49 6e 69 74 2c 20 tProc.Dde_Init,
0760: 52 65 67 69 73 74 72 79 5f 49 6e 69 74 3b 0a 23 Registry_Init;.#
0770: 65 6e 64 69 66 0a 0a 2f 2a 20 44 65 74 65 72 6d endif../* Determ
0780: 69 6e 65 20 77 68 69 63 68 20 74 79 70 65 20 6f ine which type o
0790: 66 20 73 74 6f 72 61 67 65 20 74 6f 20 75 73 65 f storage to use
07a0: 20 2d 2d 20 4d 4b 34 20 6f 72 20 5a 49 50 20 2a -- MK4 or ZIP *
07b0: 2f 0a 23 69 66 20 64 65 66 69 6e 65 64 28 4b 49 /.#if defined(KI
07c0: 54 5f 53 54 4f 52 41 47 45 5f 4d 4b 34 29 20 26 T_STORAGE_MK4) &
07d0: 26 20 64 65 66 69 6e 65 64 28 4b 49 54 5f 53 54 & defined(KIT_ST
07e0: 4f 52 41 47 45 5f 5a 49 50 29 0a 23 20 20 75 6e ORAGE_ZIP).# un
07f0: 64 65 66 20 4b 49 54 5f 53 54 4f 52 41 47 45 5f def KIT_STORAGE_
0800: 5a 49 50 0a 23 65 6e 64 69 66 0a 23 69 66 20 21 ZIP.#endif.#if !
0810: 64 65 66 69 6e 65 64 28 4b 49 54 5f 53 54 4f 52 defined(KIT_STOR
0820: 41 47 45 5f 4d 4b 34 29 20 26 26 20 21 64 65 66 AGE_MK4) && !def
0830: 69 6e 65 64 28 4b 49 54 5f 53 54 4f 52 41 47 45 ined(KIT_STORAGE
0840: 5f 5a 49 50 29 0a 23 20 20 69 66 64 65 66 20 4b _ZIP).# ifdef K
0850: 49 54 5f 49 4e 43 4c 55 44 45 53 5f 4d 4b 34 54 IT_INCLUDES_MK4T
0860: 43 4c 0a 23 20 20 20 20 64 65 66 69 6e 65 20 4b CL.# define K
0870: 49 54 5f 53 54 4f 52 41 47 45 5f 4d 4b 34 20 31 IT_STORAGE_MK4 1
0880: 0a 23 20 20 65 6c 73 65 0a 23 20 20 20 20 64 65 .# else.# de
0890: 66 69 6e 65 20 4b 49 54 5f 53 54 4f 52 41 47 45 fine KIT_STORAGE
08a0: 5f 5a 49 50 20 31 0a 23 20 20 65 6e 64 69 66 0a _ZIP 1.# endif.
08b0: 23 65 6e 64 69 66 0a 0a 23 69 66 64 65 66 20 54 #endif..#ifdef T
08c0: 43 4c 4b 49 54 5f 52 45 51 55 49 52 45 5f 54 43 CLKIT_REQUIRE_TC
08d0: 4c 45 58 45 43 55 54 41 42 4c 45 4e 41 4d 45 0a LEXECUTABLENAME.
08e0: 63 68 61 72 20 2a 74 63 6c 45 78 65 63 75 74 61 char *tclExecuta
08f0: 62 6c 65 4e 61 6d 65 3b 0a 23 65 6e 64 69 66 0a bleName;.#endif.
0900: 0a 20 20 20 20 2f 2a 0a 20 20 20 20 20 2a 20 20 . /*. *
0910: 41 74 74 65 6d 70 74 20 74 6f 20 6c 6f 61 64 20 Attempt to load
0920: 61 20 22 62 6f 6f 74 2e 74 63 6c 22 20 65 6e 74 a "boot.tcl" ent
0930: 72 79 20 66 72 6f 6d 20 74 68 65 20 65 6d 62 65 ry from the embe
0940: 64 64 65 64 20 4d 65 74 61 4b 69 74 20 66 69 6c dded MetaKit fil
0950: 65 2e 0a 20 20 20 20 20 2a 20 20 49 66 20 74 68 e.. * If th
0960: 65 72 65 20 69 73 6e 27 74 20 6f 6e 65 2c 20 74 ere isn't one, t
0970: 72 79 20 74 6f 20 6f 70 65 6e 20 61 20 72 65 67 ry to open a reg
0980: 75 6c 61 72 20 22 73 65 74 75 70 2e 74 63 6c 22 ular "setup.tcl"
0990: 20 66 69 6c 65 20 69 6e 73 74 65 61 64 2e 0a 20 file instead..
09a0: 20 20 20 20 2a 20 20 49 66 20 74 68 61 74 20 66 * If that f
09b0: 61 69 6c 73 2c 20 74 68 69 73 20 63 6f 64 65 20 ails, this code
09c0: 77 69 6c 6c 20 74 68 72 6f 77 20 61 6e 20 65 72 will throw an er
09d0: 72 6f 72 2c 20 75 73 69 6e 67 20 61 20 6d 65 73 ror, using a mes
09e0: 73 61 67 65 20 62 6f 78 2e 0a 20 20 20 20 20 2a sage box.. *
09f0: 2f 0a 0a 73 74 61 74 69 63 20 63 68 61 72 20 2a /..static char *
0a00: 70 72 65 49 6e 69 74 43 6d 64 20 3d 20 0a 23 69 preInitCmd = .#i
0a10: 66 64 65 66 20 5f 57 49 4e 33 32 5f 57 43 45 0a fdef _WIN32_WCE.
0a20: 2f 2a 20 73 69 6c 6c 79 20 68 61 63 6b 20 74 6f /* silly hack to
0a30: 20 67 65 74 20 77 69 6e 63 65 20 70 6f 72 74 20 get wince port
0a40: 74 6f 20 6c 61 75 6e 63 68 2c 20 73 6f 6d 65 20 to launch, some
0a50: 73 6f 72 74 20 6f 66 20 73 74 64 7b 69 6e 2c 6f sort of std{in,o
0a60: 75 74 2c 65 72 72 7d 20 70 72 6f 62 6c 65 6d 20 ut,err} problem
0a70: 2a 2f 0a 22 6f 70 65 6e 20 2f 6b 69 74 6f 75 74 */."open /kitout
0a80: 2e 74 78 74 20 61 3b 20 6f 70 65 6e 20 2f 6b 69 .txt a; open /ki
0a90: 74 6f 75 74 2e 74 78 74 20 61 3b 20 6f 70 65 6e tout.txt a; open
0aa0: 20 2f 6b 69 74 6f 75 74 2e 74 78 74 20 61 5c 6e /kitout.txt a\n
0ab0: 22 0a 2f 2a 20 74 68 69 73 20 74 6f 6f 20 73 65 "./* this too se
0ac0: 65 6d 73 20 74 6f 20 62 65 20 6e 65 65 64 65 64 ems to be needed
0ad0: 20 6f 6e 20 77 69 6e 63 65 20 2d 20 69 74 20 61 on wince - it a
0ae0: 70 70 65 61 72 73 20 74 6f 20 62 65 20 72 65 6c ppears to be rel
0af0: 61 74 65 64 20 74 6f 20 74 68 65 20 61 62 6f 76 ated to the abov
0b00: 65 20 2a 2f 0a 22 63 61 74 63 68 20 7b 72 65 6e e */."catch {ren
0b10: 61 6d 65 20 73 6f 75 72 63 65 20 3a 3a 74 63 6c ame source ::tcl
0b20: 3a 3a 73 6f 75 72 63 65 7d 5c 6e 22 0a 22 70 72 ::source}\n"."pr
0b30: 6f 63 20 73 6f 75 72 63 65 20 66 69 6c 65 20 7b oc source file {
0b40: 5c 6e 22 0a 09 22 73 65 74 20 6f 6c 64 20 5b 69 \n".."set old [i
0b50: 6e 66 6f 20 73 63 72 69 70 74 5d 5c 6e 22 0a 09 nfo script]\n"..
0b60: 22 69 6e 66 6f 20 73 63 72 69 70 74 20 24 66 69 "info script $fi
0b70: 6c 65 5c 6e 22 0a 09 22 73 65 74 20 66 69 64 20 le\n".."set fid
0b80: 5b 6f 70 65 6e 20 24 66 69 6c 65 5d 5c 6e 22 0a [open $file]\n".
0b90: 09 22 73 65 74 20 64 61 74 61 20 5b 72 65 61 64 ."set data [read
0ba0: 20 24 66 69 64 5d 5c 6e 22 0a 09 22 63 6c 6f 73 $fid]\n".."clos
0bb0: 65 20 24 66 69 64 5c 6e 22 0a 09 22 73 65 74 20 e $fid\n".."set
0bc0: 63 6f 64 65 20 5b 63 61 74 63 68 20 7b 75 70 6c code [catch {upl
0bd0: 65 76 65 6c 20 31 20 24 64 61 74 61 7d 20 72 65 evel 1 $data} re
0be0: 73 5d 5c 6e 22 0a 09 22 69 6e 66 6f 20 73 63 72 s]\n".."info scr
0bf0: 69 70 74 20 24 6f 6c 64 5c 6e 22 0a 09 22 69 66 ipt $old\n".."if
0c00: 20 7b 24 63 6f 64 65 20 3d 3d 20 32 7d 20 7b 20 {$code == 2} {
0c10: 73 65 74 20 63 6f 64 65 20 30 20 7d 5c 6e 22 0a set code 0 }\n".
0c20: 09 22 72 65 74 75 72 6e 20 2d 63 6f 64 65 20 24 ."return -code $
0c30: 63 6f 64 65 20 24 72 65 73 5c 6e 22 0a 22 7d 5c code $res\n"."}\
0c40: 6e 22 0a 23 65 6e 64 69 66 20 2f 2a 20 5f 57 49 n".#endif /* _WI
0c50: 4e 33 32 5f 57 43 45 20 2a 2f 0a 22 70 72 6f 63 N32_WCE */."proc
0c60: 20 74 63 6c 4b 69 74 49 6e 69 74 20 7b 7d 20 7b tclKitInit {} {
0c70: 5c 6e 22 0a 09 22 72 65 6e 61 6d 65 20 74 63 6c \n".."rename tcl
0c80: 4b 69 74 49 6e 69 74 20 7b 7d 5c 6e 22 0a 23 69 KitInit {}\n".#i
0c90: 66 64 65 66 20 4b 49 54 5f 49 4e 43 4c 55 44 45 fdef KIT_INCLUDE
0ca0: 53 5f 4d 4b 34 54 43 4c 0a 09 22 63 61 74 63 68 S_MK4TCL.."catch
0cb0: 20 7b 20 6c 6f 61 64 20 7b 7d 20 4d 6b 34 74 63 { load {} Mk4tc
0cc0: 6c 20 7d 5c 6e 22 0a 23 65 6e 64 69 66 0a 23 69 l }\n".#endif.#i
0cd0: 66 64 65 66 20 4b 49 54 5f 53 54 4f 52 41 47 45 fdef KIT_STORAGE
0ce0: 5f 4d 4b 34 0a 09 22 73 65 74 20 3a 3a 74 63 6c _MK4.."set ::tcl
0cf0: 4b 69 74 53 74 6f 72 61 67 65 20 5c 22 6d 6b 34 KitStorage \"mk4
0d00: 5c 22 5c 6e 22 0a 09 22 6d 6b 3a 3a 66 69 6c 65 \"\n".."mk::file
0d10: 20 6f 70 65 6e 20 65 78 65 20 5b 69 6e 66 6f 20 open exe [info
0d20: 6e 61 6d 65 6f 66 65 78 65 63 75 74 61 62 6c 65 nameofexecutable
0d30: 5d 20 2d 72 65 61 64 6f 6e 6c 79 5c 6e 22 0a 09 ] -readonly\n"..
0d40: 22 73 65 74 20 6e 20 5b 6d 6b 3a 3a 73 65 6c 65 "set n [mk::sele
0d50: 63 74 20 65 78 65 2e 64 69 72 73 21 30 2e 66 69 ct exe.dirs!0.fi
0d60: 6c 65 73 20 6e 61 6d 65 20 62 6f 6f 74 2e 74 63 les name boot.tc
0d70: 6c 5d 5c 6e 22 0a 09 22 69 66 20 7b 24 6e 20 21 l]\n".."if {$n !
0d80: 3d 20 5c 22 5c 22 7d 20 7b 5c 6e 22 0a 09 09 22 = \"\"} {\n"..."
0d90: 73 65 74 20 73 20 5b 6d 6b 3a 3a 67 65 74 20 65 set s [mk::get e
0da0: 78 65 2e 64 69 72 73 21 30 2e 66 69 6c 65 73 21 xe.dirs!0.files!
0db0: 24 6e 20 63 6f 6e 74 65 6e 74 73 5d 5c 6e 22 0a $n contents]\n".
0dc0: 09 09 22 69 66 20 7b 21 5b 73 74 72 69 6e 67 20 .."if {![string
0dd0: 6c 65 6e 67 74 68 20 24 73 5d 7d 20 7b 20 65 72 length $s]} { er
0de0: 72 6f 72 20 5c 22 65 6d 70 74 79 20 62 6f 6f 74 ror \"empty boot
0df0: 2e 74 63 6c 5c 22 20 7d 5c 6e 22 0a 09 09 22 63 .tcl\" }\n"..."c
0e00: 61 74 63 68 20 7b 6c 6f 61 64 20 7b 7d 20 7a 6c atch {load {} zl
0e10: 69 62 7d 5c 6e 22 0a 09 09 22 69 66 20 7b 5b 6d ib}\n"..."if {[m
0e20: 6b 3a 3a 67 65 74 20 65 78 65 2e 64 69 72 73 21 k::get exe.dirs!
0e30: 30 2e 66 69 6c 65 73 21 24 6e 20 73 69 7a 65 5d 0.files!$n size]
0e40: 20 21 3d 20 5b 73 74 72 69 6e 67 20 6c 65 6e 67 != [string leng
0e50: 74 68 20 24 73 5d 7d 20 7b 5c 6e 22 0a 09 09 09 th $s]} {\n"....
0e60: 22 73 65 74 20 73 20 5b 7a 6c 69 62 20 64 65 63 "set s [zlib dec
0e70: 6f 6d 70 72 65 73 73 20 24 73 5d 5c 6e 22 0a 09 ompress $s]\n"..
0e80: 09 22 7d 5c 6e 22 0a 09 22 7d 5c 6e 22 0a 23 65 ."}\n".."}\n".#e
0e90: 6e 64 69 66 20 2f 2a 20 4b 49 54 5f 53 54 4f 52 ndif /* KIT_STOR
0ea0: 41 47 45 5f 4d 4b 34 20 2a 2f 0a 23 69 66 64 65 AGE_MK4 */.#ifde
0eb0: 66 20 4b 49 54 5f 53 54 4f 52 41 47 45 5f 5a 49 f KIT_STORAGE_ZI
0ec0: 50 0a 09 22 73 65 74 20 3a 3a 74 63 6c 4b 69 74 P.."set ::tclKit
0ed0: 53 74 6f 72 61 67 65 20 5c 22 7a 69 70 5c 22 5c Storage \"zip\"\
0ee0: 6e 22 0a 09 22 63 61 74 63 68 20 7b 20 6c 6f 61 n".."catch { loa
0ef0: 64 20 7b 7d 20 76 66 73 20 7d 5c 6e 22 0a 09 22 d {} vfs }\n".."
0f00: 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 if {![info exist
0f10: 73 20 73 5d 7d 20 7b 5c 6e 22 0a 09 09 22 63 61 s s]} {\n"..."ca
0f20: 74 63 68 20 7b 5c 6e 22 0a 09 09 09 22 73 65 74 tch {\n"...."set
0f30: 20 62 6f 6f 74 66 69 6c 65 20 5b 66 69 6c 65 20 bootfile [file
0f40: 6a 6f 69 6e 20 5b 69 6e 66 6f 20 6e 61 6d 65 6f join [info nameo
0f50: 66 65 78 65 63 75 74 61 62 6c 65 5d 20 62 6f 6f fexecutable] boo
0f60: 74 2e 74 63 6c 5d 5c 6e 22 0a 09 09 09 22 69 66 t.tcl]\n"...."if
0f70: 20 7b 5b 66 69 6c 65 20 65 78 69 73 74 73 20 24 {[file exists $
0f80: 62 6f 6f 74 66 69 6c 65 5d 7d 20 7b 5c 6e 22 0a bootfile]} {\n".
0f90: 09 09 09 09 22 73 65 74 20 66 20 5b 6f 70 65 6e ...."set f [open
0fa0: 20 24 62 6f 6f 74 66 69 6c 65 5d 5c 6e 22 0a 09 $bootfile]\n"..
0fb0: 09 09 09 22 73 65 74 20 73 20 5b 72 65 61 64 20 ..."set s [read
0fc0: 24 66 5d 5c 6e 22 0a 09 09 09 09 22 63 6c 6f 73 $f]\n"....."clos
0fd0: 65 20 24 66 5c 6e 22 0a 09 09 09 22 7d 5c 6e 22 e $f\n"...."}\n"
0fe0: 0a 09 09 22 7d 5c 6e 22 0a 09 22 7d 5c 6e 22 0a ..."}\n".."}\n".
0ff0: 09 22 69 66 20 7b 21 5b 69 6e 66 6f 20 65 78 69 ."if {![info exi
1000: 73 74 73 20 73 5d 7d 20 7b 5c 6e 22 0a 23 20 20 sts s]} {\n".#
1010: 69 6e 63 6c 75 64 65 20 22 7a 69 70 76 66 73 2e include "zipvfs.
1020: 74 63 6c 2e 68 22 0a 09 09 22 63 61 74 63 68 20 tcl.h"..."catch
1030: 7b 5c 6e 22 0a 09 09 09 22 73 65 74 20 3a 3a 74 {\n"...."set ::t
1040: 63 6c 4b 69 74 53 74 6f 72 61 67 65 5f 66 64 20 clKitStorage_fd
1050: 5b 3a 3a 7a 69 70 3a 3a 6f 70 65 6e 20 5b 69 6e [::zip::open [in
1060: 66 6f 20 6e 61 6d 65 6f 66 65 78 65 63 75 74 61 fo nameofexecuta
1070: 62 6c 65 5d 5d 5c 6e 22 0a 09 09 09 22 3a 3a 7a ble]]\n"...."::z
1080: 69 70 3a 3a 73 74 61 74 20 24 3a 3a 74 63 6c 4b ip::stat $::tclK
1090: 69 74 53 74 6f 72 61 67 65 5f 66 64 20 62 6f 6f itStorage_fd boo
10a0: 74 2e 74 63 6c 20 73 62 5c 6e 22 0a 09 09 09 22 t.tcl sb\n"...."
10b0: 73 65 65 6b 20 24 3a 3a 74 63 6c 4b 69 74 53 74 seek $::tclKitSt
10c0: 6f 72 61 67 65 5f 66 64 20 24 73 62 28 69 6e 6f orage_fd $sb(ino
10d0: 29 5c 6e 22 0a 09 09 09 22 7a 69 70 3a 3a 44 61 )\n"...."zip::Da
10e0: 74 61 20 24 3a 3a 74 63 6c 4b 69 74 53 74 6f 72 ta $::tclKitStor
10f0: 61 67 65 5f 66 64 20 73 62 20 73 5c 6e 22 0a 09 age_fd sb s\n"..
1100: 09 22 7d 5c 6e 22 0a 09 22 7d 5c 6e 22 0a 23 65 ."}\n".."}\n".#e
1110: 6e 64 69 66 20 2f 2a 20 4b 49 54 5f 53 54 4f 52 ndif /* KIT_STOR
1120: 41 47 45 5f 5a 49 50 20 2a 2f 0a 09 22 69 66 20 AGE_ZIP */.."if
1130: 7b 21 5b 69 6e 66 6f 20 65 78 69 73 74 73 20 73 {![info exists s
1140: 5d 7d 20 7b 5c 6e 22 0a 09 09 22 73 65 74 20 66 ]} {\n"..."set f
1150: 20 5b 6f 70 65 6e 20 73 65 74 75 70 2e 74 63 6c [open setup.tcl
1160: 5d 5c 6e 22 0a 09 09 22 73 65 74 20 73 20 5b 72 ]\n"..."set s [r
1170: 65 61 64 20 24 66 5d 5c 6e 22 0a 09 09 22 63 6c ead $f]\n"..."cl
1180: 6f 73 65 20 24 66 5c 6e 22 0a 09 22 7d 5c 6e 22 ose $f\n".."}\n"
1190: 0a 09 22 75 70 6c 65 76 65 6c 20 23 30 20 24 73 .."uplevel #0 $s
11a0: 5c 6e 22 0a 23 69 66 20 64 65 66 69 6e 65 64 28 \n".#if defined(
11b0: 4b 49 54 5f 49 4e 43 4c 55 44 45 53 5f 54 4b 29 KIT_INCLUDES_TK)
11c0: 20 26 26 20 64 65 66 69 6e 65 64 28 4b 49 54 5f && defined(KIT_
11d0: 54 4b 5f 56 45 52 53 49 4f 4e 29 0a 09 22 70 61 TK_VERSION).."pa
11e0: 63 6b 61 67 65 20 69 66 6e 65 65 64 65 64 20 54 ckage ifneeded T
11f0: 6b 20 22 20 4b 49 54 5f 54 4b 5f 56 45 52 53 49 k " KIT_TK_VERSI
1200: 4f 4e 20 22 20 7b 5c 6e 22 0a 09 09 22 6c 6f 61 ON " {\n"..."loa
1210: 64 20 7b 7d 20 54 6b 5c 6e 22 0a 09 22 7d 5c 6e d {} Tk\n".."}\n
1220: 22 0a 23 65 6e 64 69 66 0a 23 69 66 64 65 66 20 ".#endif.#ifdef
1230: 5f 57 49 4e 33 32 0a 09 22 63 61 74 63 68 20 7b _WIN32.."catch {
1240: 6c 6f 61 64 20 7b 7d 20 64 64 65 7d 5c 6e 22 0a load {} dde}\n".
1250: 09 22 63 61 74 63 68 20 7b 6c 6f 61 64 20 7b 7d ."catch {load {}
1260: 20 72 65 67 69 73 74 72 79 7d 5c 6e 22 0a 23 65 registry}\n".#e
1270: 6e 64 69 66 20 2f 2a 20 5f 57 49 4e 33 32 20 2a ndif /* _WIN32 *
1280: 2f 0a 09 22 72 65 74 75 72 6e 20 30 5c 6e 22 0a /.."return 0\n".
1290: 22 7d 5c 6e 22 0a 22 74 63 6c 4b 69 74 49 6e 69 "}\n"."tclKitIni
12a0: 74 22 3b 0a 0a 73 74 61 74 69 63 20 63 6f 6e 73 t";..static cons
12b0: 74 20 63 68 61 72 20 69 6e 69 74 53 63 72 69 70 t char initScrip
12c0: 74 5b 5d 20 3d 0a 22 69 66 20 7b 5b 66 69 6c 65 t[] =."if {[file
12d0: 20 69 73 66 69 6c 65 20 5b 66 69 6c 65 20 6a 6f isfile [file jo
12e0: 69 6e 20 5b 69 6e 66 6f 20 6e 61 6d 65 6f 66 65 in [info nameofe
12f0: 78 65 5d 20 6d 61 69 6e 2e 74 63 6c 5d 5d 7d 20 xe] main.tcl]]}
1300: 7b 5c 6e 22 0a 09 22 69 66 20 7b 5b 69 6e 66 6f {\n".."if {[info
1310: 20 63 6f 6d 6d 61 6e 64 73 20 63 6f 6e 73 6f 6c commands consol
1320: 65 5d 20 21 3d 20 7b 7d 7d 20 7b 20 63 6f 6e 73 e] != {}} { cons
1330: 6f 6c 65 20 68 69 64 65 20 7d 5c 6e 22 0a 09 22 ole hide }\n".."
1340: 73 65 74 20 74 63 6c 5f 69 6e 74 65 72 61 63 74 set tcl_interact
1350: 69 76 65 20 30 5c 6e 22 0a 09 22 69 6e 63 72 20 ive 0\n".."incr
1360: 61 72 67 63 5c 6e 22 0a 09 22 73 65 74 20 61 72 argc\n".."set ar
1370: 67 76 20 5b 6c 69 6e 73 65 72 74 20 24 61 72 67 gv [linsert $arg
1380: 76 20 30 20 24 61 72 67 76 30 5d 5c 6e 22 0a 09 v 0 $argv0]\n"..
1390: 22 73 65 74 20 61 72 67 76 30 20 5b 66 69 6c 65 "set argv0 [file
13a0: 20 6a 6f 69 6e 20 5b 69 6e 66 6f 20 6e 61 6d 65 join [info name
13b0: 6f 66 65 78 65 5d 20 6d 61 69 6e 2e 74 63 6c 5d ofexe] main.tcl]
13c0: 5c 6e 22 0a 22 7d 20 65 6c 73 65 20 63 6f 6e 74 \n"."} else cont
13d0: 69 6e 75 65 5c 6e 22 3b 0a 0a 2f 2a 20 53 65 74 inue\n";../* Set
13e0: 45 78 65 63 4e 61 6d 65 20 2d 2d 0a 0a 20 20 20 ExecName --..
13f0: 48 61 63 6b 20 74 6f 20 67 65 74 20 61 72 6f 75 Hack to get arou
1400: 6e 64 20 54 63 6c 20 62 75 67 20 31 32 32 34 38 nd Tcl bug 12248
1410: 38 38 2e 0a 2a 2f 0a 73 74 61 74 69 63 20 76 6f 88..*/.static vo
1420: 69 64 20 53 65 74 45 78 65 63 4e 61 6d 65 28 54 id SetExecName(T
1430: 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 cl_Interp *inter
1440: 70 2c 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 70 p, const char *p
1450: 61 74 68 29 20 7b 0a 23 69 66 64 65 66 20 54 43 ath) {.#ifdef TC
1460: 4c 4b 49 54 5f 52 45 51 55 49 52 45 5f 54 43 4c LKIT_REQUIRE_TCL
1470: 45 58 45 43 55 54 41 42 4c 45 4e 41 4d 45 0a 09 EXECUTABLENAME..
1480: 74 63 6c 45 78 65 63 75 74 61 62 6c 65 4e 61 6d tclExecutableNam
1490: 65 20 3d 20 73 74 72 64 75 70 28 70 61 74 68 29 e = strdup(path)
14a0: 3b 0a 23 65 6e 64 69 66 0a 09 54 63 6c 5f 46 69 ;.#endif..Tcl_Fi
14b0: 6e 64 45 78 65 63 75 74 61 62 6c 65 28 70 61 74 ndExecutable(pat
14c0: 68 29 3b 0a 0a 09 72 65 74 75 72 6e 3b 0a 7d 0a h);...return;.}.
14d0: 0a 73 74 61 74 69 63 20 76 6f 69 64 20 46 69 6e .static void Fin
14e0: 64 41 6e 64 53 65 74 45 78 65 63 4e 61 6d 65 28 dAndSetExecName(
14f0: 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 Tcl_Interp *inte
1500: 72 70 29 20 7b 0a 09 69 6e 74 20 6c 65 6e 20 3d rp) {..int len =
1510: 20 30 3b 0a 09 54 63 6c 5f 4f 62 6a 20 2a 65 78 0;..Tcl_Obj *ex
1520: 65 63 4e 61 6d 65 4f 62 6a 3b 0a 09 54 63 6c 5f ecNameObj;..Tcl_
1530: 4f 62 6a 20 2a 6c 6f 62 6a 76 5b 31 5d 3b 0a 23 Obj *lobjv[1];.#
1540: 69 66 64 65 66 20 48 41 56 45 5f 52 45 41 44 4c ifdef HAVE_READL
1550: 49 4e 4b 0a 09 73 73 69 7a 65 5f 74 20 72 65 61 INK..ssize_t rea
1560: 64 6c 69 6e 6b 5f 72 65 74 3b 0a 09 63 68 61 72 dlink_ret;..char
1570: 20 65 78 65 5f 62 75 66 5b 34 30 39 36 5d 3b 0a exe_buf[4096];.
1580: 23 65 6e 64 69 66 20 2f 2a 20 48 41 56 45 5f 52 #endif /* HAVE_R
1590: 45 41 44 4c 49 4e 4b 20 2a 2f 0a 23 69 66 64 65 EADLINK */.#ifde
15a0: 66 20 48 41 56 45 5f 41 43 43 45 50 54 41 42 4c f HAVE_ACCEPTABL
15b0: 45 5f 44 4c 41 44 44 52 0a 09 44 6c 5f 69 6e 66 E_DLADDR..Dl_inf
15c0: 6f 20 73 79 6d 69 6e 66 6f 3b 0a 09 69 6e 74 20 o syminfo;..int
15d0: 64 6c 61 64 64 72 5f 72 65 74 3b 0a 23 65 6e 64 dladdr_ret;.#end
15e0: 69 66 20 2f 2a 20 48 41 56 45 5f 41 43 43 45 50 if /* HAVE_ACCEP
15f0: 54 41 42 4c 45 5f 44 4c 41 44 44 52 20 2a 2f 20 TABLE_DLADDR */
1600: 0a 0a 23 69 66 64 65 66 20 48 41 56 45 5f 52 45 ..#ifdef HAVE_RE
1610: 41 44 4c 49 4e 4b 0a 09 69 66 20 28 54 63 6c 5f ADLINK..if (Tcl_
1620: 47 65 74 4e 61 6d 65 4f 66 45 78 65 63 75 74 61 GetNameOfExecuta
1630: 62 6c 65 28 29 20 3d 3d 20 4e 55 4c 4c 29 20 7b ble() == NULL) {
1640: 0a 09 09 72 65 61 64 6c 69 6e 6b 5f 72 65 74 20 ...readlink_ret
1650: 3d 20 72 65 61 64 6c 69 6e 6b 28 22 2f 70 72 6f = readlink("/pro
1660: 63 2f 73 65 6c 66 2f 65 78 65 22 2c 20 65 78 65 c/self/exe", exe
1670: 5f 62 75 66 2c 20 73 69 7a 65 6f 66 28 65 78 65 _buf, sizeof(exe
1680: 5f 62 75 66 29 20 2d 20 31 29 3b 0a 0a 09 09 69 _buf) - 1);....i
1690: 66 20 28 72 65 61 64 6c 69 6e 6b 5f 72 65 74 20 f (readlink_ret
16a0: 3e 20 30 20 26 26 20 72 65 61 64 6c 69 6e 6b 5f > 0 && readlink_
16b0: 72 65 74 20 3c 20 28 73 69 7a 65 6f 66 28 65 78 ret < (sizeof(ex
16c0: 65 5f 62 75 66 29 20 2d 20 31 29 29 20 7b 0a 09 e_buf) - 1)) {..
16d0: 09 09 65 78 65 5f 62 75 66 5b 72 65 61 64 6c 69 ..exe_buf[readli
16e0: 6e 6b 5f 72 65 74 5d 20 3d 20 27 5c 30 27 3b 0a nk_ret] = '\0';.
16f0: 0a 09 09 09 53 65 74 45 78 65 63 4e 61 6d 65 28 ....SetExecName(
1700: 69 6e 74 65 72 70 2c 20 65 78 65 5f 62 75 66 29 interp, exe_buf)
1710: 3b 0a 0a 09 09 09 72 65 74 75 72 6e 3b 0a 09 09 ;.....return;...
1720: 7d 0a 09 7d 0a 0a 09 69 66 20 28 54 63 6c 5f 47 }..}...if (Tcl_G
1730: 65 74 4e 61 6d 65 4f 66 45 78 65 63 75 74 61 62 etNameOfExecutab
1740: 6c 65 28 29 20 3d 3d 20 4e 55 4c 4c 29 20 7b 0a le() == NULL) {.
1750: 09 09 72 65 61 64 6c 69 6e 6b 5f 72 65 74 20 3d ..readlink_ret =
1760: 20 72 65 61 64 6c 69 6e 6b 28 22 2f 70 72 6f 63 readlink("/proc
1770: 2f 63 75 72 70 72 6f 63 2f 66 69 6c 65 22 2c 20 /curproc/file",
1780: 65 78 65 5f 62 75 66 2c 20 73 69 7a 65 6f 66 28 exe_buf, sizeof(
1790: 65 78 65 5f 62 75 66 29 20 2d 20 31 29 3b 0a 0a exe_buf) - 1);..
17a0: 09 09 69 66 20 28 72 65 61 64 6c 69 6e 6b 5f 72 ..if (readlink_r
17b0: 65 74 20 3e 20 30 20 26 26 20 72 65 61 64 6c 69 et > 0 && readli
17c0: 6e 6b 5f 72 65 74 20 3c 20 28 73 69 7a 65 6f 66 nk_ret < (sizeof
17d0: 28 65 78 65 5f 62 75 66 29 20 2d 20 31 29 29 20 (exe_buf) - 1))
17e0: 7b 0a 09 09 09 65 78 65 5f 62 75 66 5b 72 65 61 {....exe_buf[rea
17f0: 64 6c 69 6e 6b 5f 72 65 74 5d 20 3d 20 27 5c 30 dlink_ret] = '\0
1800: 27 3b 0a 0a 09 09 09 69 66 20 28 73 74 72 63 6d ';.....if (strcm
1810: 70 28 65 78 65 5f 62 75 66 2c 20 22 75 6e 6b 6e p(exe_buf, "unkn
1820: 6f 77 6e 22 29 20 21 3d 20 30 29 20 7b 0a 09 09 own") != 0) {...
1830: 09 09 53 65 74 45 78 65 63 4e 61 6d 65 28 69 6e ..SetExecName(in
1840: 74 65 72 70 2c 20 65 78 65 5f 62 75 66 29 3b 0a terp, exe_buf);.
1850: 0a 09 09 09 09 72 65 74 75 72 6e 3b 0a 09 09 09 .....return;....
1860: 7d 0a 09 09 7d 0a 09 7d 0a 23 65 6e 64 69 66 20 }...}..}.#endif
1870: 2f 2a 20 48 41 56 45 5f 52 45 41 44 4c 49 4e 4b /* HAVE_READLINK
1880: 20 2a 2f 0a 0a 23 69 66 64 65 66 20 48 41 56 45 */..#ifdef HAVE
1890: 5f 41 43 43 45 50 54 41 42 4c 45 5f 44 4c 41 44 _ACCEPTABLE_DLAD
18a0: 44 52 0a 09 69 66 20 28 54 63 6c 5f 47 65 74 4e DR..if (Tcl_GetN
18b0: 61 6d 65 4f 66 45 78 65 63 75 74 61 62 6c 65 28 ameOfExecutable(
18c0: 29 20 3d 3d 20 4e 55 4c 4c 29 20 7b 0a 09 09 64 ) == NULL) {...d
18d0: 6c 61 64 64 72 5f 72 65 74 20 3d 20 64 6c 61 64 laddr_ret = dlad
18e0: 64 72 28 26 53 65 74 45 78 65 63 4e 61 6d 65 2c dr(&SetExecName,
18f0: 20 26 73 79 6d 69 6e 66 6f 29 3b 0a 09 09 69 66 &syminfo);...if
1900: 20 28 64 6c 61 64 64 72 5f 72 65 74 20 21 3d 20 (dladdr_ret !=
1910: 30 29 20 7b 0a 09 09 09 53 65 74 45 78 65 63 4e 0) {....SetExecN
1920: 61 6d 65 28 69 6e 74 65 72 70 2c 20 73 79 6d 69 ame(interp, symi
1930: 6e 66 6f 2e 64 6c 69 5f 66 6e 61 6d 65 29 3b 0a nfo.dli_fname);.
1940: 09 09 7d 0a 09 7d 0a 23 65 6e 64 69 66 20 2f 2a ..}..}.#endif /*
1950: 20 48 41 56 45 5f 41 43 43 45 50 54 41 42 4c 45 HAVE_ACCEPTABLE
1960: 5f 44 4c 41 44 44 52 20 2a 2f 0a 0a 09 69 66 20 _DLADDR */...if
1970: 28 54 63 6c 5f 47 65 74 4e 61 6d 65 4f 66 45 78 (Tcl_GetNameOfEx
1980: 65 63 75 74 61 62 6c 65 28 29 20 3d 3d 20 4e 55 ecutable() == NU
1990: 4c 4c 29 20 7b 0a 09 09 6c 6f 62 6a 76 5b 30 5d LL) {...lobjv[0]
19a0: 20 3d 20 54 63 6c 5f 47 65 74 56 61 72 32 45 78 = Tcl_GetVar2Ex
19b0: 28 69 6e 74 65 72 70 2c 20 22 61 72 67 76 30 22 (interp, "argv0"
19c0: 2c 20 4e 55 4c 4c 2c 20 54 43 4c 5f 47 4c 4f 42 , NULL, TCL_GLOB
19d0: 41 4c 5f 4f 4e 4c 59 29 3b 0a 09 09 65 78 65 63 AL_ONLY);...exec
19e0: 4e 61 6d 65 4f 62 6a 20 3d 20 54 63 6c 5f 46 53 NameObj = Tcl_FS
19f0: 4a 6f 69 6e 54 6f 50 61 74 68 28 54 63 6c 5f 46 JoinToPath(Tcl_F
1a00: 53 47 65 74 43 77 64 28 69 6e 74 65 72 70 29 2c SGetCwd(interp),
1a10: 20 31 2c 20 6c 6f 62 6a 76 29 3b 0a 0a 09 09 53 1, lobjv);....S
1a20: 65 74 45 78 65 63 4e 61 6d 65 28 69 6e 74 65 72 etExecName(inter
1a30: 70 2c 20 54 63 6c 5f 47 65 74 53 74 72 69 6e 67 p, Tcl_GetString
1a40: 46 72 6f 6d 4f 62 6a 28 65 78 65 63 4e 61 6d 65 FromObj(execName
1a50: 4f 62 6a 2c 20 26 6c 65 6e 29 29 3b 0a 0a 09 09 Obj, &len));....
1a60: 72 65 74 75 72 6e 3b 0a 09 7d 0a 0a 09 72 65 74 return;..}...ret
1a70: 75 72 6e 3b 0a 7d 0a 0a 69 6e 74 20 54 63 6c 4b urn;.}..int TclK
1a80: 69 74 5f 41 70 70 49 6e 69 74 28 54 63 6c 5f 49 it_AppInit(Tcl_I
1a90: 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 29 20 7b nterp *interp) {
1aa0: 0a 23 69 66 64 65 66 20 4b 49 54 5f 49 4e 43 4c .#ifdef KIT_INCL
1ab0: 55 44 45 53 5f 54 4b 0a 23 20 20 69 66 64 65 66 UDES_TK.# ifdef
1ac0: 20 5f 57 49 4e 33 32 0a 23 20 20 20 20 69 66 6e _WIN32.# ifn
1ad0: 64 65 66 20 5f 57 49 4e 33 32 5f 57 43 45 0a 09 def _WIN32_WCE..
1ae0: 63 68 61 72 20 6d 73 67 42 75 66 5b 32 30 34 39 char msgBuf[2049
1af0: 5d 3b 0a 23 20 20 20 20 65 6e 64 69 66 20 2f 2a ];.# endif /*
1b00: 20 21 5f 57 49 4e 33 32 5f 57 43 45 20 2a 2f 0a !_WIN32_WCE */.
1b10: 23 20 20 65 6e 64 69 66 20 2f 2a 20 5f 57 49 4e # endif /* _WIN
1b20: 33 32 20 2a 2f 0a 23 65 6e 64 69 66 20 2f 2a 20 32 */.#endif /*
1b30: 4b 49 54 5f 49 4e 43 4c 55 44 45 53 5f 54 4b 20 KIT_INCLUDES_TK
1b40: 2a 2f 0a 23 69 66 64 65 66 20 54 43 4c 4b 49 54 */.#ifdef TCLKIT
1b50: 5f 43 41 4e 5f 53 45 54 5f 45 4e 43 4f 44 49 4e _CAN_SET_ENCODIN
1b60: 47 0a 09 54 63 6c 5f 44 53 74 72 69 6e 67 20 65 G..Tcl_DString e
1b70: 6e 63 6f 64 69 6e 67 4e 61 6d 65 3b 0a 23 65 6e ncodingName;.#en
1b80: 64 69 66 20 2f 2a 20 54 43 4c 4b 49 54 5f 43 41 dif /* TCLKIT_CA
1b90: 4e 5f 53 45 54 5f 45 4e 43 4f 44 49 4e 47 20 2a N_SET_ENCODING *
1ba0: 2f 0a 0a 23 69 66 64 65 66 20 4b 49 54 5f 49 4e /..#ifdef KIT_IN
1bb0: 43 4c 55 44 45 53 5f 49 54 43 4c 0a 09 54 63 6c CLUDES_ITCL..Tcl
1bc0: 5f 53 74 61 74 69 63 50 61 63 6b 61 67 65 28 30 _StaticPackage(0
1bd0: 2c 20 22 49 74 63 6c 22 2c 20 49 74 63 6c 5f 49 , "Itcl", Itcl_I
1be0: 6e 69 74 2c 20 4e 55 4c 4c 29 3b 0a 23 65 6e 64 nit, NULL);.#end
1bf0: 69 66 20 0a 23 69 66 64 65 66 20 4b 49 54 5f 49 if .#ifdef KIT_I
1c00: 4e 43 4c 55 44 45 53 5f 4d 4b 34 54 43 4c 0a 09 NCLUDES_MK4TCL..
1c10: 54 63 6c 5f 53 74 61 74 69 63 50 61 63 6b 61 67 Tcl_StaticPackag
1c20: 65 28 30 2c 20 22 4d 6b 34 74 63 6c 22 2c 20 4d e(0, "Mk4tcl", M
1c30: 6b 34 74 63 6c 5f 49 6e 69 74 2c 20 4e 55 4c 4c k4tcl_Init, NULL
1c40: 29 3b 0a 23 65 6e 64 69 66 0a 23 69 66 64 65 66 );.#endif.#ifdef
1c50: 20 4b 49 54 5f 49 4e 43 4c 55 44 45 53 5f 50 57 KIT_INCLUDES_PW
1c60: 42 0a 09 54 63 6c 5f 53 74 61 74 69 63 50 61 63 B..Tcl_StaticPac
1c70: 6b 61 67 65 28 30 2c 20 22 70 77 62 22 2c 20 50 kage(0, "pwb", P
1c80: 77 62 5f 49 6e 69 74 2c 20 4e 55 4c 4c 29 3b 0a wb_Init, NULL);.
1c90: 23 65 6e 64 69 66 20 0a 09 54 63 6c 5f 53 74 61 #endif ..Tcl_Sta
1ca0: 74 69 63 50 61 63 6b 61 67 65 28 30 2c 20 22 72 ticPackage(0, "r
1cb0: 65 63 68 61 6e 22 2c 20 52 65 63 68 61 6e 5f 49 echan", Rechan_I
1cc0: 6e 69 74 2c 20 4e 55 4c 4c 29 3b 0a 09 54 63 6c nit, NULL);..Tcl
1cd0: 5f 53 74 61 74 69 63 50 61 63 6b 61 67 65 28 30 _StaticPackage(0
1ce0: 2c 20 22 76 66 73 22 2c 20 56 66 73 5f 49 6e 69 , "vfs", Vfs_Ini
1cf0: 74 2c 20 4e 55 4c 4c 29 3b 0a 23 69 66 64 65 66 t, NULL);.#ifdef
1d00: 20 4b 49 54 5f 49 4e 43 4c 55 44 45 53 5f 5a 4c KIT_INCLUDES_ZL
1d10: 49 42 0a 09 54 63 6c 5f 53 74 61 74 69 63 50 61 IB..Tcl_StaticPa
1d20: 63 6b 61 67 65 28 30 2c 20 22 7a 6c 69 62 22 2c ckage(0, "zlib",
1d30: 20 5a 6c 69 62 5f 49 6e 69 74 2c 20 4e 55 4c 4c Zlib_Init, NULL
1d40: 29 3b 0a 23 65 6e 64 69 66 0a 23 69 66 64 65 66 );.#endif.#ifdef
1d50: 20 54 43 4c 5f 54 48 52 45 41 44 53 0a 09 54 63 TCL_THREADS..Tc
1d60: 6c 5f 53 74 61 74 69 63 50 61 63 6b 61 67 65 28 l_StaticPackage(
1d70: 30 2c 20 22 54 68 72 65 61 64 22 2c 20 54 68 72 0, "Thread", Thr
1d80: 65 61 64 5f 49 6e 69 74 2c 20 4e 55 4c 4c 29 3b ead_Init, NULL);
1d90: 0a 23 65 6e 64 69 66 0a 23 69 66 64 65 66 20 5f .#endif.#ifdef _
1da0: 57 49 4e 33 32 0a 09 54 63 6c 5f 53 74 61 74 69 WIN32..Tcl_Stati
1db0: 63 50 61 63 6b 61 67 65 28 30 2c 20 22 64 64 65 cPackage(0, "dde
1dc0: 22 2c 20 44 64 65 5f 49 6e 69 74 2c 20 4e 55 4c ", Dde_Init, NUL
1dd0: 4c 29 3b 0a 09 54 63 6c 5f 53 74 61 74 69 63 50 L);..Tcl_StaticP
1de0: 61 63 6b 61 67 65 28 30 2c 20 22 72 65 67 69 73 ackage(0, "regis
1df0: 74 72 79 22 2c 20 52 65 67 69 73 74 72 79 5f 49 try", Registry_I
1e00: 6e 69 74 2c 20 4e 55 4c 4c 29 3b 0a 23 65 6e 64 nit, NULL);.#end
1e10: 69 66 0a 23 69 66 64 65 66 20 4b 49 54 5f 49 4e if.#ifdef KIT_IN
1e20: 43 4c 55 44 45 53 5f 54 4b 0a 09 54 63 6c 5f 53 CLUDES_TK..Tcl_S
1e30: 74 61 74 69 63 50 61 63 6b 61 67 65 28 30 2c 20 taticPackage(0,
1e40: 22 54 6b 22 2c 20 54 6b 5f 49 6e 69 74 2c 20 54 "Tk", Tk_Init, T
1e50: 6b 5f 53 61 66 65 49 6e 69 74 29 3b 0a 23 65 6e k_SafeInit);.#en
1e60: 64 69 66 0a 0a 09 2f 2a 20 74 68 65 20 74 63 6c dif.../* the tcl
1e70: 5f 72 63 46 69 6c 65 4e 61 6d 65 20 76 61 72 69 _rcFileName vari
1e80: 61 62 6c 65 20 6f 6e 6c 79 20 65 78 69 73 74 73 able only exists
1e90: 20 69 6e 20 74 68 65 20 69 6e 69 74 69 61 6c 20 in the initial
1ea0: 69 6e 74 65 72 70 72 65 74 65 72 20 2a 2f 0a 23 interpreter */.#
1eb0: 69 66 64 65 66 20 5f 57 49 4e 33 32 0a 09 54 63 ifdef _WIN32..Tc
1ec0: 6c 5f 53 65 74 56 61 72 28 69 6e 74 65 72 70 2c l_SetVar(interp,
1ed0: 20 22 74 63 6c 5f 72 63 46 69 6c 65 4e 61 6d 65 "tcl_rcFileName
1ee0: 22 2c 20 22 7e 2f 74 63 6c 6b 69 74 72 63 2e 74 ", "~/tclkitrc.t
1ef0: 63 6c 22 2c 20 54 43 4c 5f 47 4c 4f 42 41 4c 5f cl", TCL_GLOBAL_
1f00: 4f 4e 4c 59 29 3b 0a 23 65 6c 73 65 0a 09 54 63 ONLY);.#else..Tc
1f10: 6c 5f 53 65 74 56 61 72 28 69 6e 74 65 72 70 2c l_SetVar(interp,
1f20: 20 22 74 63 6c 5f 72 63 46 69 6c 65 4e 61 6d 65 "tcl_rcFileName
1f30: 22 2c 20 22 7e 2f 2e 74 63 6c 6b 69 74 72 63 22 ", "~/.tclkitrc"
1f40: 2c 20 54 43 4c 5f 47 4c 4f 42 41 4c 5f 4f 4e 4c , TCL_GLOBAL_ONL
1f50: 59 29 3b 0a 23 65 6e 64 69 66 0a 0a 23 69 66 64 Y);.#endif..#ifd
1f60: 65 66 20 54 43 4c 4b 49 54 5f 43 41 4e 5f 53 45 ef TCLKIT_CAN_SE
1f70: 54 5f 45 4e 43 4f 44 49 4e 47 0a 09 2f 2a 20 53 T_ENCODING../* S
1f80: 65 74 20 74 68 65 20 65 6e 63 6f 64 69 6e 67 20 et the encoding
1f90: 66 72 6f 6d 20 74 68 65 20 45 6e 76 69 72 6f 6e from the Environ
1fa0: 6d 65 6e 74 20 2a 2f 0a 09 54 63 6c 5f 47 65 74 ment */..Tcl_Get
1fb0: 45 6e 63 6f 64 69 6e 67 4e 61 6d 65 46 72 6f 6d EncodingNameFrom
1fc0: 45 6e 76 69 72 6f 6e 6d 65 6e 74 28 26 65 6e 63 Environment(&enc
1fd0: 6f 64 69 6e 67 4e 61 6d 65 29 3b 0a 09 54 63 6c odingName);..Tcl
1fe0: 5f 53 65 74 53 79 73 74 65 6d 45 6e 63 6f 64 69 _SetSystemEncodi
1ff0: 6e 67 28 4e 55 4c 4c 2c 20 54 63 6c 5f 44 53 74 ng(NULL, Tcl_DSt
2000: 72 69 6e 67 56 61 6c 75 65 28 26 65 6e 63 6f 64 ringValue(&encod
2010: 69 6e 67 4e 61 6d 65 29 29 3b 0a 09 54 63 6c 5f ingName));..Tcl_
2020: 53 65 74 56 61 72 28 69 6e 74 65 72 70 2c 20 22 SetVar(interp, "
2030: 74 63 6c 6b 69 74 5f 73 79 73 74 65 6d 5f 65 6e tclkit_system_en
2040: 63 6f 64 69 6e 67 22 2c 20 54 63 6c 5f 44 53 74 coding", Tcl_DSt
2050: 72 69 6e 67 56 61 6c 75 65 28 26 65 6e 63 6f 64 ringValue(&encod
2060: 69 6e 67 4e 61 6d 65 29 2c 20 30 29 3b 0a 09 54 ingName), 0);..T
2070: 63 6c 5f 44 53 74 72 69 6e 67 46 72 65 65 28 26 cl_DStringFree(&
2080: 65 6e 63 6f 64 69 6e 67 4e 61 6d 65 29 3b 0a 23 encodingName);.#
2090: 65 6e 64 69 66 0a 0a 09 2f 2a 20 48 61 63 6b 20 endif.../* Hack
20a0: 74 6f 20 67 65 74 20 61 72 6f 75 6e 64 20 54 63 to get around Tc
20b0: 6c 20 62 75 67 20 31 32 32 34 38 38 38 2e 20 20 l bug 1224888.
20c0: 54 68 69 73 20 6d 75 73 74 20 62 65 20 72 75 6e This must be run
20d0: 20 68 65 72 65 20 61 6e 64 0a 09 20 2a 20 69 6e here and.. * in
20e0: 20 4c 69 62 72 61 72 79 50 61 74 68 4f 62 6a 43 LibraryPathObjC
20f0: 6d 64 20 62 65 63 61 75 73 65 20 74 68 69 73 20 md because this
2100: 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 69 73 20 6e information is n
2110: 65 65 64 65 64 20 62 6f 74 68 0a 09 20 2a 20 62 eeded both.. * b
2120: 65 66 6f 72 65 20 61 6e 64 20 61 66 74 65 72 20 efore and after
2130: 74 68 61 74 20 63 6f 6d 6d 61 6e 64 20 69 73 20 that command is
2140: 72 75 6e 2e 20 2a 2f 0a 09 46 69 6e 64 41 6e 64 run. */..FindAnd
2150: 53 65 74 45 78 65 63 4e 61 6d 65 28 69 6e 74 65 SetExecName(inte
2160: 72 70 29 3b 0a 0a 09 54 63 6c 53 65 74 50 72 65 rp);...TclSetPre
2170: 49 6e 69 74 53 63 72 69 70 74 28 70 72 65 49 6e InitScript(preIn
2180: 69 74 43 6d 64 29 3b 0a 09 69 66 20 28 54 63 6c itCmd);..if (Tcl
2190: 5f 49 6e 69 74 28 69 6e 74 65 72 70 29 20 3d 3d _Init(interp) ==
21a0: 20 54 43 4c 5f 45 52 52 4f 52 29 20 7b 0a 09 09 TCL_ERROR) {...
21b0: 67 6f 74 6f 20 65 72 72 6f 72 3b 0a 09 7d 0a 0a goto error;..}..
21c0: 23 69 66 64 65 66 20 4b 49 54 5f 49 4e 43 4c 55 #ifdef KIT_INCLU
21d0: 44 45 53 5f 54 4b 0a 23 20 20 69 66 64 65 66 20 DES_TK.# ifdef
21e0: 5f 57 49 4e 33 32 0a 09 69 66 20 28 54 6b 5f 49 _WIN32..if (Tk_I
21f0: 6e 69 74 28 69 6e 74 65 72 70 29 20 3d 3d 20 54 nit(interp) == T
2200: 43 4c 5f 45 52 52 4f 52 29 20 7b 0a 09 09 67 6f CL_ERROR) {...go
2210: 74 6f 20 65 72 72 6f 72 3b 0a 09 7d 0a 09 69 66 to error;..}..if
2220: 20 28 54 6b 5f 43 72 65 61 74 65 43 6f 6e 73 6f (Tk_CreateConso
2230: 6c 65 57 69 6e 64 6f 77 28 69 6e 74 65 72 70 29 leWindow(interp)
2240: 20 3d 3d 20 54 43 4c 5f 45 52 52 4f 52 29 20 7b == TCL_ERROR) {
2250: 0a 09 09 67 6f 74 6f 20 65 72 72 6f 72 3b 0a 09 ...goto error;..
2260: 7d 0a 23 20 20 65 6e 64 69 66 20 2f 2a 20 5f 57 }.# endif /* _W
2270: 49 4e 33 32 20 2a 2f 0a 23 65 6e 64 69 66 20 2f IN32 */.#endif /
2280: 2a 20 4b 49 54 5f 49 4e 43 4c 55 44 45 53 5f 54 * KIT_INCLUDES_T
2290: 4b 20 2a 2f 0a 0a 09 2f 2a 20 6d 65 73 73 79 20 K */.../* messy
22a0: 62 65 63 61 75 73 65 20 54 63 6c 53 65 74 53 74 because TclSetSt
22b0: 61 72 74 75 70 53 63 72 69 70 74 50 61 74 68 20 artupScriptPath
22c0: 69 73 20 63 61 6c 6c 65 64 20 73 6c 69 67 68 74 is called slight
22d0: 6c 79 20 74 6f 6f 20 6c 61 74 65 20 2a 2f 0a 09 ly too late */..
22e0: 69 66 20 28 54 63 6c 5f 45 76 61 6c 28 69 6e 74 if (Tcl_Eval(int
22f0: 65 72 70 2c 20 69 6e 69 74 53 63 72 69 70 74 29 erp, initScript)
2300: 20 3d 3d 20 54 43 4c 5f 4f 4b 29 20 7b 0a 09 09 == TCL_OK) {...
2310: 54 63 6c 5f 4f 62 6a 2a 20 70 61 74 68 3b 0a 23 Tcl_Obj* path;.#
2320: 69 66 64 65 66 20 48 41 56 45 5f 54 43 4c 53 45 ifdef HAVE_TCLSE
2330: 54 53 54 41 52 54 55 50 53 43 52 49 50 54 50 41 TSTARTUPSCRIPTPA
2340: 54 48 0a 09 09 70 61 74 68 20 3d 20 54 63 6c 47 TH...path = TclG
2350: 65 74 53 74 61 72 74 75 70 53 63 72 69 70 74 50 etStartupScriptP
2360: 61 74 68 28 29 3b 0a 09 09 54 63 6c 53 65 74 53 ath();...TclSetS
2370: 74 61 72 74 75 70 53 63 72 69 70 74 50 61 74 68 tartupScriptPath
2380: 28 54 63 6c 5f 47 65 74 4f 62 6a 52 65 73 75 6c (Tcl_GetObjResul
2390: 74 28 69 6e 74 65 72 70 29 29 3b 0a 23 65 6c 69 t(interp));.#eli
23a0: 66 20 64 65 66 69 6e 65 64 28 48 41 56 45 5f 54 f defined(HAVE_T
23b0: 43 4c 5f 53 45 54 53 54 41 52 54 55 50 53 43 52 CL_SETSTARTUPSCR
23c0: 49 50 54 29 0a 09 09 70 61 74 68 20 3d 20 54 63 IPT)...path = Tc
23d0: 6c 5f 47 65 74 53 74 61 72 74 75 70 53 63 72 69 l_GetStartupScri
23e0: 70 74 28 4e 55 4c 4c 29 3b 0a 09 09 54 63 6c 5f pt(NULL);...Tcl_
23f0: 53 65 74 53 74 61 72 74 75 70 53 63 72 69 70 74 SetStartupScript
2400: 28 54 63 6c 5f 47 65 74 4f 62 6a 52 65 73 75 6c (Tcl_GetObjResul
2410: 74 28 69 6e 74 65 72 70 29 2c 20 4e 55 4c 4c 29 t(interp), NULL)
2420: 3b 0a 23 65 6e 64 69 66 0a 09 09 69 66 20 28 70 ;.#endif...if (p
2430: 61 74 68 20 3d 3d 20 4e 55 4c 4c 29 20 7b 0a 09 ath == NULL) {..
2440: 09 09 54 63 6c 5f 45 76 61 6c 28 69 6e 74 65 72 ..Tcl_Eval(inter
2450: 70 2c 20 22 69 6e 63 72 20 61 72 67 63 20 2d 31 p, "incr argc -1
2460: 3b 20 73 65 74 20 61 72 67 76 20 5b 6c 72 61 6e ; set argv [lran
2470: 67 65 20 24 61 72 67 76 20 31 20 65 6e 64 5d 22 ge $argv 1 end]"
2480: 29 3b 0a 09 09 7d 0a 09 7d 0a 0a 09 54 63 6c 5f );...}..}...Tcl_
2490: 53 65 74 56 61 72 28 69 6e 74 65 72 70 2c 20 22 SetVar(interp, "
24a0: 65 72 72 6f 72 49 6e 66 6f 22 2c 20 22 22 2c 20 errorInfo", "",
24b0: 54 43 4c 5f 47 4c 4f 42 41 4c 5f 4f 4e 4c 59 29 TCL_GLOBAL_ONLY)
24c0: 3b 0a 09 54 63 6c 5f 52 65 73 65 74 52 65 73 75 ;..Tcl_ResetResu
24d0: 6c 74 28 69 6e 74 65 72 70 29 3b 0a 0a 09 72 65 lt(interp);...re
24e0: 74 75 72 6e 20 54 43 4c 5f 4f 4b 3b 0a 0a 65 72 turn TCL_OK;..er
24f0: 72 6f 72 3a 0a 23 69 66 64 65 66 20 4b 49 54 5f ror:.#ifdef KIT_
2500: 49 4e 43 4c 55 44 45 53 5f 54 4b 0a 23 20 20 69 INCLUDES_TK.# i
2510: 66 64 65 66 20 5f 57 49 4e 33 32 0a 09 4d 65 73 fdef _WIN32..Mes
2520: 73 61 67 65 42 65 65 70 28 4d 42 5f 49 43 4f 4e sageBeep(MB_ICON
2530: 45 58 43 4c 41 4d 41 54 49 4f 4e 29 3b 0a 23 20 EXCLAMATION);.#
2540: 20 20 20 69 66 6e 64 65 66 20 5f 57 49 4e 33 32 ifndef _WIN32
2550: 5f 57 43 45 0a 09 73 6e 70 72 69 6e 74 66 28 6d _WCE..snprintf(m
2560: 73 67 42 75 66 2c 20 73 69 7a 65 6f 66 28 6d 73 sgBuf, sizeof(ms
2570: 67 42 75 66 29 2c 0a 09 09 22 41 20 63 72 69 74 gBuf),..."A crit
2580: 69 63 61 6c 20 65 72 72 6f 72 20 68 61 73 20 6f ical error has o
2590: 63 63 75 72 72 65 64 2e 20 20 50 6c 65 61 73 65 ccurred. Please
25a0: 20 72 65 70 6f 72 74 20 74 68 69 73 20 74 6f 20 report this to
25b0: 74 68 65 20 54 63 6c 6b 69 74 20 76 65 6e 64 6f the Tclkit vendo
25c0: 72 2e 5c 6e 49 6e 74 65 72 70 72 65 74 65 72 20 r.\nInterpreter
25d0: 52 65 74 75 72 6e 65 64 3a 20 25 73 5c 6e 45 72 Returned: %s\nEr
25e0: 72 6f 72 20 49 6e 66 6f 3a 20 25 73 22 2c 0a 09 ror Info: %s",..
25f0: 09 54 63 6c 5f 47 65 74 53 74 72 69 6e 67 52 65 .Tcl_GetStringRe
2600: 73 75 6c 74 28 69 6e 74 65 72 70 29 2c 0a 09 09 sult(interp),...
2610: 54 63 6c 5f 47 65 74 56 61 72 28 69 6e 74 65 72 Tcl_GetVar(inter
2620: 70 2c 20 22 65 72 72 6f 72 49 6e 66 6f 22 2c 20 p, "errorInfo",
2630: 54 43 4c 5f 47 4c 4f 42 41 4c 5f 4f 4e 4c 59 29 TCL_GLOBAL_ONLY)
2640: 29 3b 0a 0a 09 4d 65 73 73 61 67 65 42 6f 78 28 );...MessageBox(
2650: 4e 55 4c 4c 2c 20 6d 73 67 42 75 66 2c 20 22 45 NULL, msgBuf, "E
2660: 72 72 6f 72 20 69 6e 20 54 63 6c 4b 69 74 22 2c rror in TclKit",
2670: 0a 09 09 4d 42 5f 49 43 4f 4e 53 54 4f 50 20 7c ...MB_ICONSTOP |
2680: 20 4d 42 5f 4f 4b 20 7c 20 4d 42 5f 54 41 53 4b MB_OK | MB_TASK
2690: 4d 4f 44 41 4c 20 7c 20 4d 42 5f 53 45 54 46 4f MODAL | MB_SETFO
26a0: 52 45 47 52 4f 55 4e 44 29 3b 0a 0a 09 45 78 69 REGROUND);...Exi
26b0: 74 50 72 6f 63 65 73 73 28 31 29 3b 0a 23 20 20 tProcess(1);.#
26c0: 20 20 65 6e 64 69 66 20 2f 2a 20 21 5f 57 49 4e endif /* !_WIN
26d0: 33 32 5f 57 43 45 20 2a 2f 0a 20 20 20 20 2f 2a 32_WCE */. /*
26e0: 20 77 65 20 77 6f 6e 27 74 20 72 65 61 63 68 20 we won't reach
26f0: 74 68 69 73 2c 20 62 75 74 20 77 65 20 6e 65 65 this, but we nee
2700: 64 20 74 68 65 20 72 65 74 75 72 6e 20 2a 2f 0a d the return */.
2710: 23 20 20 65 6e 64 69 66 20 2f 2a 20 5f 57 49 4e # endif /* _WIN
2720: 33 32 20 2a 2f 0a 23 65 6e 64 69 66 20 2f 2a 20 32 */.#endif /*
2730: 4b 49 54 5f 49 4e 43 4c 55 44 45 53 5f 54 4b 20 KIT_INCLUDES_TK
2740: 2a 2f 0a 0a 09 72 65 74 75 72 6e 20 54 43 4c 5f */...return TCL_
2750: 45 52 52 4f 52 3b 0a 7d 0a ERROR;.}.