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 45 58 50 52 e TCL_SUBST_EXPR
3fd0: 09 09 30 31 30 0a 23 64 65 66 69 6e 65 20 54 43 ..010.#define TC
3fe0: 4c 5f 53 55 42 53 54 5f 41 4c 4c 09 09 30 31 37 L_SUBST_ALL..017
3ff0: 0a 0a 2f 2a 0a 20 2a 20 46 6f 72 77 61 72 64 20 ../*. * Forward
4000: 64 65 63 6c 61 72 61 74 69 6f 6e 20 6f 66 20 54 declaration of T
4010: 63 6c 5f 4f 62 6a 20 74 6f 20 70 72 65 76 65 6e cl_Obj to preven
4020: 74 20 61 6e 20 65 72 72 6f 72 20 77 68 65 6e 20 t an error when
4030: 74 68 65 20 66 6f 72 77 61 72 64 0a 20 2a 20 72 the forward. * r
4040: 65 66 65 72 65 6e 63 65 20 74 6f 20 54 63 6c 5f eference to Tcl_
4050: 4f 62 6a 20 69 73 20 65 6e 63 6f 75 6e 74 65 72 Obj is encounter
4060: 65 64 20 69 6e 20 74 68 65 20 66 75 6e 63 74 69 ed in the functi
4070: 6f 6e 20 74 79 70 65 73 20 64 65 63 6c 61 72 65 on types declare
4080: 64 20 62 65 6c 6f 77 2e 0a 20 2a 2f 0a 0a 73 74 d below.. */..st
4090: 72 75 63 74 20 54 63 6c 5f 4f 62 6a 3b 0a 0a 2f ruct Tcl_Obj;../
40a0: 2a 0a 20 2a 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 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
40e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
40f0: 0a 20 2a 20 46 75 6e 63 74 69 6f 6e 20 74 79 70 . * Function typ
4100: 65 73 20 64 65 66 69 6e 65 64 20 62 79 20 54 63 es defined by Tc
4110: 6c 3a 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 l:. */..typedef
4120: 69 6e 74 20 28 54 63 6c 5f 41 70 70 49 6e 69 74 int (Tcl_AppInit
4130: 50 72 6f 63 29 20 28 54 63 6c 5f 49 6e 74 65 72 Proc) (Tcl_Inter
4140: 70 20 2a 69 6e 74 65 72 70 29 3b 0a 74 79 70 65 p *interp);.type
4150: 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 41 73 79 def int (Tcl_Asy
4160: 6e 63 50 72 6f 63 29 20 28 76 6f 69 64 20 2a 63 ncProc) (void *c
4170: 6c 69 65 6e 74 44 61 74 61 2c 20 54 63 6c 5f 49 lientData, Tcl_I
4180: 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c 0a 09 nterp *interp,..
4190: 69 6e 74 20 63 6f 64 65 29 3b 0a 74 79 70 65 64 int code);.typed
41a0: 65 66 20 76 6f 69 64 20 28 54 63 6c 5f 43 68 61 ef void (Tcl_Cha
41b0: 6e 6e 65 6c 50 72 6f 63 29 20 28 76 6f 69 64 20 nnelProc) (void
41c0: 2a 63 6c 69 65 6e 74 44 61 74 61 2c 20 69 6e 74 *clientData, int
41d0: 20 6d 61 73 6b 29 3b 0a 74 79 70 65 64 65 66 20 mask);.typedef
41e0: 76 6f 69 64 20 28 54 63 6c 5f 43 6c 6f 73 65 50 void (Tcl_CloseP
41f0: 72 6f 63 29 20 28 76 6f 69 64 20 2a 64 61 74 61 roc) (void *data
4200: 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 64 20 );.typedef void
4210: 28 54 63 6c 5f 43 6d 64 44 65 6c 65 74 65 50 72 (Tcl_CmdDeletePr
4220: 6f 63 29 20 28 76 6f 69 64 20 2a 63 6c 69 65 6e oc) (void *clien
4230: 74 44 61 74 61 29 3b 0a 74 79 70 65 64 65 66 20 tData);.typedef
4240: 69 6e 74 20 28 54 63 6c 5f 43 6d 64 50 72 6f 63 int (Tcl_CmdProc
4250: 29 20 28 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 ) (void *clientD
4260: 61 74 61 2c 20 54 63 6c 5f 49 6e 74 65 72 70 20 ata, Tcl_Interp
4270: 2a 69 6e 74 65 72 70 2c 0a 09 69 6e 74 20 61 72 *interp,..int ar
4280: 67 63 2c 20 63 6f 6e 73 74 20 63 68 61 72 20 2a gc, const char *
4290: 2a 61 72 67 76 29 3b 0a 23 69 66 6e 64 65 66 20 *argv);.#ifndef
42a0: 54 43 4c 5f 4e 4f 5f 44 45 50 52 45 43 41 54 45 TCL_NO_DEPRECATE
42b0: 44 0a 74 79 70 65 64 65 66 20 76 6f 69 64 20 28 D.typedef void (
42c0: 54 63 6c 5f 43 6d 64 54 72 61 63 65 50 72 6f 63 Tcl_CmdTraceProc
42d0: 29 20 28 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 ) (void *clientD
42e0: 61 74 61 2c 20 54 63 6c 5f 49 6e 74 65 72 70 20 ata, Tcl_Interp
42f0: 2a 69 6e 74 65 72 70 2c 0a 09 69 6e 74 20 6c 65 *interp,..int le
4300: 76 65 6c 2c 20 63 68 61 72 20 2a 63 6f 6d 6d 61 vel, char *comma
4310: 6e 64 2c 20 54 63 6c 5f 43 6d 64 50 72 6f 63 20 nd, Tcl_CmdProc
4320: 2a 70 72 6f 63 2c 0a 09 76 6f 69 64 20 2a 63 6d *proc,..void *cm
4330: 64 43 6c 69 65 6e 74 44 61 74 61 2c 20 69 6e 74 dClientData, int
4340: 20 61 72 67 63 2c 20 63 6f 6e 73 74 20 63 68 61 argc, const cha
4350: 72 20 2a 2a 61 72 67 76 29 3b 0a 74 79 70 65 64 r **argv);.typed
4360: 65 66 20 69 6e 74 20 28 54 63 6c 5f 43 6d 64 4f ef int (Tcl_CmdO
4370: 62 6a 54 72 61 63 65 50 72 6f 63 29 20 28 76 6f bjTraceProc) (vo
4380: 69 64 20 2a 63 6c 69 65 6e 74 44 61 74 61 2c 20 id *clientData,
4390: 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 Tcl_Interp *inte
43a0: 72 70 2c 0a 09 69 6e 74 20 6c 65 76 65 6c 2c 20 rp,..int level,
43b0: 63 6f 6e 73 74 20 63 68 61 72 20 2a 63 6f 6d 6d const char *comm
43c0: 61 6e 64 2c 20 54 63 6c 5f 43 6f 6d 6d 61 6e 64 and, Tcl_Command
43d0: 20 63 6f 6d 6d 61 6e 64 49 6e 66 6f 2c 20 69 6e commandInfo, in
43e0: 74 20 6f 62 6a 63 2c 0a 09 73 74 72 75 63 74 20 t objc,..struct
43f0: 54 63 6c 5f 4f 62 6a 20 2a 63 6f 6e 73 74 20 2a Tcl_Obj *const *
4400: 6f 62 6a 76 29 3b 0a 23 65 6e 64 69 66 20 2f 2a objv);.#endif /*
4410: 20 54 43 4c 5f 4e 4f 5f 44 45 50 52 45 43 41 54 TCL_NO_DEPRECAT
4420: 45 44 20 2a 2f 0a 74 79 70 65 64 65 66 20 76 6f ED */.typedef vo
4430: 69 64 20 28 54 63 6c 5f 43 6d 64 4f 62 6a 54 72 id (Tcl_CmdObjTr
4440: 61 63 65 44 65 6c 65 74 65 50 72 6f 63 29 20 28 aceDeleteProc) (
4450: 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 61 74 61 void *clientData
4460: 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 64 20 );.typedef void
4470: 28 54 63 6c 5f 44 75 70 49 6e 74 65 72 6e 61 6c (Tcl_DupInternal
4480: 52 65 70 50 72 6f 63 29 20 28 73 74 72 75 63 74 RepProc) (struct
4490: 20 54 63 6c 5f 4f 62 6a 20 2a 73 72 63 50 74 72 Tcl_Obj *srcPtr
44a0: 2c 0a 09 73 74 72 75 63 74 20 54 63 6c 5f 4f 62 ,..struct Tcl_Ob
44b0: 6a 20 2a 64 75 70 50 74 72 29 3b 0a 74 79 70 65 j *dupPtr);.type
44c0: 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 45 6e 63 def int (Tcl_Enc
44d0: 6f 64 69 6e 67 43 6f 6e 76 65 72 74 50 72 6f 63 odingConvertProc
44e0: 29 20 28 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 ) (void *clientD
44f0: 61 74 61 2c 20 63 6f 6e 73 74 20 63 68 61 72 20 ata, const char
4500: 2a 73 72 63 2c 0a 09 69 6e 74 20 73 72 63 4c 65 *src,..int srcLe
4510: 6e 2c 20 69 6e 74 20 66 6c 61 67 73 2c 20 54 63 n, int flags, Tc
4520: 6c 5f 45 6e 63 6f 64 69 6e 67 53 74 61 74 65 20 l_EncodingState
4530: 2a 73 74 61 74 65 50 74 72 2c 20 63 68 61 72 20 *statePtr, char
4540: 2a 64 73 74 2c 0a 09 69 6e 74 20 64 73 74 4c 65 *dst,..int dstLe
4550: 6e 2c 20 69 6e 74 20 2a 73 72 63 52 65 61 64 50 n, int *srcReadP
4560: 74 72 2c 20 69 6e 74 20 2a 64 73 74 57 72 6f 74 tr, int *dstWrot
4570: 65 50 74 72 2c 20 69 6e 74 20 2a 64 73 74 43 68 ePtr, int *dstCh
4580: 61 72 73 50 74 72 29 3b 0a 74 79 70 65 64 65 66 arsPtr);.typedef
4590: 20 76 6f 69 64 20 28 54 63 6c 5f 45 6e 63 6f 64 void (Tcl_Encod
45a0: 69 6e 67 46 72 65 65 50 72 6f 63 29 20 28 76 6f ingFreeProc) (vo
45b0: 69 64 20 2a 63 6c 69 65 6e 74 44 61 74 61 29 3b id *clientData);
45c0: 0a 74 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 .typedef int (Tc
45d0: 6c 5f 45 76 65 6e 74 50 72 6f 63 29 20 28 54 63 l_EventProc) (Tc
45e0: 6c 5f 45 76 65 6e 74 20 2a 65 76 50 74 72 2c 20 l_Event *evPtr,
45f0: 69 6e 74 20 66 6c 61 67 73 29 3b 0a 74 79 70 65 int flags);.type
4600: 64 65 66 20 76 6f 69 64 20 28 54 63 6c 5f 45 76 def void (Tcl_Ev
4610: 65 6e 74 43 68 65 63 6b 50 72 6f 63 29 20 28 76 entCheckProc) (v
4620: 6f 69 64 20 2a 63 6c 69 65 6e 74 44 61 74 61 2c oid *clientData,
4630: 20 69 6e 74 20 66 6c 61 67 73 29 3b 0a 74 79 70 int flags);.typ
4640: 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 45 76 edef int (Tcl_Ev
4650: 65 6e 74 44 65 6c 65 74 65 50 72 6f 63 29 20 28 entDeleteProc) (
4660: 54 63 6c 5f 45 76 65 6e 74 20 2a 65 76 50 74 72 Tcl_Event *evPtr
4670: 2c 20 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 61 , void *clientDa
4680: 74 61 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 ta);.typedef voi
4690: 64 20 28 54 63 6c 5f 45 76 65 6e 74 53 65 74 75 d (Tcl_EventSetu
46a0: 70 50 72 6f 63 29 20 28 76 6f 69 64 20 2a 63 6c pProc) (void *cl
46b0: 69 65 6e 74 44 61 74 61 2c 20 69 6e 74 20 66 6c ientData, int fl
46c0: 61 67 73 29 3b 0a 74 79 70 65 64 65 66 20 76 6f ags);.typedef vo
46d0: 69 64 20 28 54 63 6c 5f 45 78 69 74 50 72 6f 63 id (Tcl_ExitProc
46e0: 29 20 28 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 ) (void *clientD
46f0: 61 74 61 29 3b 0a 74 79 70 65 64 65 66 20 76 6f ata);.typedef vo
4700: 69 64 20 28 54 63 6c 5f 46 69 6c 65 50 72 6f 63 id (Tcl_FileProc
4710: 29 20 28 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 ) (void *clientD
4720: 61 74 61 2c 20 69 6e 74 20 6d 61 73 6b 29 3b 0a ata, int mask);.
4730: 74 79 70 65 64 65 66 20 76 6f 69 64 20 28 54 63 typedef void (Tc
4740: 6c 5f 46 69 6c 65 46 72 65 65 50 72 6f 63 29 20 l_FileFreeProc)
4750: 28 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 61 74 (void *clientDat
4760: 61 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 64 a);.typedef void
4770: 20 28 54 63 6c 5f 46 72 65 65 49 6e 74 65 72 6e (Tcl_FreeIntern
4780: 61 6c 52 65 70 50 72 6f 63 29 20 28 73 74 72 75 alRepProc) (stru
4790: 63 74 20 54 63 6c 5f 4f 62 6a 20 2a 6f 62 6a 50 ct Tcl_Obj *objP
47a0: 74 72 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 tr);.typedef voi
47b0: 64 20 28 54 63 6c 5f 49 64 6c 65 50 72 6f 63 29 d (Tcl_IdleProc)
47c0: 20 28 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 61 (void *clientDa
47d0: 74 61 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 ta);.typedef voi
47e0: 64 20 28 54 63 6c 5f 49 6e 74 65 72 70 44 65 6c d (Tcl_InterpDel
47f0: 65 74 65 50 72 6f 63 29 20 28 76 6f 69 64 20 2a eteProc) (void *
4800: 63 6c 69 65 6e 74 44 61 74 61 2c 0a 09 54 63 6c clientData,..Tcl
4810: 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 29 _Interp *interp)
4820: 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 64 20 28 ;.typedef void (
4830: 54 63 6c 5f 4e 61 6d 65 73 70 61 63 65 44 65 6c Tcl_NamespaceDel
4840: 65 74 65 50 72 6f 63 29 20 28 76 6f 69 64 20 2a eteProc) (void *
4850: 63 6c 69 65 6e 74 44 61 74 61 29 3b 0a 23 69 66 clientData);.#if
4860: 20 21 64 65 66 69 6e 65 64 28 54 43 4c 5f 4e 4f !defined(TCL_NO
4870: 5f 44 45 50 52 45 43 41 54 45 44 29 20 7c 7c 20 _DEPRECATED) ||
4880: 21 64 65 66 69 6e 65 64 28 42 55 49 4c 44 5f 74 !defined(BUILD_t
4890: 63 6c 29 0a 74 79 70 65 64 65 66 20 69 6e 74 20 cl).typedef int
48a0: 28 54 63 6c 5f 4f 62 6a 43 6d 64 50 72 6f 63 29 (Tcl_ObjCmdProc)
48b0: 20 28 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 61 (void *clientDa
48c0: 74 61 2c 20 54 63 6c 5f 49 6e 74 65 72 70 20 2a ta, Tcl_Interp *
48d0: 69 6e 74 65 72 70 2c 0a 09 69 6e 74 20 6f 62 6a interp,..int obj
48e0: 63 2c 20 73 74 72 75 63 74 20 54 63 6c 5f 4f 62 c, struct Tcl_Ob
48f0: 6a 20 2a 63 6f 6e 73 74 20 2a 6f 62 6a 76 29 3b j *const *objv);
4900: 0a 23 65 6e 64 69 66 20 2f 2a 20 54 43 4c 5f 4e .#endif /* TCL_N
4910: 4f 5f 44 45 50 52 45 43 41 54 45 44 20 2a 2f 0a O_DEPRECATED */.
4920: 74 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c typedef int (Tcl
4930: 5f 4f 62 6a 43 6d 64 50 72 6f 63 32 29 20 28 76 _ObjCmdProc2) (v
4940: 6f 69 64 20 2a 63 6c 69 65 6e 74 44 61 74 61 2c oid *clientData,
4950: 20 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 Tcl_Interp *int
4960: 65 72 70 2c 0a 09 54 63 6c 5f 53 69 7a 65 20 6f erp,..Tcl_Size o
4970: 62 6a 63 2c 20 73 74 72 75 63 74 20 54 63 6c 5f bjc, struct Tcl_
4980: 4f 62 6a 20 2a 63 6f 6e 73 74 20 2a 6f 62 6a 76 Obj *const *objv
4990: 29 3b 0a 74 79 70 65 64 65 66 20 69 6e 74 20 28 );.typedef int (
49a0: 54 63 6c 5f 43 6d 64 4f 62 6a 54 72 61 63 65 50 Tcl_CmdObjTraceP
49b0: 72 6f 63 32 29 20 28 76 6f 69 64 20 2a 63 6c 69 roc2) (void *cli
49c0: 65 6e 74 44 61 74 61 2c 20 54 63 6c 5f 49 6e 74 entData, Tcl_Int
49d0: 65 72 70 20 2a 69 6e 74 65 72 70 2c 0a 09 54 63 erp *interp,..Tc
49e0: 6c 5f 53 69 7a 65 20 6c 65 76 65 6c 2c 20 63 6f l_Size level, co
49f0: 6e 73 74 20 63 68 61 72 20 2a 63 6f 6d 6d 61 6e nst char *comman
4a00: 64 2c 20 54 63 6c 5f 43 6f 6d 6d 61 6e 64 20 63 d, Tcl_Command c
4a10: 6f 6d 6d 61 6e 64 49 6e 66 6f 2c 20 54 63 6c 5f ommandInfo, Tcl_
4a20: 53 69 7a 65 20 6f 62 6a 63 2c 0a 09 73 74 72 75 Size objc,..stru
4a30: 63 74 20 54 63 6c 5f 4f 62 6a 20 2a 63 6f 6e 73 ct Tcl_Obj *cons
4a40: 74 20 2a 6f 62 6a 76 29 3b 0a 74 79 70 65 64 65 t *objv);.typede
4a50: 66 20 76 6f 69 64 20 28 54 63 6c 5f 46 72 65 65 f void (Tcl_Free
4a60: 50 72 6f 63 29 20 28 76 6f 69 64 20 2a 62 6c 6f Proc) (void *blo
4a70: 63 6b 50 74 72 29 3b 0a 23 64 65 66 69 6e 65 20 ckPtr);.#define
4a80: 54 63 6c 5f 45 78 69 74 50 72 6f 63 20 54 63 6c Tcl_ExitProc Tcl
4a90: 5f 46 72 65 65 50 72 6f 63 0a 23 64 65 66 69 6e _FreeProc.#defin
4aa0: 65 20 54 63 6c 5f 46 69 6c 65 46 72 65 65 50 72 e Tcl_FileFreePr
4ab0: 6f 63 20 54 63 6c 5f 46 72 65 65 50 72 6f 63 0a oc Tcl_FreeProc.
4ac0: 23 64 65 66 69 6e 65 20 54 63 6c 5f 46 69 6c 65 #define Tcl_File
4ad0: 46 72 65 65 50 72 6f 63 20 54 63 6c 5f 46 72 65 FreeProc Tcl_Fre
4ae0: 65 50 72 6f 63 0a 23 64 65 66 69 6e 65 20 54 63 eProc.#define Tc
4af0: 6c 5f 45 6e 63 6f 64 69 6e 67 46 72 65 65 50 72 l_EncodingFreePr
4b00: 6f 63 20 54 63 6c 5f 46 72 65 65 50 72 6f 63 0a oc Tcl_FreeProc.
4b10: 74 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c typedef int (Tcl
4b20: 5f 4c 69 62 72 61 72 79 49 6e 69 74 50 72 6f 63 _LibraryInitProc
4b30: 29 20 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 ) (Tcl_Interp *i
4b40: 6e 74 65 72 70 29 3b 0a 74 79 70 65 64 65 66 20 nterp);.typedef
4b50: 69 6e 74 20 28 54 63 6c 5f 4c 69 62 72 61 72 79 int (Tcl_Library
4b60: 55 6e 6c 6f 61 64 50 72 6f 63 29 20 28 54 63 6c UnloadProc) (Tcl
4b70: 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c _Interp *interp,
4b80: 20 69 6e 74 20 66 6c 61 67 73 29 3b 0a 74 79 70 int flags);.typ
4b90: 65 64 65 66 20 76 6f 69 64 20 28 54 63 6c 5f 50 edef void (Tcl_P
4ba0: 61 6e 69 63 50 72 6f 63 29 20 28 63 6f 6e 73 74 anicProc) (const
4bb0: 20 63 68 61 72 20 2a 66 6f 72 6d 61 74 2c 20 2e char *format, .
4bc0: 2e 2e 29 20 54 43 4c 5f 46 4f 52 4d 41 54 5f 50 ..) TCL_FORMAT_P
4bd0: 52 49 4e 54 46 28 31 2c 20 32 29 3b 0a 74 79 70 RINTF(1, 2);.typ
4be0: 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 50 6f edef int (Tcl_Po
4bf0: 73 74 49 6e 69 74 50 72 6f 63 29 20 28 54 63 6c stInitProc) (Tcl
4c00: 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c _Interp *interp,
4c10: 20 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 61 74 void *clientDat
4c20: 61 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 64 a);.typedef void
4c30: 20 28 54 63 6c 5f 54 63 70 41 63 63 65 70 74 50 (Tcl_TcpAcceptP
4c40: 72 6f 63 29 20 28 76 6f 69 64 20 2a 63 61 6c 6c roc) (void *call
4c50: 62 61 63 6b 44 61 74 61 2c 20 54 63 6c 5f 43 68 backData, Tcl_Ch
4c60: 61 6e 6e 65 6c 20 63 68 61 6e 2c 0a 09 63 68 61 annel chan,..cha
4c70: 72 20 2a 61 64 64 72 65 73 73 2c 20 69 6e 74 20 r *address, int
4c80: 70 6f 72 74 29 3b 0a 74 79 70 65 64 65 66 20 76 port);.typedef v
4c90: 6f 69 64 20 28 54 63 6c 5f 54 69 6d 65 72 50 72 oid (Tcl_TimerPr
4ca0: 6f 63 29 20 28 76 6f 69 64 20 2a 63 6c 69 65 6e oc) (void *clien
4cb0: 74 44 61 74 61 29 3b 0a 74 79 70 65 64 65 66 20 tData);.typedef
4cc0: 69 6e 74 20 28 54 63 6c 5f 53 65 74 46 72 6f 6d int (Tcl_SetFrom
4cd0: 41 6e 79 50 72 6f 63 29 20 28 54 63 6c 5f 49 6e AnyProc) (Tcl_In
4ce0: 74 65 72 70 20 2a 69 6e 74 65 72 70 2c 20 73 74 terp *interp, st
4cf0: 72 75 63 74 20 54 63 6c 5f 4f 62 6a 20 2a 6f 62 ruct Tcl_Obj *ob
4d00: 6a 50 74 72 29 3b 0a 74 79 70 65 64 65 66 20 76 jPtr);.typedef v
4d10: 6f 69 64 20 28 54 63 6c 5f 55 70 64 61 74 65 53 oid (Tcl_UpdateS
4d20: 74 72 69 6e 67 50 72 6f 63 29 20 28 73 74 72 75 tringProc) (stru
4d30: 63 74 20 54 63 6c 5f 4f 62 6a 20 2a 6f 62 6a 50 ct Tcl_Obj *objP
4d40: 74 72 29 3b 0a 74 79 70 65 64 65 66 20 63 68 61 tr);.typedef cha
4d50: 72 20 2a 20 28 54 63 6c 5f 56 61 72 54 72 61 63 r * (Tcl_VarTrac
4d60: 65 50 72 6f 63 29 20 28 76 6f 69 64 20 2a 63 6c eProc) (void *cl
4d70: 69 65 6e 74 44 61 74 61 2c 20 54 63 6c 5f 49 6e ientData, Tcl_In
4d80: 74 65 72 70 20 2a 69 6e 74 65 72 70 2c 0a 09 63 terp *interp,..c
4d90: 6f 6e 73 74 20 63 68 61 72 20 2a 70 61 72 74 31 onst char *part1
4da0: 2c 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 70 61 , const char *pa
4db0: 72 74 32 2c 20 69 6e 74 20 66 6c 61 67 73 29 3b rt2, int flags);
4dc0: 0a 74 79 70 65 64 65 66 20 76 6f 69 64 20 28 54 .typedef void (T
4dd0: 63 6c 5f 43 6f 6d 6d 61 6e 64 54 72 61 63 65 50 cl_CommandTraceP
4de0: 72 6f 63 29 20 28 76 6f 69 64 20 2a 63 6c 69 65 roc) (void *clie
4df0: 6e 74 44 61 74 61 2c 20 54 63 6c 5f 49 6e 74 65 ntData, Tcl_Inte
4e00: 72 70 20 2a 69 6e 74 65 72 70 2c 0a 09 63 6f 6e rp *interp,..con
4e10: 73 74 20 63 68 61 72 20 2a 6f 6c 64 4e 61 6d 65 st char *oldName
4e20: 2c 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 6e 65 , const char *ne
4e30: 77 4e 61 6d 65 2c 20 69 6e 74 20 66 6c 61 67 73 wName, int flags
4e40: 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 64 20 );.typedef void
4e50: 28 54 63 6c 5f 43 72 65 61 74 65 46 69 6c 65 48 (Tcl_CreateFileH
4e60: 61 6e 64 6c 65 72 50 72 6f 63 29 20 28 69 6e 74 andlerProc) (int
4e70: 20 66 64 2c 20 69 6e 74 20 6d 61 73 6b 2c 20 54 fd, int mask, T
4e80: 63 6c 5f 46 69 6c 65 50 72 6f 63 20 2a 70 72 6f cl_FileProc *pro
4e90: 63 2c 0a 09 76 6f 69 64 20 2a 63 6c 69 65 6e 74 c,..void *client
4ea0: 44 61 74 61 29 3b 0a 74 79 70 65 64 65 66 20 76 Data);.typedef v
4eb0: 6f 69 64 20 28 54 63 6c 5f 44 65 6c 65 74 65 46 oid (Tcl_DeleteF
4ec0: 69 6c 65 48 61 6e 64 6c 65 72 50 72 6f 63 29 20 ileHandlerProc)
4ed0: 28 69 6e 74 20 66 64 29 3b 0a 74 79 70 65 64 65 (int fd);.typede
4ee0: 66 20 76 6f 69 64 20 28 54 63 6c 5f 41 6c 65 72 f void (Tcl_Aler
4ef0: 74 4e 6f 74 69 66 69 65 72 50 72 6f 63 29 20 28 tNotifierProc) (
4f00: 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 61 74 61 void *clientData
4f10: 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 64 20 );.typedef void
4f20: 28 54 63 6c 5f 53 65 72 76 69 63 65 4d 6f 64 65 (Tcl_ServiceMode
4f30: 48 6f 6f 6b 50 72 6f 63 29 20 28 69 6e 74 20 6d HookProc) (int m
4f40: 6f 64 65 29 3b 0a 74 79 70 65 64 65 66 20 76 6f ode);.typedef vo
4f50: 69 64 20 2a 28 54 63 6c 5f 49 6e 69 74 4e 6f 74 id *(Tcl_InitNot
4f60: 69 66 69 65 72 50 72 6f 63 29 20 28 76 6f 69 64 ifierProc) (void
4f70: 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 64 20 );.typedef void
4f80: 28 54 63 6c 5f 46 69 6e 61 6c 69 7a 65 4e 6f 74 (Tcl_FinalizeNot
4f90: 69 66 69 65 72 50 72 6f 63 29 20 28 76 6f 69 64 ifierProc) (void
4fa0: 20 2a 63 6c 69 65 6e 74 44 61 74 61 29 3b 0a 74 *clientData);.t
4fb0: 79 70 65 64 65 66 20 76 6f 69 64 20 28 54 63 6c ypedef void (Tcl
4fc0: 5f 4d 61 69 6e 4c 6f 6f 70 50 72 6f 63 29 20 28 _MainLoopProc) (
4fd0: 76 6f 69 64 29 3b 0a 0c 0a 2f 2a 20 41 62 73 74 void);.../* Abst
4fe0: 72 61 63 74 20 4c 69 73 74 20 66 75 6e 63 74 69 ract List functi
4ff0: 6f 6e 73 20 2a 2f 0a 74 79 70 65 64 65 66 20 54 ons */.typedef T
5000: 63 6c 5f 53 69 7a 65 20 28 54 63 6c 5f 4f 62 6a cl_Size (Tcl_Obj
5010: 54 79 70 65 4c 65 6e 67 74 68 50 72 6f 63 29 20 TypeLengthProc)
5020: 28 73 74 72 75 63 74 20 54 63 6c 5f 4f 62 6a 20 (struct Tcl_Obj
5030: 2a 6c 69 73 74 50 74 72 29 3b 0a 74 79 70 65 64 *listPtr);.typed
5040: 65 66 20 69 6e 74 20 28 54 63 6c 5f 4f 62 6a 54 ef int (Tcl_ObjT
5050: 79 70 65 49 6e 64 65 78 50 72 6f 63 29 20 28 54 ypeIndexProc) (T
5060: 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 cl_Interp *inter
5070: 70 2c 20 73 74 72 75 63 74 20 54 63 6c 5f 4f 62 p, struct Tcl_Ob
5080: 6a 20 2a 6c 69 73 74 50 74 72 2c 0a 09 54 63 6c j *listPtr,..Tcl
5090: 5f 53 69 7a 65 20 69 6e 64 65 78 2c 20 73 74 72 _Size index, str
50a0: 75 63 74 20 54 63 6c 5f 4f 62 6a 20 2a 2a 65 6c uct Tcl_Obj **el
50b0: 65 6d 4f 62 6a 29 3b 0a 74 79 70 65 64 65 66 20 emObj);.typedef
50c0: 69 6e 74 20 28 54 63 6c 5f 4f 62 6a 54 79 70 65 int (Tcl_ObjType
50d0: 53 6c 69 63 65 50 72 6f 63 29 20 28 54 63 6c 5f SliceProc) (Tcl_
50e0: 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c 20 Interp *interp,
50f0: 73 74 72 75 63 74 20 54 63 6c 5f 4f 62 6a 20 2a struct Tcl_Obj *
5100: 6c 69 73 74 50 74 72 2c 0a 09 54 63 6c 5f 53 69 listPtr,..Tcl_Si
5110: 7a 65 20 66 72 6f 6d 49 64 78 2c 20 54 63 6c 5f ze fromIdx, Tcl_
5120: 53 69 7a 65 20 74 6f 49 64 78 2c 20 73 74 72 75 Size toIdx, stru
5130: 63 74 20 54 63 6c 5f 4f 62 6a 20 2a 2a 6e 65 77 ct Tcl_Obj **new
5140: 4f 62 6a 50 74 72 29 3b 0a 74 79 70 65 64 65 66 ObjPtr);.typedef
5150: 20 69 6e 74 20 28 54 63 6c 5f 4f 62 6a 54 79 70 int (Tcl_ObjTyp
5160: 65 52 65 76 65 72 73 65 50 72 6f 63 29 20 28 54 eReverseProc) (T
5170: 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 cl_Interp *inter
5180: 70 2c 0a 09 73 74 72 75 63 74 20 54 63 6c 5f 4f p,..struct Tcl_O
5190: 62 6a 20 2a 6c 69 73 74 50 74 72 2c 20 73 74 72 bj *listPtr, str
51a0: 75 63 74 20 54 63 6c 5f 4f 62 6a 20 2a 2a 6e 65 uct Tcl_Obj **ne
51b0: 77 4f 62 6a 50 74 72 29 3b 0a 74 79 70 65 64 65 wObjPtr);.typede
51c0: 66 20 69 6e 74 20 28 54 63 6c 5f 4f 62 6a 54 79 f int (Tcl_ObjTy
51d0: 70 65 47 65 74 45 6c 65 6d 65 6e 74 73 29 20 28 peGetElements) (
51e0: 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 Tcl_Interp *inte
51f0: 72 70 2c 0a 09 73 74 72 75 63 74 20 54 63 6c 5f rp,..struct Tcl_
5200: 4f 62 6a 20 2a 6c 69 73 74 50 74 72 2c 20 54 63 Obj *listPtr, Tc
5210: 6c 5f 53 69 7a 65 20 2a 6f 62 6a 63 70 74 72 2c l_Size *objcptr,
5220: 20 73 74 72 75 63 74 20 54 63 6c 5f 4f 62 6a 20 struct Tcl_Obj
5230: 2a 2a 2a 6f 62 6a 76 70 74 72 29 3b 0a 74 79 70 ***objvptr);.typ
5240: 65 64 65 66 20 73 74 72 75 63 74 20 54 63 6c 5f edef struct Tcl_
5250: 4f 62 6a 20 2a 28 54 63 6c 5f 4f 62 6a 54 79 70 Obj *(Tcl_ObjTyp
5260: 65 53 65 74 45 6c 65 6d 65 6e 74 29 20 28 54 63 eSetElement) (Tc
5270: 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 l_Interp *interp
5280: 2c 0a 09 73 74 72 75 63 74 20 54 63 6c 5f 4f 62 ,..struct Tcl_Ob
5290: 6a 20 2a 6c 69 73 74 50 74 72 2c 20 54 63 6c 5f j *listPtr, Tcl_
52a0: 53 69 7a 65 20 69 6e 64 65 78 43 6f 75 6e 74 2c Size indexCount,
52b0: 0a 09 73 74 72 75 63 74 20 54 63 6c 5f 4f 62 6a ..struct Tcl_Obj
52c0: 20 2a 63 6f 6e 73 74 20 69 6e 64 65 78 41 72 72 *const indexArr
52d0: 61 79 5b 5d 2c 20 73 74 72 75 63 74 20 54 63 6c ay[], struct Tcl
52e0: 5f 4f 62 6a 20 2a 76 61 6c 75 65 4f 62 6a 29 3b _Obj *valueObj);
52f0: 0a 74 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 .typedef int (Tc
5300: 6c 5f 4f 62 6a 54 79 70 65 52 65 70 6c 61 63 65 l_ObjTypeReplace
5310: 50 72 6f 63 29 20 28 54 63 6c 5f 49 6e 74 65 72 Proc) (Tcl_Inter
5320: 70 20 2a 69 6e 74 65 72 70 2c 0a 09 73 74 72 75 p *interp,..stru
5330: 63 74 20 54 63 6c 5f 4f 62 6a 20 2a 6c 69 73 74 ct Tcl_Obj *list
5340: 4f 62 6a 2c 20 54 63 6c 5f 53 69 7a 65 20 66 69 Obj, Tcl_Size fi
5350: 72 73 74 2c 20 54 63 6c 5f 53 69 7a 65 20 6e 75 rst, Tcl_Size nu
5360: 6d 54 6f 44 65 6c 65 74 65 2c 0a 09 54 63 6c 5f mToDelete,..Tcl_
5370: 53 69 7a 65 20 6e 75 6d 54 6f 49 6e 73 65 72 74 Size numToInsert
5380: 2c 20 73 74 72 75 63 74 20 54 63 6c 5f 4f 62 6a , struct Tcl_Obj
5390: 20 2a 63 6f 6e 73 74 20 69 6e 73 65 72 74 4f 62 *const insertOb
53a0: 6a 73 5b 5d 29 3b 0a 74 79 70 65 64 65 66 20 69 js[]);.typedef i
53b0: 6e 74 20 28 54 63 6c 5f 4f 62 6a 54 79 70 65 49 nt (Tcl_ObjTypeI
53c0: 6e 4f 70 65 72 61 74 6f 72 50 72 6f 63 29 20 28 nOperatorProc) (
53d0: 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 Tcl_Interp *inte
53e0: 72 70 2c 0a 09 73 74 72 75 63 74 20 54 63 6c 5f rp,..struct Tcl_
53f0: 4f 62 6a 20 2a 76 61 6c 75 65 4f 62 6a 2c 20 73 Obj *valueObj, s
5400: 74 72 75 63 74 20 54 63 6c 5f 4f 62 6a 20 2a 6c truct Tcl_Obj *l
5410: 69 73 74 4f 62 6a 2c 20 69 6e 74 20 2a 62 6f 6f istObj, int *boo
5420: 6c 52 65 73 75 6c 74 29 3b 0a 0a 23 69 66 6e 64 lResult);..#ifnd
5430: 65 66 20 54 43 4c 5f 4e 4f 5f 44 45 50 52 45 43 ef TCL_NO_DEPREC
5440: 41 54 45 44 0a 23 20 20 20 64 65 66 69 6e 65 20 ATED.# define
5450: 54 63 6c 5f 50 61 63 6b 61 67 65 49 6e 69 74 50 Tcl_PackageInitP
5460: 72 6f 63 20 54 63 6c 5f 4c 69 62 72 61 72 79 49 roc Tcl_LibraryI
5470: 6e 69 74 50 72 6f 63 0a 23 20 20 20 64 65 66 69 nitProc.# defi
5480: 6e 65 20 54 63 6c 5f 50 61 63 6b 61 67 65 55 6e ne Tcl_PackageUn
5490: 6c 6f 61 64 50 72 6f 63 20 54 63 6c 5f 4c 69 62 loadProc Tcl_Lib
54a0: 72 61 72 79 55 6e 6c 6f 61 64 50 72 6f 63 0a 23 raryUnloadProc.#
54b0: 65 6e 64 69 66 0a 0a 2f 2a 0a 20 2a 2d 2d 2d 2d endif../*. *----
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 2d 2d 2d 2d ----------------
54f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
5500: 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 54 68 65 20 --------. * The
5510: 66 6f 6c 6c 6f 77 69 6e 67 20 73 74 72 75 63 74 following struct
5520: 75 72 65 20 72 65 70 72 65 73 65 6e 74 73 20 61 ure represents a
5530: 20 74 79 70 65 20 6f 66 20 6f 62 6a 65 63 74 2c type of object,
5540: 20 77 68 69 63 68 20 69 73 20 61 20 70 61 72 74 which is a part
5550: 69 63 75 6c 61 72 0a 20 2a 20 69 6e 74 65 72 6e icular. * intern
5560: 61 6c 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f al representatio
5570: 6e 20 66 6f 72 20 61 6e 20 6f 62 6a 65 63 74 20 n for an object
5580: 70 6c 75 73 20 61 20 73 65 74 20 6f 66 20 66 75 plus a set of fu
5590: 6e 63 74 69 6f 6e 73 20 74 68 61 74 20 70 72 6f nctions that pro
55a0: 76 69 64 65 0a 20 2a 20 73 74 61 6e 64 61 72 64 vide. * standard
55b0: 20 6f 70 65 72 61 74 69 6f 6e 73 20 6f 6e 20 6f operations on o
55c0: 62 6a 65 63 74 73 20 6f 66 20 74 68 61 74 20 74 bjects of that t
55d0: 79 70 65 2e 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 ype.. */..typede
55e0: 66 20 73 74 72 75 63 74 20 54 63 6c 5f 4f 62 6a f struct Tcl_Obj
55f0: 54 79 70 65 20 7b 0a 20 20 20 20 63 6f 6e 73 74 Type {. const
5600: 20 63 68 61 72 20 2a 6e 61 6d 65 3b 09 09 2f 2a char *name;../*
5610: 20 4e 61 6d 65 20 6f 66 20 74 68 65 20 74 79 70 Name of the typ
5620: 65 2c 20 65 2e 67 2e 20 22 69 6e 74 22 2e 20 2a e, e.g. "int". *
5630: 2f 0a 20 20 20 20 54 63 6c 5f 46 72 65 65 49 6e /. Tcl_FreeIn
5640: 74 65 72 6e 61 6c 52 65 70 50 72 6f 63 20 2a 66 ternalRepProc *f
5650: 72 65 65 49 6e 74 52 65 70 50 72 6f 63 3b 0a 09 reeIntRepProc;..
5660: 09 09 09 2f 2a 20 43 61 6c 6c 65 64 20 74 6f 20 .../* Called to
5670: 66 72 65 65 20 61 6e 79 20 73 74 6f 72 61 67 65 free any storage
5680: 20 66 6f 72 20 74 68 65 20 74 79 70 65 27 73 0a for the type's.
5690: 09 09 09 09 20 2a 20 69 6e 74 65 72 6e 61 6c 20 .... * internal
56a0: 72 65 70 2e 20 4e 55 4c 4c 20 69 66 20 74 68 65 rep. NULL if the
56b0: 20 69 6e 74 65 72 6e 61 6c 20 72 65 70 20 64 6f internal rep do
56c0: 65 73 0a 09 09 09 09 20 2a 20 6e 6f 74 20 6e 65 es..... * not ne
56d0: 65 64 20 66 72 65 65 69 6e 67 2e 20 2a 2f 0a 20 ed freeing. */.
56e0: 20 20 20 54 63 6c 5f 44 75 70 49 6e 74 65 72 6e Tcl_DupIntern
56f0: 61 6c 52 65 70 50 72 6f 63 20 2a 64 75 70 49 6e alRepProc *dupIn
5700: 74 52 65 70 50 72 6f 63 3b 0a 09 09 09 09 2f 2a tRepProc;...../*
5710: 20 43 61 6c 6c 65 64 20 74 6f 20 63 72 65 61 74 Called to creat
5720: 65 20 61 20 6e 65 77 20 6f 62 6a 65 63 74 20 61 e a new object a
5730: 73 20 61 20 63 6f 70 79 20 6f 66 0a 09 09 09 09 s a copy of.....
5740: 20 2a 20 61 6e 20 65 78 69 73 74 69 6e 67 20 6f * an existing o
5750: 62 6a 65 63 74 2e 20 2a 2f 0a 20 20 20 20 54 63 bject. */. Tc
5760: 6c 5f 55 70 64 61 74 65 53 74 72 69 6e 67 50 72 l_UpdateStringPr
5770: 6f 63 20 2a 75 70 64 61 74 65 53 74 72 69 6e 67 oc *updateString
5780: 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 43 61 6c Proc;...../* Cal
5790: 6c 65 64 20 74 6f 20 75 70 64 61 74 65 20 74 68 led to update th
57a0: 65 20 73 74 72 69 6e 67 20 72 65 70 20 66 72 6f e string rep fro
57b0: 6d 20 74 68 65 0a 09 09 09 09 20 2a 20 74 79 70 m the..... * typ
57c0: 65 27 73 20 69 6e 74 65 72 6e 61 6c 20 72 65 70 e's internal rep
57d0: 72 65 73 65 6e 74 61 74 69 6f 6e 2e 20 2a 2f 0a resentation. */.
57e0: 20 20 20 20 54 63 6c 5f 53 65 74 46 72 6f 6d 41 Tcl_SetFromA
57f0: 6e 79 50 72 6f 63 20 2a 73 65 74 46 72 6f 6d 41 nyProc *setFromA
5800: 6e 79 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 43 nyProc;...../* C
5810: 61 6c 6c 65 64 20 74 6f 20 63 6f 6e 76 65 72 74 alled to convert
5820: 20 74 68 65 20 6f 62 6a 65 63 74 27 73 20 69 6e the object's in
5830: 74 65 72 6e 61 6c 20 72 65 70 0a 09 09 09 09 20 ternal rep.....
5840: 2a 20 74 6f 20 74 68 69 73 20 74 79 70 65 2e 20 * to this type.
5850: 46 72 65 65 73 20 74 68 65 20 69 6e 74 65 72 6e Frees the intern
5860: 61 6c 20 72 65 70 20 6f 66 20 74 68 65 0a 09 09 al rep of the...
5870: 09 09 20 2a 20 6f 6c 64 20 74 79 70 65 2e 20 52 .. * old type. R
5880: 65 74 75 72 6e 73 20 54 43 4c 5f 45 52 52 4f 52 eturns TCL_ERROR
5890: 20 6f 6e 20 66 61 69 6c 75 72 65 2e 20 2a 2f 0a on failure. */.
58a0: 20 20 20 20 73 69 7a 65 5f 74 20 76 65 72 73 69 size_t versi
58b0: 6f 6e 3b 09 09 2f 2a 20 56 65 72 73 69 6f 6e 20 on;../* Version
58c0: 66 69 65 6c 64 20 66 6f 72 20 66 75 74 75 72 65 field for future
58d0: 2d 70 72 6f 6f 66 69 6e 67 2e 20 2a 2f 0a 0a 20 -proofing. */..
58e0: 20 20 20 2f 2a 20 4c 69 73 74 20 65 6d 75 6c 61 /* List emula
58f0: 74 69 6f 6e 20 66 75 6e 63 74 69 6f 6e 73 20 2d tion functions -
5900: 20 4f 62 6a 54 79 70 65 20 56 65 72 73 69 6f 6e ObjType Version
5910: 20 31 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 4f 62 1 */. Tcl_Ob
5920: 6a 54 79 70 65 4c 65 6e 67 74 68 50 72 6f 63 20 jTypeLengthProc
5930: 2a 6c 65 6e 67 74 68 50 72 6f 63 3b 0a 09 09 09 *lengthProc;....
5940: 09 2f 2a 20 52 65 74 75 72 6e 20 74 68 65 20 5b ./* Return the [
5950: 6c 6c 65 6e 67 74 68 5d 20 6f 66 20 74 68 65 20 llength] of the
5960: 41 62 73 74 72 61 63 74 4c 69 73 74 20 2a 2f 0a AbstractList */.
5970: 20 20 20 20 54 63 6c 5f 4f 62 6a 54 79 70 65 49 Tcl_ObjTypeI
5980: 6e 64 65 78 50 72 6f 63 20 2a 69 6e 64 65 78 50 ndexProc *indexP
5990: 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 52 65 74 75 roc;...../* Retu
59a0: 72 6e 20 61 20 76 61 6c 75 65 20 28 54 63 6c 5f rn a value (Tcl_
59b0: 4f 62 6a 29 20 61 74 20 61 20 67 69 76 65 6e 20 Obj) at a given
59c0: 69 6e 64 65 78 20 2a 2f 0a 20 20 20 20 54 63 6c index */. Tcl
59d0: 5f 4f 62 6a 54 79 70 65 53 6c 69 63 65 50 72 6f _ObjTypeSlicePro
59e0: 63 20 2a 73 6c 69 63 65 50 72 6f 63 3b 0a 09 09 c *sliceProc;...
59f0: 09 09 2f 2a 20 52 65 74 75 72 6e 20 61 6e 20 41 ../* Return an A
5a00: 62 73 74 72 61 63 74 4c 69 73 74 20 66 6f 72 0a bstractList for.
5a10: 09 09 09 09 20 2a 20 5b 6c 72 61 6e 67 65 20 24 .... * [lrange $
5a20: 61 6c 20 24 73 74 61 72 74 20 24 65 6e 64 5d 20 al $start $end]
5a30: 2a 2f 0a 20 20 20 20 54 63 6c 5f 4f 62 6a 54 79 */. Tcl_ObjTy
5a40: 70 65 52 65 76 65 72 73 65 50 72 6f 63 20 2a 72 peReverseProc *r
5a50: 65 76 65 72 73 65 50 72 6f 63 3b 0a 09 09 09 09 everseProc;.....
5a60: 2f 2a 20 52 65 74 75 72 6e 20 61 6e 20 41 62 73 /* Return an Abs
5a70: 74 72 61 63 74 4c 69 73 74 20 66 6f 72 20 5b 6c tractList for [l
5a80: 72 65 76 65 72 73 65 20 24 61 6c 5d 20 2a 2f 0a reverse $al] */.
5a90: 20 20 20 20 54 63 6c 5f 4f 62 6a 54 79 70 65 47 Tcl_ObjTypeG
5aa0: 65 74 45 6c 65 6d 65 6e 74 73 20 2a 67 65 74 45 etElements *getE
5ab0: 6c 65 6d 65 6e 74 73 50 72 6f 63 3b 0a 09 09 09 lementsProc;....
5ac0: 09 2f 2a 20 52 65 74 75 72 6e 20 61 6e 20 6f 62 ./* Return an ob
5ad0: 6a 76 5b 5d 20 6f 66 20 61 6c 6c 20 65 6c 65 6d jv[] of all elem
5ae0: 65 6e 74 73 20 69 6e 20 74 68 65 20 6c 69 73 74 ents in the list
5af0: 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 4f 62 6a 54 */. Tcl_ObjT
5b00: 79 70 65 53 65 74 45 6c 65 6d 65 6e 74 20 2a 73 ypeSetElement *s
5b10: 65 74 45 6c 65 6d 65 6e 74 50 72 6f 63 3b 0a 09 etElementProc;..
5b20: 09 09 09 2f 2a 20 52 65 70 6c 61 63 65 20 74 68 .../* Replace th
5b30: 65 20 65 6c 65 6d 65 6e 74 20 61 74 20 74 68 65 e element at the
5b40: 20 69 6e 64 69 63 69 65 73 20 77 69 74 68 20 74 indicies with t
5b50: 68 65 0a 09 09 09 09 20 2a 20 67 69 76 65 6e 20 he..... * given
5b60: 76 61 6c 75 65 4f 62 6a 2e 20 2a 2f 0a 20 20 20 valueObj. */.
5b70: 20 54 63 6c 5f 4f 62 6a 54 79 70 65 52 65 70 6c Tcl_ObjTypeRepl
5b80: 61 63 65 50 72 6f 63 20 2a 72 65 70 6c 61 63 65 aceProc *replace
5b90: 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 52 65 70 Proc;...../* Rep
5ba0: 6c 61 63 65 20 73 75 62 6c 69 73 74 20 77 69 74 lace sublist wit
5bb0: 68 20 61 6e 6f 74 68 65 72 20 73 75 62 6c 69 73 h another sublis
5bc0: 74 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 4f 62 6a t */. Tcl_Obj
5bd0: 54 79 70 65 49 6e 4f 70 65 72 61 74 6f 72 50 72 TypeInOperatorPr
5be0: 6f 63 20 2a 69 6e 4f 70 65 72 50 72 6f 63 3b 0a oc *inOperProc;.
5bf0: 09 09 09 09 2f 2a 20 22 69 6e 22 20 61 6e 64 20 ..../* "in" and
5c00: 22 6e 69 22 20 65 78 70 72 20 6c 69 73 74 20 6f "ni" expr list o
5c10: 70 65 72 61 74 69 6f 6e 2e 0a 09 09 09 09 20 2a peration...... *
5c20: 20 44 65 74 65 72 6d 69 6e 65 20 69 66 20 74 68 Determine if th
5c30: 65 20 67 69 76 65 6e 20 73 74 72 69 6e 67 20 76 e given string v
5c40: 61 6c 75 65 20 6d 61 74 63 68 65 73 0a 09 09 09 alue matches....
5c50: 09 20 2a 20 61 6e 20 65 6c 65 6d 65 6e 74 20 69 . * an element i
5c60: 6e 20 74 68 65 20 6c 69 73 74 2e 20 2a 2f 0a 7d n the list. */.}
5c70: 20 54 63 6c 5f 4f 62 6a 54 79 70 65 3b 0a 0a 23 Tcl_ObjType;..#
5c80: 64 65 66 69 6e 65 20 54 43 4c 5f 4f 42 4a 54 59 define TCL_OBJTY
5c90: 50 45 5f 56 30 20 30 2c 20 5c 0a 09 30 2c 30 2c PE_V0 0, \..0,0,
5ca0: 30 2c 30 2c 30 2c 30 2c 30 2c 30 20 2f 2a 20 50 0,0,0,0,0,0 /* P
5cb0: 72 65 2d 54 63 6c 20 39 20 2a 2f 0a 23 64 65 66 re-Tcl 9 */.#def
5cc0: 69 6e 65 20 54 43 4c 5f 4f 42 4a 54 59 50 45 5f ine TCL_OBJTYPE_
5cd0: 56 31 28 61 29 20 6f 66 66 73 65 74 6f 66 28 54 V1(a) offsetof(T
5ce0: 63 6c 5f 4f 62 6a 54 79 70 65 2c 20 69 6e 64 65 cl_ObjType, inde
5cf0: 78 50 72 6f 63 29 2c 20 5c 0a 09 61 2c 30 2c 30 xProc), \..a,0,0
5d00: 2c 30 2c 30 2c 30 2c 30 2c 30 20 2f 2a 20 54 63 ,0,0,0,0,0 /* Tc
5d10: 6c 20 39 20 56 65 72 73 69 6f 6e 20 31 20 2a 2f l 9 Version 1 */
5d20: 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4f 42 4a .#define TCL_OBJ
5d30: 54 59 50 45 5f 56 32 28 61 2c 62 2c 63 2c 64 2c TYPE_V2(a,b,c,d,
5d40: 65 2c 66 2c 67 2c 68 29 20 73 69 7a 65 6f 66 28 e,f,g,h) sizeof(
5d50: 54 63 6c 5f 4f 62 6a 54 79 70 65 29 2c 20 20 5c Tcl_ObjType), \
5d60: 0a 09 61 2c 62 2c 63 2c 64 2c 65 2c 66 2c 67 2c ..a,b,c,d,e,f,g,
5d70: 68 20 2f 2a 20 54 63 6c 20 39 20 2d 20 41 62 73 h /* Tcl 9 - Abs
5d80: 74 72 61 63 74 4c 69 73 74 73 20 2a 2f 0a 0a 2f tractLists */../
5d90: 2a 0a 20 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 69 *. * The followi
5da0: 6e 67 20 73 74 72 75 63 74 75 72 65 20 73 74 6f ng structure sto
5db0: 72 65 73 20 61 6e 20 69 6e 74 65 72 6e 61 6c 20 res an internal
5dc0: 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 28 representation (
5dd0: 69 6e 74 65 72 6e 61 6c 72 65 70 29 20 66 6f 72 internalrep) for
5de0: 0a 20 2a 20 61 20 54 63 6c 20 76 61 6c 75 65 2e . * a Tcl value.
5df0: 20 41 6e 20 69 6e 74 65 72 6e 61 6c 72 65 70 20 An internalrep
5e00: 69 73 20 61 73 73 6f 63 69 61 74 65 64 20 77 69 is associated wi
5e10: 74 68 20 61 6e 20 54 63 6c 5f 4f 62 6a 54 79 70 th an Tcl_ObjTyp
5e20: 65 20 77 68 65 6e 20 62 6f 74 68 0a 20 2a 20 61 e when both. * a
5e30: 72 65 20 73 74 6f 72 65 64 20 69 6e 20 74 68 65 re stored in the
5e40: 20 73 61 6d 65 20 54 63 6c 5f 4f 62 6a 2e 20 20 same Tcl_Obj.
5e50: 54 68 65 20 72 6f 75 74 69 6e 65 73 20 6f 66 20 The routines of
5e60: 74 68 65 20 54 63 6c 5f 4f 62 6a 54 79 70 65 20 the Tcl_ObjType
5e70: 67 6f 76 65 72 6e 0a 20 2a 20 74 68 65 20 68 61 govern. * the ha
5e80: 6e 64 6c 69 6e 67 20 6f 66 20 74 68 65 20 69 6e ndling of the in
5e90: 74 65 72 6e 61 6c 72 65 70 2e 0a 20 2a 2f 0a 0a ternalrep.. */..
5ea0: 74 79 70 65 64 65 66 20 75 6e 69 6f 6e 20 54 63 typedef union Tc
5eb0: 6c 5f 4f 62 6a 49 6e 74 65 72 6e 61 6c 52 65 70 l_ObjInternalRep
5ec0: 20 7b 2f 2a 20 54 68 65 20 69 6e 74 65 72 6e 61 {/* The interna
5ed0: 6c 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e l representation
5ee0: 3a 20 2a 2f 0a 20 20 20 20 6c 6f 6e 67 20 6c 6f : */. long lo
5ef0: 6e 67 56 61 6c 75 65 3b 09 09 2f 2a 20 20 20 2d ngValue;../* -
5f00: 20 61 6e 20 6c 6f 6e 67 20 69 6e 74 65 67 65 72 an long integer
5f10: 20 76 61 6c 75 65 2e 20 2a 2f 0a 20 20 20 20 64 value. */. d
5f20: 6f 75 62 6c 65 20 64 6f 75 62 6c 65 56 61 6c 75 ouble doubleValu
5f30: 65 3b 09 09 2f 2a 20 20 20 2d 20 61 20 64 6f 75 e;../* - a dou
5f40: 62 6c 65 2d 70 72 65 63 69 73 69 6f 6e 20 66 6c ble-precision fl
5f50: 6f 61 74 69 6e 67 20 76 61 6c 75 65 2e 20 2a 2f oating value. */
5f60: 0a 20 20 20 20 76 6f 69 64 20 2a 6f 74 68 65 72 . void *other
5f70: 56 61 6c 75 65 50 74 72 3b 09 2f 2a 20 20 20 2d ValuePtr;./* -
5f80: 20 61 6e 6f 74 68 65 72 2c 20 74 79 70 65 2d 73 another, type-s
5f90: 70 65 63 69 66 69 63 20 76 61 6c 75 65 2c 20 2a pecific value, *
5fa0: 2f 0a 09 09 09 09 2f 2a 20 20 20 20 20 6e 6f 74 /...../* not
5fb0: 20 75 73 65 64 20 69 6e 74 65 72 6e 61 6c 6c 79 used internally
5fc0: 20 61 6e 79 20 6d 6f 72 65 2e 20 2a 2f 0a 20 20 any more. */.
5fd0: 20 20 54 63 6c 5f 57 69 64 65 49 6e 74 20 77 69 Tcl_WideInt wi
5fe0: 64 65 56 61 6c 75 65 3b 09 2f 2a 20 20 20 2d 20 deValue;./* -
5ff0: 61 6e 20 69 6e 74 65 67 65 72 20 76 61 6c 75 65 an integer value
6000: 20 3e 3d 20 36 34 62 69 74 73 20 2a 2f 0a 20 20 >= 64bits */.
6010: 20 20 73 74 72 75 63 74 20 7b 09 09 09 2f 2a 20 struct {.../*
6020: 20 20 2d 20 69 6e 74 65 72 6e 61 6c 20 72 65 70 - internal rep
6030: 20 61 73 20 74 77 6f 20 70 6f 69 6e 74 65 72 73 as two pointers
6040: 2e 20 2a 2f 0a 09 76 6f 69 64 20 2a 70 74 72 31 . */..void *ptr1
6050: 3b 0a 09 76 6f 69 64 20 2a 70 74 72 32 3b 0a 20 ;..void *ptr2;.
6060: 20 20 20 7d 20 74 77 6f 50 74 72 56 61 6c 75 65 } twoPtrValue
6070: 3b 0a 20 20 20 20 73 74 72 75 63 74 20 7b 09 09 ;. struct {..
6080: 09 2f 2a 20 20 20 2d 20 69 6e 74 65 72 6e 61 6c ./* - internal
6090: 20 72 65 70 20 61 73 20 61 20 70 6f 69 6e 74 65 rep as a pointe
60a0: 72 20 61 6e 64 20 61 20 6c 6f 6e 67 2c 20 2a 2f r and a long, */
60b0: 0a 09 76 6f 69 64 20 2a 70 74 72 3b 09 09 2f 2a ..void *ptr;../*
60c0: 20 20 20 20 20 6e 6f 74 20 75 73 65 64 20 69 6e not used in
60d0: 74 65 72 6e 61 6c 6c 79 20 61 6e 79 20 6d 6f 72 ternally any mor
60e0: 65 2e 20 2a 2f 0a 09 75 6e 73 69 67 6e 65 64 20 e. */..unsigned
60f0: 6c 6f 6e 67 20 76 61 6c 75 65 3b 0a 20 20 20 20 long value;.
6100: 7d 20 70 74 72 41 6e 64 4c 6f 6e 67 52 65 70 3b } ptrAndLongRep;
6110: 0a 20 20 20 20 73 74 72 75 63 74 20 7b 09 09 09 . struct {...
6120: 2f 2a 20 20 20 2d 20 75 73 65 20 66 6f 72 20 70 /* - use for p
6130: 6f 69 6e 74 65 72 20 61 6e 64 20 6c 65 6e 67 74 ointer and lengt
6140: 68 20 72 65 70 73 20 2a 2f 0a 09 76 6f 69 64 20 h reps */..void
6150: 2a 70 74 72 3b 0a 09 54 63 6c 5f 53 69 7a 65 20 *ptr;..Tcl_Size
6160: 73 69 7a 65 3b 0a 20 20 20 20 7d 20 70 74 72 41 size;. } ptrA
6170: 6e 64 53 69 7a 65 3b 0a 7d 20 54 63 6c 5f 4f 62 ndSize;.} Tcl_Ob
6180: 6a 49 6e 74 65 72 6e 61 6c 52 65 70 3b 0a 0a 2f jInternalRep;../
6190: 2a 0a 20 2a 20 4f 6e 65 20 6f 66 20 74 68 65 20 *. * One of the
61a0: 66 6f 6c 6c 6f 77 69 6e 67 20 73 74 72 75 63 74 following struct
61b0: 75 72 65 73 20 65 78 69 73 74 73 20 66 6f 72 20 ures exists for
61c0: 65 61 63 68 20 6f 62 6a 65 63 74 20 69 6e 20 74 each object in t
61d0: 68 65 20 54 63 6c 20 73 79 73 74 65 6d 2e 0a 20 he Tcl system..
61e0: 2a 20 41 6e 20 6f 62 6a 65 63 74 20 73 74 6f 72 * An object stor
61f0: 65 73 20 61 20 76 61 6c 75 65 20 61 73 20 65 69 es a value as ei
6200: 74 68 65 72 20 61 20 73 74 72 69 6e 67 2c 20 73 ther a string, s
6210: 6f 6d 65 20 69 6e 74 65 72 6e 61 6c 20 72 65 70 ome internal rep
6220: 72 65 73 65 6e 74 61 74 69 6f 6e 2c 0a 20 2a 20 resentation,. *
6230: 6f 72 20 62 6f 74 68 2e 0a 20 2a 2f 0a 0a 74 79 or both.. */..ty
6240: 70 65 64 65 66 20 73 74 72 75 63 74 20 54 63 6c pedef struct Tcl
6250: 5f 4f 62 6a 20 7b 0a 20 20 20 20 54 63 6c 5f 53 _Obj {. Tcl_S
6260: 69 7a 65 20 72 65 66 43 6f 75 6e 74 3b 09 09 2f ize refCount;../
6270: 2a 20 57 68 65 6e 20 30 20 74 68 65 20 6f 62 6a * When 0 the obj
6280: 65 63 74 20 77 69 6c 6c 20 62 65 20 66 72 65 65 ect will be free
6290: 64 2e 20 2a 2f 0a 20 20 20 20 63 68 61 72 20 2a d. */. char *
62a0: 62 79 74 65 73 3b 09 09 2f 2a 20 54 68 69 73 20 bytes;../* This
62b0: 70 6f 69 6e 74 73 20 74 6f 20 74 68 65 20 66 69 points to the fi
62c0: 72 73 74 20 62 79 74 65 20 6f 66 20 74 68 65 0a rst byte of the.
62d0: 09 09 09 09 20 2a 20 6f 62 6a 65 63 74 27 73 20 .... * object's
62e0: 73 74 72 69 6e 67 20 72 65 70 72 65 73 65 6e 74 string represent
62f0: 61 74 69 6f 6e 2e 20 54 68 65 20 61 72 72 61 79 ation. The array
6300: 0a 09 09 09 09 20 2a 20 6d 75 73 74 20 62 65 20 ..... * must be
6310: 66 6f 6c 6c 6f 77 65 64 20 62 79 20 61 20 6e 75 followed by a nu
6320: 6c 6c 20 62 79 74 65 20 28 69 2e 65 2e 2c 20 61 ll byte (i.e., a
6330: 74 0a 09 09 09 09 20 2a 20 6f 66 66 73 65 74 20 t..... * offset
6340: 6c 65 6e 67 74 68 29 20 62 75 74 20 6d 61 79 20 length) but may
6350: 61 6c 73 6f 20 63 6f 6e 74 61 69 6e 0a 09 09 09 also contain....
6360: 09 20 2a 20 65 6d 62 65 64 64 65 64 20 6e 75 6c . * embedded nul
6370: 6c 20 63 68 61 72 61 63 74 65 72 73 2e 20 54 68 l characters. Th
6380: 65 20 61 72 72 61 79 27 73 0a 09 09 09 09 20 2a e array's..... *
6390: 20 73 74 6f 72 61 67 65 20 69 73 20 61 6c 6c 6f storage is allo
63a0: 63 61 74 65 64 20 62 79 20 54 63 6c 5f 41 6c 6c cated by Tcl_All
63b0: 6f 63 2e 20 4e 55 4c 4c 20 6d 65 61 6e 73 0a 09 oc. NULL means..
63c0: 09 09 09 20 2a 20 74 68 65 20 73 74 72 69 6e 67 ... * the string
63d0: 20 72 65 70 20 69 73 20 69 6e 76 61 6c 69 64 20 rep is invalid
63e0: 61 6e 64 20 6d 75 73 74 20 62 65 0a 09 09 09 09 and must be.....
63f0: 20 2a 20 72 65 67 65 6e 65 72 61 74 65 64 20 66 * regenerated f
6400: 72 6f 6d 20 74 68 65 20 69 6e 74 65 72 6e 61 6c rom the internal
6410: 20 72 65 70 2e 20 20 43 6c 69 65 6e 74 73 0a 09 rep. Clients..
6420: 09 09 09 20 2a 20 73 68 6f 75 6c 64 20 75 73 65 ... * should use
6430: 20 54 63 6c 5f 47 65 74 53 74 72 69 6e 67 46 72 Tcl_GetStringFr
6440: 6f 6d 4f 62 6a 20 6f 72 0a 09 09 09 09 20 2a 20 omObj or..... *
6450: 54 63 6c 5f 47 65 74 53 74 72 69 6e 67 20 74 6f Tcl_GetString to
6460: 20 67 65 74 20 61 20 70 6f 69 6e 74 65 72 20 74 get a pointer t
6470: 6f 20 74 68 65 20 62 79 74 65 0a 09 09 09 09 20 o the byte.....
6480: 2a 20 61 72 72 61 79 20 61 73 20 61 20 72 65 61 * array as a rea
6490: 64 6f 6e 6c 79 20 76 61 6c 75 65 2e 20 2a 2f 0a donly value. */.
64a0: 20 20 20 20 54 63 6c 5f 53 69 7a 65 20 6c 65 6e Tcl_Size len
64b0: 67 74 68 3b 09 09 2f 2a 20 54 68 65 20 6e 75 6d gth;../* The num
64c0: 62 65 72 20 6f 66 20 62 79 74 65 73 20 61 74 20 ber of bytes at
64d0: 2a 62 79 74 65 73 2c 20 6e 6f 74 0a 09 09 09 09 *bytes, not.....
64e0: 20 2a 20 69 6e 63 6c 75 64 69 6e 67 20 74 68 65 * including the
64f0: 20 74 65 72 6d 69 6e 61 74 69 6e 67 20 6e 75 6c terminating nul
6500: 6c 2e 20 2a 2f 0a 20 20 20 20 63 6f 6e 73 74 20 l. */. const
6510: 54 63 6c 5f 4f 62 6a 54 79 70 65 20 2a 74 79 70 Tcl_ObjType *typ
6520: 65 50 74 72 3b 09 2f 2a 20 44 65 6e 6f 74 65 73 ePtr;./* Denotes
6530: 20 74 68 65 20 6f 62 6a 65 63 74 27 73 20 74 79 the object's ty
6540: 70 65 2e 20 41 6c 77 61 79 73 0a 09 09 09 09 20 pe. Always.....
6550: 2a 20 63 6f 72 72 65 73 70 6f 6e 64 73 20 74 6f * corresponds to
6560: 20 74 68 65 20 74 79 70 65 20 6f 66 20 74 68 65 the type of the
6570: 20 6f 62 6a 65 63 74 27 73 0a 09 09 09 09 20 2a object's..... *
6580: 20 69 6e 74 65 72 6e 61 6c 20 72 65 70 2e 20 4e internal rep. N
6590: 55 4c 4c 20 69 6e 64 69 63 61 74 65 73 20 74 68 ULL indicates th
65a0: 65 20 6f 62 6a 65 63 74 20 68 61 73 0a 09 09 09 e object has....
65b0: 09 20 2a 20 6e 6f 20 69 6e 74 65 72 6e 61 6c 20 . * no internal
65c0: 72 65 70 20 28 68 61 73 20 6e 6f 20 74 79 70 65 rep (has no type
65d0: 29 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 4f 62 ). */. Tcl_Ob
65e0: 6a 49 6e 74 65 72 6e 61 6c 52 65 70 20 69 6e 74 jInternalRep int
65f0: 65 72 6e 61 6c 52 65 70 3b 0a 09 09 09 09 2f 2a ernalRep;...../*
6600: 20 54 68 65 20 69 6e 74 65 72 6e 61 6c 20 72 65 The internal re
6610: 70 72 65 73 65 6e 74 61 74 69 6f 6e 3a 20 2a 2f presentation: */
6620: 0a 7d 20 54 63 6c 5f 4f 62 6a 3b 0a 0c 0a 2f 2a .} Tcl_Obj;.../*
6630: 0a 20 2a 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 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
6670: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a ---------------.
6680: 20 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 * The following
6690: 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 73 75 70 definitions sup
66a0: 70 6f 72 74 20 54 63 6c 27 73 20 6e 61 6d 65 73 port Tcl's names
66b0: 70 61 63 65 20 66 61 63 69 6c 69 74 79 2e 20 4e pace facility. N
66c0: 6f 74 65 3a 20 74 68 65 20 66 69 72 73 74 0a 20 ote: the first.
66d0: 2a 20 66 69 76 65 20 66 69 65 6c 64 73 20 6d 75 * five fields mu
66e0: 73 74 20 6d 61 74 63 68 20 65 78 61 63 74 6c 79 st match exactly
66f0: 20 74 68 65 20 66 69 65 6c 64 73 20 69 6e 20 61 the fields in a
6700: 20 4e 61 6d 65 73 70 61 63 65 20 73 74 72 75 63 Namespace struc
6710: 74 75 72 65 20 28 73 65 65 0a 20 2a 20 74 63 6c ture (see. * tcl
6720: 49 6e 74 2e 68 29 2e 0a 20 2a 2f 0a 0a 74 79 70 Int.h).. */..typ
6730: 65 64 65 66 20 73 74 72 75 63 74 20 54 63 6c 5f edef struct Tcl_
6740: 4e 61 6d 65 73 70 61 63 65 20 7b 0a 20 20 20 20 Namespace {.
6750: 63 68 61 72 20 2a 6e 61 6d 65 3b 09 09 09 2f 2a char *name;.../*
6760: 20 54 68 65 20 6e 61 6d 65 73 70 61 63 65 27 73 The namespace's
6770: 20 6e 61 6d 65 20 77 69 74 68 69 6e 20 69 74 73 name within its
6780: 20 70 61 72 65 6e 74 0a 09 09 09 09 20 2a 20 6e parent..... * n
6790: 61 6d 65 73 70 61 63 65 2e 20 54 68 69 73 20 63 amespace. This c
67a0: 6f 6e 74 61 69 6e 73 20 6e 6f 20 3a 3a 27 73 2e ontains no ::'s.
67b0: 20 54 68 65 20 6e 61 6d 65 0a 09 09 09 09 20 2a The name..... *
67c0: 20 6f 66 20 74 68 65 20 67 6c 6f 62 61 6c 20 6e of the global n
67d0: 61 6d 65 73 70 61 63 65 20 69 73 20 22 22 20 61 amespace is "" a
67e0: 6c 74 68 6f 75 67 68 20 22 3a 3a 22 0a 09 09 09 lthough "::"....
67f0: 09 20 2a 20 69 73 20 61 6e 20 73 79 6e 6f 6e 79 . * is an synony
6800: 6d 2e 20 2a 2f 0a 20 20 20 20 63 68 61 72 20 2a m. */. char *
6810: 66 75 6c 6c 4e 61 6d 65 3b 09 09 2f 2a 20 54 68 fullName;../* Th
6820: 65 20 6e 61 6d 65 73 70 61 63 65 27 73 20 66 75 e namespace's fu
6830: 6c 6c 79 20 71 75 61 6c 69 66 69 65 64 20 6e 61 lly qualified na
6840: 6d 65 2e 20 54 68 69 73 0a 09 09 09 09 20 2a 20 me. This..... *
6850: 73 74 61 72 74 73 20 77 69 74 68 20 3a 3a 2e 20 starts with ::.
6860: 2a 2f 0a 20 20 20 20 76 6f 69 64 20 2a 63 6c 69 */. void *cli
6870: 65 6e 74 44 61 74 61 3b 09 09 2f 2a 20 41 72 62 entData;../* Arb
6880: 69 74 72 61 72 79 20 76 61 6c 75 65 20 61 73 73 itrary value ass
6890: 6f 63 69 61 74 65 64 20 77 69 74 68 20 74 68 69 ociated with thi
68a0: 73 0a 09 09 09 09 20 2a 20 6e 61 6d 65 73 70 61 s..... * namespa
68b0: 63 65 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 4e ce. */. Tcl_N
68c0: 61 6d 65 73 70 61 63 65 44 65 6c 65 74 65 50 72 amespaceDeletePr
68d0: 6f 63 20 2a 64 65 6c 65 74 65 50 72 6f 63 3b 0a oc *deleteProc;.
68e0: 09 09 09 09 2f 2a 20 46 75 6e 63 74 69 6f 6e 20 ..../* Function
68f0: 69 6e 76 6f 6b 65 64 20 77 68 65 6e 20 64 65 6c invoked when del
6900: 65 74 69 6e 67 20 74 68 65 0a 09 09 09 09 20 2a eting the..... *
6910: 20 6e 61 6d 65 73 70 61 63 65 20 74 6f 2c 20 65 namespace to, e
6920: 2e 67 2e 2c 20 66 72 65 65 20 63 6c 69 65 6e 74 .g., free client
6930: 44 61 74 61 2e 20 2a 2f 0a 20 20 20 20 73 74 72 Data. */. str
6940: 75 63 74 20 54 63 6c 5f 4e 61 6d 65 73 70 61 63 uct Tcl_Namespac
6950: 65 20 2a 70 61 72 65 6e 74 50 74 72 3b 0a 09 09 e *parentPtr;...
6960: 09 09 2f 2a 20 50 6f 69 6e 74 73 20 74 6f 20 74 ../* Points to t
6970: 68 65 20 6e 61 6d 65 73 70 61 63 65 20 74 68 61 he namespace tha
6980: 74 20 63 6f 6e 74 61 69 6e 73 20 74 68 69 73 0a t contains this.
6990: 09 09 09 09 20 2a 20 6f 6e 65 2e 20 4e 55 4c 4c .... * one. NULL
69a0: 20 69 66 20 74 68 69 73 20 69 73 20 74 68 65 20 if this is the
69b0: 67 6c 6f 62 61 6c 0a 09 09 09 09 20 2a 20 6e 61 global..... * na
69c0: 6d 65 73 70 61 63 65 2e 20 2a 2f 0a 7d 20 54 63 mespace. */.} Tc
69d0: 6c 5f 4e 61 6d 65 73 70 61 63 65 3b 0a 0a 2f 2a l_Namespace;../*
69e0: 0a 20 2a 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 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
6a20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a ---------------.
6a30: 20 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 * The following
6a40: 20 73 74 72 75 63 74 75 72 65 20 72 65 70 72 65 structure repre
6a50: 73 65 6e 74 73 20 61 20 63 61 6c 6c 20 66 72 61 sents a call fra
6a60: 6d 65 2c 20 6f 72 20 61 63 74 69 76 61 74 69 6f me, or activatio
6a70: 6e 20 72 65 63 6f 72 64 2e 20 41 0a 20 2a 20 63 n record. A. * c
6a80: 61 6c 6c 20 66 72 61 6d 65 20 64 65 66 69 6e 65 all frame define
6a90: 73 20 61 20 6e 61 6d 69 6e 67 20 63 6f 6e 74 65 s a naming conte
6aa0: 78 74 20 66 6f 72 20 61 20 70 72 6f 63 65 64 75 xt for a procedu
6ab0: 72 65 20 63 61 6c 6c 3a 20 69 74 73 20 6c 6f 63 re call: its loc
6ac0: 61 6c 20 73 63 6f 70 65 0a 20 2a 20 28 66 6f 72 al scope. * (for
6ad0: 20 6c 6f 63 61 6c 20 76 61 72 69 61 62 6c 65 73 local variables
6ae0: 29 20 61 6e 64 20 69 74 73 20 6e 61 6d 65 73 70 ) and its namesp
6af0: 61 63 65 20 73 63 6f 70 65 20 28 75 73 65 64 20 ace scope (used
6b00: 66 6f 72 20 6e 6f 6e 2d 6c 6f 63 61 6c 0a 20 2a for non-local. *
6b10: 20 76 61 72 69 61 62 6c 65 73 3b 20 6f 66 74 65 variables; ofte
6b20: 6e 20 74 68 65 20 67 6c 6f 62 61 6c 20 3a 3a 20 n the global ::
6b30: 6e 61 6d 65 73 70 61 63 65 29 2e 20 41 20 63 61 namespace). A ca
6b40: 6c 6c 20 66 72 61 6d 65 20 63 61 6e 20 61 6c 73 ll frame can als
6b50: 6f 20 64 65 66 69 6e 65 20 74 68 65 0a 20 2a 20 o define the. *
6b60: 6e 61 6d 69 6e 67 20 63 6f 6e 74 65 78 74 20 66 naming context f
6b70: 6f 72 20 61 20 6e 61 6d 65 73 70 61 63 65 20 65 or a namespace e
6b80: 76 61 6c 20 6f 72 20 6e 61 6d 65 73 70 61 63 65 val or namespace
6b90: 20 69 6e 73 63 6f 70 65 20 63 6f 6d 6d 61 6e 64 inscope command
6ba0: 3a 20 74 68 65 0a 20 2a 20 6e 61 6d 65 73 70 61 : the. * namespa
6bb0: 63 65 20 69 6e 20 77 68 69 63 68 20 74 68 65 20 ce in which the
6bc0: 63 6f 6d 6d 61 6e 64 27 73 20 63 6f 64 65 20 73 command's code s
6bd0: 68 6f 75 6c 64 20 65 78 65 63 75 74 65 2e 20 54 hould execute. T
6be0: 68 65 20 54 63 6c 5f 43 61 6c 6c 46 72 61 6d 65 he Tcl_CallFrame
6bf0: 0a 20 2a 20 73 74 72 75 63 74 75 72 65 73 20 65 . * structures e
6c00: 78 69 73 74 20 6f 6e 6c 79 20 77 68 69 6c 65 20 xist only while
6c10: 70 72 6f 63 65 64 75 72 65 73 20 6f 72 20 6e 61 procedures or na
6c20: 6d 65 73 70 61 63 65 20 65 76 61 6c 2f 69 6e 73 mespace eval/ins
6c30: 63 6f 70 65 27 73 20 61 72 65 0a 20 2a 20 62 65 cope's are. * be
6c40: 69 6e 67 20 65 78 65 63 75 74 65 64 2c 20 61 6e ing executed, an
6c50: 64 20 70 72 6f 76 69 64 65 20 61 20 54 63 6c 20 d provide a Tcl
6c60: 63 61 6c 6c 20 73 74 61 63 6b 2e 0a 20 2a 0a 20 call stack.. *.
6c70: 2a 20 41 20 63 61 6c 6c 20 66 72 61 6d 65 20 69 * A call frame i
6c80: 73 20 69 6e 69 74 69 61 6c 69 7a 65 64 20 61 6e s initialized an
6c90: 64 20 70 75 73 68 65 64 20 75 73 69 6e 67 20 54 d pushed using T
6ca0: 63 6c 5f 50 75 73 68 43 61 6c 6c 46 72 61 6d 65 cl_PushCallFrame
6cb0: 20 61 6e 64 20 70 6f 70 70 65 64 0a 20 2a 20 75 and popped. * u
6cc0: 73 69 6e 67 20 54 63 6c 5f 50 6f 70 43 61 6c 6c sing Tcl_PopCall
6cd0: 46 72 61 6d 65 2e 20 53 74 6f 72 61 67 65 20 66 Frame. Storage f
6ce0: 6f 72 20 61 20 54 63 6c 5f 43 61 6c 6c 46 72 61 or a Tcl_CallFra
6cf0: 6d 65 20 6d 75 73 74 20 62 65 20 70 72 6f 76 69 me must be provi
6d00: 64 65 64 20 62 79 20 74 68 65 0a 20 2a 20 54 63 ded by the. * Tc
6d10: 6c 5f 50 75 73 68 43 61 6c 6c 46 72 61 6d 65 20 l_PushCallFrame
6d20: 63 61 6c 6c 65 72 2c 20 61 6e 64 20 63 61 6c 6c caller, and call
6d30: 65 72 73 20 74 79 70 69 63 61 6c 6c 79 20 61 6c ers typically al
6d40: 6c 6f 63 61 74 65 20 74 68 65 6d 20 6f 6e 20 74 locate them on t
6d50: 68 65 20 43 20 63 61 6c 6c 0a 20 2a 20 73 74 61 he C call. * sta
6d60: 63 6b 20 66 6f 72 20 65 66 66 69 63 69 65 6e 63 ck for efficienc
6d70: 79 2e 20 46 6f 72 20 74 68 69 73 20 72 65 61 73 y. For this reas
6d80: 6f 6e 2c 20 54 63 6c 5f 43 61 6c 6c 46 72 61 6d on, Tcl_CallFram
6d90: 65 20 69 73 20 64 65 66 69 6e 65 64 20 61 73 20 e is defined as
6da0: 61 0a 20 2a 20 73 74 72 75 63 74 75 72 65 20 61 a. * structure a
6db0: 6e 64 20 6e 6f 74 20 61 73 20 61 6e 20 6f 70 61 nd not as an opa
6dc0: 71 75 65 20 74 6f 6b 65 6e 2e 20 48 6f 77 65 76 que token. Howev
6dd0: 65 72 2c 20 6d 6f 73 74 20 54 63 6c 5f 43 61 6c er, most Tcl_Cal
6de0: 6c 46 72 61 6d 65 20 66 69 65 6c 64 73 0a 20 2a lFrame fields. *
6df0: 20 61 72 65 20 68 69 64 64 65 6e 20 73 69 6e 63 are hidden sinc
6e00: 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 20 73 e applications s
6e10: 68 6f 75 6c 64 20 6e 6f 74 20 61 63 63 65 73 73 hould not access
6e20: 20 74 68 65 6d 20 64 69 72 65 63 74 6c 79 3b 20 them directly;
6e30: 6f 74 68 65 72 73 20 61 72 65 0a 20 2a 20 64 65 others are. * de
6e40: 63 6c 61 72 65 64 20 61 73 20 22 64 75 6d 6d 79 clared as "dummy
6e50: 58 22 2e 0a 20 2a 0a 20 2a 20 57 41 52 4e 49 4e X".. *. * WARNIN
6e60: 47 21 21 20 54 68 65 20 73 74 72 75 63 74 75 72 G!! The structur
6e70: 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 6d 75 73 e definition mus
6e80: 74 20 62 65 20 6b 65 70 74 20 63 6f 6e 73 69 73 t be kept consis
6e90: 74 65 6e 74 20 77 69 74 68 20 74 68 65 0a 20 2a tent with the. *
6ea0: 20 43 61 6c 6c 46 72 61 6d 65 20 73 74 72 75 63 CallFrame struc
6eb0: 74 75 72 65 20 69 6e 20 74 63 6c 49 6e 74 2e 68 ture in tclInt.h
6ec0: 2e 20 49 66 20 79 6f 75 20 63 68 61 6e 67 65 20 . If you change
6ed0: 6f 6e 65 2c 20 63 68 61 6e 67 65 20 74 68 65 20 one, change the
6ee0: 6f 74 68 65 72 2e 0a 20 2a 2f 0a 0a 74 79 70 65 other.. */..type
6ef0: 64 65 66 20 73 74 72 75 63 74 20 54 63 6c 5f 43 def struct Tcl_C
6f00: 61 6c 6c 46 72 61 6d 65 20 7b 0a 20 20 20 20 54 allFrame {. T
6f10: 63 6c 5f 4e 61 6d 65 73 70 61 63 65 20 2a 6e 73 cl_Namespace *ns
6f20: 50 74 72 3b 09 2f 2a 20 43 75 72 72 65 6e 74 20 Ptr;./* Current
6f30: 6e 61 6d 65 73 70 61 63 65 20 66 6f 72 20 74 68 namespace for th
6f40: 65 20 63 61 6c 6c 20 66 72 61 6d 65 2e 20 2a 2f e call frame. */
6f50: 0a 20 20 20 20 69 6e 74 20 64 75 6d 6d 79 31 3b . int dummy1;
6f60: 0a 20 20 20 20 54 63 6c 5f 53 69 7a 65 20 64 75 . Tcl_Size du
6f70: 6d 6d 79 32 3b 0a 20 20 20 20 76 6f 69 64 20 2a mmy2;. void *
6f80: 64 75 6d 6d 79 33 3b 0a 20 20 20 20 76 6f 69 64 dummy3;. void
6f90: 20 2a 64 75 6d 6d 79 34 3b 0a 20 20 20 20 76 6f *dummy4;. vo
6fa0: 69 64 20 2a 64 75 6d 6d 79 35 3b 0a 20 20 20 20 id *dummy5;.
6fb0: 54 63 6c 5f 53 69 7a 65 20 64 75 6d 6d 79 36 3b Tcl_Size dummy6;
6fc0: 0a 20 20 20 20 76 6f 69 64 20 2a 64 75 6d 6d 79 . void *dummy
6fd0: 37 3b 0a 20 20 20 20 76 6f 69 64 20 2a 64 75 6d 7;. void *dum
6fe0: 6d 79 38 3b 0a 20 20 20 20 54 63 6c 5f 53 69 7a my8;. Tcl_Siz
6ff0: 65 20 64 75 6d 6d 79 39 3b 0a 20 20 20 20 76 6f e dummy9;. vo
7000: 69 64 20 2a 64 75 6d 6d 79 31 30 3b 0a 20 20 20 id *dummy10;.
7010: 20 76 6f 69 64 20 2a 64 75 6d 6d 79 31 31 3b 0a void *dummy11;.
7020: 20 20 20 20 76 6f 69 64 20 2a 64 75 6d 6d 79 31 void *dummy1
7030: 32 3b 0a 20 20 20 20 76 6f 69 64 20 2a 64 75 6d 2;. void *dum
7040: 6d 79 31 33 3b 0a 7d 20 54 63 6c 5f 43 61 6c 6c my13;.} Tcl_Call
7050: 46 72 61 6d 65 3b 0a 0a 2f 2a 0a 20 2a 2d 2d 2d Frame;../*. *---
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 2d 2d 2d ----------------
7090: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
70a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 49 6e 66 ---------. * Inf
70b0: 6f 72 6d 61 74 69 6f 6e 20 61 62 6f 75 74 20 63 ormation about c
70c0: 6f 6d 6d 61 6e 64 73 20 74 68 61 74 20 69 73 20 ommands that is
70d0: 72 65 74 75 72 6e 65 64 20 62 79 20 54 63 6c 5f returned by Tcl_
70e0: 47 65 74 43 6f 6d 6d 61 6e 64 49 6e 66 6f 20 61 GetCommandInfo a
70f0: 6e 64 0a 20 2a 20 70 61 73 73 65 64 20 74 6f 20 nd. * passed to
7100: 54 63 6c 5f 53 65 74 43 6f 6d 6d 61 6e 64 49 6e Tcl_SetCommandIn
7110: 66 6f 2e 20 6f 62 6a 50 72 6f 63 20 69 73 20 61 fo. objProc is a
7120: 6e 20 6f 62 6a 63 2f 6f 62 6a 76 20 6f 62 6a 65 n objc/objv obje
7130: 63 74 2d 62 61 73 65 64 20 63 6f 6d 6d 61 6e 64 ct-based command
7140: 0a 20 2a 20 66 75 6e 63 74 69 6f 6e 20 77 68 69 . * function whi
7150: 6c 65 20 70 72 6f 63 20 69 73 20 61 20 74 72 61 le proc is a tra
7160: 64 69 74 69 6f 6e 61 6c 20 54 63 6c 20 61 72 67 ditional Tcl arg
7170: 63 2f 61 72 67 76 20 73 74 72 69 6e 67 2d 62 61 c/argv string-ba
7180: 73 65 64 20 66 75 6e 63 74 69 6f 6e 2e 0a 20 2a sed function.. *
7190: 20 54 63 6c 5f 43 72 65 61 74 65 4f 62 6a 43 6f Tcl_CreateObjCo
71a0: 6d 6d 61 6e 64 20 61 6e 64 20 54 63 6c 5f 43 72 mmand and Tcl_Cr
71b0: 65 61 74 65 43 6f 6d 6d 61 6e 64 20 65 6e 73 75 eateCommand ensu
71c0: 72 65 20 74 68 61 74 20 62 6f 74 68 20 6f 62 6a re that both obj
71d0: 50 72 6f 63 20 61 6e 64 0a 20 2a 20 70 72 6f 63 Proc and. * proc
71e0: 20 61 72 65 20 6e 6f 6e 2d 4e 55 4c 4c 20 61 6e are non-NULL an
71f0: 64 20 63 61 6e 20 62 65 20 63 61 6c 6c 65 64 20 d can be called
7200: 74 6f 20 65 78 65 63 75 74 65 20 74 68 65 20 63 to execute the c
7210: 6f 6d 6d 61 6e 64 2e 20 48 6f 77 65 76 65 72 2c ommand. However,
7220: 20 69 74 20 6d 61 79 0a 20 2a 20 62 65 20 66 61 it may. * be fa
7230: 73 74 65 72 20 74 6f 20 63 61 6c 6c 20 6f 6e 65 ster to call one
7240: 20 69 6e 73 74 65 61 64 20 6f 66 20 74 68 65 20 instead of the
7250: 6f 74 68 65 72 2e 20 54 68 65 20 6d 65 6d 62 65 other. The membe
7260: 72 20 69 73 4e 61 74 69 76 65 4f 62 6a 65 63 74 r isNativeObject
7270: 50 72 6f 63 0a 20 2a 20 69 73 20 73 65 74 20 74 Proc. * is set t
7280: 6f 20 31 20 69 66 20 61 6e 20 6f 62 6a 65 63 74 o 1 if an object
7290: 2d 62 61 73 65 64 20 66 75 6e 63 74 69 6f 6e 20 -based function
72a0: 77 61 73 20 72 65 67 69 73 74 65 72 65 64 20 62 was registered b
72b0: 79 0a 20 2a 20 54 63 6c 5f 43 72 65 61 74 65 4f y. * Tcl_CreateO
72c0: 62 6a 43 6f 6d 6d 61 6e 64 2c 20 61 6e 64 20 74 bjCommand, and t
72d0: 6f 20 30 20 69 66 20 61 20 73 74 72 69 6e 67 2d o 0 if a string-
72e0: 62 61 73 65 64 20 66 75 6e 63 74 69 6f 6e 20 77 based function w
72f0: 61 73 20 72 65 67 69 73 74 65 72 65 64 20 62 79 as registered by
7300: 0a 20 2a 20 54 63 6c 5f 43 72 65 61 74 65 43 6f . * Tcl_CreateCo
7310: 6d 6d 61 6e 64 2e 20 54 68 65 20 6f 74 68 65 72 mmand. The other
7320: 20 66 75 6e 63 74 69 6f 6e 20 69 73 20 74 79 70 function is typ
7330: 69 63 61 6c 6c 79 20 73 65 74 20 74 6f 20 61 20 ically set to a
7340: 63 6f 6d 70 61 74 69 62 69 6c 69 74 79 0a 20 2a compatibility. *
7350: 20 77 72 61 70 70 65 72 20 74 68 61 74 20 64 6f wrapper that do
7360: 65 73 20 73 74 72 69 6e 67 2d 74 6f 2d 6f 62 6a es string-to-obj
7370: 65 63 74 20 6f 72 20 6f 62 6a 65 63 74 2d 74 6f ect or object-to
7380: 2d 73 74 72 69 6e 67 20 61 72 67 75 6d 65 6e 74 -string argument
7390: 20 63 6f 6e 76 65 72 73 69 6f 6e 73 0a 20 2a 20 conversions. *
73a0: 74 68 65 6e 20 63 61 6c 6c 73 20 74 68 65 20 6f then calls the o
73b0: 74 68 65 72 20 66 75 6e 63 74 69 6f 6e 2e 0a 20 ther function..
73c0: 2a 2f 0a 0a 74 79 70 65 64 65 66 20 73 74 72 75 */..typedef stru
73d0: 63 74 20 7b 0a 20 20 20 20 69 6e 74 20 69 73 4e ct {. int isN
73e0: 61 74 69 76 65 4f 62 6a 65 63 74 50 72 6f 63 3b ativeObjectProc;
73f0: 09 2f 2a 20 31 20 69 66 20 6f 62 6a 50 72 6f 63 ./* 1 if objProc
7400: 20 77 61 73 20 72 65 67 69 73 74 65 72 65 64 20 was registered
7410: 62 79 20 61 20 63 61 6c 6c 20 74 6f 0a 09 09 09 by a call to....
7420: 09 20 2a 20 54 63 6c 5f 43 72 65 61 74 65 4f 62 . * Tcl_CreateOb
7430: 6a 43 6f 6d 6d 61 6e 64 3b 20 32 20 69 66 20 6f jCommand; 2 if o
7440: 62 6a 50 72 6f 63 20 77 61 73 20 72 65 67 69 73 bjProc was regis
7450: 74 65 72 65 64 20 62 79 0a 09 09 09 09 20 2a 20 tered by..... *
7460: 61 20 63 61 6c 6c 20 74 6f 20 54 63 6c 5f 43 72 a call to Tcl_Cr
7470: 65 61 74 65 4f 62 6a 43 6f 6d 6d 61 6e 64 32 3b eateObjCommand2;
7480: 20 30 20 6f 74 68 65 72 77 69 73 65 2e 0a 09 09 0 otherwise....
7490: 09 09 20 2a 20 54 63 6c 5f 53 65 74 43 6d 64 49 .. * Tcl_SetCmdI
74a0: 6e 66 6f 20 64 6f 65 73 20 6e 6f 74 20 6d 6f 64 nfo does not mod
74b0: 69 66 79 20 74 68 69 73 20 66 69 65 6c 64 2e 20 ify this field.
74c0: 2a 2f 0a 23 69 66 64 65 66 20 54 43 4c 5f 4e 4f */.#ifdef TCL_NO
74d0: 5f 44 45 50 52 45 43 41 54 45 44 0a 20 20 20 20 _DEPRECATED.
74e0: 76 6f 69 64 20 2a 6f 62 6a 50 72 6f 63 4e 6f 74 void *objProcNot
74f0: 55 73 65 64 3b 09 2f 2a 20 43 6f 6d 6d 61 6e 64 Used;./* Command
7500: 27 73 20 6f 62 6a 65 63 74 2d 62 61 73 65 64 20 's object-based
7510: 66 75 6e 63 74 69 6f 6e 2e 20 2a 2f 0a 20 20 20 function. */.
7520: 20 76 6f 69 64 20 2a 6f 62 6a 43 6c 69 65 6e 74 void *objClient
7530: 44 61 74 61 4e 6f 74 55 73 65 64 3b 09 2f 2a 20 DataNotUsed;./*
7540: 43 6c 69 65 6e 74 44 61 74 61 20 66 6f 72 20 6f ClientData for o
7550: 62 6a 65 63 74 20 70 72 6f 63 2e 20 2a 2f 0a 23 bject proc. */.#
7560: 65 6c 73 65 0a 20 20 20 20 54 63 6c 5f 4f 62 6a else. Tcl_Obj
7570: 43 6d 64 50 72 6f 63 20 2a 6f 62 6a 50 72 6f 63 CmdProc *objProc
7580: 3b 09 2f 2a 20 43 6f 6d 6d 61 6e 64 27 73 20 6f ;./* Command's o
7590: 62 6a 65 63 74 2d 62 61 73 65 64 20 66 75 6e 63 bject-based func
75a0: 74 69 6f 6e 2e 20 2a 2f 0a 20 20 20 20 76 6f 69 tion. */. voi
75b0: 64 20 2a 6f 62 6a 43 6c 69 65 6e 74 44 61 74 61 d *objClientData
75c0: 3b 09 2f 2a 20 43 6c 69 65 6e 74 44 61 74 61 20 ;./* ClientData
75d0: 66 6f 72 20 6f 62 6a 65 63 74 20 70 72 6f 63 2e for object proc.
75e0: 20 2a 2f 0a 23 65 6e 64 69 66 0a 20 20 20 20 54 */.#endif. T
75f0: 63 6c 5f 43 6d 64 50 72 6f 63 20 2a 70 72 6f 63 cl_CmdProc *proc
7600: 3b 09 09 2f 2a 20 43 6f 6d 6d 61 6e 64 27 73 20 ;../* Command's
7610: 73 74 72 69 6e 67 2d 62 61 73 65 64 20 66 75 6e string-based fun
7620: 63 74 69 6f 6e 2e 20 2a 2f 0a 20 20 20 20 76 6f ction. */. vo
7630: 69 64 20 2a 63 6c 69 65 6e 74 44 61 74 61 3b 09 id *clientData;.
7640: 09 2f 2a 20 43 6c 69 65 6e 74 44 61 74 61 20 66 ./* ClientData f
7650: 6f 72 20 73 74 72 69 6e 67 20 70 72 6f 63 2e 20 or string proc.
7660: 2a 2f 0a 20 20 20 20 54 63 6c 5f 43 6d 64 44 65 */. Tcl_CmdDe
7670: 6c 65 74 65 50 72 6f 63 20 2a 64 65 6c 65 74 65 leteProc *delete
7680: 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 46 75 6e Proc;...../* Fun
7690: 63 74 69 6f 6e 20 74 6f 20 63 61 6c 6c 20 77 68 ction to call wh
76a0: 65 6e 20 63 6f 6d 6d 61 6e 64 20 69 73 0a 09 09 en command is...
76b0: 09 09 20 2a 20 64 65 6c 65 74 65 64 2e 20 2a 2f .. * deleted. */
76c0: 0a 20 20 20 20 76 6f 69 64 20 2a 64 65 6c 65 74 . void *delet
76d0: 65 44 61 74 61 3b 09 09 2f 2a 20 56 61 6c 75 65 eData;../* Value
76e0: 20 74 6f 20 70 61 73 73 20 74 6f 20 64 65 6c 65 to pass to dele
76f0: 74 65 50 72 6f 63 20 28 75 73 75 61 6c 6c 79 20 teProc (usually
7700: 74 68 65 0a 09 09 09 09 20 2a 20 73 61 6d 65 20 the..... * same
7710: 61 73 20 63 6c 69 65 6e 74 44 61 74 61 29 2e 20 as clientData).
7720: 2a 2f 0a 20 20 20 20 54 63 6c 5f 4e 61 6d 65 73 */. Tcl_Names
7730: 70 61 63 65 20 2a 6e 61 6d 65 73 70 61 63 65 50 pace *namespaceP
7740: 74 72 3b 2f 2a 20 50 6f 69 6e 74 73 20 74 6f 20 tr;/* Points to
7750: 74 68 65 20 6e 61 6d 65 73 70 61 63 65 20 74 68 the namespace th
7760: 61 74 20 63 6f 6e 74 61 69 6e 73 20 74 68 69 73 at contains this
7770: 0a 09 09 09 09 20 2a 20 63 6f 6d 6d 61 6e 64 2e ..... * command.
7780: 20 4e 6f 74 65 20 74 68 61 74 20 54 63 6c 5f 53 Note that Tcl_S
7790: 65 74 43 6d 64 49 6e 66 6f 20 77 69 6c 6c 20 6e etCmdInfo will n
77a0: 6f 74 0a 09 09 09 09 20 2a 20 63 68 61 6e 67 65 ot..... * change
77b0: 20 61 20 63 6f 6d 6d 61 6e 64 27 73 20 6e 61 6d a command's nam
77c0: 65 73 70 61 63 65 3b 20 75 73 65 0a 09 09 09 09 espace; use.....
77d0: 20 2a 20 54 63 6c 52 65 6e 61 6d 65 43 6f 6d 6d * TclRenameComm
77e0: 61 6e 64 20 6f 72 20 54 63 6c 5f 45 76 61 6c 20 and or Tcl_Eval
77f0: 28 6f 66 20 27 72 65 6e 61 6d 65 27 29 0a 09 09 (of 'rename')...
7800: 09 09 20 2a 20 74 6f 20 64 6f 20 74 68 61 74 2e .. * to do that.
7810: 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 4f 62 6a 43 */. Tcl_ObjC
7820: 6d 64 50 72 6f 63 32 20 2a 6f 62 6a 50 72 6f 63 mdProc2 *objProc
7830: 32 3b 09 2f 2a 20 43 6f 6d 6d 61 6e 64 27 73 20 2;./* Command's
7840: 6f 62 6a 65 63 74 32 2d 62 61 73 65 64 20 66 75 object2-based fu
7850: 6e 63 74 69 6f 6e 2e 20 2a 2f 0a 20 20 20 20 76 nction. */. v
7860: 6f 69 64 20 2a 6f 62 6a 43 6c 69 65 6e 74 44 61 oid *objClientDa
7870: 74 61 32 3b 09 2f 2a 20 43 6c 69 65 6e 74 44 61 ta2;./* ClientDa
7880: 74 61 20 66 6f 72 20 6f 62 6a 65 63 74 32 20 70 ta for object2 p
7890: 72 6f 63 2e 20 2a 2f 0a 7d 20 54 63 6c 5f 43 6d roc. */.} Tcl_Cm
78a0: 64 49 6e 66 6f 3b 0a 0a 2f 2a 0a 20 2a 2d 2d 2d dInfo;../*. *---
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 2d 2d 2d ----------------
78e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
78f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 54 68 65 ---------. * The
7900: 20 73 74 72 75 63 74 75 72 65 20 64 65 66 69 6e structure defin
7910: 65 64 20 62 65 6c 6f 77 20 69 73 20 75 73 65 64 ed below is used
7920: 20 74 6f 20 68 6f 6c 64 20 64 79 6e 61 6d 69 63 to hold dynamic
7930: 20 73 74 72 69 6e 67 73 2e 20 54 68 65 20 6f 6e strings. The on
7940: 6c 79 0a 20 2a 20 66 69 65 6c 64 73 20 74 68 61 ly. * fields tha
7950: 74 20 63 6c 69 65 6e 74 73 20 73 68 6f 75 6c 64 t clients should
7960: 20 75 73 65 20 61 72 65 20 73 74 72 69 6e 67 20 use are string
7970: 61 6e 64 20 6c 65 6e 67 74 68 2c 20 61 63 63 65 and length, acce
7980: 73 73 69 62 6c 65 20 76 69 61 20 74 68 65 0a 20 ssible via the.
7990: 2a 20 6d 61 63 72 6f 73 20 54 63 6c 5f 44 53 74 * macros Tcl_DSt
79a0: 72 69 6e 67 56 61 6c 75 65 20 61 6e 64 20 54 63 ringValue and Tc
79b0: 6c 5f 44 53 74 72 69 6e 67 4c 65 6e 67 74 68 2e l_DStringLength.
79c0: 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 . */..#define TC
79d0: 4c 5f 44 53 54 52 49 4e 47 5f 53 54 41 54 49 43 L_DSTRING_STATIC
79e0: 5f 53 49 5a 45 20 32 30 30 0a 74 79 70 65 64 65 _SIZE 200.typede
79f0: 66 20 73 74 72 75 63 74 20 54 63 6c 5f 44 53 74 f struct Tcl_DSt
7a00: 72 69 6e 67 20 7b 0a 20 20 20 20 63 68 61 72 20 ring {. char
7a10: 2a 73 74 72 69 6e 67 3b 09 09 2f 2a 20 50 6f 69 *string;../* Poi
7a20: 6e 74 73 20 74 6f 20 62 65 67 69 6e 6e 69 6e 67 nts to beginning
7a30: 20 6f 66 20 73 74 72 69 6e 67 3a 20 65 69 74 68 of string: eith
7a40: 65 72 0a 09 09 09 09 20 2a 20 73 74 61 74 69 63 er..... * static
7a50: 53 70 61 63 65 20 62 65 6c 6f 77 20 6f 72 20 61 Space below or a
7a60: 20 6d 61 6c 6c 6f 63 65 64 20 61 72 72 61 79 2e malloced array.
7a70: 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 53 69 7a 65 */. Tcl_Size
7a80: 20 6c 65 6e 67 74 68 3b 09 09 2f 2a 20 4e 75 6d length;../* Num
7a90: 62 65 72 20 6f 66 20 62 79 74 65 73 20 69 6e 20 ber of bytes in
7aa0: 73 74 72 69 6e 67 20 65 78 63 6c 75 64 69 6e 67 string excluding
7ab0: 0a 09 09 09 09 20 2a 20 74 65 72 6d 69 6e 61 74 ..... * terminat
7ac0: 69 6e 67 20 6e 75 6c 20 2a 2f 0a 20 20 20 20 54 ing nul */. T
7ad0: 63 6c 5f 53 69 7a 65 20 73 70 61 63 65 41 76 6c cl_Size spaceAvl
7ae0: 3b 09 09 2f 2a 20 54 6f 74 61 6c 20 6e 75 6d 62 ;../* Total numb
7af0: 65 72 20 6f 66 20 62 79 74 65 73 20 61 76 61 69 er of bytes avai
7b00: 6c 61 62 6c 65 20 66 6f 72 20 74 68 65 0a 09 09 lable for the...
7b10: 09 09 20 2a 20 73 74 72 69 6e 67 20 61 6e 64 20 .. * string and
7b20: 69 74 73 20 74 65 72 6d 69 6e 61 74 69 6e 67 20 its terminating
7b30: 4e 55 4c 4c 20 63 68 61 72 2e 20 2a 2f 0a 20 20 NULL char. */.
7b40: 20 20 63 68 61 72 20 73 74 61 74 69 63 53 70 61 char staticSpa
7b50: 63 65 5b 54 43 4c 5f 44 53 54 52 49 4e 47 5f 53 ce[TCL_DSTRING_S
7b60: 54 41 54 49 43 5f 53 49 5a 45 5d 3b 0a 09 09 09 TATIC_SIZE];....
7b70: 09 2f 2a 20 53 70 61 63 65 20 74 6f 20 75 73 65 ./* Space to use
7b80: 20 69 6e 20 63 6f 6d 6d 6f 6e 20 63 61 73 65 20 in common case
7b90: 77 68 65 72 65 20 73 74 72 69 6e 67 20 69 73 0a where string is.
7ba0: 09 09 09 09 20 2a 20 73 6d 61 6c 6c 2e 20 2a 2f .... * small. */
7bb0: 0a 7d 20 54 63 6c 5f 44 53 74 72 69 6e 67 3b 0a .} Tcl_DString;.
7bc0: 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f 44 53 74 .#define Tcl_DSt
7bd0: 72 69 6e 67 4c 65 6e 67 74 68 28 64 73 50 74 72 ringLength(dsPtr
7be0: 29 20 28 28 64 73 50 74 72 29 2d 3e 6c 65 6e 67 ) ((dsPtr)->leng
7bf0: 74 68 29 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f th).#define Tcl_
7c00: 44 53 74 72 69 6e 67 56 61 6c 75 65 28 64 73 50 DStringValue(dsP
7c10: 74 72 29 20 28 28 64 73 50 74 72 29 2d 3e 73 74 tr) ((dsPtr)->st
7c20: 72 69 6e 67 29 0a 0a 2f 2a 0a 20 2a 20 44 65 66 ring)../*. * Def
7c30: 69 6e 69 74 69 6f 6e 73 20 66 6f 72 20 74 68 65 initions for the
7c40: 20 6d 61 78 69 6d 75 6d 20 6e 75 6d 62 65 72 20 maximum number
7c50: 6f 66 20 64 69 67 69 74 73 20 6f 66 20 70 72 65 of digits of pre
7c60: 63 69 73 69 6f 6e 20 74 68 61 74 20 6d 61 79 20 cision that may
7c70: 62 65 0a 20 2a 20 70 72 6f 64 75 63 65 64 20 62 be. * produced b
7c80: 79 20 54 63 6c 5f 50 72 69 6e 74 44 6f 75 62 6c y Tcl_PrintDoubl
7c90: 65 2c 20 61 6e 64 20 74 68 65 20 6e 75 6d 62 65 e, and the numbe
7ca0: 72 20 6f 66 20 62 79 74 65 73 20 6f 66 20 62 75 r of bytes of bu
7cb0: 66 66 65 72 20 73 70 61 63 65 0a 20 2a 20 72 65 ffer space. * re
7cc0: 71 75 69 72 65 64 20 62 79 20 54 63 6c 5f 50 72 quired by Tcl_Pr
7cd0: 69 6e 74 44 6f 75 62 6c 65 2e 0a 20 2a 2f 0a 0a intDouble.. */..
7ce0: 23 64 65 66 69 6e 65 20 54 43 4c 5f 4d 41 58 5f #define TCL_MAX_
7cf0: 50 52 45 43 09 09 31 37 0a 23 64 65 66 69 6e 65 PREC..17.#define
7d00: 20 54 43 4c 5f 44 4f 55 42 4c 45 5f 53 50 41 43 TCL_DOUBLE_SPAC
7d10: 45 09 28 54 43 4c 5f 4d 41 58 5f 50 52 45 43 2b E.(TCL_MAX_PREC+
7d20: 31 30 29 0a 0a 2f 2a 0a 20 2a 20 44 65 66 69 6e 10)../*. * Defin
7d30: 69 74 69 6f 6e 20 66 6f 72 20 61 20 6e 75 6d 62 ition for a numb
7d40: 65 72 20 6f 66 20 62 79 74 65 73 20 6f 66 20 62 er of bytes of b
7d50: 75 66 66 65 72 20 73 70 61 63 65 20 73 75 66 66 uffer space suff
7d60: 69 63 69 65 6e 74 20 74 6f 20 68 6f 6c 64 20 74 icient to hold t
7d70: 68 65 0a 20 2a 20 73 74 72 69 6e 67 20 72 65 70 he. * string rep
7d80: 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 20 61 resentation of a
7d90: 6e 20 69 6e 74 65 67 65 72 20 69 6e 20 62 61 73 n integer in bas
7da0: 65 20 31 30 20 28 61 73 73 75 6d 69 6e 67 20 74 e 10 (assuming t
7db0: 68 65 20 65 78 69 73 74 65 6e 63 65 20 6f 66 0a he existence of.
7dc0: 20 2a 20 36 34 2d 62 69 74 20 69 6e 74 65 67 65 * 64-bit intege
7dd0: 72 73 29 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e rs).. */..#defin
7de0: 65 20 54 43 4c 5f 49 4e 54 45 47 45 52 5f 53 50 e TCL_INTEGER_SP
7df0: 41 43 45 09 28 33 2a 28 69 6e 74 29 73 69 7a 65 ACE.(3*(int)size
7e00: 6f 66 28 54 63 6c 5f 57 69 64 65 49 6e 74 29 29 of(Tcl_WideInt))
7e10: 0a 0a 2f 2a 0a 20 2a 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 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
7e50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
7e60: 2d 2d 2d 0a 20 2a 20 54 79 70 65 20 76 61 6c 75 ---. * Type valu
7e70: 65 73 20 72 65 74 75 72 6e 65 64 20 62 79 20 54 es returned by T
7e80: 63 6c 5f 47 65 74 4e 75 6d 62 65 72 46 72 6f 6d cl_GetNumberFrom
7e90: 4f 62 6a 0a 20 2a 09 54 43 4c 5f 4e 55 4d 42 45 Obj. *.TCL_NUMBE
7ea0: 52 5f 49 4e 54 09 09 52 65 70 72 65 73 65 6e 74 R_INT..Represent
7eb0: 61 74 69 6f 6e 20 69 73 20 61 20 54 63 6c 5f 57 ation is a Tcl_W
7ec0: 69 64 65 49 6e 74 0a 20 2a 09 54 43 4c 5f 4e 55 ideInt. *.TCL_NU
7ed0: 4d 42 45 52 5f 42 49 47 09 09 52 65 70 72 65 73 MBER_BIG..Repres
7ee0: 65 6e 74 61 74 69 6f 6e 20 69 73 20 61 6e 20 6d entation is an m
7ef0: 70 5f 69 6e 74 0a 20 2a 09 54 43 4c 5f 4e 55 4d p_int. *.TCL_NUM
7f00: 42 45 52 5f 44 4f 55 42 4c 45 09 52 65 70 72 65 BER_DOUBLE.Repre
7f10: 73 65 6e 74 61 74 69 6f 6e 20 69 73 20 61 20 64 sentation is a d
7f20: 6f 75 62 6c 65 0a 20 2a 09 54 43 4c 5f 4e 55 4d ouble. *.TCL_NUM
7f30: 42 45 52 5f 4e 41 4e 09 09 56 61 6c 75 65 20 69 BER_NAN..Value i
7f40: 73 20 4e 61 4e 2e 0a 20 2a 2f 0a 0a 23 64 65 66 s NaN.. */..#def
7f50: 69 6e 65 20 54 43 4c 5f 4e 55 4d 42 45 52 5f 49 ine TCL_NUMBER_I
7f60: 4e 54 09 09 32 0a 23 64 65 66 69 6e 65 20 54 43 NT..2.#define TC
7f70: 4c 5f 4e 55 4d 42 45 52 5f 42 49 47 09 09 33 0a L_NUMBER_BIG..3.
7f80: 23 64 65 66 69 6e 65 20 54 43 4c 5f 4e 55 4d 42 #define TCL_NUMB
7f90: 45 52 5f 44 4f 55 42 4c 45 09 34 0a 23 64 65 66 ER_DOUBLE.4.#def
7fa0: 69 6e 65 20 54 43 4c 5f 4e 55 4d 42 45 52 5f 4e ine TCL_NUMBER_N
7fb0: 41 4e 09 09 35 0a 0a 2f 2a 0a 20 2a 20 46 6c 61 AN..5../*. * Fla
7fc0: 67 20 76 61 6c 75 65 73 20 70 61 73 73 65 64 20 g values passed
7fd0: 74 6f 20 54 63 6c 5f 43 6f 6e 76 65 72 74 45 6c to Tcl_ConvertEl
7fe0: 65 6d 65 6e 74 2e 0a 20 2a 20 54 43 4c 5f 44 4f ement.. * TCL_DO
7ff0: 4e 54 5f 55 53 45 5f 42 52 41 43 45 53 20 66 6f NT_USE_BRACES fo
8000: 72 63 65 73 20 69 74 20 6e 6f 74 20 74 6f 20 65 rces it not to e
8010: 6e 63 6c 6f 73 65 20 74 68 65 20 65 6c 65 6d 65 nclose the eleme
8020: 6e 74 20 69 6e 20 62 72 61 63 65 73 2c 20 62 75 nt in braces, bu
8030: 74 20 74 6f 0a 20 2a 09 75 73 65 20 62 61 63 6b t to. *.use back
8040: 73 6c 61 73 68 20 71 75 6f 74 69 6e 67 20 69 6e slash quoting in
8050: 73 74 65 61 64 2e 0a 20 2a 20 54 43 4c 5f 44 4f stead.. * TCL_DO
8060: 4e 54 5f 51 55 4f 54 45 5f 48 41 53 48 20 64 69 NT_QUOTE_HASH di
8070: 73 61 62 6c 65 73 20 74 68 65 20 64 65 66 61 75 sables the defau
8080: 6c 74 20 71 75 6f 74 69 6e 67 20 6f 66 20 74 68 lt quoting of th
8090: 65 20 27 23 27 20 63 68 61 72 61 63 74 65 72 2e e '#' character.
80a0: 20 49 74 0a 20 2a 09 69 73 20 73 61 66 65 20 74 It. *.is safe t
80b0: 6f 20 6c 65 61 76 65 20 74 68 65 20 68 61 73 68 o leave the hash
80c0: 20 75 6e 71 75 6f 74 65 64 20 77 68 65 6e 20 74 unquoted when t
80d0: 68 65 20 65 6c 65 6d 65 6e 74 20 69 73 20 6e 6f he element is no
80e0: 74 20 74 68 65 20 66 69 72 73 74 0a 20 2a 09 65 t the first. *.e
80f0: 6c 65 6d 65 6e 74 20 6f 66 20 61 20 6c 69 73 74 lement of a list
8100: 2c 20 61 6e 64 20 74 68 69 73 20 66 6c 61 67 20 , and this flag
8110: 63 61 6e 20 62 65 20 75 73 65 64 20 62 79 20 74 can be used by t
8120: 68 65 20 63 61 6c 6c 65 72 20 74 6f 20 69 6e 64 he caller to ind
8130: 69 63 61 74 65 0a 20 2a 09 74 68 61 74 20 63 6f icate. *.that co
8140: 6e 64 69 74 69 6f 6e 2e 0a 20 2a 2f 0a 0a 23 64 ndition.. */..#d
8150: 65 66 69 6e 65 20 54 43 4c 5f 44 4f 4e 54 5f 55 efine TCL_DONT_U
8160: 53 45 5f 42 52 41 43 45 53 09 31 0a 23 64 65 66 SE_BRACES.1.#def
8170: 69 6e 65 20 54 43 4c 5f 44 4f 4e 54 5f 51 55 4f ine TCL_DONT_QUO
8180: 54 45 5f 48 41 53 48 09 38 0a 0a 2f 2a 0a 20 2a TE_HASH.8../*. *
8190: 20 46 6c 61 67 73 20 74 68 61 74 20 6d 61 79 20 Flags that may
81a0: 62 65 20 70 61 73 73 65 64 20 74 6f 20 54 63 6c be passed to Tcl
81b0: 5f 47 65 74 49 6e 64 65 78 46 72 6f 6d 4f 62 6a _GetIndexFromObj
81c0: 2e 0a 20 2a 20 54 43 4c 5f 45 58 41 43 54 20 64 .. * TCL_EXACT d
81d0: 69 73 61 6c 6c 6f 77 73 20 61 62 62 72 65 76 69 isallows abbrevi
81e0: 61 74 65 64 20 73 74 72 69 6e 67 73 2e 0a 20 2a ated strings.. *
81f0: 20 54 43 4c 5f 4e 55 4c 4c 5f 4f 4b 20 61 6c 6c TCL_NULL_OK all
8200: 6f 77 73 20 74 68 65 20 65 6d 70 74 79 20 73 74 ows the empty st
8210: 72 69 6e 67 20 6f 72 20 4e 55 4c 4c 20 74 6f 20 ring or NULL to
8220: 72 65 74 75 72 6e 20 54 43 4c 5f 4f 4b 2e 0a 20 return TCL_OK..
8230: 2a 20 20 20 20 20 20 54 68 65 20 72 65 74 75 72 * The retur
8240: 6e 65 64 20 76 61 6c 75 65 20 77 69 6c 6c 20 62 ned value will b
8250: 65 20 2d 31 3b 0a 20 2a 20 54 43 4c 5f 49 4e 44 e -1;. * TCL_IND
8260: 45 58 5f 54 45 4d 50 5f 54 41 42 4c 45 20 64 69 EX_TEMP_TABLE di
8270: 73 61 6c 6c 6f 77 73 20 63 61 63 68 69 6e 67 20 sallows caching
8280: 6f 66 20 6c 6f 6f 6b 75 70 73 2e 20 41 20 70 6f of lookups. A po
8290: 73 73 69 62 6c 65 20 75 73 65 20 63 61 73 65 20 ssible use case
82a0: 69 73 0a 20 2a 20 20 20 20 20 20 61 20 74 61 62 is. * a tab
82b0: 6c 65 20 74 68 61 74 20 77 69 6c 6c 20 6e 6f 74 le that will not
82c0: 20 6c 69 76 65 20 6c 6f 6e 67 20 65 6e 6f 75 67 live long enoug
82d0: 68 20 74 6f 20 6d 61 6b 65 20 69 74 20 77 6f 72 h to make it wor
82e0: 74 68 77 68 69 6c 65 2e 0a 20 2a 2f 0a 0a 23 64 thwhile.. */..#d
82f0: 65 66 69 6e 65 20 54 43 4c 5f 45 58 41 43 54 09 efine TCL_EXACT.
8300: 09 31 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4e .1.#define TCL_N
8310: 55 4c 4c 5f 4f 4b 09 09 33 32 0a 23 64 65 66 69 ULL_OK..32.#defi
8320: 6e 65 20 54 43 4c 5f 49 4e 44 45 58 5f 54 45 4d ne TCL_INDEX_TEM
8330: 50 5f 54 41 42 4c 45 09 36 34 0a 0a 2f 2a 0a 20 P_TABLE.64../*.
8340: 2a 20 46 6c 61 67 73 20 74 68 61 74 20 6d 61 79 * Flags that may
8350: 20 62 65 20 70 61 73 73 65 64 20 74 6f 20 54 63 be passed to Tc
8360: 6c 5f 55 6e 69 43 68 61 72 54 6f 55 74 66 2e 0a l_UniCharToUtf..
8370: 20 2a 20 54 43 4c 5f 43 4f 4d 42 49 4e 45 20 43 * TCL_COMBINE C
8380: 6f 6d 62 69 6e 65 20 73 75 72 72 6f 67 61 74 65 ombine surrogate
8390: 73 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 s. */..#define T
83a0: 43 4c 5f 43 4f 4d 42 49 4e 45 09 09 30 78 31 30 CL_COMBINE..0x10
83b0: 30 30 30 30 30 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 00000./*. *-----
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 2d 2d 2d 2d 2d ----------------
83f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
8400: 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 46 6c 61 67 20 -------. * Flag
8410: 76 61 6c 75 65 73 20 70 61 73 73 65 64 20 74 6f values passed to
8420: 20 54 63 6c 5f 52 65 63 6f 72 64 41 6e 64 45 76 Tcl_RecordAndEv
8430: 61 6c 2c 20 54 63 6c 5f 45 76 61 6c 4f 62 6a 2c al, Tcl_EvalObj,
8440: 20 54 63 6c 5f 45 76 61 6c 4f 62 6a 76 2e 0a 20 Tcl_EvalObjv..
8450: 2a 20 57 41 52 4e 49 4e 47 3a 20 74 68 65 73 65 * WARNING: these
8460: 20 62 69 74 20 63 68 6f 69 63 65 73 20 6d 75 73 bit choices mus
8470: 74 20 6e 6f 74 20 63 6f 6e 66 6c 69 63 74 20 77 t not conflict w
8480: 69 74 68 20 74 68 65 20 62 69 74 20 63 68 6f 69 ith the bit choi
8490: 63 65 73 20 66 6f 72 0a 20 2a 20 65 76 61 6c 46 ces for. * evalF
84a0: 6c 61 67 20 62 69 74 73 20 69 6e 20 74 63 6c 49 lag bits in tclI
84b0: 6e 74 2e 68 21 0a 20 2a 0a 20 2a 20 4d 65 61 6e nt.h!. *. * Mean
84c0: 69 6e 67 73 3a 0a 20 2a 09 54 43 4c 5f 4e 4f 5f ings:. *.TCL_NO_
84d0: 45 56 41 4c 3a 09 09 4a 75 73 74 20 72 65 63 6f EVAL:..Just reco
84e0: 72 64 20 74 68 69 73 20 63 6f 6d 6d 61 6e 64 0a rd this command.
84f0: 20 2a 09 54 43 4c 5f 45 56 41 4c 5f 47 4c 4f 42 *.TCL_EVAL_GLOB
8500: 41 4c 3a 09 45 78 65 63 75 74 65 20 73 63 72 69 AL:.Execute scri
8510: 70 74 20 69 6e 20 67 6c 6f 62 61 6c 20 6e 61 6d pt in global nam
8520: 65 73 70 61 63 65 0a 20 2a 09 54 43 4c 5f 45 56 espace. *.TCL_EV
8530: 41 4c 5f 44 49 52 45 43 54 3a 09 44 6f 20 6e 6f AL_DIRECT:.Do no
8540: 74 20 63 6f 6d 70 69 6c 65 20 74 68 69 73 20 73 t compile this s
8550: 63 72 69 70 74 0a 20 2a 09 54 43 4c 5f 45 56 41 cript. *.TCL_EVA
8560: 4c 5f 49 4e 56 4f 4b 45 3a 09 4d 61 67 69 63 61 L_INVOKE:.Magica
8570: 6c 20 54 63 6c 5f 45 76 61 6c 4f 62 6a 76 20 6d l Tcl_EvalObjv m
8580: 6f 64 65 20 66 6f 72 20 61 6c 69 61 73 65 73 2f ode for aliases/
8590: 65 6e 73 65 6d 62 6c 65 73 0a 20 2a 09 09 09 09 ensembles. *....
85a0: 6f 20 52 75 6e 20 69 6e 20 69 50 74 72 2d 3e 6c o Run in iPtr->l
85b0: 6f 6f 6b 75 70 4e 73 50 74 72 20 6f 72 20 67 6c ookupNsPtr or gl
85c0: 6f 62 61 6c 20 6e 61 6d 65 73 70 61 63 65 0a 20 obal namespace.
85d0: 2a 09 09 09 09 6f 20 43 75 74 20 6f 75 74 20 6f *....o Cut out o
85e0: 66 20 65 72 72 6f 72 20 74 72 61 63 65 73 0a 20 f error traces.
85f0: 2a 09 09 09 09 6f 20 44 6f 6e 27 74 20 72 65 73 *....o Don't res
8600: 65 74 20 74 68 65 20 66 6c 61 67 73 20 63 6f 6e et the flags con
8610: 74 72 6f 6c 6c 69 6e 67 20 65 6e 73 65 6d 62 6c trolling ensembl
8620: 65 0a 20 2a 09 09 09 09 20 20 65 72 72 6f 72 20 e. *.... error
8630: 6d 65 73 73 61 67 65 20 72 65 77 72 69 74 69 6e message rewritin
8640: 67 2e 0a 20 2a 09 54 43 4c 5f 43 41 4e 43 45 4c g.. *.TCL_CANCEL
8650: 5f 55 4e 57 49 4e 44 3a 09 4d 61 67 69 63 61 6c _UNWIND:.Magical
8660: 20 54 63 6c 5f 43 61 6e 63 65 6c 45 76 61 6c 20 Tcl_CancelEval
8670: 6d 6f 64 65 20 74 68 61 74 20 63 61 75 73 65 73 mode that causes
8680: 20 74 68 65 0a 20 2a 09 09 09 09 73 74 61 63 6b the. *....stack
8690: 20 66 6f 72 20 74 68 65 20 73 63 72 69 70 74 20 for the script
86a0: 69 6e 20 70 72 6f 67 72 65 73 73 20 74 6f 20 62 in progress to b
86b0: 65 0a 20 2a 09 09 09 09 63 6f 6d 70 6c 65 74 65 e. *....complete
86c0: 6c 79 20 75 6e 77 6f 75 6e 64 2e 0a 20 2a 09 54 ly unwound.. *.T
86d0: 43 4c 5f 45 56 41 4c 5f 4e 4f 45 52 52 3a 09 09 CL_EVAL_NOERR:..
86e0: 44 6f 20 6e 6f 20 65 78 63 65 70 74 69 6f 6e 20 Do no exception
86f0: 72 65 70 6f 72 74 69 6e 67 20 61 74 20 61 6c 6c reporting at all
8700: 2c 20 6a 75 73 74 20 72 65 74 75 72 6e 0a 20 2a , just return. *
8710: 09 09 09 09 61 73 20 74 68 65 20 63 61 6c 6c 65 ....as the calle
8720: 72 20 77 69 6c 6c 20 72 65 70 6f 72 74 2e 0a 20 r will report..
8730: 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f */..#define TCL_
8740: 4e 4f 5f 45 56 41 4c 09 09 30 78 30 31 30 30 30 NO_EVAL..0x01000
8750: 30 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 45 56 0.#define TCL_EV
8760: 41 4c 5f 47 4c 4f 42 41 4c 09 09 30 78 30 32 30 AL_GLOBAL..0x020
8770: 30 30 30 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 000.#define TCL_
8780: 45 56 41 4c 5f 44 49 52 45 43 54 09 09 30 78 30 EVAL_DIRECT..0x0
8790: 34 30 30 30 30 0a 23 64 65 66 69 6e 65 20 54 43 40000.#define TC
87a0: 4c 5f 45 56 41 4c 5f 49 4e 56 4f 4b 45 09 09 30 L_EVAL_INVOKE..0
87b0: 78 30 38 30 30 30 30 0a 23 64 65 66 69 6e 65 20 x080000.#define
87c0: 54 43 4c 5f 43 41 4e 43 45 4c 5f 55 4e 57 49 4e TCL_CANCEL_UNWIN
87d0: 44 09 30 78 31 30 30 30 30 30 0a 23 64 65 66 69 D.0x100000.#defi
87e0: 6e 65 20 54 43 4c 5f 45 56 41 4c 5f 4e 4f 45 52 ne TCL_EVAL_NOER
87f0: 52 09 09 30 78 32 30 30 30 30 30 0a 0a 2f 2a 0a R..0x200000../*.
8800: 20 2a 20 53 70 65 63 69 61 6c 20 66 72 65 65 50 * Special freeP
8810: 72 6f 63 20 76 61 6c 75 65 73 20 74 68 61 74 20 roc values that
8820: 6d 61 79 20 62 65 20 70 61 73 73 65 64 20 74 6f may be passed to
8830: 20 54 63 6c 5f 53 65 74 52 65 73 75 6c 74 20 28 Tcl_SetResult (
8840: 73 65 65 20 74 68 65 20 6d 61 6e 0a 20 2a 20 70 see the man. * p
8850: 61 67 65 20 66 6f 72 20 64 65 74 61 69 6c 73 29 age for details)
8860: 3a 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 :. */..#define T
8870: 43 4c 5f 56 4f 4c 41 54 49 4c 45 09 09 28 28 54 CL_VOLATILE..((T
8880: 63 6c 5f 46 72 65 65 50 72 6f 63 20 2a 29 20 31 cl_FreeProc *) 1
8890: 29 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 53 54 ).#define TCL_ST
88a0: 41 54 49 43 09 09 28 28 54 63 6c 5f 46 72 65 65 ATIC..((Tcl_Free
88b0: 50 72 6f 63 20 2a 29 20 30 29 0a 23 64 65 66 69 Proc *) 0).#defi
88c0: 6e 65 20 54 43 4c 5f 44 59 4e 41 4d 49 43 09 09 ne TCL_DYNAMIC..
88d0: 28 28 54 63 6c 5f 46 72 65 65 50 72 6f 63 20 2a ((Tcl_FreeProc *
88e0: 29 20 33 29 0a 0a 2f 2a 0a 20 2a 20 46 6c 61 67 ) 3)../*. * Flag
88f0: 20 76 61 6c 75 65 73 20 70 61 73 73 65 64 20 74 values passed t
8900: 6f 20 76 61 72 69 61 62 6c 65 2d 72 65 6c 61 74 o variable-relat
8910: 65 64 20 66 75 6e 63 74 69 6f 6e 73 2e 0a 20 2a ed functions.. *
8920: 20 57 41 52 4e 49 4e 47 3a 20 74 68 65 73 65 20 WARNING: these
8930: 62 69 74 20 63 68 6f 69 63 65 73 20 6d 75 73 74 bit choices must
8940: 20 6e 6f 74 20 63 6f 6e 66 6c 69 63 74 20 77 69 not conflict wi
8950: 74 68 20 74 68 65 20 62 69 74 20 63 68 6f 69 63 th the bit choic
8960: 65 20 66 6f 72 0a 20 2a 20 54 43 4c 5f 43 41 4e e for. * TCL_CAN
8970: 43 45 4c 5f 55 4e 57 49 4e 44 2c 20 61 62 6f 76 CEL_UNWIND, abov
8980: 65 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 e.. */..#define
8990: 54 43 4c 5f 47 4c 4f 42 41 4c 5f 4f 4e 4c 59 09 TCL_GLOBAL_ONLY.
89a0: 09 20 31 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f . 1.#define TCL_
89b0: 4e 41 4d 45 53 50 41 43 45 5f 4f 4e 4c 59 09 20 NAMESPACE_ONLY.
89c0: 32 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 41 50 2.#define TCL_AP
89d0: 50 45 4e 44 5f 56 41 4c 55 45 09 20 34 0a 23 64 PEND_VALUE. 4.#d
89e0: 65 66 69 6e 65 20 54 43 4c 5f 4c 49 53 54 5f 45 efine TCL_LIST_E
89f0: 4c 45 4d 45 4e 54 09 20 38 0a 23 64 65 66 69 6e LEMENT. 8.#defin
8a00: 65 20 54 43 4c 5f 54 52 41 43 45 5f 52 45 41 44 e TCL_TRACE_READ
8a10: 53 09 09 20 30 78 31 30 0a 23 64 65 66 69 6e 65 S.. 0x10.#define
8a20: 20 54 43 4c 5f 54 52 41 43 45 5f 57 52 49 54 45 TCL_TRACE_WRITE
8a30: 53 09 20 30 78 32 30 0a 23 64 65 66 69 6e 65 20 S. 0x20.#define
8a40: 54 43 4c 5f 54 52 41 43 45 5f 55 4e 53 45 54 53 TCL_TRACE_UNSETS
8a50: 09 20 30 78 34 30 0a 23 64 65 66 69 6e 65 20 54 . 0x40.#define T
8a60: 43 4c 5f 54 52 41 43 45 5f 44 45 53 54 52 4f 59 CL_TRACE_DESTROY
8a70: 45 44 09 20 30 78 38 30 0a 0a 23 64 65 66 69 6e ED. 0x80..#defin
8a80: 65 20 54 43 4c 5f 4c 45 41 56 45 5f 45 52 52 5f e TCL_LEAVE_ERR_
8a90: 4d 53 47 09 20 30 78 32 30 30 0a 23 64 65 66 69 MSG. 0x200.#defi
8aa0: 6e 65 20 54 43 4c 5f 54 52 41 43 45 5f 41 52 52 ne TCL_TRACE_ARR
8ab0: 41 59 09 09 20 30 78 38 30 30 0a 2f 2a 20 49 6e AY.. 0x800./* In
8ac0: 64 69 63 61 74 65 20 74 68 65 20 73 65 6d 61 6e dicate the seman
8ad0: 74 69 63 73 20 6f 66 20 74 68 65 20 72 65 73 75 tics of the resu
8ae0: 6c 74 20 6f 66 20 61 20 74 72 61 63 65 2e 20 2a lt of a trace. *
8af0: 2f 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 54 52 /.#define TCL_TR
8b00: 41 43 45 5f 52 45 53 55 4c 54 5f 44 59 4e 41 4d ACE_RESULT_DYNAM
8b10: 49 43 20 30 78 38 30 30 30 0a 23 64 65 66 69 6e IC 0x8000.#defin
8b20: 65 20 54 43 4c 5f 54 52 41 43 45 5f 52 45 53 55 e TCL_TRACE_RESU
8b30: 4c 54 5f 4f 42 4a 45 43 54 20 20 30 78 31 30 30 LT_OBJECT 0x100
8b40: 30 30 0a 0a 2f 2a 0a 20 2a 20 46 6c 61 67 20 76 00../*. * Flag v
8b50: 61 6c 75 65 73 20 66 6f 72 20 65 6e 73 65 6d 62 alues for ensemb
8b60: 6c 65 20 63 6f 6d 6d 61 6e 64 73 2e 0a 20 2a 2f le commands.. */
8b70: 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 45 4e ..#define TCL_EN
8b80: 53 45 4d 42 4c 45 5f 50 52 45 46 49 58 20 30 78 SEMBLE_PREFIX 0x
8b90: 30 32 2f 2a 20 46 6c 61 67 20 76 61 6c 75 65 20 02/* Flag value
8ba0: 74 6f 20 73 61 79 20 77 68 65 74 68 65 72 20 74 to say whether t
8bb0: 6f 20 61 6c 6c 6f 77 0a 09 09 09 09 20 2a 20 75 o allow..... * u
8bc0: 6e 61 6d 62 69 67 75 6f 75 73 20 70 72 65 66 69 nambiguous prefi
8bd0: 78 65 73 20 6f 66 20 63 6f 6d 6d 61 6e 64 73 20 xes of commands
8be0: 6f 72 20 74 6f 0a 09 09 09 09 20 2a 20 72 65 71 or to..... * req
8bf0: 75 69 72 65 20 65 78 61 63 74 20 6d 61 74 63 68 uire exact match
8c00: 65 73 20 66 6f 72 20 63 6f 6d 6d 61 6e 64 20 6e es for command n
8c10: 61 6d 65 73 2e 20 2a 2f 0a 0a 2f 2a 0a 20 2a 20 ames. */../*. *
8c20: 46 6c 61 67 20 76 61 6c 75 65 73 20 70 61 73 73 Flag values pass
8c30: 65 64 20 74 6f 20 63 6f 6d 6d 61 6e 64 2d 72 65 ed to command-re
8c40: 6c 61 74 65 64 20 66 75 6e 63 74 69 6f 6e 73 2e lated functions.
8c50: 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 . */..#define TC
8c60: 4c 5f 54 52 41 43 45 5f 52 45 4e 41 4d 45 09 30 L_TRACE_RENAME.0
8c70: 78 32 30 30 30 0a 23 64 65 66 69 6e 65 20 54 43 x2000.#define TC
8c80: 4c 5f 54 52 41 43 45 5f 44 45 4c 45 54 45 09 30 L_TRACE_DELETE.0
8c90: 78 34 30 30 30 0a 0a 23 64 65 66 69 6e 65 20 54 x4000..#define T
8ca0: 43 4c 5f 41 4c 4c 4f 57 5f 49 4e 4c 49 4e 45 5f CL_ALLOW_INLINE_
8cb0: 43 4f 4d 50 49 4c 41 54 49 4f 4e 20 30 78 32 30 COMPILATION 0x20
8cc0: 30 30 30 0a 0a 2f 2a 0a 20 2a 20 54 79 70 65 73 000../*. * Types
8cd0: 20 66 6f 72 20 6c 69 6e 6b 65 64 20 76 61 72 69 for linked vari
8ce0: 61 62 6c 65 73 3a 0a 20 2a 2f 0a 0a 23 64 65 66 ables:. */..#def
8cf0: 69 6e 65 20 54 43 4c 5f 4c 49 4e 4b 5f 49 4e 54 ine TCL_LINK_INT
8d00: 09 09 31 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f ..1.#define TCL_
8d10: 4c 49 4e 4b 5f 44 4f 55 42 4c 45 09 09 32 0a 23 LINK_DOUBLE..2.#
8d20: 64 65 66 69 6e 65 20 54 43 4c 5f 4c 49 4e 4b 5f define TCL_LINK_
8d30: 42 4f 4f 4c 45 41 4e 09 33 0a 23 64 65 66 69 6e BOOLEAN.3.#defin
8d40: 65 20 54 43 4c 5f 4c 49 4e 4b 5f 53 54 52 49 4e e TCL_LINK_STRIN
8d50: 47 09 09 34 0a 23 64 65 66 69 6e 65 20 54 43 4c G..4.#define TCL
8d60: 5f 4c 49 4e 4b 5f 57 49 44 45 5f 49 4e 54 09 35 _LINK_WIDE_INT.5
8d70: 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4c 49 4e .#define TCL_LIN
8d80: 4b 5f 43 48 41 52 09 09 36 0a 23 64 65 66 69 6e K_CHAR..6.#defin
8d90: 65 20 54 43 4c 5f 4c 49 4e 4b 5f 55 43 48 41 52 e TCL_LINK_UCHAR
8da0: 09 09 37 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f ..7.#define TCL_
8db0: 4c 49 4e 4b 5f 53 48 4f 52 54 09 09 38 0a 23 64 LINK_SHORT..8.#d
8dc0: 65 66 69 6e 65 20 54 43 4c 5f 4c 49 4e 4b 5f 55 efine TCL_LINK_U
8dd0: 53 48 4f 52 54 09 09 39 0a 23 64 65 66 69 6e 65 SHORT..9.#define
8de0: 20 54 43 4c 5f 4c 49 4e 4b 5f 55 49 4e 54 09 09 TCL_LINK_UINT..
8df0: 31 30 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4c 10.#define TCL_L
8e00: 49 4e 4b 5f 4c 4f 4e 47 09 09 28 28 73 69 7a 65 INK_LONG..((size
8e10: 6f 66 28 6c 6f 6e 67 29 20 21 3d 20 73 69 7a 65 of(long) != size
8e20: 6f 66 28 69 6e 74 29 29 20 3f 20 54 43 4c 5f 4c of(int)) ? TCL_L
8e30: 49 4e 4b 5f 57 49 44 45 5f 49 4e 54 20 3a 20 54 INK_WIDE_INT : T
8e40: 43 4c 5f 4c 49 4e 4b 5f 49 4e 54 29 0a 23 64 65 CL_LINK_INT).#de
8e50: 66 69 6e 65 20 54 43 4c 5f 4c 49 4e 4b 5f 55 4c fine TCL_LINK_UL
8e60: 4f 4e 47 09 09 28 28 73 69 7a 65 6f 66 28 6c 6f ONG..((sizeof(lo
8e70: 6e 67 29 20 21 3d 20 73 69 7a 65 6f 66 28 69 6e ng) != sizeof(in
8e80: 74 29 29 20 3f 20 54 43 4c 5f 4c 49 4e 4b 5f 57 t)) ? TCL_LINK_W
8e90: 49 44 45 5f 55 49 4e 54 20 3a 20 54 43 4c 5f 4c IDE_UINT : TCL_L
8ea0: 49 4e 4b 5f 55 49 4e 54 29 0a 23 64 65 66 69 6e INK_UINT).#defin
8eb0: 65 20 54 43 4c 5f 4c 49 4e 4b 5f 46 4c 4f 41 54 e TCL_LINK_FLOAT
8ec0: 09 09 31 33 0a 23 64 65 66 69 6e 65 20 54 43 4c ..13.#define TCL
8ed0: 5f 4c 49 4e 4b 5f 57 49 44 45 5f 55 49 4e 54 09 _LINK_WIDE_UINT.
8ee0: 31 34 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4c 14.#define TCL_L
8ef0: 49 4e 4b 5f 43 48 41 52 53 09 09 31 35 0a 23 64 INK_CHARS..15.#d
8f00: 65 66 69 6e 65 20 54 43 4c 5f 4c 49 4e 4b 5f 42 efine TCL_LINK_B
8f10: 49 4e 41 52 59 09 09 31 36 0a 23 64 65 66 69 6e INARY..16.#defin
8f20: 65 20 54 43 4c 5f 4c 49 4e 4b 5f 52 45 41 44 5f e TCL_LINK_READ_
8f30: 4f 4e 4c 59 09 30 78 38 30 0a 0a 2f 2a 0a 20 2a ONLY.0x80../*. *
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: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
8f80: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 ------------. *
8f90: 46 6f 72 77 61 72 64 20 64 65 63 6c 61 72 61 74 Forward declarat
8fa0: 69 6f 6e 73 20 6f 66 20 54 63 6c 5f 48 61 73 68 ions of Tcl_Hash
8fb0: 54 61 62 6c 65 20 61 6e 64 20 72 65 6c 61 74 65 Table and relate
8fc0: 64 20 74 79 70 65 73 2e 0a 20 2a 2f 0a 0a 23 69 d types.. */..#i
8fd0: 66 20 21 64 65 66 69 6e 65 64 28 54 43 4c 5f 48 f !defined(TCL_H
8fe0: 41 53 48 5f 54 59 50 45 29 20 26 26 20 21 64 65 ASH_TYPE) && !de
8ff0: 66 69 6e 65 64 20 28 54 43 4c 5f 4e 4f 5f 44 45 fined (TCL_NO_DE
9000: 50 52 45 43 41 54 45 44 29 0a 23 20 20 20 64 65 PRECATED).# de
9010: 66 69 6e 65 20 54 43 4c 5f 48 41 53 48 5f 54 59 fine TCL_HASH_TY
9020: 50 45 20 73 69 7a 65 5f 74 0a 23 65 6e 64 69 66 PE size_t.#endif
9030: 0a 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 74 ..typedef struct
9040: 20 54 63 6c 5f 48 61 73 68 4b 65 79 54 79 70 65 Tcl_HashKeyType
9050: 20 54 63 6c 5f 48 61 73 68 4b 65 79 54 79 70 65 Tcl_HashKeyType
9060: 3b 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 74 ;.typedef struct
9070: 20 54 63 6c 5f 48 61 73 68 54 61 62 6c 65 20 54 Tcl_HashTable T
9080: 63 6c 5f 48 61 73 68 54 61 62 6c 65 3b 0a 74 79 cl_HashTable;.ty
9090: 70 65 64 65 66 20 73 74 72 75 63 74 20 54 63 6c pedef struct Tcl
90a0: 5f 48 61 73 68 45 6e 74 72 79 20 54 63 6c 5f 48 _HashEntry Tcl_H
90b0: 61 73 68 45 6e 74 72 79 3b 0a 0a 74 79 70 65 64 ashEntry;..typed
90c0: 65 66 20 73 69 7a 65 5f 74 20 28 54 63 6c 5f 48 ef size_t (Tcl_H
90d0: 61 73 68 4b 65 79 50 72 6f 63 29 20 28 54 63 6c ashKeyProc) (Tcl
90e0: 5f 48 61 73 68 54 61 62 6c 65 20 2a 74 61 62 6c _HashTable *tabl
90f0: 65 50 74 72 2c 20 76 6f 69 64 20 2a 6b 65 79 50 ePtr, void *keyP
9100: 74 72 29 3b 0a 74 79 70 65 64 65 66 20 69 6e 74 tr);.typedef int
9110: 20 28 54 63 6c 5f 43 6f 6d 70 61 72 65 48 61 73 (Tcl_CompareHas
9120: 68 4b 65 79 73 50 72 6f 63 29 20 28 76 6f 69 64 hKeysProc) (void
9130: 20 2a 6b 65 79 50 74 72 2c 20 54 63 6c 5f 48 61 *keyPtr, Tcl_Ha
9140: 73 68 45 6e 74 72 79 20 2a 68 50 74 72 29 3b 0a shEntry *hPtr);.
9150: 74 79 70 65 64 65 66 20 54 63 6c 5f 48 61 73 68 typedef Tcl_Hash
9160: 45 6e 74 72 79 20 2a 20 28 54 63 6c 5f 41 6c 6c Entry * (Tcl_All
9170: 6f 63 48 61 73 68 45 6e 74 72 79 50 72 6f 63 29 ocHashEntryProc)
9180: 20 28 54 63 6c 5f 48 61 73 68 54 61 62 6c 65 20 (Tcl_HashTable
9190: 2a 74 61 62 6c 65 50 74 72 2c 0a 09 76 6f 69 64 *tablePtr,..void
91a0: 20 2a 6b 65 79 50 74 72 29 3b 0a 74 79 70 65 64 *keyPtr);.typed
91b0: 65 66 20 76 6f 69 64 20 28 54 63 6c 5f 46 72 65 ef void (Tcl_Fre
91c0: 65 48 61 73 68 45 6e 74 72 79 50 72 6f 63 29 20 eHashEntryProc)
91d0: 28 54 63 6c 5f 48 61 73 68 45 6e 74 72 79 20 2a (Tcl_HashEntry *
91e0: 68 50 74 72 29 3b 0a 0a 2f 2a 0a 20 2a 20 53 74 hPtr);../*. * St
91f0: 72 75 63 74 75 72 65 20 64 65 66 69 6e 69 74 69 ructure definiti
9200: 6f 6e 20 66 6f 72 20 61 6e 20 65 6e 74 72 79 20 on for an entry
9210: 69 6e 20 61 20 68 61 73 68 20 74 61 62 6c 65 2e in a hash table.
9220: 20 4e 6f 2d 6f 6e 65 20 6f 75 74 73 69 64 65 20 No-one outside
9230: 54 63 6c 0a 20 2a 20 73 68 6f 75 6c 64 20 61 63 Tcl. * should ac
9240: 63 65 73 73 20 61 6e 79 20 6f 66 20 74 68 65 73 cess any of thes
9250: 65 20 66 69 65 6c 64 73 20 64 69 72 65 63 74 6c e fields directl
9260: 79 3b 20 75 73 65 20 74 68 65 20 6d 61 63 72 6f y; use the macro
9270: 73 20 64 65 66 69 6e 65 64 20 62 65 6c 6f 77 2e s defined below.
9280: 0a 20 2a 2f 0a 0a 73 74 72 75 63 74 20 54 63 6c . */..struct Tcl
9290: 5f 48 61 73 68 45 6e 74 72 79 20 7b 0a 20 20 20 _HashEntry {.
92a0: 20 54 63 6c 5f 48 61 73 68 45 6e 74 72 79 20 2a Tcl_HashEntry *
92b0: 6e 65 78 74 50 74 72 3b 09 2f 2a 20 50 6f 69 6e nextPtr;./* Poin
92c0: 74 65 72 20 74 6f 20 6e 65 78 74 20 65 6e 74 72 ter to next entr
92d0: 79 20 69 6e 20 74 68 69 73 20 68 61 73 68 20 62 y in this hash b
92e0: 75 63 6b 65 74 2c 0a 09 09 09 09 20 2a 20 6f 72 ucket,..... * or
92f0: 20 4e 55 4c 4c 20 66 6f 72 20 65 6e 64 20 6f 66 NULL for end of
9300: 20 63 68 61 69 6e 2e 20 2a 2f 0a 20 20 20 20 54 chain. */. T
9310: 63 6c 5f 48 61 73 68 54 61 62 6c 65 20 2a 74 61 cl_HashTable *ta
9320: 62 6c 65 50 74 72 3b 09 2f 2a 20 50 6f 69 6e 74 blePtr;./* Point
9330: 65 72 20 74 6f 20 74 61 62 6c 65 20 63 6f 6e 74 er to table cont
9340: 61 69 6e 69 6e 67 20 65 6e 74 72 79 2e 20 2a 2f aining entry. */
9350: 0a 20 20 20 20 73 69 7a 65 5f 74 20 68 61 73 68 . size_t hash
9360: 3b 09 09 2f 2a 20 48 61 73 68 20 76 61 6c 75 65 ;../* Hash value
9370: 2e 20 2a 2f 0a 20 20 20 20 76 6f 69 64 20 2a 63 . */. void *c
9380: 6c 69 65 6e 74 44 61 74 61 3b 09 09 2f 2a 20 41 lientData;../* A
9390: 70 70 6c 69 63 61 74 69 6f 6e 20 73 74 6f 72 65 pplication store
93a0: 73 20 73 6f 6d 65 74 68 69 6e 67 20 68 65 72 65 s something here
93b0: 20 77 69 74 68 0a 09 09 09 09 20 2a 20 54 63 6c with..... * Tcl
93c0: 5f 53 65 74 48 61 73 68 56 61 6c 75 65 2e 20 2a _SetHashValue. *
93d0: 2f 0a 20 20 20 20 75 6e 69 6f 6e 20 7b 09 09 09 /. union {...
93e0: 2f 2a 20 4b 65 79 20 68 61 73 20 6f 6e 65 20 6f /* Key has one o
93f0: 66 20 74 68 65 73 65 20 66 6f 72 6d 73 3a 20 2a f these forms: *
9400: 2f 0a 09 63 68 61 72 20 2a 6f 6e 65 57 6f 72 64 /..char *oneWord
9410: 56 61 6c 75 65 3b 09 2f 2a 20 4f 6e 65 2d 77 6f Value;./* One-wo
9420: 72 64 20 76 61 6c 75 65 20 66 6f 72 20 6b 65 79 rd value for key
9430: 2e 20 2a 2f 0a 09 54 63 6c 5f 4f 62 6a 20 2a 6f . */..Tcl_Obj *o
9440: 62 6a 50 74 72 3b 09 2f 2a 20 54 63 6c 5f 4f 62 bjPtr;./* Tcl_Ob
9450: 6a 20 2a 20 6b 65 79 20 76 61 6c 75 65 2e 20 2a j * key value. *
9460: 2f 0a 09 69 6e 74 20 77 6f 72 64 73 5b 31 5d 3b /..int words[1];
9470: 09 09 2f 2a 20 4d 75 6c 74 69 70 6c 65 20 69 6e ../* Multiple in
9480: 74 65 67 65 72 20 77 6f 72 64 73 20 66 6f 72 20 teger words for
9490: 6b 65 79 2e 20 54 68 65 20 61 63 74 75 61 6c 0a key. The actual.
94a0: 09 09 09 09 20 2a 20 73 69 7a 65 20 77 69 6c 6c .... * size will
94b0: 20 62 65 20 61 73 20 6c 61 72 67 65 20 61 73 20 be as large as
94c0: 6e 65 63 65 73 73 61 72 79 20 66 6f 72 20 74 68 necessary for th
94d0: 69 73 0a 09 09 09 09 20 2a 20 74 61 62 6c 65 27 is..... * table'
94e0: 73 20 6b 65 79 73 2e 20 2a 2f 0a 09 63 68 61 72 s keys. */..char
94f0: 20 73 74 72 69 6e 67 5b 31 5d 3b 09 09 2f 2a 20 string[1];../*
9500: 53 74 72 69 6e 67 20 66 6f 72 20 6b 65 79 2e 20 String for key.
9510: 54 68 65 20 61 63 74 75 61 6c 20 73 69 7a 65 20 The actual size
9520: 77 69 6c 6c 20 62 65 20 61 73 0a 09 09 09 09 20 will be as.....
9530: 2a 20 6c 61 72 67 65 20 61 73 20 6e 65 65 64 65 * large as neede
9540: 64 20 74 6f 20 68 6f 6c 64 20 74 68 65 20 6b 65 d to hold the ke
9550: 79 2e 20 2a 2f 0a 20 20 20 20 7d 20 6b 65 79 3b y. */. } key;
9560: 09 09 09 2f 2a 20 4d 55 53 54 20 42 45 20 4c 41 .../* MUST BE LA
9570: 53 54 20 46 49 45 4c 44 20 49 4e 20 52 45 43 4f ST FIELD IN RECO
9580: 52 44 21 21 20 2a 2f 0a 7d 3b 0a 0a 2f 2a 0a 20 RD!! */.};../*.
9590: 2a 20 46 6c 61 67 73 20 75 73 65 64 20 69 6e 20 * Flags used in
95a0: 54 63 6c 5f 48 61 73 68 4b 65 79 54 79 70 65 2e Tcl_HashKeyType.
95b0: 0a 20 2a 0a 20 2a 20 54 43 4c 5f 48 41 53 48 5f . *. * TCL_HASH_
95c0: 4b 45 59 5f 52 41 4e 44 4f 4d 49 5a 45 5f 48 41 KEY_RANDOMIZE_HA
95d0: 53 48 20 2d 0a 20 2a 09 09 09 09 54 68 65 72 65 SH -. *....There
95e0: 20 61 72 65 20 73 6f 6d 65 20 74 68 69 6e 67 73 are some things
95f0: 2c 20 70 6f 69 6e 74 65 72 73 20 66 6f 72 20 65 , pointers for e
9600: 78 61 6d 70 6c 65 0a 20 2a 09 09 09 09 77 68 69 xample. *....whi
9610: 63 68 20 64 6f 6e 27 74 20 68 61 73 68 20 77 65 ch don't hash we
9620: 6c 6c 20 62 65 63 61 75 73 65 20 74 68 65 79 20 ll because they
9630: 64 6f 20 6e 6f 74 20 75 73 65 0a 20 2a 09 09 09 do not use. *...
9640: 09 74 68 65 20 6c 6f 77 65 72 20 62 69 74 73 2e .the lower bits.
9650: 20 49 66 20 74 68 69 73 20 66 6c 61 67 20 69 73 If this flag is
9660: 20 73 65 74 20 74 68 65 6e 20 74 68 65 0a 20 2a set then the. *
9670: 09 09 09 09 68 61 73 68 20 74 61 62 6c 65 20 77 ....hash table w
9680: 69 6c 6c 20 61 74 74 65 6d 70 74 20 74 6f 20 72 ill attempt to r
9690: 65 63 74 69 66 79 20 74 68 69 73 20 62 79 0a 20 ectify this by.
96a0: 2a 09 09 09 09 72 61 6e 64 6f 6d 69 73 69 6e 67 *....randomising
96b0: 20 74 68 65 20 62 69 74 73 20 61 6e 64 20 74 68 the bits and th
96c0: 65 6e 20 75 73 69 6e 67 20 74 68 65 20 75 70 70 en using the upp
96d0: 65 72 0a 20 2a 09 09 09 09 4e 20 62 69 74 73 20 er. *....N bits
96e0: 61 73 20 74 68 65 20 69 6e 64 65 78 20 69 6e 74 as the index int
96f0: 6f 20 74 68 65 20 74 61 62 6c 65 2e 0a 20 2a 20 o the table.. *
9700: 54 43 4c 5f 48 41 53 48 5f 4b 45 59 5f 53 59 53 TCL_HASH_KEY_SYS
9710: 54 45 4d 5f 48 41 53 48 20 2d 09 49 66 20 74 68 TEM_HASH -.If th
9720: 69 73 20 66 6c 61 67 20 69 73 20 73 65 74 20 74 is flag is set t
9730: 68 65 6e 20 61 6c 6c 20 6d 65 6d 6f 72 79 20 69 hen all memory i
9740: 6e 74 65 72 6e 61 6c 6c 79 0a 20 2a 20 20 20 20 nternally. *
9750: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
9760: 20 20 20 20 20 20 20 20 20 20 61 6c 6c 6f 63 61 alloca
9770: 74 65 64 20 66 6f 72 20 74 68 65 20 68 61 73 68 ted for the hash
9780: 20 74 61 62 6c 65 20 74 68 61 74 20 69 73 20 6e table that is n
9790: 6f 74 20 66 6f 72 20 61 6e 0a 20 2a 20 20 20 20 ot for an. *
97a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
97b0: 20 20 20 20 20 20 20 20 20 20 65 6e 74 72 79 20 entry
97c0: 77 69 6c 6c 20 75 73 65 20 74 68 65 20 73 79 73 will use the sys
97d0: 74 65 6d 20 68 65 61 70 2e 0a 20 2a 20 54 43 4c tem heap.. * TCL
97e0: 5f 48 41 53 48 5f 4b 45 59 5f 44 49 52 45 43 54 _HASH_KEY_DIRECT
97f0: 5f 43 4f 4d 50 41 52 45 20 2d 0a 20 2a 09 20 20 _COMPARE -. *.
9800: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
9810: 20 20 20 20 20 20 41 6c 6c 6f 77 73 20 66 61 73 Allows fas
9820: 74 20 63 6f 6d 70 61 72 69 73 6f 6e 20 66 6f 72 t comparison for
9830: 20 68 61 73 68 20 6b 65 79 73 20 64 69 72 65 63 hash keys direc
9840: 74 6c 79 0a 20 2a 20 20 20 20 20 20 20 20 20 20 tly. *
9850: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
9860: 20 20 20 20 62 79 20 63 6f 6d 70 61 72 65 20 6f by compare o
9870: 66 20 74 68 65 69 72 20 6b 65 79 2e 6f 6e 65 57 f their key.oneW
9880: 6f 72 64 56 61 6c 75 65 20 76 61 6c 75 65 73 2c ordValue values,
9890: 0a 20 2a 20 20 20 20 20 20 20 20 20 20 20 20 20 . *
98a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
98b0: 20 62 65 66 6f 72 65 20 63 61 6c 6c 20 6f 66 20 before call of
98c0: 63 6f 6d 70 61 72 65 4b 65 79 73 50 72 6f 63 20 compareKeysProc
98d0: 28 6d 75 63 68 20 73 6c 6f 77 65 72 0a 20 2a 20 (much slower. *
98e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
98f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 74 68 61 tha
9900: 6e 20 61 20 64 69 72 65 63 74 20 63 6f 6d 70 61 n a direct compa
9910: 72 65 2c 20 73 6f 20 69 74 20 69 73 20 73 70 65 re, so it is spe
9920: 65 64 2d 75 70 20 6f 6e 6c 79 0a 20 2a 20 20 20 ed-up only. *
9930: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
9940: 20 20 20 20 20 20 20 20 20 20 20 66 6c 61 67 29 flag)
9950: 2e 20 44 6f 6e 27 74 20 75 73 65 20 69 74 20 69 . Don't use it i
9960: 66 20 6b 65 79 73 20 63 6f 6e 74 61 69 6e 20 76 f keys contain v
9970: 61 6c 75 65 73 20 72 61 74 68 65 72 0a 20 2a 20 alues rather. *
9980: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
9990: 20 20 20 20 20 20 20 20 20 20 20 20 20 74 68 61 tha
99a0: 6e 20 70 6f 69 6e 74 65 72 73 2e 0a 20 2a 2f 0a n pointers.. */.
99b0: 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 48 41 53 .#define TCL_HAS
99c0: 48 5f 4b 45 59 5f 52 41 4e 44 4f 4d 49 5a 45 5f H_KEY_RANDOMIZE_
99d0: 48 41 53 48 20 30 78 31 0a 23 64 65 66 69 6e 65 HASH 0x1.#define
99e0: 20 54 43 4c 5f 48 41 53 48 5f 4b 45 59 5f 53 59 TCL_HASH_KEY_SY
99f0: 53 54 45 4d 5f 48 41 53 48 20 20 20 20 30 78 32 STEM_HASH 0x2
9a00: 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 48 41 53 .#define TCL_HAS
9a10: 48 5f 4b 45 59 5f 44 49 52 45 43 54 5f 43 4f 4d H_KEY_DIRECT_COM
9a20: 50 41 52 45 20 30 78 34 0a 0a 2f 2a 0a 20 2a 20 PARE 0x4../*. *
9a30: 53 74 72 75 63 74 75 72 65 20 64 65 66 69 6e 69 Structure defini
9a40: 74 69 6f 6e 20 66 6f 72 20 74 68 65 20 6d 65 74 tion for the met
9a50: 68 6f 64 73 20 61 73 73 6f 63 69 61 74 65 64 20 hods associated
9a60: 77 69 74 68 20 61 20 68 61 73 68 20 74 61 62 6c with a hash tabl
9a70: 65 20 6b 65 79 20 74 79 70 65 2e 0a 20 2a 2f 0a e key type.. */.
9a80: 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 48 41 53 .#define TCL_HAS
9a90: 48 5f 4b 45 59 5f 54 59 50 45 5f 56 45 52 53 49 H_KEY_TYPE_VERSI
9aa0: 4f 4e 20 31 0a 73 74 72 75 63 74 20 54 63 6c 5f ON 1.struct Tcl_
9ab0: 48 61 73 68 4b 65 79 54 79 70 65 20 7b 0a 20 20 HashKeyType {.
9ac0: 20 20 69 6e 74 20 76 65 72 73 69 6f 6e 3b 09 09 int version;..
9ad0: 2f 2a 20 56 65 72 73 69 6f 6e 20 6f 66 20 74 68 /* Version of th
9ae0: 65 20 74 61 62 6c 65 2e 20 49 66 20 74 68 69 73 e table. If this
9af0: 20 73 74 72 75 63 74 75 72 65 20 69 73 0a 09 09 structure is...
9b00: 09 09 20 2a 20 65 78 74 65 6e 64 65 64 20 69 6e .. * extended in
9b10: 20 66 75 74 75 72 65 20 74 68 65 6e 20 74 68 65 future then the
9b20: 20 76 65 72 73 69 6f 6e 20 63 61 6e 20 62 65 0a version can be.
9b30: 09 09 09 09 20 2a 20 75 73 65 64 20 74 6f 20 64 .... * used to d
9b40: 69 73 74 69 6e 67 75 69 73 68 20 62 65 74 77 65 istinguish betwe
9b50: 65 6e 20 64 69 66 66 65 72 65 6e 74 0a 09 09 09 en different....
9b60: 09 20 2a 20 73 74 72 75 63 74 75 72 65 73 2e 20 . * structures.
9b70: 2a 2f 0a 20 20 20 20 69 6e 74 20 66 6c 61 67 73 */. int flags
9b80: 3b 09 09 09 2f 2a 20 46 6c 61 67 73 2c 20 73 65 ;.../* Flags, se
9b90: 65 20 61 62 6f 76 65 20 66 6f 72 20 64 65 74 61 e above for deta
9ba0: 69 6c 73 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f ils. */. Tcl_
9bb0: 48 61 73 68 4b 65 79 50 72 6f 63 20 2a 68 61 73 HashKeyProc *has
9bc0: 68 4b 65 79 50 72 6f 63 3b 0a 09 09 09 09 2f 2a hKeyProc;...../*
9bd0: 20 43 61 6c 63 75 6c 61 74 65 73 20 61 20 68 61 Calculates a ha
9be0: 73 68 20 76 61 6c 75 65 20 66 6f 72 20 74 68 65 sh value for the
9bf0: 20 6b 65 79 2e 20 49 66 0a 09 09 09 09 20 2a 20 key. If..... *
9c00: 74 68 69 73 20 69 73 20 4e 55 4c 4c 20 74 68 65 this is NULL the
9c10: 6e 20 74 68 65 20 70 6f 69 6e 74 65 72 20 69 74 n the pointer it
9c20: 73 65 6c 66 20 69 73 0a 09 09 09 09 20 2a 20 75 self is..... * u
9c30: 73 65 64 20 61 73 20 61 20 68 61 73 68 20 76 61 sed as a hash va
9c40: 6c 75 65 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f lue. */. Tcl_
9c50: 43 6f 6d 70 61 72 65 48 61 73 68 4b 65 79 73 50 CompareHashKeysP
9c60: 72 6f 63 20 2a 63 6f 6d 70 61 72 65 4b 65 79 73 roc *compareKeys
9c70: 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 43 6f 6d Proc;...../* Com
9c80: 70 61 72 65 73 20 74 77 6f 20 6b 65 79 73 20 61 pares two keys a
9c90: 6e 64 20 72 65 74 75 72 6e 73 20 7a 65 72 6f 20 nd returns zero
9ca0: 69 66 20 74 68 65 79 0a 09 09 09 09 20 2a 20 64 if they..... * d
9cb0: 6f 20 6e 6f 74 20 6d 61 74 63 68 2c 20 61 6e 64 o not match, and
9cc0: 20 6e 6f 6e 2d 7a 65 72 6f 20 69 66 20 74 68 65 non-zero if the
9cd0: 79 20 64 6f 2e 20 49 66 0a 09 09 09 09 20 2a 20 y do. If..... *
9ce0: 74 68 69 73 20 69 73 20 4e 55 4c 4c 20 74 68 65 this is NULL the
9cf0: 6e 20 74 68 65 20 70 6f 69 6e 74 65 72 73 20 61 n the pointers a
9d00: 72 65 0a 09 09 09 09 20 2a 20 63 6f 6d 70 61 72 re..... * compar
9d10: 65 64 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 41 ed. */. Tcl_A
9d20: 6c 6c 6f 63 48 61 73 68 45 6e 74 72 79 50 72 6f llocHashEntryPro
9d30: 63 20 2a 61 6c 6c 6f 63 45 6e 74 72 79 50 72 6f c *allocEntryPro
9d40: 63 3b 0a 09 09 09 09 2f 2a 20 43 61 6c 6c 65 64 c;...../* Called
9d50: 20 74 6f 20 61 6c 6c 6f 63 61 74 65 20 6d 65 6d to allocate mem
9d60: 6f 72 79 20 66 6f 72 20 61 20 6e 65 77 20 65 6e ory for a new en
9d70: 74 72 79 2c 0a 09 09 09 09 20 2a 20 69 2e 65 2e try,..... * i.e.
9d80: 20 69 66 20 74 68 65 20 6b 65 79 20 69 73 20 61 if the key is a
9d90: 20 73 74 72 69 6e 67 20 74 68 65 6e 20 74 68 69 string then thi
9da0: 73 20 63 6f 75 6c 64 0a 09 09 09 09 20 2a 20 61 s could..... * a
9db0: 6c 6c 6f 63 61 74 65 20 61 20 73 69 6e 67 6c 65 llocate a single
9dc0: 20 62 6c 6f 63 6b 20 77 68 69 63 68 20 63 6f 6e block which con
9dd0: 74 61 69 6e 73 0a 09 09 09 09 20 2a 20 65 6e 6f tains..... * eno
9de0: 75 67 68 20 73 70 61 63 65 20 66 6f 72 20 62 6f ugh space for bo
9df0: 74 68 20 74 68 65 20 65 6e 74 72 79 20 61 6e 64 th the entry and
9e00: 20 74 68 65 0a 09 09 09 09 20 2a 20 73 74 72 69 the..... * stri
9e10: 6e 67 2e 20 4f 6e 6c 79 20 74 68 65 20 6b 65 79 ng. Only the key
9e20: 20 66 69 65 6c 64 20 6f 66 20 74 68 65 20 61 6c field of the al
9e30: 6c 6f 63 61 74 65 64 0a 09 09 09 09 20 2a 20 54 located..... * T
9e40: 63 6c 5f 48 61 73 68 45 6e 74 72 79 20 73 74 72 cl_HashEntry str
9e50: 75 63 74 75 72 65 20 6e 65 65 64 73 20 74 6f 20 ucture needs to
9e60: 62 65 20 66 69 6c 6c 65 64 0a 09 09 09 09 20 2a be filled..... *
9e70: 20 69 6e 2e 20 49 66 20 73 6f 6d 65 74 68 69 6e in. If somethin
9e80: 67 20 65 6c 73 65 20 6e 65 65 64 73 20 74 6f 20 g else needs to
9e90: 62 65 20 64 6f 6e 65 20 74 6f 0a 09 09 09 09 20 be done to.....
9ea0: 2a 20 74 68 65 20 6b 65 79 2c 20 69 2e 65 2e 20 * the key, i.e.
9eb0: 69 6e 63 72 65 6d 65 6e 74 69 6e 67 20 61 20 72 incrementing a r
9ec0: 65 66 65 72 65 6e 63 65 0a 09 09 09 09 20 2a 20 eference..... *
9ed0: 63 6f 75 6e 74 20 74 68 65 6e 20 74 68 61 74 20 count then that
9ee0: 73 68 6f 75 6c 64 20 62 65 20 64 6f 6e 65 20 62 should be done b
9ef0: 79 20 74 68 69 73 0a 09 09 09 09 20 2a 20 66 75 y this..... * fu
9f00: 6e 63 74 69 6f 6e 2e 20 49 66 20 74 68 69 73 20 nction. If this
9f10: 69 73 20 4e 55 4c 4c 20 74 68 65 6e 20 54 63 6c is NULL then Tcl
9f20: 5f 41 6c 6c 6f 63 20 69 73 0a 09 09 09 09 20 2a _Alloc is..... *
9f30: 20 75 73 65 64 20 74 6f 20 61 6c 6c 6f 63 61 74 used to allocat
9f40: 65 20 65 6e 6f 75 67 68 20 73 70 61 63 65 20 66 e enough space f
9f50: 6f 72 20 61 0a 09 09 09 09 20 2a 20 54 63 6c 5f or a..... * Tcl_
9f60: 48 61 73 68 45 6e 74 72 79 20 61 6e 64 20 74 68 HashEntry and th
9f70: 65 20 6b 65 79 20 70 6f 69 6e 74 65 72 20 69 73 e key pointer is
9f80: 0a 09 09 09 09 20 2a 20 61 73 73 69 67 6e 65 64 ..... * assigned
9f90: 20 74 6f 20 6b 65 79 2e 6f 6e 65 57 6f 72 64 56 to key.oneWordV
9fa0: 61 6c 75 65 2e 20 2a 2f 0a 20 20 20 20 54 63 6c alue. */. Tcl
9fb0: 5f 46 72 65 65 48 61 73 68 45 6e 74 72 79 50 72 _FreeHashEntryPr
9fc0: 6f 63 20 2a 66 72 65 65 45 6e 74 72 79 50 72 6f oc *freeEntryPro
9fd0: 63 3b 0a 09 09 09 09 2f 2a 20 43 61 6c 6c 65 64 c;...../* Called
9fe0: 20 74 6f 20 66 72 65 65 20 6d 65 6d 6f 72 79 20 to free memory
9ff0: 61 73 73 6f 63 69 61 74 65 64 20 77 69 74 68 20 associated with
a000: 61 6e 0a 09 09 09 09 20 2a 20 65 6e 74 72 79 2e an..... * entry.
a010: 20 49 66 20 73 6f 6d 65 74 68 69 6e 67 20 65 6c If something el
a020: 73 65 20 6e 65 65 64 73 20 74 6f 20 62 65 20 64 se needs to be d
a030: 6f 6e 65 0a 09 09 09 09 20 2a 20 74 6f 20 74 68 one..... * to th
a040: 65 20 6b 65 79 2c 20 69 2e 65 2e 20 64 65 63 72 e key, i.e. decr
a050: 65 6d 65 6e 74 69 6e 67 20 61 20 72 65 66 65 72 ementing a refer
a060: 65 6e 63 65 0a 09 09 09 09 20 2a 20 63 6f 75 6e ence..... * coun
a070: 74 20 74 68 65 6e 20 74 68 61 74 20 73 68 6f 75 t then that shou
a080: 6c 64 20 62 65 20 64 6f 6e 65 20 62 79 20 74 68 ld be done by th
a090: 69 73 0a 09 09 09 09 20 2a 20 66 75 6e 63 74 69 is..... * functi
a0a0: 6f 6e 2e 20 49 66 20 74 68 69 73 20 69 73 20 4e on. If this is N
a0b0: 55 4c 4c 20 74 68 65 6e 20 54 63 6c 5f 46 72 65 ULL then Tcl_Fre
a0c0: 65 20 69 73 0a 09 09 09 09 20 2a 20 75 73 65 64 e is..... * used
a0d0: 20 74 6f 20 66 72 65 65 20 74 68 65 20 54 63 6c to free the Tcl
a0e0: 5f 48 61 73 68 45 6e 74 72 79 2e 20 2a 2f 0a 7d _HashEntry. */.}
a0f0: 3b 0a 0a 2f 2a 0a 20 2a 20 53 74 72 75 63 74 75 ;../*. * Structu
a100: 72 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 66 6f re definition fo
a110: 72 20 61 20 68 61 73 68 20 74 61 62 6c 65 2e 20 r a hash table.
a120: 20 4d 75 73 74 20 62 65 20 69 6e 20 74 63 6c 2e Must be in tcl.
a130: 68 20 73 6f 20 63 6c 69 65 6e 74 73 20 63 61 6e h so clients can
a140: 0a 20 2a 20 61 6c 6c 6f 63 61 74 65 20 73 70 61 . * allocate spa
a150: 63 65 20 66 6f 72 20 74 68 65 73 65 20 73 74 72 ce for these str
a160: 75 63 74 75 72 65 73 2c 20 62 75 74 20 63 6c 69 uctures, but cli
a170: 65 6e 74 73 20 73 68 6f 75 6c 64 20 6e 65 76 65 ents should neve
a180: 72 20 61 63 63 65 73 73 20 61 6e 79 0a 20 2a 20 r access any. *
a190: 66 69 65 6c 64 73 20 69 6e 20 74 68 69 73 20 73 fields in this s
a1a0: 74 72 75 63 74 75 72 65 2e 0a 20 2a 2f 0a 0a 23 tructure.. */..#
a1b0: 64 65 66 69 6e 65 20 54 43 4c 5f 53 4d 41 4c 4c define TCL_SMALL
a1c0: 5f 48 41 53 48 5f 54 41 42 4c 45 20 34 0a 73 74 _HASH_TABLE 4.st
a1d0: 72 75 63 74 20 54 63 6c 5f 48 61 73 68 54 61 62 ruct Tcl_HashTab
a1e0: 6c 65 20 7b 0a 20 20 20 20 54 63 6c 5f 48 61 73 le {. Tcl_Has
a1f0: 68 45 6e 74 72 79 20 2a 2a 62 75 63 6b 65 74 73 hEntry **buckets
a200: 3b 09 2f 2a 20 50 6f 69 6e 74 65 72 20 74 6f 20 ;./* Pointer to
a210: 62 75 63 6b 65 74 20 61 72 72 61 79 2e 20 45 61 bucket array. Ea
a220: 63 68 20 65 6c 65 6d 65 6e 74 0a 09 09 09 09 20 ch element.....
a230: 2a 20 70 6f 69 6e 74 73 20 74 6f 20 66 69 72 73 * points to firs
a240: 74 20 65 6e 74 72 79 20 69 6e 20 62 75 63 6b 65 t entry in bucke
a250: 74 27 73 20 68 61 73 68 0a 09 09 09 09 20 2a 20 t's hash..... *
a260: 63 68 61 69 6e 2c 20 6f 72 20 4e 55 4c 4c 2e 20 chain, or NULL.
a270: 2a 2f 0a 20 20 20 20 54 63 6c 5f 48 61 73 68 45 */. Tcl_HashE
a280: 6e 74 72 79 20 2a 73 74 61 74 69 63 42 75 63 6b ntry *staticBuck
a290: 65 74 73 5b 54 43 4c 5f 53 4d 41 4c 4c 5f 48 41 ets[TCL_SMALL_HA
a2a0: 53 48 5f 54 41 42 4c 45 5d 3b 0a 09 09 09 09 2f SH_TABLE];...../
a2b0: 2a 20 42 75 63 6b 65 74 20 61 72 72 61 79 20 75 * Bucket array u
a2c0: 73 65 64 20 66 6f 72 20 73 6d 61 6c 6c 20 74 61 sed for small ta
a2d0: 62 6c 65 73 20 28 74 6f 0a 09 09 09 09 20 2a 20 bles (to..... *
a2e0: 61 76 6f 69 64 20 6d 61 6c 6c 6f 63 73 20 61 6e avoid mallocs an
a2f0: 64 20 66 72 65 65 73 29 2e 20 2a 2f 0a 20 20 20 d frees). */.
a300: 20 54 63 6c 5f 53 69 7a 65 20 6e 75 6d 42 75 63 Tcl_Size numBuc
a310: 6b 65 74 73 3b 09 2f 2a 20 54 6f 74 61 6c 20 6e kets;./* Total n
a320: 75 6d 62 65 72 20 6f 66 20 62 75 63 6b 65 74 73 umber of buckets
a330: 20 61 6c 6c 6f 63 61 74 65 64 20 61 74 0a 09 09 allocated at...
a340: 09 09 20 2a 20 2a 2a 62 75 63 6b 65 74 50 74 72 .. * **bucketPtr
a350: 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 53 69 7a . */. Tcl_Siz
a360: 65 20 6e 75 6d 45 6e 74 72 69 65 73 3b 09 2f 2a e numEntries;./*
a370: 20 54 6f 74 61 6c 20 6e 75 6d 62 65 72 20 6f 66 Total number of
a380: 20 65 6e 74 72 69 65 73 20 70 72 65 73 65 6e 74 entries present
a390: 20 69 6e 0a 09 09 09 09 20 2a 20 74 61 62 6c 65 in..... * table
a3a0: 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 53 69 7a . */. Tcl_Siz
a3b0: 65 20 72 65 62 75 69 6c 64 53 69 7a 65 3b 09 2f e rebuildSize;./
a3c0: 2a 20 45 6e 6c 61 72 67 65 20 74 61 62 6c 65 20 * Enlarge table
a3d0: 77 68 65 6e 20 6e 75 6d 45 6e 74 72 69 65 73 20 when numEntries
a3e0: 67 65 74 73 20 74 6f 20 62 65 0a 09 09 09 09 20 gets to be.....
a3f0: 2a 20 74 68 69 73 20 6c 61 72 67 65 2e 20 2a 2f * this large. */
a400: 0a 20 20 20 20 73 69 7a 65 5f 74 20 6d 61 73 6b . size_t mask
a410: 3b 09 09 2f 2a 20 4d 61 73 6b 20 76 61 6c 75 65 ;../* Mask value
a420: 20 75 73 65 64 20 69 6e 20 68 61 73 68 69 6e 67 used in hashing
a430: 20 66 75 6e 63 74 69 6f 6e 2e 20 2a 2f 0a 20 20 function. */.
a440: 20 20 69 6e 74 20 64 6f 77 6e 53 68 69 66 74 3b int downShift;
a450: 09 09 2f 2a 20 53 68 69 66 74 20 63 6f 75 6e 74 ../* Shift count
a460: 20 75 73 65 64 20 69 6e 20 68 61 73 68 69 6e 67 used in hashing
a470: 20 66 75 6e 63 74 69 6f 6e 2e 0a 09 09 09 09 20 function......
a480: 2a 20 44 65 73 69 67 6e 65 64 20 74 6f 20 75 73 * Designed to us
a490: 65 20 68 69 67 68 2d 6f 72 64 65 72 20 62 69 74 e high-order bit
a4a0: 73 20 6f 66 0a 09 09 09 09 20 2a 20 72 61 6e 64 s of..... * rand
a4b0: 6f 6d 69 7a 65 64 20 6b 65 79 73 2e 20 2a 2f 0a omized keys. */.
a4c0: 20 20 20 20 69 6e 74 20 6b 65 79 54 79 70 65 3b int keyType;
a4d0: 09 09 2f 2a 20 54 79 70 65 20 6f 66 20 6b 65 79 ../* Type of key
a4e0: 73 20 75 73 65 64 20 69 6e 20 74 68 69 73 20 74 s used in this t
a4f0: 61 62 6c 65 2e 20 49 74 27 73 0a 09 09 09 09 20 able. It's.....
a500: 2a 20 65 69 74 68 65 72 20 54 43 4c 5f 43 55 53 * either TCL_CUS
a510: 54 4f 4d 5f 4b 45 59 53 2c 20 54 43 4c 5f 53 54 TOM_KEYS, TCL_ST
a520: 52 49 4e 47 5f 4b 45 59 53 2c 0a 09 09 09 09 20 RING_KEYS,.....
a530: 2a 20 54 43 4c 5f 4f 4e 45 5f 57 4f 52 44 5f 4b * TCL_ONE_WORD_K
a540: 45 59 53 2c 20 6f 72 20 61 6e 20 69 6e 74 65 67 EYS, or an integ
a550: 65 72 20 67 69 76 69 6e 67 20 74 68 65 0a 09 09 er giving the...
a560: 09 09 20 2a 20 6e 75 6d 62 65 72 20 6f 66 20 69 .. * number of i
a570: 6e 74 73 20 74 68 61 74 20 69 73 20 74 68 65 20 nts that is the
a580: 73 69 7a 65 20 6f 66 20 74 68 65 0a 09 09 09 09 size of the.....
a590: 20 2a 20 6b 65 79 2e 20 2a 2f 0a 23 69 66 6e 64 * key. */.#ifnd
a5a0: 65 66 20 54 43 4c 5f 4e 4f 5f 44 45 50 52 45 43 ef TCL_NO_DEPREC
a5b0: 41 54 45 44 0a 20 20 20 20 54 63 6c 5f 48 61 73 ATED. Tcl_Has
a5c0: 68 45 6e 74 72 79 20 2a 28 2a 66 69 6e 64 50 72 hEntry *(*findPr
a5d0: 6f 63 29 20 28 54 63 6c 5f 48 61 73 68 54 61 62 oc) (Tcl_HashTab
a5e0: 6c 65 20 2a 74 61 62 6c 65 50 74 72 2c 20 63 6f le *tablePtr, co
a5f0: 6e 73 74 20 63 68 61 72 20 2a 6b 65 79 29 3b 0a nst char *key);.
a600: 23 65 6c 73 65 0a 20 20 20 20 76 6f 69 64 20 2a #else. void *
a610: 75 6e 55 73 65 64 3b 0a 23 65 6e 64 69 66 0a 20 unUsed;.#endif.
a620: 20 20 20 54 63 6c 5f 48 61 73 68 45 6e 74 72 79 Tcl_HashEntry
a630: 20 2a 28 2a 63 72 65 61 74 65 50 72 6f 63 29 20 *(*createProc)
a640: 28 54 63 6c 5f 48 61 73 68 54 61 62 6c 65 20 2a (Tcl_HashTable *
a650: 74 61 62 6c 65 50 74 72 2c 20 63 6f 6e 73 74 20 tablePtr, const
a660: 63 68 61 72 20 2a 6b 65 79 2c 0a 09 20 20 20 20 char *key,..
a670: 69 6e 74 20 2a 6e 65 77 50 74 72 29 3b 0a 20 20 int *newPtr);.
a680: 20 20 63 6f 6e 73 74 20 54 63 6c 5f 48 61 73 68 const Tcl_Hash
a690: 4b 65 79 54 79 70 65 20 2a 74 79 70 65 50 74 72 KeyType *typePtr
a6a0: 3b 0a 09 09 09 09 2f 2a 20 54 79 70 65 20 6f 66 ;...../* Type of
a6b0: 20 74 68 65 20 6b 65 79 73 20 75 73 65 64 20 69 the keys used i
a6c0: 6e 20 74 68 65 0a 09 09 09 09 20 2a 20 54 63 6c n the..... * Tcl
a6d0: 5f 48 61 73 68 54 61 62 6c 65 2e 20 2a 2f 0a 7d _HashTable. */.}
a6e0: 3b 0a 0a 2f 2a 0a 20 2a 20 53 74 72 75 63 74 75 ;../*. * Structu
a6f0: 72 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 66 6f re definition fo
a700: 72 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 75 73 r information us
a710: 65 64 20 74 6f 20 6b 65 65 70 20 74 72 61 63 6b ed to keep track
a720: 20 6f 66 20 73 65 61 72 63 68 65 73 20 74 68 72 of searches thr
a730: 6f 75 67 68 0a 20 2a 20 68 61 73 68 20 74 61 62 ough. * hash tab
a740: 6c 65 73 3a 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 les:. */..typede
a750: 66 20 73 74 72 75 63 74 20 54 63 6c 5f 48 61 73 f struct Tcl_Has
a760: 68 53 65 61 72 63 68 20 7b 0a 20 20 20 20 54 63 hSearch {. Tc
a770: 6c 5f 48 61 73 68 54 61 62 6c 65 20 2a 74 61 62 l_HashTable *tab
a780: 6c 65 50 74 72 3b 09 2f 2a 20 54 61 62 6c 65 20 lePtr;./* Table
a790: 62 65 69 6e 67 20 73 65 61 72 63 68 65 64 2e 20 being searched.
a7a0: 2a 2f 0a 20 20 20 20 54 63 6c 5f 53 69 7a 65 20 */. Tcl_Size
a7b0: 6e 65 78 74 49 6e 64 65 78 3b 09 09 2f 2a 20 49 nextIndex;../* I
a7c0: 6e 64 65 78 20 6f 66 20 6e 65 78 74 20 62 75 63 ndex of next buc
a7d0: 6b 65 74 20 74 6f 20 62 65 20 65 6e 75 6d 65 72 ket to be enumer
a7e0: 61 74 65 64 20 61 66 74 65 72 0a 09 09 09 09 20 ated after.....
a7f0: 2a 20 70 72 65 73 65 6e 74 20 6f 6e 65 2e 20 2a * present one. *
a800: 2f 0a 20 20 20 20 54 63 6c 5f 48 61 73 68 45 6e /. Tcl_HashEn
a810: 74 72 79 20 2a 6e 65 78 74 45 6e 74 72 79 50 74 try *nextEntryPt
a820: 72 3b 2f 2a 20 4e 65 78 74 20 65 6e 74 72 79 20 r;/* Next entry
a830: 74 6f 20 62 65 20 65 6e 75 6d 65 72 61 74 65 64 to be enumerated
a840: 20 69 6e 20 74 68 65 20 63 75 72 72 65 6e 74 0a in the current.
a850: 09 09 09 09 20 2a 20 62 75 63 6b 65 74 2e 20 2a .... * bucket. *
a860: 2f 0a 7d 20 54 63 6c 5f 48 61 73 68 53 65 61 72 /.} Tcl_HashSear
a870: 63 68 3b 0a 0a 2f 2a 0a 20 2a 20 41 63 63 65 70 ch;../*. * Accep
a880: 74 61 62 6c 65 20 6b 65 79 20 74 79 70 65 73 20 table key types
a890: 66 6f 72 20 68 61 73 68 20 74 61 62 6c 65 73 3a for hash tables:
a8a0: 0a 20 2a 0a 20 2a 20 54 43 4c 5f 53 54 52 49 4e . *. * TCL_STRIN
a8b0: 47 5f 4b 45 59 53 3a 09 09 54 68 65 20 6b 65 79 G_KEYS:..The key
a8c0: 73 20 61 72 65 20 73 74 72 69 6e 67 73 2c 20 74 s are strings, t
a8d0: 68 65 79 20 61 72 65 20 63 6f 70 69 65 64 20 69 hey are copied i
a8e0: 6e 74 6f 20 74 68 65 0a 20 2a 09 09 09 09 65 6e nto the. *....en
a8f0: 74 72 79 2e 0a 20 2a 20 54 43 4c 5f 4f 4e 45 5f try.. * TCL_ONE_
a900: 57 4f 52 44 5f 4b 45 59 53 3a 09 09 54 68 65 20 WORD_KEYS:..The
a910: 6b 65 79 73 20 61 72 65 20 70 6f 69 6e 74 65 72 keys are pointer
a920: 73 2c 20 74 68 65 20 70 6f 69 6e 74 65 72 20 69 s, the pointer i
a930: 73 20 73 74 6f 72 65 64 0a 20 2a 09 09 09 09 69 s stored. *....i
a940: 6e 20 74 68 65 20 65 6e 74 72 79 2e 0a 20 2a 20 n the entry.. *
a950: 54 43 4c 5f 43 55 53 54 4f 4d 5f 54 59 50 45 5f TCL_CUSTOM_TYPE_
a960: 4b 45 59 53 3a 09 54 68 65 20 6b 65 79 73 20 61 KEYS:.The keys a
a970: 72 65 20 61 72 62 69 74 72 61 72 79 20 74 79 70 re arbitrary typ
a980: 65 73 20 77 68 69 63 68 20 61 72 65 20 63 6f 70 es which are cop
a990: 69 65 64 0a 20 2a 09 09 09 09 69 6e 74 6f 20 74 ied. *....into t
a9a0: 68 65 20 65 6e 74 72 79 2e 0a 20 2a 20 54 43 4c he entry.. * TCL
a9b0: 5f 43 55 53 54 4f 4d 5f 50 54 52 5f 4b 45 59 53 _CUSTOM_PTR_KEYS
a9c0: 3a 09 09 54 68 65 20 6b 65 79 73 20 61 72 65 20 :..The keys are
a9d0: 70 6f 69 6e 74 65 72 73 20 74 6f 20 61 72 62 69 pointers to arbi
a9e0: 74 72 61 72 79 20 74 79 70 65 73 2c 20 74 68 65 trary types, the
a9f0: 0a 20 2a 09 09 09 09 70 6f 69 6e 74 65 72 20 69 . *....pointer i
aa00: 73 20 73 74 6f 72 65 64 20 69 6e 20 74 68 65 20 s stored in the
aa10: 65 6e 74 72 79 2e 0a 20 2a 0a 20 2a 20 57 68 69 entry.. *. * Whi
aa20: 6c 65 20 6d 61 69 6e 74 61 69 6e 69 6e 67 20 62 le maintaining b
aa30: 69 6e 61 72 79 20 63 6f 6d 70 61 74 69 62 69 6c inary compatibil
aa40: 69 74 79 20 74 68 65 20 61 62 6f 76 65 20 68 61 ity the above ha
aa50: 76 65 20 74 6f 20 62 65 20 64 69 73 74 69 6e 63 ve to be distinc
aa60: 74 20 76 61 6c 75 65 73 0a 20 2a 20 61 73 20 74 t values. * as t
aa70: 68 65 79 20 61 72 65 20 75 73 65 64 20 74 6f 20 hey are used to
aa80: 64 69 66 66 65 72 65 6e 74 69 61 74 65 20 62 65 differentiate be
aa90: 74 77 65 65 6e 20 6f 6c 64 20 76 65 72 73 69 6f tween old versio
aaa0: 6e 73 20 6f 66 20 74 68 65 20 68 61 73 68 20 74 ns of the hash t
aab0: 61 62 6c 65 0a 20 2a 20 77 68 69 63 68 20 64 6f able. * which do
aac0: 6e 27 74 20 68 61 76 65 20 61 20 74 79 70 65 50 n't have a typeP
aad0: 74 72 20 61 6e 64 20 6e 65 77 20 6f 6e 65 73 20 tr and new ones
aae0: 77 68 69 63 68 20 64 6f 2e 20 4f 6e 63 65 20 62 which do. Once b
aaf0: 69 6e 61 72 79 20 63 6f 6d 70 61 74 69 62 69 6c inary compatibil
ab00: 69 74 79 0a 20 2a 20 69 73 20 64 69 73 63 61 72 ity. * is discar
ab10: 64 65 64 20 69 6e 20 66 61 76 6f 75 72 20 6f 66 ded in favour of
ab20: 20 6d 61 6b 69 6e 67 20 6d 6f 72 65 20 77 69 64 making more wid
ab30: 65 20 73 70 72 65 61 64 20 63 68 61 6e 67 65 73 e spread changes
ab40: 20 54 43 4c 5f 53 54 52 49 4e 47 5f 4b 45 59 53 TCL_STRING_KEYS
ab50: 0a 20 2a 20 63 61 6e 20 62 65 20 74 68 65 20 73 . * can be the s
ab60: 61 6d 65 20 61 73 20 54 43 4c 5f 43 55 53 54 4f ame as TCL_CUSTO
ab70: 4d 5f 54 59 50 45 5f 4b 45 59 53 2c 20 61 6e 64 M_TYPE_KEYS, and
ab80: 20 54 43 4c 5f 4f 4e 45 5f 57 4f 52 44 5f 4b 45 TCL_ONE_WORD_KE
ab90: 59 53 20 63 61 6e 20 62 65 20 74 68 65 0a 20 2a YS can be the. *
aba0: 20 73 61 6d 65 20 61 73 20 54 43 4c 5f 43 55 53 same as TCL_CUS
abb0: 54 4f 4d 5f 50 54 52 5f 4b 45 59 53 20 62 65 63 TOM_PTR_KEYS bec
abc0: 61 75 73 65 20 74 68 65 79 20 73 69 6d 70 6c 79 ause they simply
abd0: 20 64 65 74 65 72 6d 69 6e 65 20 68 6f 77 20 74 determine how t
abe0: 68 65 20 6b 65 79 20 69 73 0a 20 2a 20 61 63 63 he key is. * acc
abf0: 65 73 73 65 64 20 66 72 6f 6d 20 74 68 65 20 65 essed from the e
ac00: 6e 74 72 79 20 61 6e 64 20 6e 6f 74 20 74 68 65 ntry and not the
ac10: 20 62 65 68 61 76 69 6f 75 72 2e 0a 20 2a 2f 0a behaviour.. */.
ac20: 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 53 54 52 .#define TCL_STR
ac30: 49 4e 47 5f 4b 45 59 53 09 09 28 30 29 0a 23 64 ING_KEYS..(0).#d
ac40: 65 66 69 6e 65 20 54 43 4c 5f 4f 4e 45 5f 57 4f efine TCL_ONE_WO
ac50: 52 44 5f 4b 45 59 53 09 28 31 29 0a 23 64 65 66 RD_KEYS.(1).#def
ac60: 69 6e 65 20 54 43 4c 5f 43 55 53 54 4f 4d 5f 54 ine TCL_CUSTOM_T
ac70: 59 50 45 5f 4b 45 59 53 09 28 2d 32 29 0a 23 64 YPE_KEYS.(-2).#d
ac80: 65 66 69 6e 65 20 54 43 4c 5f 43 55 53 54 4f 4d efine TCL_CUSTOM
ac90: 5f 50 54 52 5f 4b 45 59 53 09 28 2d 31 29 0a 0a _PTR_KEYS.(-1)..
aca0: 2f 2a 0a 20 2a 20 53 74 72 75 63 74 75 72 65 20 /*. * Structure
acb0: 64 65 66 69 6e 69 74 69 6f 6e 20 66 6f 72 20 69 definition for i
acc0: 6e 66 6f 72 6d 61 74 69 6f 6e 20 75 73 65 64 20 nformation used
acd0: 74 6f 20 6b 65 65 70 20 74 72 61 63 6b 20 6f 66 to keep track of
ace0: 20 73 65 61 72 63 68 65 73 20 74 68 72 6f 75 67 searches throug
acf0: 68 0a 20 2a 20 64 69 63 74 69 6f 6e 61 72 69 65 h. * dictionarie
ad00: 73 2e 20 54 68 65 73 65 20 66 69 65 6c 64 73 20 s. These fields
ad10: 73 68 6f 75 6c 64 20 6e 6f 74 20 62 65 20 61 63 should not be ac
ad20: 63 65 73 73 65 64 20 62 79 20 63 6f 64 65 20 6f cessed by code o
ad30: 75 74 73 69 64 65 0a 20 2a 20 74 63 6c 44 69 63 utside. * tclDic
ad40: 74 4f 62 6a 2e 63 0a 20 2a 2f 0a 0a 74 79 70 65 tObj.c. */..type
ad50: 64 65 66 20 73 74 72 75 63 74 20 7b 0a 20 20 20 def struct {.
ad60: 20 76 6f 69 64 20 2a 6e 65 78 74 3b 09 09 09 2f void *next;.../
ad70: 2a 20 53 65 61 72 63 68 20 70 6f 73 69 74 69 6f * Search positio
ad80: 6e 20 66 6f 72 20 75 6e 64 65 72 6c 79 69 6e 67 n for underlying
ad90: 20 68 61 73 68 0a 09 09 09 09 20 2a 20 74 61 62 hash..... * tab
ada0: 6c 65 2e 20 2a 2f 0a 20 20 20 20 73 69 7a 65 5f le. */. size_
adb0: 74 20 65 70 6f 63 68 3b 09 09 2f 2a 20 45 70 6f t epoch;../* Epo
adc0: 63 68 20 6d 61 72 6b 65 72 20 66 6f 72 20 64 69 ch marker for di
add0: 63 74 69 6f 6e 61 72 79 20 62 65 69 6e 67 20 73 ctionary being s
ade0: 65 61 72 63 68 65 64 2c 0a 09 09 09 09 20 2a 20 earched,..... *
adf0: 6f 72 20 30 20 69 66 20 73 65 61 72 63 68 20 68 or 0 if search h
ae00: 61 73 20 74 65 72 6d 69 6e 61 74 65 64 2e 20 2a as terminated. *
ae10: 2f 0a 20 20 20 20 54 63 6c 5f 44 69 63 74 20 64 /. Tcl_Dict d
ae20: 69 63 74 69 6f 6e 61 72 79 50 74 72 3b 09 2f 2a ictionaryPtr;./*
ae30: 20 52 65 66 65 72 65 6e 63 65 20 74 6f 20 64 69 Reference to di
ae40: 63 74 69 6f 6e 61 72 79 20 62 65 69 6e 67 20 73 ctionary being s
ae50: 65 61 72 63 68 65 64 2e 20 2a 2f 0a 7d 20 54 63 earched. */.} Tc
ae60: 6c 5f 44 69 63 74 53 65 61 72 63 68 3b 0a 0c 0a l_DictSearch;...
ae70: 2f 2a 0a 20 2a 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 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
aeb0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
aec0: 2d 0a 20 2a 20 46 6c 61 67 20 76 61 6c 75 65 73 -. * Flag values
aed0: 20 74 6f 20 70 61 73 73 20 74 6f 20 54 63 6c 5f to pass to Tcl_
aee0: 44 6f 4f 6e 65 45 76 65 6e 74 20 74 6f 20 64 69 DoOneEvent to di
aef0: 73 61 62 6c 65 20 73 65 61 72 63 68 65 73 20 66 sable searches f
af00: 6f 72 20 73 6f 6d 65 20 6b 69 6e 64 73 20 6f 66 or some kinds of
af10: 0a 20 2a 20 65 76 65 6e 74 73 3a 0a 20 2a 2f 0a . * events:. */.
af20: 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 44 4f 4e .#define TCL_DON
af30: 54 5f 57 41 49 54 09 09 28 31 3c 3c 31 29 0a 23 T_WAIT..(1<<1).#
af40: 64 65 66 69 6e 65 20 54 43 4c 5f 57 49 4e 44 4f define TCL_WINDO
af50: 57 5f 45 56 45 4e 54 53 09 28 31 3c 3c 32 29 0a W_EVENTS.(1<<2).
af60: 23 64 65 66 69 6e 65 20 54 43 4c 5f 46 49 4c 45 #define TCL_FILE
af70: 5f 45 56 45 4e 54 53 09 09 28 31 3c 3c 33 29 0a _EVENTS..(1<<3).
af80: 23 64 65 66 69 6e 65 20 54 43 4c 5f 54 49 4d 45 #define TCL_TIME
af90: 52 5f 45 56 45 4e 54 53 09 28 31 3c 3c 34 29 0a R_EVENTS.(1<<4).
afa0: 23 64 65 66 69 6e 65 20 54 43 4c 5f 49 44 4c 45 #define TCL_IDLE
afb0: 5f 45 56 45 4e 54 53 09 09 28 31 3c 3c 35 29 09 _EVENTS..(1<<5).
afc0: 2f 2a 20 57 41 53 20 30 78 31 30 20 3f 3f 3f 3f /* WAS 0x10 ????
afd0: 20 2a 2f 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f */.#define TCL_
afe0: 41 4c 4c 5f 45 56 45 4e 54 53 09 09 28 7e 54 43 ALL_EVENTS..(~TC
aff0: 4c 5f 44 4f 4e 54 5f 57 41 49 54 29 0a 0a 2f 2a L_DONT_WAIT)../*
b000: 0a 20 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e . * The followin
b010: 67 20 73 74 72 75 63 74 75 72 65 20 64 65 66 69 g structure defi
b020: 6e 65 73 20 61 20 67 65 6e 65 72 69 63 20 65 76 nes a generic ev
b030: 65 6e 74 20 66 6f 72 20 74 68 65 20 54 63 6c 20 ent for the Tcl
b040: 65 76 65 6e 74 20 73 79 73 74 65 6d 2e 0a 20 2a event system.. *
b050: 20 54 68 65 73 65 20 61 72 65 20 74 68 65 20 74 These are the t
b060: 68 69 6e 67 73 20 74 68 61 74 20 61 72 65 20 71 hings that are q
b070: 75 65 75 65 64 20 69 6e 20 63 61 6c 6c 73 20 74 ueued in calls t
b080: 6f 20 54 63 6c 5f 51 75 65 75 65 45 76 65 6e 74 o Tcl_QueueEvent
b090: 20 61 6e 64 0a 20 2a 20 73 65 72 76 69 63 65 64 and. * serviced
b0a0: 20 6c 61 74 65 72 20 62 79 20 54 63 6c 5f 44 6f later by Tcl_Do
b0b0: 4f 6e 65 45 76 65 6e 74 2e 20 54 68 65 72 65 20 OneEvent. There
b0c0: 63 61 6e 20 62 65 20 6d 61 6e 79 20 64 69 66 66 can be many diff
b0d0: 65 72 65 6e 74 20 6b 69 6e 64 73 20 6f 66 0a 20 erent kinds of.
b0e0: 2a 20 65 76 65 6e 74 73 20 77 69 74 68 20 64 69 * events with di
b0f0: 66 66 65 72 65 6e 74 20 66 69 65 6c 64 73 2c 20 fferent fields,
b100: 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 74 6f corresponding to
b110: 20 77 69 6e 64 6f 77 20 65 76 65 6e 74 73 2c 20 window events,
b120: 74 69 6d 65 72 20 65 76 65 6e 74 73 2c 0a 20 2a timer events,. *
b130: 20 65 74 63 2e 20 54 68 65 20 73 74 72 75 63 74 etc. The struct
b140: 75 72 65 20 66 6f 72 20 61 20 70 61 72 74 69 63 ure for a partic
b150: 75 6c 61 72 20 65 76 65 6e 74 20 63 6f 6e 73 69 ular event consi
b160: 73 74 73 20 6f 66 20 61 20 54 63 6c 5f 45 76 65 sts of a Tcl_Eve
b170: 6e 74 20 68 65 61 64 65 72 0a 20 2a 20 66 6f 6c nt header. * fol
b180: 6c 6f 77 65 64 20 62 79 20 61 64 64 69 74 69 6f lowed by additio
b190: 6e 61 6c 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 nal information
b1a0: 73 70 65 63 69 66 69 63 20 74 6f 20 74 68 61 74 specific to that
b1b0: 20 65 76 65 6e 74 2e 0a 20 2a 2f 0a 0a 73 74 72 event.. */..str
b1c0: 75 63 74 20 54 63 6c 5f 45 76 65 6e 74 20 7b 0a uct Tcl_Event {.
b1d0: 20 20 20 20 54 63 6c 5f 45 76 65 6e 74 50 72 6f Tcl_EventPro
b1e0: 63 20 2a 70 72 6f 63 3b 09 2f 2a 20 46 75 6e 63 c *proc;./* Func
b1f0: 74 69 6f 6e 20 74 6f 20 63 61 6c 6c 20 74 6f 20 tion to call to
b200: 73 65 72 76 69 63 65 20 74 68 69 73 20 65 76 65 service this eve
b210: 6e 74 2e 20 2a 2f 0a 20 20 20 20 73 74 72 75 63 nt. */. struc
b220: 74 20 54 63 6c 5f 45 76 65 6e 74 20 2a 6e 65 78 t Tcl_Event *nex
b230: 74 50 74 72 3b 09 2f 2a 20 4e 65 78 74 20 69 6e tPtr;./* Next in
b240: 20 6c 69 73 74 20 6f 66 20 70 65 6e 64 69 6e 67 list of pending
b250: 20 65 76 65 6e 74 73 2c 20 6f 72 20 4e 55 4c 4c events, or NULL
b260: 2e 20 2a 2f 0a 7d 3b 0a 0a 2f 2a 0a 20 2a 20 50 . */.};../*. * P
b270: 6f 73 69 74 69 6f 6e 73 20 74 6f 20 70 61 73 73 ositions to pass
b280: 20 74 6f 20 54 63 6c 5f 51 75 65 75 65 45 76 65 to Tcl_QueueEve
b290: 6e 74 2f 54 63 6c 5f 54 68 72 65 61 64 51 75 65 nt/Tcl_ThreadQue
b2a0: 75 65 45 76 65 6e 74 3a 0a 20 2a 2f 0a 0a 74 79 ueEvent:. */..ty
b2b0: 70 65 64 65 66 20 65 6e 75 6d 20 7b 0a 20 20 20 pedef enum {.
b2c0: 20 54 43 4c 5f 51 55 45 55 45 5f 54 41 49 4c 2c TCL_QUEUE_TAIL,
b2d0: 20 54 43 4c 5f 51 55 45 55 45 5f 48 45 41 44 2c TCL_QUEUE_HEAD,
b2e0: 20 54 43 4c 5f 51 55 45 55 45 5f 4d 41 52 4b 2c TCL_QUEUE_MARK,
b2f0: 0a 20 20 20 20 54 43 4c 5f 51 55 45 55 45 5f 41 . TCL_QUEUE_A
b300: 4c 45 52 54 5f 49 46 5f 45 4d 50 54 59 3d 34 0a LERT_IF_EMPTY=4.
b310: 7d 20 54 63 6c 5f 51 75 65 75 65 50 6f 73 69 74 } Tcl_QueuePosit
b320: 69 6f 6e 3b 0a 0a 2f 2a 0a 20 2a 20 56 61 6c 75 ion;../*. * Valu
b330: 65 73 20 74 6f 20 70 61 73 73 20 74 6f 20 54 63 es to pass to Tc
b340: 6c 5f 53 65 74 53 65 72 76 69 63 65 4d 6f 64 65 l_SetServiceMode
b350: 20 74 6f 20 73 70 65 63 69 66 79 20 74 68 65 20 to specify the
b360: 62 65 68 61 76 69 6f 72 20 6f 66 20 6e 6f 74 69 behavior of noti
b370: 66 69 65 72 0a 20 2a 20 65 76 65 6e 74 20 72 6f fier. * event ro
b380: 75 74 69 6e 65 73 2e 0a 20 2a 2f 0a 0a 23 64 65 utines.. */..#de
b390: 66 69 6e 65 20 54 43 4c 5f 53 45 52 56 49 43 45 fine TCL_SERVICE
b3a0: 5f 4e 4f 4e 45 20 30 0a 23 64 65 66 69 6e 65 20 _NONE 0.#define
b3b0: 54 43 4c 5f 53 45 52 56 49 43 45 5f 41 4c 4c 20 TCL_SERVICE_ALL
b3c0: 31 0a 0a 2f 2a 0a 20 2a 20 54 68 65 20 66 6f 6c 1../*. * The fol
b3d0: 6c 6f 77 69 6e 67 20 73 74 72 75 63 74 75 72 65 lowing structure
b3e0: 20 6b 65 65 70 73 20 69 73 20 75 73 65 64 20 74 keeps is used t
b3f0: 6f 20 68 6f 6c 64 20 61 20 74 69 6d 65 20 76 61 o hold a time va
b400: 6c 75 65 2c 20 65 69 74 68 65 72 20 61 73 20 61 lue, either as a
b410: 6e 0a 20 2a 20 61 62 73 6f 6c 75 74 65 20 74 69 n. * absolute ti
b420: 6d 65 20 28 74 68 65 20 6e 75 6d 62 65 72 20 6f me (the number o
b430: 66 20 73 65 63 6f 6e 64 73 20 66 72 6f 6d 20 74 f seconds from t
b440: 68 65 20 65 70 6f 63 68 29 20 6f 72 20 61 73 20 he epoch) or as
b450: 61 6e 20 65 6c 61 70 73 65 64 20 74 69 6d 65 2e an elapsed time.
b460: 0a 20 2a 20 4f 6e 20 55 6e 69 78 20 73 79 73 74 . * On Unix syst
b470: 65 6d 73 20 74 68 65 20 65 70 6f 63 68 20 69 73 ems the epoch is
b480: 20 4d 69 64 6e 69 67 68 74 20 4a 61 6e 20 31 2c Midnight Jan 1,
b490: 20 31 39 37 30 20 47 4d 54 2e 0a 20 2a 2f 0a 0a 1970 GMT.. */..
b4a0: 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20 54 typedef struct T
b4b0: 63 6c 5f 54 69 6d 65 20 7b 0a 20 20 20 20 6c 6f cl_Time {. lo
b4c0: 6e 67 20 6c 6f 6e 67 20 73 65 63 3b 09 09 2f 2a ng long sec;../*
b4d0: 20 53 65 63 6f 6e 64 73 2e 20 2a 2f 0a 23 69 66 Seconds. */.#if
b4e0: 20 64 65 66 69 6e 65 64 28 5f 43 59 47 57 49 4e defined(_CYGWIN
b4f0: 5f 29 0a 20 20 20 20 69 6e 74 20 75 73 65 63 3b _). int usec;
b500: 09 09 09 2f 2a 20 4d 69 63 72 6f 73 65 63 6f 6e .../* Microsecon
b510: 64 73 2e 20 2a 2f 0a 23 65 6c 73 65 0a 20 20 20 ds. */.#else.
b520: 20 6c 6f 6e 67 20 75 73 65 63 3b 09 09 09 2f 2a long usec;.../*
b530: 20 4d 69 63 72 6f 73 65 63 6f 6e 64 73 2e 20 2a Microseconds. *
b540: 2f 0a 23 65 6e 64 69 66 0a 7d 20 54 63 6c 5f 54 /.#endif.} Tcl_T
b550: 69 6d 65 3b 0a 0a 74 79 70 65 64 65 66 20 76 6f ime;..typedef vo
b560: 69 64 20 28 54 63 6c 5f 53 65 74 54 69 6d 65 72 id (Tcl_SetTimer
b570: 50 72 6f 63 29 20 28 63 6f 6e 73 74 20 54 63 6c Proc) (const Tcl
b580: 5f 54 69 6d 65 20 2a 74 69 6d 65 50 74 72 29 3b _Time *timePtr);
b590: 0a 74 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 .typedef int (Tc
b5a0: 6c 5f 57 61 69 74 46 6f 72 45 76 65 6e 74 50 72 l_WaitForEventPr
b5b0: 6f 63 29 20 28 63 6f 6e 73 74 20 54 63 6c 5f 54 oc) (const Tcl_T
b5c0: 69 6d 65 20 2a 74 69 6d 65 50 74 72 29 3b 0a 0a ime *timePtr);..
b5d0: 2f 2a 0a 20 2a 20 54 49 50 20 23 32 33 33 20 28 /*. * TIP #233 (
b5e0: 56 69 72 74 75 61 6c 69 7a 65 64 20 54 69 6d 65 Virtualized Time
b5f0: 29 0a 20 2a 20 57 41 52 4e 49 4e 47 3a 20 66 75 ). * WARNING: fu
b600: 6e 63 74 69 6f 6e 61 6c 69 74 79 20 72 65 6d 6f nctionality remo
b610: 76 65 64 2c 20 63 61 6c 6c 73 20 54 63 6c 5f 50 ved, calls Tcl_P
b620: 61 6e 69 63 0a 20 2a 2f 0a 0a 23 69 66 6e 64 65 anic. */..#ifnde
b630: 66 20 54 43 4c 5f 4e 4f 5f 44 45 50 52 45 43 41 f TCL_NO_DEPRECA
b640: 54 45 44 0a 74 79 70 65 64 65 66 20 76 6f 69 64 TED.typedef void
b650: 20 28 54 63 6c 5f 47 65 74 54 69 6d 65 50 72 6f (Tcl_GetTimePro
b660: 63 29 20 20 20 28 54 63 6c 5f 54 69 6d 65 20 2a c) (Tcl_Time *
b670: 74 69 6d 65 62 75 66 2c 20 76 6f 69 64 20 2a 63 timebuf, void *c
b680: 6c 69 65 6e 74 44 61 74 61 29 3b 0a 74 79 70 65 lientData);.type
b690: 64 65 66 20 76 6f 69 64 20 28 54 63 6c 5f 53 63 def void (Tcl_Sc
b6a0: 61 6c 65 54 69 6d 65 50 72 6f 63 29 20 28 54 63 aleTimeProc) (Tc
b6b0: 6c 5f 54 69 6d 65 20 2a 74 69 6d 65 62 75 66 2c l_Time *timebuf,
b6c0: 20 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 61 74 void *clientDat
b6d0: 61 29 3b 0a 23 65 6e 64 69 66 20 2f 2a 20 54 43 a);.#endif /* TC
b6e0: 4c 5f 4e 4f 5f 44 45 50 52 45 43 41 54 45 44 20 L_NO_DEPRECATED
b6f0: 2a 2f 0a 0a 2f 2a 0a 20 2a 20 54 49 50 20 23 37 */../*. * TIP #7
b700: 32 33 20 28 4d 6f 6e 6f 74 6f 6e 69 63 20 54 69 23 (Monotonic Ti
b710: 6d 65 29 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 66 me). */..typedef
b720: 20 6c 6f 6e 67 20 6c 6f 6e 67 20 28 54 63 6c 5f long long (Tcl_
b730: 47 65 74 4d 6f 6e 6f 74 6f 6e 69 63 54 69 6d 65 GetMonotonicTime
b740: 50 72 6f 63 29 20 20 20 28 76 6f 69 64 20 2a 63 Proc) (void *c
b750: 6c 69 65 6e 74 44 61 74 61 29 3b 0a 0a 2f 2a 0a lientData);../*.
b760: 20 2a 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 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
b7a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 --------------.
b7b0: 2a 20 42 69 74 73 20 74 6f 20 70 61 73 73 20 74 * Bits to pass t
b7c0: 6f 20 54 63 6c 5f 43 72 65 61 74 65 46 69 6c 65 o Tcl_CreateFile
b7d0: 48 61 6e 64 6c 65 72 20 61 6e 64 20 54 63 6c 5f Handler and Tcl_
b7e0: 43 72 65 61 74 65 43 68 61 6e 6e 65 6c 48 61 6e CreateChannelHan
b7f0: 64 6c 65 72 20 74 6f 0a 20 2a 20 69 6e 64 69 63 dler to. * indic
b800: 61 74 65 20 77 68 61 74 20 73 6f 72 74 73 20 6f ate what sorts o
b810: 66 20 65 76 65 6e 74 73 20 61 72 65 20 6f 66 20 f events are of
b820: 69 6e 74 65 72 65 73 74 3a 0a 20 2a 2f 0a 0a 23 interest:. */..#
b830: 64 65 66 69 6e 65 20 54 43 4c 5f 52 45 41 44 41 define TCL_READA
b840: 42 4c 45 09 09 28 31 3c 3c 31 29 0a 23 64 65 66 BLE..(1<<1).#def
b850: 69 6e 65 20 54 43 4c 5f 57 52 49 54 41 42 4c 45 ine TCL_WRITABLE
b860: 09 09 28 31 3c 3c 32 29 0a 23 64 65 66 69 6e 65 ..(1<<2).#define
b870: 20 54 43 4c 5f 45 58 43 45 50 54 49 4f 4e 09 09 TCL_EXCEPTION..
b880: 28 31 3c 3c 33 29 0a 0a 2f 2a 0a 20 2a 20 46 6c (1<<3)../*. * Fl
b890: 61 67 20 76 61 6c 75 65 73 20 74 6f 20 70 61 73 ag values to pas
b8a0: 73 20 74 6f 20 54 63 6c 5f 4f 70 65 6e 43 6f 6d s to Tcl_OpenCom
b8b0: 6d 61 6e 64 43 68 61 6e 6e 65 6c 20 74 6f 20 69 mandChannel to i
b8c0: 6e 64 69 63 61 74 65 20 74 68 65 20 64 69 73 70 ndicate the disp
b8d0: 6f 73 69 74 69 6f 6e 0a 20 2a 20 6f 66 20 74 68 osition. * of th
b8e0: 65 20 73 74 64 69 6f 20 68 61 6e 64 6c 65 73 2e e stdio handles.
b8f0: 20 54 43 4c 5f 53 54 44 49 4e 2c 20 54 43 4c 5f TCL_STDIN, TCL_
b900: 53 54 44 4f 55 54 2c 20 54 43 4c 5f 53 54 44 45 STDOUT, TCL_STDE
b910: 52 52 2c 20 61 72 65 20 61 6c 73 6f 20 75 73 65 RR, are also use
b920: 64 20 69 6e 0a 20 2a 20 54 63 6c 5f 47 65 74 53 d in. * Tcl_GetS
b930: 74 64 43 68 61 6e 6e 65 6c 2e 0a 20 2a 2f 0a 0a tdChannel.. */..
b940: 23 64 65 66 69 6e 65 20 54 43 4c 5f 53 54 44 49 #define TCL_STDI
b950: 4e 09 09 28 31 3c 3c 31 29 0a 23 64 65 66 69 6e N..(1<<1).#defin
b960: 65 20 54 43 4c 5f 53 54 44 4f 55 54 09 09 28 31 e TCL_STDOUT..(1
b970: 3c 3c 32 29 0a 23 64 65 66 69 6e 65 20 54 43 4c <<2).#define TCL
b980: 5f 53 54 44 45 52 52 09 09 28 31 3c 3c 33 29 0a _STDERR..(1<<3).
b990: 23 64 65 66 69 6e 65 20 54 43 4c 5f 45 4e 46 4f #define TCL_ENFO
b9a0: 52 43 45 5f 4d 4f 44 45 09 28 31 3c 3c 34 29 0a RCE_MODE.(1<<4).
b9b0: 0a 2f 2a 0a 20 2a 20 42 69 74 73 20 70 61 73 73 ./*. * Bits pass
b9c0: 65 64 20 74 6f 20 54 63 6c 5f 44 72 69 76 65 72 ed to Tcl_Driver
b9d0: 43 6c 6f 73 65 32 50 72 6f 63 20 74 6f 20 69 6e Close2Proc to in
b9e0: 64 69 63 61 74 65 20 77 68 69 63 68 20 73 69 64 dicate which sid
b9f0: 65 20 6f 66 20 61 20 63 68 61 6e 6e 65 6c 0a 20 e of a channel.
ba00: 2a 20 73 68 6f 75 6c 64 20 62 65 20 63 6c 6f 73 * should be clos
ba10: 65 64 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 ed.. */..#define
ba20: 20 54 43 4c 5f 43 4c 4f 53 45 5f 52 45 41 44 09 TCL_CLOSE_READ.
ba30: 09 28 31 3c 3c 31 29 0a 23 64 65 66 69 6e 65 20 .(1<<1).#define
ba40: 54 43 4c 5f 43 4c 4f 53 45 5f 57 52 49 54 45 09 TCL_CLOSE_WRITE.
ba50: 09 28 31 3c 3c 32 29 0a 0a 2f 2a 0a 20 2a 20 56 .(1<<2)../*. * V
ba60: 61 6c 75 65 20 74 6f 20 75 73 65 20 61 73 20 74 alue to use as t
ba70: 68 65 20 63 6c 6f 73 65 50 72 6f 63 20 66 6f 72 he closeProc for
ba80: 20 61 20 63 68 61 6e 6e 65 6c 20 74 68 61 74 20 a channel that
ba90: 73 75 70 70 6f 72 74 73 20 74 68 65 20 63 6c 6f supports the clo
baa0: 73 65 32 50 72 6f 63 0a 20 2a 20 69 6e 74 65 72 se2Proc. * inter
bab0: 66 61 63 65 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 face.. */..#defi
bac0: 6e 65 20 54 43 4c 5f 43 4c 4f 53 45 32 50 52 4f ne TCL_CLOSE2PRO
bad0: 43 09 09 4e 55 4c 4c 0a 0a 2f 2a 0a 20 2a 20 43 C..NULL../*. * C
bae0: 68 61 6e 6e 65 6c 20 76 65 72 73 69 6f 6e 20 74 hannel version t
baf0: 61 67 2e 20 54 68 69 73 20 77 61 73 20 69 6e 74 ag. This was int
bb00: 72 6f 64 75 63 65 64 20 69 6e 20 38 2e 33 2e 32 roduced in 8.3.2
bb10: 2f 38 2e 34 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 /8.4.. */..#defi
bb20: 6e 65 20 54 43 4c 5f 43 48 41 4e 4e 45 4c 5f 56 ne TCL_CHANNEL_V
bb30: 45 52 53 49 4f 4e 5f 35 09 28 28 54 63 6c 5f 43 ERSION_5.((Tcl_C
bb40: 68 61 6e 6e 65 6c 54 79 70 65 56 65 72 73 69 6f hannelTypeVersio
bb50: 6e 29 20 30 78 35 29 0a 0a 2f 2a 0a 20 2a 20 54 n) 0x5)../*. * T
bb60: 49 50 20 23 32 31 38 3a 20 43 68 61 6e 6e 65 6c IP #218: Channel
bb70: 20 41 63 74 69 6f 6e 73 2c 20 49 64 73 20 66 6f Actions, Ids fo
bb80: 72 20 54 63 6c 5f 44 72 69 76 65 72 54 68 72 65 r Tcl_DriverThre
bb90: 61 64 41 63 74 69 6f 6e 50 72 6f 63 2e 0a 20 2a adActionProc.. *
bba0: 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 43 /..#define TCL_C
bbb0: 48 41 4e 4e 45 4c 5f 54 48 52 45 41 44 5f 49 4e HANNEL_THREAD_IN
bbc0: 53 45 52 54 20 28 30 29 0a 23 64 65 66 69 6e 65 SERT (0).#define
bbd0: 20 54 43 4c 5f 43 48 41 4e 4e 45 4c 5f 54 48 52 TCL_CHANNEL_THR
bbe0: 45 41 44 5f 52 45 4d 4f 56 45 20 28 31 29 0a 0a EAD_REMOVE (1)..
bbf0: 2f 2a 0a 20 2a 20 54 79 70 65 64 65 66 73 20 66 /*. * Typedefs f
bc00: 6f 72 20 74 68 65 20 76 61 72 69 6f 75 73 20 6f or the various o
bc10: 70 65 72 61 74 69 6f 6e 73 20 69 6e 20 61 20 63 perations in a c
bc20: 68 61 6e 6e 65 6c 20 74 79 70 65 3a 0a 20 2a 2f hannel type:. */
bc30: 0a 0a 74 79 70 65 64 65 66 20 69 6e 74 09 28 54 ..typedef int.(T
bc40: 63 6c 5f 44 72 69 76 65 72 42 6c 6f 63 6b 4d 6f cl_DriverBlockMo
bc50: 64 65 50 72 6f 63 29 20 28 76 6f 69 64 20 2a 69 deProc) (void *i
bc60: 6e 73 74 61 6e 63 65 44 61 74 61 2c 20 69 6e 74 nstanceData, int
bc70: 20 6d 6f 64 65 29 3b 0a 74 79 70 65 64 65 66 20 mode);.typedef
bc80: 76 6f 69 64 20 54 63 6c 5f 44 72 69 76 65 72 43 void Tcl_DriverC
bc90: 6c 6f 73 65 50 72 6f 63 3b 0a 74 79 70 65 64 65 loseProc;.typede
bca0: 66 20 69 6e 74 09 28 54 63 6c 5f 44 72 69 76 65 f int.(Tcl_Drive
bcb0: 72 43 6c 6f 73 65 32 50 72 6f 63 29 20 28 76 6f rClose2Proc) (vo
bcc0: 69 64 20 2a 69 6e 73 74 61 6e 63 65 44 61 74 61 id *instanceData
bcd0: 2c 0a 09 09 09 54 63 6c 5f 49 6e 74 65 72 70 20 ,....Tcl_Interp
bce0: 2a 69 6e 74 65 72 70 2c 20 69 6e 74 20 66 6c 61 *interp, int fla
bcf0: 67 73 29 3b 0a 74 79 70 65 64 65 66 20 69 6e 74 gs);.typedef int
bd00: 09 28 54 63 6c 5f 44 72 69 76 65 72 49 6e 70 75 .(Tcl_DriverInpu
bd10: 74 50 72 6f 63 29 20 28 76 6f 69 64 20 2a 69 6e tProc) (void *in
bd20: 73 74 61 6e 63 65 44 61 74 61 2c 20 63 68 61 72 stanceData, char
bd30: 20 2a 62 75 66 2c 0a 09 09 09 69 6e 74 20 74 6f *buf,....int to
bd40: 52 65 61 64 2c 20 69 6e 74 20 2a 65 72 72 6f 72 Read, int *error
bd50: 43 6f 64 65 50 74 72 29 3b 0a 74 79 70 65 64 65 CodePtr);.typede
bd60: 66 20 69 6e 74 09 28 54 63 6c 5f 44 72 69 76 65 f int.(Tcl_Drive
bd70: 72 4f 75 74 70 75 74 50 72 6f 63 29 20 28 76 6f rOutputProc) (vo
bd80: 69 64 20 2a 69 6e 73 74 61 6e 63 65 44 61 74 61 id *instanceData
bd90: 2c 0a 09 09 09 63 6f 6e 73 74 20 63 68 61 72 20 ,....const char
bda0: 2a 62 75 66 2c 20 69 6e 74 20 74 6f 57 72 69 74 *buf, int toWrit
bdb0: 65 2c 20 69 6e 74 20 2a 65 72 72 6f 72 43 6f 64 e, int *errorCod
bdc0: 65 50 74 72 29 3b 0a 74 79 70 65 64 65 66 20 76 ePtr);.typedef v
bdd0: 6f 69 64 20 54 63 6c 5f 44 72 69 76 65 72 53 65 oid Tcl_DriverSe
bde0: 65 6b 50 72 6f 63 3b 0a 74 79 70 65 64 65 66 20 ekProc;.typedef
bdf0: 69 6e 74 09 28 54 63 6c 5f 44 72 69 76 65 72 53 int.(Tcl_DriverS
be00: 65 74 4f 70 74 69 6f 6e 50 72 6f 63 29 20 28 76 etOptionProc) (v
be10: 6f 69 64 20 2a 69 6e 73 74 61 6e 63 65 44 61 74 oid *instanceDat
be20: 61 2c 0a 09 09 09 54 63 6c 5f 49 6e 74 65 72 70 a,....Tcl_Interp
be30: 20 2a 69 6e 74 65 72 70 2c 20 63 6f 6e 73 74 20 *interp, const
be40: 63 68 61 72 20 2a 6f 70 74 69 6f 6e 4e 61 6d 65 char *optionName
be50: 2c 0a 09 09 09 63 6f 6e 73 74 20 63 68 61 72 20 ,....const char
be60: 2a 76 61 6c 75 65 29 3b 0a 74 79 70 65 64 65 66 *value);.typedef
be70: 20 69 6e 74 09 28 54 63 6c 5f 44 72 69 76 65 72 int.(Tcl_Driver
be80: 47 65 74 4f 70 74 69 6f 6e 50 72 6f 63 29 20 28 GetOptionProc) (
be90: 76 6f 69 64 20 2a 69 6e 73 74 61 6e 63 65 44 61 void *instanceDa
bea0: 74 61 2c 0a 09 09 09 54 63 6c 5f 49 6e 74 65 72 ta,....Tcl_Inter
beb0: 70 20 2a 69 6e 74 65 72 70 2c 20 63 6f 6e 73 74 p *interp, const
bec0: 20 63 68 61 72 20 2a 6f 70 74 69 6f 6e 4e 61 6d char *optionNam
bed0: 65 2c 0a 09 09 09 54 63 6c 5f 44 53 74 72 69 6e e,....Tcl_DStrin
bee0: 67 20 2a 64 73 50 74 72 29 3b 0a 74 79 70 65 64 g *dsPtr);.typed
bef0: 65 66 20 76 6f 69 64 09 28 54 63 6c 5f 44 72 69 ef void.(Tcl_Dri
bf00: 76 65 72 57 61 74 63 68 50 72 6f 63 29 20 28 76 verWatchProc) (v
bf10: 6f 69 64 20 2a 69 6e 73 74 61 6e 63 65 44 61 74 oid *instanceDat
bf20: 61 2c 20 69 6e 74 20 6d 61 73 6b 29 3b 0a 74 79 a, int mask);.ty
bf30: 70 65 64 65 66 20 69 6e 74 09 28 54 63 6c 5f 44 pedef int.(Tcl_D
bf40: 72 69 76 65 72 47 65 74 48 61 6e 64 6c 65 50 72 riverGetHandlePr
bf50: 6f 63 29 20 28 76 6f 69 64 20 2a 69 6e 73 74 61 oc) (void *insta
bf60: 6e 63 65 44 61 74 61 2c 0a 09 09 09 69 6e 74 20 nceData,....int
bf70: 64 69 72 65 63 74 69 6f 6e 2c 20 76 6f 69 64 20 direction, void
bf80: 2a 2a 68 61 6e 64 6c 65 50 74 72 29 3b 0a 74 79 **handlePtr);.ty
bf90: 70 65 64 65 66 20 69 6e 74 09 28 54 63 6c 5f 44 pedef int.(Tcl_D
bfa0: 72 69 76 65 72 46 6c 75 73 68 50 72 6f 63 29 20 riverFlushProc)
bfb0: 28 76 6f 69 64 20 2a 69 6e 73 74 61 6e 63 65 44 (void *instanceD
bfc0: 61 74 61 29 3b 0a 74 79 70 65 64 65 66 20 69 6e ata);.typedef in
bfd0: 74 09 28 54 63 6c 5f 44 72 69 76 65 72 48 61 6e t.(Tcl_DriverHan
bfe0: 64 6c 65 72 50 72 6f 63 29 20 28 76 6f 69 64 20 dlerProc) (void
bff0: 2a 69 6e 73 74 61 6e 63 65 44 61 74 61 2c 0a 09 *instanceData,..
c000: 09 09 69 6e 74 20 69 6e 74 65 72 65 73 74 4d 61 ..int interestMa
c010: 73 6b 29 3b 0a 74 79 70 65 64 65 66 20 6c 6f 6e sk);.typedef lon
c020: 67 20 6c 6f 6e 67 20 28 54 63 6c 5f 44 72 69 76 g long (Tcl_Driv
c030: 65 72 57 69 64 65 53 65 65 6b 50 72 6f 63 29 20 erWideSeekProc)
c040: 28 76 6f 69 64 20 2a 69 6e 73 74 61 6e 63 65 44 (void *instanceD
c050: 61 74 61 2c 0a 09 09 09 6c 6f 6e 67 20 6c 6f 6e ata,....long lon
c060: 67 20 6f 66 66 73 65 74 2c 20 69 6e 74 20 6d 6f g offset, int mo
c070: 64 65 2c 20 69 6e 74 20 2a 65 72 72 6f 72 43 6f de, int *errorCo
c080: 64 65 50 74 72 29 3b 0a 2f 2a 0a 20 2a 20 54 49 dePtr);./*. * TI
c090: 50 20 23 32 31 38 2c 20 43 68 61 6e 6e 65 6c 20 P #218, Channel
c0a0: 54 68 72 65 61 64 20 41 63 74 69 6f 6e 73 0a 20 Thread Actions.
c0b0: 2a 2f 0a 74 79 70 65 64 65 66 20 76 6f 69 64 09 */.typedef void.
c0c0: 28 54 63 6c 5f 44 72 69 76 65 72 54 68 72 65 61 (Tcl_DriverThrea
c0d0: 64 41 63 74 69 6f 6e 50 72 6f 63 29 20 28 76 6f dActionProc) (vo
c0e0: 69 64 20 2a 69 6e 73 74 61 6e 63 65 44 61 74 61 id *instanceData
c0f0: 2c 0a 09 09 09 69 6e 74 20 61 63 74 69 6f 6e 29 ,....int action)
c100: 3b 0a 2f 2a 0a 20 2a 20 54 49 50 20 23 32 30 38 ;./*. * TIP #208
c110: 2c 20 46 69 6c 65 20 54 72 75 6e 63 61 74 69 6f , File Truncatio
c120: 6e 20 28 65 74 63 2e 29 0a 20 2a 2f 0a 74 79 70 n (etc.). */.typ
c130: 65 64 65 66 20 69 6e 74 09 28 54 63 6c 5f 44 72 edef int.(Tcl_Dr
c140: 69 76 65 72 54 72 75 6e 63 61 74 65 50 72 6f 63 iverTruncateProc
c150: 29 20 28 76 6f 69 64 20 2a 69 6e 73 74 61 6e 63 ) (void *instanc
c160: 65 44 61 74 61 2c 0a 09 09 09 6c 6f 6e 67 20 6c eData,....long l
c170: 6f 6e 67 20 6c 65 6e 67 74 68 29 3b 0a 0a 2f 2a ong length);../*
c180: 0a 20 2a 20 73 74 72 75 63 74 20 54 63 6c 5f 43 . * struct Tcl_C
c190: 68 61 6e 6e 65 6c 54 79 70 65 3a 0a 20 2a 0a 20 hannelType:. *.
c1a0: 2a 20 4f 6e 65 20 73 75 63 68 20 73 74 72 75 63 * One such struc
c1b0: 74 75 72 65 20 65 78 69 73 74 73 20 66 6f 72 20 ture exists for
c1c0: 65 61 63 68 20 74 79 70 65 20 28 6b 69 6e 64 29 each type (kind)
c1d0: 20 6f 66 20 63 68 61 6e 6e 65 6c 2e 20 49 74 20 of channel. It
c1e0: 63 6f 6c 6c 65 63 74 73 0a 20 2a 20 74 6f 67 65 collects. * toge
c1f0: 74 68 65 72 20 69 6e 20 6f 6e 65 20 70 6c 61 63 ther in one plac
c200: 65 20 61 6c 6c 20 74 68 65 20 66 75 6e 63 74 69 e all the functi
c210: 6f 6e 73 20 74 68 61 74 20 61 72 65 20 70 61 72 ons that are par
c220: 74 20 6f 66 20 74 68 65 20 73 70 65 63 69 66 69 t of the specifi
c230: 63 0a 20 2a 20 63 68 61 6e 6e 65 6c 20 74 79 70 c. * channel typ
c240: 65 2e 0a 20 2a 0a 20 2a 20 49 74 20 69 73 20 72 e.. *. * It is r
c250: 65 63 6f 6d 6d 65 6e 64 20 74 68 61 74 20 74 68 ecommend that th
c260: 65 20 54 63 6c 5f 43 68 61 6e 6e 65 6c 2a 20 66 e Tcl_Channel* f
c270: 75 6e 63 74 69 6f 6e 73 20 61 72 65 20 75 73 65 unctions are use
c280: 64 20 74 6f 20 61 63 63 65 73 73 20 65 6c 65 6d d to access elem
c290: 65 6e 74 73 0a 20 2a 20 6f 66 20 74 68 69 73 20 ents. * of this
c2a0: 73 74 72 75 63 74 75 72 65 2c 20 69 6e 73 74 65 structure, inste
c2b0: 61 64 20 6f 66 20 64 69 72 65 63 74 20 61 63 63 ad of direct acc
c2c0: 65 73 73 69 6e 67 2e 0a 20 2a 2f 0a 0a 74 79 70 essing.. */..typ
c2d0: 65 64 65 66 20 73 74 72 75 63 74 20 54 63 6c 5f edef struct Tcl_
c2e0: 43 68 61 6e 6e 65 6c 54 79 70 65 20 7b 0a 20 20 ChannelType {.
c2f0: 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 74 79 const char *ty
c300: 70 65 4e 61 6d 65 3b 09 2f 2a 20 54 68 65 20 6e peName;./* The n
c310: 61 6d 65 20 6f 66 20 74 68 65 20 63 68 61 6e 6e ame of the chann
c320: 65 6c 20 74 79 70 65 20 69 6e 20 54 63 6c 0a 09 el type in Tcl..
c330: 09 09 09 20 2a 20 63 6f 6d 6d 61 6e 64 73 2e 20 ... * commands.
c340: 54 68 69 73 20 73 74 6f 72 61 67 65 20 69 73 20 This storage is
c350: 6f 77 6e 65 64 20 62 79 20 63 68 61 6e 6e 65 6c owned by channel
c360: 0a 09 09 09 09 20 2a 20 74 79 70 65 2e 20 2a 2f ..... * type. */
c370: 0a 20 20 20 20 54 63 6c 5f 43 68 61 6e 6e 65 6c . Tcl_Channel
c380: 54 79 70 65 56 65 72 73 69 6f 6e 20 76 65 72 73 TypeVersion vers
c390: 69 6f 6e 3b 0a 09 09 09 09 2f 2a 20 56 65 72 73 ion;...../* Vers
c3a0: 69 6f 6e 20 6f 66 20 74 68 65 20 63 68 61 6e 6e ion of the chann
c3b0: 65 6c 20 74 79 70 65 2e 20 2a 2f 0a 20 20 20 20 el type. */.
c3c0: 76 6f 69 64 20 2a 63 6c 6f 73 65 50 72 6f 63 3b void *closeProc;
c3d0: 09 09 2f 2a 20 4e 6f 74 20 75 73 65 64 20 61 6e ../* Not used an
c3e0: 79 20 6d 6f 72 65 2e 20 2a 2f 0a 20 20 20 20 54 y more. */. T
c3f0: 63 6c 5f 44 72 69 76 65 72 49 6e 70 75 74 50 72 cl_DriverInputPr
c400: 6f 63 20 2a 69 6e 70 75 74 50 72 6f 63 3b 0a 09 oc *inputProc;..
c410: 09 09 09 2f 2a 20 46 75 6e 63 74 69 6f 6e 20 74 .../* Function t
c420: 6f 20 63 61 6c 6c 20 66 6f 72 20 69 6e 70 75 74 o call for input
c430: 20 6f 6e 20 63 68 61 6e 6e 65 6c 2e 20 2a 2f 0a on channel. */.
c440: 20 20 20 20 54 63 6c 5f 44 72 69 76 65 72 4f 75 Tcl_DriverOu
c450: 74 70 75 74 50 72 6f 63 20 2a 6f 75 74 70 75 74 tputProc *output
c460: 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 46 75 6e Proc;...../* Fun
c470: 63 74 69 6f 6e 20 74 6f 20 63 61 6c 6c 20 66 6f ction to call fo
c480: 72 20 6f 75 74 70 75 74 20 6f 6e 20 63 68 61 6e r output on chan
c490: 6e 65 6c 2e 20 2a 2f 0a 20 20 20 20 76 6f 69 64 nel. */. void
c4a0: 20 2a 73 65 65 6b 50 72 6f 63 3b 09 09 2f 2a 20 *seekProc;../*
c4b0: 4e 6f 74 20 75 73 65 64 20 61 6e 79 20 6d 6f 72 Not used any mor
c4c0: 65 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 44 72 e. */. Tcl_Dr
c4d0: 69 76 65 72 53 65 74 4f 70 74 69 6f 6e 50 72 6f iverSetOptionPro
c4e0: 63 20 2a 73 65 74 4f 70 74 69 6f 6e 50 72 6f 63 c *setOptionProc
c4f0: 3b 0a 09 09 09 09 2f 2a 20 53 65 74 20 61 6e 20 ;...../* Set an
c500: 6f 70 74 69 6f 6e 20 6f 6e 20 61 20 63 68 61 6e option on a chan
c510: 6e 65 6c 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f nel. */. Tcl_
c520: 44 72 69 76 65 72 47 65 74 4f 70 74 69 6f 6e 50 DriverGetOptionP
c530: 72 6f 63 20 2a 67 65 74 4f 70 74 69 6f 6e 50 72 roc *getOptionPr
c540: 6f 63 3b 0a 09 09 09 09 2f 2a 20 47 65 74 20 61 oc;...../* Get a
c550: 6e 20 6f 70 74 69 6f 6e 20 66 72 6f 6d 20 61 20 n option from a
c560: 63 68 61 6e 6e 65 6c 2e 20 2a 2f 0a 20 20 20 20 channel. */.
c570: 54 63 6c 5f 44 72 69 76 65 72 57 61 74 63 68 50 Tcl_DriverWatchP
c580: 72 6f 63 20 2a 77 61 74 63 68 50 72 6f 63 3b 0a roc *watchProc;.
c590: 09 09 09 09 2f 2a 20 53 65 74 20 75 70 20 74 68 ..../* Set up th
c5a0: 65 20 6e 6f 74 69 66 69 65 72 20 74 6f 20 77 61 e notifier to wa
c5b0: 74 63 68 20 66 6f 72 20 65 76 65 6e 74 73 20 6f tch for events o
c5c0: 6e 0a 09 09 09 09 20 2a 20 74 68 69 73 20 63 68 n..... * this ch
c5d0: 61 6e 6e 65 6c 2e 20 2a 2f 0a 20 20 20 20 54 63 annel. */. Tc
c5e0: 6c 5f 44 72 69 76 65 72 47 65 74 48 61 6e 64 6c l_DriverGetHandl
c5f0: 65 50 72 6f 63 20 2a 67 65 74 48 61 6e 64 6c 65 eProc *getHandle
c600: 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 47 65 74 Proc;...../* Get
c610: 20 61 6e 20 4f 53 20 68 61 6e 64 6c 65 20 66 72 an OS handle fr
c620: 6f 6d 20 74 68 65 20 63 68 61 6e 6e 65 6c 20 6f om the channel o
c630: 72 20 4e 55 4c 4c 0a 09 09 09 09 20 2a 20 69 66 r NULL..... * if
c640: 20 6e 6f 74 20 73 75 70 70 6f 72 74 65 64 2e 20 not supported.
c650: 2a 2f 0a 20 20 20 20 54 63 6c 5f 44 72 69 76 65 */. Tcl_Drive
c660: 72 43 6c 6f 73 65 32 50 72 6f 63 20 2a 63 6c 6f rClose2Proc *clo
c670: 73 65 32 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 se2Proc;...../*
c680: 46 75 6e 63 74 69 6f 6e 20 74 6f 20 63 61 6c 6c Function to call
c690: 20 74 6f 20 63 6c 6f 73 65 20 74 68 65 20 63 68 to close the ch
c6a0: 61 6e 6e 65 6c 20 69 66 0a 09 09 09 09 20 2a 20 annel if..... *
c6b0: 74 68 65 20 64 65 76 69 63 65 20 73 75 70 70 6f the device suppo
c6c0: 72 74 73 20 63 6c 6f 73 69 6e 67 20 74 68 65 20 rts closing the
c6d0: 72 65 61 64 20 26 0a 09 09 09 09 20 2a 20 77 72 read &..... * wr
c6e0: 69 74 65 20 73 69 64 65 73 20 69 6e 64 65 70 65 ite sides indepe
c6f0: 6e 64 65 6e 74 6c 79 2e 20 2a 2f 0a 20 20 20 20 ndently. */.
c700: 54 63 6c 5f 44 72 69 76 65 72 42 6c 6f 63 6b 4d Tcl_DriverBlockM
c710: 6f 64 65 50 72 6f 63 20 2a 62 6c 6f 63 6b 4d 6f odeProc *blockMo
c720: 64 65 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 53 deProc;...../* S
c730: 65 74 20 62 6c 6f 63 6b 69 6e 67 20 6d 6f 64 65 et blocking mode
c740: 20 66 6f 72 20 74 68 65 20 72 61 77 20 63 68 61 for the raw cha
c750: 6e 6e 65 6c 2e 20 4d 61 79 0a 09 09 09 09 20 2a nnel. May..... *
c760: 20 62 65 20 4e 55 4c 4c 2e 20 2a 2f 0a 20 20 20 be NULL. */.
c770: 20 54 63 6c 5f 44 72 69 76 65 72 46 6c 75 73 68 Tcl_DriverFlush
c780: 50 72 6f 63 20 2a 66 6c 75 73 68 50 72 6f 63 3b Proc *flushProc;
c790: 0a 09 09 09 09 2f 2a 20 46 75 6e 63 74 69 6f 6e ...../* Function
c7a0: 20 74 6f 20 63 61 6c 6c 20 74 6f 20 66 6c 75 73 to call to flus
c7b0: 68 20 61 20 63 68 61 6e 6e 65 6c 2e 20 4d 61 79 h a channel. May
c7c0: 20 62 65 0a 09 09 09 09 20 2a 20 4e 55 4c 4c 2e be..... * NULL.
c7d0: 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 44 72 69 76 */. Tcl_Driv
c7e0: 65 72 48 61 6e 64 6c 65 72 50 72 6f 63 20 2a 68 erHandlerProc *h
c7f0: 61 6e 64 6c 65 72 50 72 6f 63 3b 0a 09 09 09 09 andlerProc;.....
c800: 2f 2a 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 63 /* Function to c
c810: 61 6c 6c 20 74 6f 20 68 61 6e 64 6c 65 20 61 20 all to handle a
c820: 63 68 61 6e 6e 65 6c 20 65 76 65 6e 74 2e 0a 09 channel event...
c830: 09 09 09 20 2a 20 54 68 69 73 20 77 69 6c 6c 20 ... * This will
c840: 62 65 20 70 61 73 73 65 64 20 75 70 20 74 68 65 be passed up the
c850: 20 73 74 61 63 6b 65 64 20 63 68 61 6e 6e 65 6c stacked channel
c860: 0a 09 09 09 09 20 2a 20 63 68 61 69 6e 2e 20 2a ..... * chain. *
c870: 2f 0a 20 20 20 20 54 63 6c 5f 44 72 69 76 65 72 /. Tcl_Driver
c880: 57 69 64 65 53 65 65 6b 50 72 6f 63 20 2a 77 69 WideSeekProc *wi
c890: 64 65 53 65 65 6b 50 72 6f 63 3b 0a 09 09 09 09 deSeekProc;.....
c8a0: 2f 2a 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 63 /* Function to c
c8b0: 61 6c 6c 20 74 6f 20 73 65 65 6b 20 6f 6e 20 74 all to seek on t
c8c0: 68 65 20 63 68 61 6e 6e 65 6c 0a 09 09 09 09 20 he channel.....
c8d0: 2a 20 77 68 69 63 68 20 63 61 6e 20 68 61 6e 64 * which can hand
c8e0: 6c 65 20 36 34 2d 62 69 74 20 6f 66 66 73 65 74 le 64-bit offset
c8f0: 73 2e 20 4d 61 79 20 62 65 0a 09 09 09 09 20 2a s. May be..... *
c900: 20 4e 55 4c 4c 2c 20 61 6e 64 20 6d 75 73 74 20 NULL, and must
c910: 62 65 20 4e 55 4c 4c 20 69 66 20 73 65 65 6b 50 be NULL if seekP
c920: 72 6f 63 20 69 73 0a 09 09 09 09 20 2a 20 4e 55 roc is..... * NU
c930: 4c 4c 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 44 LL. */. Tcl_D
c940: 72 69 76 65 72 54 68 72 65 61 64 41 63 74 69 6f riverThreadActio
c950: 6e 50 72 6f 63 20 2a 74 68 72 65 61 64 41 63 74 nProc *threadAct
c960: 69 6f 6e 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 ionProc;...../*
c970: 46 75 6e 63 74 69 6f 6e 20 74 6f 20 63 61 6c 6c Function to call
c980: 20 74 6f 20 6e 6f 74 69 66 79 20 74 68 65 20 64 to notify the d
c990: 72 69 76 65 72 20 6f 66 0a 09 09 09 09 20 2a 20 river of..... *
c9a0: 74 68 72 65 61 64 20 73 70 65 63 69 66 69 63 20 thread specific
c9b0: 61 63 74 69 76 69 74 79 20 66 6f 72 20 61 20 63 activity for a c
c9c0: 68 61 6e 6e 65 6c 2e 20 4d 61 79 0a 09 09 09 09 hannel. May.....
c9d0: 20 2a 20 62 65 20 4e 55 4c 4c 2e 20 2a 2f 0a 20 * be NULL. */.
c9e0: 20 20 20 54 63 6c 5f 44 72 69 76 65 72 54 72 75 Tcl_DriverTru
c9f0: 6e 63 61 74 65 50 72 6f 63 20 2a 74 72 75 6e 63 ncateProc *trunc
ca00: 61 74 65 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 ateProc;...../*
ca10: 46 75 6e 63 74 69 6f 6e 20 74 6f 20 63 61 6c 6c Function to call
ca20: 20 74 6f 20 74 72 75 6e 63 61 74 65 20 74 68 65 to truncate the
ca30: 20 75 6e 64 65 72 6c 79 69 6e 67 0a 09 09 09 09 underlying.....
ca40: 20 2a 20 66 69 6c 65 20 74 6f 20 61 20 70 61 72 * file to a par
ca50: 74 69 63 75 6c 61 72 20 6c 65 6e 67 74 68 2e 20 ticular length.
ca60: 4d 61 79 20 62 65 20 4e 55 4c 4c 20 69 66 0a 09 May be NULL if..
ca70: 09 09 09 20 2a 20 74 68 65 20 63 68 61 6e 6e 65 ... * the channe
ca80: 6c 20 64 6f 65 73 20 6e 6f 74 20 73 75 70 70 6f l does not suppo
ca90: 72 74 20 74 72 75 6e 63 61 74 69 6f 6e 2e 20 2a rt truncation. *
caa0: 2f 0a 7d 20 54 63 6c 5f 43 68 61 6e 6e 65 6c 54 /.} Tcl_ChannelT
cab0: 79 70 65 3b 0a 0a 2f 2a 0a 20 2a 20 54 68 65 20 ype;../*. * The
cac0: 66 6f 6c 6c 6f 77 69 6e 67 20 66 6c 61 67 73 20 following flags
cad0: 64 65 74 65 72 6d 69 6e 65 20 77 68 65 74 68 65 determine whethe
cae0: 72 20 74 68 65 20 62 6c 6f 63 6b 4d 6f 64 65 50 r the blockModeP
caf0: 72 6f 63 20 61 62 6f 76 65 20 73 68 6f 75 6c 64 roc above should
cb00: 20 73 65 74 0a 20 2a 20 74 68 65 20 63 68 61 6e set. * the chan
cb10: 6e 65 6c 20 69 6e 74 6f 20 62 6c 6f 63 6b 69 6e nel into blockin
cb20: 67 20 6f 72 20 6e 6f 6e 62 6c 6f 63 6b 69 6e 67 g or nonblocking
cb30: 20 6d 6f 64 65 2e 20 54 68 65 79 20 61 72 65 20 mode. They are
cb40: 70 61 73 73 65 64 20 61 73 20 61 72 67 75 6d 65 passed as argume
cb50: 6e 74 73 0a 20 2a 20 74 6f 20 74 68 65 20 62 6c nts. * to the bl
cb60: 6f 63 6b 4d 6f 64 65 50 72 6f 63 20 66 75 6e 63 ockModeProc func
cb70: 74 69 6f 6e 20 69 6e 20 74 68 65 20 61 62 6f 76 tion in the abov
cb80: 65 20 73 74 72 75 63 74 75 72 65 2e 0a 20 2a 2f e structure.. */
cb90: 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4d 4f ..#define TCL_MO
cba0: 44 45 5f 42 4c 4f 43 4b 49 4e 47 09 30 09 2f 2a DE_BLOCKING.0./*
cbb0: 20 50 75 74 20 63 68 61 6e 6e 65 6c 20 69 6e 74 Put channel int
cbc0: 6f 20 62 6c 6f 63 6b 69 6e 67 20 6d 6f 64 65 2e o blocking mode.
cbd0: 20 2a 2f 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f */.#define TCL_
cbe0: 4d 4f 44 45 5f 4e 4f 4e 42 4c 4f 43 4b 49 4e 47 MODE_NONBLOCKING
cbf0: 09 31 09 2f 2a 20 50 75 74 20 63 68 61 6e 6e 65 .1./* Put channe
cc00: 6c 20 69 6e 74 6f 20 6e 6f 6e 62 6c 6f 63 6b 69 l into nonblocki
cc10: 6e 67 0a 09 09 09 09 09 20 2a 20 6d 6f 64 65 2e ng...... * mode.
cc20: 20 2a 2f 0a 0a 2f 2a 0a 20 2a 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 2d 2d 2d 2d 2d 2d ----------------
cc60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
cc70: 2d 2d 2d 2d 2d 2d 0a 20 2a 20 45 6e 75 6d 20 66 ------. * Enum f
cc80: 6f 72 20 64 69 66 66 65 72 65 6e 74 20 74 79 70 or different typ
cc90: 65 73 20 6f 66 20 66 69 6c 65 20 70 61 74 68 73 es of file paths
cca0: 2e 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 65 .. */..typedef e
ccb0: 6e 75 6d 20 54 63 6c 5f 50 61 74 68 54 79 70 65 num Tcl_PathType
ccc0: 20 7b 0a 20 20 20 20 54 43 4c 5f 50 41 54 48 5f {. TCL_PATH_
ccd0: 41 42 53 4f 4c 55 54 45 2c 0a 20 20 20 20 54 43 ABSOLUTE,. TC
cce0: 4c 5f 50 41 54 48 5f 52 45 4c 41 54 49 56 45 2c L_PATH_RELATIVE,
ccf0: 0a 20 20 20 20 54 43 4c 5f 50 41 54 48 5f 56 4f . TCL_PATH_VO
cd00: 4c 55 4d 45 5f 52 45 4c 41 54 49 56 45 0a 7d 20 LUME_RELATIVE.}
cd10: 54 63 6c 5f 50 61 74 68 54 79 70 65 3b 0a 0a 2f Tcl_PathType;../
cd20: 2a 0a 20 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 69 *. * The followi
cd30: 6e 67 20 73 74 72 75 63 74 75 72 65 20 69 73 20 ng structure is
cd40: 75 73 65 64 20 74 6f 20 70 61 73 73 20 67 6c 6f used to pass glo
cd50: 62 20 74 79 70 65 20 64 61 74 61 20 61 6d 6f 6e b type data amon
cd60: 67 73 74 20 74 68 65 20 76 61 72 69 6f 75 73 0a gst the various.
cd70: 20 2a 20 67 6c 6f 62 20 72 6f 75 74 69 6e 65 73 * glob routines
cd80: 20 61 6e 64 20 54 63 6c 5f 46 53 4d 61 74 63 68 and Tcl_FSMatch
cd90: 49 6e 44 69 72 65 63 74 6f 72 79 2e 0a 20 2a 2f InDirectory.. */
cda0: 0a 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 74 ..typedef struct
cdb0: 20 54 63 6c 5f 47 6c 6f 62 54 79 70 65 44 61 74 Tcl_GlobTypeDat
cdc0: 61 20 7b 0a 20 20 20 20 69 6e 74 20 74 79 70 65 a {. int type
cdd0: 3b 09 09 09 2f 2a 20 43 6f 72 72 65 73 70 6f 6e ;.../* Correspon
cde0: 64 73 20 74 6f 20 62 63 64 70 66 6c 73 20 61 73 ds to bcdpfls as
cdf0: 20 69 6e 20 27 66 69 6e 64 20 2d 74 27 2e 20 2a in 'find -t'. *
ce00: 2f 0a 20 20 20 20 69 6e 74 20 70 65 72 6d 3b 09 /. int perm;.
ce10: 09 09 2f 2a 20 43 6f 72 72 65 73 70 6f 6e 64 73 ../* Corresponds
ce20: 20 74 6f 20 66 69 6c 65 20 70 65 72 6d 69 73 73 to file permiss
ce30: 69 6f 6e 73 2e 20 2a 2f 0a 20 20 20 20 54 63 6c ions. */. Tcl
ce40: 5f 4f 62 6a 20 2a 6d 61 63 54 79 70 65 3b 09 09 _Obj *macType;..
ce50: 2f 2a 20 41 63 63 65 70 74 61 62 6c 65 20 4d 61 /* Acceptable Ma
ce60: 63 20 74 79 70 65 2e 20 2a 2f 0a 20 20 20 20 54 c type. */. T
ce70: 63 6c 5f 4f 62 6a 20 2a 6d 61 63 43 72 65 61 74 cl_Obj *macCreat
ce80: 6f 72 3b 09 2f 2a 20 41 63 63 65 70 74 61 62 6c or;./* Acceptabl
ce90: 65 20 4d 61 63 20 63 72 65 61 74 6f 72 2e 20 2a e Mac creator. *
cea0: 2f 0a 7d 20 54 63 6c 5f 47 6c 6f 62 54 79 70 65 /.} Tcl_GlobType
ceb0: 44 61 74 61 3b 0a 0a 2f 2a 0a 20 2a 20 54 79 70 Data;../*. * Typ
cec0: 65 20 61 6e 64 20 70 65 72 6d 69 73 73 69 6f 6e e and permission
ced0: 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 66 6f 72 definitions for
cee0: 20 67 6c 6f 62 20 63 6f 6d 6d 61 6e 64 2e 0a 20 glob command..
cef0: 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f */..#define TCL_
cf00: 47 4c 4f 42 5f 54 59 50 45 5f 42 4c 4f 43 4b 09 GLOB_TYPE_BLOCK.
cf10: 09 28 31 3c 3c 30 29 0a 23 64 65 66 69 6e 65 20 .(1<<0).#define
cf20: 54 43 4c 5f 47 4c 4f 42 5f 54 59 50 45 5f 43 48 TCL_GLOB_TYPE_CH
cf30: 41 52 09 09 28 31 3c 3c 31 29 0a 23 64 65 66 69 AR..(1<<1).#defi
cf40: 6e 65 20 54 43 4c 5f 47 4c 4f 42 5f 54 59 50 45 ne TCL_GLOB_TYPE
cf50: 5f 44 49 52 09 09 28 31 3c 3c 32 29 0a 23 64 65 _DIR..(1<<2).#de
cf60: 66 69 6e 65 20 54 43 4c 5f 47 4c 4f 42 5f 54 59 fine TCL_GLOB_TY
cf70: 50 45 5f 50 49 50 45 09 09 28 31 3c 3c 33 29 0a PE_PIPE..(1<<3).
cf80: 23 64 65 66 69 6e 65 20 54 43 4c 5f 47 4c 4f 42 #define TCL_GLOB
cf90: 5f 54 59 50 45 5f 46 49 4c 45 09 09 28 31 3c 3c _TYPE_FILE..(1<<
cfa0: 34 29 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 47 4).#define TCL_G
cfb0: 4c 4f 42 5f 54 59 50 45 5f 4c 49 4e 4b 09 09 28 LOB_TYPE_LINK..(
cfc0: 31 3c 3c 35 29 0a 23 64 65 66 69 6e 65 20 54 43 1<<5).#define TC
cfd0: 4c 5f 47 4c 4f 42 5f 54 59 50 45 5f 53 4f 43 4b L_GLOB_TYPE_SOCK
cfe0: 09 09 28 31 3c 3c 36 29 0a 23 64 65 66 69 6e 65 ..(1<<6).#define
cff0: 20 54 43 4c 5f 47 4c 4f 42 5f 54 59 50 45 5f 4d TCL_GLOB_TYPE_M
d000: 4f 55 4e 54 09 09 28 31 3c 3c 37 29 0a 0a 23 64 OUNT..(1<<7)..#d
d010: 65 66 69 6e 65 20 54 43 4c 5f 47 4c 4f 42 5f 50 efine TCL_GLOB_P
d020: 45 52 4d 5f 52 4f 4e 4c 59 09 09 28 31 3c 3c 30 ERM_RONLY..(1<<0
d030: 29 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 47 4c ).#define TCL_GL
d040: 4f 42 5f 50 45 52 4d 5f 48 49 44 44 45 4e 09 09 OB_PERM_HIDDEN..
d050: 28 31 3c 3c 31 29 0a 23 64 65 66 69 6e 65 20 54 (1<<1).#define T
d060: 43 4c 5f 47 4c 4f 42 5f 50 45 52 4d 5f 52 09 09 CL_GLOB_PERM_R..
d070: 09 28 31 3c 3c 32 29 0a 23 64 65 66 69 6e 65 20 .(1<<2).#define
d080: 54 43 4c 5f 47 4c 4f 42 5f 50 45 52 4d 5f 57 09 TCL_GLOB_PERM_W.
d090: 09 09 28 31 3c 3c 33 29 0a 23 64 65 66 69 6e 65 ..(1<<3).#define
d0a0: 20 54 43 4c 5f 47 4c 4f 42 5f 50 45 52 4d 5f 58 TCL_GLOB_PERM_X
d0b0: 09 09 09 28 31 3c 3c 34 29 0a 0a 2f 2a 0a 20 2a ...(1<<4)../*. *
d0c0: 20 46 6c 61 67 73 20 66 6f 72 20 74 68 65 20 75 Flags for the u
d0d0: 6e 6c 6f 61 64 20 63 61 6c 6c 62 61 63 6b 20 66 nload callback f
d0e0: 75 6e 63 74 69 6f 6e 2e 0a 20 2a 2f 0a 0a 23 64 unction.. */..#d
d0f0: 65 66 69 6e 65 20 54 43 4c 5f 55 4e 4c 4f 41 44 efine TCL_UNLOAD
d100: 5f 44 45 54 41 43 48 5f 46 52 4f 4d 5f 49 4e 54 _DETACH_FROM_INT
d110: 45 52 50 52 45 54 45 52 09 28 31 3c 3c 30 29 0a ERPRETER.(1<<0).
d120: 23 64 65 66 69 6e 65 20 54 43 4c 5f 55 4e 4c 4f #define TCL_UNLO
d130: 41 44 5f 44 45 54 41 43 48 5f 46 52 4f 4d 5f 50 AD_DETACH_FROM_P
d140: 52 4f 43 45 53 53 09 09 28 31 3c 3c 31 29 0a 0a ROCESS..(1<<1)..
d150: 2f 2a 0a 20 2a 20 54 79 70 65 64 65 66 73 20 66 /*. * Typedefs f
d160: 6f 72 20 74 68 65 20 76 61 72 69 6f 75 73 20 66 or the various f
d170: 69 6c 65 73 79 73 74 65 6d 20 6f 70 65 72 61 74 ilesystem operat
d180: 69 6f 6e 73 3a 0a 20 2a 2f 0a 0a 74 79 70 65 64 ions:. */..typed
d190: 65 66 20 69 6e 74 20 28 54 63 6c 5f 46 53 53 74 ef int (Tcl_FSSt
d1a0: 61 74 50 72 6f 63 29 20 28 54 63 6c 5f 4f 62 6a atProc) (Tcl_Obj
d1b0: 20 2a 70 61 74 68 50 74 72 2c 20 54 63 6c 5f 53 *pathPtr, Tcl_S
d1c0: 74 61 74 42 75 66 20 2a 62 75 66 29 3b 0a 74 79 tatBuf *buf);.ty
d1d0: 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 46 pedef int (Tcl_F
d1e0: 53 41 63 63 65 73 73 50 72 6f 63 29 20 28 54 63 SAccessProc) (Tc
d1f0: 6c 5f 4f 62 6a 20 2a 70 61 74 68 50 74 72 2c 20 l_Obj *pathPtr,
d200: 69 6e 74 20 6d 6f 64 65 29 3b 0a 74 79 70 65 64 int mode);.typed
d210: 65 66 20 54 63 6c 5f 43 68 61 6e 6e 65 6c 20 28 ef Tcl_Channel (
d220: 54 63 6c 5f 46 53 4f 70 65 6e 46 69 6c 65 43 68 Tcl_FSOpenFileCh
d230: 61 6e 6e 65 6c 50 72 6f 63 29 20 28 54 63 6c 5f annelProc) (Tcl_
d240: 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c 0a Interp *interp,.
d250: 09 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68 50 74 .Tcl_Obj *pathPt
d260: 72 2c 20 69 6e 74 20 6d 6f 64 65 2c 20 69 6e 74 r, int mode, int
d270: 20 70 65 72 6d 69 73 73 69 6f 6e 73 29 3b 0a 74 permissions);.t
d280: 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f ypedef int (Tcl_
d290: 46 53 4d 61 74 63 68 49 6e 44 69 72 65 63 74 6f FSMatchInDirecto
d2a0: 72 79 50 72 6f 63 29 20 28 54 63 6c 5f 49 6e 74 ryProc) (Tcl_Int
d2b0: 65 72 70 20 2a 69 6e 74 65 72 70 2c 20 54 63 6c erp *interp, Tcl
d2c0: 5f 4f 62 6a 20 2a 72 65 73 75 6c 74 2c 0a 09 54 _Obj *result,..T
d2d0: 63 6c 5f 4f 62 6a 20 2a 70 61 74 68 50 74 72 2c cl_Obj *pathPtr,
d2e0: 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 70 61 74 const char *pat
d2f0: 74 65 72 6e 2c 20 54 63 6c 5f 47 6c 6f 62 54 79 tern, Tcl_GlobTy
d300: 70 65 44 61 74 61 20 2a 74 79 70 65 73 29 3b 0a peData *types);.
d310: 74 79 70 65 64 65 66 20 54 63 6c 5f 4f 62 6a 20 typedef Tcl_Obj
d320: 2a 20 28 54 63 6c 5f 46 53 47 65 74 43 77 64 50 * (Tcl_FSGetCwdP
d330: 72 6f 63 29 20 28 54 63 6c 5f 49 6e 74 65 72 70 roc) (Tcl_Interp
d340: 20 2a 69 6e 74 65 72 70 29 3b 0a 74 79 70 65 64 *interp);.typed
d350: 65 66 20 69 6e 74 20 28 54 63 6c 5f 46 53 43 68 ef int (Tcl_FSCh
d360: 64 69 72 50 72 6f 63 29 20 28 54 63 6c 5f 4f 62 dirProc) (Tcl_Ob
d370: 6a 20 2a 70 61 74 68 50 74 72 29 3b 0a 74 79 70 j *pathPtr);.typ
d380: 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 46 53 edef int (Tcl_FS
d390: 4c 73 74 61 74 50 72 6f 63 29 20 28 54 63 6c 5f LstatProc) (Tcl_
d3a0: 4f 62 6a 20 2a 70 61 74 68 50 74 72 2c 20 54 63 Obj *pathPtr, Tc
d3b0: 6c 5f 53 74 61 74 42 75 66 20 2a 62 75 66 29 3b l_StatBuf *buf);
d3c0: 0a 74 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 .typedef int (Tc
d3d0: 6c 5f 46 53 43 72 65 61 74 65 44 69 72 65 63 74 l_FSCreateDirect
d3e0: 6f 72 79 50 72 6f 63 29 20 28 54 63 6c 5f 4f 62 oryProc) (Tcl_Ob
d3f0: 6a 20 2a 70 61 74 68 50 74 72 29 3b 0a 74 79 70 j *pathPtr);.typ
d400: 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 46 53 edef int (Tcl_FS
d410: 44 65 6c 65 74 65 46 69 6c 65 50 72 6f 63 29 20 DeleteFileProc)
d420: 28 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68 50 74 (Tcl_Obj *pathPt
d430: 72 29 3b 0a 74 79 70 65 64 65 66 20 69 6e 74 20 r);.typedef int
d440: 28 54 63 6c 5f 46 53 43 6f 70 79 44 69 72 65 63 (Tcl_FSCopyDirec
d450: 74 6f 72 79 50 72 6f 63 29 20 28 54 63 6c 5f 4f toryProc) (Tcl_O
d460: 62 6a 20 2a 73 72 63 50 61 74 68 50 74 72 2c 0a bj *srcPathPtr,.
d470: 09 54 63 6c 5f 4f 62 6a 20 2a 64 65 73 74 50 61 .Tcl_Obj *destPa
d480: 74 68 50 74 72 2c 20 54 63 6c 5f 4f 62 6a 20 2a thPtr, Tcl_Obj *
d490: 2a 65 72 72 6f 72 50 74 72 29 3b 0a 74 79 70 65 *errorPtr);.type
d4a0: 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 46 53 43 def int (Tcl_FSC
d4b0: 6f 70 79 46 69 6c 65 50 72 6f 63 29 20 28 54 63 opyFileProc) (Tc
d4c0: 6c 5f 4f 62 6a 20 2a 73 72 63 50 61 74 68 50 74 l_Obj *srcPathPt
d4d0: 72 2c 20 54 63 6c 5f 4f 62 6a 20 2a 64 65 73 74 r, Tcl_Obj *dest
d4e0: 50 61 74 68 50 74 72 29 3b 0a 74 79 70 65 64 65 PathPtr);.typede
d4f0: 66 20 69 6e 74 20 28 54 63 6c 5f 46 53 52 65 6d f int (Tcl_FSRem
d500: 6f 76 65 44 69 72 65 63 74 6f 72 79 50 72 6f 63 oveDirectoryProc
d510: 29 20 28 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68 ) (Tcl_Obj *path
d520: 50 74 72 2c 20 69 6e 74 20 72 65 63 75 72 73 69 Ptr, int recursi
d530: 76 65 2c 0a 09 54 63 6c 5f 4f 62 6a 20 2a 2a 65 ve,..Tcl_Obj **e
d540: 72 72 6f 72 50 74 72 29 3b 0a 74 79 70 65 64 65 rrorPtr);.typede
d550: 66 20 69 6e 74 20 28 54 63 6c 5f 46 53 52 65 6e f int (Tcl_FSRen
d560: 61 6d 65 46 69 6c 65 50 72 6f 63 29 20 28 54 63 ameFileProc) (Tc
d570: 6c 5f 4f 62 6a 20 2a 73 72 63 50 61 74 68 50 74 l_Obj *srcPathPt
d580: 72 2c 20 54 63 6c 5f 4f 62 6a 20 2a 64 65 73 74 r, Tcl_Obj *dest
d590: 50 61 74 68 50 74 72 29 3b 0a 74 79 70 65 64 65 PathPtr);.typede
d5a0: 66 20 76 6f 69 64 20 28 54 63 6c 5f 46 53 55 6e f void (Tcl_FSUn
d5b0: 6c 6f 61 64 46 69 6c 65 50 72 6f 63 29 20 28 54 loadFileProc) (T
d5c0: 63 6c 5f 4c 6f 61 64 48 61 6e 64 6c 65 20 6c 6f cl_LoadHandle lo
d5d0: 61 64 48 61 6e 64 6c 65 29 3b 0a 74 79 70 65 64 adHandle);.typed
d5e0: 65 66 20 54 63 6c 5f 4f 62 6a 20 2a 20 28 54 63 ef Tcl_Obj * (Tc
d5f0: 6c 5f 46 53 4c 69 73 74 56 6f 6c 75 6d 65 73 50 l_FSListVolumesP
d600: 72 6f 63 29 20 28 76 6f 69 64 29 3b 0a 2f 2a 20 roc) (void);./*
d610: 57 65 20 68 61 76 65 20 74 6f 20 64 65 63 6c 61 We have to decla
d620: 72 65 20 74 68 65 20 75 74 69 6d 65 20 73 74 72 re the utime str
d630: 75 63 74 75 72 65 20 68 65 72 65 2e 20 2a 2f 0a ucture here. */.
d640: 73 74 72 75 63 74 20 75 74 69 6d 62 75 66 3b 0a struct utimbuf;.
d650: 74 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c typedef int (Tcl
d660: 5f 46 53 55 74 69 6d 65 50 72 6f 63 29 20 28 54 _FSUtimeProc) (T
d670: 63 6c 5f 4f 62 6a 20 2a 70 61 74 68 50 74 72 2c cl_Obj *pathPtr,
d680: 20 73 74 72 75 63 74 20 75 74 69 6d 62 75 66 20 struct utimbuf
d690: 2a 74 76 61 6c 29 3b 0a 74 79 70 65 64 65 66 20 *tval);.typedef
d6a0: 69 6e 74 20 28 54 63 6c 5f 46 53 4e 6f 72 6d 61 int (Tcl_FSNorma
d6b0: 6c 69 7a 65 50 61 74 68 50 72 6f 63 29 20 28 54 lizePathProc) (T
d6c0: 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 cl_Interp *inter
d6d0: 70 2c 20 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68 p, Tcl_Obj *path
d6e0: 50 74 72 2c 0a 09 69 6e 74 20 6e 65 78 74 43 68 Ptr,..int nextCh
d6f0: 65 63 6b 70 6f 69 6e 74 29 3b 0a 74 79 70 65 64 eckpoint);.typed
d700: 65 66 20 69 6e 74 20 28 54 63 6c 5f 46 53 46 69 ef int (Tcl_FSFi
d710: 6c 65 41 74 74 72 73 47 65 74 50 72 6f 63 29 20 leAttrsGetProc)
d720: 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 (Tcl_Interp *int
d730: 65 72 70 2c 20 69 6e 74 20 69 6e 64 65 78 2c 0a erp, int index,.
d740: 09 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68 50 74 .Tcl_Obj *pathPt
d750: 72 2c 20 54 63 6c 5f 4f 62 6a 20 2a 2a 6f 62 6a r, Tcl_Obj **obj
d760: 50 74 72 52 65 66 29 3b 0a 74 79 70 65 64 65 66 PtrRef);.typedef
d770: 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 63 6f 6e const char *con
d780: 73 74 20 2a 20 28 54 63 6c 5f 46 53 46 69 6c 65 st * (Tcl_FSFile
d790: 41 74 74 72 53 74 72 69 6e 67 73 50 72 6f 63 29 AttrStringsProc)
d7a0: 20 28 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68 50 (Tcl_Obj *pathP
d7b0: 74 72 2c 0a 09 54 63 6c 5f 4f 62 6a 20 2a 2a 6f tr,..Tcl_Obj **o
d7c0: 62 6a 50 74 72 52 65 66 29 3b 0a 74 79 70 65 64 bjPtrRef);.typed
d7d0: 65 66 20 69 6e 74 20 28 54 63 6c 5f 46 53 46 69 ef int (Tcl_FSFi
d7e0: 6c 65 41 74 74 72 73 53 65 74 50 72 6f 63 29 20 leAttrsSetProc)
d7f0: 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 (Tcl_Interp *int
d800: 65 72 70 2c 20 69 6e 74 20 69 6e 64 65 78 2c 0a erp, int index,.
d810: 09 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68 50 74 .Tcl_Obj *pathPt
d820: 72 2c 20 54 63 6c 5f 4f 62 6a 20 2a 6f 62 6a 50 r, Tcl_Obj *objP
d830: 74 72 29 3b 0a 74 79 70 65 64 65 66 20 54 63 6c tr);.typedef Tcl
d840: 5f 4f 62 6a 20 2a 20 28 54 63 6c 5f 46 53 4c 69 _Obj * (Tcl_FSLi
d850: 6e 6b 50 72 6f 63 29 20 28 54 63 6c 5f 4f 62 6a nkProc) (Tcl_Obj
d860: 20 2a 70 61 74 68 50 74 72 2c 20 54 63 6c 5f 4f *pathPtr, Tcl_O
d870: 62 6a 20 2a 74 6f 50 74 72 2c 0a 09 69 6e 74 20 bj *toPtr,..int
d880: 6c 69 6e 6b 54 79 70 65 29 3b 0a 74 79 70 65 64 linkType);.typed
d890: 65 66 20 69 6e 74 20 28 54 63 6c 5f 46 53 4c 6f ef int (Tcl_FSLo
d8a0: 61 64 46 69 6c 65 50 72 6f 63 29 20 28 54 63 6c adFileProc) (Tcl
d8b0: 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c _Interp *interp,
d8c0: 20 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68 50 74 Tcl_Obj *pathPt
d8d0: 72 2c 0a 09 54 63 6c 5f 4c 6f 61 64 48 61 6e 64 r,..Tcl_LoadHand
d8e0: 6c 65 20 2a 68 61 6e 64 6c 65 50 74 72 2c 20 54 le *handlePtr, T
d8f0: 63 6c 5f 46 53 55 6e 6c 6f 61 64 46 69 6c 65 50 cl_FSUnloadFileP
d900: 72 6f 63 20 2a 2a 75 6e 6c 6f 61 64 50 72 6f 63 roc **unloadProc
d910: 50 74 72 29 3b 0a 74 79 70 65 64 65 66 20 69 6e Ptr);.typedef in
d920: 74 20 28 54 63 6c 5f 46 53 50 61 74 68 49 6e 46 t (Tcl_FSPathInF
d930: 69 6c 65 73 79 73 74 65 6d 50 72 6f 63 29 20 28 ilesystemProc) (
d940: 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68 50 74 72 Tcl_Obj *pathPtr
d950: 2c 0a 09 76 6f 69 64 20 2a 2a 63 6c 69 65 6e 74 ,..void **client
d960: 44 61 74 61 50 74 72 29 3b 0a 74 79 70 65 64 65 DataPtr);.typede
d970: 66 20 54 63 6c 5f 4f 62 6a 20 2a 20 28 54 63 6c f Tcl_Obj * (Tcl
d980: 5f 46 53 46 69 6c 65 73 79 73 74 65 6d 50 61 74 _FSFilesystemPat
d990: 68 54 79 70 65 50 72 6f 63 29 20 28 54 63 6c 5f hTypeProc) (Tcl_
d9a0: 4f 62 6a 20 2a 70 61 74 68 50 74 72 29 3b 0a 74 Obj *pathPtr);.t
d9b0: 79 70 65 64 65 66 20 54 63 6c 5f 4f 62 6a 20 2a ypedef Tcl_Obj *
d9c0: 20 28 54 63 6c 5f 46 53 46 69 6c 65 73 79 73 74 (Tcl_FSFilesyst
d9d0: 65 6d 53 65 70 61 72 61 74 6f 72 50 72 6f 63 29 emSeparatorProc)
d9e0: 20 28 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68 50 (Tcl_Obj *pathP
d9f0: 74 72 29 3b 0a 23 64 65 66 69 6e 65 20 54 63 6c tr);.#define Tcl
da00: 5f 46 53 46 72 65 65 49 6e 74 65 72 6e 61 6c 52 _FSFreeInternalR
da10: 65 70 50 72 6f 63 20 54 63 6c 5f 46 72 65 65 50 epProc Tcl_FreeP
da20: 72 6f 63 0a 74 79 70 65 64 65 66 20 76 6f 69 64 roc.typedef void
da30: 20 2a 28 54 63 6c 5f 46 53 44 75 70 49 6e 74 65 *(Tcl_FSDupInte
da40: 72 6e 61 6c 52 65 70 50 72 6f 63 29 20 28 76 6f rnalRepProc) (vo
da50: 69 64 20 2a 63 6c 69 65 6e 74 44 61 74 61 29 3b id *clientData);
da60: 0a 74 79 70 65 64 65 66 20 54 63 6c 5f 4f 62 6a .typedef Tcl_Obj
da70: 20 2a 20 28 54 63 6c 5f 46 53 49 6e 74 65 72 6e * (Tcl_FSIntern
da80: 61 6c 54 6f 4e 6f 72 6d 61 6c 69 7a 65 64 50 72 alToNormalizedPr
da90: 6f 63 29 20 28 76 6f 69 64 20 2a 63 6c 69 65 6e oc) (void *clien
daa0: 74 44 61 74 61 29 3b 0a 74 79 70 65 64 65 66 20 tData);.typedef
dab0: 76 6f 69 64 20 2a 28 54 63 6c 5f 46 53 43 72 65 void *(Tcl_FSCre
dac0: 61 74 65 49 6e 74 65 72 6e 61 6c 52 65 70 50 72 ateInternalRepPr
dad0: 6f 63 29 20 28 54 63 6c 5f 4f 62 6a 20 2a 70 61 oc) (Tcl_Obj *pa
dae0: 74 68 50 74 72 29 3b 0a 0a 74 79 70 65 64 65 66 thPtr);..typedef
daf0: 20 73 74 72 75 63 74 20 54 63 6c 5f 46 53 56 65 struct Tcl_FSVe
db00: 72 73 69 6f 6e 5f 20 2a 54 63 6c 5f 46 53 56 65 rsion_ *Tcl_FSVe
db10: 72 73 69 6f 6e 3b 0a 0a 2f 2a 0a 20 2a 2d 2d 2d rsion;../*. *---
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 2d 2d 2d ----------------
db50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
db60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 44 61 74 ---------. * Dat
db70: 61 20 73 74 72 75 63 74 75 72 65 73 20 72 65 6c a structures rel
db80: 61 74 65 64 20 74 6f 20 68 6f 6f 6b 69 6e 67 20 ated to hooking
db90: 69 6e 74 6f 20 74 68 65 20 66 69 6c 65 73 79 73 into the filesys
dba0: 74 65 6d 0a 20 2a 2f 0a 0a 2f 2a 0a 20 2a 20 46 tem. */../*. * F
dbb0: 69 6c 65 73 79 73 74 65 6d 20 76 65 72 73 69 6f ilesystem versio
dbc0: 6e 20 74 61 67 2e 20 20 54 68 69 73 20 77 61 73 n tag. This was
dbd0: 20 69 6e 74 72 6f 64 75 63 65 64 20 69 6e 20 38 introduced in 8
dbe0: 2e 34 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 .4.. */..#define
dbf0: 20 54 43 4c 5f 46 49 4c 45 53 59 53 54 45 4d 5f TCL_FILESYSTEM_
dc00: 56 45 52 53 49 4f 4e 5f 31 09 28 28 54 63 6c 5f VERSION_1.((Tcl_
dc10: 46 53 56 65 72 73 69 6f 6e 29 20 30 78 31 29 0a FSVersion) 0x1).
dc20: 0a 2f 2a 0a 20 2a 20 73 74 72 75 63 74 20 54 63 ./*. * struct Tc
dc30: 6c 5f 46 69 6c 65 73 79 73 74 65 6d 3a 0a 20 2a l_Filesystem:. *
dc40: 0a 20 2a 20 4f 6e 65 20 73 75 63 68 20 73 74 72 . * One such str
dc50: 75 63 74 75 72 65 20 65 78 69 73 74 73 20 66 6f ucture exists fo
dc60: 72 20 65 61 63 68 20 74 79 70 65 20 28 6b 69 6e r each type (kin
dc70: 64 29 20 6f 66 20 66 69 6c 65 73 79 73 74 65 6d d) of filesystem
dc80: 2e 20 49 74 20 63 6f 6c 6c 65 63 74 73 0a 20 2a . It collects. *
dc90: 20 74 6f 67 65 74 68 65 72 20 74 68 65 20 66 75 together the fu
dca0: 6e 63 74 69 6f 6e 73 20 74 68 61 74 20 66 6f 72 nctions that for
dcb0: 6d 20 74 68 65 20 69 6e 74 65 72 66 61 63 65 20 m the interface
dcc0: 66 6f 72 20 61 20 70 61 72 74 69 63 75 6c 72 20 for a particulr
dcd0: 74 68 65 0a 20 2a 20 66 69 6c 65 73 79 73 74 65 the. * filesyste
dce0: 6d 2e 20 54 63 6c 20 61 6c 77 61 79 73 20 61 63 m. Tcl always ac
dcf0: 63 65 73 73 65 73 20 74 68 65 20 66 69 6c 65 73 cesses the files
dd00: 79 73 74 65 6d 20 74 68 72 6f 75 67 68 20 6f 6e ystem through on
dd10: 65 20 6f 66 20 74 68 65 73 65 0a 20 2a 20 73 74 e of these. * st
dd20: 72 75 63 74 75 72 65 73 2e 0a 20 2a 0a 20 2a 20 ructures.. *. *
dd30: 4e 6f 74 20 61 6c 6c 20 65 6e 74 72 69 65 73 20 Not all entries
dd40: 6e 65 65 64 20 62 65 20 6e 6f 6e 2d 4e 55 4c 4c need be non-NULL
dd50: 3b 20 61 6e 79 20 77 68 69 63 68 20 61 72 65 20 ; any which are
dd60: 4e 55 4c 4c 20 61 72 65 20 73 69 6d 70 6c 79 20 NULL are simply
dd70: 69 67 6e 6f 72 65 64 2e 0a 20 2a 20 48 6f 77 65 ignored.. * Howe
dd80: 76 65 72 2c 20 61 20 63 6f 6d 70 6c 65 74 65 20 ver, a complete
dd90: 66 69 6c 65 73 79 73 74 65 6d 20 73 68 6f 75 6c filesystem shoul
dda0: 64 20 70 72 6f 76 69 64 65 20 61 6c 6c 20 6f 66 d provide all of
ddb0: 20 74 68 65 73 65 20 66 75 6e 63 74 69 6f 6e 73 these functions
ddc0: 2e 20 54 68 65 0a 20 2a 20 65 78 70 6c 61 6e 61 . The. * explana
ddd0: 74 69 6f 6e 73 20 69 6e 20 74 68 65 20 73 74 72 tions in the str
dde0: 75 63 74 75 72 65 20 73 68 6f 77 20 74 68 65 20 ucture show the
ddf0: 69 6d 70 6f 72 74 61 6e 63 65 20 6f 66 20 65 61 importance of ea
de00: 63 68 20 66 75 6e 63 74 69 6f 6e 2e 0a 20 2a 2f ch function.. */
de10: 0a 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 74 ..typedef struct
de20: 20 54 63 6c 5f 46 69 6c 65 73 79 73 74 65 6d 20 Tcl_Filesystem
de30: 7b 0a 20 20 20 20 63 6f 6e 73 74 20 63 68 61 72 {. const char
de40: 20 2a 74 79 70 65 4e 61 6d 65 3b 09 2f 2a 20 54 *typeName;./* T
de50: 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 66 he name of the f
de60: 69 6c 65 73 79 73 74 65 6d 2e 20 2a 2f 0a 20 20 ilesystem. */.
de70: 20 20 54 63 6c 5f 53 69 7a 65 20 73 74 72 75 63 Tcl_Size struc
de80: 74 75 72 65 4c 65 6e 67 74 68 3b 09 2f 2a 20 4c tureLength;./* L
de90: 65 6e 67 74 68 20 6f 66 20 74 68 69 73 20 73 74 ength of this st
dea0: 72 75 63 74 75 72 65 2c 20 73 6f 20 66 75 74 75 ructure, so futu
deb0: 72 65 20 62 69 6e 61 72 79 0a 09 09 09 09 20 2a re binary..... *
dec0: 20 63 6f 6d 70 61 74 69 62 69 6c 69 74 79 20 63 compatibility c
ded0: 61 6e 20 62 65 20 61 73 73 75 72 65 64 2e 20 2a an be assured. *
dee0: 2f 0a 20 20 20 20 54 63 6c 5f 46 53 56 65 72 73 /. Tcl_FSVers
def0: 69 6f 6e 20 76 65 72 73 69 6f 6e 3b 09 2f 2a 20 ion version;./*
df00: 56 65 72 73 69 6f 6e 20 6f 66 20 74 68 65 20 66 Version of the f
df10: 69 6c 65 73 79 73 74 65 6d 20 74 79 70 65 2e 20 ilesystem type.
df20: 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53 50 61 74 */. Tcl_FSPat
df30: 68 49 6e 46 69 6c 65 73 79 73 74 65 6d 50 72 6f hInFilesystemPro
df40: 63 20 2a 70 61 74 68 49 6e 46 69 6c 65 73 79 73 c *pathInFilesys
df50: 74 65 6d 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 temProc;...../*
df60: 44 65 74 65 72 6d 69 6e 65 73 20 77 68 65 74 68 Determines wheth
df70: 65 72 20 74 68 65 20 70 61 74 68 6e 61 6d 65 20 er the pathname
df80: 69 73 20 69 6e 20 74 68 69 73 0a 09 09 09 09 20 is in this.....
df90: 2a 20 66 69 6c 65 73 79 73 74 65 6d 2e 20 54 68 * filesystem. Th
dfa0: 69 73 20 69 73 20 74 68 65 20 6d 6f 73 74 20 69 is is the most i
dfb0: 6d 70 6f 72 74 61 6e 74 0a 09 09 09 09 20 2a 20 mportant..... *
dfc0: 66 69 6c 65 73 79 73 74 65 6d 20 66 75 6e 63 74 filesystem funct
dfd0: 69 6f 6e 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f ion. */. Tcl_
dfe0: 46 53 44 75 70 49 6e 74 65 72 6e 61 6c 52 65 70 FSDupInternalRep
dff0: 50 72 6f 63 20 2a 64 75 70 49 6e 74 65 72 6e 61 Proc *dupInterna
e000: 6c 52 65 70 50 72 6f 63 3b 0a 09 09 09 09 2f 2a lRepProc;...../*
e010: 20 44 75 70 6c 69 63 61 74 65 73 20 74 68 65 20 Duplicates the
e020: 69 6e 74 65 72 6e 61 6c 20 68 61 6e 64 6c 65 20 internal handle
e030: 6f 66 20 74 68 65 20 6e 6f 64 65 2e 0a 09 09 09 of the node.....
e040: 09 20 2a 20 49 66 20 69 74 20 69 73 20 4e 55 4c . * If it is NUL
e050: 4c 2c 20 74 68 65 20 66 69 6c 65 73 79 73 74 65 L, the filesyste
e060: 6d 20 69 73 20 6c 65 73 73 0a 09 09 09 09 20 2a m is less..... *
e070: 20 70 65 72 66 6f 72 6d 61 6e 74 2e 20 2a 2f 0a performant. */.
e080: 20 20 20 20 54 63 6c 5f 46 53 46 72 65 65 49 6e Tcl_FSFreeIn
e090: 74 65 72 6e 61 6c 52 65 70 50 72 6f 63 20 2a 66 ternalRepProc *f
e0a0: 72 65 65 49 6e 74 65 72 6e 61 6c 52 65 70 50 72 reeInternalRepPr
e0b0: 6f 63 3b 0a 09 09 09 09 2f 2a 20 46 72 65 65 73 oc;...../* Frees
e0c0: 20 74 68 65 20 69 6e 74 65 72 6e 61 6c 20 68 61 the internal ha
e0d0: 6e 64 6c 65 20 6f 66 20 74 68 65 20 6e 6f 64 65 ndle of the node
e0e0: 2e 20 20 4e 55 4c 4c 0a 09 09 09 09 20 2a 20 6f . NULL..... * o
e0f0: 6e 6c 79 20 69 66 20 74 68 65 72 65 20 69 73 20 nly if there is
e100: 6e 6f 20 6e 65 65 64 20 74 6f 20 66 72 65 65 20 no need to free
e110: 72 65 73 6f 75 72 63 65 73 0a 09 09 09 09 20 2a resources..... *
e120: 20 75 73 65 64 20 66 6f 72 20 74 68 65 20 69 6e used for the in
e130: 74 65 72 6e 61 6c 20 68 61 6e 64 6c 65 2e 20 2a ternal handle. *
e140: 2f 0a 20 20 20 20 54 63 6c 5f 46 53 49 6e 74 65 /. Tcl_FSInte
e150: 72 6e 61 6c 54 6f 4e 6f 72 6d 61 6c 69 7a 65 64 rnalToNormalized
e160: 50 72 6f 63 20 2a 69 6e 74 65 72 6e 61 6c 54 6f Proc *internalTo
e170: 4e 6f 72 6d 61 6c 69 7a 65 64 50 72 6f 63 3b 0a NormalizedProc;.
e180: 09 09 09 09 2f 2a 20 43 6f 6e 76 65 72 74 73 20 ..../* Converts
e190: 74 68 65 20 69 6e 74 65 72 6e 61 6c 20 68 61 6e the internal han
e1a0: 64 6c 65 20 74 6f 20 61 20 6e 6f 72 6d 61 6c 69 dle to a normali
e1b0: 7a 65 64 0a 09 09 09 09 20 2a 20 70 61 74 68 2e zed..... * path.
e1c0: 20 20 4e 55 4c 4c 20 69 66 20 74 68 65 20 66 69 NULL if the fi
e1d0: 6c 65 73 79 73 74 65 6d 20 63 72 65 61 74 65 73 lesystem creates
e1e0: 20 6e 6f 64 65 73 0a 09 09 09 09 20 2a 20 68 61 nodes..... * ha
e1f0: 76 69 6e 67 20 6e 6f 20 70 61 74 68 6e 61 6d 65 ving no pathname
e200: 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53 43 . */. Tcl_FSC
e210: 72 65 61 74 65 49 6e 74 65 72 6e 61 6c 52 65 70 reateInternalRep
e220: 50 72 6f 63 20 2a 63 72 65 61 74 65 49 6e 74 65 Proc *createInte
e230: 72 6e 61 6c 52 65 70 50 72 6f 63 3b 0a 09 09 09 rnalRepProc;....
e240: 09 2f 2a 20 43 72 65 61 74 65 73 20 61 6e 20 69 ./* Creates an i
e250: 6e 74 65 72 6e 61 6c 20 68 61 6e 64 6c 65 20 66 nternal handle f
e260: 6f 72 20 61 20 70 61 74 68 6e 61 6d 65 2e 0a 09 or a pathname...
e270: 09 09 09 20 2a 20 4d 61 79 20 62 65 20 4e 55 4c ... * May be NUL
e280: 4c 20 69 66 20 70 61 74 68 6e 61 6d 65 73 20 68 L if pathnames h
e290: 61 76 65 20 6e 6f 20 69 6e 74 65 72 6e 61 6c 0a ave no internal.
e2a0: 09 09 09 09 20 2a 20 68 61 6e 64 6c 65 20 6f 72 .... * handle or
e2b0: 20 69 66 20 70 61 74 68 49 6e 46 69 6c 65 73 79 if pathInFilesy
e2c0: 73 74 65 6d 50 72 6f 63 20 61 6c 77 61 79 73 0a stemProc always.
e2d0: 09 09 09 09 20 2a 20 69 6d 6d 65 64 69 61 74 65 .... * immediate
e2e0: 6c 79 20 63 72 65 61 74 65 73 20 61 6e 20 69 6e ly creates an in
e2f0: 74 65 72 6e 61 6c 0a 09 09 09 09 20 2a 20 72 65 ternal..... * re
e300: 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 66 6f 72 presentation for
e310: 20 70 61 74 68 6e 61 6d 65 73 20 69 6e 20 74 68 pathnames in th
e320: 65 0a 09 09 09 09 20 2a 20 66 69 6c 65 73 79 73 e..... * filesys
e330: 74 65 6d 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f tem. */. Tcl_
e340: 46 53 4e 6f 72 6d 61 6c 69 7a 65 50 61 74 68 50 FSNormalizePathP
e350: 72 6f 63 20 2a 6e 6f 72 6d 61 6c 69 7a 65 50 61 roc *normalizePa
e360: 74 68 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 4e thProc;...../* N
e370: 6f 72 6d 61 6c 69 7a 65 73 20 61 20 70 61 74 68 ormalizes a path
e380: 2e 20 20 53 68 6f 75 6c 64 20 62 65 20 69 6d 70 . Should be imp
e390: 6c 65 6d 65 6e 74 65 64 20 69 66 0a 09 09 09 09 lemented if.....
e3a0: 20 2a 20 74 68 65 20 66 69 6c 65 73 79 73 74 65 * the filesyste
e3b0: 6d 73 20 73 75 70 70 6f 72 74 73 20 6d 75 6c 74 ms supports mult
e3c0: 69 70 6c 65 20 70 61 74 68 73 20 74 6f 0a 09 09 iple paths to...
e3d0: 09 09 20 2a 20 74 68 65 20 73 61 6d 65 20 6e 6f .. * the same no
e3e0: 64 65 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 de. */. Tcl_F
e3f0: 53 46 69 6c 65 73 79 73 74 65 6d 50 61 74 68 54 SFilesystemPathT
e400: 79 70 65 50 72 6f 63 20 2a 66 69 6c 65 73 79 73 ypeProc *filesys
e410: 74 65 6d 50 61 74 68 54 79 70 65 50 72 6f 63 3b temPathTypeProc;
e420: 0a 09 09 09 09 2f 2a 20 44 65 74 65 72 6d 69 6e ...../* Determin
e430: 65 73 20 74 68 65 20 74 79 70 65 20 6f 66 20 61 es the type of a
e440: 20 70 61 74 68 20 69 6e 20 74 68 69 73 0a 09 09 path in this...
e450: 09 09 20 2a 20 66 69 6c 65 73 79 73 74 65 6d 2e .. * filesystem.
e460: 20 4d 61 79 20 62 65 20 4e 55 4c 4c 2e 20 2a 2f May be NULL. */
e470: 0a 20 20 20 20 54 63 6c 5f 46 53 46 69 6c 65 73 . Tcl_FSFiles
e480: 79 73 74 65 6d 53 65 70 61 72 61 74 6f 72 50 72 ystemSeparatorPr
e490: 6f 63 20 2a 66 69 6c 65 73 79 73 74 65 6d 53 65 oc *filesystemSe
e4a0: 70 61 72 61 74 6f 72 50 72 6f 63 3b 0a 09 09 09 paratorProc;....
e4b0: 09 2f 2a 20 50 72 6f 64 75 63 65 73 20 74 68 65 ./* Produces the
e4c0: 20 73 65 70 61 72 61 74 6f 72 20 63 68 61 72 61 separator chara
e4d0: 63 74 65 72 28 73 29 20 66 6f 72 20 74 68 69 73 cter(s) for this
e4e0: 0a 09 09 09 09 20 2a 20 66 69 6c 65 73 79 73 74 ..... * filesyst
e4f0: 65 6d 2e 20 4d 75 73 74 20 6e 6f 74 20 62 65 20 em. Must not be
e500: 4e 55 4c 4c 2e 20 2a 2f 0a 20 20 20 20 54 63 6c NULL. */. Tcl
e510: 5f 46 53 53 74 61 74 50 72 6f 63 20 2a 73 74 61 _FSStatProc *sta
e520: 74 50 72 6f 63 3b 09 2f 2a 20 43 61 6c 6c 65 64 tProc;./* Called
e530: 20 62 79 20 27 54 63 6c 5f 46 53 53 74 61 74 28 by 'Tcl_FSStat(
e540: 29 27 2e 20 20 50 72 6f 76 69 64 65 64 20 62 79 )'. Provided by
e550: 20 61 6e 79 0a 09 09 09 09 20 2a 20 72 65 61 73 any..... * reas
e560: 6f 6e 61 62 6c 65 20 66 69 6c 65 73 79 73 74 65 onable filesyste
e570: 6d 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53 m. */. Tcl_FS
e580: 41 63 63 65 73 73 50 72 6f 63 20 2a 61 63 63 65 AccessProc *acce
e590: 73 73 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 43 ssProc;...../* C
e5a0: 61 6c 6c 65 64 20 62 79 20 27 54 63 6c 5f 46 53 alled by 'Tcl_FS
e5b0: 41 63 63 65 73 73 28 29 27 2e 20 20 49 6d 70 6c Access()'. Impl
e5c0: 65 6d 65 6e 74 65 64 20 62 79 0a 09 09 09 09 20 emented by.....
e5d0: 2a 20 61 6e 79 20 72 65 61 73 6f 6e 61 62 6c 65 * any reasonable
e5e0: 20 66 69 6c 65 73 79 73 74 65 6d 2e 20 2a 2f 0a filesystem. */.
e5f0: 20 20 20 20 54 63 6c 5f 46 53 4f 70 65 6e 46 69 Tcl_FSOpenFi
e600: 6c 65 43 68 61 6e 6e 65 6c 50 72 6f 63 20 2a 6f leChannelProc *o
e610: 70 65 6e 46 69 6c 65 43 68 61 6e 6e 65 6c 50 72 penFileChannelPr
e620: 6f 63 3b 0a 09 09 09 09 2f 2a 20 43 61 6c 6c 65 oc;...../* Calle
e630: 64 20 62 79 20 27 54 63 6c 5f 46 53 4f 70 65 6e d by 'Tcl_FSOpen
e640: 46 69 6c 65 43 68 61 6e 6e 65 6c 28 29 27 2e 0a FileChannel()'..
e650: 09 09 09 09 20 2a 20 50 72 6f 76 69 64 65 64 20 .... * Provided
e660: 62 79 20 61 6e 79 20 72 65 61 73 6f 6e 61 62 6c by any reasonabl
e670: 65 20 66 69 6c 65 73 79 73 74 65 6d 2e 20 2a 2f e filesystem. */
e680: 0a 20 20 20 20 54 63 6c 5f 46 53 4d 61 74 63 68 . Tcl_FSMatch
e690: 49 6e 44 69 72 65 63 74 6f 72 79 50 72 6f 63 20 InDirectoryProc
e6a0: 2a 6d 61 74 63 68 49 6e 44 69 72 65 63 74 6f 72 *matchInDirector
e6b0: 79 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 43 61 yProc;...../* Ca
e6c0: 6c 6c 65 64 20 62 79 20 27 54 63 6c 5f 46 53 4d lled by 'Tcl_FSM
e6d0: 61 74 63 68 49 6e 44 69 72 65 63 74 6f 72 79 28 atchInDirectory(
e6e0: 29 27 2e 20 20 4e 55 4c 4c 0a 09 09 09 09 20 2a )'. NULL..... *
e6f0: 20 69 66 20 74 68 65 20 66 69 6c 65 73 79 73 74 if the filesyst
e700: 65 6d 20 64 6f 65 73 20 6e 6f 74 20 73 75 70 70 em does not supp
e710: 6f 72 74 20 67 6c 6f 62 20 6f 72 0a 09 09 09 09 ort glob or.....
e720: 20 2a 20 72 65 63 75 72 73 69 76 65 20 63 6f 70 * recursive cop
e730: 79 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53 y. */. Tcl_FS
e740: 55 74 69 6d 65 50 72 6f 63 20 2a 75 74 69 6d 65 UtimeProc *utime
e750: 50 72 6f 63 3b 09 2f 2a 20 43 61 6c 6c 65 64 20 Proc;./* Called
e760: 62 79 20 27 54 63 6c 5f 46 53 55 74 69 6d 65 28 by 'Tcl_FSUtime(
e770: 29 27 2c 20 62 79 20 27 66 69 6c 65 0a 09 09 09 )', by 'file....
e780: 09 20 2a 20 6d 74 69 6d 65 27 20 74 6f 20 73 65 . * mtime' to se
e790: 74 20 28 6e 6f 74 20 72 65 61 64 29 20 74 69 6d t (not read) tim
e7a0: 65 73 2c 20 27 66 69 6c 65 0a 09 09 09 09 20 2a es, 'file..... *
e7b0: 20 61 74 69 6d 65 27 2c 20 61 6e 64 20 74 68 65 atime', and the
e7c0: 20 6f 70 65 6e 2d 72 2f 6f 70 65 6e 2d 77 2f 66 open-r/open-w/f
e7d0: 63 6f 70 79 20 76 61 72 69 61 6e 74 0a 09 09 09 copy variant....
e7e0: 09 20 2a 20 6f 66 20 27 66 69 6c 65 20 63 6f 70 . * of 'file cop
e7f0: 79 27 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 y'. */. Tcl_F
e800: 53 4c 69 6e 6b 50 72 6f 63 20 2a 6c 69 6e 6b 50 SLinkProc *linkP
e810: 72 6f 63 3b 09 2f 2a 20 43 61 6c 6c 65 64 20 62 roc;./* Called b
e820: 79 20 27 54 63 6c 5f 46 53 4c 69 6e 6b 28 29 27 y 'Tcl_FSLink()'
e830: 2e 20 4e 55 4c 4c 20 69 66 20 72 65 61 64 69 6e . NULL if readin
e840: 67 20 6f 72 0a 09 09 09 09 20 2a 20 63 72 65 61 g or..... * crea
e850: 74 69 6e 67 20 6c 69 6e 6b 73 20 69 73 20 6e 6f ting links is no
e860: 74 20 73 75 70 70 6f 72 74 65 64 2e 20 2a 2f 0a t supported. */.
e870: 20 20 20 20 54 63 6c 5f 46 53 4c 69 73 74 56 6f Tcl_FSListVo
e880: 6c 75 6d 65 73 50 72 6f 63 20 2a 6c 69 73 74 56 lumesProc *listV
e890: 6f 6c 75 6d 65 73 50 72 6f 63 3b 0a 09 09 09 09 olumesProc;.....
e8a0: 2f 2a 20 4c 69 73 74 73 20 66 69 6c 65 73 79 73 /* Lists filesys
e8b0: 74 65 6d 20 76 6f 6c 75 6d 65 73 20 61 64 64 65 tem volumes adde
e8c0: 64 20 62 79 20 74 68 69 73 0a 09 09 09 09 20 2a d by this..... *
e8d0: 20 66 69 6c 65 73 79 73 74 65 6d 2e 20 4e 55 4c filesystem. NUL
e8e0: 4c 20 69 66 20 74 68 65 20 66 69 6c 65 73 79 73 L if the filesys
e8f0: 74 65 6d 20 64 6f 65 73 20 6e 6f 74 0a 09 09 09 tem does not....
e900: 09 20 2a 20 75 73 65 20 76 6f 6c 75 6d 65 73 2e . * use volumes.
e910: 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53 46 69 */. Tcl_FSFi
e920: 6c 65 41 74 74 72 53 74 72 69 6e 67 73 50 72 6f leAttrStringsPro
e930: 63 20 2a 66 69 6c 65 41 74 74 72 53 74 72 69 6e c *fileAttrStrin
e940: 67 73 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 4c gsProc;...../* L
e950: 69 73 74 20 61 6c 6c 20 76 61 6c 69 64 20 61 74 ist all valid at
e960: 74 72 69 62 75 74 65 73 20 73 74 72 69 6e 67 73 tributes strings
e970: 2e 20 20 4e 55 4c 4c 20 69 66 0a 09 09 09 09 20 . NULL if.....
e980: 2a 20 74 68 65 20 66 69 6c 65 73 79 73 74 65 6d * the filesystem
e990: 20 64 6f 65 73 20 6e 6f 74 20 73 75 70 70 6f 72 does not suppor
e9a0: 74 20 74 68 65 20 27 66 69 6c 65 0a 09 09 09 09 t the 'file.....
e9b0: 20 2a 20 61 74 74 72 69 62 75 74 65 73 27 20 63 * attributes' c
e9c0: 6f 6d 6d 61 6e 64 2e 20 20 43 61 6e 20 62 65 20 ommand. Can be
e9d0: 75 73 65 64 20 74 6f 20 61 74 74 61 63 68 0a 09 used to attach..
e9e0: 09 09 09 20 2a 20 61 72 62 69 74 72 61 72 79 20 ... * arbitrary
e9f0: 61 64 64 69 74 69 6f 6e 61 6c 20 64 61 74 61 20 additional data
ea00: 74 6f 20 66 69 6c 65 73 20 69 6e 20 61 0a 09 09 to files in a...
ea10: 09 09 20 2a 20 66 69 6c 65 73 79 73 74 65 6d 2e .. * filesystem.
ea20: 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53 46 69 */. Tcl_FSFi
ea30: 6c 65 41 74 74 72 73 47 65 74 50 72 6f 63 20 2a leAttrsGetProc *
ea40: 66 69 6c 65 41 74 74 72 73 47 65 74 50 72 6f 63 fileAttrsGetProc
ea50: 3b 0a 09 09 09 09 2f 2a 20 43 61 6c 6c 65 64 20 ;...../* Called
ea60: 62 79 20 27 54 63 6c 5f 46 53 46 69 6c 65 41 74 by 'Tcl_FSFileAt
ea70: 74 72 73 47 65 74 28 29 27 20 61 6e 64 20 62 79 trsGet()' and by
ea80: 0a 09 09 09 09 20 2a 20 27 66 69 6c 65 20 61 74 ..... * 'file at
ea90: 74 72 69 62 75 74 65 73 27 2e 20 2a 2f 0a 20 20 tributes'. */.
eaa0: 20 20 54 63 6c 5f 46 53 46 69 6c 65 41 74 74 72 Tcl_FSFileAttr
eab0: 73 53 65 74 50 72 6f 63 20 2a 66 69 6c 65 41 74 sSetProc *fileAt
eac0: 74 72 73 53 65 74 50 72 6f 63 3b 0a 09 09 09 09 trsSetProc;.....
ead0: 2f 2a 20 43 61 6c 6c 65 64 20 62 79 20 27 54 63 /* Called by 'Tc
eae0: 6c 5f 46 53 46 69 6c 65 41 74 74 72 73 53 65 74 l_FSFileAttrsSet
eaf0: 28 29 27 20 61 6e 64 20 62 79 0a 09 09 09 09 20 ()' and by.....
eb00: 2a 20 27 66 69 6c 65 20 61 74 74 72 69 62 75 74 * 'file attribut
eb10: 65 73 27 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f es'. */. Tcl_
eb20: 46 53 43 72 65 61 74 65 44 69 72 65 63 74 6f 72 FSCreateDirector
eb30: 79 50 72 6f 63 20 2a 63 72 65 61 74 65 44 69 72 yProc *createDir
eb40: 65 63 74 6f 72 79 50 72 6f 63 3b 0a 09 09 09 09 ectoryProc;.....
eb50: 2f 2a 20 43 61 6c 6c 65 64 20 62 79 20 27 54 63 /* Called by 'Tc
eb60: 6c 5f 46 53 43 72 65 61 74 65 44 69 72 65 63 74 l_FSCreateDirect
eb70: 6f 72 79 28 29 27 2e 20 20 4d 61 79 20 62 65 0a ory()'. May be.
eb80: 09 09 09 09 20 2a 20 4e 55 4c 4c 20 69 66 20 74 .... * NULL if t
eb90: 68 65 20 66 69 6c 65 73 79 73 74 65 6d 20 69 73 he filesystem is
eba0: 20 72 65 61 64 2d 6f 6e 6c 79 2e 20 2a 2f 0a 20 read-only. */.
ebb0: 20 20 20 54 63 6c 5f 46 53 52 65 6d 6f 76 65 44 Tcl_FSRemoveD
ebc0: 69 72 65 63 74 6f 72 79 50 72 6f 63 20 2a 72 65 irectoryProc *re
ebd0: 6d 6f 76 65 44 69 72 65 63 74 6f 72 79 50 72 6f moveDirectoryPro
ebe0: 63 3b 0a 09 09 09 09 2f 2a 20 43 61 6c 6c 65 64 c;...../* Called
ebf0: 20 62 79 20 27 54 63 6c 5f 46 53 52 65 6d 6f 76 by 'Tcl_FSRemov
ec00: 65 44 69 72 65 63 74 6f 72 79 28 29 27 2e 20 20 eDirectory()'.
ec10: 4d 61 79 20 62 65 0a 09 09 09 09 20 2a 20 4e 55 May be..... * NU
ec20: 4c 4c 20 69 66 20 74 68 65 20 66 69 6c 65 73 79 LL if the filesy
ec30: 73 74 65 6d 20 69 73 20 72 65 61 64 2d 6f 6e 6c stem is read-onl
ec40: 79 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53 y. */. Tcl_FS
ec50: 44 65 6c 65 74 65 46 69 6c 65 50 72 6f 63 20 2a DeleteFileProc *
ec60: 64 65 6c 65 74 65 46 69 6c 65 50 72 6f 63 3b 0a deleteFileProc;.
ec70: 09 09 09 09 2f 2a 20 43 61 6c 6c 65 64 20 62 79 ..../* Called by
ec80: 20 27 54 63 6c 5f 46 53 44 65 6c 65 74 65 46 69 'Tcl_FSDeleteFi
ec90: 6c 65 28 29 27 20 4d 61 79 20 62 65 20 4e 55 4c le()' May be NUL
eca0: 4c 0a 09 09 09 09 20 2a 20 69 66 20 74 68 65 20 L..... * if the
ecb0: 66 69 6c 65 73 79 73 74 65 6d 20 69 73 20 69 73 filesystem is is
ecc0: 20 72 65 61 64 2d 6f 6e 6c 79 2e 20 2a 2f 0a 20 read-only. */.
ecd0: 20 20 20 54 63 6c 5f 46 53 43 6f 70 79 46 69 6c Tcl_FSCopyFil
ece0: 65 50 72 6f 63 20 2a 63 6f 70 79 46 69 6c 65 50 eProc *copyFileP
ecf0: 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 43 61 6c 6c roc;...../* Call
ed00: 65 64 20 62 79 20 27 54 63 6c 5f 46 53 43 6f 70 ed by 'Tcl_FSCop
ed10: 79 46 69 6c 65 28 29 27 2e 20 20 49 66 20 4e 55 yFile()'. If NU
ed20: 4c 4c 2c 20 66 6f 72 0a 09 09 09 09 20 2a 20 61 LL, for..... * a
ed30: 20 63 6f 70 79 20 6f 70 65 72 61 74 69 6f 6e 20 copy operation
ed40: 61 74 20 74 68 65 20 73 63 72 69 70 74 20 6c 65 at the script le
ed50: 76 65 6c 20 28 6e 6f 74 0a 09 09 09 09 20 2a 20 vel (not..... *
ed60: 43 29 20 54 63 6c 20 75 73 65 73 20 6f 70 65 6e C) Tcl uses open
ed70: 2d 72 2c 20 6f 70 65 6e 2d 77 20 61 6e 64 20 66 -r, open-w and f
ed80: 63 6f 70 79 2e 20 2a 2f 0a 20 20 20 20 54 63 6c copy. */. Tcl
ed90: 5f 46 53 52 65 6e 61 6d 65 46 69 6c 65 50 72 6f _FSRenameFilePro
eda0: 63 20 2a 72 65 6e 61 6d 65 46 69 6c 65 50 72 6f c *renameFilePro
edb0: 63 3b 0a 09 09 09 09 2f 2a 20 43 61 6c 6c 65 64 c;...../* Called
edc0: 20 62 79 20 27 54 63 6c 5f 46 53 52 65 6e 61 6d by 'Tcl_FSRenam
edd0: 65 46 69 6c 65 28 29 27 2e 20 49 66 20 4e 55 4c eFile()'. If NUL
ede0: 4c 2c 20 66 6f 72 0a 09 09 09 09 20 2a 20 61 20 L, for..... * a
edf0: 72 65 6e 61 6d 65 20 6f 70 65 72 61 74 69 6f 6e rename operation
ee00: 20 61 74 20 74 68 65 20 73 63 72 69 70 74 20 6c at the script l
ee10: 65 76 65 6c 20 28 6e 6f 74 0a 09 09 09 09 20 2a evel (not..... *
ee20: 20 43 29 20 54 63 6c 20 70 65 72 66 6f 72 6d 73 C) Tcl performs
ee30: 20 61 20 63 6f 70 79 20 6f 70 65 72 61 74 69 6f a copy operatio
ee40: 6e 20 66 6f 6c 6c 6f 77 65 64 0a 09 09 09 09 20 n followed.....
ee50: 2a 20 62 79 20 61 20 64 65 6c 65 74 65 20 6f 70 * by a delete op
ee60: 65 72 61 74 69 6f 6e 2e 20 2a 2f 0a 20 20 20 20 eration. */.
ee70: 54 63 6c 5f 46 53 43 6f 70 79 44 69 72 65 63 74 Tcl_FSCopyDirect
ee80: 6f 72 79 50 72 6f 63 20 2a 63 6f 70 79 44 69 72 oryProc *copyDir
ee90: 65 63 74 6f 72 79 50 72 6f 63 3b 0a 09 09 09 09 ectoryProc;.....
eea0: 2f 2a 20 43 61 6c 6c 65 64 20 62 79 20 27 54 63 /* Called by 'Tc
eeb0: 6c 5f 46 53 43 6f 70 79 44 69 72 65 63 74 6f 72 l_FSCopyDirector
eec0: 79 28 29 27 2e 20 49 66 20 4e 55 4c 4c 2c 0a 09 y()'. If NULL,..
eed0: 09 09 09 20 2a 20 66 6f 72 20 61 20 63 6f 70 79 ... * for a copy
eee0: 20 6f 70 65 72 61 74 69 6f 6e 20 61 74 20 74 68 operation at th
eef0: 65 20 73 63 72 69 70 74 20 6c 65 76 65 6c 0a 09 e script level..
ef00: 09 09 09 20 2a 20 28 6e 6f 74 20 43 29 20 54 63 ... * (not C) Tc
ef10: 6c 20 72 65 63 75 72 73 69 76 65 6c 79 20 63 72 l recursively cr
ef20: 65 61 74 65 73 20 64 69 72 65 63 74 6f 72 69 65 eates directorie
ef30: 73 0a 09 09 09 09 20 2a 20 61 6e 64 20 63 6f 70 s..... * and cop
ef40: 69 65 73 20 66 69 6c 65 73 2e 20 2a 2f 0a 20 20 ies files. */.
ef50: 20 20 54 63 6c 5f 46 53 4c 73 74 61 74 50 72 6f Tcl_FSLstatPro
ef60: 63 20 2a 6c 73 74 61 74 50 72 6f 63 3b 09 2f 2a c *lstatProc;./*
ef70: 20 43 61 6c 6c 65 64 20 62 79 20 27 54 63 6c 5f Called by 'Tcl_
ef80: 46 53 4c 73 74 61 74 28 29 27 2e 20 49 66 20 4e FSLstat()'. If N
ef90: 55 4c 4c 2c 20 54 63 6c 0a 09 09 09 09 20 2a 20 ULL, Tcl..... *
efa0: 61 74 74 65 6d 70 74 73 20 74 6f 20 75 73 65 20 attempts to use
efb0: 27 73 74 61 74 50 72 6f 63 27 20 69 6e 73 74 65 'statProc' inste
efc0: 61 64 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 ad. */. Tcl_F
efd0: 53 4c 6f 61 64 46 69 6c 65 50 72 6f 63 20 2a 6c SLoadFileProc *l
efe0: 6f 61 64 46 69 6c 65 50 72 6f 63 3b 0a 09 09 09 oadFileProc;....
eff0: 09 2f 2a 20 43 61 6c 6c 65 64 20 62 79 20 27 54 ./* Called by 'T
f000: 63 6c 5f 46 53 4c 6f 61 64 46 69 6c 65 28 29 27 cl_FSLoadFile()'
f010: 2e 20 49 66 20 4e 55 4c 4c 2c 20 54 63 6c 0a 09 . If NULL, Tcl..
f020: 09 09 09 20 2a 20 70 65 72 66 6f 72 6d 73 20 61 ... * performs a
f030: 20 63 6f 70 79 20 74 6f 20 61 20 74 65 6d 70 6f copy to a tempo
f040: 72 61 72 79 20 66 69 6c 65 20 69 6e 20 74 68 65 rary file in the
f050: 0a 09 09 09 09 20 2a 20 6e 61 74 69 76 65 20 66 ..... * native f
f060: 69 6c 65 73 79 73 74 65 6d 20 61 6e 64 20 74 68 ilesystem and th
f070: 65 6e 20 63 61 6c 6c 73 0a 09 09 09 09 20 2a 20 en calls..... *
f080: 54 63 6c 5f 46 53 4c 6f 61 64 46 69 6c 65 28 29 Tcl_FSLoadFile()
f090: 20 6f 6e 20 74 68 61 74 20 74 65 6d 70 6f 72 61 on that tempora
f0a0: 72 79 20 63 6f 70 79 2e 20 2a 2f 0a 20 20 20 20 ry copy. */.
f0b0: 54 63 6c 5f 46 53 47 65 74 43 77 64 50 72 6f 63 Tcl_FSGetCwdProc
f0c0: 20 2a 67 65 74 43 77 64 50 72 6f 63 3b 0a 09 09 *getCwdProc;...
f0d0: 09 09 2f 2a 20 43 61 6c 6c 65 64 20 62 79 20 27 ../* Called by '
f0e0: 54 63 6c 5f 46 53 47 65 74 43 77 64 28 29 27 2e Tcl_FSGetCwd()'.
f0f0: 20 20 4e 6f 72 6d 61 6c 6c 79 20 4e 55 4c 4c 2e Normally NULL.
f100: 0a 09 09 09 09 20 2a 20 55 73 75 61 6c 6c 79 20 ..... * Usually
f110: 6f 6e 6c 79 20 63 61 6c 6c 65 64 20 6f 6e 63 65 only called once
f120: 3a 20 20 49 66 20 27 67 65 74 63 77 64 27 20 69 : If 'getcwd' i
f130: 73 0a 09 09 09 09 20 2a 20 63 61 6c 6c 65 64 20 s..... * called
f140: 62 65 66 6f 72 65 20 27 63 68 64 69 72 27 20 69 before 'chdir' i
f150: 73 20 65 76 65 72 20 63 61 6c 6c 65 64 2e 20 2a s ever called. *
f160: 2f 0a 20 20 20 20 54 63 6c 5f 46 53 43 68 64 69 /. Tcl_FSChdi
f170: 72 50 72 6f 63 20 2a 63 68 64 69 72 50 72 6f 63 rProc *chdirProc
f180: 3b 09 2f 2a 20 43 61 6c 6c 65 64 20 62 79 20 27 ;./* Called by '
f190: 54 63 6c 5f 46 53 43 68 64 69 72 28 29 27 2e 20 Tcl_FSChdir()'.
f1a0: 20 46 6f 72 20 61 20 76 69 72 74 75 61 6c 0a 09 For a virtual..
f1b0: 09 09 09 20 2a 20 66 69 6c 65 73 79 73 74 65 6d ... * filesystem
f1c0: 2c 20 63 68 64 69 72 50 72 6f 63 20 6a 75 73 74 , chdirProc just
f1d0: 20 72 65 74 75 72 6e 73 20 7a 65 72 6f 0a 09 09 returns zero...
f1e0: 09 09 20 2a 20 28 73 75 63 63 65 73 73 29 20 69 .. * (success) i
f1f0: 66 20 74 68 65 20 70 61 74 68 6e 61 6d 65 20 69 f the pathname i
f200: 73 20 61 20 76 61 6c 69 64 0a 09 09 09 09 20 2a s a valid..... *
f210: 20 64 69 72 65 63 74 6f 72 79 2c 20 61 6e 64 20 directory, and
f220: 73 6f 6d 65 20 6f 74 68 65 72 20 76 61 6c 75 65 some other value
f230: 20 6f 74 68 65 72 77 69 73 65 2e 0a 09 09 09 09 otherwise......
f240: 20 2a 20 46 6f 72 20 41 20 72 65 61 6c 20 66 69 * For A real fi
f250: 6c 65 73 79 73 74 65 6d 2c 20 63 68 64 69 72 50 lesystem, chdirP
f260: 72 6f 63 20 70 65 72 66 6f 72 6d 73 0a 09 09 09 roc performs....
f270: 09 20 2a 20 74 68 65 20 63 6f 72 72 65 63 74 20 . * the correct
f280: 61 63 74 69 6f 6e 2c 20 65 2e 67 2e 20 20 63 61 action, e.g. ca
f290: 6c 6c 73 20 74 68 65 20 73 79 73 74 65 6d 0a 09 lls the system..
f2a0: 09 09 09 20 2a 20 27 63 68 64 69 72 27 20 66 75 ... * 'chdir' fu
f2b0: 6e 63 74 69 6f 6e 2e 20 49 66 20 6e 6f 74 20 69 nction. If not i
f2c0: 6d 70 6c 65 6d 65 6e 74 65 64 2c 20 74 68 65 6e mplemented, then
f2d0: 0a 09 09 09 09 20 2a 20 27 63 64 27 20 61 6e 64 ..... * 'cd' and
f2e0: 20 27 70 77 64 27 20 66 61 69 6c 20 66 6f 72 20 'pwd' fail for
f2f0: 61 20 70 61 74 68 6e 61 6d 65 20 69 6e 20 74 68 a pathname in th
f300: 69 73 0a 09 09 09 09 20 2a 20 66 69 6c 65 73 79 is..... * filesy
f310: 73 74 65 6d 2e 20 4f 6e 20 73 75 63 63 65 73 73 stem. On success
f320: 20 54 63 6c 20 73 74 6f 72 65 73 20 74 68 65 0a Tcl stores the.
f330: 09 09 09 09 20 2a 20 70 61 74 68 6e 61 6d 65 20 .... * pathname
f340: 66 6f 72 20 75 73 65 20 62 79 20 47 65 74 43 77 for use by GetCw
f350: 64 2e 20 20 49 66 20 4e 55 4c 4c 2c 20 54 63 6c d. If NULL, Tcl
f360: 0a 09 09 09 09 20 2a 20 70 65 72 66 6f 72 6d 73 ..... * performs
f370: 20 72 65 63 6f 72 64 73 20 74 68 65 20 70 61 74 records the pat
f380: 68 6e 61 6d 65 20 61 73 20 74 68 65 20 6e 65 77 hname as the new
f390: 0a 09 09 09 09 20 2a 20 63 75 72 72 65 6e 74 20 ..... * current
f3a0: 64 69 72 65 63 74 6f 72 79 20 69 66 20 69 74 20 directory if it
f3b0: 70 61 73 73 65 73 20 61 20 73 65 72 69 65 73 20 passes a series
f3c0: 6f 66 0a 09 09 09 09 20 2a 20 64 69 72 65 63 74 of..... * direct
f3d0: 6f 72 79 20 61 63 63 65 73 73 20 63 68 65 63 6b ory access check
f3e0: 73 2e 20 2a 2f 0a 7d 20 54 63 6c 5f 46 69 6c 65 s. */.} Tcl_File
f3f0: 73 79 73 74 65 6d 3b 0a 0a 2f 2a 0a 20 2a 20 54 system;../*. * T
f400: 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 64 65 66 he following def
f410: 69 6e 69 74 69 6f 6e 73 20 61 72 65 20 75 73 65 initions are use
f420: 64 20 61 73 20 76 61 6c 75 65 73 20 66 6f 72 20 d as values for
f430: 74 68 65 20 27 6c 69 6e 6b 41 63 74 69 6f 6e 27 the 'linkAction'
f440: 20 66 6c 61 67 20 74 6f 0a 20 2a 20 54 63 6c 5f flag to. * Tcl_
f450: 46 53 4c 69 6e 6b 2c 20 6f 72 20 74 68 65 20 6c FSLink, or the l
f460: 69 6e 6b 50 72 6f 63 20 6f 66 20 61 6e 79 20 66 inkProc of any f
f470: 69 6c 65 73 79 73 74 65 6d 2e 20 41 6e 79 20 63 ilesystem. Any c
f480: 6f 6d 62 69 6e 61 74 69 6f 6e 20 6f 66 20 66 6c ombination of fl
f490: 61 67 73 20 63 61 6e 0a 20 2a 20 62 65 20 67 69 ags can. * be gi
f4a0: 76 65 6e 2e 20 46 6f 72 20 6c 69 6e 6b 20 63 72 ven. For link cr
f4b0: 65 61 74 69 6f 6e 2c 20 74 68 65 20 6c 69 6e 6b eation, the link
f4c0: 50 72 6f 63 20 73 68 6f 75 6c 64 20 63 72 65 61 Proc should crea
f4d0: 74 65 20 61 20 6c 69 6e 6b 20 77 68 69 63 68 0a te a link which.
f4e0: 20 2a 20 6d 61 74 63 68 65 73 20 61 6e 79 20 6f * matches any o
f4f0: 66 20 74 68 65 20 74 79 70 65 73 20 67 69 76 65 f the types give
f500: 6e 2e 0a 20 2a 0a 20 2a 20 54 43 4c 5f 43 52 45 n.. *. * TCL_CRE
f510: 41 54 45 5f 53 59 4d 42 4f 4c 49 43 5f 4c 49 4e ATE_SYMBOLIC_LIN
f520: 4b 20 2d 09 43 72 65 61 74 65 20 61 20 73 79 6d K -.Create a sym
f530: 62 6f 6c 69 63 20 6f 72 20 73 6f 66 74 20 6c 69 bolic or soft li
f540: 6e 6b 2e 0a 20 2a 20 54 43 4c 5f 43 52 45 41 54 nk.. * TCL_CREAT
f550: 45 5f 48 41 52 44 5f 4c 49 4e 4b 20 2d 09 43 72 E_HARD_LINK -.Cr
f560: 65 61 74 65 20 61 20 68 61 72 64 20 6c 69 6e 6b eate a hard link
f570: 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 .. */..#define T
f580: 43 4c 5f 43 52 45 41 54 45 5f 53 59 4d 42 4f 4c CL_CREATE_SYMBOL
f590: 49 43 5f 4c 49 4e 4b 09 30 78 30 31 0a 23 64 65 IC_LINK.0x01.#de
f5a0: 66 69 6e 65 20 54 43 4c 5f 43 52 45 41 54 45 5f fine TCL_CREATE_
f5b0: 48 41 52 44 5f 4c 49 4e 4b 09 09 30 78 30 32 0a HARD_LINK..0x02.
f5c0: 0a 2f 2a 0a 20 2a 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 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
f600: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
f610: 2d 2d 0a 20 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 --. * The follow
f620: 69 6e 67 20 73 74 72 75 63 74 75 72 65 20 72 65 ing structure re
f630: 70 72 65 73 65 6e 74 73 20 74 68 65 20 4e 6f 74 presents the Not
f640: 69 66 69 65 72 20 66 75 6e 63 74 69 6f 6e 73 20 ifier functions
f650: 74 68 61 74 20 79 6f 75 20 63 61 6e 0a 20 2a 20 that you can. *
f660: 6f 76 65 72 72 69 64 65 20 77 69 74 68 20 74 68 override with th
f670: 65 20 54 63 6c 5f 53 65 74 4e 6f 74 69 66 69 65 e Tcl_SetNotifie
f680: 72 20 63 61 6c 6c 2e 0a 20 2a 2f 0a 0a 74 79 70 r call.. */..typ
f690: 65 64 65 66 20 73 74 72 75 63 74 20 54 63 6c 5f edef struct Tcl_
f6a0: 4e 6f 74 69 66 69 65 72 50 72 6f 63 73 20 7b 0a NotifierProcs {.
f6b0: 20 20 20 20 54 63 6c 5f 53 65 74 54 69 6d 65 72 Tcl_SetTimer
f6c0: 50 72 6f 63 20 2a 73 65 74 54 69 6d 65 72 50 72 Proc *setTimerPr
f6d0: 6f 63 3b 0a 20 20 20 20 54 63 6c 5f 57 61 69 74 oc;. Tcl_Wait
f6e0: 46 6f 72 45 76 65 6e 74 50 72 6f 63 20 2a 77 61 ForEventProc *wa
f6f0: 69 74 46 6f 72 45 76 65 6e 74 50 72 6f 63 3b 0a itForEventProc;.
f700: 20 20 20 20 54 63 6c 5f 43 72 65 61 74 65 46 69 Tcl_CreateFi
f710: 6c 65 48 61 6e 64 6c 65 72 50 72 6f 63 20 2a 63 leHandlerProc *c
f720: 72 65 61 74 65 46 69 6c 65 48 61 6e 64 6c 65 72 reateFileHandler
f730: 50 72 6f 63 3b 0a 20 20 20 20 54 63 6c 5f 44 65 Proc;. Tcl_De
f740: 6c 65 74 65 46 69 6c 65 48 61 6e 64 6c 65 72 50 leteFileHandlerP
f750: 72 6f 63 20 2a 64 65 6c 65 74 65 46 69 6c 65 48 roc *deleteFileH
f760: 61 6e 64 6c 65 72 50 72 6f 63 3b 0a 20 20 20 20 andlerProc;.
f770: 54 63 6c 5f 49 6e 69 74 4e 6f 74 69 66 69 65 72 Tcl_InitNotifier
f780: 50 72 6f 63 20 2a 69 6e 69 74 4e 6f 74 69 66 69 Proc *initNotifi
f790: 65 72 50 72 6f 63 3b 0a 20 20 20 20 54 63 6c 5f erProc;. Tcl_
f7a0: 46 69 6e 61 6c 69 7a 65 4e 6f 74 69 66 69 65 72 FinalizeNotifier
f7b0: 50 72 6f 63 20 2a 66 69 6e 61 6c 69 7a 65 4e 6f Proc *finalizeNo
f7c0: 74 69 66 69 65 72 50 72 6f 63 3b 0a 20 20 20 20 tifierProc;.
f7d0: 54 63 6c 5f 41 6c 65 72 74 4e 6f 74 69 66 69 65 Tcl_AlertNotifie
f7e0: 72 50 72 6f 63 20 2a 61 6c 65 72 74 4e 6f 74 69 rProc *alertNoti
f7f0: 66 69 65 72 50 72 6f 63 3b 0a 20 20 20 20 54 63 fierProc;. Tc
f800: 6c 5f 53 65 72 76 69 63 65 4d 6f 64 65 48 6f 6f l_ServiceModeHoo
f810: 6b 50 72 6f 63 20 2a 73 65 72 76 69 63 65 4d 6f kProc *serviceMo
f820: 64 65 48 6f 6f 6b 50 72 6f 63 3b 0a 7d 20 54 63 deHookProc;.} Tc
f830: 6c 5f 4e 6f 74 69 66 69 65 72 50 72 6f 63 73 3b l_NotifierProcs;
f840: 0a 0c 0a 2f 2a 0a 20 2a 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 2d 2d 2d 2d 2d 2d 2d 2d ----------------
f880: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
f890: 2d 2d 2d 2d 0a 20 2a 20 54 68 65 20 66 6f 6c 6c ----. * The foll
f8a0: 6f 77 69 6e 67 20 64 61 74 61 20 73 74 72 75 63 owing data struc
f8b0: 74 75 72 65 73 20 61 6e 64 20 64 65 63 6c 61 72 tures and declar
f8c0: 61 74 69 6f 6e 73 20 61 72 65 20 66 6f 72 20 74 ations are for t
f8d0: 68 65 20 6e 65 77 20 54 63 6c 20 70 61 72 73 65 he new Tcl parse
f8e0: 72 2e 0a 20 2a 0a 20 2a 20 46 6f 72 20 65 61 63 r.. *. * For eac
f8f0: 68 20 77 6f 72 64 20 6f 66 20 61 20 63 6f 6d 6d h word of a comm
f900: 61 6e 64 2c 20 61 6e 64 20 66 6f 72 20 65 61 63 and, and for eac
f910: 68 20 70 69 65 63 65 20 6f 66 20 61 20 77 6f 72 h piece of a wor
f920: 64 20 73 75 63 68 20 61 73 20 61 20 76 61 72 69 d such as a vari
f930: 61 62 6c 65 0a 20 2a 20 72 65 66 65 72 65 6e 63 able. * referenc
f940: 65 2c 20 6f 6e 65 20 6f 66 20 74 68 65 20 66 6f e, one of the fo
f950: 6c 6c 6f 77 69 6e 67 20 73 74 72 75 63 74 75 72 llowing structur
f960: 65 73 20 69 73 20 63 72 65 61 74 65 64 20 74 6f es is created to
f970: 20 64 65 73 63 72 69 62 65 20 74 68 65 0a 20 2a describe the. *
f980: 20 74 6f 6b 65 6e 2e 0a 20 2a 2f 0a 0a 74 79 70 token.. */..typ
f990: 65 64 65 66 20 73 74 72 75 63 74 20 54 63 6c 5f edef struct Tcl_
f9a0: 54 6f 6b 65 6e 20 7b 0a 20 20 20 20 69 6e 74 20 Token {. int
f9b0: 74 79 70 65 3b 09 09 09 2f 2a 20 54 79 70 65 20 type;.../* Type
f9c0: 6f 66 20 74 6f 6b 65 6e 2c 20 73 75 63 68 20 61 of token, such a
f9d0: 73 20 54 43 4c 5f 54 4f 4b 45 4e 5f 57 4f 52 44 s TCL_TOKEN_WORD
f9e0: 3b 20 73 65 65 0a 09 09 09 09 20 2a 20 62 65 6c ; see..... * bel
f9f0: 6f 77 20 66 6f 72 20 76 61 6c 69 64 20 74 79 70 ow for valid typ
fa00: 65 73 2e 20 2a 2f 0a 20 20 20 20 63 6f 6e 73 74 es. */. const
fa10: 20 63 68 61 72 20 2a 73 74 61 72 74 3b 09 09 2f char *start;../
fa20: 2a 20 46 69 72 73 74 20 63 68 61 72 61 63 74 65 * First characte
fa30: 72 20 69 6e 20 74 6f 6b 65 6e 2e 20 2a 2f 0a 20 r in token. */.
fa40: 20 20 20 54 63 6c 5f 53 69 7a 65 20 73 69 7a 65 Tcl_Size size
fa50: 3b 09 09 2f 2a 20 4e 75 6d 62 65 72 20 6f 66 20 ;../* Number of
fa60: 62 79 74 65 73 20 69 6e 20 74 6f 6b 65 6e 2e 20 bytes in token.
fa70: 2a 2f 0a 20 20 20 20 54 63 6c 5f 53 69 7a 65 20 */. Tcl_Size
fa80: 6e 75 6d 43 6f 6d 70 6f 6e 65 6e 74 73 3b 09 2f numComponents;./
fa90: 2a 20 49 66 20 74 68 69 73 20 74 6f 6b 65 6e 20 * If this token
faa0: 69 73 20 63 6f 6d 70 6f 73 65 64 20 6f 66 20 6f is composed of o
fab0: 74 68 65 72 20 74 6f 6b 65 6e 73 2c 0a 09 09 09 ther tokens,....
fac0: 09 20 2a 20 74 68 69 73 20 66 69 65 6c 64 20 74 . * this field t
fad0: 65 6c 6c 73 20 68 6f 77 20 6d 61 6e 79 20 6f 66 ells how many of
fae0: 20 74 68 65 6d 20 74 68 65 72 65 20 61 72 65 0a them there are.
faf0: 09 09 09 09 20 2a 20 28 69 6e 63 6c 75 64 69 6e .... * (includin
fb00: 67 20 63 6f 6d 70 6f 6e 65 6e 74 73 20 6f 66 20 g components of
fb10: 63 6f 6d 70 6f 6e 65 6e 74 73 2c 20 65 74 63 2e components, etc.
fb20: 29 2e 0a 09 09 09 09 20 2a 20 54 68 65 20 63 6f )...... * The co
fb30: 6d 70 6f 6e 65 6e 74 20 74 6f 6b 65 6e 73 20 69 mponent tokens i
fb40: 6d 6d 65 64 69 61 74 65 6c 79 20 66 6f 6c 6c 6f mmediately follo
fb50: 77 0a 09 09 09 09 20 2a 20 74 68 69 73 20 6f 6e w..... * this on
fb60: 65 2e 20 2a 2f 0a 7d 20 54 63 6c 5f 54 6f 6b 65 e. */.} Tcl_Toke
fb70: 6e 3b 0a 0a 2f 2a 0a 20 2a 20 54 79 70 65 20 76 n;../*. * Type v
fb80: 61 6c 75 65 73 20 64 65 66 69 6e 65 64 20 66 6f alues defined fo
fb90: 72 20 54 63 6c 5f 54 6f 6b 65 6e 20 73 74 72 75 r Tcl_Token stru
fba0: 63 74 75 72 65 73 2e 20 54 68 65 73 65 20 76 61 ctures. These va
fbb0: 6c 75 65 73 20 61 72 65 20 64 65 66 69 6e 65 64 lues are defined
fbc0: 20 61 73 0a 20 2a 20 6d 61 73 6b 20 62 69 74 73 as. * mask bits
fbd0: 20 73 6f 20 74 68 61 74 20 69 74 27 73 20 65 61 so that it's ea
fbe0: 73 79 20 74 6f 20 63 68 65 63 6b 20 66 6f 72 20 sy to check for
fbf0: 63 6f 6c 6c 65 63 74 69 6f 6e 73 20 6f 66 20 74 collections of t
fc00: 79 70 65 73 2e 0a 20 2a 0a 20 2a 20 54 43 4c 5f ypes.. *. * TCL_
fc10: 54 4f 4b 45 4e 5f 57 4f 52 44 20 2d 09 09 54 68 TOKEN_WORD -..Th
fc20: 65 20 74 6f 6b 65 6e 20 64 65 73 63 72 69 62 65 e token describe
fc30: 73 20 6f 6e 65 20 77 6f 72 64 20 6f 66 20 61 20 s one word of a
fc40: 63 6f 6d 6d 61 6e 64 2c 0a 20 2a 09 09 09 09 66 command,. *....f
fc50: 72 6f 6d 20 74 68 65 20 66 69 72 73 74 20 6e 6f rom the first no
fc60: 6e 2d 62 6c 61 6e 6b 20 63 68 61 72 61 63 74 65 n-blank characte
fc70: 72 20 6f 66 20 74 68 65 20 77 6f 72 64 0a 20 2a r of the word. *
fc80: 09 09 09 09 28 77 68 69 63 68 20 6d 61 79 20 62 ....(which may b
fc90: 65 20 22 20 6f 72 20 7b 29 20 75 70 20 74 6f 20 e " or {) up to
fca0: 62 75 74 20 6e 6f 74 20 69 6e 63 6c 75 64 69 6e but not includin
fcb0: 67 0a 20 2a 09 09 09 09 74 68 65 20 73 70 61 63 g. *....the spac
fcc0: 65 2c 20 73 65 6d 69 63 6f 6c 6f 6e 2c 20 6f 72 e, semicolon, or
fcd0: 20 62 72 61 63 6b 65 74 20 74 68 61 74 0a 20 2a bracket that. *
fce0: 09 09 09 09 74 65 72 6d 69 6e 61 74 65 73 20 74 ....terminates t
fcf0: 68 65 20 77 6f 72 64 2e 20 4e 75 6d 43 6f 6d 70 he word. NumComp
fd00: 6f 6e 65 6e 74 73 20 63 6f 75 6e 74 73 20 74 68 onents counts th
fd10: 65 0a 20 2a 09 09 09 09 74 6f 74 61 6c 20 6e 75 e. *....total nu
fd20: 6d 62 65 72 20 6f 66 20 73 75 62 2d 74 6f 6b 65 mber of sub-toke
fd30: 6e 73 20 74 68 61 74 20 6d 61 6b 65 20 75 70 20 ns that make up
fd40: 74 68 65 0a 20 2a 09 09 09 09 77 6f 72 64 2e 20 the. *....word.
fd50: 54 68 69 73 20 69 6e 63 6c 75 64 65 73 2c 20 66 This includes, f
fd60: 6f 72 20 65 78 61 6d 70 6c 65 2c 20 73 75 62 2d or example, sub-
fd70: 74 6f 6b 65 6e 73 0a 20 2a 09 09 09 09 6f 66 20 tokens. *....of
fd80: 54 43 4c 5f 54 4f 4b 45 4e 5f 56 41 52 49 41 42 TCL_TOKEN_VARIAB
fd90: 4c 45 20 74 6f 6b 65 6e 73 2e 0a 20 2a 20 54 43 LE tokens.. * TC
fda0: 4c 5f 54 4f 4b 45 4e 5f 53 49 4d 50 4c 45 5f 57 L_TOKEN_SIMPLE_W
fdb0: 4f 52 44 20 2d 09 54 68 69 73 20 74 6f 6b 65 6e ORD -.This token
fdc0: 20 69 73 20 6a 75 73 74 20 6c 69 6b 65 20 54 43 is just like TC
fdd0: 4c 5f 54 4f 4b 45 4e 5f 57 4f 52 44 20 65 78 63 L_TOKEN_WORD exc
fde0: 65 70 74 0a 20 2a 09 09 09 09 74 68 61 74 20 74 ept. *....that t
fdf0: 68 65 20 77 6f 72 64 20 69 73 20 67 75 61 72 61 he word is guara
fe00: 6e 74 65 65 64 20 74 6f 20 63 6f 6e 73 69 73 74 nteed to consist
fe10: 20 6f 66 20 61 0a 20 2a 09 09 09 09 73 69 6e 67 of a. *....sing
fe20: 6c 65 20 54 43 4c 5f 54 4f 4b 45 4e 5f 54 45 58 le TCL_TOKEN_TEX
fe30: 54 20 73 75 62 2d 74 6f 6b 65 6e 2e 0a 20 2a 20 T sub-token.. *
fe40: 54 43 4c 5f 54 4f 4b 45 4e 5f 54 45 58 54 20 2d TCL_TOKEN_TEXT -
fe50: 09 09 54 68 65 20 74 6f 6b 65 6e 20 64 65 73 63 ..The token desc
fe60: 72 69 62 65 73 20 61 20 72 61 6e 67 65 20 6f 66 ribes a range of
fe70: 20 6c 69 74 65 72 61 6c 20 74 65 78 74 0a 20 2a literal text. *
fe80: 09 09 09 09 74 68 61 74 20 69 73 20 70 61 72 74 ....that is part
fe90: 20 6f 66 20 61 20 77 6f 72 64 2e 20 4e 75 6d 43 of a word. NumC
fea0: 6f 6d 70 6f 6e 65 6e 74 73 20 69 73 0a 20 2a 09 omponents is. *.
feb0: 09 09 09 61 6c 77 61 79 73 20 30 2e 0a 20 2a 20 ...always 0.. *
fec0: 54 43 4c 5f 54 4f 4b 45 4e 5f 42 53 20 2d 09 09 TCL_TOKEN_BS -..
fed0: 54 68 65 20 74 6f 6b 65 6e 20 64 65 73 63 72 69 The token descri
fee0: 62 65 73 20 61 20 62 61 63 6b 73 6c 61 73 68 20 bes a backslash
fef0: 73 65 71 75 65 6e 63 65 20 74 68 61 74 0a 20 2a sequence that. *
ff00: 09 09 09 09 6d 75 73 74 20 62 65 20 63 6f 6c 6c ....must be coll
ff10: 61 70 73 65 64 2e 20 4e 75 6d 43 6f 6d 70 6f 6e apsed. NumCompon
ff20: 65 6e 74 73 20 69 73 20 61 6c 77 61 79 73 20 30 ents is always 0
ff30: 2e 0a 20 2a 20 54 43 4c 5f 54 4f 4b 45 4e 5f 43 .. * TCL_TOKEN_C
ff40: 4f 4d 4d 41 4e 44 20 2d 09 09 54 68 65 20 74 6f OMMAND -..The to
ff50: 6b 65 6e 20 64 65 73 63 72 69 62 65 73 20 61 20 ken describes a
ff60: 63 6f 6d 6d 61 6e 64 20 77 68 6f 73 65 20 72 65 command whose re
ff70: 73 75 6c 74 0a 20 2a 09 09 09 09 6d 75 73 74 20 sult. *....must
ff80: 62 65 20 73 75 62 73 74 69 74 75 74 65 64 20 69 be substituted i
ff90: 6e 74 6f 20 74 68 65 20 77 6f 72 64 2e 20 54 68 nto the word. Th
ffa0: 65 20 74 6f 6b 65 6e 0a 20 2a 09 09 09 09 69 6e e token. *....in
ffb0: 63 6c 75 64 65 73 20 74 68 65 20 65 6e 63 6c 6f cludes the enclo
ffc0: 73 69 6e 67 20 62 72 61 63 6b 65 74 73 2e 20 4e sing brackets. N
ffd0: 75 6d 43 6f 6d 70 6f 6e 65 6e 74 73 0a 20 2a 09 umComponents. *.
ffe0: 09 09 09 69 73 20 61 6c 77 61 79 73 20 30 2e 0a ...is always 0..
fff0: 20 2a 20 54 43 4c 5f 54 4f 4b 45 4e 5f 56 41 52 * TCL_TOKEN_VAR
10000 49 41 42 4c 45 20 2d 09 09 54 68 65 20 74 6f 6b IABLE -..The tok
10010 65 6e 20 64 65 73 63 72 69 62 65 73 20 61 20 76 en describes a v
10020 61 72 69 61 62 6c 65 20 73 75 62 73 74 69 74 75 ariable substitu
10030 74 69 6f 6e 2c 0a 20 2a 09 09 09 09 69 6e 63 6c tion,. *....incl
10040 75 64 69 6e 67 20 74 68 65 20 64 6f 6c 6c 61 72 uding the dollar
10050 20 73 69 67 6e 2c 20 76 61 72 69 61 62 6c 65 20 sign, variable
10060 6e 61 6d 65 2c 20 61 6e 64 0a 20 2a 09 09 09 09 name, and. *....
10070 61 72 72 61 79 20 69 6e 64 65 78 20 28 69 66 20 array index (if
10080 74 68 65 72 65 20 69 73 20 6f 6e 65 29 20 75 70 there is one) up
10090 20 74 68 72 6f 75 67 68 20 74 68 65 0a 20 2a 09 through the. *.
100a0 09 09 09 72 69 67 68 74 20 70 61 72 65 6e 74 68 ...right parenth
100b0 65 73 65 73 2e 20 4e 75 6d 43 6f 6d 70 6f 6e 65 eses. NumCompone
100c0 6e 74 73 20 74 65 6c 6c 73 20 68 6f 77 0a 20 2a nts tells how. *
100d0 09 09 09 09 6d 61 6e 79 20 61 64 64 69 74 69 6f ....many additio
100e0 6e 61 6c 20 74 6f 6b 65 6e 73 20 66 6f 6c 6c 6f nal tokens follo
100f0 77 20 74 6f 20 72 65 70 72 65 73 65 6e 74 20 74 w to represent t
10100 68 65 0a 20 2a 09 09 09 09 76 61 72 69 61 62 6c he. *....variabl
10110 65 20 6e 61 6d 65 2e 20 54 68 65 20 66 69 72 73 e name. The firs
10120 74 20 74 6f 6b 65 6e 20 77 69 6c 6c 20 62 65 20 t token will be
10130 61 0a 20 2a 09 09 09 09 54 43 4c 5f 54 4f 4b 45 a. *....TCL_TOKE
10140 4e 5f 54 45 58 54 20 74 6f 6b 65 6e 20 74 68 61 N_TEXT token tha
10150 74 20 64 65 73 63 72 69 62 65 73 20 74 68 65 0a t describes the.
10160 20 2a 09 09 09 09 76 61 72 69 61 62 6c 65 20 6e *....variable n
10170 61 6d 65 2e 20 49 66 20 74 68 65 20 76 61 72 69 ame. If the vari
10180 61 62 6c 65 20 69 73 20 61 6e 20 61 72 72 61 79 able is an array
10190 0a 20 2a 09 09 09 09 72 65 66 65 72 65 6e 63 65 . *....reference
101a0 20 74 68 65 6e 20 74 68 65 72 65 20 77 69 6c 6c then there will
101b0 20 62 65 20 6f 6e 65 20 6f 72 20 6d 6f 72 65 0a be one or more.
101c0 20 2a 09 09 09 09 61 64 64 69 74 69 6f 6e 61 6c *....additional
101d0 20 74 6f 6b 65 6e 73 2c 20 6f 66 20 74 79 70 65 tokens, of type
101e0 20 54 43 4c 5f 54 4f 4b 45 4e 5f 54 45 58 54 2c TCL_TOKEN_TEXT,
101f0 0a 20 2a 09 09 09 09 54 43 4c 5f 54 4f 4b 45 4e . *....TCL_TOKEN
10200 5f 42 53 2c 20 54 43 4c 5f 54 4f 4b 45 4e 5f 43 _BS, TCL_TOKEN_C
10210 4f 4d 4d 41 4e 44 2c 20 61 6e 64 0a 20 2a 09 09 OMMAND, and. *..
10220 09 09 54 43 4c 5f 54 4f 4b 45 4e 5f 56 41 52 49 ..TCL_TOKEN_VARI
10230 41 42 4c 45 2c 20 74 68 61 74 20 64 65 73 63 72 ABLE, that descr
10240 69 62 65 20 74 68 65 20 61 72 72 61 79 0a 20 2a ibe the array. *
10250 09 09 09 09 69 6e 64 65 78 3b 20 6e 75 6d 43 6f ....index; numCo
10260 6d 70 6f 6e 65 6e 74 73 20 63 6f 75 6e 74 73 20 mponents counts
10270 74 68 65 20 74 6f 74 61 6c 20 6e 75 6d 62 65 72 the total number
10280 0a 20 2a 09 09 09 09 6f 66 20 6e 65 73 74 65 64 . *....of nested
10290 20 74 6f 6b 65 6e 73 20 74 68 61 74 20 6d 61 6b tokens that mak
102a0 65 20 75 70 20 74 68 65 20 76 61 72 69 61 62 6c e up the variabl
102b0 65 0a 20 2a 09 09 09 09 72 65 66 65 72 65 6e 63 e. *....referenc
102c0 65 2c 20 69 6e 63 6c 75 64 69 6e 67 20 73 75 62 e, including sub
102d0 2d 74 6f 6b 65 6e 73 20 6f 66 0a 20 2a 09 09 09 -tokens of. *...
102e0 09 54 43 4c 5f 54 4f 4b 45 4e 5f 56 41 52 49 41 .TCL_TOKEN_VARIA
102f0 42 4c 45 20 74 6f 6b 65 6e 73 2e 0a 20 2a 20 54 BLE tokens.. * T
10300 43 4c 5f 54 4f 4b 45 4e 5f 53 55 42 5f 45 58 50 CL_TOKEN_SUB_EXP
10310 52 20 2d 09 09 54 68 65 20 74 6f 6b 65 6e 20 64 R -..The token d
10320 65 73 63 72 69 62 65 73 20 6f 6e 65 20 73 75 62 escribes one sub
10330 65 78 70 72 65 73 73 69 6f 6e 20 6f 66 20 61 6e expression of an
10340 0a 20 2a 09 09 09 09 65 78 70 72 65 73 73 69 6f . *....expressio
10350 6e 2c 20 66 72 6f 6d 20 74 68 65 20 66 69 72 73 n, from the firs
10360 74 20 6e 6f 6e 2d 62 6c 61 6e 6b 20 63 68 61 72 t non-blank char
10370 61 63 74 65 72 0a 20 2a 09 09 09 09 6f 66 20 74 acter. *....of t
10380 68 65 20 73 75 62 65 78 70 72 65 73 73 69 6f 6e he subexpression
10390 20 75 70 20 74 6f 20 62 75 74 20 6e 6f 74 20 69 up to but not i
103a0 6e 63 6c 75 64 69 6e 67 0a 20 2a 09 09 09 09 74 ncluding. *....t
103b0 68 65 20 73 70 61 63 65 2c 20 62 72 61 63 65 2c he space, brace,
103c0 20 6f 72 20 62 72 61 63 6b 65 74 20 74 68 61 74 or bracket that
103d0 20 74 65 72 6d 69 6e 61 74 65 73 0a 20 2a 09 09 terminates. *..
103e0 09 09 74 68 65 20 73 75 62 65 78 70 72 65 73 73 ..the subexpress
103f0 69 6f 6e 2e 20 4e 75 6d 43 6f 6d 70 6f 6e 65 6e ion. NumComponen
10400 74 73 20 63 6f 75 6e 74 73 20 74 68 65 0a 20 2a ts counts the. *
10410 09 09 09 09 74 6f 74 61 6c 20 6e 75 6d 62 65 72 ....total number
10420 20 6f 66 20 66 6f 6c 6c 6f 77 69 6e 67 20 73 75 of following su
10430 62 74 6f 6b 65 6e 73 20 74 68 61 74 20 6d 61 6b btokens that mak
10440 65 0a 20 2a 09 09 09 09 75 70 20 74 68 65 20 73 e. *....up the s
10450 75 62 65 78 70 72 65 73 73 69 6f 6e 3b 20 74 68 ubexpression; th
10460 69 73 20 69 6e 63 6c 75 64 65 73 20 61 6c 6c 0a is includes all.
10470 20 2a 09 09 09 09 73 75 62 74 6f 6b 65 6e 73 20 *....subtokens
10480 66 6f 72 20 61 6e 79 20 6e 65 73 74 65 64 20 54 for any nested T
10490 43 4c 5f 54 4f 4b 45 4e 5f 53 55 42 5f 45 58 50 CL_TOKEN_SUB_EXP
104a0 52 0a 20 2a 09 09 09 09 74 6f 6b 65 6e 73 2e 20 R. *....tokens.
104b0 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 61 20 6e For example, a n
104c0 75 6d 65 72 69 63 20 76 61 6c 75 65 20 75 73 65 umeric value use
104d0 64 20 61 73 20 61 0a 20 2a 09 09 09 09 70 72 69 d as a. *....pri
104e0 6d 69 74 69 76 65 20 6f 70 65 72 61 6e 64 20 69 mitive operand i
104f0 73 20 64 65 73 63 72 69 62 65 64 20 62 79 20 61 s described by a
10500 0a 20 2a 09 09 09 09 54 43 4c 5f 54 4f 4b 45 4e . *....TCL_TOKEN
10510 5f 53 55 42 5f 45 58 50 52 20 74 6f 6b 65 6e 20 _SUB_EXPR token
10520 66 6f 6c 6c 6f 77 65 64 20 62 79 20 61 0a 20 2a followed by a. *
10530 09 09 09 09 54 43 4c 5f 54 4f 4b 45 4e 5f 54 45 ....TCL_TOKEN_TE
10540 58 54 20 74 6f 6b 65 6e 2e 20 41 20 62 69 6e 61 XT token. A bina
10550 72 79 20 73 75 62 65 78 70 72 65 73 73 69 6f 6e ry subexpression
10560 0a 20 2a 09 09 09 09 69 73 20 64 65 73 63 72 69 . *....is descri
10570 62 65 64 20 62 79 20 61 20 54 43 4c 5f 54 4f 4b bed by a TCL_TOK
10580 45 4e 5f 53 55 42 5f 45 58 50 52 20 74 6f 6b 65 EN_SUB_EXPR toke
10590 6e 0a 20 2a 09 09 09 09 66 6f 6c 6c 6f 77 65 64 n. *....followed
105a0 20 62 79 20 74 68 65 20 54 43 4c 5f 54 4f 4b 45 by the TCL_TOKE
105b0 4e 5f 4f 50 45 52 41 54 4f 52 20 74 6f 6b 65 6e N_OPERATOR token
105c0 20 66 6f 72 0a 20 2a 09 09 09 09 74 68 65 20 6f for. *....the o
105d0 70 65 72 61 74 6f 72 2c 20 74 68 65 6e 20 54 43 perator, then TC
105e0 4c 5f 54 4f 4b 45 4e 5f 53 55 42 5f 45 58 50 52 L_TOKEN_SUB_EXPR
105f0 20 74 6f 6b 65 6e 73 0a 20 2a 09 09 09 09 66 6f tokens. *....fo
10600 72 20 74 68 65 20 6c 65 66 74 20 74 68 65 6e 20 r the left then
10610 74 68 65 20 72 69 67 68 74 20 6f 70 65 72 61 6e the right operan
10620 64 73 2e 0a 20 2a 20 54 43 4c 5f 54 4f 4b 45 4e ds.. * TCL_TOKEN
10630 5f 43 4d 44 5f 49 4e 5f 45 58 50 52 20 2d 09 54 _CMD_IN_EXPR -.T
10640 49 50 20 37 35 39 3a 20 74 68 65 20 74 6f 6b 65 IP 759: the toke
10650 6e 20 64 65 73 63 72 69 62 65 73 20 61 20 72 61 n describes a ra
10660 77 20 63 6f 6d 6d 61 6e 64 20 69 6e 0a 20 2a 09 w command in. *.
10670 09 09 09 61 6e 20 65 78 70 72 65 73 73 69 6f 6e ...an expression
10680 2c 20 61 20 63 6f 6d 6d 61 6e 64 20 77 69 74 68 , a command with
10690 6f 75 74 20 62 72 61 63 6b 65 74 73 2c 0a 20 2a out brackets,. *
106a0 09 09 09 09 77 68 6f 73 65 20 72 65 73 75 6c 74 ....whose result
106b0 20 69 73 20 74 68 65 20 76 61 6c 75 65 20 6f 66 is the value of
106c0 20 61 6e 20 6f 70 65 72 61 6e 64 2e 20 54 68 65 an operand. The
106d0 0a 20 2a 09 09 09 09 74 6f 6b 65 6e 20 69 73 20 . *....token is
106e0 74 68 65 20 74 65 78 74 20 6f 66 20 74 68 65 20 the text of the
106f0 63 6f 6d 6d 61 6e 64 2e 0a 20 2a 09 09 09 09 4e command.. *....N
10700 75 6d 43 6f 6d 70 6f 6e 65 6e 74 73 20 69 73 20 umComponents is
10710 61 6c 77 61 79 73 20 30 2e 0a 20 2a 20 54 43 4c always 0.. * TCL
10720 5f 54 4f 4b 45 4e 5f 4f 50 45 52 41 54 4f 52 20 _TOKEN_OPERATOR
10730 2d 09 09 54 68 65 20 74 6f 6b 65 6e 20 64 65 73 -..The token des
10740 63 72 69 62 65 73 20 6f 6e 65 20 65 78 70 72 65 cribes one expre
10750 73 73 69 6f 6e 20 6f 70 65 72 61 74 6f 72 2e 0a ssion operator..
10760 20 2a 09 09 09 09 41 6e 20 6f 70 65 72 61 74 6f *....An operato
10770 72 20 6d 69 67 68 74 20 62 65 20 74 68 65 20 6e r might be the n
10780 61 6d 65 20 6f 66 20 61 20 6d 61 74 68 0a 20 2a ame of a math. *
10790 09 09 09 09 66 75 6e 63 74 69 6f 6e 20 73 75 63 ....function suc
107a0 68 20 61 73 20 22 61 62 73 22 2e 20 41 20 54 43 h as "abs". A TC
107b0 4c 5f 54 4f 4b 45 4e 5f 4f 50 45 52 41 54 4f 52 L_TOKEN_OPERATOR
107c0 0a 20 2a 09 09 09 09 74 6f 6b 65 6e 20 69 73 20 . *....token is
107d0 61 6c 77 61 79 73 20 70 72 65 63 65 64 65 64 20 always preceded
107e0 62 79 20 6f 6e 65 0a 20 2a 09 09 09 09 54 43 4c by one. *....TCL
107f0 5f 54 4f 4b 45 4e 5f 53 55 42 5f 45 58 50 52 20 _TOKEN_SUB_EXPR
10800 74 6f 6b 65 6e 20 66 6f 72 20 74 68 65 20 6f 70 token for the op
10810 65 72 61 74 6f 72 27 73 0a 20 2a 09 09 09 09 73 erator's. *....s
10820 75 62 65 78 70 72 65 73 73 69 6f 6e 2c 20 61 6e ubexpression, an
10830 64 20 69 73 20 66 6f 6c 6c 6f 77 65 64 20 62 79 d is followed by
10840 20 7a 65 72 6f 20 6f 72 20 6d 6f 72 65 0a 20 2a zero or more. *
10850 09 09 09 09 54 43 4c 5f 54 4f 4b 45 4e 5f 53 55 ....TCL_TOKEN_SU
10860 42 5f 45 58 50 52 20 74 6f 6b 65 6e 73 20 66 6f B_EXPR tokens fo
10870 72 20 74 68 65 20 6f 70 65 72 61 74 6f 72 27 73 r the operator's
10880 0a 20 2a 09 09 09 09 6f 70 65 72 61 6e 64 73 2e . *....operands.
10890 20 4e 75 6d 43 6f 6d 70 6f 6e 65 6e 74 73 20 69 NumComponents i
108a0 73 20 61 6c 77 61 79 73 20 30 2e 0a 20 2a 20 54 s always 0.. * T
108b0 43 4c 5f 54 4f 4b 45 4e 5f 45 58 50 41 4e 44 5f CL_TOKEN_EXPAND_
108c0 57 4f 52 44 20 2d 09 54 68 69 73 20 74 6f 6b 65 WORD -.This toke
108d0 6e 20 69 73 20 6a 75 73 74 20 6c 69 6b 65 20 54 n is just like T
108e0 43 4c 5f 54 4f 4b 45 4e 5f 57 4f 52 44 20 65 78 CL_TOKEN_WORD ex
108f0 63 65 70 74 0a 20 2a 09 09 09 09 74 68 61 74 20 cept. *....that
10900 69 74 20 6d 61 72 6b 73 20 61 20 77 6f 72 64 20 it marks a word
10910 74 68 61 74 20 62 65 67 61 6e 20 77 69 74 68 20 that began with
10920 74 68 65 0a 20 2a 09 09 09 09 6c 69 74 65 72 61 the. *....litera
10930 6c 20 63 68 61 72 61 63 74 65 72 20 70 72 65 66 l character pref
10940 69 78 20 22 7b 2a 7d 22 2e 20 54 68 69 73 20 77 ix "{*}". This w
10950 6f 72 64 20 69 73 0a 20 2a 09 09 09 09 6d 61 72 ord is. *....mar
10960 6b 65 64 20 74 6f 20 62 65 20 65 78 70 61 6e 64 ked to be expand
10970 65 64 20 2d 20 74 68 61 74 20 69 73 2c 20 62 72 ed - that is, br
10980 6f 6b 65 6e 20 69 6e 74 6f 0a 20 2a 09 09 09 09 oken into. *....
10990 77 6f 72 64 73 20 61 66 74 65 72 20 73 75 62 73 words after subs
109a0 74 69 74 75 74 69 6f 6e 20 69 73 20 63 6f 6d 70 titution is comp
109b0 6c 65 74 65 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 lete.. */..#defi
109c0 6e 65 20 54 43 4c 5f 54 4f 4b 45 4e 5f 57 4f 52 ne TCL_TOKEN_WOR
109d0 44 09 09 31 0a 23 64 65 66 69 6e 65 20 54 43 4c D..1.#define TCL
109e0 5f 54 4f 4b 45 4e 5f 53 49 4d 50 4c 45 5f 57 4f _TOKEN_SIMPLE_WO
109f0 52 44 09 32 0a 23 64 65 66 69 6e 65 20 54 43 4c RD.2.#define TCL
10a00 5f 54 4f 4b 45 4e 5f 54 45 58 54 09 09 34 0a 23 _TOKEN_TEXT..4.#
10a10 64 65 66 69 6e 65 20 54 43 4c 5f 54 4f 4b 45 4e define TCL_TOKEN
10a20 5f 42 53 09 09 38 0a 23 64 65 66 69 6e 65 20 54 _BS..8.#define T
10a30 43 4c 5f 54 4f 4b 45 4e 5f 43 4f 4d 4d 41 4e 44 CL_TOKEN_COMMAND
10a40 09 31 36 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f .16.#define TCL_
10a50 54 4f 4b 45 4e 5f 56 41 52 49 41 42 4c 45 09 33 TOKEN_VARIABLE.3
10a60 32 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 54 4f 2.#define TCL_TO
10a70 4b 45 4e 5f 53 55 42 5f 45 58 50 52 09 36 34 0a KEN_SUB_EXPR.64.
10a80 23 64 65 66 69 6e 65 20 54 43 4c 5f 54 4f 4b 45 #define TCL_TOKE
10a90 4e 5f 4f 50 45 52 41 54 4f 52 09 31 32 38 0a 23 N_OPERATOR.128.#
10aa0 64 65 66 69 6e 65 20 54 43 4c 5f 54 4f 4b 45 4e define TCL_TOKEN
10ab0 5f 45 58 50 41 4e 44 5f 57 4f 52 44 09 32 35 36 _EXPAND_WORD.256
10ac0 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 54 4f 4b .#define TCL_TOK
10ad0 45 4e 5f 43 4d 44 5f 49 4e 5f 45 58 50 52 09 35 EN_CMD_IN_EXPR.5
10ae0 31 32 0a 0a 2f 2a 0a 20 2a 20 50 61 72 73 69 6e 12../*. * Parsin
10af0 67 20 65 72 72 6f 72 20 74 79 70 65 73 2e 20 4f g error types. O
10b00 6e 20 61 6e 79 20 70 61 72 73 69 6e 67 20 65 72 n any parsing er
10b10 72 6f 72 2c 20 6f 6e 65 20 6f 66 20 74 68 65 73 ror, one of thes
10b20 65 20 76 61 6c 75 65 73 20 77 69 6c 6c 20 62 65 e values will be
10b30 0a 20 2a 20 73 74 6f 72 65 64 20 69 6e 20 74 68 . * stored in th
10b40 65 20 65 72 72 6f 72 20 66 69 65 6c 64 20 6f 66 e error field of
10b50 20 74 68 65 20 54 63 6c 5f 50 61 72 73 65 20 73 the Tcl_Parse s
10b60 74 72 75 63 74 75 72 65 20 64 65 66 69 6e 65 64 tructure defined
10b70 20 62 65 6c 6f 77 2e 0a 20 2a 2f 0a 0a 23 64 65 below.. */..#de
10b80 66 69 6e 65 20 54 43 4c 5f 50 41 52 53 45 5f 53 fine TCL_PARSE_S
10b90 55 43 43 45 53 53 09 09 30 0a 23 64 65 66 69 6e UCCESS..0.#defin
10ba0 65 20 54 43 4c 5f 50 41 52 53 45 5f 51 55 4f 54 e TCL_PARSE_QUOT
10bb0 45 5f 45 58 54 52 41 09 09 31 0a 23 64 65 66 69 E_EXTRA..1.#defi
10bc0 6e 65 20 54 43 4c 5f 50 41 52 53 45 5f 42 52 41 ne TCL_PARSE_BRA
10bd0 43 45 5f 45 58 54 52 41 09 09 32 0a 23 64 65 66 CE_EXTRA..2.#def
10be0 69 6e 65 20 54 43 4c 5f 50 41 52 53 45 5f 4d 49 ine TCL_PARSE_MI
10bf0 53 53 49 4e 47 5f 42 52 41 43 45 09 09 33 0a 23 SSING_BRACE..3.#
10c00 64 65 66 69 6e 65 20 54 43 4c 5f 50 41 52 53 45 define TCL_PARSE
10c10 5f 4d 49 53 53 49 4e 47 5f 42 52 41 43 4b 45 54 _MISSING_BRACKET
10c20 09 34 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 50 .4.#define TCL_P
10c30 41 52 53 45 5f 4d 49 53 53 49 4e 47 5f 50 41 52 ARSE_MISSING_PAR
10c40 45 4e 09 09 35 0a 23 64 65 66 69 6e 65 20 54 43 EN..5.#define TC
10c50 4c 5f 50 41 52 53 45 5f 4d 49 53 53 49 4e 47 5f L_PARSE_MISSING_
10c60 51 55 4f 54 45 09 09 36 0a 23 64 65 66 69 6e 65 QUOTE..6.#define
10c70 20 54 43 4c 5f 50 41 52 53 45 5f 4d 49 53 53 49 TCL_PARSE_MISSI
10c80 4e 47 5f 56 41 52 5f 42 52 41 43 45 09 37 0a 23 NG_VAR_BRACE.7.#
10c90 64 65 66 69 6e 65 20 54 43 4c 5f 50 41 52 53 45 define TCL_PARSE
10ca0 5f 53 59 4e 54 41 58 09 09 38 0a 23 64 65 66 69 _SYNTAX..8.#defi
10cb0 6e 65 20 54 43 4c 5f 50 41 52 53 45 5f 42 41 44 ne TCL_PARSE_BAD
10cc0 5f 4e 55 4d 42 45 52 09 09 39 0a 0a 2f 2a 0a 20 _NUMBER..9../*.
10cd0 2a 20 41 20 73 74 72 75 63 74 75 72 65 20 6f 66 * A structure of
10ce0 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 74 the following t
10cf0 79 70 65 20 69 73 20 66 69 6c 6c 65 64 20 69 6e ype is filled in
10d00 20 62 79 20 54 63 6c 5f 50 61 72 73 65 43 6f 6d by Tcl_ParseCom
10d10 6d 61 6e 64 2e 20 49 74 0a 20 2a 20 64 65 73 63 mand. It. * desc
10d20 72 69 62 65 73 20 61 20 73 69 6e 67 6c 65 20 63 ribes a single c
10d30 6f 6d 6d 61 6e 64 20 70 61 72 73 65 64 20 66 72 ommand parsed fr
10d40 6f 6d 20 61 6e 20 69 6e 70 75 74 20 73 74 72 69 om an input stri
10d50 6e 67 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 ng.. */..#define
10d60 20 4e 55 4d 5f 53 54 41 54 49 43 5f 54 4f 4b 45 NUM_STATIC_TOKE
10d70 4e 53 20 32 30 0a 0a 74 79 70 65 64 65 66 20 73 NS 20..typedef s
10d80 74 72 75 63 74 20 54 63 6c 5f 50 61 72 73 65 20 truct Tcl_Parse
10d90 7b 0a 20 20 20 20 63 6f 6e 73 74 20 63 68 61 72 {. const char
10da0 20 2a 63 6f 6d 6d 65 6e 74 53 74 61 72 74 3b 09 *commentStart;.
10db0 2f 2a 20 50 6f 69 6e 74 65 72 20 74 6f 20 23 20 /* Pointer to #
10dc0 74 68 61 74 20 62 65 67 69 6e 73 20 74 68 65 20 that begins the
10dd0 66 69 72 73 74 20 6f 66 20 6f 6e 65 0a 09 09 09 first of one....
10de0 09 20 2a 20 6f 72 20 6d 6f 72 65 20 63 6f 6d 6d . * or more comm
10df0 65 6e 74 73 20 70 72 65 63 65 64 69 6e 67 20 74 ents preceding t
10e00 68 65 20 63 6f 6d 6d 61 6e 64 2e 20 2a 2f 0a 20 he command. */.
10e10 20 20 20 54 63 6c 5f 53 69 7a 65 20 63 6f 6d 6d Tcl_Size comm
10e20 65 6e 74 53 69 7a 65 3b 09 2f 2a 20 4e 75 6d 62 entSize;./* Numb
10e30 65 72 20 6f 66 20 62 79 74 65 73 20 69 6e 20 63 er of bytes in c
10e40 6f 6d 6d 65 6e 74 73 20 28 75 70 20 74 68 72 6f omments (up thro
10e50 75 67 68 0a 09 09 09 09 20 2a 20 6e 65 77 6c 69 ugh..... * newli
10e60 6e 65 20 63 68 61 72 61 63 74 65 72 20 74 68 61 ne character tha
10e70 74 20 74 65 72 6d 69 6e 61 74 65 73 20 74 68 65 t terminates the
10e80 20 6c 61 73 74 0a 09 09 09 09 20 2a 20 63 6f 6d last..... * com
10e90 6d 65 6e 74 29 2e 20 49 66 20 74 68 65 72 65 20 ment). If there
10ea0 77 65 72 65 20 6e 6f 20 63 6f 6d 6d 65 6e 74 73 were no comments
10eb0 2c 20 74 68 69 73 0a 09 09 09 09 20 2a 20 66 69 , this..... * fi
10ec0 65 6c 64 20 69 73 20 30 2e 20 2a 2f 0a 20 20 20 eld is 0. */.
10ed0 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 63 6f 6d const char *com
10ee0 6d 61 6e 64 53 74 61 72 74 3b 09 2f 2a 20 46 69 mandStart;./* Fi
10ef0 72 73 74 20 63 68 61 72 61 63 74 65 72 20 69 6e rst character in
10f00 20 66 69 72 73 74 20 77 6f 72 64 20 6f 66 0a 09 first word of..
10f10 09 09 09 20 2a 20 63 6f 6d 6d 61 6e 64 2e 20 2a ... * command. *
10f20 2f 0a 20 20 20 20 54 63 6c 5f 53 69 7a 65 20 63 /. Tcl_Size c
10f30 6f 6d 6d 61 6e 64 53 69 7a 65 3b 09 2f 2a 20 4e ommandSize;./* N
10f40 75 6d 62 65 72 20 6f 66 20 62 79 74 65 73 20 69 umber of bytes i
10f50 6e 20 63 6f 6d 6d 61 6e 64 2c 20 69 6e 63 6c 75 n command, inclu
10f60 64 69 6e 67 20 66 69 72 73 74 0a 09 09 09 09 20 ding first.....
10f70 2a 20 63 68 61 72 61 63 74 65 72 20 6f 66 20 66 * character of f
10f80 69 72 73 74 20 77 6f 72 64 2c 20 75 70 20 74 68 irst word, up th
10f90 72 6f 75 67 68 20 74 68 65 0a 09 09 09 09 20 2a rough the..... *
10fa0 20 74 65 72 6d 69 6e 61 74 69 6e 67 20 6e 65 77 terminating new
10fb0 6c 69 6e 65 2c 20 63 6c 6f 73 65 20 62 72 61 63 line, close brac
10fc0 6b 65 74 2c 20 6f 72 0a 09 09 09 09 20 2a 20 73 ket, or..... * s
10fd0 65 6d 69 63 6f 6c 6f 6e 2e 20 2a 2f 0a 20 20 20 emicolon. */.
10fe0 20 54 63 6c 5f 53 69 7a 65 20 6e 75 6d 57 6f 72 Tcl_Size numWor
10ff0 64 73 3b 09 09 2f 2a 20 54 6f 74 61 6c 20 6e 75 ds;../* Total nu
11000 6d 62 65 72 20 6f 66 20 77 6f 72 64 73 20 69 6e mber of words in
11010 20 63 6f 6d 6d 61 6e 64 2e 20 4d 61 79 20 62 65 command. May be
11020 0a 09 09 09 09 20 2a 20 30 2e 20 2a 2f 0a 20 20 ..... * 0. */.
11030 20 20 54 63 6c 5f 54 6f 6b 65 6e 20 2a 74 6f 6b Tcl_Token *tok
11040 65 6e 50 74 72 3b 09 2f 2a 20 50 6f 69 6e 74 65 enPtr;./* Pointe
11050 72 20 74 6f 20 66 69 72 73 74 20 74 6f 6b 65 6e r to first token
11060 20 72 65 70 72 65 73 65 6e 74 69 6e 67 20 74 68 representing th
11070 65 0a 09 09 09 09 20 2a 20 77 6f 72 64 73 20 6f e..... * words o
11080 66 20 74 68 65 20 63 6f 6d 6d 61 6e 64 2e 20 49 f the command. I
11090 6e 69 74 69 61 6c 6c 79 20 70 6f 69 6e 74 73 20 nitially points
110a0 74 6f 0a 09 09 09 09 20 2a 20 73 74 61 74 69 63 to..... * static
110b0 54 6f 6b 65 6e 73 2c 20 62 75 74 20 6d 61 79 20 Tokens, but may
110c0 63 68 61 6e 67 65 20 74 6f 20 70 6f 69 6e 74 20 change to point
110d0 74 6f 0a 09 09 09 09 20 2a 20 6d 61 6c 6c 6f 63 to..... * malloc
110e0 2d 65 64 20 73 70 61 63 65 20 69 66 20 63 6f 6d -ed space if com
110f0 6d 61 6e 64 20 65 78 63 65 65 64 73 20 73 70 61 mand exceeds spa
11100 63 65 20 69 6e 0a 09 09 09 09 20 2a 20 73 74 61 ce in..... * sta
11110 74 69 63 54 6f 6b 65 6e 73 2e 20 2a 2f 0a 20 20 ticTokens. */.
11120 20 20 54 63 6c 5f 53 69 7a 65 20 6e 75 6d 54 6f Tcl_Size numTo
11130 6b 65 6e 73 3b 09 09 2f 2a 20 54 6f 74 61 6c 20 kens;../* Total
11140 6e 75 6d 62 65 72 20 6f 66 20 74 6f 6b 65 6e 73 number of tokens
11150 20 69 6e 20 63 6f 6d 6d 61 6e 64 2e 20 2a 2f 0a in command. */.
11160 20 20 20 20 54 63 6c 5f 53 69 7a 65 20 74 6f 6b Tcl_Size tok
11170 65 6e 73 41 76 61 69 6c 61 62 6c 65 3b 09 2f 2a ensAvailable;./*
11180 20 54 6f 74 61 6c 20 6e 75 6d 62 65 72 20 6f 66 Total number of
11190 20 74 6f 6b 65 6e 73 20 61 76 61 69 6c 61 62 6c tokens availabl
111a0 65 20 61 74 0a 09 09 09 09 20 2a 20 2a 74 6f 6b e at..... * *tok
111b0 65 6e 50 74 72 2e 20 2a 2f 0a 20 20 20 20 69 6e enPtr. */. in
111c0 74 20 65 72 72 6f 72 54 79 70 65 3b 09 09 2f 2a t errorType;../*
111d0 20 4f 6e 65 20 6f 66 20 74 68 65 20 70 61 72 73 One of the pars
111e0 69 6e 67 20 65 72 72 6f 72 20 74 79 70 65 73 20 ing error types
111f0 64 65 66 69 6e 65 64 0a 09 09 09 09 20 2a 20 61 defined..... * a
11200 62 6f 76 65 2e 20 2a 2f 0a 20 20 20 20 69 6e 74 bove. */. int
11210 20 69 6e 63 6f 6d 70 6c 65 74 65 3b 09 09 2f 2a incomplete;../*
11220 20 54 68 69 73 20 66 69 65 6c 64 20 69 73 20 73 This field is s
11230 65 74 20 74 6f 20 31 20 62 79 20 54 63 6c 5f 50 et to 1 by Tcl_P
11240 61 72 73 65 43 6f 6d 6d 61 6e 64 0a 09 09 09 09 arseCommand.....
11250 20 2a 20 69 66 20 74 68 65 20 63 6f 6d 6d 61 6e * if the comman
11260 64 20 61 70 70 65 61 72 73 20 74 6f 20 62 65 20 d appears to be
11270 69 6e 63 6f 6d 70 6c 65 74 65 2e 0a 09 09 09 09 incomplete......
11280 20 2a 20 54 68 69 73 20 69 6e 66 6f 72 6d 61 74 * This informat
11290 69 6f 6e 20 69 73 20 75 73 65 64 20 62 79 0a 09 ion is used by..
112a0 09 09 09 20 2a 20 54 63 6c 5f 43 6f 6d 6d 61 6e ... * Tcl_Comman
112b0 64 43 6f 6d 70 6c 65 74 65 2e 20 2a 2f 0a 0a 20 dComplete. */..
112c0 20 20 20 2f 2a 0a 20 20 20 20 20 2a 20 54 68 65 /*. * The
112d0 20 66 69 65 6c 64 73 20 62 65 6c 6f 77 20 61 72 fields below ar
112e0 65 20 69 6e 74 65 6e 64 65 64 20 6f 6e 6c 79 20 e intended only
112f0 66 6f 72 20 74 68 65 20 70 72 69 76 61 74 65 20 for the private
11300 75 73 65 20 6f 66 20 74 68 65 20 70 61 72 73 65 use of the parse
11310 72 2e 0a 20 20 20 20 20 2a 20 54 68 65 79 20 73 r.. * They s
11320 68 6f 75 6c 64 20 6e 6f 74 20 62 65 20 75 73 65 hould not be use
11330 64 20 62 79 20 66 75 6e 63 74 69 6f 6e 73 20 74 d by functions t
11340 68 61 74 20 69 6e 76 6f 6b 65 20 54 63 6c 5f 50 hat invoke Tcl_P
11350 61 72 73 65 43 6f 6d 6d 61 6e 64 2e 0a 20 20 20 arseCommand..
11360 20 20 2a 2f 0a 0a 20 20 20 20 63 6f 6e 73 74 20 */.. const
11370 63 68 61 72 20 2a 73 74 72 69 6e 67 3b 09 09 2f char *string;../
11380 2a 20 54 68 65 20 6f 72 69 67 69 6e 61 6c 20 63 * The original c
11390 6f 6d 6d 61 6e 64 20 73 74 72 69 6e 67 20 70 61 ommand string pa
113a0 73 73 65 64 20 74 6f 0a 09 09 09 09 20 2a 20 54 ssed to..... * T
113b0 63 6c 5f 50 61 72 73 65 43 6f 6d 6d 61 6e 64 2e cl_ParseCommand.
113c0 20 2a 2f 0a 20 20 20 20 63 6f 6e 73 74 20 63 68 */. const ch
113d0 61 72 20 2a 65 6e 64 3b 09 09 2f 2a 20 50 6f 69 ar *end;../* Poi
113e0 6e 74 73 20 74 6f 20 74 68 65 20 63 68 61 72 61 nts to the chara
113f0 63 74 65 72 20 6a 75 73 74 20 61 66 74 65 72 20 cter just after
11400 74 68 65 20 6c 61 73 74 0a 09 09 09 09 20 2a 20 the last..... *
11410 6f 6e 65 20 69 6e 20 74 68 65 20 63 6f 6d 6d 61 one in the comma
11420 6e 64 20 73 74 72 69 6e 67 2e 20 2a 2f 0a 20 20 nd string. */.
11430 20 20 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e Tcl_Interp *in
11440 74 65 72 70 3b 09 09 2f 2a 20 49 6e 74 65 72 70 terp;../* Interp
11450 72 65 74 65 72 20 74 6f 20 75 73 65 20 66 6f 72 reter to use for
11460 20 65 72 72 6f 72 20 72 65 70 6f 72 74 69 6e 67 error reporting
11470 2c 20 6f 72 0a 09 09 09 09 20 2a 20 4e 55 4c 4c , or..... * NULL
11480 2e 20 2a 2f 0a 20 20 20 20 63 6f 6e 73 74 20 63 . */. const c
11490 68 61 72 20 2a 74 65 72 6d 3b 09 09 2f 2a 20 50 har *term;../* P
114a0 6f 69 6e 74 73 20 74 6f 20 63 68 61 72 61 63 74 oints to charact
114b0 65 72 20 69 6e 20 73 74 72 69 6e 67 20 74 68 61 er in string tha
114c0 74 0a 09 09 09 09 20 2a 20 74 65 72 6d 69 6e 61 t..... * termina
114d0 74 65 64 20 6d 6f 73 74 20 72 65 63 65 6e 74 20 ted most recent
114e0 74 6f 6b 65 6e 2e 20 46 69 6c 6c 65 64 20 69 6e token. Filled in
114f0 20 62 79 0a 09 09 09 09 20 2a 20 50 61 72 73 65 by..... * Parse
11500 54 6f 6b 65 6e 73 2e 20 49 66 20 61 6e 20 65 72 Tokens. If an er
11510 72 6f 72 20 6f 63 63 75 72 73 2c 20 70 6f 69 6e ror occurs, poin
11520 74 73 20 74 6f 0a 09 09 09 09 20 2a 20 62 65 67 ts to..... * beg
11530 69 6e 6e 69 6e 67 20 6f 66 20 72 65 67 69 6f 6e inning of region
11540 20 77 68 65 72 65 20 74 68 65 20 65 72 72 6f 72 where the error
11550 0a 09 09 09 09 20 2a 20 6f 63 63 75 72 72 65 64 ..... * occurred
11560 20 28 65 2e 67 2e 20 74 68 65 20 6f 70 65 6e 20 (e.g. the open
11570 62 72 61 63 65 20 69 66 20 74 68 65 20 63 6c 6f brace if the clo
11580 73 65 0a 09 09 09 09 20 2a 20 62 72 61 63 65 20 se..... * brace
11590 69 73 20 6d 69 73 73 69 6e 67 29 2e 20 2a 2f 0a is missing). */.
115a0 20 20 20 20 54 63 6c 5f 54 6f 6b 65 6e 20 73 74 Tcl_Token st
115b0 61 74 69 63 54 6f 6b 65 6e 73 5b 4e 55 4d 5f 53 aticTokens[NUM_S
115c0 54 41 54 49 43 5f 54 4f 4b 45 4e 53 5d 3b 0a 09 TATIC_TOKENS];..
115d0 09 09 09 2f 2a 20 49 6e 69 74 69 61 6c 20 73 70 .../* Initial sp
115e0 61 63 65 20 66 6f 72 20 74 6f 6b 65 6e 73 20 66 ace for tokens f
115f0 6f 72 20 63 6f 6d 6d 61 6e 64 2e 20 54 68 69 73 or command. This
11600 0a 09 09 09 09 20 2a 20 73 70 61 63 65 20 73 68 ..... * space sh
11610 6f 75 6c 64 20 62 65 20 6c 61 72 67 65 20 65 6e ould be large en
11620 6f 75 67 68 20 74 6f 20 61 63 63 6f 6d 6d 6f 64 ough to accommod
11630 61 74 65 0a 09 09 09 09 20 2a 20 6d 6f 73 74 20 ate..... * most
11640 63 6f 6d 6d 61 6e 64 73 3b 20 64 79 6e 61 6d 69 commands; dynami
11650 63 20 73 70 61 63 65 20 69 73 20 61 6c 6c 6f 63 c space is alloc
11660 61 74 65 64 0a 09 09 09 09 20 2a 20 66 6f 72 20 ated..... * for
11670 76 65 72 79 20 6c 61 72 67 65 20 63 6f 6d 6d 61 very large comma
11680 6e 64 73 20 74 68 61 74 20 64 6f 6e 27 74 20 66 nds that don't f
11690 69 74 0a 09 09 09 09 20 2a 20 68 65 72 65 2e 20 it..... * here.
116a0 2a 2f 0a 7d 20 54 63 6c 5f 50 61 72 73 65 3b 0a */.} Tcl_Parse;.
116b0 0c 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d ../*. *---------
116c0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
116d0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
116e0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
116f0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
11700 2d 2d 2d 0a 20 2a 20 54 68 65 20 66 6f 6c 6c 6f ---. * The follo
11710 77 69 6e 67 20 73 74 72 75 63 74 75 72 65 20 72 wing structure r
11720 65 70 72 65 73 65 6e 74 73 20 61 20 75 73 65 72 epresents a user
11730 2d 64 65 66 69 6e 65 64 20 65 6e 63 6f 64 69 6e -defined encodin
11740 67 2e 20 49 74 20 63 6f 6c 6c 65 63 74 73 0a 20 g. It collects.
11750 2a 20 74 6f 67 65 74 68 65 72 20 61 6c 6c 20 74 * together all t
11760 68 65 20 66 75 6e 63 74 69 6f 6e 73 20 74 68 61 he functions tha
11770 74 20 61 72 65 20 75 73 65 64 20 62 79 20 74 68 t are used by th
11780 65 20 73 70 65 63 69 66 69 63 20 65 6e 63 6f 64 e specific encod
11790 69 6e 67 2e 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 ing.. */..typede
117a0 66 20 73 74 72 75 63 74 20 54 63 6c 5f 45 6e 63 f struct Tcl_Enc
117b0 6f 64 69 6e 67 54 79 70 65 20 7b 0a 20 20 20 20 odingType {.
117c0 63 6f 6e 73 74 20 63 68 61 72 20 2a 65 6e 63 6f const char *enco
117d0 64 69 6e 67 4e 61 6d 65 3b 09 2f 2a 20 54 68 65 dingName;./* The
117e0 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 65 6e 63 name of the enc
117f0 6f 64 69 6e 67 2c 20 65 2e 67 2e 20 22 65 75 63 oding, e.g. "euc
11800 2d 6a 70 22 2e 0a 09 09 09 09 20 2a 20 54 68 69 -jp"...... * Thi
11810 73 20 6e 61 6d 65 20 69 73 20 74 68 65 20 75 6e s name is the un
11820 69 71 75 65 20 6b 65 79 20 66 6f 72 20 74 68 69 ique key for thi
11830 73 0a 09 09 09 09 20 2a 20 65 6e 63 6f 64 69 6e s..... * encodin
11840 67 20 74 79 70 65 2e 20 2a 2f 0a 20 20 20 20 54 g type. */. T
11850 63 6c 5f 45 6e 63 6f 64 69 6e 67 43 6f 6e 76 65 cl_EncodingConve
11860 72 74 50 72 6f 63 20 2a 74 6f 55 74 66 50 72 6f rtProc *toUtfPro
11870 63 3b 0a 09 09 09 09 2f 2a 20 46 75 6e 63 74 69 c;...../* Functi
11880 6f 6e 20 74 6f 20 63 6f 6e 76 65 72 74 20 66 72 on to convert fr
11890 6f 6d 20 65 78 74 65 72 6e 61 6c 20 65 6e 63 6f om external enco
118a0 64 69 6e 67 0a 09 09 09 09 20 2a 20 69 6e 74 6f ding..... * into
118b0 20 55 54 46 2d 38 2e 20 2a 2f 0a 20 20 20 20 54 UTF-8. */. T
118c0 63 6c 5f 45 6e 63 6f 64 69 6e 67 43 6f 6e 76 65 cl_EncodingConve
118d0 72 74 50 72 6f 63 20 2a 66 72 6f 6d 55 74 66 50 rtProc *fromUtfP
118e0 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 46 75 6e 63 roc;...../* Func
118f0 74 69 6f 6e 20 74 6f 20 63 6f 6e 76 65 72 74 20 tion to convert
11900 66 72 6f 6d 20 55 54 46 2d 38 20 69 6e 74 6f 0a from UTF-8 into.
11910 09 09 09 09 20 2a 20 65 78 74 65 72 6e 61 6c 20 .... * external
11920 65 6e 63 6f 64 69 6e 67 2e 20 2a 2f 0a 20 20 20 encoding. */.
11930 20 54 63 6c 5f 46 72 65 65 50 72 6f 63 20 2a 66 Tcl_FreeProc *f
11940 72 65 65 50 72 6f 63 3b 09 2f 2a 20 49 66 20 6e reeProc;./* If n
11950 6f 6e 2d 4e 55 4c 4c 2c 20 66 75 6e 63 74 69 6f on-NULL, functio
11960 6e 20 74 6f 20 63 61 6c 6c 20 77 68 65 6e 20 74 n to call when t
11970 68 69 73 0a 09 09 09 09 20 2a 20 65 6e 63 6f 64 his..... * encod
11980 69 6e 67 20 69 73 20 64 65 6c 65 74 65 64 2e 20 ing is deleted.
11990 2a 2f 0a 20 20 20 20 76 6f 69 64 20 2a 63 6c 69 */. void *cli
119a0 65 6e 74 44 61 74 61 3b 09 09 2f 2a 20 41 72 62 entData;../* Arb
119b0 69 74 72 61 72 79 20 76 61 6c 75 65 20 61 73 73 itrary value ass
119c0 6f 63 69 61 74 65 64 20 77 69 74 68 20 65 6e 63 ociated with enc
119d0 6f 64 69 6e 67 0a 09 09 09 09 20 2a 20 74 79 70 oding..... * typ
119e0 65 2e 20 50 61 73 73 65 64 20 74 6f 20 63 6f 6e e. Passed to con
119f0 76 65 72 73 69 6f 6e 20 66 75 6e 63 74 69 6f 6e version function
11a00 73 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 53 69 s. */. Tcl_Si
11a10 7a 65 20 6e 75 6c 6c 53 69 7a 65 3b 09 09 2f 2a ze nullSize;../*
11a20 20 4e 75 6d 62 65 72 20 6f 66 20 7a 65 72 6f 20 Number of zero
11a30 62 79 74 65 73 20 74 68 61 74 20 73 69 67 6e 69 bytes that signi
11a40 66 79 0a 09 09 09 09 20 2a 20 65 6e 64 2d 6f 66 fy..... * end-of
11a50 2d 73 74 72 69 6e 67 20 69 6e 20 74 68 69 73 20 -string in this
11a60 65 6e 63 6f 64 69 6e 67 2e 20 54 68 69 73 20 6e encoding. This n
11a70 75 6d 62 65 72 0a 09 09 09 09 20 2a 20 69 73 20 umber..... * is
11a80 75 73 65 64 20 74 6f 20 64 65 74 65 72 6d 69 6e used to determin
11a90 65 20 74 68 65 20 73 6f 75 72 63 65 20 73 74 72 e the source str
11aa0 69 6e 67 0a 09 09 09 09 20 2a 20 6c 65 6e 67 74 ing..... * lengt
11ab0 68 20 77 68 65 6e 20 74 68 65 20 73 72 63 4c 65 h when the srcLe
11ac0 6e 20 61 72 67 75 6d 65 6e 74 20 69 73 0a 09 09 n argument is...
11ad0 09 09 20 2a 20 6e 65 67 61 74 69 76 65 2e 20 4d .. * negative. M
11ae0 75 73 74 20 62 65 20 31 2c 20 32 2c 20 6f 72 20 ust be 1, 2, or
11af0 34 2e 20 2a 2f 0a 7d 20 54 63 6c 5f 45 6e 63 6f 4. */.} Tcl_Enco
11b00 64 69 6e 67 54 79 70 65 3b 0a 0a 2f 2a 0a 20 2a dingType;../*. *
11b10 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 64 The following d
11b20 65 66 69 6e 69 74 69 6f 6e 73 20 61 72 65 20 75 efinitions are u
11b30 73 65 64 20 61 73 20 76 61 6c 75 65 73 20 66 6f sed as values fo
11b40 72 20 74 68 65 20 63 6f 6e 76 65 72 73 69 6f 6e r the conversion
11b50 20 63 6f 6e 74 72 6f 6c 0a 20 2a 20 66 6c 61 67 control. * flag
11b60 73 20 61 72 67 75 6d 65 6e 74 20 77 68 65 6e 20 s argument when
11b70 63 6f 6e 76 65 72 74 69 6e 67 20 74 65 78 74 20 converting text
11b80 66 72 6f 6d 20 6f 6e 65 20 63 68 61 72 61 63 74 from one charact
11b90 65 72 20 73 65 74 20 74 6f 20 61 6e 6f 74 68 65 er set to anothe
11ba0 72 3a 0a 20 2a 0a 20 2a 20 54 43 4c 5f 45 4e 43 r:. *. * TCL_ENC
11bb0 4f 44 49 4e 47 5f 53 54 41 52 54 20 2d 09 09 53 ODING_START -..S
11bc0 69 67 6e 69 66 69 65 73 20 74 68 61 74 20 74 68 ignifies that th
11bd0 65 20 73 6f 75 72 63 65 20 62 75 66 66 65 72 20 e source buffer
11be0 69 73 20 74 68 65 20 66 69 72 73 74 0a 20 2a 09 is the first. *.
11bf0 09 09 09 62 6c 6f 63 6b 20 69 6e 20 61 20 28 70 ...block in a (p
11c00 6f 74 65 6e 74 69 61 6c 6c 79 20 6d 75 6c 74 69 otentially multi
11c10 2d 62 6c 6f 63 6b 29 20 69 6e 70 75 74 0a 20 2a -block) input. *
11c20 09 09 09 09 73 74 72 65 61 6d 2e 20 54 65 6c 6c ....stream. Tell
11c30 73 20 74 68 65 20 63 6f 6e 76 65 72 73 69 6f 6e s the conversion
11c40 20 66 75 6e 63 74 69 6f 6e 20 74 6f 20 72 65 73 function to res
11c50 65 74 0a 20 2a 09 09 09 09 74 6f 20 61 6e 20 69 et. *....to an i
11c60 6e 69 74 69 61 6c 20 73 74 61 74 65 20 61 6e 64 nitial state and
11c70 20 70 65 72 66 6f 72 6d 20 61 6e 79 0a 20 2a 09 perform any. *.
11c80 09 09 09 69 6e 69 74 69 61 6c 69 7a 61 74 69 6f ...initializatio
11c90 6e 20 74 68 61 74 20 6e 65 65 64 73 20 74 6f 20 n that needs to
11ca0 6f 63 63 75 72 20 62 65 66 6f 72 65 20 74 68 65 occur before the
11cb0 0a 20 2a 09 09 09 09 66 69 72 73 74 20 62 79 74 . *....first byt
11cc0 65 20 69 73 20 63 6f 6e 76 65 72 74 65 64 2e 20 e is converted.
11cd0 49 66 20 74 68 65 20 73 6f 75 72 63 65 20 62 75 If the source bu
11ce0 66 66 65 72 0a 20 2a 09 09 09 09 63 6f 6e 74 61 ffer. *....conta
11cf0 69 6e 73 20 74 68 65 20 65 6e 74 69 72 65 20 69 ins the entire i
11d00 6e 70 75 74 20 73 74 72 65 61 6d 20 74 6f 20 62 nput stream to b
11d10 65 0a 20 2a 09 09 09 09 63 6f 6e 76 65 72 74 65 e. *....converte
11d20 64 2c 20 74 68 69 73 20 66 6c 61 67 20 73 68 6f d, this flag sho
11d30 75 6c 64 20 62 65 20 73 65 74 2e 0a 20 2a 20 54 uld be set.. * T
11d40 43 4c 5f 45 4e 43 4f 44 49 4e 47 5f 45 4e 44 20 CL_ENCODING_END
11d50 2d 09 09 53 69 67 6e 69 66 69 65 73 20 74 68 61 -..Signifies tha
11d60 74 20 74 68 65 20 73 6f 75 72 63 65 20 62 75 66 t the source buf
11d70 66 65 72 20 69 73 20 74 68 65 20 6c 61 73 74 0a fer is the last.
11d80 20 2a 09 09 09 09 62 6c 6f 63 6b 20 69 6e 20 61 *....block in a
11d90 20 28 70 6f 74 65 6e 74 69 61 6c 6c 79 20 6d 75 (potentially mu
11da0 6c 74 69 2d 62 6c 6f 63 6b 29 20 69 6e 70 75 74 lti-block) input
11db0 0a 20 2a 09 09 09 09 73 74 72 65 61 6d 2e 20 54 . *....stream. T
11dc0 65 6c 6c 73 20 74 68 65 20 63 6f 6e 76 65 72 73 ells the convers
11dd0 69 6f 6e 20 72 6f 75 74 69 6e 65 20 74 6f 0a 20 ion routine to.
11de0 2a 09 09 09 09 70 65 72 66 6f 72 6d 20 61 6e 79 *....perform any
11df0 20 66 69 6e 61 6c 69 7a 61 74 69 6f 6e 20 74 68 finalization th
11e00 61 74 20 6e 65 65 64 73 20 74 6f 20 6f 63 63 75 at needs to occu
11e10 72 0a 20 2a 09 09 09 09 61 66 74 65 72 20 74 68 r. *....after th
11e20 65 20 6c 61 73 74 20 62 79 74 65 20 69 73 20 63 e last byte is c
11e30 6f 6e 76 65 72 74 65 64 20 61 6e 64 20 74 68 65 onverted and the
11e40 6e 20 74 6f 0a 20 2a 09 09 09 09 72 65 73 65 74 n to. *....reset
11e50 20 74 6f 20 61 6e 20 69 6e 69 74 69 61 6c 20 73 to an initial s
11e60 74 61 74 65 2e 20 49 66 20 74 68 65 20 73 6f 75 tate. If the sou
11e70 72 63 65 0a 20 2a 09 09 09 09 62 75 66 66 65 72 rce. *....buffer
11e80 20 63 6f 6e 74 61 69 6e 73 20 74 68 65 20 65 6e contains the en
11e90 74 69 72 65 20 69 6e 70 75 74 20 73 74 72 65 61 tire input strea
11ea0 6d 20 74 6f 20 62 65 0a 20 2a 09 09 09 09 63 6f m to be. *....co
11eb0 6e 76 65 72 74 65 64 2c 20 74 68 69 73 20 66 6c nverted, this fl
11ec0 61 67 20 73 68 6f 75 6c 64 20 62 65 20 73 65 74 ag should be set
11ed0 2e 0a 20 2a 20 54 43 4c 5f 45 4e 43 4f 44 49 4e .. * TCL_ENCODIN
11ee0 47 5f 53 54 4f 50 4f 4e 45 52 52 4f 52 20 2d 09 G_STOPONERROR -.
11ef0 4e 6f 74 20 75 73 65 64 20 61 6e 79 20 6d 6f 72 Not used any mor
11f00 65 2e 0a 20 2a 20 54 43 4c 5f 45 4e 43 4f 44 49 e.. * TCL_ENCODI
11f10 4e 47 5f 4e 4f 5f 54 45 52 4d 49 4e 41 54 45 20 NG_NO_TERMINATE
11f20 2d 09 49 66 20 73 65 74 2c 20 54 63 6c 5f 45 78 -.If set, Tcl_Ex
11f30 74 65 72 6e 61 6c 54 6f 55 74 66 20 64 6f 65 73 ternalToUtf does
11f40 20 6e 6f 74 20 61 70 70 65 6e 64 20 61 0a 20 2a not append a. *
11f50 09 09 09 09 74 65 72 6d 69 6e 61 74 69 6e 67 20 ....terminating
11f60 4e 55 4c 20 62 79 74 65 2e 20 20 53 69 6e 63 65 NUL byte. Since
11f70 20 69 74 20 64 6f 65 73 20 6e 6f 74 20 6e 65 65 it does not nee
11f80 64 0a 20 2a 09 09 09 09 61 6e 20 65 78 74 72 61 d. *....an extra
11f90 20 62 79 74 65 20 66 6f 72 20 61 20 74 65 72 6d byte for a term
11fa0 69 6e 61 74 69 6e 67 20 4e 55 4c 2c 20 69 74 20 inating NUL, it
11fb0 66 69 6c 6c 73 0a 20 2a 09 09 09 09 61 6c 6c 20 fills. *....all
11fc0 64 73 74 4c 65 6e 20 62 79 74 65 73 20 77 69 74 dstLen bytes wit
11fd0 68 20 65 6e 63 6f 64 65 64 20 55 54 46 2d 38 20 h encoded UTF-8
11fe0 63 6f 6e 74 65 6e 74 20 69 66 0a 20 2a 09 09 09 content if. *...
11ff0 09 6e 65 65 64 65 64 2e 20 20 49 66 20 63 6c 65 .needed. If cle
12000 61 72 2c 20 61 20 62 79 74 65 20 69 73 20 72 65 ar, a byte is re
12010 73 65 72 76 65 64 20 69 6e 20 74 68 65 0a 20 2a served in the. *
12020 09 09 09 09 64 73 74 20 73 70 61 63 65 20 66 6f ....dst space fo
12030 72 20 4e 55 4c 20 74 65 72 6d 69 6e 61 74 69 6f r NUL terminatio
12040 6e 2c 20 61 6e 64 20 61 0a 20 2a 09 09 09 09 74 n, and a. *....t
12050 65 72 6d 69 6e 61 74 69 6e 67 20 4e 55 4c 20 69 erminating NUL i
12060 73 20 61 70 70 65 6e 64 65 64 2e 0a 20 2a 20 54 s appended.. * T
12070 43 4c 5f 45 4e 43 4f 44 49 4e 47 5f 43 48 41 52 CL_ENCODING_CHAR
12080 5f 4c 49 4d 49 54 20 2d 09 49 66 20 73 65 74 20 _LIMIT -.If set
12090 61 6e 64 20 64 73 74 43 68 61 72 73 50 74 72 20 and dstCharsPtr
120a0 69 73 20 6e 6f 74 20 4e 55 4c 4c 2c 20 74 68 65 is not NULL, the
120b0 6e 0a 20 2a 09 09 09 09 54 63 6c 5f 45 78 74 65 n. *....Tcl_Exte
120c0 72 6e 61 6c 54 6f 55 74 66 20 74 61 6b 65 73 20 rnalToUtf takes
120d0 74 68 65 20 69 6e 69 74 69 61 6c 20 76 61 6c 75 the initial valu
120e0 65 20 6f 66 0a 20 2a 09 09 09 09 2a 64 73 74 43 e of. *....*dstC
120f0 68 61 72 73 50 74 72 20 61 73 20 61 20 6c 69 6d harsPtr as a lim
12100 69 74 20 6f 66 20 74 68 65 20 6d 61 78 69 6d 75 it of the maximu
12110 6d 20 6e 75 6d 62 65 72 0a 20 2a 09 09 09 09 6f m number. *....o
12120 66 20 63 68 61 72 73 20 74 6f 20 70 72 6f 64 75 f chars to produ
12130 63 65 20 69 6e 20 74 68 65 20 65 6e 63 6f 64 65 ce in the encode
12140 64 20 55 54 46 2d 38 0a 20 2a 09 09 09 09 63 6f d UTF-8. *....co
12150 6e 74 65 6e 74 2e 20 20 4f 74 68 65 72 77 69 73 ntent. Otherwis
12160 65 2c 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 e, the number of
12170 20 63 68 61 72 73 0a 20 2a 09 09 09 09 70 72 6f chars. *....pro
12180 64 75 63 65 64 20 69 73 20 63 6f 6e 74 72 6f 6c duced is control
12190 6c 65 64 20 6f 6e 6c 79 20 62 79 20 6f 74 68 65 led only by othe
121a0 72 20 6c 69 6d 69 74 69 6e 67 0a 20 2a 09 09 09 r limiting. *...
121b0 09 66 61 63 74 6f 72 73 2e 0a 20 2a 20 54 43 4c .factors.. * TCL
121c0 5f 45 4e 43 4f 44 49 4e 47 5f 50 52 4f 46 49 4c _ENCODING_PROFIL
121d0 45 5f 2a 20 2d 09 4d 75 74 75 61 6c 6c 79 20 65 E_* -.Mutually e
121e0 78 63 6c 75 73 69 76 65 20 65 6e 63 6f 64 69 6e xclusive encodin
121f0 67 20 70 72 6f 66 69 6c 65 20 69 64 73 2e 20 4e g profile ids. N
12200 6f 74 65 0a 20 2a 09 09 09 09 74 68 65 73 65 20 ote. *....these
12210 61 72 65 20 62 69 74 20 6d 61 73 6b 73 2e 0a 20 are bit masks..
12220 2a 0a 20 2a 20 4e 4f 54 45 3a 20 54 48 45 53 45 *. * NOTE: THESE
12230 20 42 49 54 20 44 45 46 49 4e 49 54 49 4f 4e 53 BIT DEFINITIONS
12240 20 53 48 4f 55 4c 44 20 4e 4f 54 20 4f 56 45 52 SHOULD NOT OVER
12250 4c 41 50 20 57 49 54 48 20 49 4e 54 45 52 4e 41 LAP WITH INTERNA
12260 4c 20 55 53 45 20 42 49 54 53 0a 20 2a 20 44 45 L USE BITS. * DE
12270 46 49 4e 45 44 20 49 4e 20 74 63 6c 45 6e 63 6f FINED IN tclEnco
12280 64 69 6e 67 2e 63 20 28 45 4e 43 4f 44 49 4e 47 ding.c (ENCODING
12290 5f 49 4e 50 55 54 20 65 74 20 61 6c 29 2e 20 42 _INPUT et al). B
122a0 65 20 63 6f 67 6e 69 7a 61 6e 74 20 6f 66 20 74 e cognizant of t
122b0 68 69 73 0a 20 2a 20 77 68 65 6e 20 61 64 64 69 his. * when addi
122c0 6e 67 20 62 69 74 73 2e 0a 20 2a 2f 0a 0a 23 64 ng bits.. */..#d
122d0 65 66 69 6e 65 20 54 43 4c 5f 45 4e 43 4f 44 49 efine TCL_ENCODI
122e0 4e 47 5f 53 54 41 52 54 09 09 30 78 30 31 0a 23 NG_START..0x01.#
122f0 64 65 66 69 6e 65 20 54 43 4c 5f 45 4e 43 4f 44 define TCL_ENCOD
12300 49 4e 47 5f 45 4e 44 09 09 30 78 30 32 0a 23 64 ING_END..0x02.#d
12310 65 66 69 6e 65 20 54 43 4c 5f 45 4e 43 4f 44 49 efine TCL_ENCODI
12320 4e 47 5f 53 54 4f 50 4f 4e 45 52 52 4f 52 09 30 NG_STOPONERROR.0
12330 78 30 20 2f 2a 20 4e 6f 74 20 75 73 65 64 20 61 x0 /* Not used a
12340 6e 79 20 6d 6f 72 65 20 2a 2f 0a 23 64 65 66 69 ny more */.#defi
12350 6e 65 20 54 43 4c 5f 45 4e 43 4f 44 49 4e 47 5f ne TCL_ENCODING_
12360 4e 4f 5f 54 45 52 4d 49 4e 41 54 45 09 30 78 30 NO_TERMINATE.0x0
12370 38 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 45 4e 8.#define TCL_EN
12380 43 4f 44 49 4e 47 5f 43 48 41 52 5f 4c 49 4d 49 CODING_CHAR_LIMI
12390 54 09 09 30 78 31 30 0a 2f 2a 20 49 6e 74 65 72 T..0x10./* Inter
123a0 6e 61 6c 20 75 73 65 20 62 69 74 73 2c 20 64 6f nal use bits, do
123b0 20 6e 6f 74 20 64 65 66 69 6e 65 20 62 69 74 73 not define bits
123c0 20 69 6e 20 74 68 69 73 20 73 70 61 63 65 2e 20 in this space.
123d0 53 65 65 20 61 62 6f 76 65 20 63 6f 6d 6d 65 6e See above commen
123e0 74 20 2a 2f 0a 23 64 65 66 69 6e 65 20 54 43 4c t */.#define TCL
123f0 5f 45 4e 43 4f 44 49 4e 47 5f 49 4e 54 45 52 4e _ENCODING_INTERN
12400 41 4c 5f 55 53 45 5f 4d 41 53 4b 20 20 30 78 46 AL_USE_MASK 0xF
12410 46 30 30 0a 2f 2a 0a 20 2a 20 52 65 73 65 72 76 F00./*. * Reserv
12420 65 20 74 6f 70 20 62 79 74 65 20 66 6f 72 20 70 e top byte for p
12430 72 6f 66 69 6c 65 20 76 61 6c 75 65 73 20 28 64 rofile values (d
12440 69 73 6a 6f 69 6e 74 2c 20 6e 6f 74 20 61 20 6d isjoint, not a m
12450 61 73 6b 29 2e 20 49 6e 20 63 61 73 65 20 6f 66 ask). In case of
12460 0a 20 2a 20 63 68 61 6e 67 65 73 2c 20 65 6e 73 . * changes, ens
12470 75 72 65 20 45 4e 43 4f 44 49 4e 47 5f 50 52 4f ure ENCODING_PRO
12480 46 49 4c 45 5f 2a 20 6d 61 63 72 6f 73 20 69 6e FILE_* macros in
12490 20 74 63 6c 49 6e 74 2e 68 20 61 72 65 20 6d 6f tclInt.h are mo
124a0 64 69 66 69 65 64 20 69 66 0a 20 2a 20 6e 65 63 dified if. * nec
124b0 65 73 73 61 72 79 2e 0a 20 2a 2f 0a 23 64 65 66 essary.. */.#def
124c0 69 6e 65 20 54 43 4c 5f 45 4e 43 4f 44 49 4e 47 ine TCL_ENCODING
124d0 5f 50 52 4f 46 49 4c 45 5f 53 54 52 49 43 54 20 _PROFILE_STRICT
124e0 20 20 30 78 30 30 30 30 30 30 30 30 0a 23 64 65 0x00000000.#de
124f0 66 69 6e 65 20 54 43 4c 5f 45 4e 43 4f 44 49 4e fine TCL_ENCODIN
12500 47 5f 50 52 4f 46 49 4c 45 5f 54 43 4c 38 20 20 G_PROFILE_TCL8
12510 20 20 20 30 78 30 31 30 30 30 30 30 30 0a 23 64 0x01000000.#d
12520 65 66 69 6e 65 20 54 43 4c 5f 45 4e 43 4f 44 49 efine TCL_ENCODI
12530 4e 47 5f 50 52 4f 46 49 4c 45 5f 52 45 50 4c 41 NG_PROFILE_REPLA
12540 43 45 20 20 30 78 30 32 30 30 30 30 30 30 0a 0a CE 0x02000000..
12550 2f 2a 0a 20 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 /*. * The follow
12560 69 6e 67 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 ing definitions
12570 61 72 65 20 74 68 65 20 65 72 72 6f 72 20 63 6f are the error co
12580 64 65 73 20 72 65 74 75 72 6e 65 64 20 62 79 20 des returned by
12590 74 68 65 20 63 6f 6e 76 65 72 73 69 6f 6e 0a 20 the conversion.
125a0 2a 20 72 6f 75 74 69 6e 65 73 3a 0a 20 2a 0a 20 * routines:. *.
125b0 2a 20 54 43 4c 5f 4f 4b 20 2d 09 09 09 41 6c 6c * TCL_OK -...All
125c0 20 63 68 61 72 61 63 74 65 72 73 20 77 65 72 65 characters were
125d0 20 63 6f 6e 76 65 72 74 65 64 2e 0a 20 2a 20 54 converted.. * T
125e0 43 4c 5f 43 4f 4e 56 45 52 54 5f 4e 4f 53 50 41 CL_CONVERT_NOSPA
125f0 43 45 20 2d 09 54 68 65 20 6f 75 74 70 75 74 20 CE -.The output
12600 62 75 66 66 65 72 20 77 6f 75 6c 64 20 6e 6f 74 buffer would not
12610 20 68 61 76 65 20 62 65 65 6e 20 6c 61 72 67 65 have been large
12620 0a 20 2a 09 09 09 09 65 6e 6f 75 67 68 20 66 6f . *....enough fo
12630 72 20 61 6c 6c 20 6f 66 20 74 68 65 20 63 6f 6e r all of the con
12640 76 65 72 74 65 64 20 64 61 74 61 3b 20 61 73 20 verted data; as
12650 6d 61 6e 79 0a 20 2a 09 09 09 09 63 68 61 72 61 many. *....chara
12660 63 74 65 72 73 20 61 73 20 63 6f 75 6c 64 20 66 cters as could f
12670 69 74 20 77 65 72 65 20 63 6f 6e 76 65 72 74 65 it were converte
12680 64 20 74 68 6f 75 67 68 2e 0a 20 2a 20 54 43 4c d though.. * TCL
12690 5f 43 4f 4e 56 45 52 54 5f 4d 55 4c 54 49 42 59 _CONVERT_MULTIBY
126a0 54 45 20 2d 09 54 68 65 20 6c 61 73 74 20 66 65 TE -.The last fe
126b0 77 20 62 79 74 65 73 20 69 6e 20 74 68 65 20 73 w bytes in the s
126c0 6f 75 72 63 65 20 73 74 72 69 6e 67 20 77 65 72 ource string wer
126d0 65 0a 20 2a 09 09 09 09 74 68 65 20 62 65 67 69 e. *....the begi
126e0 6e 6e 69 6e 67 20 6f 66 20 61 20 6d 75 6c 74 69 nning of a multi
126f0 62 79 74 65 20 73 65 71 75 65 6e 63 65 2c 20 62 byte sequence, b
12700 75 74 0a 20 2a 09 09 09 09 6d 6f 72 65 20 62 79 ut. *....more by
12710 74 65 73 20 77 65 72 65 20 6e 65 65 64 65 64 20 tes were needed
12720 74 6f 20 63 6f 6d 70 6c 65 74 65 20 74 68 69 73 to complete this
12730 0a 20 2a 09 09 09 09 73 65 71 75 65 6e 63 65 2e . *....sequence.
12740 20 41 20 73 75 62 73 65 71 75 65 6e 74 20 63 61 A subsequent ca
12750 6c 6c 20 74 6f 20 74 68 65 20 63 6f 6e 76 65 72 ll to the conver
12760 73 69 6f 6e 0a 20 2a 09 09 09 09 72 6f 75 74 69 sion. *....routi
12770 6e 65 20 73 68 6f 75 6c 64 20 70 61 73 73 20 74 ne should pass t
12780 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 20 he beginning of
12790 74 68 69 73 0a 20 2a 09 09 09 09 75 6e 63 6f 6e this. *....uncon
127a0 76 65 72 74 65 64 20 73 65 71 75 65 6e 63 65 20 verted sequence
127b0 70 6c 75 73 20 61 64 64 69 74 69 6f 6e 61 6c 20 plus additional
127c0 62 79 74 65 73 0a 20 2a 09 09 09 09 66 72 6f 6d bytes. *....from
127d0 20 74 68 65 20 73 6f 75 72 63 65 20 73 74 72 65 the source stre
127e0 61 6d 20 74 6f 20 70 72 6f 70 65 72 6c 79 20 63 am to properly c
127f0 6f 6e 76 65 72 74 20 74 68 65 0a 20 2a 09 09 09 onvert the. *...
12800 09 66 6f 72 6d 65 72 6c 79 20 73 70 6c 69 74 2d .formerly split-
12810 75 70 20 6d 75 6c 74 69 62 79 74 65 20 73 65 71 up multibyte seq
12820 75 65 6e 63 65 2e 0a 20 2a 20 54 43 4c 5f 43 4f uence.. * TCL_CO
12830 4e 56 45 52 54 5f 53 59 4e 54 41 58 20 2d 09 09 NVERT_SYNTAX -..
12840 54 68 65 20 73 6f 75 72 63 65 20 73 74 72 65 61 The source strea
12850 6d 20 63 6f 6e 74 61 69 6e 65 64 20 61 6e 20 69 m contained an i
12860 6e 76 61 6c 69 64 0a 20 2a 09 09 09 09 63 68 61 nvalid. *....cha
12870 72 61 63 74 65 72 20 73 65 71 75 65 6e 63 65 2e racter sequence.
12880 20 54 68 69 73 20 6d 61 79 20 6f 63 63 75 72 20 This may occur
12890 69 66 20 74 68 65 0a 20 2a 09 09 09 09 69 6e 70 if the. *....inp
128a0 75 74 20 73 74 72 65 61 6d 20 68 61 73 20 62 65 ut stream has be
128b0 65 6e 20 64 61 6d 61 67 65 64 20 6f 72 20 69 66 en damaged or if
128c0 20 74 68 65 20 69 6e 70 75 74 0a 20 2a 09 09 09 the input. *...
128d0 09 65 6e 63 6f 64 69 6e 67 20 6d 65 74 68 6f 64 .encoding method
128e0 20 77 61 73 20 6d 69 73 69 64 65 6e 74 69 66 69 was misidentifi
128f0 65 64 2e 0a 20 2a 20 54 43 4c 5f 43 4f 4e 56 45 ed.. * TCL_CONVE
12900 52 54 5f 55 4e 4b 4e 4f 57 4e 20 2d 09 54 68 65 RT_UNKNOWN -.The
12910 20 73 6f 75 72 63 65 20 73 74 72 69 6e 67 20 63 source string c
12920 6f 6e 74 61 69 6e 65 64 20 61 20 63 68 61 72 61 ontained a chara
12930 63 74 65 72 20 74 68 61 74 0a 20 2a 09 09 09 09 cter that. *....
12940 63 6f 75 6c 64 20 6e 6f 74 20 62 65 20 72 65 70 could not be rep
12950 72 65 73 65 6e 74 65 64 20 69 6e 20 74 68 65 20 resented in the
12960 74 61 72 67 65 74 0a 20 2a 09 09 09 09 65 6e 63 target. *....enc
12970 6f 64 69 6e 67 2e 0a 20 2a 2f 0a 0a 23 64 65 66 oding.. */..#def
12980 69 6e 65 20 54 43 4c 5f 43 4f 4e 56 45 52 54 5f ine TCL_CONVERT_
12990 4d 55 4c 54 49 42 59 54 45 09 28 2d 31 29 0a 23 MULTIBYTE.(-1).#
129a0 64 65 66 69 6e 65 20 54 43 4c 5f 43 4f 4e 56 45 define TCL_CONVE
129b0 52 54 5f 53 59 4e 54 41 58 09 28 2d 32 29 0a 23 RT_SYNTAX.(-2).#
129c0 64 65 66 69 6e 65 20 54 43 4c 5f 43 4f 4e 56 45 define TCL_CONVE
129d0 52 54 5f 55 4e 4b 4e 4f 57 4e 09 28 2d 33 29 0a RT_UNKNOWN.(-3).
129e0 23 64 65 66 69 6e 65 20 54 43 4c 5f 43 4f 4e 56 #define TCL_CONV
129f0 45 52 54 5f 4e 4f 53 50 41 43 45 09 28 2d 34 29 ERT_NOSPACE.(-4)
12a00 0a 0a 2f 2a 0a 20 2a 20 54 68 65 20 6d 61 78 69 ../*. * The maxi
12a10 6d 75 6d 20 6e 75 6d 62 65 72 20 6f 66 20 62 79 mum number of by
12a20 74 65 73 20 74 68 61 74 20 61 72 65 20 6e 65 63 tes that are nec
12a30 65 73 73 61 72 79 20 74 6f 20 72 65 70 72 65 73 essary to repres
12a40 65 6e 74 20 61 20 73 69 6e 67 6c 65 0a 20 2a 20 ent a single. *
12a50 55 6e 69 63 6f 64 65 20 63 68 61 72 61 63 74 65 Unicode characte
12a60 72 20 69 6e 20 55 54 46 2d 38 2e 20 54 68 65 20 r in UTF-8. The
12a70 76 61 6c 69 64 20 76 61 6c 75 65 73 20 61 72 65 valid values are
12a80 20 33 20 61 6e 64 20 34 2e 20 49 66 20 3e 20 33 3 and 4. If > 3
12a90 2c 0a 20 2a 20 74 68 65 6e 20 54 63 6c 5f 55 6e ,. * then Tcl_Un
12aa0 69 43 68 61 72 20 6d 75 73 74 20 62 65 20 34 2d iChar must be 4-
12ab0 62 79 74 65 73 20 69 6e 20 73 69 7a 65 20 28 55 bytes in size (U
12ac0 43 53 2d 34 29 20 28 74 68 65 20 64 65 66 61 75 CS-4) (the defau
12ad0 6c 74 29 2e 20 49 66 20 3d 3d 20 33 2c 0a 20 2a lt). If == 3,. *
12ae0 20 74 68 65 6e 20 54 63 6c 5f 55 6e 69 43 68 61 then Tcl_UniCha
12af0 72 20 6d 75 73 74 20 62 65 20 32 2d 62 79 74 65 r must be 2-byte
12b00 73 20 69 6e 20 73 69 7a 65 20 28 55 54 46 2d 31 s in size (UTF-1
12b10 36 29 2e 20 53 69 6e 63 65 20 54 63 6c 20 39 2e 6). Since Tcl 9.
12b20 30 2c 20 55 43 53 2d 34 0a 20 2a 20 6d 6f 64 65 0, UCS-4. * mode
12b30 20 69 73 20 74 68 65 20 64 65 66 61 75 6c 74 20 is the default
12b40 61 6e 64 20 72 65 63 6f 6d 6d 65 6e 64 65 64 20 and recommended
12b50 6d 6f 64 65 2e 0a 20 2a 2f 0a 0a 23 69 66 6e 64 mode.. */..#ifnd
12b60 65 66 20 54 43 4c 5f 55 54 46 5f 4d 41 58 0a 23 ef TCL_UTF_MAX.#
12b70 20 20 20 64 65 66 69 6e 65 20 54 43 4c 5f 55 54 define TCL_UT
12b80 46 5f 4d 41 58 09 09 34 0a 23 65 6e 64 69 66 0a F_MAX..4.#endif.
12b90 0a 2f 2a 0a 20 2a 20 54 68 69 73 20 72 65 70 72 ./*. * This repr
12ba0 65 73 65 6e 74 73 20 61 20 55 6e 69 63 6f 64 65 esents a Unicode
12bb0 20 63 68 61 72 61 63 74 65 72 2e 20 41 6e 79 20 character. Any
12bc0 63 68 61 6e 67 65 73 20 74 6f 20 74 68 69 73 20 changes to this
12bd0 73 68 6f 75 6c 64 20 61 6c 73 6f 20 62 65 0a 20 should also be.
12be0 2a 20 72 65 66 6c 65 63 74 65 64 20 69 6e 20 72 * reflected in r
12bf0 65 67 63 75 73 74 6f 6d 2e 68 2e 0a 20 2a 2f 0a egcustom.h.. */.
12c00 0a 23 69 66 20 54 43 4c 5f 55 54 46 5f 4d 41 58 .#if TCL_UTF_MAX
12c10 20 3d 3d 20 34 0a 20 20 20 20 2f 2a 0a 20 20 20 == 4. /*.
12c20 20 20 2a 20 69 6e 74 20 69 73 6e 27 74 20 31 30 * int isn't 10
12c30 30 25 20 61 63 63 75 72 61 74 65 20 61 73 20 69 0% accurate as i
12c40 74 20 73 68 6f 75 6c 64 20 62 65 20 61 20 73 74 t should be a st
12c50 72 69 63 74 20 34 2d 62 79 74 65 20 76 61 6c 75 rict 4-byte valu
12c60 65 0a 20 20 20 20 20 2a 20 28 70 65 72 68 61 70 e. * (perhap
12c70 73 20 69 6e 74 33 32 5f 74 29 2e 20 49 4c 50 36 s int32_t). ILP6
12c80 34 2f 53 49 4c 50 36 34 20 73 79 73 74 65 6d 73 4/SILP64 systems
12c90 20 6d 61 79 20 68 61 76 65 20 74 72 6f 75 62 6c may have troubl
12ca0 65 73 2e 20 54 68 65 0a 20 20 20 20 20 2a 20 73 es. The. * s
12cb0 69 7a 65 20 6f 66 20 74 68 69 73 20 76 61 6c 75 ize of this valu
12cc0 65 20 6d 75 73 74 20 62 65 20 72 65 66 6c 65 63 e must be reflec
12cd0 74 65 64 20 63 6f 72 72 65 63 74 6c 79 20 69 6e ted correctly in
12ce0 20 72 65 67 63 75 73 74 6f 6d 2e 68 2e 0a 20 20 regcustom.h..
12cf0 20 20 20 2a 2f 0a 74 79 70 65 64 65 66 20 69 6e */.typedef in
12d00 74 20 54 63 6c 5f 55 6e 69 43 68 61 72 3b 0a 23 t Tcl_UniChar;.#
12d10 65 6c 69 66 20 54 43 4c 5f 55 54 46 5f 4d 41 58 elif TCL_UTF_MAX
12d20 20 3d 3d 20 33 20 26 26 20 21 64 65 66 69 6e 65 == 3 && !define
12d30 64 28 42 55 49 4c 44 5f 74 63 6c 29 0a 74 79 70 d(BUILD_tcl).typ
12d40 65 64 65 66 20 75 6e 73 69 67 6e 65 64 20 73 68 edef unsigned sh
12d50 6f 72 74 20 54 63 6c 5f 55 6e 69 43 68 61 72 3b ort Tcl_UniChar;
12d60 0a 23 65 6c 73 65 0a 23 20 20 20 65 72 72 6f 72 .#else.# error
12d70 20 22 54 68 69 73 20 54 43 4c 5f 55 54 46 5f 4d "This TCL_UTF_M
12d80 41 58 20 76 61 6c 75 65 20 69 73 20 6e 6f 74 20 AX value is not
12d90 73 75 70 70 6f 72 74 65 64 22 0a 23 65 6e 64 69 supported".#endi
12da0 66 0a 0a 2f 2a 0a 20 2a 20 53 70 65 63 69 66 69 f../*. * Specifi
12db0 65 72 73 20 66 6f 72 20 55 6e 69 63 6f 64 65 20 ers for Unicode
12dc0 6e 6f 72 6d 61 6c 69 7a 61 74 69 6f 6e 20 66 6f normalization fo
12dd0 72 6d 73 2e 0a 20 2a 2f 0a 74 79 70 65 64 65 66 rms.. */.typedef
12de0 20 65 6e 75 6d 20 7b 0a 20 20 20 20 54 43 4c 5f enum {. TCL_
12df0 4e 46 43 2c 20 54 43 4c 5f 4e 46 44 2c 20 54 43 NFC, TCL_NFD, TC
12e00 4c 5f 4e 46 4b 43 2c 20 54 43 4c 5f 4e 46 4b 44 L_NFKC, TCL_NFKD
12e10 0a 7d 20 54 63 6c 5f 55 6e 69 63 6f 64 65 4e 6f .} Tcl_UnicodeNo
12e20 72 6d 61 6c 69 7a 61 74 69 6f 6e 46 6f 72 6d 3b rmalizationForm;
12e30 0a 0c 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d .../*. *--------
12e40 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
12e50 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
12e60 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
12e70 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
12e80 2d 2d 2d 2d 0a 20 2a 20 54 49 50 20 23 35 39 3a ----. * TIP #59:
12e90 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 73 The following s
12ea0 74 72 75 63 74 75 72 65 20 69 73 20 75 73 65 64 tructure is used
12eb0 20 69 6e 20 63 61 6c 6c 73 20 27 54 63 6c 5f 52 in calls 'Tcl_R
12ec0 65 67 69 73 74 65 72 43 6f 6e 66 69 67 27 20 74 egisterConfig' t
12ed0 6f 0a 20 2a 20 70 72 6f 76 69 64 65 20 74 68 65 o. * provide the
12ee0 20 73 79 73 74 65 6d 20 77 69 74 68 20 74 68 65 system with the
12ef0 20 65 6d 62 65 64 64 65 64 20 63 6f 6e 66 69 67 embedded config
12f00 75 72 61 74 69 6f 6e 20 64 61 74 61 2e 0a 20 2a uration data.. *
12f10 2f 0a 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 /..typedef struc
12f20 74 20 54 63 6c 5f 43 6f 6e 66 69 67 20 7b 0a 20 t Tcl_Config {.
12f30 20 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 6b const char *k
12f40 65 79 3b 09 09 2f 2a 20 43 6f 6e 66 69 67 75 72 ey;../* Configur
12f50 61 74 69 6f 6e 20 6b 65 79 20 74 6f 20 72 65 67 ation key to reg
12f60 69 73 74 65 72 2e 20 41 53 43 49 49 0a 09 09 09 ister. ASCII....
12f70 09 20 2a 20 65 6e 63 6f 64 65 64 2c 20 74 68 75 . * encoded, thu
12f80 73 20 55 54 46 2d 38 2e 20 2a 2f 0a 20 20 20 20 s UTF-8. */.
12f90 63 6f 6e 73 74 20 63 68 61 72 20 2a 76 61 6c 75 const char *valu
12fa0 65 3b 09 09 2f 2a 20 54 68 65 20 76 61 6c 75 65 e;../* The value
12fb0 20 61 73 73 6f 63 69 61 74 65 64 20 77 69 74 68 associated with
12fc0 20 74 68 65 20 6b 65 79 2e 20 53 79 73 74 65 6d the key. System
12fd0 0a 09 09 09 09 20 2a 20 65 6e 63 6f 64 69 6e 67 ..... * encoding
12fe0 2e 20 2a 2f 0a 7d 20 54 63 6c 5f 43 6f 6e 66 69 . */.} Tcl_Confi
12ff0 67 3b 0a 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d g;../*. *-------
13000 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13010 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13020 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13030 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13040 2d 2d 2d 2d 2d 0a 20 2a 20 46 6c 61 67 73 20 66 -----. * Flags f
13050 6f 72 20 54 49 50 23 31 34 33 20 6c 69 6d 69 74 or TIP#143 limit
13060 73 2c 20 64 65 74 61 69 6c 69 6e 67 20 77 68 69 s, detailing whi
13070 63 68 20 6c 69 6d 69 74 73 20 61 72 65 20 61 63 ch limits are ac
13080 74 69 76 65 20 69 6e 20 61 6e 0a 20 2a 20 69 6e tive in an. * in
13090 74 65 72 70 72 65 74 65 72 2e 20 55 73 65 64 20 terpreter. Used
130a0 66 6f 72 20 54 63 6c 5f 7b 41 64 64 2c 52 65 6d for Tcl_{Add,Rem
130b0 6f 76 65 7d 4c 69 6d 69 74 48 61 6e 64 6c 65 72 ove}LimitHandler
130c0 20 74 79 70 65 20 61 72 67 75 6d 65 6e 74 2e 0a type argument..
130d0 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c */..#define TCL
130e0 5f 4c 49 4d 49 54 5f 43 4f 4d 4d 41 4e 44 53 09 _LIMIT_COMMANDS.
130f0 30 78 30 31 0a 23 64 65 66 69 6e 65 20 54 43 4c 0x01.#define TCL
13100 5f 4c 49 4d 49 54 5f 54 49 4d 45 09 09 30 78 30 _LIMIT_TIME..0x0
13110 32 0a 0a 2f 2a 0a 20 2a 20 53 74 72 75 63 74 75 2../*. * Structu
13120 72 65 20 63 6f 6e 74 61 69 6e 69 6e 67 20 69 6e re containing in
13130 66 6f 72 6d 61 74 69 6f 6e 20 61 62 6f 75 74 20 formation about
13140 61 20 6c 69 6d 69 74 20 68 61 6e 64 6c 65 72 20 a limit handler
13150 74 6f 20 62 65 20 63 61 6c 6c 65 64 20 77 68 65 to be called whe
13160 6e 20 61 0a 20 2a 20 63 6f 6d 6d 61 6e 64 2d 20 n a. * command-
13170 6f 72 20 74 69 6d 65 2d 6c 69 6d 69 74 20 69 73 or time-limit is
13180 20 65 78 63 65 65 64 65 64 20 62 79 20 61 6e 20 exceeded by an
13190 69 6e 74 65 72 70 72 65 74 65 72 2e 0a 20 2a 2f interpreter.. */
131a0 0a 0a 74 79 70 65 64 65 66 20 76 6f 69 64 20 28 ..typedef void (
131b0 54 63 6c 5f 4c 69 6d 69 74 48 61 6e 64 6c 65 72 Tcl_LimitHandler
131c0 50 72 6f 63 29 20 28 76 6f 69 64 20 2a 63 6c 69 Proc) (void *cli
131d0 65 6e 74 44 61 74 61 2c 20 54 63 6c 5f 49 6e 74 entData, Tcl_Int
131e0 65 72 70 20 2a 69 6e 74 65 72 70 29 3b 0a 23 64 erp *interp);.#d
131f0 65 66 69 6e 65 20 54 63 6c 5f 4c 69 6d 69 74 48 efine Tcl_LimitH
13200 61 6e 64 6c 65 72 44 65 6c 65 74 65 50 72 6f 63 andlerDeleteProc
13210 20 54 63 6c 5f 46 72 65 65 50 72 6f 63 0a 0a 23 Tcl_FreeProc..#
13220 69 66 20 30 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d if 0./*. *------
13230 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13240 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13250 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13260 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13270 2d 2d 2d 2d 2d 2d 0a 20 2a 20 57 65 20 77 6f 75 ------. * We wou
13280 6c 64 20 6c 69 6b 65 20 74 6f 20 70 72 6f 76 69 ld like to provi
13290 64 65 20 61 6e 20 61 6e 6f 6e 79 6d 6f 75 73 20 de an anonymous
132a0 73 74 72 75 63 74 75 72 65 20 22 6d 70 5f 69 6e structure "mp_in
132b0 74 22 20 68 65 72 65 2c 20 77 68 69 63 68 20 69 t" here, which i
132c0 73 0a 20 2a 20 63 6f 6d 70 61 74 69 62 6c 65 20 s. * compatible
132d0 77 69 74 68 20 6c 69 62 74 6f 6d 6d 61 74 68 27 with libtommath'
132e0 73 20 22 6d 70 5f 69 6e 74 22 2c 20 62 75 74 20 s "mp_int", but
132f0 77 69 74 68 6f 75 74 20 64 75 70 6c 69 63 61 74 without duplicat
13300 69 6e 67 20 61 6e 79 74 68 69 6e 67 0a 20 2a 20 ing anything. *
13310 66 72 6f 6d 20 3c 74 6f 6d 6d 61 74 68 2e 68 3e from <tommath.h>
13320 20 6f 72 20 69 6e 63 6c 75 64 69 6e 67 20 3c 74 or including <t
13330 6f 6d 6d 61 74 68 2e 68 3e 20 68 65 72 65 2e 20 ommath.h> here.
13340 42 75 74 20 74 68 65 20 6c 69 62 74 6f 6d 6d 61 But the libtomma
13350 74 68 20 70 72 6f 6a 65 63 74 0a 20 2a 20 64 69 th project. * di
13360 64 6e 27 74 20 68 6f 6e 6f 72 20 6f 75 72 20 72 dn't honor our r
13370 65 71 75 65 73 74 2e 20 53 65 65 3a 20 3c 68 74 equest. See: <ht
13380 74 70 73 3a 2f 2f 67 69 74 68 75 62 2e 63 6f 6d tps://github.com
13390 2f 6c 69 62 74 6f 6d 2f 6c 69 62 74 6f 6d 6d 61 /libtom/libtomma
133a0 74 68 2f 70 75 6c 6c 2f 34 37 33 3e 0a 20 2a 0a th/pull/473>. *.
133b0 20 2a 20 54 68 61 74 27 73 20 77 68 79 20 74 68 * That's why th
133c0 69 73 20 70 61 72 74 20 69 73 20 63 6f 6d 6d 65 is part is comme
133d0 6e 74 65 64 20 6f 75 74 2c 20 61 6e 64 20 77 65 nted out, and we
133e0 20 61 72 65 20 75 73 69 6e 67 20 28 76 6f 69 64 are using (void
133f0 20 2a 29 20 69 6e 0a 20 2a 20 76 61 72 69 6f 75 *) in. * variou
13400 73 20 41 50 49 27 73 20 69 6e 20 73 74 65 61 64 s API's in stead
13410 20 6f 66 20 74 68 65 20 6d 6f 72 65 20 63 6f 72 of the more cor
13420 72 65 63 74 20 28 6d 70 5f 69 6e 74 20 2a 29 2e rect (mp_int *).
13430 0a 20 2a 2f 0a 0a 23 69 66 6e 64 65 66 20 4d 50 . */..#ifndef MP
13440 5f 49 4e 54 5f 44 45 43 4c 41 52 45 44 0a 23 64 _INT_DECLARED.#d
13450 65 66 69 6e 65 20 4d 50 5f 49 4e 54 5f 44 45 43 efine MP_INT_DEC
13460 4c 41 52 45 44 0a 74 79 70 65 64 65 66 20 73 74 LARED.typedef st
13470 72 75 63 74 20 6d 70 5f 69 6e 74 20 6d 70 5f 69 ruct mp_int mp_i
13480 6e 74 3b 0a 23 65 6e 64 69 66 0a 0a 23 65 6e 64 nt;.#endif..#end
13490 69 66 0a 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d if../*. *-------
134a0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
134b0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
134c0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
134d0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
134e0 2d 2d 2d 2d 2d 0a 20 2a 20 44 65 66 69 6e 69 74 -----. * Definit
134f0 69 6f 6e 73 20 6e 65 65 64 65 64 20 66 6f 72 20 ions needed for
13500 54 63 6c 5f 50 61 72 73 65 41 72 67 76 4f 62 6a Tcl_ParseArgvObj
13510 20 72 6f 75 74 69 6e 65 73 2e 0a 20 2a 20 42 61 routines.. * Ba
13520 73 65 64 20 6f 6e 20 74 6b 41 72 67 76 2e 63 2e sed on tkArgv.c.
13530 0a 20 2a 20 4d 6f 64 69 66 69 63 61 74 69 6f 6e . * Modification
13540 73 20 66 72 6f 6d 20 74 68 65 20 6f 72 69 67 69 s from the origi
13550 6e 61 6c 20 61 72 65 20 63 6f 70 79 72 69 67 68 nal are copyrigh
13560 74 20 28 63 29 20 53 61 6d 20 42 72 6f 6d 6c 65 t (c) Sam Bromle
13570 79 20 32 30 30 36 0a 20 2a 2f 0a 0a 74 79 70 65 y 2006. */..type
13580 64 65 66 20 73 74 72 75 63 74 20 7b 0a 20 20 20 def struct {.
13590 20 69 6e 74 20 74 79 70 65 3b 09 09 09 2f 2a 20 int type;.../*
135a0 49 6e 64 69 63 61 74 65 73 20 74 68 65 20 6f 70 Indicates the op
135b0 74 69 6f 6e 20 74 79 70 65 3b 20 73 65 65 20 62 tion type; see b
135c0 65 6c 6f 77 2e 20 2a 2f 0a 20 20 20 20 63 6f 6e elow. */. con
135d0 73 74 20 63 68 61 72 20 2a 6b 65 79 53 74 72 3b st char *keyStr;
135e0 09 09 2f 2a 20 54 68 65 20 6b 65 79 20 73 74 72 ../* The key str
135f0 69 6e 67 20 74 68 61 74 20 66 6c 61 67 73 20 74 ing that flags t
13600 68 65 20 6f 70 74 69 6f 6e 20 69 6e 20 74 68 65 he option in the
13610 0a 09 09 09 09 20 2a 20 61 72 67 76 20 61 72 72 ..... * argv arr
13620 61 79 2e 20 2a 2f 0a 20 20 20 20 76 6f 69 64 20 ay. */. void
13630 2a 73 72 63 50 74 72 3b 09 09 2f 2a 20 56 61 6c *srcPtr;../* Val
13640 75 65 20 74 6f 20 62 65 20 75 73 65 64 20 69 6e ue to be used in
13650 20 73 65 74 74 69 6e 67 20 64 73 74 3b 20 75 73 setting dst; us
13660 61 67 65 0a 09 09 09 09 20 2a 20 64 65 70 65 6e age..... * depen
13670 64 73 20 6f 6e 20 74 79 70 65 2e 2a 2f 0a 20 20 ds on type.*/.
13680 20 20 76 6f 69 64 20 2a 64 73 74 50 74 72 3b 09 void *dstPtr;.
13690 09 2f 2a 20 41 64 64 72 65 73 73 20 6f 66 20 76 ./* Address of v
136a0 61 6c 75 65 20 74 6f 20 62 65 20 6d 6f 64 69 66 alue to be modif
136b0 69 65 64 3b 20 75 73 61 67 65 0a 09 09 09 09 20 ied; usage.....
136c0 2a 20 64 65 70 65 6e 64 73 20 6f 6e 20 74 79 70 * depends on typ
136d0 65 2e 2a 2f 0a 20 20 20 20 63 6f 6e 73 74 20 63 e.*/. const c
136e0 68 61 72 20 2a 68 65 6c 70 53 74 72 3b 09 2f 2a har *helpStr;./*
136f0 20 44 6f 63 75 6d 65 6e 74 61 74 69 6f 6e 20 6d Documentation m
13700 65 73 73 61 67 65 20 64 65 73 63 72 69 62 69 6e essage describin
13710 67 20 74 68 69 73 0a 09 09 09 09 20 2a 20 6f 70 g this..... * op
13720 74 69 6f 6e 2e 20 2a 2f 0a 20 20 20 20 76 6f 69 tion. */. voi
13730 64 20 2a 63 6c 69 65 6e 74 44 61 74 61 3b 09 09 d *clientData;..
13740 2f 2a 20 57 6f 72 64 20 74 6f 20 70 61 73 73 20 /* Word to pass
13750 74 6f 20 66 75 6e 63 74 69 6f 6e 20 63 61 6c 6c to function call
13760 62 61 63 6b 73 2e 20 2a 2f 0a 7d 20 54 63 6c 5f backs. */.} Tcl_
13770 41 72 67 76 49 6e 66 6f 3b 0a 0a 2f 2a 0a 20 2a ArgvInfo;../*. *
13780 20 4c 65 67 61 6c 20 76 61 6c 75 65 73 20 66 6f Legal values fo
13790 72 20 74 68 65 20 74 79 70 65 20 66 69 65 6c 64 r the type field
137a0 20 6f 66 20 61 20 54 63 6c 5f 41 72 67 49 6e 66 of a Tcl_ArgInf
137b0 6f 3a 20 73 65 65 20 74 68 65 20 75 73 65 72 0a o: see the user.
137c0 20 2a 20 64 6f 63 75 6d 65 6e 74 61 74 69 6f 6e * documentation
137d0 20 66 6f 72 20 64 65 74 61 69 6c 73 2e 0a 20 2a for details.. *
137e0 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 41 /..#define TCL_A
137f0 52 47 56 5f 43 4f 4e 53 54 41 4e 54 09 31 35 0a RGV_CONSTANT.15.
13800 23 64 65 66 69 6e 65 20 54 43 4c 5f 41 52 47 56 #define TCL_ARGV
13810 5f 49 4e 54 09 09 31 36 0a 23 64 65 66 69 6e 65 _INT..16.#define
13820 20 54 43 4c 5f 41 52 47 56 5f 53 54 52 49 4e 47 TCL_ARGV_STRING
13830 09 09 31 37 0a 23 64 65 66 69 6e 65 20 54 43 4c ..17.#define TCL
13840 5f 41 52 47 56 5f 52 45 53 54 09 09 31 38 0a 23 _ARGV_REST..18.#
13850 64 65 66 69 6e 65 20 54 43 4c 5f 41 52 47 56 5f define TCL_ARGV_
13860 46 4c 4f 41 54 09 09 31 39 0a 23 64 65 66 69 6e FLOAT..19.#defin
13870 65 20 54 43 4c 5f 41 52 47 56 5f 46 55 4e 43 09 e TCL_ARGV_FUNC.
13880 09 32 30 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f .20.#define TCL_
13890 41 52 47 56 5f 47 45 4e 46 55 4e 43 09 32 31 0a ARGV_GENFUNC.21.
138a0 23 64 65 66 69 6e 65 20 54 43 4c 5f 41 52 47 56 #define TCL_ARGV
138b0 5f 48 45 4c 50 09 09 32 32 0a 23 64 65 66 69 6e _HELP..22.#defin
138c0 65 20 54 43 4c 5f 41 52 47 56 5f 45 4e 44 09 09 e TCL_ARGV_END..
138d0 32 33 0a 0a 2f 2a 0a 20 2a 20 54 79 70 65 73 20 23../*. * Types
138e0 6f 66 20 63 61 6c 6c 62 61 63 6b 20 66 75 6e 63 of callback func
138f0 74 69 6f 6e 73 20 66 6f 72 20 74 68 65 20 54 43 tions for the TC
13900 4c 5f 41 52 47 56 5f 46 55 4e 43 20 61 6e 64 20 L_ARGV_FUNC and
13910 54 43 4c 5f 41 52 47 56 5f 47 45 4e 46 55 4e 43 TCL_ARGV_GENFUNC
13920 0a 20 2a 20 61 72 67 75 6d 65 6e 74 20 74 79 70 . * argument typ
13930 65 73 3a 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 66 es:. */..typedef
13940 20 69 6e 74 20 28 54 63 6c 5f 41 72 67 76 46 75 int (Tcl_ArgvFu
13950 6e 63 50 72 6f 63 29 28 76 6f 69 64 20 2a 63 6c ncProc)(void *cl
13960 69 65 6e 74 44 61 74 61 2c 20 54 63 6c 5f 4f 62 ientData, Tcl_Ob
13970 6a 20 2a 6f 62 6a 50 74 72 2c 0a 09 76 6f 69 64 j *objPtr,..void
13980 20 2a 64 73 74 50 74 72 29 3b 0a 74 79 70 65 64 *dstPtr);.typed
13990 65 66 20 54 63 6c 5f 53 69 7a 65 20 28 54 63 6c ef Tcl_Size (Tcl
139a0 5f 41 72 67 76 47 65 6e 46 75 6e 63 50 72 6f 63 _ArgvGenFuncProc
139b0 29 28 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 61 )(void *clientDa
139c0 74 61 2c 20 54 63 6c 5f 49 6e 74 65 72 70 20 2a ta, Tcl_Interp *
139d0 69 6e 74 65 72 70 2c 0a 09 54 63 6c 5f 53 69 7a interp,..Tcl_Siz
139e0 65 20 6f 62 6a 63 2c 20 54 63 6c 5f 4f 62 6a 20 e objc, Tcl_Obj
139f0 2a 63 6f 6e 73 74 20 2a 6f 62 6a 76 2c 20 76 6f *const *objv, vo
13a00 69 64 20 2a 64 73 74 50 74 72 29 3b 0a 0a 2f 2a id *dstPtr);../*
13a10 0a 20 2a 20 53 68 6f 72 74 68 61 6e 64 20 66 6f . * Shorthand fo
13a20 72 20 63 6f 6d 6d 6f 6e 6c 79 20 75 73 65 64 20 r commonly used
13a30 61 72 67 54 61 62 6c 65 20 65 6e 74 72 69 65 73 argTable entries
13a40 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 .. */..#define T
13a50 43 4c 5f 41 52 47 56 5f 41 55 54 4f 5f 48 45 4c CL_ARGV_AUTO_HEL
13a60 50 20 5c 0a 20 20 20 20 7b 54 43 4c 5f 41 52 47 P \. {TCL_ARG
13a70 56 5f 48 45 4c 50 2c 09 22 2d 68 65 6c 70 22 2c V_HELP,."-help",
13a80 09 4e 55 4c 4c 2c 09 4e 55 4c 4c 2c 20 5c 0a 09 .NULL,.NULL, \..
13a90 20 20 20 20 22 50 72 69 6e 74 20 73 75 6d 6d 61 "Print summa
13aa0 72 79 20 6f 66 20 63 6f 6d 6d 61 6e 64 2d 6c 69 ry of command-li
13ab0 6e 65 20 6f 70 74 69 6f 6e 73 20 61 6e 64 20 61 ne options and a
13ac0 62 6f 72 74 22 2c 20 4e 55 4c 4c 7d 0a 23 64 65 bort", NULL}.#de
13ad0 66 69 6e 65 20 54 43 4c 5f 41 52 47 56 5f 41 55 fine TCL_ARGV_AU
13ae0 54 4f 5f 52 45 53 54 20 5c 0a 20 20 20 20 7b 54 TO_REST \. {T
13af0 43 4c 5f 41 52 47 56 5f 52 45 53 54 2c 09 22 2d CL_ARGV_REST,."-
13b00 2d 22 2c 09 09 4e 55 4c 4c 2c 09 4e 55 4c 4c 2c -",..NULL,.NULL,
13b10 20 5c 0a 09 20 20 20 20 22 4d 61 72 6b 73 20 74 \.. "Marks t
13b20 68 65 20 65 6e 64 20 6f 66 20 74 68 65 20 6f 70 he end of the op
13b30 74 69 6f 6e 73 22 2c 20 4e 55 4c 4c 7d 0a 23 64 tions", NULL}.#d
13b40 65 66 69 6e 65 20 54 43 4c 5f 41 52 47 56 5f 54 efine TCL_ARGV_T
13b50 41 42 4c 45 5f 45 4e 44 20 5c 0a 20 20 20 20 7b ABLE_END \. {
13b60 54 43 4c 5f 41 52 47 56 5f 45 4e 44 2c 20 4e 55 TCL_ARGV_END, NU
13b70 4c 4c 2c 20 4e 55 4c 4c 2c 20 4e 55 4c 4c 2c 20 LL, NULL, NULL,
13b80 4e 55 4c 4c 2c 20 4e 55 4c 4c 7d 0a 0a 2f 2a 0a NULL, NULL}../*.
13b90 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d *--------------
13ba0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13bb0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13bc0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13bd0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 --------------.
13be0 2a 20 44 65 66 69 6e 69 74 69 6f 6e 73 20 6e 65 * Definitions ne
13bf0 65 64 65 64 20 66 6f 72 20 54 63 6c 5f 5a 6c 69 eded for Tcl_Zli
13c00 62 20 72 6f 75 74 69 6e 65 73 2e 20 5b 54 49 50 b routines. [TIP
13c10 20 23 32 33 34 5d 0a 20 2a 0a 20 2a 20 43 6f 6e #234]. *. * Con
13c20 73 74 61 6e 74 73 20 66 6f 72 20 74 68 65 20 66 stants for the f
13c30 6f 72 6d 61 74 20 66 6c 61 67 73 20 64 65 73 63 ormat flags desc
13c40 72 69 62 69 6e 67 20 77 68 61 74 20 73 6f 72 74 ribing what sort
13c50 20 6f 66 20 64 61 74 61 20 66 6f 72 6d 61 74 20 of data format
13c60 69 73 0a 20 2a 20 64 65 73 69 72 65 64 2f 65 78 is. * desired/ex
13c70 70 65 63 74 65 64 20 66 6f 72 20 74 68 65 20 54 pected for the T
13c80 63 6c 5f 5a 6c 69 62 44 65 66 6c 61 74 65 2c 20 cl_ZlibDeflate,
13c90 54 63 6c 5f 5a 6c 69 62 49 6e 66 6c 61 74 65 20 Tcl_ZlibInflate
13ca0 61 6e 64 0a 20 2a 20 54 63 6c 5f 5a 6c 69 62 53 and. * Tcl_ZlibS
13cb0 74 72 65 61 6d 49 6e 69 74 20 66 75 6e 63 74 69 treamInit functi
13cc0 6f 6e 73 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e ons.. */..#defin
13cd0 65 20 54 43 4c 5f 5a 4c 49 42 5f 46 4f 52 4d 41 e TCL_ZLIB_FORMA
13ce0 54 5f 52 41 57 09 31 0a 23 64 65 66 69 6e 65 20 T_RAW.1.#define
13cf0 54 43 4c 5f 5a 4c 49 42 5f 46 4f 52 4d 41 54 5f TCL_ZLIB_FORMAT_
13d00 5a 4c 49 42 09 32 0a 23 64 65 66 69 6e 65 20 54 ZLIB.2.#define T
13d10 43 4c 5f 5a 4c 49 42 5f 46 4f 52 4d 41 54 5f 47 CL_ZLIB_FORMAT_G
13d20 5a 49 50 09 34 0a 23 64 65 66 69 6e 65 20 54 43 ZIP.4.#define TC
13d30 4c 5f 5a 4c 49 42 5f 46 4f 52 4d 41 54 5f 41 55 L_ZLIB_FORMAT_AU
13d40 54 4f 09 38 0a 0a 2f 2a 0a 20 2a 20 43 6f 6e 73 TO.8../*. * Cons
13d50 74 61 6e 74 73 20 74 68 61 74 20 64 65 73 63 72 tants that descr
13d60 69 62 65 20 77 68 65 74 68 65 72 20 74 68 65 20 ibe whether the
13d70 73 74 72 65 61 6d 20 69 73 20 74 6f 20 6f 70 65 stream is to ope
13d80 72 61 74 65 20 69 6e 20 63 6f 6d 70 72 65 73 73 rate in compress
13d90 69 6e 67 20 6f 72 0a 20 2a 20 64 65 63 6f 6d 70 ing or. * decomp
13da0 72 65 73 73 69 6e 67 20 6d 6f 64 65 2e 0a 20 2a ressing mode.. *
13db0 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 5a /..#define TCL_Z
13dc0 4c 49 42 5f 53 54 52 45 41 4d 5f 44 45 46 4c 41 LIB_STREAM_DEFLA
13dd0 54 45 09 31 36 0a 23 64 65 66 69 6e 65 20 54 43 TE.16.#define TC
13de0 4c 5f 5a 4c 49 42 5f 53 54 52 45 41 4d 5f 49 4e L_ZLIB_STREAM_IN
13df0 46 4c 41 54 45 09 33 32 0a 0a 2f 2a 0a 20 2a 20 FLATE.32../*. *
13e00 43 6f 6e 73 74 61 6e 74 73 20 67 69 76 69 6e 67 Constants giving
13e10 20 63 6f 6d 70 72 65 73 73 69 6f 6e 20 6c 65 76 compression lev
13e20 65 6c 73 2e 20 55 73 65 20 6f 66 20 54 43 4c 5f els. Use of TCL_
13e30 5a 4c 49 42 5f 43 4f 4d 50 52 45 53 53 5f 44 45 ZLIB_COMPRESS_DE
13e40 46 41 55 4c 54 20 69 73 0a 20 2a 20 72 65 63 6f FAULT is. * reco
13e50 6d 6d 65 6e 64 65 64 2e 0a 20 2a 2f 0a 0a 23 64 mmended.. */..#d
13e60 65 66 69 6e 65 20 54 43 4c 5f 5a 4c 49 42 5f 43 efine TCL_ZLIB_C
13e70 4f 4d 50 52 45 53 53 5f 4e 4f 4e 45 09 30 0a 23 OMPRESS_NONE.0.#
13e80 64 65 66 69 6e 65 20 54 43 4c 5f 5a 4c 49 42 5f define TCL_ZLIB_
13e90 43 4f 4d 50 52 45 53 53 5f 46 41 53 54 09 31 0a COMPRESS_FAST.1.
13ea0 23 64 65 66 69 6e 65 20 54 43 4c 5f 5a 4c 49 42 #define TCL_ZLIB
13eb0 5f 43 4f 4d 50 52 45 53 53 5f 42 45 53 54 09 39 _COMPRESS_BEST.9
13ec0 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 5a 4c 49 .#define TCL_ZLI
13ed0 42 5f 43 4f 4d 50 52 45 53 53 5f 44 45 46 41 55 B_COMPRESS_DEFAU
13ee0 4c 54 20 28 2d 31 29 0a 0a 2f 2a 0a 20 2a 20 43 LT (-1)../*. * C
13ef0 6f 6e 73 74 61 6e 74 73 20 66 6f 72 20 74 79 70 onstants for typ
13f00 65 73 20 6f 66 20 66 6c 75 73 68 69 6e 67 2c 20 es of flushing,
13f10 75 73 65 64 20 77 69 74 68 20 54 63 6c 5f 5a 6c used with Tcl_Zl
13f20 69 62 46 6c 75 73 68 2e 0a 20 2a 2f 0a 0a 23 64 ibFlush.. */..#d
13f30 65 66 69 6e 65 20 54 43 4c 5f 5a 4c 49 42 5f 4e efine TCL_ZLIB_N
13f40 4f 5f 46 4c 55 53 48 09 30 0a 23 64 65 66 69 6e O_FLUSH.0.#defin
13f50 65 20 54 43 4c 5f 5a 4c 49 42 5f 46 4c 55 53 48 e TCL_ZLIB_FLUSH
13f60 09 09 32 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f ..2.#define TCL_
13f70 5a 4c 49 42 5f 46 55 4c 4c 46 4c 55 53 48 09 33 ZLIB_FULLFLUSH.3
13f80 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 5a 4c 49 .#define TCL_ZLI
13f90 42 5f 46 49 4e 41 4c 49 5a 45 09 34 0a 0a 2f 2a B_FINALIZE.4../*
13fa0 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d . *-------------
13fb0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13fc0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13fd0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13fe0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a ---------------.
13ff0 20 2a 20 44 65 66 69 6e 69 74 69 6f 6e 73 20 6e * Definitions n
14000 65 65 64 65 64 20 66 6f 72 20 74 68 65 20 54 63 eeded for the Tc
14010 6c 5f 4c 6f 61 64 46 69 6c 65 20 66 75 6e 63 74 l_LoadFile funct
14020 69 6f 6e 2e 20 5b 54 49 50 20 23 34 31 36 5d 0a ion. [TIP #416].
14030 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c */..#define TCL
14040 5f 4c 4f 41 44 5f 47 4c 4f 42 41 4c 20 31 0a 23 _LOAD_GLOBAL 1.#
14050 64 65 66 69 6e 65 20 54 43 4c 5f 4c 4f 41 44 5f define TCL_LOAD_
14060 4c 41 5a 59 20 32 0a 0a 2f 2a 0a 20 2a 2d 2d 2d LAZY 2../*. *---
14070 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
14080 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
14090 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
140a0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
140b0 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 44 65 66 ---------. * Def
140c0 69 6e 69 74 69 6f 6e 73 20 6e 65 65 64 65 64 20 initions needed
140d0 66 6f 72 20 74 68 65 20 54 63 6c 5f 4f 70 65 6e for the Tcl_Open
140e0 54 63 70 53 65 72 76 65 72 45 78 20 66 75 6e 63 TcpServerEx func
140f0 74 69 6f 6e 2e 20 5b 54 49 50 20 23 34 35 36 5d tion. [TIP #456]
14100 0a 20 2a 2f 0a 23 64 65 66 69 6e 65 20 54 43 4c . */.#define TCL
14110 5f 54 43 50 53 45 52 56 45 52 5f 52 45 55 53 45 _TCPSERVER_REUSE
14120 41 44 44 52 20 28 31 3c 3c 30 29 0a 23 64 65 66 ADDR (1<<0).#def
14130 69 6e 65 20 54 43 4c 5f 54 43 50 53 45 52 56 45 ine TCL_TCPSERVE
14140 52 5f 52 45 55 53 45 50 4f 52 54 20 28 31 3c 3c R_REUSEPORT (1<<
14150 31 29 0a 0a 2f 2a 0a 20 2a 20 43 6f 6e 73 74 61 1)../*. * Consta
14160 6e 74 73 20 66 6f 72 20 73 70 65 63 69 61 6c 20 nts for special
14170 54 63 6c 5f 53 69 7a 65 2d 74 79 70 65 64 20 76 Tcl_Size-typed v
14180 61 6c 75 65 73 2c 20 73 65 65 20 54 49 50 20 23 alues, see TIP #
14190 34 39 34 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 494. */..#define
141a0 20 54 43 4c 5f 49 4f 5f 46 41 49 4c 55 52 45 09 TCL_IO_FAILURE.
141b0 28 28 54 63 6c 5f 53 69 7a 65 29 2d 31 29 0a 23 ((Tcl_Size)-1).#
141c0 64 65 66 69 6e 65 20 54 43 4c 5f 41 55 54 4f 5f define TCL_AUTO_
141d0 4c 45 4e 47 54 48 09 28 28 54 63 6c 5f 53 69 7a LENGTH.((Tcl_Siz
141e0 65 29 2d 31 29 0a 23 64 65 66 69 6e 65 20 54 43 e)-1).#define TC
141f0 4c 5f 49 4e 44 45 58 5f 4e 4f 4e 45 20 20 28 28 L_INDEX_NONE ((
14200 54 63 6c 5f 53 69 7a 65 29 2d 31 29 0a 0a 2f 2a Tcl_Size)-1)../*
14210 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d . *-------------
14220 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
14230 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
14240 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
14250 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a ---------------.
14260 20 2a 20 53 69 6e 67 6c 65 20 70 75 62 6c 69 63 * Single public
14270 20 64 65 63 6c 61 72 61 74 69 6f 6e 20 66 6f 72 declaration for
14280 20 4e 52 45 2e 0a 20 2a 2f 0a 0a 74 79 70 65 64 NRE.. */..typed
14290 65 66 20 69 6e 74 20 28 54 63 6c 5f 4e 52 50 6f ef int (Tcl_NRPo
142a0 73 74 50 72 6f 63 29 20 28 76 6f 69 64 20 2a 64 stProc) (void *d
142b0 61 74 61 5b 5d 2c 20 54 63 6c 5f 49 6e 74 65 72 ata[], Tcl_Inter
142c0 70 20 2a 69 6e 74 65 72 70 2c 20 69 6e 74 20 72 p *interp, int r
142d0 65 73 75 6c 74 29 3b 0a 0a 2f 2a 0a 20 2a 2d 2d esult);../*. *--
142e0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
142f0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
14300 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
14310 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
14320 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 54 68 ----------. * Th
14330 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 63 6f 6e 73 e following cons
14340 74 61 6e 74 20 69 73 20 75 73 65 64 20 74 6f 20 tant is used to
14350 74 65 73 74 20 66 6f 72 20 6f 6c 64 65 72 20 76 test for older v
14360 65 72 73 69 6f 6e 73 20 6f 66 20 54 63 6c 20 69 ersions of Tcl i
14370 6e 20 74 68 65 0a 20 2a 20 73 74 75 62 73 20 74 n the. * stubs t
14380 61 62 6c 65 73 2e 0a 20 2a 2f 0a 0a 23 64 65 66 ables.. */..#def
14390 69 6e 65 20 54 43 4c 5f 53 54 55 42 5f 4d 41 47 ine TCL_STUB_MAG
143a0 49 43 09 09 28 28 69 6e 74 29 20 30 78 46 43 41 IC..((int) 0xFCA
143b0 33 42 41 43 42 20 2b 20 28 69 6e 74 29 20 73 69 3BACB + (int) si
143c0 7a 65 6f 66 28 76 6f 69 64 20 2a 29 29 0a 0a 2f zeof(void *))../
143d0 2a 0a 20 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 69 *. * The followi
143e0 6e 67 20 66 75 6e 63 74 69 6f 6e 20 69 73 20 72 ng function is r
143f0 65 71 75 69 72 65 64 20 74 6f 20 62 65 20 64 65 equired to be de
14400 66 69 6e 65 64 20 69 6e 20 61 6c 6c 20 73 74 75 fined in all stu
14410 62 73 20 61 77 61 72 65 0a 20 2a 20 65 78 74 65 bs aware. * exte
14420 6e 73 69 6f 6e 73 2e 20 54 68 65 20 66 75 6e 63 nsions. The func
14430 74 69 6f 6e 20 69 73 20 61 63 74 75 61 6c 6c 79 tion is actually
14440 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 69 6e 20 implemented in
14450 74 68 65 20 73 74 75 62 20 6c 69 62 72 61 72 79 the stub library
14460 2c 20 6e 6f 74 0a 20 2a 20 74 68 65 20 6d 61 69 , not. * the mai
14470 6e 20 54 63 6c 20 6c 69 62 72 61 72 79 2c 20 61 n Tcl library, a
14480 6c 74 68 6f 75 67 68 20 74 68 65 72 65 20 69 73 lthough there is
14490 20 61 20 74 72 69 76 69 61 6c 20 69 6d 70 6c 65 a trivial imple
144a0 6d 65 6e 74 61 74 69 6f 6e 20 69 6e 20 74 68 65 mentation in the
144b0 0a 20 2a 20 6d 61 69 6e 20 6c 69 62 72 61 72 79 . * main library
144c0 20 69 6e 20 63 61 73 65 20 61 6e 20 65 78 74 65 in case an exte
144d0 6e 73 69 6f 6e 20 69 73 20 73 74 61 74 69 63 61 nsion is statica
144e0 6c 6c 79 20 6c 69 6e 6b 65 64 20 69 6e 74 6f 20 lly linked into
144f0 61 6e 20 61 70 70 6c 69 63 61 74 69 6f 6e 2e 0a an application..
14500 20 2a 2f 0a 0a 63 6f 6e 73 74 20 63 68 61 72 20 */..const char
14510 2a 09 09 54 63 6c 5f 49 6e 69 74 53 74 75 62 73 *..Tcl_InitStubs
14520 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 (Tcl_Interp *int
14530 65 72 70 2c 20 63 6f 6e 73 74 20 63 68 61 72 20 erp, const char
14540 2a 76 65 72 73 69 6f 6e 2c 0a 09 09 09 20 20 20 *version,....
14550 20 69 6e 74 20 65 78 61 63 74 2c 20 69 6e 74 20 int exact, int
14560 6d 61 67 69 63 29 3b 0a 63 6f 6e 73 74 20 63 68 magic);.const ch
14570 61 72 20 2a 09 09 54 63 6c 54 6f 6d 4d 61 74 68 ar *..TclTomMath
14580 49 6e 69 74 69 61 6c 69 7a 65 53 74 75 62 73 28 InitializeStubs(
14590 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 Tcl_Interp *inte
145a0 72 70 2c 0a 09 09 09 20 20 20 20 63 6f 6e 73 74 rp,.... const
145b0 20 63 68 61 72 20 2a 76 65 72 73 69 6f 6e 2c 20 char *version,
145c0 69 6e 74 20 65 70 6f 63 68 2c 20 69 6e 74 20 72 int epoch, int r
145d0 65 76 69 73 69 6f 6e 29 3b 0a 63 6f 6e 73 74 20 evision);.const
145e0 63 68 61 72 20 2a 09 09 54 63 6c 49 6e 69 74 53 char *..TclInitS
145f0 74 75 62 54 61 62 6c 65 28 63 6f 6e 73 74 20 63 tubTable(const c
14600 68 61 72 20 2a 76 65 72 73 69 6f 6e 29 3b 0a 76 har *version);.v
14610 6f 69 64 20 2a 09 09 09 54 63 6c 53 74 75 62 43 oid *...TclStubC
14620 61 6c 6c 28 76 6f 69 64 20 2a 61 72 67 29 3b 0a all(void *arg);.
14630 23 69 66 20 64 65 66 69 6e 65 64 28 5f 57 49 4e #if defined(_WIN
14640 33 32 29 0a 20 20 20 20 54 43 4c 5f 4e 4f 52 45 32). TCL_NORE
14650 54 55 52 4e 20 76 6f 69 64 20 54 63 6c 5f 43 6f TURN void Tcl_Co
14660 6e 73 6f 6c 65 50 61 6e 69 63 28 63 6f 6e 73 74 nsolePanic(const
14670 20 63 68 61 72 20 2a 66 6f 72 6d 61 74 2c 20 2e char *format, .
14680 2e 2e 29 3b 0a 23 65 6c 73 65 0a 23 20 20 20 64 ..);.#else.# d
14690 65 66 69 6e 65 20 54 63 6c 5f 43 6f 6e 73 6f 6c efine Tcl_Consol
146a0 65 50 61 6e 69 63 20 28 28 54 63 6c 5f 50 61 6e ePanic ((Tcl_Pan
146b0 69 63 50 72 6f 63 20 2a 29 4e 55 4c 4c 29 0a 23 icProc *)NULL).#
146c0 65 6e 64 69 66 0a 0a 23 69 66 64 65 66 20 55 53 endif..#ifdef US
146d0 45 5f 54 43 4c 5f 53 54 55 42 53 0a 23 20 20 20 E_TCL_STUBS.#
146e0 64 65 66 69 6e 65 20 54 63 6c 5f 49 6e 69 74 53 define Tcl_InitS
146f0 74 75 62 73 28 69 6e 74 65 72 70 2c 20 76 65 72 tubs(interp, ver
14700 73 69 6f 6e 2c 20 65 78 61 63 74 29 20 5c 0a 09 sion, exact) \..
14710 28 54 63 6c 5f 49 6e 69 74 53 74 75 62 73 29 28 (Tcl_InitStubs)(
14720 69 6e 74 65 72 70 2c 20 76 65 72 73 69 6f 6e 2c interp, version,
14730 20 5c 0a 09 20 20 20 20 28 65 78 61 63 74 29 7c \.. (exact)|
14740 28 54 43 4c 5f 4d 41 4a 4f 52 5f 56 45 52 53 49 (TCL_MAJOR_VERSI
14750 4f 4e 3c 3c 38 29 7c 28 54 43 4c 5f 4d 49 4e 4f ON<<8)|(TCL_MINO
14760 52 5f 56 45 52 53 49 4f 4e 3c 3c 31 36 29 2c 20 R_VERSION<<16),
14770 5c 0a 09 20 20 20 20 54 43 4c 5f 53 54 55 42 5f \.. TCL_STUB_
14780 4d 41 47 49 43 29 0a 23 65 6c 73 65 0a 23 20 20 MAGIC).#else.#
14790 20 64 65 66 69 6e 65 20 54 63 6c 5f 49 6e 69 74 define Tcl_Init
147a0 53 74 75 62 73 28 69 6e 74 65 72 70 2c 20 76 65 Stubs(interp, ve
147b0 72 73 69 6f 6e 2c 20 65 78 61 63 74 29 20 5c 0a rsion, exact) \.
147c0 09 54 63 6c 5f 50 6b 67 49 6e 69 74 53 74 75 62 .Tcl_PkgInitStub
147d0 73 43 68 65 63 6b 28 69 6e 74 65 72 70 2c 20 76 sCheck(interp, v
147e0 65 72 73 69 6f 6e 2c 20 5c 0a 09 09 28 65 78 61 ersion, \...(exa
147f0 63 74 29 7c 28 54 43 4c 5f 4d 41 4a 4f 52 5f 56 ct)|(TCL_MAJOR_V
14800 45 52 53 49 4f 4e 3c 3c 38 29 7c 28 54 43 4c 5f ERSION<<8)|(TCL_
14810 4d 49 4e 4f 52 5f 56 45 52 53 49 4f 4e 3c 3c 31 MINOR_VERSION<<1
14820 36 29 29 0a 23 65 6e 64 69 66 0a 0a 2f 2a 0a 20 6)).#endif../*.
14830 2a 20 50 75 62 6c 69 63 20 66 75 6e 63 74 69 6f * Public functio
14840 6e 73 20 74 68 61 74 20 61 72 65 20 6e 6f 74 20 ns that are not
14850 61 63 63 65 73 73 69 62 6c 65 20 76 69 61 20 74 accessible via t
14860 68 65 20 73 74 75 62 73 20 74 61 62 6c 65 2e 0a he stubs table..
14870 20 2a 20 54 63 6c 5f 47 65 74 4d 65 6d 6f 72 79 * Tcl_GetMemory
14880 49 6e 66 6f 20 69 73 20 6e 65 65 64 65 64 20 66 Info is needed f
14890 6f 72 20 41 4f 4c 73 65 72 76 65 72 2e 20 5b 42 or AOLserver. [B
148a0 75 67 20 31 38 36 38 31 37 31 5d 0a 20 2a 2f 0a ug 1868171]. */.
148b0 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f 4d 61 69 .#define Tcl_Mai
148c0 6e 28 61 72 67 63 2c 20 61 72 67 76 2c 20 70 72 n(argc, argv, pr
148d0 6f 63 29 20 54 63 6c 5f 4d 61 69 6e 45 78 28 61 oc) Tcl_MainEx(a
148e0 72 67 63 2c 20 61 72 67 76 2c 20 70 72 6f 63 2c rgc, argv, proc,
148f0 20 5c 0a 09 20 20 20 20 28 28 54 63 6c 5f 53 65 \.. ((Tcl_Se
14900 74 50 61 6e 69 63 50 72 6f 63 28 54 63 6c 5f 43 tPanicProc(Tcl_C
14910 6f 6e 73 6f 6c 65 50 61 6e 69 63 29 2c 20 54 63 onsolePanic), Tc
14920 6c 5f 43 72 65 61 74 65 49 6e 74 65 72 70 28 29 l_CreateInterp()
14930 29 29 29 0a 45 58 54 45 52 4e 20 54 43 4c 5f 4e ))).EXTERN TCL_N
14940 4f 52 45 54 55 52 4e 20 76 6f 69 64 20 54 63 6c ORETURN void Tcl
14950 5f 4d 61 69 6e 45 78 28 54 63 6c 5f 53 69 7a 65 _MainEx(Tcl_Size
14960 20 61 72 67 63 2c 20 63 68 61 72 20 2a 2a 61 72 argc, char **ar
14970 67 76 2c 0a 09 09 09 20 20 20 20 54 63 6c 5f 41 gv,.... Tcl_A
14980 70 70 49 6e 69 74 50 72 6f 63 20 2a 61 70 70 49 ppInitProc *appI
14990 6e 69 74 50 72 6f 63 2c 20 54 63 6c 5f 49 6e 74 nitProc, Tcl_Int
149a0 65 72 70 20 2a 69 6e 74 65 72 70 29 3b 0a 45 58 erp *interp);.EX
149b0 54 45 52 4e 20 63 6f 6e 73 74 20 63 68 61 72 20 TERN const char
149c0 2a 09 54 63 6c 5f 50 6b 67 49 6e 69 74 53 74 75 *.Tcl_PkgInitStu
149d0 62 73 43 68 65 63 6b 28 54 63 6c 5f 49 6e 74 65 bsCheck(Tcl_Inte
149e0 72 70 20 2a 69 6e 74 65 72 70 2c 0a 09 09 09 20 rp *interp,....
149f0 20 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 76 const char *v
14a00 65 72 73 69 6f 6e 2c 20 69 6e 74 20 65 78 61 63 ersion, int exac
14a10 74 29 3b 0a 45 58 54 45 52 4e 20 63 6f 6e 73 74 t);.EXTERN const
14a20 20 63 68 61 72 20 2a 09 54 63 6c 5f 49 6e 69 74 char *.Tcl_Init
14a30 53 75 62 73 79 73 74 65 6d 73 28 76 6f 69 64 29 Subsystems(void)
14a40 3b 0a 45 58 54 45 52 4e 20 76 6f 69 64 09 09 54 ;.EXTERN void..T
14a50 63 6c 5f 47 65 74 4d 65 6d 6f 72 79 49 6e 66 6f cl_GetMemoryInfo
14a60 28 54 63 6c 5f 44 53 74 72 69 6e 67 20 2a 64 73 (Tcl_DString *ds
14a70 50 74 72 29 3b 0a 45 58 54 45 52 4e 20 63 6f 6e Ptr);.EXTERN con
14a80 73 74 20 63 68 61 72 20 2a 09 54 63 6c 5f 46 69 st char *.Tcl_Fi
14a90 6e 64 45 78 65 63 75 74 61 62 6c 65 28 63 6f 6e ndExecutable(con
14aa0 73 74 20 63 68 61 72 20 2a 61 72 67 76 30 29 3b st char *argv0);
14ab0 0a 45 58 54 45 52 4e 20 63 6f 6e 73 74 20 63 68 .EXTERN const ch
14ac0 61 72 20 2a 09 54 63 6c 5f 53 65 74 50 72 65 49 ar *.Tcl_SetPreI
14ad0 6e 69 74 53 63 72 69 70 74 28 63 6f 6e 73 74 20 nitScript(const
14ae0 63 68 61 72 20 2a 73 74 72 69 6e 67 29 3b 0a 45 char *string);.E
14af0 58 54 45 52 4e 20 63 6f 6e 73 74 20 63 68 61 72 XTERN const char
14b00 20 2a 09 54 63 6c 5f 53 65 74 50 61 6e 69 63 50 *.Tcl_SetPanicP
14b10 72 6f 63 28 0a 09 09 09 20 20 20 20 54 63 6c 5f roc(.... Tcl_
14b20 50 61 6e 69 63 50 72 6f 63 20 2a 70 61 6e 69 63 PanicProc *panic
14b30 50 72 6f 63 29 3b 0a 45 58 54 45 52 4e 20 76 6f Proc);.EXTERN vo
14b40 69 64 09 09 54 63 6c 5f 53 74 61 74 69 63 4c 69 id..Tcl_StaticLi
14b50 62 72 61 72 79 28 54 63 6c 5f 49 6e 74 65 72 70 brary(Tcl_Interp
14b60 20 2a 69 6e 74 65 72 70 2c 0a 09 09 09 20 20 20 *interp,....
14b70 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 70 72 65 const char *pre
14b80 66 69 78 2c 0a 09 09 09 20 20 20 20 54 63 6c 5f fix,.... Tcl_
14b90 4c 69 62 72 61 72 79 49 6e 69 74 50 72 6f 63 20 LibraryInitProc
14ba0 2a 69 6e 69 74 50 72 6f 63 2c 0a 09 09 09 20 20 *initProc,....
14bb0 20 20 54 63 6c 5f 4c 69 62 72 61 72 79 49 6e 69 Tcl_LibraryIni
14bc0 74 50 72 6f 63 20 2a 73 61 66 65 49 6e 69 74 50 tProc *safeInitP
14bd0 72 6f 63 29 3b 0a 23 69 66 6e 64 65 66 20 54 43 roc);.#ifndef TC
14be0 4c 5f 4e 4f 5f 44 45 50 52 45 43 41 54 45 44 0a L_NO_DEPRECATED.
14bf0 23 20 20 20 64 65 66 69 6e 65 20 54 63 6c 5f 53 # define Tcl_S
14c00 74 61 74 69 63 50 61 63 6b 61 67 65 20 54 63 6c taticPackage Tcl
14c10 5f 53 74 61 74 69 63 4c 69 62 72 61 72 79 0a 23 _StaticLibrary.#
14c20 65 6e 64 69 66 0a 45 58 54 45 52 4e 20 54 63 6c endif.EXTERN Tcl
14c30 5f 45 78 69 74 50 72 6f 63 20 2a 09 54 63 6c 5f _ExitProc *.Tcl_
14c40 53 65 74 45 78 69 74 50 72 6f 63 28 54 63 6c 5f SetExitProc(Tcl_
14c50 45 78 69 74 50 72 6f 63 20 2a 70 72 6f 63 29 3b ExitProc *proc);
14c60 0a 23 69 66 64 65 66 20 5f 57 49 4e 33 32 0a 45 .#ifdef _WIN32.E
14c70 58 54 45 52 4e 20 63 6f 6e 73 74 20 63 68 61 72 XTERN const char
14c80 20 2a 09 54 63 6c 5a 69 70 66 73 5f 41 70 70 48 *.TclZipfs_AppH
14c90 6f 6f 6b 28 69 6e 74 20 2a 61 72 67 63 2c 20 75 ook(int *argc, u
14ca0 6e 73 69 67 6e 65 64 20 73 68 6f 72 74 20 2a 2a nsigned short **
14cb0 2a 61 72 67 76 29 3b 0a 23 65 6c 73 65 0a 45 58 *argv);.#else.EX
14cc0 54 45 52 4e 20 63 6f 6e 73 74 20 63 68 61 72 20 TERN const char
14cd0 2a 09 54 63 6c 5a 69 70 66 73 5f 41 70 70 48 6f *.TclZipfs_AppHo
14ce0 6f 6b 28 69 6e 74 20 2a 61 72 67 63 2c 20 63 68 ok(int *argc, ch
14cf0 61 72 20 2a 2a 2a 61 72 67 76 29 3b 0a 23 65 6e ar ***argv);.#en
14d00 64 69 66 0a 23 69 66 20 64 65 66 69 6e 65 64 28 dif.#if defined(
14d10 5f 57 49 4e 33 32 29 20 26 26 20 64 65 66 69 6e _WIN32) && defin
14d20 65 64 28 55 4e 49 43 4f 44 45 29 0a 23 69 66 6e ed(UNICODE).#ifn
14d30 64 65 66 20 55 53 45 5f 54 43 4c 5f 53 54 55 42 def USE_TCL_STUB
14d40 53 0a 23 20 20 20 64 65 66 69 6e 65 20 54 63 6c S.# define Tcl
14d50 5f 46 69 6e 64 45 78 65 63 75 74 61 62 6c 65 28 _FindExecutable(
14d60 61 72 67 29 20 28 28 54 63 6c 5f 46 69 6e 64 45 arg) ((Tcl_FindE
14d70 78 65 63 75 74 61 62 6c 65 29 28 28 63 6f 6e 73 xecutable)((cons
14d80 74 20 63 68 61 72 20 2a 29 28 61 72 67 29 29 29 t char *)(arg)))
14d90 0a 23 65 6e 64 69 66 0a 23 20 20 20 64 65 66 69 .#endif.# defi
14da0 6e 65 20 54 63 6c 5f 4d 61 69 6e 45 78 20 54 63 ne Tcl_MainEx Tc
14db0 6c 5f 4d 61 69 6e 45 78 57 0a 20 20 20 20 45 58 l_MainExW. EX
14dc0 54 45 52 4e 20 54 43 4c 5f 4e 4f 52 45 54 55 52 TERN TCL_NORETUR
14dd0 4e 20 76 6f 69 64 20 54 63 6c 5f 4d 61 69 6e 45 N void Tcl_MainE
14de0 78 57 28 54 63 6c 5f 53 69 7a 65 20 61 72 67 63 xW(Tcl_Size argc
14df0 2c 20 75 6e 73 69 67 6e 65 64 20 73 68 6f 72 74 , unsigned short
14e00 20 2a 2a 61 72 67 76 2c 0a 09 20 20 20 20 54 63 **argv,.. Tc
14e10 6c 5f 41 70 70 49 6e 69 74 50 72 6f 63 20 2a 61 l_AppInitProc *a
14e20 70 70 49 6e 69 74 50 72 6f 63 2c 20 54 63 6c 5f ppInitProc, Tcl_
14e30 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 29 3b Interp *interp);
14e40 0a 23 65 6e 64 69 66 0a 23 69 66 20 64 65 66 69 .#endif.#if defi
14e50 6e 65 64 28 55 53 45 5f 54 43 4c 5f 53 54 55 42 ned(USE_TCL_STUB
14e60 53 29 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f 53 S).#define Tcl_S
14e70 65 74 50 61 6e 69 63 50 72 6f 63 28 70 61 6e 69 etPanicProc(pani
14e80 63 50 72 6f 63 29 20 5c 0a 20 20 20 20 54 63 6c cProc) \. Tcl
14e90 49 6e 69 74 53 74 75 62 54 61 62 6c 65 28 28 28 InitStubTable(((
14ea0 63 6f 6e 73 74 20 63 68 61 72 20 2a 28 2a 29 28 const char *(*)(
14eb0 54 63 6c 5f 50 61 6e 69 63 50 72 6f 63 20 2a 29 Tcl_PanicProc *)
14ec0 29 54 63 6c 53 74 75 62 43 61 6c 6c 28 28 76 6f )TclStubCall((vo
14ed0 69 64 20 2a 29 70 61 6e 69 63 50 72 6f 63 29 29 id *)panicProc))
14ee0 28 70 61 6e 69 63 50 72 6f 63 29 29 0a 23 64 65 (panicProc)).#de
14ef0 66 69 6e 65 20 54 63 6c 5f 49 6e 69 74 53 75 62 fine Tcl_InitSub
14f00 73 79 73 74 65 6d 73 28 29 20 5c 0a 20 20 20 20 systems() \.
14f10 54 63 6c 49 6e 69 74 53 74 75 62 54 61 62 6c 65 TclInitStubTable
14f20 28 28 28 63 6f 6e 73 74 20 63 68 61 72 20 2a 28 (((const char *(
14f30 2a 29 28 76 6f 69 64 29 29 54 63 6c 53 74 75 62 *)(void))TclStub
14f40 43 61 6c 6c 28 28 76 6f 69 64 20 2a 29 31 29 29 Call((void *)1))
14f50 28 29 29 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f ()).#define Tcl_
14f60 46 69 6e 64 45 78 65 63 75 74 61 62 6c 65 28 61 FindExecutable(a
14f70 72 67 76 30 29 20 5c 0a 20 20 20 20 54 63 6c 49 rgv0) \. TclI
14f80 6e 69 74 53 74 75 62 54 61 62 6c 65 28 28 28 63 nitStubTable(((c
14f90 6f 6e 73 74 20 63 68 61 72 20 2a 28 2a 29 28 63 onst char *(*)(c
14fa0 6f 6e 73 74 20 63 68 61 72 20 2a 29 29 54 63 6c onst char *))Tcl
14fb0 53 74 75 62 43 61 6c 6c 28 28 76 6f 69 64 20 2a StubCall((void *
14fc0 29 32 29 29 28 61 72 67 76 30 29 29 0a 23 64 65 )2))(argv0)).#de
14fd0 66 69 6e 65 20 54 63 6c 5a 69 70 66 73 5f 41 70 fine TclZipfs_Ap
14fe0 70 48 6f 6f 6b 28 61 72 67 63 70 2c 20 61 72 67 pHook(argcp, arg
14ff0 76 70 29 20 5c 0a 09 54 63 6c 49 6e 69 74 53 74 vp) \..TclInitSt
15000 75 62 54 61 62 6c 65 28 28 28 63 6f 6e 73 74 20 ubTable(((const
15010 63 68 61 72 20 2a 28 2a 29 28 69 6e 74 20 2a 2c char *(*)(int *,
15020 20 76 6f 69 64 20 2a 29 29 54 63 6c 53 74 75 62 void *))TclStub
15030 43 61 6c 6c 28 28 76 6f 69 64 20 2a 29 33 29 29 Call((void *)3))
15040 28 61 72 67 63 70 2c 20 61 72 67 76 70 29 29 0a (argcp, argvp)).
15050 23 64 65 66 69 6e 65 20 54 63 6c 5f 4d 61 69 6e #define Tcl_Main
15060 45 78 57 28 61 72 67 63 2c 20 61 72 67 76 2c 20 ExW(argc, argv,
15070 61 70 70 49 6e 69 74 50 72 6f 63 2c 20 69 6e 74 appInitProc, int
15080 65 72 70 29 20 5c 0a 09 28 76 6f 69 64 29 28 28 erp) \..(void)((
15090 63 6f 6e 73 74 20 63 68 61 72 20 2a 28 2a 29 28 const char *(*)(
150a0 54 63 6c 5f 53 69 7a 65 2c 20 63 6f 6e 73 74 20 Tcl_Size, const
150b0 76 6f 69 64 20 2a 2c 20 54 63 6c 5f 41 70 70 49 void *, Tcl_AppI
150c0 6e 69 74 50 72 6f 63 20 2a 2c 20 54 63 6c 5f 49 nitProc *, Tcl_I
150d0 6e 74 65 72 70 20 2a 29 29 20 5c 0a 09 54 63 6c nterp *)) \..Tcl
150e0 53 74 75 62 43 61 6c 6c 28 28 76 6f 69 64 20 2a StubCall((void *
150f0 29 34 29 29 28 61 72 67 63 2c 20 61 72 67 76 2c )4))(argc, argv,
15100 20 61 70 70 49 6e 69 74 50 72 6f 63 2c 20 69 6e appInitProc, in
15110 74 65 72 70 29 0a 23 69 66 20 21 64 65 66 69 6e terp).#if !defin
15120 65 64 28 5f 57 49 4e 33 32 29 20 7c 7c 20 21 64 ed(_WIN32) || !d
15130 65 66 69 6e 65 64 28 55 4e 49 43 4f 44 45 29 0a efined(UNICODE).
15140 23 64 65 66 69 6e 65 20 54 63 6c 5f 4d 61 69 6e #define Tcl_Main
15150 45 78 28 61 72 67 63 2c 20 61 72 67 76 2c 20 61 Ex(argc, argv, a
15160 70 70 49 6e 69 74 50 72 6f 63 2c 20 69 6e 74 65 ppInitProc, inte
15170 72 70 29 20 5c 0a 09 28 76 6f 69 64 29 28 28 63 rp) \..(void)((c
15180 6f 6e 73 74 20 63 68 61 72 20 2a 28 2a 29 28 54 onst char *(*)(T
15190 63 6c 5f 53 69 7a 65 2c 20 63 6f 6e 73 74 20 76 cl_Size, const v
151a0 6f 69 64 20 2a 2c 20 54 63 6c 5f 41 70 70 49 6e oid *, Tcl_AppIn
151b0 69 74 50 72 6f 63 20 2a 2c 20 54 63 6c 5f 49 6e itProc *, Tcl_In
151c0 74 65 72 70 20 2a 29 29 20 5c 0a 09 54 63 6c 53 terp *)) \..TclS
151d0 74 75 62 43 61 6c 6c 28 28 76 6f 69 64 20 2a 29 tubCall((void *)
151e0 35 29 29 28 61 72 67 63 2c 20 61 72 67 76 2c 20 5))(argc, argv,
151f0 61 70 70 49 6e 69 74 50 72 6f 63 2c 20 69 6e 74 appInitProc, int
15200 65 72 70 29 0a 23 65 6e 64 69 66 0a 23 64 65 66 erp).#endif.#def
15210 69 6e 65 20 54 63 6c 5f 53 74 61 74 69 63 4c 69 ine Tcl_StaticLi
15220 62 72 61 72 79 28 69 6e 74 65 72 70 2c 20 70 6b brary(interp, pk
15230 67 4e 61 6d 65 2c 20 69 6e 69 74 50 72 6f 63 2c gName, initProc,
15240 20 73 61 66 65 49 6e 69 74 50 72 6f 63 29 20 5c safeInitProc) \
15250 0a 09 28 76 6f 69 64 29 28 28 63 6f 6e 73 74 20 ..(void)((const
15260 63 68 61 72 20 2a 28 2a 29 28 54 63 6c 5f 49 6e char *(*)(Tcl_In
15270 74 65 72 70 20 2a 2c 20 63 6f 6e 73 74 20 63 68 terp *, const ch
15280 61 72 20 2a 2c 20 54 63 6c 5f 4c 69 62 72 61 72 ar *, Tcl_Librar
15290 79 49 6e 69 74 50 72 6f 63 20 2a 2c 20 54 63 6c yInitProc *, Tcl
152a0 5f 4c 69 62 72 61 72 79 49 6e 69 74 50 72 6f 63 _LibraryInitProc
152b0 20 2a 29 29 20 5c 0a 09 54 63 6c 53 74 75 62 43 *)) \..TclStubC
152c0 61 6c 6c 28 28 76 6f 69 64 20 2a 29 36 29 29 28 all((void *)6))(
152d0 69 6e 74 65 72 70 2c 20 70 6b 67 4e 61 6d 65 2c interp, pkgName,
152e0 20 69 6e 69 74 50 72 6f 63 2c 20 73 61 66 65 49 initProc, safeI
152f0 6e 69 74 50 72 6f 63 29 0a 23 64 65 66 69 6e 65 nitProc).#define
15300 20 54 63 6c 5f 53 65 74 45 78 69 74 50 72 6f 63 Tcl_SetExitProc
15310 28 70 72 6f 63 29 20 5c 0a 09 28 28 54 63 6c 5f (proc) \..((Tcl_
15320 45 78 69 74 50 72 6f 63 20 2a 28 2a 29 28 54 63 ExitProc *(*)(Tc
15330 6c 5f 45 78 69 74 50 72 6f 63 20 2a 29 29 54 63 l_ExitProc *))Tc
15340 6c 53 74 75 62 43 61 6c 6c 28 28 76 6f 69 64 20 lStubCall((void
15350 2a 29 37 29 29 28 70 72 6f 63 29 0a 23 64 65 66 *)7))(proc).#def
15360 69 6e 65 20 54 63 6c 5f 47 65 74 4d 65 6d 6f 72 ine Tcl_GetMemor
15370 79 49 6e 66 6f 28 64 73 50 74 72 29 20 5c 0a 09 yInfo(dsPtr) \..
15380 28 76 6f 69 64 29 28 28 63 6f 6e 73 74 20 63 68 (void)((const ch
15390 61 72 20 2a 28 2a 29 28 54 63 6c 5f 44 53 74 72 ar *(*)(Tcl_DStr
153a0 69 6e 67 20 2a 29 29 54 63 6c 53 74 75 62 43 61 ing *))TclStubCa
153b0 6c 6c 28 28 76 6f 69 64 20 2a 29 38 29 29 28 64 ll((void *)8))(d
153c0 73 50 74 72 29 0a 23 64 65 66 69 6e 65 20 54 63 sPtr).#define Tc
153d0 6c 5f 53 65 74 50 72 65 49 6e 69 74 53 63 72 69 l_SetPreInitScri
153e0 70 74 28 73 74 72 69 6e 67 29 20 5c 0a 09 28 28 pt(string) \..((
153f0 63 6f 6e 73 74 20 63 68 61 72 20 2a 28 2a 29 28 const char *(*)(
15400 63 6f 6e 73 74 20 63 68 61 72 20 2a 29 29 54 63 const char *))Tc
15410 6c 53 74 75 62 43 61 6c 6c 28 28 76 6f 69 64 20 lStubCall((void
15420 2a 29 39 29 29 28 73 74 72 69 6e 67 29 0a 23 65 *)9))(string).#e
15430 6e 64 69 66 0a 0c 0a 2f 2a 0a 20 2a 2d 2d 2d 2d ndif.../*. *----
15440 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
15450 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
15460 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
15470 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
15480 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 49 6e 63 6c --------. * Incl
15490 75 64 65 20 74 68 65 20 70 75 62 6c 69 63 20 66 ude the public f
154a0 75 6e 63 74 69 6f 6e 20 64 65 63 6c 61 72 61 74 unction declarat
154b0 69 6f 6e 73 20 74 68 61 74 20 61 72 65 20 61 63 ions that are ac
154c0 63 65 73 73 69 62 6c 65 20 76 69 61 20 74 68 65 cessible via the
154d0 20 73 74 75 62 73 0a 20 2a 20 74 61 62 6c 65 2e stubs. * table.
154e0 0a 20 2a 2f 0a 0a 23 69 6e 63 6c 75 64 65 20 22 . */..#include "
154f0 74 63 6c 44 65 63 6c 73 2e 68 22 20 20 2f 2a 20 tclDecls.h" /*
15500 49 57 59 55 20 70 72 61 67 6d 61 3a 20 65 78 70 IWYU pragma: exp
15510 6f 72 74 20 2a 2f 0a 0a 2f 2a 0a 20 2a 20 49 6e ort */../*. * In
15520 63 6c 75 64 65 20 70 6c 61 74 66 6f 72 6d 20 73 clude platform s
15530 70 65 63 69 66 69 63 20 70 75 62 6c 69 63 20 66 pecific public f
15540 75 6e 63 74 69 6f 6e 20 64 65 63 6c 61 72 61 74 unction declarat
15550 69 6f 6e 73 20 74 68 61 74 20 61 72 65 20 61 63 ions that are ac
15560 63 65 73 73 69 62 6c 65 0a 20 2a 20 76 69 61 20 cessible. * via
15570 74 68 65 20 73 74 75 62 73 20 74 61 62 6c 65 2e the stubs table.
15580 20 4d 61 6b 65 20 61 6c 6c 20 54 63 6c 4f 4f 20 Make all TclOO
15590 73 79 6d 62 6f 6c 73 20 4d 4f 44 55 4c 45 5f 53 symbols MODULE_S
155a0 43 4f 50 45 20 28 77 68 69 63 68 20 6f 6e 6c 79 COPE (which only
155b0 0a 20 2a 20 68 61 73 20 65 66 66 65 63 74 20 6f . * has effect o
155c0 6e 20 62 75 69 6c 64 69 6e 67 20 69 74 20 61 73 n building it as
155d0 20 61 20 73 68 61 72 65 64 20 6c 69 62 72 61 72 a shared librar
155e0 79 29 2e 20 53 65 65 20 74 69 63 6b 65 74 20 5b y). See ticket [
155f0 33 30 31 30 33 35 32 5d 2e 0a 20 2a 2f 0a 0a 23 3010352].. */..#
15600 69 66 20 64 65 66 69 6e 65 64 28 42 55 49 4c 44 if defined(BUILD
15610 5f 74 63 6c 29 0a 23 20 20 20 75 6e 64 65 66 20 _tcl).# undef
15620 54 43 4c 41 50 49 0a 23 20 20 20 64 65 66 69 6e TCLAPI.# defin
15630 65 20 54 43 4c 41 50 49 20 4d 4f 44 55 4c 45 5f e TCLAPI MODULE_
15640 53 43 4f 50 45 0a 23 65 6e 64 69 66 0a 0a 23 69 SCOPE.#endif..#i
15650 6e 63 6c 75 64 65 20 22 74 63 6c 50 6c 61 74 44 nclude "tclPlatD
15660 65 63 6c 73 2e 68 22 20 20 2f 2a 20 49 57 59 55 ecls.h" /* IWYU
15670 20 70 72 61 67 6d 61 3a 20 65 78 70 6f 72 74 20 pragma: export
15680 2a 2f 0a 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d */../*. *-------
15690 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
156a0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
156b0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
156c0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
156d0 2d 2d 2d 2d 2d 0a 20 2a 20 54 68 65 20 66 6f 6c -----. * The fol
156e0 6c 6f 77 69 6e 67 20 64 65 63 6c 61 72 61 74 69 lowing declarati
156f0 6f 6e 73 20 6d 61 70 20 63 6b 61 6c 6c 6f 63 20 ons map ckalloc
15700 61 6e 64 20 63 6b 66 72 65 65 20 74 6f 20 54 63 and ckfree to Tc
15710 6c 5f 41 6c 6c 6f 63 20 61 6e 64 0a 20 2a 20 54 l_Alloc and. * T
15720 63 6c 5f 46 72 65 65 20 66 6f 72 20 75 73 65 20 cl_Free for use
15730 69 6e 20 54 63 6c 2d 38 2e 78 2d 63 6f 6d 70 61 in Tcl-8.x-compa
15740 74 69 62 6c 65 20 65 78 74 65 6e 73 69 6f 6e 73 tible extensions
15750 2e 0a 20 2a 2f 0a 0a 23 69 66 6e 64 65 66 20 42 .. */..#ifndef B
15760 55 49 4c 44 5f 74 63 6c 0a 23 20 20 20 64 65 66 UILD_tcl.# def
15770 69 6e 65 20 63 6b 61 6c 6c 6f 63 20 54 63 6c 5f ine ckalloc Tcl_
15780 41 6c 6c 6f 63 0a 23 20 20 20 64 65 66 69 6e 65 Alloc.# define
15790 20 61 74 74 65 6d 70 74 63 6b 61 6c 6c 6f 63 20 attemptckalloc
157a0 54 63 6c 5f 41 74 74 65 6d 70 74 41 6c 6c 6f 63 Tcl_AttemptAlloc
157b0 0a 23 20 20 20 69 66 64 65 66 20 5f 4d 53 43 5f .# ifdef _MSC_
157c0 56 45 52 0a 09 2f 2a 20 53 69 6c 65 6e 63 65 20 VER../* Silence
157d0 69 6e 76 61 6c 69 64 20 43 34 30 39 30 20 77 61 invalid C4090 wa
157e0 72 6e 69 6e 67 73 20 2a 2f 0a 23 09 64 65 66 69 rnings */.#.defi
157f0 6e 65 20 63 6b 66 72 65 65 28 61 29 20 54 63 6c ne ckfree(a) Tcl
15800 5f 46 72 65 65 28 28 76 6f 69 64 20 2a 29 28 61 _Free((void *)(a
15810 29 29 0a 23 09 64 65 66 69 6e 65 20 63 6b 72 65 )).#.define ckre
15820 61 6c 6c 6f 63 28 61 2c 62 29 20 54 63 6c 5f 52 alloc(a,b) Tcl_R
15830 65 61 6c 6c 6f 63 28 28 76 6f 69 64 20 2a 29 28 ealloc((void *)(
15840 61 29 2c 28 62 29 29 0a 23 09 64 65 66 69 6e 65 a),(b)).#.define
15850 20 61 74 74 65 6d 70 74 63 6b 72 65 61 6c 6c 6f attemptckreallo
15860 63 28 61 2c 62 29 20 54 63 6c 5f 41 74 74 65 6d c(a,b) Tcl_Attem
15870 70 74 52 65 61 6c 6c 6f 63 28 28 76 6f 69 64 20 ptRealloc((void
15880 2a 29 28 61 29 2c 28 62 29 29 0a 23 20 20 20 65 *)(a),(b)).# e
15890 6c 73 65 0a 23 09 64 65 66 69 6e 65 20 63 6b 66 lse.#.define ckf
158a0 72 65 65 20 54 63 6c 5f 46 72 65 65 0a 23 09 64 ree Tcl_Free.#.d
158b0 65 66 69 6e 65 20 63 6b 72 65 61 6c 6c 6f 63 20 efine ckrealloc
158c0 54 63 6c 5f 52 65 61 6c 6c 6f 63 0a 23 09 64 65 Tcl_Realloc.#.de
158d0 66 69 6e 65 20 61 74 74 65 6d 70 74 63 6b 72 65 fine attemptckre
158e0 61 6c 6c 6f 63 20 54 63 6c 5f 41 74 74 65 6d 70 alloc Tcl_Attemp
158f0 74 52 65 61 6c 6c 6f 63 0a 23 20 20 20 65 6e 64 tRealloc.# end
15900 69 66 0a 23 65 6e 64 69 66 0a 0a 23 69 66 6e 64 if.#endif..#ifnd
15910 65 66 20 54 43 4c 5f 4d 45 4d 5f 44 45 42 55 47 ef TCL_MEM_DEBUG
15920 0a 0a 2f 2a 0a 20 2a 20 49 66 20 77 65 20 61 72 ../*. * If we ar
15930 65 20 6e 6f 74 20 75 73 69 6e 67 20 74 68 65 20 e not using the
15940 64 65 62 75 67 67 69 6e 67 20 61 6c 6c 6f 63 61 debugging alloca
15950 74 6f 72 2c 20 77 65 20 73 68 6f 75 6c 64 20 63 tor, we should c
15960 61 6c 6c 20 74 68 65 20 54 63 6c 5f 41 6c 6c 6f all the Tcl_Allo
15970 63 2c 0a 20 2a 20 65 74 20 61 6c 2e 20 72 6f 75 c,. * et al. rou
15980 74 69 6e 65 73 20 69 6e 20 6f 72 64 65 72 20 74 tines in order t
15990 6f 20 67 75 61 72 61 6e 74 65 65 20 74 68 61 74 o guarantee that
159a0 20 65 76 65 72 79 20 6d 6f 64 75 6c 65 20 69 73 every module is
159b0 20 75 73 69 6e 67 20 74 68 65 20 73 61 6d 65 0a using the same.
159c0 20 2a 20 6d 65 6d 6f 72 79 20 61 6c 6c 6f 63 61 * memory alloca
159d0 74 6f 72 20 62 6f 74 68 20 69 6e 73 69 64 65 20 tor both inside
159e0 61 6e 64 20 6f 75 74 73 69 64 65 20 6f 66 20 74 and outside of t
159f0 68 65 20 54 63 6c 20 6c 69 62 72 61 72 79 2e 0a he Tcl library..
15a00 20 2a 2f 0a 0a 23 20 20 20 75 6e 64 65 66 20 20 */..# undef
15a10 54 63 6c 5f 49 6e 69 74 4d 65 6d 6f 72 79 0a 23 Tcl_InitMemory.#
15a20 20 20 20 64 65 66 69 6e 65 20 54 63 6c 5f 49 6e define Tcl_In
15a30 69 74 4d 65 6d 6f 72 79 28 78 29 0a 23 20 20 20 itMemory(x).#
15a40 75 6e 64 65 66 20 20 54 63 6c 5f 44 75 6d 70 41 undef Tcl_DumpA
15a50 63 74 69 76 65 4d 65 6d 6f 72 79 0a 23 20 20 20 ctiveMemory.#
15a60 64 65 66 69 6e 65 20 54 63 6c 5f 44 75 6d 70 41 define Tcl_DumpA
15a70 63 74 69 76 65 4d 65 6d 6f 72 79 28 78 29 0a 23 ctiveMemory(x).#
15a80 20 20 20 75 6e 64 65 66 20 20 54 63 6c 5f 56 61 undef Tcl_Va
15a90 6c 69 64 61 74 65 41 6c 6c 4d 65 6d 6f 72 79 0a lidateAllMemory.
15aa0 23 20 20 20 64 65 66 69 6e 65 20 54 63 6c 5f 56 # define Tcl_V
15ab0 61 6c 69 64 61 74 65 41 6c 6c 4d 65 6d 6f 72 79 alidateAllMemory
15ac0 28 78 2c 79 29 0a 0a 23 65 6e 64 69 66 20 2f 2a (x,y)..#endif /*
15ad0 20 21 54 43 4c 5f 4d 45 4d 5f 44 45 42 55 47 20 !TCL_MEM_DEBUG
15ae0 2a 2f 0a 0a 23 69 66 64 65 66 20 54 43 4c 5f 4d */..#ifdef TCL_M
15af0 45 4d 5f 44 45 42 55 47 0a 23 20 20 20 75 6e 64 EM_DEBUG.# und
15b00 65 66 20 54 63 6c 5f 49 6e 63 72 52 65 66 43 6f ef Tcl_IncrRefCo
15b10 75 6e 74 0a 23 20 20 20 64 65 66 69 6e 65 20 54 unt.# define T
15b20 63 6c 5f 49 6e 63 72 52 65 66 43 6f 75 6e 74 28 cl_IncrRefCount(
15b30 6f 62 6a 50 74 72 29 20 5c 0a 09 54 63 6c 5f 44 objPtr) \..Tcl_D
15b40 62 49 6e 63 72 52 65 66 43 6f 75 6e 74 28 6f 62 bIncrRefCount(ob
15b50 6a 50 74 72 2c 20 5f 5f 46 49 4c 45 5f 5f 2c 20 jPtr, __FILE__,
15b60 5f 5f 4c 49 4e 45 5f 5f 29 0a 23 20 20 20 75 6e __LINE__).# un
15b70 64 65 66 20 54 63 6c 5f 44 65 63 72 52 65 66 43 def Tcl_DecrRefC
15b80 6f 75 6e 74 0a 23 20 20 20 64 65 66 69 6e 65 20 ount.# define
15b90 54 63 6c 5f 44 65 63 72 52 65 66 43 6f 75 6e 74 Tcl_DecrRefCount
15ba0 28 6f 62 6a 50 74 72 29 20 5c 0a 09 54 63 6c 5f (objPtr) \..Tcl_
15bb0 44 62 44 65 63 72 52 65 66 43 6f 75 6e 74 28 6f DbDecrRefCount(o
15bc0 62 6a 50 74 72 2c 20 5f 5f 46 49 4c 45 5f 5f 2c bjPtr, __FILE__,
15bd0 20 5f 5f 4c 49 4e 45 5f 5f 29 0a 23 20 20 20 75 __LINE__).# u
15be0 6e 64 65 66 20 54 63 6c 5f 49 73 53 68 61 72 65 ndef Tcl_IsShare
15bf0 64 0a 23 20 20 20 64 65 66 69 6e 65 20 54 63 6c d.# define Tcl
15c00 5f 49 73 53 68 61 72 65 64 28 6f 62 6a 50 74 72 _IsShared(objPtr
15c10 29 20 5c 0a 09 54 63 6c 5f 44 62 49 73 53 68 61 ) \..Tcl_DbIsSha
15c20 72 65 64 28 6f 62 6a 50 74 72 2c 20 5f 5f 46 49 red(objPtr, __FI
15c30 4c 45 5f 5f 2c 20 5f 5f 4c 49 4e 45 5f 5f 29 0a LE__, __LINE__).
15c40 2f 2a 0a 20 2a 20 46 72 65 65 20 74 68 65 20 4f /*. * Free the O
15c50 62 6a 20 62 79 20 65 66 66 65 63 74 69 76 65 6c bj by effectivel
15c60 79 20 64 6f 69 6e 67 3a 0a 20 2a 0a 20 2a 20 20 y doing:. *. *
15c70 20 54 63 6c 5f 49 6e 63 72 52 65 66 43 6f 75 6e Tcl_IncrRefCoun
15c80 74 28 6f 62 6a 50 74 72 29 3b 0a 20 2a 20 20 20 t(objPtr);. *
15c90 54 63 6c 5f 44 65 63 72 52 65 66 43 6f 75 6e 74 Tcl_DecrRefCount
15ca0 28 6f 62 6a 50 74 72 29 3b 0a 20 2a 0a 20 2a 20 (objPtr);. *. *
15cb0 54 68 69 73 20 77 69 6c 6c 20 66 72 65 65 20 74 This will free t
15cc0 68 65 20 6f 62 6a 20 69 66 20 74 68 65 72 65 20 he obj if there
15cd0 61 72 65 20 6e 6f 20 72 65 66 65 72 65 6e 63 65 are no reference
15ce0 73 20 74 6f 20 74 68 65 20 6f 62 6a 2e 0a 20 2a s to the obj.. *
15cf0 2f 0a 23 20 20 20 64 65 66 69 6e 65 20 54 63 6c /.# define Tcl
15d00 5f 42 6f 75 6e 63 65 52 65 66 43 6f 75 6e 74 28 _BounceRefCount(
15d10 6f 62 6a 50 74 72 29 20 5c 0a 20 20 20 20 54 63 objPtr) \. Tc
15d20 6c 42 6f 75 6e 63 65 52 65 66 43 6f 75 6e 74 28 lBounceRefCount(
15d30 6f 62 6a 50 74 72 2c 20 5f 5f 46 49 4c 45 5f 5f objPtr, __FILE__
15d40 2c 20 5f 5f 4c 49 4e 45 5f 5f 29 0a 0a 73 74 61 , __LINE__)..sta
15d50 74 69 63 20 69 6e 6c 69 6e 65 20 76 6f 69 64 0a tic inline void.
15d60 54 63 6c 42 6f 75 6e 63 65 52 65 66 43 6f 75 6e TclBounceRefCoun
15d70 74 28 0a 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a t(. Tcl_Obj *
15d80 6f 62 6a 50 74 72 2c 0a 20 20 20 20 63 6f 6e 73 objPtr,. cons
15d90 74 20 63 68 61 72 20 2a 66 69 6c 65 2c 0a 20 20 t char *file,.
15da0 20 20 69 6e 74 20 6c 69 6e 65 29 0a 7b 0a 20 20 int line).{.
15db0 20 20 69 66 20 28 6f 62 6a 50 74 72 29 20 7b 0a if (objPtr) {.
15dc0 09 69 66 20 28 28 6f 62 6a 50 74 72 29 2d 3e 72 .if ((objPtr)->r
15dd0 65 66 43 6f 75 6e 74 20 3d 3d 20 30 29 20 7b 0a efCount == 0) {.
15de0 09 20 20 20 20 54 63 6c 5f 44 62 44 65 63 72 52 . Tcl_DbDecrR
15df0 65 66 43 6f 75 6e 74 28 6f 62 6a 50 74 72 2c 20 efCount(objPtr,
15e00 66 69 6c 65 2c 20 6c 69 6e 65 29 3b 0a 09 7d 0a file, line);..}.
15e10 20 20 20 20 7d 0a 7d 0a 23 65 6c 73 65 0a 23 20 }.}.#else.#
15e20 20 20 75 6e 64 65 66 20 54 63 6c 5f 49 6e 63 72 undef Tcl_Incr
15e30 52 65 66 43 6f 75 6e 74 0a 23 20 20 20 64 65 66 RefCount.# def
15e40 69 6e 65 20 54 63 6c 5f 49 6e 63 72 52 65 66 43 ine Tcl_IncrRefC
15e50 6f 75 6e 74 28 6f 62 6a 50 74 72 29 20 5c 0a 09 ount(objPtr) \..
15e60 28 28 76 6f 69 64 29 2b 2b 28 6f 62 6a 50 74 72 ((void)++(objPtr
15e70 29 2d 3e 72 65 66 43 6f 75 6e 74 29 0a 20 20 20 )->refCount).
15e80 20 2f 2a 0a 20 20 20 20 20 2a 20 55 73 65 20 64 /*. * Use d
15e90 6f 2f 77 68 69 6c 65 30 20 69 64 69 6f 6d 20 66 o/while0 idiom f
15ea0 6f 72 20 6f 70 74 69 6d 75 6d 20 63 6f 72 72 65 or optimum corre
15eb0 63 74 6e 65 73 73 20 77 69 74 68 6f 75 74 20 63 ctness without c
15ec0 6f 6d 70 69 6c 65 72 20 77 61 72 6e 69 6e 67 73 ompiler warnings
15ed0 2e 0a 20 20 20 20 20 2a 20 68 74 74 70 73 3a 2f .. * https:/
15ee0 2f 77 69 6b 69 2e 63 32 2e 63 6f 6d 2f 3f 54 72 /wiki.c2.com/?Tr
15ef0 69 76 69 61 6c 44 6f 57 68 69 6c 65 4c 6f 6f 70 ivialDoWhileLoop
15f00 0a 20 20 20 20 20 2a 2f 0a 23 20 20 20 75 6e 64 . */.# und
15f10 65 66 20 54 63 6c 5f 44 65 63 72 52 65 66 43 6f ef Tcl_DecrRefCo
15f20 75 6e 74 0a 23 20 20 20 64 65 66 69 6e 65 20 54 unt.# define T
15f30 63 6c 5f 44 65 63 72 52 65 66 43 6f 75 6e 74 28 cl_DecrRefCount(
15f40 6f 62 6a 50 74 72 29 20 5c 0a 09 64 6f 20 7b 09 objPtr) \..do {.
15f50 09 09 09 09 09 09 09 5c 0a 09 20 20 20 20 54 63 .......\.. Tc
15f60 6c 5f 4f 62 6a 20 2a 5f 6f 62 6a 50 74 72 20 3d l_Obj *_objPtr =
15f70 20 28 6f 62 6a 50 74 72 29 3b 09 09 09 09 5c 0a (objPtr);....\.
15f80 09 20 20 20 20 69 66 20 28 5f 6f 62 6a 50 74 72 . if (_objPtr
15f90 2d 3e 72 65 66 43 6f 75 6e 74 2d 2d 20 3c 3d 20 ->refCount-- <=
15fa0 31 29 20 7b 09 09 09 09 5c 0a 09 09 54 63 6c 46 1) {....\...TclF
15fb0 72 65 65 4f 62 6a 28 5f 6f 62 6a 50 74 72 29 3b reeObj(_objPtr);
15fc0 09 09 09 09 09 5c 0a 09 20 20 20 20 7d 09 09 09 .....\.. }...
15fd0 09 09 09 09 09 5c 0a 09 7d 20 77 68 69 6c 65 28 .....\..} while(
15fe0 30 29 0a 23 20 20 20 75 6e 64 65 66 20 54 63 6c 0).# undef Tcl
15ff0 5f 49 73 53 68 61 72 65 64 0a 23 20 20 20 64 65 _IsShared.# de
16000 66 69 6e 65 20 54 63 6c 5f 49 73 53 68 61 72 65 fine Tcl_IsShare
16010 64 28 6f 62 6a 50 74 72 29 20 5c 0a 09 28 28 6f d(objPtr) \..((o
16020 62 6a 50 74 72 29 2d 3e 72 65 66 43 6f 75 6e 74 bjPtr)->refCount
16030 20 3e 20 31 29 0a 0a 2f 2a 0a 20 2a 20 44 65 63 > 1)../*. * Dec
16040 6c 61 72 65 20 74 68 61 74 20 6f 62 6a 20 77 69 lare that obj wi
16050 6c 6c 20 6e 6f 20 6c 6f 6e 67 65 72 20 62 65 20 ll no longer be
16060 75 73 65 64 20 6f 72 20 72 65 66 65 72 65 6e 63 used or referenc
16070 65 64 2e 0a 20 2a 20 54 68 69 73 20 77 69 6c 6c ed.. * This will
16080 20 66 72 65 65 20 74 68 65 20 6f 62 6a 20 69 66 free the obj if
16090 20 74 68 65 72 65 20 61 72 65 20 6e 6f 20 72 65 there are no re
160a0 66 65 72 65 6e 63 65 73 20 74 6f 20 74 68 65 20 ferences to the
160b0 6f 62 6a 2e 0a 20 2a 2f 0a 23 20 20 20 64 65 66 obj.. */.# def
160c0 69 6e 65 20 54 63 6c 5f 42 6f 75 6e 63 65 52 65 ine Tcl_BounceRe
160d0 66 43 6f 75 6e 74 28 6f 62 6a 50 74 72 29 20 5c fCount(objPtr) \
160e0 0a 20 20 20 20 54 63 6c 42 6f 75 6e 63 65 52 65 . TclBounceRe
160f0 66 43 6f 75 6e 74 28 6f 62 6a 50 74 72 29 3b 0a fCount(objPtr);.
16100 0a 73 74 61 74 69 63 20 69 6e 6c 69 6e 65 20 76 .static inline v
16110 6f 69 64 0a 54 63 6c 42 6f 75 6e 63 65 52 65 66 oid.TclBounceRef
16120 43 6f 75 6e 74 28 0a 20 20 20 20 54 63 6c 5f 4f Count(. Tcl_O
16130 62 6a 20 2a 6f 62 6a 50 74 72 29 0a 7b 0a 20 20 bj *objPtr).{.
16140 20 20 69 66 20 28 6f 62 6a 50 74 72 29 20 7b 0a if (objPtr) {.
16150 09 69 66 20 28 28 6f 62 6a 50 74 72 29 2d 3e 72 .if ((objPtr)->r
16160 65 66 43 6f 75 6e 74 20 3d 3d 20 30 29 20 7b 0a efCount == 0) {.
16170 09 20 20 20 20 54 63 6c 5f 44 65 63 72 52 65 66 . Tcl_DecrRef
16180 43 6f 75 6e 74 28 6f 62 6a 50 74 72 29 3b 0a 09 Count(objPtr);..
16190 7d 0a 20 20 20 20 7d 0a 7d 0a 0a 23 65 6e 64 69 }. }.}..#endi
161a0 66 0a 0a 2f 2a 0a 20 2a 20 4d 61 63 72 6f 73 20 f../*. * Macros
161b0 61 6e 64 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 and definitions
161c0 74 68 61 74 20 68 65 6c 70 20 74 6f 20 64 65 62 that help to deb
161d0 75 67 20 74 68 65 20 75 73 65 20 6f 66 20 54 63 ug the use of Tc
161e0 6c 20 6f 62 6a 65 63 74 73 2e 20 57 68 65 6e 0a l objects. When.
161f0 20 2a 20 54 43 4c 5f 4d 45 4d 5f 44 45 42 55 47 * TCL_MEM_DEBUG
16200 20 69 73 20 64 65 66 69 6e 65 64 2c 20 74 68 65 is defined, the
16210 20 54 63 6c 5f 4e 65 77 20 64 65 63 6c 61 72 61 Tcl_New declara
16220 74 69 6f 6e 73 20 61 72 65 20 6f 76 65 72 72 69 tions are overri
16230 64 64 65 6e 20 74 6f 20 63 61 6c 6c 0a 20 2a 20 dden to call. *
16240 64 65 62 75 67 67 69 6e 67 20 76 65 72 73 69 6f debugging versio
16250 6e 73 20 6f 66 20 74 68 65 20 6f 62 6a 65 63 74 ns of the object
16260 20 63 72 65 61 74 69 6f 6e 20 66 75 6e 63 74 69 creation functi
16270 6f 6e 73 2e 0a 20 2a 2f 0a 0a 23 69 66 64 65 66 ons.. */..#ifdef
16280 20 54 43 4c 5f 4d 45 4d 5f 44 45 42 55 47 0a 23 TCL_MEM_DEBUG.#
16290 20 20 75 6e 64 65 66 20 20 54 63 6c 5f 4e 65 77 undef Tcl_New
162a0 42 69 67 6e 75 6d 4f 62 6a 0a 23 20 20 64 65 66 BignumObj.# def
162b0 69 6e 65 20 54 63 6c 5f 4e 65 77 42 69 67 6e 75 ine Tcl_NewBignu
162c0 6d 4f 62 6a 28 76 61 6c 29 20 5c 0a 20 20 20 20 mObj(val) \.
162d0 20 54 63 6c 5f 44 62 4e 65 77 42 69 67 6e 75 6d Tcl_DbNewBignum
162e0 4f 62 6a 28 76 61 6c 2c 20 5f 5f 46 49 4c 45 5f Obj(val, __FILE_
162f0 5f 2c 20 5f 5f 4c 49 4e 45 5f 5f 29 0a 23 20 20 _, __LINE__).#
16300 75 6e 64 65 66 20 20 54 63 6c 5f 4e 65 77 42 6f undef Tcl_NewBo
16310 6f 6c 65 61 6e 4f 62 6a 0a 23 20 20 64 65 66 69 oleanObj.# defi
16320 6e 65 20 54 63 6c 5f 4e 65 77 42 6f 6f 6c 65 61 ne Tcl_NewBoolea
16330 6e 4f 62 6a 28 76 61 6c 29 20 5c 0a 20 20 20 20 nObj(val) \.
16340 20 54 63 6c 5f 44 62 4e 65 77 57 69 64 65 49 6e Tcl_DbNewWideIn
16350 74 4f 62 6a 28 28 76 61 6c 29 21 3d 30 2c 20 5f tObj((val)!=0, _
16360 5f 46 49 4c 45 5f 5f 2c 20 5f 5f 4c 49 4e 45 5f _FILE__, __LINE_
16370 5f 29 0a 23 20 20 75 6e 64 65 66 20 20 54 63 6c _).# undef Tcl
16380 5f 4e 65 77 42 79 74 65 41 72 72 61 79 4f 62 6a _NewByteArrayObj
16390 0a 23 20 20 64 65 66 69 6e 65 20 54 63 6c 5f 4e .# define Tcl_N
163a0 65 77 42 79 74 65 41 72 72 61 79 4f 62 6a 28 62 ewByteArrayObj(b
163b0 79 74 65 73 2c 20 6c 65 6e 29 20 5c 0a 20 20 20 ytes, len) \.
163c0 20 20 54 63 6c 5f 44 62 4e 65 77 42 79 74 65 41 Tcl_DbNewByteA
163d0 72 72 61 79 4f 62 6a 28 62 79 74 65 73 2c 20 6c rrayObj(bytes, l
163e0 65 6e 2c 20 5f 5f 46 49 4c 45 5f 5f 2c 20 5f 5f en, __FILE__, __
163f0 4c 49 4e 45 5f 5f 29 0a 23 20 20 75 6e 64 65 66 LINE__).# undef
16400 20 20 54 63 6c 5f 4e 65 77 44 6f 75 62 6c 65 4f Tcl_NewDoubleO
16410 62 6a 0a 23 20 20 64 65 66 69 6e 65 20 54 63 6c bj.# define Tcl
16420 5f 4e 65 77 44 6f 75 62 6c 65 4f 62 6a 28 76 61 _NewDoubleObj(va
16430 6c 29 20 5c 0a 20 20 20 20 20 54 63 6c 5f 44 62 l) \. Tcl_Db
16440 4e 65 77 44 6f 75 62 6c 65 4f 62 6a 28 76 61 6c NewDoubleObj(val
16450 2c 20 5f 5f 46 49 4c 45 5f 5f 2c 20 5f 5f 4c 49 , __FILE__, __LI
16460 4e 45 5f 5f 29 0a 23 20 20 75 6e 64 65 66 20 20 NE__).# undef
16470 54 63 6c 5f 4e 65 77 4c 69 73 74 4f 62 6a 0a 23 Tcl_NewListObj.#
16480 20 20 64 65 66 69 6e 65 20 54 63 6c 5f 4e 65 77 define Tcl_New
16490 4c 69 73 74 4f 62 6a 28 6f 62 6a 63 2c 20 6f 62 ListObj(objc, ob
164a0 6a 76 29 20 5c 0a 20 20 20 20 20 54 63 6c 5f 44 jv) \. Tcl_D
164b0 62 4e 65 77 4c 69 73 74 4f 62 6a 28 6f 62 6a 63 bNewListObj(objc
164c0 2c 20 6f 62 6a 76 2c 20 5f 5f 46 49 4c 45 5f 5f , objv, __FILE__
164d0 2c 20 5f 5f 4c 49 4e 45 5f 5f 29 0a 23 20 20 75 , __LINE__).# u
164e0 6e 64 65 66 20 20 54 63 6c 5f 4e 65 77 4f 62 6a ndef Tcl_NewObj
164f0 0a 23 20 20 64 65 66 69 6e 65 20 54 63 6c 5f 4e .# define Tcl_N
16500 65 77 4f 62 6a 28 29 20 5c 0a 20 20 20 20 20 54 ewObj() \. T
16510 63 6c 5f 44 62 4e 65 77 4f 62 6a 28 5f 5f 46 49 cl_DbNewObj(__FI
16520 4c 45 5f 5f 2c 20 5f 5f 4c 49 4e 45 5f 5f 29 0a LE__, __LINE__).
16530 23 20 20 75 6e 64 65 66 20 20 54 63 6c 5f 4e 65 # undef Tcl_Ne
16540 77 53 74 72 69 6e 67 4f 62 6a 0a 23 20 20 64 65 wStringObj.# de
16550 66 69 6e 65 20 54 63 6c 5f 4e 65 77 53 74 72 69 fine Tcl_NewStri
16560 6e 67 4f 62 6a 28 62 79 74 65 73 2c 20 6c 65 6e ngObj(bytes, len
16570 29 20 5c 0a 20 20 20 20 20 54 63 6c 5f 44 62 4e ) \. Tcl_DbN
16580 65 77 53 74 72 69 6e 67 4f 62 6a 28 62 79 74 65 ewStringObj(byte
16590 73 2c 20 6c 65 6e 2c 20 5f 5f 46 49 4c 45 5f 5f s, len, __FILE__
165a0 2c 20 5f 5f 4c 49 4e 45 5f 5f 29 0a 23 20 20 75 , __LINE__).# u
165b0 6e 64 65 66 20 20 54 63 6c 5f 4e 65 77 57 69 64 ndef Tcl_NewWid
165c0 65 49 6e 74 4f 62 6a 0a 23 20 20 64 65 66 69 6e eIntObj.# defin
165d0 65 20 54 63 6c 5f 4e 65 77 57 69 64 65 49 6e 74 e Tcl_NewWideInt
165e0 4f 62 6a 28 76 61 6c 29 20 5c 0a 20 20 20 20 20 Obj(val) \.
165f0 54 63 6c 5f 44 62 4e 65 77 57 69 64 65 49 6e 74 Tcl_DbNewWideInt
16600 4f 62 6a 28 76 61 6c 2c 20 5f 5f 46 49 4c 45 5f Obj(val, __FILE_
16610 5f 2c 20 5f 5f 4c 49 4e 45 5f 5f 29 0a 23 65 6e _, __LINE__).#en
16620 64 69 66 20 2f 2a 20 54 43 4c 5f 4d 45 4d 5f 44 dif /* TCL_MEM_D
16630 45 42 55 47 20 2a 2f 0a 0a 2f 2a 0a 20 2a 2d 2d EBUG */../*. *--
16640 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
16650 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
16660 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
16670 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
16680 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 4d 61 ----------. * Ma
16690 63 72 6f 73 20 66 6f 72 20 63 6c 69 65 6e 74 73 cros for clients
166a0 20 74 6f 20 75 73 65 20 74 6f 20 61 63 63 65 73 to use to acces
166b0 73 20 66 69 65 6c 64 73 20 6f 66 20 68 61 73 68 s fields of hash
166c0 20 65 6e 74 72 69 65 73 3a 0a 20 2a 2f 0a 0a 23 entries:. */..#
166d0 64 65 66 69 6e 65 20 54 63 6c 5f 47 65 74 48 61 define Tcl_GetHa
166e0 73 68 56 61 6c 75 65 28 68 29 20 28 28 68 29 2d shValue(h) ((h)-
166f0 3e 63 6c 69 65 6e 74 44 61 74 61 29 0a 23 64 65 >clientData).#de
16700 66 69 6e 65 20 54 63 6c 5f 53 65 74 48 61 73 68 fine Tcl_SetHash
16710 56 61 6c 75 65 28 68 2c 20 76 61 6c 75 65 29 20 Value(h, value)
16720 28 28 68 29 2d 3e 63 6c 69 65 6e 74 44 61 74 61 ((h)->clientData
16730 20 3d 20 28 76 6f 69 64 20 2a 29 28 76 61 6c 75 = (void *)(valu
16740 65 29 29 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f e)).#define Tcl_
16750 47 65 74 48 61 73 68 4b 65 79 28 74 61 62 6c 65 GetHashKey(table
16760 50 74 72 2c 20 68 29 20 5c 0a 09 28 28 76 6f 69 Ptr, h) \..((voi
16770 64 20 2a 29 20 28 28 28 74 61 62 6c 65 50 74 72 d *) (((tablePtr
16780 29 2d 3e 6b 65 79 54 79 70 65 20 3d 3d 20 54 43 )->keyType == TC
16790 4c 5f 4f 4e 45 5f 57 4f 52 44 5f 4b 45 59 53 20 L_ONE_WORD_KEYS
167a0 7c 7c 09 09 5c 0a 09 09 20 20 20 20 28 74 61 62 ||..\... (tab
167b0 6c 65 50 74 72 29 2d 3e 6b 65 79 54 79 70 65 20 lePtr)->keyType
167c0 3d 3d 20 54 43 4c 5f 43 55 53 54 4f 4d 5f 50 54 == TCL_CUSTOM_PT
167d0 52 5f 4b 45 59 53 29 09 09 5c 0a 09 09 3f 20 28 R_KEYS)..\...? (
167e0 68 29 2d 3e 6b 65 79 2e 6f 6e 65 57 6f 72 64 56 h)->key.oneWordV
167f0 61 6c 75 65 09 09 09 09 09 5c 0a 09 09 3a 20 28 alue.....\...: (
16800 68 29 2d 3e 6b 65 79 2e 73 74 72 69 6e 67 29 29 h)->key.string))
16810 0a 0a 2f 2a 0a 20 2a 20 4d 61 63 72 6f 73 20 74 ../*. * Macros t
16820 6f 20 75 73 65 20 66 6f 72 20 63 6c 69 65 6e 74 o use for client
16830 73 20 74 6f 20 75 73 65 20 74 6f 20 69 6e 76 6f s to use to invo
16840 6b 65 20 66 69 6e 64 20 61 6e 64 20 63 72 65 61 ke find and crea
16850 74 65 20 66 75 6e 63 74 69 6f 6e 73 20 66 6f 72 te functions for
16860 0a 20 2a 20 68 61 73 68 20 74 61 62 6c 65 73 3a . * hash tables:
16870 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 63 . */..#define Tc
16880 6c 5f 46 69 6e 64 48 61 73 68 45 6e 74 72 79 28 l_FindHashEntry(
16890 74 61 62 6c 65 50 74 72 2c 20 6b 65 79 29 20 5c tablePtr, key) \
168a0 0a 09 28 2a 28 28 74 61 62 6c 65 50 74 72 29 2d ..(*((tablePtr)-
168b0 3e 63 72 65 61 74 65 50 72 6f 63 29 29 28 74 61 >createProc))(ta
168c0 62 6c 65 50 74 72 2c 20 28 63 6f 6e 73 74 20 63 blePtr, (const c
168d0 68 61 72 20 2a 29 28 6b 65 79 29 2c 20 28 69 6e har *)(key), (in
168e0 74 20 2a 29 2d 31 29 0a 23 64 65 66 69 6e 65 20 t *)-1).#define
168f0 54 63 6c 5f 41 74 74 65 6d 70 74 43 72 65 61 74 Tcl_AttemptCreat
16900 65 48 61 73 68 45 6e 74 72 79 28 74 61 62 6c 65 eHashEntry(table
16910 50 74 72 2c 20 6b 65 79 2c 20 6e 65 77 50 74 72 Ptr, key, newPtr
16920 29 20 5c 0a 09 28 2a 28 28 74 61 62 6c 65 50 74 ) \..(*((tablePt
16930 72 29 2d 3e 63 72 65 61 74 65 50 72 6f 63 29 29 r)->createProc))
16940 28 74 61 62 6c 65 50 74 72 2c 20 28 63 6f 6e 73 (tablePtr, (cons
16950 74 20 63 68 61 72 20 2a 29 28 6b 65 79 29 2c 20 t char *)(key),
16960 6e 65 77 50 74 72 29 0a 23 69 66 64 65 66 20 54 newPtr).#ifdef T
16970 43 4c 5f 4d 45 4d 5f 44 45 42 55 47 0a 23 75 6e CL_MEM_DEBUG.#un
16980 64 65 66 20 54 63 6c 5f 43 72 65 61 74 65 48 61 def Tcl_CreateHa
16990 73 68 45 6e 74 72 79 0a 23 64 65 66 69 6e 65 20 shEntry.#define
169a0 54 63 6c 5f 43 72 65 61 74 65 48 61 73 68 45 6e Tcl_CreateHashEn
169b0 74 72 79 28 74 61 62 6c 65 50 74 72 2c 20 6b 65 try(tablePtr, ke
169c0 79 2c 20 6e 65 77 50 74 72 29 20 5c 0a 09 09 54 y, newPtr) \...T
169d0 63 6c 5f 44 62 43 72 65 61 74 65 48 61 73 68 45 cl_DbCreateHashE
169e0 6e 74 72 79 28 74 61 62 6c 65 50 74 72 2c 20 6b ntry(tablePtr, k
169f0 65 79 2c 20 6e 65 77 50 74 72 2c 20 5f 5f 46 49 ey, newPtr, __FI
16a00 4c 45 5f 5f 2c 20 5f 5f 4c 49 4e 45 5f 5f 29 0a LE__, __LINE__).
16a10 23 65 6e 64 69 66 0a 0a 23 65 6e 64 69 66 20 2f #endif..#endif /
16a20 2a 20 52 43 5f 49 4e 56 4f 4b 45 44 20 2a 2f 0a * RC_INVOKED */.
16a30 0a 2f 2a 0a 20 2a 20 65 6e 64 20 62 6c 6f 63 6b ./*. * end block
16a40 20 66 6f 72 20 43 2b 2b 0a 20 2a 2f 0a 0a 23 69 for C++. */..#i
16a50 66 64 65 66 20 5f 5f 63 70 6c 75 73 70 6c 75 73 fdef __cplusplus
16a60 0a 7d 0a 23 65 6e 64 69 66 0a 0a 23 65 6e 64 69 .}.#endif..#endi
16a70 66 20 2f 2a 20 5f 54 43 4c 20 2a 2f 0a 0c 0a 2f f /* _TCL */.../
16a80 2a 0a 20 2a 20 4c 6f 63 61 6c 20 56 61 72 69 61 *. * Local Varia
16a90 62 6c 65 73 3a 0a 20 2a 20 6d 6f 64 65 3a 20 63 bles:. * mode: c
16aa0 0a 20 2a 20 63 2d 62 61 73 69 63 2d 6f 66 66 73 . * c-basic-offs
16ab0 65 74 3a 20 34 0a 20 2a 20 66 69 6c 6c 2d 63 6f et: 4. * fill-co
16ac0 6c 75 6d 6e 3a 20 37 38 0a 20 2a 20 45 6e 64 3a lumn: 78. * End:
16ad0 0a 20 2a 2f 0a . */.