Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch mig-no280 Excluding Merge-Ins
This is equivalent to a diff from 76f6a1495e to 53d0e4fb5c
|
2013-05-12
| ||
| 00:44 | Optimizations and general bytecode generation improvements. check-in: efa1b5bb6b user: dkf tags: trunk | |
|
2013-05-10
| ||
| 19:08 | Merge to near-trunk. check-in: 6f527b2285 user: dgp tags: dgp-refactor | |
| 12:57 | Optimizations and general bytecode generation improvements. check-in: 18bcecceea user: dkf tags: dkf-bcc-optimize | |
|
2013-05-08
| ||
| 19:28 | Start branch reducing use of sprintf(). Closed-Leaf check-in: cef46dbe76 user: dgp tags: dgp-sprintf | |
| 08:24 | Also get msgcat locale from Vista+ registry key "HCU/Control Panel/Desktop : PreferredUILanguages" t... check-in: 6dd00195c1 user: oehhar tags: bug3036566 | |
|
2013-05-07
| ||
| 18:08 | merge trunk Closed-Leaf check-in: 53d0e4fb5c user: mig tags: mig-no280 | |
| 15:02 | merge trunk. remove some unneeded #undef's check-in: 312eebbd03 user: jan.nijtmans tags: novem | |
| 11:38 | No longer link Cygwin executables with zlib1.dll, but with cygz.dll. On Cygwin64 this doesn't work,... check-in: 76f6a1495e user: jan.nijtmans tags: trunk | |
|
2013-05-06
| ||
| 07:33 | Add support for Cygwin64, which has a 64-bit "long" type. Binary compatibility with win64 requires ... check-in: ad5495e548 user: jan.nijtmans tags: trunk | |
|
2013-03-20
| ||
| 14:10 | merge trunk check-in: 5a5d0ec834 user: mig tags: mig-no280 | |
Changes to generic/tclAssembly.c.
| ︙ | |||
230 231 232 233 234 235 236 237 238 239 240 241 242 243 | 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | + + | /* * Static functions defined in this file. */ static void AddBasicBlockRangeToErrorInfo(AssemblyEnv*, BasicBlock*); static void AdvanceLines(int *line, const char *start, const char *end); static BasicBlock * AllocBB(AssemblyEnv*); static int AssembleOneLine(AssemblyEnv* envPtr); static void BBAdjustStackDepth(BasicBlock* bbPtr, int consumed, int produced); static void BBUpdateStackReqs(BasicBlock* bbPtr, int tblIdx, int count); static void BBEmitInstInt1(AssemblyEnv* assemEnvPtr, int tblIdx, |
| ︙ | |||
319 320 321 322 323 324 325 | 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | - - - - - - - - - - - - - - - - |
"assemblecode",
FreeAssembleCodeInternalRep, /* freeIntRepProc */
DupAssembleCodeInternalRep, /* dupIntRepProc */
NULL, /* updateStringProc */
NULL /* setFromAnyProc */
};
|
| ︙ | |||
523 524 525 526 527 528 529 530 531 532 533 534 535 536 | 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 | + + + + + + + + + + + + + + + |
INST_STR_MAP, /* 143 */
INST_STR_FIND, /* 144 */
INST_COROUTINE_NAME, /* 149 */
INST_NS_CURRENT, /* 151 */
INST_INFO_LEVEL_NUM, /* 152 */
INST_RESOLVE_COMMAND /* 154 */
};
static void
AdvanceLines(
int *line,
const char *start,
const char *end)
{
register const char *p;
for (p = start; p < end; p++) {
if (*p == '\n') {
(*line)++;
}
}
}
/*
* Helper macros.
*/
#if defined(TCL_DEBUG_ASSEMBLY) && defined(__GNUC__) && __GNUC__ > 2
#define DEBUG_PRINT(...) fprintf(stderr, ##__VA_ARGS__);fflush(stderr)
|
| ︙ | |||
866 867 868 869 870 871 872 | 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 | - - + - - + - - + + - |
/*
* Not valid, so free it and regenerate.
*/
FreeAssembleCodeInternalRep(objPtr);
}
|
| ︙ | |||
1041 1042 1043 1044 1045 1046 1047 | 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 | - + - - | return TCL_ERROR; } /* * Advance the pointers around any leading commentary. */ |
| ︙ | |||
1082 1083 1084 1085 1086 1087 1088 | 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 | - + - - | /* * Advance to the next line of code. */ nextPtr = parsePtr->commandStart + parsePtr->commandSize; bytesLeft -= (nextPtr - instPtr); instPtr = nextPtr; |
| ︙ | |||
1126 1127 1128 1129 1130 1131 1132 | 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 | - + - |
AssemblyEnv* assemEnvPtr = TclStackAlloc(interp, sizeof(AssemblyEnv));
/* Assembler environment under construction */
Tcl_Parse* parsePtr = TclStackAlloc(interp, sizeof(Tcl_Parse));
/* Parse of one line of assembly code */
assemEnvPtr->envPtr = envPtr;
assemEnvPtr->parsePtr = parsePtr;
|
| ︙ |
Changes to generic/tclBasic.c.
| ︙ | |||
79 80 81 82 83 84 85 | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | - + - - - + - - |
/*
* Declarations for managing contexts for non-recursive coroutines. Contexts
* are used to save the evaluation state between NR calls to each coro.
*/
#define SAVE_CONTEXT(context) \
(context).framePtr = iPtr->framePtr; \
|
| ︙ | |||
160 161 162 163 164 165 166 167 168 169 170 171 172 173 | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | + + + + + + + + + + + + + + + + + + + + + + + + + |
static Tcl_NRPostProc TEOV_NotFoundCallback;
static Tcl_NRPostProc TEOV_RestoreVarFrame;
static Tcl_NRPostProc TEOV_RunLeaveTraces;
static Tcl_ObjCmdProc NRCoroInjectObjCmd;
MODULE_SCOPE const TclStubs tclStubs;
static void UpdateStringOfScriptSource(Tcl_Obj *objPtr);
static const Tcl_ObjType scriptSourceType = {
"scriptSource", /* name */
NULL, /* freeIntRepProc */
NULL, /* dupIntRepProc */
UpdateStringOfScriptSource, /* updateStringProc */
NULL /* setFromAnyProc */
};
static void
UpdateStringOfScriptSource(
Tcl_Obj *objPtr)
{
const char *bytes = objPtr->internalRep.twoPtrValue.ptr1;
int len = PTR2INT(objPtr->internalRep.twoPtrValue.ptr2);
if (bytes) {
objPtr->bytes = (char *) ckalloc((unsigned) len + 1);
memcpy(objPtr->bytes, bytes, len);
objPtr->bytes[len] = '\0';
objPtr->length = len;
}
}
/*
* Magical counts for the number of arguments accepted by a coroutine command
* after particular kinds of [yield].
*/
#define CORO_ACTIVATE_YIELD PTR2INT(NULL)
|
| ︙ | |||
510 511 512 513 514 515 516 | 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 | - - - - - - - - - - - - - - - - - - - - - - - - - - - |
iPtr->interpInfo = NULL;
iPtr->numLevels = 0;
iPtr->maxNestingDepth = MAX_NESTING_DEPTH;
iPtr->framePtr = NULL; /* Initialise as soon as :: is available */
iPtr->varFramePtr = NULL; /* Initialise as soon as :: is available */
|
| ︙ | |||
729 730 731 732 733 734 735 736 737 738 739 740 741 742 | 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 | + + |
iPtr->allocCache = TclpGetAllocCache();
#else
iPtr->allocCache = NULL;
#endif
iPtr->pendingObjDataPtr = NULL;
iPtr->asyncReadyPtr = TclGetAsyncReadyPtr();
iPtr->deferredCallbacks = NULL;
iPtr->cmdSourcePtr = NULL;
/*
* Create the core commands. Do it here, rather than calling
* Tcl_CreateCommand, because it's faster (there's no need to check for a
* pre-existing command by the same name). If a command has a Tcl_CmdProc
* but no Tcl_ObjCmdProc, set the Tcl_ObjCmdProc to
* TclInvokeStringCommand. This is an object-based wrapper function that
|
| ︙ | |||
1341 1342 1343 1344 1345 1346 1347 | 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 | - |
Tcl_Interp *interp) /* Interpreter to delete. */
{
Interp *iPtr = (Interp *) interp;
Tcl_HashEntry *hPtr;
Tcl_HashSearch search;
Tcl_HashTable *hTablePtr;
ResolverScheme *resPtr, *nextResPtr;
|
| ︙ | |||
1498 1499 1500 1501 1502 1503 1504 | 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 | - - - - - - |
iPtr->errorCode = NULL;
}
Tcl_DecrRefCount(iPtr->eiVar);
if (iPtr->errorInfo) {
Tcl_DecrRefCount(iPtr->errorInfo);
iPtr->errorInfo = NULL;
}
|
| ︙ | |||
1540 1541 1542 1543 1544 1545 1546 | 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
/*
* Free up literal objects created for scripts compiled by the
* interpreter.
*/
TclDeleteLiteralTable(interp, &iPtr->literalTable);
|
| ︙ | |||
3355 3356 3357 3358 3359 3360 3361 | 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 | - + - - - - - - + - - - - + + + - - - - - - - - - - + + - - - - - - + + + + + + + + + + + + |
static Tcl_Obj *
GetCommandSource(
Interp *iPtr,
int objc,
Tcl_Obj *const objv[],
int lookup)
{
|
| ︙ | |||
4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 | 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 | + - - - - - - - - |
if (!cmdPtr) {
return TEOV_NotFound(interp, objc, objv, lookupNsPtr);
}
if (result != TCL_OK) {
return result;
}
}
iPtr->cmdSourcePtr = NULL;
#ifdef USE_DTRACE
if (TCL_DTRACE_CMD_ARGS_ENABLED()) {
const char *a[10];
int i = 0;
while (i < 10) {
a[i] = i < objc ? TclGetString(objv[i]) : NULL; i++;
}
TCL_DTRACE_CMD_ARGS(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7],
a[8], a[9]);
}
|
| ︙ | |||
4811 4812 4813 4814 4815 4816 4817 | 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 | - + - |
* execute nested commands, and report
* errors. */
Tcl_Token *tokenPtr, /* Pointer to first in an array of tokens to
* evaluate and concatenate. */
int count) /* Number of tokens to consider at tokenPtr.
* Must be at least 1. */
{
|
| ︙ | |||
4880 4881 4882 4883 4884 4885 4886 | 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - | * Results: * The return value is a standard Tcl completion code such as TCL_OK or * TCL_ERROR. A result or error message is left in interp's result. * * Side effects: * Depends on the script. * |
| ︙ | |||
5160 5161 5162 5163 5164 5165 5166 | 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 | - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - + + + + + + - - - - + + + + - - - - - - - - |
objectsNeeded += (numElements ? numElements : 1);
} else {
expand[objectsUsed] = 0;
objectsNeeded++;
}
|
| ︙ | |||
5330 5331 5332 5333 5334 5335 5336 | 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
Tcl_DecrRefCount(objv[i]);
}
if (gotParse) {
Tcl_FreeParse(parsePtr);
}
if (objvSpace != stackObjArray) {
ckfree(objvSpace);
|
| ︙ | |||
5879 5880 5881 5882 5883 5884 5885 | 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 | - - - - - - - - - - - - - - - - - + - + - - - | * the return code. * * Side effects: * The object is converted, if necessary, to a ByteCode object that holds * the bytecode instructions for the commands. Executing the commands * will almost certainly have side effects that depend on those commands. * |
| ︙ | |||
5972 5973 5974 5975 5976 5977 5978 | 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | */ Tcl_IncrRefCount(objPtr); listPtr = TclListObjCopy(interp, objPtr); Tcl_IncrRefCount(listPtr); TclDecrRefCount(objPtr); |
| ︙ | |||
6221 6222 6223 6224 6225 6226 6227 | 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 | - - - - - - - - - - - |
static int
TEOEx_ListCallback(
ClientData data[],
Tcl_Interp *interp,
int result)
{
|
| ︙ | |||
7991 7992 7993 7994 7995 7996 7997 | 7071 7072 7073 7074 7075 7076 7077 7078 7079 7080 7081 7082 7083 7084 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
}
return TCL_OK;
}
/*
*----------------------------------------------------------------------
*
|
| ︙ | |||
8128 8129 8130 8131 8132 8133 8134 | 7149 7150 7151 7152 7153 7154 7155 7156 7157 7158 7159 7160 7161 7162 | - - - - - - - - |
while (i < 10) {
a[i] = i < objc ? TclGetString(objv[i]) : NULL; i++;
}
TCL_DTRACE_CMD_ARGS(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7],
a[8], a[9]);
}
|
| ︙ | |||
8213 8214 8215 8216 8217 8218 8219 | 7226 7227 7228 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 | - + |
int
Tcl_NREvalObj(
Tcl_Interp *interp,
Tcl_Obj *objPtr,
int flags)
{
|
| ︙ | |||
8622 8623 8624 8625 8626 8627 8628 | 7635 7636 7637 7638 7639 7640 7641 7642 7643 7644 7645 7646 7647 7648 | - | /* * The execEnv was wound down but not deleted for our sake. We finish * the job here. The caller context has already been restored. */ NRE_ASSERT(iPtr->varFramePtr == corPtr->caller.varFramePtr); NRE_ASSERT(iPtr->framePtr == corPtr->caller.framePtr); |
| ︙ | |||
8675 8676 8677 8678 8679 8680 8681 | 7687 7688 7689 7690 7691 7692 7693 7694 7695 7696 7697 7698 7699 7700 | - - - - - - - - - - |
corPtr->eePtr->corPtr = NULL;
TclDeleteExecEnv(corPtr->eePtr);
corPtr->eePtr = NULL;
corPtr->stackLevel = NULL;
|
| ︙ | |||
8831 8832 8833 8834 8835 8836 8837 | 7833 7834 7835 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 | - + |
/*
* Add the callback to the coro's execEnv, so that it is the first thing
* to happen when the coro is resumed.
*/
iPtr->execEnvPtr = corPtr->eePtr;
|
| ︙ | |||
8973 8974 8975 8976 8977 8978 8979 | 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
cmdPtr = (Command *) Tcl_NRCreateCommand(interp, Tcl_DStringValue(&ds),
/*objProc*/ NULL, TclNRInterpCoroutine, corPtr, DeleteCoroutine);
Tcl_DStringFree(&ds);
corPtr->cmdPtr = cmdPtr;
cmdPtr->refCount++;
|
| ︙ |
Changes to generic/tclCmdAH.c.
| ︙ | |||
299 300 301 302 303 304 305 | 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | - - - - - - + |
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Obj *varNamePtr = NULL;
Tcl_Obj *optionVarNamePtr = NULL;
|
| ︙ | |||
756 757 758 759 760 761 762 | 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 | - - - - - - - - - - - - - - + |
TclNREvalObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
register Tcl_Obj *objPtr;
|
| ︙ | |||
2404 2405 2406 2407 2408 2409 2410 | 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 | - - - + + - - - - - - - + |
int
TclNRForObjCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
|
| ︙ | |||
2488 2489 2490 2491 2492 2493 2494 | 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 | - - - + - - - - - - - - + |
static int
ForCondCallback(
ClientData data[],
Tcl_Interp *interp,
int result)
{
|
| ︙ | |||
2732 2733 2734 2735 2736 2737 2738 | 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 | - + - |
if (statePtr->maxj > 0) {
result = ForeachAssignments(interp, statePtr);
if (result == TCL_ERROR) {
goto done;
}
TclNRAddCallback(interp, ForeachLoopStep, statePtr, NULL, NULL, NULL);
|
| ︙ | |||
2798 2799 2800 2801 2802 2803 2804 | 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 | - + - |
if (statePtr->maxj > ++statePtr->j) {
result = ForeachAssignments(interp, statePtr);
if (result == TCL_ERROR) {
goto done;
}
TclNRAddCallback(interp, ForeachLoopStep, statePtr, NULL, NULL, NULL);
|
| ︙ |
Changes to generic/tclCmdIL.c.
| ︙ | |||
115 116 117 118 119 120 121 | 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | - - - - - - | int objc, Tcl_Obj *const objv[]); static int InfoCommandsCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int InfoCompleteCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static int InfoDefaultCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); |
| ︙ | |||
164 165 166 167 168 169 170 | 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | - - |
{"args", InfoArgsCmd, TclCompileBasic1ArgCmd, NULL, NULL, 0},
{"body", InfoBodyCmd, TclCompileBasic1ArgCmd, NULL, NULL, 0},
{"cmdcount", InfoCmdCountCmd, TclCompileBasic0ArgCmd, NULL, NULL, 0},
{"commands", InfoCommandsCmd, TclCompileInfoCommandsCmd, NULL, NULL, 0},
{"complete", InfoCompleteCmd, TclCompileBasic1ArgCmd, NULL, NULL, 0},
{"coroutine", TclInfoCoroutineCmd, TclCompileInfoCoroutineCmd, NULL, NULL, 0},
{"default", InfoDefaultCmd, TclCompileBasic3ArgCmd, NULL, NULL, 0},
|
| ︙ | |||
250 251 252 253 254 255 256 | 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | - |
static int
IfConditionCallback(
ClientData data[],
Tcl_Interp *interp,
int result)
{
|
| ︙ | |||
293 294 295 296 297 298 299 | 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | - - - - - + - |
* The expression evaluated to false. Skip the command, then see if
* there is an "else" or "elseif" clause.
*/
i++;
if (i >= objc) {
if (thenScriptIndex) {
|
| ︙ | |||
350 351 352 353 354 355 356 | 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | - - - - - + - - + |
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"wrong # args: extra words after \"else\" clause in \"if\" command",
-1));
Tcl_SetErrorCode(interp, "TCL", "WRONGARGS", NULL);
return TCL_ERROR;
}
if (thenScriptIndex) {
|
| ︙ | |||
1024 1025 1026 1027 1028 1029 1030 | 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "ARGUMENT", argName, NULL);
return TCL_ERROR;
}
/*
*----------------------------------------------------------------------
*
|
| ︙ | |||
1112 1113 1114 1115 1116 1117 1118 | 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
varName = TclGetString(objv[1]);
varPtr = TclVarTraceExists(interp, varName);
Tcl_SetObjResult(interp,
Tcl_NewBooleanObj(varPtr && varPtr->value.objPtr));
return TCL_OK;
}
|
| ︙ |
Changes to generic/tclCmdMZ.c.
| ︙ | |||
3477 3478 3479 3480 3481 3482 3483 | 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 | - - - - - - |
{
int i,j, index, mode, foundmode, splitObjs, numMatchesSaved;
int noCase, patternLength;
const char *pattern;
Tcl_Obj *stringObj, *indexVarObj, *matchVarObj;
Tcl_Obj *const *savedObjv = objv;
Tcl_RegExp regExpr = NULL;
|
| ︙ | |||
3606 3607 3608 3609 3610 3611 3612 | 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 | - - - - - - |
"MODERESTRICTION", NULL);
return TCL_ERROR;
}
stringObj = objv[i];
objc -= i + 1;
objv += i + 1;
|
| ︙ | |||
3849 3850 3851 3852 3853 3854 3855 | 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - + - - - - + - - - - - - - - - - - - - - - - |
/*
* We've got a match. Find a body to execute, skipping bodies that are
* "-".
*/
matchFound:
|
| ︙ | |||
4295 4296 4297 4298 4299 4300 4301 | 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 | - + - |
/*
* Execute the body.
*/
Tcl_NRAddCallback(interp, TryPostBody, handlersObj, finallyObj,
(ClientData)objv, INT2PTR(objc));
|
| ︙ | |||
4511 4512 4513 4514 4515 4516 4517 | 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 | - + - | * arguments to [try] and so are still on the Tcl value stack. */ handlerBodyObj = info[4]; Tcl_NRAddCallback(interp, TryPostHandler, objv, options, info[0], INT2PTR((finallyObj == NULL) ? 0 : objc - 1)); Tcl_DecrRefCount(handlersObj); |
| ︙ | |||
4538 4539 4540 4541 4542 4543 4544 | 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 | - + - |
/*
* Process the finally clause.
*/
if (finallyObj != NULL) {
Tcl_NRAddCallback(interp, TryPostFinal, resultObj, options, cmdObj,
NULL);
|
| ︙ | |||
4618 4619 4620 4621 4622 4623 4624 | 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 | - - - + - |
}
/*
* Process the finally clause if it is present.
*/
if (finallyObj != NULL) {
|
| ︙ | |||
4751 4752 4753 4754 4755 4756 4757 | 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
*/
TclSmallAllocEx(interp, sizeof(ForIterData), iterPtr);
iterPtr->cond = objv[1];
iterPtr->body = objv[2];
iterPtr->next = NULL;
iterPtr->msg = "\n (\"while\" body line %d)";
|
Changes to generic/tclCompCmds.c.
| ︙ | |||
35 36 37 38 39 40 41 | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | - + - - + - + - - - - - - - - - - - - - - - - - - - - - - - - | unsigned char op, int code, int level, Tcl_Obj *returnOpts); static int IndexTailVarIfKnown(Tcl_Interp *interp, Tcl_Token *varTokenPtr, CompileEnv *envPtr); static int PushVarName(Tcl_Interp *interp, Tcl_Token *varTokenPtr, CompileEnv *envPtr, int flags, int *localIndexPtr, |
| ︙ | |||
152 153 154 155 156 157 158 | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | - |
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr, *valueTokenPtr;
int simpleVarName, isScalar, localIndex, numWords;
|
| ︙ | |||
181 182 183 184 185 186 187 | 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | - - + + - + |
* slot (entry in the array of local vars) if we are compiling a procedure
* body and if the name is simple text that does not include namespace
* qualifiers.
*/
varTokenPtr = TokenAfter(parsePtr->tokenPtr);
|
| ︙ | |||
247 248 249 250 251 252 253 | 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | - - - + + |
Tcl_Interp *interp, /* Used for looking up stuff. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
|
| ︙ | |||
279 280 281 282 283 284 285 | 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | - - - + + |
Tcl_Interp *interp, /* Used for looking up stuff. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
|
| ︙ | |||
372 373 374 375 376 377 378 | 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | - + - + - + |
Tcl_GetCommandFullName(interp, (Tcl_Command) cmdPtr, objPtr);
bytes = Tcl_GetStringFromObj(objPtr, &length);
cmdLit = TclRegisterNewCmdLiteral(envPtr, bytes, length);
TclSetCmdNameObj(interp, TclFetchLiteral(envPtr, cmdLit), cmdPtr);
TclEmitPush(cmdLit, envPtr);
TclDecrRefCount(objPtr);
if (localIndex >= 0) {
|
| ︙ | |||
486 487 488 489 490 491 492 | 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 | - - - + + |
Tcl_Interp *interp, /* Used for looking up stuff. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
|
| ︙ | |||
592 593 594 595 596 597 598 | 563 564 565 566 567 568 569 570 571 572 573 574 575 576 | - |
{
JumpFixup jumpFixup;
Tcl_Token *cmdTokenPtr, *resultNameTokenPtr, *optsNameTokenPtr;
const char *name;
int resultIndex, optsIndex, nameChars, range;
int initStackDepth = envPtr->currStackDepth;
int savedStackDepth;
|
| ︙ | |||
676 677 678 679 680 681 682 | 646 647 648 649 650 651 652 653 654 655 656 657 658 659 | - |
* Care has to be taken to make sure that substitution happens outside the
* catch range so that errors in the substitution are not caught.
* [Bug 219184]
* The reason for duplicating the script is that EVAL_STK would otherwise
* begin by undeflowing the stack below the mark set by BEGIN_CATCH4.
*/
|
| ︙ | |||
895 896 897 898 899 900 901 | 864 865 866 867 868 869 870 871 872 873 874 875 876 877 | - |
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr;
int numWords, i;
|
| ︙ | |||
935 936 937 938 939 940 941 | 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 | - + |
/*
* Remaining words (key path and value to set) can be handled normally.
*/
tokenPtr = TokenAfter(varTokenPtr);
numWords = parsePtr->numWords-1;
for (i=1 ; i<numWords ; i++) {
|
| ︙ | |||
958 959 960 961 962 963 964 | 926 927 928 929 930 931 932 933 934 935 936 937 938 939 | - |
Tcl_Interp *interp, /* Used for looking up stuff. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
|
| ︙ | |||
1024 1025 1026 1027 1028 1029 1030 | 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 | - + - - + - - + - |
return TclCompileBasic2Or3ArgCmd(interp, parsePtr, cmdPtr, envPtr);
}
/*
* Emit the key and the code to actually do the increment.
*/
|
| ︙ | |||
1153 1154 1155 1156 1157 1158 1159 | 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 | - + - |
/*
* Remaining words (the key path) can be handled normally.
*/
for (i=2 ; i<parsePtr->numWords ; i++) {
tokenPtr = TokenAfter(tokenPtr);
|
| ︙ | |||
1243 1244 1245 1246 1247 1248 1249 | 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 | - + - + |
}
PushLiteral(envPtr, "", 0);
Emit14Inst( INST_STORE_SCALAR, worker, envPtr);
TclEmitOpcode( INST_POP, envPtr);
tokenPtr = TokenAfter(parsePtr->tokenPtr);
for (i=1 ; i<parsePtr->numWords ; i+=2) {
|
| ︙ | |||
1267 1268 1269 1270 1271 1272 1273 | 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 | - - + |
Tcl_Interp *interp, /* Used for looking up stuff. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
|
| ︙ | |||
1305 1306 1307 1308 1309 1310 1311 | 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 | - + - + |
infoIndex = TclFindCompiledLocal(NULL, 0, 1, envPtr);
/*
* Get the first dictionary and verify that it is so.
*/
tokenPtr = TokenAfter(parsePtr->tokenPtr);
|
| ︙ | |||
1408 1409 1410 1411 1412 1413 1414 | 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 | - |
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr, /* Holds resulting instructions. */
int collect) /* Flag == TCL_EACH_COLLECT to collect and
* construct a new dictionary with the loop
* body result. */
{
|
| ︙ | |||
1517 1518 1519 1520 1521 1522 1523 | 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 | - + |
}
/*
* Get the dictionary and start the iteration. No catching of errors at
* this point.
*/
|
| ︙ | |||
1552 1553 1554 1555 1556 1557 1558 | 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 | - |
loopRange = DeclareExceptionRange(envPtr, LOOP_EXCEPTION_RANGE);
ExceptionRangeStarts(envPtr, loopRange);
/*
* Compile the loop body itself. It should be stack-neutral.
*/
|
| ︙ | |||
1659 1660 1661 1662 1663 1664 1665 | 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 | - |
Tcl_Interp *interp, /* Used for looking up stuff. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
|
| ︙ | |||
1765 1766 1767 1768 1769 1770 1771 | 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 | - + - |
* The list of variables to bind is stored in auxiliary data so that it
* can't be snagged by literal sharing and forced to shimmer dangerously.
*/
infoIndex = TclCreateAuxData(duiPtr, &tclDictUpdateInfoType, envPtr);
for (i=0 ; i<numVars ; i++) {
|
| ︙ | |||
1831 1832 1833 1834 1835 1836 1837 | 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 | - |
Tcl_Interp *interp, /* Used for looking up stuff. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
|
| ︙ | |||
1871 1872 1873 1874 1875 1876 1877 | 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 | - + |
/*
* Produce the string to concatenate onto the dictionary entry.
*/
tokenPtr = TokenAfter(tokenPtr);
for (i=2 ; i<parsePtr->numWords ; i++) {
|
| ︙ | |||
1895 1896 1897 1898 1899 1900 1901 | 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 | - |
Tcl_Interp *interp, /* Used for looking up stuff. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
|
| ︙ | |||
1923 1924 1925 1926 1927 1928 1929 | 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 | - - + + - |
if (!TclIsLocalScalar(name, nameChars)) {
return TclCompileBasic3ArgCmd(interp, parsePtr, cmdPtr, envPtr);
}
dictVarIndex = TclFindCompiledLocal(name, nameChars, 1, envPtr);
if (dictVarIndex < 0) {
return TclCompileBasic3ArgCmd(interp, parsePtr, cmdPtr, envPtr);
}
|
| ︙ | |||
2013 2014 2015 2016 2017 2018 2019 | 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 | - + |
if (gotPath) {
/*
* Case: Path into dict in LVT with empty body.
*/
tokenPtr = TokenAfter(varTokenPtr);
for (i=2 ; i<parsePtr->numWords-1 ; i++) {
|
| ︙ | |||
2042 2043 2044 2045 2046 2047 2048 | 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 | - + - + |
if (gotPath) {
/*
* Case: Path into dict in non-simple var with empty body.
*/
tokenPtr = varTokenPtr;
for (i=1 ; i<parsePtr->numWords-1 ; i++) {
|
| ︙ | |||
2097 2098 2099 2100 2101 2102 2103 | 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 | - + - + |
keysTmp = TclFindCompiledLocal(NULL, 0, 1, envPtr);
/*
* Issue instructions. First, the part to expand the dictionary.
*/
if (varNameTmp > -1) {
|
| ︙ | |||
2133 2134 2135 2136 2137 2138 2139 | 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 | - |
*/
range = DeclareExceptionRange(envPtr, CATCH_EXCEPTION_RANGE);
TclEmitInstInt4( INST_BEGIN_CATCH4, range, envPtr);
ExceptionRangeStarts(envPtr, range);
envPtr->currStackDepth++;
|
| ︙ | |||
2288 2289 2290 2291 2292 2293 2294 | 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 | - - + |
{
/*
* General syntax: [error message ?errorInfo? ?errorCode?]
* However, we only deal with the case where there is just a message.
*/
Tcl_Token *messageTokenPtr;
int savedStackDepth = envPtr->currStackDepth;
|
| ︙ | |||
2335 2336 2337 2338 2339 2340 2341 | 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 | - - - - - - - |
{
Tcl_Token *firstWordPtr;
if (parsePtr->numWords == 1) {
return TCL_ERROR;
}
|
| ︙ | |||
2379 2380 2381 2382 2383 2384 2385 | 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 | - |
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *startTokenPtr, *testTokenPtr, *nextTokenPtr, *bodyTokenPtr;
JumpFixup jumpEvalCondFixup;
int testCodeOffset, bodyCodeOffset, nextCodeOffset, jumpDist;
int bodyRange, nextRange;
int savedStackDepth = envPtr->currStackDepth;
|
| ︙ | |||
2422 2423 2424 2425 2426 2427 2428 | 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 | - |
bodyRange = DeclareExceptionRange(envPtr, LOOP_EXCEPTION_RANGE);
nextRange = TclCreateExceptRange(LOOP_EXCEPTION_RANGE, envPtr);
/*
* Inline compile the initial command.
*/
|
| ︙ | |||
2445 2446 2447 2448 2449 2450 2451 | 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 | - - - |
TclEmitForwardJump(envPtr, TCL_UNCONDITIONAL_JUMP, &jumpEvalCondFixup);
/*
* Compile the loop body.
*/
bodyCodeOffset = ExceptionRangeStarts(envPtr, bodyRange);
|
| ︙ | |||
2587 2588 2589 2590 2591 2592 2593 | 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 | - + - |
* iteration count. */
int collectVar = -1; /* Index of temp var holding the result var
* index. */
Tcl_Token *tokenPtr, *bodyTokenPtr;
unsigned char *jumpPc;
JumpFixup jumpFalseFixup;
|
| ︙ | |||
2628 2629 2630 2631 2632 2633 2634 | 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 | - - |
tokenPtr = TokenAfter(tokenPtr);
}
bodyTokenPtr = tokenPtr;
if (bodyTokenPtr->type != TCL_TOKEN_SIMPLE_WORD) {
return TCL_ERROR;
}
|
| ︙ | |||
2773 2774 2775 2776 2777 2778 2779 | 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 | - |
*/
loopIndex = 0;
for (i = 0, tokenPtr = parsePtr->tokenPtr;
i < numWords-1;
i++, tokenPtr = TokenAfter(tokenPtr)) {
if ((i%2 == 0) && (i > 0)) {
|
| ︙ | |||
2811 2812 2813 2814 2815 2816 2817 | 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 | - |
TclEmitInstInt4( INST_FOREACH_STEP4, infoIndex, envPtr);
TclEmitForwardJump(envPtr, TCL_FALSE_JUMP, &jumpFalseFixup);
/*
* Inline compile the loop body.
*/
|
| ︙ | |||
3067 3068 3069 3070 3071 3072 3073 | 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 | - |
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
|
| ︙ | |||
3216 3217 3218 3219 3220 3221 3222 | 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 | - + | /* * Push the code to produce the string that would be * substituted with %s, except we'll be concatenating * directly. */ |
| ︙ | |||
3288 3289 3290 3291 3292 3293 3294 | 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 | - |
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr;
int localIndex, numWords, i;
|
| ︙ | |||
3321 3322 3323 3324 3325 3326 3327 | 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 | - + |
for (i=2; i<=numWords; varTokenPtr = TokenAfter(varTokenPtr),i++) {
localIndex = IndexTailVarIfKnown(interp, varTokenPtr, envPtr);
if (localIndex < 0) {
return TCL_ERROR;
}
|
| ︙ | |||
3380 3381 3382 3383 3384 3385 3386 | 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 | - |
/* Saved stack depth at the start of the first
* test; the envPtr current depth is restored
* to this value at the start of each test. */
int realCond = 1; /* Set to 0 for static conditions:
* "if 0 {..}" */
int boolVal; /* Value of static condition. */
int compileScripts = 1;
|
| ︙ | |||
3457 3458 3459 3460 3461 3462 3463 | 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 | - |
*/
realCond = 0;
if (!boolVal) {
compileScripts = 0;
}
} else {
|
| ︙ | |||
3499 3500 3501 3502 3503 3504 3505 | 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 | - |
}
/*
* Compile the "then" command body.
*/
if (compileScripts) {
|
| ︙ | |||
3587 3588 3589 3590 3591 3592 3593 | 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 | - |
}
if (compileScripts) {
/*
* Compile the else command body.
*/
|
| ︙ | |||
3681 3682 3683 3684 3685 3686 3687 | 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 | - - - + + |
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr, *incrTokenPtr;
int simpleVarName, isScalar, localIndex, haveImmValue, immValue;
|
| ︙ | |||
3717 3718 3719 3720 3721 3722 3723 | 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 | - |
if ((code == TCL_OK) && (-127 <= immValue) && (immValue <= 127)) {
haveImmValue = 1;
}
if (!haveImmValue) {
PushLiteral(envPtr, word, numBytes);
}
} else {
|
| ︙ | |||
3796 3797 3798 3799 3800 3801 3802 | 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 | - |
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr)
{
|
| ︙ | |||
3834 3835 3836 3837 3838 3839 3840 | 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 | - + |
Tcl_DecrRefCount(objPtr);
/*
* Confirmed as a literal that will not frighten the horses. Compile. Note
* that the result needs to be list-ified.
*/
|
| ︙ | |||
3883 3884 3885 3886 3887 3888 3889 | 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 | - - - + + |
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr;
int isScalar, simpleVarName, localIndex;
|
| ︙ | |||
3946 3947 3948 3949 3950 3951 3952 | 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 | - - - - + - |
* Not much to do; we compile to a single instruction...
*/
TclEmitOpcode( INST_INFO_LEVEL_NUM, envPtr);
} else if (parsePtr->numWords != 2) {
return TCL_ERROR;
} else {
|
| ︙ | |||
4011 4012 4013 4014 4015 4016 4017 | 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 | - + - - + |
}
tokenPtr = TokenAfter(tokenPtr);
/*
* Issue the code.
*/
|
| ︙ | |||
4065 4066 4067 4068 4069 4070 4071 | 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 | - |
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr;
int simpleVarName, isScalar, localIndex, numWords;
|
| ︙ | |||
4097 4098 4099 4100 4101 4102 4103 | 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 | - - + + - + |
* frame slot (entry in the array of local vars) if we are compiling a
* procedure body and if the name is simple text that does not include
* namespace qualifiers.
*/
varTokenPtr = TokenAfter(parsePtr->tokenPtr);
|
| ︙ | |||
4168 4169 4170 4171 4172 4173 4174 | 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 | - - + - - + + |
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr;
int simpleVarName, isScalar, localIndex, numWords, idx;
|
| ︙ | |||
4277 4278 4279 4280 4281 4282 4283 | 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 | - |
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *idxTokenPtr, *valTokenPtr;
int i, numWords = parsePtr->numWords;
|
| ︙ | |||
4321 4322 4323 4324 4325 4326 4327 | 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 | - + - + | * these constructs: * lindex <arbitraryValue> <posInt> * lindex <arbitraryValue> end-<posInt> * This is best compiled as a push of the arbitrary value followed * by an "immediate lindex" which is the most efficient variety. */ |
| ︙ | |||
4383 4384 4385 4386 4387 4388 4389 | 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 | - |
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
|
| ︙ | |||
4409 4410 4411 4412 4413 4414 4415 | 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 | - + |
/*
* Push the all values onto the stack.
*/
numWords = parsePtr->numWords;
valueTokenPtr = TokenAfter(parsePtr->tokenPtr);
for (i = 1; i < numWords; i++) {
|
| ︙ | |||
4446 4447 4448 4449 4450 4451 4452 | 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 | - - + |
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr;
|
| ︙ | |||
4479 4480 4481 4482 4483 4484 4485 | 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 | - |
Tcl_Parse *parsePtr, /* Points to a parse structure for the
* command. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds the resulting instructions. */
{
Tcl_Token *tokenPtr, *listTokenPtr;
|
| ︙ | |||
4548 4549 4550 4551 4552 4553 4554 | 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 | - + |
/*
* Issue instructions. It's not safe to skip doing the LIST_RANGE, as
* we've not proved that the 'list' argument is really a list. Not that it
* is worth trying to do that given current knowledge.
*/
|
| ︙ | |||
4578 4579 4580 4581 4582 4583 4584 | 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 | - |
Tcl_Parse *parsePtr, /* Points to a parse structure for the
* command. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds the resulting instructions. */
{
Tcl_Token *tokenPtr, *listTokenPtr;
|
| ︙ | |||
4666 4667 4668 4669 4670 4671 4672 | 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 | - + |
/*
* Issue instructions. It's not safe to skip doing the LIST_RANGE, as
* we've not proved that the 'list' argument is really a list. Not that it
* is worth trying to do that given current knowledge.
*/
|
| ︙ | |||
4735 4736 4737 4738 4739 4740 4741 | 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 | - |
* code burst. */
Tcl_Token *varTokenPtr; /* Pointer to the Tcl_Token representing the
* parse of the variable name. */
int localIndex; /* Index of var in local var table. */
int simpleVarName; /* Flag == 1 if var name is simple. */
int isScalar; /* Flag == 1 if scalar, 0 if array. */
int i;
|
| ︙ | |||
4758 4759 4760 4761 4762 4763 4764 | 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 | - - + + - + |
* to emit code to compute and push the name at runtime. We use a frame
* slot (entry in the array of local vars) if we are compiling a procedure
* body and if the name is simple text that does not include namespace
* qualifiers.
*/
varTokenPtr = TokenAfter(parsePtr->tokenPtr);
|
| ︙ | |||
4935 4936 4937 4938 4939 4940 4941 | 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 | - |
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr;
|
| ︙ | |||
4970 4971 4972 4973 4974 4975 4976 | 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 | - + - - + |
* name directly here, because TclOO plays complex games with namespaces;
* the value needs to be determined at runtime for safety.
*/
PushLiteral(envPtr, "::namespace", 11);
PushLiteral(envPtr, "inscope", 7);
TclEmitOpcode( INST_NS_CURRENT, envPtr);
|
| ︙ | |||
5021 5022 5023 5024 5025 5026 5027 | 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 | - - + |
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr = TokenAfter(parsePtr->tokenPtr);
|
| ︙ | |||
5059 5060 5061 5062 5063 5064 5065 | 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 | - - + - - - + + + |
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr, *otherTokenPtr, *localTokenPtr;
int simpleVarName, isScalar, localIndex, numWords, i;
|
| ︙ | |||
5120 5121 5122 5123 5124 5125 5126 | 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 | - |
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
|
| ︙ | |||
5152 5153 5154 5155 5156 5157 5158 | 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 | - + |
idx++;
}
/*
* Issue the bytecode.
*/
|
| ︙ | |||
5188 5189 5190 5191 5192 5193 5194 | 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 | - |
* compiled. */
CompileEnv *envPtr) /* Holds the resulting instructions. */
{
Tcl_Token *varTokenPtr; /* Pointer to the Tcl_Token representing the
* parse of the RE or string. */
int i, len, nocase, exact, sawLast, simple;
const char *str;
|
| ︙ | |||
5291 5292 5293 5294 5295 5296 5297 | 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 | - + - + |
simple = 1;
PushLiteral(envPtr, Tcl_DStringValue(&ds),Tcl_DStringLength(&ds));
Tcl_DStringFree(&ds);
}
}
if (!simple) {
|
| ︙ | |||
5369 5370 5371 5372 5373 5374 5375 | 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 | - |
* In short, we look for:
*
* regsub -all [--] simpleRE string simpleReplacement
*
* The only optional part is the "--", and no other options are handled.
*/
|
| ︙ | |||
5482 5483 5484 5485 5486 5487 5488 | 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 | - + |
*/
result = TCL_OK;
bytes = Tcl_DStringValue(&pattern) + 1;
PushLiteral(envPtr, bytes, len);
bytes = Tcl_GetStringFromObj(replacementObj, &len);
PushLiteral(envPtr, bytes, len);
|
| ︙ | |||
5534 5535 5536 5537 5538 5539 5540 | 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 | - - - + + |
int level, code, objc, size, status = TCL_OK;
int numWords = parsePtr->numWords;
int explicitResult = (0 == (numWords % 2));
int numOptionWords = numWords - 1 - explicitResult;
int savedStackDepth = envPtr->currStackDepth;
Tcl_Obj *returnOpts, **objv;
Tcl_Token *wordTokenPtr = TokenAfter(parsePtr->tokenPtr);
|
| ︙ | |||
5604 5605 5606 5607 5608 5609 5610 | 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 | - + |
/*
* All options are known at compile time, so we're going to bytecompile.
* Emit instructions to push the result on the stack.
*/
if (explicitResult) {
|
| ︙ | |||
5687 5688 5689 5690 5691 5692 5693 | 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 | - - + |
Tcl_Interp *interp,
CompileEnv *envPtr)
{
Tcl_Obj *msg = Tcl_GetObjResult(interp);
int numBytes;
const char *bytes = TclGetStringFromObj(msg, &numBytes);
|
| ︙ | |||
5722 5723 5724 5725 5726 5727 5728 | 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 | - |
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr, *otherTokenPtr, *localTokenPtr;
int simpleVarName, isScalar, localIndex, numWords, i;
|
| ︙ | |||
5758 5759 5760 5761 5762 5763 5764 | 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 | - + |
newTypePtr = objPtr->typePtr;
Tcl_DecrRefCount(objPtr);
if (newTypePtr != typePtr) {
if (numWords%2) {
return TCL_ERROR;
}
|
| ︙ | |||
5783 5784 5785 5786 5787 5788 5789 | 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 | - - - + + + |
* local variable, return an error so that the non-compiled command will
* be called at runtime.
*/
for (; i<=numWords; i+=2, otherTokenPtr = TokenAfter(localTokenPtr)) {
localTokenPtr = TokenAfter(otherTokenPtr);
|
| ︙ | |||
5831 5832 5833 5834 5835 5836 5837 | 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 | - |
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr, *valueTokenPtr;
int localIndex, numWords, i;
|
| ︙ | |||
5861 5862 5863 5864 5865 5866 5867 | 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 | - + - + |
localIndex = IndexTailVarIfKnown(interp, varTokenPtr, envPtr);
if (localIndex < 0) {
return TCL_ERROR;
}
|
| ︙ | |||
6069 6070 6071 6072 6073 6074 6075 | 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 | - + - - - |
PushVarName(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Token *varTokenPtr, /* Points to a variable token. */
CompileEnv *envPtr, /* Holds resulting instructions. */
int flags, /* TCL_NO_LARGE_INDEX | TCL_NO_ELEMENT. */
int *localIndexPtr, /* Must not be NULL. */
int *simpleVarNamePtr, /* Must not be NULL. */
|
| ︙ | |||
6253 6254 6255 6256 6257 6258 6259 | 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 | - - - - - |
/*
* Compile the element script, if any, and only if not inhibited. [Bug
* 3600328]
*/
if (elName != NULL && !(flags & TCL_NO_ELEMENT)) {
if (elNameChars) {
|
| ︙ |
Changes to generic/tclCompCmdsSZ.c.
| ︙ | |||
26 27 28 29 30 31 32 | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | - + - - + - - + - - + - - + - | static void FreeJumptableInfo(ClientData clientData); static void PrintJumptableInfo(ClientData clientData, Tcl_Obj *appendObj, ByteCode *codePtr, unsigned int pcOffset); static int PushVarName(Tcl_Interp *interp, Tcl_Token *varTokenPtr, CompileEnv *envPtr, int flags, int *localIndexPtr, |
| ︙ | |||
77 78 79 80 81 82 83 | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | - - - - - - - - - - - - - - - - - - - - - - - - |
*/
#define CompileWord(envPtr, tokenPtr, interp, word) \
if ((tokenPtr)->type == TCL_TOKEN_SIMPLE_WORD) { \
TclEmitPush(TclRegisterNewLiteral((envPtr), (tokenPtr)[1].start, \
(tokenPtr)[1].size), (envPtr)); \
} else { \
|
| ︙ | |||
134 135 136 137 138 139 140 | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | - + |
#define OP1(name,val) TclEmitInstInt1(INST_##name,(val),envPtr)
#define OP4(name,val) TclEmitInstInt4(INST_##name,(val),envPtr)
#define OP14(name,val1,val2) \
TclEmitInstInt1(INST_##name,(val1),envPtr);TclEmitInt4((val2),envPtr)
#define OP44(name,val1,val2) \
TclEmitInstInt4(INST_##name,(val1),envPtr);TclEmitInt4((val2),envPtr)
#define BODY(token,index) \
|
| ︙ | |||
175 176 177 178 179 180 181 | 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | - - - + + |
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr, *valueTokenPtr;
int isAssignment, isScalar, simpleVarName, localIndex, numWords;
|
| ︙ | |||
272 273 274 275 276 277 278 | 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | - |
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
|
| ︙ | |||
304 305 306 307 308 309 310 | 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | - |
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
|
| ︙ | |||
336 337 338 339 340 341 342 | 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | - |
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
|
| ︙ | |||
368 369 370 371 372 373 374 | 335 336 337 338 339 340 341 342 343 344 345 346 347 348 | - |
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
|
| ︙ | |||
400 401 402 403 404 405 406 | 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | - |
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
|
| ︙ | |||
428 429 430 431 432 433 434 | 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | - |
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
|
| ︙ | |||
482 483 484 485 486 487 488 | 446 447 448 449 450 451 452 453 454 455 456 457 458 459 | - |
Tcl_IncrRefCount(copy);
exactMatch = TclMatchIsTrivial(TclGetString(copy));
TclDecrRefCount(copy);
}
PushLiteral(envPtr, str, length);
} else {
|
| ︙ | |||
509 510 511 512 513 514 515 | 472 473 474 475 476 477 478 479 480 481 482 483 484 485 | - |
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
|
| ︙ | |||
532 533 534 535 536 537 538 | 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 | - - |
char buf[TCL_INTEGER_SPACE];
int len = Tcl_GetCharLength(objPtr);
len = sprintf(buf, "%d", len);
PushLiteral(envPtr, buf, len);
} else {
|
| ︙ | |||
612 613 614 615 616 617 618 | 572 573 574 575 576 577 578 579 580 581 582 583 584 585 | - |
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
|
| ︙ | |||
727 728 729 730 731 732 733 | 686 687 688 689 690 691 692 693 694 695 696 697 698 699 | - |
{
int numArgs = parsePtr->numWords - 1;
int numOpts = numArgs - 1;
int objc, flags = TCL_SUBST_ALL;
Tcl_Obj **objv/*, *toSubst = NULL*/;
Tcl_Token *wordTokenPtr = TokenAfter(parsePtr->tokenPtr);
int code = TCL_ERROR;
|
| ︙ | |||
771 772 773 774 775 776 777 | 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 | - - + - - + |
TclDecrRefCount(objv[objc]);
}
TclStackFree(interp, objv);
if (/*toSubst == NULL*/ code != TCL_OK) {
return TCL_ERROR;
}
|
| ︙ | |||
821 822 823 824 825 826 827 | 777 778 779 780 781 782 783 784 785 786 787 788 789 790 | - - |
JumpFixup continueFixup, otherFixup, endFixup;
switch (tokenPtr->type) {
case TCL_TOKEN_TEXT:
literal = TclRegisterNewLiteral(envPtr,
tokenPtr->start, tokenPtr->size);
TclEmitPush(literal, envPtr);
|
| ︙ | |||
855 856 857 858 859 860 861 | 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 | - - |
}
}
if (foundCommand) {
break;
}
}
|
| ︙ | |||
886 887 888 889 890 891 892 | 838 839 840 841 842 843 844 845 846 847 848 849 850 851 | - |
/* Start */
if (TclFixupForwardJumpToHere(envPtr, &startFixup, 127)) {
Tcl_Panic("TclCompileSubstCmd: bad start jump distance %d",
(int) (CurrentOffset(envPtr) - startFixup.codeOffset));
}
}
|
| ︙ | |||
1003 1004 1005 1006 1007 1008 1009 | 954 955 956 957 958 959 960 961 962 963 964 965 966 967 | - |
}
/* CONTINUE jump to here */
if (TclFixupForwardJumpToHere(envPtr, &endFixup, 127)) {
Tcl_Panic("TclCompileSubstCmd: bad end jump distance %d",
(int) (CurrentOffset(envPtr) - endFixup.codeOffset));
}
|
| ︙ | |||
1070 1071 1072 1073 1074 1075 1076 | 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 | - - - - - |
Tcl_Token *valueTokenPtr; /* Token for the value to switch on. */
enum {Switch_Exact, Switch_Glob, Switch_Regexp} mode;
/* What kind of switch are we doing? */
Tcl_Token *bodyTokenArray; /* Array of real pattern list items. */
Tcl_Token **bodyToken; /* Array of pointers to pattern list items. */
|
| ︙ | |||
1217 1218 1219 1220 1221 1222 1223 | 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
* causes a crash during exception handling). When multiple tokens are
* available at this point, this is pretty easy.
*/
if (numWords == 1) {
const char *bytes;
int maxLen, numBytes;
|
| ︙ | |||
1340 1341 1342 1343 1344 1345 1346 | 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 | - - + + - - + + - - - |
* Check if we can generate a jump table, since if so that's faster than
* doing an explicit compare with each body. Note that we're definitely
* over-conservative with determining whether we can do the jump table,
* but it handles the most common case well enough.
*/
if (mode == Switch_Exact) {
|
| ︙ | |||
1383 1384 1385 1386 1387 1388 1389 | 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 | - - - - + - - - |
*----------------------------------------------------------------------
*/
static void
IssueSwitchChainedTests(
Tcl_Interp *interp, /* Context for compiling script bodies. */
CompileEnv *envPtr, /* Holds resulting instructions. */
|
| ︙ | |||
1418 1419 1420 1421 1422 1423 1424 | 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 | - |
int simple, exact; /* For extracting the type of regexp. */
int i;
/*
* First, we push the value we're matching against on the stack.
*/
|
| ︙ | |||
1572 1573 1574 1575 1576 1577 1578 | 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 | - - | * Now do the actual compilation. Note that we do not use CompileBody * because we may have synthesized the tokens in a non-standard * pattern. */ OP( POP); envPtr->currStackDepth = savedStackDepth + 1; |
| ︙ | |||
1650 1651 1652 1653 1654 1655 1656 | 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 | - - - - + - - - - |
*----------------------------------------------------------------------
*/
static void
IssueSwitchJumpTable(
Tcl_Interp *interp, /* Context for compiling script bodies. */
CompileEnv *envPtr, /* Holds resulting instructions. */
|
| ︙ | |||
1778 1779 1780 1781 1782 1783 1784 | 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 | - - | mustGenerate = 0; /* * Compile the body of the arm. */ envPtr->currStackDepth = savedStackDepth; |
| ︙ | |||
1940 1941 1942 1943 1944 1945 1946 | 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 | - |
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
|
| ︙ | |||
1986 1987 1988 1989 1990 1991 1992 | 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 | - |
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Parse *parsePtr, /* Points to a parse structure for the command
* created by Tcl_ParseCommand. */
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
|
| ︙ | |||
2119 2120 2121 2122 2123 2124 2125 | 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 | - - |
bodyToken = TokenAfter(parsePtr->tokenPtr);
if (numWords == 2) {
/*
* No handlers or finally; do nothing beyond evaluating the body.
*/
|
| ︙ | |||
2335 2336 2337 2338 2339 2340 2341 | 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 | - |
int numHandlers,
int *matchCodes,
Tcl_Obj **matchClauses,
int *resultVars,
int *optionVars,
Tcl_Token **handlerTokens)
{
|
| ︙ | |||
2489 2490 2491 2492 2493 2494 2495 | 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 | - |
int *matchCodes,
Tcl_Obj **matchClauses,
int *resultVars,
int *optionVars,
Tcl_Token **handlerTokens,
Tcl_Token *finallyToken) /* Not NULL */
{
|
| ︙ | |||
2729 2730 2731 2732 2733 2734 2735 | 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 | - |
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *varTokenPtr;
int isScalar, simpleVarName, localIndex, numWords, flags, i;
Tcl_Obj *leadingWord;
|
| ︙ | |||
2767 2768 2769 2770 2771 2772 2773 | 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 | - - + + | * Decide if we can use a frame slot for the var/array name or if we * need to emit code to compute and push the name at runtime. We use a * frame slot (entry in the array of local vars) if we are compiling a * procedure body and if the name is simple text that does not include * namespace qualifiers. */ |
| ︙ | |||
2830 2831 2832 2833 2834 2835 2836 | 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 | - |
Tcl_Token *testTokenPtr, *bodyTokenPtr;
JumpFixup jumpEvalCondFixup;
int testCodeOffset, bodyCodeOffset, jumpDist, range, code, boolVal;
int savedStackDepth = envPtr->currStackDepth;
int loopMayEnd = 1; /* This is set to 0 if it is recognized as an
* infinite loop. */
Tcl_Obj *boolObj;
|
| ︙ | |||
2918 2919 2920 2921 2922 2923 2924 | 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 | - - |
testCodeOffset = CurrentOffset(envPtr);
}
/*
* Compile the loop body.
*/
|
| ︙ | |||
3009 3010 3011 3012 3013 3014 3015 | 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 | - |
if (parsePtr->numWords < 1 || parsePtr->numWords > 2) {
return TCL_ERROR;
}
if (parsePtr->numWords == 1) {
PushLiteral(envPtr, "", 0);
} else {
|
| ︙ | |||
3045 3046 3047 3048 3049 3050 3051 | 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 | - + - - - |
PushVarName(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Token *varTokenPtr, /* Points to a variable token. */
CompileEnv *envPtr, /* Holds resulting instructions. */
int flags, /* TCL_NO_LARGE_INDEX. */
int *localIndexPtr, /* Must not be NULL. */
int *simpleVarNamePtr, /* Must not be NULL. */
|
| ︙ | |||
3228 3229 3230 3231 3232 3233 3234 | 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 | - - - - |
/*
* Compile the element script, if any.
*/
if (elName != NULL) {
if (elNameChars) {
|
| ︙ | |||
3284 3285 3286 3287 3288 3289 3290 | 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 | - |
CompileUnaryOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
int instruction,
CompileEnv *envPtr)
{
Tcl_Token *tokenPtr;
|
| ︙ | |||
3326 3327 3328 3329 3330 3331 3332 | 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 | - |
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
const char *identity,
int instruction,
CompileEnv *envPtr)
{
Tcl_Token *tokenPtr = parsePtr->tokenPtr;
|
| ︙ | |||
3410 3411 3412 3413 3414 3415 3416 | 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 | - |
CompileComparisonOpCmd(
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
int instruction,
CompileEnv *envPtr)
{
Tcl_Token *tokenPtr;
|
| ︙ | |||
3576 3577 3578 3579 3580 3581 3582 | 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 | - |
{
/*
* This one has its own implementation because the ** operator is the only
* one with right associativity.
*/
Tcl_Token *tokenPtr = parsePtr->tokenPtr;
|
| ︙ | |||
3746 3747 3748 3749 3750 3751 3752 | 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 | - |
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr)
{
Tcl_Token *tokenPtr = parsePtr->tokenPtr;
|
| ︙ | |||
3791 3792 3793 3794 3795 3796 3797 | 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 | - |
Tcl_Interp *interp,
Tcl_Parse *parsePtr,
Command *cmdPtr, /* Points to defintion of command being
* compiled. */
CompileEnv *envPtr)
{
Tcl_Token *tokenPtr = parsePtr->tokenPtr;
|
| ︙ |
Changes to generic/tclCompExpr.c.
| ︙ | |||
2138 2139 2140 2141 2142 2143 2144 | 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 | - - - - | * Valid parse; compile the tree. */ int objc; Tcl_Obj *const *litObjv; Tcl_Obj **funcObjv; |
| ︙ | |||
2195 2196 2197 2198 2199 2200 2201 | 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 | - + |
/*
* Note we are compiling an expression with literal arguments. This means
* there can be no [info frame] calls when we execute the resulting
* bytecode, so there's no need to tend to TIP 280 issues.
*/
envPtr = TclStackAlloc(interp, sizeof(CompileEnv));
|
| ︙ |
Changes to generic/tclCompile.c.
| ︙ | |||
560 561 562 563 564 565 566 | 560 561 562 563 564 565 566 567 568 569 570 571 572 573 | - - - - - - - - - - - | static void RegisterAuxDataType(const AuxDataType *typePtr); static int SetByteCodeFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); static int FormatInstruction(ByteCode *codePtr, const unsigned char *pc, Tcl_Obj *bufferObj); static void PrintSourceToObj(Tcl_Obj *appendObj, const char *stringPtr, int maxChars); |
| ︙ | |||
598 599 600 601 602 603 604 | 587 588 589 590 591 592 593 594 595 596 597 598 599 600 | - - - - - - - - - - - - |
"substcode", /* name */
FreeSubstCodeInternalRep, /* freeIntRepProc */
DupByteCodeInternalRep, /* dupIntRepProc - shared with bytecode */
NULL, /* updateStringProc */
NULL, /* setFromAnyProc */
};
|
| ︙ | |||
645 646 647 648 649 650 651 | 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 | - - - - - - - - - + - - - - - - - - |
TclSetByteCodeFromAny(
Tcl_Interp *interp, /* The interpreter for which the code is being
* compiled. Must not be NULL. */
Tcl_Obj *objPtr, /* The object to make a ByteCode object. */
CompileHookProc *hookProc, /* Procedure to invoke after compilation. */
ClientData clientData) /* Hook procedure private data. */
{
|
| ︙ | |||
850 851 852 853 854 855 856 | 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 | - - + |
*/
void
TclCleanupByteCode(
register ByteCode *codePtr) /* Points to the ByteCode to free. */
{
Tcl_Interp *interp = (Tcl_Interp *) *codePtr->interpHandle;
|
| ︙ | |||
940 941 942 943 944 945 946 | 900 901 902 903 904 905 906 907 908 909 910 911 912 913 | - - - - - - - - - - - - - - - - - - |
auxDataPtr = codePtr->auxDataArrayPtr;
for (i = 0; i < numAuxDataItems; i++) {
if (auxDataPtr->type->freeProc != NULL) {
auxDataPtr->type->freeProc(auxDataPtr->clientData);
}
auxDataPtr++;
|
| ︙ | |||
1082 1083 1084 1085 1086 1087 1088 | 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 | - - + - + |
}
}
if (objPtr->typePtr != &substCodeType) {
CompileEnv compEnv;
int numBytes;
const char *bytes = Tcl_GetStringFromObj(objPtr, &numBytes);
|
| ︙ | |||
1137 1138 1139 1140 1141 1142 1143 | 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 | - - - - - - - - - - - - - - - - - - - - - |
objPtr->typePtr = NULL;
codePtr->refCount--;
if (codePtr->refCount <= 0) {
TclCleanupByteCode(codePtr);
}
}
|
| ︙ | |||
1183 1184 1185 1186 1187 1188 1189 | 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 | - + - - - |
void
TclInitCompileEnv(
Tcl_Interp *interp, /* The interpreter for which a CompileEnv
* structure is initialized. */
register CompileEnv *envPtr,/* Points to the CompileEnv structure to
* initialize. */
const char *stringPtr, /* The source string to be compiled. */
|
| ︙ | |||
1222 1223 1224 1225 1226 1227 1228 | 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
envPtr->mallocedExceptArray = 0;
envPtr->cmdMapPtr = envPtr->staticCmdMapSpace;
envPtr->cmdMapEnd = COMPILEENV_INIT_CMD_MAP_SIZE;
envPtr->mallocedCmdMap = 0;
envPtr->atCmdStart = 1;
|
| ︙ | |||
1432 1433 1434 1435 1436 1437 1438 | 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 | - - - - - - - - - - - - - - |
}
if (envPtr->mallocedCmdMap) {
ckfree(envPtr->cmdMapPtr);
}
if (envPtr->mallocedAuxDataArray) {
ckfree(envPtr->auxDataArrayPtr);
}
|
| ︙ | |||
1571 1572 1573 1574 1575 1576 1577 | 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 | - - - |
unsigned char *entryCodeNext = envPtr->codeNext;
const char *p, *next;
Namespace *cmdNsPtr;
Command *cmdPtr;
Tcl_Token *tokenPtr;
int bytesLeft, isFirstCmd, wordIdx, currCmdIndex, commandLength, objIndex;
Tcl_DString ds;
|
| ︙ | |||
1601 1602 1603 1604 1605 1606 1607 | 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 | - - - - - - - - - - - - - - |
/*
* Each iteration through the following loop compiles the next command
* from the script.
*/
p = script;
bytesLeft = numBytes;
|
| ︙ | |||
1706 1707 1708 1709 1710 1711 1712 | 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 | - - - - - - - - - - - - - - - - |
* started" so that the command range is correct in the bytecode.
*/
if (expand) {
TclEmitOpcode(INST_EXPAND_START, envPtr);
}
|
| ︙ | |||
1906 1907 1908 1909 1910 1911 1912 | 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 | - - - - - - - | * uplevel, etc. commands, should they encounter it * unmodified. We care only if the we are in a context * which already allows absolute counting. */ objIndex = TclRegisterNewLiteral(envPtr, tokenPtr[1].start, tokenPtr[1].size); |
| ︙ | |||
1942 1943 1944 1945 1946 1947 1948 | 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
* is being prepared and run, INST_EXPAND_STKTOP is not
* stack-neutral in general.
*/
TclEmitOpcode(INST_INVOKE_EXPANDED, envPtr);
TclAdjustStackDepth((1-wordIdx), envPtr);
} else if (wordIdx > 0) {
|
| ︙ | |||
2087 2088 2089 2090 2091 2092 2093 | 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 | - - - |
TclEmitPush(TclRegisterNewLiteral(envPtr, name, nameBytes), envPtr);
}
/*
* Emit instructions to load the variable.
*/
|
| ︙ | |||
2122 2123 2124 2125 2126 2127 2128 | 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 | - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
int count, /* Number of tokens to consider at tokenPtr.
* Must be at least 1. */
CompileEnv *envPtr) /* Holds the resulting instructions. */
{
Tcl_DString textBuffer; /* Holds concatenated chars from adjacent
* TCL_TOKEN_TEXT, TCL_TOKEN_BS tokens. */
char buffer[TCL_UTF_MAX];
|
| ︙ | |||
2264 2265 2266 2267 2268 2269 2270 | 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 | - - - - - |
*/
if (Tcl_DStringLength(&textBuffer) > 0) {
int literal = TclRegisterDStringLiteral(envPtr, &textBuffer);
TclEmitPush(literal, envPtr);
numObjsToConcat++;
|
| ︙ | |||
2291 2292 2293 2294 2295 2296 2297 | 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 | - - - - - - - - - |
* If the tokens yielded no instructions, push an empty string.
*/
if (envPtr->codeNext == entryCodeNext) {
TclEmitPush(TclRegisterNewLiteral(envPtr, "", 0), envPtr);
}
Tcl_DStringFree(&textBuffer);
|
| ︙ | |||
2509 2510 2511 2512 2513 2514 2515 | 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 | - + |
size_t auxDataArrayBytes, structureSize;
register unsigned char *p;
#ifdef TCL_COMPILE_DEBUG
unsigned char *nextPtr;
#endif
int numLitObjects = envPtr->literalArrayNext;
Namespace *namespacePtr;
|
| ︙ | |||
2646 2647 2648 2649 2650 2651 2652 | 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 | - - - - - - - - - |
* by making its internal rep point to the just compiled ByteCode.
*/
TclFreeIntRep(objPtr);
objPtr->internalRep.twoPtrValue.ptr1 = codePtr;
objPtr->typePtr = &tclByteCodeType;
|
| ︙ | |||
2964 2965 2966 2967 2968 2969 2970 | 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
cmdIndex);
}
cmdLocPtr = &envPtr->cmdMapPtr[cmdIndex];
cmdLocPtr->numSrcBytes = numSrcBytes;
cmdLocPtr->numCodeBytes = numCodeBytes;
}
|
| ︙ | |||
3475 3476 3477 3478 3479 3480 3481 | 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
rangePtr->catchOffset += 3;
break;
default:
Tcl_Panic("TclFixupForwardJump: bad ExceptionRange type %d",
rangePtr->type);
}
}
|
| ︙ | |||
4465 4466 4467 4468 4469 4470 4471 | 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
Tcl_AppendToObj(bufferObj, "\t\t[", -1);
auxPtr->type->printProc(auxPtr->clientData, bufferObj, codePtr,
pcOffset);
Tcl_AppendToObj(bufferObj, "]\n", -1);
}
return numBytes;
}
|
| ︙ |
Changes to generic/tclCompile.h.
| ︙ | |||
110 111 112 113 114 115 116 | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
typedef struct CmdLocation {
int codeOffset; /* Offset of first byte of command code. */
int numCodeBytes; /* Number of bytes for command's code. */
int srcOffset; /* Offset of first char of the command. */
int numSrcBytes; /* Number of command source chars. */
} CmdLocation;
|
| ︙ | |||
296 297 298 299 300 301 302 | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | - - - - - - - - - - - - - |
/* Initial storage of LiteralEntry array. */
ExceptionRange staticExceptArraySpace[COMPILEENV_INIT_EXCEPT_RANGES];
/* Initial ExceptionRange array storage. */
CmdLocation staticCmdMapSpace[COMPILEENV_INIT_CMD_MAP_SIZE];
/* Initial storage for cmd location map. */
AuxData staticAuxDataArraySpace[COMPILEENV_INIT_AUX_DATA_SIZE];
/* Initial storage for aux data array. */
|
| ︙ | |||
902 903 904 905 906 907 908 | 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 | - + - | /* *---------------------------------------------------------------- * Procedures exported by the engine to be used by tclBasic.c *---------------------------------------------------------------- */ |
| ︙ | |||
964 965 966 967 968 969 970 | 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 | - + | MODULE_SCOPE void TclFreeCompileEnv(CompileEnv *envPtr); MODULE_SCOPE void TclFreeJumpFixupArray(JumpFixupArray *fixupArrayPtr); MODULE_SCOPE void TclInitAuxDataTypeTable(void); MODULE_SCOPE void TclInitByteCodeObj(Tcl_Obj *objPtr, CompileEnv *envPtr); MODULE_SCOPE void TclInitCompileEnv(Tcl_Interp *interp, CompileEnv *envPtr, const char *string, |
| ︙ | |||
1004 1005 1006 1007 1008 1009 1010 | 950 951 952 953 954 955 956 957 958 959 960 961 962 963 | - - - - - - - - | Tcl_Obj *const objv[]); #ifdef TCL_COMPILE_DEBUG MODULE_SCOPE void TclVerifyGlobalLiteralTable(Interp *iPtr); MODULE_SCOPE void TclVerifyLocalLiteralTable(CompileEnv *envPtr); #endif MODULE_SCOPE int TclWordKnownAtCompileTime(Tcl_Token *tokenPtr, Tcl_Obj *valuePtr); |
| ︙ |
Changes to generic/tclDictObj.c.
| ︙ | |||
2371 2372 2373 2374 2375 2376 2377 | 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 | - |
static int
DictForNRCmd(
ClientData dummy,
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
{
|
| ︙ | |||
2441 2442 2443 2444 2445 2446 2447 | 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 | - + - |
/*
* Run the script.
*/
TclNRAddCallback(interp, DictForLoopCallback, searchPtr, keyVarObj,
valueVarObj, scriptObj);
|
| ︙ | |||
2523 2524 2525 2526 2527 2528 2529 | 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 | - + |
/*
* Run the script.
*/
TclNRAddCallback(interp, DictForLoopCallback, searchPtr, keyVarObj,
valueVarObj, scriptObj);
|
| ︙ | |||
2563 2564 2565 2566 2567 2568 2569 | 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 | - |
static int
DictMapNRCmd(
ClientData dummy,
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
{
|
| ︙ | |||
2642 2643 2644 2645 2646 2647 2648 | 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 | - + - |
TclDecrRefCount(valueObj);
/*
* Run the script.
*/
TclNRAddCallback(interp, DictMapLoopCallback, storagePtr, NULL,NULL,NULL);
|
| ︙ | |||
2665 2666 2667 2668 2669 2670 2671 | 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 | - |
static int
DictMapLoopCallback(
ClientData data[],
Tcl_Interp *interp,
int result)
{
|
| ︙ | |||
2732 2733 2734 2735 2736 2737 2738 | 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 | - + - |
TclDecrRefCount(valueObj);
/*
* Run the script.
*/
TclNRAddCallback(interp, DictMapLoopCallback, storagePtr, NULL,NULL,NULL);
|
| ︙ | |||
2893 2894 2895 2896 2897 2898 2899 | 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 | - |
static int
DictFilterCmd(
ClientData dummy,
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
{
|
| ︙ | |||
3077 3078 3079 3080 3081 3082 3083 | 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 | - - - - - + | Tcl_SetObjResult(interp, Tcl_ObjPrintf( "couldn't set value variable: \"%s\"", TclGetString(valueVarObj))); result = TCL_ERROR; goto abnormalResult; } |
| ︙ | |||
3180 3181 3182 3183 3184 3185 3186 | 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 | - |
static int
DictUpdateCmd(
ClientData clientData,
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
{
|
| ︙ | |||
3224 3225 3226 3227 3228 3229 3230 | 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 | - + |
*/
objPtr = Tcl_NewListObj(objc-3, objv+2);
Tcl_IncrRefCount(objPtr);
Tcl_IncrRefCount(objv[1]);
TclNRAddCallback(interp, FinalizeDictUpdate, objv[1], objPtr, NULL,NULL);
|
| ︙ | |||
3339 3340 3341 3342 3343 3344 3345 | 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 | - |
static int
DictWithCmd(
ClientData dummy,
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
{
|
| ︙ | |||
3363 3364 3365 3366 3367 3368 3369 | 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 | - - + - + |
keysPtr = TclDictWithInit(interp, dictPtr, objc-3, objv+2);
if (keysPtr == NULL) {
return TCL_ERROR;
}
Tcl_IncrRefCount(keysPtr);
/*
|
| ︙ |
Changes to generic/tclEnsemble.c.
| ︙ | |||
88 89 90 91 92 93 94 | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | - - - - - - |
NULL /* setFromAnyProc */
};
/*
* Copied from tclCompCmds.c
*/
|
| ︙ | |||
1911 1912 1913 1914 1915 1916 1917 | 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 | - + | } /* * Hand off to the target command. */ TclSkipTailcall(interp); |
| ︙ | |||
3144 3145 3146 3147 3148 3149 3150 | 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 | - - - - - - - - - - |
Command *cmdPtr,
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokPtr;
Tcl_Obj *objPtr, **words;
char *bytes;
int length, i, numWords, cmdLit;
|
| ︙ | |||
3224 3225 3226 3227 3228 3229 3230 | 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 | - - - - |
* compiled. */
CompileEnv *envPtr) /* Holds resulting instructions. */
{
Tcl_Token *tokenPtr;
Tcl_Obj *objPtr;
char *bytes;
int length, i, literal;
|
| ︙ |
Changes to generic/tclExecute.c.
| ︙ | |||
169 170 171 172 173 174 175 176 177 178 179 180 181 | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | + - |
* NR_TEBC
* Helpers for NR - non-recursive calls to TEBC
* Minimal data required to fully reconstruct the execution state.
*/
typedef struct TEBCdata {
ByteCode *codePtr; /* Constant until the BC returns */
Tcl_Obj *srcPtr;
/* -----------------------------------------*/
const unsigned char *pc; /* These fields are used on return TO this */
ptrdiff_t *catchTop; /* this level: they record the state when a */
int cleanup; /* new codePtr was received for NR */
Tcl_Obj *auxObjList; /* execution. */
int checkInterp;
|
| ︙ | |||
792 793 794 795 796 797 798 799 800 801 802 803 804 805 | 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |
ckfree(searchPtr);
dictPtr = objPtr->internalRep.twoPtrValue.ptr2;
TclDecrRefCount(dictPtr);
objPtr->typePtr = NULL;
}
static void UpdateStringOfBcSource(Tcl_Obj *objPtr);
static const Tcl_ObjType bcSourceType = {
"bcSource", /* name */
NULL, /* freeIntRepProc */
NULL, /* dupIntRepProc */
UpdateStringOfBcSource, /* updateStringProc */
NULL /* setFromAnyProc */
};
static void
UpdateStringOfBcSource(
Tcl_Obj *objPtr)
{
int len;
const char *bytes;
unsigned char *pc = objPtr->internalRep.twoPtrValue.ptr1;
ByteCode *codePtr = objPtr->internalRep.twoPtrValue.ptr2;
bytes = GetSrcInfoForPc(pc, codePtr, &len, NULL);
objPtr->bytes = (char *) ckalloc((unsigned) len + 1);
memcpy(objPtr->bytes, bytes, len);
objPtr->bytes[len] = '\0';
objPtr->length = len;
}
/*
*----------------------------------------------------------------------
*
* InitByteCodeExecution --
*
* This procedure is called once to initialize the Tcl bytecode
|
| ︙ | |||
1500 1501 1502 1503 1504 1505 1506 | 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 | - - - - - + |
|| (codePtr->nsPtr != namespacePtr)
|| (codePtr->nsEpoch != namespacePtr->resolverEpoch)
|| (codePtr->localCachePtr != iPtr->varFramePtr->localCachePtr)) {
FreeExprCodeInternalRep(objPtr);
}
}
if (objPtr->typePtr != &exprCodeType) {
|
| ︙ | |||
1630 1631 1632 1633 1634 1635 1636 | 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 | - + - - |
*
*----------------------------------------------------------------------
*/
ByteCode *
TclCompileObj(
Tcl_Interp *interp,
|
| ︙ | |||
1687 1688 1689 1690 1691 1692 1693 | 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - + - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
if (!(codePtr->flags & TCL_BYTECODE_PRECOMPILED) &&
(codePtr->procPtr == NULL) &&
(codePtr->localCachePtr != iPtr->varFramePtr->localCachePtr)){
goto recompileObj;
}
|
| ︙ | |||
1942 1943 1944 1945 1946 1947 1948 | 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 | - | * contains the result of executing the code or an error message. * * Side effects: * Almost certainly, depending on the ByteCode's instructions. * *---------------------------------------------------------------------- */ |
| ︙ | |||
1969 1970 1971 1972 1973 1974 1975 | 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 | - + + + + + - - - - - - - - - - - - - - - - - - - |
codePtr->refCount++;
/*
* Reserve the stack, setup the TEBCdataPtr (TD) and CallFrame
*
* The execution uses a unified stack: first a TEBCdata, immediately
|
| ︙ | |||
2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 | 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 | + |
* used too frequently
*/
TEBCdata *TD = data[0];
#define auxObjList (TD->auxObjList)
#define catchTop (TD->catchTop)
#define codePtr (TD->codePtr)
#define srcPtr (TD->srcPtr)
#define checkInterp (TD->checkInterp)
/* Indicates when a check of interp readyness is
* necessary. Set by CACHE_STACK_INFO() */
/*
* Globals: variables that store state, must remain valid at all times.
*/
|
| ︙ | |||
2111 2112 2113 2114 2115 2116 2117 | 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 | - - - - - - |
char cmdNameBuf[21];
#endif
#ifdef TCL_COMPILE_DEBUG
int starting = 1;
traceInstructions = (tclTraceExec == 3);
#endif
|
| ︙ | |||
2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 | 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 | + - - - - - - - - - - - |
TRACE_APPEND(("ERROR: yield outside coroutine\n"));
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"yield can only be called in a coroutine", -1));
Tcl_SetErrorCode(interp, "TCL", "COROUTINE", "ILLEGAL_YIELD",
NULL);
goto gotError;
}
NRE_ASSERT(!COR_IS_SUSPENDED(corPtr));
#ifdef TCL_COMPILE_DEBUG
TRACE_WITH_OBJ(("yield, result="), iPtr->objResultPtr);
if (traceInstructions) {
fprintf(stdout, "\n");
}
#endif
|
| ︙ | |||
2753 2754 2755 2756 2757 2758 2759 | 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 | - - - - - - + |
Tcl_DecrRefCount(objPtr);
NEXT_INST_F(5, 0, 0);
}
case INST_EXPR_STK: {
ByteCode *newCodePtr;
|
| ︙ | |||
2829 2830 2831 2832 2833 2834 2835 | 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 | - - - - - - - + + + + - - - - | fprintf(stdout, "\n"); fflush(stdout); } #endif /*TCL_COMPILE_DEBUG*/ /* * Finally, let TclEvalObjv handle the command. |
| ︙ | |||
2981 2982 2983 2984 2985 2986 2987 | 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 | - - - - - - - + |
copyObjv[0] = objPtr;
memcpy(copyObjv+1, objv+opnd, sizeof(Tcl_Obj *) * (objc - opnd));
for (i=1 ; i<objc-opnd+1 ; i++) {
Tcl_IncrRefCount(copyObjv[i]);
}
objPtr = copyPtr;
}
|
| ︙ | |||
6898 6899 6900 6901 6902 6903 6904 | 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 | - - + + |
goto abnormalReturn;
}
if ((result == TCL_ERROR) && !(iPtr->flags & ERR_ALREADY_LOGGED)) {
const unsigned char *pcBeg;
bytes = GetSrcInfoForPc(pc, codePtr, &length, &pcBeg);
DECACHE_STACK_INFO();
|
| ︙ | |||
7038 7039 7040 7041 7042 7043 7044 | 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 6926 6927 6928 6929 6930 6931 6932 | - - + |
fprintf(stderr,
"\nTclNRExecuteByteCode: abnormal return at pc %u: "
"stack top %d < entry stack top %d\n",
(unsigned)(pc - codePtr->codeStart),
(unsigned) CURR_DEPTH, (unsigned) 0);
Tcl_Panic("TclNRExecuteByteCode execution failure: end stack top < start stack top");
}
|
| ︙ | |||
7087 7088 7089 7090 7091 7092 7093 | 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 6976 6977 6978 6979 | - + - - + | pc += (opnd-1); PUSH_OBJECT(Tcl_NewStringObj(bytes, length)); goto instEvalStk; } } #undef codePtr |
| ︙ | |||
8676 8677 8678 8679 8680 8681 8682 | 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | * * Side effects: * The CmdFrame at *cfPtr is updated. * *---------------------------------------------------------------------- */ |
| ︙ |
Changes to generic/tclIOUtil.c.
| ︙ | |||
1797 1798 1799 1800 1801 1802 1803 | 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 | - - - - - + |
iPtr = (Interp *) interp;
oldScriptFile = iPtr->scriptFile;
iPtr->scriptFile = pathPtr;
Tcl_IncrRefCount(iPtr->scriptFile);
string = Tcl_GetStringFromObj(objPtr, &length);
|
| ︙ | |||
1933 1934 1935 1936 1937 1938 1939 | 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 | - - - - - + |
}
iPtr = (Interp *) interp;
oldScriptFile = iPtr->scriptFile;
iPtr->scriptFile = pathPtr;
Tcl_IncrRefCount(iPtr->scriptFile);
|
| ︙ |
Changes to generic/tclInt.decls.
| ︙ | |||
918 919 920 921 922 923 924 | 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 | - - - + + + - - - + + + - + |
}
declare 231 {
int TclGetNamespaceFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
Tcl_Namespace **nsPtrPtr)
}
# Bits and pieces of TIP#280's guts
|
| ︙ | |||
961 962 963 964 965 966 967 | 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 | - + - |
int skip, ProcErrorProc *errorProc)
}
declare 240 {
int TclNRRunCallbacks(Tcl_Interp *interp, int result,
struct NRE_callback *rootPtr)
}
declare 241 {
|
| ︙ |
Changes to generic/tclInt.h.
| ︙ | |||
1132 1133 1134 1135 1136 1137 1138 | 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | * reference. Part of TIP#257. */ #define FRAME_IS_OO_DEFINE 0x8 /* The frame is part of the inside workings of * the [oo::define] command; the clientData * field contains an Object reference that has * been confirmed to refer to a class. Part of * TIP#257. */ |
| ︙ | |||
1428 1429 1430 1431 1432 1433 1434 | 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 | - - - |
* increasing addresses. The member stackPtr points to the stackItems of the
* currently active execution stack.
*/
typedef struct CorContext {
struct CallFrame *framePtr;
struct CallFrame *varFramePtr;
|
| ︙ | |||
2010 2011 2012 2013 2014 2015 2016 | 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
Tcl_Obj *chanMsg; /* Error message set by channel drivers, for
* the propagation of arbitrary Tcl errors.
* This information, if present (chanMsg not
* NULL), takes precedence over a POSIX error
* code returned by a channel operation. */
/*
|
| ︙ | |||
2120 2121 2122 2123 2124 2125 2126 | 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 | - - - - - - - - - - + |
Tcl_Obj *asyncCancelMsg; /* Error message set by async cancel handler
* for the propagation of arbitrary Tcl
* errors. This information, if present
* (asyncCancelMsg not NULL), takes precedence
* over the default error messages returned by
* a script cancellation operation. */
|
| ︙ | |||
2734 2735 2736 2737 2738 2739 2740 | 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 | - + - | MODULE_SCOPE void TclSetTailcall(Tcl_Interp *interp, Tcl_Obj *tailcallPtr); MODULE_SCOPE void TclPushTailcallPoint(Tcl_Interp *interp); /* These two can be considered for the public api */ MODULE_SCOPE void TclMarkTailcall(Tcl_Interp *interp); MODULE_SCOPE void TclSkipTailcall(Tcl_Interp *interp); |
| ︙ | |||
2807 2808 2809 2810 2811 2812 2813 | 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 | - - - - - - - - - - - - - - - - - - - - - - - - - - | *---------------------------------------------------------------- */ MODULE_SCOPE void TclAppendBytesToByteArray(Tcl_Obj *objPtr, const unsigned char *bytes, int len); MODULE_SCOPE int TclNREvalCmd(Tcl_Interp *interp, Tcl_Obj *objPtr, int flags); |
| ︙ | |||
2908 2909 2910 2911 2912 2913 2914 | 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 | - - | MODULE_SCOPE int TclGetNumberFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, ClientData *clientDataPtr, int *typePtr); MODULE_SCOPE int TclGetOpenModeEx(Tcl_Interp *interp, const char *modeString, int *seekFlagPtr, int *binaryPtr); MODULE_SCOPE Tcl_Obj * TclGetProcessGlobalValue(ProcessGlobalValue *pgvPtr); |
| ︙ | |||
2965 2966 2967 2968 2969 2970 2971 | 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 | - | MODULE_SCOPE Tcl_Command TclMakeEnsemble(Tcl_Interp *interp, const char *name, const EnsembleImplMap map[]); MODULE_SCOPE int TclMaxListLength(const char *bytes, int numBytes, const char **endPtr); MODULE_SCOPE int TclMergeReturnOptions(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], Tcl_Obj **optionsPtrPtr, int *codePtr, int *levelPtr); |
| ︙ | |||
3072 3073 3074 3075 3076 3077 3078 | 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 | - + - - + - | int numBytes); MODULE_SCOPE int TclStringMatch(const char *str, int strLen, const char *pattern, int ptnLen, int flags); MODULE_SCOPE int TclStringMatchObj(Tcl_Obj *stringObj, Tcl_Obj *patternObj, int flags); MODULE_SCOPE Tcl_Obj * TclStringObjReverse(Tcl_Obj *objPtr); MODULE_SCOPE void TclSubstCompile(Tcl_Interp *interp, const char *bytes, |
| ︙ | |||
3112 3113 3114 3115 3116 3117 3118 | 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 | - - | MODULE_SCOPE Tcl_Obj * TclDisassembleByteCodeObj(Tcl_Obj *objPtr); MODULE_SCOPE int TclZlibInit(Tcl_Interp *interp); MODULE_SCOPE void * TclpThreadCreateKey(void); MODULE_SCOPE void TclpThreadDeleteKey(void *keyPtr); MODULE_SCOPE void TclpThreadSetMasterTSD(void *tsdKeyPtr, void *ptr); MODULE_SCOPE void * TclpThreadGetMasterTSD(void *tsdKeyPtr); |
| ︙ |
Changes to generic/tclIntDecls.h.
| ︙ | |||
550 551 552 553 554 555 556 | 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 | - + - - - + - | Tcl_Obj *part1Ptr, const char *part2, int flags, const char *msg, const int createPart1, const int createPart2, Var **arrayPtrPtr); /* 231 */ EXTERN int TclGetNamespaceFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Namespace **nsPtrPtr); |
| ︙ | |||
578 579 580 581 582 583 584 | 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 | - + | Tcl_Obj *procNameObj, int skip, ProcErrorProc *errorProc); /* 240 */ EXTERN int TclNRRunCallbacks(Tcl_Interp *interp, int result, struct NRE_callback *rootPtr); /* 241 */ EXTERN int TclNREvalObjEx(Tcl_Interp *interp, Tcl_Obj *objPtr, |
| ︙ | |||
843 844 845 846 847 848 849 | 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 | - - + + - + |
Tcl_Obj * (*tclTraceDictPath) (Tcl_Interp *interp, Tcl_Obj *rootPtr, int keyc, Tcl_Obj *const keyv[], int flags); /* 225 */
int (*tclObjBeingDeleted) (Tcl_Obj *objPtr); /* 226 */
void (*tclSetNsPath) (Namespace *nsPtr, int pathLength, Tcl_Namespace *pathAry[]); /* 227 */
void (*reserved228)(void);
int (*tclPtrMakeUpvar) (Tcl_Interp *interp, Var *otherP1Ptr, const char *myName, int myFlags, int index); /* 229 */
Var * (*tclObjLookupVar) (Tcl_Interp *interp, Tcl_Obj *part1Ptr, const char *part2, int flags, const char *msg, const int createPart1, const int createPart2, Var **arrayPtrPtr); /* 230 */
int (*tclGetNamespaceFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Namespace **nsPtrPtr); /* 231 */
|
| ︙ | |||
1255 1256 1257 1258 1259 1260 1261 | 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 | - - + - - + | /* Slot 228 is reserved */ #define TclPtrMakeUpvar \ (tclIntStubsPtr->tclPtrMakeUpvar) /* 229 */ #define TclObjLookupVar \ (tclIntStubsPtr->tclObjLookupVar) /* 230 */ #define TclGetNamespaceFromObj \ (tclIntStubsPtr->tclGetNamespaceFromObj) /* 231 */ |
| ︙ |
Changes to generic/tclInterp.c.
| ︙ | |||
2796 2797 2798 2799 2800 2801 2802 | 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 | - - - - - - - - - - - + |
TclSetSlaveCancelFlags(slaveInterp, 0, 0);
Tcl_Preserve(slaveInterp);
Tcl_AllowExceptions(slaveInterp);
if (objc == 1) {
|
| ︙ |
Changes to generic/tclNamesp.c.
| ︙ | |||
3231 3232 3233 3234 3235 3236 3237 | 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 | - - |
NRNamespaceEvalCmd(
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Interp *iPtr = (Interp *) interp;
|
| ︙ | |||
3286 3287 3288 3289 3290 3291 3292 | 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 | - - - - - - - - - - - - - - + |
} else {
framePtr->objc = objc + iPtr->ensembleRewrite.numRemovedObjs
- iPtr->ensembleRewrite.numInsertedObjs;
framePtr->objv = iPtr->ensembleRewrite.sourceObjs;
}
if (objc == 3) {
|
| ︙ | |||
3757 3758 3759 3760 3761 3762 3763 | 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 | - + |
concatObjv[1] = listPtr;
cmdObjPtr = Tcl_ConcatObj(2, concatObjv);
Tcl_DecrRefCount(listPtr); /* We're done with the list object. */
}
TclNRAddCallback(interp, NsEval_Callback, namespacePtr, "inscope",
NULL, NULL);
|
| ︙ | |||
4786 4787 4788 4789 4790 4791 4792 | 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 | - + - - + + - - - - + - + - + - - - |
return nPtr->childTablePtr;
#endif
}
/*
*----------------------------------------------------------------------
*
|
| ︙ | |||
4883 4884 4885 4886 4887 4888 4889 | 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 | - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
*/
Tcl_ObjSetVar2(interp, iPtr->eiVar, NULL, iPtr->errorInfo,
TCL_GLOBAL_ONLY);
}
}
}
|
Changes to generic/tclOOBasic.c.
| ︙ | |||
400 401 402 403 404 405 406 | 400 401 402 403 404 405 406 407 408 409 410 411 412 413 | - |
{
CallContext *contextPtr = (CallContext *) context;
Tcl_Object object = Tcl_ObjectContextObject(context);
register const int skip = Tcl_ObjectContextSkippedArgs(context);
CallFrame *framePtr, **framePtrPtr = &framePtr;
Tcl_Obj *scriptPtr;
int result;
|
| ︙ | |||
435 436 437 438 439 440 441 | 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | - - - + |
* When there's more than one argument, we concatenate them together with
* spaces between, then evaluate the result. Tcl_EvalObjEx will delete the
* object when it decrements its refcount after eval'ing it.
*/
if (objc != skip+1) {
scriptPtr = Tcl_ConcatObj(objc-skip, objv+skip);
|
| ︙ |
Changes to generic/tclOODefineCmds.c.
| ︙ | |||
837 838 839 840 841 842 843 | 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 | - + - |
}
AddRef(oPtr);
if (objc == 3) {
Tcl_Obj *objNameObj = TclOOObjectName(interp, oPtr);
Tcl_IncrRefCount(objNameObj);
|
| ︙ | |||
951 952 953 954 955 956 957 | 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 | - + - |
}
AddRef(oPtr);
if (objc == 3) {
Tcl_Obj *objNameObj = TclOOObjectName(interp, oPtr);
Tcl_IncrRefCount(objNameObj);
|
| ︙ | |||
1065 1066 1067 1068 1069 1070 1071 | 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 | - + - |
}
AddRef(oPtr);
if (objc == 2) {
Tcl_Obj *objNameObj = TclOOObjectName(interp, oPtr);
Tcl_IncrRefCount(objNameObj);
|
| ︙ |
Changes to generic/tclOOInt.h.
| ︙ | |||
90 91 92 93 94 95 96 | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | - - - |
ProcErrorProc *errProc; /* Replacement error handler. */
TclOO_PreCallProc *preCallProc;
/* Callback to allow for additional setup
* before the method executes. */
TclOO_PostCallProc *postCallProc;
/* Callback to allow for additional cleanup
* after the method executes. */
|
| ︙ |
Changes to generic/tclOOMethod.c.
| ︙ | |||
12 13 14 15 16 17 18 | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | - - - - - - - - - - - - - - | #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "tclInt.h" #include "tclOOInt.h" #include "tclCompile.h" |
| ︙ | |||
84 85 86 87 88 89 90 | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | - | ClientData clientData, ClientData *newClientData); static void MethodErrorHandler(Tcl_Interp *interp, Tcl_Obj *procNameObj); static void ConstructorErrorHandler(Tcl_Interp *interp, Tcl_Obj *procNameObj); static void DestructorErrorHandler(Tcl_Interp *interp, Tcl_Obj *procNameObj); |
| ︙ | |||
454 455 456 457 458 459 460 | 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
/* The type of the method to create. */
ClientData clientData, /* The per-method type-specific data. */
Proc **procPtrPtr) /* A pointer to the variable in which to write
* the procedure record reference. Presumably
* inside the structure indicated by the
* pointer in clientData. */
{
|
| ︙ | |||
567 568 569 570 571 572 573 | 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
/* The type of the method to create. */
ClientData clientData, /* The per-method type-specific data. */
Proc **procPtrPtr) /* A pointer to the variable in which to write
* the procedure record reference. Presumably
* inside the structure indicated by the
* pointer in clientData. */
{
|
| ︙ | |||
841 842 843 844 845 846 847 | 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 | - - |
fdPtr->oldCmdPtr = pmPtr->procPtr->cmdPtr;
/*
* Compile the body. This operation may fail.
*/
|
| ︙ | |||
882 883 884 885 886 887 888 | 737 738 739 740 741 742 743 744 745 746 747 748 749 750 | - - - - - - - - - - - - - - - - - - - - - - - - - - |
}
fdPtr->framePtr->clientData = contextPtr;
fdPtr->framePtr->objc = objc;
fdPtr->framePtr->objv = objv;
fdPtr->framePtr->procPtr = pmPtr->procPtr;
|
| ︙ | |||
1112 1113 1114 1115 1116 1117 1118 | 941 942 943 944 945 946 947 948 949 950 951 952 953 954 | - - - - - - - - - - - - - - - - - - - - - - - - - - |
infoPtr->info.deleteProc = ProcedureMethodCompiledVarDelete;
infoPtr->cachedObjectVar = NULL;
infoPtr->variableObj = variableObj;
Tcl_IncrRefCount(variableObj);
*rPtrPtr = &infoPtr->info;
return TCL_OK;
}
|
| ︙ |
Changes to generic/tclObj.c.
| ︙ | |||
73 74 75 76 77 78 79 | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | - - - - - - - - - - - - - - - |
* one instance of this structure for each thread.
*
* Notice that different structures with the same name appear in other files.
* The structure defined below is used in this file only.
*/
typedef struct ThreadSpecificData {
|
| ︙ | |||
504 505 506 507 508 509 510 | 489 490 491 492 493 494 495 496 497 498 499 500 501 502 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
* Tcl_Obj's to NULL; the memory finalization will take care of releasing
* memory for us.
*/
Tcl_MutexLock(&tclObjMutex);
tclFreeObjList = NULL;
Tcl_MutexUnlock(&tclObjMutex);
}
|
| ︙ | |||
1384 1385 1386 1387 1388 1389 1390 | 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 | - - - - - - - - - - - - - - - - - - - - - - |
ckfree(objToFree);
Tcl_MutexUnlock(&tclObjMutex);
TclIncrObjsFreed();
}
ObjDeletionUnlock(context);
}
|
| ︙ | |||
1475 1476 1477 1478 1479 1480 1481 | 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 | - - - - - - - - - - - - - - - - - - - - - - |
TclFreeObjStorage(objToFree);
TclIncrObjsFreed();
}
ObjDeletionUnlock(context);
}
}
|
| ︙ |
Changes to generic/tclParse.c.
| ︙ | |||
1562 1563 1564 1565 1566 1567 1568 | 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 | - + |
*/
TclStackFree(interp, parsePtr);
return "$";
}
code = TclSubstTokens(interp, parsePtr->tokenPtr, parsePtr->numTokens,
|
| ︙ | |||
2106 2107 2108 2109 2110 2111 2112 | 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 | - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - + |
Tcl_Interp *interp, /* Interpreter in which to lookup variables,
* execute nested commands, and report
* errors. */
Tcl_Token *tokenPtr, /* Pointer to first in an array of tokens to
* evaluate and concatenate. */
int count, /* Number of tokens to consider at tokenPtr.
* Must be at least 1. */
|
| ︙ | |||
2272 2273 2274 2275 2276 2277 2278 | 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 | - + |
if (tokenPtr->numComponents > 1) {
/*
* Subst the index part of an array variable reference.
*/
code = TclSubstTokens(interp, tokenPtr+2,
|
| ︙ | |||
2356 2357 2358 2359 2360 2361 2362 | 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 | - - - - - - - - - - - - - - - - - - - - - |
}
}
}
if (code != TCL_ERROR) { /* Keep error message in result! */
if (result != NULL) {
Tcl_SetObjResult(interp, result);
|
| ︙ |
Changes to generic/tclProc.c.
| ︙ | |||
21 22 23 24 25 26 27 | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | - |
* Variables that are part of the [apply] command implementation and which
* have to be passed to the other side of the NRE call.
*/
typedef struct {
int isRootEnsemble;
Command cmd;
|
| ︙ | |||
209 210 211 212 213 214 215 | 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
* later when the procedure is called to determine what namespace the
* procedure will run in. This will be different than the current
* namespace if the proc was renamed into a different namespace.
*/
procPtr->cmdPtr = (Command *) cmd;
|
| ︙ | |||
438 439 440 441 442 443 444 | 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | - - - - - - - - - - |
* means that the same code can not be shared by two procedures that
* have a different number of arguments, even if their bodies are
* identical. Note that we don't use Tcl_DuplicateObj since we would
* not want any bytecode internal representation.
*/
if (Tcl_IsShared(bodyPtr)) {
|
| ︙ | |||
963 964 965 966 967 968 969 | 857 858 859 860 861 862 863 864 865 866 867 868 869 870 | - - |
ClientData dummy, /* Not used. */
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
register Interp *iPtr = (Interp *) interp;
|
| ︙ | |||
1001 1002 1003 1004 1005 1006 1007 | 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 | - - - - - - - + |
iPtr->varFramePtr = framePtr;
/*
* Execute the residual arguments as a command.
*/
if (objc == 1) {
|
| ︙ | |||
1790 1791 1792 1793 1794 1795 1796 | 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 | - - - - - - - - |
a[i] = (l < iPtr->varFramePtr->objc ?
TclGetString(iPtr->varFramePtr->objv[l]) : NULL);
l++;
}
TCL_DTRACE_PROC_ARGS(a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7],
a[8], a[9]);
}
|
| ︙ | |||
2003 2004 2005 2006 2007 2008 2009 | 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 | - - |
codePtr->nsPtr = nsPtr;
} else {
TclFreeIntRep(bodyPtr);
}
}
if (bodyPtr->typePtr != &tclByteCodeType) {
|
| ︙ | |||
2070 2071 2072 2073 2074 2075 2076 | 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 | - - - - - - - - - - - - - - | } procPtr->numCompiledLocals = procPtr->numArgs; } TclPushStackFrame(interp, &framePtr, (Tcl_Namespace *) nsPtr, /* isProcCallFrame */ 0); |
| ︙ | |||
2190 2191 2192 2193 2194 2195 2196 | 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 | - - - |
TclProcCleanupProc(
register Proc *procPtr) /* Procedure to be deleted. */
{
register CompiledLocal *localPtr;
Tcl_Obj *bodyPtr = procPtr->bodyPtr;
Tcl_Obj *defPtr;
Tcl_ResolvedVarInfo *resVarInfo;
|
| ︙ | |||
2217 2218 2219 2220 2221 2222 2223 | 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
defPtr = localPtr->defValuePtr;
Tcl_DecrRefCount(defPtr);
}
ckfree(localPtr);
localPtr = nextPtr;
}
ckfree(procPtr);
|
| ︙ | |||
2471 2472 2473 2474 2475 2476 2477 | 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 | - - + - |
}
static int
SetLambdaFromAny(
Tcl_Interp *interp, /* Used for error reporting if not NULL. */
register Tcl_Obj *objPtr) /* The object to convert. */
{
|
| ︙ | |||
2520 2521 2522 2523 2524 2525 2526 | 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
/*
* CAREFUL: TclCreateProc returns refCount==1! [Bug 1578454]
* procPtr->refCount = 1;
*/
procPtr->cmdPtr = NULL;
|
| ︙ | |||
2745 2746 2747 2748 2749 2750 2751 | 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 | - - - - - - - - - - - - - - - - |
}
extraPtr = TclStackAlloc(interp, sizeof(ApplyExtraData));
memset(&extraPtr->cmd, 0, sizeof(Command));
procPtr->cmdPtr = &extraPtr->cmd;
extraPtr->cmd.nsPtr = (Namespace *) nsPtr;
|
| ︙ |
Changes to generic/tclResult.c.
| ︙ | |||
13 14 15 16 17 18 19 | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | - + |
/*
* Indices of the standard return options dictionary keys.
*/
enum returnKeys {
KEY_CODE, KEY_ERRORCODE, KEY_ERRORINFO, KEY_ERRORLINE,
|
| ︙ | |||
40 41 42 43 44 45 46 | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | - - |
int flags; /* Each remaining field saves the */
int returnLevel; /* corresponding field of the Interp */
int returnCode; /* struct. These fields taken together are */
Tcl_Obj *errorInfo; /* the "state" of the interp. */
Tcl_Obj *errorCode;
Tcl_Obj *returnOpts;
Tcl_Obj *objResult;
|
| ︙ | |||
78 79 80 81 82 83 84 | 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | - - - - - |
InterpState *statePtr = ckalloc(sizeof(InterpState));
statePtr->status = status;
statePtr->flags = iPtr->flags & ERR_ALREADY_LOGGED;
statePtr->returnLevel = iPtr->returnLevel;
statePtr->returnCode = iPtr->returnCode;
statePtr->errorInfo = iPtr->errorInfo;
|
| ︙ | |||
131 132 133 134 135 136 137 | 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | - - - - - - - - |
int status = statePtr->status;
iPtr->flags &= ~ERR_ALREADY_LOGGED;
iPtr->flags |= (statePtr->flags & ERR_ALREADY_LOGGED);
iPtr->returnLevel = statePtr->returnLevel;
iPtr->returnCode = statePtr->returnCode;
|
| ︙ | |||
197 198 199 200 201 202 203 | 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | - - - |
}
if (statePtr->errorCode) {
Tcl_DecrRefCount(statePtr->errorCode);
}
if (statePtr->returnOpts) {
Tcl_DecrRefCount(statePtr->returnOpts);
}
|
| ︙ | |||
937 938 939 940 941 942 943 | 919 920 921 922 923 924 925 926 927 928 929 930 931 932 | - |
if (iPtr->flags & ERR_LEGACY_COPY) {
Tcl_ObjSetVar2(interp, iPtr->eiVar, NULL,
iPtr->errorInfo, TCL_GLOBAL_ONLY);
}
Tcl_DecrRefCount(iPtr->errorInfo);
iPtr->errorInfo = NULL;
}
|
| ︙ | |||
1172 1173 1174 1175 1176 1177 1178 | 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 | - | int i; TclNewLiteralStringObj(keys[KEY_CODE], "-code"); TclNewLiteralStringObj(keys[KEY_ERRORCODE], "-errorcode"); TclNewLiteralStringObj(keys[KEY_ERRORINFO], "-errorinfo"); TclNewLiteralStringObj(keys[KEY_ERRORLINE], "-errorline"); |
| ︙ | |||
1279 1280 1281 1282 1283 1284 1285 | 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
(void) TclGetStringFromObj(valuePtr, &infoLen);
if (infoLen) {
iPtr->errorInfo = valuePtr;
Tcl_IncrRefCount(iPtr->errorInfo);
iPtr->flags |= ERR_ALREADY_LOGGED;
}
}
|
| ︙ | |||
1476 1477 1478 1479 1480 1481 1482 | 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
TclGetString(valuePtr)));
Tcl_SetErrorCode(interp, "TCL", "RESULT", "ILLEGAL_ERRORCODE",
NULL);
goto error;
}
}
|
| ︙ | |||
1587 1588 1589 1590 1591 1592 1593 | 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 | - - - - - - - - - - - - - - - - - - - - - - - - - - |
Tcl_NewIntObj(result));
Tcl_DictObjPut(NULL, options, keys[KEY_LEVEL],
Tcl_NewIntObj(0));
}
if (result == TCL_ERROR) {
Tcl_AddErrorInfo(interp, "");
|
| ︙ |
Changes to generic/tclStubInit.c.
| ︙ | |||
529 530 531 532 533 534 535 | 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 | - - + + |
TclTraceDictPath, /* 225 */
TclObjBeingDeleted, /* 226 */
TclSetNsPath, /* 227 */
0, /* 228 */
TclPtrMakeUpvar, /* 229 */
TclObjLookupVar, /* 230 */
TclGetNamespaceFromObj, /* 231 */
|
| ︙ |
Changes to generic/tclTest.c.
| ︙ | |||
6796 6797 6798 6799 6800 6801 6802 | 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 | - + - + - - + - + - + |
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
Interp *iPtr = (Interp *) interp;
static ptrdiff_t *refDepth = NULL;
ptrdiff_t depth;
|
| ︙ |
Changes to generic/tclVar.c.
| ︙ | |||
1946 1947 1948 1949 1950 1951 1952 | 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 | - - - |
if (oldValuePtr == NULL) {
varPtr->value.objPtr = newValuePtr;
Tcl_IncrRefCount(newValuePtr);
} else {
if (Tcl_IsShared(oldValuePtr)) { /* Append to copy. */
varPtr->value.objPtr = Tcl_DuplicateObj(oldValuePtr);
|
| ︙ |
Changes to tests/cmdMZ.test.
| ︙ | |||
147 148 149 150 151 152 153 | 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | - + |
test cmdMZ-return-2.9 {return option handling} -body {
return -level 0 -code 10
} -returnCodes 10 -result {}
test cmdMZ-return-2.10 {return option handling} -body {
list [catch {return -level 0 -code error} -> foo] [dictSort $foo]
} -match glob -result {1 {-code 1 -errorcode NONE -errorinfo {
while executing
|
| ︙ | |||
183 184 185 186 187 188 189 | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | - - - + + + - + |
apply {{} {
return -code error -errorcode a\ b c
}}
} result] $result $::errorCode
} {1 c {a b}}
test cmdMZ-return-2.18 {return option handling} {
list [catch {
|
| ︙ |
Changes to tests/coroutine.test.
| ︙ | |||
15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | + |
}
::tcltest::loadTestedCommands
catch [list package require -exact Tcltest [info patchlevel]]
testConstraint testnrelevels [llength [info commands testnrelevels]]
testConstraint memory [llength [info commands memory]]
testConstraint infoframe [expr ![catch {info frame 0}]]
set lambda [list {{start 0} {stop 10}} {
# init
set i $start
set imax $stop
yield
while {$i < $imax} {
|
| ︙ | |||
292 293 294 295 296 297 298 | 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | - + |
set l0 [coroutine foo a]
set l1 [foo]
set l2 [b]
expr {$l2 - $l1}
} -cleanup {
rename a {}
rename b {}
|
| ︙ | |||
337 338 339 340 341 342 343 | 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | - + |
}
proc a {} stack
} -body {
coroutine aa a
} -cleanup {
rename stack {}
rename a {}
|
| ︙ | |||
479 480 481 482 483 484 485 | 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 | - + |
proc foo {} {
while 1 {
nestedYield
}
}
set res {}
} -body {
|
| ︙ |
Changes to tests/dict.test.
| ︙ | |||
1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 | 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 | + + + |
apply {{} {
dict with ::d p q {
}
return $a,$b
}}
} 1,2
if 0 {
# TEST REMOVED: uses [info frame]
proc linenumber {} {
dict get [info frame -1] line
}
test dict-23.1 {dict compilation crash: Bug 3487626} {
apply {{} {apply {n {
set e {}
set k {}
dict for {a b} {c {d {e {f g}}}} {
::tcl::dict::for {h i} $b {
dict update i e j {
::tcl::dict::update j f k {
return [expr {$n - [linenumber]}]
}
}
}
}
}} [linenumber]}}
} 5
test dict-23.2 {dict compilation crash: Bug 3487626} knownBug {
# Something isn't quite right in line number and continuation line
# tracking; at time of writing, this test produces 7, not 5, which
# indicates that the extra newlines in the non-script argument are
# confusing things.
apply {{} {apply {n {
set e {}
|
| ︙ | |||
1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 | 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 | + |
}
}
}
}
}} [linenumber]}}
} 5
rename linenumber {}
}
test dict-24.1 {dict map command: syntax} -returnCodes error -body {
dict map
} -result {wrong # args: should be "dict map {keyVar valueVar} dictionary script"}
test dict-24.2 {dict map command: syntax} -returnCodes error -body {
dict map x
} -result {wrong # args: should be "dict map {keyVar valueVar} dictionary script"}
|
| ︙ | |||
1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 | 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 | + + + + |
} -returnCodes 1 -result {missing value to go with key}
test dict-24.20 {dict map stack space compilation: 'dict for' bug 1903325} {
apply {{x y args} {
dict map {a b} $x {}
concat "c=$y,$args"
}} {} 1 2 3
} {c=1,2 3}
if 0 {
# TEST REMOVED: uses [info frame]
proc linenumber {} {
dict get [info frame -1] line
}
test dict-24.20.1 {dict compilation crash: 'dict for' bug 3487626} {
apply {{} {apply {n {
set e {}
set k {}
dict map {a b} {c {d {e {f g}}}} {
::tcl::dict::map {h i} $b {
dict update i e j {
::tcl::dict::update j f k {
return [expr {$n - [linenumber]}]
}
}
}
}
}} [linenumber]}}
} 5
test dict-24.21 {dict compilation crash: 'dict for' bug 3487626} knownBug {
apply {{} {apply {n {
set e {}
set k {}
dict map {a {
b
}} {c {d {e {f g}}}} {
|
| ︙ | |||
1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 | 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 | + + |
}
}
}
}
}} [linenumber]}}
} 5
rename linenumber {}
}
test dict-24.22 {dict map results (non-compiled)} {
dict map {k v} [dict map {k v} {a 1 b 2 c 3 d 4} { list $v $k }] {
return -level 0 "$k,$v"
}
} {a {a,1 a} b {b,2 b} c {c,3 c} d {d,4 d}}
test dict-24.23 {dict map results (compiled)} {
apply {{} {
|
| ︙ |
Changes to tests/error.test.
| ︙ | |||
163 164 165 166 167 168 169 | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | - - - - - - - - - - - - - |
while executing
"error msg1"} NONE}
test error-4.5 {errorInfo and errorCode variables} {
set ::errorCode bogus
list [catch {error msg1 msg2 {}} msg] $msg $::errorInfo $::errorCode
} {1 msg1 msg2 {}}
|
| ︙ | |||
230 231 232 233 234 235 236 | 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | - - - - - - - - - - |
test error-6.9 {catch must reset error state} {
proc foo {} {
return -code error [catch {error foo bar baz}]
}
catch foo
list $::errorCode
} {NONE}
|
| ︙ |
Changes to tests/execute.test.
| ︙ | |||
968 969 970 971 972 973 974 | 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 | - + |
catch [list error FOO] m o
return $o
}
} -body {
demo
} -cleanup {
rename demo {}
|
| ︙ |
Changes to tests/info.test.
| ︙ | |||
674 675 676 677 678 679 680 | 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 | - + - + - + - + + + + + + + + + |
unset functions msg
test info-21.1 {miscellaneous error conditions} -returnCodes error -body {
info
} -result {wrong # args: should be "info subcommand ?arg ...?"}
test info-21.2 {miscellaneous error conditions} -returnCodes error -body {
info gorp
|
| ︙ |
Changes to tests/ioTrans.test.
| ︙ | |||
40 41 42 43 44 45 46 | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | - |
package require tcltest 2
namespace import -force ::tcltest::*
}
# This forces the return options to be in the order that the test expects!
variable optorder {
-code !?! -level !?! -errorcode !?! -errorline !?! -errorinfo !?!
|
| ︙ | |||
1084 1085 1086 1087 1088 1089 1090 | 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 | - + |
thread::send $tid {
proc notes {} {
return $::notes
}
proc noteOpts opts {
lappend ::notes [dict merge {
-code !?! -level !?! -errorcode !?! -errorline !?!
|
| ︙ |
Changes to tests/nre.test.
| ︙ | |||
24 25 26 27 28 29 30 | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | - - + + |
# can now actually measure using testnrelevels.
#
if {[testConstraint testnrelevels]} {
namespace eval testnre {
namespace path ::tcl::mathop
#
|
| ︙ | |||
48 49 50 51 52 53 54 | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | - + - + - + - + - + - + - + - + - + + - + - + - + - + - + - + - + - + - + - + |
variable body0 {
set x [depthDiff]
if {[incr i] > 10} {
namespace upvar [namespace qualifiers \
[namespace origin depthDiff]] abs abs
incr abs [lindex [testnrelevels] 0]
|
| ︙ | |||
329 330 331 332 333 334 335 | 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | - + - + - + - + - + |
} -body {
setabs
foo bar 0
} -cleanup {
foo destroy
} -constraints {
testnrelevels
|
| ︙ | |||
405 406 407 408 409 410 411 | 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 | - + |
$j eval {namespace delete {*}[filter [namespace children ::]]}
namespace eval foo {}
list [filter [eval $x]] [filter [eval $y]] [filter [$j eval $x]] [filter [$j eval $y]]
}
} -cleanup {
interp delete $i
} -result {::foo ::foo {} {}}
|
| ︙ |
Changes to tests/oo.test.
| ︙ | |||
9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | + + |
package require TclOO 1.0
package require tcltest 2
if {"::tcltest" in [namespace children]} {
namespace import -force ::tcltest::*
}
testConstraint infoframe [expr ![catch {info frame 0}]]
testConstraint memory [llength [info commands memory]]
if {[testConstraint memory]} {
proc getbytes {} {
set lines [split [memory info] \n]
return [lindex $lines 3 3]
}
proc leaktest {script {iterations 3}} {
|
| ︙ | |||
2606 2607 2608 2609 2610 2611 2612 | 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 | - + - + |
list [next] [info frame 0]
}
method level {} {
expr {[next] - [info frame]}
}
}
list [i level] [i frames] [dict get [c frame] object]
|
| ︙ |
Changes to tests/regexpComp.test.
| ︙ | |||
826 827 828 829 830 831 832 | 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 | - + - + |
test regexpComp-21.5 {regexp command compiling tests} {
evalInProc {
regexp -nocase FOO dogfod
}
} 0
test regexpComp-21.6 {regexp command compiling tests} {
evalInProc {
|
| ︙ | |||
941 942 943 944 945 946 947 | 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 | - + - + |
set re FOO
regexp -nocase $re dogfod
}
} 0
test regexpComp-24.6 {regexp command compiling tests} {
evalInProc {
set re foo
|
| ︙ | |||
978 979 980 981 982 983 984 | 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 | - + |
# Bug 1902436 - last * escaped
evalInProc {
set text {this is *bold* !}
set re {\*bold\*.*!}
regexp -- $re $text
}
} 1
|
Changes to tests/result.test.
| ︙ | |||
130 131 132 133 134 135 136 | 130 131 132 133 134 135 136 137 138 139 | - - - - - - - - |
} -cleanup {
rename foo {}
} -result {foo {} {}}
test result-6.3 {Bug 2383005} {
catch {return -code error -errorcode {{}a} eek} m
set m
} {bad -errorcode value: expected a list but got "{}a"}
|
Changes to tests/tailcall.test.
| ︙ | |||
23 24 25 26 27 28 29 | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | - - + + - + + + + + |
# The tests that risked blowing the C stack on failure have been removed: we
# can now actually measure using testnrelevels.
#
if {[testConstraint testnrelevels]} {
namespace eval testnre {
#
|
| ︙ | |||
53 54 55 56 57 58 59 | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | - - + - - + - + - - + - - + - + - - + - - + - + - - + - - + - + - - + - - + - + - - + - - + - + - - + - - + - + |
test tailcall-0.1 {tailcall is constant space} -constraints testnrelevels -setup {
proc a i {
#
# NOTE: there may be a diff in callback depth with the first call
# ($i==0) due to the fact that the first is from an eval. Successive
# calls should add nothing to any stack depths.
#
|
| ︙ |