Attachment "290-3-20061104.diff" to
ticket [1587317fff]
added by
ecky-l
2006-11-05 00:28:21.
0000: 64 69 66 66 20 2d 75 62 72 20 74 63 6c 2e 6f 72 diff -ubr tcl.or
0010: 69 67 2f 67 65 6e 65 72 69 63 2f 74 63 6c 42 61 ig/generic/tclBa
0020: 73 69 63 2e 63 20 74 63 6c 2e 32 39 30 2f 67 65 sic.c tcl.290/ge
0030: 6e 65 72 69 63 2f 74 63 6c 42 61 73 69 63 2e 63 neric/tclBasic.c
0040: 0a 2d 2d 2d 20 74 63 6c 2e 6f 72 69 67 2f 67 65 .--- tcl.orig/ge
0050: 6e 65 72 69 63 2f 74 63 6c 42 61 73 69 63 2e 63 neric/tclBasic.c
0060: 09 53 61 74 20 4e 6f 76 20 20 34 20 30 30 3a 30 .Sat Nov 4 00:0
0070: 39 3a 33 33 20 32 30 30 36 0a 2b 2b 2b 20 74 63 9:33 2006.+++ tc
0080: 6c 2e 32 39 30 2f 67 65 6e 65 72 69 63 2f 74 63 l.290/generic/tc
0090: 6c 42 61 73 69 63 2e 63 09 53 61 74 20 4e 6f 76 lBasic.c.Sat Nov
00a0: 20 20 34 20 31 36 3a 32 34 3a 31 37 20 32 30 30 4 16:24:17 200
00b0: 36 0a 40 40 20 2d 33 39 39 2c 36 20 2b 33 39 39 6.@@ -399,6 +399
00c0: 2c 31 33 20 40 40 0a 20 20 20 20 20 69 50 74 72 ,13 @@. iPtr
00d0: 2d 3e 63 68 61 6e 4d 73 67 20 3d 20 4e 55 4c 4c ->chanMsg = NULL
00e0: 3b 0a 20 0a 20 20 20 20 20 2f 2a 0a 2b 09 20 2a ;. . /*.+. *
00f0: 20 54 49 50 20 32 39 30 3a 20 69 6e 69 74 69 61 TIP 290: initia
0100: 6c 69 7a 65 20 74 68 65 20 65 78 63 65 70 74 69 lize the excepti
0110: 6f 6e 43 6f 6d 6d 61 6e 64 20 61 6e 64 20 65 78 onCommand and ex
0120: 63 65 70 74 69 6f 6e 43 6f 6d 6d 61 6e 64 46 6c ceptionCommandFl
0130: 61 67 73 20 6d 65 6d 62 65 72 73 0a 2b 09 20 2a ags members.+. *
0140: 2f 0a 2b 09 69 50 74 72 2d 3e 65 78 63 65 70 74 /.+.iPtr->except
0150: 69 6f 6e 43 6f 6d 6d 61 6e 64 20 3d 20 4e 55 4c ionCommand = NUL
0160: 4c 3b 0a 2b 09 69 50 74 72 2d 3e 65 78 63 65 70 L;.+.iPtr->excep
0170: 74 69 6f 6e 43 6f 6d 6d 61 6e 64 46 6c 61 67 73 tionCommandFlags
0180: 20 3d 20 30 3b 0a 2b 20 20 20 20 69 50 74 72 2d = 0;.+ iPtr-
0190: 3e 63 61 74 63 68 4c 65 76 65 6c 20 3d 20 30 3b >catchLevel = 0;
01a0: 0a 2b 09 0a 2b 20 20 20 20 2f 2a 0a 20 20 20 20 .+..+ /*.
01b0: 20 20 2a 20 49 6e 69 74 69 61 6c 69 7a 65 20 74 * Initialize t
01c0: 68 65 20 63 6f 6d 70 69 6c 61 74 69 6f 6e 20 61 he compilation a
01d0: 6e 64 20 65 78 65 63 75 74 69 6f 6e 20 73 74 61 nd execution sta
01e0: 74 69 73 74 69 63 73 20 6b 65 70 74 20 66 6f 72 tistics kept for
01f0: 20 74 68 69 73 0a 20 20 20 20 20 20 2a 20 69 6e this. * in
0200: 74 65 72 70 72 65 74 65 72 2e 0a 20 20 20 20 20 terpreter..
0210: 20 2a 2f 0a 40 40 20 2d 33 35 31 39 2c 36 20 2b */.@@ -3519,6 +
0220: 33 35 32 36 2c 35 33 20 40 40 0a 20 20 20 20 20 3526,53 @@.
0230: 69 66 20 28 73 61 76 65 64 56 61 72 46 72 61 6d if (savedVarFram
0240: 65 50 74 72 29 20 7b 0a 20 09 69 50 74 72 2d 3e ePtr) {. .iPtr->
0250: 76 61 72 46 72 61 6d 65 50 74 72 20 3d 20 73 61 varFramePtr = sa
0260: 76 65 64 56 61 72 46 72 61 6d 65 50 74 72 3b 0a vedVarFramePtr;.
0270: 20 20 20 20 20 7d 0a 2b 0a 2b 20 20 20 20 2f 2a }.+.+ /*
0280: 20 0a 2b 20 20 20 20 20 2a 20 54 49 50 20 32 39 .+ * TIP 29
0290: 30 20 45 78 65 63 75 74 65 20 74 68 65 20 65 78 0 Execute the ex
02a0: 63 65 70 74 48 61 6e 64 6c 65 72 20 74 68 61 74 ceptHandler that
02b0: 20 77 61 73 20 72 65 67 69 73 74 65 72 65 64 20 was registered
02c0: 77 69 74 68 20 74 68 65 20 69 6e 74 65 72 70 2e with the interp.
02d0: 0a 2b 20 20 20 20 20 2a 0a 2b 20 20 20 20 20 2a .+ *.+ *
02e0: 20 44 6f 20 74 68 69 73 20 6f 6e 6c 79 20 69 66 Do this only if
02f0: 20 74 68 65 20 65 72 72 6f 72 20 77 61 73 20 6e the error was n
0300: 6f 74 20 74 68 72 6f 77 6e 20 61 6c 72 65 61 64 ot thrown alread
0310: 79 20 61 6e 64 20 64 65 70 65 6e 64 65 6e 64 20 y and dependend
0320: 6f 6e 20 0a 2b 20 20 20 20 20 2a 20 2d 63 61 75 on .+ * -cau
0330: 67 68 74 2f 2d 75 6e 63 61 75 67 68 74 20 28 73 ght/-uncaught (s
0340: 74 6f 72 65 64 20 69 6e 20 65 78 63 65 70 74 69 tored in excepti
0350: 6f 6e 43 6f 6d 6d 61 6e 64 46 6c 61 67 73 29 2e onCommandFlags).
0360: 0a 2b 20 20 20 20 20 2a 0a 2b 20 20 20 20 20 2a .+ *.+ *
0370: 20 54 68 65 20 72 65 74 75 72 6e 20 63 6f 64 65 The return code
0380: 20 6f 66 20 74 68 65 20 65 78 63 65 70 74 69 6f of the exceptio
0390: 6e 20 61 6e 64 20 74 68 65 20 72 65 73 75 6c 74 n and the result
03a0: 20 61 72 65 20 61 70 70 65 6e 64 65 64 20 74 6f are appended to
03b0: 20 74 68 65 0a 2b 20 20 20 20 20 2a 20 63 6f 6d the.+ * com
03c0: 6d 61 6e 64 20 62 65 66 6f 72 65 20 65 78 65 63 mand before exec
03d0: 75 74 69 6f 6e 0a 2b 20 20 20 20 20 2a 2f 0a 2b ution.+ */.+
03e0: 20 20 20 20 69 66 20 28 63 6f 64 65 20 21 3d 20 if (code !=
03f0: 54 43 4c 5f 4f 4b 20 26 26 20 69 50 74 72 2d 3e TCL_OK && iPtr->
0400: 65 78 63 65 70 74 69 6f 6e 43 6f 6d 6d 61 6e 64 exceptionCommand
0410: 20 21 3d 20 4e 55 4c 4c 20 0a 2b 20 20 20 20 20 != NULL .+
0420: 20 20 20 20 20 20 20 26 26 20 21 28 69 50 74 72 && !(iPtr
0430: 2d 3e 65 78 63 65 70 74 69 6f 6e 43 6f 6d 6d 61 ->exceptionComma
0440: 6e 64 46 6c 61 67 73 20 26 20 45 58 43 45 50 54 ndFlags & EXCEPT
0450: 43 4d 44 5f 46 49 4e 49 53 48 45 44 29 0a 2b 20 CMD_FINISHED).+
0460: 20 20 20 20 20 20 20 20 20 20 20 26 26 20 21 28 && !(
0470: 69 50 74 72 2d 3e 65 78 63 65 70 74 69 6f 6e 43 iPtr->exceptionC
0480: 6f 6d 6d 61 6e 64 46 6c 61 67 73 20 26 20 45 58 ommandFlags & EX
0490: 43 45 50 54 43 4d 44 5f 52 55 4e 4e 49 4e 47 29 CEPTCMD_RUNNING)
04a0: 29 20 7b 0a 2b 0a 2b 20 20 20 20 20 20 20 20 69 ) {.+.+ i
04b0: 6e 74 20 75 6e 63 61 74 63 68 65 64 20 3d 20 28 nt uncatched = (
04c0: 69 50 74 72 2d 3e 63 61 74 63 68 4c 65 76 65 6c iPtr->catchLevel
04d0: 20 3c 3d 20 30 20 0a 2b 20 20 20 20 20 20 20 20 <= 0 .+
04e0: 20 20 20 20 26 26 20 28 69 50 74 72 2d 3e 65 78 && (iPtr->ex
04f0: 63 65 70 74 69 6f 6e 43 6f 6d 6d 61 6e 64 46 6c ceptionCommandFl
0500: 61 67 73 20 26 20 45 58 43 45 50 54 43 4d 44 5f ags & EXCEPTCMD_
0510: 4f 4e 55 4e 43 41 55 47 48 54 29 29 3b 20 0a 2b ONUNCAUGHT)); .+
0520: 20 20 20 20 20 20 20 20 69 6e 74 20 63 61 74 63 int catc
0530: 68 65 64 20 3d 20 28 69 50 74 72 2d 3e 63 61 74 hed = (iPtr->cat
0540: 63 68 4c 65 76 65 6c 20 3e 20 30 20 0a 2b 20 20 chLevel > 0 .+
0550: 20 20 20 20 20 20 20 20 20 20 26 26 20 28 69 50 && (iP
0560: 74 72 2d 3e 65 78 63 65 70 74 69 6f 6e 43 6f 6d tr->exceptionCom
0570: 6d 61 6e 64 46 6c 61 67 73 20 26 20 45 58 43 45 mandFlags & EXCE
0580: 50 54 43 4d 44 5f 4f 4e 43 41 55 47 48 54 29 29 PTCMD_ONCAUGHT))
0590: 3b 0a 2b 20 20 20 20 20 20 20 20 69 66 20 28 75 ;.+ if (u
05a0: 6e 63 61 74 63 68 65 64 20 7c 7c 20 63 61 74 63 ncatched || catc
05b0: 68 65 64 29 20 7b 0a 2b 20 20 20 20 20 20 20 20 hed) {.+
05c0: 20 20 20 20 54 63 6c 5f 44 53 74 72 69 6e 67 20 Tcl_DString
05d0: 63 6d 64 42 75 66 3b 0a 2b 20 20 20 20 20 20 20 cmdBuf;.+
05e0: 20 20 20 20 20 69 6e 74 20 69 2c 20 63 6d 64 4c int i, cmdL
05f0: 65 6e 3b 0a 2b 20 20 20 20 20 20 20 20 20 20 20 en;.+
0600: 20 63 68 61 72 20 2a 63 6d 64 53 74 72 69 6e 67 char *cmdString
0610: 3b 0a 2b 20 20 20 20 20 20 20 20 20 20 20 20 54 ;.+ T
0620: 63 6c 5f 4f 62 6a 20 2a 65 78 63 65 70 74 43 6d cl_Obj *exceptCm
0630: 64 20 3d 20 54 63 6c 5f 44 75 70 6c 69 63 61 74 d = Tcl_Duplicat
0640: 65 4f 62 6a 28 69 50 74 72 2d 3e 65 78 63 65 70 eObj(iPtr->excep
0650: 74 69 6f 6e 43 6f 6d 6d 61 6e 64 29 3b 0a 2b 20 tionCommand);.+
0660: 20 20 20 20 20 20 20 20 20 20 20 54 63 6c 5f 4c Tcl_L
0670: 69 73 74 4f 62 6a 41 70 70 65 6e 64 45 6c 65 6d istObjAppendElem
0680: 65 6e 74 20 28 69 6e 74 65 72 70 2c 20 65 78 63 ent (interp, exc
0690: 65 70 74 43 6d 64 2c 20 54 63 6c 5f 4e 65 77 49 eptCmd, Tcl_NewI
06a0: 6e 74 4f 62 6a 28 63 6f 64 65 29 29 3b 0a 2b 20 ntObj(code));.+
06b0: 20 20 20 20 20 20 20 20 20 20 20 54 63 6c 5f 4c Tcl_L
06c0: 69 73 74 4f 62 6a 41 70 70 65 6e 64 45 6c 65 6d istObjAppendElem
06d0: 65 6e 74 20 28 69 6e 74 65 72 70 2c 20 65 78 63 ent (interp, exc
06e0: 65 70 74 43 6d 64 2c 20 54 63 6c 5f 47 65 74 4f eptCmd, Tcl_GetO
06f0: 62 6a 52 65 73 75 6c 74 28 69 6e 74 65 72 70 29 bjResult(interp)
0700: 29 3b 0a 2b 20 20 20 20 20 20 20 20 20 20 20 20 );.+
0710: 0a 2b 20 20 20 20 20 20 20 20 20 20 20 20 2f 2a .+ /*
0720: 20 4c 6f 67 20 74 68 65 20 65 72 72 6f 72 2c 20 Log the error,
0730: 73 6f 20 74 68 61 74 20 69 74 20 69 73 20 61 76 so that it is av
0740: 61 69 6c 61 62 6c 65 20 69 6e 20 74 68 65 20 68 ailable in the h
0750: 61 6e 64 6c 65 72 20 2a 2f 0a 2b 20 20 20 20 20 andler */.+
0760: 20 20 20 20 20 20 20 54 63 6c 5f 44 53 74 72 69 Tcl_DStri
0770: 6e 67 49 6e 69 74 28 26 63 6d 64 42 75 66 29 3b ngInit(&cmdBuf);
0780: 0a 2b 20 20 20 20 20 20 20 20 20 20 20 20 66 6f .+ fo
0790: 72 20 28 69 20 3d 20 30 3b 20 69 20 3c 20 6f 62 r (i = 0; i < ob
07a0: 6a 63 3b 20 69 2b 2b 29 20 7b 0a 2b 20 20 20 20 jc; i++) {.+
07b0: 20 20 20 20 20 20 20 20 20 20 20 20 54 63 6c 5f Tcl_
07c0: 44 53 74 72 69 6e 67 41 70 70 65 6e 64 45 6c 65 DStringAppendEle
07d0: 6d 65 6e 74 28 26 63 6d 64 42 75 66 2c 20 54 63 ment(&cmdBuf, Tc
07e0: 6c 5f 47 65 74 53 74 72 69 6e 67 28 6f 62 6a 76 l_GetString(objv
07f0: 5b 69 5d 29 29 3b 0a 2b 20 20 20 20 20 20 20 20 [i]));.+
0800: 20 20 20 20 7d 0a 2b 20 20 20 20 20 20 20 20 20 }.+
0810: 20 20 20 63 6d 64 53 74 72 69 6e 67 20 3d 20 54 cmdString = T
0820: 63 6c 5f 44 53 74 72 69 6e 67 56 61 6c 75 65 28 cl_DStringValue(
0830: 26 63 6d 64 42 75 66 29 3b 0a 2b 20 20 20 20 20 &cmdBuf);.+
0840: 20 20 20 20 20 20 20 63 6d 64 4c 65 6e 20 3d 20 cmdLen =
0850: 54 63 6c 5f 44 53 74 72 69 6e 67 4c 65 6e 67 74 Tcl_DStringLengt
0860: 68 28 26 63 6d 64 42 75 66 29 3b 0a 2b 20 20 20 h(&cmdBuf);.+
0870: 20 20 20 20 20 20 20 20 20 54 63 6c 5f 4c 6f 67 Tcl_Log
0880: 43 6f 6d 6d 61 6e 64 49 6e 66 6f 28 69 6e 74 65 CommandInfo(inte
0890: 72 70 2c 20 63 6d 64 53 74 72 69 6e 67 2c 20 63 rp, cmdString, c
08a0: 6d 64 53 74 72 69 6e 67 2c 20 63 6d 64 4c 65 6e mdString, cmdLen
08b0: 29 3b 0a 2b 20 20 20 20 20 20 20 20 20 20 20 20 );.+
08c0: 0a 2b 20 20 20 20 20 20 20 20 20 20 20 20 69 50 .+ iP
08d0: 74 72 2d 3e 65 78 63 65 70 74 69 6f 6e 43 6f 6d tr->exceptionCom
08e0: 6d 61 6e 64 46 6c 61 67 73 20 7c 3d 20 45 58 43 mandFlags |= EXC
08f0: 45 50 54 43 4d 44 5f 52 55 4e 4e 49 4e 47 3b 0a EPTCMD_RUNNING;.
0900: 2b 20 20 20 20 20 20 20 20 20 20 20 20 63 6f 64 + cod
0910: 65 20 3d 20 54 63 6c 5f 45 76 61 6c 4f 62 6a 28 e = Tcl_EvalObj(
0920: 69 6e 74 65 72 70 2c 20 65 78 63 65 70 74 43 6d interp, exceptCm
0930: 64 29 3b 0a 2b 20 20 20 20 20 20 20 20 20 20 20 d);.+
0940: 20 69 50 74 72 2d 3e 65 78 63 65 70 74 69 6f 6e iPtr->exception
0950: 43 6f 6d 6d 61 6e 64 46 6c 61 67 73 20 26 3d 20 CommandFlags &=
0960: 7e 45 58 43 45 50 54 43 4d 44 5f 52 55 4e 4e 49 ~EXCEPTCMD_RUNNI
0970: 4e 47 3b 0a 2b 20 20 20 20 20 20 20 20 20 20 20 NG;.+
0980: 20 69 50 74 72 2d 3e 65 78 63 65 70 74 69 6f 6e iPtr->exception
0990: 43 6f 6d 6d 61 6e 64 46 6c 61 67 73 20 7c 3d 20 CommandFlags |=
09a0: 45 58 43 45 50 54 43 4d 44 5f 46 49 4e 49 53 48 EXCEPTCMD_FINISH
09b0: 45 44 3b 0a 2b 20 20 20 20 20 20 20 20 20 20 20 ED;.+
09c0: 20 0a 2b 20 20 20 20 20 20 20 20 20 20 20 20 69 .+ i
09d0: 66 20 28 63 6d 64 4c 65 6e 20 21 3d 20 30 29 20 f (cmdLen != 0)
09e0: 7b 0a 2b 20 20 20 20 20 20 20 20 20 20 20 20 20 {.+
09f0: 20 20 20 54 63 6c 5f 44 53 74 72 69 6e 67 46 72 Tcl_DStringFr
0a00: 65 65 28 26 63 6d 64 42 75 66 29 3b 0a 2b 20 20 ee(&cmdBuf);.+
0a10: 20 20 20 20 20 20 20 20 20 20 7d 0a 2b 20 20 20 }.+
0a20: 20 20 20 20 20 20 20 20 20 0a 2b 20 20 20 20 20 .+
0a30: 20 20 20 7d 0a 2b 20 20 20 20 7d 0a 2b 0a 20 20 }.+ }.+.
0a40: 20 20 20 72 65 74 75 72 6e 20 63 6f 64 65 3b 0a return code;.
0a50: 20 7d 0a 20 0c 0a 64 69 66 66 20 2d 75 62 72 20 }. ..diff -ubr
0a60: 74 63 6c 2e 6f 72 69 67 2f 67 65 6e 65 72 69 63 tcl.orig/generic
0a70: 2f 74 63 6c 43 6d 64 41 48 2e 63 20 74 63 6c 2e /tclCmdAH.c tcl.
0a80: 32 39 30 2f 67 65 6e 65 72 69 63 2f 74 63 6c 43 290/generic/tclC
0a90: 6d 64 41 48 2e 63 0a 2d 2d 2d 20 74 63 6c 2e 6f mdAH.c.--- tcl.o
0aa0: 72 69 67 2f 67 65 6e 65 72 69 63 2f 74 63 6c 43 rig/generic/tclC
0ab0: 6d 64 41 48 2e 63 09 54 68 75 20 4e 6f 76 20 20 mdAH.c.Thu Nov
0ac0: 32 20 31 36 3a 35 37 3a 35 34 20 32 30 30 36 0a 2 16:57:54 2006.
0ad0: 2b 2b 2b 20 74 63 6c 2e 32 39 30 2f 67 65 6e 65 +++ tcl.290/gene
0ae0: 72 69 63 2f 74 63 6c 43 6d 64 41 48 2e 63 09 53 ric/tclCmdAH.c.S
0af0: 61 74 20 4e 6f 76 20 20 34 20 31 33 3a 31 33 3a at Nov 4 13:13:
0b00: 35 30 20 32 30 30 36 0a 40 40 20 2d 32 32 39 2c 50 2006.@@ -229,
0b10: 36 20 2b 32 32 39 2c 37 20 40 40 0a 20 7b 0a 20 6 +229,7 @@. {.
0b20: 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 76 61 72 Tcl_Obj *var
0b30: 4e 61 6d 65 50 74 72 20 3d 20 4e 55 4c 4c 3b 0a NamePtr = NULL;.
0b40: 20 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a 6f 70 Tcl_Obj *op
0b50: 74 69 6f 6e 56 61 72 4e 61 6d 65 50 74 72 20 3d tionVarNamePtr =
0b60: 20 4e 55 4c 4c 3b 0a 2b 20 20 20 20 49 6e 74 65 NULL;.+ Inte
0b70: 72 70 20 2a 69 50 74 72 20 3d 20 28 49 6e 74 65 rp *iPtr = (Inte
0b80: 72 70 2a 29 69 6e 74 65 72 70 3b 0a 20 20 20 20 rp*)interp;.
0b90: 20 69 6e 74 20 72 65 73 75 6c 74 3b 0a 20 0a 20 int result;. .
0ba0: 20 20 20 20 69 66 20 28 28 6f 62 6a 63 20 3c 20 if ((objc <
0bb0: 32 29 20 7c 7c 20 28 6f 62 6a 63 20 3e 20 34 29 2) || (objc > 4)
0bc0: 29 20 7b 0a 40 40 20 2d 32 34 34 2c 37 20 2b 32 ) {.@@ -244,7 +2
0bd0: 34 35 2c 39 20 40 40 0a 20 09 6f 70 74 69 6f 6e 45,9 @@. .option
0be0: 56 61 72 4e 61 6d 65 50 74 72 20 3d 20 6f 62 6a VarNamePtr = obj
0bf0: 76 5b 33 5d 3b 0a 20 20 20 20 20 7d 0a 20 0a 2b v[3];. }. .+
0c00: 20 20 20 20 69 50 74 72 2d 3e 63 61 74 63 68 4c iPtr->catchL
0c10: 65 76 65 6c 2b 2b 3b 0a 20 20 20 20 20 72 65 73 evel++;. res
0c20: 75 6c 74 20 3d 20 54 63 6c 5f 45 76 61 6c 4f 62 ult = Tcl_EvalOb
0c30: 6a 45 78 28 69 6e 74 65 72 70 2c 20 6f 62 6a 76 jEx(interp, objv
0c40: 5b 31 5d 2c 20 30 29 3b 0a 2b 20 20 20 20 69 50 [1], 0);.+ iP
0c50: 74 72 2d 3e 63 61 74 63 68 4c 65 76 65 6c 2d 2d tr->catchLevel--
0c60: 3b 0a 20 0a 20 20 20 20 20 2f 2a 0a 20 20 20 20 ;. . /*.
0c70: 20 20 2a 20 57 65 20 64 69 73 61 62 6c 65 20 63 * We disable c
0c80: 61 74 63 68 20 69 6e 20 69 6e 74 65 72 70 72 65 atch in interpre
0c90: 74 65 72 73 20 77 68 65 72 65 20 74 68 65 20 6c ters where the l
0ca0: 69 6d 69 74 20 68 61 73 20 62 65 65 6e 20 65 78 imit has been ex
0cb0: 63 65 65 64 65 64 2e 0a 64 69 66 66 20 2d 75 62 ceeded..diff -ub
0cc0: 72 20 74 63 6c 2e 6f 72 69 67 2f 67 65 6e 65 72 r tcl.orig/gener
0cd0: 69 63 2f 74 63 6c 45 76 65 6e 74 2e 63 20 74 63 ic/tclEvent.c tc
0ce0: 6c 2e 32 39 30 2f 67 65 6e 65 72 69 63 2f 74 63 l.290/generic/tc
0cf0: 6c 45 76 65 6e 74 2e 63 0a 2d 2d 2d 20 74 63 6c lEvent.c.--- tcl
0d00: 2e 6f 72 69 67 2f 67 65 6e 65 72 69 63 2f 74 63 .orig/generic/tc
0d10: 6c 45 76 65 6e 74 2e 63 09 54 75 65 20 53 65 70 lEvent.c.Tue Sep
0d20: 20 31 39 20 32 32 3a 30 37 3a 33 34 20 32 30 30 19 22:07:34 200
0d30: 36 0a 2b 2b 2b 20 74 63 6c 2e 32 39 30 2f 67 65 6.+++ tcl.290/ge
0d40: 6e 65 72 69 63 2f 74 63 6c 45 76 65 6e 74 2e 63 neric/tclEvent.c
0d50: 09 53 61 74 20 4e 6f 76 20 20 34 20 31 36 3a 30 .Sat Nov 4 16:0
0d60: 37 3a 33 34 20 32 30 30 36 0a 40 40 20 2d 33 38 7:34 2006.@@ -38
0d70: 30 2c 36 20 2b 33 38 30 2c 37 20 40 40 0a 20 20 0,6 +380,7 @@.
0d80: 20 20 20 72 65 74 75 72 6e 20 63 6f 64 65 3b 0a return code;.
0d90: 20 7d 0a 20 0c 0a 2b 0a 20 2f 2a 0a 20 20 2a 2d }. ..+. /*. *-
0da0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0db0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0dc0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0dd0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0de0: 2d 2d 2d 2d 2d 0a 20 20 2a 0a 64 69 66 66 20 2d -----. *.diff -
0df0: 75 62 72 20 74 63 6c 2e 6f 72 69 67 2f 67 65 6e ubr tcl.orig/gen
0e00: 65 72 69 63 2f 74 63 6c 45 78 65 63 75 74 65 2e eric/tclExecute.
0e10: 63 20 74 63 6c 2e 32 39 30 2f 67 65 6e 65 72 69 c tcl.290/generi
0e20: 63 2f 74 63 6c 45 78 65 63 75 74 65 2e 63 0a 2d c/tclExecute.c.-
0e30: 2d 2d 20 74 63 6c 2e 6f 72 69 67 2f 67 65 6e 65 -- tcl.orig/gene
0e40: 72 69 63 2f 74 63 6c 45 78 65 63 75 74 65 2e 63 ric/tclExecute.c
0e50: 09 54 68 75 20 4e 6f 76 20 20 32 20 31 35 3a 35 .Thu Nov 2 15:5
0e60: 38 3a 30 38 20 32 30 30 36 0a 2b 2b 2b 20 74 63 8:08 2006.+++ tc
0e70: 6c 2e 32 39 30 2f 67 65 6e 65 72 69 63 2f 74 63 l.290/generic/tc
0e80: 6c 45 78 65 63 75 74 65 2e 63 09 53 61 74 20 4e lExecute.c.Sat N
0e90: 6f 76 20 20 34 20 31 36 3a 31 32 3a 32 35 20 32 ov 4 16:12:25 2
0ea0: 30 30 36 0a 40 40 20 2d 31 38 33 2c 31 34 20 2b 006.@@ -183,14 +
0eb0: 31 38 33 2c 31 39 20 40 40 0a 20 20 2a 20 70 61 183,19 @@. * pa
0ec0: 69 72 20 6d 75 73 74 20 73 75 72 72 6f 75 6e 64 ir must surround
0ed0: 20 61 6e 79 20 63 61 6c 6c 20 69 6e 73 69 64 65 any call inside
0ee0: 20 54 63 6c 45 78 65 63 75 74 65 42 79 74 65 43 TclExecuteByteC
0ef0: 6f 64 65 20 28 61 6e 64 20 61 20 66 65 77 20 6f ode (and a few o
0f00: 74 68 65 72 0a 20 20 2a 20 70 72 6f 63 65 64 75 ther. * procedu
0f10: 72 65 73 20 74 68 61 74 20 75 73 65 20 74 68 69 res that use thi
0f20: 73 20 73 63 68 65 6d 65 29 20 74 68 61 74 20 63 s scheme) that c
0f30: 6f 75 6c 64 20 72 65 73 75 6c 74 20 69 6e 20 61 ould result in a
0f40: 20 72 65 63 75 72 73 69 76 65 20 63 61 6c 6c 0a recursive call.
0f50: 20 20 2a 20 74 6f 20 54 63 6c 45 78 65 63 75 74 * to TclExecut
0f60: 65 42 79 74 65 43 6f 64 65 2e 0a 2b 20 2a 20 0a eByteCode..+ * .
0f70: 2b 20 2a 20 54 49 50 20 32 39 30 3a 20 6b 65 65 + * TIP 290: kee
0f80: 70 20 74 68 65 20 63 61 74 63 68 20 6c 65 76 65 p the catch leve
0f90: 6c 20 69 66 20 6e 65 63 65 73 73 61 72 79 0a 20 l if necessary.
0fa0: 20 2a 2f 0a 20 0a 20 23 64 65 66 69 6e 65 20 43 */. . #define C
0fb0: 41 43 48 45 5f 53 54 41 43 4b 5f 49 4e 46 4f 28 ACHE_STACK_INFO(
0fc0: 29 20 5c 0a 2d 20 20 20 20 74 6f 73 50 74 72 20 ) \.- tosPtr
0fd0: 3d 20 65 65 50 74 72 2d 3e 74 6f 73 50 74 72 0a = eePtr->tosPtr.
0fe0: 2b 20 20 20 20 74 6f 73 50 74 72 20 3d 20 65 65 + tosPtr = ee
0ff0: 50 74 72 2d 3e 74 6f 73 50 74 72 3b 5c 0a 2b 20 Ptr->tosPtr;\.+
1000: 20 20 20 69 66 20 28 63 61 74 63 68 54 6f 70 20 if (catchTop
1010: 21 3d 20 69 6e 69 74 43 61 74 63 68 54 6f 70 29 != initCatchTop)
1020: 20 69 50 74 72 2d 3e 63 61 74 63 68 4c 65 76 65 iPtr->catchLeve
1030: 6c 2d 2d 0a 20 0a 20 23 64 65 66 69 6e 65 20 44 l--. . #define D
1040: 45 43 41 43 48 45 5f 53 54 41 43 4b 5f 49 4e 46 ECACHE_STACK_INF
1050: 4f 28 29 20 5c 0a 20 20 20 20 20 65 65 50 74 72 O() \. eePtr
1060: 2d 3e 74 6f 73 50 74 72 20 3d 20 74 6f 73 50 74 ->tosPtr = tosPt
1070: 72 3b 5c 0a 2d 20 20 20 20 63 68 65 63 6b 49 6e r;\.- checkIn
1080: 74 65 72 70 20 3d 20 31 0a 2b 20 20 20 20 63 68 terp = 1.+ ch
1090: 65 63 6b 49 6e 74 65 72 70 20 3d 20 31 3b 5c 0a eckInterp = 1;\.
10a0: 2b 20 20 20 20 69 66 20 28 63 61 74 63 68 54 6f + if (catchTo
10b0: 70 20 21 3d 20 69 6e 69 74 43 61 74 63 68 54 6f p != initCatchTo
10c0: 70 29 20 69 50 74 72 2d 3e 63 61 74 63 68 4c 65 p) iPtr->catchLe
10d0: 76 65 6c 2b 2b 0a 2b 20 20 20 20 0a 20 0a 20 0a vel++.+ . . .
10e0: 20 2f 2a 0a 40 40 20 2d 31 37 39 34 2c 36 20 2b /*.@@ -1794,6 +
10f0: 31 37 39 39 2c 31 33 20 40 40 0a 20 09 20 20 20 1799,13 @@. .
1100: 20 2f 2a 54 63 6c 5f 52 65 73 65 74 52 65 73 75 /*Tcl_ResetResu
1110: 6c 74 28 69 6e 74 65 72 70 29 3b 2a 2f 0a 20 09 lt(interp);*/. .
1120: 20 20 20 20 72 65 73 75 6c 74 20 3d 20 54 63 6c result = Tcl
1130: 45 76 61 6c 4f 62 6a 76 49 6e 74 65 72 6e 61 6c EvalObjvInternal
1140: 28 69 6e 74 65 72 70 2c 20 6f 62 6a 63 2c 20 6f (interp, objc, o
1150: 62 6a 76 2c 20 62 79 74 65 73 2c 20 6c 65 6e 67 bjv, bytes, leng
1160: 74 68 2c 20 30 29 3b 0a 20 09 20 20 20 20 43 41 th, 0);. . CA
1170: 43 48 45 5f 53 54 41 43 4b 5f 49 4e 46 4f 28 29 CHE_STACK_INFO()
1180: 3b 0a 2b 0a 2b 09 20 20 20 20 2f 2a 0a 2b 20 20 ;.+.+. /*.+
1190: 20 20 20 20 20 20 20 2a 20 54 49 50 20 32 39 30 * TIP 290
11a0: 3a 20 72 65 73 65 74 20 74 68 65 20 45 58 43 45 : reset the EXCE
11b0: 50 54 43 4d 44 5f 46 49 4e 49 53 48 45 44 20 66 PTCMD_FINISHED f
11c0: 6c 61 67 20 74 68 65 20 74 6f 70 20 6f 66 20 63 lag the top of c
11d0: 61 74 63 68 20 73 74 61 63 6b 0a 2b 20 20 20 20 atch stack.+
11e0: 20 20 20 20 20 2a 2f 0a 2b 20 20 20 20 20 20 20 */.+
11f0: 20 69 66 20 28 63 61 74 63 68 54 6f 70 20 3c 20 if (catchTop <
1200: 30 29 20 7b 0a 2b 20 20 20 20 20 20 20 20 20 20 0) {.+
1210: 20 20 69 50 74 72 2d 3e 65 78 63 65 70 74 69 6f iPtr->exceptio
1220: 6e 43 6f 6d 6d 61 6e 64 46 6c 61 67 73 20 26 3d nCommandFlags &=
1230: 20 7e 45 58 43 45 50 54 43 4d 44 5f 46 49 4e 49 ~EXCEPTCMD_FINI
1240: 53 48 45 44 3b 0a 2b 20 20 20 20 20 20 20 20 7d SHED;.+ }
1250: 0a 20 0a 20 09 20 20 20 20 2f 2a 0a 20 09 20 20 . . . /*. .
1260: 20 20 20 2a 20 49 66 20 74 68 65 20 6f 6c 64 20 * If the old
1270: 73 74 61 63 6b 20 69 73 20 67 6f 69 6e 67 20 74 stack is going t
1280: 6f 20 62 65 20 72 65 6c 65 61 73 65 64 2c 20 69 o be released, i
1290: 74 20 69 73 20 73 61 66 65 20 74 6f 20 64 6f 20 t is safe to do
12a0: 73 6f 0a 64 69 66 66 20 2d 75 62 72 20 74 63 6c so.diff -ubr tcl
12b0: 2e 6f 72 69 67 2f 67 65 6e 65 72 69 63 2f 74 63 .orig/generic/tc
12c0: 6c 49 6e 74 2e 68 20 74 63 6c 2e 32 39 30 2f 67 lInt.h tcl.290/g
12d0: 65 6e 65 72 69 63 2f 74 63 6c 49 6e 74 2e 68 0a eneric/tclInt.h.
12e0: 2d 2d 2d 20 74 63 6c 2e 6f 72 69 67 2f 67 65 6e --- tcl.orig/gen
12f0: 65 72 69 63 2f 74 63 6c 49 6e 74 2e 68 09 54 68 eric/tclInt.h.Th
1300: 75 20 4e 6f 76 20 20 32 20 31 36 3a 35 37 3a 35 u Nov 2 16:57:5
1310: 34 20 32 30 30 36 0a 2b 2b 2b 20 74 63 6c 2e 32 4 2006.+++ tcl.2
1320: 39 30 2f 67 65 6e 65 72 69 63 2f 74 63 6c 49 6e 90/generic/tclIn
1330: 74 2e 68 09 53 61 74 20 4e 6f 76 20 20 34 20 31 t.h.Sat Nov 4 1
1340: 36 3a 30 39 3a 34 33 20 32 30 30 36 0a 40 40 20 6:09:43 2006.@@
1350: 2d 31 32 38 35 2c 36 20 2b 31 32 38 35 2c 31 34 -1285,6 +1285,14
1360: 20 40 40 0a 20 7d 3b 0a 20 0a 20 2f 2a 0a 2b 20 @@. };. . /*.+
1370: 2a 20 54 49 50 20 32 39 30 20 46 6c 61 67 73 20 * TIP 290 Flags
1380: 66 6f 72 20 72 75 6e 6e 69 6e 67 20 61 6e 20 65 for running an e
1390: 78 63 65 70 74 69 6f 6e 20 63 6f 6d 6d 61 6e 64 xception command
13a0: 0a 2b 20 2a 2f 20 0a 2b 23 64 65 66 69 6e 65 20 .+ */ .+#define
13b0: 45 58 43 45 50 54 43 4d 44 5f 4f 4e 43 41 55 47 EXCEPTCMD_ONCAUG
13c0: 48 54 20 20 20 20 20 20 31 20 2f 2a 20 52 75 6e HT 1 /* Run
13d0: 20 74 68 65 20 63 6f 6d 6d 61 6e 64 20 6f 6e 20 the command on
13e0: 63 61 75 67 68 74 20 65 78 63 65 70 74 69 6f 6e caught exception
13f0: 73 20 2a 2f 0a 2b 23 64 65 66 69 6e 65 20 45 58 s */.+#define EX
1400: 43 45 50 54 43 4d 44 5f 4f 4e 55 4e 43 41 55 47 CEPTCMD_ONUNCAUG
1410: 48 54 20 20 20 20 32 20 2f 2a 20 52 75 6e 20 74 HT 2 /* Run t
1420: 68 65 20 63 6f 6d 6d 61 6e 64 20 6f 6e 20 75 6e he command on un
1430: 63 61 75 67 68 74 20 65 78 63 65 70 74 69 6f 6e caught exception
1440: 73 20 2a 2f 0a 2b 23 64 65 66 69 6e 65 20 45 58 s */.+#define EX
1450: 43 45 50 54 43 4d 44 5f 46 49 4e 49 53 48 45 44 CEPTCMD_FINISHED
1460: 20 20 20 20 34 20 2f 2a 20 69 6e 64 69 63 61 74 4 /* indicat
1470: 65 73 20 74 68 61 74 20 74 68 65 20 63 6f 6d 6d es that the comm
1480: 61 6e 64 20 68 61 73 20 62 65 65 6e 20 72 75 6e and has been run
1490: 20 66 6f 72 20 61 20 70 61 72 74 69 63 75 6c 61 for a particula
14a0: 72 20 65 78 63 65 70 74 69 6f 6e 20 2a 2f 0a 2b r exception */.+
14b0: 23 64 65 66 69 6e 65 20 45 58 43 45 50 54 43 4d #define EXCEPTCM
14c0: 44 5f 52 55 4e 4e 49 4e 47 20 20 20 20 20 38 20 D_RUNNING 8
14d0: 2f 2a 20 69 6e 64 69 63 61 74 65 73 20 74 68 61 /* indicates tha
14e0: 74 20 74 68 65 20 65 78 63 65 70 74 69 6f 6e 20 t the exception
14f0: 63 6f 6d 6d 61 6e 64 20 69 73 20 63 75 72 72 65 command is curre
1500: 6e 74 6c 79 20 72 75 6e 6e 69 6e 67 20 2a 2f 0a ntly running */.
1510: 2b 0a 2b 2f 2a 0a 20 20 2a 2d 2d 2d 2d 2d 2d 2d +.+/*. *-------
1520: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
1530: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
1540: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
1550: 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 20 20 2a 20 54 68 ---------. * Th
1560: 69 73 20 73 74 72 75 63 74 75 72 65 20 64 65 66 is structure def
1570: 69 6e 65 73 20 61 6e 20 69 6e 74 65 72 70 72 65 ines an interpre
1580: 74 65 72 2c 20 77 68 69 63 68 20 69 73 20 61 20 ter, which is a
1590: 63 6f 6c 6c 65 63 74 69 6f 6e 20 6f 66 20 63 6f collection of co
15a0: 6d 6d 61 6e 64 73 0a 20 20 2a 20 70 6c 75 73 20 mmands. * plus
15b0: 6f 74 68 65 72 20 73 74 61 74 65 20 69 6e 66 6f other state info
15c0: 72 6d 61 74 69 6f 6e 20 72 65 6c 61 74 65 64 20 rmation related
15d0: 74 6f 20 69 6e 74 65 72 70 72 65 74 69 6e 67 20 to interpreting
15e0: 63 6f 6d 6d 61 6e 64 73 2c 20 73 75 63 68 20 61 commands, such a
15f0: 73 0a 40 40 20 2d 31 32 39 32 2c 37 20 2b 31 33 s.@@ -1292,7 +13
1600: 30 30 2c 36 20 40 40 0a 20 20 2a 20 74 63 6c 42 00,6 @@. * tclB
1610: 61 73 69 63 2e 63 2c 20 62 75 74 20 61 6c 6d 6f asic.c, but almo
1620: 73 74 20 65 76 65 72 79 20 54 63 6c 20 73 6f 75 st every Tcl sou
1630: 72 63 65 20 66 69 6c 65 20 75 73 65 73 20 73 6f rce file uses so
1640: 6d 65 74 68 69 6e 67 20 69 6e 20 68 65 72 65 2e mething in here.
1650: 0a 20 20 2a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d . *------------
1660: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
1670: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
1680: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
1690: 2d 2d 2d 2d 0a 20 20 2a 2f 0a 2d 0a 20 74 79 70 ----. */.-. typ
16a0: 65 64 65 66 20 73 74 72 75 63 74 20 49 6e 74 65 edef struct Inte
16b0: 72 70 20 7b 0a 20 20 20 20 20 2f 2a 0a 20 20 20 rp {. /*.
16c0: 20 20 20 2a 20 4e 6f 74 65 3a 20 74 68 65 20 66 * Note: the f
16d0: 69 72 73 74 20 74 68 72 65 65 20 66 69 65 6c 64 irst three field
16e0: 73 20 6d 75 73 74 20 6d 61 74 63 68 20 65 78 61 s must match exa
16f0: 63 74 6c 79 20 74 68 65 20 66 69 65 6c 64 73 20 ctly the fields
1700: 69 6e 20 61 0a 40 40 20 2d 31 35 35 35 2c 36 20 in a.@@ -1555,6
1710: 2b 31 35 36 32 2c 31 35 20 40 40 0a 20 20 20 20 +1562,15 @@.
1720: 20 42 79 74 65 43 6f 64 65 53 74 61 74 73 20 73 ByteCodeStats s
1730: 74 61 74 73 3b 09 2f 2a 20 48 6f 6c 64 73 20 63 tats;./* Holds c
1740: 6f 6d 70 69 6c 61 74 69 6f 6e 20 61 6e 64 20 65 ompilation and e
1750: 78 65 63 75 74 69 6f 6e 20 73 74 61 74 69 73 74 xecution statist
1760: 69 63 73 0a 20 09 09 09 09 20 2a 20 66 6f 72 20 ics. .... * for
1770: 74 68 69 73 20 69 6e 74 65 72 70 72 65 74 65 72 this interpreter
1780: 2e 20 2a 2f 0a 20 23 65 6e 64 69 66 20 2f 2a 20 . */. #endif /*
1790: 54 43 4c 5f 43 4f 4d 50 49 4c 45 5f 53 54 41 54 TCL_COMPILE_STAT
17a0: 53 20 2a 2f 0a 2b 0a 2b 09 54 63 6c 5f 4f 62 6a S */.+.+.Tcl_Obj
17b0: 2a 20 65 78 63 65 70 74 69 6f 6e 43 6f 6d 6d 61 * exceptionComma
17c0: 6e 64 3b 20 2f 2a 20 41 20 73 63 72 69 70 74 20 nd; /* A script
17d0: 74 68 61 74 20 69 73 20 65 78 65 63 75 74 65 64 that is executed
17e0: 20 6f 6e 20 65 72 72 6f 72 73 20 2a 2f 0a 2b 09 on errors */.+.
17f0: 69 6e 74 20 65 78 63 65 70 74 69 6f 6e 43 6f 6d int exceptionCom
1800: 6d 61 6e 64 46 6c 61 67 73 3b 20 2f 2a 20 46 6c mandFlags; /* Fl
1810: 61 67 73 20 66 6f 72 20 65 78 65 63 75 74 69 6e ags for executin
1820: 67 20 74 68 65 20 45 72 72 6f 72 20 53 63 72 69 g the Error Scri
1830: 70 74 2e 20 2a 2f 0a 2b 20 20 20 20 69 6e 74 20 pt. */.+ int
1840: 63 61 74 63 68 4c 65 76 65 6c 3b 20 2f 2a 20 4c catchLevel; /* L
1850: 65 76 65 6c 20 6f 66 20 5b 63 61 74 63 68 5d 20 evel of [catch]
1860: 63 6f 6d 6d 61 6e 64 73 20 2e 20 49 73 20 69 6e commands . Is in
1870: 63 72 65 6d 65 6e 74 65 64 20 0a 2b 20 20 20 20 cremented .+
1880: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1890: 20 20 20 20 20 20 20 20 20 2a 20 6f 6e 20 65 61 * on ea
18a0: 63 68 20 65 6e 63 6f 75 6e 74 65 72 65 64 20 5b ch encountered [
18b0: 63 61 74 63 68 5d 2e 20 49 66 20 69 74 20 69 73 catch]. If it is
18c0: 20 67 72 65 61 74 65 72 0a 2b 20 20 20 20 20 20 greater.+
18d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
18e0: 20 20 20 20 20 20 20 2a 20 74 68 61 6e 20 30 20 * than 0
18f0: 64 75 72 69 6e 67 20 61 6e 20 65 72 72 6f 72 20 during an error
1900: 69 73 20 74 68 72 6f 77 6e 20 74 68 69 73 20 6d is thrown this m
1910: 65 61 6e 73 20 74 68 61 74 0a 2b 20 20 20 20 20 eans that.+
1920: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1930: 20 20 20 20 20 20 20 20 2a 20 74 68 65 20 65 72 * the er
1940: 72 6f 72 20 77 61 73 20 63 61 74 63 68 65 64 20 ror was catched
1950: 65 6c 73 65 77 68 65 72 65 2e 20 57 65 20 63 61 elsewhere. We ca
1960: 6e 20 72 65 61 63 74 0a 2b 20 20 20 20 20 20 20 n react.+
1970: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
1980: 20 20 20 20 20 20 2a 20 61 63 63 6f 72 64 69 6e * accordin
1990: 67 6c 79 0a 2b 20 20 20 20 20 20 20 20 20 20 20 gly.+
19a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
19b0: 20 20 2a 2f 0a 20 7d 20 49 6e 74 65 72 70 3b 0a */. } Interp;.
19c0: 20 0a 20 2f 2a 0a 64 69 66 66 20 2d 75 62 72 20 . /*.diff -ubr
19d0: 74 63 6c 2e 6f 72 69 67 2f 67 65 6e 65 72 69 63 tcl.orig/generic
19e0: 2f 74 63 6c 54 72 61 63 65 2e 63 20 74 63 6c 2e /tclTrace.c tcl.
19f0: 32 39 30 2f 67 65 6e 65 72 69 63 2f 74 63 6c 54 290/generic/tclT
1a00: 72 61 63 65 2e 63 0a 2d 2d 2d 20 74 63 6c 2e 6f race.c.--- tcl.o
1a10: 72 69 67 2f 67 65 6e 65 72 69 63 2f 74 63 6c 54 rig/generic/tclT
1a20: 72 61 63 65 2e 63 09 4d 6f 6e 20 4f 63 74 20 32 race.c.Mon Oct 2
1a30: 33 20 32 31 3a 33 36 3a 35 35 20 32 30 30 36 0a 3 21:36:55 2006.
1a40: 2b 2b 2b 20 74 63 6c 2e 32 39 30 2f 67 65 6e 65 +++ tcl.290/gene
1a50: 72 69 63 2f 74 63 6c 54 72 61 63 65 2e 63 09 53 ric/tclTrace.c.S
1a60: 61 74 20 4e 6f 76 20 20 34 20 31 36 3a 32 38 3a at Nov 4 16:28:
1a70: 32 35 20 32 30 30 36 0a 40 40 20 2d 31 30 31 2c 25 2006.@@ -101,
1a80: 36 20 2b 31 30 31 2c 37 20 40 40 0a 20 73 74 61 6 +101,7 @@. sta
1a90: 74 69 63 20 54 63 6c 5f 54 72 61 63 65 54 79 70 tic Tcl_TraceTyp
1aa0: 65 4f 62 6a 43 6d 64 20 54 72 61 63 65 56 61 72 eObjCmd TraceVar
1ab0: 69 61 62 6c 65 4f 62 6a 43 6d 64 3b 0a 20 73 74 iableObjCmd;. st
1ac0: 61 74 69 63 20 54 63 6c 5f 54 72 61 63 65 54 79 atic Tcl_TraceTy
1ad0: 70 65 4f 62 6a 43 6d 64 20 54 72 61 63 65 43 6f peObjCmd TraceCo
1ae0: 6d 6d 61 6e 64 4f 62 6a 43 6d 64 3b 0a 20 73 74 mmandObjCmd;. st
1af0: 61 74 69 63 20 54 63 6c 5f 54 72 61 63 65 54 79 atic Tcl_TraceTy
1b00: 70 65 4f 62 6a 43 6d 64 20 54 72 61 63 65 45 78 peObjCmd TraceEx
1b10: 65 63 75 74 69 6f 6e 4f 62 6a 43 6d 64 3b 0a 2b ecutionObjCmd;.+
1b20: 73 74 61 74 69 63 20 54 63 6c 5f 54 72 61 63 65 static Tcl_Trace
1b30: 54 79 70 65 4f 62 6a 43 6d 64 20 54 72 61 63 65 TypeObjCmd Trace
1b40: 45 78 63 65 70 74 69 6f 6e 4f 62 6a 43 6d 64 3b ExceptionObjCmd;
1b50: 0a 20 0a 20 2f 2a 0a 20 20 2a 20 45 61 63 68 20 . . /*. * Each
1b60: 73 75 62 63 6f 6d 6d 61 6e 64 20 68 61 73 20 61 subcommand has a
1b70: 20 6e 75 6d 62 65 72 20 6f 66 20 27 74 79 70 65 number of 'type
1b80: 73 27 20 74 6f 20 77 68 69 63 68 20 69 74 20 63 s' to which it c
1b90: 61 6e 20 61 70 70 6c 79 2e 20 43 75 72 72 65 6e an apply. Curren
1ba0: 74 6c 79 0a 40 40 20 2d 31 31 30 2c 31 32 20 2b tly.@@ -110,12 +
1bb0: 31 31 31 2c 31 33 20 40 40 0a 20 20 2a 2f 0a 20 111,13 @@. */.
1bc0: 0a 20 73 74 61 74 69 63 20 43 4f 4e 53 54 20 63 . static CONST c
1bd0: 68 61 72 20 2a 74 72 61 63 65 54 79 70 65 4f 70 har *traceTypeOp
1be0: 74 69 6f 6e 73 5b 5d 20 3d 20 7b 0a 2d 20 20 20 tions[] = {.-
1bf0: 20 22 65 78 65 63 75 74 69 6f 6e 22 2c 20 22 63 "execution", "c
1c00: 6f 6d 6d 61 6e 64 22 2c 20 22 76 61 72 69 61 62 ommand", "variab
1c10: 6c 65 22 2c 20 4e 55 4c 4c 0a 2b 20 20 20 20 22 le", NULL.+ "
1c20: 65 78 65 63 75 74 69 6f 6e 22 2c 20 22 63 6f 6d execution", "com
1c30: 6d 61 6e 64 22 2c 20 22 76 61 72 69 61 62 6c 65 mand", "variable
1c40: 22 2c 20 22 65 78 63 65 70 74 69 6f 6e 22 2c 20 ", "exception",
1c50: 4e 55 4c 4c 0a 20 7d 3b 0a 20 73 74 61 74 69 63 NULL. };. static
1c60: 20 54 63 6c 5f 54 72 61 63 65 54 79 70 65 4f 62 Tcl_TraceTypeOb
1c70: 6a 43 6d 64 20 2a 74 72 61 63 65 53 75 62 43 6d jCmd *traceSubCm
1c80: 64 73 5b 5d 20 3d 20 7b 0a 20 20 20 20 20 54 72 ds[] = {. Tr
1c90: 61 63 65 45 78 65 63 75 74 69 6f 6e 4f 62 6a 43 aceExecutionObjC
1ca0: 6d 64 2c 0a 20 20 20 20 20 54 72 61 63 65 43 6f md,. TraceCo
1cb0: 6d 6d 61 6e 64 4f 62 6a 43 6d 64 2c 0a 20 20 20 mmandObjCmd,.
1cc0: 20 20 54 72 61 63 65 56 61 72 69 61 62 6c 65 4f TraceVariableO
1cd0: 62 6a 43 6d 64 2c 0a 2b 20 20 20 20 54 72 61 63 bjCmd,.+ Trac
1ce0: 65 45 78 63 65 70 74 69 6f 6e 4f 62 6a 43 6d 64 eExceptionObjCmd
1cf0: 0a 20 7d 3b 0a 20 0a 20 2f 2a 0a 40 40 20 2d 31 . };. . /*.@@ -1
1d00: 38 31 2c 37 20 2b 31 38 33 2c 37 20 40 40 0a 20 81,7 +183,7 @@.
1d10: 20 20 20 20 63 68 61 72 20 2a 6e 61 6d 65 2c 20 char *name,
1d20: 2a 66 6c 61 67 4f 70 73 2c 20 2a 70 3b 0a 20 20 *flagOps, *p;.
1d30: 20 20 20 2f 2a 20 4d 61 69 6e 20 73 75 62 20 63 /* Main sub c
1d40: 6f 6d 6d 61 6e 64 73 20 74 6f 20 27 74 72 61 63 ommands to 'trac
1d50: 65 27 20 2a 2f 0a 20 20 20 20 20 73 74 61 74 69 e' */. stati
1d60: 63 20 43 4f 4e 53 54 20 63 68 61 72 20 2a 74 72 c CONST char *tr
1d70: 61 63 65 4f 70 74 69 6f 6e 73 5b 5d 20 3d 20 7b aceOptions[] = {
1d80: 0a 2d 09 22 61 64 64 22 2c 20 22 69 6e 66 6f 22 .-."add", "info"
1d90: 2c 20 22 72 65 6d 6f 76 65 22 2c 0a 2b 09 22 61 , "remove",.+."a
1da0: 64 64 22 2c 20 22 69 6e 66 6f 22 2c 20 22 72 65 dd", "info", "re
1db0: 6d 6f 76 65 22 2c 20 22 73 65 74 22 2c 20 22 75 move", "set", "u
1dc0: 6e 73 65 74 22 0a 20 23 69 66 6e 64 65 66 20 54 nset". #ifndef T
1dd0: 43 4c 5f 52 45 4d 4f 56 45 5f 4f 42 53 4f 4c 45 CL_REMOVE_OBSOLE
1de0: 54 45 5f 54 52 41 43 45 53 0a 20 09 22 76 61 72 TE_TRACES. ."var
1df0: 69 61 62 6c 65 22 2c 20 22 76 64 65 6c 65 74 65 iable", "vdelete
1e00: 22 2c 20 22 76 69 6e 66 6f 22 2c 0a 20 23 65 6e ", "vinfo",. #en
1e10: 64 69 66 0a 40 40 20 2d 31 38 39 2c 37 20 2b 31 dif.@@ -189,7 +1
1e20: 39 31 2c 37 20 40 40 0a 20 20 20 20 20 7d 3b 0a 91,7 @@. };.
1e30: 20 20 20 20 20 2f 2a 20 27 4f 4c 44 27 20 6f 70 /* 'OLD' op
1e40: 74 69 6f 6e 73 20 61 72 65 20 70 72 65 2d 54 63 tions are pre-Tc
1e50: 6c 2d 38 2e 34 20 73 74 79 6c 65 20 2a 2f 0a 20 l-8.4 style */.
1e60: 20 20 20 20 65 6e 75 6d 20 74 72 61 63 65 4f 70 enum traceOp
1e70: 74 69 6f 6e 73 20 7b 0a 2d 09 54 52 41 43 45 5f tions {.-.TRACE_
1e80: 41 44 44 2c 20 54 52 41 43 45 5f 49 4e 46 4f 2c ADD, TRACE_INFO,
1e90: 20 54 52 41 43 45 5f 52 45 4d 4f 56 45 2c 0a 2b TRACE_REMOVE,.+
1ea0: 09 54 52 41 43 45 5f 41 44 44 2c 20 54 52 41 43 .TRACE_ADD, TRAC
1eb0: 45 5f 49 4e 46 4f 2c 20 54 52 41 43 45 5f 52 45 E_INFO, TRACE_RE
1ec0: 4d 4f 56 45 2c 20 54 52 41 43 45 5f 53 45 54 2c MOVE, TRACE_SET,
1ed0: 20 54 52 41 43 45 5f 55 4e 53 45 54 2c 0a 20 23 TRACE_UNSET,. #
1ee0: 69 66 6e 64 65 66 20 54 43 4c 5f 52 45 4d 4f 56 ifndef TCL_REMOV
1ef0: 45 5f 4f 42 53 4f 4c 45 54 45 5f 54 52 41 43 45 E_OBSOLETE_TRACE
1f00: 53 0a 20 09 54 52 41 43 45 5f 4f 4c 44 5f 56 41 S. .TRACE_OLD_VA
1f10: 52 49 41 42 4c 45 2c 20 54 52 41 43 45 5f 4f 4c RIABLE, TRACE_OL
1f20: 44 5f 56 44 45 4c 45 54 45 2c 20 54 52 41 43 45 D_VDELETE, TRACE
1f30: 5f 4f 4c 44 5f 56 49 4e 46 4f 0a 20 23 65 6e 64 _OLD_VINFO. #end
1f40: 69 66 0a 40 40 20 2d 32 34 39 2c 36 20 2b 32 35 if.@@ -249,6 +25
1f50: 31 2c 32 33 20 40 40 0a 20 09 72 65 74 75 72 6e 1,23 @@. .return
1f60: 20 28 74 72 61 63 65 53 75 62 43 6d 64 73 5b 74 (traceSubCmds[t
1f70: 79 70 65 49 6e 64 65 78 5d 29 28 69 6e 74 65 72 ypeIndex])(inter
1f80: 70 2c 20 6f 70 74 69 6f 6e 49 6e 64 65 78 2c 20 p, optionIndex,
1f90: 6f 62 6a 63 2c 20 6f 62 6a 76 29 3b 0a 20 09 62 objc, objv);. .b
1fa0: 72 65 61 6b 3b 0a 20 20 20 20 20 7d 0a 2b 20 20 reak;. }.+
1fb0: 20 20 63 61 73 65 20 54 52 41 43 45 5f 53 45 54 case TRACE_SET
1fc0: 3a 0a 2b 20 20 20 20 63 61 73 65 20 54 52 41 43 :.+ case TRAC
1fd0: 45 5f 55 4e 53 45 54 3a 20 7b 0a 2b 20 20 20 20 E_UNSET: {.+
1fe0: 69 6e 74 20 74 79 70 65 49 6e 64 65 78 3b 0a 2b int typeIndex;.+
1ff0: 20 20 20 20 69 66 20 28 6f 62 6a 63 20 3c 20 33 if (objc < 3
2000: 29 20 7b 0a 2b 20 20 20 20 20 20 20 20 54 63 6c ) {.+ Tcl
2010: 5f 57 72 6f 6e 67 4e 75 6d 41 72 67 73 28 69 6e _WrongNumArgs(in
2020: 74 65 72 70 2c 20 32 2c 20 6f 62 6a 76 2c 20 22 terp, 2, objv, "
2030: 65 78 63 65 70 74 69 6f 6e 20 3f 61 72 67 20 2e exception ?arg .
2040: 2e 2e 3f 22 29 3b 0a 2b 20 20 20 20 20 20 20 20 ..?");.+
2050: 72 65 74 75 72 6e 20 54 43 4c 5f 45 52 52 4f 52 return TCL_ERROR
2060: 3b 0a 2b 20 20 20 20 7d 0a 2b 20 20 20 20 69 66 ;.+ }.+ if
2070: 20 28 54 63 6c 5f 47 65 74 49 6e 64 65 78 46 72 (Tcl_GetIndexFr
2080: 6f 6d 4f 62 6a 28 69 6e 74 65 72 70 2c 20 6f 62 omObj(interp, ob
2090: 6a 76 5b 32 5d 2c 20 74 72 61 63 65 54 79 70 65 jv[2], traceType
20a0: 4f 70 74 69 6f 6e 73 2c 20 22 6f 70 74 69 6f 6e Options, "option
20b0: 22 2c 0a 2b 20 20 20 20 20 20 20 20 30 2c 20 26 ",.+ 0, &
20c0: 74 79 70 65 49 6e 64 65 78 29 20 21 3d 20 54 43 typeIndex) != TC
20d0: 4c 5f 4f 4b 29 20 7b 0a 2b 20 20 20 20 20 20 20 L_OK) {.+
20e0: 20 72 65 74 75 72 6e 20 54 43 4c 5f 45 52 52 4f return TCL_ERRO
20f0: 52 3b 0a 2b 20 20 20 20 7d 0a 2b 20 20 20 20 69 R;.+ }.+ i
2100: 66 20 28 74 79 70 65 49 6e 64 65 78 20 3c 20 33 f (typeIndex < 3
2110: 29 20 7b 0a 2b 20 20 20 20 20 20 20 20 72 65 74 ) {.+ ret
2120: 75 72 6e 20 54 43 4c 5f 45 52 52 4f 52 3b 0a 2b urn TCL_ERROR;.+
2130: 20 20 20 20 7d 0a 2b 20 20 20 20 72 65 74 75 72 }.+ retur
2140: 6e 20 54 72 61 63 65 45 78 63 65 70 74 69 6f 6e n TraceException
2150: 4f 62 6a 43 6d 64 28 69 6e 74 65 72 70 2c 20 6f ObjCmd(interp, o
2160: 70 74 69 6f 6e 49 6e 64 65 78 2c 20 6f 62 6a 63 ptionIndex, objc
2170: 2c 20 6f 62 6a 76 29 3b 0a 2b 20 20 20 20 62 72 , objv);.+ br
2180: 65 61 6b 3b 0a 2b 20 20 20 20 7d 0a 20 0a 20 23 eak;.+ }. . #
2190: 69 66 6e 64 65 66 20 54 43 4c 5f 52 45 4d 4f 56 ifndef TCL_REMOV
21a0: 45 5f 4f 42 53 4f 4c 45 54 45 5f 54 52 41 43 45 E_OBSOLETE_TRACE
21b0: 53 0a 20 20 20 20 20 63 61 73 65 20 54 52 41 43 S. case TRAC
21c0: 45 5f 4f 4c 44 5f 56 41 52 49 41 42 4c 45 3a 0a E_OLD_VARIABLE:.
21d0: 40 40 20 2d 36 31 34 2c 36 20 2b 36 33 33 2c 31 @@ -614,6 +633,1
21e0: 30 39 20 40 40 0a 20 20 20 20 20 7d 0a 20 20 20 09 @@. }.
21f0: 20 20 7d 0a 20 20 20 20 20 72 65 74 75 72 6e 20 }. return
2200: 54 43 4c 5f 4f 4b 3b 0a 2b 7d 0a 2b 0a 2b 73 74 TCL_OK;.+}.+.+st
2210: 61 74 69 63 20 69 6e 74 0a 2b 54 72 61 63 65 45 atic int.+TraceE
2220: 78 63 65 70 74 69 6f 6e 4f 62 6a 43 6d 64 28 0a xceptionObjCmd(.
2230: 2b 20 20 20 20 54 63 6c 5f 49 6e 74 65 72 70 20 + Tcl_Interp
2240: 2a 69 6e 74 65 72 70 2c 20 20 20 20 20 2f 2a 20 *interp, /*
2250: 43 75 72 72 65 6e 74 20 69 6e 74 65 72 70 72 65 Current interpre
2260: 74 65 72 2e 20 2a 2f 0a 2b 20 20 20 20 69 6e 74 ter. */.+ int
2270: 20 6f 70 74 69 6f 6e 49 6e 64 65 78 2c 20 20 20 optionIndex,
2280: 20 20 20 20 20 2f 2a 20 41 64 64 2c 20 69 6e 66 /* Add, inf
2290: 6f 20 6f 72 20 72 65 6d 6f 76 65 20 2a 2f 0a 2b o or remove */.+
22a0: 20 20 20 20 69 6e 74 20 6f 62 6a 63 2c 20 20 20 int objc,
22b0: 20 20 20 20 20 20 20 20 2f 2a 20 4e 75 6d 62 65 /* Numbe
22c0: 72 20 6f 66 20 61 72 67 75 6d 65 6e 74 73 2e 20 r of arguments.
22d0: 2a 2f 0a 2b 20 20 20 20 54 63 6c 5f 4f 62 6a 20 */.+ Tcl_Obj
22e0: 2a 43 4f 4e 53 54 20 6f 62 6a 76 5b 5d 29 20 20 *CONST objv[])
22f0: 2f 2a 20 41 72 67 75 6d 65 6e 74 20 6f 62 6a 65 /* Argument obje
2300: 63 74 73 2e 20 2a 2f 0a 2b 7b 0a 2b 20 20 20 20 cts. */.+{.+
2310: 49 6e 74 65 72 70 20 2a 69 50 74 72 20 3d 20 28 Interp *iPtr = (
2320: 49 6e 74 65 72 70 2a 29 69 6e 74 65 72 70 3b 0a Interp*)interp;.
2330: 2b 20 20 20 20 65 6e 75 6d 20 74 72 61 63 65 4f + enum traceO
2340: 70 74 69 6f 6e 73 20 7b 0a 2b 20 20 20 20 54 52 ptions {.+ TR
2350: 41 43 45 5f 41 44 44 2c 20 54 52 41 43 45 5f 49 ACE_ADD, TRACE_I
2360: 4e 46 4f 2c 20 54 52 41 43 45 5f 52 45 4d 4f 56 NFO, TRACE_REMOV
2370: 45 2c 20 54 52 41 43 45 5f 53 45 54 2c 20 54 52 E, TRACE_SET, TR
2380: 41 43 45 5f 55 4e 53 45 54 0a 2b 20 20 20 20 7d ACE_UNSET.+ }
2390: 3b 0a 2b 20 20 20 20 0a 2b 20 20 20 20 73 77 69 ;.+ .+ swi
23a0: 74 63 68 20 28 28 65 6e 75 6d 20 74 72 61 63 65 tch ((enum trace
23b0: 4f 70 74 69 6f 6e 73 29 20 6f 70 74 69 6f 6e 49 Options) optionI
23c0: 6e 64 65 78 29 20 7b 0a 2b 20 20 20 20 20 20 20 ndex) {.+
23d0: 20 63 61 73 65 20 54 52 41 43 45 5f 49 4e 46 4f case TRACE_INFO
23e0: 3a 20 7b 0a 2b 20 20 20 20 20 20 20 20 2f 2a 0a : {.+ /*.
23f0: 2b 20 20 20 20 20 20 20 20 20 2a 20 52 65 74 75 + * Retu
2400: 72 6e 20 74 68 65 20 63 75 72 72 65 6e 74 6c 79 rn the currently
2410: 20 73 65 74 20 65 72 72 6f 72 20 73 63 72 69 70 set error scrip
2420: 74 20 70 6c 75 73 20 61 20 74 75 70 6c 65 20 66 t plus a tuple f
2430: 6f 72 20 2d 63 61 75 67 68 74 20 61 6e 64 20 0a or -caught and .
2440: 2b 20 20 20 20 20 20 20 20 20 2a 20 2d 75 6e 63 + * -unc
2450: 61 75 67 68 74 20 74 68 61 74 20 69 6e 64 69 63 aught that indic
2460: 61 74 65 73 20 77 68 65 6e 20 74 68 65 20 73 63 ates when the sc
2470: 72 69 70 74 20 69 73 20 65 78 65 63 75 74 65 64 ript is executed
2480: 0a 2b 20 20 20 20 20 20 20 20 20 2a 2f 0a 2b 20 .+ */.+
2490: 20 20 20 20 20 20 20 54 63 6c 5f 4f 62 6a 20 2a Tcl_Obj *
24a0: 72 65 73 75 6c 74 20 3d 20 54 63 6c 5f 4e 65 77 result = Tcl_New
24b0: 4f 62 6a 28 29 3b 0a 2b 20 20 20 20 20 20 20 20 Obj();.+
24c0: 54 63 6c 5f 4c 69 73 74 4f 62 6a 41 70 70 65 6e Tcl_ListObjAppen
24d0: 64 45 6c 65 6d 65 6e 74 28 69 6e 74 65 72 70 2c dElement(interp,
24e0: 20 72 65 73 75 6c 74 2c 20 54 63 6c 5f 4e 65 77 result, Tcl_New
24f0: 53 74 72 69 6e 67 4f 62 6a 28 22 2d 63 61 75 67 StringObj("-caug
2500: 68 74 22 2c 20 2d 31 29 29 3b 0a 2b 20 20 20 20 ht", -1));.+
2510: 20 20 20 20 54 63 6c 5f 4c 69 73 74 4f 62 6a 41 Tcl_ListObjA
2520: 70 70 65 6e 64 45 6c 65 6d 65 6e 74 28 69 6e 74 ppendElement(int
2530: 65 72 70 2c 20 72 65 73 75 6c 74 2c 20 0a 2b 20 erp, result, .+
2540: 20 20 20 20 20 20 20 20 20 20 20 54 63 6c 5f 4e Tcl_N
2550: 65 77 42 6f 6f 6c 65 61 6e 4f 62 6a 28 69 50 74 ewBooleanObj(iPt
2560: 72 2d 3e 65 78 63 65 70 74 69 6f 6e 43 6f 6d 6d r->exceptionComm
2570: 61 6e 64 46 6c 61 67 73 20 26 20 45 58 43 45 50 andFlags & EXCEP
2580: 54 43 4d 44 5f 4f 4e 43 41 55 47 48 54 29 29 3b TCMD_ONCAUGHT));
2590: 0a 2b 20 20 20 20 20 20 20 20 54 63 6c 5f 4c 69 .+ Tcl_Li
25a0: 73 74 4f 62 6a 41 70 70 65 6e 64 45 6c 65 6d 65 stObjAppendEleme
25b0: 6e 74 28 69 6e 74 65 72 70 2c 20 72 65 73 75 6c nt(interp, resul
25c0: 74 2c 20 54 63 6c 5f 4e 65 77 53 74 72 69 6e 67 t, Tcl_NewString
25d0: 4f 62 6a 28 22 2d 75 6e 63 61 75 67 68 74 22 2c Obj("-uncaught",
25e0: 20 2d 31 29 29 3b 0a 2b 20 20 20 20 20 20 20 20 -1));.+
25f0: 54 63 6c 5f 4c 69 73 74 4f 62 6a 41 70 70 65 6e Tcl_ListObjAppen
2600: 64 45 6c 65 6d 65 6e 74 28 69 6e 74 65 72 70 2c dElement(interp,
2610: 20 72 65 73 75 6c 74 2c 20 0a 2b 20 20 20 20 20 result, .+
2620: 20 20 20 20 20 20 20 54 63 6c 5f 4e 65 77 42 6f Tcl_NewBo
2630: 6f 6c 65 61 6e 4f 62 6a 28 69 50 74 72 2d 3e 65 oleanObj(iPtr->e
2640: 78 63 65 70 74 69 6f 6e 43 6f 6d 6d 61 6e 64 46 xceptionCommandF
2650: 6c 61 67 73 20 26 20 45 58 43 45 50 54 43 4d 44 lags & EXCEPTCMD
2660: 5f 4f 4e 55 4e 43 41 55 47 48 54 29 29 3b 0a 2b _ONUNCAUGHT));.+
2670: 20 20 20 20 20 20 20 20 69 66 20 28 69 50 74 72 if (iPtr
2680: 2d 3e 65 78 63 65 70 74 69 6f 6e 43 6f 6d 6d 61 ->exceptionComma
2690: 6e 64 20 3d 3d 20 4e 55 4c 4c 29 20 7b 0a 2b 20 nd == NULL) {.+
26a0: 20 20 20 20 20 20 20 20 20 20 20 54 63 6c 5f 4c Tcl_L
26b0: 69 73 74 4f 62 6a 41 70 70 65 6e 64 45 6c 65 6d istObjAppendElem
26c0: 65 6e 74 28 69 6e 74 65 72 70 2c 20 72 65 73 75 ent(interp, resu
26d0: 6c 74 2c 20 54 63 6c 5f 4e 65 77 53 74 72 69 6e lt, Tcl_NewStrin
26e0: 67 4f 62 6a 28 22 22 2c 20 2d 31 29 29 3b 0a 2b gObj("", -1));.+
26f0: 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b } else {
2700: 0a 2b 20 20 20 20 20 20 20 20 20 20 20 20 54 63 .+ Tc
2710: 6c 5f 4c 69 73 74 4f 62 6a 41 70 70 65 6e 64 45 l_ListObjAppendE
2720: 6c 65 6d 65 6e 74 28 69 6e 74 65 72 70 2c 20 72 lement(interp, r
2730: 65 73 75 6c 74 2c 20 69 50 74 72 2d 3e 65 78 63 esult, iPtr->exc
2740: 65 70 74 69 6f 6e 43 6f 6d 6d 61 6e 64 29 3b 0a eptionCommand);.
2750: 2b 20 20 20 20 20 20 20 20 7d 0a 2b 20 20 20 20 + }.+
2760: 20 20 20 20 0a 2b 20 20 20 20 20 20 20 20 54 63 .+ Tc
2770: 6c 5f 53 65 74 4f 62 6a 52 65 73 75 6c 74 28 69 l_SetObjResult(i
2780: 6e 74 65 72 70 2c 20 72 65 73 75 6c 74 29 3b 0a nterp, result);.
2790: 2b 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 + return
27a0: 54 43 4c 5f 4f 4b 3b 0a 2b 20 20 20 20 20 20 20 TCL_OK;.+
27b0: 20 7d 0a 2b 20 20 20 20 20 20 20 20 63 61 73 65 }.+ case
27c0: 20 54 52 41 43 45 5f 53 45 54 3a 20 7b 0a 2b 20 TRACE_SET: {.+
27d0: 20 20 20 20 20 20 20 62 72 65 61 6b 3b 0a 2b 20 break;.+
27e0: 20 20 20 20 20 20 20 7d 0a 2b 20 20 20 20 20 20 }.+
27f0: 20 20 63 61 73 65 20 54 52 41 43 45 5f 55 4e 53 case TRACE_UNS
2800: 45 54 3a 20 7b 0a 2b 20 20 20 20 20 20 20 20 54 ET: {.+ T
2810: 63 6c 5f 44 65 63 72 52 65 66 43 6f 75 6e 74 28 cl_DecrRefCount(
2820: 69 50 74 72 2d 3e 65 78 63 65 70 74 69 6f 6e 43 iPtr->exceptionC
2830: 6f 6d 6d 61 6e 64 29 3b 0a 2b 20 20 20 20 20 20 ommand);.+
2840: 20 20 69 50 74 72 2d 3e 65 78 63 65 70 74 69 6f iPtr->exceptio
2850: 6e 43 6f 6d 6d 61 6e 64 20 3d 20 4e 55 4c 4c 3b nCommand = NULL;
2860: 0a 2b 20 20 20 20 20 20 20 20 72 65 74 75 72 6e .+ return
2870: 20 54 43 4c 5f 4f 4b 3b 0a 2b 20 20 20 20 20 20 TCL_OK;.+
2880: 20 20 7d 0a 2b 20 20 20 20 20 20 20 20 64 65 66 }.+ def
2890: 61 75 6c 74 3a 20 7b 0a 2b 20 20 20 20 20 20 20 ault: {.+
28a0: 20 54 63 6c 5f 53 65 74 4f 62 6a 52 65 73 75 6c Tcl_SetObjResul
28b0: 74 28 69 6e 74 65 72 70 2c 20 54 63 6c 5f 4e 65 t(interp, Tcl_Ne
28c0: 77 53 74 72 69 6e 67 4f 62 6a 28 0a 2b 20 20 20 wStringObj(.+
28d0: 20 20 20 20 20 20 20 20 20 22 62 61 64 20 6f 70 "bad op
28e0: 74 69 6f 6e 2c 20 73 68 6f 75 6c 64 20 62 65 20 tion, should be
28f0: 74 72 61 63 65 20 73 65 74 7c 67 65 74 7c 69 6e trace set|get|in
2900: 66 6f 20 65 78 63 65 70 74 69 6f 6e 22 2c 20 2d fo exception", -
2910: 31 29 29 3b 0a 2b 20 20 20 20 20 20 20 20 72 65 1));.+ re
2920: 74 75 72 6e 20 54 43 4c 5f 45 52 52 4f 52 3b 0a turn TCL_ERROR;.
2930: 2b 20 20 20 20 20 20 20 20 7d 0a 2b 20 20 20 20 + }.+
2940: 7d 0a 2b 20 20 20 20 0a 2b 20 20 20 20 69 66 20 }.+ .+ if
2950: 28 6f 62 6a 63 20 3d 3d 20 34 29 20 7b 0a 2b 20 (objc == 4) {.+
2960: 20 20 20 20 20 20 20 69 50 74 72 2d 3e 65 78 63 iPtr->exc
2970: 65 70 74 69 6f 6e 43 6f 6d 6d 61 6e 64 20 3d 20 eptionCommand =
2980: 6f 62 6a 76 5b 33 5d 3b 0a 2b 20 20 20 20 20 20 objv[3];.+
2990: 20 20 54 63 6c 5f 49 6e 63 72 52 65 66 43 6f 75 Tcl_IncrRefCou
29a0: 6e 74 20 28 69 50 74 72 2d 3e 65 78 63 65 70 74 nt (iPtr->except
29b0: 69 6f 6e 43 6f 6d 6d 61 6e 64 29 3b 0a 2b 20 20 ionCommand);.+
29c0: 20 20 20 20 20 20 0a 2b 20 20 20 20 20 20 20 20 .+
29d0: 72 65 74 75 72 6e 20 54 43 4c 5f 4f 4b 3b 0a 2b return TCL_OK;.+
29e0: 20 20 20 20 7d 0a 2b 20 20 20 20 0a 2b 20 20 20 }.+ .+
29f0: 20 69 66 20 28 6f 62 6a 63 20 3d 3d 20 35 29 20 if (objc == 5)
2a00: 7b 0a 2b 20 20 20 20 20 20 20 20 63 68 61 72 20 {.+ char
2a10: 2a 66 6c 61 67 20 3d 20 54 63 6c 5f 47 65 74 53 *flag = Tcl_GetS
2a20: 74 72 69 6e 67 28 6f 62 6a 76 5b 33 5d 29 3b 0a tring(objv[3]);.
2a30: 2b 20 20 20 20 20 20 20 20 0a 2b 20 20 20 20 20 + .+
2a40: 20 20 20 69 66 20 28 2a 66 6c 61 67 20 21 3d 20 if (*flag !=
2a50: 27 2d 27 29 20 7b 0a 2b 20 20 20 20 20 20 20 20 '-') {.+
2a60: 20 20 20 20 67 6f 74 6f 20 65 72 72 6f 72 52 65 goto errorRe
2a70: 74 75 72 6e 3b 0a 2b 20 20 20 20 20 20 20 20 7d turn;.+ }
2a80: 0a 2b 20 20 20 20 20 20 20 20 69 66 20 28 73 74 .+ if (st
2a90: 72 63 6d 70 28 66 6c 61 67 2c 20 22 2d 63 61 75 rcmp(flag, "-cau
2aa0: 67 68 74 22 29 20 3d 3d 20 30 29 20 7b 0a 2b 20 ght") == 0) {.+
2ab0: 20 20 20 20 20 20 20 20 20 20 20 69 50 74 72 2d iPtr-
2ac0: 3e 65 78 63 65 70 74 69 6f 6e 43 6f 6d 6d 61 6e >exceptionComman
2ad0: 64 46 6c 61 67 73 20 3d 20 45 58 43 45 50 54 43 dFlags = EXCEPTC
2ae0: 4d 44 5f 4f 4e 43 41 55 47 48 54 3b 0a 2b 20 20 MD_ONCAUGHT;.+
2af0: 20 20 20 20 20 20 7d 20 65 6c 73 65 20 69 66 20 } else if
2b00: 28 73 74 72 63 6d 70 28 66 6c 61 67 2c 20 22 2d (strcmp(flag, "-
2b10: 75 6e 63 61 75 67 68 74 22 29 20 3d 3d 20 30 29 uncaught") == 0)
2b20: 20 7b 0a 2b 20 20 20 20 20 20 20 20 20 20 20 20 {.+
2b30: 69 50 74 72 2d 3e 65 78 63 65 70 74 69 6f 6e 43 iPtr->exceptionC
2b40: 6f 6d 6d 61 6e 64 46 6c 61 67 73 20 3d 20 45 58 ommandFlags = EX
2b50: 43 45 50 54 43 4d 44 5f 4f 4e 55 4e 43 41 55 47 CEPTCMD_ONUNCAUG
2b60: 48 54 3b 0a 2b 20 20 20 20 20 20 20 20 7d 20 65 HT;.+ } e
2b70: 6c 73 65 20 7b 0a 2b 20 20 20 20 20 20 20 20 20 lse {.+
2b80: 20 20 20 67 6f 74 6f 20 65 72 72 6f 72 52 65 74 goto errorRet
2b90: 75 72 6e 3b 0a 2b 20 20 20 20 20 20 20 20 7d 0a urn;.+ }.
2ba0: 2b 20 20 20 20 20 20 20 20 0a 2b 20 20 20 20 20 + .+
2bb0: 20 20 20 69 50 74 72 2d 3e 65 78 63 65 70 74 69 iPtr->excepti
2bc0: 6f 6e 43 6f 6d 6d 61 6e 64 20 3d 20 6f 62 6a 76 onCommand = objv
2bd0: 5b 34 5d 3b 0a 2b 20 20 20 20 20 20 20 20 54 63 [4];.+ Tc
2be0: 6c 5f 49 6e 63 72 52 65 66 43 6f 75 6e 74 28 69 l_IncrRefCount(i
2bf0: 50 74 72 2d 3e 65 78 63 65 70 74 69 6f 6e 43 6f Ptr->exceptionCo
2c00: 6d 6d 61 6e 64 29 3b 0a 2b 20 20 20 20 20 20 20 mmand);.+
2c10: 20 0a 2b 20 20 20 20 20 20 20 20 72 65 74 75 72 .+ retur
2c20: 6e 20 54 43 4c 5f 4f 4b 3b 0a 2b 20 20 20 20 7d n TCL_OK;.+ }
2c30: 0a 2b 20 20 20 20 0a 2b 20 20 20 20 69 66 20 28 .+ .+ if (
2c40: 6f 62 6a 63 20 3d 3d 20 36 29 20 7b 0a 2b 20 20 objc == 6) {.+
2c50: 20 20 20 20 20 20 63 68 61 72 20 2a 66 6c 61 67 char *flag
2c60: 31 20 3d 20 54 63 6c 5f 47 65 74 53 74 72 69 6e 1 = Tcl_GetStrin
2c70: 67 28 6f 62 6a 76 5b 33 5d 29 2c 20 2a 66 6c 61 g(objv[3]), *fla
2c80: 67 32 20 3d 20 54 63 6c 5f 47 65 74 53 74 72 69 g2 = Tcl_GetStri
2c90: 6e 67 28 6f 62 6a 76 5b 34 5d 29 3b 0a 2b 20 20 ng(objv[4]);.+
2ca0: 20 20 20 20 20 20 69 6e 74 20 76 61 6c 69 64 20 int valid
2cb0: 3d 20 30 3b 0a 2b 20 20 20 20 20 20 20 20 69 66 = 0;.+ if
2cc0: 20 28 2a 66 6c 61 67 31 20 21 3d 20 27 2d 27 20 (*flag1 != '-'
2cd0: 7c 7c 20 2a 66 6c 61 67 32 20 21 3d 20 27 2d 27 || *flag2 != '-'
2ce0: 29 20 7b 0a 2b 20 20 20 20 20 20 20 20 20 20 20 ) {.+
2cf0: 20 67 6f 74 6f 20 65 72 72 6f 72 52 65 74 75 72 goto errorRetur
2d00: 6e 3b 0a 2b 20 20 20 20 20 20 20 20 7d 0a 2b 20 n;.+ }.+
2d10: 20 20 20 20 20 20 20 0a 2b 20 20 20 20 20 20 20 .+
2d20: 20 76 61 6c 69 64 20 3d 20 28 73 74 72 63 6d 70 valid = (strcmp
2d30: 28 66 6c 61 67 31 2c 20 22 2d 63 61 75 67 68 74 (flag1, "-caught
2d40: 22 29 20 3d 3d 20 30 20 26 26 20 73 74 72 63 6d ") == 0 && strcm
2d50: 70 28 66 6c 61 67 32 2c 20 22 2d 75 6e 63 61 75 p(flag2, "-uncau
2d60: 67 68 74 22 29 20 3d 3d 20 30 29 0a 2b 20 20 20 ght") == 0).+
2d70: 20 20 20 20 20 20 20 20 20 7c 7c 20 28 73 74 72 || (str
2d80: 63 6d 70 28 66 6c 61 67 31 2c 20 22 2d 75 6e 63 cmp(flag1, "-unc
2d90: 61 75 67 68 74 22 29 20 3d 3d 20 30 20 26 26 20 aught") == 0 &&
2da0: 73 74 72 63 6d 70 28 66 6c 61 67 32 2c 20 22 2d strcmp(flag2, "-
2db0: 63 61 75 67 68 74 22 29 20 3d 3d 20 30 29 3b 0a caught") == 0);.
2dc0: 2b 20 20 20 20 20 20 20 20 69 66 20 28 21 76 61 + if (!va
2dd0: 6c 69 64 29 20 7b 0a 2b 20 20 20 20 20 20 20 20 lid) {.+
2de0: 20 20 20 20 67 6f 74 6f 20 65 72 72 6f 72 52 65 goto errorRe
2df0: 74 75 72 6e 3b 0a 2b 20 20 20 20 20 20 20 20 7d turn;.+ }
2e00: 0a 2b 20 20 20 20 20 20 20 20 0a 2b 20 20 20 20 .+ .+
2e10: 20 20 20 20 69 50 74 72 2d 3e 65 78 63 65 70 74 iPtr->except
2e20: 69 6f 6e 43 6f 6d 6d 61 6e 64 46 6c 61 67 73 20 ionCommandFlags
2e30: 3d 20 45 58 43 45 50 54 43 4d 44 5f 4f 4e 43 41 = EXCEPTCMD_ONCA
2e40: 55 47 48 54 7c 45 58 43 45 50 54 43 4d 44 5f 4f UGHT|EXCEPTCMD_O
2e50: 4e 55 4e 43 41 55 47 48 54 3b 0a 2b 20 20 20 20 NUNCAUGHT;.+
2e60: 20 20 20 20 69 50 74 72 2d 3e 65 78 63 65 70 74 iPtr->except
2e70: 69 6f 6e 43 6f 6d 6d 61 6e 64 20 3d 20 6f 62 6a ionCommand = obj
2e80: 76 5b 35 5d 3b 0a 2b 20 20 20 20 20 20 20 20 54 v[5];.+ T
2e90: 63 6c 5f 49 6e 63 72 52 65 66 43 6f 75 6e 74 28 cl_IncrRefCount(
2ea0: 69 50 74 72 2d 3e 65 78 63 65 70 74 69 6f 6e 43 iPtr->exceptionC
2eb0: 6f 6d 6d 61 6e 64 29 3b 0a 2b 20 20 20 20 20 20 ommand);.+
2ec0: 20 20 0a 2b 20 20 20 20 20 20 20 20 72 65 74 75 .+ retu
2ed0: 72 6e 20 54 43 4c 5f 4f 4b 3b 0a 2b 20 20 20 20 rn TCL_OK;.+
2ee0: 7d 0a 2b 20 20 20 20 0a 2b 65 72 72 6f 72 52 65 }.+ .+errorRe
2ef0: 74 75 72 6e 3a 0a 2b 20 20 20 20 69 50 74 72 2d turn:.+ iPtr-
2f00: 3e 65 78 63 65 70 74 69 6f 6e 43 6f 6d 6d 61 6e >exceptionComman
2f10: 64 20 3d 20 4e 55 4c 4c 3b 0a 2b 20 20 20 20 69 d = NULL;.+ i
2f20: 50 74 72 2d 3e 65 78 63 65 70 74 69 6f 6e 43 6f Ptr->exceptionCo
2f30: 6d 6d 61 6e 64 46 6c 61 67 73 20 3d 20 30 3b 0a mmandFlags = 0;.
2f40: 2b 20 20 20 20 54 63 6c 5f 57 72 6f 6e 67 4e 75 + Tcl_WrongNu
2f50: 6d 41 72 67 73 28 69 6e 74 65 72 70 2c 20 33 2c mArgs(interp, 3,
2f60: 20 6f 62 6a 76 2c 20 22 3f 2d 63 61 75 67 68 74 objv, "?-caught
2f70: 3f 20 3f 2d 75 6e 63 61 75 67 68 74 3f 20 3f 73 ? ?-uncaught? ?s
2f80: 63 72 69 70 74 3f 22 29 3b 0a 2b 20 20 20 20 72 cript?");.+ r
2f90: 65 74 75 72 6e 20 54 43 4c 5f 45 52 52 4f 52 3b eturn TCL_ERROR;
2fa0: 0a 20 7d 0a 20 0c 0a 20 2f 2a 0a . }. .. /*.