Hex Artifact Content

Artifact 4d11547632c59a731e5bd8673288a3bf2a19cc67:


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 23 20 20 69  TK_VERSION).#  i
11e0: 66 6e 64 65 66 20 5f 57 49 4e 33 32 0a 09 22 70  fndef _WIN32.."p
11f0: 61 63 6b 61 67 65 20 69 66 6e 65 65 64 65 64 20  ackage ifneeded 
1200: 54 6b 20 22 20 4b 49 54 5f 54 4b 5f 56 45 52 53  Tk " KIT_TK_VERS
1210: 49 4f 4e 20 22 20 7b 5c 6e 22 0a 09 09 22 6c 6f  ION " {\n"..."lo
1220: 61 64 20 7b 7d 20 54 6b 5c 6e 22 0a 09 22 7d 5c  ad {} Tk\n".."}\
1230: 6e 22 0a 23 20 20 65 6e 64 69 66 0a 23 65 6e 64  n".#  endif.#end
1240: 69 66 0a 23 69 66 64 65 66 20 5f 57 49 4e 33 32  if.#ifdef _WIN32
1250: 0a 09 22 63 61 74 63 68 20 7b 6c 6f 61 64 20 7b  .."catch {load {
1260: 7d 20 64 64 65 7d 5c 6e 22 0a 09 22 63 61 74 63  } dde}\n".."catc
1270: 68 20 7b 6c 6f 61 64 20 7b 7d 20 72 65 67 69 73  h {load {} regis
1280: 74 72 79 7d 5c 6e 22 0a 23 65 6e 64 69 66 20 2f  try}\n".#endif /
1290: 2a 20 5f 57 49 4e 33 32 20 2a 2f 0a 09 22 72 65  * _WIN32 */.."re
12a0: 74 75 72 6e 20 30 5c 6e 22 0a 22 7d 5c 6e 22 0a  turn 0\n"."}\n".
12b0: 22 74 63 6c 4b 69 74 49 6e 69 74 22 3b 0a 0a 73  "tclKitInit";..s
12c0: 74 61 74 69 63 20 63 6f 6e 73 74 20 63 68 61 72  tatic const char
12d0: 20 69 6e 69 74 53 63 72 69 70 74 5b 5d 20 3d 0a   initScript[] =.
12e0: 22 69 66 20 7b 5b 66 69 6c 65 20 69 73 66 69 6c  "if {[file isfil
12f0: 65 20 5b 66 69 6c 65 20 6a 6f 69 6e 20 5b 69 6e  e [file join [in
1300: 66 6f 20 6e 61 6d 65 6f 66 65 78 65 5d 20 6d 61  fo nameofexe] ma
1310: 69 6e 2e 74 63 6c 5d 5d 7d 20 7b 5c 6e 22 0a 09  in.tcl]]} {\n"..
1320: 22 69 66 20 7b 5b 69 6e 66 6f 20 63 6f 6d 6d 61  "if {[info comma
1330: 6e 64 73 20 63 6f 6e 73 6f 6c 65 5d 20 21 3d 20  nds console] != 
1340: 7b 7d 7d 20 7b 20 63 6f 6e 73 6f 6c 65 20 68 69  {}} { console hi
1350: 64 65 20 7d 5c 6e 22 0a 09 22 73 65 74 20 74 63  de }\n".."set tc
1360: 6c 5f 69 6e 74 65 72 61 63 74 69 76 65 20 30 5c  l_interactive 0\
1370: 6e 22 0a 09 22 69 6e 63 72 20 61 72 67 63 5c 6e  n".."incr argc\n
1380: 22 0a 09 22 73 65 74 20 61 72 67 76 20 5b 6c 69  ".."set argv [li
1390: 6e 73 65 72 74 20 24 61 72 67 76 20 30 20 24 61  nsert $argv 0 $a
13a0: 72 67 76 30 5d 5c 6e 22 0a 09 22 73 65 74 20 61  rgv0]\n".."set a
13b0: 72 67 76 30 20 5b 66 69 6c 65 20 6a 6f 69 6e 20  rgv0 [file join 
13c0: 5b 69 6e 66 6f 20 6e 61 6d 65 6f 66 65 78 65 5d  [info nameofexe]
13d0: 20 6d 61 69 6e 2e 74 63 6c 5d 5c 6e 22 0a 22 7d   main.tcl]\n"."}
13e0: 20 65 6c 73 65 20 63 6f 6e 74 69 6e 75 65 5c 6e   else continue\n
13f0: 22 3b 0a 0a 2f 2a 20 53 65 74 45 78 65 63 4e 61  ";../* SetExecNa
1400: 6d 65 20 2d 2d 0a 0a 20 20 20 48 61 63 6b 20 74  me --..   Hack t
1410: 6f 20 67 65 74 20 61 72 6f 75 6e 64 20 54 63 6c  o get around Tcl
1420: 20 62 75 67 20 31 32 32 34 38 38 38 2e 0a 2a 2f   bug 1224888..*/
1430: 0a 73 74 61 74 69 63 20 76 6f 69 64 20 53 65 74  .static void Set
1440: 45 78 65 63 4e 61 6d 65 28 54 63 6c 5f 49 6e 74  ExecName(Tcl_Int
1450: 65 72 70 20 2a 69 6e 74 65 72 70 2c 20 63 6f 6e  erp *interp, con
1460: 73 74 20 63 68 61 72 20 2a 70 61 74 68 29 20 7b  st char *path) {
1470: 0a 23 69 66 64 65 66 20 54 43 4c 4b 49 54 5f 52  .#ifdef TCLKIT_R
1480: 45 51 55 49 52 45 5f 54 43 4c 45 58 45 43 55 54  EQUIRE_TCLEXECUT
1490: 41 42 4c 45 4e 41 4d 45 0a 09 74 63 6c 45 78 65  ABLENAME..tclExe
14a0: 63 75 74 61 62 6c 65 4e 61 6d 65 20 3d 20 73 74  cutableName = st
14b0: 72 64 75 70 28 70 61 74 68 29 3b 0a 23 65 6e 64  rdup(path);.#end
14c0: 69 66 0a 09 54 63 6c 5f 46 69 6e 64 45 78 65 63  if..Tcl_FindExec
14d0: 75 74 61 62 6c 65 28 70 61 74 68 29 3b 0a 0a 09  utable(path);...
14e0: 72 65 74 75 72 6e 3b 0a 7d 0a 0a 73 74 61 74 69  return;.}..stati
14f0: 63 20 76 6f 69 64 20 46 69 6e 64 41 6e 64 53 65  c void FindAndSe
1500: 74 45 78 65 63 4e 61 6d 65 28 54 63 6c 5f 49 6e  tExecName(Tcl_In
1510: 74 65 72 70 20 2a 69 6e 74 65 72 70 29 20 7b 0a  terp *interp) {.
1520: 09 69 6e 74 20 6c 65 6e 20 3d 20 30 3b 0a 09 54  .int len = 0;..T
1530: 63 6c 5f 4f 62 6a 20 2a 65 78 65 63 4e 61 6d 65  cl_Obj *execName
1540: 4f 62 6a 3b 0a 09 54 63 6c 5f 4f 62 6a 20 2a 6c  Obj;..Tcl_Obj *l
1550: 6f 62 6a 76 5b 31 5d 3b 0a 23 69 66 64 65 66 20  objv[1];.#ifdef 
1560: 48 41 56 45 5f 52 45 41 44 4c 49 4e 4b 0a 09 73  HAVE_READLINK..s
1570: 73 69 7a 65 5f 74 20 72 65 61 64 6c 69 6e 6b 5f  size_t readlink_
1580: 72 65 74 3b 0a 09 63 68 61 72 20 65 78 65 5f 62  ret;..char exe_b
1590: 75 66 5b 34 30 39 36 5d 3b 0a 23 65 6e 64 69 66  uf[4096];.#endif
15a0: 20 2f 2a 20 48 41 56 45 5f 52 45 41 44 4c 49 4e   /* HAVE_READLIN
15b0: 4b 20 2a 2f 0a 23 69 66 64 65 66 20 48 41 56 45  K */.#ifdef HAVE
15c0: 5f 41 43 43 45 50 54 41 42 4c 45 5f 44 4c 41 44  _ACCEPTABLE_DLAD
15d0: 44 52 0a 09 44 6c 5f 69 6e 66 6f 20 73 79 6d 69  DR..Dl_info symi
15e0: 6e 66 6f 3b 0a 09 69 6e 74 20 64 6c 61 64 64 72  nfo;..int dladdr
15f0: 5f 72 65 74 3b 0a 23 65 6e 64 69 66 20 2f 2a 20  _ret;.#endif /* 
1600: 48 41 56 45 5f 41 43 43 45 50 54 41 42 4c 45 5f  HAVE_ACCEPTABLE_
1610: 44 4c 41 44 44 52 20 2a 2f 20 0a 0a 23 69 66 64  DLADDR */ ..#ifd
1620: 65 66 20 48 41 56 45 5f 52 45 41 44 4c 49 4e 4b  ef HAVE_READLINK
1630: 0a 09 69 66 20 28 54 63 6c 5f 47 65 74 4e 61 6d  ..if (Tcl_GetNam
1640: 65 4f 66 45 78 65 63 75 74 61 62 6c 65 28 29 20  eOfExecutable() 
1650: 3d 3d 20 4e 55 4c 4c 29 20 7b 0a 09 09 72 65 61  == NULL) {...rea
1660: 64 6c 69 6e 6b 5f 72 65 74 20 3d 20 72 65 61 64  dlink_ret = read
1670: 6c 69 6e 6b 28 22 2f 70 72 6f 63 2f 73 65 6c 66  link("/proc/self
1680: 2f 65 78 65 22 2c 20 65 78 65 5f 62 75 66 2c 20  /exe", exe_buf, 
1690: 73 69 7a 65 6f 66 28 65 78 65 5f 62 75 66 29 20  sizeof(exe_buf) 
16a0: 2d 20 31 29 3b 0a 0a 09 09 69 66 20 28 72 65 61  - 1);....if (rea
16b0: 64 6c 69 6e 6b 5f 72 65 74 20 3e 20 30 20 26 26  dlink_ret > 0 &&
16c0: 20 72 65 61 64 6c 69 6e 6b 5f 72 65 74 20 3c 20   readlink_ret < 
16d0: 28 73 69 7a 65 6f 66 28 65 78 65 5f 62 75 66 29  (sizeof(exe_buf)
16e0: 20 2d 20 31 29 29 20 7b 0a 09 09 09 65 78 65 5f   - 1)) {....exe_
16f0: 62 75 66 5b 72 65 61 64 6c 69 6e 6b 5f 72 65 74  buf[readlink_ret
1700: 5d 20 3d 20 27 5c 30 27 3b 0a 0a 09 09 09 53 65  ] = '\0';.....Se
1710: 74 45 78 65 63 4e 61 6d 65 28 69 6e 74 65 72 70  tExecName(interp
1720: 2c 20 65 78 65 5f 62 75 66 29 3b 0a 0a 09 09 09  , exe_buf);.....
1730: 72 65 74 75 72 6e 3b 0a 09 09 7d 0a 09 7d 0a 0a  return;...}..}..
1740: 09 69 66 20 28 54 63 6c 5f 47 65 74 4e 61 6d 65  .if (Tcl_GetName
1750: 4f 66 45 78 65 63 75 74 61 62 6c 65 28 29 20 3d  OfExecutable() =
1760: 3d 20 4e 55 4c 4c 29 20 7b 0a 09 09 72 65 61 64  = NULL) {...read
1770: 6c 69 6e 6b 5f 72 65 74 20 3d 20 72 65 61 64 6c  link_ret = readl
1780: 69 6e 6b 28 22 2f 70 72 6f 63 2f 63 75 72 70 72  ink("/proc/curpr
1790: 6f 63 2f 66 69 6c 65 22 2c 20 65 78 65 5f 62 75  oc/file", exe_bu
17a0: 66 2c 20 73 69 7a 65 6f 66 28 65 78 65 5f 62 75  f, sizeof(exe_bu
17b0: 66 29 20 2d 20 31 29 3b 0a 0a 09 09 69 66 20 28  f) - 1);....if (
17c0: 72 65 61 64 6c 69 6e 6b 5f 72 65 74 20 3e 20 30  readlink_ret > 0
17d0: 20 26 26 20 72 65 61 64 6c 69 6e 6b 5f 72 65 74   && readlink_ret
17e0: 20 3c 20 28 73 69 7a 65 6f 66 28 65 78 65 5f 62   < (sizeof(exe_b
17f0: 75 66 29 20 2d 20 31 29 29 20 7b 0a 09 09 09 65  uf) - 1)) {....e
1800: 78 65 5f 62 75 66 5b 72 65 61 64 6c 69 6e 6b 5f  xe_buf[readlink_
1810: 72 65 74 5d 20 3d 20 27 5c 30 27 3b 0a 0a 09 09  ret] = '\0';....
1820: 09 69 66 20 28 73 74 72 63 6d 70 28 65 78 65 5f  .if (strcmp(exe_
1830: 62 75 66 2c 20 22 75 6e 6b 6e 6f 77 6e 22 29 20  buf, "unknown") 
1840: 21 3d 20 30 29 20 7b 0a 09 09 09 09 53 65 74 45  != 0) {.....SetE
1850: 78 65 63 4e 61 6d 65 28 69 6e 74 65 72 70 2c 20  xecName(interp, 
1860: 65 78 65 5f 62 75 66 29 3b 0a 0a 09 09 09 09 72  exe_buf);......r
1870: 65 74 75 72 6e 3b 0a 09 09 09 7d 0a 09 09 7d 0a  eturn;....}...}.
1880: 09 7d 0a 23 65 6e 64 69 66 20 2f 2a 20 48 41 56  .}.#endif /* HAV
1890: 45 5f 52 45 41 44 4c 49 4e 4b 20 2a 2f 0a 0a 23  E_READLINK */..#
18a0: 69 66 64 65 66 20 48 41 56 45 5f 41 43 43 45 50  ifdef HAVE_ACCEP
18b0: 54 41 42 4c 45 5f 44 4c 41 44 44 52 0a 09 69 66  TABLE_DLADDR..if
18c0: 20 28 54 63 6c 5f 47 65 74 4e 61 6d 65 4f 66 45   (Tcl_GetNameOfE
18d0: 78 65 63 75 74 61 62 6c 65 28 29 20 3d 3d 20 4e  xecutable() == N
18e0: 55 4c 4c 29 20 7b 0a 09 09 64 6c 61 64 64 72 5f  ULL) {...dladdr_
18f0: 72 65 74 20 3d 20 64 6c 61 64 64 72 28 26 53 65  ret = dladdr(&Se
1900: 74 45 78 65 63 4e 61 6d 65 2c 20 26 73 79 6d 69  tExecName, &symi
1910: 6e 66 6f 29 3b 0a 09 09 69 66 20 28 64 6c 61 64  nfo);...if (dlad
1920: 64 72 5f 72 65 74 20 21 3d 20 30 29 20 7b 0a 09  dr_ret != 0) {..
1930: 09 09 53 65 74 45 78 65 63 4e 61 6d 65 28 69 6e  ..SetExecName(in
1940: 74 65 72 70 2c 20 73 79 6d 69 6e 66 6f 2e 64 6c  terp, syminfo.dl
1950: 69 5f 66 6e 61 6d 65 29 3b 0a 09 09 7d 0a 09 7d  i_fname);...}..}
1960: 0a 23 65 6e 64 69 66 20 2f 2a 20 48 41 56 45 5f  .#endif /* HAVE_
1970: 41 43 43 45 50 54 41 42 4c 45 5f 44 4c 41 44 44  ACCEPTABLE_DLADD
1980: 52 20 2a 2f 0a 0a 09 69 66 20 28 54 63 6c 5f 47  R */...if (Tcl_G
1990: 65 74 4e 61 6d 65 4f 66 45 78 65 63 75 74 61 62  etNameOfExecutab
19a0: 6c 65 28 29 20 3d 3d 20 4e 55 4c 4c 29 20 7b 0a  le() == NULL) {.
19b0: 09 09 6c 6f 62 6a 76 5b 30 5d 20 3d 20 54 63 6c  ..lobjv[0] = Tcl
19c0: 5f 47 65 74 56 61 72 32 45 78 28 69 6e 74 65 72  _GetVar2Ex(inter
19d0: 70 2c 20 22 61 72 67 76 30 22 2c 20 4e 55 4c 4c  p, "argv0", NULL
19e0: 2c 20 54 43 4c 5f 47 4c 4f 42 41 4c 5f 4f 4e 4c  , TCL_GLOBAL_ONL
19f0: 59 29 3b 0a 09 09 65 78 65 63 4e 61 6d 65 4f 62  Y);...execNameOb
1a00: 6a 20 3d 20 54 63 6c 5f 46 53 4a 6f 69 6e 54 6f  j = Tcl_FSJoinTo
1a10: 50 61 74 68 28 54 63 6c 5f 46 53 47 65 74 43 77  Path(Tcl_FSGetCw
1a20: 64 28 69 6e 74 65 72 70 29 2c 20 31 2c 20 6c 6f  d(interp), 1, lo
1a30: 62 6a 76 29 3b 0a 0a 09 09 53 65 74 45 78 65 63  bjv);....SetExec
1a40: 4e 61 6d 65 28 69 6e 74 65 72 70 2c 20 54 63 6c  Name(interp, Tcl
1a50: 5f 47 65 74 53 74 72 69 6e 67 46 72 6f 6d 4f 62  _GetStringFromOb
1a60: 6a 28 65 78 65 63 4e 61 6d 65 4f 62 6a 2c 20 26  j(execNameObj, &
1a70: 6c 65 6e 29 29 3b 0a 0a 09 09 72 65 74 75 72 6e  len));....return
1a80: 3b 0a 09 7d 0a 0a 09 72 65 74 75 72 6e 3b 0a 7d  ;..}...return;.}
1a90: 0a 0a 69 6e 74 20 54 63 6c 4b 69 74 5f 41 70 70  ..int TclKit_App
1aa0: 49 6e 69 74 28 54 63 6c 5f 49 6e 74 65 72 70 20  Init(Tcl_Interp 
1ab0: 2a 69 6e 74 65 72 70 29 20 7b 0a 23 69 66 64 65  *interp) {.#ifde
1ac0: 66 20 4b 49 54 5f 49 4e 43 4c 55 44 45 53 5f 54  f KIT_INCLUDES_T
1ad0: 4b 0a 23 20 20 69 66 64 65 66 20 5f 57 49 4e 33  K.#  ifdef _WIN3
1ae0: 32 0a 23 20 20 20 20 69 66 6e 64 65 66 20 5f 57  2.#    ifndef _W
1af0: 49 4e 33 32 5f 57 43 45 0a 09 63 68 61 72 20 6d  IN32_WCE..char m
1b00: 73 67 42 75 66 5b 32 30 34 39 5d 3b 0a 23 20 20  sgBuf[2049];.#  
1b10: 20 20 65 6e 64 69 66 20 2f 2a 20 21 5f 57 49 4e    endif /* !_WIN
1b20: 33 32 5f 57 43 45 20 2a 2f 0a 23 20 20 65 6e 64  32_WCE */.#  end
1b30: 69 66 20 2f 2a 20 5f 57 49 4e 33 32 20 2a 2f 0a  if /* _WIN32 */.
1b40: 23 65 6e 64 69 66 20 2f 2a 20 4b 49 54 5f 49 4e  #endif /* KIT_IN
1b50: 43 4c 55 44 45 53 5f 54 4b 20 2a 2f 0a 23 69 66  CLUDES_TK */.#if
1b60: 64 65 66 20 54 43 4c 4b 49 54 5f 43 41 4e 5f 53  def TCLKIT_CAN_S
1b70: 45 54 5f 45 4e 43 4f 44 49 4e 47 0a 09 54 63 6c  ET_ENCODING..Tcl
1b80: 5f 44 53 74 72 69 6e 67 20 65 6e 63 6f 64 69 6e  _DString encodin
1b90: 67 4e 61 6d 65 3b 0a 23 65 6e 64 69 66 20 2f 2a  gName;.#endif /*
1ba0: 20 54 43 4c 4b 49 54 5f 43 41 4e 5f 53 45 54 5f   TCLKIT_CAN_SET_
1bb0: 45 4e 43 4f 44 49 4e 47 20 2a 2f 0a 0a 23 69 66  ENCODING */..#if
1bc0: 64 65 66 20 4b 49 54 5f 49 4e 43 4c 55 44 45 53  def KIT_INCLUDES
1bd0: 5f 49 54 43 4c 0a 09 54 63 6c 5f 53 74 61 74 69  _ITCL..Tcl_Stati
1be0: 63 50 61 63 6b 61 67 65 28 30 2c 20 22 49 74 63  cPackage(0, "Itc
1bf0: 6c 22 2c 20 49 74 63 6c 5f 49 6e 69 74 2c 20 4e  l", Itcl_Init, N
1c00: 55 4c 4c 29 3b 0a 23 65 6e 64 69 66 20 0a 23 69  ULL);.#endif .#i
1c10: 66 64 65 66 20 4b 49 54 5f 49 4e 43 4c 55 44 45  fdef KIT_INCLUDE
1c20: 53 5f 4d 4b 34 54 43 4c 0a 09 54 63 6c 5f 53 74  S_MK4TCL..Tcl_St
1c30: 61 74 69 63 50 61 63 6b 61 67 65 28 30 2c 20 22  aticPackage(0, "
1c40: 4d 6b 34 74 63 6c 22 2c 20 4d 6b 34 74 63 6c 5f  Mk4tcl", Mk4tcl_
1c50: 49 6e 69 74 2c 20 4e 55 4c 4c 29 3b 0a 23 65 6e  Init, NULL);.#en
1c60: 64 69 66 0a 23 69 66 64 65 66 20 4b 49 54 5f 49  dif.#ifdef KIT_I
1c70: 4e 43 4c 55 44 45 53 5f 50 57 42 0a 09 54 63 6c  NCLUDES_PWB..Tcl
1c80: 5f 53 74 61 74 69 63 50 61 63 6b 61 67 65 28 30  _StaticPackage(0
1c90: 2c 20 22 70 77 62 22 2c 20 50 77 62 5f 49 6e 69  , "pwb", Pwb_Ini
1ca0: 74 2c 20 4e 55 4c 4c 29 3b 0a 23 65 6e 64 69 66  t, NULL);.#endif
1cb0: 20 0a 09 54 63 6c 5f 53 74 61 74 69 63 50 61 63   ..Tcl_StaticPac
1cc0: 6b 61 67 65 28 30 2c 20 22 72 65 63 68 61 6e 22  kage(0, "rechan"
1cd0: 2c 20 52 65 63 68 61 6e 5f 49 6e 69 74 2c 20 4e  , Rechan_Init, N
1ce0: 55 4c 4c 29 3b 0a 09 54 63 6c 5f 53 74 61 74 69  ULL);..Tcl_Stati
1cf0: 63 50 61 63 6b 61 67 65 28 30 2c 20 22 76 66 73  cPackage(0, "vfs
1d00: 22 2c 20 56 66 73 5f 49 6e 69 74 2c 20 4e 55 4c  ", Vfs_Init, NUL
1d10: 4c 29 3b 0a 23 69 66 64 65 66 20 4b 49 54 5f 49  L);.#ifdef KIT_I
1d20: 4e 43 4c 55 44 45 53 5f 5a 4c 49 42 0a 09 54 63  NCLUDES_ZLIB..Tc
1d30: 6c 5f 53 74 61 74 69 63 50 61 63 6b 61 67 65 28  l_StaticPackage(
1d40: 30 2c 20 22 7a 6c 69 62 22 2c 20 5a 6c 69 62 5f  0, "zlib", Zlib_
1d50: 49 6e 69 74 2c 20 4e 55 4c 4c 29 3b 0a 23 65 6e  Init, NULL);.#en
1d60: 64 69 66 0a 23 69 66 64 65 66 20 54 43 4c 5f 54  dif.#ifdef TCL_T
1d70: 48 52 45 41 44 53 0a 09 54 63 6c 5f 53 74 61 74  HREADS..Tcl_Stat
1d80: 69 63 50 61 63 6b 61 67 65 28 30 2c 20 22 54 68  icPackage(0, "Th
1d90: 72 65 61 64 22 2c 20 54 68 72 65 61 64 5f 49 6e  read", Thread_In
1da0: 69 74 2c 20 4e 55 4c 4c 29 3b 0a 23 65 6e 64 69  it, NULL);.#endi
1db0: 66 0a 23 69 66 64 65 66 20 5f 57 49 4e 33 32 0a  f.#ifdef _WIN32.
1dc0: 09 54 63 6c 5f 53 74 61 74 69 63 50 61 63 6b 61  .Tcl_StaticPacka
1dd0: 67 65 28 30 2c 20 22 64 64 65 22 2c 20 44 64 65  ge(0, "dde", Dde
1de0: 5f 49 6e 69 74 2c 20 4e 55 4c 4c 29 3b 0a 09 54  _Init, NULL);..T
1df0: 63 6c 5f 53 74 61 74 69 63 50 61 63 6b 61 67 65  cl_StaticPackage
1e00: 28 30 2c 20 22 72 65 67 69 73 74 72 79 22 2c 20  (0, "registry", 
1e10: 52 65 67 69 73 74 72 79 5f 49 6e 69 74 2c 20 4e  Registry_Init, N
1e20: 55 4c 4c 29 3b 0a 23 65 6e 64 69 66 0a 23 69 66  ULL);.#endif.#if
1e30: 64 65 66 20 4b 49 54 5f 49 4e 43 4c 55 44 45 53  def KIT_INCLUDES
1e40: 5f 54 4b 0a 09 54 63 6c 5f 53 74 61 74 69 63 50  _TK..Tcl_StaticP
1e50: 61 63 6b 61 67 65 28 30 2c 20 22 54 6b 22 2c 20  ackage(0, "Tk", 
1e60: 54 6b 5f 49 6e 69 74 2c 20 54 6b 5f 53 61 66 65  Tk_Init, Tk_Safe
1e70: 49 6e 69 74 29 3b 0a 23 65 6e 64 69 66 0a 0a 09  Init);.#endif...
1e80: 2f 2a 20 74 68 65 20 74 63 6c 5f 72 63 46 69 6c  /* the tcl_rcFil
1e90: 65 4e 61 6d 65 20 76 61 72 69 61 62 6c 65 20 6f  eName variable o
1ea0: 6e 6c 79 20 65 78 69 73 74 73 20 69 6e 20 74 68  nly exists in th
1eb0: 65 20 69 6e 69 74 69 61 6c 20 69 6e 74 65 72 70  e initial interp
1ec0: 72 65 74 65 72 20 2a 2f 0a 23 69 66 64 65 66 20  reter */.#ifdef 
1ed0: 5f 57 49 4e 33 32 0a 09 54 63 6c 5f 53 65 74 56  _WIN32..Tcl_SetV
1ee0: 61 72 28 69 6e 74 65 72 70 2c 20 22 74 63 6c 5f  ar(interp, "tcl_
1ef0: 72 63 46 69 6c 65 4e 61 6d 65 22 2c 20 22 7e 2f  rcFileName", "~/
1f00: 74 63 6c 6b 69 74 72 63 2e 74 63 6c 22 2c 20 54  tclkitrc.tcl", T
1f10: 43 4c 5f 47 4c 4f 42 41 4c 5f 4f 4e 4c 59 29 3b  CL_GLOBAL_ONLY);
1f20: 0a 23 65 6c 73 65 0a 09 54 63 6c 5f 53 65 74 56  .#else..Tcl_SetV
1f30: 61 72 28 69 6e 74 65 72 70 2c 20 22 74 63 6c 5f  ar(interp, "tcl_
1f40: 72 63 46 69 6c 65 4e 61 6d 65 22 2c 20 22 7e 2f  rcFileName", "~/
1f50: 2e 74 63 6c 6b 69 74 72 63 22 2c 20 54 43 4c 5f  .tclkitrc", TCL_
1f60: 47 4c 4f 42 41 4c 5f 4f 4e 4c 59 29 3b 0a 23 65  GLOBAL_ONLY);.#e
1f70: 6e 64 69 66 0a 0a 23 69 66 64 65 66 20 54 43 4c  ndif..#ifdef TCL
1f80: 4b 49 54 5f 43 41 4e 5f 53 45 54 5f 45 4e 43 4f  KIT_CAN_SET_ENCO
1f90: 44 49 4e 47 0a 09 2f 2a 20 53 65 74 20 74 68 65  DING../* Set the
1fa0: 20 65 6e 63 6f 64 69 6e 67 20 66 72 6f 6d 20 74   encoding from t
1fb0: 68 65 20 45 6e 76 69 72 6f 6e 6d 65 6e 74 20 2a  he Environment *
1fc0: 2f 0a 09 54 63 6c 5f 47 65 74 45 6e 63 6f 64 69  /..Tcl_GetEncodi
1fd0: 6e 67 4e 61 6d 65 46 72 6f 6d 45 6e 76 69 72 6f  ngNameFromEnviro
1fe0: 6e 6d 65 6e 74 28 26 65 6e 63 6f 64 69 6e 67 4e  nment(&encodingN
1ff0: 61 6d 65 29 3b 0a 09 54 63 6c 5f 53 65 74 53 79  ame);..Tcl_SetSy
2000: 73 74 65 6d 45 6e 63 6f 64 69 6e 67 28 4e 55 4c  stemEncoding(NUL
2010: 4c 2c 20 54 63 6c 5f 44 53 74 72 69 6e 67 56 61  L, Tcl_DStringVa
2020: 6c 75 65 28 26 65 6e 63 6f 64 69 6e 67 4e 61 6d  lue(&encodingNam
2030: 65 29 29 3b 0a 09 54 63 6c 5f 53 65 74 56 61 72  e));..Tcl_SetVar
2040: 28 69 6e 74 65 72 70 2c 20 22 74 63 6c 6b 69 74  (interp, "tclkit
2050: 5f 73 79 73 74 65 6d 5f 65 6e 63 6f 64 69 6e 67  _system_encoding
2060: 22 2c 20 54 63 6c 5f 44 53 74 72 69 6e 67 56 61  ", Tcl_DStringVa
2070: 6c 75 65 28 26 65 6e 63 6f 64 69 6e 67 4e 61 6d  lue(&encodingNam
2080: 65 29 2c 20 30 29 3b 0a 09 54 63 6c 5f 44 53 74  e), 0);..Tcl_DSt
2090: 72 69 6e 67 46 72 65 65 28 26 65 6e 63 6f 64 69  ringFree(&encodi
20a0: 6e 67 4e 61 6d 65 29 3b 0a 23 65 6e 64 69 66 0a  ngName);.#endif.
20b0: 0a 09 2f 2a 20 48 61 63 6b 20 74 6f 20 67 65 74  ../* Hack to get
20c0: 20 61 72 6f 75 6e 64 20 54 63 6c 20 62 75 67 20   around Tcl bug 
20d0: 31 32 32 34 38 38 38 2e 20 20 54 68 69 73 20 6d  1224888.  This m
20e0: 75 73 74 20 62 65 20 72 75 6e 20 68 65 72 65 20  ust be run here 
20f0: 61 6e 64 0a 09 20 2a 20 69 6e 20 4c 69 62 72 61  and.. * in Libra
2100: 72 79 50 61 74 68 4f 62 6a 43 6d 64 20 62 65 63  ryPathObjCmd bec
2110: 61 75 73 65 20 74 68 69 73 20 69 6e 66 6f 72 6d  ause this inform
2120: 61 74 69 6f 6e 20 69 73 20 6e 65 65 64 65 64 20  ation is needed 
2130: 62 6f 74 68 0a 09 20 2a 20 62 65 66 6f 72 65 20  both.. * before 
2140: 61 6e 64 20 61 66 74 65 72 20 74 68 61 74 20 63  and after that c
2150: 6f 6d 6d 61 6e 64 20 69 73 20 72 75 6e 2e 20 2a  ommand is run. *
2160: 2f 0a 09 46 69 6e 64 41 6e 64 53 65 74 45 78 65  /..FindAndSetExe
2170: 63 4e 61 6d 65 28 69 6e 74 65 72 70 29 3b 0a 0a  cName(interp);..
2180: 09 54 63 6c 53 65 74 50 72 65 49 6e 69 74 53 63  .TclSetPreInitSc
2190: 72 69 70 74 28 70 72 65 49 6e 69 74 43 6d 64 29  ript(preInitCmd)
21a0: 3b 0a 09 69 66 20 28 54 63 6c 5f 49 6e 69 74 28  ;..if (Tcl_Init(
21b0: 69 6e 74 65 72 70 29 20 3d 3d 20 54 43 4c 5f 45  interp) == TCL_E
21c0: 52 52 4f 52 29 20 7b 0a 09 09 67 6f 74 6f 20 65  RROR) {...goto e
21d0: 72 72 6f 72 3b 0a 09 7d 0a 0a 23 69 66 64 65 66  rror;..}..#ifdef
21e0: 20 4b 49 54 5f 49 4e 43 4c 55 44 45 53 5f 54 4b   KIT_INCLUDES_TK
21f0: 0a 23 20 20 69 66 64 65 66 20 5f 57 49 4e 33 32  .#  ifdef _WIN32
2200: 0a 09 69 66 20 28 54 6b 5f 49 6e 69 74 28 69 6e  ..if (Tk_Init(in
2210: 74 65 72 70 29 20 3d 3d 20 54 43 4c 5f 45 52 52  terp) == TCL_ERR
2220: 4f 52 29 20 7b 0a 09 09 67 6f 74 6f 20 65 72 72  OR) {...goto err
2230: 6f 72 3b 0a 09 7d 0a 09 69 66 20 28 54 6b 5f 43  or;..}..if (Tk_C
2240: 72 65 61 74 65 43 6f 6e 73 6f 6c 65 57 69 6e 64  reateConsoleWind
2250: 6f 77 28 69 6e 74 65 72 70 29 20 3d 3d 20 54 43  ow(interp) == TC
2260: 4c 5f 45 52 52 4f 52 29 20 7b 0a 09 09 67 6f 74  L_ERROR) {...got
2270: 6f 20 65 72 72 6f 72 3b 0a 09 7d 0a 23 20 20 65  o error;..}.#  e
2280: 6e 64 69 66 20 2f 2a 20 5f 57 49 4e 33 32 20 2a  ndif /* _WIN32 *
2290: 2f 0a 23 65 6e 64 69 66 20 2f 2a 20 4b 49 54 5f  /.#endif /* KIT_
22a0: 49 4e 43 4c 55 44 45 53 5f 54 4b 20 2a 2f 0a 0a  INCLUDES_TK */..
22b0: 09 2f 2a 20 6d 65 73 73 79 20 62 65 63 61 75 73  ./* messy becaus
22c0: 65 20 54 63 6c 53 65 74 53 74 61 72 74 75 70 53  e TclSetStartupS
22d0: 63 72 69 70 74 50 61 74 68 20 69 73 20 63 61 6c  criptPath is cal
22e0: 6c 65 64 20 73 6c 69 67 68 74 6c 79 20 74 6f 6f  led slightly too
22f0: 20 6c 61 74 65 20 2a 2f 0a 09 69 66 20 28 54 63   late */..if (Tc
2300: 6c 5f 45 76 61 6c 28 69 6e 74 65 72 70 2c 20 69  l_Eval(interp, i
2310: 6e 69 74 53 63 72 69 70 74 29 20 3d 3d 20 54 43  nitScript) == TC
2320: 4c 5f 4f 4b 29 20 7b 0a 09 09 54 63 6c 5f 4f 62  L_OK) {...Tcl_Ob
2330: 6a 2a 20 70 61 74 68 3b 0a 23 69 66 64 65 66 20  j* path;.#ifdef 
2340: 48 41 56 45 5f 54 43 4c 53 45 54 53 54 41 52 54  HAVE_TCLSETSTART
2350: 55 50 53 43 52 49 50 54 50 41 54 48 0a 09 09 70  UPSCRIPTPATH...p
2360: 61 74 68 20 3d 20 54 63 6c 47 65 74 53 74 61 72  ath = TclGetStar
2370: 74 75 70 53 63 72 69 70 74 50 61 74 68 28 29 3b  tupScriptPath();
2380: 0a 09 09 54 63 6c 53 65 74 53 74 61 72 74 75 70  ...TclSetStartup
2390: 53 63 72 69 70 74 50 61 74 68 28 54 63 6c 5f 47  ScriptPath(Tcl_G
23a0: 65 74 4f 62 6a 52 65 73 75 6c 74 28 69 6e 74 65  etObjResult(inte
23b0: 72 70 29 29 3b 0a 23 65 6c 69 66 20 64 65 66 69  rp));.#elif defi
23c0: 6e 65 64 28 48 41 56 45 5f 54 43 4c 5f 53 45 54  ned(HAVE_TCL_SET
23d0: 53 54 41 52 54 55 50 53 43 52 49 50 54 29 0a 09  STARTUPSCRIPT)..
23e0: 09 70 61 74 68 20 3d 20 54 63 6c 5f 47 65 74 53  .path = Tcl_GetS
23f0: 74 61 72 74 75 70 53 63 72 69 70 74 28 4e 55 4c  tartupScript(NUL
2400: 4c 29 3b 0a 09 09 54 63 6c 5f 53 65 74 53 74 61  L);...Tcl_SetSta
2410: 72 74 75 70 53 63 72 69 70 74 28 54 63 6c 5f 47  rtupScript(Tcl_G
2420: 65 74 4f 62 6a 52 65 73 75 6c 74 28 69 6e 74 65  etObjResult(inte
2430: 72 70 29 2c 20 4e 55 4c 4c 29 3b 0a 23 65 6e 64  rp), NULL);.#end
2440: 69 66 0a 09 09 69 66 20 28 70 61 74 68 20 3d 3d  if...if (path ==
2450: 20 4e 55 4c 4c 29 20 7b 0a 09 09 09 54 63 6c 5f   NULL) {....Tcl_
2460: 45 76 61 6c 28 69 6e 74 65 72 70 2c 20 22 69 6e  Eval(interp, "in
2470: 63 72 20 61 72 67 63 20 2d 31 3b 20 73 65 74 20  cr argc -1; set 
2480: 61 72 67 76 20 5b 6c 72 61 6e 67 65 20 24 61 72  argv [lrange $ar
2490: 67 76 20 31 20 65 6e 64 5d 22 29 3b 0a 09 09 7d  gv 1 end]");...}
24a0: 0a 09 7d 0a 0a 09 54 63 6c 5f 53 65 74 56 61 72  ..}...Tcl_SetVar
24b0: 28 69 6e 74 65 72 70 2c 20 22 65 72 72 6f 72 49  (interp, "errorI
24c0: 6e 66 6f 22 2c 20 22 22 2c 20 54 43 4c 5f 47 4c  nfo", "", TCL_GL
24d0: 4f 42 41 4c 5f 4f 4e 4c 59 29 3b 0a 09 54 63 6c  OBAL_ONLY);..Tcl
24e0: 5f 52 65 73 65 74 52 65 73 75 6c 74 28 69 6e 74  _ResetResult(int
24f0: 65 72 70 29 3b 0a 0a 09 72 65 74 75 72 6e 20 54  erp);...return T
2500: 43 4c 5f 4f 4b 3b 0a 0a 65 72 72 6f 72 3a 0a 23  CL_OK;..error:.#
2510: 69 66 64 65 66 20 4b 49 54 5f 49 4e 43 4c 55 44  ifdef KIT_INCLUD
2520: 45 53 5f 54 4b 0a 23 20 20 69 66 64 65 66 20 5f  ES_TK.#  ifdef _
2530: 57 49 4e 33 32 0a 09 4d 65 73 73 61 67 65 42 65  WIN32..MessageBe
2540: 65 70 28 4d 42 5f 49 43 4f 4e 45 58 43 4c 41 4d  ep(MB_ICONEXCLAM
2550: 41 54 49 4f 4e 29 3b 0a 23 20 20 20 20 69 66 6e  ATION);.#    ifn
2560: 64 65 66 20 5f 57 49 4e 33 32 5f 57 43 45 0a 09  def _WIN32_WCE..
2570: 73 6e 70 72 69 6e 74 66 28 6d 73 67 42 75 66 2c  snprintf(msgBuf,
2580: 20 73 69 7a 65 6f 66 28 6d 73 67 42 75 66 29 2c   sizeof(msgBuf),
2590: 0a 09 09 22 41 20 63 72 69 74 69 63 61 6c 20 65  ..."A critical e
25a0: 72 72 6f 72 20 68 61 73 20 6f 63 63 75 72 72 65  rror has occurre
25b0: 64 2e 20 20 50 6c 65 61 73 65 20 72 65 70 6f 72  d.  Please repor
25c0: 74 20 74 68 69 73 20 74 6f 20 74 68 65 20 54 63  t this to the Tc
25d0: 6c 6b 69 74 20 76 65 6e 64 6f 72 2e 5c 6e 49 6e  lkit vendor.\nIn
25e0: 74 65 72 70 72 65 74 65 72 20 52 65 74 75 72 6e  terpreter Return
25f0: 65 64 3a 20 25 73 5c 6e 45 72 72 6f 72 20 49 6e  ed: %s\nError In
2600: 66 6f 3a 20 25 73 22 2c 0a 09 09 54 63 6c 5f 47  fo: %s",...Tcl_G
2610: 65 74 53 74 72 69 6e 67 52 65 73 75 6c 74 28 69  etStringResult(i
2620: 6e 74 65 72 70 29 2c 0a 09 09 54 63 6c 5f 47 65  nterp),...Tcl_Ge
2630: 74 56 61 72 28 69 6e 74 65 72 70 2c 20 22 65 72  tVar(interp, "er
2640: 72 6f 72 49 6e 66 6f 22 2c 20 54 43 4c 5f 47 4c  rorInfo", TCL_GL
2650: 4f 42 41 4c 5f 4f 4e 4c 59 29 29 3b 0a 0a 09 4d  OBAL_ONLY));...M
2660: 65 73 73 61 67 65 42 6f 78 28 4e 55 4c 4c 2c 20  essageBox(NULL, 
2670: 6d 73 67 42 75 66 2c 20 22 45 72 72 6f 72 20 69  msgBuf, "Error i
2680: 6e 20 54 63 6c 4b 69 74 22 2c 0a 09 09 4d 42 5f  n TclKit",...MB_
2690: 49 43 4f 4e 53 54 4f 50 20 7c 20 4d 42 5f 4f 4b  ICONSTOP | MB_OK
26a0: 20 7c 20 4d 42 5f 54 41 53 4b 4d 4f 44 41 4c 20   | MB_TASKMODAL 
26b0: 7c 20 4d 42 5f 53 45 54 46 4f 52 45 47 52 4f 55  | MB_SETFOREGROU
26c0: 4e 44 29 3b 0a 0a 09 45 78 69 74 50 72 6f 63 65  ND);...ExitProce
26d0: 73 73 28 31 29 3b 0a 23 20 20 20 20 65 6e 64 69  ss(1);.#    endi
26e0: 66 20 2f 2a 20 21 5f 57 49 4e 33 32 5f 57 43 45  f /* !_WIN32_WCE
26f0: 20 2a 2f 0a 20 20 20 20 2f 2a 20 77 65 20 77 6f   */.    /* we wo
2700: 6e 27 74 20 72 65 61 63 68 20 74 68 69 73 2c 20  n't reach this, 
2710: 62 75 74 20 77 65 20 6e 65 65 64 20 74 68 65 20  but we need the 
2720: 72 65 74 75 72 6e 20 2a 2f 0a 23 20 20 65 6e 64  return */.#  end
2730: 69 66 20 2f 2a 20 5f 57 49 4e 33 32 20 2a 2f 0a  if /* _WIN32 */.
2740: 23 65 6e 64 69 66 20 2f 2a 20 4b 49 54 5f 49 4e  #endif /* KIT_IN
2750: 43 4c 55 44 45 53 5f 54 4b 20 2a 2f 0a 0a 09 72  CLUDES_TK */...r
2760: 65 74 75 72 6e 20 54 43 4c 5f 45 52 52 4f 52 3b  eturn TCL_ERROR;
2770: 0a 7d 0a                                         .}.