Attachment "apply.patch" to
ticket [944803ffff]
added by
msofer
2004-04-30 01:54:45.
0000: 3f 20 67 65 6e 65 72 69 63 2f 74 63 6c 4f 62 6a ? generic/tclObj
0010: 2e 63 2e 4f 52 49 47 0a 3f 20 75 6e 69 78 2f 2e .c.ORIG.? unix/.
0020: 6c 6f 67 0a 3f 20 75 6e 69 78 2f 2e 6f 66 6c 0a log.? unix/.ofl.
0030: 3f 20 75 6e 69 78 2f 45 52 52 0a 3f 20 75 6e 69 ? unix/ERR.? uni
0040: 78 2f 64 6c 74 65 73 74 2e 6d 61 72 6b 65 72 0a x/dltest.marker.
0050: 3f 20 75 6e 69 78 2f 74 63 6c 73 68 2d 68 65 61 ? unix/tclsh-hea
0060: 64 0a 3f 20 75 6e 69 78 2f 74 63 6c 73 68 2d 6e d.? unix/tclsh-n
0070: 6f 41 73 79 6e 63 0a 3f 20 75 6e 69 78 2f 74 63 oAsync.? unix/tc
0080: 6c 73 68 2d 6e 6f 53 74 61 72 74 0a 3f 20 75 6e lsh-noStart.? un
0090: 69 78 2f 78 2e 6c 6f 67 0a 3f 20 75 6e 69 78 2f ix/x.log.? unix/
00a0: 78 2e 6f 66 6c 0a 49 6e 64 65 78 3a 20 67 65 6e x.ofl.Index: gen
00b0: 65 72 69 63 2f 74 63 6c 42 61 73 69 63 2e 63 0a eric/tclBasic.c.
00c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
00d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
00e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
00f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0100: 3d 3d 3d 0a 52 43 53 20 66 69 6c 65 3a 20 2f 63 ===.RCS file: /c
0110: 76 73 72 6f 6f 74 2f 74 63 6c 2f 74 63 6c 2f 67 vsroot/tcl/tcl/g
0120: 65 6e 65 72 69 63 2f 74 63 6c 42 61 73 69 63 2e eneric/tclBasic.
0130: 63 2c 76 0a 72 65 74 72 69 65 76 69 6e 67 20 72 c,v.retrieving r
0140: 65 76 69 73 69 6f 6e 20 31 2e 39 39 0a 64 69 66 evision 1.99.dif
0150: 66 20 2d 75 20 2d 72 31 2e 39 39 20 74 63 6c 42 f -u -r1.99 tclB
0160: 61 73 69 63 2e 63 0a 2d 2d 2d 20 67 65 6e 65 72 asic.c.--- gener
0170: 69 63 2f 74 63 6c 42 61 73 69 63 2e 63 09 36 20 ic/tclBasic.c.6
0180: 41 70 72 20 32 30 30 34 20 32 32 3a 32 35 3a 34 Apr 2004 22:25:4
0190: 38 20 2d 30 30 30 30 09 31 2e 39 39 0a 2b 2b 2b 8 -0000.1.99.+++
01a0: 20 67 65 6e 65 72 69 63 2f 74 63 6c 42 61 73 69 generic/tclBasi
01b0: 63 2e 63 09 32 39 20 41 70 72 20 32 30 30 34 20 c.c.29 Apr 2004
01c0: 31 38 3a 31 34 3a 30 37 20 2d 30 30 30 30 0a 40 18:14:07 -0000.@
01d0: 40 20 2d 36 31 2c 36 20 2b 36 31 2c 38 20 40 40 @ -61,6 +61,8 @@
01e0: 0a 20 0a 20 20 20 20 20 7b 22 61 70 70 65 6e 64 . . {"append
01f0: 22 2c 09 09 28 54 63 6c 5f 43 6d 64 50 72 6f 63 ",..(Tcl_CmdProc
0200: 20 2a 29 20 4e 55 4c 4c 2c 09 54 63 6c 5f 41 70 *) NULL,.Tcl_Ap
0210: 70 65 6e 64 4f 62 6a 43 6d 64 2c 0a 20 09 54 63 pendObjCmd,. .Tc
0220: 6c 43 6f 6d 70 69 6c 65 41 70 70 65 6e 64 43 6d lCompileAppendCm
0230: 64 2c 09 09 31 7d 2c 0a 2b 20 20 20 20 7b 22 61 d,..1},.+ {"a
0240: 70 70 6c 79 22 2c 09 09 28 54 63 6c 5f 43 6d 64 pply",..(Tcl_Cmd
0250: 50 72 6f 63 20 2a 29 20 4e 55 4c 4c 2c 09 54 63 Proc *) NULL,.Tc
0260: 6c 5f 41 70 70 6c 79 4f 62 6a 43 6d 64 2c 0a 2b l_ApplyObjCmd,.+
0270: 20 20 20 20 20 20 20 20 28 43 6f 6d 70 69 6c 65 (Compile
0280: 50 72 6f 63 20 2a 29 20 4e 55 4c 4c 2c 09 09 31 Proc *) NULL,..1
0290: 7d 2c 0a 20 20 20 20 20 7b 22 61 72 72 61 79 22 },. {"array"
02a0: 2c 09 09 28 54 63 6c 5f 43 6d 64 50 72 6f 63 20 ,..(Tcl_CmdProc
02b0: 2a 29 20 4e 55 4c 4c 2c 09 54 63 6c 5f 41 72 72 *) NULL,.Tcl_Arr
02c0: 61 79 4f 62 6a 43 6d 64 2c 0a 20 20 20 20 20 20 ayObjCmd,.
02d0: 20 20 20 28 43 6f 6d 70 69 6c 65 50 72 6f 63 20 (CompileProc
02e0: 2a 29 20 4e 55 4c 4c 2c 09 09 31 7d 2c 0a 20 20 *) NULL,..1},.
02f0: 20 20 20 7b 22 62 69 6e 61 72 79 22 2c 09 09 28 {"binary",..(
0300: 54 63 6c 5f 43 6d 64 50 72 6f 63 20 2a 29 20 4e Tcl_CmdProc *) N
0310: 55 4c 4c 2c 09 54 63 6c 5f 42 69 6e 61 72 79 4f ULL,.Tcl_BinaryO
0320: 62 6a 43 6d 64 2c 0a 40 40 20 2d 34 33 33 2c 37 bjCmd,.@@ -433,7
0330: 20 2b 34 33 35 2c 37 20 40 40 0a 20 09 20 20 20 +435,7 @@. .
0340: 20 20 20 20 20 26 26 20 28 63 6d 64 49 6e 66 6f && (cmdInfo
0350: 50 74 72 2d 3e 63 6f 6d 70 69 6c 65 50 72 6f 63 Ptr->compileProc
0360: 20 3d 3d 20 28 43 6f 6d 70 69 6c 65 50 72 6f 63 == (CompileProc
0370: 20 2a 29 20 4e 55 4c 4c 29 29 20 7b 0a 20 09 20 *) NULL)) {. .
0380: 20 20 20 54 63 6c 5f 50 61 6e 69 63 28 22 54 63 Tcl_Panic("Tc
0390: 6c 5f 43 72 65 61 74 65 49 6e 74 65 72 70 3a 20 l_CreateInterp:
03a0: 62 75 69 6c 74 69 6e 20 63 6f 6d 6d 61 6e 64 20 builtin command
03b0: 77 69 74 68 20 4e 55 4c 4c 20 73 74 72 69 6e 67 with NULL string
03c0: 20 61 6e 64 20 6f 62 6a 65 63 74 20 63 6f 6d 6d and object comm
03d0: 61 6e 64 20 70 72 6f 63 73 20 61 6e 64 20 61 20 and procs and a
03e0: 4e 55 4c 4c 20 63 6f 6d 70 69 6c 65 20 70 72 6f NULL compile pro
03f0: 63 5c 6e 22 29 3b 0a 20 09 7d 0a 2d 09 0a 2b 0a c\n");. .}.-..+.
0400: 20 09 68 50 74 72 20 3d 20 54 63 6c 5f 43 72 65 .hPtr = Tcl_Cre
0410: 61 74 65 48 61 73 68 45 6e 74 72 79 28 26 69 50 ateHashEntry(&iP
0420: 74 72 2d 3e 67 6c 6f 62 61 6c 4e 73 50 74 72 2d tr->globalNsPtr-
0430: 3e 63 6d 64 54 61 62 6c 65 2c 0a 20 09 20 20 20 >cmdTable,. .
0440: 20 20 20 20 20 63 6d 64 49 6e 66 6f 50 74 72 2d cmdInfoPtr-
0450: 3e 6e 61 6d 65 2c 20 26 6e 65 77 29 3b 0a 20 09 >name, &new);. .
0460: 69 66 20 28 6e 65 77 29 20 7b 0a 49 6e 64 65 78 if (new) {.Index
0470: 3a 20 67 65 6e 65 72 69 63 2f 74 63 6c 49 6e 74 : generic/tclInt
0480: 2e 68 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d .h.=============
0490: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
04a0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
04b0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
04c0: 3d 3d 3d 3d 3d 3d 0a 52 43 53 20 66 69 6c 65 3a ======.RCS file:
04d0: 20 2f 63 76 73 72 6f 6f 74 2f 74 63 6c 2f 74 63 /cvsroot/tcl/tc
04e0: 6c 2f 67 65 6e 65 72 69 63 2f 74 63 6c 49 6e 74 l/generic/tclInt
04f0: 2e 68 2c 76 0a 72 65 74 72 69 65 76 69 6e 67 20 .h,v.retrieving
0500: 72 65 76 69 73 69 6f 6e 20 31 2e 31 35 34 0a 64 revision 1.154.d
0510: 69 66 66 20 2d 75 20 2d 72 31 2e 31 35 34 20 74 iff -u -r1.154 t
0520: 63 6c 49 6e 74 2e 68 0a 2d 2d 2d 20 67 65 6e 65 clInt.h.--- gene
0530: 72 69 63 2f 74 63 6c 49 6e 74 2e 68 09 32 35 20 ric/tclInt.h.25
0540: 41 70 72 20 32 30 30 34 20 32 30 3a 31 36 3a 33 Apr 2004 20:16:3
0550: 31 20 2d 30 30 30 30 09 31 2e 31 35 34 0a 2b 2b 1 -0000.1.154.++
0560: 2b 20 67 65 6e 65 72 69 63 2f 74 63 6c 49 6e 74 + generic/tclInt
0570: 2e 68 09 32 39 20 41 70 72 20 32 30 30 34 20 31 .h.29 Apr 2004 1
0580: 38 3a 31 34 3a 30 38 20 2d 30 30 30 30 0a 40 40 8:14:08 -0000.@@
0590: 20 2d 31 38 34 33 2c 36 20 2b 31 38 34 33 2c 38 -1843,6 +1843,8
05a0: 20 40 40 0a 20 09 09 20 20 20 20 54 63 6c 5f 49 @@. .. Tcl_I
05b0: 6e 74 65 72 70 20 2a 69 6e 74 65 72 70 2c 20 69 nterp *interp, i
05c0: 6e 74 20 6f 62 6a 63 2c 20 54 63 6c 5f 4f 62 6a nt objc, Tcl_Obj
05d0: 20 2a 43 4f 4e 53 54 20 6f 62 6a 76 5b 5d 29 29 *CONST objv[]))
05e0: 3b 0a 20 45 58 54 45 52 4e 20 69 6e 74 09 54 63 ;. EXTERN int.Tc
05f0: 6c 5f 41 70 70 65 6e 64 4f 62 6a 43 6d 64 20 5f l_AppendObjCmd _
0600: 41 4e 53 49 5f 41 52 47 53 5f 28 28 43 6c 69 65 ANSI_ARGS_((Clie
0610: 6e 74 44 61 74 61 20 63 6c 69 65 6e 74 44 61 74 ntData clientDat
0620: 61 2c 0a 20 09 09 20 20 20 20 54 63 6c 5f 49 6e a,. .. Tcl_In
0630: 74 65 72 70 20 2a 69 6e 74 65 72 70 2c 20 69 6e terp *interp, in
0640: 74 20 6f 62 6a 63 2c 20 54 63 6c 5f 4f 62 6a 20 t objc, Tcl_Obj
0650: 2a 43 4f 4e 53 54 20 6f 62 6a 76 5b 5d 29 29 3b *CONST objv[]));
0660: 0a 2b 45 58 54 45 52 4e 20 69 6e 74 09 54 63 6c .+EXTERN int.Tcl
0670: 5f 41 70 70 6c 79 4f 62 6a 43 6d 64 20 5f 41 4e _ApplyObjCmd _AN
0680: 53 49 5f 41 52 47 53 5f 28 28 43 6c 69 65 6e 74 SI_ARGS_((Client
0690: 44 61 74 61 20 63 6c 69 65 6e 74 44 61 74 61 2c Data clientData,
06a0: 0a 2b 09 09 20 20 20 20 54 63 6c 5f 49 6e 74 65 .+.. Tcl_Inte
06b0: 72 70 20 2a 69 6e 74 65 72 70 2c 20 69 6e 74 20 rp *interp, int
06c0: 6f 62 6a 63 2c 20 54 63 6c 5f 4f 62 6a 20 2a 43 objc, Tcl_Obj *C
06d0: 4f 4e 53 54 20 6f 62 6a 76 5b 5d 29 29 3b 0a 20 ONST objv[]));.
06e0: 45 58 54 45 52 4e 20 69 6e 74 09 54 63 6c 5f 41 EXTERN int.Tcl_A
06f0: 72 72 61 79 4f 62 6a 43 6d 64 20 5f 41 4e 53 49 rrayObjCmd _ANSI
0700: 5f 41 52 47 53 5f 28 28 43 6c 69 65 6e 74 44 61 _ARGS_((ClientDa
0710: 74 61 20 63 6c 69 65 6e 74 44 61 74 61 2c 0a 20 ta clientData,.
0720: 09 09 20 20 20 20 54 63 6c 5f 49 6e 74 65 72 70 .. Tcl_Interp
0730: 20 2a 69 6e 74 65 72 70 2c 20 69 6e 74 20 6f 62 *interp, int ob
0740: 6a 63 2c 20 54 63 6c 5f 4f 62 6a 20 2a 43 4f 4e jc, Tcl_Obj *CON
0750: 53 54 20 6f 62 6a 76 5b 5d 29 29 3b 0a 20 45 58 ST objv[]));. EX
0760: 54 45 52 4e 20 69 6e 74 09 54 63 6c 5f 42 69 6e TERN int.Tcl_Bin
0770: 61 72 79 4f 62 6a 43 6d 64 20 5f 41 4e 53 49 5f aryObjCmd _ANSI_
0780: 41 52 47 53 5f 28 28 43 6c 69 65 6e 74 44 61 74 ARGS_((ClientDat
0790: 61 20 63 6c 69 65 6e 74 44 61 74 61 2c 0a 49 6e a clientData,.In
07a0: 64 65 78 3a 20 67 65 6e 65 72 69 63 2f 74 63 6c dex: generic/tcl
07b0: 50 72 6f 63 2e 63 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d Proc.c.=========
07c0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
07d0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
07e0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
07f0: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 52 43 53 20 66 ==========.RCS f
0800: 69 6c 65 3a 20 2f 63 76 73 72 6f 6f 74 2f 74 63 ile: /cvsroot/tc
0810: 6c 2f 74 63 6c 2f 67 65 6e 65 72 69 63 2f 74 63 l/tcl/generic/tc
0820: 6c 50 72 6f 63 2e 63 2c 76 0a 72 65 74 72 69 65 lProc.c,v.retrie
0830: 76 69 6e 67 20 72 65 76 69 73 69 6f 6e 20 31 2e ving revision 1.
0840: 35 30 0a 64 69 66 66 20 2d 75 20 2d 72 31 2e 35 50.diff -u -r1.5
0850: 30 20 74 63 6c 50 72 6f 63 2e 63 0a 2d 2d 2d 20 0 tclProc.c.---
0860: 67 65 6e 65 72 69 63 2f 74 63 6c 50 72 6f 63 2e generic/tclProc.
0870: 63 09 39 20 4d 61 72 20 32 30 30 34 20 31 32 3a c.9 Mar 2004 12:
0880: 35 39 3a 30 35 20 2d 30 30 30 30 09 31 2e 35 30 59:05 -0000.1.50
0890: 0a 2b 2b 2b 20 67 65 6e 65 72 69 63 2f 74 63 6c .+++ generic/tcl
08a0: 50 72 6f 63 2e 63 09 32 39 20 41 70 72 20 32 30 Proc.c.29 Apr 20
08b0: 30 34 20 31 38 3a 31 34 3a 30 38 20 2d 30 30 30 04 18:14:08 -000
08c0: 30 0a 40 40 20 2d 36 2c 36 20 2b 36 2c 37 20 40 0.@@ -6,6 +6,7 @
08d0: 40 0a 20 20 2a 0a 20 20 2a 20 43 6f 70 79 72 69 @. *. * Copyri
08e0: 67 68 74 20 28 63 29 20 31 39 38 37 2d 31 39 39 ght (c) 1987-199
08f0: 33 20 54 68 65 20 52 65 67 65 6e 74 73 20 6f 66 3 The Regents of
0900: 20 74 68 65 20 55 6e 69 76 65 72 73 69 74 79 20 the University
0910: 6f 66 20 43 61 6c 69 66 6f 72 6e 69 61 2e 0a 20 of California..
0920: 20 2a 20 43 6f 70 79 72 69 67 68 74 20 28 63 29 * Copyright (c)
0930: 20 31 39 39 34 2d 31 39 39 38 20 53 75 6e 20 4d 1994-1998 Sun M
0940: 69 63 72 6f 73 79 73 74 65 6d 73 2c 20 49 6e 63 icrosystems, Inc
0950: 2e 0a 2b 20 2a 20 43 6f 70 79 72 69 67 68 74 20 ..+ * Copyright
0960: 28 63 29 20 32 30 30 34 20 20 20 20 20 20 4d 69 (c) 2004 Mi
0970: 67 75 65 6c 20 53 6f 66 65 72 0a 20 20 2a 0a 20 guel Sofer. *.
0980: 20 2a 20 53 65 65 20 74 68 65 20 66 69 6c 65 20 * See the file
0990: 22 6c 69 63 65 6e 73 65 2e 74 65 72 6d 73 22 20 "license.terms"
09a0: 66 6f 72 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 for information
09b0: 6f 6e 20 75 73 61 67 65 20 61 6e 64 20 72 65 64 on usage and red
09c0: 69 73 74 72 69 62 75 74 69 6f 6e 0a 20 20 2a 20 istribution. *
09d0: 6f 66 20 74 68 69 73 20 66 69 6c 65 2c 20 61 6e of this file, an
09e0: 64 20 66 6f 72 20 61 20 44 49 53 43 4c 41 49 4d d for a DISCLAIM
09f0: 45 52 20 4f 46 20 41 4c 4c 20 57 41 52 52 41 4e ER OF ALL WARRAN
0a00: 54 49 45 53 2e 0a 40 40 20 2d 31 37 32 31 2c 34 TIES..@@ -1721,4
0a10: 20 2b 31 37 32 32 2c 31 37 34 20 40 40 0a 20 7d +1722,174 @@. }
0a20: 0a 20 0a 20 0a 2b 0c 0a 2b 2f 2a 0a 2b 20 2a 20 . . .+..+/*.+ *
0a30: 4c 41 4d 42 44 41 20 61 6e 64 20 41 50 50 4c 59 LAMBDA and APPLY
0a40: 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 0a implementation.
0a50: 2b 20 2a 0a 2b 20 2a 2f 0a 2b 0a 2b 73 74 61 74 + *.+ */.+.+stat
0a60: 69 63 20 76 6f 69 64 09 09 44 75 70 4c 61 6d 62 ic void..DupLamb
0a70: 64 61 49 6e 74 65 72 6e 61 6c 52 65 70 20 5f 41 daInternalRep _A
0a80: 4e 53 49 5f 41 52 47 53 5f 28 28 54 63 6c 5f 4f NSI_ARGS_((Tcl_O
0a90: 62 6a 20 2a 6f 62 6a 50 74 72 2c 0a 2b 09 09 09 bj *objPtr,.+...
0aa0: 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 63 6f 70 Tcl_Obj *cop
0ab0: 79 50 74 72 29 29 3b 0a 2b 73 74 61 74 69 63 20 yPtr));.+static
0ac0: 76 6f 69 64 09 09 46 72 65 65 4c 61 6d 62 64 61 void..FreeLambda
0ad0: 49 6e 74 65 72 6e 61 6c 52 65 70 20 5f 41 4e 53 InternalRep _ANS
0ae0: 49 5f 41 52 47 53 5f 28 28 0a 2b 20 20 20 20 09 I_ARGS_((.+ .
0af0: 09 09 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 6f .. Tcl_Obj *o
0b00: 62 6a 50 74 72 29 29 3b 0a 2b 73 74 61 74 69 63 bjPtr));.+static
0b10: 20 69 6e 74 09 09 53 65 74 4c 61 6d 62 64 61 46 int..SetLambdaF
0b20: 72 6f 6d 41 6e 79 20 5f 41 4e 53 49 5f 41 52 47 romAny _ANSI_ARG
0b30: 53 5f 28 28 54 63 6c 5f 49 6e 74 65 72 70 20 2a S_((Tcl_Interp *
0b40: 69 6e 74 65 72 70 2c 0a 2b 09 09 09 20 20 20 20 interp,.+...
0b50: 54 63 6c 5f 4f 62 6a 20 2a 6f 62 6a 50 74 72 29 Tcl_Obj *objPtr)
0b60: 29 3b 0a 2b 0a 2b 54 63 6c 5f 4f 62 6a 54 79 70 );.+.+Tcl_ObjTyp
0b70: 65 20 74 63 6c 4c 61 6d 62 64 61 54 79 70 65 20 e tclLambdaType
0b80: 3d 20 7b 0a 2b 20 20 20 20 22 6c 61 6d 62 64 61 = {.+ "lambda
0b90: 22 2c 09 09 09 09 2f 2a 20 6e 61 6d 65 20 2a 2f ",..../* name */
0ba0: 0a 2b 20 20 20 20 46 72 65 65 4c 61 6d 62 64 61 .+ FreeLambda
0bb0: 49 6e 74 65 72 6e 61 6c 52 65 70 2c 09 20 20 20 InternalRep,.
0bc0: 20 20 20 20 20 2f 2a 20 66 72 65 65 49 6e 74 52 /* freeIntR
0bd0: 65 70 50 72 6f 63 20 2a 2f 0a 2b 20 20 20 20 44 epProc */.+ D
0be0: 75 70 4c 61 6d 62 64 61 49 6e 74 65 72 6e 61 6c upLambdaInternal
0bf0: 52 65 70 2c 09 20 20 20 20 20 20 20 20 2f 2a 20 Rep,. /*
0c00: 64 75 70 49 6e 74 52 65 70 50 72 6f 63 20 2a 2f dupIntRepProc */
0c10: 0a 2b 20 20 20 20 28 54 63 6c 5f 55 70 64 61 74 .+ (Tcl_Updat
0c20: 65 53 74 72 69 6e 67 50 72 6f 63 20 2a 29 20 4e eStringProc *) N
0c30: 55 4c 4c 2c 09 2f 2a 20 75 70 64 61 74 65 53 74 ULL,./* updateSt
0c40: 72 69 6e 67 50 72 6f 63 20 2a 2f 0a 2b 20 20 20 ringProc */.+
0c50: 20 53 65 74 4c 61 6d 62 64 61 46 72 6f 6d 41 6e SetLambdaFromAn
0c60: 79 09 09 09 2f 2a 20 73 65 74 46 72 6f 6d 41 6e y.../* setFromAn
0c70: 79 50 72 6f 63 20 2a 2f 0a 2b 7d 3b 0a 2b 0a 2b yProc */.+};.+.+
0c80: 2f 2a 0a 2b 20 2a 20 61 20 4c 61 6d 62 64 61 20 /*.+ * a Lambda
0c90: 54 63 6c 5f 4f 62 6a 20 68 61 73 20 74 68 65 20 Tcl_Obj has the
0ca0: 66 6f 72 6d 0a 2b 20 2a 0a 2b 20 2a 20 20 70 74 form.+ *.+ * pt
0cb0: 72 31 20 69 73 20 61 20 70 72 6f 63 50 74 72 3a r1 is a procPtr:
0cc0: 20 70 6f 69 6e 74 65 72 20 74 6f 20 61 20 70 72 pointer to a pr
0cd0: 6f 63 20 73 74 72 75 63 74 75 72 65 0a 2b 20 2a oc structure.+ *
0ce0: 0a 2b 20 2a 2f 0a 2b 0a 2b 73 74 61 74 69 63 20 .+ */.+.+static
0cf0: 76 6f 69 64 0a 2b 44 75 70 4c 61 6d 62 64 61 49 void.+DupLambdaI
0d00: 6e 74 65 72 6e 61 6c 52 65 70 28 73 72 63 50 74 nternalRep(srcPt
0d10: 72 2c 20 63 6f 70 79 50 74 72 29 0a 2b 20 20 20 r, copyPtr).+
0d20: 20 54 63 6c 5f 4f 62 6a 20 2a 73 72 63 50 74 72 Tcl_Obj *srcPtr
0d30: 3b 09 09 2f 2a 20 4f 62 6a 65 63 74 20 77 69 74 ;../* Object wit
0d40: 68 20 69 6e 74 65 72 6e 61 6c 20 72 65 70 20 74 h internal rep t
0d50: 6f 20 63 6f 70 79 2e 20 2a 2f 0a 2b 20 20 20 20 o copy. */.+
0d60: 72 65 67 69 73 74 65 72 20 54 63 6c 5f 4f 62 6a register Tcl_Obj
0d70: 20 2a 63 6f 70 79 50 74 72 3b 09 2f 2a 20 4f 62 *copyPtr;./* Ob
0d80: 6a 65 63 74 20 77 69 74 68 20 69 6e 74 65 72 6e ject with intern
0d90: 61 6c 20 72 65 70 20 74 6f 20 73 65 74 2e 20 2a al rep to set. *
0da0: 2f 0a 2b 7b 0a 2b 20 20 20 20 50 72 6f 63 20 2a /.+{.+ Proc *
0db0: 70 72 6f 63 50 74 72 20 3d 20 28 50 72 6f 63 20 procPtr = (Proc
0dc0: 2a 29 20 73 72 63 50 74 72 2d 3e 69 6e 74 65 72 *) srcPtr->inter
0dd0: 6e 61 6c 52 65 70 2e 74 77 6f 50 74 72 56 61 6c nalRep.twoPtrVal
0de0: 75 65 2e 70 74 72 31 3b 0a 2b 0a 2b 20 20 20 20 ue.ptr1;.+.+
0df0: 63 6f 70 79 50 74 72 2d 3e 69 6e 74 65 72 6e 61 copyPtr->interna
0e00: 6c 52 65 70 2e 74 77 6f 50 74 72 56 61 6c 75 65 lRep.twoPtrValue
0e10: 2e 70 74 72 31 20 3d 20 28 56 4f 49 44 20 2a 29 .ptr1 = (VOID *)
0e20: 20 70 72 6f 63 50 74 72 3b 0a 2b 20 20 20 20 63 procPtr;.+ c
0e30: 6f 70 79 50 74 72 2d 3e 69 6e 74 65 72 6e 61 6c opyPtr->internal
0e40: 52 65 70 2e 74 77 6f 50 74 72 56 61 6c 75 65 2e Rep.twoPtrValue.
0e50: 70 74 72 32 20 3d 20 4e 55 4c 4c 3b 0a 2b 0a 2b ptr2 = NULL;.+.+
0e60: 20 20 20 20 70 72 6f 63 50 74 72 2d 3e 72 65 66 procPtr->ref
0e70: 43 6f 75 6e 74 2b 2b 3b 0a 2b 20 20 20 20 63 6f Count++;.+ co
0e80: 70 79 50 74 72 2d 3e 74 79 70 65 50 74 72 20 3d pyPtr->typePtr =
0e90: 20 26 74 63 6c 4c 61 6d 62 64 61 54 79 70 65 3b &tclLambdaType;
0ea0: 0a 2b 7d 0a 2b 0a 2b 73 74 61 74 69 63 20 76 6f .+}.+.+static vo
0eb0: 69 64 0a 2b 46 72 65 65 4c 61 6d 62 64 61 49 6e id.+FreeLambdaIn
0ec0: 74 65 72 6e 61 6c 52 65 70 28 6f 62 6a 50 74 72 ternalRep(objPtr
0ed0: 29 0a 2b 20 20 20 20 72 65 67 69 73 74 65 72 20 ).+ register
0ee0: 54 63 6c 5f 4f 62 6a 20 2a 6f 62 6a 50 74 72 3b Tcl_Obj *objPtr;
0ef0: 09 2f 2a 20 43 6d 64 4e 61 6d 65 20 6f 62 6a 65 ./* CmdName obje
0f00: 63 74 20 77 69 74 68 20 69 6e 74 65 72 6e 61 6c ct with internal
0f10: 0a 2b 09 09 09 09 20 2a 20 72 65 70 72 65 73 65 .+.... * represe
0f20: 6e 74 61 74 69 6f 6e 20 74 6f 20 66 72 65 65 2e ntation to free.
0f30: 20 2a 2f 0a 2b 7b 0a 2b 20 20 20 20 50 72 6f 63 */.+{.+ Proc
0f40: 20 2a 70 72 6f 63 50 74 72 20 3d 20 28 50 72 6f *procPtr = (Pro
0f50: 63 20 2a 29 20 6f 62 6a 50 74 72 2d 3e 69 6e 74 c *) objPtr->int
0f60: 65 72 6e 61 6c 52 65 70 2e 74 77 6f 50 74 72 56 ernalRep.twoPtrV
0f70: 61 6c 75 65 2e 70 74 72 31 3b 0a 2b 0a 2b 20 20 alue.ptr1;.+.+
0f80: 20 20 70 72 6f 63 50 74 72 2d 3e 72 65 66 43 6f procPtr->refCo
0f90: 75 6e 74 2d 2d 3b 0a 2b 20 20 20 20 69 66 20 28 unt--;.+ if (
0fa0: 70 72 6f 63 50 74 72 2d 3e 72 65 66 43 6f 75 6e procPtr->refCoun
0fb0: 74 20 3d 3d 20 30 29 20 7b 0a 2b 09 54 63 6c 50 t == 0) {.+.TclP
0fc0: 72 6f 63 43 6c 65 61 6e 75 70 50 72 6f 63 28 70 rocCleanupProc(p
0fd0: 72 6f 63 50 74 72 29 3b 0a 2b 20 20 20 20 7d 0a rocPtr);.+ }.
0fe0: 2b 7d 0a 2b 0a 2b 0a 2b 73 74 61 74 69 63 20 69 +}.+.+.+static i
0ff0: 6e 74 0a 2b 53 65 74 4c 61 6d 62 64 61 46 72 6f nt.+SetLambdaFro
1000: 6d 41 6e 79 28 69 6e 74 65 72 70 2c 20 6f 62 6a mAny(interp, obj
1010: 50 74 72 29 0a 2b 20 20 20 20 54 63 6c 5f 49 6e Ptr).+ Tcl_In
1020: 74 65 72 70 20 2a 69 6e 74 65 72 70 3b 09 09 2f terp *interp;../
1030: 2a 20 55 73 65 64 20 66 6f 72 20 65 72 72 6f 72 * Used for error
1040: 20 72 65 70 6f 72 74 69 6e 67 20 69 66 20 6e 6f reporting if no
1050: 74 20 4e 55 4c 4c 2e 20 2a 2f 0a 2b 20 20 20 20 t NULL. */.+
1060: 72 65 67 69 73 74 65 72 20 54 63 6c 5f 4f 62 6a register Tcl_Obj
1070: 20 2a 6f 62 6a 50 74 72 3b 09 2f 2a 20 54 68 65 *objPtr;./* The
1080: 20 6f 62 6a 65 63 74 20 74 6f 20 63 6f 6e 76 65 object to conve
1090: 72 74 2e 20 2a 2f 0a 2b 7b 0a 2b 20 20 20 20 49 rt. */.+{.+ I
10a0: 6e 74 65 72 70 20 2a 69 50 74 72 20 3d 20 28 49 nterp *iPtr = (I
10b0: 6e 74 65 72 70 20 2a 29 20 69 6e 74 65 72 70 3b nterp *) interp;
10c0: 0a 2b 20 20 20 20 63 68 61 72 20 2a 6e 61 6d 65 .+ char *name
10d0: 3b 0a 2b 20 20 20 20 4e 61 6d 65 73 70 61 63 65 ;.+ Namespace
10e0: 20 2a 6e 73 50 74 72 20 3d 20 69 50 74 72 2d 3e *nsPtr = iPtr->
10f0: 67 6c 6f 62 61 6c 4e 73 50 74 72 3b 0a 2b 20 20 globalNsPtr;.+
1100: 20 20 54 63 6c 5f 4f 62 6a 20 2a 61 72 67 73 50 Tcl_Obj *argsP
1110: 74 72 2c 20 2a 62 6f 64 79 50 74 72 2c 20 2a 2a tr, *bodyPtr, **
1120: 6f 62 6a 76 2c 20 2a 65 72 72 50 74 72 3b 0a 2b objv, *errPtr;.+
1130: 20 20 20 20 69 6e 74 20 6f 62 6a 63 3b 0a 2b 20 int objc;.+
1140: 20 20 20 50 72 6f 63 20 2a 70 72 6f 63 50 74 72 Proc *procPtr
1150: 3b 0a 2b 20 20 20 20 69 6e 74 20 72 65 73 75 6c ;.+ int resul
1160: 74 3b 0a 2b 20 20 20 20 2f 2a 0a 2b 20 20 20 20 t;.+ /*.+
1170: 20 2a 20 43 6f 6e 76 65 72 74 20 6f 62 6a 50 74 * Convert objPt
1180: 72 20 74 6f 20 6c 69 73 74 20 74 79 70 65 20 66 r to list type f
1190: 69 72 73 74 3b 20 69 66 20 69 74 20 63 61 6e 6e irst; if it cann
11a0: 6f 74 20 62 65 0a 2b 20 20 20 20 20 2a 20 63 6f ot be.+ * co
11b0: 6e 76 65 72 74 65 64 2c 20 6f 72 20 69 66 20 69 nverted, or if i
11c0: 74 73 20 6c 65 6e 67 74 68 20 69 73 20 6e 6f 74 ts length is not
11d0: 20 32 2c 20 74 68 65 6e 20 69 74 20 63 61 6e 6e 2, then it cann
11e0: 6f 74 0a 2b 20 20 20 20 20 2a 20 62 65 20 63 6f ot.+ * be co
11f0: 6e 76 65 72 74 65 64 20 74 6f 20 74 63 6c 4c 61 nverted to tclLa
1200: 6d 62 64 61 54 79 70 65 2e 0a 2b 20 20 20 20 20 mbdaType..+
1210: 2a 2f 0a 2b 0a 2b 20 20 20 20 72 65 73 75 6c 74 */.+.+ result
1220: 20 3d 20 54 63 6c 5f 4c 69 73 74 4f 62 6a 47 65 = Tcl_ListObjGe
1230: 74 45 6c 65 6d 65 6e 74 73 28 69 6e 74 65 72 70 tElements(interp
1240: 2c 20 6f 62 6a 50 74 72 2c 20 26 6f 62 6a 63 2c , objPtr, &objc,
1250: 20 26 6f 62 6a 76 29 3b 0a 2b 20 20 20 20 69 66 &objv);.+ if
1260: 20 28 28 72 65 73 75 6c 74 20 21 3d 20 54 43 4c ((result != TCL
1270: 5f 4f 4b 29 20 7c 7c 20 28 6f 62 6a 63 20 21 3d _OK) || (objc !=
1280: 20 32 29 29 20 7b 0a 2b 09 65 72 72 50 74 72 20 2)) {.+.errPtr
1290: 3d 20 54 63 6c 5f 4e 65 77 53 74 72 69 6e 67 4f = Tcl_NewStringO
12a0: 62 6a 28 22 63 61 6e 27 74 20 69 6e 74 65 72 70 bj("can't interp
12b0: 72 65 74 20 5c 22 22 2c 2d 31 29 3b 0a 2b 09 54 ret \"",-1);.+.T
12c0: 63 6c 5f 49 6e 63 72 52 65 66 43 6f 75 6e 74 28 cl_IncrRefCount(
12d0: 65 72 72 50 74 72 29 3b 0a 2b 09 54 63 6c 5f 41 errPtr);.+.Tcl_A
12e0: 70 70 65 6e 64 4f 62 6a 54 6f 4f 62 6a 28 65 72 ppendObjToObj(er
12f0: 72 50 74 72 2c 20 6f 62 6a 50 74 72 29 3b 0a 2b rPtr, objPtr);.+
1300: 09 54 63 6c 5f 41 70 70 65 6e 64 54 6f 4f 62 6a .Tcl_AppendToObj
1310: 28 65 72 72 50 74 72 2c 20 22 5c 22 20 61 73 20 (errPtr, "\" as
1320: 61 20 6c 61 6d 62 64 61 20 65 78 70 72 65 73 73 a lambda express
1330: 69 6f 6e 22 2c 20 2d 31 29 3b 0a 2b 09 54 63 6c ion", -1);.+.Tcl
1340: 5f 53 65 74 4f 62 6a 52 65 73 75 6c 74 28 69 6e _SetObjResult(in
1350: 74 65 72 70 2c 20 65 72 72 50 74 72 29 3b 0a 2b terp, errPtr);.+
1360: 09 54 63 6c 5f 44 65 63 72 52 65 66 43 6f 75 6e .Tcl_DecrRefCoun
1370: 74 28 65 72 72 50 74 72 29 3b 0a 2b 09 72 65 74 t(errPtr);.+.ret
1380: 75 72 6e 20 54 43 4c 5f 45 52 52 4f 52 3b 0a 2b urn TCL_ERROR;.+
1390: 20 20 20 20 7d 0a 2b 20 20 20 20 61 72 67 73 50 }.+ argsP
13a0: 74 72 20 3d 20 6f 62 6a 76 5b 30 5d 3b 0a 2b 20 tr = objv[0];.+
13b0: 20 20 20 62 6f 64 79 50 74 72 20 3d 20 6f 62 6a bodyPtr = obj
13c0: 76 5b 31 5d 3b 0a 2b 20 20 20 20 6e 61 6d 65 20 v[1];.+ name
13d0: 3d 20 54 63 6c 47 65 74 53 74 72 69 6e 67 28 6f = TclGetString(o
13e0: 62 6a 50 74 72 29 3b 0a 2b 20 20 20 20 0a 2b 20 bjPtr);.+ .+
13f0: 20 20 20 69 66 20 28 54 63 6c 43 72 65 61 74 65 if (TclCreate
1400: 50 72 6f 63 28 69 6e 74 65 72 70 2c 20 6e 73 50 Proc(interp, nsP
1410: 74 72 2c 20 6e 61 6d 65 2c 20 61 72 67 73 50 74 tr, name, argsPt
1420: 72 2c 20 62 6f 64 79 50 74 72 2c 0a 2b 20 20 20 r, bodyPtr,.+
1430: 20 20 20 20 20 26 70 72 6f 63 50 74 72 29 20 21 &procPtr) !
1440: 3d 20 54 43 4c 5f 4f 4b 29 20 7b 0a 2b 20 20 20 = TCL_OK) {.+
1450: 20 20 20 20 20 72 65 74 75 72 6e 20 54 43 4c 5f return TCL_
1460: 45 52 52 4f 52 3b 0a 2b 20 20 20 20 7d 0a 2b 20 ERROR;.+ }.+
1470: 20 20 20 70 72 6f 63 50 74 72 2d 3e 72 65 66 43 procPtr->refC
1480: 6f 75 6e 74 2b 2b 3b 0a 2b 20 20 20 20 0a 2b 20 ount++;.+ .+
1490: 20 20 20 2f 2a 0a 2b 20 20 20 20 20 2a 20 4e 6f /*.+ * No
14a0: 77 20 69 6e 69 74 69 61 6c 69 7a 65 20 74 68 65 w initialize the
14b0: 20 6e 65 77 20 70 72 6f 63 65 64 75 72 65 27 73 new procedure's
14c0: 20 63 6d 64 50 74 72 20 66 69 65 6c 64 2e 20 54 cmdPtr field. T
14d0: 68 69 73 20 69 73 20 75 73 65 64 20 61 74 0a 2b his is used at.+
14e0: 20 20 20 20 20 2a 20 72 75 6e 20 74 69 6d 65 20 * run time
14f0: 74 6f 20 64 65 74 65 72 6d 69 6e 65 20 77 68 61 to determine wha
1500: 74 20 6e 61 6d 65 73 70 61 63 65 20 74 68 65 20 t namespace the
1510: 70 72 6f 63 65 64 75 72 65 20 77 69 6c 6c 20 72 procedure will r
1520: 75 6e 20 69 6e 3b 0a 2b 20 20 20 20 20 2a 20 74 un in;.+ * t
1530: 68 65 72 65 20 69 73 20 6e 6f 20 6f 74 68 65 72 here is no other
1540: 20 75 73 65 20 6f 66 20 74 68 65 20 63 6d 64 20 use of the cmd
1550: 66 69 65 6c 64 20 6f 66 20 74 68 65 20 70 72 6f field of the pro
1560: 63 20 73 74 72 75 63 74 75 72 65 2e 0a 2b 20 20 c structure..+
1570: 20 20 20 2a 20 57 65 20 73 65 74 20 69 74 20 74 * We set it t
1580: 6f 20 4e 55 4c 4c 3b 20 69 74 20 77 69 6c 6c 20 o NULL; it will
1590: 62 65 20 73 65 74 20 62 65 66 6f 72 65 20 72 75 be set before ru
15a0: 6e 6e 69 6e 67 20 62 79 20 74 68 65 20 65 78 65 nning by the exe
15b0: 63 75 74 6f 72 0a 2b 20 20 20 20 20 2a 20 63 6f cutor.+ * co
15c0: 6d 6d 61 6e 64 20 5b 6c 61 6d 62 64 61 5d 2e 0a mmand [lambda]..
15d0: 2b 20 20 20 20 20 2a 2f 0a 2b 0a 2b 20 20 20 20 + */.+.+
15e0: 70 72 6f 63 50 74 72 2d 3e 63 6d 64 50 74 72 20 procPtr->cmdPtr
15f0: 3d 20 28 43 6f 6d 6d 61 6e 64 20 2a 29 20 4e 55 = (Command *) NU
1600: 4c 4c 3b 0a 2b 0a 2b 20 20 20 20 2f 2a 0a 2b 20 LL;.+.+ /*.+
1610: 20 20 20 20 2a 20 46 72 65 65 20 74 68 65 20 6c * Free the l
1620: 69 73 74 20 69 6e 74 65 72 6e 61 6c 72 65 70 20 ist internalrep
1630: 6f 66 20 6f 62 6a 50 74 72 20 2d 20 74 68 69 73 of objPtr - this
1640: 20 77 69 6c 6c 20 66 72 65 65 20 61 72 67 73 50 will free argsP
1650: 74 72 2c 20 62 75 74 0a 2b 20 20 20 20 20 2a 20 tr, but.+ *
1660: 62 6f 64 79 50 74 72 20 72 65 74 61 69 6e 73 20 bodyPtr retains
1670: 61 20 72 65 66 65 72 65 6e 63 65 20 66 72 6f 6d a reference from
1680: 20 74 68 65 20 50 72 6f 63 20 73 74 72 75 63 74 the Proc struct
1690: 75 72 65 2e 20 54 68 65 6e 20 66 69 6e 69 73 68 ure. Then finish
16a0: 0a 2b 20 20 20 20 20 2a 20 74 68 65 20 63 6f 6e .+ * the con
16b0: 76 65 72 73 69 6f 6e 20 74 6f 20 74 63 6c 4c 61 version to tclLa
16c0: 6d 62 64 61 54 79 70 65 2e 0a 2b 20 20 20 20 20 mbdaType..+
16d0: 2a 2f 0a 2b 0a 2b 20 20 20 20 6f 62 6a 50 74 72 */.+.+ objPtr
16e0: 2d 3e 74 79 70 65 50 74 72 2d 3e 66 72 65 65 49 ->typePtr->freeI
16f0: 6e 74 52 65 70 50 72 6f 63 28 6f 62 6a 50 74 72 ntRepProc(objPtr
1700: 29 3b 0a 2b 0a 2b 20 20 20 20 6f 62 6a 50 74 72 );.+.+ objPtr
1710: 2d 3e 69 6e 74 65 72 6e 61 6c 52 65 70 2e 74 77 ->internalRep.tw
1720: 6f 50 74 72 56 61 6c 75 65 2e 70 74 72 31 20 3d oPtrValue.ptr1 =
1730: 20 28 56 4f 49 44 20 2a 29 20 70 72 6f 63 50 74 (VOID *) procPt
1740: 72 3b 0a 2b 20 20 20 20 6f 62 6a 50 74 72 2d 3e r;.+ objPtr->
1750: 69 6e 74 65 72 6e 61 6c 52 65 70 2e 74 77 6f 50 internalRep.twoP
1760: 74 72 56 61 6c 75 65 2e 70 74 72 32 20 3d 20 4e trValue.ptr2 = N
1770: 55 4c 4c 3b 0a 2b 20 20 20 20 6f 62 6a 50 74 72 ULL;.+ objPtr
1780: 2d 3e 74 79 70 65 50 74 72 20 3d 20 26 74 63 6c ->typePtr = &tcl
1790: 4c 61 6d 62 64 61 54 79 70 65 3b 0a 2b 20 20 20 LambdaType;.+
17a0: 20 72 65 74 75 72 6e 20 54 43 4c 5f 4f 4b 3b 0a return TCL_OK;.
17b0: 2b 7d 0a 2b 0a 2b 69 6e 74 0a 2b 54 63 6c 5f 41 +}.+.+int.+Tcl_A
17c0: 70 70 6c 79 4f 62 6a 43 6d 64 28 64 75 6d 6d 79 pplyObjCmd(dummy
17d0: 2c 20 69 6e 74 65 72 70 2c 20 6f 62 6a 63 2c 20 , interp, objc,
17e0: 6f 62 6a 76 29 0a 2b 20 20 20 20 43 6c 69 65 6e objv).+ Clien
17f0: 74 44 61 74 61 20 64 75 6d 6d 79 3b 09 09 2f 2a tData dummy;../*
1800: 20 4e 6f 74 20 75 73 65 64 2e 20 2a 2f 0a 2b 20 Not used. */.+
1810: 20 20 20 54 63 6c 5f 49 6e 74 65 72 70 20 2a 69 Tcl_Interp *i
1820: 6e 74 65 72 70 3b 09 09 2f 2a 20 43 75 72 72 65 nterp;../* Curre
1830: 6e 74 20 69 6e 74 65 72 70 72 65 74 65 72 2e 20 nt interpreter.
1840: 2a 2f 0a 2b 20 20 20 20 69 6e 74 20 6f 62 6a 63 */.+ int objc
1850: 3b 09 09 09 2f 2a 20 4e 75 6d 62 65 72 20 6f 66 ;.../* Number of
1860: 20 61 72 67 75 6d 65 6e 74 73 2e 20 2a 2f 0a 2b arguments. */.+
1870: 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 43 4f 4e Tcl_Obj *CON
1880: 53 54 20 6f 62 6a 76 5b 5d 3b 09 2f 2a 20 41 72 ST objv[];./* Ar
1890: 67 75 6d 65 6e 74 20 6f 62 6a 65 63 74 73 2e 20 gument objects.
18a0: 2a 2f 0a 2b 7b 0a 2b 20 20 20 20 49 6e 74 65 72 */.+{.+ Inter
18b0: 70 20 2a 69 50 74 72 20 3d 20 28 49 6e 74 65 72 p *iPtr = (Inter
18c0: 70 20 2a 29 20 69 6e 74 65 72 70 3b 0a 2b 20 20 p *) interp;.+
18d0: 20 20 50 72 6f 63 20 2a 70 72 6f 63 50 74 72 3b Proc *procPtr;
18e0: 0a 2b 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 6c .+ Tcl_Obj *l
18f0: 61 6d 62 64 61 50 74 72 3b 0a 2b 20 20 20 20 69 ambdaPtr;.+ i
1900: 6e 74 20 72 65 73 75 6c 74 3b 0a 2b 20 20 20 20 nt result;.+
1910: 43 6f 6d 6d 61 6e 64 20 2a 6c 61 6d 62 64 61 43 Command *lambdaC
1920: 6d 64 50 74 72 3b 0a 2b 20 20 20 20 0a 2b 20 20 mdPtr;.+ .+
1930: 20 20 69 66 20 28 6f 62 6a 63 20 3c 20 32 29 20 if (objc < 2)
1940: 7b 0a 2b 09 54 63 6c 5f 57 72 6f 6e 67 4e 75 6d {.+.Tcl_WrongNum
1950: 41 72 67 73 28 69 6e 74 65 72 70 2c 20 31 2c 20 Args(interp, 1,
1960: 6f 62 6a 76 2c 20 22 6c 61 6d 62 64 61 45 78 70 objv, "lambdaExp
1970: 72 20 3f 61 72 67 31 20 61 72 67 32 20 2e 2e 2e r ?arg1 arg2 ...
1980: 3f 22 29 3b 0a 2b 09 72 65 74 75 72 6e 20 54 43 ?");.+.return TC
1990: 4c 5f 45 52 52 4f 52 3b 0a 2b 20 20 20 20 7d 0a L_ERROR;.+ }.
19a0: 2b 0a 2b 20 20 20 20 2f 2a 0a 2b 20 20 20 20 20 +.+ /*.+
19b0: 2a 20 53 65 74 20 6c 61 6d 62 64 61 50 74 72 2c * Set lambdaPtr,
19c0: 20 63 6f 6e 76 65 72 74 20 69 74 20 74 6f 20 74 convert it to t
19d0: 63 6c 4c 61 6d 62 64 61 54 79 70 65 20 69 6e 20 clLambdaType in
19e0: 74 68 65 20 63 75 72 72 65 6e 74 0a 2b 20 20 20 the current.+
19f0: 20 20 2a 20 69 6e 74 65 72 70 20 69 66 20 6e 65 * interp if ne
1a00: 63 65 73 73 61 72 79 2e 0a 2b 20 20 20 20 20 2a cessary..+ *
1a10: 2f 0a 2b 0a 2b 20 20 20 20 6c 61 6d 62 64 61 50 /.+.+ lambdaP
1a20: 74 72 20 3d 20 6f 62 6a 76 5b 31 5d 3b 0a 2b 20 tr = objv[1];.+
1a30: 20 20 20 69 66 20 28 6c 61 6d 62 64 61 50 74 72 if (lambdaPtr
1a40: 2d 3e 74 79 70 65 50 74 72 20 3d 3d 20 26 74 63 ->typePtr == &tc
1a50: 6c 4c 61 6d 62 64 61 54 79 70 65 29 20 7b 0a 2b lLambdaType) {.+
1a60: 09 70 72 6f 63 50 74 72 20 3d 20 28 50 72 6f 63 .procPtr = (Proc
1a70: 20 2a 29 20 6c 61 6d 62 64 61 50 74 72 2d 3e 69 *) lambdaPtr->i
1a80: 6e 74 65 72 6e 61 6c 52 65 70 2e 74 77 6f 50 74 nternalRep.twoPt
1a90: 72 56 61 6c 75 65 2e 70 74 72 31 3b 0a 2b 20 20 rValue.ptr1;.+
1aa0: 20 20 7d 20 65 6c 73 65 20 7b 0a 2b 09 70 72 6f } else {.+.pro
1ab0: 63 50 74 72 20 3d 20 28 50 72 6f 63 20 2a 29 20 cPtr = (Proc *)
1ac0: 4e 55 4c 4c 3b 0a 2b 20 20 20 20 7d 0a 20 0a 2b NULL;.+ }. .+
1ad0: 20 20 20 20 69 66 20 28 28 70 72 6f 63 50 74 72 if ((procPtr
1ae0: 20 3d 3d 20 4e 55 4c 4c 29 20 7c 7c 20 28 70 72 == NULL) || (pr
1af0: 6f 63 50 74 72 2d 3e 69 50 74 72 20 21 3d 20 69 ocPtr->iPtr != i
1b00: 50 74 72 29 29 20 7b 0a 2b 09 72 65 73 75 6c 74 Ptr)) {.+.result
1b10: 20 3d 20 53 65 74 4c 61 6d 62 64 61 46 72 6f 6d = SetLambdaFrom
1b20: 41 6e 79 28 69 6e 74 65 72 70 2c 20 6c 61 6d 62 Any(interp, lamb
1b30: 64 61 50 74 72 29 3b 0a 2b 09 69 66 20 28 72 65 daPtr);.+.if (re
1b40: 73 75 6c 74 20 21 3d 20 54 43 4c 5f 4f 4b 29 20 sult != TCL_OK)
1b50: 7b 0a 2b 09 20 20 20 20 72 65 74 75 72 6e 20 72 {.+. return r
1b60: 65 73 75 6c 74 3b 0a 2b 09 7d 0a 2b 09 70 72 6f esult;.+.}.+.pro
1b70: 63 50 74 72 20 3d 20 28 50 72 6f 63 20 2a 29 20 cPtr = (Proc *)
1b80: 6c 61 6d 62 64 61 50 74 72 2d 3e 69 6e 74 65 72 lambdaPtr->inter
1b90: 6e 61 6c 52 65 70 2e 74 77 6f 50 74 72 56 61 6c nalRep.twoPtrVal
1ba0: 75 65 2e 70 74 72 31 3b 0a 2b 20 20 20 20 7d 0a ue.ptr1;.+ }.
1bb0: 2b 0a 2b 20 20 20 20 2f 2a 0a 2b 20 20 20 20 20 +.+ /*.+
1bc0: 2a 20 53 65 74 20 74 68 65 20 63 6d 64 20 66 69 * Set the cmd fi
1bd0: 65 6c 64 20 6f 66 20 74 68 65 20 70 72 6f 63 20 eld of the proc
1be0: 73 74 72 75 63 74 75 72 65 20 74 6f 20 70 6f 69 structure to poi
1bf0: 6e 74 20 74 6f 20 74 68 65 0a 2b 20 20 20 20 20 nt to the.+
1c00: 2a 20 61 70 70 6c 79 20 63 6f 6d 6d 61 6e 64 3b * apply command;
1c10: 20 74 68 69 73 20 66 69 65 6c 64 20 69 73 20 6f this field is o
1c20: 6e 6c 79 20 75 73 65 64 20 74 6f 20 64 65 74 65 nly used to dete
1c30: 72 6d 69 6e 65 20 74 68 65 0a 2b 20 20 20 20 20 rmine the.+
1c40: 2a 20 6e 61 6d 65 73 70 61 63 65 20 69 6e 20 77 * namespace in w
1c50: 68 69 63 68 20 74 68 65 20 70 72 6f 63 20 77 69 hich the proc wi
1c60: 6c 6c 20 72 75 6e 2e 0a 2b 20 20 20 20 20 2a 2f ll run..+ */
1c70: 0a 2b 0a 2b 20 20 20 20 6c 61 6d 62 64 61 43 6d .+.+ lambdaCm
1c80: 64 50 74 72 20 3d 20 28 43 6f 6d 6d 61 6e 64 20 dPtr = (Command
1c90: 2a 29 20 54 63 6c 5f 47 65 74 43 6f 6d 6d 61 6e *) Tcl_GetComman
1ca0: 64 46 72 6f 6d 4f 62 6a 28 69 6e 74 65 72 70 2c dFromObj(interp,
1cb0: 20 6f 62 6a 76 5b 30 5d 29 3b 0a 2b 20 20 20 20 objv[0]);.+
1cc0: 69 66 20 28 6c 61 6d 62 64 61 43 6d 64 50 74 72 if (lambdaCmdPtr
1cd0: 20 3d 3d 20 4e 55 4c 4c 29 20 7b 0a 2b 09 2f 2a == NULL) {.+./*
1ce0: 20 46 49 58 4d 45 3a 20 65 72 72 6f 72 20 6d 65 FIXME: error me
1cf0: 73 73 61 67 65 20 2a 2f 0a 2b 09 72 65 74 75 72 ssage */.+.retur
1d00: 6e 20 54 43 4c 5f 45 52 52 4f 52 3b 0a 2b 20 20 n TCL_ERROR;.+
1d10: 20 20 7d 0a 2b 20 20 20 20 70 72 6f 63 50 74 72 }.+ procPtr
1d20: 2d 3e 63 6d 64 50 74 72 20 3d 20 6c 61 6d 62 64 ->cmdPtr = lambd
1d30: 61 43 6d 64 50 74 72 3b 0a 2b 0a 2b 20 20 20 20 aCmdPtr;.+.+
1d40: 72 65 74 75 72 6e 20 54 63 6c 4f 62 6a 49 6e 74 return TclObjInt
1d50: 65 72 70 50 72 6f 63 28 20 28 43 6c 69 65 6e 74 erpProc( (Client
1d60: 44 61 74 61 29 20 70 72 6f 63 50 74 72 2c 20 69 Data) procPtr, i
1d70: 6e 74 65 72 70 2c 20 6f 62 6a 63 2d 31 2c 20 6f nterp, objc-1, o
1d80: 62 6a 76 2b 31 29 3b 0a 2b 7d 0a bjv+1);.+}.