Tcl Source Code

Hex Artifact Content
Login

Artifact 4010d6ce1800f5a99d93bd548d2aca542d400cc85ae5bca269ffabe6176b6384:


0000: 2f 2a 0a 20 2a 20 74 63 6c 2e 68 20 2d 2d 0a 20  /*. * tcl.h --. 
0010: 2a 0a 20 2a 09 54 68 69 73 20 68 65 61 64 65 72  *. *.This header
0020: 20 66 69 6c 65 20 64 65 73 63 72 69 62 65 73 20   file describes 
0030: 74 68 65 20 65 78 74 65 72 6e 61 6c 6c 79 2d 76  the externally-v
0040: 69 73 69 62 6c 65 20 66 61 63 69 6c 69 74 69 65  isible facilitie
0050: 73 20 6f 66 20 74 68 65 0a 20 2a 09 54 63 6c 20  s of the. *.Tcl 
0060: 69 6e 74 65 72 70 72 65 74 65 72 2e 0a 20 2a 0a  interpreter.. *.
0070: 20 2a 20 43 6f 70 79 72 69 67 68 74 20 28 63 29   * Copyright (c)
0080: 20 31 39 38 37 2d 31 39 39 34 20 54 68 65 20 52   1987-1994 The R
0090: 65 67 65 6e 74 73 20 6f 66 20 74 68 65 20 55 6e  egents of the Un
00a0: 69 76 65 72 73 69 74 79 20 6f 66 20 43 61 6c 69  iversity of Cali
00b0: 66 6f 72 6e 69 61 2e 0a 20 2a 20 43 6f 70 79 72  fornia.. * Copyr
00c0: 69 67 68 74 20 28 63 29 20 31 39 39 33 2d 31 39  ight (c) 1993-19
00d0: 39 36 20 4c 75 63 65 6e 74 20 54 65 63 68 6e 6f  96 Lucent Techno
00e0: 6c 6f 67 69 65 73 2e 0a 20 2a 20 43 6f 70 79 72  logies.. * Copyr
00f0: 69 67 68 74 20 28 63 29 20 31 39 39 34 2d 31 39  ight (c) 1994-19
0100: 39 38 20 53 75 6e 20 4d 69 63 72 6f 73 79 73 74  98 Sun Microsyst
0110: 65 6d 73 2c 20 49 6e 63 2e 0a 20 2a 20 43 6f 70  ems, Inc.. * Cop
0120: 79 72 69 67 68 74 20 28 63 29 20 31 39 39 38 2d  yright (c) 1998-
0130: 32 30 30 30 20 62 79 20 53 63 72 69 70 74 69 63  2000 by Scriptic
0140: 73 20 43 6f 72 70 6f 72 61 74 69 6f 6e 2e 0a 20  s Corporation.. 
0150: 2a 20 43 6f 70 79 72 69 67 68 74 20 28 63 29 20  * Copyright (c) 
0160: 32 30 30 32 20 62 79 20 4b 65 76 69 6e 20 42 2e  2002 by Kevin B.
0170: 20 4b 65 6e 6e 79 2e 20 20 41 6c 6c 20 72 69 67   Kenny.  All rig
0180: 68 74 73 20 72 65 73 65 72 76 65 64 2e 0a 20 2a  hts reserved.. *
0190: 0a 20 2a 20 53 65 65 20 74 68 65 20 66 69 6c 65  . * See the file
01a0: 20 22 6c 69 63 65 6e 73 65 2e 74 65 72 6d 73 22   "license.terms"
01b0: 20 66 6f 72 20 69 6e 66 6f 72 6d 61 74 69 6f 6e   for information
01c0: 20 6f 6e 20 75 73 61 67 65 20 61 6e 64 20 72 65   on usage and re
01d0: 64 69 73 74 72 69 62 75 74 69 6f 6e 20 6f 66 0a  distribution of.
01e0: 20 2a 20 74 68 69 73 20 66 69 6c 65 2c 20 61 6e   * this file, an
01f0: 64 20 66 6f 72 20 61 20 44 49 53 43 4c 41 49 4d  d for a DISCLAIM
0200: 45 52 20 4f 46 20 41 4c 4c 20 57 41 52 52 41 4e  ER OF ALL WARRAN
0210: 54 49 45 53 2e 0a 20 2a 2f 0a 0a 23 69 66 6e 64  TIES.. */..#ifnd
0220: 65 66 20 5f 54 43 4c 0a 23 64 65 66 69 6e 65 20  ef _TCL.#define 
0230: 5f 54 43 4c 0a 0a 2f 2a 0a 20 2a 20 46 6f 72 20  _TCL../*. * For 
0240: 43 2b 2b 20 63 6f 6d 70 69 6c 65 72 73 2c 20 75  C++ compilers, u
0250: 73 65 20 65 78 74 65 72 6e 20 22 43 22 0a 20 2a  se extern "C". *
0260: 2f 0a 0a 23 69 66 64 65 66 20 5f 5f 63 70 6c 75  /..#ifdef __cplu
0270: 73 70 6c 75 73 0a 65 78 74 65 72 6e 20 22 43 22  splus.extern "C"
0280: 20 7b 0a 23 65 6e 64 69 66 0a 0a 2f 2a 0a 20 2a   {.#endif../*. *
0290: 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 64   The following d
02a0: 65 66 69 6e 65 73 20 61 72 65 20 75 73 65 64 20  efines are used 
02b0: 74 6f 20 69 6e 64 69 63 61 74 65 20 74 68 65 20  to indicate the 
02c0: 76 61 72 69 6f 75 73 20 72 65 6c 65 61 73 65 20  various release 
02d0: 6c 65 76 65 6c 73 2e 0a 20 2a 2f 0a 0a 23 64 65  levels.. */..#de
02e0: 66 69 6e 65 20 54 43 4c 5f 41 4c 50 48 41 5f 52  fine TCL_ALPHA_R
02f0: 45 4c 45 41 53 45 09 30 0a 23 64 65 66 69 6e 65  ELEASE.0.#define
0300: 20 54 43 4c 5f 42 45 54 41 5f 52 45 4c 45 41 53   TCL_BETA_RELEAS
0310: 45 09 31 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f  E.1.#define TCL_
0320: 46 49 4e 41 4c 5f 52 45 4c 45 41 53 45 09 32 0a  FINAL_RELEASE.2.
0330: 0a 2f 2a 0a 20 2a 20 57 68 65 6e 20 76 65 72 73  ./*. * When vers
0340: 69 6f 6e 20 6e 75 6d 62 65 72 73 20 63 68 61 6e  ion numbers chan
0350: 67 65 20 68 65 72 65 2c 20 6d 75 73 74 20 61 6c  ge here, must al
0360: 73 6f 20 67 6f 20 69 6e 74 6f 20 74 68 65 20 66  so go into the f
0370: 6f 6c 6c 6f 77 69 6e 67 20 66 69 6c 65 73 20 61  ollowing files a
0380: 6e 64 0a 20 2a 20 75 70 64 61 74 65 20 74 68 65  nd. * update the
0390: 20 76 65 72 73 69 6f 6e 20 6e 75 6d 62 65 72 73   version numbers
03a0: 3a 0a 20 2a 0a 20 2a 20 6c 69 62 72 61 72 79 2f  :. *. * library/
03b0: 69 6e 69 74 2e 74 63 6c 09 28 31 20 4c 4f 43 20  init.tcl.(1 LOC 
03c0: 70 61 74 63 68 29 0a 20 2a 20 75 6e 69 78 2f 63  patch). * unix/c
03d0: 6f 6e 66 69 67 75 72 65 2e 69 6e 09 28 32 20 4c  onfigure.in.(2 L
03e0: 4f 43 20 4d 61 6a 6f 72 2c 20 32 20 4c 4f 43 20  OC Major, 2 LOC 
03f0: 6d 69 6e 6f 72 2c 20 31 20 4c 4f 43 20 70 61 74  minor, 1 LOC pat
0400: 63 68 29 0a 20 2a 20 77 69 6e 2f 63 6f 6e 66 69  ch). * win/confi
0410: 67 75 72 65 2e 69 6e 09 28 61 73 20 61 62 6f 76  gure.in.(as abov
0420: 65 29 0a 20 2a 20 77 69 6e 2f 74 63 6c 2e 6d 34  e). * win/tcl.m4
0430: 09 09 28 6e 6f 74 20 70 61 74 63 68 6c 65 76 65  ..(not patchleve
0440: 6c 29 0a 20 2a 20 52 45 41 44 4d 45 09 09 28 73  l). * README..(s
0450: 65 63 74 69 6f 6e 73 20 30 20 61 6e 64 20 32 2c  ections 0 and 2,
0460: 20 77 69 74 68 20 61 6e 64 20 77 69 74 68 6f 75   with and withou
0470: 74 20 73 65 70 61 72 61 74 6f 72 29 0a 20 2a 20  t separator). * 
0480: 6d 61 63 6f 73 78 2f 54 63 6c 2d 43 6f 6d 6d 6f  macosx/Tcl-Commo
0490: 6e 2e 78 63 63 6f 6e 66 69 67 20 28 6e 6f 74 20  n.xcconfig (not 
04a0: 70 61 74 63 68 6c 65 76 65 6c 29 20 31 20 4c 4f  patchlevel) 1 LO
04b0: 43 0a 20 2a 20 77 69 6e 2f 52 45 41 44 4d 45 09  C. * win/README.
04c0: 09 28 6e 6f 74 20 70 61 74 63 68 6c 65 76 65 6c  .(not patchlevel
04d0: 29 20 28 73 65 63 74 69 6f 6e 73 20 30 20 61 6e  ) (sections 0 an
04e0: 64 20 32 29 0a 20 2a 20 75 6e 69 78 2f 74 63 6c  d 2). * unix/tcl
04f0: 2e 73 70 65 63 09 28 31 20 4c 4f 43 20 70 61 74  .spec.(1 LOC pat
0500: 63 68 29 0a 20 2a 20 74 6f 6f 6c 73 2f 74 63 6c  ch). * tools/tcl
0510: 2e 68 70 6a 2e 69 6e 09 28 6e 6f 74 20 70 61 74  .hpj.in.(not pat
0520: 63 68 6c 65 76 65 6c 2c 20 66 6f 72 20 77 69 6e  chlevel, for win
0530: 64 6f 77 73 20 69 6e 73 74 61 6c 6c 65 72 29 0a  dows installer).
0540: 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c   */..#define TCL
0550: 5f 4d 41 4a 4f 52 5f 56 45 52 53 49 4f 4e 20 20  _MAJOR_VERSION  
0560: 20 38 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4d   8.#define TCL_M
0570: 49 4e 4f 52 5f 56 45 52 53 49 4f 4e 20 20 20 36  INOR_VERSION   6
0580: 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 52 45 4c  .#define TCL_REL
0590: 45 41 53 45 5f 4c 45 56 45 4c 20 20 20 54 43 4c  EASE_LEVEL   TCL
05a0: 5f 46 49 4e 41 4c 5f 52 45 4c 45 41 53 45 0a 23  _FINAL_RELEASE.#
05b0: 64 65 66 69 6e 65 20 54 43 4c 5f 52 45 4c 45 41  define TCL_RELEA
05c0: 53 45 5f 53 45 52 49 41 4c 20 20 31 31 0a 0a 23  SE_SERIAL  11..#
05d0: 64 65 66 69 6e 65 20 54 43 4c 5f 56 45 52 53 49  define TCL_VERSI
05e0: 4f 4e 09 20 20 20 20 22 38 2e 36 22 0a 23 64 65  ON.    "8.6".#de
05f0: 66 69 6e 65 20 54 43 4c 5f 50 41 54 43 48 5f 4c  fine TCL_PATCH_L
0600: 45 56 45 4c 09 20 20 20 20 22 38 2e 36 2e 31 31  EVEL.    "8.6.11
0610: 22 0a 0c 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d  ".../*. *-------
0620: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0630: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0640: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0650: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0660: 2d 2d 2d 2d 2d 0a 20 2a 20 54 68 65 20 66 6f 6c  -----. * The fol
0670: 6c 6f 77 69 6e 67 20 64 65 66 69 6e 69 74 69 6f  lowing definitio
0680: 6e 73 20 73 65 74 20 75 70 20 74 68 65 20 70 72  ns set up the pr
0690: 6f 70 65 72 20 6f 70 74 69 6f 6e 73 20 66 6f 72  oper options for
06a0: 20 57 69 6e 64 6f 77 73 20 63 6f 6d 70 69 6c 65   Windows compile
06b0: 72 73 2e 0a 20 2a 20 57 65 20 75 73 65 20 74 68  rs.. * We use th
06c0: 69 73 20 6d 65 74 68 6f 64 20 62 65 63 61 75 73  is method becaus
06d0: 65 20 74 68 65 72 65 20 69 73 20 6e 6f 20 61 75  e there is no au
06e0: 74 6f 63 6f 6e 66 20 65 71 75 69 76 61 6c 65 6e  toconf equivalen
06f0: 74 2e 0a 20 2a 2f 0a 0a 23 69 66 64 65 66 20 5f  t.. */..#ifdef _
0700: 57 49 4e 33 32 0a 23 20 20 20 69 66 6e 64 65 66  WIN32.#   ifndef
0710: 20 5f 5f 57 49 4e 33 32 5f 5f 0a 23 09 64 65 66   __WIN32__.#.def
0720: 69 6e 65 20 5f 5f 57 49 4e 33 32 5f 5f 0a 23 20  ine __WIN32__.# 
0730: 20 20 65 6e 64 69 66 0a 23 20 20 20 69 66 6e 64    endif.#   ifnd
0740: 65 66 20 57 49 4e 33 32 0a 23 09 64 65 66 69 6e  ef WIN32.#.defin
0750: 65 20 57 49 4e 33 32 0a 23 20 20 20 65 6e 64 69  e WIN32.#   endi
0760: 66 0a 23 65 6e 64 69 66 0a 0a 2f 2a 0a 20 2a 20  f.#endif../*. * 
0770: 55 74 69 6c 69 74 79 20 6d 61 63 72 6f 73 3a 20  Utility macros: 
0780: 53 54 52 49 4e 47 49 46 59 20 74 61 6b 65 73 20  STRINGIFY takes 
0790: 61 6e 20 61 72 67 75 6d 65 6e 74 20 61 6e 64 20  an argument and 
07a0: 77 72 61 70 73 20 69 74 20 69 6e 20 22 22 20 28  wraps it in "" (
07b0: 64 6f 75 62 6c 65 0a 20 2a 20 71 75 6f 74 61 74  double. * quotat
07c0: 69 6f 6e 20 6d 61 72 6b 73 29 2c 20 4a 4f 49 4e  ion marks), JOIN
07d0: 20 6a 6f 69 6e 73 20 74 77 6f 20 61 72 67 75 6d   joins two argum
07e0: 65 6e 74 73 2e 0a 20 2a 2f 0a 0a 23 69 66 6e 64  ents.. */..#ifnd
07f0: 65 66 20 53 54 52 49 4e 47 49 46 59 0a 23 20 20  ef STRINGIFY.#  
0800: 64 65 66 69 6e 65 20 53 54 52 49 4e 47 49 46 59  define STRINGIFY
0810: 28 78 29 20 53 54 52 49 4e 47 49 46 59 31 28 78  (x) STRINGIFY1(x
0820: 29 0a 23 20 20 64 65 66 69 6e 65 20 53 54 52 49  ).#  define STRI
0830: 4e 47 49 46 59 31 28 78 29 20 23 78 0a 23 65 6e  NGIFY1(x) #x.#en
0840: 64 69 66 0a 23 69 66 6e 64 65 66 20 4a 4f 49 4e  dif.#ifndef JOIN
0850: 0a 23 20 20 64 65 66 69 6e 65 20 4a 4f 49 4e 28  .#  define JOIN(
0860: 61 2c 62 29 20 4a 4f 49 4e 31 28 61 2c 62 29 0a  a,b) JOIN1(a,b).
0870: 23 20 20 64 65 66 69 6e 65 20 4a 4f 49 4e 31 28  #  define JOIN1(
0880: 61 2c 62 29 20 61 23 23 62 0a 23 65 6e 64 69 66  a,b) a##b.#endif
0890: 0a 0a 2f 2a 0a 20 2a 20 41 20 73 70 65 63 69 61  ../*. * A specia
08a0: 6c 20 64 65 66 69 6e 69 74 69 6f 6e 20 75 73 65  l definition use
08b0: 64 20 74 6f 20 61 6c 6c 6f 77 20 74 68 69 73 20  d to allow this 
08c0: 68 65 61 64 65 72 20 66 69 6c 65 20 74 6f 20 62  header file to b
08d0: 65 20 69 6e 63 6c 75 64 65 64 20 66 72 6f 6d 0a  e included from.
08e0: 20 2a 20 77 69 6e 64 6f 77 73 20 72 65 73 6f 75   * windows resou
08f0: 72 63 65 20 66 69 6c 65 73 20 73 6f 20 74 68 61  rce files so tha
0900: 74 20 74 68 65 79 20 63 61 6e 20 6f 62 74 61 69  t they can obtai
0910: 6e 20 76 65 72 73 69 6f 6e 20 69 6e 66 6f 72 6d  n version inform
0920: 61 74 69 6f 6e 2e 0a 20 2a 20 52 43 5f 49 4e 56  ation.. * RC_INV
0930: 4f 4b 45 44 20 69 73 20 64 65 66 69 6e 65 64 20  OKED is defined 
0940: 62 79 20 64 65 66 61 75 6c 74 20 62 79 20 74 68  by default by th
0950: 65 20 77 69 6e 64 6f 77 73 20 52 43 20 74 6f 6f  e windows RC too
0960: 6c 2e 0a 20 2a 0a 20 2a 20 52 65 73 6f 75 72 63  l.. *. * Resourc
0970: 65 20 63 6f 6d 70 69 6c 65 72 73 20 64 6f 6e 27  e compilers don'
0980: 74 20 6c 69 6b 65 20 61 6c 6c 20 74 68 65 20 43  t like all the C
0990: 20 73 74 75 66 66 2c 20 6c 69 6b 65 20 74 79 70   stuff, like typ
09a0: 65 64 65 66 73 20 61 6e 64 20 66 75 6e 63 74 69  edefs and functi
09b0: 6f 6e 0a 20 2a 20 64 65 63 6c 61 72 61 74 69 6f  on. * declaratio
09c0: 6e 73 2c 20 74 68 61 74 20 6f 63 63 75 72 20 62  ns, that occur b
09d0: 65 6c 6f 77 2c 20 73 6f 20 62 6c 6f 63 6b 20 74  elow, so block t
09e0: 68 65 6d 20 6f 75 74 2e 0a 20 2a 2f 0a 0a 23 69  hem out.. */..#i
09f0: 66 6e 64 65 66 20 52 43 5f 49 4e 56 4f 4b 45 44  fndef RC_INVOKED
0a00: 0a 0a 2f 2a 0a 20 2a 20 53 70 65 63 69 61 6c 20  ../*. * Special 
0a10: 6d 61 63 72 6f 20 74 6f 20 64 65 66 69 6e 65 20  macro to define 
0a20: 6d 75 74 65 78 65 73 2c 20 74 68 61 74 20 64 6f  mutexes, that do
0a30: 65 73 6e 27 74 20 64 6f 20 61 6e 79 74 68 69 6e  esn't do anythin
0a40: 67 20 69 66 20 77 65 20 61 72 65 20 6e 6f 74 0a  g if we are not.
0a50: 20 2a 20 75 73 69 6e 67 20 74 68 72 65 61 64 73   * using threads
0a60: 2e 0a 20 2a 2f 0a 0a 23 69 66 64 65 66 20 54 43  .. */..#ifdef TC
0a70: 4c 5f 54 48 52 45 41 44 53 0a 23 64 65 66 69 6e  L_THREADS.#defin
0a80: 65 20 54 43 4c 5f 44 45 43 4c 41 52 45 5f 4d 55  e TCL_DECLARE_MU
0a90: 54 45 58 28 6e 61 6d 65 29 20 73 74 61 74 69 63  TEX(name) static
0aa0: 20 54 63 6c 5f 4d 75 74 65 78 20 6e 61 6d 65 3b   Tcl_Mutex name;
0ab0: 0a 23 65 6c 73 65 0a 23 64 65 66 69 6e 65 20 54  .#else.#define T
0ac0: 43 4c 5f 44 45 43 4c 41 52 45 5f 4d 55 54 45 58  CL_DECLARE_MUTEX
0ad0: 28 6e 61 6d 65 29 0a 23 65 6e 64 69 66 0a 0a 2f  (name).#endif../
0ae0: 2a 0a 20 2a 20 54 63 6c 27 73 20 70 75 62 6c 69  *. * Tcl's publi
0af0: 63 20 72 6f 75 74 69 6e 65 20 54 63 6c 5f 46 53  c routine Tcl_FS
0b00: 53 65 65 6b 28 29 20 75 73 65 73 20 74 68 65 20  Seek() uses the 
0b10: 76 61 6c 75 65 73 20 53 45 45 4b 5f 53 45 54 2c  values SEEK_SET,
0b20: 20 53 45 45 4b 5f 43 55 52 2c 20 61 6e 64 0a 20   SEEK_CUR, and. 
0b30: 2a 20 53 45 45 4b 5f 45 4e 44 2c 20 61 6c 6c 20  * SEEK_END, all 
0b40: 23 64 65 66 69 6e 65 27 64 20 62 79 20 73 74 64  #define'd by std
0b50: 69 6f 2e 68 20 2e 0a 20 2a 0a 20 2a 20 41 6c 73  io.h .. *. * Als
0b60: 6f 2c 20 6d 61 6e 79 20 65 78 74 65 6e 73 69 6f  o, many extensio
0b70: 6e 73 20 6e 65 65 64 20 73 74 64 69 6f 2e 68 2c  ns need stdio.h,
0b80: 20 61 6e 64 20 74 68 65 79 27 76 65 20 67 72 6f   and they've gro
0b90: 77 6e 20 61 63 63 75 73 74 6f 6d 65 64 20 74 6f  wn accustomed to
0ba0: 20 74 63 6c 2e 68 0a 20 2a 20 70 72 6f 76 69 64   tcl.h. * provid
0bb0: 69 6e 67 20 69 74 20 66 6f 72 20 74 68 65 6d 20  ing it for them 
0bc0: 72 61 74 68 65 72 20 74 68 61 6e 20 23 69 6e 63  rather than #inc
0bd0: 6c 75 64 65 2d 69 6e 67 20 69 74 20 74 68 65 6d  lude-ing it them
0be0: 73 65 6c 76 65 73 20 61 73 20 74 68 65 79 0a 20  selves as they. 
0bf0: 2a 20 73 68 6f 75 6c 64 2c 20 73 6f 20 61 6c 73  * should, so als
0c00: 6f 20 66 6f 72 20 74 68 65 69 72 20 73 61 6b 65  o for their sake
0c10: 2c 20 77 65 20 6b 65 65 70 20 74 68 65 20 23 69  , we keep the #i
0c20: 6e 63 6c 75 64 65 20 74 6f 20 62 65 20 63 6f 6e  nclude to be con
0c30: 73 69 73 74 65 6e 74 20 77 69 74 68 0a 20 2a 20  sistent with. * 
0c40: 70 72 69 6f 72 20 54 63 6c 20 72 65 6c 65 61 73  prior Tcl releas
0c50: 65 73 2e 0a 20 2a 2f 0a 0a 23 69 6e 63 6c 75 64  es.. */..#includ
0c60: 65 20 3c 73 74 64 69 6f 2e 68 3e 0a 0a 2f 2a 0a  e <stdio.h>../*.
0c70: 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d   *--------------
0c80: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0c90: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0ca0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
0cb0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20  --------------. 
0cc0: 2a 20 53 75 70 70 6f 72 74 20 66 6f 72 20 66 75  * Support for fu
0cd0: 6e 63 74 69 6f 6e 73 20 77 69 74 68 20 61 20 76  nctions with a v
0ce0: 61 72 69 61 62 6c 65 20 6e 75 6d 62 65 72 20 6f  ariable number o
0cf0: 66 20 61 72 67 75 6d 65 6e 74 73 2e 0a 20 2a 0a  f arguments.. *.
0d00: 20 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67   * The following
0d10: 20 54 43 4c 5f 56 41 52 41 52 47 53 2a 20 6d 61   TCL_VARARGS* ma
0d20: 63 72 6f 73 20 61 72 65 20 74 6f 20 73 75 70 70  cros are to supp
0d30: 6f 72 74 20 6f 6c 64 20 65 78 74 65 6e 73 69 6f  ort old extensio
0d40: 6e 73 0a 20 2a 20 77 72 69 74 74 65 6e 20 66 6f  ns. * written fo
0d50: 72 20 6f 6c 64 65 72 20 76 65 72 73 69 6f 6e 73  r older versions
0d60: 20 6f 66 20 54 63 6c 20 77 68 65 72 65 20 74 68   of Tcl where th
0d70: 65 20 6d 61 63 72 6f 73 20 70 65 72 6d 69 74 74  e macros permitt
0d80: 65 64 0a 20 2a 20 73 75 70 70 6f 72 74 20 66 6f  ed. * support fo
0d90: 72 20 74 68 65 20 76 61 72 61 72 67 73 2e 68 20  r the varargs.h 
0da0: 73 79 73 74 65 6d 20 61 73 20 77 65 6c 6c 20 61  system as well a
0db0: 73 20 73 74 64 61 72 67 2e 68 20 2e 0a 20 2a 0a  s stdarg.h .. *.
0dc0: 20 2a 20 4e 65 77 20 63 6f 64 65 20 73 68 6f 75   * New code shou
0dd0: 6c 64 20 6a 75 73 74 20 64 69 72 65 63 74 6c 79  ld just directly
0de0: 20 62 65 20 77 72 69 74 74 65 6e 20 74 6f 20 75   be written to u
0df0: 73 65 20 73 74 64 61 72 67 2e 68 20 63 6f 6e 76  se stdarg.h conv
0e00: 65 6e 74 69 6f 6e 73 2e 0a 20 2a 2f 0a 0a 23 69  entions.. */..#i
0e10: 6e 63 6c 75 64 65 20 3c 73 74 64 61 72 67 2e 68  nclude <stdarg.h
0e20: 3e 0a 23 69 66 20 21 64 65 66 69 6e 65 64 28 54  >.#if !defined(T
0e30: 43 4c 5f 4e 4f 5f 44 45 50 52 45 43 41 54 45 44  CL_NO_DEPRECATED
0e40: 29 20 26 26 20 54 43 4c 5f 4d 41 4a 4f 52 5f 56  ) && TCL_MAJOR_V
0e50: 45 52 53 49 4f 4e 20 3c 20 39 0a 23 20 20 20 20  ERSION < 9.#    
0e60: 64 65 66 69 6e 65 20 54 43 4c 5f 56 41 52 41 52  define TCL_VARAR
0e70: 47 53 28 74 79 70 65 2c 20 6e 61 6d 65 29 20 28  GS(type, name) (
0e80: 74 79 70 65 20 6e 61 6d 65 2c 20 2e 2e 2e 29 0a  type name, ...).
0e90: 23 20 20 20 20 64 65 66 69 6e 65 20 54 43 4c 5f  #    define TCL_
0ea0: 56 41 52 41 52 47 53 5f 44 45 46 28 74 79 70 65  VARARGS_DEF(type
0eb0: 2c 20 6e 61 6d 65 29 20 28 74 79 70 65 20 6e 61  , name) (type na
0ec0: 6d 65 2c 20 2e 2e 2e 29 0a 23 20 20 20 20 64 65  me, ...).#    de
0ed0: 66 69 6e 65 20 54 43 4c 5f 56 41 52 41 52 47 53  fine TCL_VARARGS
0ee0: 5f 53 54 41 52 54 28 74 79 70 65 2c 20 6e 61 6d  _START(type, nam
0ef0: 65 2c 20 6c 69 73 74 29 20 28 76 61 5f 73 74 61  e, list) (va_sta
0f00: 72 74 28 6c 69 73 74 2c 20 6e 61 6d 65 29 2c 20  rt(list, name), 
0f10: 6e 61 6d 65 29 0a 23 65 6e 64 69 66 20 2f 2a 20  name).#endif /* 
0f20: 21 54 43 4c 5f 4e 4f 5f 44 45 50 52 45 43 41 54  !TCL_NO_DEPRECAT
0f30: 45 44 20 2a 2f 0a 23 69 66 20 64 65 66 69 6e 65  ED */.#if define
0f40: 64 28 5f 5f 47 4e 55 43 5f 5f 29 20 26 26 20 28  d(__GNUC__) && (
0f50: 5f 5f 47 4e 55 43 5f 5f 20 3e 20 32 29 0a 23 20  __GNUC__ > 2).# 
0f60: 20 20 69 66 20 64 65 66 69 6e 65 64 28 5f 57 49    if defined(_WI
0f70: 4e 33 32 29 20 26 26 20 64 65 66 69 6e 65 64 28  N32) && defined(
0f80: 5f 5f 55 53 45 5f 4d 49 4e 47 57 5f 41 4e 53 49  __USE_MINGW_ANSI
0f90: 5f 53 54 44 49 4f 29 20 26 26 20 5f 5f 55 53 45  _STDIO) && __USE
0fa0: 5f 4d 49 4e 47 57 5f 41 4e 53 49 5f 53 54 44 49  _MINGW_ANSI_STDI
0fb0: 4f 0a 23 09 64 65 66 69 6e 65 20 54 43 4c 5f 46  O.#.define TCL_F
0fc0: 4f 52 4d 41 54 5f 50 52 49 4e 54 46 28 61 2c 62  ORMAT_PRINTF(a,b
0fd0: 29 20 5f 5f 61 74 74 72 69 62 75 74 65 5f 5f 20  ) __attribute__ 
0fe0: 28 28 5f 5f 66 6f 72 6d 61 74 5f 5f 20 28 5f 5f  ((__format__ (__
0ff0: 4d 49 4e 47 57 5f 50 52 49 4e 54 46 5f 46 4f 52  MINGW_PRINTF_FOR
1000: 4d 41 54 2c 20 61 2c 20 62 29 29 29 0a 23 20 20  MAT, a, b))).#  
1010: 20 65 6c 73 65 0a 23 09 64 65 66 69 6e 65 20 54   else.#.define T
1020: 43 4c 5f 46 4f 52 4d 41 54 5f 50 52 49 4e 54 46  CL_FORMAT_PRINTF
1030: 28 61 2c 62 29 20 5f 5f 61 74 74 72 69 62 75 74  (a,b) __attribut
1040: 65 5f 5f 20 28 28 5f 5f 66 6f 72 6d 61 74 5f 5f  e__ ((__format__
1050: 20 28 5f 5f 70 72 69 6e 74 66 5f 5f 2c 20 61 2c   (__printf__, a,
1060: 20 62 29 29 29 0a 23 20 20 20 65 6e 64 69 66 0a   b))).#   endif.
1070: 23 20 20 20 64 65 66 69 6e 65 20 54 43 4c 5f 4e  #   define TCL_N
1080: 4f 52 45 54 55 52 4e 20 5f 5f 61 74 74 72 69 62  ORETURN __attrib
1090: 75 74 65 5f 5f 20 28 28 6e 6f 72 65 74 75 72 6e  ute__ ((noreturn
10a0: 29 29 0a 23 20 20 20 69 66 20 64 65 66 69 6e 65  )).#   if define
10b0: 64 28 42 55 49 4c 44 5f 74 63 6c 29 20 7c 7c 20  d(BUILD_tcl) || 
10c0: 64 65 66 69 6e 65 64 28 42 55 49 4c 44 5f 74 6b  defined(BUILD_tk
10d0: 29 0a 23 09 64 65 66 69 6e 65 20 54 43 4c 5f 4e  ).#.define TCL_N
10e0: 4f 52 45 54 55 52 4e 31 20 5f 5f 61 74 74 72 69  ORETURN1 __attri
10f0: 62 75 74 65 5f 5f 20 28 28 6e 6f 72 65 74 75 72  bute__ ((noretur
1100: 6e 29 29 0a 23 20 20 20 65 6c 73 65 0a 23 09 64  n)).#   else.#.d
1110: 65 66 69 6e 65 20 54 43 4c 5f 4e 4f 52 45 54 55  efine TCL_NORETU
1120: 52 4e 31 20 2f 2a 20 6e 6f 74 68 69 6e 67 20 2a  RN1 /* nothing *
1130: 2f 0a 23 20 20 20 65 6e 64 69 66 0a 23 65 6c 73  /.#   endif.#els
1140: 65 0a 23 20 20 20 64 65 66 69 6e 65 20 54 43 4c  e.#   define TCL
1150: 5f 46 4f 52 4d 41 54 5f 50 52 49 4e 54 46 28 61  _FORMAT_PRINTF(a
1160: 2c 62 29 0a 23 20 20 20 69 66 20 64 65 66 69 6e  ,b).#   if defin
1170: 65 64 28 5f 4d 53 43 5f 56 45 52 29 20 26 26 20  ed(_MSC_VER) && 
1180: 28 5f 4d 53 43 5f 56 45 52 20 3e 3d 20 31 33 31  (_MSC_VER >= 131
1190: 30 29 0a 23 09 64 65 66 69 6e 65 20 54 43 4c 5f  0).#.define TCL_
11a0: 4e 4f 52 45 54 55 52 4e 20 5f 64 65 63 6c 73 70  NORETURN _declsp
11b0: 65 63 28 6e 6f 72 65 74 75 72 6e 29 0a 23 20 20  ec(noreturn).#  
11c0: 20 65 6c 73 65 0a 23 09 64 65 66 69 6e 65 20 54   else.#.define T
11d0: 43 4c 5f 4e 4f 52 45 54 55 52 4e 20 2f 2a 20 6e  CL_NORETURN /* n
11e0: 6f 74 68 69 6e 67 20 2a 2f 0a 23 20 20 20 65 6e  othing */.#   en
11f0: 64 69 66 0a 23 20 20 20 64 65 66 69 6e 65 20 54  dif.#   define T
1200: 43 4c 5f 4e 4f 52 45 54 55 52 4e 31 20 2f 2a 20  CL_NORETURN1 /* 
1210: 6e 6f 74 68 69 6e 67 20 2a 2f 0a 23 65 6e 64 69  nothing */.#endi
1220: 66 0a 0a 2f 2a 0a 20 2a 20 41 6c 6c 6f 77 20 61  f../*. * Allow a
1230: 20 70 61 72 74 20 6f 66 20 54 63 6c 27 73 20 41   part of Tcl's A
1240: 50 49 20 74 6f 20 62 65 20 65 78 70 6c 69 63 69  PI to be explici
1250: 74 6c 79 20 6d 61 72 6b 65 64 20 61 73 20 64 65  tly marked as de
1260: 70 72 65 63 61 74 65 64 2e 0a 20 2a 0a 20 2a 20  precated.. *. * 
1270: 55 73 65 64 20 74 6f 20 6d 61 6b 65 20 54 49 50  Used to make TIP
1280: 20 33 33 30 2f 33 33 36 20 67 65 6e 65 72 61 74   330/336 generat
1290: 65 20 6d 6f 61 6e 73 20 65 76 65 6e 20 69 66 20  e moans even if 
12a0: 70 65 6f 70 6c 65 20 75 73 65 20 74 68 65 0a 20  people use the. 
12b0: 2a 20 63 6f 6d 70 61 74 69 62 69 6c 69 74 79 20  * compatibility 
12c0: 6d 61 63 72 6f 73 2e 20 43 68 61 6e 67 65 20 79  macros. Change y
12d0: 6f 75 72 20 63 6f 64 65 2c 20 67 75 79 73 21 20  our code, guys! 
12e0: 57 65 20 77 6f 6e 27 74 20 73 75 70 70 6f 72 74  We won't support
12f0: 20 79 6f 75 20 66 6f 72 65 76 65 72 2e 0a 20 2a   you forever.. *
1300: 2f 0a 0a 23 69 66 20 64 65 66 69 6e 65 64 28 5f  /..#if defined(_
1310: 5f 47 4e 55 43 5f 5f 29 20 26 26 20 28 28 5f 5f  _GNUC__) && ((__
1320: 47 4e 55 43 5f 5f 20 3e 3d 20 34 29 20 7c 7c 20  GNUC__ >= 4) || 
1330: 28 28 5f 5f 47 4e 55 43 5f 5f 20 3d 3d 20 33 29  ((__GNUC__ == 3)
1340: 20 26 26 20 28 5f 5f 47 4e 55 43 5f 4d 49 4e 4f   && (__GNUC_MINO
1350: 52 5f 5f 20 3e 3d 20 31 29 29 29 0a 23 20 20 20  R__ >= 1))).#   
1360: 69 66 20 28 5f 5f 47 4e 55 43 5f 5f 20 3e 20 34  if (__GNUC__ > 4
1370: 29 20 7c 7c 20 28 28 5f 5f 47 4e 55 43 5f 5f 20  ) || ((__GNUC__ 
1380: 3d 3d 20 34 29 20 26 26 20 28 5f 5f 47 4e 55 43  == 4) && (__GNUC
1390: 5f 4d 49 4e 4f 52 5f 5f 20 3e 3d 20 35 29 29 0a  _MINOR__ >= 5)).
13a0: 23 09 64 65 66 69 6e 65 20 54 43 4c 5f 44 45 50  #.define TCL_DEP
13b0: 52 45 43 41 54 45 44 5f 41 50 49 28 6d 73 67 29  RECATED_API(msg)
13c0: 09 5f 5f 61 74 74 72 69 62 75 74 65 5f 5f 20 28  .__attribute__ (
13d0: 28 5f 5f 64 65 70 72 65 63 61 74 65 64 5f 5f 20  (__deprecated__ 
13e0: 28 6d 73 67 29 29 29 0a 23 20 20 20 65 6c 73 65  (msg))).#   else
13f0: 0a 23 09 64 65 66 69 6e 65 20 54 43 4c 5f 44 45  .#.define TCL_DE
1400: 50 52 45 43 41 54 45 44 5f 41 50 49 28 6d 73 67  PRECATED_API(msg
1410: 29 09 5f 5f 61 74 74 72 69 62 75 74 65 5f 5f 20  ).__attribute__ 
1420: 28 28 5f 5f 64 65 70 72 65 63 61 74 65 64 5f 5f  ((__deprecated__
1430: 29 29 0a 23 20 20 20 65 6e 64 69 66 0a 23 65 6c  )).#   endif.#el
1440: 73 65 0a 23 20 20 20 64 65 66 69 6e 65 20 54 43  se.#   define TC
1450: 4c 5f 44 45 50 52 45 43 41 54 45 44 5f 41 50 49  L_DEPRECATED_API
1460: 28 6d 73 67 29 09 2f 2a 20 6e 6f 74 68 69 6e 67  (msg)./* nothing
1470: 20 70 6f 72 74 61 62 6c 65 20 2a 2f 0a 23 65 6e   portable */.#en
1480: 64 69 66 0a 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d  dif../*. *------
1490: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14d0: 2d 2d 2d 2d 2d 2d 0a 20 2a 20 4d 61 63 72 6f 73  ------. * Macros
14e0: 20 75 73 65 64 20 74 6f 20 64 65 63 6c 61 72 65   used to declare
14f0: 20 61 20 66 75 6e 63 74 69 6f 6e 20 74 6f 20 62   a function to b
1500: 65 20 65 78 70 6f 72 74 65 64 20 62 79 20 61 20  e exported by a 
1510: 44 4c 4c 2e 20 55 73 65 64 20 62 79 20 57 69 6e  DLL. Used by Win
1520: 64 6f 77 73 2c 0a 20 2a 20 6d 61 70 73 20 74 6f  dows,. * maps to
1530: 20 6e 6f 2d 6f 70 20 64 65 63 6c 61 72 61 74 69   no-op declarati
1540: 6f 6e 73 20 6f 6e 20 6e 6f 6e 2d 57 69 6e 64 6f  ons on non-Windo
1550: 77 73 20 73 79 73 74 65 6d 73 2e 20 54 68 65 20  ws systems. The 
1560: 64 65 66 61 75 6c 74 20 62 75 69 6c 64 20 6f 6e  default build on
1570: 0a 20 2a 20 77 69 6e 64 6f 77 73 20 69 73 20 66  . * windows is f
1580: 6f 72 20 61 20 44 4c 4c 2c 20 77 68 69 63 68 20  or a DLL, which 
1590: 63 61 75 73 65 73 20 74 68 65 20 44 4c 4c 49 4d  causes the DLLIM
15a0: 50 4f 52 54 20 61 6e 64 20 44 4c 4c 45 58 50 4f  PORT and DLLEXPO
15b0: 52 54 20 6d 61 63 72 6f 73 20 74 6f 20 62 65 0a  RT macros to be.
15c0: 20 2a 20 6e 6f 6e 65 6d 70 74 79 2e 20 54 6f 20   * nonempty. To 
15d0: 62 75 69 6c 64 20 61 20 73 74 61 74 69 63 20 6c  build a static l
15e0: 69 62 72 61 72 79 2c 20 74 68 65 20 6d 61 63 72  ibrary, the macr
15f0: 6f 20 53 54 41 54 49 43 5f 42 55 49 4c 44 20 73  o STATIC_BUILD s
1600: 68 6f 75 6c 64 20 62 65 0a 20 2a 20 64 65 66 69  hould be. * defi
1610: 6e 65 64 2e 0a 20 2a 0a 20 2a 20 4e 6f 74 65 3a  ned.. *. * Note:
1620: 20 77 68 65 6e 20 62 75 69 6c 64 69 6e 67 20 73   when building s
1630: 74 61 74 69 63 20 62 75 74 20 6c 69 6e 6b 69 6e  tatic but linkin
1640: 67 20 64 79 6e 61 6d 69 63 61 6c 6c 79 20 74 6f  g dynamically to
1650: 20 4d 53 56 43 52 54 20 77 65 20 6d 75 73 74 20   MSVCRT we must 
1660: 73 74 69 6c 6c 0a 20 2a 20 20 20 20 20 20 20 63  still. *       c
1670: 6f 72 72 65 63 74 6c 79 20 64 65 63 6f 72 61 74  orrectly decorat
1680: 65 20 74 68 65 20 43 20 6c 69 62 72 61 72 79 20  e the C library 
1690: 69 6d 70 6f 72 74 65 64 20 66 75 6e 63 74 69 6f  imported functio
16a0: 6e 2e 20 20 55 73 65 20 43 52 54 49 4d 50 4f 52  n.  Use CRTIMPOR
16b0: 54 0a 20 2a 20 20 20 20 20 20 20 66 6f 72 20 74  T. *       for t
16c0: 68 69 73 20 70 75 72 70 6f 73 65 2e 20 20 5f 44  his purpose.  _D
16d0: 4c 4c 20 69 73 20 64 65 66 69 6e 65 64 20 62 79  LL is defined by
16e0: 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 20 77 68   the compiler wh
16f0: 65 6e 20 6c 69 6e 6b 69 6e 67 20 74 6f 0a 20 2a  en linking to. *
1700: 20 20 20 20 20 20 20 4d 53 56 43 52 54 2e 0a 20         MSVCRT.. 
1710: 2a 2f 0a 0a 23 69 66 20 28 64 65 66 69 6e 65 64  */..#if (defined
1720: 28 5f 57 49 4e 33 32 29 20 26 26 20 28 64 65 66  (_WIN32) && (def
1730: 69 6e 65 64 28 5f 4d 53 43 5f 56 45 52 29 20 7c  ined(_MSC_VER) |
1740: 7c 20 28 64 65 66 69 6e 65 64 28 5f 5f 42 4f 52  | (defined(__BOR
1750: 4c 41 4e 44 43 5f 5f 29 20 26 26 20 28 5f 5f 42  LANDC__) && (__B
1760: 4f 52 4c 41 4e 44 43 5f 5f 20 3e 3d 20 30 78 30  ORLANDC__ >= 0x0
1770: 35 35 30 29 29 20 7c 7c 20 64 65 66 69 6e 65 64  550)) || defined
1780: 28 5f 5f 4c 43 43 5f 5f 29 20 7c 7c 20 64 65 66  (__LCC__) || def
1790: 69 6e 65 64 28 5f 5f 57 41 54 43 4f 4d 43 5f 5f  ined(__WATCOMC__
17a0: 29 20 7c 7c 20 28 64 65 66 69 6e 65 64 28 5f 5f  ) || (defined(__
17b0: 47 4e 55 43 5f 5f 29 20 26 26 20 64 65 66 69 6e  GNUC__) && defin
17c0: 65 64 28 5f 5f 64 65 63 6c 73 70 65 63 29 29 29  ed(__declspec)))
17d0: 29 0a 23 20 20 20 64 65 66 69 6e 65 20 48 41 56  ).#   define HAV
17e0: 45 5f 44 45 43 4c 53 50 45 43 20 31 0a 23 20 20  E_DECLSPEC 1.#  
17f0: 20 69 66 64 65 66 20 53 54 41 54 49 43 5f 42 55   ifdef STATIC_BU
1800: 49 4c 44 0a 23 20 20 20 20 20 20 20 64 65 66 69  ILD.#       defi
1810: 6e 65 20 44 4c 4c 49 4d 50 4f 52 54 0a 23 20 20  ne DLLIMPORT.#  
1820: 20 20 20 20 20 64 65 66 69 6e 65 20 44 4c 4c 45       define DLLE
1830: 58 50 4f 52 54 0a 23 20 20 20 20 20 20 20 69 66  XPORT.#       if
1840: 64 65 66 20 5f 44 4c 4c 0a 23 20 20 20 20 20 20  def _DLL.#      
1850: 20 20 20 20 20 64 65 66 69 6e 65 20 43 52 54 49       define CRTI
1860: 4d 50 4f 52 54 20 5f 5f 64 65 63 6c 73 70 65 63  MPORT __declspec
1870: 28 64 6c 6c 69 6d 70 6f 72 74 29 0a 23 20 20 20  (dllimport).#   
1880: 20 20 20 20 65 6c 73 65 0a 23 20 20 20 20 20 20      else.#      
1890: 20 20 20 20 20 64 65 66 69 6e 65 20 43 52 54 49       define CRTI
18a0: 4d 50 4f 52 54 0a 23 20 20 20 20 20 20 20 65 6e  MPORT.#       en
18b0: 64 69 66 0a 23 20 20 20 65 6c 73 65 0a 23 20 20  dif.#   else.#  
18c0: 20 20 20 20 20 64 65 66 69 6e 65 20 44 4c 4c 49       define DLLI
18d0: 4d 50 4f 52 54 20 5f 5f 64 65 63 6c 73 70 65 63  MPORT __declspec
18e0: 28 64 6c 6c 69 6d 70 6f 72 74 29 0a 23 20 20 20  (dllimport).#   
18f0: 20 20 20 20 64 65 66 69 6e 65 20 44 4c 4c 45 58      define DLLEX
1900: 50 4f 52 54 20 5f 5f 64 65 63 6c 73 70 65 63 28  PORT __declspec(
1910: 64 6c 6c 65 78 70 6f 72 74 29 0a 23 20 20 20 20  dllexport).#    
1920: 20 20 20 64 65 66 69 6e 65 20 43 52 54 49 4d 50     define CRTIMP
1930: 4f 52 54 20 5f 5f 64 65 63 6c 73 70 65 63 28 64  ORT __declspec(d
1940: 6c 6c 69 6d 70 6f 72 74 29 0a 23 20 20 20 65 6e  llimport).#   en
1950: 64 69 66 0a 23 65 6c 73 65 0a 23 20 20 20 64 65  dif.#else.#   de
1960: 66 69 6e 65 20 44 4c 4c 49 4d 50 4f 52 54 0a 23  fine DLLIMPORT.#
1970: 20 20 20 69 66 20 64 65 66 69 6e 65 64 28 5f 5f     if defined(__
1980: 47 4e 55 43 5f 5f 29 20 26 26 20 5f 5f 47 4e 55  GNUC__) && __GNU
1990: 43 5f 5f 20 3e 20 33 0a 23 20 20 20 20 20 20 20  C__ > 3.#       
19a0: 64 65 66 69 6e 65 20 44 4c 4c 45 58 50 4f 52 54  define DLLEXPORT
19b0: 20 5f 5f 61 74 74 72 69 62 75 74 65 5f 5f 20 28   __attribute__ (
19c0: 28 76 69 73 69 62 69 6c 69 74 79 28 22 64 65 66  (visibility("def
19d0: 61 75 6c 74 22 29 29 29 0a 23 20 20 20 65 6c 73  ault"))).#   els
19e0: 65 0a 23 20 20 20 20 20 20 20 64 65 66 69 6e 65  e.#       define
19f0: 20 44 4c 4c 45 58 50 4f 52 54 0a 23 20 20 20 65   DLLEXPORT.#   e
1a00: 6e 64 69 66 0a 23 20 20 20 64 65 66 69 6e 65 20  ndif.#   define 
1a10: 43 52 54 49 4d 50 4f 52 54 0a 23 65 6e 64 69 66  CRTIMPORT.#endif
1a20: 0a 0a 2f 2a 0a 20 2a 20 54 68 65 73 65 20 6d 61  ../*. * These ma
1a30: 63 72 6f 73 20 61 72 65 20 75 73 65 64 20 74 6f  cros are used to
1a40: 20 63 6f 6e 74 72 6f 6c 20 77 68 65 74 68 65 72   control whether
1a50: 20 66 75 6e 63 74 69 6f 6e 73 20 61 72 65 20 62   functions are b
1a60: 65 69 6e 67 20 64 65 63 6c 61 72 65 64 20 66 6f  eing declared fo
1a70: 72 0a 20 2a 20 69 6d 70 6f 72 74 20 6f 72 20 65  r. * import or e
1a80: 78 70 6f 72 74 2e 20 49 66 20 61 20 66 75 6e 63  xport. If a func
1a90: 74 69 6f 6e 20 69 73 20 62 65 69 6e 67 20 64 65  tion is being de
1aa0: 63 6c 61 72 65 64 20 77 68 69 6c 65 20 69 74 20  clared while it 
1ab0: 69 73 20 62 65 69 6e 67 20 62 75 69 6c 74 0a 20  is being built. 
1ac0: 2a 20 74 6f 20 62 65 20 69 6e 63 6c 75 64 65 64  * to be included
1ad0: 20 69 6e 20 61 20 73 68 61 72 65 64 20 6c 69 62   in a shared lib
1ae0: 72 61 72 79 2c 20 74 68 65 6e 20 69 74 20 73 68  rary, then it sh
1af0: 6f 75 6c 64 20 68 61 76 65 20 74 68 65 20 44 4c  ould have the DL
1b00: 4c 45 58 50 4f 52 54 0a 20 2a 20 73 74 6f 72 61  LEXPORT. * stora
1b10: 67 65 20 63 6c 61 73 73 2e 20 49 66 20 69 73 20  ge class. If is 
1b20: 62 65 69 6e 67 20 64 65 63 6c 61 72 65 64 20 66  being declared f
1b30: 6f 72 20 75 73 65 20 62 79 20 61 20 6d 6f 64 75  or use by a modu
1b40: 6c 65 20 74 68 61 74 20 69 73 20 67 6f 69 6e 67  le that is going
1b50: 20 74 6f 0a 20 2a 20 6c 69 6e 6b 20 61 67 61 69   to. * link agai
1b60: 6e 73 74 20 74 68 65 20 73 68 61 72 65 64 20 6c  nst the shared l
1b70: 69 62 72 61 72 79 2c 20 74 68 65 6e 20 69 74 20  ibrary, then it 
1b80: 73 68 6f 75 6c 64 20 68 61 76 65 20 74 68 65 20  should have the 
1b90: 44 4c 4c 49 4d 50 4f 52 54 20 73 74 6f 72 61 67  DLLIMPORT storag
1ba0: 65 0a 20 2a 20 63 6c 61 73 73 2e 20 49 66 20 74  e. * class. If t
1bb0: 68 65 20 73 79 6d 62 6f 6c 20 69 73 20 62 65 69  he symbol is bei
1bc0: 6e 67 20 64 65 63 6c 61 72 65 64 20 66 6f 72 20  ng declared for 
1bd0: 61 20 73 74 61 74 69 63 20 62 75 69 6c 64 20 6f  a static build o
1be0: 72 20 66 6f 72 20 75 73 65 20 66 72 6f 6d 20 61  r for use from a
1bf0: 0a 20 2a 20 73 74 75 62 20 6c 69 62 72 61 72 79  . * stub library
1c00: 2c 20 74 68 65 6e 20 74 68 65 20 73 74 6f 72 61  , then the stora
1c10: 67 65 20 63 6c 61 73 73 20 73 68 6f 75 6c 64 20  ge class should 
1c20: 62 65 20 65 6d 70 74 79 2e 0a 20 2a 0a 20 2a 20  be empty.. *. * 
1c30: 54 68 65 20 63 6f 6e 76 65 6e 74 69 6f 6e 20 69  The convention i
1c40: 73 20 74 68 61 74 20 61 20 6d 61 63 72 6f 20 63  s that a macro c
1c50: 61 6c 6c 65 64 20 42 55 49 4c 44 5f 78 78 78 78  alled BUILD_xxxx
1c60: 2c 20 77 68 65 72 65 20 78 78 78 78 20 69 73 20  , where xxxx is 
1c70: 74 68 65 20 6e 61 6d 65 20 6f 66 0a 20 2a 20 61  the name of. * a
1c80: 20 6c 69 62 72 61 72 79 20 77 65 20 61 72 65 20   library we are 
1c90: 62 75 69 6c 64 69 6e 67 2c 20 69 73 20 73 65 74  building, is set
1ca0: 20 6f 6e 20 74 68 65 20 63 6f 6d 70 69 6c 65 20   on the compile 
1cb0: 6c 69 6e 65 20 66 6f 72 20 73 6f 75 72 63 65 73  line for sources
1cc0: 20 74 68 61 74 20 61 72 65 0a 20 2a 20 74 6f 20   that are. * to 
1cd0: 62 65 20 70 6c 61 63 65 64 20 69 6e 20 74 68 65  be placed in the
1ce0: 20 6c 69 62 72 61 72 79 2e 20 57 68 65 6e 20 74   library. When t
1cf0: 68 69 73 20 6d 61 63 72 6f 20 69 73 20 73 65 74  his macro is set
1d00: 2c 20 74 68 65 20 73 74 6f 72 61 67 65 20 63 6c  , the storage cl
1d10: 61 73 73 20 77 69 6c 6c 0a 20 2a 20 62 65 20 73  ass will. * be s
1d20: 65 74 20 74 6f 20 44 4c 4c 45 58 50 4f 52 54 2e  et to DLLEXPORT.
1d30: 20 41 74 20 74 68 65 20 65 6e 64 20 6f 66 20 74   At the end of t
1d40: 68 65 20 68 65 61 64 65 72 20 66 69 6c 65 2c 20  he header file, 
1d50: 74 68 65 20 73 74 6f 72 61 67 65 20 63 6c 61 73  the storage clas
1d60: 73 20 77 69 6c 6c 0a 20 2a 20 62 65 20 72 65 73  s will. * be res
1d70: 65 74 20 74 6f 20 44 4c 4c 49 4d 50 4f 52 54 2e  et to DLLIMPORT.
1d80: 0a 20 2a 2f 0a 0a 23 75 6e 64 65 66 20 54 43 4c  . */..#undef TCL
1d90: 5f 53 54 4f 52 41 47 45 5f 43 4c 41 53 53 0a 23  _STORAGE_CLASS.#
1da0: 69 66 64 65 66 20 42 55 49 4c 44 5f 74 63 6c 0a  ifdef BUILD_tcl.
1db0: 23 20 20 20 64 65 66 69 6e 65 20 54 43 4c 5f 53  #   define TCL_S
1dc0: 54 4f 52 41 47 45 5f 43 4c 41 53 53 20 44 4c 4c  TORAGE_CLASS DLL
1dd0: 45 58 50 4f 52 54 0a 23 65 6c 73 65 0a 23 20 20  EXPORT.#else.#  
1de0: 20 69 66 64 65 66 20 55 53 45 5f 54 43 4c 5f 53   ifdef USE_TCL_S
1df0: 54 55 42 53 0a 23 20 20 20 20 20 20 64 65 66 69  TUBS.#      defi
1e00: 6e 65 20 54 43 4c 5f 53 54 4f 52 41 47 45 5f 43  ne TCL_STORAGE_C
1e10: 4c 41 53 53 0a 23 20 20 20 65 6c 73 65 0a 23 20  LASS.#   else.# 
1e20: 20 20 20 20 20 64 65 66 69 6e 65 20 54 43 4c 5f       define TCL_
1e30: 53 54 4f 52 41 47 45 5f 43 4c 41 53 53 20 44 4c  STORAGE_CLASS DL
1e40: 4c 49 4d 50 4f 52 54 0a 23 20 20 20 65 6e 64 69  LIMPORT.#   endi
1e50: 66 0a 23 65 6e 64 69 66 0a 0a 2f 2a 0a 20 2a 20  f.#endif../*. * 
1e60: 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 5f 41  The following _A
1e70: 4e 53 49 5f 41 52 47 53 5f 20 6d 61 63 72 6f 20  NSI_ARGS_ macro 
1e80: 69 73 20 74 6f 20 73 75 70 70 6f 72 74 20 6f 6c  is to support ol
1e90: 64 20 65 78 74 65 6e 73 69 6f 6e 73 0a 20 2a 20  d extensions. * 
1ea0: 77 72 69 74 74 65 6e 20 66 6f 72 20 6f 6c 64 65  written for olde
1eb0: 72 20 76 65 72 73 69 6f 6e 73 20 6f 66 20 54 63  r versions of Tc
1ec0: 6c 20 77 68 65 72 65 20 69 74 20 70 65 72 6d 69  l where it permi
1ed0: 74 74 65 64 20 73 75 70 70 6f 72 74 0a 20 2a 20  tted support. * 
1ee0: 66 6f 72 20 63 6f 6d 70 69 6c 65 72 73 20 77 72  for compilers wr
1ef0: 69 74 74 65 6e 20 69 6e 20 74 68 65 20 70 72 65  itten in the pre
1f00: 2d 70 72 6f 74 6f 74 79 70 65 20 65 72 61 20 6f  -prototype era o
1f10: 66 20 43 2e 0a 20 2a 0a 20 2a 20 4e 65 77 20 63  f C.. *. * New c
1f20: 6f 64 65 20 73 68 6f 75 6c 64 20 75 73 65 20 70  ode should use p
1f30: 72 6f 74 6f 74 79 70 65 73 2e 0a 20 2a 2f 0a 0a  rototypes.. */..
1f40: 23 69 66 6e 64 65 66 20 54 43 4c 5f 4e 4f 5f 44  #ifndef TCL_NO_D
1f50: 45 50 52 45 43 41 54 45 44 0a 23 20 20 20 75 6e  EPRECATED.#   un
1f60: 64 65 66 20 5f 41 4e 53 49 5f 41 52 47 53 5f 0a  def _ANSI_ARGS_.
1f70: 23 20 20 20 64 65 66 69 6e 65 20 5f 41 4e 53 49  #   define _ANSI
1f80: 5f 41 52 47 53 5f 28 78 29 09 78 0a 23 65 6e 64  _ARGS_(x).x.#end
1f90: 69 66 0a 0a 2f 2a 0a 20 2a 20 44 65 66 69 6e 69  if../*. * Defini
1fa0: 74 69 6f 6e 73 20 74 68 61 74 20 61 6c 6c 6f 77  tions that allow
1fb0: 20 74 68 69 73 20 68 65 61 64 65 72 20 66 69 6c   this header fil
1fc0: 65 20 74 6f 20 62 65 20 75 73 65 64 20 65 69 74  e to be used eit
1fd0: 68 65 72 20 77 69 74 68 20 6f 72 20 77 69 74 68  her with or with
1fe0: 6f 75 74 0a 20 2a 20 41 4e 53 49 20 43 20 66 65  out. * ANSI C fe
1ff0: 61 74 75 72 65 73 2e 0a 20 2a 2f 0a 0a 23 69 66  atures.. */..#if
2000: 6e 64 65 66 20 49 4e 4c 49 4e 45 0a 23 20 20 20  ndef INLINE.#   
2010: 64 65 66 69 6e 65 20 49 4e 4c 49 4e 45 0a 23 65  define INLINE.#e
2020: 6e 64 69 66 0a 0a 23 69 66 64 65 66 20 4e 4f 5f  ndif..#ifdef NO_
2030: 43 4f 4e 53 54 0a 23 20 20 20 69 66 6e 64 65 66  CONST.#   ifndef
2040: 20 63 6f 6e 73 74 0a 23 20 20 20 20 20 20 64 65   const.#      de
2050: 66 69 6e 65 20 63 6f 6e 73 74 0a 23 20 20 20 65  fine const.#   e
2060: 6e 64 69 66 0a 23 65 6e 64 69 66 0a 23 69 66 6e  ndif.#endif.#ifn
2070: 64 65 66 20 43 4f 4e 53 54 0a 23 20 20 20 64 65  def CONST.#   de
2080: 66 69 6e 65 20 43 4f 4e 53 54 20 63 6f 6e 73 74  fine CONST const
2090: 0a 23 65 6e 64 69 66 0a 0a 23 69 66 64 65 66 20  .#endif..#ifdef 
20a0: 55 53 45 5f 4e 4f 4e 5f 43 4f 4e 53 54 0a 23 20  USE_NON_CONST.# 
20b0: 20 20 69 66 64 65 66 20 55 53 45 5f 43 4f 4d 50    ifdef USE_COMP
20c0: 41 54 5f 43 4f 4e 53 54 0a 23 20 20 20 20 20 20  AT_CONST.#      
20d0: 65 72 72 6f 72 20 64 65 66 69 6e 65 20 61 74 20  error define at 
20e0: 6d 6f 73 74 20 6f 6e 65 20 6f 66 20 55 53 45 5f  most one of USE_
20f0: 4e 4f 4e 5f 43 4f 4e 53 54 20 61 6e 64 20 55 53  NON_CONST and US
2100: 45 5f 43 4f 4d 50 41 54 5f 43 4f 4e 53 54 0a 23  E_COMPAT_CONST.#
2110: 20 20 20 65 6e 64 69 66 0a 23 20 20 20 64 65 66     endif.#   def
2120: 69 6e 65 20 43 4f 4e 53 54 38 34 0a 23 20 20 20  ine CONST84.#   
2130: 64 65 66 69 6e 65 20 43 4f 4e 53 54 38 34 5f 52  define CONST84_R
2140: 45 54 55 52 4e 0a 23 65 6c 73 65 0a 23 20 20 20  ETURN.#else.#   
2150: 69 66 64 65 66 20 55 53 45 5f 43 4f 4d 50 41 54  ifdef USE_COMPAT
2160: 5f 43 4f 4e 53 54 0a 23 20 20 20 20 20 20 64 65  _CONST.#      de
2170: 66 69 6e 65 20 43 4f 4e 53 54 38 34 0a 23 20 20  fine CONST84.#  
2180: 20 20 20 20 64 65 66 69 6e 65 20 43 4f 4e 53 54      define CONST
2190: 38 34 5f 52 45 54 55 52 4e 20 63 6f 6e 73 74 0a  84_RETURN const.
21a0: 23 20 20 20 65 6c 73 65 0a 23 20 20 20 20 20 20  #   else.#      
21b0: 64 65 66 69 6e 65 20 43 4f 4e 53 54 38 34 20 63  define CONST84 c
21c0: 6f 6e 73 74 0a 23 20 20 20 20 20 20 64 65 66 69  onst.#      defi
21d0: 6e 65 20 43 4f 4e 53 54 38 34 5f 52 45 54 55 52  ne CONST84_RETUR
21e0: 4e 20 63 6f 6e 73 74 0a 23 20 20 20 65 6e 64 69  N const.#   endi
21f0: 66 0a 23 65 6e 64 69 66 0a 0a 23 69 66 6e 64 65  f.#endif..#ifnde
2200: 66 20 43 4f 4e 53 54 38 36 0a 23 20 20 20 20 20  f CONST86.#     
2210: 20 64 65 66 69 6e 65 20 43 4f 4e 53 54 38 36 20   define CONST86 
2220: 43 4f 4e 53 54 38 34 0a 23 65 6e 64 69 66 0a 0a  CONST84.#endif..
2230: 2f 2a 0a 20 2a 20 4d 61 6b 65 20 73 75 72 65 20  /*. * Make sure 
2240: 45 58 54 45 52 4e 20 69 73 6e 27 74 20 64 65 66  EXTERN isn't def
2250: 69 6e 65 64 20 65 6c 73 65 77 68 65 72 65 2e 0a  ined elsewhere..
2260: 20 2a 2f 0a 0a 23 69 66 64 65 66 20 45 58 54 45   */..#ifdef EXTE
2270: 52 4e 0a 23 20 20 20 75 6e 64 65 66 20 45 58 54  RN.#   undef EXT
2280: 45 52 4e 0a 23 65 6e 64 69 66 20 2f 2a 20 45 58  ERN.#endif /* EX
2290: 54 45 52 4e 20 2a 2f 0a 0a 23 69 66 64 65 66 20  TERN */..#ifdef 
22a0: 5f 5f 63 70 6c 75 73 70 6c 75 73 0a 23 20 20 20  __cplusplus.#   
22b0: 64 65 66 69 6e 65 20 45 58 54 45 52 4e 20 65 78  define EXTERN ex
22c0: 74 65 72 6e 20 22 43 22 20 54 43 4c 5f 53 54 4f  tern "C" TCL_STO
22d0: 52 41 47 45 5f 43 4c 41 53 53 0a 23 65 6c 73 65  RAGE_CLASS.#else
22e0: 0a 23 20 20 20 64 65 66 69 6e 65 20 45 58 54 45  .#   define EXTE
22f0: 52 4e 20 65 78 74 65 72 6e 20 54 43 4c 5f 53 54  RN extern TCL_ST
2300: 4f 52 41 47 45 5f 43 4c 41 53 53 0a 23 65 6e 64  ORAGE_CLASS.#end
2310: 69 66 0a 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d  if../*. *-------
2320: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2330: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2340: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2350: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2360: 2d 2d 2d 2d 2d 0a 20 2a 20 54 68 65 20 66 6f 6c  -----. * The fol
2370: 6c 6f 77 69 6e 67 20 63 6f 64 65 20 69 73 20 63  lowing code is c
2380: 6f 70 69 65 64 20 66 72 6f 6d 20 77 69 6e 6e 74  opied from winnt
2390: 2e 68 2e 20 49 66 20 77 65 20 64 6f 6e 27 74 20  .h. If we don't 
23a0: 72 65 70 6c 69 63 61 74 65 20 69 74 20 68 65 72  replicate it her
23b0: 65 2c 0a 20 2a 20 74 68 65 6e 20 3c 77 69 6e 64  e,. * then <wind
23c0: 6f 77 73 2e 68 3e 20 63 61 6e 27 74 20 62 65 20  ows.h> can't be 
23d0: 69 6e 63 6c 75 64 65 64 20 61 66 74 65 72 20 74  included after t
23e0: 63 6c 2e 68 2c 20 73 69 6e 63 65 20 74 63 6c 2e  cl.h, since tcl.
23f0: 68 20 61 6c 73 6f 20 64 65 66 69 6e 65 73 0a 20  h also defines. 
2400: 2a 20 56 4f 49 44 2e 20 54 68 69 73 20 62 6c 6f  * VOID. This blo
2410: 63 6b 20 69 73 20 73 6b 69 70 70 65 64 20 75 6e  ck is skipped un
2420: 64 65 72 20 43 79 67 77 69 6e 20 61 6e 64 20 4d  der Cygwin and M
2430: 69 6e 67 77 2e 0a 20 2a 2f 0a 0a 23 69 66 20 64  ingw.. */..#if d
2440: 65 66 69 6e 65 64 28 5f 57 49 4e 33 32 29 20 26  efined(_WIN32) &
2450: 26 20 21 64 65 66 69 6e 65 64 28 48 41 56 45 5f  & !defined(HAVE_
2460: 57 49 4e 4e 54 5f 49 47 4e 4f 52 45 5f 56 4f 49  WINNT_IGNORE_VOI
2470: 44 29 0a 23 69 66 6e 64 65 66 20 56 4f 49 44 0a  D).#ifndef VOID.
2480: 23 64 65 66 69 6e 65 20 56 4f 49 44 20 76 6f 69  #define VOID voi
2490: 64 0a 74 79 70 65 64 65 66 20 63 68 61 72 20 43  d.typedef char C
24a0: 48 41 52 3b 0a 74 79 70 65 64 65 66 20 73 68 6f  HAR;.typedef sho
24b0: 72 74 20 53 48 4f 52 54 3b 0a 74 79 70 65 64 65  rt SHORT;.typede
24c0: 66 20 6c 6f 6e 67 20 4c 4f 4e 47 3b 0a 23 65 6e  f long LONG;.#en
24d0: 64 69 66 0a 23 65 6e 64 69 66 20 2f 2a 20 5f 57  dif.#endif /* _W
24e0: 49 4e 33 32 20 26 26 20 21 48 41 56 45 5f 57 49  IN32 && !HAVE_WI
24f0: 4e 4e 54 5f 49 47 4e 4f 52 45 5f 56 4f 49 44 20  NNT_IGNORE_VOID 
2500: 2a 2f 0a 0a 2f 2a 0a 20 2a 20 4d 61 63 72 6f 20  */../*. * Macro 
2510: 74 6f 20 75 73 65 20 69 6e 73 74 65 61 64 20 6f  to use instead o
2520: 66 20 22 76 6f 69 64 22 20 66 6f 72 20 61 72 67  f "void" for arg
2530: 75 6d 65 6e 74 73 20 74 68 61 74 20 6d 75 73 74  uments that must
2540: 20 68 61 76 65 20 74 79 70 65 20 22 76 6f 69 64   have type "void
2550: 20 2a 22 0a 20 2a 20 69 6e 20 41 4e 53 49 20 43   *". * in ANSI C
2560: 3b 20 6d 61 70 73 20 74 68 65 6d 20 74 6f 20 74  ; maps them to t
2570: 79 70 65 20 22 63 68 61 72 20 2a 22 20 69 6e 20  ype "char *" in 
2580: 6e 6f 6e 2d 41 4e 53 49 20 73 79 73 74 65 6d 73  non-ANSI systems
2590: 2e 0a 20 2a 2f 0a 0a 23 69 66 6e 64 65 66 20 5f  .. */..#ifndef _
25a0: 5f 56 58 57 4f 52 4b 53 5f 5f 0a 23 20 20 20 69  _VXWORKS__.#   i
25b0: 66 6e 64 65 66 20 4e 4f 5f 56 4f 49 44 0a 23 09  fndef NO_VOID.#.
25c0: 64 65 66 69 6e 65 20 56 4f 49 44 20 76 6f 69 64  define VOID void
25d0: 0a 23 20 20 20 65 6c 73 65 0a 23 09 64 65 66 69  .#   else.#.defi
25e0: 6e 65 20 56 4f 49 44 20 63 68 61 72 0a 23 20 20  ne VOID char.#  
25f0: 20 65 6e 64 69 66 0a 23 65 6e 64 69 66 0a 0a 2f   endif.#endif../
2600: 2a 0a 20 2a 20 4d 69 73 63 65 6c 6c 61 6e 65 6f  *. * Miscellaneo
2610: 75 73 20 64 65 63 6c 61 72 61 74 69 6f 6e 73 2e  us declarations.
2620: 0a 20 2a 2f 0a 0a 23 69 66 6e 64 65 66 20 5f 43  . */..#ifndef _C
2630: 4c 49 45 4e 54 44 41 54 41 0a 23 20 20 20 69 66  LIENTDATA.#   if
2640: 6e 64 65 66 20 4e 4f 5f 56 4f 49 44 0a 09 74 79  ndef NO_VOID..ty
2650: 70 65 64 65 66 20 76 6f 69 64 20 2a 43 6c 69 65  pedef void *Clie
2660: 6e 74 44 61 74 61 3b 0a 23 20 20 20 65 6c 73 65  ntData;.#   else
2670: 0a 09 74 79 70 65 64 65 66 20 69 6e 74 20 2a 43  ..typedef int *C
2680: 6c 69 65 6e 74 44 61 74 61 3b 0a 23 20 20 20 65  lientData;.#   e
2690: 6e 64 69 66 0a 23 20 20 20 64 65 66 69 6e 65 20  ndif.#   define 
26a0: 5f 43 4c 49 45 4e 54 44 41 54 41 0a 23 65 6e 64  _CLIENTDATA.#end
26b0: 69 66 0a 0a 2f 2a 0a 20 2a 20 44 61 72 77 69 6e  if../*. * Darwin
26c0: 20 73 70 65 63 69 66 69 63 20 63 6f 6e 66 69 67   specific config
26d0: 75 72 65 20 6f 76 65 72 72 69 64 65 73 20 28 74  ure overrides (t
26e0: 6f 20 73 75 70 70 6f 72 74 20 66 61 74 20 63 6f  o support fat co
26f0: 6d 70 69 6c 65 73 2c 20 77 68 65 72 65 0a 20 2a  mpiles, where. *
2700: 20 63 6f 6e 66 69 67 75 72 65 20 72 75 6e 73 20   configure runs 
2710: 6f 6e 6c 79 20 6f 6e 63 65 20 66 6f 72 20 6d 75  only once for mu
2720: 6c 74 69 70 6c 65 20 61 72 63 68 69 74 65 63 74  ltiple architect
2730: 75 72 65 73 29 3a 0a 20 2a 2f 0a 0a 23 69 66 64  ures):. */..#ifd
2740: 65 66 20 5f 5f 41 50 50 4c 45 5f 5f 0a 23 20 20  ef __APPLE__.#  
2750: 20 69 66 64 65 66 20 5f 5f 4c 50 36 34 5f 5f 0a   ifdef __LP64__.
2760: 23 09 75 6e 64 65 66 20 54 43 4c 5f 57 49 44 45  #.undef TCL_WIDE
2770: 5f 49 4e 54 5f 54 59 50 45 0a 23 09 64 65 66 69  _INT_TYPE.#.defi
2780: 6e 65 20 54 43 4c 5f 57 49 44 45 5f 49 4e 54 5f  ne TCL_WIDE_INT_
2790: 49 53 5f 4c 4f 4e 47 20 31 0a 23 09 64 65 66 69  IS_LONG 1.#.defi
27a0: 6e 65 20 54 43 4c 5f 43 46 47 5f 44 4f 36 34 42  ne TCL_CFG_DO64B
27b0: 49 54 20 31 0a 23 20 20 20 20 65 6c 73 65 20 2f  IT 1.#    else /
27c0: 2a 20 21 5f 5f 4c 50 36 34 5f 5f 20 2a 2f 0a 23  * !__LP64__ */.#
27d0: 09 64 65 66 69 6e 65 20 54 43 4c 5f 57 49 44 45  .define TCL_WIDE
27e0: 5f 49 4e 54 5f 54 59 50 45 20 6c 6f 6e 67 20 6c  _INT_TYPE long l
27f0: 6f 6e 67 0a 23 09 75 6e 64 65 66 20 54 43 4c 5f  ong.#.undef TCL_
2800: 57 49 44 45 5f 49 4e 54 5f 49 53 5f 4c 4f 4e 47  WIDE_INT_IS_LONG
2810: 0a 23 09 75 6e 64 65 66 20 54 43 4c 5f 43 46 47  .#.undef TCL_CFG
2820: 5f 44 4f 36 34 42 49 54 0a 23 20 20 20 20 65 6e  _DO64BIT.#    en
2830: 64 69 66 20 2f 2a 20 5f 5f 4c 50 36 34 5f 5f 20  dif /* __LP64__ 
2840: 2a 2f 0a 23 20 20 20 20 75 6e 64 65 66 20 48 41  */.#    undef HA
2850: 56 45 5f 53 54 52 55 43 54 5f 53 54 41 54 36 34  VE_STRUCT_STAT64
2860: 0a 23 65 6e 64 69 66 20 2f 2a 20 5f 5f 41 50 50  .#endif /* __APP
2870: 4c 45 5f 5f 20 2a 2f 0a 0a 2f 2a 0a 20 2a 20 44  LE__ */../*. * D
2880: 65 66 69 6e 65 20 54 63 6c 5f 57 69 64 65 49 6e  efine Tcl_WideIn
2890: 74 20 74 6f 20 62 65 20 61 20 74 79 70 65 20 74  t to be a type t
28a0: 68 61 74 20 69 73 20 28 61 74 20 6c 65 61 73 74  hat is (at least
28b0: 29 20 36 34 2d 62 69 74 73 20 77 69 64 65 2c 20  ) 64-bits wide, 
28c0: 61 6e 64 20 64 65 66 69 6e 65 0a 20 2a 20 54 63  and define. * Tc
28d0: 6c 5f 57 69 64 65 55 49 6e 74 20 74 6f 20 62 65  l_WideUInt to be
28e0: 20 74 68 65 20 75 6e 73 69 67 6e 65 64 20 76 61   the unsigned va
28f0: 72 69 61 6e 74 20 6f 66 20 74 68 61 74 20 74 79  riant of that ty
2900: 70 65 20 28 61 73 73 75 6d 69 6e 67 20 74 68 61  pe (assuming tha
2910: 74 20 77 68 65 72 65 0a 20 2a 20 77 65 20 68 61  t where. * we ha
2920: 76 65 20 6f 6e 65 2c 20 77 65 20 63 61 6e 20 68  ve one, we can h
2930: 61 76 65 20 74 68 65 20 6f 74 68 65 72 2e 29 0a  ave the other.).
2940: 20 2a 0a 20 2a 20 41 6c 73 6f 20 64 65 66 69 6e   *. * Also defin
2950: 65 73 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67  es the following
2960: 20 6d 61 63 72 6f 73 3a 0a 20 2a 20 54 43 4c 5f   macros:. * TCL_
2970: 57 49 44 45 5f 49 4e 54 5f 49 53 5f 4c 4f 4e 47  WIDE_INT_IS_LONG
2980: 20 2d 20 69 66 20 77 69 64 65 20 69 6e 74 73 20   - if wide ints 
2990: 61 72 65 20 72 65 61 6c 6c 79 20 6c 6f 6e 67 73  are really longs
29a0: 20 28 69 2e 65 2e 20 77 65 27 72 65 20 6f 6e 20   (i.e. we're on 
29b0: 61 0a 20 2a 09 4c 50 36 34 20 73 79 73 74 65 6d  a. *.LP64 system
29c0: 20 73 75 63 68 20 61 73 20 6d 6f 64 65 72 6e 20   such as modern 
29d0: 53 6f 6c 61 72 69 73 20 6f 72 20 4c 69 6e 75 78  Solaris or Linux
29e0: 20 2e 2e 2e 20 6e 6f 74 20 69 6e 63 6c 75 64 69   ... not includi
29f0: 6e 67 20 57 69 6e 36 34 29 0a 20 2a 20 54 63 6c  ng Win64). * Tcl
2a00: 5f 57 69 64 65 41 73 4c 6f 6e 67 20 2d 20 66 6f  _WideAsLong - fo
2a10: 72 67 65 74 66 75 6c 20 63 6f 6e 76 65 72 74 65  rgetful converte
2a20: 72 20 66 72 6f 6d 20 77 69 64 65 49 6e 74 20 74  r from wideInt t
2a30: 6f 20 6c 6f 6e 67 2e 0a 20 2a 20 54 63 6c 5f 4c  o long.. * Tcl_L
2a40: 6f 6e 67 41 73 57 69 64 65 20 2d 20 73 69 67 6e  ongAsWide - sign
2a50: 2d 65 78 74 65 6e 64 69 6e 67 20 63 6f 6e 76 65  -extending conve
2a60: 72 74 65 72 20 66 72 6f 6d 20 6c 6f 6e 67 20 74  rter from long t
2a70: 6f 20 77 69 64 65 49 6e 74 2e 0a 20 2a 20 54 63  o wideInt.. * Tc
2a80: 6c 5f 57 69 64 65 41 73 44 6f 75 62 6c 65 20 2d  l_WideAsDouble -
2a90: 20 63 6f 6e 76 65 72 74 65 72 20 66 72 6f 6d 20   converter from 
2aa0: 77 69 64 65 49 6e 74 20 74 6f 20 64 6f 75 62 6c  wideInt to doubl
2ab0: 65 2e 0a 20 2a 20 54 63 6c 5f 44 6f 75 62 6c 65  e.. * Tcl_Double
2ac0: 41 73 57 69 64 65 20 2d 20 63 6f 6e 76 65 72 74  AsWide - convert
2ad0: 65 72 20 66 72 6f 6d 20 64 6f 75 62 6c 65 20 74  er from double t
2ae0: 6f 20 77 69 64 65 49 6e 74 2e 0a 20 2a 0a 20 2a  o wideInt.. *. *
2af0: 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 69   The following i
2b00: 6e 76 61 72 69 61 6e 74 20 73 68 6f 75 6c 64 20  nvariant should 
2b10: 68 6f 6c 64 20 66 6f 72 20 61 6e 79 20 6c 6f 6e  hold for any lon
2b20: 67 20 76 61 6c 75 65 20 27 6c 6f 6e 67 56 61 6c  g value 'longVal
2b30: 27 3a 0a 20 2a 09 6c 6f 6e 67 56 61 6c 20 3d 3d  ':. *.longVal ==
2b40: 20 54 63 6c 5f 57 69 64 65 41 73 4c 6f 6e 67 28   Tcl_WideAsLong(
2b50: 54 63 6c 5f 4c 6f 6e 67 41 73 57 69 64 65 28 6c  Tcl_LongAsWide(l
2b60: 6f 6e 67 56 61 6c 29 29 0a 20 2a 0a 20 2a 20 4e  ongVal)). *. * N
2b70: 6f 74 65 20 6f 6e 20 63 6f 6e 76 65 72 74 69 6e  ote on convertin
2b80: 67 20 62 65 74 77 65 65 6e 20 54 63 6c 5f 57 69  g between Tcl_Wi
2b90: 64 65 49 6e 74 20 61 6e 64 20 73 74 72 69 6e 67  deInt and string
2ba0: 73 2e 20 54 68 69 73 20 69 6d 70 6c 65 6d 65 6e  s. This implemen
2bb0: 74 61 74 69 6f 6e 20 28 69 6e 0a 20 2a 20 74 63  tation (in. * tc
2bc0: 6c 4f 62 6a 2e 63 29 20 64 65 70 65 6e 64 73 20  lObj.c) depends 
2bd0: 6f 6e 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 0a  on the function.
2be0: 20 2a 20 73 70 72 69 6e 74 66 28 2e 2e 2e 2c 22   * sprintf(...,"
2bf0: 25 22 20 54 43 4c 5f 4c 4c 5f 4d 4f 44 49 46 49  %" TCL_LL_MODIFI
2c00: 45 52 20 22 64 22 2c 2e 2e 2e 29 2e 0a 20 2a 2f  ER "d",...).. */
2c10: 0a 0a 23 69 66 20 21 64 65 66 69 6e 65 64 28 54  ..#if !defined(T
2c20: 43 4c 5f 57 49 44 45 5f 49 4e 54 5f 54 59 50 45  CL_WIDE_INT_TYPE
2c30: 29 26 26 21 64 65 66 69 6e 65 64 28 54 43 4c 5f  )&&!defined(TCL_
2c40: 57 49 44 45 5f 49 4e 54 5f 49 53 5f 4c 4f 4e 47  WIDE_INT_IS_LONG
2c50: 29 0a 23 20 20 20 69 66 64 65 66 20 5f 57 49 4e  ).#   ifdef _WIN
2c60: 33 32 0a 23 09 64 65 66 69 6e 65 20 54 43 4c 5f  32.#.define TCL_
2c70: 57 49 44 45 5f 49 4e 54 5f 54 59 50 45 20 5f 5f  WIDE_INT_TYPE __
2c80: 69 6e 74 36 34 0a 23 09 69 66 64 65 66 20 5f 5f  int64.#.ifdef __
2c90: 42 4f 52 4c 41 4e 44 43 5f 5f 0a 23 09 20 20 20  BORLANDC__.#.   
2ca0: 20 64 65 66 69 6e 65 20 54 43 4c 5f 4c 4c 5f 4d   define TCL_LL_M
2cb0: 4f 44 49 46 49 45 52 09 22 4c 22 0a 23 09 65 6c  ODIFIER."L".#.el
2cc0: 69 66 20 64 65 66 69 6e 65 64 28 5f 57 49 4e 33  if defined(_WIN3
2cd0: 32 29 20 26 26 20 28 21 64 65 66 69 6e 65 64 28  2) && (!defined(
2ce0: 5f 5f 55 53 45 5f 4d 49 4e 47 57 5f 41 4e 53 49  __USE_MINGW_ANSI
2cf0: 5f 53 54 44 49 4f 29 20 7c 7c 20 21 5f 5f 55 53  _STDIO) || !__US
2d00: 45 5f 4d 49 4e 47 57 5f 41 4e 53 49 5f 53 54 44  E_MINGW_ANSI_STD
2d10: 49 4f 29 0a 23 09 20 20 20 20 64 65 66 69 6e 65  IO).#.    define
2d20: 20 54 43 4c 5f 4c 4c 5f 4d 4f 44 49 46 49 45 52   TCL_LL_MODIFIER
2d30: 09 22 49 36 34 22 0a 23 09 65 6c 73 65 0a 23 09  ."I64".#.else.#.
2d40: 20 20 20 20 64 65 66 69 6e 65 20 54 43 4c 5f 4c      define TCL_L
2d50: 4c 5f 4d 4f 44 49 46 49 45 52 09 22 6c 6c 22 0a  L_MODIFIER."ll".
2d60: 23 09 65 6e 64 69 66 0a 23 20 20 20 65 6c 69 66  #.endif.#   elif
2d70: 20 64 65 66 69 6e 65 64 28 5f 5f 47 4e 55 43 5f   defined(__GNUC_
2d80: 5f 29 0a 23 20 20 20 20 20 20 64 65 66 69 6e 65  _).#      define
2d90: 20 54 43 4c 5f 57 49 44 45 5f 49 4e 54 5f 54 59   TCL_WIDE_INT_TY
2da0: 50 45 20 6c 6f 6e 67 20 6c 6f 6e 67 0a 23 20 20  PE long long.#  
2db0: 20 20 20 20 64 65 66 69 6e 65 20 54 43 4c 5f 4c      define TCL_L
2dc0: 4c 5f 4d 4f 44 49 46 49 45 52 09 22 6c 6c 22 0a  L_MODIFIER."ll".
2dd0: 23 20 20 20 65 6c 73 65 20 2f 2a 20 21 20 5f 57  #   else /* ! _W
2de0: 49 4e 33 32 20 26 26 20 21 20 5f 5f 47 4e 55 43  IN32 && ! __GNUC
2df0: 5f 5f 20 2a 2f 0a 2f 2a 0a 20 2a 20 44 6f 6e 27  __ */./*. * Don'
2e00: 74 20 6b 6e 6f 77 20 77 68 61 74 20 70 6c 61 74  t know what plat
2e10: 66 6f 72 6d 20 69 74 20 69 73 20 61 6e 64 20 63  form it is and c
2e20: 6f 6e 66 69 67 75 72 65 20 68 61 73 6e 27 74 20  onfigure hasn't 
2e30: 64 69 73 63 6f 76 65 72 65 64 20 77 68 61 74 20  discovered what 
2e40: 69 73 0a 20 2a 20 67 6f 69 6e 67 20 6f 6e 20 66  is. * going on f
2e50: 6f 72 20 75 73 2e 20 54 72 79 20 74 6f 20 67 75  or us. Try to gu
2e60: 65 73 73 2e 2e 2e 0a 20 2a 2f 0a 23 20 20 20 20  ess.... */.#    
2e70: 20 20 69 6e 63 6c 75 64 65 20 3c 6c 69 6d 69 74    include <limit
2e80: 73 2e 68 3e 0a 23 20 20 20 20 20 20 69 66 20 28  s.h>.#      if (
2e90: 49 4e 54 5f 4d 41 58 20 3c 20 4c 4f 4e 47 5f 4d  INT_MAX < LONG_M
2ea0: 41 58 29 0a 23 20 20 20 20 20 20 20 20 20 64 65  AX).#         de
2eb0: 66 69 6e 65 20 54 43 4c 5f 57 49 44 45 5f 49 4e  fine TCL_WIDE_IN
2ec0: 54 5f 49 53 5f 4c 4f 4e 47 09 31 0a 23 20 20 20  T_IS_LONG.1.#   
2ed0: 20 20 20 65 6c 73 65 0a 23 20 20 20 20 20 20 20     else.#       
2ee0: 20 20 64 65 66 69 6e 65 20 54 43 4c 5f 57 49 44    define TCL_WID
2ef0: 45 5f 49 4e 54 5f 54 59 50 45 20 6c 6f 6e 67 20  E_INT_TYPE long 
2f00: 6c 6f 6e 67 0a 23 20 20 20 20 20 20 65 6e 64 69  long.#      endi
2f10: 66 0a 23 20 20 20 65 6e 64 69 66 20 2f 2a 20 5f  f.#   endif /* _
2f20: 57 49 4e 33 32 20 2a 2f 0a 23 65 6e 64 69 66 20  WIN32 */.#endif 
2f30: 2f 2a 20 21 54 43 4c 5f 57 49 44 45 5f 49 4e 54  /* !TCL_WIDE_INT
2f40: 5f 54 59 50 45 20 26 20 21 54 43 4c 5f 57 49 44  _TYPE & !TCL_WID
2f50: 45 5f 49 4e 54 5f 49 53 5f 4c 4f 4e 47 20 2a 2f  E_INT_IS_LONG */
2f60: 0a 23 69 66 64 65 66 20 54 43 4c 5f 57 49 44 45  .#ifdef TCL_WIDE
2f70: 5f 49 4e 54 5f 49 53 5f 4c 4f 4e 47 0a 23 20 20  _INT_IS_LONG.#  
2f80: 20 75 6e 64 65 66 20 54 43 4c 5f 57 49 44 45 5f   undef TCL_WIDE_
2f90: 49 4e 54 5f 54 59 50 45 0a 23 20 20 20 64 65 66  INT_TYPE.#   def
2fa0: 69 6e 65 20 54 43 4c 5f 57 49 44 45 5f 49 4e 54  ine TCL_WIDE_INT
2fb0: 5f 54 59 50 45 09 6c 6f 6e 67 0a 23 65 6e 64 69  _TYPE.long.#endi
2fc0: 66 20 2f 2a 20 54 43 4c 5f 57 49 44 45 5f 49 4e  f /* TCL_WIDE_IN
2fd0: 54 5f 49 53 5f 4c 4f 4e 47 20 2a 2f 0a 0a 74 79  T_IS_LONG */..ty
2fe0: 70 65 64 65 66 20 54 43 4c 5f 57 49 44 45 5f 49  pedef TCL_WIDE_I
2ff0: 4e 54 5f 54 59 50 45 09 09 54 63 6c 5f 57 69 64  NT_TYPE..Tcl_Wid
3000: 65 49 6e 74 3b 0a 74 79 70 65 64 65 66 20 75 6e  eInt;.typedef un
3010: 73 69 67 6e 65 64 20 54 43 4c 5f 57 49 44 45 5f  signed TCL_WIDE_
3020: 49 4e 54 5f 54 59 50 45 09 54 63 6c 5f 57 69 64  INT_TYPE.Tcl_Wid
3030: 65 55 49 6e 74 3b 0a 0a 23 69 66 64 65 66 20 54  eUInt;..#ifdef T
3040: 43 4c 5f 57 49 44 45 5f 49 4e 54 5f 49 53 5f 4c  CL_WIDE_INT_IS_L
3050: 4f 4e 47 0a 23 20 20 20 64 65 66 69 6e 65 20 54  ONG.#   define T
3060: 63 6c 5f 57 69 64 65 41 73 4c 6f 6e 67 28 76 61  cl_WideAsLong(va
3070: 6c 29 09 09 28 28 6c 6f 6e 67 29 28 76 61 6c 29  l)..((long)(val)
3080: 29 0a 23 20 20 20 64 65 66 69 6e 65 20 54 63 6c  ).#   define Tcl
3090: 5f 4c 6f 6e 67 41 73 57 69 64 65 28 76 61 6c 29  _LongAsWide(val)
30a0: 09 09 28 28 6c 6f 6e 67 29 28 76 61 6c 29 29 0a  ..((long)(val)).
30b0: 23 20 20 20 64 65 66 69 6e 65 20 54 63 6c 5f 57  #   define Tcl_W
30c0: 69 64 65 41 73 44 6f 75 62 6c 65 28 76 61 6c 29  ideAsDouble(val)
30d0: 09 28 28 64 6f 75 62 6c 65 29 28 28 6c 6f 6e 67  .((double)((long
30e0: 29 28 76 61 6c 29 29 29 0a 23 20 20 20 64 65 66  )(val))).#   def
30f0: 69 6e 65 20 54 63 6c 5f 44 6f 75 62 6c 65 41 73  ine Tcl_DoubleAs
3100: 57 69 64 65 28 76 61 6c 29 09 28 28 6c 6f 6e 67  Wide(val).((long
3110: 29 28 28 64 6f 75 62 6c 65 29 28 76 61 6c 29 29  )((double)(val))
3120: 29 0a 23 20 20 20 69 66 6e 64 65 66 20 54 43 4c  ).#   ifndef TCL
3130: 5f 4c 4c 5f 4d 4f 44 49 46 49 45 52 0a 23 20 20  _LL_MODIFIER.#  
3140: 20 20 20 20 64 65 66 69 6e 65 20 54 43 4c 5f 4c      define TCL_L
3150: 4c 5f 4d 4f 44 49 46 49 45 52 09 09 22 6c 22 0a  L_MODIFIER.."l".
3160: 23 20 20 20 65 6e 64 69 66 20 2f 2a 20 21 54 43  #   endif /* !TC
3170: 4c 5f 4c 4c 5f 4d 4f 44 49 46 49 45 52 20 2a 2f  L_LL_MODIFIER */
3180: 0a 23 65 6c 73 65 20 2f 2a 20 54 43 4c 5f 57 49  .#else /* TCL_WI
3190: 44 45 5f 49 4e 54 5f 49 53 5f 4c 4f 4e 47 20 2a  DE_INT_IS_LONG *
31a0: 2f 0a 2f 2a 0a 20 2a 20 54 68 65 20 6e 65 78 74  /./*. * The next
31b0: 20 73 68 6f 72 74 20 73 65 63 74 69 6f 6e 20 6f   short section o
31c0: 66 20 64 65 66 69 6e 65 73 20 61 72 65 20 6f 6e  f defines are on
31d0: 6c 79 20 64 6f 6e 65 20 77 68 65 6e 20 6e 6f 74  ly done when not
31e0: 20 72 75 6e 6e 69 6e 67 20 6f 6e 20 57 69 6e 64   running on Wind
31f0: 6f 77 73 0a 20 2a 20 6f 72 20 73 6f 6d 65 20 6f  ows. * or some o
3200: 74 68 65 72 20 73 74 72 61 6e 67 65 20 70 6c 61  ther strange pla
3210: 74 66 6f 72 6d 2e 0a 20 2a 2f 0a 23 20 20 20 69  tform.. */.#   i
3220: 66 6e 64 65 66 20 54 43 4c 5f 4c 4c 5f 4d 4f 44  fndef TCL_LL_MOD
3230: 49 46 49 45 52 0a 23 20 20 20 20 20 20 64 65 66  IFIER.#      def
3240: 69 6e 65 20 54 43 4c 5f 4c 4c 5f 4d 4f 44 49 46  ine TCL_LL_MODIF
3250: 49 45 52 09 09 22 6c 6c 22 0a 23 20 20 20 65 6e  IER.."ll".#   en
3260: 64 69 66 20 2f 2a 20 21 54 43 4c 5f 4c 4c 5f 4d  dif /* !TCL_LL_M
3270: 4f 44 49 46 49 45 52 20 2a 2f 0a 23 20 20 20 64  ODIFIER */.#   d
3280: 65 66 69 6e 65 20 54 63 6c 5f 57 69 64 65 41 73  efine Tcl_WideAs
3290: 4c 6f 6e 67 28 76 61 6c 29 09 09 28 28 6c 6f 6e  Long(val)..((lon
32a0: 67 29 28 28 54 63 6c 5f 57 69 64 65 49 6e 74 29  g)((Tcl_WideInt)
32b0: 28 76 61 6c 29 29 29 0a 23 20 20 20 64 65 66 69  (val))).#   defi
32c0: 6e 65 20 54 63 6c 5f 4c 6f 6e 67 41 73 57 69 64  ne Tcl_LongAsWid
32d0: 65 28 76 61 6c 29 09 09 28 28 54 63 6c 5f 57 69  e(val)..((Tcl_Wi
32e0: 64 65 49 6e 74 29 28 28 6c 6f 6e 67 29 28 76 61  deInt)((long)(va
32f0: 6c 29 29 29 0a 23 20 20 20 64 65 66 69 6e 65 20  l))).#   define 
3300: 54 63 6c 5f 57 69 64 65 41 73 44 6f 75 62 6c 65  Tcl_WideAsDouble
3310: 28 76 61 6c 29 09 28 28 64 6f 75 62 6c 65 29 28  (val).((double)(
3320: 28 54 63 6c 5f 57 69 64 65 49 6e 74 29 28 76 61  (Tcl_WideInt)(va
3330: 6c 29 29 29 0a 23 20 20 20 64 65 66 69 6e 65 20  l))).#   define 
3340: 54 63 6c 5f 44 6f 75 62 6c 65 41 73 57 69 64 65  Tcl_DoubleAsWide
3350: 28 76 61 6c 29 09 28 28 54 63 6c 5f 57 69 64 65  (val).((Tcl_Wide
3360: 49 6e 74 29 28 28 64 6f 75 62 6c 65 29 28 76 61  Int)((double)(va
3370: 6c 29 29 29 0a 23 65 6e 64 69 66 20 2f 2a 20 54  l))).#endif /* T
3380: 43 4c 5f 57 49 44 45 5f 49 4e 54 5f 49 53 5f 4c  CL_WIDE_INT_IS_L
3390: 4f 4e 47 20 2a 2f 0a 0a 23 69 66 64 65 66 20 5f  ONG */..#ifdef _
33a0: 57 49 4e 33 32 0a 23 20 20 20 69 66 64 65 66 20  WIN32.#   ifdef 
33b0: 5f 5f 42 4f 52 4c 41 4e 44 43 5f 5f 0a 09 74 79  __BORLANDC__..ty
33c0: 70 65 64 65 66 20 73 74 72 75 63 74 20 73 74 61  pedef struct sta
33d0: 74 69 36 34 20 54 63 6c 5f 53 74 61 74 42 75 66  ti64 Tcl_StatBuf
33e0: 3b 0a 23 20 20 20 65 6c 69 66 20 64 65 66 69 6e  ;.#   elif defin
33f0: 65 64 28 5f 57 49 4e 36 34 29 20 7c 7c 20 64 65  ed(_WIN64) || de
3400: 66 69 6e 65 64 28 5f 55 53 45 5f 36 34 42 49 54  fined(_USE_64BIT
3410: 5f 54 49 4d 45 5f 54 29 0a 09 74 79 70 65 64 65  _TIME_T)..typede
3420: 66 20 73 74 72 75 63 74 20 5f 5f 73 74 61 74 36  f struct __stat6
3430: 34 20 54 63 6c 5f 53 74 61 74 42 75 66 3b 0a 23  4 Tcl_StatBuf;.#
3440: 20 20 20 65 6c 69 66 20 28 64 65 66 69 6e 65 64     elif (defined
3450: 28 5f 4d 53 43 5f 56 45 52 29 20 26 26 20 28 5f  (_MSC_VER) && (_
3460: 4d 53 43 5f 56 45 52 20 3c 20 31 34 30 30 29 29  MSC_VER < 1400))
3470: 20 7c 7c 20 64 65 66 69 6e 65 64 28 5f 55 53 45   || defined(_USE
3480: 5f 33 32 42 49 54 5f 54 49 4d 45 5f 54 29 0a 09  _32BIT_TIME_T)..
3490: 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20 5f  typedef struct _
34a0: 73 74 61 74 69 36 34 09 54 63 6c 5f 53 74 61 74  stati64.Tcl_Stat
34b0: 42 75 66 3b 0a 23 20 20 20 65 6c 73 65 0a 09 74  Buf;.#   else..t
34c0: 79 70 65 64 65 66 20 73 74 72 75 63 74 20 5f 73  ypedef struct _s
34d0: 74 61 74 33 32 69 36 34 20 54 63 6c 5f 53 74 61  tat32i64 Tcl_Sta
34e0: 74 42 75 66 3b 0a 23 20 20 20 65 6e 64 69 66 20  tBuf;.#   endif 
34f0: 2f 2a 20 5f 4d 53 43 5f 56 45 52 20 3c 20 31 34  /* _MSC_VER < 14
3500: 30 30 20 2a 2f 0a 23 65 6c 69 66 20 64 65 66 69  00 */.#elif defi
3510: 6e 65 64 28 5f 5f 43 59 47 57 49 4e 5f 5f 29 0a  ned(__CYGWIN__).
3520: 20 20 20 20 74 79 70 65 64 65 66 20 73 74 72 75      typedef stru
3530: 63 74 20 7b 0a 09 64 65 76 5f 74 20 73 74 5f 64  ct {..dev_t st_d
3540: 65 76 3b 0a 09 75 6e 73 69 67 6e 65 64 20 73 68  ev;..unsigned sh
3550: 6f 72 74 20 73 74 5f 69 6e 6f 3b 0a 09 75 6e 73  ort st_ino;..uns
3560: 69 67 6e 65 64 20 73 68 6f 72 74 20 73 74 5f 6d  igned short st_m
3570: 6f 64 65 3b 0a 09 73 68 6f 72 74 20 73 74 5f 6e  ode;..short st_n
3580: 6c 69 6e 6b 3b 0a 09 73 68 6f 72 74 20 73 74 5f  link;..short st_
3590: 75 69 64 3b 0a 09 73 68 6f 72 74 20 73 74 5f 67  uid;..short st_g
35a0: 69 64 3b 0a 09 2f 2a 20 48 65 72 65 20 69 73 20  id;../* Here is 
35b0: 61 20 32 2d 62 79 74 65 20 67 61 70 20 2a 2f 0a  a 2-byte gap */.
35c0: 09 64 65 76 5f 74 20 73 74 5f 72 64 65 76 3b 0a  .dev_t st_rdev;.
35d0: 09 2f 2a 20 48 65 72 65 20 69 73 20 61 20 34 2d  ./* Here is a 4-
35e0: 62 79 74 65 20 67 61 70 20 2a 2f 0a 09 6c 6f 6e  byte gap */..lon
35f0: 67 20 6c 6f 6e 67 20 73 74 5f 73 69 7a 65 3b 0a  g long st_size;.
3600: 09 73 74 72 75 63 74 20 7b 6c 6f 6e 67 20 74 76  .struct {long tv
3610: 5f 73 65 63 3b 7d 20 73 74 5f 61 74 69 6d 3b 0a  _sec;} st_atim;.
3620: 09 73 74 72 75 63 74 20 7b 6c 6f 6e 67 20 74 76  .struct {long tv
3630: 5f 73 65 63 3b 7d 20 73 74 5f 6d 74 69 6d 3b 0a  _sec;} st_mtim;.
3640: 09 73 74 72 75 63 74 20 7b 6c 6f 6e 67 20 74 76  .struct {long tv
3650: 5f 73 65 63 3b 7d 20 73 74 5f 63 74 69 6d 3b 0a  _sec;} st_ctim;.
3660: 09 2f 2a 20 48 65 72 65 20 69 73 20 61 20 34 2d  ./* Here is a 4-
3670: 62 79 74 65 20 67 61 70 20 2a 2f 0a 20 20 20 20  byte gap */.    
3680: 7d 20 54 63 6c 5f 53 74 61 74 42 75 66 3b 0a 23  } Tcl_StatBuf;.#
3690: 65 6c 69 66 20 64 65 66 69 6e 65 64 28 48 41 56  elif defined(HAV
36a0: 45 5f 53 54 52 55 43 54 5f 53 54 41 54 36 34 29  E_STRUCT_STAT64)
36b0: 20 26 26 20 21 64 65 66 69 6e 65 64 28 5f 5f 41   && !defined(__A
36c0: 50 50 4c 45 5f 5f 29 0a 20 20 20 20 74 79 70 65  PPLE__).    type
36d0: 64 65 66 20 73 74 72 75 63 74 20 73 74 61 74 36  def struct stat6
36e0: 34 20 54 63 6c 5f 53 74 61 74 42 75 66 3b 0a 23  4 Tcl_StatBuf;.#
36f0: 65 6c 73 65 0a 20 20 20 20 74 79 70 65 64 65 66  else.    typedef
3700: 20 73 74 72 75 63 74 20 73 74 61 74 20 54 63 6c   struct stat Tcl
3710: 5f 53 74 61 74 42 75 66 3b 0a 23 65 6e 64 69 66  _StatBuf;.#endif
3720: 0a 0c 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d  .../*. *--------
3730: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3740: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3750: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3760: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3770: 2d 2d 2d 2d 0a 20 2a 20 44 61 74 61 20 73 74 72  ----. * Data str
3780: 75 63 74 75 72 65 73 20 64 65 66 69 6e 65 64 20  uctures defined 
3790: 6f 70 61 71 75 65 6c 79 20 69 6e 20 74 68 69 73  opaquely in this
37a0: 20 6d 6f 64 75 6c 65 2e 20 54 68 65 20 64 65 66   module. The def
37b0: 69 6e 69 74 69 6f 6e 73 20 62 65 6c 6f 77 20 6a  initions below j
37c0: 75 73 74 0a 20 2a 20 70 72 6f 76 69 64 65 20 64  ust. * provide d
37d0: 75 6d 6d 79 20 74 79 70 65 73 2e 20 41 20 66 65  ummy types. A fe
37e0: 77 20 66 69 65 6c 64 73 20 61 72 65 20 6d 61 64  w fields are mad
37f0: 65 20 76 69 73 69 62 6c 65 20 69 6e 20 54 63 6c  e visible in Tcl
3800: 5f 49 6e 74 65 72 70 0a 20 2a 20 73 74 72 75 63  _Interp. * struc
3810: 74 75 72 65 73 2c 20 6e 61 6d 65 6c 79 20 74 68  tures, namely th
3820: 6f 73 65 20 75 73 65 64 20 66 6f 72 20 72 65 74  ose used for ret
3830: 75 72 6e 69 6e 67 20 61 20 73 74 72 69 6e 67 20  urning a string 
3840: 72 65 73 75 6c 74 20 66 72 6f 6d 20 63 6f 6d 6d  result from comm
3850: 61 6e 64 73 2e 0a 20 2a 20 44 69 72 65 63 74 20  ands.. * Direct 
3860: 61 63 63 65 73 73 20 74 6f 20 74 68 65 20 72 65  access to the re
3870: 73 75 6c 74 20 66 69 65 6c 64 20 69 73 20 64 69  sult field is di
3880: 73 63 6f 75 72 61 67 65 64 20 69 6e 20 54 63 6c  scouraged in Tcl
3890: 20 38 2e 30 2e 20 54 68 65 0a 20 2a 20 69 6e 74   8.0. The. * int
38a0: 65 72 70 72 65 74 65 72 20 72 65 73 75 6c 74 20  erpreter result 
38b0: 69 73 20 65 69 74 68 65 72 20 61 6e 20 6f 62 6a  is either an obj
38c0: 65 63 74 20 6f 72 20 61 20 73 74 72 69 6e 67 2c  ect or a string,
38d0: 20 61 6e 64 20 74 68 65 20 74 77 6f 20 76 61 6c   and the two val
38e0: 75 65 73 20 61 72 65 0a 20 2a 20 6b 65 70 74 20  ues are. * kept 
38f0: 63 6f 6e 73 69 73 74 65 6e 74 20 75 6e 6c 65 73  consistent unles
3900: 73 20 73 6f 6d 65 20 43 20 63 6f 64 65 20 73 65  s some C code se
3910: 74 73 20 69 6e 74 65 72 70 2d 3e 72 65 73 75 6c  ts interp->resul
3920: 74 20 64 69 72 65 63 74 6c 79 2e 0a 20 2a 20 50  t directly.. * P
3930: 72 6f 67 72 61 6d 6d 65 72 73 20 73 68 6f 75 6c  rogrammers shoul
3940: 64 20 75 73 65 20 65 69 74 68 65 72 20 74 68 65  d use either the
3950: 20 66 75 6e 63 74 69 6f 6e 20 54 63 6c 5f 47 65   function Tcl_Ge
3960: 74 4f 62 6a 52 65 73 75 6c 74 28 29 20 6f 72 0a  tObjResult() or.
3970: 20 2a 20 54 63 6c 5f 47 65 74 53 74 72 69 6e 67   * Tcl_GetString
3980: 52 65 73 75 6c 74 28 29 20 74 6f 20 72 65 61 64  Result() to read
3990: 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72   the interpreter
39a0: 27 73 20 72 65 73 75 6c 74 2e 20 53 65 65 20 74  's result. See t
39b0: 68 65 20 53 65 74 52 65 73 75 6c 74 0a 20 2a 20  he SetResult. * 
39c0: 6d 61 6e 20 70 61 67 65 20 66 6f 72 20 64 65 74  man page for det
39d0: 61 69 6c 73 2e 0a 20 2a 0a 20 2a 20 4e 6f 74 65  ails.. *. * Note
39e0: 3a 20 61 6e 79 20 63 68 61 6e 67 65 20 74 6f 20  : any change to 
39f0: 74 68 65 20 54 63 6c 5f 49 6e 74 65 72 70 20 64  the Tcl_Interp d
3a00: 65 66 69 6e 69 74 69 6f 6e 20 62 65 6c 6f 77 20  efinition below 
3a10: 6d 75 73 74 20 62 65 20 6d 69 72 72 6f 72 65 64  must be mirrored
3a20: 20 69 6e 20 74 68 65 0a 20 2a 20 22 72 65 61 6c   in the. * "real
3a30: 22 20 64 65 66 69 6e 69 74 69 6f 6e 20 69 6e 20  " definition in 
3a40: 74 63 6c 49 6e 74 2e 68 2e 0a 20 2a 0a 20 2a 20  tclInt.h.. *. * 
3a50: 4e 6f 74 65 3a 20 54 63 6c 5f 4f 62 6a 43 6d 64  Note: Tcl_ObjCmd
3a60: 50 72 6f 63 20 66 75 6e 63 74 69 6f 6e 73 20 64  Proc functions d
3a70: 6f 20 6e 6f 74 20 64 69 72 65 63 74 6c 79 20 73  o not directly s
3a80: 65 74 20 72 65 73 75 6c 74 20 61 6e 64 20 66 72  et result and fr
3a90: 65 65 50 72 6f 63 2e 0a 20 2a 20 49 6e 73 74 65  eeProc.. * Inste
3aa0: 61 64 2c 20 74 68 65 79 20 73 65 74 20 61 20 54  ad, they set a T
3ab0: 63 6c 5f 4f 62 6a 20 6d 65 6d 62 65 72 20 69 6e  cl_Obj member in
3ac0: 20 74 68 65 20 22 72 65 61 6c 22 20 73 74 72 75   the "real" stru
3ad0: 63 74 75 72 65 20 74 68 61 74 20 63 61 6e 20 62  cture that can b
3ae0: 65 0a 20 2a 20 61 63 63 65 73 73 65 64 20 77 69  e. * accessed wi
3af0: 74 68 20 54 63 6c 5f 47 65 74 4f 62 6a 52 65 73  th Tcl_GetObjRes
3b00: 75 6c 74 28 29 20 61 6e 64 20 54 63 6c 5f 53 65  ult() and Tcl_Se
3b10: 74 4f 62 6a 52 65 73 75 6c 74 28 29 2e 0a 20 2a  tObjResult().. *
3b20: 2f 0a 0a 74 79 70 65 64 65 66 20 73 74 72 75 63  /..typedef struc
3b30: 74 20 54 63 6c 5f 49 6e 74 65 72 70 0a 23 69 66  t Tcl_Interp.#if
3b40: 20 21 64 65 66 69 6e 65 64 28 54 43 4c 5f 4e 4f   !defined(TCL_NO
3b50: 5f 44 45 50 52 45 43 41 54 45 44 29 20 26 26 20  _DEPRECATED) && 
3b60: 54 43 4c 5f 4d 41 4a 4f 52 5f 56 45 52 53 49 4f  TCL_MAJOR_VERSIO
3b70: 4e 20 3c 20 39 0a 7b 0a 20 20 20 20 2f 2a 20 54  N < 9.{.    /* T
3b80: 49 50 20 23 33 33 30 3a 20 53 74 72 6f 6e 67 6c  IP #330: Strongl
3b90: 79 20 64 69 73 63 6f 75 72 61 67 65 20 65 78 74  y discourage ext
3ba0: 65 6e 73 69 6f 6e 73 20 66 72 6f 6d 20 75 73 69  ensions from usi
3bb0: 6e 67 20 74 68 65 20 73 74 72 69 6e 67 0a 20 20  ng the string.  
3bc0: 20 20 20 2a 20 72 65 73 75 6c 74 2e 20 2a 2f 0a     * result. */.
3bd0: 23 69 66 64 65 66 20 55 53 45 5f 49 4e 54 45 52  #ifdef USE_INTER
3be0: 50 5f 52 45 53 55 4c 54 0a 20 20 20 20 63 68 61  P_RESULT.    cha
3bf0: 72 20 2a 72 65 73 75 6c 74 20 54 43 4c 5f 44 45  r *result TCL_DE
3c00: 50 52 45 43 41 54 45 44 5f 41 50 49 28 22 75 73  PRECATED_API("us
3c10: 65 20 54 63 6c 5f 47 65 74 53 74 72 69 6e 67 52  e Tcl_GetStringR
3c20: 65 73 75 6c 74 2f 54 63 6c 5f 53 65 74 52 65 73  esult/Tcl_SetRes
3c30: 75 6c 74 22 29 3b 0a 09 09 09 09 2f 2a 20 49 66  ult");...../* If
3c40: 20 74 68 65 20 6c 61 73 74 20 63 6f 6d 6d 61 6e   the last comman
3c50: 64 20 72 65 74 75 72 6e 65 64 20 61 20 73 74 72  d returned a str
3c60: 69 6e 67 0a 09 09 09 09 20 2a 20 72 65 73 75 6c  ing..... * resul
3c70: 74 2c 20 74 68 69 73 20 70 6f 69 6e 74 73 20 74  t, this points t
3c80: 6f 20 69 74 2e 20 2a 2f 0a 20 20 20 20 76 6f 69  o it. */.    voi
3c90: 64 20 28 2a 66 72 65 65 50 72 6f 63 29 20 28 63  d (*freeProc) (c
3ca0: 68 61 72 20 2a 62 6c 6f 63 6b 50 74 72 29 0a 09  har *blockPtr)..
3cb0: 20 20 20 20 54 43 4c 5f 44 45 50 52 45 43 41 54      TCL_DEPRECAT
3cc0: 45 44 5f 41 50 49 28 22 75 73 65 20 54 63 6c 5f  ED_API("use Tcl_
3cd0: 47 65 74 53 74 72 69 6e 67 52 65 73 75 6c 74 2f  GetStringResult/
3ce0: 54 63 6c 5f 53 65 74 52 65 73 75 6c 74 22 29 3b  Tcl_SetResult");
3cf0: 0a 09 09 09 09 2f 2a 20 5a 65 72 6f 20 6d 65 61  ...../* Zero mea
3d00: 6e 73 20 74 68 65 20 73 74 72 69 6e 67 20 72 65  ns the string re
3d10: 73 75 6c 74 20 69 73 20 73 74 61 74 69 63 61 6c  sult is statical
3d20: 6c 79 0a 09 09 09 09 20 2a 20 61 6c 6c 6f 63 61  ly..... * alloca
3d30: 74 65 64 2e 20 54 43 4c 5f 44 59 4e 41 4d 49 43  ted. TCL_DYNAMIC
3d40: 20 6d 65 61 6e 73 20 69 74 20 77 61 73 0a 09 09   means it was...
3d50: 09 09 20 2a 20 61 6c 6c 6f 63 61 74 65 64 20 77  .. * allocated w
3d60: 69 74 68 20 63 6b 61 6c 6c 6f 63 20 61 6e 64 20  ith ckalloc and 
3d70: 73 68 6f 75 6c 64 20 62 65 20 66 72 65 65 64 0a  should be freed.
3d80: 09 09 09 09 20 2a 20 77 69 74 68 20 63 6b 66 72  .... * with ckfr
3d90: 65 65 2e 20 4f 74 68 65 72 20 76 61 6c 75 65 73  ee. Other values
3da0: 20 67 69 76 65 20 74 68 65 20 61 64 64 72 65 73   give the addres
3db0: 73 0a 09 09 09 09 20 2a 20 6f 66 20 66 75 6e 63  s..... * of func
3dc0: 74 69 6f 6e 20 74 6f 20 69 6e 76 6f 6b 65 20 74  tion to invoke t
3dd0: 6f 20 66 72 65 65 20 74 68 65 20 72 65 73 75 6c  o free the resul
3de0: 74 2e 0a 09 09 09 09 20 2a 20 54 63 6c 5f 45 76  t...... * Tcl_Ev
3df0: 61 6c 20 6d 75 73 74 20 66 72 65 65 20 69 74 20  al must free it 
3e00: 62 65 66 6f 72 65 20 65 78 65 63 75 74 69 6e 67  before executing
3e10: 20 6e 65 78 74 0a 09 09 09 09 20 2a 20 63 6f 6d   next..... * com
3e20: 6d 61 6e 64 2e 20 2a 2f 0a 23 65 6c 73 65 0a 20  mand. */.#else. 
3e30: 20 20 20 63 68 61 72 20 2a 72 65 73 75 6c 74 44     char *resultD
3e40: 6f 6e 74 55 73 65 3b 20 2f 2a 20 44 6f 6e 27 74  ontUse; /* Don't
3e50: 20 75 73 65 20 69 6e 20 65 78 74 65 6e 73 69 6f   use in extensio
3e60: 6e 73 21 20 2a 2f 0a 20 20 20 20 76 6f 69 64 20  ns! */.    void 
3e70: 28 2a 66 72 65 65 50 72 6f 63 44 6f 6e 74 55 73  (*freeProcDontUs
3e80: 65 29 20 28 63 68 61 72 20 2a 29 3b 20 2f 2a 20  e) (char *); /* 
3e90: 44 6f 6e 27 74 20 75 73 65 20 69 6e 20 65 78 74  Don't use in ext
3ea0: 65 6e 73 69 6f 6e 73 21 20 2a 2f 0a 23 65 6e 64  ensions! */.#end
3eb0: 69 66 0a 23 69 66 64 65 66 20 55 53 45 5f 49 4e  if.#ifdef USE_IN
3ec0: 54 45 52 50 5f 45 52 52 4f 52 4c 49 4e 45 0a 20  TERP_ERRORLINE. 
3ed0: 20 20 20 69 6e 74 20 65 72 72 6f 72 4c 69 6e 65     int errorLine
3ee0: 20 54 43 4c 5f 44 45 50 52 45 43 41 54 45 44 5f   TCL_DEPRECATED_
3ef0: 41 50 49 28 22 75 73 65 20 54 63 6c 5f 47 65 74  API("use Tcl_Get
3f00: 45 72 72 6f 72 4c 69 6e 65 2f 54 63 6c 5f 53 65  ErrorLine/Tcl_Se
3f10: 74 45 72 72 6f 72 4c 69 6e 65 22 29 3b 0a 09 09  tErrorLine");...
3f20: 09 09 2f 2a 20 57 68 65 6e 20 54 43 4c 5f 45 52  ../* When TCL_ER
3f30: 52 4f 52 20 69 73 20 72 65 74 75 72 6e 65 64 2c  ROR is returned,
3f40: 20 74 68 69 73 20 67 69 76 65 73 20 74 68 65 0a   this gives the.
3f50: 09 09 09 09 20 2a 20 6c 69 6e 65 20 6e 75 6d 62  .... * line numb
3f60: 65 72 20 77 69 74 68 69 6e 20 74 68 65 20 63 6f  er within the co
3f70: 6d 6d 61 6e 64 20 77 68 65 72 65 20 74 68 65 0a  mmand where the.
3f80: 09 09 09 09 20 2a 20 65 72 72 6f 72 20 6f 63 63  .... * error occ
3f90: 75 72 72 65 64 20 28 31 20 69 66 20 66 69 72 73  urred (1 if firs
3fa0: 74 20 6c 69 6e 65 29 2e 20 2a 2f 0a 23 65 6c 73  t line). */.#els
3fb0: 65 0a 20 20 20 20 69 6e 74 20 65 72 72 6f 72 4c  e.    int errorL
3fc0: 69 6e 65 44 6f 6e 74 55 73 65 3b 20 2f 2a 20 44  ineDontUse; /* D
3fd0: 6f 6e 27 74 20 75 73 65 20 69 6e 20 65 78 74 65  on't use in exte
3fe0: 6e 73 69 6f 6e 73 21 20 2a 2f 0a 23 65 6e 64 69  nsions! */.#endi
3ff0: 66 0a 7d 0a 23 65 6e 64 69 66 20 2f 2a 20 21 54  f.}.#endif /* !T
4000: 43 4c 5f 4e 4f 5f 44 45 50 52 45 43 41 54 45 44  CL_NO_DEPRECATED
4010: 20 2a 2f 0a 54 63 6c 5f 49 6e 74 65 72 70 3b 0a   */.Tcl_Interp;.
4020: 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20  .typedef struct 
4030: 54 63 6c 5f 41 73 79 6e 63 48 61 6e 64 6c 65 72  Tcl_AsyncHandler
4040: 5f 20 2a 54 63 6c 5f 41 73 79 6e 63 48 61 6e 64  _ *Tcl_AsyncHand
4050: 6c 65 72 3b 0a 74 79 70 65 64 65 66 20 73 74 72  ler;.typedef str
4060: 75 63 74 20 54 63 6c 5f 43 68 61 6e 6e 65 6c 5f  uct Tcl_Channel_
4070: 20 2a 54 63 6c 5f 43 68 61 6e 6e 65 6c 3b 0a 74   *Tcl_Channel;.t
4080: 79 70 65 64 65 66 20 73 74 72 75 63 74 20 54 63  ypedef struct Tc
4090: 6c 5f 43 68 61 6e 6e 65 6c 54 79 70 65 56 65 72  l_ChannelTypeVer
40a0: 73 69 6f 6e 5f 20 2a 54 63 6c 5f 43 68 61 6e 6e  sion_ *Tcl_Chann
40b0: 65 6c 54 79 70 65 56 65 72 73 69 6f 6e 3b 0a 74  elTypeVersion;.t
40c0: 79 70 65 64 65 66 20 73 74 72 75 63 74 20 54 63  ypedef struct Tc
40d0: 6c 5f 43 6f 6d 6d 61 6e 64 5f 20 2a 54 63 6c 5f  l_Command_ *Tcl_
40e0: 43 6f 6d 6d 61 6e 64 3b 0a 74 79 70 65 64 65 66  Command;.typedef
40f0: 20 73 74 72 75 63 74 20 54 63 6c 5f 43 6f 6e 64   struct Tcl_Cond
4100: 69 74 69 6f 6e 5f 20 2a 54 63 6c 5f 43 6f 6e 64  ition_ *Tcl_Cond
4110: 69 74 69 6f 6e 3b 0a 74 79 70 65 64 65 66 20 73  ition;.typedef s
4120: 74 72 75 63 74 20 54 63 6c 5f 44 69 63 74 5f 20  truct Tcl_Dict_ 
4130: 2a 54 63 6c 5f 44 69 63 74 3b 0a 74 79 70 65 64  *Tcl_Dict;.typed
4140: 65 66 20 73 74 72 75 63 74 20 54 63 6c 5f 45 6e  ef struct Tcl_En
4150: 63 6f 64 69 6e 67 53 74 61 74 65 5f 20 2a 54 63  codingState_ *Tc
4160: 6c 5f 45 6e 63 6f 64 69 6e 67 53 74 61 74 65 3b  l_EncodingState;
4170: 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20  .typedef struct 
4180: 54 63 6c 5f 45 6e 63 6f 64 69 6e 67 5f 20 2a 54  Tcl_Encoding_ *T
4190: 63 6c 5f 45 6e 63 6f 64 69 6e 67 3b 0a 74 79 70  cl_Encoding;.typ
41a0: 65 64 65 66 20 73 74 72 75 63 74 20 54 63 6c 5f  edef struct Tcl_
41b0: 45 76 65 6e 74 20 54 63 6c 5f 45 76 65 6e 74 3b  Event Tcl_Event;
41c0: 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20  .typedef struct 
41d0: 54 63 6c 5f 49 6e 74 65 72 70 53 74 61 74 65 5f  Tcl_InterpState_
41e0: 20 2a 54 63 6c 5f 49 6e 74 65 72 70 53 74 61 74   *Tcl_InterpStat
41f0: 65 3b 0a 74 79 70 65 64 65 66 20 73 74 72 75 63  e;.typedef struc
4200: 74 20 54 63 6c 5f 4c 6f 61 64 48 61 6e 64 6c 65  t Tcl_LoadHandle
4210: 5f 20 2a 54 63 6c 5f 4c 6f 61 64 48 61 6e 64 6c  _ *Tcl_LoadHandl
4220: 65 3b 0a 74 79 70 65 64 65 66 20 73 74 72 75 63  e;.typedef struc
4230: 74 20 54 63 6c 5f 4d 75 74 65 78 5f 20 2a 54 63  t Tcl_Mutex_ *Tc
4240: 6c 5f 4d 75 74 65 78 3b 0a 74 79 70 65 64 65 66  l_Mutex;.typedef
4250: 20 73 74 72 75 63 74 20 54 63 6c 5f 50 69 64 5f   struct Tcl_Pid_
4260: 20 2a 54 63 6c 5f 50 69 64 3b 0a 74 79 70 65 64   *Tcl_Pid;.typed
4270: 65 66 20 73 74 72 75 63 74 20 54 63 6c 5f 52 65  ef struct Tcl_Re
4280: 67 45 78 70 5f 20 2a 54 63 6c 5f 52 65 67 45 78  gExp_ *Tcl_RegEx
4290: 70 3b 0a 74 79 70 65 64 65 66 20 73 74 72 75 63  p;.typedef struc
42a0: 74 20 54 63 6c 5f 54 68 72 65 61 64 44 61 74 61  t Tcl_ThreadData
42b0: 4b 65 79 5f 20 2a 54 63 6c 5f 54 68 72 65 61 64  Key_ *Tcl_Thread
42c0: 44 61 74 61 4b 65 79 3b 0a 74 79 70 65 64 65 66  DataKey;.typedef
42d0: 20 73 74 72 75 63 74 20 54 63 6c 5f 54 68 72 65   struct Tcl_Thre
42e0: 61 64 49 64 5f 20 2a 54 63 6c 5f 54 68 72 65 61  adId_ *Tcl_Threa
42f0: 64 49 64 3b 0a 74 79 70 65 64 65 66 20 73 74 72  dId;.typedef str
4300: 75 63 74 20 54 63 6c 5f 54 69 6d 65 72 54 6f 6b  uct Tcl_TimerTok
4310: 65 6e 5f 20 2a 54 63 6c 5f 54 69 6d 65 72 54 6f  en_ *Tcl_TimerTo
4320: 6b 65 6e 3b 0a 74 79 70 65 64 65 66 20 73 74 72  ken;.typedef str
4330: 75 63 74 20 54 63 6c 5f 54 72 61 63 65 5f 20 2a  uct Tcl_Trace_ *
4340: 54 63 6c 5f 54 72 61 63 65 3b 0a 74 79 70 65 64  Tcl_Trace;.typed
4350: 65 66 20 73 74 72 75 63 74 20 54 63 6c 5f 56 61  ef struct Tcl_Va
4360: 72 5f 20 2a 54 63 6c 5f 56 61 72 3b 0a 74 79 70  r_ *Tcl_Var;.typ
4370: 65 64 65 66 20 73 74 72 75 63 74 20 54 63 6c 5f  edef struct Tcl_
4380: 5a 4c 69 62 53 74 72 65 61 6d 5f 20 2a 54 63 6c  ZLibStream_ *Tcl
4390: 5f 5a 6c 69 62 53 74 72 65 61 6d 3b 0a 0a 2f 2a  _ZlibStream;../*
43a0: 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  . *-------------
43b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
43c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
43d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
43e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a  ---------------.
43f0: 20 2a 20 44 65 66 69 6e 69 74 69 6f 6e 20 6f 66   * Definition of
4400: 20 74 68 65 20 69 6e 74 65 72 66 61 63 65 20 74   the interface t
4410: 6f 20 66 75 6e 63 74 69 6f 6e 73 20 69 6d 70 6c  o functions impl
4420: 65 6d 65 6e 74 69 6e 67 20 74 68 72 65 61 64 73  ementing threads
4430: 2e 20 41 20 66 75 6e 63 74 69 6f 6e 0a 20 2a 20  . A function. * 
4440: 66 6f 6c 6c 6f 77 69 6e 67 20 74 68 69 73 20 64  following this d
4450: 65 66 69 6e 69 74 69 6f 6e 20 69 73 20 67 69 76  efinition is giv
4460: 65 6e 20 74 6f 20 65 61 63 68 20 63 61 6c 6c 20  en to each call 
4470: 6f 66 20 27 54 63 6c 5f 43 72 65 61 74 65 54 68  of 'Tcl_CreateTh
4480: 72 65 61 64 27 20 61 6e 64 0a 20 2a 20 77 69 6c  read' and. * wil
4490: 6c 20 62 65 20 63 61 6c 6c 65 64 20 61 73 20 74  l be called as t
44a0: 68 65 20 6d 61 69 6e 20 66 75 63 74 69 6f 6e 20  he main fuction 
44b0: 6f 66 20 74 68 65 20 6e 65 77 20 74 68 72 65 61  of the new threa
44c0: 64 20 63 72 65 61 74 65 64 20 62 79 20 74 68 61  d created by tha
44d0: 74 20 63 61 6c 6c 2e 0a 20 2a 2f 0a 0a 23 69 66  t call.. */..#if
44e0: 20 64 65 66 69 6e 65 64 20 5f 57 49 4e 33 32 0a   defined _WIN32.
44f0: 74 79 70 65 64 65 66 20 75 6e 73 69 67 6e 65 64  typedef unsigned
4500: 20 28 5f 5f 73 74 64 63 61 6c 6c 20 54 63 6c 5f   (__stdcall Tcl_
4510: 54 68 72 65 61 64 43 72 65 61 74 65 50 72 6f 63  ThreadCreateProc
4520: 29 20 28 43 6c 69 65 6e 74 44 61 74 61 20 63 6c  ) (ClientData cl
4530: 69 65 6e 74 44 61 74 61 29 3b 0a 23 65 6c 73 65  ientData);.#else
4540: 0a 74 79 70 65 64 65 66 20 76 6f 69 64 20 28 54  .typedef void (T
4550: 63 6c 5f 54 68 72 65 61 64 43 72 65 61 74 65 50  cl_ThreadCreateP
4560: 72 6f 63 29 20 28 43 6c 69 65 6e 74 44 61 74 61  roc) (ClientData
4570: 20 63 6c 69 65 6e 74 44 61 74 61 29 3b 0a 23 65   clientData);.#e
4580: 6e 64 69 66 0a 0a 2f 2a 0a 20 2a 20 54 68 72 65  ndif../*. * Thre
4590: 61 64 69 6e 67 20 66 75 6e 63 74 69 6f 6e 20 72  ading function r
45a0: 65 74 75 72 6e 20 74 79 70 65 73 20 75 73 65 64  eturn types used
45b0: 20 66 6f 72 20 61 62 73 74 72 61 63 74 69 6e 67   for abstracting
45c0: 20 61 77 61 79 20 70 6c 61 74 66 6f 72 6d 0a 20   away platform. 
45d0: 2a 20 64 69 66 66 65 72 65 6e 63 65 73 20 77 68  * differences wh
45e0: 65 6e 20 77 72 69 74 69 6e 67 20 61 20 54 63 6c  en writing a Tcl
45f0: 5f 54 68 72 65 61 64 43 72 65 61 74 65 50 72 6f  _ThreadCreatePro
4600: 63 2e 20 53 65 65 20 74 68 65 20 4e 65 77 54 68  c. See the NewTh
4610: 72 65 61 64 20 66 75 6e 63 74 69 6f 6e 0a 20 2a  read function. *
4620: 20 69 6e 20 67 65 6e 65 72 69 63 2f 74 63 6c 54   in generic/tclT
4630: 68 72 65 61 64 54 65 73 74 2e 63 20 66 6f 72 20  hreadTest.c for 
4640: 69 74 27 73 20 75 73 61 67 65 2e 0a 20 2a 2f 0a  it's usage.. */.
4650: 0a 23 69 66 20 64 65 66 69 6e 65 64 20 5f 57 49  .#if defined _WI
4660: 4e 33 32 0a 23 20 20 20 64 65 66 69 6e 65 20 54  N32.#   define T
4670: 63 6c 5f 54 68 72 65 61 64 43 72 65 61 74 65 54  cl_ThreadCreateT
4680: 79 70 65 09 09 75 6e 73 69 67 6e 65 64 20 5f 5f  ype..unsigned __
4690: 73 74 64 63 61 6c 6c 0a 23 20 20 20 64 65 66 69  stdcall.#   defi
46a0: 6e 65 20 54 43 4c 5f 54 48 52 45 41 44 5f 43 52  ne TCL_THREAD_CR
46b0: 45 41 54 45 5f 52 45 54 55 52 4e 09 72 65 74 75  EATE_RETURN.retu
46c0: 72 6e 20 30 0a 23 65 6c 73 65 0a 23 20 20 20 64  rn 0.#else.#   d
46d0: 65 66 69 6e 65 20 54 63 6c 5f 54 68 72 65 61 64  efine Tcl_Thread
46e0: 43 72 65 61 74 65 54 79 70 65 09 09 76 6f 69 64  CreateType..void
46f0: 0a 23 20 20 20 64 65 66 69 6e 65 20 54 43 4c 5f  .#   define TCL_
4700: 54 48 52 45 41 44 5f 43 52 45 41 54 45 5f 52 45  THREAD_CREATE_RE
4710: 54 55 52 4e 0a 23 65 6e 64 69 66 0a 0a 2f 2a 0a  TURN.#endif../*.
4720: 20 2a 20 44 65 66 69 6e 69 74 69 6f 6e 20 6f 66   * Definition of
4730: 20 76 61 6c 75 65 73 20 66 6f 72 20 64 65 66 61   values for defa
4740: 75 6c 74 20 73 74 61 63 6b 73 69 7a 65 20 61 6e  ult stacksize an
4750: 64 20 74 68 65 20 70 6f 73 73 69 62 6c 65 20 66  d the possible f
4760: 6c 61 67 73 20 74 6f 20 62 65 0a 20 2a 20 67 69  lags to be. * gi
4770: 76 65 6e 20 74 6f 20 54 63 6c 5f 43 72 65 61 74  ven to Tcl_Creat
4780: 65 54 68 72 65 61 64 2e 0a 20 2a 2f 0a 0a 23 64  eThread.. */..#d
4790: 65 66 69 6e 65 20 54 43 4c 5f 54 48 52 45 41 44  efine TCL_THREAD
47a0: 5f 53 54 41 43 4b 5f 44 45 46 41 55 4c 54 20 28  _STACK_DEFAULT (
47b0: 30 29 20 20 20 20 2f 2a 20 55 73 65 20 64 65 66  0)    /* Use def
47c0: 61 75 6c 74 20 73 69 7a 65 20 66 6f 72 20 73 74  ault size for st
47d0: 61 63 6b 2e 20 2a 2f 0a 23 64 65 66 69 6e 65 20  ack. */.#define 
47e0: 54 43 4c 5f 54 48 52 45 41 44 5f 4e 4f 46 4c 41  TCL_THREAD_NOFLA
47f0: 47 53 09 20 28 30 30 30 30 29 20 2f 2a 20 53 74  GS. (0000) /* St
4800: 61 6e 64 61 72 64 20 66 6c 61 67 73 2c 20 64 65  andard flags, de
4810: 66 61 75 6c 74 0a 09 09 09 09 09 20 2a 20 62 65  fault...... * be
4820: 68 61 76 69 6f 75 72 2e 20 2a 2f 0a 23 64 65 66  haviour. */.#def
4830: 69 6e 65 20 54 43 4c 5f 54 48 52 45 41 44 5f 4a  ine TCL_THREAD_J
4840: 4f 49 4e 41 42 4c 45 09 20 28 30 30 30 31 29 20  OINABLE. (0001) 
4850: 2f 2a 20 4d 61 72 6b 20 74 68 65 20 74 68 72 65  /* Mark the thre
4860: 61 64 20 61 73 20 6a 6f 69 6e 61 62 6c 65 2e 20  ad as joinable. 
4870: 2a 2f 0a 0a 2f 2a 0a 20 2a 20 46 6c 61 67 20 76  */../*. * Flag v
4880: 61 6c 75 65 73 20 70 61 73 73 65 64 20 74 6f 20  alues passed to 
4890: 54 63 6c 5f 53 74 72 69 6e 67 43 61 73 65 4d 61  Tcl_StringCaseMa
48a0: 74 63 68 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e  tch.. */..#defin
48b0: 65 20 54 43 4c 5f 4d 41 54 43 48 5f 4e 4f 43 41  e TCL_MATCH_NOCA
48c0: 53 45 09 28 31 3c 3c 30 29 0a 0a 2f 2a 0a 20 2a  SE.(1<<0)../*. *
48d0: 20 46 6c 61 67 20 76 61 6c 75 65 73 20 70 61 73   Flag values pas
48e0: 73 65 64 20 74 6f 20 54 63 6c 5f 47 65 74 52 65  sed to Tcl_GetRe
48f0: 67 45 78 70 46 72 6f 6d 4f 62 6a 2e 0a 20 2a 2f  gExpFromObj.. */
4900: 0a 0a 23 64 65 66 69 6e 65 09 54 43 4c 5f 52 45  ..#define.TCL_RE
4910: 47 5f 42 41 53 49 43 09 09 30 30 30 30 30 30 09  G_BASIC..000000.
4920: 2f 2a 20 42 52 45 73 20 28 63 6f 6e 76 65 6e 69  /* BREs (conveni
4930: 65 6e 63 65 29 2e 20 2a 2f 0a 23 64 65 66 69 6e  ence). */.#defin
4940: 65 09 54 43 4c 5f 52 45 47 5f 45 58 54 45 4e 44  e.TCL_REG_EXTEND
4950: 45 44 09 30 30 30 30 30 31 09 2f 2a 20 45 52 45  ED.000001./* ERE
4960: 73 2e 20 2a 2f 0a 23 64 65 66 69 6e 65 09 54 43  s. */.#define.TC
4970: 4c 5f 52 45 47 5f 41 44 56 46 09 09 30 30 30 30  L_REG_ADVF..0000
4980: 30 32 09 2f 2a 20 41 64 76 61 6e 63 65 64 20 66  02./* Advanced f
4990: 65 61 74 75 72 65 73 20 69 6e 20 45 52 45 73 2e  eatures in EREs.
49a0: 20 2a 2f 0a 23 64 65 66 69 6e 65 09 54 43 4c 5f   */.#define.TCL_
49b0: 52 45 47 5f 41 44 56 41 4e 43 45 44 09 30 30 30  REG_ADVANCED.000
49c0: 30 30 33 09 2f 2a 20 41 52 45 73 20 28 77 68 69  003./* AREs (whi
49d0: 63 68 20 61 72 65 20 61 6c 73 6f 20 45 52 45 73  ch are also EREs
49e0: 29 2e 20 2a 2f 0a 23 64 65 66 69 6e 65 09 54 43  ). */.#define.TC
49f0: 4c 5f 52 45 47 5f 51 55 4f 54 45 09 09 30 30 30  L_REG_QUOTE..000
4a00: 30 30 34 09 2f 2a 20 4e 6f 20 73 70 65 63 69 61  004./* No specia
4a10: 6c 20 63 68 61 72 61 63 74 65 72 73 2c 20 6e 6f  l characters, no
4a20: 6e 65 2e 20 2a 2f 0a 23 64 65 66 69 6e 65 09 54  ne. */.#define.T
4a30: 43 4c 5f 52 45 47 5f 4e 4f 43 41 53 45 09 09 30  CL_REG_NOCASE..0
4a40: 30 30 30 31 30 09 2f 2a 20 49 67 6e 6f 72 65 20  00010./* Ignore 
4a50: 63 61 73 65 2e 20 2a 2f 0a 23 64 65 66 69 6e 65  case. */.#define
4a60: 09 54 43 4c 5f 52 45 47 5f 4e 4f 53 55 42 09 09  .TCL_REG_NOSUB..
4a70: 30 30 30 30 32 30 09 2f 2a 20 44 6f 6e 27 74 20  000020./* Don't 
4a80: 63 61 72 65 20 61 62 6f 75 74 20 73 75 62 65 78  care about subex
4a90: 70 72 65 73 73 69 6f 6e 73 2e 20 2a 2f 0a 23 64  pressions. */.#d
4aa0: 65 66 69 6e 65 09 54 43 4c 5f 52 45 47 5f 45 58  efine.TCL_REG_EX
4ab0: 50 41 4e 44 45 44 09 30 30 30 30 34 30 09 2f 2a  PANDED.000040./*
4ac0: 20 45 78 70 61 6e 64 65 64 20 66 6f 72 6d 61 74   Expanded format
4ad0: 2c 20 77 68 69 74 65 20 73 70 61 63 65 20 26 0a  , white space &.
4ae0: 09 09 09 09 09 20 2a 20 63 6f 6d 6d 65 6e 74 73  ..... * comments
4af0: 2e 20 2a 2f 0a 23 64 65 66 69 6e 65 09 54 43 4c  . */.#define.TCL
4b00: 5f 52 45 47 5f 4e 4c 53 54 4f 50 09 09 30 30 30  _REG_NLSTOP..000
4b10: 31 30 30 20 20 2f 2a 20 5c 6e 20 64 6f 65 73 6e  100  /* \n doesn
4b20: 27 74 20 6d 61 74 63 68 20 2e 20 6f 72 20 5b 5e  't match . or [^
4b30: 20 5d 20 2a 2f 0a 23 64 65 66 69 6e 65 09 54 43   ] */.#define.TC
4b40: 4c 5f 52 45 47 5f 4e 4c 41 4e 43 48 09 09 30 30  L_REG_NLANCH..00
4b50: 30 32 30 30 20 20 2f 2a 20 5e 20 6d 61 74 63 68  0200  /* ^ match
4b60: 65 73 20 61 66 74 65 72 20 5c 6e 2c 20 24 20 62  es after \n, $ b
4b70: 65 66 6f 72 65 2e 20 2a 2f 0a 23 64 65 66 69 6e  efore. */.#defin
4b80: 65 09 54 43 4c 5f 52 45 47 5f 4e 45 57 4c 49 4e  e.TCL_REG_NEWLIN
4b90: 45 09 09 30 30 30 33 30 30 20 20 2f 2a 20 4e 65  E..000300  /* Ne
4ba0: 77 6c 69 6e 65 73 20 61 72 65 20 6c 69 6e 65 20  wlines are line 
4bb0: 74 65 72 6d 69 6e 61 74 6f 72 73 2e 20 2a 2f 0a  terminators. */.
4bc0: 23 64 65 66 69 6e 65 09 54 43 4c 5f 52 45 47 5f  #define.TCL_REG_
4bd0: 43 41 4e 4d 41 54 43 48 09 30 30 31 30 30 30 20  CANMATCH.001000 
4be0: 20 2f 2a 20 52 65 70 6f 72 74 20 64 65 74 61 69   /* Report detai
4bf0: 6c 73 20 6f 6e 20 70 61 72 74 69 61 6c 2f 6c 69  ls on partial/li
4c00: 6d 69 74 65 64 0a 09 09 09 09 09 20 2a 20 6d 61  mited...... * ma
4c10: 74 63 68 65 73 2e 20 2a 2f 0a 0a 2f 2a 0a 20 2a  tches. */../*. *
4c20: 20 46 6c 61 67 73 20 76 61 6c 75 65 73 20 70 61   Flags values pa
4c30: 73 73 65 64 20 74 6f 20 54 63 6c 5f 52 65 67 45  ssed to Tcl_RegE
4c40: 78 70 45 78 65 63 4f 62 6a 2e 0a 20 2a 2f 0a 0a  xpExecObj.. */..
4c50: 23 64 65 66 69 6e 65 09 54 43 4c 5f 52 45 47 5f  #define.TCL_REG_
4c60: 4e 4f 54 42 4f 4c 09 30 30 30 31 09 2f 2a 20 42  NOTBOL.0001./* B
4c70: 65 67 69 6e 6e 69 6e 67 20 6f 66 20 73 74 72 69  eginning of stri
4c80: 6e 67 20 64 6f 65 73 20 6e 6f 74 20 6d 61 74 63  ng does not matc
4c90: 68 20 5e 2e 20 20 2a 2f 0a 23 64 65 66 69 6e 65  h ^.  */.#define
4ca0: 09 54 43 4c 5f 52 45 47 5f 4e 4f 54 45 4f 4c 09  .TCL_REG_NOTEOL.
4cb0: 30 30 30 32 09 2f 2a 20 45 6e 64 20 6f 66 20 73  0002./* End of s
4cc0: 74 72 69 6e 67 20 64 6f 65 73 20 6e 6f 74 20 6d  tring does not m
4cd0: 61 74 63 68 20 24 2e 20 2a 2f 0a 0a 2f 2a 0a 20  atch $. */../*. 
4ce0: 2a 20 53 74 72 75 63 74 75 72 65 73 20 66 69 6c  * Structures fil
4cf0: 6c 65 64 20 69 6e 20 62 79 20 54 63 6c 5f 52 65  led in by Tcl_Re
4d00: 67 45 78 70 49 6e 66 6f 2e 20 4e 6f 74 65 20 74  gExpInfo. Note t
4d10: 68 61 74 20 61 6c 6c 20 6f 66 66 73 65 74 20 76  hat all offset v
4d20: 61 6c 75 65 73 20 61 72 65 0a 20 2a 20 72 65 6c  alues are. * rel
4d30: 61 74 69 76 65 20 74 6f 20 74 68 65 20 73 74 61  ative to the sta
4d40: 72 74 20 6f 66 20 74 68 65 20 6d 61 74 63 68 20  rt of the match 
4d50: 73 74 72 69 6e 67 2c 20 6e 6f 74 20 74 68 65 20  string, not the 
4d60: 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 74 68 65  beginning of the
4d70: 20 65 6e 74 69 72 65 0a 20 2a 20 73 74 72 69 6e   entire. * strin
4d80: 67 2e 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20  g.. */..typedef 
4d90: 73 74 72 75 63 74 20 54 63 6c 5f 52 65 67 45 78  struct Tcl_RegEx
4da0: 70 49 6e 64 69 63 65 73 20 7b 0a 20 20 20 20 6c  pIndices {.    l
4db0: 6f 6e 67 20 73 74 61 72 74 3b 09 09 09 2f 2a 20  ong start;.../* 
4dc0: 43 68 61 72 61 63 74 65 72 20 6f 66 66 73 65 74  Character offset
4dd0: 20 6f 66 20 66 69 72 73 74 20 63 68 61 72 61 63   of first charac
4de0: 74 65 72 20 69 6e 0a 09 09 09 09 20 2a 20 6d 61  ter in..... * ma
4df0: 74 63 68 2e 20 2a 2f 0a 20 20 20 20 6c 6f 6e 67  tch. */.    long
4e00: 20 65 6e 64 3b 09 09 09 2f 2a 20 43 68 61 72 61   end;.../* Chara
4e10: 63 74 65 72 20 6f 66 66 73 65 74 20 6f 66 20 66  cter offset of f
4e20: 69 72 73 74 20 63 68 61 72 61 63 74 65 72 20 61  irst character a
4e30: 66 74 65 72 0a 09 09 09 09 20 2a 20 74 68 65 20  fter..... * the 
4e40: 6d 61 74 63 68 2e 20 2a 2f 0a 7d 20 54 63 6c 5f  match. */.} Tcl_
4e50: 52 65 67 45 78 70 49 6e 64 69 63 65 73 3b 0a 0a  RegExpIndices;..
4e60: 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20 54  typedef struct T
4e70: 63 6c 5f 52 65 67 45 78 70 49 6e 66 6f 20 7b 0a  cl_RegExpInfo {.
4e80: 20 20 20 20 69 6e 74 20 6e 73 75 62 73 3b 09 09      int nsubs;..
4e90: 09 2f 2a 20 4e 75 6d 62 65 72 20 6f 66 20 73 75  ./* Number of su
4ea0: 62 65 78 70 72 65 73 73 69 6f 6e 73 20 69 6e 20  bexpressions in 
4eb0: 74 68 65 20 63 6f 6d 70 69 6c 65 64 0a 09 09 09  the compiled....
4ec0: 09 20 2a 20 65 78 70 72 65 73 73 69 6f 6e 2e 20  . * expression. 
4ed0: 2a 2f 0a 20 20 20 20 54 63 6c 5f 52 65 67 45 78  */.    Tcl_RegEx
4ee0: 70 49 6e 64 69 63 65 73 20 2a 6d 61 74 63 68 65  pIndices *matche
4ef0: 73 3b 09 2f 2a 20 41 72 72 61 79 20 6f 66 20 6e  s;./* Array of n
4f00: 73 75 62 73 20 6d 61 74 63 68 20 6f 66 66 73 65  subs match offse
4f10: 74 20 70 61 69 72 73 2e 20 2a 2f 0a 20 20 20 20  t pairs. */.    
4f20: 6c 6f 6e 67 20 65 78 74 65 6e 64 53 74 61 72 74  long extendStart
4f30: 3b 09 09 2f 2a 20 54 68 65 20 6f 66 66 73 65 74  ;../* The offset
4f40: 20 61 74 20 77 68 69 63 68 20 61 20 73 75 62 73   at which a subs
4f50: 65 71 75 65 6e 74 20 6d 61 74 63 68 0a 09 09 09  equent match....
4f60: 09 20 2a 20 6d 69 67 68 74 20 62 65 67 69 6e 2e  . * might begin.
4f70: 20 2a 2f 0a 20 20 20 20 6c 6f 6e 67 20 72 65 73   */.    long res
4f80: 65 72 76 65 64 3b 09 09 2f 2a 20 52 65 73 65 72  erved;../* Reser
4f90: 76 65 64 20 66 6f 72 20 6c 61 74 65 72 20 75 73  ved for later us
4fa0: 65 2e 20 2a 2f 0a 7d 20 54 63 6c 5f 52 65 67 45  e. */.} Tcl_RegE
4fb0: 78 70 49 6e 66 6f 3b 0a 0a 2f 2a 0a 20 2a 20 50  xpInfo;../*. * P
4fc0: 69 63 6b 79 20 63 6f 6d 70 69 6c 65 72 73 20 63  icky compilers c
4fd0: 6f 6d 70 6c 61 69 6e 20 69 66 20 74 68 69 73 20  omplain if this 
4fe0: 74 79 70 64 65 66 20 64 6f 65 73 6e 27 74 20 61  typdef doesn't a
4ff0: 70 70 65 61 72 20 62 65 66 6f 72 65 20 74 68 65  ppear before the
5000: 20 73 74 72 75 63 74 27 73 0a 20 2a 20 72 65 66   struct's. * ref
5010: 65 72 65 6e 63 65 20 69 6e 20 74 63 6c 44 65 63  erence in tclDec
5020: 6c 73 2e 68 2e 0a 20 2a 2f 0a 0a 74 79 70 65 64  ls.h.. */..typed
5030: 65 66 20 54 63 6c 5f 53 74 61 74 42 75 66 20 2a  ef Tcl_StatBuf *
5040: 54 63 6c 5f 53 74 61 74 5f 3b 0a 74 79 70 65 64  Tcl_Stat_;.typed
5050: 65 66 20 73 74 72 75 63 74 20 73 74 61 74 20 2a  ef struct stat *
5060: 54 63 6c 5f 4f 6c 64 53 74 61 74 5f 3b 0a 0a 2f  Tcl_OldStat_;../
5070: 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  *. *------------
5080: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5090: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
50a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
50b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
50c0: 0a 20 2a 20 57 68 65 6e 20 61 20 54 43 4c 20 63  . * When a TCL c
50d0: 6f 6d 6d 61 6e 64 20 72 65 74 75 72 6e 73 2c 20  ommand returns, 
50e0: 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 20  the interpreter 
50f0: 63 6f 6e 74 61 69 6e 73 20 61 20 72 65 73 75 6c  contains a resul
5100: 74 20 66 72 6f 6d 20 74 68 65 0a 20 2a 20 63 6f  t from the. * co
5110: 6d 6d 61 6e 64 2e 20 50 72 6f 67 72 61 6d 6d 65  mmand. Programme
5120: 72 73 20 61 72 65 20 73 74 72 6f 6e 67 6c 79 20  rs are strongly 
5130: 65 6e 63 6f 75 72 61 67 65 64 20 74 6f 20 75 73  encouraged to us
5140: 65 20 6f 6e 65 20 6f 66 20 74 68 65 20 66 75 6e  e one of the fun
5150: 63 74 69 6f 6e 73 0a 20 2a 20 54 63 6c 5f 47 65  ctions. * Tcl_Ge
5160: 74 4f 62 6a 52 65 73 75 6c 74 28 29 20 6f 72 20  tObjResult() or 
5170: 54 63 6c 5f 47 65 74 53 74 72 69 6e 67 52 65 73  Tcl_GetStringRes
5180: 75 6c 74 28 29 20 74 6f 20 72 65 61 64 20 74 68  ult() to read th
5190: 65 20 69 6e 74 65 72 70 72 65 74 65 72 27 73 0a  e interpreter's.
51a0: 20 2a 20 72 65 73 75 6c 74 2e 20 53 65 65 20 74   * result. See t
51b0: 68 65 20 53 65 74 52 65 73 75 6c 74 20 6d 61 6e  he SetResult man
51c0: 20 70 61 67 65 20 66 6f 72 20 64 65 74 61 69 6c   page for detail
51d0: 73 2e 20 42 65 73 69 64 65 73 20 74 68 69 73 20  s. Besides this 
51e0: 72 65 73 75 6c 74 2c 20 74 68 65 0a 20 2a 20 63  result, the. * c
51f0: 6f 6d 6d 61 6e 64 20 66 75 6e 63 74 69 6f 6e 20  ommand function 
5200: 72 65 74 75 72 6e 73 20 61 6e 20 69 6e 74 65 67  returns an integ
5210: 65 72 20 63 6f 64 65 2c 20 77 68 69 63 68 20 69  er code, which i
5220: 73 20 6f 6e 65 20 6f 66 20 74 68 65 20 66 6f 6c  s one of the fol
5230: 6c 6f 77 69 6e 67 3a 0a 20 2a 0a 20 2a 20 54 43  lowing:. *. * TC
5240: 4c 5f 4f 4b 09 09 43 6f 6d 6d 61 6e 64 20 63 6f  L_OK..Command co
5250: 6d 70 6c 65 74 65 64 20 6e 6f 72 6d 61 6c 6c 79  mpleted normally
5260: 3b 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65  ; the interprete
5270: 72 27 73 20 72 65 73 75 6c 74 0a 20 2a 09 09 09  r's result. *...
5280: 63 6f 6e 74 61 69 6e 73 20 74 68 65 20 63 6f 6d  contains the com
5290: 6d 61 6e 64 27 73 20 72 65 73 75 6c 74 2e 0a 20  mand's result.. 
52a0: 2a 20 54 43 4c 5f 45 52 52 4f 52 09 09 54 68 65  * TCL_ERROR..The
52b0: 20 63 6f 6d 6d 61 6e 64 20 63 6f 75 6c 64 6e 27   command couldn'
52c0: 74 20 62 65 20 63 6f 6d 70 6c 65 74 65 64 20 73  t be completed s
52d0: 75 63 63 65 73 73 66 75 6c 6c 79 3b 20 74 68 65  uccessfully; the
52e0: 0a 20 2a 09 09 09 69 6e 74 65 72 70 72 65 74 65  . *...interprete
52f0: 72 27 73 20 72 65 73 75 6c 74 20 64 65 73 63 72  r's result descr
5300: 69 62 65 73 20 77 68 61 74 20 77 65 6e 74 20 77  ibes what went w
5310: 72 6f 6e 67 2e 0a 20 2a 20 54 43 4c 5f 52 45 54  rong.. * TCL_RET
5320: 55 52 4e 09 09 54 68 65 20 63 6f 6d 6d 61 6e 64  URN..The command
5330: 20 72 65 71 75 65 73 74 73 20 74 68 61 74 20 74   requests that t
5340: 68 65 20 63 75 72 72 65 6e 74 20 66 75 6e 63 74  he current funct
5350: 69 6f 6e 20 72 65 74 75 72 6e 3b 0a 20 2a 09 09  ion return;. *..
5360: 09 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72  .the interpreter
5370: 27 73 20 72 65 73 75 6c 74 20 63 6f 6e 74 61 69  's result contai
5380: 6e 73 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 27  ns the function'
5390: 73 0a 20 2a 09 09 09 72 65 74 75 72 6e 20 76 61  s. *...return va
53a0: 6c 75 65 2e 0a 20 2a 20 54 43 4c 5f 42 52 45 41  lue.. * TCL_BREA
53b0: 4b 09 09 54 68 65 20 63 6f 6d 6d 61 6e 64 20 72  K..The command r
53c0: 65 71 75 65 73 74 73 20 74 68 61 74 20 74 68 65  equests that the
53d0: 20 69 6e 6e 65 72 6d 6f 73 74 20 6c 6f 6f 70 20   innermost loop 
53e0: 62 65 0a 20 2a 09 09 09 65 78 69 74 65 64 3b 20  be. *...exited; 
53f0: 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 27  the interpreter'
5400: 73 20 72 65 73 75 6c 74 20 69 73 20 6d 65 61 6e  s result is mean
5410: 69 6e 67 6c 65 73 73 2e 0a 20 2a 20 54 43 4c 5f  ingless.. * TCL_
5420: 43 4f 4e 54 49 4e 55 45 09 09 47 6f 20 6f 6e 20  CONTINUE..Go on 
5430: 74 6f 20 74 68 65 20 6e 65 78 74 20 69 74 65 72  to the next iter
5440: 61 74 69 6f 6e 20 6f 66 20 74 68 65 20 63 75 72  ation of the cur
5450: 72 65 6e 74 20 6c 6f 6f 70 3b 20 74 68 65 0a 20  rent loop; the. 
5460: 2a 09 09 09 69 6e 74 65 72 70 72 65 74 65 72 27  *...interpreter'
5470: 73 20 72 65 73 75 6c 74 20 69 73 20 6d 65 61 6e  s result is mean
5480: 69 6e 67 6c 65 73 73 2e 0a 20 2a 2f 0a 0a 23 64  ingless.. */..#d
5490: 65 66 69 6e 65 20 54 43 4c 5f 4f 4b 09 09 09 30  efine TCL_OK...0
54a0: 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 45 52 52  .#define TCL_ERR
54b0: 4f 52 09 09 31 0a 23 64 65 66 69 6e 65 20 54 43  OR..1.#define TC
54c0: 4c 5f 52 45 54 55 52 4e 09 09 32 0a 23 64 65 66  L_RETURN..2.#def
54d0: 69 6e 65 20 54 43 4c 5f 42 52 45 41 4b 09 09 33  ine TCL_BREAK..3
54e0: 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 43 4f 4e  .#define TCL_CON
54f0: 54 49 4e 55 45 09 09 34 0a 0a 23 64 65 66 69 6e  TINUE..4..#defin
5500: 65 20 54 43 4c 5f 52 45 53 55 4c 54 5f 53 49 5a  e TCL_RESULT_SIZ
5510: 45 09 09 32 30 30 0a 0a 2f 2a 0a 20 2a 2d 2d 2d  E..200../*. *---
5520: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5530: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5540: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5550: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5560: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 46 6c 61  ---------. * Fla
5570: 67 73 20 74 6f 20 63 6f 6e 74 72 6f 6c 20 77 68  gs to control wh
5580: 61 74 20 73 75 62 73 74 69 74 75 74 69 6f 6e 73  at substitutions
5590: 20 61 72 65 20 70 65 72 66 6f 72 6d 65 64 20 62   are performed b
55a0: 79 20 54 63 6c 5f 53 75 62 73 74 4f 62 6a 28 29  y Tcl_SubstObj()
55b0: 3a 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54  :. */..#define T
55c0: 43 4c 5f 53 55 42 53 54 5f 43 4f 4d 4d 41 4e 44  CL_SUBST_COMMAND
55d0: 53 09 30 30 31 0a 23 64 65 66 69 6e 65 20 54 43  S.001.#define TC
55e0: 4c 5f 53 55 42 53 54 5f 56 41 52 49 41 42 4c 45  L_SUBST_VARIABLE
55f0: 53 09 30 30 32 0a 23 64 65 66 69 6e 65 20 54 43  S.002.#define TC
5600: 4c 5f 53 55 42 53 54 5f 42 41 43 4b 53 4c 41 53  L_SUBST_BACKSLAS
5610: 48 45 53 09 30 30 34 0a 23 64 65 66 69 6e 65 20  HES.004.#define 
5620: 54 43 4c 5f 53 55 42 53 54 5f 41 4c 4c 09 09 30  TCL_SUBST_ALL..0
5630: 30 37 0a 0a 2f 2a 0a 20 2a 20 41 72 67 75 6d 65  07../*. * Argume
5640: 6e 74 20 64 65 73 63 72 69 70 74 6f 72 73 20 66  nt descriptors f
5650: 6f 72 20 6d 61 74 68 20 66 75 6e 63 74 69 6f 6e  or math function
5660: 20 63 61 6c 6c 62 61 63 6b 73 20 69 6e 20 65 78   callbacks in ex
5670: 70 72 65 73 73 69 6f 6e 73 3a 0a 20 2a 2f 0a 0a  pressions:. */..
5680: 74 79 70 65 64 65 66 20 65 6e 75 6d 20 7b 0a 20  typedef enum {. 
5690: 20 20 20 54 43 4c 5f 49 4e 54 2c 20 54 43 4c 5f     TCL_INT, TCL_
56a0: 44 4f 55 42 4c 45 2c 20 54 43 4c 5f 45 49 54 48  DOUBLE, TCL_EITH
56b0: 45 52 2c 20 54 43 4c 5f 57 49 44 45 5f 49 4e 54  ER, TCL_WIDE_INT
56c0: 0a 7d 20 54 63 6c 5f 56 61 6c 75 65 54 79 70 65  .} Tcl_ValueType
56d0: 3b 0a 0a 74 79 70 65 64 65 66 20 73 74 72 75 63  ;..typedef struc
56e0: 74 20 54 63 6c 5f 56 61 6c 75 65 20 7b 0a 20 20  t Tcl_Value {.  
56f0: 20 20 54 63 6c 5f 56 61 6c 75 65 54 79 70 65 20    Tcl_ValueType 
5700: 74 79 70 65 3b 09 09 2f 2a 20 49 6e 64 69 63 61  type;../* Indica
5710: 74 65 73 20 69 6e 74 56 61 6c 75 65 20 6f 72 20  tes intValue or 
5720: 64 6f 75 62 6c 65 56 61 6c 75 65 20 69 73 20 76  doubleValue is v
5730: 61 6c 69 64 2c 0a 09 09 09 09 20 2a 20 6f 72 20  alid,..... * or 
5740: 62 6f 74 68 2e 20 2a 2f 0a 20 20 20 20 6c 6f 6e  both. */.    lon
5750: 67 20 69 6e 74 56 61 6c 75 65 3b 09 09 2f 2a 20  g intValue;../* 
5760: 49 6e 74 65 67 65 72 20 76 61 6c 75 65 2e 20 2a  Integer value. *
5770: 2f 0a 20 20 20 20 64 6f 75 62 6c 65 20 64 6f 75  /.    double dou
5780: 62 6c 65 56 61 6c 75 65 3b 09 09 2f 2a 20 44 6f  bleValue;../* Do
5790: 75 62 6c 65 2d 70 72 65 63 69 73 69 6f 6e 20 66  uble-precision f
57a0: 6c 6f 61 74 69 6e 67 20 76 61 6c 75 65 2e 20 2a  loating value. *
57b0: 2f 0a 20 20 20 20 54 63 6c 5f 57 69 64 65 49 6e  /.    Tcl_WideIn
57c0: 74 20 77 69 64 65 56 61 6c 75 65 3b 09 2f 2a 20  t wideValue;./* 
57d0: 57 69 64 65 20 28 6d 69 6e 2e 20 36 34 2d 62 69  Wide (min. 64-bi
57e0: 74 29 20 69 6e 74 65 67 65 72 20 76 61 6c 75 65  t) integer value
57f0: 2e 20 2a 2f 0a 7d 20 54 63 6c 5f 56 61 6c 75 65  . */.} Tcl_Value
5800: 3b 0a 0a 2f 2a 0a 20 2a 20 46 6f 72 77 61 72 64  ;../*. * Forward
5810: 20 64 65 63 6c 61 72 61 74 69 6f 6e 20 6f 66 20   declaration of 
5820: 54 63 6c 5f 4f 62 6a 20 74 6f 20 70 72 65 76 65  Tcl_Obj to preve
5830: 6e 74 20 61 6e 20 65 72 72 6f 72 20 77 68 65 6e  nt an error when
5840: 20 74 68 65 20 66 6f 72 77 61 72 64 0a 20 2a 20   the forward. * 
5850: 72 65 66 65 72 65 6e 63 65 20 74 6f 20 54 63 6c  reference to Tcl
5860: 5f 4f 62 6a 20 69 73 20 65 6e 63 6f 75 6e 74 65  _Obj is encounte
5870: 72 65 64 20 69 6e 20 74 68 65 20 66 75 6e 63 74  red in the funct
5880: 69 6f 6e 20 74 79 70 65 73 20 64 65 63 6c 61 72  ion types declar
5890: 65 64 20 62 65 6c 6f 77 2e 0a 20 2a 2f 0a 0a 73  ed below.. */..s
58a0: 74 72 75 63 74 20 54 63 6c 5f 4f 62 6a 3b 0a 0a  truct Tcl_Obj;..
58b0: 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  /*. *-----------
58c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
58d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
58e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
58f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
5900: 2d 0a 20 2a 20 46 75 6e 63 74 69 6f 6e 20 74 79  -. * Function ty
5910: 70 65 73 20 64 65 66 69 6e 65 64 20 62 79 20 54  pes defined by T
5920: 63 6c 3a 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 66  cl:. */..typedef
5930: 20 69 6e 74 20 28 54 63 6c 5f 41 70 70 49 6e 69   int (Tcl_AppIni
5940: 74 50 72 6f 63 29 20 28 54 63 6c 5f 49 6e 74 65  tProc) (Tcl_Inte
5950: 72 70 20 2a 69 6e 74 65 72 70 29 3b 0a 74 79 70  rp *interp);.typ
5960: 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 41 73  edef int (Tcl_As
5970: 79 6e 63 50 72 6f 63 29 20 28 43 6c 69 65 6e 74  yncProc) (Client
5980: 44 61 74 61 20 63 6c 69 65 6e 74 44 61 74 61 2c  Data clientData,
5990: 20 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74   Tcl_Interp *int
59a0: 65 72 70 2c 0a 09 69 6e 74 20 63 6f 64 65 29 3b  erp,..int code);
59b0: 0a 74 79 70 65 64 65 66 20 76 6f 69 64 20 28 54  .typedef void (T
59c0: 63 6c 5f 43 68 61 6e 6e 65 6c 50 72 6f 63 29 20  cl_ChannelProc) 
59d0: 28 43 6c 69 65 6e 74 44 61 74 61 20 63 6c 69 65  (ClientData clie
59e0: 6e 74 44 61 74 61 2c 20 69 6e 74 20 6d 61 73 6b  ntData, int mask
59f0: 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 64 20  );.typedef void 
5a00: 28 54 63 6c 5f 43 6c 6f 73 65 50 72 6f 63 29 20  (Tcl_CloseProc) 
5a10: 28 43 6c 69 65 6e 74 44 61 74 61 20 64 61 74 61  (ClientData data
5a20: 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 64 20  );.typedef void 
5a30: 28 54 63 6c 5f 43 6d 64 44 65 6c 65 74 65 50 72  (Tcl_CmdDeletePr
5a40: 6f 63 29 20 28 43 6c 69 65 6e 74 44 61 74 61 20  oc) (ClientData 
5a50: 63 6c 69 65 6e 74 44 61 74 61 29 3b 0a 74 79 70  clientData);.typ
5a60: 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 43 6d  edef int (Tcl_Cm
5a70: 64 50 72 6f 63 29 20 28 43 6c 69 65 6e 74 44 61  dProc) (ClientDa
5a80: 74 61 20 63 6c 69 65 6e 74 44 61 74 61 2c 20 54  ta clientData, T
5a90: 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72  cl_Interp *inter
5aa0: 70 2c 0a 09 69 6e 74 20 61 72 67 63 2c 20 43 4f  p,..int argc, CO
5ab0: 4e 53 54 38 34 20 63 68 61 72 20 2a 61 72 67 76  NST84 char *argv
5ac0: 5b 5d 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69  []);.typedef voi
5ad0: 64 20 28 54 63 6c 5f 43 6d 64 54 72 61 63 65 50  d (Tcl_CmdTraceP
5ae0: 72 6f 63 29 20 28 43 6c 69 65 6e 74 44 61 74 61  roc) (ClientData
5af0: 20 63 6c 69 65 6e 74 44 61 74 61 2c 20 54 63 6c   clientData, Tcl
5b00: 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c  _Interp *interp,
5b10: 0a 09 69 6e 74 20 6c 65 76 65 6c 2c 20 63 68 61  ..int level, cha
5b20: 72 20 2a 63 6f 6d 6d 61 6e 64 2c 20 54 63 6c 5f  r *command, Tcl_
5b30: 43 6d 64 50 72 6f 63 20 2a 70 72 6f 63 2c 0a 09  CmdProc *proc,..
5b40: 43 6c 69 65 6e 74 44 61 74 61 20 63 6d 64 43 6c  ClientData cmdCl
5b50: 69 65 6e 74 44 61 74 61 2c 20 69 6e 74 20 61 72  ientData, int ar
5b60: 67 63 2c 20 43 4f 4e 53 54 38 34 20 63 68 61 72  gc, CONST84 char
5b70: 20 2a 61 72 67 76 5b 5d 29 3b 0a 74 79 70 65 64   *argv[]);.typed
5b80: 65 66 20 69 6e 74 20 28 54 63 6c 5f 43 6d 64 4f  ef int (Tcl_CmdO
5b90: 62 6a 54 72 61 63 65 50 72 6f 63 29 20 28 43 6c  bjTraceProc) (Cl
5ba0: 69 65 6e 74 44 61 74 61 20 63 6c 69 65 6e 74 44  ientData clientD
5bb0: 61 74 61 2c 20 54 63 6c 5f 49 6e 74 65 72 70 20  ata, Tcl_Interp 
5bc0: 2a 69 6e 74 65 72 70 2c 0a 09 69 6e 74 20 6c 65  *interp,..int le
5bd0: 76 65 6c 2c 20 63 6f 6e 73 74 20 63 68 61 72 20  vel, const char 
5be0: 2a 63 6f 6d 6d 61 6e 64 2c 20 54 63 6c 5f 43 6f  *command, Tcl_Co
5bf0: 6d 6d 61 6e 64 20 63 6f 6d 6d 61 6e 64 49 6e 66  mmand commandInf
5c00: 6f 2c 20 69 6e 74 20 6f 62 6a 63 2c 0a 09 73 74  o, int objc,..st
5c10: 72 75 63 74 20 54 63 6c 5f 4f 62 6a 20 2a 63 6f  ruct Tcl_Obj *co
5c20: 6e 73 74 20 2a 6f 62 6a 76 29 3b 0a 74 79 70 65  nst *objv);.type
5c30: 64 65 66 20 76 6f 69 64 20 28 54 63 6c 5f 43 6d  def void (Tcl_Cm
5c40: 64 4f 62 6a 54 72 61 63 65 44 65 6c 65 74 65 50  dObjTraceDeleteP
5c50: 72 6f 63 29 20 28 43 6c 69 65 6e 74 44 61 74 61  roc) (ClientData
5c60: 20 63 6c 69 65 6e 74 44 61 74 61 29 3b 0a 74 79   clientData);.ty
5c70: 70 65 64 65 66 20 76 6f 69 64 20 28 54 63 6c 5f  pedef void (Tcl_
5c80: 44 75 70 49 6e 74 65 72 6e 61 6c 52 65 70 50 72  DupInternalRepPr
5c90: 6f 63 29 20 28 73 74 72 75 63 74 20 54 63 6c 5f  oc) (struct Tcl_
5ca0: 4f 62 6a 20 2a 73 72 63 50 74 72 2c 0a 09 73 74  Obj *srcPtr,..st
5cb0: 72 75 63 74 20 54 63 6c 5f 4f 62 6a 20 2a 64 75  ruct Tcl_Obj *du
5cc0: 70 50 74 72 29 3b 0a 74 79 70 65 64 65 66 20 69  pPtr);.typedef i
5cd0: 6e 74 20 28 54 63 6c 5f 45 6e 63 6f 64 69 6e 67  nt (Tcl_Encoding
5ce0: 43 6f 6e 76 65 72 74 50 72 6f 63 29 20 28 43 6c  ConvertProc) (Cl
5cf0: 69 65 6e 74 44 61 74 61 20 63 6c 69 65 6e 74 44  ientData clientD
5d00: 61 74 61 2c 20 63 6f 6e 73 74 20 63 68 61 72 20  ata, const char 
5d10: 2a 73 72 63 2c 0a 09 69 6e 74 20 73 72 63 4c 65  *src,..int srcLe
5d20: 6e 2c 20 69 6e 74 20 66 6c 61 67 73 2c 20 54 63  n, int flags, Tc
5d30: 6c 5f 45 6e 63 6f 64 69 6e 67 53 74 61 74 65 20  l_EncodingState 
5d40: 2a 73 74 61 74 65 50 74 72 2c 20 63 68 61 72 20  *statePtr, char 
5d50: 2a 64 73 74 2c 0a 09 69 6e 74 20 64 73 74 4c 65  *dst,..int dstLe
5d60: 6e 2c 20 69 6e 74 20 2a 73 72 63 52 65 61 64 50  n, int *srcReadP
5d70: 74 72 2c 20 69 6e 74 20 2a 64 73 74 57 72 6f 74  tr, int *dstWrot
5d80: 65 50 74 72 2c 20 69 6e 74 20 2a 64 73 74 43 68  ePtr, int *dstCh
5d90: 61 72 73 50 74 72 29 3b 0a 74 79 70 65 64 65 66  arsPtr);.typedef
5da0: 20 76 6f 69 64 20 28 54 63 6c 5f 45 6e 63 6f 64   void (Tcl_Encod
5db0: 69 6e 67 46 72 65 65 50 72 6f 63 29 20 28 43 6c  ingFreeProc) (Cl
5dc0: 69 65 6e 74 44 61 74 61 20 63 6c 69 65 6e 74 44  ientData clientD
5dd0: 61 74 61 29 3b 0a 74 79 70 65 64 65 66 20 69 6e  ata);.typedef in
5de0: 74 20 28 54 63 6c 5f 45 76 65 6e 74 50 72 6f 63  t (Tcl_EventProc
5df0: 29 20 28 54 63 6c 5f 45 76 65 6e 74 20 2a 65 76  ) (Tcl_Event *ev
5e00: 50 74 72 2c 20 69 6e 74 20 66 6c 61 67 73 29 3b  Ptr, int flags);
5e10: 0a 74 79 70 65 64 65 66 20 76 6f 69 64 20 28 54  .typedef void (T
5e20: 63 6c 5f 45 76 65 6e 74 43 68 65 63 6b 50 72 6f  cl_EventCheckPro
5e30: 63 29 20 28 43 6c 69 65 6e 74 44 61 74 61 20 63  c) (ClientData c
5e40: 6c 69 65 6e 74 44 61 74 61 2c 20 69 6e 74 20 66  lientData, int f
5e50: 6c 61 67 73 29 3b 0a 74 79 70 65 64 65 66 20 69  lags);.typedef i
5e60: 6e 74 20 28 54 63 6c 5f 45 76 65 6e 74 44 65 6c  nt (Tcl_EventDel
5e70: 65 74 65 50 72 6f 63 29 20 28 54 63 6c 5f 45 76  eteProc) (Tcl_Ev
5e80: 65 6e 74 20 2a 65 76 50 74 72 2c 20 43 6c 69 65  ent *evPtr, Clie
5e90: 6e 74 44 61 74 61 20 63 6c 69 65 6e 74 44 61 74  ntData clientDat
5ea0: 61 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 64  a);.typedef void
5eb0: 20 28 54 63 6c 5f 45 76 65 6e 74 53 65 74 75 70   (Tcl_EventSetup
5ec0: 50 72 6f 63 29 20 28 43 6c 69 65 6e 74 44 61 74  Proc) (ClientDat
5ed0: 61 20 63 6c 69 65 6e 74 44 61 74 61 2c 20 69 6e  a clientData, in
5ee0: 74 20 66 6c 61 67 73 29 3b 0a 74 79 70 65 64 65  t flags);.typede
5ef0: 66 20 76 6f 69 64 20 28 54 63 6c 5f 45 78 69 74  f void (Tcl_Exit
5f00: 50 72 6f 63 29 20 28 43 6c 69 65 6e 74 44 61 74  Proc) (ClientDat
5f10: 61 20 63 6c 69 65 6e 74 44 61 74 61 29 3b 0a 74  a clientData);.t
5f20: 79 70 65 64 65 66 20 76 6f 69 64 20 28 54 63 6c  ypedef void (Tcl
5f30: 5f 46 69 6c 65 50 72 6f 63 29 20 28 43 6c 69 65  _FileProc) (Clie
5f40: 6e 74 44 61 74 61 20 63 6c 69 65 6e 74 44 61 74  ntData clientDat
5f50: 61 2c 20 69 6e 74 20 6d 61 73 6b 29 3b 0a 74 79  a, int mask);.ty
5f60: 70 65 64 65 66 20 76 6f 69 64 20 28 54 63 6c 5f  pedef void (Tcl_
5f70: 46 69 6c 65 46 72 65 65 50 72 6f 63 29 20 28 43  FileFreeProc) (C
5f80: 6c 69 65 6e 74 44 61 74 61 20 63 6c 69 65 6e 74  lientData client
5f90: 44 61 74 61 29 3b 0a 74 79 70 65 64 65 66 20 76  Data);.typedef v
5fa0: 6f 69 64 20 28 54 63 6c 5f 46 72 65 65 49 6e 74  oid (Tcl_FreeInt
5fb0: 65 72 6e 61 6c 52 65 70 50 72 6f 63 29 20 28 73  ernalRepProc) (s
5fc0: 74 72 75 63 74 20 54 63 6c 5f 4f 62 6a 20 2a 6f  truct Tcl_Obj *o
5fd0: 62 6a 50 74 72 29 3b 0a 74 79 70 65 64 65 66 20  bjPtr);.typedef 
5fe0: 76 6f 69 64 20 28 54 63 6c 5f 46 72 65 65 50 72  void (Tcl_FreePr
5ff0: 6f 63 29 20 28 63 68 61 72 20 2a 62 6c 6f 63 6b  oc) (char *block
6000: 50 74 72 29 3b 0a 74 79 70 65 64 65 66 20 76 6f  Ptr);.typedef vo
6010: 69 64 20 28 54 63 6c 5f 49 64 6c 65 50 72 6f 63  id (Tcl_IdleProc
6020: 29 20 28 43 6c 69 65 6e 74 44 61 74 61 20 63 6c  ) (ClientData cl
6030: 69 65 6e 74 44 61 74 61 29 3b 0a 74 79 70 65 64  ientData);.typed
6040: 65 66 20 76 6f 69 64 20 28 54 63 6c 5f 49 6e 74  ef void (Tcl_Int
6050: 65 72 70 44 65 6c 65 74 65 50 72 6f 63 29 20 28  erpDeleteProc) (
6060: 43 6c 69 65 6e 74 44 61 74 61 20 63 6c 69 65 6e  ClientData clien
6070: 74 44 61 74 61 2c 0a 09 54 63 6c 5f 49 6e 74 65  tData,..Tcl_Inte
6080: 72 70 20 2a 69 6e 74 65 72 70 29 3b 0a 74 79 70  rp *interp);.typ
6090: 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 4d 61  edef int (Tcl_Ma
60a0: 74 68 50 72 6f 63 29 20 28 43 6c 69 65 6e 74 44  thProc) (ClientD
60b0: 61 74 61 20 63 6c 69 65 6e 74 44 61 74 61 2c 20  ata clientData, 
60c0: 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65  Tcl_Interp *inte
60d0: 72 70 2c 0a 09 54 63 6c 5f 56 61 6c 75 65 20 2a  rp,..Tcl_Value *
60e0: 61 72 67 73 2c 20 54 63 6c 5f 56 61 6c 75 65 20  args, Tcl_Value 
60f0: 2a 72 65 73 75 6c 74 50 74 72 29 3b 0a 74 79 70  *resultPtr);.typ
6100: 65 64 65 66 20 76 6f 69 64 20 28 54 63 6c 5f 4e  edef void (Tcl_N
6110: 61 6d 65 73 70 61 63 65 44 65 6c 65 74 65 50 72  amespaceDeletePr
6120: 6f 63 29 20 28 43 6c 69 65 6e 74 44 61 74 61 20  oc) (ClientData 
6130: 63 6c 69 65 6e 74 44 61 74 61 29 3b 0a 74 79 70  clientData);.typ
6140: 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 4f 62  edef int (Tcl_Ob
6150: 6a 43 6d 64 50 72 6f 63 29 20 28 43 6c 69 65 6e  jCmdProc) (Clien
6160: 74 44 61 74 61 20 63 6c 69 65 6e 74 44 61 74 61  tData clientData
6170: 2c 20 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e  , Tcl_Interp *in
6180: 74 65 72 70 2c 0a 09 69 6e 74 20 6f 62 6a 63 2c  terp,..int objc,
6190: 20 73 74 72 75 63 74 20 54 63 6c 5f 4f 62 6a 20   struct Tcl_Obj 
61a0: 2a 63 6f 6e 73 74 20 2a 6f 62 6a 76 29 3b 0a 74  *const *objv);.t
61b0: 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f  ypedef int (Tcl_
61c0: 50 61 63 6b 61 67 65 49 6e 69 74 50 72 6f 63 29  PackageInitProc)
61d0: 20 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e   (Tcl_Interp *in
61e0: 74 65 72 70 29 3b 0a 74 79 70 65 64 65 66 20 69  terp);.typedef i
61f0: 6e 74 20 28 54 63 6c 5f 50 61 63 6b 61 67 65 55  nt (Tcl_PackageU
6200: 6e 6c 6f 61 64 50 72 6f 63 29 20 28 54 63 6c 5f  nloadProc) (Tcl_
6210: 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c 20  Interp *interp, 
6220: 69 6e 74 20 66 6c 61 67 73 29 3b 0a 74 79 70 65  int flags);.type
6230: 64 65 66 20 76 6f 69 64 20 28 54 63 6c 5f 50 61  def void (Tcl_Pa
6240: 6e 69 63 50 72 6f 63 29 20 28 63 6f 6e 73 74 20  nicProc) (const 
6250: 63 68 61 72 20 2a 66 6f 72 6d 61 74 2c 20 2e 2e  char *format, ..
6260: 2e 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 64  .);.typedef void
6270: 20 28 54 63 6c 5f 54 63 70 41 63 63 65 70 74 50   (Tcl_TcpAcceptP
6280: 72 6f 63 29 20 28 43 6c 69 65 6e 74 44 61 74 61  roc) (ClientData
6290: 20 63 61 6c 6c 62 61 63 6b 44 61 74 61 2c 20 54   callbackData, T
62a0: 63 6c 5f 43 68 61 6e 6e 65 6c 20 63 68 61 6e 2c  cl_Channel chan,
62b0: 0a 09 63 68 61 72 20 2a 61 64 64 72 65 73 73 2c  ..char *address,
62c0: 20 69 6e 74 20 70 6f 72 74 29 3b 0a 74 79 70 65   int port);.type
62d0: 64 65 66 20 76 6f 69 64 20 28 54 63 6c 5f 54 69  def void (Tcl_Ti
62e0: 6d 65 72 50 72 6f 63 29 20 28 43 6c 69 65 6e 74  merProc) (Client
62f0: 44 61 74 61 20 63 6c 69 65 6e 74 44 61 74 61 29  Data clientData)
6300: 3b 0a 74 79 70 65 64 65 66 20 69 6e 74 20 28 54  ;.typedef int (T
6310: 63 6c 5f 53 65 74 46 72 6f 6d 41 6e 79 50 72 6f  cl_SetFromAnyPro
6320: 63 29 20 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a  c) (Tcl_Interp *
6330: 69 6e 74 65 72 70 2c 20 73 74 72 75 63 74 20 54  interp, struct T
6340: 63 6c 5f 4f 62 6a 20 2a 6f 62 6a 50 74 72 29 3b  cl_Obj *objPtr);
6350: 0a 74 79 70 65 64 65 66 20 76 6f 69 64 20 28 54  .typedef void (T
6360: 63 6c 5f 55 70 64 61 74 65 53 74 72 69 6e 67 50  cl_UpdateStringP
6370: 72 6f 63 29 20 28 73 74 72 75 63 74 20 54 63 6c  roc) (struct Tcl
6380: 5f 4f 62 6a 20 2a 6f 62 6a 50 74 72 29 3b 0a 74  _Obj *objPtr);.t
6390: 79 70 65 64 65 66 20 63 68 61 72 20 2a 20 28 54  ypedef char * (T
63a0: 63 6c 5f 56 61 72 54 72 61 63 65 50 72 6f 63 29  cl_VarTraceProc)
63b0: 20 28 43 6c 69 65 6e 74 44 61 74 61 20 63 6c 69   (ClientData cli
63c0: 65 6e 74 44 61 74 61 2c 20 54 63 6c 5f 49 6e 74  entData, Tcl_Int
63d0: 65 72 70 20 2a 69 6e 74 65 72 70 2c 0a 09 43 4f  erp *interp,..CO
63e0: 4e 53 54 38 34 20 63 68 61 72 20 2a 70 61 72 74  NST84 char *part
63f0: 31 2c 20 43 4f 4e 53 54 38 34 20 63 68 61 72 20  1, CONST84 char 
6400: 2a 70 61 72 74 32 2c 20 69 6e 74 20 66 6c 61 67  *part2, int flag
6410: 73 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 64  s);.typedef void
6420: 20 28 54 63 6c 5f 43 6f 6d 6d 61 6e 64 54 72 61   (Tcl_CommandTra
6430: 63 65 50 72 6f 63 29 20 28 43 6c 69 65 6e 74 44  ceProc) (ClientD
6440: 61 74 61 20 63 6c 69 65 6e 74 44 61 74 61 2c 20  ata clientData, 
6450: 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65  Tcl_Interp *inte
6460: 72 70 2c 0a 09 63 6f 6e 73 74 20 63 68 61 72 20  rp,..const char 
6470: 2a 6f 6c 64 4e 61 6d 65 2c 20 63 6f 6e 73 74 20  *oldName, const 
6480: 63 68 61 72 20 2a 6e 65 77 4e 61 6d 65 2c 20 69  char *newName, i
6490: 6e 74 20 66 6c 61 67 73 29 3b 0a 74 79 70 65 64  nt flags);.typed
64a0: 65 66 20 76 6f 69 64 20 28 54 63 6c 5f 43 72 65  ef void (Tcl_Cre
64b0: 61 74 65 46 69 6c 65 48 61 6e 64 6c 65 72 50 72  ateFileHandlerPr
64c0: 6f 63 29 20 28 69 6e 74 20 66 64 2c 20 69 6e 74  oc) (int fd, int
64d0: 20 6d 61 73 6b 2c 20 54 63 6c 5f 46 69 6c 65 50   mask, Tcl_FileP
64e0: 72 6f 63 20 2a 70 72 6f 63 2c 0a 09 43 6c 69 65  roc *proc,..Clie
64f0: 6e 74 44 61 74 61 20 63 6c 69 65 6e 74 44 61 74  ntData clientDat
6500: 61 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 64  a);.typedef void
6510: 20 28 54 63 6c 5f 44 65 6c 65 74 65 46 69 6c 65   (Tcl_DeleteFile
6520: 48 61 6e 64 6c 65 72 50 72 6f 63 29 20 28 69 6e  HandlerProc) (in
6530: 74 20 66 64 29 3b 0a 74 79 70 65 64 65 66 20 76  t fd);.typedef v
6540: 6f 69 64 20 28 54 63 6c 5f 41 6c 65 72 74 4e 6f  oid (Tcl_AlertNo
6550: 74 69 66 69 65 72 50 72 6f 63 29 20 28 43 6c 69  tifierProc) (Cli
6560: 65 6e 74 44 61 74 61 20 63 6c 69 65 6e 74 44 61  entData clientDa
6570: 74 61 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69  ta);.typedef voi
6580: 64 20 28 54 63 6c 5f 53 65 72 76 69 63 65 4d 6f  d (Tcl_ServiceMo
6590: 64 65 48 6f 6f 6b 50 72 6f 63 29 20 28 69 6e 74  deHookProc) (int
65a0: 20 6d 6f 64 65 29 3b 0a 74 79 70 65 64 65 66 20   mode);.typedef 
65b0: 43 6c 69 65 6e 74 44 61 74 61 20 28 54 63 6c 5f  ClientData (Tcl_
65c0: 49 6e 69 74 4e 6f 74 69 66 69 65 72 50 72 6f 63  InitNotifierProc
65d0: 29 20 28 76 6f 69 64 29 3b 0a 74 79 70 65 64 65  ) (void);.typede
65e0: 66 20 76 6f 69 64 20 28 54 63 6c 5f 46 69 6e 61  f void (Tcl_Fina
65f0: 6c 69 7a 65 4e 6f 74 69 66 69 65 72 50 72 6f 63  lizeNotifierProc
6600: 29 20 28 43 6c 69 65 6e 74 44 61 74 61 20 63 6c  ) (ClientData cl
6610: 69 65 6e 74 44 61 74 61 29 3b 0a 74 79 70 65 64  ientData);.typed
6620: 65 66 20 76 6f 69 64 20 28 54 63 6c 5f 4d 61 69  ef void (Tcl_Mai
6630: 6e 4c 6f 6f 70 50 72 6f 63 29 20 28 76 6f 69 64  nLoopProc) (void
6640: 29 3b 0a 0c 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d  );.../*. *------
6650: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
6660: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
6670: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
6680: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
6690: 2d 2d 2d 2d 2d 2d 0a 20 2a 20 54 68 65 20 66 6f  ------. * The fo
66a0: 6c 6c 6f 77 69 6e 67 20 73 74 72 75 63 74 75 72  llowing structur
66b0: 65 20 72 65 70 72 65 73 65 6e 74 73 20 61 20 74  e represents a t
66c0: 79 70 65 20 6f 66 20 6f 62 6a 65 63 74 2c 20 77  ype of object, w
66d0: 68 69 63 68 20 69 73 20 61 20 70 61 72 74 69 63  hich is a partic
66e0: 75 6c 61 72 0a 20 2a 20 69 6e 74 65 72 6e 61 6c  ular. * internal
66f0: 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20   representation 
6700: 66 6f 72 20 61 6e 20 6f 62 6a 65 63 74 20 70 6c  for an object pl
6710: 75 73 20 61 20 73 65 74 20 6f 66 20 66 75 6e 63  us a set of func
6720: 74 69 6f 6e 73 20 74 68 61 74 20 70 72 6f 76 69  tions that provi
6730: 64 65 0a 20 2a 20 73 74 61 6e 64 61 72 64 20 6f  de. * standard o
6740: 70 65 72 61 74 69 6f 6e 73 20 6f 6e 20 6f 62 6a  perations on obj
6750: 65 63 74 73 20 6f 66 20 74 68 61 74 20 74 79 70  ects of that typ
6760: 65 2e 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20  e.. */..typedef 
6770: 73 74 72 75 63 74 20 54 63 6c 5f 4f 62 6a 54 79  struct Tcl_ObjTy
6780: 70 65 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 63  pe {.    const c
6790: 68 61 72 20 2a 6e 61 6d 65 3b 09 09 2f 2a 20 4e  har *name;../* N
67a0: 61 6d 65 20 6f 66 20 74 68 65 20 74 79 70 65 2c  ame of the type,
67b0: 20 65 2e 67 2e 20 22 69 6e 74 22 2e 20 2a 2f 0a   e.g. "int". */.
67c0: 20 20 20 20 54 63 6c 5f 46 72 65 65 49 6e 74 65      Tcl_FreeInte
67d0: 72 6e 61 6c 52 65 70 50 72 6f 63 20 2a 66 72 65  rnalRepProc *fre
67e0: 65 49 6e 74 52 65 70 50 72 6f 63 3b 0a 09 09 09  eIntRepProc;....
67f0: 09 2f 2a 20 43 61 6c 6c 65 64 20 74 6f 20 66 72  ./* Called to fr
6800: 65 65 20 61 6e 79 20 73 74 6f 72 61 67 65 20 66  ee any storage f
6810: 6f 72 20 74 68 65 20 74 79 70 65 27 73 0a 09 09  or the type's...
6820: 09 09 20 2a 20 69 6e 74 65 72 6e 61 6c 20 72 65  .. * internal re
6830: 70 2e 20 4e 55 4c 4c 20 69 66 20 74 68 65 20 69  p. NULL if the i
6840: 6e 74 65 72 6e 61 6c 20 72 65 70 20 64 6f 65 73  nternal rep does
6850: 0a 09 09 09 09 20 2a 20 6e 6f 74 20 6e 65 65 64  ..... * not need
6860: 20 66 72 65 65 69 6e 67 2e 20 2a 2f 0a 20 20 20   freeing. */.   
6870: 20 54 63 6c 5f 44 75 70 49 6e 74 65 72 6e 61 6c   Tcl_DupInternal
6880: 52 65 70 50 72 6f 63 20 2a 64 75 70 49 6e 74 52  RepProc *dupIntR
6890: 65 70 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 43  epProc;...../* C
68a0: 61 6c 6c 65 64 20 74 6f 20 63 72 65 61 74 65 20  alled to create 
68b0: 61 20 6e 65 77 20 6f 62 6a 65 63 74 20 61 73 20  a new object as 
68c0: 61 20 63 6f 70 79 20 6f 66 0a 09 09 09 09 20 2a  a copy of..... *
68d0: 20 61 6e 20 65 78 69 73 74 69 6e 67 20 6f 62 6a   an existing obj
68e0: 65 63 74 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f  ect. */.    Tcl_
68f0: 55 70 64 61 74 65 53 74 72 69 6e 67 50 72 6f 63  UpdateStringProc
6900: 20 2a 75 70 64 61 74 65 53 74 72 69 6e 67 50 72   *updateStringPr
6910: 6f 63 3b 0a 09 09 09 09 2f 2a 20 43 61 6c 6c 65  oc;...../* Calle
6920: 64 20 74 6f 20 75 70 64 61 74 65 20 74 68 65 20  d to update the 
6930: 73 74 72 69 6e 67 20 72 65 70 20 66 72 6f 6d 20  string rep from 
6940: 74 68 65 0a 09 09 09 09 20 2a 20 74 79 70 65 27  the..... * type'
6950: 73 20 69 6e 74 65 72 6e 61 6c 20 72 65 70 72 65  s internal repre
6960: 73 65 6e 74 61 74 69 6f 6e 2e 20 2a 2f 0a 20 20  sentation. */.  
6970: 20 20 54 63 6c 5f 53 65 74 46 72 6f 6d 41 6e 79    Tcl_SetFromAny
6980: 50 72 6f 63 20 2a 73 65 74 46 72 6f 6d 41 6e 79  Proc *setFromAny
6990: 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 43 61 6c  Proc;...../* Cal
69a0: 6c 65 64 20 74 6f 20 63 6f 6e 76 65 72 74 20 74  led to convert t
69b0: 68 65 20 6f 62 6a 65 63 74 27 73 20 69 6e 74 65  he object's inte
69c0: 72 6e 61 6c 20 72 65 70 0a 09 09 09 09 20 2a 20  rnal rep..... * 
69d0: 74 6f 20 74 68 69 73 20 74 79 70 65 2e 20 46 72  to this type. Fr
69e0: 65 65 73 20 74 68 65 20 69 6e 74 65 72 6e 61 6c  ees the internal
69f0: 20 72 65 70 20 6f 66 20 74 68 65 0a 09 09 09 09   rep of the.....
6a00: 20 2a 20 6f 6c 64 20 74 79 70 65 2e 20 52 65 74   * old type. Ret
6a10: 75 72 6e 73 20 54 43 4c 5f 45 52 52 4f 52 20 6f  urns TCL_ERROR o
6a20: 6e 20 66 61 69 6c 75 72 65 2e 20 2a 2f 0a 7d 20  n failure. */.} 
6a30: 54 63 6c 5f 4f 62 6a 54 79 70 65 3b 0a 0a 2f 2a  Tcl_ObjType;../*
6a40: 0a 20 2a 20 4f 6e 65 20 6f 66 20 74 68 65 20 66  . * One of the f
6a50: 6f 6c 6c 6f 77 69 6e 67 20 73 74 72 75 63 74 75  ollowing structu
6a60: 72 65 73 20 65 78 69 73 74 73 20 66 6f 72 20 65  res exists for e
6a70: 61 63 68 20 6f 62 6a 65 63 74 20 69 6e 20 74 68  ach object in th
6a80: 65 20 54 63 6c 20 73 79 73 74 65 6d 2e 0a 20 2a  e Tcl system.. *
6a90: 20 41 6e 20 6f 62 6a 65 63 74 20 73 74 6f 72 65   An object store
6aa0: 73 20 61 20 76 61 6c 75 65 20 61 73 20 65 69 74  s a value as eit
6ab0: 68 65 72 20 61 20 73 74 72 69 6e 67 2c 20 73 6f  her a string, so
6ac0: 6d 65 20 69 6e 74 65 72 6e 61 6c 20 72 65 70 72  me internal repr
6ad0: 65 73 65 6e 74 61 74 69 6f 6e 2c 0a 20 2a 20 6f  esentation,. * o
6ae0: 72 20 62 6f 74 68 2e 0a 20 2a 2f 0a 0a 74 79 70  r both.. */..typ
6af0: 65 64 65 66 20 73 74 72 75 63 74 20 54 63 6c 5f  edef struct Tcl_
6b00: 4f 62 6a 20 7b 0a 20 20 20 20 69 6e 74 20 72 65  Obj {.    int re
6b10: 66 43 6f 75 6e 74 3b 09 09 2f 2a 20 57 68 65 6e  fCount;../* When
6b20: 20 30 20 74 68 65 20 6f 62 6a 65 63 74 20 77 69   0 the object wi
6b30: 6c 6c 20 62 65 20 66 72 65 65 64 2e 20 2a 2f 0a  ll be freed. */.
6b40: 20 20 20 20 63 68 61 72 20 2a 62 79 74 65 73 3b      char *bytes;
6b50: 09 09 2f 2a 20 54 68 69 73 20 70 6f 69 6e 74 73  ../* This points
6b60: 20 74 6f 20 74 68 65 20 66 69 72 73 74 20 62 79   to the first by
6b70: 74 65 20 6f 66 20 74 68 65 0a 09 09 09 09 20 2a  te of the..... *
6b80: 20 6f 62 6a 65 63 74 27 73 20 73 74 72 69 6e 67   object's string
6b90: 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2e   representation.
6ba0: 20 54 68 65 20 61 72 72 61 79 0a 09 09 09 09 20   The array..... 
6bb0: 2a 20 6d 75 73 74 20 62 65 20 66 6f 6c 6c 6f 77  * must be follow
6bc0: 65 64 20 62 79 20 61 20 6e 75 6c 6c 20 62 79 74  ed by a null byt
6bd0: 65 20 28 69 2e 65 2e 2c 20 61 74 0a 09 09 09 09  e (i.e., at.....
6be0: 20 2a 20 6f 66 66 73 65 74 20 6c 65 6e 67 74 68   * offset length
6bf0: 29 20 62 75 74 20 6d 61 79 20 61 6c 73 6f 20 63  ) but may also c
6c00: 6f 6e 74 61 69 6e 0a 09 09 09 09 20 2a 20 65 6d  ontain..... * em
6c10: 62 65 64 64 65 64 20 6e 75 6c 6c 20 63 68 61 72  bedded null char
6c20: 61 63 74 65 72 73 2e 20 54 68 65 20 61 72 72 61  acters. The arra
6c30: 79 27 73 0a 09 09 09 09 20 2a 20 73 74 6f 72 61  y's..... * stora
6c40: 67 65 20 69 73 20 61 6c 6c 6f 63 61 74 65 64 20  ge is allocated 
6c50: 62 79 20 63 6b 61 6c 6c 6f 63 2e 20 4e 55 4c 4c  by ckalloc. NULL
6c60: 20 6d 65 61 6e 73 0a 09 09 09 09 20 2a 20 74 68   means..... * th
6c70: 65 20 73 74 72 69 6e 67 20 72 65 70 20 69 73 20  e string rep is 
6c80: 69 6e 76 61 6c 69 64 20 61 6e 64 20 6d 75 73 74  invalid and must
6c90: 20 62 65 0a 09 09 09 09 20 2a 20 72 65 67 65 6e   be..... * regen
6ca0: 65 72 61 74 65 64 20 66 72 6f 6d 20 74 68 65 20  erated from the 
6cb0: 69 6e 74 65 72 6e 61 6c 20 72 65 70 2e 20 20 43  internal rep.  C
6cc0: 6c 69 65 6e 74 73 0a 09 09 09 09 20 2a 20 73 68  lients..... * sh
6cd0: 6f 75 6c 64 20 75 73 65 20 54 63 6c 5f 47 65 74  ould use Tcl_Get
6ce0: 53 74 72 69 6e 67 46 72 6f 6d 4f 62 6a 20 6f 72  StringFromObj or
6cf0: 0a 09 09 09 09 20 2a 20 54 63 6c 5f 47 65 74 53  ..... * Tcl_GetS
6d00: 74 72 69 6e 67 20 74 6f 20 67 65 74 20 61 20 70  tring to get a p
6d10: 6f 69 6e 74 65 72 20 74 6f 20 74 68 65 20 62 79  ointer to the by
6d20: 74 65 0a 09 09 09 09 20 2a 20 61 72 72 61 79 20  te..... * array 
6d30: 61 73 20 61 20 72 65 61 64 6f 6e 6c 79 20 76 61  as a readonly va
6d40: 6c 75 65 2e 20 2a 2f 0a 20 20 20 20 69 6e 74 20  lue. */.    int 
6d50: 6c 65 6e 67 74 68 3b 09 09 09 2f 2a 20 54 68 65  length;.../* The
6d60: 20 6e 75 6d 62 65 72 20 6f 66 20 62 79 74 65 73   number of bytes
6d70: 20 61 74 20 2a 62 79 74 65 73 2c 20 6e 6f 74 0a   at *bytes, not.
6d80: 09 09 09 09 20 2a 20 69 6e 63 6c 75 64 69 6e 67  .... * including
6d90: 20 74 68 65 20 74 65 72 6d 69 6e 61 74 69 6e 67   the terminating
6da0: 20 6e 75 6c 6c 2e 20 2a 2f 0a 20 20 20 20 63 6f   null. */.    co
6db0: 6e 73 74 20 54 63 6c 5f 4f 62 6a 54 79 70 65 20  nst Tcl_ObjType 
6dc0: 2a 74 79 70 65 50 74 72 3b 09 2f 2a 20 44 65 6e  *typePtr;./* Den
6dd0: 6f 74 65 73 20 74 68 65 20 6f 62 6a 65 63 74 27  otes the object'
6de0: 73 20 74 79 70 65 2e 20 41 6c 77 61 79 73 0a 09  s type. Always..
6df0: 09 09 09 20 2a 20 63 6f 72 72 65 73 70 6f 6e 64  ... * correspond
6e00: 73 20 74 6f 20 74 68 65 20 74 79 70 65 20 6f 66  s to the type of
6e10: 20 74 68 65 20 6f 62 6a 65 63 74 27 73 0a 09 09   the object's...
6e20: 09 09 20 2a 20 69 6e 74 65 72 6e 61 6c 20 72 65  .. * internal re
6e30: 70 2e 20 4e 55 4c 4c 20 69 6e 64 69 63 61 74 65  p. NULL indicate
6e40: 73 20 74 68 65 20 6f 62 6a 65 63 74 20 68 61 73  s the object has
6e50: 0a 09 09 09 09 20 2a 20 6e 6f 20 69 6e 74 65 72  ..... * no inter
6e60: 6e 61 6c 20 72 65 70 20 28 68 61 73 20 6e 6f 20  nal rep (has no 
6e70: 74 79 70 65 29 2e 20 2a 2f 0a 20 20 20 20 75 6e  type). */.    un
6e80: 69 6f 6e 20 7b 09 09 09 2f 2a 20 54 68 65 20 69  ion {.../* The i
6e90: 6e 74 65 72 6e 61 6c 20 72 65 70 72 65 73 65 6e  nternal represen
6ea0: 74 61 74 69 6f 6e 3a 20 2a 2f 0a 09 6c 6f 6e 67  tation: */..long
6eb0: 20 6c 6f 6e 67 56 61 6c 75 65 3b 09 09 2f 2a 20   longValue;../* 
6ec0: 20 20 2d 20 61 6e 20 6c 6f 6e 67 20 69 6e 74 65    - an long inte
6ed0: 67 65 72 20 76 61 6c 75 65 2e 20 2a 2f 0a 09 64  ger value. */..d
6ee0: 6f 75 62 6c 65 20 64 6f 75 62 6c 65 56 61 6c 75  ouble doubleValu
6ef0: 65 3b 09 2f 2a 20 20 20 2d 20 61 20 64 6f 75 62  e;./*   - a doub
6f00: 6c 65 2d 70 72 65 63 69 73 69 6f 6e 20 66 6c 6f  le-precision flo
6f10: 61 74 69 6e 67 20 76 61 6c 75 65 2e 20 2a 2f 0a  ating value. */.
6f20: 09 76 6f 69 64 20 2a 6f 74 68 65 72 56 61 6c 75  .void *otherValu
6f30: 65 50 74 72 3b 09 2f 2a 20 20 20 2d 20 61 6e 6f  ePtr;./*   - ano
6f40: 74 68 65 72 2c 20 74 79 70 65 2d 73 70 65 63 69  ther, type-speci
6f50: 66 69 63 20 76 61 6c 75 65 2c 0a 09 20 20 20 20  fic value,..    
6f60: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
6f70: 20 20 20 6e 6f 74 20 75 73 65 64 20 69 6e 74 65     not used inte
6f80: 72 6e 61 6c 6c 79 20 61 6e 79 20 6d 6f 72 65 2e  rnally any more.
6f90: 20 2a 2f 0a 09 54 63 6c 5f 57 69 64 65 49 6e 74   */..Tcl_WideInt
6fa0: 20 77 69 64 65 56 61 6c 75 65 3b 09 2f 2a 20 20   wideValue;./*  
6fb0: 20 2d 20 61 20 6c 6f 6e 67 20 6c 6f 6e 67 20 76   - a long long v
6fc0: 61 6c 75 65 2e 20 2a 2f 0a 09 73 74 72 75 63 74  alue. */..struct
6fd0: 20 7b 09 09 2f 2a 20 20 20 2d 20 69 6e 74 65 72   {../*   - inter
6fe0: 6e 61 6c 20 72 65 70 20 61 73 20 74 77 6f 20 70  nal rep as two p
6ff0: 6f 69 6e 74 65 72 73 2e 0a 09 09 09 09 20 2a 20  ointers...... * 
7000: 20 20 20 20 74 68 65 20 6d 61 69 6e 20 75 73 65      the main use
7010: 20 6f 66 20 77 68 69 63 68 20 69 73 20 61 20 62   of which is a b
7020: 69 67 6e 75 6d 27 73 0a 09 09 09 09 20 2a 20 20  ignum's..... *  
7030: 20 20 20 74 69 67 68 74 6c 79 20 70 61 63 6b 65     tightly packe
7040: 64 20 66 69 65 6c 64 73 2c 20 77 68 65 72 65 20  d fields, where 
7050: 74 68 65 20 61 6c 6c 6f 63 2c 0a 09 09 09 09 20  the alloc,..... 
7060: 2a 20 20 20 20 20 75 73 65 64 20 61 6e 64 20 73  *     used and s
7070: 69 67 6e 75 6d 20 66 6c 61 67 73 20 61 72 65 20  ignum flags are 
7080: 70 61 63 6b 65 64 20 69 6e 74 6f 0a 09 09 09 09  packed into.....
7090: 20 2a 20 20 20 20 20 70 74 72 32 20 77 69 74 68   *     ptr2 with
70a0: 20 65 76 65 72 79 74 68 69 6e 67 20 65 6c 73 65   everything else
70b0: 20 68 75 6e 67 20 6f 66 66 20 70 74 72 31 2e 20   hung off ptr1. 
70c0: 2a 2f 0a 09 20 20 20 20 76 6f 69 64 20 2a 70 74  */..    void *pt
70d0: 72 31 3b 0a 09 20 20 20 20 76 6f 69 64 20 2a 70  r1;..    void *p
70e0: 74 72 32 3b 0a 09 7d 20 74 77 6f 50 74 72 56 61  tr2;..} twoPtrVa
70f0: 6c 75 65 3b 0a 09 73 74 72 75 63 74 20 7b 09 09  lue;..struct {..
7100: 2f 2a 20 20 20 2d 20 69 6e 74 65 72 6e 61 6c 20  /*   - internal 
7110: 72 65 70 20 61 73 20 61 20 70 6f 69 6e 74 65 72  rep as a pointer
7120: 20 61 6e 64 20 61 20 6c 6f 6e 67 2c 0a 09 20 20   and a long,..  
7130: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
7140: 20 20 20 20 20 6e 6f 74 20 75 73 65 64 20 69 6e       not used in
7150: 74 65 72 6e 61 6c 6c 79 20 61 6e 79 20 6d 6f 72  ternally any mor
7160: 65 2e 20 2a 2f 0a 09 20 20 20 20 76 6f 69 64 20  e. */..    void 
7170: 2a 70 74 72 3b 0a 09 20 20 20 20 75 6e 73 69 67  *ptr;..    unsig
7180: 6e 65 64 20 6c 6f 6e 67 20 76 61 6c 75 65 3b 0a  ned long value;.
7190: 09 7d 20 70 74 72 41 6e 64 4c 6f 6e 67 52 65 70  .} ptrAndLongRep
71a0: 3b 0a 20 20 20 20 7d 20 69 6e 74 65 72 6e 61 6c  ;.    } internal
71b0: 52 65 70 3b 0a 7d 20 54 63 6c 5f 4f 62 6a 3b 0a  Rep;.} Tcl_Obj;.
71c0: 0a 2f 2a 0a 20 2a 20 4d 61 63 72 6f 73 20 74 6f  ./*. * Macros to
71d0: 20 69 6e 63 72 65 6d 65 6e 74 20 61 6e 64 20 64   increment and d
71e0: 65 63 72 65 6d 65 6e 74 20 61 20 54 63 6c 5f 4f  ecrement a Tcl_O
71f0: 62 6a 27 73 20 72 65 66 65 72 65 6e 63 65 20 63  bj's reference c
7200: 6f 75 6e 74 2c 20 61 6e 64 20 74 6f 20 74 65 73  ount, and to tes
7210: 74 0a 20 2a 20 77 68 65 74 68 65 72 20 61 6e 20  t. * whether an 
7220: 6f 62 6a 65 63 74 20 69 73 20 73 68 61 72 65 64  object is shared
7230: 20 28 69 2e 65 2e 20 68 61 73 20 72 65 66 65 72   (i.e. has refer
7240: 65 6e 63 65 20 63 6f 75 6e 74 20 3e 20 31 29 2e  ence count > 1).
7250: 20 4e 6f 74 65 3a 20 63 6c 69 65 6e 74 73 0a 20   Note: clients. 
7260: 2a 20 73 68 6f 75 6c 64 20 75 73 65 20 54 63 6c  * should use Tcl
7270: 5f 44 65 63 72 52 65 66 43 6f 75 6e 74 28 29 20  _DecrRefCount() 
7280: 77 68 65 6e 20 74 68 65 79 20 61 72 65 20 66 69  when they are fi
7290: 6e 69 73 68 65 64 20 75 73 69 6e 67 20 61 6e 20  nished using an 
72a0: 6f 62 6a 65 63 74 2c 20 61 6e 64 0a 20 2a 20 73  object, and. * s
72b0: 68 6f 75 6c 64 20 6e 65 76 65 72 20 63 61 6c 6c  hould never call
72c0: 20 54 63 6c 46 72 65 65 4f 62 6a 28 29 20 64 69   TclFreeObj() di
72d0: 72 65 63 74 6c 79 2e 20 54 63 6c 46 72 65 65 4f  rectly. TclFreeO
72e0: 62 6a 28 29 20 69 73 20 6f 6e 6c 79 20 64 65 66  bj() is only def
72f0: 69 6e 65 64 20 61 6e 64 0a 20 2a 20 6d 61 64 65  ined and. * made
7300: 20 70 75 62 6c 69 63 20 69 6e 20 74 63 6c 2e 68   public in tcl.h
7310: 20 74 6f 20 73 75 70 70 6f 72 74 20 54 63 6c 5f   to support Tcl_
7320: 44 65 63 72 52 65 66 43 6f 75 6e 74 27 73 20 6d  DecrRefCount's m
7330: 61 63 72 6f 20 64 65 66 69 6e 69 74 69 6f 6e 2e  acro definition.
7340: 0a 20 2a 2f 0a 0a 76 6f 69 64 09 09 54 63 6c 5f  . */..void..Tcl_
7350: 49 6e 63 72 52 65 66 43 6f 75 6e 74 28 54 63 6c  IncrRefCount(Tcl
7360: 5f 4f 62 6a 20 2a 6f 62 6a 50 74 72 29 3b 0a 76  _Obj *objPtr);.v
7370: 6f 69 64 09 09 54 63 6c 5f 44 65 63 72 52 65 66  oid..Tcl_DecrRef
7380: 43 6f 75 6e 74 28 54 63 6c 5f 4f 62 6a 20 2a 6f  Count(Tcl_Obj *o
7390: 62 6a 50 74 72 29 3b 0a 69 6e 74 09 09 54 63 6c  bjPtr);.int..Tcl
73a0: 5f 49 73 53 68 61 72 65 64 28 54 63 6c 5f 4f 62  _IsShared(Tcl_Ob
73b0: 6a 20 2a 6f 62 6a 50 74 72 29 3b 0a 0c 0a 2f 2a  j *objPtr);.../*
73c0: 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  . *-------------
73d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
73e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
73f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
7400: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a  ---------------.
7410: 20 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67   * The following
7420: 20 73 74 72 75 63 74 75 72 65 20 63 6f 6e 74 61   structure conta
7430: 69 6e 73 20 74 68 65 20 73 74 61 74 65 20 6e 65  ins the state ne
7440: 65 64 65 64 20 62 79 20 54 63 6c 5f 53 61 76 65  eded by Tcl_Save
7450: 52 65 73 75 6c 74 2e 20 4e 6f 2d 6f 6e 65 0a 20  Result. No-one. 
7460: 2a 20 6f 75 74 73 69 64 65 20 6f 66 20 54 63 6c  * outside of Tcl
7470: 20 73 68 6f 75 6c 64 20 61 63 63 65 73 73 20 61   should access a
7480: 6e 79 20 6f 66 20 74 68 65 73 65 20 66 69 65 6c  ny of these fiel
7490: 64 73 2e 20 54 68 69 73 20 73 74 72 75 63 74 75  ds. This structu
74a0: 72 65 20 69 73 0a 20 2a 20 74 79 70 69 63 61 6c  re is. * typical
74b0: 6c 79 20 61 6c 6c 6f 63 61 74 65 64 20 6f 6e 20  ly allocated on 
74c0: 74 68 65 20 73 74 61 63 6b 2e 0a 20 2a 2f 0a 0a  the stack.. */..
74d0: 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20 54  typedef struct T
74e0: 63 6c 5f 53 61 76 65 64 52 65 73 75 6c 74 20 7b  cl_SavedResult {
74f0: 0a 20 20 20 20 63 68 61 72 20 2a 72 65 73 75 6c  .    char *resul
7500: 74 3b 0a 20 20 20 20 54 63 6c 5f 46 72 65 65 50  t;.    Tcl_FreeP
7510: 72 6f 63 20 2a 66 72 65 65 50 72 6f 63 3b 0a 20  roc *freeProc;. 
7520: 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 6f 62 6a 52     Tcl_Obj *objR
7530: 65 73 75 6c 74 50 74 72 3b 0a 20 20 20 20 63 68  esultPtr;.    ch
7540: 61 72 20 2a 61 70 70 65 6e 64 52 65 73 75 6c 74  ar *appendResult
7550: 3b 0a 20 20 20 20 69 6e 74 20 61 70 70 65 6e 64  ;.    int append
7560: 41 76 6c 3b 0a 20 20 20 20 69 6e 74 20 61 70 70  Avl;.    int app
7570: 65 6e 64 55 73 65 64 3b 0a 20 20 20 20 63 68 61  endUsed;.    cha
7580: 72 20 72 65 73 75 6c 74 53 70 61 63 65 5b 54 43  r resultSpace[TC
7590: 4c 5f 52 45 53 55 4c 54 5f 53 49 5a 45 2b 31 5d  L_RESULT_SIZE+1]
75a0: 3b 0a 7d 20 54 63 6c 5f 53 61 76 65 64 52 65 73  ;.} Tcl_SavedRes
75b0: 75 6c 74 3b 0a 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d  ult;../*. *-----
75c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
75d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
75e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
75f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
7600: 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 54 68 65 20 66  -------. * The f
7610: 6f 6c 6c 6f 77 69 6e 67 20 64 65 66 69 6e 69 74  ollowing definit
7620: 69 6f 6e 73 20 73 75 70 70 6f 72 74 20 54 63 6c  ions support Tcl
7630: 27 73 20 6e 61 6d 65 73 70 61 63 65 20 66 61 63  's namespace fac
7640: 69 6c 69 74 79 2e 20 4e 6f 74 65 3a 20 74 68 65  ility. Note: the
7650: 20 66 69 72 73 74 0a 20 2a 20 66 69 76 65 20 66   first. * five f
7660: 69 65 6c 64 73 20 6d 75 73 74 20 6d 61 74 63 68  ields must match
7670: 20 65 78 61 63 74 6c 79 20 74 68 65 20 66 69 65   exactly the fie
7680: 6c 64 73 20 69 6e 20 61 20 4e 61 6d 65 73 70 61  lds in a Namespa
7690: 63 65 20 73 74 72 75 63 74 75 72 65 20 28 73 65  ce structure (se
76a0: 65 0a 20 2a 20 74 63 6c 49 6e 74 2e 68 29 2e 0a  e. * tclInt.h)..
76b0: 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 73 74 72   */..typedef str
76c0: 75 63 74 20 54 63 6c 5f 4e 61 6d 65 73 70 61 63  uct Tcl_Namespac
76d0: 65 20 7b 0a 20 20 20 20 63 68 61 72 20 2a 6e 61  e {.    char *na
76e0: 6d 65 3b 09 09 09 2f 2a 20 54 68 65 20 6e 61 6d  me;.../* The nam
76f0: 65 73 70 61 63 65 27 73 20 6e 61 6d 65 20 77 69  espace's name wi
7700: 74 68 69 6e 20 69 74 73 20 70 61 72 65 6e 74 0a  thin its parent.
7710: 09 09 09 09 20 2a 20 6e 61 6d 65 73 70 61 63 65  .... * namespace
7720: 2e 20 54 68 69 73 20 63 6f 6e 74 61 69 6e 73 20  . This contains 
7730: 6e 6f 20 3a 3a 27 73 2e 20 54 68 65 20 6e 61 6d  no ::'s. The nam
7740: 65 0a 09 09 09 09 20 2a 20 6f 66 20 74 68 65 20  e..... * of the 
7750: 67 6c 6f 62 61 6c 20 6e 61 6d 65 73 70 61 63 65  global namespace
7760: 20 69 73 20 22 22 20 61 6c 74 68 6f 75 67 68 20   is "" although 
7770: 22 3a 3a 22 0a 09 09 09 09 20 2a 20 69 73 20 61  "::"..... * is a
7780: 6e 20 73 79 6e 6f 6e 79 6d 2e 20 2a 2f 0a 20 20  n synonym. */.  
7790: 20 20 63 68 61 72 20 2a 66 75 6c 6c 4e 61 6d 65    char *fullName
77a0: 3b 09 09 2f 2a 20 54 68 65 20 6e 61 6d 65 73 70  ;../* The namesp
77b0: 61 63 65 27 73 20 66 75 6c 6c 79 20 71 75 61 6c  ace's fully qual
77c0: 69 66 69 65 64 20 6e 61 6d 65 2e 20 54 68 69 73  ified name. This
77d0: 0a 09 09 09 09 20 2a 20 73 74 61 72 74 73 20 77  ..... * starts w
77e0: 69 74 68 20 3a 3a 2e 20 2a 2f 0a 20 20 20 20 43  ith ::. */.    C
77f0: 6c 69 65 6e 74 44 61 74 61 20 63 6c 69 65 6e 74  lientData client
7800: 44 61 74 61 3b 09 2f 2a 20 41 72 62 69 74 72 61  Data;./* Arbitra
7810: 72 79 20 76 61 6c 75 65 20 61 73 73 6f 63 69 61  ry value associa
7820: 74 65 64 20 77 69 74 68 20 74 68 69 73 0a 09 09  ted with this...
7830: 09 09 20 2a 20 6e 61 6d 65 73 70 61 63 65 2e 20  .. * namespace. 
7840: 2a 2f 0a 20 20 20 20 54 63 6c 5f 4e 61 6d 65 73  */.    Tcl_Names
7850: 70 61 63 65 44 65 6c 65 74 65 50 72 6f 63 20 2a  paceDeleteProc *
7860: 64 65 6c 65 74 65 50 72 6f 63 3b 0a 09 09 09 09  deleteProc;.....
7870: 2f 2a 20 46 75 6e 63 74 69 6f 6e 20 69 6e 76 6f  /* Function invo
7880: 6b 65 64 20 77 68 65 6e 20 64 65 6c 65 74 69 6e  ked when deletin
7890: 67 20 74 68 65 0a 09 09 09 09 20 2a 20 6e 61 6d  g the..... * nam
78a0: 65 73 70 61 63 65 20 74 6f 2c 20 65 2e 67 2e 2c  espace to, e.g.,
78b0: 20 66 72 65 65 20 63 6c 69 65 6e 74 44 61 74 61   free clientData
78c0: 2e 20 2a 2f 0a 20 20 20 20 73 74 72 75 63 74 20  . */.    struct 
78d0: 54 63 6c 5f 4e 61 6d 65 73 70 61 63 65 20 2a 70  Tcl_Namespace *p
78e0: 61 72 65 6e 74 50 74 72 3b 0a 09 09 09 09 2f 2a  arentPtr;...../*
78f0: 20 50 6f 69 6e 74 73 20 74 6f 20 74 68 65 20 6e   Points to the n
7900: 61 6d 65 73 70 61 63 65 20 74 68 61 74 20 63 6f  amespace that co
7910: 6e 74 61 69 6e 73 20 74 68 69 73 0a 09 09 09 09  ntains this.....
7920: 20 2a 20 6f 6e 65 2e 20 4e 55 4c 4c 20 69 66 20   * one. NULL if 
7930: 74 68 69 73 20 69 73 20 74 68 65 20 67 6c 6f 62  this is the glob
7940: 61 6c 0a 09 09 09 09 20 2a 20 6e 61 6d 65 73 70  al..... * namesp
7950: 61 63 65 2e 20 2a 2f 0a 7d 20 54 63 6c 5f 4e 61  ace. */.} Tcl_Na
7960: 6d 65 73 70 61 63 65 3b 0a 0a 2f 2a 0a 20 2a 2d  mespace;../*. *-
7970: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
7980: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
7990: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
79a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
79b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 54  -----------. * T
79c0: 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 73 74 72  he following str
79d0: 75 63 74 75 72 65 20 72 65 70 72 65 73 65 6e 74  ucture represent
79e0: 73 20 61 20 63 61 6c 6c 20 66 72 61 6d 65 2c 20  s a call frame, 
79f0: 6f 72 20 61 63 74 69 76 61 74 69 6f 6e 20 72 65  or activation re
7a00: 63 6f 72 64 2e 20 41 0a 20 2a 20 63 61 6c 6c 20  cord. A. * call 
7a10: 66 72 61 6d 65 20 64 65 66 69 6e 65 73 20 61 20  frame defines a 
7a20: 6e 61 6d 69 6e 67 20 63 6f 6e 74 65 78 74 20 66  naming context f
7a30: 6f 72 20 61 20 70 72 6f 63 65 64 75 72 65 20 63  or a procedure c
7a40: 61 6c 6c 3a 20 69 74 73 20 6c 6f 63 61 6c 20 73  all: its local s
7a50: 63 6f 70 65 0a 20 2a 20 28 66 6f 72 20 6c 6f 63  cope. * (for loc
7a60: 61 6c 20 76 61 72 69 61 62 6c 65 73 29 20 61 6e  al variables) an
7a70: 64 20 69 74 73 20 6e 61 6d 65 73 70 61 63 65 20  d its namespace 
7a80: 73 63 6f 70 65 20 28 75 73 65 64 20 66 6f 72 20  scope (used for 
7a90: 6e 6f 6e 2d 6c 6f 63 61 6c 0a 20 2a 20 76 61 72  non-local. * var
7aa0: 69 61 62 6c 65 73 3b 20 6f 66 74 65 6e 20 74 68  iables; often th
7ab0: 65 20 67 6c 6f 62 61 6c 20 3a 3a 20 6e 61 6d 65  e global :: name
7ac0: 73 70 61 63 65 29 2e 20 41 20 63 61 6c 6c 20 66  space). A call f
7ad0: 72 61 6d 65 20 63 61 6e 20 61 6c 73 6f 20 64 65  rame can also de
7ae0: 66 69 6e 65 20 74 68 65 0a 20 2a 20 6e 61 6d 69  fine the. * nami
7af0: 6e 67 20 63 6f 6e 74 65 78 74 20 66 6f 72 20 61  ng context for a
7b00: 20 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c 20   namespace eval 
7b10: 6f 72 20 6e 61 6d 65 73 70 61 63 65 20 69 6e 73  or namespace ins
7b20: 63 6f 70 65 20 63 6f 6d 6d 61 6e 64 3a 20 74 68  cope command: th
7b30: 65 0a 20 2a 20 6e 61 6d 65 73 70 61 63 65 20 69  e. * namespace i
7b40: 6e 20 77 68 69 63 68 20 74 68 65 20 63 6f 6d 6d  n which the comm
7b50: 61 6e 64 27 73 20 63 6f 64 65 20 73 68 6f 75 6c  and's code shoul
7b60: 64 20 65 78 65 63 75 74 65 2e 20 54 68 65 20 54  d execute. The T
7b70: 63 6c 5f 43 61 6c 6c 46 72 61 6d 65 0a 20 2a 20  cl_CallFrame. * 
7b80: 73 74 72 75 63 74 75 72 65 73 20 65 78 69 73 74  structures exist
7b90: 20 6f 6e 6c 79 20 77 68 69 6c 65 20 70 72 6f 63   only while proc
7ba0: 65 64 75 72 65 73 20 6f 72 20 6e 61 6d 65 73 70  edures or namesp
7bb0: 61 63 65 20 65 76 61 6c 2f 69 6e 73 63 6f 70 65  ace eval/inscope
7bc0: 27 73 20 61 72 65 0a 20 2a 20 62 65 69 6e 67 20  's are. * being 
7bd0: 65 78 65 63 75 74 65 64 2c 20 61 6e 64 20 70 72  executed, and pr
7be0: 6f 76 69 64 65 20 61 20 54 63 6c 20 63 61 6c 6c  ovide a Tcl call
7bf0: 20 73 74 61 63 6b 2e 0a 20 2a 0a 20 2a 20 41 20   stack.. *. * A 
7c00: 63 61 6c 6c 20 66 72 61 6d 65 20 69 73 20 69 6e  call frame is in
7c10: 69 74 69 61 6c 69 7a 65 64 20 61 6e 64 20 70 75  itialized and pu
7c20: 73 68 65 64 20 75 73 69 6e 67 20 54 63 6c 5f 50  shed using Tcl_P
7c30: 75 73 68 43 61 6c 6c 46 72 61 6d 65 20 61 6e 64  ushCallFrame and
7c40: 20 70 6f 70 70 65 64 0a 20 2a 20 75 73 69 6e 67   popped. * using
7c50: 20 54 63 6c 5f 50 6f 70 43 61 6c 6c 46 72 61 6d   Tcl_PopCallFram
7c60: 65 2e 20 53 74 6f 72 61 67 65 20 66 6f 72 20 61  e. Storage for a
7c70: 20 54 63 6c 5f 43 61 6c 6c 46 72 61 6d 65 20 6d   Tcl_CallFrame m
7c80: 75 73 74 20 62 65 20 70 72 6f 76 69 64 65 64 20  ust be provided 
7c90: 62 79 20 74 68 65 0a 20 2a 20 54 63 6c 5f 50 75  by the. * Tcl_Pu
7ca0: 73 68 43 61 6c 6c 46 72 61 6d 65 20 63 61 6c 6c  shCallFrame call
7cb0: 65 72 2c 20 61 6e 64 20 63 61 6c 6c 65 72 73 20  er, and callers 
7cc0: 74 79 70 69 63 61 6c 6c 79 20 61 6c 6c 6f 63 61  typically alloca
7cd0: 74 65 20 74 68 65 6d 20 6f 6e 20 74 68 65 20 43  te them on the C
7ce0: 20 63 61 6c 6c 0a 20 2a 20 73 74 61 63 6b 20 66   call. * stack f
7cf0: 6f 72 20 65 66 66 69 63 69 65 6e 63 79 2e 20 46  or efficiency. F
7d00: 6f 72 20 74 68 69 73 20 72 65 61 73 6f 6e 2c 20  or this reason, 
7d10: 54 63 6c 5f 43 61 6c 6c 46 72 61 6d 65 20 69 73  Tcl_CallFrame is
7d20: 20 64 65 66 69 6e 65 64 20 61 73 20 61 0a 20 2a   defined as a. *
7d30: 20 73 74 72 75 63 74 75 72 65 20 61 6e 64 20 6e   structure and n
7d40: 6f 74 20 61 73 20 61 6e 20 6f 70 61 71 75 65 20  ot as an opaque 
7d50: 74 6f 6b 65 6e 2e 20 48 6f 77 65 76 65 72 2c 20  token. However, 
7d60: 6d 6f 73 74 20 54 63 6c 5f 43 61 6c 6c 46 72 61  most Tcl_CallFra
7d70: 6d 65 20 66 69 65 6c 64 73 0a 20 2a 20 61 72 65  me fields. * are
7d80: 20 68 69 64 64 65 6e 20 73 69 6e 63 65 20 61 70   hidden since ap
7d90: 70 6c 69 63 61 74 69 6f 6e 73 20 73 68 6f 75 6c  plications shoul
7da0: 64 20 6e 6f 74 20 61 63 63 65 73 73 20 74 68 65  d not access the
7db0: 6d 20 64 69 72 65 63 74 6c 79 3b 20 6f 74 68 65  m directly; othe
7dc0: 72 73 20 61 72 65 0a 20 2a 20 64 65 63 6c 61 72  rs are. * declar
7dd0: 65 64 20 61 73 20 22 64 75 6d 6d 79 58 22 2e 0a  ed as "dummyX"..
7de0: 20 2a 0a 20 2a 20 57 41 52 4e 49 4e 47 21 21 20   *. * WARNING!! 
7df0: 54 68 65 20 73 74 72 75 63 74 75 72 65 20 64 65  The structure de
7e00: 66 69 6e 69 74 69 6f 6e 20 6d 75 73 74 20 62 65  finition must be
7e10: 20 6b 65 70 74 20 63 6f 6e 73 69 73 74 65 6e 74   kept consistent
7e20: 20 77 69 74 68 20 74 68 65 0a 20 2a 20 43 61 6c   with the. * Cal
7e30: 6c 46 72 61 6d 65 20 73 74 72 75 63 74 75 72 65  lFrame structure
7e40: 20 69 6e 20 74 63 6c 49 6e 74 2e 68 2e 20 49 66   in tclInt.h. If
7e50: 20 79 6f 75 20 63 68 61 6e 67 65 20 6f 6e 65 2c   you change one,
7e60: 20 63 68 61 6e 67 65 20 74 68 65 20 6f 74 68 65   change the othe
7e70: 72 2e 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20  r.. */..typedef 
7e80: 73 74 72 75 63 74 20 54 63 6c 5f 43 61 6c 6c 46  struct Tcl_CallF
7e90: 72 61 6d 65 20 7b 0a 20 20 20 20 54 63 6c 5f 4e  rame {.    Tcl_N
7ea0: 61 6d 65 73 70 61 63 65 20 2a 6e 73 50 74 72 3b  amespace *nsPtr;
7eb0: 0a 20 20 20 20 69 6e 74 20 64 75 6d 6d 79 31 3b  .    int dummy1;
7ec0: 0a 20 20 20 20 69 6e 74 20 64 75 6d 6d 79 32 3b  .    int dummy2;
7ed0: 0a 20 20 20 20 76 6f 69 64 20 2a 64 75 6d 6d 79  .    void *dummy
7ee0: 33 3b 0a 20 20 20 20 76 6f 69 64 20 2a 64 75 6d  3;.    void *dum
7ef0: 6d 79 34 3b 0a 20 20 20 20 76 6f 69 64 20 2a 64  my4;.    void *d
7f00: 75 6d 6d 79 35 3b 0a 20 20 20 20 69 6e 74 20 64  ummy5;.    int d
7f10: 75 6d 6d 79 36 3b 0a 20 20 20 20 76 6f 69 64 20  ummy6;.    void 
7f20: 2a 64 75 6d 6d 79 37 3b 0a 20 20 20 20 76 6f 69  *dummy7;.    voi
7f30: 64 20 2a 64 75 6d 6d 79 38 3b 0a 20 20 20 20 69  d *dummy8;.    i
7f40: 6e 74 20 64 75 6d 6d 79 39 3b 0a 20 20 20 20 76  nt dummy9;.    v
7f50: 6f 69 64 20 2a 64 75 6d 6d 79 31 30 3b 0a 20 20  oid *dummy10;.  
7f60: 20 20 76 6f 69 64 20 2a 64 75 6d 6d 79 31 31 3b    void *dummy11;
7f70: 0a 20 20 20 20 76 6f 69 64 20 2a 64 75 6d 6d 79  .    void *dummy
7f80: 31 32 3b 0a 20 20 20 20 76 6f 69 64 20 2a 64 75  12;.    void *du
7f90: 6d 6d 79 31 33 3b 0a 7d 20 54 63 6c 5f 43 61 6c  mmy13;.} Tcl_Cal
7fa0: 6c 46 72 61 6d 65 3b 0a 0a 2f 2a 0a 20 2a 2d 2d  lFrame;../*. *--
7fb0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
7fc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
7fd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
7fe0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
7ff0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 49 6e  ----------. * In
8000: 66 6f 72 6d 61 74 69 6f 6e 20 61 62 6f 75 74 20  formation about 
8010: 63 6f 6d 6d 61 6e 64 73 20 74 68 61 74 20 69 73  commands that is
8020: 20 72 65 74 75 72 6e 65 64 20 62 79 20 54 63 6c   returned by Tcl
8030: 5f 47 65 74 43 6f 6d 6d 61 6e 64 49 6e 66 6f 20  _GetCommandInfo 
8040: 61 6e 64 0a 20 2a 20 70 61 73 73 65 64 20 74 6f  and. * passed to
8050: 20 54 63 6c 5f 53 65 74 43 6f 6d 6d 61 6e 64 49   Tcl_SetCommandI
8060: 6e 66 6f 2e 20 6f 62 6a 50 72 6f 63 20 69 73 20  nfo. objProc is 
8070: 61 6e 20 6f 62 6a 63 2f 6f 62 6a 76 20 6f 62 6a  an objc/objv obj
8080: 65 63 74 2d 62 61 73 65 64 20 63 6f 6d 6d 61 6e  ect-based comman
8090: 64 0a 20 2a 20 66 75 6e 63 74 69 6f 6e 20 77 68  d. * function wh
80a0: 69 6c 65 20 70 72 6f 63 20 69 73 20 61 20 74 72  ile proc is a tr
80b0: 61 64 69 74 69 6f 6e 61 6c 20 54 63 6c 20 61 72  aditional Tcl ar
80c0: 67 63 2f 61 72 67 76 20 73 74 72 69 6e 67 2d 62  gc/argv string-b
80d0: 61 73 65 64 20 66 75 6e 63 74 69 6f 6e 2e 0a 20  ased function.. 
80e0: 2a 20 54 63 6c 5f 43 72 65 61 74 65 4f 62 6a 43  * Tcl_CreateObjC
80f0: 6f 6d 6d 61 6e 64 20 61 6e 64 20 54 63 6c 5f 43  ommand and Tcl_C
8100: 72 65 61 74 65 43 6f 6d 6d 61 6e 64 20 65 6e 73  reateCommand ens
8110: 75 72 65 20 74 68 61 74 20 62 6f 74 68 20 6f 62  ure that both ob
8120: 6a 50 72 6f 63 20 61 6e 64 0a 20 2a 20 70 72 6f  jProc and. * pro
8130: 63 20 61 72 65 20 6e 6f 6e 2d 4e 55 4c 4c 20 61  c are non-NULL a
8140: 6e 64 20 63 61 6e 20 62 65 20 63 61 6c 6c 65 64  nd can be called
8150: 20 74 6f 20 65 78 65 63 75 74 65 20 74 68 65 20   to execute the 
8160: 63 6f 6d 6d 61 6e 64 2e 20 48 6f 77 65 76 65 72  command. However
8170: 2c 20 69 74 20 6d 61 79 0a 20 2a 20 62 65 20 66  , it may. * be f
8180: 61 73 74 65 72 20 74 6f 20 63 61 6c 6c 20 6f 6e  aster to call on
8190: 65 20 69 6e 73 74 65 61 64 20 6f 66 20 74 68 65  e instead of the
81a0: 20 6f 74 68 65 72 2e 20 54 68 65 20 6d 65 6d 62   other. The memb
81b0: 65 72 20 69 73 4e 61 74 69 76 65 4f 62 6a 65 63  er isNativeObjec
81c0: 74 50 72 6f 63 0a 20 2a 20 69 73 20 73 65 74 20  tProc. * is set 
81d0: 74 6f 20 31 20 69 66 20 61 6e 20 6f 62 6a 65 63  to 1 if an objec
81e0: 74 2d 62 61 73 65 64 20 66 75 6e 63 74 69 6f 6e  t-based function
81f0: 20 77 61 73 20 72 65 67 69 73 74 65 72 65 64 20   was registered 
8200: 62 79 0a 20 2a 20 54 63 6c 5f 43 72 65 61 74 65  by. * Tcl_Create
8210: 4f 62 6a 43 6f 6d 6d 61 6e 64 2c 20 61 6e 64 20  ObjCommand, and 
8220: 74 6f 20 30 20 69 66 20 61 20 73 74 72 69 6e 67  to 0 if a string
8230: 2d 62 61 73 65 64 20 66 75 6e 63 74 69 6f 6e 20  -based function 
8240: 77 61 73 20 72 65 67 69 73 74 65 72 65 64 20 62  was registered b
8250: 79 0a 20 2a 20 54 63 6c 5f 43 72 65 61 74 65 43  y. * Tcl_CreateC
8260: 6f 6d 6d 61 6e 64 2e 20 54 68 65 20 6f 74 68 65  ommand. The othe
8270: 72 20 66 75 6e 63 74 69 6f 6e 20 69 73 20 74 79  r function is ty
8280: 70 69 63 61 6c 6c 79 20 73 65 74 20 74 6f 20 61  pically set to a
8290: 20 63 6f 6d 70 61 74 69 62 69 6c 69 74 79 0a 20   compatibility. 
82a0: 2a 20 77 72 61 70 70 65 72 20 74 68 61 74 20 64  * wrapper that d
82b0: 6f 65 73 20 73 74 72 69 6e 67 2d 74 6f 2d 6f 62  oes string-to-ob
82c0: 6a 65 63 74 20 6f 72 20 6f 62 6a 65 63 74 2d 74  ject or object-t
82d0: 6f 2d 73 74 72 69 6e 67 20 61 72 67 75 6d 65 6e  o-string argumen
82e0: 74 20 63 6f 6e 76 65 72 73 69 6f 6e 73 0a 20 2a  t conversions. *
82f0: 20 74 68 65 6e 20 63 61 6c 6c 73 20 74 68 65 20   then calls the 
8300: 6f 74 68 65 72 20 66 75 6e 63 74 69 6f 6e 2e 0a  other function..
8310: 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 73 74 72   */..typedef str
8320: 75 63 74 20 54 63 6c 5f 43 6d 64 49 6e 66 6f 20  uct Tcl_CmdInfo 
8330: 7b 0a 20 20 20 20 69 6e 74 20 69 73 4e 61 74 69  {.    int isNati
8340: 76 65 4f 62 6a 65 63 74 50 72 6f 63 3b 09 2f 2a  veObjectProc;./*
8350: 20 31 20 69 66 20 6f 62 6a 50 72 6f 63 20 77 61   1 if objProc wa
8360: 73 20 72 65 67 69 73 74 65 72 65 64 20 62 79 20  s registered by 
8370: 61 20 63 61 6c 6c 20 74 6f 0a 09 09 09 09 20 2a  a call to..... *
8380: 20 54 63 6c 5f 43 72 65 61 74 65 4f 62 6a 43 6f   Tcl_CreateObjCo
8390: 6d 6d 61 6e 64 3b 20 30 20 6f 74 68 65 72 77 69  mmand; 0 otherwi
83a0: 73 65 2e 0a 09 09 09 09 20 2a 20 54 63 6c 5f 53  se...... * Tcl_S
83b0: 65 74 43 6d 64 49 6e 66 6f 20 64 6f 65 73 20 6e  etCmdInfo does n
83c0: 6f 74 20 6d 6f 64 69 66 79 20 74 68 69 73 0a 09  ot modify this..
83d0: 09 09 09 20 2a 20 66 69 65 6c 64 2e 20 2a 2f 0a  ... * field. */.
83e0: 20 20 20 20 54 63 6c 5f 4f 62 6a 43 6d 64 50 72      Tcl_ObjCmdPr
83f0: 6f 63 20 2a 6f 62 6a 50 72 6f 63 3b 09 2f 2a 20  oc *objProc;./* 
8400: 43 6f 6d 6d 61 6e 64 27 73 20 6f 62 6a 65 63 74  Command's object
8410: 2d 62 61 73 65 64 20 66 75 6e 63 74 69 6f 6e 2e  -based function.
8420: 20 2a 2f 0a 20 20 20 20 43 6c 69 65 6e 74 44 61   */.    ClientDa
8430: 74 61 20 6f 62 6a 43 6c 69 65 6e 74 44 61 74 61  ta objClientData
8440: 3b 09 2f 2a 20 43 6c 69 65 6e 74 44 61 74 61 20  ;./* ClientData 
8450: 66 6f 72 20 6f 62 6a 65 63 74 20 70 72 6f 63 2e  for object proc.
8460: 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 43 6d 64 50   */.    Tcl_CmdP
8470: 72 6f 63 20 2a 70 72 6f 63 3b 09 09 2f 2a 20 43  roc *proc;../* C
8480: 6f 6d 6d 61 6e 64 27 73 20 73 74 72 69 6e 67 2d  ommand's string-
8490: 62 61 73 65 64 20 66 75 6e 63 74 69 6f 6e 2e 20  based function. 
84a0: 2a 2f 0a 20 20 20 20 43 6c 69 65 6e 74 44 61 74  */.    ClientDat
84b0: 61 20 63 6c 69 65 6e 74 44 61 74 61 3b 09 2f 2a  a clientData;./*
84c0: 20 43 6c 69 65 6e 74 44 61 74 61 20 66 6f 72 20   ClientData for 
84d0: 73 74 72 69 6e 67 20 70 72 6f 63 2e 20 2a 2f 0a  string proc. */.
84e0: 20 20 20 20 54 63 6c 5f 43 6d 64 44 65 6c 65 74      Tcl_CmdDelet
84f0: 65 50 72 6f 63 20 2a 64 65 6c 65 74 65 50 72 6f  eProc *deletePro
8500: 63 3b 0a 09 09 09 09 2f 2a 20 46 75 6e 63 74 69  c;...../* Functi
8510: 6f 6e 20 74 6f 20 63 61 6c 6c 20 77 68 65 6e 20  on to call when 
8520: 63 6f 6d 6d 61 6e 64 20 69 73 0a 09 09 09 09 20  command is..... 
8530: 2a 20 64 65 6c 65 74 65 64 2e 20 2a 2f 0a 20 20  * deleted. */.  
8540: 20 20 43 6c 69 65 6e 74 44 61 74 61 20 64 65 6c    ClientData del
8550: 65 74 65 44 61 74 61 3b 09 2f 2a 20 56 61 6c 75  eteData;./* Valu
8560: 65 20 74 6f 20 70 61 73 73 20 74 6f 20 64 65 6c  e to pass to del
8570: 65 74 65 50 72 6f 63 20 28 75 73 75 61 6c 6c 79  eteProc (usually
8580: 20 74 68 65 0a 09 09 09 09 20 2a 20 73 61 6d 65   the..... * same
8590: 20 61 73 20 63 6c 69 65 6e 74 44 61 74 61 29 2e   as clientData).
85a0: 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 4e 61 6d 65   */.    Tcl_Name
85b0: 73 70 61 63 65 20 2a 6e 61 6d 65 73 70 61 63 65  space *namespace
85c0: 50 74 72 3b 2f 2a 20 50 6f 69 6e 74 73 20 74 6f  Ptr;/* Points to
85d0: 20 74 68 65 20 6e 61 6d 65 73 70 61 63 65 20 74   the namespace t
85e0: 68 61 74 20 63 6f 6e 74 61 69 6e 73 20 74 68 69  hat contains thi
85f0: 73 0a 09 09 09 09 20 2a 20 63 6f 6d 6d 61 6e 64  s..... * command
8600: 2e 20 4e 6f 74 65 20 74 68 61 74 20 54 63 6c 5f  . Note that Tcl_
8610: 53 65 74 43 6d 64 49 6e 66 6f 20 77 69 6c 6c 20  SetCmdInfo will 
8620: 6e 6f 74 0a 09 09 09 09 20 2a 20 63 68 61 6e 67  not..... * chang
8630: 65 20 61 20 63 6f 6d 6d 61 6e 64 27 73 20 6e 61  e a command's na
8640: 6d 65 73 70 61 63 65 3b 20 75 73 65 0a 09 09 09  mespace; use....
8650: 09 20 2a 20 54 63 6c 52 65 6e 61 6d 65 43 6f 6d  . * TclRenameCom
8660: 6d 61 6e 64 20 6f 72 20 54 63 6c 5f 45 76 61 6c  mand or Tcl_Eval
8670: 20 28 6f 66 20 27 72 65 6e 61 6d 65 27 29 0a 09   (of 'rename')..
8680: 09 09 09 20 2a 20 74 6f 20 64 6f 20 74 68 61 74  ... * to do that
8690: 2e 20 2a 2f 0a 7d 20 54 63 6c 5f 43 6d 64 49 6e  . */.} Tcl_CmdIn
86a0: 66 6f 3b 0a 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d  fo;../*. *------
86b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
86c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
86d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
86e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
86f0: 2d 2d 2d 2d 2d 2d 0a 20 2a 20 54 68 65 20 73 74  ------. * The st
8700: 72 75 63 74 75 72 65 20 64 65 66 69 6e 65 64 20  ructure defined 
8710: 62 65 6c 6f 77 20 69 73 20 75 73 65 64 20 74 6f  below is used to
8720: 20 68 6f 6c 64 20 64 79 6e 61 6d 69 63 20 73 74   hold dynamic st
8730: 72 69 6e 67 73 2e 20 54 68 65 20 6f 6e 6c 79 0a  rings. The only.
8740: 20 2a 20 66 69 65 6c 64 73 20 74 68 61 74 20 63   * fields that c
8750: 6c 69 65 6e 74 73 20 73 68 6f 75 6c 64 20 75 73  lients should us
8760: 65 20 61 72 65 20 73 74 72 69 6e 67 20 61 6e 64  e are string and
8770: 20 6c 65 6e 67 74 68 2c 20 61 63 63 65 73 73 69   length, accessi
8780: 62 6c 65 20 76 69 61 20 74 68 65 0a 20 2a 20 6d  ble via the. * m
8790: 61 63 72 6f 73 20 54 63 6c 5f 44 53 74 72 69 6e  acros Tcl_DStrin
87a0: 67 56 61 6c 75 65 20 61 6e 64 20 54 63 6c 5f 44  gValue and Tcl_D
87b0: 53 74 72 69 6e 67 4c 65 6e 67 74 68 2e 0a 20 2a  StringLength.. *
87c0: 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 44  /..#define TCL_D
87d0: 53 54 52 49 4e 47 5f 53 54 41 54 49 43 5f 53 49  STRING_STATIC_SI
87e0: 5a 45 20 32 30 30 0a 74 79 70 65 64 65 66 20 73  ZE 200.typedef s
87f0: 74 72 75 63 74 20 54 63 6c 5f 44 53 74 72 69 6e  truct Tcl_DStrin
8800: 67 20 7b 0a 20 20 20 20 63 68 61 72 20 2a 73 74  g {.    char *st
8810: 72 69 6e 67 3b 09 09 2f 2a 20 50 6f 69 6e 74 73  ring;../* Points
8820: 20 74 6f 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66   to beginning of
8830: 20 73 74 72 69 6e 67 3a 20 65 69 74 68 65 72 0a   string: either.
8840: 09 09 09 09 20 2a 20 73 74 61 74 69 63 53 70 61  .... * staticSpa
8850: 63 65 20 62 65 6c 6f 77 20 6f 72 20 61 20 6d 61  ce below or a ma
8860: 6c 6c 6f 63 65 64 20 61 72 72 61 79 2e 20 2a 2f  lloced array. */
8870: 0a 20 20 20 20 69 6e 74 20 6c 65 6e 67 74 68 3b  .    int length;
8880: 09 09 09 2f 2a 20 4e 75 6d 62 65 72 20 6f 66 20  .../* Number of 
8890: 6e 6f 6e 2d 4e 55 4c 4c 20 63 68 61 72 61 63 74  non-NULL charact
88a0: 65 72 73 20 69 6e 20 74 68 65 0a 09 09 09 09 20  ers in the..... 
88b0: 2a 20 73 74 72 69 6e 67 2e 20 2a 2f 0a 20 20 20  * string. */.   
88c0: 20 69 6e 74 20 73 70 61 63 65 41 76 6c 3b 09 09   int spaceAvl;..
88d0: 2f 2a 20 54 6f 74 61 6c 20 6e 75 6d 62 65 72 20  /* Total number 
88e0: 6f 66 20 62 79 74 65 73 20 61 76 61 69 6c 61 62  of bytes availab
88f0: 6c 65 20 66 6f 72 20 74 68 65 0a 09 09 09 09 20  le for the..... 
8900: 2a 20 73 74 72 69 6e 67 20 61 6e 64 20 69 74 73  * string and its
8910: 20 74 65 72 6d 69 6e 61 74 69 6e 67 20 4e 55 4c   terminating NUL
8920: 4c 20 63 68 61 72 2e 20 2a 2f 0a 20 20 20 20 63  L char. */.    c
8930: 68 61 72 20 73 74 61 74 69 63 53 70 61 63 65 5b  har staticSpace[
8940: 54 43 4c 5f 44 53 54 52 49 4e 47 5f 53 54 41 54  TCL_DSTRING_STAT
8950: 49 43 5f 53 49 5a 45 5d 3b 0a 09 09 09 09 2f 2a  IC_SIZE];...../*
8960: 20 53 70 61 63 65 20 74 6f 20 75 73 65 20 69 6e   Space to use in
8970: 20 63 6f 6d 6d 6f 6e 20 63 61 73 65 20 77 68 65   common case whe
8980: 72 65 20 73 74 72 69 6e 67 20 69 73 0a 09 09 09  re string is....
8990: 09 20 2a 20 73 6d 61 6c 6c 2e 20 2a 2f 0a 7d 20  . * small. */.} 
89a0: 54 63 6c 5f 44 53 74 72 69 6e 67 3b 0a 0a 23 64  Tcl_DString;..#d
89b0: 65 66 69 6e 65 20 54 63 6c 5f 44 53 74 72 69 6e  efine Tcl_DStrin
89c0: 67 4c 65 6e 67 74 68 28 64 73 50 74 72 29 20 28  gLength(dsPtr) (
89d0: 28 64 73 50 74 72 29 2d 3e 6c 65 6e 67 74 68 29  (dsPtr)->length)
89e0: 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f 44 53 74  .#define Tcl_DSt
89f0: 72 69 6e 67 56 61 6c 75 65 28 64 73 50 74 72 29  ringValue(dsPtr)
8a00: 20 28 28 64 73 50 74 72 29 2d 3e 73 74 72 69 6e   ((dsPtr)->strin
8a10: 67 29 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f 44  g).#define Tcl_D
8a20: 53 74 72 69 6e 67 54 72 75 6e 63 20 54 63 6c 5f  StringTrunc Tcl_
8a30: 44 53 74 72 69 6e 67 53 65 74 4c 65 6e 67 74 68  DStringSetLength
8a40: 0a 0a 2f 2a 0a 20 2a 20 44 65 66 69 6e 69 74 69  ../*. * Definiti
8a50: 6f 6e 73 20 66 6f 72 20 74 68 65 20 6d 61 78 69  ons for the maxi
8a60: 6d 75 6d 20 6e 75 6d 62 65 72 20 6f 66 20 64 69  mum number of di
8a70: 67 69 74 73 20 6f 66 20 70 72 65 63 69 73 69 6f  gits of precisio
8a80: 6e 20 74 68 61 74 20 6d 61 79 20 62 65 0a 20 2a  n that may be. *
8a90: 20 73 70 65 63 69 66 69 65 64 20 69 6e 20 74 68   specified in th
8aa0: 65 20 22 74 63 6c 5f 70 72 65 63 69 73 69 6f 6e  e "tcl_precision
8ab0: 22 20 76 61 72 69 61 62 6c 65 2c 20 61 6e 64 20  " variable, and 
8ac0: 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 62 79  the number of by
8ad0: 74 65 73 20 6f 66 0a 20 2a 20 62 75 66 66 65 72  tes of. * buffer
8ae0: 20 73 70 61 63 65 20 72 65 71 75 69 72 65 64 20   space required 
8af0: 62 79 20 54 63 6c 5f 50 72 69 6e 74 44 6f 75 62  by Tcl_PrintDoub
8b00: 6c 65 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65  le.. */..#define
8b10: 20 54 43 4c 5f 4d 41 58 5f 50 52 45 43 09 09 31   TCL_MAX_PREC..1
8b20: 37 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 44 4f  7.#define TCL_DO
8b30: 55 42 4c 45 5f 53 50 41 43 45 09 28 54 43 4c 5f  UBLE_SPACE.(TCL_
8b40: 4d 41 58 5f 50 52 45 43 2b 31 30 29 0a 0a 2f 2a  MAX_PREC+10)../*
8b50: 0a 20 2a 20 44 65 66 69 6e 69 74 69 6f 6e 20 66  . * Definition f
8b60: 6f 72 20 61 20 6e 75 6d 62 65 72 20 6f 66 20 62  or a number of b
8b70: 79 74 65 73 20 6f 66 20 62 75 66 66 65 72 20 73  ytes of buffer s
8b80: 70 61 63 65 20 73 75 66 66 69 63 69 65 6e 74 20  pace sufficient 
8b90: 74 6f 20 68 6f 6c 64 20 74 68 65 0a 20 2a 20 73  to hold the. * s
8ba0: 74 72 69 6e 67 20 72 65 70 72 65 73 65 6e 74 61  tring representa
8bb0: 74 69 6f 6e 20 6f 66 20 61 6e 20 69 6e 74 65 67  tion of an integ
8bc0: 65 72 20 69 6e 20 62 61 73 65 20 31 30 20 28 61  er in base 10 (a
8bd0: 73 73 75 6d 69 6e 67 20 74 68 65 20 65 78 69 73  ssuming the exis
8be0: 74 65 6e 63 65 20 6f 66 0a 20 2a 20 36 34 2d 62  tence of. * 64-b
8bf0: 69 74 20 69 6e 74 65 67 65 72 73 29 2e 0a 20 2a  it integers).. *
8c00: 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 49  /..#define TCL_I
8c10: 4e 54 45 47 45 52 5f 53 50 41 43 45 09 32 34 0a  NTEGER_SPACE.24.
8c20: 0a 2f 2a 0a 20 2a 20 46 6c 61 67 20 76 61 6c 75  ./*. * Flag valu
8c30: 65 73 20 70 61 73 73 65 64 20 74 6f 20 54 63 6c  es passed to Tcl
8c40: 5f 43 6f 6e 76 65 72 74 45 6c 65 6d 65 6e 74 2e  _ConvertElement.
8c50: 0a 20 2a 20 54 43 4c 5f 44 4f 4e 54 5f 55 53 45  . * TCL_DONT_USE
8c60: 5f 42 52 41 43 45 53 20 66 6f 72 63 65 73 20 69  _BRACES forces i
8c70: 74 20 6e 6f 74 20 74 6f 20 65 6e 63 6c 6f 73 65  t not to enclose
8c80: 20 74 68 65 20 65 6c 65 6d 65 6e 74 20 69 6e 20   the element in 
8c90: 62 72 61 63 65 73 2c 20 62 75 74 20 74 6f 0a 20  braces, but to. 
8ca0: 2a 09 75 73 65 20 62 61 63 6b 73 6c 61 73 68 20  *.use backslash 
8cb0: 71 75 6f 74 69 6e 67 20 69 6e 73 74 65 61 64 2e  quoting instead.
8cc0: 0a 20 2a 20 54 43 4c 5f 44 4f 4e 54 5f 51 55 4f  . * TCL_DONT_QUO
8cd0: 54 45 5f 48 41 53 48 20 64 69 73 61 62 6c 65 73  TE_HASH disables
8ce0: 20 74 68 65 20 64 65 66 61 75 6c 74 20 71 75 6f   the default quo
8cf0: 74 69 6e 67 20 6f 66 20 74 68 65 20 27 23 27 20  ting of the '#' 
8d00: 63 68 61 72 61 63 74 65 72 2e 20 49 74 0a 20 2a  character. It. *
8d10: 09 69 73 20 73 61 66 65 20 74 6f 20 6c 65 61 76  .is safe to leav
8d20: 65 20 74 68 65 20 68 61 73 68 20 75 6e 71 75 6f  e the hash unquo
8d30: 74 65 64 20 77 68 65 6e 20 74 68 65 20 65 6c 65  ted when the ele
8d40: 6d 65 6e 74 20 69 73 20 6e 6f 74 20 74 68 65 20  ment is not the 
8d50: 66 69 72 73 74 0a 20 2a 09 65 6c 65 6d 65 6e 74  first. *.element
8d60: 20 6f 66 20 61 20 6c 69 73 74 2c 20 61 6e 64 20   of a list, and 
8d70: 74 68 69 73 20 66 6c 61 67 20 63 61 6e 20 62 65  this flag can be
8d80: 20 75 73 65 64 20 62 79 20 74 68 65 20 63 61 6c   used by the cal
8d90: 6c 65 72 20 74 6f 20 69 6e 64 69 63 61 74 65 0a  ler to indicate.
8da0: 20 2a 09 74 68 61 74 20 63 6f 6e 64 69 74 69 6f   *.that conditio
8db0: 6e 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20  n.. */..#define 
8dc0: 54 43 4c 5f 44 4f 4e 54 5f 55 53 45 5f 42 52 41  TCL_DONT_USE_BRA
8dd0: 43 45 53 09 31 0a 23 64 65 66 69 6e 65 20 54 43  CES.1.#define TC
8de0: 4c 5f 44 4f 4e 54 5f 51 55 4f 54 45 5f 48 41 53  L_DONT_QUOTE_HAS
8df0: 48 09 38 0a 0a 2f 2a 0a 20 2a 20 46 6c 61 67 20  H.8../*. * Flag 
8e00: 74 68 61 74 20 6d 61 79 20 62 65 20 70 61 73 73  that may be pass
8e10: 65 64 20 74 6f 20 54 63 6c 5f 47 65 74 49 6e 64  ed to Tcl_GetInd
8e20: 65 78 46 72 6f 6d 4f 62 6a 20 74 6f 20 66 6f 72  exFromObj to for
8e30: 63 65 20 69 74 20 74 6f 20 64 69 73 61 6c 6c 6f  ce it to disallo
8e40: 77 0a 20 2a 20 61 62 62 72 65 76 69 61 74 65 64  w. * abbreviated
8e50: 20 73 74 72 69 6e 67 73 2e 0a 20 2a 2f 0a 0a 23   strings.. */..#
8e60: 64 65 66 69 6e 65 20 54 43 4c 5f 45 58 41 43 54  define TCL_EXACT
8e70: 09 31 0a 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d  .1../*. *-------
8e80: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
8e90: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
8ea0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
8eb0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
8ec0: 2d 2d 2d 2d 2d 0a 20 2a 20 46 6c 61 67 20 76 61  -----. * Flag va
8ed0: 6c 75 65 73 20 70 61 73 73 65 64 20 74 6f 20 54  lues passed to T
8ee0: 63 6c 5f 52 65 63 6f 72 64 41 6e 64 45 76 61 6c  cl_RecordAndEval
8ef0: 2c 20 54 63 6c 5f 45 76 61 6c 4f 62 6a 2c 20 54  , Tcl_EvalObj, T
8f00: 63 6c 5f 45 76 61 6c 4f 62 6a 76 2e 0a 20 2a 20  cl_EvalObjv.. * 
8f10: 57 41 52 4e 49 4e 47 3a 20 74 68 65 73 65 20 62  WARNING: these b
8f20: 69 74 20 63 68 6f 69 63 65 73 20 6d 75 73 74 20  it choices must 
8f30: 6e 6f 74 20 63 6f 6e 66 6c 69 63 74 20 77 69 74  not conflict wit
8f40: 68 20 74 68 65 20 62 69 74 20 63 68 6f 69 63 65  h the bit choice
8f50: 73 20 66 6f 72 0a 20 2a 20 65 76 61 6c 46 6c 61  s for. * evalFla
8f60: 67 20 62 69 74 73 20 69 6e 20 74 63 6c 49 6e 74  g bits in tclInt
8f70: 2e 68 21 0a 20 2a 0a 20 2a 20 4d 65 61 6e 69 6e  .h!. *. * Meanin
8f80: 67 73 3a 0a 20 2a 09 54 43 4c 5f 4e 4f 5f 45 56  gs:. *.TCL_NO_EV
8f90: 41 4c 3a 09 09 4a 75 73 74 20 72 65 63 6f 72 64  AL:..Just record
8fa0: 20 74 68 69 73 20 63 6f 6d 6d 61 6e 64 0a 20 2a   this command. *
8fb0: 09 54 43 4c 5f 45 56 41 4c 5f 47 4c 4f 42 41 4c  .TCL_EVAL_GLOBAL
8fc0: 3a 09 45 78 65 63 75 74 65 20 73 63 72 69 70 74  :.Execute script
8fd0: 20 69 6e 20 67 6c 6f 62 61 6c 20 6e 61 6d 65 73   in global names
8fe0: 70 61 63 65 0a 20 2a 09 54 43 4c 5f 45 56 41 4c  pace. *.TCL_EVAL
8ff0: 5f 44 49 52 45 43 54 3a 09 44 6f 20 6e 6f 74 20  _DIRECT:.Do not 
9000: 63 6f 6d 70 69 6c 65 20 74 68 69 73 20 73 63 72  compile this scr
9010: 69 70 74 0a 20 2a 09 54 43 4c 5f 45 56 41 4c 5f  ipt. *.TCL_EVAL_
9020: 49 4e 56 4f 4b 45 3a 09 4d 61 67 69 63 61 6c 20  INVOKE:.Magical 
9030: 54 63 6c 5f 45 76 61 6c 4f 62 6a 76 20 6d 6f 64  Tcl_EvalObjv mod
9040: 65 20 66 6f 72 20 61 6c 69 61 73 65 73 2f 65 6e  e for aliases/en
9050: 73 65 6d 62 6c 65 73 0a 20 2a 09 09 09 09 6f 20  sembles. *....o 
9060: 52 75 6e 20 69 6e 20 69 50 74 72 2d 3e 6c 6f 6f  Run in iPtr->loo
9070: 6b 75 70 4e 73 50 74 72 20 6f 72 20 67 6c 6f 62  kupNsPtr or glob
9080: 61 6c 20 6e 61 6d 65 73 70 61 63 65 0a 20 2a 09  al namespace. *.
9090: 09 09 09 6f 20 43 75 74 20 6f 75 74 20 6f 66 20  ...o Cut out of 
90a0: 65 72 72 6f 72 20 74 72 61 63 65 73 0a 20 2a 09  error traces. *.
90b0: 09 09 09 6f 20 44 6f 6e 27 74 20 72 65 73 65 74  ...o Don't reset
90c0: 20 74 68 65 20 66 6c 61 67 73 20 63 6f 6e 74 72   the flags contr
90d0: 6f 6c 6c 69 6e 67 20 65 6e 73 65 6d 62 6c 65 0a  olling ensemble.
90e0: 20 2a 09 09 09 09 20 20 65 72 72 6f 72 20 6d 65   *....  error me
90f0: 73 73 61 67 65 20 72 65 77 72 69 74 69 6e 67 2e  ssage rewriting.
9100: 0a 20 2a 09 54 43 4c 5f 43 41 4e 43 45 4c 5f 55  . *.TCL_CANCEL_U
9110: 4e 57 49 4e 44 3a 09 4d 61 67 69 63 61 6c 20 54  NWIND:.Magical T
9120: 63 6c 5f 43 61 6e 63 65 6c 45 76 61 6c 20 6d 6f  cl_CancelEval mo
9130: 64 65 20 74 68 61 74 20 63 61 75 73 65 73 20 74  de that causes t
9140: 68 65 0a 20 2a 09 09 09 09 73 74 61 63 6b 20 66  he. *....stack f
9150: 6f 72 20 74 68 65 20 73 63 72 69 70 74 20 69 6e  or the script in
9160: 20 70 72 6f 67 72 65 73 73 20 74 6f 20 62 65 0a   progress to be.
9170: 20 2a 09 09 09 09 63 6f 6d 70 6c 65 74 65 6c 79   *....completely
9180: 20 75 6e 77 6f 75 6e 64 2e 0a 20 2a 09 54 43 4c   unwound.. *.TCL
9190: 5f 45 56 41 4c 5f 4e 4f 45 52 52 3a 09 44 6f 20  _EVAL_NOERR:.Do 
91a0: 6e 6f 20 65 78 63 65 70 74 69 6f 6e 20 72 65 70  no exception rep
91b0: 6f 72 74 69 6e 67 20 61 74 20 61 6c 6c 2c 20 6a  orting at all, j
91c0: 75 73 74 20 72 65 74 75 72 6e 0a 20 2a 09 09 09  ust return. *...
91d0: 09 61 73 20 74 68 65 20 63 61 6c 6c 65 72 20 77  .as the caller w
91e0: 69 6c 6c 20 72 65 70 6f 72 74 2e 0a 20 2a 2f 0a  ill report.. */.
91f0: 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4e 4f 5f  .#define TCL_NO_
9200: 45 56 41 4c 09 09 30 78 30 31 30 30 30 30 0a 23  EVAL..0x010000.#
9210: 64 65 66 69 6e 65 20 54 43 4c 5f 45 56 41 4c 5f  define TCL_EVAL_
9220: 47 4c 4f 42 41 4c 09 09 30 78 30 32 30 30 30 30  GLOBAL..0x020000
9230: 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 45 56 41  .#define TCL_EVA
9240: 4c 5f 44 49 52 45 43 54 09 09 30 78 30 34 30 30  L_DIRECT..0x0400
9250: 30 30 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 45  00.#define TCL_E
9260: 56 41 4c 5f 49 4e 56 4f 4b 45 09 09 30 78 30 38  VAL_INVOKE..0x08
9270: 30 30 30 30 0a 23 64 65 66 69 6e 65 20 54 43 4c  0000.#define TCL
9280: 5f 43 41 4e 43 45 4c 5f 55 4e 57 49 4e 44 09 30  _CANCEL_UNWIND.0
9290: 78 31 30 30 30 30 30 0a 23 64 65 66 69 6e 65 20  x100000.#define 
92a0: 54 43 4c 5f 45 56 41 4c 5f 4e 4f 45 52 52 20 20  TCL_EVAL_NOERR  
92b0: 20 20 20 20 20 20 20 20 30 78 32 30 30 30 30 30          0x200000
92c0: 0a 0a 2f 2a 0a 20 2a 20 53 70 65 63 69 61 6c 20  ../*. * Special 
92d0: 66 72 65 65 50 72 6f 63 20 76 61 6c 75 65 73 20  freeProc values 
92e0: 74 68 61 74 20 6d 61 79 20 62 65 20 70 61 73 73  that may be pass
92f0: 65 64 20 74 6f 20 54 63 6c 5f 53 65 74 52 65 73  ed to Tcl_SetRes
9300: 75 6c 74 20 28 73 65 65 20 74 68 65 20 6d 61 6e  ult (see the man
9310: 0a 20 2a 20 70 61 67 65 20 66 6f 72 20 64 65 74  . * page for det
9320: 61 69 6c 73 29 3a 0a 20 2a 2f 0a 0a 23 64 65 66  ails):. */..#def
9330: 69 6e 65 20 54 43 4c 5f 56 4f 4c 41 54 49 4c 45  ine TCL_VOLATILE
9340: 09 09 28 28 54 63 6c 5f 46 72 65 65 50 72 6f 63  ..((Tcl_FreeProc
9350: 20 2a 29 20 31 29 0a 23 64 65 66 69 6e 65 20 54   *) 1).#define T
9360: 43 4c 5f 53 54 41 54 49 43 09 09 28 28 54 63 6c  CL_STATIC..((Tcl
9370: 5f 46 72 65 65 50 72 6f 63 20 2a 29 20 30 29 0a  _FreeProc *) 0).
9380: 23 64 65 66 69 6e 65 20 54 43 4c 5f 44 59 4e 41  #define TCL_DYNA
9390: 4d 49 43 09 09 28 28 54 63 6c 5f 46 72 65 65 50  MIC..((Tcl_FreeP
93a0: 72 6f 63 20 2a 29 20 33 29 0a 0a 2f 2a 0a 20 2a  roc *) 3)../*. *
93b0: 20 46 6c 61 67 20 76 61 6c 75 65 73 20 70 61 73   Flag values pas
93c0: 73 65 64 20 74 6f 20 76 61 72 69 61 62 6c 65 2d  sed to variable-
93d0: 72 65 6c 61 74 65 64 20 66 75 6e 63 74 69 6f 6e  related function
93e0: 73 2e 0a 20 2a 20 57 41 52 4e 49 4e 47 3a 20 74  s.. * WARNING: t
93f0: 68 65 73 65 20 62 69 74 20 63 68 6f 69 63 65 73  hese bit choices
9400: 20 6d 75 73 74 20 6e 6f 74 20 63 6f 6e 66 6c 69   must not confli
9410: 63 74 20 77 69 74 68 20 74 68 65 20 62 69 74 20  ct with the bit 
9420: 63 68 6f 69 63 65 20 66 6f 72 0a 20 2a 20 54 43  choice for. * TC
9430: 4c 5f 43 41 4e 43 45 4c 5f 55 4e 57 49 4e 44 2c  L_CANCEL_UNWIND,
9440: 20 61 62 6f 76 65 2e 0a 20 2a 2f 0a 0a 23 64 65   above.. */..#de
9450: 66 69 6e 65 20 54 43 4c 5f 47 4c 4f 42 41 4c 5f  fine TCL_GLOBAL_
9460: 4f 4e 4c 59 09 09 20 31 0a 23 64 65 66 69 6e 65  ONLY.. 1.#define
9470: 20 54 43 4c 5f 4e 41 4d 45 53 50 41 43 45 5f 4f   TCL_NAMESPACE_O
9480: 4e 4c 59 09 20 32 0a 23 64 65 66 69 6e 65 20 54  NLY. 2.#define T
9490: 43 4c 5f 41 50 50 45 4e 44 5f 56 41 4c 55 45 09  CL_APPEND_VALUE.
94a0: 20 34 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4c   4.#define TCL_L
94b0: 49 53 54 5f 45 4c 45 4d 45 4e 54 09 20 38 0a 23  IST_ELEMENT. 8.#
94c0: 64 65 66 69 6e 65 20 54 43 4c 5f 54 52 41 43 45  define TCL_TRACE
94d0: 5f 52 45 41 44 53 09 09 20 30 78 31 30 0a 23 64  _READS.. 0x10.#d
94e0: 65 66 69 6e 65 20 54 43 4c 5f 54 52 41 43 45 5f  efine TCL_TRACE_
94f0: 57 52 49 54 45 53 09 20 30 78 32 30 0a 23 64 65  WRITES. 0x20.#de
9500: 66 69 6e 65 20 54 43 4c 5f 54 52 41 43 45 5f 55  fine TCL_TRACE_U
9510: 4e 53 45 54 53 09 20 30 78 34 30 0a 23 64 65 66  NSETS. 0x40.#def
9520: 69 6e 65 20 54 43 4c 5f 54 52 41 43 45 5f 44 45  ine TCL_TRACE_DE
9530: 53 54 52 4f 59 45 44 09 20 30 78 38 30 0a 23 64  STROYED. 0x80.#d
9540: 65 66 69 6e 65 20 54 43 4c 5f 49 4e 54 45 52 50  efine TCL_INTERP
9550: 5f 44 45 53 54 52 4f 59 45 44 09 20 30 78 31 30  _DESTROYED. 0x10
9560: 30 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4c 45  0.#define TCL_LE
9570: 41 56 45 5f 45 52 52 5f 4d 53 47 09 20 30 78 32  AVE_ERR_MSG. 0x2
9580: 30 30 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 54  00.#define TCL_T
9590: 52 41 43 45 5f 41 52 52 41 59 09 09 20 30 78 38  RACE_ARRAY.. 0x8
95a0: 30 30 0a 23 69 66 6e 64 65 66 20 54 43 4c 5f 52  00.#ifndef TCL_R
95b0: 45 4d 4f 56 45 5f 4f 42 53 4f 4c 45 54 45 5f 54  EMOVE_OBSOLETE_T
95c0: 52 41 43 45 53 0a 2f 2a 20 52 65 71 75 69 72 65  RACES./* Require
95d0: 64 20 74 6f 20 73 75 70 70 6f 72 74 20 6f 6c 64  d to support old
95e0: 20 76 61 72 69 61 62 6c 65 2f 76 64 65 6c 65 74   variable/vdelet
95f0: 65 2f 76 69 6e 66 6f 20 74 72 61 63 65 73 2e 20  e/vinfo traces. 
9600: 2a 2f 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 54  */.#define TCL_T
9610: 52 41 43 45 5f 4f 4c 44 5f 53 54 59 4c 45 09 20  RACE_OLD_STYLE. 
9620: 30 78 31 30 30 30 0a 23 65 6e 64 69 66 0a 2f 2a  0x1000.#endif./*
9630: 20 49 6e 64 69 63 61 74 65 20 74 68 65 20 73 65   Indicate the se
9640: 6d 61 6e 74 69 63 73 20 6f 66 20 74 68 65 20 72  mantics of the r
9650: 65 73 75 6c 74 20 6f 66 20 61 20 74 72 61 63 65  esult of a trace
9660: 2e 20 2a 2f 0a 23 64 65 66 69 6e 65 20 54 43 4c  . */.#define TCL
9670: 5f 54 52 41 43 45 5f 52 45 53 55 4c 54 5f 44 59  _TRACE_RESULT_DY
9680: 4e 41 4d 49 43 20 30 78 38 30 30 30 0a 23 64 65  NAMIC 0x8000.#de
9690: 66 69 6e 65 20 54 43 4c 5f 54 52 41 43 45 5f 52  fine TCL_TRACE_R
96a0: 45 53 55 4c 54 5f 4f 42 4a 45 43 54 20 20 30 78  ESULT_OBJECT  0x
96b0: 31 30 30 30 30 0a 0a 2f 2a 0a 20 2a 20 46 6c 61  10000../*. * Fla
96c0: 67 20 76 61 6c 75 65 73 20 66 6f 72 20 65 6e 73  g values for ens
96d0: 65 6d 62 6c 65 20 63 6f 6d 6d 61 6e 64 73 2e 0a  emble commands..
96e0: 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c   */..#define TCL
96f0: 5f 45 4e 53 45 4d 42 4c 45 5f 50 52 45 46 49 58  _ENSEMBLE_PREFIX
9700: 20 30 78 30 32 2f 2a 20 46 6c 61 67 20 76 61 6c   0x02/* Flag val
9710: 75 65 20 74 6f 20 73 61 79 20 77 68 65 74 68 65  ue to say whethe
9720: 72 20 74 6f 20 61 6c 6c 6f 77 0a 09 09 09 09 20  r to allow..... 
9730: 2a 20 75 6e 61 6d 62 69 67 75 6f 75 73 20 70 72  * unambiguous pr
9740: 65 66 69 78 65 73 20 6f 66 20 63 6f 6d 6d 61 6e  efixes of comman
9750: 64 73 20 6f 72 20 74 6f 0a 09 09 09 09 20 2a 20  ds or to..... * 
9760: 72 65 71 75 69 72 65 20 65 78 61 63 74 20 6d 61  require exact ma
9770: 74 63 68 65 73 20 66 6f 72 20 63 6f 6d 6d 61 6e  tches for comman
9780: 64 20 6e 61 6d 65 73 2e 20 2a 2f 0a 0a 2f 2a 0a  d names. */../*.
9790: 20 2a 20 46 6c 61 67 20 76 61 6c 75 65 73 20 70   * Flag values p
97a0: 61 73 73 65 64 20 74 6f 20 63 6f 6d 6d 61 6e 64  assed to command
97b0: 2d 72 65 6c 61 74 65 64 20 66 75 6e 63 74 69 6f  -related functio
97c0: 6e 73 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65  ns.. */..#define
97d0: 20 54 43 4c 5f 54 52 41 43 45 5f 52 45 4e 41 4d   TCL_TRACE_RENAM
97e0: 45 09 30 78 32 30 30 30 0a 23 64 65 66 69 6e 65  E.0x2000.#define
97f0: 20 54 43 4c 5f 54 52 41 43 45 5f 44 45 4c 45 54   TCL_TRACE_DELET
9800: 45 09 30 78 34 30 30 30 0a 0a 23 64 65 66 69 6e  E.0x4000..#defin
9810: 65 20 54 43 4c 5f 41 4c 4c 4f 57 5f 49 4e 4c 49  e TCL_ALLOW_INLI
9820: 4e 45 5f 43 4f 4d 50 49 4c 41 54 49 4f 4e 20 30  NE_COMPILATION 0
9830: 78 32 30 30 30 30 0a 0a 2f 2a 0a 20 2a 20 54 68  x20000../*. * Th
9840: 65 20 54 43 4c 5f 50 41 52 53 45 5f 50 41 52 54  e TCL_PARSE_PART
9850: 31 20 66 6c 61 67 20 69 73 20 64 65 70 72 65 63  1 flag is deprec
9860: 61 74 65 64 20 61 6e 64 20 68 61 73 20 6e 6f 20  ated and has no 
9870: 65 66 66 65 63 74 2e 20 54 68 65 20 70 61 72 74  effect. The part
9880: 31 20 69 73 20 6e 6f 77 0a 20 2a 20 61 6c 77 61  1 is now. * alwa
9890: 79 73 20 70 61 72 73 65 64 20 77 68 65 6e 65 76  ys parsed whenev
98a0: 65 72 20 74 68 65 20 70 61 72 74 32 20 69 73 20  er the part2 is 
98b0: 4e 55 4c 4c 2e 20 28 54 68 69 73 20 69 73 20 74  NULL. (This is t
98c0: 6f 20 61 76 6f 69 64 20 61 20 63 6f 6d 6d 6f 6e  o avoid a common
98d0: 20 65 72 72 6f 72 0a 20 2a 20 77 68 65 6e 20 63   error. * when c
98e0: 6f 6e 76 65 72 74 69 6e 67 20 63 6f 64 65 20 74  onverting code t
98f0: 6f 20 75 73 65 20 74 68 65 20 6e 65 77 20 6f 62  o use the new ob
9900: 6a 65 63 74 20 62 61 73 65 64 20 41 50 49 73 20  ject based APIs 
9910: 61 6e 64 20 66 6f 72 67 65 74 74 69 6e 67 20 74  and forgetting t
9920: 6f 0a 20 2a 20 67 69 76 65 20 74 68 65 20 66 6c  o. * give the fl
9930: 61 67 29 0a 20 2a 2f 0a 0a 23 69 66 20 21 64 65  ag). */..#if !de
9940: 66 69 6e 65 64 28 54 43 4c 5f 4e 4f 5f 44 45 50  fined(TCL_NO_DEP
9950: 52 45 43 41 54 45 44 29 20 26 26 20 54 43 4c 5f  RECATED) && TCL_
9960: 4d 41 4a 4f 52 5f 56 45 52 53 49 4f 4e 20 3c 20  MAJOR_VERSION < 
9970: 39 0a 23 20 20 20 64 65 66 69 6e 65 20 54 43 4c  9.#   define TCL
9980: 5f 50 41 52 53 45 5f 50 41 52 54 31 09 30 78 34  _PARSE_PART1.0x4
9990: 30 30 0a 23 65 6e 64 69 66 20 2f 2a 20 21 54 43  00.#endif /* !TC
99a0: 4c 5f 4e 4f 5f 44 45 50 52 45 43 41 54 45 44 20  L_NO_DEPRECATED 
99b0: 2a 2f 0a 0a 2f 2a 0a 20 2a 20 54 79 70 65 73 20  */../*. * Types 
99c0: 66 6f 72 20 6c 69 6e 6b 65 64 20 76 61 72 69 61  for linked varia
99d0: 62 6c 65 73 3a 0a 20 2a 2f 0a 0a 23 64 65 66 69  bles:. */..#defi
99e0: 6e 65 20 54 43 4c 5f 4c 49 4e 4b 5f 49 4e 54 09  ne TCL_LINK_INT.
99f0: 09 31 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4c  .1.#define TCL_L
9a00: 49 4e 4b 5f 44 4f 55 42 4c 45 09 09 32 0a 23 64  INK_DOUBLE..2.#d
9a10: 65 66 69 6e 65 20 54 43 4c 5f 4c 49 4e 4b 5f 42  efine TCL_LINK_B
9a20: 4f 4f 4c 45 41 4e 09 33 0a 23 64 65 66 69 6e 65  OOLEAN.3.#define
9a30: 20 54 43 4c 5f 4c 49 4e 4b 5f 53 54 52 49 4e 47   TCL_LINK_STRING
9a40: 09 09 34 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f  ..4.#define TCL_
9a50: 4c 49 4e 4b 5f 57 49 44 45 5f 49 4e 54 09 35 0a  LINK_WIDE_INT.5.
9a60: 23 64 65 66 69 6e 65 20 54 43 4c 5f 4c 49 4e 4b  #define TCL_LINK
9a70: 5f 43 48 41 52 09 09 36 0a 23 64 65 66 69 6e 65  _CHAR..6.#define
9a80: 20 54 43 4c 5f 4c 49 4e 4b 5f 55 43 48 41 52 09   TCL_LINK_UCHAR.
9a90: 09 37 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4c  .7.#define TCL_L
9aa0: 49 4e 4b 5f 53 48 4f 52 54 09 09 38 0a 23 64 65  INK_SHORT..8.#de
9ab0: 66 69 6e 65 20 54 43 4c 5f 4c 49 4e 4b 5f 55 53  fine TCL_LINK_US
9ac0: 48 4f 52 54 09 09 39 0a 23 64 65 66 69 6e 65 20  HORT..9.#define 
9ad0: 54 43 4c 5f 4c 49 4e 4b 5f 55 49 4e 54 09 09 31  TCL_LINK_UINT..1
9ae0: 30 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4c 49  0.#define TCL_LI
9af0: 4e 4b 5f 4c 4f 4e 47 09 09 31 31 0a 23 64 65 66  NK_LONG..11.#def
9b00: 69 6e 65 20 54 43 4c 5f 4c 49 4e 4b 5f 55 4c 4f  ine TCL_LINK_ULO
9b10: 4e 47 09 09 31 32 0a 23 64 65 66 69 6e 65 20 54  NG..12.#define T
9b20: 43 4c 5f 4c 49 4e 4b 5f 46 4c 4f 41 54 09 09 31  CL_LINK_FLOAT..1
9b30: 33 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4c 49  3.#define TCL_LI
9b40: 4e 4b 5f 57 49 44 45 5f 55 49 4e 54 09 31 34 0a  NK_WIDE_UINT.14.
9b50: 23 64 65 66 69 6e 65 20 54 43 4c 5f 4c 49 4e 4b  #define TCL_LINK
9b60: 5f 52 45 41 44 5f 4f 4e 4c 59 09 30 78 38 30 0a  _READ_ONLY.0x80.
9b70: 0c 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d  ../*. *---------
9b80: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
9b90: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
9ba0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
9bb0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
9bc0: 2d 2d 2d 0a 20 2a 20 46 6f 72 77 61 72 64 20 64  ---. * Forward d
9bd0: 65 63 6c 61 72 61 74 69 6f 6e 73 20 6f 66 20 54  eclarations of T
9be0: 63 6c 5f 48 61 73 68 54 61 62 6c 65 20 61 6e 64  cl_HashTable and
9bf0: 20 72 65 6c 61 74 65 64 20 74 79 70 65 73 2e 0a   related types..
9c00: 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 73 74 72   */..typedef str
9c10: 75 63 74 20 54 63 6c 5f 48 61 73 68 4b 65 79 54  uct Tcl_HashKeyT
9c20: 79 70 65 20 54 63 6c 5f 48 61 73 68 4b 65 79 54  ype Tcl_HashKeyT
9c30: 79 70 65 3b 0a 74 79 70 65 64 65 66 20 73 74 72  ype;.typedef str
9c40: 75 63 74 20 54 63 6c 5f 48 61 73 68 54 61 62 6c  uct Tcl_HashTabl
9c50: 65 20 54 63 6c 5f 48 61 73 68 54 61 62 6c 65 3b  e Tcl_HashTable;
9c60: 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20  .typedef struct 
9c70: 54 63 6c 5f 48 61 73 68 45 6e 74 72 79 20 54 63  Tcl_HashEntry Tc
9c80: 6c 5f 48 61 73 68 45 6e 74 72 79 3b 0a 0a 74 79  l_HashEntry;..ty
9c90: 70 65 64 65 66 20 75 6e 73 69 67 6e 65 64 20 28  pedef unsigned (
9ca0: 54 63 6c 5f 48 61 73 68 4b 65 79 50 72 6f 63 29  Tcl_HashKeyProc)
9cb0: 20 28 54 63 6c 5f 48 61 73 68 54 61 62 6c 65 20   (Tcl_HashTable 
9cc0: 2a 74 61 62 6c 65 50 74 72 2c 20 76 6f 69 64 20  *tablePtr, void 
9cd0: 2a 6b 65 79 50 74 72 29 3b 0a 74 79 70 65 64 65  *keyPtr);.typede
9ce0: 66 20 69 6e 74 20 28 54 63 6c 5f 43 6f 6d 70 61  f int (Tcl_Compa
9cf0: 72 65 48 61 73 68 4b 65 79 73 50 72 6f 63 29 20  reHashKeysProc) 
9d00: 28 76 6f 69 64 20 2a 6b 65 79 50 74 72 2c 20 54  (void *keyPtr, T
9d10: 63 6c 5f 48 61 73 68 45 6e 74 72 79 20 2a 68 50  cl_HashEntry *hP
9d20: 74 72 29 3b 0a 74 79 70 65 64 65 66 20 54 63 6c  tr);.typedef Tcl
9d30: 5f 48 61 73 68 45 6e 74 72 79 20 2a 20 28 54 63  _HashEntry * (Tc
9d40: 6c 5f 41 6c 6c 6f 63 48 61 73 68 45 6e 74 72 79  l_AllocHashEntry
9d50: 50 72 6f 63 29 20 28 54 63 6c 5f 48 61 73 68 54  Proc) (Tcl_HashT
9d60: 61 62 6c 65 20 2a 74 61 62 6c 65 50 74 72 2c 0a  able *tablePtr,.
9d70: 09 76 6f 69 64 20 2a 6b 65 79 50 74 72 29 3b 0a  .void *keyPtr);.
9d80: 74 79 70 65 64 65 66 20 76 6f 69 64 20 28 54 63  typedef void (Tc
9d90: 6c 5f 46 72 65 65 48 61 73 68 45 6e 74 72 79 50  l_FreeHashEntryP
9da0: 72 6f 63 29 20 28 54 63 6c 5f 48 61 73 68 45 6e  roc) (Tcl_HashEn
9db0: 74 72 79 20 2a 68 50 74 72 29 3b 0a 0a 2f 2a 0a  try *hPtr);../*.
9dc0: 20 2a 20 54 68 69 73 20 66 6c 61 67 20 63 6f 6e   * This flag con
9dd0: 74 72 6f 6c 73 20 77 68 65 74 68 65 72 20 74 68  trols whether th
9de0: 65 20 68 61 73 68 20 74 61 62 6c 65 20 73 74 6f  e hash table sto
9df0: 72 65 73 20 74 68 65 20 68 61 73 68 20 6f 66 20  res the hash of 
9e00: 61 20 6b 65 79 2c 20 6f 72 0a 20 2a 20 72 65 63  a key, or. * rec
9e10: 61 6c 63 75 6c 61 74 65 73 20 69 74 2e 20 54 68  alculates it. Th
9e20: 65 72 65 20 73 68 6f 75 6c 64 20 62 65 20 6e 6f  ere should be no
9e30: 20 72 65 61 73 6f 6e 20 66 6f 72 20 74 75 72 6e   reason for turn
9e40: 69 6e 67 20 74 68 69 73 20 66 6c 61 67 20 6f 66  ing this flag of
9e50: 66 20 61 73 20 69 74 0a 20 2a 20 69 73 20 63 6f  f as it. * is co
9e60: 6d 70 6c 65 74 65 6c 79 20 62 69 6e 61 72 79 20  mpletely binary 
9e70: 61 6e 64 20 73 6f 75 72 63 65 20 63 6f 6d 70 61  and source compa
9e80: 74 69 62 6c 65 20 75 6e 6c 65 73 73 20 79 6f 75  tible unless you
9e90: 20 64 69 72 65 63 74 6c 79 20 61 63 63 65 73 73   directly access
9ea0: 20 74 68 65 0a 20 2a 20 62 75 63 6b 65 74 50 74   the. * bucketPt
9eb0: 72 20 6d 65 6d 62 65 72 20 6f 66 20 74 68 65 20  r member of the 
9ec0: 54 63 6c 5f 48 61 73 68 54 61 62 6c 65 45 6e 74  Tcl_HashTableEnt
9ed0: 72 79 20 73 74 72 75 63 74 75 72 65 2e 20 54 68  ry structure. Th
9ee0: 69 73 20 6d 65 6d 62 65 72 20 68 61 73 20 62 65  is member has be
9ef0: 65 6e 0a 20 2a 20 72 65 6d 6f 76 65 64 20 61 6e  en. * removed an
9f00: 64 20 74 68 65 20 73 70 61 63 65 20 75 73 65 64  d the space used
9f10: 20 74 6f 20 73 74 6f 72 65 20 74 68 65 20 68 61   to store the ha
9f20: 73 68 20 76 61 6c 75 65 2e 0a 20 2a 2f 0a 0a 23  sh value.. */..#
9f30: 69 66 6e 64 65 66 20 54 43 4c 5f 48 41 53 48 5f  ifndef TCL_HASH_
9f40: 4b 45 59 5f 53 54 4f 52 45 5f 48 41 53 48 0a 23  KEY_STORE_HASH.#
9f50: 20 20 20 64 65 66 69 6e 65 20 54 43 4c 5f 48 41     define TCL_HA
9f60: 53 48 5f 4b 45 59 5f 53 54 4f 52 45 5f 48 41 53  SH_KEY_STORE_HAS
9f70: 48 20 31 0a 23 65 6e 64 69 66 0a 0a 2f 2a 0a 20  H 1.#endif../*. 
9f80: 2a 20 53 74 72 75 63 74 75 72 65 20 64 65 66 69  * Structure defi
9f90: 6e 69 74 69 6f 6e 20 66 6f 72 20 61 6e 20 65 6e  nition for an en
9fa0: 74 72 79 20 69 6e 20 61 20 68 61 73 68 20 74 61  try in a hash ta
9fb0: 62 6c 65 2e 20 4e 6f 2d 6f 6e 65 20 6f 75 74 73  ble. No-one outs
9fc0: 69 64 65 20 54 63 6c 0a 20 2a 20 73 68 6f 75 6c  ide Tcl. * shoul
9fd0: 64 20 61 63 63 65 73 73 20 61 6e 79 20 6f 66 20  d access any of 
9fe0: 74 68 65 73 65 20 66 69 65 6c 64 73 20 64 69 72  these fields dir
9ff0: 65 63 74 6c 79 3b 20 75 73 65 20 74 68 65 20 6d  ectly; use the m
a000: 61 63 72 6f 73 20 64 65 66 69 6e 65 64 20 62 65  acros defined be
a010: 6c 6f 77 2e 0a 20 2a 2f 0a 0a 73 74 72 75 63 74  low.. */..struct
a020: 20 54 63 6c 5f 48 61 73 68 45 6e 74 72 79 20 7b   Tcl_HashEntry {
a030: 0a 20 20 20 20 54 63 6c 5f 48 61 73 68 45 6e 74  .    Tcl_HashEnt
a040: 72 79 20 2a 6e 65 78 74 50 74 72 3b 09 2f 2a 20  ry *nextPtr;./* 
a050: 50 6f 69 6e 74 65 72 20 74 6f 20 6e 65 78 74 20  Pointer to next 
a060: 65 6e 74 72 79 20 69 6e 20 74 68 69 73 20 68 61  entry in this ha
a070: 73 68 20 62 75 63 6b 65 74 2c 0a 09 09 09 09 20  sh bucket,..... 
a080: 2a 20 6f 72 20 4e 55 4c 4c 20 66 6f 72 20 65 6e  * or NULL for en
a090: 64 20 6f 66 20 63 68 61 69 6e 2e 20 2a 2f 0a 20  d of chain. */. 
a0a0: 20 20 20 54 63 6c 5f 48 61 73 68 54 61 62 6c 65     Tcl_HashTable
a0b0: 20 2a 74 61 62 6c 65 50 74 72 3b 09 2f 2a 20 50   *tablePtr;./* P
a0c0: 6f 69 6e 74 65 72 20 74 6f 20 74 61 62 6c 65 20  ointer to table 
a0d0: 63 6f 6e 74 61 69 6e 69 6e 67 20 65 6e 74 72 79  containing entry
a0e0: 2e 20 2a 2f 0a 23 69 66 20 54 43 4c 5f 48 41 53  . */.#if TCL_HAS
a0f0: 48 5f 4b 45 59 5f 53 54 4f 52 45 5f 48 41 53 48  H_KEY_STORE_HASH
a100: 0a 20 20 20 20 76 6f 69 64 20 2a 68 61 73 68 3b  .    void *hash;
a110: 09 09 09 2f 2a 20 48 61 73 68 20 76 61 6c 75 65  .../* Hash value
a120: 2c 20 73 74 6f 72 65 64 20 61 73 20 70 6f 69 6e  , stored as poin
a130: 74 65 72 20 74 6f 20 65 6e 73 75 72 65 0a 09 09  ter to ensure...
a140: 09 09 20 2a 20 74 68 61 74 20 74 68 65 20 6f 66  .. * that the of
a150: 66 73 65 74 73 20 6f 66 20 74 68 65 20 66 69 65  fsets of the fie
a160: 6c 64 73 20 69 6e 20 74 68 69 73 0a 09 09 09 09  lds in this.....
a170: 20 2a 20 73 74 72 75 63 74 75 72 65 20 61 72 65   * structure are
a180: 20 6e 6f 74 20 63 68 61 6e 67 65 64 2e 20 2a 2f   not changed. */
a190: 0a 23 65 6c 73 65 0a 20 20 20 20 54 63 6c 5f 48  .#else.    Tcl_H
a1a0: 61 73 68 45 6e 74 72 79 20 2a 2a 62 75 63 6b 65  ashEntry **bucke
a1b0: 74 50 74 72 3b 09 2f 2a 20 50 6f 69 6e 74 65 72  tPtr;./* Pointer
a1c0: 20 74 6f 20 62 75 63 6b 65 74 20 74 68 61 74 20   to bucket that 
a1d0: 70 6f 69 6e 74 73 20 74 6f 20 66 69 72 73 74 0a  points to first.
a1e0: 09 09 09 09 20 2a 20 65 6e 74 72 79 20 69 6e 20  .... * entry in 
a1f0: 74 68 69 73 20 65 6e 74 72 79 27 73 20 63 68 61  this entry's cha
a200: 69 6e 3a 20 75 73 65 64 20 66 6f 72 0a 09 09 09  in: used for....
a210: 09 20 2a 20 64 65 6c 65 74 69 6e 67 20 74 68 65  . * deleting the
a220: 20 65 6e 74 72 79 2e 20 2a 2f 0a 23 65 6e 64 69   entry. */.#endi
a230: 66 0a 20 20 20 20 43 6c 69 65 6e 74 44 61 74 61  f.    ClientData
a240: 20 63 6c 69 65 6e 74 44 61 74 61 3b 09 2f 2a 20   clientData;./* 
a250: 41 70 70 6c 69 63 61 74 69 6f 6e 20 73 74 6f 72  Application stor
a260: 65 73 20 73 6f 6d 65 74 68 69 6e 67 20 68 65 72  es something her
a270: 65 20 77 69 74 68 0a 09 09 09 09 20 2a 20 54 63  e with..... * Tc
a280: 6c 5f 53 65 74 48 61 73 68 56 61 6c 75 65 2e 20  l_SetHashValue. 
a290: 2a 2f 0a 20 20 20 20 75 6e 69 6f 6e 20 7b 09 09  */.    union {..
a2a0: 09 2f 2a 20 4b 65 79 20 68 61 73 20 6f 6e 65 20  ./* Key has one 
a2b0: 6f 66 20 74 68 65 73 65 20 66 6f 72 6d 73 3a 20  of these forms: 
a2c0: 2a 2f 0a 09 63 68 61 72 20 2a 6f 6e 65 57 6f 72  */..char *oneWor
a2d0: 64 56 61 6c 75 65 3b 09 2f 2a 20 4f 6e 65 2d 77  dValue;./* One-w
a2e0: 6f 72 64 20 76 61 6c 75 65 20 66 6f 72 20 6b 65  ord value for ke
a2f0: 79 2e 20 2a 2f 0a 09 54 63 6c 5f 4f 62 6a 20 2a  y. */..Tcl_Obj *
a300: 6f 62 6a 50 74 72 3b 09 2f 2a 20 54 63 6c 5f 4f  objPtr;./* Tcl_O
a310: 62 6a 20 2a 20 6b 65 79 20 76 61 6c 75 65 2e 20  bj * key value. 
a320: 2a 2f 0a 09 69 6e 74 20 77 6f 72 64 73 5b 31 5d  */..int words[1]
a330: 3b 09 09 2f 2a 20 4d 75 6c 74 69 70 6c 65 20 69  ;../* Multiple i
a340: 6e 74 65 67 65 72 20 77 6f 72 64 73 20 66 6f 72  nteger words for
a350: 20 6b 65 79 2e 20 54 68 65 20 61 63 74 75 61 6c   key. The actual
a360: 0a 09 09 09 09 20 2a 20 73 69 7a 65 20 77 69 6c  ..... * size wil
a370: 6c 20 62 65 20 61 73 20 6c 61 72 67 65 20 61 73  l be as large as
a380: 20 6e 65 63 65 73 73 61 72 79 20 66 6f 72 20 74   necessary for t
a390: 68 69 73 0a 09 09 09 09 20 2a 20 74 61 62 6c 65  his..... * table
a3a0: 27 73 20 6b 65 79 73 2e 20 2a 2f 0a 09 63 68 61  's keys. */..cha
a3b0: 72 20 73 74 72 69 6e 67 5b 31 5d 3b 09 09 2f 2a  r string[1];../*
a3c0: 20 53 74 72 69 6e 67 20 66 6f 72 20 6b 65 79 2e   String for key.
a3d0: 20 54 68 65 20 61 63 74 75 61 6c 20 73 69 7a 65   The actual size
a3e0: 20 77 69 6c 6c 20 62 65 20 61 73 0a 09 09 09 09   will be as.....
a3f0: 20 2a 20 6c 61 72 67 65 20 61 73 20 6e 65 65 64   * large as need
a400: 65 64 20 74 6f 20 68 6f 6c 64 20 74 68 65 20 6b  ed to hold the k
a410: 65 79 2e 20 2a 2f 0a 20 20 20 20 7d 20 6b 65 79  ey. */.    } key
a420: 3b 09 09 09 2f 2a 20 4d 55 53 54 20 42 45 20 4c  ;.../* MUST BE L
a430: 41 53 54 20 46 49 45 4c 44 20 49 4e 20 52 45 43  AST FIELD IN REC
a440: 4f 52 44 21 21 20 2a 2f 0a 7d 3b 0a 0a 2f 2a 0a  ORD!! */.};../*.
a450: 20 2a 20 46 6c 61 67 73 20 75 73 65 64 20 69 6e   * Flags used in
a460: 20 54 63 6c 5f 48 61 73 68 4b 65 79 54 79 70 65   Tcl_HashKeyType
a470: 2e 0a 20 2a 0a 20 2a 20 54 43 4c 5f 48 41 53 48  .. *. * TCL_HASH
a480: 5f 4b 45 59 5f 52 41 4e 44 4f 4d 49 5a 45 5f 48  _KEY_RANDOMIZE_H
a490: 41 53 48 20 2d 0a 20 2a 09 09 09 09 54 68 65 72  ASH -. *....Ther
a4a0: 65 20 61 72 65 20 73 6f 6d 65 20 74 68 69 6e 67  e are some thing
a4b0: 73 2c 20 70 6f 69 6e 74 65 72 73 20 66 6f 72 20  s, pointers for 
a4c0: 65 78 61 6d 70 6c 65 0a 20 2a 09 09 09 09 77 68  example. *....wh
a4d0: 69 63 68 20 64 6f 6e 27 74 20 68 61 73 68 20 77  ich don't hash w
a4e0: 65 6c 6c 20 62 65 63 61 75 73 65 20 74 68 65 79  ell because they
a4f0: 20 64 6f 20 6e 6f 74 20 75 73 65 0a 20 2a 09 09   do not use. *..
a500: 09 09 74 68 65 20 6c 6f 77 65 72 20 62 69 74 73  ..the lower bits
a510: 2e 20 49 66 20 74 68 69 73 20 66 6c 61 67 20 69  . If this flag i
a520: 73 20 73 65 74 20 74 68 65 6e 20 74 68 65 0a 20  s set then the. 
a530: 2a 09 09 09 09 68 61 73 68 20 74 61 62 6c 65 20  *....hash table 
a540: 77 69 6c 6c 20 61 74 74 65 6d 70 74 20 74 6f 20  will attempt to 
a550: 72 65 63 74 69 66 79 20 74 68 69 73 20 62 79 0a  rectify this by.
a560: 20 2a 09 09 09 09 72 61 6e 64 6f 6d 69 73 69 6e   *....randomisin
a570: 67 20 74 68 65 20 62 69 74 73 20 61 6e 64 20 74  g the bits and t
a580: 68 65 6e 20 75 73 69 6e 67 20 74 68 65 20 75 70  hen using the up
a590: 70 65 72 0a 20 2a 09 09 09 09 4e 20 62 69 74 73  per. *....N bits
a5a0: 20 61 73 20 74 68 65 20 69 6e 64 65 78 20 69 6e   as the index in
a5b0: 74 6f 20 74 68 65 20 74 61 62 6c 65 2e 0a 20 2a  to the table.. *
a5c0: 20 54 43 4c 5f 48 41 53 48 5f 4b 45 59 5f 53 59   TCL_HASH_KEY_SY
a5d0: 53 54 45 4d 5f 48 41 53 48 20 2d 09 49 66 20 74  STEM_HASH -.If t
a5e0: 68 69 73 20 66 6c 61 67 20 69 73 20 73 65 74 20  his flag is set 
a5f0: 74 68 65 6e 20 61 6c 6c 20 6d 65 6d 6f 72 79 20  then all memory 
a600: 69 6e 74 65 72 6e 61 6c 6c 79 0a 20 2a 20 20 20  internally. *   
a610: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
a620: 20 20 20 20 20 20 20 20 20 20 20 61 6c 6c 6f 63             alloc
a630: 61 74 65 64 20 66 6f 72 20 74 68 65 20 68 61 73  ated for the has
a640: 68 20 74 61 62 6c 65 20 74 68 61 74 20 69 73 20  h table that is 
a650: 6e 6f 74 20 66 6f 72 20 61 6e 0a 20 2a 20 20 20  not for an. *   
a660: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
a670: 20 20 20 20 20 20 20 20 20 20 20 65 6e 74 72 79             entry
a680: 20 77 69 6c 6c 20 75 73 65 20 74 68 65 20 73 79   will use the sy
a690: 73 74 65 6d 20 68 65 61 70 2e 0a 20 2a 2f 0a 0a  stem heap.. */..
a6a0: 23 64 65 66 69 6e 65 20 54 43 4c 5f 48 41 53 48  #define TCL_HASH
a6b0: 5f 4b 45 59 5f 52 41 4e 44 4f 4d 49 5a 45 5f 48  _KEY_RANDOMIZE_H
a6c0: 41 53 48 20 30 78 31 0a 23 64 65 66 69 6e 65 20  ASH 0x1.#define 
a6d0: 54 43 4c 5f 48 41 53 48 5f 4b 45 59 5f 53 59 53  TCL_HASH_KEY_SYS
a6e0: 54 45 4d 5f 48 41 53 48 20 20 20 20 30 78 32 0a  TEM_HASH    0x2.
a6f0: 0a 2f 2a 0a 20 2a 20 53 74 72 75 63 74 75 72 65  ./*. * Structure
a700: 20 64 65 66 69 6e 69 74 69 6f 6e 20 66 6f 72 20   definition for 
a710: 74 68 65 20 6d 65 74 68 6f 64 73 20 61 73 73 6f  the methods asso
a720: 63 69 61 74 65 64 20 77 69 74 68 20 61 20 68 61  ciated with a ha
a730: 73 68 20 74 61 62 6c 65 20 6b 65 79 20 74 79 70  sh table key typ
a740: 65 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20  e.. */..#define 
a750: 54 43 4c 5f 48 41 53 48 5f 4b 45 59 5f 54 59 50  TCL_HASH_KEY_TYP
a760: 45 5f 56 45 52 53 49 4f 4e 20 31 0a 73 74 72 75  E_VERSION 1.stru
a770: 63 74 20 54 63 6c 5f 48 61 73 68 4b 65 79 54 79  ct Tcl_HashKeyTy
a780: 70 65 20 7b 0a 20 20 20 20 69 6e 74 20 76 65 72  pe {.    int ver
a790: 73 69 6f 6e 3b 09 09 2f 2a 20 56 65 72 73 69 6f  sion;../* Versio
a7a0: 6e 20 6f 66 20 74 68 65 20 74 61 62 6c 65 2e 20  n of the table. 
a7b0: 49 66 20 74 68 69 73 20 73 74 72 75 63 74 75 72  If this structur
a7c0: 65 20 69 73 0a 09 09 09 09 20 2a 20 65 78 74 65  e is..... * exte
a7d0: 6e 64 65 64 20 69 6e 20 66 75 74 75 72 65 20 74  nded in future t
a7e0: 68 65 6e 20 74 68 65 20 76 65 72 73 69 6f 6e 20  hen the version 
a7f0: 63 61 6e 20 62 65 0a 09 09 09 09 20 2a 20 75 73  can be..... * us
a800: 65 64 20 74 6f 20 64 69 73 74 69 6e 67 75 69 73  ed to distinguis
a810: 68 20 62 65 74 77 65 65 6e 20 64 69 66 66 65 72  h between differ
a820: 65 6e 74 0a 09 09 09 09 20 2a 20 73 74 72 75 63  ent..... * struc
a830: 74 75 72 65 73 2e 20 2a 2f 0a 20 20 20 20 69 6e  tures. */.    in
a840: 74 20 66 6c 61 67 73 3b 09 09 09 2f 2a 20 46 6c  t flags;.../* Fl
a850: 61 67 73 2c 20 73 65 65 20 61 62 6f 76 65 20 66  ags, see above f
a860: 6f 72 20 64 65 74 61 69 6c 73 2e 20 2a 2f 0a 20  or details. */. 
a870: 20 20 20 54 63 6c 5f 48 61 73 68 4b 65 79 50 72     Tcl_HashKeyPr
a880: 6f 63 20 2a 68 61 73 68 4b 65 79 50 72 6f 63 3b  oc *hashKeyProc;
a890: 0a 09 09 09 09 2f 2a 20 43 61 6c 63 75 6c 61 74  ...../* Calculat
a8a0: 65 73 20 61 20 68 61 73 68 20 76 61 6c 75 65 20  es a hash value 
a8b0: 66 6f 72 20 74 68 65 20 6b 65 79 2e 20 49 66 0a  for the key. If.
a8c0: 09 09 09 09 20 2a 20 74 68 69 73 20 69 73 20 4e  .... * this is N
a8d0: 55 4c 4c 20 74 68 65 6e 20 74 68 65 20 70 6f 69  ULL then the poi
a8e0: 6e 74 65 72 20 69 74 73 65 6c 66 20 69 73 0a 09  nter itself is..
a8f0: 09 09 09 20 2a 20 75 73 65 64 20 61 73 20 61 20  ... * used as a 
a900: 68 61 73 68 20 76 61 6c 75 65 2e 20 2a 2f 0a 20  hash value. */. 
a910: 20 20 20 54 63 6c 5f 43 6f 6d 70 61 72 65 48 61     Tcl_CompareHa
a920: 73 68 4b 65 79 73 50 72 6f 63 20 2a 63 6f 6d 70  shKeysProc *comp
a930: 61 72 65 4b 65 79 73 50 72 6f 63 3b 0a 09 09 09  areKeysProc;....
a940: 09 2f 2a 20 43 6f 6d 70 61 72 65 73 20 74 77 6f  ./* Compares two
a950: 20 6b 65 79 73 20 61 6e 64 20 72 65 74 75 72 6e   keys and return
a960: 73 20 7a 65 72 6f 20 69 66 20 74 68 65 79 0a 09  s zero if they..
a970: 09 09 09 20 2a 20 64 6f 20 6e 6f 74 20 6d 61 74  ... * do not mat
a980: 63 68 2c 20 61 6e 64 20 6e 6f 6e 2d 7a 65 72 6f  ch, and non-zero
a990: 20 69 66 20 74 68 65 79 20 64 6f 2e 20 49 66 0a   if they do. If.
a9a0: 09 09 09 09 20 2a 20 74 68 69 73 20 69 73 20 4e  .... * this is N
a9b0: 55 4c 4c 20 74 68 65 6e 20 74 68 65 20 70 6f 69  ULL then the poi
a9c0: 6e 74 65 72 73 20 61 72 65 0a 09 09 09 09 20 2a  nters are..... *
a9d0: 20 63 6f 6d 70 61 72 65 64 2e 20 2a 2f 0a 20 20   compared. */.  
a9e0: 20 20 54 63 6c 5f 41 6c 6c 6f 63 48 61 73 68 45    Tcl_AllocHashE
a9f0: 6e 74 72 79 50 72 6f 63 20 2a 61 6c 6c 6f 63 45  ntryProc *allocE
aa00: 6e 74 72 79 50 72 6f 63 3b 0a 09 09 09 09 2f 2a  ntryProc;...../*
aa10: 20 43 61 6c 6c 65 64 20 74 6f 20 61 6c 6c 6f 63   Called to alloc
aa20: 61 74 65 20 6d 65 6d 6f 72 79 20 66 6f 72 20 61  ate memory for a
aa30: 20 6e 65 77 20 65 6e 74 72 79 2c 0a 09 09 09 09   new entry,.....
aa40: 20 2a 20 69 2e 65 2e 20 69 66 20 74 68 65 20 6b   * i.e. if the k
aa50: 65 79 20 69 73 20 61 20 73 74 72 69 6e 67 20 74  ey is a string t
aa60: 68 65 6e 20 74 68 69 73 20 63 6f 75 6c 64 0a 09  hen this could..
aa70: 09 09 09 20 2a 20 61 6c 6c 6f 63 61 74 65 20 61  ... * allocate a
aa80: 20 73 69 6e 67 6c 65 20 62 6c 6f 63 6b 20 77 68   single block wh
aa90: 69 63 68 20 63 6f 6e 74 61 69 6e 73 0a 09 09 09  ich contains....
aaa0: 09 20 2a 20 65 6e 6f 75 67 68 20 73 70 61 63 65  . * enough space
aab0: 20 66 6f 72 20 62 6f 74 68 20 74 68 65 20 65 6e   for both the en
aac0: 74 72 79 20 61 6e 64 20 74 68 65 0a 09 09 09 09  try and the.....
aad0: 20 2a 20 73 74 72 69 6e 67 2e 20 4f 6e 6c 79 20   * string. Only 
aae0: 74 68 65 20 6b 65 79 20 66 69 65 6c 64 20 6f 66  the key field of
aaf0: 20 74 68 65 20 61 6c 6c 6f 63 61 74 65 64 0a 09   the allocated..
ab00: 09 09 09 20 2a 20 54 63 6c 5f 48 61 73 68 45 6e  ... * Tcl_HashEn
ab10: 74 72 79 20 73 74 72 75 63 74 75 72 65 20 6e 65  try structure ne
ab20: 65 64 73 20 74 6f 20 62 65 20 66 69 6c 6c 65 64  eds to be filled
ab30: 0a 09 09 09 09 20 2a 20 69 6e 2e 20 49 66 20 73  ..... * in. If s
ab40: 6f 6d 65 74 68 69 6e 67 20 65 6c 73 65 20 6e 65  omething else ne
ab50: 65 64 73 20 74 6f 20 62 65 20 64 6f 6e 65 20 74  eds to be done t
ab60: 6f 0a 09 09 09 09 20 2a 20 74 68 65 20 6b 65 79  o..... * the key
ab70: 2c 20 69 2e 65 2e 20 69 6e 63 72 65 6d 65 6e 74  , i.e. increment
ab80: 69 6e 67 20 61 20 72 65 66 65 72 65 6e 63 65 0a  ing a reference.
ab90: 09 09 09 09 20 2a 20 63 6f 75 6e 74 20 74 68 65  .... * count the
aba0: 6e 20 74 68 61 74 20 73 68 6f 75 6c 64 20 62 65  n that should be
abb0: 20 64 6f 6e 65 20 62 79 20 74 68 69 73 0a 09 09   done by this...
abc0: 09 09 20 2a 20 66 75 6e 63 74 69 6f 6e 2e 20 49  .. * function. I
abd0: 66 20 74 68 69 73 20 69 73 20 4e 55 4c 4c 20 74  f this is NULL t
abe0: 68 65 6e 20 54 63 6c 5f 41 6c 6c 6f 63 20 69 73  hen Tcl_Alloc is
abf0: 0a 09 09 09 09 20 2a 20 75 73 65 64 20 74 6f 20  ..... * used to 
ac00: 61 6c 6c 6f 63 61 74 65 20 65 6e 6f 75 67 68 20  allocate enough 
ac10: 73 70 61 63 65 20 66 6f 72 20 61 0a 09 09 09 09  space for a.....
ac20: 20 2a 20 54 63 6c 5f 48 61 73 68 45 6e 74 72 79   * Tcl_HashEntry
ac30: 20 61 6e 64 20 74 68 65 20 6b 65 79 20 70 6f 69   and the key poi
ac40: 6e 74 65 72 20 69 73 0a 09 09 09 09 20 2a 20 61  nter is..... * a
ac50: 73 73 69 67 6e 65 64 20 74 6f 20 6b 65 79 2e 6f  ssigned to key.o
ac60: 6e 65 57 6f 72 64 56 61 6c 75 65 2e 20 2a 2f 0a  neWordValue. */.
ac70: 20 20 20 20 54 63 6c 5f 46 72 65 65 48 61 73 68      Tcl_FreeHash
ac80: 45 6e 74 72 79 50 72 6f 63 20 2a 66 72 65 65 45  EntryProc *freeE
ac90: 6e 74 72 79 50 72 6f 63 3b 0a 09 09 09 09 2f 2a  ntryProc;...../*
aca0: 20 43 61 6c 6c 65 64 20 74 6f 20 66 72 65 65 20   Called to free 
acb0: 6d 65 6d 6f 72 79 20 61 73 73 6f 63 69 61 74 65  memory associate
acc0: 64 20 77 69 74 68 20 61 6e 0a 09 09 09 09 20 2a  d with an..... *
acd0: 20 65 6e 74 72 79 2e 20 49 66 20 73 6f 6d 65 74   entry. If somet
ace0: 68 69 6e 67 20 65 6c 73 65 20 6e 65 65 64 73 20  hing else needs 
acf0: 74 6f 20 62 65 20 64 6f 6e 65 0a 09 09 09 09 20  to be done..... 
ad00: 2a 20 74 6f 20 74 68 65 20 6b 65 79 2c 20 69 2e  * to the key, i.
ad10: 65 2e 20 64 65 63 72 65 6d 65 6e 74 69 6e 67 20  e. decrementing 
ad20: 61 20 72 65 66 65 72 65 6e 63 65 0a 09 09 09 09  a reference.....
ad30: 20 2a 20 63 6f 75 6e 74 20 74 68 65 6e 20 74 68   * count then th
ad40: 61 74 20 73 68 6f 75 6c 64 20 62 65 20 64 6f 6e  at should be don
ad50: 65 20 62 79 20 74 68 69 73 0a 09 09 09 09 20 2a  e by this..... *
ad60: 20 66 75 6e 63 74 69 6f 6e 2e 20 49 66 20 74 68   function. If th
ad70: 69 73 20 69 73 20 4e 55 4c 4c 20 74 68 65 6e 20  is is NULL then 
ad80: 54 63 6c 5f 46 72 65 65 20 69 73 0a 09 09 09 09  Tcl_Free is.....
ad90: 20 2a 20 75 73 65 64 20 74 6f 20 66 72 65 65 20   * used to free 
ada0: 74 68 65 20 54 63 6c 5f 48 61 73 68 45 6e 74 72  the Tcl_HashEntr
adb0: 79 2e 20 2a 2f 0a 7d 3b 0a 0a 2f 2a 0a 20 2a 20  y. */.};../*. * 
adc0: 53 74 72 75 63 74 75 72 65 20 64 65 66 69 6e 69  Structure defini
add0: 74 69 6f 6e 20 66 6f 72 20 61 20 68 61 73 68 20  tion for a hash 
ade0: 74 61 62 6c 65 2e 20 20 4d 75 73 74 20 62 65 20  table.  Must be 
adf0: 69 6e 20 74 63 6c 2e 68 20 73 6f 20 63 6c 69 65  in tcl.h so clie
ae00: 6e 74 73 20 63 61 6e 0a 20 2a 20 61 6c 6c 6f 63  nts can. * alloc
ae10: 61 74 65 20 73 70 61 63 65 20 66 6f 72 20 74 68  ate space for th
ae20: 65 73 65 20 73 74 72 75 63 74 75 72 65 73 2c 20  ese structures, 
ae30: 62 75 74 20 63 6c 69 65 6e 74 73 20 73 68 6f 75  but clients shou
ae40: 6c 64 20 6e 65 76 65 72 20 61 63 63 65 73 73 20  ld never access 
ae50: 61 6e 79 0a 20 2a 20 66 69 65 6c 64 73 20 69 6e  any. * fields in
ae60: 20 74 68 69 73 20 73 74 72 75 63 74 75 72 65 2e   this structure.
ae70: 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43  . */..#define TC
ae80: 4c 5f 53 4d 41 4c 4c 5f 48 41 53 48 5f 54 41 42  L_SMALL_HASH_TAB
ae90: 4c 45 20 34 0a 73 74 72 75 63 74 20 54 63 6c 5f  LE 4.struct Tcl_
aea0: 48 61 73 68 54 61 62 6c 65 20 7b 0a 20 20 20 20  HashTable {.    
aeb0: 54 63 6c 5f 48 61 73 68 45 6e 74 72 79 20 2a 2a  Tcl_HashEntry **
aec0: 62 75 63 6b 65 74 73 3b 09 2f 2a 20 50 6f 69 6e  buckets;./* Poin
aed0: 74 65 72 20 74 6f 20 62 75 63 6b 65 74 20 61 72  ter to bucket ar
aee0: 72 61 79 2e 20 45 61 63 68 20 65 6c 65 6d 65 6e  ray. Each elemen
aef0: 74 0a 09 09 09 09 20 2a 20 70 6f 69 6e 74 73 20  t..... * points 
af00: 74 6f 20 66 69 72 73 74 20 65 6e 74 72 79 20 69  to first entry i
af10: 6e 20 62 75 63 6b 65 74 27 73 20 68 61 73 68 0a  n bucket's hash.
af20: 09 09 09 09 20 2a 20 63 68 61 69 6e 2c 20 6f 72  .... * chain, or
af30: 20 4e 55 4c 4c 2e 20 2a 2f 0a 20 20 20 20 54 63   NULL. */.    Tc
af40: 6c 5f 48 61 73 68 45 6e 74 72 79 20 2a 73 74 61  l_HashEntry *sta
af50: 74 69 63 42 75 63 6b 65 74 73 5b 54 43 4c 5f 53  ticBuckets[TCL_S
af60: 4d 41 4c 4c 5f 48 41 53 48 5f 54 41 42 4c 45 5d  MALL_HASH_TABLE]
af70: 3b 0a 09 09 09 09 2f 2a 20 42 75 63 6b 65 74 20  ;...../* Bucket 
af80: 61 72 72 61 79 20 75 73 65 64 20 66 6f 72 20 73  array used for s
af90: 6d 61 6c 6c 20 74 61 62 6c 65 73 20 28 74 6f 0a  mall tables (to.
afa0: 09 09 09 09 20 2a 20 61 76 6f 69 64 20 6d 61 6c  .... * avoid mal
afb0: 6c 6f 63 73 20 61 6e 64 20 66 72 65 65 73 29 2e  locs and frees).
afc0: 20 2a 2f 0a 20 20 20 20 69 6e 74 20 6e 75 6d 42   */.    int numB
afd0: 75 63 6b 65 74 73 3b 09 09 2f 2a 20 54 6f 74 61  uckets;../* Tota
afe0: 6c 20 6e 75 6d 62 65 72 20 6f 66 20 62 75 63 6b  l number of buck
aff0: 65 74 73 20 61 6c 6c 6f 63 61 74 65 64 20 61 74  ets allocated at
b000: 0a 09 09 09 09 20 2a 20 2a 2a 62 75 63 6b 65 74  ..... * **bucket
b010: 50 74 72 2e 20 2a 2f 0a 20 20 20 20 69 6e 74 20  Ptr. */.    int 
b020: 6e 75 6d 45 6e 74 72 69 65 73 3b 09 09 2f 2a 20  numEntries;../* 
b030: 54 6f 74 61 6c 20 6e 75 6d 62 65 72 20 6f 66 20  Total number of 
b040: 65 6e 74 72 69 65 73 20 70 72 65 73 65 6e 74 20  entries present 
b050: 69 6e 0a 09 09 09 09 20 2a 20 74 61 62 6c 65 2e  in..... * table.
b060: 20 2a 2f 0a 20 20 20 20 69 6e 74 20 72 65 62 75   */.    int rebu
b070: 69 6c 64 53 69 7a 65 3b 09 09 2f 2a 20 45 6e 6c  ildSize;../* Enl
b080: 61 72 67 65 20 74 61 62 6c 65 20 77 68 65 6e 20  arge table when 
b090: 6e 75 6d 45 6e 74 72 69 65 73 20 67 65 74 73 20  numEntries gets 
b0a0: 74 6f 20 62 65 0a 09 09 09 09 20 2a 20 74 68 69  to be..... * thi
b0b0: 73 20 6c 61 72 67 65 2e 20 2a 2f 0a 20 20 20 20  s large. */.    
b0c0: 69 6e 74 20 64 6f 77 6e 53 68 69 66 74 3b 09 09  int downShift;..
b0d0: 2f 2a 20 53 68 69 66 74 20 63 6f 75 6e 74 20 75  /* Shift count u
b0e0: 73 65 64 20 69 6e 20 68 61 73 68 69 6e 67 20 66  sed in hashing f
b0f0: 75 6e 63 74 69 6f 6e 2e 0a 09 09 09 09 20 2a 20  unction...... * 
b100: 44 65 73 69 67 6e 65 64 20 74 6f 20 75 73 65 20  Designed to use 
b110: 68 69 67 68 2d 6f 72 64 65 72 20 62 69 74 73 20  high-order bits 
b120: 6f 66 0a 09 09 09 09 20 2a 20 72 61 6e 64 6f 6d  of..... * random
b130: 69 7a 65 64 20 6b 65 79 73 2e 20 2a 2f 0a 20 20  ized keys. */.  
b140: 20 20 69 6e 74 20 6d 61 73 6b 3b 09 09 09 2f 2a    int mask;.../*
b150: 20 4d 61 73 6b 20 76 61 6c 75 65 20 75 73 65 64   Mask value used
b160: 20 69 6e 20 68 61 73 68 69 6e 67 20 66 75 6e 63   in hashing func
b170: 74 69 6f 6e 2e 20 2a 2f 0a 20 20 20 20 69 6e 74  tion. */.    int
b180: 20 6b 65 79 54 79 70 65 3b 09 09 2f 2a 20 54 79   keyType;../* Ty
b190: 70 65 20 6f 66 20 6b 65 79 73 20 75 73 65 64 20  pe of keys used 
b1a0: 69 6e 20 74 68 69 73 20 74 61 62 6c 65 2e 20 49  in this table. I
b1b0: 74 27 73 0a 09 09 09 09 20 2a 20 65 69 74 68 65  t's..... * eithe
b1c0: 72 20 54 43 4c 5f 43 55 53 54 4f 4d 5f 4b 45 59  r TCL_CUSTOM_KEY
b1d0: 53 2c 20 54 43 4c 5f 53 54 52 49 4e 47 5f 4b 45  S, TCL_STRING_KE
b1e0: 59 53 2c 0a 09 09 09 09 20 2a 20 54 43 4c 5f 4f  YS,..... * TCL_O
b1f0: 4e 45 5f 57 4f 52 44 5f 4b 45 59 53 2c 20 6f 72  NE_WORD_KEYS, or
b200: 20 61 6e 20 69 6e 74 65 67 65 72 20 67 69 76 69   an integer givi
b210: 6e 67 20 74 68 65 0a 09 09 09 09 20 2a 20 6e 75  ng the..... * nu
b220: 6d 62 65 72 20 6f 66 20 69 6e 74 73 20 74 68 61  mber of ints tha
b230: 74 20 69 73 20 74 68 65 20 73 69 7a 65 20 6f 66  t is the size of
b240: 20 74 68 65 0a 09 09 09 09 20 2a 20 6b 65 79 2e   the..... * key.
b250: 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 48 61 73 68   */.    Tcl_Hash
b260: 45 6e 74 72 79 20 2a 28 2a 66 69 6e 64 50 72 6f  Entry *(*findPro
b270: 63 29 20 28 54 63 6c 5f 48 61 73 68 54 61 62 6c  c) (Tcl_HashTabl
b280: 65 20 2a 74 61 62 6c 65 50 74 72 2c 20 63 6f 6e  e *tablePtr, con
b290: 73 74 20 63 68 61 72 20 2a 6b 65 79 29 3b 0a 20  st char *key);. 
b2a0: 20 20 20 54 63 6c 5f 48 61 73 68 45 6e 74 72 79     Tcl_HashEntry
b2b0: 20 2a 28 2a 63 72 65 61 74 65 50 72 6f 63 29 20   *(*createProc) 
b2c0: 28 54 63 6c 5f 48 61 73 68 54 61 62 6c 65 20 2a  (Tcl_HashTable *
b2d0: 74 61 62 6c 65 50 74 72 2c 20 63 6f 6e 73 74 20  tablePtr, const 
b2e0: 63 68 61 72 20 2a 6b 65 79 2c 0a 09 20 20 20 20  char *key,..    
b2f0: 69 6e 74 20 2a 6e 65 77 50 74 72 29 3b 0a 20 20  int *newPtr);.  
b300: 20 20 63 6f 6e 73 74 20 54 63 6c 5f 48 61 73 68    const Tcl_Hash
b310: 4b 65 79 54 79 70 65 20 2a 74 79 70 65 50 74 72  KeyType *typePtr
b320: 3b 0a 09 09 09 09 2f 2a 20 54 79 70 65 20 6f 66  ;...../* Type of
b330: 20 74 68 65 20 6b 65 79 73 20 75 73 65 64 20 69   the keys used i
b340: 6e 20 74 68 65 0a 09 09 09 09 20 2a 20 54 63 6c  n the..... * Tcl
b350: 5f 48 61 73 68 54 61 62 6c 65 2e 20 2a 2f 0a 7d  _HashTable. */.}
b360: 3b 0a 0a 2f 2a 0a 20 2a 20 53 74 72 75 63 74 75  ;../*. * Structu
b370: 72 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 66 6f  re definition fo
b380: 72 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 75 73  r information us
b390: 65 64 20 74 6f 20 6b 65 65 70 20 74 72 61 63 6b  ed to keep track
b3a0: 20 6f 66 20 73 65 61 72 63 68 65 73 20 74 68 72   of searches thr
b3b0: 6f 75 67 68 0a 20 2a 20 68 61 73 68 20 74 61 62  ough. * hash tab
b3c0: 6c 65 73 3a 0a 20 2a 2f 0a 0a 74 79 70 65 64 65  les:. */..typede
b3d0: 66 20 73 74 72 75 63 74 20 54 63 6c 5f 48 61 73  f struct Tcl_Has
b3e0: 68 53 65 61 72 63 68 20 7b 0a 20 20 20 20 54 63  hSearch {.    Tc
b3f0: 6c 5f 48 61 73 68 54 61 62 6c 65 20 2a 74 61 62  l_HashTable *tab
b400: 6c 65 50 74 72 3b 09 2f 2a 20 54 61 62 6c 65 20  lePtr;./* Table 
b410: 62 65 69 6e 67 20 73 65 61 72 63 68 65 64 2e 20  being searched. 
b420: 2a 2f 0a 20 20 20 20 69 6e 74 20 6e 65 78 74 49  */.    int nextI
b430: 6e 64 65 78 3b 09 09 2f 2a 20 49 6e 64 65 78 20  ndex;../* Index 
b440: 6f 66 20 6e 65 78 74 20 62 75 63 6b 65 74 20 74  of next bucket t
b450: 6f 20 62 65 20 65 6e 75 6d 65 72 61 74 65 64 20  o be enumerated 
b460: 61 66 74 65 72 0a 09 09 09 09 20 2a 20 70 72 65  after..... * pre
b470: 73 65 6e 74 20 6f 6e 65 2e 20 2a 2f 0a 20 20 20  sent one. */.   
b480: 20 54 63 6c 5f 48 61 73 68 45 6e 74 72 79 20 2a   Tcl_HashEntry *
b490: 6e 65 78 74 45 6e 74 72 79 50 74 72 3b 2f 2a 20  nextEntryPtr;/* 
b4a0: 4e 65 78 74 20 65 6e 74 72 79 20 74 6f 20 62 65  Next entry to be
b4b0: 20 65 6e 75 6d 65 72 61 74 65 64 20 69 6e 20 74   enumerated in t
b4c0: 68 65 20 63 75 72 72 65 6e 74 0a 09 09 09 09 20  he current..... 
b4d0: 2a 20 62 75 63 6b 65 74 2e 20 2a 2f 0a 7d 20 54  * bucket. */.} T
b4e0: 63 6c 5f 48 61 73 68 53 65 61 72 63 68 3b 0a 0a  cl_HashSearch;..
b4f0: 2f 2a 0a 20 2a 20 41 63 63 65 70 74 61 62 6c 65  /*. * Acceptable
b500: 20 6b 65 79 20 74 79 70 65 73 20 66 6f 72 20 68   key types for h
b510: 61 73 68 20 74 61 62 6c 65 73 3a 0a 20 2a 0a 20  ash tables:. *. 
b520: 2a 20 54 43 4c 5f 53 54 52 49 4e 47 5f 4b 45 59  * TCL_STRING_KEY
b530: 53 3a 09 09 54 68 65 20 6b 65 79 73 20 61 72 65  S:..The keys are
b540: 20 73 74 72 69 6e 67 73 2c 20 74 68 65 79 20 61   strings, they a
b550: 72 65 20 63 6f 70 69 65 64 20 69 6e 74 6f 20 74  re copied into t
b560: 68 65 0a 20 2a 09 09 09 09 65 6e 74 72 79 2e 0a  he. *....entry..
b570: 20 2a 20 54 43 4c 5f 4f 4e 45 5f 57 4f 52 44 5f   * TCL_ONE_WORD_
b580: 4b 45 59 53 3a 09 09 54 68 65 20 6b 65 79 73 20  KEYS:..The keys 
b590: 61 72 65 20 70 6f 69 6e 74 65 72 73 2c 20 74 68  are pointers, th
b5a0: 65 20 70 6f 69 6e 74 65 72 20 69 73 20 73 74 6f  e pointer is sto
b5b0: 72 65 64 0a 20 2a 09 09 09 09 69 6e 20 74 68 65  red. *....in the
b5c0: 20 65 6e 74 72 79 2e 0a 20 2a 20 54 43 4c 5f 43   entry.. * TCL_C
b5d0: 55 53 54 4f 4d 5f 54 59 50 45 5f 4b 45 59 53 3a  USTOM_TYPE_KEYS:
b5e0: 09 54 68 65 20 6b 65 79 73 20 61 72 65 20 61 72  .The keys are ar
b5f0: 62 69 74 72 61 72 79 20 74 79 70 65 73 20 77 68  bitrary types wh
b600: 69 63 68 20 61 72 65 20 63 6f 70 69 65 64 0a 20  ich are copied. 
b610: 2a 09 09 09 09 69 6e 74 6f 20 74 68 65 20 65 6e  *....into the en
b620: 74 72 79 2e 0a 20 2a 20 54 43 4c 5f 43 55 53 54  try.. * TCL_CUST
b630: 4f 4d 5f 50 54 52 5f 4b 45 59 53 3a 09 09 54 68  OM_PTR_KEYS:..Th
b640: 65 20 6b 65 79 73 20 61 72 65 20 70 6f 69 6e 74  e keys are point
b650: 65 72 73 20 74 6f 20 61 72 62 69 74 72 61 72 79  ers to arbitrary
b660: 20 74 79 70 65 73 2c 20 74 68 65 0a 20 2a 09 09   types, the. *..
b670: 09 09 70 6f 69 6e 74 65 72 20 69 73 20 73 74 6f  ..pointer is sto
b680: 72 65 64 20 69 6e 20 74 68 65 20 65 6e 74 72 79  red in the entry
b690: 2e 0a 20 2a 0a 20 2a 20 57 68 69 6c 65 20 6d 61  .. *. * While ma
b6a0: 69 6e 74 61 69 6e 69 6e 67 20 62 69 6e 61 72 79  intaining binary
b6b0: 20 63 6f 6d 70 61 74 69 62 69 6c 69 74 79 20 74   compatibility t
b6c0: 68 65 20 61 62 6f 76 65 20 68 61 76 65 20 74 6f  he above have to
b6d0: 20 62 65 20 64 69 73 74 69 6e 63 74 20 76 61 6c   be distinct val
b6e0: 75 65 73 0a 20 2a 20 61 73 20 74 68 65 79 20 61  ues. * as they a
b6f0: 72 65 20 75 73 65 64 20 74 6f 20 64 69 66 66 65  re used to diffe
b700: 72 65 6e 74 69 61 74 65 20 62 65 74 77 65 65 6e  rentiate between
b710: 20 6f 6c 64 20 76 65 72 73 69 6f 6e 73 20 6f 66   old versions of
b720: 20 74 68 65 20 68 61 73 68 20 74 61 62 6c 65 0a   the hash table.
b730: 20 2a 20 77 68 69 63 68 20 64 6f 6e 27 74 20 68   * which don't h
b740: 61 76 65 20 61 20 74 79 70 65 50 74 72 20 61 6e  ave a typePtr an
b750: 64 20 6e 65 77 20 6f 6e 65 73 20 77 68 69 63 68  d new ones which
b760: 20 64 6f 2e 20 4f 6e 63 65 20 62 69 6e 61 72 79   do. Once binary
b770: 20 63 6f 6d 70 61 74 69 62 69 6c 69 74 79 0a 20   compatibility. 
b780: 2a 20 69 73 20 64 69 73 63 61 72 64 65 64 20 69  * is discarded i
b790: 6e 20 66 61 76 6f 75 72 20 6f 66 20 6d 61 6b 69  n favour of maki
b7a0: 6e 67 20 6d 6f 72 65 20 77 69 64 65 20 73 70 72  ng more wide spr
b7b0: 65 61 64 20 63 68 61 6e 67 65 73 20 54 43 4c 5f  ead changes TCL_
b7c0: 53 54 52 49 4e 47 5f 4b 45 59 53 0a 20 2a 20 63  STRING_KEYS. * c
b7d0: 61 6e 20 62 65 20 74 68 65 20 73 61 6d 65 20 61  an be the same a
b7e0: 73 20 54 43 4c 5f 43 55 53 54 4f 4d 5f 54 59 50  s TCL_CUSTOM_TYP
b7f0: 45 5f 4b 45 59 53 2c 20 61 6e 64 20 54 43 4c 5f  E_KEYS, and TCL_
b800: 4f 4e 45 5f 57 4f 52 44 5f 4b 45 59 53 20 63 61  ONE_WORD_KEYS ca
b810: 6e 20 62 65 20 74 68 65 0a 20 2a 20 73 61 6d 65  n be the. * same
b820: 20 61 73 20 54 43 4c 5f 43 55 53 54 4f 4d 5f 50   as TCL_CUSTOM_P
b830: 54 52 5f 4b 45 59 53 20 62 65 63 61 75 73 65 20  TR_KEYS because 
b840: 74 68 65 79 20 73 69 6d 70 6c 79 20 64 65 74 65  they simply dete
b850: 72 6d 69 6e 65 20 68 6f 77 20 74 68 65 20 6b 65  rmine how the ke
b860: 79 20 69 73 0a 20 2a 20 61 63 63 65 73 73 65 64  y is. * accessed
b870: 20 66 72 6f 6d 20 74 68 65 20 65 6e 74 72 79 20   from the entry 
b880: 61 6e 64 20 6e 6f 74 20 74 68 65 20 62 65 68 61  and not the beha
b890: 76 69 6f 75 72 2e 0a 20 2a 2f 0a 0a 23 64 65 66  viour.. */..#def
b8a0: 69 6e 65 20 54 43 4c 5f 53 54 52 49 4e 47 5f 4b  ine TCL_STRING_K
b8b0: 45 59 53 09 09 28 30 29 0a 23 64 65 66 69 6e 65  EYS..(0).#define
b8c0: 20 54 43 4c 5f 4f 4e 45 5f 57 4f 52 44 5f 4b 45   TCL_ONE_WORD_KE
b8d0: 59 53 09 28 31 29 0a 23 64 65 66 69 6e 65 20 54  YS.(1).#define T
b8e0: 43 4c 5f 43 55 53 54 4f 4d 5f 54 59 50 45 5f 4b  CL_CUSTOM_TYPE_K
b8f0: 45 59 53 09 28 2d 32 29 0a 23 64 65 66 69 6e 65  EYS.(-2).#define
b900: 20 54 43 4c 5f 43 55 53 54 4f 4d 5f 50 54 52 5f   TCL_CUSTOM_PTR_
b910: 4b 45 59 53 09 28 2d 31 29 0a 0a 2f 2a 0a 20 2a  KEYS.(-1)../*. *
b920: 20 53 74 72 75 63 74 75 72 65 20 64 65 66 69 6e   Structure defin
b930: 69 74 69 6f 6e 20 66 6f 72 20 69 6e 66 6f 72 6d  ition for inform
b940: 61 74 69 6f 6e 20 75 73 65 64 20 74 6f 20 6b 65  ation used to ke
b950: 65 70 20 74 72 61 63 6b 20 6f 66 20 73 65 61 72  ep track of sear
b960: 63 68 65 73 20 74 68 72 6f 75 67 68 0a 20 2a 20  ches through. * 
b970: 64 69 63 74 69 6f 6e 61 72 69 65 73 2e 20 54 68  dictionaries. Th
b980: 65 73 65 20 66 69 65 6c 64 73 20 73 68 6f 75 6c  ese fields shoul
b990: 64 20 6e 6f 74 20 62 65 20 61 63 63 65 73 73 65  d not be accesse
b9a0: 64 20 62 79 20 63 6f 64 65 20 6f 75 74 73 69 64  d by code outsid
b9b0: 65 0a 20 2a 20 74 63 6c 44 69 63 74 4f 62 6a 2e  e. * tclDictObj.
b9c0: 63 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 73  c. */..typedef s
b9d0: 74 72 75 63 74 20 7b 0a 20 20 20 20 76 6f 69 64  truct {.    void
b9e0: 20 2a 6e 65 78 74 3b 09 09 09 2f 2a 20 53 65 61   *next;.../* Sea
b9f0: 72 63 68 20 70 6f 73 69 74 69 6f 6e 20 66 6f 72  rch position for
ba00: 20 75 6e 64 65 72 6c 79 69 6e 67 20 68 61 73 68   underlying hash
ba10: 0a 09 09 09 09 20 2a 20 74 61 62 6c 65 2e 20 2a  ..... * table. *
ba20: 2f 0a 20 20 20 20 69 6e 74 20 65 70 6f 63 68 3b  /.    int epoch;
ba30: 09 09 09 2f 2a 20 45 70 6f 63 68 20 6d 61 72 6b  .../* Epoch mark
ba40: 65 72 20 66 6f 72 20 64 69 63 74 69 6f 6e 61 72  er for dictionar
ba50: 79 20 62 65 69 6e 67 20 73 65 61 72 63 68 65 64  y being searched
ba60: 2c 0a 09 09 09 09 20 2a 20 6f 72 20 2d 31 20 69  ,..... * or -1 i
ba70: 66 20 73 65 61 72 63 68 20 68 61 73 20 74 65 72  f search has ter
ba80: 6d 69 6e 61 74 65 64 2e 20 2a 2f 0a 20 20 20 20  minated. */.    
ba90: 54 63 6c 5f 44 69 63 74 20 64 69 63 74 69 6f 6e  Tcl_Dict diction
baa0: 61 72 79 50 74 72 3b 09 2f 2a 20 52 65 66 65 72  aryPtr;./* Refer
bab0: 65 6e 63 65 20 74 6f 20 64 69 63 74 69 6f 6e 61  ence to dictiona
bac0: 72 79 20 62 65 69 6e 67 20 73 65 61 72 63 68 65  ry being searche
bad0: 64 2e 20 2a 2f 0a 7d 20 54 63 6c 5f 44 69 63 74  d. */.} Tcl_Dict
bae0: 53 65 61 72 63 68 3b 0a 0c 0a 2f 2a 0a 20 2a 2d  Search;.../*. *-
baf0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
bb00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
bb10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
bb20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
bb30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 46  -----------. * F
bb40: 6c 61 67 20 76 61 6c 75 65 73 20 74 6f 20 70 61  lag values to pa
bb50: 73 73 20 74 6f 20 54 63 6c 5f 44 6f 4f 6e 65 45  ss to Tcl_DoOneE
bb60: 76 65 6e 74 20 74 6f 20 64 69 73 61 62 6c 65 20  vent to disable 
bb70: 73 65 61 72 63 68 65 73 20 66 6f 72 20 73 6f 6d  searches for som
bb80: 65 20 6b 69 6e 64 73 20 6f 66 0a 20 2a 20 65 76  e kinds of. * ev
bb90: 65 6e 74 73 3a 0a 20 2a 2f 0a 0a 23 64 65 66 69  ents:. */..#defi
bba0: 6e 65 20 54 43 4c 5f 44 4f 4e 54 5f 57 41 49 54  ne TCL_DONT_WAIT
bbb0: 09 09 28 31 3c 3c 31 29 0a 23 64 65 66 69 6e 65  ..(1<<1).#define
bbc0: 20 54 43 4c 5f 57 49 4e 44 4f 57 5f 45 56 45 4e   TCL_WINDOW_EVEN
bbd0: 54 53 09 28 31 3c 3c 32 29 0a 23 64 65 66 69 6e  TS.(1<<2).#defin
bbe0: 65 20 54 43 4c 5f 46 49 4c 45 5f 45 56 45 4e 54  e TCL_FILE_EVENT
bbf0: 53 09 09 28 31 3c 3c 33 29 0a 23 64 65 66 69 6e  S..(1<<3).#defin
bc00: 65 20 54 43 4c 5f 54 49 4d 45 52 5f 45 56 45 4e  e TCL_TIMER_EVEN
bc10: 54 53 09 28 31 3c 3c 34 29 0a 23 64 65 66 69 6e  TS.(1<<4).#defin
bc20: 65 20 54 43 4c 5f 49 44 4c 45 5f 45 56 45 4e 54  e TCL_IDLE_EVENT
bc30: 53 09 09 28 31 3c 3c 35 29 09 2f 2a 20 57 41 53  S..(1<<5)./* WAS
bc40: 20 30 78 31 30 20 3f 3f 3f 3f 20 2a 2f 0a 23 64   0x10 ???? */.#d
bc50: 65 66 69 6e 65 20 54 43 4c 5f 41 4c 4c 5f 45 56  efine TCL_ALL_EV
bc60: 45 4e 54 53 09 09 28 7e 54 43 4c 5f 44 4f 4e 54  ENTS..(~TCL_DONT
bc70: 5f 57 41 49 54 29 0a 0a 2f 2a 0a 20 2a 20 54 68  _WAIT)../*. * Th
bc80: 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 73 74 72 75  e following stru
bc90: 63 74 75 72 65 20 64 65 66 69 6e 65 73 20 61 20  cture defines a 
bca0: 67 65 6e 65 72 69 63 20 65 76 65 6e 74 20 66 6f  generic event fo
bcb0: 72 20 74 68 65 20 54 63 6c 20 65 76 65 6e 74 20  r the Tcl event 
bcc0: 73 79 73 74 65 6d 2e 0a 20 2a 20 54 68 65 73 65  system.. * These
bcd0: 20 61 72 65 20 74 68 65 20 74 68 69 6e 67 73 20   are the things 
bce0: 74 68 61 74 20 61 72 65 20 71 75 65 75 65 64 20  that are queued 
bcf0: 69 6e 20 63 61 6c 6c 73 20 74 6f 20 54 63 6c 5f  in calls to Tcl_
bd00: 51 75 65 75 65 45 76 65 6e 74 20 61 6e 64 0a 20  QueueEvent and. 
bd10: 2a 20 73 65 72 76 69 63 65 64 20 6c 61 74 65 72  * serviced later
bd20: 20 62 79 20 54 63 6c 5f 44 6f 4f 6e 65 45 76 65   by Tcl_DoOneEve
bd30: 6e 74 2e 20 54 68 65 72 65 20 63 61 6e 20 62 65  nt. There can be
bd40: 20 6d 61 6e 79 20 64 69 66 66 65 72 65 6e 74 20   many different 
bd50: 6b 69 6e 64 73 20 6f 66 0a 20 2a 20 65 76 65 6e  kinds of. * even
bd60: 74 73 20 77 69 74 68 20 64 69 66 66 65 72 65 6e  ts with differen
bd70: 74 20 66 69 65 6c 64 73 2c 20 63 6f 72 72 65 73  t fields, corres
bd80: 70 6f 6e 64 69 6e 67 20 74 6f 20 77 69 6e 64 6f  ponding to windo
bd90: 77 20 65 76 65 6e 74 73 2c 20 74 69 6d 65 72 20  w events, timer 
bda0: 65 76 65 6e 74 73 2c 0a 20 2a 20 65 74 63 2e 20  events,. * etc. 
bdb0: 54 68 65 20 73 74 72 75 63 74 75 72 65 20 66 6f  The structure fo
bdc0: 72 20 61 20 70 61 72 74 69 63 75 6c 61 72 20 65  r a particular e
bdd0: 76 65 6e 74 20 63 6f 6e 73 69 73 74 73 20 6f 66  vent consists of
bde0: 20 61 20 54 63 6c 5f 45 76 65 6e 74 20 68 65 61   a Tcl_Event hea
bdf0: 64 65 72 0a 20 2a 20 66 6f 6c 6c 6f 77 65 64 20  der. * followed 
be00: 62 79 20 61 64 64 69 74 69 6f 6e 61 6c 20 69 6e  by additional in
be10: 66 6f 72 6d 61 74 69 6f 6e 20 73 70 65 63 69 66  formation specif
be20: 69 63 20 74 6f 20 74 68 61 74 20 65 76 65 6e 74  ic to that event
be30: 2e 0a 20 2a 2f 0a 0a 73 74 72 75 63 74 20 54 63  .. */..struct Tc
be40: 6c 5f 45 76 65 6e 74 20 7b 0a 20 20 20 20 54 63  l_Event {.    Tc
be50: 6c 5f 45 76 65 6e 74 50 72 6f 63 20 2a 70 72 6f  l_EventProc *pro
be60: 63 3b 09 2f 2a 20 46 75 6e 63 74 69 6f 6e 20 74  c;./* Function t
be70: 6f 20 63 61 6c 6c 20 74 6f 20 73 65 72 76 69 63  o call to servic
be80: 65 20 74 68 69 73 20 65 76 65 6e 74 2e 20 2a 2f  e this event. */
be90: 0a 20 20 20 20 73 74 72 75 63 74 20 54 63 6c 5f  .    struct Tcl_
bea0: 45 76 65 6e 74 20 2a 6e 65 78 74 50 74 72 3b 09  Event *nextPtr;.
beb0: 2f 2a 20 4e 65 78 74 20 69 6e 20 6c 69 73 74 20  /* Next in list 
bec0: 6f 66 20 70 65 6e 64 69 6e 67 20 65 76 65 6e 74  of pending event
bed0: 73 2c 20 6f 72 20 4e 55 4c 4c 2e 20 2a 2f 0a 7d  s, or NULL. */.}
bee0: 3b 0a 0a 2f 2a 0a 20 2a 20 50 6f 73 69 74 69 6f  ;../*. * Positio
bef0: 6e 73 20 74 6f 20 70 61 73 73 20 74 6f 20 54 63  ns to pass to Tc
bf00: 6c 5f 51 75 65 75 65 45 76 65 6e 74 3a 0a 20 2a  l_QueueEvent:. *
bf10: 2f 0a 0a 74 79 70 65 64 65 66 20 65 6e 75 6d 20  /..typedef enum 
bf20: 7b 0a 20 20 20 20 54 43 4c 5f 51 55 45 55 45 5f  {.    TCL_QUEUE_
bf30: 54 41 49 4c 2c 20 54 43 4c 5f 51 55 45 55 45 5f  TAIL, TCL_QUEUE_
bf40: 48 45 41 44 2c 20 54 43 4c 5f 51 55 45 55 45 5f  HEAD, TCL_QUEUE_
bf50: 4d 41 52 4b 0a 7d 20 54 63 6c 5f 51 75 65 75 65  MARK.} Tcl_Queue
bf60: 50 6f 73 69 74 69 6f 6e 3b 0a 0a 2f 2a 0a 20 2a  Position;../*. *
bf70: 20 56 61 6c 75 65 73 20 74 6f 20 70 61 73 73 20   Values to pass 
bf80: 74 6f 20 54 63 6c 5f 53 65 74 53 65 72 76 69 63  to Tcl_SetServic
bf90: 65 4d 6f 64 65 20 74 6f 20 73 70 65 63 69 66 79  eMode to specify
bfa0: 20 74 68 65 20 62 65 68 61 76 69 6f 72 20 6f 66   the behavior of
bfb0: 20 6e 6f 74 69 66 69 65 72 0a 20 2a 20 65 76 65   notifier. * eve
bfc0: 6e 74 20 72 6f 75 74 69 6e 65 73 2e 0a 20 2a 2f  nt routines.. */
bfd0: 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 53 45  ..#define TCL_SE
bfe0: 52 56 49 43 45 5f 4e 4f 4e 45 20 30 0a 23 64 65  RVICE_NONE 0.#de
bff0: 66 69 6e 65 20 54 43 4c 5f 53 45 52 56 49 43 45  fine TCL_SERVICE
c000: 5f 41 4c 4c 20 31 0a 0a 2f 2a 0a 20 2a 20 54 68  _ALL 1../*. * Th
c010: 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 73 74 72 75  e following stru
c020: 63 74 75 72 65 20 6b 65 65 70 73 20 69 73 20 75  cture keeps is u
c030: 73 65 64 20 74 6f 20 68 6f 6c 64 20 61 20 74 69  sed to hold a ti
c040: 6d 65 20 76 61 6c 75 65 2c 20 65 69 74 68 65 72  me value, either
c050: 20 61 73 20 61 6e 0a 20 2a 20 61 62 73 6f 6c 75   as an. * absolu
c060: 74 65 20 74 69 6d 65 20 28 74 68 65 20 6e 75 6d  te time (the num
c070: 62 65 72 20 6f 66 20 73 65 63 6f 6e 64 73 20 66  ber of seconds f
c080: 72 6f 6d 20 74 68 65 20 65 70 6f 63 68 29 20 6f  rom the epoch) o
c090: 72 20 61 73 20 61 6e 20 65 6c 61 70 73 65 64 20  r as an elapsed 
c0a0: 74 69 6d 65 2e 0a 20 2a 20 4f 6e 20 55 6e 69 78  time.. * On Unix
c0b0: 20 73 79 73 74 65 6d 73 20 74 68 65 20 65 70 6f   systems the epo
c0c0: 63 68 20 69 73 20 4d 69 64 6e 69 67 68 74 20 4a  ch is Midnight J
c0d0: 61 6e 20 31 2c 20 31 39 37 30 20 47 4d 54 2e 0a  an 1, 1970 GMT..
c0e0: 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 73 74 72   */..typedef str
c0f0: 75 63 74 20 54 63 6c 5f 54 69 6d 65 20 7b 0a 20  uct Tcl_Time {. 
c100: 20 20 20 6c 6f 6e 67 20 73 65 63 3b 09 09 09 2f     long sec;.../
c110: 2a 20 53 65 63 6f 6e 64 73 2e 20 2a 2f 0a 20 20  * Seconds. */.  
c120: 20 20 6c 6f 6e 67 20 75 73 65 63 3b 09 09 09 2f    long usec;.../
c130: 2a 20 4d 69 63 72 6f 73 65 63 6f 6e 64 73 2e 20  * Microseconds. 
c140: 2a 2f 0a 7d 20 54 63 6c 5f 54 69 6d 65 3b 0a 0a  */.} Tcl_Time;..
c150: 74 79 70 65 64 65 66 20 76 6f 69 64 20 28 54 63  typedef void (Tc
c160: 6c 5f 53 65 74 54 69 6d 65 72 50 72 6f 63 29 20  l_SetTimerProc) 
c170: 28 43 4f 4e 53 54 38 36 20 54 63 6c 5f 54 69 6d  (CONST86 Tcl_Tim
c180: 65 20 2a 74 69 6d 65 50 74 72 29 3b 0a 74 79 70  e *timePtr);.typ
c190: 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 57 61  edef int (Tcl_Wa
c1a0: 69 74 46 6f 72 45 76 65 6e 74 50 72 6f 63 29 20  itForEventProc) 
c1b0: 28 43 4f 4e 53 54 38 36 20 54 63 6c 5f 54 69 6d  (CONST86 Tcl_Tim
c1c0: 65 20 2a 74 69 6d 65 50 74 72 29 3b 0a 0a 2f 2a  e *timePtr);../*
c1d0: 0a 20 2a 20 54 49 50 20 23 32 33 33 20 28 56 69  . * TIP #233 (Vi
c1e0: 72 74 75 61 6c 69 7a 65 64 20 54 69 6d 65 29 0a  rtualized Time).
c1f0: 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 76 6f 69   */..typedef voi
c200: 64 20 28 54 63 6c 5f 47 65 74 54 69 6d 65 50 72  d (Tcl_GetTimePr
c210: 6f 63 29 20 20 20 28 54 63 6c 5f 54 69 6d 65 20  oc)   (Tcl_Time 
c220: 2a 74 69 6d 65 62 75 66 2c 20 43 6c 69 65 6e 74  *timebuf, Client
c230: 44 61 74 61 20 63 6c 69 65 6e 74 44 61 74 61 29  Data clientData)
c240: 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 64 20 28  ;.typedef void (
c250: 54 63 6c 5f 53 63 61 6c 65 54 69 6d 65 50 72 6f  Tcl_ScaleTimePro
c260: 63 29 20 28 54 63 6c 5f 54 69 6d 65 20 2a 74 69  c) (Tcl_Time *ti
c270: 6d 65 62 75 66 2c 20 43 6c 69 65 6e 74 44 61 74  mebuf, ClientDat
c280: 61 20 63 6c 69 65 6e 74 44 61 74 61 29 3b 0a 0a  a clientData);..
c290: 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  /*. *-----------
c2a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
c2b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
c2c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
c2d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
c2e0: 2d 0a 20 2a 20 42 69 74 73 20 74 6f 20 70 61 73  -. * Bits to pas
c2f0: 73 20 74 6f 20 54 63 6c 5f 43 72 65 61 74 65 46  s to Tcl_CreateF
c300: 69 6c 65 48 61 6e 64 6c 65 72 20 61 6e 64 20 54  ileHandler and T
c310: 63 6c 5f 43 72 65 61 74 65 43 68 61 6e 6e 65 6c  cl_CreateChannel
c320: 48 61 6e 64 6c 65 72 20 74 6f 0a 20 2a 20 69 6e  Handler to. * in
c330: 64 69 63 61 74 65 20 77 68 61 74 20 73 6f 72 74  dicate what sort
c340: 73 20 6f 66 20 65 76 65 6e 74 73 20 61 72 65 20  s of events are 
c350: 6f 66 20 69 6e 74 65 72 65 73 74 3a 0a 20 2a 2f  of interest:. */
c360: 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 52 45  ..#define TCL_RE
c370: 41 44 41 42 4c 45 09 09 28 31 3c 3c 31 29 0a 23  ADABLE..(1<<1).#
c380: 64 65 66 69 6e 65 20 54 43 4c 5f 57 52 49 54 41  define TCL_WRITA
c390: 42 4c 45 09 09 28 31 3c 3c 32 29 0a 23 64 65 66  BLE..(1<<2).#def
c3a0: 69 6e 65 20 54 43 4c 5f 45 58 43 45 50 54 49 4f  ine TCL_EXCEPTIO
c3b0: 4e 09 09 28 31 3c 3c 33 29 0a 0a 2f 2a 0a 20 2a  N..(1<<3)../*. *
c3c0: 20 46 6c 61 67 20 76 61 6c 75 65 73 20 74 6f 20   Flag values to 
c3d0: 70 61 73 73 20 74 6f 20 54 63 6c 5f 4f 70 65 6e  pass to Tcl_Open
c3e0: 43 6f 6d 6d 61 6e 64 43 68 61 6e 6e 65 6c 20 74  CommandChannel t
c3f0: 6f 20 69 6e 64 69 63 61 74 65 20 74 68 65 20 64  o indicate the d
c400: 69 73 70 6f 73 69 74 69 6f 6e 0a 20 2a 20 6f 66  isposition. * of
c410: 20 74 68 65 20 73 74 64 69 6f 20 68 61 6e 64 6c   the stdio handl
c420: 65 73 2e 20 54 43 4c 5f 53 54 44 49 4e 2c 20 54  es. TCL_STDIN, T
c430: 43 4c 5f 53 54 44 4f 55 54 2c 20 54 43 4c 5f 53  CL_STDOUT, TCL_S
c440: 54 44 45 52 52 2c 20 61 72 65 20 61 6c 73 6f 20  TDERR, are also 
c450: 75 73 65 64 20 69 6e 0a 20 2a 20 54 63 6c 5f 47  used in. * Tcl_G
c460: 65 74 53 74 64 43 68 61 6e 6e 65 6c 2e 0a 20 2a  etStdChannel.. *
c470: 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 53  /..#define TCL_S
c480: 54 44 49 4e 09 09 28 31 3c 3c 31 29 0a 23 64 65  TDIN..(1<<1).#de
c490: 66 69 6e 65 20 54 43 4c 5f 53 54 44 4f 55 54 09  fine TCL_STDOUT.
c4a0: 09 28 31 3c 3c 32 29 0a 23 64 65 66 69 6e 65 20  .(1<<2).#define 
c4b0: 54 43 4c 5f 53 54 44 45 52 52 09 09 28 31 3c 3c  TCL_STDERR..(1<<
c4c0: 33 29 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 45  3).#define TCL_E
c4d0: 4e 46 4f 52 43 45 5f 4d 4f 44 45 09 28 31 3c 3c  NFORCE_MODE.(1<<
c4e0: 34 29 0a 0a 2f 2a 0a 20 2a 20 42 69 74 73 20 70  4)../*. * Bits p
c4f0: 61 73 73 65 64 20 74 6f 20 54 63 6c 5f 44 72 69  assed to Tcl_Dri
c500: 76 65 72 43 6c 6f 73 65 32 50 72 6f 63 20 74 6f  verClose2Proc to
c510: 20 69 6e 64 69 63 61 74 65 20 77 68 69 63 68 20   indicate which 
c520: 73 69 64 65 20 6f 66 20 61 20 63 68 61 6e 6e 65  side of a channe
c530: 6c 0a 20 2a 20 73 68 6f 75 6c 64 20 62 65 20 63  l. * should be c
c540: 6c 6f 73 65 64 2e 0a 20 2a 2f 0a 0a 23 64 65 66  losed.. */..#def
c550: 69 6e 65 20 54 43 4c 5f 43 4c 4f 53 45 5f 52 45  ine TCL_CLOSE_RE
c560: 41 44 09 09 28 31 3c 3c 31 29 0a 23 64 65 66 69  AD..(1<<1).#defi
c570: 6e 65 20 54 43 4c 5f 43 4c 4f 53 45 5f 57 52 49  ne TCL_CLOSE_WRI
c580: 54 45 09 09 28 31 3c 3c 32 29 0a 0a 2f 2a 0a 20  TE..(1<<2)../*. 
c590: 2a 20 56 61 6c 75 65 20 74 6f 20 75 73 65 20 61  * Value to use a
c5a0: 73 20 74 68 65 20 63 6c 6f 73 65 50 72 6f 63 20  s the closeProc 
c5b0: 66 6f 72 20 61 20 63 68 61 6e 6e 65 6c 20 74 68  for a channel th
c5c0: 61 74 20 73 75 70 70 6f 72 74 73 20 74 68 65 20  at supports the 
c5d0: 63 6c 6f 73 65 32 50 72 6f 63 0a 20 2a 20 69 6e  close2Proc. * in
c5e0: 74 65 72 66 61 63 65 2e 0a 20 2a 2f 0a 0a 23 64  terface.. */..#d
c5f0: 65 66 69 6e 65 20 54 43 4c 5f 43 4c 4f 53 45 32  efine TCL_CLOSE2
c600: 50 52 4f 43 09 09 28 28 54 63 6c 5f 44 72 69 76  PROC..((Tcl_Driv
c610: 65 72 43 6c 6f 73 65 50 72 6f 63 20 2a 29 20 31  erCloseProc *) 1
c620: 29 0a 0a 2f 2a 0a 20 2a 20 43 68 61 6e 6e 65 6c  )../*. * Channel
c630: 20 76 65 72 73 69 6f 6e 20 74 61 67 2e 20 54 68   version tag. Th
c640: 69 73 20 77 61 73 20 69 6e 74 72 6f 64 75 63 65  is was introduce
c650: 64 20 69 6e 20 38 2e 33 2e 32 2f 38 2e 34 2e 0a  d in 8.3.2/8.4..
c660: 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c   */..#define TCL
c670: 5f 43 48 41 4e 4e 45 4c 5f 56 45 52 53 49 4f 4e  _CHANNEL_VERSION
c680: 5f 31 09 28 28 54 63 6c 5f 43 68 61 6e 6e 65 6c  _1.((Tcl_Channel
c690: 54 79 70 65 56 65 72 73 69 6f 6e 29 20 30 78 31  TypeVersion) 0x1
c6a0: 29 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 43 48  ).#define TCL_CH
c6b0: 41 4e 4e 45 4c 5f 56 45 52 53 49 4f 4e 5f 32 09  ANNEL_VERSION_2.
c6c0: 28 28 54 63 6c 5f 43 68 61 6e 6e 65 6c 54 79 70  ((Tcl_ChannelTyp
c6d0: 65 56 65 72 73 69 6f 6e 29 20 30 78 32 29 0a 23  eVersion) 0x2).#
c6e0: 64 65 66 69 6e 65 20 54 43 4c 5f 43 48 41 4e 4e  define TCL_CHANN
c6f0: 45 4c 5f 56 45 52 53 49 4f 4e 5f 33 09 28 28 54  EL_VERSION_3.((T
c700: 63 6c 5f 43 68 61 6e 6e 65 6c 54 79 70 65 56 65  cl_ChannelTypeVe
c710: 72 73 69 6f 6e 29 20 30 78 33 29 0a 23 64 65 66  rsion) 0x3).#def
c720: 69 6e 65 20 54 43 4c 5f 43 48 41 4e 4e 45 4c 5f  ine TCL_CHANNEL_
c730: 56 45 52 53 49 4f 4e 5f 34 09 28 28 54 63 6c 5f  VERSION_4.((Tcl_
c740: 43 68 61 6e 6e 65 6c 54 79 70 65 56 65 72 73 69  ChannelTypeVersi
c750: 6f 6e 29 20 30 78 34 29 0a 23 64 65 66 69 6e 65  on) 0x4).#define
c760: 20 54 43 4c 5f 43 48 41 4e 4e 45 4c 5f 56 45 52   TCL_CHANNEL_VER
c770: 53 49 4f 4e 5f 35 09 28 28 54 63 6c 5f 43 68 61  SION_5.((Tcl_Cha
c780: 6e 6e 65 6c 54 79 70 65 56 65 72 73 69 6f 6e 29  nnelTypeVersion)
c790: 20 30 78 35 29 0a 0a 2f 2a 0a 20 2a 20 54 49 50   0x5)../*. * TIP
c7a0: 20 23 32 31 38 3a 20 43 68 61 6e 6e 65 6c 20 41   #218: Channel A
c7b0: 63 74 69 6f 6e 73 2c 20 49 64 73 20 66 6f 72 20  ctions, Ids for 
c7c0: 54 63 6c 5f 44 72 69 76 65 72 54 68 72 65 61 64  Tcl_DriverThread
c7d0: 41 63 74 69 6f 6e 50 72 6f 63 2e 0a 20 2a 2f 0a  ActionProc.. */.
c7e0: 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 43 48 41  .#define TCL_CHA
c7f0: 4e 4e 45 4c 5f 54 48 52 45 41 44 5f 49 4e 53 45  NNEL_THREAD_INSE
c800: 52 54 20 28 30 29 0a 23 64 65 66 69 6e 65 20 54  RT (0).#define T
c810: 43 4c 5f 43 48 41 4e 4e 45 4c 5f 54 48 52 45 41  CL_CHANNEL_THREA
c820: 44 5f 52 45 4d 4f 56 45 20 28 31 29 0a 0a 2f 2a  D_REMOVE (1)../*
c830: 0a 20 2a 20 54 79 70 65 64 65 66 73 20 66 6f 72  . * Typedefs for
c840: 20 74 68 65 20 76 61 72 69 6f 75 73 20 6f 70 65   the various ope
c850: 72 61 74 69 6f 6e 73 20 69 6e 20 61 20 63 68 61  rations in a cha
c860: 6e 6e 65 6c 20 74 79 70 65 3a 0a 20 2a 2f 0a 0a  nnel type:. */..
c870: 74 79 70 65 64 65 66 20 69 6e 74 09 28 54 63 6c  typedef int.(Tcl
c880: 5f 44 72 69 76 65 72 42 6c 6f 63 6b 4d 6f 64 65  _DriverBlockMode
c890: 50 72 6f 63 29 20 28 43 6c 69 65 6e 74 44 61 74  Proc) (ClientDat
c8a0: 61 20 69 6e 73 74 61 6e 63 65 44 61 74 61 2c 20  a instanceData, 
c8b0: 69 6e 74 20 6d 6f 64 65 29 3b 0a 74 79 70 65 64  int mode);.typed
c8c0: 65 66 20 69 6e 74 09 28 54 63 6c 5f 44 72 69 76  ef int.(Tcl_Driv
c8d0: 65 72 43 6c 6f 73 65 50 72 6f 63 29 20 28 43 6c  erCloseProc) (Cl
c8e0: 69 65 6e 74 44 61 74 61 20 69 6e 73 74 61 6e 63  ientData instanc
c8f0: 65 44 61 74 61 2c 0a 09 09 09 54 63 6c 5f 49 6e  eData,....Tcl_In
c900: 74 65 72 70 20 2a 69 6e 74 65 72 70 29 3b 0a 74  terp *interp);.t
c910: 79 70 65 64 65 66 20 69 6e 74 09 28 54 63 6c 5f  ypedef int.(Tcl_
c920: 44 72 69 76 65 72 43 6c 6f 73 65 32 50 72 6f 63  DriverClose2Proc
c930: 29 20 28 43 6c 69 65 6e 74 44 61 74 61 20 69 6e  ) (ClientData in
c940: 73 74 61 6e 63 65 44 61 74 61 2c 0a 09 09 09 54  stanceData,....T
c950: 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72  cl_Interp *inter
c960: 70 2c 20 69 6e 74 20 66 6c 61 67 73 29 3b 0a 74  p, int flags);.t
c970: 79 70 65 64 65 66 20 69 6e 74 09 28 54 63 6c 5f  ypedef int.(Tcl_
c980: 44 72 69 76 65 72 49 6e 70 75 74 50 72 6f 63 29  DriverInputProc)
c990: 20 28 43 6c 69 65 6e 74 44 61 74 61 20 69 6e 73   (ClientData ins
c9a0: 74 61 6e 63 65 44 61 74 61 2c 20 63 68 61 72 20  tanceData, char 
c9b0: 2a 62 75 66 2c 0a 09 09 09 69 6e 74 20 74 6f 52  *buf,....int toR
c9c0: 65 61 64 2c 20 69 6e 74 20 2a 65 72 72 6f 72 43  ead, int *errorC
c9d0: 6f 64 65 50 74 72 29 3b 0a 74 79 70 65 64 65 66  odePtr);.typedef
c9e0: 20 69 6e 74 09 28 54 63 6c 5f 44 72 69 76 65 72   int.(Tcl_Driver
c9f0: 4f 75 74 70 75 74 50 72 6f 63 29 20 28 43 6c 69  OutputProc) (Cli
ca00: 65 6e 74 44 61 74 61 20 69 6e 73 74 61 6e 63 65  entData instance
ca10: 44 61 74 61 2c 0a 09 09 09 43 4f 4e 53 54 38 34  Data,....CONST84
ca20: 20 63 68 61 72 20 2a 62 75 66 2c 20 69 6e 74 20   char *buf, int 
ca30: 74 6f 57 72 69 74 65 2c 20 69 6e 74 20 2a 65 72  toWrite, int *er
ca40: 72 6f 72 43 6f 64 65 50 74 72 29 3b 0a 74 79 70  rorCodePtr);.typ
ca50: 65 64 65 66 20 69 6e 74 09 28 54 63 6c 5f 44 72  edef int.(Tcl_Dr
ca60: 69 76 65 72 53 65 65 6b 50 72 6f 63 29 20 28 43  iverSeekProc) (C
ca70: 6c 69 65 6e 74 44 61 74 61 20 69 6e 73 74 61 6e  lientData instan
ca80: 63 65 44 61 74 61 2c 20 6c 6f 6e 67 20 6f 66 66  ceData, long off
ca90: 73 65 74 2c 0a 09 09 09 69 6e 74 20 6d 6f 64 65  set,....int mode
caa0: 2c 20 69 6e 74 20 2a 65 72 72 6f 72 43 6f 64 65  , int *errorCode
cab0: 50 74 72 29 3b 0a 74 79 70 65 64 65 66 20 69 6e  Ptr);.typedef in
cac0: 74 09 28 54 63 6c 5f 44 72 69 76 65 72 53 65 74  t.(Tcl_DriverSet
cad0: 4f 70 74 69 6f 6e 50 72 6f 63 29 20 28 43 6c 69  OptionProc) (Cli
cae0: 65 6e 74 44 61 74 61 20 69 6e 73 74 61 6e 63 65  entData instance
caf0: 44 61 74 61 2c 0a 09 09 09 54 63 6c 5f 49 6e 74  Data,....Tcl_Int
cb00: 65 72 70 20 2a 69 6e 74 65 72 70 2c 20 63 6f 6e  erp *interp, con
cb10: 73 74 20 63 68 61 72 20 2a 6f 70 74 69 6f 6e 4e  st char *optionN
cb20: 61 6d 65 2c 0a 09 09 09 63 6f 6e 73 74 20 63 68  ame,....const ch
cb30: 61 72 20 2a 76 61 6c 75 65 29 3b 0a 74 79 70 65  ar *value);.type
cb40: 64 65 66 20 69 6e 74 09 28 54 63 6c 5f 44 72 69  def int.(Tcl_Dri
cb50: 76 65 72 47 65 74 4f 70 74 69 6f 6e 50 72 6f 63  verGetOptionProc
cb60: 29 20 28 43 6c 69 65 6e 74 44 61 74 61 20 69 6e  ) (ClientData in
cb70: 73 74 61 6e 63 65 44 61 74 61 2c 0a 09 09 09 54  stanceData,....T
cb80: 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72  cl_Interp *inter
cb90: 70 2c 20 43 4f 4e 53 54 38 34 20 63 68 61 72 20  p, CONST84 char 
cba0: 2a 6f 70 74 69 6f 6e 4e 61 6d 65 2c 0a 09 09 09  *optionName,....
cbb0: 54 63 6c 5f 44 53 74 72 69 6e 67 20 2a 64 73 50  Tcl_DString *dsP
cbc0: 74 72 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69  tr);.typedef voi
cbd0: 64 09 28 54 63 6c 5f 44 72 69 76 65 72 57 61 74  d.(Tcl_DriverWat
cbe0: 63 68 50 72 6f 63 29 20 28 43 6c 69 65 6e 74 44  chProc) (ClientD
cbf0: 61 74 61 20 69 6e 73 74 61 6e 63 65 44 61 74 61  ata instanceData
cc00: 2c 20 69 6e 74 20 6d 61 73 6b 29 3b 0a 74 79 70  , int mask);.typ
cc10: 65 64 65 66 20 69 6e 74 09 28 54 63 6c 5f 44 72  edef int.(Tcl_Dr
cc20: 69 76 65 72 47 65 74 48 61 6e 64 6c 65 50 72 6f  iverGetHandlePro
cc30: 63 29 20 28 43 6c 69 65 6e 74 44 61 74 61 20 69  c) (ClientData i
cc40: 6e 73 74 61 6e 63 65 44 61 74 61 2c 0a 09 09 09  nstanceData,....
cc50: 69 6e 74 20 64 69 72 65 63 74 69 6f 6e 2c 20 43  int direction, C
cc60: 6c 69 65 6e 74 44 61 74 61 20 2a 68 61 6e 64 6c  lientData *handl
cc70: 65 50 74 72 29 3b 0a 74 79 70 65 64 65 66 20 69  ePtr);.typedef i
cc80: 6e 74 09 28 54 63 6c 5f 44 72 69 76 65 72 46 6c  nt.(Tcl_DriverFl
cc90: 75 73 68 50 72 6f 63 29 20 28 43 6c 69 65 6e 74  ushProc) (Client
cca0: 44 61 74 61 20 69 6e 73 74 61 6e 63 65 44 61 74  Data instanceDat
ccb0: 61 29 3b 0a 74 79 70 65 64 65 66 20 69 6e 74 09  a);.typedef int.
ccc0: 28 54 63 6c 5f 44 72 69 76 65 72 48 61 6e 64 6c  (Tcl_DriverHandl
ccd0: 65 72 50 72 6f 63 29 20 28 43 6c 69 65 6e 74 44  erProc) (ClientD
cce0: 61 74 61 20 69 6e 73 74 61 6e 63 65 44 61 74 61  ata instanceData
ccf0: 2c 0a 09 09 09 69 6e 74 20 69 6e 74 65 72 65 73  ,....int interes
cd00: 74 4d 61 73 6b 29 3b 0a 74 79 70 65 64 65 66 20  tMask);.typedef 
cd10: 54 63 6c 5f 57 69 64 65 49 6e 74 20 28 54 63 6c  Tcl_WideInt (Tcl
cd20: 5f 44 72 69 76 65 72 57 69 64 65 53 65 65 6b 50  _DriverWideSeekP
cd30: 72 6f 63 29 20 28 43 6c 69 65 6e 74 44 61 74 61  roc) (ClientData
cd40: 20 69 6e 73 74 61 6e 63 65 44 61 74 61 2c 0a 09   instanceData,..
cd50: 09 09 54 63 6c 5f 57 69 64 65 49 6e 74 20 6f 66  ..Tcl_WideInt of
cd60: 66 73 65 74 2c 20 69 6e 74 20 6d 6f 64 65 2c 20  fset, int mode, 
cd70: 69 6e 74 20 2a 65 72 72 6f 72 43 6f 64 65 50 74  int *errorCodePt
cd80: 72 29 3b 0a 2f 2a 0a 20 2a 20 54 49 50 20 23 32  r);./*. * TIP #2
cd90: 31 38 2c 20 43 68 61 6e 6e 65 6c 20 54 68 72 65  18, Channel Thre
cda0: 61 64 20 41 63 74 69 6f 6e 73 0a 20 2a 2f 0a 74  ad Actions. */.t
cdb0: 79 70 65 64 65 66 20 76 6f 69 64 09 28 54 63 6c  ypedef void.(Tcl
cdc0: 5f 44 72 69 76 65 72 54 68 72 65 61 64 41 63 74  _DriverThreadAct
cdd0: 69 6f 6e 50 72 6f 63 29 20 28 43 6c 69 65 6e 74  ionProc) (Client
cde0: 44 61 74 61 20 69 6e 73 74 61 6e 63 65 44 61 74  Data instanceDat
cdf0: 61 2c 0a 09 09 09 69 6e 74 20 61 63 74 69 6f 6e  a,....int action
ce00: 29 3b 0a 2f 2a 0a 20 2a 20 54 49 50 20 23 32 30  );./*. * TIP #20
ce10: 38 2c 20 46 69 6c 65 20 54 72 75 6e 63 61 74 69  8, File Truncati
ce20: 6f 6e 20 28 65 74 63 2e 29 0a 20 2a 2f 0a 74 79  on (etc.). */.ty
ce30: 70 65 64 65 66 20 69 6e 74 09 28 54 63 6c 5f 44  pedef int.(Tcl_D
ce40: 72 69 76 65 72 54 72 75 6e 63 61 74 65 50 72 6f  riverTruncatePro
ce50: 63 29 20 28 43 6c 69 65 6e 74 44 61 74 61 20 69  c) (ClientData i
ce60: 6e 73 74 61 6e 63 65 44 61 74 61 2c 0a 09 09 09  nstanceData,....
ce70: 54 63 6c 5f 57 69 64 65 49 6e 74 20 6c 65 6e 67  Tcl_WideInt leng
ce80: 74 68 29 3b 0a 0a 2f 2a 0a 20 2a 20 73 74 72 75  th);../*. * stru
ce90: 63 74 20 54 63 6c 5f 43 68 61 6e 6e 65 6c 54 79  ct Tcl_ChannelTy
cea0: 70 65 3a 0a 20 2a 0a 20 2a 20 4f 6e 65 20 73 75  pe:. *. * One su
ceb0: 63 68 20 73 74 72 75 63 74 75 72 65 20 65 78 69  ch structure exi
cec0: 73 74 73 20 66 6f 72 20 65 61 63 68 20 74 79 70  sts for each typ
ced0: 65 20 28 6b 69 6e 64 29 20 6f 66 20 63 68 61 6e  e (kind) of chan
cee0: 6e 65 6c 2e 20 49 74 20 63 6f 6c 6c 65 63 74 73  nel. It collects
cef0: 0a 20 2a 20 74 6f 67 65 74 68 65 72 20 69 6e 20  . * together in 
cf00: 6f 6e 65 20 70 6c 61 63 65 20 61 6c 6c 20 74 68  one place all th
cf10: 65 20 66 75 6e 63 74 69 6f 6e 73 20 74 68 61 74  e functions that
cf20: 20 61 72 65 20 70 61 72 74 20 6f 66 20 74 68 65   are part of the
cf30: 20 73 70 65 63 69 66 69 63 0a 20 2a 20 63 68 61   specific. * cha
cf40: 6e 6e 65 6c 20 74 79 70 65 2e 0a 20 2a 0a 20 2a  nnel type.. *. *
cf50: 20 49 74 20 69 73 20 72 65 63 6f 6d 6d 65 6e 64   It is recommend
cf60: 20 74 68 61 74 20 74 68 65 20 54 63 6c 5f 43 68   that the Tcl_Ch
cf70: 61 6e 6e 65 6c 2a 20 66 75 6e 63 74 69 6f 6e 73  annel* functions
cf80: 20 61 72 65 20 75 73 65 64 20 74 6f 20 61 63 63   are used to acc
cf90: 65 73 73 20 65 6c 65 6d 65 6e 74 73 0a 20 2a 20  ess elements. * 
cfa0: 6f 66 20 74 68 69 73 20 73 74 72 75 63 74 75 72  of this structur
cfb0: 65 2c 20 69 6e 73 74 65 61 64 20 6f 66 20 64 69  e, instead of di
cfc0: 72 65 63 74 20 61 63 63 65 73 73 69 6e 67 2e 0a  rect accessing..
cfd0: 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 73 74 72   */..typedef str
cfe0: 75 63 74 20 54 63 6c 5f 43 68 61 6e 6e 65 6c 54  uct Tcl_ChannelT
cff0: 79 70 65 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20  ype {.    const 
d000: 63 68 61 72 20 2a 74 79 70 65 4e 61 6d 65 3b 09  char *typeName;.
d010: 2f 2a 20 54 68 65 20 6e 61 6d 65 20 6f 66 20 74  /* The name of t
d020: 68 65 20 63 68 61 6e 6e 65 6c 20 74 79 70 65 20  he channel type 
d030: 69 6e 20 54 63 6c 0a 09 09 09 09 20 2a 20 63 6f  in Tcl..... * co
d040: 6d 6d 61 6e 64 73 2e 20 54 68 69 73 20 73 74 6f  mmands. This sto
d050: 72 61 67 65 20 69 73 20 6f 77 6e 65 64 20 62 79  rage is owned by
d060: 20 63 68 61 6e 6e 65 6c 0a 09 09 09 09 20 2a 20   channel..... * 
d070: 74 79 70 65 2e 20 2a 2f 0a 20 20 20 20 54 63 6c  type. */.    Tcl
d080: 5f 43 68 61 6e 6e 65 6c 54 79 70 65 56 65 72 73  _ChannelTypeVers
d090: 69 6f 6e 20 76 65 72 73 69 6f 6e 3b 0a 09 09 09  ion version;....
d0a0: 09 2f 2a 20 56 65 72 73 69 6f 6e 20 6f 66 20 74  ./* Version of t
d0b0: 68 65 20 63 68 61 6e 6e 65 6c 20 74 79 70 65 2e  he channel type.
d0c0: 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 44 72 69 76   */.    Tcl_Driv
d0d0: 65 72 43 6c 6f 73 65 50 72 6f 63 20 2a 63 6c 6f  erCloseProc *clo
d0e0: 73 65 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 46  seProc;...../* F
d0f0: 75 6e 63 74 69 6f 6e 20 74 6f 20 63 61 6c 6c 20  unction to call 
d100: 74 6f 20 63 6c 6f 73 65 20 74 68 65 20 63 68 61  to close the cha
d110: 6e 6e 65 6c 2c 20 6f 72 0a 09 09 09 09 20 2a 20  nnel, or..... * 
d120: 54 43 4c 5f 43 4c 4f 53 45 32 50 52 4f 43 20 69  TCL_CLOSE2PROC i
d130: 66 20 74 68 65 20 63 6c 6f 73 65 32 50 72 6f 63  f the close2Proc
d140: 20 73 68 6f 75 6c 64 20 62 65 0a 09 09 09 09 20   should be..... 
d150: 2a 20 75 73 65 64 20 69 6e 73 74 65 61 64 2e 20  * used instead. 
d160: 2a 2f 0a 20 20 20 20 54 63 6c 5f 44 72 69 76 65  */.    Tcl_Drive
d170: 72 49 6e 70 75 74 50 72 6f 63 20 2a 69 6e 70 75  rInputProc *inpu
d180: 74 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 46 75  tProc;...../* Fu
d190: 6e 63 74 69 6f 6e 20 74 6f 20 63 61 6c 6c 20 66  nction to call f
d1a0: 6f 72 20 69 6e 70 75 74 20 6f 6e 20 63 68 61 6e  or input on chan
d1b0: 6e 65 6c 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f  nel. */.    Tcl_
d1c0: 44 72 69 76 65 72 4f 75 74 70 75 74 50 72 6f 63  DriverOutputProc
d1d0: 20 2a 6f 75 74 70 75 74 50 72 6f 63 3b 0a 09 09   *outputProc;...
d1e0: 09 09 2f 2a 20 46 75 6e 63 74 69 6f 6e 20 74 6f  ../* Function to
d1f0: 20 63 61 6c 6c 20 66 6f 72 20 6f 75 74 70 75 74   call for output
d200: 20 6f 6e 20 63 68 61 6e 6e 65 6c 2e 20 2a 2f 0a   on channel. */.
d210: 20 20 20 20 54 63 6c 5f 44 72 69 76 65 72 53 65      Tcl_DriverSe
d220: 65 6b 50 72 6f 63 20 2a 73 65 65 6b 50 72 6f 63  ekProc *seekProc
d230: 3b 0a 09 09 09 09 2f 2a 20 46 75 6e 63 74 69 6f  ;...../* Functio
d240: 6e 20 74 6f 20 63 61 6c 6c 20 74 6f 20 73 65 65  n to call to see
d250: 6b 20 6f 6e 20 74 68 65 20 63 68 61 6e 6e 65 6c  k on the channel
d260: 2e 0a 09 09 09 09 20 2a 20 4d 61 79 20 62 65 20  ...... * May be 
d270: 4e 55 4c 4c 2e 20 2a 2f 0a 20 20 20 20 54 63 6c  NULL. */.    Tcl
d280: 5f 44 72 69 76 65 72 53 65 74 4f 70 74 69 6f 6e  _DriverSetOption
d290: 50 72 6f 63 20 2a 73 65 74 4f 70 74 69 6f 6e 50  Proc *setOptionP
d2a0: 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 53 65 74 20  roc;...../* Set 
d2b0: 61 6e 20 6f 70 74 69 6f 6e 20 6f 6e 20 61 20 63  an option on a c
d2c0: 68 61 6e 6e 65 6c 2e 20 2a 2f 0a 20 20 20 20 54  hannel. */.    T
d2d0: 63 6c 5f 44 72 69 76 65 72 47 65 74 4f 70 74 69  cl_DriverGetOpti
d2e0: 6f 6e 50 72 6f 63 20 2a 67 65 74 4f 70 74 69 6f  onProc *getOptio
d2f0: 6e 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 47 65  nProc;...../* Ge
d300: 74 20 61 6e 20 6f 70 74 69 6f 6e 20 66 72 6f 6d  t an option from
d310: 20 61 20 63 68 61 6e 6e 65 6c 2e 20 2a 2f 0a 20   a channel. */. 
d320: 20 20 20 54 63 6c 5f 44 72 69 76 65 72 57 61 74     Tcl_DriverWat
d330: 63 68 50 72 6f 63 20 2a 77 61 74 63 68 50 72 6f  chProc *watchPro
d340: 63 3b 0a 09 09 09 09 2f 2a 20 53 65 74 20 75 70  c;...../* Set up
d350: 20 74 68 65 20 6e 6f 74 69 66 69 65 72 20 74 6f   the notifier to
d360: 20 77 61 74 63 68 20 66 6f 72 20 65 76 65 6e 74   watch for event
d370: 73 20 6f 6e 0a 09 09 09 09 20 2a 20 74 68 69 73  s on..... * this
d380: 20 63 68 61 6e 6e 65 6c 2e 20 2a 2f 0a 20 20 20   channel. */.   
d390: 20 54 63 6c 5f 44 72 69 76 65 72 47 65 74 48 61   Tcl_DriverGetHa
d3a0: 6e 64 6c 65 50 72 6f 63 20 2a 67 65 74 48 61 6e  ndleProc *getHan
d3b0: 64 6c 65 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20  dleProc;...../* 
d3c0: 47 65 74 20 61 6e 20 4f 53 20 68 61 6e 64 6c 65  Get an OS handle
d3d0: 20 66 72 6f 6d 20 74 68 65 20 63 68 61 6e 6e 65   from the channe
d3e0: 6c 20 6f 72 20 4e 55 4c 4c 0a 09 09 09 09 20 2a  l or NULL..... *
d3f0: 20 69 66 20 6e 6f 74 20 73 75 70 70 6f 72 74 65   if not supporte
d400: 64 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 44 72  d. */.    Tcl_Dr
d410: 69 76 65 72 43 6c 6f 73 65 32 50 72 6f 63 20 2a  iverClose2Proc *
d420: 63 6c 6f 73 65 32 50 72 6f 63 3b 0a 09 09 09 09  close2Proc;.....
d430: 2f 2a 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 63  /* Function to c
d440: 61 6c 6c 20 74 6f 20 63 6c 6f 73 65 20 74 68 65  all to close the
d450: 20 63 68 61 6e 6e 65 6c 20 69 66 0a 09 09 09 09   channel if.....
d460: 20 2a 20 74 68 65 20 64 65 76 69 63 65 20 73 75   * the device su
d470: 70 70 6f 72 74 73 20 63 6c 6f 73 69 6e 67 20 74  pports closing t
d480: 68 65 20 72 65 61 64 20 26 0a 09 09 09 09 20 2a  he read &..... *
d490: 20 77 72 69 74 65 20 73 69 64 65 73 20 69 6e 64   write sides ind
d4a0: 65 70 65 6e 64 65 6e 74 6c 79 2e 20 2a 2f 0a 20  ependently. */. 
d4b0: 20 20 20 54 63 6c 5f 44 72 69 76 65 72 42 6c 6f     Tcl_DriverBlo
d4c0: 63 6b 4d 6f 64 65 50 72 6f 63 20 2a 62 6c 6f 63  ckModeProc *bloc
d4d0: 6b 4d 6f 64 65 50 72 6f 63 3b 0a 09 09 09 09 2f  kModeProc;...../
d4e0: 2a 20 53 65 74 20 62 6c 6f 63 6b 69 6e 67 20 6d  * Set blocking m
d4f0: 6f 64 65 20 66 6f 72 20 74 68 65 20 72 61 77 20  ode for the raw 
d500: 63 68 61 6e 6e 65 6c 2e 20 4d 61 79 0a 09 09 09  channel. May....
d510: 09 20 2a 20 62 65 20 4e 55 4c 4c 2e 20 2a 2f 0a  . * be NULL. */.
d520: 20 20 20 20 2f 2a 0a 20 20 20 20 20 2a 20 4f 6e      /*.     * On
d530: 6c 79 20 76 61 6c 69 64 20 69 6e 20 54 43 4c 5f  ly valid in TCL_
d540: 43 48 41 4e 4e 45 4c 5f 56 45 52 53 49 4f 4e 5f  CHANNEL_VERSION_
d550: 32 20 63 68 61 6e 6e 65 6c 73 20 6f 72 20 6c 61  2 channels or la
d560: 74 65 72 2e 0a 20 20 20 20 20 2a 2f 0a 20 20 20  ter..     */.   
d570: 20 54 63 6c 5f 44 72 69 76 65 72 46 6c 75 73 68   Tcl_DriverFlush
d580: 50 72 6f 63 20 2a 66 6c 75 73 68 50 72 6f 63 3b  Proc *flushProc;
d590: 0a 09 09 09 09 2f 2a 20 46 75 6e 63 74 69 6f 6e  ...../* Function
d5a0: 20 74 6f 20 63 61 6c 6c 20 74 6f 20 66 6c 75 73   to call to flus
d5b0: 68 20 61 20 63 68 61 6e 6e 65 6c 2e 20 4d 61 79  h a channel. May
d5c0: 20 62 65 0a 09 09 09 09 20 2a 20 4e 55 4c 4c 2e   be..... * NULL.
d5d0: 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 44 72 69 76   */.    Tcl_Driv
d5e0: 65 72 48 61 6e 64 6c 65 72 50 72 6f 63 20 2a 68  erHandlerProc *h
d5f0: 61 6e 64 6c 65 72 50 72 6f 63 3b 0a 09 09 09 09  andlerProc;.....
d600: 2f 2a 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 63  /* Function to c
d610: 61 6c 6c 20 74 6f 20 68 61 6e 64 6c 65 20 61 20  all to handle a 
d620: 63 68 61 6e 6e 65 6c 20 65 76 65 6e 74 2e 0a 09  channel event...
d630: 09 09 09 20 2a 20 54 68 69 73 20 77 69 6c 6c 20  ... * This will 
d640: 62 65 20 70 61 73 73 65 64 20 75 70 20 74 68 65  be passed up the
d650: 20 73 74 61 63 6b 65 64 20 63 68 61 6e 6e 65 6c   stacked channel
d660: 0a 09 09 09 09 20 2a 20 63 68 61 69 6e 2e 20 2a  ..... * chain. *
d670: 2f 0a 20 20 20 20 2f 2a 0a 20 20 20 20 20 2a 20  /.    /*.     * 
d680: 4f 6e 6c 79 20 76 61 6c 69 64 20 69 6e 20 54 43  Only valid in TC
d690: 4c 5f 43 48 41 4e 4e 45 4c 5f 56 45 52 53 49 4f  L_CHANNEL_VERSIO
d6a0: 4e 5f 33 20 63 68 61 6e 6e 65 6c 73 20 6f 72 20  N_3 channels or 
d6b0: 6c 61 74 65 72 2e 0a 20 20 20 20 20 2a 2f 0a 20  later..     */. 
d6c0: 20 20 20 54 63 6c 5f 44 72 69 76 65 72 57 69 64     Tcl_DriverWid
d6d0: 65 53 65 65 6b 50 72 6f 63 20 2a 77 69 64 65 53  eSeekProc *wideS
d6e0: 65 65 6b 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20  eekProc;...../* 
d6f0: 46 75 6e 63 74 69 6f 6e 20 74 6f 20 63 61 6c 6c  Function to call
d700: 20 74 6f 20 73 65 65 6b 20 6f 6e 20 74 68 65 20   to seek on the 
d710: 63 68 61 6e 6e 65 6c 0a 09 09 09 09 20 2a 20 77  channel..... * w
d720: 68 69 63 68 20 63 61 6e 20 68 61 6e 64 6c 65 20  hich can handle 
d730: 36 34 2d 62 69 74 20 6f 66 66 73 65 74 73 2e 20  64-bit offsets. 
d740: 4d 61 79 20 62 65 0a 09 09 09 09 20 2a 20 4e 55  May be..... * NU
d750: 4c 4c 2c 20 61 6e 64 20 6d 75 73 74 20 62 65 20  LL, and must be 
d760: 4e 55 4c 4c 20 69 66 20 73 65 65 6b 50 72 6f 63  NULL if seekProc
d770: 20 69 73 0a 09 09 09 09 20 2a 20 4e 55 4c 4c 2e   is..... * NULL.
d780: 20 2a 2f 0a 20 20 20 20 2f 2a 0a 20 20 20 20 20   */.    /*.     
d790: 2a 20 4f 6e 6c 79 20 76 61 6c 69 64 20 69 6e 20  * Only valid in 
d7a0: 54 43 4c 5f 43 48 41 4e 4e 45 4c 5f 56 45 52 53  TCL_CHANNEL_VERS
d7b0: 49 4f 4e 5f 34 20 63 68 61 6e 6e 65 6c 73 20 6f  ION_4 channels o
d7c0: 72 20 6c 61 74 65 72 2e 0a 20 20 20 20 20 2a 20  r later..     * 
d7d0: 54 49 50 20 23 32 31 38 2c 20 43 68 61 6e 6e 65  TIP #218, Channe
d7e0: 6c 20 54 68 72 65 61 64 20 41 63 74 69 6f 6e 73  l Thread Actions
d7f0: 2e 0a 20 20 20 20 20 2a 2f 0a 20 20 20 20 54 63  ..     */.    Tc
d800: 6c 5f 44 72 69 76 65 72 54 68 72 65 61 64 41 63  l_DriverThreadAc
d810: 74 69 6f 6e 50 72 6f 63 20 2a 74 68 72 65 61 64  tionProc *thread
d820: 41 63 74 69 6f 6e 50 72 6f 63 3b 0a 09 09 09 09  ActionProc;.....
d830: 2f 2a 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 63  /* Function to c
d840: 61 6c 6c 20 74 6f 20 6e 6f 74 69 66 79 20 74 68  all to notify th
d850: 65 20 64 72 69 76 65 72 20 6f 66 0a 09 09 09 09  e driver of.....
d860: 20 2a 20 74 68 72 65 61 64 20 73 70 65 63 69 66   * thread specif
d870: 69 63 20 61 63 74 69 76 69 74 79 20 66 6f 72 20  ic activity for 
d880: 61 20 63 68 61 6e 6e 65 6c 2e 20 4d 61 79 0a 09  a channel. May..
d890: 09 09 09 20 2a 20 62 65 20 4e 55 4c 4c 2e 20 2a  ... * be NULL. *
d8a0: 2f 0a 20 20 20 20 2f 2a 0a 20 20 20 20 20 2a 20  /.    /*.     * 
d8b0: 4f 6e 6c 79 20 76 61 6c 69 64 20 69 6e 20 54 43  Only valid in TC
d8c0: 4c 5f 43 48 41 4e 4e 45 4c 5f 56 45 52 53 49 4f  L_CHANNEL_VERSIO
d8d0: 4e 5f 35 20 63 68 61 6e 6e 65 6c 73 20 6f 72 20  N_5 channels or 
d8e0: 6c 61 74 65 72 2e 0a 20 20 20 20 20 2a 20 54 49  later..     * TI
d8f0: 50 20 23 32 30 38 2c 20 46 69 6c 65 20 54 72 75  P #208, File Tru
d900: 6e 63 61 74 69 6f 6e 2e 0a 20 20 20 20 20 2a 2f  ncation..     */
d910: 0a 20 20 20 20 54 63 6c 5f 44 72 69 76 65 72 54  .    Tcl_DriverT
d920: 72 75 6e 63 61 74 65 50 72 6f 63 20 2a 74 72 75  runcateProc *tru
d930: 6e 63 61 74 65 50 72 6f 63 3b 0a 09 09 09 09 2f  ncateProc;...../
d940: 2a 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 63 61  * Function to ca
d950: 6c 6c 20 74 6f 20 74 72 75 6e 63 61 74 65 20 74  ll to truncate t
d960: 68 65 20 75 6e 64 65 72 6c 79 69 6e 67 0a 09 09  he underlying...
d970: 09 09 20 2a 20 66 69 6c 65 20 74 6f 20 61 20 70  .. * file to a p
d980: 61 72 74 69 63 75 6c 61 72 20 6c 65 6e 67 74 68  articular length
d990: 2e 20 4d 61 79 20 62 65 20 4e 55 4c 4c 20 69 66  . May be NULL if
d9a0: 0a 09 09 09 09 20 2a 20 74 68 65 20 63 68 61 6e  ..... * the chan
d9b0: 6e 65 6c 20 64 6f 65 73 20 6e 6f 74 20 73 75 70  nel does not sup
d9c0: 70 6f 72 74 20 74 72 75 6e 63 61 74 69 6f 6e 2e  port truncation.
d9d0: 20 2a 2f 0a 7d 20 54 63 6c 5f 43 68 61 6e 6e 65   */.} Tcl_Channe
d9e0: 6c 54 79 70 65 3b 0a 0a 2f 2a 0a 20 2a 20 54 68  lType;../*. * Th
d9f0: 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 66 6c 61 67  e following flag
da00: 73 20 64 65 74 65 72 6d 69 6e 65 20 77 68 65 74  s determine whet
da10: 68 65 72 20 74 68 65 20 62 6c 6f 63 6b 4d 6f 64  her the blockMod
da20: 65 50 72 6f 63 20 61 62 6f 76 65 20 73 68 6f 75  eProc above shou
da30: 6c 64 20 73 65 74 0a 20 2a 20 74 68 65 20 63 68  ld set. * the ch
da40: 61 6e 6e 65 6c 20 69 6e 74 6f 20 62 6c 6f 63 6b  annel into block
da50: 69 6e 67 20 6f 72 20 6e 6f 6e 62 6c 6f 63 6b 69  ing or nonblocki
da60: 6e 67 20 6d 6f 64 65 2e 20 54 68 65 79 20 61 72  ng mode. They ar
da70: 65 20 70 61 73 73 65 64 20 61 73 20 61 72 67 75  e passed as argu
da80: 6d 65 6e 74 73 0a 20 2a 20 74 6f 20 74 68 65 20  ments. * to the 
da90: 62 6c 6f 63 6b 4d 6f 64 65 50 72 6f 63 20 66 75  blockModeProc fu
daa0: 6e 63 74 69 6f 6e 20 69 6e 20 74 68 65 20 61 62  nction in the ab
dab0: 6f 76 65 20 73 74 72 75 63 74 75 72 65 2e 0a 20  ove structure.. 
dac0: 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f  */..#define TCL_
dad0: 4d 4f 44 45 5f 42 4c 4f 43 4b 49 4e 47 09 30 09  MODE_BLOCKING.0.
dae0: 2f 2a 20 50 75 74 20 63 68 61 6e 6e 65 6c 20 69  /* Put channel i
daf0: 6e 74 6f 20 62 6c 6f 63 6b 69 6e 67 20 6d 6f 64  nto blocking mod
db00: 65 2e 20 2a 2f 0a 23 64 65 66 69 6e 65 20 54 43  e. */.#define TC
db10: 4c 5f 4d 4f 44 45 5f 4e 4f 4e 42 4c 4f 43 4b 49  L_MODE_NONBLOCKI
db20: 4e 47 09 31 09 2f 2a 20 50 75 74 20 63 68 61 6e  NG.1./* Put chan
db30: 6e 65 6c 20 69 6e 74 6f 20 6e 6f 6e 62 6c 6f 63  nel into nonbloc
db40: 6b 69 6e 67 0a 09 09 09 09 09 20 2a 20 6d 6f 64  king...... * mod
db50: 65 2e 20 2a 2f 0a 0a 2f 2a 0a 20 2a 2d 2d 2d 2d  e. */../*. *----
db60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
db70: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
db80: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
db90: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
dba0: 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 45 6e 75 6d  --------. * Enum
dbb0: 20 66 6f 72 20 64 69 66 66 65 72 65 6e 74 20 74   for different t
dbc0: 79 70 65 73 20 6f 66 20 66 69 6c 65 20 70 61 74  ypes of file pat
dbd0: 68 73 2e 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 66  hs.. */..typedef
dbe0: 20 65 6e 75 6d 20 54 63 6c 5f 50 61 74 68 54 79   enum Tcl_PathTy
dbf0: 70 65 20 7b 0a 20 20 20 20 54 43 4c 5f 50 41 54  pe {.    TCL_PAT
dc00: 48 5f 41 42 53 4f 4c 55 54 45 2c 0a 20 20 20 20  H_ABSOLUTE,.    
dc10: 54 43 4c 5f 50 41 54 48 5f 52 45 4c 41 54 49 56  TCL_PATH_RELATIV
dc20: 45 2c 0a 20 20 20 20 54 43 4c 5f 50 41 54 48 5f  E,.    TCL_PATH_
dc30: 56 4f 4c 55 4d 45 5f 52 45 4c 41 54 49 56 45 0a  VOLUME_RELATIVE.
dc40: 7d 20 54 63 6c 5f 50 61 74 68 54 79 70 65 3b 0a  } Tcl_PathType;.
dc50: 0a 2f 2a 0a 20 2a 20 54 68 65 20 66 6f 6c 6c 6f  ./*. * The follo
dc60: 77 69 6e 67 20 73 74 72 75 63 74 75 72 65 20 69  wing structure i
dc70: 73 20 75 73 65 64 20 74 6f 20 70 61 73 73 20 67  s used to pass g
dc80: 6c 6f 62 20 74 79 70 65 20 64 61 74 61 20 61 6d  lob type data am
dc90: 6f 6e 67 73 74 20 74 68 65 20 76 61 72 69 6f 75  ongst the variou
dca0: 73 0a 20 2a 20 67 6c 6f 62 20 72 6f 75 74 69 6e  s. * glob routin
dcb0: 65 73 20 61 6e 64 20 54 63 6c 5f 46 53 4d 61 74  es and Tcl_FSMat
dcc0: 63 68 49 6e 44 69 72 65 63 74 6f 72 79 2e 0a 20  chInDirectory.. 
dcd0: 2a 2f 0a 0a 74 79 70 65 64 65 66 20 73 74 72 75  */..typedef stru
dce0: 63 74 20 54 63 6c 5f 47 6c 6f 62 54 79 70 65 44  ct Tcl_GlobTypeD
dcf0: 61 74 61 20 7b 0a 20 20 20 20 69 6e 74 20 74 79  ata {.    int ty
dd00: 70 65 3b 09 09 09 2f 2a 20 43 6f 72 72 65 73 70  pe;.../* Corresp
dd10: 6f 6e 64 73 20 74 6f 20 62 63 64 70 66 6c 73 20  onds to bcdpfls 
dd20: 61 73 20 69 6e 20 27 66 69 6e 64 20 2d 74 27 2e  as in 'find -t'.
dd30: 20 2a 2f 0a 20 20 20 20 69 6e 74 20 70 65 72 6d   */.    int perm
dd40: 3b 09 09 09 2f 2a 20 43 6f 72 72 65 73 70 6f 6e  ;.../* Correspon
dd50: 64 73 20 74 6f 20 66 69 6c 65 20 70 65 72 6d 69  ds to file permi
dd60: 73 73 69 6f 6e 73 2e 20 2a 2f 0a 20 20 20 20 54  ssions. */.    T
dd70: 63 6c 5f 4f 62 6a 20 2a 6d 61 63 54 79 70 65 3b  cl_Obj *macType;
dd80: 09 09 2f 2a 20 41 63 63 65 70 74 61 62 6c 65 20  ../* Acceptable 
dd90: 4d 61 63 20 74 79 70 65 2e 20 2a 2f 0a 20 20 20  Mac type. */.   
dda0: 20 54 63 6c 5f 4f 62 6a 20 2a 6d 61 63 43 72 65   Tcl_Obj *macCre
ddb0: 61 74 6f 72 3b 09 2f 2a 20 41 63 63 65 70 74 61  ator;./* Accepta
ddc0: 62 6c 65 20 4d 61 63 20 63 72 65 61 74 6f 72 2e  ble Mac creator.
ddd0: 20 2a 2f 0a 7d 20 54 63 6c 5f 47 6c 6f 62 54 79   */.} Tcl_GlobTy
dde0: 70 65 44 61 74 61 3b 0a 0a 2f 2a 0a 20 2a 20 54  peData;../*. * T
ddf0: 79 70 65 20 61 6e 64 20 70 65 72 6d 69 73 73 69  ype and permissi
de00: 6f 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 66  on definitions f
de10: 6f 72 20 67 6c 6f 62 20 63 6f 6d 6d 61 6e 64 2e  or glob command.
de20: 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43  . */..#define TC
de30: 4c 5f 47 4c 4f 42 5f 54 59 50 45 5f 42 4c 4f 43  L_GLOB_TYPE_BLOC
de40: 4b 09 09 28 31 3c 3c 30 29 0a 23 64 65 66 69 6e  K..(1<<0).#defin
de50: 65 20 54 43 4c 5f 47 4c 4f 42 5f 54 59 50 45 5f  e TCL_GLOB_TYPE_
de60: 43 48 41 52 09 09 28 31 3c 3c 31 29 0a 23 64 65  CHAR..(1<<1).#de
de70: 66 69 6e 65 20 54 43 4c 5f 47 4c 4f 42 5f 54 59  fine TCL_GLOB_TY
de80: 50 45 5f 44 49 52 09 09 28 31 3c 3c 32 29 0a 23  PE_DIR..(1<<2).#
de90: 64 65 66 69 6e 65 20 54 43 4c 5f 47 4c 4f 42 5f  define TCL_GLOB_
dea0: 54 59 50 45 5f 50 49 50 45 09 09 28 31 3c 3c 33  TYPE_PIPE..(1<<3
deb0: 29 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 47 4c  ).#define TCL_GL
dec0: 4f 42 5f 54 59 50 45 5f 46 49 4c 45 09 09 28 31  OB_TYPE_FILE..(1
ded0: 3c 3c 34 29 0a 23 64 65 66 69 6e 65 20 54 43 4c  <<4).#define TCL
dee0: 5f 47 4c 4f 42 5f 54 59 50 45 5f 4c 49 4e 4b 09  _GLOB_TYPE_LINK.
def0: 09 28 31 3c 3c 35 29 0a 23 64 65 66 69 6e 65 20  .(1<<5).#define 
df00: 54 43 4c 5f 47 4c 4f 42 5f 54 59 50 45 5f 53 4f  TCL_GLOB_TYPE_SO
df10: 43 4b 09 09 28 31 3c 3c 36 29 0a 23 64 65 66 69  CK..(1<<6).#defi
df20: 6e 65 20 54 43 4c 5f 47 4c 4f 42 5f 54 59 50 45  ne TCL_GLOB_TYPE
df30: 5f 4d 4f 55 4e 54 09 09 28 31 3c 3c 37 29 0a 0a  _MOUNT..(1<<7)..
df40: 23 64 65 66 69 6e 65 20 54 43 4c 5f 47 4c 4f 42  #define TCL_GLOB
df50: 5f 50 45 52 4d 5f 52 4f 4e 4c 59 09 09 28 31 3c  _PERM_RONLY..(1<
df60: 3c 30 29 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f  <0).#define TCL_
df70: 47 4c 4f 42 5f 50 45 52 4d 5f 48 49 44 44 45 4e  GLOB_PERM_HIDDEN
df80: 09 09 28 31 3c 3c 31 29 0a 23 64 65 66 69 6e 65  ..(1<<1).#define
df90: 20 54 43 4c 5f 47 4c 4f 42 5f 50 45 52 4d 5f 52   TCL_GLOB_PERM_R
dfa0: 09 09 09 28 31 3c 3c 32 29 0a 23 64 65 66 69 6e  ...(1<<2).#defin
dfb0: 65 20 54 43 4c 5f 47 4c 4f 42 5f 50 45 52 4d 5f  e TCL_GLOB_PERM_
dfc0: 57 09 09 09 28 31 3c 3c 33 29 0a 23 64 65 66 69  W...(1<<3).#defi
dfd0: 6e 65 20 54 43 4c 5f 47 4c 4f 42 5f 50 45 52 4d  ne TCL_GLOB_PERM
dfe0: 5f 58 09 09 09 28 31 3c 3c 34 29 0a 0a 2f 2a 0a  _X...(1<<4)../*.
dff0: 20 2a 20 46 6c 61 67 73 20 66 6f 72 20 74 68 65   * Flags for the
e000: 20 75 6e 6c 6f 61 64 20 63 61 6c 6c 62 61 63 6b   unload callback
e010: 20 66 75 6e 63 74 69 6f 6e 2e 0a 20 2a 2f 0a 0a   function.. */..
e020: 23 64 65 66 69 6e 65 20 54 43 4c 5f 55 4e 4c 4f  #define TCL_UNLO
e030: 41 44 5f 44 45 54 41 43 48 5f 46 52 4f 4d 5f 49  AD_DETACH_FROM_I
e040: 4e 54 45 52 50 52 45 54 45 52 09 28 31 3c 3c 30  NTERPRETER.(1<<0
e050: 29 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 55 4e  ).#define TCL_UN
e060: 4c 4f 41 44 5f 44 45 54 41 43 48 5f 46 52 4f 4d  LOAD_DETACH_FROM
e070: 5f 50 52 4f 43 45 53 53 09 09 28 31 3c 3c 31 29  _PROCESS..(1<<1)
e080: 0a 0a 2f 2a 0a 20 2a 20 54 79 70 65 64 65 66 73  ../*. * Typedefs
e090: 20 66 6f 72 20 74 68 65 20 76 61 72 69 6f 75 73   for the various
e0a0: 20 66 69 6c 65 73 79 73 74 65 6d 20 6f 70 65 72   filesystem oper
e0b0: 61 74 69 6f 6e 73 3a 0a 20 2a 2f 0a 0a 74 79 70  ations:. */..typ
e0c0: 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 46 53  edef int (Tcl_FS
e0d0: 53 74 61 74 50 72 6f 63 29 20 28 54 63 6c 5f 4f  StatProc) (Tcl_O
e0e0: 62 6a 20 2a 70 61 74 68 50 74 72 2c 20 54 63 6c  bj *pathPtr, Tcl
e0f0: 5f 53 74 61 74 42 75 66 20 2a 62 75 66 29 3b 0a  _StatBuf *buf);.
e100: 74 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c  typedef int (Tcl
e110: 5f 46 53 41 63 63 65 73 73 50 72 6f 63 29 20 28  _FSAccessProc) (
e120: 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68 50 74 72  Tcl_Obj *pathPtr
e130: 2c 20 69 6e 74 20 6d 6f 64 65 29 3b 0a 74 79 70  , int mode);.typ
e140: 65 64 65 66 20 54 63 6c 5f 43 68 61 6e 6e 65 6c  edef Tcl_Channel
e150: 20 28 54 63 6c 5f 46 53 4f 70 65 6e 46 69 6c 65   (Tcl_FSOpenFile
e160: 43 68 61 6e 6e 65 6c 50 72 6f 63 29 20 28 54 63  ChannelProc) (Tc
e170: 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70  l_Interp *interp
e180: 2c 0a 09 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68  ,..Tcl_Obj *path
e190: 50 74 72 2c 20 69 6e 74 20 6d 6f 64 65 2c 20 69  Ptr, int mode, i
e1a0: 6e 74 20 70 65 72 6d 69 73 73 69 6f 6e 73 29 3b  nt permissions);
e1b0: 0a 74 79 70 65 64 65 66 20 69 6e 74 20 28 54 63  .typedef int (Tc
e1c0: 6c 5f 46 53 4d 61 74 63 68 49 6e 44 69 72 65 63  l_FSMatchInDirec
e1d0: 74 6f 72 79 50 72 6f 63 29 20 28 54 63 6c 5f 49  toryProc) (Tcl_I
e1e0: 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c 20 54  nterp *interp, T
e1f0: 63 6c 5f 4f 62 6a 20 2a 72 65 73 75 6c 74 2c 0a  cl_Obj *result,.
e200: 09 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68 50 74  .Tcl_Obj *pathPt
e210: 72 2c 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 70  r, const char *p
e220: 61 74 74 65 72 6e 2c 20 54 63 6c 5f 47 6c 6f 62  attern, Tcl_Glob
e230: 54 79 70 65 44 61 74 61 20 2a 74 79 70 65 73 29  TypeData *types)
e240: 3b 0a 74 79 70 65 64 65 66 20 54 63 6c 5f 4f 62  ;.typedef Tcl_Ob
e250: 6a 20 2a 20 28 54 63 6c 5f 46 53 47 65 74 43 77  j * (Tcl_FSGetCw
e260: 64 50 72 6f 63 29 20 28 54 63 6c 5f 49 6e 74 65  dProc) (Tcl_Inte
e270: 72 70 20 2a 69 6e 74 65 72 70 29 3b 0a 74 79 70  rp *interp);.typ
e280: 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 46 53  edef int (Tcl_FS
e290: 43 68 64 69 72 50 72 6f 63 29 20 28 54 63 6c 5f  ChdirProc) (Tcl_
e2a0: 4f 62 6a 20 2a 70 61 74 68 50 74 72 29 3b 0a 74  Obj *pathPtr);.t
e2b0: 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f  ypedef int (Tcl_
e2c0: 46 53 4c 73 74 61 74 50 72 6f 63 29 20 28 54 63  FSLstatProc) (Tc
e2d0: 6c 5f 4f 62 6a 20 2a 70 61 74 68 50 74 72 2c 20  l_Obj *pathPtr, 
e2e0: 54 63 6c 5f 53 74 61 74 42 75 66 20 2a 62 75 66  Tcl_StatBuf *buf
e2f0: 29 3b 0a 74 79 70 65 64 65 66 20 69 6e 74 20 28  );.typedef int (
e300: 54 63 6c 5f 46 53 43 72 65 61 74 65 44 69 72 65  Tcl_FSCreateDire
e310: 63 74 6f 72 79 50 72 6f 63 29 20 28 54 63 6c 5f  ctoryProc) (Tcl_
e320: 4f 62 6a 20 2a 70 61 74 68 50 74 72 29 3b 0a 74  Obj *pathPtr);.t
e330: 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f  ypedef int (Tcl_
e340: 46 53 44 65 6c 65 74 65 46 69 6c 65 50 72 6f 63  FSDeleteFileProc
e350: 29 20 28 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68  ) (Tcl_Obj *path
e360: 50 74 72 29 3b 0a 74 79 70 65 64 65 66 20 69 6e  Ptr);.typedef in
e370: 74 20 28 54 63 6c 5f 46 53 43 6f 70 79 44 69 72  t (Tcl_FSCopyDir
e380: 65 63 74 6f 72 79 50 72 6f 63 29 20 28 54 63 6c  ectoryProc) (Tcl
e390: 5f 4f 62 6a 20 2a 73 72 63 50 61 74 68 50 74 72  _Obj *srcPathPtr
e3a0: 2c 0a 09 54 63 6c 5f 4f 62 6a 20 2a 64 65 73 74  ,..Tcl_Obj *dest
e3b0: 50 61 74 68 50 74 72 2c 20 54 63 6c 5f 4f 62 6a  PathPtr, Tcl_Obj
e3c0: 20 2a 2a 65 72 72 6f 72 50 74 72 29 3b 0a 74 79   **errorPtr);.ty
e3d0: 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 46  pedef int (Tcl_F
e3e0: 53 43 6f 70 79 46 69 6c 65 50 72 6f 63 29 20 28  SCopyFileProc) (
e3f0: 54 63 6c 5f 4f 62 6a 20 2a 73 72 63 50 61 74 68  Tcl_Obj *srcPath
e400: 50 74 72 2c 20 54 63 6c 5f 4f 62 6a 20 2a 64 65  Ptr, Tcl_Obj *de
e410: 73 74 50 61 74 68 50 74 72 29 3b 0a 74 79 70 65  stPathPtr);.type
e420: 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 46 53 52  def int (Tcl_FSR
e430: 65 6d 6f 76 65 44 69 72 65 63 74 6f 72 79 50 72  emoveDirectoryPr
e440: 6f 63 29 20 28 54 63 6c 5f 4f 62 6a 20 2a 70 61  oc) (Tcl_Obj *pa
e450: 74 68 50 74 72 2c 20 69 6e 74 20 72 65 63 75 72  thPtr, int recur
e460: 73 69 76 65 2c 0a 09 54 63 6c 5f 4f 62 6a 20 2a  sive,..Tcl_Obj *
e470: 2a 65 72 72 6f 72 50 74 72 29 3b 0a 74 79 70 65  *errorPtr);.type
e480: 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 46 53 52  def int (Tcl_FSR
e490: 65 6e 61 6d 65 46 69 6c 65 50 72 6f 63 29 20 28  enameFileProc) (
e4a0: 54 63 6c 5f 4f 62 6a 20 2a 73 72 63 50 61 74 68  Tcl_Obj *srcPath
e4b0: 50 74 72 2c 20 54 63 6c 5f 4f 62 6a 20 2a 64 65  Ptr, Tcl_Obj *de
e4c0: 73 74 50 61 74 68 50 74 72 29 3b 0a 74 79 70 65  stPathPtr);.type
e4d0: 64 65 66 20 76 6f 69 64 20 28 54 63 6c 5f 46 53  def void (Tcl_FS
e4e0: 55 6e 6c 6f 61 64 46 69 6c 65 50 72 6f 63 29 20  UnloadFileProc) 
e4f0: 28 54 63 6c 5f 4c 6f 61 64 48 61 6e 64 6c 65 20  (Tcl_LoadHandle 
e500: 6c 6f 61 64 48 61 6e 64 6c 65 29 3b 0a 74 79 70  loadHandle);.typ
e510: 65 64 65 66 20 54 63 6c 5f 4f 62 6a 20 2a 20 28  edef Tcl_Obj * (
e520: 54 63 6c 5f 46 53 4c 69 73 74 56 6f 6c 75 6d 65  Tcl_FSListVolume
e530: 73 50 72 6f 63 29 20 28 76 6f 69 64 29 3b 0a 2f  sProc) (void);./
e540: 2a 20 57 65 20 68 61 76 65 20 74 6f 20 64 65 63  * We have to dec
e550: 6c 61 72 65 20 74 68 65 20 75 74 69 6d 65 20 73  lare the utime s
e560: 74 72 75 63 74 75 72 65 20 68 65 72 65 2e 20 2a  tructure here. *
e570: 2f 0a 73 74 72 75 63 74 20 75 74 69 6d 62 75 66  /.struct utimbuf
e580: 3b 0a 74 79 70 65 64 65 66 20 69 6e 74 20 28 54  ;.typedef int (T
e590: 63 6c 5f 46 53 55 74 69 6d 65 50 72 6f 63 29 20  cl_FSUtimeProc) 
e5a0: 28 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68 50 74  (Tcl_Obj *pathPt
e5b0: 72 2c 20 73 74 72 75 63 74 20 75 74 69 6d 62 75  r, struct utimbu
e5c0: 66 20 2a 74 76 61 6c 29 3b 0a 74 79 70 65 64 65  f *tval);.typede
e5d0: 66 20 69 6e 74 20 28 54 63 6c 5f 46 53 4e 6f 72  f int (Tcl_FSNor
e5e0: 6d 61 6c 69 7a 65 50 61 74 68 50 72 6f 63 29 20  malizePathProc) 
e5f0: 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74  (Tcl_Interp *int
e600: 65 72 70 2c 20 54 63 6c 5f 4f 62 6a 20 2a 70 61  erp, Tcl_Obj *pa
e610: 74 68 50 74 72 2c 0a 09 69 6e 74 20 6e 65 78 74  thPtr,..int next
e620: 43 68 65 63 6b 70 6f 69 6e 74 29 3b 0a 74 79 70  Checkpoint);.typ
e630: 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 46 53  edef int (Tcl_FS
e640: 46 69 6c 65 41 74 74 72 73 47 65 74 50 72 6f 63  FileAttrsGetProc
e650: 29 20 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69  ) (Tcl_Interp *i
e660: 6e 74 65 72 70 2c 20 69 6e 74 20 69 6e 64 65 78  nterp, int index
e670: 2c 0a 09 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68  ,..Tcl_Obj *path
e680: 50 74 72 2c 20 54 63 6c 5f 4f 62 6a 20 2a 2a 6f  Ptr, Tcl_Obj **o
e690: 62 6a 50 74 72 52 65 66 29 3b 0a 74 79 70 65 64  bjPtrRef);.typed
e6a0: 65 66 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 43  ef const char *C
e6b0: 4f 4e 53 54 38 36 20 2a 20 28 54 63 6c 5f 46 53  ONST86 * (Tcl_FS
e6c0: 46 69 6c 65 41 74 74 72 53 74 72 69 6e 67 73 50  FileAttrStringsP
e6d0: 72 6f 63 29 20 28 54 63 6c 5f 4f 62 6a 20 2a 70  roc) (Tcl_Obj *p
e6e0: 61 74 68 50 74 72 2c 0a 09 54 63 6c 5f 4f 62 6a  athPtr,..Tcl_Obj
e6f0: 20 2a 2a 6f 62 6a 50 74 72 52 65 66 29 3b 0a 74   **objPtrRef);.t
e700: 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f  ypedef int (Tcl_
e710: 46 53 46 69 6c 65 41 74 74 72 73 53 65 74 50 72  FSFileAttrsSetPr
e720: 6f 63 29 20 28 54 63 6c 5f 49 6e 74 65 72 70 20  oc) (Tcl_Interp 
e730: 2a 69 6e 74 65 72 70 2c 20 69 6e 74 20 69 6e 64  *interp, int ind
e740: 65 78 2c 0a 09 54 63 6c 5f 4f 62 6a 20 2a 70 61  ex,..Tcl_Obj *pa
e750: 74 68 50 74 72 2c 20 54 63 6c 5f 4f 62 6a 20 2a  thPtr, Tcl_Obj *
e760: 6f 62 6a 50 74 72 29 3b 0a 74 79 70 65 64 65 66  objPtr);.typedef
e770: 20 54 63 6c 5f 4f 62 6a 20 2a 20 28 54 63 6c 5f   Tcl_Obj * (Tcl_
e780: 46 53 4c 69 6e 6b 50 72 6f 63 29 20 28 54 63 6c  FSLinkProc) (Tcl
e790: 5f 4f 62 6a 20 2a 70 61 74 68 50 74 72 2c 20 54  _Obj *pathPtr, T
e7a0: 63 6c 5f 4f 62 6a 20 2a 74 6f 50 74 72 2c 0a 09  cl_Obj *toPtr,..
e7b0: 69 6e 74 20 6c 69 6e 6b 54 79 70 65 29 3b 0a 74  int linkType);.t
e7c0: 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f  ypedef int (Tcl_
e7d0: 46 53 4c 6f 61 64 46 69 6c 65 50 72 6f 63 29 20  FSLoadFileProc) 
e7e0: 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74  (Tcl_Interp *int
e7f0: 65 72 70 2c 20 54 63 6c 5f 4f 62 6a 20 2a 70 61  erp, Tcl_Obj *pa
e800: 74 68 50 74 72 2c 0a 09 54 63 6c 5f 4c 6f 61 64  thPtr,..Tcl_Load
e810: 48 61 6e 64 6c 65 20 2a 68 61 6e 64 6c 65 50 74  Handle *handlePt
e820: 72 2c 20 54 63 6c 5f 46 53 55 6e 6c 6f 61 64 46  r, Tcl_FSUnloadF
e830: 69 6c 65 50 72 6f 63 20 2a 2a 75 6e 6c 6f 61 64  ileProc **unload
e840: 50 72 6f 63 50 74 72 29 3b 0a 74 79 70 65 64 65  ProcPtr);.typede
e850: 66 20 69 6e 74 20 28 54 63 6c 5f 46 53 50 61 74  f int (Tcl_FSPat
e860: 68 49 6e 46 69 6c 65 73 79 73 74 65 6d 50 72 6f  hInFilesystemPro
e870: 63 29 20 28 54 63 6c 5f 4f 62 6a 20 2a 70 61 74  c) (Tcl_Obj *pat
e880: 68 50 74 72 2c 0a 09 43 6c 69 65 6e 74 44 61 74  hPtr,..ClientDat
e890: 61 20 2a 63 6c 69 65 6e 74 44 61 74 61 50 74 72  a *clientDataPtr
e8a0: 29 3b 0a 74 79 70 65 64 65 66 20 54 63 6c 5f 4f  );.typedef Tcl_O
e8b0: 62 6a 20 2a 20 28 54 63 6c 5f 46 53 46 69 6c 65  bj * (Tcl_FSFile
e8c0: 73 79 73 74 65 6d 50 61 74 68 54 79 70 65 50 72  systemPathTypePr
e8d0: 6f 63 29 20 28 54 63 6c 5f 4f 62 6a 20 2a 70 61  oc) (Tcl_Obj *pa
e8e0: 74 68 50 74 72 29 3b 0a 74 79 70 65 64 65 66 20  thPtr);.typedef 
e8f0: 54 63 6c 5f 4f 62 6a 20 2a 20 28 54 63 6c 5f 46  Tcl_Obj * (Tcl_F
e900: 53 46 69 6c 65 73 79 73 74 65 6d 53 65 70 61 72  SFilesystemSepar
e910: 61 74 6f 72 50 72 6f 63 29 20 28 54 63 6c 5f 4f  atorProc) (Tcl_O
e920: 62 6a 20 2a 70 61 74 68 50 74 72 29 3b 0a 74 79  bj *pathPtr);.ty
e930: 70 65 64 65 66 20 76 6f 69 64 20 28 54 63 6c 5f  pedef void (Tcl_
e940: 46 53 46 72 65 65 49 6e 74 65 72 6e 61 6c 52 65  FSFreeInternalRe
e950: 70 50 72 6f 63 29 20 28 43 6c 69 65 6e 74 44 61  pProc) (ClientDa
e960: 74 61 20 63 6c 69 65 6e 74 44 61 74 61 29 3b 0a  ta clientData);.
e970: 74 79 70 65 64 65 66 20 43 6c 69 65 6e 74 44 61  typedef ClientDa
e980: 74 61 20 28 54 63 6c 5f 46 53 44 75 70 49 6e 74  ta (Tcl_FSDupInt
e990: 65 72 6e 61 6c 52 65 70 50 72 6f 63 29 20 28 43  ernalRepProc) (C
e9a0: 6c 69 65 6e 74 44 61 74 61 20 63 6c 69 65 6e 74  lientData client
e9b0: 44 61 74 61 29 3b 0a 74 79 70 65 64 65 66 20 54  Data);.typedef T
e9c0: 63 6c 5f 4f 62 6a 20 2a 20 28 54 63 6c 5f 46 53  cl_Obj * (Tcl_FS
e9d0: 49 6e 74 65 72 6e 61 6c 54 6f 4e 6f 72 6d 61 6c  InternalToNormal
e9e0: 69 7a 65 64 50 72 6f 63 29 20 28 43 6c 69 65 6e  izedProc) (Clien
e9f0: 74 44 61 74 61 20 63 6c 69 65 6e 74 44 61 74 61  tData clientData
ea00: 29 3b 0a 74 79 70 65 64 65 66 20 43 6c 69 65 6e  );.typedef Clien
ea10: 74 44 61 74 61 20 28 54 63 6c 5f 46 53 43 72 65  tData (Tcl_FSCre
ea20: 61 74 65 49 6e 74 65 72 6e 61 6c 52 65 70 50 72  ateInternalRepPr
ea30: 6f 63 29 20 28 54 63 6c 5f 4f 62 6a 20 2a 70 61  oc) (Tcl_Obj *pa
ea40: 74 68 50 74 72 29 3b 0a 0a 74 79 70 65 64 65 66  thPtr);..typedef
ea50: 20 73 74 72 75 63 74 20 54 63 6c 5f 46 53 56 65   struct Tcl_FSVe
ea60: 72 73 69 6f 6e 5f 20 2a 54 63 6c 5f 46 53 56 65  rsion_ *Tcl_FSVe
ea70: 72 73 69 6f 6e 3b 0a 0a 2f 2a 0a 20 2a 2d 2d 2d  rsion;../*. *---
ea80: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
ea90: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
eaa0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
eab0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
eac0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 44 61 74  ---------. * Dat
ead0: 61 20 73 74 72 75 63 74 75 72 65 73 20 72 65 6c  a structures rel
eae0: 61 74 65 64 20 74 6f 20 68 6f 6f 6b 69 6e 67 20  ated to hooking 
eaf0: 69 6e 74 6f 20 74 68 65 20 66 69 6c 65 73 79 73  into the filesys
eb00: 74 65 6d 0a 20 2a 2f 0a 0a 2f 2a 0a 20 2a 20 46  tem. */../*. * F
eb10: 69 6c 65 73 79 73 74 65 6d 20 76 65 72 73 69 6f  ilesystem versio
eb20: 6e 20 74 61 67 2e 20 20 54 68 69 73 20 77 61 73  n tag.  This was
eb30: 20 69 6e 74 72 6f 64 75 63 65 64 20 69 6e 20 38   introduced in 8
eb40: 2e 34 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65  .4.. */..#define
eb50: 20 54 43 4c 5f 46 49 4c 45 53 59 53 54 45 4d 5f   TCL_FILESYSTEM_
eb60: 56 45 52 53 49 4f 4e 5f 31 09 28 28 54 63 6c 5f  VERSION_1.((Tcl_
eb70: 46 53 56 65 72 73 69 6f 6e 29 20 30 78 31 29 0a  FSVersion) 0x1).
eb80: 0a 2f 2a 0a 20 2a 20 73 74 72 75 63 74 20 54 63  ./*. * struct Tc
eb90: 6c 5f 46 69 6c 65 73 79 73 74 65 6d 3a 0a 20 2a  l_Filesystem:. *
eba0: 0a 20 2a 20 4f 6e 65 20 73 75 63 68 20 73 74 72  . * One such str
ebb0: 75 63 74 75 72 65 20 65 78 69 73 74 73 20 66 6f  ucture exists fo
ebc0: 72 20 65 61 63 68 20 74 79 70 65 20 28 6b 69 6e  r each type (kin
ebd0: 64 29 20 6f 66 20 66 69 6c 65 73 79 73 74 65 6d  d) of filesystem
ebe0: 2e 20 49 74 20 63 6f 6c 6c 65 63 74 73 0a 20 2a  . It collects. *
ebf0: 20 74 6f 67 65 74 68 65 72 20 74 68 65 20 66 75   together the fu
ec00: 6e 63 74 69 6f 6e 73 20 74 68 61 74 20 66 6f 72  nctions that for
ec10: 6d 20 74 68 65 20 69 6e 74 65 72 66 61 63 65 20  m the interface 
ec20: 66 6f 72 20 61 20 70 61 72 74 69 63 75 6c 72 20  for a particulr 
ec30: 74 68 65 0a 20 2a 20 66 69 6c 65 73 79 73 74 65  the. * filesyste
ec40: 6d 2e 20 54 63 6c 20 61 6c 77 61 79 73 20 61 63  m. Tcl always ac
ec50: 63 65 73 73 65 73 20 74 68 65 20 66 69 6c 65 73  cesses the files
ec60: 79 73 74 65 6d 20 74 68 72 6f 75 67 68 20 6f 6e  ystem through on
ec70: 65 20 6f 66 20 74 68 65 73 65 0a 20 2a 20 73 74  e of these. * st
ec80: 72 75 63 74 75 72 65 73 2e 0a 20 2a 0a 20 2a 20  ructures.. *. * 
ec90: 4e 6f 74 20 61 6c 6c 20 65 6e 74 72 69 65 73 20  Not all entries 
eca0: 6e 65 65 64 20 62 65 20 6e 6f 6e 2d 4e 55 4c 4c  need be non-NULL
ecb0: 3b 20 61 6e 79 20 77 68 69 63 68 20 61 72 65 20  ; any which are 
ecc0: 4e 55 4c 4c 20 61 72 65 20 73 69 6d 70 6c 79 20  NULL are simply 
ecd0: 69 67 6e 6f 72 65 64 2e 0a 20 2a 20 48 6f 77 65  ignored.. * Howe
ece0: 76 65 72 2c 20 61 20 63 6f 6d 70 6c 65 74 65 20  ver, a complete 
ecf0: 66 69 6c 65 73 79 73 74 65 6d 20 73 68 6f 75 6c  filesystem shoul
ed00: 64 20 70 72 6f 76 69 64 65 20 61 6c 6c 20 6f 66  d provide all of
ed10: 20 74 68 65 73 65 20 66 75 6e 63 74 69 6f 6e 73   these functions
ed20: 2e 20 54 68 65 0a 20 2a 20 65 78 70 6c 61 6e 61  . The. * explana
ed30: 74 69 6f 6e 73 20 69 6e 20 74 68 65 20 73 74 72  tions in the str
ed40: 75 63 74 75 72 65 20 73 68 6f 77 20 74 68 65 20  ucture show the 
ed50: 69 6d 70 6f 72 74 61 6e 63 65 20 6f 66 20 65 61  importance of ea
ed60: 63 68 20 66 75 6e 63 74 69 6f 6e 2e 0a 20 2a 2f  ch function.. */
ed70: 0a 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 74  ..typedef struct
ed80: 20 54 63 6c 5f 46 69 6c 65 73 79 73 74 65 6d 20   Tcl_Filesystem 
ed90: 7b 0a 20 20 20 20 63 6f 6e 73 74 20 63 68 61 72  {.    const char
eda0: 20 2a 74 79 70 65 4e 61 6d 65 3b 09 2f 2a 20 54   *typeName;./* T
edb0: 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 66  he name of the f
edc0: 69 6c 65 73 79 73 74 65 6d 2e 20 2a 2f 0a 20 20  ilesystem. */.  
edd0: 20 20 69 6e 74 20 73 74 72 75 63 74 75 72 65 4c    int structureL
ede0: 65 6e 67 74 68 3b 09 2f 2a 20 4c 65 6e 67 74 68  ength;./* Length
edf0: 20 6f 66 20 74 68 69 73 20 73 74 72 75 63 74 75   of this structu
ee00: 72 65 2c 20 73 6f 20 66 75 74 75 72 65 20 62 69  re, so future bi
ee10: 6e 61 72 79 0a 09 09 09 09 20 2a 20 63 6f 6d 70  nary..... * comp
ee20: 61 74 69 62 69 6c 69 74 79 20 63 61 6e 20 62 65  atibility can be
ee30: 20 61 73 73 75 72 65 64 2e 20 2a 2f 0a 20 20 20   assured. */.   
ee40: 20 54 63 6c 5f 46 53 56 65 72 73 69 6f 6e 20 76   Tcl_FSVersion v
ee50: 65 72 73 69 6f 6e 3b 09 2f 2a 20 56 65 72 73 69  ersion;./* Versi
ee60: 6f 6e 20 6f 66 20 74 68 65 20 66 69 6c 65 73 79  on of the filesy
ee70: 73 74 65 6d 20 74 79 70 65 2e 20 2a 2f 0a 20 20  stem type. */.  
ee80: 20 20 54 63 6c 5f 46 53 50 61 74 68 49 6e 46 69    Tcl_FSPathInFi
ee90: 6c 65 73 79 73 74 65 6d 50 72 6f 63 20 2a 70 61  lesystemProc *pa
eea0: 74 68 49 6e 46 69 6c 65 73 79 73 74 65 6d 50 72  thInFilesystemPr
eeb0: 6f 63 3b 0a 09 09 09 09 2f 2a 20 44 65 74 65 72  oc;...../* Deter
eec0: 6d 69 6e 65 73 20 77 68 65 74 68 65 72 20 74 68  mines whether th
eed0: 65 20 70 61 74 68 6e 61 6d 65 20 69 73 20 69 6e  e pathname is in
eee0: 20 74 68 69 73 0a 09 09 09 09 20 2a 20 66 69 6c   this..... * fil
eef0: 65 73 79 73 74 65 6d 2e 20 54 68 69 73 20 69 73  esystem. This is
ef00: 20 74 68 65 20 6d 6f 73 74 20 69 6d 70 6f 72 74   the most import
ef10: 61 6e 74 0a 09 09 09 09 20 2a 20 66 69 6c 65 73  ant..... * files
ef20: 79 73 74 65 6d 20 66 75 6e 63 74 69 6f 6e 2e 20  ystem function. 
ef30: 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53 44 75 70  */.    Tcl_FSDup
ef40: 49 6e 74 65 72 6e 61 6c 52 65 70 50 72 6f 63 20  InternalRepProc 
ef50: 2a 64 75 70 49 6e 74 65 72 6e 61 6c 52 65 70 50  *dupInternalRepP
ef60: 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 44 75 70 6c  roc;...../* Dupl
ef70: 69 63 61 74 65 73 20 74 68 65 20 69 6e 74 65 72  icates the inter
ef80: 6e 61 6c 20 68 61 6e 64 6c 65 20 6f 66 20 74 68  nal handle of th
ef90: 65 20 6e 6f 64 65 2e 0a 09 09 09 09 20 2a 20 49  e node...... * I
efa0: 66 20 69 74 20 69 73 20 4e 55 4c 4c 2c 20 74 68  f it is NULL, th
efb0: 65 20 66 69 6c 65 73 79 73 74 65 6d 20 69 73 20  e filesystem is 
efc0: 6c 65 73 73 0a 09 09 09 09 20 2a 20 70 65 72 66  less..... * perf
efd0: 6f 72 6d 61 6e 74 2e 20 2a 2f 0a 20 20 20 20 54  ormant. */.    T
efe0: 63 6c 5f 46 53 46 72 65 65 49 6e 74 65 72 6e 61  cl_FSFreeInterna
eff0: 6c 52 65 70 50 72 6f 63 20 2a 66 72 65 65 49 6e  lRepProc *freeIn
f000: 74 65 72 6e 61 6c 52 65 70 50 72 6f 63 3b 0a 09  ternalRepProc;..
f010: 09 09 09 2f 2a 20 46 72 65 65 73 20 74 68 65 20  .../* Frees the 
f020: 69 6e 74 65 72 6e 61 6c 20 68 61 6e 64 6c 65 20  internal handle 
f030: 6f 66 20 74 68 65 20 6e 6f 64 65 2e 20 20 4e 55  of the node.  NU
f040: 4c 4c 0a 09 09 09 09 20 2a 20 6f 6e 6c 79 20 69  LL..... * only i
f050: 66 20 74 68 65 72 65 20 69 73 20 6e 6f 20 6e 65  f there is no ne
f060: 65 64 20 74 6f 20 66 72 65 65 20 72 65 73 6f 75  ed to free resou
f070: 72 63 65 73 0a 09 09 09 09 20 2a 20 75 73 65 64  rces..... * used
f080: 20 66 6f 72 20 74 68 65 20 69 6e 74 65 72 6e 61   for the interna
f090: 6c 20 68 61 6e 64 6c 65 2e 20 2a 2f 0a 20 20 20  l handle. */.   
f0a0: 20 54 63 6c 5f 46 53 49 6e 74 65 72 6e 61 6c 54   Tcl_FSInternalT
f0b0: 6f 4e 6f 72 6d 61 6c 69 7a 65 64 50 72 6f 63 20  oNormalizedProc 
f0c0: 2a 69 6e 74 65 72 6e 61 6c 54 6f 4e 6f 72 6d 61  *internalToNorma
f0d0: 6c 69 7a 65 64 50 72 6f 63 3b 0a 09 09 09 09 2f  lizedProc;...../
f0e0: 2a 20 43 6f 6e 76 65 72 74 73 20 74 68 65 20 69  * Converts the i
f0f0: 6e 74 65 72 6e 61 6c 20 68 61 6e 64 6c 65 20 74  nternal handle t
f100: 6f 20 61 20 6e 6f 72 6d 61 6c 69 7a 65 64 0a 09  o a normalized..
f110: 09 09 09 20 2a 20 70 61 74 68 2e 20 20 4e 55 4c  ... * path.  NUL
f120: 4c 20 69 66 20 74 68 65 20 66 69 6c 65 73 79 73  L if the filesys
f130: 74 65 6d 20 63 72 65 61 74 65 73 20 6e 6f 64 65  tem creates node
f140: 73 0a 09 09 09 09 20 2a 20 68 61 76 69 6e 67 20  s..... * having 
f150: 6e 6f 20 70 61 74 68 6e 61 6d 65 2e 20 2a 2f 0a  no pathname. */.
f160: 20 20 20 20 54 63 6c 5f 46 53 43 72 65 61 74 65      Tcl_FSCreate
f170: 49 6e 74 65 72 6e 61 6c 52 65 70 50 72 6f 63 20  InternalRepProc 
f180: 2a 63 72 65 61 74 65 49 6e 74 65 72 6e 61 6c 52  *createInternalR
f190: 65 70 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 43  epProc;...../* C
f1a0: 72 65 61 74 65 73 20 61 6e 20 69 6e 74 65 72 6e  reates an intern
f1b0: 61 6c 20 68 61 6e 64 6c 65 20 66 6f 72 20 61 20  al handle for a 
f1c0: 70 61 74 68 6e 61 6d 65 2e 0a 09 09 09 09 20 2a  pathname...... *
f1d0: 20 4d 61 79 20 62 65 20 4e 55 4c 4c 20 69 66 20   May be NULL if 
f1e0: 70 61 74 68 6e 61 6d 65 73 20 68 61 76 65 20 6e  pathnames have n
f1f0: 6f 20 69 6e 74 65 72 6e 61 6c 0a 09 09 09 09 20  o internal..... 
f200: 2a 20 68 61 6e 64 6c 65 20 6f 72 20 69 66 20 70  * handle or if p
f210: 61 74 68 49 6e 46 69 6c 65 73 79 73 74 65 6d 50  athInFilesystemP
f220: 72 6f 63 20 61 6c 77 61 79 73 0a 09 09 09 09 20  roc always..... 
f230: 2a 20 69 6d 6d 65 64 69 61 74 65 6c 79 20 63 72  * immediately cr
f240: 65 61 74 65 73 20 61 6e 20 69 6e 74 65 72 6e 61  eates an interna
f250: 6c 0a 09 09 09 09 20 2a 20 72 65 70 72 65 73 65  l..... * represe
f260: 6e 74 61 74 69 6f 6e 20 66 6f 72 20 70 61 74 68  ntation for path
f270: 6e 61 6d 65 73 20 69 6e 20 74 68 65 0a 09 09 09  names in the....
f280: 09 20 2a 20 66 69 6c 65 73 79 73 74 65 6d 2e 20  . * filesystem. 
f290: 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53 4e 6f 72  */.    Tcl_FSNor
f2a0: 6d 61 6c 69 7a 65 50 61 74 68 50 72 6f 63 20 2a  malizePathProc *
f2b0: 6e 6f 72 6d 61 6c 69 7a 65 50 61 74 68 50 72 6f  normalizePathPro
f2c0: 63 3b 0a 09 09 09 09 2f 2a 20 4e 6f 72 6d 61 6c  c;...../* Normal
f2d0: 69 7a 65 73 20 61 20 70 61 74 68 2e 20 20 53 68  izes a path.  Sh
f2e0: 6f 75 6c 64 20 62 65 20 69 6d 70 6c 65 6d 65 6e  ould be implemen
f2f0: 74 65 64 20 69 66 0a 09 09 09 09 20 2a 20 74 68  ted if..... * th
f300: 65 20 66 69 6c 65 73 79 73 74 65 6d 73 20 73 75  e filesystems su
f310: 70 70 6f 72 74 73 20 6d 75 6c 74 69 70 6c 65 20  pports multiple 
f320: 70 61 74 68 73 20 74 6f 0a 09 09 09 09 20 2a 20  paths to..... * 
f330: 74 68 65 20 73 61 6d 65 20 6e 6f 64 65 2e 20 2a  the same node. *
f340: 2f 0a 20 20 20 20 54 63 6c 5f 46 53 46 69 6c 65  /.    Tcl_FSFile
f350: 73 79 73 74 65 6d 50 61 74 68 54 79 70 65 50 72  systemPathTypePr
f360: 6f 63 20 2a 66 69 6c 65 73 79 73 74 65 6d 50 61  oc *filesystemPa
f370: 74 68 54 79 70 65 50 72 6f 63 3b 0a 09 09 09 09  thTypeProc;.....
f380: 2f 2a 20 44 65 74 65 72 6d 69 6e 65 73 20 74 68  /* Determines th
f390: 65 20 74 79 70 65 20 6f 66 20 61 20 70 61 74 68  e type of a path
f3a0: 20 69 6e 20 74 68 69 73 0a 09 09 09 09 20 2a 20   in this..... * 
f3b0: 66 69 6c 65 73 79 73 74 65 6d 2e 20 4d 61 79 20  filesystem. May 
f3c0: 62 65 20 4e 55 4c 4c 2e 20 2a 2f 0a 20 20 20 20  be NULL. */.    
f3d0: 54 63 6c 5f 46 53 46 69 6c 65 73 79 73 74 65 6d  Tcl_FSFilesystem
f3e0: 53 65 70 61 72 61 74 6f 72 50 72 6f 63 20 2a 66  SeparatorProc *f
f3f0: 69 6c 65 73 79 73 74 65 6d 53 65 70 61 72 61 74  ilesystemSeparat
f400: 6f 72 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 50  orProc;...../* P
f410: 72 6f 64 75 63 65 73 20 74 68 65 20 73 65 70 61  roduces the sepa
f420: 72 61 74 6f 72 20 63 68 61 72 61 63 74 65 72 28  rator character(
f430: 73 29 20 66 6f 72 20 74 68 69 73 0a 09 09 09 09  s) for this.....
f440: 20 2a 20 66 69 6c 65 73 79 73 74 65 6d 2e 20 4d   * filesystem. M
f450: 75 73 74 20 6e 6f 74 20 62 65 20 4e 55 4c 4c 2e  ust not be NULL.
f460: 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53 53 74   */.    Tcl_FSSt
f470: 61 74 50 72 6f 63 20 2a 73 74 61 74 50 72 6f 63  atProc *statProc
f480: 3b 09 2f 2a 20 43 61 6c 6c 65 64 20 62 79 20 27  ;./* Called by '
f490: 54 63 6c 5f 46 53 53 74 61 74 28 29 27 2e 20 20  Tcl_FSStat()'.  
f4a0: 50 72 6f 76 69 64 65 64 20 62 79 20 61 6e 79 0a  Provided by any.
f4b0: 09 09 09 09 20 2a 20 72 65 61 73 6f 6e 61 62 6c  .... * reasonabl
f4c0: 65 20 66 69 6c 65 73 79 73 74 65 6d 2e 20 2a 2f  e filesystem. */
f4d0: 0a 20 20 20 20 54 63 6c 5f 46 53 41 63 63 65 73  .    Tcl_FSAcces
f4e0: 73 50 72 6f 63 20 2a 61 63 63 65 73 73 50 72 6f  sProc *accessPro
f4f0: 63 3b 0a 09 09 09 09 2f 2a 20 43 61 6c 6c 65 64  c;...../* Called
f500: 20 62 79 20 27 54 63 6c 5f 46 53 41 63 63 65 73   by 'Tcl_FSAcces
f510: 73 28 29 27 2e 20 20 49 6d 70 6c 65 6d 65 6e 74  s()'.  Implement
f520: 65 64 20 62 79 0a 09 09 09 09 20 2a 20 61 6e 79  ed by..... * any
f530: 20 72 65 61 73 6f 6e 61 62 6c 65 20 66 69 6c 65   reasonable file
f540: 73 79 73 74 65 6d 2e 20 2a 2f 0a 20 20 20 20 54  system. */.    T
f550: 63 6c 5f 46 53 4f 70 65 6e 46 69 6c 65 43 68 61  cl_FSOpenFileCha
f560: 6e 6e 65 6c 50 72 6f 63 20 2a 6f 70 65 6e 46 69  nnelProc *openFi
f570: 6c 65 43 68 61 6e 6e 65 6c 50 72 6f 63 3b 0a 09  leChannelProc;..
f580: 09 09 09 2f 2a 20 43 61 6c 6c 65 64 20 62 79 20  .../* Called by 
f590: 27 54 63 6c 5f 46 53 4f 70 65 6e 46 69 6c 65 43  'Tcl_FSOpenFileC
f5a0: 68 61 6e 6e 65 6c 28 29 27 2e 0a 09 09 09 09 20  hannel()'...... 
f5b0: 2a 20 50 72 6f 76 69 64 65 64 20 62 79 20 61 6e  * Provided by an
f5c0: 79 20 72 65 61 73 6f 6e 61 62 6c 65 20 66 69 6c  y reasonable fil
f5d0: 65 73 79 73 74 65 6d 2e 20 2a 2f 0a 20 20 20 20  esystem. */.    
f5e0: 54 63 6c 5f 46 53 4d 61 74 63 68 49 6e 44 69 72  Tcl_FSMatchInDir
f5f0: 65 63 74 6f 72 79 50 72 6f 63 20 2a 6d 61 74 63  ectoryProc *matc
f600: 68 49 6e 44 69 72 65 63 74 6f 72 79 50 72 6f 63  hInDirectoryProc
f610: 3b 0a 09 09 09 09 2f 2a 20 43 61 6c 6c 65 64 20  ;...../* Called 
f620: 62 79 20 27 54 63 6c 5f 46 53 4d 61 74 63 68 49  by 'Tcl_FSMatchI
f630: 6e 44 69 72 65 63 74 6f 72 79 28 29 27 2e 20 20  nDirectory()'.  
f640: 4e 55 4c 4c 0a 09 09 09 09 20 2a 20 69 66 20 74  NULL..... * if t
f650: 68 65 20 66 69 6c 65 73 79 73 74 65 6d 20 64 6f  he filesystem do
f660: 65 73 20 6e 6f 74 20 73 75 70 70 6f 72 74 20 67  es not support g
f670: 6c 6f 62 20 6f 72 0a 09 09 09 09 20 2a 20 72 65  lob or..... * re
f680: 63 75 72 73 69 76 65 20 63 6f 70 79 2e 20 2a 2f  cursive copy. */
f690: 0a 20 20 20 20 54 63 6c 5f 46 53 55 74 69 6d 65  .    Tcl_FSUtime
f6a0: 50 72 6f 63 20 2a 75 74 69 6d 65 50 72 6f 63 3b  Proc *utimeProc;
f6b0: 09 2f 2a 20 43 61 6c 6c 65 64 20 62 79 20 27 54  ./* Called by 'T
f6c0: 63 6c 5f 46 53 55 74 69 6d 65 28 29 27 2c 20 62  cl_FSUtime()', b
f6d0: 79 20 27 66 69 6c 65 0a 09 09 09 09 20 2a 20 20  y 'file..... *  
f6e0: 6d 74 69 6d 65 27 20 74 6f 20 73 65 74 20 28 6e  mtime' to set (n
f6f0: 6f 74 20 72 65 61 64 29 20 74 69 6d 65 73 2c 20  ot read) times, 
f700: 27 66 69 6c 65 0a 09 09 09 09 20 2a 20 20 61 74  'file..... *  at
f710: 69 6d 65 27 2c 20 61 6e 64 20 74 68 65 20 6f 70  ime', and the op
f720: 65 6e 2d 72 2f 6f 70 65 6e 2d 77 2f 66 63 6f 70  en-r/open-w/fcop
f730: 79 20 76 61 72 69 61 6e 74 0a 09 09 09 09 20 2a  y variant..... *
f740: 20 20 6f 66 20 27 66 69 6c 65 20 63 6f 70 79 27    of 'file copy'
f750: 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53 4c  . */.    Tcl_FSL
f760: 69 6e 6b 50 72 6f 63 20 2a 6c 69 6e 6b 50 72 6f  inkProc *linkPro
f770: 63 3b 09 2f 2a 20 43 61 6c 6c 65 64 20 62 79 20  c;./* Called by 
f780: 27 54 63 6c 5f 46 53 4c 69 6e 6b 28 29 27 2e 20  'Tcl_FSLink()'. 
f790: 4e 55 4c 4c 20 69 66 20 72 65 61 64 69 6e 67 20  NULL if reading 
f7a0: 6f 72 0a 09 09 09 09 20 2a 20 20 63 72 65 61 74  or..... *  creat
f7b0: 69 6e 67 20 6c 69 6e 6b 73 20 69 73 20 6e 6f 74  ing links is not
f7c0: 20 73 75 70 70 6f 72 74 65 64 2e 20 2a 2f 0a 20   supported. */. 
f7d0: 20 20 20 54 63 6c 5f 46 53 4c 69 73 74 56 6f 6c     Tcl_FSListVol
f7e0: 75 6d 65 73 50 72 6f 63 20 2a 6c 69 73 74 56 6f  umesProc *listVo
f7f0: 6c 75 6d 65 73 50 72 6f 63 3b 0a 09 09 09 09 2f  lumesProc;...../
f800: 2a 20 4c 69 73 74 73 20 66 69 6c 65 73 79 73 74  * Lists filesyst
f810: 65 6d 20 76 6f 6c 75 6d 65 73 20 61 64 64 65 64  em volumes added
f820: 20 62 79 20 74 68 69 73 0a 09 09 09 09 20 2a 20   by this..... * 
f830: 66 69 6c 65 73 79 73 74 65 6d 2e 20 4e 55 4c 4c  filesystem. NULL
f840: 20 69 66 20 74 68 65 20 66 69 6c 65 73 79 73 74   if the filesyst
f850: 65 6d 20 64 6f 65 73 20 6e 6f 74 0a 09 09 09 09  em does not.....
f860: 20 2a 20 75 73 65 20 76 6f 6c 75 6d 65 73 2e 20   * use volumes. 
f870: 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53 46 69 6c  */.    Tcl_FSFil
f880: 65 41 74 74 72 53 74 72 69 6e 67 73 50 72 6f 63  eAttrStringsProc
f890: 20 2a 66 69 6c 65 41 74 74 72 53 74 72 69 6e 67   *fileAttrString
f8a0: 73 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 4c 69  sProc;...../* Li
f8b0: 73 74 20 61 6c 6c 20 76 61 6c 69 64 20 61 74 74  st all valid att
f8c0: 72 69 62 75 74 65 73 20 73 74 72 69 6e 67 73 2e  ributes strings.
f8d0: 20 20 4e 55 4c 4c 20 69 66 0a 09 09 09 09 20 2a    NULL if..... *
f8e0: 20 74 68 65 20 66 69 6c 65 73 79 73 74 65 6d 20   the filesystem 
f8f0: 64 6f 65 73 20 6e 6f 74 20 73 75 70 70 6f 72 74  does not support
f900: 20 74 68 65 20 27 66 69 6c 65 0a 09 09 09 09 20   the 'file..... 
f910: 2a 20 61 74 74 72 69 62 75 74 65 73 27 20 63 6f  * attributes' co
f920: 6d 6d 61 6e 64 2e 20 20 43 61 6e 20 62 65 20 75  mmand.  Can be u
f930: 73 65 64 20 74 6f 20 61 74 74 61 63 68 0a 09 09  sed to attach...
f940: 09 09 20 2a 20 61 72 62 69 74 72 61 72 79 20 61  .. * arbitrary a
f950: 64 64 69 74 69 6f 6e 61 6c 20 64 61 74 61 20 74  dditional data t
f960: 6f 20 66 69 6c 65 73 20 69 6e 20 61 0a 09 09 09  o files in a....
f970: 09 20 2a 20 66 69 6c 65 73 79 73 74 65 6d 2e 20  . * filesystem. 
f980: 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53 46 69 6c  */.    Tcl_FSFil
f990: 65 41 74 74 72 73 47 65 74 50 72 6f 63 20 2a 66  eAttrsGetProc *f
f9a0: 69 6c 65 41 74 74 72 73 47 65 74 50 72 6f 63 3b  ileAttrsGetProc;
f9b0: 0a 09 09 09 09 2f 2a 20 43 61 6c 6c 65 64 20 62  ...../* Called b
f9c0: 79 20 27 54 63 6c 5f 46 53 46 69 6c 65 41 74 74  y 'Tcl_FSFileAtt
f9d0: 72 73 47 65 74 28 29 27 20 61 6e 64 20 62 79 0a  rsGet()' and by.
f9e0: 09 09 09 09 20 2a 20 27 66 69 6c 65 20 61 74 74  .... * 'file att
f9f0: 72 69 62 75 74 65 73 27 2e 20 2a 2f 0a 20 20 20  ributes'. */.   
fa00: 20 54 63 6c 5f 46 53 46 69 6c 65 41 74 74 72 73   Tcl_FSFileAttrs
fa10: 53 65 74 50 72 6f 63 20 2a 66 69 6c 65 41 74 74  SetProc *fileAtt
fa20: 72 73 53 65 74 50 72 6f 63 3b 0a 09 09 09 09 2f  rsSetProc;...../
fa30: 2a 20 43 61 6c 6c 65 64 20 62 79 20 27 54 63 6c  * Called by 'Tcl
fa40: 5f 46 53 46 69 6c 65 41 74 74 72 73 53 65 74 28  _FSFileAttrsSet(
fa50: 29 27 20 61 6e 64 20 62 79 0a 09 09 09 09 20 2a  )' and by..... *
fa60: 20 27 66 69 6c 65 20 61 74 74 72 69 62 75 74 65   'file attribute
fa70: 73 27 2e 20 20 2a 2f 0a 20 20 20 20 54 63 6c 5f  s'.  */.    Tcl_
fa80: 46 53 43 72 65 61 74 65 44 69 72 65 63 74 6f 72  FSCreateDirector
fa90: 79 50 72 6f 63 20 2a 63 72 65 61 74 65 44 69 72  yProc *createDir
faa0: 65 63 74 6f 72 79 50 72 6f 63 3b 0a 09 09 09 09  ectoryProc;.....
fab0: 2f 2a 20 43 61 6c 6c 65 64 20 62 79 20 27 54 63  /* Called by 'Tc
fac0: 6c 5f 46 53 43 72 65 61 74 65 44 69 72 65 63 74  l_FSCreateDirect
fad0: 6f 72 79 28 29 27 2e 20 20 4d 61 79 20 62 65 0a  ory()'.  May be.
fae0: 09 09 09 09 20 2a 20 4e 55 4c 4c 20 69 66 20 74  .... * NULL if t
faf0: 68 65 20 66 69 6c 65 73 79 73 74 65 6d 20 69 73  he filesystem is
fb00: 20 72 65 61 64 2d 6f 6e 6c 79 2e 20 2a 2f 0a 20   read-only. */. 
fb10: 20 20 20 54 63 6c 5f 46 53 52 65 6d 6f 76 65 44     Tcl_FSRemoveD
fb20: 69 72 65 63 74 6f 72 79 50 72 6f 63 20 2a 72 65  irectoryProc *re
fb30: 6d 6f 76 65 44 69 72 65 63 74 6f 72 79 50 72 6f  moveDirectoryPro
fb40: 63 3b 0a 09 09 09 09 2f 2a 20 43 61 6c 6c 65 64  c;...../* Called
fb50: 20 62 79 20 27 54 63 6c 5f 46 53 52 65 6d 6f 76   by 'Tcl_FSRemov
fb60: 65 44 69 72 65 63 74 6f 72 79 28 29 27 2e 20 20  eDirectory()'.  
fb70: 4d 61 79 20 62 65 0a 09 09 09 09 20 2a 20 4e 55  May be..... * NU
fb80: 4c 4c 20 69 66 20 74 68 65 20 66 69 6c 65 73 79  LL if the filesy
fb90: 73 74 65 6d 20 69 73 20 72 65 61 64 2d 6f 6e 6c  stem is read-onl
fba0: 79 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53  y. */.    Tcl_FS
fbb0: 44 65 6c 65 74 65 46 69 6c 65 50 72 6f 63 20 2a  DeleteFileProc *
fbc0: 64 65 6c 65 74 65 46 69 6c 65 50 72 6f 63 3b 0a  deleteFileProc;.
fbd0: 09 09 09 09 2f 2a 20 43 61 6c 6c 65 64 20 62 79  ..../* Called by
fbe0: 20 27 54 63 6c 5f 46 53 44 65 6c 65 74 65 46 69   'Tcl_FSDeleteFi
fbf0: 6c 65 28 29 27 20 4d 61 79 20 62 65 20 4e 55 4c  le()' May be NUL
fc00: 4c 0a 09 09 09 09 20 2a 20 69 66 20 74 68 65 20  L..... * if the 
fc10: 66 69 6c 65 73 79 73 74 65 6d 20 69 73 20 69 73  filesystem is is
fc20: 20 72 65 61 64 2d 6f 6e 6c 79 2e 20 2a 2f 0a 20   read-only. */. 
fc30: 20 20 20 54 63 6c 5f 46 53 43 6f 70 79 46 69 6c     Tcl_FSCopyFil
fc40: 65 50 72 6f 63 20 2a 63 6f 70 79 46 69 6c 65 50  eProc *copyFileP
fc50: 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 43 61 6c 6c  roc;...../* Call
fc60: 65 64 20 62 79 20 27 54 63 6c 5f 46 53 43 6f 70  ed by 'Tcl_FSCop
fc70: 79 46 69 6c 65 28 29 27 2e 20 20 49 66 20 4e 55  yFile()'.  If NU
fc80: 4c 4c 2c 20 66 6f 72 0a 09 09 09 09 20 2a 20 61  LL, for..... * a
fc90: 20 63 6f 70 79 20 6f 70 65 72 61 74 69 6f 6e 20   copy operation 
fca0: 61 74 20 74 68 65 20 73 63 72 69 70 74 20 6c 65  at the script le
fcb0: 76 65 6c 20 28 6e 6f 74 0a 09 09 09 09 20 2a 20  vel (not..... * 
fcc0: 43 29 20 54 63 6c 20 75 73 65 73 20 6f 70 65 6e  C) Tcl uses open
fcd0: 2d 72 2c 20 6f 70 65 6e 2d 77 20 61 6e 64 20 66  -r, open-w and f
fce0: 63 6f 70 79 2e 20 2a 2f 0a 20 20 20 20 54 63 6c  copy. */.    Tcl
fcf0: 5f 46 53 52 65 6e 61 6d 65 46 69 6c 65 50 72 6f  _FSRenameFilePro
fd00: 63 20 2a 72 65 6e 61 6d 65 46 69 6c 65 50 72 6f  c *renameFilePro
fd10: 63 3b 0a 09 09 09 09 2f 2a 20 43 61 6c 6c 65 64  c;...../* Called
fd20: 20 62 79 20 27 54 63 6c 5f 46 53 52 65 6e 61 6d   by 'Tcl_FSRenam
fd30: 65 46 69 6c 65 28 29 27 2e 20 49 66 20 4e 55 4c  eFile()'. If NUL
fd40: 4c 2c 20 66 6f 72 0a 09 09 09 09 20 2a 20 61 20  L, for..... * a 
fd50: 72 65 6e 61 6d 65 20 6f 70 65 72 61 74 69 6f 6e  rename operation
fd60: 20 61 74 20 74 68 65 20 73 63 72 69 70 74 20 6c   at the script l
fd70: 65 76 65 6c 20 28 6e 6f 74 0a 09 09 09 09 20 2a  evel (not..... *
fd80: 20 43 29 20 54 63 6c 20 70 65 72 66 6f 72 6d 73   C) Tcl performs
fd90: 20 61 20 63 6f 70 79 20 6f 70 65 72 61 74 69 6f   a copy operatio
fda0: 6e 20 66 6f 6c 6c 6f 77 65 64 0a 09 09 09 09 20  n followed..... 
fdb0: 2a 20 62 79 20 61 20 64 65 6c 65 74 65 20 6f 70  * by a delete op
fdc0: 65 72 61 74 69 6f 6e 2e 20 2a 2f 0a 20 20 20 20  eration. */.    
fdd0: 54 63 6c 5f 46 53 43 6f 70 79 44 69 72 65 63 74  Tcl_FSCopyDirect
fde0: 6f 72 79 50 72 6f 63 20 2a 63 6f 70 79 44 69 72  oryProc *copyDir
fdf0: 65 63 74 6f 72 79 50 72 6f 63 3b 0a 09 09 09 09  ectoryProc;.....
fe00: 2f 2a 20 43 61 6c 6c 65 64 20 62 79 20 27 54 63  /* Called by 'Tc
fe10: 6c 5f 46 53 43 6f 70 79 44 69 72 65 63 74 6f 72  l_FSCopyDirector
fe20: 79 28 29 27 2e 20 49 66 20 4e 55 4c 4c 2c 0a 09  y()'. If NULL,..
fe30: 09 09 09 20 2a 20 66 6f 72 20 61 20 63 6f 70 79  ... * for a copy
fe40: 20 6f 70 65 72 61 74 69 6f 6e 20 61 74 20 74 68   operation at th
fe50: 65 20 73 63 72 69 70 74 20 6c 65 76 65 6c 0a 09  e script level..
fe60: 09 09 09 20 2a 20 28 6e 6f 74 20 43 29 20 54 63  ... * (not C) Tc
fe70: 6c 20 72 65 63 75 72 73 69 76 65 6c 79 20 63 72  l recursively cr
fe80: 65 61 74 65 73 20 64 69 72 65 63 74 6f 72 69 65  eates directorie
fe90: 73 0a 09 09 09 09 20 2a 20 61 6e 64 20 63 6f 70  s..... * and cop
fea0: 69 65 73 20 66 69 6c 65 73 2e 20 2a 2f 0a 20 20  ies files. */.  
feb0: 20 20 54 63 6c 5f 46 53 4c 73 74 61 74 50 72 6f    Tcl_FSLstatPro
fec0: 63 20 2a 6c 73 74 61 74 50 72 6f 63 3b 09 2f 2a  c *lstatProc;./*
fed0: 20 43 61 6c 6c 65 64 20 62 79 20 27 54 63 6c 5f   Called by 'Tcl_
fee0: 46 53 4c 73 74 61 74 28 29 27 2e 20 49 66 20 4e  FSLstat()'. If N
fef0: 55 4c 4c 2c 20 54 63 6c 0a 09 09 09 09 20 2a 20  ULL, Tcl..... * 
ff00: 61 74 74 65 6d 70 74 73 20 74 6f 20 75 73 65 20  attempts to use 
ff10: 27 73 74 61 74 50 72 6f 63 27 20 69 6e 73 74 65  'statProc' inste
ff20: 61 64 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46  ad. */.    Tcl_F
ff30: 53 4c 6f 61 64 46 69 6c 65 50 72 6f 63 20 2a 6c  SLoadFileProc *l
ff40: 6f 61 64 46 69 6c 65 50 72 6f 63 3b 0a 09 09 09  oadFileProc;....
ff50: 09 2f 2a 20 43 61 6c 6c 65 64 20 62 79 20 27 54  ./* Called by 'T
ff60: 63 6c 5f 46 53 4c 6f 61 64 46 69 6c 65 28 29 27  cl_FSLoadFile()'
ff70: 2e 20 49 66 20 4e 55 4c 4c 2c 20 54 63 6c 0a 09  . If NULL, Tcl..
ff80: 09 09 09 20 2a 20 70 65 72 66 6f 72 6d 73 20 61  ... * performs a
ff90: 20 63 6f 70 79 20 74 6f 20 61 20 74 65 6d 70 6f   copy to a tempo
ffa0: 72 61 72 79 20 66 69 6c 65 20 69 6e 20 74 68 65  rary file in the
ffb0: 0a 09 09 09 09 20 2a 20 6e 61 74 69 76 65 20 66  ..... * native f
ffc0: 69 6c 65 73 79 73 74 65 6d 20 61 6e 64 20 74 68  ilesystem and th
ffd0: 65 6e 20 63 61 6c 6c 73 0a 09 09 09 09 20 2a 20  en calls..... * 
ffe0: 54 63 6c 5f 46 53 4c 6f 61 64 46 69 6c 65 28 29  Tcl_FSLoadFile()
fff0: 20 6f 6e 20 74 68 61 74 20 74 65 6d 70 6f 72 61   on that tempora
10000 72 79 20 63 6f 70 79 2e 20 2a 2f 0a 20 20 20 20  ry copy. */.    
10010 54 63 6c 5f 46 53 47 65 74 43 77 64 50 72 6f 63  Tcl_FSGetCwdProc
10020 20 2a 67 65 74 43 77 64 50 72 6f 63 3b 0a 09 09   *getCwdProc;...
10030 09 09 2f 2a 20 43 61 6c 6c 65 64 20 62 79 20 27  ../* Called by '
10040 54 63 6c 5f 46 53 47 65 74 43 77 64 28 29 27 2e  Tcl_FSGetCwd()'.
10050 20 20 4e 6f 72 6d 61 6c 6c 79 20 4e 55 4c 4c 2e    Normally NULL.
10060 0a 09 09 09 09 20 2a 20 55 73 75 61 6c 6c 79 20  ..... * Usually 
10070 6f 6e 6c 79 20 63 61 6c 6c 65 64 20 6f 6e 63 65  only called once
10080 3a 20 20 49 66 20 27 67 65 74 63 77 64 27 20 69  :  If 'getcwd' i
10090 73 0a 09 09 09 09 20 2a 20 63 61 6c 6c 65 64 20  s..... * called 
100a0 62 65 66 6f 72 65 20 27 63 68 64 69 72 27 20 69  before 'chdir' i
100b0 73 20 65 76 65 72 20 63 61 6c 6c 65 64 2e 20 2a  s ever called. *
100c0 2f 0a 20 20 20 20 54 63 6c 5f 46 53 43 68 64 69  /.    Tcl_FSChdi
100d0 72 50 72 6f 63 20 2a 63 68 64 69 72 50 72 6f 63  rProc *chdirProc
100e0 3b 09 2f 2a 20 43 61 6c 6c 65 64 20 62 79 20 27  ;./* Called by '
100f0 54 63 6c 5f 46 53 43 68 64 69 72 28 29 27 2e 20  Tcl_FSChdir()'. 
10100 20 46 6f 72 20 61 20 76 69 72 74 75 61 6c 0a 09   For a virtual..
10110 09 09 09 20 2a 20 66 69 6c 65 73 79 73 74 65 6d  ... * filesystem
10120 2c 20 63 68 64 69 72 50 72 6f 63 20 6a 75 73 74  , chdirProc just
10130 20 72 65 74 75 72 6e 73 20 7a 65 72 6f 0a 09 09   returns zero...
10140 09 09 20 2a 20 28 73 75 63 63 65 73 73 29 20 69  .. * (success) i
10150 66 20 74 68 65 20 70 61 74 68 6e 61 6d 65 20 69  f the pathname i
10160 73 20 61 20 76 61 6c 69 64 0a 09 09 09 09 20 2a  s a valid..... *
10170 20 64 69 72 65 63 74 6f 72 79 2c 20 61 6e 64 20   directory, and 
10180 73 6f 6d 65 20 6f 74 68 65 72 20 76 61 6c 75 65  some other value
10190 20 6f 74 68 65 72 77 69 73 65 2e 0a 09 09 09 09   otherwise......
101a0 20 2a 20 46 6f 72 20 41 20 72 65 61 6c 20 66 69   * For A real fi
101b0 6c 65 73 79 73 74 65 6d 2c 20 63 68 64 69 72 50  lesystem, chdirP
101c0 72 6f 63 20 70 65 72 66 6f 72 6d 73 0a 09 09 09  roc performs....
101d0 09 20 2a 20 74 68 65 20 63 6f 72 72 65 63 74 20  . * the correct 
101e0 61 63 74 69 6f 6e 2c 20 65 2e 67 2e 20 20 63 61  action, e.g.  ca
101f0 6c 6c 73 20 74 68 65 20 73 79 73 74 65 6d 0a 09  lls the system..
10200 09 09 09 20 2a 20 27 63 68 64 69 72 27 20 66 75  ... * 'chdir' fu
10210 6e 63 74 69 6f 6e 2e 20 49 66 20 6e 6f 74 20 69  nction. If not i
10220 6d 70 6c 65 6d 65 6e 74 65 64 2c 20 74 68 65 6e  mplemented, then
10230 0a 09 09 09 09 20 2a 20 27 63 64 27 20 61 6e 64  ..... * 'cd' and
10240 20 27 70 77 64 27 20 66 61 69 6c 20 66 6f 72 20   'pwd' fail for 
10250 61 20 70 61 74 68 6e 61 6d 65 20 69 6e 20 74 68  a pathname in th
10260 69 73 0a 09 09 09 09 20 2a 20 66 69 6c 65 73 79  is..... * filesy
10270 73 74 65 6d 2e 20 4f 6e 20 73 75 63 63 65 73 73  stem. On success
10280 20 54 63 6c 20 73 74 6f 72 65 73 20 74 68 65 0a   Tcl stores the.
10290 09 09 09 09 20 2a 20 70 61 74 68 6e 61 6d 65 20  .... * pathname 
102a0 66 6f 72 20 75 73 65 20 62 79 20 47 65 74 43 77  for use by GetCw
102b0 64 2e 20 20 49 66 20 4e 55 4c 4c 2c 20 54 63 6c  d.  If NULL, Tcl
102c0 0a 09 09 09 09 20 2a 20 70 65 72 66 6f 72 6d 73  ..... * performs
102d0 20 72 65 63 6f 72 64 73 20 74 68 65 20 70 61 74   records the pat
102e0 68 6e 61 6d 65 20 61 73 20 74 68 65 20 6e 65 77  hname as the new
102f0 0a 09 09 09 09 20 2a 20 63 75 72 72 65 6e 74 20  ..... * current 
10300 64 69 72 65 63 74 6f 72 79 20 69 66 20 69 74 20  directory if it 
10310 70 61 73 73 65 73 20 61 20 73 65 72 69 65 73 20  passes a series 
10320 6f 66 0a 09 09 09 09 20 2a 20 64 69 72 65 63 74  of..... * direct
10330 6f 72 79 20 61 63 63 65 73 73 20 63 68 65 63 6b  ory access check
10340 73 2e 20 2a 2f 0a 7d 20 54 63 6c 5f 46 69 6c 65  s. */.} Tcl_File
10350 73 79 73 74 65 6d 3b 0a 0a 2f 2a 0a 20 2a 20 54  system;../*. * T
10360 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 64 65 66  he following def
10370 69 6e 69 74 69 6f 6e 73 20 61 72 65 20 75 73 65  initions are use
10380 64 20 61 73 20 76 61 6c 75 65 73 20 66 6f 72 20  d as values for 
10390 74 68 65 20 27 6c 69 6e 6b 41 63 74 69 6f 6e 27  the 'linkAction'
103a0 20 66 6c 61 67 20 74 6f 0a 20 2a 20 54 63 6c 5f   flag to. * Tcl_
103b0 46 53 4c 69 6e 6b 2c 20 6f 72 20 74 68 65 20 6c  FSLink, or the l
103c0 69 6e 6b 50 72 6f 63 20 6f 66 20 61 6e 79 20 66  inkProc of any f
103d0 69 6c 65 73 79 73 74 65 6d 2e 20 41 6e 79 20 63  ilesystem. Any c
103e0 6f 6d 62 69 6e 61 74 69 6f 6e 20 6f 66 20 66 6c  ombination of fl
103f0 61 67 73 20 63 61 6e 0a 20 2a 20 62 65 20 67 69  ags can. * be gi
10400 76 65 6e 2e 20 46 6f 72 20 6c 69 6e 6b 20 63 72  ven. For link cr
10410 65 61 74 69 6f 6e 2c 20 74 68 65 20 6c 69 6e 6b  eation, the link
10420 50 72 6f 63 20 73 68 6f 75 6c 64 20 63 72 65 61  Proc should crea
10430 74 65 20 61 20 6c 69 6e 6b 20 77 68 69 63 68 0a  te a link which.
10440 20 2a 20 6d 61 74 63 68 65 73 20 61 6e 79 20 6f   * matches any o
10450 66 20 74 68 65 20 74 79 70 65 73 20 67 69 76 65  f the types give
10460 6e 2e 0a 20 2a 0a 20 2a 20 54 43 4c 5f 43 52 45  n.. *. * TCL_CRE
10470 41 54 45 5f 53 59 4d 42 4f 4c 49 43 5f 4c 49 4e  ATE_SYMBOLIC_LIN
10480 4b 20 2d 09 43 72 65 61 74 65 20 61 20 73 79 6d  K -.Create a sym
10490 62 6f 6c 69 63 20 6f 72 20 73 6f 66 74 20 6c 69  bolic or soft li
104a0 6e 6b 2e 0a 20 2a 20 54 43 4c 5f 43 52 45 41 54  nk.. * TCL_CREAT
104b0 45 5f 48 41 52 44 5f 4c 49 4e 4b 20 2d 09 43 72  E_HARD_LINK -.Cr
104c0 65 61 74 65 20 61 20 68 61 72 64 20 6c 69 6e 6b  eate a hard link
104d0 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54  .. */..#define T
104e0 43 4c 5f 43 52 45 41 54 45 5f 53 59 4d 42 4f 4c  CL_CREATE_SYMBOL
104f0 49 43 5f 4c 49 4e 4b 09 30 78 30 31 0a 23 64 65  IC_LINK.0x01.#de
10500 66 69 6e 65 20 54 43 4c 5f 43 52 45 41 54 45 5f  fine TCL_CREATE_
10510 48 41 52 44 5f 4c 49 4e 4b 09 09 30 78 30 32 0a  HARD_LINK..0x02.
10520 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ./*. *----------
10530 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
10540 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
10550 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
10560 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
10570 2d 2d 0a 20 2a 20 54 68 65 20 66 6f 6c 6c 6f 77  --. * The follow
10580 69 6e 67 20 73 74 72 75 63 74 75 72 65 20 72 65  ing structure re
10590 70 72 65 73 65 6e 74 73 20 74 68 65 20 4e 6f 74  presents the Not
105a0 69 66 69 65 72 20 66 75 6e 63 74 69 6f 6e 73 20  ifier functions 
105b0 74 68 61 74 20 79 6f 75 20 63 61 6e 0a 20 2a 20  that you can. * 
105c0 6f 76 65 72 72 69 64 65 20 77 69 74 68 20 74 68  override with th
105d0 65 20 54 63 6c 5f 53 65 74 4e 6f 74 69 66 69 65  e Tcl_SetNotifie
105e0 72 20 63 61 6c 6c 2e 0a 20 2a 2f 0a 0a 74 79 70  r call.. */..typ
105f0 65 64 65 66 20 73 74 72 75 63 74 20 54 63 6c 5f  edef struct Tcl_
10600 4e 6f 74 69 66 69 65 72 50 72 6f 63 73 20 7b 0a  NotifierProcs {.
10610 20 20 20 20 54 63 6c 5f 53 65 74 54 69 6d 65 72      Tcl_SetTimer
10620 50 72 6f 63 20 2a 73 65 74 54 69 6d 65 72 50 72  Proc *setTimerPr
10630 6f 63 3b 0a 20 20 20 20 54 63 6c 5f 57 61 69 74  oc;.    Tcl_Wait
10640 46 6f 72 45 76 65 6e 74 50 72 6f 63 20 2a 77 61  ForEventProc *wa
10650 69 74 46 6f 72 45 76 65 6e 74 50 72 6f 63 3b 0a  itForEventProc;.
10660 20 20 20 20 54 63 6c 5f 43 72 65 61 74 65 46 69      Tcl_CreateFi
10670 6c 65 48 61 6e 64 6c 65 72 50 72 6f 63 20 2a 63  leHandlerProc *c
10680 72 65 61 74 65 46 69 6c 65 48 61 6e 64 6c 65 72  reateFileHandler
10690 50 72 6f 63 3b 0a 20 20 20 20 54 63 6c 5f 44 65  Proc;.    Tcl_De
106a0 6c 65 74 65 46 69 6c 65 48 61 6e 64 6c 65 72 50  leteFileHandlerP
106b0 72 6f 63 20 2a 64 65 6c 65 74 65 46 69 6c 65 48  roc *deleteFileH
106c0 61 6e 64 6c 65 72 50 72 6f 63 3b 0a 20 20 20 20  andlerProc;.    
106d0 54 63 6c 5f 49 6e 69 74 4e 6f 74 69 66 69 65 72  Tcl_InitNotifier
106e0 50 72 6f 63 20 2a 69 6e 69 74 4e 6f 74 69 66 69  Proc *initNotifi
106f0 65 72 50 72 6f 63 3b 0a 20 20 20 20 54 63 6c 5f  erProc;.    Tcl_
10700 46 69 6e 61 6c 69 7a 65 4e 6f 74 69 66 69 65 72  FinalizeNotifier
10710 50 72 6f 63 20 2a 66 69 6e 61 6c 69 7a 65 4e 6f  Proc *finalizeNo
10720 74 69 66 69 65 72 50 72 6f 63 3b 0a 20 20 20 20  tifierProc;.    
10730 54 63 6c 5f 41 6c 65 72 74 4e 6f 74 69 66 69 65  Tcl_AlertNotifie
10740 72 50 72 6f 63 20 2a 61 6c 65 72 74 4e 6f 74 69  rProc *alertNoti
10750 66 69 65 72 50 72 6f 63 3b 0a 20 20 20 20 54 63  fierProc;.    Tc
10760 6c 5f 53 65 72 76 69 63 65 4d 6f 64 65 48 6f 6f  l_ServiceModeHoo
10770 6b 50 72 6f 63 20 2a 73 65 72 76 69 63 65 4d 6f  kProc *serviceMo
10780 64 65 48 6f 6f 6b 50 72 6f 63 3b 0a 7d 20 54 63  deHookProc;.} Tc
10790 6c 5f 4e 6f 74 69 66 69 65 72 50 72 6f 63 73 3b  l_NotifierProcs;
107a0 0a 0c 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d  .../*. *--------
107b0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
107c0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
107d0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
107e0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
107f0 2d 2d 2d 2d 0a 20 2a 20 54 68 65 20 66 6f 6c 6c  ----. * The foll
10800 6f 77 69 6e 67 20 64 61 74 61 20 73 74 72 75 63  owing data struc
10810 74 75 72 65 73 20 61 6e 64 20 64 65 63 6c 61 72  tures and declar
10820 61 74 69 6f 6e 73 20 61 72 65 20 66 6f 72 20 74  ations are for t
10830 68 65 20 6e 65 77 20 54 63 6c 20 70 61 72 73 65  he new Tcl parse
10840 72 2e 0a 20 2a 0a 20 2a 20 46 6f 72 20 65 61 63  r.. *. * For eac
10850 68 20 77 6f 72 64 20 6f 66 20 61 20 63 6f 6d 6d  h word of a comm
10860 61 6e 64 2c 20 61 6e 64 20 66 6f 72 20 65 61 63  and, and for eac
10870 68 20 70 69 65 63 65 20 6f 66 20 61 20 77 6f 72  h piece of a wor
10880 64 20 73 75 63 68 20 61 73 20 61 20 76 61 72 69  d such as a vari
10890 61 62 6c 65 0a 20 2a 20 72 65 66 65 72 65 6e 63  able. * referenc
108a0 65 2c 20 6f 6e 65 20 6f 66 20 74 68 65 20 66 6f  e, one of the fo
108b0 6c 6c 6f 77 69 6e 67 20 73 74 72 75 63 74 75 72  llowing structur
108c0 65 73 20 69 73 20 63 72 65 61 74 65 64 20 74 6f  es is created to
108d0 20 64 65 73 63 72 69 62 65 20 74 68 65 0a 20 2a   describe the. *
108e0 20 74 6f 6b 65 6e 2e 0a 20 2a 2f 0a 0a 74 79 70   token.. */..typ
108f0 65 64 65 66 20 73 74 72 75 63 74 20 54 63 6c 5f  edef struct Tcl_
10900 54 6f 6b 65 6e 20 7b 0a 20 20 20 20 69 6e 74 20  Token {.    int 
10910 74 79 70 65 3b 09 09 09 2f 2a 20 54 79 70 65 20  type;.../* Type 
10920 6f 66 20 74 6f 6b 65 6e 2c 20 73 75 63 68 20 61  of token, such a
10930 73 20 54 43 4c 5f 54 4f 4b 45 4e 5f 57 4f 52 44  s TCL_TOKEN_WORD
10940 3b 20 73 65 65 0a 09 09 09 09 20 2a 20 62 65 6c  ; see..... * bel
10950 6f 77 20 66 6f 72 20 76 61 6c 69 64 20 74 79 70  ow for valid typ
10960 65 73 2e 20 2a 2f 0a 20 20 20 20 63 6f 6e 73 74  es. */.    const
10970 20 63 68 61 72 20 2a 73 74 61 72 74 3b 09 09 2f   char *start;../
10980 2a 20 46 69 72 73 74 20 63 68 61 72 61 63 74 65  * First characte
10990 72 20 69 6e 20 74 6f 6b 65 6e 2e 20 2a 2f 0a 20  r in token. */. 
109a0 20 20 20 69 6e 74 20 73 69 7a 65 3b 09 09 09 2f     int size;.../
109b0 2a 20 4e 75 6d 62 65 72 20 6f 66 20 62 79 74 65  * Number of byte
109c0 73 20 69 6e 20 74 6f 6b 65 6e 2e 20 2a 2f 0a 20  s in token. */. 
109d0 20 20 20 69 6e 74 20 6e 75 6d 43 6f 6d 70 6f 6e     int numCompon
109e0 65 6e 74 73 3b 09 09 2f 2a 20 49 66 20 74 68 69  ents;../* If thi
109f0 73 20 74 6f 6b 65 6e 20 69 73 20 63 6f 6d 70 6f  s token is compo
10a00 73 65 64 20 6f 66 20 6f 74 68 65 72 20 74 6f 6b  sed of other tok
10a10 65 6e 73 2c 0a 09 09 09 09 20 2a 20 74 68 69 73  ens,..... * this
10a20 20 66 69 65 6c 64 20 74 65 6c 6c 73 20 68 6f 77   field tells how
10a30 20 6d 61 6e 79 20 6f 66 20 74 68 65 6d 20 74 68   many of them th
10a40 65 72 65 20 61 72 65 0a 09 09 09 09 20 2a 20 28  ere are..... * (
10a50 69 6e 63 6c 75 64 69 6e 67 20 63 6f 6d 70 6f 6e  including compon
10a60 65 6e 74 73 20 6f 66 20 63 6f 6d 70 6f 6e 65 6e  ents of componen
10a70 74 73 2c 20 65 74 63 2e 29 2e 0a 09 09 09 09 20  ts, etc.)...... 
10a80 2a 20 54 68 65 20 63 6f 6d 70 6f 6e 65 6e 74 20  * The component 
10a90 74 6f 6b 65 6e 73 20 69 6d 6d 65 64 69 61 74 65  tokens immediate
10aa0 6c 79 20 66 6f 6c 6c 6f 77 0a 09 09 09 09 20 2a  ly follow..... *
10ab0 20 74 68 69 73 20 6f 6e 65 2e 20 2a 2f 0a 7d 20   this one. */.} 
10ac0 54 63 6c 5f 54 6f 6b 65 6e 3b 0a 0a 2f 2a 0a 20  Tcl_Token;../*. 
10ad0 2a 20 54 79 70 65 20 76 61 6c 75 65 73 20 64 65  * Type values de
10ae0 66 69 6e 65 64 20 66 6f 72 20 54 63 6c 5f 54 6f  fined for Tcl_To
10af0 6b 65 6e 20 73 74 72 75 63 74 75 72 65 73 2e 20  ken structures. 
10b00 54 68 65 73 65 20 76 61 6c 75 65 73 20 61 72 65  These values are
10b10 20 64 65 66 69 6e 65 64 20 61 73 0a 20 2a 20 6d   defined as. * m
10b20 61 73 6b 20 62 69 74 73 20 73 6f 20 74 68 61 74  ask bits so that
10b30 20 69 74 27 73 20 65 61 73 79 20 74 6f 20 63 68   it's easy to ch
10b40 65 63 6b 20 66 6f 72 20 63 6f 6c 6c 65 63 74 69  eck for collecti
10b50 6f 6e 73 20 6f 66 20 74 79 70 65 73 2e 0a 20 2a  ons of types.. *
10b60 0a 20 2a 20 54 43 4c 5f 54 4f 4b 45 4e 5f 57 4f  . * TCL_TOKEN_WO
10b70 52 44 20 2d 09 09 54 68 65 20 74 6f 6b 65 6e 20  RD -..The token 
10b80 64 65 73 63 72 69 62 65 73 20 6f 6e 65 20 77 6f  describes one wo
10b90 72 64 20 6f 66 20 61 20 63 6f 6d 6d 61 6e 64 2c  rd of a command,
10ba0 0a 20 2a 09 09 09 09 66 72 6f 6d 20 74 68 65 20  . *....from the 
10bb0 66 69 72 73 74 20 6e 6f 6e 2d 62 6c 61 6e 6b 20  first non-blank 
10bc0 63 68 61 72 61 63 74 65 72 20 6f 66 20 74 68 65  character of the
10bd0 20 77 6f 72 64 0a 20 2a 09 09 09 09 28 77 68 69   word. *....(whi
10be0 63 68 20 6d 61 79 20 62 65 20 22 20 6f 72 20 7b  ch may be " or {
10bf0 29 20 75 70 20 74 6f 20 62 75 74 20 6e 6f 74 20  ) up to but not 
10c00 69 6e 63 6c 75 64 69 6e 67 0a 20 2a 09 09 09 09  including. *....
10c10 74 68 65 20 73 70 61 63 65 2c 20 73 65 6d 69 63  the space, semic
10c20 6f 6c 6f 6e 2c 20 6f 72 20 62 72 61 63 6b 65 74  olon, or bracket
10c30 20 74 68 61 74 0a 20 2a 09 09 09 09 74 65 72 6d   that. *....term
10c40 69 6e 61 74 65 73 20 74 68 65 20 77 6f 72 64 2e  inates the word.
10c50 20 4e 75 6d 43 6f 6d 70 6f 6e 65 6e 74 73 20 63   NumComponents c
10c60 6f 75 6e 74 73 20 74 68 65 0a 20 2a 09 09 09 09  ounts the. *....
10c70 74 6f 74 61 6c 20 6e 75 6d 62 65 72 20 6f 66 20  total number of 
10c80 73 75 62 2d 74 6f 6b 65 6e 73 20 74 68 61 74 20  sub-tokens that 
10c90 6d 61 6b 65 20 75 70 20 74 68 65 0a 20 2a 09 09  make up the. *..
10ca0 09 09 77 6f 72 64 2e 20 54 68 69 73 20 69 6e 63  ..word. This inc
10cb0 6c 75 64 65 73 2c 20 66 6f 72 20 65 78 61 6d 70  ludes, for examp
10cc0 6c 65 2c 20 73 75 62 2d 74 6f 6b 65 6e 73 0a 20  le, sub-tokens. 
10cd0 2a 09 09 09 09 6f 66 20 54 43 4c 5f 54 4f 4b 45  *....of TCL_TOKE
10ce0 4e 5f 56 41 52 49 41 42 4c 45 20 74 6f 6b 65 6e  N_VARIABLE token
10cf0 73 2e 0a 20 2a 20 54 43 4c 5f 54 4f 4b 45 4e 5f  s.. * TCL_TOKEN_
10d00 53 49 4d 50 4c 45 5f 57 4f 52 44 20 2d 09 54 68  SIMPLE_WORD -.Th
10d10 69 73 20 74 6f 6b 65 6e 20 69 73 20 6a 75 73 74  is token is just
10d20 20 6c 69 6b 65 20 54 43 4c 5f 54 4f 4b 45 4e 5f   like TCL_TOKEN_
10d30 57 4f 52 44 20 65 78 63 65 70 74 0a 20 2a 09 09  WORD except. *..
10d40 09 09 74 68 61 74 20 74 68 65 20 77 6f 72 64 20  ..that the word 
10d50 69 73 20 67 75 61 72 61 6e 74 65 65 64 20 74 6f  is guaranteed to
10d60 20 63 6f 6e 73 69 73 74 20 6f 66 20 61 0a 20 2a   consist of a. *
10d70 09 09 09 09 73 69 6e 67 6c 65 20 54 43 4c 5f 54  ....single TCL_T
10d80 4f 4b 45 4e 5f 54 45 58 54 20 73 75 62 2d 74 6f  OKEN_TEXT sub-to
10d90 6b 65 6e 2e 0a 20 2a 20 54 43 4c 5f 54 4f 4b 45  ken.. * TCL_TOKE
10da0 4e 5f 54 45 58 54 20 2d 09 09 54 68 65 20 74 6f  N_TEXT -..The to
10db0 6b 65 6e 20 64 65 73 63 72 69 62 65 73 20 61 20  ken describes a 
10dc0 72 61 6e 67 65 20 6f 66 20 6c 69 74 65 72 61 6c  range of literal
10dd0 20 74 65 78 74 0a 20 2a 09 09 09 09 74 68 61 74   text. *....that
10de0 20 69 73 20 70 61 72 74 20 6f 66 20 61 20 77 6f   is part of a wo
10df0 72 64 2e 20 4e 75 6d 43 6f 6d 70 6f 6e 65 6e 74  rd. NumComponent
10e00 73 20 69 73 0a 20 2a 09 09 09 09 61 6c 77 61 79  s is. *....alway
10e10 73 20 30 2e 0a 20 2a 20 54 43 4c 5f 54 4f 4b 45  s 0.. * TCL_TOKE
10e20 4e 5f 42 53 20 2d 09 09 54 68 65 20 74 6f 6b 65  N_BS -..The toke
10e30 6e 20 64 65 73 63 72 69 62 65 73 20 61 20 62 61  n describes a ba
10e40 63 6b 73 6c 61 73 68 20 73 65 71 75 65 6e 63 65  ckslash sequence
10e50 20 74 68 61 74 0a 20 2a 09 09 09 09 6d 75 73 74   that. *....must
10e60 20 62 65 20 63 6f 6c 6c 61 70 73 65 64 2e 20 4e   be collapsed. N
10e70 75 6d 43 6f 6d 70 6f 6e 65 6e 74 73 20 69 73 20  umComponents is 
10e80 61 6c 77 61 79 73 20 30 2e 0a 20 2a 20 54 43 4c  always 0.. * TCL
10e90 5f 54 4f 4b 45 4e 5f 43 4f 4d 4d 41 4e 44 20 2d  _TOKEN_COMMAND -
10ea0 09 09 54 68 65 20 74 6f 6b 65 6e 20 64 65 73 63  ..The token desc
10eb0 72 69 62 65 73 20 61 20 63 6f 6d 6d 61 6e 64 20  ribes a command 
10ec0 77 68 6f 73 65 20 72 65 73 75 6c 74 0a 20 2a 09  whose result. *.
10ed0 09 09 09 6d 75 73 74 20 62 65 20 73 75 62 73 74  ...must be subst
10ee0 69 74 75 74 65 64 20 69 6e 74 6f 20 74 68 65 20  ituted into the 
10ef0 77 6f 72 64 2e 20 54 68 65 20 74 6f 6b 65 6e 0a  word. The token.
10f00 20 2a 09 09 09 09 69 6e 63 6c 75 64 65 73 20 74   *....includes t
10f10 68 65 20 65 6e 63 6c 6f 73 69 6e 67 20 62 72 61  he enclosing bra
10f20 63 6b 65 74 73 2e 20 4e 75 6d 43 6f 6d 70 6f 6e  ckets. NumCompon
10f30 65 6e 74 73 0a 20 2a 09 09 09 09 69 73 20 61 6c  ents. *....is al
10f40 77 61 79 73 20 30 2e 0a 20 2a 20 54 43 4c 5f 54  ways 0.. * TCL_T
10f50 4f 4b 45 4e 5f 56 41 52 49 41 42 4c 45 20 2d 09  OKEN_VARIABLE -.
10f60 09 54 68 65 20 74 6f 6b 65 6e 20 64 65 73 63 72  .The token descr
10f70 69 62 65 73 20 61 20 76 61 72 69 61 62 6c 65 20  ibes a variable 
10f80 73 75 62 73 74 69 74 75 74 69 6f 6e 2c 0a 20 2a  substitution,. *
10f90 09 09 09 09 69 6e 63 6c 75 64 69 6e 67 20 74 68  ....including th
10fa0 65 20 64 6f 6c 6c 61 72 20 73 69 67 6e 2c 20 76  e dollar sign, v
10fb0 61 72 69 61 62 6c 65 20 6e 61 6d 65 2c 20 61 6e  ariable name, an
10fc0 64 0a 20 2a 09 09 09 09 61 72 72 61 79 20 69 6e  d. *....array in
10fd0 64 65 78 20 28 69 66 20 74 68 65 72 65 20 69 73  dex (if there is
10fe0 20 6f 6e 65 29 20 75 70 20 74 68 72 6f 75 67 68   one) up through
10ff0 20 74 68 65 0a 20 2a 09 09 09 09 72 69 67 68 74   the. *....right
11000 20 70 61 72 65 6e 74 68 65 73 65 73 2e 20 4e 75   parentheses. Nu
11010 6d 43 6f 6d 70 6f 6e 65 6e 74 73 20 74 65 6c 6c  mComponents tell
11020 73 20 68 6f 77 0a 20 2a 09 09 09 09 6d 61 6e 79  s how. *....many
11030 20 61 64 64 69 74 69 6f 6e 61 6c 20 74 6f 6b 65   additional toke
11040 6e 73 20 66 6f 6c 6c 6f 77 20 74 6f 20 72 65 70  ns follow to rep
11050 72 65 73 65 6e 74 20 74 68 65 0a 20 2a 09 09 09  resent the. *...
11060 09 76 61 72 69 61 62 6c 65 20 6e 61 6d 65 2e 20  .variable name. 
11070 54 68 65 20 66 69 72 73 74 20 74 6f 6b 65 6e 20  The first token 
11080 77 69 6c 6c 20 62 65 20 61 0a 20 2a 09 09 09 09  will be a. *....
11090 54 43 4c 5f 54 4f 4b 45 4e 5f 54 45 58 54 20 74  TCL_TOKEN_TEXT t
110a0 6f 6b 65 6e 20 74 68 61 74 20 64 65 73 63 72 69  oken that descri
110b0 62 65 73 20 74 68 65 0a 20 2a 09 09 09 09 76 61  bes the. *....va
110c0 72 69 61 62 6c 65 20 6e 61 6d 65 2e 20 49 66 20  riable name. If 
110d0 74 68 65 20 76 61 72 69 61 62 6c 65 20 69 73 20  the variable is 
110e0 61 6e 20 61 72 72 61 79 0a 20 2a 09 09 09 09 72  an array. *....r
110f0 65 66 65 72 65 6e 63 65 20 74 68 65 6e 20 74 68  eference then th
11100 65 72 65 20 77 69 6c 6c 20 62 65 20 6f 6e 65 20  ere will be one 
11110 6f 72 20 6d 6f 72 65 0a 20 2a 09 09 09 09 61 64  or more. *....ad
11120 64 69 74 69 6f 6e 61 6c 20 74 6f 6b 65 6e 73 2c  ditional tokens,
11130 20 6f 66 20 74 79 70 65 20 54 43 4c 5f 54 4f 4b   of type TCL_TOK
11140 45 4e 5f 54 45 58 54 2c 0a 20 2a 09 09 09 09 54  EN_TEXT,. *....T
11150 43 4c 5f 54 4f 4b 45 4e 5f 42 53 2c 20 54 43 4c  CL_TOKEN_BS, TCL
11160 5f 54 4f 4b 45 4e 5f 43 4f 4d 4d 41 4e 44 2c 20  _TOKEN_COMMAND, 
11170 61 6e 64 0a 20 2a 09 09 09 09 54 43 4c 5f 54 4f  and. *....TCL_TO
11180 4b 45 4e 5f 56 41 52 49 41 42 4c 45 2c 20 74 68  KEN_VARIABLE, th
11190 61 74 20 64 65 73 63 72 69 62 65 20 74 68 65 20  at describe the 
111a0 61 72 72 61 79 0a 20 2a 09 09 09 09 69 6e 64 65  array. *....inde
111b0 78 3b 20 6e 75 6d 43 6f 6d 70 6f 6e 65 6e 74 73  x; numComponents
111c0 20 63 6f 75 6e 74 73 20 74 68 65 20 74 6f 74 61   counts the tota
111d0 6c 20 6e 75 6d 62 65 72 0a 20 2a 09 09 09 09 6f  l number. *....o
111e0 66 20 6e 65 73 74 65 64 20 74 6f 6b 65 6e 73 20  f nested tokens 
111f0 74 68 61 74 20 6d 61 6b 65 20 75 70 20 74 68 65  that make up the
11200 20 76 61 72 69 61 62 6c 65 0a 20 2a 09 09 09 09   variable. *....
11210 72 65 66 65 72 65 6e 63 65 2c 20 69 6e 63 6c 75  reference, inclu
11220 64 69 6e 67 20 73 75 62 2d 74 6f 6b 65 6e 73 20  ding sub-tokens 
11230 6f 66 0a 20 2a 09 09 09 09 54 43 4c 5f 54 4f 4b  of. *....TCL_TOK
11240 45 4e 5f 56 41 52 49 41 42 4c 45 20 74 6f 6b 65  EN_VARIABLE toke
11250 6e 73 2e 0a 20 2a 20 54 43 4c 5f 54 4f 4b 45 4e  ns.. * TCL_TOKEN
11260 5f 53 55 42 5f 45 58 50 52 20 2d 09 09 54 68 65  _SUB_EXPR -..The
11270 20 74 6f 6b 65 6e 20 64 65 73 63 72 69 62 65 73   token describes
11280 20 6f 6e 65 20 73 75 62 65 78 70 72 65 73 73 69   one subexpressi
11290 6f 6e 20 6f 66 20 61 6e 0a 20 2a 09 09 09 09 65  on of an. *....e
112a0 78 70 72 65 73 73 69 6f 6e 2c 20 66 72 6f 6d 20  xpression, from 
112b0 74 68 65 20 66 69 72 73 74 20 6e 6f 6e 2d 62 6c  the first non-bl
112c0 61 6e 6b 20 63 68 61 72 61 63 74 65 72 0a 20 2a  ank character. *
112d0 09 09 09 09 6f 66 20 74 68 65 20 73 75 62 65 78  ....of the subex
112e0 70 72 65 73 73 69 6f 6e 20 75 70 20 74 6f 20 62  pression up to b
112f0 75 74 20 6e 6f 74 20 69 6e 63 6c 75 64 69 6e 67  ut not including
11300 0a 20 2a 09 09 09 09 74 68 65 20 73 70 61 63 65  . *....the space
11310 2c 20 62 72 61 63 65 2c 20 6f 72 20 62 72 61 63  , brace, or brac
11320 6b 65 74 20 74 68 61 74 20 74 65 72 6d 69 6e 61  ket that termina
11330 74 65 73 0a 20 2a 09 09 09 09 74 68 65 20 73 75  tes. *....the su
11340 62 65 78 70 72 65 73 73 69 6f 6e 2e 20 4e 75 6d  bexpression. Num
11350 43 6f 6d 70 6f 6e 65 6e 74 73 20 63 6f 75 6e 74  Components count
11360 73 20 74 68 65 0a 20 2a 09 09 09 09 74 6f 74 61  s the. *....tota
11370 6c 20 6e 75 6d 62 65 72 20 6f 66 20 66 6f 6c 6c  l number of foll
11380 6f 77 69 6e 67 20 73 75 62 74 6f 6b 65 6e 73 20  owing subtokens 
11390 74 68 61 74 20 6d 61 6b 65 0a 20 2a 09 09 09 09  that make. *....
113a0 75 70 20 74 68 65 20 73 75 62 65 78 70 72 65 73  up the subexpres
113b0 73 69 6f 6e 3b 20 74 68 69 73 20 69 6e 63 6c 75  sion; this inclu
113c0 64 65 73 20 61 6c 6c 0a 20 2a 09 09 09 09 73 75  des all. *....su
113d0 62 74 6f 6b 65 6e 73 20 66 6f 72 20 61 6e 79 20  btokens for any 
113e0 6e 65 73 74 65 64 20 54 43 4c 5f 54 4f 4b 45 4e  nested TCL_TOKEN
113f0 5f 53 55 42 5f 45 58 50 52 0a 20 2a 09 09 09 09  _SUB_EXPR. *....
11400 74 6f 6b 65 6e 73 2e 20 46 6f 72 20 65 78 61 6d  tokens. For exam
11410 70 6c 65 2c 20 61 20 6e 75 6d 65 72 69 63 20 76  ple, a numeric v
11420 61 6c 75 65 20 75 73 65 64 20 61 73 20 61 0a 20  alue used as a. 
11430 2a 09 09 09 09 70 72 69 6d 69 74 69 76 65 20 6f  *....primitive o
11440 70 65 72 61 6e 64 20 69 73 20 64 65 73 63 72 69  perand is descri
11450 62 65 64 20 62 79 20 61 0a 20 2a 09 09 09 09 54  bed by a. *....T
11460 43 4c 5f 54 4f 4b 45 4e 5f 53 55 42 5f 45 58 50  CL_TOKEN_SUB_EXP
11470 52 20 74 6f 6b 65 6e 20 66 6f 6c 6c 6f 77 65 64  R token followed
11480 20 62 79 20 61 0a 20 2a 09 09 09 09 54 43 4c 5f   by a. *....TCL_
11490 54 4f 4b 45 4e 5f 54 45 58 54 20 74 6f 6b 65 6e  TOKEN_TEXT token
114a0 2e 20 41 20 62 69 6e 61 72 79 20 73 75 62 65 78  . A binary subex
114b0 70 72 65 73 73 69 6f 6e 0a 20 2a 09 09 09 09 69  pression. *....i
114c0 73 20 64 65 73 63 72 69 62 65 64 20 62 79 20 61  s described by a
114d0 20 54 43 4c 5f 54 4f 4b 45 4e 5f 53 55 42 5f 45   TCL_TOKEN_SUB_E
114e0 58 50 52 20 74 6f 6b 65 6e 0a 20 2a 09 09 09 09  XPR token. *....
114f0 66 6f 6c 6c 6f 77 65 64 20 62 79 20 74 68 65 20  followed by the 
11500 54 43 4c 5f 54 4f 4b 45 4e 5f 4f 50 45 52 41 54  TCL_TOKEN_OPERAT
11510 4f 52 20 74 6f 6b 65 6e 20 66 6f 72 0a 20 2a 09  OR token for. *.
11520 09 09 09 74 68 65 20 6f 70 65 72 61 74 6f 72 2c  ...the operator,
11530 20 74 68 65 6e 20 54 43 4c 5f 54 4f 4b 45 4e 5f   then TCL_TOKEN_
11540 53 55 42 5f 45 58 50 52 20 74 6f 6b 65 6e 73 0a  SUB_EXPR tokens.
11550 20 2a 09 09 09 09 66 6f 72 20 74 68 65 20 6c 65   *....for the le
11560 66 74 20 74 68 65 6e 20 74 68 65 20 72 69 67 68  ft then the righ
11570 74 20 6f 70 65 72 61 6e 64 73 2e 0a 20 2a 20 54  t operands.. * T
11580 43 4c 5f 54 4f 4b 45 4e 5f 4f 50 45 52 41 54 4f  CL_TOKEN_OPERATO
11590 52 20 2d 09 09 54 68 65 20 74 6f 6b 65 6e 20 64  R -..The token d
115a0 65 73 63 72 69 62 65 73 20 6f 6e 65 20 65 78 70  escribes one exp
115b0 72 65 73 73 69 6f 6e 20 6f 70 65 72 61 74 6f 72  ression operator
115c0 2e 0a 20 2a 09 09 09 09 41 6e 20 6f 70 65 72 61  .. *....An opera
115d0 74 6f 72 20 6d 69 67 68 74 20 62 65 20 74 68 65  tor might be the
115e0 20 6e 61 6d 65 20 6f 66 20 61 20 6d 61 74 68 0a   name of a math.
115f0 20 2a 09 09 09 09 66 75 6e 63 74 69 6f 6e 20 73   *....function s
11600 75 63 68 20 61 73 20 22 61 62 73 22 2e 20 41 20  uch as "abs". A 
11610 54 43 4c 5f 54 4f 4b 45 4e 5f 4f 50 45 52 41 54  TCL_TOKEN_OPERAT
11620 4f 52 0a 20 2a 09 09 09 09 74 6f 6b 65 6e 20 69  OR. *....token i
11630 73 20 61 6c 77 61 79 73 20 70 72 65 63 65 64 65  s always precede
11640 64 20 62 79 20 6f 6e 65 0a 20 2a 09 09 09 09 54  d by one. *....T
11650 43 4c 5f 54 4f 4b 45 4e 5f 53 55 42 5f 45 58 50  CL_TOKEN_SUB_EXP
11660 52 20 74 6f 6b 65 6e 20 66 6f 72 20 74 68 65 20  R token for the 
11670 6f 70 65 72 61 74 6f 72 27 73 0a 20 2a 09 09 09  operator's. *...
11680 09 73 75 62 65 78 70 72 65 73 73 69 6f 6e 2c 20  .subexpression, 
11690 61 6e 64 20 69 73 20 66 6f 6c 6c 6f 77 65 64 20  and is followed 
116a0 62 79 20 7a 65 72 6f 20 6f 72 20 6d 6f 72 65 0a  by zero or more.
116b0 20 2a 09 09 09 09 54 43 4c 5f 54 4f 4b 45 4e 5f   *....TCL_TOKEN_
116c0 53 55 42 5f 45 58 50 52 20 74 6f 6b 65 6e 73 20  SUB_EXPR tokens 
116d0 66 6f 72 20 74 68 65 20 6f 70 65 72 61 74 6f 72  for the operator
116e0 27 73 0a 20 2a 09 09 09 09 6f 70 65 72 61 6e 64  's. *....operand
116f0 73 2e 20 4e 75 6d 43 6f 6d 70 6f 6e 65 6e 74 73  s. NumComponents
11700 20 69 73 20 61 6c 77 61 79 73 20 30 2e 0a 20 2a   is always 0.. *
11710 20 54 43 4c 5f 54 4f 4b 45 4e 5f 45 58 50 41 4e   TCL_TOKEN_EXPAN
11720 44 5f 57 4f 52 44 20 2d 09 54 68 69 73 20 74 6f  D_WORD -.This to
11730 6b 65 6e 20 69 73 20 6a 75 73 74 20 6c 69 6b 65  ken is just like
11740 20 54 43 4c 5f 54 4f 4b 45 4e 5f 57 4f 52 44 20   TCL_TOKEN_WORD 
11750 65 78 63 65 70 74 0a 20 2a 09 09 09 09 74 68 61  except. *....tha
11760 74 20 69 74 20 6d 61 72 6b 73 20 61 20 77 6f 72  t it marks a wor
11770 64 20 74 68 61 74 20 62 65 67 61 6e 20 77 69 74  d that began wit
11780 68 20 74 68 65 0a 20 2a 09 09 09 09 6c 69 74 65  h the. *....lite
11790 72 61 6c 20 63 68 61 72 61 63 74 65 72 20 70 72  ral character pr
117a0 65 66 69 78 20 22 7b 2a 7d 22 2e 20 54 68 69 73  efix "{*}". This
117b0 20 77 6f 72 64 20 69 73 0a 20 2a 09 09 09 09 6d   word is. *....m
117c0 61 72 6b 65 64 20 74 6f 20 62 65 20 65 78 70 61  arked to be expa
117d0 6e 64 65 64 20 2d 20 74 68 61 74 20 69 73 2c 20  nded - that is, 
117e0 62 72 6f 6b 65 6e 20 69 6e 74 6f 0a 20 2a 09 09  broken into. *..
117f0 09 09 77 6f 72 64 73 20 61 66 74 65 72 20 73 75  ..words after su
11800 62 73 74 69 74 75 74 69 6f 6e 20 69 73 20 63 6f  bstitution is co
11810 6d 70 6c 65 74 65 2e 0a 20 2a 2f 0a 0a 23 64 65  mplete.. */..#de
11820 66 69 6e 65 20 54 43 4c 5f 54 4f 4b 45 4e 5f 57  fine TCL_TOKEN_W
11830 4f 52 44 09 09 31 0a 23 64 65 66 69 6e 65 20 54  ORD..1.#define T
11840 43 4c 5f 54 4f 4b 45 4e 5f 53 49 4d 50 4c 45 5f  CL_TOKEN_SIMPLE_
11850 57 4f 52 44 09 32 0a 23 64 65 66 69 6e 65 20 54  WORD.2.#define T
11860 43 4c 5f 54 4f 4b 45 4e 5f 54 45 58 54 09 09 34  CL_TOKEN_TEXT..4
11870 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 54 4f 4b  .#define TCL_TOK
11880 45 4e 5f 42 53 09 09 38 0a 23 64 65 66 69 6e 65  EN_BS..8.#define
11890 20 54 43 4c 5f 54 4f 4b 45 4e 5f 43 4f 4d 4d 41   TCL_TOKEN_COMMA
118a0 4e 44 09 31 36 0a 23 64 65 66 69 6e 65 20 54 43  ND.16.#define TC
118b0 4c 5f 54 4f 4b 45 4e 5f 56 41 52 49 41 42 4c 45  L_TOKEN_VARIABLE
118c0 09 33 32 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f  .32.#define TCL_
118d0 54 4f 4b 45 4e 5f 53 55 42 5f 45 58 50 52 09 36  TOKEN_SUB_EXPR.6
118e0 34 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 54 4f  4.#define TCL_TO
118f0 4b 45 4e 5f 4f 50 45 52 41 54 4f 52 09 31 32 38  KEN_OPERATOR.128
11900 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 54 4f 4b  .#define TCL_TOK
11910 45 4e 5f 45 58 50 41 4e 44 5f 57 4f 52 44 09 32  EN_EXPAND_WORD.2
11920 35 36 0a 0a 2f 2a 0a 20 2a 20 50 61 72 73 69 6e  56../*. * Parsin
11930 67 20 65 72 72 6f 72 20 74 79 70 65 73 2e 20 4f  g error types. O
11940 6e 20 61 6e 79 20 70 61 72 73 69 6e 67 20 65 72  n any parsing er
11950 72 6f 72 2c 20 6f 6e 65 20 6f 66 20 74 68 65 73  ror, one of thes
11960 65 20 76 61 6c 75 65 73 20 77 69 6c 6c 20 62 65  e values will be
11970 0a 20 2a 20 73 74 6f 72 65 64 20 69 6e 20 74 68  . * stored in th
11980 65 20 65 72 72 6f 72 20 66 69 65 6c 64 20 6f 66  e error field of
11990 20 74 68 65 20 54 63 6c 5f 50 61 72 73 65 20 73   the Tcl_Parse s
119a0 74 72 75 63 74 75 72 65 20 64 65 66 69 6e 65 64  tructure defined
119b0 20 62 65 6c 6f 77 2e 0a 20 2a 2f 0a 0a 23 64 65   below.. */..#de
119c0 66 69 6e 65 20 54 43 4c 5f 50 41 52 53 45 5f 53  fine TCL_PARSE_S
119d0 55 43 43 45 53 53 09 09 30 0a 23 64 65 66 69 6e  UCCESS..0.#defin
119e0 65 20 54 43 4c 5f 50 41 52 53 45 5f 51 55 4f 54  e TCL_PARSE_QUOT
119f0 45 5f 45 58 54 52 41 09 09 31 0a 23 64 65 66 69  E_EXTRA..1.#defi
11a00 6e 65 20 54 43 4c 5f 50 41 52 53 45 5f 42 52 41  ne TCL_PARSE_BRA
11a10 43 45 5f 45 58 54 52 41 09 09 32 0a 23 64 65 66  CE_EXTRA..2.#def
11a20 69 6e 65 20 54 43 4c 5f 50 41 52 53 45 5f 4d 49  ine TCL_PARSE_MI
11a30 53 53 49 4e 47 5f 42 52 41 43 45 09 09 33 0a 23  SSING_BRACE..3.#
11a40 64 65 66 69 6e 65 20 54 43 4c 5f 50 41 52 53 45  define TCL_PARSE
11a50 5f 4d 49 53 53 49 4e 47 5f 42 52 41 43 4b 45 54  _MISSING_BRACKET
11a60 09 34 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 50  .4.#define TCL_P
11a70 41 52 53 45 5f 4d 49 53 53 49 4e 47 5f 50 41 52  ARSE_MISSING_PAR
11a80 45 4e 09 09 35 0a 23 64 65 66 69 6e 65 20 54 43  EN..5.#define TC
11a90 4c 5f 50 41 52 53 45 5f 4d 49 53 53 49 4e 47 5f  L_PARSE_MISSING_
11aa0 51 55 4f 54 45 09 09 36 0a 23 64 65 66 69 6e 65  QUOTE..6.#define
11ab0 20 54 43 4c 5f 50 41 52 53 45 5f 4d 49 53 53 49   TCL_PARSE_MISSI
11ac0 4e 47 5f 56 41 52 5f 42 52 41 43 45 09 37 0a 23  NG_VAR_BRACE.7.#
11ad0 64 65 66 69 6e 65 20 54 43 4c 5f 50 41 52 53 45  define TCL_PARSE
11ae0 5f 53 59 4e 54 41 58 09 09 38 0a 23 64 65 66 69  _SYNTAX..8.#defi
11af0 6e 65 20 54 43 4c 5f 50 41 52 53 45 5f 42 41 44  ne TCL_PARSE_BAD
11b00 5f 4e 55 4d 42 45 52 09 09 39 0a 0a 2f 2a 0a 20  _NUMBER..9../*. 
11b10 2a 20 41 20 73 74 72 75 63 74 75 72 65 20 6f 66  * A structure of
11b20 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 74   the following t
11b30 79 70 65 20 69 73 20 66 69 6c 6c 65 64 20 69 6e  ype is filled in
11b40 20 62 79 20 54 63 6c 5f 50 61 72 73 65 43 6f 6d   by Tcl_ParseCom
11b50 6d 61 6e 64 2e 20 49 74 0a 20 2a 20 64 65 73 63  mand. It. * desc
11b60 72 69 62 65 73 20 61 20 73 69 6e 67 6c 65 20 63  ribes a single c
11b70 6f 6d 6d 61 6e 64 20 70 61 72 73 65 64 20 66 72  ommand parsed fr
11b80 6f 6d 20 61 6e 20 69 6e 70 75 74 20 73 74 72 69  om an input stri
11b90 6e 67 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65  ng.. */..#define
11ba0 20 4e 55 4d 5f 53 54 41 54 49 43 5f 54 4f 4b 45   NUM_STATIC_TOKE
11bb0 4e 53 20 32 30 0a 0a 74 79 70 65 64 65 66 20 73  NS 20..typedef s
11bc0 74 72 75 63 74 20 54 63 6c 5f 50 61 72 73 65 20  truct Tcl_Parse 
11bd0 7b 0a 20 20 20 20 63 6f 6e 73 74 20 63 68 61 72  {.    const char
11be0 20 2a 63 6f 6d 6d 65 6e 74 53 74 61 72 74 3b 09   *commentStart;.
11bf0 2f 2a 20 50 6f 69 6e 74 65 72 20 74 6f 20 23 20  /* Pointer to # 
11c00 74 68 61 74 20 62 65 67 69 6e 73 20 74 68 65 20  that begins the 
11c10 66 69 72 73 74 20 6f 66 20 6f 6e 65 0a 09 09 09  first of one....
11c20 09 20 2a 20 6f 72 20 6d 6f 72 65 20 63 6f 6d 6d  . * or more comm
11c30 65 6e 74 73 20 70 72 65 63 65 64 69 6e 67 20 74  ents preceding t
11c40 68 65 20 63 6f 6d 6d 61 6e 64 2e 20 2a 2f 0a 20  he command. */. 
11c50 20 20 20 69 6e 74 20 63 6f 6d 6d 65 6e 74 53 69     int commentSi
11c60 7a 65 3b 09 09 2f 2a 20 4e 75 6d 62 65 72 20 6f  ze;../* Number o
11c70 66 20 62 79 74 65 73 20 69 6e 20 63 6f 6d 6d 65  f bytes in comme
11c80 6e 74 73 20 28 75 70 20 74 68 72 6f 75 67 68 0a  nts (up through.
11c90 09 09 09 09 20 2a 20 6e 65 77 6c 69 6e 65 20 63  .... * newline c
11ca0 68 61 72 61 63 74 65 72 20 74 68 61 74 20 74 65  haracter that te
11cb0 72 6d 69 6e 61 74 65 73 20 74 68 65 20 6c 61 73  rminates the las
11cc0 74 0a 09 09 09 09 20 2a 20 63 6f 6d 6d 65 6e 74  t..... * comment
11cd0 29 2e 20 49 66 20 74 68 65 72 65 20 77 65 72 65  ). If there were
11ce0 20 6e 6f 20 63 6f 6d 6d 65 6e 74 73 2c 20 74 68   no comments, th
11cf0 69 73 0a 09 09 09 09 20 2a 20 66 69 65 6c 64 20  is..... * field 
11d00 69 73 20 30 2e 20 2a 2f 0a 20 20 20 20 63 6f 6e  is 0. */.    con
11d10 73 74 20 63 68 61 72 20 2a 63 6f 6d 6d 61 6e 64  st char *command
11d20 53 74 61 72 74 3b 09 2f 2a 20 46 69 72 73 74 20  Start;./* First 
11d30 63 68 61 72 61 63 74 65 72 20 69 6e 20 66 69 72  character in fir
11d40 73 74 20 77 6f 72 64 20 6f 66 0a 09 09 09 09 20  st word of..... 
11d50 2a 20 63 6f 6d 6d 61 6e 64 2e 20 2a 2f 0a 20 20  * command. */.  
11d60 20 20 69 6e 74 20 63 6f 6d 6d 61 6e 64 53 69 7a    int commandSiz
11d70 65 3b 09 09 2f 2a 20 4e 75 6d 62 65 72 20 6f 66  e;../* Number of
11d80 20 62 79 74 65 73 20 69 6e 20 63 6f 6d 6d 61 6e   bytes in comman
11d90 64 2c 20 69 6e 63 6c 75 64 69 6e 67 20 66 69 72  d, including fir
11da0 73 74 0a 09 09 09 09 20 2a 20 63 68 61 72 61 63  st..... * charac
11db0 74 65 72 20 6f 66 20 66 69 72 73 74 20 77 6f 72  ter of first wor
11dc0 64 2c 20 75 70 20 74 68 72 6f 75 67 68 20 74 68  d, up through th
11dd0 65 0a 09 09 09 09 20 2a 20 74 65 72 6d 69 6e 61  e..... * termina
11de0 74 69 6e 67 20 6e 65 77 6c 69 6e 65 2c 20 63 6c  ting newline, cl
11df0 6f 73 65 20 62 72 61 63 6b 65 74 2c 20 6f 72 0a  ose bracket, or.
11e00 09 09 09 09 20 2a 20 73 65 6d 69 63 6f 6c 6f 6e  .... * semicolon
11e10 2e 20 2a 2f 0a 20 20 20 20 69 6e 74 20 6e 75 6d  . */.    int num
11e20 57 6f 72 64 73 3b 09 09 2f 2a 20 54 6f 74 61 6c  Words;../* Total
11e30 20 6e 75 6d 62 65 72 20 6f 66 20 77 6f 72 64 73   number of words
11e40 20 69 6e 20 63 6f 6d 6d 61 6e 64 2e 20 4d 61 79   in command. May
11e50 20 62 65 0a 09 09 09 09 20 2a 20 30 2e 20 2a 2f   be..... * 0. */
11e60 0a 20 20 20 20 54 63 6c 5f 54 6f 6b 65 6e 20 2a  .    Tcl_Token *
11e70 74 6f 6b 65 6e 50 74 72 3b 09 2f 2a 20 50 6f 69  tokenPtr;./* Poi
11e80 6e 74 65 72 20 74 6f 20 66 69 72 73 74 20 74 6f  nter to first to
11e90 6b 65 6e 20 72 65 70 72 65 73 65 6e 74 69 6e 67  ken representing
11ea0 20 74 68 65 0a 09 09 09 09 20 2a 20 77 6f 72 64   the..... * word
11eb0 73 20 6f 66 20 74 68 65 20 63 6f 6d 6d 61 6e 64  s of the command
11ec0 2e 20 49 6e 69 74 69 61 6c 6c 79 20 70 6f 69 6e  . Initially poin
11ed0 74 73 20 74 6f 0a 09 09 09 09 20 2a 20 73 74 61  ts to..... * sta
11ee0 74 69 63 54 6f 6b 65 6e 73 2c 20 62 75 74 20 6d  ticTokens, but m
11ef0 61 79 20 63 68 61 6e 67 65 20 74 6f 20 70 6f 69  ay change to poi
11f00 6e 74 20 74 6f 0a 09 09 09 09 20 2a 20 6d 61 6c  nt to..... * mal
11f10 6c 6f 63 2d 65 64 20 73 70 61 63 65 20 69 66 20  loc-ed space if 
11f20 63 6f 6d 6d 61 6e 64 20 65 78 63 65 65 64 73 20  command exceeds 
11f30 73 70 61 63 65 20 69 6e 0a 09 09 09 09 20 2a 20  space in..... * 
11f40 73 74 61 74 69 63 54 6f 6b 65 6e 73 2e 20 2a 2f  staticTokens. */
11f50 0a 20 20 20 20 69 6e 74 20 6e 75 6d 54 6f 6b 65  .    int numToke
11f60 6e 73 3b 09 09 2f 2a 20 54 6f 74 61 6c 20 6e 75  ns;../* Total nu
11f70 6d 62 65 72 20 6f 66 20 74 6f 6b 65 6e 73 20 69  mber of tokens i
11f80 6e 20 63 6f 6d 6d 61 6e 64 2e 20 2a 2f 0a 20 20  n command. */.  
11f90 20 20 69 6e 74 20 74 6f 6b 65 6e 73 41 76 61 69    int tokensAvai
11fa0 6c 61 62 6c 65 3b 09 2f 2a 20 54 6f 74 61 6c 20  lable;./* Total 
11fb0 6e 75 6d 62 65 72 20 6f 66 20 74 6f 6b 65 6e 73  number of tokens
11fc0 20 61 76 61 69 6c 61 62 6c 65 20 61 74 0a 09 09   available at...
11fd0 09 09 20 2a 20 2a 74 6f 6b 65 6e 50 74 72 2e 20  .. * *tokenPtr. 
11fe0 2a 2f 0a 20 20 20 20 69 6e 74 20 65 72 72 6f 72  */.    int error
11ff0 54 79 70 65 3b 09 09 2f 2a 20 4f 6e 65 20 6f 66  Type;../* One of
12000 20 74 68 65 20 70 61 72 73 69 6e 67 20 65 72 72   the parsing err
12010 6f 72 20 74 79 70 65 73 20 64 65 66 69 6e 65 64  or types defined
12020 0a 09 09 09 09 20 2a 20 61 62 6f 76 65 2e 20 2a  ..... * above. *
12030 2f 0a 0a 20 20 20 20 2f 2a 0a 20 20 20 20 20 2a  /..    /*.     *
12040 20 54 68 65 20 66 69 65 6c 64 73 20 62 65 6c 6f   The fields belo
12050 77 20 61 72 65 20 69 6e 74 65 6e 64 65 64 20 6f  w are intended o
12060 6e 6c 79 20 66 6f 72 20 74 68 65 20 70 72 69 76  nly for the priv
12070 61 74 65 20 75 73 65 20 6f 66 20 74 68 65 20 70  ate use of the p
12080 61 72 73 65 72 2e 0a 20 20 20 20 20 2a 20 54 68  arser..     * Th
12090 65 79 20 73 68 6f 75 6c 64 20 6e 6f 74 20 62 65  ey should not be
120a0 20 75 73 65 64 20 62 79 20 66 75 6e 63 74 69 6f   used by functio
120b0 6e 73 20 74 68 61 74 20 69 6e 76 6f 6b 65 20 54  ns that invoke T
120c0 63 6c 5f 50 61 72 73 65 43 6f 6d 6d 61 6e 64 2e  cl_ParseCommand.
120d0 0a 20 20 20 20 20 2a 2f 0a 0a 20 20 20 20 63 6f  .     */..    co
120e0 6e 73 74 20 63 68 61 72 20 2a 73 74 72 69 6e 67  nst char *string
120f0 3b 09 09 2f 2a 20 54 68 65 20 6f 72 69 67 69 6e  ;../* The origin
12100 61 6c 20 63 6f 6d 6d 61 6e 64 20 73 74 72 69 6e  al command strin
12110 67 20 70 61 73 73 65 64 20 74 6f 0a 09 09 09 09  g passed to.....
12120 20 2a 20 54 63 6c 5f 50 61 72 73 65 43 6f 6d 6d   * Tcl_ParseComm
12130 61 6e 64 2e 20 2a 2f 0a 20 20 20 20 63 6f 6e 73  and. */.    cons
12140 74 20 63 68 61 72 20 2a 65 6e 64 3b 09 09 2f 2a  t char *end;../*
12150 20 50 6f 69 6e 74 73 20 74 6f 20 74 68 65 20 63   Points to the c
12160 68 61 72 61 63 74 65 72 20 6a 75 73 74 20 61 66  haracter just af
12170 74 65 72 20 74 68 65 20 6c 61 73 74 0a 09 09 09  ter the last....
12180 09 20 2a 20 6f 6e 65 20 69 6e 20 74 68 65 20 63  . * one in the c
12190 6f 6d 6d 61 6e 64 20 73 74 72 69 6e 67 2e 20 2a  ommand string. *
121a0 2f 0a 20 20 20 20 54 63 6c 5f 49 6e 74 65 72 70  /.    Tcl_Interp
121b0 20 2a 69 6e 74 65 72 70 3b 09 09 2f 2a 20 49 6e   *interp;../* In
121c0 74 65 72 70 72 65 74 65 72 20 74 6f 20 75 73 65  terpreter to use
121d0 20 66 6f 72 20 65 72 72 6f 72 20 72 65 70 6f 72   for error repor
121e0 74 69 6e 67 2c 20 6f 72 0a 09 09 09 09 20 2a 20  ting, or..... * 
121f0 4e 55 4c 4c 2e 20 2a 2f 0a 20 20 20 20 63 6f 6e  NULL. */.    con
12200 73 74 20 63 68 61 72 20 2a 74 65 72 6d 3b 09 09  st char *term;..
12210 2f 2a 20 50 6f 69 6e 74 73 20 74 6f 20 63 68 61  /* Points to cha
12220 72 61 63 74 65 72 20 69 6e 20 73 74 72 69 6e 67  racter in string
12230 20 74 68 61 74 0a 09 09 09 09 20 2a 20 74 65 72   that..... * ter
12240 6d 69 6e 61 74 65 64 20 6d 6f 73 74 20 72 65 63  minated most rec
12250 65 6e 74 20 74 6f 6b 65 6e 2e 20 46 69 6c 6c 65  ent token. Fille
12260 64 20 69 6e 20 62 79 0a 09 09 09 09 20 2a 20 50  d in by..... * P
12270 61 72 73 65 54 6f 6b 65 6e 73 2e 20 49 66 20 61  arseTokens. If a
12280 6e 20 65 72 72 6f 72 20 6f 63 63 75 72 73 2c 20  n error occurs, 
12290 70 6f 69 6e 74 73 20 74 6f 0a 09 09 09 09 20 2a  points to..... *
122a0 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 72 65   beginning of re
122b0 67 69 6f 6e 20 77 68 65 72 65 20 74 68 65 20 65  gion where the e
122c0 72 72 6f 72 0a 09 09 09 09 20 2a 20 6f 63 63 75  rror..... * occu
122d0 72 72 65 64 20 28 65 2e 67 2e 20 74 68 65 20 6f  rred (e.g. the o
122e0 70 65 6e 20 62 72 61 63 65 20 69 66 20 74 68 65  pen brace if the
122f0 20 63 6c 6f 73 65 0a 09 09 09 09 20 2a 20 62 72   close..... * br
12300 61 63 65 20 69 73 20 6d 69 73 73 69 6e 67 29 2e  ace is missing).
12310 20 2a 2f 0a 20 20 20 20 69 6e 74 20 69 6e 63 6f   */.    int inco
12320 6d 70 6c 65 74 65 3b 09 09 2f 2a 20 54 68 69 73  mplete;../* This
12330 20 66 69 65 6c 64 20 69 73 20 73 65 74 20 74 6f   field is set to
12340 20 31 20 62 79 20 54 63 6c 5f 50 61 72 73 65 43   1 by Tcl_ParseC
12350 6f 6d 6d 61 6e 64 0a 09 09 09 09 20 2a 20 69 66  ommand..... * if
12360 20 74 68 65 20 63 6f 6d 6d 61 6e 64 20 61 70 70   the command app
12370 65 61 72 73 20 74 6f 20 62 65 20 69 6e 63 6f 6d  ears to be incom
12380 70 6c 65 74 65 2e 0a 09 09 09 09 20 2a 20 54 68  plete...... * Th
12390 69 73 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 69  is information i
123a0 73 20 75 73 65 64 20 62 79 0a 09 09 09 09 20 2a  s used by..... *
123b0 20 54 63 6c 5f 43 6f 6d 6d 61 6e 64 43 6f 6d 70   Tcl_CommandComp
123c0 6c 65 74 65 2e 20 2a 2f 0a 20 20 20 20 54 63 6c  lete. */.    Tcl
123d0 5f 54 6f 6b 65 6e 20 73 74 61 74 69 63 54 6f 6b  _Token staticTok
123e0 65 6e 73 5b 4e 55 4d 5f 53 54 41 54 49 43 5f 54  ens[NUM_STATIC_T
123f0 4f 4b 45 4e 53 5d 3b 0a 09 09 09 09 2f 2a 20 49  OKENS];...../* I
12400 6e 69 74 69 61 6c 20 73 70 61 63 65 20 66 6f 72  nitial space for
12410 20 74 6f 6b 65 6e 73 20 66 6f 72 20 63 6f 6d 6d   tokens for comm
12420 61 6e 64 2e 20 54 68 69 73 0a 09 09 09 09 20 2a  and. This..... *
12430 20 73 70 61 63 65 20 73 68 6f 75 6c 64 20 62 65   space should be
12440 20 6c 61 72 67 65 20 65 6e 6f 75 67 68 20 74 6f   large enough to
12450 20 61 63 63 6f 6d 6d 6f 64 61 74 65 0a 09 09 09   accommodate....
12460 09 20 2a 20 6d 6f 73 74 20 63 6f 6d 6d 61 6e 64  . * most command
12470 73 3b 20 64 79 6e 61 6d 69 63 20 73 70 61 63 65  s; dynamic space
12480 20 69 73 20 61 6c 6c 6f 63 61 74 65 64 0a 09 09   is allocated...
12490 09 09 20 2a 20 66 6f 72 20 76 65 72 79 20 6c 61  .. * for very la
124a0 72 67 65 20 63 6f 6d 6d 61 6e 64 73 20 74 68 61  rge commands tha
124b0 74 20 64 6f 6e 27 74 20 66 69 74 0a 09 09 09 09  t don't fit.....
124c0 20 2a 20 68 65 72 65 2e 20 2a 2f 0a 7d 20 54 63   * here. */.} Tc
124d0 6c 5f 50 61 72 73 65 3b 0a 0c 0a 2f 2a 0a 20 2a  l_Parse;.../*. *
124e0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
124f0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
12500 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
12510 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
12520 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20  ------------. * 
12530 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 73 74  The following st
12540 72 75 63 74 75 72 65 20 72 65 70 72 65 73 65 6e  ructure represen
12550 74 73 20 61 20 75 73 65 72 2d 64 65 66 69 6e 65  ts a user-define
12560 64 20 65 6e 63 6f 64 69 6e 67 2e 20 49 74 20 63  d encoding. It c
12570 6f 6c 6c 65 63 74 73 0a 20 2a 20 74 6f 67 65 74  ollects. * toget
12580 68 65 72 20 61 6c 6c 20 74 68 65 20 66 75 6e 63  her all the func
12590 74 69 6f 6e 73 20 74 68 61 74 20 61 72 65 20 75  tions that are u
125a0 73 65 64 20 62 79 20 74 68 65 20 73 70 65 63 69  sed by the speci
125b0 66 69 63 20 65 6e 63 6f 64 69 6e 67 2e 0a 20 2a  fic encoding.. *
125c0 2f 0a 0a 74 79 70 65 64 65 66 20 73 74 72 75 63  /..typedef struc
125d0 74 20 54 63 6c 5f 45 6e 63 6f 64 69 6e 67 54 79  t Tcl_EncodingTy
125e0 70 65 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 63  pe {.    const c
125f0 68 61 72 20 2a 65 6e 63 6f 64 69 6e 67 4e 61 6d  har *encodingNam
12600 65 3b 09 2f 2a 20 54 68 65 20 6e 61 6d 65 20 6f  e;./* The name o
12610 66 20 74 68 65 20 65 6e 63 6f 64 69 6e 67 2c 20  f the encoding, 
12620 65 2e 67 2e 20 22 65 75 63 2d 6a 70 22 2e 0a 09  e.g. "euc-jp"...
12630 09 09 09 20 2a 20 54 68 69 73 20 6e 61 6d 65 20  ... * This name 
12640 69 73 20 74 68 65 20 75 6e 69 71 75 65 20 6b 65  is the unique ke
12650 79 20 66 6f 72 20 74 68 69 73 0a 09 09 09 09 20  y for this..... 
12660 2a 20 65 6e 63 6f 64 69 6e 67 20 74 79 70 65 2e  * encoding type.
12670 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 45 6e 63 6f   */.    Tcl_Enco
12680 64 69 6e 67 43 6f 6e 76 65 72 74 50 72 6f 63 20  dingConvertProc 
12690 2a 74 6f 55 74 66 50 72 6f 63 3b 0a 09 09 09 09  *toUtfProc;.....
126a0 2f 2a 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 63  /* Function to c
126b0 6f 6e 76 65 72 74 20 66 72 6f 6d 20 65 78 74 65  onvert from exte
126c0 72 6e 61 6c 20 65 6e 63 6f 64 69 6e 67 0a 09 09  rnal encoding...
126d0 09 09 20 2a 20 69 6e 74 6f 20 55 54 46 2d 38 2e  .. * into UTF-8.
126e0 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 45 6e 63 6f   */.    Tcl_Enco
126f0 64 69 6e 67 43 6f 6e 76 65 72 74 50 72 6f 63 20  dingConvertProc 
12700 2a 66 72 6f 6d 55 74 66 50 72 6f 63 3b 0a 09 09  *fromUtfProc;...
12710 09 09 2f 2a 20 46 75 6e 63 74 69 6f 6e 20 74 6f  ../* Function to
12720 20 63 6f 6e 76 65 72 74 20 66 72 6f 6d 20 55 54   convert from UT
12730 46 2d 38 20 69 6e 74 6f 0a 09 09 09 09 20 2a 20  F-8 into..... * 
12740 65 78 74 65 72 6e 61 6c 20 65 6e 63 6f 64 69 6e  external encodin
12750 67 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 45 6e  g. */.    Tcl_En
12760 63 6f 64 69 6e 67 46 72 65 65 50 72 6f 63 20 2a  codingFreeProc *
12770 66 72 65 65 50 72 6f 63 3b 0a 09 09 09 09 2f 2a  freeProc;...../*
12780 20 49 66 20 6e 6f 6e 2d 4e 55 4c 4c 2c 20 66 75   If non-NULL, fu
12790 6e 63 74 69 6f 6e 20 74 6f 20 63 61 6c 6c 20 77  nction to call w
127a0 68 65 6e 20 74 68 69 73 0a 09 09 09 09 20 2a 20  hen this..... * 
127b0 65 6e 63 6f 64 69 6e 67 20 69 73 20 64 65 6c 65  encoding is dele
127c0 74 65 64 2e 20 2a 2f 0a 20 20 20 20 43 6c 69 65  ted. */.    Clie
127d0 6e 74 44 61 74 61 20 63 6c 69 65 6e 74 44 61 74  ntData clientDat
127e0 61 3b 09 2f 2a 20 41 72 62 69 74 72 61 72 79 20  a;./* Arbitrary 
127f0 76 61 6c 75 65 20 61 73 73 6f 63 69 61 74 65 64  value associated
12800 20 77 69 74 68 20 65 6e 63 6f 64 69 6e 67 0a 09   with encoding..
12810 09 09 09 20 2a 20 74 79 70 65 2e 20 50 61 73 73  ... * type. Pass
12820 65 64 20 74 6f 20 63 6f 6e 76 65 72 73 69 6f 6e  ed to conversion
12830 20 66 75 6e 63 74 69 6f 6e 73 2e 20 2a 2f 0a 20   functions. */. 
12840 20 20 20 69 6e 74 20 6e 75 6c 6c 53 69 7a 65 3b     int nullSize;
12850 09 09 2f 2a 20 4e 75 6d 62 65 72 20 6f 66 20 7a  ../* Number of z
12860 65 72 6f 20 62 79 74 65 73 20 74 68 61 74 20 73  ero bytes that s
12870 69 67 6e 69 66 79 0a 09 09 09 09 20 2a 20 65 6e  ignify..... * en
12880 64 2d 6f 66 2d 73 74 72 69 6e 67 20 69 6e 20 74  d-of-string in t
12890 68 69 73 20 65 6e 63 6f 64 69 6e 67 2e 20 54 68  his encoding. Th
128a0 69 73 20 6e 75 6d 62 65 72 0a 09 09 09 09 20 2a  is number..... *
128b0 20 69 73 20 75 73 65 64 20 74 6f 20 64 65 74 65   is used to dete
128c0 72 6d 69 6e 65 20 74 68 65 20 73 6f 75 72 63 65  rmine the source
128d0 20 73 74 72 69 6e 67 0a 09 09 09 09 20 2a 20 6c   string..... * l
128e0 65 6e 67 74 68 20 77 68 65 6e 20 74 68 65 20 73  ength when the s
128f0 72 63 4c 65 6e 20 61 72 67 75 6d 65 6e 74 20 69  rcLen argument i
12900 73 0a 09 09 09 09 20 2a 20 6e 65 67 61 74 69 76  s..... * negativ
12910 65 2e 20 4d 75 73 74 20 62 65 20 31 20 6f 72 20  e. Must be 1 or 
12920 32 2e 20 2a 2f 0a 7d 20 54 63 6c 5f 45 6e 63 6f  2. */.} Tcl_Enco
12930 64 69 6e 67 54 79 70 65 3b 0a 0a 2f 2a 0a 20 2a  dingType;../*. *
12940 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 64   The following d
12950 65 66 69 6e 69 74 69 6f 6e 73 20 61 72 65 20 75  efinitions are u
12960 73 65 64 20 61 73 20 76 61 6c 75 65 73 20 66 6f  sed as values fo
12970 72 20 74 68 65 20 63 6f 6e 76 65 72 73 69 6f 6e  r the conversion
12980 20 63 6f 6e 74 72 6f 6c 0a 20 2a 20 66 6c 61 67   control. * flag
12990 73 20 61 72 67 75 6d 65 6e 74 20 77 68 65 6e 20  s argument when 
129a0 63 6f 6e 76 65 72 74 69 6e 67 20 74 65 78 74 20  converting text 
129b0 66 72 6f 6d 20 6f 6e 65 20 63 68 61 72 61 63 74  from one charact
129c0 65 72 20 73 65 74 20 74 6f 20 61 6e 6f 74 68 65  er set to anothe
129d0 72 3a 0a 20 2a 0a 20 2a 20 54 43 4c 5f 45 4e 43  r:. *. * TCL_ENC
129e0 4f 44 49 4e 47 5f 53 54 41 52 54 20 2d 09 09 53  ODING_START -..S
129f0 69 67 6e 69 66 69 65 73 20 74 68 61 74 20 74 68  ignifies that th
12a00 65 20 73 6f 75 72 63 65 20 62 75 66 66 65 72 20  e source buffer 
12a10 69 73 20 74 68 65 20 66 69 72 73 74 0a 20 2a 09  is the first. *.
12a20 09 09 09 62 6c 6f 63 6b 20 69 6e 20 61 20 28 70  ...block in a (p
12a30 6f 74 65 6e 74 69 61 6c 6c 79 20 6d 75 6c 74 69  otentially multi
12a40 2d 62 6c 6f 63 6b 29 20 69 6e 70 75 74 0a 20 2a  -block) input. *
12a50 09 09 09 09 73 74 72 65 61 6d 2e 20 54 65 6c 6c  ....stream. Tell
12a60 73 20 74 68 65 20 63 6f 6e 76 65 72 73 69 6f 6e  s the conversion
12a70 20 66 75 6e 63 74 69 6f 6e 20 74 6f 20 72 65 73   function to res
12a80 65 74 0a 20 2a 09 09 09 09 74 6f 20 61 6e 20 69  et. *....to an i
12a90 6e 69 74 69 61 6c 20 73 74 61 74 65 20 61 6e 64  nitial state and
12aa0 20 70 65 72 66 6f 72 6d 20 61 6e 79 0a 20 2a 09   perform any. *.
12ab0 09 09 09 69 6e 69 74 69 61 6c 69 7a 61 74 69 6f  ...initializatio
12ac0 6e 20 74 68 61 74 20 6e 65 65 64 73 20 74 6f 20  n that needs to 
12ad0 6f 63 63 75 72 20 62 65 66 6f 72 65 20 74 68 65  occur before the
12ae0 0a 20 2a 09 09 09 09 66 69 72 73 74 20 62 79 74  . *....first byt
12af0 65 20 69 73 20 63 6f 6e 76 65 72 74 65 64 2e 20  e is converted. 
12b00 49 66 20 74 68 65 20 73 6f 75 72 63 65 20 62 75  If the source bu
12b10 66 66 65 72 0a 20 2a 09 09 09 09 63 6f 6e 74 61  ffer. *....conta
12b20 69 6e 73 20 74 68 65 20 65 6e 74 69 72 65 20 69  ins the entire i
12b30 6e 70 75 74 20 73 74 72 65 61 6d 20 74 6f 20 62  nput stream to b
12b40 65 0a 20 2a 09 09 09 09 63 6f 6e 76 65 72 74 65  e. *....converte
12b50 64 2c 20 74 68 69 73 20 66 6c 61 67 20 73 68 6f  d, this flag sho
12b60 75 6c 64 20 62 65 20 73 65 74 2e 0a 20 2a 20 54  uld be set.. * T
12b70 43 4c 5f 45 4e 43 4f 44 49 4e 47 5f 45 4e 44 20  CL_ENCODING_END 
12b80 2d 09 09 53 69 67 6e 69 66 69 65 73 20 74 68 61  -..Signifies tha
12b90 74 20 74 68 65 20 73 6f 75 72 63 65 20 62 75 66  t the source buf
12ba0 66 65 72 20 69 73 20 74 68 65 20 6c 61 73 74 0a  fer is the last.
12bb0 20 2a 09 09 09 09 62 6c 6f 63 6b 20 69 6e 20 61   *....block in a
12bc0 20 28 70 6f 74 65 6e 74 69 61 6c 6c 79 20 6d 75   (potentially mu
12bd0 6c 74 69 2d 62 6c 6f 63 6b 29 20 69 6e 70 75 74  lti-block) input
12be0 0a 20 2a 09 09 09 09 73 74 72 65 61 6d 2e 20 54  . *....stream. T
12bf0 65 6c 6c 73 20 74 68 65 20 63 6f 6e 76 65 72 73  ells the convers
12c00 69 6f 6e 20 72 6f 75 74 69 6e 65 20 74 6f 0a 20  ion routine to. 
12c10 2a 09 09 09 09 70 65 72 66 6f 72 6d 20 61 6e 79  *....perform any
12c20 20 66 69 6e 61 6c 69 7a 61 74 69 6f 6e 20 74 68   finalization th
12c30 61 74 20 6e 65 65 64 73 20 74 6f 20 6f 63 63 75  at needs to occu
12c40 72 0a 20 2a 09 09 09 09 61 66 74 65 72 20 74 68  r. *....after th
12c50 65 20 6c 61 73 74 20 62 79 74 65 20 69 73 20 63  e last byte is c
12c60 6f 6e 76 65 72 74 65 64 20 61 6e 64 20 74 68 65  onverted and the
12c70 6e 20 74 6f 0a 20 2a 09 09 09 09 72 65 73 65 74  n to. *....reset
12c80 20 74 6f 20 61 6e 20 69 6e 69 74 69 61 6c 20 73   to an initial s
12c90 74 61 74 65 2e 20 49 66 20 74 68 65 20 73 6f 75  tate. If the sou
12ca0 72 63 65 0a 20 2a 09 09 09 09 62 75 66 66 65 72  rce. *....buffer
12cb0 20 63 6f 6e 74 61 69 6e 73 20 74 68 65 20 65 6e   contains the en
12cc0 74 69 72 65 20 69 6e 70 75 74 20 73 74 72 65 61  tire input strea
12cd0 6d 20 74 6f 20 62 65 0a 20 2a 09 09 09 09 63 6f  m to be. *....co
12ce0 6e 76 65 72 74 65 64 2c 20 74 68 69 73 20 66 6c  nverted, this fl
12cf0 61 67 20 73 68 6f 75 6c 64 20 62 65 20 73 65 74  ag should be set
12d00 2e 0a 20 2a 20 54 43 4c 5f 45 4e 43 4f 44 49 4e  .. * TCL_ENCODIN
12d10 47 5f 53 54 4f 50 4f 4e 45 52 52 4f 52 20 2d 09  G_STOPONERROR -.
12d20 49 66 20 73 65 74 2c 20 74 68 65 20 63 6f 6e 76  If set, the conv
12d30 65 72 74 65 72 20 72 65 74 75 72 6e 73 20 69 6d  erter returns im
12d40 6d 65 64 69 61 74 65 6c 79 20 75 70 6f 6e 0a 20  mediately upon. 
12d50 2a 09 09 09 09 65 6e 63 6f 75 6e 74 65 72 69 6e  *....encounterin
12d60 67 20 61 6e 20 69 6e 76 61 6c 69 64 20 62 79 74  g an invalid byt
12d70 65 20 73 65 71 75 65 6e 63 65 20 6f 72 20 61 0a  e sequence or a.
12d80 20 2a 09 09 09 09 73 6f 75 72 63 65 20 63 68 61   *....source cha
12d90 72 61 63 74 65 72 20 74 68 61 74 20 68 61 73 20  racter that has 
12da0 6e 6f 20 6d 61 70 70 69 6e 67 20 69 6e 20 74 68  no mapping in th
12db0 65 0a 20 2a 09 09 09 09 74 61 72 67 65 74 20 65  e. *....target e
12dc0 6e 63 6f 64 69 6e 67 2e 20 49 66 20 63 6c 65 61  ncoding. If clea
12dd0 72 2c 20 74 68 65 20 63 6f 6e 76 65 72 74 65 72  r, the converter
12de0 0a 20 2a 09 09 09 09 73 75 62 73 74 69 74 75 65  . *....substitue
12df0 73 20 74 68 65 20 70 72 6f 62 6c 65 6d 61 74 69  s the problemati
12e00 63 20 63 68 61 72 61 63 74 65 72 28 73 29 20 77  c character(s) w
12e10 69 74 68 0a 20 2a 09 09 09 09 6f 6e 65 20 6f 72  ith. *....one or
12e20 20 6d 6f 72 65 20 22 63 6c 6f 73 65 22 20 63 68   more "close" ch
12e30 61 72 61 63 74 65 72 73 20 69 6e 20 74 68 65 0a  aracters in the.
12e40 20 2a 09 09 09 09 64 65 73 74 69 6e 61 74 69 6f   *....destinatio
12e50 6e 20 62 75 66 66 65 72 20 61 6e 64 20 74 68 65  n buffer and the
12e60 6e 20 63 6f 6e 74 69 6e 75 65 73 20 74 6f 0a 20  n continues to. 
12e70 2a 09 09 09 09 63 6f 6e 76 65 72 74 20 74 68 65  *....convert the
12e80 20 73 6f 75 72 63 65 2e 0a 20 2a 20 54 43 4c 5f   source.. * TCL_
12e90 45 4e 43 4f 44 49 4e 47 5f 4e 4f 5f 54 45 52 4d  ENCODING_NO_TERM
12ea0 49 4e 41 54 45 20 2d 20 09 49 66 20 73 65 74 2c  INATE - .If set,
12eb0 20 54 63 6c 5f 45 78 74 65 72 6e 61 6c 54 6f 55   Tcl_ExternalToU
12ec0 74 66 20 64 6f 65 73 20 6e 6f 74 20 61 70 70 65  tf does not appe
12ed0 6e 64 20 61 0a 20 2a 09 09 09 09 74 65 72 6d 69  nd a. *....termi
12ee0 6e 61 74 69 6e 67 20 4e 55 4c 20 62 79 74 65 2e  nating NUL byte.
12ef0 20 20 53 69 6e 63 65 20 69 74 20 64 6f 65 73 20    Since it does 
12f00 6e 6f 74 20 6e 65 65 64 0a 20 2a 09 09 09 09 61  not need. *....a
12f10 6e 20 65 78 74 72 61 20 62 79 74 65 20 66 6f 72  n extra byte for
12f20 20 61 20 74 65 72 6d 69 6e 61 74 69 6e 67 20 4e   a terminating N
12f30 55 4c 2c 20 69 74 20 66 69 6c 6c 73 0a 20 2a 09  UL, it fills. *.
12f40 09 09 09 61 6c 6c 20 64 73 74 4c 65 6e 20 62 79  ...all dstLen by
12f50 74 65 73 20 77 69 74 68 20 65 6e 63 6f 64 65 64  tes with encoded
12f60 20 55 54 46 2d 38 20 63 6f 6e 74 65 6e 74 20 69   UTF-8 content i
12f70 66 0a 20 2a 09 09 09 09 6e 65 65 64 65 64 2e 20  f. *....needed. 
12f80 20 49 66 20 63 6c 65 61 72 2c 20 61 20 62 79 74   If clear, a byt
12f90 65 20 69 73 20 72 65 73 65 72 76 65 64 20 69 6e  e is reserved in
12fa0 20 74 68 65 0a 20 2a 09 09 09 09 64 73 74 20 73   the. *....dst s
12fb0 70 61 63 65 20 66 6f 72 20 4e 55 4c 20 74 65 72  pace for NUL ter
12fc0 6d 69 6e 61 74 69 6f 6e 2c 20 61 6e 64 20 61 0a  mination, and a.
12fd0 20 2a 09 09 09 09 74 65 72 6d 69 6e 61 74 69 6e   *....terminatin
12fe0 67 20 4e 55 4c 20 69 73 20 61 70 70 65 6e 64 65  g NUL is appende
12ff0 64 2e 0a 20 2a 20 54 43 4c 5f 45 4e 43 4f 44 49  d.. * TCL_ENCODI
13000 4e 47 5f 43 48 41 52 5f 4c 49 4d 49 54 20 2d 09  NG_CHAR_LIMIT -.
13010 49 66 20 73 65 74 20 61 6e 64 20 64 73 74 43 68  If set and dstCh
13020 61 72 73 50 74 72 20 69 73 20 6e 6f 74 20 4e 55  arsPtr is not NU
13030 4c 4c 2c 20 74 68 65 6e 0a 20 2a 09 09 09 09 54  LL, then. *....T
13040 63 6c 5f 45 78 74 65 72 6e 61 6c 54 6f 55 74 66  cl_ExternalToUtf
13050 20 74 61 6b 65 73 20 74 68 65 20 69 6e 69 74 69   takes the initi
13060 61 6c 20 76 61 6c 75 65 20 6f 66 0a 20 2a 09 09  al value of. *..
13070 09 09 2a 64 73 74 43 68 61 72 73 50 74 72 20 61  ..*dstCharsPtr a
13080 73 20 61 20 6c 69 6d 69 74 20 6f 66 20 74 68 65  s a limit of the
13090 20 6d 61 78 69 6d 75 6d 20 6e 75 6d 62 65 72 0a   maximum number.
130a0 20 2a 09 09 09 09 6f 66 20 63 68 61 72 73 20 74   *....of chars t
130b0 6f 20 70 72 6f 64 75 63 65 20 69 6e 20 74 68 65  o produce in the
130c0 20 65 6e 63 6f 64 65 64 20 55 54 46 2d 38 0a 20   encoded UTF-8. 
130d0 2a 09 09 09 09 63 6f 6e 74 65 6e 74 2e 20 20 4f  *....content.  O
130e0 74 68 65 72 77 69 73 65 2c 20 74 68 65 20 6e 75  therwise, the nu
130f0 6d 62 65 72 20 6f 66 20 63 68 61 72 73 0a 20 2a  mber of chars. *
13100 09 09 09 09 70 72 6f 64 75 63 65 64 20 69 73 20  ....produced is 
13110 63 6f 6e 74 72 6f 6c 6c 65 64 20 6f 6e 6c 79 20  controlled only 
13120 62 79 20 6f 74 68 65 72 20 6c 69 6d 69 74 69 6e  by other limitin
13130 67 0a 20 2a 09 09 09 09 66 61 63 74 6f 72 73 2e  g. *....factors.
13140 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43  . */..#define TC
13150 4c 5f 45 4e 43 4f 44 49 4e 47 5f 53 54 41 52 54  L_ENCODING_START
13160 09 09 30 78 30 31 0a 23 64 65 66 69 6e 65 20 54  ..0x01.#define T
13170 43 4c 5f 45 4e 43 4f 44 49 4e 47 5f 45 4e 44 09  CL_ENCODING_END.
13180 09 30 78 30 32 0a 23 64 65 66 69 6e 65 20 54 43  .0x02.#define TC
13190 4c 5f 45 4e 43 4f 44 49 4e 47 5f 53 54 4f 50 4f  L_ENCODING_STOPO
131a0 4e 45 52 52 4f 52 09 30 78 30 34 0a 23 64 65 66  NERROR.0x04.#def
131b0 69 6e 65 20 54 43 4c 5f 45 4e 43 4f 44 49 4e 47  ine TCL_ENCODING
131c0 5f 4e 4f 5f 54 45 52 4d 49 4e 41 54 45 09 30 78  _NO_TERMINATE.0x
131d0 30 38 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 45  08.#define TCL_E
131e0 4e 43 4f 44 49 4e 47 5f 43 48 41 52 5f 4c 49 4d  NCODING_CHAR_LIM
131f0 49 54 09 09 30 78 31 30 0a 0a 2f 2a 0a 20 2a 20  IT..0x10../*. * 
13200 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 64 65  The following de
13210 66 69 6e 69 74 69 6f 6e 73 20 61 72 65 20 74 68  finitions are th
13220 65 20 65 72 72 6f 72 20 63 6f 64 65 73 20 72 65  e error codes re
13230 74 75 72 6e 65 64 20 62 79 20 74 68 65 20 63 6f  turned by the co
13240 6e 76 65 72 73 69 6f 6e 0a 20 2a 20 72 6f 75 74  nversion. * rout
13250 69 6e 65 73 3a 0a 20 2a 0a 20 2a 20 54 43 4c 5f  ines:. *. * TCL_
13260 4f 4b 20 2d 09 09 09 41 6c 6c 20 63 68 61 72 61  OK -...All chara
13270 63 74 65 72 73 20 77 65 72 65 20 63 6f 6e 76 65  cters were conve
13280 72 74 65 64 2e 0a 20 2a 20 54 43 4c 5f 43 4f 4e  rted.. * TCL_CON
13290 56 45 52 54 5f 4e 4f 53 50 41 43 45 20 2d 09 54  VERT_NOSPACE -.T
132a0 68 65 20 6f 75 74 70 75 74 20 62 75 66 66 65 72  he output buffer
132b0 20 77 6f 75 6c 64 20 6e 6f 74 20 68 61 76 65 20   would not have 
132c0 62 65 65 6e 20 6c 61 72 67 65 0a 20 2a 09 09 09  been large. *...
132d0 09 65 6e 6f 75 67 68 20 66 6f 72 20 61 6c 6c 20  .enough for all 
132e0 6f 66 20 74 68 65 20 63 6f 6e 76 65 72 74 65 64  of the converted
132f0 20 64 61 74 61 3b 20 61 73 20 6d 61 6e 79 0a 20   data; as many. 
13300 2a 09 09 09 09 63 68 61 72 61 63 74 65 72 73 20  *....characters 
13310 61 73 20 63 6f 75 6c 64 20 66 69 74 20 77 65 72  as could fit wer
13320 65 20 63 6f 6e 76 65 72 74 65 64 20 74 68 6f 75  e converted thou
13330 67 68 2e 0a 20 2a 20 54 43 4c 5f 43 4f 4e 56 45  gh.. * TCL_CONVE
13340 52 54 5f 4d 55 4c 54 49 42 59 54 45 20 2d 09 54  RT_MULTIBYTE -.T
13350 68 65 20 6c 61 73 74 20 66 65 77 20 62 79 74 65  he last few byte
13360 73 20 69 6e 20 74 68 65 20 73 6f 75 72 63 65 20  s in the source 
13370 73 74 72 69 6e 67 20 77 65 72 65 0a 20 2a 09 09  string were. *..
13380 09 09 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20  ..the beginning 
13390 6f 66 20 61 20 6d 75 6c 74 69 62 79 74 65 20 73  of a multibyte s
133a0 65 71 75 65 6e 63 65 2c 20 62 75 74 0a 20 2a 09  equence, but. *.
133b0 09 09 09 6d 6f 72 65 20 62 79 74 65 73 20 77 65  ...more bytes we
133c0 72 65 20 6e 65 65 64 65 64 20 74 6f 20 63 6f 6d  re needed to com
133d0 70 6c 65 74 65 20 74 68 69 73 0a 20 2a 09 09 09  plete this. *...
133e0 09 73 65 71 75 65 6e 63 65 2e 20 41 20 73 75 62  .sequence. A sub
133f0 73 65 71 75 65 6e 74 20 63 61 6c 6c 20 74 6f 20  sequent call to 
13400 74 68 65 20 63 6f 6e 76 65 72 73 69 6f 6e 0a 20  the conversion. 
13410 2a 09 09 09 09 72 6f 75 74 69 6e 65 20 73 68 6f  *....routine sho
13420 75 6c 64 20 70 61 73 73 20 74 68 65 20 62 65 67  uld pass the beg
13430 69 6e 6e 69 6e 67 20 6f 66 20 74 68 69 73 0a 20  inning of this. 
13440 2a 09 09 09 09 75 6e 63 6f 6e 76 65 72 74 65 64  *....unconverted
13450 20 73 65 71 75 65 6e 63 65 20 70 6c 75 73 20 61   sequence plus a
13460 64 64 69 74 69 6f 6e 61 6c 20 62 79 74 65 73 0a  dditional bytes.
13470 20 2a 09 09 09 09 66 72 6f 6d 20 74 68 65 20 73   *....from the s
13480 6f 75 72 63 65 20 73 74 72 65 61 6d 20 74 6f 20  ource stream to 
13490 70 72 6f 70 65 72 6c 79 20 63 6f 6e 76 65 72 74  properly convert
134a0 20 74 68 65 0a 20 2a 09 09 09 09 66 6f 72 6d 65   the. *....forme
134b0 72 6c 79 20 73 70 6c 69 74 2d 75 70 20 6d 75 6c  rly split-up mul
134c0 74 69 62 79 74 65 20 73 65 71 75 65 6e 63 65 2e  tibyte sequence.
134d0 0a 20 2a 20 54 43 4c 5f 43 4f 4e 56 45 52 54 5f  . * TCL_CONVERT_
134e0 53 59 4e 54 41 58 20 2d 09 09 54 68 65 20 73 6f  SYNTAX -..The so
134f0 75 72 63 65 20 73 74 72 65 61 6d 20 63 6f 6e 74  urce stream cont
13500 61 69 6e 65 64 20 61 6e 20 69 6e 76 61 6c 69 64  ained an invalid
13510 0a 20 2a 09 09 09 09 63 68 61 72 61 63 74 65 72  . *....character
13520 20 73 65 71 75 65 6e 63 65 2e 20 54 68 69 73 20   sequence. This 
13530 6d 61 79 20 6f 63 63 75 72 20 69 66 20 74 68 65  may occur if the
13540 0a 20 2a 09 09 09 09 69 6e 70 75 74 20 73 74 72  . *....input str
13550 65 61 6d 20 68 61 73 20 62 65 65 6e 20 64 61 6d  eam has been dam
13560 61 67 65 64 20 6f 72 20 69 66 20 74 68 65 20 69  aged or if the i
13570 6e 70 75 74 0a 20 2a 09 09 09 09 65 6e 63 6f 64  nput. *....encod
13580 69 6e 67 20 6d 65 74 68 6f 64 20 77 61 73 20 6d  ing method was m
13590 69 73 69 64 65 6e 74 69 66 69 65 64 2e 20 54 68  isidentified. Th
135a0 69 73 20 65 72 72 6f 72 0a 20 2a 09 09 09 09 69  is error. *....i
135b0 73 20 72 65 70 6f 72 74 65 64 20 6f 6e 6c 79 20  s reported only 
135c0 69 66 20 54 43 4c 5f 45 4e 43 4f 44 49 4e 47 5f  if TCL_ENCODING_
135d0 53 54 4f 50 4f 4e 45 52 52 4f 52 0a 20 2a 09 09  STOPONERROR. *..
135e0 09 09 77 61 73 20 73 70 65 63 69 66 69 65 64 2e  ..was specified.
135f0 0a 20 2a 20 54 43 4c 5f 43 4f 4e 56 45 52 54 5f  . * TCL_CONVERT_
13600 55 4e 4b 4e 4f 57 4e 20 2d 09 54 68 65 20 73 6f  UNKNOWN -.The so
13610 75 72 63 65 20 73 74 72 69 6e 67 20 63 6f 6e 74  urce string cont
13620 61 69 6e 65 64 20 61 20 63 68 61 72 61 63 74 65  ained a characte
13630 72 20 74 68 61 74 0a 20 2a 09 09 09 09 63 6f 75  r that. *....cou
13640 6c 64 20 6e 6f 74 20 62 65 20 72 65 70 72 65 73  ld not be repres
13650 65 6e 74 65 64 20 69 6e 20 74 68 65 20 74 61 72  ented in the tar
13660 67 65 74 0a 20 2a 09 09 09 09 65 6e 63 6f 64 69  get. *....encodi
13670 6e 67 2e 20 54 68 69 73 20 65 72 72 6f 72 20 69  ng. This error i
13680 73 20 72 65 70 6f 72 74 65 64 20 6f 6e 6c 79 20  s reported only 
13690 69 66 0a 20 2a 09 09 09 09 54 43 4c 5f 45 4e 43  if. *....TCL_ENC
136a0 4f 44 49 4e 47 5f 53 54 4f 50 4f 4e 45 52 52 4f  ODING_STOPONERRO
136b0 52 20 77 61 73 20 73 70 65 63 69 66 69 65 64 2e  R was specified.
136c0 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43  . */..#define TC
136d0 4c 5f 43 4f 4e 56 45 52 54 5f 4d 55 4c 54 49 42  L_CONVERT_MULTIB
136e0 59 54 45 09 28 2d 31 29 0a 23 64 65 66 69 6e 65  YTE.(-1).#define
136f0 20 54 43 4c 5f 43 4f 4e 56 45 52 54 5f 53 59 4e   TCL_CONVERT_SYN
13700 54 41 58 09 28 2d 32 29 0a 23 64 65 66 69 6e 65  TAX.(-2).#define
13710 20 54 43 4c 5f 43 4f 4e 56 45 52 54 5f 55 4e 4b   TCL_CONVERT_UNK
13720 4e 4f 57 4e 09 28 2d 33 29 0a 23 64 65 66 69 6e  NOWN.(-3).#defin
13730 65 20 54 43 4c 5f 43 4f 4e 56 45 52 54 5f 4e 4f  e TCL_CONVERT_NO
13740 53 50 41 43 45 09 28 2d 34 29 0a 0a 2f 2a 0a 20  SPACE.(-4)../*. 
13750 2a 20 54 68 65 20 6d 61 78 69 6d 75 6d 20 6e 75  * The maximum nu
13760 6d 62 65 72 20 6f 66 20 62 79 74 65 73 20 74 68  mber of bytes th
13770 61 74 20 61 72 65 20 6e 65 63 65 73 73 61 72 79  at are necessary
13780 20 74 6f 20 72 65 70 72 65 73 65 6e 74 20 61 20   to represent a 
13790 73 69 6e 67 6c 65 0a 20 2a 20 55 6e 69 63 6f 64  single. * Unicod
137a0 65 20 63 68 61 72 61 63 74 65 72 20 69 6e 20 55  e character in U
137b0 54 46 2d 38 2e 20 54 68 65 20 76 61 6c 69 64 20  TF-8. The valid 
137c0 76 61 6c 75 65 73 20 73 68 6f 75 6c 64 20 62 65  values should be
137d0 20 33 2c 20 34 20 6f 72 20 36 0a 20 2a 20 28 6f   3, 4 or 6. * (o
137e0 72 20 70 65 72 68 61 70 73 20 31 20 69 66 20 77  r perhaps 1 if w
137f0 65 20 77 61 6e 74 20 74 6f 20 73 75 70 70 6f 72  e want to suppor
13800 74 20 61 20 6e 6f 6e 2d 75 6e 69 63 6f 64 65 20  t a non-unicode 
13810 65 6e 61 62 6c 65 64 20 63 6f 72 65 29 2e 20 49  enabled core). I
13820 66 20 33 20 6f 72 0a 20 2a 20 34 2c 20 74 68 65  f 3 or. * 4, the
13830 6e 20 54 63 6c 5f 55 6e 69 43 68 61 72 20 6d 75  n Tcl_UniChar mu
13840 73 74 20 62 65 20 32 2d 62 79 74 65 73 20 69 6e  st be 2-bytes in
13850 20 73 69 7a 65 20 28 55 43 53 2d 32 29 20 28 74   size (UCS-2) (t
13860 68 65 20 64 65 66 61 75 6c 74 29 2e 20 49 66 20  he default). If 
13870 36 2c 0a 20 2a 20 74 68 65 6e 20 54 63 6c 5f 55  6,. * then Tcl_U
13880 6e 69 43 68 61 72 20 6d 75 73 74 20 62 65 20 34  niChar must be 4
13890 2d 62 79 74 65 73 20 69 6e 20 73 69 7a 65 20 28  -bytes in size (
138a0 55 43 53 2d 34 29 2e 20 41 74 20 74 68 69 73 20  UCS-4). At this 
138b0 74 69 6d 65 20 55 43 53 2d 32 20 6d 6f 64 65 0a  time UCS-2 mode.
138c0 20 2a 20 69 73 20 74 68 65 20 64 65 66 61 75 6c   * is the defaul
138d0 74 20 61 6e 64 20 72 65 63 6f 6d 6d 65 6e 64 65  t and recommende
138e0 64 20 6d 6f 64 65 2e 20 55 43 53 2d 34 20 69 73  d mode. UCS-4 is
138f0 20 65 78 70 65 72 69 6d 65 6e 74 61 6c 20 61 6e   experimental an
13900 64 20 6e 6f 74 0a 20 2a 20 72 65 63 6f 6d 6d 65  d not. * recomme
13910 6e 64 65 64 2e 20 49 74 20 77 6f 72 6b 73 20 66  nded. It works f
13920 6f 72 20 74 68 65 20 63 6f 72 65 2c 20 62 75 74  or the core, but
13930 20 6d 6f 73 74 20 65 78 74 65 6e 73 69 6f 6e 73   most extensions
13940 20 65 78 70 65 63 74 20 55 43 53 2d 32 2e 0a 20   expect UCS-2.. 
13950 2a 2f 0a 0a 23 69 66 6e 64 65 66 20 54 43 4c 5f  */..#ifndef TCL_
13960 55 54 46 5f 4d 41 58 0a 23 64 65 66 69 6e 65 20  UTF_MAX.#define 
13970 54 43 4c 5f 55 54 46 5f 4d 41 58 09 09 33 0a 23  TCL_UTF_MAX..3.#
13980 65 6e 64 69 66 0a 0a 2f 2a 0a 20 2a 20 54 68 69  endif../*. * Thi
13990 73 20 72 65 70 72 65 73 65 6e 74 73 20 61 20 55  s represents a U
139a0 6e 69 63 6f 64 65 20 63 68 61 72 61 63 74 65 72  nicode character
139b0 2e 20 41 6e 79 20 63 68 61 6e 67 65 73 20 74 6f  . Any changes to
139c0 20 74 68 69 73 20 73 68 6f 75 6c 64 20 61 6c 73   this should als
139d0 6f 20 62 65 0a 20 2a 20 72 65 66 6c 65 63 74 65  o be. * reflecte
139e0 64 20 69 6e 20 72 65 67 63 75 73 74 6f 6d 2e 68  d in regcustom.h
139f0 2e 0a 20 2a 2f 0a 0a 23 69 66 20 54 43 4c 5f 55  .. */..#if TCL_U
13a00 54 46 5f 4d 41 58 20 3e 20 34 0a 20 20 20 20 2f  TF_MAX > 4.    /
13a10 2a 0a 20 20 20 20 20 2a 20 75 6e 73 69 67 6e 65  *.     * unsigne
13a20 64 20 69 6e 74 20 69 73 6e 27 74 20 31 30 30 25  d int isn't 100%
13a30 20 61 63 63 75 72 61 74 65 20 61 73 20 69 74 20   accurate as it 
13a40 73 68 6f 75 6c 64 20 62 65 20 61 20 73 74 72 69  should be a stri
13a50 63 74 20 34 2d 62 79 74 65 20 76 61 6c 75 65 0a  ct 4-byte value.
13a60 20 20 20 20 20 2a 20 28 70 65 72 68 61 70 73 20       * (perhaps 
13a70 77 63 68 61 72 5f 74 29 2e 20 36 34 2d 62 69 74  wchar_t). 64-bit
13a80 20 73 79 73 74 65 6d 73 20 6d 61 79 20 68 61 76   systems may hav
13a90 65 20 74 72 6f 75 62 6c 65 73 2e 20 54 68 65 20  e troubles. The 
13aa0 73 69 7a 65 20 6f 66 20 74 68 69 73 0a 20 20 20  size of this.   
13ab0 20 20 2a 20 76 61 6c 75 65 20 6d 75 73 74 20 62    * value must b
13ac0 65 20 72 65 66 6c 65 63 74 65 64 20 63 6f 72 72  e reflected corr
13ad0 65 63 74 6c 79 20 69 6e 20 72 65 67 63 75 73 74  ectly in regcust
13ae0 6f 6d 2e 68 20 61 6e 64 0a 20 20 20 20 20 2a 20  om.h and.     * 
13af0 69 6e 20 74 63 6c 45 6e 63 6f 64 69 6e 67 2e 63  in tclEncoding.c
13b00 2e 0a 20 20 20 20 20 2a 20 58 58 58 3a 20 54 63  ..     * XXX: Tc
13b10 6c 20 69 73 20 63 75 72 72 65 6e 74 6c 79 20 55  l is currently U
13b20 43 53 2d 32 20 61 6e 64 20 70 6c 61 6e 6e 69 6e  CS-2 and plannin
13b30 67 20 55 54 46 2d 31 36 20 66 6f 72 20 74 68 65  g UTF-16 for the
13b40 20 55 6e 69 63 6f 64 65 0a 20 20 20 20 20 2a 20   Unicode.     * 
13b50 58 58 58 3a 20 73 74 72 69 6e 67 20 72 65 70 20  XXX: string rep 
13b60 74 68 61 74 20 54 63 6c 5f 55 6e 69 43 68 61 72  that Tcl_UniChar
13b70 20 72 65 70 72 65 73 65 6e 74 73 2e 20 20 43 68   represents.  Ch
13b80 61 6e 67 69 6e 67 20 74 68 65 20 73 69 7a 65 0a  anging the size.
13b90 20 20 20 20 20 2a 20 58 58 58 3a 20 6f 66 20 54       * XXX: of T
13ba0 63 6c 5f 55 6e 69 43 68 61 72 20 69 73 20 2f 6e  cl_UniChar is /n
13bb0 6f 74 2f 20 73 75 70 70 6f 72 74 65 64 2e 0a 20  ot/ supported.. 
13bc0 20 20 20 20 2a 2f 0a 74 79 70 65 64 65 66 20 75      */.typedef u
13bd0 6e 73 69 67 6e 65 64 20 69 6e 74 20 54 63 6c 5f  nsigned int Tcl_
13be0 55 6e 69 43 68 61 72 3b 0a 23 65 6c 73 65 0a 74  UniChar;.#else.t
13bf0 79 70 65 64 65 66 20 75 6e 73 69 67 6e 65 64 20  ypedef unsigned 
13c00 73 68 6f 72 74 20 54 63 6c 5f 55 6e 69 43 68 61  short Tcl_UniCha
13c10 72 3b 0a 23 65 6e 64 69 66 0a 0c 0a 2f 2a 0a 20  r;.#endif.../*. 
13c20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  *---------------
13c30 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13c40 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13c50 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13c60 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a  -------------. *
13c70 20 54 49 50 20 23 35 39 3a 20 54 68 65 20 66 6f   TIP #59: The fo
13c80 6c 6c 6f 77 69 6e 67 20 73 74 72 75 63 74 75 72  llowing structur
13c90 65 20 69 73 20 75 73 65 64 20 69 6e 20 63 61 6c  e is used in cal
13ca0 6c 73 20 27 54 63 6c 5f 52 65 67 69 73 74 65 72  ls 'Tcl_Register
13cb0 43 6f 6e 66 69 67 27 20 74 6f 0a 20 2a 20 70 72  Config' to. * pr
13cc0 6f 76 69 64 65 20 74 68 65 20 73 79 73 74 65 6d  ovide the system
13cd0 20 77 69 74 68 20 74 68 65 20 65 6d 62 65 64 64   with the embedd
13ce0 65 64 20 63 6f 6e 66 69 67 75 72 61 74 69 6f 6e  ed configuration
13cf0 20 64 61 74 61 2e 0a 20 2a 2f 0a 0a 74 79 70 65   data.. */..type
13d00 64 65 66 20 73 74 72 75 63 74 20 54 63 6c 5f 43  def struct Tcl_C
13d10 6f 6e 66 69 67 20 7b 0a 20 20 20 20 63 6f 6e 73  onfig {.    cons
13d20 74 20 63 68 61 72 20 2a 6b 65 79 3b 09 09 2f 2a  t char *key;../*
13d30 20 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 6b   Configuration k
13d40 65 79 20 74 6f 20 72 65 67 69 73 74 65 72 2e 20  ey to register. 
13d50 41 53 43 49 49 0a 09 09 09 09 20 2a 20 65 6e 63  ASCII..... * enc
13d60 6f 64 65 64 2c 20 74 68 75 73 20 55 54 46 2d 38  oded, thus UTF-8
13d70 2e 20 2a 2f 0a 20 20 20 20 63 6f 6e 73 74 20 63  . */.    const c
13d80 68 61 72 20 2a 76 61 6c 75 65 3b 09 09 2f 2a 20  har *value;../* 
13d90 54 68 65 20 76 61 6c 75 65 20 61 73 73 6f 63 69  The value associ
13da0 61 74 65 64 20 77 69 74 68 20 74 68 65 20 6b 65  ated with the ke
13db0 79 2e 20 53 79 73 74 65 6d 0a 09 09 09 09 20 2a  y. System..... *
13dc0 20 65 6e 63 6f 64 69 6e 67 2e 20 2a 2f 0a 7d 20   encoding. */.} 
13dd0 54 63 6c 5f 43 6f 6e 66 69 67 3b 0a 0a 2f 2a 0a  Tcl_Config;../*.
13de0 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d   *--------------
13df0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13e00 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13e10 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13e20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20  --------------. 
13e30 2a 20 46 6c 61 67 73 20 66 6f 72 20 54 49 50 23  * Flags for TIP#
13e40 31 34 33 20 6c 69 6d 69 74 73 2c 20 64 65 74 61  143 limits, deta
13e50 69 6c 69 6e 67 20 77 68 69 63 68 20 6c 69 6d 69  iling which limi
13e60 74 73 20 61 72 65 20 61 63 74 69 76 65 20 69 6e  ts are active in
13e70 20 61 6e 0a 20 2a 20 69 6e 74 65 72 70 72 65 74   an. * interpret
13e80 65 72 2e 20 55 73 65 64 20 66 6f 72 20 54 63 6c  er. Used for Tcl
13e90 5f 7b 41 64 64 2c 52 65 6d 6f 76 65 7d 4c 69 6d  _{Add,Remove}Lim
13ea0 69 74 48 61 6e 64 6c 65 72 20 74 79 70 65 20 61  itHandler type a
13eb0 72 67 75 6d 65 6e 74 2e 0a 20 2a 2f 0a 0a 23 64  rgument.. */..#d
13ec0 65 66 69 6e 65 20 54 43 4c 5f 4c 49 4d 49 54 5f  efine TCL_LIMIT_
13ed0 43 4f 4d 4d 41 4e 44 53 09 30 78 30 31 0a 23 64  COMMANDS.0x01.#d
13ee0 65 66 69 6e 65 20 54 43 4c 5f 4c 49 4d 49 54 5f  efine TCL_LIMIT_
13ef0 54 49 4d 45 09 09 30 78 30 32 0a 0a 2f 2a 0a 20  TIME..0x02../*. 
13f00 2a 20 53 74 72 75 63 74 75 72 65 20 63 6f 6e 74  * Structure cont
13f10 61 69 6e 69 6e 67 20 69 6e 66 6f 72 6d 61 74 69  aining informati
13f20 6f 6e 20 61 62 6f 75 74 20 61 20 6c 69 6d 69 74  on about a limit
13f30 20 68 61 6e 64 6c 65 72 20 74 6f 20 62 65 20 63   handler to be c
13f40 61 6c 6c 65 64 20 77 68 65 6e 20 61 0a 20 2a 20  alled when a. * 
13f50 63 6f 6d 6d 61 6e 64 2d 20 6f 72 20 74 69 6d 65  command- or time
13f60 2d 6c 69 6d 69 74 20 69 73 20 65 78 63 65 65 64  -limit is exceed
13f70 65 64 20 62 79 20 61 6e 20 69 6e 74 65 72 70 72  ed by an interpr
13f80 65 74 65 72 2e 0a 20 2a 2f 0a 0a 74 79 70 65 64  eter.. */..typed
13f90 65 66 20 76 6f 69 64 20 28 54 63 6c 5f 4c 69 6d  ef void (Tcl_Lim
13fa0 69 74 48 61 6e 64 6c 65 72 50 72 6f 63 29 20 28  itHandlerProc) (
13fb0 43 6c 69 65 6e 74 44 61 74 61 20 63 6c 69 65 6e  ClientData clien
13fc0 74 44 61 74 61 2c 20 54 63 6c 5f 49 6e 74 65 72  tData, Tcl_Inter
13fd0 70 20 2a 69 6e 74 65 72 70 29 3b 0a 74 79 70 65  p *interp);.type
13fe0 64 65 66 20 76 6f 69 64 20 28 54 63 6c 5f 4c 69  def void (Tcl_Li
13ff0 6d 69 74 48 61 6e 64 6c 65 72 44 65 6c 65 74 65  mitHandlerDelete
14000 50 72 6f 63 29 20 28 43 6c 69 65 6e 74 44 61 74  Proc) (ClientDat
14010 61 20 63 6c 69 65 6e 74 44 61 74 61 29 3b 0a 0a  a clientData);..
14020 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  /*. *-----------
14030 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14040 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14050 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14060 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14070 2d 0a 20 2a 20 4f 76 65 72 72 69 64 65 20 64 65  -. * Override de
14080 66 69 6e 69 74 69 6f 6e 73 20 66 6f 72 20 6c 69  finitions for li
14090 62 74 6f 6d 6d 61 74 68 2e 0a 20 2a 2f 0a 0a 74  btommath.. */..t
140a0 79 70 65 64 65 66 20 73 74 72 75 63 74 20 6d 70  ypedef struct mp
140b0 5f 69 6e 74 20 6d 70 5f 69 6e 74 3b 0a 23 64 65  _int mp_int;.#de
140c0 66 69 6e 65 20 4d 50 5f 49 4e 54 5f 44 45 43 4c  fine MP_INT_DECL
140d0 41 52 45 44 0a 74 79 70 65 64 65 66 20 75 6e 73  ARED.typedef uns
140e0 69 67 6e 65 64 20 69 6e 74 20 6d 70 5f 64 69 67  igned int mp_dig
140f0 69 74 3b 0a 23 64 65 66 69 6e 65 20 4d 50 5f 44  it;.#define MP_D
14100 49 47 49 54 5f 44 45 43 4c 41 52 45 44 0a 0a 2f  IGIT_DECLARED../
14110 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  *. *------------
14120 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14130 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14140 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14150 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14160 0a 20 2a 20 44 65 66 69 6e 69 74 69 6f 6e 73 20  . * Definitions 
14170 6e 65 65 64 65 64 20 66 6f 72 20 54 63 6c 5f 50  needed for Tcl_P
14180 61 72 73 65 41 72 67 76 4f 62 6a 20 72 6f 75 74  arseArgvObj rout
14190 69 6e 65 73 2e 0a 20 2a 20 42 61 73 65 64 20 6f  ines.. * Based o
141a0 6e 20 74 6b 41 72 67 76 2e 63 2e 0a 20 2a 20 4d  n tkArgv.c.. * M
141b0 6f 64 69 66 69 63 61 74 69 6f 6e 73 20 66 72 6f  odifications fro
141c0 6d 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 61  m the original a
141d0 72 65 20 63 6f 70 79 72 69 67 68 74 20 28 63 29  re copyright (c)
141e0 20 53 61 6d 20 42 72 6f 6d 6c 65 79 20 32 30 30   Sam Bromley 200
141f0 36 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 73  6. */..typedef s
14200 74 72 75 63 74 20 7b 0a 20 20 20 20 69 6e 74 20  truct {.    int 
14210 74 79 70 65 3b 09 09 09 2f 2a 20 49 6e 64 69 63  type;.../* Indic
14220 61 74 65 73 20 74 68 65 20 6f 70 74 69 6f 6e 20  ates the option 
14230 74 79 70 65 3b 20 73 65 65 20 62 65 6c 6f 77 2e  type; see below.
14240 20 2a 2f 0a 20 20 20 20 63 6f 6e 73 74 20 63 68   */.    const ch
14250 61 72 20 2a 6b 65 79 53 74 72 3b 09 09 2f 2a 20  ar *keyStr;../* 
14260 54 68 65 20 6b 65 79 20 73 74 72 69 6e 67 20 74  The key string t
14270 68 61 74 20 66 6c 61 67 73 20 74 68 65 20 6f 70  hat flags the op
14280 74 69 6f 6e 20 69 6e 20 74 68 65 0a 09 09 09 09  tion in the.....
14290 20 2a 20 61 72 67 76 20 61 72 72 61 79 2e 20 2a   * argv array. *
142a0 2f 0a 20 20 20 20 76 6f 69 64 20 2a 73 72 63 50  /.    void *srcP
142b0 74 72 3b 09 09 2f 2a 20 56 61 6c 75 65 20 74 6f  tr;../* Value to
142c0 20 62 65 20 75 73 65 64 20 69 6e 20 73 65 74 74   be used in sett
142d0 69 6e 67 20 64 73 74 3b 20 75 73 61 67 65 0a 09  ing dst; usage..
142e0 09 09 09 20 2a 20 64 65 70 65 6e 64 73 20 6f 6e  ... * depends on
142f0 20 74 79 70 65 2e 2a 2f 0a 20 20 20 20 76 6f 69   type.*/.    voi
14300 64 20 2a 64 73 74 50 74 72 3b 09 09 2f 2a 20 41  d *dstPtr;../* A
14310 64 64 72 65 73 73 20 6f 66 20 76 61 6c 75 65 20  ddress of value 
14320 74 6f 20 62 65 20 6d 6f 64 69 66 69 65 64 3b 20  to be modified; 
14330 75 73 61 67 65 0a 09 09 09 09 20 2a 20 64 65 70  usage..... * dep
14340 65 6e 64 73 20 6f 6e 20 74 79 70 65 2e 2a 2f 0a  ends on type.*/.
14350 20 20 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a      const char *
14360 68 65 6c 70 53 74 72 3b 09 2f 2a 20 44 6f 63 75  helpStr;./* Docu
14370 6d 65 6e 74 61 74 69 6f 6e 20 6d 65 73 73 61 67  mentation messag
14380 65 20 64 65 73 63 72 69 62 69 6e 67 20 74 68 69  e describing thi
14390 73 0a 09 09 09 09 20 2a 20 6f 70 74 69 6f 6e 2e  s..... * option.
143a0 20 2a 2f 0a 20 20 20 20 43 6c 69 65 6e 74 44 61   */.    ClientDa
143b0 74 61 20 63 6c 69 65 6e 74 44 61 74 61 3b 09 2f  ta clientData;./
143c0 2a 20 57 6f 72 64 20 74 6f 20 70 61 73 73 20 74  * Word to pass t
143d0 6f 20 66 75 6e 63 74 69 6f 6e 20 63 61 6c 6c 62  o function callb
143e0 61 63 6b 73 2e 20 2a 2f 0a 7d 20 54 63 6c 5f 41  acks. */.} Tcl_A
143f0 72 67 76 49 6e 66 6f 3b 0a 0a 2f 2a 0a 20 2a 20  rgvInfo;../*. * 
14400 4c 65 67 61 6c 20 76 61 6c 75 65 73 20 66 6f 72  Legal values for
14410 20 74 68 65 20 74 79 70 65 20 66 69 65 6c 64 20   the type field 
14420 6f 66 20 61 20 54 63 6c 5f 41 72 67 49 6e 66 6f  of a Tcl_ArgInfo
14430 3a 20 73 65 65 20 74 68 65 20 75 73 65 72 0a 20  : see the user. 
14440 2a 20 64 6f 63 75 6d 65 6e 74 61 74 69 6f 6e 20  * documentation 
14450 66 6f 72 20 64 65 74 61 69 6c 73 2e 0a 20 2a 2f  for details.. */
14460 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 41 52  ..#define TCL_AR
14470 47 56 5f 43 4f 4e 53 54 41 4e 54 09 31 35 0a 23  GV_CONSTANT.15.#
14480 64 65 66 69 6e 65 20 54 43 4c 5f 41 52 47 56 5f  define TCL_ARGV_
14490 49 4e 54 09 09 31 36 0a 23 64 65 66 69 6e 65 20  INT..16.#define 
144a0 54 43 4c 5f 41 52 47 56 5f 53 54 52 49 4e 47 09  TCL_ARGV_STRING.
144b0 09 31 37 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f  .17.#define TCL_
144c0 41 52 47 56 5f 52 45 53 54 09 09 31 38 0a 23 64  ARGV_REST..18.#d
144d0 65 66 69 6e 65 20 54 43 4c 5f 41 52 47 56 5f 46  efine TCL_ARGV_F
144e0 4c 4f 41 54 09 09 31 39 0a 23 64 65 66 69 6e 65  LOAT..19.#define
144f0 20 54 43 4c 5f 41 52 47 56 5f 46 55 4e 43 09 09   TCL_ARGV_FUNC..
14500 32 30 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 41  20.#define TCL_A
14510 52 47 56 5f 47 45 4e 46 55 4e 43 09 32 31 0a 23  RGV_GENFUNC.21.#
14520 64 65 66 69 6e 65 20 54 43 4c 5f 41 52 47 56 5f  define TCL_ARGV_
14530 48 45 4c 50 09 09 32 32 0a 23 64 65 66 69 6e 65  HELP..22.#define
14540 20 54 43 4c 5f 41 52 47 56 5f 45 4e 44 09 09 32   TCL_ARGV_END..2
14550 33 0a 0a 2f 2a 0a 20 2a 20 54 79 70 65 73 20 6f  3../*. * Types o
14560 66 20 63 61 6c 6c 62 61 63 6b 20 66 75 6e 63 74  f callback funct
14570 69 6f 6e 73 20 66 6f 72 20 74 68 65 20 54 43 4c  ions for the TCL
14580 5f 41 52 47 56 5f 46 55 4e 43 20 61 6e 64 20 54  _ARGV_FUNC and T
14590 43 4c 5f 41 52 47 56 5f 47 45 4e 46 55 4e 43 0a  CL_ARGV_GENFUNC.
145a0 20 2a 20 61 72 67 75 6d 65 6e 74 20 74 79 70 65   * argument type
145b0 73 3a 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20  s:. */..typedef 
145c0 69 6e 74 20 28 54 63 6c 5f 41 72 67 76 46 75 6e  int (Tcl_ArgvFun
145d0 63 50 72 6f 63 29 28 43 6c 69 65 6e 74 44 61 74  cProc)(ClientDat
145e0 61 20 63 6c 69 65 6e 74 44 61 74 61 2c 20 54 63  a clientData, Tc
145f0 6c 5f 4f 62 6a 20 2a 6f 62 6a 50 74 72 2c 0a 09  l_Obj *objPtr,..
14600 76 6f 69 64 20 2a 64 73 74 50 74 72 29 3b 0a 74  void *dstPtr);.t
14610 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f  ypedef int (Tcl_
14620 41 72 67 76 47 65 6e 46 75 6e 63 50 72 6f 63 29  ArgvGenFuncProc)
14630 28 43 6c 69 65 6e 74 44 61 74 61 20 63 6c 69 65  (ClientData clie
14640 6e 74 44 61 74 61 2c 20 54 63 6c 5f 49 6e 74 65  ntData, Tcl_Inte
14650 72 70 20 2a 69 6e 74 65 72 70 2c 0a 09 69 6e 74  rp *interp,..int
14660 20 6f 62 6a 63 2c 20 54 63 6c 5f 4f 62 6a 20 2a   objc, Tcl_Obj *
14670 63 6f 6e 73 74 20 2a 6f 62 6a 76 2c 20 76 6f 69  const *objv, voi
14680 64 20 2a 64 73 74 50 74 72 29 3b 0a 0a 2f 2a 0a  d *dstPtr);../*.
14690 20 2a 20 53 68 6f 72 74 68 61 6e 64 20 66 6f 72   * Shorthand for
146a0 20 63 6f 6d 6d 6f 6e 6c 79 20 75 73 65 64 20 61   commonly used a
146b0 72 67 54 61 62 6c 65 20 65 6e 74 72 69 65 73 2e  rgTable entries.
146c0 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43  . */..#define TC
146d0 4c 5f 41 52 47 56 5f 41 55 54 4f 5f 48 45 4c 50  L_ARGV_AUTO_HELP
146e0 20 5c 0a 20 20 20 20 7b 54 43 4c 5f 41 52 47 56   \.    {TCL_ARGV
146f0 5f 48 45 4c 50 2c 09 22 2d 68 65 6c 70 22 2c 09  _HELP,."-help",.
14700 4e 55 4c 4c 2c 09 4e 55 4c 4c 2c 20 5c 0a 09 20  NULL,.NULL, \.. 
14710 20 20 20 22 50 72 69 6e 74 20 73 75 6d 6d 61 72     "Print summar
14720 79 20 6f 66 20 63 6f 6d 6d 61 6e 64 2d 6c 69 6e  y of command-lin
14730 65 20 6f 70 74 69 6f 6e 73 20 61 6e 64 20 61 62  e options and ab
14740 6f 72 74 22 2c 20 4e 55 4c 4c 7d 0a 23 64 65 66  ort", NULL}.#def
14750 69 6e 65 20 54 43 4c 5f 41 52 47 56 5f 41 55 54  ine TCL_ARGV_AUT
14760 4f 5f 52 45 53 54 20 5c 0a 20 20 20 20 7b 54 43  O_REST \.    {TC
14770 4c 5f 41 52 47 56 5f 52 45 53 54 2c 09 22 2d 2d  L_ARGV_REST,."--
14780 22 2c 09 09 4e 55 4c 4c 2c 09 4e 55 4c 4c 2c 20  ",..NULL,.NULL, 
14790 5c 0a 09 20 20 20 20 22 4d 61 72 6b 73 20 74 68  \..    "Marks th
147a0 65 20 65 6e 64 20 6f 66 20 74 68 65 20 6f 70 74  e end of the opt
147b0 69 6f 6e 73 22 2c 20 4e 55 4c 4c 7d 0a 23 64 65  ions", NULL}.#de
147c0 66 69 6e 65 20 54 43 4c 5f 41 52 47 56 5f 54 41  fine TCL_ARGV_TA
147d0 42 4c 45 5f 45 4e 44 20 5c 0a 20 20 20 20 7b 54  BLE_END \.    {T
147e0 43 4c 5f 41 52 47 56 5f 45 4e 44 2c 20 4e 55 4c  CL_ARGV_END, NUL
147f0 4c 2c 20 4e 55 4c 4c 2c 20 4e 55 4c 4c 2c 20 4e  L, NULL, NULL, N
14800 55 4c 4c 2c 20 4e 55 4c 4c 7d 0a 0a 2f 2a 0a 20  ULL, NULL}../*. 
14810 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  *---------------
14820 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14830 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14840 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14850 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a  -------------. *
14860 20 44 65 66 69 6e 69 74 69 6f 6e 73 20 6e 65 65   Definitions nee
14870 64 65 64 20 66 6f 72 20 54 63 6c 5f 5a 6c 69 62  ded for Tcl_Zlib
14880 20 72 6f 75 74 69 6e 65 73 2e 20 5b 54 49 50 20   routines. [TIP 
14890 23 32 33 34 5d 0a 20 2a 0a 20 2a 20 43 6f 6e 73  #234]. *. * Cons
148a0 74 61 6e 74 73 20 66 6f 72 20 74 68 65 20 66 6f  tants for the fo
148b0 72 6d 61 74 20 66 6c 61 67 73 20 64 65 73 63 72  rmat flags descr
148c0 69 62 69 6e 67 20 77 68 61 74 20 73 6f 72 74 20  ibing what sort 
148d0 6f 66 20 64 61 74 61 20 66 6f 72 6d 61 74 20 69  of data format i
148e0 73 0a 20 2a 20 64 65 73 69 72 65 64 2f 65 78 70  s. * desired/exp
148f0 65 63 74 65 64 20 66 6f 72 20 74 68 65 20 54 63  ected for the Tc
14900 6c 5f 5a 6c 69 62 44 65 66 6c 61 74 65 2c 20 54  l_ZlibDeflate, T
14910 63 6c 5f 5a 6c 69 62 49 6e 66 6c 61 74 65 20 61  cl_ZlibInflate a
14920 6e 64 0a 20 2a 20 54 63 6c 5f 5a 6c 69 62 53 74  nd. * Tcl_ZlibSt
14930 72 65 61 6d 49 6e 69 74 20 66 75 6e 63 74 69 6f  reamInit functio
14940 6e 73 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65  ns.. */..#define
14950 20 54 43 4c 5f 5a 4c 49 42 5f 46 4f 52 4d 41 54   TCL_ZLIB_FORMAT
14960 5f 52 41 57 09 31 0a 23 64 65 66 69 6e 65 20 54  _RAW.1.#define T
14970 43 4c 5f 5a 4c 49 42 5f 46 4f 52 4d 41 54 5f 5a  CL_ZLIB_FORMAT_Z
14980 4c 49 42 09 32 0a 23 64 65 66 69 6e 65 20 54 43  LIB.2.#define TC
14990 4c 5f 5a 4c 49 42 5f 46 4f 52 4d 41 54 5f 47 5a  L_ZLIB_FORMAT_GZ
149a0 49 50 09 34 0a 23 64 65 66 69 6e 65 20 54 43 4c  IP.4.#define TCL
149b0 5f 5a 4c 49 42 5f 46 4f 52 4d 41 54 5f 41 55 54  _ZLIB_FORMAT_AUT
149c0 4f 09 38 0a 0a 2f 2a 0a 20 2a 20 43 6f 6e 73 74  O.8../*. * Const
149d0 61 6e 74 73 20 74 68 61 74 20 64 65 73 63 72 69  ants that descri
149e0 62 65 20 77 68 65 74 68 65 72 20 74 68 65 20 73  be whether the s
149f0 74 72 65 61 6d 20 69 73 20 74 6f 20 6f 70 65 72  tream is to oper
14a00 61 74 65 20 69 6e 20 63 6f 6d 70 72 65 73 73 69  ate in compressi
14a10 6e 67 20 6f 72 0a 20 2a 20 64 65 63 6f 6d 70 72  ng or. * decompr
14a20 65 73 73 69 6e 67 20 6d 6f 64 65 2e 0a 20 2a 2f  essing mode.. */
14a30 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 5a 4c  ..#define TCL_ZL
14a40 49 42 5f 53 54 52 45 41 4d 5f 44 45 46 4c 41 54  IB_STREAM_DEFLAT
14a50 45 09 31 36 0a 23 64 65 66 69 6e 65 20 54 43 4c  E.16.#define TCL
14a60 5f 5a 4c 49 42 5f 53 54 52 45 41 4d 5f 49 4e 46  _ZLIB_STREAM_INF
14a70 4c 41 54 45 09 33 32 0a 0a 2f 2a 0a 20 2a 20 43  LATE.32../*. * C
14a80 6f 6e 73 74 61 6e 74 73 20 67 69 76 69 6e 67 20  onstants giving 
14a90 63 6f 6d 70 72 65 73 73 69 6f 6e 20 6c 65 76 65  compression leve
14aa0 6c 73 2e 20 55 73 65 20 6f 66 20 54 43 4c 5f 5a  ls. Use of TCL_Z
14ab0 4c 49 42 5f 43 4f 4d 50 52 45 53 53 5f 44 45 46  LIB_COMPRESS_DEF
14ac0 41 55 4c 54 20 69 73 0a 20 2a 20 72 65 63 6f 6d  AULT is. * recom
14ad0 6d 65 6e 64 65 64 2e 0a 20 2a 2f 0a 0a 23 64 65  mended.. */..#de
14ae0 66 69 6e 65 20 54 43 4c 5f 5a 4c 49 42 5f 43 4f  fine TCL_ZLIB_CO
14af0 4d 50 52 45 53 53 5f 4e 4f 4e 45 09 30 0a 23 64  MPRESS_NONE.0.#d
14b00 65 66 69 6e 65 20 54 43 4c 5f 5a 4c 49 42 5f 43  efine TCL_ZLIB_C
14b10 4f 4d 50 52 45 53 53 5f 46 41 53 54 09 31 0a 23  OMPRESS_FAST.1.#
14b20 64 65 66 69 6e 65 20 54 43 4c 5f 5a 4c 49 42 5f  define TCL_ZLIB_
14b30 43 4f 4d 50 52 45 53 53 5f 42 45 53 54 09 39 0a  COMPRESS_BEST.9.
14b40 23 64 65 66 69 6e 65 20 54 43 4c 5f 5a 4c 49 42  #define TCL_ZLIB
14b50 5f 43 4f 4d 50 52 45 53 53 5f 44 45 46 41 55 4c  _COMPRESS_DEFAUL
14b60 54 20 28 2d 31 29 0a 0a 2f 2a 0a 20 2a 20 43 6f  T (-1)../*. * Co
14b70 6e 73 74 61 6e 74 73 20 66 6f 72 20 74 79 70 65  nstants for type
14b80 73 20 6f 66 20 66 6c 75 73 68 69 6e 67 2c 20 75  s of flushing, u
14b90 73 65 64 20 77 69 74 68 20 54 63 6c 5f 5a 6c 69  sed with Tcl_Zli
14ba0 62 46 6c 75 73 68 2e 0a 20 2a 2f 0a 0a 23 64 65  bFlush.. */..#de
14bb0 66 69 6e 65 20 54 43 4c 5f 5a 4c 49 42 5f 4e 4f  fine TCL_ZLIB_NO
14bc0 5f 46 4c 55 53 48 09 30 0a 23 64 65 66 69 6e 65  _FLUSH.0.#define
14bd0 20 54 43 4c 5f 5a 4c 49 42 5f 46 4c 55 53 48 09   TCL_ZLIB_FLUSH.
14be0 09 32 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 5a  .2.#define TCL_Z
14bf0 4c 49 42 5f 46 55 4c 4c 46 4c 55 53 48 09 33 0a  LIB_FULLFLUSH.3.
14c00 23 64 65 66 69 6e 65 20 54 43 4c 5f 5a 4c 49 42  #define TCL_ZLIB
14c10 5f 46 49 4e 41 4c 49 5a 45 09 34 0a 0a 2f 2a 0a  _FINALIZE.4../*.
14c20 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d   *--------------
14c30 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14c40 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14c50 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14c60 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20  --------------. 
14c70 2a 20 44 65 66 69 6e 69 74 69 6f 6e 73 20 6e 65  * Definitions ne
14c80 65 64 65 64 20 66 6f 72 20 74 68 65 20 54 63 6c  eded for the Tcl
14c90 5f 4c 6f 61 64 46 69 6c 65 20 66 75 6e 63 74 69  _LoadFile functi
14ca0 6f 6e 2e 20 5b 54 49 50 20 23 34 31 36 5d 0a 20  on. [TIP #416]. 
14cb0 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f  */..#define TCL_
14cc0 4c 4f 41 44 5f 47 4c 4f 42 41 4c 20 31 0a 23 64  LOAD_GLOBAL 1.#d
14cd0 65 66 69 6e 65 20 54 43 4c 5f 4c 4f 41 44 5f 4c  efine TCL_LOAD_L
14ce0 41 5a 59 20 32 0a 0a 2f 2a 0a 20 2a 2d 2d 2d 2d  AZY 2../*. *----
14cf0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14d00 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14d10 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14d20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14d30 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 53 69 6e 67  --------. * Sing
14d40 6c 65 20 70 75 62 6c 69 63 20 64 65 63 6c 61 72  le public declar
14d50 61 74 69 6f 6e 20 66 6f 72 20 4e 52 45 2e 0a 20  ation for NRE.. 
14d60 2a 2f 0a 0a 74 79 70 65 64 65 66 20 69 6e 74 20  */..typedef int 
14d70 28 54 63 6c 5f 4e 52 50 6f 73 74 50 72 6f 63 29  (Tcl_NRPostProc)
14d80 20 28 43 6c 69 65 6e 74 44 61 74 61 20 64 61 74   (ClientData dat
14d90 61 5b 5d 2c 20 54 63 6c 5f 49 6e 74 65 72 70 20  a[], Tcl_Interp 
14da0 2a 69 6e 74 65 72 70 2c 0a 09 09 09 09 69 6e 74  *interp,.....int
14db0 20 72 65 73 75 6c 74 29 3b 0a 0a 2f 2a 0a 20 2a   result);../*. *
14dc0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14dd0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14de0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14df0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14e00 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20  ------------. * 
14e10 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 63 6f  The following co
14e20 6e 73 74 61 6e 74 20 69 73 20 75 73 65 64 20 74  nstant is used t
14e30 6f 20 74 65 73 74 20 66 6f 72 20 6f 6c 64 65 72  o test for older
14e40 20 76 65 72 73 69 6f 6e 73 20 6f 66 20 54 63 6c   versions of Tcl
14e50 20 69 6e 20 74 68 65 0a 20 2a 20 73 74 75 62 73   in the. * stubs
14e60 20 74 61 62 6c 65 73 2e 0a 20 2a 2f 0a 0a 23 64   tables.. */..#d
14e70 65 66 69 6e 65 20 54 43 4c 5f 53 54 55 42 5f 4d  efine TCL_STUB_M
14e80 41 47 49 43 09 09 28 28 69 6e 74 29 20 30 78 46  AGIC..((int) 0xF
14e90 43 41 33 42 41 43 46 29 0a 0a 2f 2a 0a 20 2a 20  CA3BACF)../*. * 
14ea0 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 66 75  The following fu
14eb0 6e 63 74 69 6f 6e 20 69 73 20 72 65 71 75 69 72  nction is requir
14ec0 65 64 20 74 6f 20 62 65 20 64 65 66 69 6e 65 64  ed to be defined
14ed0 20 69 6e 20 61 6c 6c 20 73 74 75 62 73 20 61 77   in all stubs aw
14ee0 61 72 65 0a 20 2a 20 65 78 74 65 6e 73 69 6f 6e  are. * extension
14ef0 73 2e 20 54 68 65 20 66 75 6e 63 74 69 6f 6e 20  s. The function 
14f00 69 73 20 61 63 74 75 61 6c 6c 79 20 69 6d 70 6c  is actually impl
14f10 65 6d 65 6e 74 65 64 20 69 6e 20 74 68 65 20 73  emented in the s
14f20 74 75 62 20 6c 69 62 72 61 72 79 2c 20 6e 6f 74  tub library, not
14f30 0a 20 2a 20 74 68 65 20 6d 61 69 6e 20 54 63 6c  . * the main Tcl
14f40 20 6c 69 62 72 61 72 79 2c 20 61 6c 74 68 6f 75   library, althou
14f50 67 68 20 74 68 65 72 65 20 69 73 20 61 20 74 72  gh there is a tr
14f60 69 76 69 61 6c 20 69 6d 70 6c 65 6d 65 6e 74 61  ivial implementa
14f70 74 69 6f 6e 20 69 6e 20 74 68 65 0a 20 2a 20 6d  tion in the. * m
14f80 61 69 6e 20 6c 69 62 72 61 72 79 20 69 6e 20 63  ain library in c
14f90 61 73 65 20 61 6e 20 65 78 74 65 6e 73 69 6f 6e  ase an extension
14fa0 20 69 73 20 73 74 61 74 69 63 61 6c 6c 79 20 6c   is statically l
14fb0 69 6e 6b 65 64 20 69 6e 74 6f 20 61 6e 20 61 70  inked into an ap
14fc0 70 6c 69 63 61 74 69 6f 6e 2e 0a 20 2a 2f 0a 0a  plication.. */..
14fd0 63 6f 6e 73 74 20 63 68 61 72 20 2a 09 09 54 63  const char *..Tc
14fe0 6c 5f 49 6e 69 74 53 74 75 62 73 28 54 63 6c 5f  l_InitStubs(Tcl_
14ff0 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c 20  Interp *interp, 
15000 63 6f 6e 73 74 20 63 68 61 72 20 2a 76 65 72 73  const char *vers
15010 69 6f 6e 2c 0a 09 09 09 20 20 20 20 69 6e 74 20  ion,....    int 
15020 65 78 61 63 74 29 3b 0a 63 6f 6e 73 74 20 63 68  exact);.const ch
15030 61 72 20 2a 09 09 54 63 6c 54 6f 6d 4d 61 74 68  ar *..TclTomMath
15040 49 6e 69 74 69 61 6c 69 7a 65 53 74 75 62 73 28  InitializeStubs(
15050 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65  Tcl_Interp *inte
15060 72 70 2c 0a 09 09 09 20 20 20 20 63 6f 6e 73 74  rp,....    const
15070 20 63 68 61 72 20 2a 76 65 72 73 69 6f 6e 2c 20   char *version, 
15080 69 6e 74 20 65 70 6f 63 68 2c 20 69 6e 74 20 72  int epoch, int r
15090 65 76 69 73 69 6f 6e 29 3b 0a 0a 2f 2a 0a 20 2a  evision);../*. *
150a0 20 57 68 65 6e 20 6e 6f 74 20 75 73 69 6e 67 20   When not using 
150b0 73 74 75 62 73 2c 20 6d 61 6b 65 20 69 74 20 61  stubs, make it a
150c0 20 6d 61 63 72 6f 2e 0a 20 2a 2f 0a 0a 23 69 66   macro.. */..#if
150d0 6e 64 65 66 20 55 53 45 5f 54 43 4c 5f 53 54 55  ndef USE_TCL_STU
150e0 42 53 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f 49  BS.#define Tcl_I
150f0 6e 69 74 53 74 75 62 73 28 69 6e 74 65 72 70 2c  nitStubs(interp,
15100 20 76 65 72 73 69 6f 6e 2c 20 65 78 61 63 74 29   version, exact)
15110 20 5c 0a 20 20 20 20 54 63 6c 5f 50 6b 67 49 6e   \.    Tcl_PkgIn
15120 69 74 53 74 75 62 73 43 68 65 63 6b 28 69 6e 74  itStubsCheck(int
15130 65 72 70 2c 20 76 65 72 73 69 6f 6e 2c 20 65 78  erp, version, ex
15140 61 63 74 29 0a 23 65 6e 64 69 66 0a 0a 2f 2a 0a  act).#endif../*.
15150 20 2a 20 50 75 62 6c 69 63 20 66 75 6e 63 74 69   * Public functi
15160 6f 6e 73 20 74 68 61 74 20 61 72 65 20 6e 6f 74  ons that are not
15170 20 61 63 63 65 73 73 69 62 6c 65 20 76 69 61 20   accessible via 
15180 74 68 65 20 73 74 75 62 73 20 74 61 62 6c 65 2e  the stubs table.
15190 0a 20 2a 20 54 63 6c 5f 47 65 74 4d 65 6d 6f 72  . * Tcl_GetMemor
151a0 79 49 6e 66 6f 20 69 73 20 6e 65 65 64 65 64 20  yInfo is needed 
151b0 66 6f 72 20 41 4f 4c 73 65 72 76 65 72 2e 20 5b  for AOLserver. [
151c0 42 75 67 20 31 38 36 38 31 37 31 5d 0a 20 2a 2f  Bug 1868171]. */
151d0 0a 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f 4d 61  ..#define Tcl_Ma
151e0 69 6e 28 61 72 67 63 2c 20 61 72 67 76 2c 20 70  in(argc, argv, p
151f0 72 6f 63 29 20 54 63 6c 5f 4d 61 69 6e 45 78 28  roc) Tcl_MainEx(
15200 61 72 67 63 2c 20 61 72 67 76 2c 20 70 72 6f 63  argc, argv, proc
15210 2c 20 5c 0a 09 20 20 20 20 28 28 54 63 6c 5f 43  , \..    ((Tcl_C
15220 72 65 61 74 65 49 6e 74 65 72 70 29 28 29 29 29  reateInterp)()))
15230 0a 45 58 54 45 52 4e 20 76 6f 69 64 09 09 54 63  .EXTERN void..Tc
15240 6c 5f 4d 61 69 6e 45 78 28 69 6e 74 20 61 72 67  l_MainEx(int arg
15250 63 2c 20 63 68 61 72 20 2a 2a 61 72 67 76 2c 0a  c, char **argv,.
15260 09 09 09 20 20 20 20 54 63 6c 5f 41 70 70 49 6e  ...    Tcl_AppIn
15270 69 74 50 72 6f 63 20 2a 61 70 70 49 6e 69 74 50  itProc *appInitP
15280 72 6f 63 2c 20 54 63 6c 5f 49 6e 74 65 72 70 20  roc, Tcl_Interp 
15290 2a 69 6e 74 65 72 70 29 3b 0a 45 58 54 45 52 4e  *interp);.EXTERN
152a0 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 09 54 63   const char *.Tc
152b0 6c 5f 50 6b 67 49 6e 69 74 53 74 75 62 73 43 68  l_PkgInitStubsCh
152c0 65 63 6b 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a  eck(Tcl_Interp *
152d0 69 6e 74 65 72 70 2c 0a 09 09 09 20 20 20 20 63  interp,....    c
152e0 6f 6e 73 74 20 63 68 61 72 20 2a 76 65 72 73 69  onst char *versi
152f0 6f 6e 2c 20 69 6e 74 20 65 78 61 63 74 29 3b 0a  on, int exact);.
15300 45 58 54 45 52 4e 20 76 6f 69 64 09 09 54 63 6c  EXTERN void..Tcl
15310 5f 47 65 74 4d 65 6d 6f 72 79 49 6e 66 6f 28 54  _GetMemoryInfo(T
15320 63 6c 5f 44 53 74 72 69 6e 67 20 2a 64 73 50 74  cl_DString *dsPt
15330 72 29 3b 0a 0c 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d  r);.../*. *-----
15340 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
15350 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
15360 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
15370 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
15380 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 49 6e 63 6c 75  -------. * Inclu
15390 64 65 20 74 68 65 20 70 75 62 6c 69 63 20 66 75  de the public fu
153a0 6e 63 74 69 6f 6e 20 64 65 63 6c 61 72 61 74 69  nction declarati
153b0 6f 6e 73 20 74 68 61 74 20 61 72 65 20 61 63 63  ons that are acc
153c0 65 73 73 69 62 6c 65 20 76 69 61 20 74 68 65 20  essible via the 
153d0 73 74 75 62 73 0a 20 2a 20 74 61 62 6c 65 2e 0a  stubs. * table..
153e0 20 2a 2f 0a 0a 23 69 6e 63 6c 75 64 65 20 22 74   */..#include "t
153f0 63 6c 44 65 63 6c 73 2e 68 22 0a 0a 2f 2a 0a 20  clDecls.h"../*. 
15400 2a 20 49 6e 63 6c 75 64 65 20 70 6c 61 74 66 6f  * Include platfo
15410 72 6d 20 73 70 65 63 69 66 69 63 20 70 75 62 6c  rm specific publ
15420 69 63 20 66 75 6e 63 74 69 6f 6e 20 64 65 63 6c  ic function decl
15430 61 72 61 74 69 6f 6e 73 20 74 68 61 74 20 61 72  arations that ar
15440 65 20 61 63 63 65 73 73 69 62 6c 65 0a 20 2a 20  e accessible. * 
15450 76 69 61 20 74 68 65 20 73 74 75 62 73 20 74 61  via the stubs ta
15460 62 6c 65 2e 20 4d 61 6b 65 20 61 6c 6c 20 54 63  ble. Make all Tc
15470 6c 4f 4f 20 73 79 6d 62 6f 6c 73 20 4d 4f 44 55  lOO symbols MODU
15480 4c 45 5f 53 43 4f 50 45 20 28 77 68 69 63 68 20  LE_SCOPE (which 
15490 6f 6e 6c 79 0a 20 2a 20 68 61 73 20 65 66 66 65  only. * has effe
154a0 63 74 20 6f 6e 20 62 75 69 6c 64 69 6e 67 20 69  ct on building i
154b0 74 20 61 73 20 61 20 73 68 61 72 65 64 20 6c 69  t as a shared li
154c0 62 72 61 72 79 29 2e 20 53 65 65 20 74 69 63 6b  brary). See tick
154d0 65 74 20 5b 33 30 31 30 33 35 32 5d 2e 0a 20 2a  et [3010352].. *
154e0 2f 0a 0a 23 69 66 20 64 65 66 69 6e 65 64 28 42  /..#if defined(B
154f0 55 49 4c 44 5f 74 63 6c 29 0a 23 20 20 20 75 6e  UILD_tcl).#   un
15500 64 65 66 20 54 43 4c 41 50 49 0a 23 20 20 20 64  def TCLAPI.#   d
15510 65 66 69 6e 65 20 54 43 4c 41 50 49 20 4d 4f 44  efine TCLAPI MOD
15520 55 4c 45 5f 53 43 4f 50 45 0a 23 65 6e 64 69 66  ULE_SCOPE.#endif
15530 0a 0a 23 69 6e 63 6c 75 64 65 20 22 74 63 6c 50  ..#include "tclP
15540 6c 61 74 44 65 63 6c 73 2e 68 22 0a 0a 2f 2a 0a  latDecls.h"../*.
15550 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d   *--------------
15560 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
15570 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
15580 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
15590 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20  --------------. 
155a0 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20  * The following 
155b0 64 65 63 6c 61 72 61 74 69 6f 6e 73 20 65 69 74  declarations eit
155c0 68 65 72 20 6d 61 70 20 63 6b 61 6c 6c 6f 63 20  her map ckalloc 
155d0 61 6e 64 20 63 6b 66 72 65 65 20 74 6f 20 6d 61  and ckfree to ma
155e0 6c 6c 6f 63 20 61 6e 64 0a 20 2a 20 66 72 65 65  lloc and. * free
155f0 2c 20 6f 72 20 74 68 65 79 20 6d 61 70 20 74 68  , or they map th
15600 65 6d 20 74 6f 20 66 75 6e 63 74 69 6f 6e 73 20  em to functions 
15610 77 69 74 68 20 61 6c 6c 20 73 6f 72 74 73 20 6f  with all sorts o
15620 66 20 64 65 62 75 67 67 69 6e 67 20 68 6f 6f 6b  f debugging hook
15630 73 0a 20 2a 20 64 65 66 69 6e 65 64 20 69 6e 20  s. * defined in 
15640 74 63 6c 43 6b 61 6c 6c 6f 63 2e 63 2e 0a 20 2a  tclCkalloc.c.. *
15650 2f 0a 0a 23 69 66 64 65 66 20 54 43 4c 5f 4d 45  /..#ifdef TCL_ME
15660 4d 5f 44 45 42 55 47 0a 0a 23 20 20 20 64 65 66  M_DEBUG..#   def
15670 69 6e 65 20 63 6b 61 6c 6c 6f 63 28 78 29 20 5c  ine ckalloc(x) \
15680 0a 20 20 20 20 28 28 76 6f 69 64 20 2a 29 20 54  .    ((void *) T
15690 63 6c 5f 44 62 43 6b 61 6c 6c 6f 63 28 28 75 6e  cl_DbCkalloc((un
156a0 73 69 67 6e 65 64 29 28 78 29 2c 20 5f 5f 46 49  signed)(x), __FI
156b0 4c 45 5f 5f 2c 20 5f 5f 4c 49 4e 45 5f 5f 29 29  LE__, __LINE__))
156c0 0a 23 20 20 20 64 65 66 69 6e 65 20 63 6b 66 72  .#   define ckfr
156d0 65 65 28 78 29 20 5c 0a 20 20 20 20 54 63 6c 5f  ee(x) \.    Tcl_
156e0 44 62 43 6b 66 72 65 65 28 28 63 68 61 72 20 2a  DbCkfree((char *
156f0 29 28 78 29 2c 20 5f 5f 46 49 4c 45 5f 5f 2c 20  )(x), __FILE__, 
15700 5f 5f 4c 49 4e 45 5f 5f 29 0a 23 20 20 20 64 65  __LINE__).#   de
15710 66 69 6e 65 20 63 6b 72 65 61 6c 6c 6f 63 28 78  fine ckrealloc(x
15720 2c 79 29 20 5c 0a 20 20 20 20 28 28 76 6f 69 64  ,y) \.    ((void
15730 20 2a 29 20 54 63 6c 5f 44 62 43 6b 72 65 61 6c   *) Tcl_DbCkreal
15740 6c 6f 63 28 28 63 68 61 72 20 2a 29 28 78 29 2c  loc((char *)(x),
15750 20 28 75 6e 73 69 67 6e 65 64 29 28 79 29 2c 20   (unsigned)(y), 
15760 5f 5f 46 49 4c 45 5f 5f 2c 20 5f 5f 4c 49 4e 45  __FILE__, __LINE
15770 5f 5f 29 29 0a 23 20 20 20 64 65 66 69 6e 65 20  __)).#   define 
15780 61 74 74 65 6d 70 74 63 6b 61 6c 6c 6f 63 28 78  attemptckalloc(x
15790 29 20 5c 0a 20 20 20 20 28 28 76 6f 69 64 20 2a  ) \.    ((void *
157a0 29 20 54 63 6c 5f 41 74 74 65 6d 70 74 44 62 43  ) Tcl_AttemptDbC
157b0 6b 61 6c 6c 6f 63 28 28 75 6e 73 69 67 6e 65 64  kalloc((unsigned
157c0 29 28 78 29 2c 20 5f 5f 46 49 4c 45 5f 5f 2c 20  )(x), __FILE__, 
157d0 5f 5f 4c 49 4e 45 5f 5f 29 29 0a 23 20 20 20 64  __LINE__)).#   d
157e0 65 66 69 6e 65 20 61 74 74 65 6d 70 74 63 6b 72  efine attemptckr
157f0 65 61 6c 6c 6f 63 28 78 2c 79 29 20 5c 0a 20 20  ealloc(x,y) \.  
15800 20 20 28 28 76 6f 69 64 20 2a 29 20 54 63 6c 5f    ((void *) Tcl_
15810 41 74 74 65 6d 70 74 44 62 43 6b 72 65 61 6c 6c  AttemptDbCkreall
15820 6f 63 28 28 63 68 61 72 20 2a 29 28 78 29 2c 20  oc((char *)(x), 
15830 28 75 6e 73 69 67 6e 65 64 29 28 79 29 2c 20 5f  (unsigned)(y), _
15840 5f 46 49 4c 45 5f 5f 2c 20 5f 5f 4c 49 4e 45 5f  _FILE__, __LINE_
15850 5f 29 29 0a 0a 23 65 6c 73 65 20 2f 2a 20 21 54  _))..#else /* !T
15860 43 4c 5f 4d 45 4d 5f 44 45 42 55 47 20 2a 2f 0a  CL_MEM_DEBUG */.
15870 0a 2f 2a 0a 20 2a 20 49 66 20 77 65 20 61 72 65  ./*. * If we are
15880 20 6e 6f 74 20 75 73 69 6e 67 20 74 68 65 20 64   not using the d
15890 65 62 75 67 67 69 6e 67 20 61 6c 6c 6f 63 61 74  ebugging allocat
158a0 6f 72 2c 20 77 65 20 73 68 6f 75 6c 64 20 63 61  or, we should ca
158b0 6c 6c 20 74 68 65 20 54 63 6c 5f 41 6c 6c 6f 63  ll the Tcl_Alloc
158c0 2c 0a 20 2a 20 65 74 20 61 6c 2e 20 72 6f 75 74  ,. * et al. rout
158d0 69 6e 65 73 20 69 6e 20 6f 72 64 65 72 20 74 6f  ines in order to
158e0 20 67 75 61 72 61 6e 74 65 65 20 74 68 61 74 20   guarantee that 
158f0 65 76 65 72 79 20 6d 6f 64 75 6c 65 20 69 73 20  every module is 
15900 75 73 69 6e 67 20 74 68 65 20 73 61 6d 65 0a 20  using the same. 
15910 2a 20 6d 65 6d 6f 72 79 20 61 6c 6c 6f 63 61 74  * memory allocat
15920 6f 72 20 62 6f 74 68 20 69 6e 73 69 64 65 20 61  or both inside a
15930 6e 64 20 6f 75 74 73 69 64 65 20 6f 66 20 74 68  nd outside of th
15940 65 20 54 63 6c 20 6c 69 62 72 61 72 79 2e 0a 20  e Tcl library.. 
15950 2a 2f 0a 0a 23 20 20 20 64 65 66 69 6e 65 20 63  */..#   define c
15960 6b 61 6c 6c 6f 63 28 78 29 20 5c 0a 20 20 20 20  kalloc(x) \.    
15970 28 28 76 6f 69 64 20 2a 29 20 54 63 6c 5f 41 6c  ((void *) Tcl_Al
15980 6c 6f 63 28 28 75 6e 73 69 67 6e 65 64 29 28 78  loc((unsigned)(x
15990 29 29 29 0a 23 20 20 20 64 65 66 69 6e 65 20 63  ))).#   define c
159a0 6b 66 72 65 65 28 78 29 20 5c 0a 20 20 20 20 54  kfree(x) \.    T
159b0 63 6c 5f 46 72 65 65 28 28 63 68 61 72 20 2a 29  cl_Free((char *)
159c0 28 78 29 29 0a 23 20 20 20 64 65 66 69 6e 65 20  (x)).#   define 
159d0 63 6b 72 65 61 6c 6c 6f 63 28 78 2c 79 29 20 5c  ckrealloc(x,y) \
159e0 0a 20 20 20 20 28 28 76 6f 69 64 20 2a 29 20 54  .    ((void *) T
159f0 63 6c 5f 52 65 61 6c 6c 6f 63 28 28 63 68 61 72  cl_Realloc((char
15a00 20 2a 29 28 78 29 2c 20 28 75 6e 73 69 67 6e 65   *)(x), (unsigne
15a10 64 29 28 79 29 29 29 0a 23 20 20 20 64 65 66 69  d)(y))).#   defi
15a20 6e 65 20 61 74 74 65 6d 70 74 63 6b 61 6c 6c 6f  ne attemptckallo
15a30 63 28 78 29 20 5c 0a 20 20 20 20 28 28 76 6f 69  c(x) \.    ((voi
15a40 64 20 2a 29 20 54 63 6c 5f 41 74 74 65 6d 70 74  d *) Tcl_Attempt
15a50 41 6c 6c 6f 63 28 28 75 6e 73 69 67 6e 65 64 29  Alloc((unsigned)
15a60 28 78 29 29 29 0a 23 20 20 20 64 65 66 69 6e 65  (x))).#   define
15a70 20 61 74 74 65 6d 70 74 63 6b 72 65 61 6c 6c 6f   attemptckreallo
15a80 63 28 78 2c 79 29 20 5c 0a 20 20 20 20 28 28 76  c(x,y) \.    ((v
15a90 6f 69 64 20 2a 29 20 54 63 6c 5f 41 74 74 65 6d  oid *) Tcl_Attem
15aa0 70 74 52 65 61 6c 6c 6f 63 28 28 63 68 61 72 20  ptRealloc((char 
15ab0 2a 29 28 78 29 2c 20 28 75 6e 73 69 67 6e 65 64  *)(x), (unsigned
15ac0 29 28 79 29 29 29 0a 23 20 20 20 75 6e 64 65 66  )(y))).#   undef
15ad0 20 20 54 63 6c 5f 49 6e 69 74 4d 65 6d 6f 72 79    Tcl_InitMemory
15ae0 0a 23 20 20 20 64 65 66 69 6e 65 20 54 63 6c 5f  .#   define Tcl_
15af0 49 6e 69 74 4d 65 6d 6f 72 79 28 78 29 0a 23 20  InitMemory(x).# 
15b00 20 20 75 6e 64 65 66 20 20 54 63 6c 5f 44 75 6d    undef  Tcl_Dum
15b10 70 41 63 74 69 76 65 4d 65 6d 6f 72 79 0a 23 20  pActiveMemory.# 
15b20 20 20 64 65 66 69 6e 65 20 54 63 6c 5f 44 75 6d    define Tcl_Dum
15b30 70 41 63 74 69 76 65 4d 65 6d 6f 72 79 28 78 29  pActiveMemory(x)
15b40 0a 23 20 20 20 75 6e 64 65 66 20 20 54 63 6c 5f  .#   undef  Tcl_
15b50 56 61 6c 69 64 61 74 65 41 6c 6c 4d 65 6d 6f 72  ValidateAllMemor
15b60 79 0a 23 20 20 20 64 65 66 69 6e 65 20 54 63 6c  y.#   define Tcl
15b70 5f 56 61 6c 69 64 61 74 65 41 6c 6c 4d 65 6d 6f  _ValidateAllMemo
15b80 72 79 28 78 2c 79 29 0a 0a 23 65 6e 64 69 66 20  ry(x,y)..#endif 
15b90 2f 2a 20 21 54 43 4c 5f 4d 45 4d 5f 44 45 42 55  /* !TCL_MEM_DEBU
15ba0 47 20 2a 2f 0a 0a 23 69 66 64 65 66 20 54 43 4c  G */..#ifdef TCL
15bb0 5f 4d 45 4d 5f 44 45 42 55 47 0a 23 20 20 20 64  _MEM_DEBUG.#   d
15bc0 65 66 69 6e 65 20 54 63 6c 5f 49 6e 63 72 52 65  efine Tcl_IncrRe
15bd0 66 43 6f 75 6e 74 28 6f 62 6a 50 74 72 29 20 5c  fCount(objPtr) \
15be0 0a 09 54 63 6c 5f 44 62 49 6e 63 72 52 65 66 43  ..Tcl_DbIncrRefC
15bf0 6f 75 6e 74 28 6f 62 6a 50 74 72 2c 20 5f 5f 46  ount(objPtr, __F
15c00 49 4c 45 5f 5f 2c 20 5f 5f 4c 49 4e 45 5f 5f 29  ILE__, __LINE__)
15c10 0a 23 20 20 20 64 65 66 69 6e 65 20 54 63 6c 5f  .#   define Tcl_
15c20 44 65 63 72 52 65 66 43 6f 75 6e 74 28 6f 62 6a  DecrRefCount(obj
15c30 50 74 72 29 20 5c 0a 09 54 63 6c 5f 44 62 44 65  Ptr) \..Tcl_DbDe
15c40 63 72 52 65 66 43 6f 75 6e 74 28 6f 62 6a 50 74  crRefCount(objPt
15c50 72 2c 20 5f 5f 46 49 4c 45 5f 5f 2c 20 5f 5f 4c  r, __FILE__, __L
15c60 49 4e 45 5f 5f 29 0a 23 20 20 20 64 65 66 69 6e  INE__).#   defin
15c70 65 20 54 63 6c 5f 49 73 53 68 61 72 65 64 28 6f  e Tcl_IsShared(o
15c80 62 6a 50 74 72 29 20 5c 0a 09 54 63 6c 5f 44 62  bjPtr) \..Tcl_Db
15c90 49 73 53 68 61 72 65 64 28 6f 62 6a 50 74 72 2c  IsShared(objPtr,
15ca0 20 5f 5f 46 49 4c 45 5f 5f 2c 20 5f 5f 4c 49 4e   __FILE__, __LIN
15cb0 45 5f 5f 29 0a 23 65 6c 73 65 0a 23 20 20 20 64  E__).#else.#   d
15cc0 65 66 69 6e 65 20 54 63 6c 5f 49 6e 63 72 52 65  efine Tcl_IncrRe
15cd0 66 43 6f 75 6e 74 28 6f 62 6a 50 74 72 29 20 5c  fCount(objPtr) \
15ce0 0a 09 2b 2b 28 6f 62 6a 50 74 72 29 2d 3e 72 65  ..++(objPtr)->re
15cf0 66 43 6f 75 6e 74 0a 20 20 20 20 2f 2a 0a 20 20  fCount.    /*.  
15d00 20 20 20 2a 20 55 73 65 20 64 6f 2f 77 68 69 6c     * Use do/whil
15d10 65 30 20 69 64 69 6f 6d 20 66 6f 72 20 6f 70 74  e0 idiom for opt
15d20 69 6d 75 6d 20 63 6f 72 72 65 63 74 6e 65 73 73  imum correctness
15d30 20 77 69 74 68 6f 75 74 20 63 6f 6d 70 69 6c 65   without compile
15d40 72 20 77 61 72 6e 69 6e 67 73 2e 0a 20 20 20 20  r warnings..    
15d50 20 2a 20 68 74 74 70 3a 2f 2f 63 32 2e 63 6f 6d   * http://c2.com
15d60 2f 63 67 69 2f 77 69 6b 69 3f 54 72 69 76 69 61  /cgi/wiki?Trivia
15d70 6c 44 6f 57 68 69 6c 65 4c 6f 6f 70 0a 20 20 20  lDoWhileLoop.   
15d80 20 20 2a 2f 0a 23 20 20 20 64 65 66 69 6e 65 20    */.#   define 
15d90 54 63 6c 5f 44 65 63 72 52 65 66 43 6f 75 6e 74  Tcl_DecrRefCount
15da0 28 6f 62 6a 50 74 72 29 20 5c 0a 09 64 6f 20 7b  (objPtr) \..do {
15db0 20 5c 0a 09 20 20 20 20 54 63 6c 5f 4f 62 6a 20   \..    Tcl_Obj 
15dc0 2a 5f 6f 62 6a 50 74 72 20 3d 20 28 6f 62 6a 50  *_objPtr = (objP
15dd0 74 72 29 3b 20 5c 0a 09 20 20 20 20 69 66 20 28  tr); \..    if (
15de0 5f 6f 62 6a 50 74 72 2d 3e 72 65 66 43 6f 75 6e  _objPtr->refCoun
15df0 74 2d 2d 20 3c 3d 20 31 29 20 7b 20 5c 0a 09 09  t-- <= 1) { \...
15e00 54 63 6c 46 72 65 65 4f 62 6a 28 5f 6f 62 6a 50  TclFreeObj(_objP
15e10 74 72 29 3b 20 5c 0a 09 20 20 20 20 7d 20 5c 0a  tr); \..    } \.
15e20 09 7d 20 77 68 69 6c 65 28 30 29 0a 23 20 20 20  .} while(0).#   
15e30 64 65 66 69 6e 65 20 54 63 6c 5f 49 73 53 68 61  define Tcl_IsSha
15e40 72 65 64 28 6f 62 6a 50 74 72 29 20 5c 0a 09 28  red(objPtr) \..(
15e50 28 6f 62 6a 50 74 72 29 2d 3e 72 65 66 43 6f 75  (objPtr)->refCou
15e60 6e 74 20 3e 20 31 29 0a 23 65 6e 64 69 66 0a 0a  nt > 1).#endif..
15e70 2f 2a 0a 20 2a 20 4d 61 63 72 6f 73 20 61 6e 64  /*. * Macros and
15e80 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 74 68 61   definitions tha
15e90 74 20 68 65 6c 70 20 74 6f 20 64 65 62 75 67 20  t help to debug 
15ea0 74 68 65 20 75 73 65 20 6f 66 20 54 63 6c 20 6f  the use of Tcl o
15eb0 62 6a 65 63 74 73 2e 20 57 68 65 6e 0a 20 2a 20  bjects. When. * 
15ec0 54 43 4c 5f 4d 45 4d 5f 44 45 42 55 47 20 69 73  TCL_MEM_DEBUG is
15ed0 20 64 65 66 69 6e 65 64 2c 20 74 68 65 20 54 63   defined, the Tc
15ee0 6c 5f 4e 65 77 20 64 65 63 6c 61 72 61 74 69 6f  l_New declaratio
15ef0 6e 73 20 61 72 65 20 6f 76 65 72 72 69 64 64 65  ns are overridde
15f00 6e 20 74 6f 20 63 61 6c 6c 0a 20 2a 20 64 65 62  n to call. * deb
15f10 75 67 67 69 6e 67 20 76 65 72 73 69 6f 6e 73 20  ugging versions 
15f20 6f 66 20 74 68 65 20 6f 62 6a 65 63 74 20 63 72  of the object cr
15f30 65 61 74 69 6f 6e 20 66 75 6e 63 74 69 6f 6e 73  eation functions
15f40 2e 0a 20 2a 2f 0a 0a 23 69 66 64 65 66 20 54 43  .. */..#ifdef TC
15f50 4c 5f 4d 45 4d 5f 44 45 42 55 47 0a 23 20 20 75  L_MEM_DEBUG.#  u
15f60 6e 64 65 66 20 20 54 63 6c 5f 4e 65 77 42 69 67  ndef  Tcl_NewBig
15f70 6e 75 6d 4f 62 6a 0a 23 20 20 64 65 66 69 6e 65  numObj.#  define
15f80 20 54 63 6c 5f 4e 65 77 42 69 67 6e 75 6d 4f 62   Tcl_NewBignumOb
15f90 6a 28 76 61 6c 29 20 5c 0a 20 20 20 20 20 54 63  j(val) \.     Tc
15fa0 6c 5f 44 62 4e 65 77 42 69 67 6e 75 6d 4f 62 6a  l_DbNewBignumObj
15fb0 28 76 61 6c 2c 20 5f 5f 46 49 4c 45 5f 5f 2c 20  (val, __FILE__, 
15fc0 5f 5f 4c 49 4e 45 5f 5f 29 0a 23 20 20 75 6e 64  __LINE__).#  und
15fd0 65 66 20 20 54 63 6c 5f 4e 65 77 42 6f 6f 6c 65  ef  Tcl_NewBoole
15fe0 61 6e 4f 62 6a 0a 23 20 20 64 65 66 69 6e 65 20  anObj.#  define 
15ff0 54 63 6c 5f 4e 65 77 42 6f 6f 6c 65 61 6e 4f 62  Tcl_NewBooleanOb
16000 6a 28 76 61 6c 29 20 5c 0a 20 20 20 20 20 54 63  j(val) \.     Tc
16010 6c 5f 44 62 4e 65 77 42 6f 6f 6c 65 61 6e 4f 62  l_DbNewBooleanOb
16020 6a 28 76 61 6c 2c 20 5f 5f 46 49 4c 45 5f 5f 2c  j(val, __FILE__,
16030 20 5f 5f 4c 49 4e 45 5f 5f 29 0a 23 20 20 75 6e   __LINE__).#  un
16040 64 65 66 20 20 54 63 6c 5f 4e 65 77 42 79 74 65  def  Tcl_NewByte
16050 41 72 72 61 79 4f 62 6a 0a 23 20 20 64 65 66 69  ArrayObj.#  defi
16060 6e 65 20 54 63 6c 5f 4e 65 77 42 79 74 65 41 72  ne Tcl_NewByteAr
16070 72 61 79 4f 62 6a 28 62 79 74 65 73 2c 20 6c 65  rayObj(bytes, le
16080 6e 29 20 5c 0a 20 20 20 20 20 54 63 6c 5f 44 62  n) \.     Tcl_Db
16090 4e 65 77 42 79 74 65 41 72 72 61 79 4f 62 6a 28  NewByteArrayObj(
160a0 62 79 74 65 73 2c 20 6c 65 6e 2c 20 5f 5f 46 49  bytes, len, __FI
160b0 4c 45 5f 5f 2c 20 5f 5f 4c 49 4e 45 5f 5f 29 0a  LE__, __LINE__).
160c0 23 20 20 75 6e 64 65 66 20 20 54 63 6c 5f 4e 65  #  undef  Tcl_Ne
160d0 77 44 6f 75 62 6c 65 4f 62 6a 0a 23 20 20 64 65  wDoubleObj.#  de
160e0 66 69 6e 65 20 54 63 6c 5f 4e 65 77 44 6f 75 62  fine Tcl_NewDoub
160f0 6c 65 4f 62 6a 28 76 61 6c 29 20 5c 0a 20 20 20  leObj(val) \.   
16100 20 20 54 63 6c 5f 44 62 4e 65 77 44 6f 75 62 6c    Tcl_DbNewDoubl
16110 65 4f 62 6a 28 76 61 6c 2c 20 5f 5f 46 49 4c 45  eObj(val, __FILE
16120 5f 5f 2c 20 5f 5f 4c 49 4e 45 5f 5f 29 0a 23 20  __, __LINE__).# 
16130 20 75 6e 64 65 66 20 20 54 63 6c 5f 4e 65 77 49   undef  Tcl_NewI
16140 6e 74 4f 62 6a 0a 23 20 20 64 65 66 69 6e 65 20  ntObj.#  define 
16150 54 63 6c 5f 4e 65 77 49 6e 74 4f 62 6a 28 76 61  Tcl_NewIntObj(va
16160 6c 29 20 5c 0a 20 20 20 20 20 54 63 6c 5f 44 62  l) \.     Tcl_Db
16170 4e 65 77 4c 6f 6e 67 4f 62 6a 28 76 61 6c 2c 20  NewLongObj(val, 
16180 5f 5f 46 49 4c 45 5f 5f 2c 20 5f 5f 4c 49 4e 45  __FILE__, __LINE
16190 5f 5f 29 0a 23 20 20 75 6e 64 65 66 20 20 54 63  __).#  undef  Tc
161a0 6c 5f 4e 65 77 4c 69 73 74 4f 62 6a 0a 23 20 20  l_NewListObj.#  
161b0 64 65 66 69 6e 65 20 54 63 6c 5f 4e 65 77 4c 69  define Tcl_NewLi
161c0 73 74 4f 62 6a 28 6f 62 6a 63 2c 20 6f 62 6a 76  stObj(objc, objv
161d0 29 20 5c 0a 20 20 20 20 20 54 63 6c 5f 44 62 4e  ) \.     Tcl_DbN
161e0 65 77 4c 69 73 74 4f 62 6a 28 6f 62 6a 63 2c 20  ewListObj(objc, 
161f0 6f 62 6a 76 2c 20 5f 5f 46 49 4c 45 5f 5f 2c 20  objv, __FILE__, 
16200 5f 5f 4c 49 4e 45 5f 5f 29 0a 23 20 20 75 6e 64  __LINE__).#  und
16210 65 66 20 20 54 63 6c 5f 4e 65 77 4c 6f 6e 67 4f  ef  Tcl_NewLongO
16220 62 6a 0a 23 20 20 64 65 66 69 6e 65 20 54 63 6c  bj.#  define Tcl
16230 5f 4e 65 77 4c 6f 6e 67 4f 62 6a 28 76 61 6c 29  _NewLongObj(val)
16240 20 5c 0a 20 20 20 20 20 54 63 6c 5f 44 62 4e 65   \.     Tcl_DbNe
16250 77 4c 6f 6e 67 4f 62 6a 28 76 61 6c 2c 20 5f 5f  wLongObj(val, __
16260 46 49 4c 45 5f 5f 2c 20 5f 5f 4c 49 4e 45 5f 5f  FILE__, __LINE__
16270 29 0a 23 20 20 75 6e 64 65 66 20 20 54 63 6c 5f  ).#  undef  Tcl_
16280 4e 65 77 4f 62 6a 0a 23 20 20 64 65 66 69 6e 65  NewObj.#  define
16290 20 54 63 6c 5f 4e 65 77 4f 62 6a 28 29 20 5c 0a   Tcl_NewObj() \.
162a0 20 20 20 20 20 54 63 6c 5f 44 62 4e 65 77 4f 62       Tcl_DbNewOb
162b0 6a 28 5f 5f 46 49 4c 45 5f 5f 2c 20 5f 5f 4c 49  j(__FILE__, __LI
162c0 4e 45 5f 5f 29 0a 23 20 20 75 6e 64 65 66 20 20  NE__).#  undef  
162d0 54 63 6c 5f 4e 65 77 53 74 72 69 6e 67 4f 62 6a  Tcl_NewStringObj
162e0 0a 23 20 20 64 65 66 69 6e 65 20 54 63 6c 5f 4e  .#  define Tcl_N
162f0 65 77 53 74 72 69 6e 67 4f 62 6a 28 62 79 74 65  ewStringObj(byte
16300 73 2c 20 6c 65 6e 29 20 5c 0a 20 20 20 20 20 54  s, len) \.     T
16310 63 6c 5f 44 62 4e 65 77 53 74 72 69 6e 67 4f 62  cl_DbNewStringOb
16320 6a 28 62 79 74 65 73 2c 20 6c 65 6e 2c 20 5f 5f  j(bytes, len, __
16330 46 49 4c 45 5f 5f 2c 20 5f 5f 4c 49 4e 45 5f 5f  FILE__, __LINE__
16340 29 0a 23 20 20 75 6e 64 65 66 20 20 54 63 6c 5f  ).#  undef  Tcl_
16350 4e 65 77 57 69 64 65 49 6e 74 4f 62 6a 0a 23 20  NewWideIntObj.# 
16360 20 64 65 66 69 6e 65 20 54 63 6c 5f 4e 65 77 57   define Tcl_NewW
16370 69 64 65 49 6e 74 4f 62 6a 28 76 61 6c 29 20 5c  ideIntObj(val) \
16380 0a 20 20 20 20 20 54 63 6c 5f 44 62 4e 65 77 57  .     Tcl_DbNewW
16390 69 64 65 49 6e 74 4f 62 6a 28 76 61 6c 2c 20 5f  ideIntObj(val, _
163a0 5f 46 49 4c 45 5f 5f 2c 20 5f 5f 4c 49 4e 45 5f  _FILE__, __LINE_
163b0 5f 29 0a 23 65 6e 64 69 66 20 2f 2a 20 54 43 4c  _).#endif /* TCL
163c0 5f 4d 45 4d 5f 44 45 42 55 47 20 2a 2f 0a 0a 2f  _MEM_DEBUG */../
163d0 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  *. *------------
163e0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
163f0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
16400 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
16410 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
16420 0a 20 2a 20 4d 61 63 72 6f 73 20 66 6f 72 20 63  . * Macros for c
16430 6c 69 65 6e 74 73 20 74 6f 20 75 73 65 20 74 6f  lients to use to
16440 20 61 63 63 65 73 73 20 66 69 65 6c 64 73 20 6f   access fields o
16450 66 20 68 61 73 68 20 65 6e 74 72 69 65 73 3a 0a  f hash entries:.
16460 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 63 6c   */..#define Tcl
16470 5f 47 65 74 48 61 73 68 56 61 6c 75 65 28 68 29  _GetHashValue(h)
16480 20 28 28 68 29 2d 3e 63 6c 69 65 6e 74 44 61 74   ((h)->clientDat
16490 61 29 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f 53  a).#define Tcl_S
164a0 65 74 48 61 73 68 56 61 6c 75 65 28 68 2c 20 76  etHashValue(h, v
164b0 61 6c 75 65 29 20 28 28 68 29 2d 3e 63 6c 69 65  alue) ((h)->clie
164c0 6e 74 44 61 74 61 20 3d 20 28 43 6c 69 65 6e 74  ntData = (Client
164d0 44 61 74 61 29 20 28 76 61 6c 75 65 29 29 0a 23  Data) (value)).#
164e0 64 65 66 69 6e 65 20 54 63 6c 5f 47 65 74 48 61  define Tcl_GetHa
164f0 73 68 4b 65 79 28 74 61 62 6c 65 50 74 72 2c 20  shKey(tablePtr, 
16500 68 29 20 5c 0a 09 28 28 76 6f 69 64 20 2a 29 20  h) \..((void *) 
16510 28 28 28 74 61 62 6c 65 50 74 72 29 2d 3e 6b 65  (((tablePtr)->ke
16520 79 54 79 70 65 20 3d 3d 20 54 43 4c 5f 4f 4e 45  yType == TCL_ONE
16530 5f 57 4f 52 44 5f 4b 45 59 53 20 7c 7c 20 5c 0a  _WORD_KEYS || \.
16540 09 09 20 20 20 20 28 74 61 62 6c 65 50 74 72 29  ..    (tablePtr)
16550 2d 3e 6b 65 79 54 79 70 65 20 3d 3d 20 54 43 4c  ->keyType == TCL
16560 5f 43 55 53 54 4f 4d 5f 50 54 52 5f 4b 45 59 53  _CUSTOM_PTR_KEYS
16570 29 20 5c 0a 09 09 20 20 20 3f 20 28 68 29 2d 3e  ) \...   ? (h)->
16580 6b 65 79 2e 6f 6e 65 57 6f 72 64 56 61 6c 75 65  key.oneWordValue
16590 20 5c 0a 09 09 20 20 20 3a 20 28 68 29 2d 3e 6b   \...   : (h)->k
165a0 65 79 2e 73 74 72 69 6e 67 29 29 0a 0a 2f 2a 0a  ey.string))../*.
165b0 20 2a 20 4d 61 63 72 6f 73 20 74 6f 20 75 73 65   * Macros to use
165c0 20 66 6f 72 20 63 6c 69 65 6e 74 73 20 74 6f 20   for clients to 
165d0 75 73 65 20 74 6f 20 69 6e 76 6f 6b 65 20 66 69  use to invoke fi
165e0 6e 64 20 61 6e 64 20 63 72 65 61 74 65 20 66 75  nd and create fu
165f0 6e 63 74 69 6f 6e 73 20 66 6f 72 0a 20 2a 20 68  nctions for. * h
16600 61 73 68 20 74 61 62 6c 65 73 3a 0a 20 2a 2f 0a  ash tables:. */.
16610 0a 23 75 6e 64 65 66 20 20 54 63 6c 5f 46 69 6e  .#undef  Tcl_Fin
16620 64 48 61 73 68 45 6e 74 72 79 0a 23 64 65 66 69  dHashEntry.#defi
16630 6e 65 20 54 63 6c 5f 46 69 6e 64 48 61 73 68 45  ne Tcl_FindHashE
16640 6e 74 72 79 28 74 61 62 6c 65 50 74 72 2c 20 6b  ntry(tablePtr, k
16650 65 79 29 20 5c 0a 09 28 2a 28 28 74 61 62 6c 65  ey) \..(*((table
16660 50 74 72 29 2d 3e 66 69 6e 64 50 72 6f 63 29 29  Ptr)->findProc))
16670 28 74 61 62 6c 65 50 74 72 2c 20 28 63 6f 6e 73  (tablePtr, (cons
16680 74 20 63 68 61 72 20 2a 29 28 6b 65 79 29 29 0a  t char *)(key)).
16690 23 75 6e 64 65 66 20 20 54 63 6c 5f 43 72 65 61  #undef  Tcl_Crea
166a0 74 65 48 61 73 68 45 6e 74 72 79 0a 23 64 65 66  teHashEntry.#def
166b0 69 6e 65 20 54 63 6c 5f 43 72 65 61 74 65 48 61  ine Tcl_CreateHa
166c0 73 68 45 6e 74 72 79 28 74 61 62 6c 65 50 74 72  shEntry(tablePtr
166d0 2c 20 6b 65 79 2c 20 6e 65 77 50 74 72 29 20 5c  , key, newPtr) \
166e0 0a 09 28 2a 28 28 74 61 62 6c 65 50 74 72 29 2d  ..(*((tablePtr)-
166f0 3e 63 72 65 61 74 65 50 72 6f 63 29 29 28 74 61  >createProc))(ta
16700 62 6c 65 50 74 72 2c 20 28 63 6f 6e 73 74 20 63  blePtr, (const c
16710 68 61 72 20 2a 29 28 6b 65 79 29 2c 20 6e 65 77  har *)(key), new
16720 50 74 72 29 0a 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d  Ptr)../*. *-----
16730 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
16740 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
16750 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
16760 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
16770 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 4d 61 63 72 6f  -------. * Macro
16780 73 20 74 68 61 74 20 65 6c 69 6d 69 6e 61 74 65  s that eliminate
16790 20 74 68 65 20 6f 76 65 72 68 65 61 64 20 6f 66   the overhead of
167a0 20 74 68 65 20 74 68 72 65 61 64 20 73 79 6e 63   the thread sync
167b0 68 72 6f 6e 69 7a 61 74 69 6f 6e 20 66 75 6e 63  hronization func
167c0 74 69 6f 6e 73 0a 20 2a 20 77 68 65 6e 20 63 6f  tions. * when co
167d0 6d 70 69 6c 69 6e 67 20 77 69 74 68 6f 75 74 20  mpiling without 
167e0 74 68 72 65 61 64 20 73 75 70 70 6f 72 74 2e 0a  thread support..
167f0 20 2a 2f 0a 0a 23 69 66 6e 64 65 66 20 54 43 4c   */..#ifndef TCL
16800 5f 54 48 52 45 41 44 53 0a 23 75 6e 64 65 66 20  _THREADS.#undef 
16810 20 54 63 6c 5f 4d 75 74 65 78 4c 6f 63 6b 0a 23   Tcl_MutexLock.#
16820 64 65 66 69 6e 65 20 54 63 6c 5f 4d 75 74 65 78  define Tcl_Mutex
16830 4c 6f 63 6b 28 6d 75 74 65 78 50 74 72 29 0a 23  Lock(mutexPtr).#
16840 75 6e 64 65 66 20 20 54 63 6c 5f 4d 75 74 65 78  undef  Tcl_Mutex
16850 55 6e 6c 6f 63 6b 0a 23 64 65 66 69 6e 65 20 54  Unlock.#define T
16860 63 6c 5f 4d 75 74 65 78 55 6e 6c 6f 63 6b 28 6d  cl_MutexUnlock(m
16870 75 74 65 78 50 74 72 29 0a 23 75 6e 64 65 66 20  utexPtr).#undef 
16880 20 54 63 6c 5f 4d 75 74 65 78 46 69 6e 61 6c 69   Tcl_MutexFinali
16890 7a 65 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f 4d  ze.#define Tcl_M
168a0 75 74 65 78 46 69 6e 61 6c 69 7a 65 28 6d 75 74  utexFinalize(mut
168b0 65 78 50 74 72 29 0a 23 75 6e 64 65 66 20 20 54  exPtr).#undef  T
168c0 63 6c 5f 43 6f 6e 64 69 74 69 6f 6e 4e 6f 74 69  cl_ConditionNoti
168d0 66 79 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f 43  fy.#define Tcl_C
168e0 6f 6e 64 69 74 69 6f 6e 4e 6f 74 69 66 79 28 63  onditionNotify(c
168f0 6f 6e 64 50 74 72 29 0a 23 75 6e 64 65 66 20 20  ondPtr).#undef  
16900 54 63 6c 5f 43 6f 6e 64 69 74 69 6f 6e 57 61 69  Tcl_ConditionWai
16910 74 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f 43 6f  t.#define Tcl_Co
16920 6e 64 69 74 69 6f 6e 57 61 69 74 28 63 6f 6e 64  nditionWait(cond
16930 50 74 72 2c 20 6d 75 74 65 78 50 74 72 2c 20 74  Ptr, mutexPtr, t
16940 69 6d 65 50 74 72 29 0a 23 75 6e 64 65 66 20 20  imePtr).#undef  
16950 54 63 6c 5f 43 6f 6e 64 69 74 69 6f 6e 46 69 6e  Tcl_ConditionFin
16960 61 6c 69 7a 65 0a 23 64 65 66 69 6e 65 20 54 63  alize.#define Tc
16970 6c 5f 43 6f 6e 64 69 74 69 6f 6e 46 69 6e 61 6c  l_ConditionFinal
16980 69 7a 65 28 63 6f 6e 64 50 74 72 29 0a 23 65 6e  ize(condPtr).#en
16990 64 69 66 20 2f 2a 20 54 43 4c 5f 54 48 52 45 41  dif /* TCL_THREA
169a0 44 53 20 2a 2f 0a 0a 2f 2a 0a 20 2a 2d 2d 2d 2d  DS */../*. *----
169b0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
169c0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
169d0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
169e0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
169f0 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 44 65 70 72  --------. * Depr
16a00 65 63 61 74 65 64 20 54 63 6c 20 66 75 6e 63 74  ecated Tcl funct
16a10 69 6f 6e 73 3a 0a 20 2a 2f 0a 0a 23 69 66 6e 64  ions:. */..#ifnd
16a20 65 66 20 54 43 4c 5f 4e 4f 5f 44 45 50 52 45 43  ef TCL_NO_DEPREC
16a30 41 54 45 44 0a 2f 2a 0a 20 2a 20 54 68 65 73 65  ATED./*. * These
16a40 20 66 75 6e 63 74 69 6f 6e 20 68 61 76 65 20 62   function have b
16a50 65 65 6e 20 72 65 6e 61 6d 65 64 2e 20 54 68 65  een renamed. The
16a60 20 6f 6c 64 20 6e 61 6d 65 73 20 61 72 65 20 64   old names are d
16a70 65 70 72 65 63 61 74 65 64 2c 20 62 75 74 20 77  eprecated, but w
16a80 65 0a 20 2a 20 64 65 66 69 6e 65 20 74 68 65 73  e. * define thes
16a90 65 20 6d 61 63 72 6f 73 20 66 6f 72 20 62 61 63  e macros for bac
16aa0 6b 77 61 72 64 73 20 63 6f 6d 70 61 74 69 62 69  kwards compatibi
16ab0 6c 69 74 79 2e 0a 20 2a 2f 0a 0a 23 20 20 20 64  lity.. */..#   d
16ac0 65 66 69 6e 65 20 54 63 6c 5f 43 6b 61 6c 6c 6f  efine Tcl_Ckallo
16ad0 63 09 09 54 63 6c 5f 41 6c 6c 6f 63 0a 23 20 20  c..Tcl_Alloc.#  
16ae0 20 64 65 66 69 6e 65 20 54 63 6c 5f 43 6b 66 72   define Tcl_Ckfr
16af0 65 65 09 09 54 63 6c 5f 46 72 65 65 0a 23 20 20  ee..Tcl_Free.#  
16b00 20 64 65 66 69 6e 65 20 54 63 6c 5f 43 6b 72 65   define Tcl_Ckre
16b10 61 6c 6c 6f 63 09 54 63 6c 5f 52 65 61 6c 6c 6f  alloc.Tcl_Reallo
16b20 63 0a 23 20 20 20 64 65 66 69 6e 65 20 54 63 6c  c.#   define Tcl
16b30 5f 52 65 74 75 72 6e 09 09 54 63 6c 5f 53 65 74  _Return..Tcl_Set
16b40 52 65 73 75 6c 74 0a 23 20 20 20 64 65 66 69 6e  Result.#   defin
16b50 65 20 54 63 6c 5f 54 69 6c 64 65 53 75 62 73 74  e Tcl_TildeSubst
16b60 09 54 63 6c 5f 54 72 61 6e 73 6c 61 74 65 46 69  .Tcl_TranslateFi
16b70 6c 65 4e 61 6d 65 0a 23 69 66 20 21 64 65 66 69  leName.#if !defi
16b80 6e 65 64 28 5f 5f 41 50 50 4c 45 5f 5f 29 20 2f  ned(__APPLE__) /
16b90 2a 20 4f 6e 20 4f 53 58 2c 20 74 68 65 72 65 20  * On OSX, there 
16ba0 69 73 20 61 20 63 6f 6e 66 6c 69 63 74 20 77 69  is a conflict wi
16bb0 74 68 20 22 6d 61 63 68 2f 6d 61 63 68 2e 68 22  th "mach/mach.h"
16bc0 20 2a 2f 0a 23 20 20 20 64 65 66 69 6e 65 20 70   */.#   define p
16bd0 61 6e 69 63 09 09 54 63 6c 5f 50 61 6e 69 63 0a  anic..Tcl_Panic.
16be0 23 65 6e 64 69 66 0a 23 20 20 20 64 65 66 69 6e  #endif.#   defin
16bf0 65 20 70 61 6e 69 63 56 41 09 09 54 63 6c 5f 50  e panicVA..Tcl_P
16c00 61 6e 69 63 56 41 0a 23 65 6e 64 69 66 20 2f 2a  anicVA.#endif /*
16c10 20 21 54 43 4c 5f 4e 4f 5f 44 45 50 52 45 43 41   !TCL_NO_DEPRECA
16c20 54 45 44 20 2a 2f 0a 0a 2f 2a 0a 20 2a 2d 2d 2d  TED */../*. *---
16c30 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
16c40 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
16c50 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
16c60 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
16c70 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 43 6f 6e  ---------. * Con
16c80 76 65 6e 69 65 6e 63 65 20 64 65 63 6c 61 72 61  venience declara
16c90 74 69 6f 6e 20 6f 66 20 54 63 6c 5f 41 70 70 49  tion of Tcl_AppI
16ca0 6e 69 74 20 66 6f 72 20 62 61 63 6b 77 61 72 64  nit for backward
16cb0 73 20 63 6f 6d 70 61 74 69 62 69 6c 69 74 79 2e  s compatibility.
16cc0 20 54 68 69 73 0a 20 2a 20 66 75 6e 63 74 69 6f   This. * functio
16cd0 6e 20 69 73 20 6e 6f 74 20 2a 69 6d 70 6c 65 6d  n is not *implem
16ce0 65 6e 74 65 64 2a 20 62 79 20 74 68 65 20 74 63  ented* by the tc
16cf0 6c 20 6c 69 62 72 61 72 79 2c 20 73 6f 20 74 68  l library, so th
16d00 65 20 73 74 6f 72 61 67 65 20 63 6c 61 73 73 20  e storage class 
16d10 69 73 0a 20 2a 20 6e 65 69 74 68 65 72 20 44 4c  is. * neither DL
16d20 4c 45 58 50 4f 52 54 20 6e 6f 72 20 44 4c 4c 49  LEXPORT nor DLLI
16d30 4d 50 4f 52 54 2e 0a 20 2a 2f 0a 0a 65 78 74 65  MPORT.. */..exte
16d40 72 6e 20 54 63 6c 5f 41 70 70 49 6e 69 74 50 72  rn Tcl_AppInitPr
16d50 6f 63 20 54 63 6c 5f 41 70 70 49 6e 69 74 3b 0a  oc Tcl_AppInit;.
16d60 0a 23 65 6e 64 69 66 20 2f 2a 20 52 43 5f 49 4e  .#endif /* RC_IN
16d70 56 4f 4b 45 44 20 2a 2f 0a 0a 2f 2a 0a 20 2a 20  VOKED */../*. * 
16d80 65 6e 64 20 62 6c 6f 63 6b 20 66 6f 72 20 43 2b  end block for C+
16d90 2b 0a 20 2a 2f 0a 0a 23 69 66 64 65 66 20 5f 5f  +. */..#ifdef __
16da0 63 70 6c 75 73 70 6c 75 73 0a 7d 0a 23 65 6e 64  cplusplus.}.#end
16db0 69 66 0a 0a 23 65 6e 64 69 66 20 2f 2a 20 5f 54  if..#endif /* _T
16dc0 43 4c 20 2a 2f 0a 0c 0a 2f 2a 0a 20 2a 20 4c 6f  CL */.../*. * Lo
16dd0 63 61 6c 20 56 61 72 69 61 62 6c 65 73 3a 0a 20  cal Variables:. 
16de0 2a 20 6d 6f 64 65 3a 20 63 0a 20 2a 20 63 2d 62  * mode: c. * c-b
16df0 61 73 69 63 2d 6f 66 66 73 65 74 3a 20 34 0a 20  asic-offset: 4. 
16e00 2a 20 66 69 6c 6c 2d 63 6f 6c 75 6d 6e 3a 20 37  * fill-column: 7
16e10 38 0a 20 2a 20 45 6e 64 3a 0a 20 2a 2f 0a        8. * End:. */.