Attachment "tcl.h" to
ticket [633990ffff]
added by
edwardross
2002-11-06 02:27:38.
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 0a 20 2a 09 6f 66 20 74 68 65 20 54 63 6c 20 s. *.of the Tcl
0060: 69 6e 74 65 72 70 72 65 74 65 72 2e 0a 20 2a 0a interpreter.. *.
0070: 20 2a 20 43 6f 70 79 72 69 67 68 74 20 28 63 29 * Copyright (c)
0080: 20 31 39 38 37 2d 31 39 39 34 20 54 68 65 20 52 1987-1994 The R
0090: 65 67 65 6e 74 73 20 6f 66 20 74 68 65 20 55 6e egents of the Un
00a0: 69 76 65 72 73 69 74 79 20 6f 66 20 43 61 6c 69 iversity of Cali
00b0: 66 6f 72 6e 69 61 2e 0a 20 2a 20 43 6f 70 79 72 fornia.. * Copyr
00c0: 69 67 68 74 20 28 63 29 20 31 39 39 33 2d 31 39 ight (c) 1993-19
00d0: 39 36 20 4c 75 63 65 6e 74 20 54 65 63 68 6e 6f 96 Lucent Techno
00e0: 6c 6f 67 69 65 73 2e 0a 20 2a 20 43 6f 70 79 72 logies.. * Copyr
00f0: 69 67 68 74 20 28 63 29 20 31 39 39 34 2d 31 39 ight (c) 1994-19
0100: 39 38 20 53 75 6e 20 4d 69 63 72 6f 73 79 73 74 98 Sun Microsyst
0110: 65 6d 73 2c 20 49 6e 63 2e 0a 20 2a 20 43 6f 70 ems, Inc.. * Cop
0120: 79 72 69 67 68 74 20 28 63 29 20 31 39 39 38 2d yright (c) 1998-
0130: 32 30 30 30 20 62 79 20 53 63 72 69 70 74 69 63 2000 by Scriptic
0140: 73 20 43 6f 72 70 6f 72 61 74 69 6f 6e 2e 0a 20 s Corporation..
0150: 2a 0a 20 2a 20 53 65 65 20 74 68 65 20 66 69 6c *. * See the fil
0160: 65 20 22 6c 69 63 65 6e 73 65 2e 74 65 72 6d 73 e "license.terms
0170: 22 20 66 6f 72 20 69 6e 66 6f 72 6d 61 74 69 6f " for informatio
0180: 6e 20 6f 6e 20 75 73 61 67 65 20 61 6e 64 20 72 n on usage and r
0190: 65 64 69 73 74 72 69 62 75 74 69 6f 6e 0a 20 2a edistribution. *
01a0: 20 6f 66 20 74 68 69 73 20 66 69 6c 65 2c 20 61 of this file, a
01b0: 6e 64 20 66 6f 72 20 61 20 44 49 53 43 4c 41 49 nd for a DISCLAI
01c0: 4d 45 52 20 4f 46 20 41 4c 4c 20 57 41 52 52 41 MER OF ALL WARRA
01d0: 4e 54 49 45 53 2e 0a 20 2a 0a 20 2a 20 52 43 53 NTIES.. *. * RCS
01e0: 3a 20 40 28 23 29 20 24 49 64 3a 20 74 63 6c 2e : @(#) $Id: tcl.
01f0: 68 2c 76 20 31 2e 37 30 2e 32 2e 39 20 32 30 30 h,v 1.70.2.9 200
0200: 31 2f 31 30 2f 31 37 20 31 39 3a 32 39 3a 32 34 1/10/17 19:29:24
0210: 20 64 61 73 20 45 78 70 20 24 0a 20 2a 2f 0a 0a das Exp $. */..
0220: 23 69 66 6e 64 65 66 20 5f 54 43 4c 0a 23 64 65 #ifndef _TCL.#de
0230: 66 69 6e 65 20 5f 54 43 4c 0a 0a 2f 2a 0a 20 2a fine _TCL../*. *
0240: 20 46 6f 72 20 43 2b 2b 20 63 6f 6d 70 69 6c 65 For C++ compile
0250: 72 73 2c 20 75 73 65 20 65 78 74 65 72 6e 20 22 rs, use extern "
0260: 43 22 0a 20 2a 2f 0a 0a 23 69 66 64 65 66 20 5f C". */..#ifdef _
0270: 5f 63 70 6c 75 73 70 6c 75 73 0a 65 78 74 65 72 _cplusplus.exter
0280: 6e 20 22 43 22 20 7b 0a 23 65 6e 64 69 66 0a 20 n "C" {.#endif.
0290: 20 20 20 0a 2f 2a 0a 20 2a 20 54 68 65 20 66 6f ./*. * The fo
02a0: 6c 6c 6f 77 69 6e 67 20 64 65 66 69 6e 65 73 20 llowing defines
02b0: 61 72 65 20 75 73 65 64 20 74 6f 20 69 6e 64 69 are used to indi
02c0: 63 61 74 65 20 74 68 65 20 76 61 72 69 6f 75 73 cate the various
02d0: 20 72 65 6c 65 61 73 65 20 6c 65 76 65 6c 73 2e release levels.
02e0: 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 . */..#define TC
02f0: 4c 5f 41 4c 50 48 41 5f 52 45 4c 45 41 53 45 09 L_ALPHA_RELEASE.
0300: 30 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 42 45 0.#define TCL_BE
0310: 54 41 5f 52 45 4c 45 41 53 45 09 31 0a 23 64 65 TA_RELEASE.1.#de
0320: 66 69 6e 65 20 54 43 4c 5f 46 49 4e 41 4c 5f 52 fine TCL_FINAL_R
0330: 45 4c 45 41 53 45 09 32 0a 0a 2f 2a 0a 20 2a 20 ELEASE.2../*. *
0340: 57 68 65 6e 20 76 65 72 73 69 6f 6e 20 6e 75 6d When version num
0350: 62 65 72 73 20 63 68 61 6e 67 65 20 68 65 72 65 bers change here
0360: 2c 20 6d 75 73 74 20 61 6c 73 6f 20 67 6f 20 69 , must also go i
0370: 6e 74 6f 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e nto the followin
0380: 67 20 66 69 6c 65 73 0a 20 2a 20 61 6e 64 20 75 g files. * and u
0390: 70 64 61 74 65 20 74 68 65 20 76 65 72 73 69 6f pdate the versio
03a0: 6e 20 6e 75 6d 62 65 72 73 3a 0a 20 2a 0a 20 2a n numbers:. *. *
03b0: 20 6c 69 62 72 61 72 79 2f 69 6e 69 74 2e 74 63 library/init.tc
03c0: 6c 09 28 6f 6e 6c 79 20 69 66 20 4d 61 6a 6f 72 l.(only if Major
03d0: 2e 6d 69 6e 6f 72 20 63 68 61 6e 67 65 73 2c 20 .minor changes,
03e0: 6e 6f 74 20 70 61 74 63 68 6c 65 76 65 6c 29 20 not patchlevel)
03f0: 31 20 4c 4f 43 0a 20 2a 20 75 6e 69 78 2f 63 6f 1 LOC. * unix/co
0400: 6e 66 69 67 75 72 65 2e 69 6e 09 28 32 20 4c 4f nfigure.in.(2 LO
0410: 43 20 4d 61 6a 6f 72 2c 20 32 20 4c 4f 43 20 6d C Major, 2 LOC m
0420: 69 6e 6f 72 2c 20 31 20 4c 4f 43 20 70 61 74 63 inor, 1 LOC patc
0430: 68 29 0a 20 2a 20 77 69 6e 2f 63 6f 6e 66 69 67 h). * win/config
0440: 75 72 65 2e 69 6e 09 28 61 73 20 61 62 6f 76 65 ure.in.(as above
0450: 29 0a 20 2a 20 77 69 6e 2f 74 63 6c 2e 6d 34 09 ). * win/tcl.m4.
0460: 09 28 6e 6f 74 20 70 61 74 63 68 6c 65 76 65 6c .(not patchlevel
0470: 29 0a 20 2a 20 77 69 6e 2f 6d 61 6b 65 66 69 6c ). * win/makefil
0480: 65 2e 76 63 09 28 6e 6f 74 20 70 61 74 63 68 6c e.vc.(not patchl
0490: 65 76 65 6c 29 20 32 20 4c 4f 43 0a 20 2a 20 77 evel) 2 LOC. * w
04a0: 69 6e 2f 70 6b 67 49 6e 64 65 78 2e 74 63 6c 09 in/pkgIndex.tcl.
04b0: 28 6e 6f 74 20 70 61 74 63 68 6c 65 76 65 6c 2c (not patchlevel,
04c0: 20 66 6f 72 20 74 63 6c 72 65 67 4e 4e 2e 64 6c for tclregNN.dl
04d0: 6c 29 0a 20 2a 20 52 45 41 44 4d 45 09 09 28 73 l). * README..(s
04e0: 65 63 74 69 6f 6e 73 20 30 20 61 6e 64 20 32 29 ections 0 and 2)
04f0: 0a 20 2a 20 6d 61 63 2f 52 45 41 44 4d 45 09 09 . * mac/README..
0500: 28 32 20 4c 4f 43 2c 20 6e 6f 74 20 70 61 74 63 (2 LOC, not patc
0510: 68 6c 65 76 65 6c 29 0a 20 2a 20 77 69 6e 2f 52 hlevel). * win/R
0520: 45 41 44 4d 45 2e 62 69 6e 61 72 79 09 28 73 65 EADME.binary.(se
0530: 63 74 69 6f 6e 73 20 30 2d 34 29 0a 20 2a 20 77 ctions 0-4). * w
0540: 69 6e 2f 52 45 41 44 4d 45 09 09 28 6e 6f 74 20 in/README..(not
0550: 70 61 74 63 68 6c 65 76 65 6c 29 20 28 73 65 63 patchlevel) (sec
0560: 74 69 6f 6e 73 20 30 20 61 6e 64 20 32 29 0a 20 tions 0 and 2).
0570: 2a 20 75 6e 69 78 2f 52 45 41 44 4d 45 09 09 28 * unix/README..(
0580: 6e 6f 74 20 70 61 74 63 68 6c 65 76 65 6c 29 20 not patchlevel)
0590: 28 70 61 72 74 20 28 68 29 29 0a 20 2a 20 75 6e (part (h)). * un
05a0: 69 78 2f 74 63 6c 2e 73 70 65 63 09 28 32 20 4c ix/tcl.spec.(2 L
05b0: 4f 43 20 4d 61 6a 6f 72 2f 4d 69 6e 6f 72 2c 20 OC Major/Minor,
05c0: 31 20 4c 4f 43 20 70 61 74 63 68 29 0a 20 2a 20 1 LOC patch). *
05d0: 74 65 73 74 73 2f 62 61 73 69 63 2e 74 65 73 74 tests/basic.test
05e0: 09 28 6e 6f 74 20 70 61 74 63 68 6c 65 76 65 6c .(not patchlevel
05f0: 29 20 28 76 65 72 73 69 6f 6e 20 63 68 65 63 6b ) (version check
0600: 73 29 0a 20 2a 20 74 6f 6f 6c 73 2f 74 63 6c 2e s). * tools/tcl.
0610: 68 70 6a 2e 69 6e 09 28 6e 6f 74 20 70 61 74 63 hpj.in.(not patc
0620: 68 6c 65 76 65 6c 2c 20 66 6f 72 20 77 69 6e 64 hlevel, for wind
0630: 6f 77 73 20 69 6e 73 74 61 6c 6c 65 72 29 0a 20 ows installer).
0640: 2a 20 74 6f 6f 6c 73 2f 74 63 6c 2e 77 73 65 2e * tools/tcl.wse.
0650: 69 6e 09 28 66 6f 72 20 77 69 6e 64 6f 77 73 20 in.(for windows
0660: 69 6e 73 74 61 6c 6c 65 72 29 0a 20 2a 20 74 6f installer). * to
0670: 6f 6c 73 2f 74 63 6c 53 70 6c 61 73 68 2e 62 6d ols/tclSplash.bm
0680: 70 09 28 6e 6f 74 20 70 61 74 63 68 6c 65 76 65 p.(not patchleve
0690: 6c 29 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 l). */..#define
06a0: 54 43 4c 5f 4d 41 4a 4f 52 5f 56 45 52 53 49 4f TCL_MAJOR_VERSIO
06b0: 4e 20 20 20 38 0a 23 64 65 66 69 6e 65 20 54 43 N 8.#define TC
06c0: 4c 5f 4d 49 4e 4f 52 5f 56 45 52 53 49 4f 4e 20 L_MINOR_VERSION
06d0: 20 20 33 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 3.#define TCL_
06e0: 52 45 4c 45 41 53 45 5f 4c 45 56 45 4c 20 20 20 RELEASE_LEVEL
06f0: 54 43 4c 5f 46 49 4e 41 4c 5f 52 45 4c 45 41 53 TCL_FINAL_RELEAS
0700: 45 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 52 45 E.#define TCL_RE
0710: 4c 45 41 53 45 5f 53 45 52 49 41 4c 20 20 34 0a LEASE_SERIAL 4.
0720: 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 56 45 52 .#define TCL_VER
0730: 53 49 4f 4e 09 20 20 20 20 22 38 2e 33 22 0a 23 SION. "8.3".#
0740: 64 65 66 69 6e 65 20 54 43 4c 5f 50 41 54 43 48 define TCL_PATCH
0750: 5f 4c 45 56 45 4c 09 20 20 20 20 22 38 2e 33 2e _LEVEL. "8.3.
0760: 34 22 0a 0a 2f 2a 0a 20 2a 20 54 68 65 20 66 6f 4"../*. * The fo
0770: 6c 6c 6f 77 69 6e 67 20 64 65 66 69 6e 69 74 69 llowing definiti
0780: 6f 6e 73 20 73 65 74 20 75 70 20 74 68 65 20 70 ons set up the p
0790: 72 6f 70 65 72 20 6f 70 74 69 6f 6e 73 20 66 6f roper options fo
07a0: 72 20 57 69 6e 64 6f 77 73 0a 20 2a 20 63 6f 6d r Windows. * com
07b0: 70 69 6c 65 72 73 2e 20 20 57 65 20 75 73 65 20 pilers. We use
07c0: 74 68 69 73 20 6d 65 74 68 6f 64 20 62 65 63 61 this method beca
07d0: 75 73 65 20 74 68 65 72 65 20 69 73 20 6e 6f 20 use there is no
07e0: 61 75 74 6f 63 6f 6e 66 20 65 71 75 69 76 61 6c autoconf equival
07f0: 65 6e 74 2e 0a 20 2a 2f 0a 0a 23 69 66 6e 64 65 ent.. */..#ifnde
0800: 66 20 5f 5f 57 49 4e 33 32 5f 5f 0a 23 20 20 20 f __WIN32__.#
0810: 69 66 20 64 65 66 69 6e 65 64 28 5f 57 49 4e 33 if defined(_WIN3
0820: 32 29 20 7c 7c 20 64 65 66 69 6e 65 64 28 57 49 2) || defined(WI
0830: 4e 33 32 29 20 7c 7c 20 64 65 66 69 6e 65 64 28 N32) || defined(
0840: 5f 5f 43 59 47 57 49 4e 5f 5f 29 20 7c 7c 20 64 __CYGWIN__) || d
0850: 65 66 69 6e 65 64 28 5f 5f 4d 49 4e 47 57 33 32 efined(__MINGW32
0860: 5f 5f 29 20 7c 7c 20 64 65 66 69 6e 65 64 28 5f __) || defined(_
0870: 5f 42 4f 52 4c 41 4e 44 43 5f 5f 29 0a 23 09 64 _BORLANDC__).#.d
0880: 65 66 69 6e 65 20 5f 5f 57 49 4e 33 32 5f 5f 0a efine __WIN32__.
0890: 23 09 69 66 6e 64 65 66 20 57 49 4e 33 32 0a 23 #.ifndef WIN32.#
08a0: 09 20 20 20 20 64 65 66 69 6e 65 20 57 49 4e 33 . define WIN3
08b0: 32 0a 23 09 65 6e 64 69 66 0a 23 20 20 20 65 6e 2.#.endif.# en
08c0: 64 69 66 0a 23 65 6e 64 69 66 0a 0a 23 69 66 64 dif.#endif..#ifd
08d0: 65 66 20 5f 5f 57 49 4e 33 32 5f 5f 0a 23 20 20 ef __WIN32__.#
08e0: 20 69 66 6e 64 65 66 20 53 54 52 49 43 54 0a 23 ifndef STRICT.#
08f0: 09 64 65 66 69 6e 65 20 53 54 52 49 43 54 0a 23 .define STRICT.#
0900: 20 20 20 65 6e 64 69 66 0a 23 20 20 20 69 66 6e endif.# ifn
0910: 64 65 66 20 55 53 45 5f 50 52 4f 54 4f 54 59 50 def USE_PROTOTYP
0920: 45 0a 23 09 64 65 66 69 6e 65 20 55 53 45 5f 50 E.#.define USE_P
0930: 52 4f 54 4f 54 59 50 45 20 31 0a 23 20 20 20 65 ROTOTYPE 1.# e
0940: 6e 64 69 66 0a 23 20 20 20 69 66 6e 64 65 66 20 ndif.# ifndef
0950: 48 41 53 5f 53 54 44 41 52 47 0a 23 09 64 65 66 HAS_STDARG.#.def
0960: 69 6e 65 20 48 41 53 5f 53 54 44 41 52 47 20 31 ine HAS_STDARG 1
0970: 0a 23 20 20 20 65 6e 64 69 66 0a 23 20 20 20 69 .# endif.# i
0980: 66 6e 64 65 66 20 55 53 45 5f 50 52 4f 54 4f 54 fndef USE_PROTOT
0990: 59 50 45 0a 23 09 64 65 66 69 6e 65 20 55 53 45 YPE.#.define USE
09a0: 5f 50 52 4f 54 4f 54 59 50 45 20 31 0a 23 20 20 _PROTOTYPE 1.#
09b0: 20 65 6e 64 69 66 0a 0a 23 65 6e 64 69 66 20 2f endif..#endif /
09c0: 2a 20 5f 5f 57 49 4e 33 32 5f 5f 20 2a 2f 0a 0a * __WIN32__ */..
09d0: 2f 2a 0a 20 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 /*. * The follow
09e0: 69 6e 67 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 ing definitions
09f0: 73 65 74 20 75 70 20 74 68 65 20 70 72 6f 70 65 set up the prope
0a00: 72 20 6f 70 74 69 6f 6e 73 20 66 6f 72 20 4d 61 r options for Ma
0a10: 63 69 6e 74 6f 73 68 0a 20 2a 20 63 6f 6d 70 69 cintosh. * compi
0a20: 6c 65 72 73 2e 20 20 57 65 20 75 73 65 20 74 68 lers. We use th
0a30: 69 73 20 6d 65 74 68 6f 64 20 62 65 63 61 75 73 is method becaus
0a40: 65 20 74 68 65 72 65 20 69 73 20 6e 6f 20 61 75 e there is no au
0a50: 74 6f 63 6f 6e 66 20 65 71 75 69 76 61 6c 65 6e toconf equivalen
0a60: 74 2e 0a 20 2a 2f 0a 0a 23 69 66 64 65 66 20 4d t.. */..#ifdef M
0a70: 41 43 5f 54 43 4c 0a 23 69 6e 63 6c 75 64 65 20 AC_TCL.#include
0a80: 3c 43 6f 6e 64 69 74 69 6f 6e 61 6c 4d 61 63 72 <ConditionalMacr
0a90: 6f 73 2e 68 3e 0a 23 20 20 20 69 66 6e 64 65 66 os.h>.# ifndef
0aa0: 20 48 41 53 5f 53 54 44 41 52 47 0a 23 09 64 65 HAS_STDARG.#.de
0ab0: 66 69 6e 65 20 48 41 53 5f 53 54 44 41 52 47 20 fine HAS_STDARG
0ac0: 31 0a 23 20 20 20 65 6e 64 69 66 0a 23 20 20 20 1.# endif.#
0ad0: 69 66 6e 64 65 66 20 55 53 45 5f 54 43 4c 41 4c ifndef USE_TCLAL
0ae0: 4c 4f 43 0a 23 09 64 65 66 69 6e 65 20 55 53 45 LOC.#.define USE
0af0: 5f 54 43 4c 41 4c 4c 4f 43 20 31 0a 23 20 20 20 _TCLALLOC 1.#
0b00: 65 6e 64 69 66 0a 23 20 20 20 69 66 6e 64 65 66 endif.# ifndef
0b10: 20 4e 4f 5f 53 54 52 45 52 52 4f 52 0a 23 09 64 NO_STRERROR.#.d
0b20: 65 66 69 6e 65 20 4e 4f 5f 53 54 52 45 52 52 4f efine NO_STRERRO
0b30: 52 20 31 0a 23 20 20 20 65 6e 64 69 66 0a 23 20 R 1.# endif.#
0b40: 20 20 64 65 66 69 6e 65 20 49 4e 4c 49 4e 45 20 define INLINE
0b50: 0a 23 65 6e 64 69 66 0a 0a 2f 2a 0a 20 2a 20 55 .#endif../*. * U
0b60: 74 69 6c 69 74 79 20 6d 61 63 72 6f 73 3a 20 53 tility macros: S
0b70: 54 52 49 4e 47 49 46 59 20 74 61 6b 65 73 20 61 TRINGIFY takes a
0b80: 6e 20 61 72 67 75 6d 65 6e 74 20 61 6e 64 20 77 n argument and w
0b90: 72 61 70 73 20 69 74 20 69 6e 20 22 22 20 28 64 raps it in "" (d
0ba0: 6f 75 62 6c 65 0a 20 2a 20 71 75 6f 74 61 74 69 ouble. * quotati
0bb0: 6f 6e 20 6d 61 72 6b 73 29 2c 20 4a 4f 49 4e 20 on marks), JOIN
0bc0: 6a 6f 69 6e 73 20 74 77 6f 20 61 72 67 75 6d 65 joins two argume
0bd0: 6e 74 73 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e nts.. */..#defin
0be0: 65 20 56 45 52 42 41 54 49 4d 28 78 29 20 78 0a e VERBATIM(x) x.
0bf0: 23 69 66 64 65 66 20 5f 4d 53 43 5f 56 45 52 0a #ifdef _MSC_VER.
0c00: 23 20 64 65 66 69 6e 65 20 53 54 52 49 4e 47 49 # define STRINGI
0c10: 46 59 28 78 29 20 53 54 52 49 4e 47 49 46 59 31 FY(x) STRINGIFY1
0c20: 28 78 29 0a 23 20 64 65 66 69 6e 65 20 53 54 52 (x).# define STR
0c30: 49 4e 47 49 46 59 31 28 78 29 20 23 78 0a 23 20 INGIFY1(x) #x.#
0c40: 64 65 66 69 6e 65 20 4a 4f 49 4e 28 61 2c 62 29 define JOIN(a,b)
0c50: 20 4a 4f 49 4e 31 28 61 2c 62 29 0a 23 20 64 65 JOIN1(a,b).# de
0c60: 66 69 6e 65 20 4a 4f 49 4e 31 28 61 2c 62 29 20 fine JOIN1(a,b)
0c70: 61 23 23 62 0a 23 65 6c 73 65 0a 23 20 69 66 64 a##b.#else.# ifd
0c80: 65 66 20 52 45 53 4f 55 52 43 45 5f 49 4e 43 4c ef RESOURCE_INCL
0c90: 55 44 45 44 0a 23 20 20 64 65 66 69 6e 65 20 53 UDED.# define S
0ca0: 54 52 49 4e 47 49 46 59 28 78 29 20 53 54 52 49 TRINGIFY(x) STRI
0cb0: 4e 47 49 46 59 31 28 78 29 0a 23 20 20 64 65 66 NGIFY1(x).# def
0cc0: 69 6e 65 20 53 54 52 49 4e 47 49 46 59 31 28 78 ine STRINGIFY1(x
0cd0: 29 20 23 78 0a 23 20 20 64 65 66 69 6e 65 20 4a ) #x.# define J
0ce0: 4f 49 4e 28 61 2c 62 29 20 4a 4f 49 4e 31 28 61 OIN(a,b) JOIN1(a
0cf0: 2c 62 29 0a 23 20 20 64 65 66 69 6e 65 20 4a 4f ,b).# define JO
0d00: 49 4e 31 28 61 2c 62 29 20 61 23 23 62 0a 23 20 IN1(a,b) a##b.#
0d10: 65 6c 73 65 0a 23 20 20 69 66 64 65 66 20 5f 5f else.# ifdef __
0d20: 53 54 44 43 5f 5f 0a 23 20 20 20 64 65 66 69 6e STDC__.# defin
0d30: 65 20 53 54 52 49 4e 47 49 46 59 28 78 29 20 23 e STRINGIFY(x) #
0d40: 78 0a 23 20 20 20 64 65 66 69 6e 65 20 4a 4f 49 x.# define JOI
0d50: 4e 28 61 2c 62 29 20 61 23 23 62 0a 23 20 20 65 N(a,b) a##b.# e
0d60: 6c 73 65 0a 23 20 20 20 64 65 66 69 6e 65 20 53 lse.# define S
0d70: 54 52 49 4e 47 49 46 59 28 78 29 20 22 78 22 0a TRINGIFY(x) "x".
0d80: 23 20 20 20 64 65 66 69 6e 65 20 4a 4f 49 4e 28 # define JOIN(
0d90: 61 2c 62 29 20 56 45 52 42 41 54 49 4d 28 61 29 a,b) VERBATIM(a)
0da0: 56 45 52 42 41 54 49 4d 28 62 29 0a 23 20 20 65 VERBATIM(b).# e
0db0: 6e 64 69 66 0a 23 20 65 6e 64 69 66 0a 23 65 6e ndif.# endif.#en
0dc0: 64 69 66 0a 0a 2f 2a 0a 20 2a 20 53 70 65 63 69 dif../*. * Speci
0dd0: 61 6c 20 6d 61 63 72 6f 20 74 6f 20 64 65 66 69 al macro to defi
0de0: 6e 65 20 6d 75 74 65 78 65 73 2c 20 74 68 61 74 ne mutexes, that
0df0: 20 64 6f 65 73 6e 27 74 20 64 6f 20 61 6e 79 74 doesn't do anyt
0e00: 68 69 6e 67 0a 20 2a 20 69 66 20 77 65 20 61 72 hing. * if we ar
0e10: 65 20 6e 6f 74 20 75 73 69 6e 67 20 74 68 72 65 e not using thre
0e20: 61 64 73 2e 0a 20 2a 2f 0a 0a 23 69 66 64 65 66 ads.. */..#ifdef
0e30: 20 54 43 4c 5f 54 48 52 45 41 44 53 0a 23 64 65 TCL_THREADS.#de
0e40: 66 69 6e 65 20 54 43 4c 5f 44 45 43 4c 41 52 45 fine TCL_DECLARE
0e50: 5f 4d 55 54 45 58 28 6e 61 6d 65 29 20 73 74 61 _MUTEX(name) sta
0e60: 74 69 63 20 54 63 6c 5f 4d 75 74 65 78 20 6e 61 tic Tcl_Mutex na
0e70: 6d 65 3b 0a 23 65 6c 73 65 0a 23 64 65 66 69 6e me;.#else.#defin
0e80: 65 20 54 43 4c 5f 44 45 43 4c 41 52 45 5f 4d 55 e TCL_DECLARE_MU
0e90: 54 45 58 28 6e 61 6d 65 29 0a 23 65 6e 64 69 66 TEX(name).#endif
0ea0: 0a 0a 2f 2a 0a 20 2a 20 4d 61 63 72 6f 73 20 74 ../*. * Macros t
0eb0: 68 61 74 20 65 6c 69 6d 69 6e 61 74 65 20 74 68 hat eliminate th
0ec0: 65 20 6f 76 65 72 68 65 61 64 20 6f 66 20 74 68 e overhead of th
0ed0: 65 20 74 68 72 65 61 64 20 73 79 6e 63 68 72 6f e thread synchro
0ee0: 6e 69 7a 61 74 69 6f 6e 0a 20 2a 20 66 75 6e 63 nization. * func
0ef0: 74 69 6f 6e 73 20 77 68 65 6e 20 63 6f 6d 70 69 tions when compi
0f00: 6c 69 6e 67 20 77 69 74 68 6f 75 74 20 74 68 72 ling without thr
0f10: 65 61 64 20 73 75 70 70 6f 72 74 2e 0a 20 2a 2f ead support.. */
0f20: 0a 0a 23 69 66 6e 64 65 66 20 54 43 4c 5f 54 48 ..#ifndef TCL_TH
0f30: 52 45 41 44 53 0a 23 64 65 66 69 6e 65 20 54 63 READS.#define Tc
0f40: 6c 5f 4d 75 74 65 78 4c 6f 63 6b 28 6d 75 74 65 l_MutexLock(mute
0f50: 78 50 74 72 29 0a 23 64 65 66 69 6e 65 20 54 63 xPtr).#define Tc
0f60: 6c 5f 4d 75 74 65 78 55 6e 6c 6f 63 6b 28 6d 75 l_MutexUnlock(mu
0f70: 74 65 78 50 74 72 29 0a 23 64 65 66 69 6e 65 20 texPtr).#define
0f80: 54 63 6c 5f 4d 75 74 65 78 46 69 6e 61 6c 69 7a Tcl_MutexFinaliz
0f90: 65 28 6d 75 74 65 78 50 74 72 29 0a 23 64 65 66 e(mutexPtr).#def
0fa0: 69 6e 65 20 54 63 6c 5f 43 6f 6e 64 69 74 69 6f ine Tcl_Conditio
0fb0: 6e 4e 6f 74 69 66 79 28 63 6f 6e 64 50 74 72 29 nNotify(condPtr)
0fc0: 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f 43 6f 6e .#define Tcl_Con
0fd0: 64 69 74 69 6f 6e 57 61 69 74 28 63 6f 6e 64 50 ditionWait(condP
0fe0: 74 72 2c 20 6d 75 74 65 78 50 74 72 2c 20 74 69 tr, mutexPtr, ti
0ff0: 6d 65 50 74 72 29 0a 23 64 65 66 69 6e 65 20 54 mePtr).#define T
1000: 63 6c 5f 43 6f 6e 64 69 74 69 6f 6e 46 69 6e 61 cl_ConditionFina
1010: 6c 69 7a 65 28 63 6f 6e 64 50 74 72 29 0a 23 65 lize(condPtr).#e
1020: 6e 64 69 66 20 2f 2a 20 54 43 4c 5f 54 48 52 45 ndif /* TCL_THRE
1030: 41 44 53 20 2a 2f 0a 0a 2f 2a 20 0a 20 2a 20 41 ADS */../* . * A
1040: 20 73 70 65 63 69 61 6c 20 64 65 66 69 6e 69 74 special definit
1050: 69 6f 6e 20 75 73 65 64 20 74 6f 20 61 6c 6c 6f ion used to allo
1060: 77 20 74 68 69 73 20 68 65 61 64 65 72 20 66 69 w this header fi
1070: 6c 65 20 74 6f 20 62 65 20 69 6e 63 6c 75 64 65 le to be include
1080: 64 20 0a 20 2a 20 69 6e 20 72 65 73 6f 75 72 63 d . * in resourc
1090: 65 20 66 69 6c 65 73 20 73 6f 20 74 68 61 74 20 e files so that
10a0: 74 68 65 79 20 63 61 6e 20 67 65 74 20 6f 62 74 they can get obt
10b0: 61 69 6e 20 76 65 72 73 69 6f 6e 20 69 6e 66 6f ain version info
10c0: 72 6d 61 74 69 6f 6e 20 66 72 6f 6d 0a 20 2a 20 rmation from. *
10d0: 74 68 69 73 20 66 69 6c 65 2e 20 20 52 65 73 6f this file. Reso
10e0: 75 72 63 65 20 63 6f 6d 70 69 6c 65 72 73 20 64 urce compilers d
10f0: 6f 6e 27 74 20 6c 69 6b 65 20 61 6c 6c 20 74 68 on't like all th
1100: 65 20 43 20 73 74 75 66 66 2c 20 6c 69 6b 65 20 e C stuff, like
1110: 74 79 70 65 64 65 66 73 0a 20 2a 20 61 6e 64 20 typedefs. * and
1120: 70 72 6f 63 65 64 75 72 65 20 64 65 63 6c 61 72 procedure declar
1130: 61 74 69 6f 6e 73 2c 20 74 68 61 74 20 6f 63 63 ations, that occ
1140: 75 72 20 62 65 6c 6f 77 2e 0a 20 2a 2f 0a 0a 23 ur below.. */..#
1150: 69 66 6e 64 65 66 20 52 45 53 4f 55 52 43 45 5f ifndef RESOURCE_
1160: 49 4e 43 4c 55 44 45 44 0a 0a 23 69 66 6e 64 65 INCLUDED..#ifnde
1170: 66 20 42 55 46 53 49 5a 0a 23 69 6e 63 6c 75 64 f BUFSIZ.#includ
1180: 65 20 3c 73 74 64 69 6f 2e 68 3e 0a 23 65 6e 64 e <stdio.h>.#end
1190: 69 66 0a 0a 2f 2a 0a 20 2a 20 44 65 66 69 6e 69 if../*. * Defini
11a0: 74 69 6f 6e 73 20 74 68 61 74 20 61 6c 6c 6f 77 tions that allow
11b0: 20 54 63 6c 20 66 75 6e 63 74 69 6f 6e 73 20 77 Tcl functions w
11c0: 69 74 68 20 76 61 72 69 61 62 6c 65 20 6e 75 6d ith variable num
11d0: 62 65 72 73 20 6f 66 0a 20 2a 20 61 72 67 75 6d bers of. * argum
11e0: 65 6e 74 73 20 74 6f 20 62 65 20 75 73 65 64 20 ents to be used
11f0: 77 69 74 68 20 65 69 74 68 65 72 20 76 61 72 61 with either vara
1200: 72 67 73 2e 68 20 6f 72 20 73 74 64 61 72 67 2e rgs.h or stdarg.
1210: 68 2e 20 20 54 43 4c 5f 56 41 52 41 52 47 53 0a h. TCL_VARARGS.
1220: 20 2a 20 69 73 20 75 73 65 64 20 69 6e 20 70 72 * is used in pr
1230: 6f 63 65 64 75 72 65 20 70 72 6f 74 6f 74 79 70 ocedure prototyp
1240: 65 73 2e 20 20 54 43 4c 5f 56 41 52 41 52 47 53 es. TCL_VARARGS
1250: 5f 44 45 46 20 69 73 20 75 73 65 64 20 74 6f 20 _DEF is used to
1260: 64 65 63 6c 61 72 65 0a 20 2a 20 74 68 65 20 61 declare. * the a
1270: 72 67 75 6d 65 6e 74 73 20 69 6e 20 61 20 66 75 rguments in a fu
1280: 6e 63 74 69 6f 6e 20 64 65 66 69 6e 69 74 6f 6e nction definiton
1290: 3a 20 69 74 20 74 61 6b 65 73 20 74 68 65 20 74 : it takes the t
12a0: 79 70 65 20 61 6e 64 20 6e 61 6d 65 20 6f 66 0a ype and name of.
12b0: 20 2a 20 74 68 65 20 66 69 72 73 74 20 61 72 67 * the first arg
12c0: 75 6d 65 6e 74 20 61 6e 64 20 73 75 70 70 6c 69 ument and suppli
12d0: 65 73 20 74 68 65 20 61 70 70 72 6f 70 72 69 61 es the appropria
12e0: 74 65 20 61 72 67 75 6d 65 6e 74 20 64 65 63 6c te argument decl
12f0: 61 72 61 74 69 6f 6e 0a 20 2a 20 73 74 72 69 6e aration. * strin
1300: 67 20 66 6f 72 20 75 73 65 20 69 6e 20 74 68 65 g for use in the
1310: 20 66 75 6e 63 74 69 6f 6e 20 64 65 66 69 6e 69 function defini
1320: 74 69 6f 6e 2e 20 20 54 43 4c 5f 56 41 52 41 52 tion. TCL_VARAR
1330: 47 53 5f 53 54 41 52 54 0a 20 2a 20 69 6e 69 74 GS_START. * init
1340: 69 61 6c 69 7a 65 73 20 74 68 65 20 76 61 5f 6c ializes the va_l
1350: 69 73 74 20 64 61 74 61 20 73 74 72 75 63 74 75 ist data structu
1360: 72 65 20 61 6e 64 20 72 65 74 75 72 6e 73 20 74 re and returns t
1370: 68 65 20 66 69 72 73 74 20 61 72 67 75 6d 65 6e he first argumen
1380: 74 2e 0a 20 2a 2f 0a 0a 23 69 66 20 64 65 66 69 t.. */..#if defi
1390: 6e 65 64 28 5f 5f 53 54 44 43 5f 5f 29 20 7c 7c ned(__STDC__) ||
13a0: 20 64 65 66 69 6e 65 64 28 48 41 53 5f 53 54 44 defined(HAS_STD
13b0: 41 52 47 29 0a 23 20 20 20 69 6e 63 6c 75 64 65 ARG).# include
13c0: 20 3c 73 74 64 61 72 67 2e 68 3e 0a 0a 23 20 20 <stdarg.h>..#
13d0: 20 64 65 66 69 6e 65 20 54 43 4c 5f 56 41 52 41 define TCL_VARA
13e0: 52 47 53 28 74 79 70 65 2c 20 6e 61 6d 65 29 20 RGS(type, name)
13f0: 28 74 79 70 65 20 6e 61 6d 65 2c 20 2e 2e 2e 29 (type name, ...)
1400: 0a 23 20 20 20 64 65 66 69 6e 65 20 54 43 4c 5f .# define TCL_
1410: 56 41 52 41 52 47 53 5f 44 45 46 28 74 79 70 65 VARARGS_DEF(type
1420: 2c 20 6e 61 6d 65 29 20 28 74 79 70 65 20 6e 61 , name) (type na
1430: 6d 65 2c 20 2e 2e 2e 29 0a 23 20 20 20 64 65 66 me, ...).# def
1440: 69 6e 65 20 54 43 4c 5f 56 41 52 41 52 47 53 5f ine TCL_VARARGS_
1450: 53 54 41 52 54 28 74 79 70 65 2c 20 6e 61 6d 65 START(type, name
1460: 2c 20 6c 69 73 74 29 20 28 76 61 5f 73 74 61 72 , list) (va_star
1470: 74 28 6c 69 73 74 2c 20 6e 61 6d 65 29 2c 20 6e t(list, name), n
1480: 61 6d 65 29 0a 23 65 6c 73 65 0a 23 20 20 20 69 ame).#else.# i
1490: 6e 63 6c 75 64 65 20 3c 76 61 72 61 72 67 73 2e nclude <varargs.
14a0: 68 3e 0a 0a 23 20 20 20 69 66 64 65 66 20 5f 5f h>..# ifdef __
14b0: 63 70 6c 75 73 70 6c 75 73 0a 23 09 64 65 66 69 cplusplus.#.defi
14c0: 6e 65 20 54 43 4c 5f 56 41 52 41 52 47 53 28 74 ne TCL_VARARGS(t
14d0: 79 70 65 2c 20 6e 61 6d 65 29 20 28 74 79 70 65 ype, name) (type
14e0: 20 6e 61 6d 65 2c 20 2e 2e 2e 29 0a 23 09 64 65 name, ...).#.de
14f0: 66 69 6e 65 20 54 43 4c 5f 56 41 52 41 52 47 53 fine TCL_VARARGS
1500: 5f 44 45 46 28 74 79 70 65 2c 20 6e 61 6d 65 29 _DEF(type, name)
1510: 20 28 74 79 70 65 20 76 61 5f 61 6c 69 73 74 2c (type va_alist,
1520: 20 2e 2e 2e 29 0a 23 20 20 20 65 6c 73 65 0a 23 ...).# else.#
1530: 09 64 65 66 69 6e 65 20 54 43 4c 5f 56 41 52 41 .define TCL_VARA
1540: 52 47 53 28 74 79 70 65 2c 20 6e 61 6d 65 29 20 RGS(type, name)
1550: 28 29 0a 23 09 64 65 66 69 6e 65 20 54 43 4c 5f ().#.define TCL_
1560: 56 41 52 41 52 47 53 5f 44 45 46 28 74 79 70 65 VARARGS_DEF(type
1570: 2c 20 6e 61 6d 65 29 20 28 76 61 5f 61 6c 69 73 , name) (va_alis
1580: 74 29 0a 23 20 20 20 65 6e 64 69 66 0a 23 20 20 t).# endif.#
1590: 20 64 65 66 69 6e 65 20 54 43 4c 5f 56 41 52 41 define TCL_VARA
15a0: 52 47 53 5f 53 54 41 52 54 28 74 79 70 65 2c 20 RGS_START(type,
15b0: 6e 61 6d 65 2c 20 6c 69 73 74 29 20 5c 0a 09 28 name, list) \..(
15c0: 76 61 5f 73 74 61 72 74 28 6c 69 73 74 29 2c 20 va_start(list),
15d0: 76 61 5f 61 72 67 28 6c 69 73 74 2c 20 74 79 70 va_arg(list, typ
15e0: 65 29 29 0a 23 65 6e 64 69 66 0a 0a 2f 2a 0a 20 e)).#endif../*.
15f0: 2a 20 4d 61 63 72 6f 73 20 75 73 65 64 20 74 6f * Macros used to
1600: 20 64 65 63 6c 61 72 65 20 61 20 66 75 6e 63 74 declare a funct
1610: 69 6f 6e 20 74 6f 20 62 65 20 65 78 70 6f 72 74 ion to be export
1620: 65 64 20 62 79 20 61 20 44 4c 4c 2e 0a 20 2a 20 ed by a DLL.. *
1630: 55 73 65 64 20 62 79 20 57 69 6e 64 6f 77 73 2c Used by Windows,
1640: 20 6d 61 70 73 20 74 6f 20 6e 6f 2d 6f 70 20 64 maps to no-op d
1650: 65 63 6c 61 72 61 74 69 6f 6e 73 20 6f 6e 20 6e eclarations on n
1660: 6f 6e 2d 57 69 6e 64 6f 77 73 20 73 79 73 74 65 on-Windows syste
1670: 6d 73 2e 0a 20 2a 20 54 68 65 20 64 65 66 61 75 ms.. * The defau
1680: 6c 74 20 62 75 69 6c 64 20 6f 6e 20 77 69 6e 64 lt build on wind
1690: 6f 77 73 20 69 73 20 66 6f 72 20 61 20 44 4c 4c ows is for a DLL
16a0: 2c 20 77 68 69 63 68 20 63 61 75 73 65 73 20 74 , which causes t
16b0: 68 65 20 44 4c 4c 49 4d 50 4f 52 54 0a 20 2a 20 he DLLIMPORT. *
16c0: 61 6e 64 20 44 4c 4c 45 58 50 4f 52 54 20 6d 61 and DLLEXPORT ma
16d0: 63 72 6f 73 20 74 6f 20 62 65 20 6e 6f 6e 65 6d cros to be nonem
16e0: 70 74 79 2e 20 54 6f 20 62 75 69 6c 64 20 61 20 pty. To build a
16f0: 73 74 61 74 69 63 20 6c 69 62 72 61 72 79 2c 20 static library,
1700: 74 68 65 0a 20 2a 20 6d 61 63 72 6f 20 53 54 41 the. * macro STA
1710: 54 49 43 5f 42 55 49 4c 44 20 73 68 6f 75 6c 64 TIC_BUILD should
1720: 20 62 65 20 64 65 66 69 6e 65 64 2e 0a 20 2a 2f be defined.. */
1730: 0a 0a 23 69 66 64 65 66 20 53 54 41 54 49 43 5f ..#ifdef STATIC_
1740: 42 55 49 4c 44 0a 23 20 64 65 66 69 6e 65 20 44 BUILD.# define D
1750: 4c 4c 49 4d 50 4f 52 54 0a 23 20 64 65 66 69 6e LLIMPORT.# defin
1760: 65 20 44 4c 4c 45 58 50 4f 52 54 0a 23 65 6c 73 e DLLEXPORT.#els
1770: 65 0a 23 20 69 66 20 28 64 65 66 69 6e 65 64 28 e.# if (defined(
1780: 5f 5f 57 49 4e 33 32 5f 5f 29 20 26 26 20 28 64 __WIN32__) && (d
1790: 65 66 69 6e 65 64 28 5f 4d 53 43 5f 56 45 52 29 efined(_MSC_VER)
17a0: 20 7c 7c 20 28 64 65 66 69 6e 65 64 28 5f 5f 47 || (defined(__G
17b0: 4e 55 43 5f 5f 29 20 26 26 20 64 65 66 69 6e 65 NUC__) && define
17c0: 64 28 5f 5f 64 65 63 6c 73 70 65 63 29 29 29 29 d(__declspec))))
17d0: 20 7c 7c 20 28 64 65 66 69 6e 65 64 28 4d 41 43 || (defined(MAC
17e0: 5f 54 43 4c 29 20 26 26 20 46 55 4e 43 54 49 4f _TCL) && FUNCTIO
17f0: 4e 5f 44 45 43 4c 53 50 45 43 29 0a 23 20 20 20 N_DECLSPEC).#
1800: 64 65 66 69 6e 65 20 44 4c 4c 49 4d 50 4f 52 54 define DLLIMPORT
1810: 20 5f 5f 64 65 63 6c 73 70 65 63 28 64 6c 6c 69 __declspec(dlli
1820: 6d 70 6f 72 74 29 0a 23 20 20 20 64 65 66 69 6e mport).# defin
1830: 65 20 44 4c 4c 45 58 50 4f 52 54 20 5f 5f 64 65 e DLLEXPORT __de
1840: 63 6c 73 70 65 63 28 64 6c 6c 65 78 70 6f 72 74 clspec(dllexport
1850: 29 0a 23 20 65 6c 73 65 0a 23 20 20 64 65 66 69 ).# else.# defi
1860: 6e 65 20 44 4c 4c 49 4d 50 4f 52 54 0a 23 20 20 ne DLLIMPORT.#
1870: 64 65 66 69 6e 65 20 44 4c 4c 45 58 50 4f 52 54 define DLLEXPORT
1880: 0a 23 20 65 6e 64 69 66 0a 23 65 6e 64 69 66 0a .# endif.#endif.
1890: 0a 2f 2a 0a 20 2a 20 54 68 65 73 65 20 6d 61 63 ./*. * These mac
18a0: 72 6f 73 20 61 72 65 20 75 73 65 64 20 74 6f 20 ros are used to
18b0: 63 6f 6e 74 72 6f 6c 20 77 68 65 74 68 65 72 20 control whether
18c0: 66 75 6e 63 74 69 6f 6e 73 20 61 72 65 20 62 65 functions are be
18d0: 69 6e 67 20 64 65 63 6c 61 72 65 64 20 66 6f 72 ing declared for
18e0: 0a 20 2a 20 69 6d 70 6f 72 74 20 6f 72 20 65 78 . * import or ex
18f0: 70 6f 72 74 2e 20 20 49 66 20 61 20 66 75 6e 63 port. If a func
1900: 74 69 6f 6e 20 69 73 20 62 65 69 6e 67 20 64 65 tion is being de
1910: 63 6c 61 72 65 64 20 77 68 69 6c 65 20 69 74 20 clared while it
1920: 69 73 20 62 65 69 6e 67 20 62 75 69 6c 74 0a 20 is being built.
1930: 2a 20 74 6f 20 62 65 20 69 6e 63 6c 75 64 65 64 * to be included
1940: 20 69 6e 20 61 20 73 68 61 72 65 64 20 6c 69 62 in a shared lib
1950: 72 61 72 79 2c 20 74 68 65 6e 20 69 74 20 73 68 rary, then it sh
1960: 6f 75 6c 64 20 68 61 76 65 20 74 68 65 20 44 4c ould have the DL
1970: 4c 45 58 50 4f 52 54 0a 20 2a 20 73 74 6f 72 61 LEXPORT. * stora
1980: 67 65 20 63 6c 61 73 73 2e 20 20 49 66 20 69 73 ge class. If is
1990: 20 62 65 69 6e 67 20 64 65 63 6c 61 72 65 64 20 being declared
19a0: 66 6f 72 20 75 73 65 20 62 79 20 61 20 6d 6f 64 for use by a mod
19b0: 75 6c 65 20 74 68 61 74 20 69 73 20 67 6f 69 6e ule that is goin
19c0: 67 20 74 6f 0a 20 2a 20 6c 69 6e 6b 20 61 67 61 g to. * link aga
19d0: 69 6e 73 74 20 74 68 65 20 73 68 61 72 65 64 20 inst the shared
19e0: 6c 69 62 72 61 72 79 2c 20 74 68 65 6e 20 69 74 library, then it
19f0: 20 73 68 6f 75 6c 64 20 68 61 76 65 20 74 68 65 should have the
1a00: 20 44 4c 4c 49 4d 50 4f 52 54 20 73 74 6f 72 61 DLLIMPORT stora
1a10: 67 65 0a 20 2a 20 63 6c 61 73 73 2e 20 20 49 66 ge. * class. If
1a20: 20 74 68 65 20 73 79 6d 62 6f 6c 20 69 73 20 62 the symbol is b
1a30: 65 69 6e 64 20 64 65 63 6c 61 72 65 64 20 66 6f eind declared fo
1a40: 72 20 61 20 73 74 61 74 69 63 20 62 75 69 6c 64 r a static build
1a50: 20 6f 72 20 66 6f 72 20 75 73 65 20 66 72 6f 6d or for use from
1a60: 20 61 0a 20 2a 20 73 74 75 62 20 6c 69 62 72 61 a. * stub libra
1a70: 72 79 2c 20 74 68 65 6e 20 74 68 65 20 73 74 6f ry, then the sto
1a80: 72 61 67 65 20 63 6c 61 73 73 20 73 68 6f 75 6c rage class shoul
1a90: 64 20 62 65 20 65 6d 70 74 79 2e 0a 20 2a 0a 20 d be empty.. *.
1aa0: 2a 20 54 68 65 20 63 6f 6e 76 65 6e 74 69 6f 6e * The convention
1ab0: 20 69 73 20 74 68 61 74 20 61 20 6d 61 63 72 6f is that a macro
1ac0: 20 63 61 6c 6c 65 64 20 42 55 49 4c 44 5f 78 78 called BUILD_xx
1ad0: 78 78 2c 20 77 68 65 72 65 20 78 78 78 78 20 69 xx, where xxxx i
1ae0: 73 20 74 68 65 0a 20 2a 20 6e 61 6d 65 20 6f 66 s the. * name of
1af0: 20 61 20 6c 69 62 72 61 72 79 20 77 65 20 61 72 a library we ar
1b00: 65 20 62 75 69 6c 64 69 6e 67 2c 20 69 73 20 73 e building, is s
1b10: 65 74 20 6f 6e 20 74 68 65 20 63 6f 6d 70 69 6c et on the compil
1b20: 65 20 6c 69 6e 65 20 66 6f 72 20 73 6f 75 72 63 e line for sourc
1b30: 65 73 0a 20 2a 20 74 68 61 74 20 61 72 65 20 74 es. * that are t
1b40: 6f 20 62 65 20 70 6c 61 63 65 64 20 69 6e 20 74 o be placed in t
1b50: 68 65 20 6c 69 62 72 61 72 79 2e 20 20 57 68 65 he library. Whe
1b60: 6e 20 74 68 69 73 20 6d 61 63 72 6f 20 69 73 20 n this macro is
1b70: 73 65 74 2c 20 74 68 65 0a 20 2a 20 73 74 6f 72 set, the. * stor
1b80: 61 67 65 20 63 6c 61 73 73 20 77 69 6c 6c 20 62 age class will b
1b90: 65 20 73 65 74 20 74 6f 20 44 4c 4c 45 58 50 4f e set to DLLEXPO
1ba0: 52 54 2e 20 20 41 74 20 74 68 65 20 65 6e 64 20 RT. At the end
1bb0: 6f 66 20 74 68 65 20 68 65 61 64 65 72 20 66 69 of the header fi
1bc0: 6c 65 2c 20 74 68 65 0a 20 2a 20 73 74 6f 72 61 le, the. * stora
1bd0: 67 65 20 63 6c 61 73 73 20 77 69 6c 6c 20 62 65 ge class will be
1be0: 20 72 65 73 65 74 20 74 6f 20 44 4c 4c 49 4d 50 reset to DLLIMP
1bf0: 4f 52 54 2e 0a 20 2a 2f 0a 0a 23 75 6e 64 65 66 ORT.. */..#undef
1c00: 20 54 43 4c 5f 53 54 4f 52 41 47 45 5f 43 4c 41 TCL_STORAGE_CLA
1c10: 53 53 0a 23 69 66 64 65 66 20 42 55 49 4c 44 5f SS.#ifdef BUILD_
1c20: 74 63 6c 0a 23 20 64 65 66 69 6e 65 20 54 43 4c tcl.# define TCL
1c30: 5f 53 54 4f 52 41 47 45 5f 43 4c 41 53 53 20 44 _STORAGE_CLASS D
1c40: 4c 4c 45 58 50 4f 52 54 0a 23 65 6c 73 65 0a 23 LLEXPORT.#else.#
1c50: 20 69 66 64 65 66 20 55 53 45 5f 54 43 4c 5f 53 ifdef USE_TCL_S
1c60: 54 55 42 53 0a 23 20 20 64 65 66 69 6e 65 20 54 TUBS.# define T
1c70: 43 4c 5f 53 54 4f 52 41 47 45 5f 43 4c 41 53 53 CL_STORAGE_CLASS
1c80: 0a 23 20 65 6c 73 65 0a 23 20 20 64 65 66 69 6e .# else.# defin
1c90: 65 20 54 43 4c 5f 53 54 4f 52 41 47 45 5f 43 4c e TCL_STORAGE_CL
1ca0: 41 53 53 20 44 4c 4c 49 4d 50 4f 52 54 0a 23 20 ASS DLLIMPORT.#
1cb0: 65 6e 64 69 66 0a 23 65 6e 64 69 66 0a 0a 2f 2a endif.#endif../*
1cc0: 0a 20 2a 20 44 65 66 69 6e 69 74 69 6f 6e 73 20 . * Definitions
1cd0: 74 68 61 74 20 61 6c 6c 6f 77 20 74 68 69 73 20 that allow this
1ce0: 68 65 61 64 65 72 20 66 69 6c 65 20 74 6f 20 62 header file to b
1cf0: 65 20 75 73 65 64 20 65 69 74 68 65 72 20 77 69 e used either wi
1d00: 74 68 20 6f 72 0a 20 2a 20 77 69 74 68 6f 75 74 th or. * without
1d10: 20 41 4e 53 49 20 43 20 66 65 61 74 75 72 65 73 ANSI C features
1d20: 20 6c 69 6b 65 20 66 75 6e 63 74 69 6f 6e 20 70 like function p
1d30: 72 6f 74 6f 74 79 70 65 73 2e 0a 20 2a 2f 0a 0a rototypes.. */..
1d40: 23 75 6e 64 65 66 20 5f 41 4e 53 49 5f 41 52 47 #undef _ANSI_ARG
1d50: 53 5f 0a 23 75 6e 64 65 66 20 43 4f 4e 53 54 0a S_.#undef CONST.
1d60: 23 69 66 6e 64 65 66 20 49 4e 4c 49 4e 45 0a 23 #ifndef INLINE.#
1d70: 20 20 20 64 65 66 69 6e 65 20 49 4e 4c 49 4e 45 define INLINE
1d80: 0a 23 65 6e 64 69 66 0a 0a 23 69 66 20 28 28 64 .#endif..#if ((d
1d90: 65 66 69 6e 65 64 28 5f 5f 53 54 44 43 5f 5f 29 efined(__STDC__)
1da0: 20 7c 7c 20 64 65 66 69 6e 65 64 28 53 41 42 45 || defined(SABE
1db0: 52 29 29 20 26 26 20 21 64 65 66 69 6e 65 64 28 R)) && !defined(
1dc0: 4e 4f 5f 50 52 4f 54 4f 54 59 50 45 29 29 20 7c NO_PROTOTYPE)) |
1dd0: 7c 20 64 65 66 69 6e 65 64 28 5f 5f 63 70 6c 75 | defined(__cplu
1de0: 73 70 6c 75 73 29 20 7c 7c 20 64 65 66 69 6e 65 splus) || define
1df0: 64 28 55 53 45 5f 50 52 4f 54 4f 54 59 50 45 29 d(USE_PROTOTYPE)
1e00: 0a 23 20 20 20 64 65 66 69 6e 65 20 5f 55 53 49 .# define _USI
1e10: 4e 47 5f 50 52 4f 54 4f 54 59 50 45 53 5f 20 31 NG_PROTOTYPES_ 1
1e20: 0a 23 20 20 20 64 65 66 69 6e 65 20 5f 41 4e 53 .# define _ANS
1e30: 49 5f 41 52 47 53 5f 28 78 29 09 78 0a 23 20 20 I_ARGS_(x).x.#
1e40: 20 64 65 66 69 6e 65 20 43 4f 4e 53 54 20 63 6f define CONST co
1e50: 6e 73 74 0a 23 65 6c 73 65 0a 23 20 20 20 64 65 nst.#else.# de
1e60: 66 69 6e 65 20 5f 41 4e 53 49 5f 41 52 47 53 5f fine _ANSI_ARGS_
1e70: 28 78 29 09 28 29 0a 23 20 20 20 64 65 66 69 6e (x).().# defin
1e80: 65 20 43 4f 4e 53 54 0a 23 65 6e 64 69 66 0a 0a e CONST.#endif..
1e90: 2f 2a 0a 20 2a 20 4d 61 6b 65 20 73 75 72 65 20 /*. * Make sure
1ea0: 45 58 54 45 52 4e 20 69 73 6e 27 74 20 64 65 66 EXTERN isn't def
1eb0: 69 6e 65 64 20 65 6c 73 65 77 68 65 72 65 0a 20 ined elsewhere.
1ec0: 2a 2f 0a 23 69 66 64 65 66 20 45 58 54 45 52 4e */.#ifdef EXTERN
1ed0: 0a 23 75 6e 64 65 66 20 45 58 54 45 52 4e 0a 23 .#undef EXTERN.#
1ee0: 65 6e 64 69 66 20 2f 2a 20 45 58 54 45 52 4e 20 endif /* EXTERN
1ef0: 2a 2f 0a 0a 23 69 66 64 65 66 20 5f 5f 63 70 6c */..#ifdef __cpl
1f00: 75 73 70 6c 75 73 0a 23 20 20 20 64 65 66 69 6e usplus.# defin
1f10: 65 20 48 45 41 44 5f 45 58 54 45 52 4e 20 65 78 e HEAD_EXTERN ex
1f20: 74 65 72 6e 20 22 43 22 0a 23 65 6c 73 65 0a 23 tern "C".#else.#
1f30: 20 20 20 64 65 66 69 6e 65 20 48 45 41 44 5f 45 define HEAD_E
1f40: 58 54 45 52 4e 20 65 78 74 65 72 6e 0a 23 65 6e XTERN extern.#en
1f50: 64 69 66 0a 0a 23 64 65 66 69 6e 65 20 45 58 54 dif..#define EXT
1f60: 45 52 4e 20 48 45 41 44 5f 45 58 54 45 52 4e 20 ERN HEAD_EXTERN
1f70: 54 43 4c 5f 53 54 4f 52 41 47 45 5f 43 4c 41 53 TCL_STORAGE_CLAS
1f80: 53 0a 0a 2f 2a 0a 20 2a 20 4d 61 63 72 6f 20 74 S../*. * Macro t
1f90: 6f 20 75 73 65 20 69 6e 73 74 65 61 64 20 6f 66 o use instead of
1fa0: 20 22 76 6f 69 64 22 20 66 6f 72 20 61 72 67 75 "void" for argu
1fb0: 6d 65 6e 74 73 20 74 68 61 74 20 6d 75 73 74 20 ments that must
1fc0: 68 61 76 65 0a 20 2a 20 74 79 70 65 20 22 76 6f have. * type "vo
1fd0: 69 64 20 2a 22 20 69 6e 20 41 4e 53 49 20 43 3b id *" in ANSI C;
1fe0: 20 20 6d 61 70 73 20 74 68 65 6d 20 74 6f 20 74 maps them to t
1ff0: 79 70 65 20 22 63 68 61 72 20 2a 22 20 69 6e 0a ype "char *" in.
2000: 20 2a 20 6e 6f 6e 2d 41 4e 53 49 20 73 79 73 74 * non-ANSI syst
2010: 65 6d 73 2e 0a 20 2a 2f 0a 23 69 66 6e 64 65 66 ems.. */.#ifndef
2020: 20 5f 5f 57 49 4e 33 32 5f 5f 0a 23 69 66 6e 64 __WIN32__.#ifnd
2030: 65 66 20 56 4f 49 44 0a 23 20 20 20 69 66 64 65 ef VOID.# ifde
2040: 66 20 5f 5f 53 54 44 43 5f 5f 0a 23 20 20 20 20 f __STDC__.#
2050: 20 20 20 64 65 66 69 6e 65 20 56 4f 49 44 20 76 define VOID v
2060: 6f 69 64 0a 23 20 20 20 65 6c 73 65 0a 23 20 20 oid.# else.#
2070: 20 20 20 20 20 64 65 66 69 6e 65 20 56 4f 49 44 define VOID
2080: 20 63 68 61 72 0a 23 20 20 20 65 6e 64 69 66 0a char.# endif.
2090: 23 65 6e 64 69 66 0a 23 65 6c 73 65 20 2f 2a 20 #endif.#else /*
20a0: 5f 5f 57 49 4e 33 32 5f 5f 20 2a 2f 0a 2f 2a 0a __WIN32__ */./*.
20b0: 20 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 * The following
20c0: 20 63 6f 64 65 20 69 73 20 63 6f 70 69 65 64 20 code is copied
20d0: 66 72 6f 6d 20 77 69 6e 6e 74 2e 68 0a 20 2a 2f from winnt.h. */
20e0: 0a 23 69 66 6e 64 65 66 20 56 4f 49 44 0a 23 64 .#ifndef VOID.#d
20f0: 65 66 69 6e 65 20 56 4f 49 44 20 76 6f 69 64 0a efine VOID void.
2100: 74 79 70 65 64 65 66 20 63 68 61 72 20 43 48 41 typedef char CHA
2110: 52 3b 0a 74 79 70 65 64 65 66 20 73 68 6f 72 74 R;.typedef short
2120: 20 53 48 4f 52 54 3b 0a 74 79 70 65 64 65 66 20 SHORT;.typedef
2130: 6c 6f 6e 67 20 4c 4f 4e 47 3b 0a 23 65 6e 64 69 long LONG;.#endi
2140: 66 0a 23 65 6e 64 69 66 20 2f 2a 20 5f 5f 57 49 f.#endif /* __WI
2150: 4e 33 32 5f 5f 20 2a 2f 0a 0a 2f 2a 0a 20 2a 20 N32__ */../*. *
2160: 4d 69 73 63 65 6c 6c 61 6e 65 6f 75 73 20 64 65 Miscellaneous de
2170: 63 6c 61 72 61 74 69 6f 6e 73 2e 0a 20 2a 2f 0a clarations.. */.
2180: 0a 23 69 66 6e 64 65 66 20 4e 55 4c 4c 0a 23 64 .#ifndef NULL.#d
2190: 65 66 69 6e 65 20 4e 55 4c 4c 20 30 0a 23 65 6e efine NULL 0.#en
21a0: 64 69 66 0a 0a 23 69 66 6e 64 65 66 20 5f 43 4c dif..#ifndef _CL
21b0: 49 45 4e 54 44 41 54 41 0a 23 20 20 20 69 66 20 IENTDATA.# if
21c0: 64 65 66 69 6e 65 64 28 5f 5f 53 54 44 43 5f 5f defined(__STDC__
21d0: 29 20 7c 7c 20 64 65 66 69 6e 65 64 28 5f 5f 63 ) || defined(__c
21e0: 70 6c 75 73 70 6c 75 73 29 0a 20 20 20 20 74 79 plusplus). ty
21f0: 70 65 64 65 66 20 76 6f 69 64 20 2a 43 6c 69 65 pedef void *Clie
2200: 6e 74 44 61 74 61 3b 0a 23 20 20 20 65 6c 73 65 ntData;.# else
2210: 0a 20 20 20 20 74 79 70 65 64 65 66 20 69 6e 74 . typedef int
2220: 20 2a 43 6c 69 65 6e 74 44 61 74 61 3b 0a 23 20 *ClientData;.#
2230: 20 20 65 6e 64 69 66 20 2f 2a 20 5f 5f 53 54 44 endif /* __STD
2240: 43 5f 5f 20 2a 2f 0a 23 64 65 66 69 6e 65 20 5f C__ */.#define _
2250: 43 4c 49 45 4e 54 44 41 54 41 0a 23 65 6e 64 69 CLIENTDATA.#endi
2260: 66 0a 0a 2f 2a 0a 20 2a 20 44 61 74 61 20 73 74 f../*. * Data st
2270: 72 75 63 74 75 72 65 73 20 64 65 66 69 6e 65 64 ructures defined
2280: 20 6f 70 61 71 75 65 6c 79 20 69 6e 20 74 68 69 opaquely in thi
2290: 73 20 6d 6f 64 75 6c 65 2e 20 54 68 65 20 64 65 s module. The de
22a0: 66 69 6e 69 74 69 6f 6e 73 20 62 65 6c 6f 77 0a finitions below.
22b0: 20 2a 20 6a 75 73 74 20 70 72 6f 76 69 64 65 20 * just provide
22c0: 64 75 6d 6d 79 20 74 79 70 65 73 2e 20 41 20 66 dummy types. A f
22d0: 65 77 20 66 69 65 6c 64 73 20 61 72 65 20 6d 61 ew fields are ma
22e0: 64 65 20 76 69 73 69 62 6c 65 20 69 6e 20 54 63 de visible in Tc
22f0: 6c 5f 49 6e 74 65 72 70 0a 20 2a 20 73 74 72 75 l_Interp. * stru
2300: 63 74 75 72 65 73 2c 20 6e 61 6d 65 6c 79 20 74 ctures, namely t
2310: 68 6f 73 65 20 75 73 65 64 20 66 6f 72 20 72 65 hose used for re
2320: 74 75 72 6e 69 6e 67 20 61 20 73 74 72 69 6e 67 turning a string
2330: 20 72 65 73 75 6c 74 20 66 72 6f 6d 0a 20 2a 20 result from. *
2340: 63 6f 6d 6d 61 6e 64 73 2e 20 44 69 72 65 63 74 commands. Direct
2350: 20 61 63 63 65 73 73 20 74 6f 20 74 68 65 20 72 access to the r
2360: 65 73 75 6c 74 20 66 69 65 6c 64 20 69 73 20 64 esult field is d
2370: 69 73 63 6f 75 72 61 67 65 64 20 69 6e 20 54 63 iscouraged in Tc
2380: 6c 20 38 2e 30 2e 0a 20 2a 20 54 68 65 20 69 6e l 8.0.. * The in
2390: 74 65 72 70 72 65 74 65 72 20 72 65 73 75 6c 74 terpreter result
23a0: 20 69 73 20 65 69 74 68 65 72 20 61 6e 20 6f 62 is either an ob
23b0: 6a 65 63 74 20 6f 72 20 61 20 73 74 72 69 6e 67 ject or a string
23c0: 2c 20 61 6e 64 20 74 68 65 20 74 77 6f 0a 20 2a , and the two. *
23d0: 20 76 61 6c 75 65 73 20 61 72 65 20 6b 65 70 74 values are kept
23e0: 20 63 6f 6e 73 69 73 74 65 6e 74 20 75 6e 6c 65 consistent unle
23f0: 73 73 20 73 6f 6d 65 20 43 20 63 6f 64 65 20 73 ss some C code s
2400: 65 74 73 20 69 6e 74 65 72 70 2d 3e 72 65 73 75 ets interp->resu
2410: 6c 74 0a 20 2a 20 64 69 72 65 63 74 6c 79 2e 20 lt. * directly.
2420: 50 72 6f 67 72 61 6d 6d 65 72 73 20 73 68 6f 75 Programmers shou
2430: 6c 64 20 75 73 65 20 65 69 74 68 65 72 20 74 68 ld use either th
2440: 65 20 70 72 6f 63 65 64 75 72 65 20 54 63 6c 5f e procedure Tcl_
2450: 47 65 74 4f 62 6a 52 65 73 75 6c 74 28 29 0a 20 GetObjResult().
2460: 2a 20 6f 72 20 54 63 6c 5f 47 65 74 53 74 72 69 * or Tcl_GetStri
2470: 6e 67 52 65 73 75 6c 74 28 29 20 74 6f 20 72 65 ngResult() to re
2480: 61 64 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 ad the interpret
2490: 65 72 27 73 20 72 65 73 75 6c 74 2e 20 53 65 65 er's result. See
24a0: 20 74 68 65 0a 20 2a 20 53 65 74 52 65 73 75 6c the. * SetResul
24b0: 74 20 6d 61 6e 20 70 61 67 65 20 66 6f 72 20 64 t man page for d
24c0: 65 74 61 69 6c 73 2e 0a 20 2a 20 0a 20 2a 20 4e etails.. * . * N
24d0: 6f 74 65 3a 20 61 6e 79 20 63 68 61 6e 67 65 20 ote: any change
24e0: 74 6f 20 74 68 65 20 54 63 6c 5f 49 6e 74 65 72 to the Tcl_Inter
24f0: 70 20 64 65 66 69 6e 69 74 69 6f 6e 20 62 65 6c p definition bel
2500: 6f 77 20 6d 75 73 74 20 62 65 20 6d 69 72 72 6f ow must be mirro
2510: 72 65 64 0a 20 2a 20 69 6e 20 74 68 65 20 22 72 red. * in the "r
2520: 65 61 6c 22 20 64 65 66 69 6e 69 74 69 6f 6e 20 eal" definition
2530: 69 6e 20 74 63 6c 49 6e 74 2e 68 2e 0a 20 2a 0a in tclInt.h.. *.
2540: 20 2a 20 4e 6f 74 65 3a 20 54 63 6c 5f 4f 62 6a * Note: Tcl_Obj
2550: 43 6d 64 50 72 6f 63 20 70 72 6f 63 65 64 75 72 CmdProc procedur
2560: 65 73 20 64 6f 20 6e 6f 74 20 64 69 72 65 63 74 es do not direct
2570: 6c 79 20 73 65 74 20 72 65 73 75 6c 74 20 61 6e ly set result an
2580: 64 20 66 72 65 65 50 72 6f 63 2e 0a 20 2a 20 49 d freeProc.. * I
2590: 6e 73 74 65 61 64 2c 20 74 68 65 79 20 73 65 74 nstead, they set
25a0: 20 61 20 54 63 6c 5f 4f 62 6a 20 6d 65 6d 62 65 a Tcl_Obj membe
25b0: 72 20 69 6e 20 74 68 65 20 22 72 65 61 6c 22 20 r in the "real"
25c0: 73 74 72 75 63 74 75 72 65 20 74 68 61 74 20 63 structure that c
25d0: 61 6e 20 62 65 0a 20 2a 20 61 63 63 65 73 73 65 an be. * accesse
25e0: 64 20 77 69 74 68 20 54 63 6c 5f 47 65 74 4f 62 d with Tcl_GetOb
25f0: 6a 52 65 73 75 6c 74 28 29 20 61 6e 64 20 54 63 jResult() and Tc
2600: 6c 5f 53 65 74 4f 62 6a 52 65 73 75 6c 74 28 29 l_SetObjResult()
2610: 2e 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 73 .. */..typedef s
2620: 74 72 75 63 74 20 54 63 6c 5f 49 6e 74 65 72 70 truct Tcl_Interp
2630: 20 7b 0a 20 20 20 20 63 68 61 72 20 2a 72 65 73 {. char *res
2640: 75 6c 74 3b 09 09 2f 2a 20 49 66 20 74 68 65 20 ult;../* If the
2650: 6c 61 73 74 20 63 6f 6d 6d 61 6e 64 20 72 65 74 last command ret
2660: 75 72 6e 65 64 20 61 20 73 74 72 69 6e 67 0a 09 urned a string..
2670: 09 09 09 20 2a 20 72 65 73 75 6c 74 2c 20 74 68 ... * result, th
2680: 69 73 20 70 6f 69 6e 74 73 20 74 6f 20 69 74 2e is points to it.
2690: 20 2a 2f 0a 20 20 20 20 76 6f 69 64 20 28 2a 66 */. void (*f
26a0: 72 65 65 50 72 6f 63 29 20 5f 41 4e 53 49 5f 41 reeProc) _ANSI_A
26b0: 52 47 53 5f 28 28 63 68 61 72 20 2a 62 6c 6f 63 RGS_((char *bloc
26c0: 6b 50 74 72 29 29 3b 0a 09 09 09 09 2f 2a 20 5a kPtr));...../* Z
26d0: 65 72 6f 20 6d 65 61 6e 73 20 74 68 65 20 73 74 ero means the st
26e0: 72 69 6e 67 20 72 65 73 75 6c 74 20 69 73 0a 09 ring result is..
26f0: 09 09 09 20 2a 20 73 74 61 74 69 63 61 6c 6c 79 ... * statically
2700: 20 61 6c 6c 6f 63 61 74 65 64 2e 20 54 43 4c 5f allocated. TCL_
2710: 44 59 4e 41 4d 49 43 20 6d 65 61 6e 73 0a 09 09 DYNAMIC means...
2720: 09 09 20 2a 20 69 74 20 77 61 73 20 61 6c 6c 6f .. * it was allo
2730: 63 61 74 65 64 20 77 69 74 68 20 63 6b 61 6c 6c cated with ckall
2740: 6f 63 20 61 6e 64 20 73 68 6f 75 6c 64 0a 09 09 oc and should...
2750: 09 09 20 2a 20 62 65 20 66 72 65 65 64 20 77 69 .. * be freed wi
2760: 74 68 20 63 6b 66 72 65 65 2e 20 4f 74 68 65 72 th ckfree. Other
2770: 20 76 61 6c 75 65 73 20 67 69 76 65 0a 09 09 09 values give....
2780: 09 20 2a 20 74 68 65 20 61 64 64 72 65 73 73 20 . * the address
2790: 6f 66 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 of procedure to
27a0: 69 6e 76 6f 6b 65 20 74 6f 0a 09 09 09 09 20 2a invoke to..... *
27b0: 20 66 72 65 65 20 74 68 65 20 72 65 73 75 6c 74 free the result
27c0: 2e 20 54 63 6c 5f 45 76 61 6c 20 6d 75 73 74 20 . Tcl_Eval must
27d0: 66 72 65 65 20 69 74 0a 09 09 09 09 20 2a 20 62 free it..... * b
27e0: 65 66 6f 72 65 20 65 78 65 63 75 74 69 6e 67 20 efore executing
27f0: 6e 65 78 74 20 63 6f 6d 6d 61 6e 64 2e 20 2a 2f next command. */
2800: 0a 20 20 20 20 69 6e 74 20 65 72 72 6f 72 4c 69 . int errorLi
2810: 6e 65 3b 20 20 20 20 20 20 20 20 20 20 20 20 20 ne;
2820: 20 2f 2a 20 57 68 65 6e 20 54 43 4c 5f 45 52 52 /* When TCL_ERR
2830: 4f 52 20 69 73 20 72 65 74 75 72 6e 65 64 2c 20 OR is returned,
2840: 74 68 69 73 20 67 69 76 65 73 0a 20 20 20 20 20 this gives.
2850: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
2860: 20 20 20 20 20 20 20 20 20 20 20 20 2a 20 74 68 * th
2870: 65 20 6c 69 6e 65 20 6e 75 6d 62 65 72 20 77 69 e line number wi
2880: 74 68 69 6e 20 74 68 65 20 63 6f 6d 6d 61 6e 64 thin the command
2890: 20 77 68 65 72 65 0a 20 20 20 20 20 20 20 20 20 where.
28a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
28b0: 20 20 20 20 20 20 20 20 2a 20 74 68 65 20 65 72 * the er
28c0: 72 6f 72 20 6f 63 63 75 72 72 65 64 20 28 31 20 ror occurred (1
28d0: 69 66 20 66 69 72 73 74 20 6c 69 6e 65 29 2e 20 if first line).
28e0: 2a 2f 0a 7d 20 54 63 6c 5f 49 6e 74 65 72 70 3b */.} Tcl_Interp;
28f0: 0a 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 74 ..typedef struct
2900: 20 54 63 6c 5f 41 73 79 6e 63 48 61 6e 64 6c 65 Tcl_AsyncHandle
2910: 72 5f 20 2a 54 63 6c 5f 41 73 79 6e 63 48 61 6e r_ *Tcl_AsyncHan
2920: 64 6c 65 72 3b 0a 74 79 70 65 64 65 66 20 73 74 dler;.typedef st
2930: 72 75 63 74 20 54 63 6c 5f 43 68 61 6e 6e 65 6c ruct Tcl_Channel
2940: 5f 20 2a 54 63 6c 5f 43 68 61 6e 6e 65 6c 3b 0a _ *Tcl_Channel;.
2950: 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20 54 typedef struct T
2960: 63 6c 5f 43 6f 6d 6d 61 6e 64 5f 20 2a 54 63 6c cl_Command_ *Tcl
2970: 5f 43 6f 6d 6d 61 6e 64 3b 0a 74 79 70 65 64 65 _Command;.typede
2980: 66 20 73 74 72 75 63 74 20 54 63 6c 5f 43 6f 6e f struct Tcl_Con
2990: 64 69 74 69 6f 6e 5f 20 2a 54 63 6c 5f 43 6f 6e dition_ *Tcl_Con
29a0: 64 69 74 69 6f 6e 3b 0a 74 79 70 65 64 65 66 20 dition;.typedef
29b0: 73 74 72 75 63 74 20 54 63 6c 5f 45 6e 63 6f 64 struct Tcl_Encod
29c0: 69 6e 67 53 74 61 74 65 5f 20 2a 54 63 6c 5f 45 ingState_ *Tcl_E
29d0: 6e 63 6f 64 69 6e 67 53 74 61 74 65 3b 0a 74 79 ncodingState;.ty
29e0: 70 65 64 65 66 20 73 74 72 75 63 74 20 54 63 6c pedef struct Tcl
29f0: 5f 45 6e 63 6f 64 69 6e 67 5f 20 2a 54 63 6c 5f _Encoding_ *Tcl_
2a00: 45 6e 63 6f 64 69 6e 67 3b 0a 74 79 70 65 64 65 Encoding;.typede
2a10: 66 20 73 74 72 75 63 74 20 54 63 6c 5f 45 76 65 f struct Tcl_Eve
2a20: 6e 74 20 54 63 6c 5f 45 76 65 6e 74 3b 0a 74 79 nt Tcl_Event;.ty
2a30: 70 65 64 65 66 20 73 74 72 75 63 74 20 54 63 6c pedef struct Tcl
2a40: 5f 4d 75 74 65 78 5f 20 2a 54 63 6c 5f 4d 75 74 _Mutex_ *Tcl_Mut
2a50: 65 78 3b 0a 74 79 70 65 64 65 66 20 73 74 72 75 ex;.typedef stru
2a60: 63 74 20 54 63 6c 5f 50 69 64 5f 20 2a 54 63 6c ct Tcl_Pid_ *Tcl
2a70: 5f 50 69 64 3b 0a 74 79 70 65 64 65 66 20 73 74 _Pid;.typedef st
2a80: 72 75 63 74 20 54 63 6c 5f 52 65 67 45 78 70 5f ruct Tcl_RegExp_
2a90: 20 2a 54 63 6c 5f 52 65 67 45 78 70 3b 0a 74 79 *Tcl_RegExp;.ty
2aa0: 70 65 64 65 66 20 73 74 72 75 63 74 20 54 63 6c pedef struct Tcl
2ab0: 5f 54 68 72 65 61 64 44 61 74 61 4b 65 79 5f 20 _ThreadDataKey_
2ac0: 2a 54 63 6c 5f 54 68 72 65 61 64 44 61 74 61 4b *Tcl_ThreadDataK
2ad0: 65 79 3b 0a 74 79 70 65 64 65 66 20 73 74 72 75 ey;.typedef stru
2ae0: 63 74 20 54 63 6c 5f 54 68 72 65 61 64 49 64 5f ct Tcl_ThreadId_
2af0: 20 2a 54 63 6c 5f 54 68 72 65 61 64 49 64 3b 0a *Tcl_ThreadId;.
2b00: 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20 54 typedef struct T
2b10: 63 6c 5f 54 69 6d 65 72 54 6f 6b 65 6e 5f 20 2a cl_TimerToken_ *
2b20: 54 63 6c 5f 54 69 6d 65 72 54 6f 6b 65 6e 3b 0a Tcl_TimerToken;.
2b30: 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20 54 typedef struct T
2b40: 63 6c 5f 54 72 61 63 65 5f 20 2a 54 63 6c 5f 54 cl_Trace_ *Tcl_T
2b50: 72 61 63 65 3b 0a 74 79 70 65 64 65 66 20 73 74 race;.typedef st
2b60: 72 75 63 74 20 54 63 6c 5f 56 61 72 5f 20 2a 54 ruct Tcl_Var_ *T
2b70: 63 6c 5f 56 61 72 3b 0a 74 79 70 65 64 65 66 20 cl_Var;.typedef
2b80: 73 74 72 75 63 74 20 54 63 6c 5f 43 68 61 6e 6e struct Tcl_Chann
2b90: 65 6c 54 79 70 65 56 65 72 73 69 6f 6e 5f 20 2a elTypeVersion_ *
2ba0: 54 63 6c 5f 43 68 61 6e 6e 65 6c 54 79 70 65 56 Tcl_ChannelTypeV
2bb0: 65 72 73 69 6f 6e 3b 0a 0a 2f 2a 0a 20 2a 20 44 ersion;../*. * D
2bc0: 65 66 69 6e 69 74 69 6f 6e 20 6f 66 20 74 68 65 efinition of the
2bd0: 20 69 6e 74 65 72 66 61 63 65 20 74 6f 20 70 72 interface to pr
2be0: 6f 63 65 64 75 72 65 73 20 69 6d 70 6c 65 6d 65 ocedures impleme
2bf0: 6e 74 69 6e 67 20 74 68 72 65 61 64 73 2e 0a 20 nting threads..
2c00: 2a 20 41 20 70 72 6f 63 65 64 75 72 65 20 66 6f * A procedure fo
2c10: 6c 6c 6f 77 69 6e 67 20 74 68 69 73 20 64 65 66 llowing this def
2c20: 69 6e 69 74 69 6f 6e 20 69 73 20 67 69 76 65 6e inition is given
2c30: 20 74 6f 20 65 61 63 68 20 63 61 6c 6c 20 6f 66 to each call of
2c40: 0a 20 2a 20 27 54 63 6c 5f 43 72 65 61 74 65 54 . * 'Tcl_CreateT
2c50: 68 72 65 61 64 27 20 61 6e 64 20 77 69 6c 6c 20 hread' and will
2c60: 62 65 20 63 61 6c 6c 65 64 20 61 73 20 74 68 65 be called as the
2c70: 20 6d 61 69 6e 20 66 75 63 74 69 6f 6e 20 6f 66 main fuction of
2c80: 0a 20 2a 20 74 68 65 20 6e 65 77 20 74 68 72 65 . * the new thre
2c90: 61 64 20 63 72 65 61 74 65 64 20 62 79 20 74 68 ad created by th
2ca0: 61 74 20 63 61 6c 6c 2e 0a 20 2a 2f 0a 0a 23 69 at call.. */..#i
2cb0: 66 64 65 66 20 4d 41 43 5f 54 43 4c 0a 74 79 70 fdef MAC_TCL.typ
2cc0: 65 64 65 66 20 70 61 73 63 61 6c 20 76 6f 69 64 edef pascal void
2cd0: 20 2a 28 54 63 6c 5f 54 68 72 65 61 64 43 72 65 *(Tcl_ThreadCre
2ce0: 61 74 65 50 72 6f 63 29 20 5f 41 4e 53 49 5f 41 ateProc) _ANSI_A
2cf0: 52 47 53 5f 28 28 43 6c 69 65 6e 74 44 61 74 61 RGS_((ClientData
2d00: 20 63 6c 69 65 6e 74 44 61 74 61 29 29 3b 0a 23 clientData));.#
2d10: 65 6c 69 66 20 64 65 66 69 6e 65 64 20 5f 5f 57 elif defined __W
2d20: 49 4e 33 32 5f 5f 0a 74 79 70 65 64 65 66 20 75 IN32__.typedef u
2d30: 6e 73 69 67 6e 65 64 20 28 5f 5f 73 74 64 63 61 nsigned (__stdca
2d40: 6c 6c 20 54 63 6c 5f 54 68 72 65 61 64 43 72 65 ll Tcl_ThreadCre
2d50: 61 74 65 50 72 6f 63 29 20 5f 41 4e 53 49 5f 41 ateProc) _ANSI_A
2d60: 52 47 53 5f 28 28 43 6c 69 65 6e 74 44 61 74 61 RGS_((ClientData
2d70: 20 63 6c 69 65 6e 74 44 61 74 61 29 29 3b 0a 23 clientData));.#
2d80: 65 6c 73 65 0a 74 79 70 65 64 65 66 20 76 6f 69 else.typedef voi
2d90: 64 20 28 54 63 6c 5f 54 68 72 65 61 64 43 72 65 d (Tcl_ThreadCre
2da0: 61 74 65 50 72 6f 63 29 20 5f 41 4e 53 49 5f 41 ateProc) _ANSI_A
2db0: 52 47 53 5f 28 28 43 6c 69 65 6e 74 44 61 74 61 RGS_((ClientData
2dc0: 20 63 6c 69 65 6e 74 44 61 74 61 29 29 3b 0a 23 clientData));.#
2dd0: 65 6e 64 69 66 0a 0a 0a 2f 2a 0a 20 2a 20 54 68 endif.../*. * Th
2de0: 72 65 61 64 69 6e 67 20 66 75 6e 63 74 69 6f 6e reading function
2df0: 20 72 65 74 75 72 6e 20 74 79 70 65 73 20 75 73 return types us
2e00: 65 64 20 66 6f 72 20 61 62 73 74 72 61 63 74 69 ed for abstracti
2e10: 6e 67 20 61 77 61 79 20 70 6c 61 74 66 6f 72 6d ng away platform
2e20: 0a 20 2a 20 64 69 66 66 65 72 65 6e 63 65 73 20 . * differences
2e30: 77 68 65 6e 20 77 72 69 74 69 6e 67 20 61 20 54 when writing a T
2e40: 63 6c 5f 54 68 72 65 61 64 43 72 65 61 74 65 50 cl_ThreadCreateP
2e50: 72 6f 63 2e 20 20 53 65 65 20 74 68 65 20 4e 65 roc. See the Ne
2e60: 77 54 68 72 65 61 64 0a 20 2a 20 66 75 6e 63 74 wThread. * funct
2e70: 69 6f 6e 20 69 6e 20 67 65 6e 65 72 69 63 2f 74 ion in generic/t
2e80: 63 6c 54 68 72 65 61 64 54 65 73 74 2e 63 20 66 clThreadTest.c f
2e90: 6f 72 20 69 74 27 73 20 75 73 61 67 65 2e 0a 20 or it's usage..
2ea0: 2a 2f 0a 23 69 66 64 65 66 20 4d 41 43 5f 54 43 */.#ifdef MAC_TC
2eb0: 4c 0a 23 20 20 20 64 65 66 69 6e 65 20 54 63 6c L.# define Tcl
2ec0: 5f 54 68 72 65 61 64 43 72 65 61 74 65 54 79 70 _ThreadCreateTyp
2ed0: 65 09 09 70 61 73 63 61 6c 20 76 6f 69 64 20 2a e..pascal void *
2ee0: 0a 23 20 20 20 64 65 66 69 6e 65 20 54 43 4c 5f .# define TCL_
2ef0: 54 48 52 45 41 44 5f 43 52 45 41 54 45 5f 52 45 THREAD_CREATE_RE
2f00: 54 55 52 4e 09 72 65 74 75 72 6e 20 4e 55 4c 4c TURN.return NULL
2f10: 0a 23 65 6c 69 66 20 64 65 66 69 6e 65 64 20 5f .#elif defined _
2f20: 5f 57 49 4e 33 32 5f 5f 0a 23 20 20 20 64 65 66 _WIN32__.# def
2f30: 69 6e 65 20 54 63 6c 5f 54 68 72 65 61 64 43 72 ine Tcl_ThreadCr
2f40: 65 61 74 65 54 79 70 65 09 09 75 6e 73 69 67 6e eateType..unsign
2f50: 65 64 20 5f 5f 73 74 64 63 61 6c 6c 0a 23 20 20 ed __stdcall.#
2f60: 20 64 65 66 69 6e 65 20 54 43 4c 5f 54 48 52 45 define TCL_THRE
2f70: 41 44 5f 43 52 45 41 54 45 5f 52 45 54 55 52 4e AD_CREATE_RETURN
2f80: 09 72 65 74 75 72 6e 20 30 0a 23 65 6c 73 65 0a .return 0.#else.
2f90: 23 20 20 20 64 65 66 69 6e 65 20 54 63 6c 5f 54 # define Tcl_T
2fa0: 68 72 65 61 64 43 72 65 61 74 65 54 79 70 65 09 hreadCreateType.
2fb0: 09 76 6f 69 64 0a 23 20 20 20 64 65 66 69 6e 65 .void.# define
2fc0: 20 54 43 4c 5f 54 48 52 45 41 44 5f 43 52 45 41 TCL_THREAD_CREA
2fd0: 54 45 5f 52 45 54 55 52 4e 09 0a 23 65 6e 64 69 TE_RETURN..#endi
2fe0: 66 0a 0a 0a 0a 2f 2a 0a 20 2a 20 44 65 66 69 6e f..../*. * Defin
2ff0: 69 74 69 6f 6e 20 6f 66 20 76 61 6c 75 65 73 20 ition of values
3000: 66 6f 72 20 64 65 66 61 75 6c 74 20 73 74 61 63 for default stac
3010: 6b 73 69 7a 65 20 61 6e 64 20 74 68 65 20 70 6f ksize and the po
3020: 73 73 69 62 6c 65 20 66 6c 61 67 73 20 74 6f 20 ssible flags to
3030: 62 65 0a 20 2a 20 67 69 76 65 6e 20 74 6f 20 54 be. * given to T
3040: 63 6c 5f 43 72 65 61 74 65 54 68 72 65 61 64 2e cl_CreateThread.
3050: 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 . */..#define TC
3060: 4c 5f 54 48 52 45 41 44 5f 53 54 41 43 4b 5f 44 L_THREAD_STACK_D
3070: 45 46 41 55 4c 54 20 28 30 29 20 20 20 20 2f 2a EFAULT (0) /*
3080: 20 55 73 65 20 64 65 66 61 75 6c 74 20 73 69 7a Use default siz
3090: 65 20 66 6f 72 20 73 74 61 63 6b 20 2a 2f 0a 23 e for stack */.#
30a0: 64 65 66 69 6e 65 20 54 43 4c 5f 54 48 52 45 41 define TCL_THREA
30b0: 44 5f 4e 4f 46 4c 41 47 53 20 20 20 20 20 20 20 D_NOFLAGS
30c0: 28 30 30 30 30 29 20 2f 2a 20 53 74 61 6e 64 61 (0000) /* Standa
30d0: 72 64 20 66 6c 61 67 73 2c 20 64 65 66 61 75 6c rd flags, defaul
30e0: 74 20 62 65 68 61 76 69 6f 75 72 20 2a 2f 0a 23 t behaviour */.#
30f0: 64 65 66 69 6e 65 20 54 43 4c 5f 54 48 52 45 41 define TCL_THREA
3100: 44 5f 4a 4f 49 4e 41 42 4c 45 20 20 20 20 20 20 D_JOINABLE
3110: 28 30 30 30 31 29 20 2f 2a 20 4d 61 72 6b 20 74 (0001) /* Mark t
3120: 68 65 20 74 68 72 65 61 64 20 61 73 20 6a 6f 69 he thread as joi
3130: 6e 61 62 6c 65 20 2a 2f 0a 0a 2f 2a 0a 20 2a 20 nable */../*. *
3140: 46 6c 61 67 20 76 61 6c 75 65 73 20 70 61 73 73 Flag values pass
3150: 65 64 20 74 6f 20 54 63 6c 5f 47 65 74 52 65 67 ed to Tcl_GetReg
3160: 45 78 70 46 72 6f 6d 4f 62 6a 2e 0a 20 2a 2f 0a ExpFromObj.. */.
3170: 0a 23 64 65 66 69 6e 65 09 54 43 4c 5f 52 45 47 .#define.TCL_REG
3180: 5f 42 41 53 49 43 09 09 30 30 30 30 30 30 09 2f _BASIC..000000./
3190: 2a 20 42 52 45 73 20 28 63 6f 6e 76 65 6e 69 65 * BREs (convenie
31a0: 6e 63 65 29 20 2a 2f 0a 23 64 65 66 69 6e 65 09 nce) */.#define.
31b0: 54 43 4c 5f 52 45 47 5f 45 58 54 45 4e 44 45 44 TCL_REG_EXTENDED
31c0: 09 30 30 30 30 30 31 09 2f 2a 20 45 52 45 73 20 .000001./* EREs
31d0: 2a 2f 0a 23 64 65 66 69 6e 65 09 54 43 4c 5f 52 */.#define.TCL_R
31e0: 45 47 5f 41 44 56 46 09 09 30 30 30 30 30 32 09 EG_ADVF..000002.
31f0: 2f 2a 20 61 64 76 61 6e 63 65 64 20 66 65 61 74 /* advanced feat
3200: 75 72 65 73 20 69 6e 20 45 52 45 73 20 2a 2f 0a ures in EREs */.
3210: 23 64 65 66 69 6e 65 09 54 43 4c 5f 52 45 47 5f #define.TCL_REG_
3220: 41 44 56 41 4e 43 45 44 09 30 30 30 30 30 33 09 ADVANCED.000003.
3230: 2f 2a 20 41 52 45 73 20 28 77 68 69 63 68 20 61 /* AREs (which a
3240: 72 65 20 61 6c 73 6f 20 45 52 45 73 29 20 2a 2f re also EREs) */
3250: 0a 23 64 65 66 69 6e 65 09 54 43 4c 5f 52 45 47 .#define.TCL_REG
3260: 5f 51 55 4f 54 45 09 09 30 30 30 30 30 34 09 2f _QUOTE..000004./
3270: 2a 20 6e 6f 20 73 70 65 63 69 61 6c 20 63 68 61 * no special cha
3280: 72 61 63 74 65 72 73 2c 20 6e 6f 6e 65 20 2a 2f racters, none */
3290: 0a 23 64 65 66 69 6e 65 09 54 43 4c 5f 52 45 47 .#define.TCL_REG
32a0: 5f 4e 4f 43 41 53 45 09 09 30 30 30 30 31 30 09 _NOCASE..000010.
32b0: 2f 2a 20 69 67 6e 6f 72 65 20 63 61 73 65 20 2a /* ignore case *
32c0: 2f 0a 23 64 65 66 69 6e 65 09 54 43 4c 5f 52 45 /.#define.TCL_RE
32d0: 47 5f 4e 4f 53 55 42 09 09 30 30 30 30 32 30 09 G_NOSUB..000020.
32e0: 2f 2a 20 64 6f 6e 27 74 20 63 61 72 65 20 61 62 /* don't care ab
32f0: 6f 75 74 20 73 75 62 65 78 70 72 65 73 73 69 6f out subexpressio
3300: 6e 73 20 2a 2f 0a 23 64 65 66 69 6e 65 09 54 43 ns */.#define.TC
3310: 4c 5f 52 45 47 5f 45 58 50 41 4e 44 45 44 09 30 L_REG_EXPANDED.0
3320: 30 30 30 34 30 09 2f 2a 20 65 78 70 61 6e 64 65 00040./* expande
3330: 64 20 66 6f 72 6d 61 74 2c 20 77 68 69 74 65 20 d format, white
3340: 73 70 61 63 65 20 26 0a 09 09 09 09 09 20 2a 20 space &...... *
3350: 63 6f 6d 6d 65 6e 74 73 20 2a 2f 0a 23 64 65 66 comments */.#def
3360: 69 6e 65 09 54 43 4c 5f 52 45 47 5f 4e 4c 53 54 ine.TCL_REG_NLST
3370: 4f 50 09 09 30 30 30 31 30 30 20 20 2f 2a 20 5c OP..000100 /* \
3380: 6e 20 64 6f 65 73 6e 27 74 20 6d 61 74 63 68 20 n doesn't match
3390: 2e 20 6f 72 20 5b 5e 20 5d 20 2a 2f 0a 23 64 65 . or [^ ] */.#de
33a0: 66 69 6e 65 09 54 43 4c 5f 52 45 47 5f 4e 4c 41 fine.TCL_REG_NLA
33b0: 4e 43 48 09 09 30 30 30 32 30 30 20 20 2f 2a 20 NCH..000200 /*
33c0: 5e 20 6d 61 74 63 68 65 73 20 61 66 74 65 72 20 ^ matches after
33d0: 5c 6e 2c 20 24 20 62 65 66 6f 72 65 20 2a 2f 0a \n, $ before */.
33e0: 23 64 65 66 69 6e 65 09 54 43 4c 5f 52 45 47 5f #define.TCL_REG_
33f0: 4e 45 57 4c 49 4e 45 09 09 30 30 30 33 30 30 20 NEWLINE..000300
3400: 20 2f 2a 20 6e 65 77 6c 69 6e 65 73 20 61 72 65 /* newlines are
3410: 20 6c 69 6e 65 20 74 65 72 6d 69 6e 61 74 6f 72 line terminator
3420: 73 20 2a 2f 0a 23 64 65 66 69 6e 65 09 54 43 4c s */.#define.TCL
3430: 5f 52 45 47 5f 43 41 4e 4d 41 54 43 48 09 30 30 _REG_CANMATCH.00
3440: 31 30 30 30 20 20 2f 2a 20 72 65 70 6f 72 74 20 1000 /* report
3450: 64 65 74 61 69 6c 73 20 6f 6e 20 70 61 72 74 69 details on parti
3460: 61 6c 2f 6c 69 6d 69 74 65 64 0a 09 09 09 09 09 al/limited......
3470: 20 2a 20 6d 61 74 63 68 65 73 20 2a 2f 0a 0a 2f * matches */../
3480: 2a 0a 20 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 69 *. * The followi
3490: 6e 67 20 66 6c 61 67 20 69 73 20 65 78 70 65 72 ng flag is exper
34a0: 69 6d 65 6e 74 61 6c 20 61 6e 64 20 6f 6e 6c 79 imental and only
34b0: 20 69 6e 74 65 6e 64 65 64 20 66 6f 72 20 75 73 intended for us
34c0: 65 20 62 79 20 45 78 70 65 63 74 2e 20 20 49 74 e by Expect. It
34d0: 0a 20 2a 20 77 69 6c 6c 20 70 72 6f 62 61 62 6c . * will probabl
34e0: 79 20 67 6f 20 61 77 61 79 20 69 6e 20 61 20 6c y go away in a l
34f0: 61 74 65 72 20 72 65 6c 65 61 73 65 2e 0a 20 2a ater release.. *
3500: 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 52 /..#define TCL_R
3510: 45 47 5f 42 4f 53 4f 4e 4c 59 09 09 30 30 32 30 EG_BOSONLY..0020
3520: 30 30 09 2f 2a 20 70 72 65 70 65 6e 64 20 5c 41 00./* prepend \A
3530: 20 74 6f 20 70 61 74 74 65 72 6e 20 73 6f 20 69 to pattern so i
3540: 74 20 6f 6e 6c 79 0a 09 09 09 09 09 20 2a 20 6d t only...... * m
3550: 61 74 63 68 65 73 20 61 74 20 74 68 65 20 62 65 atches at the be
3560: 67 69 6e 6e 69 6e 67 20 6f 66 20 74 68 65 0a 09 ginning of the..
3570: 09 09 09 09 20 2a 20 73 74 72 69 6e 67 2e 20 2a .... * string. *
3580: 2f 0a 0a 2f 2a 0a 20 2a 20 46 6c 61 67 73 20 76 /../*. * Flags v
3590: 61 6c 75 65 73 20 70 61 73 73 65 64 20 74 6f 20 alues passed to
35a0: 54 63 6c 5f 52 65 67 45 78 70 45 78 65 63 4f 62 Tcl_RegExpExecOb
35b0: 6a 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 09 j.. */..#define.
35c0: 54 43 4c 5f 52 45 47 5f 4e 4f 54 42 4f 4c 09 30 TCL_REG_NOTBOL.0
35d0: 30 30 31 09 2f 2a 20 42 65 67 69 6e 6e 69 6e 67 001./* Beginning
35e0: 20 6f 66 20 73 74 72 69 6e 67 20 64 6f 65 73 20 of string does
35f0: 6e 6f 74 20 6d 61 74 63 68 20 5e 2e 20 20 2a 2f not match ^. */
3600: 0a 23 64 65 66 69 6e 65 09 54 43 4c 5f 52 45 47 .#define.TCL_REG
3610: 5f 4e 4f 54 45 4f 4c 09 30 30 30 32 09 2f 2a 20 _NOTEOL.0002./*
3620: 45 6e 64 20 6f 66 20 73 74 72 69 6e 67 20 64 6f End of string do
3630: 65 73 20 6e 6f 74 20 6d 61 74 63 68 20 24 2e 20 es not match $.
3640: 2a 2f 0a 0a 2f 2a 0a 20 2a 20 53 74 72 75 63 74 */../*. * Struct
3650: 75 72 65 73 20 66 69 6c 6c 65 64 20 69 6e 20 62 ures filled in b
3660: 79 20 54 63 6c 5f 52 65 67 45 78 70 49 6e 66 6f y Tcl_RegExpInfo
3670: 2e 20 20 4e 6f 74 65 20 74 68 61 74 20 61 6c 6c . Note that all
3680: 20 6f 66 66 73 65 74 20 76 61 6c 75 65 73 20 61 offset values a
3690: 72 65 0a 20 2a 20 72 65 6c 61 74 69 76 65 20 74 re. * relative t
36a0: 6f 20 74 68 65 20 73 74 61 72 74 20 6f 66 20 74 o the start of t
36b0: 68 65 20 6d 61 74 63 68 20 73 74 72 69 6e 67 2c he match string,
36c0: 20 6e 6f 74 20 74 68 65 20 62 65 67 69 6e 6e 69 not the beginni
36d0: 6e 67 20 6f 66 20 74 68 65 0a 20 2a 20 65 6e 74 ng of the. * ent
36e0: 69 72 65 20 73 74 72 69 6e 67 2e 0a 20 2a 2f 0a ire string.. */.
36f0: 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20 .typedef struct
3700: 54 63 6c 5f 52 65 67 45 78 70 49 6e 64 69 63 65 Tcl_RegExpIndice
3710: 73 20 7b 0a 20 20 20 20 6c 6f 6e 67 20 73 74 61 s {. long sta
3720: 72 74 3b 09 09 2f 2a 20 63 68 61 72 61 63 74 65 rt;../* characte
3730: 72 20 6f 66 66 73 65 74 20 6f 66 20 66 69 72 73 r offset of firs
3740: 74 20 63 68 61 72 61 63 74 65 72 20 69 6e 20 6d t character in m
3750: 61 74 63 68 20 2a 2f 0a 20 20 20 20 6c 6f 6e 67 atch */. long
3760: 20 65 6e 64 3b 09 09 2f 2a 20 63 68 61 72 61 63 end;../* charac
3770: 74 65 72 20 6f 66 66 73 65 74 20 6f 66 20 66 69 ter offset of fi
3780: 72 73 74 20 63 68 61 72 61 63 74 65 72 20 61 66 rst character af
3790: 74 65 72 20 74 68 65 0a 09 09 09 20 2a 20 6d 61 ter the.... * ma
37a0: 74 63 68 2e 20 2a 2f 0a 7d 20 54 63 6c 5f 52 65 tch. */.} Tcl_Re
37b0: 67 45 78 70 49 6e 64 69 63 65 73 3b 0a 0a 74 79 gExpIndices;..ty
37c0: 70 65 64 65 66 20 73 74 72 75 63 74 20 54 63 6c pedef struct Tcl
37d0: 5f 52 65 67 45 78 70 49 6e 66 6f 20 7b 0a 20 20 _RegExpInfo {.
37e0: 20 20 69 6e 74 20 6e 73 75 62 73 3b 09 09 09 2f int nsubs;.../
37f0: 2a 20 6e 75 6d 62 65 72 20 6f 66 20 73 75 62 65 * number of sube
3800: 78 70 72 65 73 73 69 6f 6e 73 20 69 6e 20 74 68 xpressions in th
3810: 65 0a 09 09 09 09 20 2a 20 63 6f 6d 70 69 6c 65 e..... * compile
3820: 64 20 65 78 70 72 65 73 73 69 6f 6e 20 2a 2f 0a d expression */.
3830: 20 20 20 20 54 63 6c 5f 52 65 67 45 78 70 49 6e Tcl_RegExpIn
3840: 64 69 63 65 73 20 2a 6d 61 74 63 68 65 73 3b 09 dices *matches;.
3850: 2f 2a 20 61 72 72 61 79 20 6f 66 20 6e 73 75 62 /* array of nsub
3860: 73 20 6d 61 74 63 68 20 6f 66 66 73 65 74 0a 09 s match offset..
3870: 09 09 09 20 2a 20 70 61 69 72 73 20 2a 2f 0a 20 ... * pairs */.
3880: 20 20 20 6c 6f 6e 67 20 65 78 74 65 6e 64 53 74 long extendSt
3890: 61 72 74 3b 09 09 2f 2a 20 54 68 65 20 6f 66 66 art;../* The off
38a0: 73 65 74 20 61 74 20 77 68 69 63 68 20 61 20 73 set at which a s
38b0: 75 62 73 65 71 75 65 6e 74 0a 09 09 09 09 20 2a ubsequent..... *
38c0: 20 6d 61 74 63 68 20 6d 69 67 68 74 20 62 65 67 match might beg
38d0: 69 6e 2e 20 2a 2f 0a 20 20 20 20 6c 6f 6e 67 20 in. */. long
38e0: 72 65 73 65 72 76 65 64 3b 09 09 2f 2a 20 52 65 reserved;../* Re
38f0: 73 65 72 76 65 64 20 66 6f 72 20 6c 61 74 65 72 served for later
3900: 20 75 73 65 2e 20 2a 2f 0a 7d 20 54 63 6c 5f 52 use. */.} Tcl_R
3910: 65 67 45 78 70 49 6e 66 6f 3b 0a 0a 2f 2a 0a 20 egExpInfo;../*.
3920: 2a 20 50 69 63 6b 79 20 63 6f 6d 70 69 6c 65 72 * Picky compiler
3930: 73 20 63 6f 6d 70 6c 61 69 6e 20 69 66 20 74 68 s complain if th
3940: 69 73 20 74 79 70 64 65 66 20 64 6f 65 73 6e 27 is typdef doesn'
3950: 74 20 61 70 70 65 61 72 20 62 65 66 6f 72 65 20 t appear before
3960: 74 68 65 0a 20 2a 20 73 74 72 75 63 74 27 73 20 the. * struct's
3970: 72 65 66 65 72 65 6e 63 65 20 69 6e 20 74 63 6c reference in tcl
3980: 44 65 63 6c 73 2e 68 2e 0a 20 2a 2f 0a 0a 74 79 Decls.h.. */..ty
3990: 70 65 64 65 66 20 73 74 72 75 63 74 20 73 74 61 pedef struct sta
39a0: 74 20 2a 54 63 6c 5f 53 74 61 74 5f 3b 0a 0a 2f t *Tcl_Stat_;../
39b0: 2a 0a 20 2a 20 57 68 65 6e 20 61 20 54 43 4c 20 *. * When a TCL
39c0: 63 6f 6d 6d 61 6e 64 20 72 65 74 75 72 6e 73 2c command returns,
39d0: 20 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 72 the interpreter
39e0: 20 63 6f 6e 74 61 69 6e 73 20 61 20 72 65 73 75 contains a resu
39f0: 6c 74 20 66 72 6f 6d 20 74 68 65 0a 20 2a 20 63 lt from the. * c
3a00: 6f 6d 6d 61 6e 64 2e 20 50 72 6f 67 72 61 6d 6d ommand. Programm
3a10: 65 72 73 20 61 72 65 20 73 74 72 6f 6e 67 6c 79 ers are strongly
3a20: 20 65 6e 63 6f 75 72 61 67 65 64 20 74 6f 20 75 encouraged to u
3a30: 73 65 20 6f 6e 65 20 6f 66 20 74 68 65 0a 20 2a se one of the. *
3a40: 20 70 72 6f 63 65 64 75 72 65 73 20 54 63 6c 5f procedures Tcl_
3a50: 47 65 74 4f 62 6a 52 65 73 75 6c 74 28 29 20 6f GetObjResult() o
3a60: 72 20 54 63 6c 5f 47 65 74 53 74 72 69 6e 67 52 r Tcl_GetStringR
3a70: 65 73 75 6c 74 28 29 20 74 6f 20 72 65 61 64 20 esult() to read
3a80: 74 68 65 0a 20 2a 20 69 6e 74 65 72 70 72 65 74 the. * interpret
3a90: 65 72 27 73 20 72 65 73 75 6c 74 2e 20 53 65 65 er's result. See
3aa0: 20 74 68 65 20 53 65 74 52 65 73 75 6c 74 20 6d the SetResult m
3ab0: 61 6e 20 70 61 67 65 20 66 6f 72 20 64 65 74 61 an page for deta
3ac0: 69 6c 73 2e 20 42 65 73 69 64 65 73 0a 20 2a 20 ils. Besides. *
3ad0: 74 68 69 73 20 72 65 73 75 6c 74 2c 20 74 68 65 this result, the
3ae0: 20 63 6f 6d 6d 61 6e 64 20 70 72 6f 63 65 64 75 command procedu
3af0: 72 65 20 72 65 74 75 72 6e 73 20 61 6e 20 69 6e re returns an in
3b00: 74 65 67 65 72 20 63 6f 64 65 2c 20 77 68 69 63 teger code, whic
3b10: 68 20 69 73 20 0a 20 2a 20 6f 6e 65 20 6f 66 20 h is . * one of
3b20: 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 3a 0a 20 the following:.
3b30: 2a 0a 20 2a 20 54 43 4c 5f 4f 4b 09 09 43 6f 6d *. * TCL_OK..Com
3b40: 6d 61 6e 64 20 63 6f 6d 70 6c 65 74 65 64 20 6e mand completed n
3b50: 6f 72 6d 61 6c 6c 79 3b 20 74 68 65 20 69 6e 74 ormally; the int
3b60: 65 72 70 72 65 74 65 72 27 73 0a 20 2a 09 09 09 erpreter's. *...
3b70: 72 65 73 75 6c 74 20 63 6f 6e 74 61 69 6e 73 09 result contains.
3b80: 74 68 65 20 63 6f 6d 6d 61 6e 64 27 73 20 72 65 the command's re
3b90: 73 75 6c 74 2e 0a 20 2a 20 54 43 4c 5f 45 52 52 sult.. * TCL_ERR
3ba0: 4f 52 09 09 54 68 65 20 63 6f 6d 6d 61 6e 64 20 OR..The command
3bb0: 63 6f 75 6c 64 6e 27 74 20 62 65 20 63 6f 6d 70 couldn't be comp
3bc0: 6c 65 74 65 64 20 73 75 63 63 65 73 73 66 75 6c leted successful
3bd0: 6c 79 3b 0a 20 2a 09 09 09 74 68 65 20 69 6e 74 ly;. *...the int
3be0: 65 72 70 72 65 74 65 72 27 73 20 72 65 73 75 6c erpreter's resul
3bf0: 74 20 64 65 73 63 72 69 62 65 73 20 77 68 61 74 t describes what
3c00: 20 77 65 6e 74 20 77 72 6f 6e 67 2e 0a 20 2a 20 went wrong.. *
3c10: 54 43 4c 5f 52 45 54 55 52 4e 09 09 54 68 65 20 TCL_RETURN..The
3c20: 63 6f 6d 6d 61 6e 64 20 72 65 71 75 65 73 74 73 command requests
3c30: 20 74 68 61 74 20 74 68 65 20 63 75 72 72 65 6e that the curren
3c40: 74 20 70 72 6f 63 65 64 75 72 65 0a 20 2a 09 09 t procedure. *..
3c50: 09 72 65 74 75 72 6e 3b 20 74 68 65 20 69 6e 74 .return; the int
3c60: 65 72 70 72 65 74 65 72 27 73 20 72 65 73 75 6c erpreter's resul
3c70: 74 20 63 6f 6e 74 61 69 6e 73 20 74 68 65 0a 20 t contains the.
3c80: 2a 09 09 09 70 72 6f 63 65 64 75 72 65 27 73 20 *...procedure's
3c90: 72 65 74 75 72 6e 20 76 61 6c 75 65 2e 0a 20 2a return value.. *
3ca0: 20 54 43 4c 5f 42 52 45 41 4b 09 09 54 68 65 20 TCL_BREAK..The
3cb0: 63 6f 6d 6d 61 6e 64 20 72 65 71 75 65 73 74 73 command requests
3cc0: 20 74 68 61 74 20 74 68 65 20 69 6e 6e 65 72 6d that the innerm
3cd0: 6f 73 74 20 6c 6f 6f 70 0a 20 2a 09 09 09 62 65 ost loop. *...be
3ce0: 20 65 78 69 74 65 64 3b 20 74 68 65 20 69 6e 74 exited; the int
3cf0: 65 72 70 72 65 74 65 72 27 73 20 72 65 73 75 6c erpreter's resul
3d00: 74 20 69 73 20 6d 65 61 6e 69 6e 67 6c 65 73 73 t is meaningless
3d10: 2e 0a 20 2a 20 54 43 4c 5f 43 4f 4e 54 49 4e 55 .. * TCL_CONTINU
3d20: 45 09 09 47 6f 20 6f 6e 20 74 6f 20 74 68 65 20 E..Go on to the
3d30: 6e 65 78 74 20 69 74 65 72 61 74 69 6f 6e 20 6f next iteration o
3d40: 66 20 74 68 65 20 63 75 72 72 65 6e 74 20 6c 6f f the current lo
3d50: 6f 70 3b 0a 20 2a 09 09 09 74 68 65 20 69 6e 74 op;. *...the int
3d60: 65 72 70 72 65 74 65 72 27 73 20 72 65 73 75 6c erpreter's resul
3d70: 74 20 69 73 20 6d 65 61 6e 69 6e 67 6c 65 73 73 t is meaningless
3d80: 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 .. */..#define T
3d90: 43 4c 5f 4f 4b 09 09 30 0a 23 64 65 66 69 6e 65 CL_OK..0.#define
3da0: 20 54 43 4c 5f 45 52 52 4f 52 09 31 0a 23 64 65 TCL_ERROR.1.#de
3db0: 66 69 6e 65 20 54 43 4c 5f 52 45 54 55 52 4e 09 fine TCL_RETURN.
3dc0: 32 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 42 52 2.#define TCL_BR
3dd0: 45 41 4b 09 33 0a 23 64 65 66 69 6e 65 20 54 43 EAK.3.#define TC
3de0: 4c 5f 43 4f 4e 54 49 4e 55 45 09 34 0a 0a 23 64 L_CONTINUE.4..#d
3df0: 65 66 69 6e 65 20 54 43 4c 5f 52 45 53 55 4c 54 efine TCL_RESULT
3e00: 5f 53 49 5a 45 20 32 30 30 0a 0a 2f 2a 0a 20 2a _SIZE 200../*. *
3e10: 20 41 72 67 75 6d 65 6e 74 20 64 65 73 63 72 69 Argument descri
3e20: 70 74 6f 72 73 20 66 6f 72 20 6d 61 74 68 20 66 ptors for math f
3e30: 75 6e 63 74 69 6f 6e 20 63 61 6c 6c 62 61 63 6b unction callback
3e40: 73 20 69 6e 20 65 78 70 72 65 73 73 69 6f 6e 73 s in expressions
3e50: 3a 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 65 :. */..typedef e
3e60: 6e 75 6d 20 7b 54 43 4c 5f 49 4e 54 2c 20 54 43 num {TCL_INT, TC
3e70: 4c 5f 44 4f 55 42 4c 45 2c 20 54 43 4c 5f 45 49 L_DOUBLE, TCL_EI
3e80: 54 48 45 52 7d 20 54 63 6c 5f 56 61 6c 75 65 54 THER} Tcl_ValueT
3e90: 79 70 65 3b 0a 74 79 70 65 64 65 66 20 73 74 72 ype;.typedef str
3ea0: 75 63 74 20 54 63 6c 5f 56 61 6c 75 65 20 7b 0a uct Tcl_Value {.
3eb0: 20 20 20 20 54 63 6c 5f 56 61 6c 75 65 54 79 70 Tcl_ValueTyp
3ec0: 65 20 74 79 70 65 3b 09 09 2f 2a 20 49 6e 64 69 e type;../* Indi
3ed0: 63 61 74 65 73 20 69 6e 74 56 61 6c 75 65 20 6f cates intValue o
3ee0: 72 20 64 6f 75 62 6c 65 56 61 6c 75 65 20 69 73 r doubleValue is
3ef0: 0a 09 09 09 09 20 2a 20 76 61 6c 69 64 2c 20 6f ..... * valid, o
3f00: 72 20 62 6f 74 68 2e 20 2a 2f 0a 20 20 20 20 6c r both. */. l
3f10: 6f 6e 67 20 69 6e 74 56 61 6c 75 65 3b 09 09 2f ong intValue;../
3f20: 2a 20 49 6e 74 65 67 65 72 20 76 61 6c 75 65 2e * Integer value.
3f30: 20 2a 2f 0a 20 20 20 20 64 6f 75 62 6c 65 20 64 */. double d
3f40: 6f 75 62 6c 65 56 61 6c 75 65 3b 09 09 2f 2a 20 oubleValue;../*
3f50: 44 6f 75 62 6c 65 2d 70 72 65 63 69 73 69 6f 6e Double-precision
3f60: 20 66 6c 6f 61 74 69 6e 67 20 76 61 6c 75 65 2e floating value.
3f70: 20 2a 2f 0a 7d 20 54 63 6c 5f 56 61 6c 75 65 3b */.} Tcl_Value;
3f80: 0a 0a 2f 2a 0a 20 2a 20 46 6f 72 77 61 72 64 20 ../*. * Forward
3f90: 64 65 63 6c 61 72 61 74 69 6f 6e 20 6f 66 20 54 declaration of T
3fa0: 63 6c 5f 4f 62 6a 20 74 6f 20 70 72 65 76 65 6e cl_Obj to preven
3fb0: 74 20 61 6e 20 65 72 72 6f 72 20 77 68 65 6e 20 t an error when
3fc0: 74 68 65 20 66 6f 72 77 61 72 64 0a 20 2a 20 72 the forward. * r
3fd0: 65 66 65 72 65 6e 63 65 20 74 6f 20 54 63 6c 5f eference to Tcl_
3fe0: 4f 62 6a 20 69 73 20 65 6e 63 6f 75 6e 74 65 72 Obj is encounter
3ff0: 65 64 20 69 6e 20 74 68 65 20 70 72 6f 63 65 64 ed in the proced
4000: 75 72 65 20 74 79 70 65 73 20 64 65 63 6c 61 72 ure types declar
4010: 65 64 20 0a 20 2a 20 62 65 6c 6f 77 2e 0a 20 2a ed . * below.. *
4020: 2f 0a 0a 73 74 72 75 63 74 20 54 63 6c 5f 4f 62 /..struct Tcl_Ob
4030: 6a 3b 0a 0a 2f 2a 0a 20 2a 20 50 72 6f 63 65 64 j;../*. * Proced
4040: 75 72 65 20 74 79 70 65 73 20 64 65 66 69 6e 65 ure types define
4050: 64 20 62 79 20 54 63 6c 3a 0a 20 2a 2f 0a 0a 74 d by Tcl:. */..t
4060: 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f ypedef int (Tcl_
4070: 41 70 70 49 6e 69 74 50 72 6f 63 29 20 5f 41 4e AppInitProc) _AN
4080: 53 49 5f 41 52 47 53 5f 28 28 54 63 6c 5f 49 6e SI_ARGS_((Tcl_In
4090: 74 65 72 70 20 2a 69 6e 74 65 72 70 29 29 3b 0a terp *interp));.
40a0: 74 79 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c typedef int (Tcl
40b0: 5f 41 73 79 6e 63 50 72 6f 63 29 20 5f 41 4e 53 _AsyncProc) _ANS
40c0: 49 5f 41 52 47 53 5f 28 28 43 6c 69 65 6e 74 44 I_ARGS_((ClientD
40d0: 61 74 61 20 63 6c 69 65 6e 74 44 61 74 61 2c 0a ata clientData,.
40e0: 09 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 .Tcl_Interp *int
40f0: 65 72 70 2c 20 69 6e 74 20 63 6f 64 65 29 29 3b erp, int code));
4100: 0a 74 79 70 65 64 65 66 20 76 6f 69 64 20 28 54 .typedef void (T
4110: 63 6c 5f 43 68 61 6e 6e 65 6c 50 72 6f 63 29 20 cl_ChannelProc)
4120: 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 43 6c 69 _ANSI_ARGS_((Cli
4130: 65 6e 74 44 61 74 61 20 63 6c 69 65 6e 74 44 61 entData clientDa
4140: 74 61 2c 20 69 6e 74 20 6d 61 73 6b 29 29 3b 0a ta, int mask));.
4150: 74 79 70 65 64 65 66 20 76 6f 69 64 20 28 54 63 typedef void (Tc
4160: 6c 5f 43 6c 6f 73 65 50 72 6f 63 29 20 5f 41 4e l_CloseProc) _AN
4170: 53 49 5f 41 52 47 53 5f 28 28 43 6c 69 65 6e 74 SI_ARGS_((Client
4180: 44 61 74 61 20 64 61 74 61 29 29 3b 0a 74 79 70 Data data));.typ
4190: 65 64 65 66 20 76 6f 69 64 20 28 54 63 6c 5f 43 edef void (Tcl_C
41a0: 6d 64 44 65 6c 65 74 65 50 72 6f 63 29 20 5f 41 mdDeleteProc) _A
41b0: 4e 53 49 5f 41 52 47 53 5f 28 28 43 6c 69 65 6e NSI_ARGS_((Clien
41c0: 74 44 61 74 61 20 63 6c 69 65 6e 74 44 61 74 61 tData clientData
41d0: 29 29 3b 0a 74 79 70 65 64 65 66 20 69 6e 74 20 ));.typedef int
41e0: 28 54 63 6c 5f 43 6d 64 50 72 6f 63 29 20 5f 41 (Tcl_CmdProc) _A
41f0: 4e 53 49 5f 41 52 47 53 5f 28 28 43 6c 69 65 6e NSI_ARGS_((Clien
4200: 74 44 61 74 61 20 63 6c 69 65 6e 74 44 61 74 61 tData clientData
4210: 2c 0a 09 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 ,..Tcl_Interp *i
4220: 6e 74 65 72 70 2c 20 69 6e 74 20 61 72 67 63 2c nterp, int argc,
4230: 20 63 68 61 72 20 2a 61 72 67 76 5b 5d 29 29 3b char *argv[]));
4240: 0a 74 79 70 65 64 65 66 20 76 6f 69 64 20 28 54 .typedef void (T
4250: 63 6c 5f 43 6d 64 54 72 61 63 65 50 72 6f 63 29 cl_CmdTraceProc)
4260: 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 43 6c _ANSI_ARGS_((Cl
4270: 69 65 6e 74 44 61 74 61 20 63 6c 69 65 6e 74 44 ientData clientD
4280: 61 74 61 2c 0a 09 54 63 6c 5f 49 6e 74 65 72 70 ata,..Tcl_Interp
4290: 20 2a 69 6e 74 65 72 70 2c 20 69 6e 74 20 6c 65 *interp, int le
42a0: 76 65 6c 2c 20 63 68 61 72 20 2a 63 6f 6d 6d 61 vel, char *comma
42b0: 6e 64 2c 20 54 63 6c 5f 43 6d 64 50 72 6f 63 20 nd, Tcl_CmdProc
42c0: 2a 70 72 6f 63 2c 0a 09 43 6c 69 65 6e 74 44 61 *proc,..ClientDa
42d0: 74 61 20 63 6d 64 43 6c 69 65 6e 74 44 61 74 61 ta cmdClientData
42e0: 2c 20 69 6e 74 20 61 72 67 63 2c 20 63 68 61 72 , int argc, char
42f0: 20 2a 61 72 67 76 5b 5d 29 29 3b 0a 74 79 70 65 *argv[]));.type
4300: 64 65 66 20 76 6f 69 64 20 28 54 63 6c 5f 44 75 def void (Tcl_Du
4310: 70 49 6e 74 65 72 6e 61 6c 52 65 70 50 72 6f 63 pInternalRepProc
4320: 29 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 73 ) _ANSI_ARGS_((s
4330: 74 72 75 63 74 20 54 63 6c 5f 4f 62 6a 20 2a 73 truct Tcl_Obj *s
4340: 72 63 50 74 72 2c 20 0a 20 20 20 20 20 20 20 20 rcPtr, .
4350: 73 74 72 75 63 74 20 54 63 6c 5f 4f 62 6a 20 2a struct Tcl_Obj *
4360: 64 75 70 50 74 72 29 29 3b 0a 74 79 70 65 64 65 dupPtr));.typede
4370: 66 20 69 6e 74 20 28 54 63 6c 5f 45 6e 63 6f 64 f int (Tcl_Encod
4380: 69 6e 67 43 6f 6e 76 65 72 74 50 72 6f 63 29 5f ingConvertProc)_
4390: 41 4e 53 49 5f 41 52 47 53 5f 28 28 43 6c 69 65 ANSI_ARGS_((Clie
43a0: 6e 74 44 61 74 61 20 63 6c 69 65 6e 74 44 61 74 ntData clientDat
43b0: 61 2c 0a 09 43 4f 4e 53 54 20 63 68 61 72 20 2a a,..CONST char *
43c0: 73 72 63 2c 20 69 6e 74 20 73 72 63 4c 65 6e 2c src, int srcLen,
43d0: 20 69 6e 74 20 66 6c 61 67 73 2c 20 54 63 6c 5f int flags, Tcl_
43e0: 45 6e 63 6f 64 69 6e 67 53 74 61 74 65 20 2a 73 EncodingState *s
43f0: 74 61 74 65 50 74 72 2c 0a 09 63 68 61 72 20 2a tatePtr,..char *
4400: 64 73 74 2c 20 69 6e 74 20 64 73 74 4c 65 6e 2c dst, int dstLen,
4410: 20 69 6e 74 20 2a 73 72 63 52 65 61 64 50 74 72 int *srcReadPtr
4420: 2c 20 69 6e 74 20 2a 64 73 74 57 72 6f 74 65 50 , int *dstWroteP
4430: 74 72 2c 0a 09 69 6e 74 20 2a 64 73 74 43 68 61 tr,..int *dstCha
4440: 72 73 50 74 72 29 29 3b 0a 74 79 70 65 64 65 66 rsPtr));.typedef
4450: 20 76 6f 69 64 20 28 54 63 6c 5f 45 6e 63 6f 64 void (Tcl_Encod
4460: 69 6e 67 46 72 65 65 50 72 6f 63 29 5f 41 4e 53 ingFreeProc)_ANS
4470: 49 5f 41 52 47 53 5f 28 28 43 6c 69 65 6e 74 44 I_ARGS_((ClientD
4480: 61 74 61 20 63 6c 69 65 6e 74 44 61 74 61 29 29 ata clientData))
4490: 3b 0a 74 79 70 65 64 65 66 20 69 6e 74 20 28 54 ;.typedef int (T
44a0: 63 6c 5f 45 76 65 6e 74 50 72 6f 63 29 20 5f 41 cl_EventProc) _A
44b0: 4e 53 49 5f 41 52 47 53 5f 28 28 54 63 6c 5f 45 NSI_ARGS_((Tcl_E
44c0: 76 65 6e 74 20 2a 65 76 50 74 72 2c 20 69 6e 74 vent *evPtr, int
44d0: 20 66 6c 61 67 73 29 29 3b 0a 74 79 70 65 64 65 flags));.typede
44e0: 66 20 76 6f 69 64 20 28 54 63 6c 5f 45 76 65 6e f void (Tcl_Even
44f0: 74 43 68 65 63 6b 50 72 6f 63 29 20 5f 41 4e 53 tCheckProc) _ANS
4500: 49 5f 41 52 47 53 5f 28 28 43 6c 69 65 6e 74 44 I_ARGS_((ClientD
4510: 61 74 61 20 63 6c 69 65 6e 74 44 61 74 61 2c 0a ata clientData,.
4520: 09 69 6e 74 20 66 6c 61 67 73 29 29 3b 0a 74 79 .int flags));.ty
4530: 70 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 45 pedef int (Tcl_E
4540: 76 65 6e 74 44 65 6c 65 74 65 50 72 6f 63 29 20 ventDeleteProc)
4550: 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 54 63 6c _ANSI_ARGS_((Tcl
4560: 5f 45 76 65 6e 74 20 2a 65 76 50 74 72 2c 0a 20 _Event *evPtr,.
4570: 20 20 20 20 20 20 20 43 6c 69 65 6e 74 44 61 74 ClientDat
4580: 61 20 63 6c 69 65 6e 74 44 61 74 61 29 29 3b 0a a clientData));.
4590: 74 79 70 65 64 65 66 20 76 6f 69 64 20 28 54 63 typedef void (Tc
45a0: 6c 5f 45 76 65 6e 74 53 65 74 75 70 50 72 6f 63 l_EventSetupProc
45b0: 29 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 43 ) _ANSI_ARGS_((C
45c0: 6c 69 65 6e 74 44 61 74 61 20 63 6c 69 65 6e 74 lientData client
45d0: 44 61 74 61 2c 0a 09 69 6e 74 20 66 6c 61 67 73 Data,..int flags
45e0: 29 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 64 ));.typedef void
45f0: 20 28 54 63 6c 5f 45 78 69 74 50 72 6f 63 29 20 (Tcl_ExitProc)
4600: 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 43 6c 69 _ANSI_ARGS_((Cli
4610: 65 6e 74 44 61 74 61 20 63 6c 69 65 6e 74 44 61 entData clientDa
4620: 74 61 29 29 3b 0a 74 79 70 65 64 65 66 20 76 6f ta));.typedef vo
4630: 69 64 20 28 54 63 6c 5f 46 69 6c 65 50 72 6f 63 id (Tcl_FileProc
4640: 29 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 43 ) _ANSI_ARGS_((C
4650: 6c 69 65 6e 74 44 61 74 61 20 63 6c 69 65 6e 74 lientData client
4660: 44 61 74 61 2c 20 69 6e 74 20 6d 61 73 6b 29 29 Data, int mask))
4670: 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 64 20 28 ;.typedef void (
4680: 54 63 6c 5f 46 69 6c 65 46 72 65 65 50 72 6f 63 Tcl_FileFreeProc
4690: 29 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 43 ) _ANSI_ARGS_((C
46a0: 6c 69 65 6e 74 44 61 74 61 20 63 6c 69 65 6e 74 lientData client
46b0: 44 61 74 61 29 29 3b 0a 74 79 70 65 64 65 66 20 Data));.typedef
46c0: 76 6f 69 64 20 28 54 63 6c 5f 46 72 65 65 49 6e void (Tcl_FreeIn
46d0: 74 65 72 6e 61 6c 52 65 70 50 72 6f 63 29 20 5f ternalRepProc) _
46e0: 41 4e 53 49 5f 41 52 47 53 5f 28 28 73 74 72 75 ANSI_ARGS_((stru
46f0: 63 74 20 54 63 6c 5f 4f 62 6a 20 2a 6f 62 6a 50 ct Tcl_Obj *objP
4700: 74 72 29 29 3b 0a 74 79 70 65 64 65 66 20 76 6f tr));.typedef vo
4710: 69 64 20 28 54 63 6c 5f 46 72 65 65 50 72 6f 63 id (Tcl_FreeProc
4720: 29 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 63 ) _ANSI_ARGS_((c
4730: 68 61 72 20 2a 62 6c 6f 63 6b 50 74 72 29 29 3b har *blockPtr));
4740: 0a 74 79 70 65 64 65 66 20 76 6f 69 64 20 28 54 .typedef void (T
4750: 63 6c 5f 49 64 6c 65 50 72 6f 63 29 20 5f 41 4e cl_IdleProc) _AN
4760: 53 49 5f 41 52 47 53 5f 28 28 43 6c 69 65 6e 74 SI_ARGS_((Client
4770: 44 61 74 61 20 63 6c 69 65 6e 74 44 61 74 61 29 Data clientData)
4780: 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 64 20 );.typedef void
4790: 28 54 63 6c 5f 49 6e 74 65 72 70 44 65 6c 65 74 (Tcl_InterpDelet
47a0: 65 50 72 6f 63 29 20 5f 41 4e 53 49 5f 41 52 47 eProc) _ANSI_ARG
47b0: 53 5f 28 28 43 6c 69 65 6e 74 44 61 74 61 20 63 S_((ClientData c
47c0: 6c 69 65 6e 74 44 61 74 61 2c 0a 09 54 63 6c 5f lientData,..Tcl_
47d0: 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 29 29 Interp *interp))
47e0: 3b 0a 74 79 70 65 64 65 66 20 69 6e 74 20 28 54 ;.typedef int (T
47f0: 63 6c 5f 4d 61 74 68 50 72 6f 63 29 20 5f 41 4e cl_MathProc) _AN
4800: 53 49 5f 41 52 47 53 5f 28 28 43 6c 69 65 6e 74 SI_ARGS_((Client
4810: 44 61 74 61 20 63 6c 69 65 6e 74 44 61 74 61 2c Data clientData,
4820: 0a 09 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e ..Tcl_Interp *in
4830: 74 65 72 70 2c 20 54 63 6c 5f 56 61 6c 75 65 20 terp, Tcl_Value
4840: 2a 61 72 67 73 2c 20 54 63 6c 5f 56 61 6c 75 65 *args, Tcl_Value
4850: 20 2a 72 65 73 75 6c 74 50 74 72 29 29 3b 0a 74 *resultPtr));.t
4860: 79 70 65 64 65 66 20 76 6f 69 64 20 28 54 63 6c ypedef void (Tcl
4870: 5f 4e 61 6d 65 73 70 61 63 65 44 65 6c 65 74 65 _NamespaceDelete
4880: 50 72 6f 63 29 20 5f 41 4e 53 49 5f 41 52 47 53 Proc) _ANSI_ARGS
4890: 5f 28 28 43 6c 69 65 6e 74 44 61 74 61 20 63 6c _((ClientData cl
48a0: 69 65 6e 74 44 61 74 61 29 29 3b 0a 74 79 70 65 ientData));.type
48b0: 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 4f 62 6a def int (Tcl_Obj
48c0: 43 6d 64 50 72 6f 63 29 20 5f 41 4e 53 49 5f 41 CmdProc) _ANSI_A
48d0: 52 47 53 5f 28 28 43 6c 69 65 6e 74 44 61 74 61 RGS_((ClientData
48e0: 20 63 6c 69 65 6e 74 44 61 74 61 2c 0a 09 54 63 clientData,..Tc
48f0: 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 l_Interp *interp
4900: 2c 20 69 6e 74 20 6f 62 6a 63 2c 20 73 74 72 75 , int objc, stru
4910: 63 74 20 54 63 6c 5f 4f 62 6a 20 2a 20 43 4f 4e ct Tcl_Obj * CON
4920: 53 54 20 2a 20 6f 62 6a 76 29 29 3b 0a 74 79 70 ST * objv));.typ
4930: 65 64 65 66 20 69 6e 74 20 28 54 63 6c 5f 50 61 edef int (Tcl_Pa
4940: 63 6b 61 67 65 49 6e 69 74 50 72 6f 63 29 20 5f ckageInitProc) _
4950: 41 4e 53 49 5f 41 52 47 53 5f 28 28 54 63 6c 5f ANSI_ARGS_((Tcl_
4960: 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 29 29 Interp *interp))
4970: 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 64 20 28 ;.typedef void (
4980: 54 63 6c 5f 50 61 6e 69 63 50 72 6f 63 29 20 5f Tcl_PanicProc) _
4990: 41 4e 53 49 5f 41 52 47 53 5f 28 54 43 4c 5f 56 ANSI_ARGS_(TCL_V
49a0: 41 52 41 52 47 53 28 63 68 61 72 20 2a 2c 20 66 ARARGS(char *, f
49b0: 6f 72 6d 61 74 29 29 3b 0a 74 79 70 65 64 65 66 ormat));.typedef
49c0: 20 76 6f 69 64 20 28 54 63 6c 5f 54 63 70 41 63 void (Tcl_TcpAc
49d0: 63 65 70 74 50 72 6f 63 29 20 5f 41 4e 53 49 5f ceptProc) _ANSI_
49e0: 41 52 47 53 5f 28 28 43 6c 69 65 6e 74 44 61 74 ARGS_((ClientDat
49f0: 61 20 63 61 6c 6c 62 61 63 6b 44 61 74 61 2c 0a a callbackData,.
4a00: 20 20 20 20 20 20 20 20 54 63 6c 5f 43 68 61 6e Tcl_Chan
4a10: 6e 65 6c 20 63 68 61 6e 2c 20 63 68 61 72 20 2a nel chan, char *
4a20: 61 64 64 72 65 73 73 2c 20 69 6e 74 20 70 6f 72 address, int por
4a30: 74 29 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 t));.typedef voi
4a40: 64 20 28 54 63 6c 5f 54 69 6d 65 72 50 72 6f 63 d (Tcl_TimerProc
4a50: 29 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 43 ) _ANSI_ARGS_((C
4a60: 6c 69 65 6e 74 44 61 74 61 20 63 6c 69 65 6e 74 lientData client
4a70: 44 61 74 61 29 29 3b 0a 74 79 70 65 64 65 66 20 Data));.typedef
4a80: 69 6e 74 20 28 54 63 6c 5f 53 65 74 46 72 6f 6d int (Tcl_SetFrom
4a90: 41 6e 79 50 72 6f 63 29 20 5f 41 4e 53 49 5f 41 AnyProc) _ANSI_A
4aa0: 52 47 53 5f 28 28 54 63 6c 5f 49 6e 74 65 72 70 RGS_((Tcl_Interp
4ab0: 20 2a 69 6e 74 65 72 70 2c 0a 09 73 74 72 75 63 *interp,..struc
4ac0: 74 20 54 63 6c 5f 4f 62 6a 20 2a 6f 62 6a 50 74 t Tcl_Obj *objPt
4ad0: 72 29 29 3b 0a 74 79 70 65 64 65 66 20 76 6f 69 r));.typedef voi
4ae0: 64 20 28 54 63 6c 5f 55 70 64 61 74 65 53 74 72 d (Tcl_UpdateStr
4af0: 69 6e 67 50 72 6f 63 29 20 5f 41 4e 53 49 5f 41 ingProc) _ANSI_A
4b00: 52 47 53 5f 28 28 73 74 72 75 63 74 20 54 63 6c RGS_((struct Tcl
4b10: 5f 4f 62 6a 20 2a 6f 62 6a 50 74 72 29 29 3b 0a _Obj *objPtr));.
4b20: 74 79 70 65 64 65 66 20 63 68 61 72 20 2a 28 54 typedef char *(T
4b30: 63 6c 5f 56 61 72 54 72 61 63 65 50 72 6f 63 29 cl_VarTraceProc)
4b40: 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 43 6c _ANSI_ARGS_((Cl
4b50: 69 65 6e 74 44 61 74 61 20 63 6c 69 65 6e 74 44 ientData clientD
4b60: 61 74 61 2c 0a 09 54 63 6c 5f 49 6e 74 65 72 70 ata,..Tcl_Interp
4b70: 20 2a 69 6e 74 65 72 70 2c 20 63 68 61 72 20 2a *interp, char *
4b80: 70 61 72 74 31 2c 20 63 68 61 72 20 2a 70 61 72 part1, char *par
4b90: 74 32 2c 20 69 6e 74 20 66 6c 61 67 73 29 29 3b t2, int flags));
4ba0: 0a 74 79 70 65 64 65 66 20 76 6f 69 64 20 28 54 .typedef void (T
4bb0: 63 6c 5f 43 72 65 61 74 65 46 69 6c 65 48 61 6e cl_CreateFileHan
4bc0: 64 6c 65 72 50 72 6f 63 29 20 5f 41 4e 53 49 5f dlerProc) _ANSI_
4bd0: 41 52 47 53 5f 28 28 69 6e 74 20 66 64 2c 20 69 ARGS_((int fd, i
4be0: 6e 74 20 6d 61 73 6b 2c 0a 09 54 63 6c 5f 46 69 nt mask,..Tcl_Fi
4bf0: 6c 65 50 72 6f 63 20 2a 70 72 6f 63 2c 20 43 6c leProc *proc, Cl
4c00: 69 65 6e 74 44 61 74 61 20 63 6c 69 65 6e 74 44 ientData clientD
4c10: 61 74 61 29 29 3b 0a 74 79 70 65 64 65 66 20 76 ata));.typedef v
4c20: 6f 69 64 20 28 54 63 6c 5f 44 65 6c 65 74 65 46 oid (Tcl_DeleteF
4c30: 69 6c 65 48 61 6e 64 6c 65 72 50 72 6f 63 29 20 ileHandlerProc)
4c40: 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 69 6e 74 _ANSI_ARGS_((int
4c50: 20 66 64 29 29 3b 0a 74 79 70 65 64 65 66 20 76 fd));.typedef v
4c60: 6f 69 64 20 28 54 63 6c 5f 4d 61 69 6e 4c 6f 6f oid (Tcl_MainLoo
4c70: 70 50 72 6f 63 29 20 5f 41 4e 53 49 5f 41 52 47 pProc) _ANSI_ARG
4c80: 53 5f 28 28 76 6f 69 64 29 29 3b 0a 0a 2f 2a 0a S_((void));../*.
4c90: 20 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 * The following
4ca0: 20 73 74 72 75 63 74 75 72 65 20 72 65 70 72 65 structure repre
4cb0: 73 65 6e 74 73 20 61 20 74 79 70 65 20 6f 66 20 sents a type of
4cc0: 6f 62 6a 65 63 74 2c 20 77 68 69 63 68 20 69 73 object, which is
4cd0: 20 61 0a 20 2a 20 70 61 72 74 69 63 75 6c 61 72 a. * particular
4ce0: 20 69 6e 74 65 72 6e 61 6c 20 72 65 70 72 65 73 internal repres
4cf0: 65 6e 74 61 74 69 6f 6e 20 66 6f 72 20 61 6e 20 entation for an
4d00: 6f 62 6a 65 63 74 20 70 6c 75 73 20 61 20 73 65 object plus a se
4d10: 74 20 6f 66 0a 20 2a 20 70 72 6f 63 65 64 75 72 t of. * procedur
4d20: 65 73 20 74 68 61 74 20 70 72 6f 76 69 64 65 20 es that provide
4d30: 73 74 61 6e 64 61 72 64 20 6f 70 65 72 61 74 69 standard operati
4d40: 6f 6e 73 20 6f 6e 20 6f 62 6a 65 63 74 73 20 6f ons on objects o
4d50: 66 20 74 68 61 74 20 74 79 70 65 2e 0a 20 2a 2f f that type.. */
4d60: 0a 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 74 ..typedef struct
4d70: 20 54 63 6c 5f 4f 62 6a 54 79 70 65 20 7b 0a 20 Tcl_ObjType {.
4d80: 20 20 20 63 68 61 72 20 2a 6e 61 6d 65 3b 09 09 char *name;..
4d90: 09 2f 2a 20 4e 61 6d 65 20 6f 66 20 74 68 65 20 ./* Name of the
4da0: 74 79 70 65 2c 20 65 2e 67 2e 20 22 69 6e 74 22 type, e.g. "int"
4db0: 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 46 72 65 . */. Tcl_Fre
4dc0: 65 49 6e 74 65 72 6e 61 6c 52 65 70 50 72 6f 63 eInternalRepProc
4dd0: 20 2a 66 72 65 65 49 6e 74 52 65 70 50 72 6f 63 *freeIntRepProc
4de0: 3b 0a 09 09 09 09 2f 2a 20 43 61 6c 6c 65 64 20 ;...../* Called
4df0: 74 6f 20 66 72 65 65 20 61 6e 79 20 73 74 6f 72 to free any stor
4e00: 61 67 65 20 66 6f 72 20 74 68 65 20 74 79 70 65 age for the type
4e10: 27 73 0a 09 09 09 09 20 2a 20 69 6e 74 65 72 6e 's..... * intern
4e20: 61 6c 20 72 65 70 2e 20 4e 55 4c 4c 20 69 66 20 al rep. NULL if
4e30: 74 68 65 20 69 6e 74 65 72 6e 61 6c 20 72 65 70 the internal rep
4e40: 0a 09 09 09 09 20 2a 20 64 6f 65 73 20 6e 6f 74 ..... * does not
4e50: 20 6e 65 65 64 20 66 72 65 65 69 6e 67 2e 20 2a need freeing. *
4e60: 2f 0a 20 20 20 20 54 63 6c 5f 44 75 70 49 6e 74 /. Tcl_DupInt
4e70: 65 72 6e 61 6c 52 65 70 50 72 6f 63 20 2a 64 75 ernalRepProc *du
4e80: 70 49 6e 74 52 65 70 50 72 6f 63 3b 0a 20 20 20 pIntRepProc;.
4e90: 20 09 09 09 09 2f 2a 20 43 61 6c 6c 65 64 20 74 ..../* Called t
4ea0: 6f 20 63 72 65 61 74 65 20 61 20 6e 65 77 20 6f o create a new o
4eb0: 62 6a 65 63 74 20 61 73 20 61 20 63 6f 70 79 0a bject as a copy.
4ec0: 09 09 09 09 20 2a 20 6f 66 20 61 6e 20 65 78 69 .... * of an exi
4ed0: 73 74 69 6e 67 20 6f 62 6a 65 63 74 2e 20 2a 2f sting object. */
4ee0: 0a 20 20 20 20 54 63 6c 5f 55 70 64 61 74 65 53 . Tcl_UpdateS
4ef0: 74 72 69 6e 67 50 72 6f 63 20 2a 75 70 64 61 74 tringProc *updat
4f00: 65 53 74 72 69 6e 67 50 72 6f 63 3b 0a 20 20 20 eStringProc;.
4f10: 20 09 09 09 09 2f 2a 20 43 61 6c 6c 65 64 20 74 ..../* Called t
4f20: 6f 20 75 70 64 61 74 65 20 74 68 65 20 73 74 72 o update the str
4f30: 69 6e 67 20 72 65 70 20 66 72 6f 6d 20 74 68 65 ing rep from the
4f40: 0a 09 09 09 09 20 2a 20 74 79 70 65 27 73 20 69 ..... * type's i
4f50: 6e 74 65 72 6e 61 6c 20 72 65 70 72 65 73 65 6e nternal represen
4f60: 74 61 74 69 6f 6e 2e 20 2a 2f 0a 20 20 20 20 54 tation. */. T
4f70: 63 6c 5f 53 65 74 46 72 6f 6d 41 6e 79 50 72 6f cl_SetFromAnyPro
4f80: 63 20 2a 73 65 74 46 72 6f 6d 41 6e 79 50 72 6f c *setFromAnyPro
4f90: 63 3b 0a 20 20 20 20 09 09 09 09 2f 2a 20 43 61 c;. ..../* Ca
4fa0: 6c 6c 65 64 20 74 6f 20 63 6f 6e 76 65 72 74 20 lled to convert
4fb0: 74 68 65 20 6f 62 6a 65 63 74 27 73 20 69 6e 74 the object's int
4fc0: 65 72 6e 61 6c 0a 09 09 09 09 20 2a 20 72 65 70 ernal..... * rep
4fd0: 20 74 6f 20 74 68 69 73 20 74 79 70 65 2e 20 46 to this type. F
4fe0: 72 65 65 73 20 74 68 65 20 69 6e 74 65 72 6e 61 rees the interna
4ff0: 6c 20 72 65 70 0a 09 09 09 09 20 2a 20 6f 66 20 l rep..... * of
5000: 74 68 65 20 6f 6c 64 20 74 79 70 65 2e 20 52 65 the old type. Re
5010: 74 75 72 6e 73 20 54 43 4c 5f 45 52 52 4f 52 20 turns TCL_ERROR
5020: 6f 6e 0a 09 09 09 09 20 2a 20 66 61 69 6c 75 72 on..... * failur
5030: 65 2e 20 2a 2f 0a 7d 20 54 63 6c 5f 4f 62 6a 54 e. */.} Tcl_ObjT
5040: 79 70 65 3b 0a 0a 2f 2a 0a 20 2a 20 4f 6e 65 20 ype;../*. * One
5050: 6f 66 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 of the following
5060: 20 73 74 72 75 63 74 75 72 65 73 20 65 78 69 73 structures exis
5070: 74 73 20 66 6f 72 20 65 61 63 68 20 6f 62 6a 65 ts for each obje
5080: 63 74 20 69 6e 20 74 68 65 20 54 63 6c 0a 20 2a ct in the Tcl. *
5090: 20 73 79 73 74 65 6d 2e 20 41 6e 20 6f 62 6a 65 system. An obje
50a0: 63 74 20 73 74 6f 72 65 73 20 61 20 76 61 6c 75 ct stores a valu
50b0: 65 20 61 73 20 65 69 74 68 65 72 20 61 20 73 74 e as either a st
50c0: 72 69 6e 67 2c 20 73 6f 6d 65 20 69 6e 74 65 72 ring, some inter
50d0: 6e 61 6c 0a 20 2a 20 72 65 70 72 65 73 65 6e 74 nal. * represent
50e0: 61 74 69 6f 6e 2c 20 6f 72 20 62 6f 74 68 2e 0a ation, or both..
50f0: 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 73 74 72 */..typedef str
5100: 75 63 74 20 54 63 6c 5f 4f 62 6a 20 7b 0a 20 20 uct Tcl_Obj {.
5110: 20 20 69 6e 74 20 72 65 66 43 6f 75 6e 74 3b 09 int refCount;.
5120: 09 2f 2a 20 57 68 65 6e 20 30 20 74 68 65 20 6f ./* When 0 the o
5130: 62 6a 65 63 74 20 77 69 6c 6c 20 62 65 20 66 72 bject will be fr
5140: 65 65 64 2e 20 2a 2f 0a 20 20 20 20 63 68 61 72 eed. */. char
5150: 20 2a 62 79 74 65 73 3b 09 09 2f 2a 20 54 68 69 *bytes;../* Thi
5160: 73 20 70 6f 69 6e 74 73 20 74 6f 20 74 68 65 20 s points to the
5170: 66 69 72 73 74 20 62 79 74 65 20 6f 66 20 74 68 first byte of th
5180: 65 0a 09 09 09 09 20 2a 20 6f 62 6a 65 63 74 27 e..... * object'
5190: 73 20 73 74 72 69 6e 67 20 72 65 70 72 65 73 65 s string represe
51a0: 6e 74 61 74 69 6f 6e 2e 20 54 68 65 20 61 72 72 ntation. The arr
51b0: 61 79 0a 09 09 09 09 20 2a 20 6d 75 73 74 20 62 ay..... * must b
51c0: 65 20 66 6f 6c 6c 6f 77 65 64 20 62 79 20 61 20 e followed by a
51d0: 6e 75 6c 6c 20 62 79 74 65 20 28 69 2e 65 2e 2c null byte (i.e.,
51e0: 20 61 74 0a 09 09 09 09 20 2a 20 6f 66 66 73 65 at..... * offse
51f0: 74 20 6c 65 6e 67 74 68 29 20 62 75 74 20 6d 61 t length) but ma
5200: 79 20 61 6c 73 6f 20 63 6f 6e 74 61 69 6e 0a 09 y also contain..
5210: 09 09 09 20 2a 20 65 6d 62 65 64 64 65 64 20 6e ... * embedded n
5220: 75 6c 6c 20 63 68 61 72 61 63 74 65 72 73 2e 20 ull characters.
5230: 54 68 65 20 61 72 72 61 79 27 73 0a 09 09 09 09 The array's.....
5240: 20 2a 20 73 74 6f 72 61 67 65 20 69 73 20 61 6c * storage is al
5250: 6c 6f 63 61 74 65 64 20 62 79 20 63 6b 61 6c 6c located by ckall
5260: 6f 63 2e 20 4e 55 4c 4c 0a 09 09 09 09 20 2a 20 oc. NULL..... *
5270: 6d 65 61 6e 73 20 74 68 65 20 73 74 72 69 6e 67 means the string
5280: 20 72 65 70 20 69 73 20 69 6e 76 61 6c 69 64 20 rep is invalid
5290: 61 6e 64 20 6d 75 73 74 0a 09 09 09 09 20 2a 20 and must..... *
52a0: 62 65 20 72 65 67 65 6e 65 72 61 74 65 64 20 66 be regenerated f
52b0: 72 6f 6d 20 74 68 65 20 69 6e 74 65 72 6e 61 6c rom the internal
52c0: 20 72 65 70 2e 0a 09 09 09 09 20 2a 20 43 6c 69 rep...... * Cli
52d0: 65 6e 74 73 20 73 68 6f 75 6c 64 20 75 73 65 20 ents should use
52e0: 54 63 6c 5f 47 65 74 53 74 72 69 6e 67 46 72 6f Tcl_GetStringFro
52f0: 6d 4f 62 6a 0a 09 09 09 09 20 2a 20 6f 72 20 54 mObj..... * or T
5300: 63 6c 5f 47 65 74 53 74 72 69 6e 67 20 74 6f 20 cl_GetString to
5310: 67 65 74 20 61 20 70 6f 69 6e 74 65 72 20 74 6f get a pointer to
5320: 20 74 68 65 0a 09 09 09 09 20 2a 20 62 79 74 65 the..... * byte
5330: 20 61 72 72 61 79 20 61 73 20 61 20 72 65 61 64 array as a read
5340: 6f 6e 6c 79 20 76 61 6c 75 65 2e 20 2a 2f 0a 20 only value. */.
5350: 20 20 20 69 6e 74 20 6c 65 6e 67 74 68 3b 09 09 int length;..
5360: 09 2f 2a 20 54 68 65 20 6e 75 6d 62 65 72 20 6f ./* The number o
5370: 66 20 62 79 74 65 73 20 61 74 20 2a 62 79 74 65 f bytes at *byte
5380: 73 2c 20 6e 6f 74 0a 09 09 09 09 20 2a 20 69 6e s, not..... * in
5390: 63 6c 75 64 69 6e 67 20 74 68 65 20 74 65 72 6d cluding the term
53a0: 69 6e 61 74 69 6e 67 20 6e 75 6c 6c 2e 20 2a 2f inating null. */
53b0: 0a 20 20 20 20 54 63 6c 5f 4f 62 6a 54 79 70 65 . Tcl_ObjType
53c0: 20 2a 74 79 70 65 50 74 72 3b 09 2f 2a 20 44 65 *typePtr;./* De
53d0: 6e 6f 74 65 73 20 74 68 65 20 6f 62 6a 65 63 74 notes the object
53e0: 27 73 20 74 79 70 65 2e 20 41 6c 77 61 79 73 0a 's type. Always.
53f0: 09 09 09 09 20 2a 20 63 6f 72 72 65 73 70 6f 6e .... * correspon
5400: 64 73 20 74 6f 20 74 68 65 20 74 79 70 65 20 6f ds to the type o
5410: 66 20 74 68 65 20 6f 62 6a 65 63 74 27 73 0a 09 f the object's..
5420: 09 09 09 20 2a 20 69 6e 74 65 72 6e 61 6c 20 72 ... * internal r
5430: 65 70 2e 20 4e 55 4c 4c 20 69 6e 64 69 63 61 74 ep. NULL indicat
5440: 65 73 20 74 68 65 20 6f 62 6a 65 63 74 0a 09 09 es the object...
5450: 09 09 20 2a 20 68 61 73 20 6e 6f 20 69 6e 74 65 .. * has no inte
5460: 72 6e 61 6c 20 72 65 70 20 28 68 61 73 20 6e 6f rnal rep (has no
5470: 20 74 79 70 65 29 2e 20 2a 2f 0a 20 20 20 20 75 type). */. u
5480: 6e 69 6f 6e 20 7b 09 09 09 2f 2a 20 54 68 65 20 nion {.../* The
5490: 69 6e 74 65 72 6e 61 6c 20 72 65 70 72 65 73 65 internal represe
54a0: 6e 74 61 74 69 6f 6e 3a 20 2a 2f 0a 09 6c 6f 6e ntation: */..lon
54b0: 67 20 6c 6f 6e 67 56 61 6c 75 65 3b 09 09 2f 2a g longValue;../*
54c0: 20 20 20 2d 20 61 6e 20 6c 6f 6e 67 20 69 6e 74 - an long int
54d0: 65 67 65 72 20 76 61 6c 75 65 20 2a 2f 0a 09 64 eger value */..d
54e0: 6f 75 62 6c 65 20 64 6f 75 62 6c 65 56 61 6c 75 ouble doubleValu
54f0: 65 3b 09 2f 2a 20 20 20 2d 20 61 20 64 6f 75 62 e;./* - a doub
5500: 6c 65 2d 70 72 65 63 69 73 69 6f 6e 20 66 6c 6f le-precision flo
5510: 61 74 69 6e 67 20 76 61 6c 75 65 20 2a 2f 0a 09 ating value */..
5520: 56 4f 49 44 20 2a 6f 74 68 65 72 56 61 6c 75 65 VOID *otherValue
5530: 50 74 72 3b 09 2f 2a 20 20 20 2d 20 61 6e 6f 74 Ptr;./* - anot
5540: 68 65 72 2c 20 74 79 70 65 2d 73 70 65 63 69 66 her, type-specif
5550: 69 63 20 76 61 6c 75 65 20 2a 2f 0a 09 73 74 72 ic value */..str
5560: 75 63 74 20 7b 09 09 2f 2a 20 20 20 2d 20 69 6e uct {../* - in
5570: 74 65 72 6e 61 6c 20 72 65 70 20 61 73 20 74 77 ternal rep as tw
5580: 6f 20 70 6f 69 6e 74 65 72 73 20 2a 2f 0a 09 20 o pointers */..
5590: 20 20 20 56 4f 49 44 20 2a 70 74 72 31 3b 0a 09 VOID *ptr1;..
55a0: 20 20 20 20 56 4f 49 44 20 2a 70 74 72 32 3b 0a VOID *ptr2;.
55b0: 09 7d 20 74 77 6f 50 74 72 56 61 6c 75 65 3b 0a .} twoPtrValue;.
55c0: 20 20 20 20 7d 20 69 6e 74 65 72 6e 61 6c 52 65 } internalRe
55d0: 70 3b 0a 7d 20 54 63 6c 5f 4f 62 6a 3b 0a 0a 2f p;.} Tcl_Obj;../
55e0: 2a 0a 20 2a 20 4d 61 63 72 6f 73 20 74 6f 20 69 *. * Macros to i
55f0: 6e 63 72 65 6d 65 6e 74 20 61 6e 64 20 64 65 63 ncrement and dec
5600: 72 65 6d 65 6e 74 20 61 20 54 63 6c 5f 4f 62 6a rement a Tcl_Obj
5610: 27 73 20 72 65 66 65 72 65 6e 63 65 20 63 6f 75 's reference cou
5620: 6e 74 2c 20 61 6e 64 20 74 6f 0a 20 2a 20 74 65 nt, and to. * te
5630: 73 74 20 77 68 65 74 68 65 72 20 61 6e 20 6f 62 st whether an ob
5640: 6a 65 63 74 20 69 73 20 73 68 61 72 65 64 20 28 ject is shared (
5650: 69 2e 65 2e 20 68 61 73 20 72 65 66 65 72 65 6e i.e. has referen
5660: 63 65 20 63 6f 75 6e 74 20 3e 20 31 29 2e 0a 20 ce count > 1)..
5670: 2a 20 4e 6f 74 65 3a 20 63 6c 69 65 6e 74 73 20 * Note: clients
5680: 73 68 6f 75 6c 64 20 75 73 65 20 54 63 6c 5f 44 should use Tcl_D
5690: 65 63 72 52 65 66 43 6f 75 6e 74 28 29 20 77 68 ecrRefCount() wh
56a0: 65 6e 20 74 68 65 79 20 61 72 65 20 66 69 6e 69 en they are fini
56b0: 73 68 65 64 20 75 73 69 6e 67 0a 20 2a 20 61 6e shed using. * an
56c0: 20 6f 62 6a 65 63 74 2c 20 61 6e 64 20 73 68 6f object, and sho
56d0: 75 6c 64 20 6e 65 76 65 72 20 63 61 6c 6c 20 54 uld never call T
56e0: 63 6c 46 72 65 65 4f 62 6a 28 29 20 64 69 72 65 clFreeObj() dire
56f0: 63 74 6c 79 2e 20 54 63 6c 46 72 65 65 4f 62 6a ctly. TclFreeObj
5700: 28 29 20 69 73 0a 20 2a 20 6f 6e 6c 79 20 64 65 () is. * only de
5710: 66 69 6e 65 64 20 61 6e 64 20 6d 61 64 65 20 70 fined and made p
5720: 75 62 6c 69 63 20 69 6e 20 74 63 6c 2e 68 20 74 ublic in tcl.h t
5730: 6f 20 73 75 70 70 6f 72 74 20 54 63 6c 5f 44 65 o support Tcl_De
5740: 63 72 52 65 66 43 6f 75 6e 74 27 73 20 6d 61 63 crRefCount's mac
5750: 72 6f 0a 20 2a 20 64 65 66 69 6e 69 74 69 6f 6e ro. * definition
5760: 2e 20 4e 6f 74 65 20 61 6c 73 6f 20 74 68 61 74 . Note also that
5770: 20 54 63 6c 5f 44 65 63 72 52 65 66 43 6f 75 6e Tcl_DecrRefCoun
5780: 74 28 29 20 72 65 66 65 72 73 20 74 6f 20 74 68 t() refers to th
5790: 65 20 70 61 72 61 6d 65 74 65 72 0a 20 2a 20 22 e parameter. * "
57a0: 6f 62 6a 22 20 74 77 69 63 65 2e 20 54 68 69 73 obj" twice. This
57b0: 20 6d 65 61 6e 73 20 74 68 61 74 20 79 6f 75 20 means that you
57c0: 73 68 6f 75 6c 64 20 61 76 6f 69 64 20 63 61 6c should avoid cal
57d0: 6c 69 6e 67 20 69 74 20 77 69 74 68 20 61 6e 0a ling it with an.
57e0: 20 2a 20 65 78 70 72 65 73 73 69 6f 6e 20 74 68 * expression th
57f0: 61 74 20 69 73 20 65 78 70 65 6e 73 69 76 65 20 at is expensive
5800: 74 6f 20 63 6f 6d 70 75 74 65 20 6f 72 20 68 61 to compute or ha
5810: 73 20 73 69 64 65 20 65 66 66 65 63 74 73 2e 0a s side effects..
5820: 20 2a 2f 0a 0a 76 6f 69 64 09 09 54 63 6c 5f 49 */..void..Tcl_I
5830: 6e 63 72 52 65 66 43 6f 75 6e 74 20 5f 41 4e 53 ncrRefCount _ANS
5840: 49 5f 41 52 47 53 5f 28 28 54 63 6c 5f 4f 62 6a I_ARGS_((Tcl_Obj
5850: 20 2a 6f 62 6a 50 74 72 29 29 3b 0a 76 6f 69 64 *objPtr));.void
5860: 09 09 54 63 6c 5f 44 65 63 72 52 65 66 43 6f 75 ..Tcl_DecrRefCou
5870: 6e 74 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 nt _ANSI_ARGS_((
5880: 54 63 6c 5f 4f 62 6a 20 2a 6f 62 6a 50 74 72 29 Tcl_Obj *objPtr)
5890: 29 3b 0a 69 6e 74 09 09 54 63 6c 5f 49 73 53 68 );.int..Tcl_IsSh
58a0: 61 72 65 64 20 5f 41 4e 53 49 5f 41 52 47 53 5f ared _ANSI_ARGS_
58b0: 28 28 54 63 6c 5f 4f 62 6a 20 2a 6f 62 6a 50 74 ((Tcl_Obj *objPt
58c0: 72 29 29 3b 0a 0a 23 69 66 64 65 66 20 54 43 4c r));..#ifdef TCL
58d0: 5f 4d 45 4d 5f 44 45 42 55 47 0a 23 20 20 20 64 _MEM_DEBUG.# d
58e0: 65 66 69 6e 65 20 54 63 6c 5f 49 6e 63 72 52 65 efine Tcl_IncrRe
58f0: 66 43 6f 75 6e 74 28 6f 62 6a 50 74 72 29 20 5c fCount(objPtr) \
5900: 0a 09 54 63 6c 5f 44 62 49 6e 63 72 52 65 66 43 ..Tcl_DbIncrRefC
5910: 6f 75 6e 74 28 6f 62 6a 50 74 72 2c 20 5f 5f 46 ount(objPtr, __F
5920: 49 4c 45 5f 5f 2c 20 5f 5f 4c 49 4e 45 5f 5f 29 ILE__, __LINE__)
5930: 0a 23 20 20 20 64 65 66 69 6e 65 20 54 63 6c 5f .# define Tcl_
5940: 44 65 63 72 52 65 66 43 6f 75 6e 74 28 6f 62 6a DecrRefCount(obj
5950: 50 74 72 29 20 5c 0a 09 54 63 6c 5f 44 62 44 65 Ptr) \..Tcl_DbDe
5960: 63 72 52 65 66 43 6f 75 6e 74 28 6f 62 6a 50 74 crRefCount(objPt
5970: 72 2c 20 5f 5f 46 49 4c 45 5f 5f 2c 20 5f 5f 4c r, __FILE__, __L
5980: 49 4e 45 5f 5f 29 0a 23 20 20 20 64 65 66 69 6e INE__).# defin
5990: 65 20 54 63 6c 5f 49 73 53 68 61 72 65 64 28 6f e Tcl_IsShared(o
59a0: 62 6a 50 74 72 29 20 5c 0a 09 54 63 6c 5f 44 62 bjPtr) \..Tcl_Db
59b0: 49 73 53 68 61 72 65 64 28 6f 62 6a 50 74 72 2c IsShared(objPtr,
59c0: 20 5f 5f 46 49 4c 45 5f 5f 2c 20 5f 5f 4c 49 4e __FILE__, __LIN
59d0: 45 5f 5f 29 0a 23 65 6c 73 65 0a 23 20 20 20 64 E__).#else.# d
59e0: 65 66 69 6e 65 20 54 63 6c 5f 49 6e 63 72 52 65 efine Tcl_IncrRe
59f0: 66 43 6f 75 6e 74 28 6f 62 6a 50 74 72 29 20 5c fCount(objPtr) \
5a00: 0a 09 2b 2b 28 6f 62 6a 50 74 72 29 2d 3e 72 65 ..++(objPtr)->re
5a10: 66 43 6f 75 6e 74 0a 23 20 20 20 64 65 66 69 6e fCount.# defin
5a20: 65 20 54 63 6c 5f 44 65 63 72 52 65 66 43 6f 75 e Tcl_DecrRefCou
5a30: 6e 74 28 6f 62 6a 50 74 72 29 20 5c 0a 09 69 66 nt(objPtr) \..if
5a40: 20 28 2d 2d 28 6f 62 6a 50 74 72 29 2d 3e 72 65 (--(objPtr)->re
5a50: 66 43 6f 75 6e 74 20 3c 3d 20 30 29 20 54 63 6c fCount <= 0) Tcl
5a60: 46 72 65 65 4f 62 6a 28 6f 62 6a 50 74 72 29 0a FreeObj(objPtr).
5a70: 23 20 20 20 64 65 66 69 6e 65 20 54 63 6c 5f 49 # define Tcl_I
5a80: 73 53 68 61 72 65 64 28 6f 62 6a 50 74 72 29 20 sShared(objPtr)
5a90: 5c 0a 09 28 28 6f 62 6a 50 74 72 29 2d 3e 72 65 \..((objPtr)->re
5aa0: 66 43 6f 75 6e 74 20 3e 20 31 29 0a 23 65 6e 64 fCount > 1).#end
5ab0: 69 66 0a 0a 2f 2a 0a 20 2a 20 4d 61 63 72 6f 73 if../*. * Macros
5ac0: 20 61 6e 64 20 64 65 66 69 6e 69 74 69 6f 6e 73 and definitions
5ad0: 20 74 68 61 74 20 68 65 6c 70 20 74 6f 20 64 65 that help to de
5ae0: 62 75 67 20 74 68 65 20 75 73 65 20 6f 66 20 54 bug the use of T
5af0: 63 6c 20 6f 62 6a 65 63 74 73 2e 0a 20 2a 20 57 cl objects.. * W
5b00: 68 65 6e 20 54 43 4c 5f 4d 45 4d 5f 44 45 42 55 hen TCL_MEM_DEBU
5b10: 47 20 69 73 20 64 65 66 69 6e 65 64 2c 20 74 68 G is defined, th
5b20: 65 20 54 63 6c 5f 4e 65 77 20 64 65 63 6c 61 72 e Tcl_New declar
5b30: 61 74 69 6f 6e 73 20 61 72 65 20 0a 20 2a 20 6f ations are . * o
5b40: 76 65 72 72 69 64 64 65 6e 20 74 6f 20 63 61 6c verridden to cal
5b50: 6c 20 64 65 62 75 67 67 69 6e 67 20 76 65 72 73 l debugging vers
5b60: 69 6f 6e 73 20 6f 66 20 74 68 65 20 6f 62 6a 65 ions of the obje
5b70: 63 74 20 63 72 65 61 74 69 6f 6e 20 70 72 6f 63 ct creation proc
5b80: 65 64 75 72 65 73 2e 0a 20 2a 2f 0a 0a 23 69 66 edures.. */..#if
5b90: 64 65 66 20 54 43 4c 5f 4d 45 4d 5f 44 45 42 55 def TCL_MEM_DEBU
5ba0: 47 0a 23 20 20 64 65 66 69 6e 65 20 54 63 6c 5f G.# define Tcl_
5bb0: 4e 65 77 42 6f 6f 6c 65 61 6e 4f 62 6a 28 76 61 NewBooleanObj(va
5bc0: 6c 29 20 5c 0a 20 20 20 20 20 54 63 6c 5f 44 62 l) \. Tcl_Db
5bd0: 4e 65 77 42 6f 6f 6c 65 61 6e 4f 62 6a 28 76 61 NewBooleanObj(va
5be0: 6c 2c 20 5f 5f 46 49 4c 45 5f 5f 2c 20 5f 5f 4c l, __FILE__, __L
5bf0: 49 4e 45 5f 5f 29 0a 23 20 20 64 65 66 69 6e 65 INE__).# define
5c00: 20 54 63 6c 5f 4e 65 77 42 79 74 65 41 72 72 61 Tcl_NewByteArra
5c10: 79 4f 62 6a 28 62 79 74 65 73 2c 20 6c 65 6e 29 yObj(bytes, len)
5c20: 20 5c 0a 20 20 20 20 20 54 63 6c 5f 44 62 4e 65 \. Tcl_DbNe
5c30: 77 42 79 74 65 41 72 72 61 79 4f 62 6a 28 62 79 wByteArrayObj(by
5c40: 74 65 73 2c 20 6c 65 6e 2c 20 5f 5f 46 49 4c 45 tes, len, __FILE
5c50: 5f 5f 2c 20 5f 5f 4c 49 4e 45 5f 5f 29 0a 23 20 __, __LINE__).#
5c60: 20 64 65 66 69 6e 65 20 54 63 6c 5f 4e 65 77 44 define Tcl_NewD
5c70: 6f 75 62 6c 65 4f 62 6a 28 76 61 6c 29 20 5c 0a oubleObj(val) \.
5c80: 20 20 20 20 20 54 63 6c 5f 44 62 4e 65 77 44 6f Tcl_DbNewDo
5c90: 75 62 6c 65 4f 62 6a 28 76 61 6c 2c 20 5f 5f 46 ubleObj(val, __F
5ca0: 49 4c 45 5f 5f 2c 20 5f 5f 4c 49 4e 45 5f 5f 29 ILE__, __LINE__)
5cb0: 0a 23 20 20 64 65 66 69 6e 65 20 54 63 6c 5f 4e .# define Tcl_N
5cc0: 65 77 49 6e 74 4f 62 6a 28 76 61 6c 29 20 5c 0a ewIntObj(val) \.
5cd0: 20 20 20 20 20 54 63 6c 5f 44 62 4e 65 77 4c 6f Tcl_DbNewLo
5ce0: 6e 67 4f 62 6a 28 76 61 6c 2c 20 5f 5f 46 49 4c ngObj(val, __FIL
5cf0: 45 5f 5f 2c 20 5f 5f 4c 49 4e 45 5f 5f 29 0a 23 E__, __LINE__).#
5d00: 20 20 64 65 66 69 6e 65 20 54 63 6c 5f 4e 65 77 define Tcl_New
5d10: 4c 69 73 74 4f 62 6a 28 6f 62 6a 63 2c 20 6f 62 ListObj(objc, ob
5d20: 6a 76 29 20 5c 0a 20 20 20 20 20 54 63 6c 5f 44 jv) \. Tcl_D
5d30: 62 4e 65 77 4c 69 73 74 4f 62 6a 28 6f 62 6a 63 bNewListObj(objc
5d40: 2c 20 6f 62 6a 76 2c 20 5f 5f 46 49 4c 45 5f 5f , objv, __FILE__
5d50: 2c 20 5f 5f 4c 49 4e 45 5f 5f 29 0a 23 20 20 64 , __LINE__).# d
5d60: 65 66 69 6e 65 20 54 63 6c 5f 4e 65 77 4c 6f 6e efine Tcl_NewLon
5d70: 67 4f 62 6a 28 76 61 6c 29 20 5c 0a 20 20 20 20 gObj(val) \.
5d80: 20 54 63 6c 5f 44 62 4e 65 77 4c 6f 6e 67 4f 62 Tcl_DbNewLongOb
5d90: 6a 28 76 61 6c 2c 20 5f 5f 46 49 4c 45 5f 5f 2c j(val, __FILE__,
5da0: 20 5f 5f 4c 49 4e 45 5f 5f 29 0a 23 20 20 64 65 __LINE__).# de
5db0: 66 69 6e 65 20 54 63 6c 5f 4e 65 77 4f 62 6a 28 fine Tcl_NewObj(
5dc0: 29 20 5c 0a 20 20 20 20 20 54 63 6c 5f 44 62 4e ) \. Tcl_DbN
5dd0: 65 77 4f 62 6a 28 5f 5f 46 49 4c 45 5f 5f 2c 20 ewObj(__FILE__,
5de0: 5f 5f 4c 49 4e 45 5f 5f 29 0a 23 20 20 64 65 66 __LINE__).# def
5df0: 69 6e 65 20 54 63 6c 5f 4e 65 77 53 74 72 69 6e ine Tcl_NewStrin
5e00: 67 4f 62 6a 28 62 79 74 65 73 2c 20 6c 65 6e 29 gObj(bytes, len)
5e10: 20 5c 0a 20 20 20 20 20 54 63 6c 5f 44 62 4e 65 \. Tcl_DbNe
5e20: 77 53 74 72 69 6e 67 4f 62 6a 28 62 79 74 65 73 wStringObj(bytes
5e30: 2c 20 6c 65 6e 2c 20 5f 5f 46 49 4c 45 5f 5f 2c , len, __FILE__,
5e40: 20 5f 5f 4c 49 4e 45 5f 5f 29 0a 23 65 6e 64 69 __LINE__).#endi
5e50: 66 20 2f 2a 20 54 43 4c 5f 4d 45 4d 5f 44 45 42 f /* TCL_MEM_DEB
5e60: 55 47 20 2a 2f 0a 0a 2f 2a 0a 20 2a 20 54 68 65 UG */../*. * The
5e70: 20 66 6f 6c 6c 6f 77 69 6e 67 20 73 74 72 75 63 following struc
5e80: 74 75 72 65 20 63 6f 6e 74 61 69 6e 73 20 74 68 ture contains th
5e90: 65 20 73 74 61 74 65 20 6e 65 65 64 65 64 20 62 e state needed b
5ea0: 79 0a 20 2a 20 54 63 6c 5f 53 61 76 65 52 65 73 y. * Tcl_SaveRes
5eb0: 75 6c 74 2e 20 20 4e 6f 2d 6f 6e 65 20 6f 75 74 ult. No-one out
5ec0: 73 69 64 65 20 6f 66 20 54 63 6c 20 73 68 6f 75 side of Tcl shou
5ed0: 6c 64 20 61 63 63 65 73 73 20 61 6e 79 20 6f 66 ld access any of
5ee0: 20 74 68 65 73 65 0a 20 2a 20 66 69 65 6c 64 73 these. * fields
5ef0: 2e 20 20 54 68 69 73 20 73 74 72 75 63 74 75 72 . This structur
5f00: 65 20 69 73 20 74 79 70 69 63 61 6c 6c 79 20 61 e is typically a
5f10: 6c 6c 6f 63 61 74 65 64 20 6f 6e 20 74 68 65 20 llocated on the
5f20: 73 74 61 63 6b 2e 0a 20 2a 2f 0a 0a 74 79 70 65 stack.. */..type
5f30: 64 65 66 20 73 74 72 75 63 74 20 54 63 6c 5f 53 def struct Tcl_S
5f40: 61 76 65 64 52 65 73 75 6c 74 20 7b 0a 20 20 20 avedResult {.
5f50: 20 63 68 61 72 20 2a 72 65 73 75 6c 74 3b 0a 20 char *result;.
5f60: 20 20 20 54 63 6c 5f 46 72 65 65 50 72 6f 63 20 Tcl_FreeProc
5f70: 2a 66 72 65 65 50 72 6f 63 3b 0a 20 20 20 20 54 *freeProc;. T
5f80: 63 6c 5f 4f 62 6a 20 2a 6f 62 6a 52 65 73 75 6c cl_Obj *objResul
5f90: 74 50 74 72 3b 0a 20 20 20 20 63 68 61 72 20 2a tPtr;. char *
5fa0: 61 70 70 65 6e 64 52 65 73 75 6c 74 3b 0a 20 20 appendResult;.
5fb0: 20 20 69 6e 74 20 61 70 70 65 6e 64 41 76 6c 3b int appendAvl;
5fc0: 0a 20 20 20 20 69 6e 74 20 61 70 70 65 6e 64 55 . int appendU
5fd0: 73 65 64 3b 0a 20 20 20 20 63 68 61 72 20 72 65 sed;. char re
5fe0: 73 75 6c 74 53 70 61 63 65 5b 54 43 4c 5f 52 45 sultSpace[TCL_RE
5ff0: 53 55 4c 54 5f 53 49 5a 45 2b 31 5d 3b 0a 7d 20 SULT_SIZE+1];.}
6000: 54 63 6c 5f 53 61 76 65 64 52 65 73 75 6c 74 3b Tcl_SavedResult;
6010: 0a 0a 0a 2f 2a 0a 20 2a 20 54 68 65 20 66 6f 6c .../*. * The fol
6020: 6c 6f 77 69 6e 67 20 64 65 66 69 6e 69 74 69 6f lowing definitio
6030: 6e 73 20 73 75 70 70 6f 72 74 20 54 63 6c 27 73 ns support Tcl's
6040: 20 6e 61 6d 65 73 70 61 63 65 20 66 61 63 69 6c namespace facil
6050: 69 74 79 2e 0a 20 2a 20 4e 6f 74 65 3a 20 74 68 ity.. * Note: th
6060: 65 20 66 69 72 73 74 20 66 69 76 65 20 66 69 65 e first five fie
6070: 6c 64 73 20 6d 75 73 74 20 6d 61 74 63 68 20 65 lds must match e
6080: 78 61 63 74 6c 79 20 74 68 65 20 66 69 65 6c 64 xactly the field
6090: 73 20 69 6e 20 61 0a 20 2a 20 4e 61 6d 65 73 70 s in a. * Namesp
60a0: 61 63 65 20 73 74 72 75 63 74 75 72 65 20 28 73 ace structure (s
60b0: 65 65 20 74 63 6c 49 6e 74 2e 68 29 2e 20 0a 20 ee tclInt.h). .
60c0: 2a 2f 0a 0a 74 79 70 65 64 65 66 20 73 74 72 75 */..typedef stru
60d0: 63 74 20 54 63 6c 5f 4e 61 6d 65 73 70 61 63 65 ct Tcl_Namespace
60e0: 20 7b 0a 20 20 20 20 63 68 61 72 20 2a 6e 61 6d {. char *nam
60f0: 65 3b 20 20 20 20 20 20 20 20 20 20 20 20 20 20 e;
6100: 20 20 20 2f 2a 20 54 68 65 20 6e 61 6d 65 73 70 /* The namesp
6110: 61 63 65 27 73 20 6e 61 6d 65 20 77 69 74 68 69 ace's name withi
6120: 6e 20 69 74 73 20 70 61 72 65 6e 74 0a 09 09 09 n its parent....
6130: 09 20 2a 20 6e 61 6d 65 73 70 61 63 65 2e 20 54 . * namespace. T
6140: 68 69 73 20 63 6f 6e 74 61 69 6e 73 20 6e 6f 20 his contains no
6150: 3a 3a 27 73 2e 20 54 68 65 0a 09 09 09 09 20 2a ::'s. The..... *
6160: 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 67 6c 6f name of the glo
6170: 62 61 6c 20 6e 61 6d 65 73 70 61 63 65 20 69 73 bal namespace is
6180: 20 22 22 0a 09 09 09 09 20 2a 20 61 6c 74 68 6f ""..... * altho
6190: 75 67 68 20 22 3a 3a 22 20 69 73 20 61 6e 20 73 ugh "::" is an s
61a0: 79 6e 6f 6e 79 6d 2e 20 2a 2f 0a 20 20 20 20 63 ynonym. */. c
61b0: 68 61 72 20 2a 66 75 6c 6c 4e 61 6d 65 3b 20 20 har *fullName;
61c0: 20 20 20 20 20 20 20 20 20 20 20 2f 2a 20 54 68 /* Th
61d0: 65 20 6e 61 6d 65 73 70 61 63 65 27 73 20 66 75 e namespace's fu
61e0: 6c 6c 79 20 71 75 61 6c 69 66 69 65 64 20 6e 61 lly qualified na
61f0: 6d 65 2e 0a 09 09 09 09 20 2a 20 54 68 69 73 20 me...... * This
6200: 73 74 61 72 74 73 20 77 69 74 68 20 3a 3a 2e 20 starts with ::.
6210: 2a 2f 0a 20 20 20 20 43 6c 69 65 6e 74 44 61 74 */. ClientDat
6220: 61 20 63 6c 69 65 6e 74 44 61 74 61 3b 20 20 20 a clientData;
6230: 20 20 20 2f 2a 20 41 72 62 69 74 72 61 72 79 20 /* Arbitrary
6240: 76 61 6c 75 65 20 61 73 73 6f 63 69 61 74 65 64 value associated
6250: 20 77 69 74 68 20 74 68 69 73 0a 09 09 09 09 20 with this.....
6260: 2a 20 6e 61 6d 65 73 70 61 63 65 2e 20 2a 2f 0a * namespace. */.
6270: 20 20 20 20 54 63 6c 5f 4e 61 6d 65 73 70 61 63 Tcl_Namespac
6280: 65 44 65 6c 65 74 65 50 72 6f 63 2a 20 64 65 6c eDeleteProc* del
6290: 65 74 65 50 72 6f 63 3b 0a 20 20 20 20 20 20 20 eteProc;.
62a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
62b0: 20 20 20 20 20 20 20 20 20 2f 2a 20 50 72 6f 63 /* Proc
62c0: 65 64 75 72 65 20 69 6e 76 6f 6b 65 64 20 77 68 edure invoked wh
62d0: 65 6e 20 64 65 6c 65 74 69 6e 67 20 74 68 65 0a en deleting the.
62e0: 09 09 09 09 20 2a 20 6e 61 6d 65 73 70 61 63 65 .... * namespace
62f0: 20 74 6f 2c 20 65 2e 67 2e 2c 20 66 72 65 65 20 to, e.g., free
6300: 63 6c 69 65 6e 74 44 61 74 61 2e 20 2a 2f 0a 20 clientData. */.
6310: 20 20 20 73 74 72 75 63 74 20 54 63 6c 5f 4e 61 struct Tcl_Na
6320: 6d 65 73 70 61 63 65 2a 20 70 61 72 65 6e 74 50 mespace* parentP
6330: 74 72 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 tr;.
6340: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
6350: 20 20 20 20 2f 2a 20 50 6f 69 6e 74 73 20 74 6f /* Points to
6360: 20 74 68 65 20 6e 61 6d 65 73 70 61 63 65 20 74 the namespace t
6370: 68 61 74 20 63 6f 6e 74 61 69 6e 73 0a 09 09 09 hat contains....
6380: 09 20 2a 20 74 68 69 73 20 6f 6e 65 2e 20 4e 55 . * this one. NU
6390: 4c 4c 20 69 66 20 74 68 69 73 20 69 73 20 74 68 LL if this is th
63a0: 65 20 67 6c 6f 62 61 6c 0a 09 09 09 09 20 2a 20 e global..... *
63b0: 6e 61 6d 65 73 70 61 63 65 2e 20 2a 2f 0a 7d 20 namespace. */.}
63c0: 54 63 6c 5f 4e 61 6d 65 73 70 61 63 65 3b 0a 0a Tcl_Namespace;..
63d0: 2f 2a 0a 20 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 /*. * The follow
63e0: 69 6e 67 20 73 74 72 75 63 74 75 72 65 20 72 65 ing structure re
63f0: 70 72 65 73 65 6e 74 73 20 61 20 63 61 6c 6c 20 presents a call
6400: 66 72 61 6d 65 2c 20 6f 72 20 61 63 74 69 76 61 frame, or activa
6410: 74 69 6f 6e 20 72 65 63 6f 72 64 2e 0a 20 2a 20 tion record.. *
6420: 41 20 63 61 6c 6c 20 66 72 61 6d 65 20 64 65 66 A call frame def
6430: 69 6e 65 73 20 61 20 6e 61 6d 69 6e 67 20 63 6f ines a naming co
6440: 6e 74 65 78 74 20 66 6f 72 20 61 20 70 72 6f 63 ntext for a proc
6450: 65 64 75 72 65 20 63 61 6c 6c 3a 20 69 74 73 20 edure call: its
6460: 6c 6f 63 61 6c 0a 20 2a 20 73 63 6f 70 65 20 28 local. * scope (
6470: 66 6f 72 20 6c 6f 63 61 6c 20 76 61 72 69 61 62 for local variab
6480: 6c 65 73 29 20 61 6e 64 20 69 74 73 20 6e 61 6d les) and its nam
6490: 65 73 70 61 63 65 20 73 63 6f 70 65 20 28 75 73 espace scope (us
64a0: 65 64 20 66 6f 72 20 6e 6f 6e 2d 6c 6f 63 61 6c ed for non-local
64b0: 0a 20 2a 20 76 61 72 69 61 62 6c 65 73 3b 20 6f . * variables; o
64c0: 66 74 65 6e 20 74 68 65 20 67 6c 6f 62 61 6c 20 ften the global
64d0: 3a 3a 20 6e 61 6d 65 73 70 61 63 65 29 2e 20 41 :: namespace). A
64e0: 20 63 61 6c 6c 20 66 72 61 6d 65 20 63 61 6e 20 call frame can
64f0: 61 6c 73 6f 20 64 65 66 69 6e 65 0a 20 2a 20 74 also define. * t
6500: 68 65 20 6e 61 6d 69 6e 67 20 63 6f 6e 74 65 78 he naming contex
6510: 74 20 66 6f 72 20 61 20 6e 61 6d 65 73 70 61 63 t for a namespac
6520: 65 20 65 76 61 6c 20 6f 72 20 6e 61 6d 65 73 70 e eval or namesp
6530: 61 63 65 20 69 6e 73 63 6f 70 65 20 63 6f 6d 6d ace inscope comm
6540: 61 6e 64 3a 0a 20 2a 20 74 68 65 20 6e 61 6d 65 and:. * the name
6550: 73 70 61 63 65 20 69 6e 20 77 68 69 63 68 20 74 space in which t
6560: 68 65 20 63 6f 6d 6d 61 6e 64 27 73 20 63 6f 64 he command's cod
6570: 65 20 73 68 6f 75 6c 64 20 65 78 65 63 75 74 65 e should execute
6580: 2e 20 54 68 65 0a 20 2a 20 54 63 6c 5f 43 61 6c . The. * Tcl_Cal
6590: 6c 46 72 61 6d 65 20 73 74 72 75 63 74 75 72 65 lFrame structure
65a0: 73 20 65 78 69 73 74 20 6f 6e 6c 79 20 77 68 69 s exist only whi
65b0: 6c 65 20 70 72 6f 63 65 64 75 72 65 73 20 6f 72 le procedures or
65c0: 20 6e 61 6d 65 73 70 61 63 65 0a 20 2a 20 65 76 namespace. * ev
65d0: 61 6c 2f 69 6e 73 63 6f 70 65 27 73 20 61 72 65 al/inscope's are
65e0: 20 62 65 69 6e 67 20 65 78 65 63 75 74 65 64 2c being executed,
65f0: 20 61 6e 64 20 70 72 6f 76 69 64 65 20 61 20 54 and provide a T
6600: 63 6c 20 63 61 6c 6c 20 73 74 61 63 6b 2e 0a 20 cl call stack..
6610: 2a 20 0a 20 2a 20 41 20 63 61 6c 6c 20 66 72 61 * . * A call fra
6620: 6d 65 20 69 73 20 69 6e 69 74 69 61 6c 69 7a 65 me is initialize
6630: 64 20 61 6e 64 20 70 75 73 68 65 64 20 75 73 69 d and pushed usi
6640: 6e 67 20 54 63 6c 5f 50 75 73 68 43 61 6c 6c 46 ng Tcl_PushCallF
6650: 72 61 6d 65 20 61 6e 64 0a 20 2a 20 70 6f 70 70 rame and. * popp
6660: 65 64 20 75 73 69 6e 67 20 54 63 6c 5f 50 6f 70 ed using Tcl_Pop
6670: 43 61 6c 6c 46 72 61 6d 65 2e 20 53 74 6f 72 61 CallFrame. Stora
6680: 67 65 20 66 6f 72 20 61 20 54 63 6c 5f 43 61 6c ge for a Tcl_Cal
6690: 6c 46 72 61 6d 65 20 6d 75 73 74 20 62 65 0a 20 lFrame must be.
66a0: 2a 20 70 72 6f 76 69 64 65 64 20 62 79 20 74 68 * provided by th
66b0: 65 20 54 63 6c 5f 50 75 73 68 43 61 6c 6c 46 72 e Tcl_PushCallFr
66c0: 61 6d 65 20 63 61 6c 6c 65 72 2c 20 61 6e 64 20 ame caller, and
66d0: 63 61 6c 6c 65 72 73 20 74 79 70 69 63 61 6c 6c callers typicall
66e0: 79 20 61 6c 6c 6f 63 61 74 65 0a 20 2a 20 74 68 y allocate. * th
66f0: 65 6d 20 6f 6e 20 74 68 65 20 43 20 63 61 6c 6c em on the C call
6700: 20 73 74 61 63 6b 20 66 6f 72 20 65 66 66 69 63 stack for effic
6710: 69 65 6e 63 79 2e 20 46 6f 72 20 74 68 69 73 20 iency. For this
6720: 72 65 61 73 6f 6e 2c 20 54 63 6c 5f 43 61 6c 6c reason, Tcl_Call
6730: 46 72 61 6d 65 0a 20 2a 20 69 73 20 64 65 66 69 Frame. * is defi
6740: 6e 65 64 20 61 73 20 61 20 73 74 72 75 63 74 75 ned as a structu
6750: 72 65 20 61 6e 64 20 6e 6f 74 20 61 73 20 61 6e re and not as an
6760: 20 6f 70 61 71 75 65 20 74 6f 6b 65 6e 2e 20 48 opaque token. H
6770: 6f 77 65 76 65 72 2c 20 6d 6f 73 74 0a 20 2a 20 owever, most. *
6780: 54 63 6c 5f 43 61 6c 6c 46 72 61 6d 65 20 66 69 Tcl_CallFrame fi
6790: 65 6c 64 73 20 61 72 65 20 68 69 64 64 65 6e 20 elds are hidden
67a0: 73 69 6e 63 65 20 61 70 70 6c 69 63 61 74 69 6f since applicatio
67b0: 6e 73 20 73 68 6f 75 6c 64 20 6e 6f 74 20 61 63 ns should not ac
67c0: 63 65 73 73 0a 20 2a 20 74 68 65 6d 20 64 69 72 cess. * them dir
67d0: 65 63 74 6c 79 3b 20 6f 74 68 65 72 73 20 61 72 ectly; others ar
67e0: 65 20 64 65 63 6c 61 72 65 64 20 61 73 20 22 64 e declared as "d
67f0: 75 6d 6d 79 58 22 2e 0a 20 2a 0a 20 2a 20 57 41 ummyX".. *. * WA
6800: 52 4e 49 4e 47 21 21 20 54 68 65 20 73 74 72 75 RNING!! The stru
6810: 63 74 75 72 65 20 64 65 66 69 6e 69 74 69 6f 6e cture definition
6820: 20 6d 75 73 74 20 62 65 20 6b 65 70 74 20 63 6f must be kept co
6830: 6e 73 69 73 74 65 6e 74 20 77 69 74 68 20 74 68 nsistent with th
6840: 65 0a 20 2a 20 43 61 6c 6c 46 72 61 6d 65 20 73 e. * CallFrame s
6850: 74 72 75 63 74 75 72 65 20 69 6e 20 74 63 6c 49 tructure in tclI
6860: 6e 74 2e 68 2e 20 49 66 20 79 6f 75 20 63 68 61 nt.h. If you cha
6870: 6e 67 65 20 6f 6e 65 2c 20 63 68 61 6e 67 65 20 nge one, change
6880: 74 68 65 20 6f 74 68 65 72 2e 0a 20 2a 2f 0a 0a the other.. */..
6890: 74 79 70 65 64 65 66 20 73 74 72 75 63 74 20 54 typedef struct T
68a0: 63 6c 5f 43 61 6c 6c 46 72 61 6d 65 20 7b 0a 20 cl_CallFrame {.
68b0: 20 20 20 54 63 6c 5f 4e 61 6d 65 73 70 61 63 65 Tcl_Namespace
68c0: 20 2a 6e 73 50 74 72 3b 0a 20 20 20 20 69 6e 74 *nsPtr;. int
68d0: 20 64 75 6d 6d 79 31 3b 0a 20 20 20 20 69 6e 74 dummy1;. int
68e0: 20 64 75 6d 6d 79 32 3b 0a 20 20 20 20 63 68 61 dummy2;. cha
68f0: 72 20 2a 64 75 6d 6d 79 33 3b 0a 20 20 20 20 63 r *dummy3;. c
6900: 68 61 72 20 2a 64 75 6d 6d 79 34 3b 0a 20 20 20 har *dummy4;.
6910: 20 63 68 61 72 20 2a 64 75 6d 6d 79 35 3b 0a 20 char *dummy5;.
6920: 20 20 20 69 6e 74 20 64 75 6d 6d 79 36 3b 0a 20 int dummy6;.
6930: 20 20 20 63 68 61 72 20 2a 64 75 6d 6d 79 37 3b char *dummy7;
6940: 0a 20 20 20 20 63 68 61 72 20 2a 64 75 6d 6d 79 . char *dummy
6950: 38 3b 0a 20 20 20 20 69 6e 74 20 64 75 6d 6d 79 8;. int dummy
6960: 39 3b 0a 20 20 20 20 63 68 61 72 2a 20 64 75 6d 9;. char* dum
6970: 6d 79 31 30 3b 0a 7d 20 54 63 6c 5f 43 61 6c 6c my10;.} Tcl_Call
6980: 46 72 61 6d 65 3b 0a 0a 2f 2a 0a 20 2a 20 49 6e Frame;../*. * In
6990: 66 6f 72 6d 61 74 69 6f 6e 20 61 62 6f 75 74 20 formation about
69a0: 63 6f 6d 6d 61 6e 64 73 20 74 68 61 74 20 69 73 commands that is
69b0: 20 72 65 74 75 72 6e 65 64 20 62 79 20 54 63 6c returned by Tcl
69c0: 5f 47 65 74 43 6f 6d 6d 61 6e 64 49 6e 66 6f 20 _GetCommandInfo
69d0: 61 6e 64 0a 20 2a 20 70 61 73 73 65 64 20 74 6f and. * passed to
69e0: 20 54 63 6c 5f 53 65 74 43 6f 6d 6d 61 6e 64 49 Tcl_SetCommandI
69f0: 6e 66 6f 2e 20 6f 62 6a 50 72 6f 63 20 69 73 20 nfo. objProc is
6a00: 61 6e 20 6f 62 6a 63 2f 6f 62 6a 76 20 6f 62 6a an objc/objv obj
6a10: 65 63 74 2d 62 61 73 65 64 0a 20 2a 20 63 6f 6d ect-based. * com
6a20: 6d 61 6e 64 20 70 72 6f 63 65 64 75 72 65 20 77 mand procedure w
6a30: 68 69 6c 65 20 70 72 6f 63 20 69 73 20 61 20 74 hile proc is a t
6a40: 72 61 64 69 74 69 6f 6e 61 6c 20 54 63 6c 20 61 raditional Tcl a
6a50: 72 67 63 2f 61 72 67 76 0a 20 2a 20 73 74 72 69 rgc/argv. * stri
6a60: 6e 67 2d 62 61 73 65 64 20 70 72 6f 63 65 64 75 ng-based procedu
6a70: 72 65 2e 20 54 63 6c 5f 43 72 65 61 74 65 4f 62 re. Tcl_CreateOb
6a80: 6a 43 6f 6d 6d 61 6e 64 20 61 6e 64 20 54 63 6c jCommand and Tcl
6a90: 5f 43 72 65 61 74 65 43 6f 6d 6d 61 6e 64 0a 20 _CreateCommand.
6aa0: 2a 20 65 6e 73 75 72 65 20 74 68 61 74 20 62 6f * ensure that bo
6ab0: 74 68 20 6f 62 6a 50 72 6f 63 20 61 6e 64 20 70 th objProc and p
6ac0: 72 6f 63 20 61 72 65 20 6e 6f 6e 2d 4e 55 4c 4c roc are non-NULL
6ad0: 20 61 6e 64 20 63 61 6e 20 62 65 20 63 61 6c 6c and can be call
6ae0: 65 64 20 74 6f 0a 20 2a 20 65 78 65 63 75 74 65 ed to. * execute
6af0: 20 74 68 65 20 63 6f 6d 6d 61 6e 64 2e 20 48 6f the command. Ho
6b00: 77 65 76 65 72 2c 20 69 74 20 6d 61 79 20 62 65 wever, it may be
6b10: 20 66 61 73 74 65 72 20 74 6f 20 63 61 6c 6c 20 faster to call
6b20: 6f 6e 65 20 69 6e 73 74 65 61 64 20 6f 66 0a 20 one instead of.
6b30: 2a 20 74 68 65 20 6f 74 68 65 72 2e 20 54 68 65 * the other. The
6b40: 20 6d 65 6d 62 65 72 20 69 73 4e 61 74 69 76 65 member isNative
6b50: 4f 62 6a 65 63 74 50 72 6f 63 20 69 73 20 73 65 ObjectProc is se
6b60: 74 20 74 6f 20 31 20 69 66 20 61 6e 0a 20 2a 20 t to 1 if an. *
6b70: 6f 62 6a 65 63 74 2d 62 61 73 65 64 20 70 72 6f object-based pro
6b80: 63 65 64 75 72 65 20 77 61 73 20 72 65 67 69 73 cedure was regis
6b90: 74 65 72 65 64 20 62 79 20 54 63 6c 5f 43 72 65 tered by Tcl_Cre
6ba0: 61 74 65 4f 62 6a 43 6f 6d 6d 61 6e 64 2c 20 61 ateObjCommand, a
6bb0: 6e 64 20 74 6f 0a 20 2a 20 30 20 69 66 20 61 20 nd to. * 0 if a
6bc0: 73 74 72 69 6e 67 2d 62 61 73 65 64 20 70 72 6f string-based pro
6bd0: 63 65 64 75 72 65 20 77 61 73 20 72 65 67 69 73 cedure was regis
6be0: 74 65 72 65 64 20 62 79 20 54 63 6c 5f 43 72 65 tered by Tcl_Cre
6bf0: 61 74 65 43 6f 6d 6d 61 6e 64 2e 0a 20 2a 20 54 ateCommand.. * T
6c00: 68 65 20 6f 74 68 65 72 20 70 72 6f 63 65 64 75 he other procedu
6c10: 72 65 20 69 73 20 74 79 70 69 63 61 6c 6c 79 20 re is typically
6c20: 73 65 74 20 74 6f 20 61 20 63 6f 6d 70 61 74 69 set to a compati
6c30: 62 69 6c 69 74 79 20 77 72 61 70 70 65 72 20 74 bility wrapper t
6c40: 68 61 74 0a 20 2a 20 64 6f 65 73 20 73 74 72 69 hat. * does stri
6c50: 6e 67 2d 74 6f 2d 6f 62 6a 65 63 74 20 6f 72 20 ng-to-object or
6c60: 6f 62 6a 65 63 74 2d 74 6f 2d 73 74 72 69 6e 67 object-to-string
6c70: 20 61 72 67 75 6d 65 6e 74 20 63 6f 6e 76 65 72 argument conver
6c80: 73 69 6f 6e 73 20 74 68 65 6e 0a 20 2a 20 63 61 sions then. * ca
6c90: 6c 6c 73 20 74 68 65 20 6f 74 68 65 72 20 70 72 lls the other pr
6ca0: 6f 63 65 64 75 72 65 2e 0a 20 2a 2f 0a 20 20 20 ocedure.. */.
6cb0: 20 20 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 .typedef struc
6cc0: 74 20 54 63 6c 5f 43 6d 64 49 6e 66 6f 20 7b 0a t Tcl_CmdInfo {.
6cd0: 20 20 20 20 69 6e 74 20 69 73 4e 61 74 69 76 65 int isNative
6ce0: 4f 62 6a 65 63 74 50 72 6f 63 3b 09 20 2f 2a 20 ObjectProc;. /*
6cf0: 31 20 69 66 20 6f 62 6a 50 72 6f 63 20 77 61 73 1 if objProc was
6d00: 20 72 65 67 69 73 74 65 72 65 64 20 62 79 20 61 registered by a
6d10: 20 63 61 6c 6c 20 74 6f 0a 09 09 09 09 20 20 2a call to..... *
6d20: 20 54 63 6c 5f 43 72 65 61 74 65 4f 62 6a 43 6f Tcl_CreateObjCo
6d30: 6d 6d 61 6e 64 3b 20 30 20 6f 74 68 65 72 77 69 mmand; 0 otherwi
6d40: 73 65 2e 0a 09 09 09 09 20 20 2a 20 54 63 6c 5f se...... * Tcl_
6d50: 53 65 74 43 6d 64 49 6e 66 6f 20 64 6f 65 73 20 SetCmdInfo does
6d60: 6e 6f 74 20 6d 6f 64 69 66 79 20 74 68 69 73 0a not modify this.
6d70: 09 09 09 09 20 20 2a 20 66 69 65 6c 64 2e 20 2a .... * field. *
6d80: 2f 0a 20 20 20 20 54 63 6c 5f 4f 62 6a 43 6d 64 /. Tcl_ObjCmd
6d90: 50 72 6f 63 20 2a 6f 62 6a 50 72 6f 63 3b 09 20 Proc *objProc;.
6da0: 2f 2a 20 43 6f 6d 6d 61 6e 64 27 73 20 6f 62 6a /* Command's obj
6db0: 65 63 74 2d 62 61 73 65 64 20 70 72 6f 63 65 64 ect-based proced
6dc0: 75 72 65 2e 20 2a 2f 0a 20 20 20 20 43 6c 69 65 ure. */. Clie
6dd0: 6e 74 44 61 74 61 20 6f 62 6a 43 6c 69 65 6e 74 ntData objClient
6de0: 44 61 74 61 3b 09 20 2f 2a 20 43 6c 69 65 6e 74 Data;. /* Client
6df0: 44 61 74 61 20 66 6f 72 20 6f 62 6a 65 63 74 20 Data for object
6e00: 70 72 6f 63 2e 20 2a 2f 0a 20 20 20 20 54 63 6c proc. */. Tcl
6e10: 5f 43 6d 64 50 72 6f 63 20 2a 70 72 6f 63 3b 09 _CmdProc *proc;.
6e20: 09 20 2f 2a 20 43 6f 6d 6d 61 6e 64 27 73 20 73 . /* Command's s
6e30: 74 72 69 6e 67 2d 62 61 73 65 64 20 70 72 6f 63 tring-based proc
6e40: 65 64 75 72 65 2e 20 2a 2f 0a 20 20 20 20 43 6c edure. */. Cl
6e50: 69 65 6e 74 44 61 74 61 20 63 6c 69 65 6e 74 44 ientData clientD
6e60: 61 74 61 3b 09 20 2f 2a 20 43 6c 69 65 6e 74 44 ata;. /* ClientD
6e70: 61 74 61 20 66 6f 72 20 73 74 72 69 6e 67 20 70 ata for string p
6e80: 72 6f 63 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f roc. */. Tcl_
6e90: 43 6d 64 44 65 6c 65 74 65 50 72 6f 63 20 2a 64 CmdDeleteProc *d
6ea0: 65 6c 65 74 65 50 72 6f 63 3b 0a 20 20 20 20 20 eleteProc;.
6eb0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
6ec0: 20 20 20 20 20 20 20 20 20 20 20 20 2f 2a 20 50 /* P
6ed0: 72 6f 63 65 64 75 72 65 20 74 6f 20 63 61 6c 6c rocedure to call
6ee0: 20 77 68 65 6e 20 63 6f 6d 6d 61 6e 64 20 69 73 when command is
6ef0: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .
6f00: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
6f10: 20 20 20 2a 20 64 65 6c 65 74 65 64 2e 20 2a 2f * deleted. */
6f20: 0a 20 20 20 20 43 6c 69 65 6e 74 44 61 74 61 20 . ClientData
6f30: 64 65 6c 65 74 65 44 61 74 61 3b 09 20 2f 2a 20 deleteData;. /*
6f40: 56 61 6c 75 65 20 74 6f 20 70 61 73 73 20 74 6f Value to pass to
6f50: 20 64 65 6c 65 74 65 50 72 6f 63 20 28 75 73 75 deleteProc (usu
6f60: 61 6c 6c 79 0a 09 09 09 09 20 20 2a 20 74 68 65 ally..... * the
6f70: 20 73 61 6d 65 20 61 73 20 63 6c 69 65 6e 74 44 same as clientD
6f80: 61 74 61 29 2e 20 2a 2f 0a 20 20 20 20 54 63 6c ata). */. Tcl
6f90: 5f 4e 61 6d 65 73 70 61 63 65 20 2a 6e 61 6d 65 _Namespace *name
6fa0: 73 70 61 63 65 50 74 72 3b 20 2f 2a 20 50 6f 69 spacePtr; /* Poi
6fb0: 6e 74 73 20 74 6f 20 74 68 65 20 6e 61 6d 65 73 nts to the names
6fc0: 70 61 63 65 20 74 68 61 74 20 63 6f 6e 74 61 69 pace that contai
6fd0: 6e 73 0a 09 09 09 09 20 20 2a 20 74 68 69 73 20 ns..... * this
6fe0: 63 6f 6d 6d 61 6e 64 2e 20 4e 6f 74 65 20 74 68 command. Note th
6ff0: 61 74 20 54 63 6c 5f 53 65 74 43 6d 64 49 6e 66 at Tcl_SetCmdInf
7000: 6f 0a 09 09 09 09 20 20 2a 20 77 69 6c 6c 20 6e o..... * will n
7010: 6f 74 20 63 68 61 6e 67 65 20 61 20 63 6f 6d 6d ot change a comm
7020: 61 6e 64 27 73 20 6e 61 6d 65 73 70 61 63 65 3b and's namespace;
7030: 0a 09 09 09 09 20 20 2a 20 75 73 65 20 54 63 6c ..... * use Tcl
7040: 5f 52 65 6e 61 6d 65 43 6f 6d 6d 61 6e 64 20 74 _RenameCommand t
7050: 6f 20 64 6f 20 74 68 61 74 2e 20 2a 2f 0a 0a 7d o do that. */..}
7060: 20 54 63 6c 5f 43 6d 64 49 6e 66 6f 3b 0a 0a 2f Tcl_CmdInfo;../
7070: 2a 0a 20 2a 20 54 68 65 20 73 74 72 75 63 74 75 *. * The structu
7080: 72 65 20 64 65 66 69 6e 65 64 20 62 65 6c 6f 77 re defined below
7090: 20 69 73 20 75 73 65 64 20 74 6f 20 68 6f 6c 64 is used to hold
70a0: 20 64 79 6e 61 6d 69 63 20 73 74 72 69 6e 67 73 dynamic strings
70b0: 2e 20 20 54 68 65 20 6f 6e 6c 79 0a 20 2a 20 66 . The only. * f
70c0: 69 65 6c 64 20 74 68 61 74 20 63 6c 69 65 6e 74 ield that client
70d0: 73 20 73 68 6f 75 6c 64 20 75 73 65 20 69 73 20 s should use is
70e0: 74 68 65 20 73 74 72 69 6e 67 20 66 69 65 6c 64 the string field
70f0: 2c 20 61 6e 64 20 74 68 65 79 20 73 68 6f 75 6c , and they shoul
7100: 64 0a 20 2a 20 6e 65 76 65 72 20 6d 6f 64 69 66 d. * never modif
7110: 79 20 69 74 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 y it.. */..#defi
7120: 6e 65 20 54 43 4c 5f 44 53 54 52 49 4e 47 5f 53 ne TCL_DSTRING_S
7130: 54 41 54 49 43 5f 53 49 5a 45 20 32 30 30 0a 74 TATIC_SIZE 200.t
7140: 79 70 65 64 65 66 20 73 74 72 75 63 74 20 54 63 ypedef struct Tc
7150: 6c 5f 44 53 74 72 69 6e 67 20 7b 0a 20 20 20 20 l_DString {.
7160: 63 68 61 72 20 2a 73 74 72 69 6e 67 3b 09 09 2f char *string;../
7170: 2a 20 50 6f 69 6e 74 73 20 74 6f 20 62 65 67 69 * Points to begi
7180: 6e 6e 69 6e 67 20 6f 66 20 73 74 72 69 6e 67 3a nning of string:
7190: 20 20 65 69 74 68 65 72 0a 09 09 09 09 20 2a 20 either..... *
71a0: 73 74 61 74 69 63 53 70 61 63 65 20 62 65 6c 6f staticSpace belo
71b0: 77 20 6f 72 20 61 20 6d 61 6c 6c 6f 63 65 64 20 w or a malloced
71c0: 61 72 72 61 79 2e 20 2a 2f 0a 20 20 20 20 69 6e array. */. in
71d0: 74 20 6c 65 6e 67 74 68 3b 09 09 09 2f 2a 20 4e t length;.../* N
71e0: 75 6d 62 65 72 20 6f 66 20 6e 6f 6e 2d 4e 55 4c umber of non-NUL
71f0: 4c 20 63 68 61 72 61 63 74 65 72 73 20 69 6e 20 L characters in
7200: 74 68 65 0a 09 09 09 09 20 2a 20 73 74 72 69 6e the..... * strin
7210: 67 2e 20 2a 2f 0a 20 20 20 20 69 6e 74 20 73 70 g. */. int sp
7220: 61 63 65 41 76 6c 3b 09 09 2f 2a 20 54 6f 74 61 aceAvl;../* Tota
7230: 6c 20 6e 75 6d 62 65 72 20 6f 66 20 62 79 74 65 l number of byte
7240: 73 20 61 76 61 69 6c 61 62 6c 65 20 66 6f 72 20 s available for
7250: 74 68 65 0a 09 09 09 09 20 2a 20 73 74 72 69 6e the..... * strin
7260: 67 20 61 6e 64 20 69 74 73 20 74 65 72 6d 69 6e g and its termin
7270: 61 74 69 6e 67 20 4e 55 4c 4c 20 63 68 61 72 2e ating NULL char.
7280: 20 2a 2f 0a 20 20 20 20 63 68 61 72 20 73 74 61 */. char sta
7290: 74 69 63 53 70 61 63 65 5b 54 43 4c 5f 44 53 54 ticSpace[TCL_DST
72a0: 52 49 4e 47 5f 53 54 41 54 49 43 5f 53 49 5a 45 RING_STATIC_SIZE
72b0: 5d 3b 0a 09 09 09 09 2f 2a 20 53 70 61 63 65 20 ];...../* Space
72c0: 74 6f 20 75 73 65 20 69 6e 20 63 6f 6d 6d 6f 6e to use in common
72d0: 20 63 61 73 65 20 77 68 65 72 65 20 73 74 72 69 case where stri
72e0: 6e 67 0a 09 09 09 09 20 2a 20 69 73 20 73 6d 61 ng..... * is sma
72f0: 6c 6c 2e 20 2a 2f 0a 7d 20 54 63 6c 5f 44 53 74 ll. */.} Tcl_DSt
7300: 72 69 6e 67 3b 0a 0a 23 64 65 66 69 6e 65 20 54 ring;..#define T
7310: 63 6c 5f 44 53 74 72 69 6e 67 4c 65 6e 67 74 68 cl_DStringLength
7320: 28 64 73 50 74 72 29 20 28 28 64 73 50 74 72 29 (dsPtr) ((dsPtr)
7330: 2d 3e 6c 65 6e 67 74 68 29 0a 23 64 65 66 69 6e ->length).#defin
7340: 65 20 54 63 6c 5f 44 53 74 72 69 6e 67 56 61 6c e Tcl_DStringVal
7350: 75 65 28 64 73 50 74 72 29 20 28 28 64 73 50 74 ue(dsPtr) ((dsPt
7360: 72 29 2d 3e 73 74 72 69 6e 67 29 0a 23 64 65 66 r)->string).#def
7370: 69 6e 65 20 54 63 6c 5f 44 53 74 72 69 6e 67 54 ine Tcl_DStringT
7380: 72 75 6e 63 20 54 63 6c 5f 44 53 74 72 69 6e 67 runc Tcl_DString
7390: 53 65 74 4c 65 6e 67 74 68 0a 0a 2f 2a 0a 20 2a SetLength../*. *
73a0: 20 44 65 66 69 6e 69 74 69 6f 6e 73 20 66 6f 72 Definitions for
73b0: 20 74 68 65 20 6d 61 78 69 6d 75 6d 20 6e 75 6d the maximum num
73c0: 62 65 72 20 6f 66 20 64 69 67 69 74 73 20 6f 66 ber of digits of
73d0: 20 70 72 65 63 69 73 69 6f 6e 20 74 68 61 74 20 precision that
73e0: 6d 61 79 0a 20 2a 20 62 65 20 73 70 65 63 69 66 may. * be specif
73f0: 69 65 64 20 69 6e 20 74 68 65 20 22 74 63 6c 5f ied in the "tcl_
7400: 70 72 65 63 69 73 69 6f 6e 22 20 76 61 72 69 61 precision" varia
7410: 62 6c 65 2c 20 61 6e 64 20 74 68 65 20 6e 75 6d ble, and the num
7420: 62 65 72 20 6f 66 0a 20 2a 20 62 79 74 65 73 20 ber of. * bytes
7430: 6f 66 20 62 75 66 66 65 72 20 73 70 61 63 65 20 of buffer space
7440: 72 65 71 75 69 72 65 64 20 62 79 20 54 63 6c 5f required by Tcl_
7450: 50 72 69 6e 74 44 6f 75 62 6c 65 2e 0a 20 2a 2f PrintDouble.. */
7460: 0a 20 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4d . .#define TCL_M
7470: 41 58 5f 50 52 45 43 20 31 37 0a 23 64 65 66 69 AX_PREC 17.#defi
7480: 6e 65 20 54 43 4c 5f 44 4f 55 42 4c 45 5f 53 50 ne TCL_DOUBLE_SP
7490: 41 43 45 20 28 54 43 4c 5f 4d 41 58 5f 50 52 45 ACE (TCL_MAX_PRE
74a0: 43 2b 31 30 29 0a 0a 2f 2a 0a 20 2a 20 44 65 66 C+10)../*. * Def
74b0: 69 6e 69 74 69 6f 6e 20 66 6f 72 20 61 20 6e 75 inition for a nu
74c0: 6d 62 65 72 20 6f 66 20 62 79 74 65 73 20 6f 66 mber of bytes of
74d0: 20 62 75 66 66 65 72 20 73 70 61 63 65 20 73 75 buffer space su
74e0: 66 66 69 63 69 65 6e 74 20 74 6f 20 68 6f 6c 64 fficient to hold
74f0: 20 74 68 65 0a 20 2a 20 73 74 72 69 6e 67 20 72 the. * string r
7500: 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 epresentation of
7510: 20 61 6e 20 69 6e 74 65 67 65 72 20 69 6e 20 62 an integer in b
7520: 61 73 65 20 31 30 20 28 61 73 73 75 6d 69 6e 67 ase 10 (assuming
7530: 20 74 68 65 20 65 78 69 73 74 65 6e 63 65 0a 20 the existence.
7540: 2a 20 6f 66 20 36 34 2d 62 69 74 20 69 6e 74 65 * of 64-bit inte
7550: 67 65 72 73 29 2e 0a 20 2a 2f 0a 0a 23 64 65 66 gers).. */..#def
7560: 69 6e 65 20 54 43 4c 5f 49 4e 54 45 47 45 52 5f ine TCL_INTEGER_
7570: 53 50 41 43 45 09 32 34 0a 0a 2f 2a 0a 20 2a 20 SPACE.24../*. *
7580: 46 6c 61 67 20 74 68 61 74 20 6d 61 79 20 62 65 Flag that may be
7590: 20 70 61 73 73 65 64 20 74 6f 20 54 63 6c 5f 43 passed to Tcl_C
75a0: 6f 6e 76 65 72 74 45 6c 65 6d 65 6e 74 20 74 6f onvertElement to
75b0: 20 66 6f 72 63 65 20 69 74 20 6e 6f 74 20 74 6f force it not to
75c0: 0a 20 2a 20 6f 75 74 70 75 74 20 62 72 61 63 65 . * output brace
75d0: 73 20 28 63 61 72 65 66 75 6c 21 20 20 69 66 20 s (careful! if
75e0: 79 6f 75 20 63 68 61 6e 67 65 20 74 68 69 73 20 you change this
75f0: 66 6c 61 67 20 62 65 20 73 75 72 65 20 74 6f 20 flag be sure to
7600: 63 68 61 6e 67 65 0a 20 2a 20 74 68 65 20 64 65 change. * the de
7610: 66 69 6e 69 74 69 6f 6e 73 20 61 74 20 74 68 65 finitions at the
7620: 20 66 72 6f 6e 74 20 6f 66 20 74 63 6c 55 74 69 front of tclUti
7630: 6c 2e 63 29 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 l.c).. */..#defi
7640: 6e 65 20 54 43 4c 5f 44 4f 4e 54 5f 55 53 45 5f ne TCL_DONT_USE_
7650: 42 52 41 43 45 53 09 31 0a 0a 2f 2a 0a 20 2a 20 BRACES.1../*. *
7660: 46 6c 61 67 20 74 68 61 74 20 6d 61 79 20 62 65 Flag that may be
7670: 20 70 61 73 73 65 64 20 74 6f 20 54 63 6c 5f 47 passed to Tcl_G
7680: 65 74 49 6e 64 65 78 46 72 6f 6d 4f 62 6a 20 74 etIndexFromObj t
7690: 6f 20 66 6f 72 63 65 20 69 74 20 74 6f 20 64 69 o force it to di
76a0: 73 61 6c 6c 6f 77 0a 20 2a 20 61 62 62 72 65 76 sallow. * abbrev
76b0: 69 61 74 65 64 20 73 74 72 69 6e 67 73 2e 0a 20 iated strings..
76c0: 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f */..#define TCL_
76d0: 45 58 41 43 54 09 31 0a 0a 2f 2a 0a 20 2a 20 46 EXACT.1../*. * F
76e0: 6c 61 67 20 76 61 6c 75 65 73 20 70 61 73 73 65 lag values passe
76f0: 64 20 74 6f 20 54 63 6c 5f 52 65 63 6f 72 64 41 d to Tcl_RecordA
7700: 6e 64 45 76 61 6c 20 61 6e 64 2f 6f 72 20 54 63 ndEval and/or Tc
7710: 6c 5f 45 76 61 6c 4f 62 6a 2e 0a 20 2a 20 57 41 l_EvalObj.. * WA
7720: 52 4e 49 4e 47 3a 20 74 68 65 73 65 20 62 69 74 RNING: these bit
7730: 20 63 68 6f 69 63 65 73 20 6d 75 73 74 20 6e 6f choices must no
7740: 74 20 63 6f 6e 66 6c 69 63 74 20 77 69 74 68 20 t conflict with
7750: 74 68 65 20 62 69 74 20 63 68 6f 69 63 65 73 0a the bit choices.
7760: 20 2a 20 66 6f 72 20 65 76 61 6c 46 6c 61 67 20 * for evalFlag
7770: 62 69 74 73 20 69 6e 20 74 63 6c 49 6e 74 2e 68 bits in tclInt.h
7780: 21 21 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 !!. */..#define
7790: 54 43 4c 5f 4e 4f 5f 45 56 41 4c 09 09 30 78 31 TCL_NO_EVAL..0x1
77a0: 30 30 30 30 0a 23 64 65 66 69 6e 65 20 54 43 4c 0000.#define TCL
77b0: 5f 45 56 41 4c 5f 47 4c 4f 42 41 4c 09 09 30 78 _EVAL_GLOBAL..0x
77c0: 32 30 30 30 30 0a 23 64 65 66 69 6e 65 20 54 43 20000.#define TC
77d0: 4c 5f 45 56 41 4c 5f 44 49 52 45 43 54 09 09 30 L_EVAL_DIRECT..0
77e0: 78 34 30 30 30 30 0a 0a 2f 2a 0a 20 2a 20 53 70 x40000../*. * Sp
77f0: 65 63 69 61 6c 20 66 72 65 65 50 72 6f 63 20 76 ecial freeProc v
7800: 61 6c 75 65 73 20 74 68 61 74 20 6d 61 79 20 62 alues that may b
7810: 65 20 70 61 73 73 65 64 20 74 6f 20 54 63 6c 5f e passed to Tcl_
7820: 53 65 74 52 65 73 75 6c 74 20 28 73 65 65 0a 20 SetResult (see.
7830: 2a 20 74 68 65 20 6d 61 6e 20 70 61 67 65 20 66 * the man page f
7840: 6f 72 20 64 65 74 61 69 6c 73 29 3a 0a 20 2a 2f or details):. */
7850: 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 56 4f ..#define TCL_VO
7860: 4c 41 54 49 4c 45 09 28 28 54 63 6c 5f 46 72 65 LATILE.((Tcl_Fre
7870: 65 50 72 6f 63 20 2a 29 20 31 29 0a 23 64 65 66 eProc *) 1).#def
7880: 69 6e 65 20 54 43 4c 5f 53 54 41 54 49 43 09 28 ine TCL_STATIC.(
7890: 28 54 63 6c 5f 46 72 65 65 50 72 6f 63 20 2a 29 (Tcl_FreeProc *)
78a0: 20 30 29 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 0).#define TCL_
78b0: 44 59 4e 41 4d 49 43 09 28 28 54 63 6c 5f 46 72 DYNAMIC.((Tcl_Fr
78c0: 65 65 50 72 6f 63 20 2a 29 20 33 29 0a 0a 2f 2a eeProc *) 3)../*
78d0: 0a 20 2a 20 46 6c 61 67 20 76 61 6c 75 65 73 20 . * Flag values
78e0: 70 61 73 73 65 64 20 74 6f 20 76 61 72 69 61 62 passed to variab
78f0: 6c 65 2d 72 65 6c 61 74 65 64 20 70 72 6f 63 65 le-related proce
7900: 64 75 72 65 73 2e 0a 20 2a 2f 0a 0a 23 64 65 66 dures.. */..#def
7910: 69 6e 65 20 54 43 4c 5f 47 4c 4f 42 41 4c 5f 4f ine TCL_GLOBAL_O
7920: 4e 4c 59 09 09 20 31 0a 23 64 65 66 69 6e 65 20 NLY.. 1.#define
7930: 54 43 4c 5f 4e 41 4d 45 53 50 41 43 45 5f 4f 4e TCL_NAMESPACE_ON
7940: 4c 59 09 20 32 0a 23 64 65 66 69 6e 65 20 54 43 LY. 2.#define TC
7950: 4c 5f 41 50 50 45 4e 44 5f 56 41 4c 55 45 09 20 L_APPEND_VALUE.
7960: 34 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4c 49 4.#define TCL_LI
7970: 53 54 5f 45 4c 45 4d 45 4e 54 09 20 38 0a 23 64 ST_ELEMENT. 8.#d
7980: 65 66 69 6e 65 20 54 43 4c 5f 54 52 41 43 45 5f efine TCL_TRACE_
7990: 52 45 41 44 53 09 09 20 30 78 31 30 0a 23 64 65 READS.. 0x10.#de
79a0: 66 69 6e 65 20 54 43 4c 5f 54 52 41 43 45 5f 57 fine TCL_TRACE_W
79b0: 52 49 54 45 53 09 20 30 78 32 30 0a 23 64 65 66 RITES. 0x20.#def
79c0: 69 6e 65 20 54 43 4c 5f 54 52 41 43 45 5f 55 4e ine TCL_TRACE_UN
79d0: 53 45 54 53 09 20 30 78 34 30 0a 23 64 65 66 69 SETS. 0x40.#defi
79e0: 6e 65 20 54 43 4c 5f 54 52 41 43 45 5f 44 45 53 ne TCL_TRACE_DES
79f0: 54 52 4f 59 45 44 09 20 30 78 38 30 0a 23 64 65 TROYED. 0x80.#de
7a00: 66 69 6e 65 20 54 43 4c 5f 49 4e 54 45 52 50 5f fine TCL_INTERP_
7a10: 44 45 53 54 52 4f 59 45 44 09 20 30 78 31 30 30 DESTROYED. 0x100
7a20: 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4c 45 41 .#define TCL_LEA
7a30: 56 45 5f 45 52 52 5f 4d 53 47 09 20 30 78 32 30 VE_ERR_MSG. 0x20
7a40: 30 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 54 52 0.#define TCL_TR
7a50: 41 43 45 5f 41 52 52 41 59 09 09 20 30 78 38 30 ACE_ARRAY.. 0x80
7a60: 30 0a 0a 2f 2a 0a 20 2a 20 54 68 65 20 54 43 4c 0../*. * The TCL
7a70: 5f 50 41 52 53 45 5f 50 41 52 54 31 20 66 6c 61 _PARSE_PART1 fla
7a80: 67 20 69 73 20 64 65 70 72 65 63 61 74 65 64 20 g is deprecated
7a90: 61 6e 64 20 68 61 73 20 6e 6f 20 65 66 66 65 63 and has no effec
7aa0: 74 2e 20 0a 20 2a 20 54 68 65 20 70 61 72 74 31 t. . * The part1
7ab0: 20 69 73 20 6e 6f 77 20 61 6c 77 61 79 73 20 70 is now always p
7ac0: 61 72 73 65 64 20 77 68 65 6e 65 76 65 72 20 74 arsed whenever t
7ad0: 68 65 20 70 61 72 74 32 20 69 73 20 4e 55 4c 4c he part2 is NULL
7ae0: 2e 0a 20 2a 20 28 54 68 69 73 20 69 73 20 74 6f .. * (This is to
7af0: 20 61 76 6f 69 64 20 61 20 63 6f 6d 6d 6f 6e 20 avoid a common
7b00: 65 72 72 6f 72 20 77 68 65 6e 20 63 6f 6e 76 65 error when conve
7b10: 72 74 69 6e 67 20 63 6f 64 65 20 74 6f 0a 20 2a rting code to. *
7b20: 20 20 75 73 65 20 74 68 65 20 6e 65 77 20 6f 62 use the new ob
7b30: 6a 65 63 74 20 62 61 73 65 64 20 41 50 49 73 20 ject based APIs
7b40: 61 6e 64 20 66 6f 72 67 65 74 74 69 6e 67 20 74 and forgetting t
7b50: 6f 20 67 69 76 65 20 74 68 65 0a 20 2a 20 20 66 o give the. * f
7b60: 6c 61 67 29 0a 20 2a 2f 0a 23 69 66 6e 64 65 66 lag). */.#ifndef
7b70: 20 54 43 4c 5f 4e 4f 5f 44 45 50 52 45 43 41 54 TCL_NO_DEPRECAT
7b80: 45 44 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 50 ED.#define TCL_P
7b90: 41 52 53 45 5f 50 41 52 54 31 20 20 20 20 20 20 ARSE_PART1
7ba0: 20 20 20 20 30 78 34 30 30 0a 23 65 6e 64 69 66 0x400.#endif
7bb0: 0a 0a 0a 2f 2a 0a 20 2a 20 54 79 70 65 73 20 66 .../*. * Types f
7bc0: 6f 72 20 6c 69 6e 6b 65 64 20 76 61 72 69 61 62 or linked variab
7bd0: 6c 65 73 3a 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e les:. */..#defin
7be0: 65 20 54 43 4c 5f 4c 49 4e 4b 5f 49 4e 54 09 09 e TCL_LINK_INT..
7bf0: 31 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4c 49 1.#define TCL_LI
7c00: 4e 4b 5f 44 4f 55 42 4c 45 09 09 32 0a 23 64 65 NK_DOUBLE..2.#de
7c10: 66 69 6e 65 20 54 43 4c 5f 4c 49 4e 4b 5f 42 4f fine TCL_LINK_BO
7c20: 4f 4c 45 41 4e 09 33 0a 23 64 65 66 69 6e 65 20 OLEAN.3.#define
7c30: 54 43 4c 5f 4c 49 4e 4b 5f 53 54 52 49 4e 47 09 TCL_LINK_STRING.
7c40: 09 34 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 4c .4.#define TCL_L
7c50: 49 4e 4b 5f 52 45 41 44 5f 4f 4e 4c 59 09 30 78 INK_READ_ONLY.0x
7c60: 38 30 0a 0a 2f 2a 0a 20 2a 20 46 6f 72 77 61 72 80../*. * Forwar
7c70: 64 20 64 65 63 6c 61 72 61 74 69 6f 6e 20 6f 66 d declaration of
7c80: 20 54 63 6c 5f 48 61 73 68 54 61 62 6c 65 2e 20 Tcl_HashTable.
7c90: 20 4e 65 65 64 65 64 20 62 79 20 73 6f 6d 65 20 Needed by some
7ca0: 43 2b 2b 20 63 6f 6d 70 69 6c 65 72 73 0a 20 2a C++ compilers. *
7cb0: 20 74 6f 20 70 72 65 76 65 6e 74 20 65 72 72 6f to prevent erro
7cc0: 72 73 20 77 68 65 6e 20 74 68 65 20 66 6f 72 77 rs when the forw
7cd0: 61 72 64 20 72 65 66 65 72 65 6e 63 65 20 74 6f ard reference to
7ce0: 20 54 63 6c 5f 48 61 73 68 54 61 62 6c 65 20 69 Tcl_HashTable i
7cf0: 73 0a 20 2a 20 65 6e 63 6f 75 6e 74 65 72 65 64 s. * encountered
7d00: 20 69 6e 20 74 68 65 20 54 63 6c 5f 48 61 73 68 in the Tcl_Hash
7d10: 45 6e 74 72 79 20 73 74 72 75 63 74 75 72 65 2e Entry structure.
7d20: 0a 20 2a 2f 0a 0a 23 69 66 64 65 66 20 5f 5f 63 . */..#ifdef __c
7d30: 70 6c 75 73 70 6c 75 73 0a 73 74 72 75 63 74 20 plusplus.struct
7d40: 54 63 6c 5f 48 61 73 68 54 61 62 6c 65 3b 0a 23 Tcl_HashTable;.#
7d50: 65 6e 64 69 66 0a 0a 2f 2a 0a 20 2a 20 53 74 72 endif../*. * Str
7d60: 75 63 74 75 72 65 20 64 65 66 69 6e 69 74 69 6f ucture definitio
7d70: 6e 20 66 6f 72 20 61 6e 20 65 6e 74 72 79 20 69 n for an entry i
7d80: 6e 20 61 20 68 61 73 68 20 74 61 62 6c 65 2e 20 n a hash table.
7d90: 20 4e 6f 2d 6f 6e 65 20 6f 75 74 73 69 64 65 0a No-one outside.
7da0: 20 2a 20 54 63 6c 20 73 68 6f 75 6c 64 20 61 63 * Tcl should ac
7db0: 63 65 73 73 20 61 6e 79 20 6f 66 20 74 68 65 73 cess any of thes
7dc0: 65 20 66 69 65 6c 64 73 20 64 69 72 65 63 74 6c e fields directl
7dd0: 79 3b 20 20 75 73 65 20 74 68 65 20 6d 61 63 72 y; use the macr
7de0: 6f 73 0a 20 2a 20 64 65 66 69 6e 65 64 20 62 65 os. * defined be
7df0: 6c 6f 77 2e 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 low.. */..typede
7e00: 66 20 73 74 72 75 63 74 20 54 63 6c 5f 48 61 73 f struct Tcl_Has
7e10: 68 45 6e 74 72 79 20 7b 0a 20 20 20 20 73 74 72 hEntry {. str
7e20: 75 63 74 20 54 63 6c 5f 48 61 73 68 45 6e 74 72 uct Tcl_HashEntr
7e30: 79 20 2a 6e 65 78 74 50 74 72 3b 09 2f 2a 20 50 y *nextPtr;./* P
7e40: 6f 69 6e 74 65 72 20 74 6f 20 6e 65 78 74 20 65 ointer to next e
7e50: 6e 74 72 79 20 69 6e 20 74 68 69 73 0a 09 09 09 ntry in this....
7e60: 09 09 20 2a 20 68 61 73 68 20 62 75 63 6b 65 74 .. * hash bucket
7e70: 2c 20 6f 72 20 4e 55 4c 4c 20 66 6f 72 20 65 6e , or NULL for en
7e80: 64 20 6f 66 0a 09 09 09 09 09 20 2a 20 63 68 61 d of...... * cha
7e90: 69 6e 2e 20 2a 2f 0a 20 20 20 20 73 74 72 75 63 in. */. struc
7ea0: 74 20 54 63 6c 5f 48 61 73 68 54 61 62 6c 65 20 t Tcl_HashTable
7eb0: 2a 74 61 62 6c 65 50 74 72 3b 09 2f 2a 20 50 6f *tablePtr;./* Po
7ec0: 69 6e 74 65 72 20 74 6f 20 74 61 62 6c 65 20 63 inter to table c
7ed0: 6f 6e 74 61 69 6e 69 6e 67 20 65 6e 74 72 79 2e ontaining entry.
7ee0: 20 2a 2f 0a 20 20 20 20 73 74 72 75 63 74 20 54 */. struct T
7ef0: 63 6c 5f 48 61 73 68 45 6e 74 72 79 20 2a 2a 62 cl_HashEntry **b
7f00: 75 63 6b 65 74 50 74 72 3b 09 2f 2a 20 50 6f 69 ucketPtr;./* Poi
7f10: 6e 74 65 72 20 74 6f 20 62 75 63 6b 65 74 20 74 nter to bucket t
7f20: 68 61 74 20 70 6f 69 6e 74 73 20 74 6f 0a 09 09 hat points to...
7f30: 09 09 09 20 2a 20 66 69 72 73 74 20 65 6e 74 72 ... * first entr
7f40: 79 20 69 6e 20 74 68 69 73 20 65 6e 74 72 79 27 y in this entry'
7f50: 73 20 63 68 61 69 6e 3a 0a 09 09 09 09 09 20 2a s chain:...... *
7f60: 20 75 73 65 64 20 66 6f 72 20 64 65 6c 65 74 69 used for deleti
7f70: 6e 67 20 74 68 65 20 65 6e 74 72 79 2e 20 2a 2f ng the entry. */
7f80: 0a 20 20 20 20 43 6c 69 65 6e 74 44 61 74 61 20 . ClientData
7f90: 63 6c 69 65 6e 74 44 61 74 61 3b 09 09 2f 2a 20 clientData;../*
7fa0: 41 70 70 6c 69 63 61 74 69 6f 6e 20 73 74 6f 72 Application stor
7fb0: 65 73 20 73 6f 6d 65 74 68 69 6e 67 20 68 65 72 es something her
7fc0: 65 0a 09 09 09 09 09 20 2a 20 77 69 74 68 20 54 e...... * with T
7fd0: 63 6c 5f 53 65 74 48 61 73 68 56 61 6c 75 65 2e cl_SetHashValue.
7fe0: 20 2a 2f 0a 20 20 20 20 75 6e 69 6f 6e 20 7b 09 */. union {.
7ff0: 09 09 09 2f 2a 20 4b 65 79 20 68 61 73 20 6f 6e .../* Key has on
8000: 65 20 6f 66 20 74 68 65 73 65 20 66 6f 72 6d 73 e of these forms
8010: 3a 20 2a 2f 0a 09 63 68 61 72 20 2a 6f 6e 65 57 : */..char *oneW
8020: 6f 72 64 56 61 6c 75 65 3b 09 09 2f 2a 20 4f 6e ordValue;../* On
8030: 65 2d 77 6f 72 64 20 76 61 6c 75 65 20 66 6f 72 e-word value for
8040: 20 6b 65 79 2e 20 2a 2f 0a 09 69 6e 74 20 77 6f key. */..int wo
8050: 72 64 73 5b 31 5d 3b 09 09 09 2f 2a 20 4d 75 6c rds[1];.../* Mul
8060: 74 69 70 6c 65 20 69 6e 74 65 67 65 72 20 77 6f tiple integer wo
8070: 72 64 73 20 66 6f 72 20 6b 65 79 2e 0a 09 09 09 rds for key.....
8080: 09 09 20 2a 20 54 68 65 20 61 63 74 75 61 6c 20 .. * The actual
8090: 73 69 7a 65 20 77 69 6c 6c 20 62 65 20 61 73 20 size will be as
80a0: 6c 61 72 67 65 0a 09 09 09 09 09 20 2a 20 61 73 large...... * as
80b0: 20 6e 65 63 65 73 73 61 72 79 20 66 6f 72 20 74 necessary for t
80c0: 68 69 73 20 74 61 62 6c 65 27 73 0a 09 09 09 09 his table's.....
80d0: 09 20 2a 20 6b 65 79 73 2e 20 2a 2f 0a 09 63 68 . * keys. */..ch
80e0: 61 72 20 73 74 72 69 6e 67 5b 34 5d 3b 09 09 09 ar string[4];...
80f0: 2f 2a 20 53 74 72 69 6e 67 20 66 6f 72 20 6b 65 /* String for ke
8100: 79 2e 20 20 54 68 65 20 61 63 74 75 61 6c 20 73 y. The actual s
8110: 69 7a 65 0a 09 09 09 09 09 20 2a 20 77 69 6c 6c ize...... * will
8120: 20 62 65 20 61 73 20 6c 61 72 67 65 20 61 73 20 be as large as
8130: 6e 65 65 64 65 64 20 74 6f 20 68 6f 6c 64 0a 09 needed to hold..
8140: 09 09 09 09 20 2a 20 74 68 65 20 6b 65 79 2e 20 .... * the key.
8150: 2a 2f 0a 20 20 20 20 7d 20 6b 65 79 3b 09 09 09 */. } key;...
8160: 09 2f 2a 20 4d 55 53 54 20 42 45 20 4c 41 53 54 ./* MUST BE LAST
8170: 20 46 49 45 4c 44 20 49 4e 20 52 45 43 4f 52 44 FIELD IN RECORD
8180: 21 21 20 2a 2f 0a 7d 20 54 63 6c 5f 48 61 73 68 !! */.} Tcl_Hash
8190: 45 6e 74 72 79 3b 0a 0a 2f 2a 0a 20 2a 20 53 74 Entry;../*. * St
81a0: 72 75 63 74 75 72 65 20 64 65 66 69 6e 69 74 69 ructure definiti
81b0: 6f 6e 20 66 6f 72 20 61 20 68 61 73 68 20 74 61 on for a hash ta
81c0: 62 6c 65 2e 20 20 4d 75 73 74 20 62 65 20 69 6e ble. Must be in
81d0: 20 74 63 6c 2e 68 20 73 6f 20 63 6c 69 65 6e 74 tcl.h so client
81e0: 73 0a 20 2a 20 63 61 6e 20 61 6c 6c 6f 63 61 74 s. * can allocat
81f0: 65 20 73 70 61 63 65 20 66 6f 72 20 74 68 65 73 e space for thes
8200: 65 20 73 74 72 75 63 74 75 72 65 73 2c 20 62 75 e structures, bu
8210: 74 20 63 6c 69 65 6e 74 73 20 73 68 6f 75 6c 64 t clients should
8220: 20 6e 65 76 65 72 0a 20 2a 20 61 63 63 65 73 73 never. * access
8230: 20 61 6e 79 20 66 69 65 6c 64 73 20 69 6e 20 74 any fields in t
8240: 68 69 73 20 73 74 72 75 63 74 75 72 65 2e 0a 20 his structure..
8250: 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f */..#define TCL_
8260: 53 4d 41 4c 4c 5f 48 41 53 48 5f 54 41 42 4c 45 SMALL_HASH_TABLE
8270: 20 34 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 4.typedef struc
8280: 74 20 54 63 6c 5f 48 61 73 68 54 61 62 6c 65 20 t Tcl_HashTable
8290: 7b 0a 20 20 20 20 54 63 6c 5f 48 61 73 68 45 6e {. Tcl_HashEn
82a0: 74 72 79 20 2a 2a 62 75 63 6b 65 74 73 3b 09 09 try **buckets;..
82b0: 2f 2a 20 50 6f 69 6e 74 65 72 20 74 6f 20 62 75 /* Pointer to bu
82c0: 63 6b 65 74 20 61 72 72 61 79 2e 20 20 45 61 63 cket array. Eac
82d0: 68 0a 09 09 09 09 09 20 2a 20 65 6c 65 6d 65 6e h...... * elemen
82e0: 74 20 70 6f 69 6e 74 73 20 74 6f 20 66 69 72 73 t points to firs
82f0: 74 20 65 6e 74 72 79 20 69 6e 0a 09 09 09 09 09 t entry in......
8300: 20 2a 20 62 75 63 6b 65 74 27 73 20 68 61 73 68 * bucket's hash
8310: 20 63 68 61 69 6e 2c 20 6f 72 20 4e 55 4c 4c 2e chain, or NULL.
8320: 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 48 61 73 68 */. Tcl_Hash
8330: 45 6e 74 72 79 20 2a 73 74 61 74 69 63 42 75 63 Entry *staticBuc
8340: 6b 65 74 73 5b 54 43 4c 5f 53 4d 41 4c 4c 5f 48 kets[TCL_SMALL_H
8350: 41 53 48 5f 54 41 42 4c 45 5d 3b 0a 09 09 09 09 ASH_TABLE];.....
8360: 09 2f 2a 20 42 75 63 6b 65 74 20 61 72 72 61 79 ./* Bucket array
8370: 20 75 73 65 64 20 66 6f 72 20 73 6d 61 6c 6c 20 used for small
8380: 74 61 62 6c 65 73 0a 09 09 09 09 09 20 2a 20 28 tables...... * (
8390: 74 6f 20 61 76 6f 69 64 20 6d 61 6c 6c 6f 63 73 to avoid mallocs
83a0: 20 61 6e 64 20 66 72 65 65 73 29 2e 20 2a 2f 0a and frees). */.
83b0: 20 20 20 20 69 6e 74 20 6e 75 6d 42 75 63 6b 65 int numBucke
83c0: 74 73 3b 09 09 09 2f 2a 20 54 6f 74 61 6c 20 6e ts;.../* Total n
83d0: 75 6d 62 65 72 20 6f 66 20 62 75 63 6b 65 74 73 umber of buckets
83e0: 20 61 6c 6c 6f 63 61 74 65 64 0a 09 09 09 09 09 allocated......
83f0: 20 2a 20 61 74 20 2a 2a 62 75 63 6b 65 74 50 74 * at **bucketPt
8400: 72 2e 20 2a 2f 0a 20 20 20 20 69 6e 74 20 6e 75 r. */. int nu
8410: 6d 45 6e 74 72 69 65 73 3b 09 09 09 2f 2a 20 54 mEntries;.../* T
8420: 6f 74 61 6c 20 6e 75 6d 62 65 72 20 6f 66 20 65 otal number of e
8430: 6e 74 72 69 65 73 20 70 72 65 73 65 6e 74 0a 09 ntries present..
8440: 09 09 09 09 20 2a 20 69 6e 20 74 61 62 6c 65 2e .... * in table.
8450: 20 2a 2f 0a 20 20 20 20 69 6e 74 20 72 65 62 75 */. int rebu
8460: 69 6c 64 53 69 7a 65 3b 09 09 09 2f 2a 20 45 6e ildSize;.../* En
8470: 6c 61 72 67 65 20 74 61 62 6c 65 20 77 68 65 6e large table when
8480: 20 6e 75 6d 45 6e 74 72 69 65 73 20 67 65 74 73 numEntries gets
8490: 0a 09 09 09 09 09 20 2a 20 74 6f 20 62 65 20 74 ...... * to be t
84a0: 68 69 73 20 6c 61 72 67 65 2e 20 2a 2f 0a 20 20 his large. */.
84b0: 20 20 69 6e 74 20 64 6f 77 6e 53 68 69 66 74 3b int downShift;
84c0: 09 09 09 2f 2a 20 53 68 69 66 74 20 63 6f 75 6e .../* Shift coun
84d0: 74 20 75 73 65 64 20 69 6e 20 68 61 73 68 69 6e t used in hashin
84e0: 67 0a 09 09 09 09 09 20 2a 20 66 75 6e 63 74 69 g...... * functi
84f0: 6f 6e 2e 20 20 44 65 73 69 67 6e 65 64 20 74 6f on. Designed to
8500: 20 75 73 65 20 68 69 67 68 2d 0a 09 09 09 09 09 use high-......
8510: 20 2a 20 6f 72 64 65 72 20 62 69 74 73 20 6f 66 * order bits of
8520: 20 72 61 6e 64 6f 6d 69 7a 65 64 20 6b 65 79 73 randomized keys
8530: 2e 20 2a 2f 0a 20 20 20 20 69 6e 74 20 6d 61 73 . */. int mas
8540: 6b 3b 09 09 09 09 2f 2a 20 4d 61 73 6b 20 76 61 k;..../* Mask va
8550: 6c 75 65 20 75 73 65 64 20 69 6e 20 68 61 73 68 lue used in hash
8560: 69 6e 67 0a 09 09 09 09 09 20 2a 20 66 75 6e 63 ing...... * func
8570: 74 69 6f 6e 2e 20 2a 2f 0a 20 20 20 20 69 6e 74 tion. */. int
8580: 20 6b 65 79 54 79 70 65 3b 09 09 09 2f 2a 20 54 keyType;.../* T
8590: 79 70 65 20 6f 66 20 6b 65 79 73 20 75 73 65 64 ype of keys used
85a0: 20 69 6e 20 74 68 69 73 20 74 61 62 6c 65 2e 20 in this table.
85b0: 0a 09 09 09 09 09 20 2a 20 49 74 27 73 20 65 69 ...... * It's ei
85c0: 74 68 65 72 20 54 43 4c 5f 53 54 52 49 4e 47 5f ther TCL_STRING_
85d0: 4b 45 59 53 2c 0a 09 09 09 09 09 20 2a 20 54 43 KEYS,...... * TC
85e0: 4c 5f 4f 4e 45 5f 57 4f 52 44 5f 4b 45 59 53 2c L_ONE_WORD_KEYS,
85f0: 20 6f 72 20 61 6e 20 69 6e 74 65 67 65 72 0a 09 or an integer..
8600: 09 09 09 09 20 2a 20 67 69 76 69 6e 67 20 74 68 .... * giving th
8610: 65 20 6e 75 6d 62 65 72 20 6f 66 20 69 6e 74 73 e number of ints
8620: 20 74 68 61 74 0a 20 20 20 20 20 20 20 20 20 20 that.
8630: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
8640: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2a *
8650: 20 69 73 20 74 68 65 20 73 69 7a 65 20 6f 66 20 is the size of
8660: 74 68 65 20 6b 65 79 2e 0a 09 09 09 09 09 20 2a the key....... *
8670: 2f 0a 20 20 20 20 54 63 6c 5f 48 61 73 68 45 6e /. Tcl_HashEn
8680: 74 72 79 20 2a 28 2a 66 69 6e 64 50 72 6f 63 29 try *(*findProc)
8690: 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 73 74 _ANSI_ARGS_((st
86a0: 72 75 63 74 20 54 63 6c 5f 48 61 73 68 54 61 62 ruct Tcl_HashTab
86b0: 6c 65 20 2a 74 61 62 6c 65 50 74 72 2c 0a 09 20 le *tablePtr,..
86c0: 20 20 20 43 4f 4e 53 54 20 63 68 61 72 20 2a 6b CONST char *k
86d0: 65 79 29 29 3b 0a 20 20 20 20 54 63 6c 5f 48 61 ey));. Tcl_Ha
86e0: 73 68 45 6e 74 72 79 20 2a 28 2a 63 72 65 61 74 shEntry *(*creat
86f0: 65 50 72 6f 63 29 20 5f 41 4e 53 49 5f 41 52 47 eProc) _ANSI_ARG
8700: 53 5f 28 28 73 74 72 75 63 74 20 54 63 6c 5f 48 S_((struct Tcl_H
8710: 61 73 68 54 61 62 6c 65 20 2a 74 61 62 6c 65 50 ashTable *tableP
8720: 74 72 2c 0a 09 20 20 20 20 43 4f 4e 53 54 20 63 tr,.. CONST c
8730: 68 61 72 20 2a 6b 65 79 2c 20 69 6e 74 20 2a 6e har *key, int *n
8740: 65 77 50 74 72 29 29 3b 0a 7d 20 54 63 6c 5f 48 ewPtr));.} Tcl_H
8750: 61 73 68 54 61 62 6c 65 3b 0a 0a 2f 2a 0a 20 2a ashTable;../*. *
8760: 20 53 74 72 75 63 74 75 72 65 20 64 65 66 69 6e Structure defin
8770: 69 74 69 6f 6e 20 66 6f 72 20 69 6e 66 6f 72 6d ition for inform
8780: 61 74 69 6f 6e 20 75 73 65 64 20 74 6f 20 6b 65 ation used to ke
8790: 65 70 20 74 72 61 63 6b 20 6f 66 20 73 65 61 72 ep track of sear
87a0: 63 68 65 73 0a 20 2a 20 74 68 72 6f 75 67 68 20 ches. * through
87b0: 68 61 73 68 20 74 61 62 6c 65 73 3a 0a 20 2a 2f hash tables:. */
87c0: 0a 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 74 ..typedef struct
87d0: 20 54 63 6c 5f 48 61 73 68 53 65 61 72 63 68 20 Tcl_HashSearch
87e0: 7b 0a 20 20 20 20 54 63 6c 5f 48 61 73 68 54 61 {. Tcl_HashTa
87f0: 62 6c 65 20 2a 74 61 62 6c 65 50 74 72 3b 09 09 ble *tablePtr;..
8800: 2f 2a 20 54 61 62 6c 65 20 62 65 69 6e 67 20 73 /* Table being s
8810: 65 61 72 63 68 65 64 2e 20 2a 2f 0a 20 20 20 20 earched. */.
8820: 69 6e 74 20 6e 65 78 74 49 6e 64 65 78 3b 09 09 int nextIndex;..
8830: 09 2f 2a 20 49 6e 64 65 78 20 6f 66 20 6e 65 78 ./* Index of nex
8840: 74 20 62 75 63 6b 65 74 20 74 6f 20 62 65 0a 09 t bucket to be..
8850: 09 09 09 09 20 2a 20 65 6e 75 6d 65 72 61 74 65 .... * enumerate
8860: 64 20 61 66 74 65 72 20 70 72 65 73 65 6e 74 20 d after present
8870: 6f 6e 65 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f one. */. Tcl_
8880: 48 61 73 68 45 6e 74 72 79 20 2a 6e 65 78 74 45 HashEntry *nextE
8890: 6e 74 72 79 50 74 72 3b 09 2f 2a 20 4e 65 78 74 ntryPtr;./* Next
88a0: 20 65 6e 74 72 79 20 74 6f 20 62 65 20 65 6e 75 entry to be enu
88b0: 6d 65 72 61 74 65 64 20 69 6e 20 74 68 65 0a 09 merated in the..
88c0: 09 09 09 09 20 2a 20 74 68 65 20 63 75 72 72 65 .... * the curre
88d0: 6e 74 20 62 75 63 6b 65 74 2e 20 2a 2f 0a 7d 20 nt bucket. */.}
88e0: 54 63 6c 5f 48 61 73 68 53 65 61 72 63 68 3b 0a Tcl_HashSearch;.
88f0: 0a 2f 2a 0a 20 2a 20 41 63 63 65 70 74 61 62 6c ./*. * Acceptabl
8900: 65 20 6b 65 79 20 74 79 70 65 73 20 66 6f 72 20 e key types for
8910: 68 61 73 68 20 74 61 62 6c 65 73 3a 0a 20 2a 2f hash tables:. */
8920: 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 53 54 ..#define TCL_ST
8930: 52 49 4e 47 5f 4b 45 59 53 09 09 30 0a 23 64 65 RING_KEYS..0.#de
8940: 66 69 6e 65 20 54 43 4c 5f 4f 4e 45 5f 57 4f 52 fine TCL_ONE_WOR
8950: 44 5f 4b 45 59 53 09 31 0a 0a 2f 2a 0a 20 2a 20 D_KEYS.1../*. *
8960: 4d 61 63 72 6f 73 20 66 6f 72 20 63 6c 69 65 6e Macros for clien
8970: 74 73 20 74 6f 20 75 73 65 20 74 6f 20 61 63 63 ts to use to acc
8980: 65 73 73 20 66 69 65 6c 64 73 20 6f 66 20 68 61 ess fields of ha
8990: 73 68 20 65 6e 74 72 69 65 73 3a 0a 20 2a 2f 0a sh entries:. */.
89a0: 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f 47 65 74 .#define Tcl_Get
89b0: 48 61 73 68 56 61 6c 75 65 28 68 29 20 28 28 68 HashValue(h) ((h
89c0: 29 2d 3e 63 6c 69 65 6e 74 44 61 74 61 29 0a 23 )->clientData).#
89d0: 64 65 66 69 6e 65 20 54 63 6c 5f 53 65 74 48 61 define Tcl_SetHa
89e0: 73 68 56 61 6c 75 65 28 68 2c 20 76 61 6c 75 65 shValue(h, value
89f0: 29 20 28 28 68 29 2d 3e 63 6c 69 65 6e 74 44 61 ) ((h)->clientDa
8a00: 74 61 20 3d 20 28 43 6c 69 65 6e 74 44 61 74 61 ta = (ClientData
8a10: 29 20 28 76 61 6c 75 65 29 29 0a 23 64 65 66 69 ) (value)).#defi
8a20: 6e 65 20 54 63 6c 5f 47 65 74 48 61 73 68 4b 65 ne Tcl_GetHashKe
8a30: 79 28 74 61 62 6c 65 50 74 72 2c 20 68 29 20 5c y(tablePtr, h) \
8a40: 0a 20 20 20 20 28 28 63 68 61 72 20 2a 29 20 28 . ((char *) (
8a50: 28 28 74 61 62 6c 65 50 74 72 29 2d 3e 6b 65 79 ((tablePtr)->key
8a60: 54 79 70 65 20 3d 3d 20 54 43 4c 5f 4f 4e 45 5f Type == TCL_ONE_
8a70: 57 4f 52 44 5f 4b 45 59 53 29 20 3f 20 28 68 29 WORD_KEYS) ? (h)
8a80: 2d 3e 6b 65 79 2e 6f 6e 65 57 6f 72 64 56 61 6c ->key.oneWordVal
8a90: 75 65 20 5c 0a 09 09 09 09 09 09 3a 20 28 68 29 ue \.......: (h)
8aa0: 2d 3e 6b 65 79 2e 73 74 72 69 6e 67 29 29 0a 0a ->key.string))..
8ab0: 2f 2a 0a 20 2a 20 4d 61 63 72 6f 73 20 74 6f 20 /*. * Macros to
8ac0: 75 73 65 20 66 6f 72 20 63 6c 69 65 6e 74 73 20 use for clients
8ad0: 74 6f 20 75 73 65 20 74 6f 20 69 6e 76 6f 6b 65 to use to invoke
8ae0: 20 66 69 6e 64 20 61 6e 64 20 63 72 65 61 74 65 find and create
8af0: 20 70 72 6f 63 65 64 75 72 65 73 0a 20 2a 20 66 procedures. * f
8b00: 6f 72 20 68 61 73 68 20 74 61 62 6c 65 73 3a 0a or hash tables:.
8b10: 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 63 6c */..#define Tcl
8b20: 5f 46 69 6e 64 48 61 73 68 45 6e 74 72 79 28 74 _FindHashEntry(t
8b30: 61 62 6c 65 50 74 72 2c 20 6b 65 79 29 20 5c 0a ablePtr, key) \.
8b40: 09 28 2a 28 28 74 61 62 6c 65 50 74 72 29 2d 3e .(*((tablePtr)->
8b50: 66 69 6e 64 50 72 6f 63 29 29 28 74 61 62 6c 65 findProc))(table
8b60: 50 74 72 2c 20 6b 65 79 29 0a 23 64 65 66 69 6e Ptr, key).#defin
8b70: 65 20 54 63 6c 5f 43 72 65 61 74 65 48 61 73 68 e Tcl_CreateHash
8b80: 45 6e 74 72 79 28 74 61 62 6c 65 50 74 72 2c 20 Entry(tablePtr,
8b90: 6b 65 79 2c 20 6e 65 77 50 74 72 29 20 5c 0a 09 key, newPtr) \..
8ba0: 28 2a 28 28 74 61 62 6c 65 50 74 72 29 2d 3e 63 (*((tablePtr)->c
8bb0: 72 65 61 74 65 50 72 6f 63 29 29 28 74 61 62 6c reateProc))(tabl
8bc0: 65 50 74 72 2c 20 6b 65 79 2c 20 6e 65 77 50 74 ePtr, key, newPt
8bd0: 72 29 0a 0a 2f 2a 0a 20 2a 20 46 6c 61 67 20 76 r)../*. * Flag v
8be0: 61 6c 75 65 73 20 74 6f 20 70 61 73 73 20 74 6f alues to pass to
8bf0: 20 54 63 6c 5f 44 6f 4f 6e 65 45 76 65 6e 74 20 Tcl_DoOneEvent
8c00: 74 6f 20 64 69 73 61 62 6c 65 20 73 65 61 72 63 to disable searc
8c10: 68 65 73 0a 20 2a 20 66 6f 72 20 73 6f 6d 65 20 hes. * for some
8c20: 6b 69 6e 64 73 20 6f 66 20 65 76 65 6e 74 73 3a kinds of events:
8c30: 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 . */..#define TC
8c40: 4c 5f 44 4f 4e 54 5f 57 41 49 54 09 09 28 31 3c L_DONT_WAIT..(1<
8c50: 3c 31 29 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f <1).#define TCL_
8c60: 57 49 4e 44 4f 57 5f 45 56 45 4e 54 53 09 28 31 WINDOW_EVENTS.(1
8c70: 3c 3c 32 29 0a 23 64 65 66 69 6e 65 20 54 43 4c <<2).#define TCL
8c80: 5f 46 49 4c 45 5f 45 56 45 4e 54 53 09 09 28 31 _FILE_EVENTS..(1
8c90: 3c 3c 33 29 0a 23 64 65 66 69 6e 65 20 54 43 4c <<3).#define TCL
8ca0: 5f 54 49 4d 45 52 5f 45 56 45 4e 54 53 09 28 31 _TIMER_EVENTS.(1
8cb0: 3c 3c 34 29 0a 23 64 65 66 69 6e 65 20 54 43 4c <<4).#define TCL
8cc0: 5f 49 44 4c 45 5f 45 56 45 4e 54 53 09 09 28 31 _IDLE_EVENTS..(1
8cd0: 3c 3c 35 29 09 2f 2a 20 57 41 53 20 30 78 31 30 <<5)./* WAS 0x10
8ce0: 20 3f 3f 3f 3f 20 2a 2f 0a 23 64 65 66 69 6e 65 ???? */.#define
8cf0: 20 54 43 4c 5f 41 4c 4c 5f 45 56 45 4e 54 53 09 TCL_ALL_EVENTS.
8d00: 09 28 7e 54 43 4c 5f 44 4f 4e 54 5f 57 41 49 54 .(~TCL_DONT_WAIT
8d10: 29 0a 0a 2f 2a 0a 20 2a 20 54 68 65 20 66 6f 6c )../*. * The fol
8d20: 6c 6f 77 69 6e 67 20 73 74 72 75 63 74 75 72 65 lowing structure
8d30: 20 64 65 66 69 6e 65 73 20 61 20 67 65 6e 65 72 defines a gener
8d40: 69 63 20 65 76 65 6e 74 20 66 6f 72 20 74 68 65 ic event for the
8d50: 20 54 63 6c 20 65 76 65 6e 74 0a 20 2a 20 73 79 Tcl event. * sy
8d60: 73 74 65 6d 2e 20 20 54 68 65 73 65 20 61 72 65 stem. These are
8d70: 20 74 68 65 20 74 68 69 6e 67 73 20 74 68 61 74 the things that
8d80: 20 61 72 65 20 71 75 65 75 65 64 20 69 6e 20 63 are queued in c
8d90: 61 6c 6c 73 20 74 6f 20 54 63 6c 5f 51 75 65 75 alls to Tcl_Queu
8da0: 65 45 76 65 6e 74 0a 20 2a 20 61 6e 64 20 73 65 eEvent. * and se
8db0: 72 76 69 63 65 64 20 6c 61 74 65 72 20 62 79 20 rviced later by
8dc0: 54 63 6c 5f 44 6f 4f 6e 65 45 76 65 6e 74 2e 20 Tcl_DoOneEvent.
8dd0: 20 54 68 65 72 65 20 63 61 6e 20 62 65 20 6d 61 There can be ma
8de0: 6e 79 20 64 69 66 66 65 72 65 6e 74 0a 20 2a 20 ny different. *
8df0: 6b 69 6e 64 73 20 6f 66 20 65 76 65 6e 74 73 20 kinds of events
8e00: 77 69 74 68 20 64 69 66 66 65 72 65 6e 74 20 66 with different f
8e10: 69 65 6c 64 73 2c 20 63 6f 72 72 65 73 70 6f 6e ields, correspon
8e20: 64 69 6e 67 20 74 6f 20 77 69 6e 64 6f 77 20 65 ding to window e
8e30: 76 65 6e 74 73 2c 0a 20 2a 20 74 69 6d 65 72 20 vents,. * timer
8e40: 65 76 65 6e 74 73 2c 20 65 74 63 2e 20 20 54 68 events, etc. Th
8e50: 65 20 73 74 72 75 63 74 75 72 65 20 66 6f 72 20 e structure for
8e60: 61 20 70 61 72 74 69 63 75 6c 61 72 20 65 76 65 a particular eve
8e70: 6e 74 20 63 6f 6e 73 69 73 74 73 20 6f 66 0a 20 nt consists of.
8e80: 2a 20 61 20 54 63 6c 5f 45 76 65 6e 74 20 68 65 * a Tcl_Event he
8e90: 61 64 65 72 20 66 6f 6c 6c 6f 77 65 64 20 62 79 ader followed by
8ea0: 20 61 64 64 69 74 69 6f 6e 61 6c 20 69 6e 66 6f additional info
8eb0: 72 6d 61 74 69 6f 6e 20 73 70 65 63 69 66 69 63 rmation specific
8ec0: 20 74 6f 20 74 68 61 74 0a 20 2a 20 65 76 65 6e to that. * even
8ed0: 74 2e 0a 20 2a 2f 0a 0a 73 74 72 75 63 74 20 54 t.. */..struct T
8ee0: 63 6c 5f 45 76 65 6e 74 20 7b 0a 20 20 20 20 54 cl_Event {. T
8ef0: 63 6c 5f 45 76 65 6e 74 50 72 6f 63 20 2a 70 72 cl_EventProc *pr
8f00: 6f 63 3b 09 2f 2a 20 50 72 6f 63 65 64 75 72 65 oc;./* Procedure
8f10: 20 74 6f 20 63 61 6c 6c 20 74 6f 20 73 65 72 76 to call to serv
8f20: 69 63 65 20 74 68 69 73 20 65 76 65 6e 74 2e 20 ice this event.
8f30: 2a 2f 0a 20 20 20 20 73 74 72 75 63 74 20 54 63 */. struct Tc
8f40: 6c 5f 45 76 65 6e 74 20 2a 6e 65 78 74 50 74 72 l_Event *nextPtr
8f50: 3b 09 2f 2a 20 4e 65 78 74 20 69 6e 20 6c 69 73 ;./* Next in lis
8f60: 74 20 6f 66 20 70 65 6e 64 69 6e 67 20 65 76 65 t of pending eve
8f70: 6e 74 73 2c 20 6f 72 20 4e 55 4c 4c 2e 20 2a 2f nts, or NULL. */
8f80: 0a 7d 3b 0a 0a 2f 2a 0a 20 2a 20 50 6f 73 69 74 .};../*. * Posit
8f90: 69 6f 6e 73 20 74 6f 20 70 61 73 73 20 74 6f 20 ions to pass to
8fa0: 54 63 6c 5f 51 75 65 75 65 45 76 65 6e 74 3a 0a Tcl_QueueEvent:.
8fb0: 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 65 6e 75 */..typedef enu
8fc0: 6d 20 7b 0a 20 20 20 20 54 43 4c 5f 51 55 45 55 m {. TCL_QUEU
8fd0: 45 5f 54 41 49 4c 2c 20 54 43 4c 5f 51 55 45 55 E_TAIL, TCL_QUEU
8fe0: 45 5f 48 45 41 44 2c 20 54 43 4c 5f 51 55 45 55 E_HEAD, TCL_QUEU
8ff0: 45 5f 4d 41 52 4b 0a 7d 20 54 63 6c 5f 51 75 65 E_MARK.} Tcl_Que
9000: 75 65 50 6f 73 69 74 69 6f 6e 3b 0a 0a 2f 2a 0a uePosition;../*.
9010: 20 2a 20 56 61 6c 75 65 73 20 74 6f 20 70 61 73 * Values to pas
9020: 73 20 74 6f 20 54 63 6c 5f 53 65 74 53 65 72 76 s to Tcl_SetServ
9030: 69 63 65 4d 6f 64 65 20 74 6f 20 73 70 65 63 69 iceMode to speci
9040: 66 79 20 74 68 65 20 62 65 68 61 76 69 6f 72 20 fy the behavior
9050: 6f 66 20 6e 6f 74 69 66 69 65 72 0a 20 2a 20 65 of notifier. * e
9060: 76 65 6e 74 20 72 6f 75 74 69 6e 65 73 2e 0a 20 vent routines..
9070: 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f */..#define TCL_
9080: 53 45 52 56 49 43 45 5f 4e 4f 4e 45 20 30 0a 23 SERVICE_NONE 0.#
9090: 64 65 66 69 6e 65 20 54 43 4c 5f 53 45 52 56 49 define TCL_SERVI
90a0: 43 45 5f 41 4c 4c 20 31 0a 0a 2f 2a 0a 20 2a 20 CE_ALL 1../*. *
90b0: 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 73 74 The following st
90c0: 72 75 63 74 75 72 65 20 6b 65 65 70 73 20 69 73 ructure keeps is
90d0: 20 75 73 65 64 20 74 6f 20 68 6f 6c 64 20 61 20 used to hold a
90e0: 74 69 6d 65 20 76 61 6c 75 65 2c 20 65 69 74 68 time value, eith
90f0: 65 72 20 61 73 0a 20 2a 20 61 6e 20 61 62 73 6f er as. * an abso
9100: 6c 75 74 65 20 74 69 6d 65 20 28 74 68 65 20 6e lute time (the n
9110: 75 6d 62 65 72 20 6f 66 20 73 65 63 6f 6e 64 73 umber of seconds
9120: 20 66 72 6f 6d 20 74 68 65 20 65 70 6f 63 68 29 from the epoch)
9130: 20 6f 72 20 61 73 20 61 6e 0a 20 2a 20 65 6c 61 or as an. * ela
9140: 70 73 65 64 20 74 69 6d 65 2e 20 4f 6e 20 55 6e psed time. On Un
9150: 69 78 20 73 79 73 74 65 6d 73 20 74 68 65 20 65 ix systems the e
9160: 70 6f 63 68 20 69 73 20 4d 69 64 6e 69 67 68 74 poch is Midnight
9170: 20 4a 61 6e 20 31 2c 20 31 39 37 30 20 47 4d 54 Jan 1, 1970 GMT
9180: 2e 0a 20 2a 20 4f 6e 20 4d 61 63 69 6e 74 6f 73 .. * On Macintos
9190: 68 20 73 79 73 74 65 6d 73 20 74 68 65 20 65 70 h systems the ep
91a0: 6f 63 68 20 69 73 20 4d 69 64 6e 69 67 68 74 20 och is Midnight
91b0: 4a 61 6e 20 31 2c 20 31 39 30 34 20 47 4d 54 2e Jan 1, 1904 GMT.
91c0: 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 73 74 . */..typedef st
91d0: 72 75 63 74 20 54 63 6c 5f 54 69 6d 65 20 7b 0a ruct Tcl_Time {.
91e0: 20 20 20 20 6c 6f 6e 67 20 73 65 63 3b 09 09 09 long sec;...
91f0: 2f 2a 20 53 65 63 6f 6e 64 73 2e 20 2a 2f 0a 20 /* Seconds. */.
9200: 20 20 20 6c 6f 6e 67 20 75 73 65 63 3b 09 09 09 long usec;...
9210: 2f 2a 20 4d 69 63 72 6f 73 65 63 6f 6e 64 73 2e /* Microseconds.
9220: 20 2a 2f 0a 7d 20 54 63 6c 5f 54 69 6d 65 3b 0a */.} Tcl_Time;.
9230: 0a 74 79 70 65 64 65 66 20 76 6f 69 64 20 28 54 .typedef void (T
9240: 63 6c 5f 53 65 74 54 69 6d 65 72 50 72 6f 63 29 cl_SetTimerProc)
9250: 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 54 63 _ANSI_ARGS_((Tc
9260: 6c 5f 54 69 6d 65 20 2a 74 69 6d 65 50 74 72 29 l_Time *timePtr)
9270: 29 3b 0a 74 79 70 65 64 65 66 20 69 6e 74 20 28 );.typedef int (
9280: 54 63 6c 5f 57 61 69 74 46 6f 72 45 76 65 6e 74 Tcl_WaitForEvent
9290: 50 72 6f 63 29 20 5f 41 4e 53 49 5f 41 52 47 53 Proc) _ANSI_ARGS
92a0: 5f 28 28 54 63 6c 5f 54 69 6d 65 20 2a 74 69 6d _((Tcl_Time *tim
92b0: 65 50 74 72 29 29 3b 0a 0a 2f 2a 0a 20 2a 20 42 ePtr));../*. * B
92c0: 69 74 73 20 74 6f 20 70 61 73 73 20 74 6f 20 54 its to pass to T
92d0: 63 6c 5f 43 72 65 61 74 65 46 69 6c 65 48 61 6e cl_CreateFileHan
92e0: 64 6c 65 72 20 61 6e 64 20 54 63 6c 5f 43 72 65 dler and Tcl_Cre
92f0: 61 74 65 43 68 61 6e 6e 65 6c 48 61 6e 64 6c 65 ateChannelHandle
9300: 72 0a 20 2a 20 74 6f 20 69 6e 64 69 63 61 74 65 r. * to indicate
9310: 20 77 68 61 74 20 73 6f 72 74 73 20 6f 66 20 65 what sorts of e
9320: 76 65 6e 74 73 20 61 72 65 20 6f 66 20 69 6e 74 vents are of int
9330: 65 72 65 73 74 3a 0a 20 2a 2f 0a 0a 23 64 65 66 erest:. */..#def
9340: 69 6e 65 20 54 43 4c 5f 52 45 41 44 41 42 4c 45 ine TCL_READABLE
9350: 09 28 31 3c 3c 31 29 0a 23 64 65 66 69 6e 65 20 .(1<<1).#define
9360: 54 43 4c 5f 57 52 49 54 41 42 4c 45 09 28 31 3c TCL_WRITABLE.(1<
9370: 3c 32 29 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f <2).#define TCL_
9380: 45 58 43 45 50 54 49 4f 4e 09 28 31 3c 3c 33 29 EXCEPTION.(1<<3)
9390: 0a 0a 2f 2a 0a 20 2a 20 46 6c 61 67 20 76 61 6c ../*. * Flag val
93a0: 75 65 73 20 74 6f 20 70 61 73 73 20 74 6f 20 54 ues to pass to T
93b0: 63 6c 5f 4f 70 65 6e 43 6f 6d 6d 61 6e 64 43 68 cl_OpenCommandCh
93c0: 61 6e 6e 65 6c 20 74 6f 20 69 6e 64 69 63 61 74 annel to indicat
93d0: 65 20 74 68 65 0a 20 2a 20 64 69 73 70 6f 73 69 e the. * disposi
93e0: 74 69 6f 6e 20 6f 66 20 74 68 65 20 73 74 64 69 tion of the stdi
93f0: 6f 20 68 61 6e 64 6c 65 73 2e 20 20 54 43 4c 5f o handles. TCL_
9400: 53 54 44 49 4e 2c 20 54 43 4c 5f 53 54 44 4f 55 STDIN, TCL_STDOU
9410: 54 2c 20 54 43 4c 5f 53 54 44 45 52 52 2c 0a 20 T, TCL_STDERR,.
9420: 2a 20 61 72 65 20 61 6c 73 6f 20 75 73 65 64 20 * are also used
9430: 69 6e 20 54 63 6c 5f 47 65 74 53 74 64 43 68 61 in Tcl_GetStdCha
9440: 6e 6e 65 6c 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 nnel.. */..#defi
9450: 6e 65 20 54 43 4c 5f 53 54 44 49 4e 09 09 28 31 ne TCL_STDIN..(1
9460: 3c 3c 31 29 09 0a 23 64 65 66 69 6e 65 20 54 43 <<1)..#define TC
9470: 4c 5f 53 54 44 4f 55 54 09 09 28 31 3c 3c 32 29 L_STDOUT..(1<<2)
9480: 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 53 54 44 .#define TCL_STD
9490: 45 52 52 09 09 28 31 3c 3c 33 29 0a 23 64 65 66 ERR..(1<<3).#def
94a0: 69 6e 65 20 54 43 4c 5f 45 4e 46 4f 52 43 45 5f ine TCL_ENFORCE_
94b0: 4d 4f 44 45 09 28 31 3c 3c 34 29 0a 0a 2f 2a 0a MODE.(1<<4)../*.
94c0: 20 2a 20 42 69 74 73 20 70 61 73 73 65 64 20 74 * Bits passed t
94d0: 6f 20 54 63 6c 5f 44 72 69 76 65 72 43 6c 6f 73 o Tcl_DriverClos
94e0: 65 32 50 72 6f 63 20 74 6f 20 69 6e 64 69 63 61 e2Proc to indica
94f0: 74 65 20 77 68 69 63 68 20 73 69 64 65 20 6f 66 te which side of
9500: 20 61 20 63 68 61 6e 6e 65 6c 0a 20 2a 20 73 68 a channel. * sh
9510: 6f 75 6c 64 20 62 65 20 63 6c 6f 73 65 64 2e 0a ould be closed..
9520: 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c */..#define TCL
9530: 5f 43 4c 4f 53 45 5f 52 45 41 44 09 09 28 31 3c _CLOSE_READ..(1<
9540: 3c 31 29 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f <1).#define TCL_
9550: 43 4c 4f 53 45 5f 57 52 49 54 45 09 09 28 31 3c CLOSE_WRITE..(1<
9560: 3c 32 29 0a 0a 2f 2a 0a 20 2a 20 56 61 6c 75 65 <2)../*. * Value
9570: 20 74 6f 20 75 73 65 20 61 73 20 74 68 65 20 63 to use as the c
9580: 6c 6f 73 65 50 72 6f 63 20 66 6f 72 20 61 20 63 loseProc for a c
9590: 68 61 6e 6e 65 6c 20 74 68 61 74 20 73 75 70 70 hannel that supp
95a0: 6f 72 74 73 20 74 68 65 0a 20 2a 20 63 6c 6f 73 orts the. * clos
95b0: 65 32 50 72 6f 63 20 69 6e 74 65 72 66 61 63 65 e2Proc interface
95c0: 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 .. */..#define T
95d0: 43 4c 5f 43 4c 4f 53 45 32 50 52 4f 43 09 28 28 CL_CLOSE2PROC.((
95e0: 54 63 6c 5f 44 72 69 76 65 72 43 6c 6f 73 65 50 Tcl_DriverCloseP
95f0: 72 6f 63 20 2a 29 31 29 0a 0a 2f 2a 0a 20 2a 20 roc *)1)../*. *
9600: 43 68 61 6e 6e 65 6c 20 76 65 72 73 69 6f 6e 20 Channel version
9610: 74 61 67 2e 20 20 54 68 69 73 20 77 61 73 20 69 tag. This was i
9620: 6e 74 72 6f 64 75 63 65 64 20 69 6e 20 38 2e 33 ntroduced in 8.3
9630: 2e 32 2f 38 2e 34 2e 0a 20 2a 2f 0a 0a 23 64 65 .2/8.4.. */..#de
9640: 66 69 6e 65 20 54 43 4c 5f 43 48 41 4e 4e 45 4c fine TCL_CHANNEL
9650: 5f 56 45 52 53 49 4f 4e 5f 31 09 28 28 54 63 6c _VERSION_1.((Tcl
9660: 5f 43 68 61 6e 6e 65 6c 54 79 70 65 56 65 72 73 _ChannelTypeVers
9670: 69 6f 6e 29 20 30 78 31 29 0a 23 64 65 66 69 6e ion) 0x1).#defin
9680: 65 20 54 43 4c 5f 43 48 41 4e 4e 45 4c 5f 56 45 e TCL_CHANNEL_VE
9690: 52 53 49 4f 4e 5f 32 09 28 28 54 63 6c 5f 43 68 RSION_2.((Tcl_Ch
96a0: 61 6e 6e 65 6c 54 79 70 65 56 65 72 73 69 6f 6e annelTypeVersion
96b0: 29 20 30 78 32 29 0a 0a 2f 2a 0a 20 2a 20 54 79 ) 0x2)../*. * Ty
96c0: 70 65 64 65 66 73 20 66 6f 72 20 74 68 65 20 76 pedefs for the v
96d0: 61 72 69 6f 75 73 20 6f 70 65 72 61 74 69 6f 6e arious operation
96e0: 73 20 69 6e 20 61 20 63 68 61 6e 6e 65 6c 20 74 s in a channel t
96f0: 79 70 65 3a 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 ype:. */..typede
9700: 66 20 69 6e 74 09 28 54 63 6c 5f 44 72 69 76 65 f int.(Tcl_Drive
9710: 72 42 6c 6f 63 6b 4d 6f 64 65 50 72 6f 63 29 20 rBlockModeProc)
9720: 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 0a 09 09 _ANSI_ARGS_((...
9730: 20 20 20 20 43 6c 69 65 6e 74 44 61 74 61 20 69 ClientData i
9740: 6e 73 74 61 6e 63 65 44 61 74 61 2c 20 69 6e 74 nstanceData, int
9750: 20 6d 6f 64 65 29 29 3b 0a 74 79 70 65 64 65 66 mode));.typedef
9760: 20 69 6e 74 09 28 54 63 6c 5f 44 72 69 76 65 72 int.(Tcl_Driver
9770: 43 6c 6f 73 65 50 72 6f 63 29 20 5f 41 4e 53 49 CloseProc) _ANSI
9780: 5f 41 52 47 53 5f 28 28 43 6c 69 65 6e 74 44 61 _ARGS_((ClientDa
9790: 74 61 20 69 6e 73 74 61 6e 63 65 44 61 74 61 2c ta instanceData,
97a0: 0a 09 09 20 20 20 20 54 63 6c 5f 49 6e 74 65 72 ... Tcl_Inter
97b0: 70 20 2a 69 6e 74 65 72 70 29 29 3b 0a 74 79 70 p *interp));.typ
97c0: 65 64 65 66 20 69 6e 74 09 28 54 63 6c 5f 44 72 edef int.(Tcl_Dr
97d0: 69 76 65 72 43 6c 6f 73 65 32 50 72 6f 63 29 20 iverClose2Proc)
97e0: 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 43 6c 69 _ANSI_ARGS_((Cli
97f0: 65 6e 74 44 61 74 61 20 69 6e 73 74 61 6e 63 65 entData instance
9800: 44 61 74 61 2c 0a 09 09 20 20 20 20 54 63 6c 5f Data,... Tcl_
9810: 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c 20 Interp *interp,
9820: 69 6e 74 20 66 6c 61 67 73 29 29 3b 0a 74 79 70 int flags));.typ
9830: 65 64 65 66 20 69 6e 74 09 28 54 63 6c 5f 44 72 edef int.(Tcl_Dr
9840: 69 76 65 72 49 6e 70 75 74 50 72 6f 63 29 20 5f iverInputProc) _
9850: 41 4e 53 49 5f 41 52 47 53 5f 28 28 43 6c 69 65 ANSI_ARGS_((Clie
9860: 6e 74 44 61 74 61 20 69 6e 73 74 61 6e 63 65 44 ntData instanceD
9870: 61 74 61 2c 0a 09 09 20 20 20 20 63 68 61 72 20 ata,... char
9880: 2a 62 75 66 2c 20 69 6e 74 20 74 6f 52 65 61 64 *buf, int toRead
9890: 2c 20 69 6e 74 20 2a 65 72 72 6f 72 43 6f 64 65 , int *errorCode
98a0: 50 74 72 29 29 3b 0a 74 79 70 65 64 65 66 20 69 Ptr));.typedef i
98b0: 6e 74 09 28 54 63 6c 5f 44 72 69 76 65 72 4f 75 nt.(Tcl_DriverOu
98c0: 74 70 75 74 50 72 6f 63 29 20 5f 41 4e 53 49 5f tputProc) _ANSI_
98d0: 41 52 47 53 5f 28 28 43 6c 69 65 6e 74 44 61 74 ARGS_((ClientDat
98e0: 61 20 69 6e 73 74 61 6e 63 65 44 61 74 61 2c 0a a instanceData,.
98f0: 09 09 20 20 20 20 63 68 61 72 20 2a 62 75 66 2c .. char *buf,
9900: 20 69 6e 74 20 74 6f 57 72 69 74 65 2c 20 69 6e int toWrite, in
9910: 74 20 2a 65 72 72 6f 72 43 6f 64 65 50 74 72 29 t *errorCodePtr)
9920: 29 3b 0a 74 79 70 65 64 65 66 20 69 6e 74 09 28 );.typedef int.(
9930: 54 63 6c 5f 44 72 69 76 65 72 53 65 65 6b 50 72 Tcl_DriverSeekPr
9940: 6f 63 29 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 oc) _ANSI_ARGS_(
9950: 28 43 6c 69 65 6e 74 44 61 74 61 20 69 6e 73 74 (ClientData inst
9960: 61 6e 63 65 44 61 74 61 2c 0a 09 09 20 20 20 20 anceData,...
9970: 6c 6f 6e 67 20 6f 66 66 73 65 74 2c 20 69 6e 74 long offset, int
9980: 20 6d 6f 64 65 2c 20 69 6e 74 20 2a 65 72 72 6f mode, int *erro
9990: 72 43 6f 64 65 50 74 72 29 29 3b 0a 74 79 70 65 rCodePtr));.type
99a0: 64 65 66 20 69 6e 74 09 28 54 63 6c 5f 44 72 69 def int.(Tcl_Dri
99b0: 76 65 72 53 65 74 4f 70 74 69 6f 6e 50 72 6f 63 verSetOptionProc
99c0: 29 20 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 0a ) _ANSI_ARGS_((.
99d0: 09 09 20 20 20 20 43 6c 69 65 6e 74 44 61 74 61 .. ClientData
99e0: 20 69 6e 73 74 61 6e 63 65 44 61 74 61 2c 20 54 instanceData, T
99f0: 63 6c 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 cl_Interp *inter
9a00: 70 2c 0a 09 20 20 20 20 20 20 20 20 20 20 20 20 p,..
9a10: 63 68 61 72 20 2a 6f 70 74 69 6f 6e 4e 61 6d 65 char *optionName
9a20: 2c 20 63 68 61 72 20 2a 76 61 6c 75 65 29 29 3b , char *value));
9a30: 0a 74 79 70 65 64 65 66 20 69 6e 74 09 28 54 63 .typedef int.(Tc
9a40: 6c 5f 44 72 69 76 65 72 47 65 74 4f 70 74 69 6f l_DriverGetOptio
9a50: 6e 50 72 6f 63 29 20 5f 41 4e 53 49 5f 41 52 47 nProc) _ANSI_ARG
9a60: 53 5f 28 28 0a 09 09 20 20 20 20 43 6c 69 65 6e S_((... Clien
9a70: 74 44 61 74 61 20 69 6e 73 74 61 6e 63 65 44 61 tData instanceDa
9a80: 74 61 2c 20 54 63 6c 5f 49 6e 74 65 72 70 20 2a ta, Tcl_Interp *
9a90: 69 6e 74 65 72 70 2c 0a 09 09 20 20 20 20 63 68 interp,... ch
9aa0: 61 72 20 2a 6f 70 74 69 6f 6e 4e 61 6d 65 2c 20 ar *optionName,
9ab0: 54 63 6c 5f 44 53 74 72 69 6e 67 20 2a 64 73 50 Tcl_DString *dsP
9ac0: 74 72 29 29 3b 0a 74 79 70 65 64 65 66 20 76 6f tr));.typedef vo
9ad0: 69 64 09 28 54 63 6c 5f 44 72 69 76 65 72 57 61 id.(Tcl_DriverWa
9ae0: 74 63 68 50 72 6f 63 29 20 5f 41 4e 53 49 5f 41 tchProc) _ANSI_A
9af0: 52 47 53 5f 28 28 0a 09 09 20 20 20 20 43 6c 69 RGS_((... Cli
9b00: 65 6e 74 44 61 74 61 20 69 6e 73 74 61 6e 63 65 entData instance
9b10: 44 61 74 61 2c 20 69 6e 74 20 6d 61 73 6b 29 29 Data, int mask))
9b20: 3b 0a 74 79 70 65 64 65 66 20 69 6e 74 09 28 54 ;.typedef int.(T
9b30: 63 6c 5f 44 72 69 76 65 72 47 65 74 48 61 6e 64 cl_DriverGetHand
9b40: 6c 65 50 72 6f 63 29 20 5f 41 4e 53 49 5f 41 52 leProc) _ANSI_AR
9b50: 47 53 5f 28 28 0a 09 09 20 20 20 20 43 6c 69 65 GS_((... Clie
9b60: 6e 74 44 61 74 61 20 69 6e 73 74 61 6e 63 65 44 ntData instanceD
9b70: 61 74 61 2c 20 69 6e 74 20 64 69 72 65 63 74 69 ata, int directi
9b80: 6f 6e 2c 0a 09 09 20 20 20 20 43 6c 69 65 6e 74 on,... Client
9b90: 44 61 74 61 20 2a 68 61 6e 64 6c 65 50 74 72 29 Data *handlePtr)
9ba0: 29 3b 0a 74 79 70 65 64 65 66 20 69 6e 74 09 28 );.typedef int.(
9bb0: 54 63 6c 5f 44 72 69 76 65 72 46 6c 75 73 68 50 Tcl_DriverFlushP
9bc0: 72 6f 63 29 20 5f 41 4e 53 49 5f 41 52 47 53 5f roc) _ANSI_ARGS_
9bd0: 28 28 0a 09 09 20 20 20 20 43 6c 69 65 6e 74 44 ((... ClientD
9be0: 61 74 61 20 69 6e 73 74 61 6e 63 65 44 61 74 61 ata instanceData
9bf0: 29 29 3b 0a 74 79 70 65 64 65 66 20 69 6e 74 09 ));.typedef int.
9c00: 28 54 63 6c 5f 44 72 69 76 65 72 48 61 6e 64 6c (Tcl_DriverHandl
9c10: 65 72 50 72 6f 63 29 20 5f 41 4e 53 49 5f 41 52 erProc) _ANSI_AR
9c20: 47 53 5f 28 28 0a 09 09 20 20 20 20 43 6c 69 65 GS_((... Clie
9c30: 6e 74 44 61 74 61 20 69 6e 73 74 61 6e 63 65 44 ntData instanceD
9c40: 61 74 61 2c 20 69 6e 74 20 69 6e 74 65 72 65 73 ata, int interes
9c50: 74 4d 61 73 6b 29 29 3b 0a 0a 2f 2a 0a 20 2a 20 tMask));../*. *
9c60: 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 64 65 The following de
9c70: 63 6c 61 72 61 74 69 6f 6e 73 20 65 69 74 68 65 clarations eithe
9c80: 72 20 6d 61 70 20 63 6b 61 6c 6c 6f 63 20 61 6e r map ckalloc an
9c90: 64 20 63 6b 66 72 65 65 20 74 6f 0a 20 2a 20 6d d ckfree to. * m
9ca0: 61 6c 6c 6f 63 20 61 6e 64 20 66 72 65 65 2c 20 alloc and free,
9cb0: 6f 72 20 74 68 65 79 20 6d 61 70 20 74 68 65 6d or they map them
9cc0: 20 74 6f 20 70 72 6f 63 65 64 75 72 65 73 20 77 to procedures w
9cd0: 69 74 68 20 61 6c 6c 20 73 6f 72 74 73 0a 20 2a ith all sorts. *
9ce0: 20 6f 66 20 64 65 62 75 67 67 69 6e 67 20 68 6f of debugging ho
9cf0: 6f 6b 73 20 64 65 66 69 6e 65 64 20 69 6e 20 74 oks defined in t
9d00: 63 6c 43 6b 61 6c 6c 6f 63 2e 63 2e 0a 20 2a 2f clCkalloc.c.. */
9d10: 0a 0a 23 69 66 64 65 66 20 54 43 4c 5f 4d 45 4d ..#ifdef TCL_MEM
9d20: 5f 44 45 42 55 47 0a 0a 23 20 20 20 64 65 66 69 _DEBUG..# defi
9d30: 6e 65 20 63 6b 61 6c 6c 6f 63 28 78 29 20 54 63 ne ckalloc(x) Tc
9d40: 6c 5f 44 62 43 6b 61 6c 6c 6f 63 28 78 2c 20 5f l_DbCkalloc(x, _
9d50: 5f 46 49 4c 45 5f 5f 2c 20 5f 5f 4c 49 4e 45 5f _FILE__, __LINE_
9d60: 5f 29 0a 23 20 20 20 64 65 66 69 6e 65 20 63 6b _).# define ck
9d70: 66 72 65 65 28 78 29 20 20 54 63 6c 5f 44 62 43 free(x) Tcl_DbC
9d80: 6b 66 72 65 65 28 78 2c 20 5f 5f 46 49 4c 45 5f kfree(x, __FILE_
9d90: 5f 2c 20 5f 5f 4c 49 4e 45 5f 5f 29 0a 23 20 20 _, __LINE__).#
9da0: 20 64 65 66 69 6e 65 20 63 6b 72 65 61 6c 6c 6f define ckreallo
9db0: 63 28 78 2c 79 29 20 54 63 6c 5f 44 62 43 6b 72 c(x,y) Tcl_DbCkr
9dc0: 65 61 6c 6c 6f 63 28 28 78 29 2c 20 28 79 29 2c ealloc((x), (y),
9dd0: 5f 5f 46 49 4c 45 5f 5f 2c 20 5f 5f 4c 49 4e 45 __FILE__, __LINE
9de0: 5f 5f 29 0a 0a 23 65 6c 73 65 20 2f 2a 20 21 54 __)..#else /* !T
9df0: 43 4c 5f 4d 45 4d 5f 44 45 42 55 47 20 2a 2f 0a CL_MEM_DEBUG */.
9e00: 0a 2f 2a 0a 20 2a 20 49 66 20 77 65 20 61 72 65 ./*. * If we are
9e10: 20 6e 6f 74 20 75 73 69 6e 67 20 74 68 65 20 64 not using the d
9e20: 65 62 75 67 67 69 6e 67 20 61 6c 6c 6f 63 61 74 ebugging allocat
9e30: 6f 72 2c 20 77 65 20 73 68 6f 75 6c 64 20 63 61 or, we should ca
9e40: 6c 6c 20 74 68 65 20 0a 20 2a 20 54 63 6c 5f 41 ll the . * Tcl_A
9e50: 6c 6c 6f 63 2c 20 65 74 20 61 6c 2e 20 72 6f 75 lloc, et al. rou
9e60: 74 69 6e 65 73 20 69 6e 20 6f 72 64 65 72 20 74 tines in order t
9e70: 6f 20 67 75 61 72 61 6e 74 65 65 20 74 68 61 74 o guarantee that
9e80: 20 65 76 65 72 79 20 6d 6f 64 75 6c 65 0a 20 2a every module. *
9e90: 20 69 73 20 75 73 69 6e 67 20 74 68 65 20 73 61 is using the sa
9ea0: 6d 65 20 6d 65 6d 6f 72 79 20 61 6c 6c 6f 63 61 me memory alloca
9eb0: 74 6f 72 20 62 6f 74 68 20 69 6e 73 69 64 65 20 tor both inside
9ec0: 61 6e 64 20 6f 75 74 73 69 64 65 20 6f 66 20 74 and outside of t
9ed0: 68 65 0a 20 2a 20 54 63 6c 20 6c 69 62 72 61 72 he. * Tcl librar
9ee0: 79 2e 0a 20 2a 2f 0a 0a 23 20 20 20 64 65 66 69 y.. */..# defi
9ef0: 6e 65 20 63 6b 61 6c 6c 6f 63 28 78 29 20 54 63 ne ckalloc(x) Tc
9f00: 6c 5f 41 6c 6c 6f 63 28 78 29 0a 23 20 20 20 64 l_Alloc(x).# d
9f10: 65 66 69 6e 65 20 63 6b 66 72 65 65 28 78 29 20 efine ckfree(x)
9f20: 54 63 6c 5f 46 72 65 65 28 78 29 0a 23 20 20 20 Tcl_Free(x).#
9f30: 64 65 66 69 6e 65 20 63 6b 72 65 61 6c 6c 6f 63 define ckrealloc
9f40: 28 78 2c 79 29 20 54 63 6c 5f 52 65 61 6c 6c 6f (x,y) Tcl_Reallo
9f50: 63 28 78 2c 79 29 0a 23 20 20 20 64 65 66 69 6e c(x,y).# defin
9f60: 65 20 54 63 6c 5f 49 6e 69 74 4d 65 6d 6f 72 79 e Tcl_InitMemory
9f70: 28 78 29 0a 23 20 20 20 64 65 66 69 6e 65 20 54 (x).# define T
9f80: 63 6c 5f 44 75 6d 70 41 63 74 69 76 65 4d 65 6d cl_DumpActiveMem
9f90: 6f 72 79 28 78 29 0a 23 20 20 20 64 65 66 69 6e ory(x).# defin
9fa0: 65 20 54 63 6c 5f 56 61 6c 69 64 61 74 65 41 6c e Tcl_ValidateAl
9fb0: 6c 4d 65 6d 6f 72 79 28 78 2c 79 29 0a 0a 23 65 lMemory(x,y)..#e
9fc0: 6e 64 69 66 20 2f 2a 20 21 54 43 4c 5f 4d 45 4d ndif /* !TCL_MEM
9fd0: 5f 44 45 42 55 47 20 2a 2f 0a 0a 2f 2a 0a 20 2a _DEBUG */../*. *
9fe0: 20 45 6e 75 6d 20 66 6f 72 20 64 69 66 66 65 72 Enum for differ
9ff0: 65 6e 74 20 65 6e 64 20 6f 66 20 6c 69 6e 65 20 ent end of line
a000: 74 72 61 6e 73 6c 61 74 69 6f 6e 20 61 6e 64 20 translation and
a010: 72 65 63 6f 67 6e 69 74 69 6f 6e 20 6d 6f 64 65 recognition mode
a020: 73 2e 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 s.. */..typedef
a030: 65 6e 75 6d 20 54 63 6c 5f 45 6f 6c 54 72 61 6e enum Tcl_EolTran
a040: 73 6c 61 74 69 6f 6e 20 7b 0a 20 20 20 20 54 43 slation {. TC
a050: 4c 5f 54 52 41 4e 53 4c 41 54 45 5f 41 55 54 4f L_TRANSLATE_AUTO
a060: 2c 09 09 09 2f 2a 20 45 6f 6c 20 3d 3d 20 5c 72 ,.../* Eol == \r
a070: 2c 20 5c 6e 20 61 6e 64 20 5c 72 5c 6e 2e 20 2a , \n and \r\n. *
a080: 2f 0a 20 20 20 20 54 43 4c 5f 54 52 41 4e 53 4c /. TCL_TRANSL
a090: 41 54 45 5f 43 52 2c 09 09 09 2f 2a 20 45 6f 6c ATE_CR,.../* Eol
a0a0: 20 3d 3d 20 5c 72 2e 20 2a 2f 0a 20 20 20 20 54 == \r. */. T
a0b0: 43 4c 5f 54 52 41 4e 53 4c 41 54 45 5f 4c 46 2c CL_TRANSLATE_LF,
a0c0: 09 09 09 2f 2a 20 45 6f 6c 20 3d 3d 20 5c 6e 2e .../* Eol == \n.
a0d0: 20 2a 2f 0a 20 20 20 20 54 43 4c 5f 54 52 41 4e */. TCL_TRAN
a0e0: 53 4c 41 54 45 5f 43 52 4c 46 09 09 09 2f 2a 20 SLATE_CRLF.../*
a0f0: 45 6f 6c 20 3d 3d 20 5c 72 5c 6e 2e 20 2a 2f 0a Eol == \r\n. */.
a100: 7d 20 54 63 6c 5f 45 6f 6c 54 72 61 6e 73 6c 61 } Tcl_EolTransla
a110: 74 69 6f 6e 3b 0a 0a 2f 2a 0a 20 2a 20 73 74 72 tion;../*. * str
a120: 75 63 74 20 54 63 6c 5f 43 68 61 6e 6e 65 6c 54 uct Tcl_ChannelT
a130: 79 70 65 3a 0a 20 2a 0a 20 2a 20 4f 6e 65 20 73 ype:. *. * One s
a140: 75 63 68 20 73 74 72 75 63 74 75 72 65 20 65 78 uch structure ex
a150: 69 73 74 73 20 66 6f 72 20 65 61 63 68 20 74 79 ists for each ty
a160: 70 65 20 28 6b 69 6e 64 29 20 6f 66 20 63 68 61 pe (kind) of cha
a170: 6e 6e 65 6c 2e 0a 20 2a 20 49 74 20 63 6f 6c 6c nnel.. * It coll
a180: 65 63 74 73 20 74 6f 67 65 74 68 65 72 20 69 6e ects together in
a190: 20 6f 6e 65 20 70 6c 61 63 65 20 61 6c 6c 20 74 one place all t
a1a0: 68 65 20 66 75 6e 63 74 69 6f 6e 73 20 74 68 61 he functions tha
a1b0: 74 20 61 72 65 0a 20 2a 20 70 61 72 74 20 6f 66 t are. * part of
a1c0: 20 74 68 65 20 73 70 65 63 69 66 69 63 20 63 68 the specific ch
a1d0: 61 6e 6e 65 6c 20 74 79 70 65 2e 0a 20 2a 0a 20 annel type.. *.
a1e0: 2a 20 49 74 20 69 73 20 72 65 63 6f 6d 6d 65 6e * It is recommen
a1f0: 64 20 74 68 61 74 20 74 68 65 20 54 63 6c 5f 43 d that the Tcl_C
a200: 68 61 6e 6e 65 6c 2a 20 66 75 6e 63 74 69 6f 6e hannel* function
a210: 73 20 61 72 65 20 75 73 65 64 20 74 6f 20 61 63 s are used to ac
a220: 63 65 73 73 0a 20 2a 20 65 6c 65 6d 65 6e 74 73 cess. * elements
a230: 20 6f 66 20 74 68 69 73 20 73 74 72 75 63 74 75 of this structu
a240: 72 65 2c 20 69 6e 73 74 65 61 64 20 6f 66 20 64 re, instead of d
a250: 69 72 65 63 74 20 61 63 63 65 73 73 69 6e 67 2e irect accessing.
a260: 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 73 74 . */..typedef st
a270: 72 75 63 74 20 54 63 6c 5f 43 68 61 6e 6e 65 6c ruct Tcl_Channel
a280: 54 79 70 65 20 7b 0a 20 20 20 20 63 68 61 72 20 Type {. char
a290: 2a 74 79 70 65 4e 61 6d 65 3b 09 09 09 2f 2a 20 *typeName;.../*
a2a0: 54 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 The name of the
a2b0: 63 68 61 6e 6e 65 6c 20 74 79 70 65 20 69 6e 20 channel type in
a2c0: 54 63 6c 0a 09 09 09 09 09 20 2a 20 63 6f 6d 6d Tcl...... * comm
a2d0: 61 6e 64 73 2e 20 54 68 69 73 20 73 74 6f 72 61 ands. This stora
a2e0: 67 65 20 69 73 20 6f 77 6e 65 64 20 62 79 0a 09 ge is owned by..
a2f0: 09 09 09 09 20 2a 20 63 68 61 6e 6e 65 6c 20 74 .... * channel t
a300: 79 70 65 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f ype. */. Tcl_
a310: 43 68 61 6e 6e 65 6c 54 79 70 65 56 65 72 73 69 ChannelTypeVersi
a320: 6f 6e 20 76 65 72 73 69 6f 6e 3b 09 2f 2a 20 56 on version;./* V
a330: 65 72 73 69 6f 6e 20 6f 66 20 74 68 65 20 63 68 ersion of the ch
a340: 61 6e 6e 65 6c 20 74 79 70 65 2e 20 2a 2f 0a 20 annel type. */.
a350: 20 20 20 54 63 6c 5f 44 72 69 76 65 72 43 6c 6f Tcl_DriverClo
a360: 73 65 50 72 6f 63 20 2a 63 6c 6f 73 65 50 72 6f seProc *closePro
a370: 63 3b 09 2f 2a 20 50 72 6f 63 65 64 75 72 65 20 c;./* Procedure
a380: 74 6f 20 63 61 6c 6c 20 74 6f 20 63 6c 6f 73 65 to call to close
a390: 20 74 68 65 0a 09 09 09 09 09 20 2a 20 63 68 61 the...... * cha
a3a0: 6e 6e 65 6c 2c 20 6f 72 20 54 43 4c 5f 43 4c 4f nnel, or TCL_CLO
a3b0: 53 45 32 50 52 4f 43 20 69 66 20 74 68 65 0a 09 SE2PROC if the..
a3c0: 09 09 09 09 20 2a 20 63 6c 6f 73 65 32 50 72 6f .... * close2Pro
a3d0: 63 20 73 68 6f 75 6c 64 20 62 65 20 75 73 65 64 c should be used
a3e0: 0a 09 09 09 09 09 20 2a 20 69 6e 73 74 65 61 64 ...... * instead
a3f0: 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 44 72 69 . */. Tcl_Dri
a400: 76 65 72 49 6e 70 75 74 50 72 6f 63 20 2a 69 6e verInputProc *in
a410: 70 75 74 50 72 6f 63 3b 09 2f 2a 20 50 72 6f 63 putProc;./* Proc
a420: 65 64 75 72 65 20 74 6f 20 63 61 6c 6c 20 66 6f edure to call fo
a430: 72 20 69 6e 70 75 74 0a 09 09 09 09 09 20 2a 20 r input...... *
a440: 6f 6e 20 63 68 61 6e 6e 65 6c 2e 20 2a 2f 0a 20 on channel. */.
a450: 20 20 20 54 63 6c 5f 44 72 69 76 65 72 4f 75 74 Tcl_DriverOut
a460: 70 75 74 50 72 6f 63 20 2a 6f 75 74 70 75 74 50 putProc *outputP
a470: 72 6f 63 3b 09 2f 2a 20 50 72 6f 63 65 64 75 72 roc;./* Procedur
a480: 65 20 74 6f 20 63 61 6c 6c 20 66 6f 72 20 6f 75 e to call for ou
a490: 74 70 75 74 0a 09 09 09 09 09 20 2a 20 6f 6e 20 tput...... * on
a4a0: 63 68 61 6e 6e 65 6c 2e 20 2a 2f 0a 20 20 20 20 channel. */.
a4b0: 54 63 6c 5f 44 72 69 76 65 72 53 65 65 6b 50 72 Tcl_DriverSeekPr
a4c0: 6f 63 20 2a 73 65 65 6b 50 72 6f 63 3b 09 2f 2a oc *seekProc;./*
a4d0: 20 50 72 6f 63 65 64 75 72 65 20 74 6f 20 63 61 Procedure to ca
a4e0: 6c 6c 20 74 6f 20 73 65 65 6b 0a 09 09 09 09 09 ll to seek......
a4f0: 20 2a 20 6f 6e 20 74 68 65 20 63 68 61 6e 6e 65 * on the channe
a500: 6c 2e 20 4d 61 79 20 62 65 20 4e 55 4c 4c 2e 20 l. May be NULL.
a510: 2a 2f 0a 20 20 20 20 54 63 6c 5f 44 72 69 76 65 */. Tcl_Drive
a520: 72 53 65 74 4f 70 74 69 6f 6e 50 72 6f 63 20 2a rSetOptionProc *
a530: 73 65 74 4f 70 74 69 6f 6e 50 72 6f 63 3b 0a 09 setOptionProc;..
a540: 09 09 09 09 2f 2a 20 53 65 74 20 61 6e 20 6f 70 ..../* Set an op
a550: 74 69 6f 6e 20 6f 6e 20 61 20 63 68 61 6e 6e 65 tion on a channe
a560: 6c 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 44 72 l. */. Tcl_Dr
a570: 69 76 65 72 47 65 74 4f 70 74 69 6f 6e 50 72 6f iverGetOptionPro
a580: 63 20 2a 67 65 74 4f 70 74 69 6f 6e 50 72 6f 63 c *getOptionProc
a590: 3b 0a 09 09 09 09 09 2f 2a 20 47 65 74 20 61 6e ;....../* Get an
a5a0: 20 6f 70 74 69 6f 6e 20 66 72 6f 6d 20 61 20 63 option from a c
a5b0: 68 61 6e 6e 65 6c 2e 20 2a 2f 0a 20 20 20 20 54 hannel. */. T
a5c0: 63 6c 5f 44 72 69 76 65 72 57 61 74 63 68 50 72 cl_DriverWatchPr
a5d0: 6f 63 20 2a 77 61 74 63 68 50 72 6f 63 3b 09 2f oc *watchProc;./
a5e0: 2a 20 53 65 74 20 75 70 20 74 68 65 20 6e 6f 74 * Set up the not
a5f0: 69 66 69 65 72 20 74 6f 20 77 61 74 63 68 0a 09 ifier to watch..
a600: 09 09 09 09 20 2a 20 66 6f 72 20 65 76 65 6e 74 .... * for event
a610: 73 20 6f 6e 20 74 68 69 73 20 63 68 61 6e 6e 65 s on this channe
a620: 6c 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 44 72 l. */. Tcl_Dr
a630: 69 76 65 72 47 65 74 48 61 6e 64 6c 65 50 72 6f iverGetHandlePro
a640: 63 20 2a 67 65 74 48 61 6e 64 6c 65 50 72 6f 63 c *getHandleProc
a650: 3b 0a 09 09 09 09 09 2f 2a 20 47 65 74 20 61 6e ;....../* Get an
a660: 20 4f 53 20 68 61 6e 64 6c 65 20 66 72 6f 6d 20 OS handle from
a670: 74 68 65 20 63 68 61 6e 6e 65 6c 0a 09 09 09 09 the channel.....
a680: 09 20 2a 20 6f 72 20 4e 55 4c 4c 20 69 66 20 6e . * or NULL if n
a690: 6f 74 20 73 75 70 70 6f 72 74 65 64 2e 20 2a 2f ot supported. */
a6a0: 0a 20 20 20 20 54 63 6c 5f 44 72 69 76 65 72 43 . Tcl_DriverC
a6b0: 6c 6f 73 65 32 50 72 6f 63 20 2a 63 6c 6f 73 65 lose2Proc *close
a6c0: 32 50 72 6f 63 3b 09 2f 2a 20 50 72 6f 63 65 64 2Proc;./* Proced
a6d0: 75 72 65 20 74 6f 20 63 61 6c 6c 20 74 6f 20 63 ure to call to c
a6e0: 6c 6f 73 65 20 74 68 65 0a 09 09 09 09 09 20 2a lose the...... *
a6f0: 20 63 68 61 6e 6e 65 6c 20 69 66 20 74 68 65 20 channel if the
a700: 64 65 76 69 63 65 20 73 75 70 70 6f 72 74 73 0a device supports.
a710: 09 09 09 09 09 20 2a 20 63 6c 6f 73 69 6e 67 20 ..... * closing
a720: 74 68 65 20 72 65 61 64 20 26 20 77 72 69 74 65 the read & write
a730: 20 73 69 64 65 73 0a 09 09 09 09 09 20 2a 20 69 sides...... * i
a740: 6e 64 65 70 65 6e 64 65 6e 74 6c 79 2e 20 2a 2f ndependently. */
a750: 0a 20 20 20 20 54 63 6c 5f 44 72 69 76 65 72 42 . Tcl_DriverB
a760: 6c 6f 63 6b 4d 6f 64 65 50 72 6f 63 20 2a 62 6c lockModeProc *bl
a770: 6f 63 6b 4d 6f 64 65 50 72 6f 63 3b 0a 09 09 09 ockModeProc;....
a780: 09 09 2f 2a 20 53 65 74 20 62 6c 6f 63 6b 69 6e ../* Set blockin
a790: 67 20 6d 6f 64 65 20 66 6f 72 20 74 68 65 0a 09 g mode for the..
a7a0: 09 09 09 09 20 2a 20 72 61 77 20 63 68 61 6e 6e .... * raw chann
a7b0: 65 6c 2e 20 4d 61 79 20 62 65 20 4e 55 4c 4c 2e el. May be NULL.
a7c0: 20 2a 2f 0a 20 20 20 20 2f 2a 0a 20 20 20 20 20 */. /*.
a7d0: 2a 20 4f 6e 6c 79 20 76 61 6c 69 64 20 69 6e 20 * Only valid in
a7e0: 54 43 4c 5f 43 48 41 4e 4e 45 4c 5f 56 45 52 53 TCL_CHANNEL_VERS
a7f0: 49 4f 4e 5f 32 20 63 68 61 6e 6e 65 6c 73 0a 20 ION_2 channels.
a800: 20 20 20 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 44 */. Tcl_D
a810: 72 69 76 65 72 46 6c 75 73 68 50 72 6f 63 20 2a riverFlushProc *
a820: 66 6c 75 73 68 50 72 6f 63 3b 09 2f 2a 20 50 72 flushProc;./* Pr
a830: 6f 63 65 64 75 72 65 20 74 6f 20 63 61 6c 6c 20 ocedure to call
a840: 74 6f 20 66 6c 75 73 68 20 61 0a 09 09 09 09 09 to flush a......
a850: 20 2a 20 63 68 61 6e 6e 65 6c 2e 20 4d 61 79 20 * channel. May
a860: 62 65 20 4e 55 4c 4c 2e 20 2a 2f 0a 20 20 20 20 be NULL. */.
a870: 54 63 6c 5f 44 72 69 76 65 72 48 61 6e 64 6c 65 Tcl_DriverHandle
a880: 72 50 72 6f 63 20 2a 68 61 6e 64 6c 65 72 50 72 rProc *handlerPr
a890: 6f 63 3b 09 2f 2a 20 50 72 6f 63 65 64 75 72 65 oc;./* Procedure
a8a0: 20 74 6f 20 63 61 6c 6c 20 74 6f 20 68 61 6e 64 to call to hand
a8b0: 6c 65 20 61 0a 09 09 09 09 09 20 2a 20 63 68 61 le a...... * cha
a8c0: 6e 6e 65 6c 20 65 76 65 6e 74 2e 20 20 54 68 69 nnel event. Thi
a8d0: 73 20 77 69 6c 6c 20 62 65 20 70 61 73 73 65 64 s will be passed
a8e0: 0a 09 09 09 09 09 20 2a 20 75 70 20 74 68 65 20 ...... * up the
a8f0: 73 74 61 63 6b 65 64 20 63 68 61 6e 6e 65 6c 20 stacked channel
a900: 63 68 61 69 6e 2e 20 2a 2f 0a 7d 20 54 63 6c 5f chain. */.} Tcl_
a910: 43 68 61 6e 6e 65 6c 54 79 70 65 3b 0a 0a 2f 2a ChannelType;../*
a920: 0a 20 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e . * The followin
a930: 67 20 66 6c 61 67 73 20 64 65 74 65 72 6d 69 6e g flags determin
a940: 65 20 77 68 65 74 68 65 72 20 74 68 65 20 62 6c e whether the bl
a950: 6f 63 6b 4d 6f 64 65 50 72 6f 63 20 61 62 6f 76 ockModeProc abov
a960: 65 20 73 68 6f 75 6c 64 0a 20 2a 20 73 65 74 20 e should. * set
a970: 74 68 65 20 63 68 61 6e 6e 65 6c 20 69 6e 74 6f the channel into
a980: 20 62 6c 6f 63 6b 69 6e 67 20 6f 72 20 6e 6f 6e blocking or non
a990: 62 6c 6f 63 6b 69 6e 67 20 6d 6f 64 65 2e 20 54 blocking mode. T
a9a0: 68 65 79 20 61 72 65 20 70 61 73 73 65 64 0a 20 hey are passed.
a9b0: 2a 20 61 73 20 61 72 67 75 6d 65 6e 74 73 20 74 * as arguments t
a9c0: 6f 20 74 68 65 20 62 6c 6f 63 6b 4d 6f 64 65 50 o the blockModeP
a9d0: 72 6f 63 20 70 72 6f 63 65 64 75 72 65 20 69 6e roc procedure in
a9e0: 20 74 68 65 20 61 62 6f 76 65 20 73 74 72 75 63 the above struc
a9f0: 74 75 72 65 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 ture.. */..#defi
aa00: 6e 65 20 54 43 4c 5f 4d 4f 44 45 5f 42 4c 4f 43 ne TCL_MODE_BLOC
aa10: 4b 49 4e 47 09 30 09 2f 2a 20 50 75 74 20 63 68 KING.0./* Put ch
aa20: 61 6e 6e 65 6c 20 69 6e 74 6f 20 62 6c 6f 63 6b annel into block
aa30: 69 6e 67 20 6d 6f 64 65 2e 20 2a 2f 0a 23 64 65 ing mode. */.#de
aa40: 66 69 6e 65 20 54 43 4c 5f 4d 4f 44 45 5f 4e 4f fine TCL_MODE_NO
aa50: 4e 42 4c 4f 43 4b 49 4e 47 09 31 09 2f 2a 20 50 NBLOCKING.1./* P
aa60: 75 74 20 63 68 61 6e 6e 65 6c 20 69 6e 74 6f 20 ut channel into
aa70: 6e 6f 6e 62 6c 6f 63 6b 69 6e 67 0a 09 09 09 09 nonblocking.....
aa80: 09 20 2a 20 6d 6f 64 65 2e 20 2a 2f 0a 0a 2f 2a . * mode. */../*
aa90: 0a 20 2a 20 45 6e 75 6d 20 66 6f 72 20 64 69 66 . * Enum for dif
aaa0: 66 65 72 65 6e 74 20 74 79 70 65 73 20 6f 66 20 ferent types of
aab0: 66 69 6c 65 20 70 61 74 68 73 2e 0a 20 2a 2f 0a file paths.. */.
aac0: 0a 74 79 70 65 64 65 66 20 65 6e 75 6d 20 54 63 .typedef enum Tc
aad0: 6c 5f 50 61 74 68 54 79 70 65 20 7b 0a 20 20 20 l_PathType {.
aae0: 20 54 43 4c 5f 50 41 54 48 5f 41 42 53 4f 4c 55 TCL_PATH_ABSOLU
aaf0: 54 45 2c 0a 20 20 20 20 54 43 4c 5f 50 41 54 48 TE,. TCL_PATH
ab00: 5f 52 45 4c 41 54 49 56 45 2c 0a 20 20 20 20 54 _RELATIVE,. T
ab10: 43 4c 5f 50 41 54 48 5f 56 4f 4c 55 4d 45 5f 52 CL_PATH_VOLUME_R
ab20: 45 4c 41 54 49 56 45 0a 7d 20 54 63 6c 5f 50 61 ELATIVE.} Tcl_Pa
ab30: 74 68 54 79 70 65 3b 0a 0a 2f 2a 0a 20 2a 20 54 thType;../*. * T
ab40: 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 73 74 72 he following str
ab50: 75 63 74 75 72 65 20 72 65 70 72 65 73 65 6e 74 ucture represent
ab60: 73 20 74 68 65 20 4e 6f 74 69 66 69 65 72 20 66 s the Notifier f
ab70: 75 6e 63 74 69 6f 6e 73 20 74 68 61 74 0a 20 2a unctions that. *
ab80: 20 79 6f 75 20 63 61 6e 20 6f 76 65 72 72 69 64 you can overrid
ab90: 65 20 77 69 74 68 20 74 68 65 20 54 63 6c 5f 53 e with the Tcl_S
aba0: 65 74 4e 6f 74 69 66 69 65 72 20 63 61 6c 6c 2e etNotifier call.
abb0: 0a 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 73 74 . */..typedef st
abc0: 72 75 63 74 20 54 63 6c 5f 4e 6f 74 69 66 69 65 ruct Tcl_Notifie
abd0: 72 50 72 6f 63 73 20 7b 0a 20 20 20 20 54 63 6c rProcs {. Tcl
abe0: 5f 53 65 74 54 69 6d 65 72 50 72 6f 63 20 2a 73 _SetTimerProc *s
abf0: 65 74 54 69 6d 65 72 50 72 6f 63 3b 0a 20 20 20 etTimerProc;.
ac00: 20 54 63 6c 5f 57 61 69 74 46 6f 72 45 76 65 6e Tcl_WaitForEven
ac10: 74 50 72 6f 63 20 2a 77 61 69 74 46 6f 72 45 76 tProc *waitForEv
ac20: 65 6e 74 50 72 6f 63 3b 0a 20 20 20 20 54 63 6c entProc;. Tcl
ac30: 5f 43 72 65 61 74 65 46 69 6c 65 48 61 6e 64 6c _CreateFileHandl
ac40: 65 72 50 72 6f 63 20 2a 63 72 65 61 74 65 46 69 erProc *createFi
ac50: 6c 65 48 61 6e 64 6c 65 72 50 72 6f 63 3b 0a 20 leHandlerProc;.
ac60: 20 20 20 54 63 6c 5f 44 65 6c 65 74 65 46 69 6c Tcl_DeleteFil
ac70: 65 48 61 6e 64 6c 65 72 50 72 6f 63 20 2a 64 65 eHandlerProc *de
ac80: 6c 65 74 65 46 69 6c 65 48 61 6e 64 6c 65 72 50 leteFileHandlerP
ac90: 72 6f 63 3b 0a 7d 20 54 63 6c 5f 4e 6f 74 69 66 roc;.} Tcl_Notif
aca0: 69 65 72 50 72 6f 63 73 3b 0a 0a 2f 2a 0a 20 2a ierProcs;../*. *
acb0: 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 73 The following s
acc0: 74 72 75 63 74 75 72 65 20 72 65 70 72 65 73 65 tructure represe
acd0: 6e 74 73 20 61 20 75 73 65 72 2d 64 65 66 69 6e nts a user-defin
ace0: 65 64 20 65 6e 63 6f 64 69 6e 67 2e 20 20 49 74 ed encoding. It
acf0: 20 63 6f 6c 6c 65 63 74 73 0a 20 2a 20 74 6f 67 collects. * tog
ad00: 65 74 68 65 72 20 61 6c 6c 20 74 68 65 20 66 75 ether all the fu
ad10: 6e 63 74 69 6f 6e 73 20 74 68 61 74 20 61 72 65 nctions that are
ad20: 20 75 73 65 64 20 62 79 20 74 68 65 20 73 70 65 used by the spe
ad30: 63 69 66 69 63 20 65 6e 63 6f 64 69 6e 67 2e 0a cific encoding..
ad40: 20 2a 2f 0a 0a 74 79 70 65 64 65 66 20 73 74 72 */..typedef str
ad50: 75 63 74 20 54 63 6c 5f 45 6e 63 6f 64 69 6e 67 uct Tcl_Encoding
ad60: 54 79 70 65 20 7b 0a 20 20 20 20 43 4f 4e 53 54 Type {. CONST
ad70: 20 63 68 61 72 20 2a 65 6e 63 6f 64 69 6e 67 4e char *encodingN
ad80: 61 6d 65 3b 09 2f 2a 20 54 68 65 20 6e 61 6d 65 ame;./* The name
ad90: 20 6f 66 20 74 68 65 20 65 6e 63 6f 64 69 6e 67 of the encoding
ada0: 2c 20 65 2e 67 2e 20 20 22 65 75 63 2d 6a 70 22 , e.g. "euc-jp"
adb0: 2e 0a 09 09 09 09 20 2a 20 54 68 69 73 20 6e 61 ...... * This na
adc0: 6d 65 20 69 73 20 74 68 65 20 75 6e 69 71 75 65 me is the unique
add0: 20 6b 65 79 20 66 6f 72 20 74 68 69 73 0a 09 09 key for this...
ade0: 09 09 20 2a 20 65 6e 63 6f 64 69 6e 67 20 74 79 .. * encoding ty
adf0: 70 65 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f 45 pe. */. Tcl_E
ae00: 6e 63 6f 64 69 6e 67 43 6f 6e 76 65 72 74 50 72 ncodingConvertPr
ae10: 6f 63 20 2a 74 6f 55 74 66 50 72 6f 63 3b 0a 09 oc *toUtfProc;..
ae20: 09 09 09 2f 2a 20 50 72 6f 63 65 64 75 72 65 20 .../* Procedure
ae30: 74 6f 20 63 6f 6e 76 65 72 74 20 66 72 6f 6d 20 to convert from
ae40: 65 78 74 65 72 6e 61 6c 0a 09 09 09 09 20 2a 20 external..... *
ae50: 65 6e 63 6f 64 69 6e 67 20 69 6e 74 6f 20 55 54 encoding into UT
ae60: 46 2d 38 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f F-8. */. Tcl_
ae70: 45 6e 63 6f 64 69 6e 67 43 6f 6e 76 65 72 74 50 EncodingConvertP
ae80: 72 6f 63 20 2a 66 72 6f 6d 55 74 66 50 72 6f 63 roc *fromUtfProc
ae90: 3b 0a 09 09 09 09 2f 2a 20 50 72 6f 63 65 64 75 ;...../* Procedu
aea0: 72 65 20 74 6f 20 63 6f 6e 76 65 72 74 20 66 72 re to convert fr
aeb0: 6f 6d 20 55 54 46 2d 38 20 69 6e 74 6f 0a 09 09 om UTF-8 into...
aec0: 09 09 20 2a 20 65 78 74 65 72 6e 61 6c 20 65 6e .. * external en
aed0: 63 6f 64 69 6e 67 2e 20 2a 2f 0a 20 20 20 20 54 coding. */. T
aee0: 63 6c 5f 45 6e 63 6f 64 69 6e 67 46 72 65 65 50 cl_EncodingFreeP
aef0: 72 6f 63 20 2a 66 72 65 65 50 72 6f 63 3b 0a 09 roc *freeProc;..
af00: 09 09 09 2f 2a 20 49 66 20 6e 6f 6e 2d 4e 55 4c .../* If non-NUL
af10: 4c 2c 20 70 72 6f 63 65 64 75 72 65 20 74 6f 20 L, procedure to
af20: 63 61 6c 6c 20 77 68 65 6e 20 74 68 69 73 0a 09 call when this..
af30: 09 09 09 20 2a 20 65 6e 63 6f 64 69 6e 67 20 69 ... * encoding i
af40: 73 20 64 65 6c 65 74 65 64 2e 20 2a 2f 0a 20 20 s deleted. */.
af50: 20 20 43 6c 69 65 6e 74 44 61 74 61 20 63 6c 69 ClientData cli
af60: 65 6e 74 44 61 74 61 3b 09 2f 2a 20 41 72 62 69 entData;./* Arbi
af70: 74 72 61 72 79 20 76 61 6c 75 65 20 61 73 73 6f trary value asso
af80: 63 69 61 74 65 64 20 77 69 74 68 20 65 6e 63 6f ciated with enco
af90: 64 69 6e 67 0a 09 09 09 09 20 2a 20 74 79 70 65 ding..... * type
afa0: 2e 20 20 50 61 73 73 65 64 20 74 6f 20 63 6f 6e . Passed to con
afb0: 76 65 72 73 69 6f 6e 20 70 72 6f 63 65 64 75 72 version procedur
afc0: 65 73 2e 20 2a 2f 0a 20 20 20 20 69 6e 74 20 6e es. */. int n
afd0: 75 6c 6c 53 69 7a 65 3b 09 09 2f 2a 20 4e 75 6d ullSize;../* Num
afe0: 62 65 72 20 6f 66 20 7a 65 72 6f 20 62 79 74 65 ber of zero byte
aff0: 73 20 74 68 61 74 20 73 69 67 6e 69 66 79 0a 09 s that signify..
b000: 09 09 09 20 2a 20 65 6e 64 2d 6f 66 2d 73 74 72 ... * end-of-str
b010: 69 6e 67 20 69 6e 20 74 68 69 73 20 65 6e 63 6f ing in this enco
b020: 64 69 6e 67 2e 20 20 54 68 69 73 0a 09 09 09 09 ding. This.....
b030: 20 2a 20 6e 75 6d 62 65 72 20 69 73 20 75 73 65 * number is use
b040: 64 20 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 74 d to determine t
b050: 68 65 20 73 6f 75 72 63 65 0a 09 09 09 09 20 2a he source..... *
b060: 20 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 20 77 string length w
b070: 68 65 6e 20 74 68 65 20 73 72 63 4c 65 6e 20 61 hen the srcLen a
b080: 72 67 75 6d 65 6e 74 20 69 73 0a 09 09 09 09 20 rgument is.....
b090: 2a 20 6e 65 67 61 74 69 76 65 2e 20 20 4d 75 73 * negative. Mus
b0a0: 74 20 62 65 20 31 20 6f 72 20 32 2e 20 2a 2f 0a t be 1 or 2. */.
b0b0: 7d 20 54 63 6c 5f 45 6e 63 6f 64 69 6e 67 54 79 } Tcl_EncodingTy
b0c0: 70 65 3b 20 20 20 20 0a 0a 2f 2a 0a 20 2a 20 54 pe; ../*. * T
b0d0: 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 64 65 66 he following def
b0e0: 69 6e 69 74 69 6f 6e 73 20 61 72 65 20 75 73 65 initions are use
b0f0: 64 20 61 73 20 76 61 6c 75 65 73 20 66 6f 72 20 d as values for
b100: 74 68 65 20 63 6f 6e 76 65 72 73 69 6f 6e 20 63 the conversion c
b110: 6f 6e 74 72 6f 6c 0a 20 2a 20 66 6c 61 67 73 20 ontrol. * flags
b120: 61 72 67 75 6d 65 6e 74 20 77 68 65 6e 20 63 6f argument when co
b130: 6e 76 65 72 74 69 6e 67 20 74 65 78 74 20 66 72 nverting text fr
b140: 6f 6d 20 6f 6e 65 20 63 68 61 72 61 63 74 65 72 om one character
b150: 20 73 65 74 20 74 6f 20 61 6e 6f 74 68 65 72 3a set to another:
b160: 0a 20 2a 0a 20 2a 20 54 43 4c 5f 45 4e 43 4f 44 . *. * TCL_ENCOD
b170: 49 4e 47 5f 53 54 41 52 54 3a 09 20 20 20 20 20 ING_START:.
b180: 09 53 69 67 6e 69 66 69 65 73 20 74 68 61 74 20 .Signifies that
b190: 74 68 65 20 73 6f 75 72 63 65 20 62 75 66 66 65 the source buffe
b1a0: 72 20 69 73 20 74 68 65 20 66 69 72 73 74 0a 20 r is the first.
b1b0: 2a 09 09 09 09 62 6c 6f 63 6b 20 69 6e 20 61 20 *....block in a
b1c0: 28 70 6f 74 65 6e 74 69 61 6c 6c 79 20 6d 75 6c (potentially mul
b1d0: 74 69 2d 62 6c 6f 63 6b 29 20 69 6e 70 75 74 0a ti-block) input.
b1e0: 20 2a 09 09 09 09 73 74 72 65 61 6d 2e 20 20 54 *....stream. T
b1f0: 65 6c 6c 73 20 74 68 65 20 63 6f 6e 76 65 72 73 ells the convers
b200: 69 6f 6e 20 70 72 6f 63 65 64 75 72 65 20 74 6f ion procedure to
b210: 0a 20 2a 09 09 09 09 72 65 73 65 74 20 74 6f 20 . *....reset to
b220: 61 6e 20 69 6e 69 74 69 61 6c 20 73 74 61 74 65 an initial state
b230: 20 61 6e 64 20 70 65 72 66 6f 72 6d 20 61 6e 79 and perform any
b240: 0a 20 2a 09 09 09 09 69 6e 69 74 69 61 6c 69 7a . *....initializ
b250: 61 74 69 6f 6e 20 74 68 61 74 20 6e 65 65 64 73 ation that needs
b260: 20 74 6f 20 6f 63 63 75 72 20 62 65 66 6f 72 65 to occur before
b270: 20 74 68 65 0a 20 2a 09 09 09 09 66 69 72 73 74 the. *....first
b280: 20 62 79 74 65 20 69 73 20 63 6f 6e 76 65 72 74 byte is convert
b290: 65 64 2e 20 20 49 66 20 74 68 65 20 73 6f 75 72 ed. If the sour
b2a0: 63 65 0a 20 2a 09 09 09 09 62 75 66 66 65 72 20 ce. *....buffer
b2b0: 63 6f 6e 74 61 69 6e 73 20 74 68 65 20 65 6e 74 contains the ent
b2c0: 69 72 65 20 69 6e 70 75 74 20 73 74 72 65 61 6d ire input stream
b2d0: 20 74 6f 20 62 65 0a 20 2a 09 09 09 09 63 6f 6e to be. *....con
b2e0: 76 65 72 74 65 64 2c 20 74 68 69 73 20 66 6c 61 verted, this fla
b2f0: 67 20 73 68 6f 75 6c 64 20 62 65 20 73 65 74 2e g should be set.
b300: 0a 20 2a 0a 20 2a 20 54 43 4c 5f 45 4e 43 4f 44 . *. * TCL_ENCOD
b310: 49 4e 47 5f 45 4e 44 3a 09 09 53 69 67 6e 69 66 ING_END:..Signif
b320: 69 65 73 20 74 68 61 74 20 74 68 65 20 73 6f 75 ies that the sou
b330: 72 63 65 20 62 75 66 66 65 72 20 69 73 20 74 68 rce buffer is th
b340: 65 20 6c 61 73 74 0a 20 2a 09 09 09 09 62 6c 6f e last. *....blo
b350: 63 6b 20 69 6e 20 61 20 28 70 6f 74 65 6e 74 69 ck in a (potenti
b360: 61 6c 6c 79 20 6d 75 6c 74 69 2d 62 6c 6f 63 6b ally multi-block
b370: 29 20 69 6e 70 75 74 0a 20 2a 09 09 09 09 73 74 ) input. *....st
b380: 72 65 61 6d 2e 20 20 54 65 6c 6c 73 20 74 68 65 ream. Tells the
b390: 20 63 6f 6e 76 65 72 73 69 6f 6e 20 72 6f 75 74 conversion rout
b3a0: 69 6e 65 20 74 6f 0a 20 2a 09 09 09 09 70 65 72 ine to. *....per
b3b0: 66 6f 72 6d 20 61 6e 79 20 66 69 6e 61 6c 69 7a form any finaliz
b3c0: 61 74 69 6f 6e 20 74 68 61 74 20 6e 65 65 64 73 ation that needs
b3d0: 20 74 6f 20 6f 63 63 75 72 0a 20 2a 09 09 09 09 to occur. *....
b3e0: 61 66 74 65 72 20 74 68 65 20 6c 61 73 74 20 62 after the last b
b3f0: 79 74 65 20 69 73 20 63 6f 6e 76 65 72 74 65 64 yte is converted
b400: 20 61 6e 64 20 74 68 65 6e 20 74 6f 0a 20 2a 09 and then to. *.
b410: 09 09 09 72 65 73 65 74 20 74 6f 20 61 6e 20 69 ...reset to an i
b420: 6e 69 74 69 61 6c 20 73 74 61 74 65 2e 20 20 49 nitial state. I
b430: 66 20 74 68 65 20 73 6f 75 72 63 65 0a 20 2a 09 f the source. *.
b440: 09 09 09 62 75 66 66 65 72 20 63 6f 6e 74 61 69 ...buffer contai
b450: 6e 73 20 74 68 65 20 65 6e 74 69 72 65 20 69 6e ns the entire in
b460: 70 75 74 20 73 74 72 65 61 6d 20 74 6f 20 62 65 put stream to be
b470: 0a 20 2a 09 09 09 09 63 6f 6e 76 65 72 74 65 64 . *....converted
b480: 2c 20 74 68 69 73 20 66 6c 61 67 20 73 68 6f 75 , this flag shou
b490: 6c 64 20 62 65 20 73 65 74 2e 0a 20 2a 09 09 09 ld be set.. *...
b4a0: 09 0a 20 2a 20 54 43 4c 5f 45 4e 43 4f 44 49 4e .. * TCL_ENCODIN
b4b0: 47 5f 53 54 4f 50 4f 4e 45 52 52 4f 52 3a 09 49 G_STOPONERROR:.I
b4c0: 66 20 73 65 74 2c 20 74 68 65 6e 20 74 68 65 20 f set, then the
b4d0: 63 6f 6e 76 65 72 74 65 72 20 77 69 6c 6c 20 72 converter will r
b4e0: 65 74 75 72 6e 0a 20 2a 09 09 09 09 69 6d 6d 65 eturn. *....imme
b4f0: 64 69 61 74 65 6c 79 20 75 70 6f 6e 20 65 6e 63 diately upon enc
b500: 6f 75 6e 74 65 72 69 6e 67 20 61 6e 20 69 6e 76 ountering an inv
b510: 61 6c 69 64 0a 20 2a 09 09 09 09 62 79 74 65 20 alid. *....byte
b520: 73 65 71 75 65 6e 63 65 20 6f 72 20 61 20 73 6f sequence or a so
b530: 75 72 63 65 20 63 68 61 72 61 63 74 65 72 20 74 urce character t
b540: 68 61 74 20 68 61 73 0a 20 2a 09 09 09 09 6e 6f hat has. *....no
b550: 20 6d 61 70 70 69 6e 67 20 69 6e 20 74 68 65 20 mapping in the
b560: 74 61 72 67 65 74 20 65 6e 63 6f 64 69 6e 67 2e target encoding.
b570: 20 20 49 66 20 63 6c 65 61 72 2c 0a 20 2a 09 09 If clear,. *..
b580: 09 09 74 68 65 6e 20 74 68 65 20 63 6f 6e 76 65 ..then the conve
b590: 72 74 65 72 20 77 69 6c 6c 20 73 6b 69 70 20 74 rter will skip t
b5a0: 68 65 20 70 72 6f 62 6c 65 6d 2c 0a 20 2a 09 09 he problem,. *..
b5b0: 09 09 73 75 62 73 74 69 74 75 74 69 6e 67 20 6f ..substituting o
b5c0: 6e 65 20 6f 72 20 6d 6f 72 65 20 22 63 6c 6f 73 ne or more "clos
b5d0: 65 22 20 63 68 61 72 61 63 74 65 72 73 0a 20 2a e" characters. *
b5e0: 09 09 09 09 69 6e 20 74 68 65 20 64 65 73 74 69 ....in the desti
b5f0: 6e 61 74 69 6f 6e 20 62 75 66 66 65 72 20 61 6e nation buffer an
b600: 64 20 74 68 65 6e 20 63 6f 6e 74 69 6e 75 65 0a d then continue.
b610: 20 2a 09 09 09 09 74 6f 20 73 6f 6e 76 65 72 74 *....to sonvert
b620: 20 74 68 65 20 73 6f 75 72 63 65 2e 0a 20 2a 2f the source.. */
b630: 0a 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 45 4e ..#define TCL_EN
b640: 43 4f 44 49 4e 47 5f 53 54 41 52 54 09 09 30 78 CODING_START..0x
b650: 30 31 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 45 01.#define TCL_E
b660: 4e 43 4f 44 49 4e 47 5f 45 4e 44 09 09 30 78 30 NCODING_END..0x0
b670: 32 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 45 4e 2.#define TCL_EN
b680: 43 4f 44 49 4e 47 5f 53 54 4f 50 4f 4e 45 52 52 CODING_STOPONERR
b690: 4f 52 09 30 78 30 34 0a 0a 2f 2a 0a 20 2a 2d 2d OR.0x04../*. *--
b6a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
b6b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
b6c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
b6d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 --------------.
b6e0: 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 * The following
b6f0: 64 61 74 61 20 73 74 72 75 63 74 75 72 65 73 20 data structures
b700: 61 6e 64 20 64 65 63 6c 61 72 61 74 69 6f 6e 73 and declarations
b710: 20 61 72 65 20 66 6f 72 20 74 68 65 20 6e 65 77 are for the new
b720: 0a 20 2a 20 54 63 6c 20 70 61 72 73 65 72 2e 09 . * Tcl parser..
b730: 54 68 69 73 20 73 74 75 66 66 20 73 68 6f 75 6c This stuff shoul
b740: 64 20 61 6c 6c 20 6d 6f 76 65 20 74 6f 20 74 63 d all move to tc
b750: 6c 2e 68 20 65 76 65 6e 74 75 61 6c 6c 79 2e 0a l.h eventually..
b760: 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d *--------------
b770: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
b780: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
b790: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
b7a0: 2d 2d 0a 20 2a 2f 0a 0a 2f 2a 0a 20 2a 20 46 6f --. */../*. * Fo
b7b0: 72 20 65 61 63 68 20 77 6f 72 64 20 6f 66 20 61 r each word of a
b7c0: 20 63 6f 6d 6d 61 6e 64 2c 20 61 6e 64 20 66 6f command, and fo
b7d0: 72 20 65 61 63 68 20 70 69 65 63 65 20 6f 66 20 r each piece of
b7e0: 61 20 77 6f 72 64 20 73 75 63 68 20 61 73 20 61 a word such as a
b7f0: 0a 20 2a 20 76 61 72 69 61 62 6c 65 20 72 65 66 . * variable ref
b800: 65 72 65 6e 63 65 2c 20 6f 6e 65 20 6f 66 20 74 erence, one of t
b810: 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 73 74 72 he following str
b820: 75 63 74 75 72 65 73 20 69 73 20 63 72 65 61 74 uctures is creat
b830: 65 64 20 74 6f 0a 20 2a 20 64 65 73 63 72 69 62 ed to. * describ
b840: 65 20 74 68 65 20 74 6f 6b 65 6e 2e 0a 20 2a 2f e the token.. */
b850: 0a 0a 74 79 70 65 64 65 66 20 73 74 72 75 63 74 ..typedef struct
b860: 20 54 63 6c 5f 54 6f 6b 65 6e 20 7b 0a 20 20 20 Tcl_Token {.
b870: 20 69 6e 74 20 74 79 70 65 3b 09 09 09 2f 2a 20 int type;.../*
b880: 54 79 70 65 20 6f 66 20 74 6f 6b 65 6e 2c 20 73 Type of token, s
b890: 75 63 68 20 61 73 20 54 43 4c 5f 54 4f 4b 45 4e uch as TCL_TOKEN
b8a0: 5f 57 4f 52 44 3b 0a 09 09 09 09 20 2a 20 73 65 _WORD;..... * se
b8b0: 65 20 62 65 6c 6f 77 20 66 6f 72 20 76 61 6c 69 e below for vali
b8c0: 64 20 74 79 70 65 73 2e 20 2a 2f 0a 20 20 20 20 d types. */.
b8d0: 63 68 61 72 20 2a 73 74 61 72 74 3b 09 09 2f 2a char *start;../*
b8e0: 20 46 69 72 73 74 20 63 68 61 72 61 63 74 65 72 First character
b8f0: 20 69 6e 20 74 6f 6b 65 6e 2e 20 2a 2f 0a 20 20 in token. */.
b900: 20 20 69 6e 74 20 73 69 7a 65 3b 09 09 09 2f 2a int size;.../*
b910: 20 4e 75 6d 62 65 72 20 6f 66 20 62 79 74 65 73 Number of bytes
b920: 20 69 6e 20 74 6f 6b 65 6e 2e 20 2a 2f 0a 20 20 in token. */.
b930: 20 20 69 6e 74 20 6e 75 6d 43 6f 6d 70 6f 6e 65 int numCompone
b940: 6e 74 73 3b 09 09 2f 2a 20 49 66 20 74 68 69 73 nts;../* If this
b950: 20 74 6f 6b 65 6e 20 69 73 20 63 6f 6d 70 6f 73 token is compos
b960: 65 64 20 6f 66 20 6f 74 68 65 72 0a 09 09 09 09 ed of other.....
b970: 20 2a 20 74 6f 6b 65 6e 73 2c 20 74 68 69 73 20 * tokens, this
b980: 66 69 65 6c 64 20 74 65 6c 6c 73 20 68 6f 77 20 field tells how
b990: 6d 61 6e 79 20 6f 66 0a 09 09 09 09 20 2a 20 74 many of..... * t
b9a0: 68 65 6d 20 74 68 65 72 65 20 61 72 65 20 28 69 hem there are (i
b9b0: 6e 63 6c 75 64 69 6e 67 20 63 6f 6d 70 6f 6e 65 ncluding compone
b9c0: 6e 74 73 20 6f 66 0a 09 09 09 09 20 2a 20 63 6f nts of..... * co
b9d0: 6d 70 6f 6e 65 6e 74 73 2c 20 65 74 63 2e 29 2e mponents, etc.).
b9e0: 20 20 54 68 65 20 63 6f 6d 70 6f 6e 65 6e 74 20 The component
b9f0: 74 6f 6b 65 6e 73 0a 09 09 09 09 20 2a 20 69 6d tokens..... * im
ba00: 6d 65 64 69 61 74 65 6c 79 20 66 6f 6c 6c 6f 77 mediately follow
ba10: 20 74 68 69 73 20 6f 6e 65 2e 20 2a 2f 0a 7d 20 this one. */.}
ba20: 54 63 6c 5f 54 6f 6b 65 6e 3b 0a 0a 2f 2a 0a 20 Tcl_Token;../*.
ba30: 2a 20 54 79 70 65 20 76 61 6c 75 65 73 20 64 65 * Type values de
ba40: 66 69 6e 65 64 20 66 6f 72 20 54 63 6c 5f 54 6f fined for Tcl_To
ba50: 6b 65 6e 20 73 74 72 75 63 74 75 72 65 73 2e 20 ken structures.
ba60: 20 54 68 65 73 65 20 76 61 6c 75 65 73 20 61 72 These values ar
ba70: 65 0a 20 2a 20 64 65 66 69 6e 65 64 20 61 73 20 e. * defined as
ba80: 6d 61 73 6b 20 62 69 74 73 20 73 6f 20 74 68 61 mask bits so tha
ba90: 74 20 69 74 27 73 20 65 61 73 79 20 74 6f 20 63 t it's easy to c
baa0: 68 65 63 6b 20 66 6f 72 20 63 6f 6c 6c 65 63 74 heck for collect
bab0: 69 6f 6e 73 20 6f 66 0a 20 2a 20 74 79 70 65 73 ions of. * types
bac0: 2e 0a 20 2a 0a 20 2a 20 54 43 4c 5f 54 4f 4b 45 .. *. * TCL_TOKE
bad0: 4e 5f 57 4f 52 44 20 2d 09 09 54 68 65 20 74 6f N_WORD -..The to
bae0: 6b 65 6e 20 64 65 73 63 72 69 62 65 73 20 6f 6e ken describes on
baf0: 65 20 77 6f 72 64 20 6f 66 20 61 20 63 6f 6d 6d e word of a comm
bb00: 61 6e 64 2c 0a 20 2a 09 09 09 09 66 72 6f 6d 20 and,. *....from
bb10: 74 68 65 20 66 69 72 73 74 20 6e 6f 6e 2d 62 6c the first non-bl
bb20: 61 6e 6b 20 63 68 61 72 61 63 74 65 72 20 6f 66 ank character of
bb30: 0a 20 2a 09 09 09 09 74 68 65 20 77 6f 72 64 20 . *....the word
bb40: 28 77 68 69 63 68 20 6d 61 79 20 62 65 20 22 20 (which may be "
bb50: 6f 72 20 7b 29 20 75 70 20 74 6f 20 62 75 74 0a or {) up to but.
bb60: 20 2a 09 09 09 09 6e 6f 74 20 69 6e 63 6c 75 64 *....not includ
bb70: 69 6e 67 20 74 68 65 20 73 70 61 63 65 2c 20 73 ing the space, s
bb80: 65 6d 69 63 6f 6c 6f 6e 2c 20 6f 72 0a 20 2a 09 emicolon, or. *.
bb90: 09 09 09 62 72 61 63 6b 65 74 20 74 68 61 74 20 ...bracket that
bba0: 74 65 72 6d 69 6e 61 74 65 73 20 74 68 65 20 77 terminates the w
bbb0: 6f 72 64 2e 20 0a 20 2a 09 09 09 09 4e 75 6d 43 ord. . *....NumC
bbc0: 6f 6d 70 6f 6e 65 6e 74 73 20 63 6f 75 6e 74 73 omponents counts
bbd0: 20 74 68 65 20 74 6f 74 61 6c 20 6e 75 6d 62 65 the total numbe
bbe0: 72 20 6f 66 0a 20 2a 09 09 09 09 73 75 62 2d 74 r of. *....sub-t
bbf0: 6f 6b 65 6e 73 20 74 68 61 74 20 6d 61 6b 65 20 okens that make
bc00: 75 70 20 74 68 65 20 77 6f 72 64 2e 20 20 54 68 up the word. Th
bc10: 69 73 0a 20 2a 09 09 09 09 69 6e 63 6c 75 64 65 is. *....include
bc20: 73 2c 20 66 6f 72 20 65 78 61 6d 70 6c 65 2c 20 s, for example,
bc30: 73 75 62 2d 74 6f 6b 65 6e 73 20 6f 66 0a 20 2a sub-tokens of. *
bc40: 09 09 09 09 54 43 4c 5f 54 4f 4b 45 4e 5f 56 41 ....TCL_TOKEN_VA
bc50: 52 49 41 42 4c 45 20 74 6f 6b 65 6e 73 2e 0a 20 RIABLE tokens..
bc60: 2a 20 54 43 4c 5f 54 4f 4b 45 4e 5f 53 49 4d 50 * TCL_TOKEN_SIMP
bc70: 4c 45 5f 57 4f 52 44 20 2d 09 54 68 69 73 20 74 LE_WORD -.This t
bc80: 6f 6b 65 6e 20 69 73 20 6a 75 73 74 20 6c 69 6b oken is just lik
bc90: 65 20 54 43 4c 5f 54 4f 4b 45 4e 5f 57 4f 52 44 e TCL_TOKEN_WORD
bca0: 0a 20 2a 09 09 09 09 65 78 63 65 70 74 20 74 68 . *....except th
bcb0: 61 74 20 74 68 65 20 77 6f 72 64 20 69 73 20 67 at the word is g
bcc0: 75 61 72 61 6e 74 65 65 64 20 74 6f 0a 20 2a 09 uaranteed to. *.
bcd0: 09 09 09 63 6f 6e 73 69 73 74 20 6f 66 20 61 20 ...consist of a
bce0: 73 69 6e 67 6c 65 20 54 43 4c 5f 54 4f 4b 45 4e single TCL_TOKEN
bcf0: 5f 54 45 58 54 0a 20 2a 09 09 09 09 73 75 62 2d _TEXT. *....sub-
bd00: 74 6f 6b 65 6e 2e 0a 20 2a 20 54 43 4c 5f 54 4f token.. * TCL_TO
bd10: 4b 45 4e 5f 54 45 58 54 20 2d 09 09 54 68 65 20 KEN_TEXT -..The
bd20: 74 6f 6b 65 6e 20 64 65 73 63 72 69 62 65 73 20 token describes
bd30: 61 20 72 61 6e 67 65 20 6f 66 20 6c 69 74 65 72 a range of liter
bd40: 61 6c 0a 20 2a 09 09 09 09 74 65 78 74 20 74 68 al. *....text th
bd50: 61 74 20 69 73 20 70 61 72 74 20 6f 66 20 61 20 at is part of a
bd60: 77 6f 72 64 2e 20 0a 20 2a 09 09 09 09 4e 75 6d word. . *....Num
bd70: 43 6f 6d 70 6f 6e 65 6e 74 73 20 69 73 20 61 6c Components is al
bd80: 77 61 79 73 20 30 2e 0a 20 2a 20 54 43 4c 5f 54 ways 0.. * TCL_T
bd90: 4f 4b 45 4e 5f 42 53 20 2d 09 09 54 68 65 20 74 OKEN_BS -..The t
bda0: 6f 6b 65 6e 20 64 65 73 63 72 69 62 65 73 20 61 oken describes a
bdb0: 20 62 61 63 6b 73 6c 61 73 68 20 73 65 71 75 65 backslash seque
bdc0: 6e 63 65 0a 20 2a 09 09 09 09 74 68 61 74 20 6d nce. *....that m
bdd0: 75 73 74 20 62 65 20 63 6f 6c 6c 61 70 73 65 64 ust be collapsed
bde0: 2e 09 20 4e 75 6d 43 6f 6d 70 6f 6e 65 6e 74 73 .. NumComponents
bdf0: 0a 20 2a 09 09 09 09 69 73 20 61 6c 77 61 79 73 . *....is always
be00: 20 30 2e 0a 20 2a 20 54 43 4c 5f 54 4f 4b 45 4e 0.. * TCL_TOKEN
be10: 5f 43 4f 4d 4d 41 4e 44 20 2d 09 09 54 68 65 20 _COMMAND -..The
be20: 74 6f 6b 65 6e 20 64 65 73 63 72 69 62 65 73 20 token describes
be30: 61 20 63 6f 6d 6d 61 6e 64 20 77 68 6f 73 65 20 a command whose
be40: 72 65 73 75 6c 74 0a 20 2a 09 09 09 09 6d 75 73 result. *....mus
be50: 74 20 62 65 20 73 75 62 73 74 69 74 75 74 65 64 t be substituted
be60: 20 69 6e 74 6f 20 74 68 65 20 77 6f 72 64 2e 20 into the word.
be70: 20 54 68 65 0a 20 2a 09 09 09 09 74 6f 6b 65 6e The. *....token
be80: 20 69 6e 63 6c 75 64 65 73 20 74 68 65 20 65 6e includes the en
be90: 63 6c 6f 73 69 6e 67 20 62 72 61 63 6b 65 74 73 closing brackets
bea0: 2e 20 0a 20 2a 09 09 09 09 4e 75 6d 43 6f 6d 70 . . *....NumComp
beb0: 6f 6e 65 6e 74 73 20 69 73 20 61 6c 77 61 79 73 onents is always
bec0: 20 30 2e 0a 20 2a 20 54 43 4c 5f 54 4f 4b 45 4e 0.. * TCL_TOKEN
bed0: 5f 56 41 52 49 41 42 4c 45 20 2d 09 09 54 68 65 _VARIABLE -..The
bee0: 20 74 6f 6b 65 6e 20 64 65 73 63 72 69 62 65 73 token describes
bef0: 20 61 20 76 61 72 69 61 62 6c 65 0a 20 2a 09 09 a variable. *..
bf00: 09 09 73 75 62 73 74 69 74 75 74 69 6f 6e 2c 20 ..substitution,
bf10: 69 6e 63 6c 75 64 69 6e 67 20 74 68 65 20 64 6f including the do
bf20: 6c 6c 61 72 20 73 69 67 6e 2c 0a 20 2a 09 09 09 llar sign,. *...
bf30: 09 76 61 72 69 61 62 6c 65 20 6e 61 6d 65 2c 20 .variable name,
bf40: 61 6e 64 20 61 72 72 61 79 20 69 6e 64 65 78 20 and array index
bf50: 28 69 66 20 74 68 65 72 65 0a 20 2a 09 09 09 09 (if there. *....
bf60: 69 73 20 6f 6e 65 29 20 75 70 20 74 68 72 6f 75 is one) up throu
bf70: 67 68 20 74 68 65 20 72 69 67 68 74 0a 20 2a 09 gh the right. *.
bf80: 09 09 09 70 61 72 65 6e 74 68 65 73 65 73 2e 20 ...parentheses.
bf90: 20 4e 75 6d 43 6f 6d 70 6f 6e 65 6e 74 73 20 74 NumComponents t
bfa0: 65 6c 6c 73 20 68 6f 77 0a 20 2a 09 09 09 09 6d ells how. *....m
bfb0: 61 6e 79 20 61 64 64 69 74 69 6f 6e 61 6c 20 74 any additional t
bfc0: 6f 6b 65 6e 73 20 66 6f 6c 6c 6f 77 20 74 6f 0a okens follow to.
bfd0: 20 2a 09 09 09 09 72 65 70 72 65 73 65 6e 74 20 *....represent
bfe0: 74 68 65 20 76 61 72 69 61 62 6c 65 20 6e 61 6d the variable nam
bff0: 65 2e 20 20 54 68 65 20 66 69 72 73 74 0a 20 2a e. The first. *
c000: 09 09 09 09 74 6f 6b 65 6e 20 77 69 6c 6c 20 62 ....token will b
c010: 65 20 61 20 54 43 4c 5f 54 4f 4b 45 4e 5f 54 45 e a TCL_TOKEN_TE
c020: 58 54 20 74 6f 6b 65 6e 0a 20 2a 09 09 09 09 74 XT token. *....t
c030: 68 61 74 20 64 65 73 63 72 69 62 65 73 20 74 68 hat describes th
c040: 65 20 76 61 72 69 61 62 6c 65 20 6e 61 6d 65 2e e variable name.
c050: 20 20 49 66 0a 20 2a 09 09 09 09 74 68 65 20 76 If. *....the v
c060: 61 72 69 61 62 6c 65 20 69 73 20 61 6e 20 61 72 ariable is an ar
c070: 72 61 79 20 72 65 66 65 72 65 6e 63 65 20 74 68 ray reference th
c080: 65 6e 0a 20 2a 09 09 09 09 74 68 65 72 65 20 77 en. *....there w
c090: 69 6c 6c 20 62 65 20 6f 6e 65 20 6f 72 20 6d 6f ill be one or mo
c0a0: 72 65 20 61 64 64 69 74 69 6f 6e 61 6c 0a 20 2a re additional. *
c0b0: 09 09 09 09 74 6f 6b 65 6e 73 2c 20 6f 66 20 74 ....tokens, of t
c0c0: 79 70 65 20 54 43 4c 5f 54 4f 4b 45 4e 5f 54 45 ype TCL_TOKEN_TE
c0d0: 58 54 2c 0a 20 2a 09 09 09 09 54 43 4c 5f 54 4f XT,. *....TCL_TO
c0e0: 4b 45 4e 5f 42 53 2c 20 54 43 4c 5f 54 4f 4b 45 KEN_BS, TCL_TOKE
c0f0: 4e 5f 43 4f 4d 4d 41 4e 44 2c 20 61 6e 64 0a 20 N_COMMAND, and.
c100: 2a 09 09 09 09 54 43 4c 5f 54 4f 4b 45 4e 5f 56 *....TCL_TOKEN_V
c110: 41 52 49 41 42 4c 45 2c 20 74 68 61 74 20 64 65 ARIABLE, that de
c120: 73 63 72 69 62 65 20 74 68 65 0a 20 2a 09 09 09 scribe the. *...
c130: 09 61 72 72 61 79 20 69 6e 64 65 78 3b 20 6e 75 .array index; nu
c140: 6d 43 6f 6d 70 6f 6e 65 6e 74 73 20 63 6f 75 6e mComponents coun
c150: 74 73 20 74 68 65 0a 20 2a 09 09 09 09 74 6f 74 ts the. *....tot
c160: 61 6c 20 6e 75 6d 62 65 72 20 6f 66 20 6e 65 73 al number of nes
c170: 74 65 64 20 74 6f 6b 65 6e 73 20 74 68 61 74 20 ted tokens that
c180: 6d 61 6b 65 0a 20 2a 09 09 09 09 75 70 20 74 68 make. *....up th
c190: 65 20 76 61 72 69 61 62 6c 65 20 72 65 66 65 72 e variable refer
c1a0: 65 6e 63 65 2c 20 69 6e 63 6c 75 64 69 6e 67 0a ence, including.
c1b0: 20 2a 09 09 09 09 73 75 62 2d 74 6f 6b 65 6e 73 *....sub-tokens
c1c0: 20 6f 66 20 54 43 4c 5f 54 4f 4b 45 4e 5f 56 41 of TCL_TOKEN_VA
c1d0: 52 49 41 42 4c 45 20 74 6f 6b 65 6e 73 2e 0a 20 RIABLE tokens..
c1e0: 2a 20 54 43 4c 5f 54 4f 4b 45 4e 5f 53 55 42 5f * TCL_TOKEN_SUB_
c1f0: 45 58 50 52 20 2d 09 09 54 68 65 20 74 6f 6b 65 EXPR -..The toke
c200: 6e 20 64 65 73 63 72 69 62 65 73 20 6f 6e 65 20 n describes one
c210: 73 75 62 65 78 70 72 65 73 73 69 6f 6e 20 6f 66 subexpression of
c220: 20 61 0a 20 2a 09 09 09 09 65 78 70 72 65 73 73 a. *....express
c230: 69 6f 6e 2c 20 66 72 6f 6d 20 74 68 65 20 66 69 ion, from the fi
c240: 72 73 74 20 6e 6f 6e 2d 62 6c 61 6e 6b 0a 20 2a rst non-blank. *
c250: 09 09 09 09 63 68 61 72 61 63 74 65 72 20 6f 66 ....character of
c260: 20 74 68 65 20 73 75 62 65 78 70 72 65 73 73 69 the subexpressi
c270: 6f 6e 20 75 70 20 74 6f 20 62 75 74 20 6e 6f 74 on up to but not
c280: 0a 20 2a 09 09 09 09 69 6e 63 6c 75 64 69 6e 67 . *....including
c290: 20 74 68 65 20 73 70 61 63 65 2c 20 62 72 61 63 the space, brac
c2a0: 65 2c 20 6f 72 20 62 72 61 63 6b 65 74 0a 20 2a e, or bracket. *
c2b0: 09 09 09 09 74 68 61 74 20 74 65 72 6d 69 6e 61 ....that termina
c2c0: 74 65 73 20 74 68 65 20 73 75 62 65 78 70 72 65 tes the subexpre
c2d0: 73 73 69 6f 6e 2e 20 0a 20 2a 09 09 09 09 4e 75 ssion. . *....Nu
c2e0: 6d 43 6f 6d 70 6f 6e 65 6e 74 73 20 63 6f 75 6e mComponents coun
c2f0: 74 73 20 74 68 65 20 74 6f 74 61 6c 20 6e 75 6d ts the total num
c300: 62 65 72 20 6f 66 0a 20 2a 09 09 09 09 66 6f 6c ber of. *....fol
c310: 6c 6f 77 69 6e 67 20 73 75 62 74 6f 6b 65 6e 73 lowing subtokens
c320: 20 74 68 61 74 20 6d 61 6b 65 20 75 70 20 74 68 that make up th
c330: 65 0a 20 2a 09 09 09 09 73 75 62 65 78 70 72 65 e. *....subexpre
c340: 73 73 69 6f 6e 3b 20 74 68 69 73 20 69 6e 63 6c ssion; this incl
c350: 75 64 65 73 20 61 6c 6c 20 73 75 62 74 6f 6b 65 udes all subtoke
c360: 6e 73 0a 20 2a 09 09 09 09 66 6f 72 20 61 6e 79 ns. *....for any
c370: 20 6e 65 73 74 65 64 20 54 43 4c 5f 54 4f 4b 45 nested TCL_TOKE
c380: 4e 5f 53 55 42 5f 45 58 50 52 20 74 6f 6b 65 6e N_SUB_EXPR token
c390: 73 2e 0a 20 2a 09 09 09 09 46 6f 72 20 65 78 61 s.. *....For exa
c3a0: 6d 70 6c 65 2c 20 61 20 6e 75 6d 65 72 69 63 20 mple, a numeric
c3b0: 76 61 6c 75 65 20 75 73 65 64 20 61 73 20 61 0a value used as a.
c3c0: 20 2a 09 09 09 09 70 72 69 6d 69 74 69 76 65 20 *....primitive
c3d0: 6f 70 65 72 61 6e 64 20 69 73 20 64 65 73 63 72 operand is descr
c3e0: 69 62 65 64 20 62 79 20 61 0a 20 2a 09 09 09 09 ibed by a. *....
c3f0: 54 43 4c 5f 54 4f 4b 45 4e 5f 53 55 42 5f 45 58 TCL_TOKEN_SUB_EX
c400: 50 52 20 74 6f 6b 65 6e 20 66 6f 6c 6c 6f 77 65 PR token followe
c410: 64 20 62 79 20 61 0a 20 2a 09 09 09 09 54 43 4c d by a. *....TCL
c420: 5f 54 4f 4b 45 4e 5f 54 45 58 54 20 74 6f 6b 65 _TOKEN_TEXT toke
c430: 6e 2e 20 41 20 62 69 6e 61 72 79 20 73 75 62 65 n. A binary sube
c440: 78 70 72 65 73 73 69 6f 6e 0a 20 2a 09 09 09 09 xpression. *....
c450: 69 73 20 64 65 73 63 72 69 62 65 64 20 62 79 20 is described by
c460: 61 20 54 43 4c 5f 54 4f 4b 45 4e 5f 53 55 42 5f a TCL_TOKEN_SUB_
c470: 45 58 50 52 20 74 6f 6b 65 6e 0a 20 2a 09 09 09 EXPR token. *...
c480: 09 66 6f 6c 6c 6f 77 65 64 20 62 79 20 74 68 65 .followed by the
c490: 09 54 43 4c 5f 54 4f 4b 45 4e 5f 4f 50 45 52 41 .TCL_TOKEN_OPERA
c4a0: 54 4f 52 20 74 6f 6b 65 6e 0a 20 2a 09 09 09 09 TOR token. *....
c4b0: 66 6f 72 20 74 68 65 20 6f 70 65 72 61 74 6f 72 for the operator
c4c0: 2c 20 74 68 65 6e 20 54 43 4c 5f 54 4f 4b 45 4e , then TCL_TOKEN
c4d0: 5f 53 55 42 5f 45 58 50 52 0a 20 2a 09 09 09 09 _SUB_EXPR. *....
c4e0: 74 6f 6b 65 6e 73 20 66 6f 72 20 74 68 65 20 6c tokens for the l
c4f0: 65 66 74 20 74 68 65 6e 20 74 68 65 20 72 69 67 eft then the rig
c500: 68 74 20 6f 70 65 72 61 6e 64 73 2e 0a 20 2a 20 ht operands.. *
c510: 54 43 4c 5f 54 4f 4b 45 4e 5f 4f 50 45 52 41 54 TCL_TOKEN_OPERAT
c520: 4f 52 20 2d 09 09 54 68 65 20 74 6f 6b 65 6e 20 OR -..The token
c530: 64 65 73 63 72 69 62 65 73 20 6f 6e 65 20 65 78 describes one ex
c540: 70 72 65 73 73 69 6f 6e 20 6f 70 65 72 61 74 6f pression operato
c550: 72 2e 0a 20 2a 09 09 09 09 41 6e 20 6f 70 65 72 r.. *....An oper
c560: 61 74 6f 72 20 6d 69 67 68 74 20 62 65 20 74 68 ator might be th
c570: 65 20 6e 61 6d 65 20 6f 66 20 61 20 6d 61 74 68 e name of a math
c580: 0a 20 2a 09 09 09 09 66 75 6e 63 74 69 6f 6e 20 . *....function
c590: 73 75 63 68 20 61 73 20 22 61 62 73 22 2e 20 41 such as "abs". A
c5a0: 20 54 43 4c 5f 54 4f 4b 45 4e 5f 4f 50 45 52 41 TCL_TOKEN_OPERA
c5b0: 54 4f 52 0a 20 2a 09 09 09 09 74 6f 6b 65 6e 20 TOR. *....token
c5c0: 69 73 20 61 6c 77 61 79 73 20 70 72 65 63 65 65 is always precee
c5d0: 64 65 64 20 62 79 20 6f 6e 65 0a 20 2a 09 09 09 ded by one. *...
c5e0: 09 54 43 4c 5f 54 4f 4b 45 4e 5f 53 55 42 5f 45 .TCL_TOKEN_SUB_E
c5f0: 58 50 52 20 74 6f 6b 65 6e 20 66 6f 72 20 74 68 XPR token for th
c600: 65 20 6f 70 65 72 61 74 6f 72 27 73 0a 20 2a 09 e operator's. *.
c610: 09 09 09 73 75 62 65 78 70 72 65 73 73 69 6f 6e ...subexpression
c620: 2c 20 61 6e 64 20 69 73 20 66 6f 6c 6c 6f 77 65 , and is followe
c630: 64 20 62 79 20 7a 65 72 6f 20 6f 72 0a 20 2a 09 d by zero or. *.
c640: 09 09 09 6d 6f 72 65 20 54 43 4c 5f 54 4f 4b 45 ...more TCL_TOKE
c650: 4e 5f 53 55 42 5f 45 58 50 52 20 74 6f 6b 65 6e N_SUB_EXPR token
c660: 73 20 66 6f 72 20 74 68 65 0a 20 2a 09 09 09 09 s for the. *....
c670: 6f 70 65 72 61 74 6f 72 27 73 20 6f 70 65 72 61 operator's opera
c680: 6e 64 73 2e 20 4e 75 6d 43 6f 6d 70 6f 6e 65 6e nds. NumComponen
c690: 74 73 20 69 73 0a 20 2a 09 09 09 09 61 6c 77 61 ts is. *....alwa
c6a0: 79 73 20 30 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 ys 0.. */..#defi
c6b0: 6e 65 20 54 43 4c 5f 54 4f 4b 45 4e 5f 57 4f 52 ne TCL_TOKEN_WOR
c6c0: 44 09 09 31 0a 23 64 65 66 69 6e 65 20 54 43 4c D..1.#define TCL
c6d0: 5f 54 4f 4b 45 4e 5f 53 49 4d 50 4c 45 5f 57 4f _TOKEN_SIMPLE_WO
c6e0: 52 44 09 32 0a 23 64 65 66 69 6e 65 20 54 43 4c RD.2.#define TCL
c6f0: 5f 54 4f 4b 45 4e 5f 54 45 58 54 09 09 34 0a 23 _TOKEN_TEXT..4.#
c700: 64 65 66 69 6e 65 20 54 43 4c 5f 54 4f 4b 45 4e define TCL_TOKEN
c710: 5f 42 53 09 09 38 0a 23 64 65 66 69 6e 65 20 54 _BS..8.#define T
c720: 43 4c 5f 54 4f 4b 45 4e 5f 43 4f 4d 4d 41 4e 44 CL_TOKEN_COMMAND
c730: 09 31 36 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f .16.#define TCL_
c740: 54 4f 4b 45 4e 5f 56 41 52 49 41 42 4c 45 09 33 TOKEN_VARIABLE.3
c750: 32 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 54 4f 2.#define TCL_TO
c760: 4b 45 4e 5f 53 55 42 5f 45 58 50 52 09 36 34 0a KEN_SUB_EXPR.64.
c770: 23 64 65 66 69 6e 65 20 54 43 4c 5f 54 4f 4b 45 #define TCL_TOKE
c780: 4e 5f 4f 50 45 52 41 54 4f 52 09 31 32 38 0a 0a N_OPERATOR.128..
c790: 2f 2a 0a 20 2a 20 50 61 72 73 69 6e 67 20 65 72 /*. * Parsing er
c7a0: 72 6f 72 20 74 79 70 65 73 2e 20 20 4f 6e 20 61 ror types. On a
c7b0: 6e 79 20 70 61 72 73 69 6e 67 20 65 72 72 6f 72 ny parsing error
c7c0: 2c 20 6f 6e 65 20 6f 66 20 74 68 65 73 65 20 76 , one of these v
c7d0: 61 6c 75 65 73 0a 20 2a 20 77 69 6c 6c 20 62 65 alues. * will be
c7e0: 20 73 74 6f 72 65 64 20 69 6e 20 74 68 65 20 65 stored in the e
c7f0: 72 72 6f 72 20 66 69 65 6c 64 20 6f 66 20 74 68 rror field of th
c800: 65 20 54 63 6c 5f 50 61 72 73 65 20 73 74 72 75 e Tcl_Parse stru
c810: 63 74 75 72 65 0a 20 2a 20 64 65 66 69 6e 65 64 cture. * defined
c820: 20 62 65 6c 6f 77 2e 0a 20 2a 2f 0a 0a 23 64 65 below.. */..#de
c830: 66 69 6e 65 20 54 43 4c 5f 50 41 52 53 45 5f 53 fine TCL_PARSE_S
c840: 55 43 43 45 53 53 09 09 30 0a 23 64 65 66 69 6e UCCESS..0.#defin
c850: 65 20 54 43 4c 5f 50 41 52 53 45 5f 51 55 4f 54 e TCL_PARSE_QUOT
c860: 45 5f 45 58 54 52 41 09 09 31 0a 23 64 65 66 69 E_EXTRA..1.#defi
c870: 6e 65 20 54 43 4c 5f 50 41 52 53 45 5f 42 52 41 ne TCL_PARSE_BRA
c880: 43 45 5f 45 58 54 52 41 09 09 32 0a 23 64 65 66 CE_EXTRA..2.#def
c890: 69 6e 65 20 54 43 4c 5f 50 41 52 53 45 5f 4d 49 ine TCL_PARSE_MI
c8a0: 53 53 49 4e 47 5f 42 52 41 43 45 09 09 33 0a 23 SSING_BRACE..3.#
c8b0: 64 65 66 69 6e 65 20 54 43 4c 5f 50 41 52 53 45 define TCL_PARSE
c8c0: 5f 4d 49 53 53 49 4e 47 5f 42 52 41 43 4b 45 54 _MISSING_BRACKET
c8d0: 09 34 0a 23 64 65 66 69 6e 65 20 54 43 4c 5f 50 .4.#define TCL_P
c8e0: 41 52 53 45 5f 4d 49 53 53 49 4e 47 5f 50 41 52 ARSE_MISSING_PAR
c8f0: 45 4e 09 09 35 0a 23 64 65 66 69 6e 65 20 54 43 EN..5.#define TC
c900: 4c 5f 50 41 52 53 45 5f 4d 49 53 53 49 4e 47 5f L_PARSE_MISSING_
c910: 51 55 4f 54 45 09 09 36 0a 23 64 65 66 69 6e 65 QUOTE..6.#define
c920: 20 54 43 4c 5f 50 41 52 53 45 5f 4d 49 53 53 49 TCL_PARSE_MISSI
c930: 4e 47 5f 56 41 52 5f 42 52 41 43 45 09 37 0a 23 NG_VAR_BRACE.7.#
c940: 64 65 66 69 6e 65 20 54 43 4c 5f 50 41 52 53 45 define TCL_PARSE
c950: 5f 53 59 4e 54 41 58 09 09 38 0a 23 64 65 66 69 _SYNTAX..8.#defi
c960: 6e 65 20 54 43 4c 5f 50 41 52 53 45 5f 42 41 44 ne TCL_PARSE_BAD
c970: 5f 4e 55 4d 42 45 52 09 09 39 0a 0a 2f 2a 0a 20 _NUMBER..9../*.
c980: 2a 20 41 20 73 74 72 75 63 74 75 72 65 20 6f 66 * A structure of
c990: 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 74 the following t
c9a0: 79 70 65 20 69 73 20 66 69 6c 6c 65 64 20 69 6e ype is filled in
c9b0: 20 62 79 20 54 63 6c 5f 50 61 72 73 65 43 6f 6d by Tcl_ParseCom
c9c0: 6d 61 6e 64 2e 0a 20 2a 20 49 74 20 64 65 73 63 mand.. * It desc
c9d0: 72 69 62 65 73 20 61 20 73 69 6e 67 6c 65 20 63 ribes a single c
c9e0: 6f 6d 6d 61 6e 64 20 70 61 72 73 65 64 20 66 72 ommand parsed fr
c9f0: 6f 6d 20 61 6e 20 69 6e 70 75 74 20 73 74 72 69 om an input stri
ca00: 6e 67 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 ng.. */..#define
ca10: 20 4e 55 4d 5f 53 54 41 54 49 43 5f 54 4f 4b 45 NUM_STATIC_TOKE
ca20: 4e 53 20 32 30 0a 0a 74 79 70 65 64 65 66 20 73 NS 20..typedef s
ca30: 74 72 75 63 74 20 54 63 6c 5f 50 61 72 73 65 20 truct Tcl_Parse
ca40: 7b 0a 20 20 20 20 63 68 61 72 20 2a 63 6f 6d 6d {. char *comm
ca50: 65 6e 74 53 74 61 72 74 3b 09 09 2f 2a 20 50 6f entStart;../* Po
ca60: 69 6e 74 65 72 20 74 6f 20 23 20 74 68 61 74 20 inter to # that
ca70: 62 65 67 69 6e 73 20 74 68 65 20 66 69 72 73 74 begins the first
ca80: 20 6f 66 0a 09 09 09 09 20 2a 20 6f 6e 65 20 6f of..... * one o
ca90: 72 20 6d 6f 72 65 20 63 6f 6d 6d 65 6e 74 73 20 r more comments
caa0: 70 72 65 63 65 64 69 6e 67 20 74 68 65 0a 09 09 preceding the...
cab0: 09 09 20 2a 20 63 6f 6d 6d 61 6e 64 2e 20 2a 2f .. * command. */
cac0: 0a 20 20 20 20 69 6e 74 20 63 6f 6d 6d 65 6e 74 . int comment
cad0: 53 69 7a 65 3b 09 09 2f 2a 20 4e 75 6d 62 65 72 Size;../* Number
cae0: 20 6f 66 20 62 79 74 65 73 20 69 6e 20 63 6f 6d of bytes in com
caf0: 6d 65 6e 74 73 20 28 75 70 20 74 68 72 6f 75 67 ments (up throug
cb00: 68 0a 09 09 09 09 20 2a 20 6e 65 77 6c 69 6e 65 h..... * newline
cb10: 20 63 68 61 72 61 63 74 65 72 20 74 68 61 74 20 character that
cb20: 74 65 72 6d 69 6e 61 74 65 73 20 74 68 65 0a 09 terminates the..
cb30: 09 09 09 20 2a 20 6c 61 73 74 20 63 6f 6d 6d 65 ... * last comme
cb40: 6e 74 29 2e 20 20 49 66 20 74 68 65 72 65 20 77 nt). If there w
cb50: 65 72 65 20 6e 6f 0a 09 09 09 09 20 2a 20 63 6f ere no..... * co
cb60: 6d 6d 65 6e 74 73 2c 20 74 68 69 73 20 66 69 65 mments, this fie
cb70: 6c 64 20 69 73 20 30 2e 20 2a 2f 0a 20 20 20 20 ld is 0. */.
cb80: 63 68 61 72 20 2a 63 6f 6d 6d 61 6e 64 53 74 61 char *commandSta
cb90: 72 74 3b 09 09 2f 2a 20 46 69 72 73 74 20 63 68 rt;../* First ch
cba0: 61 72 61 63 74 65 72 20 69 6e 20 66 69 72 73 74 aracter in first
cbb0: 20 77 6f 72 64 20 6f 66 20 63 6f 6d 6d 61 6e 64 word of command
cbc0: 2e 20 2a 2f 0a 20 20 20 20 69 6e 74 20 63 6f 6d . */. int com
cbd0: 6d 61 6e 64 53 69 7a 65 3b 09 09 2f 2a 20 4e 75 mandSize;../* Nu
cbe0: 6d 62 65 72 20 6f 66 20 62 79 74 65 73 20 69 6e mber of bytes in
cbf0: 20 63 6f 6d 6d 61 6e 64 2c 20 69 6e 63 6c 75 64 command, includ
cc00: 69 6e 67 0a 09 09 09 09 20 2a 20 66 69 72 73 74 ing..... * first
cc10: 20 63 68 61 72 61 63 74 65 72 20 6f 66 20 66 69 character of fi
cc20: 72 73 74 20 77 6f 72 64 2c 20 75 70 0a 09 09 09 rst word, up....
cc30: 09 20 2a 20 74 68 72 6f 75 67 68 20 74 68 65 20 . * through the
cc40: 74 65 72 6d 69 6e 61 74 69 6e 67 20 6e 65 77 6c terminating newl
cc50: 69 6e 65 2c 0a 09 09 09 09 20 2a 20 63 6c 6f 73 ine,..... * clos
cc60: 65 20 62 72 61 63 6b 65 74 2c 20 6f 72 20 73 65 e bracket, or se
cc70: 6d 69 63 6f 6c 6f 6e 2e 20 2a 2f 0a 20 20 20 20 micolon. */.
cc80: 69 6e 74 20 6e 75 6d 57 6f 72 64 73 3b 09 09 2f int numWords;../
cc90: 2a 20 54 6f 74 61 6c 20 6e 75 6d 62 65 72 20 6f * Total number o
cca0: 66 20 77 6f 72 64 73 20 69 6e 20 63 6f 6d 6d 61 f words in comma
ccb0: 6e 64 2e 20 20 4d 61 79 0a 09 09 09 09 20 2a 20 nd. May..... *
ccc0: 62 65 20 30 2e 20 2a 2f 0a 20 20 20 20 54 63 6c be 0. */. Tcl
ccd0: 5f 54 6f 6b 65 6e 20 2a 74 6f 6b 65 6e 50 74 72 _Token *tokenPtr
cce0: 3b 09 2f 2a 20 50 6f 69 6e 74 65 72 20 74 6f 20 ;./* Pointer to
ccf0: 66 69 72 73 74 20 74 6f 6b 65 6e 20 72 65 70 72 first token repr
cd00: 65 73 65 6e 74 69 6e 67 0a 09 09 09 09 20 2a 20 esenting..... *
cd10: 74 68 65 20 77 6f 72 64 73 20 6f 66 20 74 68 65 the words of the
cd20: 20 63 6f 6d 6d 61 6e 64 2e 20 20 49 6e 69 74 69 command. Initi
cd30: 61 6c 6c 79 0a 09 09 09 09 20 2a 20 70 6f 69 6e ally..... * poin
cd40: 74 73 20 74 6f 20 73 74 61 74 69 63 54 6f 6b 65 ts to staticToke
cd50: 6e 73 2c 20 62 75 74 20 6d 61 79 20 63 68 61 6e ns, but may chan
cd60: 67 65 0a 09 09 09 09 20 2a 20 74 6f 20 70 6f 69 ge..... * to poi
cd70: 6e 74 20 74 6f 20 6d 61 6c 6c 6f 63 2d 65 64 20 nt to malloc-ed
cd80: 73 70 61 63 65 20 69 66 20 63 6f 6d 6d 61 6e 64 space if command
cd90: 0a 09 09 09 09 20 2a 20 65 78 63 65 65 64 73 20 ..... * exceeds
cda0: 73 70 61 63 65 20 69 6e 20 73 74 61 74 69 63 54 space in staticT
cdb0: 6f 6b 65 6e 73 2e 20 2a 2f 0a 20 20 20 20 69 6e okens. */. in
cdc0: 74 20 6e 75 6d 54 6f 6b 65 6e 73 3b 09 09 2f 2a t numTokens;../*
cdd0: 20 54 6f 74 61 6c 20 6e 75 6d 62 65 72 20 6f 66 Total number of
cde0: 20 74 6f 6b 65 6e 73 20 69 6e 20 63 6f 6d 6d 61 tokens in comma
cdf0: 6e 64 2e 20 2a 2f 0a 20 20 20 20 69 6e 74 20 74 nd. */. int t
ce00: 6f 6b 65 6e 73 41 76 61 69 6c 61 62 6c 65 3b 09 okensAvailable;.
ce10: 2f 2a 20 54 6f 74 61 6c 20 6e 75 6d 62 65 72 20 /* Total number
ce20: 6f 66 20 74 6f 6b 65 6e 73 20 61 76 61 69 6c 61 of tokens availa
ce30: 62 6c 65 20 61 74 0a 09 09 09 09 20 2a 20 2a 74 ble at..... * *t
ce40: 6f 6b 65 6e 50 74 72 2e 20 2a 2f 0a 20 20 20 20 okenPtr. */.
ce50: 69 6e 74 20 65 72 72 6f 72 54 79 70 65 3b 09 09 int errorType;..
ce60: 2f 2a 20 4f 6e 65 20 6f 66 20 74 68 65 20 70 61 /* One of the pa
ce70: 72 73 69 6e 67 20 65 72 72 6f 72 20 74 79 70 65 rsing error type
ce80: 73 20 64 65 66 69 6e 65 64 0a 09 09 09 09 20 2a s defined..... *
ce90: 20 61 62 6f 76 65 2e 20 2a 2f 0a 0a 20 20 20 20 above. */..
cea0: 2f 2a 0a 20 20 20 20 20 2a 20 54 68 65 20 66 69 /*. * The fi
ceb0: 65 6c 64 73 20 62 65 6c 6f 77 20 61 72 65 20 69 elds below are i
cec0: 6e 74 65 6e 64 65 64 20 6f 6e 6c 79 20 66 6f 72 ntended only for
ced0: 20 74 68 65 20 70 72 69 76 61 74 65 20 75 73 65 the private use
cee0: 20 6f 66 20 74 68 65 0a 20 20 20 20 20 2a 20 70 of the. * p
cef0: 61 72 73 65 72 2e 09 54 68 65 79 20 73 68 6f 75 arser..They shou
cf00: 6c 64 20 6e 6f 74 20 62 65 20 75 73 65 64 20 62 ld not be used b
cf10: 79 20 70 72 6f 63 65 64 75 72 65 73 20 74 68 61 y procedures tha
cf20: 74 20 69 6e 76 6f 6b 65 0a 20 20 20 20 20 2a 20 t invoke. *
cf30: 54 63 6c 5f 50 61 72 73 65 43 6f 6d 6d 61 6e 64 Tcl_ParseCommand
cf40: 2e 0a 20 20 20 20 20 2a 2f 0a 0a 20 20 20 20 63 .. */.. c
cf50: 68 61 72 20 2a 73 74 72 69 6e 67 3b 09 09 2f 2a har *string;../*
cf60: 20 54 68 65 20 6f 72 69 67 69 6e 61 6c 20 63 6f The original co
cf70: 6d 6d 61 6e 64 20 73 74 72 69 6e 67 20 70 61 73 mmand string pas
cf80: 73 65 64 20 74 6f 0a 09 09 09 09 20 2a 20 54 63 sed to..... * Tc
cf90: 6c 5f 50 61 72 73 65 43 6f 6d 6d 61 6e 64 2e 20 l_ParseCommand.
cfa0: 2a 2f 0a 20 20 20 20 63 68 61 72 20 2a 65 6e 64 */. char *end
cfb0: 3b 09 09 09 2f 2a 20 50 6f 69 6e 74 73 20 74 6f ;.../* Points to
cfc0: 20 74 68 65 20 63 68 61 72 61 63 74 65 72 20 6a the character j
cfd0: 75 73 74 20 61 66 74 65 72 20 74 68 65 0a 09 09 ust after the...
cfe0: 09 09 20 2a 20 6c 61 73 74 20 6f 6e 65 20 69 6e .. * last one in
cff0: 20 74 68 65 20 63 6f 6d 6d 61 6e 64 20 73 74 72 the command str
d000: 69 6e 67 2e 20 2a 2f 0a 20 20 20 20 54 63 6c 5f ing. */. Tcl_
d010: 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 3b 09 Interp *interp;.
d020: 09 2f 2a 20 49 6e 74 65 72 70 72 65 74 65 72 20 ./* Interpreter
d030: 74 6f 20 75 73 65 20 66 6f 72 20 65 72 72 6f 72 to use for error
d040: 20 72 65 70 6f 72 74 69 6e 67 2c 0a 09 09 09 09 reporting,.....
d050: 20 2a 20 6f 72 20 4e 55 4c 4c 2e 20 2a 2f 0a 20 * or NULL. */.
d060: 20 20 20 63 68 61 72 20 2a 74 65 72 6d 3b 09 09 char *term;..
d070: 09 2f 2a 20 50 6f 69 6e 74 73 20 74 6f 20 63 68 ./* Points to ch
d080: 61 72 61 63 74 65 72 20 69 6e 20 73 74 72 69 6e aracter in strin
d090: 67 20 74 68 61 74 0a 09 09 09 09 20 2a 20 74 65 g that..... * te
d0a0: 72 6d 69 6e 61 74 65 64 20 6d 6f 73 74 20 72 65 rminated most re
d0b0: 63 65 6e 74 20 74 6f 6b 65 6e 2e 20 20 46 69 6c cent token. Fil
d0c0: 6c 65 64 20 69 6e 0a 09 09 09 09 20 2a 20 62 79 led in..... * by
d0d0: 20 50 61 72 73 65 54 6f 6b 65 6e 73 2e 20 20 49 ParseTokens. I
d0e0: 66 20 61 6e 20 65 72 72 6f 72 20 6f 63 63 75 72 f an error occur
d0f0: 73 2c 0a 09 09 09 09 20 2a 20 70 6f 69 6e 74 73 s,..... * points
d100: 20 74 6f 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 to beginning of
d110: 20 72 65 67 69 6f 6e 20 77 68 65 72 65 20 74 68 region where th
d120: 65 0a 09 09 09 09 20 2a 20 65 72 72 6f 72 20 6f e..... * error o
d130: 63 63 75 72 72 65 64 20 28 65 2e 67 2e 20 74 68 ccurred (e.g. th
d140: 65 20 6f 70 65 6e 20 62 72 61 63 65 20 69 66 0a e open brace if.
d150: 09 09 09 09 20 2a 20 74 68 65 20 63 6c 6f 73 65 .... * the close
d160: 20 62 72 61 63 65 20 69 73 20 6d 69 73 73 69 6e brace is missin
d170: 67 29 2e 20 2a 2f 0a 20 20 20 20 69 6e 74 20 69 g). */. int i
d180: 6e 63 6f 6d 70 6c 65 74 65 3b 09 09 2f 2a 20 54 ncomplete;../* T
d190: 68 69 73 20 66 69 65 6c 64 20 69 73 20 73 65 74 his field is set
d1a0: 20 74 6f 20 31 20 62 79 20 54 63 6c 5f 50 61 72 to 1 by Tcl_Par
d1b0: 73 65 43 6f 6d 6d 61 6e 64 0a 09 09 09 09 20 2a seCommand..... *
d1c0: 20 69 66 20 74 68 65 20 63 6f 6d 6d 61 6e 64 20 if the command
d1d0: 61 70 70 65 61 72 73 20 74 6f 20 62 65 20 69 6e appears to be in
d1e0: 63 6f 6d 70 6c 65 74 65 2e 0a 09 09 09 09 20 2a complete...... *
d1f0: 20 54 68 69 73 20 69 6e 66 6f 72 6d 61 74 69 6f This informatio
d200: 6e 20 69 73 20 75 73 65 64 20 62 79 0a 09 09 09 n is used by....
d210: 09 20 2a 20 54 63 6c 5f 43 6f 6d 6d 61 6e 64 43 . * Tcl_CommandC
d220: 6f 6d 70 6c 65 74 65 2e 20 2a 2f 0a 20 20 20 20 omplete. */.
d230: 54 63 6c 5f 54 6f 6b 65 6e 20 73 74 61 74 69 63 Tcl_Token static
d240: 54 6f 6b 65 6e 73 5b 4e 55 4d 5f 53 54 41 54 49 Tokens[NUM_STATI
d250: 43 5f 54 4f 4b 45 4e 53 5d 3b 0a 09 09 09 09 2f C_TOKENS];...../
d260: 2a 20 49 6e 69 74 69 61 6c 20 73 70 61 63 65 20 * Initial space
d270: 66 6f 72 20 74 6f 6b 65 6e 73 20 66 6f 72 20 63 for tokens for c
d280: 6f 6d 6d 61 6e 64 2e 0a 09 09 09 09 20 2a 20 54 ommand...... * T
d290: 68 69 73 20 73 70 61 63 65 20 73 68 6f 75 6c 64 his space should
d2a0: 20 62 65 20 6c 61 72 67 65 20 65 6e 6f 75 67 68 be large enough
d2b0: 20 74 6f 0a 09 09 09 09 20 2a 20 61 63 63 6f 6d to..... * accom
d2c0: 6d 6f 64 61 74 65 20 6d 6f 73 74 20 63 6f 6d 6d modate most comm
d2d0: 61 6e 64 73 3b 20 64 79 6e 61 6d 69 63 0a 09 09 ands; dynamic...
d2e0: 09 09 20 2a 20 73 70 61 63 65 20 69 73 20 61 6c .. * space is al
d2f0: 6c 6f 63 61 74 65 64 20 66 6f 72 20 76 65 72 79 located for very
d300: 20 6c 61 72 67 65 0a 09 09 09 09 20 2a 20 63 6f large..... * co
d310: 6d 6d 61 6e 64 73 20 74 68 61 74 20 64 6f 6e 27 mmands that don'
d320: 74 20 66 69 74 20 68 65 72 65 2e 20 2a 2f 0a 7d t fit here. */.}
d330: 20 54 63 6c 5f 50 61 72 73 65 3b 0a 0a 2f 2a 0a Tcl_Parse;../*.
d340: 20 2a 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 * The following
d350: 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 61 72 65 definitions are
d360: 20 74 68 65 20 65 72 72 6f 72 20 63 6f 64 65 73 the error codes
d370: 20 72 65 74 75 72 6e 65 64 20 62 79 20 74 68 65 returned by the
d380: 20 63 6f 6e 76 65 72 73 69 6f 6e 0a 20 2a 20 72 conversion. * r
d390: 6f 75 74 69 6e 65 73 3a 0a 20 2a 0a 20 2a 20 54 outines:. *. * T
d3a0: 43 4c 5f 4f 4b 3a 09 09 09 41 6c 6c 20 63 68 61 CL_OK:...All cha
d3b0: 72 61 63 74 65 72 73 20 77 65 72 65 20 63 6f 6e racters were con
d3c0: 76 65 72 74 65 64 2e 0a 20 2a 0a 20 2a 20 54 43 verted.. *. * TC
d3d0: 4c 5f 43 4f 4e 56 45 52 54 5f 4e 4f 53 50 41 43 L_CONVERT_NOSPAC
d3e0: 45 3a 09 09 54 68 65 20 6f 75 74 70 75 74 20 62 E:..The output b
d3f0: 75 66 66 65 72 20 77 6f 75 6c 64 20 6e 6f 74 20 uffer would not
d400: 68 61 76 65 20 62 65 65 6e 20 6c 61 72 67 65 0a have been large.
d410: 20 2a 09 09 09 09 65 6e 6f 75 67 68 20 66 6f 72 *....enough for
d420: 20 61 6c 6c 20 6f 66 20 74 68 65 20 63 6f 6e 76 all of the conv
d430: 65 72 74 65 64 20 64 61 74 61 3b 20 61 73 20 6d erted data; as m
d440: 61 6e 79 0a 20 2a 09 09 09 09 63 68 61 72 61 63 any. *....charac
d450: 74 65 72 73 20 61 73 20 63 6f 75 6c 64 20 66 69 ters as could fi
d460: 74 20 77 65 72 65 20 63 6f 6e 76 65 72 74 65 64 t were converted
d470: 20 74 68 6f 75 67 68 2e 0a 20 2a 0a 20 2a 20 54 though.. *. * T
d480: 43 4c 5f 43 4f 4e 56 45 52 54 5f 4d 55 4c 54 49 CL_CONVERT_MULTI
d490: 42 59 54 45 3a 09 54 68 65 20 6c 61 73 74 20 66 BYTE:.The last f
d4a0: 65 77 20 62 79 74 65 73 20 69 6e 20 74 68 65 20 ew bytes in the
d4b0: 73 6f 75 72 63 65 20 73 74 72 69 6e 67 20 77 65 source string we
d4c0: 72 65 0a 20 2a 09 09 09 09 74 68 65 20 62 65 67 re. *....the beg
d4d0: 69 6e 6e 69 6e 67 20 6f 66 20 61 20 6d 75 6c 74 inning of a mult
d4e0: 69 62 79 74 65 20 73 65 71 75 65 6e 63 65 2c 20 ibyte sequence,
d4f0: 62 75 74 0a 20 2a 09 09 09 09 6d 6f 72 65 20 62 but. *....more b
d500: 79 74 65 73 20 77 65 72 65 20 6e 65 65 64 65 64 ytes were needed
d510: 20 74 6f 20 63 6f 6d 70 6c 65 74 65 20 74 68 69 to complete thi
d520: 73 0a 20 2a 09 09 09 09 73 65 71 75 65 6e 63 65 s. *....sequence
d530: 2e 20 20 41 20 73 75 62 73 65 71 75 65 6e 74 20 . A subsequent
d540: 63 61 6c 6c 20 74 6f 20 74 68 65 20 63 6f 6e 76 call to the conv
d550: 65 72 73 69 6f 6e 0a 20 2a 09 09 09 09 72 6f 75 ersion. *....rou
d560: 74 69 6e 65 20 73 68 6f 75 6c 64 20 70 61 73 73 tine should pass
d570: 20 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f the beginning o
d580: 66 20 74 68 69 73 0a 20 2a 09 09 09 09 75 6e 63 f this. *....unc
d590: 6f 6e 76 65 72 74 65 64 20 73 65 71 75 65 6e 63 onverted sequenc
d5a0: 65 20 70 6c 75 73 20 61 64 64 69 74 69 6f 6e 61 e plus additiona
d5b0: 6c 20 62 79 74 65 73 0a 20 2a 09 09 09 09 66 72 l bytes. *....fr
d5c0: 6f 6d 20 74 68 65 20 73 6f 75 72 63 65 20 73 74 om the source st
d5d0: 72 65 61 6d 20 74 6f 20 70 72 6f 70 65 72 6c 79 ream to properly
d5e0: 20 63 6f 6e 76 65 72 74 0a 20 2a 09 09 09 09 74 convert. *....t
d5f0: 68 65 20 66 6f 72 6d 65 72 6c 79 20 73 70 6c 69 he formerly spli
d600: 74 2d 75 70 20 6d 75 6c 74 69 62 79 74 65 20 73 t-up multibyte s
d610: 65 71 75 65 6e 63 65 2e 0a 20 2a 0a 20 2a 20 54 equence.. *. * T
d620: 43 4c 5f 43 4f 4e 56 45 52 54 5f 53 59 4e 54 41 CL_CONVERT_SYNTA
d630: 58 3a 09 09 54 68 65 20 73 6f 75 72 63 65 20 73 X:..The source s
d640: 74 72 65 61 6d 20 63 6f 6e 74 61 69 6e 65 64 20 tream contained
d650: 61 6e 20 69 6e 76 61 6c 69 64 0a 20 2a 09 09 09 an invalid. *...
d660: 09 63 68 61 72 61 63 74 65 72 20 73 65 71 75 65 .character seque
d670: 6e 63 65 2e 20 20 54 68 69 73 20 6d 61 79 20 6f nce. This may o
d680: 63 63 75 72 20 69 66 20 74 68 65 0a 20 2a 09 09 ccur if the. *..
d690: 09 09 69 6e 70 75 74 20 73 74 72 65 61 6d 20 68 ..input stream h
d6a0: 61 73 20 62 65 65 6e 20 64 61 6d 61 67 65 64 20 as been damaged
d6b0: 6f 72 20 69 66 20 74 68 65 20 69 6e 70 75 74 0a or if the input.
d6c0: 20 2a 09 09 09 09 65 6e 63 6f 64 69 6e 67 20 6d *....encoding m
d6d0: 65 74 68 6f 64 20 77 61 73 20 6d 69 73 69 64 65 ethod was miside
d6e0: 6e 74 69 66 69 65 64 2e 20 20 54 68 69 73 20 65 ntified. This e
d6f0: 72 72 6f 72 0a 20 2a 09 09 09 09 69 73 20 72 65 rror. *....is re
d700: 70 6f 72 74 65 64 20 6f 6e 6c 79 20 69 66 20 54 ported only if T
d710: 43 4c 5f 45 4e 43 4f 44 49 4e 47 5f 53 54 4f 50 CL_ENCODING_STOP
d720: 4f 4e 45 52 52 4f 52 0a 20 2a 09 09 09 09 77 61 ONERROR. *....wa
d730: 73 20 73 70 65 63 69 66 69 65 64 2e 0a 20 2a 20 s specified.. *
d740: 0a 20 2a 20 54 43 4c 5f 43 4f 4e 56 45 52 54 5f . * TCL_CONVERT_
d750: 55 4e 4b 4e 4f 57 4e 3a 09 09 54 68 65 20 73 6f UNKNOWN:..The so
d760: 75 72 63 65 20 73 74 72 69 6e 67 20 63 6f 6e 74 urce string cont
d770: 61 69 6e 65 64 20 61 20 63 68 61 72 61 63 74 65 ained a characte
d780: 72 0a 20 2a 09 09 09 09 74 68 61 74 20 63 6f 75 r. *....that cou
d790: 6c 64 20 6e 6f 74 20 62 65 20 72 65 70 72 65 73 ld not be repres
d7a0: 65 6e 74 65 64 20 69 6e 20 74 68 65 20 74 61 72 ented in the tar
d7b0: 67 65 74 0a 20 2a 09 09 09 09 65 6e 63 6f 64 69 get. *....encodi
d7c0: 6e 67 2e 20 20 54 68 69 73 20 65 72 72 6f 72 20 ng. This error
d7d0: 69 73 20 72 65 70 6f 72 74 65 64 20 6f 6e 6c 79 is reported only
d7e0: 20 69 66 0a 20 2a 09 09 09 09 54 43 4c 5f 45 4e if. *....TCL_EN
d7f0: 43 4f 44 49 4e 47 5f 53 54 4f 50 4f 4e 45 52 52 CODING_STOPONERR
d800: 4f 52 20 77 61 73 20 73 70 65 63 69 66 69 65 64 OR was specified
d810: 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 .. */..#define T
d820: 43 4c 5f 43 4f 4e 56 45 52 54 5f 4d 55 4c 54 49 CL_CONVERT_MULTI
d830: 42 59 54 45 09 09 2d 31 0a 23 64 65 66 69 6e 65 BYTE..-1.#define
d840: 20 54 43 4c 5f 43 4f 4e 56 45 52 54 5f 53 59 4e TCL_CONVERT_SYN
d850: 54 41 58 09 09 2d 32 0a 23 64 65 66 69 6e 65 20 TAX..-2.#define
d860: 54 43 4c 5f 43 4f 4e 56 45 52 54 5f 55 4e 4b 4e TCL_CONVERT_UNKN
d870: 4f 57 4e 09 09 2d 33 0a 23 64 65 66 69 6e 65 20 OWN..-3.#define
d880: 54 43 4c 5f 43 4f 4e 56 45 52 54 5f 4e 4f 53 50 TCL_CONVERT_NOSP
d890: 41 43 45 09 09 2d 34 0a 0a 2f 2a 0a 20 2a 20 54 ACE..-4../*. * T
d8a0: 68 65 20 6d 61 78 69 6d 75 6d 20 6e 75 6d 62 65 he maximum numbe
d8b0: 72 20 6f 66 20 62 79 74 65 73 20 74 68 61 74 20 r of bytes that
d8c0: 61 72 65 20 6e 65 63 65 73 73 61 72 79 20 74 6f are necessary to
d8d0: 20 72 65 70 72 65 73 65 6e 74 20 61 20 73 69 6e represent a sin
d8e0: 67 6c 65 0a 20 2a 20 55 6e 69 63 6f 64 65 20 63 gle. * Unicode c
d8f0: 68 61 72 61 63 74 65 72 20 69 6e 20 55 54 46 2d haracter in UTF-
d900: 38 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 8.. */..#define
d910: 54 43 4c 5f 55 54 46 5f 4d 41 58 09 09 33 0a 0a TCL_UTF_MAX..3..
d920: 2f 2a 0a 20 2a 20 54 68 69 73 20 72 65 70 72 65 /*. * This repre
d930: 73 65 6e 74 73 20 61 20 55 6e 69 63 6f 64 65 20 sents a Unicode
d940: 63 68 61 72 61 63 74 65 72 2e 20 20 0a 20 2a 2f character. . */
d950: 0a 0a 74 79 70 65 64 65 66 20 75 6e 73 69 67 6e ..typedef unsign
d960: 65 64 20 73 68 6f 72 74 20 54 63 6c 5f 55 6e 69 ed short Tcl_Uni
d970: 43 68 61 72 3b 0a 0a 2f 2a 0a 20 2a 20 44 65 70 Char;../*. * Dep
d980: 72 65 63 61 74 65 64 20 54 63 6c 20 70 72 6f 63 recated Tcl proc
d990: 65 64 75 72 65 73 3a 0a 20 2a 2f 0a 0a 23 69 66 edures:. */..#if
d9a0: 6e 64 65 66 20 54 43 4c 5f 4e 4f 5f 44 45 50 52 ndef TCL_NO_DEPR
d9b0: 45 43 41 54 45 44 0a 23 64 65 66 69 6e 65 20 54 ECATED.#define T
d9c0: 63 6c 5f 45 76 61 6c 4f 62 6a 28 69 6e 74 65 72 cl_EvalObj(inter
d9d0: 70 2c 6f 62 6a 50 74 72 29 20 54 63 6c 5f 45 76 p,objPtr) Tcl_Ev
d9e0: 61 6c 4f 62 6a 45 78 28 28 69 6e 74 65 72 70 29 alObjEx((interp)
d9f0: 2c 28 6f 62 6a 50 74 72 29 2c 30 29 0a 23 64 65 ,(objPtr),0).#de
da00: 66 69 6e 65 20 54 63 6c 5f 47 6c 6f 62 61 6c 45 fine Tcl_GlobalE
da10: 76 61 6c 4f 62 6a 28 69 6e 74 65 72 70 2c 6f 62 valObj(interp,ob
da20: 6a 50 74 72 29 20 5c 0a 09 54 63 6c 5f 45 76 61 jPtr) \..Tcl_Eva
da30: 6c 4f 62 6a 45 78 28 28 69 6e 74 65 72 70 29 2c lObjEx((interp),
da40: 28 6f 62 6a 50 74 72 29 2c 54 43 4c 5f 45 56 41 (objPtr),TCL_EVA
da50: 4c 5f 47 4c 4f 42 41 4c 29 0a 23 65 6e 64 69 66 L_GLOBAL).#endif
da60: 0a 0a 2f 2a 0a 20 2a 20 54 68 65 73 65 20 66 75 ../*. * These fu
da70: 6e 63 74 69 6f 6e 20 68 61 76 65 20 62 65 65 6e nction have been
da80: 20 72 65 6e 61 6d 65 64 2e 20 54 68 65 20 6f 6c renamed. The ol
da90: 64 20 6e 61 6d 65 73 20 61 72 65 20 64 65 70 72 d names are depr
daa0: 65 63 61 74 65 64 2c 20 62 75 74 20 77 65 0a 20 ecated, but we.
dab0: 2a 20 64 65 66 69 6e 65 20 74 68 65 73 65 20 6d * define these m
dac0: 61 63 72 6f 73 20 66 6f 72 20 62 61 63 6b 77 61 acros for backwa
dad0: 72 64 73 20 63 6f 6d 70 61 74 69 62 69 6c 74 79 rds compatibilty
dae0: 2e 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 .. */..#define T
daf0: 63 6c 5f 43 6b 61 6c 6c 6f 63 20 54 63 6c 5f 41 cl_Ckalloc Tcl_A
db00: 6c 6c 6f 63 0a 23 64 65 66 69 6e 65 20 54 63 6c lloc.#define Tcl
db10: 5f 43 6b 66 72 65 65 20 54 63 6c 5f 46 72 65 65 _Ckfree Tcl_Free
db20: 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f 43 6b 72 .#define Tcl_Ckr
db30: 65 61 6c 6c 6f 63 20 54 63 6c 5f 52 65 61 6c 6c ealloc Tcl_Reall
db40: 6f 63 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f 52 oc.#define Tcl_R
db50: 65 74 75 72 6e 20 54 63 6c 5f 53 65 74 52 65 73 eturn Tcl_SetRes
db60: 75 6c 74 0a 23 64 65 66 69 6e 65 20 54 63 6c 5f ult.#define Tcl_
db70: 54 69 6c 64 65 53 75 62 73 74 20 54 63 6c 5f 54 TildeSubst Tcl_T
db80: 72 61 6e 73 6c 61 74 65 46 69 6c 65 4e 61 6d 65 ranslateFileName
db90: 0a 23 64 65 66 69 6e 65 20 70 61 6e 69 63 20 54 .#define panic T
dba0: 63 6c 5f 50 61 6e 69 63 0a 23 64 65 66 69 6e 65 cl_Panic.#define
dbb0: 20 70 61 6e 69 63 56 41 20 54 63 6c 5f 50 61 6e panicVA Tcl_Pan
dbc0: 69 63 56 41 0a 0a 2f 2a 0a 20 2a 20 54 68 65 20 icVA../*. * The
dbd0: 66 6f 6c 6c 6f 77 69 6e 67 20 63 6f 6e 73 74 61 following consta
dbe0: 6e 74 20 69 73 20 75 73 65 64 20 74 6f 20 74 65 nt is used to te
dbf0: 73 74 20 66 6f 72 20 6f 6c 64 65 72 20 76 65 72 st for older ver
dc00: 73 69 6f 6e 73 20 6f 66 20 54 63 6c 0a 20 2a 20 sions of Tcl. *
dc10: 69 6e 20 74 68 65 20 73 74 75 62 73 20 74 61 62 in the stubs tab
dc20: 6c 65 73 2e 0a 20 2a 0a 20 2a 20 4a 61 6e 20 4e les.. *. * Jan N
dc30: 69 6a 74 6d 61 6e 27 73 20 70 6c 75 73 20 70 61 ijtman's plus pa
dc40: 74 63 68 20 75 73 65 73 20 30 78 46 43 41 31 42 tch uses 0xFCA1B
dc50: 41 43 46 2c 20 73 6f 20 77 65 20 6e 65 65 64 20 ACF, so we need
dc60: 74 6f 20 70 69 63 6b 20 61 20 64 69 66 66 65 72 to pick a differ
dc70: 65 6e 74 0a 20 2a 20 76 61 6c 75 65 20 73 69 6e ent. * value sin
dc80: 63 65 20 74 68 65 20 73 74 75 62 73 20 74 61 62 ce the stubs tab
dc90: 6c 65 73 20 64 6f 6e 27 74 20 6d 61 74 63 68 2e les don't match.
dca0: 0a 20 2a 2f 0a 0a 23 64 65 66 69 6e 65 20 54 43 . */..#define TC
dcb0: 4c 5f 53 54 55 42 5f 4d 41 47 49 43 20 30 78 46 L_STUB_MAGIC 0xF
dcc0: 43 41 33 42 41 43 46 0a 0a 2f 2a 0a 20 2a 20 54 CA3BACF../*. * T
dcd0: 68 65 20 66 6f 6c 6c 6f 77 69 6e 67 20 66 75 6e he following fun
dce0: 63 74 69 6f 6e 20 69 73 20 72 65 71 75 69 72 65 ction is require
dcf0: 64 20 74 6f 20 62 65 20 64 65 66 69 6e 65 64 20 d to be defined
dd00: 69 6e 20 61 6c 6c 20 73 74 75 62 73 20 61 77 61 in all stubs awa
dd10: 72 65 0a 20 2a 20 65 78 74 65 6e 73 69 6f 6e 73 re. * extensions
dd20: 2e 20 20 54 68 65 20 66 75 6e 63 74 69 6f 6e 20 . The function
dd30: 69 73 20 61 63 74 75 61 6c 6c 79 20 69 6d 70 6c is actually impl
dd40: 65 6d 65 6e 74 65 64 20 69 6e 20 74 68 65 20 73 emented in the s
dd50: 74 75 62 0a 20 2a 20 6c 69 62 72 61 72 79 2c 20 tub. * library,
dd60: 6e 6f 74 20 74 68 65 20 6d 61 69 6e 20 54 63 6c not the main Tcl
dd70: 20 6c 69 62 72 61 72 79 2c 20 61 6c 74 68 6f 75 library, althou
dd80: 67 68 20 74 68 65 72 65 20 69 73 20 61 20 74 72 gh there is a tr
dd90: 69 76 69 61 6c 0a 20 2a 20 69 6d 70 6c 65 6d 65 ivial. * impleme
dda0: 6e 74 61 74 69 6f 6e 20 69 6e 20 74 68 65 20 6d ntation in the m
ddb0: 61 69 6e 20 6c 69 62 72 61 72 79 20 69 6e 20 63 ain library in c
ddc0: 61 73 65 20 61 6e 20 65 78 74 65 6e 73 69 6f 6e ase an extension
ddd0: 20 69 73 20 73 74 61 74 69 63 61 6c 6c 79 0a 20 is statically.
dde0: 2a 20 6c 69 6e 6b 65 64 20 69 6e 74 6f 20 61 6e * linked into an
ddf0: 20 61 70 70 6c 69 63 61 74 69 6f 6e 2e 0a 20 2a application.. *
de00: 2f 0a 0a 45 58 54 45 52 4e 20 63 68 61 72 20 2a /..EXTERN char *
de10: 09 09 54 63 6c 5f 49 6e 69 74 53 74 75 62 73 20 ..Tcl_InitStubs
de20: 5f 41 4e 53 49 5f 41 52 47 53 5f 28 28 54 63 6c _ANSI_ARGS_((Tcl
de30: 5f 49 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c _Interp *interp,
de40: 0a 09 09 09 20 20 20 20 63 68 61 72 20 2a 76 65 .... char *ve
de50: 72 73 69 6f 6e 2c 20 69 6e 74 20 65 78 61 63 74 rsion, int exact
de60: 29 29 3b 0a 0a 23 69 66 6e 64 65 66 20 55 53 45 ));..#ifndef USE
de70: 5f 54 43 4c 5f 53 54 55 42 53 0a 0a 2f 2a 0a 20 _TCL_STUBS../*.
de80: 2a 20 57 68 65 6e 20 6e 6f 74 20 75 73 69 6e 67 * When not using
de90: 20 73 74 75 62 73 2c 20 6d 61 6b 65 20 69 74 20 stubs, make it
dea0: 61 20 6d 61 63 72 6f 2e 0a 20 2a 2f 0a 0a 23 64 a macro.. */..#d
deb0: 65 66 69 6e 65 20 54 63 6c 5f 49 6e 69 74 53 74 efine Tcl_InitSt
dec0: 75 62 73 28 69 6e 74 65 72 70 2c 20 76 65 72 73 ubs(interp, vers
ded0: 69 6f 6e 2c 20 65 78 61 63 74 29 20 5c 0a 20 20 ion, exact) \.
dee0: 20 20 54 63 6c 5f 50 6b 67 52 65 71 75 69 72 65 Tcl_PkgRequire
def0: 28 69 6e 74 65 72 70 2c 20 22 54 63 6c 22 2c 20 (interp, "Tcl",
df00: 76 65 72 73 69 6f 6e 2c 20 65 78 61 63 74 29 0a version, exact).
df10: 0a 23 65 6e 64 69 66 0a 0a 0a 2f 2a 0a 20 2a 20 .#endif.../*. *
df20: 49 6e 63 6c 75 64 65 20 74 68 65 20 70 75 62 6c Include the publ
df30: 69 63 20 66 75 6e 63 74 69 6f 6e 20 64 65 63 6c ic function decl
df40: 61 72 61 74 69 6f 6e 73 20 74 68 61 74 20 61 72 arations that ar
df50: 65 20 61 63 63 65 73 73 69 62 6c 65 20 76 69 61 e accessible via
df60: 0a 20 2a 20 74 68 65 20 73 74 75 62 73 20 74 61 . * the stubs ta
df70: 62 6c 65 2e 0a 20 2a 2f 0a 0a 23 69 6e 63 6c 75 ble.. */..#inclu
df80: 64 65 20 22 74 63 6c 44 65 63 6c 73 2e 68 22 0a de "tclDecls.h".
df90: 0a 2f 2a 0a 20 2a 20 50 75 62 6c 69 63 20 66 75 ./*. * Public fu
dfa0: 6e 63 74 69 6f 6e 73 20 74 68 61 74 20 61 72 65 nctions that are
dfb0: 20 6e 6f 74 20 61 63 63 65 73 73 69 62 6c 65 20 not accessible
dfc0: 76 69 61 20 74 68 65 20 73 74 75 62 73 20 74 61 via the stubs ta
dfd0: 62 6c 65 2e 0a 20 2a 2f 0a 0a 45 58 54 45 52 4e ble.. */..EXTERN
dfe0: 20 76 6f 69 64 20 54 63 6c 5f 4d 61 69 6e 20 5f void Tcl_Main _
dff0: 41 4e 53 49 5f 41 52 47 53 5f 28 28 69 6e 74 20 ANSI_ARGS_((int
e000: 61 72 67 63 2c 20 63 68 61 72 20 2a 2a 61 72 67 argc, char **arg
e010: 76 2c 0a 09 54 63 6c 5f 41 70 70 49 6e 69 74 50 v,..Tcl_AppInitP
e020: 72 6f 63 20 2a 61 70 70 49 6e 69 74 50 72 6f 63 roc *appInitProc
e030: 29 29 3b 0a 0a 2f 2a 0a 20 2a 20 43 6f 6e 76 65 ));../*. * Conve
e040: 6e 69 65 6e 63 65 20 64 65 63 6c 61 72 61 74 69 nience declarati
e050: 6f 6e 20 6f 66 20 54 63 6c 5f 41 70 70 49 6e 69 on of Tcl_AppIni
e060: 74 20 66 6f 72 20 62 61 63 6b 77 61 72 64 73 20 t for backwards
e070: 63 6f 6d 70 61 74 69 62 69 6c 69 74 79 2e 0a 20 compatibility..
e080: 2a 20 54 68 69 73 20 66 75 6e 63 74 69 6f 6e 20 * This function
e090: 69 73 20 6e 6f 74 20 2a 69 6d 70 6c 65 6d 65 6e is not *implemen
e0a0: 74 65 64 2a 20 62 79 20 74 68 65 20 74 63 6c 20 ted* by the tcl
e0b0: 6c 69 62 72 61 72 79 2c 20 73 6f 20 74 68 65 20 library, so the
e0c0: 73 74 6f 72 61 67 65 0a 20 2a 20 63 6c 61 73 73 storage. * class
e0d0: 20 69 73 20 6e 65 69 74 68 65 72 20 44 4c 4c 45 is neither DLLE
e0e0: 58 50 4f 52 54 20 6e 6f 72 20 44 4c 4c 49 4d 50 XPORT nor DLLIMP
e0f0: 4f 52 54 0a 20 2a 2f 0a 0a 48 45 41 44 5f 45 58 ORT. */..HEAD_EX
e100: 54 45 52 4e 20 69 6e 74 09 09 54 63 6c 5f 41 70 TERN int..Tcl_Ap
e110: 70 49 6e 69 74 20 5f 41 4e 53 49 5f 41 52 47 53 pInit _ANSI_ARGS
e120: 5f 28 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 _((Tcl_Interp *i
e130: 6e 74 65 72 70 29 29 3b 0a 0a 23 65 6e 64 69 66 nterp));..#endif
e140: 20 2f 2a 20 52 45 53 4f 55 52 43 45 5f 49 4e 43 /* RESOURCE_INC
e150: 4c 55 44 45 44 20 2a 2f 0a 0a 2f 2a 0a 20 2a 20 LUDED */../*. *
e160: 65 6e 64 20 62 6c 6f 63 6b 20 66 6f 72 20 43 2b end block for C+
e170: 2b 0a 20 2a 2f 0a 20 20 20 20 0a 23 69 66 64 65 +. */. .#ifde
e180: 66 20 5f 5f 63 70 6c 75 73 70 6c 75 73 0a 7d 0a f __cplusplus.}.
e190: 23 65 6e 64 69 66 0a 20 20 20 20 0a 23 65 6e 64 #endif. .#end
e1a0: 69 66 20 2f 2a 20 5f 54 43 4c 20 2a 2f 0a if /* _TCL */.