Tcl Source Code

Hex Artifact Content
Login

Artifact 3b18bad11356907c0e342b889b9d80ecbc8946540d65a20d9b1c12139a2e75c3:


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 c2 a9 20   * Copyright © 
0080: 31 39 38 37 2d 31 39 39 34 20 54 68 65 20 52 65  1987-1994 The Re
0090: 67 65 6e 74 73 20 6f 66 20 74 68 65 20 55 6e 69  gents of the Uni
00a0: 76 65 72 73 69 74 79 20 6f 66 20 43 61 6c 69 66  versity of Calif
00b0: 6f 72 6e 69 61 2e 0a 20 2a 20 43 6f 70 79 72 69  ornia.. * Copyri
00c0: 67 68 74 20 c2 a9 20 31 39 39 33 2d 31 39 39 36  ght © 1993-1996
00d0: 20 4c 75 63 65 6e 74 20 54 65 63 68 6e 6f 6c 6f   Lucent Technolo
00e0: 67 69 65 73 2e 0a 20 2a 20 43 6f 70 79 72 69 67  gies.. * Copyrig
00f0: 68 74 20 c2 a9 20 31 39 39 34 2d 31 39 39 38 20  ht © 1994-1998 
0100: 53 75 6e 20 4d 69 63 72 6f 73 79 73 74 65 6d 73  Sun Microsystems
0110: 2c 20 49 6e 63 2e 0a 20 2a 20 43 6f 70 79 72 69  , Inc.. * Copyri
0120: 67 68 74 20 c2 a9 20 31 39 39 38 2d 32 30 30 30  ght © 1998-2000
0130: 20 62 79 20 53 63 72 69 70 74 69 63 73 20 43 6f   by Scriptics Co
0140: 72 70 6f 72 61 74 69 6f 6e 2e 0a 20 2a 20 43 6f  rporation.. * Co
0150: 70 79 72 69 67 68 74 20 c2 a9 20 32 30 30 32 20  pyright © 2002 
0160: 62 79 20 4b 65 76 69 6e 20 42 2e 20 4b 65 6e 6e  by Kevin B. Kenn
0170: 79 2e 20 20 41 6c 6c 20 72 69 67 68 74 73 20 72  y.  All rights r
0180: 65 73 65 72 76 65 64 2e 0a 20 2a 0a 20 2a 20 53  eserved.. *. * S
0190: 65 65 20 74 68 65 20 66 69 6c 65 20 22 6c 69 63  ee the file "lic
01a0: 65 6e 73 65 2e 74 65 72 6d 73 22 20 66 6f 72 20  ense.terms" for 
01b0: 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 6f 6e 20 75  information on u
01c0: 73 61 67 65 20 61 6e 64 20 72 65 64 69 73 74 72  sage and redistr
01d0: 69 62 75 74 69 6f 6e 20 6f 66 0a 20 2a 20 74 68  ibution of. * th
01e0: 69 73 20 66 69 6c 65 2c 20 61 6e 64 20 66 6f 72  is file, and for
01f0: 20 61 20 44 49 53 43 4c 41 49 4d 45 52 20 4f 46   a DISCLAIMER OF
0200: 20 41 4c 4c 20 57 41 52 52 41 4e 54 49 45 53 2e   ALL WARRANTIES.
0210: 0a 20 2a 2f 0a 0a 23 69 66 6e 64 65 66 20 5f 54  . */..#ifndef _T
0220: 43 4c 0a 23 64 65 66 69 6e 65 20 5f 54 43 4c 0a  CL.#define _TCL.
0230: 0a 2f 2a 0a 20 2a 20 46 6f 72 20 43 2b 2b 20 63  ./*. * For C++ c
0240: 6f 6d 70 69 6c 65 72 73 2c 20 75 73 65 20 65 78  ompilers, use ex
0250: 74 65 72 6e 20 22 43 22 0a 20 2a 2f 0a 0a 23 69  tern "C". */..#i
0260: 66 64 65 66 20 5f 5f 63 70 6c 75 73 70 6c 75 73  fdef __cplusplus
0270: 0a 65 78 74 65 72 6e 20 22 43 22 20 7b 0a 23 65  .extern "C" {.#e
0280: 6e 64 69 66 0a 0a 2f 2a 0a 20 2a 20 54 68 65 20  ndif../*. * The 
0290: 66 6f 6c 6c 6f 77 69 6e 67 20 64 65 66 69 6e 65  following define
02a0: 73 20 61 72 65 20 75 73 65 64 20 74 6f 20 69 6e  s are used to in
02b0: 64 69 63 61 74 65 20 74 68 65 20 76 61 72 69 6f  dicate the vario
02c0: 75 73 20 72 65 6c 65 61 73 65 20 6c 65 76 65 6c  us release level
02d0: 73 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20  s.. */..#define 
02e0: 54 43 4c 5f 41 4c 50 48 41 5f 52 45 4c 45 41 53  TCL_ALPHA_RELEAS
02f0: 45 09 30 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f  E.0.#define TCL_
0300: 42 45 54 41 5f 52 45 4c 45 41 53 45 09 31 0a 23  BETA_RELEASE.1.#
0310: 64 65 66 69 6e 65 20 54 43 4c 5f 46 49 4e 41 4c  define TCL_FINAL
0320: 5f 52 45 4c 45 41 53 45 09 32 0a 0a 2f 2a 0a 20  _RELEASE.2../*. 
0330: 2a 20 57 68 65 6e 20 76 65 72 73 69 6f 6e 20 6e  * When version n
0340: 75 6d 62 65 72 73 20 63 68 61 6e 67 65 20 68 65  umbers change he
0350: 72 65 2c 20 6d 75 73 74 20 61 6c 73 6f 20 67 6f  re, must also go
0360: 20 69 6e 74 6f 20 74 68 65 20 66 6f 6c 6c 6f 77   into the follow
0370: 69 6e 67 20 66 69 6c 65 73 20 61 6e 64 0a 20 2a  ing files and. *
0380: 20 75 70 64 61 74 65 20 74 68 65 20 76 65 72 73   update the vers
0390: 69 6f 6e 20 6e 75 6d 62 65 72 73 3a 0a 20 2a 0a  ion numbers:. *.
03a0: 20 2a 20 6c 69 62 72 61 72 79 2f 69 6e 69 74 2e   * library/init.
03b0: 74 63 6c 09 28 31 20 4c 4f 43 20 70 61 74 63 68  tcl.(1 LOC patch
03c0: 29 0a 20 2a 20 75 6e 69 78 2f 63 6f 6e 66 69 67  ). * unix/config
03d0: 75 72 65 2e 61 63 09 28 32 20 4c 4f 43 20 4d 61  ure.ac.(2 LOC Ma
03e0: 6a 6f 72 2c 20 32 20 4c 4f 43 20 6d 69 6e 6f 72  jor, 2 LOC minor
03f0: 2c 20 31 20 4c 4f 43 20 70 61 74 63 68 29 0a 20  , 1 LOC patch). 
0400: 2a 20 77 69 6e 2f 63 6f 6e 66 69 67 75 72 65 2e  * win/configure.
0410: 61 63 09 28 61 73 20 61 62 6f 76 65 29 0a 20 2a  ac.(as above). *
0420: 20 77 69 6e 2f 74 63 6c 2e 6d 34 09 09 28 6e 6f   win/tcl.m4..(no
0430: 74 20 70 61 74 63 68 6c 65 76 65 6c 29 0a 20 2a  t patchlevel). *
0440: 20 52 45 41 44 4d 45 2e 6d 64 09 09 28 73 65 63   README.md..(sec
0450: 74 69 6f 6e 73 20 30 20 61 6e 64 20 32 2c 20 77  tions 0 and 2, w
0460: 69 74 68 20 61 6e 64 20 77 69 74 68 6f 75 74 20  ith and without 
0470: 73 65 70 61 72 61 74 6f 72 29 0a 20 2a 20 77 69  separator). * wi
0480: 6e 2f 52 45 41 44 4d 45 09 09 28 6e 6f 74 20 70  n/README..(not p
0490: 61 74 63 68 6c 65 76 65 6c 29 20 28 73 65 63 74  atchlevel) (sect
04a0: 69 6f 6e 73 20 30 20 61 6e 64 20 32 29 0a 20 2a  ions 0 and 2). *
04b0: 20 75 6e 69 78 2f 74 63 6c 2e 73 70 65 63 09 28   unix/tcl.spec.(
04c0: 31 20 4c 4f 43 20 70 61 74 63 68 29 0a 20 2a 2f  1 LOC patch). */
04d0: 0a 0a 23 69 66 20 21 64 65 66 69 6e 65 64 28 54  ..#if !defined(T
04e0: 43 4c 5f 4d 41 4a 4f 52 5f 56 45 52 53 49 4f 4e  CL_MAJOR_VERSION
04f0: 29 0a 23 20 20 20 64 65 66 69 6e 65 20 54 43 4c  ).#   define TCL
0500: 5f 4d 41 4a 4f 52 5f 56 45 52 53 49 4f 4e 09 39  _MAJOR_VERSION.9
0510: 0a 23 65 6e 64 69 66 0a 23 69 66 20 54 43 4c 5f  .#endif.#if TCL_
0520: 4d 41 4a 4f 52 5f 56 45 52 53 49 4f 4e 20 21 3d  MAJOR_VERSION !=
0530: 20 39 0a 23 20 20 20 65 72 72 6f 72 20 22 54 68   9.#   error "Th
0540: 69 73 20 68 65 61 64 65 72 2d 66 69 6c 65 20 69  is header-file i
0550: 73 20 66 6f 72 20 54 63 6c 20 39 20 6f 6e 6c 79  s for Tcl 9 only
0560: 22 0a 23 65 6e 64 69 66 0a 23 64 65 66 69 6e 65  ".#endif.#define
0570: 20 54 43 4c 5f 4d 49 4e 4f 52 5f 56 45 52 53 49   TCL_MINOR_VERSI
0580: 4f 4e 20 20 20 31 0a 23 64 65 66 69 6e 65 20 54  ON   1.#define T
0590: 43 4c 5f 52 45 4c 45 41 53 45 5f 4c 45 56 45 4c  CL_RELEASE_LEVEL
05a0: 20 20 20 54 43 4c 5f 46 49 4e 41 4c 5f 52 45 4c     TCL_FINAL_REL
05b0: 45 41 53 45 0a 23 64 65 66 69 6e 65 20 54 43 4c  EASE.#define TCL
05c0: 5f 52 45 4c 45 41 53 45 5f 53 45 52 49 41 4c 20  _RELEASE_SERIAL 
05d0: 20 31 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f   1..#define TCL_
05e0: 56 45 52 53 49 4f 4e 09 20 20 20 20 22 39 2e 31  VERSION.    "9.1
05f0: 22 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 50 41  ".#define TCL_PA
0600: 54 43 48 5f 4c 45 56 45 4c 09 20 20 20 20 22 39  TCH_LEVEL.    "9
0610: 2e 31 2e 31 22 0a 0c 0a 23 69 66 20 64 65 66 69  .1.1"...#if defi
0620: 6e 65 64 28 52 43 5f 49 4e 56 4f 4b 45 44 29 0a  ned(RC_INVOKED).
0630: 2f 2a 0a 20 2a 20 55 74 69 6c 69 74 79 20 6d 61  /*. * Utility ma
0640: 63 72 6f 73 3a 20 53 54 52 49 4e 47 49 46 59 20  cros: STRINGIFY 
0650: 74 61 6b 65 73 20 61 6e 20 61 72 67 75 6d 65 6e  takes an argumen
0660: 74 20 61 6e 64 20 77 72 61 70 73 20 69 74 20 69  t and wraps it i
0670: 6e 20 22 22 20 28 64 6f 75 62 6c 65 0a 20 2a 20  n "" (double. * 
0680: 71 75 6f 74 61 74 69 6f 6e 20 6d 61 72 6b 73 29  quotation marks)
0690: 2c 20 4a 4f 49 4e 20 6a 6f 69 6e 73 20 74 77 6f  , JOIN joins two
06a0: 20 61 72 67 75 6d 65 6e 74 73 2e 0a 20 2a 2f 0a   arguments.. */.
06b0: 0a 23 69 66 6e 64 65 66 20 53 54 52 49 4e 47 49  .#ifndef STRINGI
06c0: 46 59 0a 23 20 20 64 65 66 69 6e 65 20 53 54 52  FY.#  define STR
06d0: 49 4e 47 49 46 59 28 78 29 20 53 54 52 49 4e 47  INGIFY(x) STRING
06e0: 49 46 59 31 28 78 29 0a 23 20 20 64 65 66 69 6e  IFY1(x).#  defin
06f0: 65 20 53 54 52 49 4e 47 49 46 59 31 28 78 29 20  e STRINGIFY1(x) 
0700: 23 78 0a 23 65 6e 64 69 66 0a 23 69 66 6e 64 65  #x.#endif.#ifnde
0710: 66 20 4a 4f 49 4e 0a 23 20 20 64 65 66 69 6e 65  f JOIN.#  define
0720: 20 4a 4f 49 4e 28 61 2c 62 29 20 4a 4f 49 4e 31   JOIN(a,b) JOIN1
0730: 28 61 2c 62 29 0a 23 20 20 64 65 66 69 6e 65 20  (a,b).#  define 
0740: 4a 4f 49 4e 31 28 61 2c 62 29 20 61 23 23 62 0a  JOIN1(a,b) a##b.
0750: 23 65 6e 64 69 66 0a 23 65 6e 64 69 66 20 2f 2a  #endif.#endif /*
0760: 20 52 43 5f 49 4e 56 4f 4b 45 44 20 2a 2f 0a 0a   RC_INVOKED */..
0770: 2f 2a 0a 20 2a 20 41 20 73 70 65 63 69 61 6c 20  /*. * A special 
0780: 64 65 66 69 6e 69 74 69 6f 6e 20 75 73 65 64 20  definition used 
0790: 74 6f 20 61 6c 6c 6f 77 20 74 68 69 73 20 68 65  to allow this he
07a0: 61 64 65 72 20 66 69 6c 65 20 74 6f 20 62 65 20  ader file to be 
07b0: 69 6e 63 6c 75 64 65 64 20 66 72 6f 6d 0a 20 2a  included from. *
07c0: 20 77 69 6e 64 6f 77 73 20 72 65 73 6f 75 72 63   windows resourc
07d0: 65 20 66 69 6c 65 73 20 73 6f 20 74 68 61 74 20  e files so that 
07e0: 74 68 65 79 20 63 61 6e 20 6f 62 74 61 69 6e 20  they can obtain 
07f0: 76 65 72 73 69 6f 6e 20 69 6e 66 6f 72 6d 61 74  version informat
0800: 69 6f 6e 2e 0a 20 2a 20 52 43 5f 49 4e 56 4f 4b  ion.. * RC_INVOK
0810: 45 44 20 69 73 20 64 65 66 69 6e 65 64 20 62 79  ED is defined by
0820: 20 64 65 66 61 75 6c 74 20 62 79 20 74 68 65 20   default by the 
0830: 77 69 6e 64 6f 77 73 20 52 43 20 74 6f 6f 6c 2e  windows RC tool.
0840: 0a 20 2a 0a 20 2a 20 52 65 73 6f 75 72 63 65 20  . *. * Resource 
0850: 63 6f 6d 70 69 6c 65 72 73 20 64 6f 6e 27 74 20  compilers don't 
0860: 6c 69 6b 65 20 61 6c 6c 20 74 68 65 20 43 20 73  like all the C s
0870: 74 75 66 66 2c 20 6c 69 6b 65 20 74 79 70 65 64  tuff, like typed
0880: 65 66 73 20 61 6e 64 20 66 75 6e 63 74 69 6f 6e  efs and function
0890: 0a 20 2a 20 64 65 63 6c 61 72 61 74 69 6f 6e 73  . * declarations
08a0: 2c 20 74 68 61 74 20 6f 63 63 75 72 20 62 65 6c  , that occur bel
08b0: 6f 77 2c 20 73 6f 20 62 6c 6f 63 6b 20 74 68 65  ow, so block the
08c0: 6d 20 6f 75 74 2e 0a 20 2a 2f 0a 0a 23 69 66 6e  m out.. */..#ifn
08d0: 64 65 66 20 52 43 5f 49 4e 56 4f 4b 45 44 0a 0a  def RC_INVOKED..
08e0: 2f 2a 0a 20 2a 20 53 70 65 63 69 61 6c 20 6d 61  /*. * Special ma
08f0: 63 72 6f 20 74 6f 20 64 65 66 69 6e 65 20 6d 75  cro to define mu
0900: 74 65 78 65 73 2e 0a 20 2a 2f 0a 0a 23 64 65 66  texes.. */..#def
0910: 69 6e 65 20 54 43 4c 5f 44 45 43 4c 41 52 45 5f  ine TCL_DECLARE_
0920: 4d 55 54 45 58 28 6e 61 6d 65 29 20 5c 0a 20 20  MUTEX(name) \.  
0930: 20 20 73 74 61 74 69 63 20 54 63 6c 5f 4d 75 74    static Tcl_Mut
0940: 65 78 20 6e 61 6d 65 3b 0a 0a 2f 2a 0a 20 2a 20  ex name;../*. * 
0950: 54 63 6c 27 73 20 70 75 62 6c 69 63 20 72 6f 75  Tcl's public rou
0960: 74 69 6e 65 20 54 63 6c 5f 46 53 53 65 65 6b 28  tine Tcl_FSSeek(
0970: 29 20 75 73 65 73 20 74 68 65 20 76 61 6c 75 65  ) uses the value
0980: 73 20 53 45 45 4b 5f 53 45 54 2c 20 53 45 45 4b  s SEEK_SET, SEEK
0990: 5f 43 55 52 2c 20 61 6e 64 0a 20 2a 20 53 45 45  _CUR, and. * SEE
09a0: 4b 5f 45 4e 44 2c 20 61 6c 6c 20 23 64 65 66 69  K_END, all #defi
09b0: 6e 65 27 64 20 62 79 20 73 74 64 69 6f 2e 68 20  ne'd by stdio.h 
09c0: 2e 0a 20 2a 0a 20 2a 20 41 6c 73 6f 2c 20 6d 61  .. *. * Also, ma
09d0: 6e 79 20 65 78 74 65 6e 73 69 6f 6e 73 20 6e 65  ny extensions ne
09e0: 65 64 20 73 74 64 69 6f 2e 68 2c 20 61 6e 64 20  ed stdio.h, and 
09f0: 74 68 65 79 27 76 65 20 67 72 6f 77 6e 20 61 63  they've grown ac
0a00: 63 75 73 74 6f 6d 65 64 20 74 6f 20 74 63 6c 2e  customed to tcl.
0a10: 68 0a 20 2a 20 70 72 6f 76 69 64 69 6e 67 20 69  h. * providing i
0a20: 74 20 66 6f 72 20 74 68 65 6d 20 72 61 74 68 65  t for them rathe
0a30: 72 20 74 68 61 6e 20 23 69 6e 63 6c 75 64 65 2d  r than #include-
0a40: 69 6e 67 20 69 74 20 74 68 65 6d 73 65 6c 76 65  ing it themselve
0a50: 73 20 61 73 20 74 68 65 79 0a 20 2a 20 73 68 6f  s as they. * sho
0a60: 75 6c 64 2c 20 73 6f 20 61 6c 73 6f 20 66 6f 72  uld, so also for
0a70: 20 74 68 65 69 72 20 73 61 6b 65 2c 20 77 65 20   their sake, we 
0a80: 6b 65 65 70 20 74 68 65 20 23 69 6e 63 6c 75 64  keep the #includ
0a90: 65 20 74 6f 20 62 65 20 63 6f 6e 73 69 73 74 65  e to be consiste
0aa0: 6e 74 20 77 69 74 68 0a 20 2a 20 70 72 69 6f 72  nt with. * prior
0ab0: 20 54 63 6c 20 72 65 6c 65 61 73 65 73 2e 0a 20   Tcl releases.. 
0ac0: 2a 2f 0a 0a 23 69 6e 63 6c 75 64 65 20 3c 73 74  */..#include <st
0ad0: 64 69 6f 2e 68 3e 0a 23 69 6e 63 6c 75 64 65 20  dio.h>.#include 
0ae0: 3c 73 74 64 64 65 66 2e 68 3e 0a 0a 23 69 66 20  <stddef.h>..#if 
0af0: 64 65 66 69 6e 65 64 28 5f 5f 47 4e 55 43 5f 5f  defined(__GNUC__
0b00: 29 20 26 26 20 28 5f 5f 47 4e 55 43 5f 5f 20 3e  ) && (__GNUC__ >
0b10: 20 32 29 0a 23 20 20 20 69 66 20 64 65 66 69 6e   2).#   if defin
0b20: 65 64 28 5f 57 49 4e 33 32 29 20 26 26 20 64 65  ed(_WIN32) && de
0b30: 66 69 6e 65 64 28 5f 5f 55 53 45 5f 4d 49 4e 47  fined(__USE_MING
0b40: 57 5f 41 4e 53 49 5f 53 54 44 49 4f 29 20 26 26  W_ANSI_STDIO) &&
0b50: 20 5f 5f 55 53 45 5f 4d 49 4e 47 57 5f 41 4e 53   __USE_MINGW_ANS
0b60: 49 5f 53 54 44 49 4f 0a 23 09 64 65 66 69 6e 65  I_STDIO.#.define
0b70: 20 54 43 4c 5f 46 4f 52 4d 41 54 5f 50 52 49 4e   TCL_FORMAT_PRIN
0b80: 54 46 28 61 2c 62 29 20 5f 5f 61 74 74 72 69 62  TF(a,b) __attrib
0b90: 75 74 65 5f 5f 20 28 28 5f 5f 66 6f 72 6d 61 74  ute__ ((__format
0ba0: 5f 5f 20 28 5f 5f 4d 49 4e 47 57 5f 50 52 49 4e  __ (__MINGW_PRIN
0bb0: 54 46 5f 46 4f 52 4d 41 54 2c 20 61 2c 20 62 29  TF_FORMAT, a, b)
0bc0: 29 29 0a 23 20 20 20 65 6c 73 65 0a 23 09 64 65  )).#   else.#.de
0bd0: 66 69 6e 65 20 54 43 4c 5f 46 4f 52 4d 41 54 5f  fine TCL_FORMAT_
0be0: 50 52 49 4e 54 46 28 61 2c 62 29 20 5f 5f 61 74  PRINTF(a,b) __at
0bf0: 74 72 69 62 75 74 65 5f 5f 20 28 28 5f 5f 66 6f  tribute__ ((__fo
0c00: 72 6d 61 74 5f 5f 20 28 5f 5f 70 72 69 6e 74 66  rmat__ (__printf
0c10: 5f 5f 2c 20 61 2c 20 62 29 29 29 0a 23 20 20 20  __, a, b))).#   
0c20: 65 6e 64 69 66 0a 23 20 20 20 64 65 66 69 6e 65  endif.#   define
0c30: 20 54 43 4c 5f 4e 4f 52 45 54 55 52 4e 20 5f 5f   TCL_NORETURN __
0c40: 61 74 74 72 69 62 75 74 65 5f 5f 20 28 28 5f 5f  attribute__ ((__
0c50: 6e 6f 72 65 74 75 72 6e 5f 5f 29 29 0a 23 20 20  noreturn__)).#  
0c60: 20 64 65 66 69 6e 65 20 54 43 4c 5f 4e 4f 49 4e   define TCL_NOIN
0c70: 4c 49 4e 45 20 5f 5f 61 74 74 72 69 62 75 74 65  LINE __attribute
0c80: 5f 5f 20 28 28 5f 5f 6e 6f 69 6e 6c 69 6e 65 5f  __ ((__noinline_
0c90: 5f 29 29 0a 23 20 20 20 64 65 66 69 6e 65 20 54  _)).#   define T
0ca0: 43 4c 5f 4e 4f 52 45 54 55 52 4e 31 20 5f 5f 61  CL_NORETURN1 __a
0cb0: 74 74 72 69 62 75 74 65 5f 5f 20 28 28 5f 5f 6e  ttribute__ ((__n
0cc0: 6f 72 65 74 75 72 6e 5f 5f 29 29 0a 23 65 6c 73  oreturn__)).#els
0cd0: 65 0a 23 20 20 20 64 65 66 69 6e 65 20 54 43 4c  e.#   define TCL
0ce0: 5f 46 4f 52 4d 41 54 5f 50 52 49 4e 54 46 28 61  _FORMAT_PRINTF(a
0cf0: 2c 62 29 0a 23 20 20 20 69 66 20 64 65 66 69 6e  ,b).#   if defin
0d00: 65 64 28 5f 4d 53 43 5f 56 45 52 29 0a 23 09 64  ed(_MSC_VER).#.d
0d10: 65 66 69 6e 65 20 54 43 4c 5f 4e 4f 52 45 54 55  efine TCL_NORETU
0d20: 52 4e 20 5f 5f 64 65 63 6c 73 70 65 63 28 6e 6f  RN __declspec(no
0d30: 72 65 74 75 72 6e 29 0a 23 09 64 65 66 69 6e 65  return).#.define
0d40: 20 54 43 4c 5f 4e 4f 49 4e 4c 49 4e 45 20 5f 5f   TCL_NOINLINE __
0d50: 64 65 63 6c 73 70 65 63 28 6e 6f 69 6e 6c 69 6e  declspec(noinlin
0d60: 65 29 0a 23 20 20 20 65 6c 73 65 0a 23 09 64 65  e).#   else.#.de
0d70: 66 69 6e 65 20 54 43 4c 5f 4e 4f 52 45 54 55 52  fine TCL_NORETUR
0d80: 4e 20 2f 2a 20 6e 6f 74 68 69 6e 67 20 2a 2f 0a  N /* nothing */.
0d90: 23 09 64 65 66 69 6e 65 20 54 43 4c 5f 4e 4f 49  #.define TCL_NOI
0da0: 4e 4c 49 4e 45 20 2f 2a 20 6e 6f 74 68 69 6e 67  NLINE /* nothing
0db0: 20 2a 2f 0a 23 20 20 20 65 6e 64 69 66 0a 23 20   */.#   endif.# 
0dc0: 20 20 64 65 66 69 6e 65 20 54 43 4c 5f 4e 4f 52    define TCL_NOR
0dd0: 45 54 55 52 4e 31 20 2f 2a 20 6e 6f 74 68 69 6e  ETURN1 /* nothin
0de0: 67 20 2a 2f 0a 23 65 6e 64 69 66 0a 0a 2f 2a 0a  g */.#endif../*.
0df0: 20 2a 20 41 6c 6c 6f 77 20 61 20 70 61 72 74 20   * Allow a part 
0e00: 6f 66 20 54 63 6c 27 73 20 41 50 49 20 74 6f 20  of Tcl's API to 
0e10: 62 65 20 65 78 70 6c 69 63 69 74 6c 79 20 6d 61  be explicitly ma
0e20: 72 6b 65 64 20 61 73 20 64 65 70 72 65 63 61 74  rked as deprecat
0e30: 65 64 2e 0a 20 2a 0a 20 2a 20 55 73 65 64 20 74  ed.. *. * Used t
0e40: 6f 20 6d 61 6b 65 20 54 49 50 20 33 33 30 2f 33  o make TIP 330/3
0e50: 33 36 20 67 65 6e 65 72 61 74 65 20 6d 6f 61 6e  36 generate moan
0e60: 73 20 65 76 65 6e 20 69 66 20 70 65 6f 70 6c 65  s even if people
0e70: 20 75 73 65 20 74 68 65 0a 20 2a 20 63 6f 6d 70   use the. * comp
0e80: 61 74 69 62 69 6c 69 74 79 20 6d 61 63 72 6f 73  atibility macros
0e90: 2e 20 43 68 61 6e 67 65 20 79 6f 75 72 20 63 6f  . Change your co
0ea0: 64 65 2c 20 67 75 79 73 21 20 57 65 20 77 6f 6e  de, guys! We won
0eb0: 27 74 20 73 75 70 70 6f 72 74 20 79 6f 75 20 66  't support you f
0ec0: 6f 72 65 76 65 72 2e 0a 20 2a 2f 0a 0a 23 69 66  orever.. */..#if
0ed0: 20 64 65 66 69 6e 65 64 28 5f 5f 47 4e 55 43 5f   defined(__GNUC_
0ee0: 5f 29 20 26 26 20 28 28 5f 5f 47 4e 55 43 5f 5f  _) && ((__GNUC__
0ef0: 20 3e 3d 20 34 29 20 7c 7c 20 28 28 5f 5f 47 4e   >= 4) || ((__GN
0f00: 55 43 5f 5f 20 3d 3d 20 33 29 20 26 26 20 28 5f  UC__ == 3) && (_
0f10: 5f 47 4e 55 43 5f 4d 49 4e 4f 52 5f 5f 20 3e 3d  _GNUC_MINOR__ >=
0f20: 20 31 29 29 29 0a 23 20 20 20 69 66 20 28 5f 5f   1))).#   if (__
0f30: 47 4e 55 43 5f 5f 20 3e 20 34 29 20 7c 7c 20 28  GNUC__ > 4) || (
0f40: 28 5f 5f 47 4e 55 43 5f 5f 20 3d 3d 20 34 29 20  (__GNUC__ == 4) 
0f50: 26 26 20 28 5f 5f 47 4e 55 43 5f 4d 49 4e 4f 52  && (__GNUC_MINOR
0f60: 5f 5f 20 3e 3d 20 35 29 29 0a 23 09 64 65 66 69  __ >= 5)).#.defi
0f70: 6e 65 20 54 43 4c 5f 44 45 50 52 45 43 41 54 45  ne TCL_DEPRECATE
0f80: 44 5f 41 50 49 28 6d 73 67 29 09 5f 5f 61 74 74  D_API(msg).__att
0f90: 72 69 62 75 74 65 5f 5f 20 28 28 5f 5f 64 65 70  ribute__ ((__dep
0fa0: 72 65 63 61 74 65 64 5f 5f 20 28 6d 73 67 29 29  recated__ (msg))
0fb0: 29 0a 23 20 20 20 65 6c 73 65 0a 23 09 64 65 66  ).#   else.#.def
0fc0: 69 6e 65 20 54 43 4c 5f 44 45 50 52 45 43 41 54  ine TCL_DEPRECAT
0fd0: 45 44 5f 41 50 49 28 6d 73 67 29 09 5f 5f 61 74  ED_API(msg).__at
0fe0: 74 72 69 62 75 74 65 5f 5f 20 28 28 5f 5f 64 65  tribute__ ((__de
0ff0: 70 72 65 63 61 74 65 64 5f 5f 29 29 0a 23 20 20  precated__)).#  
1000: 20 65 6e 64 69 66 0a 23 65 6c 73 65 0a 23 20 20   endif.#else.#  
1010: 20 64 65 66 69 6e 65 20 54 43 4c 5f 44 45 50 52   define TCL_DEPR
1020: 45 43 41 54 45 44 5f 41 50 49 28 6d 73 67 29 09  ECATED_API(msg).
1030: 2f 2a 20 6e 6f 74 68 69 6e 67 20 70 6f 72 74 61  /* nothing porta
1040: 62 6c 65 20 2a 2f 0a 23 65 6e 64 69 66 0a 0a 2f  ble */.#endif../
1050: 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  *. *------------
1060: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1070: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1080: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
1090: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
10a0: 0a 20 2a 20 4d 61 63 72 6f 73 20 75 73 65 64 20  . * Macros used 
10b0: 74 6f 20 64 65 63 6c 61 72 65 20 61 20 66 75 6e  to declare a fun
10c0: 63 74 69 6f 6e 20 74 6f 20 62 65 20 65 78 70 6f  ction to be expo
10d0: 72 74 65 64 20 62 79 20 61 20 44 4c 4c 2e 20 55  rted by a DLL. U
10e0: 73 65 64 20 62 79 20 57 69 6e 64 6f 77 73 2c 0a  sed by Windows,.
10f0: 20 2a 20 6d 61 70 73 20 74 6f 20 6e 6f 2d 6f 70   * maps to no-op
1100: 20 64 65 63 6c 61 72 61 74 69 6f 6e 73 20 6f 6e   declarations on
1110: 20 6e 6f 6e 2d 57 69 6e 64 6f 77 73 20 73 79 73   non-Windows sys
1120: 74 65 6d 73 2e 20 54 68 65 20 64 65 66 61 75 6c  tems. The defaul
1130: 74 20 62 75 69 6c 64 20 6f 6e 0a 20 2a 20 77 69  t build on. * wi
1140: 6e 64 6f 77 73 20 69 73 20 66 6f 72 20 61 20 44  ndows is for a D
1150: 4c 4c 2c 20 77 68 69 63 68 20 63 61 75 73 65 73  LL, which causes
1160: 20 74 68 65 20 44 4c 4c 49 4d 50 4f 52 54 20 61   the DLLIMPORT a
1170: 6e 64 20 44 4c 4c 45 58 50 4f 52 54 20 6d 61 63  nd DLLEXPORT mac
1180: 72 6f 73 20 74 6f 20 62 65 0a 20 2a 20 6e 6f 6e  ros to be. * non
1190: 65 6d 70 74 79 2e 20 54 6f 20 62 75 69 6c 64 20  empty. To build 
11a0: 61 20 73 74 61 74 69 63 20 6c 69 62 72 61 72 79  a static library
11b0: 2c 20 74 68 65 20 6d 61 63 72 6f 20 53 54 41 54  , the macro STAT
11c0: 49 43 5f 42 55 49 4c 44 20 73 68 6f 75 6c 64 20  IC_BUILD should 
11d0: 62 65 0a 20 2a 20 64 65 66 69 6e 65 64 2e 0a 20  be. * defined.. 
11e0: 2a 0a 20 2a 20 4e 6f 74 65 3a 20 77 68 65 6e 20  *. * Note: when 
11f0: 62 75 69 6c 64 69 6e 67 20 73 74 61 74 69 63 20  building static 
1200: 62 75 74 20 6c 69 6e 6b 69 6e 67 20 64 79 6e 61  but linking dyna
1210: 6d 69 63 61 6c 6c 79 20 74 6f 20 4d 53 56 43 52  mically to MSVCR
1220: 54 20 77 65 20 6d 75 73 74 20 73 74 69 6c 6c 0a  T we must still.
1230: 20 2a 20 20 20 20 20 20 20 63 6f 72 72 65 63 74   *       correct
1240: 6c 79 20 64 65 63 6f 72 61 74 65 20 74 68 65 20  ly decorate the 
1250: 43 20 6c 69 62 72 61 72 79 20 69 6d 70 6f 72 74  C library import
1260: 65 64 20 66 75 6e 63 74 69 6f 6e 2e 20 20 55 73  ed function.  Us
1270: 65 20 43 52 54 49 4d 50 4f 52 54 0a 20 2a 20 20  e CRTIMPORT. *  
1280: 20 20 20 20 20 66 6f 72 20 74 68 69 73 20 70 75       for this pu
1290: 72 70 6f 73 65 2e 20 20 5f 44 4c 4c 20 69 73 20  rpose.  _DLL is 
12a0: 64 65 66 69 6e 65 64 20 62 79 20 74 68 65 20 63  defined by the c
12b0: 6f 6d 70 69 6c 65 72 20 77 68 65 6e 20 6c 69 6e  ompiler when lin
12c0: 6b 69 6e 67 20 74 6f 0a 20 2a 20 20 20 20 20 20  king to. *      
12d0: 20 4d 53 56 43 52 54 2e 0a 20 2a 2f 0a 0a 23 69   MSVCRT.. */..#i
12e0: 66 64 65 66 20 5f 57 49 4e 33 32 0a 23 20 20 20  fdef _WIN32.#   
12f0: 69 66 64 65 66 20 53 54 41 54 49 43 5f 42 55 49  ifdef STATIC_BUI
1300: 4c 44 0a 23 20 20 20 20 20 20 20 64 65 66 69 6e  LD.#       defin
1310: 65 20 44 4c 4c 49 4d 50 4f 52 54 0a 23 20 20 20  e DLLIMPORT.#   
1320: 20 20 20 20 64 65 66 69 6e 65 20 44 4c 4c 45 58      define DLLEX
1330: 50 4f 52 54 0a 23 20 20 20 20 20 20 20 69 66 64  PORT.#       ifd
1340: 65 66 20 5f 44 4c 4c 0a 23 20 20 20 20 20 20 20  ef _DLL.#       
1350: 20 20 20 20 64 65 66 69 6e 65 20 43 52 54 49 4d      define CRTIM
1360: 50 4f 52 54 20 5f 5f 64 65 63 6c 73 70 65 63 28  PORT __declspec(
1370: 64 6c 6c 69 6d 70 6f 72 74 29 0a 23 20 20 20 20  dllimport).#    
1380: 20 20 20 65 6c 73 65 0a 23 20 20 20 20 20 20 20     else.#       
1390: 20 20 20 20 64 65 66 69 6e 65 20 43 52 54 49 4d      define CRTIM
13a0: 50 4f 52 54 0a 23 20 20 20 20 20 20 20 65 6e 64  PORT.#       end
13b0: 69 66 0a 23 20 20 20 65 6c 73 65 0a 23 20 20 20  if.#   else.#   
13c0: 20 20 20 20 64 65 66 69 6e 65 20 44 4c 4c 49 4d      define DLLIM
13d0: 50 4f 52 54 20 5f 5f 64 65 63 6c 73 70 65 63 28  PORT __declspec(
13e0: 64 6c 6c 69 6d 70 6f 72 74 29 0a 23 20 20 20 20  dllimport).#    
13f0: 20 20 20 64 65 66 69 6e 65 20 44 4c 4c 45 58 50     define DLLEXP
1400: 4f 52 54 20 5f 5f 64 65 63 6c 73 70 65 63 28 64  ORT __declspec(d
1410: 6c 6c 65 78 70 6f 72 74 29 0a 23 20 20 20 20 20  llexport).#     
1420: 20 20 64 65 66 69 6e 65 20 43 52 54 49 4d 50 4f    define CRTIMPO
1430: 52 54 20 5f 5f 64 65 63 6c 73 70 65 63 28 64 6c  RT __declspec(dl
1440: 6c 69 6d 70 6f 72 74 29 0a 23 20 20 20 65 6e 64  limport).#   end
1450: 69 66 0a 23 65 6c 73 65 0a 23 20 20 20 64 65 66  if.#else.#   def
1460: 69 6e 65 20 44 4c 4c 49 4d 50 4f 52 54 0a 23 20  ine DLLIMPORT.# 
1470: 20 20 69 66 20 64 65 66 69 6e 65 64 28 5f 5f 47    if defined(__G
1480: 4e 55 43 5f 5f 29 20 26 26 20 5f 5f 47 4e 55 43  NUC__) && __GNUC
1490: 5f 5f 20 3e 20 33 0a 23 20 20 20 20 20 20 20 64  __ > 3.#       d
14a0: 65 66 69 6e 65 20 44 4c 4c 45 58 50 4f 52 54 20  efine DLLEXPORT 
14b0: 5f 5f 61 74 74 72 69 62 75 74 65 5f 5f 20 28 28  __attribute__ ((
14c0: 76 69 73 69 62 69 6c 69 74 79 28 22 64 65 66 61  visibility("defa
14d0: 75 6c 74 22 29 29 29 0a 23 20 20 20 65 6c 73 65  ult"))).#   else
14e0: 0a 23 20 20 20 20 20 20 20 64 65 66 69 6e 65 20  .#       define 
14f0: 44 4c 4c 45 58 50 4f 52 54 0a 23 20 20 20 65 6e  DLLEXPORT.#   en
1500: 64 69 66 0a 23 20 20 20 64 65 66 69 6e 65 20 43  dif.#   define C
1510: 52 54 49 4d 50 4f 52 54 0a 23 65 6e 64 69 66 0a  RTIMPORT.#endif.
1520: 0a 2f 2a 0a 20 2a 20 54 68 65 73 65 20 6d 61 63  ./*. * These mac
1530: 72 6f 73 20 61 72 65 20 75 73 65 64 20 74 6f 20  ros are used to 
1540: 63 6f 6e 74 72 6f 6c 20 77 68 65 74 68 65 72 20  control whether 
1550: 66 75 6e 63 74 69 6f 6e 73 20 61 72 65 20 62 65  functions are be
1560: 69 6e 67 20 64 65 63 6c 61 72 65 64 20 66 6f 72  ing declared for
1570: 0a 20 2a 20 69 6d 70 6f 72 74 20 6f 72 20 65 78  . * import or ex
1580: 70 6f 72 74 2e 20 49 66 20 61 20 66 75 6e 63 74  port. If a funct
1590: 69 6f 6e 20 69 73 20 62 65 69 6e 67 20 64 65 63  ion is being dec
15a0: 6c 61 72 65 64 20 77 68 69 6c 65 20 69 74 20 69  lared while it i
15b0: 73 20 62 65 69 6e 67 20 62 75 69 6c 74 0a 20 2a  s being built. *
15c0: 20 74 6f 20 62 65 20 69 6e 63 6c 75 64 65 64 20   to be included 
15d0: 69 6e 20 61 20 73 68 61 72 65 64 20 6c 69 62 72  in a shared libr
15e0: 61 72 79 2c 20 74 68 65 6e 20 69 74 20 73 68 6f  ary, then it sho
15f0: 75 6c 64 20 68 61 76 65 20 74 68 65 20 44 4c 4c  uld have the DLL
1600: 45 58 50 4f 52 54 0a 20 2a 20 73 74 6f 72 61 67  EXPORT. * storag
1610: 65 20 63 6c 61 73 73 2e 20 49 66 20 69 73 20 62  e class. If is b
1620: 65 69 6e 67 20 64 65 63 6c 61 72 65 64 20 66 6f  eing declared fo
1630: 72 20 75 73 65 20 62 79 20 61 20 6d 6f 64 75 6c  r use by a modul
1640: 65 20 74 68 61 74 20 69 73 20 67 6f 69 6e 67 20  e that is going 
1650: 74 6f 0a 20 2a 20 6c 69 6e 6b 20 61 67 61 69 6e  to. * link again
1660: 73 74 20 74 68 65 20 73 68 61 72 65 64 20 6c 69  st the shared li
1670: 62 72 61 72 79 2c 20 74 68 65 6e 20 69 74 20 73  brary, then it s
1680: 68 6f 75 6c 64 20 68 61 76 65 20 74 68 65 20 44  hould have the D
1690: 4c 4c 49 4d 50 4f 52 54 20 73 74 6f 72 61 67 65  LLIMPORT storage
16a0: 0a 20 2a 20 63 6c 61 73 73 2e 20 49 66 20 74 68  . * class. If th
16b0: 65 20 73 79 6d 62 6f 6c 20 69 73 20 62 65 69 6e  e symbol is bein
16c0: 67 20 64 65 63 6c 61 72 65 64 20 66 6f 72 20 61  g declared for a
16d0: 20 73 74 61 74 69 63 20 62 75 69 6c 64 20 6f 72   static build or
16e0: 20 66 6f 72 20 75 73 65 20 66 72 6f 6d 20 61 0a   for use from a.
16f0: 20 2a 20 73 74 75 62 20 6c 69 62 72 61 72 79 2c   * stub library,
1700: 20 74 68 65 6e 20 74 68 65 20 73 74 6f 72 61 67   then the storag
1710: 65 20 63 6c 61 73 73 20 73 68 6f 75 6c 64 20 62  e class should b
1720: 65 20 65 6d 70 74 79 2e 0a 20 2a 0a 20 2a 20 54  e empty.. *. * T
1730: 68 65 20 63 6f 6e 76 65 6e 74 69 6f 6e 20 69 73  he convention is
1740: 20 74 68 61 74 20 61 20 6d 61 63 72 6f 20 63 61   that a macro ca
1750: 6c 6c 65 64 20 42 55 49 4c 44 5f 78 78 78 78 2c  lled BUILD_xxxx,
1760: 20 77 68 65 72 65 20 78 78 78 78 20 69 73 20 74   where xxxx is t
1770: 68 65 20 6e 61 6d 65 20 6f 66 0a 20 2a 20 61 20  he name of. * a 
1780: 6c 69 62 72 61 72 79 20 77 65 20 61 72 65 20 62  library we are b
1790: 75 69 6c 64 69 6e 67 2c 20 69 73 20 73 65 74 20  uilding, is set 
17a0: 6f 6e 20 74 68 65 20 63 6f 6d 70 69 6c 65 20 6c  on the compile l
17b0: 69 6e 65 20 66 6f 72 20 73 6f 75 72 63 65 73 20  ine for sources 
17c0: 74 68 61 74 20 61 72 65 0a 20 2a 20 74 6f 20 62  that are. * to b
17d0: 65 20 70 6c 61 63 65 64 20 69 6e 20 74 68 65 20  e placed in the 
17e0: 6c 69 62 72 61 72 79 2e 20 57 68 65 6e 20 74 68  library. When th
17f0: 69 73 20 6d 61 63 72 6f 20 69 73 20 73 65 74 2c  is macro is set,
1800: 20 74 68 65 20 73 74 6f 72 61 67 65 20 63 6c 61   the storage cla
1810: 73 73 20 77 69 6c 6c 0a 20 2a 20 62 65 20 73 65  ss will. * be se
1820: 74 20 74 6f 20 44 4c 4c 45 58 50 4f 52 54 2e 20  t to DLLEXPORT. 
1830: 41 74 20 74 68 65 20 65 6e 64 20 6f 66 20 74 68  At the end of th
1840: 65 20 68 65 61 64 65 72 20 66 69 6c 65 2c 20 74  e header file, t
1850: 68 65 20 73 74 6f 72 61 67 65 20 63 6c 61 73 73  he storage class
1860: 20 77 69 6c 6c 0a 20 2a 20 62 65 20 72 65 73 65   will. * be rese
1870: 74 20 74 6f 20 44 4c 4c 49 4d 50 4f 52 54 2e 0a  t to DLLIMPORT..
1880: 20 2a 2f 0a 0a 23 75 6e 64 65 66 20 54 43 4c 5f   */..#undef TCL_
1890: 53 54 4f 52 41 47 45 5f 43 4c 41 53 53 0a 23 69  STORAGE_CLASS.#i
18a0: 66 64 65 66 20 42 55 49 4c 44 5f 74 63 6c 0a 23  fdef BUILD_tcl.#
18b0: 20 20 20 64 65 66 69 6e 65 20 54 43 4c 5f 53 54     define TCL_ST
18c0: 4f 52 41 47 45 5f 43 4c 41 53 53 20 44 4c 4c 45  ORAGE_CLASS DLLE
18d0: 58 50 4f 52 54 0a 23 65 6c 73 65 0a 23 20 20 20  XPORT.#else.#   
18e0: 69 66 64 65 66 20 55 53 45 5f 54 43 4c 5f 53 54  ifdef USE_TCL_ST
18f0: 55 42 53 0a 23 20 20 20 20 20 20 64 65 66 69 6e  UBS.#      defin
1900: 65 20 54 43 4c 5f 53 54 4f 52 41 47 45 5f 43 4c  e TCL_STORAGE_CL
1910: 41 53 53 0a 23 20 20 20 65 6c 73 65 0a 23 20 20  ASS.#   else.#  
1920: 20 20 20 20 64 65 66 69 6e 65 20 54 43 4c 5f 53      define TCL_S
1930: 54 4f 52 41 47 45 5f 43 4c 41 53 53 20 44 4c 4c  TORAGE_CLASS DLL
1940: 49 4d 50 4f 52 54 0a 23 20 20 20 65 6e 64 69 66  IMPORT.#   endif
1950: 0a 23 65 6e 64 69 66 0a 0a 23 69 66 20 21 64 65  .#endif..#if !de
1960: 66 69 6e 65 64 28 43 4f 4e 53 54 38 36 29 20 26  fined(CONST86) &
1970: 26 20 21 64 65 66 69 6e 65 64 28 54 43 4c 5f 4e  & !defined(TCL_N
1980: 4f 5f 44 45 50 52 45 43 41 54 45 44 29 0a 23 20  O_DEPRECATED).# 
1990: 20 20 20 20 20 64 65 66 69 6e 65 20 43 4f 4e 53       define CONS
19a0: 54 38 36 20 63 6f 6e 73 74 0a 23 65 6e 64 69 66  T86 const.#endif
19b0: 0a 0a 2f 2a 0a 20 2a 20 4d 61 6b 65 20 73 75 72  ../*. * Make sur
19c0: 65 20 45 58 54 45 52 4e 20 69 73 6e 27 74 20 64  e EXTERN isn't d
19d0: 65 66 69 6e 65 64 20 65 6c 73 65 77 68 65 72 65  efined elsewhere
19e0: 2e 0a 20 2a 2f 0a 0a 23 69 66 64 65 66 20 45 58  .. */..#ifdef EX
19f0: 54 45 52 4e 0a 23 20 20 20 75 6e 64 65 66 20 45  TERN.#   undef E
1a00: 58 54 45 52 4e 0a 23 65 6e 64 69 66 20 2f 2a 20  XTERN.#endif /* 
1a10: 45 58 54 45 52 4e 20 2a 2f 0a 0a 23 69 66 64 65  EXTERN */..#ifde
1a20: 66 20 5f 5f 63 70 6c 75 73 70 6c 75 73 0a 23 20  f __cplusplus.# 
1a30: 20 20 64 65 66 69 6e 65 20 45 58 54 45 52 4e 20    define EXTERN 
1a40: 65 78 74 65 72 6e 20 22 43 22 20 54 43 4c 5f 53  extern "C" TCL_S
1a50: 54 4f 52 41 47 45 5f 43 4c 41 53 53 0a 23 65 6c  TORAGE_CLASS.#el
1a60: 73 65 0a 23 20 20 20 64 65 66 69 6e 65 20 45 58  se.#   define EX
1a70: 54 45 52 4e 20 65 78 74 65 72 6e 20 54 43 4c 5f  TERN extern TCL_
1a80: 53 54 4f 52 41 47 45 5f 43 4c 41 53 53 0a 23 65  STORAGE_CLASS.#e
1a90: 6e 64 69 66 0a 0a 2f 2a 0a 20 2a 20 4d 69 73 63  ndif../*. * Misc
1aa0: 65 6c 6c 61 6e 65 6f 75 73 20 64 65 63 6c 61 72  ellaneous declar
1ab0: 61 74 69 6f 6e 73 2e 0a 20 2a 2f 0a 0a 74 79 70  ations.. */..typ
1ac0: 65 64 65 66 20 76 6f 69 64 20 2a 43 6c 69 65 6e  edef void *Clien
1ad0: 74 44 61 74 61 3b 0a 0a 2f 2a 0a 20 2a 20 44 61  tData;../*. * Da
1ae0: 72 77 69 6e 20 73 70 65 63 69 66 69 63 20 63 6f  rwin specific co
1af0: 6e 66 69 67 75 72 65 20 6f 76 65 72 72 69 64 65  nfigure override
1b00: 73 20 28 74 6f 20 73 75 70 70 6f 72 74 20 66 61  s (to support fa
1b10: 74 20 63 6f 6d 70 69 6c 65 73 2c 20 77 68 65 72  t compiles, wher
1b20: 65 0a 20 2a 20 63 6f 6e 66 69 67 75 72 65 20 72  e. * configure r
1b30: 75 6e 73 20 6f 6e 6c 79 20 6f 6e 63 65 20 66 6f  uns only once fo
1b40: 72 20 6d 75 6c 74 69 70 6c 65 20 61 72 63 68 69  r multiple archi
1b50: 74 65 63 74 75 72 65 73 29 3a 0a 20 2a 2f 0a 0a  tectures):. */..
1b60: 23 69 66 64 65 66 20 5f 5f 41 50 50 4c 45 5f 5f  #ifdef __APPLE__
1b70: 0a 23 20 20 20 69 66 64 65 66 20 5f 5f 4c 50 36  .#   ifdef __LP6
1b80: 34 5f 5f 0a 23 09 64 65 66 69 6e 65 20 54 43 4c  4__.#.define TCL
1b90: 5f 57 49 44 45 5f 49 4e 54 5f 49 53 5f 4c 4f 4e  _WIDE_INT_IS_LON
1ba0: 47 20 31 0a 23 09 64 65 66 69 6e 65 20 54 43 4c  G 1.#.define TCL
1bb0: 5f 43 46 47 5f 44 4f 36 34 42 49 54 20 31 0a 23  _CFG_DO64BIT 1.#
1bc0: 20 20 20 20 65 6c 73 65 20 2f 2a 20 21 5f 5f 4c      else /* !__L
1bd0: 50 36 34 5f 5f 20 2a 2f 0a 23 09 75 6e 64 65 66  P64__ */.#.undef
1be0: 20 54 43 4c 5f 57 49 44 45 5f 49 4e 54 5f 49 53   TCL_WIDE_INT_IS
1bf0: 5f 4c 4f 4e 47 0a 23 09 75 6e 64 65 66 20 54 43  _LONG.#.undef TC
1c00: 4c 5f 43 46 47 5f 44 4f 36 34 42 49 54 0a 23 20  L_CFG_DO64BIT.# 
1c10: 20 20 20 65 6e 64 69 66 20 2f 2a 20 5f 5f 4c 50     endif /* __LP
1c20: 36 34 5f 5f 20 2a 2f 0a 23 20 20 20 20 75 6e 64  64__ */.#    und
1c30: 65 66 20 48 41 56 45 5f 53 54 52 55 43 54 5f 53  ef HAVE_STRUCT_S
1c40: 54 41 54 36 34 0a 23 65 6e 64 69 66 20 2f 2a 20  TAT64.#endif /* 
1c50: 5f 5f 41 50 50 4c 45 5f 5f 20 2a 2f 0a 0a 2f 2a  __APPLE__ */../*
1c60: 20 43 72 6f 73 73 2d 63 6f 6d 70 69 6c 69 6e 67   Cross-compiling
1c70: 20 33 32 2d 62 69 74 20 6f 6e 20 61 20 36 34 2d   32-bit on a 64-
1c80: 62 69 74 20 70 6c 61 74 66 6f 72 6d 3f 20 54 68  bit platform? Th
1c90: 65 6e 20 6f 75 72 0a 20 2a 20 63 6f 6e 66 69 67  en our. * config
1ca0: 75 72 65 20 73 63 72 69 70 74 20 64 6f 65 73 20  ure script does 
1cb0: 74 68 65 20 77 72 6f 6e 67 20 74 68 69 6e 67 2e  the wrong thing.
1cc0: 20 43 6f 72 72 65 63 74 20 74 68 61 74 20 68 65   Correct that he
1cd0: 72 65 2e 0a 20 2a 2f 0a 23 69 66 20 64 65 66 69  re.. */.#if defi
1ce0: 6e 65 64 28 5f 5f 47 4e 55 43 5f 5f 29 20 26 26  ned(__GNUC__) &&
1cf0: 20 21 64 65 66 69 6e 65 64 28 5f 57 49 4e 33 32   !defined(_WIN32
1d00: 29 20 26 26 20 21 64 65 66 69 6e 65 64 28 5f 5f  ) && !defined(__
1d10: 4c 50 36 34 5f 5f 29 0a 23 20 20 20 75 6e 64 65  LP64__).#   unde
1d20: 66 20 54 43 4c 5f 57 49 44 45 5f 49 4e 54 5f 49  f TCL_WIDE_INT_I
1d30: 53 5f 4c 4f 4e 47 0a 23 65 6e 64 69 66 0a 0a 2f  S_LONG.#endif../
1d40: 2a 0a 20 2a 20 44 65 66 69 6e 65 20 54 63 6c 5f  *. * Define Tcl_
1d50: 57 69 64 65 49 6e 74 20 74 6f 20 62 65 20 61 20  WideInt to be a 
1d60: 74 79 70 65 20 74 68 61 74 20 69 73 20 28 61 74  type that is (at
1d70: 20 6c 65 61 73 74 29 20 36 34 2d 62 69 74 73 20   least) 64-bits 
1d80: 77 69 64 65 2c 20 61 6e 64 20 64 65 66 69 6e 65  wide, and define
1d90: 0a 20 2a 20 54 63 6c 5f 57 69 64 65 55 49 6e 74  . * Tcl_WideUInt
1da0: 20 74 6f 20 62 65 20 74 68 65 20 75 6e 73 69 67   to be the unsig
1db0: 6e 65 64 20 76 61 72 69 61 6e 74 20 6f 66 20 74  ned variant of t
1dc0: 68 61 74 20 74 79 70 65 20 28 61 73 73 75 6d 69  hat type (assumi
1dd0: 6e 67 20 74 68 61 74 20 77 68 65 72 65 0a 20 2a  ng that where. *
1de0: 20 77 65 20 68 61 76 65 20 6f 6e 65 2c 20 77 65   we have one, we
1df0: 20 63 61 6e 20 68 61 76 65 20 74 68 65 20 6f 74   can have the ot
1e00: 68 65 72 2e 29 0a 20 2a 0a 20 2a 20 41 6c 73 6f  her.). *. * Also
1e10: 20 64 65 66 69 6e 65 73 20 74 68 65 20 66 6f 6c   defines the fol
1e20: 6c 6f 77 69 6e 67 20 6d 61 63 72 6f 73 3a 0a 20  lowing macros:. 
1e30: 2a 20 54 43 4c 5f 57 49 44 45 5f 49 4e 54 5f 49  * TCL_WIDE_INT_I
1e40: 53 5f 4c 4f 4e 47 20 2d 20 69 66 20 77 69 64 65  S_LONG - if wide
1e50: 20 69 6e 74 73 20 61 72 65 20 72 65 61 6c 6c 79   ints are really
1e60: 20 6c 6f 6e 67 73 20 28 69 2e 65 2e 20 77 65 27   longs (i.e. we'
1e70: 72 65 20 6f 6e 20 61 0a 20 2a 09 4c 50 36 34 20  re on a. *.LP64 
1e80: 73 79 73 74 65 6d 20 73 75 63 68 20 61 73 20 6d  system such as m
1e90: 6f 64 65 72 6e 20 53 6f 6c 61 72 69 73 20 6f 72  odern Solaris or
1ea0: 20 4c 69 6e 75 78 20 2e 2e 2e 20 6e 6f 74 20 69   Linux ... not i
1eb0: 6e 63 6c 75 64 69 6e 67 20 57 69 6e 36 34 29 0a  ncluding Win64).
1ec0: 20 2a 20 54 63 6c 5f 57 69 64 65 41 73 4c 6f 6e   * Tcl_WideAsLon
1ed0: 67 20 2d 20 66 6f 72 67 65 74 66 75 6c 20 63 6f  g - forgetful co
1ee0: 6e 76 65 72 74 65 72 20 66 72 6f 6d 20 77 69 64  nverter from wid
1ef0: 65 49 6e 74 20 74 6f 20 6c 6f 6e 67 2e 0a 20 2a  eInt to long.. *
1f00: 20 54 63 6c 5f 4c 6f 6e 67 41 73 57 69 64 65 20   Tcl_LongAsWide 
1f10: 2d 20 73 69 67 6e 2d 65 78 74 65 6e 64 69 6e 67  - sign-extending
1f20: 20 63 6f 6e 76 65 72 74 65 72 20 66 72 6f 6d 20   converter from 
1f30: 6c 6f 6e 67 20 74 6f 20 77 69 64 65 49 6e 74 2e  long to wideInt.
1f40: 0a 20 2a 20 54 63 6c 5f 57 69 64 65 41 73 44 6f  . * Tcl_WideAsDo
1f50: 75 62 6c 65 20 2d 20 63 6f 6e 76 65 72 74 65 72  uble - converter
1f60: 20 66 72 6f 6d 20 77 69 64 65 49 6e 74 20 74 6f   from wideInt to
1f70: 20 64 6f 75 62 6c 65 2e 0a 20 2a 20 54 63 6c 5f   double.. * Tcl_
1f80: 44 6f 75 62 6c 65 41 73 57 69 64 65 20 2d 20 63  DoubleAsWide - c
1f90: 6f 6e 76 65 72 74 65 72 20 66 72 6f 6d 20 64 6f  onverter from do
1fa0: 75 62 6c 65 20 74 6f 20 77 69 64 65 49 6e 74 2e  uble to wideInt.
1fb0: 0a 20 2a 0a 20 2a 20 54 68 65 20 66 6f 6c 6c 6f  . *. * The follo
1fc0: 77 69 6e 67 20 69 6e 76 61 72 69 61 6e 74 20 73  wing invariant s
1fd0: 68 6f 75 6c 64 20 68 6f 6c 64 20 66 6f 72 20 61  hould hold for a
1fe0: 6e 79 20 6c 6f 6e 67 20 76 61 6c 75 65 20 27 6c  ny long value 'l
1ff0: 6f 6e 67 56 61 6c 27 3a 0a 20 2a 09 6c 6f 6e 67  ongVal':. *.long
2000: 56 61 6c 20 3d 3d 20 54 63 6c 5f 57 69 64 65 41  Val == Tcl_WideA
2010: 73 4c 6f 6e 67 28 54 63 6c 5f 4c 6f 6e 67 41 73  sLong(Tcl_LongAs
2020: 57 69 64 65 28 6c 6f 6e 67 56 61 6c 29 29 0a 20  Wide(longVal)). 
2030: 2a 2f 0a 0a 23 69 66 20 21 64 65 66 69 6e 65 64  */..#if !defined
2040: 28 54 43 4c 5f 57 49 44 45 5f 49 4e 54 5f 54 59  (TCL_WIDE_INT_TY
2050: 50 45 29 20 26 26 20 21 64 65 66 69 6e 65 64 28  PE) && !defined(
2060: 54 43 4c 5f 57 49 44 45 5f 49 4e 54 5f 49 53 5f  TCL_WIDE_INT_IS_
2070: 4c 4f 4e 47 29 20 26 26 20 21 64 65 66 69 6e 65  LONG) && !define
2080: 64 28 5f 57 49 4e 33 32 29 20 26 26 20 21 64 65  d(_WIN32) && !de
2090: 66 69 6e 65 64 28 5f 5f 47 4e 55 43 5f 5f 29 0a  fined(__GNUC__).
20a0: 2f 2a 0a 20 2a 20 44 6f 6e 27 74 20 6b 6e 6f 77  /*. * Don't know
20b0: 20 77 68 61 74 20 70 6c 61 74 66 6f 72 6d 20 69   what platform i
20c0: 74 20 69 73 20 61 6e 64 20 63 6f 6e 66 69 67 75  t is and configu
20d0: 72 65 20 68 61 73 6e 27 74 20 64 69 73 63 6f 76  re hasn't discov
20e0: 65 72 65 64 20 77 68 61 74 20 69 73 0a 20 2a 20  ered what is. * 
20f0: 67 6f 69 6e 67 20 6f 6e 20 66 6f 72 20 75 73 2e  going on for us.
2100: 20 54 72 79 20 74 6f 20 67 75 65 73 73 2e 2e 2e   Try to guess...
2110: 0a 20 2a 2f 0a 23 20 20 20 69 6e 63 6c 75 64 65  . */.#   include
2120: 20 3c 6c 69 6d 69 74 73 2e 68 3e 0a 23 20 20 20   <limits.h>.#   
2130: 69 66 20 64 65 66 69 6e 65 64 28 4c 4c 4f 4e 47  if defined(LLONG
2140: 5f 4d 41 58 29 20 26 26 20 28 4c 4c 4f 4e 47 5f  _MAX) && (LLONG_
2150: 4d 41 58 20 3d 3d 20 4c 4f 4e 47 5f 4d 41 58 29  MAX == LONG_MAX)
2160: 0a 23 09 64 65 66 69 6e 65 20 54 43 4c 5f 57 49  .#.define TCL_WI
2170: 44 45 5f 49 4e 54 5f 49 53 5f 4c 4f 4e 47 09 31  DE_INT_IS_LONG.1
2180: 0a 23 20 20 20 65 6e 64 69 66 0a 23 65 6e 64 69  .#   endif.#endi
2190: 66 0a 0a 23 69 66 6e 64 65 66 20 54 43 4c 5f 57  f..#ifndef TCL_W
21a0: 49 44 45 5f 49 4e 54 5f 54 59 50 45 0a 23 20 20  IDE_INT_TYPE.#  
21b0: 20 64 65 66 69 6e 65 20 54 43 4c 5f 57 49 44 45   define TCL_WIDE
21c0: 5f 49 4e 54 5f 54 59 50 45 09 09 6c 6f 6e 67 20  _INT_TYPE..long 
21d0: 6c 6f 6e 67 0a 23 65 6e 64 69 66 20 2f 2a 20 21  long.#endif /* !
21e0: 54 43 4c 5f 57 49 44 45 5f 49 4e 54 5f 54 59 50  TCL_WIDE_INT_TYP
21f0: 45 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 54 43  E */..typedef TC
2200: 4c 5f 57 49 44 45 5f 49 4e 54 5f 54 59 50 45 09  L_WIDE_INT_TYPE.
2210: 09 54 63 6c 5f 57 69 64 65 49 6e 74 3b 0a 74 79  .Tcl_WideInt;.ty
2220: 70 65 64 65 66 20 75 6e 73 69 67 6e 65 64 20 54  pedef unsigned T
2230: 43 4c 5f 57 49 44 45 5f 49 4e 54 5f 54 59 50 45  CL_WIDE_INT_TYPE
2240: 09 54 63 6c 5f 57 69 64 65 55 49 6e 74 3b 0a 0a  .Tcl_WideUInt;..
2250: 23 69 66 6e 64 65 66 20 54 43 4c 5f 4c 4c 5f 4d  #ifndef TCL_LL_M
2260: 4f 44 49 46 49 45 52 0a 23 20 20 20 69 66 20 64  ODIFIER.#   if d
2270: 65 66 69 6e 65 64 28 5f 57 49 4e 33 32 29 20 26  efined(_WIN32) &
2280: 26 20 21 64 65 66 69 6e 65 64 28 5f 55 43 52 54  & !defined(_UCRT
2290: 29 20 26 26 20 21 28 64 65 66 69 6e 65 64 28 5f  ) && !(defined(_
22a0: 5f 55 53 45 5f 4d 49 4e 47 57 5f 41 4e 53 49 5f  _USE_MINGW_ANSI_
22b0: 53 54 44 49 4f 29 20 26 26 20 5f 5f 55 53 45 5f  STDIO) && __USE_
22c0: 4d 49 4e 47 57 5f 41 4e 53 49 5f 53 54 44 49 4f  MINGW_ANSI_STDIO
22d0: 29 0a 23 09 64 65 66 69 6e 65 20 54 43 4c 5f 4c  ).#.define TCL_L
22e0: 4c 5f 4d 4f 44 49 46 49 45 52 09 22 49 36 34 22  L_MODIFIER."I64"
22f0: 0a 23 20 20 20 65 6c 73 65 0a 23 09 64 65 66 69  .#   else.#.defi
2300: 6e 65 20 54 43 4c 5f 4c 4c 5f 4d 4f 44 49 46 49  ne TCL_LL_MODIFI
2310: 45 52 09 22 6c 6c 22 0a 23 20 20 20 65 6e 64 69  ER."ll".#   endi
2320: 66 0a 23 65 6e 64 69 66 20 2f 2a 20 21 54 43 4c  f.#endif /* !TCL
2330: 5f 4c 4c 5f 4d 4f 44 49 46 49 45 52 20 2a 2f 0a  _LL_MODIFIER */.
2340: 23 69 66 6e 64 65 66 20 54 43 4c 5f 5a 5f 4d 4f  #ifndef TCL_Z_MO
2350: 44 49 46 49 45 52 0a 23 20 20 20 69 66 20 64 65  DIFIER.#   if de
2360: 66 69 6e 65 64 28 5f 5f 47 4e 55 43 5f 5f 29 20  fined(__GNUC__) 
2370: 26 26 20 21 64 65 66 69 6e 65 64 28 5f 57 49 4e  && !defined(_WIN
2380: 33 32 29 0a 23 09 64 65 66 69 6e 65 20 54 43 4c  32).#.define TCL
2390: 5f 5a 5f 4d 4f 44 49 46 49 45 52 09 22 7a 22 0a  _Z_MODIFIER."z".
23a0: 23 20 20 20 65 6c 69 66 20 64 65 66 69 6e 65 64  #   elif defined
23b0: 28 5f 57 49 4e 36 34 29 0a 23 09 64 65 66 69 6e  (_WIN64).#.defin
23c0: 65 20 54 43 4c 5f 5a 5f 4d 4f 44 49 46 49 45 52  e TCL_Z_MODIFIER
23d0: 09 54 43 4c 5f 4c 4c 5f 4d 4f 44 49 46 49 45 52  .TCL_LL_MODIFIER
23e0: 0a 23 20 20 20 65 6c 73 65 0a 23 09 64 65 66 69  .#   else.#.defi
23f0: 6e 65 20 54 43 4c 5f 5a 5f 4d 4f 44 49 46 49 45  ne TCL_Z_MODIFIE
2400: 52 09 22 22 0a 23 20 20 20 65 6e 64 69 66 0a 23  R."".#   endif.#
2410: 65 6e 64 69 66 20 2f 2a 20 21 54 43 4c 5f 5a 5f  endif /* !TCL_Z_
2420: 4d 4f 44 49 46 49 45 52 20 2a 2f 0a 23 69 66 6e  MODIFIER */.#ifn
2430: 64 65 66 20 54 43 4c 5f 54 5f 4d 4f 44 49 46 49  def TCL_T_MODIFI
2440: 45 52 0a 23 20 20 20 69 66 20 64 65 66 69 6e 65  ER.#   if define
2450: 64 28 5f 5f 47 4e 55 43 5f 5f 29 20 26 26 20 21  d(__GNUC__) && !
2460: 64 65 66 69 6e 65 64 28 5f 57 49 4e 33 32 29 0a  defined(_WIN32).
2470: 23 09 64 65 66 69 6e 65 20 54 43 4c 5f 54 5f 4d  #.define TCL_T_M
2480: 4f 44 49 46 49 45 52 09 22 74 22 0a 23 20 20 20  ODIFIER."t".#   
2490: 65 6c 69 66 20 64 65 66 69 6e 65 64 28 5f 57 49  elif defined(_WI
24a0: 4e 36 34 29 0a 23 09 64 65 66 69 6e 65 20 54 43  N64).#.define TC
24b0: 4c 5f 54 5f 4d 4f 44 49 46 49 45 52 09 54 43 4c  L_T_MODIFIER.TCL
24c0: 5f 4c 4c 5f 4d 4f 44 49 46 49 45 52 0a 23 20 20  _LL_MODIFIER.#  
24d0: 20 65 6c 73 65 0a 23 09 64 65 66 69 6e 65 20 54   else.#.define T
24e0: 43 4c 5f 54 5f 4d 4f 44 49 46 49 45 52 09 54 43  CL_T_MODIFIER.TC
24f0: 4c 5f 5a 5f 4d 4f 44 49 46 49 45 52 0a 23 20 20  L_Z_MODIFIER.#  
2500: 20 65 6e 64 69 66 0a 23 65 6e 64 69 66 20 2f 2a   endif.#endif /*
2510: 20 21 54 43 4c 5f 54 5f 4d 4f 44 49 46 49 45 52   !TCL_T_MODIFIER
2520: 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 63 6c   */..#define Tcl
2530: 5f 57 69 64 65 41 73 4c 6f 6e 67 28 76 61 6c 29  _WideAsLong(val)
2540: 09 28 28 6c 6f 6e 67 29 28 28 54 63 6c 5f 57 69  .((long)((Tcl_Wi
2550: 64 65 49 6e 74 29 28 76 61 6c 29 29 29 0a 23 64  deInt)(val))).#d
2560: 65 66 69 6e 65 20 54 63 6c 5f 4c 6f 6e 67 41 73  efine Tcl_LongAs
2570: 57 69 64 65 28 76 61 6c 29 09 28 28 54 63 6c 5f  Wide(val).((Tcl_
2580: 57 69 64 65 49 6e 74 29 28 28 6c 6f 6e 67 29 28  WideInt)((long)(
2590: 76 61 6c 29 29 29 0a 23 64 65 66 69 6e 65 20 54  val))).#define T
25a0: 63 6c 5f 57 69 64 65 41 73 44 6f 75 62 6c 65 28  cl_WideAsDouble(
25b0: 76 61 6c 29 09 28 28 64 6f 75 62 6c 65 29 28 28  val).((double)((
25c0: 54 63 6c 5f 57 69 64 65 49 6e 74 29 28 76 61 6c  Tcl_WideInt)(val
25d0: 29 29 29 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f  ))).#define Tcl_
25e0: 44 6f 75 62 6c 65 41 73 57 69 64 65 28 76 61 6c  DoubleAsWide(val
25f0: 29 09 28 28 54 63 6c 5f 57 69 64 65 49 6e 74 29  ).((Tcl_WideInt)
2600: 28 28 64 6f 75 62 6c 65 29 28 76 61 6c 29 29 29  ((double)(val)))
2610: 0a 0a 74 79 70 65 64 65 66 20 70 74 72 64 69 66  ..typedef ptrdif
2620: 66 5f 74 20 54 63 6c 5f 53 69 7a 65 3b 0a 23 64  f_t Tcl_Size;.#d
2630: 65 66 69 6e 65 20 54 43 4c 5f 53 49 5a 45 5f 4d  efine TCL_SIZE_M
2640: 41 58 20 28 28 54 63 6c 5f 53 69 7a 65 29 28 28  AX ((Tcl_Size)((
2650: 28 73 69 7a 65 5f 74 29 2d 31 29 3e 3e 31 29 29  (size_t)-1)>>1))
2660: 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 53 49 5a  .#define TCL_SIZ
2670: 45 5f 4d 4f 44 49 46 49 45 52 20 54 43 4c 5f 54  E_MODIFIER TCL_T
2680: 5f 4d 4f 44 49 46 49 45 52 0a 0a 23 69 66 64 65  _MODIFIER..#ifde
2690: 66 20 5f 57 49 4e 33 32 0a 20 20 20 20 74 79 70  f _WIN32.    typ
26a0: 65 64 65 66 20 73 74 72 75 63 74 20 5f 5f 73 74  edef struct __st
26b0: 61 74 36 34 20 54 63 6c 5f 53 74 61 74 42 75 66  at64 Tcl_StatBuf
26c0: 3b 0a 23 65 6c 69 66 20 64 65 66 69 6e 65 64 28  ;.#elif defined(
26d0: 5f 5f 43 59 47 57 49 4e 5f 5f 29 0a 20 20 20 20  __CYGWIN__).    
26e0: 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20 7b  typedef struct {
26f0: 0a 09 75 6e 73 69 67 6e 65 64 20 73 74 5f 64 65  ..unsigned st_de
2700: 76 3b 0a 09 75 6e 73 69 67 6e 65 64 20 73 68 6f  v;..unsigned sho
2710: 72 74 20 73 74 5f 69 6e 6f 3b 0a 09 75 6e 73 69  rt st_ino;..unsi
2720: 67 6e 65 64 20 73 68 6f 72 74 20 73 74 5f 6d 6f  gned short st_mo
2730: 64 65 3b 0a 09 73 68 6f 72 74 20 73 74 5f 6e 6c  de;..short st_nl
2740: 69 6e 6b 3b 0a 09 73 68 6f 72 74 20 73 74 5f 75  ink;..short st_u
2750: 69 64 3b 0a 09 73 68 6f 72 74 20 73 74 5f 67 69  id;..short st_gi
2760: 64 3b 0a 09 2f 2a 20 48 65 72 65 20 69 73 20 61  d;../* Here is a
2770: 20 32 2d 62 79 74 65 20 67 61 70 20 2a 2f 0a 09   2-byte gap */..
2780: 75 6e 73 69 67 6e 65 64 20 73 74 5f 72 64 65 76  unsigned st_rdev
2790: 3b 0a 09 2f 2a 20 48 65 72 65 20 69 73 20 61 20  ;../* Here is a 
27a0: 34 2d 62 79 74 65 20 67 61 70 20 2a 2f 0a 09 6c  4-byte gap */..l
27b0: 6f 6e 67 20 6c 6f 6e 67 20 73 74 5f 73 69 7a 65  ong long st_size
27c0: 3b 0a 09 73 74 72 75 63 74 20 7b 6c 6f 6e 67 20  ;..struct {long 
27d0: 74 76 5f 73 65 63 3b 7d 20 73 74 5f 61 74 69 6d  tv_sec;} st_atim
27e0: 3b 0a 09 73 74 72 75 63 74 20 7b 6c 6f 6e 67 20  ;..struct {long 
27f0: 74 76 5f 73 65 63 3b 7d 20 73 74 5f 6d 74 69 6d  tv_sec;} st_mtim
2800: 3b 0a 09 73 74 72 75 63 74 20 7b 6c 6f 6e 67 20  ;..struct {long 
2810: 74 76 5f 73 65 63 3b 7d 20 73 74 5f 63 74 69 6d  tv_sec;} st_ctim
2820: 3b 0a 20 20 20 20 7d 20 54 63 6c 5f 53 74 61 74  ;.    } Tcl_Stat
2830: 42 75 66 3b 0a 23 65 6c 73 65 0a 20 20 20 20 74  Buf;.#else.    t
2840: 79 70 65 64 65 66 20 73 74 72 75 63 74 20 73 74  ypedef struct st
2850: 61 74 20 54 63 6c 5f 53 74 61 74 42 75 66 3b 0a  at Tcl_StatBuf;.
2860: 23 65 6e 64 69 66 0a 0c 0a 2f 2a 0a 20 2a 2d 2d  #endif.../*. *--
2870: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2880: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2890: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
28a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
28b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 44 61  ----------. * Da
28c0: 74 61 20 73 74 72 75 63 74 75 72 65 73 20 64 65  ta structures de
28d0: 66 69 6e 65 64 20 6f 70 61 71 75 65 6c 79 20 69  fined opaquely i
28e0: 6e 20 74 68 69 73 20 6d 6f 64 75 6c 65 2e 20 54  n this module. T
28f0: 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 62  he definitions b
2900: 65 6c 6f 77 20 6a 75 73 74 0a 20 2a 20 70 72 6f  elow just. * pro
2910: 76 69 64 65 20 64 75 6d 6d 79 20 74 79 70 65 73  vide dummy types
2920: 2e 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 73  .. */..typedef s
2930: 74 72 75 63 74 20 54 63 6c 5f 41 73 79 6e 63 48  truct Tcl_AsyncH
2940: 61 6e 64 6c 65 72 5f 20 2a 54 63 6c 5f 41 73 79  andler_ *Tcl_Asy
2950: 6e 63 48 61 6e 64 6c 65 72 3b 0a 74 79 70 65 64  ncHandler;.typed
2960: 65 66 20 73 74 72 75 63 74 20 54 63 6c 5f 43 68  ef struct Tcl_Ch
2970: 61 6e 6e 65 6c 5f 20 2a 54 63 6c 5f 43 68 61 6e  annel_ *Tcl_Chan
2980: 6e 65 6c 3b 0a 74 79 70 65 64 65 66 20 73 74 72  nel;.typedef str
2990: 75 63 74 20 54 63 6c 5f 43 68 61 6e 6e 65 6c 54  uct Tcl_ChannelT
29a0: 79 70 65 56 65 72 73 69 6f 6e 5f 20 2a 54 63 6c  ypeVersion_ *Tcl
29b0: 5f 43 68 61 6e 6e 65 6c 54 79 70 65 56 65 72 73  _ChannelTypeVers
29c0: 69 6f 6e 3b 0a 74 79 70 65 64 65 66 20 73 74 72  ion;.typedef str
29d0: 75 63 74 20 54 63 6c 5f 43 6f 6d 6d 61 6e 64 5f  uct Tcl_Command_
29e0: 20 2a 54 63 6c 5f 43 6f 6d 6d 61 6e 64 3b 0a 74   *Tcl_Command;.t
29f0: 79 70 65 64 65 66 20 73 74 72 75 63 74 20 54 63  ypedef struct Tc
2a00: 6c 5f 43 6f 6e 64 69 74 69 6f 6e 5f 20 2a 54 63  l_Condition_ *Tc
2a10: 6c 5f 43 6f 6e 64 69 74 69 6f 6e 3b 0a 74 79 70  l_Condition;.typ
2a20: 65 64 65 66 20 73 74 72 75 63 74 20 54 63 6c 5f  edef struct Tcl_
2a30: 44 69 63 74 5f 20 2a 54 63 6c 5f 44 69 63 74 3b  Dict_ *Tcl_Dict;
2a40: 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20  .typedef struct 
2a50: 54 63 6c 5f 45 6e 63 6f 64 69 6e 67 53 74 61 74  Tcl_EncodingStat
2a60: 65 5f 20 2a 54 63 6c 5f 45 6e 63 6f 64 69 6e 67  e_ *Tcl_Encoding
2a70: 53 74 61 74 65 3b 0a 74 79 70 65 64 65 66 20 73  State;.typedef s
2a80: 74 72 75 63 74 20 54 63 6c 5f 45 6e 63 6f 64 69  truct Tcl_Encodi
2a90: 6e 67 5f 20 2a 54 63 6c 5f 45 6e 63 6f 64 69 6e  ng_ *Tcl_Encodin
2aa0: 67 3b 0a 74 79 70 65 64 65 66 20 73 74 72 75 63  g;.typedef struc
2ab0: 74 20 54 63 6c 5f 45 76 65 6e 74 20 54 63 6c 5f  t Tcl_Event Tcl_
2ac0: 45 76 65 6e 74 3b 0a 74 79 70 65 64 65 66 20 73  Event;.typedef s
2ad0: 74 72 75 63 74 20 54 63 6c 5f 49 6e 74 65 72 70  truct Tcl_Interp
2ae0: 20 54 63 6c 5f 49 6e 74 65 72 70 3b 0a 74 79 70   Tcl_Interp;.typ
2af0: 65 64 65 66 20 73 74 72 75 63 74 20 54 63 6c 5f  edef struct Tcl_
2b00: 49 6e 74 65 72 70 53 74 61 74 65 5f 20 2a 54 63  InterpState_ *Tc
2b10: 6c 5f 49 6e 74 65 72 70 53 74 61 74 65 3b 0a 74  l_InterpState;.t
2b20: 79 70 65 64 65 66 20 73 74 72 75 63 74 20 54 63  ypedef struct Tc
2b30: 6c 5f 4c 6f 61 64 48 61 6e 64 6c 65 5f 20 2a 54  l_LoadHandle_ *T
2b40: 63 6c 5f 4c 6f 61 64 48 61 6e 64 6c 65 3b 0a 74  cl_LoadHandle;.t
2b50: 79 70 65 64 65 66 20 73 74 72 75 63 74 20 54 63  ypedef struct Tc
2b60: 6c 5f 4d 75 74 65 78 5f 20 2a 54 63 6c 5f 4d 75  l_Mutex_ *Tcl_Mu
2b70: 74 65 78 3b 0a 74 79 70 65 64 65 66 20 73 74 72  tex;.typedef str
2b80: 75 63 74 20 54 63 6c 5f 50 69 64 5f 20 2a 54 63  uct Tcl_Pid_ *Tc
2b90: 6c 5f 50 69 64 3b 0a 74 79 70 65 64 65 66 20 73  l_Pid;.typedef s
2ba0: 74 72 75 63 74 20 54 63 6c 5f 52 65 67 45 78 70  truct Tcl_RegExp
2bb0: 5f 20 2a 54 63 6c 5f 52 65 67 45 78 70 3b 0a 74  _ *Tcl_RegExp;.t
2bc0: 79 70 65 64 65 66 20 73 74 72 75 63 74 20 54 63  ypedef struct Tc
2bd0: 6c 5f 54 68 72 65 61 64 44 61 74 61 4b 65 79 5f  l_ThreadDataKey_
2be0: 20 2a 54 63 6c 5f 54 68 72 65 61 64 44 61 74 61   *Tcl_ThreadData
2bf0: 4b 65 79 3b 0a 74 79 70 65 64 65 66 20 73 74 72  Key;.typedef str
2c00: 75 63 74 20 54 63 6c 5f 54 68 72 65 61 64 49 64  uct Tcl_ThreadId
2c10: 5f 20 2a 54 63 6c 5f 54 68 72 65 61 64 49 64 3b  _ *Tcl_ThreadId;
2c20: 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20  .typedef struct 
2c30: 54 63 6c 5f 54 69 6d 65 72 54 6f 6b 65 6e 5f 20  Tcl_TimerToken_ 
2c40: 2a 54 63 6c 5f 54 69 6d 65 72 54 6f 6b 65 6e 3b  *Tcl_TimerToken;
2c50: 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20  .typedef struct 
2c60: 54 63 6c 5f 54 72 61 63 65 5f 20 2a 54 63 6c 5f  Tcl_Trace_ *Tcl_
2c70: 54 72 61 63 65 3b 0a 74 79 70 65 64 65 66 20 73  Trace;.typedef s
2c80: 74 72 75 63 74 20 54 63 6c 5f 56 61 72 5f 20 2a  truct Tcl_Var_ *
2c90: 54 63 6c 5f 56 61 72 3b 0a 74 79 70 65 64 65 66  Tcl_Var;.typedef
2ca0: 20 73 74 72 75 63 74 20 54 63 6c 5f 5a 4c 69 62   struct Tcl_ZLib
2cb0: 53 74 72 65 61 6d 5f 20 2a 54 63 6c 5f 5a 6c 69  Stream_ *Tcl_Zli
2cc0: 62 53 74 72 65 61 6d 3b 0a 0a 2f 2a 0a 20 2a 2d  bStream;../*. *-
2cd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2ce0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2cf0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2d00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
2d10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 44  -----------. * D
2d20: 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 74 68 65  efinition of the
2d30: 20 69 6e 74 65 72 66 61 63 65 20 74 6f 20 66 75   interface to fu
2d40: 6e 63 74 69 6f 6e 73 20 69 6d 70 6c 65 6d 65 6e  nctions implemen
2d50: 74 69 6e 67 20 74 68 72 65 61 64 73 2e 20 41 20  ting threads. A 
2d60: 66 75 6e 63 74 69 6f 6e 0a 20 2a 20 66 6f 6c 6c  function. * foll
2d70: 6f 77 69 6e 67 20 74 68 69 73 20 64 65 66 69 6e  owing this defin
2d80: 69 74 69 6f 6e 20 69 73 20 67 69 76 65 6e 20 74  ition is given t
2d90: 6f 20 65 61 63 68 20 63 61 6c 6c 20 6f 66 20 27  o each call of '
2da0: 54 63 6c 5f 43 72 65 61 74 65 54 68 72 65 61 64  Tcl_CreateThread
2db0: 27 20 61 6e 64 0a 20 2a 20 77 69 6c 6c 20 62 65  ' and. * will be
2dc0: 20 63 61 6c 6c 65 64 20 61 73 20 74 68 65 20 6d   called as the m
2dd0: 61 69 6e 20 66 75 63 74 69 6f 6e 20 6f 66 20 74  ain fuction of t
2de0: 68 65 20 6e 65 77 20 74 68 72 65 61 64 20 63 72  he new thread cr
2df0: 65 61 74 65 64 20 62 79 20 74 68 61 74 20 63 61  eated by that ca
2e00: 6c 6c 2e 0a 20 2a 2f 0a 0a 23 69 66 20 64 65 66  ll.. */..#if def
2e10: 69 6e 65 64 20 5f 57 49 4e 33 32 0a 74 79 70 65  ined _WIN32.type
2e20: 64 65 66 20 75 6e 73 69 67 6e 65 64 20 28 5f 5f  def unsigned (__
2e30: 73 74 64 63 61 6c 6c 20 54 63 6c 5f 54 68 72 65  stdcall Tcl_Thre
2e40: 61 64 43 72 65 61 74 65 50 72 6f 63 29 20 28 76  adCreateProc) (v
2e50: 6f 69 64 20 2a 63 6c 69 65 6e 74 44 61 74 61 29  oid *clientData)
2e60: 3b 0a 23 65 6c 73 65 0a 74 79 70 65 64 65 66 20  ;.#else.typedef 
2e70: 76 6f 69 64 20 28 54 63 6c 5f 54 68 72 65 61 64  void (Tcl_Thread
2e80: 43 72 65 61 74 65 50 72 6f 63 29 20 28 76 6f 69  CreateProc) (voi
2e90: 64 20 2a 63 6c 69 65 6e 74 44 61 74 61 29 3b 0a  d *clientData);.
2ea0: 23 65 6e 64 69 66 0a 0a 2f 2a 0a 20 2a 20 54 68  #endif../*. * Th
2eb0: 72 65 61 64 69 6e 67 20 66 75 6e 63 74 69 6f 6e  reading function
2ec0: 20 72 65 74 75 72 6e 20 74 79 70 65 73 20 75 73   return types us
2ed0: 65 64 20 66 6f 72 20 61 62 73 74 72 61 63 74 69  ed for abstracti
2ee0: 6e 67 20 61 77 61 79 20 70 6c 61 74 66 6f 72 6d  ng away platform
2ef0: 0a 20 2a 20 64 69 66 66 65 72 65 6e 63 65 73 20  . * differences 
2f00: 77 68 65 6e 20 77 72 69 74 69 6e 67 20 61 20 54  when writing a T
2f10: 63 6c 5f 54 68 72 65 61 64 43 72 65 61 74 65 50  cl_ThreadCreateP
2f20: 72 6f 63 2e 20 53 65 65 20 74 68 65 20 4e 65 77  roc. See the New
2f30: 54 68 72 65 61 64 20 66 75 6e 63 74 69 6f 6e 0a  Thread function.
2f40: 20 2a 20 69 6e 20 67 65 6e 65 72 69 63 2f 74 63   * in generic/tc
2f50: 6c 54 68 72 65 61 64 54 65 73 74 2e 63 20 66 6f  lThreadTest.c fo
2f60: 72 20 69 74 27 73 20 75 73 61 67 65 2e 0a 20 2a  r it's usage.. *
2f70: 2f 0a 0a 23 69 66 20 64 65 66 69 6e 65 64 20 5f  /..#if defined _
2f80: 57 49 4e 33 32 0a 23 20 20 20 64 65 66 69 6e 65  WIN32.#   define
2f90: 20 54 63 6c 5f 54 68 72 65 61 64 43 72 65 61 74   Tcl_ThreadCreat
2fa0: 65 54 79 70 65 09 09 75 6e 73 69 67 6e 65 64 20  eType..unsigned 
2fb0: 5f 5f 73 74 64 63 61 6c 6c 0a 23 20 20 20 64 65  __stdcall.#   de
2fc0: 66 69 6e 65 20 54 43 4c 5f 54 48 52 45 41 44 5f  fine TCL_THREAD_
2fd0: 43 52 45 41 54 45 5f 52 45 54 55 52 4e 09 72 65  CREATE_RETURN.re
2fe0: 74 75 72 6e 20 30 0a 23 65 6c 73 65 0a 23 20 20  turn 0.#else.#  
2ff0: 20 64 65 66 69 6e 65 20 54 63 6c 5f 54 68 72 65   define Tcl_Thre
3000: 61 64 43 72 65 61 74 65 54 79 70 65 09 09 76 6f  adCreateType..vo
3010: 69 64 0a 23 20 20 20 64 65 66 69 6e 65 20 54 43  id.#   define TC
3020: 4c 5f 54 48 52 45 41 44 5f 43 52 45 41 54 45 5f  L_THREAD_CREATE_
3030: 52 45 54 55 52 4e 0a 23 65 6e 64 69 66 0a 0a 2f  RETURN.#endif../
3040: 2a 0a 20 2a 20 44 65 66 69 6e 69 74 69 6f 6e 20  *. * Definition 
3050: 6f 66 20 76 61 6c 75 65 73 20 66 6f 72 20 64 65  of values for de
3060: 66 61 75 6c 74 20 73 74 61 63 6b 73 69 7a 65 20  fault stacksize 
3070: 61 6e 64 20 74 68 65 20 70 6f 73 73 69 62 6c 65  and the possible
3080: 20 66 6c 61 67 73 20 74 6f 20 62 65 0a 20 2a 20   flags to be. * 
3090: 67 69 76 65 6e 20 74 6f 20 54 63 6c 5f 43 72 65  given to Tcl_Cre
30a0: 61 74 65 54 68 72 65 61 64 2e 0a 20 2a 2f 0a 0a  ateThread.. */..
30b0: 23 64 65 66 69 6e 65 20 54 43 4c 5f 54 48 52 45  #define TCL_THRE
30c0: 41 44 5f 53 54 41 43 4b 5f 44 45 46 41 55 4c 54  AD_STACK_DEFAULT
30d0: 20 28 30 29 09 2f 2a 20 55 73 65 20 64 65 66 61   (0)./* Use defa
30e0: 75 6c 74 20 73 69 7a 65 20 66 6f 72 20 73 74 61  ult size for sta
30f0: 63 6b 2e 20 2a 2f 0a 23 64 65 66 69 6e 65 20 54  ck. */.#define T
3100: 43 4c 5f 54 48 52 45 41 44 5f 4e 4f 46 4c 41 47  CL_THREAD_NOFLAG
3110: 53 09 20 28 30 30 30 30 29 20 2f 2a 20 53 74 61  S. (0000) /* Sta
3120: 6e 64 61 72 64 20 66 6c 61 67 73 2c 20 64 65 66  ndard flags, def
3130: 61 75 6c 74 0a 09 09 09 09 09 20 2a 20 62 65 68  ault...... * beh
3140: 61 76 69 6f 75 72 2e 20 2a 2f 0a 23 64 65 66 69  aviour. */.#defi
3150: 6e 65 20 54 43 4c 5f 54 48 52 45 41 44 5f 4a 4f  ne TCL_THREAD_JO
3160: 49 4e 41 42 4c 45 09 20 28 30 30 30 31 29 20 2f  INABLE. (0001) /
3170: 2a 20 4d 61 72 6b 20 74 68 65 20 74 68 72 65 61  * Mark the threa
3180: 64 20 61 73 20 6a 6f 69 6e 61 62 6c 65 2e 20 2a  d as joinable. *
3190: 2f 0a 0a 2f 2a 0a 20 2a 20 46 6c 61 67 20 76 61  /../*. * Flag va
31a0: 6c 75 65 73 20 70 61 73 73 65 64 20 74 6f 20 54  lues passed to T
31b0: 63 6c 5f 53 74 72 69 6e 67 43 61 73 65 4d 61 74  cl_StringCaseMat
31c0: 63 68 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65  ch.. */..#define
31d0: 20 54 43 4c 5f 4d 41 54 43 48 5f 4e 4f 43 41 53   TCL_MATCH_NOCAS
31e0: 45 09 28 31 3c 3c 30 29 0a 0a 2f 2a 0a 20 2a 20  E.(1<<0)../*. * 
31f0: 46 6c 61 67 20 76 61 6c 75 65 73 20 70 61 73 73  Flag values pass
3200: 65 64 20 74 6f 20 54 63 6c 5f 47 65 74 52 65 67  ed to Tcl_GetReg
3210: 45 78 70 46 72 6f 6d 4f 62 6a 2e 0a 20 2a 2f 0a  ExpFromObj.. */.
3220: 0a 23 64 65 66 69 6e 65 09 54 43 4c 5f 52 45 47  .#define.TCL_REG
3230: 5f 42 41 53 49 43 09 09 30 30 30 30 30 30 09 2f  _BASIC..000000./
3240: 2a 20 42 52 45 73 20 28 63 6f 6e 76 65 6e 69 65  * BREs (convenie
3250: 6e 63 65 29 2e 20 2a 2f 0a 23 64 65 66 69 6e 65  nce). */.#define
3260: 09 54 43 4c 5f 52 45 47 5f 45 58 54 45 4e 44 45  .TCL_REG_EXTENDE
3270: 44 09 30 30 30 30 30 31 09 2f 2a 20 45 52 45 73  D.000001./* EREs
3280: 2e 20 2a 2f 0a 23 64 65 66 69 6e 65 09 54 43 4c  . */.#define.TCL
3290: 5f 52 45 47 5f 41 44 56 46 09 09 30 30 30 30 30  _REG_ADVF..00000
32a0: 32 09 2f 2a 20 41 64 76 61 6e 63 65 64 20 66 65  2./* Advanced fe
32b0: 61 74 75 72 65 73 20 69 6e 20 45 52 45 73 2e 20  atures in EREs. 
32c0: 2a 2f 0a 23 64 65 66 69 6e 65 09 54 43 4c 5f 52  */.#define.TCL_R
32d0: 45 47 5f 41 44 56 41 4e 43 45 44 09 30 30 30 30  EG_ADVANCED.0000
32e0: 30 33 09 2f 2a 20 41 52 45 73 20 28 77 68 69 63  03./* AREs (whic
32f0: 68 20 61 72 65 20 61 6c 73 6f 20 45 52 45 73 29  h are also EREs)
3300: 2e 20 2a 2f 0a 23 64 65 66 69 6e 65 09 54 43 4c  . */.#define.TCL
3310: 5f 52 45 47 5f 51 55 4f 54 45 09 09 30 30 30 30  _REG_QUOTE..0000
3320: 30 34 09 2f 2a 20 4e 6f 20 73 70 65 63 69 61 6c  04./* No special
3330: 20 63 68 61 72 61 63 74 65 72 73 2c 20 6e 6f 6e   characters, non
3340: 65 2e 20 2a 2f 0a 23 64 65 66 69 6e 65 09 54 43  e. */.#define.TC
3350: 4c 5f 52 45 47 5f 4e 4f 43 41 53 45 09 09 30 30  L_REG_NOCASE..00
3360: 30 30 31 30 09 2f 2a 20 49 67 6e 6f 72 65 20 63  0010./* Ignore c
3370: 61 73 65 2e 20 2a 2f 0a 23 64 65 66 69 6e 65 09  ase. */.#define.
3380: 54 43 4c 5f 52 45 47 5f 4e 4f 53 55 42 09 09 30  TCL_REG_NOSUB..0
3390: 30 30 30 32 30 09 2f 2a 20 44 6f 6e 27 74 20 63  00020./* Don't c
33a0: 61 72 65 20 61 62 6f 75 74 20 73 75 62 65 78 70  are about subexp
33b0: 72 65 73 73 69 6f 6e 73 2e 20 2a 2f 0a 23 64 65  ressions. */.#de
33c0: 66 69 6e 65 09 54 43 4c 5f 52 45 47 5f 45 58 50  fine.TCL_REG_EXP
33d0: 41 4e 44 45 44 09 30 30 30 30 34 30 09 2f 2a 20  ANDED.000040./* 
33e0: 45 78 70 61 6e 64 65 64 20 66 6f 72 6d 61 74 2c  Expanded format,
33f0: 20 77 68 69 74 65 20 73 70 61 63 65 20 26 0a 09   white space &..
3400: 09 09 09 09 20 2a 20 63 6f 6d 6d 65 6e 74 73 2e  .... * comments.
3410: 20 2a 2f 0a 23 64 65 66 69 6e 65 09 54 43 4c 5f   */.#define.TCL_
3420: 52 45 47 5f 4e 4c 53 54 4f 50 09 09 30 30 30 31  REG_NLSTOP..0001
3430: 30 30 20 20 2f 2a 20 5c 6e 20 64 6f 65 73 6e 27  00  /* \n doesn'
3440: 74 20 6d 61 74 63 68 20 2e 20 6f 72 20 5b 5e 20  t match . or [^ 
3450: 5d 20 2a 2f 0a 23 64 65 66 69 6e 65 09 54 43 4c  ] */.#define.TCL
3460: 5f 52 45 47 5f 4e 4c 41 4e 43 48 09 09 30 30 30  _REG_NLANCH..000
3470: 32 30 30 20 20 2f 2a 20 5e 20 6d 61 74 63 68 65  200  /* ^ matche
3480: 73 20 61 66 74 65 72 20 5c 6e 2c 20 24 20 62 65  s after \n, $ be
3490: 66 6f 72 65 2e 20 2a 2f 0a 23 64 65 66 69 6e 65  fore. */.#define
34a0: 09 54 43 4c 5f 52 45 47 5f 4e 45 57 4c 49 4e 45  .TCL_REG_NEWLINE
34b0: 09 09 30 30 30 33 30 30 20 20 2f 2a 20 4e 65 77  ..000300  /* New
34c0: 6c 69 6e 65 73 20 61 72 65 20 6c 69 6e 65 20 74  lines are line t
34d0: 65 72 6d 69 6e 61 74 6f 72 73 2e 20 2a 2f 0a 23  erminators. */.#
34e0: 64 65 66 69 6e 65 09 54 43 4c 5f 52 45 47 5f 43  define.TCL_REG_C
34f0: 41 4e 4d 41 54 43 48 09 30 30 31 30 30 30 20 20  ANMATCH.001000  
3500: 2f 2a 20 52 65 70 6f 72 74 20 64 65 74 61 69 6c  /* Report detail
3510: 73 20 6f 6e 20 70 61 72 74 69 61 6c 2f 6c 69 6d  s on partial/lim
3520: 69 74 65 64 0a 09 09 09 09 09 20 2a 20 6d 61 74  ited...... * mat
3530: 63 68 65 73 2e 20 2a 2f 0a 0a 2f 2a 0a 20 2a 20  ches. */../*. * 
3540: 46 6c 61 67 73 20 76 61 6c 75 65 73 20 70 61 73  Flags values pas
3550: 73 65 64 20 74 6f 20 54 63 6c 5f 52 65 67 45 78  sed to Tcl_RegEx
3560: 70 45 78 65 63 4f 62 6a 2e 0a 20 2a 2f 0a 0a 23  pExecObj.. */..#
3570: 64 65 66 69 6e 65 09 54 43 4c 5f 52 45 47 5f 4e  define.TCL_REG_N
3580: 4f 54 42 4f 4c 09 30 30 30 31 09 2f 2a 20 42 65  OTBOL.0001./* Be
3590: 67 69 6e 6e 69 6e 67 20 6f 66 20 73 74 72 69 6e  ginning of strin
35a0: 67 20 64 6f 65 73 20 6e 6f 74 20 6d 61 74 63 68  g does not match
35b0: 20 5e 2e 20 2a 2f 0a 23 64 65 66 69 6e 65 09 54   ^. */.#define.T
35c0: 43 4c 5f 52 45 47 5f 4e 4f 54 45 4f 4c 09 30 30  CL_REG_NOTEOL.00
35d0: 30 32 09 2f 2a 20 45 6e 64 20 6f 66 20 73 74 72  02./* End of str
35e0: 69 6e 67 20 64 6f 65 73 20 6e 6f 74 20 6d 61 74  ing does not mat
35f0: 63 68 20 24 2e 20 2a 2f 0a 0a 2f 2a 0a 20 2a 20  ch $. */../*. * 
3600: 53 74 72 75 63 74 75 72 65 73 20 66 69 6c 6c 65  Structures fille
3610: 64 20 69 6e 20 62 79 20 54 63 6c 5f 52 65 67 45  d in by Tcl_RegE
3620: 78 70 49 6e 66 6f 2e 20 4e 6f 74 65 20 74 68 61  xpInfo. Note tha
3630: 74 20 61 6c 6c 20 6f 66 66 73 65 74 20 76 61 6c  t all offset val
3640: 75 65 73 20 61 72 65 0a 20 2a 20 72 65 6c 61 74  ues are. * relat
3650: 69 76 65 20 74 6f 20 74 68 65 20 73 74 61 72 74  ive to the start
3660: 20 6f 66 20 74 68 65 20 6d 61 74 63 68 20 73 74   of the match st
3670: 72 69 6e 67 2c 20 6e 6f 74 20 74 68 65 20 62 65  ring, not the be
3680: 67 69 6e 6e 69 6e 67 20 6f 66 20 74 68 65 20 65  ginning of the e
3690: 6e 74 69 72 65 0a 20 2a 20 73 74 72 69 6e 67 2e  ntire. * string.
36a0: 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 73 74  . */..typedef st
36b0: 72 75 63 74 20 54 63 6c 5f 52 65 67 45 78 70 49  ruct Tcl_RegExpI
36c0: 6e 64 69 63 65 73 20 7b 0a 20 20 20 20 54 63 6c  ndices {.    Tcl
36d0: 5f 53 69 7a 65 20 73 74 61 72 74 3b 09 09 2f 2a  _Size start;../*
36e0: 20 43 68 61 72 61 63 74 65 72 20 6f 66 66 73 65   Character offse
36f0: 74 20 6f 66 20 66 69 72 73 74 20 63 68 61 72 61  t of first chara
3700: 63 74 65 72 20 69 6e 0a 09 09 09 09 20 2a 20 6d  cter in..... * m
3710: 61 74 63 68 2e 20 2a 2f 0a 20 20 20 20 54 63 6c  atch. */.    Tcl
3720: 5f 53 69 7a 65 20 65 6e 64 3b 09 09 2f 2a 20 43  _Size end;../* C
3730: 68 61 72 61 63 74 65 72 20 6f 66 66 73 65 74 20  haracter offset 
3740: 6f 66 20 66 69 72 73 74 20 63 68 61 72 61 63 74  of first charact
3750: 65 72 20 61 66 74 65 72 0a 09 09 09 09 20 2a 20  er after..... * 
3760: 74 68 65 20 6d 61 74 63 68 2e 20 2a 2f 0a 7d 20  the match. */.} 
3770: 54 63 6c 5f 52 65 67 45 78 70 49 6e 64 69 63 65  Tcl_RegExpIndice
3780: 73 3b 0a 0a 74 79 70 65 64 65 66 20 73 74 72 75  s;..typedef stru
3790: 63 74 20 54 63 6c 5f 52 65 67 45 78 70 49 6e 66  ct Tcl_RegExpInf
37a0: 6f 20 7b 0a 20 20 20 20 54 63 6c 5f 53 69 7a 65  o {.    Tcl_Size
37b0: 20 6e 73 75 62 73 3b 09 09 2f 2a 20 4e 75 6d 62   nsubs;../* Numb
37c0: 65 72 20 6f 66 20 73 75 62 65 78 70 72 65 73 73  er of subexpress
37d0: 69 6f 6e 73 20 69 6e 20 74 68 65 20 63 6f 6d 70  ions in the comp
37e0: 69 6c 65 64 0a 09 09 09 09 20 2a 20 65 78 70 72  iled..... * expr
37f0: 65 73 73 69 6f 6e 2e 20 2a 2f 0a 20 20 20 20 54  ession. */.    T
3800: 63 6c 5f 52 65 67 45 78 70 49 6e 64 69 63 65 73  cl_RegExpIndices
3810: 20 2a 6d 61 74 63 68 65 73 3b 09 2f 2a 20 41 72   *matches;./* Ar
3820: 72 61 79 20 6f 66 20 6e 73 75 62 73 20 6d 61 74  ray of nsubs mat
3830: 63 68 20 6f 66 66 73 65 74 20 70 61 69 72 73 2e  ch offset pairs.
3840: 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 53 69 7a 65   */.    Tcl_Size
3850: 20 65 78 74 65 6e 64 53 74 61 72 74 3b 09 2f 2a   extendStart;./*
3860: 20 54 68 65 20 6f 66 66 73 65 74 20 61 74 20 77   The offset at w
3870: 68 69 63 68 20 61 20 73 75 62 73 65 71 75 65 6e  hich a subsequen
3880: 74 20 6d 61 74 63 68 0a 09 09 09 09 20 2a 20 6d  t match..... * m
3890: 69 67 68 74 20 62 65 67 69 6e 2e 20 2a 2f 0a 7d  ight begin. */.}
38a0: 20 54 63 6c 5f 52 65 67 45 78 70 49 6e 66 6f 3b   Tcl_RegExpInfo;
38b0: 0a 0a 2f 2a 0a 20 2a 20 50 69 63 6b 79 20 63 6f  ../*. * Picky co
38c0: 6d 70 69 6c 65 72 73 20 63 6f 6d 70 6c 61 69 6e  mpilers complain
38d0: 20 69 66 20 74 68 69 73 20 74 79 70 64 65 66 20   if this typdef 
38e0: 64 6f 65 73 6e 27 74 20 61 70 70 65 61 72 20 62  doesn't appear b
38f0: 65 66 6f 72 65 20 74 68 65 20 73 74 72 75 63 74  efore the struct
3900: 27 73 0a 20 2a 20 72 65 66 65 72 65 6e 63 65 20  's. * reference 
3910: 69 6e 20 74 63 6c 44 65 63 6c 73 2e 68 2e 0a 20  in tclDecls.h.. 
3920: 2a 2f 0a 0a 74 79 70 65 64 65 66 20 54 63 6c 5f  */..typedef Tcl_
3930: 53 74 61 74 42 75 66 20 2a 54 63 6c 5f 53 74 61  StatBuf *Tcl_Sta
3940: 74 5f 3b 0a 74 79 70 65 64 65 66 20 73 74 72 75  t_;.typedef stru
3950: 63 74 20 73 74 61 74 20 2a 54 63 6c 5f 4f 6c 64  ct stat *Tcl_Old
3960: 53 74 61 74 5f 3b 0a 0a 2f 2a 0a 20 2a 2d 2d 2d  Stat_;../*. *---
3970: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3980: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3990: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
39a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
39b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 57 68 65  ---------. * Whe
39c0: 6e 20 61 20 54 43 4c 20 63 6f 6d 6d 61 6e 64 20  n a TCL command 
39d0: 72 65 74 75 72 6e 73 2c 20 74 68 65 20 69 6e 74  returns, the int
39e0: 65 72 70 72 65 74 65 72 20 63 6f 6e 74 61 69 6e  erpreter contain
39f0: 73 20 61 20 72 65 73 75 6c 74 20 66 72 6f 6d 20  s a result from 
3a00: 74 68 65 0a 20 2a 20 63 6f 6d 6d 61 6e 64 2e 20  the. * command. 
3a10: 50 72 6f 67 72 61 6d 6d 65 72 73 20 61 72 65 20  Programmers are 
3a20: 73 74 72 6f 6e 67 6c 79 20 65 6e 63 6f 75 72 61  strongly encoura
3a30: 67 65 64 20 74 6f 20 75 73 65 20 6f 6e 65 20 6f  ged to use one o
3a40: 66 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 73 0a  f the functions.
3a50: 20 2a 20 54 63 6c 5f 47 65 74 4f 62 6a 52 65 73   * Tcl_GetObjRes
3a60: 75 6c 74 28 29 20 6f 72 20 54 63 6c 5f 47 65 74  ult() or Tcl_Get
3a70: 53 74 72 69 6e 67 52 65 73 75 6c 74 28 29 20 74  StringResult() t
3a80: 6f 20 72 65 61 64 20 74 68 65 20 69 6e 74 65 72  o read the inter
3a90: 70 72 65 74 65 72 27 73 0a 20 2a 20 72 65 73 75  preter's. * resu
3aa0: 6c 74 2e 20 53 65 65 20 74 68 65 20 53 65 74 52  lt. See the SetR
3ab0: 65 73 75 6c 74 20 6d 61 6e 20 70 61 67 65 20 66  esult man page f
3ac0: 6f 72 20 64 65 74 61 69 6c 73 2e 20 42 65 73 69  or details. Besi
3ad0: 64 65 73 20 74 68 69 73 20 72 65 73 75 6c 74 2c  des this result,
3ae0: 20 74 68 65 0a 20 2a 20 63 6f 6d 6d 61 6e 64 20   the. * command 
3af0: 66 75 6e 63 74 69 6f 6e 20 72 65 74 75 72 6e 73  function returns
3b00: 20 61 6e 20 69 6e 74 65 67 65 72 20 63 6f 64 65   an integer code
3b10: 2c 20 77 68 69 63 68 20 69 73 20 6f 6e 65 20 6f  , which is one o
3b20: 66 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 3a  f the following:
3b30: 0a 20 2a 0a 20 2a 20 54 43 4c 5f 4f 4b 09 09 43  . *. * TCL_OK..C
3b40: 6f 6d 6d 61 6e 64 20 63 6f 6d 70 6c 65 74 65 64  ommand completed
3b50: 20 6e 6f 72 6d 61 6c 6c 79 3b 20 74 68 65 20 69   normally; the i
3b60: 6e 74 65 72 70 72 65 74 65 72 27 73 20 72 65 73  nterpreter's res
3b70: 75 6c 74 0a 20 2a 09 09 09 63 6f 6e 74 61 69 6e  ult. *...contain
3b80: 73 20 74 68 65 20 63 6f 6d 6d 61 6e 64 27 73 20  s the command's 
3b90: 72 65 73 75 6c 74 2e 0a 20 2a 20 54 43 4c 5f 45  result.. * TCL_E
3ba0: 52 52 4f 52 09 09 54 68 65 20 63 6f 6d 6d 61 6e  RROR..The comman
3bb0: 64 20 63 6f 75 6c 64 6e 27 74 20 62 65 20 63 6f  d couldn't be co
3bc0: 6d 70 6c 65 74 65 64 20 73 75 63 63 65 73 73 66  mpleted successf
3bd0: 75 6c 6c 79 3b 20 74 68 65 0a 20 2a 09 09 09 69  ully; the. *...i
3be0: 6e 74 65 72 70 72 65 74 65 72 27 73 20 72 65 73  nterpreter's res
3bf0: 75 6c 74 20 64 65 73 63 72 69 62 65 73 20 77 68  ult describes wh
3c00: 61 74 20 77 65 6e 74 20 77 72 6f 6e 67 2e 0a 20  at went wrong.. 
3c10: 2a 20 54 43 4c 5f 52 45 54 55 52 4e 09 09 54 68  * TCL_RETURN..Th
3c20: 65 20 63 6f 6d 6d 61 6e 64 20 72 65 71 75 65 73  e command reques
3c30: 74 73 20 74 68 61 74 20 74 68 65 20 63 75 72 72  ts that the curr
3c40: 65 6e 74 20 66 75 6e 63 74 69 6f 6e 20 72 65 74  ent function ret
3c50: 75 72 6e 3b 0a 20 2a 09 09 09 74 68 65 20 69 6e  urn;. *...the in
3c60: 74 65 72 70 72 65 74 65 72 27 73 20 72 65 73 75  terpreter's resu
3c70: 6c 74 20 63 6f 6e 74 61 69 6e 73 20 74 68 65 20  lt contains the 
3c80: 66 75 6e 63 74 69 6f 6e 27 73 0a 20 2a 09 09 09  function's. *...
3c90: 72 65 74 75 72 6e 20 76 61 6c 75 65 2e 0a 20 2a  return value.. *
3ca0: 20 54 43 4c 5f 42 52 45 41 4b 09 09 54 68 65 20   TCL_BREAK..The 
3cb0: 63 6f 6d 6d 61 6e 64 20 72 65 71 75 65 73 74 73  command requests
3cc0: 20 74 68 61 74 20 74 68 65 20 69 6e 6e 65 72 6d   that the innerm
3cd0: 6f 73 74 20 6c 6f 6f 70 20 62 65 0a 20 2a 09 09  ost loop be. *..
3ce0: 09 65 78 69 74 65 64 3b 20 74 68 65 20 69 6e 74  .exited; the int
3cf0: 65 72 70 72 65 74 65 72 27 73 20 72 65 73 75 6c  erpreter's resul
3d00: 74 20 69 73 20 6d 65 61 6e 69 6e 67 6c 65 73 73  t is meaningless
3d10: 2e 0a 20 2a 20 54 43 4c 5f 43 4f 4e 54 49 4e 55  .. * TCL_CONTINU
3d20: 45 09 09 47 6f 20 6f 6e 20 74 6f 20 74 68 65 20  E..Go on to the 
3d30: 6e 65 78 74 20 69 74 65 72 61 74 69 6f 6e 20 6f  next iteration o
3d40: 66 20 74 68 65 20 63 75 72 72 65 6e 74 20 6c 6f  f the current lo
3d50: 6f 70 3b 20 74 68 65 0a 20 2a 09 09 09 69 6e 74  op; the. *...int
3d60: 65 72 70 72 65 74 65 72 27 73 20 72 65 73 75 6c  erpreter's resul
3d70: 74 20 69 73 20 6d 65 61 6e 69 6e 67 6c 65 73 73  t is meaningless
3d80: 2e 0a 20 2a 20 49 6e 74 65 67 65 72 20 72 65 74  .. * Integer ret
3d90: 75 72 6e 20 63 6f 64 65 73 20 69 6e 20 74 68 65  urn codes in the
3da0: 20 72 61 6e 67 65 20 54 43 4c 5f 43 4f 44 45 5f   range TCL_CODE_
3db0: 55 53 45 52 5f 4d 49 4e 20 74 6f 20 54 43 4c 5f  USER_MIN to TCL_
3dc0: 43 4f 44 45 5f 55 53 45 52 5f 4d 41 58 20 61 72  CODE_USER_MAX ar
3dd0: 65 0a 20 2a 20 72 65 73 65 72 76 65 64 20 66 6f  e. * reserved fo
3de0: 72 20 74 68 65 20 75 73 65 20 6f 66 20 70 61 63  r the use of pac
3df0: 6b 61 67 65 73 2e 0a 20 2a 2f 0a 0a 23 64 65 66  kages.. */..#def
3e00: 69 6e 65 20 54 43 4c 5f 4f 4b 09 09 09 30 0a 23  ine TCL_OK...0.#
3e10: 64 65 66 69 6e 65 20 54 43 4c 5f 45 52 52 4f 52  define TCL_ERROR
3e20: 09 09 31 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f  ..1.#define TCL_
3e30: 52 45 54 55 52 4e 09 09 32 0a 23 64 65 66 69 6e  RETURN..2.#defin
3e40: 65 20 54 43 4c 5f 42 52 45 41 4b 09 09 33 0a 23  e TCL_BREAK..3.#
3e50: 64 65 66 69 6e 65 20 54 43 4c 5f 43 4f 4e 54 49  define TCL_CONTI
3e60: 4e 55 45 09 09 34 0a 23 64 65 66 69 6e 65 20 54  NUE..4.#define T
3e70: 43 4c 5f 43 4f 44 45 5f 55 53 45 52 5f 4d 49 4e  CL_CODE_USER_MIN
3e80: 09 35 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 43  .5.#define TCL_C
3e90: 4f 44 45 5f 55 53 45 52 5f 4d 41 58 09 30 78 33  ODE_USER_MAX.0x3
3ea0: 66 66 66 66 66 66 66 20 2f 2a 20 31 30 37 33 37  fffffff /* 10737
3eb0: 34 31 38 32 33 20 2a 2f 0a 0a 2f 2a 0a 20 2a 2d  41823 */../*. *-
3ec0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3ed0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3ee0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3ef0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
3f00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 46  -----------. * F
3f10: 6c 61 67 73 20 74 6f 20 63 6f 6e 74 72 6f 6c 20  lags to control 
3f20: 77 68 61 74 20 73 75 62 73 74 69 74 75 74 69 6f  what substitutio
3f30: 6e 73 20 61 72 65 20 70 65 72 66 6f 72 6d 65 64  ns are performed
3f40: 20 62 79 20 54 63 6c 5f 53 75 62 73 74 4f 62 6a   by Tcl_SubstObj
3f50: 28 29 3a 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65  ():. */..#define
3f60: 20 54 43 4c 5f 53 55 42 53 54 5f 43 4f 4d 4d 41   TCL_SUBST_COMMA
3f70: 4e 44 53 09 30 30 31 0a 23 64 65 66 69 6e 65 20  NDS.001.#define 
3f80: 54 43 4c 5f 53 55 42 53 54 5f 56 41 52 49 41 42  TCL_SUBST_VARIAB
3f90: 4c 45 53 09 30 30 32 0a 23 64 65 66 69 6e 65 20  LES.002.#define 
3fa0: 54 43 4c 5f 53 55 42 53 54 5f 42 41 43 4b 53 4c  TCL_SUBST_BACKSL
3fb0: 41 53 48 45 53 09 30 30 34 0a 23 64 65 66 69 6e  ASHES.004.#defin
3fc0: 65 20 54 43 4c 5f 53 55 42 53 54 5f 41 4c 4c 09  e TCL_SUBST_ALL.
3fd0: 09 30 30 37 0a 0a 2f 2a 0a 20 2a 20 46 6f 72 77  .007../*. * Forw
3fe0: 61 72 64 20 64 65 63 6c 61 72 61 74 69 6f 6e 20  ard declaration 
3ff0: 6f 66 20 54 63 6c 5f 4f 62 6a 20 74 6f 20 70 72  of Tcl_Obj to pr
4000: 65 76 65 6e 74 20 61 6e 20 65 72 72 6f 72 20 77  event an error w
4010: 68 65 6e 20 74 68 65 20 66 6f 72 77 61 72 64 0a  hen the forward.
4020: 20 2a 20 72 65 66 65 72 65 6e 63 65 20 74 6f 20   * reference to 
4030: 54 63 6c 5f 4f 62 6a 20 69 73 20 65 6e 63 6f 75  Tcl_Obj is encou
4040: 6e 74 65 72 65 64 20 69 6e 20 74 68 65 20 66 75  ntered in the fu
4050: 6e 63 74 69 6f 6e 20 74 79 70 65 73 20 64 65 63  nction types dec
4060: 6c 61 72 65 64 20 62 65 6c 6f 77 2e 0a 20 2a 2f  lared below.. */
4070: 0a 0a 73 74 72 75 63 74 20 54 63 6c 5f 4f 62 6a  ..struct Tcl_Obj
4080: 3b 0a 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d  ;../*. *--------
4090: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
40a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
40b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
40c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
40d0: 2d 2d 2d 2d 0a 20 2a 20 46 75 6e 63 74 69 6f 6e  ----. * Function
40e0: 20 74 79 70 65 73 20 64 65 66 69 6e 65 64 20 62   types defined b
40f0: 79 20 54 63 6c 3a 0a 20 2a 2f 0a 0a 74 79 70 65  y Tcl:. */..type
4100: 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 41 70 70  def int (Tcl_App
4110: 49 6e 69 74 50 72 6f 63 29 20 28 54 63 6c 5f 49  InitProc) (Tcl_I
4120: 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 29 3b 0a  nterp *interp);.
4130: 74 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c  typedef int (Tcl
4140: 5f 41 73 79 6e 63 50 72 6f 63 29 20 28 76 6f 69  _AsyncProc) (voi
4150: 64 20 2a 63 6c 69 65 6e 74 44 61 74 61 2c 20 54  d *clientData, T
4160: 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72  cl_Interp *inter
4170: 70 2c 0a 09 69 6e 74 20 63 6f 64 65 29 3b 0a 74  p,..int code);.t
4180: 79 70 65 64 65 66 20 76 6f 69 64 20 28 54 63 6c  ypedef void (Tcl
4190: 5f 43 68 61 6e 6e 65 6c 50 72 6f 63 29 20 28 76  _ChannelProc) (v
41a0: 6f 69 64 20 2a 63 6c 69 65 6e 74 44 61 74 61 2c  oid *clientData,
41b0: 20 69 6e 74 20 6d 61 73 6b 29 3b 0a 74 79 70 65   int mask);.type
41c0: 64 65 66 20 76 6f 69 64 20 28 54 63 6c 5f 43 6c  def void (Tcl_Cl
41d0: 6f 73 65 50 72 6f 63 29 20 28 76 6f 69 64 20 2a  oseProc) (void *
41e0: 64 61 74 61 29 3b 0a 74 79 70 65 64 65 66 20 76  data);.typedef v
41f0: 6f 69 64 20 28 54 63 6c 5f 43 6d 64 44 65 6c 65  oid (Tcl_CmdDele
4200: 74 65 50 72 6f 63 29 20 28 76 6f 69 64 20 2a 63  teProc) (void *c
4210: 6c 69 65 6e 74 44 61 74 61 29 3b 0a 74 79 70 65  lientData);.type
4220: 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 43 6d 64  def int (Tcl_Cmd
4230: 50 72 6f 63 29 20 28 76 6f 69 64 20 2a 63 6c 69  Proc) (void *cli
4240: 65 6e 74 44 61 74 61 2c 20 54 63 6c 5f 49 6e 74  entData, Tcl_Int
4250: 65 72 70 20 2a 69 6e 74 65 72 70 2c 0a 09 69 6e  erp *interp,..in
4260: 74 20 61 72 67 63 2c 20 63 6f 6e 73 74 20 63 68  t argc, const ch
4270: 61 72 20 2a 2a 61 72 67 76 29 3b 0a 23 69 66 6e  ar **argv);.#ifn
4280: 64 65 66 20 54 43 4c 5f 4e 4f 5f 44 45 50 52 45  def TCL_NO_DEPRE
4290: 43 41 54 45 44 0a 74 79 70 65 64 65 66 20 76 6f  CATED.typedef vo
42a0: 69 64 20 28 54 63 6c 5f 43 6d 64 54 72 61 63 65  id (Tcl_CmdTrace
42b0: 50 72 6f 63 29 20 28 76 6f 69 64 20 2a 63 6c 69  Proc) (void *cli
42c0: 65 6e 74 44 61 74 61 2c 20 54 63 6c 5f 49 6e 74  entData, Tcl_Int
42d0: 65 72 70 20 2a 69 6e 74 65 72 70 2c 0a 09 69 6e  erp *interp,..in
42e0: 74 20 6c 65 76 65 6c 2c 20 63 68 61 72 20 2a 63  t level, char *c
42f0: 6f 6d 6d 61 6e 64 2c 20 54 63 6c 5f 43 6d 64 50  ommand, Tcl_CmdP
4300: 72 6f 63 20 2a 70 72 6f 63 2c 0a 09 76 6f 69 64  roc *proc,..void
4310: 20 2a 63 6d 64 43 6c 69 65 6e 74 44 61 74 61 2c   *cmdClientData,
4320: 20 69 6e 74 20 61 72 67 63 2c 20 63 6f 6e 73 74   int argc, const
4330: 20 63 68 61 72 20 2a 2a 61 72 67 76 29 3b 0a 74   char **argv);.t
4340: 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f  ypedef int (Tcl_
4350: 43 6d 64 4f 62 6a 54 72 61 63 65 50 72 6f 63 29  CmdObjTraceProc)
4360: 20 28 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 61   (void *clientDa
4370: 74 61 2c 20 54 63 6c 5f 49 6e 74 65 72 70 20 2a  ta, Tcl_Interp *
4380: 69 6e 74 65 72 70 2c 0a 09 69 6e 74 20 6c 65 76  interp,..int lev
4390: 65 6c 2c 20 63 6f 6e 73 74 20 63 68 61 72 20 2a  el, const char *
43a0: 63 6f 6d 6d 61 6e 64 2c 20 54 63 6c 5f 43 6f 6d  command, Tcl_Com
43b0: 6d 61 6e 64 20 63 6f 6d 6d 61 6e 64 49 6e 66 6f  mand commandInfo
43c0: 2c 20 69 6e 74 20 6f 62 6a 63 2c 0a 09 73 74 72  , int objc,..str
43d0: 75 63 74 20 54 63 6c 5f 4f 62 6a 20 2a 63 6f 6e  uct Tcl_Obj *con
43e0: 73 74 20 2a 6f 62 6a 76 29 3b 0a 23 65 6e 64 69  st *objv);.#endi
43f0: 66 20 2f 2a 20 54 43 4c 5f 4e 4f 5f 44 45 50 52  f /* TCL_NO_DEPR
4400: 45 43 41 54 45 44 20 2a 2f 0a 74 79 70 65 64 65  ECATED */.typede
4410: 66 20 76 6f 69 64 20 28 54 63 6c 5f 43 6d 64 4f  f void (Tcl_CmdO
4420: 62 6a 54 72 61 63 65 44 65 6c 65 74 65 50 72 6f  bjTraceDeletePro
4430: 63 29 20 28 76 6f 69 64 20 2a 63 6c 69 65 6e 74  c) (void *client
4440: 44 61 74 61 29 3b 0a 74 79 70 65 64 65 66 20 76  Data);.typedef v
4450: 6f 69 64 20 28 54 63 6c 5f 44 75 70 49 6e 74 65  oid (Tcl_DupInte
4460: 72 6e 61 6c 52 65 70 50 72 6f 63 29 20 28 73 74  rnalRepProc) (st
4470: 72 75 63 74 20 54 63 6c 5f 4f 62 6a 20 2a 73 72  ruct Tcl_Obj *sr
4480: 63 50 74 72 2c 0a 09 73 74 72 75 63 74 20 54 63  cPtr,..struct Tc
4490: 6c 5f 4f 62 6a 20 2a 64 75 70 50 74 72 29 3b 0a  l_Obj *dupPtr);.
44a0: 74 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c  typedef int (Tcl
44b0: 5f 45 6e 63 6f 64 69 6e 67 43 6f 6e 76 65 72 74  _EncodingConvert
44c0: 50 72 6f 63 29 20 28 76 6f 69 64 20 2a 63 6c 69  Proc) (void *cli
44d0: 65 6e 74 44 61 74 61 2c 20 63 6f 6e 73 74 20 63  entData, const c
44e0: 68 61 72 20 2a 73 72 63 2c 0a 09 69 6e 74 20 73  har *src,..int s
44f0: 72 63 4c 65 6e 2c 20 69 6e 74 20 66 6c 61 67 73  rcLen, int flags
4500: 2c 20 54 63 6c 5f 45 6e 63 6f 64 69 6e 67 53 74  , Tcl_EncodingSt
4510: 61 74 65 20 2a 73 74 61 74 65 50 74 72 2c 20 63  ate *statePtr, c
4520: 68 61 72 20 2a 64 73 74 2c 0a 09 69 6e 74 20 64  har *dst,..int d
4530: 73 74 4c 65 6e 2c 20 69 6e 74 20 2a 73 72 63 52  stLen, int *srcR
4540: 65 61 64 50 74 72 2c 20 69 6e 74 20 2a 64 73 74  eadPtr, int *dst
4550: 57 72 6f 74 65 50 74 72 2c 20 69 6e 74 20 2a 64  WrotePtr, int *d
4560: 73 74 43 68 61 72 73 50 74 72 29 3b 0a 74 79 70  stCharsPtr);.typ
4570: 65 64 65 66 20 76 6f 69 64 20 28 54 63 6c 5f 45  edef void (Tcl_E
4580: 6e 63 6f 64 69 6e 67 46 72 65 65 50 72 6f 63 29  ncodingFreeProc)
4590: 20 28 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 61   (void *clientDa
45a0: 74 61 29 3b 0a 74 79 70 65 64 65 66 20 69 6e 74  ta);.typedef int
45b0: 20 28 54 63 6c 5f 45 76 65 6e 74 50 72 6f 63 29   (Tcl_EventProc)
45c0: 20 28 54 63 6c 5f 45 76 65 6e 74 20 2a 65 76 50   (Tcl_Event *evP
45d0: 74 72 2c 20 69 6e 74 20 66 6c 61 67 73 29 3b 0a  tr, int flags);.
45e0: 74 79 70 65 64 65 66 20 76 6f 69 64 20 28 54 63  typedef void (Tc
45f0: 6c 5f 45 76 65 6e 74 43 68 65 63 6b 50 72 6f 63  l_EventCheckProc
4600: 29 20 28 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44  ) (void *clientD
4610: 61 74 61 2c 20 69 6e 74 20 66 6c 61 67 73 29 3b  ata, int flags);
4620: 0a 74 79 70 65 64 65 66 20 69 6e 74 20 28 54 63  .typedef int (Tc
4630: 6c 5f 45 76 65 6e 74 44 65 6c 65 74 65 50 72 6f  l_EventDeletePro
4640: 63 29 20 28 54 63 6c 5f 45 76 65 6e 74 20 2a 65  c) (Tcl_Event *e
4650: 76 50 74 72 2c 20 76 6f 69 64 20 2a 63 6c 69 65  vPtr, void *clie
4660: 6e 74 44 61 74 61 29 3b 0a 74 79 70 65 64 65 66  ntData);.typedef
4670: 20 76 6f 69 64 20 28 54 63 6c 5f 45 76 65 6e 74   void (Tcl_Event
4680: 53 65 74 75 70 50 72 6f 63 29 20 28 76 6f 69 64  SetupProc) (void
4690: 20 2a 63 6c 69 65 6e 74 44 61 74 61 2c 20 69 6e   *clientData, in
46a0: 74 20 66 6c 61 67 73 29 3b 0a 74 79 70 65 64 65  t flags);.typede
46b0: 66 20 76 6f 69 64 20 28 54 63 6c 5f 45 78 69 74  f void (Tcl_Exit
46c0: 50 72 6f 63 29 20 28 76 6f 69 64 20 2a 63 6c 69  Proc) (void *cli
46d0: 65 6e 74 44 61 74 61 29 3b 0a 74 79 70 65 64 65  entData);.typede
46e0: 66 20 76 6f 69 64 20 28 54 63 6c 5f 46 69 6c 65  f void (Tcl_File
46f0: 50 72 6f 63 29 20 28 76 6f 69 64 20 2a 63 6c 69  Proc) (void *cli
4700: 65 6e 74 44 61 74 61 2c 20 69 6e 74 20 6d 61 73  entData, int mas
4710: 6b 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 64  k);.typedef void
4720: 20 28 54 63 6c 5f 46 69 6c 65 46 72 65 65 50 72   (Tcl_FileFreePr
4730: 6f 63 29 20 28 76 6f 69 64 20 2a 63 6c 69 65 6e  oc) (void *clien
4740: 74 44 61 74 61 29 3b 0a 74 79 70 65 64 65 66 20  tData);.typedef 
4750: 76 6f 69 64 20 28 54 63 6c 5f 46 72 65 65 49 6e  void (Tcl_FreeIn
4760: 74 65 72 6e 61 6c 52 65 70 50 72 6f 63 29 20 28  ternalRepProc) (
4770: 73 74 72 75 63 74 20 54 63 6c 5f 4f 62 6a 20 2a  struct Tcl_Obj *
4780: 6f 62 6a 50 74 72 29 3b 0a 74 79 70 65 64 65 66  objPtr);.typedef
4790: 20 76 6f 69 64 20 28 54 63 6c 5f 49 64 6c 65 50   void (Tcl_IdleP
47a0: 72 6f 63 29 20 28 76 6f 69 64 20 2a 63 6c 69 65  roc) (void *clie
47b0: 6e 74 44 61 74 61 29 3b 0a 74 79 70 65 64 65 66  ntData);.typedef
47c0: 20 76 6f 69 64 20 28 54 63 6c 5f 49 6e 74 65 72   void (Tcl_Inter
47d0: 70 44 65 6c 65 74 65 50 72 6f 63 29 20 28 76 6f  pDeleteProc) (vo
47e0: 69 64 20 2a 63 6c 69 65 6e 74 44 61 74 61 2c 0a  id *clientData,.
47f0: 09 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74  .Tcl_Interp *int
4800: 65 72 70 29 3b 0a 74 79 70 65 64 65 66 20 76 6f  erp);.typedef vo
4810: 69 64 20 28 54 63 6c 5f 4e 61 6d 65 73 70 61 63  id (Tcl_Namespac
4820: 65 44 65 6c 65 74 65 50 72 6f 63 29 20 28 76 6f  eDeleteProc) (vo
4830: 69 64 20 2a 63 6c 69 65 6e 74 44 61 74 61 29 3b  id *clientData);
4840: 0a 23 69 66 20 21 64 65 66 69 6e 65 64 28 54 43  .#if !defined(TC
4850: 4c 5f 4e 4f 5f 44 45 50 52 45 43 41 54 45 44 29  L_NO_DEPRECATED)
4860: 20 7c 7c 20 21 64 65 66 69 6e 65 64 28 42 55 49   || !defined(BUI
4870: 4c 44 5f 74 63 6c 29 0a 74 79 70 65 64 65 66 20  LD_tcl).typedef 
4880: 69 6e 74 20 28 54 63 6c 5f 4f 62 6a 43 6d 64 50  int (Tcl_ObjCmdP
4890: 72 6f 63 29 20 28 76 6f 69 64 20 2a 63 6c 69 65  roc) (void *clie
48a0: 6e 74 44 61 74 61 2c 20 54 63 6c 5f 49 6e 74 65  ntData, Tcl_Inte
48b0: 72 70 20 2a 69 6e 74 65 72 70 2c 0a 09 69 6e 74  rp *interp,..int
48c0: 20 6f 62 6a 63 2c 20 73 74 72 75 63 74 20 54 63   objc, struct Tc
48d0: 6c 5f 4f 62 6a 20 2a 63 6f 6e 73 74 20 2a 6f 62  l_Obj *const *ob
48e0: 6a 76 29 3b 0a 23 65 6e 64 69 66 20 2f 2a 20 54  jv);.#endif /* T
48f0: 43 4c 5f 4e 4f 5f 44 45 50 52 45 43 41 54 45 44  CL_NO_DEPRECATED
4900: 20 2a 2f 0a 74 79 70 65 64 65 66 20 69 6e 74 20   */.typedef int 
4910: 28 54 63 6c 5f 4f 62 6a 43 6d 64 50 72 6f 63 32  (Tcl_ObjCmdProc2
4920: 29 20 28 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44  ) (void *clientD
4930: 61 74 61 2c 20 54 63 6c 5f 49 6e 74 65 72 70 20  ata, Tcl_Interp 
4940: 2a 69 6e 74 65 72 70 2c 0a 09 54 63 6c 5f 53 69  *interp,..Tcl_Si
4950: 7a 65 20 6f 62 6a 63 2c 20 73 74 72 75 63 74 20  ze objc, struct 
4960: 54 63 6c 5f 4f 62 6a 20 2a 63 6f 6e 73 74 20 2a  Tcl_Obj *const *
4970: 6f 62 6a 76 29 3b 0a 74 79 70 65 64 65 66 20 69  objv);.typedef i
4980: 6e 74 20 28 54 63 6c 5f 43 6d 64 4f 62 6a 54 72  nt (Tcl_CmdObjTr
4990: 61 63 65 50 72 6f 63 32 29 20 28 76 6f 69 64 20  aceProc2) (void 
49a0: 2a 63 6c 69 65 6e 74 44 61 74 61 2c 20 54 63 6c  *clientData, Tcl
49b0: 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c  _Interp *interp,
49c0: 0a 09 54 63 6c 5f 53 69 7a 65 20 6c 65 76 65 6c  ..Tcl_Size level
49d0: 2c 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 63 6f  , const char *co
49e0: 6d 6d 61 6e 64 2c 20 54 63 6c 5f 43 6f 6d 6d 61  mmand, Tcl_Comma
49f0: 6e 64 20 63 6f 6d 6d 61 6e 64 49 6e 66 6f 2c 20  nd commandInfo, 
4a00: 54 63 6c 5f 53 69 7a 65 20 6f 62 6a 63 2c 0a 09  Tcl_Size objc,..
4a10: 73 74 72 75 63 74 20 54 63 6c 5f 4f 62 6a 20 2a  struct Tcl_Obj *
4a20: 63 6f 6e 73 74 20 2a 6f 62 6a 76 29 3b 0a 74 79  const *objv);.ty
4a30: 70 65 64 65 66 20 76 6f 69 64 20 28 54 63 6c 5f  pedef void (Tcl_
4a40: 46 72 65 65 50 72 6f 63 29 20 28 76 6f 69 64 20  FreeProc) (void 
4a50: 2a 62 6c 6f 63 6b 50 74 72 29 3b 0a 23 64 65 66  *blockPtr);.#def
4a60: 69 6e 65 20 54 63 6c 5f 45 78 69 74 50 72 6f 63  ine Tcl_ExitProc
4a70: 20 54 63 6c 5f 46 72 65 65 50 72 6f 63 0a 23 64   Tcl_FreeProc.#d
4a80: 65 66 69 6e 65 20 54 63 6c 5f 46 69 6c 65 46 72  efine Tcl_FileFr
4a90: 65 65 50 72 6f 63 20 54 63 6c 5f 46 72 65 65 50  eeProc Tcl_FreeP
4aa0: 72 6f 63 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f  roc.#define Tcl_
4ab0: 46 69 6c 65 46 72 65 65 50 72 6f 63 20 54 63 6c  FileFreeProc Tcl
4ac0: 5f 46 72 65 65 50 72 6f 63 0a 23 64 65 66 69 6e  _FreeProc.#defin
4ad0: 65 20 54 63 6c 5f 45 6e 63 6f 64 69 6e 67 46 72  e Tcl_EncodingFr
4ae0: 65 65 50 72 6f 63 20 54 63 6c 5f 46 72 65 65 50  eeProc Tcl_FreeP
4af0: 72 6f 63 0a 74 79 70 65 64 65 66 20 69 6e 74 20  roc.typedef int 
4b00: 28 54 63 6c 5f 4c 69 62 72 61 72 79 49 6e 69 74  (Tcl_LibraryInit
4b10: 50 72 6f 63 29 20 28 54 63 6c 5f 49 6e 74 65 72  Proc) (Tcl_Inter
4b20: 70 20 2a 69 6e 74 65 72 70 29 3b 0a 74 79 70 65  p *interp);.type
4b30: 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 4c 69 62  def int (Tcl_Lib
4b40: 72 61 72 79 55 6e 6c 6f 61 64 50 72 6f 63 29 20  raryUnloadProc) 
4b50: 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74  (Tcl_Interp *int
4b60: 65 72 70 2c 20 69 6e 74 20 66 6c 61 67 73 29 3b  erp, int flags);
4b70: 0a 74 79 70 65 64 65 66 20 76 6f 69 64 20 28 54  .typedef void (T
4b80: 63 6c 5f 50 61 6e 69 63 50 72 6f 63 29 20 28 63  cl_PanicProc) (c
4b90: 6f 6e 73 74 20 63 68 61 72 20 2a 66 6f 72 6d 61  onst char *forma
4ba0: 74 2c 20 2e 2e 2e 29 20 54 43 4c 5f 46 4f 52 4d  t, ...) TCL_FORM
4bb0: 41 54 5f 50 52 49 4e 54 46 28 31 2c 20 32 29 3b  AT_PRINTF(1, 2);
4bc0: 0a 74 79 70 65 64 65 66 20 69 6e 74 20 28 54 63  .typedef int (Tc
4bd0: 6c 5f 50 6f 73 74 49 6e 69 74 50 72 6f 63 29 20  l_PostInitProc) 
4be0: 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74  (Tcl_Interp *int
4bf0: 65 72 70 2c 20 76 6f 69 64 20 2a 63 6c 69 65 6e  erp, void *clien
4c00: 74 44 61 74 61 29 3b 0a 74 79 70 65 64 65 66 20  tData);.typedef 
4c10: 76 6f 69 64 20 28 54 63 6c 5f 54 63 70 41 63 63  void (Tcl_TcpAcc
4c20: 65 70 74 50 72 6f 63 29 20 28 76 6f 69 64 20 2a  eptProc) (void *
4c30: 63 61 6c 6c 62 61 63 6b 44 61 74 61 2c 20 54 63  callbackData, Tc
4c40: 6c 5f 43 68 61 6e 6e 65 6c 20 63 68 61 6e 2c 0a  l_Channel chan,.
4c50: 09 63 68 61 72 20 2a 61 64 64 72 65 73 73 2c 20  .char *address, 
4c60: 69 6e 74 20 70 6f 72 74 29 3b 0a 74 79 70 65 64  int port);.typed
4c70: 65 66 20 76 6f 69 64 20 28 54 63 6c 5f 54 69 6d  ef void (Tcl_Tim
4c80: 65 72 50 72 6f 63 29 20 28 76 6f 69 64 20 2a 63  erProc) (void *c
4c90: 6c 69 65 6e 74 44 61 74 61 29 3b 0a 74 79 70 65  lientData);.type
4ca0: 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 53 65 74  def int (Tcl_Set
4cb0: 46 72 6f 6d 41 6e 79 50 72 6f 63 29 20 28 54 63  FromAnyProc) (Tc
4cc0: 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70  l_Interp *interp
4cd0: 2c 20 73 74 72 75 63 74 20 54 63 6c 5f 4f 62 6a  , struct Tcl_Obj
4ce0: 20 2a 6f 62 6a 50 74 72 29 3b 0a 74 79 70 65 64   *objPtr);.typed
4cf0: 65 66 20 76 6f 69 64 20 28 54 63 6c 5f 55 70 64  ef void (Tcl_Upd
4d00: 61 74 65 53 74 72 69 6e 67 50 72 6f 63 29 20 28  ateStringProc) (
4d10: 73 74 72 75 63 74 20 54 63 6c 5f 4f 62 6a 20 2a  struct Tcl_Obj *
4d20: 6f 62 6a 50 74 72 29 3b 0a 74 79 70 65 64 65 66  objPtr);.typedef
4d30: 20 63 68 61 72 20 2a 20 28 54 63 6c 5f 56 61 72   char * (Tcl_Var
4d40: 54 72 61 63 65 50 72 6f 63 29 20 28 76 6f 69 64  TraceProc) (void
4d50: 20 2a 63 6c 69 65 6e 74 44 61 74 61 2c 20 54 63   *clientData, Tc
4d60: 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70  l_Interp *interp
4d70: 2c 0a 09 63 6f 6e 73 74 20 63 68 61 72 20 2a 70  ,..const char *p
4d80: 61 72 74 31 2c 20 63 6f 6e 73 74 20 63 68 61 72  art1, const char
4d90: 20 2a 70 61 72 74 32 2c 20 69 6e 74 20 66 6c 61   *part2, int fla
4da0: 67 73 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69  gs);.typedef voi
4db0: 64 20 28 54 63 6c 5f 43 6f 6d 6d 61 6e 64 54 72  d (Tcl_CommandTr
4dc0: 61 63 65 50 72 6f 63 29 20 28 76 6f 69 64 20 2a  aceProc) (void *
4dd0: 63 6c 69 65 6e 74 44 61 74 61 2c 20 54 63 6c 5f  clientData, Tcl_
4de0: 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c 0a  Interp *interp,.
4df0: 09 63 6f 6e 73 74 20 63 68 61 72 20 2a 6f 6c 64  .const char *old
4e00: 4e 61 6d 65 2c 20 63 6f 6e 73 74 20 63 68 61 72  Name, const char
4e10: 20 2a 6e 65 77 4e 61 6d 65 2c 20 69 6e 74 20 66   *newName, int f
4e20: 6c 61 67 73 29 3b 0a 74 79 70 65 64 65 66 20 76  lags);.typedef v
4e30: 6f 69 64 20 28 54 63 6c 5f 43 72 65 61 74 65 46  oid (Tcl_CreateF
4e40: 69 6c 65 48 61 6e 64 6c 65 72 50 72 6f 63 29 20  ileHandlerProc) 
4e50: 28 69 6e 74 20 66 64 2c 20 69 6e 74 20 6d 61 73  (int fd, int mas
4e60: 6b 2c 20 54 63 6c 5f 46 69 6c 65 50 72 6f 63 20  k, Tcl_FileProc 
4e70: 2a 70 72 6f 63 2c 0a 09 76 6f 69 64 20 2a 63 6c  *proc,..void *cl
4e80: 69 65 6e 74 44 61 74 61 29 3b 0a 74 79 70 65 64  ientData);.typed
4e90: 65 66 20 76 6f 69 64 20 28 54 63 6c 5f 44 65 6c  ef void (Tcl_Del
4ea0: 65 74 65 46 69 6c 65 48 61 6e 64 6c 65 72 50 72  eteFileHandlerPr
4eb0: 6f 63 29 20 28 69 6e 74 20 66 64 29 3b 0a 74 79  oc) (int fd);.ty
4ec0: 70 65 64 65 66 20 76 6f 69 64 20 28 54 63 6c 5f  pedef void (Tcl_
4ed0: 41 6c 65 72 74 4e 6f 74 69 66 69 65 72 50 72 6f  AlertNotifierPro
4ee0: 63 29 20 28 76 6f 69 64 20 2a 63 6c 69 65 6e 74  c) (void *client
4ef0: 44 61 74 61 29 3b 0a 74 79 70 65 64 65 66 20 76  Data);.typedef v
4f00: 6f 69 64 20 28 54 63 6c 5f 53 65 72 76 69 63 65  oid (Tcl_Service
4f10: 4d 6f 64 65 48 6f 6f 6b 50 72 6f 63 29 20 28 69  ModeHookProc) (i
4f20: 6e 74 20 6d 6f 64 65 29 3b 0a 74 79 70 65 64 65  nt mode);.typede
4f30: 66 20 76 6f 69 64 20 2a 28 54 63 6c 5f 49 6e 69  f void *(Tcl_Ini
4f40: 74 4e 6f 74 69 66 69 65 72 50 72 6f 63 29 20 28  tNotifierProc) (
4f50: 76 6f 69 64 29 3b 0a 74 79 70 65 64 65 66 20 76  void);.typedef v
4f60: 6f 69 64 20 28 54 63 6c 5f 46 69 6e 61 6c 69 7a  oid (Tcl_Finaliz
4f70: 65 4e 6f 74 69 66 69 65 72 50 72 6f 63 29 20 28  eNotifierProc) (
4f80: 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 61 74 61  void *clientData
4f90: 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 64 20  );.typedef void 
4fa0: 28 54 63 6c 5f 4d 61 69 6e 4c 6f 6f 70 50 72 6f  (Tcl_MainLoopPro
4fb0: 63 29 20 28 76 6f 69 64 29 3b 0a 0c 0a 2f 2a 20  c) (void);.../* 
4fc0: 41 62 73 74 72 61 63 74 20 4c 69 73 74 20 66 75  Abstract List fu
4fd0: 6e 63 74 69 6f 6e 73 20 2a 2f 0a 74 79 70 65 64  nctions */.typed
4fe0: 65 66 20 54 63 6c 5f 53 69 7a 65 20 28 54 63 6c  ef Tcl_Size (Tcl
4ff0: 5f 4f 62 6a 54 79 70 65 4c 65 6e 67 74 68 50 72  _ObjTypeLengthPr
5000: 6f 63 29 20 28 73 74 72 75 63 74 20 54 63 6c 5f  oc) (struct Tcl_
5010: 4f 62 6a 20 2a 6c 69 73 74 50 74 72 29 3b 0a 74  Obj *listPtr);.t
5020: 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f  ypedef int (Tcl_
5030: 4f 62 6a 54 79 70 65 49 6e 64 65 78 50 72 6f 63  ObjTypeIndexProc
5040: 29 20 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69  ) (Tcl_Interp *i
5050: 6e 74 65 72 70 2c 20 73 74 72 75 63 74 20 54 63  nterp, struct Tc
5060: 6c 5f 4f 62 6a 20 2a 6c 69 73 74 50 74 72 2c 0a  l_Obj *listPtr,.
5070: 09 54 63 6c 5f 53 69 7a 65 20 69 6e 64 65 78 2c  .Tcl_Size index,
5080: 20 73 74 72 75 63 74 20 54 63 6c 5f 4f 62 6a 20   struct Tcl_Obj 
5090: 2a 2a 65 6c 65 6d 4f 62 6a 29 3b 0a 74 79 70 65  **elemObj);.type
50a0: 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 4f 62 6a  def int (Tcl_Obj
50b0: 54 79 70 65 53 6c 69 63 65 50 72 6f 63 29 20 28  TypeSliceProc) (
50c0: 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65  Tcl_Interp *inte
50d0: 72 70 2c 20 73 74 72 75 63 74 20 54 63 6c 5f 4f  rp, struct Tcl_O
50e0: 62 6a 20 2a 6c 69 73 74 50 74 72 2c 0a 09 54 63  bj *listPtr,..Tc
50f0: 6c 5f 53 69 7a 65 20 66 72 6f 6d 49 64 78 2c 20  l_Size fromIdx, 
5100: 54 63 6c 5f 53 69 7a 65 20 74 6f 49 64 78 2c 20  Tcl_Size toIdx, 
5110: 73 74 72 75 63 74 20 54 63 6c 5f 4f 62 6a 20 2a  struct Tcl_Obj *
5120: 2a 6e 65 77 4f 62 6a 50 74 72 29 3b 0a 74 79 70  *newObjPtr);.typ
5130: 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 4f 62  edef int (Tcl_Ob
5140: 6a 54 79 70 65 52 65 76 65 72 73 65 50 72 6f 63  jTypeReverseProc
5150: 29 20 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69  ) (Tcl_Interp *i
5160: 6e 74 65 72 70 2c 0a 09 73 74 72 75 63 74 20 54  nterp,..struct T
5170: 63 6c 5f 4f 62 6a 20 2a 6c 69 73 74 50 74 72 2c  cl_Obj *listPtr,
5180: 20 73 74 72 75 63 74 20 54 63 6c 5f 4f 62 6a 20   struct Tcl_Obj 
5190: 2a 2a 6e 65 77 4f 62 6a 50 74 72 29 3b 0a 74 79  **newObjPtr);.ty
51a0: 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 4f  pedef int (Tcl_O
51b0: 62 6a 54 79 70 65 47 65 74 45 6c 65 6d 65 6e 74  bjTypeGetElement
51c0: 73 29 20 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a  s) (Tcl_Interp *
51d0: 69 6e 74 65 72 70 2c 0a 09 73 74 72 75 63 74 20  interp,..struct 
51e0: 54 63 6c 5f 4f 62 6a 20 2a 6c 69 73 74 50 74 72  Tcl_Obj *listPtr
51f0: 2c 20 54 63 6c 5f 53 69 7a 65 20 2a 6f 62 6a 63  , Tcl_Size *objc
5200: 70 74 72 2c 20 73 74 72 75 63 74 20 54 63 6c 5f  ptr, struct Tcl_
5210: 4f 62 6a 20 2a 2a 2a 6f 62 6a 76 70 74 72 29 3b  Obj ***objvptr);
5220: 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20  .typedef struct 
5230: 54 63 6c 5f 4f 62 6a 20 2a 28 54 63 6c 5f 4f 62  Tcl_Obj *(Tcl_Ob
5240: 6a 54 79 70 65 53 65 74 45 6c 65 6d 65 6e 74 29  jTypeSetElement)
5250: 20 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e   (Tcl_Interp *in
5260: 74 65 72 70 2c 0a 09 73 74 72 75 63 74 20 54 63  terp,..struct Tc
5270: 6c 5f 4f 62 6a 20 2a 6c 69 73 74 50 74 72 2c 20  l_Obj *listPtr, 
5280: 54 63 6c 5f 53 69 7a 65 20 69 6e 64 65 78 43 6f  Tcl_Size indexCo
5290: 75 6e 74 2c 0a 09 73 74 72 75 63 74 20 54 63 6c  unt,..struct Tcl
52a0: 5f 4f 62 6a 20 2a 63 6f 6e 73 74 20 69 6e 64 65  _Obj *const inde
52b0: 78 41 72 72 61 79 5b 5d 2c 20 73 74 72 75 63 74  xArray[], struct
52c0: 20 54 63 6c 5f 4f 62 6a 20 2a 76 61 6c 75 65 4f   Tcl_Obj *valueO
52d0: 62 6a 29 3b 0a 74 79 70 65 64 65 66 20 69 6e 74  bj);.typedef int
52e0: 20 28 54 63 6c 5f 4f 62 6a 54 79 70 65 52 65 70   (Tcl_ObjTypeRep
52f0: 6c 61 63 65 50 72 6f 63 29 20 28 54 63 6c 5f 49  laceProc) (Tcl_I
5300: 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c 0a 09  nterp *interp,..
5310: 73 74 72 75 63 74 20 54 63 6c 5f 4f 62 6a 20 2a  struct Tcl_Obj *
5320: 6c 69 73 74 4f 62 6a 2c 20 54 63 6c 5f 53 69 7a  listObj, Tcl_Siz
5330: 65 20 66 69 72 73 74 2c 20 54 63 6c 5f 53 69 7a  e first, Tcl_Siz
5340: 65 20 6e 75 6d 54 6f 44 65 6c 65 74 65 2c 0a 09  e numToDelete,..
5350: 54 63 6c 5f 53 69 7a 65 20 6e 75 6d 54 6f 49 6e  Tcl_Size numToIn
5360: 73 65 72 74 2c 20 73 74 72 75 63 74 20 54 63 6c  sert, struct Tcl
5370: 5f 4f 62 6a 20 2a 63 6f 6e 73 74 20 69 6e 73 65  _Obj *const inse
5380: 72 74 4f 62 6a 73 5b 5d 29 3b 0a 74 79 70 65 64  rtObjs[]);.typed
5390: 65 66 20 69 6e 74 20 28 54 63 6c 5f 4f 62 6a 54  ef int (Tcl_ObjT
53a0: 79 70 65 49 6e 4f 70 65 72 61 74 6f 72 50 72 6f  ypeInOperatorPro
53b0: 63 29 20 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a  c) (Tcl_Interp *
53c0: 69 6e 74 65 72 70 2c 0a 09 73 74 72 75 63 74 20  interp,..struct 
53d0: 54 63 6c 5f 4f 62 6a 20 2a 76 61 6c 75 65 4f 62  Tcl_Obj *valueOb
53e0: 6a 2c 20 73 74 72 75 63 74 20 54 63 6c 5f 4f 62  j, struct Tcl_Ob
53f0: 6a 20 2a 6c 69 73 74 4f 62 6a 2c 20 69 6e 74 20  j *listObj, int 
5400: 2a 62 6f 6f 6c 52 65 73 75 6c 74 29 3b 0a 0a 23  *boolResult);..#
5410: 69 66 6e 64 65 66 20 54 43 4c 5f 4e 4f 5f 44 45  ifndef TCL_NO_DE
5420: 50 52 45 43 41 54 45 44 0a 23 20 20 20 64 65 66  PRECATED.#   def
5430: 69 6e 65 20 54 63 6c 5f 50 61 63 6b 61 67 65 49  ine Tcl_PackageI
5440: 6e 69 74 50 72 6f 63 20 54 63 6c 5f 4c 69 62 72  nitProc Tcl_Libr
5450: 61 72 79 49 6e 69 74 50 72 6f 63 0a 23 20 20 20  aryInitProc.#   
5460: 64 65 66 69 6e 65 20 54 63 6c 5f 50 61 63 6b 61  define Tcl_Packa
5470: 67 65 55 6e 6c 6f 61 64 50 72 6f 63 20 54 63 6c  geUnloadProc Tcl
5480: 5f 4c 69 62 72 61 72 79 55 6e 6c 6f 61 64 50 72  _LibraryUnloadPr
5490: 6f 63 0a 23 65 6e 64 69 66 0a 0a 2f 2a 0a 20 2a  oc.#endif../*. *
54a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
54b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
54c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
54d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
54e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20  ------------. * 
54f0: 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 73 74  The following st
5500: 72 75 63 74 75 72 65 20 72 65 70 72 65 73 65 6e  ructure represen
5510: 74 73 20 61 20 74 79 70 65 20 6f 66 20 6f 62 6a  ts a type of obj
5520: 65 63 74 2c 20 77 68 69 63 68 20 69 73 20 61 20  ect, which is a 
5530: 70 61 72 74 69 63 75 6c 61 72 0a 20 2a 20 69 6e  particular. * in
5540: 74 65 72 6e 61 6c 20 72 65 70 72 65 73 65 6e 74  ternal represent
5550: 61 74 69 6f 6e 20 66 6f 72 20 61 6e 20 6f 62 6a  ation for an obj
5560: 65 63 74 20 70 6c 75 73 20 61 20 73 65 74 20 6f  ect plus a set o
5570: 66 20 66 75 6e 63 74 69 6f 6e 73 20 74 68 61 74  f functions that
5580: 20 70 72 6f 76 69 64 65 0a 20 2a 20 73 74 61 6e   provide. * stan
5590: 64 61 72 64 20 6f 70 65 72 61 74 69 6f 6e 73 20  dard operations 
55a0: 6f 6e 20 6f 62 6a 65 63 74 73 20 6f 66 20 74 68  on objects of th
55b0: 61 74 20 74 79 70 65 2e 0a 20 2a 2f 0a 0a 74 79  at type.. */..ty
55c0: 70 65 64 65 66 20 73 74 72 75 63 74 20 54 63 6c  pedef struct Tcl
55d0: 5f 4f 62 6a 54 79 70 65 20 7b 0a 20 20 20 20 63  _ObjType {.    c
55e0: 6f 6e 73 74 20 63 68 61 72 20 2a 6e 61 6d 65 3b  onst char *name;
55f0: 09 09 2f 2a 20 4e 61 6d 65 20 6f 66 20 74 68 65  ../* Name of the
5600: 20 74 79 70 65 2c 20 65 2e 67 2e 20 22 69 6e 74   type, e.g. "int
5610: 22 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 72  ". */.    Tcl_Fr
5620: 65 65 49 6e 74 65 72 6e 61 6c 52 65 70 50 72 6f  eeInternalRepPro
5630: 63 20 2a 66 72 65 65 49 6e 74 52 65 70 50 72 6f  c *freeIntRepPro
5640: 63 3b 0a 09 09 09 09 2f 2a 20 43 61 6c 6c 65 64  c;...../* Called
5650: 20 74 6f 20 66 72 65 65 20 61 6e 79 20 73 74 6f   to free any sto
5660: 72 61 67 65 20 66 6f 72 20 74 68 65 20 74 79 70  rage for the typ
5670: 65 27 73 0a 09 09 09 09 20 2a 20 69 6e 74 65 72  e's..... * inter
5680: 6e 61 6c 20 72 65 70 2e 20 4e 55 4c 4c 20 69 66  nal rep. NULL if
5690: 20 74 68 65 20 69 6e 74 65 72 6e 61 6c 20 72 65   the internal re
56a0: 70 20 64 6f 65 73 0a 09 09 09 09 20 2a 20 6e 6f  p does..... * no
56b0: 74 20 6e 65 65 64 20 66 72 65 65 69 6e 67 2e 20  t need freeing. 
56c0: 2a 2f 0a 20 20 20 20 54 63 6c 5f 44 75 70 49 6e  */.    Tcl_DupIn
56d0: 74 65 72 6e 61 6c 52 65 70 50 72 6f 63 20 2a 64  ternalRepProc *d
56e0: 75 70 49 6e 74 52 65 70 50 72 6f 63 3b 0a 09 09  upIntRepProc;...
56f0: 09 09 2f 2a 20 43 61 6c 6c 65 64 20 74 6f 20 63  ../* Called to c
5700: 72 65 61 74 65 20 61 20 6e 65 77 20 6f 62 6a 65  reate a new obje
5710: 63 74 20 61 73 20 61 20 63 6f 70 79 20 6f 66 0a  ct as a copy of.
5720: 09 09 09 09 20 2a 20 61 6e 20 65 78 69 73 74 69  .... * an existi
5730: 6e 67 20 6f 62 6a 65 63 74 2e 20 2a 2f 0a 20 20  ng object. */.  
5740: 20 20 54 63 6c 5f 55 70 64 61 74 65 53 74 72 69    Tcl_UpdateStri
5750: 6e 67 50 72 6f 63 20 2a 75 70 64 61 74 65 53 74  ngProc *updateSt
5760: 72 69 6e 67 50 72 6f 63 3b 0a 09 09 09 09 2f 2a  ringProc;...../*
5770: 20 43 61 6c 6c 65 64 20 74 6f 20 75 70 64 61 74   Called to updat
5780: 65 20 74 68 65 20 73 74 72 69 6e 67 20 72 65 70  e the string rep
5790: 20 66 72 6f 6d 20 74 68 65 0a 09 09 09 09 20 2a   from the..... *
57a0: 20 74 79 70 65 27 73 20 69 6e 74 65 72 6e 61 6c   type's internal
57b0: 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2e   representation.
57c0: 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 53 65 74 46   */.    Tcl_SetF
57d0: 72 6f 6d 41 6e 79 50 72 6f 63 20 2a 73 65 74 46  romAnyProc *setF
57e0: 72 6f 6d 41 6e 79 50 72 6f 63 3b 0a 09 09 09 09  romAnyProc;.....
57f0: 2f 2a 20 43 61 6c 6c 65 64 20 74 6f 20 63 6f 6e  /* Called to con
5800: 76 65 72 74 20 74 68 65 20 6f 62 6a 65 63 74 27  vert the object'
5810: 73 20 69 6e 74 65 72 6e 61 6c 20 72 65 70 0a 09  s internal rep..
5820: 09 09 09 20 2a 20 74 6f 20 74 68 69 73 20 74 79  ... * to this ty
5830: 70 65 2e 20 46 72 65 65 73 20 74 68 65 20 69 6e  pe. Frees the in
5840: 74 65 72 6e 61 6c 20 72 65 70 20 6f 66 20 74 68  ternal rep of th
5850: 65 0a 09 09 09 09 20 2a 20 6f 6c 64 20 74 79 70  e..... * old typ
5860: 65 2e 20 52 65 74 75 72 6e 73 20 54 43 4c 5f 45  e. Returns TCL_E
5870: 52 52 4f 52 20 6f 6e 20 66 61 69 6c 75 72 65 2e  RROR on failure.
5880: 20 2a 2f 0a 20 20 20 20 73 69 7a 65 5f 74 20 76   */.    size_t v
5890: 65 72 73 69 6f 6e 3b 09 09 2f 2a 20 56 65 72 73  ersion;../* Vers
58a0: 69 6f 6e 20 66 69 65 6c 64 20 66 6f 72 20 66 75  ion field for fu
58b0: 74 75 72 65 2d 70 72 6f 6f 66 69 6e 67 2e 20 2a  ture-proofing. *
58c0: 2f 0a 0a 20 20 20 20 2f 2a 20 4c 69 73 74 20 65  /..    /* List e
58d0: 6d 75 6c 61 74 69 6f 6e 20 66 75 6e 63 74 69 6f  mulation functio
58e0: 6e 73 20 2d 20 4f 62 6a 54 79 70 65 20 56 65 72  ns - ObjType Ver
58f0: 73 69 6f 6e 20 31 20 2a 2f 0a 20 20 20 20 54 63  sion 1 */.    Tc
5900: 6c 5f 4f 62 6a 54 79 70 65 4c 65 6e 67 74 68 50  l_ObjTypeLengthP
5910: 72 6f 63 20 2a 6c 65 6e 67 74 68 50 72 6f 63 3b  roc *lengthProc;
5920: 0a 09 09 09 09 2f 2a 20 52 65 74 75 72 6e 20 74  ...../* Return t
5930: 68 65 20 5b 6c 6c 65 6e 67 74 68 5d 20 6f 66 20  he [llength] of 
5940: 74 68 65 20 41 62 73 74 72 61 63 74 4c 69 73 74  the AbstractList
5950: 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 4f 62 6a 54   */.    Tcl_ObjT
5960: 79 70 65 49 6e 64 65 78 50 72 6f 63 20 2a 69 6e  ypeIndexProc *in
5970: 64 65 78 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20  dexProc;...../* 
5980: 52 65 74 75 72 6e 20 61 20 76 61 6c 75 65 20 28  Return a value (
5990: 54 63 6c 5f 4f 62 6a 29 20 61 74 20 61 20 67 69  Tcl_Obj) at a gi
59a0: 76 65 6e 20 69 6e 64 65 78 20 2a 2f 0a 20 20 20  ven index */.   
59b0: 20 54 63 6c 5f 4f 62 6a 54 79 70 65 53 6c 69 63   Tcl_ObjTypeSlic
59c0: 65 50 72 6f 63 20 2a 73 6c 69 63 65 50 72 6f 63  eProc *sliceProc
59d0: 3b 0a 09 09 09 09 2f 2a 20 52 65 74 75 72 6e 20  ;...../* Return 
59e0: 61 6e 20 41 62 73 74 72 61 63 74 4c 69 73 74 20  an AbstractList 
59f0: 66 6f 72 0a 09 09 09 09 20 2a 20 5b 6c 72 61 6e  for..... * [lran
5a00: 67 65 20 24 61 6c 20 24 73 74 61 72 74 20 24 65  ge $al $start $e
5a10: 6e 64 5d 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 4f  nd] */.    Tcl_O
5a20: 62 6a 54 79 70 65 52 65 76 65 72 73 65 50 72 6f  bjTypeReversePro
5a30: 63 20 2a 72 65 76 65 72 73 65 50 72 6f 63 3b 0a  c *reverseProc;.
5a40: 09 09 09 09 2f 2a 20 52 65 74 75 72 6e 20 61 6e  ..../* Return an
5a50: 20 41 62 73 74 72 61 63 74 4c 69 73 74 20 66 6f   AbstractList fo
5a60: 72 20 5b 6c 72 65 76 65 72 73 65 20 24 61 6c 5d  r [lreverse $al]
5a70: 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 4f 62 6a 54   */.    Tcl_ObjT
5a80: 79 70 65 47 65 74 45 6c 65 6d 65 6e 74 73 20 2a  ypeGetElements *
5a90: 67 65 74 45 6c 65 6d 65 6e 74 73 50 72 6f 63 3b  getElementsProc;
5aa0: 0a 09 09 09 09 2f 2a 20 52 65 74 75 72 6e 20 61  ...../* Return a
5ab0: 6e 20 6f 62 6a 76 5b 5d 20 6f 66 20 61 6c 6c 20  n objv[] of all 
5ac0: 65 6c 65 6d 65 6e 74 73 20 69 6e 20 74 68 65 20  elements in the 
5ad0: 6c 69 73 74 20 2a 2f 0a 20 20 20 20 54 63 6c 5f  list */.    Tcl_
5ae0: 4f 62 6a 54 79 70 65 53 65 74 45 6c 65 6d 65 6e  ObjTypeSetElemen
5af0: 74 20 2a 73 65 74 45 6c 65 6d 65 6e 74 50 72 6f  t *setElementPro
5b00: 63 3b 0a 09 09 09 09 2f 2a 20 52 65 70 6c 61 63  c;...../* Replac
5b10: 65 20 74 68 65 20 65 6c 65 6d 65 6e 74 20 61 74  e the element at
5b20: 20 74 68 65 20 69 6e 64 69 63 69 65 73 20 77 69   the indicies wi
5b30: 74 68 20 74 68 65 0a 09 09 09 09 20 2a 20 67 69  th the..... * gi
5b40: 76 65 6e 20 76 61 6c 75 65 4f 62 6a 2e 20 2a 2f  ven valueObj. */
5b50: 0a 20 20 20 20 54 63 6c 5f 4f 62 6a 54 79 70 65  .    Tcl_ObjType
5b60: 52 65 70 6c 61 63 65 50 72 6f 63 20 2a 72 65 70  ReplaceProc *rep
5b70: 6c 61 63 65 50 72 6f 63 3b 0a 09 09 09 09 2f 2a  laceProc;...../*
5b80: 20 52 65 70 6c 61 63 65 20 73 75 62 6c 69 73 74   Replace sublist
5b90: 20 77 69 74 68 20 61 6e 6f 74 68 65 72 20 73 75   with another su
5ba0: 62 6c 69 73 74 20 2a 2f 0a 20 20 20 20 54 63 6c  blist */.    Tcl
5bb0: 5f 4f 62 6a 54 79 70 65 49 6e 4f 70 65 72 61 74  _ObjTypeInOperat
5bc0: 6f 72 50 72 6f 63 20 2a 69 6e 4f 70 65 72 50 72  orProc *inOperPr
5bd0: 6f 63 3b 0a 09 09 09 09 2f 2a 20 22 69 6e 22 20  oc;...../* "in" 
5be0: 61 6e 64 20 22 6e 69 22 20 65 78 70 72 20 6c 69  and "ni" expr li
5bf0: 73 74 20 6f 70 65 72 61 74 69 6f 6e 2e 0a 09 09  st operation....
5c00: 09 09 20 2a 20 44 65 74 65 72 6d 69 6e 65 20 69  .. * Determine i
5c10: 66 20 74 68 65 20 67 69 76 65 6e 20 73 74 72 69  f the given stri
5c20: 6e 67 20 76 61 6c 75 65 20 6d 61 74 63 68 65 73  ng value matches
5c30: 0a 09 09 09 09 20 2a 20 61 6e 20 65 6c 65 6d 65  ..... * an eleme
5c40: 6e 74 20 69 6e 20 74 68 65 20 6c 69 73 74 2e 20  nt in the list. 
5c50: 2a 2f 0a 7d 20 54 63 6c 5f 4f 62 6a 54 79 70 65  */.} Tcl_ObjType
5c60: 3b 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4f  ;..#define TCL_O
5c70: 42 4a 54 59 50 45 5f 56 30 20 30 2c 20 5c 0a 09  BJTYPE_V0 0, \..
5c80: 30 2c 30 2c 30 2c 30 2c 30 2c 30 2c 30 2c 30 20  0,0,0,0,0,0,0,0 
5c90: 2f 2a 20 50 72 65 2d 54 63 6c 20 39 20 2a 2f 0a  /* Pre-Tcl 9 */.
5ca0: 23 64 65 66 69 6e 65 20 54 43 4c 5f 4f 42 4a 54  #define TCL_OBJT
5cb0: 59 50 45 5f 56 31 28 61 29 20 6f 66 66 73 65 74  YPE_V1(a) offset
5cc0: 6f 66 28 54 63 6c 5f 4f 62 6a 54 79 70 65 2c 20  of(Tcl_ObjType, 
5cd0: 69 6e 64 65 78 50 72 6f 63 29 2c 20 5c 0a 09 61  indexProc), \..a
5ce0: 2c 30 2c 30 2c 30 2c 30 2c 30 2c 30 2c 30 20 2f  ,0,0,0,0,0,0,0 /
5cf0: 2a 20 54 63 6c 20 39 20 56 65 72 73 69 6f 6e 20  * Tcl 9 Version 
5d00: 31 20 2a 2f 0a 23 64 65 66 69 6e 65 20 54 43 4c  1 */.#define TCL
5d10: 5f 4f 42 4a 54 59 50 45 5f 56 32 28 61 2c 62 2c  _OBJTYPE_V2(a,b,
5d20: 63 2c 64 2c 65 2c 66 2c 67 2c 68 29 20 73 69 7a  c,d,e,f,g,h) siz
5d30: 65 6f 66 28 54 63 6c 5f 4f 62 6a 54 79 70 65 29  eof(Tcl_ObjType)
5d40: 2c 20 20 5c 0a 09 61 2c 62 2c 63 2c 64 2c 65 2c  ,  \..a,b,c,d,e,
5d50: 66 2c 67 2c 68 20 2f 2a 20 54 63 6c 20 39 20 2d  f,g,h /* Tcl 9 -
5d60: 20 41 62 73 74 72 61 63 74 4c 69 73 74 73 20 2a   AbstractLists *
5d70: 2f 0a 0a 2f 2a 0a 20 2a 20 54 68 65 20 66 6f 6c  /../*. * The fol
5d80: 6c 6f 77 69 6e 67 20 73 74 72 75 63 74 75 72 65  lowing structure
5d90: 20 73 74 6f 72 65 73 20 61 6e 20 69 6e 74 65 72   stores an inter
5da0: 6e 61 6c 20 72 65 70 72 65 73 65 6e 74 61 74 69  nal representati
5db0: 6f 6e 20 28 69 6e 74 65 72 6e 61 6c 72 65 70 29  on (internalrep)
5dc0: 20 66 6f 72 0a 20 2a 20 61 20 54 63 6c 20 76 61   for. * a Tcl va
5dd0: 6c 75 65 2e 20 41 6e 20 69 6e 74 65 72 6e 61 6c  lue. An internal
5de0: 72 65 70 20 69 73 20 61 73 73 6f 63 69 61 74 65  rep is associate
5df0: 64 20 77 69 74 68 20 61 6e 20 54 63 6c 5f 4f 62  d with an Tcl_Ob
5e00: 6a 54 79 70 65 20 77 68 65 6e 20 62 6f 74 68 0a  jType when both.
5e10: 20 2a 20 61 72 65 20 73 74 6f 72 65 64 20 69 6e   * are stored in
5e20: 20 74 68 65 20 73 61 6d 65 20 54 63 6c 5f 4f 62   the same Tcl_Ob
5e30: 6a 2e 20 20 54 68 65 20 72 6f 75 74 69 6e 65 73  j.  The routines
5e40: 20 6f 66 20 74 68 65 20 54 63 6c 5f 4f 62 6a 54   of the Tcl_ObjT
5e50: 79 70 65 20 67 6f 76 65 72 6e 0a 20 2a 20 74 68  ype govern. * th
5e60: 65 20 68 61 6e 64 6c 69 6e 67 20 6f 66 20 74 68  e handling of th
5e70: 65 20 69 6e 74 65 72 6e 61 6c 72 65 70 2e 0a 20  e internalrep.. 
5e80: 2a 2f 0a 0a 74 79 70 65 64 65 66 20 75 6e 69 6f  */..typedef unio
5e90: 6e 20 54 63 6c 5f 4f 62 6a 49 6e 74 65 72 6e 61  n Tcl_ObjInterna
5ea0: 6c 52 65 70 20 7b 2f 2a 20 54 68 65 20 69 6e 74  lRep {/* The int
5eb0: 65 72 6e 61 6c 20 72 65 70 72 65 73 65 6e 74 61  ernal representa
5ec0: 74 69 6f 6e 3a 20 2a 2f 0a 20 20 20 20 6c 6f 6e  tion: */.    lon
5ed0: 67 20 6c 6f 6e 67 56 61 6c 75 65 3b 09 09 2f 2a  g longValue;../*
5ee0: 20 20 20 2d 20 61 6e 20 6c 6f 6e 67 20 69 6e 74     - an long int
5ef0: 65 67 65 72 20 76 61 6c 75 65 2e 20 2a 2f 0a 20  eger value. */. 
5f00: 20 20 20 64 6f 75 62 6c 65 20 64 6f 75 62 6c 65     double double
5f10: 56 61 6c 75 65 3b 09 09 2f 2a 20 20 20 2d 20 61  Value;../*   - a
5f20: 20 64 6f 75 62 6c 65 2d 70 72 65 63 69 73 69 6f   double-precisio
5f30: 6e 20 66 6c 6f 61 74 69 6e 67 20 76 61 6c 75 65  n floating value
5f40: 2e 20 2a 2f 0a 20 20 20 20 76 6f 69 64 20 2a 6f  . */.    void *o
5f50: 74 68 65 72 56 61 6c 75 65 50 74 72 3b 09 2f 2a  therValuePtr;./*
5f60: 20 20 20 2d 20 61 6e 6f 74 68 65 72 2c 20 74 79     - another, ty
5f70: 70 65 2d 73 70 65 63 69 66 69 63 20 76 61 6c 75  pe-specific valu
5f80: 65 2c 20 2a 2f 0a 09 09 09 09 2f 2a 20 20 20 20  e, */...../*    
5f90: 20 6e 6f 74 20 75 73 65 64 20 69 6e 74 65 72 6e   not used intern
5fa0: 61 6c 6c 79 20 61 6e 79 20 6d 6f 72 65 2e 20 2a  ally any more. *
5fb0: 2f 0a 20 20 20 20 54 63 6c 5f 57 69 64 65 49 6e  /.    Tcl_WideIn
5fc0: 74 20 77 69 64 65 56 61 6c 75 65 3b 09 2f 2a 20  t wideValue;./* 
5fd0: 20 20 2d 20 61 6e 20 69 6e 74 65 67 65 72 20 76    - an integer v
5fe0: 61 6c 75 65 20 3e 3d 20 36 34 62 69 74 73 20 2a  alue >= 64bits *
5ff0: 2f 0a 20 20 20 20 73 74 72 75 63 74 20 7b 09 09  /.    struct {..
6000: 09 2f 2a 20 20 20 2d 20 69 6e 74 65 72 6e 61 6c  ./*   - internal
6010: 20 72 65 70 20 61 73 20 74 77 6f 20 70 6f 69 6e   rep as two poin
6020: 74 65 72 73 2e 20 2a 2f 0a 09 76 6f 69 64 20 2a  ters. */..void *
6030: 70 74 72 31 3b 0a 09 76 6f 69 64 20 2a 70 74 72  ptr1;..void *ptr
6040: 32 3b 0a 20 20 20 20 7d 20 74 77 6f 50 74 72 56  2;.    } twoPtrV
6050: 61 6c 75 65 3b 0a 20 20 20 20 73 74 72 75 63 74  alue;.    struct
6060: 20 7b 09 09 09 2f 2a 20 20 20 2d 20 69 6e 74 65   {.../*   - inte
6070: 72 6e 61 6c 20 72 65 70 20 61 73 20 61 20 70 6f  rnal rep as a po
6080: 69 6e 74 65 72 20 61 6e 64 20 61 20 6c 6f 6e 67  inter and a long
6090: 2c 20 2a 2f 0a 09 76 6f 69 64 20 2a 70 74 72 3b  , */..void *ptr;
60a0: 09 09 2f 2a 20 20 20 20 20 6e 6f 74 20 75 73 65  ../*     not use
60b0: 64 20 69 6e 74 65 72 6e 61 6c 6c 79 20 61 6e 79  d internally any
60c0: 20 6d 6f 72 65 2e 20 2a 2f 0a 09 75 6e 73 69 67   more. */..unsig
60d0: 6e 65 64 20 6c 6f 6e 67 20 76 61 6c 75 65 3b 0a  ned long value;.
60e0: 20 20 20 20 7d 20 70 74 72 41 6e 64 4c 6f 6e 67      } ptrAndLong
60f0: 52 65 70 3b 0a 20 20 20 20 73 74 72 75 63 74 20  Rep;.    struct 
6100: 7b 09 09 09 2f 2a 20 20 20 2d 20 75 73 65 20 66  {.../*   - use f
6110: 6f 72 20 70 6f 69 6e 74 65 72 20 61 6e 64 20 6c  or pointer and l
6120: 65 6e 67 74 68 20 72 65 70 73 20 2a 2f 0a 09 76  ength reps */..v
6130: 6f 69 64 20 2a 70 74 72 3b 0a 09 54 63 6c 5f 53  oid *ptr;..Tcl_S
6140: 69 7a 65 20 73 69 7a 65 3b 0a 20 20 20 20 7d 20  ize size;.    } 
6150: 70 74 72 41 6e 64 53 69 7a 65 3b 0a 7d 20 54 63  ptrAndSize;.} Tc
6160: 6c 5f 4f 62 6a 49 6e 74 65 72 6e 61 6c 52 65 70  l_ObjInternalRep
6170: 3b 0a 0a 2f 2a 0a 20 2a 20 4f 6e 65 20 6f 66 20  ;../*. * One of 
6180: 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 73 74  the following st
6190: 72 75 63 74 75 72 65 73 20 65 78 69 73 74 73 20  ructures exists 
61a0: 66 6f 72 20 65 61 63 68 20 6f 62 6a 65 63 74 20  for each object 
61b0: 69 6e 20 74 68 65 20 54 63 6c 20 73 79 73 74 65  in the Tcl syste
61c0: 6d 2e 0a 20 2a 20 41 6e 20 6f 62 6a 65 63 74 20  m.. * An object 
61d0: 73 74 6f 72 65 73 20 61 20 76 61 6c 75 65 20 61  stores a value a
61e0: 73 20 65 69 74 68 65 72 20 61 20 73 74 72 69 6e  s either a strin
61f0: 67 2c 20 73 6f 6d 65 20 69 6e 74 65 72 6e 61 6c  g, some internal
6200: 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2c   representation,
6210: 0a 20 2a 20 6f 72 20 62 6f 74 68 2e 0a 20 2a 2f  . * or both.. */
6220: 0a 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 74  ..typedef struct
6230: 20 54 63 6c 5f 4f 62 6a 20 7b 0a 20 20 20 20 54   Tcl_Obj {.    T
6240: 63 6c 5f 53 69 7a 65 20 72 65 66 43 6f 75 6e 74  cl_Size refCount
6250: 3b 09 09 2f 2a 20 57 68 65 6e 20 30 20 74 68 65  ;../* When 0 the
6260: 20 6f 62 6a 65 63 74 20 77 69 6c 6c 20 62 65 20   object will be 
6270: 66 72 65 65 64 2e 20 2a 2f 0a 20 20 20 20 63 68  freed. */.    ch
6280: 61 72 20 2a 62 79 74 65 73 3b 09 09 2f 2a 20 54  ar *bytes;../* T
6290: 68 69 73 20 70 6f 69 6e 74 73 20 74 6f 20 74 68  his points to th
62a0: 65 20 66 69 72 73 74 20 62 79 74 65 20 6f 66 20  e first byte of 
62b0: 74 68 65 0a 09 09 09 09 20 2a 20 6f 62 6a 65 63  the..... * objec
62c0: 74 27 73 20 73 74 72 69 6e 67 20 72 65 70 72 65  t's string repre
62d0: 73 65 6e 74 61 74 69 6f 6e 2e 20 54 68 65 20 61  sentation. The a
62e0: 72 72 61 79 0a 09 09 09 09 20 2a 20 6d 75 73 74  rray..... * must
62f0: 20 62 65 20 66 6f 6c 6c 6f 77 65 64 20 62 79 20   be followed by 
6300: 61 20 6e 75 6c 6c 20 62 79 74 65 20 28 69 2e 65  a null byte (i.e
6310: 2e 2c 20 61 74 0a 09 09 09 09 20 2a 20 6f 66 66  ., at..... * off
6320: 73 65 74 20 6c 65 6e 67 74 68 29 20 62 75 74 20  set length) but 
6330: 6d 61 79 20 61 6c 73 6f 20 63 6f 6e 74 61 69 6e  may also contain
6340: 0a 09 09 09 09 20 2a 20 65 6d 62 65 64 64 65 64  ..... * embedded
6350: 20 6e 75 6c 6c 20 63 68 61 72 61 63 74 65 72 73   null characters
6360: 2e 20 54 68 65 20 61 72 72 61 79 27 73 0a 09 09  . The array's...
6370: 09 09 20 2a 20 73 74 6f 72 61 67 65 20 69 73 20  .. * storage is 
6380: 61 6c 6c 6f 63 61 74 65 64 20 62 79 20 54 63 6c  allocated by Tcl
6390: 5f 41 6c 6c 6f 63 2e 20 4e 55 4c 4c 20 6d 65 61  _Alloc. NULL mea
63a0: 6e 73 0a 09 09 09 09 20 2a 20 74 68 65 20 73 74  ns..... * the st
63b0: 72 69 6e 67 20 72 65 70 20 69 73 20 69 6e 76 61  ring rep is inva
63c0: 6c 69 64 20 61 6e 64 20 6d 75 73 74 20 62 65 0a  lid and must be.
63d0: 09 09 09 09 20 2a 20 72 65 67 65 6e 65 72 61 74  .... * regenerat
63e0: 65 64 20 66 72 6f 6d 20 74 68 65 20 69 6e 74 65  ed from the inte
63f0: 72 6e 61 6c 20 72 65 70 2e 20 20 43 6c 69 65 6e  rnal rep.  Clien
6400: 74 73 0a 09 09 09 09 20 2a 20 73 68 6f 75 6c 64  ts..... * should
6410: 20 75 73 65 20 54 63 6c 5f 47 65 74 53 74 72 69   use Tcl_GetStri
6420: 6e 67 46 72 6f 6d 4f 62 6a 20 6f 72 0a 09 09 09  ngFromObj or....
6430: 09 20 2a 20 54 63 6c 5f 47 65 74 53 74 72 69 6e  . * Tcl_GetStrin
6440: 67 20 74 6f 20 67 65 74 20 61 20 70 6f 69 6e 74  g to get a point
6450: 65 72 20 74 6f 20 74 68 65 20 62 79 74 65 0a 09  er to the byte..
6460: 09 09 09 20 2a 20 61 72 72 61 79 20 61 73 20 61  ... * array as a
6470: 20 72 65 61 64 6f 6e 6c 79 20 76 61 6c 75 65 2e   readonly value.
6480: 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 53 69 7a 65   */.    Tcl_Size
6490: 20 6c 65 6e 67 74 68 3b 09 09 2f 2a 20 54 68 65   length;../* The
64a0: 20 6e 75 6d 62 65 72 20 6f 66 20 62 79 74 65 73   number of bytes
64b0: 20 61 74 20 2a 62 79 74 65 73 2c 20 6e 6f 74 0a   at *bytes, not.
64c0: 09 09 09 09 20 2a 20 69 6e 63 6c 75 64 69 6e 67  .... * including
64d0: 20 74 68 65 20 74 65 72 6d 69 6e 61 74 69 6e 67   the terminating
64e0: 20 6e 75 6c 6c 2e 20 2a 2f 0a 20 20 20 20 63 6f   null. */.    co
64f0: 6e 73 74 20 54 63 6c 5f 4f 62 6a 54 79 70 65 20  nst Tcl_ObjType 
6500: 2a 74 79 70 65 50 74 72 3b 09 2f 2a 20 44 65 6e  *typePtr;./* Den
6510: 6f 74 65 73 20 74 68 65 20 6f 62 6a 65 63 74 27  otes the object'
6520: 73 20 74 79 70 65 2e 20 41 6c 77 61 79 73 0a 09  s type. Always..
6530: 09 09 09 20 2a 20 63 6f 72 72 65 73 70 6f 6e 64  ... * correspond
6540: 73 20 74 6f 20 74 68 65 20 74 79 70 65 20 6f 66  s to the type of
6550: 20 74 68 65 20 6f 62 6a 65 63 74 27 73 0a 09 09   the object's...
6560: 09 09 20 2a 20 69 6e 74 65 72 6e 61 6c 20 72 65  .. * internal re
6570: 70 2e 20 4e 55 4c 4c 20 69 6e 64 69 63 61 74 65  p. NULL indicate
6580: 73 20 74 68 65 20 6f 62 6a 65 63 74 20 68 61 73  s the object has
6590: 0a 09 09 09 09 20 2a 20 6e 6f 20 69 6e 74 65 72  ..... * no inter
65a0: 6e 61 6c 20 72 65 70 20 28 68 61 73 20 6e 6f 20  nal rep (has no 
65b0: 74 79 70 65 29 2e 20 2a 2f 0a 20 20 20 20 54 63  type). */.    Tc
65c0: 6c 5f 4f 62 6a 49 6e 74 65 72 6e 61 6c 52 65 70  l_ObjInternalRep
65d0: 20 69 6e 74 65 72 6e 61 6c 52 65 70 3b 0a 09 09   internalRep;...
65e0: 09 09 2f 2a 20 54 68 65 20 69 6e 74 65 72 6e 61  ../* The interna
65f0: 6c 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e  l representation
6600: 3a 20 2a 2f 0a 7d 20 54 63 6c 5f 4f 62 6a 3b 0a  : */.} Tcl_Obj;.
6610: 0c 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d  ../*. *---------
6620: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
6630: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
6640: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 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 0a 20 2a 20 54 68 65 20 66 6f 6c 6c 6f  ---. * The follo
6670: 77 69 6e 67 20 64 65 66 69 6e 69 74 69 6f 6e 73  wing definitions
6680: 20 73 75 70 70 6f 72 74 20 54 63 6c 27 73 20 6e   support Tcl's n
6690: 61 6d 65 73 70 61 63 65 20 66 61 63 69 6c 69 74  amespace facilit
66a0: 79 2e 20 4e 6f 74 65 3a 20 74 68 65 20 66 69 72  y. Note: the fir
66b0: 73 74 0a 20 2a 20 66 69 76 65 20 66 69 65 6c 64  st. * five field
66c0: 73 20 6d 75 73 74 20 6d 61 74 63 68 20 65 78 61  s must match exa
66d0: 63 74 6c 79 20 74 68 65 20 66 69 65 6c 64 73 20  ctly the fields 
66e0: 69 6e 20 61 20 4e 61 6d 65 73 70 61 63 65 20 73  in a Namespace s
66f0: 74 72 75 63 74 75 72 65 20 28 73 65 65 0a 20 2a  tructure (see. *
6700: 20 74 63 6c 49 6e 74 2e 68 29 2e 0a 20 2a 2f 0a   tclInt.h).. */.
6710: 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20  .typedef struct 
6720: 54 63 6c 5f 4e 61 6d 65 73 70 61 63 65 20 7b 0a  Tcl_Namespace {.
6730: 20 20 20 20 63 68 61 72 20 2a 6e 61 6d 65 3b 09      char *name;.
6740: 09 09 2f 2a 20 54 68 65 20 6e 61 6d 65 73 70 61  ../* The namespa
6750: 63 65 27 73 20 6e 61 6d 65 20 77 69 74 68 69 6e  ce's name within
6760: 20 69 74 73 20 70 61 72 65 6e 74 0a 09 09 09 09   its parent.....
6770: 20 2a 20 6e 61 6d 65 73 70 61 63 65 2e 20 54 68   * namespace. Th
6780: 69 73 20 63 6f 6e 74 61 69 6e 73 20 6e 6f 20 3a  is contains no :
6790: 3a 27 73 2e 20 54 68 65 20 6e 61 6d 65 0a 09 09  :'s. The name...
67a0: 09 09 20 2a 20 6f 66 20 74 68 65 20 67 6c 6f 62  .. * of the glob
67b0: 61 6c 20 6e 61 6d 65 73 70 61 63 65 20 69 73 20  al namespace is 
67c0: 22 22 20 61 6c 74 68 6f 75 67 68 20 22 3a 3a 22  "" although "::"
67d0: 0a 09 09 09 09 20 2a 20 69 73 20 61 6e 20 73 79  ..... * is an sy
67e0: 6e 6f 6e 79 6d 2e 20 2a 2f 0a 20 20 20 20 63 68  nonym. */.    ch
67f0: 61 72 20 2a 66 75 6c 6c 4e 61 6d 65 3b 09 09 2f  ar *fullName;../
6800: 2a 20 54 68 65 20 6e 61 6d 65 73 70 61 63 65 27  * The namespace'
6810: 73 20 66 75 6c 6c 79 20 71 75 61 6c 69 66 69 65  s fully qualifie
6820: 64 20 6e 61 6d 65 2e 20 54 68 69 73 0a 09 09 09  d name. This....
6830: 09 20 2a 20 73 74 61 72 74 73 20 77 69 74 68 20  . * starts with 
6840: 3a 3a 2e 20 2a 2f 0a 20 20 20 20 76 6f 69 64 20  ::. */.    void 
6850: 2a 63 6c 69 65 6e 74 44 61 74 61 3b 09 09 2f 2a  *clientData;../*
6860: 20 41 72 62 69 74 72 61 72 79 20 76 61 6c 75 65   Arbitrary value
6870: 20 61 73 73 6f 63 69 61 74 65 64 20 77 69 74 68   associated with
6880: 20 74 68 69 73 0a 09 09 09 09 20 2a 20 6e 61 6d   this..... * nam
6890: 65 73 70 61 63 65 2e 20 2a 2f 0a 20 20 20 20 54  espace. */.    T
68a0: 63 6c 5f 4e 61 6d 65 73 70 61 63 65 44 65 6c 65  cl_NamespaceDele
68b0: 74 65 50 72 6f 63 20 2a 64 65 6c 65 74 65 50 72  teProc *deletePr
68c0: 6f 63 3b 0a 09 09 09 09 2f 2a 20 46 75 6e 63 74  oc;...../* Funct
68d0: 69 6f 6e 20 69 6e 76 6f 6b 65 64 20 77 68 65 6e  ion invoked when
68e0: 20 64 65 6c 65 74 69 6e 67 20 74 68 65 0a 09 09   deleting the...
68f0: 09 09 20 2a 20 6e 61 6d 65 73 70 61 63 65 20 74  .. * namespace t
6900: 6f 2c 20 65 2e 67 2e 2c 20 66 72 65 65 20 63 6c  o, e.g., free cl
6910: 69 65 6e 74 44 61 74 61 2e 20 2a 2f 0a 20 20 20  ientData. */.   
6920: 20 73 74 72 75 63 74 20 54 63 6c 5f 4e 61 6d 65   struct Tcl_Name
6930: 73 70 61 63 65 20 2a 70 61 72 65 6e 74 50 74 72  space *parentPtr
6940: 3b 0a 09 09 09 09 2f 2a 20 50 6f 69 6e 74 73 20  ;...../* Points 
6950: 74 6f 20 74 68 65 20 6e 61 6d 65 73 70 61 63 65  to the namespace
6960: 20 74 68 61 74 20 63 6f 6e 74 61 69 6e 73 20 74   that contains t
6970: 68 69 73 0a 09 09 09 09 20 2a 20 6f 6e 65 2e 20  his..... * one. 
6980: 4e 55 4c 4c 20 69 66 20 74 68 69 73 20 69 73 20  NULL if this is 
6990: 74 68 65 20 67 6c 6f 62 61 6c 0a 09 09 09 09 20  the global..... 
69a0: 2a 20 6e 61 6d 65 73 70 61 63 65 2e 20 2a 2f 0a  * namespace. */.
69b0: 7d 20 54 63 6c 5f 4e 61 6d 65 73 70 61 63 65 3b  } Tcl_Namespace;
69c0: 0a 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d  ../*. *---------
69d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
69e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
69f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
6a00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
6a10: 2d 2d 2d 0a 20 2a 20 54 68 65 20 66 6f 6c 6c 6f  ---. * The follo
6a20: 77 69 6e 67 20 73 74 72 75 63 74 75 72 65 20 72  wing structure r
6a30: 65 70 72 65 73 65 6e 74 73 20 61 20 63 61 6c 6c  epresents a call
6a40: 20 66 72 61 6d 65 2c 20 6f 72 20 61 63 74 69 76   frame, or activ
6a50: 61 74 69 6f 6e 20 72 65 63 6f 72 64 2e 20 41 0a  ation record. A.
6a60: 20 2a 20 63 61 6c 6c 20 66 72 61 6d 65 20 64 65   * call frame de
6a70: 66 69 6e 65 73 20 61 20 6e 61 6d 69 6e 67 20 63  fines a naming c
6a80: 6f 6e 74 65 78 74 20 66 6f 72 20 61 20 70 72 6f  ontext for a pro
6a90: 63 65 64 75 72 65 20 63 61 6c 6c 3a 20 69 74 73  cedure call: its
6aa0: 20 6c 6f 63 61 6c 20 73 63 6f 70 65 0a 20 2a 20   local scope. * 
6ab0: 28 66 6f 72 20 6c 6f 63 61 6c 20 76 61 72 69 61  (for local varia
6ac0: 62 6c 65 73 29 20 61 6e 64 20 69 74 73 20 6e 61  bles) and its na
6ad0: 6d 65 73 70 61 63 65 20 73 63 6f 70 65 20 28 75  mespace scope (u
6ae0: 73 65 64 20 66 6f 72 20 6e 6f 6e 2d 6c 6f 63 61  sed for non-loca
6af0: 6c 0a 20 2a 20 76 61 72 69 61 62 6c 65 73 3b 20  l. * variables; 
6b00: 6f 66 74 65 6e 20 74 68 65 20 67 6c 6f 62 61 6c  often the global
6b10: 20 3a 3a 20 6e 61 6d 65 73 70 61 63 65 29 2e 20   :: namespace). 
6b20: 41 20 63 61 6c 6c 20 66 72 61 6d 65 20 63 61 6e  A call frame can
6b30: 20 61 6c 73 6f 20 64 65 66 69 6e 65 20 74 68 65   also define the
6b40: 0a 20 2a 20 6e 61 6d 69 6e 67 20 63 6f 6e 74 65  . * naming conte
6b50: 78 74 20 66 6f 72 20 61 20 6e 61 6d 65 73 70 61  xt for a namespa
6b60: 63 65 20 65 76 61 6c 20 6f 72 20 6e 61 6d 65 73  ce eval or names
6b70: 70 61 63 65 20 69 6e 73 63 6f 70 65 20 63 6f 6d  pace inscope com
6b80: 6d 61 6e 64 3a 20 74 68 65 0a 20 2a 20 6e 61 6d  mand: the. * nam
6b90: 65 73 70 61 63 65 20 69 6e 20 77 68 69 63 68 20  espace in which 
6ba0: 74 68 65 20 63 6f 6d 6d 61 6e 64 27 73 20 63 6f  the command's co
6bb0: 64 65 20 73 68 6f 75 6c 64 20 65 78 65 63 75 74  de should execut
6bc0: 65 2e 20 54 68 65 20 54 63 6c 5f 43 61 6c 6c 46  e. The Tcl_CallF
6bd0: 72 61 6d 65 0a 20 2a 20 73 74 72 75 63 74 75 72  rame. * structur
6be0: 65 73 20 65 78 69 73 74 20 6f 6e 6c 79 20 77 68  es exist only wh
6bf0: 69 6c 65 20 70 72 6f 63 65 64 75 72 65 73 20 6f  ile procedures o
6c00: 72 20 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c  r namespace eval
6c10: 2f 69 6e 73 63 6f 70 65 27 73 20 61 72 65 0a 20  /inscope's are. 
6c20: 2a 20 62 65 69 6e 67 20 65 78 65 63 75 74 65 64  * being executed
6c30: 2c 20 61 6e 64 20 70 72 6f 76 69 64 65 20 61 20  , and provide a 
6c40: 54 63 6c 20 63 61 6c 6c 20 73 74 61 63 6b 2e 0a  Tcl call stack..
6c50: 20 2a 0a 20 2a 20 41 20 63 61 6c 6c 20 66 72 61   *. * A call fra
6c60: 6d 65 20 69 73 20 69 6e 69 74 69 61 6c 69 7a 65  me is initialize
6c70: 64 20 61 6e 64 20 70 75 73 68 65 64 20 75 73 69  d and pushed usi
6c80: 6e 67 20 54 63 6c 5f 50 75 73 68 43 61 6c 6c 46  ng Tcl_PushCallF
6c90: 72 61 6d 65 20 61 6e 64 20 70 6f 70 70 65 64 0a  rame and popped.
6ca0: 20 2a 20 75 73 69 6e 67 20 54 63 6c 5f 50 6f 70   * using Tcl_Pop
6cb0: 43 61 6c 6c 46 72 61 6d 65 2e 20 53 74 6f 72 61  CallFrame. Stora
6cc0: 67 65 20 66 6f 72 20 61 20 54 63 6c 5f 43 61 6c  ge for a Tcl_Cal
6cd0: 6c 46 72 61 6d 65 20 6d 75 73 74 20 62 65 20 70  lFrame must be p
6ce0: 72 6f 76 69 64 65 64 20 62 79 20 74 68 65 0a 20  rovided by the. 
6cf0: 2a 20 54 63 6c 5f 50 75 73 68 43 61 6c 6c 46 72  * Tcl_PushCallFr
6d00: 61 6d 65 20 63 61 6c 6c 65 72 2c 20 61 6e 64 20  ame caller, and 
6d10: 63 61 6c 6c 65 72 73 20 74 79 70 69 63 61 6c 6c  callers typicall
6d20: 79 20 61 6c 6c 6f 63 61 74 65 20 74 68 65 6d 20  y allocate them 
6d30: 6f 6e 20 74 68 65 20 43 20 63 61 6c 6c 0a 20 2a  on the C call. *
6d40: 20 73 74 61 63 6b 20 66 6f 72 20 65 66 66 69 63   stack for effic
6d50: 69 65 6e 63 79 2e 20 46 6f 72 20 74 68 69 73 20  iency. For this 
6d60: 72 65 61 73 6f 6e 2c 20 54 63 6c 5f 43 61 6c 6c  reason, Tcl_Call
6d70: 46 72 61 6d 65 20 69 73 20 64 65 66 69 6e 65 64  Frame is defined
6d80: 20 61 73 20 61 0a 20 2a 20 73 74 72 75 63 74 75   as a. * structu
6d90: 72 65 20 61 6e 64 20 6e 6f 74 20 61 73 20 61 6e  re and not as an
6da0: 20 6f 70 61 71 75 65 20 74 6f 6b 65 6e 2e 20 48   opaque token. H
6db0: 6f 77 65 76 65 72 2c 20 6d 6f 73 74 20 54 63 6c  owever, most Tcl
6dc0: 5f 43 61 6c 6c 46 72 61 6d 65 20 66 69 65 6c 64  _CallFrame field
6dd0: 73 0a 20 2a 20 61 72 65 20 68 69 64 64 65 6e 20  s. * are hidden 
6de0: 73 69 6e 63 65 20 61 70 70 6c 69 63 61 74 69 6f  since applicatio
6df0: 6e 73 20 73 68 6f 75 6c 64 20 6e 6f 74 20 61 63  ns should not ac
6e00: 63 65 73 73 20 74 68 65 6d 20 64 69 72 65 63 74  cess them direct
6e10: 6c 79 3b 20 6f 74 68 65 72 73 20 61 72 65 0a 20  ly; others are. 
6e20: 2a 20 64 65 63 6c 61 72 65 64 20 61 73 20 22 64  * declared as "d
6e30: 75 6d 6d 79 58 22 2e 0a 20 2a 0a 20 2a 20 57 41  ummyX".. *. * WA
6e40: 52 4e 49 4e 47 21 21 20 54 68 65 20 73 74 72 75  RNING!! The stru
6e50: 63 74 75 72 65 20 64 65 66 69 6e 69 74 69 6f 6e  cture definition
6e60: 20 6d 75 73 74 20 62 65 20 6b 65 70 74 20 63 6f   must be kept co
6e70: 6e 73 69 73 74 65 6e 74 20 77 69 74 68 20 74 68  nsistent with th
6e80: 65 0a 20 2a 20 43 61 6c 6c 46 72 61 6d 65 20 73  e. * CallFrame s
6e90: 74 72 75 63 74 75 72 65 20 69 6e 20 74 63 6c 49  tructure in tclI
6ea0: 6e 74 2e 68 2e 20 49 66 20 79 6f 75 20 63 68 61  nt.h. If you cha
6eb0: 6e 67 65 20 6f 6e 65 2c 20 63 68 61 6e 67 65 20  nge one, change 
6ec0: 74 68 65 20 6f 74 68 65 72 2e 0a 20 2a 2f 0a 0a  the other.. */..
6ed0: 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20 54  typedef struct T
6ee0: 63 6c 5f 43 61 6c 6c 46 72 61 6d 65 20 7b 0a 20  cl_CallFrame {. 
6ef0: 20 20 20 54 63 6c 5f 4e 61 6d 65 73 70 61 63 65     Tcl_Namespace
6f00: 20 2a 6e 73 50 74 72 3b 09 2f 2a 20 43 75 72 72   *nsPtr;./* Curr
6f10: 65 6e 74 20 6e 61 6d 65 73 70 61 63 65 20 66 6f  ent namespace fo
6f20: 72 20 74 68 65 20 63 61 6c 6c 20 66 72 61 6d 65  r the call frame
6f30: 2e 20 2a 2f 0a 20 20 20 20 69 6e 74 20 64 75 6d  . */.    int dum
6f40: 6d 79 31 3b 0a 20 20 20 20 54 63 6c 5f 53 69 7a  my1;.    Tcl_Siz
6f50: 65 20 64 75 6d 6d 79 32 3b 0a 20 20 20 20 76 6f  e dummy2;.    vo
6f60: 69 64 20 2a 64 75 6d 6d 79 33 3b 0a 20 20 20 20  id *dummy3;.    
6f70: 76 6f 69 64 20 2a 64 75 6d 6d 79 34 3b 0a 20 20  void *dummy4;.  
6f80: 20 20 76 6f 69 64 20 2a 64 75 6d 6d 79 35 3b 0a    void *dummy5;.
6f90: 20 20 20 20 54 63 6c 5f 53 69 7a 65 20 64 75 6d      Tcl_Size dum
6fa0: 6d 79 36 3b 0a 20 20 20 20 76 6f 69 64 20 2a 64  my6;.    void *d
6fb0: 75 6d 6d 79 37 3b 0a 20 20 20 20 76 6f 69 64 20  ummy7;.    void 
6fc0: 2a 64 75 6d 6d 79 38 3b 0a 20 20 20 20 54 63 6c  *dummy8;.    Tcl
6fd0: 5f 53 69 7a 65 20 64 75 6d 6d 79 39 3b 0a 20 20  _Size dummy9;.  
6fe0: 20 20 76 6f 69 64 20 2a 64 75 6d 6d 79 31 30 3b    void *dummy10;
6ff0: 0a 20 20 20 20 76 6f 69 64 20 2a 64 75 6d 6d 79  .    void *dummy
7000: 31 31 3b 0a 20 20 20 20 76 6f 69 64 20 2a 64 75  11;.    void *du
7010: 6d 6d 79 31 32 3b 0a 20 20 20 20 76 6f 69 64 20  mmy12;.    void 
7020: 2a 64 75 6d 6d 79 31 33 3b 0a 7d 20 54 63 6c 5f  *dummy13;.} Tcl_
7030: 43 61 6c 6c 46 72 61 6d 65 3b 0a 0a 2f 2a 0a 20  CallFrame;../*. 
7040: 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  *---------------
7050: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
7060: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
7070: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
7080: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a  -------------. *
7090: 20 49 6e 66 6f 72 6d 61 74 69 6f 6e 20 61 62 6f   Information abo
70a0: 75 74 20 63 6f 6d 6d 61 6e 64 73 20 74 68 61 74  ut commands that
70b0: 20 69 73 20 72 65 74 75 72 6e 65 64 20 62 79 20   is returned by 
70c0: 54 63 6c 5f 47 65 74 43 6f 6d 6d 61 6e 64 49 6e  Tcl_GetCommandIn
70d0: 66 6f 20 61 6e 64 0a 20 2a 20 70 61 73 73 65 64  fo and. * passed
70e0: 20 74 6f 20 54 63 6c 5f 53 65 74 43 6f 6d 6d 61   to Tcl_SetComma
70f0: 6e 64 49 6e 66 6f 2e 20 6f 62 6a 50 72 6f 63 20  ndInfo. objProc 
7100: 69 73 20 61 6e 20 6f 62 6a 63 2f 6f 62 6a 76 20  is an objc/objv 
7110: 6f 62 6a 65 63 74 2d 62 61 73 65 64 20 63 6f 6d  object-based com
7120: 6d 61 6e 64 0a 20 2a 20 66 75 6e 63 74 69 6f 6e  mand. * function
7130: 20 77 68 69 6c 65 20 70 72 6f 63 20 69 73 20 61   while proc is a
7140: 20 74 72 61 64 69 74 69 6f 6e 61 6c 20 54 63 6c   traditional Tcl
7150: 20 61 72 67 63 2f 61 72 67 76 20 73 74 72 69 6e   argc/argv strin
7160: 67 2d 62 61 73 65 64 20 66 75 6e 63 74 69 6f 6e  g-based function
7170: 2e 0a 20 2a 20 54 63 6c 5f 43 72 65 61 74 65 4f  .. * Tcl_CreateO
7180: 62 6a 43 6f 6d 6d 61 6e 64 20 61 6e 64 20 54 63  bjCommand and Tc
7190: 6c 5f 43 72 65 61 74 65 43 6f 6d 6d 61 6e 64 20  l_CreateCommand 
71a0: 65 6e 73 75 72 65 20 74 68 61 74 20 62 6f 74 68  ensure that both
71b0: 20 6f 62 6a 50 72 6f 63 20 61 6e 64 0a 20 2a 20   objProc and. * 
71c0: 70 72 6f 63 20 61 72 65 20 6e 6f 6e 2d 4e 55 4c  proc are non-NUL
71d0: 4c 20 61 6e 64 20 63 61 6e 20 62 65 20 63 61 6c  L and can be cal
71e0: 6c 65 64 20 74 6f 20 65 78 65 63 75 74 65 20 74  led to execute t
71f0: 68 65 20 63 6f 6d 6d 61 6e 64 2e 20 48 6f 77 65  he command. Howe
7200: 76 65 72 2c 20 69 74 20 6d 61 79 0a 20 2a 20 62  ver, it may. * b
7210: 65 20 66 61 73 74 65 72 20 74 6f 20 63 61 6c 6c  e faster to call
7220: 20 6f 6e 65 20 69 6e 73 74 65 61 64 20 6f 66 20   one instead of 
7230: 74 68 65 20 6f 74 68 65 72 2e 20 54 68 65 20 6d  the other. The m
7240: 65 6d 62 65 72 20 69 73 4e 61 74 69 76 65 4f 62  ember isNativeOb
7250: 6a 65 63 74 50 72 6f 63 0a 20 2a 20 69 73 20 73  jectProc. * is s
7260: 65 74 20 74 6f 20 31 20 69 66 20 61 6e 20 6f 62  et to 1 if an ob
7270: 6a 65 63 74 2d 62 61 73 65 64 20 66 75 6e 63 74  ject-based funct
7280: 69 6f 6e 20 77 61 73 20 72 65 67 69 73 74 65 72  ion was register
7290: 65 64 20 62 79 0a 20 2a 20 54 63 6c 5f 43 72 65  ed by. * Tcl_Cre
72a0: 61 74 65 4f 62 6a 43 6f 6d 6d 61 6e 64 2c 20 61  ateObjCommand, a
72b0: 6e 64 20 74 6f 20 30 20 69 66 20 61 20 73 74 72  nd to 0 if a str
72c0: 69 6e 67 2d 62 61 73 65 64 20 66 75 6e 63 74 69  ing-based functi
72d0: 6f 6e 20 77 61 73 20 72 65 67 69 73 74 65 72 65  on was registere
72e0: 64 20 62 79 0a 20 2a 20 54 63 6c 5f 43 72 65 61  d by. * Tcl_Crea
72f0: 74 65 43 6f 6d 6d 61 6e 64 2e 20 54 68 65 20 6f  teCommand. The o
7300: 74 68 65 72 20 66 75 6e 63 74 69 6f 6e 20 69 73  ther function is
7310: 20 74 79 70 69 63 61 6c 6c 79 20 73 65 74 20 74   typically set t
7320: 6f 20 61 20 63 6f 6d 70 61 74 69 62 69 6c 69 74  o a compatibilit
7330: 79 0a 20 2a 20 77 72 61 70 70 65 72 20 74 68 61  y. * wrapper tha
7340: 74 20 64 6f 65 73 20 73 74 72 69 6e 67 2d 74 6f  t does string-to
7350: 2d 6f 62 6a 65 63 74 20 6f 72 20 6f 62 6a 65 63  -object or objec
7360: 74 2d 74 6f 2d 73 74 72 69 6e 67 20 61 72 67 75  t-to-string argu
7370: 6d 65 6e 74 20 63 6f 6e 76 65 72 73 69 6f 6e 73  ment conversions
7380: 0a 20 2a 20 74 68 65 6e 20 63 61 6c 6c 73 20 74  . * then calls t
7390: 68 65 20 6f 74 68 65 72 20 66 75 6e 63 74 69 6f  he other functio
73a0: 6e 2e 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20  n.. */..typedef 
73b0: 73 74 72 75 63 74 20 7b 0a 20 20 20 20 69 6e 74  struct {.    int
73c0: 20 69 73 4e 61 74 69 76 65 4f 62 6a 65 63 74 50   isNativeObjectP
73d0: 72 6f 63 3b 09 2f 2a 20 31 20 69 66 20 6f 62 6a  roc;./* 1 if obj
73e0: 50 72 6f 63 20 77 61 73 20 72 65 67 69 73 74 65  Proc was registe
73f0: 72 65 64 20 62 79 20 61 20 63 61 6c 6c 20 74 6f  red by a call to
7400: 0a 09 09 09 09 20 2a 20 54 63 6c 5f 43 72 65 61  ..... * Tcl_Crea
7410: 74 65 4f 62 6a 43 6f 6d 6d 61 6e 64 3b 20 32 20  teObjCommand; 2 
7420: 69 66 20 6f 62 6a 50 72 6f 63 20 77 61 73 20 72  if objProc was r
7430: 65 67 69 73 74 65 72 65 64 20 62 79 0a 09 09 09  egistered by....
7440: 09 20 2a 20 61 20 63 61 6c 6c 20 74 6f 20 54 63  . * a call to Tc
7450: 6c 5f 43 72 65 61 74 65 4f 62 6a 43 6f 6d 6d 61  l_CreateObjComma
7460: 6e 64 32 3b 20 30 20 6f 74 68 65 72 77 69 73 65  nd2; 0 otherwise
7470: 2e 0a 09 09 09 09 20 2a 20 54 63 6c 5f 53 65 74  ...... * Tcl_Set
7480: 43 6d 64 49 6e 66 6f 20 64 6f 65 73 20 6e 6f 74  CmdInfo does not
7490: 20 6d 6f 64 69 66 79 20 74 68 69 73 20 66 69 65   modify this fie
74a0: 6c 64 2e 20 2a 2f 0a 23 69 66 64 65 66 20 54 43  ld. */.#ifdef TC
74b0: 4c 5f 4e 4f 5f 44 45 50 52 45 43 41 54 45 44 0a  L_NO_DEPRECATED.
74c0: 20 20 20 20 76 6f 69 64 20 2a 6f 62 6a 50 72 6f      void *objPro
74d0: 63 4e 6f 74 55 73 65 64 3b 09 2f 2a 20 43 6f 6d  cNotUsed;./* Com
74e0: 6d 61 6e 64 27 73 20 6f 62 6a 65 63 74 2d 62 61  mand's object-ba
74f0: 73 65 64 20 66 75 6e 63 74 69 6f 6e 2e 20 2a 2f  sed function. */
7500: 0a 20 20 20 20 76 6f 69 64 20 2a 6f 62 6a 43 6c  .    void *objCl
7510: 69 65 6e 74 44 61 74 61 4e 6f 74 55 73 65 64 3b  ientDataNotUsed;
7520: 09 2f 2a 20 43 6c 69 65 6e 74 44 61 74 61 20 66  ./* ClientData f
7530: 6f 72 20 6f 62 6a 65 63 74 20 70 72 6f 63 2e 20  or object proc. 
7540: 2a 2f 0a 23 65 6c 73 65 0a 20 20 20 20 54 63 6c  */.#else.    Tcl
7550: 5f 4f 62 6a 43 6d 64 50 72 6f 63 20 2a 6f 62 6a  _ObjCmdProc *obj
7560: 50 72 6f 63 3b 09 2f 2a 20 43 6f 6d 6d 61 6e 64  Proc;./* Command
7570: 27 73 20 6f 62 6a 65 63 74 2d 62 61 73 65 64 20  's object-based 
7580: 66 75 6e 63 74 69 6f 6e 2e 20 2a 2f 0a 20 20 20  function. */.   
7590: 20 76 6f 69 64 20 2a 6f 62 6a 43 6c 69 65 6e 74   void *objClient
75a0: 44 61 74 61 3b 09 2f 2a 20 43 6c 69 65 6e 74 44  Data;./* ClientD
75b0: 61 74 61 20 66 6f 72 20 6f 62 6a 65 63 74 20 70  ata for object p
75c0: 72 6f 63 2e 20 2a 2f 0a 23 65 6e 64 69 66 0a 20  roc. */.#endif. 
75d0: 20 20 20 54 63 6c 5f 43 6d 64 50 72 6f 63 20 2a     Tcl_CmdProc *
75e0: 70 72 6f 63 3b 09 09 2f 2a 20 43 6f 6d 6d 61 6e  proc;../* Comman
75f0: 64 27 73 20 73 74 72 69 6e 67 2d 62 61 73 65 64  d's string-based
7600: 20 66 75 6e 63 74 69 6f 6e 2e 20 2a 2f 0a 20 20   function. */.  
7610: 20 20 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 61    void *clientDa
7620: 74 61 3b 09 09 2f 2a 20 43 6c 69 65 6e 74 44 61  ta;../* ClientDa
7630: 74 61 20 66 6f 72 20 73 74 72 69 6e 67 20 70 72  ta for string pr
7640: 6f 63 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 43  oc. */.    Tcl_C
7650: 6d 64 44 65 6c 65 74 65 50 72 6f 63 20 2a 64 65  mdDeleteProc *de
7660: 6c 65 74 65 50 72 6f 63 3b 0a 09 09 09 09 2f 2a  leteProc;...../*
7670: 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 63 61 6c   Function to cal
7680: 6c 20 77 68 65 6e 20 63 6f 6d 6d 61 6e 64 20 69  l when command i
7690: 73 0a 09 09 09 09 20 2a 20 64 65 6c 65 74 65 64  s..... * deleted
76a0: 2e 20 2a 2f 0a 20 20 20 20 76 6f 69 64 20 2a 64  . */.    void *d
76b0: 65 6c 65 74 65 44 61 74 61 3b 09 09 2f 2a 20 56  eleteData;../* V
76c0: 61 6c 75 65 20 74 6f 20 70 61 73 73 20 74 6f 20  alue to pass to 
76d0: 64 65 6c 65 74 65 50 72 6f 63 20 28 75 73 75 61  deleteProc (usua
76e0: 6c 6c 79 20 74 68 65 0a 09 09 09 09 20 2a 20 73  lly the..... * s
76f0: 61 6d 65 20 61 73 20 63 6c 69 65 6e 74 44 61 74  ame as clientDat
7700: 61 29 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 4e  a). */.    Tcl_N
7710: 61 6d 65 73 70 61 63 65 20 2a 6e 61 6d 65 73 70  amespace *namesp
7720: 61 63 65 50 74 72 3b 2f 2a 20 50 6f 69 6e 74 73  acePtr;/* Points
7730: 20 74 6f 20 74 68 65 20 6e 61 6d 65 73 70 61 63   to the namespac
7740: 65 20 74 68 61 74 20 63 6f 6e 74 61 69 6e 73 20  e that contains 
7750: 74 68 69 73 0a 09 09 09 09 20 2a 20 63 6f 6d 6d  this..... * comm
7760: 61 6e 64 2e 20 4e 6f 74 65 20 74 68 61 74 20 54  and. Note that T
7770: 63 6c 5f 53 65 74 43 6d 64 49 6e 66 6f 20 77 69  cl_SetCmdInfo wi
7780: 6c 6c 20 6e 6f 74 0a 09 09 09 09 20 2a 20 63 68  ll not..... * ch
7790: 61 6e 67 65 20 61 20 63 6f 6d 6d 61 6e 64 27 73  ange a command's
77a0: 20 6e 61 6d 65 73 70 61 63 65 3b 20 75 73 65 0a   namespace; use.
77b0: 09 09 09 09 20 2a 20 54 63 6c 52 65 6e 61 6d 65  .... * TclRename
77c0: 43 6f 6d 6d 61 6e 64 20 6f 72 20 54 63 6c 5f 45  Command or Tcl_E
77d0: 76 61 6c 20 28 6f 66 20 27 72 65 6e 61 6d 65 27  val (of 'rename'
77e0: 29 0a 09 09 09 09 20 2a 20 74 6f 20 64 6f 20 74  )..... * to do t
77f0: 68 61 74 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f  hat. */.    Tcl_
7800: 4f 62 6a 43 6d 64 50 72 6f 63 32 20 2a 6f 62 6a  ObjCmdProc2 *obj
7810: 50 72 6f 63 32 3b 09 2f 2a 20 43 6f 6d 6d 61 6e  Proc2;./* Comman
7820: 64 27 73 20 6f 62 6a 65 63 74 32 2d 62 61 73 65  d's object2-base
7830: 64 20 66 75 6e 63 74 69 6f 6e 2e 20 2a 2f 0a 20  d function. */. 
7840: 20 20 20 76 6f 69 64 20 2a 6f 62 6a 43 6c 69 65     void *objClie
7850: 6e 74 44 61 74 61 32 3b 09 2f 2a 20 43 6c 69 65  ntData2;./* Clie
7860: 6e 74 44 61 74 61 20 66 6f 72 20 6f 62 6a 65 63  ntData for objec
7870: 74 32 20 70 72 6f 63 2e 20 2a 2f 0a 7d 20 54 63  t2 proc. */.} Tc
7880: 6c 5f 43 6d 64 49 6e 66 6f 3b 0a 0a 2f 2a 0a 20  l_CmdInfo;../*. 
7890: 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  *---------------
78a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
78b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
78c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
78d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a  -------------. *
78e0: 20 54 68 65 20 73 74 72 75 63 74 75 72 65 20 64   The structure d
78f0: 65 66 69 6e 65 64 20 62 65 6c 6f 77 20 69 73 20  efined below is 
7900: 75 73 65 64 20 74 6f 20 68 6f 6c 64 20 64 79 6e  used to hold dyn
7910: 61 6d 69 63 20 73 74 72 69 6e 67 73 2e 20 54 68  amic strings. Th
7920: 65 20 6f 6e 6c 79 0a 20 2a 20 66 69 65 6c 64 73  e only. * fields
7930: 20 74 68 61 74 20 63 6c 69 65 6e 74 73 20 73 68   that clients sh
7940: 6f 75 6c 64 20 75 73 65 20 61 72 65 20 73 74 72  ould use are str
7950: 69 6e 67 20 61 6e 64 20 6c 65 6e 67 74 68 2c 20  ing and length, 
7960: 61 63 63 65 73 73 69 62 6c 65 20 76 69 61 20 74  accessible via t
7970: 68 65 0a 20 2a 20 6d 61 63 72 6f 73 20 54 63 6c  he. * macros Tcl
7980: 5f 44 53 74 72 69 6e 67 56 61 6c 75 65 20 61 6e  _DStringValue an
7990: 64 20 54 63 6c 5f 44 53 74 72 69 6e 67 4c 65 6e  d Tcl_DStringLen
79a0: 67 74 68 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e  gth.. */..#defin
79b0: 65 20 54 43 4c 5f 44 53 54 52 49 4e 47 5f 53 54  e TCL_DSTRING_ST
79c0: 41 54 49 43 5f 53 49 5a 45 20 32 30 30 0a 74 79  ATIC_SIZE 200.ty
79d0: 70 65 64 65 66 20 73 74 72 75 63 74 20 54 63 6c  pedef struct Tcl
79e0: 5f 44 53 74 72 69 6e 67 20 7b 0a 20 20 20 20 63  _DString {.    c
79f0: 68 61 72 20 2a 73 74 72 69 6e 67 3b 09 09 2f 2a  har *string;../*
7a00: 20 50 6f 69 6e 74 73 20 74 6f 20 62 65 67 69 6e   Points to begin
7a10: 6e 69 6e 67 20 6f 66 20 73 74 72 69 6e 67 3a 20  ning of string: 
7a20: 65 69 74 68 65 72 0a 09 09 09 09 20 2a 20 73 74  either..... * st
7a30: 61 74 69 63 53 70 61 63 65 20 62 65 6c 6f 77 20  aticSpace below 
7a40: 6f 72 20 61 20 6d 61 6c 6c 6f 63 65 64 20 61 72  or a malloced ar
7a50: 72 61 79 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f  ray. */.    Tcl_
7a60: 53 69 7a 65 20 6c 65 6e 67 74 68 3b 09 09 2f 2a  Size length;../*
7a70: 20 4e 75 6d 62 65 72 20 6f 66 20 62 79 74 65 73   Number of bytes
7a80: 20 69 6e 20 73 74 72 69 6e 67 20 65 78 63 6c 75   in string exclu
7a90: 64 69 6e 67 0a 09 09 09 09 20 2a 20 74 65 72 6d  ding..... * term
7aa0: 69 6e 61 74 69 6e 67 20 6e 75 6c 20 2a 2f 0a 20  inating nul */. 
7ab0: 20 20 20 54 63 6c 5f 53 69 7a 65 20 73 70 61 63     Tcl_Size spac
7ac0: 65 41 76 6c 3b 09 09 2f 2a 20 54 6f 74 61 6c 20  eAvl;../* Total 
7ad0: 6e 75 6d 62 65 72 20 6f 66 20 62 79 74 65 73 20  number of bytes 
7ae0: 61 76 61 69 6c 61 62 6c 65 20 66 6f 72 20 74 68  available for th
7af0: 65 0a 09 09 09 09 20 2a 20 73 74 72 69 6e 67 20  e..... * string 
7b00: 61 6e 64 20 69 74 73 20 74 65 72 6d 69 6e 61 74  and its terminat
7b10: 69 6e 67 20 4e 55 4c 4c 20 63 68 61 72 2e 20 2a  ing NULL char. *
7b20: 2f 0a 20 20 20 20 63 68 61 72 20 73 74 61 74 69  /.    char stati
7b30: 63 53 70 61 63 65 5b 54 43 4c 5f 44 53 54 52 49  cSpace[TCL_DSTRI
7b40: 4e 47 5f 53 54 41 54 49 43 5f 53 49 5a 45 5d 3b  NG_STATIC_SIZE];
7b50: 0a 09 09 09 09 2f 2a 20 53 70 61 63 65 20 74 6f  ...../* Space to
7b60: 20 75 73 65 20 69 6e 20 63 6f 6d 6d 6f 6e 20 63   use in common c
7b70: 61 73 65 20 77 68 65 72 65 20 73 74 72 69 6e 67  ase where string
7b80: 20 69 73 0a 09 09 09 09 20 2a 20 73 6d 61 6c 6c   is..... * small
7b90: 2e 20 2a 2f 0a 7d 20 54 63 6c 5f 44 53 74 72 69  . */.} Tcl_DStri
7ba0: 6e 67 3b 0a 0a 23 64 65 66 69 6e 65 20 54 63 6c  ng;..#define Tcl
7bb0: 5f 44 53 74 72 69 6e 67 4c 65 6e 67 74 68 28 64  _DStringLength(d
7bc0: 73 50 74 72 29 20 28 28 64 73 50 74 72 29 2d 3e  sPtr) ((dsPtr)->
7bd0: 6c 65 6e 67 74 68 29 0a 23 64 65 66 69 6e 65 20  length).#define 
7be0: 54 63 6c 5f 44 53 74 72 69 6e 67 56 61 6c 75 65  Tcl_DStringValue
7bf0: 28 64 73 50 74 72 29 20 28 28 64 73 50 74 72 29  (dsPtr) ((dsPtr)
7c00: 2d 3e 73 74 72 69 6e 67 29 0a 0a 2f 2a 0a 20 2a  ->string)../*. *
7c10: 20 44 65 66 69 6e 69 74 69 6f 6e 73 20 66 6f 72   Definitions for
7c20: 20 74 68 65 20 6d 61 78 69 6d 75 6d 20 6e 75 6d   the maximum num
7c30: 62 65 72 20 6f 66 20 64 69 67 69 74 73 20 6f 66  ber of digits of
7c40: 20 70 72 65 63 69 73 69 6f 6e 20 74 68 61 74 20   precision that 
7c50: 6d 61 79 20 62 65 0a 20 2a 20 70 72 6f 64 75 63  may be. * produc
7c60: 65 64 20 62 79 20 54 63 6c 5f 50 72 69 6e 74 44  ed by Tcl_PrintD
7c70: 6f 75 62 6c 65 2c 20 61 6e 64 20 74 68 65 20 6e  ouble, and the n
7c80: 75 6d 62 65 72 20 6f 66 20 62 79 74 65 73 20 6f  umber of bytes o
7c90: 66 20 62 75 66 66 65 72 20 73 70 61 63 65 0a 20  f buffer space. 
7ca0: 2a 20 72 65 71 75 69 72 65 64 20 62 79 20 54 63  * required by Tc
7cb0: 6c 5f 50 72 69 6e 74 44 6f 75 62 6c 65 2e 0a 20  l_PrintDouble.. 
7cc0: 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f  */..#define TCL_
7cd0: 4d 41 58 5f 50 52 45 43 09 09 31 37 0a 23 64 65  MAX_PREC..17.#de
7ce0: 66 69 6e 65 20 54 43 4c 5f 44 4f 55 42 4c 45 5f  fine TCL_DOUBLE_
7cf0: 53 50 41 43 45 09 28 54 43 4c 5f 4d 41 58 5f 50  SPACE.(TCL_MAX_P
7d00: 52 45 43 2b 31 30 29 0a 0a 2f 2a 0a 20 2a 20 44  REC+10)../*. * D
7d10: 65 66 69 6e 69 74 69 6f 6e 20 66 6f 72 20 61 20  efinition for a 
7d20: 6e 75 6d 62 65 72 20 6f 66 20 62 79 74 65 73 20  number of bytes 
7d30: 6f 66 20 62 75 66 66 65 72 20 73 70 61 63 65 20  of buffer space 
7d40: 73 75 66 66 69 63 69 65 6e 74 20 74 6f 20 68 6f  sufficient to ho
7d50: 6c 64 20 74 68 65 0a 20 2a 20 73 74 72 69 6e 67  ld the. * string
7d60: 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20   representation 
7d70: 6f 66 20 61 6e 20 69 6e 74 65 67 65 72 20 69 6e  of an integer in
7d80: 20 62 61 73 65 20 31 30 20 28 61 73 73 75 6d 69   base 10 (assumi
7d90: 6e 67 20 74 68 65 20 65 78 69 73 74 65 6e 63 65  ng the existence
7da0: 20 6f 66 0a 20 2a 20 36 34 2d 62 69 74 20 69 6e   of. * 64-bit in
7db0: 74 65 67 65 72 73 29 2e 0a 20 2a 2f 0a 0a 23 64  tegers).. */..#d
7dc0: 65 66 69 6e 65 20 54 43 4c 5f 49 4e 54 45 47 45  efine TCL_INTEGE
7dd0: 52 5f 53 50 41 43 45 09 28 33 2a 28 69 6e 74 29  R_SPACE.(3*(int)
7de0: 73 69 7a 65 6f 66 28 54 63 6c 5f 57 69 64 65 49  sizeof(Tcl_WideI
7df0: 6e 74 29 29 0a 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d  nt))../*. *-----
7e00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
7e10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
7e20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
7e30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
7e40: 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 54 79 70 65 20  -------. * Type 
7e50: 76 61 6c 75 65 73 20 72 65 74 75 72 6e 65 64 20  values returned 
7e60: 62 79 20 54 63 6c 5f 47 65 74 4e 75 6d 62 65 72  by Tcl_GetNumber
7e70: 46 72 6f 6d 4f 62 6a 0a 20 2a 09 54 43 4c 5f 4e  FromObj. *.TCL_N
7e80: 55 4d 42 45 52 5f 49 4e 54 09 09 52 65 70 72 65  UMBER_INT..Repre
7e90: 73 65 6e 74 61 74 69 6f 6e 20 69 73 20 61 20 54  sentation is a T
7ea0: 63 6c 5f 57 69 64 65 49 6e 74 0a 20 2a 09 54 43  cl_WideInt. *.TC
7eb0: 4c 5f 4e 55 4d 42 45 52 5f 42 49 47 09 09 52 65  L_NUMBER_BIG..Re
7ec0: 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 69 73 20  presentation is 
7ed0: 61 6e 20 6d 70 5f 69 6e 74 0a 20 2a 09 54 43 4c  an mp_int. *.TCL
7ee0: 5f 4e 55 4d 42 45 52 5f 44 4f 55 42 4c 45 09 52  _NUMBER_DOUBLE.R
7ef0: 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 69 73  epresentation is
7f00: 20 61 20 64 6f 75 62 6c 65 0a 20 2a 09 54 43 4c   a double. *.TCL
7f10: 5f 4e 55 4d 42 45 52 5f 4e 41 4e 09 09 56 61 6c  _NUMBER_NAN..Val
7f20: 75 65 20 69 73 20 4e 61 4e 2e 0a 20 2a 2f 0a 0a  ue is NaN.. */..
7f30: 23 64 65 66 69 6e 65 20 54 43 4c 5f 4e 55 4d 42  #define TCL_NUMB
7f40: 45 52 5f 49 4e 54 09 09 32 0a 23 64 65 66 69 6e  ER_INT..2.#defin
7f50: 65 20 54 43 4c 5f 4e 55 4d 42 45 52 5f 42 49 47  e TCL_NUMBER_BIG
7f60: 09 09 33 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f  ..3.#define TCL_
7f70: 4e 55 4d 42 45 52 5f 44 4f 55 42 4c 45 09 34 0a  NUMBER_DOUBLE.4.
7f80: 23 64 65 66 69 6e 65 20 54 43 4c 5f 4e 55 4d 42  #define TCL_NUMB
7f90: 45 52 5f 4e 41 4e 09 09 35 0a 0a 2f 2a 0a 20 2a  ER_NAN..5../*. *
7fa0: 20 46 6c 61 67 20 76 61 6c 75 65 73 20 70 61 73   Flag values pas
7fb0: 73 65 64 20 74 6f 20 54 63 6c 5f 43 6f 6e 76 65  sed to Tcl_Conve
7fc0: 72 74 45 6c 65 6d 65 6e 74 2e 0a 20 2a 20 54 43  rtElement.. * TC
7fd0: 4c 5f 44 4f 4e 54 5f 55 53 45 5f 42 52 41 43 45  L_DONT_USE_BRACE
7fe0: 53 20 66 6f 72 63 65 73 20 69 74 20 6e 6f 74 20  S forces it not 
7ff0: 74 6f 20 65 6e 63 6c 6f 73 65 20 74 68 65 20 65  to enclose the e
8000: 6c 65 6d 65 6e 74 20 69 6e 20 62 72 61 63 65 73  lement in braces
8010: 2c 20 62 75 74 20 74 6f 0a 20 2a 09 75 73 65 20  , but to. *.use 
8020: 62 61 63 6b 73 6c 61 73 68 20 71 75 6f 74 69 6e  backslash quotin
8030: 67 20 69 6e 73 74 65 61 64 2e 0a 20 2a 20 54 43  g instead.. * TC
8040: 4c 5f 44 4f 4e 54 5f 51 55 4f 54 45 5f 48 41 53  L_DONT_QUOTE_HAS
8050: 48 20 64 69 73 61 62 6c 65 73 20 74 68 65 20 64  H disables the d
8060: 65 66 61 75 6c 74 20 71 75 6f 74 69 6e 67 20 6f  efault quoting o
8070: 66 20 74 68 65 20 27 23 27 20 63 68 61 72 61 63  f the '#' charac
8080: 74 65 72 2e 20 49 74 0a 20 2a 09 69 73 20 73 61  ter. It. *.is sa
8090: 66 65 20 74 6f 20 6c 65 61 76 65 20 74 68 65 20  fe to leave the 
80a0: 68 61 73 68 20 75 6e 71 75 6f 74 65 64 20 77 68  hash unquoted wh
80b0: 65 6e 20 74 68 65 20 65 6c 65 6d 65 6e 74 20 69  en the element i
80c0: 73 20 6e 6f 74 20 74 68 65 20 66 69 72 73 74 0a  s not the first.
80d0: 20 2a 09 65 6c 65 6d 65 6e 74 20 6f 66 20 61 20   *.element of a 
80e0: 6c 69 73 74 2c 20 61 6e 64 20 74 68 69 73 20 66  list, and this f
80f0: 6c 61 67 20 63 61 6e 20 62 65 20 75 73 65 64 20  lag can be used 
8100: 62 79 20 74 68 65 20 63 61 6c 6c 65 72 20 74 6f  by the caller to
8110: 20 69 6e 64 69 63 61 74 65 0a 20 2a 09 74 68 61   indicate. *.tha
8120: 74 20 63 6f 6e 64 69 74 69 6f 6e 2e 0a 20 2a 2f  t condition.. */
8130: 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 44 4f  ..#define TCL_DO
8140: 4e 54 5f 55 53 45 5f 42 52 41 43 45 53 09 31 0a  NT_USE_BRACES.1.
8150: 23 64 65 66 69 6e 65 20 54 43 4c 5f 44 4f 4e 54  #define TCL_DONT
8160: 5f 51 55 4f 54 45 5f 48 41 53 48 09 38 0a 0a 2f  _QUOTE_HASH.8../
8170: 2a 0a 20 2a 20 46 6c 61 67 73 20 74 68 61 74 20  *. * Flags that 
8180: 6d 61 79 20 62 65 20 70 61 73 73 65 64 20 74 6f  may be passed to
8190: 20 54 63 6c 5f 47 65 74 49 6e 64 65 78 46 72 6f   Tcl_GetIndexFro
81a0: 6d 4f 62 6a 2e 0a 20 2a 20 54 43 4c 5f 45 58 41  mObj.. * TCL_EXA
81b0: 43 54 20 64 69 73 61 6c 6c 6f 77 73 20 61 62 62  CT disallows abb
81c0: 72 65 76 69 61 74 65 64 20 73 74 72 69 6e 67 73  reviated strings
81d0: 2e 0a 20 2a 20 54 43 4c 5f 4e 55 4c 4c 5f 4f 4b  .. * TCL_NULL_OK
81e0: 20 61 6c 6c 6f 77 73 20 74 68 65 20 65 6d 70 74   allows the empt
81f0: 79 20 73 74 72 69 6e 67 20 6f 72 20 4e 55 4c 4c  y string or NULL
8200: 20 74 6f 20 72 65 74 75 72 6e 20 54 43 4c 5f 4f   to return TCL_O
8210: 4b 2e 0a 20 2a 20 20 20 20 20 20 54 68 65 20 72  K.. *      The r
8220: 65 74 75 72 6e 65 64 20 76 61 6c 75 65 20 77 69  eturned value wi
8230: 6c 6c 20 62 65 20 2d 31 3b 0a 20 2a 20 54 43 4c  ll be -1;. * TCL
8240: 5f 49 4e 44 45 58 5f 54 45 4d 50 5f 54 41 42 4c  _INDEX_TEMP_TABL
8250: 45 20 64 69 73 61 6c 6c 6f 77 73 20 63 61 63 68  E disallows cach
8260: 69 6e 67 20 6f 66 20 6c 6f 6f 6b 75 70 73 2e 20  ing of lookups. 
8270: 41 20 70 6f 73 73 69 62 6c 65 20 75 73 65 20 63  A possible use c
8280: 61 73 65 20 69 73 0a 20 2a 20 20 20 20 20 20 61  ase is. *      a
8290: 20 74 61 62 6c 65 20 74 68 61 74 20 77 69 6c 6c   table that will
82a0: 20 6e 6f 74 20 6c 69 76 65 20 6c 6f 6e 67 20 65   not live long e
82b0: 6e 6f 75 67 68 20 74 6f 20 6d 61 6b 65 20 69 74  nough to make it
82c0: 20 77 6f 72 74 68 77 68 69 6c 65 2e 0a 20 2a 2f   worthwhile.. */
82d0: 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 45 58  ..#define TCL_EX
82e0: 41 43 54 09 09 31 0a 23 64 65 66 69 6e 65 20 54  ACT..1.#define T
82f0: 43 4c 5f 4e 55 4c 4c 5f 4f 4b 09 09 33 32 0a 23  CL_NULL_OK..32.#
8300: 64 65 66 69 6e 65 20 54 43 4c 5f 49 4e 44 45 58  define TCL_INDEX
8310: 5f 54 45 4d 50 5f 54 41 42 4c 45 09 36 34 0a 0a  _TEMP_TABLE.64..
8320: 2f 2a 0a 20 2a 20 46 6c 61 67 73 20 74 68 61 74  /*. * Flags that
8330: 20 6d 61 79 20 62 65 20 70 61 73 73 65 64 20 74   may be passed t
8340: 6f 20 54 63 6c 5f 55 6e 69 43 68 61 72 54 6f 55  o Tcl_UniCharToU
8350: 74 66 2e 0a 20 2a 20 54 43 4c 5f 43 4f 4d 42 49  tf.. * TCL_COMBI
8360: 4e 45 20 43 6f 6d 62 69 6e 65 20 73 75 72 72 6f  NE Combine surro
8370: 67 61 74 65 73 0a 20 2a 2f 0a 0a 23 64 65 66 69  gates. */..#defi
8380: 6e 65 20 54 43 4c 5f 43 4f 4d 42 49 4e 45 09 09  ne TCL_COMBINE..
8390: 30 78 31 30 30 30 30 30 30 0a 2f 2a 0a 20 2a 2d  0x1000000./*. *-
83a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
83b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
83c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
83d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
83e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 46  -----------. * F
83f0: 6c 61 67 20 76 61 6c 75 65 73 20 70 61 73 73 65  lag values passe
8400: 64 20 74 6f 20 54 63 6c 5f 52 65 63 6f 72 64 41  d to Tcl_RecordA
8410: 6e 64 45 76 61 6c 2c 20 54 63 6c 5f 45 76 61 6c  ndEval, Tcl_Eval
8420: 4f 62 6a 2c 20 54 63 6c 5f 45 76 61 6c 4f 62 6a  Obj, Tcl_EvalObj
8430: 76 2e 0a 20 2a 20 57 41 52 4e 49 4e 47 3a 20 74  v.. * WARNING: t
8440: 68 65 73 65 20 62 69 74 20 63 68 6f 69 63 65 73  hese bit choices
8450: 20 6d 75 73 74 20 6e 6f 74 20 63 6f 6e 66 6c 69   must not confli
8460: 63 74 20 77 69 74 68 20 74 68 65 20 62 69 74 20  ct with the bit 
8470: 63 68 6f 69 63 65 73 20 66 6f 72 0a 20 2a 20 65  choices for. * e
8480: 76 61 6c 46 6c 61 67 20 62 69 74 73 20 69 6e 20  valFlag bits in 
8490: 74 63 6c 49 6e 74 2e 68 21 0a 20 2a 0a 20 2a 20  tclInt.h!. *. * 
84a0: 4d 65 61 6e 69 6e 67 73 3a 0a 20 2a 09 54 43 4c  Meanings:. *.TCL
84b0: 5f 4e 4f 5f 45 56 41 4c 3a 09 09 4a 75 73 74 20  _NO_EVAL:..Just 
84c0: 72 65 63 6f 72 64 20 74 68 69 73 20 63 6f 6d 6d  record this comm
84d0: 61 6e 64 0a 20 2a 09 54 43 4c 5f 45 56 41 4c 5f  and. *.TCL_EVAL_
84e0: 47 4c 4f 42 41 4c 3a 09 45 78 65 63 75 74 65 20  GLOBAL:.Execute 
84f0: 73 63 72 69 70 74 20 69 6e 20 67 6c 6f 62 61 6c  script in global
8500: 20 6e 61 6d 65 73 70 61 63 65 0a 20 2a 09 54 43   namespace. *.TC
8510: 4c 5f 45 56 41 4c 5f 44 49 52 45 43 54 3a 09 44  L_EVAL_DIRECT:.D
8520: 6f 20 6e 6f 74 20 63 6f 6d 70 69 6c 65 20 74 68  o not compile th
8530: 69 73 20 73 63 72 69 70 74 0a 20 2a 09 54 43 4c  is script. *.TCL
8540: 5f 45 56 41 4c 5f 49 4e 56 4f 4b 45 3a 09 4d 61  _EVAL_INVOKE:.Ma
8550: 67 69 63 61 6c 20 54 63 6c 5f 45 76 61 6c 4f 62  gical Tcl_EvalOb
8560: 6a 76 20 6d 6f 64 65 20 66 6f 72 20 61 6c 69 61  jv mode for alia
8570: 73 65 73 2f 65 6e 73 65 6d 62 6c 65 73 0a 20 2a  ses/ensembles. *
8580: 09 09 09 09 6f 20 52 75 6e 20 69 6e 20 69 50 74  ....o Run in iPt
8590: 72 2d 3e 6c 6f 6f 6b 75 70 4e 73 50 74 72 20 6f  r->lookupNsPtr o
85a0: 72 20 67 6c 6f 62 61 6c 20 6e 61 6d 65 73 70 61  r global namespa
85b0: 63 65 0a 20 2a 09 09 09 09 6f 20 43 75 74 20 6f  ce. *....o Cut o
85c0: 75 74 20 6f 66 20 65 72 72 6f 72 20 74 72 61 63  ut of error trac
85d0: 65 73 0a 20 2a 09 09 09 09 6f 20 44 6f 6e 27 74  es. *....o Don't
85e0: 20 72 65 73 65 74 20 74 68 65 20 66 6c 61 67 73   reset the flags
85f0: 20 63 6f 6e 74 72 6f 6c 6c 69 6e 67 20 65 6e 73   controlling ens
8600: 65 6d 62 6c 65 0a 20 2a 09 09 09 09 20 20 65 72  emble. *....  er
8610: 72 6f 72 20 6d 65 73 73 61 67 65 20 72 65 77 72  ror message rewr
8620: 69 74 69 6e 67 2e 0a 20 2a 09 54 43 4c 5f 43 41  iting.. *.TCL_CA
8630: 4e 43 45 4c 5f 55 4e 57 49 4e 44 3a 09 4d 61 67  NCEL_UNWIND:.Mag
8640: 69 63 61 6c 20 54 63 6c 5f 43 61 6e 63 65 6c 45  ical Tcl_CancelE
8650: 76 61 6c 20 6d 6f 64 65 20 74 68 61 74 20 63 61  val mode that ca
8660: 75 73 65 73 20 74 68 65 0a 20 2a 09 09 09 09 73  uses the. *....s
8670: 74 61 63 6b 20 66 6f 72 20 74 68 65 20 73 63 72  tack for the scr
8680: 69 70 74 20 69 6e 20 70 72 6f 67 72 65 73 73 20  ipt in progress 
8690: 74 6f 20 62 65 0a 20 2a 09 09 09 09 63 6f 6d 70  to be. *....comp
86a0: 6c 65 74 65 6c 79 20 75 6e 77 6f 75 6e 64 2e 0a  letely unwound..
86b0: 20 2a 09 54 43 4c 5f 45 56 41 4c 5f 4e 4f 45 52   *.TCL_EVAL_NOER
86c0: 52 3a 09 09 44 6f 20 6e 6f 20 65 78 63 65 70 74  R:..Do no except
86d0: 69 6f 6e 20 72 65 70 6f 72 74 69 6e 67 20 61 74  ion reporting at
86e0: 20 61 6c 6c 2c 20 6a 75 73 74 20 72 65 74 75 72   all, just retur
86f0: 6e 0a 20 2a 09 09 09 09 61 73 20 74 68 65 20 63  n. *....as the c
8700: 61 6c 6c 65 72 20 77 69 6c 6c 20 72 65 70 6f 72  aller will repor
8710: 74 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20  t.. */..#define 
8720: 54 43 4c 5f 4e 4f 5f 45 56 41 4c 09 09 30 78 30  TCL_NO_EVAL..0x0
8730: 31 30 30 30 30 0a 23 64 65 66 69 6e 65 20 54 43  10000.#define TC
8740: 4c 5f 45 56 41 4c 5f 47 4c 4f 42 41 4c 09 09 30  L_EVAL_GLOBAL..0
8750: 78 30 32 30 30 30 30 0a 23 64 65 66 69 6e 65 20  x020000.#define 
8760: 54 43 4c 5f 45 56 41 4c 5f 44 49 52 45 43 54 09  TCL_EVAL_DIRECT.
8770: 09 30 78 30 34 30 30 30 30 0a 23 64 65 66 69 6e  .0x040000.#defin
8780: 65 20 54 43 4c 5f 45 56 41 4c 5f 49 4e 56 4f 4b  e TCL_EVAL_INVOK
8790: 45 09 09 30 78 30 38 30 30 30 30 0a 23 64 65 66  E..0x080000.#def
87a0: 69 6e 65 20 54 43 4c 5f 43 41 4e 43 45 4c 5f 55  ine TCL_CANCEL_U
87b0: 4e 57 49 4e 44 09 30 78 31 30 30 30 30 30 0a 23  NWIND.0x100000.#
87c0: 64 65 66 69 6e 65 20 54 43 4c 5f 45 56 41 4c 5f  define TCL_EVAL_
87d0: 4e 4f 45 52 52 09 09 30 78 32 30 30 30 30 30 0a  NOERR..0x200000.
87e0: 0a 2f 2a 0a 20 2a 20 53 70 65 63 69 61 6c 20 66  ./*. * Special f
87f0: 72 65 65 50 72 6f 63 20 76 61 6c 75 65 73 20 74  reeProc values t
8800: 68 61 74 20 6d 61 79 20 62 65 20 70 61 73 73 65  hat may be passe
8810: 64 20 74 6f 20 54 63 6c 5f 53 65 74 52 65 73 75  d to Tcl_SetResu
8820: 6c 74 20 28 73 65 65 20 74 68 65 20 6d 61 6e 0a  lt (see the man.
8830: 20 2a 20 70 61 67 65 20 66 6f 72 20 64 65 74 61   * page for deta
8840: 69 6c 73 29 3a 0a 20 2a 2f 0a 0a 23 64 65 66 69  ils):. */..#defi
8850: 6e 65 20 54 43 4c 5f 56 4f 4c 41 54 49 4c 45 09  ne TCL_VOLATILE.
8860: 09 28 28 54 63 6c 5f 46 72 65 65 50 72 6f 63 20  .((Tcl_FreeProc 
8870: 2a 29 20 31 29 0a 23 64 65 66 69 6e 65 20 54 43  *) 1).#define TC
8880: 4c 5f 53 54 41 54 49 43 09 09 28 28 54 63 6c 5f  L_STATIC..((Tcl_
8890: 46 72 65 65 50 72 6f 63 20 2a 29 20 30 29 0a 23  FreeProc *) 0).#
88a0: 64 65 66 69 6e 65 20 54 43 4c 5f 44 59 4e 41 4d  define TCL_DYNAM
88b0: 49 43 09 09 28 28 54 63 6c 5f 46 72 65 65 50 72  IC..((Tcl_FreePr
88c0: 6f 63 20 2a 29 20 33 29 0a 0a 2f 2a 0a 20 2a 20  oc *) 3)../*. * 
88d0: 46 6c 61 67 20 76 61 6c 75 65 73 20 70 61 73 73  Flag values pass
88e0: 65 64 20 74 6f 20 76 61 72 69 61 62 6c 65 2d 72  ed to variable-r
88f0: 65 6c 61 74 65 64 20 66 75 6e 63 74 69 6f 6e 73  elated functions
8900: 2e 0a 20 2a 20 57 41 52 4e 49 4e 47 3a 20 74 68  .. * WARNING: th
8910: 65 73 65 20 62 69 74 20 63 68 6f 69 63 65 73 20  ese bit choices 
8920: 6d 75 73 74 20 6e 6f 74 20 63 6f 6e 66 6c 69 63  must not conflic
8930: 74 20 77 69 74 68 20 74 68 65 20 62 69 74 20 63  t with the bit c
8940: 68 6f 69 63 65 20 66 6f 72 0a 20 2a 20 54 43 4c  hoice for. * TCL
8950: 5f 43 41 4e 43 45 4c 5f 55 4e 57 49 4e 44 2c 20  _CANCEL_UNWIND, 
8960: 61 62 6f 76 65 2e 0a 20 2a 2f 0a 0a 23 64 65 66  above.. */..#def
8970: 69 6e 65 20 54 43 4c 5f 47 4c 4f 42 41 4c 5f 4f  ine TCL_GLOBAL_O
8980: 4e 4c 59 09 09 20 31 0a 23 64 65 66 69 6e 65 20  NLY.. 1.#define 
8990: 54 43 4c 5f 4e 41 4d 45 53 50 41 43 45 5f 4f 4e  TCL_NAMESPACE_ON
89a0: 4c 59 09 20 32 0a 23 64 65 66 69 6e 65 20 54 43  LY. 2.#define TC
89b0: 4c 5f 41 50 50 45 4e 44 5f 56 41 4c 55 45 09 20  L_APPEND_VALUE. 
89c0: 34 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4c 49  4.#define TCL_LI
89d0: 53 54 5f 45 4c 45 4d 45 4e 54 09 20 38 0a 23 64  ST_ELEMENT. 8.#d
89e0: 65 66 69 6e 65 20 54 43 4c 5f 54 52 41 43 45 5f  efine TCL_TRACE_
89f0: 52 45 41 44 53 09 09 20 30 78 31 30 0a 23 64 65  READS.. 0x10.#de
8a00: 66 69 6e 65 20 54 43 4c 5f 54 52 41 43 45 5f 57  fine TCL_TRACE_W
8a10: 52 49 54 45 53 09 20 30 78 32 30 0a 23 64 65 66  RITES. 0x20.#def
8a20: 69 6e 65 20 54 43 4c 5f 54 52 41 43 45 5f 55 4e  ine TCL_TRACE_UN
8a30: 53 45 54 53 09 20 30 78 34 30 0a 23 64 65 66 69  SETS. 0x40.#defi
8a40: 6e 65 20 54 43 4c 5f 54 52 41 43 45 5f 44 45 53  ne TCL_TRACE_DES
8a50: 54 52 4f 59 45 44 09 20 30 78 38 30 0a 0a 23 64  TROYED. 0x80..#d
8a60: 65 66 69 6e 65 20 54 43 4c 5f 4c 45 41 56 45 5f  efine TCL_LEAVE_
8a70: 45 52 52 5f 4d 53 47 09 20 30 78 32 30 30 0a 23  ERR_MSG. 0x200.#
8a80: 64 65 66 69 6e 65 20 54 43 4c 5f 54 52 41 43 45  define TCL_TRACE
8a90: 5f 41 52 52 41 59 09 09 20 30 78 38 30 30 0a 2f  _ARRAY.. 0x800./
8aa0: 2a 20 49 6e 64 69 63 61 74 65 20 74 68 65 20 73  * Indicate the s
8ab0: 65 6d 61 6e 74 69 63 73 20 6f 66 20 74 68 65 20  emantics of the 
8ac0: 72 65 73 75 6c 74 20 6f 66 20 61 20 74 72 61 63  result of a trac
8ad0: 65 2e 20 2a 2f 0a 23 64 65 66 69 6e 65 20 54 43  e. */.#define TC
8ae0: 4c 5f 54 52 41 43 45 5f 52 45 53 55 4c 54 5f 44  L_TRACE_RESULT_D
8af0: 59 4e 41 4d 49 43 20 30 78 38 30 30 30 0a 23 64  YNAMIC 0x8000.#d
8b00: 65 66 69 6e 65 20 54 43 4c 5f 54 52 41 43 45 5f  efine TCL_TRACE_
8b10: 52 45 53 55 4c 54 5f 4f 42 4a 45 43 54 20 20 30  RESULT_OBJECT  0
8b20: 78 31 30 30 30 30 0a 0a 2f 2a 0a 20 2a 20 46 6c  x10000../*. * Fl
8b30: 61 67 20 76 61 6c 75 65 73 20 66 6f 72 20 65 6e  ag values for en
8b40: 73 65 6d 62 6c 65 20 63 6f 6d 6d 61 6e 64 73 2e  semble commands.
8b50: 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43  . */..#define TC
8b60: 4c 5f 45 4e 53 45 4d 42 4c 45 5f 50 52 45 46 49  L_ENSEMBLE_PREFI
8b70: 58 20 30 78 30 32 2f 2a 20 46 6c 61 67 20 76 61  X 0x02/* Flag va
8b80: 6c 75 65 20 74 6f 20 73 61 79 20 77 68 65 74 68  lue to say wheth
8b90: 65 72 20 74 6f 20 61 6c 6c 6f 77 0a 09 09 09 09  er to allow.....
8ba0: 20 2a 20 75 6e 61 6d 62 69 67 75 6f 75 73 20 70   * unambiguous p
8bb0: 72 65 66 69 78 65 73 20 6f 66 20 63 6f 6d 6d 61  refixes of comma
8bc0: 6e 64 73 20 6f 72 20 74 6f 0a 09 09 09 09 20 2a  nds or to..... *
8bd0: 20 72 65 71 75 69 72 65 20 65 78 61 63 74 20 6d   require exact m
8be0: 61 74 63 68 65 73 20 66 6f 72 20 63 6f 6d 6d 61  atches for comma
8bf0: 6e 64 20 6e 61 6d 65 73 2e 20 2a 2f 0a 0a 2f 2a  nd names. */../*
8c00: 0a 20 2a 20 46 6c 61 67 20 76 61 6c 75 65 73 20  . * Flag values 
8c10: 70 61 73 73 65 64 20 74 6f 20 63 6f 6d 6d 61 6e  passed to comman
8c20: 64 2d 72 65 6c 61 74 65 64 20 66 75 6e 63 74 69  d-related functi
8c30: 6f 6e 73 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e  ons.. */..#defin
8c40: 65 20 54 43 4c 5f 54 52 41 43 45 5f 52 45 4e 41  e TCL_TRACE_RENA
8c50: 4d 45 09 30 78 32 30 30 30 0a 23 64 65 66 69 6e  ME.0x2000.#defin
8c60: 65 20 54 43 4c 5f 54 52 41 43 45 5f 44 45 4c 45  e TCL_TRACE_DELE
8c70: 54 45 09 30 78 34 30 30 30 0a 0a 23 64 65 66 69  TE.0x4000..#defi
8c80: 6e 65 20 54 43 4c 5f 41 4c 4c 4f 57 5f 49 4e 4c  ne TCL_ALLOW_INL
8c90: 49 4e 45 5f 43 4f 4d 50 49 4c 41 54 49 4f 4e 20  INE_COMPILATION 
8ca0: 30 78 32 30 30 30 30 0a 0a 2f 2a 0a 20 2a 20 54  0x20000../*. * T
8cb0: 79 70 65 73 20 66 6f 72 20 6c 69 6e 6b 65 64 20  ypes for linked 
8cc0: 76 61 72 69 61 62 6c 65 73 3a 0a 20 2a 2f 0a 0a  variables:. */..
8cd0: 23 64 65 66 69 6e 65 20 54 43 4c 5f 4c 49 4e 4b  #define TCL_LINK
8ce0: 5f 49 4e 54 09 09 31 0a 23 64 65 66 69 6e 65 20  _INT..1.#define 
8cf0: 54 43 4c 5f 4c 49 4e 4b 5f 44 4f 55 42 4c 45 09  TCL_LINK_DOUBLE.
8d00: 09 32 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4c  .2.#define TCL_L
8d10: 49 4e 4b 5f 42 4f 4f 4c 45 41 4e 09 33 0a 23 64  INK_BOOLEAN.3.#d
8d20: 65 66 69 6e 65 20 54 43 4c 5f 4c 49 4e 4b 5f 53  efine TCL_LINK_S
8d30: 54 52 49 4e 47 09 09 34 0a 23 64 65 66 69 6e 65  TRING..4.#define
8d40: 20 54 43 4c 5f 4c 49 4e 4b 5f 57 49 44 45 5f 49   TCL_LINK_WIDE_I
8d50: 4e 54 09 35 0a 23 64 65 66 69 6e 65 20 54 43 4c  NT.5.#define TCL
8d60: 5f 4c 49 4e 4b 5f 43 48 41 52 09 09 36 0a 23 64  _LINK_CHAR..6.#d
8d70: 65 66 69 6e 65 20 54 43 4c 5f 4c 49 4e 4b 5f 55  efine TCL_LINK_U
8d80: 43 48 41 52 09 09 37 0a 23 64 65 66 69 6e 65 20  CHAR..7.#define 
8d90: 54 43 4c 5f 4c 49 4e 4b 5f 53 48 4f 52 54 09 09  TCL_LINK_SHORT..
8da0: 38 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4c 49  8.#define TCL_LI
8db0: 4e 4b 5f 55 53 48 4f 52 54 09 09 39 0a 23 64 65  NK_USHORT..9.#de
8dc0: 66 69 6e 65 20 54 43 4c 5f 4c 49 4e 4b 5f 55 49  fine TCL_LINK_UI
8dd0: 4e 54 09 09 31 30 0a 23 64 65 66 69 6e 65 20 54  NT..10.#define T
8de0: 43 4c 5f 4c 49 4e 4b 5f 4c 4f 4e 47 09 09 28 28  CL_LINK_LONG..((
8df0: 73 69 7a 65 6f 66 28 6c 6f 6e 67 29 20 21 3d 20  sizeof(long) != 
8e00: 73 69 7a 65 6f 66 28 69 6e 74 29 29 20 3f 20 54  sizeof(int)) ? T
8e10: 43 4c 5f 4c 49 4e 4b 5f 57 49 44 45 5f 49 4e 54  CL_LINK_WIDE_INT
8e20: 20 3a 20 54 43 4c 5f 4c 49 4e 4b 5f 49 4e 54 29   : TCL_LINK_INT)
8e30: 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4c 49 4e  .#define TCL_LIN
8e40: 4b 5f 55 4c 4f 4e 47 09 09 28 28 73 69 7a 65 6f  K_ULONG..((sizeo
8e50: 66 28 6c 6f 6e 67 29 20 21 3d 20 73 69 7a 65 6f  f(long) != sizeo
8e60: 66 28 69 6e 74 29 29 20 3f 20 54 43 4c 5f 4c 49  f(int)) ? TCL_LI
8e70: 4e 4b 5f 57 49 44 45 5f 55 49 4e 54 20 3a 20 54  NK_WIDE_UINT : T
8e80: 43 4c 5f 4c 49 4e 4b 5f 55 49 4e 54 29 0a 23 64  CL_LINK_UINT).#d
8e90: 65 66 69 6e 65 20 54 43 4c 5f 4c 49 4e 4b 5f 46  efine TCL_LINK_F
8ea0: 4c 4f 41 54 09 09 31 33 0a 23 64 65 66 69 6e 65  LOAT..13.#define
8eb0: 20 54 43 4c 5f 4c 49 4e 4b 5f 57 49 44 45 5f 55   TCL_LINK_WIDE_U
8ec0: 49 4e 54 09 31 34 0a 23 64 65 66 69 6e 65 20 54  INT.14.#define T
8ed0: 43 4c 5f 4c 49 4e 4b 5f 43 48 41 52 53 09 09 31  CL_LINK_CHARS..1
8ee0: 35 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4c 49  5.#define TCL_LI
8ef0: 4e 4b 5f 42 49 4e 41 52 59 09 09 31 36 0a 23 64  NK_BINARY..16.#d
8f00: 65 66 69 6e 65 20 54 43 4c 5f 4c 49 4e 4b 5f 52  efine TCL_LINK_R
8f10: 45 41 44 5f 4f 4e 4c 59 09 30 78 38 30 0a 0a 2f  EAD_ONLY.0x80../
8f20: 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  *. *------------
8f30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
8f40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
8f50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
8f60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
8f70: 0a 20 2a 20 46 6f 72 77 61 72 64 20 64 65 63 6c  . * Forward decl
8f80: 61 72 61 74 69 6f 6e 73 20 6f 66 20 54 63 6c 5f  arations of Tcl_
8f90: 48 61 73 68 54 61 62 6c 65 20 61 6e 64 20 72 65  HashTable and re
8fa0: 6c 61 74 65 64 20 74 79 70 65 73 2e 0a 20 2a 2f  lated types.. */
8fb0: 0a 0a 23 69 66 20 21 64 65 66 69 6e 65 64 28 54  ..#if !defined(T
8fc0: 43 4c 5f 48 41 53 48 5f 54 59 50 45 29 20 26 26  CL_HASH_TYPE) &&
8fd0: 20 21 64 65 66 69 6e 65 64 20 28 54 43 4c 5f 4e   !defined (TCL_N
8fe0: 4f 5f 44 45 50 52 45 43 41 54 45 44 29 0a 23 20  O_DEPRECATED).# 
8ff0: 20 20 64 65 66 69 6e 65 20 54 43 4c 5f 48 41 53    define TCL_HAS
9000: 48 5f 54 59 50 45 20 73 69 7a 65 5f 74 0a 23 65  H_TYPE size_t.#e
9010: 6e 64 69 66 0a 0a 74 79 70 65 64 65 66 20 73 74  ndif..typedef st
9020: 72 75 63 74 20 54 63 6c 5f 48 61 73 68 4b 65 79  ruct Tcl_HashKey
9030: 54 79 70 65 20 54 63 6c 5f 48 61 73 68 4b 65 79  Type Tcl_HashKey
9040: 54 79 70 65 3b 0a 74 79 70 65 64 65 66 20 73 74  Type;.typedef st
9050: 72 75 63 74 20 54 63 6c 5f 48 61 73 68 54 61 62  ruct Tcl_HashTab
9060: 6c 65 20 54 63 6c 5f 48 61 73 68 54 61 62 6c 65  le Tcl_HashTable
9070: 3b 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 74  ;.typedef struct
9080: 20 54 63 6c 5f 48 61 73 68 45 6e 74 72 79 20 54   Tcl_HashEntry T
9090: 63 6c 5f 48 61 73 68 45 6e 74 72 79 3b 0a 0a 74  cl_HashEntry;..t
90a0: 79 70 65 64 65 66 20 73 69 7a 65 5f 74 20 28 54  ypedef size_t (T
90b0: 63 6c 5f 48 61 73 68 4b 65 79 50 72 6f 63 29 20  cl_HashKeyProc) 
90c0: 28 54 63 6c 5f 48 61 73 68 54 61 62 6c 65 20 2a  (Tcl_HashTable *
90d0: 74 61 62 6c 65 50 74 72 2c 20 76 6f 69 64 20 2a  tablePtr, void *
90e0: 6b 65 79 50 74 72 29 3b 0a 74 79 70 65 64 65 66  keyPtr);.typedef
90f0: 20 69 6e 74 20 28 54 63 6c 5f 43 6f 6d 70 61 72   int (Tcl_Compar
9100: 65 48 61 73 68 4b 65 79 73 50 72 6f 63 29 20 28  eHashKeysProc) (
9110: 76 6f 69 64 20 2a 6b 65 79 50 74 72 2c 20 54 63  void *keyPtr, Tc
9120: 6c 5f 48 61 73 68 45 6e 74 72 79 20 2a 68 50 74  l_HashEntry *hPt
9130: 72 29 3b 0a 74 79 70 65 64 65 66 20 54 63 6c 5f  r);.typedef Tcl_
9140: 48 61 73 68 45 6e 74 72 79 20 2a 20 28 54 63 6c  HashEntry * (Tcl
9150: 5f 41 6c 6c 6f 63 48 61 73 68 45 6e 74 72 79 50  _AllocHashEntryP
9160: 72 6f 63 29 20 28 54 63 6c 5f 48 61 73 68 54 61  roc) (Tcl_HashTa
9170: 62 6c 65 20 2a 74 61 62 6c 65 50 74 72 2c 0a 09  ble *tablePtr,..
9180: 76 6f 69 64 20 2a 6b 65 79 50 74 72 29 3b 0a 74  void *keyPtr);.t
9190: 79 70 65 64 65 66 20 76 6f 69 64 20 28 54 63 6c  ypedef void (Tcl
91a0: 5f 46 72 65 65 48 61 73 68 45 6e 74 72 79 50 72  _FreeHashEntryPr
91b0: 6f 63 29 20 28 54 63 6c 5f 48 61 73 68 45 6e 74  oc) (Tcl_HashEnt
91c0: 72 79 20 2a 68 50 74 72 29 3b 0a 0a 2f 2a 0a 20  ry *hPtr);../*. 
91d0: 2a 20 53 74 72 75 63 74 75 72 65 20 64 65 66 69  * Structure defi
91e0: 6e 69 74 69 6f 6e 20 66 6f 72 20 61 6e 20 65 6e  nition for an en
91f0: 74 72 79 20 69 6e 20 61 20 68 61 73 68 20 74 61  try in a hash ta
9200: 62 6c 65 2e 20 4e 6f 2d 6f 6e 65 20 6f 75 74 73  ble. No-one outs
9210: 69 64 65 20 54 63 6c 0a 20 2a 20 73 68 6f 75 6c  ide Tcl. * shoul
9220: 64 20 61 63 63 65 73 73 20 61 6e 79 20 6f 66 20  d access any of 
9230: 74 68 65 73 65 20 66 69 65 6c 64 73 20 64 69 72  these fields dir
9240: 65 63 74 6c 79 3b 20 75 73 65 20 74 68 65 20 6d  ectly; use the m
9250: 61 63 72 6f 73 20 64 65 66 69 6e 65 64 20 62 65  acros defined be
9260: 6c 6f 77 2e 0a 20 2a 2f 0a 0a 73 74 72 75 63 74  low.. */..struct
9270: 20 54 63 6c 5f 48 61 73 68 45 6e 74 72 79 20 7b   Tcl_HashEntry {
9280: 0a 20 20 20 20 54 63 6c 5f 48 61 73 68 45 6e 74  .    Tcl_HashEnt
9290: 72 79 20 2a 6e 65 78 74 50 74 72 3b 09 2f 2a 20  ry *nextPtr;./* 
92a0: 50 6f 69 6e 74 65 72 20 74 6f 20 6e 65 78 74 20  Pointer to next 
92b0: 65 6e 74 72 79 20 69 6e 20 74 68 69 73 20 68 61  entry in this ha
92c0: 73 68 20 62 75 63 6b 65 74 2c 0a 09 09 09 09 20  sh bucket,..... 
92d0: 2a 20 6f 72 20 4e 55 4c 4c 20 66 6f 72 20 65 6e  * or NULL for en
92e0: 64 20 6f 66 20 63 68 61 69 6e 2e 20 2a 2f 0a 20  d of chain. */. 
92f0: 20 20 20 54 63 6c 5f 48 61 73 68 54 61 62 6c 65     Tcl_HashTable
9300: 20 2a 74 61 62 6c 65 50 74 72 3b 09 2f 2a 20 50   *tablePtr;./* P
9310: 6f 69 6e 74 65 72 20 74 6f 20 74 61 62 6c 65 20  ointer to table 
9320: 63 6f 6e 74 61 69 6e 69 6e 67 20 65 6e 74 72 79  containing entry
9330: 2e 20 2a 2f 0a 20 20 20 20 73 69 7a 65 5f 74 20  . */.    size_t 
9340: 68 61 73 68 3b 09 09 2f 2a 20 48 61 73 68 20 76  hash;../* Hash v
9350: 61 6c 75 65 2e 20 2a 2f 0a 20 20 20 20 76 6f 69  alue. */.    voi
9360: 64 20 2a 63 6c 69 65 6e 74 44 61 74 61 3b 09 09  d *clientData;..
9370: 2f 2a 20 41 70 70 6c 69 63 61 74 69 6f 6e 20 73  /* Application s
9380: 74 6f 72 65 73 20 73 6f 6d 65 74 68 69 6e 67 20  tores something 
9390: 68 65 72 65 20 77 69 74 68 0a 09 09 09 09 20 2a  here with..... *
93a0: 20 54 63 6c 5f 53 65 74 48 61 73 68 56 61 6c 75   Tcl_SetHashValu
93b0: 65 2e 20 2a 2f 0a 20 20 20 20 75 6e 69 6f 6e 20  e. */.    union 
93c0: 7b 09 09 09 2f 2a 20 4b 65 79 20 68 61 73 20 6f  {.../* Key has o
93d0: 6e 65 20 6f 66 20 74 68 65 73 65 20 66 6f 72 6d  ne of these form
93e0: 73 3a 20 2a 2f 0a 09 63 68 61 72 20 2a 6f 6e 65  s: */..char *one
93f0: 57 6f 72 64 56 61 6c 75 65 3b 09 2f 2a 20 4f 6e  WordValue;./* On
9400: 65 2d 77 6f 72 64 20 76 61 6c 75 65 20 66 6f 72  e-word value for
9410: 20 6b 65 79 2e 20 2a 2f 0a 09 54 63 6c 5f 4f 62   key. */..Tcl_Ob
9420: 6a 20 2a 6f 62 6a 50 74 72 3b 09 2f 2a 20 54 63  j *objPtr;./* Tc
9430: 6c 5f 4f 62 6a 20 2a 20 6b 65 79 20 76 61 6c 75  l_Obj * key valu
9440: 65 2e 20 2a 2f 0a 09 69 6e 74 20 77 6f 72 64 73  e. */..int words
9450: 5b 31 5d 3b 09 09 2f 2a 20 4d 75 6c 74 69 70 6c  [1];../* Multipl
9460: 65 20 69 6e 74 65 67 65 72 20 77 6f 72 64 73 20  e integer words 
9470: 66 6f 72 20 6b 65 79 2e 20 54 68 65 20 61 63 74  for key. The act
9480: 75 61 6c 0a 09 09 09 09 20 2a 20 73 69 7a 65 20  ual..... * size 
9490: 77 69 6c 6c 20 62 65 20 61 73 20 6c 61 72 67 65  will be as large
94a0: 20 61 73 20 6e 65 63 65 73 73 61 72 79 20 66 6f   as necessary fo
94b0: 72 20 74 68 69 73 0a 09 09 09 09 20 2a 20 74 61  r this..... * ta
94c0: 62 6c 65 27 73 20 6b 65 79 73 2e 20 2a 2f 0a 09  ble's keys. */..
94d0: 63 68 61 72 20 73 74 72 69 6e 67 5b 31 5d 3b 09  char string[1];.
94e0: 09 2f 2a 20 53 74 72 69 6e 67 20 66 6f 72 20 6b  ./* String for k
94f0: 65 79 2e 20 54 68 65 20 61 63 74 75 61 6c 20 73  ey. The actual s
9500: 69 7a 65 20 77 69 6c 6c 20 62 65 20 61 73 0a 09  ize will be as..
9510: 09 09 09 20 2a 20 6c 61 72 67 65 20 61 73 20 6e  ... * large as n
9520: 65 65 64 65 64 20 74 6f 20 68 6f 6c 64 20 74 68  eeded to hold th
9530: 65 20 6b 65 79 2e 20 2a 2f 0a 20 20 20 20 7d 20  e key. */.    } 
9540: 6b 65 79 3b 09 09 09 2f 2a 20 4d 55 53 54 20 42  key;.../* MUST B
9550: 45 20 4c 41 53 54 20 46 49 45 4c 44 20 49 4e 20  E LAST FIELD IN 
9560: 52 45 43 4f 52 44 21 21 20 2a 2f 0a 7d 3b 0a 0a  RECORD!! */.};..
9570: 2f 2a 0a 20 2a 20 46 6c 61 67 73 20 75 73 65 64  /*. * Flags used
9580: 20 69 6e 20 54 63 6c 5f 48 61 73 68 4b 65 79 54   in Tcl_HashKeyT
9590: 79 70 65 2e 0a 20 2a 0a 20 2a 20 54 43 4c 5f 48  ype.. *. * TCL_H
95a0: 41 53 48 5f 4b 45 59 5f 52 41 4e 44 4f 4d 49 5a  ASH_KEY_RANDOMIZ
95b0: 45 5f 48 41 53 48 20 2d 0a 20 2a 09 09 09 09 54  E_HASH -. *....T
95c0: 68 65 72 65 20 61 72 65 20 73 6f 6d 65 20 74 68  here are some th
95d0: 69 6e 67 73 2c 20 70 6f 69 6e 74 65 72 73 20 66  ings, pointers f
95e0: 6f 72 20 65 78 61 6d 70 6c 65 0a 20 2a 09 09 09  or example. *...
95f0: 09 77 68 69 63 68 20 64 6f 6e 27 74 20 68 61 73  .which don't has
9600: 68 20 77 65 6c 6c 20 62 65 63 61 75 73 65 20 74  h well because t
9610: 68 65 79 20 64 6f 20 6e 6f 74 20 75 73 65 0a 20  hey do not use. 
9620: 2a 09 09 09 09 74 68 65 20 6c 6f 77 65 72 20 62  *....the lower b
9630: 69 74 73 2e 20 49 66 20 74 68 69 73 20 66 6c 61  its. If this fla
9640: 67 20 69 73 20 73 65 74 20 74 68 65 6e 20 74 68  g is set then th
9650: 65 0a 20 2a 09 09 09 09 68 61 73 68 20 74 61 62  e. *....hash tab
9660: 6c 65 20 77 69 6c 6c 20 61 74 74 65 6d 70 74 20  le will attempt 
9670: 74 6f 20 72 65 63 74 69 66 79 20 74 68 69 73 20  to rectify this 
9680: 62 79 0a 20 2a 09 09 09 09 72 61 6e 64 6f 6d 69  by. *....randomi
9690: 73 69 6e 67 20 74 68 65 20 62 69 74 73 20 61 6e  sing the bits an
96a0: 64 20 74 68 65 6e 20 75 73 69 6e 67 20 74 68 65  d then using the
96b0: 20 75 70 70 65 72 0a 20 2a 09 09 09 09 4e 20 62   upper. *....N b
96c0: 69 74 73 20 61 73 20 74 68 65 20 69 6e 64 65 78  its as the index
96d0: 20 69 6e 74 6f 20 74 68 65 20 74 61 62 6c 65 2e   into the table.
96e0: 0a 20 2a 20 54 43 4c 5f 48 41 53 48 5f 4b 45 59  . * TCL_HASH_KEY
96f0: 5f 53 59 53 54 45 4d 5f 48 41 53 48 20 2d 09 49  _SYSTEM_HASH -.I
9700: 66 20 74 68 69 73 20 66 6c 61 67 20 69 73 20 73  f this flag is s
9710: 65 74 20 74 68 65 6e 20 61 6c 6c 20 6d 65 6d 6f  et then all memo
9720: 72 79 20 69 6e 74 65 72 6e 61 6c 6c 79 0a 20 2a  ry internally. *
9730: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
9740: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 61 6c                al
9750: 6c 6f 63 61 74 65 64 20 66 6f 72 20 74 68 65 20  located for the 
9760: 68 61 73 68 20 74 61 62 6c 65 20 74 68 61 74 20  hash table that 
9770: 69 73 20 6e 6f 74 20 66 6f 72 20 61 6e 0a 20 2a  is not for an. *
9780: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
9790: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 65 6e                en
97a0: 74 72 79 20 77 69 6c 6c 20 75 73 65 20 74 68 65  try will use the
97b0: 20 73 79 73 74 65 6d 20 68 65 61 70 2e 0a 20 2a   system heap.. *
97c0: 20 54 43 4c 5f 48 41 53 48 5f 4b 45 59 5f 44 49   TCL_HASH_KEY_DI
97d0: 52 45 43 54 5f 43 4f 4d 50 41 52 45 20 2d 0a 20  RECT_COMPARE -. 
97e0: 2a 09 20 20 20 20 20 20 20 20 20 20 20 20 20 20  *.              
97f0: 20 20 20 20 20 20 20 20 20 20 41 6c 6c 6f 77 73            Allows
9800: 20 66 61 73 74 20 63 6f 6d 70 61 72 69 73 6f 6e   fast comparison
9810: 20 66 6f 72 20 68 61 73 68 20 6b 65 79 73 20 64   for hash keys d
9820: 69 72 65 63 74 6c 79 0a 20 2a 20 20 20 20 20 20  irectly. *      
9830: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
9840: 20 20 20 20 20 20 20 20 62 79 20 63 6f 6d 70 61          by compa
9850: 72 65 20 6f 66 20 74 68 65 69 72 20 6b 65 79 2e  re of their key.
9860: 6f 6e 65 57 6f 72 64 56 61 6c 75 65 20 76 61 6c  oneWordValue val
9870: 75 65 73 2c 0a 20 2a 20 20 20 20 20 20 20 20 20  ues,. *         
9880: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
9890: 20 20 20 20 20 62 65 66 6f 72 65 20 63 61 6c 6c       before call
98a0: 20 6f 66 20 63 6f 6d 70 61 72 65 4b 65 79 73 50   of compareKeysP
98b0: 72 6f 63 20 28 6d 75 63 68 20 73 6c 6f 77 65 72  roc (much slower
98c0: 0a 20 2a 20 20 20 20 20 20 20 20 20 20 20 20 20  . *             
98d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
98e0: 20 74 68 61 6e 20 61 20 64 69 72 65 63 74 20 63   than a direct c
98f0: 6f 6d 70 61 72 65 2c 20 73 6f 20 69 74 20 69 73  ompare, so it is
9900: 20 73 70 65 65 64 2d 75 70 20 6f 6e 6c 79 0a 20   speed-up only. 
9910: 2a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20  *               
9920: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 66                 f
9930: 6c 61 67 29 2e 20 44 6f 6e 27 74 20 75 73 65 20  lag). Don't use 
9940: 69 74 20 69 66 20 6b 65 79 73 20 63 6f 6e 74 61  it if keys conta
9950: 69 6e 20 76 61 6c 75 65 73 20 72 61 74 68 65 72  in values rather
9960: 0a 20 2a 20 20 20 20 20 20 20 20 20 20 20 20 20  . *             
9970: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20                  
9980: 20 74 68 61 6e 20 70 6f 69 6e 74 65 72 73 2e 0a   than pointers..
9990: 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c   */..#define TCL
99a0: 5f 48 41 53 48 5f 4b 45 59 5f 52 41 4e 44 4f 4d  _HASH_KEY_RANDOM
99b0: 49 5a 45 5f 48 41 53 48 20 30 78 31 0a 23 64 65  IZE_HASH 0x1.#de
99c0: 66 69 6e 65 20 54 43 4c 5f 48 41 53 48 5f 4b 45  fine TCL_HASH_KE
99d0: 59 5f 53 59 53 54 45 4d 5f 48 41 53 48 20 20 20  Y_SYSTEM_HASH   
99e0: 20 30 78 32 0a 23 64 65 66 69 6e 65 20 54 43 4c   0x2.#define TCL
99f0: 5f 48 41 53 48 5f 4b 45 59 5f 44 49 52 45 43 54  _HASH_KEY_DIRECT
9a00: 5f 43 4f 4d 50 41 52 45 20 30 78 34 0a 0a 2f 2a  _COMPARE 0x4../*
9a10: 0a 20 2a 20 53 74 72 75 63 74 75 72 65 20 64 65  . * Structure de
9a20: 66 69 6e 69 74 69 6f 6e 20 66 6f 72 20 74 68 65  finition for the
9a30: 20 6d 65 74 68 6f 64 73 20 61 73 73 6f 63 69 61   methods associa
9a40: 74 65 64 20 77 69 74 68 20 61 20 68 61 73 68 20  ted with a hash 
9a50: 74 61 62 6c 65 20 6b 65 79 20 74 79 70 65 2e 0a  table key type..
9a60: 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c   */..#define TCL
9a70: 5f 48 41 53 48 5f 4b 45 59 5f 54 59 50 45 5f 56  _HASH_KEY_TYPE_V
9a80: 45 52 53 49 4f 4e 20 31 0a 73 74 72 75 63 74 20  ERSION 1.struct 
9a90: 54 63 6c 5f 48 61 73 68 4b 65 79 54 79 70 65 20  Tcl_HashKeyType 
9aa0: 7b 0a 20 20 20 20 69 6e 74 20 76 65 72 73 69 6f  {.    int versio
9ab0: 6e 3b 09 09 2f 2a 20 56 65 72 73 69 6f 6e 20 6f  n;../* Version o
9ac0: 66 20 74 68 65 20 74 61 62 6c 65 2e 20 49 66 20  f the table. If 
9ad0: 74 68 69 73 20 73 74 72 75 63 74 75 72 65 20 69  this structure i
9ae0: 73 0a 09 09 09 09 20 2a 20 65 78 74 65 6e 64 65  s..... * extende
9af0: 64 20 69 6e 20 66 75 74 75 72 65 20 74 68 65 6e  d in future then
9b00: 20 74 68 65 20 76 65 72 73 69 6f 6e 20 63 61 6e   the version can
9b10: 20 62 65 0a 09 09 09 09 20 2a 20 75 73 65 64 20   be..... * used 
9b20: 74 6f 20 64 69 73 74 69 6e 67 75 69 73 68 20 62  to distinguish b
9b30: 65 74 77 65 65 6e 20 64 69 66 66 65 72 65 6e 74  etween different
9b40: 0a 09 09 09 09 20 2a 20 73 74 72 75 63 74 75 72  ..... * structur
9b50: 65 73 2e 20 2a 2f 0a 20 20 20 20 69 6e 74 20 66  es. */.    int f
9b60: 6c 61 67 73 3b 09 09 09 2f 2a 20 46 6c 61 67 73  lags;.../* Flags
9b70: 2c 20 73 65 65 20 61 62 6f 76 65 20 66 6f 72 20  , see above for 
9b80: 64 65 74 61 69 6c 73 2e 20 2a 2f 0a 20 20 20 20  details. */.    
9b90: 54 63 6c 5f 48 61 73 68 4b 65 79 50 72 6f 63 20  Tcl_HashKeyProc 
9ba0: 2a 68 61 73 68 4b 65 79 50 72 6f 63 3b 0a 09 09  *hashKeyProc;...
9bb0: 09 09 2f 2a 20 43 61 6c 63 75 6c 61 74 65 73 20  ../* Calculates 
9bc0: 61 20 68 61 73 68 20 76 61 6c 75 65 20 66 6f 72  a hash value for
9bd0: 20 74 68 65 20 6b 65 79 2e 20 49 66 0a 09 09 09   the key. If....
9be0: 09 20 2a 20 74 68 69 73 20 69 73 20 4e 55 4c 4c  . * this is NULL
9bf0: 20 74 68 65 6e 20 74 68 65 20 70 6f 69 6e 74 65   then the pointe
9c00: 72 20 69 74 73 65 6c 66 20 69 73 0a 09 09 09 09  r itself is.....
9c10: 20 2a 20 75 73 65 64 20 61 73 20 61 20 68 61 73   * used as a has
9c20: 68 20 76 61 6c 75 65 2e 20 2a 2f 0a 20 20 20 20  h value. */.    
9c30: 54 63 6c 5f 43 6f 6d 70 61 72 65 48 61 73 68 4b  Tcl_CompareHashK
9c40: 65 79 73 50 72 6f 63 20 2a 63 6f 6d 70 61 72 65  eysProc *compare
9c50: 4b 65 79 73 50 72 6f 63 3b 0a 09 09 09 09 2f 2a  KeysProc;...../*
9c60: 20 43 6f 6d 70 61 72 65 73 20 74 77 6f 20 6b 65   Compares two ke
9c70: 79 73 20 61 6e 64 20 72 65 74 75 72 6e 73 20 7a  ys and returns z
9c80: 65 72 6f 20 69 66 20 74 68 65 79 0a 09 09 09 09  ero if they.....
9c90: 20 2a 20 64 6f 20 6e 6f 74 20 6d 61 74 63 68 2c   * do not match,
9ca0: 20 61 6e 64 20 6e 6f 6e 2d 7a 65 72 6f 20 69 66   and non-zero if
9cb0: 20 74 68 65 79 20 64 6f 2e 20 49 66 0a 09 09 09   they do. If....
9cc0: 09 20 2a 20 74 68 69 73 20 69 73 20 4e 55 4c 4c  . * this is NULL
9cd0: 20 74 68 65 6e 20 74 68 65 20 70 6f 69 6e 74 65   then the pointe
9ce0: 72 73 20 61 72 65 0a 09 09 09 09 20 2a 20 63 6f  rs are..... * co
9cf0: 6d 70 61 72 65 64 2e 20 2a 2f 0a 20 20 20 20 54  mpared. */.    T
9d00: 63 6c 5f 41 6c 6c 6f 63 48 61 73 68 45 6e 74 72  cl_AllocHashEntr
9d10: 79 50 72 6f 63 20 2a 61 6c 6c 6f 63 45 6e 74 72  yProc *allocEntr
9d20: 79 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 43 61  yProc;...../* Ca
9d30: 6c 6c 65 64 20 74 6f 20 61 6c 6c 6f 63 61 74 65  lled to allocate
9d40: 20 6d 65 6d 6f 72 79 20 66 6f 72 20 61 20 6e 65   memory for a ne
9d50: 77 20 65 6e 74 72 79 2c 0a 09 09 09 09 20 2a 20  w entry,..... * 
9d60: 69 2e 65 2e 20 69 66 20 74 68 65 20 6b 65 79 20  i.e. if the key 
9d70: 69 73 20 61 20 73 74 72 69 6e 67 20 74 68 65 6e  is a string then
9d80: 20 74 68 69 73 20 63 6f 75 6c 64 0a 09 09 09 09   this could.....
9d90: 20 2a 20 61 6c 6c 6f 63 61 74 65 20 61 20 73 69   * allocate a si
9da0: 6e 67 6c 65 20 62 6c 6f 63 6b 20 77 68 69 63 68  ngle block which
9db0: 20 63 6f 6e 74 61 69 6e 73 0a 09 09 09 09 20 2a   contains..... *
9dc0: 20 65 6e 6f 75 67 68 20 73 70 61 63 65 20 66 6f   enough space fo
9dd0: 72 20 62 6f 74 68 20 74 68 65 20 65 6e 74 72 79  r both the entry
9de0: 20 61 6e 64 20 74 68 65 0a 09 09 09 09 20 2a 20   and the..... * 
9df0: 73 74 72 69 6e 67 2e 20 4f 6e 6c 79 20 74 68 65  string. Only the
9e00: 20 6b 65 79 20 66 69 65 6c 64 20 6f 66 20 74 68   key field of th
9e10: 65 20 61 6c 6c 6f 63 61 74 65 64 0a 09 09 09 09  e allocated.....
9e20: 20 2a 20 54 63 6c 5f 48 61 73 68 45 6e 74 72 79   * Tcl_HashEntry
9e30: 20 73 74 72 75 63 74 75 72 65 20 6e 65 65 64 73   structure needs
9e40: 20 74 6f 20 62 65 20 66 69 6c 6c 65 64 0a 09 09   to be filled...
9e50: 09 09 20 2a 20 69 6e 2e 20 49 66 20 73 6f 6d 65  .. * in. If some
9e60: 74 68 69 6e 67 20 65 6c 73 65 20 6e 65 65 64 73  thing else needs
9e70: 20 74 6f 20 62 65 20 64 6f 6e 65 20 74 6f 0a 09   to be done to..
9e80: 09 09 09 20 2a 20 74 68 65 20 6b 65 79 2c 20 69  ... * the key, i
9e90: 2e 65 2e 20 69 6e 63 72 65 6d 65 6e 74 69 6e 67  .e. incrementing
9ea0: 20 61 20 72 65 66 65 72 65 6e 63 65 0a 09 09 09   a reference....
9eb0: 09 20 2a 20 63 6f 75 6e 74 20 74 68 65 6e 20 74  . * count then t
9ec0: 68 61 74 20 73 68 6f 75 6c 64 20 62 65 20 64 6f  hat should be do
9ed0: 6e 65 20 62 79 20 74 68 69 73 0a 09 09 09 09 20  ne by this..... 
9ee0: 2a 20 66 75 6e 63 74 69 6f 6e 2e 20 49 66 20 74  * function. If t
9ef0: 68 69 73 20 69 73 20 4e 55 4c 4c 20 74 68 65 6e  his is NULL then
9f00: 20 54 63 6c 5f 41 6c 6c 6f 63 20 69 73 0a 09 09   Tcl_Alloc is...
9f10: 09 09 20 2a 20 75 73 65 64 20 74 6f 20 61 6c 6c  .. * used to all
9f20: 6f 63 61 74 65 20 65 6e 6f 75 67 68 20 73 70 61  ocate enough spa
9f30: 63 65 20 66 6f 72 20 61 0a 09 09 09 09 20 2a 20  ce for a..... * 
9f40: 54 63 6c 5f 48 61 73 68 45 6e 74 72 79 20 61 6e  Tcl_HashEntry an
9f50: 64 20 74 68 65 20 6b 65 79 20 70 6f 69 6e 74 65  d the key pointe
9f60: 72 20 69 73 0a 09 09 09 09 20 2a 20 61 73 73 69  r is..... * assi
9f70: 67 6e 65 64 20 74 6f 20 6b 65 79 2e 6f 6e 65 57  gned to key.oneW
9f80: 6f 72 64 56 61 6c 75 65 2e 20 2a 2f 0a 20 20 20  ordValue. */.   
9f90: 20 54 63 6c 5f 46 72 65 65 48 61 73 68 45 6e 74   Tcl_FreeHashEnt
9fa0: 72 79 50 72 6f 63 20 2a 66 72 65 65 45 6e 74 72  ryProc *freeEntr
9fb0: 79 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 43 61  yProc;...../* Ca
9fc0: 6c 6c 65 64 20 74 6f 20 66 72 65 65 20 6d 65 6d  lled to free mem
9fd0: 6f 72 79 20 61 73 73 6f 63 69 61 74 65 64 20 77  ory associated w
9fe0: 69 74 68 20 61 6e 0a 09 09 09 09 20 2a 20 65 6e  ith an..... * en
9ff0: 74 72 79 2e 20 49 66 20 73 6f 6d 65 74 68 69 6e  try. If somethin
a000: 67 20 65 6c 73 65 20 6e 65 65 64 73 20 74 6f 20  g else needs to 
a010: 62 65 20 64 6f 6e 65 0a 09 09 09 09 20 2a 20 74  be done..... * t
a020: 6f 20 74 68 65 20 6b 65 79 2c 20 69 2e 65 2e 20  o the key, i.e. 
a030: 64 65 63 72 65 6d 65 6e 74 69 6e 67 20 61 20 72  decrementing a r
a040: 65 66 65 72 65 6e 63 65 0a 09 09 09 09 20 2a 20  eference..... * 
a050: 63 6f 75 6e 74 20 74 68 65 6e 20 74 68 61 74 20  count then that 
a060: 73 68 6f 75 6c 64 20 62 65 20 64 6f 6e 65 20 62  should be done b
a070: 79 20 74 68 69 73 0a 09 09 09 09 20 2a 20 66 75  y this..... * fu
a080: 6e 63 74 69 6f 6e 2e 20 49 66 20 74 68 69 73 20  nction. If this 
a090: 69 73 20 4e 55 4c 4c 20 74 68 65 6e 20 54 63 6c  is NULL then Tcl
a0a0: 5f 46 72 65 65 20 69 73 0a 09 09 09 09 20 2a 20  _Free is..... * 
a0b0: 75 73 65 64 20 74 6f 20 66 72 65 65 20 74 68 65  used to free the
a0c0: 20 54 63 6c 5f 48 61 73 68 45 6e 74 72 79 2e 20   Tcl_HashEntry. 
a0d0: 2a 2f 0a 7d 3b 0a 0a 2f 2a 0a 20 2a 20 53 74 72  */.};../*. * Str
a0e0: 75 63 74 75 72 65 20 64 65 66 69 6e 69 74 69 6f  ucture definitio
a0f0: 6e 20 66 6f 72 20 61 20 68 61 73 68 20 74 61 62  n for a hash tab
a100: 6c 65 2e 20 20 4d 75 73 74 20 62 65 20 69 6e 20  le.  Must be in 
a110: 74 63 6c 2e 68 20 73 6f 20 63 6c 69 65 6e 74 73  tcl.h so clients
a120: 20 63 61 6e 0a 20 2a 20 61 6c 6c 6f 63 61 74 65   can. * allocate
a130: 20 73 70 61 63 65 20 66 6f 72 20 74 68 65 73 65   space for these
a140: 20 73 74 72 75 63 74 75 72 65 73 2c 20 62 75 74   structures, but
a150: 20 63 6c 69 65 6e 74 73 20 73 68 6f 75 6c 64 20   clients should 
a160: 6e 65 76 65 72 20 61 63 63 65 73 73 20 61 6e 79  never access any
a170: 0a 20 2a 20 66 69 65 6c 64 73 20 69 6e 20 74 68  . * fields in th
a180: 69 73 20 73 74 72 75 63 74 75 72 65 2e 0a 20 2a  is structure.. *
a190: 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 53  /..#define TCL_S
a1a0: 4d 41 4c 4c 5f 48 41 53 48 5f 54 41 42 4c 45 20  MALL_HASH_TABLE 
a1b0: 34 0a 73 74 72 75 63 74 20 54 63 6c 5f 48 61 73  4.struct Tcl_Has
a1c0: 68 54 61 62 6c 65 20 7b 0a 20 20 20 20 54 63 6c  hTable {.    Tcl
a1d0: 5f 48 61 73 68 45 6e 74 72 79 20 2a 2a 62 75 63  _HashEntry **buc
a1e0: 6b 65 74 73 3b 09 2f 2a 20 50 6f 69 6e 74 65 72  kets;./* Pointer
a1f0: 20 74 6f 20 62 75 63 6b 65 74 20 61 72 72 61 79   to bucket array
a200: 2e 20 45 61 63 68 20 65 6c 65 6d 65 6e 74 0a 09  . Each element..
a210: 09 09 09 20 2a 20 70 6f 69 6e 74 73 20 74 6f 20  ... * points to 
a220: 66 69 72 73 74 20 65 6e 74 72 79 20 69 6e 20 62  first entry in b
a230: 75 63 6b 65 74 27 73 20 68 61 73 68 0a 09 09 09  ucket's hash....
a240: 09 20 2a 20 63 68 61 69 6e 2c 20 6f 72 20 4e 55  . * chain, or NU
a250: 4c 4c 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 48  LL. */.    Tcl_H
a260: 61 73 68 45 6e 74 72 79 20 2a 73 74 61 74 69 63  ashEntry *static
a270: 42 75 63 6b 65 74 73 5b 54 43 4c 5f 53 4d 41 4c  Buckets[TCL_SMAL
a280: 4c 5f 48 41 53 48 5f 54 41 42 4c 45 5d 3b 0a 09  L_HASH_TABLE];..
a290: 09 09 09 2f 2a 20 42 75 63 6b 65 74 20 61 72 72  .../* Bucket arr
a2a0: 61 79 20 75 73 65 64 20 66 6f 72 20 73 6d 61 6c  ay used for smal
a2b0: 6c 20 74 61 62 6c 65 73 20 28 74 6f 0a 09 09 09  l tables (to....
a2c0: 09 20 2a 20 61 76 6f 69 64 20 6d 61 6c 6c 6f 63  . * avoid malloc
a2d0: 73 20 61 6e 64 20 66 72 65 65 73 29 2e 20 2a 2f  s and frees). */
a2e0: 0a 20 20 20 20 54 63 6c 5f 53 69 7a 65 20 6e 75  .    Tcl_Size nu
a2f0: 6d 42 75 63 6b 65 74 73 3b 09 2f 2a 20 54 6f 74  mBuckets;./* Tot
a300: 61 6c 20 6e 75 6d 62 65 72 20 6f 66 20 62 75 63  al number of buc
a310: 6b 65 74 73 20 61 6c 6c 6f 63 61 74 65 64 20 61  kets allocated a
a320: 74 0a 09 09 09 09 20 2a 20 2a 2a 62 75 63 6b 65  t..... * **bucke
a330: 74 50 74 72 2e 20 2a 2f 0a 20 20 20 20 54 63 6c  tPtr. */.    Tcl
a340: 5f 53 69 7a 65 20 6e 75 6d 45 6e 74 72 69 65 73  _Size numEntries
a350: 3b 09 2f 2a 20 54 6f 74 61 6c 20 6e 75 6d 62 65  ;./* Total numbe
a360: 72 20 6f 66 20 65 6e 74 72 69 65 73 20 70 72 65  r of entries pre
a370: 73 65 6e 74 20 69 6e 0a 09 09 09 09 20 2a 20 74  sent in..... * t
a380: 61 62 6c 65 2e 20 2a 2f 0a 20 20 20 20 54 63 6c  able. */.    Tcl
a390: 5f 53 69 7a 65 20 72 65 62 75 69 6c 64 53 69 7a  _Size rebuildSiz
a3a0: 65 3b 09 2f 2a 20 45 6e 6c 61 72 67 65 20 74 61  e;./* Enlarge ta
a3b0: 62 6c 65 20 77 68 65 6e 20 6e 75 6d 45 6e 74 72  ble when numEntr
a3c0: 69 65 73 20 67 65 74 73 20 74 6f 20 62 65 0a 09  ies gets to be..
a3d0: 09 09 09 20 2a 20 74 68 69 73 20 6c 61 72 67 65  ... * this large
a3e0: 2e 20 2a 2f 0a 20 20 20 20 73 69 7a 65 5f 74 20  . */.    size_t 
a3f0: 6d 61 73 6b 3b 09 09 2f 2a 20 4d 61 73 6b 20 76  mask;../* Mask v
a400: 61 6c 75 65 20 75 73 65 64 20 69 6e 20 68 61 73  alue used in has
a410: 68 69 6e 67 20 66 75 6e 63 74 69 6f 6e 2e 20 2a  hing function. *
a420: 2f 0a 20 20 20 20 69 6e 74 20 64 6f 77 6e 53 68  /.    int downSh
a430: 69 66 74 3b 09 09 2f 2a 20 53 68 69 66 74 20 63  ift;../* Shift c
a440: 6f 75 6e 74 20 75 73 65 64 20 69 6e 20 68 61 73  ount used in has
a450: 68 69 6e 67 20 66 75 6e 63 74 69 6f 6e 2e 0a 09  hing function...
a460: 09 09 09 20 2a 20 44 65 73 69 67 6e 65 64 20 74  ... * Designed t
a470: 6f 20 75 73 65 20 68 69 67 68 2d 6f 72 64 65 72  o use high-order
a480: 20 62 69 74 73 20 6f 66 0a 09 09 09 09 20 2a 20   bits of..... * 
a490: 72 61 6e 64 6f 6d 69 7a 65 64 20 6b 65 79 73 2e  randomized keys.
a4a0: 20 2a 2f 0a 20 20 20 20 69 6e 74 20 6b 65 79 54   */.    int keyT
a4b0: 79 70 65 3b 09 09 2f 2a 20 54 79 70 65 20 6f 66  ype;../* Type of
a4c0: 20 6b 65 79 73 20 75 73 65 64 20 69 6e 20 74 68   keys used in th
a4d0: 69 73 20 74 61 62 6c 65 2e 20 49 74 27 73 0a 09  is table. It's..
a4e0: 09 09 09 20 2a 20 65 69 74 68 65 72 20 54 43 4c  ... * either TCL
a4f0: 5f 43 55 53 54 4f 4d 5f 4b 45 59 53 2c 20 54 43  _CUSTOM_KEYS, TC
a500: 4c 5f 53 54 52 49 4e 47 5f 4b 45 59 53 2c 0a 09  L_STRING_KEYS,..
a510: 09 09 09 20 2a 20 54 43 4c 5f 4f 4e 45 5f 57 4f  ... * TCL_ONE_WO
a520: 52 44 5f 4b 45 59 53 2c 20 6f 72 20 61 6e 20 69  RD_KEYS, or an i
a530: 6e 74 65 67 65 72 20 67 69 76 69 6e 67 20 74 68  nteger giving th
a540: 65 0a 09 09 09 09 20 2a 20 6e 75 6d 62 65 72 20  e..... * number 
a550: 6f 66 20 69 6e 74 73 20 74 68 61 74 20 69 73 20  of ints that is 
a560: 74 68 65 20 73 69 7a 65 20 6f 66 20 74 68 65 0a  the size of the.
a570: 09 09 09 09 20 2a 20 6b 65 79 2e 20 2a 2f 0a 23  .... * key. */.#
a580: 69 66 6e 64 65 66 20 54 43 4c 5f 4e 4f 5f 44 45  ifndef TCL_NO_DE
a590: 50 52 45 43 41 54 45 44 0a 20 20 20 20 54 63 6c  PRECATED.    Tcl
a5a0: 5f 48 61 73 68 45 6e 74 72 79 20 2a 28 2a 66 69  _HashEntry *(*fi
a5b0: 6e 64 50 72 6f 63 29 20 28 54 63 6c 5f 48 61 73  ndProc) (Tcl_Has
a5c0: 68 54 61 62 6c 65 20 2a 74 61 62 6c 65 50 74 72  hTable *tablePtr
a5d0: 2c 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 6b 65  , const char *ke
a5e0: 79 29 3b 0a 23 65 6c 73 65 0a 20 20 20 20 76 6f  y);.#else.    vo
a5f0: 69 64 20 2a 75 6e 55 73 65 64 3b 0a 23 65 6e 64  id *unUsed;.#end
a600: 69 66 0a 20 20 20 20 54 63 6c 5f 48 61 73 68 45  if.    Tcl_HashE
a610: 6e 74 72 79 20 2a 28 2a 63 72 65 61 74 65 50 72  ntry *(*createPr
a620: 6f 63 29 20 28 54 63 6c 5f 48 61 73 68 54 61 62  oc) (Tcl_HashTab
a630: 6c 65 20 2a 74 61 62 6c 65 50 74 72 2c 20 63 6f  le *tablePtr, co
a640: 6e 73 74 20 63 68 61 72 20 2a 6b 65 79 2c 0a 09  nst char *key,..
a650: 20 20 20 20 69 6e 74 20 2a 6e 65 77 50 74 72 29      int *newPtr)
a660: 3b 0a 20 20 20 20 63 6f 6e 73 74 20 54 63 6c 5f  ;.    const Tcl_
a670: 48 61 73 68 4b 65 79 54 79 70 65 20 2a 74 79 70  HashKeyType *typ
a680: 65 50 74 72 3b 0a 09 09 09 09 2f 2a 20 54 79 70  ePtr;...../* Typ
a690: 65 20 6f 66 20 74 68 65 20 6b 65 79 73 20 75 73  e of the keys us
a6a0: 65 64 20 69 6e 20 74 68 65 0a 09 09 09 09 20 2a  ed in the..... *
a6b0: 20 54 63 6c 5f 48 61 73 68 54 61 62 6c 65 2e 20   Tcl_HashTable. 
a6c0: 2a 2f 0a 7d 3b 0a 0a 2f 2a 0a 20 2a 20 53 74 72  */.};../*. * Str
a6d0: 75 63 74 75 72 65 20 64 65 66 69 6e 69 74 69 6f  ucture definitio
a6e0: 6e 20 66 6f 72 20 69 6e 66 6f 72 6d 61 74 69 6f  n for informatio
a6f0: 6e 20 75 73 65 64 20 74 6f 20 6b 65 65 70 20 74  n used to keep t
a700: 72 61 63 6b 20 6f 66 20 73 65 61 72 63 68 65 73  rack of searches
a710: 20 74 68 72 6f 75 67 68 0a 20 2a 20 68 61 73 68   through. * hash
a720: 20 74 61 62 6c 65 73 3a 0a 20 2a 2f 0a 0a 74 79   tables:. */..ty
a730: 70 65 64 65 66 20 73 74 72 75 63 74 20 54 63 6c  pedef struct Tcl
a740: 5f 48 61 73 68 53 65 61 72 63 68 20 7b 0a 20 20  _HashSearch {.  
a750: 20 20 54 63 6c 5f 48 61 73 68 54 61 62 6c 65 20    Tcl_HashTable 
a760: 2a 74 61 62 6c 65 50 74 72 3b 09 2f 2a 20 54 61  *tablePtr;./* Ta
a770: 62 6c 65 20 62 65 69 6e 67 20 73 65 61 72 63 68  ble being search
a780: 65 64 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 53  ed. */.    Tcl_S
a790: 69 7a 65 20 6e 65 78 74 49 6e 64 65 78 3b 09 09  ize nextIndex;..
a7a0: 2f 2a 20 49 6e 64 65 78 20 6f 66 20 6e 65 78 74  /* Index of next
a7b0: 20 62 75 63 6b 65 74 20 74 6f 20 62 65 20 65 6e   bucket to be en
a7c0: 75 6d 65 72 61 74 65 64 20 61 66 74 65 72 0a 09  umerated after..
a7d0: 09 09 09 20 2a 20 70 72 65 73 65 6e 74 20 6f 6e  ... * present on
a7e0: 65 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 48 61  e. */.    Tcl_Ha
a7f0: 73 68 45 6e 74 72 79 20 2a 6e 65 78 74 45 6e 74  shEntry *nextEnt
a800: 72 79 50 74 72 3b 2f 2a 20 4e 65 78 74 20 65 6e  ryPtr;/* Next en
a810: 74 72 79 20 74 6f 20 62 65 20 65 6e 75 6d 65 72  try to be enumer
a820: 61 74 65 64 20 69 6e 20 74 68 65 20 63 75 72 72  ated in the curr
a830: 65 6e 74 0a 09 09 09 09 20 2a 20 62 75 63 6b 65  ent..... * bucke
a840: 74 2e 20 2a 2f 0a 7d 20 54 63 6c 5f 48 61 73 68  t. */.} Tcl_Hash
a850: 53 65 61 72 63 68 3b 0a 0a 2f 2a 0a 20 2a 20 41  Search;../*. * A
a860: 63 63 65 70 74 61 62 6c 65 20 6b 65 79 20 74 79  cceptable key ty
a870: 70 65 73 20 66 6f 72 20 68 61 73 68 20 74 61 62  pes for hash tab
a880: 6c 65 73 3a 0a 20 2a 0a 20 2a 20 54 43 4c 5f 53  les:. *. * TCL_S
a890: 54 52 49 4e 47 5f 4b 45 59 53 3a 09 09 54 68 65  TRING_KEYS:..The
a8a0: 20 6b 65 79 73 20 61 72 65 20 73 74 72 69 6e 67   keys are string
a8b0: 73 2c 20 74 68 65 79 20 61 72 65 20 63 6f 70 69  s, they are copi
a8c0: 65 64 20 69 6e 74 6f 20 74 68 65 0a 20 2a 09 09  ed into the. *..
a8d0: 09 09 65 6e 74 72 79 2e 0a 20 2a 20 54 43 4c 5f  ..entry.. * TCL_
a8e0: 4f 4e 45 5f 57 4f 52 44 5f 4b 45 59 53 3a 09 09  ONE_WORD_KEYS:..
a8f0: 54 68 65 20 6b 65 79 73 20 61 72 65 20 70 6f 69  The keys are poi
a900: 6e 74 65 72 73 2c 20 74 68 65 20 70 6f 69 6e 74  nters, the point
a910: 65 72 20 69 73 20 73 74 6f 72 65 64 0a 20 2a 09  er is stored. *.
a920: 09 09 09 69 6e 20 74 68 65 20 65 6e 74 72 79 2e  ...in the entry.
a930: 0a 20 2a 20 54 43 4c 5f 43 55 53 54 4f 4d 5f 54  . * TCL_CUSTOM_T
a940: 59 50 45 5f 4b 45 59 53 3a 09 54 68 65 20 6b 65  YPE_KEYS:.The ke
a950: 79 73 20 61 72 65 20 61 72 62 69 74 72 61 72 79  ys are arbitrary
a960: 20 74 79 70 65 73 20 77 68 69 63 68 20 61 72 65   types which are
a970: 20 63 6f 70 69 65 64 0a 20 2a 09 09 09 09 69 6e   copied. *....in
a980: 74 6f 20 74 68 65 20 65 6e 74 72 79 2e 0a 20 2a  to the entry.. *
a990: 20 54 43 4c 5f 43 55 53 54 4f 4d 5f 50 54 52 5f   TCL_CUSTOM_PTR_
a9a0: 4b 45 59 53 3a 09 09 54 68 65 20 6b 65 79 73 20  KEYS:..The keys 
a9b0: 61 72 65 20 70 6f 69 6e 74 65 72 73 20 74 6f 20  are pointers to 
a9c0: 61 72 62 69 74 72 61 72 79 20 74 79 70 65 73 2c  arbitrary types,
a9d0: 20 74 68 65 0a 20 2a 09 09 09 09 70 6f 69 6e 74   the. *....point
a9e0: 65 72 20 69 73 20 73 74 6f 72 65 64 20 69 6e 20  er is stored in 
a9f0: 74 68 65 20 65 6e 74 72 79 2e 0a 20 2a 0a 20 2a  the entry.. *. *
aa00: 20 57 68 69 6c 65 20 6d 61 69 6e 74 61 69 6e 69   While maintaini
aa10: 6e 67 20 62 69 6e 61 72 79 20 63 6f 6d 70 61 74  ng binary compat
aa20: 69 62 69 6c 69 74 79 20 74 68 65 20 61 62 6f 76  ibility the abov
aa30: 65 20 68 61 76 65 20 74 6f 20 62 65 20 64 69 73  e have to be dis
aa40: 74 69 6e 63 74 20 76 61 6c 75 65 73 0a 20 2a 20  tinct values. * 
aa50: 61 73 20 74 68 65 79 20 61 72 65 20 75 73 65 64  as they are used
aa60: 20 74 6f 20 64 69 66 66 65 72 65 6e 74 69 61 74   to differentiat
aa70: 65 20 62 65 74 77 65 65 6e 20 6f 6c 64 20 76 65  e between old ve
aa80: 72 73 69 6f 6e 73 20 6f 66 20 74 68 65 20 68 61  rsions of the ha
aa90: 73 68 20 74 61 62 6c 65 0a 20 2a 20 77 68 69 63  sh table. * whic
aaa0: 68 20 64 6f 6e 27 74 20 68 61 76 65 20 61 20 74  h don't have a t
aab0: 79 70 65 50 74 72 20 61 6e 64 20 6e 65 77 20 6f  ypePtr and new o
aac0: 6e 65 73 20 77 68 69 63 68 20 64 6f 2e 20 4f 6e  nes which do. On
aad0: 63 65 20 62 69 6e 61 72 79 20 63 6f 6d 70 61 74  ce binary compat
aae0: 69 62 69 6c 69 74 79 0a 20 2a 20 69 73 20 64 69  ibility. * is di
aaf0: 73 63 61 72 64 65 64 20 69 6e 20 66 61 76 6f 75  scarded in favou
ab00: 72 20 6f 66 20 6d 61 6b 69 6e 67 20 6d 6f 72 65  r of making more
ab10: 20 77 69 64 65 20 73 70 72 65 61 64 20 63 68 61   wide spread cha
ab20: 6e 67 65 73 20 54 43 4c 5f 53 54 52 49 4e 47 5f  nges TCL_STRING_
ab30: 4b 45 59 53 0a 20 2a 20 63 61 6e 20 62 65 20 74  KEYS. * can be t
ab40: 68 65 20 73 61 6d 65 20 61 73 20 54 43 4c 5f 43  he same as TCL_C
ab50: 55 53 54 4f 4d 5f 54 59 50 45 5f 4b 45 59 53 2c  USTOM_TYPE_KEYS,
ab60: 20 61 6e 64 20 54 43 4c 5f 4f 4e 45 5f 57 4f 52   and TCL_ONE_WOR
ab70: 44 5f 4b 45 59 53 20 63 61 6e 20 62 65 20 74 68  D_KEYS can be th
ab80: 65 0a 20 2a 20 73 61 6d 65 20 61 73 20 54 43 4c  e. * same as TCL
ab90: 5f 43 55 53 54 4f 4d 5f 50 54 52 5f 4b 45 59 53  _CUSTOM_PTR_KEYS
aba0: 20 62 65 63 61 75 73 65 20 74 68 65 79 20 73 69   because they si
abb0: 6d 70 6c 79 20 64 65 74 65 72 6d 69 6e 65 20 68  mply determine h
abc0: 6f 77 20 74 68 65 20 6b 65 79 20 69 73 0a 20 2a  ow the key is. *
abd0: 20 61 63 63 65 73 73 65 64 20 66 72 6f 6d 20 74   accessed from t
abe0: 68 65 20 65 6e 74 72 79 20 61 6e 64 20 6e 6f 74  he entry and not
abf0: 20 74 68 65 20 62 65 68 61 76 69 6f 75 72 2e 0a   the behaviour..
ac00: 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c   */..#define TCL
ac10: 5f 53 54 52 49 4e 47 5f 4b 45 59 53 09 09 28 30  _STRING_KEYS..(0
ac20: 29 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4f 4e  ).#define TCL_ON
ac30: 45 5f 57 4f 52 44 5f 4b 45 59 53 09 28 31 29 0a  E_WORD_KEYS.(1).
ac40: 23 64 65 66 69 6e 65 20 54 43 4c 5f 43 55 53 54  #define TCL_CUST
ac50: 4f 4d 5f 54 59 50 45 5f 4b 45 59 53 09 28 2d 32  OM_TYPE_KEYS.(-2
ac60: 29 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 43 55  ).#define TCL_CU
ac70: 53 54 4f 4d 5f 50 54 52 5f 4b 45 59 53 09 28 2d  STOM_PTR_KEYS.(-
ac80: 31 29 0a 0a 2f 2a 0a 20 2a 20 53 74 72 75 63 74  1)../*. * Struct
ac90: 75 72 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 66  ure definition f
aca0: 6f 72 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 75  or information u
acb0: 73 65 64 20 74 6f 20 6b 65 65 70 20 74 72 61 63  sed to keep trac
acc0: 6b 20 6f 66 20 73 65 61 72 63 68 65 73 20 74 68  k of searches th
acd0: 72 6f 75 67 68 0a 20 2a 20 64 69 63 74 69 6f 6e  rough. * diction
ace0: 61 72 69 65 73 2e 20 54 68 65 73 65 20 66 69 65  aries. These fie
acf0: 6c 64 73 20 73 68 6f 75 6c 64 20 6e 6f 74 20 62  lds should not b
ad00: 65 20 61 63 63 65 73 73 65 64 20 62 79 20 63 6f  e accessed by co
ad10: 64 65 20 6f 75 74 73 69 64 65 0a 20 2a 20 74 63  de outside. * tc
ad20: 6c 44 69 63 74 4f 62 6a 2e 63 0a 20 2a 2f 0a 0a  lDictObj.c. */..
ad30: 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20 7b  typedef struct {
ad40: 0a 20 20 20 20 76 6f 69 64 20 2a 6e 65 78 74 3b  .    void *next;
ad50: 09 09 09 2f 2a 20 53 65 61 72 63 68 20 70 6f 73  .../* Search pos
ad60: 69 74 69 6f 6e 20 66 6f 72 20 75 6e 64 65 72 6c  ition for underl
ad70: 79 69 6e 67 20 68 61 73 68 0a 09 09 09 09 20 2a  ying hash..... *
ad80: 20 74 61 62 6c 65 2e 20 2a 2f 0a 20 20 20 20 73   table. */.    s
ad90: 69 7a 65 5f 74 20 65 70 6f 63 68 3b 09 09 2f 2a  ize_t epoch;../*
ada0: 20 45 70 6f 63 68 20 6d 61 72 6b 65 72 20 66 6f   Epoch marker fo
adb0: 72 20 64 69 63 74 69 6f 6e 61 72 79 20 62 65 69  r dictionary bei
adc0: 6e 67 20 73 65 61 72 63 68 65 64 2c 0a 09 09 09  ng searched,....
add0: 09 20 2a 20 6f 72 20 30 20 69 66 20 73 65 61 72  . * or 0 if sear
ade0: 63 68 20 68 61 73 20 74 65 72 6d 69 6e 61 74 65  ch has terminate
adf0: 64 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 44 69  d. */.    Tcl_Di
ae00: 63 74 20 64 69 63 74 69 6f 6e 61 72 79 50 74 72  ct dictionaryPtr
ae10: 3b 09 2f 2a 20 52 65 66 65 72 65 6e 63 65 20 74  ;./* Reference t
ae20: 6f 20 64 69 63 74 69 6f 6e 61 72 79 20 62 65 69  o dictionary bei
ae30: 6e 67 20 73 65 61 72 63 68 65 64 2e 20 2a 2f 0a  ng searched. */.
ae40: 7d 20 54 63 6c 5f 44 69 63 74 53 65 61 72 63 68  } Tcl_DictSearch
ae50: 3b 0a 0c 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d  ;.../*. *-------
ae60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
ae70: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
ae80: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
ae90: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
aea0: 2d 2d 2d 2d 2d 0a 20 2a 20 46 6c 61 67 20 76 61  -----. * Flag va
aeb0: 6c 75 65 73 20 74 6f 20 70 61 73 73 20 74 6f 20  lues to pass to 
aec0: 54 63 6c 5f 44 6f 4f 6e 65 45 76 65 6e 74 20 74  Tcl_DoOneEvent t
aed0: 6f 20 64 69 73 61 62 6c 65 20 73 65 61 72 63 68  o disable search
aee0: 65 73 20 66 6f 72 20 73 6f 6d 65 20 6b 69 6e 64  es for some kind
aef0: 73 20 6f 66 0a 20 2a 20 65 76 65 6e 74 73 3a 0a  s of. * events:.
af00: 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c   */..#define TCL
af10: 5f 44 4f 4e 54 5f 57 41 49 54 09 09 28 31 3c 3c  _DONT_WAIT..(1<<
af20: 31 29 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 57  1).#define TCL_W
af30: 49 4e 44 4f 57 5f 45 56 45 4e 54 53 09 28 31 3c  INDOW_EVENTS.(1<
af40: 3c 32 29 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f  <2).#define TCL_
af50: 46 49 4c 45 5f 45 56 45 4e 54 53 09 09 28 31 3c  FILE_EVENTS..(1<
af60: 3c 33 29 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f  <3).#define TCL_
af70: 54 49 4d 45 52 5f 45 56 45 4e 54 53 09 28 31 3c  TIMER_EVENTS.(1<
af80: 3c 34 29 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f  <4).#define TCL_
af90: 49 44 4c 45 5f 45 56 45 4e 54 53 09 09 28 31 3c  IDLE_EVENTS..(1<
afa0: 3c 35 29 09 2f 2a 20 57 41 53 20 30 78 31 30 20  <5)./* WAS 0x10 
afb0: 3f 3f 3f 3f 20 2a 2f 0a 23 64 65 66 69 6e 65 20  ???? */.#define 
afc0: 54 43 4c 5f 41 4c 4c 5f 45 56 45 4e 54 53 09 09  TCL_ALL_EVENTS..
afd0: 28 7e 54 43 4c 5f 44 4f 4e 54 5f 57 41 49 54 29  (~TCL_DONT_WAIT)
afe0: 0a 0a 2f 2a 0a 20 2a 20 54 68 65 20 66 6f 6c 6c  ../*. * The foll
aff0: 6f 77 69 6e 67 20 73 74 72 75 63 74 75 72 65 20  owing structure 
b000: 64 65 66 69 6e 65 73 20 61 20 67 65 6e 65 72 69  defines a generi
b010: 63 20 65 76 65 6e 74 20 66 6f 72 20 74 68 65 20  c event for the 
b020: 54 63 6c 20 65 76 65 6e 74 20 73 79 73 74 65 6d  Tcl event system
b030: 2e 0a 20 2a 20 54 68 65 73 65 20 61 72 65 20 74  .. * These are t
b040: 68 65 20 74 68 69 6e 67 73 20 74 68 61 74 20 61  he things that a
b050: 72 65 20 71 75 65 75 65 64 20 69 6e 20 63 61 6c  re queued in cal
b060: 6c 73 20 74 6f 20 54 63 6c 5f 51 75 65 75 65 45  ls to Tcl_QueueE
b070: 76 65 6e 74 20 61 6e 64 0a 20 2a 20 73 65 72 76  vent and. * serv
b080: 69 63 65 64 20 6c 61 74 65 72 20 62 79 20 54 63  iced later by Tc
b090: 6c 5f 44 6f 4f 6e 65 45 76 65 6e 74 2e 20 54 68  l_DoOneEvent. Th
b0a0: 65 72 65 20 63 61 6e 20 62 65 20 6d 61 6e 79 20  ere can be many 
b0b0: 64 69 66 66 65 72 65 6e 74 20 6b 69 6e 64 73 20  different kinds 
b0c0: 6f 66 0a 20 2a 20 65 76 65 6e 74 73 20 77 69 74  of. * events wit
b0d0: 68 20 64 69 66 66 65 72 65 6e 74 20 66 69 65 6c  h different fiel
b0e0: 64 73 2c 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e  ds, correspondin
b0f0: 67 20 74 6f 20 77 69 6e 64 6f 77 20 65 76 65 6e  g to window even
b100: 74 73 2c 20 74 69 6d 65 72 20 65 76 65 6e 74 73  ts, timer events
b110: 2c 0a 20 2a 20 65 74 63 2e 20 54 68 65 20 73 74  ,. * etc. The st
b120: 72 75 63 74 75 72 65 20 66 6f 72 20 61 20 70 61  ructure for a pa
b130: 72 74 69 63 75 6c 61 72 20 65 76 65 6e 74 20 63  rticular event c
b140: 6f 6e 73 69 73 74 73 20 6f 66 20 61 20 54 63 6c  onsists of a Tcl
b150: 5f 45 76 65 6e 74 20 68 65 61 64 65 72 0a 20 2a  _Event header. *
b160: 20 66 6f 6c 6c 6f 77 65 64 20 62 79 20 61 64 64   followed by add
b170: 69 74 69 6f 6e 61 6c 20 69 6e 66 6f 72 6d 61 74  itional informat
b180: 69 6f 6e 20 73 70 65 63 69 66 69 63 20 74 6f 20  ion specific to 
b190: 74 68 61 74 20 65 76 65 6e 74 2e 0a 20 2a 2f 0a  that event.. */.
b1a0: 0a 73 74 72 75 63 74 20 54 63 6c 5f 45 76 65 6e  .struct Tcl_Even
b1b0: 74 20 7b 0a 20 20 20 20 54 63 6c 5f 45 76 65 6e  t {.    Tcl_Even
b1c0: 74 50 72 6f 63 20 2a 70 72 6f 63 3b 09 2f 2a 20  tProc *proc;./* 
b1d0: 46 75 6e 63 74 69 6f 6e 20 74 6f 20 63 61 6c 6c  Function to call
b1e0: 20 74 6f 20 73 65 72 76 69 63 65 20 74 68 69 73   to service this
b1f0: 20 65 76 65 6e 74 2e 20 2a 2f 0a 20 20 20 20 73   event. */.    s
b200: 74 72 75 63 74 20 54 63 6c 5f 45 76 65 6e 74 20  truct Tcl_Event 
b210: 2a 6e 65 78 74 50 74 72 3b 09 2f 2a 20 4e 65 78  *nextPtr;./* Nex
b220: 74 20 69 6e 20 6c 69 73 74 20 6f 66 20 70 65 6e  t in list of pen
b230: 64 69 6e 67 20 65 76 65 6e 74 73 2c 20 6f 72 20  ding events, or 
b240: 4e 55 4c 4c 2e 20 2a 2f 0a 7d 3b 0a 0a 2f 2a 0a  NULL. */.};../*.
b250: 20 2a 20 50 6f 73 69 74 69 6f 6e 73 20 74 6f 20   * Positions to 
b260: 70 61 73 73 20 74 6f 20 54 63 6c 5f 51 75 65 75  pass to Tcl_Queu
b270: 65 45 76 65 6e 74 2f 54 63 6c 5f 54 68 72 65 61  eEvent/Tcl_Threa
b280: 64 51 75 65 75 65 45 76 65 6e 74 3a 0a 20 2a 2f  dQueueEvent:. */
b290: 0a 0a 74 79 70 65 64 65 66 20 65 6e 75 6d 20 7b  ..typedef enum {
b2a0: 0a 20 20 20 20 54 43 4c 5f 51 55 45 55 45 5f 54  .    TCL_QUEUE_T
b2b0: 41 49 4c 2c 20 54 43 4c 5f 51 55 45 55 45 5f 48  AIL, TCL_QUEUE_H
b2c0: 45 41 44 2c 20 54 43 4c 5f 51 55 45 55 45 5f 4d  EAD, TCL_QUEUE_M
b2d0: 41 52 4b 2c 0a 20 20 20 20 54 43 4c 5f 51 55 45  ARK,.    TCL_QUE
b2e0: 55 45 5f 41 4c 45 52 54 5f 49 46 5f 45 4d 50 54  UE_ALERT_IF_EMPT
b2f0: 59 3d 34 0a 7d 20 54 63 6c 5f 51 75 65 75 65 50  Y=4.} Tcl_QueueP
b300: 6f 73 69 74 69 6f 6e 3b 0a 0a 2f 2a 0a 20 2a 20  osition;../*. * 
b310: 56 61 6c 75 65 73 20 74 6f 20 70 61 73 73 20 74  Values to pass t
b320: 6f 20 54 63 6c 5f 53 65 74 53 65 72 76 69 63 65  o Tcl_SetService
b330: 4d 6f 64 65 20 74 6f 20 73 70 65 63 69 66 79 20  Mode to specify 
b340: 74 68 65 20 62 65 68 61 76 69 6f 72 20 6f 66 20  the behavior of 
b350: 6e 6f 74 69 66 69 65 72 0a 20 2a 20 65 76 65 6e  notifier. * even
b360: 74 20 72 6f 75 74 69 6e 65 73 2e 0a 20 2a 2f 0a  t routines.. */.
b370: 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 53 45 52  .#define TCL_SER
b380: 56 49 43 45 5f 4e 4f 4e 45 20 30 0a 23 64 65 66  VICE_NONE 0.#def
b390: 69 6e 65 20 54 43 4c 5f 53 45 52 56 49 43 45 5f  ine TCL_SERVICE_
b3a0: 41 4c 4c 20 31 0a 0a 2f 2a 0a 20 2a 20 54 68 65  ALL 1../*. * The
b3b0: 20 66 6f 6c 6c 6f 77 69 6e 67 20 73 74 72 75 63   following struc
b3c0: 74 75 72 65 20 6b 65 65 70 73 20 69 73 20 75 73  ture keeps is us
b3d0: 65 64 20 74 6f 20 68 6f 6c 64 20 61 20 74 69 6d  ed to hold a tim
b3e0: 65 20 76 61 6c 75 65 2c 20 65 69 74 68 65 72 20  e value, either 
b3f0: 61 73 20 61 6e 0a 20 2a 20 61 62 73 6f 6c 75 74  as an. * absolut
b400: 65 20 74 69 6d 65 20 28 74 68 65 20 6e 75 6d 62  e time (the numb
b410: 65 72 20 6f 66 20 73 65 63 6f 6e 64 73 20 66 72  er of seconds fr
b420: 6f 6d 20 74 68 65 20 65 70 6f 63 68 29 20 6f 72  om the epoch) or
b430: 20 61 73 20 61 6e 20 65 6c 61 70 73 65 64 20 74   as an elapsed t
b440: 69 6d 65 2e 0a 20 2a 20 4f 6e 20 55 6e 69 78 20  ime.. * On Unix 
b450: 73 79 73 74 65 6d 73 20 74 68 65 20 65 70 6f 63  systems the epoc
b460: 68 20 69 73 20 4d 69 64 6e 69 67 68 74 20 4a 61  h is Midnight Ja
b470: 6e 20 31 2c 20 31 39 37 30 20 47 4d 54 2e 0a 20  n 1, 1970 GMT.. 
b480: 2a 2f 0a 0a 74 79 70 65 64 65 66 20 73 74 72 75  */..typedef stru
b490: 63 74 20 54 63 6c 5f 54 69 6d 65 20 7b 0a 20 20  ct Tcl_Time {.  
b4a0: 20 20 6c 6f 6e 67 20 6c 6f 6e 67 20 73 65 63 3b    long long sec;
b4b0: 09 09 2f 2a 20 53 65 63 6f 6e 64 73 2e 20 2a 2f  ../* Seconds. */
b4c0: 0a 23 69 66 20 64 65 66 69 6e 65 64 28 5f 43 59  .#if defined(_CY
b4d0: 47 57 49 4e 5f 29 0a 20 20 20 20 69 6e 74 20 75  GWIN_).    int u
b4e0: 73 65 63 3b 09 09 09 2f 2a 20 4d 69 63 72 6f 73  sec;.../* Micros
b4f0: 65 63 6f 6e 64 73 2e 20 2a 2f 0a 23 65 6c 73 65  econds. */.#else
b500: 0a 20 20 20 20 6c 6f 6e 67 20 75 73 65 63 3b 09  .    long usec;.
b510: 09 09 2f 2a 20 4d 69 63 72 6f 73 65 63 6f 6e 64  ../* Microsecond
b520: 73 2e 20 2a 2f 0a 23 65 6e 64 69 66 0a 7d 20 54  s. */.#endif.} T
b530: 63 6c 5f 54 69 6d 65 3b 0a 0a 74 79 70 65 64 65  cl_Time;..typede
b540: 66 20 76 6f 69 64 20 28 54 63 6c 5f 53 65 74 54  f void (Tcl_SetT
b550: 69 6d 65 72 50 72 6f 63 29 20 28 63 6f 6e 73 74  imerProc) (const
b560: 20 54 63 6c 5f 54 69 6d 65 20 2a 74 69 6d 65 50   Tcl_Time *timeP
b570: 74 72 29 3b 0a 74 79 70 65 64 65 66 20 69 6e 74  tr);.typedef int
b580: 20 28 54 63 6c 5f 57 61 69 74 46 6f 72 45 76 65   (Tcl_WaitForEve
b590: 6e 74 50 72 6f 63 29 20 28 63 6f 6e 73 74 20 54  ntProc) (const T
b5a0: 63 6c 5f 54 69 6d 65 20 2a 74 69 6d 65 50 74 72  cl_Time *timePtr
b5b0: 29 3b 0a 0a 2f 2a 0a 20 2a 20 54 49 50 20 23 32  );../*. * TIP #2
b5c0: 33 33 20 28 56 69 72 74 75 61 6c 69 7a 65 64 20  33 (Virtualized 
b5d0: 54 69 6d 65 29 0a 20 2a 20 57 41 52 4e 49 4e 47  Time). * WARNING
b5e0: 3a 20 66 75 6e 63 74 69 6f 6e 61 6c 69 74 79 20  : functionality 
b5f0: 72 65 6d 6f 76 65 64 2c 20 63 61 6c 6c 73 20 54  removed, calls T
b600: 63 6c 5f 50 61 6e 69 63 0a 20 2a 2f 0a 0a 23 69  cl_Panic. */..#i
b610: 66 6e 64 65 66 20 54 43 4c 5f 4e 4f 5f 44 45 50  fndef TCL_NO_DEP
b620: 52 45 43 41 54 45 44 0a 74 79 70 65 64 65 66 20  RECATED.typedef 
b630: 76 6f 69 64 20 28 54 63 6c 5f 47 65 74 54 69 6d  void (Tcl_GetTim
b640: 65 50 72 6f 63 29 20 20 20 28 54 63 6c 5f 54 69  eProc)   (Tcl_Ti
b650: 6d 65 20 2a 74 69 6d 65 62 75 66 2c 20 76 6f 69  me *timebuf, voi
b660: 64 20 2a 63 6c 69 65 6e 74 44 61 74 61 29 3b 0a  d *clientData);.
b670: 74 79 70 65 64 65 66 20 76 6f 69 64 20 28 54 63  typedef void (Tc
b680: 6c 5f 53 63 61 6c 65 54 69 6d 65 50 72 6f 63 29  l_ScaleTimeProc)
b690: 20 28 54 63 6c 5f 54 69 6d 65 20 2a 74 69 6d 65   (Tcl_Time *time
b6a0: 62 75 66 2c 20 76 6f 69 64 20 2a 63 6c 69 65 6e  buf, void *clien
b6b0: 74 44 61 74 61 29 3b 0a 23 65 6e 64 69 66 20 2f  tData);.#endif /
b6c0: 2a 20 54 43 4c 5f 4e 4f 5f 44 45 50 52 45 43 41  * TCL_NO_DEPRECA
b6d0: 54 45 44 20 2a 2f 0a 0a 2f 2a 0a 20 2a 20 54 49  TED */../*. * TI
b6e0: 50 20 23 37 32 33 20 28 4d 6f 6e 6f 74 6f 6e 69  P #723 (Monotoni
b6f0: 63 20 54 69 6d 65 29 0a 20 2a 2f 0a 0a 74 79 70  c Time). */..typ
b700: 65 64 65 66 20 6c 6f 6e 67 20 6c 6f 6e 67 20 28  edef long long (
b710: 54 63 6c 5f 47 65 74 4d 6f 6e 6f 74 6f 6e 69 63  Tcl_GetMonotonic
b720: 54 69 6d 65 50 72 6f 63 29 20 20 20 28 76 6f 69  TimeProc)   (voi
b730: 64 20 2a 63 6c 69 65 6e 74 44 61 74 61 29 3b 0a  d *clientData);.
b740: 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ./*. *----------
b750: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
b760: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
b770: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
b780: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
b790: 2d 2d 0a 20 2a 20 42 69 74 73 20 74 6f 20 70 61  --. * Bits to pa
b7a0: 73 73 20 74 6f 20 54 63 6c 5f 43 72 65 61 74 65  ss to Tcl_Create
b7b0: 46 69 6c 65 48 61 6e 64 6c 65 72 20 61 6e 64 20  FileHandler and 
b7c0: 54 63 6c 5f 43 72 65 61 74 65 43 68 61 6e 6e 65  Tcl_CreateChanne
b7d0: 6c 48 61 6e 64 6c 65 72 20 74 6f 0a 20 2a 20 69  lHandler to. * i
b7e0: 6e 64 69 63 61 74 65 20 77 68 61 74 20 73 6f 72  ndicate what sor
b7f0: 74 73 20 6f 66 20 65 76 65 6e 74 73 20 61 72 65  ts of events are
b800: 20 6f 66 20 69 6e 74 65 72 65 73 74 3a 0a 20 2a   of interest:. *
b810: 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 52  /..#define TCL_R
b820: 45 41 44 41 42 4c 45 09 09 28 31 3c 3c 31 29 0a  EADABLE..(1<<1).
b830: 23 64 65 66 69 6e 65 20 54 43 4c 5f 57 52 49 54  #define TCL_WRIT
b840: 41 42 4c 45 09 09 28 31 3c 3c 32 29 0a 23 64 65  ABLE..(1<<2).#de
b850: 66 69 6e 65 20 54 43 4c 5f 45 58 43 45 50 54 49  fine TCL_EXCEPTI
b860: 4f 4e 09 09 28 31 3c 3c 33 29 0a 0a 2f 2a 0a 20  ON..(1<<3)../*. 
b870: 2a 20 46 6c 61 67 20 76 61 6c 75 65 73 20 74 6f  * Flag values to
b880: 20 70 61 73 73 20 74 6f 20 54 63 6c 5f 4f 70 65   pass to Tcl_Ope
b890: 6e 43 6f 6d 6d 61 6e 64 43 68 61 6e 6e 65 6c 20  nCommandChannel 
b8a0: 74 6f 20 69 6e 64 69 63 61 74 65 20 74 68 65 20  to indicate the 
b8b0: 64 69 73 70 6f 73 69 74 69 6f 6e 0a 20 2a 20 6f  disposition. * o
b8c0: 66 20 74 68 65 20 73 74 64 69 6f 20 68 61 6e 64  f the stdio hand
b8d0: 6c 65 73 2e 20 54 43 4c 5f 53 54 44 49 4e 2c 20  les. TCL_STDIN, 
b8e0: 54 43 4c 5f 53 54 44 4f 55 54 2c 20 54 43 4c 5f  TCL_STDOUT, TCL_
b8f0: 53 54 44 45 52 52 2c 20 61 72 65 20 61 6c 73 6f  STDERR, are also
b900: 20 75 73 65 64 20 69 6e 0a 20 2a 20 54 63 6c 5f   used in. * Tcl_
b910: 47 65 74 53 74 64 43 68 61 6e 6e 65 6c 2e 0a 20  GetStdChannel.. 
b920: 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f  */..#define TCL_
b930: 53 54 44 49 4e 09 09 28 31 3c 3c 31 29 0a 23 64  STDIN..(1<<1).#d
b940: 65 66 69 6e 65 20 54 43 4c 5f 53 54 44 4f 55 54  efine TCL_STDOUT
b950: 09 09 28 31 3c 3c 32 29 0a 23 64 65 66 69 6e 65  ..(1<<2).#define
b960: 20 54 43 4c 5f 53 54 44 45 52 52 09 09 28 31 3c   TCL_STDERR..(1<
b970: 3c 33 29 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f  <3).#define TCL_
b980: 45 4e 46 4f 52 43 45 5f 4d 4f 44 45 09 28 31 3c  ENFORCE_MODE.(1<
b990: 3c 34 29 0a 0a 2f 2a 0a 20 2a 20 42 69 74 73 20  <4)../*. * Bits 
b9a0: 70 61 73 73 65 64 20 74 6f 20 54 63 6c 5f 44 72  passed to Tcl_Dr
b9b0: 69 76 65 72 43 6c 6f 73 65 32 50 72 6f 63 20 74  iverClose2Proc t
b9c0: 6f 20 69 6e 64 69 63 61 74 65 20 77 68 69 63 68  o indicate which
b9d0: 20 73 69 64 65 20 6f 66 20 61 20 63 68 61 6e 6e   side of a chann
b9e0: 65 6c 0a 20 2a 20 73 68 6f 75 6c 64 20 62 65 20  el. * should be 
b9f0: 63 6c 6f 73 65 64 2e 0a 20 2a 2f 0a 0a 23 64 65  closed.. */..#de
ba00: 66 69 6e 65 20 54 43 4c 5f 43 4c 4f 53 45 5f 52  fine TCL_CLOSE_R
ba10: 45 41 44 09 09 28 31 3c 3c 31 29 0a 23 64 65 66  EAD..(1<<1).#def
ba20: 69 6e 65 20 54 43 4c 5f 43 4c 4f 53 45 5f 57 52  ine TCL_CLOSE_WR
ba30: 49 54 45 09 09 28 31 3c 3c 32 29 0a 0a 2f 2a 0a  ITE..(1<<2)../*.
ba40: 20 2a 20 56 61 6c 75 65 20 74 6f 20 75 73 65 20   * Value to use 
ba50: 61 73 20 74 68 65 20 63 6c 6f 73 65 50 72 6f 63  as the closeProc
ba60: 20 66 6f 72 20 61 20 63 68 61 6e 6e 65 6c 20 74   for a channel t
ba70: 68 61 74 20 73 75 70 70 6f 72 74 73 20 74 68 65  hat supports the
ba80: 20 63 6c 6f 73 65 32 50 72 6f 63 0a 20 2a 20 69   close2Proc. * i
ba90: 6e 74 65 72 66 61 63 65 2e 0a 20 2a 2f 0a 0a 23  nterface.. */..#
baa0: 64 65 66 69 6e 65 20 54 43 4c 5f 43 4c 4f 53 45  define TCL_CLOSE
bab0: 32 50 52 4f 43 09 09 4e 55 4c 4c 0a 0a 2f 2a 0a  2PROC..NULL../*.
bac0: 20 2a 20 43 68 61 6e 6e 65 6c 20 76 65 72 73 69   * Channel versi
bad0: 6f 6e 20 74 61 67 2e 20 54 68 69 73 20 77 61 73  on tag. This was
bae0: 20 69 6e 74 72 6f 64 75 63 65 64 20 69 6e 20 38   introduced in 8
baf0: 2e 33 2e 32 2f 38 2e 34 2e 0a 20 2a 2f 0a 0a 23  .3.2/8.4.. */..#
bb00: 64 65 66 69 6e 65 20 54 43 4c 5f 43 48 41 4e 4e  define TCL_CHANN
bb10: 45 4c 5f 56 45 52 53 49 4f 4e 5f 35 09 28 28 54  EL_VERSION_5.((T
bb20: 63 6c 5f 43 68 61 6e 6e 65 6c 54 79 70 65 56 65  cl_ChannelTypeVe
bb30: 72 73 69 6f 6e 29 20 30 78 35 29 0a 0a 2f 2a 0a  rsion) 0x5)../*.
bb40: 20 2a 20 54 49 50 20 23 32 31 38 3a 20 43 68 61   * TIP #218: Cha
bb50: 6e 6e 65 6c 20 41 63 74 69 6f 6e 73 2c 20 49 64  nnel Actions, Id
bb60: 73 20 66 6f 72 20 54 63 6c 5f 44 72 69 76 65 72  s for Tcl_Driver
bb70: 54 68 72 65 61 64 41 63 74 69 6f 6e 50 72 6f 63  ThreadActionProc
bb80: 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54  .. */..#define T
bb90: 43 4c 5f 43 48 41 4e 4e 45 4c 5f 54 48 52 45 41  CL_CHANNEL_THREA
bba0: 44 5f 49 4e 53 45 52 54 20 28 30 29 0a 23 64 65  D_INSERT (0).#de
bbb0: 66 69 6e 65 20 54 43 4c 5f 43 48 41 4e 4e 45 4c  fine TCL_CHANNEL
bbc0: 5f 54 48 52 45 41 44 5f 52 45 4d 4f 56 45 20 28  _THREAD_REMOVE (
bbd0: 31 29 0a 0a 2f 2a 0a 20 2a 20 54 79 70 65 64 65  1)../*. * Typede
bbe0: 66 73 20 66 6f 72 20 74 68 65 20 76 61 72 69 6f  fs for the vario
bbf0: 75 73 20 6f 70 65 72 61 74 69 6f 6e 73 20 69 6e  us operations in
bc00: 20 61 20 63 68 61 6e 6e 65 6c 20 74 79 70 65 3a   a channel type:
bc10: 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 69 6e  . */..typedef in
bc20: 74 09 28 54 63 6c 5f 44 72 69 76 65 72 42 6c 6f  t.(Tcl_DriverBlo
bc30: 63 6b 4d 6f 64 65 50 72 6f 63 29 20 28 76 6f 69  ckModeProc) (voi
bc40: 64 20 2a 69 6e 73 74 61 6e 63 65 44 61 74 61 2c  d *instanceData,
bc50: 20 69 6e 74 20 6d 6f 64 65 29 3b 0a 74 79 70 65   int mode);.type
bc60: 64 65 66 20 76 6f 69 64 20 54 63 6c 5f 44 72 69  def void Tcl_Dri
bc70: 76 65 72 43 6c 6f 73 65 50 72 6f 63 3b 0a 74 79  verCloseProc;.ty
bc80: 70 65 64 65 66 20 69 6e 74 09 28 54 63 6c 5f 44  pedef int.(Tcl_D
bc90: 72 69 76 65 72 43 6c 6f 73 65 32 50 72 6f 63 29  riverClose2Proc)
bca0: 20 28 76 6f 69 64 20 2a 69 6e 73 74 61 6e 63 65   (void *instance
bcb0: 44 61 74 61 2c 0a 09 09 09 54 63 6c 5f 49 6e 74  Data,....Tcl_Int
bcc0: 65 72 70 20 2a 69 6e 74 65 72 70 2c 20 69 6e 74  erp *interp, int
bcd0: 20 66 6c 61 67 73 29 3b 0a 74 79 70 65 64 65 66   flags);.typedef
bce0: 20 69 6e 74 09 28 54 63 6c 5f 44 72 69 76 65 72   int.(Tcl_Driver
bcf0: 49 6e 70 75 74 50 72 6f 63 29 20 28 76 6f 69 64  InputProc) (void
bd00: 20 2a 69 6e 73 74 61 6e 63 65 44 61 74 61 2c 20   *instanceData, 
bd10: 63 68 61 72 20 2a 62 75 66 2c 0a 09 09 09 69 6e  char *buf,....in
bd20: 74 20 74 6f 52 65 61 64 2c 20 69 6e 74 20 2a 65  t toRead, int *e
bd30: 72 72 6f 72 43 6f 64 65 50 74 72 29 3b 0a 74 79  rrorCodePtr);.ty
bd40: 70 65 64 65 66 20 69 6e 74 09 28 54 63 6c 5f 44  pedef int.(Tcl_D
bd50: 72 69 76 65 72 4f 75 74 70 75 74 50 72 6f 63 29  riverOutputProc)
bd60: 20 28 76 6f 69 64 20 2a 69 6e 73 74 61 6e 63 65   (void *instance
bd70: 44 61 74 61 2c 0a 09 09 09 63 6f 6e 73 74 20 63  Data,....const c
bd80: 68 61 72 20 2a 62 75 66 2c 20 69 6e 74 20 74 6f  har *buf, int to
bd90: 57 72 69 74 65 2c 20 69 6e 74 20 2a 65 72 72 6f  Write, int *erro
bda0: 72 43 6f 64 65 50 74 72 29 3b 0a 74 79 70 65 64  rCodePtr);.typed
bdb0: 65 66 20 76 6f 69 64 20 54 63 6c 5f 44 72 69 76  ef void Tcl_Driv
bdc0: 65 72 53 65 65 6b 50 72 6f 63 3b 0a 74 79 70 65  erSeekProc;.type
bdd0: 64 65 66 20 69 6e 74 09 28 54 63 6c 5f 44 72 69  def int.(Tcl_Dri
bde0: 76 65 72 53 65 74 4f 70 74 69 6f 6e 50 72 6f 63  verSetOptionProc
bdf0: 29 20 28 76 6f 69 64 20 2a 69 6e 73 74 61 6e 63  ) (void *instanc
be00: 65 44 61 74 61 2c 0a 09 09 09 54 63 6c 5f 49 6e  eData,....Tcl_In
be10: 74 65 72 70 20 2a 69 6e 74 65 72 70 2c 20 63 6f  terp *interp, co
be20: 6e 73 74 20 63 68 61 72 20 2a 6f 70 74 69 6f 6e  nst char *option
be30: 4e 61 6d 65 2c 0a 09 09 09 63 6f 6e 73 74 20 63  Name,....const c
be40: 68 61 72 20 2a 76 61 6c 75 65 29 3b 0a 74 79 70  har *value);.typ
be50: 65 64 65 66 20 69 6e 74 09 28 54 63 6c 5f 44 72  edef int.(Tcl_Dr
be60: 69 76 65 72 47 65 74 4f 70 74 69 6f 6e 50 72 6f  iverGetOptionPro
be70: 63 29 20 28 76 6f 69 64 20 2a 69 6e 73 74 61 6e  c) (void *instan
be80: 63 65 44 61 74 61 2c 0a 09 09 09 54 63 6c 5f 49  ceData,....Tcl_I
be90: 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c 20 63  nterp *interp, c
bea0: 6f 6e 73 74 20 63 68 61 72 20 2a 6f 70 74 69 6f  onst char *optio
beb0: 6e 4e 61 6d 65 2c 0a 09 09 09 54 63 6c 5f 44 53  nName,....Tcl_DS
bec0: 74 72 69 6e 67 20 2a 64 73 50 74 72 29 3b 0a 74  tring *dsPtr);.t
bed0: 79 70 65 64 65 66 20 76 6f 69 64 09 28 54 63 6c  ypedef void.(Tcl
bee0: 5f 44 72 69 76 65 72 57 61 74 63 68 50 72 6f 63  _DriverWatchProc
bef0: 29 20 28 76 6f 69 64 20 2a 69 6e 73 74 61 6e 63  ) (void *instanc
bf00: 65 44 61 74 61 2c 20 69 6e 74 20 6d 61 73 6b 29  eData, int mask)
bf10: 3b 0a 74 79 70 65 64 65 66 20 69 6e 74 09 28 54  ;.typedef int.(T
bf20: 63 6c 5f 44 72 69 76 65 72 47 65 74 48 61 6e 64  cl_DriverGetHand
bf30: 6c 65 50 72 6f 63 29 20 28 76 6f 69 64 20 2a 69  leProc) (void *i
bf40: 6e 73 74 61 6e 63 65 44 61 74 61 2c 0a 09 09 09  nstanceData,....
bf50: 69 6e 74 20 64 69 72 65 63 74 69 6f 6e 2c 20 76  int direction, v
bf60: 6f 69 64 20 2a 2a 68 61 6e 64 6c 65 50 74 72 29  oid **handlePtr)
bf70: 3b 0a 74 79 70 65 64 65 66 20 69 6e 74 09 28 54  ;.typedef int.(T
bf80: 63 6c 5f 44 72 69 76 65 72 46 6c 75 73 68 50 72  cl_DriverFlushPr
bf90: 6f 63 29 20 28 76 6f 69 64 20 2a 69 6e 73 74 61  oc) (void *insta
bfa0: 6e 63 65 44 61 74 61 29 3b 0a 74 79 70 65 64 65  nceData);.typede
bfb0: 66 20 69 6e 74 09 28 54 63 6c 5f 44 72 69 76 65  f int.(Tcl_Drive
bfc0: 72 48 61 6e 64 6c 65 72 50 72 6f 63 29 20 28 76  rHandlerProc) (v
bfd0: 6f 69 64 20 2a 69 6e 73 74 61 6e 63 65 44 61 74  oid *instanceDat
bfe0: 61 2c 0a 09 09 09 69 6e 74 20 69 6e 74 65 72 65  a,....int intere
bff0: 73 74 4d 61 73 6b 29 3b 0a 74 79 70 65 64 65 66  stMask);.typedef
c000: 20 6c 6f 6e 67 20 6c 6f 6e 67 20 28 54 63 6c 5f   long long (Tcl_
c010: 44 72 69 76 65 72 57 69 64 65 53 65 65 6b 50 72  DriverWideSeekPr
c020: 6f 63 29 20 28 76 6f 69 64 20 2a 69 6e 73 74 61  oc) (void *insta
c030: 6e 63 65 44 61 74 61 2c 0a 09 09 09 6c 6f 6e 67  nceData,....long
c040: 20 6c 6f 6e 67 20 6f 66 66 73 65 74 2c 20 69 6e   long offset, in
c050: 74 20 6d 6f 64 65 2c 20 69 6e 74 20 2a 65 72 72  t mode, int *err
c060: 6f 72 43 6f 64 65 50 74 72 29 3b 0a 2f 2a 0a 20  orCodePtr);./*. 
c070: 2a 20 54 49 50 20 23 32 31 38 2c 20 43 68 61 6e  * TIP #218, Chan
c080: 6e 65 6c 20 54 68 72 65 61 64 20 41 63 74 69 6f  nel Thread Actio
c090: 6e 73 0a 20 2a 2f 0a 74 79 70 65 64 65 66 20 76  ns. */.typedef v
c0a0: 6f 69 64 09 28 54 63 6c 5f 44 72 69 76 65 72 54  oid.(Tcl_DriverT
c0b0: 68 72 65 61 64 41 63 74 69 6f 6e 50 72 6f 63 29  hreadActionProc)
c0c0: 20 28 76 6f 69 64 20 2a 69 6e 73 74 61 6e 63 65   (void *instance
c0d0: 44 61 74 61 2c 0a 09 09 09 69 6e 74 20 61 63 74  Data,....int act
c0e0: 69 6f 6e 29 3b 0a 2f 2a 0a 20 2a 20 54 49 50 20  ion);./*. * TIP 
c0f0: 23 32 30 38 2c 20 46 69 6c 65 20 54 72 75 6e 63  #208, File Trunc
c100: 61 74 69 6f 6e 20 28 65 74 63 2e 29 0a 20 2a 2f  ation (etc.). */
c110: 0a 74 79 70 65 64 65 66 20 69 6e 74 09 28 54 63  .typedef int.(Tc
c120: 6c 5f 44 72 69 76 65 72 54 72 75 6e 63 61 74 65  l_DriverTruncate
c130: 50 72 6f 63 29 20 28 76 6f 69 64 20 2a 69 6e 73  Proc) (void *ins
c140: 74 61 6e 63 65 44 61 74 61 2c 0a 09 09 09 6c 6f  tanceData,....lo
c150: 6e 67 20 6c 6f 6e 67 20 6c 65 6e 67 74 68 29 3b  ng long length);
c160: 0a 0a 2f 2a 0a 20 2a 20 73 74 72 75 63 74 20 54  ../*. * struct T
c170: 63 6c 5f 43 68 61 6e 6e 65 6c 54 79 70 65 3a 0a  cl_ChannelType:.
c180: 20 2a 0a 20 2a 20 4f 6e 65 20 73 75 63 68 20 73   *. * One such s
c190: 74 72 75 63 74 75 72 65 20 65 78 69 73 74 73 20  tructure exists 
c1a0: 66 6f 72 20 65 61 63 68 20 74 79 70 65 20 28 6b  for each type (k
c1b0: 69 6e 64 29 20 6f 66 20 63 68 61 6e 6e 65 6c 2e  ind) of channel.
c1c0: 20 49 74 20 63 6f 6c 6c 65 63 74 73 0a 20 2a 20   It collects. * 
c1d0: 74 6f 67 65 74 68 65 72 20 69 6e 20 6f 6e 65 20  together in one 
c1e0: 70 6c 61 63 65 20 61 6c 6c 20 74 68 65 20 66 75  place all the fu
c1f0: 6e 63 74 69 6f 6e 73 20 74 68 61 74 20 61 72 65  nctions that are
c200: 20 70 61 72 74 20 6f 66 20 74 68 65 20 73 70 65   part of the spe
c210: 63 69 66 69 63 0a 20 2a 20 63 68 61 6e 6e 65 6c  cific. * channel
c220: 20 74 79 70 65 2e 0a 20 2a 0a 20 2a 20 49 74 20   type.. *. * It 
c230: 69 73 20 72 65 63 6f 6d 6d 65 6e 64 20 74 68 61  is recommend tha
c240: 74 20 74 68 65 20 54 63 6c 5f 43 68 61 6e 6e 65  t the Tcl_Channe
c250: 6c 2a 20 66 75 6e 63 74 69 6f 6e 73 20 61 72 65  l* functions are
c260: 20 75 73 65 64 20 74 6f 20 61 63 63 65 73 73 20   used to access 
c270: 65 6c 65 6d 65 6e 74 73 0a 20 2a 20 6f 66 20 74  elements. * of t
c280: 68 69 73 20 73 74 72 75 63 74 75 72 65 2c 20 69  his structure, i
c290: 6e 73 74 65 61 64 20 6f 66 20 64 69 72 65 63 74  nstead of direct
c2a0: 20 61 63 63 65 73 73 69 6e 67 2e 0a 20 2a 2f 0a   accessing.. */.
c2b0: 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20  .typedef struct 
c2c0: 54 63 6c 5f 43 68 61 6e 6e 65 6c 54 79 70 65 20  Tcl_ChannelType 
c2d0: 7b 0a 20 20 20 20 63 6f 6e 73 74 20 63 68 61 72  {.    const char
c2e0: 20 2a 74 79 70 65 4e 61 6d 65 3b 09 2f 2a 20 54   *typeName;./* T
c2f0: 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 63  he name of the c
c300: 68 61 6e 6e 65 6c 20 74 79 70 65 20 69 6e 20 54  hannel type in T
c310: 63 6c 0a 09 09 09 09 20 2a 20 63 6f 6d 6d 61 6e  cl..... * comman
c320: 64 73 2e 20 54 68 69 73 20 73 74 6f 72 61 67 65  ds. This storage
c330: 20 69 73 20 6f 77 6e 65 64 20 62 79 20 63 68 61   is owned by cha
c340: 6e 6e 65 6c 0a 09 09 09 09 20 2a 20 74 79 70 65  nnel..... * type
c350: 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 43 68 61  . */.    Tcl_Cha
c360: 6e 6e 65 6c 54 79 70 65 56 65 72 73 69 6f 6e 20  nnelTypeVersion 
c370: 76 65 72 73 69 6f 6e 3b 0a 09 09 09 09 2f 2a 20  version;...../* 
c380: 56 65 72 73 69 6f 6e 20 6f 66 20 74 68 65 20 63  Version of the c
c390: 68 61 6e 6e 65 6c 20 74 79 70 65 2e 20 2a 2f 0a  hannel type. */.
c3a0: 20 20 20 20 76 6f 69 64 20 2a 63 6c 6f 73 65 50      void *closeP
c3b0: 72 6f 63 3b 09 09 2f 2a 20 4e 6f 74 20 75 73 65  roc;../* Not use
c3c0: 64 20 61 6e 79 20 6d 6f 72 65 2e 20 2a 2f 0a 20  d any more. */. 
c3d0: 20 20 20 54 63 6c 5f 44 72 69 76 65 72 49 6e 70     Tcl_DriverInp
c3e0: 75 74 50 72 6f 63 20 2a 69 6e 70 75 74 50 72 6f  utProc *inputPro
c3f0: 63 3b 0a 09 09 09 09 2f 2a 20 46 75 6e 63 74 69  c;...../* Functi
c400: 6f 6e 20 74 6f 20 63 61 6c 6c 20 66 6f 72 20 69  on to call for i
c410: 6e 70 75 74 20 6f 6e 20 63 68 61 6e 6e 65 6c 2e  nput on channel.
c420: 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 44 72 69 76   */.    Tcl_Driv
c430: 65 72 4f 75 74 70 75 74 50 72 6f 63 20 2a 6f 75  erOutputProc *ou
c440: 74 70 75 74 50 72 6f 63 3b 0a 09 09 09 09 2f 2a  tputProc;...../*
c450: 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 63 61 6c   Function to cal
c460: 6c 20 66 6f 72 20 6f 75 74 70 75 74 20 6f 6e 20  l for output on 
c470: 63 68 61 6e 6e 65 6c 2e 20 2a 2f 0a 20 20 20 20  channel. */.    
c480: 76 6f 69 64 20 2a 73 65 65 6b 50 72 6f 63 3b 09  void *seekProc;.
c490: 09 2f 2a 20 4e 6f 74 20 75 73 65 64 20 61 6e 79  ./* Not used any
c4a0: 20 6d 6f 72 65 2e 20 2a 2f 0a 20 20 20 20 54 63   more. */.    Tc
c4b0: 6c 5f 44 72 69 76 65 72 53 65 74 4f 70 74 69 6f  l_DriverSetOptio
c4c0: 6e 50 72 6f 63 20 2a 73 65 74 4f 70 74 69 6f 6e  nProc *setOption
c4d0: 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 53 65 74  Proc;...../* Set
c4e0: 20 61 6e 20 6f 70 74 69 6f 6e 20 6f 6e 20 61 20   an option on a 
c4f0: 63 68 61 6e 6e 65 6c 2e 20 2a 2f 0a 20 20 20 20  channel. */.    
c500: 54 63 6c 5f 44 72 69 76 65 72 47 65 74 4f 70 74  Tcl_DriverGetOpt
c510: 69 6f 6e 50 72 6f 63 20 2a 67 65 74 4f 70 74 69  ionProc *getOpti
c520: 6f 6e 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 47  onProc;...../* G
c530: 65 74 20 61 6e 20 6f 70 74 69 6f 6e 20 66 72 6f  et an option fro
c540: 6d 20 61 20 63 68 61 6e 6e 65 6c 2e 20 2a 2f 0a  m a channel. */.
c550: 20 20 20 20 54 63 6c 5f 44 72 69 76 65 72 57 61      Tcl_DriverWa
c560: 74 63 68 50 72 6f 63 20 2a 77 61 74 63 68 50 72  tchProc *watchPr
c570: 6f 63 3b 0a 09 09 09 09 2f 2a 20 53 65 74 20 75  oc;...../* Set u
c580: 70 20 74 68 65 20 6e 6f 74 69 66 69 65 72 20 74  p the notifier t
c590: 6f 20 77 61 74 63 68 20 66 6f 72 20 65 76 65 6e  o watch for even
c5a0: 74 73 20 6f 6e 0a 09 09 09 09 20 2a 20 74 68 69  ts on..... * thi
c5b0: 73 20 63 68 61 6e 6e 65 6c 2e 20 2a 2f 0a 20 20  s channel. */.  
c5c0: 20 20 54 63 6c 5f 44 72 69 76 65 72 47 65 74 48    Tcl_DriverGetH
c5d0: 61 6e 64 6c 65 50 72 6f 63 20 2a 67 65 74 48 61  andleProc *getHa
c5e0: 6e 64 6c 65 50 72 6f 63 3b 0a 09 09 09 09 2f 2a  ndleProc;...../*
c5f0: 20 47 65 74 20 61 6e 20 4f 53 20 68 61 6e 64 6c   Get an OS handl
c600: 65 20 66 72 6f 6d 20 74 68 65 20 63 68 61 6e 6e  e from the chann
c610: 65 6c 20 6f 72 20 4e 55 4c 4c 0a 09 09 09 09 20  el or NULL..... 
c620: 2a 20 69 66 20 6e 6f 74 20 73 75 70 70 6f 72 74  * if not support
c630: 65 64 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 44  ed. */.    Tcl_D
c640: 72 69 76 65 72 43 6c 6f 73 65 32 50 72 6f 63 20  riverClose2Proc 
c650: 2a 63 6c 6f 73 65 32 50 72 6f 63 3b 0a 09 09 09  *close2Proc;....
c660: 09 2f 2a 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20  ./* Function to 
c670: 63 61 6c 6c 20 74 6f 20 63 6c 6f 73 65 20 74 68  call to close th
c680: 65 20 63 68 61 6e 6e 65 6c 20 69 66 0a 09 09 09  e channel if....
c690: 09 20 2a 20 74 68 65 20 64 65 76 69 63 65 20 73  . * the device s
c6a0: 75 70 70 6f 72 74 73 20 63 6c 6f 73 69 6e 67 20  upports closing 
c6b0: 74 68 65 20 72 65 61 64 20 26 0a 09 09 09 09 20  the read &..... 
c6c0: 2a 20 77 72 69 74 65 20 73 69 64 65 73 20 69 6e  * write sides in
c6d0: 64 65 70 65 6e 64 65 6e 74 6c 79 2e 20 2a 2f 0a  dependently. */.
c6e0: 20 20 20 20 54 63 6c 5f 44 72 69 76 65 72 42 6c      Tcl_DriverBl
c6f0: 6f 63 6b 4d 6f 64 65 50 72 6f 63 20 2a 62 6c 6f  ockModeProc *blo
c700: 63 6b 4d 6f 64 65 50 72 6f 63 3b 0a 09 09 09 09  ckModeProc;.....
c710: 2f 2a 20 53 65 74 20 62 6c 6f 63 6b 69 6e 67 20  /* Set blocking 
c720: 6d 6f 64 65 20 66 6f 72 20 74 68 65 20 72 61 77  mode for the raw
c730: 20 63 68 61 6e 6e 65 6c 2e 20 4d 61 79 0a 09 09   channel. May...
c740: 09 09 20 2a 20 62 65 20 4e 55 4c 4c 2e 20 2a 2f  .. * be NULL. */
c750: 0a 20 20 20 20 54 63 6c 5f 44 72 69 76 65 72 46  .    Tcl_DriverF
c760: 6c 75 73 68 50 72 6f 63 20 2a 66 6c 75 73 68 50  lushProc *flushP
c770: 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 46 75 6e 63  roc;...../* Func
c780: 74 69 6f 6e 20 74 6f 20 63 61 6c 6c 20 74 6f 20  tion to call to 
c790: 66 6c 75 73 68 20 61 20 63 68 61 6e 6e 65 6c 2e  flush a channel.
c7a0: 20 4d 61 79 20 62 65 0a 09 09 09 09 20 2a 20 4e   May be..... * N
c7b0: 55 4c 4c 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f  ULL. */.    Tcl_
c7c0: 44 72 69 76 65 72 48 61 6e 64 6c 65 72 50 72 6f  DriverHandlerPro
c7d0: 63 20 2a 68 61 6e 64 6c 65 72 50 72 6f 63 3b 0a  c *handlerProc;.
c7e0: 09 09 09 09 2f 2a 20 46 75 6e 63 74 69 6f 6e 20  ..../* Function 
c7f0: 74 6f 20 63 61 6c 6c 20 74 6f 20 68 61 6e 64 6c  to call to handl
c800: 65 20 61 20 63 68 61 6e 6e 65 6c 20 65 76 65 6e  e a channel even
c810: 74 2e 0a 09 09 09 09 20 2a 20 54 68 69 73 20 77  t...... * This w
c820: 69 6c 6c 20 62 65 20 70 61 73 73 65 64 20 75 70  ill be passed up
c830: 20 74 68 65 20 73 74 61 63 6b 65 64 20 63 68 61   the stacked cha
c840: 6e 6e 65 6c 0a 09 09 09 09 20 2a 20 63 68 61 69  nnel..... * chai
c850: 6e 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 44 72  n. */.    Tcl_Dr
c860: 69 76 65 72 57 69 64 65 53 65 65 6b 50 72 6f 63  iverWideSeekProc
c870: 20 2a 77 69 64 65 53 65 65 6b 50 72 6f 63 3b 0a   *wideSeekProc;.
c880: 09 09 09 09 2f 2a 20 46 75 6e 63 74 69 6f 6e 20  ..../* Function 
c890: 74 6f 20 63 61 6c 6c 20 74 6f 20 73 65 65 6b 20  to call to seek 
c8a0: 6f 6e 20 74 68 65 20 63 68 61 6e 6e 65 6c 0a 09  on the channel..
c8b0: 09 09 09 20 2a 20 77 68 69 63 68 20 63 61 6e 20  ... * which can 
c8c0: 68 61 6e 64 6c 65 20 36 34 2d 62 69 74 20 6f 66  handle 64-bit of
c8d0: 66 73 65 74 73 2e 20 4d 61 79 20 62 65 0a 09 09  fsets. May be...
c8e0: 09 09 20 2a 20 4e 55 4c 4c 2c 20 61 6e 64 20 6d  .. * NULL, and m
c8f0: 75 73 74 20 62 65 20 4e 55 4c 4c 20 69 66 20 73  ust be NULL if s
c900: 65 65 6b 50 72 6f 63 20 69 73 0a 09 09 09 09 20  eekProc is..... 
c910: 2a 20 4e 55 4c 4c 2e 20 2a 2f 0a 20 20 20 20 54  * NULL. */.    T
c920: 63 6c 5f 44 72 69 76 65 72 54 68 72 65 61 64 41  cl_DriverThreadA
c930: 63 74 69 6f 6e 50 72 6f 63 20 2a 74 68 72 65 61  ctionProc *threa
c940: 64 41 63 74 69 6f 6e 50 72 6f 63 3b 0a 09 09 09  dActionProc;....
c950: 09 2f 2a 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20  ./* Function to 
c960: 63 61 6c 6c 20 74 6f 20 6e 6f 74 69 66 79 20 74  call to notify t
c970: 68 65 20 64 72 69 76 65 72 20 6f 66 0a 09 09 09  he driver of....
c980: 09 20 2a 20 74 68 72 65 61 64 20 73 70 65 63 69  . * thread speci
c990: 66 69 63 20 61 63 74 69 76 69 74 79 20 66 6f 72  fic activity for
c9a0: 20 61 20 63 68 61 6e 6e 65 6c 2e 20 4d 61 79 0a   a channel. May.
c9b0: 09 09 09 09 20 2a 20 62 65 20 4e 55 4c 4c 2e 20  .... * be NULL. 
c9c0: 2a 2f 0a 20 20 20 20 54 63 6c 5f 44 72 69 76 65  */.    Tcl_Drive
c9d0: 72 54 72 75 6e 63 61 74 65 50 72 6f 63 20 2a 74  rTruncateProc *t
c9e0: 72 75 6e 63 61 74 65 50 72 6f 63 3b 0a 09 09 09  runcateProc;....
c9f0: 09 2f 2a 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20  ./* Function to 
ca00: 63 61 6c 6c 20 74 6f 20 74 72 75 6e 63 61 74 65  call to truncate
ca10: 20 74 68 65 20 75 6e 64 65 72 6c 79 69 6e 67 0a   the underlying.
ca20: 09 09 09 09 20 2a 20 66 69 6c 65 20 74 6f 20 61  .... * file to a
ca30: 20 70 61 72 74 69 63 75 6c 61 72 20 6c 65 6e 67   particular leng
ca40: 74 68 2e 20 4d 61 79 20 62 65 20 4e 55 4c 4c 20  th. May be NULL 
ca50: 69 66 0a 09 09 09 09 20 2a 20 74 68 65 20 63 68  if..... * the ch
ca60: 61 6e 6e 65 6c 20 64 6f 65 73 20 6e 6f 74 20 73  annel does not s
ca70: 75 70 70 6f 72 74 20 74 72 75 6e 63 61 74 69 6f  upport truncatio
ca80: 6e 2e 20 2a 2f 0a 7d 20 54 63 6c 5f 43 68 61 6e  n. */.} Tcl_Chan
ca90: 6e 65 6c 54 79 70 65 3b 0a 0a 2f 2a 0a 20 2a 20  nelType;../*. * 
caa0: 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 66 6c  The following fl
cab0: 61 67 73 20 64 65 74 65 72 6d 69 6e 65 20 77 68  ags determine wh
cac0: 65 74 68 65 72 20 74 68 65 20 62 6c 6f 63 6b 4d  ether the blockM
cad0: 6f 64 65 50 72 6f 63 20 61 62 6f 76 65 20 73 68  odeProc above sh
cae0: 6f 75 6c 64 20 73 65 74 0a 20 2a 20 74 68 65 20  ould set. * the 
caf0: 63 68 61 6e 6e 65 6c 20 69 6e 74 6f 20 62 6c 6f  channel into blo
cb00: 63 6b 69 6e 67 20 6f 72 20 6e 6f 6e 62 6c 6f 63  cking or nonbloc
cb10: 6b 69 6e 67 20 6d 6f 64 65 2e 20 54 68 65 79 20  king mode. They 
cb20: 61 72 65 20 70 61 73 73 65 64 20 61 73 20 61 72  are passed as ar
cb30: 67 75 6d 65 6e 74 73 0a 20 2a 20 74 6f 20 74 68  guments. * to th
cb40: 65 20 62 6c 6f 63 6b 4d 6f 64 65 50 72 6f 63 20  e blockModeProc 
cb50: 66 75 6e 63 74 69 6f 6e 20 69 6e 20 74 68 65 20  function in the 
cb60: 61 62 6f 76 65 20 73 74 72 75 63 74 75 72 65 2e  above structure.
cb70: 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43  . */..#define TC
cb80: 4c 5f 4d 4f 44 45 5f 42 4c 4f 43 4b 49 4e 47 09  L_MODE_BLOCKING.
cb90: 30 09 2f 2a 20 50 75 74 20 63 68 61 6e 6e 65 6c  0./* Put channel
cba0: 20 69 6e 74 6f 20 62 6c 6f 63 6b 69 6e 67 20 6d   into blocking m
cbb0: 6f 64 65 2e 20 2a 2f 0a 23 64 65 66 69 6e 65 20  ode. */.#define 
cbc0: 54 43 4c 5f 4d 4f 44 45 5f 4e 4f 4e 42 4c 4f 43  TCL_MODE_NONBLOC
cbd0: 4b 49 4e 47 09 31 09 2f 2a 20 50 75 74 20 63 68  KING.1./* Put ch
cbe0: 61 6e 6e 65 6c 20 69 6e 74 6f 20 6e 6f 6e 62 6c  annel into nonbl
cbf0: 6f 63 6b 69 6e 67 0a 09 09 09 09 09 20 2a 20 6d  ocking...... * m
cc00: 6f 64 65 2e 20 2a 2f 0a 0a 2f 2a 0a 20 2a 2d 2d  ode. */../*. *--
cc10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
cc20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
cc30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
cc40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
cc50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 45 6e  ----------. * En
cc60: 75 6d 20 66 6f 72 20 64 69 66 66 65 72 65 6e 74  um for different
cc70: 20 74 79 70 65 73 20 6f 66 20 66 69 6c 65 20 70   types of file p
cc80: 61 74 68 73 2e 0a 20 2a 2f 0a 0a 74 79 70 65 64  aths.. */..typed
cc90: 65 66 20 65 6e 75 6d 20 54 63 6c 5f 50 61 74 68  ef enum Tcl_Path
cca0: 54 79 70 65 20 7b 0a 20 20 20 20 54 43 4c 5f 50  Type {.    TCL_P
ccb0: 41 54 48 5f 41 42 53 4f 4c 55 54 45 2c 0a 20 20  ATH_ABSOLUTE,.  
ccc0: 20 20 54 43 4c 5f 50 41 54 48 5f 52 45 4c 41 54    TCL_PATH_RELAT
ccd0: 49 56 45 2c 0a 20 20 20 20 54 43 4c 5f 50 41 54  IVE,.    TCL_PAT
cce0: 48 5f 56 4f 4c 55 4d 45 5f 52 45 4c 41 54 49 56  H_VOLUME_RELATIV
ccf0: 45 0a 7d 20 54 63 6c 5f 50 61 74 68 54 79 70 65  E.} Tcl_PathType
cd00: 3b 0a 0a 2f 2a 0a 20 2a 20 54 68 65 20 66 6f 6c  ;../*. * The fol
cd10: 6c 6f 77 69 6e 67 20 73 74 72 75 63 74 75 72 65  lowing structure
cd20: 20 69 73 20 75 73 65 64 20 74 6f 20 70 61 73 73   is used to pass
cd30: 20 67 6c 6f 62 20 74 79 70 65 20 64 61 74 61 20   glob type data 
cd40: 61 6d 6f 6e 67 73 74 20 74 68 65 20 76 61 72 69  amongst the vari
cd50: 6f 75 73 0a 20 2a 20 67 6c 6f 62 20 72 6f 75 74  ous. * glob rout
cd60: 69 6e 65 73 20 61 6e 64 20 54 63 6c 5f 46 53 4d  ines and Tcl_FSM
cd70: 61 74 63 68 49 6e 44 69 72 65 63 74 6f 72 79 2e  atchInDirectory.
cd80: 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 73 74  . */..typedef st
cd90: 72 75 63 74 20 54 63 6c 5f 47 6c 6f 62 54 79 70  ruct Tcl_GlobTyp
cda0: 65 44 61 74 61 20 7b 0a 20 20 20 20 69 6e 74 20  eData {.    int 
cdb0: 74 79 70 65 3b 09 09 09 2f 2a 20 43 6f 72 72 65  type;.../* Corre
cdc0: 73 70 6f 6e 64 73 20 74 6f 20 62 63 64 70 66 6c  sponds to bcdpfl
cdd0: 73 20 61 73 20 69 6e 20 27 66 69 6e 64 20 2d 74  s as in 'find -t
cde0: 27 2e 20 2a 2f 0a 20 20 20 20 69 6e 74 20 70 65  '. */.    int pe
cdf0: 72 6d 3b 09 09 09 2f 2a 20 43 6f 72 72 65 73 70  rm;.../* Corresp
ce00: 6f 6e 64 73 20 74 6f 20 66 69 6c 65 20 70 65 72  onds to file per
ce10: 6d 69 73 73 69 6f 6e 73 2e 20 2a 2f 0a 20 20 20  missions. */.   
ce20: 20 54 63 6c 5f 4f 62 6a 20 2a 6d 61 63 54 79 70   Tcl_Obj *macTyp
ce30: 65 3b 09 09 2f 2a 20 41 63 63 65 70 74 61 62 6c  e;../* Acceptabl
ce40: 65 20 4d 61 63 20 74 79 70 65 2e 20 2a 2f 0a 20  e Mac type. */. 
ce50: 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 6d 61 63 43     Tcl_Obj *macC
ce60: 72 65 61 74 6f 72 3b 09 2f 2a 20 41 63 63 65 70  reator;./* Accep
ce70: 74 61 62 6c 65 20 4d 61 63 20 63 72 65 61 74 6f  table Mac creato
ce80: 72 2e 20 2a 2f 0a 7d 20 54 63 6c 5f 47 6c 6f 62  r. */.} Tcl_Glob
ce90: 54 79 70 65 44 61 74 61 3b 0a 0a 2f 2a 0a 20 2a  TypeData;../*. *
cea0: 20 54 79 70 65 20 61 6e 64 20 70 65 72 6d 69 73   Type and permis
ceb0: 73 69 6f 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73  sion definitions
cec0: 20 66 6f 72 20 67 6c 6f 62 20 63 6f 6d 6d 61 6e   for glob comman
ced0: 64 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20  d.. */..#define 
cee0: 54 43 4c 5f 47 4c 4f 42 5f 54 59 50 45 5f 42 4c  TCL_GLOB_TYPE_BL
cef0: 4f 43 4b 09 09 28 31 3c 3c 30 29 0a 23 64 65 66  OCK..(1<<0).#def
cf00: 69 6e 65 20 54 43 4c 5f 47 4c 4f 42 5f 54 59 50  ine TCL_GLOB_TYP
cf10: 45 5f 43 48 41 52 09 09 28 31 3c 3c 31 29 0a 23  E_CHAR..(1<<1).#
cf20: 64 65 66 69 6e 65 20 54 43 4c 5f 47 4c 4f 42 5f  define TCL_GLOB_
cf30: 54 59 50 45 5f 44 49 52 09 09 28 31 3c 3c 32 29  TYPE_DIR..(1<<2)
cf40: 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 47 4c 4f  .#define TCL_GLO
cf50: 42 5f 54 59 50 45 5f 50 49 50 45 09 09 28 31 3c  B_TYPE_PIPE..(1<
cf60: 3c 33 29 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f  <3).#define TCL_
cf70: 47 4c 4f 42 5f 54 59 50 45 5f 46 49 4c 45 09 09  GLOB_TYPE_FILE..
cf80: 28 31 3c 3c 34 29 0a 23 64 65 66 69 6e 65 20 54  (1<<4).#define T
cf90: 43 4c 5f 47 4c 4f 42 5f 54 59 50 45 5f 4c 49 4e  CL_GLOB_TYPE_LIN
cfa0: 4b 09 09 28 31 3c 3c 35 29 0a 23 64 65 66 69 6e  K..(1<<5).#defin
cfb0: 65 20 54 43 4c 5f 47 4c 4f 42 5f 54 59 50 45 5f  e TCL_GLOB_TYPE_
cfc0: 53 4f 43 4b 09 09 28 31 3c 3c 36 29 0a 23 64 65  SOCK..(1<<6).#de
cfd0: 66 69 6e 65 20 54 43 4c 5f 47 4c 4f 42 5f 54 59  fine TCL_GLOB_TY
cfe0: 50 45 5f 4d 4f 55 4e 54 09 09 28 31 3c 3c 37 29  PE_MOUNT..(1<<7)
cff0: 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 47 4c  ..#define TCL_GL
d000: 4f 42 5f 50 45 52 4d 5f 52 4f 4e 4c 59 09 09 28  OB_PERM_RONLY..(
d010: 31 3c 3c 30 29 0a 23 64 65 66 69 6e 65 20 54 43  1<<0).#define TC
d020: 4c 5f 47 4c 4f 42 5f 50 45 52 4d 5f 48 49 44 44  L_GLOB_PERM_HIDD
d030: 45 4e 09 09 28 31 3c 3c 31 29 0a 23 64 65 66 69  EN..(1<<1).#defi
d040: 6e 65 20 54 43 4c 5f 47 4c 4f 42 5f 50 45 52 4d  ne TCL_GLOB_PERM
d050: 5f 52 09 09 09 28 31 3c 3c 32 29 0a 23 64 65 66  _R...(1<<2).#def
d060: 69 6e 65 20 54 43 4c 5f 47 4c 4f 42 5f 50 45 52  ine TCL_GLOB_PER
d070: 4d 5f 57 09 09 09 28 31 3c 3c 33 29 0a 23 64 65  M_W...(1<<3).#de
d080: 66 69 6e 65 20 54 43 4c 5f 47 4c 4f 42 5f 50 45  fine TCL_GLOB_PE
d090: 52 4d 5f 58 09 09 09 28 31 3c 3c 34 29 0a 0a 2f  RM_X...(1<<4)../
d0a0: 2a 0a 20 2a 20 46 6c 61 67 73 20 66 6f 72 20 74  *. * Flags for t
d0b0: 68 65 20 75 6e 6c 6f 61 64 20 63 61 6c 6c 62 61  he unload callba
d0c0: 63 6b 20 66 75 6e 63 74 69 6f 6e 2e 0a 20 2a 2f  ck function.. */
d0d0: 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 55 4e  ..#define TCL_UN
d0e0: 4c 4f 41 44 5f 44 45 54 41 43 48 5f 46 52 4f 4d  LOAD_DETACH_FROM
d0f0: 5f 49 4e 54 45 52 50 52 45 54 45 52 09 28 31 3c  _INTERPRETER.(1<
d100: 3c 30 29 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f  <0).#define TCL_
d110: 55 4e 4c 4f 41 44 5f 44 45 54 41 43 48 5f 46 52  UNLOAD_DETACH_FR
d120: 4f 4d 5f 50 52 4f 43 45 53 53 09 09 28 31 3c 3c  OM_PROCESS..(1<<
d130: 31 29 0a 0a 2f 2a 0a 20 2a 20 54 79 70 65 64 65  1)../*. * Typede
d140: 66 73 20 66 6f 72 20 74 68 65 20 76 61 72 69 6f  fs for the vario
d150: 75 73 20 66 69 6c 65 73 79 73 74 65 6d 20 6f 70  us filesystem op
d160: 65 72 61 74 69 6f 6e 73 3a 0a 20 2a 2f 0a 0a 74  erations:. */..t
d170: 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f  ypedef int (Tcl_
d180: 46 53 53 74 61 74 50 72 6f 63 29 20 28 54 63 6c  FSStatProc) (Tcl
d190: 5f 4f 62 6a 20 2a 70 61 74 68 50 74 72 2c 20 54  _Obj *pathPtr, T
d1a0: 63 6c 5f 53 74 61 74 42 75 66 20 2a 62 75 66 29  cl_StatBuf *buf)
d1b0: 3b 0a 74 79 70 65 64 65 66 20 69 6e 74 20 28 54  ;.typedef int (T
d1c0: 63 6c 5f 46 53 41 63 63 65 73 73 50 72 6f 63 29  cl_FSAccessProc)
d1d0: 20 28 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68 50   (Tcl_Obj *pathP
d1e0: 74 72 2c 20 69 6e 74 20 6d 6f 64 65 29 3b 0a 74  tr, int mode);.t
d1f0: 79 70 65 64 65 66 20 54 63 6c 5f 43 68 61 6e 6e  ypedef Tcl_Chann
d200: 65 6c 20 28 54 63 6c 5f 46 53 4f 70 65 6e 46 69  el (Tcl_FSOpenFi
d210: 6c 65 43 68 61 6e 6e 65 6c 50 72 6f 63 29 20 28  leChannelProc) (
d220: 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65  Tcl_Interp *inte
d230: 72 70 2c 0a 09 54 63 6c 5f 4f 62 6a 20 2a 70 61  rp,..Tcl_Obj *pa
d240: 74 68 50 74 72 2c 20 69 6e 74 20 6d 6f 64 65 2c  thPtr, int mode,
d250: 20 69 6e 74 20 70 65 72 6d 69 73 73 69 6f 6e 73   int permissions
d260: 29 3b 0a 74 79 70 65 64 65 66 20 69 6e 74 20 28  );.typedef int (
d270: 54 63 6c 5f 46 53 4d 61 74 63 68 49 6e 44 69 72  Tcl_FSMatchInDir
d280: 65 63 74 6f 72 79 50 72 6f 63 29 20 28 54 63 6c  ectoryProc) (Tcl
d290: 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c  _Interp *interp,
d2a0: 20 54 63 6c 5f 4f 62 6a 20 2a 72 65 73 75 6c 74   Tcl_Obj *result
d2b0: 2c 0a 09 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68  ,..Tcl_Obj *path
d2c0: 50 74 72 2c 20 63 6f 6e 73 74 20 63 68 61 72 20  Ptr, const char 
d2d0: 2a 70 61 74 74 65 72 6e 2c 20 54 63 6c 5f 47 6c  *pattern, Tcl_Gl
d2e0: 6f 62 54 79 70 65 44 61 74 61 20 2a 74 79 70 65  obTypeData *type
d2f0: 73 29 3b 0a 74 79 70 65 64 65 66 20 54 63 6c 5f  s);.typedef Tcl_
d300: 4f 62 6a 20 2a 20 28 54 63 6c 5f 46 53 47 65 74  Obj * (Tcl_FSGet
d310: 43 77 64 50 72 6f 63 29 20 28 54 63 6c 5f 49 6e  CwdProc) (Tcl_In
d320: 74 65 72 70 20 2a 69 6e 74 65 72 70 29 3b 0a 74  terp *interp);.t
d330: 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f  ypedef int (Tcl_
d340: 46 53 43 68 64 69 72 50 72 6f 63 29 20 28 54 63  FSChdirProc) (Tc
d350: 6c 5f 4f 62 6a 20 2a 70 61 74 68 50 74 72 29 3b  l_Obj *pathPtr);
d360: 0a 74 79 70 65 64 65 66 20 69 6e 74 20 28 54 63  .typedef int (Tc
d370: 6c 5f 46 53 4c 73 74 61 74 50 72 6f 63 29 20 28  l_FSLstatProc) (
d380: 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68 50 74 72  Tcl_Obj *pathPtr
d390: 2c 20 54 63 6c 5f 53 74 61 74 42 75 66 20 2a 62  , Tcl_StatBuf *b
d3a0: 75 66 29 3b 0a 74 79 70 65 64 65 66 20 69 6e 74  uf);.typedef int
d3b0: 20 28 54 63 6c 5f 46 53 43 72 65 61 74 65 44 69   (Tcl_FSCreateDi
d3c0: 72 65 63 74 6f 72 79 50 72 6f 63 29 20 28 54 63  rectoryProc) (Tc
d3d0: 6c 5f 4f 62 6a 20 2a 70 61 74 68 50 74 72 29 3b  l_Obj *pathPtr);
d3e0: 0a 74 79 70 65 64 65 66 20 69 6e 74 20 28 54 63  .typedef int (Tc
d3f0: 6c 5f 46 53 44 65 6c 65 74 65 46 69 6c 65 50 72  l_FSDeleteFilePr
d400: 6f 63 29 20 28 54 63 6c 5f 4f 62 6a 20 2a 70 61  oc) (Tcl_Obj *pa
d410: 74 68 50 74 72 29 3b 0a 74 79 70 65 64 65 66 20  thPtr);.typedef 
d420: 69 6e 74 20 28 54 63 6c 5f 46 53 43 6f 70 79 44  int (Tcl_FSCopyD
d430: 69 72 65 63 74 6f 72 79 50 72 6f 63 29 20 28 54  irectoryProc) (T
d440: 63 6c 5f 4f 62 6a 20 2a 73 72 63 50 61 74 68 50  cl_Obj *srcPathP
d450: 74 72 2c 0a 09 54 63 6c 5f 4f 62 6a 20 2a 64 65  tr,..Tcl_Obj *de
d460: 73 74 50 61 74 68 50 74 72 2c 20 54 63 6c 5f 4f  stPathPtr, Tcl_O
d470: 62 6a 20 2a 2a 65 72 72 6f 72 50 74 72 29 3b 0a  bj **errorPtr);.
d480: 74 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c  typedef int (Tcl
d490: 5f 46 53 43 6f 70 79 46 69 6c 65 50 72 6f 63 29  _FSCopyFileProc)
d4a0: 20 28 54 63 6c 5f 4f 62 6a 20 2a 73 72 63 50 61   (Tcl_Obj *srcPa
d4b0: 74 68 50 74 72 2c 20 54 63 6c 5f 4f 62 6a 20 2a  thPtr, Tcl_Obj *
d4c0: 64 65 73 74 50 61 74 68 50 74 72 29 3b 0a 74 79  destPathPtr);.ty
d4d0: 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 46  pedef int (Tcl_F
d4e0: 53 52 65 6d 6f 76 65 44 69 72 65 63 74 6f 72 79  SRemoveDirectory
d4f0: 50 72 6f 63 29 20 28 54 63 6c 5f 4f 62 6a 20 2a  Proc) (Tcl_Obj *
d500: 70 61 74 68 50 74 72 2c 20 69 6e 74 20 72 65 63  pathPtr, int rec
d510: 75 72 73 69 76 65 2c 0a 09 54 63 6c 5f 4f 62 6a  ursive,..Tcl_Obj
d520: 20 2a 2a 65 72 72 6f 72 50 74 72 29 3b 0a 74 79   **errorPtr);.ty
d530: 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 46  pedef int (Tcl_F
d540: 53 52 65 6e 61 6d 65 46 69 6c 65 50 72 6f 63 29  SRenameFileProc)
d550: 20 28 54 63 6c 5f 4f 62 6a 20 2a 73 72 63 50 61   (Tcl_Obj *srcPa
d560: 74 68 50 74 72 2c 20 54 63 6c 5f 4f 62 6a 20 2a  thPtr, Tcl_Obj *
d570: 64 65 73 74 50 61 74 68 50 74 72 29 3b 0a 74 79  destPathPtr);.ty
d580: 70 65 64 65 66 20 76 6f 69 64 20 28 54 63 6c 5f  pedef void (Tcl_
d590: 46 53 55 6e 6c 6f 61 64 46 69 6c 65 50 72 6f 63  FSUnloadFileProc
d5a0: 29 20 28 54 63 6c 5f 4c 6f 61 64 48 61 6e 64 6c  ) (Tcl_LoadHandl
d5b0: 65 20 6c 6f 61 64 48 61 6e 64 6c 65 29 3b 0a 74  e loadHandle);.t
d5c0: 79 70 65 64 65 66 20 54 63 6c 5f 4f 62 6a 20 2a  ypedef Tcl_Obj *
d5d0: 20 28 54 63 6c 5f 46 53 4c 69 73 74 56 6f 6c 75   (Tcl_FSListVolu
d5e0: 6d 65 73 50 72 6f 63 29 20 28 76 6f 69 64 29 3b  mesProc) (void);
d5f0: 0a 2f 2a 20 57 65 20 68 61 76 65 20 74 6f 20 64  ./* We have to d
d600: 65 63 6c 61 72 65 20 74 68 65 20 75 74 69 6d 65  eclare the utime
d610: 20 73 74 72 75 63 74 75 72 65 20 68 65 72 65 2e   structure here.
d620: 20 2a 2f 0a 73 74 72 75 63 74 20 75 74 69 6d 62   */.struct utimb
d630: 75 66 3b 0a 74 79 70 65 64 65 66 20 69 6e 74 20  uf;.typedef int 
d640: 28 54 63 6c 5f 46 53 55 74 69 6d 65 50 72 6f 63  (Tcl_FSUtimeProc
d650: 29 20 28 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68  ) (Tcl_Obj *path
d660: 50 74 72 2c 20 73 74 72 75 63 74 20 75 74 69 6d  Ptr, struct utim
d670: 62 75 66 20 2a 74 76 61 6c 29 3b 0a 74 79 70 65  buf *tval);.type
d680: 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 46 53 4e  def int (Tcl_FSN
d690: 6f 72 6d 61 6c 69 7a 65 50 61 74 68 50 72 6f 63  ormalizePathProc
d6a0: 29 20 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69  ) (Tcl_Interp *i
d6b0: 6e 74 65 72 70 2c 20 54 63 6c 5f 4f 62 6a 20 2a  nterp, Tcl_Obj *
d6c0: 70 61 74 68 50 74 72 2c 0a 09 69 6e 74 20 6e 65  pathPtr,..int ne
d6d0: 78 74 43 68 65 63 6b 70 6f 69 6e 74 29 3b 0a 74  xtCheckpoint);.t
d6e0: 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f  ypedef int (Tcl_
d6f0: 46 53 46 69 6c 65 41 74 74 72 73 47 65 74 50 72  FSFileAttrsGetPr
d700: 6f 63 29 20 28 54 63 6c 5f 49 6e 74 65 72 70 20  oc) (Tcl_Interp 
d710: 2a 69 6e 74 65 72 70 2c 20 69 6e 74 20 69 6e 64  *interp, int ind
d720: 65 78 2c 0a 09 54 63 6c 5f 4f 62 6a 20 2a 70 61  ex,..Tcl_Obj *pa
d730: 74 68 50 74 72 2c 20 54 63 6c 5f 4f 62 6a 20 2a  thPtr, Tcl_Obj *
d740: 2a 6f 62 6a 50 74 72 52 65 66 29 3b 0a 74 79 70  *objPtrRef);.typ
d750: 65 64 65 66 20 63 6f 6e 73 74 20 63 68 61 72 20  edef const char 
d760: 2a 63 6f 6e 73 74 20 2a 20 28 54 63 6c 5f 46 53  *const * (Tcl_FS
d770: 46 69 6c 65 41 74 74 72 53 74 72 69 6e 67 73 50  FileAttrStringsP
d780: 72 6f 63 29 20 28 54 63 6c 5f 4f 62 6a 20 2a 70  roc) (Tcl_Obj *p
d790: 61 74 68 50 74 72 2c 0a 09 54 63 6c 5f 4f 62 6a  athPtr,..Tcl_Obj
d7a0: 20 2a 2a 6f 62 6a 50 74 72 52 65 66 29 3b 0a 74   **objPtrRef);.t
d7b0: 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f  ypedef int (Tcl_
d7c0: 46 53 46 69 6c 65 41 74 74 72 73 53 65 74 50 72  FSFileAttrsSetPr
d7d0: 6f 63 29 20 28 54 63 6c 5f 49 6e 74 65 72 70 20  oc) (Tcl_Interp 
d7e0: 2a 69 6e 74 65 72 70 2c 20 69 6e 74 20 69 6e 64  *interp, int ind
d7f0: 65 78 2c 0a 09 54 63 6c 5f 4f 62 6a 20 2a 70 61  ex,..Tcl_Obj *pa
d800: 74 68 50 74 72 2c 20 54 63 6c 5f 4f 62 6a 20 2a  thPtr, Tcl_Obj *
d810: 6f 62 6a 50 74 72 29 3b 0a 74 79 70 65 64 65 66  objPtr);.typedef
d820: 20 54 63 6c 5f 4f 62 6a 20 2a 20 28 54 63 6c 5f   Tcl_Obj * (Tcl_
d830: 46 53 4c 69 6e 6b 50 72 6f 63 29 20 28 54 63 6c  FSLinkProc) (Tcl
d840: 5f 4f 62 6a 20 2a 70 61 74 68 50 74 72 2c 20 54  _Obj *pathPtr, T
d850: 63 6c 5f 4f 62 6a 20 2a 74 6f 50 74 72 2c 0a 09  cl_Obj *toPtr,..
d860: 69 6e 74 20 6c 69 6e 6b 54 79 70 65 29 3b 0a 74  int linkType);.t
d870: 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f  ypedef int (Tcl_
d880: 46 53 4c 6f 61 64 46 69 6c 65 50 72 6f 63 29 20  FSLoadFileProc) 
d890: 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74  (Tcl_Interp *int
d8a0: 65 72 70 2c 20 54 63 6c 5f 4f 62 6a 20 2a 70 61  erp, Tcl_Obj *pa
d8b0: 74 68 50 74 72 2c 0a 09 54 63 6c 5f 4c 6f 61 64  thPtr,..Tcl_Load
d8c0: 48 61 6e 64 6c 65 20 2a 68 61 6e 64 6c 65 50 74  Handle *handlePt
d8d0: 72 2c 20 54 63 6c 5f 46 53 55 6e 6c 6f 61 64 46  r, Tcl_FSUnloadF
d8e0: 69 6c 65 50 72 6f 63 20 2a 2a 75 6e 6c 6f 61 64  ileProc **unload
d8f0: 50 72 6f 63 50 74 72 29 3b 0a 74 79 70 65 64 65  ProcPtr);.typede
d900: 66 20 69 6e 74 20 28 54 63 6c 5f 46 53 50 61 74  f int (Tcl_FSPat
d910: 68 49 6e 46 69 6c 65 73 79 73 74 65 6d 50 72 6f  hInFilesystemPro
d920: 63 29 20 28 54 63 6c 5f 4f 62 6a 20 2a 70 61 74  c) (Tcl_Obj *pat
d930: 68 50 74 72 2c 0a 09 76 6f 69 64 20 2a 2a 63 6c  hPtr,..void **cl
d940: 69 65 6e 74 44 61 74 61 50 74 72 29 3b 0a 74 79  ientDataPtr);.ty
d950: 70 65 64 65 66 20 54 63 6c 5f 4f 62 6a 20 2a 20  pedef Tcl_Obj * 
d960: 28 54 63 6c 5f 46 53 46 69 6c 65 73 79 73 74 65  (Tcl_FSFilesyste
d970: 6d 50 61 74 68 54 79 70 65 50 72 6f 63 29 20 28  mPathTypeProc) (
d980: 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68 50 74 72  Tcl_Obj *pathPtr
d990: 29 3b 0a 74 79 70 65 64 65 66 20 54 63 6c 5f 4f  );.typedef Tcl_O
d9a0: 62 6a 20 2a 20 28 54 63 6c 5f 46 53 46 69 6c 65  bj * (Tcl_FSFile
d9b0: 73 79 73 74 65 6d 53 65 70 61 72 61 74 6f 72 50  systemSeparatorP
d9c0: 72 6f 63 29 20 28 54 63 6c 5f 4f 62 6a 20 2a 70  roc) (Tcl_Obj *p
d9d0: 61 74 68 50 74 72 29 3b 0a 23 64 65 66 69 6e 65  athPtr);.#define
d9e0: 20 54 63 6c 5f 46 53 46 72 65 65 49 6e 74 65 72   Tcl_FSFreeInter
d9f0: 6e 61 6c 52 65 70 50 72 6f 63 20 54 63 6c 5f 46  nalRepProc Tcl_F
da00: 72 65 65 50 72 6f 63 0a 74 79 70 65 64 65 66 20  reeProc.typedef 
da10: 76 6f 69 64 20 2a 28 54 63 6c 5f 46 53 44 75 70  void *(Tcl_FSDup
da20: 49 6e 74 65 72 6e 61 6c 52 65 70 50 72 6f 63 29  InternalRepProc)
da30: 20 28 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 61   (void *clientDa
da40: 74 61 29 3b 0a 74 79 70 65 64 65 66 20 54 63 6c  ta);.typedef Tcl
da50: 5f 4f 62 6a 20 2a 20 28 54 63 6c 5f 46 53 49 6e  _Obj * (Tcl_FSIn
da60: 74 65 72 6e 61 6c 54 6f 4e 6f 72 6d 61 6c 69 7a  ternalToNormaliz
da70: 65 64 50 72 6f 63 29 20 28 76 6f 69 64 20 2a 63  edProc) (void *c
da80: 6c 69 65 6e 74 44 61 74 61 29 3b 0a 74 79 70 65  lientData);.type
da90: 64 65 66 20 76 6f 69 64 20 2a 28 54 63 6c 5f 46  def void *(Tcl_F
daa0: 53 43 72 65 61 74 65 49 6e 74 65 72 6e 61 6c 52  SCreateInternalR
dab0: 65 70 50 72 6f 63 29 20 28 54 63 6c 5f 4f 62 6a  epProc) (Tcl_Obj
dac0: 20 2a 70 61 74 68 50 74 72 29 3b 0a 0a 74 79 70   *pathPtr);..typ
dad0: 65 64 65 66 20 73 74 72 75 63 74 20 54 63 6c 5f  edef struct Tcl_
dae0: 46 53 56 65 72 73 69 6f 6e 5f 20 2a 54 63 6c 5f  FSVersion_ *Tcl_
daf0: 46 53 56 65 72 73 69 6f 6e 3b 0a 0a 2f 2a 0a 20  FSVersion;../*. 
db00: 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  *---------------
db10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
db20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
db30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
db40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a  -------------. *
db50: 20 44 61 74 61 20 73 74 72 75 63 74 75 72 65 73   Data structures
db60: 20 72 65 6c 61 74 65 64 20 74 6f 20 68 6f 6f 6b   related to hook
db70: 69 6e 67 20 69 6e 74 6f 20 74 68 65 20 66 69 6c  ing into the fil
db80: 65 73 79 73 74 65 6d 0a 20 2a 2f 0a 0a 2f 2a 0a  esystem. */../*.
db90: 20 2a 20 46 69 6c 65 73 79 73 74 65 6d 20 76 65   * Filesystem ve
dba0: 72 73 69 6f 6e 20 74 61 67 2e 20 20 54 68 69 73  rsion tag.  This
dbb0: 20 77 61 73 20 69 6e 74 72 6f 64 75 63 65 64 20   was introduced 
dbc0: 69 6e 20 38 2e 34 2e 0a 20 2a 2f 0a 0a 23 64 65  in 8.4.. */..#de
dbd0: 66 69 6e 65 20 54 43 4c 5f 46 49 4c 45 53 59 53  fine TCL_FILESYS
dbe0: 54 45 4d 5f 56 45 52 53 49 4f 4e 5f 31 09 28 28  TEM_VERSION_1.((
dbf0: 54 63 6c 5f 46 53 56 65 72 73 69 6f 6e 29 20 30  Tcl_FSVersion) 0
dc00: 78 31 29 0a 0a 2f 2a 0a 20 2a 20 73 74 72 75 63  x1)../*. * struc
dc10: 74 20 54 63 6c 5f 46 69 6c 65 73 79 73 74 65 6d  t Tcl_Filesystem
dc20: 3a 0a 20 2a 0a 20 2a 20 4f 6e 65 20 73 75 63 68  :. *. * One such
dc30: 20 73 74 72 75 63 74 75 72 65 20 65 78 69 73 74   structure exist
dc40: 73 20 66 6f 72 20 65 61 63 68 20 74 79 70 65 20  s for each type 
dc50: 28 6b 69 6e 64 29 20 6f 66 20 66 69 6c 65 73 79  (kind) of filesy
dc60: 73 74 65 6d 2e 20 49 74 20 63 6f 6c 6c 65 63 74  stem. It collect
dc70: 73 0a 20 2a 20 74 6f 67 65 74 68 65 72 20 74 68  s. * together th
dc80: 65 20 66 75 6e 63 74 69 6f 6e 73 20 74 68 61 74  e functions that
dc90: 20 66 6f 72 6d 20 74 68 65 20 69 6e 74 65 72 66   form the interf
dca0: 61 63 65 20 66 6f 72 20 61 20 70 61 72 74 69 63  ace for a partic
dcb0: 75 6c 72 20 74 68 65 0a 20 2a 20 66 69 6c 65 73  ulr the. * files
dcc0: 79 73 74 65 6d 2e 20 54 63 6c 20 61 6c 77 61 79  ystem. Tcl alway
dcd0: 73 20 61 63 63 65 73 73 65 73 20 74 68 65 20 66  s accesses the f
dce0: 69 6c 65 73 79 73 74 65 6d 20 74 68 72 6f 75 67  ilesystem throug
dcf0: 68 20 6f 6e 65 20 6f 66 20 74 68 65 73 65 0a 20  h one of these. 
dd00: 2a 20 73 74 72 75 63 74 75 72 65 73 2e 0a 20 2a  * structures.. *
dd10: 0a 20 2a 20 4e 6f 74 20 61 6c 6c 20 65 6e 74 72  . * Not all entr
dd20: 69 65 73 20 6e 65 65 64 20 62 65 20 6e 6f 6e 2d  ies need be non-
dd30: 4e 55 4c 4c 3b 20 61 6e 79 20 77 68 69 63 68 20  NULL; any which 
dd40: 61 72 65 20 4e 55 4c 4c 20 61 72 65 20 73 69 6d  are NULL are sim
dd50: 70 6c 79 20 69 67 6e 6f 72 65 64 2e 0a 20 2a 20  ply ignored.. * 
dd60: 48 6f 77 65 76 65 72 2c 20 61 20 63 6f 6d 70 6c  However, a compl
dd70: 65 74 65 20 66 69 6c 65 73 79 73 74 65 6d 20 73  ete filesystem s
dd80: 68 6f 75 6c 64 20 70 72 6f 76 69 64 65 20 61 6c  hould provide al
dd90: 6c 20 6f 66 20 74 68 65 73 65 20 66 75 6e 63 74  l of these funct
dda0: 69 6f 6e 73 2e 20 54 68 65 0a 20 2a 20 65 78 70  ions. The. * exp
ddb0: 6c 61 6e 61 74 69 6f 6e 73 20 69 6e 20 74 68 65  lanations in the
ddc0: 20 73 74 72 75 63 74 75 72 65 20 73 68 6f 77 20   structure show 
ddd0: 74 68 65 20 69 6d 70 6f 72 74 61 6e 63 65 20 6f  the importance o
dde0: 66 20 65 61 63 68 20 66 75 6e 63 74 69 6f 6e 2e  f each function.
ddf0: 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 73 74  . */..typedef st
de00: 72 75 63 74 20 54 63 6c 5f 46 69 6c 65 73 79 73  ruct Tcl_Filesys
de10: 74 65 6d 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20  tem {.    const 
de20: 63 68 61 72 20 2a 74 79 70 65 4e 61 6d 65 3b 09  char *typeName;.
de30: 2f 2a 20 54 68 65 20 6e 61 6d 65 20 6f 66 20 74  /* The name of t
de40: 68 65 20 66 69 6c 65 73 79 73 74 65 6d 2e 20 2a  he filesystem. *
de50: 2f 0a 20 20 20 20 54 63 6c 5f 53 69 7a 65 20 73  /.    Tcl_Size s
de60: 74 72 75 63 74 75 72 65 4c 65 6e 67 74 68 3b 09  tructureLength;.
de70: 2f 2a 20 4c 65 6e 67 74 68 20 6f 66 20 74 68 69  /* Length of thi
de80: 73 20 73 74 72 75 63 74 75 72 65 2c 20 73 6f 20  s structure, so 
de90: 66 75 74 75 72 65 20 62 69 6e 61 72 79 0a 09 09  future binary...
dea0: 09 09 20 2a 20 63 6f 6d 70 61 74 69 62 69 6c 69  .. * compatibili
deb0: 74 79 20 63 61 6e 20 62 65 20 61 73 73 75 72 65  ty can be assure
dec0: 64 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53  d. */.    Tcl_FS
ded0: 56 65 72 73 69 6f 6e 20 76 65 72 73 69 6f 6e 3b  Version version;
dee0: 09 2f 2a 20 56 65 72 73 69 6f 6e 20 6f 66 20 74  ./* Version of t
def0: 68 65 20 66 69 6c 65 73 79 73 74 65 6d 20 74 79  he filesystem ty
df00: 70 65 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46  pe. */.    Tcl_F
df10: 53 50 61 74 68 49 6e 46 69 6c 65 73 79 73 74 65  SPathInFilesyste
df20: 6d 50 72 6f 63 20 2a 70 61 74 68 49 6e 46 69 6c  mProc *pathInFil
df30: 65 73 79 73 74 65 6d 50 72 6f 63 3b 0a 09 09 09  esystemProc;....
df40: 09 2f 2a 20 44 65 74 65 72 6d 69 6e 65 73 20 77  ./* Determines w
df50: 68 65 74 68 65 72 20 74 68 65 20 70 61 74 68 6e  hether the pathn
df60: 61 6d 65 20 69 73 20 69 6e 20 74 68 69 73 0a 09  ame is in this..
df70: 09 09 09 20 2a 20 66 69 6c 65 73 79 73 74 65 6d  ... * filesystem
df80: 2e 20 54 68 69 73 20 69 73 20 74 68 65 20 6d 6f  . This is the mo
df90: 73 74 20 69 6d 70 6f 72 74 61 6e 74 0a 09 09 09  st important....
dfa0: 09 20 2a 20 66 69 6c 65 73 79 73 74 65 6d 20 66  . * filesystem f
dfb0: 75 6e 63 74 69 6f 6e 2e 20 2a 2f 0a 20 20 20 20  unction. */.    
dfc0: 54 63 6c 5f 46 53 44 75 70 49 6e 74 65 72 6e 61  Tcl_FSDupInterna
dfd0: 6c 52 65 70 50 72 6f 63 20 2a 64 75 70 49 6e 74  lRepProc *dupInt
dfe0: 65 72 6e 61 6c 52 65 70 50 72 6f 63 3b 0a 09 09  ernalRepProc;...
dff0: 09 09 2f 2a 20 44 75 70 6c 69 63 61 74 65 73 20  ../* Duplicates 
e000: 74 68 65 20 69 6e 74 65 72 6e 61 6c 20 68 61 6e  the internal han
e010: 64 6c 65 20 6f 66 20 74 68 65 20 6e 6f 64 65 2e  dle of the node.
e020: 0a 09 09 09 09 20 2a 20 49 66 20 69 74 20 69 73  ..... * If it is
e030: 20 4e 55 4c 4c 2c 20 74 68 65 20 66 69 6c 65 73   NULL, the files
e040: 79 73 74 65 6d 20 69 73 20 6c 65 73 73 0a 09 09  ystem is less...
e050: 09 09 20 2a 20 70 65 72 66 6f 72 6d 61 6e 74 2e  .. * performant.
e060: 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53 46 72   */.    Tcl_FSFr
e070: 65 65 49 6e 74 65 72 6e 61 6c 52 65 70 50 72 6f  eeInternalRepPro
e080: 63 20 2a 66 72 65 65 49 6e 74 65 72 6e 61 6c 52  c *freeInternalR
e090: 65 70 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 46  epProc;...../* F
e0a0: 72 65 65 73 20 74 68 65 20 69 6e 74 65 72 6e 61  rees the interna
e0b0: 6c 20 68 61 6e 64 6c 65 20 6f 66 20 74 68 65 20  l handle of the 
e0c0: 6e 6f 64 65 2e 20 20 4e 55 4c 4c 0a 09 09 09 09  node.  NULL.....
e0d0: 20 2a 20 6f 6e 6c 79 20 69 66 20 74 68 65 72 65   * only if there
e0e0: 20 69 73 20 6e 6f 20 6e 65 65 64 20 74 6f 20 66   is no need to f
e0f0: 72 65 65 20 72 65 73 6f 75 72 63 65 73 0a 09 09  ree resources...
e100: 09 09 20 2a 20 75 73 65 64 20 66 6f 72 20 74 68  .. * used for th
e110: 65 20 69 6e 74 65 72 6e 61 6c 20 68 61 6e 64 6c  e internal handl
e120: 65 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53  e. */.    Tcl_FS
e130: 49 6e 74 65 72 6e 61 6c 54 6f 4e 6f 72 6d 61 6c  InternalToNormal
e140: 69 7a 65 64 50 72 6f 63 20 2a 69 6e 74 65 72 6e  izedProc *intern
e150: 61 6c 54 6f 4e 6f 72 6d 61 6c 69 7a 65 64 50 72  alToNormalizedPr
e160: 6f 63 3b 0a 09 09 09 09 2f 2a 20 43 6f 6e 76 65  oc;...../* Conve
e170: 72 74 73 20 74 68 65 20 69 6e 74 65 72 6e 61 6c  rts the internal
e180: 20 68 61 6e 64 6c 65 20 74 6f 20 61 20 6e 6f 72   handle to a nor
e190: 6d 61 6c 69 7a 65 64 0a 09 09 09 09 20 2a 20 70  malized..... * p
e1a0: 61 74 68 2e 20 20 4e 55 4c 4c 20 69 66 20 74 68  ath.  NULL if th
e1b0: 65 20 66 69 6c 65 73 79 73 74 65 6d 20 63 72 65  e filesystem cre
e1c0: 61 74 65 73 20 6e 6f 64 65 73 0a 09 09 09 09 20  ates nodes..... 
e1d0: 2a 20 68 61 76 69 6e 67 20 6e 6f 20 70 61 74 68  * having no path
e1e0: 6e 61 6d 65 2e 20 2a 2f 0a 20 20 20 20 54 63 6c  name. */.    Tcl
e1f0: 5f 46 53 43 72 65 61 74 65 49 6e 74 65 72 6e 61  _FSCreateInterna
e200: 6c 52 65 70 50 72 6f 63 20 2a 63 72 65 61 74 65  lRepProc *create
e210: 49 6e 74 65 72 6e 61 6c 52 65 70 50 72 6f 63 3b  InternalRepProc;
e220: 0a 09 09 09 09 2f 2a 20 43 72 65 61 74 65 73 20  ...../* Creates 
e230: 61 6e 20 69 6e 74 65 72 6e 61 6c 20 68 61 6e 64  an internal hand
e240: 6c 65 20 66 6f 72 20 61 20 70 61 74 68 6e 61 6d  le for a pathnam
e250: 65 2e 0a 09 09 09 09 20 2a 20 4d 61 79 20 62 65  e...... * May be
e260: 20 4e 55 4c 4c 20 69 66 20 70 61 74 68 6e 61 6d   NULL if pathnam
e270: 65 73 20 68 61 76 65 20 6e 6f 20 69 6e 74 65 72  es have no inter
e280: 6e 61 6c 0a 09 09 09 09 20 2a 20 68 61 6e 64 6c  nal..... * handl
e290: 65 20 6f 72 20 69 66 20 70 61 74 68 49 6e 46 69  e or if pathInFi
e2a0: 6c 65 73 79 73 74 65 6d 50 72 6f 63 20 61 6c 77  lesystemProc alw
e2b0: 61 79 73 0a 09 09 09 09 20 2a 20 69 6d 6d 65 64  ays..... * immed
e2c0: 69 61 74 65 6c 79 20 63 72 65 61 74 65 73 20 61  iately creates a
e2d0: 6e 20 69 6e 74 65 72 6e 61 6c 0a 09 09 09 09 20  n internal..... 
e2e0: 2a 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e  * representation
e2f0: 20 66 6f 72 20 70 61 74 68 6e 61 6d 65 73 20 69   for pathnames i
e300: 6e 20 74 68 65 0a 09 09 09 09 20 2a 20 66 69 6c  n the..... * fil
e310: 65 73 79 73 74 65 6d 2e 20 2a 2f 0a 20 20 20 20  esystem. */.    
e320: 54 63 6c 5f 46 53 4e 6f 72 6d 61 6c 69 7a 65 50  Tcl_FSNormalizeP
e330: 61 74 68 50 72 6f 63 20 2a 6e 6f 72 6d 61 6c 69  athProc *normali
e340: 7a 65 50 61 74 68 50 72 6f 63 3b 0a 09 09 09 09  zePathProc;.....
e350: 2f 2a 20 4e 6f 72 6d 61 6c 69 7a 65 73 20 61 20  /* Normalizes a 
e360: 70 61 74 68 2e 20 20 53 68 6f 75 6c 64 20 62 65  path.  Should be
e370: 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 69 66 0a   implemented if.
e380: 09 09 09 09 20 2a 20 74 68 65 20 66 69 6c 65 73  .... * the files
e390: 79 73 74 65 6d 73 20 73 75 70 70 6f 72 74 73 20  ystems supports 
e3a0: 6d 75 6c 74 69 70 6c 65 20 70 61 74 68 73 20 74  multiple paths t
e3b0: 6f 0a 09 09 09 09 20 2a 20 74 68 65 20 73 61 6d  o..... * the sam
e3c0: 65 20 6e 6f 64 65 2e 20 2a 2f 0a 20 20 20 20 54  e node. */.    T
e3d0: 63 6c 5f 46 53 46 69 6c 65 73 79 73 74 65 6d 50  cl_FSFilesystemP
e3e0: 61 74 68 54 79 70 65 50 72 6f 63 20 2a 66 69 6c  athTypeProc *fil
e3f0: 65 73 79 73 74 65 6d 50 61 74 68 54 79 70 65 50  esystemPathTypeP
e400: 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 44 65 74 65  roc;...../* Dete
e410: 72 6d 69 6e 65 73 20 74 68 65 20 74 79 70 65 20  rmines the type 
e420: 6f 66 20 61 20 70 61 74 68 20 69 6e 20 74 68 69  of a path in thi
e430: 73 0a 09 09 09 09 20 2a 20 66 69 6c 65 73 79 73  s..... * filesys
e440: 74 65 6d 2e 20 4d 61 79 20 62 65 20 4e 55 4c 4c  tem. May be NULL
e450: 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53 46  . */.    Tcl_FSF
e460: 69 6c 65 73 79 73 74 65 6d 53 65 70 61 72 61 74  ilesystemSeparat
e470: 6f 72 50 72 6f 63 20 2a 66 69 6c 65 73 79 73 74  orProc *filesyst
e480: 65 6d 53 65 70 61 72 61 74 6f 72 50 72 6f 63 3b  emSeparatorProc;
e490: 0a 09 09 09 09 2f 2a 20 50 72 6f 64 75 63 65 73  ...../* Produces
e4a0: 20 74 68 65 20 73 65 70 61 72 61 74 6f 72 20 63   the separator c
e4b0: 68 61 72 61 63 74 65 72 28 73 29 20 66 6f 72 20  haracter(s) for 
e4c0: 74 68 69 73 0a 09 09 09 09 20 2a 20 66 69 6c 65  this..... * file
e4d0: 73 79 73 74 65 6d 2e 20 4d 75 73 74 20 6e 6f 74  system. Must not
e4e0: 20 62 65 20 4e 55 4c 4c 2e 20 2a 2f 0a 20 20 20   be NULL. */.   
e4f0: 20 54 63 6c 5f 46 53 53 74 61 74 50 72 6f 63 20   Tcl_FSStatProc 
e500: 2a 73 74 61 74 50 72 6f 63 3b 09 2f 2a 20 43 61  *statProc;./* Ca
e510: 6c 6c 65 64 20 62 79 20 27 54 63 6c 5f 46 53 53  lled by 'Tcl_FSS
e520: 74 61 74 28 29 27 2e 20 20 50 72 6f 76 69 64 65  tat()'.  Provide
e530: 64 20 62 79 20 61 6e 79 0a 09 09 09 09 20 2a 20  d by any..... * 
e540: 72 65 61 73 6f 6e 61 62 6c 65 20 66 69 6c 65 73  reasonable files
e550: 79 73 74 65 6d 2e 20 2a 2f 0a 20 20 20 20 54 63  ystem. */.    Tc
e560: 6c 5f 46 53 41 63 63 65 73 73 50 72 6f 63 20 2a  l_FSAccessProc *
e570: 61 63 63 65 73 73 50 72 6f 63 3b 0a 09 09 09 09  accessProc;.....
e580: 2f 2a 20 43 61 6c 6c 65 64 20 62 79 20 27 54 63  /* Called by 'Tc
e590: 6c 5f 46 53 41 63 63 65 73 73 28 29 27 2e 20 20  l_FSAccess()'.  
e5a0: 49 6d 70 6c 65 6d 65 6e 74 65 64 20 62 79 0a 09  Implemented by..
e5b0: 09 09 09 20 2a 20 61 6e 79 20 72 65 61 73 6f 6e  ... * any reason
e5c0: 61 62 6c 65 20 66 69 6c 65 73 79 73 74 65 6d 2e  able filesystem.
e5d0: 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53 4f 70   */.    Tcl_FSOp
e5e0: 65 6e 46 69 6c 65 43 68 61 6e 6e 65 6c 50 72 6f  enFileChannelPro
e5f0: 63 20 2a 6f 70 65 6e 46 69 6c 65 43 68 61 6e 6e  c *openFileChann
e600: 65 6c 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 43  elProc;...../* C
e610: 61 6c 6c 65 64 20 62 79 20 27 54 63 6c 5f 46 53  alled by 'Tcl_FS
e620: 4f 70 65 6e 46 69 6c 65 43 68 61 6e 6e 65 6c 28  OpenFileChannel(
e630: 29 27 2e 0a 09 09 09 09 20 2a 20 50 72 6f 76 69  )'...... * Provi
e640: 64 65 64 20 62 79 20 61 6e 79 20 72 65 61 73 6f  ded by any reaso
e650: 6e 61 62 6c 65 20 66 69 6c 65 73 79 73 74 65 6d  nable filesystem
e660: 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53 4d  . */.    Tcl_FSM
e670: 61 74 63 68 49 6e 44 69 72 65 63 74 6f 72 79 50  atchInDirectoryP
e680: 72 6f 63 20 2a 6d 61 74 63 68 49 6e 44 69 72 65  roc *matchInDire
e690: 63 74 6f 72 79 50 72 6f 63 3b 0a 09 09 09 09 2f  ctoryProc;...../
e6a0: 2a 20 43 61 6c 6c 65 64 20 62 79 20 27 54 63 6c  * Called by 'Tcl
e6b0: 5f 46 53 4d 61 74 63 68 49 6e 44 69 72 65 63 74  _FSMatchInDirect
e6c0: 6f 72 79 28 29 27 2e 20 20 4e 55 4c 4c 0a 09 09  ory()'.  NULL...
e6d0: 09 09 20 2a 20 69 66 20 74 68 65 20 66 69 6c 65  .. * if the file
e6e0: 73 79 73 74 65 6d 20 64 6f 65 73 20 6e 6f 74 20  system does not 
e6f0: 73 75 70 70 6f 72 74 20 67 6c 6f 62 20 6f 72 0a  support glob or.
e700: 09 09 09 09 20 2a 20 72 65 63 75 72 73 69 76 65  .... * recursive
e710: 20 63 6f 70 79 2e 20 2a 2f 0a 20 20 20 20 54 63   copy. */.    Tc
e720: 6c 5f 46 53 55 74 69 6d 65 50 72 6f 63 20 2a 75  l_FSUtimeProc *u
e730: 74 69 6d 65 50 72 6f 63 3b 09 2f 2a 20 43 61 6c  timeProc;./* Cal
e740: 6c 65 64 20 62 79 20 27 54 63 6c 5f 46 53 55 74  led by 'Tcl_FSUt
e750: 69 6d 65 28 29 27 2c 20 62 79 20 27 66 69 6c 65  ime()', by 'file
e760: 0a 09 09 09 09 20 2a 20 6d 74 69 6d 65 27 20 74  ..... * mtime' t
e770: 6f 20 73 65 74 20 28 6e 6f 74 20 72 65 61 64 29  o set (not read)
e780: 20 74 69 6d 65 73 2c 20 27 66 69 6c 65 0a 09 09   times, 'file...
e790: 09 09 20 2a 20 61 74 69 6d 65 27 2c 20 61 6e 64  .. * atime', and
e7a0: 20 74 68 65 20 6f 70 65 6e 2d 72 2f 6f 70 65 6e   the open-r/open
e7b0: 2d 77 2f 66 63 6f 70 79 20 76 61 72 69 61 6e 74  -w/fcopy variant
e7c0: 0a 09 09 09 09 20 2a 20 6f 66 20 27 66 69 6c 65  ..... * of 'file
e7d0: 20 63 6f 70 79 27 2e 20 2a 2f 0a 20 20 20 20 54   copy'. */.    T
e7e0: 63 6c 5f 46 53 4c 69 6e 6b 50 72 6f 63 20 2a 6c  cl_FSLinkProc *l
e7f0: 69 6e 6b 50 72 6f 63 3b 09 2f 2a 20 43 61 6c 6c  inkProc;./* Call
e800: 65 64 20 62 79 20 27 54 63 6c 5f 46 53 4c 69 6e  ed by 'Tcl_FSLin
e810: 6b 28 29 27 2e 20 4e 55 4c 4c 20 69 66 20 72 65  k()'. NULL if re
e820: 61 64 69 6e 67 20 6f 72 0a 09 09 09 09 20 2a 20  ading or..... * 
e830: 63 72 65 61 74 69 6e 67 20 6c 69 6e 6b 73 20 69  creating links i
e840: 73 20 6e 6f 74 20 73 75 70 70 6f 72 74 65 64 2e  s not supported.
e850: 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53 4c 69   */.    Tcl_FSLi
e860: 73 74 56 6f 6c 75 6d 65 73 50 72 6f 63 20 2a 6c  stVolumesProc *l
e870: 69 73 74 56 6f 6c 75 6d 65 73 50 72 6f 63 3b 0a  istVolumesProc;.
e880: 09 09 09 09 2f 2a 20 4c 69 73 74 73 20 66 69 6c  ..../* Lists fil
e890: 65 73 79 73 74 65 6d 20 76 6f 6c 75 6d 65 73 20  esystem volumes 
e8a0: 61 64 64 65 64 20 62 79 20 74 68 69 73 0a 09 09  added by this...
e8b0: 09 09 20 2a 20 66 69 6c 65 73 79 73 74 65 6d 2e  .. * filesystem.
e8c0: 20 4e 55 4c 4c 20 69 66 20 74 68 65 20 66 69 6c   NULL if the fil
e8d0: 65 73 79 73 74 65 6d 20 64 6f 65 73 20 6e 6f 74  esystem does not
e8e0: 0a 09 09 09 09 20 2a 20 75 73 65 20 76 6f 6c 75  ..... * use volu
e8f0: 6d 65 73 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f  mes. */.    Tcl_
e900: 46 53 46 69 6c 65 41 74 74 72 53 74 72 69 6e 67  FSFileAttrString
e910: 73 50 72 6f 63 20 2a 66 69 6c 65 41 74 74 72 53  sProc *fileAttrS
e920: 74 72 69 6e 67 73 50 72 6f 63 3b 0a 09 09 09 09  tringsProc;.....
e930: 2f 2a 20 4c 69 73 74 20 61 6c 6c 20 76 61 6c 69  /* List all vali
e940: 64 20 61 74 74 72 69 62 75 74 65 73 20 73 74 72  d attributes str
e950: 69 6e 67 73 2e 20 20 4e 55 4c 4c 20 69 66 0a 09  ings.  NULL if..
e960: 09 09 09 20 2a 20 74 68 65 20 66 69 6c 65 73 79  ... * the filesy
e970: 73 74 65 6d 20 64 6f 65 73 20 6e 6f 74 20 73 75  stem does not su
e980: 70 70 6f 72 74 20 74 68 65 20 27 66 69 6c 65 0a  pport the 'file.
e990: 09 09 09 09 20 2a 20 61 74 74 72 69 62 75 74 65  .... * attribute
e9a0: 73 27 20 63 6f 6d 6d 61 6e 64 2e 20 20 43 61 6e  s' command.  Can
e9b0: 20 62 65 20 75 73 65 64 20 74 6f 20 61 74 74 61   be used to atta
e9c0: 63 68 0a 09 09 09 09 20 2a 20 61 72 62 69 74 72  ch..... * arbitr
e9d0: 61 72 79 20 61 64 64 69 74 69 6f 6e 61 6c 20 64  ary additional d
e9e0: 61 74 61 20 74 6f 20 66 69 6c 65 73 20 69 6e 20  ata to files in 
e9f0: 61 0a 09 09 09 09 20 2a 20 66 69 6c 65 73 79 73  a..... * filesys
ea00: 74 65 6d 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f  tem. */.    Tcl_
ea10: 46 53 46 69 6c 65 41 74 74 72 73 47 65 74 50 72  FSFileAttrsGetPr
ea20: 6f 63 20 2a 66 69 6c 65 41 74 74 72 73 47 65 74  oc *fileAttrsGet
ea30: 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 43 61 6c  Proc;...../* Cal
ea40: 6c 65 64 20 62 79 20 27 54 63 6c 5f 46 53 46 69  led by 'Tcl_FSFi
ea50: 6c 65 41 74 74 72 73 47 65 74 28 29 27 20 61 6e  leAttrsGet()' an
ea60: 64 20 62 79 0a 09 09 09 09 20 2a 20 27 66 69 6c  d by..... * 'fil
ea70: 65 20 61 74 74 72 69 62 75 74 65 73 27 2e 20 2a  e attributes'. *
ea80: 2f 0a 20 20 20 20 54 63 6c 5f 46 53 46 69 6c 65  /.    Tcl_FSFile
ea90: 41 74 74 72 73 53 65 74 50 72 6f 63 20 2a 66 69  AttrsSetProc *fi
eaa0: 6c 65 41 74 74 72 73 53 65 74 50 72 6f 63 3b 0a  leAttrsSetProc;.
eab0: 09 09 09 09 2f 2a 20 43 61 6c 6c 65 64 20 62 79  ..../* Called by
eac0: 20 27 54 63 6c 5f 46 53 46 69 6c 65 41 74 74 72   'Tcl_FSFileAttr
ead0: 73 53 65 74 28 29 27 20 61 6e 64 20 62 79 0a 09  sSet()' and by..
eae0: 09 09 09 20 2a 20 27 66 69 6c 65 20 61 74 74 72  ... * 'file attr
eaf0: 69 62 75 74 65 73 27 2e 20 2a 2f 0a 20 20 20 20  ibutes'. */.    
eb00: 54 63 6c 5f 46 53 43 72 65 61 74 65 44 69 72 65  Tcl_FSCreateDire
eb10: 63 74 6f 72 79 50 72 6f 63 20 2a 63 72 65 61 74  ctoryProc *creat
eb20: 65 44 69 72 65 63 74 6f 72 79 50 72 6f 63 3b 0a  eDirectoryProc;.
eb30: 09 09 09 09 2f 2a 20 43 61 6c 6c 65 64 20 62 79  ..../* Called by
eb40: 20 27 54 63 6c 5f 46 53 43 72 65 61 74 65 44 69   'Tcl_FSCreateDi
eb50: 72 65 63 74 6f 72 79 28 29 27 2e 20 20 4d 61 79  rectory()'.  May
eb60: 20 62 65 0a 09 09 09 09 20 2a 20 4e 55 4c 4c 20   be..... * NULL 
eb70: 69 66 20 74 68 65 20 66 69 6c 65 73 79 73 74 65  if the filesyste
eb80: 6d 20 69 73 20 72 65 61 64 2d 6f 6e 6c 79 2e 20  m is read-only. 
eb90: 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53 52 65 6d  */.    Tcl_FSRem
eba0: 6f 76 65 44 69 72 65 63 74 6f 72 79 50 72 6f 63  oveDirectoryProc
ebb0: 20 2a 72 65 6d 6f 76 65 44 69 72 65 63 74 6f 72   *removeDirector
ebc0: 79 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 43 61  yProc;...../* Ca
ebd0: 6c 6c 65 64 20 62 79 20 27 54 63 6c 5f 46 53 52  lled by 'Tcl_FSR
ebe0: 65 6d 6f 76 65 44 69 72 65 63 74 6f 72 79 28 29  emoveDirectory()
ebf0: 27 2e 20 20 4d 61 79 20 62 65 0a 09 09 09 09 20  '.  May be..... 
ec00: 2a 20 4e 55 4c 4c 20 69 66 20 74 68 65 20 66 69  * NULL if the fi
ec10: 6c 65 73 79 73 74 65 6d 20 69 73 20 72 65 61 64  lesystem is read
ec20: 2d 6f 6e 6c 79 2e 20 2a 2f 0a 20 20 20 20 54 63  -only. */.    Tc
ec30: 6c 5f 46 53 44 65 6c 65 74 65 46 69 6c 65 50 72  l_FSDeleteFilePr
ec40: 6f 63 20 2a 64 65 6c 65 74 65 46 69 6c 65 50 72  oc *deleteFilePr
ec50: 6f 63 3b 0a 09 09 09 09 2f 2a 20 43 61 6c 6c 65  oc;...../* Calle
ec60: 64 20 62 79 20 27 54 63 6c 5f 46 53 44 65 6c 65  d by 'Tcl_FSDele
ec70: 74 65 46 69 6c 65 28 29 27 20 4d 61 79 20 62 65  teFile()' May be
ec80: 20 4e 55 4c 4c 0a 09 09 09 09 20 2a 20 69 66 20   NULL..... * if 
ec90: 74 68 65 20 66 69 6c 65 73 79 73 74 65 6d 20 69  the filesystem i
eca0: 73 20 69 73 20 72 65 61 64 2d 6f 6e 6c 79 2e 20  s is read-only. 
ecb0: 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53 43 6f 70  */.    Tcl_FSCop
ecc0: 79 46 69 6c 65 50 72 6f 63 20 2a 63 6f 70 79 46  yFileProc *copyF
ecd0: 69 6c 65 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20  ileProc;...../* 
ece0: 43 61 6c 6c 65 64 20 62 79 20 27 54 63 6c 5f 46  Called by 'Tcl_F
ecf0: 53 43 6f 70 79 46 69 6c 65 28 29 27 2e 20 20 49  SCopyFile()'.  I
ed00: 66 20 4e 55 4c 4c 2c 20 66 6f 72 0a 09 09 09 09  f NULL, for.....
ed10: 20 2a 20 61 20 63 6f 70 79 20 6f 70 65 72 61 74   * a copy operat
ed20: 69 6f 6e 20 61 74 20 74 68 65 20 73 63 72 69 70  ion at the scrip
ed30: 74 20 6c 65 76 65 6c 20 28 6e 6f 74 0a 09 09 09  t level (not....
ed40: 09 20 2a 20 43 29 20 54 63 6c 20 75 73 65 73 20  . * C) Tcl uses 
ed50: 6f 70 65 6e 2d 72 2c 20 6f 70 65 6e 2d 77 20 61  open-r, open-w a
ed60: 6e 64 20 66 63 6f 70 79 2e 20 2a 2f 0a 20 20 20  nd fcopy. */.   
ed70: 20 54 63 6c 5f 46 53 52 65 6e 61 6d 65 46 69 6c   Tcl_FSRenameFil
ed80: 65 50 72 6f 63 20 2a 72 65 6e 61 6d 65 46 69 6c  eProc *renameFil
ed90: 65 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 43 61  eProc;...../* Ca
eda0: 6c 6c 65 64 20 62 79 20 27 54 63 6c 5f 46 53 52  lled by 'Tcl_FSR
edb0: 65 6e 61 6d 65 46 69 6c 65 28 29 27 2e 20 49 66  enameFile()'. If
edc0: 20 4e 55 4c 4c 2c 20 66 6f 72 0a 09 09 09 09 20   NULL, for..... 
edd0: 2a 20 61 20 72 65 6e 61 6d 65 20 6f 70 65 72 61  * a rename opera
ede0: 74 69 6f 6e 20 61 74 20 74 68 65 20 73 63 72 69  tion at the scri
edf0: 70 74 20 6c 65 76 65 6c 20 28 6e 6f 74 0a 09 09  pt level (not...
ee00: 09 09 20 2a 20 43 29 20 54 63 6c 20 70 65 72 66  .. * C) Tcl perf
ee10: 6f 72 6d 73 20 61 20 63 6f 70 79 20 6f 70 65 72  orms a copy oper
ee20: 61 74 69 6f 6e 20 66 6f 6c 6c 6f 77 65 64 0a 09  ation followed..
ee30: 09 09 09 20 2a 20 62 79 20 61 20 64 65 6c 65 74  ... * by a delet
ee40: 65 20 6f 70 65 72 61 74 69 6f 6e 2e 20 2a 2f 0a  e operation. */.
ee50: 20 20 20 20 54 63 6c 5f 46 53 43 6f 70 79 44 69      Tcl_FSCopyDi
ee60: 72 65 63 74 6f 72 79 50 72 6f 63 20 2a 63 6f 70  rectoryProc *cop
ee70: 79 44 69 72 65 63 74 6f 72 79 50 72 6f 63 3b 0a  yDirectoryProc;.
ee80: 09 09 09 09 2f 2a 20 43 61 6c 6c 65 64 20 62 79  ..../* Called by
ee90: 20 27 54 63 6c 5f 46 53 43 6f 70 79 44 69 72 65   'Tcl_FSCopyDire
eea0: 63 74 6f 72 79 28 29 27 2e 20 49 66 20 4e 55 4c  ctory()'. If NUL
eeb0: 4c 2c 0a 09 09 09 09 20 2a 20 66 6f 72 20 61 20  L,..... * for a 
eec0: 63 6f 70 79 20 6f 70 65 72 61 74 69 6f 6e 20 61  copy operation a
eed0: 74 20 74 68 65 20 73 63 72 69 70 74 20 6c 65 76  t the script lev
eee0: 65 6c 0a 09 09 09 09 20 2a 20 28 6e 6f 74 20 43  el..... * (not C
eef0: 29 20 54 63 6c 20 72 65 63 75 72 73 69 76 65 6c  ) Tcl recursivel
ef00: 79 20 63 72 65 61 74 65 73 20 64 69 72 65 63 74  y creates direct
ef10: 6f 72 69 65 73 0a 09 09 09 09 20 2a 20 61 6e 64  ories..... * and
ef20: 20 63 6f 70 69 65 73 20 66 69 6c 65 73 2e 20 2a   copies files. *
ef30: 2f 0a 20 20 20 20 54 63 6c 5f 46 53 4c 73 74 61  /.    Tcl_FSLsta
ef40: 74 50 72 6f 63 20 2a 6c 73 74 61 74 50 72 6f 63  tProc *lstatProc
ef50: 3b 09 2f 2a 20 43 61 6c 6c 65 64 20 62 79 20 27  ;./* Called by '
ef60: 54 63 6c 5f 46 53 4c 73 74 61 74 28 29 27 2e 20  Tcl_FSLstat()'. 
ef70: 49 66 20 4e 55 4c 4c 2c 20 54 63 6c 0a 09 09 09  If NULL, Tcl....
ef80: 09 20 2a 20 61 74 74 65 6d 70 74 73 20 74 6f 20  . * attempts to 
ef90: 75 73 65 20 27 73 74 61 74 50 72 6f 63 27 20 69  use 'statProc' i
efa0: 6e 73 74 65 61 64 2e 20 2a 2f 0a 20 20 20 20 54  nstead. */.    T
efb0: 63 6c 5f 46 53 4c 6f 61 64 46 69 6c 65 50 72 6f  cl_FSLoadFilePro
efc0: 63 20 2a 6c 6f 61 64 46 69 6c 65 50 72 6f 63 3b  c *loadFileProc;
efd0: 0a 09 09 09 09 2f 2a 20 43 61 6c 6c 65 64 20 62  ...../* Called b
efe0: 79 20 27 54 63 6c 5f 46 53 4c 6f 61 64 46 69 6c  y 'Tcl_FSLoadFil
eff0: 65 28 29 27 2e 20 49 66 20 4e 55 4c 4c 2c 20 54  e()'. If NULL, T
f000: 63 6c 0a 09 09 09 09 20 2a 20 70 65 72 66 6f 72  cl..... * perfor
f010: 6d 73 20 61 20 63 6f 70 79 20 74 6f 20 61 20 74  ms a copy to a t
f020: 65 6d 70 6f 72 61 72 79 20 66 69 6c 65 20 69 6e  emporary file in
f030: 20 74 68 65 0a 09 09 09 09 20 2a 20 6e 61 74 69   the..... * nati
f040: 76 65 20 66 69 6c 65 73 79 73 74 65 6d 20 61 6e  ve filesystem an
f050: 64 20 74 68 65 6e 20 63 61 6c 6c 73 0a 09 09 09  d then calls....
f060: 09 20 2a 20 54 63 6c 5f 46 53 4c 6f 61 64 46 69  . * Tcl_FSLoadFi
f070: 6c 65 28 29 20 6f 6e 20 74 68 61 74 20 74 65 6d  le() on that tem
f080: 70 6f 72 61 72 79 20 63 6f 70 79 2e 20 2a 2f 0a  porary copy. */.
f090: 20 20 20 20 54 63 6c 5f 46 53 47 65 74 43 77 64      Tcl_FSGetCwd
f0a0: 50 72 6f 63 20 2a 67 65 74 43 77 64 50 72 6f 63  Proc *getCwdProc
f0b0: 3b 0a 09 09 09 09 2f 2a 20 43 61 6c 6c 65 64 20  ;...../* Called 
f0c0: 62 79 20 27 54 63 6c 5f 46 53 47 65 74 43 77 64  by 'Tcl_FSGetCwd
f0d0: 28 29 27 2e 20 20 4e 6f 72 6d 61 6c 6c 79 20 4e  ()'.  Normally N
f0e0: 55 4c 4c 2e 0a 09 09 09 09 20 2a 20 55 73 75 61  ULL...... * Usua
f0f0: 6c 6c 79 20 6f 6e 6c 79 20 63 61 6c 6c 65 64 20  lly only called 
f100: 6f 6e 63 65 3a 20 20 49 66 20 27 67 65 74 63 77  once:  If 'getcw
f110: 64 27 20 69 73 0a 09 09 09 09 20 2a 20 63 61 6c  d' is..... * cal
f120: 6c 65 64 20 62 65 66 6f 72 65 20 27 63 68 64 69  led before 'chdi
f130: 72 27 20 69 73 20 65 76 65 72 20 63 61 6c 6c 65  r' is ever calle
f140: 64 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53  d. */.    Tcl_FS
f150: 43 68 64 69 72 50 72 6f 63 20 2a 63 68 64 69 72  ChdirProc *chdir
f160: 50 72 6f 63 3b 09 2f 2a 20 43 61 6c 6c 65 64 20  Proc;./* Called 
f170: 62 79 20 27 54 63 6c 5f 46 53 43 68 64 69 72 28  by 'Tcl_FSChdir(
f180: 29 27 2e 20 20 46 6f 72 20 61 20 76 69 72 74 75  )'.  For a virtu
f190: 61 6c 0a 09 09 09 09 20 2a 20 66 69 6c 65 73 79  al..... * filesy
f1a0: 73 74 65 6d 2c 20 63 68 64 69 72 50 72 6f 63 20  stem, chdirProc 
f1b0: 6a 75 73 74 20 72 65 74 75 72 6e 73 20 7a 65 72  just returns zer
f1c0: 6f 0a 09 09 09 09 20 2a 20 28 73 75 63 63 65 73  o..... * (succes
f1d0: 73 29 20 69 66 20 74 68 65 20 70 61 74 68 6e 61  s) if the pathna
f1e0: 6d 65 20 69 73 20 61 20 76 61 6c 69 64 0a 09 09  me is a valid...
f1f0: 09 09 20 2a 20 64 69 72 65 63 74 6f 72 79 2c 20  .. * directory, 
f200: 61 6e 64 20 73 6f 6d 65 20 6f 74 68 65 72 20 76  and some other v
f210: 61 6c 75 65 20 6f 74 68 65 72 77 69 73 65 2e 0a  alue otherwise..
f220: 09 09 09 09 20 2a 20 46 6f 72 20 41 20 72 65 61  .... * For A rea
f230: 6c 20 66 69 6c 65 73 79 73 74 65 6d 2c 20 63 68  l filesystem, ch
f240: 64 69 72 50 72 6f 63 20 70 65 72 66 6f 72 6d 73  dirProc performs
f250: 0a 09 09 09 09 20 2a 20 74 68 65 20 63 6f 72 72  ..... * the corr
f260: 65 63 74 20 61 63 74 69 6f 6e 2c 20 65 2e 67 2e  ect action, e.g.
f270: 20 20 63 61 6c 6c 73 20 74 68 65 20 73 79 73 74    calls the syst
f280: 65 6d 0a 09 09 09 09 20 2a 20 27 63 68 64 69 72  em..... * 'chdir
f290: 27 20 66 75 6e 63 74 69 6f 6e 2e 20 49 66 20 6e  ' function. If n
f2a0: 6f 74 20 69 6d 70 6c 65 6d 65 6e 74 65 64 2c 20  ot implemented, 
f2b0: 74 68 65 6e 0a 09 09 09 09 20 2a 20 27 63 64 27  then..... * 'cd'
f2c0: 20 61 6e 64 20 27 70 77 64 27 20 66 61 69 6c 20   and 'pwd' fail 
f2d0: 66 6f 72 20 61 20 70 61 74 68 6e 61 6d 65 20 69  for a pathname i
f2e0: 6e 20 74 68 69 73 0a 09 09 09 09 20 2a 20 66 69  n this..... * fi
f2f0: 6c 65 73 79 73 74 65 6d 2e 20 4f 6e 20 73 75 63  lesystem. On suc
f300: 63 65 73 73 20 54 63 6c 20 73 74 6f 72 65 73 20  cess Tcl stores 
f310: 74 68 65 0a 09 09 09 09 20 2a 20 70 61 74 68 6e  the..... * pathn
f320: 61 6d 65 20 66 6f 72 20 75 73 65 20 62 79 20 47  ame for use by G
f330: 65 74 43 77 64 2e 20 20 49 66 20 4e 55 4c 4c 2c  etCwd.  If NULL,
f340: 20 54 63 6c 0a 09 09 09 09 20 2a 20 70 65 72 66   Tcl..... * perf
f350: 6f 72 6d 73 20 72 65 63 6f 72 64 73 20 74 68 65  orms records the
f360: 20 70 61 74 68 6e 61 6d 65 20 61 73 20 74 68 65   pathname as the
f370: 20 6e 65 77 0a 09 09 09 09 20 2a 20 63 75 72 72   new..... * curr
f380: 65 6e 74 20 64 69 72 65 63 74 6f 72 79 20 69 66  ent directory if
f390: 20 69 74 20 70 61 73 73 65 73 20 61 20 73 65 72   it passes a ser
f3a0: 69 65 73 20 6f 66 0a 09 09 09 09 20 2a 20 64 69  ies of..... * di
f3b0: 72 65 63 74 6f 72 79 20 61 63 63 65 73 73 20 63  rectory access c
f3c0: 68 65 63 6b 73 2e 20 2a 2f 0a 7d 20 54 63 6c 5f  hecks. */.} Tcl_
f3d0: 46 69 6c 65 73 79 73 74 65 6d 3b 0a 0a 2f 2a 0a  Filesystem;../*.
f3e0: 20 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67   * The following
f3f0: 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 61 72 65   definitions are
f400: 20 75 73 65 64 20 61 73 20 76 61 6c 75 65 73 20   used as values 
f410: 66 6f 72 20 74 68 65 20 27 6c 69 6e 6b 41 63 74  for the 'linkAct
f420: 69 6f 6e 27 20 66 6c 61 67 20 74 6f 0a 20 2a 20  ion' flag to. * 
f430: 54 63 6c 5f 46 53 4c 69 6e 6b 2c 20 6f 72 20 74  Tcl_FSLink, or t
f440: 68 65 20 6c 69 6e 6b 50 72 6f 63 20 6f 66 20 61  he linkProc of a
f450: 6e 79 20 66 69 6c 65 73 79 73 74 65 6d 2e 20 41  ny filesystem. A
f460: 6e 79 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 6f  ny combination o
f470: 66 20 66 6c 61 67 73 20 63 61 6e 0a 20 2a 20 62  f flags can. * b
f480: 65 20 67 69 76 65 6e 2e 20 46 6f 72 20 6c 69 6e  e given. For lin
f490: 6b 20 63 72 65 61 74 69 6f 6e 2c 20 74 68 65 20  k creation, the 
f4a0: 6c 69 6e 6b 50 72 6f 63 20 73 68 6f 75 6c 64 20  linkProc should 
f4b0: 63 72 65 61 74 65 20 61 20 6c 69 6e 6b 20 77 68  create a link wh
f4c0: 69 63 68 0a 20 2a 20 6d 61 74 63 68 65 73 20 61  ich. * matches a
f4d0: 6e 79 20 6f 66 20 74 68 65 20 74 79 70 65 73 20  ny of the types 
f4e0: 67 69 76 65 6e 2e 0a 20 2a 0a 20 2a 20 54 43 4c  given.. *. * TCL
f4f0: 5f 43 52 45 41 54 45 5f 53 59 4d 42 4f 4c 49 43  _CREATE_SYMBOLIC
f500: 5f 4c 49 4e 4b 20 2d 09 43 72 65 61 74 65 20 61  _LINK -.Create a
f510: 20 73 79 6d 62 6f 6c 69 63 20 6f 72 20 73 6f 66   symbolic or sof
f520: 74 20 6c 69 6e 6b 2e 0a 20 2a 20 54 43 4c 5f 43  t link.. * TCL_C
f530: 52 45 41 54 45 5f 48 41 52 44 5f 4c 49 4e 4b 20  REATE_HARD_LINK 
f540: 2d 09 43 72 65 61 74 65 20 61 20 68 61 72 64 20  -.Create a hard 
f550: 6c 69 6e 6b 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69  link.. */..#defi
f560: 6e 65 20 54 43 4c 5f 43 52 45 41 54 45 5f 53 59  ne TCL_CREATE_SY
f570: 4d 42 4f 4c 49 43 5f 4c 49 4e 4b 09 30 78 30 31  MBOLIC_LINK.0x01
f580: 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 43 52 45  .#define TCL_CRE
f590: 41 54 45 5f 48 41 52 44 5f 4c 49 4e 4b 09 09 30  ATE_HARD_LINK..0
f5a0: 78 30 32 0a 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d  x02../*. *------
f5b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
f5c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
f5d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
f5e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
f5f0: 2d 2d 2d 2d 2d 2d 0a 20 2a 20 54 68 65 20 66 6f  ------. * The fo
f600: 6c 6c 6f 77 69 6e 67 20 73 74 72 75 63 74 75 72  llowing structur
f610: 65 20 72 65 70 72 65 73 65 6e 74 73 20 74 68 65  e represents the
f620: 20 4e 6f 74 69 66 69 65 72 20 66 75 6e 63 74 69   Notifier functi
f630: 6f 6e 73 20 74 68 61 74 20 79 6f 75 20 63 61 6e  ons that you can
f640: 0a 20 2a 20 6f 76 65 72 72 69 64 65 20 77 69 74  . * override wit
f650: 68 20 74 68 65 20 54 63 6c 5f 53 65 74 4e 6f 74  h the Tcl_SetNot
f660: 69 66 69 65 72 20 63 61 6c 6c 2e 0a 20 2a 2f 0a  ifier call.. */.
f670: 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20  .typedef struct 
f680: 54 63 6c 5f 4e 6f 74 69 66 69 65 72 50 72 6f 63  Tcl_NotifierProc
f690: 73 20 7b 0a 20 20 20 20 54 63 6c 5f 53 65 74 54  s {.    Tcl_SetT
f6a0: 69 6d 65 72 50 72 6f 63 20 2a 73 65 74 54 69 6d  imerProc *setTim
f6b0: 65 72 50 72 6f 63 3b 0a 20 20 20 20 54 63 6c 5f  erProc;.    Tcl_
f6c0: 57 61 69 74 46 6f 72 45 76 65 6e 74 50 72 6f 63  WaitForEventProc
f6d0: 20 2a 77 61 69 74 46 6f 72 45 76 65 6e 74 50 72   *waitForEventPr
f6e0: 6f 63 3b 0a 20 20 20 20 54 63 6c 5f 43 72 65 61  oc;.    Tcl_Crea
f6f0: 74 65 46 69 6c 65 48 61 6e 64 6c 65 72 50 72 6f  teFileHandlerPro
f700: 63 20 2a 63 72 65 61 74 65 46 69 6c 65 48 61 6e  c *createFileHan
f710: 64 6c 65 72 50 72 6f 63 3b 0a 20 20 20 20 54 63  dlerProc;.    Tc
f720: 6c 5f 44 65 6c 65 74 65 46 69 6c 65 48 61 6e 64  l_DeleteFileHand
f730: 6c 65 72 50 72 6f 63 20 2a 64 65 6c 65 74 65 46  lerProc *deleteF
f740: 69 6c 65 48 61 6e 64 6c 65 72 50 72 6f 63 3b 0a  ileHandlerProc;.
f750: 20 20 20 20 54 63 6c 5f 49 6e 69 74 4e 6f 74 69      Tcl_InitNoti
f760: 66 69 65 72 50 72 6f 63 20 2a 69 6e 69 74 4e 6f  fierProc *initNo
f770: 74 69 66 69 65 72 50 72 6f 63 3b 0a 20 20 20 20  tifierProc;.    
f780: 54 63 6c 5f 46 69 6e 61 6c 69 7a 65 4e 6f 74 69  Tcl_FinalizeNoti
f790: 66 69 65 72 50 72 6f 63 20 2a 66 69 6e 61 6c 69  fierProc *finali
f7a0: 7a 65 4e 6f 74 69 66 69 65 72 50 72 6f 63 3b 0a  zeNotifierProc;.
f7b0: 20 20 20 20 54 63 6c 5f 41 6c 65 72 74 4e 6f 74      Tcl_AlertNot
f7c0: 69 66 69 65 72 50 72 6f 63 20 2a 61 6c 65 72 74  ifierProc *alert
f7d0: 4e 6f 74 69 66 69 65 72 50 72 6f 63 3b 0a 20 20  NotifierProc;.  
f7e0: 20 20 54 63 6c 5f 53 65 72 76 69 63 65 4d 6f 64    Tcl_ServiceMod
f7f0: 65 48 6f 6f 6b 50 72 6f 63 20 2a 73 65 72 76 69  eHookProc *servi
f800: 63 65 4d 6f 64 65 48 6f 6f 6b 50 72 6f 63 3b 0a  ceModeHookProc;.
f810: 7d 20 54 63 6c 5f 4e 6f 74 69 66 69 65 72 50 72  } Tcl_NotifierPr
f820: 6f 63 73 3b 0a 0c 0a 2f 2a 0a 20 2a 2d 2d 2d 2d  ocs;.../*. *----
f830: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
f840: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
f850: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
f860: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
f870: 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 54 68 65 20  --------. * The 
f880: 66 6f 6c 6c 6f 77 69 6e 67 20 64 61 74 61 20 73  following data s
f890: 74 72 75 63 74 75 72 65 73 20 61 6e 64 20 64 65  tructures and de
f8a0: 63 6c 61 72 61 74 69 6f 6e 73 20 61 72 65 20 66  clarations are f
f8b0: 6f 72 20 74 68 65 20 6e 65 77 20 54 63 6c 20 70  or the new Tcl p
f8c0: 61 72 73 65 72 2e 0a 20 2a 0a 20 2a 20 46 6f 72  arser.. *. * For
f8d0: 20 65 61 63 68 20 77 6f 72 64 20 6f 66 20 61 20   each word of a 
f8e0: 63 6f 6d 6d 61 6e 64 2c 20 61 6e 64 20 66 6f 72  command, and for
f8f0: 20 65 61 63 68 20 70 69 65 63 65 20 6f 66 20 61   each piece of a
f900: 20 77 6f 72 64 20 73 75 63 68 20 61 73 20 61 20   word such as a 
f910: 76 61 72 69 61 62 6c 65 0a 20 2a 20 72 65 66 65  variable. * refe
f920: 72 65 6e 63 65 2c 20 6f 6e 65 20 6f 66 20 74 68  rence, one of th
f930: 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 73 74 72 75  e following stru
f940: 63 74 75 72 65 73 20 69 73 20 63 72 65 61 74 65  ctures is create
f950: 64 20 74 6f 20 64 65 73 63 72 69 62 65 20 74 68  d to describe th
f960: 65 0a 20 2a 20 74 6f 6b 65 6e 2e 0a 20 2a 2f 0a  e. * token.. */.
f970: 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20  .typedef struct 
f980: 54 63 6c 5f 54 6f 6b 65 6e 20 7b 0a 20 20 20 20  Tcl_Token {.    
f990: 69 6e 74 20 74 79 70 65 3b 09 09 09 2f 2a 20 54  int type;.../* T
f9a0: 79 70 65 20 6f 66 20 74 6f 6b 65 6e 2c 20 73 75  ype of token, su
f9b0: 63 68 20 61 73 20 54 43 4c 5f 54 4f 4b 45 4e 5f  ch as TCL_TOKEN_
f9c0: 57 4f 52 44 3b 20 73 65 65 0a 09 09 09 09 20 2a  WORD; see..... *
f9d0: 20 62 65 6c 6f 77 20 66 6f 72 20 76 61 6c 69 64   below for valid
f9e0: 20 74 79 70 65 73 2e 20 2a 2f 0a 20 20 20 20 63   types. */.    c
f9f0: 6f 6e 73 74 20 63 68 61 72 20 2a 73 74 61 72 74  onst char *start
fa00: 3b 09 09 2f 2a 20 46 69 72 73 74 20 63 68 61 72  ;../* First char
fa10: 61 63 74 65 72 20 69 6e 20 74 6f 6b 65 6e 2e 20  acter in token. 
fa20: 2a 2f 0a 20 20 20 20 54 63 6c 5f 53 69 7a 65 20  */.    Tcl_Size 
fa30: 73 69 7a 65 3b 09 09 2f 2a 20 4e 75 6d 62 65 72  size;../* Number
fa40: 20 6f 66 20 62 79 74 65 73 20 69 6e 20 74 6f 6b   of bytes in tok
fa50: 65 6e 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 53  en. */.    Tcl_S
fa60: 69 7a 65 20 6e 75 6d 43 6f 6d 70 6f 6e 65 6e 74  ize numComponent
fa70: 73 3b 09 2f 2a 20 49 66 20 74 68 69 73 20 74 6f  s;./* If this to
fa80: 6b 65 6e 20 69 73 20 63 6f 6d 70 6f 73 65 64 20  ken is composed 
fa90: 6f 66 20 6f 74 68 65 72 20 74 6f 6b 65 6e 73 2c  of other tokens,
faa0: 0a 09 09 09 09 20 2a 20 74 68 69 73 20 66 69 65  ..... * this fie
fab0: 6c 64 20 74 65 6c 6c 73 20 68 6f 77 20 6d 61 6e  ld tells how man
fac0: 79 20 6f 66 20 74 68 65 6d 20 74 68 65 72 65 20  y of them there 
fad0: 61 72 65 0a 09 09 09 09 20 2a 20 28 69 6e 63 6c  are..... * (incl
fae0: 75 64 69 6e 67 20 63 6f 6d 70 6f 6e 65 6e 74 73  uding components
faf0: 20 6f 66 20 63 6f 6d 70 6f 6e 65 6e 74 73 2c 20   of components, 
fb00: 65 74 63 2e 29 2e 0a 09 09 09 09 20 2a 20 54 68  etc.)...... * Th
fb10: 65 20 63 6f 6d 70 6f 6e 65 6e 74 20 74 6f 6b 65  e component toke
fb20: 6e 73 20 69 6d 6d 65 64 69 61 74 65 6c 79 20 66  ns immediately f
fb30: 6f 6c 6c 6f 77 0a 09 09 09 09 20 2a 20 74 68 69  ollow..... * thi
fb40: 73 20 6f 6e 65 2e 20 2a 2f 0a 7d 20 54 63 6c 5f  s one. */.} Tcl_
fb50: 54 6f 6b 65 6e 3b 0a 0a 2f 2a 0a 20 2a 20 54 79  Token;../*. * Ty
fb60: 70 65 20 76 61 6c 75 65 73 20 64 65 66 69 6e 65  pe values define
fb70: 64 20 66 6f 72 20 54 63 6c 5f 54 6f 6b 65 6e 20  d for Tcl_Token 
fb80: 73 74 72 75 63 74 75 72 65 73 2e 20 54 68 65 73  structures. Thes
fb90: 65 20 76 61 6c 75 65 73 20 61 72 65 20 64 65 66  e values are def
fba0: 69 6e 65 64 20 61 73 0a 20 2a 20 6d 61 73 6b 20  ined as. * mask 
fbb0: 62 69 74 73 20 73 6f 20 74 68 61 74 20 69 74 27  bits so that it'
fbc0: 73 20 65 61 73 79 20 74 6f 20 63 68 65 63 6b 20  s easy to check 
fbd0: 66 6f 72 20 63 6f 6c 6c 65 63 74 69 6f 6e 73 20  for collections 
fbe0: 6f 66 20 74 79 70 65 73 2e 0a 20 2a 0a 20 2a 20  of types.. *. * 
fbf0: 54 43 4c 5f 54 4f 4b 45 4e 5f 57 4f 52 44 20 2d  TCL_TOKEN_WORD -
fc00: 09 09 54 68 65 20 74 6f 6b 65 6e 20 64 65 73 63  ..The token desc
fc10: 72 69 62 65 73 20 6f 6e 65 20 77 6f 72 64 20 6f  ribes one word o
fc20: 66 20 61 20 63 6f 6d 6d 61 6e 64 2c 0a 20 2a 09  f a command,. *.
fc30: 09 09 09 66 72 6f 6d 20 74 68 65 20 66 69 72 73  ...from the firs
fc40: 74 20 6e 6f 6e 2d 62 6c 61 6e 6b 20 63 68 61 72  t non-blank char
fc50: 61 63 74 65 72 20 6f 66 20 74 68 65 20 77 6f 72  acter of the wor
fc60: 64 0a 20 2a 09 09 09 09 28 77 68 69 63 68 20 6d  d. *....(which m
fc70: 61 79 20 62 65 20 22 20 6f 72 20 7b 29 20 75 70  ay be " or {) up
fc80: 20 74 6f 20 62 75 74 20 6e 6f 74 20 69 6e 63 6c   to but not incl
fc90: 75 64 69 6e 67 0a 20 2a 09 09 09 09 74 68 65 20  uding. *....the 
fca0: 73 70 61 63 65 2c 20 73 65 6d 69 63 6f 6c 6f 6e  space, semicolon
fcb0: 2c 20 6f 72 20 62 72 61 63 6b 65 74 20 74 68 61  , or bracket tha
fcc0: 74 0a 20 2a 09 09 09 09 74 65 72 6d 69 6e 61 74  t. *....terminat
fcd0: 65 73 20 74 68 65 20 77 6f 72 64 2e 20 4e 75 6d  es the word. Num
fce0: 43 6f 6d 70 6f 6e 65 6e 74 73 20 63 6f 75 6e 74  Components count
fcf0: 73 20 74 68 65 0a 20 2a 09 09 09 09 74 6f 74 61  s the. *....tota
fd00: 6c 20 6e 75 6d 62 65 72 20 6f 66 20 73 75 62 2d  l number of sub-
fd10: 74 6f 6b 65 6e 73 20 74 68 61 74 20 6d 61 6b 65  tokens that make
fd20: 20 75 70 20 74 68 65 0a 20 2a 09 09 09 09 77 6f   up the. *....wo
fd30: 72 64 2e 20 54 68 69 73 20 69 6e 63 6c 75 64 65  rd. This include
fd40: 73 2c 20 66 6f 72 20 65 78 61 6d 70 6c 65 2c 20  s, for example, 
fd50: 73 75 62 2d 74 6f 6b 65 6e 73 0a 20 2a 09 09 09  sub-tokens. *...
fd60: 09 6f 66 20 54 43 4c 5f 54 4f 4b 45 4e 5f 56 41  .of TCL_TOKEN_VA
fd70: 52 49 41 42 4c 45 20 74 6f 6b 65 6e 73 2e 0a 20  RIABLE tokens.. 
fd80: 2a 20 54 43 4c 5f 54 4f 4b 45 4e 5f 53 49 4d 50  * TCL_TOKEN_SIMP
fd90: 4c 45 5f 57 4f 52 44 20 2d 09 54 68 69 73 20 74  LE_WORD -.This t
fda0: 6f 6b 65 6e 20 69 73 20 6a 75 73 74 20 6c 69 6b  oken is just lik
fdb0: 65 20 54 43 4c 5f 54 4f 4b 45 4e 5f 57 4f 52 44  e TCL_TOKEN_WORD
fdc0: 20 65 78 63 65 70 74 0a 20 2a 09 09 09 09 74 68   except. *....th
fdd0: 61 74 20 74 68 65 20 77 6f 72 64 20 69 73 20 67  at the word is g
fde0: 75 61 72 61 6e 74 65 65 64 20 74 6f 20 63 6f 6e  uaranteed to con
fdf0: 73 69 73 74 20 6f 66 20 61 0a 20 2a 09 09 09 09  sist of a. *....
fe00: 73 69 6e 67 6c 65 20 54 43 4c 5f 54 4f 4b 45 4e  single TCL_TOKEN
fe10: 5f 54 45 58 54 20 73 75 62 2d 74 6f 6b 65 6e 2e  _TEXT sub-token.
fe20: 0a 20 2a 20 54 43 4c 5f 54 4f 4b 45 4e 5f 54 45  . * TCL_TOKEN_TE
fe30: 58 54 20 2d 09 09 54 68 65 20 74 6f 6b 65 6e 20  XT -..The token 
fe40: 64 65 73 63 72 69 62 65 73 20 61 20 72 61 6e 67  describes a rang
fe50: 65 20 6f 66 20 6c 69 74 65 72 61 6c 20 74 65 78  e of literal tex
fe60: 74 0a 20 2a 09 09 09 09 74 68 61 74 20 69 73 20  t. *....that is 
fe70: 70 61 72 74 20 6f 66 20 61 20 77 6f 72 64 2e 20  part of a word. 
fe80: 4e 75 6d 43 6f 6d 70 6f 6e 65 6e 74 73 20 69 73  NumComponents is
fe90: 0a 20 2a 09 09 09 09 61 6c 77 61 79 73 20 30 2e  . *....always 0.
fea0: 0a 20 2a 20 54 43 4c 5f 54 4f 4b 45 4e 5f 42 53  . * TCL_TOKEN_BS
feb0: 20 2d 09 09 54 68 65 20 74 6f 6b 65 6e 20 64 65   -..The token de
fec0: 73 63 72 69 62 65 73 20 61 20 62 61 63 6b 73 6c  scribes a backsl
fed0: 61 73 68 20 73 65 71 75 65 6e 63 65 20 74 68 61  ash sequence tha
fee0: 74 0a 20 2a 09 09 09 09 6d 75 73 74 20 62 65 20  t. *....must be 
fef0: 63 6f 6c 6c 61 70 73 65 64 2e 20 4e 75 6d 43 6f  collapsed. NumCo
ff00: 6d 70 6f 6e 65 6e 74 73 20 69 73 20 61 6c 77 61  mponents is alwa
ff10: 79 73 20 30 2e 0a 20 2a 20 54 43 4c 5f 54 4f 4b  ys 0.. * TCL_TOK
ff20: 45 4e 5f 43 4f 4d 4d 41 4e 44 20 2d 09 09 54 68  EN_COMMAND -..Th
ff30: 65 20 74 6f 6b 65 6e 20 64 65 73 63 72 69 62 65  e token describe
ff40: 73 20 61 20 63 6f 6d 6d 61 6e 64 20 77 68 6f 73  s a command whos
ff50: 65 20 72 65 73 75 6c 74 0a 20 2a 09 09 09 09 6d  e result. *....m
ff60: 75 73 74 20 62 65 20 73 75 62 73 74 69 74 75 74  ust be substitut
ff70: 65 64 20 69 6e 74 6f 20 74 68 65 20 77 6f 72 64  ed into the word
ff80: 2e 20 54 68 65 20 74 6f 6b 65 6e 0a 20 2a 09 09  . The token. *..
ff90: 09 09 69 6e 63 6c 75 64 65 73 20 74 68 65 20 65  ..includes the e
ffa0: 6e 63 6c 6f 73 69 6e 67 20 62 72 61 63 6b 65 74  nclosing bracket
ffb0: 73 2e 20 4e 75 6d 43 6f 6d 70 6f 6e 65 6e 74 73  s. NumComponents
ffc0: 0a 20 2a 09 09 09 09 69 73 20 61 6c 77 61 79 73  . *....is always
ffd0: 20 30 2e 0a 20 2a 20 54 43 4c 5f 54 4f 4b 45 4e   0.. * TCL_TOKEN
ffe0: 5f 56 41 52 49 41 42 4c 45 20 2d 09 09 54 68 65  _VARIABLE -..The
fff0: 20 74 6f 6b 65 6e 20 64 65 73 63 72 69 62 65 73   token describes
10000 20 61 20 76 61 72 69 61 62 6c 65 20 73 75 62 73   a variable subs
10010 74 69 74 75 74 69 6f 6e 2c 0a 20 2a 09 09 09 09  titution,. *....
10020 69 6e 63 6c 75 64 69 6e 67 20 74 68 65 20 64 6f  including the do
10030 6c 6c 61 72 20 73 69 67 6e 2c 20 76 61 72 69 61  llar sign, varia
10040 62 6c 65 20 6e 61 6d 65 2c 20 61 6e 64 0a 20 2a  ble name, and. *
10050 09 09 09 09 61 72 72 61 79 20 69 6e 64 65 78 20  ....array index 
10060 28 69 66 20 74 68 65 72 65 20 69 73 20 6f 6e 65  (if there is one
10070 29 20 75 70 20 74 68 72 6f 75 67 68 20 74 68 65  ) up through the
10080 0a 20 2a 09 09 09 09 72 69 67 68 74 20 70 61 72  . *....right par
10090 65 6e 74 68 65 73 65 73 2e 20 4e 75 6d 43 6f 6d  entheses. NumCom
100a0 70 6f 6e 65 6e 74 73 20 74 65 6c 6c 73 20 68 6f  ponents tells ho
100b0 77 0a 20 2a 09 09 09 09 6d 61 6e 79 20 61 64 64  w. *....many add
100c0 69 74 69 6f 6e 61 6c 20 74 6f 6b 65 6e 73 20 66  itional tokens f
100d0 6f 6c 6c 6f 77 20 74 6f 20 72 65 70 72 65 73 65  ollow to represe
100e0 6e 74 20 74 68 65 0a 20 2a 09 09 09 09 76 61 72  nt the. *....var
100f0 69 61 62 6c 65 20 6e 61 6d 65 2e 20 54 68 65 20  iable name. The 
10100 66 69 72 73 74 20 74 6f 6b 65 6e 20 77 69 6c 6c  first token will
10110 20 62 65 20 61 0a 20 2a 09 09 09 09 54 43 4c 5f   be a. *....TCL_
10120 54 4f 4b 45 4e 5f 54 45 58 54 20 74 6f 6b 65 6e  TOKEN_TEXT token
10130 20 74 68 61 74 20 64 65 73 63 72 69 62 65 73 20   that describes 
10140 74 68 65 0a 20 2a 09 09 09 09 76 61 72 69 61 62  the. *....variab
10150 6c 65 20 6e 61 6d 65 2e 20 49 66 20 74 68 65 20  le name. If the 
10160 76 61 72 69 61 62 6c 65 20 69 73 20 61 6e 20 61  variable is an a
10170 72 72 61 79 0a 20 2a 09 09 09 09 72 65 66 65 72  rray. *....refer
10180 65 6e 63 65 20 74 68 65 6e 20 74 68 65 72 65 20  ence then there 
10190 77 69 6c 6c 20 62 65 20 6f 6e 65 20 6f 72 20 6d  will be one or m
101a0 6f 72 65 0a 20 2a 09 09 09 09 61 64 64 69 74 69  ore. *....additi
101b0 6f 6e 61 6c 20 74 6f 6b 65 6e 73 2c 20 6f 66 20  onal tokens, of 
101c0 74 79 70 65 20 54 43 4c 5f 54 4f 4b 45 4e 5f 54  type TCL_TOKEN_T
101d0 45 58 54 2c 0a 20 2a 09 09 09 09 54 43 4c 5f 54  EXT,. *....TCL_T
101e0 4f 4b 45 4e 5f 42 53 2c 20 54 43 4c 5f 54 4f 4b  OKEN_BS, TCL_TOK
101f0 45 4e 5f 43 4f 4d 4d 41 4e 44 2c 20 61 6e 64 0a  EN_COMMAND, and.
10200 20 2a 09 09 09 09 54 43 4c 5f 54 4f 4b 45 4e 5f   *....TCL_TOKEN_
10210 56 41 52 49 41 42 4c 45 2c 20 74 68 61 74 20 64  VARIABLE, that d
10220 65 73 63 72 69 62 65 20 74 68 65 20 61 72 72 61  escribe the arra
10230 79 0a 20 2a 09 09 09 09 69 6e 64 65 78 3b 20 6e  y. *....index; n
10240 75 6d 43 6f 6d 70 6f 6e 65 6e 74 73 20 63 6f 75  umComponents cou
10250 6e 74 73 20 74 68 65 20 74 6f 74 61 6c 20 6e 75  nts the total nu
10260 6d 62 65 72 0a 20 2a 09 09 09 09 6f 66 20 6e 65  mber. *....of ne
10270 73 74 65 64 20 74 6f 6b 65 6e 73 20 74 68 61 74  sted tokens that
10280 20 6d 61 6b 65 20 75 70 20 74 68 65 20 76 61 72   make up the var
10290 69 61 62 6c 65 0a 20 2a 09 09 09 09 72 65 66 65  iable. *....refe
102a0 72 65 6e 63 65 2c 20 69 6e 63 6c 75 64 69 6e 67  rence, including
102b0 20 73 75 62 2d 74 6f 6b 65 6e 73 20 6f 66 0a 20   sub-tokens of. 
102c0 2a 09 09 09 09 54 43 4c 5f 54 4f 4b 45 4e 5f 56  *....TCL_TOKEN_V
102d0 41 52 49 41 42 4c 45 20 74 6f 6b 65 6e 73 2e 0a  ARIABLE tokens..
102e0 20 2a 20 54 43 4c 5f 54 4f 4b 45 4e 5f 53 55 42   * TCL_TOKEN_SUB
102f0 5f 45 58 50 52 20 2d 09 09 54 68 65 20 74 6f 6b  _EXPR -..The tok
10300 65 6e 20 64 65 73 63 72 69 62 65 73 20 6f 6e 65  en describes one
10310 20 73 75 62 65 78 70 72 65 73 73 69 6f 6e 20 6f   subexpression o
10320 66 20 61 6e 0a 20 2a 09 09 09 09 65 78 70 72 65  f an. *....expre
10330 73 73 69 6f 6e 2c 20 66 72 6f 6d 20 74 68 65 20  ssion, from the 
10340 66 69 72 73 74 20 6e 6f 6e 2d 62 6c 61 6e 6b 20  first non-blank 
10350 63 68 61 72 61 63 74 65 72 0a 20 2a 09 09 09 09  character. *....
10360 6f 66 20 74 68 65 20 73 75 62 65 78 70 72 65 73  of the subexpres
10370 73 69 6f 6e 20 75 70 20 74 6f 20 62 75 74 20 6e  sion up to but n
10380 6f 74 20 69 6e 63 6c 75 64 69 6e 67 0a 20 2a 09  ot including. *.
10390 09 09 09 74 68 65 20 73 70 61 63 65 2c 20 62 72  ...the space, br
103a0 61 63 65 2c 20 6f 72 20 62 72 61 63 6b 65 74 20  ace, or bracket 
103b0 74 68 61 74 20 74 65 72 6d 69 6e 61 74 65 73 0a  that terminates.
103c0 20 2a 09 09 09 09 74 68 65 20 73 75 62 65 78 70   *....the subexp
103d0 72 65 73 73 69 6f 6e 2e 20 4e 75 6d 43 6f 6d 70  ression. NumComp
103e0 6f 6e 65 6e 74 73 20 63 6f 75 6e 74 73 20 74 68  onents counts th
103f0 65 0a 20 2a 09 09 09 09 74 6f 74 61 6c 20 6e 75  e. *....total nu
10400 6d 62 65 72 20 6f 66 20 66 6f 6c 6c 6f 77 69 6e  mber of followin
10410 67 20 73 75 62 74 6f 6b 65 6e 73 20 74 68 61 74  g subtokens that
10420 20 6d 61 6b 65 0a 20 2a 09 09 09 09 75 70 20 74   make. *....up t
10430 68 65 20 73 75 62 65 78 70 72 65 73 73 69 6f 6e  he subexpression
10440 3b 20 74 68 69 73 20 69 6e 63 6c 75 64 65 73 20  ; this includes 
10450 61 6c 6c 0a 20 2a 09 09 09 09 73 75 62 74 6f 6b  all. *....subtok
10460 65 6e 73 20 66 6f 72 20 61 6e 79 20 6e 65 73 74  ens for any nest
10470 65 64 20 54 43 4c 5f 54 4f 4b 45 4e 5f 53 55 42  ed TCL_TOKEN_SUB
10480 5f 45 58 50 52 0a 20 2a 09 09 09 09 74 6f 6b 65  _EXPR. *....toke
10490 6e 73 2e 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c  ns. For example,
104a0 20 61 20 6e 75 6d 65 72 69 63 20 76 61 6c 75 65   a numeric value
104b0 20 75 73 65 64 20 61 73 20 61 0a 20 2a 09 09 09   used as a. *...
104c0 09 70 72 69 6d 69 74 69 76 65 20 6f 70 65 72 61  .primitive opera
104d0 6e 64 20 69 73 20 64 65 73 63 72 69 62 65 64 20  nd is described 
104e0 62 79 20 61 0a 20 2a 09 09 09 09 54 43 4c 5f 54  by a. *....TCL_T
104f0 4f 4b 45 4e 5f 53 55 42 5f 45 58 50 52 20 74 6f  OKEN_SUB_EXPR to
10500 6b 65 6e 20 66 6f 6c 6c 6f 77 65 64 20 62 79 20  ken followed by 
10510 61 0a 20 2a 09 09 09 09 54 43 4c 5f 54 4f 4b 45  a. *....TCL_TOKE
10520 4e 5f 54 45 58 54 20 74 6f 6b 65 6e 2e 20 41 20  N_TEXT token. A 
10530 62 69 6e 61 72 79 20 73 75 62 65 78 70 72 65 73  binary subexpres
10540 73 69 6f 6e 0a 20 2a 09 09 09 09 69 73 20 64 65  sion. *....is de
10550 73 63 72 69 62 65 64 20 62 79 20 61 20 54 43 4c  scribed by a TCL
10560 5f 54 4f 4b 45 4e 5f 53 55 42 5f 45 58 50 52 20  _TOKEN_SUB_EXPR 
10570 74 6f 6b 65 6e 0a 20 2a 09 09 09 09 66 6f 6c 6c  token. *....foll
10580 6f 77 65 64 20 62 79 20 74 68 65 20 54 43 4c 5f  owed by the TCL_
10590 54 4f 4b 45 4e 5f 4f 50 45 52 41 54 4f 52 20 74  TOKEN_OPERATOR t
105a0 6f 6b 65 6e 20 66 6f 72 0a 20 2a 09 09 09 09 74  oken for. *....t
105b0 68 65 20 6f 70 65 72 61 74 6f 72 2c 20 74 68 65  he operator, the
105c0 6e 20 54 43 4c 5f 54 4f 4b 45 4e 5f 53 55 42 5f  n TCL_TOKEN_SUB_
105d0 45 58 50 52 20 74 6f 6b 65 6e 73 0a 20 2a 09 09  EXPR tokens. *..
105e0 09 09 66 6f 72 20 74 68 65 20 6c 65 66 74 20 74  ..for the left t
105f0 68 65 6e 20 74 68 65 20 72 69 67 68 74 20 6f 70  hen the right op
10600 65 72 61 6e 64 73 2e 0a 20 2a 20 54 43 4c 5f 54  erands.. * TCL_T
10610 4f 4b 45 4e 5f 4f 50 45 52 41 54 4f 52 20 2d 09  OKEN_OPERATOR -.
10620 09 54 68 65 20 74 6f 6b 65 6e 20 64 65 73 63 72  .The token descr
10630 69 62 65 73 20 6f 6e 65 20 65 78 70 72 65 73 73  ibes one express
10640 69 6f 6e 20 6f 70 65 72 61 74 6f 72 2e 0a 20 2a  ion operator.. *
10650 09 09 09 09 41 6e 20 6f 70 65 72 61 74 6f 72 20  ....An operator 
10660 6d 69 67 68 74 20 62 65 20 74 68 65 20 6e 61 6d  might be the nam
10670 65 20 6f 66 20 61 20 6d 61 74 68 0a 20 2a 09 09  e of a math. *..
10680 09 09 66 75 6e 63 74 69 6f 6e 20 73 75 63 68 20  ..function such 
10690 61 73 20 22 61 62 73 22 2e 20 41 20 54 43 4c 5f  as "abs". A TCL_
106a0 54 4f 4b 45 4e 5f 4f 50 45 52 41 54 4f 52 0a 20  TOKEN_OPERATOR. 
106b0 2a 09 09 09 09 74 6f 6b 65 6e 20 69 73 20 61 6c  *....token is al
106c0 77 61 79 73 20 70 72 65 63 65 64 65 64 20 62 79  ways preceded by
106d0 20 6f 6e 65 0a 20 2a 09 09 09 09 54 43 4c 5f 54   one. *....TCL_T
106e0 4f 4b 45 4e 5f 53 55 42 5f 45 58 50 52 20 74 6f  OKEN_SUB_EXPR to
106f0 6b 65 6e 20 66 6f 72 20 74 68 65 20 6f 70 65 72  ken for the oper
10700 61 74 6f 72 27 73 0a 20 2a 09 09 09 09 73 75 62  ator's. *....sub
10710 65 78 70 72 65 73 73 69 6f 6e 2c 20 61 6e 64 20  expression, and 
10720 69 73 20 66 6f 6c 6c 6f 77 65 64 20 62 79 20 7a  is followed by z
10730 65 72 6f 20 6f 72 20 6d 6f 72 65 0a 20 2a 09 09  ero or more. *..
10740 09 09 54 43 4c 5f 54 4f 4b 45 4e 5f 53 55 42 5f  ..TCL_TOKEN_SUB_
10750 45 58 50 52 20 74 6f 6b 65 6e 73 20 66 6f 72 20  EXPR tokens for 
10760 74 68 65 20 6f 70 65 72 61 74 6f 72 27 73 0a 20  the operator's. 
10770 2a 09 09 09 09 6f 70 65 72 61 6e 64 73 2e 20 4e  *....operands. N
10780 75 6d 43 6f 6d 70 6f 6e 65 6e 74 73 20 69 73 20  umComponents is 
10790 61 6c 77 61 79 73 20 30 2e 0a 20 2a 20 54 43 4c  always 0.. * TCL
107a0 5f 54 4f 4b 45 4e 5f 45 58 50 41 4e 44 5f 57 4f  _TOKEN_EXPAND_WO
107b0 52 44 20 2d 09 54 68 69 73 20 74 6f 6b 65 6e 20  RD -.This token 
107c0 69 73 20 6a 75 73 74 20 6c 69 6b 65 20 54 43 4c  is just like TCL
107d0 5f 54 4f 4b 45 4e 5f 57 4f 52 44 20 65 78 63 65  _TOKEN_WORD exce
107e0 70 74 0a 20 2a 09 09 09 09 74 68 61 74 20 69 74  pt. *....that it
107f0 20 6d 61 72 6b 73 20 61 20 77 6f 72 64 20 74 68   marks a word th
10800 61 74 20 62 65 67 61 6e 20 77 69 74 68 20 74 68  at began with th
10810 65 0a 20 2a 09 09 09 09 6c 69 74 65 72 61 6c 20  e. *....literal 
10820 63 68 61 72 61 63 74 65 72 20 70 72 65 66 69 78  character prefix
10830 20 22 7b 2a 7d 22 2e 20 54 68 69 73 20 77 6f 72   "{*}". This wor
10840 64 20 69 73 0a 20 2a 09 09 09 09 6d 61 72 6b 65  d is. *....marke
10850 64 20 74 6f 20 62 65 20 65 78 70 61 6e 64 65 64  d to be expanded
10860 20 2d 20 74 68 61 74 20 69 73 2c 20 62 72 6f 6b   - that is, brok
10870 65 6e 20 69 6e 74 6f 0a 20 2a 09 09 09 09 77 6f  en into. *....wo
10880 72 64 73 20 61 66 74 65 72 20 73 75 62 73 74 69  rds after substi
10890 74 75 74 69 6f 6e 20 69 73 20 63 6f 6d 70 6c 65  tution is comple
108a0 74 65 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65  te.. */..#define
108b0 20 54 43 4c 5f 54 4f 4b 45 4e 5f 57 4f 52 44 09   TCL_TOKEN_WORD.
108c0 09 31 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 54  .1.#define TCL_T
108d0 4f 4b 45 4e 5f 53 49 4d 50 4c 45 5f 57 4f 52 44  OKEN_SIMPLE_WORD
108e0 09 32 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 54  .2.#define TCL_T
108f0 4f 4b 45 4e 5f 54 45 58 54 09 09 34 0a 23 64 65  OKEN_TEXT..4.#de
10900 66 69 6e 65 20 54 43 4c 5f 54 4f 4b 45 4e 5f 42  fine TCL_TOKEN_B
10910 53 09 09 38 0a 23 64 65 66 69 6e 65 20 54 43 4c  S..8.#define TCL
10920 5f 54 4f 4b 45 4e 5f 43 4f 4d 4d 41 4e 44 09 31  _TOKEN_COMMAND.1
10930 36 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 54 4f  6.#define TCL_TO
10940 4b 45 4e 5f 56 41 52 49 41 42 4c 45 09 33 32 0a  KEN_VARIABLE.32.
10950 23 64 65 66 69 6e 65 20 54 43 4c 5f 54 4f 4b 45  #define TCL_TOKE
10960 4e 5f 53 55 42 5f 45 58 50 52 09 36 34 0a 23 64  N_SUB_EXPR.64.#d
10970 65 66 69 6e 65 20 54 43 4c 5f 54 4f 4b 45 4e 5f  efine TCL_TOKEN_
10980 4f 50 45 52 41 54 4f 52 09 31 32 38 0a 23 64 65  OPERATOR.128.#de
10990 66 69 6e 65 20 54 43 4c 5f 54 4f 4b 45 4e 5f 45  fine TCL_TOKEN_E
109a0 58 50 41 4e 44 5f 57 4f 52 44 09 32 35 36 0a 0a  XPAND_WORD.256..
109b0 2f 2a 0a 20 2a 20 50 61 72 73 69 6e 67 20 65 72  /*. * Parsing er
109c0 72 6f 72 20 74 79 70 65 73 2e 20 4f 6e 20 61 6e  ror types. On an
109d0 79 20 70 61 72 73 69 6e 67 20 65 72 72 6f 72 2c  y parsing error,
109e0 20 6f 6e 65 20 6f 66 20 74 68 65 73 65 20 76 61   one of these va
109f0 6c 75 65 73 20 77 69 6c 6c 20 62 65 0a 20 2a 20  lues will be. * 
10a00 73 74 6f 72 65 64 20 69 6e 20 74 68 65 20 65 72  stored in the er
10a10 72 6f 72 20 66 69 65 6c 64 20 6f 66 20 74 68 65  ror field of the
10a20 20 54 63 6c 5f 50 61 72 73 65 20 73 74 72 75 63   Tcl_Parse struc
10a30 74 75 72 65 20 64 65 66 69 6e 65 64 20 62 65 6c  ture defined bel
10a40 6f 77 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65  ow.. */..#define
10a50 20 54 43 4c 5f 50 41 52 53 45 5f 53 55 43 43 45   TCL_PARSE_SUCCE
10a60 53 53 09 09 30 0a 23 64 65 66 69 6e 65 20 54 43  SS..0.#define TC
10a70 4c 5f 50 41 52 53 45 5f 51 55 4f 54 45 5f 45 58  L_PARSE_QUOTE_EX
10a80 54 52 41 09 09 31 0a 23 64 65 66 69 6e 65 20 54  TRA..1.#define T
10a90 43 4c 5f 50 41 52 53 45 5f 42 52 41 43 45 5f 45  CL_PARSE_BRACE_E
10aa0 58 54 52 41 09 09 32 0a 23 64 65 66 69 6e 65 20  XTRA..2.#define 
10ab0 54 43 4c 5f 50 41 52 53 45 5f 4d 49 53 53 49 4e  TCL_PARSE_MISSIN
10ac0 47 5f 42 52 41 43 45 09 09 33 0a 23 64 65 66 69  G_BRACE..3.#defi
10ad0 6e 65 20 54 43 4c 5f 50 41 52 53 45 5f 4d 49 53  ne TCL_PARSE_MIS
10ae0 53 49 4e 47 5f 42 52 41 43 4b 45 54 09 34 0a 23  SING_BRACKET.4.#
10af0 64 65 66 69 6e 65 20 54 43 4c 5f 50 41 52 53 45  define TCL_PARSE
10b00 5f 4d 49 53 53 49 4e 47 5f 50 41 52 45 4e 09 09  _MISSING_PAREN..
10b10 35 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 50 41  5.#define TCL_PA
10b20 52 53 45 5f 4d 49 53 53 49 4e 47 5f 51 55 4f 54  RSE_MISSING_QUOT
10b30 45 09 09 36 0a 23 64 65 66 69 6e 65 20 54 43 4c  E..6.#define TCL
10b40 5f 50 41 52 53 45 5f 4d 49 53 53 49 4e 47 5f 56  _PARSE_MISSING_V
10b50 41 52 5f 42 52 41 43 45 09 37 0a 23 64 65 66 69  AR_BRACE.7.#defi
10b60 6e 65 20 54 43 4c 5f 50 41 52 53 45 5f 53 59 4e  ne TCL_PARSE_SYN
10b70 54 41 58 09 09 38 0a 23 64 65 66 69 6e 65 20 54  TAX..8.#define T
10b80 43 4c 5f 50 41 52 53 45 5f 42 41 44 5f 4e 55 4d  CL_PARSE_BAD_NUM
10b90 42 45 52 09 09 39 0a 0a 2f 2a 0a 20 2a 20 41 20  BER..9../*. * A 
10ba0 73 74 72 75 63 74 75 72 65 20 6f 66 20 74 68 65  structure of the
10bb0 20 66 6f 6c 6c 6f 77 69 6e 67 20 74 79 70 65 20   following type 
10bc0 69 73 20 66 69 6c 6c 65 64 20 69 6e 20 62 79 20  is filled in by 
10bd0 54 63 6c 5f 50 61 72 73 65 43 6f 6d 6d 61 6e 64  Tcl_ParseCommand
10be0 2e 20 49 74 0a 20 2a 20 64 65 73 63 72 69 62 65  . It. * describe
10bf0 73 20 61 20 73 69 6e 67 6c 65 20 63 6f 6d 6d 61  s a single comma
10c00 6e 64 20 70 61 72 73 65 64 20 66 72 6f 6d 20 61  nd parsed from a
10c10 6e 20 69 6e 70 75 74 20 73 74 72 69 6e 67 2e 0a  n input string..
10c20 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 4e 55 4d   */..#define NUM
10c30 5f 53 54 41 54 49 43 5f 54 4f 4b 45 4e 53 20 32  _STATIC_TOKENS 2
10c40 30 0a 0a 74 79 70 65 64 65 66 20 73 74 72 75 63  0..typedef struc
10c50 74 20 54 63 6c 5f 50 61 72 73 65 20 7b 0a 20 20  t Tcl_Parse {.  
10c60 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 63 6f    const char *co
10c70 6d 6d 65 6e 74 53 74 61 72 74 3b 09 2f 2a 20 50  mmentStart;./* P
10c80 6f 69 6e 74 65 72 20 74 6f 20 23 20 74 68 61 74  ointer to # that
10c90 20 62 65 67 69 6e 73 20 74 68 65 20 66 69 72 73   begins the firs
10ca0 74 20 6f 66 20 6f 6e 65 0a 09 09 09 09 20 2a 20  t of one..... * 
10cb0 6f 72 20 6d 6f 72 65 20 63 6f 6d 6d 65 6e 74 73  or more comments
10cc0 20 70 72 65 63 65 64 69 6e 67 20 74 68 65 20 63   preceding the c
10cd0 6f 6d 6d 61 6e 64 2e 20 2a 2f 0a 20 20 20 20 54  ommand. */.    T
10ce0 63 6c 5f 53 69 7a 65 20 63 6f 6d 6d 65 6e 74 53  cl_Size commentS
10cf0 69 7a 65 3b 09 2f 2a 20 4e 75 6d 62 65 72 20 6f  ize;./* Number o
10d00 66 20 62 79 74 65 73 20 69 6e 20 63 6f 6d 6d 65  f bytes in comme
10d10 6e 74 73 20 28 75 70 20 74 68 72 6f 75 67 68 0a  nts (up through.
10d20 09 09 09 09 20 2a 20 6e 65 77 6c 69 6e 65 20 63  .... * newline c
10d30 68 61 72 61 63 74 65 72 20 74 68 61 74 20 74 65  haracter that te
10d40 72 6d 69 6e 61 74 65 73 20 74 68 65 20 6c 61 73  rminates the las
10d50 74 0a 09 09 09 09 20 2a 20 63 6f 6d 6d 65 6e 74  t..... * comment
10d60 29 2e 20 49 66 20 74 68 65 72 65 20 77 65 72 65  ). If there were
10d70 20 6e 6f 20 63 6f 6d 6d 65 6e 74 73 2c 20 74 68   no comments, th
10d80 69 73 0a 09 09 09 09 20 2a 20 66 69 65 6c 64 20  is..... * field 
10d90 69 73 20 30 2e 20 2a 2f 0a 20 20 20 20 63 6f 6e  is 0. */.    con
10da0 73 74 20 63 68 61 72 20 2a 63 6f 6d 6d 61 6e 64  st char *command
10db0 53 74 61 72 74 3b 09 2f 2a 20 46 69 72 73 74 20  Start;./* First 
10dc0 63 68 61 72 61 63 74 65 72 20 69 6e 20 66 69 72  character in fir
10dd0 73 74 20 77 6f 72 64 20 6f 66 0a 09 09 09 09 20  st word of..... 
10de0 2a 20 63 6f 6d 6d 61 6e 64 2e 20 2a 2f 0a 20 20  * command. */.  
10df0 20 20 54 63 6c 5f 53 69 7a 65 20 63 6f 6d 6d 61    Tcl_Size comma
10e00 6e 64 53 69 7a 65 3b 09 2f 2a 20 4e 75 6d 62 65  ndSize;./* Numbe
10e10 72 20 6f 66 20 62 79 74 65 73 20 69 6e 20 63 6f  r of bytes in co
10e20 6d 6d 61 6e 64 2c 20 69 6e 63 6c 75 64 69 6e 67  mmand, including
10e30 20 66 69 72 73 74 0a 09 09 09 09 20 2a 20 63 68   first..... * ch
10e40 61 72 61 63 74 65 72 20 6f 66 20 66 69 72 73 74  aracter of first
10e50 20 77 6f 72 64 2c 20 75 70 20 74 68 72 6f 75 67   word, up throug
10e60 68 20 74 68 65 0a 09 09 09 09 20 2a 20 74 65 72  h the..... * ter
10e70 6d 69 6e 61 74 69 6e 67 20 6e 65 77 6c 69 6e 65  minating newline
10e80 2c 20 63 6c 6f 73 65 20 62 72 61 63 6b 65 74 2c  , close bracket,
10e90 20 6f 72 0a 09 09 09 09 20 2a 20 73 65 6d 69 63   or..... * semic
10ea0 6f 6c 6f 6e 2e 20 2a 2f 0a 20 20 20 20 54 63 6c  olon. */.    Tcl
10eb0 5f 53 69 7a 65 20 6e 75 6d 57 6f 72 64 73 3b 09  _Size numWords;.
10ec0 09 2f 2a 20 54 6f 74 61 6c 20 6e 75 6d 62 65 72  ./* Total number
10ed0 20 6f 66 20 77 6f 72 64 73 20 69 6e 20 63 6f 6d   of words in com
10ee0 6d 61 6e 64 2e 20 4d 61 79 20 62 65 0a 09 09 09  mand. May be....
10ef0 09 20 2a 20 30 2e 20 2a 2f 0a 20 20 20 20 54 63  . * 0. */.    Tc
10f00 6c 5f 54 6f 6b 65 6e 20 2a 74 6f 6b 65 6e 50 74  l_Token *tokenPt
10f10 72 3b 09 2f 2a 20 50 6f 69 6e 74 65 72 20 74 6f  r;./* Pointer to
10f20 20 66 69 72 73 74 20 74 6f 6b 65 6e 20 72 65 70   first token rep
10f30 72 65 73 65 6e 74 69 6e 67 20 74 68 65 0a 09 09  resenting the...
10f40 09 09 20 2a 20 77 6f 72 64 73 20 6f 66 20 74 68  .. * words of th
10f50 65 20 63 6f 6d 6d 61 6e 64 2e 20 49 6e 69 74 69  e command. Initi
10f60 61 6c 6c 79 20 70 6f 69 6e 74 73 20 74 6f 0a 09  ally points to..
10f70 09 09 09 20 2a 20 73 74 61 74 69 63 54 6f 6b 65  ... * staticToke
10f80 6e 73 2c 20 62 75 74 20 6d 61 79 20 63 68 61 6e  ns, but may chan
10f90 67 65 20 74 6f 20 70 6f 69 6e 74 20 74 6f 0a 09  ge to point to..
10fa0 09 09 09 20 2a 20 6d 61 6c 6c 6f 63 2d 65 64 20  ... * malloc-ed 
10fb0 73 70 61 63 65 20 69 66 20 63 6f 6d 6d 61 6e 64  space if command
10fc0 20 65 78 63 65 65 64 73 20 73 70 61 63 65 20 69   exceeds space i
10fd0 6e 0a 09 09 09 09 20 2a 20 73 74 61 74 69 63 54  n..... * staticT
10fe0 6f 6b 65 6e 73 2e 20 2a 2f 0a 20 20 20 20 54 63  okens. */.    Tc
10ff0 6c 5f 53 69 7a 65 20 6e 75 6d 54 6f 6b 65 6e 73  l_Size numTokens
11000 3b 09 09 2f 2a 20 54 6f 74 61 6c 20 6e 75 6d 62  ;../* Total numb
11010 65 72 20 6f 66 20 74 6f 6b 65 6e 73 20 69 6e 20  er of tokens in 
11020 63 6f 6d 6d 61 6e 64 2e 20 2a 2f 0a 20 20 20 20  command. */.    
11030 54 63 6c 5f 53 69 7a 65 20 74 6f 6b 65 6e 73 41  Tcl_Size tokensA
11040 76 61 69 6c 61 62 6c 65 3b 09 2f 2a 20 54 6f 74  vailable;./* Tot
11050 61 6c 20 6e 75 6d 62 65 72 20 6f 66 20 74 6f 6b  al number of tok
11060 65 6e 73 20 61 76 61 69 6c 61 62 6c 65 20 61 74  ens available at
11070 0a 09 09 09 09 20 2a 20 2a 74 6f 6b 65 6e 50 74  ..... * *tokenPt
11080 72 2e 20 2a 2f 0a 20 20 20 20 69 6e 74 20 65 72  r. */.    int er
11090 72 6f 72 54 79 70 65 3b 09 09 2f 2a 20 4f 6e 65  rorType;../* One
110a0 20 6f 66 20 74 68 65 20 70 61 72 73 69 6e 67 20   of the parsing 
110b0 65 72 72 6f 72 20 74 79 70 65 73 20 64 65 66 69  error types defi
110c0 6e 65 64 0a 09 09 09 09 20 2a 20 61 62 6f 76 65  ned..... * above
110d0 2e 20 2a 2f 0a 20 20 20 20 69 6e 74 20 69 6e 63  . */.    int inc
110e0 6f 6d 70 6c 65 74 65 3b 09 09 2f 2a 20 54 68 69  omplete;../* Thi
110f0 73 20 66 69 65 6c 64 20 69 73 20 73 65 74 20 74  s field is set t
11100 6f 20 31 20 62 79 20 54 63 6c 5f 50 61 72 73 65  o 1 by Tcl_Parse
11110 43 6f 6d 6d 61 6e 64 0a 09 09 09 09 20 2a 20 69  Command..... * i
11120 66 20 74 68 65 20 63 6f 6d 6d 61 6e 64 20 61 70  f the command ap
11130 70 65 61 72 73 20 74 6f 20 62 65 20 69 6e 63 6f  pears to be inco
11140 6d 70 6c 65 74 65 2e 0a 09 09 09 09 20 2a 20 54  mplete...... * T
11150 68 69 73 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20  his information 
11160 69 73 20 75 73 65 64 20 62 79 0a 09 09 09 09 20  is used by..... 
11170 2a 20 54 63 6c 5f 43 6f 6d 6d 61 6e 64 43 6f 6d  * Tcl_CommandCom
11180 70 6c 65 74 65 2e 20 2a 2f 0a 0a 20 20 20 20 2f  plete. */..    /
11190 2a 0a 20 20 20 20 20 2a 20 54 68 65 20 66 69 65  *.     * The fie
111a0 6c 64 73 20 62 65 6c 6f 77 20 61 72 65 20 69 6e  lds below are in
111b0 74 65 6e 64 65 64 20 6f 6e 6c 79 20 66 6f 72 20  tended only for 
111c0 74 68 65 20 70 72 69 76 61 74 65 20 75 73 65 20  the private use 
111d0 6f 66 20 74 68 65 20 70 61 72 73 65 72 2e 0a 20  of the parser.. 
111e0 20 20 20 20 2a 20 54 68 65 79 20 73 68 6f 75 6c      * They shoul
111f0 64 20 6e 6f 74 20 62 65 20 75 73 65 64 20 62 79  d not be used by
11200 20 66 75 6e 63 74 69 6f 6e 73 20 74 68 61 74 20   functions that 
11210 69 6e 76 6f 6b 65 20 54 63 6c 5f 50 61 72 73 65  invoke Tcl_Parse
11220 43 6f 6d 6d 61 6e 64 2e 0a 20 20 20 20 20 2a 2f  Command..     */
11230 0a 0a 20 20 20 20 63 6f 6e 73 74 20 63 68 61 72  ..    const char
11240 20 2a 73 74 72 69 6e 67 3b 09 09 2f 2a 20 54 68   *string;../* Th
11250 65 20 6f 72 69 67 69 6e 61 6c 20 63 6f 6d 6d 61  e original comma
11260 6e 64 20 73 74 72 69 6e 67 20 70 61 73 73 65 64  nd string passed
11270 20 74 6f 0a 09 09 09 09 20 2a 20 54 63 6c 5f 50   to..... * Tcl_P
11280 61 72 73 65 43 6f 6d 6d 61 6e 64 2e 20 2a 2f 0a  arseCommand. */.
11290 20 20 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a      const char *
112a0 65 6e 64 3b 09 09 2f 2a 20 50 6f 69 6e 74 73 20  end;../* Points 
112b0 74 6f 20 74 68 65 20 63 68 61 72 61 63 74 65 72  to the character
112c0 20 6a 75 73 74 20 61 66 74 65 72 20 74 68 65 20   just after the 
112d0 6c 61 73 74 0a 09 09 09 09 20 2a 20 6f 6e 65 20  last..... * one 
112e0 69 6e 20 74 68 65 20 63 6f 6d 6d 61 6e 64 20 73  in the command s
112f0 74 72 69 6e 67 2e 20 2a 2f 0a 20 20 20 20 54 63  tring. */.    Tc
11300 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70  l_Interp *interp
11310 3b 09 09 2f 2a 20 49 6e 74 65 72 70 72 65 74 65  ;../* Interprete
11320 72 20 74 6f 20 75 73 65 20 66 6f 72 20 65 72 72  r to use for err
11330 6f 72 20 72 65 70 6f 72 74 69 6e 67 2c 20 6f 72  or reporting, or
11340 0a 09 09 09 09 20 2a 20 4e 55 4c 4c 2e 20 2a 2f  ..... * NULL. */
11350 0a 20 20 20 20 63 6f 6e 73 74 20 63 68 61 72 20  .    const char 
11360 2a 74 65 72 6d 3b 09 09 2f 2a 20 50 6f 69 6e 74  *term;../* Point
11370 73 20 74 6f 20 63 68 61 72 61 63 74 65 72 20 69  s to character i
11380 6e 20 73 74 72 69 6e 67 20 74 68 61 74 0a 09 09  n string that...
11390 09 09 20 2a 20 74 65 72 6d 69 6e 61 74 65 64 20  .. * terminated 
113a0 6d 6f 73 74 20 72 65 63 65 6e 74 20 74 6f 6b 65  most recent toke
113b0 6e 2e 20 46 69 6c 6c 65 64 20 69 6e 20 62 79 0a  n. Filled in by.
113c0 09 09 09 09 20 2a 20 50 61 72 73 65 54 6f 6b 65  .... * ParseToke
113d0 6e 73 2e 20 49 66 20 61 6e 20 65 72 72 6f 72 20  ns. If an error 
113e0 6f 63 63 75 72 73 2c 20 70 6f 69 6e 74 73 20 74  occurs, points t
113f0 6f 0a 09 09 09 09 20 2a 20 62 65 67 69 6e 6e 69  o..... * beginni
11400 6e 67 20 6f 66 20 72 65 67 69 6f 6e 20 77 68 65  ng of region whe
11410 72 65 20 74 68 65 20 65 72 72 6f 72 0a 09 09 09  re the error....
11420 09 20 2a 20 6f 63 63 75 72 72 65 64 20 28 65 2e  . * occurred (e.
11430 67 2e 20 74 68 65 20 6f 70 65 6e 20 62 72 61 63  g. the open brac
11440 65 20 69 66 20 74 68 65 20 63 6c 6f 73 65 0a 09  e if the close..
11450 09 09 09 20 2a 20 62 72 61 63 65 20 69 73 20 6d  ... * brace is m
11460 69 73 73 69 6e 67 29 2e 20 2a 2f 0a 20 20 20 20  issing). */.    
11470 54 63 6c 5f 54 6f 6b 65 6e 20 73 74 61 74 69 63  Tcl_Token static
11480 54 6f 6b 65 6e 73 5b 4e 55 4d 5f 53 54 41 54 49  Tokens[NUM_STATI
11490 43 5f 54 4f 4b 45 4e 53 5d 3b 0a 09 09 09 09 2f  C_TOKENS];...../
114a0 2a 20 49 6e 69 74 69 61 6c 20 73 70 61 63 65 20  * Initial space 
114b0 66 6f 72 20 74 6f 6b 65 6e 73 20 66 6f 72 20 63  for tokens for c
114c0 6f 6d 6d 61 6e 64 2e 20 54 68 69 73 0a 09 09 09  ommand. This....
114d0 09 20 2a 20 73 70 61 63 65 20 73 68 6f 75 6c 64  . * space should
114e0 20 62 65 20 6c 61 72 67 65 20 65 6e 6f 75 67 68   be large enough
114f0 20 74 6f 20 61 63 63 6f 6d 6d 6f 64 61 74 65 0a   to accommodate.
11500 09 09 09 09 20 2a 20 6d 6f 73 74 20 63 6f 6d 6d  .... * most comm
11510 61 6e 64 73 3b 20 64 79 6e 61 6d 69 63 20 73 70  ands; dynamic sp
11520 61 63 65 20 69 73 20 61 6c 6c 6f 63 61 74 65 64  ace is allocated
11530 0a 09 09 09 09 20 2a 20 66 6f 72 20 76 65 72 79  ..... * for very
11540 20 6c 61 72 67 65 20 63 6f 6d 6d 61 6e 64 73 20   large commands 
11550 74 68 61 74 20 64 6f 6e 27 74 20 66 69 74 0a 09  that don't fit..
11560 09 09 09 20 2a 20 68 65 72 65 2e 20 2a 2f 0a 7d  ... * here. */.}
11570 20 54 63 6c 5f 50 61 72 73 65 3b 0a 0c 0a 2f 2a   Tcl_Parse;.../*
11580 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  . *-------------
11590 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
115a0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
115b0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
115c0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a  ---------------.
115d0 20 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67   * The following
115e0 20 73 74 72 75 63 74 75 72 65 20 72 65 70 72 65   structure repre
115f0 73 65 6e 74 73 20 61 20 75 73 65 72 2d 64 65 66  sents a user-def
11600 69 6e 65 64 20 65 6e 63 6f 64 69 6e 67 2e 20 49  ined encoding. I
11610 74 20 63 6f 6c 6c 65 63 74 73 0a 20 2a 20 74 6f  t collects. * to
11620 67 65 74 68 65 72 20 61 6c 6c 20 74 68 65 20 66  gether all the f
11630 75 6e 63 74 69 6f 6e 73 20 74 68 61 74 20 61 72  unctions that ar
11640 65 20 75 73 65 64 20 62 79 20 74 68 65 20 73 70  e used by the sp
11650 65 63 69 66 69 63 20 65 6e 63 6f 64 69 6e 67 2e  ecific encoding.
11660 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 73 74  . */..typedef st
11670 72 75 63 74 20 54 63 6c 5f 45 6e 63 6f 64 69 6e  ruct Tcl_Encodin
11680 67 54 79 70 65 20 7b 0a 20 20 20 20 63 6f 6e 73  gType {.    cons
11690 74 20 63 68 61 72 20 2a 65 6e 63 6f 64 69 6e 67  t char *encoding
116a0 4e 61 6d 65 3b 09 2f 2a 20 54 68 65 20 6e 61 6d  Name;./* The nam
116b0 65 20 6f 66 20 74 68 65 20 65 6e 63 6f 64 69 6e  e of the encodin
116c0 67 2c 20 65 2e 67 2e 20 22 65 75 63 2d 6a 70 22  g, e.g. "euc-jp"
116d0 2e 0a 09 09 09 09 20 2a 20 54 68 69 73 20 6e 61  ...... * This na
116e0 6d 65 20 69 73 20 74 68 65 20 75 6e 69 71 75 65  me is the unique
116f0 20 6b 65 79 20 66 6f 72 20 74 68 69 73 0a 09 09   key for this...
11700 09 09 20 2a 20 65 6e 63 6f 64 69 6e 67 20 74 79  .. * encoding ty
11710 70 65 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 45  pe. */.    Tcl_E
11720 6e 63 6f 64 69 6e 67 43 6f 6e 76 65 72 74 50 72  ncodingConvertPr
11730 6f 63 20 2a 74 6f 55 74 66 50 72 6f 63 3b 0a 09  oc *toUtfProc;..
11740 09 09 09 2f 2a 20 46 75 6e 63 74 69 6f 6e 20 74  .../* Function t
11750 6f 20 63 6f 6e 76 65 72 74 20 66 72 6f 6d 20 65  o convert from e
11760 78 74 65 72 6e 61 6c 20 65 6e 63 6f 64 69 6e 67  xternal encoding
11770 0a 09 09 09 09 20 2a 20 69 6e 74 6f 20 55 54 46  ..... * into UTF
11780 2d 38 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 45  -8. */.    Tcl_E
11790 6e 63 6f 64 69 6e 67 43 6f 6e 76 65 72 74 50 72  ncodingConvertPr
117a0 6f 63 20 2a 66 72 6f 6d 55 74 66 50 72 6f 63 3b  oc *fromUtfProc;
117b0 0a 09 09 09 09 2f 2a 20 46 75 6e 63 74 69 6f 6e  ...../* Function
117c0 20 74 6f 20 63 6f 6e 76 65 72 74 20 66 72 6f 6d   to convert from
117d0 20 55 54 46 2d 38 20 69 6e 74 6f 0a 09 09 09 09   UTF-8 into.....
117e0 20 2a 20 65 78 74 65 72 6e 61 6c 20 65 6e 63 6f   * external enco
117f0 64 69 6e 67 2e 20 2a 2f 0a 20 20 20 20 54 63 6c  ding. */.    Tcl
11800 5f 46 72 65 65 50 72 6f 63 20 2a 66 72 65 65 50  _FreeProc *freeP
11810 72 6f 63 3b 09 2f 2a 20 49 66 20 6e 6f 6e 2d 4e  roc;./* If non-N
11820 55 4c 4c 2c 20 66 75 6e 63 74 69 6f 6e 20 74 6f  ULL, function to
11830 20 63 61 6c 6c 20 77 68 65 6e 20 74 68 69 73 0a   call when this.
11840 09 09 09 09 20 2a 20 65 6e 63 6f 64 69 6e 67 20  .... * encoding 
11850 69 73 20 64 65 6c 65 74 65 64 2e 20 2a 2f 0a 20  is deleted. */. 
11860 20 20 20 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44     void *clientD
11870 61 74 61 3b 09 09 2f 2a 20 41 72 62 69 74 72 61  ata;../* Arbitra
11880 72 79 20 76 61 6c 75 65 20 61 73 73 6f 63 69 61  ry value associa
11890 74 65 64 20 77 69 74 68 20 65 6e 63 6f 64 69 6e  ted with encodin
118a0 67 0a 09 09 09 09 20 2a 20 74 79 70 65 2e 20 50  g..... * type. P
118b0 61 73 73 65 64 20 74 6f 20 63 6f 6e 76 65 72 73  assed to convers
118c0 69 6f 6e 20 66 75 6e 63 74 69 6f 6e 73 2e 20 2a  ion functions. *
118d0 2f 0a 20 20 20 20 54 63 6c 5f 53 69 7a 65 20 6e  /.    Tcl_Size n
118e0 75 6c 6c 53 69 7a 65 3b 09 09 2f 2a 20 4e 75 6d  ullSize;../* Num
118f0 62 65 72 20 6f 66 20 7a 65 72 6f 20 62 79 74 65  ber of zero byte
11900 73 20 74 68 61 74 20 73 69 67 6e 69 66 79 0a 09  s that signify..
11910 09 09 09 20 2a 20 65 6e 64 2d 6f 66 2d 73 74 72  ... * end-of-str
11920 69 6e 67 20 69 6e 20 74 68 69 73 20 65 6e 63 6f  ing in this enco
11930 64 69 6e 67 2e 20 54 68 69 73 20 6e 75 6d 62 65  ding. This numbe
11940 72 0a 09 09 09 09 20 2a 20 69 73 20 75 73 65 64  r..... * is used
11950 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 74 68   to determine th
11960 65 20 73 6f 75 72 63 65 20 73 74 72 69 6e 67 0a  e source string.
11970 09 09 09 09 20 2a 20 6c 65 6e 67 74 68 20 77 68  .... * length wh
11980 65 6e 20 74 68 65 20 73 72 63 4c 65 6e 20 61 72  en the srcLen ar
11990 67 75 6d 65 6e 74 20 69 73 0a 09 09 09 09 20 2a  gument is..... *
119a0 20 6e 65 67 61 74 69 76 65 2e 20 4d 75 73 74 20   negative. Must 
119b0 62 65 20 31 2c 20 32 2c 20 6f 72 20 34 2e 20 2a  be 1, 2, or 4. *
119c0 2f 0a 7d 20 54 63 6c 5f 45 6e 63 6f 64 69 6e 67  /.} Tcl_Encoding
119d0 54 79 70 65 3b 0a 0a 2f 2a 0a 20 2a 20 54 68 65  Type;../*. * The
119e0 20 66 6f 6c 6c 6f 77 69 6e 67 20 64 65 66 69 6e   following defin
119f0 69 74 69 6f 6e 73 20 61 72 65 20 75 73 65 64 20  itions are used 
11a00 61 73 20 76 61 6c 75 65 73 20 66 6f 72 20 74 68  as values for th
11a10 65 20 63 6f 6e 76 65 72 73 69 6f 6e 20 63 6f 6e  e conversion con
11a20 74 72 6f 6c 0a 20 2a 20 66 6c 61 67 73 20 61 72  trol. * flags ar
11a30 67 75 6d 65 6e 74 20 77 68 65 6e 20 63 6f 6e 76  gument when conv
11a40 65 72 74 69 6e 67 20 74 65 78 74 20 66 72 6f 6d  erting text from
11a50 20 6f 6e 65 20 63 68 61 72 61 63 74 65 72 20 73   one character s
11a60 65 74 20 74 6f 20 61 6e 6f 74 68 65 72 3a 0a 20  et to another:. 
11a70 2a 0a 20 2a 20 54 43 4c 5f 45 4e 43 4f 44 49 4e  *. * TCL_ENCODIN
11a80 47 5f 53 54 41 52 54 20 2d 09 09 53 69 67 6e 69  G_START -..Signi
11a90 66 69 65 73 20 74 68 61 74 20 74 68 65 20 73 6f  fies that the so
11aa0 75 72 63 65 20 62 75 66 66 65 72 20 69 73 20 74  urce buffer is t
11ab0 68 65 20 66 69 72 73 74 0a 20 2a 09 09 09 09 62  he first. *....b
11ac0 6c 6f 63 6b 20 69 6e 20 61 20 28 70 6f 74 65 6e  lock in a (poten
11ad0 74 69 61 6c 6c 79 20 6d 75 6c 74 69 2d 62 6c 6f  tially multi-blo
11ae0 63 6b 29 20 69 6e 70 75 74 0a 20 2a 09 09 09 09  ck) input. *....
11af0 73 74 72 65 61 6d 2e 20 54 65 6c 6c 73 20 74 68  stream. Tells th
11b00 65 20 63 6f 6e 76 65 72 73 69 6f 6e 20 66 75 6e  e conversion fun
11b10 63 74 69 6f 6e 20 74 6f 20 72 65 73 65 74 0a 20  ction to reset. 
11b20 2a 09 09 09 09 74 6f 20 61 6e 20 69 6e 69 74 69  *....to an initi
11b30 61 6c 20 73 74 61 74 65 20 61 6e 64 20 70 65 72  al state and per
11b40 66 6f 72 6d 20 61 6e 79 0a 20 2a 09 09 09 09 69  form any. *....i
11b50 6e 69 74 69 61 6c 69 7a 61 74 69 6f 6e 20 74 68  nitialization th
11b60 61 74 20 6e 65 65 64 73 20 74 6f 20 6f 63 63 75  at needs to occu
11b70 72 20 62 65 66 6f 72 65 20 74 68 65 0a 20 2a 09  r before the. *.
11b80 09 09 09 66 69 72 73 74 20 62 79 74 65 20 69 73  ...first byte is
11b90 20 63 6f 6e 76 65 72 74 65 64 2e 20 49 66 20 74   converted. If t
11ba0 68 65 20 73 6f 75 72 63 65 20 62 75 66 66 65 72  he source buffer
11bb0 0a 20 2a 09 09 09 09 63 6f 6e 74 61 69 6e 73 20  . *....contains 
11bc0 74 68 65 20 65 6e 74 69 72 65 20 69 6e 70 75 74  the entire input
11bd0 20 73 74 72 65 61 6d 20 74 6f 20 62 65 0a 20 2a   stream to be. *
11be0 09 09 09 09 63 6f 6e 76 65 72 74 65 64 2c 20 74  ....converted, t
11bf0 68 69 73 20 66 6c 61 67 20 73 68 6f 75 6c 64 20  his flag should 
11c00 62 65 20 73 65 74 2e 0a 20 2a 20 54 43 4c 5f 45  be set.. * TCL_E
11c10 4e 43 4f 44 49 4e 47 5f 45 4e 44 20 2d 09 09 53  NCODING_END -..S
11c20 69 67 6e 69 66 69 65 73 20 74 68 61 74 20 74 68  ignifies that th
11c30 65 20 73 6f 75 72 63 65 20 62 75 66 66 65 72 20  e source buffer 
11c40 69 73 20 74 68 65 20 6c 61 73 74 0a 20 2a 09 09  is the last. *..
11c50 09 09 62 6c 6f 63 6b 20 69 6e 20 61 20 28 70 6f  ..block in a (po
11c60 74 65 6e 74 69 61 6c 6c 79 20 6d 75 6c 74 69 2d  tentially multi-
11c70 62 6c 6f 63 6b 29 20 69 6e 70 75 74 0a 20 2a 09  block) input. *.
11c80 09 09 09 73 74 72 65 61 6d 2e 20 54 65 6c 6c 73  ...stream. Tells
11c90 20 74 68 65 20 63 6f 6e 76 65 72 73 69 6f 6e 20   the conversion 
11ca0 72 6f 75 74 69 6e 65 20 74 6f 0a 20 2a 09 09 09  routine to. *...
11cb0 09 70 65 72 66 6f 72 6d 20 61 6e 79 20 66 69 6e  .perform any fin
11cc0 61 6c 69 7a 61 74 69 6f 6e 20 74 68 61 74 20 6e  alization that n
11cd0 65 65 64 73 20 74 6f 20 6f 63 63 75 72 0a 20 2a  eeds to occur. *
11ce0 09 09 09 09 61 66 74 65 72 20 74 68 65 20 6c 61  ....after the la
11cf0 73 74 20 62 79 74 65 20 69 73 20 63 6f 6e 76 65  st byte is conve
11d00 72 74 65 64 20 61 6e 64 20 74 68 65 6e 20 74 6f  rted and then to
11d10 0a 20 2a 09 09 09 09 72 65 73 65 74 20 74 6f 20  . *....reset to 
11d20 61 6e 20 69 6e 69 74 69 61 6c 20 73 74 61 74 65  an initial state
11d30 2e 20 49 66 20 74 68 65 20 73 6f 75 72 63 65 0a  . If the source.
11d40 20 2a 09 09 09 09 62 75 66 66 65 72 20 63 6f 6e   *....buffer con
11d50 74 61 69 6e 73 20 74 68 65 20 65 6e 74 69 72 65  tains the entire
11d60 20 69 6e 70 75 74 20 73 74 72 65 61 6d 20 74 6f   input stream to
11d70 20 62 65 0a 20 2a 09 09 09 09 63 6f 6e 76 65 72   be. *....conver
11d80 74 65 64 2c 20 74 68 69 73 20 66 6c 61 67 20 73  ted, this flag s
11d90 68 6f 75 6c 64 20 62 65 20 73 65 74 2e 0a 20 2a  hould be set.. *
11da0 20 54 43 4c 5f 45 4e 43 4f 44 49 4e 47 5f 53 54   TCL_ENCODING_ST
11db0 4f 50 4f 4e 45 52 52 4f 52 20 2d 09 4e 6f 74 20  OPONERROR -.Not 
11dc0 75 73 65 64 20 61 6e 79 20 6d 6f 72 65 2e 0a 20  used any more.. 
11dd0 2a 20 54 43 4c 5f 45 4e 43 4f 44 49 4e 47 5f 4e  * TCL_ENCODING_N
11de0 4f 5f 54 45 52 4d 49 4e 41 54 45 20 2d 09 49 66  O_TERMINATE -.If
11df0 20 73 65 74 2c 20 54 63 6c 5f 45 78 74 65 72 6e   set, Tcl_Extern
11e00 61 6c 54 6f 55 74 66 20 64 6f 65 73 20 6e 6f 74  alToUtf does not
11e10 20 61 70 70 65 6e 64 20 61 0a 20 2a 09 09 09 09   append a. *....
11e20 74 65 72 6d 69 6e 61 74 69 6e 67 20 4e 55 4c 20  terminating NUL 
11e30 62 79 74 65 2e 20 20 53 69 6e 63 65 20 69 74 20  byte.  Since it 
11e40 64 6f 65 73 20 6e 6f 74 20 6e 65 65 64 0a 20 2a  does not need. *
11e50 09 09 09 09 61 6e 20 65 78 74 72 61 20 62 79 74  ....an extra byt
11e60 65 20 66 6f 72 20 61 20 74 65 72 6d 69 6e 61 74  e for a terminat
11e70 69 6e 67 20 4e 55 4c 2c 20 69 74 20 66 69 6c 6c  ing NUL, it fill
11e80 73 0a 20 2a 09 09 09 09 61 6c 6c 20 64 73 74 4c  s. *....all dstL
11e90 65 6e 20 62 79 74 65 73 20 77 69 74 68 20 65 6e  en bytes with en
11ea0 63 6f 64 65 64 20 55 54 46 2d 38 20 63 6f 6e 74  coded UTF-8 cont
11eb0 65 6e 74 20 69 66 0a 20 2a 09 09 09 09 6e 65 65  ent if. *....nee
11ec0 64 65 64 2e 20 20 49 66 20 63 6c 65 61 72 2c 20  ded.  If clear, 
11ed0 61 20 62 79 74 65 20 69 73 20 72 65 73 65 72 76  a byte is reserv
11ee0 65 64 20 69 6e 20 74 68 65 0a 20 2a 09 09 09 09  ed in the. *....
11ef0 64 73 74 20 73 70 61 63 65 20 66 6f 72 20 4e 55  dst space for NU
11f00 4c 20 74 65 72 6d 69 6e 61 74 69 6f 6e 2c 20 61  L termination, a
11f10 6e 64 20 61 0a 20 2a 09 09 09 09 74 65 72 6d 69  nd a. *....termi
11f20 6e 61 74 69 6e 67 20 4e 55 4c 20 69 73 20 61 70  nating NUL is ap
11f30 70 65 6e 64 65 64 2e 0a 20 2a 20 54 43 4c 5f 45  pended.. * TCL_E
11f40 4e 43 4f 44 49 4e 47 5f 43 48 41 52 5f 4c 49 4d  NCODING_CHAR_LIM
11f50 49 54 20 2d 09 49 66 20 73 65 74 20 61 6e 64 20  IT -.If set and 
11f60 64 73 74 43 68 61 72 73 50 74 72 20 69 73 20 6e  dstCharsPtr is n
11f70 6f 74 20 4e 55 4c 4c 2c 20 74 68 65 6e 0a 20 2a  ot NULL, then. *
11f80 09 09 09 09 54 63 6c 5f 45 78 74 65 72 6e 61 6c  ....Tcl_External
11f90 54 6f 55 74 66 20 74 61 6b 65 73 20 74 68 65 20  ToUtf takes the 
11fa0 69 6e 69 74 69 61 6c 20 76 61 6c 75 65 20 6f 66  initial value of
11fb0 0a 20 2a 09 09 09 09 2a 64 73 74 43 68 61 72 73  . *....*dstChars
11fc0 50 74 72 20 61 73 20 61 20 6c 69 6d 69 74 20 6f  Ptr as a limit o
11fd0 66 20 74 68 65 20 6d 61 78 69 6d 75 6d 20 6e 75  f the maximum nu
11fe0 6d 62 65 72 0a 20 2a 09 09 09 09 6f 66 20 63 68  mber. *....of ch
11ff0 61 72 73 20 74 6f 20 70 72 6f 64 75 63 65 20 69  ars to produce i
12000 6e 20 74 68 65 20 65 6e 63 6f 64 65 64 20 55 54  n the encoded UT
12010 46 2d 38 0a 20 2a 09 09 09 09 63 6f 6e 74 65 6e  F-8. *....conten
12020 74 2e 20 20 4f 74 68 65 72 77 69 73 65 2c 20 74  t.  Otherwise, t
12030 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 63 68 61  he number of cha
12040 72 73 0a 20 2a 09 09 09 09 70 72 6f 64 75 63 65  rs. *....produce
12050 64 20 69 73 20 63 6f 6e 74 72 6f 6c 6c 65 64 20  d is controlled 
12060 6f 6e 6c 79 20 62 79 20 6f 74 68 65 72 20 6c 69  only by other li
12070 6d 69 74 69 6e 67 0a 20 2a 09 09 09 09 66 61 63  miting. *....fac
12080 74 6f 72 73 2e 0a 20 2a 20 54 43 4c 5f 45 4e 43  tors.. * TCL_ENC
12090 4f 44 49 4e 47 5f 50 52 4f 46 49 4c 45 5f 2a 20  ODING_PROFILE_* 
120a0 2d 09 4d 75 74 75 61 6c 6c 79 20 65 78 63 6c 75  -.Mutually exclu
120b0 73 69 76 65 20 65 6e 63 6f 64 69 6e 67 20 70 72  sive encoding pr
120c0 6f 66 69 6c 65 20 69 64 73 2e 20 4e 6f 74 65 0a  ofile ids. Note.
120d0 20 2a 09 09 09 09 74 68 65 73 65 20 61 72 65 20   *....these are 
120e0 62 69 74 20 6d 61 73 6b 73 2e 0a 20 2a 0a 20 2a  bit masks.. *. *
120f0 20 4e 4f 54 45 3a 20 54 48 45 53 45 20 42 49 54   NOTE: THESE BIT
12100 20 44 45 46 49 4e 49 54 49 4f 4e 53 20 53 48 4f   DEFINITIONS SHO
12110 55 4c 44 20 4e 4f 54 20 4f 56 45 52 4c 41 50 20  ULD NOT OVERLAP 
12120 57 49 54 48 20 49 4e 54 45 52 4e 41 4c 20 55 53  WITH INTERNAL US
12130 45 20 42 49 54 53 0a 20 2a 20 44 45 46 49 4e 45  E BITS. * DEFINE
12140 44 20 49 4e 20 74 63 6c 45 6e 63 6f 64 69 6e 67  D IN tclEncoding
12150 2e 63 20 28 45 4e 43 4f 44 49 4e 47 5f 49 4e 50  .c (ENCODING_INP
12160 55 54 20 65 74 20 61 6c 29 2e 20 42 65 20 63 6f  UT et al). Be co
12170 67 6e 69 7a 61 6e 74 20 6f 66 20 74 68 69 73 0a  gnizant of this.
12180 20 2a 20 77 68 65 6e 20 61 64 64 69 6e 67 20 62   * when adding b
12190 69 74 73 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e  its.. */..#defin
121a0 65 20 54 43 4c 5f 45 4e 43 4f 44 49 4e 47 5f 53  e TCL_ENCODING_S
121b0 54 41 52 54 09 09 30 78 30 31 0a 23 64 65 66 69  TART..0x01.#defi
121c0 6e 65 20 54 43 4c 5f 45 4e 43 4f 44 49 4e 47 5f  ne TCL_ENCODING_
121d0 45 4e 44 09 09 30 78 30 32 0a 23 64 65 66 69 6e  END..0x02.#defin
121e0 65 20 54 43 4c 5f 45 4e 43 4f 44 49 4e 47 5f 53  e TCL_ENCODING_S
121f0 54 4f 50 4f 4e 45 52 52 4f 52 09 30 78 30 20 2f  TOPONERROR.0x0 /
12200 2a 20 4e 6f 74 20 75 73 65 64 20 61 6e 79 20 6d  * Not used any m
12210 6f 72 65 20 2a 2f 0a 23 64 65 66 69 6e 65 20 54  ore */.#define T
12220 43 4c 5f 45 4e 43 4f 44 49 4e 47 5f 4e 4f 5f 54  CL_ENCODING_NO_T
12230 45 52 4d 49 4e 41 54 45 09 30 78 30 38 0a 23 64  ERMINATE.0x08.#d
12240 65 66 69 6e 65 20 54 43 4c 5f 45 4e 43 4f 44 49  efine TCL_ENCODI
12250 4e 47 5f 43 48 41 52 5f 4c 49 4d 49 54 09 09 30  NG_CHAR_LIMIT..0
12260 78 31 30 0a 2f 2a 20 49 6e 74 65 72 6e 61 6c 20  x10./* Internal 
12270 75 73 65 20 62 69 74 73 2c 20 64 6f 20 6e 6f 74  use bits, do not
12280 20 64 65 66 69 6e 65 20 62 69 74 73 20 69 6e 20   define bits in 
12290 74 68 69 73 20 73 70 61 63 65 2e 20 53 65 65 20  this space. See 
122a0 61 62 6f 76 65 20 63 6f 6d 6d 65 6e 74 20 2a 2f  above comment */
122b0 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 45 4e 43  .#define TCL_ENC
122c0 4f 44 49 4e 47 5f 49 4e 54 45 52 4e 41 4c 5f 55  ODING_INTERNAL_U
122d0 53 45 5f 4d 41 53 4b 20 20 30 78 46 46 30 30 0a  SE_MASK  0xFF00.
122e0 2f 2a 0a 20 2a 20 52 65 73 65 72 76 65 20 74 6f  /*. * Reserve to
122f0 70 20 62 79 74 65 20 66 6f 72 20 70 72 6f 66 69  p byte for profi
12300 6c 65 20 76 61 6c 75 65 73 20 28 64 69 73 6a 6f  le values (disjo
12310 69 6e 74 2c 20 6e 6f 74 20 61 20 6d 61 73 6b 29  int, not a mask)
12320 2e 20 49 6e 20 63 61 73 65 20 6f 66 0a 20 2a 20  . In case of. * 
12330 63 68 61 6e 67 65 73 2c 20 65 6e 73 75 72 65 20  changes, ensure 
12340 45 4e 43 4f 44 49 4e 47 5f 50 52 4f 46 49 4c 45  ENCODING_PROFILE
12350 5f 2a 20 6d 61 63 72 6f 73 20 69 6e 20 74 63 6c  _* macros in tcl
12360 49 6e 74 2e 68 20 61 72 65 20 6d 6f 64 69 66 69  Int.h are modifi
12370 65 64 20 69 66 0a 20 2a 20 6e 65 63 65 73 73 61  ed if. * necessa
12380 72 79 2e 0a 20 2a 2f 0a 23 64 65 66 69 6e 65 20  ry.. */.#define 
12390 54 43 4c 5f 45 4e 43 4f 44 49 4e 47 5f 50 52 4f  TCL_ENCODING_PRO
123a0 46 49 4c 45 5f 53 54 52 49 43 54 20 20 20 30 78  FILE_STRICT   0x
123b0 30 30 30 30 30 30 30 30 0a 23 64 65 66 69 6e 65  00000000.#define
123c0 20 54 43 4c 5f 45 4e 43 4f 44 49 4e 47 5f 50 52   TCL_ENCODING_PR
123d0 4f 46 49 4c 45 5f 54 43 4c 38 20 20 20 20 20 30  OFILE_TCL8     0
123e0 78 30 31 30 30 30 30 30 30 0a 23 64 65 66 69 6e  x01000000.#defin
123f0 65 20 54 43 4c 5f 45 4e 43 4f 44 49 4e 47 5f 50  e TCL_ENCODING_P
12400 52 4f 46 49 4c 45 5f 52 45 50 4c 41 43 45 20 20  ROFILE_REPLACE  
12410 30 78 30 32 30 30 30 30 30 30 0a 0a 2f 2a 0a 20  0x02000000../*. 
12420 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20  * The following 
12430 64 65 66 69 6e 69 74 69 6f 6e 73 20 61 72 65 20  definitions are 
12440 74 68 65 20 65 72 72 6f 72 20 63 6f 64 65 73 20  the error codes 
12450 72 65 74 75 72 6e 65 64 20 62 79 20 74 68 65 20  returned by the 
12460 63 6f 6e 76 65 72 73 69 6f 6e 0a 20 2a 20 72 6f  conversion. * ro
12470 75 74 69 6e 65 73 3a 0a 20 2a 0a 20 2a 20 54 43  utines:. *. * TC
12480 4c 5f 4f 4b 20 2d 09 09 09 41 6c 6c 20 63 68 61  L_OK -...All cha
12490 72 61 63 74 65 72 73 20 77 65 72 65 20 63 6f 6e  racters were con
124a0 76 65 72 74 65 64 2e 0a 20 2a 20 54 43 4c 5f 43  verted.. * TCL_C
124b0 4f 4e 56 45 52 54 5f 4e 4f 53 50 41 43 45 20 2d  ONVERT_NOSPACE -
124c0 09 54 68 65 20 6f 75 74 70 75 74 20 62 75 66 66  .The output buff
124d0 65 72 20 77 6f 75 6c 64 20 6e 6f 74 20 68 61 76  er would not hav
124e0 65 20 62 65 65 6e 20 6c 61 72 67 65 0a 20 2a 09  e been large. *.
124f0 09 09 09 65 6e 6f 75 67 68 20 66 6f 72 20 61 6c  ...enough for al
12500 6c 20 6f 66 20 74 68 65 20 63 6f 6e 76 65 72 74  l of the convert
12510 65 64 20 64 61 74 61 3b 20 61 73 20 6d 61 6e 79  ed data; as many
12520 0a 20 2a 09 09 09 09 63 68 61 72 61 63 74 65 72  . *....character
12530 73 20 61 73 20 63 6f 75 6c 64 20 66 69 74 20 77  s as could fit w
12540 65 72 65 20 63 6f 6e 76 65 72 74 65 64 20 74 68  ere converted th
12550 6f 75 67 68 2e 0a 20 2a 20 54 43 4c 5f 43 4f 4e  ough.. * TCL_CON
12560 56 45 52 54 5f 4d 55 4c 54 49 42 59 54 45 20 2d  VERT_MULTIBYTE -
12570 09 54 68 65 20 6c 61 73 74 20 66 65 77 20 62 79  .The last few by
12580 74 65 73 20 69 6e 20 74 68 65 20 73 6f 75 72 63  tes in the sourc
12590 65 20 73 74 72 69 6e 67 20 77 65 72 65 0a 20 2a  e string were. *
125a0 09 09 09 09 74 68 65 20 62 65 67 69 6e 6e 69 6e  ....the beginnin
125b0 67 20 6f 66 20 61 20 6d 75 6c 74 69 62 79 74 65  g of a multibyte
125c0 20 73 65 71 75 65 6e 63 65 2c 20 62 75 74 0a 20   sequence, but. 
125d0 2a 09 09 09 09 6d 6f 72 65 20 62 79 74 65 73 20  *....more bytes 
125e0 77 65 72 65 20 6e 65 65 64 65 64 20 74 6f 20 63  were needed to c
125f0 6f 6d 70 6c 65 74 65 20 74 68 69 73 0a 20 2a 09  omplete this. *.
12600 09 09 09 73 65 71 75 65 6e 63 65 2e 20 41 20 73  ...sequence. A s
12610 75 62 73 65 71 75 65 6e 74 20 63 61 6c 6c 20 74  ubsequent call t
12620 6f 20 74 68 65 20 63 6f 6e 76 65 72 73 69 6f 6e  o the conversion
12630 0a 20 2a 09 09 09 09 72 6f 75 74 69 6e 65 20 73  . *....routine s
12640 68 6f 75 6c 64 20 70 61 73 73 20 74 68 65 20 62  hould pass the b
12650 65 67 69 6e 6e 69 6e 67 20 6f 66 20 74 68 69 73  eginning of this
12660 0a 20 2a 09 09 09 09 75 6e 63 6f 6e 76 65 72 74  . *....unconvert
12670 65 64 20 73 65 71 75 65 6e 63 65 20 70 6c 75 73  ed sequence plus
12680 20 61 64 64 69 74 69 6f 6e 61 6c 20 62 79 74 65   additional byte
12690 73 0a 20 2a 09 09 09 09 66 72 6f 6d 20 74 68 65  s. *....from the
126a0 20 73 6f 75 72 63 65 20 73 74 72 65 61 6d 20 74   source stream t
126b0 6f 20 70 72 6f 70 65 72 6c 79 20 63 6f 6e 76 65  o properly conve
126c0 72 74 20 74 68 65 0a 20 2a 09 09 09 09 66 6f 72  rt the. *....for
126d0 6d 65 72 6c 79 20 73 70 6c 69 74 2d 75 70 20 6d  merly split-up m
126e0 75 6c 74 69 62 79 74 65 20 73 65 71 75 65 6e 63  ultibyte sequenc
126f0 65 2e 0a 20 2a 20 54 43 4c 5f 43 4f 4e 56 45 52  e.. * TCL_CONVER
12700 54 5f 53 59 4e 54 41 58 20 2d 09 09 54 68 65 20  T_SYNTAX -..The 
12710 73 6f 75 72 63 65 20 73 74 72 65 61 6d 20 63 6f  source stream co
12720 6e 74 61 69 6e 65 64 20 61 6e 20 69 6e 76 61 6c  ntained an inval
12730 69 64 0a 20 2a 09 09 09 09 63 68 61 72 61 63 74  id. *....charact
12740 65 72 20 73 65 71 75 65 6e 63 65 2e 20 54 68 69  er sequence. Thi
12750 73 20 6d 61 79 20 6f 63 63 75 72 20 69 66 20 74  s may occur if t
12760 68 65 0a 20 2a 09 09 09 09 69 6e 70 75 74 20 73  he. *....input s
12770 74 72 65 61 6d 20 68 61 73 20 62 65 65 6e 20 64  tream has been d
12780 61 6d 61 67 65 64 20 6f 72 20 69 66 20 74 68 65  amaged or if the
12790 20 69 6e 70 75 74 0a 20 2a 09 09 09 09 65 6e 63   input. *....enc
127a0 6f 64 69 6e 67 20 6d 65 74 68 6f 64 20 77 61 73  oding method was
127b0 20 6d 69 73 69 64 65 6e 74 69 66 69 65 64 2e 0a   misidentified..
127c0 20 2a 20 54 43 4c 5f 43 4f 4e 56 45 52 54 5f 55   * TCL_CONVERT_U
127d0 4e 4b 4e 4f 57 4e 20 2d 09 54 68 65 20 73 6f 75  NKNOWN -.The sou
127e0 72 63 65 20 73 74 72 69 6e 67 20 63 6f 6e 74 61  rce string conta
127f0 69 6e 65 64 20 61 20 63 68 61 72 61 63 74 65 72  ined a character
12800 20 74 68 61 74 0a 20 2a 09 09 09 09 63 6f 75 6c   that. *....coul
12810 64 20 6e 6f 74 20 62 65 20 72 65 70 72 65 73 65  d not be represe
12820 6e 74 65 64 20 69 6e 20 74 68 65 20 74 61 72 67  nted in the targ
12830 65 74 0a 20 2a 09 09 09 09 65 6e 63 6f 64 69 6e  et. *....encodin
12840 67 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20  g.. */..#define 
12850 54 43 4c 5f 43 4f 4e 56 45 52 54 5f 4d 55 4c 54  TCL_CONVERT_MULT
12860 49 42 59 54 45 09 28 2d 31 29 0a 23 64 65 66 69  IBYTE.(-1).#defi
12870 6e 65 20 54 43 4c 5f 43 4f 4e 56 45 52 54 5f 53  ne TCL_CONVERT_S
12880 59 4e 54 41 58 09 28 2d 32 29 0a 23 64 65 66 69  YNTAX.(-2).#defi
12890 6e 65 20 54 43 4c 5f 43 4f 4e 56 45 52 54 5f 55  ne TCL_CONVERT_U
128a0 4e 4b 4e 4f 57 4e 09 28 2d 33 29 0a 23 64 65 66  NKNOWN.(-3).#def
128b0 69 6e 65 20 54 43 4c 5f 43 4f 4e 56 45 52 54 5f  ine TCL_CONVERT_
128c0 4e 4f 53 50 41 43 45 09 28 2d 34 29 0a 0a 2f 2a  NOSPACE.(-4)../*
128d0 0a 20 2a 20 54 68 65 20 6d 61 78 69 6d 75 6d 20  . * The maximum 
128e0 6e 75 6d 62 65 72 20 6f 66 20 62 79 74 65 73 20  number of bytes 
128f0 74 68 61 74 20 61 72 65 20 6e 65 63 65 73 73 61  that are necessa
12900 72 79 20 74 6f 20 72 65 70 72 65 73 65 6e 74 20  ry to represent 
12910 61 20 73 69 6e 67 6c 65 0a 20 2a 20 55 6e 69 63  a single. * Unic
12920 6f 64 65 20 63 68 61 72 61 63 74 65 72 20 69 6e  ode character in
12930 20 55 54 46 2d 38 2e 20 54 68 65 20 76 61 6c 69   UTF-8. The vali
12940 64 20 76 61 6c 75 65 73 20 61 72 65 20 33 20 61  d values are 3 a
12950 6e 64 20 34 2e 20 49 66 20 3e 20 33 2c 0a 20 2a  nd 4. If > 3,. *
12960 20 74 68 65 6e 20 54 63 6c 5f 55 6e 69 43 68 61   then Tcl_UniCha
12970 72 20 6d 75 73 74 20 62 65 20 34 2d 62 79 74 65  r must be 4-byte
12980 73 20 69 6e 20 73 69 7a 65 20 28 55 43 53 2d 34  s in size (UCS-4
12990 29 20 28 74 68 65 20 64 65 66 61 75 6c 74 29 2e  ) (the default).
129a0 20 49 66 20 3d 3d 20 33 2c 0a 20 2a 20 74 68 65   If == 3,. * the
129b0 6e 20 54 63 6c 5f 55 6e 69 43 68 61 72 20 6d 75  n Tcl_UniChar mu
129c0 73 74 20 62 65 20 32 2d 62 79 74 65 73 20 69 6e  st be 2-bytes in
129d0 20 73 69 7a 65 20 28 55 54 46 2d 31 36 29 2e 20   size (UTF-16). 
129e0 53 69 6e 63 65 20 54 63 6c 20 39 2e 30 2c 20 55  Since Tcl 9.0, U
129f0 43 53 2d 34 0a 20 2a 20 6d 6f 64 65 20 69 73 20  CS-4. * mode is 
12a00 74 68 65 20 64 65 66 61 75 6c 74 20 61 6e 64 20  the default and 
12a10 72 65 63 6f 6d 6d 65 6e 64 65 64 20 6d 6f 64 65  recommended mode
12a20 2e 0a 20 2a 2f 0a 0a 23 69 66 6e 64 65 66 20 54  .. */..#ifndef T
12a30 43 4c 5f 55 54 46 5f 4d 41 58 0a 23 20 20 20 64  CL_UTF_MAX.#   d
12a40 65 66 69 6e 65 20 54 43 4c 5f 55 54 46 5f 4d 41  efine TCL_UTF_MA
12a50 58 09 09 34 0a 23 65 6e 64 69 66 0a 0a 2f 2a 0a  X..4.#endif../*.
12a60 20 2a 20 54 68 69 73 20 72 65 70 72 65 73 65 6e   * This represen
12a70 74 73 20 61 20 55 6e 69 63 6f 64 65 20 63 68 61  ts a Unicode cha
12a80 72 61 63 74 65 72 2e 20 41 6e 79 20 63 68 61 6e  racter. Any chan
12a90 67 65 73 20 74 6f 20 74 68 69 73 20 73 68 6f 75  ges to this shou
12aa0 6c 64 20 61 6c 73 6f 20 62 65 0a 20 2a 20 72 65  ld also be. * re
12ab0 66 6c 65 63 74 65 64 20 69 6e 20 72 65 67 63 75  flected in regcu
12ac0 73 74 6f 6d 2e 68 2e 0a 20 2a 2f 0a 0a 23 69 66  stom.h.. */..#if
12ad0 20 54 43 4c 5f 55 54 46 5f 4d 41 58 20 3d 3d 20   TCL_UTF_MAX == 
12ae0 34 0a 20 20 20 20 2f 2a 0a 20 20 20 20 20 2a 20  4.    /*.     * 
12af0 69 6e 74 20 69 73 6e 27 74 20 31 30 30 25 20 61  int isn't 100% a
12b00 63 63 75 72 61 74 65 20 61 73 20 69 74 20 73 68  ccurate as it sh
12b10 6f 75 6c 64 20 62 65 20 61 20 73 74 72 69 63 74  ould be a strict
12b20 20 34 2d 62 79 74 65 20 76 61 6c 75 65 0a 20 20   4-byte value.  
12b30 20 20 20 2a 20 28 70 65 72 68 61 70 73 20 69 6e     * (perhaps in
12b40 74 33 32 5f 74 29 2e 20 49 4c 50 36 34 2f 53 49  t32_t). ILP64/SI
12b50 4c 50 36 34 20 73 79 73 74 65 6d 73 20 6d 61 79  LP64 systems may
12b60 20 68 61 76 65 20 74 72 6f 75 62 6c 65 73 2e 20   have troubles. 
12b70 54 68 65 0a 20 20 20 20 20 2a 20 73 69 7a 65 20  The.     * size 
12b80 6f 66 20 74 68 69 73 20 76 61 6c 75 65 20 6d 75  of this value mu
12b90 73 74 20 62 65 20 72 65 66 6c 65 63 74 65 64 20  st be reflected 
12ba0 63 6f 72 72 65 63 74 6c 79 20 69 6e 20 72 65 67  correctly in reg
12bb0 63 75 73 74 6f 6d 2e 68 2e 0a 20 20 20 20 20 2a  custom.h..     *
12bc0 2f 0a 74 79 70 65 64 65 66 20 69 6e 74 20 54 63  /.typedef int Tc
12bd0 6c 5f 55 6e 69 43 68 61 72 3b 0a 23 65 6c 69 66  l_UniChar;.#elif
12be0 20 54 43 4c 5f 55 54 46 5f 4d 41 58 20 3d 3d 20   TCL_UTF_MAX == 
12bf0 33 20 26 26 20 21 64 65 66 69 6e 65 64 28 42 55  3 && !defined(BU
12c00 49 4c 44 5f 74 63 6c 29 0a 74 79 70 65 64 65 66  ILD_tcl).typedef
12c10 20 75 6e 73 69 67 6e 65 64 20 73 68 6f 72 74 20   unsigned short 
12c20 54 63 6c 5f 55 6e 69 43 68 61 72 3b 0a 23 65 6c  Tcl_UniChar;.#el
12c30 73 65 0a 23 20 20 20 65 72 72 6f 72 20 22 54 68  se.#   error "Th
12c40 69 73 20 54 43 4c 5f 55 54 46 5f 4d 41 58 20 76  is TCL_UTF_MAX v
12c50 61 6c 75 65 20 69 73 20 6e 6f 74 20 73 75 70 70  alue is not supp
12c60 6f 72 74 65 64 22 0a 23 65 6e 64 69 66 0a 0a 2f  orted".#endif../
12c70 2a 0a 20 2a 20 53 70 65 63 69 66 69 65 72 73 20  *. * Specifiers 
12c80 66 6f 72 20 55 6e 69 63 6f 64 65 20 6e 6f 72 6d  for Unicode norm
12c90 61 6c 69 7a 61 74 69 6f 6e 20 66 6f 72 6d 73 2e  alization forms.
12ca0 0a 20 2a 2f 0a 74 79 70 65 64 65 66 20 65 6e 75  . */.typedef enu
12cb0 6d 20 7b 0a 20 20 20 20 54 43 4c 5f 4e 46 43 2c  m {.    TCL_NFC,
12cc0 20 54 43 4c 5f 4e 46 44 2c 20 54 43 4c 5f 4e 46   TCL_NFD, TCL_NF
12cd0 4b 43 2c 20 54 43 4c 5f 4e 46 4b 44 0a 7d 20 54  KC, TCL_NFKD.} T
12ce0 63 6c 5f 55 6e 69 63 6f 64 65 4e 6f 72 6d 61 6c  cl_UnicodeNormal
12cf0 69 7a 61 74 69 6f 6e 46 6f 72 6d 3b 0a 0c 0a 2f  izationForm;.../
12d00 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  *. *------------
12d10 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
12d20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
12d30 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
12d40 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
12d50 0a 20 2a 20 54 49 50 20 23 35 39 3a 20 54 68 65  . * TIP #59: The
12d60 20 66 6f 6c 6c 6f 77 69 6e 67 20 73 74 72 75 63   following struc
12d70 74 75 72 65 20 69 73 20 75 73 65 64 20 69 6e 20  ture is used in 
12d80 63 61 6c 6c 73 20 27 54 63 6c 5f 52 65 67 69 73  calls 'Tcl_Regis
12d90 74 65 72 43 6f 6e 66 69 67 27 20 74 6f 0a 20 2a  terConfig' to. *
12da0 20 70 72 6f 76 69 64 65 20 74 68 65 20 73 79 73   provide the sys
12db0 74 65 6d 20 77 69 74 68 20 74 68 65 20 65 6d 62  tem with the emb
12dc0 65 64 64 65 64 20 63 6f 6e 66 69 67 75 72 61 74  edded configurat
12dd0 69 6f 6e 20 64 61 74 61 2e 0a 20 2a 2f 0a 0a 74  ion data.. */..t
12de0 79 70 65 64 65 66 20 73 74 72 75 63 74 20 54 63  ypedef struct Tc
12df0 6c 5f 43 6f 6e 66 69 67 20 7b 0a 20 20 20 20 63  l_Config {.    c
12e00 6f 6e 73 74 20 63 68 61 72 20 2a 6b 65 79 3b 09  onst char *key;.
12e10 09 2f 2a 20 43 6f 6e 66 69 67 75 72 61 74 69 6f  ./* Configuratio
12e20 6e 20 6b 65 79 20 74 6f 20 72 65 67 69 73 74 65  n key to registe
12e30 72 2e 20 41 53 43 49 49 0a 09 09 09 09 20 2a 20  r. ASCII..... * 
12e40 65 6e 63 6f 64 65 64 2c 20 74 68 75 73 20 55 54  encoded, thus UT
12e50 46 2d 38 2e 20 2a 2f 0a 20 20 20 20 63 6f 6e 73  F-8. */.    cons
12e60 74 20 63 68 61 72 20 2a 76 61 6c 75 65 3b 09 09  t char *value;..
12e70 2f 2a 20 54 68 65 20 76 61 6c 75 65 20 61 73 73  /* The value ass
12e80 6f 63 69 61 74 65 64 20 77 69 74 68 20 74 68 65  ociated with the
12e90 20 6b 65 79 2e 20 53 79 73 74 65 6d 0a 09 09 09   key. System....
12ea0 09 20 2a 20 65 6e 63 6f 64 69 6e 67 2e 20 2a 2f  . * encoding. */
12eb0 0a 7d 20 54 63 6c 5f 43 6f 6e 66 69 67 3b 0a 0a  .} Tcl_Config;..
12ec0 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  /*. *-----------
12ed0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
12ee0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
12ef0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
12f00 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
12f10 2d 0a 20 2a 20 46 6c 61 67 73 20 66 6f 72 20 54  -. * Flags for T
12f20 49 50 23 31 34 33 20 6c 69 6d 69 74 73 2c 20 64  IP#143 limits, d
12f30 65 74 61 69 6c 69 6e 67 20 77 68 69 63 68 20 6c  etailing which l
12f40 69 6d 69 74 73 20 61 72 65 20 61 63 74 69 76 65  imits are active
12f50 20 69 6e 20 61 6e 0a 20 2a 20 69 6e 74 65 72 70   in an. * interp
12f60 72 65 74 65 72 2e 20 55 73 65 64 20 66 6f 72 20  reter. Used for 
12f70 54 63 6c 5f 7b 41 64 64 2c 52 65 6d 6f 76 65 7d  Tcl_{Add,Remove}
12f80 4c 69 6d 69 74 48 61 6e 64 6c 65 72 20 74 79 70  LimitHandler typ
12f90 65 20 61 72 67 75 6d 65 6e 74 2e 0a 20 2a 2f 0a  e argument.. */.
12fa0 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4c 49 4d  .#define TCL_LIM
12fb0 49 54 5f 43 4f 4d 4d 41 4e 44 53 09 30 78 30 31  IT_COMMANDS.0x01
12fc0 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4c 49 4d  .#define TCL_LIM
12fd0 49 54 5f 54 49 4d 45 09 09 30 78 30 32 0a 0a 2f  IT_TIME..0x02../
12fe0 2a 0a 20 2a 20 53 74 72 75 63 74 75 72 65 20 63  *. * Structure c
12ff0 6f 6e 74 61 69 6e 69 6e 67 20 69 6e 66 6f 72 6d  ontaining inform
13000 61 74 69 6f 6e 20 61 62 6f 75 74 20 61 20 6c 69  ation about a li
13010 6d 69 74 20 68 61 6e 64 6c 65 72 20 74 6f 20 62  mit handler to b
13020 65 20 63 61 6c 6c 65 64 20 77 68 65 6e 20 61 0a  e called when a.
13030 20 2a 20 63 6f 6d 6d 61 6e 64 2d 20 6f 72 20 74   * command- or t
13040 69 6d 65 2d 6c 69 6d 69 74 20 69 73 20 65 78 63  ime-limit is exc
13050 65 65 64 65 64 20 62 79 20 61 6e 20 69 6e 74 65  eeded by an inte
13060 72 70 72 65 74 65 72 2e 0a 20 2a 2f 0a 0a 74 79  rpreter.. */..ty
13070 70 65 64 65 66 20 76 6f 69 64 20 28 54 63 6c 5f  pedef void (Tcl_
13080 4c 69 6d 69 74 48 61 6e 64 6c 65 72 50 72 6f 63  LimitHandlerProc
13090 29 20 28 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44  ) (void *clientD
130a0 61 74 61 2c 20 54 63 6c 5f 49 6e 74 65 72 70 20  ata, Tcl_Interp 
130b0 2a 69 6e 74 65 72 70 29 3b 0a 23 64 65 66 69 6e  *interp);.#defin
130c0 65 20 54 63 6c 5f 4c 69 6d 69 74 48 61 6e 64 6c  e Tcl_LimitHandl
130d0 65 72 44 65 6c 65 74 65 50 72 6f 63 20 54 63 6c  erDeleteProc Tcl
130e0 5f 46 72 65 65 50 72 6f 63 0a 0a 23 69 66 20 30  _FreeProc..#if 0
130f0 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ./*. *----------
13100 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13110 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13120 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13130 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13140 2d 2d 0a 20 2a 20 57 65 20 77 6f 75 6c 64 20 6c  --. * We would l
13150 69 6b 65 20 74 6f 20 70 72 6f 76 69 64 65 20 61  ike to provide a
13160 6e 20 61 6e 6f 6e 79 6d 6f 75 73 20 73 74 72 75  n anonymous stru
13170 63 74 75 72 65 20 22 6d 70 5f 69 6e 74 22 20 68  cture "mp_int" h
13180 65 72 65 2c 20 77 68 69 63 68 20 69 73 0a 20 2a  ere, which is. *
13190 20 63 6f 6d 70 61 74 69 62 6c 65 20 77 69 74 68   compatible with
131a0 20 6c 69 62 74 6f 6d 6d 61 74 68 27 73 20 22 6d   libtommath's "m
131b0 70 5f 69 6e 74 22 2c 20 62 75 74 20 77 69 74 68  p_int", but with
131c0 6f 75 74 20 64 75 70 6c 69 63 61 74 69 6e 67 20  out duplicating 
131d0 61 6e 79 74 68 69 6e 67 0a 20 2a 20 66 72 6f 6d  anything. * from
131e0 20 3c 74 6f 6d 6d 61 74 68 2e 68 3e 20 6f 72 20   <tommath.h> or 
131f0 69 6e 63 6c 75 64 69 6e 67 20 3c 74 6f 6d 6d 61  including <tomma
13200 74 68 2e 68 3e 20 68 65 72 65 2e 20 42 75 74 20  th.h> here. But 
13210 74 68 65 20 6c 69 62 74 6f 6d 6d 61 74 68 20 70  the libtommath p
13220 72 6f 6a 65 63 74 0a 20 2a 20 64 69 64 6e 27 74  roject. * didn't
13230 20 68 6f 6e 6f 72 20 6f 75 72 20 72 65 71 75 65   honor our reque
13240 73 74 2e 20 53 65 65 3a 20 3c 68 74 74 70 73 3a  st. See: <https:
13250 2f 2f 67 69 74 68 75 62 2e 63 6f 6d 2f 6c 69 62  //github.com/lib
13260 74 6f 6d 2f 6c 69 62 74 6f 6d 6d 61 74 68 2f 70  tom/libtommath/p
13270 75 6c 6c 2f 34 37 33 3e 0a 20 2a 0a 20 2a 20 54  ull/473>. *. * T
13280 68 61 74 27 73 20 77 68 79 20 74 68 69 73 20 70  hat's why this p
13290 61 72 74 20 69 73 20 63 6f 6d 6d 65 6e 74 65 64  art is commented
132a0 20 6f 75 74 2c 20 61 6e 64 20 77 65 20 61 72 65   out, and we are
132b0 20 75 73 69 6e 67 20 28 76 6f 69 64 20 2a 29 20   using (void *) 
132c0 69 6e 0a 20 2a 20 76 61 72 69 6f 75 73 20 41 50  in. * various AP
132d0 49 27 73 20 69 6e 20 73 74 65 61 64 20 6f 66 20  I's in stead of 
132e0 74 68 65 20 6d 6f 72 65 20 63 6f 72 72 65 63 74  the more correct
132f0 20 28 6d 70 5f 69 6e 74 20 2a 29 2e 0a 20 2a 2f   (mp_int *).. */
13300 0a 0a 23 69 66 6e 64 65 66 20 4d 50 5f 49 4e 54  ..#ifndef MP_INT
13310 5f 44 45 43 4c 41 52 45 44 0a 23 64 65 66 69 6e  _DECLARED.#defin
13320 65 20 4d 50 5f 49 4e 54 5f 44 45 43 4c 41 52 45  e MP_INT_DECLARE
13330 44 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 74  D.typedef struct
13340 20 6d 70 5f 69 6e 74 20 6d 70 5f 69 6e 74 3b 0a   mp_int mp_int;.
13350 23 65 6e 64 69 66 0a 0a 23 65 6e 64 69 66 0a 0a  #endif..#endif..
13360 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  /*. *-----------
13370 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13380 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13390 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
133a0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
133b0 2d 0a 20 2a 20 44 65 66 69 6e 69 74 69 6f 6e 73  -. * Definitions
133c0 20 6e 65 65 64 65 64 20 66 6f 72 20 54 63 6c 5f   needed for Tcl_
133d0 50 61 72 73 65 41 72 67 76 4f 62 6a 20 72 6f 75  ParseArgvObj rou
133e0 74 69 6e 65 73 2e 0a 20 2a 20 42 61 73 65 64 20  tines.. * Based 
133f0 6f 6e 20 74 6b 41 72 67 76 2e 63 2e 0a 20 2a 20  on tkArgv.c.. * 
13400 4d 6f 64 69 66 69 63 61 74 69 6f 6e 73 20 66 72  Modifications fr
13410 6f 6d 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20  om the original 
13420 61 72 65 20 63 6f 70 79 72 69 67 68 74 20 28 63  are copyright (c
13430 29 20 53 61 6d 20 42 72 6f 6d 6c 65 79 20 32 30  ) Sam Bromley 20
13440 30 36 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20  06. */..typedef 
13450 73 74 72 75 63 74 20 7b 0a 20 20 20 20 69 6e 74  struct {.    int
13460 20 74 79 70 65 3b 09 09 09 2f 2a 20 49 6e 64 69   type;.../* Indi
13470 63 61 74 65 73 20 74 68 65 20 6f 70 74 69 6f 6e  cates the option
13480 20 74 79 70 65 3b 20 73 65 65 20 62 65 6c 6f 77   type; see below
13490 2e 20 2a 2f 0a 20 20 20 20 63 6f 6e 73 74 20 63  . */.    const c
134a0 68 61 72 20 2a 6b 65 79 53 74 72 3b 09 09 2f 2a  har *keyStr;../*
134b0 20 54 68 65 20 6b 65 79 20 73 74 72 69 6e 67 20   The key string 
134c0 74 68 61 74 20 66 6c 61 67 73 20 74 68 65 20 6f  that flags the o
134d0 70 74 69 6f 6e 20 69 6e 20 74 68 65 0a 09 09 09  ption in the....
134e0 09 20 2a 20 61 72 67 76 20 61 72 72 61 79 2e 20  . * argv array. 
134f0 2a 2f 0a 20 20 20 20 76 6f 69 64 20 2a 73 72 63  */.    void *src
13500 50 74 72 3b 09 09 2f 2a 20 56 61 6c 75 65 20 74  Ptr;../* Value t
13510 6f 20 62 65 20 75 73 65 64 20 69 6e 20 73 65 74  o be used in set
13520 74 69 6e 67 20 64 73 74 3b 20 75 73 61 67 65 0a  ting dst; usage.
13530 09 09 09 09 20 2a 20 64 65 70 65 6e 64 73 20 6f  .... * depends o
13540 6e 20 74 79 70 65 2e 2a 2f 0a 20 20 20 20 76 6f  n type.*/.    vo
13550 69 64 20 2a 64 73 74 50 74 72 3b 09 09 2f 2a 20  id *dstPtr;../* 
13560 41 64 64 72 65 73 73 20 6f 66 20 76 61 6c 75 65  Address of value
13570 20 74 6f 20 62 65 20 6d 6f 64 69 66 69 65 64 3b   to be modified;
13580 20 75 73 61 67 65 0a 09 09 09 09 20 2a 20 64 65   usage..... * de
13590 70 65 6e 64 73 20 6f 6e 20 74 79 70 65 2e 2a 2f  pends on type.*/
135a0 0a 20 20 20 20 63 6f 6e 73 74 20 63 68 61 72 20  .    const char 
135b0 2a 68 65 6c 70 53 74 72 3b 09 2f 2a 20 44 6f 63  *helpStr;./* Doc
135c0 75 6d 65 6e 74 61 74 69 6f 6e 20 6d 65 73 73 61  umentation messa
135d0 67 65 20 64 65 73 63 72 69 62 69 6e 67 20 74 68  ge describing th
135e0 69 73 0a 09 09 09 09 20 2a 20 6f 70 74 69 6f 6e  is..... * option
135f0 2e 20 2a 2f 0a 20 20 20 20 76 6f 69 64 20 2a 63  . */.    void *c
13600 6c 69 65 6e 74 44 61 74 61 3b 09 09 2f 2a 20 57  lientData;../* W
13610 6f 72 64 20 74 6f 20 70 61 73 73 20 74 6f 20 66  ord to pass to f
13620 75 6e 63 74 69 6f 6e 20 63 61 6c 6c 62 61 63 6b  unction callback
13630 73 2e 20 2a 2f 0a 7d 20 54 63 6c 5f 41 72 67 76  s. */.} Tcl_Argv
13640 49 6e 66 6f 3b 0a 0a 2f 2a 0a 20 2a 20 4c 65 67  Info;../*. * Leg
13650 61 6c 20 76 61 6c 75 65 73 20 66 6f 72 20 74 68  al values for th
13660 65 20 74 79 70 65 20 66 69 65 6c 64 20 6f 66 20  e type field of 
13670 61 20 54 63 6c 5f 41 72 67 49 6e 66 6f 3a 20 73  a Tcl_ArgInfo: s
13680 65 65 20 74 68 65 20 75 73 65 72 0a 20 2a 20 64  ee the user. * d
13690 6f 63 75 6d 65 6e 74 61 74 69 6f 6e 20 66 6f 72  ocumentation for
136a0 20 64 65 74 61 69 6c 73 2e 0a 20 2a 2f 0a 0a 23   details.. */..#
136b0 64 65 66 69 6e 65 20 54 43 4c 5f 41 52 47 56 5f  define TCL_ARGV_
136c0 43 4f 4e 53 54 41 4e 54 09 31 35 0a 23 64 65 66  CONSTANT.15.#def
136d0 69 6e 65 20 54 43 4c 5f 41 52 47 56 5f 49 4e 54  ine TCL_ARGV_INT
136e0 09 09 31 36 0a 23 64 65 66 69 6e 65 20 54 43 4c  ..16.#define TCL
136f0 5f 41 52 47 56 5f 53 54 52 49 4e 47 09 09 31 37  _ARGV_STRING..17
13700 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 41 52 47  .#define TCL_ARG
13710 56 5f 52 45 53 54 09 09 31 38 0a 23 64 65 66 69  V_REST..18.#defi
13720 6e 65 20 54 43 4c 5f 41 52 47 56 5f 46 4c 4f 41  ne TCL_ARGV_FLOA
13730 54 09 09 31 39 0a 23 64 65 66 69 6e 65 20 54 43  T..19.#define TC
13740 4c 5f 41 52 47 56 5f 46 55 4e 43 09 09 32 30 0a  L_ARGV_FUNC..20.
13750 23 64 65 66 69 6e 65 20 54 43 4c 5f 41 52 47 56  #define TCL_ARGV
13760 5f 47 45 4e 46 55 4e 43 09 32 31 0a 23 64 65 66  _GENFUNC.21.#def
13770 69 6e 65 20 54 43 4c 5f 41 52 47 56 5f 48 45 4c  ine TCL_ARGV_HEL
13780 50 09 09 32 32 0a 23 64 65 66 69 6e 65 20 54 43  P..22.#define TC
13790 4c 5f 41 52 47 56 5f 45 4e 44 09 09 32 33 0a 0a  L_ARGV_END..23..
137a0 2f 2a 0a 20 2a 20 54 79 70 65 73 20 6f 66 20 63  /*. * Types of c
137b0 61 6c 6c 62 61 63 6b 20 66 75 6e 63 74 69 6f 6e  allback function
137c0 73 20 66 6f 72 20 74 68 65 20 54 43 4c 5f 41 52  s for the TCL_AR
137d0 47 56 5f 46 55 4e 43 20 61 6e 64 20 54 43 4c 5f  GV_FUNC and TCL_
137e0 41 52 47 56 5f 47 45 4e 46 55 4e 43 0a 20 2a 20  ARGV_GENFUNC. * 
137f0 61 72 67 75 6d 65 6e 74 20 74 79 70 65 73 3a 0a  argument types:.
13800 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 69 6e 74   */..typedef int
13810 20 28 54 63 6c 5f 41 72 67 76 46 75 6e 63 50 72   (Tcl_ArgvFuncPr
13820 6f 63 29 28 76 6f 69 64 20 2a 63 6c 69 65 6e 74  oc)(void *client
13830 44 61 74 61 2c 20 54 63 6c 5f 4f 62 6a 20 2a 6f  Data, Tcl_Obj *o
13840 62 6a 50 74 72 2c 0a 09 76 6f 69 64 20 2a 64 73  bjPtr,..void *ds
13850 74 50 74 72 29 3b 0a 74 79 70 65 64 65 66 20 54  tPtr);.typedef T
13860 63 6c 5f 53 69 7a 65 20 28 54 63 6c 5f 41 72 67  cl_Size (Tcl_Arg
13870 76 47 65 6e 46 75 6e 63 50 72 6f 63 29 28 76 6f  vGenFuncProc)(vo
13880 69 64 20 2a 63 6c 69 65 6e 74 44 61 74 61 2c 20  id *clientData, 
13890 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65  Tcl_Interp *inte
138a0 72 70 2c 0a 09 54 63 6c 5f 53 69 7a 65 20 6f 62  rp,..Tcl_Size ob
138b0 6a 63 2c 20 54 63 6c 5f 4f 62 6a 20 2a 63 6f 6e  jc, Tcl_Obj *con
138c0 73 74 20 2a 6f 62 6a 76 2c 20 76 6f 69 64 20 2a  st *objv, void *
138d0 64 73 74 50 74 72 29 3b 0a 0a 2f 2a 0a 20 2a 20  dstPtr);../*. * 
138e0 53 68 6f 72 74 68 61 6e 64 20 66 6f 72 20 63 6f  Shorthand for co
138f0 6d 6d 6f 6e 6c 79 20 75 73 65 64 20 61 72 67 54  mmonly used argT
13900 61 62 6c 65 20 65 6e 74 72 69 65 73 2e 0a 20 2a  able entries.. *
13910 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 41  /..#define TCL_A
13920 52 47 56 5f 41 55 54 4f 5f 48 45 4c 50 20 5c 0a  RGV_AUTO_HELP \.
13930 20 20 20 20 7b 54 43 4c 5f 41 52 47 56 5f 48 45      {TCL_ARGV_HE
13940 4c 50 2c 09 22 2d 68 65 6c 70 22 2c 09 4e 55 4c  LP,."-help",.NUL
13950 4c 2c 09 4e 55 4c 4c 2c 20 5c 0a 09 20 20 20 20  L,.NULL, \..    
13960 22 50 72 69 6e 74 20 73 75 6d 6d 61 72 79 20 6f  "Print summary o
13970 66 20 63 6f 6d 6d 61 6e 64 2d 6c 69 6e 65 20 6f  f command-line o
13980 70 74 69 6f 6e 73 20 61 6e 64 20 61 62 6f 72 74  ptions and abort
13990 22 2c 20 4e 55 4c 4c 7d 0a 23 64 65 66 69 6e 65  ", NULL}.#define
139a0 20 54 43 4c 5f 41 52 47 56 5f 41 55 54 4f 5f 52   TCL_ARGV_AUTO_R
139b0 45 53 54 20 5c 0a 20 20 20 20 7b 54 43 4c 5f 41  EST \.    {TCL_A
139c0 52 47 56 5f 52 45 53 54 2c 09 22 2d 2d 22 2c 09  RGV_REST,."--",.
139d0 09 4e 55 4c 4c 2c 09 4e 55 4c 4c 2c 20 5c 0a 09  .NULL,.NULL, \..
139e0 20 20 20 20 22 4d 61 72 6b 73 20 74 68 65 20 65      "Marks the e
139f0 6e 64 20 6f 66 20 74 68 65 20 6f 70 74 69 6f 6e  nd of the option
13a00 73 22 2c 20 4e 55 4c 4c 7d 0a 23 64 65 66 69 6e  s", NULL}.#defin
13a10 65 20 54 43 4c 5f 41 52 47 56 5f 54 41 42 4c 45  e TCL_ARGV_TABLE
13a20 5f 45 4e 44 20 5c 0a 20 20 20 20 7b 54 43 4c 5f  _END \.    {TCL_
13a30 41 52 47 56 5f 45 4e 44 2c 20 4e 55 4c 4c 2c 20  ARGV_END, NULL, 
13a40 4e 55 4c 4c 2c 20 4e 55 4c 4c 2c 20 4e 55 4c 4c  NULL, NULL, NULL
13a50 2c 20 4e 55 4c 4c 7d 0a 0a 2f 2a 0a 20 2a 2d 2d  , NULL}../*. *--
13a60 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13a70 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13a80 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13a90 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13aa0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 44 65  ----------. * De
13ab0 66 69 6e 69 74 69 6f 6e 73 20 6e 65 65 64 65 64  finitions needed
13ac0 20 66 6f 72 20 54 63 6c 5f 5a 6c 69 62 20 72 6f   for Tcl_Zlib ro
13ad0 75 74 69 6e 65 73 2e 20 5b 54 49 50 20 23 32 33  utines. [TIP #23
13ae0 34 5d 0a 20 2a 0a 20 2a 20 43 6f 6e 73 74 61 6e  4]. *. * Constan
13af0 74 73 20 66 6f 72 20 74 68 65 20 66 6f 72 6d 61  ts for the forma
13b00 74 20 66 6c 61 67 73 20 64 65 73 63 72 69 62 69  t flags describi
13b10 6e 67 20 77 68 61 74 20 73 6f 72 74 20 6f 66 20  ng what sort of 
13b20 64 61 74 61 20 66 6f 72 6d 61 74 20 69 73 0a 20  data format is. 
13b30 2a 20 64 65 73 69 72 65 64 2f 65 78 70 65 63 74  * desired/expect
13b40 65 64 20 66 6f 72 20 74 68 65 20 54 63 6c 5f 5a  ed for the Tcl_Z
13b50 6c 69 62 44 65 66 6c 61 74 65 2c 20 54 63 6c 5f  libDeflate, Tcl_
13b60 5a 6c 69 62 49 6e 66 6c 61 74 65 20 61 6e 64 0a  ZlibInflate and.
13b70 20 2a 20 54 63 6c 5f 5a 6c 69 62 53 74 72 65 61   * Tcl_ZlibStrea
13b80 6d 49 6e 69 74 20 66 75 6e 63 74 69 6f 6e 73 2e  mInit functions.
13b90 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43  . */..#define TC
13ba0 4c 5f 5a 4c 49 42 5f 46 4f 52 4d 41 54 5f 52 41  L_ZLIB_FORMAT_RA
13bb0 57 09 31 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f  W.1.#define TCL_
13bc0 5a 4c 49 42 5f 46 4f 52 4d 41 54 5f 5a 4c 49 42  ZLIB_FORMAT_ZLIB
13bd0 09 32 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 5a  .2.#define TCL_Z
13be0 4c 49 42 5f 46 4f 52 4d 41 54 5f 47 5a 49 50 09  LIB_FORMAT_GZIP.
13bf0 34 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 5a 4c  4.#define TCL_ZL
13c00 49 42 5f 46 4f 52 4d 41 54 5f 41 55 54 4f 09 38  IB_FORMAT_AUTO.8
13c10 0a 0a 2f 2a 0a 20 2a 20 43 6f 6e 73 74 61 6e 74  ../*. * Constant
13c20 73 20 74 68 61 74 20 64 65 73 63 72 69 62 65 20  s that describe 
13c30 77 68 65 74 68 65 72 20 74 68 65 20 73 74 72 65  whether the stre
13c40 61 6d 20 69 73 20 74 6f 20 6f 70 65 72 61 74 65  am is to operate
13c50 20 69 6e 20 63 6f 6d 70 72 65 73 73 69 6e 67 20   in compressing 
13c60 6f 72 0a 20 2a 20 64 65 63 6f 6d 70 72 65 73 73  or. * decompress
13c70 69 6e 67 20 6d 6f 64 65 2e 0a 20 2a 2f 0a 0a 23  ing mode.. */..#
13c80 64 65 66 69 6e 65 20 54 43 4c 5f 5a 4c 49 42 5f  define TCL_ZLIB_
13c90 53 54 52 45 41 4d 5f 44 45 46 4c 41 54 45 09 31  STREAM_DEFLATE.1
13ca0 36 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 5a 4c  6.#define TCL_ZL
13cb0 49 42 5f 53 54 52 45 41 4d 5f 49 4e 46 4c 41 54  IB_STREAM_INFLAT
13cc0 45 09 33 32 0a 0a 2f 2a 0a 20 2a 20 43 6f 6e 73  E.32../*. * Cons
13cd0 74 61 6e 74 73 20 67 69 76 69 6e 67 20 63 6f 6d  tants giving com
13ce0 70 72 65 73 73 69 6f 6e 20 6c 65 76 65 6c 73 2e  pression levels.
13cf0 20 55 73 65 20 6f 66 20 54 43 4c 5f 5a 4c 49 42   Use of TCL_ZLIB
13d00 5f 43 4f 4d 50 52 45 53 53 5f 44 45 46 41 55 4c  _COMPRESS_DEFAUL
13d10 54 20 69 73 0a 20 2a 20 72 65 63 6f 6d 6d 65 6e  T is. * recommen
13d20 64 65 64 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e  ded.. */..#defin
13d30 65 20 54 43 4c 5f 5a 4c 49 42 5f 43 4f 4d 50 52  e TCL_ZLIB_COMPR
13d40 45 53 53 5f 4e 4f 4e 45 09 30 0a 23 64 65 66 69  ESS_NONE.0.#defi
13d50 6e 65 20 54 43 4c 5f 5a 4c 49 42 5f 43 4f 4d 50  ne TCL_ZLIB_COMP
13d60 52 45 53 53 5f 46 41 53 54 09 31 0a 23 64 65 66  RESS_FAST.1.#def
13d70 69 6e 65 20 54 43 4c 5f 5a 4c 49 42 5f 43 4f 4d  ine TCL_ZLIB_COM
13d80 50 52 45 53 53 5f 42 45 53 54 09 39 0a 23 64 65  PRESS_BEST.9.#de
13d90 66 69 6e 65 20 54 43 4c 5f 5a 4c 49 42 5f 43 4f  fine TCL_ZLIB_CO
13da0 4d 50 52 45 53 53 5f 44 45 46 41 55 4c 54 20 28  MPRESS_DEFAULT (
13db0 2d 31 29 0a 0a 2f 2a 0a 20 2a 20 43 6f 6e 73 74  -1)../*. * Const
13dc0 61 6e 74 73 20 66 6f 72 20 74 79 70 65 73 20 6f  ants for types o
13dd0 66 20 66 6c 75 73 68 69 6e 67 2c 20 75 73 65 64  f flushing, used
13de0 20 77 69 74 68 20 54 63 6c 5f 5a 6c 69 62 46 6c   with Tcl_ZlibFl
13df0 75 73 68 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e  ush.. */..#defin
13e00 65 20 54 43 4c 5f 5a 4c 49 42 5f 4e 4f 5f 46 4c  e TCL_ZLIB_NO_FL
13e10 55 53 48 09 30 0a 23 64 65 66 69 6e 65 20 54 43  USH.0.#define TC
13e20 4c 5f 5a 4c 49 42 5f 46 4c 55 53 48 09 09 32 0a  L_ZLIB_FLUSH..2.
13e30 23 64 65 66 69 6e 65 20 54 43 4c 5f 5a 4c 49 42  #define TCL_ZLIB
13e40 5f 46 55 4c 4c 46 4c 55 53 48 09 33 0a 23 64 65  _FULLFLUSH.3.#de
13e50 66 69 6e 65 20 54 43 4c 5f 5a 4c 49 42 5f 46 49  fine TCL_ZLIB_FI
13e60 4e 41 4c 49 5a 45 09 34 0a 0a 2f 2a 0a 20 2a 2d  NALIZE.4../*. *-
13e70 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13e80 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13e90 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13ea0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13eb0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 44  -----------. * D
13ec0 65 66 69 6e 69 74 69 6f 6e 73 20 6e 65 65 64 65  efinitions neede
13ed0 64 20 66 6f 72 20 74 68 65 20 54 63 6c 5f 4c 6f  d for the Tcl_Lo
13ee0 61 64 46 69 6c 65 20 66 75 6e 63 74 69 6f 6e 2e  adFile function.
13ef0 20 5b 54 49 50 20 23 34 31 36 5d 0a 20 2a 2f 0a   [TIP #416]. */.
13f00 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4c 4f 41  .#define TCL_LOA
13f10 44 5f 47 4c 4f 42 41 4c 20 31 0a 23 64 65 66 69  D_GLOBAL 1.#defi
13f20 6e 65 20 54 43 4c 5f 4c 4f 41 44 5f 4c 41 5a 59  ne TCL_LOAD_LAZY
13f30 20 32 0a 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d   2../*. *-------
13f40 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13f50 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13f60 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13f70 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
13f80 2d 2d 2d 2d 2d 0a 20 2a 20 44 65 66 69 6e 69 74  -----. * Definit
13f90 69 6f 6e 73 20 6e 65 65 64 65 64 20 66 6f 72 20  ions needed for 
13fa0 74 68 65 20 54 63 6c 5f 4f 70 65 6e 54 63 70 53  the Tcl_OpenTcpS
13fb0 65 72 76 65 72 45 78 20 66 75 6e 63 74 69 6f 6e  erverEx function
13fc0 2e 20 5b 54 49 50 20 23 34 35 36 5d 0a 20 2a 2f  . [TIP #456]. */
13fd0 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 54 43 50  .#define TCL_TCP
13fe0 53 45 52 56 45 52 5f 52 45 55 53 45 41 44 44 52  SERVER_REUSEADDR
13ff0 20 28 31 3c 3c 30 29 0a 23 64 65 66 69 6e 65 20   (1<<0).#define 
14000 54 43 4c 5f 54 43 50 53 45 52 56 45 52 5f 52 45  TCL_TCPSERVER_RE
14010 55 53 45 50 4f 52 54 20 28 31 3c 3c 31 29 0a 0a  USEPORT (1<<1)..
14020 2f 2a 0a 20 2a 20 43 6f 6e 73 74 61 6e 74 73 20  /*. * Constants 
14030 66 6f 72 20 73 70 65 63 69 61 6c 20 54 63 6c 5f  for special Tcl_
14040 53 69 7a 65 2d 74 79 70 65 64 20 76 61 6c 75 65  Size-typed value
14050 73 2c 20 73 65 65 20 54 49 50 20 23 34 39 34 0a  s, see TIP #494.
14060 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c   */..#define TCL
14070 5f 49 4f 5f 46 41 49 4c 55 52 45 09 28 28 54 63  _IO_FAILURE.((Tc
14080 6c 5f 53 69 7a 65 29 2d 31 29 0a 23 64 65 66 69  l_Size)-1).#defi
14090 6e 65 20 54 43 4c 5f 41 55 54 4f 5f 4c 45 4e 47  ne TCL_AUTO_LENG
140a0 54 48 09 28 28 54 63 6c 5f 53 69 7a 65 29 2d 31  TH.((Tcl_Size)-1
140b0 29 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 49 4e  ).#define TCL_IN
140c0 44 45 58 5f 4e 4f 4e 45 20 20 28 28 54 63 6c 5f  DEX_NONE  ((Tcl_
140d0 53 69 7a 65 29 2d 31 29 0a 0a 2f 2a 0a 20 2a 2d  Size)-1)../*. *-
140e0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
140f0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14100 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14110 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
14120 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 53  -----------. * S
14130 69 6e 67 6c 65 20 70 75 62 6c 69 63 20 64 65 63  ingle public dec
14140 6c 61 72 61 74 69 6f 6e 20 66 6f 72 20 4e 52 45  laration for NRE
14150 2e 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 69  .. */..typedef i
14160 6e 74 20 28 54 63 6c 5f 4e 52 50 6f 73 74 50 72  nt (Tcl_NRPostPr
14170 6f 63 29 20 28 76 6f 69 64 20 2a 64 61 74 61 5b  oc) (void *data[
14180 5d 2c 20 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69  ], Tcl_Interp *i
14190 6e 74 65 72 70 2c 20 69 6e 74 20 72 65 73 75 6c  nterp, int resul
141a0 74 29 3b 0a 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d  t);../*. *------
141b0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
141c0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
141d0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
141e0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
141f0 2d 2d 2d 2d 2d 2d 0a 20 2a 20 54 68 65 20 66 6f  ------. * The fo
14200 6c 6c 6f 77 69 6e 67 20 63 6f 6e 73 74 61 6e 74  llowing constant
14210 20 69 73 20 75 73 65 64 20 74 6f 20 74 65 73 74   is used to test
14220 20 66 6f 72 20 6f 6c 64 65 72 20 76 65 72 73 69   for older versi
14230 6f 6e 73 20 6f 66 20 54 63 6c 20 69 6e 20 74 68  ons of Tcl in th
14240 65 0a 20 2a 20 73 74 75 62 73 20 74 61 62 6c 65  e. * stubs table
14250 73 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20  s.. */..#define 
14260 54 43 4c 5f 53 54 55 42 5f 4d 41 47 49 43 09 09  TCL_STUB_MAGIC..
14270 28 28 69 6e 74 29 20 30 78 46 43 41 33 42 41 43  ((int) 0xFCA3BAC
14280 42 20 2b 20 28 69 6e 74 29 20 73 69 7a 65 6f 66  B + (int) sizeof
14290 28 76 6f 69 64 20 2a 29 29 0a 0a 2f 2a 0a 20 2a  (void *))../*. *
142a0 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 66   The following f
142b0 75 6e 63 74 69 6f 6e 20 69 73 20 72 65 71 75 69  unction is requi
142c0 72 65 64 20 74 6f 20 62 65 20 64 65 66 69 6e 65  red to be define
142d0 64 20 69 6e 20 61 6c 6c 20 73 74 75 62 73 20 61  d in all stubs a
142e0 77 61 72 65 0a 20 2a 20 65 78 74 65 6e 73 69 6f  ware. * extensio
142f0 6e 73 2e 20 54 68 65 20 66 75 6e 63 74 69 6f 6e  ns. The function
14300 20 69 73 20 61 63 74 75 61 6c 6c 79 20 69 6d 70   is actually imp
14310 6c 65 6d 65 6e 74 65 64 20 69 6e 20 74 68 65 20  lemented in the 
14320 73 74 75 62 20 6c 69 62 72 61 72 79 2c 20 6e 6f  stub library, no
14330 74 0a 20 2a 20 74 68 65 20 6d 61 69 6e 20 54 63  t. * the main Tc
14340 6c 20 6c 69 62 72 61 72 79 2c 20 61 6c 74 68 6f  l library, altho
14350 75 67 68 20 74 68 65 72 65 20 69 73 20 61 20 74  ugh there is a t
14360 72 69 76 69 61 6c 20 69 6d 70 6c 65 6d 65 6e 74  rivial implement
14370 61 74 69 6f 6e 20 69 6e 20 74 68 65 0a 20 2a 20  ation in the. * 
14380 6d 61 69 6e 20 6c 69 62 72 61 72 79 20 69 6e 20  main library in 
14390 63 61 73 65 20 61 6e 20 65 78 74 65 6e 73 69 6f  case an extensio
143a0 6e 20 69 73 20 73 74 61 74 69 63 61 6c 6c 79 20  n is statically 
143b0 6c 69 6e 6b 65 64 20 69 6e 74 6f 20 61 6e 20 61  linked into an a
143c0 70 70 6c 69 63 61 74 69 6f 6e 2e 0a 20 2a 2f 0a  pplication.. */.
143d0 0a 63 6f 6e 73 74 20 63 68 61 72 20 2a 09 09 54  .const char *..T
143e0 63 6c 5f 49 6e 69 74 53 74 75 62 73 28 54 63 6c  cl_InitStubs(Tcl
143f0 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c  _Interp *interp,
14400 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 76 65 72   const char *ver
14410 73 69 6f 6e 2c 0a 09 09 09 20 20 20 20 69 6e 74  sion,....    int
14420 20 65 78 61 63 74 2c 20 69 6e 74 20 6d 61 67 69   exact, int magi
14430 63 29 3b 0a 63 6f 6e 73 74 20 63 68 61 72 20 2a  c);.const char *
14440 09 09 54 63 6c 54 6f 6d 4d 61 74 68 49 6e 69 74  ..TclTomMathInit
14450 69 61 6c 69 7a 65 53 74 75 62 73 28 54 63 6c 5f  ializeStubs(Tcl_
14460 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c 0a  Interp *interp,.
14470 09 09 09 20 20 20 20 63 6f 6e 73 74 20 63 68 61  ...    const cha
14480 72 20 2a 76 65 72 73 69 6f 6e 2c 20 69 6e 74 20  r *version, int 
14490 65 70 6f 63 68 2c 20 69 6e 74 20 72 65 76 69 73  epoch, int revis
144a0 69 6f 6e 29 3b 0a 63 6f 6e 73 74 20 63 68 61 72  ion);.const char
144b0 20 2a 09 09 54 63 6c 49 6e 69 74 53 74 75 62 54   *..TclInitStubT
144c0 61 62 6c 65 28 63 6f 6e 73 74 20 63 68 61 72 20  able(const char 
144d0 2a 76 65 72 73 69 6f 6e 29 3b 0a 76 6f 69 64 20  *version);.void 
144e0 2a 09 09 09 54 63 6c 53 74 75 62 43 61 6c 6c 28  *...TclStubCall(
144f0 76 6f 69 64 20 2a 61 72 67 29 3b 0a 23 69 66 20  void *arg);.#if 
14500 64 65 66 69 6e 65 64 28 5f 57 49 4e 33 32 29 0a  defined(_WIN32).
14510 20 20 20 20 54 43 4c 5f 4e 4f 52 45 54 55 52 4e      TCL_NORETURN
14520 20 76 6f 69 64 20 54 63 6c 5f 43 6f 6e 73 6f 6c   void Tcl_Consol
14530 65 50 61 6e 69 63 28 63 6f 6e 73 74 20 63 68 61  ePanic(const cha
14540 72 20 2a 66 6f 72 6d 61 74 2c 20 2e 2e 2e 29 3b  r *format, ...);
14550 0a 23 65 6c 73 65 0a 23 20 20 20 64 65 66 69 6e  .#else.#   defin
14560 65 20 54 63 6c 5f 43 6f 6e 73 6f 6c 65 50 61 6e  e Tcl_ConsolePan
14570 69 63 20 28 28 54 63 6c 5f 50 61 6e 69 63 50 72  ic ((Tcl_PanicPr
14580 6f 63 20 2a 29 4e 55 4c 4c 29 0a 23 65 6e 64 69  oc *)NULL).#endi
14590 66 0a 0a 23 69 66 64 65 66 20 55 53 45 5f 54 43  f..#ifdef USE_TC
145a0 4c 5f 53 54 55 42 53 0a 23 20 20 20 64 65 66 69  L_STUBS.#   defi
145b0 6e 65 20 54 63 6c 5f 49 6e 69 74 53 74 75 62 73  ne Tcl_InitStubs
145c0 28 69 6e 74 65 72 70 2c 20 76 65 72 73 69 6f 6e  (interp, version
145d0 2c 20 65 78 61 63 74 29 20 5c 0a 09 28 54 63 6c  , exact) \..(Tcl
145e0 5f 49 6e 69 74 53 74 75 62 73 29 28 69 6e 74 65  _InitStubs)(inte
145f0 72 70 2c 20 76 65 72 73 69 6f 6e 2c 20 5c 0a 09  rp, version, \..
14600 20 20 20 20 28 65 78 61 63 74 29 7c 28 54 43 4c      (exact)|(TCL
14610 5f 4d 41 4a 4f 52 5f 56 45 52 53 49 4f 4e 3c 3c  _MAJOR_VERSION<<
14620 38 29 7c 28 54 43 4c 5f 4d 49 4e 4f 52 5f 56 45  8)|(TCL_MINOR_VE
14630 52 53 49 4f 4e 3c 3c 31 36 29 2c 20 5c 0a 09 20  RSION<<16), \.. 
14640 20 20 20 54 43 4c 5f 53 54 55 42 5f 4d 41 47 49     TCL_STUB_MAGI
14650 43 29 0a 23 65 6c 73 65 0a 23 20 20 20 64 65 66  C).#else.#   def
14660 69 6e 65 20 54 63 6c 5f 49 6e 69 74 53 74 75 62  ine Tcl_InitStub
14670 73 28 69 6e 74 65 72 70 2c 20 76 65 72 73 69 6f  s(interp, versio
14680 6e 2c 20 65 78 61 63 74 29 20 5c 0a 09 54 63 6c  n, exact) \..Tcl
14690 5f 50 6b 67 49 6e 69 74 53 74 75 62 73 43 68 65  _PkgInitStubsChe
146a0 63 6b 28 69 6e 74 65 72 70 2c 20 76 65 72 73 69  ck(interp, versi
146b0 6f 6e 2c 20 5c 0a 09 09 28 65 78 61 63 74 29 7c  on, \...(exact)|
146c0 28 54 43 4c 5f 4d 41 4a 4f 52 5f 56 45 52 53 49  (TCL_MAJOR_VERSI
146d0 4f 4e 3c 3c 38 29 7c 28 54 43 4c 5f 4d 49 4e 4f  ON<<8)|(TCL_MINO
146e0 52 5f 56 45 52 53 49 4f 4e 3c 3c 31 36 29 29 0a  R_VERSION<<16)).
146f0 23 65 6e 64 69 66 0a 0a 2f 2a 0a 20 2a 20 50 75  #endif../*. * Pu
14700 62 6c 69 63 20 66 75 6e 63 74 69 6f 6e 73 20 74  blic functions t
14710 68 61 74 20 61 72 65 20 6e 6f 74 20 61 63 63 65  hat are not acce
14720 73 73 69 62 6c 65 20 76 69 61 20 74 68 65 20 73  ssible via the s
14730 74 75 62 73 20 74 61 62 6c 65 2e 0a 20 2a 20 54  tubs table.. * T
14740 63 6c 5f 47 65 74 4d 65 6d 6f 72 79 49 6e 66 6f  cl_GetMemoryInfo
14750 20 69 73 20 6e 65 65 64 65 64 20 66 6f 72 20 41   is needed for A
14760 4f 4c 73 65 72 76 65 72 2e 20 5b 42 75 67 20 31  OLserver. [Bug 1
14770 38 36 38 31 37 31 5d 0a 20 2a 2f 0a 0a 23 64 65  868171]. */..#de
14780 66 69 6e 65 20 54 63 6c 5f 4d 61 69 6e 28 61 72  fine Tcl_Main(ar
14790 67 63 2c 20 61 72 67 76 2c 20 70 72 6f 63 29 20  gc, argv, proc) 
147a0 54 63 6c 5f 4d 61 69 6e 45 78 28 61 72 67 63 2c  Tcl_MainEx(argc,
147b0 20 61 72 67 76 2c 20 70 72 6f 63 2c 20 5c 0a 09   argv, proc, \..
147c0 20 20 20 20 28 28 54 63 6c 5f 53 65 74 50 61 6e      ((Tcl_SetPan
147d0 69 63 50 72 6f 63 28 54 63 6c 5f 43 6f 6e 73 6f  icProc(Tcl_Conso
147e0 6c 65 50 61 6e 69 63 29 2c 20 54 63 6c 5f 43 72  lePanic), Tcl_Cr
147f0 65 61 74 65 49 6e 74 65 72 70 28 29 29 29 29 0a  eateInterp()))).
14800 45 58 54 45 52 4e 20 54 43 4c 5f 4e 4f 52 45 54  EXTERN TCL_NORET
14810 55 52 4e 20 76 6f 69 64 20 54 63 6c 5f 4d 61 69  URN void Tcl_Mai
14820 6e 45 78 28 54 63 6c 5f 53 69 7a 65 20 61 72 67  nEx(Tcl_Size arg
14830 63 2c 20 63 68 61 72 20 2a 2a 61 72 67 76 2c 0a  c, char **argv,.
14840 09 09 09 20 20 20 20 54 63 6c 5f 41 70 70 49 6e  ...    Tcl_AppIn
14850 69 74 50 72 6f 63 20 2a 61 70 70 49 6e 69 74 50  itProc *appInitP
14860 72 6f 63 2c 20 54 63 6c 5f 49 6e 74 65 72 70 20  roc, Tcl_Interp 
14870 2a 69 6e 74 65 72 70 29 3b 0a 45 58 54 45 52 4e  *interp);.EXTERN
14880 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 09 54 63   const char *.Tc
14890 6c 5f 50 6b 67 49 6e 69 74 53 74 75 62 73 43 68  l_PkgInitStubsCh
148a0 65 63 6b 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a  eck(Tcl_Interp *
148b0 69 6e 74 65 72 70 2c 0a 09 09 09 20 20 20 20 63  interp,....    c
148c0 6f 6e 73 74 20 63 68 61 72 20 2a 76 65 72 73 69  onst char *versi
148d0 6f 6e 2c 20 69 6e 74 20 65 78 61 63 74 29 3b 0a  on, int exact);.
148e0 45 58 54 45 52 4e 20 63 6f 6e 73 74 20 63 68 61  EXTERN const cha
148f0 72 20 2a 09 54 63 6c 5f 49 6e 69 74 53 75 62 73  r *.Tcl_InitSubs
14900 79 73 74 65 6d 73 28 76 6f 69 64 29 3b 0a 45 58  ystems(void);.EX
14910 54 45 52 4e 20 76 6f 69 64 09 09 54 63 6c 5f 47  TERN void..Tcl_G
14920 65 74 4d 65 6d 6f 72 79 49 6e 66 6f 28 54 63 6c  etMemoryInfo(Tcl
14930 5f 44 53 74 72 69 6e 67 20 2a 64 73 50 74 72 29  _DString *dsPtr)
14940 3b 0a 45 58 54 45 52 4e 20 63 6f 6e 73 74 20 63  ;.EXTERN const c
14950 68 61 72 20 2a 09 54 63 6c 5f 46 69 6e 64 45 78  har *.Tcl_FindEx
14960 65 63 75 74 61 62 6c 65 28 63 6f 6e 73 74 20 63  ecutable(const c
14970 68 61 72 20 2a 61 72 67 76 30 29 3b 0a 45 58 54  har *argv0);.EXT
14980 45 52 4e 20 63 6f 6e 73 74 20 63 68 61 72 20 2a  ERN const char *
14990 09 54 63 6c 5f 53 65 74 50 72 65 49 6e 69 74 53  .Tcl_SetPreInitS
149a0 63 72 69 70 74 28 63 6f 6e 73 74 20 63 68 61 72  cript(const char
149b0 20 2a 73 74 72 69 6e 67 29 3b 0a 45 58 54 45 52   *string);.EXTER
149c0 4e 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 09 54  N const char *.T
149d0 63 6c 5f 53 65 74 50 61 6e 69 63 50 72 6f 63 28  cl_SetPanicProc(
149e0 0a 09 09 09 20 20 20 20 54 63 6c 5f 50 61 6e 69  ....    Tcl_Pani
149f0 63 50 72 6f 63 20 2a 70 61 6e 69 63 50 72 6f 63  cProc *panicProc
14a00 29 3b 0a 45 58 54 45 52 4e 20 76 6f 69 64 09 09  );.EXTERN void..
14a10 54 63 6c 5f 53 74 61 74 69 63 4c 69 62 72 61 72  Tcl_StaticLibrar
14a20 79 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e  y(Tcl_Interp *in
14a30 74 65 72 70 2c 0a 09 09 09 20 20 20 20 63 6f 6e  terp,....    con
14a40 73 74 20 63 68 61 72 20 2a 70 72 65 66 69 78 2c  st char *prefix,
14a50 0a 09 09 09 20 20 20 20 54 63 6c 5f 4c 69 62 72  ....    Tcl_Libr
14a60 61 72 79 49 6e 69 74 50 72 6f 63 20 2a 69 6e 69  aryInitProc *ini
14a70 74 50 72 6f 63 2c 0a 09 09 09 20 20 20 20 54 63  tProc,....    Tc
14a80 6c 5f 4c 69 62 72 61 72 79 49 6e 69 74 50 72 6f  l_LibraryInitPro
14a90 63 20 2a 73 61 66 65 49 6e 69 74 50 72 6f 63 29  c *safeInitProc)
14aa0 3b 0a 23 69 66 6e 64 65 66 20 54 43 4c 5f 4e 4f  ;.#ifndef TCL_NO
14ab0 5f 44 45 50 52 45 43 41 54 45 44 0a 23 20 20 20  _DEPRECATED.#   
14ac0 64 65 66 69 6e 65 20 54 63 6c 5f 53 74 61 74 69  define Tcl_Stati
14ad0 63 50 61 63 6b 61 67 65 20 54 63 6c 5f 53 74 61  cPackage Tcl_Sta
14ae0 74 69 63 4c 69 62 72 61 72 79 0a 23 65 6e 64 69  ticLibrary.#endi
14af0 66 0a 45 58 54 45 52 4e 20 54 63 6c 5f 45 78 69  f.EXTERN Tcl_Exi
14b00 74 50 72 6f 63 20 2a 09 54 63 6c 5f 53 65 74 45  tProc *.Tcl_SetE
14b10 78 69 74 50 72 6f 63 28 54 63 6c 5f 45 78 69 74  xitProc(Tcl_Exit
14b20 50 72 6f 63 20 2a 70 72 6f 63 29 3b 0a 23 69 66  Proc *proc);.#if
14b30 64 65 66 20 5f 57 49 4e 33 32 0a 45 58 54 45 52  def _WIN32.EXTER
14b40 4e 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 09 54  N const char *.T
14b50 63 6c 5a 69 70 66 73 5f 41 70 70 48 6f 6f 6b 28  clZipfs_AppHook(
14b60 69 6e 74 20 2a 61 72 67 63 2c 20 75 6e 73 69 67  int *argc, unsig
14b70 6e 65 64 20 73 68 6f 72 74 20 2a 2a 2a 61 72 67  ned short ***arg
14b80 76 29 3b 0a 23 65 6c 73 65 0a 45 58 54 45 52 4e  v);.#else.EXTERN
14b90 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 09 54 63   const char *.Tc
14ba0 6c 5a 69 70 66 73 5f 41 70 70 48 6f 6f 6b 28 69  lZipfs_AppHook(i
14bb0 6e 74 20 2a 61 72 67 63 2c 20 63 68 61 72 20 2a  nt *argc, char *
14bc0 2a 2a 61 72 67 76 29 3b 0a 23 65 6e 64 69 66 0a  **argv);.#endif.
14bd0 23 69 66 20 64 65 66 69 6e 65 64 28 5f 57 49 4e  #if defined(_WIN
14be0 33 32 29 20 26 26 20 64 65 66 69 6e 65 64 28 55  32) && defined(U
14bf0 4e 49 43 4f 44 45 29 0a 23 69 66 6e 64 65 66 20  NICODE).#ifndef 
14c00 55 53 45 5f 54 43 4c 5f 53 54 55 42 53 0a 23 20  USE_TCL_STUBS.# 
14c10 20 20 64 65 66 69 6e 65 20 54 63 6c 5f 46 69 6e    define Tcl_Fin
14c20 64 45 78 65 63 75 74 61 62 6c 65 28 61 72 67 29  dExecutable(arg)
14c30 20 28 28 54 63 6c 5f 46 69 6e 64 45 78 65 63 75   ((Tcl_FindExecu
14c40 74 61 62 6c 65 29 28 28 63 6f 6e 73 74 20 63 68  table)((const ch
14c50 61 72 20 2a 29 28 61 72 67 29 29 29 0a 23 65 6e  ar *)(arg))).#en
14c60 64 69 66 0a 23 20 20 20 64 65 66 69 6e 65 20 54  dif.#   define T
14c70 63 6c 5f 4d 61 69 6e 45 78 20 54 63 6c 5f 4d 61  cl_MainEx Tcl_Ma
14c80 69 6e 45 78 57 0a 20 20 20 20 45 58 54 45 52 4e  inExW.    EXTERN
14c90 20 54 43 4c 5f 4e 4f 52 45 54 55 52 4e 20 76 6f   TCL_NORETURN vo
14ca0 69 64 20 54 63 6c 5f 4d 61 69 6e 45 78 57 28 54  id Tcl_MainExW(T
14cb0 63 6c 5f 53 69 7a 65 20 61 72 67 63 2c 20 63 6f  cl_Size argc, co
14cc0 6e 73 74 20 76 6f 69 64 20 2a 61 72 67 76 2c 0a  nst void *argv,.
14cd0 09 20 20 20 20 54 63 6c 5f 41 70 70 49 6e 69 74  .    Tcl_AppInit
14ce0 50 72 6f 63 20 2a 61 70 70 49 6e 69 74 50 72 6f  Proc *appInitPro
14cf0 63 2c 20 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69  c, Tcl_Interp *i
14d00 6e 74 65 72 70 29 3b 0a 23 65 6e 64 69 66 0a 23  nterp);.#endif.#
14d10 69 66 20 64 65 66 69 6e 65 64 28 55 53 45 5f 54  if defined(USE_T
14d20 43 4c 5f 53 54 55 42 53 29 0a 23 64 65 66 69 6e  CL_STUBS).#defin
14d30 65 20 54 63 6c 5f 53 65 74 50 61 6e 69 63 50 72  e Tcl_SetPanicPr
14d40 6f 63 28 70 61 6e 69 63 50 72 6f 63 29 20 5c 0a  oc(panicProc) \.
14d50 20 20 20 20 54 63 6c 49 6e 69 74 53 74 75 62 54      TclInitStubT
14d60 61 62 6c 65 28 28 28 63 6f 6e 73 74 20 63 68 61  able(((const cha
14d70 72 20 2a 28 2a 29 28 54 63 6c 5f 50 61 6e 69 63  r *(*)(Tcl_Panic
14d80 50 72 6f 63 20 2a 29 29 54 63 6c 53 74 75 62 43  Proc *))TclStubC
14d90 61 6c 6c 28 28 76 6f 69 64 20 2a 29 70 61 6e 69  all((void *)pani
14da0 63 50 72 6f 63 29 29 28 70 61 6e 69 63 50 72 6f  cProc))(panicPro
14db0 63 29 29 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f  c)).#define Tcl_
14dc0 49 6e 69 74 53 75 62 73 79 73 74 65 6d 73 28 29  InitSubsystems()
14dd0 20 5c 0a 20 20 20 20 54 63 6c 49 6e 69 74 53 74   \.    TclInitSt
14de0 75 62 54 61 62 6c 65 28 28 28 63 6f 6e 73 74 20  ubTable(((const 
14df0 63 68 61 72 20 2a 28 2a 29 28 76 6f 69 64 29 29  char *(*)(void))
14e00 54 63 6c 53 74 75 62 43 61 6c 6c 28 28 76 6f 69  TclStubCall((voi
14e10 64 20 2a 29 31 29 29 28 29 29 0a 23 64 65 66 69  d *)1))()).#defi
14e20 6e 65 20 54 63 6c 5f 46 69 6e 64 45 78 65 63 75  ne Tcl_FindExecu
14e30 74 61 62 6c 65 28 61 72 67 76 30 29 20 5c 0a 20  table(argv0) \. 
14e40 20 20 20 54 63 6c 49 6e 69 74 53 74 75 62 54 61     TclInitStubTa
14e50 62 6c 65 28 28 28 63 6f 6e 73 74 20 63 68 61 72  ble(((const char
14e60 20 2a 28 2a 29 28 63 6f 6e 73 74 20 63 68 61 72   *(*)(const char
14e70 20 2a 29 29 54 63 6c 53 74 75 62 43 61 6c 6c 28   *))TclStubCall(
14e80 28 76 6f 69 64 20 2a 29 32 29 29 28 61 72 67 76  (void *)2))(argv
14e90 30 29 29 0a 23 64 65 66 69 6e 65 20 54 63 6c 5a  0)).#define TclZ
14ea0 69 70 66 73 5f 41 70 70 48 6f 6f 6b 28 61 72 67  ipfs_AppHook(arg
14eb0 63 70 2c 20 61 72 67 76 70 29 20 5c 0a 09 54 63  cp, argvp) \..Tc
14ec0 6c 49 6e 69 74 53 74 75 62 54 61 62 6c 65 28 28  lInitStubTable((
14ed0 28 63 6f 6e 73 74 20 63 68 61 72 20 2a 28 2a 29  (const char *(*)
14ee0 28 69 6e 74 20 2a 2c 20 76 6f 69 64 20 2a 29 29  (int *, void *))
14ef0 54 63 6c 53 74 75 62 43 61 6c 6c 28 28 76 6f 69  TclStubCall((voi
14f00 64 20 2a 29 33 29 29 28 61 72 67 63 70 2c 20 61  d *)3))(argcp, a
14f10 72 67 76 70 29 29 0a 23 64 65 66 69 6e 65 20 54  rgvp)).#define T
14f20 63 6c 5f 4d 61 69 6e 45 78 57 28 61 72 67 63 2c  cl_MainExW(argc,
14f30 20 61 72 67 76 2c 20 61 70 70 49 6e 69 74 50 72   argv, appInitPr
14f40 6f 63 2c 20 69 6e 74 65 72 70 29 20 5c 0a 09 28  oc, interp) \..(
14f50 76 6f 69 64 29 28 28 63 6f 6e 73 74 20 63 68 61  void)((const cha
14f60 72 20 2a 28 2a 29 28 54 63 6c 5f 53 69 7a 65 2c  r *(*)(Tcl_Size,
14f70 20 63 6f 6e 73 74 20 76 6f 69 64 20 2a 2c 20 54   const void *, T
14f80 63 6c 5f 41 70 70 49 6e 69 74 50 72 6f 63 20 2a  cl_AppInitProc *
14f90 2c 20 54 63 6c 5f 49 6e 74 65 72 70 20 2a 29 29  , Tcl_Interp *))
14fa0 20 5c 0a 09 54 63 6c 53 74 75 62 43 61 6c 6c 28   \..TclStubCall(
14fb0 28 76 6f 69 64 20 2a 29 34 29 29 28 61 72 67 63  (void *)4))(argc
14fc0 2c 20 61 72 67 76 2c 20 61 70 70 49 6e 69 74 50  , argv, appInitP
14fd0 72 6f 63 2c 20 69 6e 74 65 72 70 29 0a 23 69 66  roc, interp).#if
14fe0 20 21 64 65 66 69 6e 65 64 28 5f 57 49 4e 33 32   !defined(_WIN32
14ff0 29 20 7c 7c 20 21 64 65 66 69 6e 65 64 28 55 4e  ) || !defined(UN
15000 49 43 4f 44 45 29 0a 23 64 65 66 69 6e 65 20 54  ICODE).#define T
15010 63 6c 5f 4d 61 69 6e 45 78 28 61 72 67 63 2c 20  cl_MainEx(argc, 
15020 61 72 67 76 2c 20 61 70 70 49 6e 69 74 50 72 6f  argv, appInitPro
15030 63 2c 20 69 6e 74 65 72 70 29 20 5c 0a 09 28 76  c, interp) \..(v
15040 6f 69 64 29 28 28 63 6f 6e 73 74 20 63 68 61 72  oid)((const char
15050 20 2a 28 2a 29 28 54 63 6c 5f 53 69 7a 65 2c 20   *(*)(Tcl_Size, 
15060 63 6f 6e 73 74 20 76 6f 69 64 20 2a 2c 20 54 63  const void *, Tc
15070 6c 5f 41 70 70 49 6e 69 74 50 72 6f 63 20 2a 2c  l_AppInitProc *,
15080 20 54 63 6c 5f 49 6e 74 65 72 70 20 2a 29 29 20   Tcl_Interp *)) 
15090 5c 0a 09 54 63 6c 53 74 75 62 43 61 6c 6c 28 28  \..TclStubCall((
150a0 76 6f 69 64 20 2a 29 35 29 29 28 61 72 67 63 2c  void *)5))(argc,
150b0 20 61 72 67 76 2c 20 61 70 70 49 6e 69 74 50 72   argv, appInitPr
150c0 6f 63 2c 20 69 6e 74 65 72 70 29 0a 23 65 6e 64  oc, interp).#end
150d0 69 66 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f 53  if.#define Tcl_S
150e0 74 61 74 69 63 4c 69 62 72 61 72 79 28 69 6e 74  taticLibrary(int
150f0 65 72 70 2c 20 70 6b 67 4e 61 6d 65 2c 20 69 6e  erp, pkgName, in
15100 69 74 50 72 6f 63 2c 20 73 61 66 65 49 6e 69 74  itProc, safeInit
15110 50 72 6f 63 29 20 5c 0a 09 28 76 6f 69 64 29 28  Proc) \..(void)(
15120 28 63 6f 6e 73 74 20 63 68 61 72 20 2a 28 2a 29  (const char *(*)
15130 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a 2c 20 63  (Tcl_Interp *, c
15140 6f 6e 73 74 20 63 68 61 72 20 2a 2c 20 54 63 6c  onst char *, Tcl
15150 5f 4c 69 62 72 61 72 79 49 6e 69 74 50 72 6f 63  _LibraryInitProc
15160 20 2a 2c 20 54 63 6c 5f 4c 69 62 72 61 72 79 49   *, Tcl_LibraryI
15170 6e 69 74 50 72 6f 63 20 2a 29 29 20 5c 0a 09 54  nitProc *)) \..T
15180 63 6c 53 74 75 62 43 61 6c 6c 28 28 76 6f 69 64  clStubCall((void
15190 20 2a 29 36 29 29 28 69 6e 74 65 72 70 2c 20 70   *)6))(interp, p
151a0 6b 67 4e 61 6d 65 2c 20 69 6e 69 74 50 72 6f 63  kgName, initProc
151b0 2c 20 73 61 66 65 49 6e 69 74 50 72 6f 63 29 0a  , safeInitProc).
151c0 23 64 65 66 69 6e 65 20 54 63 6c 5f 53 65 74 45  #define Tcl_SetE
151d0 78 69 74 50 72 6f 63 28 70 72 6f 63 29 20 5c 0a  xitProc(proc) \.
151e0 09 28 28 54 63 6c 5f 45 78 69 74 50 72 6f 63 20  .((Tcl_ExitProc 
151f0 2a 28 2a 29 28 54 63 6c 5f 45 78 69 74 50 72 6f  *(*)(Tcl_ExitPro
15200 63 20 2a 29 29 54 63 6c 53 74 75 62 43 61 6c 6c  c *))TclStubCall
15210 28 28 76 6f 69 64 20 2a 29 37 29 29 28 70 72 6f  ((void *)7))(pro
15220 63 29 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f 47  c).#define Tcl_G
15230 65 74 4d 65 6d 6f 72 79 49 6e 66 6f 28 64 73 50  etMemoryInfo(dsP
15240 74 72 29 20 5c 0a 09 28 76 6f 69 64 29 28 28 63  tr) \..(void)((c
15250 6f 6e 73 74 20 63 68 61 72 20 2a 28 2a 29 28 54  onst char *(*)(T
15260 63 6c 5f 44 53 74 72 69 6e 67 20 2a 29 29 54 63  cl_DString *))Tc
15270 6c 53 74 75 62 43 61 6c 6c 28 28 76 6f 69 64 20  lStubCall((void 
15280 2a 29 38 29 29 28 64 73 50 74 72 29 0a 23 64 65  *)8))(dsPtr).#de
15290 66 69 6e 65 20 54 63 6c 5f 53 65 74 50 72 65 49  fine Tcl_SetPreI
152a0 6e 69 74 53 63 72 69 70 74 28 73 74 72 69 6e 67  nitScript(string
152b0 29 20 5c 0a 09 28 28 63 6f 6e 73 74 20 63 68 61  ) \..((const cha
152c0 72 20 2a 28 2a 29 28 63 6f 6e 73 74 20 63 68 61  r *(*)(const cha
152d0 72 20 2a 29 29 54 63 6c 53 74 75 62 43 61 6c 6c  r *))TclStubCall
152e0 28 28 76 6f 69 64 20 2a 29 39 29 29 28 73 74 72  ((void *)9))(str
152f0 69 6e 67 29 0a 23 65 6e 64 69 66 0a 0c 0a 2f 2a  ing).#endif.../*
15300 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  . *-------------
15310 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
15320 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
15330 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
15340 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a  ---------------.
15350 20 2a 20 49 6e 63 6c 75 64 65 20 74 68 65 20 70   * Include the p
15360 75 62 6c 69 63 20 66 75 6e 63 74 69 6f 6e 20 64  ublic function d
15370 65 63 6c 61 72 61 74 69 6f 6e 73 20 74 68 61 74  eclarations that
15380 20 61 72 65 20 61 63 63 65 73 73 69 62 6c 65 20   are accessible 
15390 76 69 61 20 74 68 65 20 73 74 75 62 73 0a 20 2a  via the stubs. *
153a0 20 74 61 62 6c 65 2e 0a 20 2a 2f 0a 0a 23 69 6e   table.. */..#in
153b0 63 6c 75 64 65 20 22 74 63 6c 44 65 63 6c 73 2e  clude "tclDecls.
153c0 68 22 20 20 2f 2a 20 49 57 59 55 20 70 72 61 67  h"  /* IWYU prag
153d0 6d 61 3a 20 65 78 70 6f 72 74 20 2a 2f 0a 0a 2f  ma: export */../
153e0 2a 0a 20 2a 20 49 6e 63 6c 75 64 65 20 70 6c 61  *. * Include pla
153f0 74 66 6f 72 6d 20 73 70 65 63 69 66 69 63 20 70  tform specific p
15400 75 62 6c 69 63 20 66 75 6e 63 74 69 6f 6e 20 64  ublic function d
15410 65 63 6c 61 72 61 74 69 6f 6e 73 20 74 68 61 74  eclarations that
15420 20 61 72 65 20 61 63 63 65 73 73 69 62 6c 65 0a   are accessible.
15430 20 2a 20 76 69 61 20 74 68 65 20 73 74 75 62 73   * via the stubs
15440 20 74 61 62 6c 65 2e 20 4d 61 6b 65 20 61 6c 6c   table. Make all
15450 20 54 63 6c 4f 4f 20 73 79 6d 62 6f 6c 73 20 4d   TclOO symbols M
15460 4f 44 55 4c 45 5f 53 43 4f 50 45 20 28 77 68 69  ODULE_SCOPE (whi
15470 63 68 20 6f 6e 6c 79 0a 20 2a 20 68 61 73 20 65  ch only. * has e
15480 66 66 65 63 74 20 6f 6e 20 62 75 69 6c 64 69 6e  ffect on buildin
15490 67 20 69 74 20 61 73 20 61 20 73 68 61 72 65 64  g it as a shared
154a0 20 6c 69 62 72 61 72 79 29 2e 20 53 65 65 20 74   library). See t
154b0 69 63 6b 65 74 20 5b 33 30 31 30 33 35 32 5d 2e  icket [3010352].
154c0 0a 20 2a 2f 0a 0a 23 69 66 20 64 65 66 69 6e 65  . */..#if define
154d0 64 28 42 55 49 4c 44 5f 74 63 6c 29 0a 23 20 20  d(BUILD_tcl).#  
154e0 20 75 6e 64 65 66 20 54 43 4c 41 50 49 0a 23 20   undef TCLAPI.# 
154f0 20 20 64 65 66 69 6e 65 20 54 43 4c 41 50 49 20    define TCLAPI 
15500 4d 4f 44 55 4c 45 5f 53 43 4f 50 45 0a 23 65 6e  MODULE_SCOPE.#en
15510 64 69 66 0a 0a 23 69 6e 63 6c 75 64 65 20 22 74  dif..#include "t
15520 63 6c 50 6c 61 74 44 65 63 6c 73 2e 68 22 20 20  clPlatDecls.h"  
15530 2f 2a 20 49 57 59 55 20 70 72 61 67 6d 61 3a 20  /* IWYU pragma: 
15540 65 78 70 6f 72 74 20 2a 2f 0a 0a 2f 2a 0a 20 2a  export */../*. *
15550 2d 2d 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 0a 20 2a 20  ------------. * 
155a0 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 64 65  The following de
155b0 63 6c 61 72 61 74 69 6f 6e 73 20 6d 61 70 20 63  clarations map c
155c0 6b 61 6c 6c 6f 63 20 61 6e 64 20 63 6b 66 72 65  kalloc and ckfre
155d0 65 20 74 6f 20 54 63 6c 5f 41 6c 6c 6f 63 20 61  e to Tcl_Alloc a
155e0 6e 64 0a 20 2a 20 54 63 6c 5f 46 72 65 65 20 66  nd. * Tcl_Free f
155f0 6f 72 20 75 73 65 20 69 6e 20 54 63 6c 2d 38 2e  or use in Tcl-8.
15600 78 2d 63 6f 6d 70 61 74 69 62 6c 65 20 65 78 74  x-compatible ext
15610 65 6e 73 69 6f 6e 73 2e 0a 20 2a 2f 0a 0a 23 69  ensions.. */..#i
15620 66 6e 64 65 66 20 42 55 49 4c 44 5f 74 63 6c 0a  fndef BUILD_tcl.
15630 23 20 20 20 64 65 66 69 6e 65 20 63 6b 61 6c 6c  #   define ckall
15640 6f 63 20 54 63 6c 5f 41 6c 6c 6f 63 0a 23 20 20  oc Tcl_Alloc.#  
15650 20 64 65 66 69 6e 65 20 61 74 74 65 6d 70 74 63   define attemptc
15660 6b 61 6c 6c 6f 63 20 54 63 6c 5f 41 74 74 65 6d  kalloc Tcl_Attem
15670 70 74 41 6c 6c 6f 63 0a 23 20 20 20 69 66 64 65  ptAlloc.#   ifde
15680 66 20 5f 4d 53 43 5f 56 45 52 0a 09 2f 2a 20 53  f _MSC_VER../* S
15690 69 6c 65 6e 63 65 20 69 6e 76 61 6c 69 64 20 43  ilence invalid C
156a0 34 30 39 30 20 77 61 72 6e 69 6e 67 73 20 2a 2f  4090 warnings */
156b0 0a 23 09 64 65 66 69 6e 65 20 63 6b 66 72 65 65  .#.define ckfree
156c0 28 61 29 20 54 63 6c 5f 46 72 65 65 28 28 76 6f  (a) Tcl_Free((vo
156d0 69 64 20 2a 29 28 61 29 29 0a 23 09 64 65 66 69  id *)(a)).#.defi
156e0 6e 65 20 63 6b 72 65 61 6c 6c 6f 63 28 61 2c 62  ne ckrealloc(a,b
156f0 29 20 54 63 6c 5f 52 65 61 6c 6c 6f 63 28 28 76  ) Tcl_Realloc((v
15700 6f 69 64 20 2a 29 28 61 29 2c 28 62 29 29 0a 23  oid *)(a),(b)).#
15710 09 64 65 66 69 6e 65 20 61 74 74 65 6d 70 74 63  .define attemptc
15720 6b 72 65 61 6c 6c 6f 63 28 61 2c 62 29 20 54 63  krealloc(a,b) Tc
15730 6c 5f 41 74 74 65 6d 70 74 52 65 61 6c 6c 6f 63  l_AttemptRealloc
15740 28 28 76 6f 69 64 20 2a 29 28 61 29 2c 28 62 29  ((void *)(a),(b)
15750 29 0a 23 20 20 20 65 6c 73 65 0a 23 09 64 65 66  ).#   else.#.def
15760 69 6e 65 20 63 6b 66 72 65 65 20 54 63 6c 5f 46  ine ckfree Tcl_F
15770 72 65 65 0a 23 09 64 65 66 69 6e 65 20 63 6b 72  ree.#.define ckr
15780 65 61 6c 6c 6f 63 20 54 63 6c 5f 52 65 61 6c 6c  ealloc Tcl_Reall
15790 6f 63 0a 23 09 64 65 66 69 6e 65 20 61 74 74 65  oc.#.define atte
157a0 6d 70 74 63 6b 72 65 61 6c 6c 6f 63 20 54 63 6c  mptckrealloc Tcl
157b0 5f 41 74 74 65 6d 70 74 52 65 61 6c 6c 6f 63 0a  _AttemptRealloc.
157c0 23 20 20 20 65 6e 64 69 66 0a 23 65 6e 64 69 66  #   endif.#endif
157d0 0a 0a 23 69 66 6e 64 65 66 20 54 43 4c 5f 4d 45  ..#ifndef TCL_ME
157e0 4d 5f 44 45 42 55 47 0a 0a 2f 2a 0a 20 2a 20 49  M_DEBUG../*. * I
157f0 66 20 77 65 20 61 72 65 20 6e 6f 74 20 75 73 69  f we are not usi
15800 6e 67 20 74 68 65 20 64 65 62 75 67 67 69 6e 67  ng the debugging
15810 20 61 6c 6c 6f 63 61 74 6f 72 2c 20 77 65 20 73   allocator, we s
15820 68 6f 75 6c 64 20 63 61 6c 6c 20 74 68 65 20 54  hould call the T
15830 63 6c 5f 41 6c 6c 6f 63 2c 0a 20 2a 20 65 74 20  cl_Alloc,. * et 
15840 61 6c 2e 20 72 6f 75 74 69 6e 65 73 20 69 6e 20  al. routines in 
15850 6f 72 64 65 72 20 74 6f 20 67 75 61 72 61 6e 74  order to guarant
15860 65 65 20 74 68 61 74 20 65 76 65 72 79 20 6d 6f  ee that every mo
15870 64 75 6c 65 20 69 73 20 75 73 69 6e 67 20 74 68  dule is using th
15880 65 20 73 61 6d 65 0a 20 2a 20 6d 65 6d 6f 72 79  e same. * memory
15890 20 61 6c 6c 6f 63 61 74 6f 72 20 62 6f 74 68 20   allocator both 
158a0 69 6e 73 69 64 65 20 61 6e 64 20 6f 75 74 73 69  inside and outsi
158b0 64 65 20 6f 66 20 74 68 65 20 54 63 6c 20 6c 69  de of the Tcl li
158c0 62 72 61 72 79 2e 0a 20 2a 2f 0a 0a 23 20 20 20  brary.. */..#   
158d0 75 6e 64 65 66 20 20 54 63 6c 5f 49 6e 69 74 4d  undef  Tcl_InitM
158e0 65 6d 6f 72 79 0a 23 20 20 20 64 65 66 69 6e 65  emory.#   define
158f0 20 54 63 6c 5f 49 6e 69 74 4d 65 6d 6f 72 79 28   Tcl_InitMemory(
15900 78 29 0a 23 20 20 20 75 6e 64 65 66 20 20 54 63  x).#   undef  Tc
15910 6c 5f 44 75 6d 70 41 63 74 69 76 65 4d 65 6d 6f  l_DumpActiveMemo
15920 72 79 0a 23 20 20 20 64 65 66 69 6e 65 20 54 63  ry.#   define Tc
15930 6c 5f 44 75 6d 70 41 63 74 69 76 65 4d 65 6d 6f  l_DumpActiveMemo
15940 72 79 28 78 29 0a 23 20 20 20 75 6e 64 65 66 20  ry(x).#   undef 
15950 20 54 63 6c 5f 56 61 6c 69 64 61 74 65 41 6c 6c   Tcl_ValidateAll
15960 4d 65 6d 6f 72 79 0a 23 20 20 20 64 65 66 69 6e  Memory.#   defin
15970 65 20 54 63 6c 5f 56 61 6c 69 64 61 74 65 41 6c  e Tcl_ValidateAl
15980 6c 4d 65 6d 6f 72 79 28 78 2c 79 29 0a 0a 23 65  lMemory(x,y)..#e
15990 6e 64 69 66 20 2f 2a 20 21 54 43 4c 5f 4d 45 4d  ndif /* !TCL_MEM
159a0 5f 44 45 42 55 47 20 2a 2f 0a 0a 23 69 66 64 65  _DEBUG */..#ifde
159b0 66 20 54 43 4c 5f 4d 45 4d 5f 44 45 42 55 47 0a  f TCL_MEM_DEBUG.
159c0 23 20 20 20 75 6e 64 65 66 20 54 63 6c 5f 49 6e  #   undef Tcl_In
159d0 63 72 52 65 66 43 6f 75 6e 74 0a 23 20 20 20 64  crRefCount.#   d
159e0 65 66 69 6e 65 20 54 63 6c 5f 49 6e 63 72 52 65  efine Tcl_IncrRe
159f0 66 43 6f 75 6e 74 28 6f 62 6a 50 74 72 29 20 5c  fCount(objPtr) \
15a00 0a 09 54 63 6c 5f 44 62 49 6e 63 72 52 65 66 43  ..Tcl_DbIncrRefC
15a10 6f 75 6e 74 28 6f 62 6a 50 74 72 2c 20 5f 5f 46  ount(objPtr, __F
15a20 49 4c 45 5f 5f 2c 20 5f 5f 4c 49 4e 45 5f 5f 29  ILE__, __LINE__)
15a30 0a 23 20 20 20 75 6e 64 65 66 20 54 63 6c 5f 44  .#   undef Tcl_D
15a40 65 63 72 52 65 66 43 6f 75 6e 74 0a 23 20 20 20  ecrRefCount.#   
15a50 64 65 66 69 6e 65 20 54 63 6c 5f 44 65 63 72 52  define Tcl_DecrR
15a60 65 66 43 6f 75 6e 74 28 6f 62 6a 50 74 72 29 20  efCount(objPtr) 
15a70 5c 0a 09 54 63 6c 5f 44 62 44 65 63 72 52 65 66  \..Tcl_DbDecrRef
15a80 43 6f 75 6e 74 28 6f 62 6a 50 74 72 2c 20 5f 5f  Count(objPtr, __
15a90 46 49 4c 45 5f 5f 2c 20 5f 5f 4c 49 4e 45 5f 5f  FILE__, __LINE__
15aa0 29 0a 23 20 20 20 75 6e 64 65 66 20 54 63 6c 5f  ).#   undef Tcl_
15ab0 49 73 53 68 61 72 65 64 0a 23 20 20 20 64 65 66  IsShared.#   def
15ac0 69 6e 65 20 54 63 6c 5f 49 73 53 68 61 72 65 64  ine Tcl_IsShared
15ad0 28 6f 62 6a 50 74 72 29 20 5c 0a 09 54 63 6c 5f  (objPtr) \..Tcl_
15ae0 44 62 49 73 53 68 61 72 65 64 28 6f 62 6a 50 74  DbIsShared(objPt
15af0 72 2c 20 5f 5f 46 49 4c 45 5f 5f 2c 20 5f 5f 4c  r, __FILE__, __L
15b00 49 4e 45 5f 5f 29 0a 2f 2a 0a 20 2a 20 46 72 65  INE__)./*. * Fre
15b10 65 20 74 68 65 20 4f 62 6a 20 62 79 20 65 66 66  e the Obj by eff
15b20 65 63 74 69 76 65 6c 79 20 64 6f 69 6e 67 3a 0a  ectively doing:.
15b30 20 2a 0a 20 2a 20 20 20 54 63 6c 5f 49 6e 63 72   *. *   Tcl_Incr
15b40 52 65 66 43 6f 75 6e 74 28 6f 62 6a 50 74 72 29  RefCount(objPtr)
15b50 3b 0a 20 2a 20 20 20 54 63 6c 5f 44 65 63 72 52  ;. *   Tcl_DecrR
15b60 65 66 43 6f 75 6e 74 28 6f 62 6a 50 74 72 29 3b  efCount(objPtr);
15b70 0a 20 2a 0a 20 2a 20 54 68 69 73 20 77 69 6c 6c  . *. * This will
15b80 20 66 72 65 65 20 74 68 65 20 6f 62 6a 20 69 66   free the obj if
15b90 20 74 68 65 72 65 20 61 72 65 20 6e 6f 20 72 65   there are no re
15ba0 66 65 72 65 6e 63 65 73 20 74 6f 20 74 68 65 20  ferences to the 
15bb0 6f 62 6a 2e 0a 20 2a 2f 0a 23 20 20 20 64 65 66  obj.. */.#   def
15bc0 69 6e 65 20 54 63 6c 5f 42 6f 75 6e 63 65 52 65  ine Tcl_BounceRe
15bd0 66 43 6f 75 6e 74 28 6f 62 6a 50 74 72 29 20 5c  fCount(objPtr) \
15be0 0a 20 20 20 20 54 63 6c 42 6f 75 6e 63 65 52 65  .    TclBounceRe
15bf0 66 43 6f 75 6e 74 28 6f 62 6a 50 74 72 2c 20 5f  fCount(objPtr, _
15c00 5f 46 49 4c 45 5f 5f 2c 20 5f 5f 4c 49 4e 45 5f  _FILE__, __LINE_
15c10 5f 29 0a 0a 73 74 61 74 69 63 20 69 6e 6c 69 6e  _)..static inlin
15c20 65 20 76 6f 69 64 0a 54 63 6c 42 6f 75 6e 63 65  e void.TclBounce
15c30 52 65 66 43 6f 75 6e 74 28 0a 20 20 20 20 54 63  RefCount(.    Tc
15c40 6c 5f 4f 62 6a 20 2a 6f 62 6a 50 74 72 2c 0a 20  l_Obj *objPtr,. 
15c50 20 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 66     const char *f
15c60 69 6c 65 2c 0a 20 20 20 20 69 6e 74 20 6c 69 6e  ile,.    int lin
15c70 65 29 0a 7b 0a 20 20 20 20 69 66 20 28 6f 62 6a  e).{.    if (obj
15c80 50 74 72 29 20 7b 0a 09 69 66 20 28 28 6f 62 6a  Ptr) {..if ((obj
15c90 50 74 72 29 2d 3e 72 65 66 43 6f 75 6e 74 20 3d  Ptr)->refCount =
15ca0 3d 20 30 29 20 7b 0a 09 20 20 20 20 54 63 6c 5f  = 0) {..    Tcl_
15cb0 44 62 44 65 63 72 52 65 66 43 6f 75 6e 74 28 6f  DbDecrRefCount(o
15cc0 62 6a 50 74 72 2c 20 66 69 6c 65 2c 20 6c 69 6e  bjPtr, file, lin
15cd0 65 29 3b 0a 09 7d 0a 20 20 20 20 7d 0a 7d 0a 23  e);..}.    }.}.#
15ce0 65 6c 73 65 0a 23 20 20 20 75 6e 64 65 66 20 54  else.#   undef T
15cf0 63 6c 5f 49 6e 63 72 52 65 66 43 6f 75 6e 74 0a  cl_IncrRefCount.
15d00 23 20 20 20 64 65 66 69 6e 65 20 54 63 6c 5f 49  #   define Tcl_I
15d10 6e 63 72 52 65 66 43 6f 75 6e 74 28 6f 62 6a 50  ncrRefCount(objP
15d20 74 72 29 20 5c 0a 09 28 28 76 6f 69 64 29 2b 2b  tr) \..((void)++
15d30 28 6f 62 6a 50 74 72 29 2d 3e 72 65 66 43 6f 75  (objPtr)->refCou
15d40 6e 74 29 0a 20 20 20 20 2f 2a 0a 20 20 20 20 20  nt).    /*.     
15d50 2a 20 55 73 65 20 64 6f 2f 77 68 69 6c 65 30 20  * Use do/while0 
15d60 69 64 69 6f 6d 20 66 6f 72 20 6f 70 74 69 6d 75  idiom for optimu
15d70 6d 20 63 6f 72 72 65 63 74 6e 65 73 73 20 77 69  m correctness wi
15d80 74 68 6f 75 74 20 63 6f 6d 70 69 6c 65 72 20 77  thout compiler w
15d90 61 72 6e 69 6e 67 73 2e 0a 20 20 20 20 20 2a 20  arnings..     * 
15da0 68 74 74 70 73 3a 2f 2f 77 69 6b 69 2e 63 32 2e  https://wiki.c2.
15db0 63 6f 6d 2f 3f 54 72 69 76 69 61 6c 44 6f 57 68  com/?TrivialDoWh
15dc0 69 6c 65 4c 6f 6f 70 0a 20 20 20 20 20 2a 2f 0a  ileLoop.     */.
15dd0 23 20 20 20 75 6e 64 65 66 20 54 63 6c 5f 44 65  #   undef Tcl_De
15de0 63 72 52 65 66 43 6f 75 6e 74 0a 23 20 20 20 64  crRefCount.#   d
15df0 65 66 69 6e 65 20 54 63 6c 5f 44 65 63 72 52 65  efine Tcl_DecrRe
15e00 66 43 6f 75 6e 74 28 6f 62 6a 50 74 72 29 20 5c  fCount(objPtr) \
15e10 0a 09 64 6f 20 7b 09 09 09 09 09 09 09 09 5c 0a  ..do {........\.
15e20 09 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 5f 6f  .    Tcl_Obj *_o
15e30 62 6a 50 74 72 20 3d 20 28 6f 62 6a 50 74 72 29  bjPtr = (objPtr)
15e40 3b 09 09 09 09 5c 0a 09 20 20 20 20 69 66 20 28  ;....\..    if (
15e50 5f 6f 62 6a 50 74 72 2d 3e 72 65 66 43 6f 75 6e  _objPtr->refCoun
15e60 74 2d 2d 20 3c 3d 20 31 29 20 7b 09 09 09 09 5c  t-- <= 1) {....\
15e70 0a 09 09 54 63 6c 46 72 65 65 4f 62 6a 28 5f 6f  ...TclFreeObj(_o
15e80 62 6a 50 74 72 29 3b 09 09 09 09 09 5c 0a 09 20  bjPtr);.....\.. 
15e90 20 20 20 7d 09 09 09 09 09 09 09 09 5c 0a 09 7d     }........\..}
15ea0 20 77 68 69 6c 65 28 30 29 0a 23 20 20 20 75 6e   while(0).#   un
15eb0 64 65 66 20 54 63 6c 5f 49 73 53 68 61 72 65 64  def Tcl_IsShared
15ec0 0a 23 20 20 20 64 65 66 69 6e 65 20 54 63 6c 5f  .#   define Tcl_
15ed0 49 73 53 68 61 72 65 64 28 6f 62 6a 50 74 72 29  IsShared(objPtr)
15ee0 20 5c 0a 09 28 28 6f 62 6a 50 74 72 29 2d 3e 72   \..((objPtr)->r
15ef0 65 66 43 6f 75 6e 74 20 3e 20 31 29 0a 0a 2f 2a  efCount > 1)../*
15f00 0a 20 2a 20 44 65 63 6c 61 72 65 20 74 68 61 74  . * Declare that
15f10 20 6f 62 6a 20 77 69 6c 6c 20 6e 6f 20 6c 6f 6e   obj will no lon
15f20 67 65 72 20 62 65 20 75 73 65 64 20 6f 72 20 72  ger be used or r
15f30 65 66 65 72 65 6e 63 65 64 2e 0a 20 2a 20 54 68  eferenced.. * Th
15f40 69 73 20 77 69 6c 6c 20 66 72 65 65 20 74 68 65  is will free the
15f50 20 6f 62 6a 20 69 66 20 74 68 65 72 65 20 61 72   obj if there ar
15f60 65 20 6e 6f 20 72 65 66 65 72 65 6e 63 65 73 20  e no references 
15f70 74 6f 20 74 68 65 20 6f 62 6a 2e 0a 20 2a 2f 0a  to the obj.. */.
15f80 23 20 20 20 64 65 66 69 6e 65 20 54 63 6c 5f 42  #   define Tcl_B
15f90 6f 75 6e 63 65 52 65 66 43 6f 75 6e 74 28 6f 62  ounceRefCount(ob
15fa0 6a 50 74 72 29 20 5c 0a 20 20 20 20 54 63 6c 42  jPtr) \.    TclB
15fb0 6f 75 6e 63 65 52 65 66 43 6f 75 6e 74 28 6f 62  ounceRefCount(ob
15fc0 6a 50 74 72 29 3b 0a 0a 73 74 61 74 69 63 20 69  jPtr);..static i
15fd0 6e 6c 69 6e 65 20 76 6f 69 64 0a 54 63 6c 42 6f  nline void.TclBo
15fe0 75 6e 63 65 52 65 66 43 6f 75 6e 74 28 0a 20 20  unceRefCount(.  
15ff0 20 20 54 63 6c 5f 4f 62 6a 20 2a 6f 62 6a 50 74    Tcl_Obj *objPt
16000 72 29 0a 7b 0a 20 20 20 20 69 66 20 28 6f 62 6a  r).{.    if (obj
16010 50 74 72 29 20 7b 0a 09 69 66 20 28 28 6f 62 6a  Ptr) {..if ((obj
16020 50 74 72 29 2d 3e 72 65 66 43 6f 75 6e 74 20 3d  Ptr)->refCount =
16030 3d 20 30 29 20 7b 0a 09 20 20 20 20 54 63 6c 5f  = 0) {..    Tcl_
16040 44 65 63 72 52 65 66 43 6f 75 6e 74 28 6f 62 6a  DecrRefCount(obj
16050 50 74 72 29 3b 0a 09 7d 0a 20 20 20 20 7d 0a 7d  Ptr);..}.    }.}
16060 0a 0a 23 65 6e 64 69 66 0a 0a 2f 2a 0a 20 2a 20  ..#endif../*. * 
16070 4d 61 63 72 6f 73 20 61 6e 64 20 64 65 66 69 6e  Macros and defin
16080 69 74 69 6f 6e 73 20 74 68 61 74 20 68 65 6c 70  itions that help
16090 20 74 6f 20 64 65 62 75 67 20 74 68 65 20 75 73   to debug the us
160a0 65 20 6f 66 20 54 63 6c 20 6f 62 6a 65 63 74 73  e of Tcl objects
160b0 2e 20 57 68 65 6e 0a 20 2a 20 54 43 4c 5f 4d 45  . When. * TCL_ME
160c0 4d 5f 44 45 42 55 47 20 69 73 20 64 65 66 69 6e  M_DEBUG is defin
160d0 65 64 2c 20 74 68 65 20 54 63 6c 5f 4e 65 77 20  ed, the Tcl_New 
160e0 64 65 63 6c 61 72 61 74 69 6f 6e 73 20 61 72 65  declarations are
160f0 20 6f 76 65 72 72 69 64 64 65 6e 20 74 6f 20 63   overridden to c
16100 61 6c 6c 0a 20 2a 20 64 65 62 75 67 67 69 6e 67  all. * debugging
16110 20 76 65 72 73 69 6f 6e 73 20 6f 66 20 74 68 65   versions of the
16120 20 6f 62 6a 65 63 74 20 63 72 65 61 74 69 6f 6e   object creation
16130 20 66 75 6e 63 74 69 6f 6e 73 2e 0a 20 2a 2f 0a   functions.. */.
16140 0a 23 69 66 64 65 66 20 54 43 4c 5f 4d 45 4d 5f  .#ifdef TCL_MEM_
16150 44 45 42 55 47 0a 23 20 20 75 6e 64 65 66 20 20  DEBUG.#  undef  
16160 54 63 6c 5f 4e 65 77 42 69 67 6e 75 6d 4f 62 6a  Tcl_NewBignumObj
16170 0a 23 20 20 64 65 66 69 6e 65 20 54 63 6c 5f 4e  .#  define Tcl_N
16180 65 77 42 69 67 6e 75 6d 4f 62 6a 28 76 61 6c 29  ewBignumObj(val)
16190 20 5c 0a 20 20 20 20 20 54 63 6c 5f 44 62 4e 65   \.     Tcl_DbNe
161a0 77 42 69 67 6e 75 6d 4f 62 6a 28 76 61 6c 2c 20  wBignumObj(val, 
161b0 5f 5f 46 49 4c 45 5f 5f 2c 20 5f 5f 4c 49 4e 45  __FILE__, __LINE
161c0 5f 5f 29 0a 23 20 20 75 6e 64 65 66 20 20 54 63  __).#  undef  Tc
161d0 6c 5f 4e 65 77 42 6f 6f 6c 65 61 6e 4f 62 6a 0a  l_NewBooleanObj.
161e0 23 20 20 64 65 66 69 6e 65 20 54 63 6c 5f 4e 65  #  define Tcl_Ne
161f0 77 42 6f 6f 6c 65 61 6e 4f 62 6a 28 76 61 6c 29  wBooleanObj(val)
16200 20 5c 0a 20 20 20 20 20 54 63 6c 5f 44 62 4e 65   \.     Tcl_DbNe
16210 77 57 69 64 65 49 6e 74 4f 62 6a 28 28 76 61 6c  wWideIntObj((val
16220 29 21 3d 30 2c 20 5f 5f 46 49 4c 45 5f 5f 2c 20  )!=0, __FILE__, 
16230 5f 5f 4c 49 4e 45 5f 5f 29 0a 23 20 20 75 6e 64  __LINE__).#  und
16240 65 66 20 20 54 63 6c 5f 4e 65 77 42 79 74 65 41  ef  Tcl_NewByteA
16250 72 72 61 79 4f 62 6a 0a 23 20 20 64 65 66 69 6e  rrayObj.#  defin
16260 65 20 54 63 6c 5f 4e 65 77 42 79 74 65 41 72 72  e Tcl_NewByteArr
16270 61 79 4f 62 6a 28 62 79 74 65 73 2c 20 6c 65 6e  ayObj(bytes, len
16280 29 20 5c 0a 20 20 20 20 20 54 63 6c 5f 44 62 4e  ) \.     Tcl_DbN
16290 65 77 42 79 74 65 41 72 72 61 79 4f 62 6a 28 62  ewByteArrayObj(b
162a0 79 74 65 73 2c 20 6c 65 6e 2c 20 5f 5f 46 49 4c  ytes, len, __FIL
162b0 45 5f 5f 2c 20 5f 5f 4c 49 4e 45 5f 5f 29 0a 23  E__, __LINE__).#
162c0 20 20 75 6e 64 65 66 20 20 54 63 6c 5f 4e 65 77    undef  Tcl_New
162d0 44 6f 75 62 6c 65 4f 62 6a 0a 23 20 20 64 65 66  DoubleObj.#  def
162e0 69 6e 65 20 54 63 6c 5f 4e 65 77 44 6f 75 62 6c  ine Tcl_NewDoubl
162f0 65 4f 62 6a 28 76 61 6c 29 20 5c 0a 20 20 20 20  eObj(val) \.    
16300 20 54 63 6c 5f 44 62 4e 65 77 44 6f 75 62 6c 65   Tcl_DbNewDouble
16310 4f 62 6a 28 76 61 6c 2c 20 5f 5f 46 49 4c 45 5f  Obj(val, __FILE_
16320 5f 2c 20 5f 5f 4c 49 4e 45 5f 5f 29 0a 23 20 20  _, __LINE__).#  
16330 75 6e 64 65 66 20 20 54 63 6c 5f 4e 65 77 4c 69  undef  Tcl_NewLi
16340 73 74 4f 62 6a 0a 23 20 20 64 65 66 69 6e 65 20  stObj.#  define 
16350 54 63 6c 5f 4e 65 77 4c 69 73 74 4f 62 6a 28 6f  Tcl_NewListObj(o
16360 62 6a 63 2c 20 6f 62 6a 76 29 20 5c 0a 20 20 20  bjc, objv) \.   
16370 20 20 54 63 6c 5f 44 62 4e 65 77 4c 69 73 74 4f    Tcl_DbNewListO
16380 62 6a 28 6f 62 6a 63 2c 20 6f 62 6a 76 2c 20 5f  bj(objc, objv, _
16390 5f 46 49 4c 45 5f 5f 2c 20 5f 5f 4c 49 4e 45 5f  _FILE__, __LINE_
163a0 5f 29 0a 23 20 20 75 6e 64 65 66 20 20 54 63 6c  _).#  undef  Tcl
163b0 5f 4e 65 77 4f 62 6a 0a 23 20 20 64 65 66 69 6e  _NewObj.#  defin
163c0 65 20 54 63 6c 5f 4e 65 77 4f 62 6a 28 29 20 5c  e Tcl_NewObj() \
163d0 0a 20 20 20 20 20 54 63 6c 5f 44 62 4e 65 77 4f  .     Tcl_DbNewO
163e0 62 6a 28 5f 5f 46 49 4c 45 5f 5f 2c 20 5f 5f 4c  bj(__FILE__, __L
163f0 49 4e 45 5f 5f 29 0a 23 20 20 75 6e 64 65 66 20  INE__).#  undef 
16400 20 54 63 6c 5f 4e 65 77 53 74 72 69 6e 67 4f 62   Tcl_NewStringOb
16410 6a 0a 23 20 20 64 65 66 69 6e 65 20 54 63 6c 5f  j.#  define Tcl_
16420 4e 65 77 53 74 72 69 6e 67 4f 62 6a 28 62 79 74  NewStringObj(byt
16430 65 73 2c 20 6c 65 6e 29 20 5c 0a 20 20 20 20 20  es, len) \.     
16440 54 63 6c 5f 44 62 4e 65 77 53 74 72 69 6e 67 4f  Tcl_DbNewStringO
16450 62 6a 28 62 79 74 65 73 2c 20 6c 65 6e 2c 20 5f  bj(bytes, len, _
16460 5f 46 49 4c 45 5f 5f 2c 20 5f 5f 4c 49 4e 45 5f  _FILE__, __LINE_
16470 5f 29 0a 23 20 20 75 6e 64 65 66 20 20 54 63 6c  _).#  undef  Tcl
16480 5f 4e 65 77 57 69 64 65 49 6e 74 4f 62 6a 0a 23  _NewWideIntObj.#
16490 20 20 64 65 66 69 6e 65 20 54 63 6c 5f 4e 65 77    define Tcl_New
164a0 57 69 64 65 49 6e 74 4f 62 6a 28 76 61 6c 29 20  WideIntObj(val) 
164b0 5c 0a 20 20 20 20 20 54 63 6c 5f 44 62 4e 65 77  \.     Tcl_DbNew
164c0 57 69 64 65 49 6e 74 4f 62 6a 28 76 61 6c 2c 20  WideIntObj(val, 
164d0 5f 5f 46 49 4c 45 5f 5f 2c 20 5f 5f 4c 49 4e 45  __FILE__, __LINE
164e0 5f 5f 29 0a 23 65 6e 64 69 66 20 2f 2a 20 54 43  __).#endif /* TC
164f0 4c 5f 4d 45 4d 5f 44 45 42 55 47 20 2a 2f 0a 0a  L_MEM_DEBUG */..
16500 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  /*. *-----------
16510 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
16520 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
16530 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
16540 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
16550 2d 0a 20 2a 20 4d 61 63 72 6f 73 20 66 6f 72 20  -. * Macros for 
16560 63 6c 69 65 6e 74 73 20 74 6f 20 75 73 65 20 74  clients to use t
16570 6f 20 61 63 63 65 73 73 20 66 69 65 6c 64 73 20  o access fields 
16580 6f 66 20 68 61 73 68 20 65 6e 74 72 69 65 73 3a  of hash entries:
16590 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 63  . */..#define Tc
165a0 6c 5f 47 65 74 48 61 73 68 56 61 6c 75 65 28 68  l_GetHashValue(h
165b0 29 20 28 28 68 29 2d 3e 63 6c 69 65 6e 74 44 61  ) ((h)->clientDa
165c0 74 61 29 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f  ta).#define Tcl_
165d0 53 65 74 48 61 73 68 56 61 6c 75 65 28 68 2c 20  SetHashValue(h, 
165e0 76 61 6c 75 65 29 20 28 28 68 29 2d 3e 63 6c 69  value) ((h)->cli
165f0 65 6e 74 44 61 74 61 20 3d 20 28 76 6f 69 64 20  entData = (void 
16600 2a 29 28 76 61 6c 75 65 29 29 0a 23 64 65 66 69  *)(value)).#defi
16610 6e 65 20 54 63 6c 5f 47 65 74 48 61 73 68 4b 65  ne Tcl_GetHashKe
16620 79 28 74 61 62 6c 65 50 74 72 2c 20 68 29 20 5c  y(tablePtr, h) \
16630 0a 09 28 28 76 6f 69 64 20 2a 29 20 28 28 28 74  ..((void *) (((t
16640 61 62 6c 65 50 74 72 29 2d 3e 6b 65 79 54 79 70  ablePtr)->keyTyp
16650 65 20 3d 3d 20 54 43 4c 5f 4f 4e 45 5f 57 4f 52  e == TCL_ONE_WOR
16660 44 5f 4b 45 59 53 20 7c 7c 09 09 5c 0a 09 09 20  D_KEYS ||..\... 
16670 20 20 20 28 74 61 62 6c 65 50 74 72 29 2d 3e 6b     (tablePtr)->k
16680 65 79 54 79 70 65 20 3d 3d 20 54 43 4c 5f 43 55  eyType == TCL_CU
16690 53 54 4f 4d 5f 50 54 52 5f 4b 45 59 53 29 09 09  STOM_PTR_KEYS)..
166a0 5c 0a 09 09 3f 20 28 68 29 2d 3e 6b 65 79 2e 6f  \...? (h)->key.o
166b0 6e 65 57 6f 72 64 56 61 6c 75 65 09 09 09 09 09  neWordValue.....
166c0 5c 0a 09 09 3a 20 28 68 29 2d 3e 6b 65 79 2e 73  \...: (h)->key.s
166d0 74 72 69 6e 67 29 29 0a 0a 2f 2a 0a 20 2a 20 4d  tring))../*. * M
166e0 61 63 72 6f 73 20 74 6f 20 75 73 65 20 66 6f 72  acros to use for
166f0 20 63 6c 69 65 6e 74 73 20 74 6f 20 75 73 65 20   clients to use 
16700 74 6f 20 69 6e 76 6f 6b 65 20 66 69 6e 64 20 61  to invoke find a
16710 6e 64 20 63 72 65 61 74 65 20 66 75 6e 63 74 69  nd create functi
16720 6f 6e 73 20 66 6f 72 0a 20 2a 20 68 61 73 68 20  ons for. * hash 
16730 74 61 62 6c 65 73 3a 0a 20 2a 2f 0a 0a 23 64 65  tables:. */..#de
16740 66 69 6e 65 20 54 63 6c 5f 46 69 6e 64 48 61 73  fine Tcl_FindHas
16750 68 45 6e 74 72 79 28 74 61 62 6c 65 50 74 72 2c  hEntry(tablePtr,
16760 20 6b 65 79 29 20 5c 0a 09 28 2a 28 28 74 61 62   key) \..(*((tab
16770 6c 65 50 74 72 29 2d 3e 63 72 65 61 74 65 50 72  lePtr)->createPr
16780 6f 63 29 29 28 74 61 62 6c 65 50 74 72 2c 20 28  oc))(tablePtr, (
16790 63 6f 6e 73 74 20 63 68 61 72 20 2a 29 28 6b 65  const char *)(ke
167a0 79 29 2c 20 28 69 6e 74 20 2a 29 2d 31 29 0a 23  y), (int *)-1).#
167b0 64 65 66 69 6e 65 20 54 63 6c 5f 41 74 74 65 6d  define Tcl_Attem
167c0 70 74 43 72 65 61 74 65 48 61 73 68 45 6e 74 72  ptCreateHashEntr
167d0 79 28 74 61 62 6c 65 50 74 72 2c 20 6b 65 79 2c  y(tablePtr, key,
167e0 20 6e 65 77 50 74 72 29 20 5c 0a 09 28 2a 28 28   newPtr) \..(*((
167f0 74 61 62 6c 65 50 74 72 29 2d 3e 63 72 65 61 74  tablePtr)->creat
16800 65 50 72 6f 63 29 29 28 74 61 62 6c 65 50 74 72  eProc))(tablePtr
16810 2c 20 28 63 6f 6e 73 74 20 63 68 61 72 20 2a 29  , (const char *)
16820 28 6b 65 79 29 2c 20 6e 65 77 50 74 72 29 0a 23  (key), newPtr).#
16830 69 66 64 65 66 20 54 43 4c 5f 4d 45 4d 5f 44 45  ifdef TCL_MEM_DE
16840 42 55 47 0a 23 75 6e 64 65 66 20 54 63 6c 5f 43  BUG.#undef Tcl_C
16850 72 65 61 74 65 48 61 73 68 45 6e 74 72 79 0a 23  reateHashEntry.#
16860 64 65 66 69 6e 65 20 54 63 6c 5f 43 72 65 61 74  define Tcl_Creat
16870 65 48 61 73 68 45 6e 74 72 79 28 74 61 62 6c 65  eHashEntry(table
16880 50 74 72 2c 20 6b 65 79 2c 20 6e 65 77 50 74 72  Ptr, key, newPtr
16890 29 20 5c 0a 09 09 54 63 6c 5f 44 62 43 72 65 61  ) \...Tcl_DbCrea
168a0 74 65 48 61 73 68 45 6e 74 72 79 28 74 61 62 6c  teHashEntry(tabl
168b0 65 50 74 72 2c 20 6b 65 79 2c 20 6e 65 77 50 74  ePtr, key, newPt
168c0 72 2c 20 5f 5f 46 49 4c 45 5f 5f 2c 20 5f 5f 4c  r, __FILE__, __L
168d0 49 4e 45 5f 5f 29 0a 23 65 6e 64 69 66 0a 0a 23  INE__).#endif..#
168e0 65 6e 64 69 66 20 2f 2a 20 52 43 5f 49 4e 56 4f  endif /* RC_INVO
168f0 4b 45 44 20 2a 2f 0a 0a 2f 2a 0a 20 2a 20 65 6e  KED */../*. * en
16900 64 20 62 6c 6f 63 6b 20 66 6f 72 20 43 2b 2b 0a  d block for C++.
16910 20 2a 2f 0a 0a 23 69 66 64 65 66 20 5f 5f 63 70   */..#ifdef __cp
16920 6c 75 73 70 6c 75 73 0a 7d 0a 23 65 6e 64 69 66  lusplus.}.#endif
16930 0a 0a 23 65 6e 64 69 66 20 2f 2a 20 5f 54 43 4c  ..#endif /* _TCL
16940 20 2a 2f 0a 0c 0a 2f 2a 0a 20 2a 20 4c 6f 63 61   */.../*. * Loca
16950 6c 20 56 61 72 69 61 62 6c 65 73 3a 0a 20 2a 20  l Variables:. * 
16960 6d 6f 64 65 3a 20 63 0a 20 2a 20 63 2d 62 61 73  mode: c. * c-bas
16970 69 63 2d 6f 66 66 73 65 74 3a 20 34 0a 20 2a 20  ic-offset: 4. * 
16980 66 69 6c 6c 2d 63 6f 6c 75 6d 6e 3a 20 37 38 0a  fill-column: 78.
16990 20 2a 20 45 6e 64 3a 0a 20 2a 2f 0a               * End:. */.