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 28 21 64 65 66 69 6e 65 64 28 5f 5f 55 53 & (!defined(__US
2290: 45 5f 4d 49 4e 47 57 5f 41 4e 53 49 5f 53 54 44 E_MINGW_ANSI_STD
22a0: 49 4f 29 20 7c 7c 20 21 5f 5f 55 53 45 5f 4d 49 IO) || !__USE_MI
22b0: 4e 47 57 5f 41 4e 53 49 5f 53 54 44 49 4f 29 0a NGW_ANSI_STDIO).
22c0: 23 09 64 65 66 69 6e 65 20 54 43 4c 5f 4c 4c 5f #.define TCL_LL_
22d0: 4d 4f 44 49 46 49 45 52 09 22 49 36 34 22 0a 23 MODIFIER."I64".#
22e0: 20 20 20 65 6c 73 65 0a 23 09 64 65 66 69 6e 65 else.#.define
22f0: 20 54 43 4c 5f 4c 4c 5f 4d 4f 44 49 46 49 45 52 TCL_LL_MODIFIER
2300: 09 22 6c 6c 22 0a 23 20 20 20 65 6e 64 69 66 0a ."ll".# endif.
2310: 23 65 6e 64 69 66 20 2f 2a 20 21 54 43 4c 5f 4c #endif /* !TCL_L
2320: 4c 5f 4d 4f 44 49 46 49 45 52 20 2a 2f 0a 23 69 L_MODIFIER */.#i
2330: 66 6e 64 65 66 20 54 43 4c 5f 5a 5f 4d 4f 44 49 fndef TCL_Z_MODI
2340: 46 49 45 52 0a 23 20 20 20 69 66 20 64 65 66 69 FIER.# if defi
2350: 6e 65 64 28 5f 5f 47 4e 55 43 5f 5f 29 20 26 26 ned(__GNUC__) &&
2360: 20 21 64 65 66 69 6e 65 64 28 5f 57 49 4e 33 32 !defined(_WIN32
2370: 29 0a 23 09 64 65 66 69 6e 65 20 54 43 4c 5f 5a ).#.define TCL_Z
2380: 5f 4d 4f 44 49 46 49 45 52 09 22 7a 22 0a 23 20 _MODIFIER."z".#
2390: 20 20 65 6c 69 66 20 64 65 66 69 6e 65 64 28 5f elif defined(_
23a0: 57 49 4e 36 34 29 0a 23 09 64 65 66 69 6e 65 20 WIN64).#.define
23b0: 54 43 4c 5f 5a 5f 4d 4f 44 49 46 49 45 52 09 54 TCL_Z_MODIFIER.T
23c0: 43 4c 5f 4c 4c 5f 4d 4f 44 49 46 49 45 52 0a 23 CL_LL_MODIFIER.#
23d0: 20 20 20 65 6c 73 65 0a 23 09 64 65 66 69 6e 65 else.#.define
23e0: 20 54 43 4c 5f 5a 5f 4d 4f 44 49 46 49 45 52 09 TCL_Z_MODIFIER.
23f0: 22 22 0a 23 20 20 20 65 6e 64 69 66 0a 23 65 6e "".# endif.#en
2400: 64 69 66 20 2f 2a 20 21 54 43 4c 5f 5a 5f 4d 4f dif /* !TCL_Z_MO
2410: 44 49 46 49 45 52 20 2a 2f 0a 23 69 66 6e 64 65 DIFIER */.#ifnde
2420: 66 20 54 43 4c 5f 54 5f 4d 4f 44 49 46 49 45 52 f TCL_T_MODIFIER
2430: 0a 23 20 20 20 69 66 20 64 65 66 69 6e 65 64 28 .# if defined(
2440: 5f 5f 47 4e 55 43 5f 5f 29 20 26 26 20 21 64 65 __GNUC__) && !de
2450: 66 69 6e 65 64 28 5f 57 49 4e 33 32 29 0a 23 09 fined(_WIN32).#.
2460: 64 65 66 69 6e 65 20 54 43 4c 5f 54 5f 4d 4f 44 define TCL_T_MOD
2470: 49 46 49 45 52 09 22 74 22 0a 23 20 20 20 65 6c IFIER."t".# el
2480: 69 66 20 64 65 66 69 6e 65 64 28 5f 57 49 4e 36 if defined(_WIN6
2490: 34 29 0a 23 09 64 65 66 69 6e 65 20 54 43 4c 5f 4).#.define TCL_
24a0: 54 5f 4d 4f 44 49 46 49 45 52 09 54 43 4c 5f 4c T_MODIFIER.TCL_L
24b0: 4c 5f 4d 4f 44 49 46 49 45 52 0a 23 20 20 20 65 L_MODIFIER.# e
24c0: 6c 73 65 0a 23 09 64 65 66 69 6e 65 20 54 43 4c lse.#.define TCL
24d0: 5f 54 5f 4d 4f 44 49 46 49 45 52 09 54 43 4c 5f _T_MODIFIER.TCL_
24e0: 5a 5f 4d 4f 44 49 46 49 45 52 0a 23 20 20 20 65 Z_MODIFIER.# e
24f0: 6e 64 69 66 0a 23 65 6e 64 69 66 20 2f 2a 20 21 ndif.#endif /* !
2500: 54 43 4c 5f 54 5f 4d 4f 44 49 46 49 45 52 20 2a TCL_T_MODIFIER *
2510: 2f 0a 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f 57 /..#define Tcl_W
2520: 69 64 65 41 73 4c 6f 6e 67 28 76 61 6c 29 09 28 ideAsLong(val).(
2530: 28 6c 6f 6e 67 29 28 28 54 63 6c 5f 57 69 64 65 (long)((Tcl_Wide
2540: 49 6e 74 29 28 76 61 6c 29 29 29 0a 23 64 65 66 Int)(val))).#def
2550: 69 6e 65 20 54 63 6c 5f 4c 6f 6e 67 41 73 57 69 ine Tcl_LongAsWi
2560: 64 65 28 76 61 6c 29 09 28 28 54 63 6c 5f 57 69 de(val).((Tcl_Wi
2570: 64 65 49 6e 74 29 28 28 6c 6f 6e 67 29 28 76 61 deInt)((long)(va
2580: 6c 29 29 29 0a 23 64 65 66 69 6e 65 20 54 63 6c l))).#define Tcl
2590: 5f 57 69 64 65 41 73 44 6f 75 62 6c 65 28 76 61 _WideAsDouble(va
25a0: 6c 29 09 28 28 64 6f 75 62 6c 65 29 28 28 54 63 l).((double)((Tc
25b0: 6c 5f 57 69 64 65 49 6e 74 29 28 76 61 6c 29 29 l_WideInt)(val))
25c0: 29 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f 44 6f ).#define Tcl_Do
25d0: 75 62 6c 65 41 73 57 69 64 65 28 76 61 6c 29 09 ubleAsWide(val).
25e0: 28 28 54 63 6c 5f 57 69 64 65 49 6e 74 29 28 28 ((Tcl_WideInt)((
25f0: 64 6f 75 62 6c 65 29 28 76 61 6c 29 29 29 0a 0a double)(val)))..
2600: 74 79 70 65 64 65 66 20 70 74 72 64 69 66 66 5f typedef ptrdiff_
2610: 74 20 54 63 6c 5f 53 69 7a 65 3b 0a 23 64 65 66 t Tcl_Size;.#def
2620: 69 6e 65 20 54 43 4c 5f 53 49 5a 45 5f 4d 41 58 ine TCL_SIZE_MAX
2630: 20 28 28 54 63 6c 5f 53 69 7a 65 29 28 28 28 73 ((Tcl_Size)(((s
2640: 69 7a 65 5f 74 29 2d 31 29 3e 3e 31 29 29 0a 23 ize_t)-1)>>1)).#
2650: 64 65 66 69 6e 65 20 54 43 4c 5f 53 49 5a 45 5f define TCL_SIZE_
2660: 4d 4f 44 49 46 49 45 52 20 54 43 4c 5f 54 5f 4d MODIFIER TCL_T_M
2670: 4f 44 49 46 49 45 52 0a 0a 23 69 66 64 65 66 20 ODIFIER..#ifdef
2680: 5f 57 49 4e 33 32 0a 20 20 20 20 74 79 70 65 64 _WIN32. typed
2690: 65 66 20 73 74 72 75 63 74 20 5f 5f 73 74 61 74 ef struct __stat
26a0: 36 34 20 54 63 6c 5f 53 74 61 74 42 75 66 3b 0a 64 Tcl_StatBuf;.
26b0: 23 65 6c 69 66 20 64 65 66 69 6e 65 64 28 5f 5f #elif defined(__
26c0: 43 59 47 57 49 4e 5f 5f 29 0a 20 20 20 20 74 79 CYGWIN__). ty
26d0: 70 65 64 65 66 20 73 74 72 75 63 74 20 7b 0a 09 pedef struct {..
26e0: 75 6e 73 69 67 6e 65 64 20 73 74 5f 64 65 76 3b unsigned st_dev;
26f0: 0a 09 75 6e 73 69 67 6e 65 64 20 73 68 6f 72 74 ..unsigned short
2700: 20 73 74 5f 69 6e 6f 3b 0a 09 75 6e 73 69 67 6e st_ino;..unsign
2710: 65 64 20 73 68 6f 72 74 20 73 74 5f 6d 6f 64 65 ed short st_mode
2720: 3b 0a 09 73 68 6f 72 74 20 73 74 5f 6e 6c 69 6e ;..short st_nlin
2730: 6b 3b 0a 09 73 68 6f 72 74 20 73 74 5f 75 69 64 k;..short st_uid
2740: 3b 0a 09 73 68 6f 72 74 20 73 74 5f 67 69 64 3b ;..short st_gid;
2750: 0a 09 2f 2a 20 48 65 72 65 20 69 73 20 61 20 32 ../* Here is a 2
2760: 2d 62 79 74 65 20 67 61 70 20 2a 2f 0a 09 75 6e -byte gap */..un
2770: 73 69 67 6e 65 64 20 73 74 5f 72 64 65 76 3b 0a signed st_rdev;.
2780: 09 2f 2a 20 48 65 72 65 20 69 73 20 61 20 34 2d ./* Here is a 4-
2790: 62 79 74 65 20 67 61 70 20 2a 2f 0a 09 6c 6f 6e byte gap */..lon
27a0: 67 20 6c 6f 6e 67 20 73 74 5f 73 69 7a 65 3b 0a g long st_size;.
27b0: 09 73 74 72 75 63 74 20 7b 6c 6f 6e 67 20 74 76 .struct {long tv
27c0: 5f 73 65 63 3b 7d 20 73 74 5f 61 74 69 6d 3b 0a _sec;} st_atim;.
27d0: 09 73 74 72 75 63 74 20 7b 6c 6f 6e 67 20 74 76 .struct {long tv
27e0: 5f 73 65 63 3b 7d 20 73 74 5f 6d 74 69 6d 3b 0a _sec;} st_mtim;.
27f0: 09 73 74 72 75 63 74 20 7b 6c 6f 6e 67 20 74 76 .struct {long tv
2800: 5f 73 65 63 3b 7d 20 73 74 5f 63 74 69 6d 3b 0a _sec;} st_ctim;.
2810: 20 20 20 20 7d 20 54 63 6c 5f 53 74 61 74 42 75 } Tcl_StatBu
2820: 66 3b 0a 23 65 6c 73 65 0a 20 20 20 20 74 79 70 f;.#else. typ
2830: 65 64 65 66 20 73 74 72 75 63 74 20 73 74 61 74 edef struct stat
2840: 20 54 63 6c 5f 53 74 61 74 42 75 66 3b 0a 23 65 Tcl_StatBuf;.#e
2850: 6e 64 69 66 0a 0c 0a 2f 2a 0a 20 2a 2d 2d 2d 2d ndif.../*. *----
2860: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
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 0a 20 2a 20 44 61 74 61 --------. * Data
28b0: 20 73 74 72 75 63 74 75 72 65 73 20 64 65 66 69 structures defi
28c0: 6e 65 64 20 6f 70 61 71 75 65 6c 79 20 69 6e 20 ned opaquely in
28d0: 74 68 69 73 20 6d 6f 64 75 6c 65 2e 20 54 68 65 this module. The
28e0: 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 62 65 6c definitions bel
28f0: 6f 77 20 6a 75 73 74 0a 20 2a 20 70 72 6f 76 69 ow just. * provi
2900: 64 65 20 64 75 6d 6d 79 20 74 79 70 65 73 2e 0a de dummy types..
2910: 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 73 74 72 */..typedef str
2920: 75 63 74 20 54 63 6c 5f 41 73 79 6e 63 48 61 6e uct Tcl_AsyncHan
2930: 64 6c 65 72 5f 20 2a 54 63 6c 5f 41 73 79 6e 63 dler_ *Tcl_Async
2940: 48 61 6e 64 6c 65 72 3b 0a 74 79 70 65 64 65 66 Handler;.typedef
2950: 20 73 74 72 75 63 74 20 54 63 6c 5f 43 68 61 6e struct Tcl_Chan
2960: 6e 65 6c 5f 20 2a 54 63 6c 5f 43 68 61 6e 6e 65 nel_ *Tcl_Channe
2970: 6c 3b 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 l;.typedef struc
2980: 74 20 54 63 6c 5f 43 68 61 6e 6e 65 6c 54 79 70 t Tcl_ChannelTyp
2990: 65 56 65 72 73 69 6f 6e 5f 20 2a 54 63 6c 5f 43 eVersion_ *Tcl_C
29a0: 68 61 6e 6e 65 6c 54 79 70 65 56 65 72 73 69 6f hannelTypeVersio
29b0: 6e 3b 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 n;.typedef struc
29c0: 74 20 54 63 6c 5f 43 6f 6d 6d 61 6e 64 5f 20 2a t Tcl_Command_ *
29d0: 54 63 6c 5f 43 6f 6d 6d 61 6e 64 3b 0a 74 79 70 Tcl_Command;.typ
29e0: 65 64 65 66 20 73 74 72 75 63 74 20 54 63 6c 5f edef struct Tcl_
29f0: 43 6f 6e 64 69 74 69 6f 6e 5f 20 2a 54 63 6c 5f Condition_ *Tcl_
2a00: 43 6f 6e 64 69 74 69 6f 6e 3b 0a 74 79 70 65 64 Condition;.typed
2a10: 65 66 20 73 74 72 75 63 74 20 54 63 6c 5f 44 69 ef struct Tcl_Di
2a20: 63 74 5f 20 2a 54 63 6c 5f 44 69 63 74 3b 0a 74 ct_ *Tcl_Dict;.t
2a30: 79 70 65 64 65 66 20 73 74 72 75 63 74 20 54 63 ypedef struct Tc
2a40: 6c 5f 45 6e 63 6f 64 69 6e 67 53 74 61 74 65 5f l_EncodingState_
2a50: 20 2a 54 63 6c 5f 45 6e 63 6f 64 69 6e 67 53 74 *Tcl_EncodingSt
2a60: 61 74 65 3b 0a 74 79 70 65 64 65 66 20 73 74 72 ate;.typedef str
2a70: 75 63 74 20 54 63 6c 5f 45 6e 63 6f 64 69 6e 67 uct Tcl_Encoding
2a80: 5f 20 2a 54 63 6c 5f 45 6e 63 6f 64 69 6e 67 3b _ *Tcl_Encoding;
2a90: 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20 .typedef struct
2aa0: 54 63 6c 5f 45 76 65 6e 74 20 54 63 6c 5f 45 76 Tcl_Event Tcl_Ev
2ab0: 65 6e 74 3b 0a 74 79 70 65 64 65 66 20 73 74 72 ent;.typedef str
2ac0: 75 63 74 20 54 63 6c 5f 49 6e 74 65 72 70 20 54 uct Tcl_Interp T
2ad0: 63 6c 5f 49 6e 74 65 72 70 3b 0a 74 79 70 65 64 cl_Interp;.typed
2ae0: 65 66 20 73 74 72 75 63 74 20 54 63 6c 5f 49 6e ef struct Tcl_In
2af0: 74 65 72 70 53 74 61 74 65 5f 20 2a 54 63 6c 5f terpState_ *Tcl_
2b00: 49 6e 74 65 72 70 53 74 61 74 65 3b 0a 74 79 70 InterpState;.typ
2b10: 65 64 65 66 20 73 74 72 75 63 74 20 54 63 6c 5f edef struct Tcl_
2b20: 4c 6f 61 64 48 61 6e 64 6c 65 5f 20 2a 54 63 6c LoadHandle_ *Tcl
2b30: 5f 4c 6f 61 64 48 61 6e 64 6c 65 3b 0a 74 79 70 _LoadHandle;.typ
2b40: 65 64 65 66 20 73 74 72 75 63 74 20 54 63 6c 5f edef struct Tcl_
2b50: 4d 75 74 65 78 5f 20 2a 54 63 6c 5f 4d 75 74 65 Mutex_ *Tcl_Mute
2b60: 78 3b 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 x;.typedef struc
2b70: 74 20 54 63 6c 5f 50 69 64 5f 20 2a 54 63 6c 5f t Tcl_Pid_ *Tcl_
2b80: 50 69 64 3b 0a 74 79 70 65 64 65 66 20 73 74 72 Pid;.typedef str
2b90: 75 63 74 20 54 63 6c 5f 52 65 67 45 78 70 5f 20 uct Tcl_RegExp_
2ba0: 2a 54 63 6c 5f 52 65 67 45 78 70 3b 0a 74 79 70 *Tcl_RegExp;.typ
2bb0: 65 64 65 66 20 73 74 72 75 63 74 20 54 63 6c 5f edef struct Tcl_
2bc0: 54 68 72 65 61 64 44 61 74 61 4b 65 79 5f 20 2a ThreadDataKey_ *
2bd0: 54 63 6c 5f 54 68 72 65 61 64 44 61 74 61 4b 65 Tcl_ThreadDataKe
2be0: 79 3b 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 y;.typedef struc
2bf0: 74 20 54 63 6c 5f 54 68 72 65 61 64 49 64 5f 20 t Tcl_ThreadId_
2c00: 2a 54 63 6c 5f 54 68 72 65 61 64 49 64 3b 0a 74 *Tcl_ThreadId;.t
2c10: 79 70 65 64 65 66 20 73 74 72 75 63 74 20 54 63 ypedef struct Tc
2c20: 6c 5f 54 69 6d 65 72 54 6f 6b 65 6e 5f 20 2a 54 l_TimerToken_ *T
2c30: 63 6c 5f 54 69 6d 65 72 54 6f 6b 65 6e 3b 0a 74 cl_TimerToken;.t
2c40: 79 70 65 64 65 66 20 73 74 72 75 63 74 20 54 63 ypedef struct Tc
2c50: 6c 5f 54 72 61 63 65 5f 20 2a 54 63 6c 5f 54 72 l_Trace_ *Tcl_Tr
2c60: 61 63 65 3b 0a 74 79 70 65 64 65 66 20 73 74 72 ace;.typedef str
2c70: 75 63 74 20 54 63 6c 5f 56 61 72 5f 20 2a 54 63 uct Tcl_Var_ *Tc
2c80: 6c 5f 56 61 72 3b 0a 74 79 70 65 64 65 66 20 73 l_Var;.typedef s
2c90: 74 72 75 63 74 20 54 63 6c 5f 5a 4c 69 62 53 74 truct Tcl_ZLibSt
2ca0: 72 65 61 6d 5f 20 2a 54 63 6c 5f 5a 6c 69 62 53 ream_ *Tcl_ZlibS
2cb0: 74 72 65 61 6d 3b 0a 0a 2f 2a 0a 20 2a 2d 2d 2d tream;../*. *---
2cc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
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 0a 20 2a 20 44 65 66 ---------. * Def
2d10: 69 6e 69 74 69 6f 6e 20 6f 66 20 74 68 65 20 69 inition of the i
2d20: 6e 74 65 72 66 61 63 65 20 74 6f 20 66 75 6e 63 nterface to func
2d30: 74 69 6f 6e 73 20 69 6d 70 6c 65 6d 65 6e 74 69 tions implementi
2d40: 6e 67 20 74 68 72 65 61 64 73 2e 20 41 20 66 75 ng threads. A fu
2d50: 6e 63 74 69 6f 6e 0a 20 2a 20 66 6f 6c 6c 6f 77 nction. * follow
2d60: 69 6e 67 20 74 68 69 73 20 64 65 66 69 6e 69 74 ing this definit
2d70: 69 6f 6e 20 69 73 20 67 69 76 65 6e 20 74 6f 20 ion is given to
2d80: 65 61 63 68 20 63 61 6c 6c 20 6f 66 20 27 54 63 each call of 'Tc
2d90: 6c 5f 43 72 65 61 74 65 54 68 72 65 61 64 27 20 l_CreateThread'
2da0: 61 6e 64 0a 20 2a 20 77 69 6c 6c 20 62 65 20 63 and. * will be c
2db0: 61 6c 6c 65 64 20 61 73 20 74 68 65 20 6d 61 69 alled as the mai
2dc0: 6e 20 66 75 63 74 69 6f 6e 20 6f 66 20 74 68 65 n fuction of the
2dd0: 20 6e 65 77 20 74 68 72 65 61 64 20 63 72 65 61 new thread crea
2de0: 74 65 64 20 62 79 20 74 68 61 74 20 63 61 6c 6c ted by that call
2df0: 2e 0a 20 2a 2f 0a 0a 23 69 66 20 64 65 66 69 6e .. */..#if defin
2e00: 65 64 20 5f 57 49 4e 33 32 0a 74 79 70 65 64 65 ed _WIN32.typede
2e10: 66 20 75 6e 73 69 67 6e 65 64 20 28 5f 5f 73 74 f unsigned (__st
2e20: 64 63 61 6c 6c 20 54 63 6c 5f 54 68 72 65 61 64 dcall Tcl_Thread
2e30: 43 72 65 61 74 65 50 72 6f 63 29 20 28 76 6f 69 CreateProc) (voi
2e40: 64 20 2a 63 6c 69 65 6e 74 44 61 74 61 29 3b 0a d *clientData);.
2e50: 23 65 6c 73 65 0a 74 79 70 65 64 65 66 20 76 6f #else.typedef vo
2e60: 69 64 20 28 54 63 6c 5f 54 68 72 65 61 64 43 72 id (Tcl_ThreadCr
2e70: 65 61 74 65 50 72 6f 63 29 20 28 76 6f 69 64 20 eateProc) (void
2e80: 2a 63 6c 69 65 6e 74 44 61 74 61 29 3b 0a 23 65 *clientData);.#e
2e90: 6e 64 69 66 0a 0a 2f 2a 0a 20 2a 20 54 68 72 65 ndif../*. * Thre
2ea0: 61 64 69 6e 67 20 66 75 6e 63 74 69 6f 6e 20 72 ading function r
2eb0: 65 74 75 72 6e 20 74 79 70 65 73 20 75 73 65 64 eturn types used
2ec0: 20 66 6f 72 20 61 62 73 74 72 61 63 74 69 6e 67 for abstracting
2ed0: 20 61 77 61 79 20 70 6c 61 74 66 6f 72 6d 0a 20 away platform.
2ee0: 2a 20 64 69 66 66 65 72 65 6e 63 65 73 20 77 68 * differences wh
2ef0: 65 6e 20 77 72 69 74 69 6e 67 20 61 20 54 63 6c en writing a Tcl
2f00: 5f 54 68 72 65 61 64 43 72 65 61 74 65 50 72 6f _ThreadCreatePro
2f10: 63 2e 20 53 65 65 20 74 68 65 20 4e 65 77 54 68 c. See the NewTh
2f20: 72 65 61 64 20 66 75 6e 63 74 69 6f 6e 0a 20 2a read function. *
2f30: 20 69 6e 20 67 65 6e 65 72 69 63 2f 74 63 6c 54 in generic/tclT
2f40: 68 72 65 61 64 54 65 73 74 2e 63 20 66 6f 72 20 hreadTest.c for
2f50: 69 74 27 73 20 75 73 61 67 65 2e 0a 20 2a 2f 0a it's usage.. */.
2f60: 0a 23 69 66 20 64 65 66 69 6e 65 64 20 5f 57 49 .#if defined _WI
2f70: 4e 33 32 0a 23 20 20 20 64 65 66 69 6e 65 20 54 N32.# define T
2f80: 63 6c 5f 54 68 72 65 61 64 43 72 65 61 74 65 54 cl_ThreadCreateT
2f90: 79 70 65 09 09 75 6e 73 69 67 6e 65 64 20 5f 5f ype..unsigned __
2fa0: 73 74 64 63 61 6c 6c 0a 23 20 20 20 64 65 66 69 stdcall.# defi
2fb0: 6e 65 20 54 43 4c 5f 54 48 52 45 41 44 5f 43 52 ne TCL_THREAD_CR
2fc0: 45 41 54 45 5f 52 45 54 55 52 4e 09 72 65 74 75 EATE_RETURN.retu
2fd0: 72 6e 20 30 0a 23 65 6c 73 65 0a 23 20 20 20 64 rn 0.#else.# d
2fe0: 65 66 69 6e 65 20 54 63 6c 5f 54 68 72 65 61 64 efine Tcl_Thread
2ff0: 43 72 65 61 74 65 54 79 70 65 09 09 76 6f 69 64 CreateType..void
3000: 0a 23 20 20 20 64 65 66 69 6e 65 20 54 43 4c 5f .# define TCL_
3010: 54 48 52 45 41 44 5f 43 52 45 41 54 45 5f 52 45 THREAD_CREATE_RE
3020: 54 55 52 4e 0a 23 65 6e 64 69 66 0a 0a 2f 2a 0a TURN.#endif../*.
3030: 20 2a 20 44 65 66 69 6e 69 74 69 6f 6e 20 6f 66 * Definition of
3040: 20 76 61 6c 75 65 73 20 66 6f 72 20 64 65 66 61 values for defa
3050: 75 6c 74 20 73 74 61 63 6b 73 69 7a 65 20 61 6e ult stacksize an
3060: 64 20 74 68 65 20 70 6f 73 73 69 62 6c 65 20 66 d the possible f
3070: 6c 61 67 73 20 74 6f 20 62 65 0a 20 2a 20 67 69 lags to be. * gi
3080: 76 65 6e 20 74 6f 20 54 63 6c 5f 43 72 65 61 74 ven to Tcl_Creat
3090: 65 54 68 72 65 61 64 2e 0a 20 2a 2f 0a 0a 23 64 eThread.. */..#d
30a0: 65 66 69 6e 65 20 54 43 4c 5f 54 48 52 45 41 44 efine TCL_THREAD
30b0: 5f 53 54 41 43 4b 5f 44 45 46 41 55 4c 54 20 28 _STACK_DEFAULT (
30c0: 30 29 09 2f 2a 20 55 73 65 20 64 65 66 61 75 6c 0)./* Use defaul
30d0: 74 20 73 69 7a 65 20 66 6f 72 20 73 74 61 63 6b t size for stack
30e0: 2e 20 2a 2f 0a 23 64 65 66 69 6e 65 20 54 43 4c . */.#define TCL
30f0: 5f 54 48 52 45 41 44 5f 4e 4f 46 4c 41 47 53 09 _THREAD_NOFLAGS.
3100: 20 28 30 30 30 30 29 20 2f 2a 20 53 74 61 6e 64 (0000) /* Stand
3110: 61 72 64 20 66 6c 61 67 73 2c 20 64 65 66 61 75 ard flags, defau
3120: 6c 74 0a 09 09 09 09 09 20 2a 20 62 65 68 61 76 lt...... * behav
3130: 69 6f 75 72 2e 20 2a 2f 0a 23 64 65 66 69 6e 65 iour. */.#define
3140: 20 54 43 4c 5f 54 48 52 45 41 44 5f 4a 4f 49 4e TCL_THREAD_JOIN
3150: 41 42 4c 45 09 20 28 30 30 30 31 29 20 2f 2a 20 ABLE. (0001) /*
3160: 4d 61 72 6b 20 74 68 65 20 74 68 72 65 61 64 20 Mark the thread
3170: 61 73 20 6a 6f 69 6e 61 62 6c 65 2e 20 2a 2f 0a as joinable. */.
3180: 0a 2f 2a 0a 20 2a 20 46 6c 61 67 20 76 61 6c 75 ./*. * Flag valu
3190: 65 73 20 70 61 73 73 65 64 20 74 6f 20 54 63 6c es passed to Tcl
31a0: 5f 53 74 72 69 6e 67 43 61 73 65 4d 61 74 63 68 _StringCaseMatch
31b0: 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 .. */..#define T
31c0: 43 4c 5f 4d 41 54 43 48 5f 4e 4f 43 41 53 45 09 CL_MATCH_NOCASE.
31d0: 28 31 3c 3c 30 29 0a 0a 2f 2a 0a 20 2a 20 46 6c (1<<0)../*. * Fl
31e0: 61 67 20 76 61 6c 75 65 73 20 70 61 73 73 65 64 ag values passed
31f0: 20 74 6f 20 54 63 6c 5f 47 65 74 52 65 67 45 78 to Tcl_GetRegEx
3200: 70 46 72 6f 6d 4f 62 6a 2e 0a 20 2a 2f 0a 0a 23 pFromObj.. */..#
3210: 64 65 66 69 6e 65 09 54 43 4c 5f 52 45 47 5f 42 define.TCL_REG_B
3220: 41 53 49 43 09 09 30 30 30 30 30 30 09 2f 2a 20 ASIC..000000./*
3230: 42 52 45 73 20 28 63 6f 6e 76 65 6e 69 65 6e 63 BREs (convenienc
3240: 65 29 2e 20 2a 2f 0a 23 64 65 66 69 6e 65 09 54 e). */.#define.T
3250: 43 4c 5f 52 45 47 5f 45 58 54 45 4e 44 45 44 09 CL_REG_EXTENDED.
3260: 30 30 30 30 30 31 09 2f 2a 20 45 52 45 73 2e 20 000001./* EREs.
3270: 2a 2f 0a 23 64 65 66 69 6e 65 09 54 43 4c 5f 52 */.#define.TCL_R
3280: 45 47 5f 41 44 56 46 09 09 30 30 30 30 30 32 09 EG_ADVF..000002.
3290: 2f 2a 20 41 64 76 61 6e 63 65 64 20 66 65 61 74 /* Advanced feat
32a0: 75 72 65 73 20 69 6e 20 45 52 45 73 2e 20 2a 2f ures in EREs. */
32b0: 0a 23 64 65 66 69 6e 65 09 54 43 4c 5f 52 45 47 .#define.TCL_REG
32c0: 5f 41 44 56 41 4e 43 45 44 09 30 30 30 30 30 33 _ADVANCED.000003
32d0: 09 2f 2a 20 41 52 45 73 20 28 77 68 69 63 68 20 ./* AREs (which
32e0: 61 72 65 20 61 6c 73 6f 20 45 52 45 73 29 2e 20 are also EREs).
32f0: 2a 2f 0a 23 64 65 66 69 6e 65 09 54 43 4c 5f 52 */.#define.TCL_R
3300: 45 47 5f 51 55 4f 54 45 09 09 30 30 30 30 30 34 EG_QUOTE..000004
3310: 09 2f 2a 20 4e 6f 20 73 70 65 63 69 61 6c 20 63 ./* No special c
3320: 68 61 72 61 63 74 65 72 73 2c 20 6e 6f 6e 65 2e haracters, none.
3330: 20 2a 2f 0a 23 64 65 66 69 6e 65 09 54 43 4c 5f */.#define.TCL_
3340: 52 45 47 5f 4e 4f 43 41 53 45 09 09 30 30 30 30 REG_NOCASE..0000
3350: 31 30 09 2f 2a 20 49 67 6e 6f 72 65 20 63 61 73 10./* Ignore cas
3360: 65 2e 20 2a 2f 0a 23 64 65 66 69 6e 65 09 54 43 e. */.#define.TC
3370: 4c 5f 52 45 47 5f 4e 4f 53 55 42 09 09 30 30 30 L_REG_NOSUB..000
3380: 30 32 30 09 2f 2a 20 44 6f 6e 27 74 20 63 61 72 020./* Don't car
3390: 65 20 61 62 6f 75 74 20 73 75 62 65 78 70 72 65 e about subexpre
33a0: 73 73 69 6f 6e 73 2e 20 2a 2f 0a 23 64 65 66 69 ssions. */.#defi
33b0: 6e 65 09 54 43 4c 5f 52 45 47 5f 45 58 50 41 4e ne.TCL_REG_EXPAN
33c0: 44 45 44 09 30 30 30 30 34 30 09 2f 2a 20 45 78 DED.000040./* Ex
33d0: 70 61 6e 64 65 64 20 66 6f 72 6d 61 74 2c 20 77 panded format, w
33e0: 68 69 74 65 20 73 70 61 63 65 20 26 0a 09 09 09 hite space &....
33f0: 09 09 20 2a 20 63 6f 6d 6d 65 6e 74 73 2e 20 2a .. * comments. *
3400: 2f 0a 23 64 65 66 69 6e 65 09 54 43 4c 5f 52 45 /.#define.TCL_RE
3410: 47 5f 4e 4c 53 54 4f 50 09 09 30 30 30 31 30 30 G_NLSTOP..000100
3420: 20 20 2f 2a 20 5c 6e 20 64 6f 65 73 6e 27 74 20 /* \n doesn't
3430: 6d 61 74 63 68 20 2e 20 6f 72 20 5b 5e 20 5d 20 match . or [^ ]
3440: 2a 2f 0a 23 64 65 66 69 6e 65 09 54 43 4c 5f 52 */.#define.TCL_R
3450: 45 47 5f 4e 4c 41 4e 43 48 09 09 30 30 30 32 30 EG_NLANCH..00020
3460: 30 20 20 2f 2a 20 5e 20 6d 61 74 63 68 65 73 20 0 /* ^ matches
3470: 61 66 74 65 72 20 5c 6e 2c 20 24 20 62 65 66 6f after \n, $ befo
3480: 72 65 2e 20 2a 2f 0a 23 64 65 66 69 6e 65 09 54 re. */.#define.T
3490: 43 4c 5f 52 45 47 5f 4e 45 57 4c 49 4e 45 09 09 CL_REG_NEWLINE..
34a0: 30 30 30 33 30 30 20 20 2f 2a 20 4e 65 77 6c 69 000300 /* Newli
34b0: 6e 65 73 20 61 72 65 20 6c 69 6e 65 20 74 65 72 nes are line ter
34c0: 6d 69 6e 61 74 6f 72 73 2e 20 2a 2f 0a 23 64 65 minators. */.#de
34d0: 66 69 6e 65 09 54 43 4c 5f 52 45 47 5f 43 41 4e fine.TCL_REG_CAN
34e0: 4d 41 54 43 48 09 30 30 31 30 30 30 20 20 2f 2a MATCH.001000 /*
34f0: 20 52 65 70 6f 72 74 20 64 65 74 61 69 6c 73 20 Report details
3500: 6f 6e 20 70 61 72 74 69 61 6c 2f 6c 69 6d 69 74 on partial/limit
3510: 65 64 0a 09 09 09 09 09 20 2a 20 6d 61 74 63 68 ed...... * match
3520: 65 73 2e 20 2a 2f 0a 0a 2f 2a 0a 20 2a 20 46 6c es. */../*. * Fl
3530: 61 67 73 20 76 61 6c 75 65 73 20 70 61 73 73 65 ags values passe
3540: 64 20 74 6f 20 54 63 6c 5f 52 65 67 45 78 70 45 d to Tcl_RegExpE
3550: 78 65 63 4f 62 6a 2e 0a 20 2a 2f 0a 0a 23 64 65 xecObj.. */..#de
3560: 66 69 6e 65 09 54 43 4c 5f 52 45 47 5f 4e 4f 54 fine.TCL_REG_NOT
3570: 42 4f 4c 09 30 30 30 31 09 2f 2a 20 42 65 67 69 BOL.0001./* Begi
3580: 6e 6e 69 6e 67 20 6f 66 20 73 74 72 69 6e 67 20 nning of string
3590: 64 6f 65 73 20 6e 6f 74 20 6d 61 74 63 68 20 5e does not match ^
35a0: 2e 20 2a 2f 0a 23 64 65 66 69 6e 65 09 54 43 4c . */.#define.TCL
35b0: 5f 52 45 47 5f 4e 4f 54 45 4f 4c 09 30 30 30 32 _REG_NOTEOL.0002
35c0: 09 2f 2a 20 45 6e 64 20 6f 66 20 73 74 72 69 6e ./* End of strin
35d0: 67 20 64 6f 65 73 20 6e 6f 74 20 6d 61 74 63 68 g does not match
35e0: 20 24 2e 20 2a 2f 0a 0a 2f 2a 0a 20 2a 20 53 74 $. */../*. * St
35f0: 72 75 63 74 75 72 65 73 20 66 69 6c 6c 65 64 20 ructures filled
3600: 69 6e 20 62 79 20 54 63 6c 5f 52 65 67 45 78 70 in by Tcl_RegExp
3610: 49 6e 66 6f 2e 20 4e 6f 74 65 20 74 68 61 74 20 Info. Note that
3620: 61 6c 6c 20 6f 66 66 73 65 74 20 76 61 6c 75 65 all offset value
3630: 73 20 61 72 65 0a 20 2a 20 72 65 6c 61 74 69 76 s are. * relativ
3640: 65 20 74 6f 20 74 68 65 20 73 74 61 72 74 20 6f e to the start o
3650: 66 20 74 68 65 20 6d 61 74 63 68 20 73 74 72 69 f the match stri
3660: 6e 67 2c 20 6e 6f 74 20 74 68 65 20 62 65 67 69 ng, not the begi
3670: 6e 6e 69 6e 67 20 6f 66 20 74 68 65 20 65 6e 74 nning of the ent
3680: 69 72 65 0a 20 2a 20 73 74 72 69 6e 67 2e 0a 20 ire. * string..
3690: 2a 2f 0a 0a 74 79 70 65 64 65 66 20 73 74 72 75 */..typedef stru
36a0: 63 74 20 54 63 6c 5f 52 65 67 45 78 70 49 6e 64 ct Tcl_RegExpInd
36b0: 69 63 65 73 20 7b 0a 20 20 20 20 54 63 6c 5f 53 ices {. Tcl_S
36c0: 69 7a 65 20 73 74 61 72 74 3b 09 09 2f 2a 20 43 ize start;../* C
36d0: 68 61 72 61 63 74 65 72 20 6f 66 66 73 65 74 20 haracter offset
36e0: 6f 66 20 66 69 72 73 74 20 63 68 61 72 61 63 74 of first charact
36f0: 65 72 20 69 6e 0a 09 09 09 09 20 2a 20 6d 61 74 er in..... * mat
3700: 63 68 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 53 ch. */. Tcl_S
3710: 69 7a 65 20 65 6e 64 3b 09 09 2f 2a 20 43 68 61 ize end;../* Cha
3720: 72 61 63 74 65 72 20 6f 66 66 73 65 74 20 6f 66 racter offset of
3730: 20 66 69 72 73 74 20 63 68 61 72 61 63 74 65 72 first character
3740: 20 61 66 74 65 72 0a 09 09 09 09 20 2a 20 74 68 after..... * th
3750: 65 20 6d 61 74 63 68 2e 20 2a 2f 0a 7d 20 54 63 e match. */.} Tc
3760: 6c 5f 52 65 67 45 78 70 49 6e 64 69 63 65 73 3b l_RegExpIndices;
3770: 0a 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 74 ..typedef struct
3780: 20 54 63 6c 5f 52 65 67 45 78 70 49 6e 66 6f 20 Tcl_RegExpInfo
3790: 7b 0a 20 20 20 20 54 63 6c 5f 53 69 7a 65 20 6e {. Tcl_Size n
37a0: 73 75 62 73 3b 09 09 2f 2a 20 4e 75 6d 62 65 72 subs;../* Number
37b0: 20 6f 66 20 73 75 62 65 78 70 72 65 73 73 69 6f of subexpressio
37c0: 6e 73 20 69 6e 20 74 68 65 20 63 6f 6d 70 69 6c ns in the compil
37d0: 65 64 0a 09 09 09 09 20 2a 20 65 78 70 72 65 73 ed..... * expres
37e0: 73 69 6f 6e 2e 20 2a 2f 0a 20 20 20 20 54 63 6c sion. */. Tcl
37f0: 5f 52 65 67 45 78 70 49 6e 64 69 63 65 73 20 2a _RegExpIndices *
3800: 6d 61 74 63 68 65 73 3b 09 2f 2a 20 41 72 72 61 matches;./* Arra
3810: 79 20 6f 66 20 6e 73 75 62 73 20 6d 61 74 63 68 y of nsubs match
3820: 20 6f 66 66 73 65 74 20 70 61 69 72 73 2e 20 2a offset pairs. *
3830: 2f 0a 20 20 20 20 54 63 6c 5f 53 69 7a 65 20 65 /. Tcl_Size e
3840: 78 74 65 6e 64 53 74 61 72 74 3b 09 2f 2a 20 54 xtendStart;./* T
3850: 68 65 20 6f 66 66 73 65 74 20 61 74 20 77 68 69 he offset at whi
3860: 63 68 20 61 20 73 75 62 73 65 71 75 65 6e 74 20 ch a subsequent
3870: 6d 61 74 63 68 0a 09 09 09 09 20 2a 20 6d 69 67 match..... * mig
3880: 68 74 20 62 65 67 69 6e 2e 20 2a 2f 0a 7d 20 54 ht begin. */.} T
3890: 63 6c 5f 52 65 67 45 78 70 49 6e 66 6f 3b 0a 0a cl_RegExpInfo;..
38a0: 2f 2a 0a 20 2a 20 50 69 63 6b 79 20 63 6f 6d 70 /*. * Picky comp
38b0: 69 6c 65 72 73 20 63 6f 6d 70 6c 61 69 6e 20 69 ilers complain i
38c0: 66 20 74 68 69 73 20 74 79 70 64 65 66 20 64 6f f this typdef do
38d0: 65 73 6e 27 74 20 61 70 70 65 61 72 20 62 65 66 esn't appear bef
38e0: 6f 72 65 20 74 68 65 20 73 74 72 75 63 74 27 73 ore the struct's
38f0: 0a 20 2a 20 72 65 66 65 72 65 6e 63 65 20 69 6e . * reference in
3900: 20 74 63 6c 44 65 63 6c 73 2e 68 2e 0a 20 2a 2f tclDecls.h.. */
3910: 0a 0a 74 79 70 65 64 65 66 20 54 63 6c 5f 53 74 ..typedef Tcl_St
3920: 61 74 42 75 66 20 2a 54 63 6c 5f 53 74 61 74 5f atBuf *Tcl_Stat_
3930: 3b 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 74 ;.typedef struct
3940: 20 73 74 61 74 20 2a 54 63 6c 5f 4f 6c 64 53 74 stat *Tcl_OldSt
3950: 61 74 5f 3b 0a 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d at_;../*. *-----
3960: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
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 0a 20 2a 20 57 68 65 6e 20 -------. * When
39b0: 61 20 54 43 4c 20 63 6f 6d 6d 61 6e 64 20 72 65 a TCL command re
39c0: 74 75 72 6e 73 2c 20 74 68 65 20 69 6e 74 65 72 turns, the inter
39d0: 70 72 65 74 65 72 20 63 6f 6e 74 61 69 6e 73 20 preter contains
39e0: 61 20 72 65 73 75 6c 74 20 66 72 6f 6d 20 74 68 a result from th
39f0: 65 0a 20 2a 20 63 6f 6d 6d 61 6e 64 2e 20 50 72 e. * command. Pr
3a00: 6f 67 72 61 6d 6d 65 72 73 20 61 72 65 20 73 74 ogrammers are st
3a10: 72 6f 6e 67 6c 79 20 65 6e 63 6f 75 72 61 67 65 rongly encourage
3a20: 64 20 74 6f 20 75 73 65 20 6f 6e 65 20 6f 66 20 d to use one of
3a30: 74 68 65 20 66 75 6e 63 74 69 6f 6e 73 0a 20 2a the functions. *
3a40: 20 54 63 6c 5f 47 65 74 4f 62 6a 52 65 73 75 6c Tcl_GetObjResul
3a50: 74 28 29 20 6f 72 20 54 63 6c 5f 47 65 74 53 74 t() or Tcl_GetSt
3a60: 72 69 6e 67 52 65 73 75 6c 74 28 29 20 74 6f 20 ringResult() to
3a70: 72 65 61 64 20 74 68 65 20 69 6e 74 65 72 70 72 read the interpr
3a80: 65 74 65 72 27 73 0a 20 2a 20 72 65 73 75 6c 74 eter's. * result
3a90: 2e 20 53 65 65 20 74 68 65 20 53 65 74 52 65 73 . See the SetRes
3aa0: 75 6c 74 20 6d 61 6e 20 70 61 67 65 20 66 6f 72 ult man page for
3ab0: 20 64 65 74 61 69 6c 73 2e 20 42 65 73 69 64 65 details. Beside
3ac0: 73 20 74 68 69 73 20 72 65 73 75 6c 74 2c 20 74 s this result, t
3ad0: 68 65 0a 20 2a 20 63 6f 6d 6d 61 6e 64 20 66 75 he. * command fu
3ae0: 6e 63 74 69 6f 6e 20 72 65 74 75 72 6e 73 20 61 nction returns a
3af0: 6e 20 69 6e 74 65 67 65 72 20 63 6f 64 65 2c 20 n integer code,
3b00: 77 68 69 63 68 20 69 73 20 6f 6e 65 20 6f 66 20 which is one of
3b10: 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 3a 0a 20 the following:.
3b20: 2a 0a 20 2a 20 54 43 4c 5f 4f 4b 09 09 43 6f 6d *. * TCL_OK..Com
3b30: 6d 61 6e 64 20 63 6f 6d 70 6c 65 74 65 64 20 6e mand completed n
3b40: 6f 72 6d 61 6c 6c 79 3b 20 74 68 65 20 69 6e 74 ormally; the int
3b50: 65 72 70 72 65 74 65 72 27 73 20 72 65 73 75 6c erpreter's resul
3b60: 74 0a 20 2a 09 09 09 63 6f 6e 74 61 69 6e 73 20 t. *...contains
3b70: 74 68 65 20 63 6f 6d 6d 61 6e 64 27 73 20 72 65 the command's re
3b80: 73 75 6c 74 2e 0a 20 2a 20 54 43 4c 5f 45 52 52 sult.. * TCL_ERR
3b90: 4f 52 09 09 54 68 65 20 63 6f 6d 6d 61 6e 64 20 OR..The command
3ba0: 63 6f 75 6c 64 6e 27 74 20 62 65 20 63 6f 6d 70 couldn't be comp
3bb0: 6c 65 74 65 64 20 73 75 63 63 65 73 73 66 75 6c leted successful
3bc0: 6c 79 3b 20 74 68 65 0a 20 2a 09 09 09 69 6e 74 ly; the. *...int
3bd0: 65 72 70 72 65 74 65 72 27 73 20 72 65 73 75 6c erpreter's resul
3be0: 74 20 64 65 73 63 72 69 62 65 73 20 77 68 61 74 t describes what
3bf0: 20 77 65 6e 74 20 77 72 6f 6e 67 2e 0a 20 2a 20 went wrong.. *
3c00: 54 43 4c 5f 52 45 54 55 52 4e 09 09 54 68 65 20 TCL_RETURN..The
3c10: 63 6f 6d 6d 61 6e 64 20 72 65 71 75 65 73 74 73 command requests
3c20: 20 74 68 61 74 20 74 68 65 20 63 75 72 72 65 6e that the curren
3c30: 74 20 66 75 6e 63 74 69 6f 6e 20 72 65 74 75 72 t function retur
3c40: 6e 3b 0a 20 2a 09 09 09 74 68 65 20 69 6e 74 65 n;. *...the inte
3c50: 72 70 72 65 74 65 72 27 73 20 72 65 73 75 6c 74 rpreter's result
3c60: 20 63 6f 6e 74 61 69 6e 73 20 74 68 65 20 66 75 contains the fu
3c70: 6e 63 74 69 6f 6e 27 73 0a 20 2a 09 09 09 72 65 nction's. *...re
3c80: 74 75 72 6e 20 76 61 6c 75 65 2e 0a 20 2a 20 54 turn value.. * T
3c90: 43 4c 5f 42 52 45 41 4b 09 09 54 68 65 20 63 6f CL_BREAK..The co
3ca0: 6d 6d 61 6e 64 20 72 65 71 75 65 73 74 73 20 74 mmand requests t
3cb0: 68 61 74 20 74 68 65 20 69 6e 6e 65 72 6d 6f 73 hat the innermos
3cc0: 74 20 6c 6f 6f 70 20 62 65 0a 20 2a 09 09 09 65 t loop be. *...e
3cd0: 78 69 74 65 64 3b 20 74 68 65 20 69 6e 74 65 72 xited; the inter
3ce0: 70 72 65 74 65 72 27 73 20 72 65 73 75 6c 74 20 preter's result
3cf0: 69 73 20 6d 65 61 6e 69 6e 67 6c 65 73 73 2e 0a is meaningless..
3d00: 20 2a 20 54 43 4c 5f 43 4f 4e 54 49 4e 55 45 09 * TCL_CONTINUE.
3d10: 09 47 6f 20 6f 6e 20 74 6f 20 74 68 65 20 6e 65 .Go on to the ne
3d20: 78 74 20 69 74 65 72 61 74 69 6f 6e 20 6f 66 20 xt iteration of
3d30: 74 68 65 20 63 75 72 72 65 6e 74 20 6c 6f 6f 70 the current loop
3d40: 3b 20 74 68 65 0a 20 2a 09 09 09 69 6e 74 65 72 ; the. *...inter
3d50: 70 72 65 74 65 72 27 73 20 72 65 73 75 6c 74 20 preter's result
3d60: 69 73 20 6d 65 61 6e 69 6e 67 6c 65 73 73 2e 0a is meaningless..
3d70: 20 2a 20 49 6e 74 65 67 65 72 20 72 65 74 75 72 * Integer retur
3d80: 6e 20 63 6f 64 65 73 20 69 6e 20 74 68 65 20 72 n codes in the r
3d90: 61 6e 67 65 20 54 43 4c 5f 43 4f 44 45 5f 55 53 ange TCL_CODE_US
3da0: 45 52 5f 4d 49 4e 20 74 6f 20 54 43 4c 5f 43 4f ER_MIN to TCL_CO
3db0: 44 45 5f 55 53 45 52 5f 4d 41 58 20 61 72 65 0a DE_USER_MAX are.
3dc0: 20 2a 20 72 65 73 65 72 76 65 64 20 66 6f 72 20 * reserved for
3dd0: 74 68 65 20 75 73 65 20 6f 66 20 70 61 63 6b 61 the use of packa
3de0: 67 65 73 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e ges.. */..#defin
3df0: 65 20 54 43 4c 5f 4f 4b 09 09 09 30 0a 23 64 65 e TCL_OK...0.#de
3e00: 66 69 6e 65 20 54 43 4c 5f 45 52 52 4f 52 09 09 fine TCL_ERROR..
3e10: 31 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 52 45 1.#define TCL_RE
3e20: 54 55 52 4e 09 09 32 0a 23 64 65 66 69 6e 65 20 TURN..2.#define
3e30: 54 43 4c 5f 42 52 45 41 4b 09 09 33 0a 23 64 65 TCL_BREAK..3.#de
3e40: 66 69 6e 65 20 54 43 4c 5f 43 4f 4e 54 49 4e 55 fine TCL_CONTINU
3e50: 45 09 09 34 0a 23 64 65 66 69 6e 65 20 54 43 4c E..4.#define TCL
3e60: 5f 43 4f 44 45 5f 55 53 45 52 5f 4d 49 4e 09 35 _CODE_USER_MIN.5
3e70: 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 43 4f 44 .#define TCL_COD
3e80: 45 5f 55 53 45 52 5f 4d 41 58 09 30 78 33 66 66 E_USER_MAX.0x3ff
3e90: 66 66 66 66 66 20 2f 2a 20 31 30 37 33 37 34 31 fffff /* 1073741
3ea0: 38 32 33 20 2a 2f 0a 0a 2f 2a 0a 20 2a 2d 2d 2d 823 */../*. *---
3eb0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
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 0a 20 2a 20 46 6c 61 ---------. * Fla
3f00: 67 73 20 74 6f 20 63 6f 6e 74 72 6f 6c 20 77 68 gs to control wh
3f10: 61 74 20 73 75 62 73 74 69 74 75 74 69 6f 6e 73 at substitutions
3f20: 20 61 72 65 20 70 65 72 66 6f 72 6d 65 64 20 62 are performed b
3f30: 79 20 54 63 6c 5f 53 75 62 73 74 4f 62 6a 28 29 y Tcl_SubstObj()
3f40: 3a 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 :. */..#define T
3f50: 43 4c 5f 53 55 42 53 54 5f 43 4f 4d 4d 41 4e 44 CL_SUBST_COMMAND
3f60: 53 09 30 30 31 0a 23 64 65 66 69 6e 65 20 54 43 S.001.#define TC
3f70: 4c 5f 53 55 42 53 54 5f 56 41 52 49 41 42 4c 45 L_SUBST_VARIABLE
3f80: 53 09 30 30 32 0a 23 64 65 66 69 6e 65 20 54 43 S.002.#define TC
3f90: 4c 5f 53 55 42 53 54 5f 42 41 43 4b 53 4c 41 53 L_SUBST_BACKSLAS
3fa0: 48 45 53 09 30 30 34 0a 23 64 65 66 69 6e 65 20 HES.004.#define
3fb0: 54 43 4c 5f 53 55 42 53 54 5f 41 4c 4c 09 09 30 TCL_SUBST_ALL..0
3fc0: 30 37 0a 0a 2f 2a 0a 20 2a 20 46 6f 72 77 61 72 07../*. * Forwar
3fd0: 64 20 64 65 63 6c 61 72 61 74 69 6f 6e 20 6f 66 d declaration of
3fe0: 20 54 63 6c 5f 4f 62 6a 20 74 6f 20 70 72 65 76 Tcl_Obj to prev
3ff0: 65 6e 74 20 61 6e 20 65 72 72 6f 72 20 77 68 65 ent an error whe
4000: 6e 20 74 68 65 20 66 6f 72 77 61 72 64 0a 20 2a n the forward. *
4010: 20 72 65 66 65 72 65 6e 63 65 20 74 6f 20 54 63 reference to Tc
4020: 6c 5f 4f 62 6a 20 69 73 20 65 6e 63 6f 75 6e 74 l_Obj is encount
4030: 65 72 65 64 20 69 6e 20 74 68 65 20 66 75 6e 63 ered in the func
4040: 74 69 6f 6e 20 74 79 70 65 73 20 64 65 63 6c 61 tion types decla
4050: 72 65 64 20 62 65 6c 6f 77 2e 0a 20 2a 2f 0a 0a red below.. */..
4060: 73 74 72 75 63 74 20 54 63 6c 5f 4f 62 6a 3b 0a struct Tcl_Obj;.
4070: 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ./*. *----------
4080: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
4090: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
40a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
40b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
40c0: 2d 2d 0a 20 2a 20 46 75 6e 63 74 69 6f 6e 20 74 --. * Function t
40d0: 79 70 65 73 20 64 65 66 69 6e 65 64 20 62 79 20 ypes defined by
40e0: 54 63 6c 3a 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 Tcl:. */..typede
40f0: 66 20 69 6e 74 20 28 54 63 6c 5f 41 70 70 49 6e f int (Tcl_AppIn
4100: 69 74 50 72 6f 63 29 20 28 54 63 6c 5f 49 6e 74 itProc) (Tcl_Int
4110: 65 72 70 20 2a 69 6e 74 65 72 70 29 3b 0a 74 79 erp *interp);.ty
4120: 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 41 pedef int (Tcl_A
4130: 73 79 6e 63 50 72 6f 63 29 20 28 76 6f 69 64 20 syncProc) (void
4140: 2a 63 6c 69 65 6e 74 44 61 74 61 2c 20 54 63 6c *clientData, Tcl
4150: 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c _Interp *interp,
4160: 0a 09 69 6e 74 20 63 6f 64 65 29 3b 0a 74 79 70 ..int code);.typ
4170: 65 64 65 66 20 76 6f 69 64 20 28 54 63 6c 5f 43 edef void (Tcl_C
4180: 68 61 6e 6e 65 6c 50 72 6f 63 29 20 28 76 6f 69 hannelProc) (voi
4190: 64 20 2a 63 6c 69 65 6e 74 44 61 74 61 2c 20 69 d *clientData, i
41a0: 6e 74 20 6d 61 73 6b 29 3b 0a 74 79 70 65 64 65 nt mask);.typede
41b0: 66 20 76 6f 69 64 20 28 54 63 6c 5f 43 6c 6f 73 f void (Tcl_Clos
41c0: 65 50 72 6f 63 29 20 28 76 6f 69 64 20 2a 64 61 eProc) (void *da
41d0: 74 61 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 ta);.typedef voi
41e0: 64 20 28 54 63 6c 5f 43 6d 64 44 65 6c 65 74 65 d (Tcl_CmdDelete
41f0: 50 72 6f 63 29 20 28 76 6f 69 64 20 2a 63 6c 69 Proc) (void *cli
4200: 65 6e 74 44 61 74 61 29 3b 0a 74 79 70 65 64 65 entData);.typede
4210: 66 20 69 6e 74 20 28 54 63 6c 5f 43 6d 64 50 72 f int (Tcl_CmdPr
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 2c 20 54 63 6c 5f 49 6e 74 65 72 tData, Tcl_Inter
4240: 70 20 2a 69 6e 74 65 72 70 2c 0a 09 69 6e 74 20 p *interp,..int
4250: 61 72 67 63 2c 20 63 6f 6e 73 74 20 63 68 61 72 argc, const char
4260: 20 2a 2a 61 72 67 76 29 3b 0a 23 69 66 6e 64 65 **argv);.#ifnde
4270: 66 20 54 43 4c 5f 4e 4f 5f 44 45 50 52 45 43 41 f TCL_NO_DEPRECA
4280: 54 45 44 0a 74 79 70 65 64 65 66 20 76 6f 69 64 TED.typedef void
4290: 20 28 54 63 6c 5f 43 6d 64 54 72 61 63 65 50 72 (Tcl_CmdTracePr
42a0: 6f 63 29 20 28 76 6f 69 64 20 2a 63 6c 69 65 6e oc) (void *clien
42b0: 74 44 61 74 61 2c 20 54 63 6c 5f 49 6e 74 65 72 tData, Tcl_Inter
42c0: 70 20 2a 69 6e 74 65 72 70 2c 0a 09 69 6e 74 20 p *interp,..int
42d0: 6c 65 76 65 6c 2c 20 63 68 61 72 20 2a 63 6f 6d level, char *com
42e0: 6d 61 6e 64 2c 20 54 63 6c 5f 43 6d 64 50 72 6f mand, Tcl_CmdPro
42f0: 63 20 2a 70 72 6f 63 2c 0a 09 76 6f 69 64 20 2a c *proc,..void *
4300: 63 6d 64 43 6c 69 65 6e 74 44 61 74 61 2c 20 69 cmdClientData, i
4310: 6e 74 20 61 72 67 63 2c 20 63 6f 6e 73 74 20 63 nt argc, const c
4320: 68 61 72 20 2a 2a 61 72 67 76 29 3b 0a 74 79 70 har **argv);.typ
4330: 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 43 6d edef int (Tcl_Cm
4340: 64 4f 62 6a 54 72 61 63 65 50 72 6f 63 29 20 28 dObjTraceProc) (
4350: 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 61 74 61 void *clientData
4360: 2c 20 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e , Tcl_Interp *in
4370: 74 65 72 70 2c 0a 09 69 6e 74 20 6c 65 76 65 6c terp,..int level
4380: 2c 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 63 6f , const char *co
4390: 6d 6d 61 6e 64 2c 20 54 63 6c 5f 43 6f 6d 6d 61 mmand, Tcl_Comma
43a0: 6e 64 20 63 6f 6d 6d 61 6e 64 49 6e 66 6f 2c 20 nd commandInfo,
43b0: 69 6e 74 20 6f 62 6a 63 2c 0a 09 73 74 72 75 63 int objc,..struc
43c0: 74 20 54 63 6c 5f 4f 62 6a 20 2a 63 6f 6e 73 74 t Tcl_Obj *const
43d0: 20 2a 6f 62 6a 76 29 3b 0a 23 65 6e 64 69 66 20 *objv);.#endif
43e0: 2f 2a 20 54 43 4c 5f 4e 4f 5f 44 45 50 52 45 43 /* TCL_NO_DEPREC
43f0: 41 54 45 44 20 2a 2f 0a 74 79 70 65 64 65 66 20 ATED */.typedef
4400: 76 6f 69 64 20 28 54 63 6c 5f 43 6d 64 4f 62 6a void (Tcl_CmdObj
4410: 54 72 61 63 65 44 65 6c 65 74 65 50 72 6f 63 29 TraceDeleteProc)
4420: 20 28 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 61 (void *clientDa
4430: 74 61 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 ta);.typedef voi
4440: 64 20 28 54 63 6c 5f 44 75 70 49 6e 74 65 72 6e d (Tcl_DupIntern
4450: 61 6c 52 65 70 50 72 6f 63 29 20 28 73 74 72 75 alRepProc) (stru
4460: 63 74 20 54 63 6c 5f 4f 62 6a 20 2a 73 72 63 50 ct Tcl_Obj *srcP
4470: 74 72 2c 0a 09 73 74 72 75 63 74 20 54 63 6c 5f tr,..struct Tcl_
4480: 4f 62 6a 20 2a 64 75 70 50 74 72 29 3b 0a 74 79 Obj *dupPtr);.ty
4490: 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 45 pedef int (Tcl_E
44a0: 6e 63 6f 64 69 6e 67 43 6f 6e 76 65 72 74 50 72 ncodingConvertPr
44b0: 6f 63 29 20 28 76 6f 69 64 20 2a 63 6c 69 65 6e oc) (void *clien
44c0: 74 44 61 74 61 2c 20 63 6f 6e 73 74 20 63 68 61 tData, const cha
44d0: 72 20 2a 73 72 63 2c 0a 09 69 6e 74 20 73 72 63 r *src,..int src
44e0: 4c 65 6e 2c 20 69 6e 74 20 66 6c 61 67 73 2c 20 Len, int flags,
44f0: 54 63 6c 5f 45 6e 63 6f 64 69 6e 67 53 74 61 74 Tcl_EncodingStat
4500: 65 20 2a 73 74 61 74 65 50 74 72 2c 20 63 68 61 e *statePtr, cha
4510: 72 20 2a 64 73 74 2c 0a 09 69 6e 74 20 64 73 74 r *dst,..int dst
4520: 4c 65 6e 2c 20 69 6e 74 20 2a 73 72 63 52 65 61 Len, int *srcRea
4530: 64 50 74 72 2c 20 69 6e 74 20 2a 64 73 74 57 72 dPtr, int *dstWr
4540: 6f 74 65 50 74 72 2c 20 69 6e 74 20 2a 64 73 74 otePtr, int *dst
4550: 43 68 61 72 73 50 74 72 29 3b 0a 74 79 70 65 64 CharsPtr);.typed
4560: 65 66 20 76 6f 69 64 20 28 54 63 6c 5f 45 6e 63 ef void (Tcl_Enc
4570: 6f 64 69 6e 67 46 72 65 65 50 72 6f 63 29 20 28 odingFreeProc) (
4580: 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 61 74 61 void *clientData
4590: 29 3b 0a 74 79 70 65 64 65 66 20 69 6e 74 20 28 );.typedef int (
45a0: 54 63 6c 5f 45 76 65 6e 74 50 72 6f 63 29 20 28 Tcl_EventProc) (
45b0: 54 63 6c 5f 45 76 65 6e 74 20 2a 65 76 50 74 72 Tcl_Event *evPtr
45c0: 2c 20 69 6e 74 20 66 6c 61 67 73 29 3b 0a 74 79 , int flags);.ty
45d0: 70 65 64 65 66 20 76 6f 69 64 20 28 54 63 6c 5f pedef void (Tcl_
45e0: 45 76 65 6e 74 43 68 65 63 6b 50 72 6f 63 29 20 EventCheckProc)
45f0: 28 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 61 74 (void *clientDat
4600: 61 2c 20 69 6e 74 20 66 6c 61 67 73 29 3b 0a 74 a, int flags);.t
4610: 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f ypedef int (Tcl_
4620: 45 76 65 6e 74 44 65 6c 65 74 65 50 72 6f 63 29 EventDeleteProc)
4630: 20 28 54 63 6c 5f 45 76 65 6e 74 20 2a 65 76 50 (Tcl_Event *evP
4640: 74 72 2c 20 76 6f 69 64 20 2a 63 6c 69 65 6e 74 tr, void *client
4650: 44 61 74 61 29 3b 0a 74 79 70 65 64 65 66 20 76 Data);.typedef v
4660: 6f 69 64 20 28 54 63 6c 5f 45 76 65 6e 74 53 65 oid (Tcl_EventSe
4670: 74 75 70 50 72 6f 63 29 20 28 76 6f 69 64 20 2a tupProc) (void *
4680: 63 6c 69 65 6e 74 44 61 74 61 2c 20 69 6e 74 20 clientData, int
4690: 66 6c 61 67 73 29 3b 0a 74 79 70 65 64 65 66 20 flags);.typedef
46a0: 76 6f 69 64 20 28 54 63 6c 5f 45 78 69 74 50 72 void (Tcl_ExitPr
46b0: 6f 63 29 20 28 76 6f 69 64 20 2a 63 6c 69 65 6e oc) (void *clien
46c0: 74 44 61 74 61 29 3b 0a 74 79 70 65 64 65 66 20 tData);.typedef
46d0: 76 6f 69 64 20 28 54 63 6c 5f 46 69 6c 65 50 72 void (Tcl_FilePr
46e0: 6f 63 29 20 28 76 6f 69 64 20 2a 63 6c 69 65 6e oc) (void *clien
46f0: 74 44 61 74 61 2c 20 69 6e 74 20 6d 61 73 6b 29 tData, int mask)
4700: 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 64 20 28 ;.typedef void (
4710: 54 63 6c 5f 46 69 6c 65 46 72 65 65 50 72 6f 63 Tcl_FileFreeProc
4720: 29 20 28 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 ) (void *clientD
4730: 61 74 61 29 3b 0a 74 79 70 65 64 65 66 20 76 6f ata);.typedef vo
4740: 69 64 20 28 54 63 6c 5f 46 72 65 65 49 6e 74 65 id (Tcl_FreeInte
4750: 72 6e 61 6c 52 65 70 50 72 6f 63 29 20 28 73 74 rnalRepProc) (st
4760: 72 75 63 74 20 54 63 6c 5f 4f 62 6a 20 2a 6f 62 ruct Tcl_Obj *ob
4770: 6a 50 74 72 29 3b 0a 74 79 70 65 64 65 66 20 76 jPtr);.typedef v
4780: 6f 69 64 20 28 54 63 6c 5f 49 64 6c 65 50 72 6f oid (Tcl_IdlePro
4790: 63 29 20 28 76 6f 69 64 20 2a 63 6c 69 65 6e 74 c) (void *client
47a0: 44 61 74 61 29 3b 0a 74 79 70 65 64 65 66 20 76 Data);.typedef v
47b0: 6f 69 64 20 28 54 63 6c 5f 49 6e 74 65 72 70 44 oid (Tcl_InterpD
47c0: 65 6c 65 74 65 50 72 6f 63 29 20 28 76 6f 69 64 eleteProc) (void
47d0: 20 2a 63 6c 69 65 6e 74 44 61 74 61 2c 0a 09 54 *clientData,..T
47e0: 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 cl_Interp *inter
47f0: 70 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 64 p);.typedef void
4800: 20 28 54 63 6c 5f 4e 61 6d 65 73 70 61 63 65 44 (Tcl_NamespaceD
4810: 65 6c 65 74 65 50 72 6f 63 29 20 28 76 6f 69 64 eleteProc) (void
4820: 20 2a 63 6c 69 65 6e 74 44 61 74 61 29 3b 0a 23 *clientData);.#
4830: 69 66 20 21 64 65 66 69 6e 65 64 28 54 43 4c 5f if !defined(TCL_
4840: 4e 4f 5f 44 45 50 52 45 43 41 54 45 44 29 20 7c NO_DEPRECATED) |
4850: 7c 20 21 64 65 66 69 6e 65 64 28 42 55 49 4c 44 | !defined(BUILD
4860: 5f 74 63 6c 29 0a 74 79 70 65 64 65 66 20 69 6e _tcl).typedef in
4870: 74 20 28 54 63 6c 5f 4f 62 6a 43 6d 64 50 72 6f t (Tcl_ObjCmdPro
4880: 63 29 20 28 76 6f 69 64 20 2a 63 6c 69 65 6e 74 c) (void *client
4890: 44 61 74 61 2c 20 54 63 6c 5f 49 6e 74 65 72 70 Data, Tcl_Interp
48a0: 20 2a 69 6e 74 65 72 70 2c 0a 09 69 6e 74 20 6f *interp,..int o
48b0: 62 6a 63 2c 20 73 74 72 75 63 74 20 54 63 6c 5f bjc, struct Tcl_
48c0: 4f 62 6a 20 2a 63 6f 6e 73 74 20 2a 6f 62 6a 76 Obj *const *objv
48d0: 29 3b 0a 23 65 6e 64 69 66 20 2f 2a 20 54 43 4c );.#endif /* TCL
48e0: 5f 4e 4f 5f 44 45 50 52 45 43 41 54 45 44 20 2a _NO_DEPRECATED *
48f0: 2f 0a 74 79 70 65 64 65 66 20 69 6e 74 20 28 54 /.typedef int (T
4900: 63 6c 5f 4f 62 6a 43 6d 64 50 72 6f 63 32 29 20 cl_ObjCmdProc2)
4910: 28 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 61 74 (void *clientDat
4920: 61 2c 20 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 a, Tcl_Interp *i
4930: 6e 74 65 72 70 2c 0a 09 54 63 6c 5f 53 69 7a 65 nterp,..Tcl_Size
4940: 20 6f 62 6a 63 2c 20 73 74 72 75 63 74 20 54 63 objc, struct Tc
4950: 6c 5f 4f 62 6a 20 2a 63 6f 6e 73 74 20 2a 6f 62 l_Obj *const *ob
4960: 6a 76 29 3b 0a 74 79 70 65 64 65 66 20 69 6e 74 jv);.typedef int
4970: 20 28 54 63 6c 5f 43 6d 64 4f 62 6a 54 72 61 63 (Tcl_CmdObjTrac
4980: 65 50 72 6f 63 32 29 20 28 76 6f 69 64 20 2a 63 eProc2) (void *c
4990: 6c 69 65 6e 74 44 61 74 61 2c 20 54 63 6c 5f 49 lientData, Tcl_I
49a0: 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c 0a 09 nterp *interp,..
49b0: 54 63 6c 5f 53 69 7a 65 20 6c 65 76 65 6c 2c 20 Tcl_Size level,
49c0: 63 6f 6e 73 74 20 63 68 61 72 20 2a 63 6f 6d 6d const char *comm
49d0: 61 6e 64 2c 20 54 63 6c 5f 43 6f 6d 6d 61 6e 64 and, Tcl_Command
49e0: 20 63 6f 6d 6d 61 6e 64 49 6e 66 6f 2c 20 54 63 commandInfo, Tc
49f0: 6c 5f 53 69 7a 65 20 6f 62 6a 63 2c 0a 09 73 74 l_Size objc,..st
4a00: 72 75 63 74 20 54 63 6c 5f 4f 62 6a 20 2a 63 6f ruct Tcl_Obj *co
4a10: 6e 73 74 20 2a 6f 62 6a 76 29 3b 0a 74 79 70 65 nst *objv);.type
4a20: 64 65 66 20 76 6f 69 64 20 28 54 63 6c 5f 46 72 def void (Tcl_Fr
4a30: 65 65 50 72 6f 63 29 20 28 76 6f 69 64 20 2a 62 eeProc) (void *b
4a40: 6c 6f 63 6b 50 74 72 29 3b 0a 23 64 65 66 69 6e lockPtr);.#defin
4a50: 65 20 54 63 6c 5f 45 78 69 74 50 72 6f 63 20 54 e Tcl_ExitProc T
4a60: 63 6c 5f 46 72 65 65 50 72 6f 63 0a 23 64 65 66 cl_FreeProc.#def
4a70: 69 6e 65 20 54 63 6c 5f 46 69 6c 65 46 72 65 65 ine Tcl_FileFree
4a80: 50 72 6f 63 20 54 63 6c 5f 46 72 65 65 50 72 6f Proc Tcl_FreePro
4a90: 63 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f 46 69 c.#define Tcl_Fi
4aa0: 6c 65 46 72 65 65 50 72 6f 63 20 54 63 6c 5f 46 leFreeProc Tcl_F
4ab0: 72 65 65 50 72 6f 63 0a 23 64 65 66 69 6e 65 20 reeProc.#define
4ac0: 54 63 6c 5f 45 6e 63 6f 64 69 6e 67 46 72 65 65 Tcl_EncodingFree
4ad0: 50 72 6f 63 20 54 63 6c 5f 46 72 65 65 50 72 6f Proc Tcl_FreePro
4ae0: 63 0a 74 79 70 65 64 65 66 20 69 6e 74 20 28 54 c.typedef int (T
4af0: 63 6c 5f 4c 69 62 72 61 72 79 49 6e 69 74 50 72 cl_LibraryInitPr
4b00: 6f 63 29 20 28 54 63 6c 5f 49 6e 74 65 72 70 20 oc) (Tcl_Interp
4b10: 2a 69 6e 74 65 72 70 29 3b 0a 74 79 70 65 64 65 *interp);.typede
4b20: 66 20 69 6e 74 20 28 54 63 6c 5f 4c 69 62 72 61 f int (Tcl_Libra
4b30: 72 79 55 6e 6c 6f 61 64 50 72 6f 63 29 20 28 54 ryUnloadProc) (T
4b40: 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 cl_Interp *inter
4b50: 70 2c 20 69 6e 74 20 66 6c 61 67 73 29 3b 0a 74 p, int flags);.t
4b60: 79 70 65 64 65 66 20 76 6f 69 64 20 28 54 63 6c ypedef void (Tcl
4b70: 5f 50 61 6e 69 63 50 72 6f 63 29 20 28 63 6f 6e _PanicProc) (con
4b80: 73 74 20 63 68 61 72 20 2a 66 6f 72 6d 61 74 2c st char *format,
4b90: 20 2e 2e 2e 29 20 54 43 4c 5f 46 4f 52 4d 41 54 ...) TCL_FORMAT
4ba0: 5f 50 52 49 4e 54 46 28 31 2c 20 32 29 3b 0a 74 _PRINTF(1, 2);.t
4bb0: 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f ypedef int (Tcl_
4bc0: 50 6f 73 74 49 6e 69 74 50 72 6f 63 29 20 28 54 PostInitProc) (T
4bd0: 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 cl_Interp *inter
4be0: 70 2c 20 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 p, void *clientD
4bf0: 61 74 61 29 3b 0a 74 79 70 65 64 65 66 20 76 6f ata);.typedef vo
4c00: 69 64 20 28 54 63 6c 5f 54 63 70 41 63 63 65 70 id (Tcl_TcpAccep
4c10: 74 50 72 6f 63 29 20 28 76 6f 69 64 20 2a 63 61 tProc) (void *ca
4c20: 6c 6c 62 61 63 6b 44 61 74 61 2c 20 54 63 6c 5f llbackData, Tcl_
4c30: 43 68 61 6e 6e 65 6c 20 63 68 61 6e 2c 0a 09 63 Channel chan,..c
4c40: 68 61 72 20 2a 61 64 64 72 65 73 73 2c 20 69 6e har *address, in
4c50: 74 20 70 6f 72 74 29 3b 0a 74 79 70 65 64 65 66 t port);.typedef
4c60: 20 76 6f 69 64 20 28 54 63 6c 5f 54 69 6d 65 72 void (Tcl_Timer
4c70: 50 72 6f 63 29 20 28 76 6f 69 64 20 2a 63 6c 69 Proc) (void *cli
4c80: 65 6e 74 44 61 74 61 29 3b 0a 74 79 70 65 64 65 entData);.typede
4c90: 66 20 69 6e 74 20 28 54 63 6c 5f 53 65 74 46 72 f int (Tcl_SetFr
4ca0: 6f 6d 41 6e 79 50 72 6f 63 29 20 28 54 63 6c 5f omAnyProc) (Tcl_
4cb0: 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c 20 Interp *interp,
4cc0: 73 74 72 75 63 74 20 54 63 6c 5f 4f 62 6a 20 2a struct Tcl_Obj *
4cd0: 6f 62 6a 50 74 72 29 3b 0a 74 79 70 65 64 65 66 objPtr);.typedef
4ce0: 20 76 6f 69 64 20 28 54 63 6c 5f 55 70 64 61 74 void (Tcl_Updat
4cf0: 65 53 74 72 69 6e 67 50 72 6f 63 29 20 28 73 74 eStringProc) (st
4d00: 72 75 63 74 20 54 63 6c 5f 4f 62 6a 20 2a 6f 62 ruct Tcl_Obj *ob
4d10: 6a 50 74 72 29 3b 0a 74 79 70 65 64 65 66 20 63 jPtr);.typedef c
4d20: 68 61 72 20 2a 20 28 54 63 6c 5f 56 61 72 54 72 har * (Tcl_VarTr
4d30: 61 63 65 50 72 6f 63 29 20 28 76 6f 69 64 20 2a aceProc) (void *
4d40: 63 6c 69 65 6e 74 44 61 74 61 2c 20 54 63 6c 5f clientData, Tcl_
4d50: 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c 0a Interp *interp,.
4d60: 09 63 6f 6e 73 74 20 63 68 61 72 20 2a 70 61 72 .const char *par
4d70: 74 31 2c 20 63 6f 6e 73 74 20 63 68 61 72 20 2a t1, const char *
4d80: 70 61 72 74 32 2c 20 69 6e 74 20 66 6c 61 67 73 part2, int flags
4d90: 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 64 20 );.typedef void
4da0: 28 54 63 6c 5f 43 6f 6d 6d 61 6e 64 54 72 61 63 (Tcl_CommandTrac
4db0: 65 50 72 6f 63 29 20 28 76 6f 69 64 20 2a 63 6c eProc) (void *cl
4dc0: 69 65 6e 74 44 61 74 61 2c 20 54 63 6c 5f 49 6e ientData, Tcl_In
4dd0: 74 65 72 70 20 2a 69 6e 74 65 72 70 2c 0a 09 63 terp *interp,..c
4de0: 6f 6e 73 74 20 63 68 61 72 20 2a 6f 6c 64 4e 61 onst char *oldNa
4df0: 6d 65 2c 20 63 6f 6e 73 74 20 63 68 61 72 20 2a me, const char *
4e00: 6e 65 77 4e 61 6d 65 2c 20 69 6e 74 20 66 6c 61 newName, int fla
4e10: 67 73 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 gs);.typedef voi
4e20: 64 20 28 54 63 6c 5f 43 72 65 61 74 65 46 69 6c d (Tcl_CreateFil
4e30: 65 48 61 6e 64 6c 65 72 50 72 6f 63 29 20 28 69 eHandlerProc) (i
4e40: 6e 74 20 66 64 2c 20 69 6e 74 20 6d 61 73 6b 2c nt fd, int mask,
4e50: 20 54 63 6c 5f 46 69 6c 65 50 72 6f 63 20 2a 70 Tcl_FileProc *p
4e60: 72 6f 63 2c 0a 09 76 6f 69 64 20 2a 63 6c 69 65 roc,..void *clie
4e70: 6e 74 44 61 74 61 29 3b 0a 74 79 70 65 64 65 66 ntData);.typedef
4e80: 20 76 6f 69 64 20 28 54 63 6c 5f 44 65 6c 65 74 void (Tcl_Delet
4e90: 65 46 69 6c 65 48 61 6e 64 6c 65 72 50 72 6f 63 eFileHandlerProc
4ea0: 29 20 28 69 6e 74 20 66 64 29 3b 0a 74 79 70 65 ) (int fd);.type
4eb0: 64 65 66 20 76 6f 69 64 20 28 54 63 6c 5f 41 6c def void (Tcl_Al
4ec0: 65 72 74 4e 6f 74 69 66 69 65 72 50 72 6f 63 29 ertNotifierProc)
4ed0: 20 28 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 61 (void *clientDa
4ee0: 74 61 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 ta);.typedef voi
4ef0: 64 20 28 54 63 6c 5f 53 65 72 76 69 63 65 4d 6f d (Tcl_ServiceMo
4f00: 64 65 48 6f 6f 6b 50 72 6f 63 29 20 28 69 6e 74 deHookProc) (int
4f10: 20 6d 6f 64 65 29 3b 0a 74 79 70 65 64 65 66 20 mode);.typedef
4f20: 76 6f 69 64 20 2a 28 54 63 6c 5f 49 6e 69 74 4e void *(Tcl_InitN
4f30: 6f 74 69 66 69 65 72 50 72 6f 63 29 20 28 76 6f otifierProc) (vo
4f40: 69 64 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 id);.typedef voi
4f50: 64 20 28 54 63 6c 5f 46 69 6e 61 6c 69 7a 65 4e d (Tcl_FinalizeN
4f60: 6f 74 69 66 69 65 72 50 72 6f 63 29 20 28 76 6f otifierProc) (vo
4f70: 69 64 20 2a 63 6c 69 65 6e 74 44 61 74 61 29 3b id *clientData);
4f80: 0a 74 79 70 65 64 65 66 20 76 6f 69 64 20 28 54 .typedef void (T
4f90: 63 6c 5f 4d 61 69 6e 4c 6f 6f 70 50 72 6f 63 29 cl_MainLoopProc)
4fa0: 20 28 76 6f 69 64 29 3b 0a 0c 0a 2f 2a 20 41 62 (void);.../* Ab
4fb0: 73 74 72 61 63 74 20 4c 69 73 74 20 66 75 6e 63 stract List func
4fc0: 74 69 6f 6e 73 20 2a 2f 0a 74 79 70 65 64 65 66 tions */.typedef
4fd0: 20 54 63 6c 5f 53 69 7a 65 20 28 54 63 6c 5f 4f Tcl_Size (Tcl_O
4fe0: 62 6a 54 79 70 65 4c 65 6e 67 74 68 50 72 6f 63 bjTypeLengthProc
4ff0: 29 20 28 73 74 72 75 63 74 20 54 63 6c 5f 4f 62 ) (struct Tcl_Ob
5000: 6a 20 2a 6c 69 73 74 50 74 72 29 3b 0a 74 79 70 j *listPtr);.typ
5010: 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 4f 62 edef int (Tcl_Ob
5020: 6a 54 79 70 65 49 6e 64 65 78 50 72 6f 63 29 20 jTypeIndexProc)
5030: 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 (Tcl_Interp *int
5040: 65 72 70 2c 20 73 74 72 75 63 74 20 54 63 6c 5f erp, struct Tcl_
5050: 4f 62 6a 20 2a 6c 69 73 74 50 74 72 2c 0a 09 54 Obj *listPtr,..T
5060: 63 6c 5f 53 69 7a 65 20 69 6e 64 65 78 2c 20 73 cl_Size index, s
5070: 74 72 75 63 74 20 54 63 6c 5f 4f 62 6a 20 2a 2a truct Tcl_Obj **
5080: 65 6c 65 6d 4f 62 6a 29 3b 0a 74 79 70 65 64 65 elemObj);.typede
5090: 66 20 69 6e 74 20 28 54 63 6c 5f 4f 62 6a 54 79 f int (Tcl_ObjTy
50a0: 70 65 53 6c 69 63 65 50 72 6f 63 29 20 28 54 63 peSliceProc) (Tc
50b0: 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 l_Interp *interp
50c0: 2c 20 73 74 72 75 63 74 20 54 63 6c 5f 4f 62 6a , struct Tcl_Obj
50d0: 20 2a 6c 69 73 74 50 74 72 2c 0a 09 54 63 6c 5f *listPtr,..Tcl_
50e0: 53 69 7a 65 20 66 72 6f 6d 49 64 78 2c 20 54 63 Size fromIdx, Tc
50f0: 6c 5f 53 69 7a 65 20 74 6f 49 64 78 2c 20 73 74 l_Size toIdx, st
5100: 72 75 63 74 20 54 63 6c 5f 4f 62 6a 20 2a 2a 6e ruct Tcl_Obj **n
5110: 65 77 4f 62 6a 50 74 72 29 3b 0a 74 79 70 65 64 ewObjPtr);.typed
5120: 65 66 20 69 6e 74 20 28 54 63 6c 5f 4f 62 6a 54 ef int (Tcl_ObjT
5130: 79 70 65 52 65 76 65 72 73 65 50 72 6f 63 29 20 ypeReverseProc)
5140: 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 (Tcl_Interp *int
5150: 65 72 70 2c 0a 09 73 74 72 75 63 74 20 54 63 6c erp,..struct Tcl
5160: 5f 4f 62 6a 20 2a 6c 69 73 74 50 74 72 2c 20 73 _Obj *listPtr, s
5170: 74 72 75 63 74 20 54 63 6c 5f 4f 62 6a 20 2a 2a truct Tcl_Obj **
5180: 6e 65 77 4f 62 6a 50 74 72 29 3b 0a 74 79 70 65 newObjPtr);.type
5190: 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 4f 62 6a def int (Tcl_Obj
51a0: 54 79 70 65 47 65 74 45 6c 65 6d 65 6e 74 73 29 TypeGetElements)
51b0: 20 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e (Tcl_Interp *in
51c0: 74 65 72 70 2c 0a 09 73 74 72 75 63 74 20 54 63 terp,..struct Tc
51d0: 6c 5f 4f 62 6a 20 2a 6c 69 73 74 50 74 72 2c 20 l_Obj *listPtr,
51e0: 54 63 6c 5f 53 69 7a 65 20 2a 6f 62 6a 63 70 74 Tcl_Size *objcpt
51f0: 72 2c 20 73 74 72 75 63 74 20 54 63 6c 5f 4f 62 r, struct Tcl_Ob
5200: 6a 20 2a 2a 2a 6f 62 6a 76 70 74 72 29 3b 0a 74 j ***objvptr);.t
5210: 79 70 65 64 65 66 20 73 74 72 75 63 74 20 54 63 ypedef struct Tc
5220: 6c 5f 4f 62 6a 20 2a 28 54 63 6c 5f 4f 62 6a 54 l_Obj *(Tcl_ObjT
5230: 79 70 65 53 65 74 45 6c 65 6d 65 6e 74 29 20 28 ypeSetElement) (
5240: 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 Tcl_Interp *inte
5250: 72 70 2c 0a 09 73 74 72 75 63 74 20 54 63 6c 5f rp,..struct Tcl_
5260: 4f 62 6a 20 2a 6c 69 73 74 50 74 72 2c 20 54 63 Obj *listPtr, Tc
5270: 6c 5f 53 69 7a 65 20 69 6e 64 65 78 43 6f 75 6e l_Size indexCoun
5280: 74 2c 0a 09 73 74 72 75 63 74 20 54 63 6c 5f 4f t,..struct Tcl_O
5290: 62 6a 20 2a 63 6f 6e 73 74 20 69 6e 64 65 78 41 bj *const indexA
52a0: 72 72 61 79 5b 5d 2c 20 73 74 72 75 63 74 20 54 rray[], struct T
52b0: 63 6c 5f 4f 62 6a 20 2a 76 61 6c 75 65 4f 62 6a cl_Obj *valueObj
52c0: 29 3b 0a 74 79 70 65 64 65 66 20 69 6e 74 20 28 );.typedef int (
52d0: 54 63 6c 5f 4f 62 6a 54 79 70 65 52 65 70 6c 61 Tcl_ObjTypeRepla
52e0: 63 65 50 72 6f 63 29 20 28 54 63 6c 5f 49 6e 74 ceProc) (Tcl_Int
52f0: 65 72 70 20 2a 69 6e 74 65 72 70 2c 0a 09 73 74 erp *interp,..st
5300: 72 75 63 74 20 54 63 6c 5f 4f 62 6a 20 2a 6c 69 ruct Tcl_Obj *li
5310: 73 74 4f 62 6a 2c 20 54 63 6c 5f 53 69 7a 65 20 stObj, Tcl_Size
5320: 66 69 72 73 74 2c 20 54 63 6c 5f 53 69 7a 65 20 first, Tcl_Size
5330: 6e 75 6d 54 6f 44 65 6c 65 74 65 2c 0a 09 54 63 numToDelete,..Tc
5340: 6c 5f 53 69 7a 65 20 6e 75 6d 54 6f 49 6e 73 65 l_Size numToInse
5350: 72 74 2c 20 73 74 72 75 63 74 20 54 63 6c 5f 4f rt, struct Tcl_O
5360: 62 6a 20 2a 63 6f 6e 73 74 20 69 6e 73 65 72 74 bj *const insert
5370: 4f 62 6a 73 5b 5d 29 3b 0a 74 79 70 65 64 65 66 Objs[]);.typedef
5380: 20 69 6e 74 20 28 54 63 6c 5f 4f 62 6a 54 79 70 int (Tcl_ObjTyp
5390: 65 49 6e 4f 70 65 72 61 74 6f 72 50 72 6f 63 29 eInOperatorProc)
53a0: 20 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e (Tcl_Interp *in
53b0: 74 65 72 70 2c 0a 09 73 74 72 75 63 74 20 54 63 terp,..struct Tc
53c0: 6c 5f 4f 62 6a 20 2a 76 61 6c 75 65 4f 62 6a 2c l_Obj *valueObj,
53d0: 20 73 74 72 75 63 74 20 54 63 6c 5f 4f 62 6a 20 struct Tcl_Obj
53e0: 2a 6c 69 73 74 4f 62 6a 2c 20 69 6e 74 20 2a 62 *listObj, int *b
53f0: 6f 6f 6c 52 65 73 75 6c 74 29 3b 0a 0a 23 69 66 oolResult);..#if
5400: 6e 64 65 66 20 54 43 4c 5f 4e 4f 5f 44 45 50 52 ndef TCL_NO_DEPR
5410: 45 43 41 54 45 44 0a 23 20 20 20 64 65 66 69 6e ECATED.# defin
5420: 65 20 54 63 6c 5f 50 61 63 6b 61 67 65 49 6e 69 e Tcl_PackageIni
5430: 74 50 72 6f 63 20 54 63 6c 5f 4c 69 62 72 61 72 tProc Tcl_Librar
5440: 79 49 6e 69 74 50 72 6f 63 0a 23 20 20 20 64 65 yInitProc.# de
5450: 66 69 6e 65 20 54 63 6c 5f 50 61 63 6b 61 67 65 fine Tcl_Package
5460: 55 6e 6c 6f 61 64 50 72 6f 63 20 54 63 6c 5f 4c UnloadProc Tcl_L
5470: 69 62 72 61 72 79 55 6e 6c 6f 61 64 50 72 6f 63 ibraryUnloadProc
5480: 0a 23 65 6e 64 69 66 0a 0a 2f 2a 0a 20 2a 2d 2d .#endif../*. *--
5490: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
54a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
54b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
54c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
54d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 54 68 ----------. * Th
54e0: 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 73 74 72 75 e following stru
54f0: 63 74 75 72 65 20 72 65 70 72 65 73 65 6e 74 73 cture represents
5500: 20 61 20 74 79 70 65 20 6f 66 20 6f 62 6a 65 63 a type of objec
5510: 74 2c 20 77 68 69 63 68 20 69 73 20 61 20 70 61 t, which is a pa
5520: 72 74 69 63 75 6c 61 72 0a 20 2a 20 69 6e 74 65 rticular. * inte
5530: 72 6e 61 6c 20 72 65 70 72 65 73 65 6e 74 61 74 rnal representat
5540: 69 6f 6e 20 66 6f 72 20 61 6e 20 6f 62 6a 65 63 ion for an objec
5550: 74 20 70 6c 75 73 20 61 20 73 65 74 20 6f 66 20 t plus a set of
5560: 66 75 6e 63 74 69 6f 6e 73 20 74 68 61 74 20 70 functions that p
5570: 72 6f 76 69 64 65 0a 20 2a 20 73 74 61 6e 64 61 rovide. * standa
5580: 72 64 20 6f 70 65 72 61 74 69 6f 6e 73 20 6f 6e rd operations on
5590: 20 6f 62 6a 65 63 74 73 20 6f 66 20 74 68 61 74 objects of that
55a0: 20 74 79 70 65 2e 0a 20 2a 2f 0a 0a 74 79 70 65 type.. */..type
55b0: 64 65 66 20 73 74 72 75 63 74 20 54 63 6c 5f 4f def struct Tcl_O
55c0: 62 6a 54 79 70 65 20 7b 0a 20 20 20 20 63 6f 6e bjType {. con
55d0: 73 74 20 63 68 61 72 20 2a 6e 61 6d 65 3b 09 09 st char *name;..
55e0: 2f 2a 20 4e 61 6d 65 20 6f 66 20 74 68 65 20 74 /* Name of the t
55f0: 79 70 65 2c 20 65 2e 67 2e 20 22 69 6e 74 22 2e ype, e.g. "int".
5600: 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 72 65 65 */. Tcl_Free
5610: 49 6e 74 65 72 6e 61 6c 52 65 70 50 72 6f 63 20 InternalRepProc
5620: 2a 66 72 65 65 49 6e 74 52 65 70 50 72 6f 63 3b *freeIntRepProc;
5630: 0a 09 09 09 09 2f 2a 20 43 61 6c 6c 65 64 20 74 ...../* Called t
5640: 6f 20 66 72 65 65 20 61 6e 79 20 73 74 6f 72 61 o free any stora
5650: 67 65 20 66 6f 72 20 74 68 65 20 74 79 70 65 27 ge for the type'
5660: 73 0a 09 09 09 09 20 2a 20 69 6e 74 65 72 6e 61 s..... * interna
5670: 6c 20 72 65 70 2e 20 4e 55 4c 4c 20 69 66 20 74 l rep. NULL if t
5680: 68 65 20 69 6e 74 65 72 6e 61 6c 20 72 65 70 20 he internal rep
5690: 64 6f 65 73 0a 09 09 09 09 20 2a 20 6e 6f 74 20 does..... * not
56a0: 6e 65 65 64 20 66 72 65 65 69 6e 67 2e 20 2a 2f need freeing. */
56b0: 0a 20 20 20 20 54 63 6c 5f 44 75 70 49 6e 74 65 . Tcl_DupInte
56c0: 72 6e 61 6c 52 65 70 50 72 6f 63 20 2a 64 75 70 rnalRepProc *dup
56d0: 49 6e 74 52 65 70 50 72 6f 63 3b 0a 09 09 09 09 IntRepProc;.....
56e0: 2f 2a 20 43 61 6c 6c 65 64 20 74 6f 20 63 72 65 /* Called to cre
56f0: 61 74 65 20 61 20 6e 65 77 20 6f 62 6a 65 63 74 ate a new object
5700: 20 61 73 20 61 20 63 6f 70 79 20 6f 66 0a 09 09 as a copy of...
5710: 09 09 20 2a 20 61 6e 20 65 78 69 73 74 69 6e 67 .. * an existing
5720: 20 6f 62 6a 65 63 74 2e 20 2a 2f 0a 20 20 20 20 object. */.
5730: 54 63 6c 5f 55 70 64 61 74 65 53 74 72 69 6e 67 Tcl_UpdateString
5740: 50 72 6f 63 20 2a 75 70 64 61 74 65 53 74 72 69 Proc *updateStri
5750: 6e 67 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 43 ngProc;...../* C
5760: 61 6c 6c 65 64 20 74 6f 20 75 70 64 61 74 65 20 alled to update
5770: 74 68 65 20 73 74 72 69 6e 67 20 72 65 70 20 66 the string rep f
5780: 72 6f 6d 20 74 68 65 0a 09 09 09 09 20 2a 20 74 rom the..... * t
5790: 79 70 65 27 73 20 69 6e 74 65 72 6e 61 6c 20 72 ype's internal r
57a0: 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2e 20 2a epresentation. *
57b0: 2f 0a 20 20 20 20 54 63 6c 5f 53 65 74 46 72 6f /. Tcl_SetFro
57c0: 6d 41 6e 79 50 72 6f 63 20 2a 73 65 74 46 72 6f mAnyProc *setFro
57d0: 6d 41 6e 79 50 72 6f 63 3b 0a 09 09 09 09 2f 2a mAnyProc;...../*
57e0: 20 43 61 6c 6c 65 64 20 74 6f 20 63 6f 6e 76 65 Called to conve
57f0: 72 74 20 74 68 65 20 6f 62 6a 65 63 74 27 73 20 rt the object's
5800: 69 6e 74 65 72 6e 61 6c 20 72 65 70 0a 09 09 09 internal rep....
5810: 09 20 2a 20 74 6f 20 74 68 69 73 20 74 79 70 65 . * to this type
5820: 2e 20 46 72 65 65 73 20 74 68 65 20 69 6e 74 65 . Frees the inte
5830: 72 6e 61 6c 20 72 65 70 20 6f 66 20 74 68 65 0a rnal rep of the.
5840: 09 09 09 09 20 2a 20 6f 6c 64 20 74 79 70 65 2e .... * old type.
5850: 20 52 65 74 75 72 6e 73 20 54 43 4c 5f 45 52 52 Returns TCL_ERR
5860: 4f 52 20 6f 6e 20 66 61 69 6c 75 72 65 2e 20 2a OR on failure. *
5870: 2f 0a 20 20 20 20 73 69 7a 65 5f 74 20 76 65 72 /. size_t ver
5880: 73 69 6f 6e 3b 09 09 2f 2a 20 56 65 72 73 69 6f sion;../* Versio
5890: 6e 20 66 69 65 6c 64 20 66 6f 72 20 66 75 74 75 n field for futu
58a0: 72 65 2d 70 72 6f 6f 66 69 6e 67 2e 20 2a 2f 0a re-proofing. */.
58b0: 0a 20 20 20 20 2f 2a 20 4c 69 73 74 20 65 6d 75 . /* List emu
58c0: 6c 61 74 69 6f 6e 20 66 75 6e 63 74 69 6f 6e 73 lation functions
58d0: 20 2d 20 4f 62 6a 54 79 70 65 20 56 65 72 73 69 - ObjType Versi
58e0: 6f 6e 20 31 20 2a 2f 0a 20 20 20 20 54 63 6c 5f on 1 */. Tcl_
58f0: 4f 62 6a 54 79 70 65 4c 65 6e 67 74 68 50 72 6f ObjTypeLengthPro
5900: 63 20 2a 6c 65 6e 67 74 68 50 72 6f 63 3b 0a 09 c *lengthProc;..
5910: 09 09 09 2f 2a 20 52 65 74 75 72 6e 20 74 68 65 .../* Return the
5920: 20 5b 6c 6c 65 6e 67 74 68 5d 20 6f 66 20 74 68 [llength] of th
5930: 65 20 41 62 73 74 72 61 63 74 4c 69 73 74 20 2a e AbstractList *
5940: 2f 0a 20 20 20 20 54 63 6c 5f 4f 62 6a 54 79 70 /. Tcl_ObjTyp
5950: 65 49 6e 64 65 78 50 72 6f 63 20 2a 69 6e 64 65 eIndexProc *inde
5960: 78 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 52 65 xProc;...../* Re
5970: 74 75 72 6e 20 61 20 76 61 6c 75 65 20 28 54 63 turn a value (Tc
5980: 6c 5f 4f 62 6a 29 20 61 74 20 61 20 67 69 76 65 l_Obj) at a give
5990: 6e 20 69 6e 64 65 78 20 2a 2f 0a 20 20 20 20 54 n index */. T
59a0: 63 6c 5f 4f 62 6a 54 79 70 65 53 6c 69 63 65 50 cl_ObjTypeSliceP
59b0: 72 6f 63 20 2a 73 6c 69 63 65 50 72 6f 63 3b 0a roc *sliceProc;.
59c0: 09 09 09 09 2f 2a 20 52 65 74 75 72 6e 20 61 6e ..../* Return an
59d0: 20 41 62 73 74 72 61 63 74 4c 69 73 74 20 66 6f AbstractList fo
59e0: 72 0a 09 09 09 09 20 2a 20 5b 6c 72 61 6e 67 65 r..... * [lrange
59f0: 20 24 61 6c 20 24 73 74 61 72 74 20 24 65 6e 64 $al $start $end
5a00: 5d 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 4f 62 6a ] */. Tcl_Obj
5a10: 54 79 70 65 52 65 76 65 72 73 65 50 72 6f 63 20 TypeReverseProc
5a20: 2a 72 65 76 65 72 73 65 50 72 6f 63 3b 0a 09 09 *reverseProc;...
5a30: 09 09 2f 2a 20 52 65 74 75 72 6e 20 61 6e 20 41 ../* Return an A
5a40: 62 73 74 72 61 63 74 4c 69 73 74 20 66 6f 72 20 bstractList for
5a50: 5b 6c 72 65 76 65 72 73 65 20 24 61 6c 5d 20 2a [lreverse $al] *
5a60: 2f 0a 20 20 20 20 54 63 6c 5f 4f 62 6a 54 79 70 /. Tcl_ObjTyp
5a70: 65 47 65 74 45 6c 65 6d 65 6e 74 73 20 2a 67 65 eGetElements *ge
5a80: 74 45 6c 65 6d 65 6e 74 73 50 72 6f 63 3b 0a 09 tElementsProc;..
5a90: 09 09 09 2f 2a 20 52 65 74 75 72 6e 20 61 6e 20 .../* Return an
5aa0: 6f 62 6a 76 5b 5d 20 6f 66 20 61 6c 6c 20 65 6c objv[] of all el
5ab0: 65 6d 65 6e 74 73 20 69 6e 20 74 68 65 20 6c 69 ements in the li
5ac0: 73 74 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 4f 62 st */. Tcl_Ob
5ad0: 6a 54 79 70 65 53 65 74 45 6c 65 6d 65 6e 74 20 jTypeSetElement
5ae0: 2a 73 65 74 45 6c 65 6d 65 6e 74 50 72 6f 63 3b *setElementProc;
5af0: 0a 09 09 09 09 2f 2a 20 52 65 70 6c 61 63 65 20 ...../* Replace
5b00: 74 68 65 20 65 6c 65 6d 65 6e 74 20 61 74 20 74 the element at t
5b10: 68 65 20 69 6e 64 69 63 69 65 73 20 77 69 74 68 he indicies with
5b20: 20 74 68 65 0a 09 09 09 09 20 2a 20 67 69 76 65 the..... * give
5b30: 6e 20 76 61 6c 75 65 4f 62 6a 2e 20 2a 2f 0a 20 n valueObj. */.
5b40: 20 20 20 54 63 6c 5f 4f 62 6a 54 79 70 65 52 65 Tcl_ObjTypeRe
5b50: 70 6c 61 63 65 50 72 6f 63 20 2a 72 65 70 6c 61 placeProc *repla
5b60: 63 65 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 52 ceProc;...../* R
5b70: 65 70 6c 61 63 65 20 73 75 62 6c 69 73 74 20 77 eplace sublist w
5b80: 69 74 68 20 61 6e 6f 74 68 65 72 20 73 75 62 6c ith another subl
5b90: 69 73 74 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 4f ist */. Tcl_O
5ba0: 62 6a 54 79 70 65 49 6e 4f 70 65 72 61 74 6f 72 bjTypeInOperator
5bb0: 50 72 6f 63 20 2a 69 6e 4f 70 65 72 50 72 6f 63 Proc *inOperProc
5bc0: 3b 0a 09 09 09 09 2f 2a 20 22 69 6e 22 20 61 6e ;...../* "in" an
5bd0: 64 20 22 6e 69 22 20 65 78 70 72 20 6c 69 73 74 d "ni" expr list
5be0: 20 6f 70 65 72 61 74 69 6f 6e 2e 0a 09 09 09 09 operation......
5bf0: 20 2a 20 44 65 74 65 72 6d 69 6e 65 20 69 66 20 * Determine if
5c00: 74 68 65 20 67 69 76 65 6e 20 73 74 72 69 6e 67 the given string
5c10: 20 76 61 6c 75 65 20 6d 61 74 63 68 65 73 0a 09 value matches..
5c20: 09 09 09 20 2a 20 61 6e 20 65 6c 65 6d 65 6e 74 ... * an element
5c30: 20 69 6e 20 74 68 65 20 6c 69 73 74 2e 20 2a 2f in the list. */
5c40: 0a 7d 20 54 63 6c 5f 4f 62 6a 54 79 70 65 3b 0a .} Tcl_ObjType;.
5c50: 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4f 42 4a .#define TCL_OBJ
5c60: 54 59 50 45 5f 56 30 20 30 2c 20 5c 0a 09 30 2c TYPE_V0 0, \..0,
5c70: 30 2c 30 2c 30 2c 30 2c 30 2c 30 2c 30 20 2f 2a 0,0,0,0,0,0,0 /*
5c80: 20 50 72 65 2d 54 63 6c 20 39 20 2a 2f 0a 23 64 Pre-Tcl 9 */.#d
5c90: 65 66 69 6e 65 20 54 43 4c 5f 4f 42 4a 54 59 50 efine TCL_OBJTYP
5ca0: 45 5f 56 31 28 61 29 20 6f 66 66 73 65 74 6f 66 E_V1(a) offsetof
5cb0: 28 54 63 6c 5f 4f 62 6a 54 79 70 65 2c 20 69 6e (Tcl_ObjType, in
5cc0: 64 65 78 50 72 6f 63 29 2c 20 5c 0a 09 61 2c 30 dexProc), \..a,0
5cd0: 2c 30 2c 30 2c 30 2c 30 2c 30 2c 30 20 2f 2a 20 ,0,0,0,0,0,0 /*
5ce0: 54 63 6c 20 39 20 56 65 72 73 69 6f 6e 20 31 20 Tcl 9 Version 1
5cf0: 2a 2f 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4f */.#define TCL_O
5d00: 42 4a 54 59 50 45 5f 56 32 28 61 2c 62 2c 63 2c BJTYPE_V2(a,b,c,
5d10: 64 2c 65 2c 66 2c 67 2c 68 29 20 73 69 7a 65 6f d,e,f,g,h) sizeo
5d20: 66 28 54 63 6c 5f 4f 62 6a 54 79 70 65 29 2c 20 f(Tcl_ObjType),
5d30: 20 5c 0a 09 61 2c 62 2c 63 2c 64 2c 65 2c 66 2c \..a,b,c,d,e,f,
5d40: 67 2c 68 20 2f 2a 20 54 63 6c 20 39 20 2d 20 41 g,h /* Tcl 9 - A
5d50: 62 73 74 72 61 63 74 4c 69 73 74 73 20 2a 2f 0a bstractLists */.
5d60: 0a 2f 2a 0a 20 2a 20 54 68 65 20 66 6f 6c 6c 6f ./*. * The follo
5d70: 77 69 6e 67 20 73 74 72 75 63 74 75 72 65 20 73 wing structure s
5d80: 74 6f 72 65 73 20 61 6e 20 69 6e 74 65 72 6e 61 tores an interna
5d90: 6c 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e l representation
5da0: 20 28 69 6e 74 65 72 6e 61 6c 72 65 70 29 20 66 (internalrep) f
5db0: 6f 72 0a 20 2a 20 61 20 54 63 6c 20 76 61 6c 75 or. * a Tcl valu
5dc0: 65 2e 20 41 6e 20 69 6e 74 65 72 6e 61 6c 72 65 e. An internalre
5dd0: 70 20 69 73 20 61 73 73 6f 63 69 61 74 65 64 20 p is associated
5de0: 77 69 74 68 20 61 6e 20 54 63 6c 5f 4f 62 6a 54 with an Tcl_ObjT
5df0: 79 70 65 20 77 68 65 6e 20 62 6f 74 68 0a 20 2a ype when both. *
5e00: 20 61 72 65 20 73 74 6f 72 65 64 20 69 6e 20 74 are stored in t
5e10: 68 65 20 73 61 6d 65 20 54 63 6c 5f 4f 62 6a 2e he same Tcl_Obj.
5e20: 20 20 54 68 65 20 72 6f 75 74 69 6e 65 73 20 6f The routines o
5e30: 66 20 74 68 65 20 54 63 6c 5f 4f 62 6a 54 79 70 f the Tcl_ObjTyp
5e40: 65 20 67 6f 76 65 72 6e 0a 20 2a 20 74 68 65 20 e govern. * the
5e50: 68 61 6e 64 6c 69 6e 67 20 6f 66 20 74 68 65 20 handling of the
5e60: 69 6e 74 65 72 6e 61 6c 72 65 70 2e 0a 20 2a 2f internalrep.. */
5e70: 0a 0a 74 79 70 65 64 65 66 20 75 6e 69 6f 6e 20 ..typedef union
5e80: 54 63 6c 5f 4f 62 6a 49 6e 74 65 72 6e 61 6c 52 Tcl_ObjInternalR
5e90: 65 70 20 7b 2f 2a 20 54 68 65 20 69 6e 74 65 72 ep {/* The inter
5ea0: 6e 61 6c 20 72 65 70 72 65 73 65 6e 74 61 74 69 nal representati
5eb0: 6f 6e 3a 20 2a 2f 0a 20 20 20 20 6c 6f 6e 67 20 on: */. long
5ec0: 6c 6f 6e 67 56 61 6c 75 65 3b 09 09 2f 2a 20 20 longValue;../*
5ed0: 20 2d 20 61 6e 20 6c 6f 6e 67 20 69 6e 74 65 67 - an long integ
5ee0: 65 72 20 76 61 6c 75 65 2e 20 2a 2f 0a 20 20 20 er value. */.
5ef0: 20 64 6f 75 62 6c 65 20 64 6f 75 62 6c 65 56 61 double doubleVa
5f00: 6c 75 65 3b 09 09 2f 2a 20 20 20 2d 20 61 20 64 lue;../* - a d
5f10: 6f 75 62 6c 65 2d 70 72 65 63 69 73 69 6f 6e 20 ouble-precision
5f20: 66 6c 6f 61 74 69 6e 67 20 76 61 6c 75 65 2e 20 floating value.
5f30: 2a 2f 0a 20 20 20 20 76 6f 69 64 20 2a 6f 74 68 */. void *oth
5f40: 65 72 56 61 6c 75 65 50 74 72 3b 09 2f 2a 20 20 erValuePtr;./*
5f50: 20 2d 20 61 6e 6f 74 68 65 72 2c 20 74 79 70 65 - another, type
5f60: 2d 73 70 65 63 69 66 69 63 20 76 61 6c 75 65 2c -specific value,
5f70: 20 2a 2f 0a 09 09 09 09 2f 2a 20 20 20 20 20 6e */...../* n
5f80: 6f 74 20 75 73 65 64 20 69 6e 74 65 72 6e 61 6c ot used internal
5f90: 6c 79 20 61 6e 79 20 6d 6f 72 65 2e 20 2a 2f 0a ly any more. */.
5fa0: 20 20 20 20 54 63 6c 5f 57 69 64 65 49 6e 74 20 Tcl_WideInt
5fb0: 77 69 64 65 56 61 6c 75 65 3b 09 2f 2a 20 20 20 wideValue;./*
5fc0: 2d 20 61 6e 20 69 6e 74 65 67 65 72 20 76 61 6c - an integer val
5fd0: 75 65 20 3e 3d 20 36 34 62 69 74 73 20 2a 2f 0a ue >= 64bits */.
5fe0: 20 20 20 20 73 74 72 75 63 74 20 7b 09 09 09 2f struct {.../
5ff0: 2a 20 20 20 2d 20 69 6e 74 65 72 6e 61 6c 20 72 * - internal r
6000: 65 70 20 61 73 20 74 77 6f 20 70 6f 69 6e 74 65 ep as two pointe
6010: 72 73 2e 20 2a 2f 0a 09 76 6f 69 64 20 2a 70 74 rs. */..void *pt
6020: 72 31 3b 0a 09 76 6f 69 64 20 2a 70 74 72 32 3b r1;..void *ptr2;
6030: 0a 20 20 20 20 7d 20 74 77 6f 50 74 72 56 61 6c . } twoPtrVal
6040: 75 65 3b 0a 20 20 20 20 73 74 72 75 63 74 20 7b ue;. struct {
6050: 09 09 09 2f 2a 20 20 20 2d 20 69 6e 74 65 72 6e .../* - intern
6060: 61 6c 20 72 65 70 20 61 73 20 61 20 70 6f 69 6e al rep as a poin
6070: 74 65 72 20 61 6e 64 20 61 20 6c 6f 6e 67 2c 20 ter and a long,
6080: 2a 2f 0a 09 76 6f 69 64 20 2a 70 74 72 3b 09 09 */..void *ptr;..
6090: 2f 2a 20 20 20 20 20 6e 6f 74 20 75 73 65 64 20 /* not used
60a0: 69 6e 74 65 72 6e 61 6c 6c 79 20 61 6e 79 20 6d internally any m
60b0: 6f 72 65 2e 20 2a 2f 0a 09 75 6e 73 69 67 6e 65 ore. */..unsigne
60c0: 64 20 6c 6f 6e 67 20 76 61 6c 75 65 3b 0a 20 20 d long value;.
60d0: 20 20 7d 20 70 74 72 41 6e 64 4c 6f 6e 67 52 65 } ptrAndLongRe
60e0: 70 3b 0a 20 20 20 20 73 74 72 75 63 74 20 7b 09 p;. struct {.
60f0: 09 09 2f 2a 20 20 20 2d 20 75 73 65 20 66 6f 72 ../* - use for
6100: 20 70 6f 69 6e 74 65 72 20 61 6e 64 20 6c 65 6e pointer and len
6110: 67 74 68 20 72 65 70 73 20 2a 2f 0a 09 76 6f 69 gth reps */..voi
6120: 64 20 2a 70 74 72 3b 0a 09 54 63 6c 5f 53 69 7a d *ptr;..Tcl_Siz
6130: 65 20 73 69 7a 65 3b 0a 20 20 20 20 7d 20 70 74 e size;. } pt
6140: 72 41 6e 64 53 69 7a 65 3b 0a 7d 20 54 63 6c 5f rAndSize;.} Tcl_
6150: 4f 62 6a 49 6e 74 65 72 6e 61 6c 52 65 70 3b 0a ObjInternalRep;.
6160: 0a 2f 2a 0a 20 2a 20 4f 6e 65 20 6f 66 20 74 68 ./*. * One of th
6170: 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 73 74 72 75 e following stru
6180: 63 74 75 72 65 73 20 65 78 69 73 74 73 20 66 6f ctures exists fo
6190: 72 20 65 61 63 68 20 6f 62 6a 65 63 74 20 69 6e r each object in
61a0: 20 74 68 65 20 54 63 6c 20 73 79 73 74 65 6d 2e the Tcl system.
61b0: 0a 20 2a 20 41 6e 20 6f 62 6a 65 63 74 20 73 74 . * An object st
61c0: 6f 72 65 73 20 61 20 76 61 6c 75 65 20 61 73 20 ores a value as
61d0: 65 69 74 68 65 72 20 61 20 73 74 72 69 6e 67 2c either a string,
61e0: 20 73 6f 6d 65 20 69 6e 74 65 72 6e 61 6c 20 72 some internal r
61f0: 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 2c 0a 20 epresentation,.
6200: 2a 20 6f 72 20 62 6f 74 68 2e 0a 20 2a 2f 0a 0a * or both.. */..
6210: 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20 54 typedef struct T
6220: 63 6c 5f 4f 62 6a 20 7b 0a 20 20 20 20 54 63 6c cl_Obj {. Tcl
6230: 5f 53 69 7a 65 20 72 65 66 43 6f 75 6e 74 3b 09 _Size refCount;.
6240: 09 2f 2a 20 57 68 65 6e 20 30 20 74 68 65 20 6f ./* When 0 the o
6250: 62 6a 65 63 74 20 77 69 6c 6c 20 62 65 20 66 72 bject will be fr
6260: 65 65 64 2e 20 2a 2f 0a 20 20 20 20 63 68 61 72 eed. */. char
6270: 20 2a 62 79 74 65 73 3b 09 09 2f 2a 20 54 68 69 *bytes;../* Thi
6280: 73 20 70 6f 69 6e 74 73 20 74 6f 20 74 68 65 20 s points to the
6290: 66 69 72 73 74 20 62 79 74 65 20 6f 66 20 74 68 first byte of th
62a0: 65 0a 09 09 09 09 20 2a 20 6f 62 6a 65 63 74 27 e..... * object'
62b0: 73 20 73 74 72 69 6e 67 20 72 65 70 72 65 73 65 s string represe
62c0: 6e 74 61 74 69 6f 6e 2e 20 54 68 65 20 61 72 72 ntation. The arr
62d0: 61 79 0a 09 09 09 09 20 2a 20 6d 75 73 74 20 62 ay..... * must b
62e0: 65 20 66 6f 6c 6c 6f 77 65 64 20 62 79 20 61 20 e followed by a
62f0: 6e 75 6c 6c 20 62 79 74 65 20 28 69 2e 65 2e 2c null byte (i.e.,
6300: 20 61 74 0a 09 09 09 09 20 2a 20 6f 66 66 73 65 at..... * offse
6310: 74 20 6c 65 6e 67 74 68 29 20 62 75 74 20 6d 61 t length) but ma
6320: 79 20 61 6c 73 6f 20 63 6f 6e 74 61 69 6e 0a 09 y also contain..
6330: 09 09 09 20 2a 20 65 6d 62 65 64 64 65 64 20 6e ... * embedded n
6340: 75 6c 6c 20 63 68 61 72 61 63 74 65 72 73 2e 20 ull characters.
6350: 54 68 65 20 61 72 72 61 79 27 73 0a 09 09 09 09 The array's.....
6360: 20 2a 20 73 74 6f 72 61 67 65 20 69 73 20 61 6c * storage is al
6370: 6c 6f 63 61 74 65 64 20 62 79 20 54 63 6c 5f 41 located by Tcl_A
6380: 6c 6c 6f 63 2e 20 4e 55 4c 4c 20 6d 65 61 6e 73 lloc. NULL means
6390: 0a 09 09 09 09 20 2a 20 74 68 65 20 73 74 72 69 ..... * the stri
63a0: 6e 67 20 72 65 70 20 69 73 20 69 6e 76 61 6c 69 ng rep is invali
63b0: 64 20 61 6e 64 20 6d 75 73 74 20 62 65 0a 09 09 d and must be...
63c0: 09 09 20 2a 20 72 65 67 65 6e 65 72 61 74 65 64 .. * regenerated
63d0: 20 66 72 6f 6d 20 74 68 65 20 69 6e 74 65 72 6e from the intern
63e0: 61 6c 20 72 65 70 2e 20 20 43 6c 69 65 6e 74 73 al rep. Clients
63f0: 0a 09 09 09 09 20 2a 20 73 68 6f 75 6c 64 20 75 ..... * should u
6400: 73 65 20 54 63 6c 5f 47 65 74 53 74 72 69 6e 67 se Tcl_GetString
6410: 46 72 6f 6d 4f 62 6a 20 6f 72 0a 09 09 09 09 20 FromObj or.....
6420: 2a 20 54 63 6c 5f 47 65 74 53 74 72 69 6e 67 20 * Tcl_GetString
6430: 74 6f 20 67 65 74 20 61 20 70 6f 69 6e 74 65 72 to get a pointer
6440: 20 74 6f 20 74 68 65 20 62 79 74 65 0a 09 09 09 to the byte....
6450: 09 20 2a 20 61 72 72 61 79 20 61 73 20 61 20 72 . * array as a r
6460: 65 61 64 6f 6e 6c 79 20 76 61 6c 75 65 2e 20 2a eadonly value. *
6470: 2f 0a 20 20 20 20 54 63 6c 5f 53 69 7a 65 20 6c /. Tcl_Size l
6480: 65 6e 67 74 68 3b 09 09 2f 2a 20 54 68 65 20 6e ength;../* The n
6490: 75 6d 62 65 72 20 6f 66 20 62 79 74 65 73 20 61 umber of bytes a
64a0: 74 20 2a 62 79 74 65 73 2c 20 6e 6f 74 0a 09 09 t *bytes, not...
64b0: 09 09 20 2a 20 69 6e 63 6c 75 64 69 6e 67 20 74 .. * including t
64c0: 68 65 20 74 65 72 6d 69 6e 61 74 69 6e 67 20 6e he terminating n
64d0: 75 6c 6c 2e 20 2a 2f 0a 20 20 20 20 63 6f 6e 73 ull. */. cons
64e0: 74 20 54 63 6c 5f 4f 62 6a 54 79 70 65 20 2a 74 t Tcl_ObjType *t
64f0: 79 70 65 50 74 72 3b 09 2f 2a 20 44 65 6e 6f 74 ypePtr;./* Denot
6500: 65 73 20 74 68 65 20 6f 62 6a 65 63 74 27 73 20 es the object's
6510: 74 79 70 65 2e 20 41 6c 77 61 79 73 0a 09 09 09 type. Always....
6520: 09 20 2a 20 63 6f 72 72 65 73 70 6f 6e 64 73 20 . * corresponds
6530: 74 6f 20 74 68 65 20 74 79 70 65 20 6f 66 20 74 to the type of t
6540: 68 65 20 6f 62 6a 65 63 74 27 73 0a 09 09 09 09 he object's.....
6550: 20 2a 20 69 6e 74 65 72 6e 61 6c 20 72 65 70 2e * internal rep.
6560: 20 4e 55 4c 4c 20 69 6e 64 69 63 61 74 65 73 20 NULL indicates
6570: 74 68 65 20 6f 62 6a 65 63 74 20 68 61 73 0a 09 the object has..
6580: 09 09 09 20 2a 20 6e 6f 20 69 6e 74 65 72 6e 61 ... * no interna
6590: 6c 20 72 65 70 20 28 68 61 73 20 6e 6f 20 74 79 l rep (has no ty
65a0: 70 65 29 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f pe). */. Tcl_
65b0: 4f 62 6a 49 6e 74 65 72 6e 61 6c 52 65 70 20 69 ObjInternalRep i
65c0: 6e 74 65 72 6e 61 6c 52 65 70 3b 0a 09 09 09 09 nternalRep;.....
65d0: 2f 2a 20 54 68 65 20 69 6e 74 65 72 6e 61 6c 20 /* The internal
65e0: 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 3a 20 representation:
65f0: 2a 2f 0a 7d 20 54 63 6c 5f 4f 62 6a 3b 0a 0c 0a */.} Tcl_Obj;...
6600: 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d /*. *-----------
6610: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
6620: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
6630: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
6640: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
6650: 2d 0a 20 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 69 -. * The followi
6660: 6e 67 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 73 ng definitions s
6670: 75 70 70 6f 72 74 20 54 63 6c 27 73 20 6e 61 6d upport Tcl's nam
6680: 65 73 70 61 63 65 20 66 61 63 69 6c 69 74 79 2e espace facility.
6690: 20 4e 6f 74 65 3a 20 74 68 65 20 66 69 72 73 74 Note: the first
66a0: 0a 20 2a 20 66 69 76 65 20 66 69 65 6c 64 73 20 . * five fields
66b0: 6d 75 73 74 20 6d 61 74 63 68 20 65 78 61 63 74 must match exact
66c0: 6c 79 20 74 68 65 20 66 69 65 6c 64 73 20 69 6e ly the fields in
66d0: 20 61 20 4e 61 6d 65 73 70 61 63 65 20 73 74 72 a Namespace str
66e0: 75 63 74 75 72 65 20 28 73 65 65 0a 20 2a 20 74 ucture (see. * t
66f0: 63 6c 49 6e 74 2e 68 29 2e 0a 20 2a 2f 0a 0a 74 clInt.h).. */..t
6700: 79 70 65 64 65 66 20 73 74 72 75 63 74 20 54 63 ypedef struct Tc
6710: 6c 5f 4e 61 6d 65 73 70 61 63 65 20 7b 0a 20 20 l_Namespace {.
6720: 20 20 63 68 61 72 20 2a 6e 61 6d 65 3b 09 09 09 char *name;...
6730: 2f 2a 20 54 68 65 20 6e 61 6d 65 73 70 61 63 65 /* The namespace
6740: 27 73 20 6e 61 6d 65 20 77 69 74 68 69 6e 20 69 's name within i
6750: 74 73 20 70 61 72 65 6e 74 0a 09 09 09 09 20 2a ts parent..... *
6760: 20 6e 61 6d 65 73 70 61 63 65 2e 20 54 68 69 73 namespace. This
6770: 20 63 6f 6e 74 61 69 6e 73 20 6e 6f 20 3a 3a 27 contains no ::'
6780: 73 2e 20 54 68 65 20 6e 61 6d 65 0a 09 09 09 09 s. The name.....
6790: 20 2a 20 6f 66 20 74 68 65 20 67 6c 6f 62 61 6c * of the global
67a0: 20 6e 61 6d 65 73 70 61 63 65 20 69 73 20 22 22 namespace is ""
67b0: 20 61 6c 74 68 6f 75 67 68 20 22 3a 3a 22 0a 09 although "::"..
67c0: 09 09 09 20 2a 20 69 73 20 61 6e 20 73 79 6e 6f ... * is an syno
67d0: 6e 79 6d 2e 20 2a 2f 0a 20 20 20 20 63 68 61 72 nym. */. char
67e0: 20 2a 66 75 6c 6c 4e 61 6d 65 3b 09 09 2f 2a 20 *fullName;../*
67f0: 54 68 65 20 6e 61 6d 65 73 70 61 63 65 27 73 20 The namespace's
6800: 66 75 6c 6c 79 20 71 75 61 6c 69 66 69 65 64 20 fully qualified
6810: 6e 61 6d 65 2e 20 54 68 69 73 0a 09 09 09 09 20 name. This.....
6820: 2a 20 73 74 61 72 74 73 20 77 69 74 68 20 3a 3a * starts with ::
6830: 2e 20 2a 2f 0a 20 20 20 20 76 6f 69 64 20 2a 63 . */. void *c
6840: 6c 69 65 6e 74 44 61 74 61 3b 09 09 2f 2a 20 41 lientData;../* A
6850: 72 62 69 74 72 61 72 79 20 76 61 6c 75 65 20 61 rbitrary value a
6860: 73 73 6f 63 69 61 74 65 64 20 77 69 74 68 20 74 ssociated with t
6870: 68 69 73 0a 09 09 09 09 20 2a 20 6e 61 6d 65 73 his..... * names
6880: 70 61 63 65 2e 20 2a 2f 0a 20 20 20 20 54 63 6c pace. */. Tcl
6890: 5f 4e 61 6d 65 73 70 61 63 65 44 65 6c 65 74 65 _NamespaceDelete
68a0: 50 72 6f 63 20 2a 64 65 6c 65 74 65 50 72 6f 63 Proc *deleteProc
68b0: 3b 0a 09 09 09 09 2f 2a 20 46 75 6e 63 74 69 6f ;...../* Functio
68c0: 6e 20 69 6e 76 6f 6b 65 64 20 77 68 65 6e 20 64 n invoked when d
68d0: 65 6c 65 74 69 6e 67 20 74 68 65 0a 09 09 09 09 eleting the.....
68e0: 20 2a 20 6e 61 6d 65 73 70 61 63 65 20 74 6f 2c * namespace to,
68f0: 20 65 2e 67 2e 2c 20 66 72 65 65 20 63 6c 69 65 e.g., free clie
6900: 6e 74 44 61 74 61 2e 20 2a 2f 0a 20 20 20 20 73 ntData. */. s
6910: 74 72 75 63 74 20 54 63 6c 5f 4e 61 6d 65 73 70 truct Tcl_Namesp
6920: 61 63 65 20 2a 70 61 72 65 6e 74 50 74 72 3b 0a ace *parentPtr;.
6930: 09 09 09 09 2f 2a 20 50 6f 69 6e 74 73 20 74 6f ..../* Points to
6940: 20 74 68 65 20 6e 61 6d 65 73 70 61 63 65 20 74 the namespace t
6950: 68 61 74 20 63 6f 6e 74 61 69 6e 73 20 74 68 69 hat contains thi
6960: 73 0a 09 09 09 09 20 2a 20 6f 6e 65 2e 20 4e 55 s..... * one. NU
6970: 4c 4c 20 69 66 20 74 68 69 73 20 69 73 20 74 68 LL if this is th
6980: 65 20 67 6c 6f 62 61 6c 0a 09 09 09 09 20 2a 20 e global..... *
6990: 6e 61 6d 65 73 70 61 63 65 2e 20 2a 2f 0a 7d 20 namespace. */.}
69a0: 54 63 6c 5f 4e 61 6d 65 73 70 61 63 65 3b 0a 0a Tcl_Namespace;..
69b0: 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d /*. *-----------
69c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
69d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
69e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
69f0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
6a00: 2d 0a 20 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 69 -. * The followi
6a10: 6e 67 20 73 74 72 75 63 74 75 72 65 20 72 65 70 ng structure rep
6a20: 72 65 73 65 6e 74 73 20 61 20 63 61 6c 6c 20 66 resents a call f
6a30: 72 61 6d 65 2c 20 6f 72 20 61 63 74 69 76 61 74 rame, or activat
6a40: 69 6f 6e 20 72 65 63 6f 72 64 2e 20 41 0a 20 2a ion record. A. *
6a50: 20 63 61 6c 6c 20 66 72 61 6d 65 20 64 65 66 69 call frame defi
6a60: 6e 65 73 20 61 20 6e 61 6d 69 6e 67 20 63 6f 6e nes a naming con
6a70: 74 65 78 74 20 66 6f 72 20 61 20 70 72 6f 63 65 text for a proce
6a80: 64 75 72 65 20 63 61 6c 6c 3a 20 69 74 73 20 6c dure call: its l
6a90: 6f 63 61 6c 20 73 63 6f 70 65 0a 20 2a 20 28 66 ocal scope. * (f
6aa0: 6f 72 20 6c 6f 63 61 6c 20 76 61 72 69 61 62 6c or local variabl
6ab0: 65 73 29 20 61 6e 64 20 69 74 73 20 6e 61 6d 65 es) and its name
6ac0: 73 70 61 63 65 20 73 63 6f 70 65 20 28 75 73 65 space scope (use
6ad0: 64 20 66 6f 72 20 6e 6f 6e 2d 6c 6f 63 61 6c 0a d for non-local.
6ae0: 20 2a 20 76 61 72 69 61 62 6c 65 73 3b 20 6f 66 * variables; of
6af0: 74 65 6e 20 74 68 65 20 67 6c 6f 62 61 6c 20 3a ten the global :
6b00: 3a 20 6e 61 6d 65 73 70 61 63 65 29 2e 20 41 20 : namespace). A
6b10: 63 61 6c 6c 20 66 72 61 6d 65 20 63 61 6e 20 61 call frame can a
6b20: 6c 73 6f 20 64 65 66 69 6e 65 20 74 68 65 0a 20 lso define the.
6b30: 2a 20 6e 61 6d 69 6e 67 20 63 6f 6e 74 65 78 74 * naming context
6b40: 20 66 6f 72 20 61 20 6e 61 6d 65 73 70 61 63 65 for a namespace
6b50: 20 65 76 61 6c 20 6f 72 20 6e 61 6d 65 73 70 61 eval or namespa
6b60: 63 65 20 69 6e 73 63 6f 70 65 20 63 6f 6d 6d 61 ce inscope comma
6b70: 6e 64 3a 20 74 68 65 0a 20 2a 20 6e 61 6d 65 73 nd: the. * names
6b80: 70 61 63 65 20 69 6e 20 77 68 69 63 68 20 74 68 pace in which th
6b90: 65 20 63 6f 6d 6d 61 6e 64 27 73 20 63 6f 64 65 e command's code
6ba0: 20 73 68 6f 75 6c 64 20 65 78 65 63 75 74 65 2e should execute.
6bb0: 20 54 68 65 20 54 63 6c 5f 43 61 6c 6c 46 72 61 The Tcl_CallFra
6bc0: 6d 65 0a 20 2a 20 73 74 72 75 63 74 75 72 65 73 me. * structures
6bd0: 20 65 78 69 73 74 20 6f 6e 6c 79 20 77 68 69 6c exist only whil
6be0: 65 20 70 72 6f 63 65 64 75 72 65 73 20 6f 72 20 e procedures or
6bf0: 6e 61 6d 65 73 70 61 63 65 20 65 76 61 6c 2f 69 namespace eval/i
6c00: 6e 73 63 6f 70 65 27 73 20 61 72 65 0a 20 2a 20 nscope's are. *
6c10: 62 65 69 6e 67 20 65 78 65 63 75 74 65 64 2c 20 being executed,
6c20: 61 6e 64 20 70 72 6f 76 69 64 65 20 61 20 54 63 and provide a Tc
6c30: 6c 20 63 61 6c 6c 20 73 74 61 63 6b 2e 0a 20 2a l call stack.. *
6c40: 0a 20 2a 20 41 20 63 61 6c 6c 20 66 72 61 6d 65 . * A call frame
6c50: 20 69 73 20 69 6e 69 74 69 61 6c 69 7a 65 64 20 is initialized
6c60: 61 6e 64 20 70 75 73 68 65 64 20 75 73 69 6e 67 and pushed using
6c70: 20 54 63 6c 5f 50 75 73 68 43 61 6c 6c 46 72 61 Tcl_PushCallFra
6c80: 6d 65 20 61 6e 64 20 70 6f 70 70 65 64 0a 20 2a me and popped. *
6c90: 20 75 73 69 6e 67 20 54 63 6c 5f 50 6f 70 43 61 using Tcl_PopCa
6ca0: 6c 6c 46 72 61 6d 65 2e 20 53 74 6f 72 61 67 65 llFrame. Storage
6cb0: 20 66 6f 72 20 61 20 54 63 6c 5f 43 61 6c 6c 46 for a Tcl_CallF
6cc0: 72 61 6d 65 20 6d 75 73 74 20 62 65 20 70 72 6f rame must be pro
6cd0: 76 69 64 65 64 20 62 79 20 74 68 65 0a 20 2a 20 vided by the. *
6ce0: 54 63 6c 5f 50 75 73 68 43 61 6c 6c 46 72 61 6d Tcl_PushCallFram
6cf0: 65 20 63 61 6c 6c 65 72 2c 20 61 6e 64 20 63 61 e caller, and ca
6d00: 6c 6c 65 72 73 20 74 79 70 69 63 61 6c 6c 79 20 llers typically
6d10: 61 6c 6c 6f 63 61 74 65 20 74 68 65 6d 20 6f 6e allocate them on
6d20: 20 74 68 65 20 43 20 63 61 6c 6c 0a 20 2a 20 73 the C call. * s
6d30: 74 61 63 6b 20 66 6f 72 20 65 66 66 69 63 69 65 tack for efficie
6d40: 6e 63 79 2e 20 46 6f 72 20 74 68 69 73 20 72 65 ncy. For this re
6d50: 61 73 6f 6e 2c 20 54 63 6c 5f 43 61 6c 6c 46 72 ason, Tcl_CallFr
6d60: 61 6d 65 20 69 73 20 64 65 66 69 6e 65 64 20 61 ame is defined a
6d70: 73 20 61 0a 20 2a 20 73 74 72 75 63 74 75 72 65 s a. * structure
6d80: 20 61 6e 64 20 6e 6f 74 20 61 73 20 61 6e 20 6f and not as an o
6d90: 70 61 71 75 65 20 74 6f 6b 65 6e 2e 20 48 6f 77 paque token. How
6da0: 65 76 65 72 2c 20 6d 6f 73 74 20 54 63 6c 5f 43 ever, most Tcl_C
6db0: 61 6c 6c 46 72 61 6d 65 20 66 69 65 6c 64 73 0a allFrame fields.
6dc0: 20 2a 20 61 72 65 20 68 69 64 64 65 6e 20 73 69 * are hidden si
6dd0: 6e 63 65 20 61 70 70 6c 69 63 61 74 69 6f 6e 73 nce applications
6de0: 20 73 68 6f 75 6c 64 20 6e 6f 74 20 61 63 63 65 should not acce
6df0: 73 73 20 74 68 65 6d 20 64 69 72 65 63 74 6c 79 ss them directly
6e00: 3b 20 6f 74 68 65 72 73 20 61 72 65 0a 20 2a 20 ; others are. *
6e10: 64 65 63 6c 61 72 65 64 20 61 73 20 22 64 75 6d declared as "dum
6e20: 6d 79 58 22 2e 0a 20 2a 0a 20 2a 20 57 41 52 4e myX".. *. * WARN
6e30: 49 4e 47 21 21 20 54 68 65 20 73 74 72 75 63 74 ING!! The struct
6e40: 75 72 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 6d ure definition m
6e50: 75 73 74 20 62 65 20 6b 65 70 74 20 63 6f 6e 73 ust be kept cons
6e60: 69 73 74 65 6e 74 20 77 69 74 68 20 74 68 65 0a istent with the.
6e70: 20 2a 20 43 61 6c 6c 46 72 61 6d 65 20 73 74 72 * CallFrame str
6e80: 75 63 74 75 72 65 20 69 6e 20 74 63 6c 49 6e 74 ucture in tclInt
6e90: 2e 68 2e 20 49 66 20 79 6f 75 20 63 68 61 6e 67 .h. If you chang
6ea0: 65 20 6f 6e 65 2c 20 63 68 61 6e 67 65 20 74 68 e one, change th
6eb0: 65 20 6f 74 68 65 72 2e 0a 20 2a 2f 0a 0a 74 79 e other.. */..ty
6ec0: 70 65 64 65 66 20 73 74 72 75 63 74 20 54 63 6c pedef struct Tcl
6ed0: 5f 43 61 6c 6c 46 72 61 6d 65 20 7b 0a 20 20 20 _CallFrame {.
6ee0: 20 54 63 6c 5f 4e 61 6d 65 73 70 61 63 65 20 2a Tcl_Namespace *
6ef0: 6e 73 50 74 72 3b 09 2f 2a 20 43 75 72 72 65 6e nsPtr;./* Curren
6f00: 74 20 6e 61 6d 65 73 70 61 63 65 20 66 6f 72 20 t namespace for
6f10: 74 68 65 20 63 61 6c 6c 20 66 72 61 6d 65 2e 20 the call frame.
6f20: 2a 2f 0a 20 20 20 20 69 6e 74 20 64 75 6d 6d 79 */. int dummy
6f30: 31 3b 0a 20 20 20 20 54 63 6c 5f 53 69 7a 65 20 1;. Tcl_Size
6f40: 64 75 6d 6d 79 32 3b 0a 20 20 20 20 76 6f 69 64 dummy2;. void
6f50: 20 2a 64 75 6d 6d 79 33 3b 0a 20 20 20 20 76 6f *dummy3;. vo
6f60: 69 64 20 2a 64 75 6d 6d 79 34 3b 0a 20 20 20 20 id *dummy4;.
6f70: 76 6f 69 64 20 2a 64 75 6d 6d 79 35 3b 0a 20 20 void *dummy5;.
6f80: 20 20 54 63 6c 5f 53 69 7a 65 20 64 75 6d 6d 79 Tcl_Size dummy
6f90: 36 3b 0a 20 20 20 20 76 6f 69 64 20 2a 64 75 6d 6;. void *dum
6fa0: 6d 79 37 3b 0a 20 20 20 20 76 6f 69 64 20 2a 64 my7;. void *d
6fb0: 75 6d 6d 79 38 3b 0a 20 20 20 20 54 63 6c 5f 53 ummy8;. Tcl_S
6fc0: 69 7a 65 20 64 75 6d 6d 79 39 3b 0a 20 20 20 20 ize dummy9;.
6fd0: 76 6f 69 64 20 2a 64 75 6d 6d 79 31 30 3b 0a 20 void *dummy10;.
6fe0: 20 20 20 76 6f 69 64 20 2a 64 75 6d 6d 79 31 31 void *dummy11
6ff0: 3b 0a 20 20 20 20 76 6f 69 64 20 2a 64 75 6d 6d ;. void *dumm
7000: 79 31 32 3b 0a 20 20 20 20 76 6f 69 64 20 2a 64 y12;. void *d
7010: 75 6d 6d 79 31 33 3b 0a 7d 20 54 63 6c 5f 43 61 ummy13;.} Tcl_Ca
7020: 6c 6c 46 72 61 6d 65 3b 0a 0a 2f 2a 0a 20 2a 2d llFrame;../*. *-
7030: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
7040: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
7050: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
7060: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
7070: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 49 -----------. * I
7080: 6e 66 6f 72 6d 61 74 69 6f 6e 20 61 62 6f 75 74 nformation about
7090: 20 63 6f 6d 6d 61 6e 64 73 20 74 68 61 74 20 69 commands that i
70a0: 73 20 72 65 74 75 72 6e 65 64 20 62 79 20 54 63 s returned by Tc
70b0: 6c 5f 47 65 74 43 6f 6d 6d 61 6e 64 49 6e 66 6f l_GetCommandInfo
70c0: 20 61 6e 64 0a 20 2a 20 70 61 73 73 65 64 20 74 and. * passed t
70d0: 6f 20 54 63 6c 5f 53 65 74 43 6f 6d 6d 61 6e 64 o Tcl_SetCommand
70e0: 49 6e 66 6f 2e 20 6f 62 6a 50 72 6f 63 20 69 73 Info. objProc is
70f0: 20 61 6e 20 6f 62 6a 63 2f 6f 62 6a 76 20 6f 62 an objc/objv ob
7100: 6a 65 63 74 2d 62 61 73 65 64 20 63 6f 6d 6d 61 ject-based comma
7110: 6e 64 0a 20 2a 20 66 75 6e 63 74 69 6f 6e 20 77 nd. * function w
7120: 68 69 6c 65 20 70 72 6f 63 20 69 73 20 61 20 74 hile proc is a t
7130: 72 61 64 69 74 69 6f 6e 61 6c 20 54 63 6c 20 61 raditional Tcl a
7140: 72 67 63 2f 61 72 67 76 20 73 74 72 69 6e 67 2d rgc/argv string-
7150: 62 61 73 65 64 20 66 75 6e 63 74 69 6f 6e 2e 0a based function..
7160: 20 2a 20 54 63 6c 5f 43 72 65 61 74 65 4f 62 6a * Tcl_CreateObj
7170: 43 6f 6d 6d 61 6e 64 20 61 6e 64 20 54 63 6c 5f Command and Tcl_
7180: 43 72 65 61 74 65 43 6f 6d 6d 61 6e 64 20 65 6e CreateCommand en
7190: 73 75 72 65 20 74 68 61 74 20 62 6f 74 68 20 6f sure that both o
71a0: 62 6a 50 72 6f 63 20 61 6e 64 0a 20 2a 20 70 72 bjProc and. * pr
71b0: 6f 63 20 61 72 65 20 6e 6f 6e 2d 4e 55 4c 4c 20 oc are non-NULL
71c0: 61 6e 64 20 63 61 6e 20 62 65 20 63 61 6c 6c 65 and can be calle
71d0: 64 20 74 6f 20 65 78 65 63 75 74 65 20 74 68 65 d to execute the
71e0: 20 63 6f 6d 6d 61 6e 64 2e 20 48 6f 77 65 76 65 command. Howeve
71f0: 72 2c 20 69 74 20 6d 61 79 0a 20 2a 20 62 65 20 r, it may. * be
7200: 66 61 73 74 65 72 20 74 6f 20 63 61 6c 6c 20 6f faster to call o
7210: 6e 65 20 69 6e 73 74 65 61 64 20 6f 66 20 74 68 ne instead of th
7220: 65 20 6f 74 68 65 72 2e 20 54 68 65 20 6d 65 6d e other. The mem
7230: 62 65 72 20 69 73 4e 61 74 69 76 65 4f 62 6a 65 ber isNativeObje
7240: 63 74 50 72 6f 63 0a 20 2a 20 69 73 20 73 65 74 ctProc. * is set
7250: 20 74 6f 20 31 20 69 66 20 61 6e 20 6f 62 6a 65 to 1 if an obje
7260: 63 74 2d 62 61 73 65 64 20 66 75 6e 63 74 69 6f ct-based functio
7270: 6e 20 77 61 73 20 72 65 67 69 73 74 65 72 65 64 n was registered
7280: 20 62 79 0a 20 2a 20 54 63 6c 5f 43 72 65 61 74 by. * Tcl_Creat
7290: 65 4f 62 6a 43 6f 6d 6d 61 6e 64 2c 20 61 6e 64 eObjCommand, and
72a0: 20 74 6f 20 30 20 69 66 20 61 20 73 74 72 69 6e to 0 if a strin
72b0: 67 2d 62 61 73 65 64 20 66 75 6e 63 74 69 6f 6e g-based function
72c0: 20 77 61 73 20 72 65 67 69 73 74 65 72 65 64 20 was registered
72d0: 62 79 0a 20 2a 20 54 63 6c 5f 43 72 65 61 74 65 by. * Tcl_Create
72e0: 43 6f 6d 6d 61 6e 64 2e 20 54 68 65 20 6f 74 68 Command. The oth
72f0: 65 72 20 66 75 6e 63 74 69 6f 6e 20 69 73 20 74 er function is t
7300: 79 70 69 63 61 6c 6c 79 20 73 65 74 20 74 6f 20 ypically set to
7310: 61 20 63 6f 6d 70 61 74 69 62 69 6c 69 74 79 0a a compatibility.
7320: 20 2a 20 77 72 61 70 70 65 72 20 74 68 61 74 20 * wrapper that
7330: 64 6f 65 73 20 73 74 72 69 6e 67 2d 74 6f 2d 6f does string-to-o
7340: 62 6a 65 63 74 20 6f 72 20 6f 62 6a 65 63 74 2d bject or object-
7350: 74 6f 2d 73 74 72 69 6e 67 20 61 72 67 75 6d 65 to-string argume
7360: 6e 74 20 63 6f 6e 76 65 72 73 69 6f 6e 73 0a 20 nt conversions.
7370: 2a 20 74 68 65 6e 20 63 61 6c 6c 73 20 74 68 65 * then calls the
7380: 20 6f 74 68 65 72 20 66 75 6e 63 74 69 6f 6e 2e other function.
7390: 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 73 74 . */..typedef st
73a0: 72 75 63 74 20 7b 0a 20 20 20 20 69 6e 74 20 69 ruct {. int i
73b0: 73 4e 61 74 69 76 65 4f 62 6a 65 63 74 50 72 6f sNativeObjectPro
73c0: 63 3b 09 2f 2a 20 31 20 69 66 20 6f 62 6a 50 72 c;./* 1 if objPr
73d0: 6f 63 20 77 61 73 20 72 65 67 69 73 74 65 72 65 oc was registere
73e0: 64 20 62 79 20 61 20 63 61 6c 6c 20 74 6f 0a 09 d by a call to..
73f0: 09 09 09 20 2a 20 54 63 6c 5f 43 72 65 61 74 65 ... * Tcl_Create
7400: 4f 62 6a 43 6f 6d 6d 61 6e 64 3b 20 32 20 69 66 ObjCommand; 2 if
7410: 20 6f 62 6a 50 72 6f 63 20 77 61 73 20 72 65 67 objProc was reg
7420: 69 73 74 65 72 65 64 20 62 79 0a 09 09 09 09 20 istered by.....
7430: 2a 20 61 20 63 61 6c 6c 20 74 6f 20 54 63 6c 5f * a call to Tcl_
7440: 43 72 65 61 74 65 4f 62 6a 43 6f 6d 6d 61 6e 64 CreateObjCommand
7450: 32 3b 20 30 20 6f 74 68 65 72 77 69 73 65 2e 0a 2; 0 otherwise..
7460: 09 09 09 09 20 2a 20 54 63 6c 5f 53 65 74 43 6d .... * Tcl_SetCm
7470: 64 49 6e 66 6f 20 64 6f 65 73 20 6e 6f 74 20 6d dInfo does not m
7480: 6f 64 69 66 79 20 74 68 69 73 20 66 69 65 6c 64 odify this field
7490: 2e 20 2a 2f 0a 23 69 66 64 65 66 20 54 43 4c 5f . */.#ifdef TCL_
74a0: 4e 4f 5f 44 45 50 52 45 43 41 54 45 44 0a 20 20 NO_DEPRECATED.
74b0: 20 20 76 6f 69 64 20 2a 6f 62 6a 50 72 6f 63 4e void *objProcN
74c0: 6f 74 55 73 65 64 3b 09 2f 2a 20 43 6f 6d 6d 61 otUsed;./* Comma
74d0: 6e 64 27 73 20 6f 62 6a 65 63 74 2d 62 61 73 65 nd's object-base
74e0: 64 20 66 75 6e 63 74 69 6f 6e 2e 20 2a 2f 0a 20 d function. */.
74f0: 20 20 20 76 6f 69 64 20 2a 6f 62 6a 43 6c 69 65 void *objClie
7500: 6e 74 44 61 74 61 4e 6f 74 55 73 65 64 3b 09 2f ntDataNotUsed;./
7510: 2a 20 43 6c 69 65 6e 74 44 61 74 61 20 66 6f 72 * ClientData for
7520: 20 6f 62 6a 65 63 74 20 70 72 6f 63 2e 20 2a 2f object proc. */
7530: 0a 23 65 6c 73 65 0a 20 20 20 20 54 63 6c 5f 4f .#else. Tcl_O
7540: 62 6a 43 6d 64 50 72 6f 63 20 2a 6f 62 6a 50 72 bjCmdProc *objPr
7550: 6f 63 3b 09 2f 2a 20 43 6f 6d 6d 61 6e 64 27 73 oc;./* Command's
7560: 20 6f 62 6a 65 63 74 2d 62 61 73 65 64 20 66 75 object-based fu
7570: 6e 63 74 69 6f 6e 2e 20 2a 2f 0a 20 20 20 20 76 nction. */. v
7580: 6f 69 64 20 2a 6f 62 6a 43 6c 69 65 6e 74 44 61 oid *objClientDa
7590: 74 61 3b 09 2f 2a 20 43 6c 69 65 6e 74 44 61 74 ta;./* ClientDat
75a0: 61 20 66 6f 72 20 6f 62 6a 65 63 74 20 70 72 6f a for object pro
75b0: 63 2e 20 2a 2f 0a 23 65 6e 64 69 66 0a 20 20 20 c. */.#endif.
75c0: 20 54 63 6c 5f 43 6d 64 50 72 6f 63 20 2a 70 72 Tcl_CmdProc *pr
75d0: 6f 63 3b 09 09 2f 2a 20 43 6f 6d 6d 61 6e 64 27 oc;../* Command'
75e0: 73 20 73 74 72 69 6e 67 2d 62 61 73 65 64 20 66 s string-based f
75f0: 75 6e 63 74 69 6f 6e 2e 20 2a 2f 0a 20 20 20 20 unction. */.
7600: 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 61 74 61 void *clientData
7610: 3b 09 09 2f 2a 20 43 6c 69 65 6e 74 44 61 74 61 ;../* ClientData
7620: 20 66 6f 72 20 73 74 72 69 6e 67 20 70 72 6f 63 for string proc
7630: 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 43 6d 64 . */. Tcl_Cmd
7640: 44 65 6c 65 74 65 50 72 6f 63 20 2a 64 65 6c 65 DeleteProc *dele
7650: 74 65 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 46 teProc;...../* F
7660: 75 6e 63 74 69 6f 6e 20 74 6f 20 63 61 6c 6c 20 unction to call
7670: 77 68 65 6e 20 63 6f 6d 6d 61 6e 64 20 69 73 0a when command is.
7680: 09 09 09 09 20 2a 20 64 65 6c 65 74 65 64 2e 20 .... * deleted.
7690: 2a 2f 0a 20 20 20 20 76 6f 69 64 20 2a 64 65 6c */. void *del
76a0: 65 74 65 44 61 74 61 3b 09 09 2f 2a 20 56 61 6c eteData;../* Val
76b0: 75 65 20 74 6f 20 70 61 73 73 20 74 6f 20 64 65 ue to pass to de
76c0: 6c 65 74 65 50 72 6f 63 20 28 75 73 75 61 6c 6c leteProc (usuall
76d0: 79 20 74 68 65 0a 09 09 09 09 20 2a 20 73 61 6d y the..... * sam
76e0: 65 20 61 73 20 63 6c 69 65 6e 74 44 61 74 61 29 e as clientData)
76f0: 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 4e 61 6d . */. Tcl_Nam
7700: 65 73 70 61 63 65 20 2a 6e 61 6d 65 73 70 61 63 espace *namespac
7710: 65 50 74 72 3b 2f 2a 20 50 6f 69 6e 74 73 20 74 ePtr;/* Points t
7720: 6f 20 74 68 65 20 6e 61 6d 65 73 70 61 63 65 20 o the namespace
7730: 74 68 61 74 20 63 6f 6e 74 61 69 6e 73 20 74 68 that contains th
7740: 69 73 0a 09 09 09 09 20 2a 20 63 6f 6d 6d 61 6e is..... * comman
7750: 64 2e 20 4e 6f 74 65 20 74 68 61 74 20 54 63 6c d. Note that Tcl
7760: 5f 53 65 74 43 6d 64 49 6e 66 6f 20 77 69 6c 6c _SetCmdInfo will
7770: 20 6e 6f 74 0a 09 09 09 09 20 2a 20 63 68 61 6e not..... * chan
7780: 67 65 20 61 20 63 6f 6d 6d 61 6e 64 27 73 20 6e ge a command's n
7790: 61 6d 65 73 70 61 63 65 3b 20 75 73 65 0a 09 09 amespace; use...
77a0: 09 09 20 2a 20 54 63 6c 52 65 6e 61 6d 65 43 6f .. * TclRenameCo
77b0: 6d 6d 61 6e 64 20 6f 72 20 54 63 6c 5f 45 76 61 mmand or Tcl_Eva
77c0: 6c 20 28 6f 66 20 27 72 65 6e 61 6d 65 27 29 0a l (of 'rename').
77d0: 09 09 09 09 20 2a 20 74 6f 20 64 6f 20 74 68 61 .... * to do tha
77e0: 74 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 4f 62 t. */. Tcl_Ob
77f0: 6a 43 6d 64 50 72 6f 63 32 20 2a 6f 62 6a 50 72 jCmdProc2 *objPr
7800: 6f 63 32 3b 09 2f 2a 20 43 6f 6d 6d 61 6e 64 27 oc2;./* Command'
7810: 73 20 6f 62 6a 65 63 74 32 2d 62 61 73 65 64 20 s object2-based
7820: 66 75 6e 63 74 69 6f 6e 2e 20 2a 2f 0a 20 20 20 function. */.
7830: 20 76 6f 69 64 20 2a 6f 62 6a 43 6c 69 65 6e 74 void *objClient
7840: 44 61 74 61 32 3b 09 2f 2a 20 43 6c 69 65 6e 74 Data2;./* Client
7850: 44 61 74 61 20 66 6f 72 20 6f 62 6a 65 63 74 32 Data for object2
7860: 20 70 72 6f 63 2e 20 2a 2f 0a 7d 20 54 63 6c 5f proc. */.} Tcl_
7870: 43 6d 64 49 6e 66 6f 3b 0a 0a 2f 2a 0a 20 2a 2d CmdInfo;../*. *-
7880: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
7890: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
78a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
78b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
78c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 54 -----------. * T
78d0: 68 65 20 73 74 72 75 63 74 75 72 65 20 64 65 66 he structure def
78e0: 69 6e 65 64 20 62 65 6c 6f 77 20 69 73 20 75 73 ined below is us
78f0: 65 64 20 74 6f 20 68 6f 6c 64 20 64 79 6e 61 6d ed to hold dynam
7900: 69 63 20 73 74 72 69 6e 67 73 2e 20 54 68 65 20 ic strings. The
7910: 6f 6e 6c 79 0a 20 2a 20 66 69 65 6c 64 73 20 74 only. * fields t
7920: 68 61 74 20 63 6c 69 65 6e 74 73 20 73 68 6f 75 hat clients shou
7930: 6c 64 20 75 73 65 20 61 72 65 20 73 74 72 69 6e ld use are strin
7940: 67 20 61 6e 64 20 6c 65 6e 67 74 68 2c 20 61 63 g and length, ac
7950: 63 65 73 73 69 62 6c 65 20 76 69 61 20 74 68 65 cessible via the
7960: 0a 20 2a 20 6d 61 63 72 6f 73 20 54 63 6c 5f 44 . * macros Tcl_D
7970: 53 74 72 69 6e 67 56 61 6c 75 65 20 61 6e 64 20 StringValue and
7980: 54 63 6c 5f 44 53 74 72 69 6e 67 4c 65 6e 67 74 Tcl_DStringLengt
7990: 68 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 h.. */..#define
79a0: 54 43 4c 5f 44 53 54 52 49 4e 47 5f 53 54 41 54 TCL_DSTRING_STAT
79b0: 49 43 5f 53 49 5a 45 20 32 30 30 0a 74 79 70 65 IC_SIZE 200.type
79c0: 64 65 66 20 73 74 72 75 63 74 20 54 63 6c 5f 44 def struct Tcl_D
79d0: 53 74 72 69 6e 67 20 7b 0a 20 20 20 20 63 68 61 String {. cha
79e0: 72 20 2a 73 74 72 69 6e 67 3b 09 09 2f 2a 20 50 r *string;../* P
79f0: 6f 69 6e 74 73 20 74 6f 20 62 65 67 69 6e 6e 69 oints to beginni
7a00: 6e 67 20 6f 66 20 73 74 72 69 6e 67 3a 20 65 69 ng of string: ei
7a10: 74 68 65 72 0a 09 09 09 09 20 2a 20 73 74 61 74 ther..... * stat
7a20: 69 63 53 70 61 63 65 20 62 65 6c 6f 77 20 6f 72 icSpace below or
7a30: 20 61 20 6d 61 6c 6c 6f 63 65 64 20 61 72 72 61 a malloced arra
7a40: 79 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 53 69 y. */. Tcl_Si
7a50: 7a 65 20 6c 65 6e 67 74 68 3b 09 09 2f 2a 20 4e ze length;../* N
7a60: 75 6d 62 65 72 20 6f 66 20 62 79 74 65 73 20 69 umber of bytes i
7a70: 6e 20 73 74 72 69 6e 67 20 65 78 63 6c 75 64 69 n string excludi
7a80: 6e 67 0a 09 09 09 09 20 2a 20 74 65 72 6d 69 6e ng..... * termin
7a90: 61 74 69 6e 67 20 6e 75 6c 20 2a 2f 0a 20 20 20 ating nul */.
7aa0: 20 54 63 6c 5f 53 69 7a 65 20 73 70 61 63 65 41 Tcl_Size spaceA
7ab0: 76 6c 3b 09 09 2f 2a 20 54 6f 74 61 6c 20 6e 75 vl;../* Total nu
7ac0: 6d 62 65 72 20 6f 66 20 62 79 74 65 73 20 61 76 mber of bytes av
7ad0: 61 69 6c 61 62 6c 65 20 66 6f 72 20 74 68 65 0a ailable for the.
7ae0: 09 09 09 09 20 2a 20 73 74 72 69 6e 67 20 61 6e .... * string an
7af0: 64 20 69 74 73 20 74 65 72 6d 69 6e 61 74 69 6e d its terminatin
7b00: 67 20 4e 55 4c 4c 20 63 68 61 72 2e 20 2a 2f 0a g NULL char. */.
7b10: 20 20 20 20 63 68 61 72 20 73 74 61 74 69 63 53 char staticS
7b20: 70 61 63 65 5b 54 43 4c 5f 44 53 54 52 49 4e 47 pace[TCL_DSTRING
7b30: 5f 53 54 41 54 49 43 5f 53 49 5a 45 5d 3b 0a 09 _STATIC_SIZE];..
7b40: 09 09 09 2f 2a 20 53 70 61 63 65 20 74 6f 20 75 .../* Space to u
7b50: 73 65 20 69 6e 20 63 6f 6d 6d 6f 6e 20 63 61 73 se in common cas
7b60: 65 20 77 68 65 72 65 20 73 74 72 69 6e 67 20 69 e where string i
7b70: 73 0a 09 09 09 09 20 2a 20 73 6d 61 6c 6c 2e 20 s..... * small.
7b80: 2a 2f 0a 7d 20 54 63 6c 5f 44 53 74 72 69 6e 67 */.} Tcl_DString
7b90: 3b 0a 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f 44 ;..#define Tcl_D
7ba0: 53 74 72 69 6e 67 4c 65 6e 67 74 68 28 64 73 50 StringLength(dsP
7bb0: 74 72 29 20 28 28 64 73 50 74 72 29 2d 3e 6c 65 tr) ((dsPtr)->le
7bc0: 6e 67 74 68 29 0a 23 64 65 66 69 6e 65 20 54 63 ngth).#define Tc
7bd0: 6c 5f 44 53 74 72 69 6e 67 56 61 6c 75 65 28 64 l_DStringValue(d
7be0: 73 50 74 72 29 20 28 28 64 73 50 74 72 29 2d 3e sPtr) ((dsPtr)->
7bf0: 73 74 72 69 6e 67 29 0a 0a 2f 2a 0a 20 2a 20 44 string)../*. * D
7c00: 65 66 69 6e 69 74 69 6f 6e 73 20 66 6f 72 20 74 efinitions for t
7c10: 68 65 20 6d 61 78 69 6d 75 6d 20 6e 75 6d 62 65 he maximum numbe
7c20: 72 20 6f 66 20 64 69 67 69 74 73 20 6f 66 20 70 r of digits of p
7c30: 72 65 63 69 73 69 6f 6e 20 74 68 61 74 20 6d 61 recision that ma
7c40: 79 20 62 65 0a 20 2a 20 70 72 6f 64 75 63 65 64 y be. * produced
7c50: 20 62 79 20 54 63 6c 5f 50 72 69 6e 74 44 6f 75 by Tcl_PrintDou
7c60: 62 6c 65 2c 20 61 6e 64 20 74 68 65 20 6e 75 6d ble, and the num
7c70: 62 65 72 20 6f 66 20 62 79 74 65 73 20 6f 66 20 ber of bytes of
7c80: 62 75 66 66 65 72 20 73 70 61 63 65 0a 20 2a 20 buffer space. *
7c90: 72 65 71 75 69 72 65 64 20 62 79 20 54 63 6c 5f required by Tcl_
7ca0: 50 72 69 6e 74 44 6f 75 62 6c 65 2e 0a 20 2a 2f PrintDouble.. */
7cb0: 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4d 41 ..#define TCL_MA
7cc0: 58 5f 50 52 45 43 09 09 31 37 0a 23 64 65 66 69 X_PREC..17.#defi
7cd0: 6e 65 20 54 43 4c 5f 44 4f 55 42 4c 45 5f 53 50 ne TCL_DOUBLE_SP
7ce0: 41 43 45 09 28 54 43 4c 5f 4d 41 58 5f 50 52 45 ACE.(TCL_MAX_PRE
7cf0: 43 2b 31 30 29 0a 0a 2f 2a 0a 20 2a 20 44 65 66 C+10)../*. * Def
7d00: 69 6e 69 74 69 6f 6e 20 66 6f 72 20 61 20 6e 75 inition for a nu
7d10: 6d 62 65 72 20 6f 66 20 62 79 74 65 73 20 6f 66 mber of bytes of
7d20: 20 62 75 66 66 65 72 20 73 70 61 63 65 20 73 75 buffer space su
7d30: 66 66 69 63 69 65 6e 74 20 74 6f 20 68 6f 6c 64 fficient to hold
7d40: 20 74 68 65 0a 20 2a 20 73 74 72 69 6e 67 20 72 the. * string r
7d50: 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 epresentation of
7d60: 20 61 6e 20 69 6e 74 65 67 65 72 20 69 6e 20 62 an integer in b
7d70: 61 73 65 20 31 30 20 28 61 73 73 75 6d 69 6e 67 ase 10 (assuming
7d80: 20 74 68 65 20 65 78 69 73 74 65 6e 63 65 20 6f the existence o
7d90: 66 0a 20 2a 20 36 34 2d 62 69 74 20 69 6e 74 65 f. * 64-bit inte
7da0: 67 65 72 73 29 2e 0a 20 2a 2f 0a 0a 23 64 65 66 gers).. */..#def
7db0: 69 6e 65 20 54 43 4c 5f 49 4e 54 45 47 45 52 5f ine TCL_INTEGER_
7dc0: 53 50 41 43 45 09 28 33 2a 28 69 6e 74 29 73 69 SPACE.(3*(int)si
7dd0: 7a 65 6f 66 28 54 63 6c 5f 57 69 64 65 49 6e 74 zeof(Tcl_WideInt
7de0: 29 29 0a 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d ))../*. *-------
7df0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
7e00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
7e10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
7e20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
7e30: 2d 2d 2d 2d 2d 0a 20 2a 20 54 79 70 65 20 76 61 -----. * Type va
7e40: 6c 75 65 73 20 72 65 74 75 72 6e 65 64 20 62 79 lues returned by
7e50: 20 54 63 6c 5f 47 65 74 4e 75 6d 62 65 72 46 72 Tcl_GetNumberFr
7e60: 6f 6d 4f 62 6a 0a 20 2a 09 54 43 4c 5f 4e 55 4d omObj. *.TCL_NUM
7e70: 42 45 52 5f 49 4e 54 09 09 52 65 70 72 65 73 65 BER_INT..Represe
7e80: 6e 74 61 74 69 6f 6e 20 69 73 20 61 20 54 63 6c ntation is a Tcl
7e90: 5f 57 69 64 65 49 6e 74 0a 20 2a 09 54 43 4c 5f _WideInt. *.TCL_
7ea0: 4e 55 4d 42 45 52 5f 42 49 47 09 09 52 65 70 72 NUMBER_BIG..Repr
7eb0: 65 73 65 6e 74 61 74 69 6f 6e 20 69 73 20 61 6e esentation is an
7ec0: 20 6d 70 5f 69 6e 74 0a 20 2a 09 54 43 4c 5f 4e mp_int. *.TCL_N
7ed0: 55 4d 42 45 52 5f 44 4f 55 42 4c 45 09 52 65 70 UMBER_DOUBLE.Rep
7ee0: 72 65 73 65 6e 74 61 74 69 6f 6e 20 69 73 20 61 resentation is a
7ef0: 20 64 6f 75 62 6c 65 0a 20 2a 09 54 43 4c 5f 4e double. *.TCL_N
7f00: 55 4d 42 45 52 5f 4e 41 4e 09 09 56 61 6c 75 65 UMBER_NAN..Value
7f10: 20 69 73 20 4e 61 4e 2e 0a 20 2a 2f 0a 0a 23 64 is NaN.. */..#d
7f20: 65 66 69 6e 65 20 54 43 4c 5f 4e 55 4d 42 45 52 efine TCL_NUMBER
7f30: 5f 49 4e 54 09 09 32 0a 23 64 65 66 69 6e 65 20 _INT..2.#define
7f40: 54 43 4c 5f 4e 55 4d 42 45 52 5f 42 49 47 09 09 TCL_NUMBER_BIG..
7f50: 33 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4e 55 3.#define TCL_NU
7f60: 4d 42 45 52 5f 44 4f 55 42 4c 45 09 34 0a 23 64 MBER_DOUBLE.4.#d
7f70: 65 66 69 6e 65 20 54 43 4c 5f 4e 55 4d 42 45 52 efine TCL_NUMBER
7f80: 5f 4e 41 4e 09 09 35 0a 0a 2f 2a 0a 20 2a 20 46 _NAN..5../*. * F
7f90: 6c 61 67 20 76 61 6c 75 65 73 20 70 61 73 73 65 lag values passe
7fa0: 64 20 74 6f 20 54 63 6c 5f 43 6f 6e 76 65 72 74 d to Tcl_Convert
7fb0: 45 6c 65 6d 65 6e 74 2e 0a 20 2a 20 54 43 4c 5f Element.. * TCL_
7fc0: 44 4f 4e 54 5f 55 53 45 5f 42 52 41 43 45 53 20 DONT_USE_BRACES
7fd0: 66 6f 72 63 65 73 20 69 74 20 6e 6f 74 20 74 6f forces it not to
7fe0: 20 65 6e 63 6c 6f 73 65 20 74 68 65 20 65 6c 65 enclose the ele
7ff0: 6d 65 6e 74 20 69 6e 20 62 72 61 63 65 73 2c 20 ment in braces,
8000: 62 75 74 20 74 6f 0a 20 2a 09 75 73 65 20 62 61 but to. *.use ba
8010: 63 6b 73 6c 61 73 68 20 71 75 6f 74 69 6e 67 20 ckslash quoting
8020: 69 6e 73 74 65 61 64 2e 0a 20 2a 20 54 43 4c 5f instead.. * TCL_
8030: 44 4f 4e 54 5f 51 55 4f 54 45 5f 48 41 53 48 20 DONT_QUOTE_HASH
8040: 64 69 73 61 62 6c 65 73 20 74 68 65 20 64 65 66 disables the def
8050: 61 75 6c 74 20 71 75 6f 74 69 6e 67 20 6f 66 20 ault quoting of
8060: 74 68 65 20 27 23 27 20 63 68 61 72 61 63 74 65 the '#' characte
8070: 72 2e 20 49 74 0a 20 2a 09 69 73 20 73 61 66 65 r. It. *.is safe
8080: 20 74 6f 20 6c 65 61 76 65 20 74 68 65 20 68 61 to leave the ha
8090: 73 68 20 75 6e 71 75 6f 74 65 64 20 77 68 65 6e sh unquoted when
80a0: 20 74 68 65 20 65 6c 65 6d 65 6e 74 20 69 73 20 the element is
80b0: 6e 6f 74 20 74 68 65 20 66 69 72 73 74 0a 20 2a not the first. *
80c0: 09 65 6c 65 6d 65 6e 74 20 6f 66 20 61 20 6c 69 .element of a li
80d0: 73 74 2c 20 61 6e 64 20 74 68 69 73 20 66 6c 61 st, and this fla
80e0: 67 20 63 61 6e 20 62 65 20 75 73 65 64 20 62 79 g can be used by
80f0: 20 74 68 65 20 63 61 6c 6c 65 72 20 74 6f 20 69 the caller to i
8100: 6e 64 69 63 61 74 65 0a 20 2a 09 74 68 61 74 20 ndicate. *.that
8110: 63 6f 6e 64 69 74 69 6f 6e 2e 0a 20 2a 2f 0a 0a condition.. */..
8120: 23 64 65 66 69 6e 65 20 54 43 4c 5f 44 4f 4e 54 #define TCL_DONT
8130: 5f 55 53 45 5f 42 52 41 43 45 53 09 31 0a 23 64 _USE_BRACES.1.#d
8140: 65 66 69 6e 65 20 54 43 4c 5f 44 4f 4e 54 5f 51 efine TCL_DONT_Q
8150: 55 4f 54 45 5f 48 41 53 48 09 38 0a 0a 2f 2a 0a UOTE_HASH.8../*.
8160: 20 2a 20 46 6c 61 67 73 20 74 68 61 74 20 6d 61 * Flags that ma
8170: 79 20 62 65 20 70 61 73 73 65 64 20 74 6f 20 54 y be passed to T
8180: 63 6c 5f 47 65 74 49 6e 64 65 78 46 72 6f 6d 4f cl_GetIndexFromO
8190: 62 6a 2e 0a 20 2a 20 54 43 4c 5f 45 58 41 43 54 bj.. * TCL_EXACT
81a0: 20 64 69 73 61 6c 6c 6f 77 73 20 61 62 62 72 65 disallows abbre
81b0: 76 69 61 74 65 64 20 73 74 72 69 6e 67 73 2e 0a viated strings..
81c0: 20 2a 20 54 43 4c 5f 4e 55 4c 4c 5f 4f 4b 20 61 * TCL_NULL_OK a
81d0: 6c 6c 6f 77 73 20 74 68 65 20 65 6d 70 74 79 20 llows the empty
81e0: 73 74 72 69 6e 67 20 6f 72 20 4e 55 4c 4c 20 74 string or NULL t
81f0: 6f 20 72 65 74 75 72 6e 20 54 43 4c 5f 4f 4b 2e o return TCL_OK.
8200: 0a 20 2a 20 20 20 20 20 20 54 68 65 20 72 65 74 . * The ret
8210: 75 72 6e 65 64 20 76 61 6c 75 65 20 77 69 6c 6c urned value will
8220: 20 62 65 20 2d 31 3b 0a 20 2a 20 54 43 4c 5f 49 be -1;. * TCL_I
8230: 4e 44 45 58 5f 54 45 4d 50 5f 54 41 42 4c 45 20 NDEX_TEMP_TABLE
8240: 64 69 73 61 6c 6c 6f 77 73 20 63 61 63 68 69 6e disallows cachin
8250: 67 20 6f 66 20 6c 6f 6f 6b 75 70 73 2e 20 41 20 g of lookups. A
8260: 70 6f 73 73 69 62 6c 65 20 75 73 65 20 63 61 73 possible use cas
8270: 65 20 69 73 0a 20 2a 20 20 20 20 20 20 61 20 74 e is. * a t
8280: 61 62 6c 65 20 74 68 61 74 20 77 69 6c 6c 20 6e able that will n
8290: 6f 74 20 6c 69 76 65 20 6c 6f 6e 67 20 65 6e 6f ot live long eno
82a0: 75 67 68 20 74 6f 20 6d 61 6b 65 20 69 74 20 77 ugh to make it w
82b0: 6f 72 74 68 77 68 69 6c 65 2e 0a 20 2a 2f 0a 0a orthwhile.. */..
82c0: 23 64 65 66 69 6e 65 20 54 43 4c 5f 45 58 41 43 #define TCL_EXAC
82d0: 54 09 09 31 0a 23 64 65 66 69 6e 65 20 54 43 4c T..1.#define TCL
82e0: 5f 4e 55 4c 4c 5f 4f 4b 09 09 33 32 0a 23 64 65 _NULL_OK..32.#de
82f0: 66 69 6e 65 20 54 43 4c 5f 49 4e 44 45 58 5f 54 fine TCL_INDEX_T
8300: 45 4d 50 5f 54 41 42 4c 45 09 36 34 0a 0a 2f 2a EMP_TABLE.64../*
8310: 0a 20 2a 20 46 6c 61 67 73 20 74 68 61 74 20 6d . * Flags that m
8320: 61 79 20 62 65 20 70 61 73 73 65 64 20 74 6f 20 ay be passed to
8330: 54 63 6c 5f 55 6e 69 43 68 61 72 54 6f 55 74 66 Tcl_UniCharToUtf
8340: 2e 0a 20 2a 20 54 43 4c 5f 43 4f 4d 42 49 4e 45 .. * TCL_COMBINE
8350: 20 43 6f 6d 62 69 6e 65 20 73 75 72 72 6f 67 61 Combine surroga
8360: 74 65 73 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 tes. */..#define
8370: 20 54 43 4c 5f 43 4f 4d 42 49 4e 45 09 09 30 78 TCL_COMBINE..0x
8380: 31 30 30 30 30 30 30 0a 2f 2a 0a 20 2a 2d 2d 2d 1000000./*. *---
8390: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
83a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
83b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
83c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
83d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 46 6c 61 ---------. * Fla
83e0: 67 20 76 61 6c 75 65 73 20 70 61 73 73 65 64 20 g values passed
83f0: 74 6f 20 54 63 6c 5f 52 65 63 6f 72 64 41 6e 64 to Tcl_RecordAnd
8400: 45 76 61 6c 2c 20 54 63 6c 5f 45 76 61 6c 4f 62 Eval, Tcl_EvalOb
8410: 6a 2c 20 54 63 6c 5f 45 76 61 6c 4f 62 6a 76 2e j, Tcl_EvalObjv.
8420: 0a 20 2a 20 57 41 52 4e 49 4e 47 3a 20 74 68 65 . * WARNING: the
8430: 73 65 20 62 69 74 20 63 68 6f 69 63 65 73 20 6d se bit choices m
8440: 75 73 74 20 6e 6f 74 20 63 6f 6e 66 6c 69 63 74 ust not conflict
8450: 20 77 69 74 68 20 74 68 65 20 62 69 74 20 63 68 with the bit ch
8460: 6f 69 63 65 73 20 66 6f 72 0a 20 2a 20 65 76 61 oices for. * eva
8470: 6c 46 6c 61 67 20 62 69 74 73 20 69 6e 20 74 63 lFlag bits in tc
8480: 6c 49 6e 74 2e 68 21 0a 20 2a 0a 20 2a 20 4d 65 lInt.h!. *. * Me
8490: 61 6e 69 6e 67 73 3a 0a 20 2a 09 54 43 4c 5f 4e anings:. *.TCL_N
84a0: 4f 5f 45 56 41 4c 3a 09 09 4a 75 73 74 20 72 65 O_EVAL:..Just re
84b0: 63 6f 72 64 20 74 68 69 73 20 63 6f 6d 6d 61 6e cord this comman
84c0: 64 0a 20 2a 09 54 43 4c 5f 45 56 41 4c 5f 47 4c d. *.TCL_EVAL_GL
84d0: 4f 42 41 4c 3a 09 45 78 65 63 75 74 65 20 73 63 OBAL:.Execute sc
84e0: 72 69 70 74 20 69 6e 20 67 6c 6f 62 61 6c 20 6e ript in global n
84f0: 61 6d 65 73 70 61 63 65 0a 20 2a 09 54 43 4c 5f amespace. *.TCL_
8500: 45 56 41 4c 5f 44 49 52 45 43 54 3a 09 44 6f 20 EVAL_DIRECT:.Do
8510: 6e 6f 74 20 63 6f 6d 70 69 6c 65 20 74 68 69 73 not compile this
8520: 20 73 63 72 69 70 74 0a 20 2a 09 54 43 4c 5f 45 script. *.TCL_E
8530: 56 41 4c 5f 49 4e 56 4f 4b 45 3a 09 4d 61 67 69 VAL_INVOKE:.Magi
8540: 63 61 6c 20 54 63 6c 5f 45 76 61 6c 4f 62 6a 76 cal Tcl_EvalObjv
8550: 20 6d 6f 64 65 20 66 6f 72 20 61 6c 69 61 73 65 mode for aliase
8560: 73 2f 65 6e 73 65 6d 62 6c 65 73 0a 20 2a 09 09 s/ensembles. *..
8570: 09 09 6f 20 52 75 6e 20 69 6e 20 69 50 74 72 2d ..o Run in iPtr-
8580: 3e 6c 6f 6f 6b 75 70 4e 73 50 74 72 20 6f 72 20 >lookupNsPtr or
8590: 67 6c 6f 62 61 6c 20 6e 61 6d 65 73 70 61 63 65 global namespace
85a0: 0a 20 2a 09 09 09 09 6f 20 43 75 74 20 6f 75 74 . *....o Cut out
85b0: 20 6f 66 20 65 72 72 6f 72 20 74 72 61 63 65 73 of error traces
85c0: 0a 20 2a 09 09 09 09 6f 20 44 6f 6e 27 74 20 72 . *....o Don't r
85d0: 65 73 65 74 20 74 68 65 20 66 6c 61 67 73 20 63 eset the flags c
85e0: 6f 6e 74 72 6f 6c 6c 69 6e 67 20 65 6e 73 65 6d ontrolling ensem
85f0: 62 6c 65 0a 20 2a 09 09 09 09 20 20 65 72 72 6f ble. *.... erro
8600: 72 20 6d 65 73 73 61 67 65 20 72 65 77 72 69 74 r message rewrit
8610: 69 6e 67 2e 0a 20 2a 09 54 43 4c 5f 43 41 4e 43 ing.. *.TCL_CANC
8620: 45 4c 5f 55 4e 57 49 4e 44 3a 09 4d 61 67 69 63 EL_UNWIND:.Magic
8630: 61 6c 20 54 63 6c 5f 43 61 6e 63 65 6c 45 76 61 al Tcl_CancelEva
8640: 6c 20 6d 6f 64 65 20 74 68 61 74 20 63 61 75 73 l mode that caus
8650: 65 73 20 74 68 65 0a 20 2a 09 09 09 09 73 74 61 es the. *....sta
8660: 63 6b 20 66 6f 72 20 74 68 65 20 73 63 72 69 70 ck for the scrip
8670: 74 20 69 6e 20 70 72 6f 67 72 65 73 73 20 74 6f t in progress to
8680: 20 62 65 0a 20 2a 09 09 09 09 63 6f 6d 70 6c 65 be. *....comple
8690: 74 65 6c 79 20 75 6e 77 6f 75 6e 64 2e 0a 20 2a tely unwound.. *
86a0: 09 54 43 4c 5f 45 56 41 4c 5f 4e 4f 45 52 52 3a .TCL_EVAL_NOERR:
86b0: 09 09 44 6f 20 6e 6f 20 65 78 63 65 70 74 69 6f ..Do no exceptio
86c0: 6e 20 72 65 70 6f 72 74 69 6e 67 20 61 74 20 61 n reporting at a
86d0: 6c 6c 2c 20 6a 75 73 74 20 72 65 74 75 72 6e 0a ll, just return.
86e0: 20 2a 09 09 09 09 61 73 20 74 68 65 20 63 61 6c *....as the cal
86f0: 6c 65 72 20 77 69 6c 6c 20 72 65 70 6f 72 74 2e ler will report.
8700: 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 . */..#define TC
8710: 4c 5f 4e 4f 5f 45 56 41 4c 09 09 30 78 30 31 30 L_NO_EVAL..0x010
8720: 30 30 30 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 000.#define TCL_
8730: 45 56 41 4c 5f 47 4c 4f 42 41 4c 09 09 30 78 30 EVAL_GLOBAL..0x0
8740: 32 30 30 30 30 0a 23 64 65 66 69 6e 65 20 54 43 20000.#define TC
8750: 4c 5f 45 56 41 4c 5f 44 49 52 45 43 54 09 09 30 L_EVAL_DIRECT..0
8760: 78 30 34 30 30 30 30 0a 23 64 65 66 69 6e 65 20 x040000.#define
8770: 54 43 4c 5f 45 56 41 4c 5f 49 4e 56 4f 4b 45 09 TCL_EVAL_INVOKE.
8780: 09 30 78 30 38 30 30 30 30 0a 23 64 65 66 69 6e .0x080000.#defin
8790: 65 20 54 43 4c 5f 43 41 4e 43 45 4c 5f 55 4e 57 e TCL_CANCEL_UNW
87a0: 49 4e 44 09 30 78 31 30 30 30 30 30 0a 23 64 65 IND.0x100000.#de
87b0: 66 69 6e 65 20 54 43 4c 5f 45 56 41 4c 5f 4e 4f fine TCL_EVAL_NO
87c0: 45 52 52 09 09 30 78 32 30 30 30 30 30 0a 0a 2f ERR..0x200000../
87d0: 2a 0a 20 2a 20 53 70 65 63 69 61 6c 20 66 72 65 *. * Special fre
87e0: 65 50 72 6f 63 20 76 61 6c 75 65 73 20 74 68 61 eProc values tha
87f0: 74 20 6d 61 79 20 62 65 20 70 61 73 73 65 64 20 t may be passed
8800: 74 6f 20 54 63 6c 5f 53 65 74 52 65 73 75 6c 74 to Tcl_SetResult
8810: 20 28 73 65 65 20 74 68 65 20 6d 61 6e 0a 20 2a (see the man. *
8820: 20 70 61 67 65 20 66 6f 72 20 64 65 74 61 69 6c page for detail
8830: 73 29 3a 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 s):. */..#define
8840: 20 54 43 4c 5f 56 4f 4c 41 54 49 4c 45 09 09 28 TCL_VOLATILE..(
8850: 28 54 63 6c 5f 46 72 65 65 50 72 6f 63 20 2a 29 (Tcl_FreeProc *)
8860: 20 31 29 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 1).#define TCL_
8870: 53 54 41 54 49 43 09 09 28 28 54 63 6c 5f 46 72 STATIC..((Tcl_Fr
8880: 65 65 50 72 6f 63 20 2a 29 20 30 29 0a 23 64 65 eeProc *) 0).#de
8890: 66 69 6e 65 20 54 43 4c 5f 44 59 4e 41 4d 49 43 fine TCL_DYNAMIC
88a0: 09 09 28 28 54 63 6c 5f 46 72 65 65 50 72 6f 63 ..((Tcl_FreeProc
88b0: 20 2a 29 20 33 29 0a 0a 2f 2a 0a 20 2a 20 46 6c *) 3)../*. * Fl
88c0: 61 67 20 76 61 6c 75 65 73 20 70 61 73 73 65 64 ag values passed
88d0: 20 74 6f 20 76 61 72 69 61 62 6c 65 2d 72 65 6c to variable-rel
88e0: 61 74 65 64 20 66 75 6e 63 74 69 6f 6e 73 2e 0a ated functions..
88f0: 20 2a 20 57 41 52 4e 49 4e 47 3a 20 74 68 65 73 * WARNING: thes
8900: 65 20 62 69 74 20 63 68 6f 69 63 65 73 20 6d 75 e bit choices mu
8910: 73 74 20 6e 6f 74 20 63 6f 6e 66 6c 69 63 74 20 st not conflict
8920: 77 69 74 68 20 74 68 65 20 62 69 74 20 63 68 6f with the bit cho
8930: 69 63 65 20 66 6f 72 0a 20 2a 20 54 43 4c 5f 43 ice for. * TCL_C
8940: 41 4e 43 45 4c 5f 55 4e 57 49 4e 44 2c 20 61 62 ANCEL_UNWIND, ab
8950: 6f 76 65 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e ove.. */..#defin
8960: 65 20 54 43 4c 5f 47 4c 4f 42 41 4c 5f 4f 4e 4c e TCL_GLOBAL_ONL
8970: 59 09 09 20 31 0a 23 64 65 66 69 6e 65 20 54 43 Y.. 1.#define TC
8980: 4c 5f 4e 41 4d 45 53 50 41 43 45 5f 4f 4e 4c 59 L_NAMESPACE_ONLY
8990: 09 20 32 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f . 2.#define TCL_
89a0: 41 50 50 45 4e 44 5f 56 41 4c 55 45 09 20 34 0a APPEND_VALUE. 4.
89b0: 23 64 65 66 69 6e 65 20 54 43 4c 5f 4c 49 53 54 #define TCL_LIST
89c0: 5f 45 4c 45 4d 45 4e 54 09 20 38 0a 23 64 65 66 _ELEMENT. 8.#def
89d0: 69 6e 65 20 54 43 4c 5f 54 52 41 43 45 5f 52 45 ine TCL_TRACE_RE
89e0: 41 44 53 09 09 20 30 78 31 30 0a 23 64 65 66 69 ADS.. 0x10.#defi
89f0: 6e 65 20 54 43 4c 5f 54 52 41 43 45 5f 57 52 49 ne TCL_TRACE_WRI
8a00: 54 45 53 09 20 30 78 32 30 0a 23 64 65 66 69 6e TES. 0x20.#defin
8a10: 65 20 54 43 4c 5f 54 52 41 43 45 5f 55 4e 53 45 e TCL_TRACE_UNSE
8a20: 54 53 09 20 30 78 34 30 0a 23 64 65 66 69 6e 65 TS. 0x40.#define
8a30: 20 54 43 4c 5f 54 52 41 43 45 5f 44 45 53 54 52 TCL_TRACE_DESTR
8a40: 4f 59 45 44 09 20 30 78 38 30 0a 0a 23 64 65 66 OYED. 0x80..#def
8a50: 69 6e 65 20 54 43 4c 5f 4c 45 41 56 45 5f 45 52 ine TCL_LEAVE_ER
8a60: 52 5f 4d 53 47 09 20 30 78 32 30 30 0a 23 64 65 R_MSG. 0x200.#de
8a70: 66 69 6e 65 20 54 43 4c 5f 54 52 41 43 45 5f 41 fine TCL_TRACE_A
8a80: 52 52 41 59 09 09 20 30 78 38 30 30 0a 2f 2a 20 RRAY.. 0x800./*
8a90: 49 6e 64 69 63 61 74 65 20 74 68 65 20 73 65 6d Indicate the sem
8aa0: 61 6e 74 69 63 73 20 6f 66 20 74 68 65 20 72 65 antics of the re
8ab0: 73 75 6c 74 20 6f 66 20 61 20 74 72 61 63 65 2e sult of a trace.
8ac0: 20 2a 2f 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f */.#define TCL_
8ad0: 54 52 41 43 45 5f 52 45 53 55 4c 54 5f 44 59 4e TRACE_RESULT_DYN
8ae0: 41 4d 49 43 20 30 78 38 30 30 30 0a 23 64 65 66 AMIC 0x8000.#def
8af0: 69 6e 65 20 54 43 4c 5f 54 52 41 43 45 5f 52 45 ine TCL_TRACE_RE
8b00: 53 55 4c 54 5f 4f 42 4a 45 43 54 20 20 30 78 31 SULT_OBJECT 0x1
8b10: 30 30 30 30 0a 0a 2f 2a 0a 20 2a 20 46 6c 61 67 0000../*. * Flag
8b20: 20 76 61 6c 75 65 73 20 66 6f 72 20 65 6e 73 65 values for ense
8b30: 6d 62 6c 65 20 63 6f 6d 6d 61 6e 64 73 2e 0a 20 mble commands..
8b40: 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f */..#define TCL_
8b50: 45 4e 53 45 4d 42 4c 45 5f 50 52 45 46 49 58 20 ENSEMBLE_PREFIX
8b60: 30 78 30 32 2f 2a 20 46 6c 61 67 20 76 61 6c 75 0x02/* Flag valu
8b70: 65 20 74 6f 20 73 61 79 20 77 68 65 74 68 65 72 e to say whether
8b80: 20 74 6f 20 61 6c 6c 6f 77 0a 09 09 09 09 20 2a to allow..... *
8b90: 20 75 6e 61 6d 62 69 67 75 6f 75 73 20 70 72 65 unambiguous pre
8ba0: 66 69 78 65 73 20 6f 66 20 63 6f 6d 6d 61 6e 64 fixes of command
8bb0: 73 20 6f 72 20 74 6f 0a 09 09 09 09 20 2a 20 72 s or to..... * r
8bc0: 65 71 75 69 72 65 20 65 78 61 63 74 20 6d 61 74 equire exact mat
8bd0: 63 68 65 73 20 66 6f 72 20 63 6f 6d 6d 61 6e 64 ches for command
8be0: 20 6e 61 6d 65 73 2e 20 2a 2f 0a 0a 2f 2a 0a 20 names. */../*.
8bf0: 2a 20 46 6c 61 67 20 76 61 6c 75 65 73 20 70 61 * Flag values pa
8c00: 73 73 65 64 20 74 6f 20 63 6f 6d 6d 61 6e 64 2d ssed to command-
8c10: 72 65 6c 61 74 65 64 20 66 75 6e 63 74 69 6f 6e related function
8c20: 73 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 s.. */..#define
8c30: 54 43 4c 5f 54 52 41 43 45 5f 52 45 4e 41 4d 45 TCL_TRACE_RENAME
8c40: 09 30 78 32 30 30 30 0a 23 64 65 66 69 6e 65 20 .0x2000.#define
8c50: 54 43 4c 5f 54 52 41 43 45 5f 44 45 4c 45 54 45 TCL_TRACE_DELETE
8c60: 09 30 78 34 30 30 30 0a 0a 23 64 65 66 69 6e 65 .0x4000..#define
8c70: 20 54 43 4c 5f 41 4c 4c 4f 57 5f 49 4e 4c 49 4e TCL_ALLOW_INLIN
8c80: 45 5f 43 4f 4d 50 49 4c 41 54 49 4f 4e 20 30 78 E_COMPILATION 0x
8c90: 32 30 30 30 30 0a 0a 2f 2a 0a 20 2a 20 54 79 70 20000../*. * Typ
8ca0: 65 73 20 66 6f 72 20 6c 69 6e 6b 65 64 20 76 61 es for linked va
8cb0: 72 69 61 62 6c 65 73 3a 0a 20 2a 2f 0a 0a 23 64 riables:. */..#d
8cc0: 65 66 69 6e 65 20 54 43 4c 5f 4c 49 4e 4b 5f 49 efine TCL_LINK_I
8cd0: 4e 54 09 09 31 0a 23 64 65 66 69 6e 65 20 54 43 NT..1.#define TC
8ce0: 4c 5f 4c 49 4e 4b 5f 44 4f 55 42 4c 45 09 09 32 L_LINK_DOUBLE..2
8cf0: 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4c 49 4e .#define TCL_LIN
8d00: 4b 5f 42 4f 4f 4c 45 41 4e 09 33 0a 23 64 65 66 K_BOOLEAN.3.#def
8d10: 69 6e 65 20 54 43 4c 5f 4c 49 4e 4b 5f 53 54 52 ine TCL_LINK_STR
8d20: 49 4e 47 09 09 34 0a 23 64 65 66 69 6e 65 20 54 ING..4.#define T
8d30: 43 4c 5f 4c 49 4e 4b 5f 57 49 44 45 5f 49 4e 54 CL_LINK_WIDE_INT
8d40: 09 35 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4c .5.#define TCL_L
8d50: 49 4e 4b 5f 43 48 41 52 09 09 36 0a 23 64 65 66 INK_CHAR..6.#def
8d60: 69 6e 65 20 54 43 4c 5f 4c 49 4e 4b 5f 55 43 48 ine TCL_LINK_UCH
8d70: 41 52 09 09 37 0a 23 64 65 66 69 6e 65 20 54 43 AR..7.#define TC
8d80: 4c 5f 4c 49 4e 4b 5f 53 48 4f 52 54 09 09 38 0a L_LINK_SHORT..8.
8d90: 23 64 65 66 69 6e 65 20 54 43 4c 5f 4c 49 4e 4b #define TCL_LINK
8da0: 5f 55 53 48 4f 52 54 09 09 39 0a 23 64 65 66 69 _USHORT..9.#defi
8db0: 6e 65 20 54 43 4c 5f 4c 49 4e 4b 5f 55 49 4e 54 ne TCL_LINK_UINT
8dc0: 09 09 31 30 0a 23 64 65 66 69 6e 65 20 54 43 4c ..10.#define TCL
8dd0: 5f 4c 49 4e 4b 5f 4c 4f 4e 47 09 09 28 28 73 69 _LINK_LONG..((si
8de0: 7a 65 6f 66 28 6c 6f 6e 67 29 20 21 3d 20 73 69 zeof(long) != si
8df0: 7a 65 6f 66 28 69 6e 74 29 29 20 3f 20 54 43 4c zeof(int)) ? TCL
8e00: 5f 4c 49 4e 4b 5f 57 49 44 45 5f 49 4e 54 20 3a _LINK_WIDE_INT :
8e10: 20 54 43 4c 5f 4c 49 4e 4b 5f 49 4e 54 29 0a 23 TCL_LINK_INT).#
8e20: 64 65 66 69 6e 65 20 54 43 4c 5f 4c 49 4e 4b 5f define TCL_LINK_
8e30: 55 4c 4f 4e 47 09 09 28 28 73 69 7a 65 6f 66 28 ULONG..((sizeof(
8e40: 6c 6f 6e 67 29 20 21 3d 20 73 69 7a 65 6f 66 28 long) != sizeof(
8e50: 69 6e 74 29 29 20 3f 20 54 43 4c 5f 4c 49 4e 4b int)) ? TCL_LINK
8e60: 5f 57 49 44 45 5f 55 49 4e 54 20 3a 20 54 43 4c _WIDE_UINT : TCL
8e70: 5f 4c 49 4e 4b 5f 55 49 4e 54 29 0a 23 64 65 66 _LINK_UINT).#def
8e80: 69 6e 65 20 54 43 4c 5f 4c 49 4e 4b 5f 46 4c 4f ine TCL_LINK_FLO
8e90: 41 54 09 09 31 33 0a 23 64 65 66 69 6e 65 20 54 AT..13.#define T
8ea0: 43 4c 5f 4c 49 4e 4b 5f 57 49 44 45 5f 55 49 4e CL_LINK_WIDE_UIN
8eb0: 54 09 31 34 0a 23 64 65 66 69 6e 65 20 54 43 4c T.14.#define TCL
8ec0: 5f 4c 49 4e 4b 5f 43 48 41 52 53 09 09 31 35 0a _LINK_CHARS..15.
8ed0: 23 64 65 66 69 6e 65 20 54 43 4c 5f 4c 49 4e 4b #define TCL_LINK
8ee0: 5f 42 49 4e 41 52 59 09 09 31 36 0a 23 64 65 66 _BINARY..16.#def
8ef0: 69 6e 65 20 54 43 4c 5f 4c 49 4e 4b 5f 52 45 41 ine TCL_LINK_REA
8f00: 44 5f 4f 4e 4c 59 09 30 78 38 30 0a 0a 2f 2a 0a D_ONLY.0x80../*.
8f10: 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d *--------------
8f20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
8f30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
8f40: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
8f50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 --------------.
8f60: 2a 20 46 6f 72 77 61 72 64 20 64 65 63 6c 61 72 * Forward declar
8f70: 61 74 69 6f 6e 73 20 6f 66 20 54 63 6c 5f 48 61 ations of Tcl_Ha
8f80: 73 68 54 61 62 6c 65 20 61 6e 64 20 72 65 6c 61 shTable and rela
8f90: 74 65 64 20 74 79 70 65 73 2e 0a 20 2a 2f 0a 0a ted types.. */..
8fa0: 23 69 66 20 21 64 65 66 69 6e 65 64 28 54 43 4c #if !defined(TCL
8fb0: 5f 48 41 53 48 5f 54 59 50 45 29 20 26 26 20 21 _HASH_TYPE) && !
8fc0: 64 65 66 69 6e 65 64 20 28 54 43 4c 5f 4e 4f 5f defined (TCL_NO_
8fd0: 44 45 50 52 45 43 41 54 45 44 29 0a 23 20 20 20 DEPRECATED).#
8fe0: 64 65 66 69 6e 65 20 54 43 4c 5f 48 41 53 48 5f define TCL_HASH_
8ff0: 54 59 50 45 20 73 69 7a 65 5f 74 0a 23 65 6e 64 TYPE size_t.#end
9000: 69 66 0a 0a 74 79 70 65 64 65 66 20 73 74 72 75 if..typedef stru
9010: 63 74 20 54 63 6c 5f 48 61 73 68 4b 65 79 54 79 ct Tcl_HashKeyTy
9020: 70 65 20 54 63 6c 5f 48 61 73 68 4b 65 79 54 79 pe Tcl_HashKeyTy
9030: 70 65 3b 0a 74 79 70 65 64 65 66 20 73 74 72 75 pe;.typedef stru
9040: 63 74 20 54 63 6c 5f 48 61 73 68 54 61 62 6c 65 ct Tcl_HashTable
9050: 20 54 63 6c 5f 48 61 73 68 54 61 62 6c 65 3b 0a Tcl_HashTable;.
9060: 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20 54 typedef struct T
9070: 63 6c 5f 48 61 73 68 45 6e 74 72 79 20 54 63 6c cl_HashEntry Tcl
9080: 5f 48 61 73 68 45 6e 74 72 79 3b 0a 0a 74 79 70 _HashEntry;..typ
9090: 65 64 65 66 20 73 69 7a 65 5f 74 20 28 54 63 6c edef size_t (Tcl
90a0: 5f 48 61 73 68 4b 65 79 50 72 6f 63 29 20 28 54 _HashKeyProc) (T
90b0: 63 6c 5f 48 61 73 68 54 61 62 6c 65 20 2a 74 61 cl_HashTable *ta
90c0: 62 6c 65 50 74 72 2c 20 76 6f 69 64 20 2a 6b 65 blePtr, void *ke
90d0: 79 50 74 72 29 3b 0a 74 79 70 65 64 65 66 20 69 yPtr);.typedef i
90e0: 6e 74 20 28 54 63 6c 5f 43 6f 6d 70 61 72 65 48 nt (Tcl_CompareH
90f0: 61 73 68 4b 65 79 73 50 72 6f 63 29 20 28 76 6f ashKeysProc) (vo
9100: 69 64 20 2a 6b 65 79 50 74 72 2c 20 54 63 6c 5f id *keyPtr, Tcl_
9110: 48 61 73 68 45 6e 74 72 79 20 2a 68 50 74 72 29 HashEntry *hPtr)
9120: 3b 0a 74 79 70 65 64 65 66 20 54 63 6c 5f 48 61 ;.typedef Tcl_Ha
9130: 73 68 45 6e 74 72 79 20 2a 20 28 54 63 6c 5f 41 shEntry * (Tcl_A
9140: 6c 6c 6f 63 48 61 73 68 45 6e 74 72 79 50 72 6f llocHashEntryPro
9150: 63 29 20 28 54 63 6c 5f 48 61 73 68 54 61 62 6c c) (Tcl_HashTabl
9160: 65 20 2a 74 61 62 6c 65 50 74 72 2c 0a 09 76 6f e *tablePtr,..vo
9170: 69 64 20 2a 6b 65 79 50 74 72 29 3b 0a 74 79 70 id *keyPtr);.typ
9180: 65 64 65 66 20 76 6f 69 64 20 28 54 63 6c 5f 46 edef void (Tcl_F
9190: 72 65 65 48 61 73 68 45 6e 74 72 79 50 72 6f 63 reeHashEntryProc
91a0: 29 20 28 54 63 6c 5f 48 61 73 68 45 6e 74 72 79 ) (Tcl_HashEntry
91b0: 20 2a 68 50 74 72 29 3b 0a 0a 2f 2a 0a 20 2a 20 *hPtr);../*. *
91c0: 53 74 72 75 63 74 75 72 65 20 64 65 66 69 6e 69 Structure defini
91d0: 74 69 6f 6e 20 66 6f 72 20 61 6e 20 65 6e 74 72 tion for an entr
91e0: 79 20 69 6e 20 61 20 68 61 73 68 20 74 61 62 6c y in a hash tabl
91f0: 65 2e 20 4e 6f 2d 6f 6e 65 20 6f 75 74 73 69 64 e. No-one outsid
9200: 65 20 54 63 6c 0a 20 2a 20 73 68 6f 75 6c 64 20 e Tcl. * should
9210: 61 63 63 65 73 73 20 61 6e 79 20 6f 66 20 74 68 access any of th
9220: 65 73 65 20 66 69 65 6c 64 73 20 64 69 72 65 63 ese fields direc
9230: 74 6c 79 3b 20 75 73 65 20 74 68 65 20 6d 61 63 tly; use the mac
9240: 72 6f 73 20 64 65 66 69 6e 65 64 20 62 65 6c 6f ros defined belo
9250: 77 2e 0a 20 2a 2f 0a 0a 73 74 72 75 63 74 20 54 w.. */..struct T
9260: 63 6c 5f 48 61 73 68 45 6e 74 72 79 20 7b 0a 20 cl_HashEntry {.
9270: 20 20 20 54 63 6c 5f 48 61 73 68 45 6e 74 72 79 Tcl_HashEntry
9280: 20 2a 6e 65 78 74 50 74 72 3b 09 2f 2a 20 50 6f *nextPtr;./* Po
9290: 69 6e 74 65 72 20 74 6f 20 6e 65 78 74 20 65 6e inter to next en
92a0: 74 72 79 20 69 6e 20 74 68 69 73 20 68 61 73 68 try in this hash
92b0: 20 62 75 63 6b 65 74 2c 0a 09 09 09 09 20 2a 20 bucket,..... *
92c0: 6f 72 20 4e 55 4c 4c 20 66 6f 72 20 65 6e 64 20 or NULL for end
92d0: 6f 66 20 63 68 61 69 6e 2e 20 2a 2f 0a 20 20 20 of chain. */.
92e0: 20 54 63 6c 5f 48 61 73 68 54 61 62 6c 65 20 2a Tcl_HashTable *
92f0: 74 61 62 6c 65 50 74 72 3b 09 2f 2a 20 50 6f 69 tablePtr;./* Poi
9300: 6e 74 65 72 20 74 6f 20 74 61 62 6c 65 20 63 6f nter to table co
9310: 6e 74 61 69 6e 69 6e 67 20 65 6e 74 72 79 2e 20 ntaining entry.
9320: 2a 2f 0a 20 20 20 20 73 69 7a 65 5f 74 20 68 61 */. size_t ha
9330: 73 68 3b 09 09 2f 2a 20 48 61 73 68 20 76 61 6c sh;../* Hash val
9340: 75 65 2e 20 2a 2f 0a 20 20 20 20 76 6f 69 64 20 ue. */. void
9350: 2a 63 6c 69 65 6e 74 44 61 74 61 3b 09 09 2f 2a *clientData;../*
9360: 20 41 70 70 6c 69 63 61 74 69 6f 6e 20 73 74 6f Application sto
9370: 72 65 73 20 73 6f 6d 65 74 68 69 6e 67 20 68 65 res something he
9380: 72 65 20 77 69 74 68 0a 09 09 09 09 20 2a 20 54 re with..... * T
9390: 63 6c 5f 53 65 74 48 61 73 68 56 61 6c 75 65 2e cl_SetHashValue.
93a0: 20 2a 2f 0a 20 20 20 20 75 6e 69 6f 6e 20 7b 09 */. union {.
93b0: 09 09 2f 2a 20 4b 65 79 20 68 61 73 20 6f 6e 65 ../* Key has one
93c0: 20 6f 66 20 74 68 65 73 65 20 66 6f 72 6d 73 3a of these forms:
93d0: 20 2a 2f 0a 09 63 68 61 72 20 2a 6f 6e 65 57 6f */..char *oneWo
93e0: 72 64 56 61 6c 75 65 3b 09 2f 2a 20 4f 6e 65 2d rdValue;./* One-
93f0: 77 6f 72 64 20 76 61 6c 75 65 20 66 6f 72 20 6b word value for k
9400: 65 79 2e 20 2a 2f 0a 09 54 63 6c 5f 4f 62 6a 20 ey. */..Tcl_Obj
9410: 2a 6f 62 6a 50 74 72 3b 09 2f 2a 20 54 63 6c 5f *objPtr;./* Tcl_
9420: 4f 62 6a 20 2a 20 6b 65 79 20 76 61 6c 75 65 2e Obj * key value.
9430: 20 2a 2f 0a 09 69 6e 74 20 77 6f 72 64 73 5b 31 */..int words[1
9440: 5d 3b 09 09 2f 2a 20 4d 75 6c 74 69 70 6c 65 20 ];../* Multiple
9450: 69 6e 74 65 67 65 72 20 77 6f 72 64 73 20 66 6f integer words fo
9460: 72 20 6b 65 79 2e 20 54 68 65 20 61 63 74 75 61 r key. The actua
9470: 6c 0a 09 09 09 09 20 2a 20 73 69 7a 65 20 77 69 l..... * size wi
9480: 6c 6c 20 62 65 20 61 73 20 6c 61 72 67 65 20 61 ll be as large a
9490: 73 20 6e 65 63 65 73 73 61 72 79 20 66 6f 72 20 s necessary for
94a0: 74 68 69 73 0a 09 09 09 09 20 2a 20 74 61 62 6c this..... * tabl
94b0: 65 27 73 20 6b 65 79 73 2e 20 2a 2f 0a 09 63 68 e's keys. */..ch
94c0: 61 72 20 73 74 72 69 6e 67 5b 31 5d 3b 09 09 2f ar string[1];../
94d0: 2a 20 53 74 72 69 6e 67 20 66 6f 72 20 6b 65 79 * String for key
94e0: 2e 20 54 68 65 20 61 63 74 75 61 6c 20 73 69 7a . The actual siz
94f0: 65 20 77 69 6c 6c 20 62 65 20 61 73 0a 09 09 09 e will be as....
9500: 09 20 2a 20 6c 61 72 67 65 20 61 73 20 6e 65 65 . * large as nee
9510: 64 65 64 20 74 6f 20 68 6f 6c 64 20 74 68 65 20 ded to hold the
9520: 6b 65 79 2e 20 2a 2f 0a 20 20 20 20 7d 20 6b 65 key. */. } ke
9530: 79 3b 09 09 09 2f 2a 20 4d 55 53 54 20 42 45 20 y;.../* MUST BE
9540: 4c 41 53 54 20 46 49 45 4c 44 20 49 4e 20 52 45 LAST FIELD IN RE
9550: 43 4f 52 44 21 21 20 2a 2f 0a 7d 3b 0a 0a 2f 2a CORD!! */.};../*
9560: 0a 20 2a 20 46 6c 61 67 73 20 75 73 65 64 20 69 . * Flags used i
9570: 6e 20 54 63 6c 5f 48 61 73 68 4b 65 79 54 79 70 n Tcl_HashKeyTyp
9580: 65 2e 0a 20 2a 0a 20 2a 20 54 43 4c 5f 48 41 53 e.. *. * TCL_HAS
9590: 48 5f 4b 45 59 5f 52 41 4e 44 4f 4d 49 5a 45 5f H_KEY_RANDOMIZE_
95a0: 48 41 53 48 20 2d 0a 20 2a 09 09 09 09 54 68 65 HASH -. *....The
95b0: 72 65 20 61 72 65 20 73 6f 6d 65 20 74 68 69 6e re are some thin
95c0: 67 73 2c 20 70 6f 69 6e 74 65 72 73 20 66 6f 72 gs, pointers for
95d0: 20 65 78 61 6d 70 6c 65 0a 20 2a 09 09 09 09 77 example. *....w
95e0: 68 69 63 68 20 64 6f 6e 27 74 20 68 61 73 68 20 hich don't hash
95f0: 77 65 6c 6c 20 62 65 63 61 75 73 65 20 74 68 65 well because the
9600: 79 20 64 6f 20 6e 6f 74 20 75 73 65 0a 20 2a 09 y do not use. *.
9610: 09 09 09 74 68 65 20 6c 6f 77 65 72 20 62 69 74 ...the lower bit
9620: 73 2e 20 49 66 20 74 68 69 73 20 66 6c 61 67 20 s. If this flag
9630: 69 73 20 73 65 74 20 74 68 65 6e 20 74 68 65 0a is set then the.
9640: 20 2a 09 09 09 09 68 61 73 68 20 74 61 62 6c 65 *....hash table
9650: 20 77 69 6c 6c 20 61 74 74 65 6d 70 74 20 74 6f will attempt to
9660: 20 72 65 63 74 69 66 79 20 74 68 69 73 20 62 79 rectify this by
9670: 0a 20 2a 09 09 09 09 72 61 6e 64 6f 6d 69 73 69 . *....randomisi
9680: 6e 67 20 74 68 65 20 62 69 74 73 20 61 6e 64 20 ng the bits and
9690: 74 68 65 6e 20 75 73 69 6e 67 20 74 68 65 20 75 then using the u
96a0: 70 70 65 72 0a 20 2a 09 09 09 09 4e 20 62 69 74 pper. *....N bit
96b0: 73 20 61 73 20 74 68 65 20 69 6e 64 65 78 20 69 s as the index i
96c0: 6e 74 6f 20 74 68 65 20 74 61 62 6c 65 2e 0a 20 nto the table..
96d0: 2a 20 54 43 4c 5f 48 41 53 48 5f 4b 45 59 5f 53 * TCL_HASH_KEY_S
96e0: 59 53 54 45 4d 5f 48 41 53 48 20 2d 09 49 66 20 YSTEM_HASH -.If
96f0: 74 68 69 73 20 66 6c 61 67 20 69 73 20 73 65 74 this flag is set
9700: 20 74 68 65 6e 20 61 6c 6c 20 6d 65 6d 6f 72 79 then all memory
9710: 20 69 6e 74 65 72 6e 61 6c 6c 79 0a 20 2a 20 20 internally. *
9720: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
9730: 20 20 20 20 20 20 20 20 20 20 20 20 61 6c 6c 6f allo
9740: 63 61 74 65 64 20 66 6f 72 20 74 68 65 20 68 61 cated for the ha
9750: 73 68 20 74 61 62 6c 65 20 74 68 61 74 20 69 73 sh table that is
9760: 20 6e 6f 74 20 66 6f 72 20 61 6e 0a 20 2a 20 20 not for an. *
9770: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
9780: 20 20 20 20 20 20 20 20 20 20 20 20 65 6e 74 72 entr
9790: 79 20 77 69 6c 6c 20 75 73 65 20 74 68 65 20 73 y will use the s
97a0: 79 73 74 65 6d 20 68 65 61 70 2e 0a 20 2a 20 54 ystem heap.. * T
97b0: 43 4c 5f 48 41 53 48 5f 4b 45 59 5f 44 49 52 45 CL_HASH_KEY_DIRE
97c0: 43 54 5f 43 4f 4d 50 41 52 45 20 2d 0a 20 2a 09 CT_COMPARE -. *.
97d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
97e0: 20 20 20 20 20 20 20 20 41 6c 6c 6f 77 73 20 66 Allows f
97f0: 61 73 74 20 63 6f 6d 70 61 72 69 73 6f 6e 20 66 ast comparison f
9800: 6f 72 20 68 61 73 68 20 6b 65 79 73 20 64 69 72 or hash keys dir
9810: 65 63 74 6c 79 0a 20 2a 20 20 20 20 20 20 20 20 ectly. *
9820: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
9830: 20 20 20 20 20 20 62 79 20 63 6f 6d 70 61 72 65 by compare
9840: 20 6f 66 20 74 68 65 69 72 20 6b 65 79 2e 6f 6e of their key.on
9850: 65 57 6f 72 64 56 61 6c 75 65 20 76 61 6c 75 65 eWordValue value
9860: 73 2c 0a 20 2a 20 20 20 20 20 20 20 20 20 20 20 s,. *
9870: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
9880: 20 20 20 62 65 66 6f 72 65 20 63 61 6c 6c 20 6f before call o
9890: 66 20 63 6f 6d 70 61 72 65 4b 65 79 73 50 72 6f f compareKeysPro
98a0: 63 20 28 6d 75 63 68 20 73 6c 6f 77 65 72 0a 20 c (much slower.
98b0: 2a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 *
98c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 t
98d0: 68 61 6e 20 61 20 64 69 72 65 63 74 20 63 6f 6d han a direct com
98e0: 70 61 72 65 2c 20 73 6f 20 69 74 20 69 73 20 73 pare, so it is s
98f0: 70 65 65 64 2d 75 70 20 6f 6e 6c 79 0a 20 2a 20 peed-up only. *
9900: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
9910: 20 20 20 20 20 20 20 20 20 20 20 20 20 66 6c 61 fla
9920: 67 29 2e 20 44 6f 6e 27 74 20 75 73 65 20 69 74 g). Don't use it
9930: 20 69 66 20 6b 65 79 73 20 63 6f 6e 74 61 69 6e if keys contain
9940: 20 76 61 6c 75 65 73 20 72 61 74 68 65 72 0a 20 values rather.
9950: 2a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 *
9960: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 74 t
9970: 68 61 6e 20 70 6f 69 6e 74 65 72 73 2e 0a 20 2a han pointers.. *
9980: 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 48 /..#define TCL_H
9990: 41 53 48 5f 4b 45 59 5f 52 41 4e 44 4f 4d 49 5a ASH_KEY_RANDOMIZ
99a0: 45 5f 48 41 53 48 20 30 78 31 0a 23 64 65 66 69 E_HASH 0x1.#defi
99b0: 6e 65 20 54 43 4c 5f 48 41 53 48 5f 4b 45 59 5f ne TCL_HASH_KEY_
99c0: 53 59 53 54 45 4d 5f 48 41 53 48 20 20 20 20 30 SYSTEM_HASH 0
99d0: 78 32 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 48 x2.#define TCL_H
99e0: 41 53 48 5f 4b 45 59 5f 44 49 52 45 43 54 5f 43 ASH_KEY_DIRECT_C
99f0: 4f 4d 50 41 52 45 20 30 78 34 0a 0a 2f 2a 0a 20 OMPARE 0x4../*.
9a00: 2a 20 53 74 72 75 63 74 75 72 65 20 64 65 66 69 * Structure defi
9a10: 6e 69 74 69 6f 6e 20 66 6f 72 20 74 68 65 20 6d nition for the m
9a20: 65 74 68 6f 64 73 20 61 73 73 6f 63 69 61 74 65 ethods associate
9a30: 64 20 77 69 74 68 20 61 20 68 61 73 68 20 74 61 d with a hash ta
9a40: 62 6c 65 20 6b 65 79 20 74 79 70 65 2e 0a 20 2a ble key type.. *
9a50: 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 48 /..#define TCL_H
9a60: 41 53 48 5f 4b 45 59 5f 54 59 50 45 5f 56 45 52 ASH_KEY_TYPE_VER
9a70: 53 49 4f 4e 20 31 0a 73 74 72 75 63 74 20 54 63 SION 1.struct Tc
9a80: 6c 5f 48 61 73 68 4b 65 79 54 79 70 65 20 7b 0a l_HashKeyType {.
9a90: 20 20 20 20 69 6e 74 20 76 65 72 73 69 6f 6e 3b int version;
9aa0: 09 09 2f 2a 20 56 65 72 73 69 6f 6e 20 6f 66 20 ../* Version of
9ab0: 74 68 65 20 74 61 62 6c 65 2e 20 49 66 20 74 68 the table. If th
9ac0: 69 73 20 73 74 72 75 63 74 75 72 65 20 69 73 0a is structure is.
9ad0: 09 09 09 09 20 2a 20 65 78 74 65 6e 64 65 64 20 .... * extended
9ae0: 69 6e 20 66 75 74 75 72 65 20 74 68 65 6e 20 74 in future then t
9af0: 68 65 20 76 65 72 73 69 6f 6e 20 63 61 6e 20 62 he version can b
9b00: 65 0a 09 09 09 09 20 2a 20 75 73 65 64 20 74 6f e..... * used to
9b10: 20 64 69 73 74 69 6e 67 75 69 73 68 20 62 65 74 distinguish bet
9b20: 77 65 65 6e 20 64 69 66 66 65 72 65 6e 74 0a 09 ween different..
9b30: 09 09 09 20 2a 20 73 74 72 75 63 74 75 72 65 73 ... * structures
9b40: 2e 20 2a 2f 0a 20 20 20 20 69 6e 74 20 66 6c 61 . */. int fla
9b50: 67 73 3b 09 09 09 2f 2a 20 46 6c 61 67 73 2c 20 gs;.../* Flags,
9b60: 73 65 65 20 61 62 6f 76 65 20 66 6f 72 20 64 65 see above for de
9b70: 74 61 69 6c 73 2e 20 2a 2f 0a 20 20 20 20 54 63 tails. */. Tc
9b80: 6c 5f 48 61 73 68 4b 65 79 50 72 6f 63 20 2a 68 l_HashKeyProc *h
9b90: 61 73 68 4b 65 79 50 72 6f 63 3b 0a 09 09 09 09 ashKeyProc;.....
9ba0: 2f 2a 20 43 61 6c 63 75 6c 61 74 65 73 20 61 20 /* Calculates a
9bb0: 68 61 73 68 20 76 61 6c 75 65 20 66 6f 72 20 74 hash value for t
9bc0: 68 65 20 6b 65 79 2e 20 49 66 0a 09 09 09 09 20 he key. If.....
9bd0: 2a 20 74 68 69 73 20 69 73 20 4e 55 4c 4c 20 74 * this is NULL t
9be0: 68 65 6e 20 74 68 65 20 70 6f 69 6e 74 65 72 20 hen the pointer
9bf0: 69 74 73 65 6c 66 20 69 73 0a 09 09 09 09 20 2a itself is..... *
9c00: 20 75 73 65 64 20 61 73 20 61 20 68 61 73 68 20 used as a hash
9c10: 76 61 6c 75 65 2e 20 2a 2f 0a 20 20 20 20 54 63 value. */. Tc
9c20: 6c 5f 43 6f 6d 70 61 72 65 48 61 73 68 4b 65 79 l_CompareHashKey
9c30: 73 50 72 6f 63 20 2a 63 6f 6d 70 61 72 65 4b 65 sProc *compareKe
9c40: 79 73 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 43 ysProc;...../* C
9c50: 6f 6d 70 61 72 65 73 20 74 77 6f 20 6b 65 79 73 ompares two keys
9c60: 20 61 6e 64 20 72 65 74 75 72 6e 73 20 7a 65 72 and returns zer
9c70: 6f 20 69 66 20 74 68 65 79 0a 09 09 09 09 20 2a o if they..... *
9c80: 20 64 6f 20 6e 6f 74 20 6d 61 74 63 68 2c 20 61 do not match, a
9c90: 6e 64 20 6e 6f 6e 2d 7a 65 72 6f 20 69 66 20 74 nd non-zero if t
9ca0: 68 65 79 20 64 6f 2e 20 49 66 0a 09 09 09 09 20 hey do. If.....
9cb0: 2a 20 74 68 69 73 20 69 73 20 4e 55 4c 4c 20 74 * this is NULL t
9cc0: 68 65 6e 20 74 68 65 20 70 6f 69 6e 74 65 72 73 hen the pointers
9cd0: 20 61 72 65 0a 09 09 09 09 20 2a 20 63 6f 6d 70 are..... * comp
9ce0: 61 72 65 64 2e 20 2a 2f 0a 20 20 20 20 54 63 6c ared. */. Tcl
9cf0: 5f 41 6c 6c 6f 63 48 61 73 68 45 6e 74 72 79 50 _AllocHashEntryP
9d00: 72 6f 63 20 2a 61 6c 6c 6f 63 45 6e 74 72 79 50 roc *allocEntryP
9d10: 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 43 61 6c 6c roc;...../* Call
9d20: 65 64 20 74 6f 20 61 6c 6c 6f 63 61 74 65 20 6d ed to allocate m
9d30: 65 6d 6f 72 79 20 66 6f 72 20 61 20 6e 65 77 20 emory for a new
9d40: 65 6e 74 72 79 2c 0a 09 09 09 09 20 2a 20 69 2e entry,..... * i.
9d50: 65 2e 20 69 66 20 74 68 65 20 6b 65 79 20 69 73 e. if the key is
9d60: 20 61 20 73 74 72 69 6e 67 20 74 68 65 6e 20 74 a string then t
9d70: 68 69 73 20 63 6f 75 6c 64 0a 09 09 09 09 20 2a his could..... *
9d80: 20 61 6c 6c 6f 63 61 74 65 20 61 20 73 69 6e 67 allocate a sing
9d90: 6c 65 20 62 6c 6f 63 6b 20 77 68 69 63 68 20 63 le block which c
9da0: 6f 6e 74 61 69 6e 73 0a 09 09 09 09 20 2a 20 65 ontains..... * e
9db0: 6e 6f 75 67 68 20 73 70 61 63 65 20 66 6f 72 20 nough space for
9dc0: 62 6f 74 68 20 74 68 65 20 65 6e 74 72 79 20 61 both the entry a
9dd0: 6e 64 20 74 68 65 0a 09 09 09 09 20 2a 20 73 74 nd the..... * st
9de0: 72 69 6e 67 2e 20 4f 6e 6c 79 20 74 68 65 20 6b ring. Only the k
9df0: 65 79 20 66 69 65 6c 64 20 6f 66 20 74 68 65 20 ey field of the
9e00: 61 6c 6c 6f 63 61 74 65 64 0a 09 09 09 09 20 2a allocated..... *
9e10: 20 54 63 6c 5f 48 61 73 68 45 6e 74 72 79 20 73 Tcl_HashEntry s
9e20: 74 72 75 63 74 75 72 65 20 6e 65 65 64 73 20 74 tructure needs t
9e30: 6f 20 62 65 20 66 69 6c 6c 65 64 0a 09 09 09 09 o be filled.....
9e40: 20 2a 20 69 6e 2e 20 49 66 20 73 6f 6d 65 74 68 * in. If someth
9e50: 69 6e 67 20 65 6c 73 65 20 6e 65 65 64 73 20 74 ing else needs t
9e60: 6f 20 62 65 20 64 6f 6e 65 20 74 6f 0a 09 09 09 o be done to....
9e70: 09 20 2a 20 74 68 65 20 6b 65 79 2c 20 69 2e 65 . * the key, i.e
9e80: 2e 20 69 6e 63 72 65 6d 65 6e 74 69 6e 67 20 61 . incrementing a
9e90: 20 72 65 66 65 72 65 6e 63 65 0a 09 09 09 09 20 reference.....
9ea0: 2a 20 63 6f 75 6e 74 20 74 68 65 6e 20 74 68 61 * count then tha
9eb0: 74 20 73 68 6f 75 6c 64 20 62 65 20 64 6f 6e 65 t should be done
9ec0: 20 62 79 20 74 68 69 73 0a 09 09 09 09 20 2a 20 by this..... *
9ed0: 66 75 6e 63 74 69 6f 6e 2e 20 49 66 20 74 68 69 function. If thi
9ee0: 73 20 69 73 20 4e 55 4c 4c 20 74 68 65 6e 20 54 s is NULL then T
9ef0: 63 6c 5f 41 6c 6c 6f 63 20 69 73 0a 09 09 09 09 cl_Alloc is.....
9f00: 20 2a 20 75 73 65 64 20 74 6f 20 61 6c 6c 6f 63 * used to alloc
9f10: 61 74 65 20 65 6e 6f 75 67 68 20 73 70 61 63 65 ate enough space
9f20: 20 66 6f 72 20 61 0a 09 09 09 09 20 2a 20 54 63 for a..... * Tc
9f30: 6c 5f 48 61 73 68 45 6e 74 72 79 20 61 6e 64 20 l_HashEntry and
9f40: 74 68 65 20 6b 65 79 20 70 6f 69 6e 74 65 72 20 the key pointer
9f50: 69 73 0a 09 09 09 09 20 2a 20 61 73 73 69 67 6e is..... * assign
9f60: 65 64 20 74 6f 20 6b 65 79 2e 6f 6e 65 57 6f 72 ed to key.oneWor
9f70: 64 56 61 6c 75 65 2e 20 2a 2f 0a 20 20 20 20 54 dValue. */. T
9f80: 63 6c 5f 46 72 65 65 48 61 73 68 45 6e 74 72 79 cl_FreeHashEntry
9f90: 50 72 6f 63 20 2a 66 72 65 65 45 6e 74 72 79 50 Proc *freeEntryP
9fa0: 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 43 61 6c 6c roc;...../* Call
9fb0: 65 64 20 74 6f 20 66 72 65 65 20 6d 65 6d 6f 72 ed to free memor
9fc0: 79 20 61 73 73 6f 63 69 61 74 65 64 20 77 69 74 y associated wit
9fd0: 68 20 61 6e 0a 09 09 09 09 20 2a 20 65 6e 74 72 h an..... * entr
9fe0: 79 2e 20 49 66 20 73 6f 6d 65 74 68 69 6e 67 20 y. If something
9ff0: 65 6c 73 65 20 6e 65 65 64 73 20 74 6f 20 62 65 else needs to be
a000: 20 64 6f 6e 65 0a 09 09 09 09 20 2a 20 74 6f 20 done..... * to
a010: 74 68 65 20 6b 65 79 2c 20 69 2e 65 2e 20 64 65 the key, i.e. de
a020: 63 72 65 6d 65 6e 74 69 6e 67 20 61 20 72 65 66 crementing a ref
a030: 65 72 65 6e 63 65 0a 09 09 09 09 20 2a 20 63 6f erence..... * co
a040: 75 6e 74 20 74 68 65 6e 20 74 68 61 74 20 73 68 unt then that sh
a050: 6f 75 6c 64 20 62 65 20 64 6f 6e 65 20 62 79 20 ould be done by
a060: 74 68 69 73 0a 09 09 09 09 20 2a 20 66 75 6e 63 this..... * func
a070: 74 69 6f 6e 2e 20 49 66 20 74 68 69 73 20 69 73 tion. If this is
a080: 20 4e 55 4c 4c 20 74 68 65 6e 20 54 63 6c 5f 46 NULL then Tcl_F
a090: 72 65 65 20 69 73 0a 09 09 09 09 20 2a 20 75 73 ree is..... * us
a0a0: 65 64 20 74 6f 20 66 72 65 65 20 74 68 65 20 54 ed to free the T
a0b0: 63 6c 5f 48 61 73 68 45 6e 74 72 79 2e 20 2a 2f cl_HashEntry. */
a0c0: 0a 7d 3b 0a 0a 2f 2a 0a 20 2a 20 53 74 72 75 63 .};../*. * Struc
a0d0: 74 75 72 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 ture definition
a0e0: 66 6f 72 20 61 20 68 61 73 68 20 74 61 62 6c 65 for a hash table
a0f0: 2e 20 20 4d 75 73 74 20 62 65 20 69 6e 20 74 63 . Must be in tc
a100: 6c 2e 68 20 73 6f 20 63 6c 69 65 6e 74 73 20 63 l.h so clients c
a110: 61 6e 0a 20 2a 20 61 6c 6c 6f 63 61 74 65 20 73 an. * allocate s
a120: 70 61 63 65 20 66 6f 72 20 74 68 65 73 65 20 73 pace for these s
a130: 74 72 75 63 74 75 72 65 73 2c 20 62 75 74 20 63 tructures, but c
a140: 6c 69 65 6e 74 73 20 73 68 6f 75 6c 64 20 6e 65 lients should ne
a150: 76 65 72 20 61 63 63 65 73 73 20 61 6e 79 0a 20 ver access any.
a160: 2a 20 66 69 65 6c 64 73 20 69 6e 20 74 68 69 73 * fields in this
a170: 20 73 74 72 75 63 74 75 72 65 2e 0a 20 2a 2f 0a structure.. */.
a180: 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 53 4d 41 .#define TCL_SMA
a190: 4c 4c 5f 48 41 53 48 5f 54 41 42 4c 45 20 34 0a LL_HASH_TABLE 4.
a1a0: 73 74 72 75 63 74 20 54 63 6c 5f 48 61 73 68 54 struct Tcl_HashT
a1b0: 61 62 6c 65 20 7b 0a 20 20 20 20 54 63 6c 5f 48 able {. Tcl_H
a1c0: 61 73 68 45 6e 74 72 79 20 2a 2a 62 75 63 6b 65 ashEntry **bucke
a1d0: 74 73 3b 09 2f 2a 20 50 6f 69 6e 74 65 72 20 74 ts;./* Pointer t
a1e0: 6f 20 62 75 63 6b 65 74 20 61 72 72 61 79 2e 20 o bucket array.
a1f0: 45 61 63 68 20 65 6c 65 6d 65 6e 74 0a 09 09 09 Each element....
a200: 09 20 2a 20 70 6f 69 6e 74 73 20 74 6f 20 66 69 . * points to fi
a210: 72 73 74 20 65 6e 74 72 79 20 69 6e 20 62 75 63 rst entry in buc
a220: 6b 65 74 27 73 20 68 61 73 68 0a 09 09 09 09 20 ket's hash.....
a230: 2a 20 63 68 61 69 6e 2c 20 6f 72 20 4e 55 4c 4c * chain, or NULL
a240: 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 48 61 73 . */. Tcl_Has
a250: 68 45 6e 74 72 79 20 2a 73 74 61 74 69 63 42 75 hEntry *staticBu
a260: 63 6b 65 74 73 5b 54 43 4c 5f 53 4d 41 4c 4c 5f ckets[TCL_SMALL_
a270: 48 41 53 48 5f 54 41 42 4c 45 5d 3b 0a 09 09 09 HASH_TABLE];....
a280: 09 2f 2a 20 42 75 63 6b 65 74 20 61 72 72 61 79 ./* Bucket array
a290: 20 75 73 65 64 20 66 6f 72 20 73 6d 61 6c 6c 20 used for small
a2a0: 74 61 62 6c 65 73 20 28 74 6f 0a 09 09 09 09 20 tables (to.....
a2b0: 2a 20 61 76 6f 69 64 20 6d 61 6c 6c 6f 63 73 20 * avoid mallocs
a2c0: 61 6e 64 20 66 72 65 65 73 29 2e 20 2a 2f 0a 20 and frees). */.
a2d0: 20 20 20 54 63 6c 5f 53 69 7a 65 20 6e 75 6d 42 Tcl_Size numB
a2e0: 75 63 6b 65 74 73 3b 09 2f 2a 20 54 6f 74 61 6c uckets;./* Total
a2f0: 20 6e 75 6d 62 65 72 20 6f 66 20 62 75 63 6b 65 number of bucke
a300: 74 73 20 61 6c 6c 6f 63 61 74 65 64 20 61 74 0a ts allocated at.
a310: 09 09 09 09 20 2a 20 2a 2a 62 75 63 6b 65 74 50 .... * **bucketP
a320: 74 72 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 53 tr. */. Tcl_S
a330: 69 7a 65 20 6e 75 6d 45 6e 74 72 69 65 73 3b 09 ize numEntries;.
a340: 2f 2a 20 54 6f 74 61 6c 20 6e 75 6d 62 65 72 20 /* Total number
a350: 6f 66 20 65 6e 74 72 69 65 73 20 70 72 65 73 65 of entries prese
a360: 6e 74 20 69 6e 0a 09 09 09 09 20 2a 20 74 61 62 nt in..... * tab
a370: 6c 65 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 53 le. */. Tcl_S
a380: 69 7a 65 20 72 65 62 75 69 6c 64 53 69 7a 65 3b ize rebuildSize;
a390: 09 2f 2a 20 45 6e 6c 61 72 67 65 20 74 61 62 6c ./* Enlarge tabl
a3a0: 65 20 77 68 65 6e 20 6e 75 6d 45 6e 74 72 69 65 e when numEntrie
a3b0: 73 20 67 65 74 73 20 74 6f 20 62 65 0a 09 09 09 s gets to be....
a3c0: 09 20 2a 20 74 68 69 73 20 6c 61 72 67 65 2e 20 . * this large.
a3d0: 2a 2f 0a 20 20 20 20 73 69 7a 65 5f 74 20 6d 61 */. size_t ma
a3e0: 73 6b 3b 09 09 2f 2a 20 4d 61 73 6b 20 76 61 6c sk;../* Mask val
a3f0: 75 65 20 75 73 65 64 20 69 6e 20 68 61 73 68 69 ue used in hashi
a400: 6e 67 20 66 75 6e 63 74 69 6f 6e 2e 20 2a 2f 0a ng function. */.
a410: 20 20 20 20 69 6e 74 20 64 6f 77 6e 53 68 69 66 int downShif
a420: 74 3b 09 09 2f 2a 20 53 68 69 66 74 20 63 6f 75 t;../* Shift cou
a430: 6e 74 20 75 73 65 64 20 69 6e 20 68 61 73 68 69 nt used in hashi
a440: 6e 67 20 66 75 6e 63 74 69 6f 6e 2e 0a 09 09 09 ng function.....
a450: 09 20 2a 20 44 65 73 69 67 6e 65 64 20 74 6f 20 . * Designed to
a460: 75 73 65 20 68 69 67 68 2d 6f 72 64 65 72 20 62 use high-order b
a470: 69 74 73 20 6f 66 0a 09 09 09 09 20 2a 20 72 61 its of..... * ra
a480: 6e 64 6f 6d 69 7a 65 64 20 6b 65 79 73 2e 20 2a ndomized keys. *
a490: 2f 0a 20 20 20 20 69 6e 74 20 6b 65 79 54 79 70 /. int keyTyp
a4a0: 65 3b 09 09 2f 2a 20 54 79 70 65 20 6f 66 20 6b e;../* Type of k
a4b0: 65 79 73 20 75 73 65 64 20 69 6e 20 74 68 69 73 eys used in this
a4c0: 20 74 61 62 6c 65 2e 20 49 74 27 73 0a 09 09 09 table. It's....
a4d0: 09 20 2a 20 65 69 74 68 65 72 20 54 43 4c 5f 43 . * either TCL_C
a4e0: 55 53 54 4f 4d 5f 4b 45 59 53 2c 20 54 43 4c 5f USTOM_KEYS, TCL_
a4f0: 53 54 52 49 4e 47 5f 4b 45 59 53 2c 0a 09 09 09 STRING_KEYS,....
a500: 09 20 2a 20 54 43 4c 5f 4f 4e 45 5f 57 4f 52 44 . * TCL_ONE_WORD
a510: 5f 4b 45 59 53 2c 20 6f 72 20 61 6e 20 69 6e 74 _KEYS, or an int
a520: 65 67 65 72 20 67 69 76 69 6e 67 20 74 68 65 0a eger giving the.
a530: 09 09 09 09 20 2a 20 6e 75 6d 62 65 72 20 6f 66 .... * number of
a540: 20 69 6e 74 73 20 74 68 61 74 20 69 73 20 74 68 ints that is th
a550: 65 20 73 69 7a 65 20 6f 66 20 74 68 65 0a 09 09 e size of the...
a560: 09 09 20 2a 20 6b 65 79 2e 20 2a 2f 0a 23 69 66 .. * key. */.#if
a570: 6e 64 65 66 20 54 43 4c 5f 4e 4f 5f 44 45 50 52 ndef TCL_NO_DEPR
a580: 45 43 41 54 45 44 0a 20 20 20 20 54 63 6c 5f 48 ECATED. Tcl_H
a590: 61 73 68 45 6e 74 72 79 20 2a 28 2a 66 69 6e 64 ashEntry *(*find
a5a0: 50 72 6f 63 29 20 28 54 63 6c 5f 48 61 73 68 54 Proc) (Tcl_HashT
a5b0: 61 62 6c 65 20 2a 74 61 62 6c 65 50 74 72 2c 20 able *tablePtr,
a5c0: 63 6f 6e 73 74 20 63 68 61 72 20 2a 6b 65 79 29 const char *key)
a5d0: 3b 0a 23 65 6c 73 65 0a 20 20 20 20 76 6f 69 64 ;.#else. void
a5e0: 20 2a 75 6e 55 73 65 64 3b 0a 23 65 6e 64 69 66 *unUsed;.#endif
a5f0: 0a 20 20 20 20 54 63 6c 5f 48 61 73 68 45 6e 74 . Tcl_HashEnt
a600: 72 79 20 2a 28 2a 63 72 65 61 74 65 50 72 6f 63 ry *(*createProc
a610: 29 20 28 54 63 6c 5f 48 61 73 68 54 61 62 6c 65 ) (Tcl_HashTable
a620: 20 2a 74 61 62 6c 65 50 74 72 2c 20 63 6f 6e 73 *tablePtr, cons
a630: 74 20 63 68 61 72 20 2a 6b 65 79 2c 0a 09 20 20 t char *key,..
a640: 20 20 69 6e 74 20 2a 6e 65 77 50 74 72 29 3b 0a int *newPtr);.
a650: 20 20 20 20 63 6f 6e 73 74 20 54 63 6c 5f 48 61 const Tcl_Ha
a660: 73 68 4b 65 79 54 79 70 65 20 2a 74 79 70 65 50 shKeyType *typeP
a670: 74 72 3b 0a 09 09 09 09 2f 2a 20 54 79 70 65 20 tr;...../* Type
a680: 6f 66 20 74 68 65 20 6b 65 79 73 20 75 73 65 64 of the keys used
a690: 20 69 6e 20 74 68 65 0a 09 09 09 09 20 2a 20 54 in the..... * T
a6a0: 63 6c 5f 48 61 73 68 54 61 62 6c 65 2e 20 2a 2f cl_HashTable. */
a6b0: 0a 7d 3b 0a 0a 2f 2a 0a 20 2a 20 53 74 72 75 63 .};../*. * Struc
a6c0: 74 75 72 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 ture definition
a6d0: 66 6f 72 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 for information
a6e0: 75 73 65 64 20 74 6f 20 6b 65 65 70 20 74 72 61 used to keep tra
a6f0: 63 6b 20 6f 66 20 73 65 61 72 63 68 65 73 20 74 ck of searches t
a700: 68 72 6f 75 67 68 0a 20 2a 20 68 61 73 68 20 74 hrough. * hash t
a710: 61 62 6c 65 73 3a 0a 20 2a 2f 0a 0a 74 79 70 65 ables:. */..type
a720: 64 65 66 20 73 74 72 75 63 74 20 54 63 6c 5f 48 def struct Tcl_H
a730: 61 73 68 53 65 61 72 63 68 20 7b 0a 20 20 20 20 ashSearch {.
a740: 54 63 6c 5f 48 61 73 68 54 61 62 6c 65 20 2a 74 Tcl_HashTable *t
a750: 61 62 6c 65 50 74 72 3b 09 2f 2a 20 54 61 62 6c ablePtr;./* Tabl
a760: 65 20 62 65 69 6e 67 20 73 65 61 72 63 68 65 64 e being searched
a770: 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 53 69 7a . */. Tcl_Siz
a780: 65 20 6e 65 78 74 49 6e 64 65 78 3b 09 09 2f 2a e nextIndex;../*
a790: 20 49 6e 64 65 78 20 6f 66 20 6e 65 78 74 20 62 Index of next b
a7a0: 75 63 6b 65 74 20 74 6f 20 62 65 20 65 6e 75 6d ucket to be enum
a7b0: 65 72 61 74 65 64 20 61 66 74 65 72 0a 09 09 09 erated after....
a7c0: 09 20 2a 20 70 72 65 73 65 6e 74 20 6f 6e 65 2e . * present one.
a7d0: 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 48 61 73 68 */. Tcl_Hash
a7e0: 45 6e 74 72 79 20 2a 6e 65 78 74 45 6e 74 72 79 Entry *nextEntry
a7f0: 50 74 72 3b 2f 2a 20 4e 65 78 74 20 65 6e 74 72 Ptr;/* Next entr
a800: 79 20 74 6f 20 62 65 20 65 6e 75 6d 65 72 61 74 y to be enumerat
a810: 65 64 20 69 6e 20 74 68 65 20 63 75 72 72 65 6e ed in the curren
a820: 74 0a 09 09 09 09 20 2a 20 62 75 63 6b 65 74 2e t..... * bucket.
a830: 20 2a 2f 0a 7d 20 54 63 6c 5f 48 61 73 68 53 65 */.} Tcl_HashSe
a840: 61 72 63 68 3b 0a 0a 2f 2a 0a 20 2a 20 41 63 63 arch;../*. * Acc
a850: 65 70 74 61 62 6c 65 20 6b 65 79 20 74 79 70 65 eptable key type
a860: 73 20 66 6f 72 20 68 61 73 68 20 74 61 62 6c 65 s for hash table
a870: 73 3a 0a 20 2a 0a 20 2a 20 54 43 4c 5f 53 54 52 s:. *. * TCL_STR
a880: 49 4e 47 5f 4b 45 59 53 3a 09 09 54 68 65 20 6b ING_KEYS:..The k
a890: 65 79 73 20 61 72 65 20 73 74 72 69 6e 67 73 2c eys are strings,
a8a0: 20 74 68 65 79 20 61 72 65 20 63 6f 70 69 65 64 they are copied
a8b0: 20 69 6e 74 6f 20 74 68 65 0a 20 2a 09 09 09 09 into the. *....
a8c0: 65 6e 74 72 79 2e 0a 20 2a 20 54 43 4c 5f 4f 4e entry.. * TCL_ON
a8d0: 45 5f 57 4f 52 44 5f 4b 45 59 53 3a 09 09 54 68 E_WORD_KEYS:..Th
a8e0: 65 20 6b 65 79 73 20 61 72 65 20 70 6f 69 6e 74 e keys are point
a8f0: 65 72 73 2c 20 74 68 65 20 70 6f 69 6e 74 65 72 ers, the pointer
a900: 20 69 73 20 73 74 6f 72 65 64 0a 20 2a 09 09 09 is stored. *...
a910: 09 69 6e 20 74 68 65 20 65 6e 74 72 79 2e 0a 20 .in the entry..
a920: 2a 20 54 43 4c 5f 43 55 53 54 4f 4d 5f 54 59 50 * TCL_CUSTOM_TYP
a930: 45 5f 4b 45 59 53 3a 09 54 68 65 20 6b 65 79 73 E_KEYS:.The keys
a940: 20 61 72 65 20 61 72 62 69 74 72 61 72 79 20 74 are arbitrary t
a950: 79 70 65 73 20 77 68 69 63 68 20 61 72 65 20 63 ypes which are c
a960: 6f 70 69 65 64 0a 20 2a 09 09 09 09 69 6e 74 6f opied. *....into
a970: 20 74 68 65 20 65 6e 74 72 79 2e 0a 20 2a 20 54 the entry.. * T
a980: 43 4c 5f 43 55 53 54 4f 4d 5f 50 54 52 5f 4b 45 CL_CUSTOM_PTR_KE
a990: 59 53 3a 09 09 54 68 65 20 6b 65 79 73 20 61 72 YS:..The keys ar
a9a0: 65 20 70 6f 69 6e 74 65 72 73 20 74 6f 20 61 72 e pointers to ar
a9b0: 62 69 74 72 61 72 79 20 74 79 70 65 73 2c 20 74 bitrary types, t
a9c0: 68 65 0a 20 2a 09 09 09 09 70 6f 69 6e 74 65 72 he. *....pointer
a9d0: 20 69 73 20 73 74 6f 72 65 64 20 69 6e 20 74 68 is stored in th
a9e0: 65 20 65 6e 74 72 79 2e 0a 20 2a 0a 20 2a 20 57 e entry.. *. * W
a9f0: 68 69 6c 65 20 6d 61 69 6e 74 61 69 6e 69 6e 67 hile maintaining
aa00: 20 62 69 6e 61 72 79 20 63 6f 6d 70 61 74 69 62 binary compatib
aa10: 69 6c 69 74 79 20 74 68 65 20 61 62 6f 76 65 20 ility the above
aa20: 68 61 76 65 20 74 6f 20 62 65 20 64 69 73 74 69 have to be disti
aa30: 6e 63 74 20 76 61 6c 75 65 73 0a 20 2a 20 61 73 nct values. * as
aa40: 20 74 68 65 79 20 61 72 65 20 75 73 65 64 20 74 they are used t
aa50: 6f 20 64 69 66 66 65 72 65 6e 74 69 61 74 65 20 o differentiate
aa60: 62 65 74 77 65 65 6e 20 6f 6c 64 20 76 65 72 73 between old vers
aa70: 69 6f 6e 73 20 6f 66 20 74 68 65 20 68 61 73 68 ions of the hash
aa80: 20 74 61 62 6c 65 0a 20 2a 20 77 68 69 63 68 20 table. * which
aa90: 64 6f 6e 27 74 20 68 61 76 65 20 61 20 74 79 70 don't have a typ
aaa0: 65 50 74 72 20 61 6e 64 20 6e 65 77 20 6f 6e 65 ePtr and new one
aab0: 73 20 77 68 69 63 68 20 64 6f 2e 20 4f 6e 63 65 s which do. Once
aac0: 20 62 69 6e 61 72 79 20 63 6f 6d 70 61 74 69 62 binary compatib
aad0: 69 6c 69 74 79 0a 20 2a 20 69 73 20 64 69 73 63 ility. * is disc
aae0: 61 72 64 65 64 20 69 6e 20 66 61 76 6f 75 72 20 arded in favour
aaf0: 6f 66 20 6d 61 6b 69 6e 67 20 6d 6f 72 65 20 77 of making more w
ab00: 69 64 65 20 73 70 72 65 61 64 20 63 68 61 6e 67 ide spread chang
ab10: 65 73 20 54 43 4c 5f 53 54 52 49 4e 47 5f 4b 45 es TCL_STRING_KE
ab20: 59 53 0a 20 2a 20 63 61 6e 20 62 65 20 74 68 65 YS. * can be the
ab30: 20 73 61 6d 65 20 61 73 20 54 43 4c 5f 43 55 53 same as TCL_CUS
ab40: 54 4f 4d 5f 54 59 50 45 5f 4b 45 59 53 2c 20 61 TOM_TYPE_KEYS, a
ab50: 6e 64 20 54 43 4c 5f 4f 4e 45 5f 57 4f 52 44 5f nd TCL_ONE_WORD_
ab60: 4b 45 59 53 20 63 61 6e 20 62 65 20 74 68 65 0a KEYS can be the.
ab70: 20 2a 20 73 61 6d 65 20 61 73 20 54 43 4c 5f 43 * same as TCL_C
ab80: 55 53 54 4f 4d 5f 50 54 52 5f 4b 45 59 53 20 62 USTOM_PTR_KEYS b
ab90: 65 63 61 75 73 65 20 74 68 65 79 20 73 69 6d 70 ecause they simp
aba0: 6c 79 20 64 65 74 65 72 6d 69 6e 65 20 68 6f 77 ly determine how
abb0: 20 74 68 65 20 6b 65 79 20 69 73 0a 20 2a 20 61 the key is. * a
abc0: 63 63 65 73 73 65 64 20 66 72 6f 6d 20 74 68 65 ccessed from the
abd0: 20 65 6e 74 72 79 20 61 6e 64 20 6e 6f 74 20 74 entry and not t
abe0: 68 65 20 62 65 68 61 76 69 6f 75 72 2e 0a 20 2a he behaviour.. *
abf0: 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 53 /..#define TCL_S
ac00: 54 52 49 4e 47 5f 4b 45 59 53 09 09 28 30 29 0a TRING_KEYS..(0).
ac10: 23 64 65 66 69 6e 65 20 54 43 4c 5f 4f 4e 45 5f #define TCL_ONE_
ac20: 57 4f 52 44 5f 4b 45 59 53 09 28 31 29 0a 23 64 WORD_KEYS.(1).#d
ac30: 65 66 69 6e 65 20 54 43 4c 5f 43 55 53 54 4f 4d efine TCL_CUSTOM
ac40: 5f 54 59 50 45 5f 4b 45 59 53 09 28 2d 32 29 0a _TYPE_KEYS.(-2).
ac50: 23 64 65 66 69 6e 65 20 54 43 4c 5f 43 55 53 54 #define TCL_CUST
ac60: 4f 4d 5f 50 54 52 5f 4b 45 59 53 09 28 2d 31 29 OM_PTR_KEYS.(-1)
ac70: 0a 0a 2f 2a 0a 20 2a 20 53 74 72 75 63 74 75 72 ../*. * Structur
ac80: 65 20 64 65 66 69 6e 69 74 69 6f 6e 20 66 6f 72 e definition for
ac90: 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 75 73 65 information use
aca0: 64 20 74 6f 20 6b 65 65 70 20 74 72 61 63 6b 20 d to keep track
acb0: 6f 66 20 73 65 61 72 63 68 65 73 20 74 68 72 6f of searches thro
acc0: 75 67 68 0a 20 2a 20 64 69 63 74 69 6f 6e 61 72 ugh. * dictionar
acd0: 69 65 73 2e 20 54 68 65 73 65 20 66 69 65 6c 64 ies. These field
ace0: 73 20 73 68 6f 75 6c 64 20 6e 6f 74 20 62 65 20 s should not be
acf0: 61 63 63 65 73 73 65 64 20 62 79 20 63 6f 64 65 accessed by code
ad00: 20 6f 75 74 73 69 64 65 0a 20 2a 20 74 63 6c 44 outside. * tclD
ad10: 69 63 74 4f 62 6a 2e 63 0a 20 2a 2f 0a 0a 74 79 ictObj.c. */..ty
ad20: 70 65 64 65 66 20 73 74 72 75 63 74 20 7b 0a 20 pedef struct {.
ad30: 20 20 20 76 6f 69 64 20 2a 6e 65 78 74 3b 09 09 void *next;..
ad40: 09 2f 2a 20 53 65 61 72 63 68 20 70 6f 73 69 74 ./* Search posit
ad50: 69 6f 6e 20 66 6f 72 20 75 6e 64 65 72 6c 79 69 ion for underlyi
ad60: 6e 67 20 68 61 73 68 0a 09 09 09 09 20 2a 20 74 ng hash..... * t
ad70: 61 62 6c 65 2e 20 2a 2f 0a 20 20 20 20 73 69 7a able. */. siz
ad80: 65 5f 74 20 65 70 6f 63 68 3b 09 09 2f 2a 20 45 e_t epoch;../* E
ad90: 70 6f 63 68 20 6d 61 72 6b 65 72 20 66 6f 72 20 poch marker for
ada0: 64 69 63 74 69 6f 6e 61 72 79 20 62 65 69 6e 67 dictionary being
adb0: 20 73 65 61 72 63 68 65 64 2c 0a 09 09 09 09 20 searched,.....
adc0: 2a 20 6f 72 20 30 20 69 66 20 73 65 61 72 63 68 * or 0 if search
add0: 20 68 61 73 20 74 65 72 6d 69 6e 61 74 65 64 2e has terminated.
ade0: 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 44 69 63 74 */. Tcl_Dict
adf0: 20 64 69 63 74 69 6f 6e 61 72 79 50 74 72 3b 09 dictionaryPtr;.
ae00: 2f 2a 20 52 65 66 65 72 65 6e 63 65 20 74 6f 20 /* Reference to
ae10: 64 69 63 74 69 6f 6e 61 72 79 20 62 65 69 6e 67 dictionary being
ae20: 20 73 65 61 72 63 68 65 64 2e 20 2a 2f 0a 7d 20 searched. */.}
ae30: 54 63 6c 5f 44 69 63 74 53 65 61 72 63 68 3b 0a Tcl_DictSearch;.
ae40: 0c 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d ../*. *---------
ae50: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
ae60: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
ae70: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
ae80: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
ae90: 2d 2d 2d 0a 20 2a 20 46 6c 61 67 20 76 61 6c 75 ---. * Flag valu
aea0: 65 73 20 74 6f 20 70 61 73 73 20 74 6f 20 54 63 es to pass to Tc
aeb0: 6c 5f 44 6f 4f 6e 65 45 76 65 6e 74 20 74 6f 20 l_DoOneEvent to
aec0: 64 69 73 61 62 6c 65 20 73 65 61 72 63 68 65 73 disable searches
aed0: 20 66 6f 72 20 73 6f 6d 65 20 6b 69 6e 64 73 20 for some kinds
aee0: 6f 66 0a 20 2a 20 65 76 65 6e 74 73 3a 0a 20 2a of. * events:. *
aef0: 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 44 /..#define TCL_D
af00: 4f 4e 54 5f 57 41 49 54 09 09 28 31 3c 3c 31 29 ONT_WAIT..(1<<1)
af10: 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 57 49 4e .#define TCL_WIN
af20: 44 4f 57 5f 45 56 45 4e 54 53 09 28 31 3c 3c 32 DOW_EVENTS.(1<<2
af30: 29 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 46 49 ).#define TCL_FI
af40: 4c 45 5f 45 56 45 4e 54 53 09 09 28 31 3c 3c 33 LE_EVENTS..(1<<3
af50: 29 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 54 49 ).#define TCL_TI
af60: 4d 45 52 5f 45 56 45 4e 54 53 09 28 31 3c 3c 34 MER_EVENTS.(1<<4
af70: 29 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 49 44 ).#define TCL_ID
af80: 4c 45 5f 45 56 45 4e 54 53 09 09 28 31 3c 3c 35 LE_EVENTS..(1<<5
af90: 29 09 2f 2a 20 57 41 53 20 30 78 31 30 20 3f 3f )./* WAS 0x10 ??
afa0: 3f 3f 20 2a 2f 0a 23 64 65 66 69 6e 65 20 54 43 ?? */.#define TC
afb0: 4c 5f 41 4c 4c 5f 45 56 45 4e 54 53 09 09 28 7e L_ALL_EVENTS..(~
afc0: 54 43 4c 5f 44 4f 4e 54 5f 57 41 49 54 29 0a 0a TCL_DONT_WAIT)..
afd0: 2f 2a 0a 20 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 /*. * The follow
afe0: 69 6e 67 20 73 74 72 75 63 74 75 72 65 20 64 65 ing structure de
aff0: 66 69 6e 65 73 20 61 20 67 65 6e 65 72 69 63 20 fines a generic
b000: 65 76 65 6e 74 20 66 6f 72 20 74 68 65 20 54 63 event for the Tc
b010: 6c 20 65 76 65 6e 74 20 73 79 73 74 65 6d 2e 0a l event system..
b020: 20 2a 20 54 68 65 73 65 20 61 72 65 20 74 68 65 * These are the
b030: 20 74 68 69 6e 67 73 20 74 68 61 74 20 61 72 65 things that are
b040: 20 71 75 65 75 65 64 20 69 6e 20 63 61 6c 6c 73 queued in calls
b050: 20 74 6f 20 54 63 6c 5f 51 75 65 75 65 45 76 65 to Tcl_QueueEve
b060: 6e 74 20 61 6e 64 0a 20 2a 20 73 65 72 76 69 63 nt and. * servic
b070: 65 64 20 6c 61 74 65 72 20 62 79 20 54 63 6c 5f ed later by Tcl_
b080: 44 6f 4f 6e 65 45 76 65 6e 74 2e 20 54 68 65 72 DoOneEvent. Ther
b090: 65 20 63 61 6e 20 62 65 20 6d 61 6e 79 20 64 69 e can be many di
b0a0: 66 66 65 72 65 6e 74 20 6b 69 6e 64 73 20 6f 66 fferent kinds of
b0b0: 0a 20 2a 20 65 76 65 6e 74 73 20 77 69 74 68 20 . * events with
b0c0: 64 69 66 66 65 72 65 6e 74 20 66 69 65 6c 64 73 different fields
b0d0: 2c 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 , corresponding
b0e0: 74 6f 20 77 69 6e 64 6f 77 20 65 76 65 6e 74 73 to window events
b0f0: 2c 20 74 69 6d 65 72 20 65 76 65 6e 74 73 2c 0a , timer events,.
b100: 20 2a 20 65 74 63 2e 20 54 68 65 20 73 74 72 75 * etc. The stru
b110: 63 74 75 72 65 20 66 6f 72 20 61 20 70 61 72 74 cture for a part
b120: 69 63 75 6c 61 72 20 65 76 65 6e 74 20 63 6f 6e icular event con
b130: 73 69 73 74 73 20 6f 66 20 61 20 54 63 6c 5f 45 sists of a Tcl_E
b140: 76 65 6e 74 20 68 65 61 64 65 72 0a 20 2a 20 66 vent header. * f
b150: 6f 6c 6c 6f 77 65 64 20 62 79 20 61 64 64 69 74 ollowed by addit
b160: 69 6f 6e 61 6c 20 69 6e 66 6f 72 6d 61 74 69 6f ional informatio
b170: 6e 20 73 70 65 63 69 66 69 63 20 74 6f 20 74 68 n specific to th
b180: 61 74 20 65 76 65 6e 74 2e 0a 20 2a 2f 0a 0a 73 at event.. */..s
b190: 74 72 75 63 74 20 54 63 6c 5f 45 76 65 6e 74 20 truct Tcl_Event
b1a0: 7b 0a 20 20 20 20 54 63 6c 5f 45 76 65 6e 74 50 {. Tcl_EventP
b1b0: 72 6f 63 20 2a 70 72 6f 63 3b 09 2f 2a 20 46 75 roc *proc;./* Fu
b1c0: 6e 63 74 69 6f 6e 20 74 6f 20 63 61 6c 6c 20 74 nction to call t
b1d0: 6f 20 73 65 72 76 69 63 65 20 74 68 69 73 20 65 o service this e
b1e0: 76 65 6e 74 2e 20 2a 2f 0a 20 20 20 20 73 74 72 vent. */. str
b1f0: 75 63 74 20 54 63 6c 5f 45 76 65 6e 74 20 2a 6e uct Tcl_Event *n
b200: 65 78 74 50 74 72 3b 09 2f 2a 20 4e 65 78 74 20 extPtr;./* Next
b210: 69 6e 20 6c 69 73 74 20 6f 66 20 70 65 6e 64 69 in list of pendi
b220: 6e 67 20 65 76 65 6e 74 73 2c 20 6f 72 20 4e 55 ng events, or NU
b230: 4c 4c 2e 20 2a 2f 0a 7d 3b 0a 0a 2f 2a 0a 20 2a LL. */.};../*. *
b240: 20 50 6f 73 69 74 69 6f 6e 73 20 74 6f 20 70 61 Positions to pa
b250: 73 73 20 74 6f 20 54 63 6c 5f 51 75 65 75 65 45 ss to Tcl_QueueE
b260: 76 65 6e 74 2f 54 63 6c 5f 54 68 72 65 61 64 51 vent/Tcl_ThreadQ
b270: 75 65 75 65 45 76 65 6e 74 3a 0a 20 2a 2f 0a 0a ueueEvent:. */..
b280: 74 79 70 65 64 65 66 20 65 6e 75 6d 20 7b 0a 20 typedef enum {.
b290: 20 20 20 54 43 4c 5f 51 55 45 55 45 5f 54 41 49 TCL_QUEUE_TAI
b2a0: 4c 2c 20 54 43 4c 5f 51 55 45 55 45 5f 48 45 41 L, TCL_QUEUE_HEA
b2b0: 44 2c 20 54 43 4c 5f 51 55 45 55 45 5f 4d 41 52 D, TCL_QUEUE_MAR
b2c0: 4b 2c 0a 20 20 20 20 54 43 4c 5f 51 55 45 55 45 K,. TCL_QUEUE
b2d0: 5f 41 4c 45 52 54 5f 49 46 5f 45 4d 50 54 59 3d _ALERT_IF_EMPTY=
b2e0: 34 0a 7d 20 54 63 6c 5f 51 75 65 75 65 50 6f 73 4.} Tcl_QueuePos
b2f0: 69 74 69 6f 6e 3b 0a 0a 2f 2a 0a 20 2a 20 56 61 ition;../*. * Va
b300: 6c 75 65 73 20 74 6f 20 70 61 73 73 20 74 6f 20 lues to pass to
b310: 54 63 6c 5f 53 65 74 53 65 72 76 69 63 65 4d 6f Tcl_SetServiceMo
b320: 64 65 20 74 6f 20 73 70 65 63 69 66 79 20 74 68 de to specify th
b330: 65 20 62 65 68 61 76 69 6f 72 20 6f 66 20 6e 6f e behavior of no
b340: 74 69 66 69 65 72 0a 20 2a 20 65 76 65 6e 74 20 tifier. * event
b350: 72 6f 75 74 69 6e 65 73 2e 0a 20 2a 2f 0a 0a 23 routines.. */..#
b360: 64 65 66 69 6e 65 20 54 43 4c 5f 53 45 52 56 49 define TCL_SERVI
b370: 43 45 5f 4e 4f 4e 45 20 30 0a 23 64 65 66 69 6e CE_NONE 0.#defin
b380: 65 20 54 43 4c 5f 53 45 52 56 49 43 45 5f 41 4c e TCL_SERVICE_AL
b390: 4c 20 31 0a 0a 2f 2a 0a 20 2a 20 54 68 65 20 66 L 1../*. * The f
b3a0: 6f 6c 6c 6f 77 69 6e 67 20 73 74 72 75 63 74 75 ollowing structu
b3b0: 72 65 20 6b 65 65 70 73 20 69 73 20 75 73 65 64 re keeps is used
b3c0: 20 74 6f 20 68 6f 6c 64 20 61 20 74 69 6d 65 20 to hold a time
b3d0: 76 61 6c 75 65 2c 20 65 69 74 68 65 72 20 61 73 value, either as
b3e0: 20 61 6e 0a 20 2a 20 61 62 73 6f 6c 75 74 65 20 an. * absolute
b3f0: 74 69 6d 65 20 28 74 68 65 20 6e 75 6d 62 65 72 time (the number
b400: 20 6f 66 20 73 65 63 6f 6e 64 73 20 66 72 6f 6d of seconds from
b410: 20 74 68 65 20 65 70 6f 63 68 29 20 6f 72 20 61 the epoch) or a
b420: 73 20 61 6e 20 65 6c 61 70 73 65 64 20 74 69 6d s an elapsed tim
b430: 65 2e 0a 20 2a 20 4f 6e 20 55 6e 69 78 20 73 79 e.. * On Unix sy
b440: 73 74 65 6d 73 20 74 68 65 20 65 70 6f 63 68 20 stems the epoch
b450: 69 73 20 4d 69 64 6e 69 67 68 74 20 4a 61 6e 20 is Midnight Jan
b460: 31 2c 20 31 39 37 30 20 47 4d 54 2e 0a 20 2a 2f 1, 1970 GMT.. */
b470: 0a 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 74 ..typedef struct
b480: 20 54 63 6c 5f 54 69 6d 65 20 7b 0a 20 20 20 20 Tcl_Time {.
b490: 6c 6f 6e 67 20 6c 6f 6e 67 20 73 65 63 3b 09 09 long long sec;..
b4a0: 2f 2a 20 53 65 63 6f 6e 64 73 2e 20 2a 2f 0a 23 /* Seconds. */.#
b4b0: 69 66 20 64 65 66 69 6e 65 64 28 5f 43 59 47 57 if defined(_CYGW
b4c0: 49 4e 5f 29 0a 20 20 20 20 69 6e 74 20 75 73 65 IN_). int use
b4d0: 63 3b 09 09 09 2f 2a 20 4d 69 63 72 6f 73 65 63 c;.../* Microsec
b4e0: 6f 6e 64 73 2e 20 2a 2f 0a 23 65 6c 73 65 0a 20 onds. */.#else.
b4f0: 20 20 20 6c 6f 6e 67 20 75 73 65 63 3b 09 09 09 long usec;...
b500: 2f 2a 20 4d 69 63 72 6f 73 65 63 6f 6e 64 73 2e /* Microseconds.
b510: 20 2a 2f 0a 23 65 6e 64 69 66 0a 7d 20 54 63 6c */.#endif.} Tcl
b520: 5f 54 69 6d 65 3b 0a 0a 74 79 70 65 64 65 66 20 _Time;..typedef
b530: 76 6f 69 64 20 28 54 63 6c 5f 53 65 74 54 69 6d void (Tcl_SetTim
b540: 65 72 50 72 6f 63 29 20 28 63 6f 6e 73 74 20 54 erProc) (const T
b550: 63 6c 5f 54 69 6d 65 20 2a 74 69 6d 65 50 74 72 cl_Time *timePtr
b560: 29 3b 0a 74 79 70 65 64 65 66 20 69 6e 74 20 28 );.typedef int (
b570: 54 63 6c 5f 57 61 69 74 46 6f 72 45 76 65 6e 74 Tcl_WaitForEvent
b580: 50 72 6f 63 29 20 28 63 6f 6e 73 74 20 54 63 6c Proc) (const Tcl
b590: 5f 54 69 6d 65 20 2a 74 69 6d 65 50 74 72 29 3b _Time *timePtr);
b5a0: 0a 0a 2f 2a 0a 20 2a 20 54 49 50 20 23 32 33 33 ../*. * TIP #233
b5b0: 20 28 56 69 72 74 75 61 6c 69 7a 65 64 20 54 69 (Virtualized Ti
b5c0: 6d 65 29 0a 20 2a 20 57 41 52 4e 49 4e 47 3a 20 me). * WARNING:
b5d0: 66 75 6e 63 74 69 6f 6e 61 6c 69 74 79 20 72 65 functionality re
b5e0: 6d 6f 76 65 64 2c 20 63 61 6c 6c 73 20 54 63 6c moved, calls Tcl
b5f0: 5f 50 61 6e 69 63 0a 20 2a 2f 0a 0a 23 69 66 6e _Panic. */..#ifn
b600: 64 65 66 20 54 43 4c 5f 4e 4f 5f 44 45 50 52 45 def TCL_NO_DEPRE
b610: 43 41 54 45 44 0a 74 79 70 65 64 65 66 20 76 6f CATED.typedef vo
b620: 69 64 20 28 54 63 6c 5f 47 65 74 54 69 6d 65 50 id (Tcl_GetTimeP
b630: 72 6f 63 29 20 20 20 28 54 63 6c 5f 54 69 6d 65 roc) (Tcl_Time
b640: 20 2a 74 69 6d 65 62 75 66 2c 20 76 6f 69 64 20 *timebuf, void
b650: 2a 63 6c 69 65 6e 74 44 61 74 61 29 3b 0a 74 79 *clientData);.ty
b660: 70 65 64 65 66 20 76 6f 69 64 20 28 54 63 6c 5f pedef void (Tcl_
b670: 53 63 61 6c 65 54 69 6d 65 50 72 6f 63 29 20 28 ScaleTimeProc) (
b680: 54 63 6c 5f 54 69 6d 65 20 2a 74 69 6d 65 62 75 Tcl_Time *timebu
b690: 66 2c 20 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 f, void *clientD
b6a0: 61 74 61 29 3b 0a 23 65 6e 64 69 66 20 2f 2a 20 ata);.#endif /*
b6b0: 54 43 4c 5f 4e 4f 5f 44 45 50 52 45 43 41 54 45 TCL_NO_DEPRECATE
b6c0: 44 20 2a 2f 0a 0a 2f 2a 0a 20 2a 20 54 49 50 20 D */../*. * TIP
b6d0: 23 37 32 33 20 28 4d 6f 6e 6f 74 6f 6e 69 63 20 #723 (Monotonic
b6e0: 54 69 6d 65 29 0a 20 2a 2f 0a 0a 74 79 70 65 64 Time). */..typed
b6f0: 65 66 20 6c 6f 6e 67 20 6c 6f 6e 67 20 28 54 63 ef long long (Tc
b700: 6c 5f 47 65 74 4d 6f 6e 6f 74 6f 6e 69 63 54 69 l_GetMonotonicTi
b710: 6d 65 50 72 6f 63 29 20 20 20 28 76 6f 69 64 20 meProc) (void
b720: 2a 63 6c 69 65 6e 74 44 61 74 61 29 3b 0a 0a 2f *clientData);../
b730: 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d *. *------------
b740: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
b750: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
b760: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
b770: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
b780: 0a 20 2a 20 42 69 74 73 20 74 6f 20 70 61 73 73 . * Bits to pass
b790: 20 74 6f 20 54 63 6c 5f 43 72 65 61 74 65 46 69 to Tcl_CreateFi
b7a0: 6c 65 48 61 6e 64 6c 65 72 20 61 6e 64 20 54 63 leHandler and Tc
b7b0: 6c 5f 43 72 65 61 74 65 43 68 61 6e 6e 65 6c 48 l_CreateChannelH
b7c0: 61 6e 64 6c 65 72 20 74 6f 0a 20 2a 20 69 6e 64 andler to. * ind
b7d0: 69 63 61 74 65 20 77 68 61 74 20 73 6f 72 74 73 icate what sorts
b7e0: 20 6f 66 20 65 76 65 6e 74 73 20 61 72 65 20 6f of events are o
b7f0: 66 20 69 6e 74 65 72 65 73 74 3a 0a 20 2a 2f 0a f interest:. */.
b800: 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 52 45 41 .#define TCL_REA
b810: 44 41 42 4c 45 09 09 28 31 3c 3c 31 29 0a 23 64 DABLE..(1<<1).#d
b820: 65 66 69 6e 65 20 54 43 4c 5f 57 52 49 54 41 42 efine TCL_WRITAB
b830: 4c 45 09 09 28 31 3c 3c 32 29 0a 23 64 65 66 69 LE..(1<<2).#defi
b840: 6e 65 20 54 43 4c 5f 45 58 43 45 50 54 49 4f 4e ne TCL_EXCEPTION
b850: 09 09 28 31 3c 3c 33 29 0a 0a 2f 2a 0a 20 2a 20 ..(1<<3)../*. *
b860: 46 6c 61 67 20 76 61 6c 75 65 73 20 74 6f 20 70 Flag values to p
b870: 61 73 73 20 74 6f 20 54 63 6c 5f 4f 70 65 6e 43 ass to Tcl_OpenC
b880: 6f 6d 6d 61 6e 64 43 68 61 6e 6e 65 6c 20 74 6f ommandChannel to
b890: 20 69 6e 64 69 63 61 74 65 20 74 68 65 20 64 69 indicate the di
b8a0: 73 70 6f 73 69 74 69 6f 6e 0a 20 2a 20 6f 66 20 sposition. * of
b8b0: 74 68 65 20 73 74 64 69 6f 20 68 61 6e 64 6c 65 the stdio handle
b8c0: 73 2e 20 54 43 4c 5f 53 54 44 49 4e 2c 20 54 43 s. TCL_STDIN, TC
b8d0: 4c 5f 53 54 44 4f 55 54 2c 20 54 43 4c 5f 53 54 L_STDOUT, TCL_ST
b8e0: 44 45 52 52 2c 20 61 72 65 20 61 6c 73 6f 20 75 DERR, are also u
b8f0: 73 65 64 20 69 6e 0a 20 2a 20 54 63 6c 5f 47 65 sed in. * Tcl_Ge
b900: 74 53 74 64 43 68 61 6e 6e 65 6c 2e 0a 20 2a 2f tStdChannel.. */
b910: 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 53 54 ..#define TCL_ST
b920: 44 49 4e 09 09 28 31 3c 3c 31 29 0a 23 64 65 66 DIN..(1<<1).#def
b930: 69 6e 65 20 54 43 4c 5f 53 54 44 4f 55 54 09 09 ine TCL_STDOUT..
b940: 28 31 3c 3c 32 29 0a 23 64 65 66 69 6e 65 20 54 (1<<2).#define T
b950: 43 4c 5f 53 54 44 45 52 52 09 09 28 31 3c 3c 33 CL_STDERR..(1<<3
b960: 29 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 45 4e ).#define TCL_EN
b970: 46 4f 52 43 45 5f 4d 4f 44 45 09 28 31 3c 3c 34 FORCE_MODE.(1<<4
b980: 29 0a 0a 2f 2a 0a 20 2a 20 42 69 74 73 20 70 61 )../*. * Bits pa
b990: 73 73 65 64 20 74 6f 20 54 63 6c 5f 44 72 69 76 ssed to Tcl_Driv
b9a0: 65 72 43 6c 6f 73 65 32 50 72 6f 63 20 74 6f 20 erClose2Proc to
b9b0: 69 6e 64 69 63 61 74 65 20 77 68 69 63 68 20 73 indicate which s
b9c0: 69 64 65 20 6f 66 20 61 20 63 68 61 6e 6e 65 6c ide of a channel
b9d0: 0a 20 2a 20 73 68 6f 75 6c 64 20 62 65 20 63 6c . * should be cl
b9e0: 6f 73 65 64 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 osed.. */..#defi
b9f0: 6e 65 20 54 43 4c 5f 43 4c 4f 53 45 5f 52 45 41 ne TCL_CLOSE_REA
ba00: 44 09 09 28 31 3c 3c 31 29 0a 23 64 65 66 69 6e D..(1<<1).#defin
ba10: 65 20 54 43 4c 5f 43 4c 4f 53 45 5f 57 52 49 54 e TCL_CLOSE_WRIT
ba20: 45 09 09 28 31 3c 3c 32 29 0a 0a 2f 2a 0a 20 2a E..(1<<2)../*. *
ba30: 20 56 61 6c 75 65 20 74 6f 20 75 73 65 20 61 73 Value to use as
ba40: 20 74 68 65 20 63 6c 6f 73 65 50 72 6f 63 20 66 the closeProc f
ba50: 6f 72 20 61 20 63 68 61 6e 6e 65 6c 20 74 68 61 or a channel tha
ba60: 74 20 73 75 70 70 6f 72 74 73 20 74 68 65 20 63 t supports the c
ba70: 6c 6f 73 65 32 50 72 6f 63 0a 20 2a 20 69 6e 74 lose2Proc. * int
ba80: 65 72 66 61 63 65 2e 0a 20 2a 2f 0a 0a 23 64 65 erface.. */..#de
ba90: 66 69 6e 65 20 54 43 4c 5f 43 4c 4f 53 45 32 50 fine TCL_CLOSE2P
baa0: 52 4f 43 09 09 4e 55 4c 4c 0a 0a 2f 2a 0a 20 2a ROC..NULL../*. *
bab0: 20 43 68 61 6e 6e 65 6c 20 76 65 72 73 69 6f 6e Channel version
bac0: 20 74 61 67 2e 20 54 68 69 73 20 77 61 73 20 69 tag. This was i
bad0: 6e 74 72 6f 64 75 63 65 64 20 69 6e 20 38 2e 33 ntroduced in 8.3
bae0: 2e 32 2f 38 2e 34 2e 0a 20 2a 2f 0a 0a 23 64 65 .2/8.4.. */..#de
baf0: 66 69 6e 65 20 54 43 4c 5f 43 48 41 4e 4e 45 4c fine TCL_CHANNEL
bb00: 5f 56 45 52 53 49 4f 4e 5f 35 09 28 28 54 63 6c _VERSION_5.((Tcl
bb10: 5f 43 68 61 6e 6e 65 6c 54 79 70 65 56 65 72 73 _ChannelTypeVers
bb20: 69 6f 6e 29 20 30 78 35 29 0a 0a 2f 2a 0a 20 2a ion) 0x5)../*. *
bb30: 20 54 49 50 20 23 32 31 38 3a 20 43 68 61 6e 6e TIP #218: Chann
bb40: 65 6c 20 41 63 74 69 6f 6e 73 2c 20 49 64 73 20 el Actions, Ids
bb50: 66 6f 72 20 54 63 6c 5f 44 72 69 76 65 72 54 68 for Tcl_DriverTh
bb60: 72 65 61 64 41 63 74 69 6f 6e 50 72 6f 63 2e 0a readActionProc..
bb70: 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c */..#define TCL
bb80: 5f 43 48 41 4e 4e 45 4c 5f 54 48 52 45 41 44 5f _CHANNEL_THREAD_
bb90: 49 4e 53 45 52 54 20 28 30 29 0a 23 64 65 66 69 INSERT (0).#defi
bba0: 6e 65 20 54 43 4c 5f 43 48 41 4e 4e 45 4c 5f 54 ne TCL_CHANNEL_T
bbb0: 48 52 45 41 44 5f 52 45 4d 4f 56 45 20 28 31 29 HREAD_REMOVE (1)
bbc0: 0a 0a 2f 2a 0a 20 2a 20 54 79 70 65 64 65 66 73 ../*. * Typedefs
bbd0: 20 66 6f 72 20 74 68 65 20 76 61 72 69 6f 75 73 for the various
bbe0: 20 6f 70 65 72 61 74 69 6f 6e 73 20 69 6e 20 61 operations in a
bbf0: 20 63 68 61 6e 6e 65 6c 20 74 79 70 65 3a 0a 20 channel type:.
bc00: 2a 2f 0a 0a 74 79 70 65 64 65 66 20 69 6e 74 09 */..typedef int.
bc10: 28 54 63 6c 5f 44 72 69 76 65 72 42 6c 6f 63 6b (Tcl_DriverBlock
bc20: 4d 6f 64 65 50 72 6f 63 29 20 28 76 6f 69 64 20 ModeProc) (void
bc30: 2a 69 6e 73 74 61 6e 63 65 44 61 74 61 2c 20 69 *instanceData, i
bc40: 6e 74 20 6d 6f 64 65 29 3b 0a 74 79 70 65 64 65 nt mode);.typede
bc50: 66 20 76 6f 69 64 20 54 63 6c 5f 44 72 69 76 65 f void Tcl_Drive
bc60: 72 43 6c 6f 73 65 50 72 6f 63 3b 0a 74 79 70 65 rCloseProc;.type
bc70: 64 65 66 20 69 6e 74 09 28 54 63 6c 5f 44 72 69 def int.(Tcl_Dri
bc80: 76 65 72 43 6c 6f 73 65 32 50 72 6f 63 29 20 28 verClose2Proc) (
bc90: 76 6f 69 64 20 2a 69 6e 73 74 61 6e 63 65 44 61 void *instanceDa
bca0: 74 61 2c 0a 09 09 09 54 63 6c 5f 49 6e 74 65 72 ta,....Tcl_Inter
bcb0: 70 20 2a 69 6e 74 65 72 70 2c 20 69 6e 74 20 66 p *interp, int f
bcc0: 6c 61 67 73 29 3b 0a 74 79 70 65 64 65 66 20 69 lags);.typedef i
bcd0: 6e 74 09 28 54 63 6c 5f 44 72 69 76 65 72 49 6e nt.(Tcl_DriverIn
bce0: 70 75 74 50 72 6f 63 29 20 28 76 6f 69 64 20 2a putProc) (void *
bcf0: 69 6e 73 74 61 6e 63 65 44 61 74 61 2c 20 63 68 instanceData, ch
bd00: 61 72 20 2a 62 75 66 2c 0a 09 09 09 69 6e 74 20 ar *buf,....int
bd10: 74 6f 52 65 61 64 2c 20 69 6e 74 20 2a 65 72 72 toRead, int *err
bd20: 6f 72 43 6f 64 65 50 74 72 29 3b 0a 74 79 70 65 orCodePtr);.type
bd30: 64 65 66 20 69 6e 74 09 28 54 63 6c 5f 44 72 69 def int.(Tcl_Dri
bd40: 76 65 72 4f 75 74 70 75 74 50 72 6f 63 29 20 28 verOutputProc) (
bd50: 76 6f 69 64 20 2a 69 6e 73 74 61 6e 63 65 44 61 void *instanceDa
bd60: 74 61 2c 0a 09 09 09 63 6f 6e 73 74 20 63 68 61 ta,....const cha
bd70: 72 20 2a 62 75 66 2c 20 69 6e 74 20 74 6f 57 72 r *buf, int toWr
bd80: 69 74 65 2c 20 69 6e 74 20 2a 65 72 72 6f 72 43 ite, int *errorC
bd90: 6f 64 65 50 74 72 29 3b 0a 74 79 70 65 64 65 66 odePtr);.typedef
bda0: 20 76 6f 69 64 20 54 63 6c 5f 44 72 69 76 65 72 void Tcl_Driver
bdb0: 53 65 65 6b 50 72 6f 63 3b 0a 74 79 70 65 64 65 SeekProc;.typede
bdc0: 66 20 69 6e 74 09 28 54 63 6c 5f 44 72 69 76 65 f int.(Tcl_Drive
bdd0: 72 53 65 74 4f 70 74 69 6f 6e 50 72 6f 63 29 20 rSetOptionProc)
bde0: 28 76 6f 69 64 20 2a 69 6e 73 74 61 6e 63 65 44 (void *instanceD
bdf0: 61 74 61 2c 0a 09 09 09 54 63 6c 5f 49 6e 74 65 ata,....Tcl_Inte
be00: 72 70 20 2a 69 6e 74 65 72 70 2c 20 63 6f 6e 73 rp *interp, cons
be10: 74 20 63 68 61 72 20 2a 6f 70 74 69 6f 6e 4e 61 t char *optionNa
be20: 6d 65 2c 0a 09 09 09 63 6f 6e 73 74 20 63 68 61 me,....const cha
be30: 72 20 2a 76 61 6c 75 65 29 3b 0a 74 79 70 65 64 r *value);.typed
be40: 65 66 20 69 6e 74 09 28 54 63 6c 5f 44 72 69 76 ef int.(Tcl_Driv
be50: 65 72 47 65 74 4f 70 74 69 6f 6e 50 72 6f 63 29 erGetOptionProc)
be60: 20 28 76 6f 69 64 20 2a 69 6e 73 74 61 6e 63 65 (void *instance
be70: 44 61 74 61 2c 0a 09 09 09 54 63 6c 5f 49 6e 74 Data,....Tcl_Int
be80: 65 72 70 20 2a 69 6e 74 65 72 70 2c 20 63 6f 6e erp *interp, con
be90: 73 74 20 63 68 61 72 20 2a 6f 70 74 69 6f 6e 4e st char *optionN
bea0: 61 6d 65 2c 0a 09 09 09 54 63 6c 5f 44 53 74 72 ame,....Tcl_DStr
beb0: 69 6e 67 20 2a 64 73 50 74 72 29 3b 0a 74 79 70 ing *dsPtr);.typ
bec0: 65 64 65 66 20 76 6f 69 64 09 28 54 63 6c 5f 44 edef void.(Tcl_D
bed0: 72 69 76 65 72 57 61 74 63 68 50 72 6f 63 29 20 riverWatchProc)
bee0: 28 76 6f 69 64 20 2a 69 6e 73 74 61 6e 63 65 44 (void *instanceD
bef0: 61 74 61 2c 20 69 6e 74 20 6d 61 73 6b 29 3b 0a ata, int mask);.
bf00: 74 79 70 65 64 65 66 20 69 6e 74 09 28 54 63 6c typedef int.(Tcl
bf10: 5f 44 72 69 76 65 72 47 65 74 48 61 6e 64 6c 65 _DriverGetHandle
bf20: 50 72 6f 63 29 20 28 76 6f 69 64 20 2a 69 6e 73 Proc) (void *ins
bf30: 74 61 6e 63 65 44 61 74 61 2c 0a 09 09 09 69 6e tanceData,....in
bf40: 74 20 64 69 72 65 63 74 69 6f 6e 2c 20 76 6f 69 t direction, voi
bf50: 64 20 2a 2a 68 61 6e 64 6c 65 50 74 72 29 3b 0a d **handlePtr);.
bf60: 74 79 70 65 64 65 66 20 69 6e 74 09 28 54 63 6c typedef int.(Tcl
bf70: 5f 44 72 69 76 65 72 46 6c 75 73 68 50 72 6f 63 _DriverFlushProc
bf80: 29 20 28 76 6f 69 64 20 2a 69 6e 73 74 61 6e 63 ) (void *instanc
bf90: 65 44 61 74 61 29 3b 0a 74 79 70 65 64 65 66 20 eData);.typedef
bfa0: 69 6e 74 09 28 54 63 6c 5f 44 72 69 76 65 72 48 int.(Tcl_DriverH
bfb0: 61 6e 64 6c 65 72 50 72 6f 63 29 20 28 76 6f 69 andlerProc) (voi
bfc0: 64 20 2a 69 6e 73 74 61 6e 63 65 44 61 74 61 2c d *instanceData,
bfd0: 0a 09 09 09 69 6e 74 20 69 6e 74 65 72 65 73 74 ....int interest
bfe0: 4d 61 73 6b 29 3b 0a 74 79 70 65 64 65 66 20 6c Mask);.typedef l
bff0: 6f 6e 67 20 6c 6f 6e 67 20 28 54 63 6c 5f 44 72 ong long (Tcl_Dr
c000: 69 76 65 72 57 69 64 65 53 65 65 6b 50 72 6f 63 iverWideSeekProc
c010: 29 20 28 76 6f 69 64 20 2a 69 6e 73 74 61 6e 63 ) (void *instanc
c020: 65 44 61 74 61 2c 0a 09 09 09 6c 6f 6e 67 20 6c eData,....long l
c030: 6f 6e 67 20 6f 66 66 73 65 74 2c 20 69 6e 74 20 ong offset, int
c040: 6d 6f 64 65 2c 20 69 6e 74 20 2a 65 72 72 6f 72 mode, int *error
c050: 43 6f 64 65 50 74 72 29 3b 0a 2f 2a 0a 20 2a 20 CodePtr);./*. *
c060: 54 49 50 20 23 32 31 38 2c 20 43 68 61 6e 6e 65 TIP #218, Channe
c070: 6c 20 54 68 72 65 61 64 20 41 63 74 69 6f 6e 73 l Thread Actions
c080: 0a 20 2a 2f 0a 74 79 70 65 64 65 66 20 76 6f 69 . */.typedef voi
c090: 64 09 28 54 63 6c 5f 44 72 69 76 65 72 54 68 72 d.(Tcl_DriverThr
c0a0: 65 61 64 41 63 74 69 6f 6e 50 72 6f 63 29 20 28 eadActionProc) (
c0b0: 76 6f 69 64 20 2a 69 6e 73 74 61 6e 63 65 44 61 void *instanceDa
c0c0: 74 61 2c 0a 09 09 09 69 6e 74 20 61 63 74 69 6f ta,....int actio
c0d0: 6e 29 3b 0a 2f 2a 0a 20 2a 20 54 49 50 20 23 32 n);./*. * TIP #2
c0e0: 30 38 2c 20 46 69 6c 65 20 54 72 75 6e 63 61 74 08, File Truncat
c0f0: 69 6f 6e 20 28 65 74 63 2e 29 0a 20 2a 2f 0a 74 ion (etc.). */.t
c100: 79 70 65 64 65 66 20 69 6e 74 09 28 54 63 6c 5f ypedef int.(Tcl_
c110: 44 72 69 76 65 72 54 72 75 6e 63 61 74 65 50 72 DriverTruncatePr
c120: 6f 63 29 20 28 76 6f 69 64 20 2a 69 6e 73 74 61 oc) (void *insta
c130: 6e 63 65 44 61 74 61 2c 0a 09 09 09 6c 6f 6e 67 nceData,....long
c140: 20 6c 6f 6e 67 20 6c 65 6e 67 74 68 29 3b 0a 0a long length);..
c150: 2f 2a 0a 20 2a 20 73 74 72 75 63 74 20 54 63 6c /*. * struct Tcl
c160: 5f 43 68 61 6e 6e 65 6c 54 79 70 65 3a 0a 20 2a _ChannelType:. *
c170: 0a 20 2a 20 4f 6e 65 20 73 75 63 68 20 73 74 72 . * One such str
c180: 75 63 74 75 72 65 20 65 78 69 73 74 73 20 66 6f ucture exists fo
c190: 72 20 65 61 63 68 20 74 79 70 65 20 28 6b 69 6e r each type (kin
c1a0: 64 29 20 6f 66 20 63 68 61 6e 6e 65 6c 2e 20 49 d) of channel. I
c1b0: 74 20 63 6f 6c 6c 65 63 74 73 0a 20 2a 20 74 6f t collects. * to
c1c0: 67 65 74 68 65 72 20 69 6e 20 6f 6e 65 20 70 6c gether in one pl
c1d0: 61 63 65 20 61 6c 6c 20 74 68 65 20 66 75 6e 63 ace all the func
c1e0: 74 69 6f 6e 73 20 74 68 61 74 20 61 72 65 20 70 tions that are p
c1f0: 61 72 74 20 6f 66 20 74 68 65 20 73 70 65 63 69 art of the speci
c200: 66 69 63 0a 20 2a 20 63 68 61 6e 6e 65 6c 20 74 fic. * channel t
c210: 79 70 65 2e 0a 20 2a 0a 20 2a 20 49 74 20 69 73 ype.. *. * It is
c220: 20 72 65 63 6f 6d 6d 65 6e 64 20 74 68 61 74 20 recommend that
c230: 74 68 65 20 54 63 6c 5f 43 68 61 6e 6e 65 6c 2a the Tcl_Channel*
c240: 20 66 75 6e 63 74 69 6f 6e 73 20 61 72 65 20 75 functions are u
c250: 73 65 64 20 74 6f 20 61 63 63 65 73 73 20 65 6c sed to access el
c260: 65 6d 65 6e 74 73 0a 20 2a 20 6f 66 20 74 68 69 ements. * of thi
c270: 73 20 73 74 72 75 63 74 75 72 65 2c 20 69 6e 73 s structure, ins
c280: 74 65 61 64 20 6f 66 20 64 69 72 65 63 74 20 61 tead of direct a
c290: 63 63 65 73 73 69 6e 67 2e 0a 20 2a 2f 0a 0a 74 ccessing.. */..t
c2a0: 79 70 65 64 65 66 20 73 74 72 75 63 74 20 54 63 ypedef struct Tc
c2b0: 6c 5f 43 68 61 6e 6e 65 6c 54 79 70 65 20 7b 0a l_ChannelType {.
c2c0: 20 20 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a const char *
c2d0: 74 79 70 65 4e 61 6d 65 3b 09 2f 2a 20 54 68 65 typeName;./* The
c2e0: 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 63 68 61 name of the cha
c2f0: 6e 6e 65 6c 20 74 79 70 65 20 69 6e 20 54 63 6c nnel type in Tcl
c300: 0a 09 09 09 09 20 2a 20 63 6f 6d 6d 61 6e 64 73 ..... * commands
c310: 2e 20 54 68 69 73 20 73 74 6f 72 61 67 65 20 69 . This storage i
c320: 73 20 6f 77 6e 65 64 20 62 79 20 63 68 61 6e 6e s owned by chann
c330: 65 6c 0a 09 09 09 09 20 2a 20 74 79 70 65 2e 20 el..... * type.
c340: 2a 2f 0a 20 20 20 20 54 63 6c 5f 43 68 61 6e 6e */. Tcl_Chann
c350: 65 6c 54 79 70 65 56 65 72 73 69 6f 6e 20 76 65 elTypeVersion ve
c360: 72 73 69 6f 6e 3b 0a 09 09 09 09 2f 2a 20 56 65 rsion;...../* Ve
c370: 72 73 69 6f 6e 20 6f 66 20 74 68 65 20 63 68 61 rsion of the cha
c380: 6e 6e 65 6c 20 74 79 70 65 2e 20 2a 2f 0a 20 20 nnel type. */.
c390: 20 20 76 6f 69 64 20 2a 63 6c 6f 73 65 50 72 6f void *closePro
c3a0: 63 3b 09 09 2f 2a 20 4e 6f 74 20 75 73 65 64 20 c;../* Not used
c3b0: 61 6e 79 20 6d 6f 72 65 2e 20 2a 2f 0a 20 20 20 any more. */.
c3c0: 20 54 63 6c 5f 44 72 69 76 65 72 49 6e 70 75 74 Tcl_DriverInput
c3d0: 50 72 6f 63 20 2a 69 6e 70 75 74 50 72 6f 63 3b Proc *inputProc;
c3e0: 0a 09 09 09 09 2f 2a 20 46 75 6e 63 74 69 6f 6e ...../* Function
c3f0: 20 74 6f 20 63 61 6c 6c 20 66 6f 72 20 69 6e 70 to call for inp
c400: 75 74 20 6f 6e 20 63 68 61 6e 6e 65 6c 2e 20 2a ut on channel. *
c410: 2f 0a 20 20 20 20 54 63 6c 5f 44 72 69 76 65 72 /. Tcl_Driver
c420: 4f 75 74 70 75 74 50 72 6f 63 20 2a 6f 75 74 70 OutputProc *outp
c430: 75 74 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 46 utProc;...../* F
c440: 75 6e 63 74 69 6f 6e 20 74 6f 20 63 61 6c 6c 20 unction to call
c450: 66 6f 72 20 6f 75 74 70 75 74 20 6f 6e 20 63 68 for output on ch
c460: 61 6e 6e 65 6c 2e 20 2a 2f 0a 20 20 20 20 76 6f annel. */. vo
c470: 69 64 20 2a 73 65 65 6b 50 72 6f 63 3b 09 09 2f id *seekProc;../
c480: 2a 20 4e 6f 74 20 75 73 65 64 20 61 6e 79 20 6d * Not used any m
c490: 6f 72 65 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f ore. */. Tcl_
c4a0: 44 72 69 76 65 72 53 65 74 4f 70 74 69 6f 6e 50 DriverSetOptionP
c4b0: 72 6f 63 20 2a 73 65 74 4f 70 74 69 6f 6e 50 72 roc *setOptionPr
c4c0: 6f 63 3b 0a 09 09 09 09 2f 2a 20 53 65 74 20 61 oc;...../* Set a
c4d0: 6e 20 6f 70 74 69 6f 6e 20 6f 6e 20 61 20 63 68 n option on a ch
c4e0: 61 6e 6e 65 6c 2e 20 2a 2f 0a 20 20 20 20 54 63 annel. */. Tc
c4f0: 6c 5f 44 72 69 76 65 72 47 65 74 4f 70 74 69 6f l_DriverGetOptio
c500: 6e 50 72 6f 63 20 2a 67 65 74 4f 70 74 69 6f 6e nProc *getOption
c510: 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 47 65 74 Proc;...../* Get
c520: 20 61 6e 20 6f 70 74 69 6f 6e 20 66 72 6f 6d 20 an option from
c530: 61 20 63 68 61 6e 6e 65 6c 2e 20 2a 2f 0a 20 20 a channel. */.
c540: 20 20 54 63 6c 5f 44 72 69 76 65 72 57 61 74 63 Tcl_DriverWatc
c550: 68 50 72 6f 63 20 2a 77 61 74 63 68 50 72 6f 63 hProc *watchProc
c560: 3b 0a 09 09 09 09 2f 2a 20 53 65 74 20 75 70 20 ;...../* Set up
c570: 74 68 65 20 6e 6f 74 69 66 69 65 72 20 74 6f 20 the notifier to
c580: 77 61 74 63 68 20 66 6f 72 20 65 76 65 6e 74 73 watch for events
c590: 20 6f 6e 0a 09 09 09 09 20 2a 20 74 68 69 73 20 on..... * this
c5a0: 63 68 61 6e 6e 65 6c 2e 20 2a 2f 0a 20 20 20 20 channel. */.
c5b0: 54 63 6c 5f 44 72 69 76 65 72 47 65 74 48 61 6e Tcl_DriverGetHan
c5c0: 64 6c 65 50 72 6f 63 20 2a 67 65 74 48 61 6e 64 dleProc *getHand
c5d0: 6c 65 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 47 leProc;...../* G
c5e0: 65 74 20 61 6e 20 4f 53 20 68 61 6e 64 6c 65 20 et an OS handle
c5f0: 66 72 6f 6d 20 74 68 65 20 63 68 61 6e 6e 65 6c from the channel
c600: 20 6f 72 20 4e 55 4c 4c 0a 09 09 09 09 20 2a 20 or NULL..... *
c610: 69 66 20 6e 6f 74 20 73 75 70 70 6f 72 74 65 64 if not supported
c620: 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 44 72 69 . */. Tcl_Dri
c630: 76 65 72 43 6c 6f 73 65 32 50 72 6f 63 20 2a 63 verClose2Proc *c
c640: 6c 6f 73 65 32 50 72 6f 63 3b 0a 09 09 09 09 2f lose2Proc;...../
c650: 2a 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 63 61 * Function to ca
c660: 6c 6c 20 74 6f 20 63 6c 6f 73 65 20 74 68 65 20 ll to close the
c670: 63 68 61 6e 6e 65 6c 20 69 66 0a 09 09 09 09 20 channel if.....
c680: 2a 20 74 68 65 20 64 65 76 69 63 65 20 73 75 70 * the device sup
c690: 70 6f 72 74 73 20 63 6c 6f 73 69 6e 67 20 74 68 ports closing th
c6a0: 65 20 72 65 61 64 20 26 0a 09 09 09 09 20 2a 20 e read &..... *
c6b0: 77 72 69 74 65 20 73 69 64 65 73 20 69 6e 64 65 write sides inde
c6c0: 70 65 6e 64 65 6e 74 6c 79 2e 20 2a 2f 0a 20 20 pendently. */.
c6d0: 20 20 54 63 6c 5f 44 72 69 76 65 72 42 6c 6f 63 Tcl_DriverBloc
c6e0: 6b 4d 6f 64 65 50 72 6f 63 20 2a 62 6c 6f 63 6b kModeProc *block
c6f0: 4d 6f 64 65 50 72 6f 63 3b 0a 09 09 09 09 2f 2a ModeProc;...../*
c700: 20 53 65 74 20 62 6c 6f 63 6b 69 6e 67 20 6d 6f Set blocking mo
c710: 64 65 20 66 6f 72 20 74 68 65 20 72 61 77 20 63 de for the raw c
c720: 68 61 6e 6e 65 6c 2e 20 4d 61 79 0a 09 09 09 09 hannel. May.....
c730: 20 2a 20 62 65 20 4e 55 4c 4c 2e 20 2a 2f 0a 20 * be NULL. */.
c740: 20 20 20 54 63 6c 5f 44 72 69 76 65 72 46 6c 75 Tcl_DriverFlu
c750: 73 68 50 72 6f 63 20 2a 66 6c 75 73 68 50 72 6f shProc *flushPro
c760: 63 3b 0a 09 09 09 09 2f 2a 20 46 75 6e 63 74 69 c;...../* Functi
c770: 6f 6e 20 74 6f 20 63 61 6c 6c 20 74 6f 20 66 6c on to call to fl
c780: 75 73 68 20 61 20 63 68 61 6e 6e 65 6c 2e 20 4d ush a channel. M
c790: 61 79 20 62 65 0a 09 09 09 09 20 2a 20 4e 55 4c ay be..... * NUL
c7a0: 4c 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 44 72 L. */. Tcl_Dr
c7b0: 69 76 65 72 48 61 6e 64 6c 65 72 50 72 6f 63 20 iverHandlerProc
c7c0: 2a 68 61 6e 64 6c 65 72 50 72 6f 63 3b 0a 09 09 *handlerProc;...
c7d0: 09 09 2f 2a 20 46 75 6e 63 74 69 6f 6e 20 74 6f ../* Function to
c7e0: 20 63 61 6c 6c 20 74 6f 20 68 61 6e 64 6c 65 20 call to handle
c7f0: 61 20 63 68 61 6e 6e 65 6c 20 65 76 65 6e 74 2e a channel event.
c800: 0a 09 09 09 09 20 2a 20 54 68 69 73 20 77 69 6c ..... * This wil
c810: 6c 20 62 65 20 70 61 73 73 65 64 20 75 70 20 74 l be passed up t
c820: 68 65 20 73 74 61 63 6b 65 64 20 63 68 61 6e 6e he stacked chann
c830: 65 6c 0a 09 09 09 09 20 2a 20 63 68 61 69 6e 2e el..... * chain.
c840: 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 44 72 69 76 */. Tcl_Driv
c850: 65 72 57 69 64 65 53 65 65 6b 50 72 6f 63 20 2a erWideSeekProc *
c860: 77 69 64 65 53 65 65 6b 50 72 6f 63 3b 0a 09 09 wideSeekProc;...
c870: 09 09 2f 2a 20 46 75 6e 63 74 69 6f 6e 20 74 6f ../* Function to
c880: 20 63 61 6c 6c 20 74 6f 20 73 65 65 6b 20 6f 6e call to seek on
c890: 20 74 68 65 20 63 68 61 6e 6e 65 6c 0a 09 09 09 the channel....
c8a0: 09 20 2a 20 77 68 69 63 68 20 63 61 6e 20 68 61 . * which can ha
c8b0: 6e 64 6c 65 20 36 34 2d 62 69 74 20 6f 66 66 73 ndle 64-bit offs
c8c0: 65 74 73 2e 20 4d 61 79 20 62 65 0a 09 09 09 09 ets. May be.....
c8d0: 20 2a 20 4e 55 4c 4c 2c 20 61 6e 64 20 6d 75 73 * NULL, and mus
c8e0: 74 20 62 65 20 4e 55 4c 4c 20 69 66 20 73 65 65 t be NULL if see
c8f0: 6b 50 72 6f 63 20 69 73 0a 09 09 09 09 20 2a 20 kProc is..... *
c900: 4e 55 4c 4c 2e 20 2a 2f 0a 20 20 20 20 54 63 6c NULL. */. Tcl
c910: 5f 44 72 69 76 65 72 54 68 72 65 61 64 41 63 74 _DriverThreadAct
c920: 69 6f 6e 50 72 6f 63 20 2a 74 68 72 65 61 64 41 ionProc *threadA
c930: 63 74 69 6f 6e 50 72 6f 63 3b 0a 09 09 09 09 2f ctionProc;...../
c940: 2a 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 63 61 * Function to ca
c950: 6c 6c 20 74 6f 20 6e 6f 74 69 66 79 20 74 68 65 ll to notify the
c960: 20 64 72 69 76 65 72 20 6f 66 0a 09 09 09 09 20 driver of.....
c970: 2a 20 74 68 72 65 61 64 20 73 70 65 63 69 66 69 * thread specifi
c980: 63 20 61 63 74 69 76 69 74 79 20 66 6f 72 20 61 c activity for a
c990: 20 63 68 61 6e 6e 65 6c 2e 20 4d 61 79 0a 09 09 channel. May...
c9a0: 09 09 20 2a 20 62 65 20 4e 55 4c 4c 2e 20 2a 2f .. * be NULL. */
c9b0: 0a 20 20 20 20 54 63 6c 5f 44 72 69 76 65 72 54 . Tcl_DriverT
c9c0: 72 75 6e 63 61 74 65 50 72 6f 63 20 2a 74 72 75 runcateProc *tru
c9d0: 6e 63 61 74 65 50 72 6f 63 3b 0a 09 09 09 09 2f ncateProc;...../
c9e0: 2a 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 63 61 * Function to ca
c9f0: 6c 6c 20 74 6f 20 74 72 75 6e 63 61 74 65 20 74 ll to truncate t
ca00: 68 65 20 75 6e 64 65 72 6c 79 69 6e 67 0a 09 09 he underlying...
ca10: 09 09 20 2a 20 66 69 6c 65 20 74 6f 20 61 20 70 .. * file to a p
ca20: 61 72 74 69 63 75 6c 61 72 20 6c 65 6e 67 74 68 articular length
ca30: 2e 20 4d 61 79 20 62 65 20 4e 55 4c 4c 20 69 66 . May be NULL if
ca40: 0a 09 09 09 09 20 2a 20 74 68 65 20 63 68 61 6e ..... * the chan
ca50: 6e 65 6c 20 64 6f 65 73 20 6e 6f 74 20 73 75 70 nel does not sup
ca60: 70 6f 72 74 20 74 72 75 6e 63 61 74 69 6f 6e 2e port truncation.
ca70: 20 2a 2f 0a 7d 20 54 63 6c 5f 43 68 61 6e 6e 65 */.} Tcl_Channe
ca80: 6c 54 79 70 65 3b 0a 0a 2f 2a 0a 20 2a 20 54 68 lType;../*. * Th
ca90: 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 66 6c 61 67 e following flag
caa0: 73 20 64 65 74 65 72 6d 69 6e 65 20 77 68 65 74 s determine whet
cab0: 68 65 72 20 74 68 65 20 62 6c 6f 63 6b 4d 6f 64 her the blockMod
cac0: 65 50 72 6f 63 20 61 62 6f 76 65 20 73 68 6f 75 eProc above shou
cad0: 6c 64 20 73 65 74 0a 20 2a 20 74 68 65 20 63 68 ld set. * the ch
cae0: 61 6e 6e 65 6c 20 69 6e 74 6f 20 62 6c 6f 63 6b annel into block
caf0: 69 6e 67 20 6f 72 20 6e 6f 6e 62 6c 6f 63 6b 69 ing or nonblocki
cb00: 6e 67 20 6d 6f 64 65 2e 20 54 68 65 79 20 61 72 ng mode. They ar
cb10: 65 20 70 61 73 73 65 64 20 61 73 20 61 72 67 75 e passed as argu
cb20: 6d 65 6e 74 73 0a 20 2a 20 74 6f 20 74 68 65 20 ments. * to the
cb30: 62 6c 6f 63 6b 4d 6f 64 65 50 72 6f 63 20 66 75 blockModeProc fu
cb40: 6e 63 74 69 6f 6e 20 69 6e 20 74 68 65 20 61 62 nction in the ab
cb50: 6f 76 65 20 73 74 72 75 63 74 75 72 65 2e 0a 20 ove structure..
cb60: 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f */..#define TCL_
cb70: 4d 4f 44 45 5f 42 4c 4f 43 4b 49 4e 47 09 30 09 MODE_BLOCKING.0.
cb80: 2f 2a 20 50 75 74 20 63 68 61 6e 6e 65 6c 20 69 /* Put channel i
cb90: 6e 74 6f 20 62 6c 6f 63 6b 69 6e 67 20 6d 6f 64 nto blocking mod
cba0: 65 2e 20 2a 2f 0a 23 64 65 66 69 6e 65 20 54 43 e. */.#define TC
cbb0: 4c 5f 4d 4f 44 45 5f 4e 4f 4e 42 4c 4f 43 4b 49 L_MODE_NONBLOCKI
cbc0: 4e 47 09 31 09 2f 2a 20 50 75 74 20 63 68 61 6e NG.1./* Put chan
cbd0: 6e 65 6c 20 69 6e 74 6f 20 6e 6f 6e 62 6c 6f 63 nel into nonbloc
cbe0: 6b 69 6e 67 0a 09 09 09 09 09 20 2a 20 6d 6f 64 king...... * mod
cbf0: 65 2e 20 2a 2f 0a 0a 2f 2a 0a 20 2a 2d 2d 2d 2d e. */../*. *----
cc00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
cc10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
cc20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
cc30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
cc40: 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 45 6e 75 6d --------. * Enum
cc50: 20 66 6f 72 20 64 69 66 66 65 72 65 6e 74 20 74 for different t
cc60: 79 70 65 73 20 6f 66 20 66 69 6c 65 20 70 61 74 ypes of file pat
cc70: 68 73 2e 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 66 hs.. */..typedef
cc80: 20 65 6e 75 6d 20 54 63 6c 5f 50 61 74 68 54 79 enum Tcl_PathTy
cc90: 70 65 20 7b 0a 20 20 20 20 54 43 4c 5f 50 41 54 pe {. TCL_PAT
cca0: 48 5f 41 42 53 4f 4c 55 54 45 2c 0a 20 20 20 20 H_ABSOLUTE,.
ccb0: 54 43 4c 5f 50 41 54 48 5f 52 45 4c 41 54 49 56 TCL_PATH_RELATIV
ccc0: 45 2c 0a 20 20 20 20 54 43 4c 5f 50 41 54 48 5f E,. TCL_PATH_
ccd0: 56 4f 4c 55 4d 45 5f 52 45 4c 41 54 49 56 45 0a VOLUME_RELATIVE.
cce0: 7d 20 54 63 6c 5f 50 61 74 68 54 79 70 65 3b 0a } Tcl_PathType;.
ccf0: 0a 2f 2a 0a 20 2a 20 54 68 65 20 66 6f 6c 6c 6f ./*. * The follo
cd00: 77 69 6e 67 20 73 74 72 75 63 74 75 72 65 20 69 wing structure i
cd10: 73 20 75 73 65 64 20 74 6f 20 70 61 73 73 20 67 s used to pass g
cd20: 6c 6f 62 20 74 79 70 65 20 64 61 74 61 20 61 6d lob type data am
cd30: 6f 6e 67 73 74 20 74 68 65 20 76 61 72 69 6f 75 ongst the variou
cd40: 73 0a 20 2a 20 67 6c 6f 62 20 72 6f 75 74 69 6e s. * glob routin
cd50: 65 73 20 61 6e 64 20 54 63 6c 5f 46 53 4d 61 74 es and Tcl_FSMat
cd60: 63 68 49 6e 44 69 72 65 63 74 6f 72 79 2e 0a 20 chInDirectory..
cd70: 2a 2f 0a 0a 74 79 70 65 64 65 66 20 73 74 72 75 */..typedef stru
cd80: 63 74 20 54 63 6c 5f 47 6c 6f 62 54 79 70 65 44 ct Tcl_GlobTypeD
cd90: 61 74 61 20 7b 0a 20 20 20 20 69 6e 74 20 74 79 ata {. int ty
cda0: 70 65 3b 09 09 09 2f 2a 20 43 6f 72 72 65 73 70 pe;.../* Corresp
cdb0: 6f 6e 64 73 20 74 6f 20 62 63 64 70 66 6c 73 20 onds to bcdpfls
cdc0: 61 73 20 69 6e 20 27 66 69 6e 64 20 2d 74 27 2e as in 'find -t'.
cdd0: 20 2a 2f 0a 20 20 20 20 69 6e 74 20 70 65 72 6d */. int perm
cde0: 3b 09 09 09 2f 2a 20 43 6f 72 72 65 73 70 6f 6e ;.../* Correspon
cdf0: 64 73 20 74 6f 20 66 69 6c 65 20 70 65 72 6d 69 ds to file permi
ce00: 73 73 69 6f 6e 73 2e 20 2a 2f 0a 20 20 20 20 54 ssions. */. T
ce10: 63 6c 5f 4f 62 6a 20 2a 6d 61 63 54 79 70 65 3b cl_Obj *macType;
ce20: 09 09 2f 2a 20 41 63 63 65 70 74 61 62 6c 65 20 ../* Acceptable
ce30: 4d 61 63 20 74 79 70 65 2e 20 2a 2f 0a 20 20 20 Mac type. */.
ce40: 20 54 63 6c 5f 4f 62 6a 20 2a 6d 61 63 43 72 65 Tcl_Obj *macCre
ce50: 61 74 6f 72 3b 09 2f 2a 20 41 63 63 65 70 74 61 ator;./* Accepta
ce60: 62 6c 65 20 4d 61 63 20 63 72 65 61 74 6f 72 2e ble Mac creator.
ce70: 20 2a 2f 0a 7d 20 54 63 6c 5f 47 6c 6f 62 54 79 */.} Tcl_GlobTy
ce80: 70 65 44 61 74 61 3b 0a 0a 2f 2a 0a 20 2a 20 54 peData;../*. * T
ce90: 79 70 65 20 61 6e 64 20 70 65 72 6d 69 73 73 69 ype and permissi
cea0: 6f 6e 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 66 on definitions f
ceb0: 6f 72 20 67 6c 6f 62 20 63 6f 6d 6d 61 6e 64 2e or glob command.
cec0: 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 . */..#define TC
ced0: 4c 5f 47 4c 4f 42 5f 54 59 50 45 5f 42 4c 4f 43 L_GLOB_TYPE_BLOC
cee0: 4b 09 09 28 31 3c 3c 30 29 0a 23 64 65 66 69 6e K..(1<<0).#defin
cef0: 65 20 54 43 4c 5f 47 4c 4f 42 5f 54 59 50 45 5f e TCL_GLOB_TYPE_
cf00: 43 48 41 52 09 09 28 31 3c 3c 31 29 0a 23 64 65 CHAR..(1<<1).#de
cf10: 66 69 6e 65 20 54 43 4c 5f 47 4c 4f 42 5f 54 59 fine TCL_GLOB_TY
cf20: 50 45 5f 44 49 52 09 09 28 31 3c 3c 32 29 0a 23 PE_DIR..(1<<2).#
cf30: 64 65 66 69 6e 65 20 54 43 4c 5f 47 4c 4f 42 5f define TCL_GLOB_
cf40: 54 59 50 45 5f 50 49 50 45 09 09 28 31 3c 3c 33 TYPE_PIPE..(1<<3
cf50: 29 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 47 4c ).#define TCL_GL
cf60: 4f 42 5f 54 59 50 45 5f 46 49 4c 45 09 09 28 31 OB_TYPE_FILE..(1
cf70: 3c 3c 34 29 0a 23 64 65 66 69 6e 65 20 54 43 4c <<4).#define TCL
cf80: 5f 47 4c 4f 42 5f 54 59 50 45 5f 4c 49 4e 4b 09 _GLOB_TYPE_LINK.
cf90: 09 28 31 3c 3c 35 29 0a 23 64 65 66 69 6e 65 20 .(1<<5).#define
cfa0: 54 43 4c 5f 47 4c 4f 42 5f 54 59 50 45 5f 53 4f TCL_GLOB_TYPE_SO
cfb0: 43 4b 09 09 28 31 3c 3c 36 29 0a 23 64 65 66 69 CK..(1<<6).#defi
cfc0: 6e 65 20 54 43 4c 5f 47 4c 4f 42 5f 54 59 50 45 ne TCL_GLOB_TYPE
cfd0: 5f 4d 4f 55 4e 54 09 09 28 31 3c 3c 37 29 0a 0a _MOUNT..(1<<7)..
cfe0: 23 64 65 66 69 6e 65 20 54 43 4c 5f 47 4c 4f 42 #define TCL_GLOB
cff0: 5f 50 45 52 4d 5f 52 4f 4e 4c 59 09 09 28 31 3c _PERM_RONLY..(1<
d000: 3c 30 29 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f <0).#define TCL_
d010: 47 4c 4f 42 5f 50 45 52 4d 5f 48 49 44 44 45 4e GLOB_PERM_HIDDEN
d020: 09 09 28 31 3c 3c 31 29 0a 23 64 65 66 69 6e 65 ..(1<<1).#define
d030: 20 54 43 4c 5f 47 4c 4f 42 5f 50 45 52 4d 5f 52 TCL_GLOB_PERM_R
d040: 09 09 09 28 31 3c 3c 32 29 0a 23 64 65 66 69 6e ...(1<<2).#defin
d050: 65 20 54 43 4c 5f 47 4c 4f 42 5f 50 45 52 4d 5f e TCL_GLOB_PERM_
d060: 57 09 09 09 28 31 3c 3c 33 29 0a 23 64 65 66 69 W...(1<<3).#defi
d070: 6e 65 20 54 43 4c 5f 47 4c 4f 42 5f 50 45 52 4d ne TCL_GLOB_PERM
d080: 5f 58 09 09 09 28 31 3c 3c 34 29 0a 0a 2f 2a 0a _X...(1<<4)../*.
d090: 20 2a 20 46 6c 61 67 73 20 66 6f 72 20 74 68 65 * Flags for the
d0a0: 20 75 6e 6c 6f 61 64 20 63 61 6c 6c 62 61 63 6b unload callback
d0b0: 20 66 75 6e 63 74 69 6f 6e 2e 0a 20 2a 2f 0a 0a function.. */..
d0c0: 23 64 65 66 69 6e 65 20 54 43 4c 5f 55 4e 4c 4f #define TCL_UNLO
d0d0: 41 44 5f 44 45 54 41 43 48 5f 46 52 4f 4d 5f 49 AD_DETACH_FROM_I
d0e0: 4e 54 45 52 50 52 45 54 45 52 09 28 31 3c 3c 30 NTERPRETER.(1<<0
d0f0: 29 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 55 4e ).#define TCL_UN
d100: 4c 4f 41 44 5f 44 45 54 41 43 48 5f 46 52 4f 4d LOAD_DETACH_FROM
d110: 5f 50 52 4f 43 45 53 53 09 09 28 31 3c 3c 31 29 _PROCESS..(1<<1)
d120: 0a 0a 2f 2a 0a 20 2a 20 54 79 70 65 64 65 66 73 ../*. * Typedefs
d130: 20 66 6f 72 20 74 68 65 20 76 61 72 69 6f 75 73 for the various
d140: 20 66 69 6c 65 73 79 73 74 65 6d 20 6f 70 65 72 filesystem oper
d150: 61 74 69 6f 6e 73 3a 0a 20 2a 2f 0a 0a 74 79 70 ations:. */..typ
d160: 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 46 53 edef int (Tcl_FS
d170: 53 74 61 74 50 72 6f 63 29 20 28 54 63 6c 5f 4f StatProc) (Tcl_O
d180: 62 6a 20 2a 70 61 74 68 50 74 72 2c 20 54 63 6c bj *pathPtr, Tcl
d190: 5f 53 74 61 74 42 75 66 20 2a 62 75 66 29 3b 0a _StatBuf *buf);.
d1a0: 74 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c typedef int (Tcl
d1b0: 5f 46 53 41 63 63 65 73 73 50 72 6f 63 29 20 28 _FSAccessProc) (
d1c0: 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68 50 74 72 Tcl_Obj *pathPtr
d1d0: 2c 20 69 6e 74 20 6d 6f 64 65 29 3b 0a 74 79 70 , int mode);.typ
d1e0: 65 64 65 66 20 54 63 6c 5f 43 68 61 6e 6e 65 6c edef Tcl_Channel
d1f0: 20 28 54 63 6c 5f 46 53 4f 70 65 6e 46 69 6c 65 (Tcl_FSOpenFile
d200: 43 68 61 6e 6e 65 6c 50 72 6f 63 29 20 28 54 63 ChannelProc) (Tc
d210: 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 l_Interp *interp
d220: 2c 0a 09 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68 ,..Tcl_Obj *path
d230: 50 74 72 2c 20 69 6e 74 20 6d 6f 64 65 2c 20 69 Ptr, int mode, i
d240: 6e 74 20 70 65 72 6d 69 73 73 69 6f 6e 73 29 3b nt permissions);
d250: 0a 74 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 .typedef int (Tc
d260: 6c 5f 46 53 4d 61 74 63 68 49 6e 44 69 72 65 63 l_FSMatchInDirec
d270: 74 6f 72 79 50 72 6f 63 29 20 28 54 63 6c 5f 49 toryProc) (Tcl_I
d280: 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c 20 54 nterp *interp, T
d290: 63 6c 5f 4f 62 6a 20 2a 72 65 73 75 6c 74 2c 0a cl_Obj *result,.
d2a0: 09 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68 50 74 .Tcl_Obj *pathPt
d2b0: 72 2c 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 70 r, const char *p
d2c0: 61 74 74 65 72 6e 2c 20 54 63 6c 5f 47 6c 6f 62 attern, Tcl_Glob
d2d0: 54 79 70 65 44 61 74 61 20 2a 74 79 70 65 73 29 TypeData *types)
d2e0: 3b 0a 74 79 70 65 64 65 66 20 54 63 6c 5f 4f 62 ;.typedef Tcl_Ob
d2f0: 6a 20 2a 20 28 54 63 6c 5f 46 53 47 65 74 43 77 j * (Tcl_FSGetCw
d300: 64 50 72 6f 63 29 20 28 54 63 6c 5f 49 6e 74 65 dProc) (Tcl_Inte
d310: 72 70 20 2a 69 6e 74 65 72 70 29 3b 0a 74 79 70 rp *interp);.typ
d320: 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 46 53 edef int (Tcl_FS
d330: 43 68 64 69 72 50 72 6f 63 29 20 28 54 63 6c 5f ChdirProc) (Tcl_
d340: 4f 62 6a 20 2a 70 61 74 68 50 74 72 29 3b 0a 74 Obj *pathPtr);.t
d350: 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f ypedef int (Tcl_
d360: 46 53 4c 73 74 61 74 50 72 6f 63 29 20 28 54 63 FSLstatProc) (Tc
d370: 6c 5f 4f 62 6a 20 2a 70 61 74 68 50 74 72 2c 20 l_Obj *pathPtr,
d380: 54 63 6c 5f 53 74 61 74 42 75 66 20 2a 62 75 66 Tcl_StatBuf *buf
d390: 29 3b 0a 74 79 70 65 64 65 66 20 69 6e 74 20 28 );.typedef int (
d3a0: 54 63 6c 5f 46 53 43 72 65 61 74 65 44 69 72 65 Tcl_FSCreateDire
d3b0: 63 74 6f 72 79 50 72 6f 63 29 20 28 54 63 6c 5f ctoryProc) (Tcl_
d3c0: 4f 62 6a 20 2a 70 61 74 68 50 74 72 29 3b 0a 74 Obj *pathPtr);.t
d3d0: 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f ypedef int (Tcl_
d3e0: 46 53 44 65 6c 65 74 65 46 69 6c 65 50 72 6f 63 FSDeleteFileProc
d3f0: 29 20 28 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68 ) (Tcl_Obj *path
d400: 50 74 72 29 3b 0a 74 79 70 65 64 65 66 20 69 6e Ptr);.typedef in
d410: 74 20 28 54 63 6c 5f 46 53 43 6f 70 79 44 69 72 t (Tcl_FSCopyDir
d420: 65 63 74 6f 72 79 50 72 6f 63 29 20 28 54 63 6c ectoryProc) (Tcl
d430: 5f 4f 62 6a 20 2a 73 72 63 50 61 74 68 50 74 72 _Obj *srcPathPtr
d440: 2c 0a 09 54 63 6c 5f 4f 62 6a 20 2a 64 65 73 74 ,..Tcl_Obj *dest
d450: 50 61 74 68 50 74 72 2c 20 54 63 6c 5f 4f 62 6a PathPtr, Tcl_Obj
d460: 20 2a 2a 65 72 72 6f 72 50 74 72 29 3b 0a 74 79 **errorPtr);.ty
d470: 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 46 pedef int (Tcl_F
d480: 53 43 6f 70 79 46 69 6c 65 50 72 6f 63 29 20 28 SCopyFileProc) (
d490: 54 63 6c 5f 4f 62 6a 20 2a 73 72 63 50 61 74 68 Tcl_Obj *srcPath
d4a0: 50 74 72 2c 20 54 63 6c 5f 4f 62 6a 20 2a 64 65 Ptr, Tcl_Obj *de
d4b0: 73 74 50 61 74 68 50 74 72 29 3b 0a 74 79 70 65 stPathPtr);.type
d4c0: 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 46 53 52 def int (Tcl_FSR
d4d0: 65 6d 6f 76 65 44 69 72 65 63 74 6f 72 79 50 72 emoveDirectoryPr
d4e0: 6f 63 29 20 28 54 63 6c 5f 4f 62 6a 20 2a 70 61 oc) (Tcl_Obj *pa
d4f0: 74 68 50 74 72 2c 20 69 6e 74 20 72 65 63 75 72 thPtr, int recur
d500: 73 69 76 65 2c 0a 09 54 63 6c 5f 4f 62 6a 20 2a sive,..Tcl_Obj *
d510: 2a 65 72 72 6f 72 50 74 72 29 3b 0a 74 79 70 65 *errorPtr);.type
d520: 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 46 53 52 def int (Tcl_FSR
d530: 65 6e 61 6d 65 46 69 6c 65 50 72 6f 63 29 20 28 enameFileProc) (
d540: 54 63 6c 5f 4f 62 6a 20 2a 73 72 63 50 61 74 68 Tcl_Obj *srcPath
d550: 50 74 72 2c 20 54 63 6c 5f 4f 62 6a 20 2a 64 65 Ptr, Tcl_Obj *de
d560: 73 74 50 61 74 68 50 74 72 29 3b 0a 74 79 70 65 stPathPtr);.type
d570: 64 65 66 20 76 6f 69 64 20 28 54 63 6c 5f 46 53 def void (Tcl_FS
d580: 55 6e 6c 6f 61 64 46 69 6c 65 50 72 6f 63 29 20 UnloadFileProc)
d590: 28 54 63 6c 5f 4c 6f 61 64 48 61 6e 64 6c 65 20 (Tcl_LoadHandle
d5a0: 6c 6f 61 64 48 61 6e 64 6c 65 29 3b 0a 74 79 70 loadHandle);.typ
d5b0: 65 64 65 66 20 54 63 6c 5f 4f 62 6a 20 2a 20 28 edef Tcl_Obj * (
d5c0: 54 63 6c 5f 46 53 4c 69 73 74 56 6f 6c 75 6d 65 Tcl_FSListVolume
d5d0: 73 50 72 6f 63 29 20 28 76 6f 69 64 29 3b 0a 2f sProc) (void);./
d5e0: 2a 20 57 65 20 68 61 76 65 20 74 6f 20 64 65 63 * We have to dec
d5f0: 6c 61 72 65 20 74 68 65 20 75 74 69 6d 65 20 73 lare the utime s
d600: 74 72 75 63 74 75 72 65 20 68 65 72 65 2e 20 2a tructure here. *
d610: 2f 0a 73 74 72 75 63 74 20 75 74 69 6d 62 75 66 /.struct utimbuf
d620: 3b 0a 74 79 70 65 64 65 66 20 69 6e 74 20 28 54 ;.typedef int (T
d630: 63 6c 5f 46 53 55 74 69 6d 65 50 72 6f 63 29 20 cl_FSUtimeProc)
d640: 28 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68 50 74 (Tcl_Obj *pathPt
d650: 72 2c 20 73 74 72 75 63 74 20 75 74 69 6d 62 75 r, struct utimbu
d660: 66 20 2a 74 76 61 6c 29 3b 0a 74 79 70 65 64 65 f *tval);.typede
d670: 66 20 69 6e 74 20 28 54 63 6c 5f 46 53 4e 6f 72 f int (Tcl_FSNor
d680: 6d 61 6c 69 7a 65 50 61 74 68 50 72 6f 63 29 20 malizePathProc)
d690: 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 (Tcl_Interp *int
d6a0: 65 72 70 2c 20 54 63 6c 5f 4f 62 6a 20 2a 70 61 erp, Tcl_Obj *pa
d6b0: 74 68 50 74 72 2c 0a 09 69 6e 74 20 6e 65 78 74 thPtr,..int next
d6c0: 43 68 65 63 6b 70 6f 69 6e 74 29 3b 0a 74 79 70 Checkpoint);.typ
d6d0: 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 46 53 edef int (Tcl_FS
d6e0: 46 69 6c 65 41 74 74 72 73 47 65 74 50 72 6f 63 FileAttrsGetProc
d6f0: 29 20 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 ) (Tcl_Interp *i
d700: 6e 74 65 72 70 2c 20 69 6e 74 20 69 6e 64 65 78 nterp, int index
d710: 2c 0a 09 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68 ,..Tcl_Obj *path
d720: 50 74 72 2c 20 54 63 6c 5f 4f 62 6a 20 2a 2a 6f Ptr, Tcl_Obj **o
d730: 62 6a 50 74 72 52 65 66 29 3b 0a 74 79 70 65 64 bjPtrRef);.typed
d740: 65 66 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 63 ef const char *c
d750: 6f 6e 73 74 20 2a 20 28 54 63 6c 5f 46 53 46 69 onst * (Tcl_FSFi
d760: 6c 65 41 74 74 72 53 74 72 69 6e 67 73 50 72 6f leAttrStringsPro
d770: 63 29 20 28 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 c) (Tcl_Obj *pat
d780: 68 50 74 72 2c 0a 09 54 63 6c 5f 4f 62 6a 20 2a hPtr,..Tcl_Obj *
d790: 2a 6f 62 6a 50 74 72 52 65 66 29 3b 0a 74 79 70 *objPtrRef);.typ
d7a0: 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 46 53 edef int (Tcl_FS
d7b0: 46 69 6c 65 41 74 74 72 73 53 65 74 50 72 6f 63 FileAttrsSetProc
d7c0: 29 20 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 ) (Tcl_Interp *i
d7d0: 6e 74 65 72 70 2c 20 69 6e 74 20 69 6e 64 65 78 nterp, int index
d7e0: 2c 0a 09 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68 ,..Tcl_Obj *path
d7f0: 50 74 72 2c 20 54 63 6c 5f 4f 62 6a 20 2a 6f 62 Ptr, Tcl_Obj *ob
d800: 6a 50 74 72 29 3b 0a 74 79 70 65 64 65 66 20 54 jPtr);.typedef T
d810: 63 6c 5f 4f 62 6a 20 2a 20 28 54 63 6c 5f 46 53 cl_Obj * (Tcl_FS
d820: 4c 69 6e 6b 50 72 6f 63 29 20 28 54 63 6c 5f 4f LinkProc) (Tcl_O
d830: 62 6a 20 2a 70 61 74 68 50 74 72 2c 20 54 63 6c bj *pathPtr, Tcl
d840: 5f 4f 62 6a 20 2a 74 6f 50 74 72 2c 0a 09 69 6e _Obj *toPtr,..in
d850: 74 20 6c 69 6e 6b 54 79 70 65 29 3b 0a 74 79 70 t linkType);.typ
d860: 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 46 53 edef int (Tcl_FS
d870: 4c 6f 61 64 46 69 6c 65 50 72 6f 63 29 20 28 54 LoadFileProc) (T
d880: 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 cl_Interp *inter
d890: 70 2c 20 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68 p, Tcl_Obj *path
d8a0: 50 74 72 2c 0a 09 54 63 6c 5f 4c 6f 61 64 48 61 Ptr,..Tcl_LoadHa
d8b0: 6e 64 6c 65 20 2a 68 61 6e 64 6c 65 50 74 72 2c ndle *handlePtr,
d8c0: 20 54 63 6c 5f 46 53 55 6e 6c 6f 61 64 46 69 6c Tcl_FSUnloadFil
d8d0: 65 50 72 6f 63 20 2a 2a 75 6e 6c 6f 61 64 50 72 eProc **unloadPr
d8e0: 6f 63 50 74 72 29 3b 0a 74 79 70 65 64 65 66 20 ocPtr);.typedef
d8f0: 69 6e 74 20 28 54 63 6c 5f 46 53 50 61 74 68 49 int (Tcl_FSPathI
d900: 6e 46 69 6c 65 73 79 73 74 65 6d 50 72 6f 63 29 nFilesystemProc)
d910: 20 28 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 68 50 (Tcl_Obj *pathP
d920: 74 72 2c 0a 09 76 6f 69 64 20 2a 2a 63 6c 69 65 tr,..void **clie
d930: 6e 74 44 61 74 61 50 74 72 29 3b 0a 74 79 70 65 ntDataPtr);.type
d940: 64 65 66 20 54 63 6c 5f 4f 62 6a 20 2a 20 28 54 def Tcl_Obj * (T
d950: 63 6c 5f 46 53 46 69 6c 65 73 79 73 74 65 6d 50 cl_FSFilesystemP
d960: 61 74 68 54 79 70 65 50 72 6f 63 29 20 28 54 63 athTypeProc) (Tc
d970: 6c 5f 4f 62 6a 20 2a 70 61 74 68 50 74 72 29 3b l_Obj *pathPtr);
d980: 0a 74 79 70 65 64 65 66 20 54 63 6c 5f 4f 62 6a .typedef Tcl_Obj
d990: 20 2a 20 28 54 63 6c 5f 46 53 46 69 6c 65 73 79 * (Tcl_FSFilesy
d9a0: 73 74 65 6d 53 65 70 61 72 61 74 6f 72 50 72 6f stemSeparatorPro
d9b0: 63 29 20 28 54 63 6c 5f 4f 62 6a 20 2a 70 61 74 c) (Tcl_Obj *pat
d9c0: 68 50 74 72 29 3b 0a 23 64 65 66 69 6e 65 20 54 hPtr);.#define T
d9d0: 63 6c 5f 46 53 46 72 65 65 49 6e 74 65 72 6e 61 cl_FSFreeInterna
d9e0: 6c 52 65 70 50 72 6f 63 20 54 63 6c 5f 46 72 65 lRepProc Tcl_Fre
d9f0: 65 50 72 6f 63 0a 74 79 70 65 64 65 66 20 76 6f eProc.typedef vo
da00: 69 64 20 2a 28 54 63 6c 5f 46 53 44 75 70 49 6e id *(Tcl_FSDupIn
da10: 74 65 72 6e 61 6c 52 65 70 50 72 6f 63 29 20 28 ternalRepProc) (
da20: 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 61 74 61 void *clientData
da30: 29 3b 0a 74 79 70 65 64 65 66 20 54 63 6c 5f 4f );.typedef Tcl_O
da40: 62 6a 20 2a 20 28 54 63 6c 5f 46 53 49 6e 74 65 bj * (Tcl_FSInte
da50: 72 6e 61 6c 54 6f 4e 6f 72 6d 61 6c 69 7a 65 64 rnalToNormalized
da60: 50 72 6f 63 29 20 28 76 6f 69 64 20 2a 63 6c 69 Proc) (void *cli
da70: 65 6e 74 44 61 74 61 29 3b 0a 74 79 70 65 64 65 entData);.typede
da80: 66 20 76 6f 69 64 20 2a 28 54 63 6c 5f 46 53 43 f void *(Tcl_FSC
da90: 72 65 61 74 65 49 6e 74 65 72 6e 61 6c 52 65 70 reateInternalRep
daa0: 50 72 6f 63 29 20 28 54 63 6c 5f 4f 62 6a 20 2a Proc) (Tcl_Obj *
dab0: 70 61 74 68 50 74 72 29 3b 0a 0a 74 79 70 65 64 pathPtr);..typed
dac0: 65 66 20 73 74 72 75 63 74 20 54 63 6c 5f 46 53 ef struct Tcl_FS
dad0: 56 65 72 73 69 6f 6e 5f 20 2a 54 63 6c 5f 46 53 Version_ *Tcl_FS
dae0: 56 65 72 73 69 6f 6e 3b 0a 0a 2f 2a 0a 20 2a 2d Version;../*. *-
daf0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
db00: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
db10: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
db20: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
db30: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 44 -----------. * D
db40: 61 74 61 20 73 74 72 75 63 74 75 72 65 73 20 72 ata structures r
db50: 65 6c 61 74 65 64 20 74 6f 20 68 6f 6f 6b 69 6e elated to hookin
db60: 67 20 69 6e 74 6f 20 74 68 65 20 66 69 6c 65 73 g into the files
db70: 79 73 74 65 6d 0a 20 2a 2f 0a 0a 2f 2a 0a 20 2a ystem. */../*. *
db80: 20 46 69 6c 65 73 79 73 74 65 6d 20 76 65 72 73 Filesystem vers
db90: 69 6f 6e 20 74 61 67 2e 20 20 54 68 69 73 20 77 ion tag. This w
dba0: 61 73 20 69 6e 74 72 6f 64 75 63 65 64 20 69 6e as introduced in
dbb0: 20 38 2e 34 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 8.4.. */..#defi
dbc0: 6e 65 20 54 43 4c 5f 46 49 4c 45 53 59 53 54 45 ne TCL_FILESYSTE
dbd0: 4d 5f 56 45 52 53 49 4f 4e 5f 31 09 28 28 54 63 M_VERSION_1.((Tc
dbe0: 6c 5f 46 53 56 65 72 73 69 6f 6e 29 20 30 78 31 l_FSVersion) 0x1
dbf0: 29 0a 0a 2f 2a 0a 20 2a 20 73 74 72 75 63 74 20 )../*. * struct
dc00: 54 63 6c 5f 46 69 6c 65 73 79 73 74 65 6d 3a 0a Tcl_Filesystem:.
dc10: 20 2a 0a 20 2a 20 4f 6e 65 20 73 75 63 68 20 73 *. * One such s
dc20: 74 72 75 63 74 75 72 65 20 65 78 69 73 74 73 20 tructure exists
dc30: 66 6f 72 20 65 61 63 68 20 74 79 70 65 20 28 6b for each type (k
dc40: 69 6e 64 29 20 6f 66 20 66 69 6c 65 73 79 73 74 ind) of filesyst
dc50: 65 6d 2e 20 49 74 20 63 6f 6c 6c 65 63 74 73 0a em. It collects.
dc60: 20 2a 20 74 6f 67 65 74 68 65 72 20 74 68 65 20 * together the
dc70: 66 75 6e 63 74 69 6f 6e 73 20 74 68 61 74 20 66 functions that f
dc80: 6f 72 6d 20 74 68 65 20 69 6e 74 65 72 66 61 63 orm the interfac
dc90: 65 20 66 6f 72 20 61 20 70 61 72 74 69 63 75 6c e for a particul
dca0: 72 20 74 68 65 0a 20 2a 20 66 69 6c 65 73 79 73 r the. * filesys
dcb0: 74 65 6d 2e 20 54 63 6c 20 61 6c 77 61 79 73 20 tem. Tcl always
dcc0: 61 63 63 65 73 73 65 73 20 74 68 65 20 66 69 6c accesses the fil
dcd0: 65 73 79 73 74 65 6d 20 74 68 72 6f 75 67 68 20 esystem through
dce0: 6f 6e 65 20 6f 66 20 74 68 65 73 65 0a 20 2a 20 one of these. *
dcf0: 73 74 72 75 63 74 75 72 65 73 2e 0a 20 2a 0a 20 structures.. *.
dd00: 2a 20 4e 6f 74 20 61 6c 6c 20 65 6e 74 72 69 65 * Not all entrie
dd10: 73 20 6e 65 65 64 20 62 65 20 6e 6f 6e 2d 4e 55 s need be non-NU
dd20: 4c 4c 3b 20 61 6e 79 20 77 68 69 63 68 20 61 72 LL; any which ar
dd30: 65 20 4e 55 4c 4c 20 61 72 65 20 73 69 6d 70 6c e NULL are simpl
dd40: 79 20 69 67 6e 6f 72 65 64 2e 0a 20 2a 20 48 6f y ignored.. * Ho
dd50: 77 65 76 65 72 2c 20 61 20 63 6f 6d 70 6c 65 74 wever, a complet
dd60: 65 20 66 69 6c 65 73 79 73 74 65 6d 20 73 68 6f e filesystem sho
dd70: 75 6c 64 20 70 72 6f 76 69 64 65 20 61 6c 6c 20 uld provide all
dd80: 6f 66 20 74 68 65 73 65 20 66 75 6e 63 74 69 6f of these functio
dd90: 6e 73 2e 20 54 68 65 0a 20 2a 20 65 78 70 6c 61 ns. The. * expla
dda0: 6e 61 74 69 6f 6e 73 20 69 6e 20 74 68 65 20 73 nations in the s
ddb0: 74 72 75 63 74 75 72 65 20 73 68 6f 77 20 74 68 tructure show th
ddc0: 65 20 69 6d 70 6f 72 74 61 6e 63 65 20 6f 66 20 e importance of
ddd0: 65 61 63 68 20 66 75 6e 63 74 69 6f 6e 2e 0a 20 each function..
dde0: 2a 2f 0a 0a 74 79 70 65 64 65 66 20 73 74 72 75 */..typedef stru
ddf0: 63 74 20 54 63 6c 5f 46 69 6c 65 73 79 73 74 65 ct Tcl_Filesyste
de00: 6d 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 63 68 m {. const ch
de10: 61 72 20 2a 74 79 70 65 4e 61 6d 65 3b 09 2f 2a ar *typeName;./*
de20: 20 54 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 The name of the
de30: 20 66 69 6c 65 73 79 73 74 65 6d 2e 20 2a 2f 0a filesystem. */.
de40: 20 20 20 20 54 63 6c 5f 53 69 7a 65 20 73 74 72 Tcl_Size str
de50: 75 63 74 75 72 65 4c 65 6e 67 74 68 3b 09 2f 2a uctureLength;./*
de60: 20 4c 65 6e 67 74 68 20 6f 66 20 74 68 69 73 20 Length of this
de70: 73 74 72 75 63 74 75 72 65 2c 20 73 6f 20 66 75 structure, so fu
de80: 74 75 72 65 20 62 69 6e 61 72 79 0a 09 09 09 09 ture binary.....
de90: 20 2a 20 63 6f 6d 70 61 74 69 62 69 6c 69 74 79 * compatibility
dea0: 20 63 61 6e 20 62 65 20 61 73 73 75 72 65 64 2e can be assured.
deb0: 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53 56 65 */. Tcl_FSVe
dec0: 72 73 69 6f 6e 20 76 65 72 73 69 6f 6e 3b 09 2f rsion version;./
ded0: 2a 20 56 65 72 73 69 6f 6e 20 6f 66 20 74 68 65 * Version of the
dee0: 20 66 69 6c 65 73 79 73 74 65 6d 20 74 79 70 65 filesystem type
def0: 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53 50 . */. Tcl_FSP
df00: 61 74 68 49 6e 46 69 6c 65 73 79 73 74 65 6d 50 athInFilesystemP
df10: 72 6f 63 20 2a 70 61 74 68 49 6e 46 69 6c 65 73 roc *pathInFiles
df20: 79 73 74 65 6d 50 72 6f 63 3b 0a 09 09 09 09 2f ystemProc;...../
df30: 2a 20 44 65 74 65 72 6d 69 6e 65 73 20 77 68 65 * Determines whe
df40: 74 68 65 72 20 74 68 65 20 70 61 74 68 6e 61 6d ther the pathnam
df50: 65 20 69 73 20 69 6e 20 74 68 69 73 0a 09 09 09 e is in this....
df60: 09 20 2a 20 66 69 6c 65 73 79 73 74 65 6d 2e 20 . * filesystem.
df70: 54 68 69 73 20 69 73 20 74 68 65 20 6d 6f 73 74 This is the most
df80: 20 69 6d 70 6f 72 74 61 6e 74 0a 09 09 09 09 20 important.....
df90: 2a 20 66 69 6c 65 73 79 73 74 65 6d 20 66 75 6e * filesystem fun
dfa0: 63 74 69 6f 6e 2e 20 2a 2f 0a 20 20 20 20 54 63 ction. */. Tc
dfb0: 6c 5f 46 53 44 75 70 49 6e 74 65 72 6e 61 6c 52 l_FSDupInternalR
dfc0: 65 70 50 72 6f 63 20 2a 64 75 70 49 6e 74 65 72 epProc *dupInter
dfd0: 6e 61 6c 52 65 70 50 72 6f 63 3b 0a 09 09 09 09 nalRepProc;.....
dfe0: 2f 2a 20 44 75 70 6c 69 63 61 74 65 73 20 74 68 /* Duplicates th
dff0: 65 20 69 6e 74 65 72 6e 61 6c 20 68 61 6e 64 6c e internal handl
e000: 65 20 6f 66 20 74 68 65 20 6e 6f 64 65 2e 0a 09 e of the node...
e010: 09 09 09 20 2a 20 49 66 20 69 74 20 69 73 20 4e ... * If it is N
e020: 55 4c 4c 2c 20 74 68 65 20 66 69 6c 65 73 79 73 ULL, the filesys
e030: 74 65 6d 20 69 73 20 6c 65 73 73 0a 09 09 09 09 tem is less.....
e040: 20 2a 20 70 65 72 66 6f 72 6d 61 6e 74 2e 20 2a * performant. *
e050: 2f 0a 20 20 20 20 54 63 6c 5f 46 53 46 72 65 65 /. Tcl_FSFree
e060: 49 6e 74 65 72 6e 61 6c 52 65 70 50 72 6f 63 20 InternalRepProc
e070: 2a 66 72 65 65 49 6e 74 65 72 6e 61 6c 52 65 70 *freeInternalRep
e080: 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 46 72 65 Proc;...../* Fre
e090: 65 73 20 74 68 65 20 69 6e 74 65 72 6e 61 6c 20 es the internal
e0a0: 68 61 6e 64 6c 65 20 6f 66 20 74 68 65 20 6e 6f handle of the no
e0b0: 64 65 2e 20 20 4e 55 4c 4c 0a 09 09 09 09 20 2a de. NULL..... *
e0c0: 20 6f 6e 6c 79 20 69 66 20 74 68 65 72 65 20 69 only if there i
e0d0: 73 20 6e 6f 20 6e 65 65 64 20 74 6f 20 66 72 65 s no need to fre
e0e0: 65 20 72 65 73 6f 75 72 63 65 73 0a 09 09 09 09 e resources.....
e0f0: 20 2a 20 75 73 65 64 20 66 6f 72 20 74 68 65 20 * used for the
e100: 69 6e 74 65 72 6e 61 6c 20 68 61 6e 64 6c 65 2e internal handle.
e110: 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53 49 6e */. Tcl_FSIn
e120: 74 65 72 6e 61 6c 54 6f 4e 6f 72 6d 61 6c 69 7a ternalToNormaliz
e130: 65 64 50 72 6f 63 20 2a 69 6e 74 65 72 6e 61 6c edProc *internal
e140: 54 6f 4e 6f 72 6d 61 6c 69 7a 65 64 50 72 6f 63 ToNormalizedProc
e150: 3b 0a 09 09 09 09 2f 2a 20 43 6f 6e 76 65 72 74 ;...../* Convert
e160: 73 20 74 68 65 20 69 6e 74 65 72 6e 61 6c 20 68 s the internal h
e170: 61 6e 64 6c 65 20 74 6f 20 61 20 6e 6f 72 6d 61 andle to a norma
e180: 6c 69 7a 65 64 0a 09 09 09 09 20 2a 20 70 61 74 lized..... * pat
e190: 68 2e 20 20 4e 55 4c 4c 20 69 66 20 74 68 65 20 h. NULL if the
e1a0: 66 69 6c 65 73 79 73 74 65 6d 20 63 72 65 61 74 filesystem creat
e1b0: 65 73 20 6e 6f 64 65 73 0a 09 09 09 09 20 2a 20 es nodes..... *
e1c0: 68 61 76 69 6e 67 20 6e 6f 20 70 61 74 68 6e 61 having no pathna
e1d0: 6d 65 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 me. */. Tcl_F
e1e0: 53 43 72 65 61 74 65 49 6e 74 65 72 6e 61 6c 52 SCreateInternalR
e1f0: 65 70 50 72 6f 63 20 2a 63 72 65 61 74 65 49 6e epProc *createIn
e200: 74 65 72 6e 61 6c 52 65 70 50 72 6f 63 3b 0a 09 ternalRepProc;..
e210: 09 09 09 2f 2a 20 43 72 65 61 74 65 73 20 61 6e .../* Creates an
e220: 20 69 6e 74 65 72 6e 61 6c 20 68 61 6e 64 6c 65 internal handle
e230: 20 66 6f 72 20 61 20 70 61 74 68 6e 61 6d 65 2e for a pathname.
e240: 0a 09 09 09 09 20 2a 20 4d 61 79 20 62 65 20 4e ..... * May be N
e250: 55 4c 4c 20 69 66 20 70 61 74 68 6e 61 6d 65 73 ULL if pathnames
e260: 20 68 61 76 65 20 6e 6f 20 69 6e 74 65 72 6e 61 have no interna
e270: 6c 0a 09 09 09 09 20 2a 20 68 61 6e 64 6c 65 20 l..... * handle
e280: 6f 72 20 69 66 20 70 61 74 68 49 6e 46 69 6c 65 or if pathInFile
e290: 73 79 73 74 65 6d 50 72 6f 63 20 61 6c 77 61 79 systemProc alway
e2a0: 73 0a 09 09 09 09 20 2a 20 69 6d 6d 65 64 69 61 s..... * immedia
e2b0: 74 65 6c 79 20 63 72 65 61 74 65 73 20 61 6e 20 tely creates an
e2c0: 69 6e 74 65 72 6e 61 6c 0a 09 09 09 09 20 2a 20 internal..... *
e2d0: 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 66 representation f
e2e0: 6f 72 20 70 61 74 68 6e 61 6d 65 73 20 69 6e 20 or pathnames in
e2f0: 74 68 65 0a 09 09 09 09 20 2a 20 66 69 6c 65 73 the..... * files
e300: 79 73 74 65 6d 2e 20 2a 2f 0a 20 20 20 20 54 63 ystem. */. Tc
e310: 6c 5f 46 53 4e 6f 72 6d 61 6c 69 7a 65 50 61 74 l_FSNormalizePat
e320: 68 50 72 6f 63 20 2a 6e 6f 72 6d 61 6c 69 7a 65 hProc *normalize
e330: 50 61 74 68 50 72 6f 63 3b 0a 09 09 09 09 2f 2a PathProc;...../*
e340: 20 4e 6f 72 6d 61 6c 69 7a 65 73 20 61 20 70 61 Normalizes a pa
e350: 74 68 2e 20 20 53 68 6f 75 6c 64 20 62 65 20 69 th. Should be i
e360: 6d 70 6c 65 6d 65 6e 74 65 64 20 69 66 0a 09 09 mplemented if...
e370: 09 09 20 2a 20 74 68 65 20 66 69 6c 65 73 79 73 .. * the filesys
e380: 74 65 6d 73 20 73 75 70 70 6f 72 74 73 20 6d 75 tems supports mu
e390: 6c 74 69 70 6c 65 20 70 61 74 68 73 20 74 6f 0a ltiple paths to.
e3a0: 09 09 09 09 20 2a 20 74 68 65 20 73 61 6d 65 20 .... * the same
e3b0: 6e 6f 64 65 2e 20 2a 2f 0a 20 20 20 20 54 63 6c node. */. Tcl
e3c0: 5f 46 53 46 69 6c 65 73 79 73 74 65 6d 50 61 74 _FSFilesystemPat
e3d0: 68 54 79 70 65 50 72 6f 63 20 2a 66 69 6c 65 73 hTypeProc *files
e3e0: 79 73 74 65 6d 50 61 74 68 54 79 70 65 50 72 6f ystemPathTypePro
e3f0: 63 3b 0a 09 09 09 09 2f 2a 20 44 65 74 65 72 6d c;...../* Determ
e400: 69 6e 65 73 20 74 68 65 20 74 79 70 65 20 6f 66 ines the type of
e410: 20 61 20 70 61 74 68 20 69 6e 20 74 68 69 73 0a a path in this.
e420: 09 09 09 09 20 2a 20 66 69 6c 65 73 79 73 74 65 .... * filesyste
e430: 6d 2e 20 4d 61 79 20 62 65 20 4e 55 4c 4c 2e 20 m. May be NULL.
e440: 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53 46 69 6c */. Tcl_FSFil
e450: 65 73 79 73 74 65 6d 53 65 70 61 72 61 74 6f 72 esystemSeparator
e460: 50 72 6f 63 20 2a 66 69 6c 65 73 79 73 74 65 6d Proc *filesystem
e470: 53 65 70 61 72 61 74 6f 72 50 72 6f 63 3b 0a 09 SeparatorProc;..
e480: 09 09 09 2f 2a 20 50 72 6f 64 75 63 65 73 20 74 .../* Produces t
e490: 68 65 20 73 65 70 61 72 61 74 6f 72 20 63 68 61 he separator cha
e4a0: 72 61 63 74 65 72 28 73 29 20 66 6f 72 20 74 68 racter(s) for th
e4b0: 69 73 0a 09 09 09 09 20 2a 20 66 69 6c 65 73 79 is..... * filesy
e4c0: 73 74 65 6d 2e 20 4d 75 73 74 20 6e 6f 74 20 62 stem. Must not b
e4d0: 65 20 4e 55 4c 4c 2e 20 2a 2f 0a 20 20 20 20 54 e NULL. */. T
e4e0: 63 6c 5f 46 53 53 74 61 74 50 72 6f 63 20 2a 73 cl_FSStatProc *s
e4f0: 74 61 74 50 72 6f 63 3b 09 2f 2a 20 43 61 6c 6c tatProc;./* Call
e500: 65 64 20 62 79 20 27 54 63 6c 5f 46 53 53 74 61 ed by 'Tcl_FSSta
e510: 74 28 29 27 2e 20 20 50 72 6f 76 69 64 65 64 20 t()'. Provided
e520: 62 79 20 61 6e 79 0a 09 09 09 09 20 2a 20 72 65 by any..... * re
e530: 61 73 6f 6e 61 62 6c 65 20 66 69 6c 65 73 79 73 asonable filesys
e540: 74 65 6d 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f tem. */. Tcl_
e550: 46 53 41 63 63 65 73 73 50 72 6f 63 20 2a 61 63 FSAccessProc *ac
e560: 63 65 73 73 50 72 6f 63 3b 0a 09 09 09 09 2f 2a cessProc;...../*
e570: 20 43 61 6c 6c 65 64 20 62 79 20 27 54 63 6c 5f Called by 'Tcl_
e580: 46 53 41 63 63 65 73 73 28 29 27 2e 20 20 49 6d FSAccess()'. Im
e590: 70 6c 65 6d 65 6e 74 65 64 20 62 79 0a 09 09 09 plemented by....
e5a0: 09 20 2a 20 61 6e 79 20 72 65 61 73 6f 6e 61 62 . * any reasonab
e5b0: 6c 65 20 66 69 6c 65 73 79 73 74 65 6d 2e 20 2a le filesystem. *
e5c0: 2f 0a 20 20 20 20 54 63 6c 5f 46 53 4f 70 65 6e /. Tcl_FSOpen
e5d0: 46 69 6c 65 43 68 61 6e 6e 65 6c 50 72 6f 63 20 FileChannelProc
e5e0: 2a 6f 70 65 6e 46 69 6c 65 43 68 61 6e 6e 65 6c *openFileChannel
e5f0: 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 43 61 6c Proc;...../* Cal
e600: 6c 65 64 20 62 79 20 27 54 63 6c 5f 46 53 4f 70 led by 'Tcl_FSOp
e610: 65 6e 46 69 6c 65 43 68 61 6e 6e 65 6c 28 29 27 enFileChannel()'
e620: 2e 0a 09 09 09 09 20 2a 20 50 72 6f 76 69 64 65 ...... * Provide
e630: 64 20 62 79 20 61 6e 79 20 72 65 61 73 6f 6e 61 d by any reasona
e640: 62 6c 65 20 66 69 6c 65 73 79 73 74 65 6d 2e 20 ble filesystem.
e650: 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53 4d 61 74 */. Tcl_FSMat
e660: 63 68 49 6e 44 69 72 65 63 74 6f 72 79 50 72 6f chInDirectoryPro
e670: 63 20 2a 6d 61 74 63 68 49 6e 44 69 72 65 63 74 c *matchInDirect
e680: 6f 72 79 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 oryProc;...../*
e690: 43 61 6c 6c 65 64 20 62 79 20 27 54 63 6c 5f 46 Called by 'Tcl_F
e6a0: 53 4d 61 74 63 68 49 6e 44 69 72 65 63 74 6f 72 SMatchInDirector
e6b0: 79 28 29 27 2e 20 20 4e 55 4c 4c 0a 09 09 09 09 y()'. NULL.....
e6c0: 20 2a 20 69 66 20 74 68 65 20 66 69 6c 65 73 79 * if the filesy
e6d0: 73 74 65 6d 20 64 6f 65 73 20 6e 6f 74 20 73 75 stem does not su
e6e0: 70 70 6f 72 74 20 67 6c 6f 62 20 6f 72 0a 09 09 pport glob or...
e6f0: 09 09 20 2a 20 72 65 63 75 72 73 69 76 65 20 63 .. * recursive c
e700: 6f 70 79 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f opy. */. Tcl_
e710: 46 53 55 74 69 6d 65 50 72 6f 63 20 2a 75 74 69 FSUtimeProc *uti
e720: 6d 65 50 72 6f 63 3b 09 2f 2a 20 43 61 6c 6c 65 meProc;./* Calle
e730: 64 20 62 79 20 27 54 63 6c 5f 46 53 55 74 69 6d d by 'Tcl_FSUtim
e740: 65 28 29 27 2c 20 62 79 20 27 66 69 6c 65 0a 09 e()', by 'file..
e750: 09 09 09 20 2a 20 6d 74 69 6d 65 27 20 74 6f 20 ... * mtime' to
e760: 73 65 74 20 28 6e 6f 74 20 72 65 61 64 29 20 74 set (not read) t
e770: 69 6d 65 73 2c 20 27 66 69 6c 65 0a 09 09 09 09 imes, 'file.....
e780: 20 2a 20 61 74 69 6d 65 27 2c 20 61 6e 64 20 74 * atime', and t
e790: 68 65 20 6f 70 65 6e 2d 72 2f 6f 70 65 6e 2d 77 he open-r/open-w
e7a0: 2f 66 63 6f 70 79 20 76 61 72 69 61 6e 74 0a 09 /fcopy variant..
e7b0: 09 09 09 20 2a 20 6f 66 20 27 66 69 6c 65 20 63 ... * of 'file c
e7c0: 6f 70 79 27 2e 20 2a 2f 0a 20 20 20 20 54 63 6c opy'. */. Tcl
e7d0: 5f 46 53 4c 69 6e 6b 50 72 6f 63 20 2a 6c 69 6e _FSLinkProc *lin
e7e0: 6b 50 72 6f 63 3b 09 2f 2a 20 43 61 6c 6c 65 64 kProc;./* Called
e7f0: 20 62 79 20 27 54 63 6c 5f 46 53 4c 69 6e 6b 28 by 'Tcl_FSLink(
e800: 29 27 2e 20 4e 55 4c 4c 20 69 66 20 72 65 61 64 )'. NULL if read
e810: 69 6e 67 20 6f 72 0a 09 09 09 09 20 2a 20 63 72 ing or..... * cr
e820: 65 61 74 69 6e 67 20 6c 69 6e 6b 73 20 69 73 20 eating links is
e830: 6e 6f 74 20 73 75 70 70 6f 72 74 65 64 2e 20 2a not supported. *
e840: 2f 0a 20 20 20 20 54 63 6c 5f 46 53 4c 69 73 74 /. Tcl_FSList
e850: 56 6f 6c 75 6d 65 73 50 72 6f 63 20 2a 6c 69 73 VolumesProc *lis
e860: 74 56 6f 6c 75 6d 65 73 50 72 6f 63 3b 0a 09 09 tVolumesProc;...
e870: 09 09 2f 2a 20 4c 69 73 74 73 20 66 69 6c 65 73 ../* Lists files
e880: 79 73 74 65 6d 20 76 6f 6c 75 6d 65 73 20 61 64 ystem volumes ad
e890: 64 65 64 20 62 79 20 74 68 69 73 0a 09 09 09 09 ded by this.....
e8a0: 20 2a 20 66 69 6c 65 73 79 73 74 65 6d 2e 20 4e * filesystem. N
e8b0: 55 4c 4c 20 69 66 20 74 68 65 20 66 69 6c 65 73 ULL if the files
e8c0: 79 73 74 65 6d 20 64 6f 65 73 20 6e 6f 74 0a 09 ystem does not..
e8d0: 09 09 09 20 2a 20 75 73 65 20 76 6f 6c 75 6d 65 ... * use volume
e8e0: 73 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53 s. */. Tcl_FS
e8f0: 46 69 6c 65 41 74 74 72 53 74 72 69 6e 67 73 50 FileAttrStringsP
e900: 72 6f 63 20 2a 66 69 6c 65 41 74 74 72 53 74 72 roc *fileAttrStr
e910: 69 6e 67 73 50 72 6f 63 3b 0a 09 09 09 09 2f 2a ingsProc;...../*
e920: 20 4c 69 73 74 20 61 6c 6c 20 76 61 6c 69 64 20 List all valid
e930: 61 74 74 72 69 62 75 74 65 73 20 73 74 72 69 6e attributes strin
e940: 67 73 2e 20 20 4e 55 4c 4c 20 69 66 0a 09 09 09 gs. NULL if....
e950: 09 20 2a 20 74 68 65 20 66 69 6c 65 73 79 73 74 . * the filesyst
e960: 65 6d 20 64 6f 65 73 20 6e 6f 74 20 73 75 70 70 em does not supp
e970: 6f 72 74 20 74 68 65 20 27 66 69 6c 65 0a 09 09 ort the 'file...
e980: 09 09 20 2a 20 61 74 74 72 69 62 75 74 65 73 27 .. * attributes'
e990: 20 63 6f 6d 6d 61 6e 64 2e 20 20 43 61 6e 20 62 command. Can b
e9a0: 65 20 75 73 65 64 20 74 6f 20 61 74 74 61 63 68 e used to attach
e9b0: 0a 09 09 09 09 20 2a 20 61 72 62 69 74 72 61 72 ..... * arbitrar
e9c0: 79 20 61 64 64 69 74 69 6f 6e 61 6c 20 64 61 74 y additional dat
e9d0: 61 20 74 6f 20 66 69 6c 65 73 20 69 6e 20 61 0a a to files in a.
e9e0: 09 09 09 09 20 2a 20 66 69 6c 65 73 79 73 74 65 .... * filesyste
e9f0: 6d 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53 m. */. Tcl_FS
ea00: 46 69 6c 65 41 74 74 72 73 47 65 74 50 72 6f 63 FileAttrsGetProc
ea10: 20 2a 66 69 6c 65 41 74 74 72 73 47 65 74 50 72 *fileAttrsGetPr
ea20: 6f 63 3b 0a 09 09 09 09 2f 2a 20 43 61 6c 6c 65 oc;...../* Calle
ea30: 64 20 62 79 20 27 54 63 6c 5f 46 53 46 69 6c 65 d by 'Tcl_FSFile
ea40: 41 74 74 72 73 47 65 74 28 29 27 20 61 6e 64 20 AttrsGet()' and
ea50: 62 79 0a 09 09 09 09 20 2a 20 27 66 69 6c 65 20 by..... * 'file
ea60: 61 74 74 72 69 62 75 74 65 73 27 2e 20 2a 2f 0a attributes'. */.
ea70: 20 20 20 20 54 63 6c 5f 46 53 46 69 6c 65 41 74 Tcl_FSFileAt
ea80: 74 72 73 53 65 74 50 72 6f 63 20 2a 66 69 6c 65 trsSetProc *file
ea90: 41 74 74 72 73 53 65 74 50 72 6f 63 3b 0a 09 09 AttrsSetProc;...
eaa0: 09 09 2f 2a 20 43 61 6c 6c 65 64 20 62 79 20 27 ../* Called by '
eab0: 54 63 6c 5f 46 53 46 69 6c 65 41 74 74 72 73 53 Tcl_FSFileAttrsS
eac0: 65 74 28 29 27 20 61 6e 64 20 62 79 0a 09 09 09 et()' and by....
ead0: 09 20 2a 20 27 66 69 6c 65 20 61 74 74 72 69 62 . * 'file attrib
eae0: 75 74 65 73 27 2e 20 2a 2f 0a 20 20 20 20 54 63 utes'. */. Tc
eaf0: 6c 5f 46 53 43 72 65 61 74 65 44 69 72 65 63 74 l_FSCreateDirect
eb00: 6f 72 79 50 72 6f 63 20 2a 63 72 65 61 74 65 44 oryProc *createD
eb10: 69 72 65 63 74 6f 72 79 50 72 6f 63 3b 0a 09 09 irectoryProc;...
eb20: 09 09 2f 2a 20 43 61 6c 6c 65 64 20 62 79 20 27 ../* Called by '
eb30: 54 63 6c 5f 46 53 43 72 65 61 74 65 44 69 72 65 Tcl_FSCreateDire
eb40: 63 74 6f 72 79 28 29 27 2e 20 20 4d 61 79 20 62 ctory()'. May b
eb50: 65 0a 09 09 09 09 20 2a 20 4e 55 4c 4c 20 69 66 e..... * NULL if
eb60: 20 74 68 65 20 66 69 6c 65 73 79 73 74 65 6d 20 the filesystem
eb70: 69 73 20 72 65 61 64 2d 6f 6e 6c 79 2e 20 2a 2f is read-only. */
eb80: 0a 20 20 20 20 54 63 6c 5f 46 53 52 65 6d 6f 76 . Tcl_FSRemov
eb90: 65 44 69 72 65 63 74 6f 72 79 50 72 6f 63 20 2a eDirectoryProc *
eba0: 72 65 6d 6f 76 65 44 69 72 65 63 74 6f 72 79 50 removeDirectoryP
ebb0: 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 43 61 6c 6c roc;...../* Call
ebc0: 65 64 20 62 79 20 27 54 63 6c 5f 46 53 52 65 6d ed by 'Tcl_FSRem
ebd0: 6f 76 65 44 69 72 65 63 74 6f 72 79 28 29 27 2e oveDirectory()'.
ebe0: 20 20 4d 61 79 20 62 65 0a 09 09 09 09 20 2a 20 May be..... *
ebf0: 4e 55 4c 4c 20 69 66 20 74 68 65 20 66 69 6c 65 NULL if the file
ec00: 73 79 73 74 65 6d 20 69 73 20 72 65 61 64 2d 6f system is read-o
ec10: 6e 6c 79 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f nly. */. Tcl_
ec20: 46 53 44 65 6c 65 74 65 46 69 6c 65 50 72 6f 63 FSDeleteFileProc
ec30: 20 2a 64 65 6c 65 74 65 46 69 6c 65 50 72 6f 63 *deleteFileProc
ec40: 3b 0a 09 09 09 09 2f 2a 20 43 61 6c 6c 65 64 20 ;...../* Called
ec50: 62 79 20 27 54 63 6c 5f 46 53 44 65 6c 65 74 65 by 'Tcl_FSDelete
ec60: 46 69 6c 65 28 29 27 20 4d 61 79 20 62 65 20 4e File()' May be N
ec70: 55 4c 4c 0a 09 09 09 09 20 2a 20 69 66 20 74 68 ULL..... * if th
ec80: 65 20 66 69 6c 65 73 79 73 74 65 6d 20 69 73 20 e filesystem is
ec90: 69 73 20 72 65 61 64 2d 6f 6e 6c 79 2e 20 2a 2f is read-only. */
eca0: 0a 20 20 20 20 54 63 6c 5f 46 53 43 6f 70 79 46 . Tcl_FSCopyF
ecb0: 69 6c 65 50 72 6f 63 20 2a 63 6f 70 79 46 69 6c ileProc *copyFil
ecc0: 65 50 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 43 61 eProc;...../* Ca
ecd0: 6c 6c 65 64 20 62 79 20 27 54 63 6c 5f 46 53 43 lled by 'Tcl_FSC
ece0: 6f 70 79 46 69 6c 65 28 29 27 2e 20 20 49 66 20 opyFile()'. If
ecf0: 4e 55 4c 4c 2c 20 66 6f 72 0a 09 09 09 09 20 2a NULL, for..... *
ed00: 20 61 20 63 6f 70 79 20 6f 70 65 72 61 74 69 6f a copy operatio
ed10: 6e 20 61 74 20 74 68 65 20 73 63 72 69 70 74 20 n at the script
ed20: 6c 65 76 65 6c 20 28 6e 6f 74 0a 09 09 09 09 20 level (not.....
ed30: 2a 20 43 29 20 54 63 6c 20 75 73 65 73 20 6f 70 * C) Tcl uses op
ed40: 65 6e 2d 72 2c 20 6f 70 65 6e 2d 77 20 61 6e 64 en-r, open-w and
ed50: 20 66 63 6f 70 79 2e 20 2a 2f 0a 20 20 20 20 54 fcopy. */. T
ed60: 63 6c 5f 46 53 52 65 6e 61 6d 65 46 69 6c 65 50 cl_FSRenameFileP
ed70: 72 6f 63 20 2a 72 65 6e 61 6d 65 46 69 6c 65 50 roc *renameFileP
ed80: 72 6f 63 3b 0a 09 09 09 09 2f 2a 20 43 61 6c 6c roc;...../* Call
ed90: 65 64 20 62 79 20 27 54 63 6c 5f 46 53 52 65 6e ed by 'Tcl_FSRen
eda0: 61 6d 65 46 69 6c 65 28 29 27 2e 20 49 66 20 4e ameFile()'. If N
edb0: 55 4c 4c 2c 20 66 6f 72 0a 09 09 09 09 20 2a 20 ULL, for..... *
edc0: 61 20 72 65 6e 61 6d 65 20 6f 70 65 72 61 74 69 a rename operati
edd0: 6f 6e 20 61 74 20 74 68 65 20 73 63 72 69 70 74 on at the script
ede0: 20 6c 65 76 65 6c 20 28 6e 6f 74 0a 09 09 09 09 level (not.....
edf0: 20 2a 20 43 29 20 54 63 6c 20 70 65 72 66 6f 72 * C) Tcl perfor
ee00: 6d 73 20 61 20 63 6f 70 79 20 6f 70 65 72 61 74 ms a copy operat
ee10: 69 6f 6e 20 66 6f 6c 6c 6f 77 65 64 0a 09 09 09 ion followed....
ee20: 09 20 2a 20 62 79 20 61 20 64 65 6c 65 74 65 20 . * by a delete
ee30: 6f 70 65 72 61 74 69 6f 6e 2e 20 2a 2f 0a 20 20 operation. */.
ee40: 20 20 54 63 6c 5f 46 53 43 6f 70 79 44 69 72 65 Tcl_FSCopyDire
ee50: 63 74 6f 72 79 50 72 6f 63 20 2a 63 6f 70 79 44 ctoryProc *copyD
ee60: 69 72 65 63 74 6f 72 79 50 72 6f 63 3b 0a 09 09 irectoryProc;...
ee70: 09 09 2f 2a 20 43 61 6c 6c 65 64 20 62 79 20 27 ../* Called by '
ee80: 54 63 6c 5f 46 53 43 6f 70 79 44 69 72 65 63 74 Tcl_FSCopyDirect
ee90: 6f 72 79 28 29 27 2e 20 49 66 20 4e 55 4c 4c 2c ory()'. If NULL,
eea0: 0a 09 09 09 09 20 2a 20 66 6f 72 20 61 20 63 6f ..... * for a co
eeb0: 70 79 20 6f 70 65 72 61 74 69 6f 6e 20 61 74 20 py operation at
eec0: 74 68 65 20 73 63 72 69 70 74 20 6c 65 76 65 6c the script level
eed0: 0a 09 09 09 09 20 2a 20 28 6e 6f 74 20 43 29 20 ..... * (not C)
eee0: 54 63 6c 20 72 65 63 75 72 73 69 76 65 6c 79 20 Tcl recursively
eef0: 63 72 65 61 74 65 73 20 64 69 72 65 63 74 6f 72 creates director
ef00: 69 65 73 0a 09 09 09 09 20 2a 20 61 6e 64 20 63 ies..... * and c
ef10: 6f 70 69 65 73 20 66 69 6c 65 73 2e 20 2a 2f 0a opies files. */.
ef20: 20 20 20 20 54 63 6c 5f 46 53 4c 73 74 61 74 50 Tcl_FSLstatP
ef30: 72 6f 63 20 2a 6c 73 74 61 74 50 72 6f 63 3b 09 roc *lstatProc;.
ef40: 2f 2a 20 43 61 6c 6c 65 64 20 62 79 20 27 54 63 /* Called by 'Tc
ef50: 6c 5f 46 53 4c 73 74 61 74 28 29 27 2e 20 49 66 l_FSLstat()'. If
ef60: 20 4e 55 4c 4c 2c 20 54 63 6c 0a 09 09 09 09 20 NULL, Tcl.....
ef70: 2a 20 61 74 74 65 6d 70 74 73 20 74 6f 20 75 73 * attempts to us
ef80: 65 20 27 73 74 61 74 50 72 6f 63 27 20 69 6e 73 e 'statProc' ins
ef90: 74 65 61 64 2e 20 2a 2f 0a 20 20 20 20 54 63 6c tead. */. Tcl
efa0: 5f 46 53 4c 6f 61 64 46 69 6c 65 50 72 6f 63 20 _FSLoadFileProc
efb0: 2a 6c 6f 61 64 46 69 6c 65 50 72 6f 63 3b 0a 09 *loadFileProc;..
efc0: 09 09 09 2f 2a 20 43 61 6c 6c 65 64 20 62 79 20 .../* Called by
efd0: 27 54 63 6c 5f 46 53 4c 6f 61 64 46 69 6c 65 28 'Tcl_FSLoadFile(
efe0: 29 27 2e 20 49 66 20 4e 55 4c 4c 2c 20 54 63 6c )'. If NULL, Tcl
eff0: 0a 09 09 09 09 20 2a 20 70 65 72 66 6f 72 6d 73 ..... * performs
f000: 20 61 20 63 6f 70 79 20 74 6f 20 61 20 74 65 6d a copy to a tem
f010: 70 6f 72 61 72 79 20 66 69 6c 65 20 69 6e 20 74 porary file in t
f020: 68 65 0a 09 09 09 09 20 2a 20 6e 61 74 69 76 65 he..... * native
f030: 20 66 69 6c 65 73 79 73 74 65 6d 20 61 6e 64 20 filesystem and
f040: 74 68 65 6e 20 63 61 6c 6c 73 0a 09 09 09 09 20 then calls.....
f050: 2a 20 54 63 6c 5f 46 53 4c 6f 61 64 46 69 6c 65 * Tcl_FSLoadFile
f060: 28 29 20 6f 6e 20 74 68 61 74 20 74 65 6d 70 6f () on that tempo
f070: 72 61 72 79 20 63 6f 70 79 2e 20 2a 2f 0a 20 20 rary copy. */.
f080: 20 20 54 63 6c 5f 46 53 47 65 74 43 77 64 50 72 Tcl_FSGetCwdPr
f090: 6f 63 20 2a 67 65 74 43 77 64 50 72 6f 63 3b 0a oc *getCwdProc;.
f0a0: 09 09 09 09 2f 2a 20 43 61 6c 6c 65 64 20 62 79 ..../* Called by
f0b0: 20 27 54 63 6c 5f 46 53 47 65 74 43 77 64 28 29 'Tcl_FSGetCwd()
f0c0: 27 2e 20 20 4e 6f 72 6d 61 6c 6c 79 20 4e 55 4c '. Normally NUL
f0d0: 4c 2e 0a 09 09 09 09 20 2a 20 55 73 75 61 6c 6c L...... * Usuall
f0e0: 79 20 6f 6e 6c 79 20 63 61 6c 6c 65 64 20 6f 6e y only called on
f0f0: 63 65 3a 20 20 49 66 20 27 67 65 74 63 77 64 27 ce: If 'getcwd'
f100: 20 69 73 0a 09 09 09 09 20 2a 20 63 61 6c 6c 65 is..... * calle
f110: 64 20 62 65 66 6f 72 65 20 27 63 68 64 69 72 27 d before 'chdir'
f120: 20 69 73 20 65 76 65 72 20 63 61 6c 6c 65 64 2e is ever called.
f130: 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 53 43 68 */. Tcl_FSCh
f140: 64 69 72 50 72 6f 63 20 2a 63 68 64 69 72 50 72 dirProc *chdirPr
f150: 6f 63 3b 09 2f 2a 20 43 61 6c 6c 65 64 20 62 79 oc;./* Called by
f160: 20 27 54 63 6c 5f 46 53 43 68 64 69 72 28 29 27 'Tcl_FSChdir()'
f170: 2e 20 20 46 6f 72 20 61 20 76 69 72 74 75 61 6c . For a virtual
f180: 0a 09 09 09 09 20 2a 20 66 69 6c 65 73 79 73 74 ..... * filesyst
f190: 65 6d 2c 20 63 68 64 69 72 50 72 6f 63 20 6a 75 em, chdirProc ju
f1a0: 73 74 20 72 65 74 75 72 6e 73 20 7a 65 72 6f 0a st returns zero.
f1b0: 09 09 09 09 20 2a 20 28 73 75 63 63 65 73 73 29 .... * (success)
f1c0: 20 69 66 20 74 68 65 20 70 61 74 68 6e 61 6d 65 if the pathname
f1d0: 20 69 73 20 61 20 76 61 6c 69 64 0a 09 09 09 09 is a valid.....
f1e0: 20 2a 20 64 69 72 65 63 74 6f 72 79 2c 20 61 6e * directory, an
f1f0: 64 20 73 6f 6d 65 20 6f 74 68 65 72 20 76 61 6c d some other val
f200: 75 65 20 6f 74 68 65 72 77 69 73 65 2e 0a 09 09 ue otherwise....
f210: 09 09 20 2a 20 46 6f 72 20 41 20 72 65 61 6c 20 .. * For A real
f220: 66 69 6c 65 73 79 73 74 65 6d 2c 20 63 68 64 69 filesystem, chdi
f230: 72 50 72 6f 63 20 70 65 72 66 6f 72 6d 73 0a 09 rProc performs..
f240: 09 09 09 20 2a 20 74 68 65 20 63 6f 72 72 65 63 ... * the correc
f250: 74 20 61 63 74 69 6f 6e 2c 20 65 2e 67 2e 20 20 t action, e.g.
f260: 63 61 6c 6c 73 20 74 68 65 20 73 79 73 74 65 6d calls the system
f270: 0a 09 09 09 09 20 2a 20 27 63 68 64 69 72 27 20 ..... * 'chdir'
f280: 66 75 6e 63 74 69 6f 6e 2e 20 49 66 20 6e 6f 74 function. If not
f290: 20 69 6d 70 6c 65 6d 65 6e 74 65 64 2c 20 74 68 implemented, th
f2a0: 65 6e 0a 09 09 09 09 20 2a 20 27 63 64 27 20 61 en..... * 'cd' a
f2b0: 6e 64 20 27 70 77 64 27 20 66 61 69 6c 20 66 6f nd 'pwd' fail fo
f2c0: 72 20 61 20 70 61 74 68 6e 61 6d 65 20 69 6e 20 r a pathname in
f2d0: 74 68 69 73 0a 09 09 09 09 20 2a 20 66 69 6c 65 this..... * file
f2e0: 73 79 73 74 65 6d 2e 20 4f 6e 20 73 75 63 63 65 system. On succe
f2f0: 73 73 20 54 63 6c 20 73 74 6f 72 65 73 20 74 68 ss Tcl stores th
f300: 65 0a 09 09 09 09 20 2a 20 70 61 74 68 6e 61 6d e..... * pathnam
f310: 65 20 66 6f 72 20 75 73 65 20 62 79 20 47 65 74 e for use by Get
f320: 43 77 64 2e 20 20 49 66 20 4e 55 4c 4c 2c 20 54 Cwd. If NULL, T
f330: 63 6c 0a 09 09 09 09 20 2a 20 70 65 72 66 6f 72 cl..... * perfor
f340: 6d 73 20 72 65 63 6f 72 64 73 20 74 68 65 20 70 ms records the p
f350: 61 74 68 6e 61 6d 65 20 61 73 20 74 68 65 20 6e athname as the n
f360: 65 77 0a 09 09 09 09 20 2a 20 63 75 72 72 65 6e ew..... * curren
f370: 74 20 64 69 72 65 63 74 6f 72 79 20 69 66 20 69 t directory if i
f380: 74 20 70 61 73 73 65 73 20 61 20 73 65 72 69 65 t passes a serie
f390: 73 20 6f 66 0a 09 09 09 09 20 2a 20 64 69 72 65 s of..... * dire
f3a0: 63 74 6f 72 79 20 61 63 63 65 73 73 20 63 68 65 ctory access che
f3b0: 63 6b 73 2e 20 2a 2f 0a 7d 20 54 63 6c 5f 46 69 cks. */.} Tcl_Fi
f3c0: 6c 65 73 79 73 74 65 6d 3b 0a 0a 2f 2a 0a 20 2a lesystem;../*. *
f3d0: 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 64 The following d
f3e0: 65 66 69 6e 69 74 69 6f 6e 73 20 61 72 65 20 75 efinitions are u
f3f0: 73 65 64 20 61 73 20 76 61 6c 75 65 73 20 66 6f sed as values fo
f400: 72 20 74 68 65 20 27 6c 69 6e 6b 41 63 74 69 6f r the 'linkActio
f410: 6e 27 20 66 6c 61 67 20 74 6f 0a 20 2a 20 54 63 n' flag to. * Tc
f420: 6c 5f 46 53 4c 69 6e 6b 2c 20 6f 72 20 74 68 65 l_FSLink, or the
f430: 20 6c 69 6e 6b 50 72 6f 63 20 6f 66 20 61 6e 79 linkProc of any
f440: 20 66 69 6c 65 73 79 73 74 65 6d 2e 20 41 6e 79 filesystem. Any
f450: 20 63 6f 6d 62 69 6e 61 74 69 6f 6e 20 6f 66 20 combination of
f460: 66 6c 61 67 73 20 63 61 6e 0a 20 2a 20 62 65 20 flags can. * be
f470: 67 69 76 65 6e 2e 20 46 6f 72 20 6c 69 6e 6b 20 given. For link
f480: 63 72 65 61 74 69 6f 6e 2c 20 74 68 65 20 6c 69 creation, the li
f490: 6e 6b 50 72 6f 63 20 73 68 6f 75 6c 64 20 63 72 nkProc should cr
f4a0: 65 61 74 65 20 61 20 6c 69 6e 6b 20 77 68 69 63 eate a link whic
f4b0: 68 0a 20 2a 20 6d 61 74 63 68 65 73 20 61 6e 79 h. * matches any
f4c0: 20 6f 66 20 74 68 65 20 74 79 70 65 73 20 67 69 of the types gi
f4d0: 76 65 6e 2e 0a 20 2a 0a 20 2a 20 54 43 4c 5f 43 ven.. *. * TCL_C
f4e0: 52 45 41 54 45 5f 53 59 4d 42 4f 4c 49 43 5f 4c REATE_SYMBOLIC_L
f4f0: 49 4e 4b 20 2d 09 43 72 65 61 74 65 20 61 20 73 INK -.Create a s
f500: 79 6d 62 6f 6c 69 63 20 6f 72 20 73 6f 66 74 20 ymbolic or soft
f510: 6c 69 6e 6b 2e 0a 20 2a 20 54 43 4c 5f 43 52 45 link.. * TCL_CRE
f520: 41 54 45 5f 48 41 52 44 5f 4c 49 4e 4b 20 2d 09 ATE_HARD_LINK -.
f530: 43 72 65 61 74 65 20 61 20 68 61 72 64 20 6c 69 Create a hard li
f540: 6e 6b 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 nk.. */..#define
f550: 20 54 43 4c 5f 43 52 45 41 54 45 5f 53 59 4d 42 TCL_CREATE_SYMB
f560: 4f 4c 49 43 5f 4c 49 4e 4b 09 30 78 30 31 0a 23 OLIC_LINK.0x01.#
f570: 64 65 66 69 6e 65 20 54 43 4c 5f 43 52 45 41 54 define TCL_CREAT
f580: 45 5f 48 41 52 44 5f 4c 49 4e 4b 09 09 30 78 30 E_HARD_LINK..0x0
f590: 32 0a 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2../*. *--------
f5a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
f5b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
f5c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
f5d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
f5e0: 2d 2d 2d 2d 0a 20 2a 20 54 68 65 20 66 6f 6c 6c ----. * The foll
f5f0: 6f 77 69 6e 67 20 73 74 72 75 63 74 75 72 65 20 owing structure
f600: 72 65 70 72 65 73 65 6e 74 73 20 74 68 65 20 4e represents the N
f610: 6f 74 69 66 69 65 72 20 66 75 6e 63 74 69 6f 6e otifier function
f620: 73 20 74 68 61 74 20 79 6f 75 20 63 61 6e 0a 20 s that you can.
f630: 2a 20 6f 76 65 72 72 69 64 65 20 77 69 74 68 20 * override with
f640: 74 68 65 20 54 63 6c 5f 53 65 74 4e 6f 74 69 66 the Tcl_SetNotif
f650: 69 65 72 20 63 61 6c 6c 2e 0a 20 2a 2f 0a 0a 74 ier call.. */..t
f660: 79 70 65 64 65 66 20 73 74 72 75 63 74 20 54 63 ypedef struct Tc
f670: 6c 5f 4e 6f 74 69 66 69 65 72 50 72 6f 63 73 20 l_NotifierProcs
f680: 7b 0a 20 20 20 20 54 63 6c 5f 53 65 74 54 69 6d {. Tcl_SetTim
f690: 65 72 50 72 6f 63 20 2a 73 65 74 54 69 6d 65 72 erProc *setTimer
f6a0: 50 72 6f 63 3b 0a 20 20 20 20 54 63 6c 5f 57 61 Proc;. Tcl_Wa
f6b0: 69 74 46 6f 72 45 76 65 6e 74 50 72 6f 63 20 2a itForEventProc *
f6c0: 77 61 69 74 46 6f 72 45 76 65 6e 74 50 72 6f 63 waitForEventProc
f6d0: 3b 0a 20 20 20 20 54 63 6c 5f 43 72 65 61 74 65 ;. Tcl_Create
f6e0: 46 69 6c 65 48 61 6e 64 6c 65 72 50 72 6f 63 20 FileHandlerProc
f6f0: 2a 63 72 65 61 74 65 46 69 6c 65 48 61 6e 64 6c *createFileHandl
f700: 65 72 50 72 6f 63 3b 0a 20 20 20 20 54 63 6c 5f erProc;. Tcl_
f710: 44 65 6c 65 74 65 46 69 6c 65 48 61 6e 64 6c 65 DeleteFileHandle
f720: 72 50 72 6f 63 20 2a 64 65 6c 65 74 65 46 69 6c rProc *deleteFil
f730: 65 48 61 6e 64 6c 65 72 50 72 6f 63 3b 0a 20 20 eHandlerProc;.
f740: 20 20 54 63 6c 5f 49 6e 69 74 4e 6f 74 69 66 69 Tcl_InitNotifi
f750: 65 72 50 72 6f 63 20 2a 69 6e 69 74 4e 6f 74 69 erProc *initNoti
f760: 66 69 65 72 50 72 6f 63 3b 0a 20 20 20 20 54 63 fierProc;. Tc
f770: 6c 5f 46 69 6e 61 6c 69 7a 65 4e 6f 74 69 66 69 l_FinalizeNotifi
f780: 65 72 50 72 6f 63 20 2a 66 69 6e 61 6c 69 7a 65 erProc *finalize
f790: 4e 6f 74 69 66 69 65 72 50 72 6f 63 3b 0a 20 20 NotifierProc;.
f7a0: 20 20 54 63 6c 5f 41 6c 65 72 74 4e 6f 74 69 66 Tcl_AlertNotif
f7b0: 69 65 72 50 72 6f 63 20 2a 61 6c 65 72 74 4e 6f ierProc *alertNo
f7c0: 74 69 66 69 65 72 50 72 6f 63 3b 0a 20 20 20 20 tifierProc;.
f7d0: 54 63 6c 5f 53 65 72 76 69 63 65 4d 6f 64 65 48 Tcl_ServiceModeH
f7e0: 6f 6f 6b 50 72 6f 63 20 2a 73 65 72 76 69 63 65 ookProc *service
f7f0: 4d 6f 64 65 48 6f 6f 6b 50 72 6f 63 3b 0a 7d 20 ModeHookProc;.}
f800: 54 63 6c 5f 4e 6f 74 69 66 69 65 72 50 72 6f 63 Tcl_NotifierProc
f810: 73 3b 0a 0c 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d s;.../*. *------
f820: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
f830: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
f840: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
f850: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
f860: 2d 2d 2d 2d 2d 2d 0a 20 2a 20 54 68 65 20 66 6f ------. * The fo
f870: 6c 6c 6f 77 69 6e 67 20 64 61 74 61 20 73 74 72 llowing data str
f880: 75 63 74 75 72 65 73 20 61 6e 64 20 64 65 63 6c uctures and decl
f890: 61 72 61 74 69 6f 6e 73 20 61 72 65 20 66 6f 72 arations are for
f8a0: 20 74 68 65 20 6e 65 77 20 54 63 6c 20 70 61 72 the new Tcl par
f8b0: 73 65 72 2e 0a 20 2a 0a 20 2a 20 46 6f 72 20 65 ser.. *. * For e
f8c0: 61 63 68 20 77 6f 72 64 20 6f 66 20 61 20 63 6f ach word of a co
f8d0: 6d 6d 61 6e 64 2c 20 61 6e 64 20 66 6f 72 20 65 mmand, and for e
f8e0: 61 63 68 20 70 69 65 63 65 20 6f 66 20 61 20 77 ach piece of a w
f8f0: 6f 72 64 20 73 75 63 68 20 61 73 20 61 20 76 61 ord such as a va
f900: 72 69 61 62 6c 65 0a 20 2a 20 72 65 66 65 72 65 riable. * refere
f910: 6e 63 65 2c 20 6f 6e 65 20 6f 66 20 74 68 65 20 nce, one of the
f920: 66 6f 6c 6c 6f 77 69 6e 67 20 73 74 72 75 63 74 following struct
f930: 75 72 65 73 20 69 73 20 63 72 65 61 74 65 64 20 ures is created
f940: 74 6f 20 64 65 73 63 72 69 62 65 20 74 68 65 0a to describe the.
f950: 20 2a 20 74 6f 6b 65 6e 2e 0a 20 2a 2f 0a 0a 74 * token.. */..t
f960: 79 70 65 64 65 66 20 73 74 72 75 63 74 20 54 63 ypedef struct Tc
f970: 6c 5f 54 6f 6b 65 6e 20 7b 0a 20 20 20 20 69 6e l_Token {. in
f980: 74 20 74 79 70 65 3b 09 09 09 2f 2a 20 54 79 70 t type;.../* Typ
f990: 65 20 6f 66 20 74 6f 6b 65 6e 2c 20 73 75 63 68 e of token, such
f9a0: 20 61 73 20 54 43 4c 5f 54 4f 4b 45 4e 5f 57 4f as TCL_TOKEN_WO
f9b0: 52 44 3b 20 73 65 65 0a 09 09 09 09 20 2a 20 62 RD; see..... * b
f9c0: 65 6c 6f 77 20 66 6f 72 20 76 61 6c 69 64 20 74 elow for valid t
f9d0: 79 70 65 73 2e 20 2a 2f 0a 20 20 20 20 63 6f 6e ypes. */. con
f9e0: 73 74 20 63 68 61 72 20 2a 73 74 61 72 74 3b 09 st char *start;.
f9f0: 09 2f 2a 20 46 69 72 73 74 20 63 68 61 72 61 63 ./* First charac
fa00: 74 65 72 20 69 6e 20 74 6f 6b 65 6e 2e 20 2a 2f ter in token. */
fa10: 0a 20 20 20 20 54 63 6c 5f 53 69 7a 65 20 73 69 . Tcl_Size si
fa20: 7a 65 3b 09 09 2f 2a 20 4e 75 6d 62 65 72 20 6f ze;../* Number o
fa30: 66 20 62 79 74 65 73 20 69 6e 20 74 6f 6b 65 6e f bytes in token
fa40: 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 53 69 7a . */. Tcl_Siz
fa50: 65 20 6e 75 6d 43 6f 6d 70 6f 6e 65 6e 74 73 3b e numComponents;
fa60: 09 2f 2a 20 49 66 20 74 68 69 73 20 74 6f 6b 65 ./* If this toke
fa70: 6e 20 69 73 20 63 6f 6d 70 6f 73 65 64 20 6f 66 n is composed of
fa80: 20 6f 74 68 65 72 20 74 6f 6b 65 6e 73 2c 0a 09 other tokens,..
fa90: 09 09 09 20 2a 20 74 68 69 73 20 66 69 65 6c 64 ... * this field
faa0: 20 74 65 6c 6c 73 20 68 6f 77 20 6d 61 6e 79 20 tells how many
fab0: 6f 66 20 74 68 65 6d 20 74 68 65 72 65 20 61 72 of them there ar
fac0: 65 0a 09 09 09 09 20 2a 20 28 69 6e 63 6c 75 64 e..... * (includ
fad0: 69 6e 67 20 63 6f 6d 70 6f 6e 65 6e 74 73 20 6f ing components o
fae0: 66 20 63 6f 6d 70 6f 6e 65 6e 74 73 2c 20 65 74 f components, et
faf0: 63 2e 29 2e 0a 09 09 09 09 20 2a 20 54 68 65 20 c.)...... * The
fb00: 63 6f 6d 70 6f 6e 65 6e 74 20 74 6f 6b 65 6e 73 component tokens
fb10: 20 69 6d 6d 65 64 69 61 74 65 6c 79 20 66 6f 6c immediately fol
fb20: 6c 6f 77 0a 09 09 09 09 20 2a 20 74 68 69 73 20 low..... * this
fb30: 6f 6e 65 2e 20 2a 2f 0a 7d 20 54 63 6c 5f 54 6f one. */.} Tcl_To
fb40: 6b 65 6e 3b 0a 0a 2f 2a 0a 20 2a 20 54 79 70 65 ken;../*. * Type
fb50: 20 76 61 6c 75 65 73 20 64 65 66 69 6e 65 64 20 values defined
fb60: 66 6f 72 20 54 63 6c 5f 54 6f 6b 65 6e 20 73 74 for Tcl_Token st
fb70: 72 75 63 74 75 72 65 73 2e 20 54 68 65 73 65 20 ructures. These
fb80: 76 61 6c 75 65 73 20 61 72 65 20 64 65 66 69 6e values are defin
fb90: 65 64 20 61 73 0a 20 2a 20 6d 61 73 6b 20 62 69 ed as. * mask bi
fba0: 74 73 20 73 6f 20 74 68 61 74 20 69 74 27 73 20 ts so that it's
fbb0: 65 61 73 79 20 74 6f 20 63 68 65 63 6b 20 66 6f easy to check fo
fbc0: 72 20 63 6f 6c 6c 65 63 74 69 6f 6e 73 20 6f 66 r collections of
fbd0: 20 74 79 70 65 73 2e 0a 20 2a 0a 20 2a 20 54 43 types.. *. * TC
fbe0: 4c 5f 54 4f 4b 45 4e 5f 57 4f 52 44 20 2d 09 09 L_TOKEN_WORD -..
fbf0: 54 68 65 20 74 6f 6b 65 6e 20 64 65 73 63 72 69 The token descri
fc00: 62 65 73 20 6f 6e 65 20 77 6f 72 64 20 6f 66 20 bes one word of
fc10: 61 20 63 6f 6d 6d 61 6e 64 2c 0a 20 2a 09 09 09 a command,. *...
fc20: 09 66 72 6f 6d 20 74 68 65 20 66 69 72 73 74 20 .from the first
fc30: 6e 6f 6e 2d 62 6c 61 6e 6b 20 63 68 61 72 61 63 non-blank charac
fc40: 74 65 72 20 6f 66 20 74 68 65 20 77 6f 72 64 0a ter of the word.
fc50: 20 2a 09 09 09 09 28 77 68 69 63 68 20 6d 61 79 *....(which may
fc60: 20 62 65 20 22 20 6f 72 20 7b 29 20 75 70 20 74 be " or {) up t
fc70: 6f 20 62 75 74 20 6e 6f 74 20 69 6e 63 6c 75 64 o but not includ
fc80: 69 6e 67 0a 20 2a 09 09 09 09 74 68 65 20 73 70 ing. *....the sp
fc90: 61 63 65 2c 20 73 65 6d 69 63 6f 6c 6f 6e 2c 20 ace, semicolon,
fca0: 6f 72 20 62 72 61 63 6b 65 74 20 74 68 61 74 0a or bracket that.
fcb0: 20 2a 09 09 09 09 74 65 72 6d 69 6e 61 74 65 73 *....terminates
fcc0: 20 74 68 65 20 77 6f 72 64 2e 20 4e 75 6d 43 6f the word. NumCo
fcd0: 6d 70 6f 6e 65 6e 74 73 20 63 6f 75 6e 74 73 20 mponents counts
fce0: 74 68 65 0a 20 2a 09 09 09 09 74 6f 74 61 6c 20 the. *....total
fcf0: 6e 75 6d 62 65 72 20 6f 66 20 73 75 62 2d 74 6f number of sub-to
fd00: 6b 65 6e 73 20 74 68 61 74 20 6d 61 6b 65 20 75 kens that make u
fd10: 70 20 74 68 65 0a 20 2a 09 09 09 09 77 6f 72 64 p the. *....word
fd20: 2e 20 54 68 69 73 20 69 6e 63 6c 75 64 65 73 2c . This includes,
fd30: 20 66 6f 72 20 65 78 61 6d 70 6c 65 2c 20 73 75 for example, su
fd40: 62 2d 74 6f 6b 65 6e 73 0a 20 2a 09 09 09 09 6f b-tokens. *....o
fd50: 66 20 54 43 4c 5f 54 4f 4b 45 4e 5f 56 41 52 49 f TCL_TOKEN_VARI
fd60: 41 42 4c 45 20 74 6f 6b 65 6e 73 2e 0a 20 2a 20 ABLE tokens.. *
fd70: 54 43 4c 5f 54 4f 4b 45 4e 5f 53 49 4d 50 4c 45 TCL_TOKEN_SIMPLE
fd80: 5f 57 4f 52 44 20 2d 09 54 68 69 73 20 74 6f 6b _WORD -.This tok
fd90: 65 6e 20 69 73 20 6a 75 73 74 20 6c 69 6b 65 20 en is just like
fda0: 54 43 4c 5f 54 4f 4b 45 4e 5f 57 4f 52 44 20 65 TCL_TOKEN_WORD e
fdb0: 78 63 65 70 74 0a 20 2a 09 09 09 09 74 68 61 74 xcept. *....that
fdc0: 20 74 68 65 20 77 6f 72 64 20 69 73 20 67 75 61 the word is gua
fdd0: 72 61 6e 74 65 65 64 20 74 6f 20 63 6f 6e 73 69 ranteed to consi
fde0: 73 74 20 6f 66 20 61 0a 20 2a 09 09 09 09 73 69 st of a. *....si
fdf0: 6e 67 6c 65 20 54 43 4c 5f 54 4f 4b 45 4e 5f 54 ngle TCL_TOKEN_T
fe00: 45 58 54 20 73 75 62 2d 74 6f 6b 65 6e 2e 0a 20 EXT sub-token..
fe10: 2a 20 54 43 4c 5f 54 4f 4b 45 4e 5f 54 45 58 54 * TCL_TOKEN_TEXT
fe20: 20 2d 09 09 54 68 65 20 74 6f 6b 65 6e 20 64 65 -..The token de
fe30: 73 63 72 69 62 65 73 20 61 20 72 61 6e 67 65 20 scribes a range
fe40: 6f 66 20 6c 69 74 65 72 61 6c 20 74 65 78 74 0a of literal text.
fe50: 20 2a 09 09 09 09 74 68 61 74 20 69 73 20 70 61 *....that is pa
fe60: 72 74 20 6f 66 20 61 20 77 6f 72 64 2e 20 4e 75 rt of a word. Nu
fe70: 6d 43 6f 6d 70 6f 6e 65 6e 74 73 20 69 73 0a 20 mComponents is.
fe80: 2a 09 09 09 09 61 6c 77 61 79 73 20 30 2e 0a 20 *....always 0..
fe90: 2a 20 54 43 4c 5f 54 4f 4b 45 4e 5f 42 53 20 2d * TCL_TOKEN_BS -
fea0: 09 09 54 68 65 20 74 6f 6b 65 6e 20 64 65 73 63 ..The token desc
feb0: 72 69 62 65 73 20 61 20 62 61 63 6b 73 6c 61 73 ribes a backslas
fec0: 68 20 73 65 71 75 65 6e 63 65 20 74 68 61 74 0a h sequence that.
fed0: 20 2a 09 09 09 09 6d 75 73 74 20 62 65 20 63 6f *....must be co
fee0: 6c 6c 61 70 73 65 64 2e 20 4e 75 6d 43 6f 6d 70 llapsed. NumComp
fef0: 6f 6e 65 6e 74 73 20 69 73 20 61 6c 77 61 79 73 onents is always
ff00: 20 30 2e 0a 20 2a 20 54 43 4c 5f 54 4f 4b 45 4e 0.. * TCL_TOKEN
ff10: 5f 43 4f 4d 4d 41 4e 44 20 2d 09 09 54 68 65 20 _COMMAND -..The
ff20: 74 6f 6b 65 6e 20 64 65 73 63 72 69 62 65 73 20 token describes
ff30: 61 20 63 6f 6d 6d 61 6e 64 20 77 68 6f 73 65 20 a command whose
ff40: 72 65 73 75 6c 74 0a 20 2a 09 09 09 09 6d 75 73 result. *....mus
ff50: 74 20 62 65 20 73 75 62 73 74 69 74 75 74 65 64 t be substituted
ff60: 20 69 6e 74 6f 20 74 68 65 20 77 6f 72 64 2e 20 into the word.
ff70: 54 68 65 20 74 6f 6b 65 6e 0a 20 2a 09 09 09 09 The token. *....
ff80: 69 6e 63 6c 75 64 65 73 20 74 68 65 20 65 6e 63 includes the enc
ff90: 6c 6f 73 69 6e 67 20 62 72 61 63 6b 65 74 73 2e losing brackets.
ffa0: 20 4e 75 6d 43 6f 6d 70 6f 6e 65 6e 74 73 0a 20 NumComponents.
ffb0: 2a 09 09 09 09 69 73 20 61 6c 77 61 79 73 20 30 *....is always 0
ffc0: 2e 0a 20 2a 20 54 43 4c 5f 54 4f 4b 45 4e 5f 56 .. * TCL_TOKEN_V
ffd0: 41 52 49 41 42 4c 45 20 2d 09 09 54 68 65 20 74 ARIABLE -..The t
ffe0: 6f 6b 65 6e 20 64 65 73 63 72 69 62 65 73 20 61 oken describes a
fff0: 20 76 61 72 69 61 62 6c 65 20 73 75 62 73 74 69 variable substi
10000 74 75 74 69 6f 6e 2c 0a 20 2a 09 09 09 09 69 6e tution,. *....in
10010 63 6c 75 64 69 6e 67 20 74 68 65 20 64 6f 6c 6c cluding the doll
10020 61 72 20 73 69 67 6e 2c 20 76 61 72 69 61 62 6c ar sign, variabl
10030 65 20 6e 61 6d 65 2c 20 61 6e 64 0a 20 2a 09 09 e name, and. *..
10040 09 09 61 72 72 61 79 20 69 6e 64 65 78 20 28 69 ..array index (i
10050 66 20 74 68 65 72 65 20 69 73 20 6f 6e 65 29 20 f there is one)
10060 75 70 20 74 68 72 6f 75 67 68 20 74 68 65 0a 20 up through the.
10070 2a 09 09 09 09 72 69 67 68 74 20 70 61 72 65 6e *....right paren
10080 74 68 65 73 65 73 2e 20 4e 75 6d 43 6f 6d 70 6f theses. NumCompo
10090 6e 65 6e 74 73 20 74 65 6c 6c 73 20 68 6f 77 0a nents tells how.
100a0 20 2a 09 09 09 09 6d 61 6e 79 20 61 64 64 69 74 *....many addit
100b0 69 6f 6e 61 6c 20 74 6f 6b 65 6e 73 20 66 6f 6c ional tokens fol
100c0 6c 6f 77 20 74 6f 20 72 65 70 72 65 73 65 6e 74 low to represent
100d0 20 74 68 65 0a 20 2a 09 09 09 09 76 61 72 69 61 the. *....varia
100e0 62 6c 65 20 6e 61 6d 65 2e 20 54 68 65 20 66 69 ble name. The fi
100f0 72 73 74 20 74 6f 6b 65 6e 20 77 69 6c 6c 20 62 rst token will b
10100 65 20 61 0a 20 2a 09 09 09 09 54 43 4c 5f 54 4f e a. *....TCL_TO
10110 4b 45 4e 5f 54 45 58 54 20 74 6f 6b 65 6e 20 74 KEN_TEXT token t
10120 68 61 74 20 64 65 73 63 72 69 62 65 73 20 74 68 hat describes th
10130 65 0a 20 2a 09 09 09 09 76 61 72 69 61 62 6c 65 e. *....variable
10140 20 6e 61 6d 65 2e 20 49 66 20 74 68 65 20 76 61 name. If the va
10150 72 69 61 62 6c 65 20 69 73 20 61 6e 20 61 72 72 riable is an arr
10160 61 79 0a 20 2a 09 09 09 09 72 65 66 65 72 65 6e ay. *....referen
10170 63 65 20 74 68 65 6e 20 74 68 65 72 65 20 77 69 ce then there wi
10180 6c 6c 20 62 65 20 6f 6e 65 20 6f 72 20 6d 6f 72 ll be one or mor
10190 65 0a 20 2a 09 09 09 09 61 64 64 69 74 69 6f 6e e. *....addition
101a0 61 6c 20 74 6f 6b 65 6e 73 2c 20 6f 66 20 74 79 al tokens, of ty
101b0 70 65 20 54 43 4c 5f 54 4f 4b 45 4e 5f 54 45 58 pe TCL_TOKEN_TEX
101c0 54 2c 0a 20 2a 09 09 09 09 54 43 4c 5f 54 4f 4b T,. *....TCL_TOK
101d0 45 4e 5f 42 53 2c 20 54 43 4c 5f 54 4f 4b 45 4e EN_BS, TCL_TOKEN
101e0 5f 43 4f 4d 4d 41 4e 44 2c 20 61 6e 64 0a 20 2a _COMMAND, and. *
101f0 09 09 09 09 54 43 4c 5f 54 4f 4b 45 4e 5f 56 41 ....TCL_TOKEN_VA
10200 52 49 41 42 4c 45 2c 20 74 68 61 74 20 64 65 73 RIABLE, that des
10210 63 72 69 62 65 20 74 68 65 20 61 72 72 61 79 0a cribe the array.
10220 20 2a 09 09 09 09 69 6e 64 65 78 3b 20 6e 75 6d *....index; num
10230 43 6f 6d 70 6f 6e 65 6e 74 73 20 63 6f 75 6e 74 Components count
10240 73 20 74 68 65 20 74 6f 74 61 6c 20 6e 75 6d 62 s the total numb
10250 65 72 0a 20 2a 09 09 09 09 6f 66 20 6e 65 73 74 er. *....of nest
10260 65 64 20 74 6f 6b 65 6e 73 20 74 68 61 74 20 6d ed tokens that m
10270 61 6b 65 20 75 70 20 74 68 65 20 76 61 72 69 61 ake up the varia
10280 62 6c 65 0a 20 2a 09 09 09 09 72 65 66 65 72 65 ble. *....refere
10290 6e 63 65 2c 20 69 6e 63 6c 75 64 69 6e 67 20 73 nce, including s
102a0 75 62 2d 74 6f 6b 65 6e 73 20 6f 66 0a 20 2a 09 ub-tokens of. *.
102b0 09 09 09 54 43 4c 5f 54 4f 4b 45 4e 5f 56 41 52 ...TCL_TOKEN_VAR
102c0 49 41 42 4c 45 20 74 6f 6b 65 6e 73 2e 0a 20 2a IABLE tokens.. *
102d0 20 54 43 4c 5f 54 4f 4b 45 4e 5f 53 55 42 5f 45 TCL_TOKEN_SUB_E
102e0 58 50 52 20 2d 09 09 54 68 65 20 74 6f 6b 65 6e XPR -..The token
102f0 20 64 65 73 63 72 69 62 65 73 20 6f 6e 65 20 73 describes one s
10300 75 62 65 78 70 72 65 73 73 69 6f 6e 20 6f 66 20 ubexpression of
10310 61 6e 0a 20 2a 09 09 09 09 65 78 70 72 65 73 73 an. *....express
10320 69 6f 6e 2c 20 66 72 6f 6d 20 74 68 65 20 66 69 ion, from the fi
10330 72 73 74 20 6e 6f 6e 2d 62 6c 61 6e 6b 20 63 68 rst non-blank ch
10340 61 72 61 63 74 65 72 0a 20 2a 09 09 09 09 6f 66 aracter. *....of
10350 20 74 68 65 20 73 75 62 65 78 70 72 65 73 73 69 the subexpressi
10360 6f 6e 20 75 70 20 74 6f 20 62 75 74 20 6e 6f 74 on up to but not
10370 20 69 6e 63 6c 75 64 69 6e 67 0a 20 2a 09 09 09 including. *...
10380 09 74 68 65 20 73 70 61 63 65 2c 20 62 72 61 63 .the space, brac
10390 65 2c 20 6f 72 20 62 72 61 63 6b 65 74 20 74 68 e, or bracket th
103a0 61 74 20 74 65 72 6d 69 6e 61 74 65 73 0a 20 2a at terminates. *
103b0 09 09 09 09 74 68 65 20 73 75 62 65 78 70 72 65 ....the subexpre
103c0 73 73 69 6f 6e 2e 20 4e 75 6d 43 6f 6d 70 6f 6e ssion. NumCompon
103d0 65 6e 74 73 20 63 6f 75 6e 74 73 20 74 68 65 0a ents counts the.
103e0 20 2a 09 09 09 09 74 6f 74 61 6c 20 6e 75 6d 62 *....total numb
103f0 65 72 20 6f 66 20 66 6f 6c 6c 6f 77 69 6e 67 20 er of following
10400 73 75 62 74 6f 6b 65 6e 73 20 74 68 61 74 20 6d subtokens that m
10410 61 6b 65 0a 20 2a 09 09 09 09 75 70 20 74 68 65 ake. *....up the
10420 20 73 75 62 65 78 70 72 65 73 73 69 6f 6e 3b 20 subexpression;
10430 74 68 69 73 20 69 6e 63 6c 75 64 65 73 20 61 6c this includes al
10440 6c 0a 20 2a 09 09 09 09 73 75 62 74 6f 6b 65 6e l. *....subtoken
10450 73 20 66 6f 72 20 61 6e 79 20 6e 65 73 74 65 64 s for any nested
10460 20 54 43 4c 5f 54 4f 4b 45 4e 5f 53 55 42 5f 45 TCL_TOKEN_SUB_E
10470 58 50 52 0a 20 2a 09 09 09 09 74 6f 6b 65 6e 73 XPR. *....tokens
10480 2e 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 61 . For example, a
10490 20 6e 75 6d 65 72 69 63 20 76 61 6c 75 65 20 75 numeric value u
104a0 73 65 64 20 61 73 20 61 0a 20 2a 09 09 09 09 70 sed as a. *....p
104b0 72 69 6d 69 74 69 76 65 20 6f 70 65 72 61 6e 64 rimitive operand
104c0 20 69 73 20 64 65 73 63 72 69 62 65 64 20 62 79 is described by
104d0 20 61 0a 20 2a 09 09 09 09 54 43 4c 5f 54 4f 4b a. *....TCL_TOK
104e0 45 4e 5f 53 55 42 5f 45 58 50 52 20 74 6f 6b 65 EN_SUB_EXPR toke
104f0 6e 20 66 6f 6c 6c 6f 77 65 64 20 62 79 20 61 0a n followed by a.
10500 20 2a 09 09 09 09 54 43 4c 5f 54 4f 4b 45 4e 5f *....TCL_TOKEN_
10510 54 45 58 54 20 74 6f 6b 65 6e 2e 20 41 20 62 69 TEXT token. A bi
10520 6e 61 72 79 20 73 75 62 65 78 70 72 65 73 73 69 nary subexpressi
10530 6f 6e 0a 20 2a 09 09 09 09 69 73 20 64 65 73 63 on. *....is desc
10540 72 69 62 65 64 20 62 79 20 61 20 54 43 4c 5f 54 ribed by a TCL_T
10550 4f 4b 45 4e 5f 53 55 42 5f 45 58 50 52 20 74 6f OKEN_SUB_EXPR to
10560 6b 65 6e 0a 20 2a 09 09 09 09 66 6f 6c 6c 6f 77 ken. *....follow
10570 65 64 20 62 79 20 74 68 65 20 54 43 4c 5f 54 4f ed by the TCL_TO
10580 4b 45 4e 5f 4f 50 45 52 41 54 4f 52 20 74 6f 6b KEN_OPERATOR tok
10590 65 6e 20 66 6f 72 0a 20 2a 09 09 09 09 74 68 65 en for. *....the
105a0 20 6f 70 65 72 61 74 6f 72 2c 20 74 68 65 6e 20 operator, then
105b0 54 43 4c 5f 54 4f 4b 45 4e 5f 53 55 42 5f 45 58 TCL_TOKEN_SUB_EX
105c0 50 52 20 74 6f 6b 65 6e 73 0a 20 2a 09 09 09 09 PR tokens. *....
105d0 66 6f 72 20 74 68 65 20 6c 65 66 74 20 74 68 65 for the left the
105e0 6e 20 74 68 65 20 72 69 67 68 74 20 6f 70 65 72 n the right oper
105f0 61 6e 64 73 2e 0a 20 2a 20 54 43 4c 5f 54 4f 4b ands.. * TCL_TOK
10600 45 4e 5f 4f 50 45 52 41 54 4f 52 20 2d 09 09 54 EN_OPERATOR -..T
10610 68 65 20 74 6f 6b 65 6e 20 64 65 73 63 72 69 62 he token describ
10620 65 73 20 6f 6e 65 20 65 78 70 72 65 73 73 69 6f es one expressio
10630 6e 20 6f 70 65 72 61 74 6f 72 2e 0a 20 2a 09 09 n operator.. *..
10640 09 09 41 6e 20 6f 70 65 72 61 74 6f 72 20 6d 69 ..An operator mi
10650 67 68 74 20 62 65 20 74 68 65 20 6e 61 6d 65 20 ght be the name
10660 6f 66 20 61 20 6d 61 74 68 0a 20 2a 09 09 09 09 of a math. *....
10670 66 75 6e 63 74 69 6f 6e 20 73 75 63 68 20 61 73 function such as
10680 20 22 61 62 73 22 2e 20 41 20 54 43 4c 5f 54 4f "abs". A TCL_TO
10690 4b 45 4e 5f 4f 50 45 52 41 54 4f 52 0a 20 2a 09 KEN_OPERATOR. *.
106a0 09 09 09 74 6f 6b 65 6e 20 69 73 20 61 6c 77 61 ...token is alwa
106b0 79 73 20 70 72 65 63 65 64 65 64 20 62 79 20 6f ys preceded by o
106c0 6e 65 0a 20 2a 09 09 09 09 54 43 4c 5f 54 4f 4b ne. *....TCL_TOK
106d0 45 4e 5f 53 55 42 5f 45 58 50 52 20 74 6f 6b 65 EN_SUB_EXPR toke
106e0 6e 20 66 6f 72 20 74 68 65 20 6f 70 65 72 61 74 n for the operat
106f0 6f 72 27 73 0a 20 2a 09 09 09 09 73 75 62 65 78 or's. *....subex
10700 70 72 65 73 73 69 6f 6e 2c 20 61 6e 64 20 69 73 pression, and is
10710 20 66 6f 6c 6c 6f 77 65 64 20 62 79 20 7a 65 72 followed by zer
10720 6f 20 6f 72 20 6d 6f 72 65 0a 20 2a 09 09 09 09 o or more. *....
10730 54 43 4c 5f 54 4f 4b 45 4e 5f 53 55 42 5f 45 58 TCL_TOKEN_SUB_EX
10740 50 52 20 74 6f 6b 65 6e 73 20 66 6f 72 20 74 68 PR tokens for th
10750 65 20 6f 70 65 72 61 74 6f 72 27 73 0a 20 2a 09 e operator's. *.
10760 09 09 09 6f 70 65 72 61 6e 64 73 2e 20 4e 75 6d ...operands. Num
10770 43 6f 6d 70 6f 6e 65 6e 74 73 20 69 73 20 61 6c Components is al
10780 77 61 79 73 20 30 2e 0a 20 2a 20 54 43 4c 5f 54 ways 0.. * TCL_T
10790 4f 4b 45 4e 5f 45 58 50 41 4e 44 5f 57 4f 52 44 OKEN_EXPAND_WORD
107a0 20 2d 09 54 68 69 73 20 74 6f 6b 65 6e 20 69 73 -.This token is
107b0 20 6a 75 73 74 20 6c 69 6b 65 20 54 43 4c 5f 54 just like TCL_T
107c0 4f 4b 45 4e 5f 57 4f 52 44 20 65 78 63 65 70 74 OKEN_WORD except
107d0 0a 20 2a 09 09 09 09 74 68 61 74 20 69 74 20 6d . *....that it m
107e0 61 72 6b 73 20 61 20 77 6f 72 64 20 74 68 61 74 arks a word that
107f0 20 62 65 67 61 6e 20 77 69 74 68 20 74 68 65 0a began with the.
10800 20 2a 09 09 09 09 6c 69 74 65 72 61 6c 20 63 68 *....literal ch
10810 61 72 61 63 74 65 72 20 70 72 65 66 69 78 20 22 aracter prefix "
10820 7b 2a 7d 22 2e 20 54 68 69 73 20 77 6f 72 64 20 {*}". This word
10830 69 73 0a 20 2a 09 09 09 09 6d 61 72 6b 65 64 20 is. *....marked
10840 74 6f 20 62 65 20 65 78 70 61 6e 64 65 64 20 2d to be expanded -
10850 20 74 68 61 74 20 69 73 2c 20 62 72 6f 6b 65 6e that is, broken
10860 20 69 6e 74 6f 0a 20 2a 09 09 09 09 77 6f 72 64 into. *....word
10870 73 20 61 66 74 65 72 20 73 75 62 73 74 69 74 75 s after substitu
10880 74 69 6f 6e 20 69 73 20 63 6f 6d 70 6c 65 74 65 tion is complete
10890 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 .. */..#define T
108a0 43 4c 5f 54 4f 4b 45 4e 5f 57 4f 52 44 09 09 31 CL_TOKEN_WORD..1
108b0 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 54 4f 4b .#define TCL_TOK
108c0 45 4e 5f 53 49 4d 50 4c 45 5f 57 4f 52 44 09 32 EN_SIMPLE_WORD.2
108d0 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 54 4f 4b .#define TCL_TOK
108e0 45 4e 5f 54 45 58 54 09 09 34 0a 23 64 65 66 69 EN_TEXT..4.#defi
108f0 6e 65 20 54 43 4c 5f 54 4f 4b 45 4e 5f 42 53 09 ne TCL_TOKEN_BS.
10900 09 38 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 54 .8.#define TCL_T
10910 4f 4b 45 4e 5f 43 4f 4d 4d 41 4e 44 09 31 36 0a OKEN_COMMAND.16.
10920 23 64 65 66 69 6e 65 20 54 43 4c 5f 54 4f 4b 45 #define TCL_TOKE
10930 4e 5f 56 41 52 49 41 42 4c 45 09 33 32 0a 23 64 N_VARIABLE.32.#d
10940 65 66 69 6e 65 20 54 43 4c 5f 54 4f 4b 45 4e 5f efine TCL_TOKEN_
10950 53 55 42 5f 45 58 50 52 09 36 34 0a 23 64 65 66 SUB_EXPR.64.#def
10960 69 6e 65 20 54 43 4c 5f 54 4f 4b 45 4e 5f 4f 50 ine TCL_TOKEN_OP
10970 45 52 41 54 4f 52 09 31 32 38 0a 23 64 65 66 69 ERATOR.128.#defi
10980 6e 65 20 54 43 4c 5f 54 4f 4b 45 4e 5f 45 58 50 ne TCL_TOKEN_EXP
10990 41 4e 44 5f 57 4f 52 44 09 32 35 36 0a 0a 2f 2a AND_WORD.256../*
109a0 0a 20 2a 20 50 61 72 73 69 6e 67 20 65 72 72 6f . * Parsing erro
109b0 72 20 74 79 70 65 73 2e 20 4f 6e 20 61 6e 79 20 r types. On any
109c0 70 61 72 73 69 6e 67 20 65 72 72 6f 72 2c 20 6f parsing error, o
109d0 6e 65 20 6f 66 20 74 68 65 73 65 20 76 61 6c 75 ne of these valu
109e0 65 73 20 77 69 6c 6c 20 62 65 0a 20 2a 20 73 74 es will be. * st
109f0 6f 72 65 64 20 69 6e 20 74 68 65 20 65 72 72 6f ored in the erro
10a00 72 20 66 69 65 6c 64 20 6f 66 20 74 68 65 20 54 r field of the T
10a10 63 6c 5f 50 61 72 73 65 20 73 74 72 75 63 74 75 cl_Parse structu
10a20 72 65 20 64 65 66 69 6e 65 64 20 62 65 6c 6f 77 re defined below
10a30 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 .. */..#define T
10a40 43 4c 5f 50 41 52 53 45 5f 53 55 43 43 45 53 53 CL_PARSE_SUCCESS
10a50 09 09 30 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f ..0.#define TCL_
10a60 50 41 52 53 45 5f 51 55 4f 54 45 5f 45 58 54 52 PARSE_QUOTE_EXTR
10a70 41 09 09 31 0a 23 64 65 66 69 6e 65 20 54 43 4c A..1.#define TCL
10a80 5f 50 41 52 53 45 5f 42 52 41 43 45 5f 45 58 54 _PARSE_BRACE_EXT
10a90 52 41 09 09 32 0a 23 64 65 66 69 6e 65 20 54 43 RA..2.#define TC
10aa0 4c 5f 50 41 52 53 45 5f 4d 49 53 53 49 4e 47 5f L_PARSE_MISSING_
10ab0 42 52 41 43 45 09 09 33 0a 23 64 65 66 69 6e 65 BRACE..3.#define
10ac0 20 54 43 4c 5f 50 41 52 53 45 5f 4d 49 53 53 49 TCL_PARSE_MISSI
10ad0 4e 47 5f 42 52 41 43 4b 45 54 09 34 0a 23 64 65 NG_BRACKET.4.#de
10ae0 66 69 6e 65 20 54 43 4c 5f 50 41 52 53 45 5f 4d fine TCL_PARSE_M
10af0 49 53 53 49 4e 47 5f 50 41 52 45 4e 09 09 35 0a ISSING_PAREN..5.
10b00 23 64 65 66 69 6e 65 20 54 43 4c 5f 50 41 52 53 #define TCL_PARS
10b10 45 5f 4d 49 53 53 49 4e 47 5f 51 55 4f 54 45 09 E_MISSING_QUOTE.
10b20 09 36 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 50 .6.#define TCL_P
10b30 41 52 53 45 5f 4d 49 53 53 49 4e 47 5f 56 41 52 ARSE_MISSING_VAR
10b40 5f 42 52 41 43 45 09 37 0a 23 64 65 66 69 6e 65 _BRACE.7.#define
10b50 20 54 43 4c 5f 50 41 52 53 45 5f 53 59 4e 54 41 TCL_PARSE_SYNTA
10b60 58 09 09 38 0a 23 64 65 66 69 6e 65 20 54 43 4c X..8.#define TCL
10b70 5f 50 41 52 53 45 5f 42 41 44 5f 4e 55 4d 42 45 _PARSE_BAD_NUMBE
10b80 52 09 09 39 0a 0a 2f 2a 0a 20 2a 20 41 20 73 74 R..9../*. * A st
10b90 72 75 63 74 75 72 65 20 6f 66 20 74 68 65 20 66 ructure of the f
10ba0 6f 6c 6c 6f 77 69 6e 67 20 74 79 70 65 20 69 73 ollowing type is
10bb0 20 66 69 6c 6c 65 64 20 69 6e 20 62 79 20 54 63 filled in by Tc
10bc0 6c 5f 50 61 72 73 65 43 6f 6d 6d 61 6e 64 2e 20 l_ParseCommand.
10bd0 49 74 0a 20 2a 20 64 65 73 63 72 69 62 65 73 20 It. * describes
10be0 61 20 73 69 6e 67 6c 65 20 63 6f 6d 6d 61 6e 64 a single command
10bf0 20 70 61 72 73 65 64 20 66 72 6f 6d 20 61 6e 20 parsed from an
10c00 69 6e 70 75 74 20 73 74 72 69 6e 67 2e 0a 20 2a input string.. *
10c10 2f 0a 0a 23 64 65 66 69 6e 65 20 4e 55 4d 5f 53 /..#define NUM_S
10c20 54 41 54 49 43 5f 54 4f 4b 45 4e 53 20 32 30 0a TATIC_TOKENS 20.
10c30 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20 .typedef struct
10c40 54 63 6c 5f 50 61 72 73 65 20 7b 0a 20 20 20 20 Tcl_Parse {.
10c50 63 6f 6e 73 74 20 63 68 61 72 20 2a 63 6f 6d 6d const char *comm
10c60 65 6e 74 53 74 61 72 74 3b 09 2f 2a 20 50 6f 69 entStart;./* Poi
10c70 6e 74 65 72 20 74 6f 20 23 20 74 68 61 74 20 62 nter to # that b
10c80 65 67 69 6e 73 20 74 68 65 20 66 69 72 73 74 20 egins the first
10c90 6f 66 20 6f 6e 65 0a 09 09 09 09 20 2a 20 6f 72 of one..... * or
10ca0 20 6d 6f 72 65 20 63 6f 6d 6d 65 6e 74 73 20 70 more comments p
10cb0 72 65 63 65 64 69 6e 67 20 74 68 65 20 63 6f 6d receding the com
10cc0 6d 61 6e 64 2e 20 2a 2f 0a 20 20 20 20 54 63 6c mand. */. Tcl
10cd0 5f 53 69 7a 65 20 63 6f 6d 6d 65 6e 74 53 69 7a _Size commentSiz
10ce0 65 3b 09 2f 2a 20 4e 75 6d 62 65 72 20 6f 66 20 e;./* Number of
10cf0 62 79 74 65 73 20 69 6e 20 63 6f 6d 6d 65 6e 74 bytes in comment
10d00 73 20 28 75 70 20 74 68 72 6f 75 67 68 0a 09 09 s (up through...
10d10 09 09 20 2a 20 6e 65 77 6c 69 6e 65 20 63 68 61 .. * newline cha
10d20 72 61 63 74 65 72 20 74 68 61 74 20 74 65 72 6d racter that term
10d30 69 6e 61 74 65 73 20 74 68 65 20 6c 61 73 74 0a inates the last.
10d40 09 09 09 09 20 2a 20 63 6f 6d 6d 65 6e 74 29 2e .... * comment).
10d50 20 49 66 20 74 68 65 72 65 20 77 65 72 65 20 6e If there were n
10d60 6f 20 63 6f 6d 6d 65 6e 74 73 2c 20 74 68 69 73 o comments, this
10d70 0a 09 09 09 09 20 2a 20 66 69 65 6c 64 20 69 73 ..... * field is
10d80 20 30 2e 20 2a 2f 0a 20 20 20 20 63 6f 6e 73 74 0. */. const
10d90 20 63 68 61 72 20 2a 63 6f 6d 6d 61 6e 64 53 74 char *commandSt
10da0 61 72 74 3b 09 2f 2a 20 46 69 72 73 74 20 63 68 art;./* First ch
10db0 61 72 61 63 74 65 72 20 69 6e 20 66 69 72 73 74 aracter in first
10dc0 20 77 6f 72 64 20 6f 66 0a 09 09 09 09 20 2a 20 word of..... *
10dd0 63 6f 6d 6d 61 6e 64 2e 20 2a 2f 0a 20 20 20 20 command. */.
10de0 54 63 6c 5f 53 69 7a 65 20 63 6f 6d 6d 61 6e 64 Tcl_Size command
10df0 53 69 7a 65 3b 09 2f 2a 20 4e 75 6d 62 65 72 20 Size;./* Number
10e00 6f 66 20 62 79 74 65 73 20 69 6e 20 63 6f 6d 6d of bytes in comm
10e10 61 6e 64 2c 20 69 6e 63 6c 75 64 69 6e 67 20 66 and, including f
10e20 69 72 73 74 0a 09 09 09 09 20 2a 20 63 68 61 72 irst..... * char
10e30 61 63 74 65 72 20 6f 66 20 66 69 72 73 74 20 77 acter of first w
10e40 6f 72 64 2c 20 75 70 20 74 68 72 6f 75 67 68 20 ord, up through
10e50 74 68 65 0a 09 09 09 09 20 2a 20 74 65 72 6d 69 the..... * termi
10e60 6e 61 74 69 6e 67 20 6e 65 77 6c 69 6e 65 2c 20 nating newline,
10e70 63 6c 6f 73 65 20 62 72 61 63 6b 65 74 2c 20 6f close bracket, o
10e80 72 0a 09 09 09 09 20 2a 20 73 65 6d 69 63 6f 6c r..... * semicol
10e90 6f 6e 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 53 on. */. Tcl_S
10ea0 69 7a 65 20 6e 75 6d 57 6f 72 64 73 3b 09 09 2f ize numWords;../
10eb0 2a 20 54 6f 74 61 6c 20 6e 75 6d 62 65 72 20 6f * Total number o
10ec0 66 20 77 6f 72 64 73 20 69 6e 20 63 6f 6d 6d 61 f words in comma
10ed0 6e 64 2e 20 4d 61 79 20 62 65 0a 09 09 09 09 20 nd. May be.....
10ee0 2a 20 30 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f * 0. */. Tcl_
10ef0 54 6f 6b 65 6e 20 2a 74 6f 6b 65 6e 50 74 72 3b Token *tokenPtr;
10f00 09 2f 2a 20 50 6f 69 6e 74 65 72 20 74 6f 20 66 ./* Pointer to f
10f10 69 72 73 74 20 74 6f 6b 65 6e 20 72 65 70 72 65 irst token repre
10f20 73 65 6e 74 69 6e 67 20 74 68 65 0a 09 09 09 09 senting the.....
10f30 20 2a 20 77 6f 72 64 73 20 6f 66 20 74 68 65 20 * words of the
10f40 63 6f 6d 6d 61 6e 64 2e 20 49 6e 69 74 69 61 6c command. Initial
10f50 6c 79 20 70 6f 69 6e 74 73 20 74 6f 0a 09 09 09 ly points to....
10f60 09 20 2a 20 73 74 61 74 69 63 54 6f 6b 65 6e 73 . * staticTokens
10f70 2c 20 62 75 74 20 6d 61 79 20 63 68 61 6e 67 65 , but may change
10f80 20 74 6f 20 70 6f 69 6e 74 20 74 6f 0a 09 09 09 to point to....
10f90 09 20 2a 20 6d 61 6c 6c 6f 63 2d 65 64 20 73 70 . * malloc-ed sp
10fa0 61 63 65 20 69 66 20 63 6f 6d 6d 61 6e 64 20 65 ace if command e
10fb0 78 63 65 65 64 73 20 73 70 61 63 65 20 69 6e 0a xceeds space in.
10fc0 09 09 09 09 20 2a 20 73 74 61 74 69 63 54 6f 6b .... * staticTok
10fd0 65 6e 73 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f ens. */. Tcl_
10fe0 53 69 7a 65 20 6e 75 6d 54 6f 6b 65 6e 73 3b 09 Size numTokens;.
10ff0 09 2f 2a 20 54 6f 74 61 6c 20 6e 75 6d 62 65 72 ./* Total number
11000 20 6f 66 20 74 6f 6b 65 6e 73 20 69 6e 20 63 6f of tokens in co
11010 6d 6d 61 6e 64 2e 20 2a 2f 0a 20 20 20 20 54 63 mmand. */. Tc
11020 6c 5f 53 69 7a 65 20 74 6f 6b 65 6e 73 41 76 61 l_Size tokensAva
11030 69 6c 61 62 6c 65 3b 09 2f 2a 20 54 6f 74 61 6c ilable;./* Total
11040 20 6e 75 6d 62 65 72 20 6f 66 20 74 6f 6b 65 6e number of token
11050 73 20 61 76 61 69 6c 61 62 6c 65 20 61 74 0a 09 s available at..
11060 09 09 09 20 2a 20 2a 74 6f 6b 65 6e 50 74 72 2e ... * *tokenPtr.
11070 20 2a 2f 0a 20 20 20 20 69 6e 74 20 65 72 72 6f */. int erro
11080 72 54 79 70 65 3b 09 09 2f 2a 20 4f 6e 65 20 6f rType;../* One o
11090 66 20 74 68 65 20 70 61 72 73 69 6e 67 20 65 72 f the parsing er
110a0 72 6f 72 20 74 79 70 65 73 20 64 65 66 69 6e 65 ror types define
110b0 64 0a 09 09 09 09 20 2a 20 61 62 6f 76 65 2e 20 d..... * above.
110c0 2a 2f 0a 20 20 20 20 69 6e 74 20 69 6e 63 6f 6d */. int incom
110d0 70 6c 65 74 65 3b 09 09 2f 2a 20 54 68 69 73 20 plete;../* This
110e0 66 69 65 6c 64 20 69 73 20 73 65 74 20 74 6f 20 field is set to
110f0 31 20 62 79 20 54 63 6c 5f 50 61 72 73 65 43 6f 1 by Tcl_ParseCo
11100 6d 6d 61 6e 64 0a 09 09 09 09 20 2a 20 69 66 20 mmand..... * if
11110 74 68 65 20 63 6f 6d 6d 61 6e 64 20 61 70 70 65 the command appe
11120 61 72 73 20 74 6f 20 62 65 20 69 6e 63 6f 6d 70 ars to be incomp
11130 6c 65 74 65 2e 0a 09 09 09 09 20 2a 20 54 68 69 lete...... * Thi
11140 73 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 69 73 s information is
11150 20 75 73 65 64 20 62 79 0a 09 09 09 09 20 2a 20 used by..... *
11160 54 63 6c 5f 43 6f 6d 6d 61 6e 64 43 6f 6d 70 6c Tcl_CommandCompl
11170 65 74 65 2e 20 2a 2f 0a 0a 20 20 20 20 2f 2a 0a ete. */.. /*.
11180 20 20 20 20 20 2a 20 54 68 65 20 66 69 65 6c 64 * The field
11190 73 20 62 65 6c 6f 77 20 61 72 65 20 69 6e 74 65 s below are inte
111a0 6e 64 65 64 20 6f 6e 6c 79 20 66 6f 72 20 74 68 nded only for th
111b0 65 20 70 72 69 76 61 74 65 20 75 73 65 20 6f 66 e private use of
111c0 20 74 68 65 20 70 61 72 73 65 72 2e 0a 20 20 20 the parser..
111d0 20 20 2a 20 54 68 65 79 20 73 68 6f 75 6c 64 20 * They should
111e0 6e 6f 74 20 62 65 20 75 73 65 64 20 62 79 20 66 not be used by f
111f0 75 6e 63 74 69 6f 6e 73 20 74 68 61 74 20 69 6e unctions that in
11200 76 6f 6b 65 20 54 63 6c 5f 50 61 72 73 65 43 6f voke Tcl_ParseCo
11210 6d 6d 61 6e 64 2e 0a 20 20 20 20 20 2a 2f 0a 0a mmand.. */..
11220 20 20 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a const char *
11230 73 74 72 69 6e 67 3b 09 09 2f 2a 20 54 68 65 20 string;../* The
11240 6f 72 69 67 69 6e 61 6c 20 63 6f 6d 6d 61 6e 64 original command
11250 20 73 74 72 69 6e 67 20 70 61 73 73 65 64 20 74 string passed t
11260 6f 0a 09 09 09 09 20 2a 20 54 63 6c 5f 50 61 72 o..... * Tcl_Par
11270 73 65 43 6f 6d 6d 61 6e 64 2e 20 2a 2f 0a 20 20 seCommand. */.
11280 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 65 6e const char *en
11290 64 3b 09 09 2f 2a 20 50 6f 69 6e 74 73 20 74 6f d;../* Points to
112a0 20 74 68 65 20 63 68 61 72 61 63 74 65 72 20 6a the character j
112b0 75 73 74 20 61 66 74 65 72 20 74 68 65 20 6c 61 ust after the la
112c0 73 74 0a 09 09 09 09 20 2a 20 6f 6e 65 20 69 6e st..... * one in
112d0 20 74 68 65 20 63 6f 6d 6d 61 6e 64 20 73 74 72 the command str
112e0 69 6e 67 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f ing. */. Tcl_
112f0 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 3b 09 Interp *interp;.
11300 09 2f 2a 20 49 6e 74 65 72 70 72 65 74 65 72 20 ./* Interpreter
11310 74 6f 20 75 73 65 20 66 6f 72 20 65 72 72 6f 72 to use for error
11320 20 72 65 70 6f 72 74 69 6e 67 2c 20 6f 72 0a 09 reporting, or..
11330 09 09 09 20 2a 20 4e 55 4c 4c 2e 20 2a 2f 0a 20 ... * NULL. */.
11340 20 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 74 const char *t
11350 65 72 6d 3b 09 09 2f 2a 20 50 6f 69 6e 74 73 20 erm;../* Points
11360 74 6f 20 63 68 61 72 61 63 74 65 72 20 69 6e 20 to character in
11370 73 74 72 69 6e 67 20 74 68 61 74 0a 09 09 09 09 string that.....
11380 20 2a 20 74 65 72 6d 69 6e 61 74 65 64 20 6d 6f * terminated mo
11390 73 74 20 72 65 63 65 6e 74 20 74 6f 6b 65 6e 2e st recent token.
113a0 20 46 69 6c 6c 65 64 20 69 6e 20 62 79 0a 09 09 Filled in by...
113b0 09 09 20 2a 20 50 61 72 73 65 54 6f 6b 65 6e 73 .. * ParseTokens
113c0 2e 20 49 66 20 61 6e 20 65 72 72 6f 72 20 6f 63 . If an error oc
113d0 63 75 72 73 2c 20 70 6f 69 6e 74 73 20 74 6f 0a curs, points to.
113e0 09 09 09 09 20 2a 20 62 65 67 69 6e 6e 69 6e 67 .... * beginning
113f0 20 6f 66 20 72 65 67 69 6f 6e 20 77 68 65 72 65 of region where
11400 20 74 68 65 20 65 72 72 6f 72 0a 09 09 09 09 20 the error.....
11410 2a 20 6f 63 63 75 72 72 65 64 20 28 65 2e 67 2e * occurred (e.g.
11420 20 74 68 65 20 6f 70 65 6e 20 62 72 61 63 65 20 the open brace
11430 69 66 20 74 68 65 20 63 6c 6f 73 65 0a 09 09 09 if the close....
11440 09 20 2a 20 62 72 61 63 65 20 69 73 20 6d 69 73 . * brace is mis
11450 73 69 6e 67 29 2e 20 2a 2f 0a 20 20 20 20 54 63 sing). */. Tc
11460 6c 5f 54 6f 6b 65 6e 20 73 74 61 74 69 63 54 6f l_Token staticTo
11470 6b 65 6e 73 5b 4e 55 4d 5f 53 54 41 54 49 43 5f kens[NUM_STATIC_
11480 54 4f 4b 45 4e 53 5d 3b 0a 09 09 09 09 2f 2a 20 TOKENS];...../*
11490 49 6e 69 74 69 61 6c 20 73 70 61 63 65 20 66 6f Initial space fo
114a0 72 20 74 6f 6b 65 6e 73 20 66 6f 72 20 63 6f 6d r tokens for com
114b0 6d 61 6e 64 2e 20 54 68 69 73 0a 09 09 09 09 20 mand. This.....
114c0 2a 20 73 70 61 63 65 20 73 68 6f 75 6c 64 20 62 * space should b
114d0 65 20 6c 61 72 67 65 20 65 6e 6f 75 67 68 20 74 e large enough t
114e0 6f 20 61 63 63 6f 6d 6d 6f 64 61 74 65 0a 09 09 o accommodate...
114f0 09 09 20 2a 20 6d 6f 73 74 20 63 6f 6d 6d 61 6e .. * most comman
11500 64 73 3b 20 64 79 6e 61 6d 69 63 20 73 70 61 63 ds; dynamic spac
11510 65 20 69 73 20 61 6c 6c 6f 63 61 74 65 64 0a 09 e is allocated..
11520 09 09 09 20 2a 20 66 6f 72 20 76 65 72 79 20 6c ... * for very l
11530 61 72 67 65 20 63 6f 6d 6d 61 6e 64 73 20 74 68 arge commands th
11540 61 74 20 64 6f 6e 27 74 20 66 69 74 0a 09 09 09 at don't fit....
11550 09 20 2a 20 68 65 72 65 2e 20 2a 2f 0a 7d 20 54 . * here. */.} T
11560 63 6c 5f 50 61 72 73 65 3b 0a 0c 0a 2f 2a 0a 20 cl_Parse;.../*.
11570 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d *---------------
11580 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
11590 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
115a0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
115b0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a -------------. *
115c0 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 73 The following s
115d0 74 72 75 63 74 75 72 65 20 72 65 70 72 65 73 65 tructure represe
115e0 6e 74 73 20 61 20 75 73 65 72 2d 64 65 66 69 6e nts a user-defin
115f0 65 64 20 65 6e 63 6f 64 69 6e 67 2e 20 49 74 20 ed encoding. It
11600 63 6f 6c 6c 65 63 74 73 0a 20 2a 20 74 6f 67 65 collects. * toge
11610 74 68 65 72 20 61 6c 6c 20 74 68 65 20 66 75 6e ther all the fun
11620 63 74 69 6f 6e 73 20 74 68 61 74 20 61 72 65 20 ctions that are
11630 75 73 65 64 20 62 79 20 74 68 65 20 73 70 65 63 used by the spec
11640 69 66 69 63 20 65 6e 63 6f 64 69 6e 67 2e 0a 20 ific encoding..
11650 2a 2f 0a 0a 74 79 70 65 64 65 66 20 73 74 72 75 */..typedef stru
11660 63 74 20 54 63 6c 5f 45 6e 63 6f 64 69 6e 67 54 ct Tcl_EncodingT
11670 79 70 65 20 7b 0a 20 20 20 20 63 6f 6e 73 74 20 ype {. const
11680 63 68 61 72 20 2a 65 6e 63 6f 64 69 6e 67 4e 61 char *encodingNa
11690 6d 65 3b 09 2f 2a 20 54 68 65 20 6e 61 6d 65 20 me;./* The name
116a0 6f 66 20 74 68 65 20 65 6e 63 6f 64 69 6e 67 2c of the encoding,
116b0 20 65 2e 67 2e 20 22 65 75 63 2d 6a 70 22 2e 0a e.g. "euc-jp"..
116c0 09 09 09 09 20 2a 20 54 68 69 73 20 6e 61 6d 65 .... * This name
116d0 20 69 73 20 74 68 65 20 75 6e 69 71 75 65 20 6b is the unique k
116e0 65 79 20 66 6f 72 20 74 68 69 73 0a 09 09 09 09 ey for this.....
116f0 20 2a 20 65 6e 63 6f 64 69 6e 67 20 74 79 70 65 * encoding type
11700 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 45 6e 63 . */. Tcl_Enc
11710 6f 64 69 6e 67 43 6f 6e 76 65 72 74 50 72 6f 63 odingConvertProc
11720 20 2a 74 6f 55 74 66 50 72 6f 63 3b 0a 09 09 09 *toUtfProc;....
11730 09 2f 2a 20 46 75 6e 63 74 69 6f 6e 20 74 6f 20 ./* Function to
11740 63 6f 6e 76 65 72 74 20 66 72 6f 6d 20 65 78 74 convert from ext
11750 65 72 6e 61 6c 20 65 6e 63 6f 64 69 6e 67 0a 09 ernal encoding..
11760 09 09 09 20 2a 20 69 6e 74 6f 20 55 54 46 2d 38 ... * into UTF-8
11770 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 45 6e 63 . */. Tcl_Enc
11780 6f 64 69 6e 67 43 6f 6e 76 65 72 74 50 72 6f 63 odingConvertProc
11790 20 2a 66 72 6f 6d 55 74 66 50 72 6f 63 3b 0a 09 *fromUtfProc;..
117a0 09 09 09 2f 2a 20 46 75 6e 63 74 69 6f 6e 20 74 .../* Function t
117b0 6f 20 63 6f 6e 76 65 72 74 20 66 72 6f 6d 20 55 o convert from U
117c0 54 46 2d 38 20 69 6e 74 6f 0a 09 09 09 09 20 2a TF-8 into..... *
117d0 20 65 78 74 65 72 6e 61 6c 20 65 6e 63 6f 64 69 external encodi
117e0 6e 67 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 ng. */. Tcl_F
117f0 72 65 65 50 72 6f 63 20 2a 66 72 65 65 50 72 6f reeProc *freePro
11800 63 3b 09 2f 2a 20 49 66 20 6e 6f 6e 2d 4e 55 4c c;./* If non-NUL
11810 4c 2c 20 66 75 6e 63 74 69 6f 6e 20 74 6f 20 63 L, function to c
11820 61 6c 6c 20 77 68 65 6e 20 74 68 69 73 0a 09 09 all when this...
11830 09 09 20 2a 20 65 6e 63 6f 64 69 6e 67 20 69 73 .. * encoding is
11840 20 64 65 6c 65 74 65 64 2e 20 2a 2f 0a 20 20 20 deleted. */.
11850 20 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 61 74 void *clientDat
11860 61 3b 09 09 2f 2a 20 41 72 62 69 74 72 61 72 79 a;../* Arbitrary
11870 20 76 61 6c 75 65 20 61 73 73 6f 63 69 61 74 65 value associate
11880 64 20 77 69 74 68 20 65 6e 63 6f 64 69 6e 67 0a d with encoding.
11890 09 09 09 09 20 2a 20 74 79 70 65 2e 20 50 61 73 .... * type. Pas
118a0 73 65 64 20 74 6f 20 63 6f 6e 76 65 72 73 69 6f sed to conversio
118b0 6e 20 66 75 6e 63 74 69 6f 6e 73 2e 20 2a 2f 0a n functions. */.
118c0 20 20 20 20 54 63 6c 5f 53 69 7a 65 20 6e 75 6c Tcl_Size nul
118d0 6c 53 69 7a 65 3b 09 09 2f 2a 20 4e 75 6d 62 65 lSize;../* Numbe
118e0 72 20 6f 66 20 7a 65 72 6f 20 62 79 74 65 73 20 r of zero bytes
118f0 74 68 61 74 20 73 69 67 6e 69 66 79 0a 09 09 09 that signify....
11900 09 20 2a 20 65 6e 64 2d 6f 66 2d 73 74 72 69 6e . * end-of-strin
11910 67 20 69 6e 20 74 68 69 73 20 65 6e 63 6f 64 69 g in this encodi
11920 6e 67 2e 20 54 68 69 73 20 6e 75 6d 62 65 72 0a ng. This number.
11930 09 09 09 09 20 2a 20 69 73 20 75 73 65 64 20 74 .... * is used t
11940 6f 20 64 65 74 65 72 6d 69 6e 65 20 74 68 65 20 o determine the
11950 73 6f 75 72 63 65 20 73 74 72 69 6e 67 0a 09 09 source string...
11960 09 09 20 2a 20 6c 65 6e 67 74 68 20 77 68 65 6e .. * length when
11970 20 74 68 65 20 73 72 63 4c 65 6e 20 61 72 67 75 the srcLen argu
11980 6d 65 6e 74 20 69 73 0a 09 09 09 09 20 2a 20 6e ment is..... * n
11990 65 67 61 74 69 76 65 2e 20 4d 75 73 74 20 62 65 egative. Must be
119a0 20 31 2c 20 32 2c 20 6f 72 20 34 2e 20 2a 2f 0a 1, 2, or 4. */.
119b0 7d 20 54 63 6c 5f 45 6e 63 6f 64 69 6e 67 54 79 } Tcl_EncodingTy
119c0 70 65 3b 0a 0a 2f 2a 0a 20 2a 20 54 68 65 20 66 pe;../*. * The f
119d0 6f 6c 6c 6f 77 69 6e 67 20 64 65 66 69 6e 69 74 ollowing definit
119e0 69 6f 6e 73 20 61 72 65 20 75 73 65 64 20 61 73 ions are used as
119f0 20 76 61 6c 75 65 73 20 66 6f 72 20 74 68 65 20 values for the
11a00 63 6f 6e 76 65 72 73 69 6f 6e 20 63 6f 6e 74 72 conversion contr
11a10 6f 6c 0a 20 2a 20 66 6c 61 67 73 20 61 72 67 75 ol. * flags argu
11a20 6d 65 6e 74 20 77 68 65 6e 20 63 6f 6e 76 65 72 ment when conver
11a30 74 69 6e 67 20 74 65 78 74 20 66 72 6f 6d 20 6f ting text from o
11a40 6e 65 20 63 68 61 72 61 63 74 65 72 20 73 65 74 ne character set
11a50 20 74 6f 20 61 6e 6f 74 68 65 72 3a 0a 20 2a 0a to another:. *.
11a60 20 2a 20 54 43 4c 5f 45 4e 43 4f 44 49 4e 47 5f * TCL_ENCODING_
11a70 53 54 41 52 54 20 2d 09 09 53 69 67 6e 69 66 69 START -..Signifi
11a80 65 73 20 74 68 61 74 20 74 68 65 20 73 6f 75 72 es that the sour
11a90 63 65 20 62 75 66 66 65 72 20 69 73 20 74 68 65 ce buffer is the
11aa0 20 66 69 72 73 74 0a 20 2a 09 09 09 09 62 6c 6f first. *....blo
11ab0 63 6b 20 69 6e 20 61 20 28 70 6f 74 65 6e 74 69 ck in a (potenti
11ac0 61 6c 6c 79 20 6d 75 6c 74 69 2d 62 6c 6f 63 6b ally multi-block
11ad0 29 20 69 6e 70 75 74 0a 20 2a 09 09 09 09 73 74 ) input. *....st
11ae0 72 65 61 6d 2e 20 54 65 6c 6c 73 20 74 68 65 20 ream. Tells the
11af0 63 6f 6e 76 65 72 73 69 6f 6e 20 66 75 6e 63 74 conversion funct
11b00 69 6f 6e 20 74 6f 20 72 65 73 65 74 0a 20 2a 09 ion to reset. *.
11b10 09 09 09 74 6f 20 61 6e 20 69 6e 69 74 69 61 6c ...to an initial
11b20 20 73 74 61 74 65 20 61 6e 64 20 70 65 72 66 6f state and perfo
11b30 72 6d 20 61 6e 79 0a 20 2a 09 09 09 09 69 6e 69 rm any. *....ini
11b40 74 69 61 6c 69 7a 61 74 69 6f 6e 20 74 68 61 74 tialization that
11b50 20 6e 65 65 64 73 20 74 6f 20 6f 63 63 75 72 20 needs to occur
11b60 62 65 66 6f 72 65 20 74 68 65 0a 20 2a 09 09 09 before the. *...
11b70 09 66 69 72 73 74 20 62 79 74 65 20 69 73 20 63 .first byte is c
11b80 6f 6e 76 65 72 74 65 64 2e 20 49 66 20 74 68 65 onverted. If the
11b90 20 73 6f 75 72 63 65 20 62 75 66 66 65 72 0a 20 source buffer.
11ba0 2a 09 09 09 09 63 6f 6e 74 61 69 6e 73 20 74 68 *....contains th
11bb0 65 20 65 6e 74 69 72 65 20 69 6e 70 75 74 20 73 e entire input s
11bc0 74 72 65 61 6d 20 74 6f 20 62 65 0a 20 2a 09 09 tream to be. *..
11bd0 09 09 63 6f 6e 76 65 72 74 65 64 2c 20 74 68 69 ..converted, thi
11be0 73 20 66 6c 61 67 20 73 68 6f 75 6c 64 20 62 65 s flag should be
11bf0 20 73 65 74 2e 0a 20 2a 20 54 43 4c 5f 45 4e 43 set.. * TCL_ENC
11c00 4f 44 49 4e 47 5f 45 4e 44 20 2d 09 09 53 69 67 ODING_END -..Sig
11c10 6e 69 66 69 65 73 20 74 68 61 74 20 74 68 65 20 nifies that the
11c20 73 6f 75 72 63 65 20 62 75 66 66 65 72 20 69 73 source buffer is
11c30 20 74 68 65 20 6c 61 73 74 0a 20 2a 09 09 09 09 the last. *....
11c40 62 6c 6f 63 6b 20 69 6e 20 61 20 28 70 6f 74 65 block in a (pote
11c50 6e 74 69 61 6c 6c 79 20 6d 75 6c 74 69 2d 62 6c ntially multi-bl
11c60 6f 63 6b 29 20 69 6e 70 75 74 0a 20 2a 09 09 09 ock) input. *...
11c70 09 73 74 72 65 61 6d 2e 20 54 65 6c 6c 73 20 74 .stream. Tells t
11c80 68 65 20 63 6f 6e 76 65 72 73 69 6f 6e 20 72 6f he conversion ro
11c90 75 74 69 6e 65 20 74 6f 0a 20 2a 09 09 09 09 70 utine to. *....p
11ca0 65 72 66 6f 72 6d 20 61 6e 79 20 66 69 6e 61 6c erform any final
11cb0 69 7a 61 74 69 6f 6e 20 74 68 61 74 20 6e 65 65 ization that nee
11cc0 64 73 20 74 6f 20 6f 63 63 75 72 0a 20 2a 09 09 ds to occur. *..
11cd0 09 09 61 66 74 65 72 20 74 68 65 20 6c 61 73 74 ..after the last
11ce0 20 62 79 74 65 20 69 73 20 63 6f 6e 76 65 72 74 byte is convert
11cf0 65 64 20 61 6e 64 20 74 68 65 6e 20 74 6f 0a 20 ed and then to.
11d00 2a 09 09 09 09 72 65 73 65 74 20 74 6f 20 61 6e *....reset to an
11d10 20 69 6e 69 74 69 61 6c 20 73 74 61 74 65 2e 20 initial state.
11d20 49 66 20 74 68 65 20 73 6f 75 72 63 65 0a 20 2a If the source. *
11d30 09 09 09 09 62 75 66 66 65 72 20 63 6f 6e 74 61 ....buffer conta
11d40 69 6e 73 20 74 68 65 20 65 6e 74 69 72 65 20 69 ins the entire i
11d50 6e 70 75 74 20 73 74 72 65 61 6d 20 74 6f 20 62 nput stream to b
11d60 65 0a 20 2a 09 09 09 09 63 6f 6e 76 65 72 74 65 e. *....converte
11d70 64 2c 20 74 68 69 73 20 66 6c 61 67 20 73 68 6f d, this flag sho
11d80 75 6c 64 20 62 65 20 73 65 74 2e 0a 20 2a 20 54 uld be set.. * T
11d90 43 4c 5f 45 4e 43 4f 44 49 4e 47 5f 53 54 4f 50 CL_ENCODING_STOP
11da0 4f 4e 45 52 52 4f 52 20 2d 09 4e 6f 74 20 75 73 ONERROR -.Not us
11db0 65 64 20 61 6e 79 20 6d 6f 72 65 2e 0a 20 2a 20 ed any more.. *
11dc0 54 43 4c 5f 45 4e 43 4f 44 49 4e 47 5f 4e 4f 5f TCL_ENCODING_NO_
11dd0 54 45 52 4d 49 4e 41 54 45 20 2d 09 49 66 20 73 TERMINATE -.If s
11de0 65 74 2c 20 54 63 6c 5f 45 78 74 65 72 6e 61 6c et, Tcl_External
11df0 54 6f 55 74 66 20 64 6f 65 73 20 6e 6f 74 20 61 ToUtf does not a
11e00 70 70 65 6e 64 20 61 0a 20 2a 09 09 09 09 74 65 ppend a. *....te
11e10 72 6d 69 6e 61 74 69 6e 67 20 4e 55 4c 20 62 79 rminating NUL by
11e20 74 65 2e 20 20 53 69 6e 63 65 20 69 74 20 64 6f te. Since it do
11e30 65 73 20 6e 6f 74 20 6e 65 65 64 0a 20 2a 09 09 es not need. *..
11e40 09 09 61 6e 20 65 78 74 72 61 20 62 79 74 65 20 ..an extra byte
11e50 66 6f 72 20 61 20 74 65 72 6d 69 6e 61 74 69 6e for a terminatin
11e60 67 20 4e 55 4c 2c 20 69 74 20 66 69 6c 6c 73 0a g NUL, it fills.
11e70 20 2a 09 09 09 09 61 6c 6c 20 64 73 74 4c 65 6e *....all dstLen
11e80 20 62 79 74 65 73 20 77 69 74 68 20 65 6e 63 6f bytes with enco
11e90 64 65 64 20 55 54 46 2d 38 20 63 6f 6e 74 65 6e ded UTF-8 conten
11ea0 74 20 69 66 0a 20 2a 09 09 09 09 6e 65 65 64 65 t if. *....neede
11eb0 64 2e 20 20 49 66 20 63 6c 65 61 72 2c 20 61 20 d. If clear, a
11ec0 62 79 74 65 20 69 73 20 72 65 73 65 72 76 65 64 byte is reserved
11ed0 20 69 6e 20 74 68 65 0a 20 2a 09 09 09 09 64 73 in the. *....ds
11ee0 74 20 73 70 61 63 65 20 66 6f 72 20 4e 55 4c 20 t space for NUL
11ef0 74 65 72 6d 69 6e 61 74 69 6f 6e 2c 20 61 6e 64 termination, and
11f00 20 61 0a 20 2a 09 09 09 09 74 65 72 6d 69 6e 61 a. *....termina
11f10 74 69 6e 67 20 4e 55 4c 20 69 73 20 61 70 70 65 ting NUL is appe
11f20 6e 64 65 64 2e 0a 20 2a 20 54 43 4c 5f 45 4e 43 nded.. * TCL_ENC
11f30 4f 44 49 4e 47 5f 43 48 41 52 5f 4c 49 4d 49 54 ODING_CHAR_LIMIT
11f40 20 2d 09 49 66 20 73 65 74 20 61 6e 64 20 64 73 -.If set and ds
11f50 74 43 68 61 72 73 50 74 72 20 69 73 20 6e 6f 74 tCharsPtr is not
11f60 20 4e 55 4c 4c 2c 20 74 68 65 6e 0a 20 2a 09 09 NULL, then. *..
11f70 09 09 54 63 6c 5f 45 78 74 65 72 6e 61 6c 54 6f ..Tcl_ExternalTo
11f80 55 74 66 20 74 61 6b 65 73 20 74 68 65 20 69 6e Utf takes the in
11f90 69 74 69 61 6c 20 76 61 6c 75 65 20 6f 66 0a 20 itial value of.
11fa0 2a 09 09 09 09 2a 64 73 74 43 68 61 72 73 50 74 *....*dstCharsPt
11fb0 72 20 61 73 20 61 20 6c 69 6d 69 74 20 6f 66 20 r as a limit of
11fc0 74 68 65 20 6d 61 78 69 6d 75 6d 20 6e 75 6d 62 the maximum numb
11fd0 65 72 0a 20 2a 09 09 09 09 6f 66 20 63 68 61 72 er. *....of char
11fe0 73 20 74 6f 20 70 72 6f 64 75 63 65 20 69 6e 20 s to produce in
11ff0 74 68 65 20 65 6e 63 6f 64 65 64 20 55 54 46 2d the encoded UTF-
12000 38 0a 20 2a 09 09 09 09 63 6f 6e 74 65 6e 74 2e 8. *....content.
12010 20 20 4f 74 68 65 72 77 69 73 65 2c 20 74 68 65 Otherwise, the
12020 20 6e 75 6d 62 65 72 20 6f 66 20 63 68 61 72 73 number of chars
12030 0a 20 2a 09 09 09 09 70 72 6f 64 75 63 65 64 20 . *....produced
12040 69 73 20 63 6f 6e 74 72 6f 6c 6c 65 64 20 6f 6e is controlled on
12050 6c 79 20 62 79 20 6f 74 68 65 72 20 6c 69 6d 69 ly by other limi
12060 74 69 6e 67 0a 20 2a 09 09 09 09 66 61 63 74 6f ting. *....facto
12070 72 73 2e 0a 20 2a 20 54 43 4c 5f 45 4e 43 4f 44 rs.. * TCL_ENCOD
12080 49 4e 47 5f 50 52 4f 46 49 4c 45 5f 2a 20 2d 09 ING_PROFILE_* -.
12090 4d 75 74 75 61 6c 6c 79 20 65 78 63 6c 75 73 69 Mutually exclusi
120a0 76 65 20 65 6e 63 6f 64 69 6e 67 20 70 72 6f 66 ve encoding prof
120b0 69 6c 65 20 69 64 73 2e 20 4e 6f 74 65 0a 20 2a ile ids. Note. *
120c0 09 09 09 09 74 68 65 73 65 20 61 72 65 20 62 69 ....these are bi
120d0 74 20 6d 61 73 6b 73 2e 0a 20 2a 0a 20 2a 20 4e t masks.. *. * N
120e0 4f 54 45 3a 20 54 48 45 53 45 20 42 49 54 20 44 OTE: THESE BIT D
120f0 45 46 49 4e 49 54 49 4f 4e 53 20 53 48 4f 55 4c EFINITIONS SHOUL
12100 44 20 4e 4f 54 20 4f 56 45 52 4c 41 50 20 57 49 D NOT OVERLAP WI
12110 54 48 20 49 4e 54 45 52 4e 41 4c 20 55 53 45 20 TH INTERNAL USE
12120 42 49 54 53 0a 20 2a 20 44 45 46 49 4e 45 44 20 BITS. * DEFINED
12130 49 4e 20 74 63 6c 45 6e 63 6f 64 69 6e 67 2e 63 IN tclEncoding.c
12140 20 28 45 4e 43 4f 44 49 4e 47 5f 49 4e 50 55 54 (ENCODING_INPUT
12150 20 65 74 20 61 6c 29 2e 20 42 65 20 63 6f 67 6e et al). Be cogn
12160 69 7a 61 6e 74 20 6f 66 20 74 68 69 73 0a 20 2a izant of this. *
12170 20 77 68 65 6e 20 61 64 64 69 6e 67 20 62 69 74 when adding bit
12180 73 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 s.. */..#define
12190 54 43 4c 5f 45 4e 43 4f 44 49 4e 47 5f 53 54 41 TCL_ENCODING_STA
121a0 52 54 09 09 30 78 30 31 0a 23 64 65 66 69 6e 65 RT..0x01.#define
121b0 20 54 43 4c 5f 45 4e 43 4f 44 49 4e 47 5f 45 4e TCL_ENCODING_EN
121c0 44 09 09 30 78 30 32 0a 23 64 65 66 69 6e 65 20 D..0x02.#define
121d0 54 43 4c 5f 45 4e 43 4f 44 49 4e 47 5f 53 54 4f TCL_ENCODING_STO
121e0 50 4f 4e 45 52 52 4f 52 09 30 78 30 20 2f 2a 20 PONERROR.0x0 /*
121f0 4e 6f 74 20 75 73 65 64 20 61 6e 79 20 6d 6f 72 Not used any mor
12200 65 20 2a 2f 0a 23 64 65 66 69 6e 65 20 54 43 4c e */.#define TCL
12210 5f 45 4e 43 4f 44 49 4e 47 5f 4e 4f 5f 54 45 52 _ENCODING_NO_TER
12220 4d 49 4e 41 54 45 09 30 78 30 38 0a 23 64 65 66 MINATE.0x08.#def
12230 69 6e 65 20 54 43 4c 5f 45 4e 43 4f 44 49 4e 47 ine TCL_ENCODING
12240 5f 43 48 41 52 5f 4c 49 4d 49 54 09 09 30 78 31 _CHAR_LIMIT..0x1
12250 30 0a 2f 2a 20 49 6e 74 65 72 6e 61 6c 20 75 73 0./* Internal us
12260 65 20 62 69 74 73 2c 20 64 6f 20 6e 6f 74 20 64 e bits, do not d
12270 65 66 69 6e 65 20 62 69 74 73 20 69 6e 20 74 68 efine bits in th
12280 69 73 20 73 70 61 63 65 2e 20 53 65 65 20 61 62 is space. See ab
12290 6f 76 65 20 63 6f 6d 6d 65 6e 74 20 2a 2f 0a 23 ove comment */.#
122a0 64 65 66 69 6e 65 20 54 43 4c 5f 45 4e 43 4f 44 define TCL_ENCOD
122b0 49 4e 47 5f 49 4e 54 45 52 4e 41 4c 5f 55 53 45 ING_INTERNAL_USE
122c0 5f 4d 41 53 4b 20 20 30 78 46 46 30 30 0a 2f 2a _MASK 0xFF00./*
122d0 0a 20 2a 20 52 65 73 65 72 76 65 20 74 6f 70 20 . * Reserve top
122e0 62 79 74 65 20 66 6f 72 20 70 72 6f 66 69 6c 65 byte for profile
122f0 20 76 61 6c 75 65 73 20 28 64 69 73 6a 6f 69 6e values (disjoin
12300 74 2c 20 6e 6f 74 20 61 20 6d 61 73 6b 29 2e 20 t, not a mask).
12310 49 6e 20 63 61 73 65 20 6f 66 0a 20 2a 20 63 68 In case of. * ch
12320 61 6e 67 65 73 2c 20 65 6e 73 75 72 65 20 45 4e anges, ensure EN
12330 43 4f 44 49 4e 47 5f 50 52 4f 46 49 4c 45 5f 2a CODING_PROFILE_*
12340 20 6d 61 63 72 6f 73 20 69 6e 20 74 63 6c 49 6e macros in tclIn
12350 74 2e 68 20 61 72 65 20 6d 6f 64 69 66 69 65 64 t.h are modified
12360 20 69 66 0a 20 2a 20 6e 65 63 65 73 73 61 72 79 if. * necessary
12370 2e 0a 20 2a 2f 0a 23 64 65 66 69 6e 65 20 54 43 .. */.#define TC
12380 4c 5f 45 4e 43 4f 44 49 4e 47 5f 50 52 4f 46 49 L_ENCODING_PROFI
12390 4c 45 5f 53 54 52 49 43 54 20 20 20 30 78 30 30 LE_STRICT 0x00
123a0 30 30 30 30 30 30 0a 23 64 65 66 69 6e 65 20 54 000000.#define T
123b0 43 4c 5f 45 4e 43 4f 44 49 4e 47 5f 50 52 4f 46 CL_ENCODING_PROF
123c0 49 4c 45 5f 54 43 4c 38 20 20 20 20 20 30 78 30 ILE_TCL8 0x0
123d0 31 30 30 30 30 30 30 0a 23 64 65 66 69 6e 65 20 1000000.#define
123e0 54 43 4c 5f 45 4e 43 4f 44 49 4e 47 5f 50 52 4f TCL_ENCODING_PRO
123f0 46 49 4c 45 5f 52 45 50 4c 41 43 45 20 20 30 78 FILE_REPLACE 0x
12400 30 32 30 30 30 30 30 30 0a 0a 2f 2a 0a 20 2a 20 02000000../*. *
12410 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 64 65 The following de
12420 66 69 6e 69 74 69 6f 6e 73 20 61 72 65 20 74 68 finitions are th
12430 65 20 65 72 72 6f 72 20 63 6f 64 65 73 20 72 65 e error codes re
12440 74 75 72 6e 65 64 20 62 79 20 74 68 65 20 63 6f turned by the co
12450 6e 76 65 72 73 69 6f 6e 0a 20 2a 20 72 6f 75 74 nversion. * rout
12460 69 6e 65 73 3a 0a 20 2a 0a 20 2a 20 54 43 4c 5f ines:. *. * TCL_
12470 4f 4b 20 2d 09 09 09 41 6c 6c 20 63 68 61 72 61 OK -...All chara
12480 63 74 65 72 73 20 77 65 72 65 20 63 6f 6e 76 65 cters were conve
12490 72 74 65 64 2e 0a 20 2a 20 54 43 4c 5f 43 4f 4e rted.. * TCL_CON
124a0 56 45 52 54 5f 4e 4f 53 50 41 43 45 20 2d 09 54 VERT_NOSPACE -.T
124b0 68 65 20 6f 75 74 70 75 74 20 62 75 66 66 65 72 he output buffer
124c0 20 77 6f 75 6c 64 20 6e 6f 74 20 68 61 76 65 20 would not have
124d0 62 65 65 6e 20 6c 61 72 67 65 0a 20 2a 09 09 09 been large. *...
124e0 09 65 6e 6f 75 67 68 20 66 6f 72 20 61 6c 6c 20 .enough for all
124f0 6f 66 20 74 68 65 20 63 6f 6e 76 65 72 74 65 64 of the converted
12500 20 64 61 74 61 3b 20 61 73 20 6d 61 6e 79 0a 20 data; as many.
12510 2a 09 09 09 09 63 68 61 72 61 63 74 65 72 73 20 *....characters
12520 61 73 20 63 6f 75 6c 64 20 66 69 74 20 77 65 72 as could fit wer
12530 65 20 63 6f 6e 76 65 72 74 65 64 20 74 68 6f 75 e converted thou
12540 67 68 2e 0a 20 2a 20 54 43 4c 5f 43 4f 4e 56 45 gh.. * TCL_CONVE
12550 52 54 5f 4d 55 4c 54 49 42 59 54 45 20 2d 09 54 RT_MULTIBYTE -.T
12560 68 65 20 6c 61 73 74 20 66 65 77 20 62 79 74 65 he last few byte
12570 73 20 69 6e 20 74 68 65 20 73 6f 75 72 63 65 20 s in the source
12580 73 74 72 69 6e 67 20 77 65 72 65 0a 20 2a 09 09 string were. *..
12590 09 09 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 ..the beginning
125a0 6f 66 20 61 20 6d 75 6c 74 69 62 79 74 65 20 73 of a multibyte s
125b0 65 71 75 65 6e 63 65 2c 20 62 75 74 0a 20 2a 09 equence, but. *.
125c0 09 09 09 6d 6f 72 65 20 62 79 74 65 73 20 77 65 ...more bytes we
125d0 72 65 20 6e 65 65 64 65 64 20 74 6f 20 63 6f 6d re needed to com
125e0 70 6c 65 74 65 20 74 68 69 73 0a 20 2a 09 09 09 plete this. *...
125f0 09 73 65 71 75 65 6e 63 65 2e 20 41 20 73 75 62 .sequence. A sub
12600 73 65 71 75 65 6e 74 20 63 61 6c 6c 20 74 6f 20 sequent call to
12610 74 68 65 20 63 6f 6e 76 65 72 73 69 6f 6e 0a 20 the conversion.
12620 2a 09 09 09 09 72 6f 75 74 69 6e 65 20 73 68 6f *....routine sho
12630 75 6c 64 20 70 61 73 73 20 74 68 65 20 62 65 67 uld pass the beg
12640 69 6e 6e 69 6e 67 20 6f 66 20 74 68 69 73 0a 20 inning of this.
12650 2a 09 09 09 09 75 6e 63 6f 6e 76 65 72 74 65 64 *....unconverted
12660 20 73 65 71 75 65 6e 63 65 20 70 6c 75 73 20 61 sequence plus a
12670 64 64 69 74 69 6f 6e 61 6c 20 62 79 74 65 73 0a dditional bytes.
12680 20 2a 09 09 09 09 66 72 6f 6d 20 74 68 65 20 73 *....from the s
12690 6f 75 72 63 65 20 73 74 72 65 61 6d 20 74 6f 20 ource stream to
126a0 70 72 6f 70 65 72 6c 79 20 63 6f 6e 76 65 72 74 properly convert
126b0 20 74 68 65 0a 20 2a 09 09 09 09 66 6f 72 6d 65 the. *....forme
126c0 72 6c 79 20 73 70 6c 69 74 2d 75 70 20 6d 75 6c rly split-up mul
126d0 74 69 62 79 74 65 20 73 65 71 75 65 6e 63 65 2e tibyte sequence.
126e0 0a 20 2a 20 54 43 4c 5f 43 4f 4e 56 45 52 54 5f . * TCL_CONVERT_
126f0 53 59 4e 54 41 58 20 2d 09 09 54 68 65 20 73 6f SYNTAX -..The so
12700 75 72 63 65 20 73 74 72 65 61 6d 20 63 6f 6e 74 urce stream cont
12710 61 69 6e 65 64 20 61 6e 20 69 6e 76 61 6c 69 64 ained an invalid
12720 0a 20 2a 09 09 09 09 63 68 61 72 61 63 74 65 72 . *....character
12730 20 73 65 71 75 65 6e 63 65 2e 20 54 68 69 73 20 sequence. This
12740 6d 61 79 20 6f 63 63 75 72 20 69 66 20 74 68 65 may occur if the
12750 0a 20 2a 09 09 09 09 69 6e 70 75 74 20 73 74 72 . *....input str
12760 65 61 6d 20 68 61 73 20 62 65 65 6e 20 64 61 6d eam has been dam
12770 61 67 65 64 20 6f 72 20 69 66 20 74 68 65 20 69 aged or if the i
12780 6e 70 75 74 0a 20 2a 09 09 09 09 65 6e 63 6f 64 nput. *....encod
12790 69 6e 67 20 6d 65 74 68 6f 64 20 77 61 73 20 6d ing method was m
127a0 69 73 69 64 65 6e 74 69 66 69 65 64 2e 0a 20 2a isidentified.. *
127b0 20 54 43 4c 5f 43 4f 4e 56 45 52 54 5f 55 4e 4b TCL_CONVERT_UNK
127c0 4e 4f 57 4e 20 2d 09 54 68 65 20 73 6f 75 72 63 NOWN -.The sourc
127d0 65 20 73 74 72 69 6e 67 20 63 6f 6e 74 61 69 6e e string contain
127e0 65 64 20 61 20 63 68 61 72 61 63 74 65 72 20 74 ed a character t
127f0 68 61 74 0a 20 2a 09 09 09 09 63 6f 75 6c 64 20 hat. *....could
12800 6e 6f 74 20 62 65 20 72 65 70 72 65 73 65 6e 74 not be represent
12810 65 64 20 69 6e 20 74 68 65 20 74 61 72 67 65 74 ed in the target
12820 0a 20 2a 09 09 09 09 65 6e 63 6f 64 69 6e 67 2e . *....encoding.
12830 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 . */..#define TC
12840 4c 5f 43 4f 4e 56 45 52 54 5f 4d 55 4c 54 49 42 L_CONVERT_MULTIB
12850 59 54 45 09 28 2d 31 29 0a 23 64 65 66 69 6e 65 YTE.(-1).#define
12860 20 54 43 4c 5f 43 4f 4e 56 45 52 54 5f 53 59 4e TCL_CONVERT_SYN
12870 54 41 58 09 28 2d 32 29 0a 23 64 65 66 69 6e 65 TAX.(-2).#define
12880 20 54 43 4c 5f 43 4f 4e 56 45 52 54 5f 55 4e 4b TCL_CONVERT_UNK
12890 4e 4f 57 4e 09 28 2d 33 29 0a 23 64 65 66 69 6e NOWN.(-3).#defin
128a0 65 20 54 43 4c 5f 43 4f 4e 56 45 52 54 5f 4e 4f e TCL_CONVERT_NO
128b0 53 50 41 43 45 09 28 2d 34 29 0a 0a 2f 2a 0a 20 SPACE.(-4)../*.
128c0 2a 20 54 68 65 20 6d 61 78 69 6d 75 6d 20 6e 75 * The maximum nu
128d0 6d 62 65 72 20 6f 66 20 62 79 74 65 73 20 74 68 mber of bytes th
128e0 61 74 20 61 72 65 20 6e 65 63 65 73 73 61 72 79 at are necessary
128f0 20 74 6f 20 72 65 70 72 65 73 65 6e 74 20 61 20 to represent a
12900 73 69 6e 67 6c 65 0a 20 2a 20 55 6e 69 63 6f 64 single. * Unicod
12910 65 20 63 68 61 72 61 63 74 65 72 20 69 6e 20 55 e character in U
12920 54 46 2d 38 2e 20 54 68 65 20 76 61 6c 69 64 20 TF-8. The valid
12930 76 61 6c 75 65 73 20 61 72 65 20 33 20 61 6e 64 values are 3 and
12940 20 34 2e 20 49 66 20 3e 20 33 2c 0a 20 2a 20 74 4. If > 3,. * t
12950 68 65 6e 20 54 63 6c 5f 55 6e 69 43 68 61 72 20 hen Tcl_UniChar
12960 6d 75 73 74 20 62 65 20 34 2d 62 79 74 65 73 20 must be 4-bytes
12970 69 6e 20 73 69 7a 65 20 28 55 43 53 2d 34 29 20 in size (UCS-4)
12980 28 74 68 65 20 64 65 66 61 75 6c 74 29 2e 20 49 (the default). I
12990 66 20 3d 3d 20 33 2c 0a 20 2a 20 74 68 65 6e 20 f == 3,. * then
129a0 54 63 6c 5f 55 6e 69 43 68 61 72 20 6d 75 73 74 Tcl_UniChar must
129b0 20 62 65 20 32 2d 62 79 74 65 73 20 69 6e 20 73 be 2-bytes in s
129c0 69 7a 65 20 28 55 54 46 2d 31 36 29 2e 20 53 69 ize (UTF-16). Si
129d0 6e 63 65 20 54 63 6c 20 39 2e 30 2c 20 55 43 53 nce Tcl 9.0, UCS
129e0 2d 34 0a 20 2a 20 6d 6f 64 65 20 69 73 20 74 68 -4. * mode is th
129f0 65 20 64 65 66 61 75 6c 74 20 61 6e 64 20 72 65 e default and re
12a00 63 6f 6d 6d 65 6e 64 65 64 20 6d 6f 64 65 2e 0a commended mode..
12a10 20 2a 2f 0a 0a 23 69 66 6e 64 65 66 20 54 43 4c */..#ifndef TCL
12a20 5f 55 54 46 5f 4d 41 58 0a 23 20 20 20 64 65 66 _UTF_MAX.# def
12a30 69 6e 65 20 54 43 4c 5f 55 54 46 5f 4d 41 58 09 ine TCL_UTF_MAX.
12a40 09 34 0a 23 65 6e 64 69 66 0a 0a 2f 2a 0a 20 2a .4.#endif../*. *
12a50 20 54 68 69 73 20 72 65 70 72 65 73 65 6e 74 73 This represents
12a60 20 61 20 55 6e 69 63 6f 64 65 20 63 68 61 72 61 a Unicode chara
12a70 63 74 65 72 2e 20 41 6e 79 20 63 68 61 6e 67 65 cter. Any change
12a80 73 20 74 6f 20 74 68 69 73 20 73 68 6f 75 6c 64 s to this should
12a90 20 61 6c 73 6f 20 62 65 0a 20 2a 20 72 65 66 6c also be. * refl
12aa0 65 63 74 65 64 20 69 6e 20 72 65 67 63 75 73 74 ected in regcust
12ab0 6f 6d 2e 68 2e 0a 20 2a 2f 0a 0a 23 69 66 20 54 om.h.. */..#if T
12ac0 43 4c 5f 55 54 46 5f 4d 41 58 20 3d 3d 20 34 0a CL_UTF_MAX == 4.
12ad0 20 20 20 20 2f 2a 0a 20 20 20 20 20 2a 20 69 6e /*. * in
12ae0 74 20 69 73 6e 27 74 20 31 30 30 25 20 61 63 63 t isn't 100% acc
12af0 75 72 61 74 65 20 61 73 20 69 74 20 73 68 6f 75 urate as it shou
12b00 6c 64 20 62 65 20 61 20 73 74 72 69 63 74 20 34 ld be a strict 4
12b10 2d 62 79 74 65 20 76 61 6c 75 65 0a 20 20 20 20 -byte value.
12b20 20 2a 20 28 70 65 72 68 61 70 73 20 69 6e 74 33 * (perhaps int3
12b30 32 5f 74 29 2e 20 49 4c 50 36 34 2f 53 49 4c 50 2_t). ILP64/SILP
12b40 36 34 20 73 79 73 74 65 6d 73 20 6d 61 79 20 68 64 systems may h
12b50 61 76 65 20 74 72 6f 75 62 6c 65 73 2e 20 54 68 ave troubles. Th
12b60 65 0a 20 20 20 20 20 2a 20 73 69 7a 65 20 6f 66 e. * size of
12b70 20 74 68 69 73 20 76 61 6c 75 65 20 6d 75 73 74 this value must
12b80 20 62 65 20 72 65 66 6c 65 63 74 65 64 20 63 6f be reflected co
12b90 72 72 65 63 74 6c 79 20 69 6e 20 72 65 67 63 75 rrectly in regcu
12ba0 73 74 6f 6d 2e 68 2e 0a 20 20 20 20 20 2a 2f 0a stom.h.. */.
12bb0 74 79 70 65 64 65 66 20 69 6e 74 20 54 63 6c 5f typedef int Tcl_
12bc0 55 6e 69 43 68 61 72 3b 0a 23 65 6c 69 66 20 54 UniChar;.#elif T
12bd0 43 4c 5f 55 54 46 5f 4d 41 58 20 3d 3d 20 33 20 CL_UTF_MAX == 3
12be0 26 26 20 21 64 65 66 69 6e 65 64 28 42 55 49 4c && !defined(BUIL
12bf0 44 5f 74 63 6c 29 0a 74 79 70 65 64 65 66 20 75 D_tcl).typedef u
12c00 6e 73 69 67 6e 65 64 20 73 68 6f 72 74 20 54 63 nsigned short Tc
12c10 6c 5f 55 6e 69 43 68 61 72 3b 0a 23 65 6c 73 65 l_UniChar;.#else
12c20 0a 23 20 20 20 65 72 72 6f 72 20 22 54 68 69 73 .# error "This
12c30 20 54 43 4c 5f 55 54 46 5f 4d 41 58 20 76 61 6c TCL_UTF_MAX val
12c40 75 65 20 69 73 20 6e 6f 74 20 73 75 70 70 6f 72 ue is not suppor
12c50 74 65 64 22 0a 23 65 6e 64 69 66 0a 0a 2f 2a 0a ted".#endif../*.
12c60 20 2a 20 53 70 65 63 69 66 69 65 72 73 20 66 6f * Specifiers fo
12c70 72 20 55 6e 69 63 6f 64 65 20 6e 6f 72 6d 61 6c r Unicode normal
12c80 69 7a 61 74 69 6f 6e 20 66 6f 72 6d 73 2e 0a 20 ization forms..
12c90 2a 2f 0a 74 79 70 65 64 65 66 20 65 6e 75 6d 20 */.typedef enum
12ca0 7b 0a 20 20 20 20 54 43 4c 5f 4e 46 43 2c 20 54 {. TCL_NFC, T
12cb0 43 4c 5f 4e 46 44 2c 20 54 43 4c 5f 4e 46 4b 43 CL_NFD, TCL_NFKC
12cc0 2c 20 54 43 4c 5f 4e 46 4b 44 0a 7d 20 54 63 6c , TCL_NFKD.} Tcl
12cd0 5f 55 6e 69 63 6f 64 65 4e 6f 72 6d 61 6c 69 7a _UnicodeNormaliz
12ce0 61 74 69 6f 6e 46 6f 72 6d 3b 0a 0c 0a 2f 2a 0a ationForm;.../*.
12cf0 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d *--------------
12d00 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
12d10 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
12d20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
12d30 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 --------------.
12d40 2a 20 54 49 50 20 23 35 39 3a 20 54 68 65 20 66 * TIP #59: The f
12d50 6f 6c 6c 6f 77 69 6e 67 20 73 74 72 75 63 74 75 ollowing structu
12d60 72 65 20 69 73 20 75 73 65 64 20 69 6e 20 63 61 re is used in ca
12d70 6c 6c 73 20 27 54 63 6c 5f 52 65 67 69 73 74 65 lls 'Tcl_Registe
12d80 72 43 6f 6e 66 69 67 27 20 74 6f 0a 20 2a 20 70 rConfig' to. * p
12d90 72 6f 76 69 64 65 20 74 68 65 20 73 79 73 74 65 rovide the syste
12da0 6d 20 77 69 74 68 20 74 68 65 20 65 6d 62 65 64 m with the embed
12db0 64 65 64 20 63 6f 6e 66 69 67 75 72 61 74 69 6f ded configuratio
12dc0 6e 20 64 61 74 61 2e 0a 20 2a 2f 0a 0a 74 79 70 n data.. */..typ
12dd0 65 64 65 66 20 73 74 72 75 63 74 20 54 63 6c 5f edef struct Tcl_
12de0 43 6f 6e 66 69 67 20 7b 0a 20 20 20 20 63 6f 6e Config {. con
12df0 73 74 20 63 68 61 72 20 2a 6b 65 79 3b 09 09 2f st char *key;../
12e00 2a 20 43 6f 6e 66 69 67 75 72 61 74 69 6f 6e 20 * Configuration
12e10 6b 65 79 20 74 6f 20 72 65 67 69 73 74 65 72 2e key to register.
12e20 20 41 53 43 49 49 0a 09 09 09 09 20 2a 20 65 6e ASCII..... * en
12e30 63 6f 64 65 64 2c 20 74 68 75 73 20 55 54 46 2d coded, thus UTF-
12e40 38 2e 20 2a 2f 0a 20 20 20 20 63 6f 6e 73 74 20 8. */. const
12e50 63 68 61 72 20 2a 76 61 6c 75 65 3b 09 09 2f 2a char *value;../*
12e60 20 54 68 65 20 76 61 6c 75 65 20 61 73 73 6f 63 The value assoc
12e70 69 61 74 65 64 20 77 69 74 68 20 74 68 65 20 6b iated with the k
12e80 65 79 2e 20 53 79 73 74 65 6d 0a 09 09 09 09 20 ey. System.....
12e90 2a 20 65 6e 63 6f 64 69 6e 67 2e 20 2a 2f 0a 7d * encoding. */.}
12ea0 20 54 63 6c 5f 43 6f 6e 66 69 67 3b 0a 0a 2f 2a Tcl_Config;../*
12eb0 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d . *-------------
12ec0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
12ed0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
12ee0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
12ef0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a ---------------.
12f00 20 2a 20 46 6c 61 67 73 20 66 6f 72 20 54 49 50 * Flags for TIP
12f10 23 31 34 33 20 6c 69 6d 69 74 73 2c 20 64 65 74 #143 limits, det
12f20 61 69 6c 69 6e 67 20 77 68 69 63 68 20 6c 69 6d ailing which lim
12f30 69 74 73 20 61 72 65 20 61 63 74 69 76 65 20 69 its are active i
12f40 6e 20 61 6e 0a 20 2a 20 69 6e 74 65 72 70 72 65 n an. * interpre
12f50 74 65 72 2e 20 55 73 65 64 20 66 6f 72 20 54 63 ter. Used for Tc
12f60 6c 5f 7b 41 64 64 2c 52 65 6d 6f 76 65 7d 4c 69 l_{Add,Remove}Li
12f70 6d 69 74 48 61 6e 64 6c 65 72 20 74 79 70 65 20 mitHandler type
12f80 61 72 67 75 6d 65 6e 74 2e 0a 20 2a 2f 0a 0a 23 argument.. */..#
12f90 64 65 66 69 6e 65 20 54 43 4c 5f 4c 49 4d 49 54 define TCL_LIMIT
12fa0 5f 43 4f 4d 4d 41 4e 44 53 09 30 78 30 31 0a 23 _COMMANDS.0x01.#
12fb0 64 65 66 69 6e 65 20 54 43 4c 5f 4c 49 4d 49 54 define TCL_LIMIT
12fc0 5f 54 49 4d 45 09 09 30 78 30 32 0a 0a 2f 2a 0a _TIME..0x02../*.
12fd0 20 2a 20 53 74 72 75 63 74 75 72 65 20 63 6f 6e * Structure con
12fe0 74 61 69 6e 69 6e 67 20 69 6e 66 6f 72 6d 61 74 taining informat
12ff0 69 6f 6e 20 61 62 6f 75 74 20 61 20 6c 69 6d 69 ion about a limi
13000 74 20 68 61 6e 64 6c 65 72 20 74 6f 20 62 65 20 t handler to be
13010 63 61 6c 6c 65 64 20 77 68 65 6e 20 61 0a 20 2a called when a. *
13020 20 63 6f 6d 6d 61 6e 64 2d 20 6f 72 20 74 69 6d command- or tim
13030 65 2d 6c 69 6d 69 74 20 69 73 20 65 78 63 65 65 e-limit is excee
13040 64 65 64 20 62 79 20 61 6e 20 69 6e 74 65 72 70 ded by an interp
13050 72 65 74 65 72 2e 0a 20 2a 2f 0a 0a 74 79 70 65 reter.. */..type
13060 64 65 66 20 76 6f 69 64 20 28 54 63 6c 5f 4c 69 def void (Tcl_Li
13070 6d 69 74 48 61 6e 64 6c 65 72 50 72 6f 63 29 20 mitHandlerProc)
13080 28 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 61 74 (void *clientDat
13090 61 2c 20 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 a, Tcl_Interp *i
130a0 6e 74 65 72 70 29 3b 0a 23 64 65 66 69 6e 65 20 nterp);.#define
130b0 54 63 6c 5f 4c 69 6d 69 74 48 61 6e 64 6c 65 72 Tcl_LimitHandler
130c0 44 65 6c 65 74 65 50 72 6f 63 20 54 63 6c 5f 46 DeleteProc Tcl_F
130d0 72 65 65 50 72 6f 63 0a 0a 23 69 66 20 30 0a 2f reeProc..#if 0./
130e0 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d *. *------------
130f0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13100 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13110 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13120 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13130 0a 20 2a 20 57 65 20 77 6f 75 6c 64 20 6c 69 6b . * We would lik
13140 65 20 74 6f 20 70 72 6f 76 69 64 65 20 61 6e 20 e to provide an
13150 61 6e 6f 6e 79 6d 6f 75 73 20 73 74 72 75 63 74 anonymous struct
13160 75 72 65 20 22 6d 70 5f 69 6e 74 22 20 68 65 72 ure "mp_int" her
13170 65 2c 20 77 68 69 63 68 20 69 73 0a 20 2a 20 63 e, which is. * c
13180 6f 6d 70 61 74 69 62 6c 65 20 77 69 74 68 20 6c ompatible with l
13190 69 62 74 6f 6d 6d 61 74 68 27 73 20 22 6d 70 5f ibtommath's "mp_
131a0 69 6e 74 22 2c 20 62 75 74 20 77 69 74 68 6f 75 int", but withou
131b0 74 20 64 75 70 6c 69 63 61 74 69 6e 67 20 61 6e t duplicating an
131c0 79 74 68 69 6e 67 0a 20 2a 20 66 72 6f 6d 20 3c ything. * from <
131d0 74 6f 6d 6d 61 74 68 2e 68 3e 20 6f 72 20 69 6e tommath.h> or in
131e0 63 6c 75 64 69 6e 67 20 3c 74 6f 6d 6d 61 74 68 cluding <tommath
131f0 2e 68 3e 20 68 65 72 65 2e 20 42 75 74 20 74 68 .h> here. But th
13200 65 20 6c 69 62 74 6f 6d 6d 61 74 68 20 70 72 6f e libtommath pro
13210 6a 65 63 74 0a 20 2a 20 64 69 64 6e 27 74 20 68 ject. * didn't h
13220 6f 6e 6f 72 20 6f 75 72 20 72 65 71 75 65 73 74 onor our request
13230 2e 20 53 65 65 3a 20 3c 68 74 74 70 73 3a 2f 2f . See: <https://
13240 67 69 74 68 75 62 2e 63 6f 6d 2f 6c 69 62 74 6f github.com/libto
13250 6d 2f 6c 69 62 74 6f 6d 6d 61 74 68 2f 70 75 6c m/libtommath/pul
13260 6c 2f 34 37 33 3e 0a 20 2a 0a 20 2a 20 54 68 61 l/473>. *. * Tha
13270 74 27 73 20 77 68 79 20 74 68 69 73 20 70 61 72 t's why this par
13280 74 20 69 73 20 63 6f 6d 6d 65 6e 74 65 64 20 6f t is commented o
13290 75 74 2c 20 61 6e 64 20 77 65 20 61 72 65 20 75 ut, and we are u
132a0 73 69 6e 67 20 28 76 6f 69 64 20 2a 29 20 69 6e sing (void *) in
132b0 0a 20 2a 20 76 61 72 69 6f 75 73 20 41 50 49 27 . * various API'
132c0 73 20 69 6e 20 73 74 65 61 64 20 6f 66 20 74 68 s in stead of th
132d0 65 20 6d 6f 72 65 20 63 6f 72 72 65 63 74 20 28 e more correct (
132e0 6d 70 5f 69 6e 74 20 2a 29 2e 0a 20 2a 2f 0a 0a mp_int *).. */..
132f0 23 69 66 6e 64 65 66 20 4d 50 5f 49 4e 54 5f 44 #ifndef MP_INT_D
13300 45 43 4c 41 52 45 44 0a 23 64 65 66 69 6e 65 20 ECLARED.#define
13310 4d 50 5f 49 4e 54 5f 44 45 43 4c 41 52 45 44 0a MP_INT_DECLARED.
13320 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20 6d typedef struct m
13330 70 5f 69 6e 74 20 6d 70 5f 69 6e 74 3b 0a 23 65 p_int mp_int;.#e
13340 6e 64 69 66 0a 0a 23 65 6e 64 69 66 0a 0a 2f 2a ndif..#endif../*
13350 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d . *-------------
13360 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13370 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13380 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13390 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a ---------------.
133a0 20 2a 20 44 65 66 69 6e 69 74 69 6f 6e 73 20 6e * Definitions n
133b0 65 65 64 65 64 20 66 6f 72 20 54 63 6c 5f 50 61 eeded for Tcl_Pa
133c0 72 73 65 41 72 67 76 4f 62 6a 20 72 6f 75 74 69 rseArgvObj routi
133d0 6e 65 73 2e 0a 20 2a 20 42 61 73 65 64 20 6f 6e nes.. * Based on
133e0 20 74 6b 41 72 67 76 2e 63 2e 0a 20 2a 20 4d 6f tkArgv.c.. * Mo
133f0 64 69 66 69 63 61 74 69 6f 6e 73 20 66 72 6f 6d difications from
13400 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 61 72 the original ar
13410 65 20 63 6f 70 79 72 69 67 68 74 20 28 63 29 20 e copyright (c)
13420 53 61 6d 20 42 72 6f 6d 6c 65 79 20 32 30 30 36 Sam Bromley 2006
13430 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 73 74 . */..typedef st
13440 72 75 63 74 20 7b 0a 20 20 20 20 69 6e 74 20 74 ruct {. int t
13450 79 70 65 3b 09 09 09 2f 2a 20 49 6e 64 69 63 61 ype;.../* Indica
13460 74 65 73 20 74 68 65 20 6f 70 74 69 6f 6e 20 74 tes the option t
13470 79 70 65 3b 20 73 65 65 20 62 65 6c 6f 77 2e 20 ype; see below.
13480 2a 2f 0a 20 20 20 20 63 6f 6e 73 74 20 63 68 61 */. const cha
13490 72 20 2a 6b 65 79 53 74 72 3b 09 09 2f 2a 20 54 r *keyStr;../* T
134a0 68 65 20 6b 65 79 20 73 74 72 69 6e 67 20 74 68 he key string th
134b0 61 74 20 66 6c 61 67 73 20 74 68 65 20 6f 70 74 at flags the opt
134c0 69 6f 6e 20 69 6e 20 74 68 65 0a 09 09 09 09 20 ion in the.....
134d0 2a 20 61 72 67 76 20 61 72 72 61 79 2e 20 2a 2f * argv array. */
134e0 0a 20 20 20 20 76 6f 69 64 20 2a 73 72 63 50 74 . void *srcPt
134f0 72 3b 09 09 2f 2a 20 56 61 6c 75 65 20 74 6f 20 r;../* Value to
13500 62 65 20 75 73 65 64 20 69 6e 20 73 65 74 74 69 be used in setti
13510 6e 67 20 64 73 74 3b 20 75 73 61 67 65 0a 09 09 ng dst; usage...
13520 09 09 20 2a 20 64 65 70 65 6e 64 73 20 6f 6e 20 .. * depends on
13530 74 79 70 65 2e 2a 2f 0a 20 20 20 20 76 6f 69 64 type.*/. void
13540 20 2a 64 73 74 50 74 72 3b 09 09 2f 2a 20 41 64 *dstPtr;../* Ad
13550 64 72 65 73 73 20 6f 66 20 76 61 6c 75 65 20 74 dress of value t
13560 6f 20 62 65 20 6d 6f 64 69 66 69 65 64 3b 20 75 o be modified; u
13570 73 61 67 65 0a 09 09 09 09 20 2a 20 64 65 70 65 sage..... * depe
13580 6e 64 73 20 6f 6e 20 74 79 70 65 2e 2a 2f 0a 20 nds on type.*/.
13590 20 20 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 68 const char *h
135a0 65 6c 70 53 74 72 3b 09 2f 2a 20 44 6f 63 75 6d elpStr;./* Docum
135b0 65 6e 74 61 74 69 6f 6e 20 6d 65 73 73 61 67 65 entation message
135c0 20 64 65 73 63 72 69 62 69 6e 67 20 74 68 69 73 describing this
135d0 0a 09 09 09 09 20 2a 20 6f 70 74 69 6f 6e 2e 20 ..... * option.
135e0 2a 2f 0a 20 20 20 20 76 6f 69 64 20 2a 63 6c 69 */. void *cli
135f0 65 6e 74 44 61 74 61 3b 09 09 2f 2a 20 57 6f 72 entData;../* Wor
13600 64 20 74 6f 20 70 61 73 73 20 74 6f 20 66 75 6e d to pass to fun
13610 63 74 69 6f 6e 20 63 61 6c 6c 62 61 63 6b 73 2e ction callbacks.
13620 20 2a 2f 0a 7d 20 54 63 6c 5f 41 72 67 76 49 6e */.} Tcl_ArgvIn
13630 66 6f 3b 0a 0a 2f 2a 0a 20 2a 20 4c 65 67 61 6c fo;../*. * Legal
13640 20 76 61 6c 75 65 73 20 66 6f 72 20 74 68 65 20 values for the
13650 74 79 70 65 20 66 69 65 6c 64 20 6f 66 20 61 20 type field of a
13660 54 63 6c 5f 41 72 67 49 6e 66 6f 3a 20 73 65 65 Tcl_ArgInfo: see
13670 20 74 68 65 20 75 73 65 72 0a 20 2a 20 64 6f 63 the user. * doc
13680 75 6d 65 6e 74 61 74 69 6f 6e 20 66 6f 72 20 64 umentation for d
13690 65 74 61 69 6c 73 2e 0a 20 2a 2f 0a 0a 23 64 65 etails.. */..#de
136a0 66 69 6e 65 20 54 43 4c 5f 41 52 47 56 5f 43 4f fine TCL_ARGV_CO
136b0 4e 53 54 41 4e 54 09 31 35 0a 23 64 65 66 69 6e NSTANT.15.#defin
136c0 65 20 54 43 4c 5f 41 52 47 56 5f 49 4e 54 09 09 e TCL_ARGV_INT..
136d0 31 36 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 41 16.#define TCL_A
136e0 52 47 56 5f 53 54 52 49 4e 47 09 09 31 37 0a 23 RGV_STRING..17.#
136f0 64 65 66 69 6e 65 20 54 43 4c 5f 41 52 47 56 5f define TCL_ARGV_
13700 52 45 53 54 09 09 31 38 0a 23 64 65 66 69 6e 65 REST..18.#define
13710 20 54 43 4c 5f 41 52 47 56 5f 46 4c 4f 41 54 09 TCL_ARGV_FLOAT.
13720 09 31 39 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f .19.#define TCL_
13730 41 52 47 56 5f 46 55 4e 43 09 09 32 30 0a 23 64 ARGV_FUNC..20.#d
13740 65 66 69 6e 65 20 54 43 4c 5f 41 52 47 56 5f 47 efine TCL_ARGV_G
13750 45 4e 46 55 4e 43 09 32 31 0a 23 64 65 66 69 6e ENFUNC.21.#defin
13760 65 20 54 43 4c 5f 41 52 47 56 5f 48 45 4c 50 09 e TCL_ARGV_HELP.
13770 09 32 32 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f .22.#define TCL_
13780 41 52 47 56 5f 45 4e 44 09 09 32 33 0a 0a 2f 2a ARGV_END..23../*
13790 0a 20 2a 20 54 79 70 65 73 20 6f 66 20 63 61 6c . * Types of cal
137a0 6c 62 61 63 6b 20 66 75 6e 63 74 69 6f 6e 73 20 lback functions
137b0 66 6f 72 20 74 68 65 20 54 43 4c 5f 41 52 47 56 for the TCL_ARGV
137c0 5f 46 55 4e 43 20 61 6e 64 20 54 43 4c 5f 41 52 _FUNC and TCL_AR
137d0 47 56 5f 47 45 4e 46 55 4e 43 0a 20 2a 20 61 72 GV_GENFUNC. * ar
137e0 67 75 6d 65 6e 74 20 74 79 70 65 73 3a 0a 20 2a gument types:. *
137f0 2f 0a 0a 74 79 70 65 64 65 66 20 69 6e 74 20 28 /..typedef int (
13800 54 63 6c 5f 41 72 67 76 46 75 6e 63 50 72 6f 63 Tcl_ArgvFuncProc
13810 29 28 76 6f 69 64 20 2a 63 6c 69 65 6e 74 44 61 )(void *clientDa
13820 74 61 2c 20 54 63 6c 5f 4f 62 6a 20 2a 6f 62 6a ta, Tcl_Obj *obj
13830 50 74 72 2c 0a 09 76 6f 69 64 20 2a 64 73 74 50 Ptr,..void *dstP
13840 74 72 29 3b 0a 74 79 70 65 64 65 66 20 54 63 6c tr);.typedef Tcl
13850 5f 53 69 7a 65 20 28 54 63 6c 5f 41 72 67 76 47 _Size (Tcl_ArgvG
13860 65 6e 46 75 6e 63 50 72 6f 63 29 28 76 6f 69 64 enFuncProc)(void
13870 20 2a 63 6c 69 65 6e 74 44 61 74 61 2c 20 54 63 *clientData, Tc
13880 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 l_Interp *interp
13890 2c 0a 09 54 63 6c 5f 53 69 7a 65 20 6f 62 6a 63 ,..Tcl_Size objc
138a0 2c 20 54 63 6c 5f 4f 62 6a 20 2a 63 6f 6e 73 74 , Tcl_Obj *const
138b0 20 2a 6f 62 6a 76 2c 20 76 6f 69 64 20 2a 64 73 *objv, void *ds
138c0 74 50 74 72 29 3b 0a 0a 2f 2a 0a 20 2a 20 53 68 tPtr);../*. * Sh
138d0 6f 72 74 68 61 6e 64 20 66 6f 72 20 63 6f 6d 6d orthand for comm
138e0 6f 6e 6c 79 20 75 73 65 64 20 61 72 67 54 61 62 only used argTab
138f0 6c 65 20 65 6e 74 72 69 65 73 2e 0a 20 2a 2f 0a le entries.. */.
13900 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 41 52 47 .#define TCL_ARG
13910 56 5f 41 55 54 4f 5f 48 45 4c 50 20 5c 0a 20 20 V_AUTO_HELP \.
13920 20 20 7b 54 43 4c 5f 41 52 47 56 5f 48 45 4c 50 {TCL_ARGV_HELP
13930 2c 09 22 2d 68 65 6c 70 22 2c 09 4e 55 4c 4c 2c ,."-help",.NULL,
13940 09 4e 55 4c 4c 2c 20 5c 0a 09 20 20 20 20 22 50 .NULL, \.. "P
13950 72 69 6e 74 20 73 75 6d 6d 61 72 79 20 6f 66 20 rint summary of
13960 63 6f 6d 6d 61 6e 64 2d 6c 69 6e 65 20 6f 70 74 command-line opt
13970 69 6f 6e 73 20 61 6e 64 20 61 62 6f 72 74 22 2c ions and abort",
13980 20 4e 55 4c 4c 7d 0a 23 64 65 66 69 6e 65 20 54 NULL}.#define T
13990 43 4c 5f 41 52 47 56 5f 41 55 54 4f 5f 52 45 53 CL_ARGV_AUTO_RES
139a0 54 20 5c 0a 20 20 20 20 7b 54 43 4c 5f 41 52 47 T \. {TCL_ARG
139b0 56 5f 52 45 53 54 2c 09 22 2d 2d 22 2c 09 09 4e V_REST,."--",..N
139c0 55 4c 4c 2c 09 4e 55 4c 4c 2c 20 5c 0a 09 20 20 ULL,.NULL, \..
139d0 20 20 22 4d 61 72 6b 73 20 74 68 65 20 65 6e 64 "Marks the end
139e0 20 6f 66 20 74 68 65 20 6f 70 74 69 6f 6e 73 22 of the options"
139f0 2c 20 4e 55 4c 4c 7d 0a 23 64 65 66 69 6e 65 20 , NULL}.#define
13a00 54 43 4c 5f 41 52 47 56 5f 54 41 42 4c 45 5f 45 TCL_ARGV_TABLE_E
13a10 4e 44 20 5c 0a 20 20 20 20 7b 54 43 4c 5f 41 52 ND \. {TCL_AR
13a20 47 56 5f 45 4e 44 2c 20 4e 55 4c 4c 2c 20 4e 55 GV_END, NULL, NU
13a30 4c 4c 2c 20 4e 55 4c 4c 2c 20 4e 55 4c 4c 2c 20 LL, NULL, NULL,
13a40 4e 55 4c 4c 7d 0a 0a 2f 2a 0a 20 2a 2d 2d 2d 2d NULL}../*. *----
13a50 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13a60 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13a70 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13a80 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13a90 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 44 65 66 69 --------. * Defi
13aa0 6e 69 74 69 6f 6e 73 20 6e 65 65 64 65 64 20 66 nitions needed f
13ab0 6f 72 20 54 63 6c 5f 5a 6c 69 62 20 72 6f 75 74 or Tcl_Zlib rout
13ac0 69 6e 65 73 2e 20 5b 54 49 50 20 23 32 33 34 5d ines. [TIP #234]
13ad0 0a 20 2a 0a 20 2a 20 43 6f 6e 73 74 61 6e 74 73 . *. * Constants
13ae0 20 66 6f 72 20 74 68 65 20 66 6f 72 6d 61 74 20 for the format
13af0 66 6c 61 67 73 20 64 65 73 63 72 69 62 69 6e 67 flags describing
13b00 20 77 68 61 74 20 73 6f 72 74 20 6f 66 20 64 61 what sort of da
13b10 74 61 20 66 6f 72 6d 61 74 20 69 73 0a 20 2a 20 ta format is. *
13b20 64 65 73 69 72 65 64 2f 65 78 70 65 63 74 65 64 desired/expected
13b30 20 66 6f 72 20 74 68 65 20 54 63 6c 5f 5a 6c 69 for the Tcl_Zli
13b40 62 44 65 66 6c 61 74 65 2c 20 54 63 6c 5f 5a 6c bDeflate, Tcl_Zl
13b50 69 62 49 6e 66 6c 61 74 65 20 61 6e 64 0a 20 2a ibInflate and. *
13b60 20 54 63 6c 5f 5a 6c 69 62 53 74 72 65 61 6d 49 Tcl_ZlibStreamI
13b70 6e 69 74 20 66 75 6e 63 74 69 6f 6e 73 2e 0a 20 nit functions..
13b80 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f */..#define TCL_
13b90 5a 4c 49 42 5f 46 4f 52 4d 41 54 5f 52 41 57 09 ZLIB_FORMAT_RAW.
13ba0 31 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 5a 4c 1.#define TCL_ZL
13bb0 49 42 5f 46 4f 52 4d 41 54 5f 5a 4c 49 42 09 32 IB_FORMAT_ZLIB.2
13bc0 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 5a 4c 49 .#define TCL_ZLI
13bd0 42 5f 46 4f 52 4d 41 54 5f 47 5a 49 50 09 34 0a B_FORMAT_GZIP.4.
13be0 23 64 65 66 69 6e 65 20 54 43 4c 5f 5a 4c 49 42 #define TCL_ZLIB
13bf0 5f 46 4f 52 4d 41 54 5f 41 55 54 4f 09 38 0a 0a _FORMAT_AUTO.8..
13c00 2f 2a 0a 20 2a 20 43 6f 6e 73 74 61 6e 74 73 20 /*. * Constants
13c10 74 68 61 74 20 64 65 73 63 72 69 62 65 20 77 68 that describe wh
13c20 65 74 68 65 72 20 74 68 65 20 73 74 72 65 61 6d ether the stream
13c30 20 69 73 20 74 6f 20 6f 70 65 72 61 74 65 20 69 is to operate i
13c40 6e 20 63 6f 6d 70 72 65 73 73 69 6e 67 20 6f 72 n compressing or
13c50 0a 20 2a 20 64 65 63 6f 6d 70 72 65 73 73 69 6e . * decompressin
13c60 67 20 6d 6f 64 65 2e 0a 20 2a 2f 0a 0a 23 64 65 g mode.. */..#de
13c70 66 69 6e 65 20 54 43 4c 5f 5a 4c 49 42 5f 53 54 fine TCL_ZLIB_ST
13c80 52 45 41 4d 5f 44 45 46 4c 41 54 45 09 31 36 0a REAM_DEFLATE.16.
13c90 23 64 65 66 69 6e 65 20 54 43 4c 5f 5a 4c 49 42 #define TCL_ZLIB
13ca0 5f 53 54 52 45 41 4d 5f 49 4e 46 4c 41 54 45 09 _STREAM_INFLATE.
13cb0 33 32 0a 0a 2f 2a 0a 20 2a 20 43 6f 6e 73 74 61 32../*. * Consta
13cc0 6e 74 73 20 67 69 76 69 6e 67 20 63 6f 6d 70 72 nts giving compr
13cd0 65 73 73 69 6f 6e 20 6c 65 76 65 6c 73 2e 20 55 ession levels. U
13ce0 73 65 20 6f 66 20 54 43 4c 5f 5a 4c 49 42 5f 43 se of TCL_ZLIB_C
13cf0 4f 4d 50 52 45 53 53 5f 44 45 46 41 55 4c 54 20 OMPRESS_DEFAULT
13d00 69 73 0a 20 2a 20 72 65 63 6f 6d 6d 65 6e 64 65 is. * recommende
13d10 64 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 d.. */..#define
13d20 54 43 4c 5f 5a 4c 49 42 5f 43 4f 4d 50 52 45 53 TCL_ZLIB_COMPRES
13d30 53 5f 4e 4f 4e 45 09 30 0a 23 64 65 66 69 6e 65 S_NONE.0.#define
13d40 20 54 43 4c 5f 5a 4c 49 42 5f 43 4f 4d 50 52 45 TCL_ZLIB_COMPRE
13d50 53 53 5f 46 41 53 54 09 31 0a 23 64 65 66 69 6e SS_FAST.1.#defin
13d60 65 20 54 43 4c 5f 5a 4c 49 42 5f 43 4f 4d 50 52 e TCL_ZLIB_COMPR
13d70 45 53 53 5f 42 45 53 54 09 39 0a 23 64 65 66 69 ESS_BEST.9.#defi
13d80 6e 65 20 54 43 4c 5f 5a 4c 49 42 5f 43 4f 4d 50 ne TCL_ZLIB_COMP
13d90 52 45 53 53 5f 44 45 46 41 55 4c 54 20 28 2d 31 RESS_DEFAULT (-1
13da0 29 0a 0a 2f 2a 0a 20 2a 20 43 6f 6e 73 74 61 6e )../*. * Constan
13db0 74 73 20 66 6f 72 20 74 79 70 65 73 20 6f 66 20 ts for types of
13dc0 66 6c 75 73 68 69 6e 67 2c 20 75 73 65 64 20 77 flushing, used w
13dd0 69 74 68 20 54 63 6c 5f 5a 6c 69 62 46 6c 75 73 ith Tcl_ZlibFlus
13de0 68 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 h.. */..#define
13df0 54 43 4c 5f 5a 4c 49 42 5f 4e 4f 5f 46 4c 55 53 TCL_ZLIB_NO_FLUS
13e00 48 09 30 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f H.0.#define TCL_
13e10 5a 4c 49 42 5f 46 4c 55 53 48 09 09 32 0a 23 64 ZLIB_FLUSH..2.#d
13e20 65 66 69 6e 65 20 54 43 4c 5f 5a 4c 49 42 5f 46 efine TCL_ZLIB_F
13e30 55 4c 4c 46 4c 55 53 48 09 33 0a 23 64 65 66 69 ULLFLUSH.3.#defi
13e40 6e 65 20 54 43 4c 5f 5a 4c 49 42 5f 46 49 4e 41 ne TCL_ZLIB_FINA
13e50 4c 49 5a 45 09 34 0a 0a 2f 2a 0a 20 2a 2d 2d 2d LIZE.4../*. *---
13e60 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13e70 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13e80 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13e90 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13ea0 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 44 65 66 ---------. * Def
13eb0 69 6e 69 74 69 6f 6e 73 20 6e 65 65 64 65 64 20 initions needed
13ec0 66 6f 72 20 74 68 65 20 54 63 6c 5f 4c 6f 61 64 for the Tcl_Load
13ed0 46 69 6c 65 20 66 75 6e 63 74 69 6f 6e 2e 20 5b File function. [
13ee0 54 49 50 20 23 34 31 36 5d 0a 20 2a 2f 0a 0a 23 TIP #416]. */..#
13ef0 64 65 66 69 6e 65 20 54 43 4c 5f 4c 4f 41 44 5f define TCL_LOAD_
13f00 47 4c 4f 42 41 4c 20 31 0a 23 64 65 66 69 6e 65 GLOBAL 1.#define
13f10 20 54 43 4c 5f 4c 4f 41 44 5f 4c 41 5a 59 20 32 TCL_LOAD_LAZY 2
13f20 0a 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d ../*. *---------
13f30 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13f40 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13f50 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13f60 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
13f70 2d 2d 2d 0a 20 2a 20 44 65 66 69 6e 69 74 69 6f ---. * Definitio
13f80 6e 73 20 6e 65 65 64 65 64 20 66 6f 72 20 74 68 ns needed for th
13f90 65 20 54 63 6c 5f 4f 70 65 6e 54 63 70 53 65 72 e Tcl_OpenTcpSer
13fa0 76 65 72 45 78 20 66 75 6e 63 74 69 6f 6e 2e 20 verEx function.
13fb0 5b 54 49 50 20 23 34 35 36 5d 0a 20 2a 2f 0a 23 [TIP #456]. */.#
13fc0 64 65 66 69 6e 65 20 54 43 4c 5f 54 43 50 53 45 define TCL_TCPSE
13fd0 52 56 45 52 5f 52 45 55 53 45 41 44 44 52 20 28 RVER_REUSEADDR (
13fe0 31 3c 3c 30 29 0a 23 64 65 66 69 6e 65 20 54 43 1<<0).#define TC
13ff0 4c 5f 54 43 50 53 45 52 56 45 52 5f 52 45 55 53 L_TCPSERVER_REUS
14000 45 50 4f 52 54 20 28 31 3c 3c 31 29 0a 0a 2f 2a EPORT (1<<1)../*
14010 0a 20 2a 20 43 6f 6e 73 74 61 6e 74 73 20 66 6f . * Constants fo
14020 72 20 73 70 65 63 69 61 6c 20 54 63 6c 5f 53 69 r special Tcl_Si
14030 7a 65 2d 74 79 70 65 64 20 76 61 6c 75 65 73 2c ze-typed values,
14040 20 73 65 65 20 54 49 50 20 23 34 39 34 0a 20 2a see TIP #494. *
14050 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 49 /..#define TCL_I
14060 4f 5f 46 41 49 4c 55 52 45 09 28 28 54 63 6c 5f O_FAILURE.((Tcl_
14070 53 69 7a 65 29 2d 31 29 0a 23 64 65 66 69 6e 65 Size)-1).#define
14080 20 54 43 4c 5f 41 55 54 4f 5f 4c 45 4e 47 54 48 TCL_AUTO_LENGTH
14090 09 28 28 54 63 6c 5f 53 69 7a 65 29 2d 31 29 0a .((Tcl_Size)-1).
140a0 23 64 65 66 69 6e 65 20 54 43 4c 5f 49 4e 44 45 #define TCL_INDE
140b0 58 5f 4e 4f 4e 45 20 20 28 28 54 63 6c 5f 53 69 X_NONE ((Tcl_Si
140c0 7a 65 29 2d 31 29 0a 0a 2f 2a 0a 20 2a 2d 2d 2d ze)-1)../*. *---
140d0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
140e0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
140f0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
14100 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
14110 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 2a 20 53 69 6e ---------. * Sin
14120 67 6c 65 20 70 75 62 6c 69 63 20 64 65 63 6c 61 gle public decla
14130 72 61 74 69 6f 6e 20 66 6f 72 20 4e 52 45 2e 0a ration for NRE..
14140 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 69 6e 74 */..typedef int
14150 20 28 54 63 6c 5f 4e 52 50 6f 73 74 50 72 6f 63 (Tcl_NRPostProc
14160 29 20 28 76 6f 69 64 20 2a 64 61 74 61 5b 5d 2c ) (void *data[],
14170 20 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 Tcl_Interp *int
14180 65 72 70 2c 20 69 6e 74 20 72 65 73 75 6c 74 29 erp, int result)
14190 3b 0a 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d ;../*. *--------
141a0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
141b0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
141c0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
141d0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
141e0 2d 2d 2d 2d 0a 20 2a 20 54 68 65 20 66 6f 6c 6c ----. * The foll
141f0 6f 77 69 6e 67 20 63 6f 6e 73 74 61 6e 74 20 69 owing constant i
14200 73 20 75 73 65 64 20 74 6f 20 74 65 73 74 20 66 s used to test f
14210 6f 72 20 6f 6c 64 65 72 20 76 65 72 73 69 6f 6e or older version
14220 73 20 6f 66 20 54 63 6c 20 69 6e 20 74 68 65 0a s of Tcl in the.
14230 20 2a 20 73 74 75 62 73 20 74 61 62 6c 65 73 2e * stubs tables.
14240 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 . */..#define TC
14250 4c 5f 53 54 55 42 5f 4d 41 47 49 43 09 09 28 28 L_STUB_MAGIC..((
14260 69 6e 74 29 20 30 78 46 43 41 33 42 41 43 42 20 int) 0xFCA3BACB
14270 2b 20 28 69 6e 74 29 20 73 69 7a 65 6f 66 28 76 + (int) sizeof(v
14280 6f 69 64 20 2a 29 29 0a 0a 2f 2a 0a 20 2a 20 54 oid *))../*. * T
14290 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 66 75 6e he following fun
142a0 63 74 69 6f 6e 20 69 73 20 72 65 71 75 69 72 65 ction is require
142b0 64 20 74 6f 20 62 65 20 64 65 66 69 6e 65 64 20 d to be defined
142c0 69 6e 20 61 6c 6c 20 73 74 75 62 73 20 61 77 61 in all stubs awa
142d0 72 65 0a 20 2a 20 65 78 74 65 6e 73 69 6f 6e 73 re. * extensions
142e0 2e 20 54 68 65 20 66 75 6e 63 74 69 6f 6e 20 69 . The function i
142f0 73 20 61 63 74 75 61 6c 6c 79 20 69 6d 70 6c 65 s actually imple
14300 6d 65 6e 74 65 64 20 69 6e 20 74 68 65 20 73 74 mented in the st
14310 75 62 20 6c 69 62 72 61 72 79 2c 20 6e 6f 74 0a ub library, not.
14320 20 2a 20 74 68 65 20 6d 61 69 6e 20 54 63 6c 20 * the main Tcl
14330 6c 69 62 72 61 72 79 2c 20 61 6c 74 68 6f 75 67 library, althoug
14340 68 20 74 68 65 72 65 20 69 73 20 61 20 74 72 69 h there is a tri
14350 76 69 61 6c 20 69 6d 70 6c 65 6d 65 6e 74 61 74 vial implementat
14360 69 6f 6e 20 69 6e 20 74 68 65 0a 20 2a 20 6d 61 ion in the. * ma
14370 69 6e 20 6c 69 62 72 61 72 79 20 69 6e 20 63 61 in library in ca
14380 73 65 20 61 6e 20 65 78 74 65 6e 73 69 6f 6e 20 se an extension
14390 69 73 20 73 74 61 74 69 63 61 6c 6c 79 20 6c 69 is statically li
143a0 6e 6b 65 64 20 69 6e 74 6f 20 61 6e 20 61 70 70 nked into an app
143b0 6c 69 63 61 74 69 6f 6e 2e 0a 20 2a 2f 0a 0a 63 lication.. */..c
143c0 6f 6e 73 74 20 63 68 61 72 20 2a 09 09 54 63 6c onst char *..Tcl
143d0 5f 49 6e 69 74 53 74 75 62 73 28 54 63 6c 5f 49 _InitStubs(Tcl_I
143e0 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c 20 63 nterp *interp, c
143f0 6f 6e 73 74 20 63 68 61 72 20 2a 76 65 72 73 69 onst char *versi
14400 6f 6e 2c 0a 09 09 09 20 20 20 20 69 6e 74 20 65 on,.... int e
14410 78 61 63 74 2c 20 69 6e 74 20 6d 61 67 69 63 29 xact, int magic)
14420 3b 0a 63 6f 6e 73 74 20 63 68 61 72 20 2a 09 09 ;.const char *..
14430 54 63 6c 54 6f 6d 4d 61 74 68 49 6e 69 74 69 61 TclTomMathInitia
14440 6c 69 7a 65 53 74 75 62 73 28 54 63 6c 5f 49 6e lizeStubs(Tcl_In
14450 74 65 72 70 20 2a 69 6e 74 65 72 70 2c 0a 09 09 terp *interp,...
14460 09 20 20 20 20 63 6f 6e 73 74 20 63 68 61 72 20 . const char
14470 2a 76 65 72 73 69 6f 6e 2c 20 69 6e 74 20 65 70 *version, int ep
14480 6f 63 68 2c 20 69 6e 74 20 72 65 76 69 73 69 6f och, int revisio
14490 6e 29 3b 0a 63 6f 6e 73 74 20 63 68 61 72 20 2a n);.const char *
144a0 09 09 54 63 6c 49 6e 69 74 53 74 75 62 54 61 62 ..TclInitStubTab
144b0 6c 65 28 63 6f 6e 73 74 20 63 68 61 72 20 2a 76 le(const char *v
144c0 65 72 73 69 6f 6e 29 3b 0a 76 6f 69 64 20 2a 09 ersion);.void *.
144d0 09 09 54 63 6c 53 74 75 62 43 61 6c 6c 28 76 6f ..TclStubCall(vo
144e0 69 64 20 2a 61 72 67 29 3b 0a 23 69 66 20 64 65 id *arg);.#if de
144f0 66 69 6e 65 64 28 5f 57 49 4e 33 32 29 0a 20 20 fined(_WIN32).
14500 20 20 54 43 4c 5f 4e 4f 52 45 54 55 52 4e 20 76 TCL_NORETURN v
14510 6f 69 64 20 54 63 6c 5f 43 6f 6e 73 6f 6c 65 50 oid Tcl_ConsoleP
14520 61 6e 69 63 28 63 6f 6e 73 74 20 63 68 61 72 20 anic(const char
14530 2a 66 6f 72 6d 61 74 2c 20 2e 2e 2e 29 3b 0a 23 *format, ...);.#
14540 65 6c 73 65 0a 23 20 20 20 64 65 66 69 6e 65 20 else.# define
14550 54 63 6c 5f 43 6f 6e 73 6f 6c 65 50 61 6e 69 63 Tcl_ConsolePanic
14560 20 28 28 54 63 6c 5f 50 61 6e 69 63 50 72 6f 63 ((Tcl_PanicProc
14570 20 2a 29 4e 55 4c 4c 29 0a 23 65 6e 64 69 66 0a *)NULL).#endif.
14580 0a 23 69 66 64 65 66 20 55 53 45 5f 54 43 4c 5f .#ifdef USE_TCL_
14590 53 54 55 42 53 0a 23 20 20 20 64 65 66 69 6e 65 STUBS.# define
145a0 20 54 63 6c 5f 49 6e 69 74 53 74 75 62 73 28 69 Tcl_InitStubs(i
145b0 6e 74 65 72 70 2c 20 76 65 72 73 69 6f 6e 2c 20 nterp, version,
145c0 65 78 61 63 74 29 20 5c 0a 09 28 54 63 6c 5f 49 exact) \..(Tcl_I
145d0 6e 69 74 53 74 75 62 73 29 28 69 6e 74 65 72 70 nitStubs)(interp
145e0 2c 20 76 65 72 73 69 6f 6e 2c 20 5c 0a 09 20 20 , version, \..
145f0 20 20 28 65 78 61 63 74 29 7c 28 54 43 4c 5f 4d (exact)|(TCL_M
14600 41 4a 4f 52 5f 56 45 52 53 49 4f 4e 3c 3c 38 29 AJOR_VERSION<<8)
14610 7c 28 54 43 4c 5f 4d 49 4e 4f 52 5f 56 45 52 53 |(TCL_MINOR_VERS
14620 49 4f 4e 3c 3c 31 36 29 2c 20 5c 0a 09 20 20 20 ION<<16), \..
14630 20 54 43 4c 5f 53 54 55 42 5f 4d 41 47 49 43 29 TCL_STUB_MAGIC)
14640 0a 23 65 6c 73 65 0a 23 20 20 20 64 65 66 69 6e .#else.# defin
14650 65 20 54 63 6c 5f 49 6e 69 74 53 74 75 62 73 28 e Tcl_InitStubs(
14660 69 6e 74 65 72 70 2c 20 76 65 72 73 69 6f 6e 2c interp, version,
14670 20 65 78 61 63 74 29 20 5c 0a 09 54 63 6c 5f 50 exact) \..Tcl_P
14680 6b 67 49 6e 69 74 53 74 75 62 73 43 68 65 63 6b kgInitStubsCheck
14690 28 69 6e 74 65 72 70 2c 20 76 65 72 73 69 6f 6e (interp, version
146a0 2c 20 5c 0a 09 09 28 65 78 61 63 74 29 7c 28 54 , \...(exact)|(T
146b0 43 4c 5f 4d 41 4a 4f 52 5f 56 45 52 53 49 4f 4e CL_MAJOR_VERSION
146c0 3c 3c 38 29 7c 28 54 43 4c 5f 4d 49 4e 4f 52 5f <<8)|(TCL_MINOR_
146d0 56 45 52 53 49 4f 4e 3c 3c 31 36 29 29 0a 23 65 VERSION<<16)).#e
146e0 6e 64 69 66 0a 0a 2f 2a 0a 20 2a 20 50 75 62 6c ndif../*. * Publ
146f0 69 63 20 66 75 6e 63 74 69 6f 6e 73 20 74 68 61 ic functions tha
14700 74 20 61 72 65 20 6e 6f 74 20 61 63 63 65 73 73 t are not access
14710 69 62 6c 65 20 76 69 61 20 74 68 65 20 73 74 75 ible via the stu
14720 62 73 20 74 61 62 6c 65 2e 0a 20 2a 20 54 63 6c bs table.. * Tcl
14730 5f 47 65 74 4d 65 6d 6f 72 79 49 6e 66 6f 20 69 _GetMemoryInfo i
14740 73 20 6e 65 65 64 65 64 20 66 6f 72 20 41 4f 4c s needed for AOL
14750 73 65 72 76 65 72 2e 20 5b 42 75 67 20 31 38 36 server. [Bug 186
14760 38 31 37 31 5d 0a 20 2a 2f 0a 0a 23 64 65 66 69 8171]. */..#defi
14770 6e 65 20 54 63 6c 5f 4d 61 69 6e 28 61 72 67 63 ne Tcl_Main(argc
14780 2c 20 61 72 67 76 2c 20 70 72 6f 63 29 20 54 63 , argv, proc) Tc
14790 6c 5f 4d 61 69 6e 45 78 28 61 72 67 63 2c 20 61 l_MainEx(argc, a
147a0 72 67 76 2c 20 70 72 6f 63 2c 20 5c 0a 09 20 20 rgv, proc, \..
147b0 20 20 28 28 54 63 6c 5f 53 65 74 50 61 6e 69 63 ((Tcl_SetPanic
147c0 50 72 6f 63 28 54 63 6c 5f 43 6f 6e 73 6f 6c 65 Proc(Tcl_Console
147d0 50 61 6e 69 63 29 2c 20 54 63 6c 5f 43 72 65 61 Panic), Tcl_Crea
147e0 74 65 49 6e 74 65 72 70 28 29 29 29 29 0a 45 58 teInterp()))).EX
147f0 54 45 52 4e 20 54 43 4c 5f 4e 4f 52 45 54 55 52 TERN TCL_NORETUR
14800 4e 20 76 6f 69 64 20 54 63 6c 5f 4d 61 69 6e 45 N void Tcl_MainE
14810 78 28 54 63 6c 5f 53 69 7a 65 20 61 72 67 63 2c x(Tcl_Size argc,
14820 20 63 68 61 72 20 2a 2a 61 72 67 76 2c 0a 09 09 char **argv,...
14830 09 20 20 20 20 54 63 6c 5f 41 70 70 49 6e 69 74 . Tcl_AppInit
14840 50 72 6f 63 20 2a 61 70 70 49 6e 69 74 50 72 6f Proc *appInitPro
14850 63 2c 20 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 c, Tcl_Interp *i
14860 6e 74 65 72 70 29 3b 0a 45 58 54 45 52 4e 20 63 nterp);.EXTERN c
14870 6f 6e 73 74 20 63 68 61 72 20 2a 09 54 63 6c 5f onst char *.Tcl_
14880 50 6b 67 49 6e 69 74 53 74 75 62 73 43 68 65 63 PkgInitStubsChec
14890 6b 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e k(Tcl_Interp *in
148a0 74 65 72 70 2c 0a 09 09 09 20 20 20 20 63 6f 6e terp,.... con
148b0 73 74 20 63 68 61 72 20 2a 76 65 72 73 69 6f 6e st char *version
148c0 2c 20 69 6e 74 20 65 78 61 63 74 29 3b 0a 45 58 , int exact);.EX
148d0 54 45 52 4e 20 63 6f 6e 73 74 20 63 68 61 72 20 TERN const char
148e0 2a 09 54 63 6c 5f 49 6e 69 74 53 75 62 73 79 73 *.Tcl_InitSubsys
148f0 74 65 6d 73 28 76 6f 69 64 29 3b 0a 45 58 54 45 tems(void);.EXTE
14900 52 4e 20 76 6f 69 64 09 09 54 63 6c 5f 47 65 74 RN void..Tcl_Get
14910 4d 65 6d 6f 72 79 49 6e 66 6f 28 54 63 6c 5f 44 MemoryInfo(Tcl_D
14920 53 74 72 69 6e 67 20 2a 64 73 50 74 72 29 3b 0a String *dsPtr);.
14930 45 58 54 45 52 4e 20 63 6f 6e 73 74 20 63 68 61 EXTERN const cha
14940 72 20 2a 09 54 63 6c 5f 46 69 6e 64 45 78 65 63 r *.Tcl_FindExec
14950 75 74 61 62 6c 65 28 63 6f 6e 73 74 20 63 68 61 utable(const cha
14960 72 20 2a 61 72 67 76 30 29 3b 0a 45 58 54 45 52 r *argv0);.EXTER
14970 4e 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 09 54 N const char *.T
14980 63 6c 5f 53 65 74 50 72 65 49 6e 69 74 53 63 72 cl_SetPreInitScr
14990 69 70 74 28 63 6f 6e 73 74 20 63 68 61 72 20 2a ipt(const char *
149a0 73 74 72 69 6e 67 29 3b 0a 45 58 54 45 52 4e 20 string);.EXTERN
149b0 63 6f 6e 73 74 20 63 68 61 72 20 2a 09 54 63 6c const char *.Tcl
149c0 5f 53 65 74 50 61 6e 69 63 50 72 6f 63 28 0a 09 _SetPanicProc(..
149d0 09 09 20 20 20 20 54 63 6c 5f 50 61 6e 69 63 50 .. Tcl_PanicP
149e0 72 6f 63 20 2a 70 61 6e 69 63 50 72 6f 63 29 3b roc *panicProc);
149f0 0a 45 58 54 45 52 4e 20 76 6f 69 64 09 09 54 63 .EXTERN void..Tc
14a00 6c 5f 53 74 61 74 69 63 4c 69 62 72 61 72 79 28 l_StaticLibrary(
14a10 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 Tcl_Interp *inte
14a20 72 70 2c 0a 09 09 09 20 20 20 20 63 6f 6e 73 74 rp,.... const
14a30 20 63 68 61 72 20 2a 70 72 65 66 69 78 2c 0a 09 char *prefix,..
14a40 09 09 20 20 20 20 54 63 6c 5f 4c 69 62 72 61 72 .. Tcl_Librar
14a50 79 49 6e 69 74 50 72 6f 63 20 2a 69 6e 69 74 50 yInitProc *initP
14a60 72 6f 63 2c 0a 09 09 09 20 20 20 20 54 63 6c 5f roc,.... Tcl_
14a70 4c 69 62 72 61 72 79 49 6e 69 74 50 72 6f 63 20 LibraryInitProc
14a80 2a 73 61 66 65 49 6e 69 74 50 72 6f 63 29 3b 0a *safeInitProc);.
14a90 23 69 66 6e 64 65 66 20 54 43 4c 5f 4e 4f 5f 44 #ifndef TCL_NO_D
14aa0 45 50 52 45 43 41 54 45 44 0a 23 20 20 20 64 65 EPRECATED.# de
14ab0 66 69 6e 65 20 54 63 6c 5f 53 74 61 74 69 63 50 fine Tcl_StaticP
14ac0 61 63 6b 61 67 65 20 54 63 6c 5f 53 74 61 74 69 ackage Tcl_Stati
14ad0 63 4c 69 62 72 61 72 79 0a 23 65 6e 64 69 66 0a cLibrary.#endif.
14ae0 45 58 54 45 52 4e 20 54 63 6c 5f 45 78 69 74 50 EXTERN Tcl_ExitP
14af0 72 6f 63 20 2a 09 54 63 6c 5f 53 65 74 45 78 69 roc *.Tcl_SetExi
14b00 74 50 72 6f 63 28 54 63 6c 5f 45 78 69 74 50 72 tProc(Tcl_ExitPr
14b10 6f 63 20 2a 70 72 6f 63 29 3b 0a 23 69 66 64 65 oc *proc);.#ifde
14b20 66 20 5f 57 49 4e 33 32 0a 45 58 54 45 52 4e 20 f _WIN32.EXTERN
14b30 63 6f 6e 73 74 20 63 68 61 72 20 2a 09 54 63 6c const char *.Tcl
14b40 5a 69 70 66 73 5f 41 70 70 48 6f 6f 6b 28 69 6e Zipfs_AppHook(in
14b50 74 20 2a 61 72 67 63 2c 20 75 6e 73 69 67 6e 65 t *argc, unsigne
14b60 64 20 73 68 6f 72 74 20 2a 2a 2a 61 72 67 76 29 d short ***argv)
14b70 3b 0a 23 65 6c 73 65 0a 45 58 54 45 52 4e 20 63 ;.#else.EXTERN c
14b80 6f 6e 73 74 20 63 68 61 72 20 2a 09 54 63 6c 5a onst char *.TclZ
14b90 69 70 66 73 5f 41 70 70 48 6f 6f 6b 28 69 6e 74 ipfs_AppHook(int
14ba0 20 2a 61 72 67 63 2c 20 63 68 61 72 20 2a 2a 2a *argc, char ***
14bb0 61 72 67 76 29 3b 0a 23 65 6e 64 69 66 0a 23 69 argv);.#endif.#i
14bc0 66 20 64 65 66 69 6e 65 64 28 5f 57 49 4e 33 32 f defined(_WIN32
14bd0 29 20 26 26 20 64 65 66 69 6e 65 64 28 55 4e 49 ) && defined(UNI
14be0 43 4f 44 45 29 0a 23 69 66 6e 64 65 66 20 55 53 CODE).#ifndef US
14bf0 45 5f 54 43 4c 5f 53 54 55 42 53 0a 23 20 20 20 E_TCL_STUBS.#
14c00 64 65 66 69 6e 65 20 54 63 6c 5f 46 69 6e 64 45 define Tcl_FindE
14c10 78 65 63 75 74 61 62 6c 65 28 61 72 67 29 20 28 xecutable(arg) (
14c20 28 54 63 6c 5f 46 69 6e 64 45 78 65 63 75 74 61 (Tcl_FindExecuta
14c30 62 6c 65 29 28 28 63 6f 6e 73 74 20 63 68 61 72 ble)((const char
14c40 20 2a 29 28 61 72 67 29 29 29 0a 23 65 6e 64 69 *)(arg))).#endi
14c50 66 0a 23 20 20 20 64 65 66 69 6e 65 20 54 63 6c f.# define Tcl
14c60 5f 4d 61 69 6e 45 78 20 54 63 6c 5f 4d 61 69 6e _MainEx Tcl_Main
14c70 45 78 57 0a 20 20 20 20 45 58 54 45 52 4e 20 54 ExW. EXTERN T
14c80 43 4c 5f 4e 4f 52 45 54 55 52 4e 20 76 6f 69 64 CL_NORETURN void
14c90 20 54 63 6c 5f 4d 61 69 6e 45 78 57 28 54 63 6c Tcl_MainExW(Tcl
14ca0 5f 53 69 7a 65 20 61 72 67 63 2c 20 75 6e 73 69 _Size argc, unsi
14cb0 67 6e 65 64 20 73 68 6f 72 74 20 2a 2a 61 72 67 gned short **arg
14cc0 76 2c 0a 09 20 20 20 20 54 63 6c 5f 41 70 70 49 v,.. Tcl_AppI
14cd0 6e 69 74 50 72 6f 63 20 2a 61 70 70 49 6e 69 74 nitProc *appInit
14ce0 50 72 6f 63 2c 20 54 63 6c 5f 49 6e 74 65 72 70 Proc, Tcl_Interp
14cf0 20 2a 69 6e 74 65 72 70 29 3b 0a 23 65 6e 64 69 *interp);.#endi
14d00 66 0a 23 69 66 20 64 65 66 69 6e 65 64 28 55 53 f.#if defined(US
14d10 45 5f 54 43 4c 5f 53 54 55 42 53 29 0a 23 64 65 E_TCL_STUBS).#de
14d20 66 69 6e 65 20 54 63 6c 5f 53 65 74 50 61 6e 69 fine Tcl_SetPani
14d30 63 50 72 6f 63 28 70 61 6e 69 63 50 72 6f 63 29 cProc(panicProc)
14d40 20 5c 0a 20 20 20 20 54 63 6c 49 6e 69 74 53 74 \. TclInitSt
14d50 75 62 54 61 62 6c 65 28 28 28 63 6f 6e 73 74 20 ubTable(((const
14d60 63 68 61 72 20 2a 28 2a 29 28 54 63 6c 5f 50 61 char *(*)(Tcl_Pa
14d70 6e 69 63 50 72 6f 63 20 2a 29 29 54 63 6c 53 74 nicProc *))TclSt
14d80 75 62 43 61 6c 6c 28 28 76 6f 69 64 20 2a 29 70 ubCall((void *)p
14d90 61 6e 69 63 50 72 6f 63 29 29 28 70 61 6e 69 63 anicProc))(panic
14da0 50 72 6f 63 29 29 0a 23 64 65 66 69 6e 65 20 54 Proc)).#define T
14db0 63 6c 5f 49 6e 69 74 53 75 62 73 79 73 74 65 6d cl_InitSubsystem
14dc0 73 28 29 20 5c 0a 20 20 20 20 54 63 6c 49 6e 69 s() \. TclIni
14dd0 74 53 74 75 62 54 61 62 6c 65 28 28 28 63 6f 6e tStubTable(((con
14de0 73 74 20 63 68 61 72 20 2a 28 2a 29 28 76 6f 69 st char *(*)(voi
14df0 64 29 29 54 63 6c 53 74 75 62 43 61 6c 6c 28 28 d))TclStubCall((
14e00 76 6f 69 64 20 2a 29 31 29 29 28 29 29 0a 23 64 void *)1))()).#d
14e10 65 66 69 6e 65 20 54 63 6c 5f 46 69 6e 64 45 78 efine Tcl_FindEx
14e20 65 63 75 74 61 62 6c 65 28 61 72 67 76 30 29 20 ecutable(argv0)
14e30 5c 0a 20 20 20 20 54 63 6c 49 6e 69 74 53 74 75 \. TclInitStu
14e40 62 54 61 62 6c 65 28 28 28 63 6f 6e 73 74 20 63 bTable(((const c
14e50 68 61 72 20 2a 28 2a 29 28 63 6f 6e 73 74 20 63 har *(*)(const c
14e60 68 61 72 20 2a 29 29 54 63 6c 53 74 75 62 43 61 har *))TclStubCa
14e70 6c 6c 28 28 76 6f 69 64 20 2a 29 32 29 29 28 61 ll((void *)2))(a
14e80 72 67 76 30 29 29 0a 23 64 65 66 69 6e 65 20 54 rgv0)).#define T
14e90 63 6c 5a 69 70 66 73 5f 41 70 70 48 6f 6f 6b 28 clZipfs_AppHook(
14ea0 61 72 67 63 70 2c 20 61 72 67 76 70 29 20 5c 0a argcp, argvp) \.
14eb0 09 54 63 6c 49 6e 69 74 53 74 75 62 54 61 62 6c .TclInitStubTabl
14ec0 65 28 28 28 63 6f 6e 73 74 20 63 68 61 72 20 2a e(((const char *
14ed0 28 2a 29 28 69 6e 74 20 2a 2c 20 76 6f 69 64 20 (*)(int *, void
14ee0 2a 29 29 54 63 6c 53 74 75 62 43 61 6c 6c 28 28 *))TclStubCall((
14ef0 76 6f 69 64 20 2a 29 33 29 29 28 61 72 67 63 70 void *)3))(argcp
14f00 2c 20 61 72 67 76 70 29 29 0a 23 64 65 66 69 6e , argvp)).#defin
14f10 65 20 54 63 6c 5f 4d 61 69 6e 45 78 57 28 61 72 e Tcl_MainExW(ar
14f20 67 63 2c 20 61 72 67 76 2c 20 61 70 70 49 6e 69 gc, argv, appIni
14f30 74 50 72 6f 63 2c 20 69 6e 74 65 72 70 29 20 5c tProc, interp) \
14f40 0a 09 28 76 6f 69 64 29 28 28 63 6f 6e 73 74 20 ..(void)((const
14f50 63 68 61 72 20 2a 28 2a 29 28 54 63 6c 5f 53 69 char *(*)(Tcl_Si
14f60 7a 65 2c 20 63 6f 6e 73 74 20 76 6f 69 64 20 2a ze, const void *
14f70 2c 20 54 63 6c 5f 41 70 70 49 6e 69 74 50 72 6f , Tcl_AppInitPro
14f80 63 20 2a 2c 20 54 63 6c 5f 49 6e 74 65 72 70 20 c *, Tcl_Interp
14f90 2a 29 29 20 5c 0a 09 54 63 6c 53 74 75 62 43 61 *)) \..TclStubCa
14fa0 6c 6c 28 28 76 6f 69 64 20 2a 29 34 29 29 28 61 ll((void *)4))(a
14fb0 72 67 63 2c 20 61 72 67 76 2c 20 61 70 70 49 6e rgc, argv, appIn
14fc0 69 74 50 72 6f 63 2c 20 69 6e 74 65 72 70 29 0a itProc, interp).
14fd0 23 69 66 20 21 64 65 66 69 6e 65 64 28 5f 57 49 #if !defined(_WI
14fe0 4e 33 32 29 20 7c 7c 20 21 64 65 66 69 6e 65 64 N32) || !defined
14ff0 28 55 4e 49 43 4f 44 45 29 0a 23 64 65 66 69 6e (UNICODE).#defin
15000 65 20 54 63 6c 5f 4d 61 69 6e 45 78 28 61 72 67 e Tcl_MainEx(arg
15010 63 2c 20 61 72 67 76 2c 20 61 70 70 49 6e 69 74 c, argv, appInit
15020 50 72 6f 63 2c 20 69 6e 74 65 72 70 29 20 5c 0a Proc, interp) \.
15030 09 28 76 6f 69 64 29 28 28 63 6f 6e 73 74 20 63 .(void)((const c
15040 68 61 72 20 2a 28 2a 29 28 54 63 6c 5f 53 69 7a har *(*)(Tcl_Siz
15050 65 2c 20 63 6f 6e 73 74 20 76 6f 69 64 20 2a 2c e, const void *,
15060 20 54 63 6c 5f 41 70 70 49 6e 69 74 50 72 6f 63 Tcl_AppInitProc
15070 20 2a 2c 20 54 63 6c 5f 49 6e 74 65 72 70 20 2a *, Tcl_Interp *
15080 29 29 20 5c 0a 09 54 63 6c 53 74 75 62 43 61 6c )) \..TclStubCal
15090 6c 28 28 76 6f 69 64 20 2a 29 35 29 29 28 61 72 l((void *)5))(ar
150a0 67 63 2c 20 61 72 67 76 2c 20 61 70 70 49 6e 69 gc, argv, appIni
150b0 74 50 72 6f 63 2c 20 69 6e 74 65 72 70 29 0a 23 tProc, interp).#
150c0 65 6e 64 69 66 0a 23 64 65 66 69 6e 65 20 54 63 endif.#define Tc
150d0 6c 5f 53 74 61 74 69 63 4c 69 62 72 61 72 79 28 l_StaticLibrary(
150e0 69 6e 74 65 72 70 2c 20 70 6b 67 4e 61 6d 65 2c interp, pkgName,
150f0 20 69 6e 69 74 50 72 6f 63 2c 20 73 61 66 65 49 initProc, safeI
15100 6e 69 74 50 72 6f 63 29 20 5c 0a 09 28 76 6f 69 nitProc) \..(voi
15110 64 29 28 28 63 6f 6e 73 74 20 63 68 61 72 20 2a d)((const char *
15120 28 2a 29 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a (*)(Tcl_Interp *
15130 2c 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 2c 20 , const char *,
15140 54 63 6c 5f 4c 69 62 72 61 72 79 49 6e 69 74 50 Tcl_LibraryInitP
15150 72 6f 63 20 2a 2c 20 54 63 6c 5f 4c 69 62 72 61 roc *, Tcl_Libra
15160 72 79 49 6e 69 74 50 72 6f 63 20 2a 29 29 20 5c ryInitProc *)) \
15170 0a 09 54 63 6c 53 74 75 62 43 61 6c 6c 28 28 76 ..TclStubCall((v
15180 6f 69 64 20 2a 29 36 29 29 28 69 6e 74 65 72 70 oid *)6))(interp
15190 2c 20 70 6b 67 4e 61 6d 65 2c 20 69 6e 69 74 50 , pkgName, initP
151a0 72 6f 63 2c 20 73 61 66 65 49 6e 69 74 50 72 6f roc, safeInitPro
151b0 63 29 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f 53 c).#define Tcl_S
151c0 65 74 45 78 69 74 50 72 6f 63 28 70 72 6f 63 29 etExitProc(proc)
151d0 20 5c 0a 09 28 28 54 63 6c 5f 45 78 69 74 50 72 \..((Tcl_ExitPr
151e0 6f 63 20 2a 28 2a 29 28 54 63 6c 5f 45 78 69 74 oc *(*)(Tcl_Exit
151f0 50 72 6f 63 20 2a 29 29 54 63 6c 53 74 75 62 43 Proc *))TclStubC
15200 61 6c 6c 28 28 76 6f 69 64 20 2a 29 37 29 29 28 all((void *)7))(
15210 70 72 6f 63 29 0a 23 64 65 66 69 6e 65 20 54 63 proc).#define Tc
15220 6c 5f 47 65 74 4d 65 6d 6f 72 79 49 6e 66 6f 28 l_GetMemoryInfo(
15230 64 73 50 74 72 29 20 5c 0a 09 28 76 6f 69 64 29 dsPtr) \..(void)
15240 28 28 63 6f 6e 73 74 20 63 68 61 72 20 2a 28 2a ((const char *(*
15250 29 28 54 63 6c 5f 44 53 74 72 69 6e 67 20 2a 29 )(Tcl_DString *)
15260 29 54 63 6c 53 74 75 62 43 61 6c 6c 28 28 76 6f )TclStubCall((vo
15270 69 64 20 2a 29 38 29 29 28 64 73 50 74 72 29 0a id *)8))(dsPtr).
15280 23 64 65 66 69 6e 65 20 54 63 6c 5f 53 65 74 50 #define Tcl_SetP
15290 72 65 49 6e 69 74 53 63 72 69 70 74 28 73 74 72 reInitScript(str
152a0 69 6e 67 29 20 5c 0a 09 28 28 63 6f 6e 73 74 20 ing) \..((const
152b0 63 68 61 72 20 2a 28 2a 29 28 63 6f 6e 73 74 20 char *(*)(const
152c0 63 68 61 72 20 2a 29 29 54 63 6c 53 74 75 62 43 char *))TclStubC
152d0 61 6c 6c 28 28 76 6f 69 64 20 2a 29 39 29 29 28 all((void *)9))(
152e0 73 74 72 69 6e 67 29 0a 23 65 6e 64 69 66 0a 0c string).#endif..
152f0 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ./*. *----------
15300 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
15310 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
15320 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
15330 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
15340 2d 2d 0a 20 2a 20 49 6e 63 6c 75 64 65 20 74 68 --. * Include th
15350 65 20 70 75 62 6c 69 63 20 66 75 6e 63 74 69 6f e public functio
15360 6e 20 64 65 63 6c 61 72 61 74 69 6f 6e 73 20 74 n declarations t
15370 68 61 74 20 61 72 65 20 61 63 63 65 73 73 69 62 hat are accessib
15380 6c 65 20 76 69 61 20 74 68 65 20 73 74 75 62 73 le via the stubs
15390 0a 20 2a 20 74 61 62 6c 65 2e 0a 20 2a 2f 0a 0a . * table.. */..
153a0 23 69 6e 63 6c 75 64 65 20 22 74 63 6c 44 65 63 #include "tclDec
153b0 6c 73 2e 68 22 20 20 2f 2a 20 49 57 59 55 20 70 ls.h" /* IWYU p
153c0 72 61 67 6d 61 3a 20 65 78 70 6f 72 74 20 2a 2f ragma: export */
153d0 0a 0a 2f 2a 0a 20 2a 20 49 6e 63 6c 75 64 65 20 ../*. * Include
153e0 70 6c 61 74 66 6f 72 6d 20 73 70 65 63 69 66 69 platform specifi
153f0 63 20 70 75 62 6c 69 63 20 66 75 6e 63 74 69 6f c public functio
15400 6e 20 64 65 63 6c 61 72 61 74 69 6f 6e 73 20 74 n declarations t
15410 68 61 74 20 61 72 65 20 61 63 63 65 73 73 69 62 hat are accessib
15420 6c 65 0a 20 2a 20 76 69 61 20 74 68 65 20 73 74 le. * via the st
15430 75 62 73 20 74 61 62 6c 65 2e 20 4d 61 6b 65 20 ubs table. Make
15440 61 6c 6c 20 54 63 6c 4f 4f 20 73 79 6d 62 6f 6c all TclOO symbol
15450 73 20 4d 4f 44 55 4c 45 5f 53 43 4f 50 45 20 28 s MODULE_SCOPE (
15460 77 68 69 63 68 20 6f 6e 6c 79 0a 20 2a 20 68 61 which only. * ha
15470 73 20 65 66 66 65 63 74 20 6f 6e 20 62 75 69 6c s effect on buil
15480 64 69 6e 67 20 69 74 20 61 73 20 61 20 73 68 61 ding it as a sha
15490 72 65 64 20 6c 69 62 72 61 72 79 29 2e 20 53 65 red library). Se
154a0 65 20 74 69 63 6b 65 74 20 5b 33 30 31 30 33 35 e ticket [301035
154b0 32 5d 2e 0a 20 2a 2f 0a 0a 23 69 66 20 64 65 66 2].. */..#if def
154c0 69 6e 65 64 28 42 55 49 4c 44 5f 74 63 6c 29 0a ined(BUILD_tcl).
154d0 23 20 20 20 75 6e 64 65 66 20 54 43 4c 41 50 49 # undef TCLAPI
154e0 0a 23 20 20 20 64 65 66 69 6e 65 20 54 43 4c 41 .# define TCLA
154f0 50 49 20 4d 4f 44 55 4c 45 5f 53 43 4f 50 45 0a PI MODULE_SCOPE.
15500 23 65 6e 64 69 66 0a 0a 23 69 6e 63 6c 75 64 65 #endif..#include
15510 20 22 74 63 6c 50 6c 61 74 44 65 63 6c 73 2e 68 "tclPlatDecls.h
15520 22 20 20 2f 2a 20 49 57 59 55 20 70 72 61 67 6d " /* IWYU pragm
15530 61 3a 20 65 78 70 6f 72 74 20 2a 2f 0a 0a 2f 2a a: export */../*
15540 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d . *-------------
15550 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
15560 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
15570 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
15580 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a ---------------.
15590 20 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 * The following
155a0 20 64 65 63 6c 61 72 61 74 69 6f 6e 73 20 6d 61 declarations ma
155b0 70 20 63 6b 61 6c 6c 6f 63 20 61 6e 64 20 63 6b p ckalloc and ck
155c0 66 72 65 65 20 74 6f 20 54 63 6c 5f 41 6c 6c 6f free to Tcl_Allo
155d0 63 20 61 6e 64 0a 20 2a 20 54 63 6c 5f 46 72 65 c and. * Tcl_Fre
155e0 65 20 66 6f 72 20 75 73 65 20 69 6e 20 54 63 6c e for use in Tcl
155f0 2d 38 2e 78 2d 63 6f 6d 70 61 74 69 62 6c 65 20 -8.x-compatible
15600 65 78 74 65 6e 73 69 6f 6e 73 2e 0a 20 2a 2f 0a extensions.. */.
15610 0a 23 69 66 6e 64 65 66 20 42 55 49 4c 44 5f 74 .#ifndef BUILD_t
15620 63 6c 0a 23 20 20 20 64 65 66 69 6e 65 20 63 6b cl.# define ck
15630 61 6c 6c 6f 63 20 54 63 6c 5f 41 6c 6c 6f 63 0a alloc Tcl_Alloc.
15640 23 20 20 20 64 65 66 69 6e 65 20 61 74 74 65 6d # define attem
15650 70 74 63 6b 61 6c 6c 6f 63 20 54 63 6c 5f 41 74 ptckalloc Tcl_At
15660 74 65 6d 70 74 41 6c 6c 6f 63 0a 23 20 20 20 69 temptAlloc.# i
15670 66 64 65 66 20 5f 4d 53 43 5f 56 45 52 0a 09 2f fdef _MSC_VER../
15680 2a 20 53 69 6c 65 6e 63 65 20 69 6e 76 61 6c 69 * Silence invali
15690 64 20 43 34 30 39 30 20 77 61 72 6e 69 6e 67 73 d C4090 warnings
156a0 20 2a 2f 0a 23 09 64 65 66 69 6e 65 20 63 6b 66 */.#.define ckf
156b0 72 65 65 28 61 29 20 54 63 6c 5f 46 72 65 65 28 ree(a) Tcl_Free(
156c0 28 76 6f 69 64 20 2a 29 28 61 29 29 0a 23 09 64 (void *)(a)).#.d
156d0 65 66 69 6e 65 20 63 6b 72 65 61 6c 6c 6f 63 28 efine ckrealloc(
156e0 61 2c 62 29 20 54 63 6c 5f 52 65 61 6c 6c 6f 63 a,b) Tcl_Realloc
156f0 28 28 76 6f 69 64 20 2a 29 28 61 29 2c 28 62 29 ((void *)(a),(b)
15700 29 0a 23 09 64 65 66 69 6e 65 20 61 74 74 65 6d ).#.define attem
15710 70 74 63 6b 72 65 61 6c 6c 6f 63 28 61 2c 62 29 ptckrealloc(a,b)
15720 20 54 63 6c 5f 41 74 74 65 6d 70 74 52 65 61 6c Tcl_AttemptReal
15730 6c 6f 63 28 28 76 6f 69 64 20 2a 29 28 61 29 2c loc((void *)(a),
15740 28 62 29 29 0a 23 20 20 20 65 6c 73 65 0a 23 09 (b)).# else.#.
15750 64 65 66 69 6e 65 20 63 6b 66 72 65 65 20 54 63 define ckfree Tc
15760 6c 5f 46 72 65 65 0a 23 09 64 65 66 69 6e 65 20 l_Free.#.define
15770 63 6b 72 65 61 6c 6c 6f 63 20 54 63 6c 5f 52 65 ckrealloc Tcl_Re
15780 61 6c 6c 6f 63 0a 23 09 64 65 66 69 6e 65 20 61 alloc.#.define a
15790 74 74 65 6d 70 74 63 6b 72 65 61 6c 6c 6f 63 20 ttemptckrealloc
157a0 54 63 6c 5f 41 74 74 65 6d 70 74 52 65 61 6c 6c Tcl_AttemptReall
157b0 6f 63 0a 23 20 20 20 65 6e 64 69 66 0a 23 65 6e oc.# endif.#en
157c0 64 69 66 0a 0a 23 69 66 6e 64 65 66 20 54 43 4c dif..#ifndef TCL
157d0 5f 4d 45 4d 5f 44 45 42 55 47 0a 0a 2f 2a 0a 20 _MEM_DEBUG../*.
157e0 2a 20 49 66 20 77 65 20 61 72 65 20 6e 6f 74 20 * If we are not
157f0 75 73 69 6e 67 20 74 68 65 20 64 65 62 75 67 67 using the debugg
15800 69 6e 67 20 61 6c 6c 6f 63 61 74 6f 72 2c 20 77 ing allocator, w
15810 65 20 73 68 6f 75 6c 64 20 63 61 6c 6c 20 74 68 e should call th
15820 65 20 54 63 6c 5f 41 6c 6c 6f 63 2c 0a 20 2a 20 e Tcl_Alloc,. *
15830 65 74 20 61 6c 2e 20 72 6f 75 74 69 6e 65 73 20 et al. routines
15840 69 6e 20 6f 72 64 65 72 20 74 6f 20 67 75 61 72 in order to guar
15850 61 6e 74 65 65 20 74 68 61 74 20 65 76 65 72 79 antee that every
15860 20 6d 6f 64 75 6c 65 20 69 73 20 75 73 69 6e 67 module is using
15870 20 74 68 65 20 73 61 6d 65 0a 20 2a 20 6d 65 6d the same. * mem
15880 6f 72 79 20 61 6c 6c 6f 63 61 74 6f 72 20 62 6f ory allocator bo
15890 74 68 20 69 6e 73 69 64 65 20 61 6e 64 20 6f 75 th inside and ou
158a0 74 73 69 64 65 20 6f 66 20 74 68 65 20 54 63 6c tside of the Tcl
158b0 20 6c 69 62 72 61 72 79 2e 0a 20 2a 2f 0a 0a 23 library.. */..#
158c0 20 20 20 75 6e 64 65 66 20 20 54 63 6c 5f 49 6e undef Tcl_In
158d0 69 74 4d 65 6d 6f 72 79 0a 23 20 20 20 64 65 66 itMemory.# def
158e0 69 6e 65 20 54 63 6c 5f 49 6e 69 74 4d 65 6d 6f ine Tcl_InitMemo
158f0 72 79 28 78 29 0a 23 20 20 20 75 6e 64 65 66 20 ry(x).# undef
15900 20 54 63 6c 5f 44 75 6d 70 41 63 74 69 76 65 4d Tcl_DumpActiveM
15910 65 6d 6f 72 79 0a 23 20 20 20 64 65 66 69 6e 65 emory.# define
15920 20 54 63 6c 5f 44 75 6d 70 41 63 74 69 76 65 4d Tcl_DumpActiveM
15930 65 6d 6f 72 79 28 78 29 0a 23 20 20 20 75 6e 64 emory(x).# und
15940 65 66 20 20 54 63 6c 5f 56 61 6c 69 64 61 74 65 ef Tcl_Validate
15950 41 6c 6c 4d 65 6d 6f 72 79 0a 23 20 20 20 64 65 AllMemory.# de
15960 66 69 6e 65 20 54 63 6c 5f 56 61 6c 69 64 61 74 fine Tcl_Validat
15970 65 41 6c 6c 4d 65 6d 6f 72 79 28 78 2c 79 29 0a eAllMemory(x,y).
15980 0a 23 65 6e 64 69 66 20 2f 2a 20 21 54 43 4c 5f .#endif /* !TCL_
15990 4d 45 4d 5f 44 45 42 55 47 20 2a 2f 0a 0a 23 69 MEM_DEBUG */..#i
159a0 66 64 65 66 20 54 43 4c 5f 4d 45 4d 5f 44 45 42 fdef TCL_MEM_DEB
159b0 55 47 0a 23 20 20 20 75 6e 64 65 66 20 54 63 6c UG.# undef Tcl
159c0 5f 49 6e 63 72 52 65 66 43 6f 75 6e 74 0a 23 20 _IncrRefCount.#
159d0 20 20 64 65 66 69 6e 65 20 54 63 6c 5f 49 6e 63 define Tcl_Inc
159e0 72 52 65 66 43 6f 75 6e 74 28 6f 62 6a 50 74 72 rRefCount(objPtr
159f0 29 20 5c 0a 09 54 63 6c 5f 44 62 49 6e 63 72 52 ) \..Tcl_DbIncrR
15a00 65 66 43 6f 75 6e 74 28 6f 62 6a 50 74 72 2c 20 efCount(objPtr,
15a10 5f 5f 46 49 4c 45 5f 5f 2c 20 5f 5f 4c 49 4e 45 __FILE__, __LINE
15a20 5f 5f 29 0a 23 20 20 20 75 6e 64 65 66 20 54 63 __).# undef Tc
15a30 6c 5f 44 65 63 72 52 65 66 43 6f 75 6e 74 0a 23 l_DecrRefCount.#
15a40 20 20 20 64 65 66 69 6e 65 20 54 63 6c 5f 44 65 define Tcl_De
15a50 63 72 52 65 66 43 6f 75 6e 74 28 6f 62 6a 50 74 crRefCount(objPt
15a60 72 29 20 5c 0a 09 54 63 6c 5f 44 62 44 65 63 72 r) \..Tcl_DbDecr
15a70 52 65 66 43 6f 75 6e 74 28 6f 62 6a 50 74 72 2c RefCount(objPtr,
15a80 20 5f 5f 46 49 4c 45 5f 5f 2c 20 5f 5f 4c 49 4e __FILE__, __LIN
15a90 45 5f 5f 29 0a 23 20 20 20 75 6e 64 65 66 20 54 E__).# undef T
15aa0 63 6c 5f 49 73 53 68 61 72 65 64 0a 23 20 20 20 cl_IsShared.#
15ab0 64 65 66 69 6e 65 20 54 63 6c 5f 49 73 53 68 61 define Tcl_IsSha
15ac0 72 65 64 28 6f 62 6a 50 74 72 29 20 5c 0a 09 54 red(objPtr) \..T
15ad0 63 6c 5f 44 62 49 73 53 68 61 72 65 64 28 6f 62 cl_DbIsShared(ob
15ae0 6a 50 74 72 2c 20 5f 5f 46 49 4c 45 5f 5f 2c 20 jPtr, __FILE__,
15af0 5f 5f 4c 49 4e 45 5f 5f 29 0a 2f 2a 0a 20 2a 20 __LINE__)./*. *
15b00 46 72 65 65 20 74 68 65 20 4f 62 6a 20 62 79 20 Free the Obj by
15b10 65 66 66 65 63 74 69 76 65 6c 79 20 64 6f 69 6e effectively doin
15b20 67 3a 0a 20 2a 0a 20 2a 20 20 20 54 63 6c 5f 49 g:. *. * Tcl_I
15b30 6e 63 72 52 65 66 43 6f 75 6e 74 28 6f 62 6a 50 ncrRefCount(objP
15b40 74 72 29 3b 0a 20 2a 20 20 20 54 63 6c 5f 44 65 tr);. * Tcl_De
15b50 63 72 52 65 66 43 6f 75 6e 74 28 6f 62 6a 50 74 crRefCount(objPt
15b60 72 29 3b 0a 20 2a 0a 20 2a 20 54 68 69 73 20 77 r);. *. * This w
15b70 69 6c 6c 20 66 72 65 65 20 74 68 65 20 6f 62 6a ill free the obj
15b80 20 69 66 20 74 68 65 72 65 20 61 72 65 20 6e 6f if there are no
15b90 20 72 65 66 65 72 65 6e 63 65 73 20 74 6f 20 74 references to t
15ba0 68 65 20 6f 62 6a 2e 0a 20 2a 2f 0a 23 20 20 20 he obj.. */.#
15bb0 64 65 66 69 6e 65 20 54 63 6c 5f 42 6f 75 6e 63 define Tcl_Bounc
15bc0 65 52 65 66 43 6f 75 6e 74 28 6f 62 6a 50 74 72 eRefCount(objPtr
15bd0 29 20 5c 0a 20 20 20 20 54 63 6c 42 6f 75 6e 63 ) \. TclBounc
15be0 65 52 65 66 43 6f 75 6e 74 28 6f 62 6a 50 74 72 eRefCount(objPtr
15bf0 2c 20 5f 5f 46 49 4c 45 5f 5f 2c 20 5f 5f 4c 49 , __FILE__, __LI
15c00 4e 45 5f 5f 29 0a 0a 73 74 61 74 69 63 20 69 6e NE__)..static in
15c10 6c 69 6e 65 20 76 6f 69 64 0a 54 63 6c 42 6f 75 line void.TclBou
15c20 6e 63 65 52 65 66 43 6f 75 6e 74 28 0a 20 20 20 nceRefCount(.
15c30 20 54 63 6c 5f 4f 62 6a 20 2a 6f 62 6a 50 74 72 Tcl_Obj *objPtr
15c40 2c 0a 20 20 20 20 63 6f 6e 73 74 20 63 68 61 72 ,. const char
15c50 20 2a 66 69 6c 65 2c 0a 20 20 20 20 69 6e 74 20 *file,. int
15c60 6c 69 6e 65 29 0a 7b 0a 20 20 20 20 69 66 20 28 line).{. if (
15c70 6f 62 6a 50 74 72 29 20 7b 0a 09 69 66 20 28 28 objPtr) {..if ((
15c80 6f 62 6a 50 74 72 29 2d 3e 72 65 66 43 6f 75 6e objPtr)->refCoun
15c90 74 20 3d 3d 20 30 29 20 7b 0a 09 20 20 20 20 54 t == 0) {.. T
15ca0 63 6c 5f 44 62 44 65 63 72 52 65 66 43 6f 75 6e cl_DbDecrRefCoun
15cb0 74 28 6f 62 6a 50 74 72 2c 20 66 69 6c 65 2c 20 t(objPtr, file,
15cc0 6c 69 6e 65 29 3b 0a 09 7d 0a 20 20 20 20 7d 0a line);..}. }.
15cd0 7d 0a 23 65 6c 73 65 0a 23 20 20 20 75 6e 64 65 }.#else.# unde
15ce0 66 20 54 63 6c 5f 49 6e 63 72 52 65 66 43 6f 75 f Tcl_IncrRefCou
15cf0 6e 74 0a 23 20 20 20 64 65 66 69 6e 65 20 54 63 nt.# define Tc
15d00 6c 5f 49 6e 63 72 52 65 66 43 6f 75 6e 74 28 6f l_IncrRefCount(o
15d10 62 6a 50 74 72 29 20 5c 0a 09 28 28 76 6f 69 64 bjPtr) \..((void
15d20 29 2b 2b 28 6f 62 6a 50 74 72 29 2d 3e 72 65 66 )++(objPtr)->ref
15d30 43 6f 75 6e 74 29 0a 20 20 20 20 2f 2a 0a 20 20 Count). /*.
15d40 20 20 20 2a 20 55 73 65 20 64 6f 2f 77 68 69 6c * Use do/whil
15d50 65 30 20 69 64 69 6f 6d 20 66 6f 72 20 6f 70 74 e0 idiom for opt
15d60 69 6d 75 6d 20 63 6f 72 72 65 63 74 6e 65 73 73 imum correctness
15d70 20 77 69 74 68 6f 75 74 20 63 6f 6d 70 69 6c 65 without compile
15d80 72 20 77 61 72 6e 69 6e 67 73 2e 0a 20 20 20 20 r warnings..
15d90 20 2a 20 68 74 74 70 73 3a 2f 2f 77 69 6b 69 2e * https://wiki.
15da0 63 32 2e 63 6f 6d 2f 3f 54 72 69 76 69 61 6c 44 c2.com/?TrivialD
15db0 6f 57 68 69 6c 65 4c 6f 6f 70 0a 20 20 20 20 20 oWhileLoop.
15dc0 2a 2f 0a 23 20 20 20 75 6e 64 65 66 20 54 63 6c */.# undef Tcl
15dd0 5f 44 65 63 72 52 65 66 43 6f 75 6e 74 0a 23 20 _DecrRefCount.#
15de0 20 20 64 65 66 69 6e 65 20 54 63 6c 5f 44 65 63 define Tcl_Dec
15df0 72 52 65 66 43 6f 75 6e 74 28 6f 62 6a 50 74 72 rRefCount(objPtr
15e00 29 20 5c 0a 09 64 6f 20 7b 09 09 09 09 09 09 09 ) \..do {.......
15e10 09 5c 0a 09 20 20 20 20 54 63 6c 5f 4f 62 6a 20 .\.. Tcl_Obj
15e20 2a 5f 6f 62 6a 50 74 72 20 3d 20 28 6f 62 6a 50 *_objPtr = (objP
15e30 74 72 29 3b 09 09 09 09 5c 0a 09 20 20 20 20 69 tr);....\.. i
15e40 66 20 28 5f 6f 62 6a 50 74 72 2d 3e 72 65 66 43 f (_objPtr->refC
15e50 6f 75 6e 74 2d 2d 20 3c 3d 20 31 29 20 7b 09 09 ount-- <= 1) {..
15e60 09 09 5c 0a 09 09 54 63 6c 46 72 65 65 4f 62 6a ..\...TclFreeObj
15e70 28 5f 6f 62 6a 50 74 72 29 3b 09 09 09 09 09 5c (_objPtr);.....\
15e80 0a 09 20 20 20 20 7d 09 09 09 09 09 09 09 09 5c .. }........\
15e90 0a 09 7d 20 77 68 69 6c 65 28 30 29 0a 23 20 20 ..} while(0).#
15ea0 20 75 6e 64 65 66 20 54 63 6c 5f 49 73 53 68 61 undef Tcl_IsSha
15eb0 72 65 64 0a 23 20 20 20 64 65 66 69 6e 65 20 54 red.# define T
15ec0 63 6c 5f 49 73 53 68 61 72 65 64 28 6f 62 6a 50 cl_IsShared(objP
15ed0 74 72 29 20 5c 0a 09 28 28 6f 62 6a 50 74 72 29 tr) \..((objPtr)
15ee0 2d 3e 72 65 66 43 6f 75 6e 74 20 3e 20 31 29 0a ->refCount > 1).
15ef0 0a 2f 2a 0a 20 2a 20 44 65 63 6c 61 72 65 20 74 ./*. * Declare t
15f00 68 61 74 20 6f 62 6a 20 77 69 6c 6c 20 6e 6f 20 hat obj will no
15f10 6c 6f 6e 67 65 72 20 62 65 20 75 73 65 64 20 6f longer be used o
15f20 72 20 72 65 66 65 72 65 6e 63 65 64 2e 0a 20 2a r referenced.. *
15f30 20 54 68 69 73 20 77 69 6c 6c 20 66 72 65 65 20 This will free
15f40 74 68 65 20 6f 62 6a 20 69 66 20 74 68 65 72 65 the obj if there
15f50 20 61 72 65 20 6e 6f 20 72 65 66 65 72 65 6e 63 are no referenc
15f60 65 73 20 74 6f 20 74 68 65 20 6f 62 6a 2e 0a 20 es to the obj..
15f70 2a 2f 0a 23 20 20 20 64 65 66 69 6e 65 20 54 63 */.# define Tc
15f80 6c 5f 42 6f 75 6e 63 65 52 65 66 43 6f 75 6e 74 l_BounceRefCount
15f90 28 6f 62 6a 50 74 72 29 20 5c 0a 20 20 20 20 54 (objPtr) \. T
15fa0 63 6c 42 6f 75 6e 63 65 52 65 66 43 6f 75 6e 74 clBounceRefCount
15fb0 28 6f 62 6a 50 74 72 29 3b 0a 0a 73 74 61 74 69 (objPtr);..stati
15fc0 63 20 69 6e 6c 69 6e 65 20 76 6f 69 64 0a 54 63 c inline void.Tc
15fd0 6c 42 6f 75 6e 63 65 52 65 66 43 6f 75 6e 74 28 lBounceRefCount(
15fe0 0a 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 6f 62 . Tcl_Obj *ob
15ff0 6a 50 74 72 29 0a 7b 0a 20 20 20 20 69 66 20 28 jPtr).{. if (
16000 6f 62 6a 50 74 72 29 20 7b 0a 09 69 66 20 28 28 objPtr) {..if ((
16010 6f 62 6a 50 74 72 29 2d 3e 72 65 66 43 6f 75 6e objPtr)->refCoun
16020 74 20 3d 3d 20 30 29 20 7b 0a 09 20 20 20 20 54 t == 0) {.. T
16030 63 6c 5f 44 65 63 72 52 65 66 43 6f 75 6e 74 28 cl_DecrRefCount(
16040 6f 62 6a 50 74 72 29 3b 0a 09 7d 0a 20 20 20 20 objPtr);..}.
16050 7d 0a 7d 0a 0a 23 65 6e 64 69 66 0a 0a 2f 2a 0a }.}..#endif../*.
16060 20 2a 20 4d 61 63 72 6f 73 20 61 6e 64 20 64 65 * Macros and de
16070 66 69 6e 69 74 69 6f 6e 73 20 74 68 61 74 20 68 finitions that h
16080 65 6c 70 20 74 6f 20 64 65 62 75 67 20 74 68 65 elp to debug the
16090 20 75 73 65 20 6f 66 20 54 63 6c 20 6f 62 6a 65 use of Tcl obje
160a0 63 74 73 2e 20 57 68 65 6e 0a 20 2a 20 54 43 4c cts. When. * TCL
160b0 5f 4d 45 4d 5f 44 45 42 55 47 20 69 73 20 64 65 _MEM_DEBUG is de
160c0 66 69 6e 65 64 2c 20 74 68 65 20 54 63 6c 5f 4e fined, the Tcl_N
160d0 65 77 20 64 65 63 6c 61 72 61 74 69 6f 6e 73 20 ew declarations
160e0 61 72 65 20 6f 76 65 72 72 69 64 64 65 6e 20 74 are overridden t
160f0 6f 20 63 61 6c 6c 0a 20 2a 20 64 65 62 75 67 67 o call. * debugg
16100 69 6e 67 20 76 65 72 73 69 6f 6e 73 20 6f 66 20 ing versions of
16110 74 68 65 20 6f 62 6a 65 63 74 20 63 72 65 61 74 the object creat
16120 69 6f 6e 20 66 75 6e 63 74 69 6f 6e 73 2e 0a 20 ion functions..
16130 2a 2f 0a 0a 23 69 66 64 65 66 20 54 43 4c 5f 4d */..#ifdef TCL_M
16140 45 4d 5f 44 45 42 55 47 0a 23 20 20 75 6e 64 65 EM_DEBUG.# unde
16150 66 20 20 54 63 6c 5f 4e 65 77 42 69 67 6e 75 6d f Tcl_NewBignum
16160 4f 62 6a 0a 23 20 20 64 65 66 69 6e 65 20 54 63 Obj.# define Tc
16170 6c 5f 4e 65 77 42 69 67 6e 75 6d 4f 62 6a 28 76 l_NewBignumObj(v
16180 61 6c 29 20 5c 0a 20 20 20 20 20 54 63 6c 5f 44 al) \. Tcl_D
16190 62 4e 65 77 42 69 67 6e 75 6d 4f 62 6a 28 76 61 bNewBignumObj(va
161a0 6c 2c 20 5f 5f 46 49 4c 45 5f 5f 2c 20 5f 5f 4c l, __FILE__, __L
161b0 49 4e 45 5f 5f 29 0a 23 20 20 75 6e 64 65 66 20 INE__).# undef
161c0 20 54 63 6c 5f 4e 65 77 42 6f 6f 6c 65 61 6e 4f Tcl_NewBooleanO
161d0 62 6a 0a 23 20 20 64 65 66 69 6e 65 20 54 63 6c bj.# define Tcl
161e0 5f 4e 65 77 42 6f 6f 6c 65 61 6e 4f 62 6a 28 76 _NewBooleanObj(v
161f0 61 6c 29 20 5c 0a 20 20 20 20 20 54 63 6c 5f 44 al) \. Tcl_D
16200 62 4e 65 77 57 69 64 65 49 6e 74 4f 62 6a 28 28 bNewWideIntObj((
16210 76 61 6c 29 21 3d 30 2c 20 5f 5f 46 49 4c 45 5f val)!=0, __FILE_
16220 5f 2c 20 5f 5f 4c 49 4e 45 5f 5f 29 0a 23 20 20 _, __LINE__).#
16230 75 6e 64 65 66 20 20 54 63 6c 5f 4e 65 77 42 79 undef Tcl_NewBy
16240 74 65 41 72 72 61 79 4f 62 6a 0a 23 20 20 64 65 teArrayObj.# de
16250 66 69 6e 65 20 54 63 6c 5f 4e 65 77 42 79 74 65 fine Tcl_NewByte
16260 41 72 72 61 79 4f 62 6a 28 62 79 74 65 73 2c 20 ArrayObj(bytes,
16270 6c 65 6e 29 20 5c 0a 20 20 20 20 20 54 63 6c 5f len) \. Tcl_
16280 44 62 4e 65 77 42 79 74 65 41 72 72 61 79 4f 62 DbNewByteArrayOb
16290 6a 28 62 79 74 65 73 2c 20 6c 65 6e 2c 20 5f 5f j(bytes, len, __
162a0 46 49 4c 45 5f 5f 2c 20 5f 5f 4c 49 4e 45 5f 5f FILE__, __LINE__
162b0 29 0a 23 20 20 75 6e 64 65 66 20 20 54 63 6c 5f ).# undef Tcl_
162c0 4e 65 77 44 6f 75 62 6c 65 4f 62 6a 0a 23 20 20 NewDoubleObj.#
162d0 64 65 66 69 6e 65 20 54 63 6c 5f 4e 65 77 44 6f define Tcl_NewDo
162e0 75 62 6c 65 4f 62 6a 28 76 61 6c 29 20 5c 0a 20 ubleObj(val) \.
162f0 20 20 20 20 54 63 6c 5f 44 62 4e 65 77 44 6f 75 Tcl_DbNewDou
16300 62 6c 65 4f 62 6a 28 76 61 6c 2c 20 5f 5f 46 49 bleObj(val, __FI
16310 4c 45 5f 5f 2c 20 5f 5f 4c 49 4e 45 5f 5f 29 0a LE__, __LINE__).
16320 23 20 20 75 6e 64 65 66 20 20 54 63 6c 5f 4e 65 # undef Tcl_Ne
16330 77 4c 69 73 74 4f 62 6a 0a 23 20 20 64 65 66 69 wListObj.# defi
16340 6e 65 20 54 63 6c 5f 4e 65 77 4c 69 73 74 4f 62 ne Tcl_NewListOb
16350 6a 28 6f 62 6a 63 2c 20 6f 62 6a 76 29 20 5c 0a j(objc, objv) \.
16360 20 20 20 20 20 54 63 6c 5f 44 62 4e 65 77 4c 69 Tcl_DbNewLi
16370 73 74 4f 62 6a 28 6f 62 6a 63 2c 20 6f 62 6a 76 stObj(objc, objv
16380 2c 20 5f 5f 46 49 4c 45 5f 5f 2c 20 5f 5f 4c 49 , __FILE__, __LI
16390 4e 45 5f 5f 29 0a 23 20 20 75 6e 64 65 66 20 20 NE__).# undef
163a0 54 63 6c 5f 4e 65 77 4f 62 6a 0a 23 20 20 64 65 Tcl_NewObj.# de
163b0 66 69 6e 65 20 54 63 6c 5f 4e 65 77 4f 62 6a 28 fine Tcl_NewObj(
163c0 29 20 5c 0a 20 20 20 20 20 54 63 6c 5f 44 62 4e ) \. Tcl_DbN
163d0 65 77 4f 62 6a 28 5f 5f 46 49 4c 45 5f 5f 2c 20 ewObj(__FILE__,
163e0 5f 5f 4c 49 4e 45 5f 5f 29 0a 23 20 20 75 6e 64 __LINE__).# und
163f0 65 66 20 20 54 63 6c 5f 4e 65 77 53 74 72 69 6e ef Tcl_NewStrin
16400 67 4f 62 6a 0a 23 20 20 64 65 66 69 6e 65 20 54 gObj.# define T
16410 63 6c 5f 4e 65 77 53 74 72 69 6e 67 4f 62 6a 28 cl_NewStringObj(
16420 62 79 74 65 73 2c 20 6c 65 6e 29 20 5c 0a 20 20 bytes, len) \.
16430 20 20 20 54 63 6c 5f 44 62 4e 65 77 53 74 72 69 Tcl_DbNewStri
16440 6e 67 4f 62 6a 28 62 79 74 65 73 2c 20 6c 65 6e ngObj(bytes, len
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 57 69 64 65 49 6e 74 4f 62 Tcl_NewWideIntOb
16480 6a 0a 23 20 20 64 65 66 69 6e 65 20 54 63 6c 5f j.# define Tcl_
16490 4e 65 77 57 69 64 65 49 6e 74 4f 62 6a 28 76 61 NewWideIntObj(va
164a0 6c 29 20 5c 0a 20 20 20 20 20 54 63 6c 5f 44 62 l) \. Tcl_Db
164b0 4e 65 77 57 69 64 65 49 6e 74 4f 62 6a 28 76 61 NewWideIntObj(va
164c0 6c 2c 20 5f 5f 46 49 4c 45 5f 5f 2c 20 5f 5f 4c l, __FILE__, __L
164d0 49 4e 45 5f 5f 29 0a 23 65 6e 64 69 66 20 2f 2a INE__).#endif /*
164e0 20 54 43 4c 5f 4d 45 4d 5f 44 45 42 55 47 20 2a TCL_MEM_DEBUG *
164f0 2f 0a 0a 2f 2a 0a 20 2a 2d 2d 2d 2d 2d 2d 2d 2d /../*. *--------
16500 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
16510 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
16520 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
16530 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
16540 2d 2d 2d 2d 0a 20 2a 20 4d 61 63 72 6f 73 20 66 ----. * Macros f
16550 6f 72 20 63 6c 69 65 6e 74 73 20 74 6f 20 75 73 or clients to us
16560 65 20 74 6f 20 61 63 63 65 73 73 20 66 69 65 6c e to access fiel
16570 64 73 20 6f 66 20 68 61 73 68 20 65 6e 74 72 69 ds of hash entri
16580 65 73 3a 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 es:. */..#define
16590 20 54 63 6c 5f 47 65 74 48 61 73 68 56 61 6c 75 Tcl_GetHashValu
165a0 65 28 68 29 20 28 28 68 29 2d 3e 63 6c 69 65 6e e(h) ((h)->clien
165b0 74 44 61 74 61 29 0a 23 64 65 66 69 6e 65 20 54 tData).#define T
165c0 63 6c 5f 53 65 74 48 61 73 68 56 61 6c 75 65 28 cl_SetHashValue(
165d0 68 2c 20 76 61 6c 75 65 29 20 28 28 68 29 2d 3e h, value) ((h)->
165e0 63 6c 69 65 6e 74 44 61 74 61 20 3d 20 28 76 6f clientData = (vo
165f0 69 64 20 2a 29 28 76 61 6c 75 65 29 29 0a 23 64 id *)(value)).#d
16600 65 66 69 6e 65 20 54 63 6c 5f 47 65 74 48 61 73 efine Tcl_GetHas
16610 68 4b 65 79 28 74 61 62 6c 65 50 74 72 2c 20 68 hKey(tablePtr, h
16620 29 20 5c 0a 09 28 28 76 6f 69 64 20 2a 29 20 28 ) \..((void *) (
16630 28 28 74 61 62 6c 65 50 74 72 29 2d 3e 6b 65 79 ((tablePtr)->key
16640 54 79 70 65 20 3d 3d 20 54 43 4c 5f 4f 4e 45 5f Type == TCL_ONE_
16650 57 4f 52 44 5f 4b 45 59 53 20 7c 7c 09 09 5c 0a WORD_KEYS ||..\.
16660 09 09 20 20 20 20 28 74 61 62 6c 65 50 74 72 29 .. (tablePtr)
16670 2d 3e 6b 65 79 54 79 70 65 20 3d 3d 20 54 43 4c ->keyType == TCL
16680 5f 43 55 53 54 4f 4d 5f 50 54 52 5f 4b 45 59 53 _CUSTOM_PTR_KEYS
16690 29 09 09 5c 0a 09 09 3f 20 28 68 29 2d 3e 6b 65 )..\...? (h)->ke
166a0 79 2e 6f 6e 65 57 6f 72 64 56 61 6c 75 65 09 09 y.oneWordValue..
166b0 09 09 09 5c 0a 09 09 3a 20 28 68 29 2d 3e 6b 65 ...\...: (h)->ke
166c0 79 2e 73 74 72 69 6e 67 29 29 0a 0a 2f 2a 0a 20 y.string))../*.
166d0 2a 20 4d 61 63 72 6f 73 20 74 6f 20 75 73 65 20 * Macros to use
166e0 66 6f 72 20 63 6c 69 65 6e 74 73 20 74 6f 20 75 for clients to u
166f0 73 65 20 74 6f 20 69 6e 76 6f 6b 65 20 66 69 6e se to invoke fin
16700 64 20 61 6e 64 20 63 72 65 61 74 65 20 66 75 6e d and create fun
16710 63 74 69 6f 6e 73 20 66 6f 72 0a 20 2a 20 68 61 ctions for. * ha
16720 73 68 20 74 61 62 6c 65 73 3a 0a 20 2a 2f 0a 0a sh tables:. */..
16730 23 64 65 66 69 6e 65 20 54 63 6c 5f 46 69 6e 64 #define Tcl_Find
16740 48 61 73 68 45 6e 74 72 79 28 74 61 62 6c 65 50 HashEntry(tableP
16750 74 72 2c 20 6b 65 79 29 20 5c 0a 09 28 2a 28 28 tr, key) \..(*((
16760 74 61 62 6c 65 50 74 72 29 2d 3e 63 72 65 61 74 tablePtr)->creat
16770 65 50 72 6f 63 29 29 28 74 61 62 6c 65 50 74 72 eProc))(tablePtr
16780 2c 20 28 63 6f 6e 73 74 20 63 68 61 72 20 2a 29 , (const char *)
16790 28 6b 65 79 29 2c 20 28 69 6e 74 20 2a 29 2d 31 (key), (int *)-1
167a0 29 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f 41 74 ).#define Tcl_At
167b0 74 65 6d 70 74 43 72 65 61 74 65 48 61 73 68 45 temptCreateHashE
167c0 6e 74 72 79 28 74 61 62 6c 65 50 74 72 2c 20 6b ntry(tablePtr, k
167d0 65 79 2c 20 6e 65 77 50 74 72 29 20 5c 0a 09 28 ey, newPtr) \..(
167e0 2a 28 28 74 61 62 6c 65 50 74 72 29 2d 3e 63 72 *((tablePtr)->cr
167f0 65 61 74 65 50 72 6f 63 29 29 28 74 61 62 6c 65 eateProc))(table
16800 50 74 72 2c 20 28 63 6f 6e 73 74 20 63 68 61 72 Ptr, (const char
16810 20 2a 29 28 6b 65 79 29 2c 20 6e 65 77 50 74 72 *)(key), newPtr
16820 29 0a 23 69 66 64 65 66 20 54 43 4c 5f 4d 45 4d ).#ifdef TCL_MEM
16830 5f 44 45 42 55 47 0a 23 75 6e 64 65 66 20 54 63 _DEBUG.#undef Tc
16840 6c 5f 43 72 65 61 74 65 48 61 73 68 45 6e 74 72 l_CreateHashEntr
16850 79 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f 43 72 y.#define Tcl_Cr
16860 65 61 74 65 48 61 73 68 45 6e 74 72 79 28 74 61 eateHashEntry(ta
16870 62 6c 65 50 74 72 2c 20 6b 65 79 2c 20 6e 65 77 blePtr, key, new
16880 50 74 72 29 20 5c 0a 09 09 54 63 6c 5f 44 62 43 Ptr) \...Tcl_DbC
16890 72 65 61 74 65 48 61 73 68 45 6e 74 72 79 28 74 reateHashEntry(t
168a0 61 62 6c 65 50 74 72 2c 20 6b 65 79 2c 20 6e 65 ablePtr, key, ne
168b0 77 50 74 72 2c 20 5f 5f 46 49 4c 45 5f 5f 2c 20 wPtr, __FILE__,
168c0 5f 5f 4c 49 4e 45 5f 5f 29 0a 23 65 6e 64 69 66 __LINE__).#endif
168d0 0a 0a 23 65 6e 64 69 66 20 2f 2a 20 52 43 5f 49 ..#endif /* RC_I
168e0 4e 56 4f 4b 45 44 20 2a 2f 0a 0a 2f 2a 0a 20 2a NVOKED */../*. *
168f0 20 65 6e 64 20 62 6c 6f 63 6b 20 66 6f 72 20 43 end block for C
16900 2b 2b 0a 20 2a 2f 0a 0a 23 69 66 64 65 66 20 5f ++. */..#ifdef _
16910 5f 63 70 6c 75 73 70 6c 75 73 0a 7d 0a 23 65 6e _cplusplus.}.#en
16920 64 69 66 0a 0a 23 65 6e 64 69 66 20 2f 2a 20 5f dif..#endif /* _
16930 54 43 4c 20 2a 2f 0a 0c 0a 2f 2a 0a 20 2a 20 4c TCL */.../*. * L
16940 6f 63 61 6c 20 56 61 72 69 61 62 6c 65 73 3a 0a ocal Variables:.
16950 20 2a 20 6d 6f 64 65 3a 20 63 0a 20 2a 20 63 2d * mode: c. * c-
16960 62 61 73 69 63 2d 6f 66 66 73 65 74 3a 20 34 0a basic-offset: 4.
16970 20 2a 20 66 69 6c 6c 2d 63 6f 6c 75 6d 6e 3a 20 * fill-column:
16980 37 38 0a 20 2a 20 45 6e 64 3a 0a 20 2a 2f 0a 78. * End:. */.