Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch dkf-c11-features Excluding Merge-Ins
This is equivalent to a diff from 88f0807bb9 to 43e1c33e9e
|
2025-01-13
| ||
| 09:59 | More macros for measuring literals at compile time, and a shortcut for adding to error info Closed-Leaf check-in: 43e1c33e9e user: dkf tags: dkf-c11-features | |
|
2025-01-10
| ||
| 21:37 | Merge-mark check-in: 5145a78372 user: jan.nijtmans tags: trunk, main | |
| 16:25 | Clean up TEBC TRACE macro system check-in: 9dc5edae35 user: dkf tags: dkf-c11-features | |
| 14:02 | Rebase to 9.0 Closed-Leaf check-in: 7512a6295d user: jan.nijtmans tags: 70f3b23cad-docs-version-requirement | |
|
2025-01-08
| ||
| 16:09 | Rebase to 9.0 check-in: 16bd4182a9 user: jan.nijtmans tags: tip-709 | |
| 15:23 | Merge 9.0. registry -> 1.4a0 (breaking compilation on Windows XP) check-in: fd7b19dc30 user: jan.nijtmans tags: tip-710 | |
| 15:02 | Use C11 features, especially variadic macros. check-in: 38f3728d9a user: dkf tags: dkf-c11-features | |
| 14:07 | In --with-tcl8 mode, only typedef Tcl_Size when Tcl_Size is not #defined already check-in: 88f0807bb9 user: jan.nijtmans tags: trunk, main | |
| 13:57 | Only typedef Tcl_Size when Tcl_Size is not #defined. Spacing changes (backported from 8.7) check-in: 70a524360e user: jan.nijtmans tags: core-8-branch | |
|
2025-01-07
| ||
| 15:42 | Simplification for [d58e315172] check-in: 4e87493367 user: jan.nijtmans tags: trunk, main | |
Changes to generic/tclArithSeries.c.
| ︙ | |||
693 694 695 696 697 698 699 | 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 | - + - - + + - |
}
if (isnan(dstart) || isnan(dend)) {
const char *description = "non-numeric floating-point value";
char tmp[TCL_DOUBLE_SPACE + 2];
tmp[0] = '\0';
Tcl_PrintDouble(NULL, isnan(dstart)?dstart:dend, tmp);
|
| ︙ | |||
728 729 730 731 732 733 734 | 727 728 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 | - - - + + - + |
/*
* todo: check whether the boundary must be rather LIST_MAX, to be more
* similar to plain lists, otherwise it'd generare an error or panic later
* (0x0ffffffffffffffa instead of 0x7fffffffffffffff by 64bit)
*/
if (len > TCL_SIZE_MAX) {
exceeded:
|
| ︙ | |||
1008 1009 1010 1011 1012 1013 1014 | 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 | - - + + - - + |
/* If this exists, it has already been populated */
objv = arithSeriesRepPtr->elements;
} else {
/* Construct the elements array */
objv = (Tcl_Obj **) Tcl_Alloc(sizeof(Tcl_Obj*) * objc);
if (objv == NULL) {
if (interp) {
|
| ︙ | |||
1034 1035 1036 1037 1038 1039 1040 | 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 | - - - + + |
} else {
objv = NULL;
}
*objvPtr = objv;
*objcPtr = objc;
} else {
if (interp != NULL) {
|
| ︙ |
Changes to generic/tclAssembly.c.
| ︙ | |||
788 789 790 791 792 793 794 | 788 789 790 791 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 | - - - + - - - + - - |
TclNRAssembleObjCmd(
TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
ByteCode *codePtr; /* Pointer to the bytecode to execute */
|
| ︙ | |||
977 978 979 980 981 982 983 | 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 | - - + - + |
/*
* Compile the code and convert any error from the compilation into
* bytecode reporting the error;
*/
if (TCL_ERROR == TclAssembleCode(envPtr, tokenPtr[1].start,
tokenPtr[1].size, TCL_EVAL_DIRECT)) {
|
| ︙ | |||
1373 1374 1375 1376 1377 1378 1379 | 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 | - - - + + |
Tcl_WrongNumArgs(interp, 1, &instNameObj, "imm8");
goto cleanup;
}
if (GetIntegerOperand(assemEnvPtr, &tokenPtr, &opnd) != TCL_OK) {
goto cleanup;
}
if (opnd < 0 || opnd > 3) {
|
| ︙ | |||
1614 1615 1616 1617 1618 1619 1620 | 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 | - - - + + |
goto cleanup;
}
if (GetIntegerOperand(assemEnvPtr, &tokenPtr, &opnd) != TCL_OK) {
goto cleanup;
}
if (opnd < 2) {
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
|
| ︙ | |||
1979 1980 1981 1982 1983 1984 1985 | 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 | - - + + - - + |
Tcl_Size i;
if (TclListObjLength(interp, jumps, &objc) != TCL_OK) {
return TCL_ERROR;
}
if (objc % 2 != 0) {
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
|
| ︙ | |||
2010 2011 2012 2013 2014 2015 2016 | 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 | - + - - + + |
for (i = 0; i < objc; i+=2) {
DEBUG_PRINT(" %s -> %s\n", TclGetString(objv[i]),
TclGetString(objv[i+1]));
hashEntry = Tcl_CreateHashEntry(jtHashPtr, TclGetString(objv[i]),
&isNew);
if (!isNew) {
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
|
| ︙ | |||
2096 2097 2098 2099 2100 2101 2102 | 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 | - - - + + + |
Tcl_Interp* interp = (Tcl_Interp*) assemEnvPtr->envPtr->iPtr;
Tcl_Obj* operandObj;
TclNewObj(operandObj);
if (!TclWordKnownAtCompileTime(*tokenPtrPtr, operandObj)) {
Tcl_DecrRefCount(operandObj);
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
|
| ︙ | |||
2318 2319 2320 2321 2322 2323 2324 | 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 | - + - - + + |
Tcl_DecrRefCount(varNameObj);
return TCL_INDEX_NONE;
}
localVar = TclFindCompiledLocal(varNameStr, varNameLen, 1, envPtr);
Tcl_DecrRefCount(varNameObj);
if (localVar < 0) {
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
|
| ︙ | |||
2354 2355 2356 2357 2358 2359 2360 | 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 | - - - + + |
const char* name, /* Variable name to check */
int nameLen) /* Length of the variable */
{
const char* p;
for (p = name; p+2 < name+nameLen; p++) {
if ((*p == ':') && (p[1] == ':')) {
|
| ︙ | |||
2387 2388 2389 2390 2391 2392 2393 | 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 | - - - + - - + |
*/
static int
CheckOneByte(
Tcl_Interp* interp, /* Tcl interpreter for error reporting */
int value) /* Value to check */
{
|
| ︙ | |||
2422 2423 2424 2425 2426 2427 2428 | 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 | - - - + - - + |
*/
static int
CheckSignedOneByte(
Tcl_Interp* interp, /* Tcl interpreter for error reporting */
int value) /* Value to check */
{
|
| ︙ | |||
2455 2456 2457 2458 2459 2460 2461 | 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 | - - - + - - + |
*/
static int
CheckNonNegative(
Tcl_Interp* interp, /* Tcl interpreter for error reporting */
int value) /* Value to check */
{
|
| ︙ | |||
2488 2489 2490 2491 2492 2493 2494 | 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 | - - - + - - + |
*/
static int
CheckStrictlyPositive(
Tcl_Interp* interp, /* Tcl interpreter for error reporting */
int value) /* Value to check */
{
|
| ︙ | |||
2542 2543 2544 2545 2546 2547 2548 | 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 | - - - + + + - |
entry = Tcl_CreateHashEntry(&assemEnvPtr->labelHash, labelName, &isNew);
if (!isNew) {
/*
* This is a duplicate label.
*/
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
|
| ︙ | |||
2943 2944 2945 2946 2947 2948 2949 | 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 | - - - - + + + + |
{
CompileEnv* envPtr = assemEnvPtr->envPtr;
/* Compilation environment */
Tcl_Interp* interp = (Tcl_Interp*) envPtr->iPtr;
/* Tcl interpreter */
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
|
| ︙ | |||
3226 3227 3228 3229 3230 3231 3232 | 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 | - + - - + + |
opcode = (envPtr->codeStart)[offset];
if (BytecodeMightThrow(opcode)) {
/*
* Report an error for a throw in the wrong context.
*/
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
|
| ︙ | |||
3403 3404 3405 3406 3407 3408 3409 | 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 | - - + + - + |
* among the paths that reach it.
*/
if (blockPtr->initialStackDepth == initialStackDepth) {
return TCL_OK;
}
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
|
| ︙ | |||
3433 3434 3435 3436 3437 3438 3439 | 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 | - - + + - - - + + + |
/*
* Calculate minimum stack depth, and flag an error if the block
* underflows the stack.
*/
if (initialStackDepth + blockPtr->minStackDepth < 0) {
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
|
| ︙ | |||
3578 3579 3580 3581 3582 3583 3584 | 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 | - + - - + + |
/*
* Exit with unbalanced stack.
*/
if (depth != 1) {
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
|
| ︙ | |||
3722 3723 3724 3725 3726 3727 3728 | 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 | - + - + - + |
* rechecked.
*/
if (bbPtr->catchState == BBCS_UNKNOWN) {
bbPtr->enclosingCatch = enclosing;
} else if (bbPtr->enclosingCatch != enclosing) {
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
|
| ︙ | |||
3782 3783 3784 3785 3786 3787 3788 | 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 | - - + + - + |
/*
* If the block ends a catch, the state for the successor is whatever
* the state was on entry to the catch.
*/
if (enclosing == NULL) {
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
|
| ︙ | |||
3857 3858 3859 3860 3861 3862 3863 | 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 | - - + + - + |
CompileEnv* envPtr = assemEnvPtr->envPtr;
/* Compilation environment */
Tcl_Interp* interp = (Tcl_Interp*) envPtr->iPtr;
/* Tcl interpreter */
if (assemEnvPtr->curr_bb->catchState >= BBCS_INCATCH) {
if (assemEnvPtr->flags & TCL_EVAL_DIRECT) {
|
| ︙ | |||
4259 4260 4261 4262 4263 4264 4265 | 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 | - - - - - - + + - + - - + + + - |
AssemblyEnv* assemEnvPtr, /* Assembly environment */
BasicBlock* bbPtr) /* Basic block in which the error is found */
{
CompileEnv* envPtr = assemEnvPtr->envPtr;
/* Compilation environment */
Tcl_Interp* interp = (Tcl_Interp*) envPtr->iPtr;
/* Tcl interpreter */
|
| ︙ |
Changes to generic/tclBasic.c.
| ︙ | |||
1519 1520 1521 1522 1523 1524 1525 | 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 | - + - - + + |
void *clientData,
Tcl_Interp *interp,
TCL_UNUSED(int) /*objc*/,
TCL_UNUSED(Tcl_Obj *const *) /* objv */)
{
const UnsafeEnsembleInfo *infoPtr = (const UnsafeEnsembleInfo *)clientData;
|
| ︙ | |||
2214 2215 2216 2217 2218 2219 2220 | 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 | - + - - + + |
*
* But as we currently limit ourselves to the global namespace only for
* the source, in order to avoid potential confusion, lets prevent "::" in
* the token too. - dl
*/
if (strstr(hiddenCmdToken, "::") != NULL) {
|
| ︙ | |||
2239 2240 2241 2242 2243 2244 2245 | 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 | - - + + - - + |
cmdPtr = (Command *) cmd;
/*
* Check that the command is really in global namespace
*/
if (cmdPtr->nsPtr != iPtr->globalNsPtr) {
|
| ︙ | |||
2265 2266 2267 2268 2269 2270 2271 | 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 | - + - - + + |
* It is an error to move an exposed command to a hidden command with
* hiddenCmdToken if a hidden command with the name hiddenCmdToken already
* exists.
*/
hPtr = Tcl_CreateHashEntry(hiddenCmdTablePtr, hiddenCmdToken, &isNew);
if (!isNew) {
|
| ︙ | |||
2369 2370 2371 2372 2373 2374 2375 | 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 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 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 | - - + + - - + - - - + + + - - - + + - - - - + + + |
/*
* Check that we have a regular name for the command (that the user is not
* trying to do an expose and a rename (to another namespace) at the same
* time).
*/
if (strstr(cmdName, "::") != NULL) {
|
| ︙ | |||
3075 3076 3077 3078 3079 3080 3081 | 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 | - + - - + + |
* Find the existing command. An error is returned if cmdName can't be
* found.
*/
cmd = Tcl_FindCommand(interp, oldName, NULL, /*flags*/ 0);
cmdPtr = (Command *) cmd;
if (cmdPtr == NULL) {
|
| ︙ | |||
3108 3109 3110 3111 3112 3113 3114 | 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 | - - - + + + - - - + + + - |
* create the containing namespaces just like Tcl_CreateObjCommand would.
*/
TclGetNamespaceForQualName(interp, newName, NULL,
TCL_CREATE_NS_IF_UNKNOWN, &newNsPtr, &dummy1, &dummy2, &newTail);
if ((newNsPtr == NULL) || (newTail == NULL)) {
|
| ︙ | |||
3559 3560 3561 3562 3563 3564 3565 | 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 | - + - + - + |
/*
* Add the full name of the containing namespace, followed by the "::"
* separator, and the command name.
*/
if ((cmdPtr != NULL) && TclRoutineHasName(cmdPtr)) {
if (cmdPtr->nsPtr != NULL) {
|
| ︙ | |||
4066 4067 4068 4069 4070 4071 4072 | 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 | - - - - + + + |
Tcl_ResetResult(interp);
/*
* If the interpreter has been deleted, return an error.
*/
if (iPtr->flags & DELETED) {
|
| ︙ | |||
4095 4096 4097 4098 4099 4100 4101 | 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 | - - - + + |
* probably because of an infinite loop somewhere.
*/
if ((iPtr->numLevels <= iPtr->maxNestingDepth)) {
return TCL_OK;
}
|
| ︙ | |||
4231 4232 4233 4234 4235 4236 4237 | 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 | - + |
id = "ICANCEL";
if (length == 0) {
message = "eval canceled";
}
}
Tcl_SetObjResult(interp, Tcl_NewStringObj(message, TCL_INDEX_NONE));
|
| ︙ | |||
4418 4419 4420 4421 4422 4423 4424 | 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 | - + |
* this callback (that marks the end of the target command) and goes back
* to the end of the source command.
*/
if (iPtr->deferredCallbacks) {
iPtr->deferredCallbacks = NULL;
} else {
|
| ︙ | |||
4523 4524 4525 4526 4527 4528 4529 | 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 | - - - + + + |
cmdPtr = preCmdPtr;
} else if (flags & TCL_EVAL_NORESOLVE) {
/*
* When it's been deleted, and we're told not to attempt resolving
* it ourselves, all we can do is raise an error.
*/
|
| ︙ | |||
4624 4625 4626 4627 4628 4629 4630 | 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 | - + |
TclDTraceInfo(info, a, i);
TCL_DTRACE_CMD_INFO(a[0], a[1], a[2], a[3], i[0], i[1], a[4], a[5]);
TclDecrRefCount(info);
}
if ((TCL_DTRACE_CMD_RETURN_ENABLED() || TCL_DTRACE_CMD_RESULT_ENABLED())
&& objc) {
|
| ︙ | |||
4674 4675 4676 4677 4678 4679 4680 | 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 | - + |
* If there is a tailcall, schedule it next
*/
if (data[1] && (data[1] != INT2PTR(1))) {
listPtr = (Tcl_Obj *)data[1];
data[1] = NULL;
|
| ︙ | |||
4729 4730 4731 4732 4733 4734 4735 | 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 | - + - - + - - + - |
*/
if (!(flags & TCL_EVAL_INVOKE)) {
/*
* Error messages
*/
|
| ︙ | |||
4897 4898 4899 4900 4901 4902 4903 | 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 | - - - - + + + + - + |
*
* In this case we worry a bit less about recursion for now, and call the
* "blocking" interface.
*/
cmdPtr = TEOV_LookupCmdFromObj(interp, newObjv[0], lookupNsPtr);
if (cmdPtr == NULL) {
|
| ︙ | |||
4992 4993 4994 4995 4996 4997 4998 | 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 | - + |
if (traceCode != TCL_OK) {
if (traceCode == TCL_ERROR) {
Tcl_Obj *info;
TclNewLiteralStringObj(info, "\n (enter trace on \"");
Tcl_AppendLimitedToObj(info, command, length, 55, "...");
|
| ︙ | |||
5044 5045 5046 5047 5048 5049 5050 | 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 | - + |
if (traceCode != TCL_OK) {
if (traceCode == TCL_ERROR) {
Tcl_Obj *info;
TclNewLiteralStringObj(info, "\n (leave trace on \"");
Tcl_AppendLimitedToObj(info, command, length, 55, "...");
|
| ︙ | |||
5387 5388 5389 5390 5391 5392 5393 | 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 | - - + + + |
code = TclListObjLength(interp, objv[objectsUsed],
&numElements);
if (code == TCL_ERROR) {
/*
* Attempt to expand a non-list.
*/
|
| ︙ | |||
6201 6202 6203 6204 6205 6206 6207 | 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 | - + | iPtr->cmdFramePtr = eoFramePtr; flags |= TCL_EVAL_SOURCE_IN_FRAME; } TclMarkTailcall(interp); TclNRAddCallback(interp, TEOEx_ListCallback, listPtr, eoFramePtr, |
| ︙ | |||
6232 6233 6234 6235 6236 6237 6238 | 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 | - + | savedVarFramePtr = iPtr->varFramePtr; iPtr->varFramePtr = iPtr->rootFramePtr; } Tcl_IncrRefCount(objPtr); codePtr = TclCompileObj(interp, objPtr, invoker, word); TclNRAddCallback(interp, TEOEx_ByteCodeCallback, savedVarFramePtr, |
| ︙ | |||
6382 6383 6384 6385 6386 6387 6388 | 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 | - - + - - + - - + - + |
* result code was returned. */
int returnCode) /* The unexpected result code. */
{
char buf[TCL_INTEGER_SPACE];
Tcl_ResetResult(interp);
if (returnCode == TCL_BREAK) {
|
| ︙ | |||
6694 6695 6696 6697 6698 6699 6700 | 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 | - - + |
* TCL_INVOKE_HIDDEN, TCL_INVOKE_NO_UNKNOWN,
* or TCL_INVOKE_NO_TRACEBACK. */
{
if (interp == NULL) {
return TCL_ERROR;
}
if ((objc < 1) || (objv == NULL)) {
|
| ︙ | |||
6723 6724 6725 6726 6727 6728 6729 | 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 | - - - + + - - + |
cmdName = TclGetString(objv[0]);
hTblPtr = iPtr->hiddenCmdTablePtr;
if (hTblPtr != NULL) {
hPtr = Tcl_FindHashEntry(hTblPtr, cmdName);
}
if (hPtr == NULL) {
|
| ︙ | |||
6848 6849 6850 6851 6852 6853 6854 | 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 | - + |
*/
iPtr->flags |= ERR_LEGACY_COPY;
if (iPtr->errorInfo == NULL) {
iPtr->errorInfo = iPtr->objResultPtr;
Tcl_IncrRefCount(iPtr->errorInfo);
if (!iPtr->errorCode) {
|
| ︙ | |||
7213 7214 7215 7216 7217 7218 7219 | 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 7213 7214 | - - - - + + + |
return TCL_ERROR;
}
Tcl_SetObjResult(interp, Tcl_NewBignumObj(&root));
}
return TCL_OK;
negarg:
|
| ︙ | |||
8231 8232 8233 8234 8235 8236 8237 | 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 | - - + |
case FP_SUBNORMAL:
TclNewLiteralStringObj(objPtr, "subnormal");
break;
case FP_ZERO:
TclNewLiteralStringObj(objPtr, "zero");
break;
default:
|
| ︙ | |||
8273 8274 8275 8276 8277 8278 8279 | 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 | - + - - + + |
while (tail > name + 1) {
tail--;
if (*tail == ':' && tail[-1] == ':') {
name = tail + 1;
break;
}
}
|
| ︙ | |||
8692 8693 8694 8695 8696 8697 8698 | 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 | - + - - + |
void
TclMarkTailcall(
Tcl_Interp *interp)
{
Interp *iPtr = (Interp *) interp;
if (iPtr->deferredCallbacks == NULL) {
|
| ︙ | |||
8782 8783 8784 8785 8786 8787 8788 | 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 | - - - + + + |
if (objc < 1) {
Tcl_WrongNumArgs(interp, 1, objv, "?command? ?arg ...?");
return TCL_ERROR;
}
if (!(iPtr->varFramePtr->isProcCallFrame & 1)) {
|
| ︙ | |||
8865 8866 8867 8868 8869 8870 8871 | 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 | - + |
}
/*
* Perform the tailcall
*/
TclMarkTailcall(interp);
|
| ︙ | |||
8943 8944 8945 8946 8947 8948 8949 | 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 8958 8959 8960 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 | - - - + + - + - - - - + + - - - + + - |
if (objc > 2) {
Tcl_WrongNumArgs(interp, 1, objv, "?returnValue?");
return TCL_ERROR;
}
if (!corPtr) {
|
| ︙ | |||
9034 9035 9036 9037 9038 9039 9040 | 9011 9012 9013 9014 9015 9016 9017 9018 9019 9020 9021 9022 9023 9024 9025 | - + - |
Tcl_InterpState state = Tcl_SaveInterpState(interp, result);
NRE_ASSERT(COR_IS_SUSPENDED(corPtr));
NRE_ASSERT(corPtr->eePtr != NULL);
NRE_ASSERT(corPtr->eePtr != iPtr->execEnvPtr);
corPtr->eePtr->rewind = 1;
|
| ︙ | |||
9179 9180 9181 9182 9183 9184 9185 | 9155 9156 9157 9158 9159 9160 9161 9162 9163 9164 9165 9166 9167 9168 9169 | - + - |
if (!corPtr->stackLevel) {
/*
* -- Coroutine is suspended --
* Push the callback to restore the caller's context on yield or
* return.
*/
|
| ︙ | |||
9217 9218 9219 9220 9221 9222 9223 | 9192 9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 9203 9204 9205 9206 9207 | - - - + + - | corPtr->yieldPtr = NULL; break; } } } iPtr->execEnvPtr = corPtr->eePtr; |
| ︙ | |||
9277 9278 9279 9280 9281 9282 9283 | 9250 9251 9252 9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 | - - - - + + + - + - + - + - - - + + |
/*
* Look up the coroutine.
*/
cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, objv[1]);
if ((!cmdPtr) || (cmdPtr->nreProc != TclNRInterpCoroutine)) {
|
| ︙ | |||
9339 9340 9341 9342 9343 9344 9345 | 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 | - - + + |
* How to get a coroutine from its handle.
*/
Command *cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, objPtr);
if ((!cmdPtr) || (cmdPtr->nreProc != TclNRInterpCoroutine)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(errMsg, TCL_INDEX_NONE));
|
| ︙ | |||
9371 9372 9373 9374 9375 9376 9377 | 9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 9364 9365 9366 9367 9368 9369 9370 | - - - + + + - + |
corPtr = GetCoroutineFromObj(interp, objv[1],
"can only inject a command into a coroutine");
if (!corPtr) {
return TCL_ERROR;
}
if (!COR_IS_SUSPENDED(corPtr)) {
|
| ︙ | |||
9416 9417 9418 9419 9420 9421 9422 | 9387 9388 9389 9390 9391 9392 9393 9394 9395 9396 9397 9398 9399 9400 9401 9402 9403 | - - + + - - + |
corPtr = GetCoroutineFromObj(interp, objv[1],
"can only inject a probe command into a coroutine");
if (!corPtr) {
return TCL_ERROR;
}
if (!COR_IS_SUSPENDED(corPtr)) {
|
| ︙ | |||
9441 9442 9443 9444 9445 9446 9447 | 9411 9412 9413 9414 9415 9416 9417 9418 9419 9420 9421 9422 9423 9424 9425 | - + - |
/*
* Now we immediately transfer control to the coroutine to run our probe.
* TRICKY STUFF copied from the [yield] implementation.
*
* Push the callback to restore the caller's context on yield back.
*/
|
| ︙ | |||
9505 9506 9507 9508 9509 9510 9511 | 9474 9475 9476 9477 9478 9479 9480 9481 9482 9483 9484 9485 9486 9487 9488 9489 9490 | - + - - + - |
if (!isProbe) {
/*
* If this is [coroinject], add the extra arguments now.
*/
if (nargs == COROUTINE_ARGUMENTS_SINGLE_OPTIONAL) {
|
| ︙ | |||
9582 9583 9584 9585 9586 9587 9588 | 9549 9550 9551 9552 9553 9554 9555 9556 9557 9558 9559 9560 9561 9562 9563 9564 9565 9566 9567 9568 9569 9570 9571 9572 9573 9574 9575 9576 9577 9578 9579 9580 9581 9582 9583 9584 9585 9586 9587 9588 9589 9590 9591 9592 9593 9594 9595 9596 9597 9598 9599 | - - + + - - + - - - - + + + - + - |
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
CoroutineData *corPtr = (CoroutineData *)clientData;
if (!COR_IS_SUSPENDED(corPtr)) {
|
| ︙ | |||
9660 9661 9662 9663 9664 9665 9666 | 9624 9625 9626 9627 9628 9629 9630 9631 9632 9633 9634 9635 9636 9637 9638 9639 9640 9641 9642 9643 9644 9645 9646 9647 9648 | - + - - + + - + - - + + |
}
procName = TclGetString(objv[1]);
TclGetNamespaceForQualName(interp, procName, inNsPtr, 0,
&nsPtr, &altNsPtr, &cxtNsPtr, &simpleName);
if (nsPtr == NULL) {
|
| ︙ | |||
9742 9743 9744 9745 9746 9747 9748 | 9706 9707 9708 9709 9710 9711 9712 9713 9714 9715 9716 9717 9718 9719 9720 9721 9722 9723 9724 9725 9726 9727 9728 9729 9730 9731 9732 9733 9734 9735 9736 9737 9738 | - + - - + - |
corPtr->eePtr->corPtr = corPtr;
SAVE_CONTEXT(corPtr->caller);
corPtr->callerEEPtr = iPtr->execEnvPtr;
RESTORE_CONTEXT(corPtr->running);
iPtr->execEnvPtr = corPtr->eePtr;
|
| ︙ |
Changes to generic/tclBinary.c.
| ︙ | |||
397 398 399 400 401 402 403 | 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 | - - - + + |
if (bytes && numBytesPtr) {
if (numBytes > INT_MAX) {
/* Caller asked for numBytes to be written to an int, but the
* value is outside the int range. */
if (interp) {
|
| ︙ | |||
514 515 516 517 518 519 520 | 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 | - + - - + + |
int ch;
int count = TclUtfToUniChar(src, &ch);
if (ch > 255) {
proper = 0;
if (demandProper) {
if (interp) {
|
| ︙ | |||
963 964 965 966 967 968 969 | 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 | - - + + - - - + + |
if (TclListObjLength(interp, objv[arg], &listc) != TCL_OK) {
return TCL_ERROR;
}
if (count == BINARY_ALL) {
count = listc;
} else if (count > listc) {
|
| ︙ | |||
1294 1295 1296 1297 1298 1299 1300 | 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 | - + - + - - + |
}
}
Tcl_SetObjResult(interp, resultPtr);
return TCL_OK;
badValue:
Tcl_ResetResult(interp);
|
| ︙ | |||
1695 1696 1697 1698 1699 1700 1701 | 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 | - - + |
badField:
{
Tcl_UniChar ch = 0;
char buf[5] = "";
TclUtfToUniChar(errorString, &ch);
buf[Tcl_UniCharToUtf(ch, buf)] = '\0';
|
| ︙ | |||
2561 2562 2563 2564 2565 2566 2567 | 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 | - + - - + + |
badChar:
if (pure) {
ucs4 = c;
} else {
TclUtfToUniChar((const char *)(data - 1), &ucs4);
}
TclDecrRefCount(resultObj);
|
| ︙ | |||
2630 2631 2632 2633 2634 2635 2636 | 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 | - - - - + + + |
}
switch (index) {
case OPT_MAXLEN:
if (TclGetWideIntFromObj(interp, objv[i + 1], &maxlen) != TCL_OK) {
return TCL_ERROR;
}
if (maxlen < 0) {
|
| ︙ | |||
2758 2759 2760 2761 2762 2763 2764 | 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 | - - - - + + + - + - - - + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - + + + - + |
switch (index) {
case OPT_MAXLEN:
if (Tcl_GetIntFromObj(interp, objv[i + 1],
&lineLength) != TCL_OK) {
return TCL_ERROR;
}
if (lineLength < 5 || lineLength > 85) {
|
| ︙ | |||
3014 3015 3016 3017 3018 3019 3020 | 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 | - - + + - + - - + + |
goto shortUu;
}
Tcl_SetByteArrayLength(resultObj, cursor - begin);
Tcl_SetObjResult(interp, resultObj);
return TCL_OK;
shortUu:
|
| ︙ | |||
3201 3202 3203 3204 3205 3206 3207 | 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 | - + - - + + |
* valid member of the base64 alphabet, it could be the lead byte
* of a multi-byte character. */
/* Safe because we know data is NUL-terminated */
TclUtfToUniChar((const char *)(data - 1), &ucs4);
}
|
Changes to generic/tclCkalloc.c.
| ︙ | |||
186 187 188 189 190 191 192 | 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | - + |
current_bytes_malloced,
maximum_malloc_packets,
maximum_bytes_malloced);
if (flags == 0) {
fprintf((FILE *)clientData, "%s", buf);
} else {
/* Assume objPtr to append to */
|
| ︙ | |||
821 822 823 824 825 826 827 | 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 | - - + + - + - + - - + + - |
fileName = Tcl_TranslateFileName(interp, TclGetString(objv[2]), &buffer);
if (fileName == NULL) {
return TCL_ERROR;
}
result = Tcl_DumpActiveMemory(fileName);
Tcl_DStringFree(&buffer);
if (result != TCL_OK) {
|
| ︙ | |||
931 932 933 934 935 936 937 | 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 | - + - + |
if (objc != 3) {
goto bad_suboption;
}
validate_memory = (strcmp(TclGetString(objv[2]),"on") == 0);
return TCL_OK;
}
|
| ︙ |
Changes to generic/tclClock.c.
| ︙ | |||
698 699 700 701 702 703 704 | 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 | - - + + - - + |
/* if locale was not yet used */
if (!(opts->flags & CLF_LOCALE_USED)) {
opts->localeObj = NormLocaleObj(dataPtr, opts->interp,
opts->localeObj, &opts->mcDictObj);
if (opts->localeObj == NULL) {
|
| ︙ | |||
969 970 971 972 973 974 975 | 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 | - - + + |
};
int optionIndex; /* Index of an option. */
Tcl_Size i;
for (i = 1; i < objc; i++) {
if (Tcl_GetIndexFromObj(interp, objv[i++], options,
"option", 0, &optionIndex) != TCL_OK) {
|
| ︙ | |||
1423 1424 1425 1426 1427 1428 1429 | 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 | - - + + |
}
dict = objv[1];
if (Tcl_DictObjGet(interp, dict, dataPtr->literals[LIT_LOCALSECONDS],
&secondsObj)!= TCL_OK) {
return TCL_ERROR;
}
if (secondsObj == NULL) {
|
| ︙ | |||
1650 1651 1652 1653 1654 1655 1656 | 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 | - - + - - + |
{
Tcl_Obj *value = NULL;
if (Tcl_DictObjGet(interp, dict, key, &value) != TCL_OK) {
return TCL_ERROR;
}
if (value == NULL) {
|
| ︙ | |||
2114 2115 2116 2117 2118 2119 2120 | 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 | - - + |
/*
* If conversion fails, report an error.
*/
if (localErrno != 0
|| (fields->seconds == -1 && timeVal.tm_yday == -1)) {
|
| ︙ | |||
2336 2337 2338 2339 2340 2341 2342 | 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 | - - - + + + - + - - + + |
/*
* Use 'localtime' to determine local year, month, day, time of day.
*/
tock = (time_t) fields->seconds;
if ((Tcl_WideInt) tock != fields->seconds) {
|
| ︙ | |||
3324 3325 3326 3327 3328 3329 3330 | 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 | - - + + - |
goto badOptionMsg;
}
/* if already specified */
if (saw & (1 << optionIndex)) {
if (operation != CLC_OP_SCN && optionIndex == CLC_ARGS_BASE) {
goto badOptionMsg;
}
|
| ︙ | |||
3376 3377 3378 3379 3380 3381 3382 | 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 | - - - + + + |
/*
* Check options.
*/
if ((saw & (1 << CLC_ARGS_GMT))
&& (saw & (1 << CLC_ARGS_TIMEZONE))) {
|
| ︙ | |||
3425 3426 3427 3428 3429 3430 3431 | 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 | - - - + + + |
goto baseNow;
}
if (TclHasInternalRep(baseObj, &tclBignumType)) {
goto baseOverflow;
}
|
| ︙ | |||
3481 3482 3483 3484 3485 3486 3487 | 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 | - - + + - - - + + |
memcpy(&dataPtr->lastBase.date, date, ClockCacheableDateFieldsSize);
TclSetObjRef(dataPtr->lastBase.timezoneObj, opts->timezoneObj);
}
return TCL_OK;
badOptionMsg:
|
| ︙ | |||
3530 3531 3532 3533 3534 3535 3536 | 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 | - + |
int ret;
ClockFmtScnCmdArgs opts; /* Format, locale, timezone and base */
DateFormat dateFmt; /* Common structure used for formatting */
/* even number of arguments */
if ((objc & 1) == 1) {
Tcl_WrongNumArgs(interp, 0, objv, syntax);
|
| ︙ | |||
3601 3602 3603 3604 3605 3606 3607 | 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 | - + |
ClockFmtScnCmdArgs opts; /* Format, locale, timezone and base */
DateInfo yy; /* Common structure used for parsing */
DateInfo *info = &yy;
/* even number of arguments */
if ((objc & 1) == 1) {
Tcl_WrongNumArgs(interp, 0, objv, syntax);
|
| ︙ | |||
3628 3629 3630 3631 3632 3633 3634 | 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 | - - - + + + |
/* If free scan */
if (opts.formatObj == NULL) {
/* Use compiled version of FreeScan - */
/* [SB] TODO: Perhaps someday we'll localize the legacy code. Right now,
* it's not localized. */
if (opts.localeObj != NULL) {
|
| ︙ | |||
3722 3723 3724 3725 3726 3727 3728 | 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 | - - - + + + |
}
/* some overflow checks */
if (info->flags & CLF_JULIANDAY) {
double curJDN = (double)yydate.julianDay
+ ((double)yySecondOfDay - SECONDS_PER_DAY/2) / SECONDS_PER_DAY;
if (curJDN > opts->dataPtr->maxJDN) {
|
| ︙ | |||
3955 3956 3957 3958 3959 3960 3961 | 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 | - - - + + |
goto error;
}
}
return TCL_OK;
error:
|
| ︙ | |||
3999 4000 4001 4002 4003 4004 4005 | 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 | - + - + |
* Notice that many yy-defines point to values in the "info" or "date"
* structure, e. g. yySecondOfDay -> info->date.secondOfDay or
* yyMonth -> info->date.month (same as yydate.month)
*/
yyInput = TclGetString(strObj);
if (TclClockFreeScan(interp, info) != TCL_OK) {
|
| ︙ | |||
4396 4397 4398 4399 4400 4401 4402 | 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 | - + |
int unitIndex; /* Index of an option. */
Tcl_Size i;
Tcl_WideInt offs;
/* even number of arguments */
if ((objc & 1) == 1) {
Tcl_WrongNumArgs(interp, 0, objv, syntax);
|
| ︙ |
Changes to generic/tclClockFmt.c.
| ︙ | |||
856 857 858 859 860 861 862 | 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 | + - - - + + + |
fss->objRefCount++;
ObjClockFmtScn(objPtr) = fss;
}
Tcl_MutexUnlock(&ClockFmtMutex);
if (fss == NULL && interp != NULL) {
TclPrintfResult(interp,
|
| ︙ | |||
1603 1604 1605 1606 1607 1608 1609 | 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 | - - - + + |
return TCL_RETURN;
}
if (val == 0) {
val = 7;
}
if (val > 7) {
|
| ︙ | |||
2698 2699 2700 2701 2702 2703 2704 | 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 | - - - + + + - - + + - + - + - + |
ret = TCL_OK;
done:
return ret;
/* Error case reporting. */
overflow:
|
| ︙ |
Changes to generic/tclCmdAH.c.
| ︙ | |||
182 183 184 185 186 187 188 | 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | - + |
varNamePtr = objv[2];
}
if (objc == 4) {
optionVarNamePtr = objv[3];
}
TclNRAddCallback(interp, CatchObjCmdCallback, INT2PTR(objc),
|
| ︙ | |||
208 209 210 211 212 213 214 | 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | - - + + |
int rewind = iPtr->execEnvPtr->rewind;
/*
* We disable catch in interpreters where the limit has been exceeded.
*/
if (rewind || Tcl_LimitExceeded(interp)) {
|
| ︙ | |||
286 287 288 289 290 291 292 | 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | - + - + |
Tcl_DString ds;
result = Tcl_UtfToExternalDStringEx(NULL, TCLFSENCODING, TclGetString(dir), -1, 0, &ds, NULL);
Tcl_DStringFree(&ds);
if (result == TCL_OK) {
result = Tcl_FSChdir(dir);
}
if (result != TCL_OK) {
|
| ︙ | |||
721 722 723 724 725 726 727 | 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 | - + - - + + - |
if (objc == 1) {
Tcl_SetObjResult(interp, Tcl_GetEncodingSearchPath());
return TCL_OK;
}
dirListObj = objv[1];
if (Tcl_SetEncodingSearchPath(dirListObj) == TCL_ERROR) {
|
| ︙ | |||
897 898 899 900 901 902 903 | 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 | - - + + |
static int
EvalCmdErrMsg(
TCL_UNUSED(void **),
Tcl_Interp *interp,
int result)
{
if (result == TCL_ERROR) {
|
| ︙ | |||
951 952 953 954 955 956 957 | 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 | - + |
*
* TIP #280. Make invoking context available to eval'd script, done
* with the default values.
*/
objPtr = Tcl_ConcatObj(objc-1, objv+1);
}
|
| ︙ | |||
1047 1048 1049 1050 1051 1052 1053 | 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 | - + - + |
return TCL_ERROR;
}
TclNewObj(resultPtr);
Tcl_IncrRefCount(resultPtr);
if (objc == 2) {
objPtr = objv[1];
|
| ︙ | |||
1187 1188 1189 1190 1191 1192 1193 | 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 | - + - + - + - + |
}
if (GetStatBuf(interp, objv[1], Tcl_FSStat, &buf) != TCL_OK) {
return TCL_ERROR;
}
#if defined(_WIN32)
/* We use a value of 0 to indicate the access time not available */
if (Tcl_GetAccessTimeFromStat(&buf) == 0) {
|
| ︙ | |||
1269 1270 1271 1272 1273 1274 1275 | 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 1302 1303 1304 1305 1306 | - + - + - + - + |
}
if (GetStatBuf(interp, objv[1], Tcl_FSStat, &buf) != TCL_OK) {
return TCL_ERROR;
}
#if defined(_WIN32)
/* We use a value of 0 to indicate the modification time not available */
if (Tcl_GetModificationTimeFromStat(&buf) == 0) {
|
| ︙ | |||
1916 1917 1918 1919 1920 1921 1922 | 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 | - - - + + + |
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "name");
return TCL_ERROR;
}
fsInfo = Tcl_FSFileSystemInfo(objv[1]);
if (fsInfo == NULL) {
|
| ︙ | |||
2064 2065 2066 2067 2068 2069 2070 | 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 | - + - - + + - |
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "name");
return TCL_ERROR;
}
res = Tcl_FSSplitPath(objv[1], (Tcl_Size *)NULL);
if (res == NULL) {
|
| ︙ | |||
2167 2168 2169 2170 2171 2172 2173 | 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 | - - - - + + + |
break;
}
Tcl_SetObjResult(interp, Tcl_NewStringObj(separator, 1));
} else {
Tcl_Obj *separatorObj = Tcl_FSPathSeparator(objv[1]);
if (separatorObj == NULL) {
|
| ︙ | |||
2300 2301 2302 2303 2304 2305 2306 | 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 | - - - + + |
} else {
status = statProc(pathPtr, statPtr);
}
Tcl_DStringFree(&ds);
if (status < 0) {
if (interp != NULL) {
|
| ︙ | |||
2342 2343 2344 2345 2346 2347 2348 | 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 | - - + + - - |
{
Tcl_Obj *field, *value, *result;
unsigned short mode;
if (varName == NULL) {
TclNewObj(result);
Tcl_IncrRefCount(result);
|
| ︙ | |||
2535 2536 2537 2538 2539 2540 2541 | 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 | - + |
TclSmallAllocEx(interp, sizeof(ForIterData), iterPtr);
iterPtr->cond = objv[2];
iterPtr->body = objv[4];
iterPtr->next = objv[3];
iterPtr->msg = "\n (\"for\" body line %d)";
iterPtr->word = 4;
|
| ︙ | |||
2559 2560 2561 2562 2563 2564 2565 | 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 | - + |
if (result != TCL_OK) {
if (result == TCL_ERROR) {
Tcl_AddErrorInfo(interp, "\n (\"for\" initial command)");
}
TclSmallFreeEx(interp, iterPtr);
return result;
}
|
| ︙ | |||
2583 2584 2585 2586 2587 2588 2589 | 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 | - + - - - + | * We need to reset the result before evaluating the expression. * Otherwise, any error message will be appended to the result of the * last evaluation. */ Tcl_ResetResult(interp); TclNewObj(boolObj); |
| ︙ | |||
2623 2624 2625 2626 2627 2628 2629 | 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 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 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 | - + - - + - - + - - + - + |
return TCL_ERROR;
}
Tcl_DecrRefCount(boolObj);
if (value) {
/* TIP #280. */
if (iterPtr->next) {
|
| ︙ | |||
2809 2810 2811 2812 2813 2814 2815 | 2798 2799 2800 2801 2802 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 | - + - - - - - - + + + + + + - + |
/* Variables */
statePtr->vCopyList[i] = TclListObjCopy(interp, objv[1+i*2]);
if (statePtr->vCopyList[i] == NULL) {
result = TCL_ERROR;
goto done;
}
result = TclListObjLength(interp, statePtr->vCopyList[i],
|
| ︙ | |||
2871 2872 2873 2874 2875 2876 2877 | 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 | - + |
if (statePtr->maxj > 0) {
result = ForeachAssignments(interp, statePtr);
if (result == TCL_ERROR) {
goto done;
}
|
| ︙ | |||
2922 2923 2924 2925 2926 2927 2928 | 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 | - - + - + - + |
}
}
break;
case TCL_BREAK:
result = TCL_OK;
goto finish;
case TCL_ERROR:
|
| ︙ | |||
2985 2986 2987 2988 2989 2990 2991 | 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 | - + - + - + - + |
TclObjTypeHasProc(statePtr->aCopyList[i],indexProc) != NULL;
for (v=0 ; v<statePtr->varcList[i] ; v++) {
k = statePtr->index[i]++;
if (k < statePtr->argcList[i]) {
if (isAbstractList) {
if (TclObjTypeIndex(interp, statePtr->aCopyList[i], k, &valuePtr) != TCL_OK) {
|
| ︙ |
Changes to generic/tclCmdIL.c.
| ︙ | |||
217 218 219 220 221 222 223 | 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 | - + - - + + - - + + |
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Obj *boolObj;
if (objc <= 1) {
|
| ︙ | |||
308 309 310 311 312 313 314 | 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 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 | - + - - + + - + - - + + - - + - + - - + + |
* At this point in the loop, objv and objc refer to an expression to
* test, either for the main expression or an expression following an
* "elseif". The arguments after the expression must be "then"
* (optional) and a script to execute if the expression is true.
*/
if (i >= objc) {
|
| ︙ | |||
482 483 484 485 486 487 488 | 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 | - - - + + |
Tcl_WrongNumArgs(interp, 1, objv, "procname");
return TCL_ERROR;
}
name = TclGetString(objv[1]);
procPtr = TclFindProc(iPtr, name);
if (procPtr == NULL) {
|
| ︙ | |||
544 545 546 547 548 549 550 | 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 | - - - + + |
Tcl_WrongNumArgs(interp, 1, objv, "procname");
return TCL_ERROR;
}
name = TclGetString(objv[1]);
procPtr = TclFindProc(iPtr, name);
if (procPtr == NULL) {
|
| ︙ | |||
964 965 966 967 968 969 970 | 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 | - - - + + - |
}
procName = TclGetString(objv[1]);
argName = TclGetString(objv[2]);
procPtr = TclFindProc(iPtr, procName);
if (procPtr == NULL) {
|
| ︙ | |||
997 998 999 1000 1001 1002 1003 | 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 | - + - - + + |
}
Tcl_SetObjResult(interp, Tcl_NewBooleanObj(0));
}
return TCL_OK;
}
}
|
| ︙ | |||
1180 1181 1182 1183 1184 1185 1186 | 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 | - - - + + - |
if (TclGetIntFromObj(interp, objv[1], &level) != TCL_OK) {
code = TCL_ERROR;
goto done;
}
if ((level > topLevel) || (level <= - topLevel)) {
levelError:
|
| ︙ | |||
1478 1479 1480 1481 1482 1483 1484 | 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 | - + - + |
int code;
if (objc > 2) {
Tcl_WrongNumArgs(interp, 1, objv, "?pattern?");
return TCL_ERROR;
}
|
| ︙ | |||
1548 1549 1550 1551 1552 1553 1554 | 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 | - - - + + |
name = Tcl_GetHostName();
if (name) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(name, -1));
return TCL_OK;
}
|
| ︙ | |||
1620 1621 1622 1623 1624 1625 1626 | 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 | - - - + + - |
return TCL_OK;
}
Tcl_WrongNumArgs(interp, 1, objv, "?number?");
return TCL_ERROR;
levelError:
|
| ︙ | |||
1668 1669 1670 1671 1672 1673 1674 | 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 | - - - + + |
libDirName = Tcl_GetVar2(interp, "tcl_library", NULL, TCL_GLOBAL_ONLY);
if (libDirName != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(libDirName, -1));
return TCL_OK;
}
|
| ︙ | |||
2122 2123 2124 2125 2126 2127 2128 | 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 | - + - - + + |
/*
* There's one special case: safe child interpreters can't see aliases as
* aliases as they're part of the security mechanisms.
*/
if (Tcl_IsSafe(interp)
&& (((Command *) command)->objProc == TclAliasObjCmd)) {
|
| ︙ | |||
2199 2200 2201 2202 2203 2204 2205 | 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 | - + |
return TCL_ERROR;
}
Tcl_SetObjResult(interp, elemObj);
}
return TCL_OK;
}
|
| ︙ | |||
2633 2634 2635 2636 2637 2638 2639 | 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 | - - - + + - + |
* First, extract the element to be returned.
* TclLindexFlat adds a ref count which is handled.
*/
if (objc == 2) {
if (!listLen) {
/* empty list, throw the same error as with index "end" */
|
| ︙ | |||
2954 2955 2956 2957 2958 2959 2960 | 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 | - - - + + + + - - - - + + + + |
Tcl_WrongNumArgs(interp, 1, objv, "count ?value ...?");
return TCL_ERROR;
}
if (TCL_OK != TclGetWideIntFromObj(interp, objv[1], &elementCount)) {
return TCL_ERROR;
}
if (elementCount < 0) {
|
| ︙ | |||
3389 3390 3391 3392 3393 3394 3395 | 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 | - - - + + - - + + - - + - - - - + + + - - + + - - + |
*/
if (startPtr != NULL) {
Tcl_DecrRefCount(startPtr);
startPtr = NULL;
}
if (i > objc-4) {
|
| ︙ | |||
3490 3491 3492 3493 3494 3495 3496 | 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 | - + - - + + - - + + - - - + + + - - - - + + - |
for (j=0 ; j<sortInfo.indexc ; j++) {
int encoded = 0;
if (TclIndexEncode(interp, indices[j], TCL_INDEX_NONE,
TCL_INDEX_NONE, &encoded) != TCL_OK) {
result = TCL_ERROR;
}
if (encoded == (int)TCL_INDEX_NONE) {
|
| ︙ | |||
3575 3576 3577 3578 3579 3580 3581 | 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 | - - + + - - + - - + - - - + + + |
/*
* Check for sanity when grouping elements of the overall list together
* because of the -stride option. [TIP #351]
*/
if (groupSize > 1) {
if (listc % groupSize) {
|
| ︙ | |||
4057 4058 4059 4060 4061 4062 4063 | 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 | - + - - + + - + - |
*numValuePtr = argPtr;
Tcl_IncrRefCount(argPtr);
return NumericArg;
}
}
if (allowedArgs & RangeKeywordArg) {
result = Tcl_GetIndexFromObj(NULL, argPtr, seq_operations,
|
| ︙ | |||
4577 4578 4579 4580 4581 4582 4583 | 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 | - + - - + + |
}
switch (index) {
case LSORT_ASCII:
sortInfo.sortMode = SORTMODE_ASCII;
break;
case LSORT_COMMAND:
if (i == objc-2) {
|
| ︙ | |||
4602 4603 4604 4605 4606 4607 4608 | 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 | - - + + - - + |
sortInfo.isIncreasing = 1;
break;
case LSORT_INDEX: {
Tcl_Size sortindex;
Tcl_Obj **indexv;
if (i == objc-2) {
|
| ︙ | |||
4629 4630 4631 4632 4633 4634 4635 | 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 | - + - - + + - - + + |
for (j=0 ; j<sortindex ; j++) {
int encoded = 0;
int result = TclIndexEncode(interp, indexv[j],
TCL_INDEX_NONE, TCL_INDEX_NONE, &encoded);
if ((result == TCL_OK) && (encoded == (int)TCL_INDEX_NONE)) {
|
| ︙ | |||
4663 4664 4665 4666 4667 4668 4669 | 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 | - - + + - - + - - - + + - |
sortInfo.unique = 1;
break;
case LSORT_INDICES:
indices = 1;
break;
case LSORT_STRIDE:
if (i == objc-2) {
|
| ︙ | |||
4777 4778 4779 4780 4781 4782 4783 | 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 | - - + + - - + - - + - - + + - |
/*
* Check for sanity when grouping elements of the overall list together
* because of the -stride option. [TIP #326]
*/
if (group) {
if (length % groupSize) {
|
| ︙ | |||
4858 4859 4860 4861 4862 4863 4864 | 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 | - - - + + + + |
elmArrSize = length * sizeof(SortElement);
if (elmArrSize <= MAXCALLOC) {
elementArray = (SortElement *)Tcl_Alloc(elmArrSize);
} else {
elementArray = (SortElement *)malloc(elmArrSize);
}
if (!elementArray) {
|
| ︙ | |||
5311 5312 5313 5314 5315 5316 5317 | 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 | - - - - + + + + |
/*
* Parse the result of the command.
*/
if (TclGetIntFromObj(infoPtr->interp,
Tcl_GetObjResult(infoPtr->interp), &order) != TCL_OK) {
|
| ︙ | |||
5521 5522 5523 5524 5525 5526 5527 | 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 | - + - + - + - + - - + + |
¤tObj) != TCL_OK) {
infoPtr->resultCode = TCL_ERROR;
return NULL;
}
if (currentObj == NULL) {
if (index == TCL_INDEX_NONE) {
index = TCL_INDEX_END - infoPtr->indexv[i];
|
| ︙ |
Changes to generic/tclCmdMZ.c.
| ︙ | |||
225 226 227 228 229 230 231 | 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | - - - + + + - |
/*
* Check if the user requested -inline, but specified match variables; a
* no-no.
*/
if (doinline && ((objc - 2) != 0)) {
|
| ︙ | |||
677 678 679 680 681 682 683 | 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 | - - + + - - + - |
* object. (If they aren't, that's cheap to do.)
*/
if (TclListObjLength(interp, objv[2], &numParts) != TCL_OK) {
return TCL_ERROR;
}
if (numParts < 1) {
|
| ︙ | |||
810 811 812 813 814 815 816 | 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 | - + - + |
result = Tcl_EvalObjv(interp, numArgs, args, 0);
for (idx = 0 ; idx <= info.nsubs ; idx++) {
TclDecrRefCount(args[idx + numParts]);
}
Tcl_Free(args);
if (result != TCL_OK) {
if (result == TCL_ERROR) {
|
| ︙ | |||
1968 1969 1970 1971 1972 1973 1974 | 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 | - - - + + + - |
if (objc == 4) {
const char *string = TclGetStringFromObj(objv[1], &length2);
if ((length2 > 1) &&
strncmp(string, "-nocase", length2) == 0) {
nocase = 1;
} else {
|
| ︙ | |||
2036 2037 2038 2039 2040 2041 2042 | 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 | - - - + + - |
Tcl_SetObjResult(interp, objv[objc-1]);
return TCL_OK;
} else if (mapElemc & 1) {
/*
* The charMap must be an even number of key/value items.
*/
|
| ︙ | |||
2240 2241 2242 2243 2244 2245 2246 | 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 | - - - + + + - |
if (objc == 4) {
Tcl_Size length;
const char *string = TclGetStringFromObj(objv[1], &length);
if ((length > 1) && strncmp(string, "-nocase", length) == 0) {
nocase = TCL_MATCH_NOCASE;
} else {
|
| ︙ | |||
2661 2662 2663 2664 2665 2666 2667 | 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 | - - + + - - - + + |
if (TclGetWideIntFromObj(interp, objv[i], &reqlength) != TCL_OK) {
return TCL_ERROR;
}
if ((Tcl_WideUInt)reqlength > TCL_SIZE_MAX) {
reqlength = -1;
}
} else {
|
| ︙ | |||
2766 2767 2768 2769 2770 2771 2772 | 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 | - - + + - - - + + |
}
if ((Tcl_WideUInt)wreqlength > TCL_SIZE_MAX) {
*reqlength = -1;
} else {
*reqlength = wreqlength;
}
} else {
|
| ︙ | |||
2933 2934 2935 2936 2937 2938 2939 | 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 | - + | end = Tcl_UtfAtIndex(start, last - first + 1); resultPtr = Tcl_NewStringObj(string1, end - string1); string2 = TclGetString(resultPtr) + (start - string1); length2 = Tcl_UtfToLower(string2); Tcl_SetObjLength(resultPtr, length2 + (start - string1)); |
| ︙ | |||
3018 3019 3020 3021 3022 3023 3024 | 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 | - + | end = Tcl_UtfAtIndex(start, last - first + 1); resultPtr = Tcl_NewStringObj(string1, end - string1); string2 = TclGetString(resultPtr) + (start - string1); length2 = Tcl_UtfToUpper(string2); Tcl_SetObjLength(resultPtr, length2 + (start - string1)); |
| ︙ | |||
3103 3104 3105 3106 3107 3108 3109 | 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 | - + | end = Tcl_UtfAtIndex(start, last - first + 1); resultPtr = Tcl_NewStringObj(string1, end - string1); string2 = TclGetString(resultPtr) + (start - string1); length2 = Tcl_UtfToTitle(string2); Tcl_SetObjLength(resultPtr, length2 + (start - string1)); |
| ︙ | |||
3496 3497 3498 3499 3500 3501 3502 | 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 | - + - - - + + + - + - - + + - - + - - + + - - - - + + + - - - - + + + - |
default:
if (foundmode) {
/*
* Mode already set via -exact, -glob, or -regexp.
*/
|
| ︙ | |||
3610 3611 3612 3613 3614 3615 3616 | 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 | - - - + + - - + - - - + + + - + - - - + + + |
/*
* Complain if there is an odd number of words in the list of patterns and
* bodies.
*/
if (objc % 2) {
Tcl_ResetResult(interp);
|
| ︙ | |||
3888 3889 3890 3891 3892 3893 3894 | 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 | - - + + - + |
}
}
/*
* TIP #280: Make invoking context available to switch branch.
*/
|
| ︙ | |||
3930 3931 3932 3933 3934 3935 3936 | 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 | - - + - + |
* Generate an error message if necessary.
*/
if (result == TCL_ERROR) {
int limit = 50;
int overflow = (patternLength > limit);
|
| ︙ | |||
3978 3979 3980 3981 3982 3983 3984 | 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 | - - - + + - |
/*
* The type must be a list of at least length 1.
*/
if (TclListObjLength(interp, objv[1], &len) != TCL_OK) {
return TCL_ERROR;
} else if (len < 1) {
|
| ︙ | |||
4717 4718 4719 4720 4721 4722 4723 | 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 | - - + - - + + - + - + - - + + - + - + - - + + - + - + - - - + + - - + + - + - - + + |
0, &type) != TCL_OK) {
Tcl_DecrRefCount(handlersObj);
return TCL_ERROR;
}
switch (type) {
case TryFinally: /* finally script */
if (i < objc-2) {
|
| ︙ | |||
4799 4800 4801 4802 4803 4804 4805 | 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 | - - + + - + - - - + + |
Tcl_NewListObj(5, info));
haveHandlers = 1;
i += 3;
break;
}
}
if (bodyShared) {
|
| ︙ | |||
4891 4892 4893 4894 4895 4896 4897 | 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 | - - - + + - - - + + |
cmdObj = objv[0];
/*
* Check for limits/rewinding, which override normal trapping behaviour.
*/
if (((Interp*) interp)->execEnvPtr->rewind || Tcl_LimitExceeded(interp)) {
|
| ︙ | |||
5026 5027 5028 5029 5030 5031 5032 | 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 | - + | * now because the info[] array is about to become invalid. There * is very little refcount handling here however, since we know * that the objects that we still want to refer to now were input * arguments to [try] and so are still on the Tcl value stack. */ handlerBodyObj = info[4]; |
| ︙ | |||
5054 5055 5056 5057 5058 5059 5060 | 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 | - + - |
}
/*
* Process the finally clause.
*/
if (finallyObj != NULL) {
|
| ︙ | |||
5138 5139 5140 5141 5142 5143 5144 | 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 | - + - |
/*
* Process the finally clause if it is present.
*/
if (finallyObj != NULL) {
Interp *iPtr = (Interp *) interp;
|
| ︙ | |||
5271 5272 5273 5274 5275 5276 5277 | 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 | - + - |
TclSmallAllocEx(interp, sizeof(ForIterData), iterPtr);
iterPtr->cond = objv[1];
iterPtr->body = objv[2];
iterPtr->next = NULL;
iterPtr->msg = "\n (\"while\" body line %d)";
iterPtr->word = 2;
|
| ︙ |
Changes to generic/tclCompCmds.c.
| ︙ | |||
2371 2372 2373 2374 2375 2376 2377 | 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 | - + |
TCL_UNUSED(size_t))
{
DictUpdateInfo *duiPtr = (DictUpdateInfo *)clientData;
Tcl_Size i;
for (i=0 ; i<duiPtr->length ; i++) {
if (i) {
|
| ︙ | |||
3051 3052 3053 3054 3055 3056 3057 | 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 | - + - + - + - + - + - + - + - + - + |
TCL_UNUSED(ByteCode *),
TCL_UNUSED(size_t))
{
ForeachInfo *infoPtr = (ForeachInfo *)clientData;
ForeachVarList *varsPtr;
Tcl_Size i, j;
|
| ︙ | |||
3348 3349 3350 3351 3352 3353 3354 | 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 | - + |
* in the format string. */
TclNewObj(tmpObj); /* The buffer used to accumulate the literal
* being built. */
for (bytes = start ; *bytes ; bytes++) {
if (*bytes == '%') {
Tcl_AppendToObj(tmpObj, start, bytes - start);
if (*++bytes == '%') {
|
| ︙ |
Changes to generic/tclCompCmdsSZ.c.
| ︙ | |||
2595 2596 2597 2598 2599 2600 2601 | 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 | - + - + |
hPtr = Tcl_FirstHashEntry(&jtPtr->hashTable, &search);
for (; hPtr ; hPtr = Tcl_NextHashEntry(&search)) {
keyPtr = (const char *)Tcl_GetHashKey(&jtPtr->hashTable, hPtr);
offset = PTR2INT(Tcl_GetHashValue(hPtr));
if (i++) {
|
| ︙ |
Changes to generic/tclCompExpr.c.
| ︙ | |||
780 781 782 783 784 785 786 | 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 | - - + + - - + + - - + + |
const char *stop;
TclParseNumber(NULL, NULL, NULL, start, scanned,
&stop, TCL_PARSE_NO_WHITESPACE);
if (isdigit(UCHAR(*stop)) || (stop == start + 1)) {
switch (start[1]) {
case 'b':
|
| ︙ | |||
1445 1446 1447 1448 1449 1450 1451 | 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 | - + - - + - + - + - |
(start + scanned + limit > parsePtr->end) ? "" : "...");
/*
* Next, append any postscript message.
*/
if (post != NULL) {
|
| ︙ |
Changes to generic/tclCompile.c.
| ︙ | |||
2167 2168 2169 2170 2171 2172 2173 | 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 | - - - + + + - + - - + + |
* Check depth to avoid overflow of the C execution stack by too many
* nested calls of TclCompileScript, considering interp recursionlimit.
* Use factor 5/4 (1.25) to avoid being too mistaken when recognizing the
* limit during "mixed" evaluation and compilation process (nested
* eval+compile) and is good enough for default recursionlimit (1000).
*/
if (iPtr->numLevels / 5 > iPtr->maxNestingDepth / 4) {
|
| ︙ |
Changes to generic/tclConfig.c.
| ︙ | |||
223 224 225 226 227 228 229 | 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 | - - - + + + - - - + + + |
if (Tcl_DictObjGet(interp, pDB, pkgName, &pkgDict) != TCL_OK
|| pkgDict == NULL) {
/*
* Maybe a Tcl_Panic is better, because the package data has to be
* present.
*/
|
| ︙ | |||
274 275 276 277 278 279 280 | 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | - - - + + |
return TCL_ERROR;
}
Tcl_DictObjSize(interp, pkgDict, &m);
listPtr = Tcl_NewListObj(m, NULL);
if (!listPtr) {
|
| ︙ |
Changes to generic/tclDictObj.c.
| ︙ | |||
712 713 714 715 716 717 718 | 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 | - - - + + |
dict->chain = NULL;
dict->refCount = 1;
DictSetInternalRep(objPtr, dict);
return TCL_OK;
missingValue:
if (interp != NULL) {
|
| ︙ | |||
805 806 807 808 809 810 811 | 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 | - + - - - + + + |
int isNew; /* Dummy */
if (flags & DICT_PATH_EXISTS) {
return DICT_PATH_NON_EXISTENT;
}
if ((flags & DICT_PATH_CREATE) != DICT_PATH_CREATE) {
if (interp != NULL) {
|
| ︙ | |||
1765 1766 1767 1768 1769 1770 1771 | 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 | - + - - - + + + |
return TCL_ERROR;
}
result = Tcl_DictObjGet(interp, dictPtr, objv[objc-1], &valuePtr);
if (result != TCL_OK) {
return result;
}
if (valuePtr == NULL) {
|
| ︙ | |||
2698 2699 2700 2701 2702 2703 2704 | 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 | - - - + + |
* Parse arguments.
*/
if (TclListObjGetElements(interp, objv[1], &varc, &varv) != TCL_OK) {
return TCL_ERROR;
}
if (varc != 2) {
|
| ︙ | |||
2791 2792 2793 2794 2795 2796 2797 | 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 | - - - + + |
if (result == TCL_CONTINUE) {
result = TCL_OK;
} else if (result != TCL_OK) {
if (result == TCL_BREAK) {
Tcl_ResetResult(interp);
result = TCL_OK;
} else if (result == TCL_ERROR) {
|
| ︙ | |||
2893 2894 2895 2896 2897 2898 2899 | 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 | - - - + + + |
* Parse arguments.
*/
if (TclListObjGetElements(interp, objv[1], &varc, &varv) != TCL_OK) {
return TCL_ERROR;
}
if (varc != 2) {
|
| ︙ | |||
2953 2954 2955 2956 2957 2958 2959 | 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 | - + |
}
TclDecrRefCount(valueObj);
/*
* Run the script.
*/
|
| ︙ | |||
2993 2994 2995 2996 2997 2998 2999 | 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 | - - - + + |
if (result == TCL_CONTINUE) {
result = TCL_OK;
} else if (result != TCL_OK) {
if (result == TCL_BREAK) {
Tcl_ResetResult(interp);
result = TCL_OK;
} else if (result == TCL_ERROR) {
|
| ︙ | |||
3043 3044 3045 3046 3047 3048 3049 | 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 | - + |
}
TclDecrRefCount(valueObj);
/*
* Run the script.
*/
|
| ︙ | |||
3333 3334 3335 3336 3337 3338 3339 | 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 | - - - + + |
* copying from the "dict for" implementation has occurred!
*/
if (TclListObjGetElements(interp, objv[3], &varc, &varv) != TCL_OK) {
return TCL_ERROR;
}
if (varc != 2) {
|
| ︙ | |||
3422 3423 3424 3425 3426 3427 3428 | 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 | - + - + | Tcl_ResetResult(interp); Tcl_DictObjDone(&search); /* FALLTHRU */ case TCL_CONTINUE: result = TCL_OK; break; case TCL_ERROR: |
| ︙ | |||
3534 3535 3536 3537 3538 3539 3540 | 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 | - + |
* Execute the body after setting up the NRE handler to process the
* results.
*/
objPtr = Tcl_NewListObj(objc-3, objv+2);
Tcl_IncrRefCount(objPtr);
Tcl_IncrRefCount(objv[1]);
|
| ︙ | |||
3684 3685 3686 3687 3688 3689 3690 | 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 | - + - |
pathPtr = NULL;
if (objc > 3) {
pathPtr = Tcl_NewListObj(objc-3, objv+2);
Tcl_IncrRefCount(pathPtr);
}
Tcl_IncrRefCount(objv[1]);
|
| ︙ |
Changes to generic/tclDisassemble.c.
| ︙ | |||
193 194 195 196 197 198 199 | 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | - + + - + + + + + |
void
TclPrintObject(
FILE *outFile, /* The file to print the source to. */
Tcl_Obj *objPtr, /* Points to the Tcl object whose string
* representation should be printed. */
Tcl_Size maxChars) /* Maximum number of chars to print. */
{
|
| ︙ | |||
278 279 280 281 282 283 284 | 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | - + |
/*
* Print header lines describing the ByteCode.
*/
Tcl_AppendPrintfToObj(bufferObj,
"ByteCode %p, refCt %" TCL_SIZE_MODIFIER "d, epoch %" TCL_SIZE_MODIFIER "d, interp %p (epoch %" TCL_SIZE_MODIFIER "d)\n",
codePtr, codePtr->refCount, codePtr->compileEpoch, iPtr, iPtr->compileEpoch);
|
| ︙ | |||
337 338 339 340 341 342 343 | 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | - + |
(localPtr->flags & (VAR_ARRAY|VAR_LINK)) ? "" : ", scalar",
(localPtr->flags & VAR_ARRAY) ? ", array" : "",
(localPtr->flags & VAR_LINK) ? ", link" : "",
(localPtr->flags & VAR_ARGUMENT) ? ", arg" : "",
(localPtr->flags & VAR_TEMPORARY) ? ", temp" : "",
(localPtr->flags & VAR_RESOLVED) ? ", resolved" : "");
if (TclIsVarTemporary(localPtr)) {
|
| ︙ | |||
387 388 389 390 391 392 393 | 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | - + |
* If there were no commands (e.g., an expression or an empty string was
* compiled), just print all instructions and return.
*/
if (numCmds == 0) {
pc = codeStart;
while (pc < codeLimit) {
|
| ︙ | |||
449 450 451 452 453 454 455 | 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | - + |
Tcl_AppendPrintfToObj(bufferObj, "%s%4" TCL_SIZE_MODIFIER "d: pc %d-%d, src %d-%d",
((i % 2)? " " : "\n "),
(i+1), codeOffset, (codeOffset + codeLen - 1),
srcOffset, (srcOffset + srcLen - 1));
}
if (numCmds > 0) {
|
| ︙ | |||
498 499 500 501 502 503 504 | 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 | - + - + - + |
}
/*
* Print instructions before command i.
*/
while ((pc-codeStart) < codeOffset) {
|
| ︙ | |||
652 653 654 655 656 657 658 | 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 | - + - + - + - + |
break;
}
}
if (suffixObj) {
const char *bytes;
Tcl_Size length;
|
| ︙ | |||
864 865 866 867 868 869 870 | 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 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 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 | - + - + - + - + - + - + - + - + - + - + |
const char *stringPtr, /* The string to print. */
Tcl_Size maxChars) /* Maximum number of chars to print. */
{
const char *p;
Tcl_Size i = 0, len;
if (stringPtr == NULL) {
|
| ︙ | |||
970 971 972 973 974 975 976 | 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 | - + - + - + - + - + - + |
for (i=0 ; i<localCount ; i++,localPtr=localPtr->nextPtr) {
Tcl_Obj *descriptor[2];
TclNewObj(descriptor[0]);
if (!(localPtr->flags & (VAR_ARRAY|VAR_LINK))) {
Tcl_ListObjAppendElement(NULL, descriptor[0],
|
| ︙ | |||
1079 1080 1081 1082 1083 1084 1085 | 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 | - + - |
case OPERAND_IDX4:
val = TclGetInt4AtPtr(opnd);
opnd += 4;
if (val >= -1) {
Tcl_ListObjAppendElement(NULL, inst, Tcl_ObjPrintf(
".%d", val));
} else if (val == -2) {
|
| ︙ | |||
1330 1331 1332 1333 1334 1335 1336 | 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 | - - - - + + + + |
if (objc != 3) {
Tcl_WrongNumArgs(interp, 2, objv, "procName");
return TCL_ERROR;
}
procPtr = TclFindProc((Interp *) interp, TclGetString(objv[2]));
if (procPtr == NULL) {
|
| ︙ | |||
1380 1381 1382 1383 1384 1385 1386 | 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 | - - - - + + + + - - + + - - - + + - - - - + + + + |
*/
oPtr = (Object *) Tcl_GetObjectFromObj(interp, objv[2]);
if (oPtr == NULL) {
return TCL_ERROR;
}
if (oPtr->classPtr == NULL) {
|
| ︙ | |||
1445 1446 1447 1448 1449 1450 1451 | 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 | - - - - + + + + - - + + - - - + + - - - - + + + + |
*/
oPtr = (Object *) Tcl_GetObjectFromObj(interp, objv[2]);
if (oPtr == NULL) {
return TCL_ERROR;
}
if (oPtr->classPtr == NULL) {
|
| ︙ | |||
1510 1511 1512 1513 1514 1515 1516 | 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 | - - - - + + + + |
*/
oPtr = (Object *) Tcl_GetObjectFromObj(interp, objv[2]);
if (oPtr == NULL) {
return TCL_ERROR;
}
if (oPtr->classPtr == NULL) {
|
| ︙ | |||
1545 1546 1547 1548 1549 1550 1551 | 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 | - - - - + + + + - - - - + + + + |
/*
* Compile (if necessary) and disassemble a method body.
*/
methodBody:
if (hPtr == NULL) {
unknownMethod:
|
| ︙ | |||
1590 1591 1592 1593 1594 1595 1596 | 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 | - - - + + - |
/*
* Do the actual disassembly.
*/
ByteCodeGetInternalRep(codeObjPtr, &tclByteCodeType, codePtr);
if (codePtr->flags & TCL_BYTECODE_PRECOMPILED) {
|
| ︙ |
Changes to generic/tclEncoding.c.
| ︙ | |||
1241 1242 1243 1244 1245 1246 1247 | 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 | - + - - - + + + - |
? TCL_INDEX_NONE : nBytesProcessed;
} else {
/* Caller wants error message on failure */
if (result != TCL_OK && interp != NULL) {
char buf[TCL_INTEGER_SPACE];
snprintf(buf, sizeof(buf), "%" TCL_SIZE_MODIFIER "d",
nBytesProcessed);
|
| ︙ | |||
1564 1565 1566 1567 1568 1569 1570 | 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 | - + - - + + + - | Tcl_Size pos = Tcl_NumUtfChars(srcStart, nBytesProcessed); int ucs4; char buf[TCL_INTEGER_SPACE]; TclUtfToUniChar(&srcStart[nBytesProcessed], &ucs4); snprintf(buf, sizeof(buf), "%" TCL_SIZE_MODIFIER "d", nBytesProcessed); |
| ︙ | |||
1821 1822 1823 1824 1825 1826 1827 | 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 | - - - + + |
map = Tcl_DuplicateObj(TclGetProcessGlobalValue(&encodingFileMap));
TclDictPut(NULL, map, name, dir[i]);
TclSetProcessGlobalValue(&encodingFileMap, map);
}
}
if ((NULL == chan) && (interp != NULL)) {
|
| ︙ | |||
1895 1896 1897 1898 1899 1900 1901 | 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 | - - - + + |
encoding = LoadTableEncoding(name, ENCODING_MULTIBYTE, chan);
break;
case 'E':
encoding = LoadEscapeEncoding(name, chan);
break;
}
if ((encoding == NULL) && (interp != NULL)) {
|
| ︙ | |||
4530 4531 4532 4533 4534 4535 4536 | 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 | - - + - - + + - - + |
}
}
if (interp) {
/* This code assumes at least two profiles :-) */
Tcl_Obj *errorObj = Tcl_ObjPrintf("bad profile name \"%s\": must be",
profileName);
for (i = 0; i < (numProfiles - 1); ++i) {
|
| ︙ | |||
4571 4572 4573 4574 4575 4576 4577 | 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 | - - + + - - + |
for (i = 0; i < sizeof(encodingProfiles) / sizeof(encodingProfiles[0]); ++i) {
if (profileValue == encodingProfiles[i].value) {
return encodingProfiles[i].name;
}
}
if (interp) {
|
| ︙ |
Changes to generic/tclEnsemble.c.
| ︙ | |||
156 157 158 159 160 161 162 | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | - - + + - - + |
{
Namespace *nsPtr = (Namespace *) TclGetCurrentNamespace(interp);
Tcl_Command token; /* The ensemble command. */
enum EnsSubcmds index;
if (nsPtr == NULL || nsPtr->flags & NS_DEAD) {
if (!Tcl_InterpDeleted(interp)) {
|
| ︙ | |||
330 331 332 333 334 335 336 | 329 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 | - + - - + + - - + |
const char *cmd;
if (TclListObjGetElements(interp, listObj, &len,
&listv) != TCL_OK) {
goto mapError;
}
if (len < 1) {
|
| ︙ | |||
648 649 650 651 652 653 654 | 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 | - + - - + + - - + |
}
do {
if (TclListObjLength(interp, listObj, &len) != TCL_OK) {
goto finishSearchAndError;
}
if (len < 1) {
|
| ︙ | |||
694 695 696 697 698 699 700 | 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 | - - - + + - |
Tcl_DictObjDone(&search);
if (patchedDict) {
Tcl_DecrRefCount(patchedDict);
}
goto freeMapAndError;
}
case CONF_NAMESPACE:
|
| ︙ | |||
866 867 868 869 870 871 872 | 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 | - - + - - + |
Tcl_Interp *interp, /* Where to report an error. May be NULL. */
Tcl_Command token) /* What to check for ensemble-ness. */
{
Command *cmdPtr = (Command *) token;
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
if (interp != NULL) {
|
| ︙ | |||
1081 1082 1083 1084 1085 1086 1087 | 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 | - - + + - - + - |
if (Tcl_ListObjIndex(interp, valuePtr, 0, &cmdObjPtr) != TCL_OK) {
Tcl_DictObjDone(&search);
return TCL_ERROR;
}
bytes = TclGetString(cmdObjPtr);
if (bytes[0] != ':' || bytes[1] != ':') {
|
| ︙ | |||
1487 1488 1489 1490 1491 1492 1493 | 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 | - + - - - + + + |
*/
token = TclGetOriginalCommand(token);
if (token == NULL ||
((Command *) token)->objProc != TclEnsembleImplementationCmd) {
if (flags & TCL_LEAVE_ERR_MSG) {
|
| ︙ | |||
1788 1789 1790 1791 1792 1793 1794 | 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 | - - + - - + |
if (ensemblePtr->nsPtr->flags & NS_DEAD) {
/*
* Don't know how we got here, but make things give up quickly.
*/
if (!Tcl_InterpDeleted(interp)) {
|
| ︙ | |||
1949 1950 1951 1952 1953 1954 1955 | 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 | - + - + - | Tcl_ListObjReplace(NULL, copyPtr, LIST_MAX, 0, ensemblePtr->numParameters, objv + 1); Tcl_ListObjReplace(NULL, copyPtr, LIST_MAX, 0, objc - 2 - ensemblePtr->numParameters, objv + 2 + ensemblePtr->numParameters); } Tcl_IncrRefCount(copyPtr); |
| ︙ | |||
2001 2002 2003 2004 2005 2006 2007 | 1989 1990 1991 1992 1993 1994 1995 1996 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 | - + - - + - + - + |
* Could not find a routine for the named subcommand so generate a standard
* failure message. The one odd case compared with a standard
* ensemble-like command is where a namespace has no exported commands at
* all...
*/
Tcl_ResetResult(interp);
|
| ︙ | |||
2239 2240 2241 2242 2243 2244 2245 | 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 | - + - + | */ tmp[0] = NULL; tmp[1] = (Tcl_Obj *) iPtr->ensembleRewrite.sourceObjs; tmp[2] = (Tcl_Obj *) store; iPtr->ensembleRewrite.sourceObjs = (Tcl_Obj *const *) tmp; |
| ︙ | |||
2373 2374 2375 2376 2377 2378 2379 | 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 | - - + + - - + - |
*/
Tcl_Preserve(ensemblePtr);
TclSkipTailcall(interp);
result = Tcl_EvalObjv(interp, paramc, paramv, 0);
if ((result == TCL_OK) && (ensemblePtr->flags & ENSEMBLE_DEAD)) {
if (!Tcl_InterpDeleted(interp)) {
|
| ︙ | |||
2422 2423 2424 2425 2426 2427 2428 | 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 2434 2435 2436 2437 2438 2439 | - - + + - - + - - + - - + - - + - |
/*
* Convert exceptional result to an error.
*/
if (!Tcl_InterpDeleted(interp)) {
if (result != TCL_ERROR) {
Tcl_ResetResult(interp);
|
| ︙ | |||
2777 2778 2779 2780 2781 2782 2783 | 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 | - + - + |
* content!
*/
if (isNew) {
Tcl_Obj *cmdObj, *cmdPrefixObj;
TclNewObj(cmdObj);
|
| ︙ |
Changes to generic/tclEvent.c.
| ︙ | |||
340 341 342 343 344 345 346 | 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 | - - - + + - - - + + |
/*
* Check for a valid return options dictionary.
*/
result = TclDictGet(NULL, objv[2], "-level", &valuePtr);
if (result != TCL_OK || valuePtr == NULL) {
|
| ︙ | |||
1560 1561 1562 1563 1564 1565 1566 | 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 1584 1585 | - - - + + + - - - + + |
case OPT_NO_WEVTS:
mask &= ~TCL_WINDOW_EVENTS;
break;
case OPT_TIMEOUT:
if (++i >= objc) {
needArg:
Tcl_ResetResult(interp);
|
| ︙ | |||
1608 1609 1610 1611 1612 1613 1614 | 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 | - + - + |
}
if (TclGetChannelFromObj(interp, objv[i], &chan, &mode, 0)
!= TCL_OK) {
result = TCL_ERROR;
goto done;
}
if (!(mode & TCL_READABLE)) {
|
| ︙ | |||
1632 1633 1634 1635 1636 1637 1638 | 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 | - + - + - - - + + - - - + + |
}
if (TclGetChannelFromObj(interp, objv[i], &chan, &mode, 0)
!= TCL_OK) {
result = TCL_ERROR;
goto done;
}
if (!(mode & TCL_WRITABLE)) {
|
| ︙ | |||
1688 1689 1690 1691 1692 1693 1694 | 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 | - - - + + + |
result = TCL_ERROR;
goto done;
}
if (!(mask & TCL_FILE_EVENTS)) {
for (i = 0; i < numItems; i++) {
if (vwaitItems[i].mask) {
|
| ︙ | |||
1728 1729 1730 1731 1732 1733 1734 | 1723 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 1749 1750 1751 1752 1753 1754 1755 1756 | - - + + - - - + + - - + |
((!any && (done < numItems)) || (any && !done))) {
foundEvent = Tcl_DoOneEvent(mask);
if (Tcl_Canceled(interp, TCL_LEAVE_ERR_MSG) == TCL_ERROR) {
break;
}
if (Tcl_LimitExceeded(interp)) {
Tcl_ResetResult(interp);
|
| ︙ | |||
1976 1977 1978 1979 1980 1981 1982 | 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 | - + |
while (Tcl_DoOneEvent(flags) != 0) {
if (Tcl_Canceled(interp, TCL_LEAVE_ERR_MSG) == TCL_ERROR) {
return TCL_ERROR;
}
if (Tcl_LimitExceeded(interp)) {
Tcl_ResetResult(interp);
|
| ︙ |
Changes to generic/tclExecute.c.
| ︙ | |||
116 117 118 119 120 121 122 | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | - - - + + + - |
CmdFrame cmdFrame; /* codePtr was received for NR execution. */
Tcl_Obj *stack[1]; /* Start of the actual combined catch and obj
* stacks; the struct will be expanded as
* necessary */
} TEBCdata;
#define TEBC_YIELD() \
|
| ︙ | |||
366 367 368 369 370 371 372 | 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 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | - - - + + + + - + - - - + + + + + - - - - + + + + - - + + - - - - - - - - + + - + - + + + | #define OBJ_AT_DEPTH(n) tosPtr[-(n)] #define CURR_DEPTH (tosPtr - initTosPtr) #define STACK_BASE(esPtr) ((esPtr)->stackWords - 1) /* |
| ︙ | |||
438 439 440 441 442 443 444 445 446 447 448 449 450 451 | 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 | + + + + |
} while (0)
#define TCL_DTRACE_INST_LAST() \
do { \
if (TCL_DTRACE_INST_DONE_ENABLED() && curInstName) { \
TCL_DTRACE_INST_DONE(curInstName, (int) CURR_DEPTH, tosPtr);\
} \
} while (0)
#else
#define TCL_DTRACE_INST_NEXT()
#define TCL_DTRACE_INST_LAST()
#endif
/*
* Macro used in this file to save a function call for common uses of
* Tcl_GetNumberFromObj(). The ANSI C "prototype" is:
*
* MODULE_SCOPE int GetNumberFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr,
* void **ptrPtr, int *tPtr);
|
| ︙ | |||
1297 1298 1299 1300 1301 1302 1303 | 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 | - + - |
Tcl_Obj **resultPtrPtr) /* Where the Tcl_Obj* that is the expression
* result is stored if no errors occur. */
{
NRE_callback *rootPtr = TOP_CB(interp);
Tcl_Obj *resultPtr;
TclNewObj(resultPtr);
|
| ︙ | |||
1356 1357 1358 1359 1360 1361 1362 | 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 | - + - |
{
ByteCode *codePtr;
Tcl_InterpState state = Tcl_SaveInterpState(interp, TCL_OK);
Tcl_ResetResult(interp);
codePtr = CompileExprObj(interp, objPtr);
|
| ︙ | |||
1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 | 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 | + + |
/* Counter that is used to work out when to
* call Tcl_AsyncReady(). This must be 1
* initially so that we call the async-check
* stanza early, otherwise there are command
* sequences that can make the interpreter
* busy-loop without an opportunity to
* recognise an interrupt. */
#ifdef USE_DTRACE
const char *curInstName;
#endif
#ifdef TCL_COMPILE_DEBUG
int traceInstructions; /* Whether we are doing instruction-level
* tracing or not. */
#endif
Var *compiledLocals = iPtr->varFramePtr->compiledLocals;
Tcl_Obj **constants = &iPtr->execEnvPtr->constants[0];
|
| ︙ | |||
2116 2117 2118 2119 2120 2121 2122 | 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 | - - + + + | } /* * Push the call's object result and continue execution with the next * instruction. */ |
| ︙ | |||
2272 2273 2274 2275 2276 2277 2278 2279 | 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 | + - + |
#endif /* TCL_COMPILE_DEBUG */
TCL_DTRACE_INST_NEXT();
if (inst == INST_LOAD_SCALAR1) {
goto instLoadScalar1;
} else if (inst == INST_PUSH1) {
TRACE("%u => ", TclGetUInt1AtPtr(pc + 1));
PUSH_OBJECT(codePtr->objArrayPtr[TclGetUInt1AtPtr(pc+1)]);
|
| ︙ | |||
2312 2313 2314 2315 2316 2317 2318 | 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 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 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 | - + - - + + - + - + - - + + - + - + - + - - + - + - - + + - + - - + + - - + - + - - + - - - + - + - - + | int code = TclGetInt4AtPtr(pc+1); int level = TclGetUInt4AtPtr(pc+5); /* * OBJ_AT_TOS is returnOpts, OBJ_UNDER_TOS is resultObjPtr. */ |
| ︙ | |||
2461 2462 2463 2464 2465 2466 2467 | 2459 2460 2461 2462 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 | - + - - - + + + - + - + - + - + - + | ArgumentBCEnter(interp, codePtr, TD, pc, objc, objv); } pc++; cleanup = 1; TEBC_YIELD(); TclNRAddCallback(interp, TclNRCoroutineActivateCallback, corPtr, |
| ︙ | |||
2516 2517 2518 2519 2520 2521 2522 | 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 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 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 | - - + + - - + + + - + - + + + - + + - + - + - + - + - + - + |
result = TCL_RETURN;
cleanup = opnd;
goto processExceptionReturn;
}
case INST_DONE:
if (tosPtr > initTosPtr) {
|
| ︙ | |||
2635 2636 2637 2638 2639 2640 2641 | 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 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 2682 2683 2684 | - + - + - + | * error, also in INST_EXPAND_STKTOP). */ TclNewObj(objPtr); objPtr->internalRep.twoPtrValue.ptr2 = INT2PTR(CURR_DEPTH); objPtr->length = 0; PUSH_TAUX_OBJ(objPtr); |
| ︙ | |||
2715 2716 2717 2718 2719 2720 2721 | 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 | - + |
* that it has a freeIntRepProc we use Tcl_DecrRefCount().
*/
for (i = 0; i < objc; i++) {
PUSH_OBJECT(objv[i]);
}
|
| ︙ | |||
2788 2789 2790 2791 2792 2793 2794 | 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 | - + |
#ifdef TCL_COMPILE_DEBUG
if (tclTraceExec >= 2) {
Tcl_Size i;
if (traceInstructions) {
strncpy(cmdNameBuf, TclGetString(objv[0]), 20);
|
| ︙ | |||
2839 2840 2841 2842 2843 2844 2845 | 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 | - + + |
cleanup = objc;
#ifdef TCL_COMPILE_DEBUG
if (tclTraceExec >= 2) {
Tcl_Size i;
if (traceInstructions) {
strncpy(cmdNameBuf, TclGetString(objv[0]), 20);
|
| ︙ | |||
2884 2885 2886 2887 2888 2889 2890 | 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 | - + - + - + - + - + - + | } DECACHE_STACK_INFO(); pc += 6; TEBC_YIELD(); TclMarkTailcall(interp); |
| ︙ | |||
2959 2960 2961 2962 2963 2964 2965 | 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 | - + - + - + - + - + - + |
doLoadArray:
part1Ptr = NULL;
part2Ptr = OBJ_AT_TOS;
arrayPtr = LOCAL(opnd);
while (TclIsVarLink(arrayPtr)) {
arrayPtr = arrayPtr->value.linkPtr;
}
|
| ︙ | |||
3061 3062 3063 3064 3065 3066 3067 | 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 | - - + + |
opnd = TclGetUInt1AtPtr(pc+1);
pcAdjustment = 2;
doStoreArrayDirect:
valuePtr = OBJ_AT_TOS;
part2Ptr = OBJ_UNDER_TOS;
arrayPtr = LOCAL(opnd);
|
| ︙ | |||
3092 3093 3094 3095 3096 3097 3098 | 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 | - + |
case INST_STORE_SCALAR1:
opnd = TclGetUInt1AtPtr(pc+1);
pcAdjustment = 2;
doStoreScalarDirect:
valuePtr = OBJ_AT_TOS;
varPtr = LOCAL(opnd);
|
| ︙ | |||
3118 3119 3120 3121 3122 3123 3124 | 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 | - + - + |
TclDecrRefCount(valuePtr);
}
objResultPtr = OBJ_AT_TOS;
varPtr->value.objPtr = objResultPtr;
#ifndef TCL_COMPILE_DEBUG
if (pc[pcAdjustment] == INST_POP) {
tosPtr--;
|
| ︙ | |||
3169 3170 3171 3172 3173 3174 3175 | 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 | - + - - + + |
storeFlags = TCL_LEAVE_ERR_MSG;
doStoreStk:
objPtr = OBJ_AT_DEPTH(1 + (part2Ptr != NULL)); /* variable name */
part1Ptr = objPtr;
#ifdef TCL_COMPILE_DEBUG
if (part2Ptr == NULL) {
|
| ︙ | |||
3216 3217 3218 3219 3220 3221 3222 | 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 | - - + + |
storeFlags = (TCL_LEAVE_ERR_MSG | TCL_APPEND_VALUE);
goto doStoreArray;
doStoreArray:
valuePtr = OBJ_AT_TOS;
part2Ptr = OBJ_UNDER_TOS;
arrayPtr = LOCAL(opnd);
|
| ︙ | |||
3262 3263 3264 3265 3266 3267 3268 | 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 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 | - + - + - + - + |
pcAdjustment = 2;
storeFlags = (TCL_LEAVE_ERR_MSG | TCL_APPEND_VALUE);
goto doStoreScalar;
doStoreScalar:
valuePtr = OBJ_AT_TOS;
varPtr = LOCAL(opnd);
|
| ︙ | |||
3321 3322 3323 3324 3325 3326 3327 | 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 | - - + + |
part2Ptr = OBJ_UNDER_TOS;
arrayPtr = LOCAL(opnd);
cleanup = 2;
pcAdjustment = 5;
while (TclIsVarLink(arrayPtr)) {
arrayPtr = arrayPtr->value.linkPtr;
}
|
| ︙ | |||
3350 3351 3352 3353 3354 3355 3356 | 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 | - - + + - + - + |
case INST_LAPPEND_LIST_ARRAY_STK:
pcAdjustment = 1;
cleanup = 3;
valuePtr = OBJ_AT_TOS;
part2Ptr = OBJ_UNDER_TOS; /* element name */
part1Ptr = OBJ_AT_DEPTH(2); /* array name */
|
| ︙ | |||
3452 3453 3454 3455 3456 3457 3458 | 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 | - + |
CACHE_STACK_INFO();
if (!objResultPtr) {
errorInLappendListPtr:
TRACE_ERROR(interp);
goto gotError;
}
}
|
| ︙ | |||
3505 3506 3507 3508 3509 3510 3511 | 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 | - - + + - + |
pcAdjustment = 2;
doIncrStk:
if ((*pc == INST_INCR_ARRAY_STK_IMM)
|| (*pc == INST_INCR_ARRAY_STK)) {
part2Ptr = OBJ_AT_TOS;
objPtr = OBJ_UNDER_TOS;
|
| ︙ | |||
3543 3544 3545 3546 3547 3548 3549 | 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 | - + |
part1Ptr = NULL;
part2Ptr = OBJ_AT_TOS;
arrayPtr = LOCAL(opnd);
cleanup = 1;
while (TclIsVarLink(arrayPtr)) {
arrayPtr = arrayPtr->value.linkPtr;
}
|
| ︙ | |||
3580 3581 3582 3583 3584 3585 3586 | 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 | - + - + |
/*
* Overflow when (augend and sum have different sign) and
* (augend and increment have the same sign). This is
* encapsulated in the Overflowing macro.
*/
if (!Overflowing(augend, increment, sum)) {
|
| ︙ | |||
3646 3647 3648 3649 3650 3651 3652 | 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 | - + |
varPtr = LOCAL(opnd);
while (TclIsVarLink(varPtr)) {
varPtr = varPtr->value.linkPtr;
}
arrayPtr = NULL;
part1Ptr = part2Ptr = NULL;
cleanup = 0;
|
| ︙ | |||
3677 3678 3679 3680 3681 3682 3683 | 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 | - + - + - + |
Tcl_DecrRefCount(incrPtr);
if (objResultPtr == NULL) {
TRACE_ERROR(interp);
goto gotError;
}
}
doneIncr:
|
| ︙ | |||
3722 3723 3724 3725 3726 3727 3728 | 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 | - + |
pcAdjustment = 5;
opnd = TclGetUInt4AtPtr(pc+1);
part2Ptr = OBJ_AT_TOS;
arrayPtr = LOCAL(opnd);
while (TclIsVarLink(arrayPtr)) {
arrayPtr = arrayPtr->value.linkPtr;
}
|
| ︙ | |||
3750 3751 3752 3753 3754 3755 3756 | 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 | - + - + |
goto afterExistsPeephole;
case INST_EXIST_ARRAY_STK:
cleanup = 2;
pcAdjustment = 1;
part2Ptr = OBJ_AT_TOS; /* element name */
part1Ptr = OBJ_UNDER_TOS; /* array name */
|
| ︙ | |||
3783 3784 3785 3786 3787 3788 3789 | 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 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 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 | - + - + - + - - + + - + - + |
/*
* Peep-hole optimisation: if you're about to jump, do jump from here.
*/
afterExistsPeephole: {
int found = (varPtr && !TclIsVarUndefined(varPtr));
|
| ︙ | |||
3887 3888 3889 3890 3891 3892 3893 | 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 | - - + + - - + + - + |
NEXT_INST_F(6, 1, 0);
case INST_UNSET_ARRAY_STK:
flags = TclGetUInt1AtPtr(pc+1) ? TCL_LEAVE_ERR_MSG : 0;
cleanup = 2;
part2Ptr = OBJ_AT_TOS; /* element name */
part1Ptr = OBJ_UNDER_TOS; /* array name */
|
| ︙ | |||
3930 3931 3932 3933 3934 3935 3936 | 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 | - + - + - + |
case INST_CONST_IMM:
opnd = TclGetUInt4AtPtr(pc+1);
pcAdjustment = 5;
cleanup = 1;
part1Ptr = NULL;
objPtr = OBJ_AT_TOS;
|
| ︙ | |||
3977 3978 3979 3980 3981 3982 3983 | 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 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 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 | - + - + - + - + - + - + - + - + - + - + - - + + |
CACHE_STACK_INFO();
if (resPtr == NULL) {
TRACE_ERROR(interp);
goto gotError;
}
}
TclSetVarConstant(varPtr);
|
| ︙ | |||
4115 4116 4117 4118 4119 4120 4121 | 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 | - - + + |
if (!otherPtr) {
TRACE_ERROR(interp);
goto gotError;
}
goto doLinkVars;
case INST_NSUPVAR:
|
| ︙ | |||
4139 4140 4141 4142 4143 4144 4145 | 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 | - + |
if (!otherPtr) {
TRACE_ERROR(interp);
goto gotError;
}
goto doLinkVars;
case INST_VARIABLE:
|
| ︙ | |||
4174 4175 4176 4177 4178 4179 4180 | 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 | - + |
/*
* Then it is a defined link.
*/
Var *linkPtr = varPtr->value.linkPtr;
if (linkPtr == otherPtr) {
|
| ︙ | |||
4200 4201 4202 4203 4204 4205 4206 | 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 | - + - - + + - - + + | } /* * Do not pop the namespace or frame index, it may be needed for other * variables - and [variable] did not push it at all. */ |
| ︙ | |||
4249 4250 4251 4252 4253 4254 4255 | 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 | - - + + - - + + - + - + - - + + - + - - + + - + + - + - + + - + - - + + + - + - + - + - - + + - - + + - + + - + - + - - - + + + - - + + - + - + + - - - + + + - - + - + - - - + + + - - + - - - + + + |
case INST_JUMP_TRUE1:
jmpOffset[0] = 2;
jmpOffset[1] = TclGetInt1AtPtr(pc+1);
doCondJump:
valuePtr = OBJ_AT_TOS;
|
| ︙ | |||
4513 4514 4515 4516 4517 4518 4519 | 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 | - - + + - + - + - + - + - + - - - + + + - |
methodType = "constructor";
} else if (contextPtr->callPtr->flags & DESTRUCTOR) {
methodType = "destructor";
} else {
methodType = "method";
}
|
| ︙ | |||
4576 4577 4578 4579 4580 4581 4582 | 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 | - + - - + |
methodType = "constructor";
} else if (contextPtr->callPtr->flags & DESTRUCTOR) {
methodType = "destructor";
} else {
methodType = "method";
}
|
| ︙ | |||
4650 4651 4652 4653 4654 4655 4656 4657 4658 | 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 | + - + + - + - + + - + - - + |
(Tcl_ObjectContext) contextPtr, opnd, objv);
}
return ((Tcl_MethodCallProc2 *)(void *)(mPtr->typePtr->callProc))(mPtr->clientData, interp,
(Tcl_ObjectContext) contextPtr, opnd, objv);
}
case INST_TCLOO_IS_OBJECT:
TRACE("%.30s => ", O2S(OBJ_AT_TOS));
oPtr = (Object *) Tcl_GetObjectFromObj(interp, OBJ_AT_TOS);
objResultPtr = TCONST(oPtr != NULL ? 1 : 0);
|
| ︙ | |||
4693 4694 4695 4696 4697 4698 4699 4700 | 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 | + - + - + - + - + |
case INST_LIST:
/*
* Pop the opnd (objc) top stack elements into a new list obj and then
* decrement their ref counts.
*/
opnd = TclGetUInt4AtPtr(pc+1);
TRACE("%u => ", opnd);
objResultPtr = Tcl_NewListObj(opnd, &OBJ_AT_DEPTH(opnd-1));
|
| ︙ | |||
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 | - + - + | goto gotError; } /* * Stash the list element on the stack. */ |
| ︙ | |||
4847 4848 4849 4850 4851 4852 4853 | 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 | - + - + - + - + |
objResultPtr = objv[index];
} else {
TclNewObj(objResultPtr);
}
lindexFastPath2:
|
| ︙ | |||
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 4989 4990 4991 | - + - - + + - + - - + + | goto gotError; } /* * Set result. */ CACHE_STACK_INFO(); |
| ︙ | |||
4997 4998 4999 5000 5001 5002 5003 | 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 | - + - + |
}
#endif
/* Every range of an empty list is an empty list */
if (objc == 0) {
/* avoid return of not canonical list (e. g. spaces in string repr.) */
if (!valuePtr->bytes || !valuePtr->length) {
|
| ︙ | |||
5045 5046 5047 5048 5049 5050 5051 | 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 | - + - + |
if (objResultPtr == NULL) {
CACHE_STACK_INFO();
TRACE_ERROR(interp);
goto gotError;
}
CACHE_STACK_INFO();
|
| ︙ | |||
5112 5113 5114 5115 5116 5117 5118 | 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 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 | - + - + - + - + |
}
}
if (*pc == INST_LIST_NOT_IN) {
match = !match;
}
|
| ︙ | |||
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 | - + - + |
objResultPtr = Tcl_DuplicateObj(valuePtr);
if (Tcl_ListObjReplace(interp, objResultPtr, fromIdx, numToDelete,
numNewElems, &OBJ_AT_DEPTH(numNewElems - 1)) != TCL_OK) {
TRACE_ERROR(interp);
Tcl_DecrRefCount(objResultPtr);
goto gotError;
}
|
| ︙ | |||
5284 5285 5286 5287 5288 5289 5290 | 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 | - - + + - + - + - + - + - + - + - + - + - + - + - + | case INST_GE: case INST_STR_GE: match = (match >= 0); break; } } |
| ︙ | |||
5390 5391 5392 5393 5394 5395 5396 | 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 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 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 | - + - - + + - + - + - + - + - - + + - + - + - + - + + + |
TclNewObj(objResultPtr);
} else {
slength = Tcl_UniCharToUtf(ch, buf);
objResultPtr = Tcl_NewStringObj(buf, slength);
}
}
|
| ︙ | |||
5562 5563 5564 5565 5566 5567 5568 | 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 | - - + - - + + - - + + - + - - + |
/*
* Put the rest of the unmapped chars onto result.
*/
Tcl_AppendUnicodeToObj(objResultPtr, p, ustring1 - p);
}
doneStringMap:
|
| ︙ | |||
5637 5638 5639 5640 5641 5642 5643 | 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 | - + | } /* * Reuse value2Ptr object already on stack if possible. Adjustment is * 2 due to the nocase byte */ |
| ︙ | |||
5679 5680 5681 5682 5683 5684 5685 | 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 | - + |
/*
* Careful here; trim set often contains non-ASCII characters so we
* take care when printing. [Bug 971cb4f1db]
*/
#ifdef TCL_COMPILE_DEBUG
if (traceInstructions) {
|
| ︙ | |||
5708 5709 5710 5711 5712 5713 5714 | 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 | - + - + |
}
}
case INST_REGEXP:
cflags = TclGetInt1AtPtr(pc+1); /* RE compile flages like NOCASE */
valuePtr = OBJ_AT_TOS; /* String */
value2Ptr = OBJ_UNDER_TOS; /* Pattern */
|
| ︙ | |||
5755 5756 5757 5758 5759 5760 5761 | 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 | - + |
Tcl_WideInt w1, w2, wResult;
case INST_NUM_TYPE:
if (GetNumberFromObj(NULL, OBJ_AT_TOS, &ptr1, &type1) != TCL_OK) {
type1 = 0;
}
TclNewIntObj(objResultPtr, type1);
|
| ︙ | |||
5836 5837 5838 5839 5840 5841 5842 | 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 | - - + + - + - + - + - + - - + + - + - + - + - + |
}
/*
* Peep-hole optimisation: if you're about to jump, do jump from here.
*/
foundResult:
|
| ︙ | |||
5925 5926 5927 5928 5929 5930 5931 | 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 | - - + - - + + - - + - + - + - + - - + - - + + - - + - + - - + + - - + + |
(Tcl_WideUInt)w2*(Tcl_WideUInt)wResult);
goto wideResultOfArithmetic;
}
break;
case INST_RSHIFT:
if (w2 < 0) {
|
| ︙ | |||
6025 6026 6027 6028 6029 6030 6031 | 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 | - + - + - + - + - + - + - + - + - + | } } /* * Too large; need to use the broken-out function. */ |
| ︙ | |||
6151 6152 6153 6154 6155 6156 6157 | 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 | - + - + - + - - + + |
* wResult have the same sign and there is no overflow anyway.
*/
if (Overflowing(w1, ~w2, wResult)) {
goto overflow;
}
wideResultOfArithmetic:
|
| ︙ | |||
6206 6207 6208 6209 6210 6211 6212 | 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 6398 6399 6400 6401 6402 6403 6404 6405 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 6427 6428 6429 6430 6431 6432 6433 6434 6435 6436 6437 6438 6439 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 6470 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 | - + - + - + - + - + - + + - - + + - + - + - - + + - + - + - + - + - + - - + + - + - + - + - + - + - + - - + + - + - - + + - + - + - + - + + - + - + - + - + - + - - + + |
/*
* Fall through with INST_EXPON, INST_DIV and large multiplies.
*/
}
overflow:
|
| ︙ | |||
6522 6523 6524 6525 6526 6527 6528 | 6527 6528 6529 6530 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 6549 6550 6551 6552 6553 6554 6555 6556 6557 6558 6559 | - + - + | * Store a pointer to the ForeachInfo struct; same dirty trick * as above */ TclNewObj(tmpPtr); tmpPtr->internalRep.twoPtrValue.ptr1 = infoPtr; PUSH_OBJECT(tmpPtr); /* infoPtr object */ |
| ︙ | |||
6625 6626 6627 6628 6629 6630 6631 | 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 6640 6641 6642 6643 6644 6645 6646 6647 6648 6649 6650 6651 6652 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 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 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 | - - + + - + - + - + - + + - + - + - + + - + - + + - + - + - + - + + - + - + - + - + - - + + - + - + - + - + - - - + + + - - - + + - + - + - - + + - + - + - - - + + + - - - + + - + - + |
Tcl_IncrRefCount(valuePtr);
}
} else {
DECACHE_STACK_INFO();
if (TclPtrSetVarIdx(interp, varPtr, NULL, NULL, NULL,
valuePtr, TCL_LEAVE_ERR_MSG, varIndex)==NULL){
CACHE_STACK_INFO();
|
| ︙ | |||
6942 6943 6944 6945 6946 6947 6948 | 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 | - - + + |
Tcl_Panic("Should not happen!");
}
if (result != TCL_OK) {
if (allocateDict) {
TclDecrRefCount(dictPtr);
}
|
| ︙ | |||
6974 6975 6976 6977 6978 6979 6980 | 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 | - + - + |
}
}
#ifndef TCL_COMPILE_DEBUG
if (pc[9] == INST_POP) {
NEXT_INST_V(10, cleanup, 0);
}
#endif
|
| ︙ | |||
7113 7114 7115 7116 7117 7118 7119 | 7120 7121 7122 7123 7124 7125 7126 7127 7128 7129 7130 7131 7132 7133 7134 7135 7136 7137 7138 7139 | - + - + |
}
}
#ifndef TCL_COMPILE_DEBUG
if (pc[5] == INST_POP) {
NEXT_INST_F(6, 2, 0);
}
#endif
|
| ︙ | |||
7154 7155 7156 7157 7158 7159 7160 | 7161 7162 7163 7164 7165 7166 7167 7168 7169 7170 7171 7172 7173 7174 7175 | - + |
}
varPtr->value.objPtr = statePtr;
Tcl_IncrRefCount(statePtr);
goto pushDictIteratorResult;
case INST_DICT_NEXT:
opnd = TclGetUInt4AtPtr(pc+1);
|
| ︙ | |||
7176 7177 7178 7179 7180 7181 7182 | 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 7198 7199 7200 7201 7202 7203 7204 7205 7206 7207 7208 7209 7210 7211 7212 | - - + + - + |
TclNewObj(emptyPtr);
PUSH_OBJECT(emptyPtr);
PUSH_OBJECT(emptyPtr);
} else {
PUSH_OBJECT(valuePtr);
PUSH_OBJECT(keyPtr);
}
|
| ︙ | |||
7245 7246 7247 7248 7249 7250 7251 | 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 7275 7276 7277 7278 7279 7280 7281 7282 7283 7284 7285 7286 7287 | - + - + - + | TRACE_ERROR(interp); Tcl_DecrRefCount(dictPtr); goto gotError; } CACHE_STACK_INFO(); } TclDecrRefCount(dictPtr); |
| ︙ | |||
7322 7323 7324 7325 7326 7327 7328 | 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 | - + - + - + - - + + |
if (allocdict) {
TclDecrRefCount(dictPtr);
}
TRACE_ERROR(interp);
goto gotError;
}
}
|
| ︙ | |||
7368 7369 7370 7371 7372 7373 7374 | 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 | - + - - + + - + + + + + + - + + + |
objc, objv, keysPtr);
CACHE_STACK_INFO();
TclDecrRefCount(keysPtr);
if (result != TCL_OK) {
TRACE_ERROR(interp);
goto gotError;
}
|
| ︙ | |||
7431 7432 7433 7434 7435 7436 7437 | 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 | - + |
wval = (Tcl_WideInt)now.sec;
break;
default:
Tcl_Panic("clockRead instruction with unknown clock#");
break;
}
TclNewIntObj(objResultPtr, wval);
|
| ︙ | |||
7463 7464 7465 7466 7467 7468 7469 | 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 | - + - + - + - + - - + + - + - + - + - - + + - + - + - - + + - - + + - + - + - + - + - - + - - + + |
*/
processExceptionReturn:
#ifdef TCL_COMPILE_DEBUG
switch (*pc) {
case INST_INVOKE_STK1:
opnd = TclGetUInt1AtPtr(pc+1);
|
| ︙ | |||
8118 8119 8120 8121 8122 8123 8124 | 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 | - - + |
mp_clear(&big2);
break;
default:
/* Unused, here to silence compiler warning */
invalid = 0;
}
if (invalid) {
|
| ︙ | |||
8149 8150 8151 8152 8153 8154 8155 | 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 | - - + | /* * Technically, we could hold the value (1 << (INT_MAX+1)) in * an mp_int, but since we're using mp_mul_2d() to do the * work, and it takes only an int argument, that's a good * place to draw the line. */ |
| ︙ | |||
8396 8397 8398 8399 8400 8401 8402 | 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 | - - + |
* 268435455, which fits into a signed 32 bit int which is within the
* range of the Tcl_WideInt type. This means any numeric Tcl_Obj value
* not using TCL_NUMBER_INT type must hold a value larger than we
* accept.
*/
if (type2 != TCL_NUMBER_INT) {
|
| ︙ | |||
8472 8473 8474 8475 8476 8477 8478 | 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 | - - - + |
wResult = oddExponent ? -Exp64Value[base] : Exp64Value[base];
WIDE_RESULT(wResult);
}
}
overflowExpon:
|
| ︙ | |||
9109 9110 9111 9112 9113 9114 9115 | 9117 9118 9119 9120 9121 9122 9123 9124 9125 9126 9127 9128 9129 9130 9131 9132 9133 | - - - + + + |
if (GetNumberFromObj(NULL, opndPtr, &ptr, &type) != TCL_OK) {
Tcl_Size length;
if (TclHasInternalRep(opndPtr, &tclDictType)) {
Tcl_DictObjSize(NULL, opndPtr, &length);
if (length > 0) {
listRep:
|
| ︙ | |||
9133 9134 9135 9136 9137 9138 9139 | 9141 9142 9143 9144 9145 9146 9147 9148 9149 9150 9151 9152 9153 9154 9155 9156 9157 9158 | - + - - + + |
} else if (type == TCL_NUMBER_DOUBLE) {
description = "floating-point value";
} else {
/* TODO: No caller needs this. Eliminate? */
description = "(big) integer";
}
|
| ︙ | |||
9461 9462 9463 9464 9465 9466 9467 | 9469 9470 9471 9472 9473 9474 9475 9476 9477 9478 9479 9480 9481 9482 9483 | - + | } /* *---------------------------------------------------------------------- * * GetOpcodeName -- * |
| ︙ | |||
9514 9515 9516 9517 9518 9519 9520 | 9522 9523 9524 9525 9526 9527 9528 9529 9530 9531 9532 9533 9534 9535 9536 9537 9538 9539 9540 9541 9542 9543 9544 9545 9546 9547 9548 9549 9550 9551 | - + - + - + - + - |
* distinguish underflows from overflows. */
{
const char *s;
if ((errno == EDOM) || isnan(value)) {
s = "domain error: argument not in valid range";
Tcl_SetObjResult(interp, Tcl_NewStringObj(s, -1));
|
| ︙ |
Changes to generic/tclFCmd.c.
| ︙ | |||
150 151 152 153 154 155 156 | 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | - + - + |
* overwriting the symlink.
*/
if ((Tcl_FSStat(target, &statBuf) != 0) || !S_ISDIR(statBuf.st_mode)) {
if ((objc - i) > 2) {
errno = ENOTDIR;
Tcl_PosixError(interp);
|
| ︙ | |||
317 318 319 320 321 322 323 | 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | - + - + |
}
Tcl_DecrRefCount(split);
split = NULL;
}
done:
if (errfile != NULL) {
|
| ︙ | |||
399 400 401 402 403 404 405 | 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | - + - + |
* We own a reference count on errorBuffer, if it was set as a
* result of this call.
*/
result = Tcl_FSRemoveDirectory(objv[i], force, &errorBuffer);
if (result != TCL_OK) {
if ((force == 0) && (errno == EEXIST)) {
|
| ︙ | |||
448 449 450 451 452 453 454 | 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | - + - + - + - + |
}
if (result != TCL_OK) {
if (errfile == NULL) {
/*
* We try to accommodate poor error results from our Tcl_FS calls.
*/
|
| ︙ | |||
576 577 578 579 580 581 582 | 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 | - + - + - + - + |
* implementations of copy and rename on all platforms also prevent
* this.
*/
if (S_ISDIR(sourceStatBuf.st_mode)
&& !S_ISDIR(targetStatBuf.st_mode)) {
errno = EISDIR;
|
| ︙ | |||
617 618 619 620 621 622 623 | 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 | - + - + |
if (copyFlag == 0) {
result = Tcl_FSRenameFile(source, target);
if (result == TCL_OK) {
goto done;
}
if (errno == EINVAL) {
|
| ︙ | |||
664 665 666 667 668 669 670 | 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 | - + - + |
*/
if (Tcl_FSStat(source, &sourceStatBuf) != 0) {
/*
* Actual file doesn't exist.
*/
|
| ︙ | |||
798 799 800 801 802 803 804 | 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 | - - + + |
} else {
result = Tcl_FSDeleteFile(source);
if (result != TCL_OK) {
errfile = source;
}
}
if (result != TCL_OK) {
|
| ︙ | |||
1020 1021 1022 1023 1024 1025 1026 | 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 | - + - + |
if (objStrings == NULL) {
if (Tcl_GetErrno() != 0) {
/*
* There was an error, probably that the filePtr is not
* accepted by any filesystem
*/
|
| ︙ | |||
1108 1109 1110 1111 1112 1113 1114 | 1108 1109 1110 1111 1112 1113 1114 1115 1116 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 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 | - + - - + + - + - - + + - - - + + + - |
* Get one attribute.
*/
int index;
Tcl_Obj *objPtr = NULL;
if (numObjStrings == 0) {
|
| ︙ | |||
1262 1263 1264 1265 1266 1267 1268 | 1261 1262 1263 1264 1265 1266 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 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 | - + - + - + - + - + - + - + - - + + - + - + |
if (contents == NULL) {
/*
* We handle three common error cases specially, and for all other
* errors, we use the standard Posix error message.
*/
if (errno == EEXIST) {
|
| ︙ | |||
1383 1384 1385 1386 1387 1388 1389 | 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 | - + - + |
return TCL_ERROR;
}
Tcl_DStringFree(&ds);
contents = Tcl_FSLink(objv[1], NULL, 0);
if (contents == NULL) {
|
| ︙ | |||
1539 1540 1541 1542 1543 1544 1545 | 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 | - - + + |
* Deal with results.
*/
if (chan == NULL) {
if (nameVarObj) {
TclDecrRefCount(nameObj);
}
|
| ︙ | |||
1691 1692 1693 1694 1695 1696 1697 | 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 | - + - + |
}
/*
* Deal with results.
*/
if (dirNameObj == NULL) {
|
| ︙ |
Changes to generic/tclFileName.c.
| ︙ | |||
835 836 837 838 839 840 841 | 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 | - + |
switch (tclPlatform) {
case TCL_PLATFORM_UNIX:
/*
* Append a separator if needed.
*/
if (length > 0 && (start[length-1] != '/')) {
|
| ︙ | |||
871 872 873 874 875 876 877 | 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 | - + |
case TCL_PLATFORM_WINDOWS:
/*
* Check to see if we need to append a separator.
*/
if ((length > 0) &&
(start[length-1] != '/') && (start[length-1] != ':')) {
|
| ︙ | |||
927 928 929 930 931 932 933 | 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 | - + - |
char *
Tcl_JoinPath(
Tcl_Size argc,
const char *const *argv,
Tcl_DString *resultPtr) /* Pointer to previously initialized DString */
{
|
| ︙ | |||
955 956 957 958 959 960 961 | 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 | - - + |
Tcl_IncrRefCount(resultObj);
Tcl_DecrRefCount(listObj);
/*
* Store the result.
*/
|
| ︙ | |||
1166 1167 1168 1169 1170 1171 1172 | 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 1245 | - - - + + - + - + - - - + + - + - - - + + - + - + - - - + + - - - + + - + - - - + + + |
/*
* Do nothing; This is normal operations in Tcl 9.
* Keep accepting as a no-op option to accommodate old scripts.
*/
break;
case GLOB_DIR: /* -dir */
if (i == (objc-1)) {
|
| ︙ | |||
1308 1309 1310 1311 1312 1313 1314 | 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 | - + - + |
* '' or 'C:'. The way we do this is to add a separator if
* there are none presently in the prefix. Similar treatment
* for the zipfs volume.
*/
const char *temp = TclGetString(pathOrDir);
if (strpbrk(temp, "\\/") == NULL) {
|
| ︙ | |||
1449 1450 1451 1452 1453 1454 1455 | 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 | - + - - + + - + - + - + | /* * Error cases. We reset the 'join' flag to zero, since we * haven't yet made use of it. */ badTypesArg: |
| ︙ | |||
2030 2031 2032 2033 2034 2035 2036 | 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 | - - - + + - - - - + + - | /* * Balanced braces. */ closeBrace = p; break; } |
| ︙ | |||
2254 2255 2256 2257 2258 2259 2260 | 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 | - + |
* The current prefix must end in a separator.
*/
Tcl_Size len;
const char *joined = TclGetStringFromObj(joinedPtr,&len);
if ((len > 0) && (strchr(separators, joined[len-1]) == NULL)) {
|
| ︙ | |||
2292 2293 2294 2295 2296 2297 2298 | 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 | - + |
*/
Tcl_Size len;
const char *joined = TclGetStringFromObj(joinedPtr,&len);
if ((len > 0) && (strchr(separators, joined[len-1]) == NULL)) {
if (Tcl_FSGetPathType(pathPtr) != TCL_PATH_VOLUME_RELATIVE) {
|
| ︙ |
Changes to generic/tclIO.c.
| ︙ | |||
1231 1232 1233 1234 1235 1236 1237 | 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 | - + - + |
{
ChannelState *statePtr; /* State of the real channel. */
statePtr = ((Channel *) chan)->state->bottomChanPtr->state;
if (GotFlag(statePtr, CHANNEL_INCLOSE)) {
if (interp != NULL) {
|
| ︙ | |||
1459 1460 1461 1462 1463 1464 1465 | 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 | - - - + + + |
name = chanPtr->state->channelName;
}
}
hTblPtr = GetChannelTable(interp);
hPtr = Tcl_FindHashEntry(hTblPtr, name);
if (hPtr == NULL) {
|
| ︙ | |||
1822 1823 1824 1825 1826 1827 1828 | 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 | - + - + - + - + |
while ((statePtr != NULL) && (statePtr->topChanPtr != prevChanPtr)) {
statePtr = statePtr->nextCSPtr;
}
if (statePtr == NULL) {
if (interp) {
|
| ︙ | |||
1873 1874 1875 1876 1877 1878 1879 | 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 | - + - + |
* TODO: Examine what can go wrong if Tcl_Flush() call disturbs
* the stacking state of this channel during its operations.
*/
if (Tcl_Flush((Tcl_Channel) prevChanPtr) != TCL_OK) {
statePtr->csPtrR = csPtrR;
statePtr->csPtrW = csPtrW;
if (interp) {
|
| ︙ | |||
2068 2069 2070 2071 2072 2073 2074 | 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 | - + - + |
* Move error messages put by the driver into the chan/ip
* bypass area into the regular interpreter result. Fall back
* to the regular message if nothing was found in the
* bypasses.
*/
if (!TclChanCaughtErrorBypass(interp, chan) && interp) {
|
| ︙ | |||
2456 2457 2458 2459 2460 2461 2462 | 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 | - + - + |
}
ResetFlag(statePtr, mode);
return TCL_OK;
error:
if (interp != NULL) {
|
| ︙ | |||
2684 2685 2686 2687 2688 2689 2690 | 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 | - - + |
{
if (!GotFlag(statePtr, CHANNEL_DEAD)) {
return 0;
}
Tcl_SetErrno(EINVAL);
if (interp) {
|
| ︙ | |||
3472 3473 3474 3475 3476 3477 3478 | 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 | - + - + |
if (statePtr->refCount > 0) {
Tcl_Panic("called Tcl_Close on channel with refCount > 0");
}
if (GotFlag(statePtr, CHANNEL_INCLOSE)) {
if (interp) {
|
| ︙ | |||
3640 3641 3642 3643 3644 3645 3646 | 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 | - + - + - + - + - - + + - + - + - + - + |
chanPtr = (Channel *) chan;
statePtr = chanPtr->state;
if ((flags & (TCL_READABLE | TCL_WRITABLE)) == 0) {
return TclClose(interp, chan);
}
if ((flags & (TCL_READABLE | TCL_WRITABLE)) == (TCL_READABLE | TCL_WRITABLE)) {
|
| ︙ | |||
7883 7884 7885 7886 7887 7888 7889 | 7882 7883 7884 7885 7886 7887 7888 7889 7890 7891 7892 7893 7894 7895 7896 7897 7898 7899 7900 7901 7902 7903 7904 | - - - + + + |
Tcl_Interp *interp, /* Current interpreter (can be NULL).*/
const char *optionName, /* 'bad option' name */
const char *optionList) /* Specific options list to append to the
* standard generic options. Can be NULL for
* generic options only. */
{
if (interp != NULL) {
|
| ︙ | |||
8030 8031 8032 8033 8034 8035 8036 | 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 | - + - + |
}
}
if (len == 0 || HaveOpt(2, "-encoding")) {
if (len == 0) {
Tcl_DStringAppendElement(dsPtr, "-encoding");
}
Tcl_DStringAppendElement(dsPtr,
|
| ︙ | |||
8170 8171 8172 8173 8174 8175 8176 | 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 | - + - + |
/*
* If the channel is in the middle of a background copy, fail.
*/
if (statePtr->csPtrR || statePtr->csPtrW) {
if (interp) {
|
| ︙ | |||
8221 8222 8223 8224 8225 8226 8227 | 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 | - + - + |
ResetFlag(statePtr, CHANNEL_UNBUFFERED);
SetFlag(statePtr, CHANNEL_LINEBUFFERED);
} else if ((newValue[0] == 'n') &&
(strncmp(newValue, "none", len) == 0)) {
ResetFlag(statePtr, CHANNEL_LINEBUFFERED);
SetFlag(statePtr, CHANNEL_UNBUFFERED);
} else if (interp) {
|
| ︙ | |||
8251 8252 8253 8254 8255 8256 8257 | 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 | - + - + |
return TCL_OK;
} else if (HaveOpt(2, "-encoding")) {
Tcl_Encoding encoding;
int profile;
if ((newValue[0] == '\0') || !strcmp(newValue, "binary")) {
if (interp) {
|
| ︙ | |||
8298 8299 8300 8301 8302 8303 8304 | 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 | - + - + |
#endif
))) {
if (GotFlag(statePtr, TCL_READABLE)) {
statePtr->inEofChar = newValue[0];
}
} else {
if (interp) {
|
| ︙ | |||
8345 8346 8347 8348 8349 8350 8351 | 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 | - + - + |
readMode = GotFlag(statePtr, TCL_READABLE) ? argv[0] : NULL;
writeMode = GotFlag(statePtr, TCL_WRITABLE) ? argv[0] : NULL;
} else if (argc == 2) {
readMode = GotFlag(statePtr, TCL_READABLE) ? argv[0] : NULL;
writeMode = GotFlag(statePtr, TCL_WRITABLE) ? argv[1] : NULL;
} else {
if (interp) {
|
| ︙ | |||
8375 8376 8377 8378 8379 8380 8381 | 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 | - + - + |
translation = TCL_TRANSLATE_CR;
} else if (strcmp(readMode, "crlf") == 0) {
translation = TCL_TRANSLATE_CRLF;
} else if (strcmp(readMode, "platform") == 0) {
translation = TCL_PLATFORM_TRANSLATION;
} else {
if (interp) {
|
| ︙ | |||
8424 8425 8426 8427 8428 8429 8430 | 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 8435 8436 8437 8438 8439 | - + - + |
statePtr->outputTranslation = TCL_TRANSLATE_CR;
} else if (strcmp(writeMode, "crlf") == 0) {
statePtr->outputTranslation = TCL_TRANSLATE_CRLF;
} else if (strcmp(writeMode, "platform") == 0) {
statePtr->outputTranslation = TCL_PLATFORM_TRANSLATION;
} else {
if (interp) {
|
| ︙ | |||
9233 9234 9235 9236 9237 9238 9239 | 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 9245 9246 9247 | - - + + |
chan = Tcl_GetChannel(interp, chanName, NULL);
if (chan == NULL) {
return TCL_ERROR;
}
chanPtr = (Channel *) chan;
statePtr = chanPtr->state;
if (GotFlag(statePtr, mask) == 0) {
|
| ︙ | |||
9344 9345 9346 9347 9348 9349 9350 | 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 9364 9365 | - - + + - - + + |
int moveBytes;
inStatePtr = inPtr->state;
outStatePtr = outPtr->state;
if (BUSY_STATE(inStatePtr, TCL_READABLE)) {
if (interp) {
|
| ︙ | |||
9684 9685 9686 9687 9688 9689 9690 9691 9692 9693 9694 9695 9696 9697 | 9683 9684 9685 9686 9687 9688 9689 9690 9691 9692 9693 9694 9695 9696 9697 9698 9699 9700 9701 9702 9703 9704 9705 9706 9707 9708 9709 9710 9711 9712 9713 9714 | + + + + + + + + + + + + + + + + + + |
if (code == TCL_ERROR) {
return TCL_ERROR;
}
/* code == TCL_CONTINUE --> continue the loop */
}
return TCL_OK; /* Silence compiler warnings */
}
static inline Tcl_Obj *
ErrorCopying(
Tcl_Interp *interp,
Tcl_Channel chan,
const char *direction,
Tcl_Obj *msg)
{
const char *chanName = Tcl_GetChannelName(chan);
const char *details = (msg ? TclGetString(msg) : Tcl_PosixError(interp));
if (chanName) {
return Tcl_ObjPrintf("error %s \"%s\": %s",
direction, chanName, details);
} else {
return Tcl_ObjPrintf("error %s closed channel: %s", direction, details);
}
}
static int
CopyData(
CopyState *csPtr, /* State of copy operation. */
int mask) /* Current channel event flags. */
{
Tcl_Interp *interp;
|
| ︙ | |||
9804 9805 9806 9807 9808 9809 9810 | 9821 9822 9823 9824 9825 9826 9827 9828 9829 9830 9831 9832 9833 9834 9835 | - + - - - - - - - - |
}
underflow = (size >= 0) && (size < sizeb); /* Input underflow */
}
if (size < 0) {
readError:
if (interp) {
|
| ︙ | |||
9880 9881 9882 9883 9884 9885 9886 | 9889 9890 9891 9892 9893 9894 9895 9896 9897 9898 9899 9900 9901 9902 9903 | - + - - - - - - - - |
* drive toRead below -1, causing infinite looping). Completely
* unsuitable for updating totals and toRead.
*/
if (sizeb < 0) {
writeError:
if (interp) {
|
| ︙ | |||
10507 10508 10509 10510 10511 10512 10513 | 10508 10509 10510 10511 10512 10513 10514 10515 10516 10517 10518 10519 10520 10521 10522 10523 10524 | - + - + |
*
* Note that we cannot have a message in the interpreter bypass
* area, StackSetBlockMode is restricted to the channel bypass.
* We still need the interp as the destination of the move.
*/
if (!TclChanCaughtErrorBypass(interp, (Tcl_Channel) chanPtr)) {
|
| ︙ |
Changes to generic/tclIOCmd.c.
| ︙ | |||
153 154 155 156 157 158 159 | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | - + - + |
}
chanObjPtr = tsdPtr->stdoutObjPtr;
}
if (TclGetChannelFromObj(interp, chanObjPtr, &chan, &mode, 0) != TCL_OK) {
return TCL_ERROR;
}
if (!(mode & TCL_WRITABLE)) {
|
| ︙ | |||
182 183 184 185 186 187 188 | 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | - - + + |
* Capture error messages put by the driver into the bypass area and put
* them into the regular interpreter result. Fall back to the regular
* message if nothing was found in the bypass.
*/
error:
if (!TclChanCaughtErrorBypass(interp, chan)) {
|
| ︙ | |||
226 227 228 229 230 231 232 | 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 | - + - + - + - + |
return TCL_ERROR;
}
chanObjPtr = objv[1];
if (TclGetChannelFromObj(interp, chanObjPtr, &chan, &mode, 0) != TCL_OK) {
return TCL_ERROR;
}
if (!(mode & TCL_WRITABLE)) {
|
| ︙ | |||
292 293 294 295 296 297 298 | 292 293 294 295 296 297 298 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 | - + - + - + - + |
return TCL_ERROR;
}
chanObjPtr = objv[1];
if (TclGetChannelFromObj(interp, chanObjPtr, &chan, &mode, 0) != TCL_OK) {
return TCL_ERROR;
}
if (!(mode & TCL_READABLE)) {
|
| ︙ | |||
403 404 405 406 407 408 409 | 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 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 459 460 461 462 | - + - + - + - - + + - + - + - + |
}
chanObjPtr = objv[i];
if (TclGetChannelFromObj(interp, chanObjPtr, &chan, &mode, 0) != TCL_OK) {
return TCL_ERROR;
}
if (!(mode & TCL_READABLE)) {
|
| ︙ | |||
540 541 542 543 544 545 546 | 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 | - + - + |
* TIP #219.
* Capture error messages put by the driver into the bypass area and
* put them into the regular interpreter result. Fall back to the
* regular message if nothing was found in the bypass.
*/
if (!TclChanCaughtErrorBypass(interp, chan)) {
|
| ︙ | |||
671 672 673 674 675 676 677 | 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 | - + - + |
/*
* Check direction against channel mode. It is an error if we try to
* close a direction not supported by the channel (already closed, or
* never opened for that direction).
*/
if (!(dir & Tcl_GetChannelMode(chan))) {
|
| ︙ | |||
1011 1012 1013 1014 1015 1016 1017 | 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 | - + - + |
* TIP #219.
* Capture error messages put by the driver into the bypass area
* and put them into the regular interpreter result. Fall back to
* the regular message if nothing was found in the bypass.
*/
if (!TclChanCaughtErrorBypass(interp, chan)) {
|
| ︙ | |||
1082 1083 1084 1085 1086 1087 1088 | 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 | - + - + |
return TCL_ERROR;
}
if (TclGetChannelFromObj(interp, objv[1], &chan, &mode, 0) != TCL_OK) {
return TCL_ERROR;
}
if (!(mode & TCL_READABLE)) {
|
| ︙ | |||
1144 1145 1146 1147 1148 1149 1150 | 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 | - + |
if ((permString[scanned] == '0')
&& (permString[scanned+1] >= '0')
&& (permString[scanned+1] <= '7')) {
Tcl_Obj *permObj;
TclNewLiteralStringObj(permObj, "0o");
|
| ︙ | |||
1522 1523 1524 1525 1526 1527 1528 | 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 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 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 | - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + - + - + |
if (Tcl_GetIndexFromObj(interp, objv[a], socketOptions, "option",
TCL_EXACT, &optionIndex) != TCL_OK) {
return TCL_ERROR;
}
switch (optionIndex) {
case SKT_ASYNC:
if (server == 1) {
|
| ︙ | |||
1765 1766 1767 1768 1769 1770 1771 | 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 | - + - + - + - + |
* writable, as appropriate.
*/
if (TclGetChannelFromObj(interp, objv[1], &inChan, &mode, 0) != TCL_OK) {
return TCL_ERROR;
}
if (!(mode & TCL_READABLE)) {
|
| ︙ | |||
1920 1921 1922 1923 1924 1925 1926 | 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 | - - + + - + - + - + - + |
* User is supplying an explicit length.
*/
if (TclGetWideIntFromObj(interp, objv[2], &length) != TCL_OK) {
return TCL_ERROR;
}
if (length < 0) {
|
| ︙ |
Changes to generic/tclIOGT.c.
| ︙ | |||
263 264 265 266 267 268 269 | 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | - - + |
Tcl_DString ds;
if (chan == NULL) {
return TCL_ERROR;
}
if (TCL_OK != TclListObjLength(interp, cmdObjPtr, &objc)) {
|
| ︙ | |||
468 469 470 471 472 473 474 | 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 | - - + + - |
case TRANSMIT_IBUF:
resObj = Tcl_GetObjResult(eval);
resBuf = Tcl_GetBytesFromObj(NULL, resObj, &resLen);
if (resBuf) {
ResultAdd(&dataPtr->result, resBuf, resLen);
break;
}
|
| ︙ |
Changes to generic/tclIORChan.c.
| ︙ | |||
504 505 506 507 508 509 510 | 504 505 506 507 508 509 510 511 512 513 514 515 516 517 | - |
Tcl_Size listc; /* Result of 'initialize', and of */
Tcl_Obj **listv; /* its sublist in the 2nd element */
int methIndex; /* Encoded method name */
int result; /* Result code for 'initialize' */
Tcl_Obj *resObj; /* Result data for 'initialize' */
int methods; /* Bitmask for supported methods. */
Channel *chanPtr; /* 'chan' resolved to internal struct. */
|
| ︙ | |||
598 599 600 601 602 603 604 | 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 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 | - + - + - - - + + - - + - + - + - + - + - + - + - + - + - + - + |
* Verify the result.
* - List, of method names. Convert to mask.
* Check for non-optionals through the mask.
* Compare open mode against optional r/w.
*/
if (TclListObjGetElements(NULL, resObj, &listc, &listv) != TCL_OK) {
|
| ︙ | |||
855 856 857 858 859 860 861 | 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 | - - - + + + |
chanId = TclGetString(objv[CHAN]);
rcmPtr = GetReflectedChannelMap(interp);
hPtr = Tcl_FindHashEntry(&rcmPtr->map, chanId);
if (hPtr == NULL) {
|
| ︙ | |||
909 910 911 912 913 914 915 | 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 | - - + - + - + |
* "write". Expect at least one list element. Abbreviations are ok.
*/
if (EncodeEventMask(interp, "event", objv[EVENT], &events) != TCL_OK) {
return TCL_ERROR;
}
if (events == 0) {
|
| ︙ | |||
1951 1952 1953 1954 1955 1956 1957 | 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 | - + - + |
if ((listc % 2) == 1) {
/*
* Odd number of elements is wrong.
*/
Tcl_ResetResult(interp);
|
| ︙ | |||
2409 2410 2411 2412 2413 2414 2415 | 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 | - - + + - + - + |
if (result != TCL_ERROR) {
Tcl_Size cmdLen;
const char *cmdString = TclGetStringFromObj(cmd, &cmdLen);
Tcl_IncrRefCount(cmd);
Tcl_ResetResult(rcPtr->interp);
|
| ︙ |
Changes to generic/tclIORTrans.c.
| ︙ | |||
596 597 598 599 600 601 602 | 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 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 667 668 669 670 671 672 673 674 675 676 | - + - + - + - + - - + - + - + - + - + - + - + - + |
/*
* Verify the result.
* - List, of method names. Convert to mask. Check for non-optionals
* through the mask. Compare open mode against optional r/w.
*/
if (TclListObjGetElements(NULL, resObj, &listc, &listv) != TCL_OK) {
|
| ︙ | |||
1999 2000 2001 2002 2003 2004 2005 | 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 | - - + + - - + + |
if (result != TCL_ERROR) {
Tcl_Obj *cmd = Tcl_NewListObj(cmdc, rtPtr->argv);
Tcl_Size cmdLen;
const char *cmdString = TclGetStringFromObj(cmd, &cmdLen);
Tcl_IncrRefCount(cmd);
Tcl_ResetResult(rtPtr->interp);
|
| ︙ |
Changes to generic/tclIOSock.c.
| ︙ | |||
88 89 90 91 92 93 94 | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | - - + |
return TCL_OK;
}
}
if (Tcl_GetInt(interp, string, portPtr) != TCL_OK) {
return TCL_ERROR;
}
if (*portPtr > 0xFFFF) {
|
| ︙ |
Changes to generic/tclIOUtil.c.
| ︙ | |||
1048 1049 1050 1051 1052 1053 1054 | 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 | - - + + - |
* generic code because otherwise every filesystem implementation of
* Tcl_FSMatchInDirectory has to do it.
*/
cwd = Tcl_FSGetCwd(NULL);
if (cwd == NULL) {
if (interp != NULL) {
|
| ︙ | |||
1510 1511 1512 1513 1514 1515 1516 | 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 | - - - + + - - - + + + - - + - - - + + + |
goto error;
}
return mode;
error:
*modeFlagsPtr = 0;
if (interp != NULL) {
|
| ︙ | |||
1570 1571 1572 1573 1574 1575 1576 | 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 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 | - - + - + - + - + - + - + - + - + - - + + - |
}
mode = (mode & ~O_ACCMODE) | O_RDWR;
gotRW = 1;
} else if ((c == 'A') && (strcmp(flag, "APPEND") == 0)) {
if (mode & O_APPEND) {
accessFlagRepeated:
if (interp) {
|
| ︙ | |||
1707 1708 1709 1710 1711 1712 1713 | 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 | - + - + - + - + |
if (Tcl_FSGetNormalizedPath(interp, pathPtr) == NULL) {
return result;
}
if (Tcl_FSStat(pathPtr, &statBuf) == -1) {
Tcl_SetErrno(errno);
|
| ︙ | |||
1750 1751 1752 1753 1754 1755 1756 | 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 | - + - + - + - + |
/*
* Read first character of stream to check for utf-8 BOM
*/
if (Tcl_ReadChars(chan, objPtr, 1, 0) == TCL_IO_FAILURE) {
Tcl_CloseEx(interp, chan, 0);
|
| ︙ | |||
1810 1811 1812 1813 1814 1815 1816 | 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 | - - + - + | * Record information about where the error occurred. */ const char *pathString = TclGetStringFromObj(pathPtr, &length); int limit = 150; int overflow = (length > limit); |
| ︙ | |||
1842 1843 1844 1845 1846 1847 1848 | 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 | - + - + - + - + |
if (Tcl_FSGetNormalizedPath(interp, pathPtr) == NULL) {
return TCL_ERROR;
}
if (Tcl_FSStat(pathPtr, &statBuf) == -1) {
Tcl_SetErrno(errno);
|
| ︙ | |||
1886 1887 1888 1889 1890 1891 1892 | 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 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 | - + - + - + - + - + - |
/*
* Read first character of stream to check for utf-8 BOM
*/
if (Tcl_ReadChars(chan, objPtr, 1, 0) == TCL_IO_FAILURE) {
Tcl_CloseEx(interp, chan, 0);
|
| ︙ | |||
1963 1964 1965 1966 1967 1968 1969 | 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 | - - + - + | */ Tcl_Size length; const char *pathString = TclGetStringFromObj(pathPtr, &length); const int limit = 150; int overflow = (length > limit); |
| ︙ | |||
2058 2059 2060 2061 2062 2063 2064 | 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 | - + |
Tcl_Interp *interp) /* Interpreter to set the errorCode of */
{
const char *id, *msg;
msg = Tcl_ErrnoMsg(errno);
id = Tcl_ErrnoId();
if (interp) {
|
| ︙ | |||
2228 2229 2230 2231 2232 2233 2234 | 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 | - + - + - + - + |
/*
* Seek and/or set binary mode as determined above.
*/
if ((modeFlags & 1) && Tcl_Seek(retVal, (Tcl_WideInt) 0, SEEK_END)
< (Tcl_WideInt) 0) {
if (interp != NULL) {
|
| ︙ | |||
2672 2673 2674 2675 2676 2677 2678 | 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 | - + - + |
fsRecPtr->fsPtr->freeInternalRepProc(retCd);
}
Tcl_DecrRefCount(retVal);
retVal = NULL;
Disclaim();
goto cdDidNotChange;
} else if (interp != NULL) {
|
| ︙ | |||
2747 2748 2749 2750 2751 2752 2753 | 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 | - + - + |
* New API.
*/
TclFSGetCwdProc2 *proc2 = (TclFSGetCwdProc2 *) fsPtr->getCwdProc;
retCd = proc2(tsdPtr->cwdClientData);
if (retCd == NULL && interp != NULL) {
|
| ︙ | |||
3211 3212 3213 3214 3215 3216 3217 | 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 | - + - + |
/*
* Make sure the file is accessible.
*/
if (Tcl_FSAccess(pathPtr, R_OK) != 0) {
if (interp) {
|
| ︙ | |||
3287 3288 3289 3290 3291 3292 3293 | 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 | - - + |
/*
* Try to delete the file we probably created and then exit.
*/
Tcl_FSDeleteFile(copyToPtr);
Tcl_DecrRefCount(copyToPtr);
if (interp) {
|
| ︙ | |||
3588 3589 3590 3591 3592 3593 3594 | 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 | - - + + - |
int
Tcl_FSUnloadFile(
Tcl_Interp *interp, /* The relevant interpreter. */
Tcl_LoadHandle handle) /* A handle for the object to unload. */
{
if (handle->unloadFileProcPtr == NULL) {
if (interp != NULL) {
|
| ︙ |
Changes to generic/tclIcu.c.
| ︙ | |||
290 291 292 293 294 295 296 | 290 291 292 293 294 295 296 297 298 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 | - - - + + - + - - + + |
/* Error handlers. */
static int
FunctionNotAvailableError(
Tcl_Interp *interp)
{
if (interp) {
|
| ︙ | |||
599 600 601 602 603 604 605 | 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 | - + - + |
if (objc == 1) {
return DetectableEncodings(interp);
}
int all = 0;
if (objc == 3) {
if (strcmp("-all", Tcl_GetString(objv[2]))) {
|
| ︙ | |||
767 768 769 770 771 772 773 | 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 | - - + |
}
}
UCharx *utf16 = (UCharx *) Tcl_DStringValue(dsInPtr);
Tcl_Size utf16len = Tcl_DStringLength(dsInPtr) / sizeof(UCharx);
Tcl_Size dstLen, dstCapacity;
if (utf16len > INT_MAX) {
|
| ︙ | |||
831 832 833 834 835 836 837 | 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 | - - + |
{
if (ucnv_open == NULL || ucnv_close == NULL ||
ucnv_toUChars == NULL || UCNV_TO_U_CALLBACK_STOP == NULL) {
return FunctionNotAvailableError(interp);
}
if (nbytes > INT_MAX) {
|
| ︙ | |||
940 941 942 943 944 945 946 | 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 | - - + |
Tcl_Size utf16len;
UCharx *normPtr;
int32_t normLen;
utf16 = (UCharx *) Tcl_DStringValue(dsInPtr);
utf16len = Tcl_DStringLength(dsInPtr) / sizeof(UCharx);
if (utf16len > INT_MAX) {
|
| ︙ | |||
1005 1006 1007 1008 1009 1010 1011 | 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 | - - - + + - - - - - + + + + - - + |
for (i = 1; i < objc; ++i) {
if (Tcl_GetIndexFromObj(
interp, objv[i], optNames, "option", 0, &opt) != TCL_OK) {
return TCL_ERROR;
}
++i;
if (i == objc) {
|
| ︙ | |||
1174 1175 1176 1177 1178 1179 1180 | 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 | - - - + + - - - - - + + + + - + + |
for (i = 1; i < objc - 1; ++i) {
if (Tcl_GetIndexFromObj(
interp, objv[i], optNames, "option", 0, &opt) != TCL_OK) {
return TCL_ERROR;
}
++i;
if (i == (objc-1)) {
|
| ︙ | |||
1399 1400 1401 1402 1403 1404 1405 | 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 | - + - + - + |
* On Windows, if no ICU install found, look for the system's
* (Win10 1703 or later). There are two cases. Newer systems
* have icu.dll containing all functions. Older systems have
* icucc.dll and icuin.dll
*/
if (icu_fns.libs[0] == NULL) {
Tcl_ResetResult(interp);
|
| ︙ |
Changes to generic/tclIndexObj.c.
| ︙ | |||
199 200 201 202 203 204 205 | 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | - + - + |
const char *const *entryPtr;
Tcl_Obj *resultPtr;
IndexRep *indexRep;
const Tcl_ObjInternalRep *irPtr;
if (offset < (Tcl_Size)sizeof(char *)) {
if (interp) {
|
| ︙ | |||
329 330 331 332 333 334 335 | 329 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 | - + - + - + - + - - - + + - + - + - + |
int count = 0;
TclNewObj(resultPtr);
entryPtr = (const char *const *)tablePtr;
while ((*entryPtr != NULL) && !**entryPtr) {
entryPtr = NEXT_ENTRY(entryPtr, offset);
}
|
| ︙ | |||
532 533 534 535 536 537 538 | 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 | - - - + + - - - + + - - + + - - + |
}
switch (index) {
case PRFMATCH_EXACT:
flags |= TCL_EXACT;
break;
case PRFMATCH_MESSAGE:
if (i > objc-4) {
|
| ︙ | |||
590 591 592 593 594 595 596 | 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 | - + - |
} else if (errorPtr == NULL) {
return TCL_ERROR;
}
if (Tcl_IsShared(errorPtr)) {
errorPtr = Tcl_DuplicateObj(errorPtr);
}
|
| ︙ | |||
819 820 821 822 823 824 825 | 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 | - + - + |
Interp *iPtr = (Interp *)interp;
const char *elementStr;
TclNewObj(objPtr);
if (iPtr->flags & INTERP_ALTERNATE_WRONG_ARGS) {
iPtr->flags &= ~INTERP_ALTERNATE_WRONG_ARGS;
Tcl_AppendObjToObj(objPtr, Tcl_GetObjResult(interp));
|
| ︙ | |||
890 891 892 893 894 895 896 | 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 | - + |
/*
* Add a space if the word is not the last one (which has a
* moderately complex condition here).
*/
if (i + 1 < toPrint || objc!=0 || message!=NULL) {
|
| ︙ | |||
912 913 914 915 916 917 918 | 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 | - + |
* Otherwise, just use the string rep.
*/
const Tcl_ObjInternalRep *irPtr;
if ((irPtr = TclFetchInternalRep(objv[i], &tclIndexType))) {
IndexRep *indexRep = (IndexRep *)irPtr->twoPtrValue.ptr1;
|
| ︙ | |||
940 941 942 943 944 945 946 | 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 | - + - + - - + + |
/*
* Append a space character (" ") if there is more text to follow
* (either another element from objv, or the message string).
*/
if (i + 1 < objc || message!=NULL) {
|
| ︙ | |||
1072 1073 1074 1075 1076 1077 1078 | 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 1093 | - - + - - + |
continue;
}
if (infoPtr->keyStr[length] == 0) {
matchPtr = infoPtr;
goto gotMatch;
}
if (matchPtr != NULL) {
|
| ︙ | |||
1111 1112 1113 1114 1115 1116 1117 | 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 | - + - + |
break;
case TCL_ARGV_INT:
if (objc == 0) {
goto missingArg;
}
if (Tcl_GetIntFromObj(interp, objv[srcIndex],
(int *) infoPtr->dstPtr) == TCL_ERROR) {
|
| ︙ | |||
1144 1145 1146 1147 1148 1149 1150 | 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 | - + - + |
goto argsDone;
case TCL_ARGV_FLOAT:
if (objc == 0) {
goto missingArg;
}
if (Tcl_GetDoubleFromObj(interp, objv[srcIndex],
(double *) infoPtr->dstPtr) == TCL_ERROR) {
|
| ︙ | |||
1169 1170 1171 1172 1173 1174 1175 | 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 | - - - + + + - - + + |
if (handlerProc(infoPtr->clientData, argObj, infoPtr->dstPtr)) {
srcIndex++;
objc--;
}
break;
}
case TCL_ARGV_GENFUNC: {
|
| ︙ | |||
1229 1230 1231 1232 1233 1234 1235 | 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 | - - + + |
/*
* Make sure to handle freeing any temporary space we've allocated on the
* way to an error.
*/
missingArg:
|
| ︙ | |||
1291 1292 1293 1294 1295 1296 1297 | 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 | - + - + |
}
}
/*
* Now add the option information, with pretty-printing.
*/
|
| ︙ | |||
1375 1376 1377 1378 1379 1380 1381 | 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 | - + - - + + |
}
/*
* Value is not a legal completion code.
*/
if (interp != NULL) {
|
Changes to generic/tclInt.h.
| ︙ | |||
4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 | 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 | + + + + + + + + + + + + + + |
*/
#define TclDStringAppendLiteral(dsPtr, sLiteral) \
Tcl_DStringAppend((dsPtr), (sLiteral), sizeof(sLiteral "") - 1)
#define TclDStringClear(dsPtr) \
Tcl_DStringSetLength((dsPtr), 0)
/*
*----------------------------------------------------------------
* Convenience macro for Tcl_AppendToObj and Tcl_NewStringObj.
* The ANSI C "prototypes" for these macros are:
*
* MODULE_SCOPE void TclAppendLiteralToObj(Tcl_DString *dsPtr,
* const char *sLiteral);
* MODULE_SCOPE Tcl_Obj * TclNewString(const char *sLiteral);
*/
#define TclAppendLiteralToObj(objPtr, sLiteral) \
Tcl_AppendToObj((objPtr), (sLiteral), sizeof(sLiteral "") - 1)
#define TclNewString(sLiteral) \
Tcl_NewStringObj((sLiteral), sizeof(sLiteral "") - 1)
/*
*----------------------------------------------------------------
* Inline version of Tcl_GetCurrentNamespace and Tcl_GetGlobalNamespace.
*/
#define TclGetCurrentNamespace(interp) \
(Tcl_Namespace *) ((Interp *)(interp))->varFramePtr->nsPtr
|
| ︙ | |||
5068 5069 5070 5071 5072 5073 5074 | 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 | - + + + + + + + + + + + + + + + + + + + + + + + + + + + + |
#define TOP_CB(iPtr) \
(((Interp *)(iPtr))->execEnvPtr->callbackPtr)
/*
* Inline version of Tcl_NRAddCallback.
*/
|
| ︙ |
Changes to generic/tclInterp.c.
| ︙ | |||
879 880 881 882 883 884 885 | 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 | - - - - + + + + |
InterpInfo *iiPtr;
for (i = 2; i < objc; i++) {
childInterp = GetInterp(interp, objv[i]);
if (childInterp == NULL) {
return TCL_ERROR;
} else if (childInterp == interp) {
|
| ︙ | |||
1124 1125 1126 1127 1128 1129 1130 | 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 | - + - - + + - - + - - - + + + |
}
aliasName = TclGetString(objv[3]);
iiPtr = INTERP_INFO(childInterp);
hPtr = Tcl_FindHashEntry(&iiPtr->child.aliasTable, aliasName);
if (hPtr == NULL) {
|
| ︙ | |||
1317 1318 1319 1320 1321 1322 1323 | 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 | - - - + + - |
Tcl_HashEntry *hPtr;
Alias *aliasPtr;
Tcl_Size objc;
Tcl_Obj **objv;
hPtr = Tcl_FindHashEntry(&iiPtr->child.aliasTable, aliasName);
if (hPtr == NULL) {
|
| ︙ | |||
1408 1409 1410 1411 1412 1413 1414 | 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 | - + - + - + - - + + - |
if (Tcl_InterpDeleted(nextAliasPtr->targetInterp)) {
/*
* The child interpreter can be deleted while creating the alias.
* [Bug #641195]
*/
|
| ︙ | |||
1646 1647 1648 1649 1650 1651 1652 | 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 | - - - - + + + + |
* the original name (with which it was created) to find the alias to
* delete it.
*/
childPtr = &INTERP_INFO(childInterp)->child;
hPtr = Tcl_FindHashEntry(&childPtr->aliasTable, TclGetString(namePtr));
if (hPtr == NULL) {
|
| ︙ | |||
1816 1817 1818 1819 1820 1821 1822 | 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 | - + |
/*
* Use the ensemble rewriting machinery to ensure correct error messages:
* only the source command should show, not the full target prefix.
*/
if (TclInitRewriteEnsemble(interp, 1, prefc, objv)) {
|
| ︙ | |||
2298 2299 2300 2301 2302 2303 2304 | 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 | - - - - + + + + |
childPtr = (Child *) Tcl_GetHashValue(hPtr);
searchInterp = childPtr->childInterp;
if (searchInterp == NULL) {
break;
}
}
if (searchInterp == NULL) {
|
| ︙ | |||
2336 2337 2338 2339 2340 2341 2342 | 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 | - - - - + + + |
Tcl_Obj *const objv[]) /* Argument strings. */
{
if (objc) {
Tcl_Size length;
if (TCL_ERROR == TclListObjLength(NULL, objv[0], &length)
|| (length < 1)) {
|
| ︙ | |||
2407 2408 2409 2410 2411 2412 2413 | 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 | - + - + |
safe = Tcl_IsSafe(parentInterp);
}
parentInfoPtr = INTERP_INFO(parentInterp);
hPtr = Tcl_CreateHashEntry(&parentInfoPtr->parent.childTable, path,
&isNew);
if (isNew == 0) {
|
| ︙ | |||
2778 2779 2780 2781 2782 2783 2784 | 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 | - + - |
int debugType;
Interp *iPtr;
Tcl_Obj *resultPtr;
iPtr = (Interp *) childInterp;
if (objc == 0) {
TclNewObj(resultPtr);
|
| ︙ | |||
2902 2903 2904 2905 2906 2907 2908 | 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 | - - + + - - + - |
Tcl_Interp *childInterp, /* Interp in which command will be exposed. */
Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
const char *name;
if (Tcl_IsSafe(interp)) {
|
| ︙ | |||
2948 2949 2950 2951 2952 2953 2954 | 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 | - - - + + + - - - - + + - - - - + + |
Tcl_Obj *const objv[]) /* Argument strings. */
{
Interp *iPtr;
Tcl_WideInt limit;
if (objc) {
if (Tcl_IsSafe(interp)) {
|
| ︙ | |||
3008 3009 3010 3011 3012 3013 3014 | 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 | - - + + - - + - |
Tcl_Interp *childInterp, /* Interp in which command will be exposed. */
Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument strings. */
{
const char *name;
if (Tcl_IsSafe(interp)) {
|
| ︙ | |||
3094 3095 3096 3097 3098 3099 3100 | 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 | - - + + - - + - - + - |
const char *namespaceName, /* The namespace to use, if any. */
Tcl_Size objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
int result;
if (Tcl_IsSafe(interp)) {
|
| ︙ | |||
3171 3172 3173 3174 3175 3176 3177 | 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 | - - + + - - + - |
static int
ChildMarkTrusted(
Tcl_Interp *interp, /* Interp for error return. */
Tcl_Interp *childInterp) /* The child interpreter which will be marked
* trusted. */
{
if (Tcl_IsSafe(interp)) {
|
| ︙ | |||
3426 3427 3428 3429 3430 3431 3432 | 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 | - - - + + |
(iPtr->limit.cmdCount < iPtr->cmdCount)) {
iPtr->limit.exceeded |= TCL_LIMIT_COMMANDS;
Tcl_Preserve(interp);
RunLimitHandlers(iPtr->limit.cmdHandlers, interp);
if (iPtr->limit.cmdCount >= iPtr->cmdCount) {
iPtr->limit.exceeded &= ~TCL_LIMIT_COMMANDS;
} else if (iPtr->limit.exceeded & TCL_LIMIT_COMMANDS) {
|
| ︙ | |||
3452 3453 3454 3455 3456 3457 3458 | 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 | - - - + + |
Tcl_Preserve(interp);
RunLimitHandlers(iPtr->limit.timeHandlers, interp);
if (iPtr->limit.time.sec > now.sec ||
(iPtr->limit.time.sec == now.sec &&
iPtr->limit.time.usec >= now.usec)) {
iPtr->limit.exceeded &= ~TCL_LIMIT_TIME;
} else if (iPtr->limit.exceeded & TCL_LIMIT_TIME) {
|
| ︙ | |||
4456 4457 4458 4459 4460 4461 4462 | 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 | - - - + + - |
* First, ensure that we are not reading or writing the calling
* interpreter's limits; it may only manipulate its children. Note that
* the low level API enforces this with Tcl_Panic, which we want to
* avoid. [Bug 3398794]
*/
if (interp == childInterp) {
|
| ︙ | |||
4551 4552 4553 4554 4555 4556 4557 | 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 | - - - - + + + - - - - + + + + |
break;
case OPT_GRAN:
granObj = objv[i+1];
if (TclGetIntFromObj(interp, objv[i+1], &gran) != TCL_OK) {
return TCL_ERROR;
}
if (gran < 1) {
|
| ︙ | |||
4640 4641 4642 4643 4644 4645 4646 | 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 | - - - + + - |
* First, ensure that we are not reading or writing the calling
* interpreter's limits; it may only manipulate its children. Note that
* the low level API enforces this with Tcl_Panic, which we want to
* avoid. [Bug 3398794]
*/
if (interp == childInterp) {
|
| ︙ | |||
4755 4756 4757 4758 4759 4760 4761 | 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 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 | - - - - + + + - - - - + + + + - - - - + + + - + - - - + + + - + - - - + + + |
break;
case OPT_GRAN:
granObj = objv[i+1];
if (TclGetIntFromObj(interp, objv[i+1], &gran) != TCL_OK) {
return TCL_ERROR;
}
if (gran < 1) {
|
| ︙ |
Changes to generic/tclLink.c.
| ︙ | |||
163 164 165 166 167 168 169 | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | - - + |
Namespace *dummy;
const char *name;
int code;
linkPtr = (Link *) Tcl_VarTraceInfo2(interp, varName, NULL,
TCL_GLOBAL_ONLY, LinkTraceProc, NULL);
if (linkPtr != NULL) {
|
| ︙ | |||
243 244 245 246 247 248 249 | 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | - - + |
Tcl_Obj *objPtr;
Link *linkPtr;
Namespace *dummy;
const char *name;
int code;
if (size < 1) {
|
| ︙ | |||
311 312 313 314 315 316 317 | 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | - - + |
break;
case TCL_LINK_CHARS:
case TCL_LINK_BINARY:
linkPtr->bytes = size * sizeof(char);
break;
default:
LinkFree(linkPtr);
|
| ︙ |
Changes to generic/tclListObj.c.
| ︙ | |||
465 466 467 468 469 470 471 | 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | - + - - + + |
*/
static int
MemoryAllocationError(
Tcl_Interp *interp, /* Interpreter for error message. May be NULL */
size_t size) /* Size of attempted allocation that failed */
{
if (interp != NULL) {
|
| ︙ | |||
494 495 496 497 498 499 500 | 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 | - - - + + |
*------------------------------------------------------------------------
*/
static int
ListLimitExceededError(
Tcl_Interp *interp)
{
if (interp != NULL) {
|
| ︙ | |||
672 673 674 675 676 677 678 | 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 | - - - + |
#undef INVARIANT
return;
failure:
Tcl_Panic("List internal failure in %s line %d. Condition: %s",
|
| ︙ | |||
2982 2983 2984 2985 2986 2987 2988 | 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 | - - - + + + |
if ((index == TCL_SIZE_MAX) && (elemCount == 0)) {
index = 0;
}
if (index < 0 || index > elemCount
|| (valueObj == NULL && index >= elemCount)) {
/* ...the index points outside the sublist. */
if (interp != NULL) {
|
| ︙ | |||
3171 3172 3173 3174 3175 3176 3177 | 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 | - - - + + + |
}
elemCount = ListRepLength(&listRep);
/* Ensure that the index is in bounds. */
if ((index < 0) || (index >= elemCount)) {
if (interp != NULL) {
|
| ︙ |
Changes to generic/tclLoad.c.
| ︙ | |||
186 187 188 189 190 191 192 | 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | - - - + + - |
if (objc >= 3) {
prefix = TclGetString(objv[2]);
if (prefix[0] == '\0') {
prefix = NULL;
}
}
if ((fullFileName[0] == 0) && (prefix == NULL)) {
|
| ︙ | |||
251 252 253 254 255 256 257 | 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 | - + - - - + + + |
defaultPtr = libraryPtr;
}
if (filesMatch && !namesMatch && (fullFileName[0] != 0)) {
/*
* Can't have two different libraries loaded from the same file.
*/
|
| ︙ | |||
289 290 291 292 293 294 295 | 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | - - - + + + - |
if (libraryPtr == NULL) {
/*
* The desired file isn't currently loaded, so load it. It's an error
* if the desired library is a static one.
*/
if (fullFileName[0] == 0) {
|
| ︙ | |||
350 351 352 353 354 355 356 | 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | - + - - - + + + |
if (!Tcl_UniCharIsWordChar(UCHAR(ch))
|| Tcl_UniCharIsDigit(UCHAR(ch))) {
break;
}
}
if (p == pkgGuess) {
Tcl_DecrRefCount(splitPtr);
|
| ︙ | |||
447 448 449 450 451 452 453 | 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 | - + - - + + - - + - - + + - - + |
/*
* Invoke the library's initialization function (either the normal one or
* the safe one, depending on whether or not the interpreter is safe).
*/
if (Tcl_IsSafe(target)) {
if (libraryPtr->safeInitProc == NULL) {
|
| ︙ | |||
618 619 620 621 622 623 624 | 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | - - - + + - |
if (objc - i >= 2) {
prefix = TclGetString(objv[i+1]);
if (prefix[0] == '\0') {
prefix = NULL;
}
}
if ((fullFileName[0] == 0) && (prefix == NULL)) {
|
| ︙ | |||
685 686 687 688 689 690 691 | 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 706 | - + - - + + - - - - + + + - |
}
Tcl_MutexUnlock(&libraryMutex);
if (fullFileName[0] == 0) {
/*
* It's an error to try unload a static library.
*/
|
| ︙ | |||
727 728 729 730 731 732 733 | 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 | - + - - + + - |
}
}
if (code != TCL_OK) {
/*
* The library has not been loaded in this interpreter.
*/
|
| ︙ | |||
788 789 790 791 792 793 794 | 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 | - + - - + + - - + - - + + - |
* libraryPtr->unloadProc must not be NULL for the DLL to be unloadable. If
* the interpreter is a safe one, libraryPtr->safeUnloadProc must be non-NULL.
*/
if (Tcl_IsSafe(target)) {
if (libraryPtr->safeUnloadProc == NULL) {
if (!interpExiting) {
|
| ︙ | |||
955 956 957 958 959 960 961 | 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 | - + - - + + - |
Tcl_Free(iterLibraryPtr);
Tcl_MutexUnlock(&libraryMutex);
} else {
code = TCL_ERROR;
}
}
#else
|
| ︙ |
Changes to generic/tclLoadNone.c.
| ︙ | |||
42 43 44 45 46 47 48 | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | - - + + - |
Tcl_FSUnloadFileProc **unloadProcPtr,
/* Filled with address of Tcl_FSUnloadFileProc
* function which should be used for this
* file. */
int flags)
{
if (interp) {
|
| ︙ |
Changes to generic/tclMain.c.
| ︙ | |||
338 339 340 341 342 343 344 | 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | - + |
path = Tcl_GetStartupScript(&encodingName);
if (path != NULL) {
appName = path;
} else if (argv[0]) {
appName = NewNativeObj(argv[0]);
} else {
|
| ︙ | |||
497 498 499 500 501 502 503 | 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 | - + |
*/
if (Tcl_IsShared(is.commandPtr)) {
Tcl_DecrRefCount(is.commandPtr);
is.commandPtr = Tcl_DuplicateObj(is.commandPtr);
Tcl_IncrRefCount(is.commandPtr);
}
|
| ︙ | |||
769 770 771 772 773 774 775 | 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 | - + |
}
if (Tcl_IsShared(commandPtr)) {
Tcl_DecrRefCount(commandPtr);
commandPtr = Tcl_DuplicateObj(commandPtr);
Tcl_IncrRefCount(commandPtr);
}
|
| ︙ | |||
880 881 882 883 884 885 886 | 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 | - + - |
Tcl_WriteChars(chan, DEFAULT_PRIMARY_PROMPT,
sizeof(DEFAULT_PRIMARY_PROMPT) - 1);
}
}
} else {
code = Tcl_EvalObjEx(interp, promptCmdPtr, TCL_EVAL_GLOBAL);
if (code != TCL_OK) {
|
| ︙ |
Changes to generic/tclNamesp.c.
| ︙ | |||
829 830 831 832 833 834 835 | 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 | - - - - + + + + |
/*
* If we've ended up with an empty string now, we're attempting to create
* the global namespace despite the global namespace existing. That's
* naughty!
*/
if (*name == '\0') {
|
| ︙ | |||
861 862 863 864 865 866 867 | 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 | - - - - + + + + |
/*
* Check for a bad namespace name and make sure that the name does not
* already exist in the parent namespace.
*/
if (FindChildEntry(parentPtr, simpleName) != NULL) {
|
| ︙ | |||
1504 1505 1506 1507 1508 1509 1510 | 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 | - - - + + + |
* Check that the pattern doesn't have namespace qualifiers.
*/
TclGetNamespaceForQualName(interp, pattern, nsPtr, TCL_NAMESPACE_ONLY,
&exportNsPtr, &dummyPtr, &dummyPtr, &simplePattern);
if ((exportNsPtr != nsPtr) || (strcmp(pattern, simplePattern) != 0)) {
|
| ︙ | |||
1712 1713 1714 1715 1716 1717 1718 | 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 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 1749 | - - + + - - - + + + - + - - + + - + - - + + |
/*
* From the pattern, find the namespace from which we are importing and
* get the simple pattern (no namespace qualifiers or ::'s) at the end.
*/
if (strlen(pattern) == 0) {
|
| ︙ | |||
1852 1853 1854 1855 1856 1857 1858 | 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 | - + - + - + |
Command *overwrite = (Command *) Tcl_GetHashValue(found);
Command *linkCmd = cmdPtr;
while (linkCmd->deleteProc == DeleteImportedCmd) {
dataPtr = (ImportedCmdData *) linkCmd->objClientData;
linkCmd = dataPtr->realCmdPtr;
if (overwrite == linkCmd) {
|
| ︙ | |||
1898 1899 1900 1901 1902 1903 1904 | 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 | - - - + + + | /* * Repeated import of same command is acceptable. */ return TCL_OK; } } |
| ︙ | |||
1967 1968 1969 1970 1971 1972 1973 | 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 | - + - - + + |
* simple pattern.
*/
TclGetNamespaceForQualName(interp, pattern, nsPtr, TCL_NAMESPACE_ONLY,
&sourceNsPtr, &dummyPtr, &dummyPtr, &simplePattern);
if (sourceNsPtr == NULL) {
|
| ︙ | |||
2599 2600 2601 2602 2603 2604 2605 | 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 | - - - + + |
flags|TCL_FIND_ONLY_NS, &nsPtr, &dummy1Ptr, &dummy2Ptr, &dummy);
if (nsPtr != NULL) {
return (Tcl_Namespace *) nsPtr;
}
if (flags & TCL_LEAVE_ERR_MSG) {
|
| ︙ | |||
2789 2790 2791 2792 2793 2794 2795 | 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 | - - - + + |
if (cmdPtr != NULL) {
cmdPtr->flags &= ~CMD_VIA_RESOLVER;
return (Tcl_Command) cmdPtr;
}
if (flags & TCL_LEAVE_ERR_MSG) {
|
| ︙ | |||
2965 2966 2967 2968 2969 2970 2971 | 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 | - - + - + - + - + |
* namespace. */
Tcl_Namespace **nsPtrPtr) /* Result namespace pointer goes here. */
{
if (GetNamespaceFromObj(interp, objPtr, nsPtrPtr) == TCL_ERROR) {
const char *name = TclGetString(objPtr);
if ((name[0] == ':') && (name[1] == ':')) {
|
| ︙ | |||
3403 3404 3405 3406 3407 3408 3409 | 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 | - + - - - + + + |
*/
for (i = 1; i < objc; i++) {
name = TclGetString(objv[i]);
namespacePtr = Tcl_FindNamespace(interp, name, NULL, /*flags*/ 0);
if ((namespacePtr == NULL)
|| (((Namespace *) namespacePtr)->flags & NS_TEARDOWN)) {
|
| ︙ | |||
3541 3542 3543 3544 3545 3546 3547 | 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 | - + - - + - + |
word = 0;
}
/*
* TIP #280: Make invoking context available to eval'd script.
*/
|
| ︙ | |||
3966 3967 3968 3969 3970 3971 3972 | 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 | - + - |
concatObjv[0] = objv[2];
concatObjv[1] = Tcl_NewListObj(objc - 3, objv + 3);
cmdObjPtr = Tcl_ConcatObj(2, concatObjv);
Tcl_DecrRefCount(concatObjv[1]); /* We're done with the list object. */
}
|
| ︙ | |||
4033 4034 4035 4036 4037 4038 4039 | 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 | - - - - + + + + |
Tcl_DecrRefCount(resultPtr);
goto namespaceOriginError;
}
Tcl_SetObjResult(interp, resultPtr);
return TCL_OK;
namespaceOriginError:
|
| ︙ | |||
5051 5052 5053 5054 5055 5056 5057 | 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 | - - - + + + - + |
}
}
if (length < 0) {
length = strlen(command);
}
overflow = (length > limit);
|
| ︙ |
Changes to generic/tclOO.c.
| ︙ | |||
1848 1849 1850 1851 1852 1853 1854 | 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 | - + |
contextPtr->skip = skip;
/*
* Adjust the ensemble tracking record if necessary. [Bug 3514761]
*/
if (TclInitRewriteEnsemble(interp, skip, skip, objv)) {
|
| ︙ | |||
1885 1886 1887 1888 1889 1890 1891 | 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 | - + - + |
/*
* Disallow creation of an object over an existing command.
*/
hPtr = Tcl_FindHashEntry(&nsPtr->cmdTable, simpleName);
if (hPtr) {
|
| ︙ | |||
1943 1944 1945 1946 1947 1948 1949 | 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 | - - + |
/*
* Ensure an error if the object was deleted in the constructor. Don't
* want to lose errors by accident. [Bug 2903011]
*/
if (result != TCL_ERROR && Destructing(oPtr)) {
|
| ︙ | |||
2014 2015 2016 2017 2018 2019 2020 | 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 | - - + |
int result;
/*
* Sanity check.
*/
if (IsRootClass(oPtr)) {
|
| ︙ | |||
2779 2780 2781 2782 2783 2784 2785 | 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 | - + - - - + + + - + - - - + + + |
Tcl_IncrRefCount(mappedMethodName);
contextPtr = TclOOGetCallContext(oPtr, mappedMethodName,
flags | (oPtr->flags & FILTER_HANDLING), callerObjPtr,
callerClsPtr, methodNamePtr);
TclDecrRefCount(mappedMethodName);
if (contextPtr == NULL) {
|
| ︙ | |||
2823 2824 2825 2826 2827 2828 2829 | 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 | - - - - + + + - + |
continue;
}
if (miPtr->mPtr->declaringClassPtr == startCls) {
break;
}
}
if (contextPtr->index >= contextPtr->callPtr->numChain) {
|
| ︙ | |||
2905 2906 2907 2908 2909 2910 2911 | 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 | - - + |
methodType = "constructor";
} else if (contextPtr->callPtr->flags & DESTRUCTOR) {
methodType = "destructor";
} else {
methodType = "method";
}
|
| ︙ | |||
2974 2975 2976 2977 2978 2979 2980 | 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 | - - + - + |
methodType = "constructor";
} else if (contextPtr->callPtr->flags & DESTRUCTOR) {
methodType = "destructor";
} else {
methodType = "method";
}
|
| ︙ | |||
3052 3053 3054 3055 3056 3057 3058 | 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 | - - - + + + - |
if (cmdPtr == NULL || cmdPtr->objProc != TclOOPublicObjectCmd) {
goto notAnObject;
}
}
return (Tcl_Object) cmdPtr->objClientData;
notAnObject:
|
| ︙ |
Changes to generic/tclOOBasic.c.
| ︙ | |||
42 43 44 45 46 47 48 | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | - + |
* ----------------------------------------------------------------------
*/
static inline Tcl_Object *
AddConstructionFinalizer(
Tcl_Interp *interp)
{
|
| ︙ | |||
128 129 130 131 132 133 134 | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | - + - |
* Must add references or errors in configuration script will cause
* trouble.
*/
Tcl_IncrRefCount(invoke[0]);
Tcl_IncrRefCount(invoke[1]);
Tcl_IncrRefCount(invoke[2]);
|
| ︙ | |||
200 201 202 203 204 205 206 | 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 | - - + + - - + |
* Sanity check; should not be possible to invoke this method on a
* non-class.
*/
if (oPtr->classPtr == NULL) {
Tcl_Obj *cmdnameObj = TclOOObjectName(interp, oPtr);
|
| ︙ | |||
265 266 267 268 269 270 271 | 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | - - + + - - + - - + |
* Sanity check; should not be possible to invoke this method on a
* non-class.
*/
if (oPtr->classPtr == NULL) {
Tcl_Obj *cmdnameObj = TclOOObjectName(interp, oPtr);
|
| ︙ | |||
336 337 338 339 340 341 342 | 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | - - + + |
* Sanity check; should not be possible to invoke this method on a
* non-class.
*/
if (oPtr->classPtr == NULL) {
Tcl_Obj *cmdnameObj = TclOOObjectName(interp, oPtr);
|
| ︙ | |||
385 386 387 388 389 390 391 | 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 | - + - |
if (!(oPtr->flags & DESTRUCTOR_CALLED)) {
oPtr->flags |= DESTRUCTOR_CALLED;
contextPtr = TclOOGetCallContext(oPtr, NULL, DESTRUCTOR, NULL, NULL,
NULL);
if (contextPtr != NULL) {
contextPtr->callPtr->flags |= DESTRUCTOR;
contextPtr->skip = 0;
|
| ︙ | |||
480 481 482 483 484 485 486 | 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 | - + - - - + + |
}
/*
* Evaluate the script now, with FinalizeEval to do the processing after
* the script completes.
*/
|
| ︙ | |||
595 596 597 598 599 600 601 | 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 | - - - - + + + + - + - + - + - |
const char *piece;
if (contextPtr->callPtr->flags & PUBLIC_METHOD) {
piece = "visible methods";
} else {
piece = "methods";
}
|
| ︙ | |||
671 672 673 674 675 676 677 | 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 | - + - - + + |
/*
* The variable name must not contain a '::' since that's illegal in
* local names.
*/
if (strstr(varName, "::") != NULL) {
|
| ︙ | |||
703 704 705 706 707 708 709 | 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 | - + | /* * Variable cannot be an element in an array. If aryPtr is not * NULL, it is an element, so throw up an error and return. */ TclVarErrMsg(interp, varName, NULL, "define", "name refers to an element in an array"); |
| ︙ | |||
825 826 827 828 829 830 831 | 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 | - + |
}
Tcl_IncrRefCount(varNamePtr);
Tcl_Var var = (Tcl_Var) TclObjLookupVar(interp, varNamePtr, NULL,
TCL_NAMESPACE_ONLY|TCL_LEAVE_ERR_MSG, "refer to", 1, 1,
(Var **) aryPtr);
Tcl_DecrRefCount(varNamePtr);
if (var == NULL) {
|
| ︙ | |||
927 928 929 930 931 932 933 | 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 | - + - + - + |
/*
* Start with sanity checks on the calling context to make sure that we
* are invoked from a suitable method context. If so, we can safely
* retrieve the handle to the object call context.
*/
if (framePtr == NULL || !(framePtr->isProcCallFrame & FRAME_IS_METHOD)) {
|
| ︙ | |||
967 968 969 970 971 972 973 | 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 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 | - + - + - - + + - + |
/*
* Start with sanity checks on the calling context to make sure that we
* are invoked from a suitable method context. If so, we can safely
* retrieve the handle to the object call context.
*/
if (framePtr == NULL || !(framePtr->isProcCallFrame & FRAME_IS_METHOD)) {
|
| ︙ | |||
1036 1037 1038 1039 1040 1041 1042 | 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 | - + - + - + - + |
methodType = "method";
}
for (i=contextPtr->index ; i != TCL_INDEX_NONE ; i--) {
MInvoke *miPtr = &contextPtr->callPtr->chain[i];
if (!miPtr->isFilter && miPtr->mPtr->declaringClassPtr == classPtr) {
|
| ︙ | |||
1105 1106 1107 1108 1109 1110 1111 | 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 | - + - + |
((contextPtr)->callPtr->chain[(contextPtr)->index])
/*
* Start with sanity checks on the calling context and the method context.
*/
if (framePtr == NULL || !(framePtr->isProcCallFrame & FRAME_IS_METHOD)) {
|
| ︙ | |||
1141 1142 1143 1144 1145 1146 1147 | 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 | - - + - - + |
Tcl_SetObjResult(interp,
TclNewNamespaceObj(contextPtr->oPtr->namespacePtr));
return TCL_OK;
case SELF_CLASS: {
Class *clsPtr = CurrentlyInvoked(contextPtr).mPtr->declaringClassPtr;
if (clsPtr == NULL) {
|
| ︙ | |||
1188 1189 1190 1191 1192 1193 1194 | 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 | - - + - - + |
result[2] = miPtr->mPtr->namePtr;
Tcl_SetObjResult(interp, Tcl_NewListObj(3, result));
return TCL_OK;
}
case SELF_CALLER:
if ((framePtr->callerVarPtr == NULL) ||
!(framePtr->callerVarPtr->isProcCallFrame & FRAME_IS_METHOD)){
|
| ︙ | |||
1239 1240 1241 1242 1243 1244 1245 | 1228 1229 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 1258 1259 | - - + - - + |
} else if (mPtr->declaringObjectPtr != NULL) {
declarerPtr = mPtr->declaringObjectPtr;
} else {
/*
* This should be unreachable code.
*/
|
| ︙ | |||
1284 1285 1286 1287 1288 1289 1290 | 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 | - - + |
} else if (mPtr->declaringObjectPtr != NULL) {
declarerPtr = mPtr->declaringObjectPtr;
} else {
/*
* This should be unreachable code.
*/
|
| ︙ | |||
1364 1365 1366 1367 1368 1369 1370 | 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 | - - + + |
if (objc == 4) {
namespaceName = TclGetString(objv[3]);
if (namespaceName[0] == '\0') {
namespaceName = NULL;
} else if (Tcl_FindNamespace(interp, namespaceName, NULL,
0) != NULL) {
|
| ︙ |
Changes to generic/tclOOCall.c.
| ︙ | |||
353 354 355 356 357 358 359 | 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 | - + - - + - + | } /* * Add a callback to ensure that method references are dropped once * this call is finished. */ |
| ︙ |
Changes to generic/tclOODefineCmds.c.
| ︙ | |||
698 699 700 701 702 703 704 | 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 | - - - - + + + + - - + - + - + |
Tcl_HashEntry *hPtr, *newHPtr = NULL;
Method *mPtr;
int isNew;
if (!useClass) {
if (!oPtr->methodsPtr) {
noSuchMethod:
|
| ︙ | |||
788 789 790 791 792 793 794 | 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 | - - + |
{
Namespace *nsPtr = (Namespace *) Tcl_GetCurrentNamespace(interp);
FOREACH_HASH_DECLS;
Tcl_Size soughtLen;
const char *soughtStr, *nameStr, *matchedStr = NULL;
if (objc < 2) {
|
| ︙ | |||
831 832 833 834 835 836 837 | 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 | - - - + + |
result = Tcl_EvalObjv(interp, objc - 1, newObjv, 0);
Tcl_DecrRefCount(newObjv[0]);
TclStackFree(interp, newObjv);
return result;
}
noMatch:
|
| ︙ | |||
921 922 923 924 925 926 927 | 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 | - - + |
Object *oPtr,
int objc,
Tcl_Obj *const objv[])
{
CallFrame *framePtr, **framePtrPtr = &framePtr;
if (namespacePtr == NULL) {
|
| ︙ | |||
961 962 963 964 965 966 967 | 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 | - + - + - - + - + - - + |
{
Interp *iPtr = (Interp *) interp;
Tcl_Object object;
if ((iPtr->varFramePtr == NULL)
|| (iPtr->varFramePtr->isProcCallFrame != FRAME_IS_OO_DEFINE
&& iPtr->varFramePtr->isProcCallFrame != PRIVATE_FRAME)) {
|
| ︙ | |||
1033 1034 1035 1036 1037 1038 1039 | 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 | - - + + |
oPtr = (Object *) Tcl_GetObjectFromObj(interp, className);
iPtr->varFramePtr = savedFramePtr;
if (oPtr == NULL) {
return NULL;
}
if (oPtr->classPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(errMsg, TCL_AUTO_LENGTH));
|
| ︙ | |||
1098 1099 1100 1101 1102 1103 1104 | 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 | - + - + |
Tcl_Size length;
Tcl_Obj *realNameObj = Tcl_ObjectDeleted((Tcl_Object) oPtr)
? savedNameObj : TclOOObjectName(interp, oPtr);
const char *objName = TclGetStringFromObj(realNameObj, &length);
int limit = OBJNAME_LENGTH_IN_ERRORINFO_LIMIT;
int overflow = (length > limit);
|
| ︙ | |||
1207 1208 1209 1210 1211 1212 1213 | 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 | - - - - + + + + |
}
oPtr = (Object *) Tcl_GetObjectFromObj(interp, objv[1]);
if (oPtr == NULL) {
return TCL_ERROR;
}
if (oPtr->classPtr == NULL) {
|
| ︙ | |||
1530 1531 1532 1533 1534 1535 1536 | 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 | - - + + - - - + + - - - + + - |
*/
oPtr = (Object *) TclOOGetDefineCmdContext(interp);
if (oPtr == NULL) {
return TCL_ERROR;
}
if (oPtr->flags & ROOT_OBJECT) {
|
| ︙ | |||
1700 1701 1702 1703 1704 1705 1706 | 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 | - - + + - |
Class *clsPtr = TclOOGetClassDefineCmdContext(interp);
Tcl_Namespace *nsPtr;
Tcl_Obj *nsNamePtr, **storagePtr;
if (clsPtr == NULL) {
return TCL_ERROR;
} else if (clsPtr->thisPtr->flags & (ROOT_OBJECT | ROOT_CLASS)) {
|
| ︙ | |||
1778 1779 1780 1781 1782 1783 1784 | 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 | - - + |
}
oPtr = (Object *) TclOOGetDefineCmdContext(interp);
if (oPtr == NULL) {
return TCL_ERROR;
}
if (!isInstanceDeleteMethod && !oPtr->classPtr) {
|
| ︙ | |||
1900 1901 1902 1903 1904 1905 1906 | 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 | - - + |
oPtr = (Object *) TclOOGetDefineCmdContext(interp);
if (oPtr == NULL) {
return TCL_ERROR;
}
clsPtr = oPtr->classPtr;
if (!isInstanceExport && !clsPtr) {
|
| ︙ | |||
1995 1996 1997 1998 1999 2000 2001 | 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 | - - + |
}
oPtr = (Object *) TclOOGetDefineCmdContext(interp);
if (oPtr == NULL) {
return TCL_ERROR;
}
if (!isInstanceForward && !oPtr->classPtr) {
|
| ︙ | |||
2073 2074 2075 2076 2077 2078 2079 | 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 | - - + |
}
oPtr = (Object *) TclOOGetDefineCmdContext(interp);
if (oPtr == NULL) {
return TCL_ERROR;
}
if (!isInstanceMethod && !oPtr->classPtr) {
|
| ︙ | |||
2152 2153 2154 2155 2156 2157 2158 | 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 | - - + |
}
oPtr = (Object *) TclOOGetDefineCmdContext(interp);
if (oPtr == NULL) {
return TCL_ERROR;
}
if (!isInstanceRenameMethod && !oPtr->classPtr) {
|
| ︙ | |||
2214 2215 2216 2217 2218 2219 2220 | 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 | - - + |
oPtr = (Object *) TclOOGetDefineCmdContext(interp);
if (oPtr == NULL) {
return TCL_ERROR;
}
clsPtr = oPtr->classPtr;
if (!isInstanceUnexport && !clsPtr) {
|
| ︙ | |||
2539 2540 2541 2542 2543 2544 2545 | 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 | - - + - - - + |
"may only mix in classes");
if (mixins[i] == NULL) {
i--;
goto freeAndError;
}
(void) Tcl_CreateHashEntry(&uniqueCheck, (void *) mixins[i], &isNew);
if (!isNew) {
|
| ︙ | |||
2630 2631 2632 2633 2634 2635 2636 | 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 | - - + + - |
"superclassList");
return TCL_ERROR;
}
objv += Tcl_ObjectContextSkippedArgs(context);
Foundation *fPtr = clsPtr->thisPtr->fPtr;
if (clsPtr == fPtr->objectCls) {
|
| ︙ | |||
2671 2672 2673 2674 2675 2676 2677 | 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 | - - + + - - - + + - |
superclasses[i] = GetClassInOuterContext(interp, superv[i],
"only a class can be a superclass");
if (superclasses[i] == NULL) {
goto failedAfterAlloc;
}
for (j = 0; j < i; j++) {
if (superclasses[j] == superclasses[i]) {
|
| ︙ | |||
2803 2804 2805 2806 2807 2808 2809 | 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 | - + - + - + - + |
return TCL_ERROR;
}
for (i = 0; i < varc; i++) {
const char *varName = TclGetString(varv[i]);
if (strstr(varName, "::") != NULL) {
|
| ︙ | |||
2978 2979 2980 2981 2982 2983 2984 | 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 | - - + + - |
mixins[i] = GetClassInOuterContext(interp, mixinv[i],
"may only mix in classes");
if (mixins[i] == NULL) {
goto freeAndError;
}
(void) Tcl_CreateHashEntry(&uniqueCheck, (void *) mixins[i], &isNew);
if (!isNew) {
|
| ︙ | |||
3074 3075 3076 3077 3078 3079 3080 | 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 | - + - + - + - + |
return TCL_ERROR;
}
for (i = 0; i < varc; i++) {
const char *varName = TclGetString(varv[i]);
if (strstr(varName, "::") != NULL) {
|
| ︙ |
Changes to generic/tclOOInfo.c.
| ︙ | |||
162 163 164 165 166 167 168 | 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | - - - - + + + + |
{
Object *oPtr = (Object *) Tcl_GetObjectFromObj(interp, objPtr);
if (oPtr == NULL) {
return NULL;
}
if (oPtr->classPtr == NULL) {
|
| ︙ | |||
300 301 302 303 304 305 306 | 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | - - - + + - - - + + - - + - |
return TCL_OK;
/*
* Errors...
*/
unknownMethod:
|
| ︙ | |||
409 410 411 412 413 414 415 | 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 | - - - + + + - - - + + - - + - |
return TCL_OK;
/*
* Errors...
*/
unknownMethod:
|
| ︙ | |||
613 614 615 616 617 618 619 | 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 | - - - + + - |
flag = PRIVATE_METHOD;
break;
case OPT_PRIVATE:
flag = 0;
break;
case OPT_SCOPE:
if (++i >= objc) {
|
| ︙ | |||
739 740 741 742 743 744 745 | 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 | - - - + + - |
}
Tcl_SetObjResult(interp,
Tcl_NewStringObj(mPtr->typePtr->name, TCL_AUTO_LENGTH));
return TCL_OK;
unknownMethod:
|
| ︙ | |||
881 882 883 884 885 886 887 | 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 | - + - + |
if (objc != 2 && objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "objName ?-private?");
return TCL_ERROR;
}
if (objc == 3) {
if (strcmp("-private", TclGetString(objv[2])) != 0) {
|
| ︙ | |||
1008 1009 1010 1011 1012 1013 1014 | 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 | - - + + - |
return TCL_ERROR;
}
if (clsPtr->constructorPtr == NULL) {
return TCL_OK;
}
procPtr = TclOOGetProcFromMethod(clsPtr->constructorPtr);
if (procPtr == NULL) {
|
| ︙ | |||
1067 1068 1069 1070 1071 1072 1073 | 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 | - - - + + + - - - + + - - + - |
}
clsPtr = TclOOGetClassFromObj(interp, objv[1]);
if (clsPtr == NULL) {
return TCL_ERROR;
}
hPtr = Tcl_FindHashEntry(&clsPtr->classMethods, objv[2]);
if (hPtr == NULL) {
|
| ︙ | |||
1186 1187 1188 1189 1190 1191 1192 | 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 | - - + + - |
}
if (clsPtr->destructorPtr == NULL) {
return TCL_OK;
}
procPtr = TclOOGetProcFromMethod(clsPtr->destructorPtr);
if (procPtr == NULL) {
|
| ︙ | |||
1266 1267 1268 1269 1270 1271 1272 | 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 | - - - + + + - - - + + - - + - |
}
clsPtr = TclOOGetClassFromObj(interp, objv[1]);
if (clsPtr == NULL) {
return TCL_ERROR;
}
hPtr = Tcl_FindHashEntry(&clsPtr->classMethods, objv[2]);
if (hPtr == NULL) {
|
| ︙ | |||
1397 1398 1399 1400 1401 1402 1403 | 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 | - - - + + - |
flag = PRIVATE_METHOD;
break;
case OPT_PRIVATE:
flag = 0;
break;
case OPT_SCOPE:
if (++i >= objc) {
|
| ︙ | |||
1512 1513 1514 1515 1516 1517 1518 | 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 | - - - + + - |
goto unknownMethod;
}
Tcl_SetObjResult(interp,
Tcl_NewStringObj(mPtr->typePtr->name, TCL_AUTO_LENGTH));
return TCL_OK;
unknownMethod:
|
| ︙ | |||
1683 1684 1685 1686 1687 1688 1689 | 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 | - + - + |
if (objc != 2 && objc != 3) {
Tcl_WrongNumArgs(interp, 1, objv, "className ?-private?");
return TCL_ERROR;
}
if (objc == 3) {
if (strcmp("-private", TclGetString(objv[2])) != 0) {
|
| ︙ | |||
1750 1751 1752 1753 1754 1755 1756 | 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 | - - + |
/*
* Get the call context and render its call chain.
*/
contextPtr = TclOOGetCallContext(oPtr, objv[2], PUBLIC_METHOD, NULL, NULL,
NULL);
if (contextPtr == NULL) {
|
| ︙ | |||
1796 1797 1798 1799 1800 1801 1802 | 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 | - - + |
/*
* Get an render the stereotypical call chain.
*/
callPtr = TclOOGetStereotypeCallChain(clsPtr, objv[2], PUBLIC_METHOD);
if (callPtr == NULL) {
|
| ︙ |
Changes to generic/tclOOInt.h.
| ︙ | |||
710 711 712 713 714 715 716 | 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 | - + |
} \
} while(0)
/*
* Convenience macro for generating error codes.
*/
#define OO_ERROR(interp, code) \
|
| ︙ |
Changes to generic/tclOOMethod.c.
| ︙ | |||
883 884 885 886 887 888 889 | 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 | - + |
}
}
/*
* Now invoke the body of the method.
*/
|
| ︙ | |||
1323 1324 1325 1326 1327 1328 1329 | 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 | - + - + - - + - + |
} else {
objectName = "unknown or deleted";
objectNameLen = 18;
}
if (!special) {
Tcl_Size nameLen;
const char *methodName = TclGetStringFromObj(mPtr->namePtr, &nameLen);
|
| ︙ | |||
1489 1490 1491 1492 1493 1494 1495 | 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 | - - + |
Tcl_Size prefixLen;
ForwardMethod *fmPtr;
if (TclListObjLength(interp, prefixObj, &prefixLen) != TCL_OK) {
return NULL;
}
if (prefixLen < 1) {
|
| ︙ | |||
1528 1529 1530 1531 1532 1533 1534 | 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 | - - + |
Tcl_Size prefixLen;
ForwardMethod *fmPtr;
if (TclListObjLength(interp, prefixObj, &prefixLen) != TCL_OK) {
return NULL;
}
if (prefixLen < 1) {
|
| ︙ | |||
1576 1577 1578 1579 1580 1581 1582 | 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 | - + |
* non-empty list, so there's a whole class of failures ("not a list") we
* can ignore here.
*/
TclListObjGetElements(NULL, fmPtr->prefixObj, &numPrefixes, &prefixObjs);
argObjs = InitEnsembleRewrite(interp, objc, objv, skip,
numPrefixes, prefixObjs, &len);
|
| ︙ | |||
1734 1735 1736 1737 1738 1739 1740 | 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 | - + |
* how to store the rewrite rules get complex solely because of the case
* where an ensemble rewrites itself out of the picture; when that
* happens, the quality of the error message rewrite falls drastically
* (and unavoidably).
*/
if (TclInitRewriteEnsemble(interp, toRewrite, rewriteLength, objv)) {
|
| ︙ |
Changes to generic/tclOOProp.c.
| ︙ | |||
105 106 107 108 109 110 111 | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | - - + + - - + + |
Tcl_IncrRefCount(args[0]);
Tcl_IncrRefCount(args[1]);
code = TclOOPrivateObjectCmd(oPtr, interp, 2, args);
Tcl_DecrRefCount(args[0]);
Tcl_DecrRefCount(args[1]);
switch (code) {
case TCL_BREAK:
|
| ︙ | |||
140 141 142 143 144 145 146 | 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | - - + + - - + + |
Tcl_IncrRefCount(args[2]);
code = TclOOPrivateObjectCmd(oPtr, interp, 3, args);
Tcl_DecrRefCount(args[0]);
Tcl_DecrRefCount(args[1]);
Tcl_DecrRefCount(args[2]);
switch (code) {
case TCL_BREAK:
|
| ︙ | |||
212 213 214 215 216 217 218 | 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | - + - + |
*/
Tcl_InterpState foo = Tcl_SaveInterpState(interp, result);
Tcl_Obj *otherName = GetPropertyName(interp, oPtr,
flags ^ (GPN_WRITABLE | GPN_FALLING_BACK), namePtr, NULL);
result = Tcl_RestoreInterpState(interp, foo);
if (otherName != NULL) {
|
| ︙ | |||
1003 1004 1005 1006 1007 1008 1009 | 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 | - - + |
return TCL_ERROR;
}
ImplementClassProperty(cls, propName, readable, writable);
}
return TCL_OK;
badProp:
|
| ︙ | |||
1046 1047 1048 1049 1050 1051 1052 | 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 | - - + |
};
Object *oPtr = (Object *) TclOOGetDefineCmdContext(interp);
if (oPtr == NULL) {
return TCL_ERROR;
}
if (!useInstance && !oPtr->classPtr) {
|
| ︙ | |||
1073 1074 1075 1076 1077 1078 1079 | 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 | - + - - + + |
break;
}
if (Tcl_GetIndexFromObj(interp, nextObj, options, "option", 0,
&option) != TCL_OK) {
return TCL_ERROR;
}
if (i + 2 >= objc) {
|
| ︙ |
Changes to generic/tclObj.c.
| ︙ | |||
943 944 945 946 947 948 949 | 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 | - - - + + + |
* Use the target type's Tcl_SetFromAnyProc to set "objPtr"s internal form
* as appropriate for the target type. This frees the old internal
* representation.
*/
if (typePtr->setFromAnyProc == NULL) {
if (interp) {
|
| ︙ | |||
2064 2065 2066 2067 2068 2069 2070 | 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 | + - - + + |
}
/* Handle dict separately, because it doesn't have a lengthProc */
if (TclHasInternalRep(objPtr, &tclDictType)) {
Tcl_DictObjSize(NULL, objPtr, &length);
if (length > 0) {
listRep:
if (interp) {
TclPrintfResult(interp,
|
| ︙ | |||
2150 2151 2152 2153 2154 2155 2156 | 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 | - + - + |
if (interp != NULL) {
Tcl_Size length;
const char *str = Tcl_GetStringFromObj(objPtr, &length);
Tcl_Obj *msg;
TclNewLiteralStringObj(msg, "expected boolean value but got \"");
Tcl_AppendLimitedToObj(msg, str, length, 50, "");
|
| ︙ | |||
2439 2440 2441 2442 2443 2444 2445 | 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 | - - - + + + - |
double *dblPtr) /* Place to store resulting double. */
{
Tcl_Size length;
do {
if (TclHasInternalRep(objPtr, &tclDoubleType)) {
if (isnan(objPtr->internalRep.doubleValue)) {
if (interp != NULL) {
|
| ︙ | |||
2466 2467 2468 2469 2470 2471 2472 | 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 | - - + + |
}
/* Handle dict separately, because it doesn't have a lengthProc */
if (TclHasInternalRep(objPtr, &tclDictType)) {
Tcl_DictObjSize(NULL, objPtr, &length);
if (length > 0) {
listRep:
if (interp) {
|
| ︙ | |||
2586 2587 2588 2589 2590 2591 2592 | 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 | - - - - + + + |
long l;
if (TclGetLongFromObj(interp, objPtr, &l) != TCL_OK) {
return TCL_ERROR;
}
if ((ULONG_MAX > UINT_MAX) && ((l > UINT_MAX) || (l < INT_MIN))) {
if (interp != NULL) {
|
| ︙ | |||
2709 2710 2711 2712 2713 2714 2715 | 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 | - + - - + + |
return TCL_OK;
}
goto tooLarge;
}
#endif
if (TclHasInternalRep(objPtr, &tclDoubleType)) {
if (interp != NULL) {
|
| ︙ | |||
2753 2754 2755 2756 2757 2758 2759 | 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 | - - - + + - + |
}
}
#ifndef TCL_WIDE_INT_IS_LONG
tooLarge:
#endif
if (interp != NULL) {
const char *s = "integer value too large to represent";
|
| ︙ | |||
3033 3034 3035 3036 3037 3038 3039 | 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 | - + - - + + |
do {
if (TclHasInternalRep(objPtr, &tclIntType)) {
*wideIntPtr = objPtr->internalRep.wideValue;
return TCL_OK;
}
if (TclHasInternalRep(objPtr, &tclDoubleType)) {
if (interp != NULL) {
|
| ︙ | |||
3071 3072 3073 3074 3075 3076 3077 | 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 | - - - + + - + |
*wideIntPtr = (Tcl_WideInt)value;
return TCL_OK;
}
}
}
if (interp != NULL) {
const char *s = "integer value too large to represent";
|
| ︙ | |||
3131 3132 3133 3134 3135 3136 3137 | 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 | - + - - + + |
/* Place to store resulting long. */
{
do {
if (TclHasInternalRep(objPtr, &tclIntType)) {
if (objPtr->internalRep.wideValue < 0) {
wideUIntOutOfRange:
if (interp != NULL) {
|
| ︙ | |||
3170 3171 3172 3173 3174 3175 3176 | 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 | - - - + + |
}
*wideUIntPtr = (Tcl_WideUInt)value;
return TCL_OK;
}
if (interp != NULL) {
const char *s = "integer value too large to represent";
|
| ︙ | |||
3217 3218 3219 3220 3221 3222 3223 | 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 | - + - - + + |
do {
if (TclHasInternalRep(objPtr, &tclIntType)) {
*wideIntPtr = objPtr->internalRep.wideValue;
return TCL_OK;
}
if (TclHasInternalRep(objPtr, &tclDoubleType)) {
if (interp != NULL) {
|
| ︙ | |||
3541 3542 3543 3544 3545 3546 3547 | 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 | - + - - + + |
objPtr->internalRep.wideValue) != MP_OKAY) {
return TCL_ERROR;
}
return TCL_OK;
}
if (TclHasInternalRep(objPtr, &tclDoubleType)) {
if (interp != NULL) {
|
| ︙ | |||
3773 3774 3775 3776 3777 3778 3779 | 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 | - + |
}
/* Handle dict separately, because it doesn't have a lengthProc */
if (TclHasInternalRep(objPtr, &tclDictType)) {
Tcl_DictObjSize(NULL, objPtr, &length);
if (length > 0) {
listRep:
if (interp) {
|
| ︙ | |||
3810 3811 3812 3813 3814 3815 3816 | 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 | - - - + + + |
numBytes = 0;
}
if (numBytes < 0) {
numBytes = strlen(bytes);
}
if (numBytes > INT_MAX) {
if (interp) {
|
| ︙ | |||
4746 4747 4748 4749 4750 4751 4752 | 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 | - + - + - + |
Tcl_AppendPrintfToObj(descObj, ", internal representation %p:%p",
(void *) objv[1]->internalRep.twoPtrValue.ptr1,
(void *) objv[1]->internalRep.twoPtrValue.ptr2);
}
}
if (objv[1]->bytes) {
|
| ︙ |
Changes to generic/tclParse.c.
| ︙ | |||
223 224 225 226 227 228 229 | 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | - - + |
if (numBytes < 0 && start) {
numBytes = strlen(start);
}
TclParseInit(interp, start, numBytes, parsePtr);
if ((start == NULL) && (numBytes != 0)) {
if (interp != NULL) {
|
| ︙ | |||
277 278 279 280 281 282 283 | 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | - - + + - - + + |
}
/* Are we missing white space after previous word? */
if (scanned == 0) {
if (src[-1] == '"') {
if (interp != NULL) {
|
| ︙ | |||
1157 1158 1159 1160 1161 1162 1163 | 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 | - - + + |
if ((nestedPtr->term < parsePtr->end)
&& (*(nestedPtr->term) == ']')
&& !(nestedPtr->incomplete)) {
break;
}
if (numBytes == 0) {
if (parsePtr->interp != NULL) {
|
| ︙ | |||
1403 1404 1405 1406 1407 1408 1409 | 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 | - - + + |
}
numBytes--;
src++;
ch= *src;
}
if (numBytes == 0) {
if (parsePtr->interp != NULL) {
|
| ︙ | |||
1461 1462 1463 1464 1465 1466 1467 | 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 | - + - - - + + |
if (TCL_OK != ParseTokens(src+1, numBytes-1, TYPE_BAD_ARRAY_INDEX,
TCL_SUBST_ALL, parsePtr)) {
goto error;
}
if (parsePtr->term == src+numBytes){
if (parsePtr->interp != NULL) {
|
| ︙ | |||
1742 1743 1744 1745 1746 1747 1748 | 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 | - - + |
* Skip straight to the exit code since we have no interpreter to put
* error message in.
*/
goto error;
}
|
| ︙ | |||
1766 1767 1768 1769 1770 1771 1772 | 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 | - + + |
break;
case '\n':
openBrace = 0;
break;
case '#' :
if (openBrace && TclIsSpaceProcM(src[-1])) {
Tcl_AppendToObj(Tcl_GetObjResult(parsePtr->interp),
|
| ︙ | |||
1844 1845 1846 1847 1848 1849 1850 | 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 | - + - |
if (TCL_OK != ParseTokens(start+1, numBytes-1, TYPE_QUOTE, TCL_SUBST_ALL,
parsePtr)) {
goto error;
}
if (*parsePtr->term != '"') {
if (parsePtr->interp != NULL) {
|
| ︙ |
Changes to generic/tclPathObj.c.
| ︙ | |||
415 416 417 418 419 420 421 | 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 | - + |
}
if (needTrailingSlash) {
if (Tcl_IsShared(retVal)) {
TclDecrRefCount(retVal);
retVal = Tcl_DuplicateObj(retVal);
Tcl_IncrRefCount(retVal);
}
|
| ︙ | |||
1350 1351 1352 1353 1354 1355 1356 | 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 | - + |
* of no evidence that such a foolish thing exists. This solution was
* chosen so that "JoinPath" operations that pass through either path
* internalrep produce the same results; that is, bugward compatibility. If
* we need to fix that bug here, it needs fixing in TclJoinPath() too.
*/
bytes = TclGetStringFromObj(tail, &length);
if (length == 0) {
|
| ︙ | |||
2483 2484 2485 2486 2487 2488 2489 | 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 | - - + + - - + - - - - + + - |
if (user == NULL || user[0] == 0) {
/* No user name specified -> current user */
dir = TclGetEnv("HOME", &dirString);
if (dir == NULL) {
if (interp) {
|
| ︙ |
Changes to generic/tclPipe.c.
| ︙ | |||
102 103 104 105 106 107 108 | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | - + - - + + - |
if (file == NULL) {
Tcl_Obj *msg;
Tcl_GetChannelError(chan, &msg);
if (msg) {
Tcl_SetObjResult(interp, msg);
} else {
|
| ︙ | |||
138 139 140 141 142 143 144 | 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 | - + - + - - - + + + |
name = Tcl_TranslateFileName(interp, spec, &nameString);
if (name == NULL) {
return NULL;
}
file = TclpOpenFile(name, flags);
Tcl_DStringFree(&nameString);
if (file == NULL) {
|
| ︙ | |||
336 337 338 339 340 341 342 | 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 | - + - + - - + |
Tcl_Seek(errorChan, 0, SEEK_SET);
TclNewObj(objPtr);
count = Tcl_ReadChars(errorChan, objPtr, TCL_INDEX_NONE, 0);
if (count == -1) {
result = TCL_ERROR;
Tcl_DecrRefCount(objPtr);
Tcl_ResetResult(interp);
|
| ︙ | |||
507 508 509 510 511 512 513 | 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 | - - - - + + + + |
switch (*p++) {
case '|':
if (*p == '&') {
p++;
}
if (*p == '\0') {
if ((i == (lastBar + 1)) || (i == (argc - 1))) {
|
| ︙ | |||
535 536 537 538 539 540 541 | 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 | - + - - - + + + |
if (*p == '<') {
inputFile = NULL;
inputLiteral = p + 1;
skip = 1;
if (*inputLiteral == '\0') {
inputLiteral = ((i + 1) == argc) ? NULL : argv[i + 1];
if (inputLiteral == NULL) {
|
| ︙ | |||
652 653 654 655 656 657 658 | 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | - + - - - + + + |
/*
* Special case handling of 2>@1 to redirect stderr to the
* exec/open output pipe as well. This is meant for the end of
* the command string, otherwise use |& between commands.
*/
if (i != argc-1) {
|
| ︙ | |||
695 696 697 698 699 700 701 | 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 | - - - + + - - + - + - + - + |
}
if (needCmd) {
/*
* We had a bar followed only by redirections.
*/
|
| ︙ | |||
754 755 756 757 758 759 760 | 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 | - + - + |
if (outPipePtr != NULL) {
/*
* Output from the last process in the pipeline is to go to a pipe
* that can be read by the caller.
*/
if (TclpCreatePipe(outPipePtr, &outputFile) == 0) {
|
| ︙ | |||
794 795 796 797 798 799 800 | 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 | - + - + |
* cause the pipeline to deadlock: we'd be waiting for processes
* to complete before reading stderr, and processes couldn't
* complete because stderr was backed up.
*/
errorFile = TclpCreateTempFile(NULL);
if (errorFile == NULL) {
|
| ︙ | |||
867 868 869 870 871 872 873 | 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 | - - + + |
*/
if (lastArg == argc) {
curOutFile = outputFile;
} else {
argv[lastArg] = NULL;
if (TclpCreatePipe(&pipeIn, &curOutFile) == 0) {
|
| ︙ | |||
1048 1049 1050 1051 1052 1053 1054 | 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 | - + - - + + - - + - - + + - - - - + + + |
/*
* Verify that the pipes that were created satisfy the readable/writable
* constraints.
*/
if (flags & TCL_ENFORCE_MODE) {
if ((flags & TCL_STDOUT) && (outPipe == NULL)) {
|
| ︙ |
Changes to generic/tclPkg.c.
| ︙ | |||
185 186 187 188 189 190 191 | 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | - + - - + + |
if (res == 0) {
if (clientData != NULL) {
pkgPtr->clientData = clientData;
}
return TCL_OK;
}
|
| ︙ | |||
382 383 384 385 386 387 388 | 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 | - + - - + + - + | * * Trouble is that's going to be tricky. We're now using a Tcl library * that's not fully initialized. Functions in it may not work * reliably, so be very careful about adding any other calls here * without checking how they behave when initialization is incomplete. */ |
| ︙ | |||
445 446 447 448 449 450 451 | 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 | - - + + - - + - - - + + - - + + |
void *clientData,
Tcl_Interp *interp,
int reqc,
Tcl_Obj *const reqv[])
{
RequireProcArgs *args = (RequireProcArgs *)clientData;
|
| ︙ | |||
501 502 503 504 505 506 507 | 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 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 | - - + + - - + + - - + + - - - + + - + - - + - - - + + - + - - + + - |
/*
* If we've got the package in the DB already, go on to actually loading
* it.
*/
if (reqPtr->pkgPtr->version != NULL) {
|
| ︙ | |||
657 658 659 660 661 662 663 | 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 | - + - + - + |
/*
* Check whether we're already attempting to load some version of this
* package (circular dependency detection).
*/
if (pkgPtr->clientData != NULL) {
|
| ︙ | |||
797 798 799 800 801 802 803 | 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 | - - + + |
if ((iPtr->packagePrefer == PKG_PREFER_STABLE)
&& (bestStablePtr != NULL)) {
bestPtr = bestStablePtr;
}
if (bestPtr == NULL) {
|
| ︙ | |||
828 829 830 831 832 833 834 | 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 | - - + + |
pkgName->nextPtr = pkgFiles->names;
strcpy(pkgName->name, name);
pkgFiles->names = pkgName;
if (bestPtr->pkgIndex) {
TclPkgFileSeen(interp, bestPtr->pkgIndex);
}
reqPtr->versionToProvide = versionToProvide;
|
| ︙ | |||
863 864 865 866 867 868 869 | 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 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 | - + - - + + - - + - - + + - - + - - + + - - - + + |
Tcl_Free(pkgName);
reqPtr->pkgPtr = FindPackage(interp, name);
if (result == TCL_OK) {
Tcl_ResetResult(interp);
if (reqPtr->pkgPtr->version == NULL) {
result = TCL_ERROR;
|
| ︙ | |||
935 936 937 938 939 940 941 | 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 | - - + + |
Tcl_DecrRefCount(reqPtr->pkgPtr->version);
reqPtr->pkgPtr->version = NULL;
}
reqPtr->pkgPtr->clientData = NULL;
return result;
}
|
| ︙ | |||
1009 1010 1011 1012 1013 1014 1015 | 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 | - + - - - + - - + - + |
* calling Tcl_PkgRequireEx() to check for us.
*/
const char *foundVersion = Tcl_PkgRequireEx(interp, name, version,
exact, clientDataPtr);
if (foundVersion == NULL) {
|
| ︙ | |||
1346 1347 1348 1349 1350 1351 1352 | 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 | - + - - - + + + - + | } /* * Create a new-style requirement for the exact version. */ ov = Tcl_NewStringObj(version, -1); |
| ︙ | |||
1382 1383 1384 1385 1386 1387 1388 | 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 | - - - - + + + + - | * so duplicate them. */ Tcl_ListObjAppendElement(interp, objvListPtr, Tcl_DuplicateObj(newobjv[i])); } TclListObjGetElements(interp, objvListPtr, &newobjc, &newObjvPtr); |
| ︙ | |||
1746 1747 1748 1749 1750 1751 1752 | 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 | - - - + + + |
*stable = !hasunstable;
}
return TCL_OK;
}
error:
Tcl_Free(ibuf);
|
| ︙ | |||
2009 2010 2011 2012 2013 2014 2015 | 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 | - - - + + + |
}
if (strchr(dash+1, '-') != NULL) {
/*
* More dashes found after the first. This is wrong.
*/
|
| ︙ |
Changes to generic/tclProc.c.
| ︙ | |||
181 182 183 184 185 186 187 | 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 | - + - - + + - + - - + + - + - - - + |
*/
procName = TclGetString(objv[1]);
TclGetNamespaceForQualName(interp, procName, NULL, 0,
&nsPtr, &altNsPtr, &cxtNsPtr, &simpleName);
if (nsPtr == NULL) {
|
| ︙ | |||
494 495 496 497 498 499 500 | 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 | - + - - - + + + - |
result = TclListObjGetElements(interp, argsPtr, &numArgs, &argArray);
if (result != TCL_OK) {
goto procError;
}
if (precompiled) {
if (numArgs > procPtr->numArgs) {
|
| ︙ | |||
523 524 525 526 527 528 529 | 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 | - - - + + + - - - - + + - - - - + + + - + - - - + + + - - - + + + - - - - + + |
result = TclListObjGetElements(interp, argArray[i], &fieldCount,
&fieldValues);
if (result != TCL_OK) {
goto procError;
}
if (fieldCount > 2) {
|
| ︙ | |||
589 590 591 592 593 594 595 | 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 | - + - - - + + + - - + + - - - + - - - + + + |
if ((localPtr->nameLength != nameLength)
|| (memcmp(localPtr->name, argname, nameLength) != 0)
|| (localPtr->frameIndex != i)
|| !(localPtr->flags & VAR_ARGUMENT)
|| (localPtr->defValuePtr == NULL && fieldCount == 2)
|| (localPtr->defValuePtr != NULL && fieldCount != 2)) {
|
| ︙ | |||
842 843 844 845 846 847 848 | 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 | - - + + |
}
}
}
badLevel:
if (name == NULL) {
name = objPtr ? TclGetString(objPtr) : "1" ;
}
|
| ︙ | |||
873 874 875 876 877 878 879 | 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 | - - + + |
void *data[],
Tcl_Interp *interp,
int result)
{
CallFrame *savedVarFramePtr = (CallFrame *)data[0];
if (result == TCL_ERROR) {
|
| ︙ | |||
981 982 983 984 985 986 987 | 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 | - + - |
* between, then evaluate the result. Tcl_EvalObjEx will delete the
* object when it decrements its refcount after eval'ing it.
*/
objPtr = Tcl_ConcatObj(objc, objv);
}
|
| ︙ | |||
1079 1080 1081 1082 1083 1084 1085 | 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 1093 1094 1095 1096 1097 | - + - + - |
*/
numArgs = framePtr->procPtr->numArgs;
desiredObjs = (Tcl_Obj **)TclStackAlloc(interp,
sizeof(Tcl_Obj *) * (numArgs+1));
if (framePtr->isProcCallFrame & FRAME_IS_LAMBDA) {
|
| ︙ | |||
1476 1477 1478 1479 1480 1481 1482 | 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 | - + |
/*
* Initialise all compiled locals to avoid problems at DeleteLocalVars.
*/
incorrectArgs:
if ((skip != 1) &&
TclInitRewriteEnsemble(interp, skip-1, 0, framePtr->objv)) {
|
| ︙ | |||
1777 1778 1779 1780 1781 1782 1783 | 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 | - + - |
/*
* Invoke the commands in the procedure's body.
*/
procPtr->refCount++;
ByteCodeGetInternalRep(procPtr->bodyPtr, &tclByteCodeType, codePtr);
|
| ︙ | |||
1854 1855 1856 1857 1858 1859 1860 | 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 | - + - - + + |
case TCL_CONTINUE:
case TCL_BREAK:
/*
* It's an error to get to this point from a 'break' or 'continue', so
* transform to an error now.
*/
|
| ︙ | |||
1937 1938 1939 1940 1941 1942 1943 | 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 | - - - - + + + + |
&& (codePtr->nsEpoch == nsPtr->resolverEpoch)
&& ((codePtr->procPtr == procPtr) || !bodyPtr->bytes)) {
return TCL_OK;
}
if (codePtr->flags & TCL_BYTECODE_PRECOMPILED) {
if ((Interp *) *codePtr->interpHandle != iPtr) {
|
| ︙ | |||
1965 1966 1967 1968 1969 1970 1971 | 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 | - + | * to compile. */ Tcl_Obj *message; TclNewLiteralStringObj(message, "Compiling "); Tcl_IncrRefCount(message); |
| ︙ | |||
2080 2081 2082 2083 2084 2085 2086 | 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 | - - + - + |
* messages and trace information. */
{
int overflow, limit = 60;
Tcl_Size nameLen;
const char *procName = TclGetStringFromObj(procNameObj, &nameLen);
overflow = (nameLen > (Tcl_Size)limit);
|
| ︙ | |||
2455 2456 2457 2458 2459 2460 2461 | 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 2475 2476 2477 2478 2479 2480 2481 2482 2483 | - + - - + + - + - - + + - - + + |
/*
* Convert objPtr to list type first; if it cannot be converted, or if its
* length is not 2, then it cannot be converted to lambdaType.
*/
result = TclListObjLength(NULL, objPtr, &objc);
if ((result != TCL_OK) || ((objc != 2) && (objc != 3))) {
|
| ︙ | |||
2726 2727 2728 2729 2730 2731 2732 | 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 | - + |
extraPtr->efi.fields[0].name = "lambda";
extraPtr->efi.fields[0].proc = NULL;
extraPtr->efi.fields[0].clientData = lambdaPtr;
extraPtr->cmd.clientData = &extraPtr->efi;
result = TclPushProcCallFrame(procPtr, interp, objc, objv, 1);
if (result == TCL_OK) {
|
| ︙ | |||
2774 2775 2776 2777 2778 2779 2780 | 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 | - - + - + |
* messages and trace information. */
{
int overflow, limit = 60;
Tcl_Size nameLen;
const char *procName = TclGetStringFromObj(procNameObj, &nameLen);
overflow = (nameLen > (Tcl_Size)limit);
|
| ︙ |
Changes to generic/tclProcess.c.
| ︙ | |||
236 237 238 239 240 241 242 | 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | - + |
*codePtr = errno;
}
if (msgObjPtr) {
*msgObjPtr = Tcl_ObjPrintf(
"error waiting for process to exit: %s", msg);
}
if (errorObjPtr) {
|
| ︙ | |||
265 266 267 268 269 270 271 | 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | - - + - + |
/*
* CHILDSTATUS pid code
*
* Child exited with a non-zero exit status.
*/
if (msgObjPtr) {
|
| ︙ | |||
291 292 293 294 295 296 297 | 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | - + |
if (codePtr) {
*codePtr = WTERMSIG(waitStatus);
}
if (msgObjPtr) {
*msgObjPtr = Tcl_ObjPrintf("child killed: %s", msg);
}
if (errorObjPtr) {
|
| ︙ | |||
313 314 315 316 317 318 319 | 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 | - + - - + - - - - + + + + |
if (codePtr) {
*codePtr = WSTOPSIG(waitStatus);
}
if (msgObjPtr) {
*msgObjPtr = Tcl_ObjPrintf("child suspended: %s", msg);
}
if (errorObjPtr) {
|
| ︙ |
Changes to generic/tclRegexp.c.
| ︙ | |||
723 724 725 726 727 728 729 | 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 | - + - + |
char cbuf[TCL_INTEGER_SPACE];
size_t n;
const char *p;
Tcl_ResetResult(interp);
n = TclReError(status, buf, sizeof(buf));
p = (n > sizeof(buf)) ? "..." : "";
|
| ︙ |
Changes to generic/tclResult.c.
| ︙ | |||
310 311 312 313 314 315 316 | 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | - + |
}
while (1) {
const char *bytes = va_arg(argList, char *);
if (bytes == NULL) {
break;
}
|
| ︙ | |||
357 358 359 360 361 362 363 | 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 | - + |
Tcl_Size length;
if (Tcl_IsShared(iPtr->objResultPtr)) {
Tcl_SetObjResult(interp, Tcl_DuplicateObj(iPtr->objResultPtr));
}
bytes = TclGetStringFromObj(iPtr->objResultPtr, &length);
if (TclNeedSpace(bytes, bytes + length)) {
|
| ︙ | |||
762 763 764 765 766 767 768 | 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 | - + |
valueObjv);
}
Tcl_DictObjGet(NULL, iPtr->returnOpts, keys[KEY_ERRORCODE],
&valuePtr);
if (valuePtr != NULL) {
Tcl_SetObjErrorCode(interp, valuePtr);
} else {
|
| ︙ | |||
838 839 840 841 842 843 844 | 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 | - + - - + + - |
nestedOptions:
if (TCL_ERROR == Tcl_DictObjFirst(NULL, dict, &search,
&keyPtr, &valuePtr, &done)) {
/*
* Value is not a legal dictionary.
*/
|
| ︙ | |||
888 889 890 891 892 893 894 | 887 888 889 890 891 892 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 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 | - + - - + + - + - - + + - - + - - + + - - + - - - + + + |
if (valuePtr != NULL) {
if ((TCL_ERROR == TclGetIntFromObj(NULL, valuePtr, &level))
|| (level < 0)) {
/*
* Value is not a legal level.
*/
|
| ︙ | |||
1100 1101 1102 1103 1104 1105 1106 | 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 | - - - + + + |
Tcl_Size objc;
int level, code;
Tcl_Obj **objv, *mergedOpts;
Tcl_IncrRefCount(options);
if (TCL_ERROR == TclListObjGetElements(interp, options, &objc, &objv)
|| (objc % 2)) {
|
| ︙ |
Changes to generic/tclScan.c.
| ︙ | |||
338 339 340 341 342 343 344 | 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 | - - + + - - + - + - + - - + |
goto xpgCheckDone;
}
notXpg:
gotSequential = 1;
if (gotXpg) {
mixedXPG:
|
| ︙ | |||
412 413 414 415 416 417 418 | 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 | - - + + - - + - - - - + + + + - + |
/*
* Handle the various field types.
*/
switch (ch) {
case 'c':
if (flags & SCAN_WIDTH) {
|
| ︙ | |||
479 480 481 482 483 484 485 | 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 | - - - + + - - - - + + + - + |
if (*format == '\0') {
goto badSet;
}
format += TclUtfToUniChar(format, &ch);
}
break;
badSet:
|
| ︙ | |||
534 535 536 537 538 539 540 | 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 | - - + + - - + - - + + - - + - - - + + + - - + + - - + |
}
}
if (totalSubs) {
*totalSubs = numVars;
}
for (i = 0; i < numVars; i++) {
if (nassign[i] > 1) {
|
| ︙ | |||
970 971 972 973 974 975 976 | 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 | - - - + + + |
} else {
wideValue = WIDE_MAX;
}
}
if ((flags & SCAN_UNSIGNED) && (wideValue < 0)) {
mp_int big;
if (mp_init_u64(&big, (Tcl_WideUInt)wideValue) != MP_OKAY) {
|
| ︙ | |||
997 998 999 1000 1001 1002 1003 | 989 990 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 | - - - + + + - - - - + + + |
}
if (res == TCL_ERROR) {
if (objs != NULL) {
Tcl_Free(objs);
}
Tcl_DecrRefCount(objPtr);
|
| ︙ |
Changes to generic/tclStrIdxTree.c.
| ︙ | |||
465 466 467 468 469 470 471 | 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 | - + |
Tcl_Interp *interp,
TclStrIdx *tree,
int offs)
{
Tcl_Obj *obj[2];
const char *s;
|
| ︙ | |||
500 501 502 503 504 505 506 | 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | - + - |
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "");
return TCL_ERROR;
}
if (Tcl_GetIndexFromObj(interp, objv[1], options,
"option", 0, &optionIndex) != TCL_OK) {
|
| ︙ |
Changes to generic/tclStrToD.c.
| ︙ | |||
1528 1529 1530 1531 1532 1533 1534 | 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 | - + - + - + - + |
Tcl_Obj *msg = Tcl_ObjPrintf("expected %s but got ",
expected);
Tcl_Size argc;
const char **argv;
if ((TclMaxListLength(bytes, TCL_INDEX_NONE, NULL) > 1)
&& Tcl_SplitList(NULL, bytes, &argc, &argv) == TCL_OK) {
Tcl_Free(argv);
|
| ︙ | |||
4797 4798 4799 4800 4801 4802 4803 | 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 | - - + + |
* Infinite values can't convert to bignum.
*/
if (isinf(d)) {
if (interp != NULL) {
const char *s = "integer value too large to represent";
|
| ︙ |
Changes to generic/tclStringObj.c.
| ︙ | |||
1811 1812 1813 1814 1815 1816 1817 | 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 | - + |
while (1) {
const char *bytes = va_arg(argList, char *);
if (bytes == NULL) {
break;
}
|
| ︙ | |||
2248 2249 2250 2251 2252 2253 2254 | 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 | - + - + - + - + |
(isNegative ? "-" : gotPlus ? "+" : " "), 1);
segmentLimit -= 1;
}
if (gotHash || (ch == 'p')) {
switch (ch) {
case 'o':
|
| ︙ | |||
2307 2308 2309 2310 2311 2312 2313 | 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 | - + - + |
*/
if (gotPrecision) {
if (length < precision) {
segmentLimit -= precision - length;
}
while (length < precision) {
|
| ︙ | |||
2437 2438 2439 2440 2441 2442 2443 | 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 | - + - + |
mp_clear(&big);
}
if (gotPrecision) {
if (length < precision) {
segmentLimit -= precision - length;
}
while (length < precision) {
|
| ︙ | |||
2554 2555 2556 2557 2558 2559 2560 | 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 | - - - + + |
*q = 'p';
}
}
break;
}
default:
if (interp != NULL) {
|
| ︙ | |||
2616 2617 2618 2619 2620 2621 2622 | 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 | - + |
}
return TCL_OK;
errorMsg:
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(msg, -1));
|
| ︙ | |||
3035 3036 3037 3038 3039 3040 3041 | 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 | - + - - + + |
/* Any repeats of empty is empty. */
return objPtr;
}
/* maxCount includes space for null */
if (count > (maxCount-1)) {
if (interp) {
|
| ︙ | |||
3073 3074 3075 3076 3077 3078 3079 | 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 | - + - - + + |
TclInvalidateStringRep(objPtr);
objResultPtr = objPtr;
}
/* TODO - overflow check */
if (0 == Tcl_AttemptSetObjLength(objResultPtr, count*length)) {
if (interp) {
|
| ︙ | |||
3102 3103 3104 3105 3106 3107 3108 | 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 | - + - - + + |
} else {
TclFreeInternalRep(objPtr);
objResultPtr = objPtr;
}
/* TODO - overflow check */
if (0 == Tcl_AttemptSetObjLength(objResultPtr, count*length)) {
if (interp) {
|
| ︙ | |||
3400 3401 3402 3403 3404 3405 3406 | 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 | - - - - - + + + + + - - - - - + + + + + |
objResultPtr = *objv++; objc--;
/* Ugly interface! Force resize of the unicode array. */
(void)Tcl_GetUnicodeFromObj(objResultPtr, &start);
Tcl_InvalidateStringRep(objResultPtr);
if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) {
if (interp) {
|
| ︙ | |||
3449 3450 3451 3452 3453 3454 3455 | 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 | - - - - + + + + + - - - - + + + + + |
Tcl_Size start;
objResultPtr = *objv++; objc--;
(void)TclGetStringFromObj(objResultPtr, &start);
if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) {
if (interp) {
|
| ︙ | |||
3491 3492 3493 3494 3495 3496 3497 | 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 | - + - - + + |
/* Must NUL-terminate! */
*dst = '\0';
}
return objResultPtr;
overflow:
if (interp) {
|
| ︙ | |||
4241 4242 4243 4244 4245 4246 4247 | 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 | - - - - + + + + + |
memcpy(bytes + first, iBytes, count);
Tcl_InvalidateStringRep(objPtr);
return objPtr;
}
if (newBytes > (TCL_SIZE_MAX - (numBytes - count))) {
if (interp) {
|
| ︙ |
Changes to generic/tclTimer.c.
| ︙ | |||
818 819 820 821 822 823 824 | 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 | - + - - + + - |
*/
if (TclGetWideIntFromObj(NULL, objv[1], &ms) != TCL_OK) {
if (Tcl_GetIndexFromObj(NULL, objv[1], afterSubCmds, "", 0, &index)
!= TCL_OK) {
const char *arg = TclGetString(objv[1]);
|
| ︙ | |||
959 960 961 962 963 964 965 | 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 | - - - + + |
Tcl_WrongNumArgs(interp, 2, objv, "?id?");
return TCL_ERROR;
}
afterPtr = GetAfterEvent(assocPtr, objv[2]);
if (afterPtr == NULL) {
const char *eventStr = TclGetString(objv[2]);
|
| ︙ |
Changes to generic/tclTrace.c.
| ︙ | |||
311 312 313 314 315 316 317 | 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | - + - - + + - |
*/
result = TclListObjLength(interp, objv[4], &listLen);
if (result != TCL_OK) {
return result;
}
if (listLen == 0) {
|
| ︙ | |||
553 554 555 556 557 558 559 | 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 | - + - - + + - |
*/
result = TclListObjLength(interp, objv[4], &listLen);
if (result != TCL_OK) {
return result;
}
if (listLen == 0) {
|
| ︙ | |||
752 753 754 755 756 757 758 | 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 | - + - - + + - |
*/
result = TclListObjLength(interp, objv[4], &listLen);
if (result != TCL_OK) {
return result;
}
if (listLen == 0) {
|
| ︙ | |||
2670 2671 2672 2673 2674 2675 2676 | 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 | - - + - + |
if (disposeFlags & TCL_TRACE_RESULT_OBJECT) {
Tcl_SetObjResult((Tcl_Interp *)iPtr, (Tcl_Obj *) result);
} else {
Tcl_SetObjResult((Tcl_Interp *)iPtr,
Tcl_NewStringObj(result, -1));
}
|
| ︙ |
Changes to generic/tclUtil.c.
| ︙ | |||
665 666 667 668 669 670 671 | 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 | - + - - + + - |
if (interp != NULL) {
p2 = p;
while ((p2 < limit) && (!TclIsSpaceProcM(*p2))
&& (p2 < p+20)) {
p2++;
}
|
| ︙ | |||
717 718 719 720 721 722 723 | 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 | - + - - + + - |
if (interp != NULL) {
p2 = p;
while ((p2 < limit) && (!TclIsSpaceProcM(*p2))
&& (p2 < p+20)) {
p2++;
}
|
| ︙ | |||
751 752 753 754 755 756 757 | 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 | - - - + + - - - - + + - |
/*
* End of list/dict: terminate element.
*/
if (p == limit) {
if (openBraces != 0) {
if (interp != NULL) {
|
| ︙ | |||
910 911 912 913 914 915 916 | 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 | - - - + + - |
}
if (*element == 0) {
break;
}
if (i >= size) {
Tcl_Free((void *)argv);
if (interp != NULL) {
|
| ︙ | |||
2083 2084 2085 2086 2087 2088 2089 | 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 | - + |
}
/*
* Append to the result with space if needed.
*/
if (needSpace) {
|
| ︙ | |||
3732 3733 3734 3735 3736 3737 3738 | 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 | - + - + - + |
}
return TCL_OK;
/* Report a parse error. */
parseError:
if (interp != NULL) {
char * bytes = TclGetString(objPtr);
|
| ︙ | |||
3928 3929 3930 3931 3932 3933 3934 | 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 | + - - + + |
}
}
*indexPtr = idx;
return TCL_OK;
rangeerror:
if (interp) {
TclPrintfResult(interp,
|
| ︙ | |||
3986 3987 3988 3989 3990 3991 3992 | 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 | - + - + - + - + |
int
TclCommandWordLimitError(
Tcl_Interp *interp, /* May be NULL */
Tcl_Size count) /* If <= 0, "unknown" */
{
if (interp) {
if (count > 0) {
|
| ︙ | |||
4600 4601 4602 4603 4604 4605 4606 | 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 | - + |
}
return TCL_OK;
invalidGlob:
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(msg, -1));
|
Changes to generic/tclVar.c.
| ︙ | |||
340 341 342 343 344 345 346 | 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | - - - + + |
static int
NotArrayError(
Tcl_Interp *interp,
Tcl_Obj *name)
{
const char *nameStr = TclGetString(name);
|
| ︙ | |||
646 647 648 649 650 651 652 | 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 | - + |
* ERROR: part1Ptr is already an array element, cannot specify
* a part2.
*/
if (flags & TCL_LEAVE_ERR_MSG) {
TclObjVarErrMsg(interp, part1Ptr, part2Ptr, msg,
NOSUCHVAR, -1);
|
| ︙ | |||
671 672 673 674 675 676 677 | 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 | - + - |
const char *part2 = strchr(part1, '(');
if (part2) {
if (part2Ptr != NULL) {
if (flags & TCL_LEAVE_ERR_MSG) {
TclObjVarErrMsg(interp, part1Ptr, part2Ptr, msg,
NEEDARRAY, -1);
|
| ︙ | |||
699 700 701 702 703 704 705 | 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 | - - + + |
*/
varPtr = TclLookupSimpleVar(interp, part1Ptr, flags, createPart1,
&errMsg, &index);
if (varPtr == NULL) {
if ((errMsg != NULL) && (flags & TCL_LEAVE_ERR_MSG)) {
TclObjVarErrMsg(interp, part1Ptr, part2Ptr, msg, errMsg, -1);
|
| ︙ | |||
1083 1084 1085 1086 1087 1088 1089 | 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 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 | - - + + - - + + - - + + - - + + |
*/
if (TclIsVarUndefined(arrayPtr) && !TclIsVarArrayElement(arrayPtr)) {
if (!createArray) {
if (flags & TCL_LEAVE_ERR_MSG) {
TclObjVarErrMsg(interp, arrayNamePtr, elNamePtr, msg,
NOSUCHVAR, index);
|
| ︙ | |||
1452 1453 1454 1455 1456 1457 1458 | 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 | - + |
/*
* An error. If the variable doesn't exist anymore and no-one's using it,
* then free up the relevant structures and hash table entries.
*/
errorReturn:
|
| ︙ | |||
1930 1931 1932 1933 1934 1935 1936 | 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 | - + - + - + - + |
*/
if (TclIsVarDeadHash(varPtr)) {
if (flags & TCL_LEAVE_ERR_MSG) {
if (TclIsVarArrayElement(varPtr)) {
TclObjVarErrMsg(interp, part1Ptr, part2Ptr, "set",
DANGLINGELEMENT, index);
|
| ︙ | |||
2053 2054 2055 2056 2057 2058 2059 | 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 | - + |
/*
* If the variable doesn't exist anymore and no-one's using it, then free
* up the relevant structures and hash table entries.
*/
cleanup:
if (resultPtr == NULL) {
|
| ︙ | |||
2237 2238 2239 2240 2241 2242 2243 | 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 | - + |
/*
* It's an error to try to increment a constant.
*/
if (TclIsVarConstant(varPtr)) {
if (flags & TCL_LEAVE_ERR_MSG) {
TclObjVarErrMsg(interp, part1Ptr, part2Ptr, "incr", ISCONST,index);
|
| ︙ | |||
2474 2475 2476 2477 2478 2479 2480 | 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 | - + |
/*
* It's an error to try to unset a constant.
*/
if (TclIsVarConstant(varPtr)) {
if (flags & TCL_LEAVE_ERR_MSG) {
TclObjVarErrMsg(interp, part1Ptr, part2Ptr, "unset", ISCONST,index);
|
| ︙ | |||
2502 2503 2504 2505 2506 2507 2508 | 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 | - + |
* It's an error to unset an undefined variable.
*/
if (result != TCL_OK) {
if (flags & TCL_LEAVE_ERR_MSG) {
TclObjVarErrMsg(interp, part1Ptr, part2Ptr, "unset",
((initialArrayPtr == NULL) ? NOSUCHVAR : NOSUCHELEMENT), index);
|
| ︙ | |||
3103 3104 3105 3106 3107 3108 3109 | 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 | - - - + + |
*/
if (TclListObjLength(interp, objv[1], &numVars) != TCL_OK) {
return TCL_ERROR;
}
if (numVars != 2) {
|
| ︙ | |||
3178 3179 3180 3181 3182 3183 3184 | 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 | - - - + + |
if (result == TCL_CONTINUE) {
result = TCL_OK;
} else if (result != TCL_OK) {
if (result == TCL_BREAK) {
Tcl_ResetResult(interp);
result = TCL_OK;
} else if (result == TCL_ERROR) {
|
| ︙ | |||
3204 3205 3206 3207 3208 3209 3210 | 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 | - - - + + |
&valueObj);
}
result = TCL_OK;
if (done != TCL_CONTINUE) {
Tcl_ResetResult(interp);
if (done == TCL_ERROR) {
|
| ︙ | |||
4020 4021 4022 4023 4024 4025 4026 | 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 | - - + + |
/*createPart2*/ 1, &arrayPtr);
if (varPtr == NULL) {
return TCL_ERROR;
}
if (arrayPtr) {
CleanupVar(varPtr, arrayPtr);
TclObjVarErrMsg(interp, arrayNameObj, NULL, "set", NEEDARRAY, -1);
|
| ︙ | |||
4087 4088 4089 4090 4091 4092 4093 | 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 | - - - + + + |
Tcl_Size i;
result = TclListObjLength(interp, arrayElemObj, &elemLen);
if (result != TCL_OK) {
return result;
}
if (elemLen & 1) {
|
| ︙ | |||
4148 4149 4150 4151 4152 4153 4154 | 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 | - + |
if (TclIsVarArrayElement(varPtr) || !TclIsVarUndefined(varPtr)) {
/*
* Either an array element, or a scalar: lose!
*/
TclObjVarErrMsg(interp, arrayNameObj, NULL, "array set",
NEEDARRAY, -1);
|
| ︙ | |||
4260 4261 4262 4263 4264 4265 4266 | 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 | - - + |
if (!isArray) {
return NotArrayError(interp, varNameObj);
}
stats = Tcl_HashStats((Tcl_HashTable *) varPtr->value.tablePtr);
if (stats == NULL) {
|
| ︙ | |||
4528 4529 4530 4531 4532 4533 4534 | 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 | - + - - + + |
if (!(arrayPtr != NULL
? (TclIsVarInHash(arrayPtr) && TclGetVarNsPtr(arrayPtr))
: (TclIsVarInHash(otherPtr) && TclGetVarNsPtr(otherPtr)))
&& ((myFlags & (TCL_GLOBAL_ONLY | TCL_NAMESPACE_ONLY))
|| (varFramePtr == NULL)
|| !HasLocalVars(varFramePtr)
|| (strstr(TclGetString(myNamePtr), "::") != NULL))) {
|
| ︙ | |||
4644 4645 4646 4647 4648 4649 4650 | 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 | - + - - + + - - - + + - - - + + + - - - + + + - - - + + + |
if (p != NULL) {
p += strlen(p)-1;
if (*p == ')') {
/*
* myName looks like an array reference.
*/
|
| ︙ | |||
4817 4818 4819 4820 4821 4822 4823 | 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 | - + - + |
/*
* Add the full name of the containing namespace (if any), followed by the
* "::" separator, then the variable name.
*/
nsPtr = TclGetVarNsPtr(varPtr);
if (nsPtr) {
|
| ︙ | |||
4874 4875 4876 4877 4878 4879 4880 | 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 | - + - + - + |
}
part1Ptr = objv[1];
varPtr = TclObjLookupVarEx(interp, part1Ptr, NULL, TCL_LEAVE_ERR_MSG,
"const", /*createPart1*/ 1, /*createPart2*/ 1, &arrayPtr);
if (TclIsVarArray(varPtr)) {
TclObjVarErrMsg(interp, part1Ptr, NULL, "make constant", ISARRAY, -1);
|
| ︙ | |||
5067 5068 5069 5070 5071 5072 5073 | 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 | - + | /* * Variable cannot be an element in an array. If arrayPtr is * non-NULL, it is, so throw up an error and return. */ TclObjVarErrMsg(interp, varNamePtr, NULL, "define", ISARRAYELEMENT, -1); |
| ︙ | |||
5215 5216 5217 5218 5219 5220 5221 | 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 | - - - + + - |
}
if ((result == 0) && hasLevel) {
/*
* Synthesize an error message since TclObjGetFrame doesn't do this
* for this particular case.
*/
|
| ︙ | |||
5299 5300 5301 5302 5303 5304 5305 | 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 | - - + - + - + - - + - + |
return searchPtr;
}
}
}
if ((handle[0] != 's') || (handle[1] != '-')
|| (strtoul(handle + 2, &end, 10), end == (handle + 2))
|| (*end != '-')) {
|
| ︙ | |||
5700 5701 5702 5703 5704 5705 5706 | 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 | - + - + |
{
if (!part1Ptr) {
if (index == -1) {
Tcl_Panic("invalid part1Ptr and invalid index together");
}
part1Ptr = localName(((Interp *)interp)->varFramePtr, index);
}
|
| ︙ | |||
5951 5952 5953 5954 5955 5956 5957 | 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 | - - - + + |
varPtr = VarHashFindVar(&nsPtr[search]->varTable, simpleNamePtr);
}
}
if (simpleName != name) {
Tcl_DecrRefCount(simpleNamePtr);
}
if ((varPtr == NULL) && (flags & TCL_LEAVE_ERR_MSG)) {
|
| ︙ | |||
6857 6858 6859 6860 6861 6862 6863 | 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 6860 | - - - + + |
if (!varPtr || TclIsVarUndefined(varPtr) || !isArray) {
return NotArrayError(interp, arrayNameObj);
}
defaultValueObj = TclGetArrayDefault(varPtr);
if (!defaultValueObj) {
/* Array default must exist. */
|
| ︙ | |||
6888 6889 6890 6891 6892 6893 6894 | 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 | - - + + - + | /* * Not a valid array name. */ CleanupVar(varPtr, arrayPtr); TclObjVarErrMsg(interp, arrayNameObj, NULL, "array default set", NEEDARRAY, -1); |
| ︙ |
Changes to generic/tclZipfs.c.
| ︙ | |||
50 51 52 53 54 55 56 | 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 | - - - + + - - + + - + - |
if (interp) { \
Tcl_SetObjResult(interp, Tcl_NewStringObj(errstr, -1)); \
} \
} while (0)
#define ZIPFS_MEM_ERROR(interp) \
do { \
if (interp) { \
|
| ︙ | |||
1116 1117 1118 1119 1120 1121 1122 | 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 | - - + |
Tcl_DStringFree(&dsJoin);
Tcl_DStringAppend(dsPtr, normalizedPath, normalizedLen);
Tcl_DecrRefCount(normalizedObj);
return TCL_OK;
invalidMountPath:
if (interp) {
|
| ︙ | |||
1971 1972 1973 1974 1975 1976 1977 | 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 | - - + + |
WriteLock();
hPtr = Tcl_CreateHashEntry(&ZipFS.zipHash, mountPoint, &isNew);
if (!isNew) {
if (interp) {
zf0 = (ZipFile *) Tcl_GetHashValue(hPtr);
|
| ︙ | |||
2084 2085 2086 2087 2088 2089 2090 | 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 | - + - + - | * APK due to the leading dot in the file name component. This * trick should make the files AndroidManifest.xml, * resources.arsc, and classes.dex visible to Tcl. */ Tcl_DString ds2; Tcl_DStringInit(&ds2); |
| ︙ | |||
2436 2437 2438 2439 2440 2441 2442 | 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 | - - - + + + |
Unlock();
zipPathObj = Tcl_NewStringObj(zipname, -1);
Tcl_IncrRefCount(zipPathObj);
normZipPathObj = Tcl_FSGetNormalizedPath(interp, zipPathObj);
if (normZipPathObj == NULL) {
|
| ︙ | |||
2897 2898 2899 2900 2901 2902 2903 | 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 | - - + + - |
if (Tcl_GetDoubleFromObj(interp, ret, &r) != TCL_OK) {
goto failed;
}
*chPtr = (int) (r * 256);
return TCL_OK;
failed:
|
| ︙ | |||
2984 2985 2986 2987 2988 2989 2990 | 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 | - - + + |
TCL_INDEX_NONE, 0, &zpathDs, NULL) != TCL_OK) {
Tcl_DStringFree(&zpathDs);
return TCL_ERROR;
}
zpathExt = Tcl_DStringValue(&zpathDs);
zpathlen = strlen(zpathExt);
if (zpathlen + ZIP_CENTRAL_HEADER_LEN > bufsize) {
|
| ︙ | |||
3026 3027 3028 3029 3030 3031 3032 | 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 | - - + + - - + + |
if (len < 0) {
Tcl_DStringFree(&zpathDs);
if (nbyte == 0 && errno == EISDIR) {
Tcl_Close(interp, in);
return TCL_OK;
}
readErrorWithChannelOpen:
|
| ︙ | |||
3062 3063 3064 3065 3066 3067 3068 | 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 | - + - + |
*/
memset(buf, '\0', ZIP_LOCAL_HEADER_LEN);
memcpy(buf + ZIP_LOCAL_HEADER_LEN, zpathExt, zpathlen);
len = zpathlen + ZIP_LOCAL_HEADER_LEN;
if (Tcl_Write(out, buf, len) != len) {
writeErrorWithChannelOpen:
|
| ︙ | |||
3140 3141 3142 3143 3144 3145 3146 | 3135 3136 3137 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 3170 3171 3172 | - - + + - - + + |
compMeth = ZIP_COMPMETH_DEFLATED;
memset(&stream, 0, sizeof(z_stream));
stream.zalloc = Z_NULL;
stream.zfree = Z_NULL;
stream.opaque = Z_NULL;
if (deflateInit2(&stream, 9, Z_DEFLATED, -15, 8,
Z_DEFAULT_STRATEGY) != Z_OK) {
|
| ︙ | |||
3205 3206 3207 3208 3209 3210 3211 | 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 | - - + |
*/
if (Tcl_Seek(in, 0, SEEK_SET) != 0) {
goto seekErr;
}
if (Tcl_Seek(out, dataStartOffset, SEEK_SET) != dataStartOffset) {
seekErr:
|
| ︙ | |||
3249 3250 3251 3252 3253 3254 3255 | 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 | - - + + |
}
Tcl_Close(interp, in);
Tcl_DStringFree(&zpathDs);
zpathExt = NULL;
hPtr = Tcl_CreateHashEntry(fileHash, zpathTcl, &isNew);
if (!isNew) {
|
| ︙ | |||
3281 3282 3283 3284 3285 3286 3287 | 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 | - - + - - + - - + |
*/
SerializeLocalEntryHeader(start, end, (unsigned char *) buf, z,
zpathlen, align);
if (Tcl_Seek(out, headerStartOffset, SEEK_SET) != headerStartOffset) {
Tcl_DeleteHashEntry(hPtr);
Tcl_Free(z);
|
| ︙ | |||
3322 3323 3324 3325 3326 3327 3328 | 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 | - + |
ZipFSFind(
Tcl_Interp *interp,
Tcl_Obj *dirRoot)
{
Tcl_Obj *cmd[2];
int result;
|
| ︙ | |||
3559 3560 3561 3562 3563 3564 3565 | 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 | - - + + |
* Copy everything up to the ZIP-related suffix.
*/
if ((size_t)Tcl_Write(out, (char *) zf->data,
zf->passOffset) != zf->passOffset) {
memset(passBuf, 0, sizeof(passBuf));
Tcl_DecrRefCount(list);
|
| ︙ | |||
3601 3602 3603 3604 3605 3606 3607 | 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 | - - + + |
*/
len = strlen(passBuf);
if (len > 0) {
i = Tcl_Write(out, passBuf, len);
if (i != len) {
Tcl_DecrRefCount(list);
|
| ︙ | |||
3668 3669 3670 3671 3672 3673 3674 | 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 | - - + - - + |
name = Tcl_DStringValue(&ds);
len = Tcl_DStringLength(&ds);
SerializeCentralDirectoryEntry(start, end, (unsigned char *) buf,
z, len, dataStartOffset);
if ((Tcl_Write(out, buf, ZIP_CENTRAL_HEADER_LEN)
!= ZIP_CENTRAL_HEADER_LEN)
|| (Tcl_Write(out, name, len) != len)) {
|
| ︙ | |||
3784 3785 3786 3787 3788 3789 3790 | 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 | - - + |
goto copyError;
}
}
Tcl_Close(interp, in);
return TCL_OK;
copyError:
|
| ︙ | |||
4185 4186 4187 4188 4189 4190 4191 | 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 | - - + + - |
Tcl_ListObjAppendElement(interp, result,
Tcl_NewWideIntObj(z->numCompressedBytes));
Tcl_ListObjAppendElement(interp, result, Tcl_NewWideIntObj(z->offset));
ret = TCL_OK;
} else {
Tcl_SetErrno(ENOENT);
if (interp) {
|
| ︙ | |||
4846 4847 4848 4849 4850 4851 4852 | 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 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 | - + - + - + - + - + - + - - + + - |
int wr = (mode & (O_WRONLY | O_RDWR)) != 0;
/* Check for unsupported modes. */
if ((ZipFS.wrmax <= 0) && wr) {
Tcl_SetErrno(EACCES);
if (interp) {
|
| ︙ | |||
4924 4925 4926 4927 4928 4929 4930 | 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 | - + |
/* Read-only */
flags |= TCL_READABLE;
}
if (z->isEncrypted) {
if (z->numCompressedBytes < ZIP_CRYPT_HDR_LEN) {
ZIPFS_ERROR(interp,
|
| ︙ | |||
5561 5562 5563 5564 5565 5566 5567 | 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 | - + |
*-------------------------------------------------------------------------
*/
static Tcl_Obj *
ZipFSFilesystemSeparatorProc(
TCL_UNUSED(Tcl_Obj *) /*pathPtr*/)
{
|
| ︙ | |||
5679 5680 5681 5682 5683 5684 5685 | 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 | - + | /* * We need to strip the normalized prefix of the filenames and replace * it with the official prefix that we were expecting to get. */ strip = len + 1; Tcl_DStringAppend(&dsPref, prefix, prefixLen); |
| ︙ | |||
6104 6105 6106 6107 6108 6109 6110 | 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 | - + - + |
TclNewIntObj(*objPtrRef, z ? z->offset : 0);
break;
case ZIP_ATTR_MOUNT:
if (z) {
*objPtrRef = Tcl_NewStringObj(z->zipFilePtr->mountPoint,
z->zipFilePtr->mountPointLen);
} else {
|
| ︙ | |||
6172 6173 6174 6175 6176 6177 6178 | 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 | - + |
*-------------------------------------------------------------------------
*/
static Tcl_Obj *
ZipFSFilesystemPathTypeProc(
TCL_UNUSED(Tcl_Obj *) /*pathPtr*/)
{
|
| ︙ |
Changes to generic/tclZlib.c.
| ︙ | |||
338 339 340 341 342 343 344 | 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | - + |
Tcl_SetObjResult(interp, Tcl_NewStringObj(zError(code), TCL_AUTO_LENGTH));
/*
* Tricky point! We might pass NULL twice here (and will when the error
* type is known).
*/
|
| ︙ | |||
447 448 449 450 451 452 453 | 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 | - - + + - + - |
result = Tcl_UtfToExternal(NULL, latin1enc, valueStr, length,
TCL_ENCODING_START|TCL_ENCODING_END|TCL_ENCODING_PROFILE_STRICT,
&state, headerPtr->nativeCommentBuf, MAX_COMMENT_LEN - 1, NULL,
&len, NULL);
if (result != TCL_OK) {
if (interp) {
if (result == TCL_CONVERT_UNKNOWN) {
|
| ︙ | |||
483 484 485 486 487 488 489 | 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 | - - + + - - + |
result = Tcl_UtfToExternal(NULL, latin1enc, valueStr, length,
TCL_ENCODING_START|TCL_ENCODING_END|TCL_ENCODING_PROFILE_STRICT,
&state, headerPtr->nativeFilenameBuf, MAXPATHLEN - 1, NULL,
&len, NULL);
if (result != TCL_OK) {
if (interp) {
if (result == TCL_CONVERT_UNKNOWN) {
|
| ︙ | |||
825 826 827 828 829 830 831 | 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 | - - - + + + |
goto error;
}
Tcl_DStringInit(&cmdname);
TclDStringAppendLiteral(&cmdname, "::tcl::zlib::streamcmd_");
TclDStringAppendObj(&cmdname, Tcl_GetObjResult(interp));
if (Tcl_FindCommand(interp, Tcl_DStringValue(&cmdname),
NULL, 0) != NULL) {
|
| ︙ | |||
1217 1218 1219 1220 1221 1222 1223 | 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 | - - - + + + |
int e;
Tcl_Size size = 0;
size_t outSize, toStore;
unsigned char *bytes;
if (zshPtr->streamEnd) {
if (zshPtr->interp) {
|
| ︙ | |||
1447 1448 1449 1450 1451 1452 1453 | 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 | - + - - + + - |
/*
* State: We have not satisfied the request yet and there may be
* more to inflate.
*/
if (zshPtr->stream.avail_in > 0) {
if (zshPtr->interp) {
|
| ︙ | |||
2216 2217 2218 2219 2220 2221 2222 | 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 | - - - + + - + - - + + |
* -> channel */
return ZlibPushSubcmd(interp, objc, objv);
}
return TCL_ERROR;
badLevel:
|
| ︙ | |||
2361 2362 2363 2364 2365 2366 2367 | 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 | - - - + + |
*/
if (levelObj == NULL) {
level = Z_DEFAULT_COMPRESSION;
} else if (Tcl_GetIntFromObj(interp, levelObj, &level) != TCL_OK) {
return TCL_ERROR;
} else if (level < 0 || level > 9) {
|
| ︙ | |||
2480 2481 2482 2483 2484 2485 2486 | 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 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 | - - + + - - + - - + + - - + - - - + + + - - - + + - - - + + - - + - + - - + + - + - - |
}
/*
* Sanity checks.
*/
if (mode == TCL_ZLIB_STREAM_DEFLATE && !(chanMode & TCL_WRITABLE)) {
|
| ︙ | |||
2756 2757 2758 2759 2760 2761 2762 | 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 | - + - - + + - - + + - - + - + - - + + - + - - + + |
flush = -2;
} else {
flush = Z_FINISH;
}
break;
case ao_buffer: /* -buffer bufferSize */
if (i == objc - 2) {
|
| ︙ | |||
2883 2884 2885 2886 2887 2888 2889 | 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 | - + - - + + - + - - + + |
flush = -2;
} else {
flush = Z_FINISH;
}
break;
case po_dictionary: /* -dictionary compDict */
if (i == objc - 2) {
|
| ︙ | |||
2942 2943 2944 2945 2946 2947 2948 | 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 | - - + + - - + |
Tcl_Obj *resultObj;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 2, objv, NULL);
return TCL_ERROR;
} else if (zshPtr->mode != TCL_ZLIB_STREAM_INFLATE
|| zshPtr->format != TCL_ZLIB_FORMAT_GZIP) {
|
| ︙ | |||
3031 3032 3033 3034 3035 3036 3037 | 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 | - + - + |
}
if (written && Tcl_WriteRaw(chanDataPtr->parent,
chanDataPtr->outBuffer, written) == TCL_IO_FAILURE) {
/* TODO: is this the right way to do errors on close?
* Note: when close is called from FinalizeIOSubsystem then
* interp may be NULL */
if (!TclInThreadExit() && interp) {
|
| ︙ | |||
3167 3168 3169 3170 3171 3172 3173 | 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 | - + | *errorCodePtr = Tcl_GetErrno(); return -1; } /* more bytes (or Eof if readBytes == 0) */ chanDataPtr->inStream.avail_in += readBytes; |
| ︙ | |||
3270 3271 3272 3273 3274 3275 3276 | 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 | - + - |
}
if (e == Z_OK) {
return toWrite - chanDataPtr->outStream.avail_in;
}
errObj = Tcl_NewListObj(0, NULL);
|
| ︙ | |||
3319 3320 3321 3322 3323 3324 3325 | 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 | - - + + - |
/*
* Write the bytes we've received to the next layer.
*/
if (len > 0 && Tcl_WriteRaw(chanDataPtr->parent, chanDataPtr->outBuffer,
len) == TCL_IO_FAILURE) {
|
| ︙ | |||
3405 3406 3407 3408 3409 3410 3411 | 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 | - + - - + + - - - + + - |
int flushType;
if (value[0] == 'f' && strcmp(value, "full") == 0) {
flushType = Z_FULL_FLUSH;
} else if (value[0] == 's' && strcmp(value, "sync") == 0) {
flushType = Z_SYNC_FLUSH;
} else {
|
| ︙ | |||
3522 3523 3524 3525 3526 3527 3528 | 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 | - - + - - - |
Tcl_DStringAppendElement(dsPtr,
TclGetString(chanDataPtr->compDictObj));
} else {
Tcl_DStringAppendElement(dsPtr, "");
}
} else {
if (chanDataPtr->compDictObj) {
|
| ︙ | |||
3973 3974 3975 3976 3977 3978 3979 | 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 | - + - |
}
}
return resBytes;
handleError:
errObj = Tcl_NewListObj(0, NULL);
|
| ︙ |
Changes to macosx/tclMacOSXFCmd.c.
| ︙ | |||
131 132 133 134 135 136 137 | 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 | - + - + - - + + - + - + |
finderinfo *finder = (finderinfo *) &finfo.data;
off_t *rsrcForkSize = (off_t *) &finfo.data;
const char *native;
result = TclpObjStat(fileName, &statBuf);
if (result != 0) {
|
| ︙ | |||
184 185 186 187 188 189 190 | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | - - - + + |
break;
case MACOSX_RSRCLENGTH_ATTRIBUTE:
TclNewIntObj(*attributePtrPtr, *rsrcForkSize);
break;
}
return TCL_OK;
#else
|
| ︙ | |||
227 228 229 230 231 232 233 | 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 | - + - + - - + + - + - + |
finderinfo *finder = (finderinfo *) &finfo.data;
off_t *rsrcForkSize = (off_t *) &finfo.data;
const char *native;
result = TclpObjStat(fileName, &statBuf);
if (result != 0) {
|
| ︙ | |||
294 295 296 297 298 299 300 | 293 294 295 296 297 298 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 331 | - + - + - - - + + + |
break;
}
result = setattrlist(native, &alist,
&finfo.data, sizeof(finfo.data), 0);
if (result != 0) {
|
| ︙ | |||
348 349 350 351 352 353 354 | 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 | - + - + - - - + + |
result = close(fd);
}
}
Tcl_DStringFree(&ds);
if (result != 0) {
|
| ︙ | |||
629 630 631 632 633 634 635 | 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 | - - - + + + |
Tcl_Size length;
string = TclGetStringFromObj(objPtr, &length);
Tcl_UtfToExternalDStringEx(NULL, encoding, string, length, TCL_ENCODING_PROFILE_TCL8, &ds, NULL);
if (Tcl_DStringLength(&ds) > 4) {
if (interp) {
|
| ︙ |
Changes to tests/fCmd.test.
| ︙ | |||
2901 2902 2903 2904 2905 2906 2907 | 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 | - + - + - + - + |
} -result relative/path
test fCmd-32.14.1 {Tcl_FSTildeExpand relative/path} -constraints testfstildeexpand -body {
testfstildeexpand relative/path
} -result relative/path
test fCmd-32.15 {file tildeexpand ~\\path} -body {
file tildeexpand ~\\foo
} -constraints win -result [file join $::env(HOME)/foo]
|
| ︙ |
Changes to unix/tclLoadDl.c.
| ︙ | |||
125 126 127 128 129 130 131 | 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | - + - + |
* Write the string to a variable first to work around a compiler bug
* in the Sun Forte 6 compiler. [Bug 1503729]
*/
const char *errorStr = dlerror();
if (interp) {
|
| ︙ | |||
225 226 227 228 229 230 231 | 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | - - - + + + - |
if (proc == NULL) {
const char *errorStr = dlerror();
if (interp) {
if (!errorStr) {
errorStr = "unknown";
}
|
| ︙ |
Changes to unix/tclLoadDyld.c.
| ︙ | |||
160 161 162 163 164 165 166 | 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | - + |
*loadHandle = newHandle;
result = TCL_OK;
} else {
Tcl_Obj *errObj;
TclNewObj(errObj);
if (errMsg != NULL) {
|
| ︙ | |||
266 267 268 269 270 271 272 | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | - - - + + + - |
proc = (Tcl_LibraryInitProc *)NSAddressOfSymbol(nsSymbol);
}
Tcl_DStringFree(&newName);
#endif /* TCL_LOAD_FROM_MEMORY */
}
Tcl_DStringFree(&ds);
if (errMsg && (interp != NULL)) {
|
| ︙ |
Changes to unix/tclLoadNext.c.
| ︙ | |||
96 97 98 99 100 101 102 | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | - - + + |
}
if (!result) {
char *data;
int len, maxlen;
NXGetMemoryBuffer(errorStream, &data, &len, &maxlen);
|
| ︙ | |||
146 147 148 149 150 151 152 | 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | - - - + + |
sym[0] = '_';
sym[1] = 0;
strcat(sym, symbol);
rld_lookup(NULL, sym, (unsigned long *) &proc);
}
if (proc == NULL && interp != NULL) {
|
| ︙ |
Changes to unix/tclLoadOSF.c.
| ︙ | |||
106 107 108 109 110 111 112 | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | - + - + |
}
native = Tcl_DStringValue(&ds);
lm = (Tcl_LibraryInitProc *) load(native, LDR_NOFLAGS);
Tcl_DStringFree(&ds);
}
if (lm == LDR_NULL_MODULE) {
|
| ︙ | |||
163 164 165 166 167 168 169 | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | - - - + + |
Tcl_Interp *interp,
Tcl_LoadHandle loadHandle,
const char *symbol)
{
void *proc = ldr_lookup_package((char *) loadHandle, symbol);
if (proc == NULL && interp != NULL) {
|
| ︙ |
Changes to unix/tclLoadShl.c.
| ︙ | |||
92 93 94 95 96 97 98 | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | - + - + |
}
native = Tcl_DStringValue(&ds);
handle = shl_load(native, BIND_DEFERRED|BIND_VERBOSE|DYNAMIC_PATH, 0L);
Tcl_DStringFree(&ds);
}
if (handle == NULL) {
|
| ︙ | |||
148 149 150 151 152 153 154 | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | - + - + |
if (shl_findsym(&handle, Tcl_DStringValue(&newName),
(short) TYPE_PROCEDURE, (void *)&proc) != 0) {
proc = NULL;
}
Tcl_DStringFree(&newName);
}
if (proc == NULL && interp != NULL) {
|
| ︙ |
Changes to unix/tclUnixChan.c.
| ︙ | |||
107 108 109 110 111 112 113 | 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | - - - + + + |
int stop;
} TtyAttrs;
#endif /* SUPPORTS_TTY */
#define UNSUPPORTED_OPTION(detail) \
if (interp) { \
|
| ︙ | |||
676 677 678 679 680 681 682 | 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 | - + - + |
if ((len > 1) && (strncmp(optionName, "-stat", len) == 0)) {
Tcl_Obj *dictObj = StatOpenFile(fsPtr);
const char *dictContents;
Tcl_Size dictLength;
if (dictObj == NULL) {
|
| ︙ | |||
819 820 821 822 823 824 825 | 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 | - + - - - + + + - + - - + + |
return TCL_ERROR;
#endif /* CRTSCTS */
} else if (strncasecmp(value, "DTRDSR", vlen) == 0) {
UNSUPPORTED_OPTION("-handshake DTRDSR");
return TCL_ERROR;
} else {
if (interp) {
|
| ︙ | |||
906 907 908 909 910 911 912 | 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 | - + - - - + + + |
Tcl_Size i;
if (Tcl_SplitList(interp, value, &argc, &argv) == TCL_ERROR) {
return TCL_ERROR;
}
if ((argc % 2) == 1) {
if (interp) {
|
| ︙ | |||
948 949 950 951 952 953 954 | 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 | - + - - - + + + |
#else /* TIOCSBRK & TIOCCBRK */
UNSUPPORTED_OPTION("-ttycontrol BREAK");
Tcl_Free(argv);
return TCL_ERROR;
#endif /* TIOCSBRK & TIOCCBRK */
} else {
if (interp) {
|
| ︙ | |||
980 981 982 983 984 985 986 | 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 | - + - - - + + + - + - + |
fsPtr->closeMode = CLOSE_DEFAULT;
} else if (strncasecmp(value, "DRAIN", vlen) == 0) {
fsPtr->closeMode = CLOSE_DRAIN;
} else if (strncasecmp(value, "DISCARD", vlen) == 0) {
fsPtr->closeMode = CLOSE_DISCARD;
} else {
if (interp) {
|
| ︙ | |||
1038 1039 1040 1041 1042 1043 1044 | 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 | - + - - - + + + - + - + |
/*
* Reset to the initial state, whatever that is.
*/
memcpy(&iostate, &fsPtr->initState, sizeof(struct termios));
} else {
if (interp) {
|
| ︙ | |||
1147 1148 1149 1150 1151 1152 1153 | 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 | - + - + |
if (len == 0) {
Tcl_DStringAppendElement(dsPtr, "-inputmode");
}
if (len==0 || (len>1 && strncmp(optionName, "-inputmode", len)==0)) {
valid = 1;
if (tcgetattr(fsPtr->fileState.fd, &iostate) < 0) {
if (interp != NULL) {
|
| ︙ | |||
1257 1258 1259 1260 1261 1262 1263 | 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 | - + - + |
if ((len > 1) && (strncmp(optionName, "-winsize", len) == 0)) {
struct winsize ws;
valid = 1;
if (ioctl(fsPtr->fileState.fd, TIOCGWINSZ, &ws) < 0) {
if (interp != NULL) {
|
| ︙ | |||
1618 1619 1620 1621 1622 1623 1624 | 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 | - - - + + + |
i = sscanf(mode, "%d,%c,%d,%d%n",
&ttyPtr->baud,
&parity,
&ttyPtr->data,
&ttyPtr->stop, &end);
if ((i != 4) || (mode[end] != '\0')) {
if (interp != NULL) {
|
| ︙ | |||
1644 1645 1646 1647 1648 1649 1650 | 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 | - - - + + + - - - + + + - - - + + + |
#else
#define PARITY_CHARS "noe"
#define PARITY_MSG "n, o, or e"
#endif /* PAREXT */
if (strchr(PARITY_CHARS, parity) == NULL) {
if (interp != NULL) {
|
| ︙ | |||
1788 1789 1790 1791 1792 1793 1794 | 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 | - - - + + + - + - + |
(*TclGetString(pathPtr) == '~') /* possible tilde expansion */
) &&
Tcl_FSGetNormalizedPath(interp, pathPtr) == NULL
) {
return NULL;
}
|
| ︙ | |||
2080 2081 2082 2083 2084 2085 2086 | 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 | - - - + + - - - - + + - |
FILE *f;
chan = Tcl_GetChannel(interp, chanID, &chanMode);
if (chan == NULL) {
return TCL_ERROR;
}
if (forWriting && !(chanMode & TCL_WRITABLE)) {
|
| ︙ | |||
2118 2119 2120 2121 2122 2123 2124 | 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 | - - - - + + + + - - - + + - |
* The call to fdopen below is probably dangerous, since it will
* truncate an existing file if the file is being opened for
* writing....
*/
f = fdopen(fd, (forWriting ? "w" : "r"));
if (f == NULL) {
|
| ︙ |
Changes to unix/tclUnixFCmd.c.
| ︙ | |||
1335 1336 1337 1338 1339 1340 1341 | 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 | - + - + |
struct group *groupPtr;
int result;
result = TclpObjStat(fileName, &statBuf);
if (result != 0) {
if (interp != NULL) {
|
| ︙ | |||
1389 1390 1391 1392 1393 1394 1395 | 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 | - + - + |
struct passwd *pwPtr;
int result;
result = TclpObjStat(fileName, &statBuf);
if (result != 0) {
if (interp != NULL) {
|
| ︙ | |||
1440 1441 1442 1443 1444 1445 1446 | 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 | - + - + |
Tcl_StatBuf statBuf;
int result;
result = TclpObjStat(fileName, &statBuf);
if (result != 0) {
if (interp != NULL) {
|
| ︙ | |||
1497 1498 1499 1500 1501 1502 1503 | 1497 1498 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 1524 1525 1526 1527 1528 1529 | - + - - + + - - + - + |
}
native = Tcl_DStringValue(&ds);
groupPtr = TclpGetGrNam(native); /* INTL: Native. */
Tcl_DStringFree(&ds);
if (groupPtr == NULL) {
if (interp != NULL) {
|
| ︙ | |||
1568 1569 1570 1571 1572 1573 1574 | 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 1599 | - + - - + + - - + - + |
}
native = Tcl_DStringValue(&ds);
pwPtr = TclpGetPwNam(native); /* INTL: Native. */
Tcl_DStringFree(&ds);
if (pwPtr == NULL) {
if (interp != NULL) {
|
| ︙ | |||
1635 1636 1637 1638 1639 1640 1641 | 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 | - + - + - + - + - - + + - + - + |
if ((modeStringPtr[scanned] == '0')
&& (modeStringPtr[scanned+1] >= '0')
&& (modeStringPtr[scanned+1] <= '7')) {
/* Leading zero - attempt octal interpretation */
Tcl_Obj *modeObj;
TclNewLiteralStringObj(modeObj, "0o");
|
| ︙ | |||
2375 2376 2377 2378 2379 2380 2381 | 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 | - - + + |
static void
StatError(
Tcl_Interp *interp, /* The interp that has the error */
Tcl_Obj *fileName) /* The name of the file which caused the
* error. */
{
Tcl_WinConvertError(GetLastError());
|
| ︙ | |||
2528 2529 2530 2531 2532 2533 2534 | 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 | - + - + |
Tcl_StatBuf statBuf;
int result;
result = TclpObjStat(fileName, &statBuf);
if (result != 0) {
if (interp != NULL) {
|
| ︙ | |||
2574 2575 2576 2577 2578 2579 2580 | 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 | - + - + - + - + |
return TCL_ERROR;
}
result = TclpObjStat(fileName, &statBuf);
if (result != 0) {
if (interp != NULL) {
|
| ︙ |
Changes to unix/tclUnixFile.c.
| ︙ | |||
317 318 319 320 321 322 323 | 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | - + - + |
return TCL_OK;
}
d = TclOSopendir(native); /* INTL: Native. */
if (d == NULL) {
Tcl_DStringFree(&ds);
if (interp != NULL) {
|
| ︙ | |||
788 789 790 791 792 793 794 | 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 | - + - + |
#ifdef USEGETWD
if (getwd(buffer) == NULL) /* INTL: Native. */
#else
if (getcwd(buffer, MAXPATHLEN+1) == NULL) /* INTL: Native. */
#endif /* USEGETWD */
{
if (interp != NULL) {
|
| ︙ |
Changes to unix/tclUnixInit.c.
| ︙ | |||
825 826 827 828 829 830 831 | 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 | - + |
while ((q = strchr(p, ':')) != NULL) {
Tcl_ListObjAppendElement(NULL, pkgListObj, Tcl_NewStringObj(p, q-p));
p = q+1;
}
if (*p) {
Tcl_ListObjAppendElement(NULL, pkgListObj, Tcl_NewStringObj(p, -1));
}
|
| ︙ |
Changes to unix/tclUnixPipe.c.
| ︙ | |||
290 291 292 293 294 295 296 | 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | - + - + |
TclpTempFileNameForLibrary(
Tcl_Interp *interp, /* Tcl interpreter. */
TCL_UNUSED(Tcl_Obj *) /*path*/)
{
Tcl_Obj *retval = TclpTempFileName();
if (retval == NULL) {
|
| ︙ | |||
443 444 445 446 447 448 449 | 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | - - + + |
/*
* Create a pipe that the child can use to return error information if
* anything goes wrong.
*/
if (TclpCreatePipe(&errPipeIn, &errPipeOut) == 0) {
|
| ︙ | |||
606 607 608 609 610 611 612 | 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 | - - + + - - + |
TclStackFree(interp, newArgv);
TclStackFree(interp, dsArray);
if (pid == -1) {
#ifdef HAVE_POSIX_SPAWNP
errno = childErrno;
#endif
|
| ︙ | |||
912 913 914 915 916 917 918 | 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 | - - + + |
Tcl_Channel *rchan, /* Returned read side. */
Tcl_Channel *wchan, /* Returned write side. */
TCL_UNUSED(int) /*flags*/) /* Reserved for future use. */
{
int fileNums[2];
if (pipe(fileNums) < 0) {
|
| ︙ |
Changes to unix/tclUnixSock.c.
| ︙ | |||
824 825 826 827 828 829 830 | 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 | - + - + |
(const char *) &val, sizeof(int));
#else
ret = -1;
Tcl_SetErrno(ENOTSUP);
#endif
if (ret < 0) {
if (interp) {
|
| ︙ | |||
848 849 850 851 852 853 854 | 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 | - + - + |
(const char *) &val, sizeof(int));
#else
ret = -1;
Tcl_SetErrno(ENOTSUP);
#endif
if (ret < 0) {
if (interp) {
|
| ︙ | |||
973 974 975 976 977 978 979 | 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 | - - + + - |
* (len==0), don't flag an error at that point because it could be
* an fconfigure request on a server socket (which have no peer).
* Same must be done on win&mac.
*/
if (len) {
if (interp) {
|
| ︙ | |||
1016 1017 1018 1019 1020 1021 1022 | 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 | - - + + |
if (found) {
if (len) {
return TCL_OK;
}
Tcl_DStringEndSublist(dsPtr);
} else {
if (interp) {
|
| ︙ | |||
1460 1461 1462 1463 1464 1465 1466 | 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 | - - + + |
* Failure for either a synchronous connection, or an async one that
* failed before it could enter background mode, e.g. because an
* invalid -myaddr was given.
*/
if (interp != NULL) {
errno = error;
|
| ︙ | |||
1512 1513 1514 1515 1516 1517 1518 | 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 | - - + |
if (!TclCreateSocketAddress(interp, &addrlist, host, port, 0, &errorMsg)
|| !TclCreateSocketAddress(interp, &myaddrlist, myaddr, myport, 1,
&errorMsg)) {
if (addrlist != NULL) {
freeaddrinfo(addrlist);
}
if (interp != NULL) {
|
| ︙ | |||
1861 1862 1863 1864 1865 1866 1867 | 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 | - + - - + - - - - - - |
}
if (statePtr != NULL) {
statePtr->channel = Tcl_CreateChannel(&tcpChannelType, channelName,
statePtr, 0);
return statePtr->channel;
}
if (interp != NULL) {
|
| ︙ |
Changes to win/Makefile.in.
| ︙ | |||
583 584 585 586 587 588 589 590 591 592 593 594 595 596 | 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 | + |
@POST_MAKE_LIB@
${TCL_DLL_FILE}: ${TCL_LIB_FILE} ${TCL_OBJS} tcl.$(RES) @ZLIB_DLL_FILE@ @TOMMATH_DLL_FILE@ ${TCL_ZIP_FILE}
@$(RM) ${TCL_DLL_FILE} $(TCL_LIB_FILE)
@MAKE_DLL@ ${TCL_OBJS} tcl.$(RES) $(SHLIB_LD_LIBS)
$(COPY) tclsh.exe.manifest ${TCL_DLL_FILE}.manifest
@VC_MANIFEST_EMBED_DLL@
@-sleep 2
@if test "${ZIPFS_BUILD}" = "1" ; then \
cat ${TCL_ZIP_FILE} >> ${TCL_DLL_FILE}; \
fi
ifeq (,$(findstring --disable-shared,$(PKG_CFG_ARGS)))
${TCL_LIB_FILE}:
@$(RM) ${TCL_DLL_FILE} $(TCL_LIB_FILE)
|
| ︙ |
Changes to win/tclWinChan.c.
| ︙ | |||
891 892 893 894 895 896 897 | 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 | - + - + |
STORE_ELEM("mode", Tcl_NewWideIntObj(mode));
/*
* Windows only has files and directories, as far as we're concerned.
* Anything else and we definitely couldn't have got here anyway.
*/
if (attr & FILE_ATTRIBUTE_DIRECTORY) {
|
| ︙ | |||
930 931 932 933 934 935 936 | 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 | - + - + |
if ((len > 1) && (strncmp(optionName, "-stat", len) == 0)) {
Tcl_Obj *dictObj = StatOpenFile(infoPtr);
const char *dictContents;
Tcl_Size dictLength;
if (dictObj == NULL) {
|
| ︙ | |||
1000 1001 1002 1003 1004 1005 1006 | 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 | - - - - + + - - + - - + - + | /* * We need this just to ensure we return the correct error messages under * some circumstances (relative paths only), so because the normalization * is very expensive, don't invoke it for native or absolute paths. * Note: since paths starting with ~ are relative in 9.0 for windows, * it doesn't need to consider tilde expansion (in opposite to 8.x). */ |
| ︙ | |||
1070 1071 1072 1073 1074 1075 1076 | 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 | - + - + |
*/
if (NativeIsComPort(nativeName)) {
handle = TclWinSerialOpen(INVALID_HANDLE_VALUE, nativeName, accessMode);
if (handle == INVALID_HANDLE_VALUE) {
Tcl_WinConvertError(GetLastError());
if (interp) {
|
| ︙ | |||
1127 1128 1129 1130 1131 1132 1133 | 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 | - + - + |
if ((err & 0xFFFFL) == ERROR_OPEN_FAILED) {
err = TEST_FLAG(mode, O_CREAT) ? ERROR_FILE_EXISTS
: ERROR_FILE_NOT_FOUND;
}
Tcl_WinConvertError(err);
if (interp) {
|
| ︙ | |||
1151 1152 1153 1154 1155 1156 1157 | 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 | - + - + |
* fail, because the channel exists.
*/
handle = TclWinSerialOpen(handle, nativeName, accessMode);
if (handle == INVALID_HANDLE_VALUE) {
Tcl_WinConvertError(GetLastError());
if (interp) {
|
| ︙ | |||
1188 1189 1190 1191 1192 1193 1194 | 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 | - - + + - - + - |
default:
/*
* The handle is of an unknown type, probably /dev/nul equivalent or
* possibly a closed handle.
*/
channel = NULL;
|
| ︙ |
Changes to win/tclWinConsole.c.
| ︙ | |||
2274 2275 2276 2277 2278 2279 2280 | 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 | - + - + - + - - - + + + - + - + |
if ((chanInfoPtr->flags & CONSOLE_READ_OPS) && (len > 1) &&
(strncmp(optionName, "-inputmode", len) == 0)) {
DWORD mode;
if (GetConsoleMode(chanInfoPtr->handle, &mode) == 0) {
Tcl_WinConvertError(GetLastError());
if (interp != NULL) {
|
| ︙ | |||
2377 2378 2379 2380 2381 2382 2383 | 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 | - + - + |
if (len==0 || (len>1 && strncmp(optionName, "-inputmode", len)==0)) {
DWORD mode;
valid = 1;
if (GetConsoleMode(chanInfoPtr->handle, &mode) == 0) {
Tcl_WinConvertError(GetLastError());
if (interp != NULL) {
|
| ︙ | |||
2411 2412 2413 2414 2415 2416 2417 | 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 | - + - + |
CONSOLE_SCREEN_BUFFER_INFO consoleInfo;
valid = 1;
if (!GetConsoleScreenBufferInfo(chanInfoPtr->handle,
&consoleInfo)) {
Tcl_WinConvertError(GetLastError());
if (interp != NULL) {
|
| ︙ |
Changes to win/tclWinDde.c.
| ︙ | |||
377 378 379 380 381 382 383 | 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 | - + |
}
if (r == TCL_OK) {
r = Tcl_ListObjGetElements(interp, srvListPtr, &srvCount,
&srvPtrPtr);
}
if (r != TCL_OK) {
Tcl_DStringInit(&dString);
|
| ︙ |
Changes to win/tclWinFCmd.c.
| ︙ | |||
1476 1477 1478 1479 1480 1481 1482 | 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 | - - + + |
static void
StatError(
Tcl_Interp *interp, /* The interp that has the error */
Tcl_Obj *fileName) /* The name of the file which caused the
* error. */
{
Tcl_WinConvertError(GetLastError());
|
| ︙ | |||
1595 1596 1597 1598 1599 1600 1601 | 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 | - + - + |
Tcl_Size pathc, i, length;
Tcl_Obj *splitPath;
splitPath = Tcl_FSSplitPath(fileName, &pathc);
if (splitPath == NULL || pathc == 0) {
if (interp != NULL) {
|
| ︙ | |||
1875 1876 1877 1878 1879 1880 1881 | 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 | - + - + |
static int
CannotSetAttribute(
Tcl_Interp *interp, /* The interp we are using for errors. */
int objIndex, /* The index of the attribute. */
Tcl_Obj *fileName, /* The name of the file. */
TCL_UNUSED(Tcl_Obj *) /*attributePtr*/)
{
|
| ︙ |
Changes to win/tclWinFile.c.
| ︙ | |||
1034 1035 1036 1037 1038 1039 1040 | 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 | - + - + |
Tcl_DStringFree(&dsOrig);
return TCL_OK;
}
Tcl_WinConvertError(err);
if (interp != NULL) {
|
| ︙ | |||
1515 1516 1517 1518 1519 1520 1521 | 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 | - + |
/*
* User exists but has no home dir. Return
* "{GetProfilesDirectory}/<user>".
*/
GetProfilesDirectoryW(buf, &size);
Tcl_WCharToUtfDString(buf, size-1, bufferPtr);
|
| ︙ | |||
1941 1942 1943 1944 1945 1946 1947 | 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 | - + - + |
WCHAR buffer[MAX_PATH];
char *p;
WCHAR *native;
if (GetCurrentDirectoryW(MAX_PATH, buffer) == 0) {
Tcl_WinConvertError(GetLastError());
if (interp != NULL) {
|
| ︙ | |||
2618 2619 2620 2621 2622 2623 2624 | 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 | - + | * Tcl_GetStringFromObj(to, &pathLen); * nextCheckpoint = pathLen; * * So, instead we have to start from the beginning. */ nextCheckpoint = 0; |
| ︙ | |||
2792 2793 2794 2795 2796 2797 2798 | 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 | - + | */ Tcl_Obj *tmpPathPtr; Tcl_Size len; tmpPathPtr = Tcl_NewStringObj(Tcl_DStringValue(&ds), nextCheckpoint); |
| ︙ | |||
2865 2866 2867 2868 2869 2870 2871 | 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 | - + | * Path of form /foo/bar which is a path in the root directory of the * current volume. */ const char *drive = TclGetString(useThisCwd); absolutePath = Tcl_NewStringObj(drive,2); |
| ︙ | |||
2898 2899 2900 2901 2902 2903 2904 | 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 | - + - + - + |
if (drive[cwdLen-1] != '/' && (path[2] != '\0')) {
/*
* Only add a trailing '/' if needed, which is if there isn't
* one already, and if we are going to be adding some more
* characters.
*/
|
| ︙ |
Changes to win/tclWinInit.c.
| ︙ | |||
401 402 403 404 405 406 407 | 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | - + |
Tcl_GetEncodingNameFromEnvironment(
Tcl_DString *bufPtr)
{
UINT acp = GetACP();
Tcl_DStringInit(bufPtr);
if (acp == CP_UTF8) {
|
| ︙ |
Changes to win/tclWinLoad.c.
| ︙ | |||
129 130 131 132 133 134 135 | 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 | - + - + + - - + + - - - - + + + + + - - + + + - - - - + + + - - + + + - + |
* about any problem, but it's better than nothing. It'd be even
* better if there was a way to get what DLLs
*/
if (interp) {
switch (lastError) {
case ERROR_MOD_NOT_FOUND:
|
| ︙ | |||
221 222 223 224 225 226 227 | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | - - - + + |
Tcl_DStringInit(&ds);
TclDStringAppendLiteral(&ds, "_");
sym2 = Tcl_DStringAppend(&ds, symbol, TCL_INDEX_NONE);
proc = (void *)GetProcAddress(hInstance, sym2);
Tcl_DStringFree(&ds);
}
if (proc == NULL && interp != NULL) {
|
| ︙ | |||
288 289 290 291 292 293 294 | 290 291 292 293 294 295 296 297 298 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 | - + - + - + |
{
Tcl_Obj *fileName; /* Name of the temp file. */
Tcl_Obj *tail; /* Tail of the source path. */
Tcl_MutexLock(&dllDirectoryNameMutex);
if (dllDirectoryName == NULL) {
if (InitDLLDirectoryName() == TCL_ERROR) {
|
| ︙ |
Changes to win/tclWinPipe.c.
| ︙ | |||
1028 1029 1030 1031 1032 1033 1034 | 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 | - + - + |
}
} else {
DuplicateHandle(hProcess, inputHandle, hProcess, &startInfo.hStdInput,
0, TRUE, DUPLICATE_SAME_ACCESS);
}
if (startInfo.hStdInput == INVALID_HANDLE_VALUE) {
Tcl_WinConvertError(GetLastError());
|
| ︙ | |||
1057 1058 1059 1060 1061 1062 1063 | 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 1093 | - + - + - + - + |
&secAtts, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
} else {
DuplicateHandle(hProcess, outputHandle, hProcess,
&startInfo.hStdOutput, 0, TRUE, DUPLICATE_SAME_ACCESS);
}
if (startInfo.hStdOutput == INVALID_HANDLE_VALUE) {
Tcl_WinConvertError(GetLastError());
|
| ︙ | |||
1139 1140 1141 1142 1143 1144 1145 | 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 | - - + + |
BuildCommandLine(execPath, argc, argv, &cmdLine);
if (CreateProcessW(NULL, (WCHAR *) Tcl_DStringValue(&cmdLine),
NULL, NULL, TRUE, (DWORD) createFlags, NULL, NULL, &startInfo,
&procInfo) == 0) {
Tcl_WinConvertError(GetLastError());
|
| ︙ | |||
1388 1389 1390 1391 1392 1393 1394 | 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 | - - + + |
}
break;
}
Tcl_DStringFree(&nameBuf);
if (applType == APPL_NONE) {
Tcl_WinConvertError(GetLastError());
|
| ︙ | |||
1870 1871 1872 1873 1874 1875 1876 | 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 | - - + + |
sec.nLength = sizeof(SECURITY_ATTRIBUTES);
sec.lpSecurityDescriptor = NULL;
sec.bInheritHandle = FALSE;
if (!CreatePipe(&readHandle, &writeHandle, &sec, 0)) {
Tcl_WinConvertError(GetLastError());
|
| ︙ |
Changes to win/tclWinReg.c.
| ︙ | |||
1204 1205 1206 1207 1208 1209 1210 | 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 | - + - - - - |
REGSAM mode) /* Mode flags to pass. */
{
DWORD result, size;
Tcl_DString subkey;
HKEY hKey;
REGSAM saveMode = mode;
static int checkExProc = 0;
|
| ︙ | |||
1248 1249 1250 1251 1252 1253 1254 | 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 | - - + + - - + + |
*/
if (mode && !checkExProc) {
HMODULE handle;
checkExProc = 1;
handle = GetModuleHandleW(L"ADVAPI32");
|
| ︙ |
Changes to win/tclWinSerial.c.
| ︙ | |||
1648 1649 1650 1651 1652 1653 1654 | 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 | - + - - - + + + |
infoPtr->flags &= ~SERIAL_CLOSE_MASK;
infoPtr->flags |= SERIAL_CLOSE_DRAIN;
} else if (strncasecmp(value, "DISCARD", vlen) == 0) {
infoPtr->flags &= ~SERIAL_CLOSE_MASK;
infoPtr->flags |= SERIAL_CLOSE_DISCARD;
} else {
if (interp) {
|
| ︙ | |||
1674 1675 1676 1677 1678 1679 1680 | 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 | - + - - + + |
Tcl_DStringInit(&ds);
native = Tcl_UtfToWCharDString(value, TCL_INDEX_NONE, &ds);
result = BuildCommDCBW(native, &dcb);
Tcl_DStringFree(&ds);
if (result == FALSE) {
if (interp != NULL) {
|
| ︙ | |||
1738 1739 1740 1741 1742 1743 1744 | 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 | - + - - + + |
dcb.fOutxCtsFlow = TRUE;
dcb.fRtsControl = RTS_CONTROL_HANDSHAKE;
} else if (strncasecmp(value, "DTRDSR", vlen) == 0) {
dcb.fOutxDsrFlow = TRUE;
dcb.fDtrControl = DTR_CONTROL_HANDSHAKE;
} else {
if (interp != NULL) {
|
| ︙ | |||
1767 1768 1769 1770 1771 1772 1773 | 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 | - + - + - - + |
if (Tcl_SplitList(interp, value, &argc, &argv) == TCL_ERROR) {
return TCL_ERROR;
}
if (argc != 2) {
badXchar:
if (interp != NULL) {
|
| ︙ | |||
1825 1826 1827 1828 1829 1830 1831 | 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 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 | - + - - + + - - - - + + + - - - - + + + - - - - + + + - + - - + + - |
int res = TCL_OK;
if (Tcl_SplitList(interp, value, &argc, &argv) == TCL_ERROR) {
return TCL_ERROR;
}
if ((argc % 2) == 1) {
if (interp != NULL) {
|
| ︙ | |||
1918 1919 1920 1921 1922 1923 1924 | 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 | - + - - + + - + - + |
inSize = atoi(argv[0]);
outSize = atoi(argv[1]);
}
Tcl_Free((void *)argv);
if ((argc < 1) || (argc > 2) || (inSize <= 0) || (outSize <= 0)) {
if (interp != NULL) {
|
| ︙ | |||
1980 1981 1982 1983 1984 1985 1986 | 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 | - - + + - - - + + - - + + |
if (Tcl_GetInt(interp, value, &msec) != TCL_OK) {
return TCL_ERROR;
}
tout.ReadTotalTimeoutConstant = msec;
if (!SetCommTimeouts(infoPtr->handle, &tout)) {
if (interp != NULL) {
Tcl_WinConvertError(GetLastError());
|
| ︙ | |||
2086 2087 2088 2089 2090 2091 2092 | 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 | - - + + |
char parity;
const char *stop;
char buf[2 * TCL_INTEGER_SPACE + 16];
if (!GetCommState(infoPtr->handle, &dcb)) {
if (interp != NULL) {
Tcl_WinConvertError(GetLastError());
|
| ︙ | |||
2156 2157 2158 2159 2160 2161 2162 | 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 | - - + + |
if (len==0 || (len>1 && strncmp(optionName, "-xchar", len) == 0)) {
char buf[4];
valid = 1;
if (!GetCommState(infoPtr->handle, &dcb)) {
if (interp != NULL) {
Tcl_WinConvertError(GetLastError());
|
| ︙ | |||
2234 2235 2236 2237 2238 2239 2240 | 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 | - - + + |
if (len>4 && strncmp(optionName, "-ttystatus", len)==0) {
DWORD status;
if (!GetCommModemStatus(infoPtr->handle, &status)) {
if (interp != NULL) {
Tcl_WinConvertError(GetLastError());
|
| ︙ |
Changes to win/tclWinSock.c.
| ︙ | |||
1214 1215 1216 1217 1218 1219 1220 | 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 1245 1246 1247 1248 1249 1250 1251 | - + - + - + - + |
return TCL_ERROR;
}
rtn = setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE,
(const char *) &boolVar, sizeof(boolVar));
if (rtn != 0) {
Tcl_WinConvertError(WSAGetLastError());
if (interp) {
|
| ︙ | |||
1423 1424 1425 1426 1427 1428 1429 | 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 | - - + + - |
* an fconfigure request on a server socket (such sockets have no
* peer). {Copied from unix/tclUnixChan.c}
*/
if (len) {
Tcl_WinConvertError((DWORD) WSAGetLastError());
if (interp) {
|
| ︙ | |||
1497 1498 1499 1500 1501 1502 1503 | 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 | - - + + |
if (len) {
return TCL_OK;
}
Tcl_DStringEndSublist(dsPtr);
} else {
if (interp) {
Tcl_WinConvertError((DWORD) WSAGetLastError());
|
| ︙ | |||
1966 1967 1968 1969 1970 1971 1972 | 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 | - - + + |
}
/*
* Error message on synchronous connect
*/
if (interp != NULL) {
|
| ︙ | |||
2020 2021 2022 2023 2024 2025 2026 | 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 | - - + |
if (!TclCreateSocketAddress(interp, &addrlist, host, port, 0, &errorMsg)
|| !TclCreateSocketAddress(interp, &myaddrlist, myaddr, myport, 1,
&errorMsg)) {
if (addrlist != NULL) {
freeaddrinfo(addrlist);
}
if (interp != NULL) {
|
| ︙ | |||
2295 2296 2297 2298 2299 2300 2301 | 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 | - + - + |
Tcl_CloseEx(NULL, statePtr->channel, 0);
return NULL;
}
return statePtr->channel;
}
if (interp != NULL) {
|
| ︙ |