Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch tidy-indentation Excluding Merge-Ins
This is equivalent to a diff from 750dad1cdf to b356268e32
|
2024-04-23
| ||
| 16:06 | Hmm, something is broken. Leaving this here but this commit is definitely wrong somehow Leaf check-in: b356268e32 user: dkf tags: tidy-indentation | |
|
2024-04-18
| ||
| 15:25 | Merge 8.7 check-in: d6f9aacbe7 user: jan.nijtmans tags: trunk, main | |
| 15:06 | Tidy up some indentation and other little code style issues check-in: cb11914788 user: dkf tags: tidy-indentation | |
| 14:41 | Tcl_DuplicateObj can't return NULL check-in: 750dad1cdf user: dkf tags: trunk, main | |
|
2024-04-17
| ||
| 16:19 | Few additions to release notes check-in: 811ffd1e5e user: jan.nijtmans tags: trunk, main | |
Changes to generic/tcl.h.
| ︙ | |||
244 245 246 247 248 249 250 | 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | + - + | # else /* !__LP64__ */ # undef TCL_WIDE_INT_IS_LONG # undef TCL_CFG_DO64BIT # endif /* __LP64__ */ # undef HAVE_STRUCT_STAT64 #endif /* __APPLE__ */ /* |
| ︙ | |||
460 461 462 463 464 465 466 | 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 | - + - + - + - + |
* Structures filled in by Tcl_RegExpInfo. Note that all offset values are
* relative to the start of the match string, not the beginning of the entire
* string.
*/
typedef struct Tcl_RegExpIndices {
#if TCL_MAJOR_VERSION > 8
|
| ︙ | |||
613 614 615 616 617 618 619 | 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 | - - - - - + + + + + - - - - - - - + + + + + + - - - - + + + - - - - + + + | typedef void (Tcl_AlertNotifierProc) (void *clientData); typedef void (Tcl_ServiceModeHookProc) (int mode); typedef void *(Tcl_InitNotifierProc) (void); typedef void (Tcl_FinalizeNotifierProc) (void *clientData); typedef void (Tcl_MainLoopProc) (void); /* Abstract List functions */ |
| ︙ | |||
666 667 668 669 670 671 672 | 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 | - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + |
/* Called to convert the object's internal rep
* to this type. Frees the internal rep of the
* old type. Returns TCL_ERROR on failure. */
#if TCL_MAJOR_VERSION > 8
size_t version;
/* List emulation functions - ObjType Version 1 */
|
| ︙ | |||
745 746 747 748 749 750 751 | 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 | - + + - + |
* array as a readonly value. */
Tcl_Size length; /* The number of bytes at *bytes, not
* including the terminating null. */
const Tcl_ObjType *typePtr; /* Denotes the object's type. Always
* corresponds to the type of the object's
* internal rep. NULL indicates the object has
* no internal rep (has no type). */
|
| ︙ | |||
837 838 839 840 841 842 843 | 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 | - + - + |
int isNativeObjectProc; /* 1 if objProc was registered by a call to
* Tcl_CreateObjCommand; 2 if objProc was registered by
* a call to Tcl_CreateObjCommand2; 0 otherwise.
* Tcl_SetCmdInfo does not modify this field. */
Tcl_ObjCmdProc *objProc; /* Command's object-based function. */
void *objClientData; /* ClientData for object proc. */
Tcl_CmdProc *proc; /* Command's string-based function. */
|
| ︙ | |||
901 902 903 904 905 906 907 | 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 | - - - - + + + + - + - + | * Type values returned by Tcl_GetNumberFromObj * TCL_NUMBER_INT Representation is a Tcl_WideInt * TCL_NUMBER_BIG Representation is an mp_int * TCL_NUMBER_DOUBLE Representation is a double * TCL_NUMBER_NAN Value is NaN. */ |
| ︙ | |||
960 961 962 963 964 965 966 | 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 | - + - + | * o Run in iPtr->lookupNsPtr or global namespace * o Cut out of error traces * o Don't reset the flags controlling ensemble * error message rewriting. * TCL_CANCEL_UNWIND: Magical Tcl_CancelEval mode that causes the * stack for the script in progress to be * completely unwound. |
| ︙ | |||
1073 1074 1075 1076 1077 1078 1079 | 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 | - + |
*/
struct Tcl_HashEntry {
Tcl_HashEntry *nextPtr; /* Pointer to next entry in this hash bucket,
* or NULL for end of chain. */
Tcl_HashTable *tablePtr; /* Pointer to table containing entry. */
size_t hash; /* Hash value. */
|
| ︙ | |||
1097 1098 1099 1100 1101 1102 1103 | 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 | - - + + - - - - - - + + + + + + | * There are some things, pointers for example * which don't hash well because they do not use * the lower bits. If this flag is set then the * hash table will attempt to rectify this by * randomising the bits and then using the upper * N bits as the index into the table. * TCL_HASH_KEY_SYSTEM_HASH - If this flag is set then all memory internally |
| ︙ | |||
1169 1170 1171 1172 1173 1174 1175 | 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 | - + - + - + - + |
struct Tcl_HashTable {
Tcl_HashEntry **buckets; /* Pointer to bucket array. Each element
* points to first entry in bucket's hash
* chain, or NULL. */
Tcl_HashEntry *staticBuckets[TCL_SMALL_HASH_TABLE];
/* Bucket array used for small tables (to
* avoid mallocs and frees). */
|
| ︙ | |||
1772 1773 1774 1775 1776 1777 1778 | 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 | - - + + |
* token.
*/
typedef struct Tcl_Token {
int type; /* Type of token, such as TCL_TOKEN_WORD; see
* below for valid types. */
const char *start; /* First character in token. */
|
| ︙ | |||
1887 1888 1889 1890 1891 1892 1893 | 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 | - + - + |
*/
#define NUM_STATIC_TOKENS 20
typedef struct Tcl_Parse {
const char *commentStart; /* Pointer to # that begins the first of one
* or more comments preceding the command. */
|
| ︙ | |||
1963 1964 1965 1966 1967 1968 1969 | 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 | - + |
* into UTF-8. */
Tcl_EncodingConvertProc *fromUtfProc;
/* Function to convert from UTF-8 into
* external encoding. */
Tcl_FreeProc *freeProc;
/* If non-NULL, function to call when this
* encoding is deleted. */
|
| ︙ | |||
2169 2170 2171 2172 2173 2174 2175 | 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 | - + |
* argv array. */
void *srcPtr; /* Value to be used in setting dst; usage
* depends on type.*/
void *dstPtr; /* Address of value to be modified; usage
* depends on type.*/
const char *helpStr; /* Documentation message describing this
* option. */
|
| ︙ | |||
2497 2498 2499 2500 2501 2502 2503 | 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 | - + + + + + - - + + - - - - - + + + + + - + + + - - + + |
* Tcl_DecrRefCount(objPtr);
*
* This will free the obj if there are no references to the obj.
*/
# define Tcl_BounceRefCount(objPtr) \
TclBounceRefCount(objPtr, __FILE__, __LINE__)
|
| ︙ |
Changes to generic/tclAlloc.c.
| ︙ | |||
43 44 45 46 47 48 49 | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | - - + + + - - - - + + + + - + - + - |
* enabled then a second word holds the size of the requested block, less 1,
* rounded up to a multiple of sizeof(RMAGIC). The order of elements is
* critical: ov.magic must overlay the low order bits of ov.next, and ov.magic
* can not be a valid ov.next bit pattern.
*/
union overhead {
|
| ︙ | |||
247 248 249 250 251 252 253 | 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | - + | * None. * *---------------------------------------------------------------------- */ void * TclpAlloc( |
| ︙ | |||
381 382 383 384 385 386 387 | 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 | - + - + | * Attempts to get more memory from the system. * *---------------------------------------------------------------------- */ static void MoreCore( |
| ︙ | |||
507 508 509 510 511 512 513 | 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 | - + |
*
*----------------------------------------------------------------------
*/
void *
TclpRealloc(
void *oldPtr, /* Pointer to alloc'ed block. */
|
| ︙ | |||
690 691 692 693 694 695 696 | 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 | - + | * *---------------------------------------------------------------------- */ #undef TclpAlloc void * TclpAlloc( |
| ︙ | |||
739 740 741 742 743 744 745 | 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 | - + |
*
*----------------------------------------------------------------------
*/
void *
TclpRealloc(
void *oldPtr, /* Pointer to alloced block. */
|
| ︙ |
Changes to generic/tclArithSeries.c.
| ︙ | |||
93 94 95 96 97 98 99 | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | - - - - - + + + + + - - - + + + |
int *boolResult);
static int TclArithSeriesObjStep(Tcl_Obj *arithSeriesObj,
Tcl_Obj **stepObj);
/* ------------------------ ArithSeries object type -------------------------- */
static const Tcl_ObjType arithSeriesType = {
|
| ︙ | |||
545 546 547 548 549 550 551 | 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 | - - + - - - - - - - - - + + + + + + + + | * TclNewArithSeriesObj -- * * Creates a new ArithSeries object. Some arguments may be NULL and will * be computed based on the other given arguments. * refcount = 0. * * Results: |
| ︙ | |||
660 661 662 663 664 665 666 | 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 | - - | * Returns the element with the specified index in the list * represented by the specified Arithmetic Sequence object. * If the index is out of range, TCL_ERROR is returned, * otherwise TCL_OK is returned and the integer value of the * element is stored in *element. * * Results: |
| ︙ | |||
701 702 703 704 705 706 707 | 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 | - - | *---------------------------------------------------------------------- * * ArithSeriesObjLength * * Returns the length of the arithmetic series. * * Results: |
| ︙ | |||
728 729 730 731 732 733 734 | 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 | - - + - | * * TclArithSeriesObjStep -- * * Return a Tcl_Obj with the step value from the give ArithSeries Obj. * refcount = 0. * * Results: |
| ︙ | |||
765 766 767 768 769 770 771 | 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 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 811 812 | - - - - - + + - + - + - + | * The Arithmetic Series object is just an way to optimize * Lists space complexity, so no one should try to convert * a string to an Arithmetic Series object. * * This function is here just to populate the Type structure. * * Results: |
| ︙ | |||
1012 1013 1014 1015 1016 1017 1018 | 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 | - + | * Side effects: * The ogiginal obj will be modified and returned if it is not Shared. * *---------------------------------------------------------------------- */ int TclArithSeriesObjReverse( |
| ︙ | |||
1198 1199 1200 1201 1202 1203 1204 | 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 | - | * Boolean true or false (1/0) * * Side effects: * None * *---------------------------------------------------------------------- */ |
| ︙ |
Changes to generic/tclAssembly.c.
| ︙ | |||
218 219 220 221 222 223 224 | 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | - + - + |
typedef struct AssemblyEnv {
CompileEnv* envPtr; /* Compilation environment being used for code
* generation */
Tcl_Parse* parsePtr; /* Parse of the current line of source */
Tcl_HashTable labelHash; /* Hash table whose keys are labels and whose
* values are 'label' objects storing the code
* offsets of the labels. */
|
| ︙ | |||
273 274 275 276 277 278 279 | 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | - + | static void CompileEmbeddedScript(AssemblyEnv*, Tcl_Token*, const TalInstDesc*); static int DefineLabel(AssemblyEnv* envPtr, const char* label); static void DeleteMirrorJumpTable(JumptableInfo* jtPtr); static void FillInJumpOffsets(AssemblyEnv*); static int CreateMirrorJumpTable(AssemblyEnv* assemEnvPtr, Tcl_Obj* jumpTable); |
| ︙ | |||
1267 1268 1269 1270 1271 1272 1273 | 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 | - + |
TalInstType instType; /* Type of the instruction */
Tcl_Obj* operand1Obj = NULL;
/* First operand to the instruction */
const char* operand1; /* String rep of the operand */
Tcl_Size operand1Len; /* String length of the operand */
int opnd; /* Integer representation of an operand */
int litIndex; /* Literal pool index of a constant */
|
| ︙ | |||
1298 1299 1300 1301 1302 1303 1304 | 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 | - |
/*
* Vector on the type of instruction being processed.
*/
instType = TalInstructionTable[tblIdx].instType;
switch (instType) {
|
| ︙ | |||
1964 1965 1966 1967 1968 1969 1970 | 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 | - + |
*/
static int
CreateMirrorJumpTable(
AssemblyEnv* assemEnvPtr, /* Assembly environment */
Tcl_Obj* jumps) /* List of alternating keywords and labels */
{
|
| ︙ |
Changes to generic/tclAsync.c.
| ︙ | |||
26 27 28 29 30 31 32 | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | - + - + |
* invoked in the next call to
* Tcl_AsyncInvoke. */
struct AsyncHandler *nextPtr, *prevPtr;
/* Next, previous in list of all handlers
* for the process. */
Tcl_AsyncProc *proc; /* Procedure to call when handler is
* invoked. */
|
| ︙ | |||
138 139 140 141 142 143 144 | 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | - + |
*----------------------------------------------------------------------
*/
Tcl_AsyncHandler
Tcl_AsyncCreate(
Tcl_AsyncProc *proc, /* Procedure to call when handler is
* invoked. */
|
| ︙ | |||
186 187 188 189 190 191 192 | 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 | - + - | * The handler gets marked for invocation later. * *---------------------------------------------------------------------- */ void Tcl_AsyncMark( |
| ︙ | |||
220 221 222 223 224 225 226 | 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | - - + + | * The handler gets marked for invocation later. * *---------------------------------------------------------------------- */ int Tcl_AsyncMarkFromSignal( |
| ︙ | |||
374 375 376 377 378 379 380 | 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 | - + | * deleted by some other thread. * *---------------------------------------------------------------------- */ void Tcl_AsyncDelete( |
| ︙ |
Changes to generic/tclBasic.c.
| ︙ | |||
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | + + + + + + + + - + - + - |
/*
* TCL_FPCLASSIFY_MODE:
* 0 - fpclassify
* 1 - _fpclass
* 2 - simulate
* 3 - __builtin_fpclassify
*
* Not directly used; handled by preprocessor.
*/
enum ClassifyModes {
MODE_FPCLASSIFY = 0, /* Use fpclassify(), C99 standard */
MODE_FPCLASS = 1, /* Use _fpclass() */
MODE_SIMULATE = 2, /* Simulate */
MODE_BUILTIN = 3 /* Use __builtin_fpclassify() */
};
#ifndef TCL_FPCLASSIFY_MODE
#if defined(__MINGW32__) && defined(_X86_) /* mingw 32-bit */
/*
* MINGW x86 (tested up to gcc 8.1) seems to have a bug in fpclassify,
* [fpclassify 1e-314], x86 => normal, x64 => subnormal, so switch to using a
* version using a compiler built-in.
*/
#define TCL_FPCLASSIFY_MODE 1
|
| ︙ | |||
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 303 304 305 306 307 308 309 310 311 312 | + - - - + + + + - + - - - - + + + + |
const char *name; /* Name of object-based command. */
Tcl_ObjCmdProc *objProc; /* Object-based function for command. */
CompileProc *compileProc; /* Function called to compile command. */
Tcl_ObjCmdProc *nreProc; /* NR-based function for command */
int flags; /* Various flag bits, as defined below. */
} CmdInfo;
enum CmdInfoFlags {
|
| ︙ | |||
624 625 626 627 628 629 630 | 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 | - - + + |
Tcl_DeleteHashTable(&cancelTable);
cancelTableInitialized = 0;
}
Tcl_MutexUnlock(&cancelLock);
Tcl_MutexLock(&commandTypeLock);
if (commandTypeInit) {
|
| ︙ | |||
815 816 817 818 819 820 821 | 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 | - - - - - - - - - - + + + + + + + + + + |
}
Tcl_MutexUnlock(&cancelLock);
}
#undef TclObjInterpProc
if (commandTypeInit == 0) {
|
| ︙ | |||
937 938 939 940 941 942 943 | 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 | - + |
iPtr->threadId = Tcl_GetCurrentThread();
/* TIP #378 */
#ifdef TCL_INTERP_DEBUG_FRAME
iPtr->flags |= INTERP_DEBUG_FRAME;
#else
if (getenv("TCL_INTERP_DEBUG_FRAME") != NULL) {
|
| ︙ | |||
1094 1095 1096 1097 1098 1099 1100 | 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 | - - - + + + | cmdPtr->proc = NULL; cmdPtr->clientData = cmdPtr; cmdPtr->objProc = cmdInfoPtr->objProc; cmdPtr->objClientData = NULL; cmdPtr->deleteProc = NULL; cmdPtr->deleteData = NULL; cmdPtr->flags = 0; |
| ︙ | |||
1156 1157 1158 1159 1160 1161 1162 | 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 | - - + + - + - |
Tcl_CreateObjCommand(interp, "::tcl::unsupported::getbytecode",
Tcl_DisassembleObjCmd, INT2PTR(1), NULL);
Tcl_CreateObjCommand(interp, "::tcl::unsupported::representation",
Tcl_RepresentationCmd, NULL, NULL);
/* Adding the bytecode assembler command */
cmdPtr = (Command *) Tcl_NRCreateCommand(interp,
|
| ︙ | |||
1344 1345 1346 1347 1348 1349 1350 | 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 | - - + + - + - - - + + + - - - - - + + + + + - + - + - - - + + + |
Tcl_ObjCmdProc *implementationProc,
const char *nameStr)
{
Tcl_HashEntry *hPtr;
Tcl_MutexLock(&commandTypeLock);
if (commandTypeInit == 0) {
|
| ︙ | |||
1420 1421 1422 1423 1424 1425 1426 | 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 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 1470 1471 1472 1473 1474 1475 1476 | - - - - - + + + + + - - - - + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + |
for (cmdInfoPtr = builtInCmds; cmdInfoPtr->name != NULL; cmdInfoPtr++) {
if (!(cmdInfoPtr->flags & CMD_IS_SAFE)) {
Tcl_HideCommand(interp, cmdInfoPtr->name, cmdInfoPtr->name);
}
}
for (unsafePtr = unsafeEnsembleCommands;
|
| ︙ | |||
1488 1489 1490 1491 1492 1493 1494 | 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 | - - + + |
Tcl_Interp *interp,
TCL_UNUSED(int) /*objc*/,
TCL_UNUSED(Tcl_Obj *const *) /* objv */)
{
const UnsafeEnsembleInfo *infoPtr = (const UnsafeEnsembleInfo *)clientData;
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
| ︙ | |||
1520 1521 1522 1523 1524 1525 1526 | 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 | - + |
*/
void
Tcl_CallWhenDeleted(
Tcl_Interp *interp, /* Interpreter to watch. */
Tcl_InterpDeleteProc *proc, /* Function to call when interpreter is about
* to be deleted. */
|
| ︙ | |||
1568 1569 1570 1571 1572 1573 1574 | 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 | - + |
*/
void
Tcl_DontCallWhenDeleted(
Tcl_Interp *interp, /* Interpreter to watch. */
Tcl_InterpDeleteProc *proc, /* Function to call when interpreter is about
* to be deleted. */
|
| ︙ | |||
1616 1617 1618 1619 1620 1621 1622 | 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 | - + |
void
Tcl_SetAssocData(
Tcl_Interp *interp, /* Interpreter to associate with. */
const char *name, /* Name for association. */
Tcl_InterpDeleteProc *proc, /* Proc to call when interpreter is about to
* be deleted. */
|
| ︙ | |||
1933 1934 1935 1936 1937 1938 1939 | 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 | - |
for (; hPtr != NULL; hPtr = Tcl_NextHashEntry(&search)) {
Tcl_DeleteCommandFromToken(interp, (Tcl_Command)Tcl_GetHashValue(hPtr));
}
Tcl_DeleteHashTable(hTablePtr);
Tcl_Free(hTablePtr);
}
|
| ︙ | |||
2186 2187 2188 2189 2190 2191 2192 | 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 | - + |
* the token too. - dl
*/
if (strstr(hiddenCmdToken, "::") != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"cannot use namespace qualifiers in hidden command"
" token (rename)", -1));
|
| ︙ | |||
2209 2210 2211 2212 2213 2214 2215 | 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 | - - - + + + |
/*
* Check that the command is really in global namespace
*/
if (cmdPtr->nsPtr != iPtr->globalNsPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
2235 2236 2237 2238 2239 2240 2241 | 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 | - - - + + + |
* hiddenCmdToken if a hidden command with the name hiddenCmdToken already
* exists.
*/
hPtr = Tcl_CreateHashEntry(hiddenCmdTablePtr, hiddenCmdToken, &isNew);
if (!isNew) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
| ︙ | |||
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 | - - - + + + - - - + + + |
* 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) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
2395 2396 2397 2398 2399 2400 2401 | 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 | - - + + |
* It is an error to overwrite an existing exposed command as a result of
* exposing a previously hidden command.
*/
hPtr = Tcl_CreateHashEntry(&nsPtr->cmdTable, cmdName, &isNew);
if (!isNew) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
| ︙ | |||
2493 2494 2495 2496 2497 2498 2499 | 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 | - + |
Tcl_Interp *interp, /* Token for command interpreter returned by a
* previous call to Tcl_CreateInterp. */
const char *cmdName, /* Name of command. If it contains namespace
* qualifiers, the new command is put in the
* specified namespace; otherwise it is put in
* the global namespace. */
Tcl_CmdProc *proc, /* Function to associate with cmdName. */
|
| ︙ | |||
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 | - - - + + + - + - + - + - + - + - + - - + + |
* If the command name we seek to create already exists, we need to
* delete that first. That can be tricky in the presence of traces.
* Loop until we no longer find an existing command in the way, or
* until we've deleted one command and that didn't finish the job.
*/
while (1) {
|
| ︙ | |||
2682 2683 2684 2685 2686 2687 2688 | 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 | - + - + - |
* on the calling sequence.
*
*----------------------------------------------------------------------
*/
typedef struct {
Tcl_ObjCmdProc2 *proc;
|
| ︙ | |||
2727 2728 2729 2730 2731 2732 2733 | 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 | - + - + - |
* previous call to Tcl_CreateInterp). */
const char *cmdName, /* Name of command. If it contains namespace
* qualifiers, the new command is put in the
* specified namespace; otherwise it is put in
* the global namespace. */
Tcl_ObjCmdProc2 *proc, /* Object-based function to associate with
* name. */
|
| ︙ | |||
2755 2756 2757 2758 2759 2760 2761 | 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 | - + - + - |
* previous call to Tcl_CreateInterp). */
const char *cmdName, /* Name of command. If it contains namespace
* qualifiers, the new command is put in the
* specified namespace; otherwise it is put in
* the global namespace. */
Tcl_ObjCmdProc *proc, /* Object-based function to associate with
* name. */
|
| ︙ | |||
2784 2785 2786 2787 2788 2789 2790 | 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 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 | - + - - + + - + |
* otherwise, we always put it in the global namespace.
*/
if (strstr(cmdName, "::") != NULL) {
Namespace *dummy1, *dummy2;
TclGetNamespaceForQualName(interp, cmdName, NULL,
|
| ︙ | |||
2837 2838 2839 2840 2841 2842 2843 | 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 | - - + + - - + + - + | * isNew - No conflict with existing command. * deleted - We've already deleted a conflicting command */ break; } /* |
| ︙ | |||
2974 2975 2976 2977 2978 2979 2980 | 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 | - + - + | * InvokeStringCommand allocates and frees storage. * *---------------------------------------------------------------------- */ int InvokeStringCommand( |
| ︙ | |||
3048 3049 3050 3051 3052 3053 3054 | 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 | - + - + |
* found.
*/
cmd = Tcl_FindCommand(interp, oldName, NULL, /*flags*/ 0);
cmdPtr = (Command *) cmd;
if (cmdPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
| ︙ | |||
3081 3082 3083 3084 3085 3086 3087 | 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 | - - + + - - - + + + |
*/
TclGetNamespaceForQualName(interp, newName, NULL,
TCL_CREATE_NS_IF_UNKNOWN, &newNsPtr, &dummy1, &dummy2, &newTail);
if ((newNsPtr == NULL) || (newTail == NULL)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
| ︙ | |||
3262 3263 3264 3265 3266 3267 3268 | 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 | - + | * None. * *---------------------------------------------------------------------- */ static int invokeObj2Command( |
| ︙ | |||
3916 3917 3918 3919 3920 3921 3922 | 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 | - + | * Transfers a message from the cancellation message to the interpreter. * *---------------------------------------------------------------------- */ static int CancelEvalProc( |
| ︙ | |||
3994 3995 3996 3997 3998 3999 4000 | 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 | - + | * deleted or when the last ByteCode referring to it is freed. * *---------------------------------------------------------------------- */ void TclCleanupCommand( |
| ︙ | |||
4146 4147 4148 4149 4150 4151 4152 | 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 | - + - + - - + + - - - - + + + + - - - - - + + + + + - - - - - - - - - - - + + + + + + + + + + + - - + + |
/*
* Has the current script in progress for this interpreter been canceled
* or is the stack being unwound due to the previous script cancellation?
*/
if (!TclCanceled(iPtr)) {
|
| ︙ | |||
4242 4243 4244 4245 4246 4247 4248 | 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 | - + |
int
Tcl_CancelEval(
Tcl_Interp *interp, /* Interpreter in which to cancel the
* script. */
Tcl_Obj *resultObjPtr, /* The script cancellation error message or
* NULL for a default error message. */
|
| ︙ | |||
4388 4389 4390 4391 4392 4393 4394 | 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 | - + |
* data[1] stores a marker for use by tailcalls; it will be set to 1 by
* command redirectors (imports, alias, ensembles) so that tailcall skips
* this callback (that marks the end of the target command) and goes back
* to the end of the source command.
*/
if (iPtr->deferredCallbacks) {
|
| ︙ | |||
4439 4440 4441 4442 4443 4444 4445 | 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 4493 4494 4495 4496 4497 4498 | - - - - + + - - + + |
}
/*
* Configure evaluation context to match the requested flags.
*/
if (iPtr->lookupNsPtr) {
|
| ︙ | |||
4613 4614 4615 4616 4617 4618 4619 | 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 | - - + + - - - + + + |
Tcl_Interp *interp,
int result,
struct NRE_callback *rootPtr)
/* All callbacks down to rootPtr not inclusive
* are to be run. */
{
while (TOP_CB(interp) != rootPtr) {
|
| ︙ | |||
4866 4867 4868 4869 4870 4871 4872 | 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 | - - - + + + |
* 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) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
| ︙ | |||
5067 5068 5069 5070 5071 5072 5073 | 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 | - + |
int
Tcl_EvalTokensStandard(
Tcl_Interp *interp, /* Interpreter in which to lookup variables,
* execute nested commands, and report
* errors. */
Tcl_Token *tokenPtr, /* Pointer to first in an array of tokens to
* evaluate and concatenate. */
|
| ︙ | |||
5122 5123 5124 5125 5126 5127 5128 | 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 | - + |
Tcl_Size numBytes, /* Number of bytes in script. If -1, the
* script consists of all bytes up to the
* first NUL character. */
int flags, /* Collection of OR-ed bits that control the
* evaluation of the script. Only
* TCL_EVAL_GLOBAL is currently supported. */
Tcl_Size line, /* The line the script starts on. */
|
| ︙ | |||
5153 5154 5155 5156 5157 5158 5159 | 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 | - + - - + |
Tcl_Token *tokenPtr;
int expandRequested, code = TCL_OK;
Tcl_Size bytesLeft, commandLength;
CallFrame *savedVarFramePtr;/* Saves old copy of iPtr->varFramePtr in case
* TCL_EVAL_GLOBAL was set. */
int allowExceptions = (iPtr->evalFlags & TCL_ALLOW_EXCEPTIONS);
int gotParse = 0;
|
| ︙ | |||
5363 5364 5365 5366 5367 5368 5369 | 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 | - | Tcl_DecrRefCount(objv[objectsUsed]); break; } expandRequested = 1; expand[objectsUsed] = 1; additionalObjsCount = (numElements ? numElements : 1); |
| ︙ | |||
5844 5845 5846 5847 5848 5849 5850 | 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 | - + |
* evaluation are not supposed to get compiled, because a command
* such as [info level] in the script can expose some of the dispatch
* shenanigans. This means that we don't have to tend to the
* housekeeping, and can escape now.
*/
if (ePtr->nline != objc) {
|
| ︙ | |||
6052 6053 6054 6055 6056 6057 6058 | 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 | - + - + - + |
*----------------------------------------------------------------------
*/
int
Tcl_EvalObjEx(
Tcl_Interp *interp, /* Token for command interpreter (returned by
* a previous call to Tcl_CreateInterp). */
|
| ︙ | |||
6169 6170 6171 6172 6173 6174 6175 | 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 | - + - - - + + + - + | iPtr->cmdFramePtr = eoFramePtr; flags |= TCL_EVAL_SOURCE_IN_FRAME; } TclMarkTailcall(interp); |
| ︙ | |||
6485 6486 6487 6488 6489 6490 6491 | 6485 6486 6487 6488 6489 6490 6491 6492 6493 6494 6495 6496 6497 6498 6499 | - + |
*--------------------------------------------------------------
*/
int
Tcl_ExprLongObj(
Tcl_Interp *interp, /* Context in which to evaluate the
* expression. */
|
| ︙ | |||
6532 6533 6534 6535 6536 6537 6538 | 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 | - + |
return result;
}
int
Tcl_ExprDoubleObj(
Tcl_Interp *interp, /* Context in which to evaluate the
* expression. */
|
| ︙ | |||
6608 6609 6610 6611 6612 6613 6614 | 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 | - + |
*----------------------------------------------------------------------
*/
int
TclObjInvokeNamespace(
Tcl_Interp *interp, /* Interpreter in which command is to be
* invoked. */
|
| ︙ | |||
6652 6653 6654 6655 6656 6657 6658 | 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 | - + - + |
*----------------------------------------------------------------------
*/
int
TclObjInvoke(
Tcl_Interp *interp, /* Interpreter in which command is to be
* invoked. */
|
| ︙ | |||
6693 6694 6695 6696 6697 6698 6699 | 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 | - - - + + + |
cmdName = TclGetString(objv[0]);
hTblPtr = iPtr->hiddenCmdTablePtr;
if (hTblPtr != NULL) {
hPtr = Tcl_FindHashEntry(hTblPtr, cmdName);
}
if (hPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
| ︙ | |||
7183 7184 7185 7186 7187 7188 7189 | 7183 7184 7185 7186 7187 7188 7189 7190 7191 7192 7193 7194 7195 7196 7197 | - + |
}
Tcl_SetObjResult(interp, Tcl_NewBignumObj(&root));
}
return TCL_OK;
negarg:
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
7243 7244 7245 7246 7247 7248 7249 | 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 | - + |
Tcl_SetObjResult(interp, Tcl_NewDoubleObj(sqrt(d)));
}
return TCL_OK;
}
static int
ExprUnaryFunc(
|
| ︙ | |||
7307 7308 7309 7310 7311 7312 7313 | 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 | - + |
}
Tcl_SetObjResult(interp, Tcl_NewDoubleObj(dResult));
return TCL_OK;
}
static int
ExprBinaryFunc(
|
| ︙ | |||
7611 7612 7613 7614 7615 7616 7617 | 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 7632 7633 7634 7635 7636 7637 7638 | - - - - - - - + + + + + + + - - - - - - + + + + + + |
if (objc < 2) {
MathFuncWrongNumArgs(interp, 2, objc, objv);
return TCL_ERROR;
}
res = objv[1];
for (i = 1; i < objc; i++) {
|
| ︙ | |||
7912 7913 7914 7915 7916 7917 7918 | 7912 7913 7914 7915 7916 7917 7918 7919 7920 7921 7922 7923 7924 7925 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 | - - - - - + + + + + - + - - - - - - - - - - + + + + + + + + + + - - + + - - - + + + - - - + + + - + - - - + + + - + - - - + + + - + - + - + - + - + - + - + |
return fpclassify(d);
#else /* TCL_FPCLASSIFY_MODE != 0 */
/*
* If we don't have fpclassify(), we also don't have the values it returns.
* Hence we define those here.
*/
#ifndef FP_NAN
|
| ︙ | |||
8032 8033 8034 8035 8036 8037 8038 | 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 | - + - - - - - + + + + + |
if (objc != 2) {
MathFuncWrongNumArgs(interp, 2, objc, objv);
return TCL_ERROR;
}
if (Tcl_GetNumberFromObj(interp, objv[1], &ptr, &type) != TCL_OK) {
|
| ︙ | |||
8063 8064 8065 8066 8067 8068 8069 | 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 | - + - - - - + + + + |
if (objc != 2) {
MathFuncWrongNumArgs(interp, 2, objc, objv);
return TCL_ERROR;
}
if (Tcl_GetNumberFromObj(interp, objv[1], &ptr, &type) != TCL_OK) {
|
| ︙ | |||
8093 8094 8095 8096 8097 8098 8099 | 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 | - + - - - - + + + + |
if (objc != 2) {
MathFuncWrongNumArgs(interp, 2, objc, objv);
return TCL_ERROR;
}
if (Tcl_GetNumberFromObj(interp, objv[1], &ptr, &type) != TCL_OK) {
|
| ︙ | |||
8123 8124 8125 8126 8127 8128 8129 | 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 | - + - - - - + + + + |
if (objc != 2) {
MathFuncWrongNumArgs(interp, 2, objc, objv);
return TCL_ERROR;
}
if (Tcl_GetNumberFromObj(interp, objv[1], &ptr, &type) != TCL_OK) {
|
| ︙ | |||
8153 8154 8155 8156 8157 8158 8159 | 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 | - + - - - - + + + + |
if (objc != 2) {
MathFuncWrongNumArgs(interp, 2, objc, objv);
return TCL_ERROR;
}
if (Tcl_GetNumberFromObj(interp, objv[1], &ptr, &type) != TCL_OK) {
|
| ︙ | |||
8183 8184 8185 8186 8187 8188 8189 | 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 | - + - + - - + + - + - + - - + + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - - + + + |
if (objc != 3) {
MathFuncWrongNumArgs(interp, 3, objc, objv);
return TCL_ERROR;
}
if (Tcl_GetNumberFromObj(interp, objv[1], &ptr, &type) != TCL_OK) {
|
| ︙ | |||
8571 8572 8573 8574 8575 8576 8577 | 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 | - + |
* specified namespace; otherwise it is put in
* the global namespace. */
Tcl_ObjCmdProc2 *proc, /* Object-based function to associate with
* name, provides direct access for direct
* calls. */
Tcl_ObjCmdProc2 *nreProc, /* Object-based function to associate with
* name, provides NR implementation */
|
| ︙ | |||
8602 8603 8604 8605 8606 8607 8608 | 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 | - + - + - - + + |
* specified namespace; otherwise it is put in
* the global namespace. */
Tcl_ObjCmdProc *proc, /* Object-based function to associate with
* name, provides direct access for direct
* calls. */
Tcl_ObjCmdProc *nreProc, /* Object-based function to associate with
* name, provides NR implementation */
|
| ︙ | |||
8651 8652 8653 8654 8655 8656 8657 | 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 | - + |
return TclNREvalObjEx(interp, objPtr, flags, NULL, INT_MIN);
}
int
Tcl_NREvalObjv(
Tcl_Interp *interp, /* Interpreter in which to evaluate the
* command. Also used for error reporting. */
|
| ︙ | |||
8710 8711 8712 8713 8714 8715 8716 | 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 | - - + + |
TclMarkTailcall(
Tcl_Interp *interp)
{
Interp *iPtr = (Interp *) interp;
if (iPtr->deferredCallbacks == NULL) {
TclNRAddCallback(interp, NRCommand, NULL, NULL,
|
| ︙ | |||
8758 8759 8760 8761 8762 8763 8764 | 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 | - - - + + + - + |
* being tailcalled. Note that we skip NRCommands marked by a 1 in data[1]
* (used by command redirectors).
*/
NRE_callback *runPtr;
for (runPtr = TOP_CB(interp); runPtr; runPtr = runPtr->nextPtr) {
|
| ︙ | |||
8799 8800 8801 8802 8803 8804 8805 | 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 | - - - + + + - - + + - - + + - - - - + + + + - - + + - + |
if (objc < 1) {
Tcl_WrongNumArgs(interp, 1, objv, "?command? ?arg ...?");
return TCL_ERROR;
}
if (!(iPtr->varFramePtr->isProcCallFrame & 1)) {
|
| ︙ | |||
8869 8870 8871 8872 8873 8874 8875 | 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 | - - - - + + + + - + |
nsObjPtr = objv[0];
if (result == TCL_OK) {
result = TclGetNamespaceFromObj(interp, nsObjPtr, &nsPtr);
}
if (result != TCL_OK) {
|
| ︙ | |||
8962 8963 8964 8965 8966 8967 8968 | 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 8976 8977 8978 8979 8980 8981 8982 8983 8984 8985 8986 8987 | - + - + |
if (objc > 2) {
Tcl_WrongNumArgs(interp, 1, objv, "?returnValue?");
return TCL_ERROR;
}
if (!corPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
8995 8996 8997 8998 8999 9000 9001 | 8995 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 9016 9017 9018 9019 | - + - + - + - + |
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "command ?arg ...?");
return TCL_ERROR;
}
if (!corPtr) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
9192 9193 9194 9195 9196 9197 9198 | 9192 9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 9203 9204 9205 9206 9207 9208 9209 9210 9211 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221 9222 9223 9224 9225 9226 9227 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252 9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 | - - - - - + + + + + - - + + - - - - + + + + - - - + + + - - - - - + + + + + - - - + + + - + - - - - - - - + + + + + + - - - - - - - - + + + + + + + + - + - - - + + + - + |
Tcl_Interp *interp,
TCL_UNUSED(int) /*result*/)
{
CoroutineData *corPtr = (CoroutineData *)data[0];
void *stackLevel = TclGetCStackPtr();
if (!corPtr->stackLevel) {
|
| ︙ | |||
9326 9327 9328 9329 9330 9331 9332 | 9325 9326 9327 9328 9329 9330 9331 9332 9333 9334 9335 9336 9337 9338 9339 9340 9341 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 9371 9372 9373 | - - - - - + + + + + - - + + - - + + - - + + - - - - + + + + |
/*
* Look up the coroutine.
*/
cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, objv[1]);
if ((!cmdPtr) || (cmdPtr->nreProc != TclNRInterpCoroutine)) {
|
| ︙ | |||
9387 9388 9389 9390 9391 9392 9393 | 9386 9387 9388 9389 9390 9391 9392 9393 9394 9395 9396 9397 9398 9399 9400 9401 9402 9403 | - - - - + + + + |
/*
* How to get a coroutine from its handle.
*/
Command *cmdPtr = (Command *) Tcl_GetCommandFromObj(interp, objPtr);
if ((!cmdPtr) || (cmdPtr->nreProc != TclNRInterpCoroutine)) {
|
| ︙ | |||
9415 9416 9417 9418 9419 9420 9421 | 9414 9415 9416 9417 9418 9419 9420 9421 9422 9423 9424 9425 9426 9427 9428 9429 9430 9431 9432 9433 9434 9435 9436 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 9447 | - + - + - - - - + + + + - + |
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv, "coroName cmd ?arg1 arg2 ...?");
return TCL_ERROR;
}
corPtr = GetCoroutineFromObj(interp, objv[1],
|
| ︙ | |||
9460 9461 9462 9463 9464 9465 9466 | 9459 9460 9461 9462 9463 9464 9465 9466 9467 9468 9469 9470 9471 9472 9473 9474 9475 9476 9477 9478 9479 9480 9481 9482 9483 9484 9485 9486 9487 9488 9489 9490 9491 9492 9493 9494 9495 9496 9497 9498 9499 9500 9501 9502 9503 9504 | - + - + - - - - - + + + + + - + - + |
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv, "coroName cmd ?arg1 arg2 ...?");
return TCL_ERROR;
}
corPtr = GetCoroutineFromObj(interp, objv[1],
|
| ︙ | |||
9577 9578 9579 9580 9581 9582 9583 | 9576 9577 9578 9579 9580 9581 9582 9583 9584 9585 9586 9587 9588 9589 9590 | - + |
/*
* Call the user's script; we're in the right place.
*/
Tcl_IncrRefCount(listPtr);
TclMarkTailcall(interp);
TclNRAddCallback(interp, InjectHandlerPostCall, corPtr, listPtr,
|
| ︙ | |||
9607 9608 9609 9610 9611 9612 9613 | 9606 9607 9608 9609 9610 9611 9612 9613 9614 9615 9616 9617 9618 9619 9620 9621 9622 9623 9624 9625 9626 9627 9628 9629 | - - - - - - - - - - + + + + + + + + + + |
* If we were doing a probe, splice ourselves back out of the stack
* cleanly here. General injection should instead just look after itself.
*
* Code from guts of [yield] implementation.
*/
if (isProbe) {
|
| ︙ | |||
9652 9653 9654 9655 9656 9657 9658 | 9651 9652 9653 9654 9655 9656 9657 9658 9659 9660 9661 9662 9663 9664 9665 9666 9667 9668 9669 9670 9671 9672 9673 | - + - + - - - - + + + + |
if (objc < 3) {
Tcl_WrongNumArgs(interp, 1, objv, "coroName cmd ?arg1 arg2 ...?");
return TCL_ERROR;
}
corPtr = GetCoroutineFromObj(interp, objv[1],
|
| ︙ | |||
9687 9688 9689 9690 9691 9692 9693 | 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 9715 9716 9717 9718 9719 9720 9721 9722 9723 9724 9725 9726 9727 9728 9729 9730 9731 9732 9733 9734 9735 9736 9737 9738 | - - + + - - - - - - - + + + + + + + - - - - - - - - + + + + + + + + - - - - + + + + - + |
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
CoroutineData *corPtr = (CoroutineData *)clientData;
if (!COR_IS_SUSPENDED(corPtr)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
| ︙ | |||
9765 9766 9767 9768 9769 9770 9771 | 9764 9765 9766 9767 9768 9769 9770 9771 9772 9773 9774 9775 9776 9777 9778 9779 9780 9781 9782 9783 9784 9785 9786 9787 | - - - + + + - - - + + + |
procName = TclGetString(objv[1]);
TclGetNamespaceForQualName(interp, procName, inNsPtr, 0,
&nsPtr, &altNsPtr, &cxtNsPtr, &simpleName);
if (nsPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
| ︙ | |||
9866 9867 9868 9869 9870 9871 9872 | 9865 9866 9867 9868 9869 9870 9871 9872 9873 9874 9875 9876 9877 9878 9879 | - + |
iPtr->execEnvPtr = corPtr->callerEEPtr;
/*
* Now just resume the coroutine.
*/
TclNRAddCallback(interp, TclNRCoroutineActivateCallback, corPtr,
|
| ︙ |
Changes to generic/tclBinary.c.
| ︙ | |||
24 25 26 27 28 29 30 | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | - - - + + + + | #define BINARY_ALL -1 /* Use all elements in the argument. */ #define BINARY_NOCOUNT -2 /* No count was specified in format. */ /* * The following flags may be OR'ed together and returned by GetFormatSpec */ |
| ︙ | |||
181 182 183 184 185 186 187 | 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | - + |
unsigned char bytes[TCLFLEXARRAY]; /* The array of bytes. The actual size of this
* field depends on the 'allocated' field
* above. */
} ByteArray;
#define BYTEARRAY_MAX_LEN (TCL_SIZE_MAX - (Tcl_Size)offsetof(ByteArray, bytes))
#define BYTEARRAY_SIZE(len) \
|
| ︙ | |||
436 437 438 439 440 441 442 | 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | - + |
*----------------------------------------------------------------------
*/
unsigned char *
Tcl_SetByteArrayLength(
Tcl_Obj *objPtr, /* The ByteArray object. */
Tcl_Size numBytes) /* Number of bytes in resized array
|
| ︙ | |||
767 768 769 770 771 772 773 | 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 | + - - + + - - - + - |
if ((BYTEARRAY_MAX_LEN - byteArrayPtr->used) < len) {
/* Will wrap around !! */
Tcl_Panic("max size of a byte array exceeded");
}
needed = byteArrayPtr->used + len;
if (needed > byteArrayPtr->allocated) {
Tcl_Size newCapacity;
|
| ︙ |
Changes to generic/tclCkalloc.c.
| ︙ | |||
167 168 169 170 171 172 173 | 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | - + |
TclDumpMemoryInfo(
void *clientData,
int flags)
{
char buf[1024];
if (clientData == NULL) {
|
| ︙ | |||
272 273 274 275 276 277 278 | 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | - |
Tcl_Panic("Memory validation failure");
}
if (nukeGuards) {
memset(memHeaderP->low_guard, 0, LOW_GUARD_SIZE);
memset(hiPtr, 0, HIGH_GUARD_SIZE);
}
|
| ︙ | |||
823 824 825 826 827 828 829 | 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 | - + |
if (fileName == NULL) {
return TCL_ERROR;
}
result = Tcl_DumpActiveMemory(fileName);
Tcl_DStringFree(&buffer);
if (result != TCL_OK) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf("error accessing %s: %s",
|
| ︙ | |||
868 869 870 871 872 873 874 | 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 | - - + + |
fileName = Tcl_TranslateFileName(interp, TclGetString(objv[2]), &buffer);
if (fileName == NULL) {
return TCL_ERROR;
}
fileP = fopen(fileName, "w");
if (fileP == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
| ︙ | |||
933 934 935 936 937 938 939 | 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 | - - - + + + |
goto bad_suboption;
}
validate_memory = (strcmp(TclGetString(objv[2]),"on") == 0);
return TCL_OK;
}
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
| ︙ | |||
1005 1006 1007 1008 1009 1010 1011 | 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 | - |
Tcl_Interp *interp) /* Interpreter in which commands should be
* added */
{
TclInitDbCkalloc();
Tcl_CreateObjCommand(interp, "memory", MemoryCmd, NULL, NULL);
Tcl_CreateObjCommand(interp, "checkmem", CheckmemCmd, NULL, NULL);
}
|
| ︙ | |||
1249 1250 1251 1252 1253 1254 1255 | 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 | - - - - - + + + + + | * Panics if memory of at least the requested size could not be * allocated. * *------------------------------------------------------------------------ */ void * TclAllocElemsEx( |
| ︙ | |||
1284 1285 1286 1287 1288 1289 1290 | 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 | - - - - - - - + + + + + + + | * Pointer to allocated memory block which is at least as large * as the requested size or NULL if allocation failed. * *------------------------------------------------------------------------ */ void * TclAttemptReallocElemsEx( |
| ︙ |
Changes to generic/tclClock.c.
| ︙ | |||
120 121 122 123 124 125 126 | 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | - + |
* Structure containing description of "native" clock commands to create.
*/
struct ClockCommand {
const char *name; /* The tail of the command name. The full name
* is "::tcl::clock::<name>". When NULL marks
* the end of the table. */
|
| ︙ | |||
251 252 253 254 255 256 257 | 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | - + |
data->defFlags = 0;
/*
* Install the commands.
*/
|
| ︙ | |||
345 346 347 348 349 350 351 | 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | - + | * Results: * None. * *---------------------------------------------------------------------- */ static void ClockDeleteCmdProc( |
| ︙ | |||
642 643 644 645 646 647 648 | 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 | - + - + - + |
|| (localeObj->length == dataPtr->prevUsedLocale->length
&& strcasecmp(loc, TclGetString(dataPtr->prevUsedLocale)) == 0))) {
*mcDictObj = dataPtr->prevUsedLocaleDict;
TclSetObjRef(dataPtr->prevUsedLocaleUnnorm, localeObj);
return dataPtr->prevUsedLocale;
}
|
| ︙ | |||
700 701 702 703 704 705 706 | 700 701 702 703 704 705 706 707 708 709 710 711 712 713 | - |
ClockMCDict(
ClockFmtScnCmdArgs *opts)
{
ClockClientData *dataPtr = opts->dataPtr;
/* if dict not yet retrieved */
if (opts->mcDictObj == NULL) {
|
| ︙ | |||
752 753 754 755 756 757 758 | 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 | - + + - + + + - + + |
if (Tcl_EvalObjv(opts->interp, 2, callargs, 0) != TCL_OK) {
return NULL;
}
opts->mcDictObj = Tcl_GetObjResult(opts->interp);
Tcl_ResetResult(opts->interp);
|
| ︙ | |||
817 818 819 820 821 822 823 | 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 | - + |
if (opts->mcDictObj == NULL) {
return NULL;
}
}
Tcl_DictObjGet(opts->interp, opts->mcDictObj,
opts->dataPtr->mcLiterals[mcKey], &valObj);
|
| ︙ | |||
1941 1942 1943 1944 1945 1946 1947 | 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 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 | - + - + - + - - + |
rangesVal) != TCL_OK) {
return TCL_ERROR;
}
seconds = fields->seconds;
/* Cache the last conversion */
|
| ︙ | |||
2239 2240 2241 2242 2243 2244 2245 | 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 | - + + - + + + + | return TCL_ERROR; } /* converted using table (TZ isn't :localtime) */ fields->flags &= ~CLF_CTZ; /* Cache the last conversion */ |
| ︙ | |||
2696 2697 2698 2699 2700 2701 2702 | 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 | + + - + + |
int month;
const int *dipm = daysInPriorMonths[IsGregorianLeapYear(fields)];
/*
* Estimate month by calculating `dayOfYear / (365/12)`
*/
month = (day*12) / dipm[12];
/*
|
| ︙ | |||
2832 2833 2834 2835 2836 2837 2838 | 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 | - + |
fields->year = year;
}
/*
* Try an initial conversion in the Gregorian calendar.
*/
|
| ︙ | |||
2896 2897 2898 2899 2900 2901 2902 | 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 | - | * * Side effects: * Stores day number in 'julianDay' * *---------------------------------------------------------------------- */ |
| ︙ | |||
3285 3286 3287 3288 3289 3290 3291 | 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 | - + |
} ClockOperation;
static int
ClockParseFmtScnArgs(
ClockFmtScnCmdArgs *opts, /* Result vector: format, locale, timezone... */
TclDateFields *date, /* Extracted date-time corresponding base
* (by scan or add) resp. clockval (by format) */
|
| ︙ | |||
3310 3311 3312 3313 3314 3315 3316 | 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 | + - + |
Tcl_WideInt baseVal; /* Base time, expressed in seconds from the Epoch */
if (operation == CLC_OP_SCN) {
/* default flags (from configure) */
opts->flags |= dataPtr->defFlags & CLF_VALIDATE;
} else {
/* clock value (as current base) */
baseIdx = 1;
|
| ︙ | |||
3361 3362 3363 3364 3365 3366 3367 | 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 | + - + | case CLC_ARGS_LOCALE: opts->localeObj = objv[i + 1]; break; case CLC_ARGS_TIMEZONE: opts->timezoneObj = objv[i + 1]; break; case CLC_ARGS_BASE: baseIdx = i + 1; |
| ︙ | |||
3478 3479 3480 3481 3482 3483 3484 | 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 | - + |
&& (!(dataPtr->lastBase.date.flags & CLF_CTZ)
|| dataPtr->lastTZEpoch == TzsetIfNecessary())) {
memcpy(date, &dataPtr->lastBase.date, ClockCacheableDateFieldsSize);
} else {
/* extact fields from base */
date->seconds = baseVal;
if (ClockGetDateFields(dataPtr, interp, date, opts->timezoneObj,
|
| ︙ | |||
3715 3716 3717 3718 3719 3720 3721 | 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 | - - + + |
DateInfo *info, /* Clock scan info structure */
ClockFmtScnCmdArgs *opts) /* Format, locale, timezone and base */
{
/* If needed assemble julianDay using year, month, etc. */
if (info->flags & CLF_ASSEMBLE_JULIANDAY) {
if (info->flags & CLF_ISO8601WEEK) {
GetJulianDayFromEraYearWeekDay(&yydate, GREGORIAN_CHANGE_DATE);
|
| ︙ | |||
3797 3798 3799 3800 3801 3802 3803 | 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 | - + - + |
yySecondOfDay, (int)yydate.localSeconds, (int)(yydate.localSeconds % SECONDS_PER_DAY),
yydate.tzOffset);
#endif
if (!(stage & CLF_VALIDATE_S1) || !(opts->flags & CLF_VALIDATE_S1)) {
goto stage_2;
}
|
| ︙ | |||
3899 3900 3901 3902 3903 3904 3905 | 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 | - + |
goto error;
}
}
if (!(stage & CLF_VALIDATE_S2) || !(opts->flags & CLF_VALIDATE_S2)) {
return TCL_OK;
}
|
| ︙ | |||
4305 4306 4307 4308 4309 4310 4311 | 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 | - - |
/* adjust if we end up on a weekend */
if (resDayOfWeek > 5) {
offs += 2;
}
return offs;
}
|
| ︙ | |||
4567 4568 4569 4570 4571 4572 4573 | 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 | - - - - - + + + + + |
ClockSafeCatchCmd(
TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const objv[])
{
typedef struct {
|
| ︙ |
Changes to generic/tclClockFmt.c.
| ︙ | |||
1144 1145 1146 1147 1148 1149 1150 | 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 | - |
/* regards all possible spaces here (because they are optional) */
end = p + tok->lookAhMax + yySpaceCount + 1;
if (end > info->dateEnd) {
end = info->dateEnd;
}
p += tok->lookAhMin;
if (laTok->map && p < end) {
|
| ︙ | |||
1859 1860 1861 1862 1863 1864 1865 | 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 | - + |
} else {
/* legacy (alnum) timezone like CEST, etc. */
if (maxLen > 4) {
maxLen = 4;
}
while (len < maxLen) {
if ((*p & 0x80)
|
| ︙ | |||
2581 2582 2583 2584 2585 2586 2587 | 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 | - |
* Invalidate result
*/
flags |= info->flags;
/* seconds token (%s) take precedence over all other tokens */
if ((opts->flags & CLF_EXTENDED) || !(flags & CLF_POSIXSEC)) {
if (flags & CLF_DATE) {
|
| ︙ |
Changes to generic/tclCmdAH.c.
| ︙ | |||
421 422 423 424 425 426 427 | 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 | - - - - - - - + + + + + + + - | * - *failVarPtr is set to -failindex option value or NULL * On error, all of the above are uninitialized. * *------------------------------------------------------------------------ */ static int EncodingConvertParseOptions( |
| ︙ | |||
496 497 498 499 500 501 502 | 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 | - + |
*encPtr = encoding;
*dataObjPtr = dataObj;
*profilePtr = profile;
*failVarPtr = failVarObj;
return TCL_OK;
}
|
| ︙ | |||
521 522 523 524 525 526 527 | 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 | - + |
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Obj *data; /* Byte array to convert */
Tcl_DString ds; /* Buffer to hold the string */
Tcl_Encoding encoding; /* Encoding to use */
|
| ︙ | |||
590 591 592 593 594 595 596 | 589 590 591 592 593 594 595 596 597 598 599 600 601 602 | - |
Tcl_SetObjResult(interp, Tcl_DStringToObj(&ds));
/* We're done with the encoding */
Tcl_FreeEncoding(encoding);
return TCL_OK;
|
| ︙ | |||
683 684 685 686 687 688 689 | 681 682 683 684 685 686 687 688 689 690 691 692 693 694 | - |
Tcl_DStringLength(&ds)));
Tcl_DStringFree(&ds);
/* We're done with the encoding */
Tcl_FreeEncoding(encoding);
return TCL_OK;
|
| ︙ | |||
749 750 751 752 753 754 755 | 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 | - - - + + + |
*
*-----------------------------------------------------------------------------
*/
int
EncodingNamesObjCmd(
TCL_UNUSED(void *),
|
| ︙ | |||
777 778 779 780 781 782 783 | 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 | - - - + + + |
*
*-----------------------------------------------------------------------------
*/
int
EncodingProfilesObjCmd(
TCL_UNUSED(void *),
|
| ︙ | |||
808 809 810 811 812 813 814 | 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 | - - - + + + |
*
*-----------------------------------------------------------------------------
*/
int
EncodingSystemObjCmd(
TCL_UNUSED(void *),
|
| ︙ | |||
2343 2344 2345 2346 2347 2348 2349 | 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 | - - - - - - - - - - + + + + + + + + + + - + - - - + + + - - + + |
{
Tcl_Obj *field, *value, *result;
unsigned short mode;
if (varName == NULL) {
TclNewObj(result);
Tcl_IncrRefCount(result);
|
| ︙ | |||
2810 2811 2812 2813 2814 2815 2816 | 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 | - + - + |
/* 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],
|
| ︙ |
Changes to generic/tclCmdIL.c.
| ︙ | |||
84 85 86 87 88 89 90 | 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | - - - - - - - + + + + + + + + | * changed from TCL_OK to TCL_ERROR. */ } SortInfo; /* * The "sortMode" field of the SortInfo structure can take on any of the * following values. */ |
| ︙ | |||
1259 1260 1261 1262 1263 1264 1265 | 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 | - + |
Tcl_Obj *
TclInfoFrame(
Tcl_Interp *interp, /* Current interpreter. */
CmdFrame *framePtr) /* Frame to get info for. */
{
Interp *iPtr = (Interp *) interp;
Tcl_Obj *tmpObj;
|
| ︙ | |||
2210 2211 2212 2213 2214 2215 2216 | 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 | - |
resObjPtr = TclStringCat(interp, listLen, elemPtrs, 0);
} else {
Tcl_Size i;
TclNewObj(resObjPtr);
for (i = 0; i < listLen; i++) {
if (i > 0) {
|
| ︙ | |||
2422 2423 2424 2425 2426 2427 2428 | 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 | - + |
*----------------------------------------------------------------------
*/
int
Tcl_LinsertObjCmd(
TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2515 2516 2517 2518 2519 2520 2521 | 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 | - - + + - |
*----------------------------------------------------------------------
*/
int
Tcl_ListObjCmd(
TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
2552 2553 2554 2555 2556 2557 2558 | 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 | - + - |
*/
int
Tcl_LlengthObjCmd(
TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
|
| ︙ | |||
2601 2602 2603 2604 2605 2606 2607 | 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 | - + - |
*/
int
Tcl_LpopObjCmd(
TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
|
| ︙ | |||
2721 2722 2723 2724 2725 2726 2727 | 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 | - + - |
*/
int
Tcl_LrangeObjCmd(
TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
|
| ︙ | |||
2933 2934 2935 2936 2937 2938 2939 | 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 | - - + + - |
*----------------------------------------------------------------------
*/
int
Tcl_LrepeatObjCmd(
TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
3214 3215 3216 3217 3218 3219 3220 | 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 | - |
for (i=0,j=elemc-1 ; i<elemc ; i++,j--) {
dataArray[j] = elemv[i];
Tcl_IncrRefCount(elemv[i]);
}
Tcl_SetObjResult(interp, resultObj);
} else {
|
| ︙ | |||
4165 4166 4167 4168 4169 4170 4171 | 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 | - - + + - - - - + + + + - - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - + + + + + - - - - - + + + + + - - - - - + + + + + - |
/*
* Create a decoding key by looping through the arguments and identify
* what kind of argument each one is. Encode each argument as a decimal
* digit.
*/
if (objc > 6) {
|
| ︙ | |||
4766 4767 4768 4769 4770 4771 4772 | 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 | - + - + |
}
Tcl_ListObjAppendElement(interp, newCommandPtr, Tcl_NewObj());
sortInfo.compareCmdPtr = newCommandPtr;
}
if (TclObjTypeHasProc(objv[1], getElementsProc)) {
sortInfo.resultCode =
|
| ︙ | |||
5286 5287 5288 5289 5290 5291 5292 | 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 | - | * Once an error has occurred, skip any future comparisons so as * to preserve the error message in sortInterp->result. */ return 0; } |
| ︙ | |||
5364 5365 5366 5367 5368 5369 5370 | 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 | - + |
const char *left, const char *right) /* The strings to compare. */
{
int uniLeft = 0, uniRight = 0, uniLeftLower, uniRightLower;
int diff, zeros;
int secondaryDiff = 0;
while (1) {
|
| ︙ |
Changes to generic/tclCmdMZ.c.
| ︙ | |||
722 723 724 725 726 727 728 | 722 723 724 725 726 727 728 729 730 731 732 733 734 735 | - |
* case where the regexp pattern can match the empty string - this is
* useful when doing, say, 'regsub -- ^ $str ...' when $str might be
* empty.
*/
numMatches = 0;
for ( ; offset <= wlen; ) {
|
| ︙ | |||
1232 1233 1234 1235 1236 1237 1238 | 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 | - |
Tcl_SetHashValue(hPtr, objPtr);
} else {
objPtr = (Tcl_Obj *)Tcl_GetHashValue(hPtr);
}
Tcl_ListObjAppendElement(NULL, listPtr, objPtr);
}
Tcl_DeleteHashTable(&charReuseTable);
|
| ︙ | |||
2403 2404 2405 2406 2407 2408 2409 | 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 | - + |
/*
* The following test screens out most empty substrings as candidates for
* replacement. When they are detected, no replacement is done, and the
* result is the original string.
*/
|
| ︙ |
Changes to generic/tclCompCmds.c.
| ︙ | |||
195 196 197 198 199 200 201 | 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | - + |
/*
* Can only handle the case where we are appending to a local scalar when
* there are multiple values to append. Fortunately, this is common.
*/
varTokenPtr = TokenAfter(parsePtr->tokenPtr);
|
| ︙ | |||
375 376 377 378 379 380 381 | 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 | - + - + | * a non-local variable: upvar from a local one! This consumes the * variable name that was left at stacktop. */ localIndex = TclFindCompiledLocal(varTokenPtr->start, varTokenPtr->size, 1, envPtr); PushStringLiteral(envPtr, "0"); |
| ︙ | |||
603 604 605 606 607 608 609 | 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 | - + - + |
*/
resultIndex = optsIndex = -1;
cmdTokenPtr = TokenAfter(parsePtr->tokenPtr);
if ((int)parsePtr->numWords >= 3) {
resultNameTokenPtr = TokenAfter(cmdTokenPtr);
/* DGP */
|
| ︙ | |||
653 654 655 656 657 658 659 | 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 678 679 680 681 682 683 684 685 686 | - - |
/* drop the script */
dropScript = 1;
TclEmitInstInt4( INST_REVERSE, 2, envPtr);
TclEmitOpcode( INST_POP, envPtr);
}
ExceptionRangeEnds(envPtr, range);
|
| ︙ | |||
966 967 968 969 970 971 972 | 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 | - + |
&localIndex, &isScalar, 1);
/*
* If the user specified an array element, we don't bother handling
* that.
*/
if (!isScalar) {
|
| ︙ | |||
1098 1099 1100 1101 1102 1103 1104 | 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 | - + |
/*
* The dictionary variable must be a local scalar that is knowable at
* compile time; anything else exceeds the complexity of the opcode. So
* discover what the index is.
*/
varTokenPtr = TokenAfter(parsePtr->tokenPtr);
|
| ︙ | |||
1181 1182 1183 1184 1185 1186 1187 | 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 | - + |
/*
* The dictionary variable must be a local scalar that is knowable at
* compile time; anything else exceeds the complexity of the opcode. So
* discover what the index is.
*/
|
| ︙ | |||
1329 1330 1331 1332 1333 1334 1335 | 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 | - + |
/*
* The dictionary variable must be a local scalar that is knowable at
* compile time; anything else exceeds the complexity of the opcode. So
* discover what the index is.
*/
tokenPtr = TokenAfter(parsePtr->tokenPtr);
|
| ︙ | |||
1656 1657 1658 1659 1660 1661 1662 | 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 | - + - + |
Tcl_DStringFree(&buffer);
if (numVars != 2) {
Tcl_Free((void *)argv);
return TclCompileBasic3ArgCmd(interp, parsePtr, cmdPtr, envPtr);
}
nameChars = strlen(argv[0]);
|
| ︙ | |||
1856 1857 1858 1859 1860 1861 1862 | 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 | - + |
/*
* The dictionary variable must be a local scalar that is knowable at
* compile time; anything else exceeds the complexity of the opcode. So
* discover what the index is.
*/
dictVarTokenPtr = TokenAfter(parsePtr->tokenPtr);
|
| ︙ | |||
1885 1886 1887 1888 1889 1890 1891 | 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 | - + | tokenPtr = TokenAfter(tokenPtr); /* * Stash the index in the auxiliary data (if it is indeed a local * scalar that is resolvable at compile-time). */ |
| ︙ | |||
1996 1997 1998 1999 2000 2001 2002 | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 | - + |
}
/*
* Get the index of the local variable that we will be working with.
*/
tokenPtr = TokenAfter(parsePtr->tokenPtr);
|
| ︙ | |||
2052 2053 2054 2055 2056 2057 2058 | 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 | - + |
/*
* Parse the arguments.
*/
varTokenPtr = TokenAfter(parsePtr->tokenPtr);
keyTokenPtr = TokenAfter(varTokenPtr);
valueTokenPtr = TokenAfter(keyTokenPtr);
|
| ︙ | |||
2128 2129 2130 2131 2132 2133 2134 | 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 | - + |
}
/*
* Determine if we're manipulating a dict in a simple local variable.
*/
gotPath = ((int)parsePtr->numWords > 3);
|
| ︙ | |||
2847 2848 2849 2850 2851 2852 2853 | 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 | - - + |
for (j = 0; j < numVars; j++) {
Tcl_Obj *varNameObj;
const char *bytes;
int varIndex;
Tcl_Size length;
|
| ︙ | |||
2965 2966 2967 2968 2969 2970 2971 | 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 | - + | * the new ForeachInfo record. * *---------------------------------------------------------------------- */ static void * DupForeachInfo( |
| ︙ | |||
3014 3015 3016 3017 3018 3019 3020 | 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 | - + | * ForeachInfo structure. * *---------------------------------------------------------------------- */ static void FreeForeachInfo( |
| ︙ | |||
3348 3349 3350 3351 3352 3353 3354 | 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 | - + |
i = 0; /* The count of things to concat. */
j = 2; /* The index into the argument tokens, for
* TIP#280 handling. */
start = TclGetString(formatObj);
/* The start of the currently-scanned literal
* in the format string. */
|
| ︙ | |||
3450 3451 3452 3453 3454 3455 3456 | 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 | - + |
TclLocalScalar(
const char *bytes,
size_t numBytes,
CompileEnv *envPtr)
{
Tcl_Token token[2] = {
{TCL_TOKEN_SIMPLE_WORD, NULL, 0, 1},
|
| ︙ | |||
3598 3599 3600 3601 3602 3603 3604 | 3595 3596 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 | - - - - - + + + + + - - - - - - - + + + + + + + - - - + + + - - - - - - + + + + + + - - - + + + |
name = varTokenPtr[1].start;
nameLen = p - varTokenPtr[1].start;
elName = p + 1;
remainingLen = (varTokenPtr[2].start - p) - 1;
elNameLen = (varTokenPtr[n].start-p) + varTokenPtr[n].size - 1;
if (!(flags & TCL_NO_ELEMENT)) {
|
| ︙ |
Changes to generic/tclCompCmdsGR.c.
| ︙ | |||
519 520 521 522 523 524 525 | 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 | - + |
haveImmValue = 1;
}
/*
* Emit the instruction to increment the variable.
*/
|
| ︙ | |||
1831 1832 1833 1834 1835 1836 1837 | 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 | - + |
localTokenPtr = tokenPtr;
for (i=2; i<numWords; i+=2) {
otherTokenPtr = TokenAfter(localTokenPtr);
localTokenPtr = TokenAfter(otherTokenPtr);
CompileWord(envPtr, otherTokenPtr, interp, i);
|
| ︙ | |||
2574 2575 2576 2577 2578 2579 2580 | 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 | - + |
* be called at runtime.
*/
for (; i<numWords; i+=2, otherTokenPtr = TokenAfter(localTokenPtr)) {
localTokenPtr = TokenAfter(otherTokenPtr);
CompileWord(envPtr, otherTokenPtr, interp, i);
|
| ︙ |
Changes to generic/tclCompCmdsSZ.c.
| ︙ | |||
456 457 458 459 460 461 462 | 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | - |
tokenPtr = TokenAfter(parsePtr->tokenPtr);
CompileWord(envPtr, tokenPtr, interp, 1);
/* See what can be discovered about index at compile time */
tokenPtr = TokenAfter(tokenPtr);
if (TCL_OK != TclGetIndexFromToken(tokenPtr, TCL_INDEX_START,
TCL_INDEX_END, &idx)) {
|
| ︙ | |||
1093 1094 1095 1096 1097 1098 1099 | 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 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 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 1246 | - - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - + + + + + + + - + - - - - - - - - - - - - - + + + + + + + + + + + + + |
*
* For some compile-time values we can detect these cases, and
* compile direct to bytecode implementing the no-op.
*/
if ((last == (int)TCL_INDEX_NONE) /* Know (last < 0) */
|| (first == (int)TCL_INDEX_NONE) /* Know (first > end) */
|
| ︙ | |||
1478 1479 1480 1481 1482 1483 1484 | 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 | + - - - - - + + + + + - + |
/*
if (TclSubstOptions(NULL, numOpts, objv, &flags) == TCL_OK) {
toSubst = objv[numOpts];
Tcl_IncrRefCount(toSubst);
}
*/
/*
|
| ︙ | |||
2112 2113 2114 2115 2116 2117 2118 | 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 | - + |
CompileEnv *envPtr, /* Holds resulting instructions. */
int mode, /* Exact, Glob or Regexp */
int noCase, /* Case-insensitivity flag. */
Tcl_Size numBodyTokens, /* Number of tokens describing things the
* switch can match against and bodies to
* execute when the match succeeds. */
Tcl_Token **bodyToken, /* Array of pointers to pattern list items. */
|
| ︙ | |||
2360 2361 2362 2363 2364 2365 2366 | 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 | - + |
IssueSwitchJumpTable(
Tcl_Interp *interp, /* Context for compiling script bodies. */
CompileEnv *envPtr, /* Holds resulting instructions. */
int numBodyTokens, /* Number of tokens describing things the
* switch can match against and bodies to
* execute when the match succeeds. */
Tcl_Token **bodyToken, /* Array of pointers to pattern list items. */
|
| ︙ | |||
2917 2918 2919 2920 2921 2922 2923 | 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 | - + - + |
TclDecrRefCount(tmpObj);
goto failedToCompile;
}
if (objc > 0) {
Tcl_Size len;
const char *varname = TclGetStringFromObj(objv[0], &len);
|
| ︙ |
Changes to generic/tclCompExpr.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 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | - - + + - + - + + + - + - + - + - + - + - + - + - + - - + - - + - - + - - + - - + - - + - - + - + - - - + + + - - + - - + - - + + - + - - + + - - + - - - - - - - - - + + + + + + + + + - - + - - + - - - - - - - - - - + + + + + + + + + + - - + - - + + - - + - - - - + + + + - - + + | * The four category values are LEAF, UNARY, and BINARY, explained below, and * "uncategorized", which is used either temporarily, until context determines * which of the other three categories is correct, or for lexemes like * INVALID, which aren't really lexemes at all, but indicators of a parsing * error. Note that the codes must be distinct to distinguish categories, but * need not take the form of a bit array. */ |
| ︙ | |||
743 744 745 746 747 748 749 | 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 | - + |
* name, and there's no place in the parse tree to store
* it, so we keep a separate list of all the function
* names we've parsed in the order we found them.
*/
Tcl_ListObjAppendElement(NULL, funcList, literal);
} else if (Tcl_GetBooleanFromObj(NULL,literal,&b) == TCL_OK) {
|
| ︙ | |||
869 870 871 872 873 874 875 | 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 | - + - + | scanned = 0; insertMark = 1; /* * Free any literal to avoid a memleak. */ |
| ︙ | |||
1052 1053 1054 1055 1056 1057 1058 | 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 | - | Tcl_DecrRefCount(literal); } complete = lastParsed = OT_TOKENS; break; } /* case LEAF */ case UNARY: |
| ︙ | |||
1535 1536 1537 1538 1539 1540 1541 | 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 | - - |
/*
* Handle next child node or leaf.
*/
switch (next) {
case OT_EMPTY:
|
| ︙ | |||
1626 1627 1628 1629 1630 1631 1632 | 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 | - | start += scanned; numBytes -= scanned; tokenPtr += toCopy; break; } default: |
| ︙ | |||
1649 1650 1651 1652 1653 1654 1655 | 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 | - - + - |
* Generate tokens for the operator / subexpression...
*/
switch (nodePtr->lexeme) {
case OPEN_PAREN:
case COMMA:
case COLON:
|
| ︙ | |||
1696 1697 1698 1699 1700 1701 1702 | 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 | - | * Tcl_Token of type TCL_TOKEN_OPERATOR will be 0. This means * we can make other use of this field for now to track the * stack of subexpressions we have pending. */ subExprTokenPtr[1].numComponents = parentIdx; break; |
| ︙ | |||
1757 1758 1759 1760 1761 1762 1763 | 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 | - - - |
start += scanned;
numBytes -= scanned;
break;
case MARK_PARENT:
switch (nodePtr->lexeme) {
case START:
|
| ︙ | |||
1865 1866 1867 1868 1869 1870 1871 | 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 | - - + + |
* first null character. */
Tcl_Parse *parsePtr) /* Structure to fill with information about
* the parsed expression; any previous
* information in the structure is ignored. */
{
int code;
OpNode *opTree = NULL; /* Will point to the tree of operators. */
|
| ︙ | |||
2087 2088 2089 2090 2091 2092 2093 | 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 | - |
break;
}
TclNewObj(literal);
if (TclParseNumber(NULL, literal, NULL, start, numBytes, &end,
TCL_PARSE_NO_WHITESPACE) == TCL_OK) {
if (end < start + numBytes && !TclIsBareword(*end)) {
|
| ︙ | |||
2679 2680 2681 2682 2683 2684 2685 | 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 | - - - + + + + |
{
int code = TCL_OK;
if (objc < 3) {
Tcl_SetObjResult(interp, Tcl_NewBooleanObj(1));
} else {
TclOpCmdClientData *occdPtr = (TclOpCmdClientData *)clientData;
|
| ︙ |
Changes to generic/tclCompile.c.
| ︙ | |||
677 678 679 680 681 682 683 | 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 | - + | /* * Prototypes for procedures defined later in this file: */ static void CleanupByteCode(ByteCode *codePtr); static ByteCode * CompileSubstObj(Tcl_Interp *interp, Tcl_Obj *objPtr, |
| ︙ | |||
736 737 738 739 740 741 742 | 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 | - + + + - + + + + + - + - - + + |
"substcode", /* name */
FreeSubstCodeInternalRep, /* freeIntRepProc */
DupByteCodeInternalRep, /* dupIntRepProc - shared with bytecode */
NULL, /* updateStringProc */
NULL, /* setFromAnyProc */
TCL_OBJTYPE_V0
};
|
| ︙ | |||
775 776 777 778 779 780 781 | 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 | - + |
int
TclSetByteCodeFromAny(
Tcl_Interp *interp, /* The interpreter for which the code is being
* compiled. Must not be NULL. */
Tcl_Obj *objPtr, /* The object to make a ByteCode object. */
CompileHookProc *hookProc, /* Procedure to invoke after compilation. */
|
| ︙ | |||
992 993 994 995 996 997 998 | 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 | - + | * delayed until the last execution of the code completes. * *---------------------------------------------------------------------- */ static void FreeByteCodeInternalRep( |
| ︙ | |||
1042 1043 1044 1045 1046 1047 1048 | 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 | - + |
/* Just dropped to refcount==0. Clean up. */
CleanupByteCode(codePtr);
}
static void
CleanupByteCode(
|
| ︙ | |||
1111 1112 1113 1114 1115 1116 1117 | 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 | - |
* of an interpreter being deleted, which is signaled by interp == NULL.
* Also, as the interp deletion will remove the global literal table
* anyway, avoid the extra cost of updating it for each literal being
* released.
*/
if (codePtr->flags & TCL_BYTECODE_PRECOMPILED) {
|
| ︙ | |||
1321 1322 1323 1324 1325 1326 1327 | 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 | - + - + |
*----------------------------------------------------------------------
*/
static ByteCode *
CompileSubstObj(
Tcl_Interp *interp,
Tcl_Obj *objPtr,
|
| ︙ | |||
1356 1357 1358 1359 1360 1361 1362 | 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 | - + | TclSubstCompile(interp, bytes, numBytes, flags, 1, &compEnv); TclEmitOpcode(INST_DONE, &compEnv); codePtr = TclInitByteCodeObj(objPtr, &substCodeType, &compEnv); TclFreeCompileEnv(&compEnv); |
| ︙ | |||
1393 1394 1395 1396 1397 1398 1399 | 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 | - + | * the cleanup is delayed until the last execution of the code completes. * *---------------------------------------------------------------------- */ static void FreeSubstCodeInternalRep( |
| ︙ | |||
1444 1445 1446 1447 1448 1449 1450 | 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 | - + |
*----------------------------------------------------------------------
*/
void
TclInitCompileEnv(
Tcl_Interp *interp, /* The interpreter for which a CompileEnv
* structure is initialized. */
|
| ︙ | |||
2216 2217 2218 2219 2220 2221 2222 | 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 | - - + + |
Tcl_Parse *parsePtr = (Tcl_Parse *)Tcl_Alloc(sizeof(Tcl_Parse));
do {
const char *next;
if (TCL_OK != Tcl_ParseCommand(interp, p, numBytes, 0, parsePtr)) {
/*
|
| ︙ | |||
2645 2646 2647 2648 2649 2650 2651 | 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 | - + |
*/
void
TclCompileCmdWord(
Tcl_Interp *interp, /* Used for error and status reporting. */
Tcl_Token *tokenPtr, /* Pointer to first in an array of tokens for
* a command word to compile inline. */
|
| ︙ | |||
2985 2986 2987 2988 2989 2990 2991 | 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 | - + |
ByteCode *
TclInitByteCodeObj(
Tcl_Obj *objPtr, /* Points object that should be initialized,
* and whose string rep contains the source
* code. */
const Tcl_ObjType *typePtr,
|
| ︙ | |||
3030 3031 3032 3033 3034 3035 3036 | 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 | - + | * variable is unknown, or if the name is NULL. * *---------------------------------------------------------------------- */ Tcl_Size TclFindCompiledLocal( |
| ︙ | |||
3209 3210 3211 3212 3213 3214 3215 | 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 | - + |
EnterCmdStartData(
CompileEnv *envPtr, /* Points to the compilation environment
* structure in which to enter command
* location information. */
Tcl_Size cmdIndex, /* Index of the command whose start data is
* being set. */
Tcl_Size srcOffset, /* Offset of first char of the command. */
|
| ︙ | |||
3287 3288 3289 3290 3291 3292 3293 | 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 | - - + + |
static void
EnterCmdExtentData(
CompileEnv *envPtr, /* Points to the compilation environment
* structure in which to enter command
* location information. */
Tcl_Size cmdIndex, /* Index of the command whose source and code
* length data is being set. */
|
| ︙ | |||
3411 3412 3413 3414 3415 3416 3417 | 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 | - + |
*
*----------------------------------------------------------------------
*/
Tcl_Size
TclCreateExceptRange(
ExceptionRangeType type, /* The kind of ExceptionRange desired. */
|
| ︙ | |||
3509 3510 3511 3512 3513 3514 3515 | 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 | - |
rangePtr--; i--;
if (CurrentOffset(envPtr) >= (int)rangePtr->codeOffset &&
(rangePtr->numCodeBytes == TCL_INDEX_NONE || CurrentOffset(envPtr) <
(int)rangePtr->codeOffset+(int)rangePtr->numCodeBytes) &&
(returnCode != TCL_CONTINUE ||
envPtr->exceptAuxArrayPtr[i].supportsContinue)) {
|
| ︙ | |||
3771 3772 3773 3774 3775 3776 3777 | 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 | - + - + | * If there is not enough room in the CompileEnv's AuxData array, its size * is doubled. *---------------------------------------------------------------------- */ Tcl_Size TclCreateAuxData( |
| ︙ |
Changes to generic/tclCompile.h.
| ︙ | |||
11 12 13 14 15 16 17 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | + + - + + | */ #ifndef _TCLCOMPILATION #define _TCLCOMPILATION 1 #include "tclInt.h" /* Forward declarations. */ |
| ︙ | |||
74 75 76 77 78 79 80 | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | - + - + - + - + - - + + - + - + - + - + - + - + - + + - - - + + + - + - + - - + + - + - + - - + + - - - - - + + + + + | * break command is executed, the ExceptionRange structure for the most deeply * nested loop, if any, is found and used. These structures are also generated * for the "next" subcommands of for loops since a break there terminates the * for command. This means a for command actually generates two LoopInfo * structures. */ |
| ︙ | |||
262 263 264 265 266 267 268 | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | - + |
* during compilation by CompileProcs and used by instructions during
* execution.
*/
typedef struct AuxData {
const AuxDataType *type; /* Pointer to the AuxData type associated with
* this ClientData. */
|
| ︙ | |||
286 287 288 289 290 291 292 | 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 | - + - - + + - + - + - + |
* compiled. Commands and their compile procs
* are specific to an interpreter so the code
* emitted will depend on the interpreter. */
const char *source; /* The source string being compiled by
* SetByteCodeFromAny. This pointer is not
* owned by the CompileEnv and must not be
* freed or changed by it. */
|
| ︙ | |||
329 330 331 332 333 334 335 | 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | - + |
ExceptionRange *exceptArrayPtr;
/* Points to start of the ExceptionRange
* array. */
Tcl_Size exceptArrayNext; /* Next free ExceptionRange array index.
* exceptArrayNext is the number of ranges and
* (exceptArrayNext-1) is the index of the
* current range's array entry. */
|
| ︙ | |||
375 376 377 378 379 380 381 | 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 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 | - + - + - + + - - - - + + + + - - + - - - - + + + + - - + - + + - + |
CmdLocation staticCmdMapSpace[COMPILEENV_INIT_CMD_MAP_SIZE];
/* Initial storage for cmd location map. */
AuxData staticAuxDataArraySpace[COMPILEENV_INIT_AUX_DATA_SIZE];
/* Initial storage for aux data array. */
/* TIP #280 */
ExtCmdLoc *extCmdMapPtr; /* Extended command location information for
* 'info frame'. */
|
| ︙ | |||
455 456 457 458 459 460 461 | 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 | - - - - + + + + - + - + - + |
* Proc structure; otherwise NULL. This
* pointer is also not owned by the ByteCode
* and must not be freed by it. */
size_t structureSize; /* Number of bytes in the ByteCode structure
* itself. Does not include heap space for
* literal Tcl objects or storage referenced
* by AuxData entries. */
|
| ︙ | |||
521 522 523 524 525 526 527 | 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 | + - + - - - + + + - - + + - + + + - + - + - - - + + + |
* variables. */
#ifdef TCL_COMPILE_STATS
Tcl_Time createTime; /* Absolute time when the ByteCode was
* created. */
#endif /* TCL_COMPILE_STATS */
} ByteCode;
static inline void
|
| ︙ | |||
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 | - - - - - + + + + + |
INST_LAPPEND_LIST_ARRAY_STK,
INST_LAPPEND_LIST_STK,
INST_CLOCK_READ,
INST_DICT_GET_DEF,
|
| ︙ | |||
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 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 | - - + + - + + - + - + - + + + + - - + + + + + + + - + + |
* to 5 bytes. */
} JumpFixup;
#define JUMPFIXUP_INIT_ENTRIES 10
typedef struct JumpFixupArray {
JumpFixup *fixup; /* Points to start of jump fixup array. */
|
| ︙ | |||
1203 1204 1205 1206 1207 1208 1209 | 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 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 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 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 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 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 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 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 1470 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 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 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 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 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 | - - - - - + + + + + + - - - - - - + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + - + - - - - + + - - - + + - - - - - + + + + + + + - - - - + + + + + - - - - - + + + + + + + + - - - + + + - - + + - - - - + + + + + + + - - - - - - + + + + - - + + - - - + + + - - - - - - + + + + + + + + - - - + + - + + - + - - - - - + + + + + + - - - - + + - - - - + + + + - - + + - - - - - + + + + + + + - - - - - - + + + + + + + + + - - - - + + + - - - - + + - - - + + - - + - - + - - + - + + - - - - + + + + + + + - - - - - + + + + + - - - - - - + + + + + + + + + + - - - - + + + - - + - - + - - - - + + + - - + + - - - - - - + + + + + + + + + - - + - - - + - - - - + + + - - - + + + - - + + - - - + + + + + - - - + - - - - - - - - - + + + + + + + + + + + + - - + + - - + + - - - - - + + + + + + + + + + + - + - - - - - + + + + - - - - + + - - + + - - - - - - + + + + + + + + + - - + - - - - - + + + + + - + - + - - - - - - - - + + + + + + - + - + - - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - + + + + - - + + + + + + + + - - - - + + + + + + - - + - - - + + + - + - - - + + + + - - + - - + + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + + + - - - - - + + + + + + + + + + + + + + + | MODULE_SCOPE Tcl_Obj *TclGetInnerContext(Tcl_Interp *interp, const unsigned char *pc, Tcl_Obj **tosPtr); MODULE_SCOPE Tcl_Obj *TclNewInstNameObj(unsigned char inst); MODULE_SCOPE int TclPushProcCallFrame(void *clientData, Tcl_Interp *interp, Tcl_Size objc, Tcl_Obj *const objv[], int isLambda); #endif /* TCL_MAJOR_VERSION > 8 */ |
| ︙ | |||
1655 1656 1657 1658 1659 1660 1661 | 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 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 | - - + + + + + - + - - + - - - - + - - - + + + + + - - + + + |
if (idx <= 255) { \
TclEmitInstInt1(nm##1,idx,envPtr); \
} else { \
TclEmitInstInt4(nm##4,idx,envPtr); \
}
/*
|
| ︙ |
Changes to generic/tclConfig.c.
| ︙ | |||
65 66 67 68 69 70 71 | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | - + + |
void
Tcl_RegisterConfig(
Tcl_Interp *interp, /* Interpreter the configuration command is
* registered in. */
const char *pkgName, /* Name of the package registering the
* embedded configuration. ASCII, thus in
* UTF-8 too. */
|
| ︙ |
Changes to generic/tclDate.h.
| ︙ | |||
16 17 18 19 20 21 22 | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | - - + + | /* * Constants */ #define JULIAN_DAY_POSIX_EPOCH 2440588 #define GREGORIAN_CHANGE_DATE 2361222 #define SECONDS_PER_DAY 86400 |
| ︙ | |||
482 483 484 485 486 487 488 | 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | - - + + |
unsigned fmtTokC;
#if CLOCK_FMT_SCN_STORAGE_GC_SIZE > 0
ClockFmtScnStorage *nextPtr;
ClockFmtScnStorage *prevPtr;
#endif
size_t fmtMinAlloc;
#if 0
|
| ︙ |
Changes to generic/tclDictObj.c.
| ︙ | |||
127 128 129 130 131 132 133 | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | - + |
* dictionary. Used for doing traversal of the
* entries in the order that they are
* created. */
ChainEntry *entryChainTail; /* Other end of linked list of all entries in
* the dictionary. Used for doing traversal of
* the entries in the order that they are
* created. */
|
| ︙ | |||
159 160 161 162 163 164 165 | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | - - - - - - + + + + + + - - - - - + + + + + - + |
NULL,
NULL,
NULL,
NULL,
NULL)
};
|
| ︙ | |||
623 624 625 626 627 628 629 | 623 624 625 626 627 628 629 630 631 632 633 634 635 636 | - |
/* Cannot fail, we already know the Tcl_ObjType is "list". */
TclListObjGetElements(NULL, objPtr, &objc, &objv);
if (objc & 1) {
goto missingValue;
}
for (i=0 ; i<objc ; i+=2) {
|
| ︙ | |||
1273 1274 1275 1276 1277 1278 1279 | 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 | - + | * Removes a reference to the dictionary's internal rep. * *---------------------------------------------------------------------- */ void Tcl_DictObjDone( |
| ︙ | |||
2100 2101 2102 2103 2104 2105 2106 | 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 | - + - + |
*
*----------------------------------------------------------------------
*/
Tcl_Obj *
TclDictObjSmartRef(
Tcl_Interp *interp,
|
| ︙ | |||
3918 3919 3920 3921 3922 3923 3924 | 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 | - |
TclCopyAndCollapse(elemSize, elemStart, check));
}
llen++;
}
Tcl_DecrRefCount(elemPtr);
return llen;
}
|
| ︙ |
Changes to generic/tclDisassemble.c.
| ︙ | |||
41 42 43 44 45 46 47 | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | - - - - + + + + - - + + - - - + + + - |
NULL, /* freeIntRepProc */
NULL, /* dupIntRepProc */
UpdateStringOfInstName, /* updateStringProc */
NULL, /* setFromAnyProc */
TCL_OBJTYPE_V0
};
|
| ︙ | |||
275 276 277 278 279 280 281 | 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 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 332 333 334 335 336 337 338 339 340 | - + + - + + + - - + + + + - + + + |
numCmds = codePtr->numCommands;
/*
* Print header lines describing the ByteCode.
*/
Tcl_AppendPrintfToObj(bufferObj,
|
| ︙ | |||
351 352 353 354 355 356 357 | 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 | + - + - + + + - + |
}
/*
* Print the ExceptionRange array.
*/
if ((int)codePtr->numExceptRanges > 0) {
Tcl_AppendPrintfToObj(bufferObj,
|
| ︙ | |||
442 443 444 445 446 447 448 | 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 | - + + |
srcLen = TclGetInt4AtPtr(srcLengthNext);
srcLengthNext += 4;
} else {
srcLen = TclGetInt1AtPtr(srcLengthNext);
srcLengthNext++;
}
|
| ︙ | |||
700 701 702 703 704 705 706 | 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 | - - + + |
case INST_LNOT:
case INST_BITNOT:
case INST_UMINUS:
case INST_UPLUS:
case INST_TRY_CVT_TO_NUMERIC:
case INST_EXPAND_STKTOP:
case INST_EXPR_STK:
|
| ︙ | |||
728 729 730 731 732 733 734 | 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 | - - + + - - - + + + - - + + - + - - - + + + - + - - - + + + - + - + - - - - - + + + + - + - - - - - + + + + + |
case INST_BITXOR:
case INST_BITAND:
case INST_EXPON:
case INST_ADD:
case INST_SUB:
case INST_DIV:
case INST_MULT:
|
| ︙ | |||
825 826 827 828 829 830 831 | 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 | - + - + |
*----------------------------------------------------------------------
*/
static void
UpdateStringOfInstName(
Tcl_Obj *objPtr)
{
|
| ︙ | |||
1143 1144 1145 1146 1147 1148 1149 | 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 | - + + + - + + |
TclNewObj(exn);
for (i=0 ; i<(int)codePtr->numExceptRanges ; i++) {
ExceptionRange *rangePtr = &codePtr->exceptArrayPtr[i];
switch (rangePtr->type) {
case LOOP_EXCEPTION_RANGE:
Tcl_ListObjAppendElement(NULL, exn, Tcl_ObjPrintf(
|
| ︙ | |||
1265 1266 1267 1268 1269 1270 1271 | 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 | - + | * in order to disassemble them. * *---------------------------------------------------------------------- */ int Tcl_DisassembleObjCmd( |
| ︙ |
Changes to generic/tclEncoding.c.
| ︙ | |||
30 31 32 33 34 35 36 | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | - + - + |
* into UTF-8. */
Tcl_EncodingConvertProc *fromUtfProc;
/* Function to convert from UTF-8 into
* external encoding. */
Tcl_EncodingFreeProc *freeProc;
/* If non-NULL, function to call when this
* encoding is deleted. */
|
| ︙ | |||
115 116 117 118 119 120 121 | 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | - + + - - - - - + + + + + + |
* conversion. */
char prefixBytes[256]; /* If a byte in the input stream is the first
* character of one of the escape sequences in
* the following array, the corresponding
* entry in this array is 1, otherwise it is
* 0. */
int numSubTables; /* Length of following array. */
|
| ︙ | |||
197 198 199 200 201 202 203 | 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 | - + - + - + - - - + + + |
int value;
} encodingProfiles[] = {
{"replace", TCL_ENCODING_PROFILE_REPLACE},
{"strict", TCL_ENCODING_PROFILE_STRICT},
{"tcl8", TCL_ENCODING_PROFILE_TCL8},
};
|
| ︙ | |||
254 255 256 257 258 259 260 | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | - - + - + - + - - - + + + - | static Tcl_EncodingConvertProc Utf16ToUtfProc; static Tcl_EncodingConvertProc UtfToUtf16Proc; static Tcl_EncodingConvertProc UtfToUcs2Proc; static Tcl_EncodingConvertProc UtfToUtfProc; static Tcl_EncodingConvertProc Iso88591FromUtfProc; static Tcl_EncodingConvertProc Iso88591ToUtfProc; |
| ︙ | |||
508 509 510 511 512 513 514 | 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 | + - - - + + + + |
/*
* NOTE: THESE BIT DEFINITIONS SHOULD NOT OVERLAP WITH INTERNAL USE BITS
* DEFINED IN tcl.h (TCL_ENCODING_* et al). Be cognizant of this
* when adding bits. TODO - should really be defined in a single file.
*
* To prevent conflicting bits, only define bits within 0xff00 mask here.
*/
enum EncodingFlags {
|
| ︙ | |||
1123 1124 1125 1126 1127 1128 1129 | 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 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 | - - - - - - - + + + + + + + - - - - - - - - - + + + + + + + + - - + + - + - + - - - + + + |
* "flags" controls the behavior if any of the bytes in
* the source buffer are invalid or cannot be represented in utf-8.
* Possible flags values:
* target encoding. It should be composed by OR-ing the following:
* - *At most one* of TCL_ENCODING_PROFILE{DEFAULT,TCL8,STRICT}
*
* Results:
|
| ︙ | |||
1426 1427 1428 1429 1430 1431 1432 | 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 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 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 | - - - - - - - - + + + + + + + - - - - - - - - + + + + + + + + - - + + - + - - - + + + |
Tcl_DString *dstPtr) /* Uninitialized or free DString in which the
* converted string is stored. */
{
Tcl_UtfToExternalDStringEx(
NULL, encoding, src, srcLen, TCL_ENCODING_PROFILE_TCL8, dstPtr, NULL);
return Tcl_DStringValue(dstPtr);
}
|
| ︙ | |||
2458 2459 2460 2461 2462 2463 2464 | 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 | - |
dstStart = dst;
flags |= PTR2INT(clientData);
dstEnd = dst + dstLen - ((flags & ENCODING_UTF) ? TCL_UTF_MAX : 6);
profile = ENCODING_PROFILE_GET(flags);
for (numChars = 0; src < srcEnd && numChars <= charLimit; numChars++) {
|
| ︙ | |||
2499 2500 2501 2502 2503 2504 2505 | 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 | - - - + + | /* * Convert 0xC080 to real nulls when we are in output mode, * irrespective of the profile. */ *dst++ = 0; src += 2; } |
| ︙ | |||
2593 2594 2595 2596 2597 2598 2599 | 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 | - + | * None. * *------------------------------------------------------------------------- */ static int Utf32ToUtfProc( |
| ︙ | |||
2722 2723 2724 2725 2726 2727 2728 | 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 | - + | * None. * *------------------------------------------------------------------------- */ static int UtfToUtf32Proc( |
| ︙ | |||
2821 2822 2823 2824 2825 2826 2827 | 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 | - + | * None. * *------------------------------------------------------------------------- */ static int Utf16ToUtfProc( |
| ︙ | |||
2999 3000 3001 3002 3003 3004 3005 | 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 | - + | * None. * *------------------------------------------------------------------------- */ static int UtfToUtf16Proc( |
| ︙ | |||
3107 3108 3109 3110 3111 3112 3113 | 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 | - + | * None. * *------------------------------------------------------------------------- */ static int UtfToUcs2Proc( |
| ︙ | |||
3211 3212 3213 3214 3215 3216 3217 | 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 | - + | * None. * *------------------------------------------------------------------------- */ static int TableToUtfProc( |
| ︙ | |||
3339 3340 3341 3342 3343 3344 3345 | 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 | - + | * None. * *------------------------------------------------------------------------- */ static int TableFromUtfProc( |
| ︙ | |||
3631 3632 3633 3634 3635 3636 3637 | 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 | - + | * Memory freed. * *--------------------------------------------------------------------------- */ static void TableFreeProc( |
| ︙ | |||
3666 3667 3668 3669 3670 3671 3672 | 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 | - + | * None. * *------------------------------------------------------------------------- */ static int EscapeToUtfProc( |
| ︙ | |||
3879 3880 3881 3882 3883 3884 3885 | 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 | - + | * None. * *------------------------------------------------------------------------- */ static int EscapeFromUtfProc( |
| ︙ | |||
4090 4091 4092 4093 4094 4095 4096 | 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 | - + | * Memory is freed. * *--------------------------------------------------------------------------- */ static void EscapeFreeProc( |
| ︙ | |||
4315 4316 4317 4318 4319 4320 4321 | 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 | - + - + |
Tcl_Obj *errorObj = Tcl_ObjPrintf("bad profile name \"%s\": must be",
profileName);
for (i = 0; i < (numProfiles - 1); ++i) {
Tcl_AppendStringsToObj(
errorObj, " ", encodingProfiles[i].name, ",", (void *)NULL);
}
Tcl_AppendStringsToObj(
|
| ︙ | |||
4356 4357 4358 4359 4360 4361 4362 | 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 | - + |
}
}
if (interp) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"Internal error. Bad profile id \"%d\".",
profileValue));
Tcl_SetErrorCode(
|
| ︙ | |||
4384 4385 4386 4387 4388 4389 4390 | 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 | - - + + |
TclGetEncodingProfiles(Tcl_Interp *interp)
{
size_t i, n;
Tcl_Obj *objPtr;
n = sizeof(encodingProfiles) / sizeof(encodingProfiles[0]);
objPtr = Tcl_NewListObj(n, NULL);
for (i = 0; i < n; ++i) {
|
Changes to generic/tclEnsemble.c.
| ︙ | |||
81 82 83 84 85 86 87 | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | - + - + - - - + + + - - - - - - - - + + + + + + + + + + + + + + + + + + + + |
FreeEnsembleCmdRep, /* freeIntRepProc */
DupEnsembleCmdRep, /* dupIntRepProc */
NULL, /* updateStringProc */
NULL, /* setFromAnyProc */
TCL_OBJTYPE_V0
};
|
| ︙ | |||
793 794 795 796 797 798 799 | 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 | - - - - + |
Tcl_Obj *subcmdList)
{
Command *cmdPtr = (Command *) token;
EnsembleConfig *ensemblePtr;
Tcl_Obj *oldList;
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
|
| ︙ | |||
869 870 871 872 873 874 875 | 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 | - - - - + |
{
Command *cmdPtr = (Command *) token;
EnsembleConfig *ensemblePtr;
Tcl_Obj *oldList;
Tcl_Size length;
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
|
| ︙ | |||
945 946 947 948 949 950 951 | 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 | - - - - + |
Tcl_Obj *mapDict)
{
Command *cmdPtr = (Command *) token;
EnsembleConfig *ensemblePtr;
Tcl_Obj *oldDict;
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
|
| ︙ | |||
1045 1046 1047 1048 1049 1050 1051 | 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 | - - - - + |
Tcl_Obj *unknownList)
{
Command *cmdPtr = (Command *) token;
EnsembleConfig *ensemblePtr;
Tcl_Obj *oldList;
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
|
| ︙ | |||
1111 1112 1113 1114 1115 1116 1117 | 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 | - - - - + |
int flags)
{
Command *cmdPtr = (Command *) token;
EnsembleConfig *ensemblePtr;
int wasCompiled;
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
|
| ︙ | |||
1187 1188 1189 1190 1191 1192 1193 | 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 | - - - - - - + |
Tcl_Command token,
Tcl_Obj **subcmdListPtr)
{
Command *cmdPtr = (Command *) token;
EnsembleConfig *ensemblePtr;
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
|
| ︙ | |||
1229 1230 1231 1232 1233 1234 1235 | 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 | - - - - - - + |
Tcl_Command token,
Tcl_Obj **paramListPtr)
{
Command *cmdPtr = (Command *) token;
EnsembleConfig *ensemblePtr;
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
|
| ︙ | |||
1271 1272 1273 1274 1275 1276 1277 | 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 | - - - - - - + |
Tcl_Command token,
Tcl_Obj **mapDictPtr)
{
Command *cmdPtr = (Command *) token;
EnsembleConfig *ensemblePtr;
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
|
| ︙ | |||
1312 1313 1314 1315 1316 1317 1318 | 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 | - - - - - - + |
Tcl_Command token,
Tcl_Obj **unknownListPtr)
{
Command *cmdPtr = (Command *) token;
EnsembleConfig *ensemblePtr;
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
|
| ︙ | |||
1353 1354 1355 1356 1357 1358 1359 | 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 | - - - - - - + |
Tcl_Command token,
int *flagsPtr)
{
Command *cmdPtr = (Command *) token;
EnsembleConfig *ensemblePtr;
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
|
| ︙ | |||
1394 1395 1396 1397 1398 1399 1400 | 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 | - - - - - - + |
Tcl_Command token,
Tcl_Namespace **namespacePtrPtr)
{
Command *cmdPtr = (Command *) token;
EnsembleConfig *ensemblePtr;
if (cmdPtr->objProc != TclEnsembleImplementationCmd) {
|
| ︙ | |||
1795 1796 1797 1798 1799 1800 1801 | 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 | - |
* Look in the hashtable for the named subcommand. This is the fastest
* path if there is no cache in operation.
*/
hPtr = Tcl_FindHashEntry(&ensemblePtr->subcommandTable,
TclGetString(subObj));
if (hPtr != NULL) {
|
| ︙ | |||
2480 2481 2482 2483 2484 2485 2486 | 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 | - - + + - - - - - - + + + + + + |
static void
ClearTable(
EnsembleConfig *ensemblePtr)
{
Tcl_HashTable *hash = &ensemblePtr->subcommandTable;
if (hash->numEntries != 0) {
|
| ︙ | |||
2591 2592 2593 2594 2595 2596 2597 | 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 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 | - - - + + + - - - - + + + + - - - - - - + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - + + + + + + - + - - - - - - - - + + + + + + + + - - - - + + + + - + - - - - - - + + + + + + - - - - - + + + + + - - - + + + - - - - + + + + - - - - - + + + + + |
Tcl_Obj *mapDict = ensemblePtr->subcommandDict;
Tcl_Obj *subList = ensemblePtr->subcmdList;
ClearTable(ensemblePtr);
Tcl_InitHashTable(hash, TCL_STRING_KEYS);
if (subList) {
|
| ︙ | |||
3189 3190 3191 3192 3193 3194 3195 | 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 | - - - + + + |
}
/*
* Throw out any line information generated by the failed compile attempt.
*/
while (mapPtr->nuloc > eclIndex + 1) {
|
| ︙ |
Changes to generic/tclEnv.c.
| ︙ | |||
32 33 34 35 36 37 38 | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | - - + - + | # define tenviron2utfdstr(str, dsPtr) \ Tcl_ExternalToUtfDString(NULL, str, -1, dsPtr) # define utf2tenvirondstr(str, dsPtr) \ Tcl_UtfToExternalDString(NULL, str, -1, dsPtr) # define techar char #endif |
| ︙ | |||
806 807 808 809 810 811 812 813 814 815 816 817 818 819 | 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 | + |
* unlikely, so we don't bother. However, in the case of DPURIFY, just
* free all strings in the cache.
*/
if (env.cache) {
#ifdef PURIFY
Tcl_Size i;
for (i = 0; i < env.cacheSize; i++) {
Tcl_Free(env.cache[i]);
}
#endif
Tcl_Free(env.cache);
env.cache = NULL;
env.cacheSize = 0;
|
| ︙ |
Changes to generic/tclEvent.c.
| ︙ | |||
65 66 67 68 69 70 71 | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | - + |
/*
* For each exit handler created with a call to Tcl_Create(Late)ExitHandler
* there is a structure of the following type:
*/
typedef struct ExitHandler {
Tcl_ExitProc *proc; /* Function to call when process exits. */
|
| ︙ | |||
115 116 117 118 119 120 121 | 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | - + |
* standard channels. */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
#if TCL_THREADS
typedef struct {
Tcl_ThreadCreateProc *proc; /* Main() function of the thread */
|
| ︙ | |||
205 206 207 208 209 210 211 | 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | - + | * Depends on what actions the handler command takes for the errors. * *---------------------------------------------------------------------- */ static void HandleBgErrors( |
| ︙ | |||
609 610 611 612 613 614 615 | 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 | - + | * reports, they are canceled. * *---------------------------------------------------------------------- */ static void BgErrorDeleteProc( |
| ︙ | |||
648 649 650 651 652 653 654 | 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 | - + |
*
*----------------------------------------------------------------------
*/
void
Tcl_CreateExitHandler(
Tcl_ExitProc *proc, /* Function to invoke. */
|
| ︙ | |||
681 682 683 684 685 686 687 | 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 | - + |
*
*----------------------------------------------------------------------
*/
void
TclCreateLateExitHandler(
Tcl_ExitProc *proc, /* Function to invoke. */
|
| ︙ | |||
714 715 716 717 718 719 720 | 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 | - + |
*
*----------------------------------------------------------------------
*/
void
Tcl_DeleteExitHandler(
Tcl_ExitProc *proc, /* Function that was previously registered. */
|
| ︙ | |||
757 758 759 760 761 762 763 | 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 | - + |
*
*----------------------------------------------------------------------
*/
void
TclDeleteLateExitHandler(
Tcl_ExitProc *proc, /* Function that was previously registered. */
|
| ︙ | |||
800 801 802 803 804 805 806 | 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 | - + |
*
*----------------------------------------------------------------------
*/
void
Tcl_CreateThreadExitHandler(
Tcl_ExitProc *proc, /* Function to invoke. */
|
| ︙ | |||
833 834 835 836 837 838 839 | 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 | - + |
*
*----------------------------------------------------------------------
*/
void
Tcl_DeleteThreadExitHandler(
Tcl_ExitProc *proc, /* Function that was previously registered. */
|
| ︙ | |||
873 874 875 876 877 878 879 | 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 | - + | * Sets the application wide exit handler to the specified value. * *---------------------------------------------------------------------- */ Tcl_ExitProc * Tcl_SetExitProc( |
| ︙ | |||
970 971 972 973 974 975 976 | 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 | - - - - - - |
* returns, so critical is this dependency.
*
* If subsystems are not (yet) initialized, proper Tcl-finalization is
* impossible, so fallback to system exit, see bug-[f8a33ce3db5d8cc2].
*/
if (currentAppExitPtr) {
|
| ︙ | |||
1131 1132 1133 1134 1135 1136 1137 | 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 | - - + |
/*
* Double check inside the mutex. There are definitely calls back into
* this routine from some of the functions below.
*/
TclpInitLock();
if (subsystemsInitialized == 0) {
|
| ︙ | |||
2051 2052 2053 2054 2055 2056 2057 | 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 | - + |
*/
int
Tcl_CreateThread(
Tcl_ThreadId *idPtr, /* Return, the ID of the thread */
Tcl_ThreadCreateProc *proc, /* Main() function of the thread */
void *clientData, /* The one argument to Main() */
|
| ︙ |
Changes to generic/tclExecute.c.
| ︙ | |||
188 189 190 191 192 193 194 | 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 | - + - + | * We use the new compile-time assertions to check that nCleanup is constant * and within range. */ /* Verify the stack depth, only when no expansion is in progress */ #ifdef TCL_COMPILE_DEBUG |
| ︙ | |||
232 233 234 235 236 237 238 | 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | - + |
case 1: goto cleanup1; \
case 2: goto cleanup2; \
case 0: break; \
} \
} \
} while (0)
|
| ︙ | |||
372 373 374 375 376 377 378 379 380 | 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 | + + + + + + + + + + + + + + - - + - - - - + - - |
/*
* Macros used to trace instruction execution. The macros TRACE,
* TRACE_WITH_OBJ, and O2S are only used inside TclNRExecuteByteCode. O2S is
* only used in TRACE* calls to get a string from an object.
*/
#ifdef TCL_COMPILE_DEBUG
/* Factor out a large print so we only get warnings about it once. */
static inline void
PrintTracePrefix(
Interp *iPtr,
int currDepth,
const ByteCode *codePtr,
const unsigned char *pc)
{
fprintf(stdout,
"%2" TCL_SIZE_MODIFIER "d: %2" TCL_T_MODIFIER "d (%" TCL_T_MODIFIER "d) %s ",
iPtr->numLevels, currDepth, pc - codePtr->codeStart, GetOpcodeName(pc));
}
# define TRACE(a) \
while (traceInstructions) { \
|
| ︙ | |||
599 600 601 602 603 604 605 | 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 | - + | /* * Markers for ExecuteExtendedBinaryMathOp. */ #define DIVIDED_BY_ZERO ((Tcl_Obj *) -1) #define EXPONENT_OF_ZERO ((Tcl_Obj *) -2) #define GENERAL_ARITHMETIC_ERROR ((Tcl_Obj *) -3) |
| ︙ | |||
1019 1020 1021 1022 1023 1024 1025 | 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 | - |
* the marker, (WALLOCALIGN-1) for the maximal possible offset.
*/
if (move) {
moveWords = esPtr->tosPtr - MEMSTART(markerPtr) + 1;
}
needed = growth + moveWords + WALLOCALIGN;
|
| ︙ | |||
1559 1560 1561 1562 1563 1564 1565 | 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 | - + |
TclCompileObj(
Tcl_Interp *interp,
Tcl_Obj *objPtr,
const CmdFrame *invoker,
int word)
{
Interp *iPtr = (Interp *) interp;
|
| ︙ | |||
2023 2024 2025 2026 2027 2028 2029 | 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 | - - + + - + |
/*
* Globals: variables that store state, must remain valid at all times.
*/
Tcl_Obj **tosPtr; /* Cached pointer to top of evaluation
* stack. */
const unsigned char *pc = (const unsigned char *)data[1];
|
| ︙ | |||
2087 2088 2089 2090 2091 2092 2093 | 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 | - + |
TclNewObj(objPtr);
Tcl_IncrRefCount(objPtr);
iPtr->objResultPtr = objPtr;
}
goto cleanup0;
} else {
|
| ︙ | |||
2520 2521 2522 2523 2524 2525 2526 | 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 | - |
result = TCL_RETURN;
cleanup = opnd;
goto processExceptionReturn;
}
case INST_DONE:
if (tosPtr > initTosPtr) {
|
| ︙ | |||
4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 | 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 | + - - - + + - + |
/*
* Extract the desired list element.
*/
{
Tcl_Size value2Length;
Tcl_Obj *indexListPtr = value2Ptr;
int code;
if ((TclListObjGetElements(interp, valuePtr, &objc, &objv) == TCL_OK)
&& (!TclHasInternalRep(value2Ptr, &tclListType)
|| (Tcl_ListObjLength(interp, value2Ptr, &value2Length),
value2Length == 1
? (indexListPtr = TclListObjGetElement(value2Ptr, 0), 1)
: 0))) {
|
| ︙ | |||
4921 4922 4923 4924 4925 4926 4927 | 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 | - + |
* Compute the new variable value.
*/
DECACHE_STACK_INFO();
if (TclObjTypeHasProc(valuePtr, setElementProc)) {
objResultPtr = TclObjTypeSetElement(interp,
valuePtr, numIndices,
|
| ︙ | |||
5070 5071 5072 5073 5074 5075 5076 | 5076 5077 5078 5079 5080 5081 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 5136 5137 5138 5139 5140 5141 5142 | - - + + - - - - - - - + + + + + + + - - - - - - - - - - + + + + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - + + - - - - + + + + |
NEXT_INST_F(9, 1, 1);
case INST_LIST_IN:
case INST_LIST_NOT_IN: /* Basic list containment operators. */
value2Ptr = OBJ_AT_TOS;
valuePtr = OBJ_UNDER_TOS;
|
| ︙ | |||
5559 5560 5561 5562 5563 5564 5565 | 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 | - + |
objResultPtr = Tcl_NewUnicodeObj(ustring1, 0);
p = ustring1;
end = ustring1 + slength;
for (; ustring1 < end; ustring1++) {
if ((*ustring1 == *ustring2) &&
/* Fix bug [69218ab7b]: restrict max compare length. */
((end - ustring1) >= length2) && (length2 == 1 ||
|
| ︙ | |||
5788 5789 5790 5791 5792 5793 5794 | 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 | - - - + + + |
case INST_GE: {
int iResult = 0, compare = 0;
value2Ptr = OBJ_AT_TOS;
valuePtr = OBJ_UNDER_TOS;
/*
|
| ︙ | |||
6599 6600 6601 6602 6603 6604 6605 | 6604 6605 6606 6607 6608 6609 6610 6611 6612 6613 6614 6615 6616 6617 | - |
interp, listPtr, &listLen, &elements);
}
if (status != TCL_OK) {
CACHE_STACK_INFO();
goto gotError;
}
CACHE_STACK_INFO();
|
| ︙ | |||
7866 7867 7868 7869 7870 7871 7872 | 7870 7871 7872 7873 7874 7875 7876 7877 7878 7879 7880 7881 7882 7883 7884 7885 7886 7887 | - - + + + + | /* * WidePwrSmallExpon -- * * Helper to calculate small powers of integers whose result is wide. */ static inline Tcl_WideInt |
| ︙ | |||
8371 8372 8373 8374 8375 8376 8377 | 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 | - |
*/
return constants[1];
}
}
}
if (negativeExponent) {
|
| ︙ | |||
8956 8957 8958 8959 8960 8961 8962 | 8961 8962 8963 8964 8965 8966 8967 8968 8969 8970 8971 8972 8973 8974 8975 | - + | * None. * *---------------------------------------------------------------------- */ static void PrintByteCodeInfo( |
| ︙ | |||
8980 8981 8982 8983 8984 8985 8986 | 8985 8986 8987 8988 8989 8990 8991 8992 8993 8994 8995 8996 8997 8998 8999 | - + |
codePtr->numSrcBytes?
((float)codePtr->structureSize)/codePtr->numSrcBytes :
#endif
0.0);
#ifdef TCL_COMPILE_STATS
fprintf(stdout, " Code %" TCL_Z_MODIFIER "u = header %" TCL_Z_MODIFIER "u+inst %" TCL_Z_MODIFIER
|
| ︙ | |||
9020 9021 9022 9023 9024 9025 9026 | 9025 9026 9027 9028 9029 9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 | - + | * *---------------------------------------------------------------------- */ #ifdef TCL_COMPILE_DEBUG static void ValidatePcAndStackTop( |
| ︙ | |||
9092 9093 9094 9095 9096 9097 9098 | 9097 9098 9099 9100 9101 9102 9103 9104 9105 9106 9107 9108 9109 9110 9111 | - + |
*----------------------------------------------------------------------
*/
static void
IllegalExprOperandType(
Tcl_Interp *interp, /* Interpreter to which error information
* pertains. */
|
| ︙ | |||
9156 9157 9158 9159 9160 9161 9162 | 9161 9162 9163 9164 9165 9166 9167 9168 9169 9170 9171 9172 9173 9174 9175 9176 9177 9178 9179 9180 9181 9182 9183 9184 9185 9186 9187 9188 9189 9190 9191 9192 9193 9194 9195 9196 9197 9198 9199 9200 9201 9202 | - + - + - + - + - + - |
Tcl_Obj *
TclGetSourceFromFrame(
CmdFrame *cfPtr,
int objc,
Tcl_Obj *const objv[])
{
if (cfPtr == NULL) {
|
| ︙ | |||
9542 9543 9544 9545 9546 9547 9548 | 9546 9547 9548 9549 9550 9551 9552 9553 9554 9555 9556 9557 9558 9559 9560 | - + | * None. * *---------------------------------------------------------------------- */ int TclLog2( |
| ︙ |
Changes to generic/tclFCmd.c.
| ︙ | |||
258 259 260 261 262 263 264 | 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | - |
for (j = 0; j < pobjc; j++) {
int errCount = 2;
target = Tcl_FSJoinPath(split, j + 1);
Tcl_IncrRefCount(target);
createDir:
|
| ︙ | |||
425 426 427 428 429 430 431 | 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 | - + + + |
}
}
} else {
result = Tcl_FSDeleteFile(objv[i]);
}
if (result != TCL_OK) {
|
| ︙ |
Changes to generic/tclFileName.c.
| ︙ | |||
36 37 38 39 40 41 42 | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | - - - + + + + | const char *separators, Tcl_Obj *pathPtr, int flags, char *pattern, Tcl_GlobTypeData *types); static int TclGlob(Tcl_Interp *interp, char *pattern, Tcl_Obj *pathPrefix, int globFlags, Tcl_GlobTypeData *types); /* Flag values used by TclGlob() */ |
| ︙ | |||
247 248 249 250 251 252 253 | 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | - - - - - |
*/
if (path[4] == '\0') {
abs = 4;
} else if (path[4] == ':' && path[5] == '\0') {
abs = 5;
}
|
| ︙ | |||
386 387 388 389 390 391 392 | 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 427 428 429 430 431 432 433 434 435 436 437 438 439 | - + - - - + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - + + + + + + - - + + - - - - - - - - - - - + + + + + + + + + + + |
Tcl_Obj **driveNameRef)
{
Tcl_PathType type = TCL_PATH_ABSOLUTE;
const char *path = TclGetString(pathPtr);
switch (tclPlatform) {
case TCL_PLATFORM_UNIX: {
|
| ︙ | |||
650 651 652 653 654 655 656 | 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 | - - - + + + |
for (;;) {
elementStart = path;
while ((*path != '\0') && (*path != '/')) {
path++;
}
length = path - elementStart;
if (length > 0) {
|
| ︙ | |||
713 714 715 716 717 718 719 720 721 722 723 724 725 726 | 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 | + |
elementStart = p;
while ((*p != '\0') && (*p != '/') && (*p != '\\')) {
p++;
}
length = p - elementStart;
if (length > 0) {
Tcl_Obj *nextElt;
if ((elementStart != path) &&
isalpha(UCHAR(elementStart[0])) &&
(elementStart[1] == ':')) {
TclNewLiteralStringObj(nextElt, "./");
Tcl_AppendToObj(nextElt, elementStart, length);
} else {
nextElt = Tcl_NewStringObj(elementStart, length);
|
| ︙ | |||
1158 1159 1160 1161 1162 1163 1164 | 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 | - + - + |
Tcl_ResetResult(interp);
break;
}
}
switch (index) {
|
| ︙ | |||
1186 1187 1188 1189 1190 1191 1192 | 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 | - + - + - + - + - + | return TCL_ERROR; } dir = PATH_DIR; globFlags |= TCL_GLOBMODE_DIR; pathOrDir = objv[i+1]; i++; break; |
| ︙ | |||
1274 1275 1276 1277 1278 1279 1280 | 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 | - |
if (last == first + pathlength) {
/*
* It's really a directory.
*/
dir = PATH_DIR;
|
| ︙ | |||
1402 1403 1404 1405 1406 1407 1408 | 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 | - - | break; case 's': globTypes->type |= TCL_GLOB_TYPE_SOCK; break; default: goto badTypesArg; } |
| ︙ | |||
1693 1694 1695 1696 1697 1698 1699 | 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 | - | /* * ':' no longer needed as a separator. It is only relevant to the * beginning of the path. */ separators = "/\\"; |
| ︙ | |||
2003 2004 2005 2006 2007 2008 2009 | 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 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 | - - - - |
*/
openBrace = closeBrace = NULL;
quoted = 0;
for (p = pattern; *p != '\0'; p++) {
if (quoted) {
quoted = 0;
|
| ︙ |
Changes to generic/tclHash.c.
| ︙ | |||
282 283 284 285 286 287 288 | 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | - + - - + + - |
for (hPtr = tablePtr->buckets[index]; hPtr != NULL;
hPtr = hPtr->nextPtr) {
if (hash != hPtr->hash) {
continue;
}
/* if keys pointers or values are equal */
if ((key == hPtr->key.oneWordValue)
|
| ︙ | |||
669 670 671 672 673 674 675 | 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 | - + |
*
*----------------------------------------------------------------------
*/
static Tcl_HashEntry *
AllocArrayEntry(
Tcl_HashTable *tablePtr, /* Hash table. */
|
| ︙ | |||
705 706 707 708 709 710 711 | 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 | - + | * None. * *---------------------------------------------------------------------- */ static int CompareArrayKeys( |
| ︙ | |||
734 735 736 737 738 739 740 | 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 | - + |
*
*----------------------------------------------------------------------
*/
static size_t
HashArrayKey(
Tcl_HashTable *tablePtr, /* Hash table. */
|
| ︙ | |||
766 767 768 769 770 771 772 | 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 | - + |
*
*----------------------------------------------------------------------
*/
static Tcl_HashEntry *
AllocStringEntry(
TCL_UNUSED(Tcl_HashTable *),
|
| ︙ | |||
802 803 804 805 806 807 808 | 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 | - + | * None. * *---------------------------------------------------------------------- */ static int CompareStringKeys( |
| ︙ | |||
828 829 830 831 832 833 834 | 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 | - + |
*
*----------------------------------------------------------------------
*/
static size_t
HashStringKey(
TCL_UNUSED(Tcl_HashTable *),
|
| ︙ | |||
982 983 984 985 986 987 988 | 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 | - - + + |
*/
tablePtr->numBuckets *= 4;
if (typePtr->flags & TCL_HASH_KEY_SYSTEM_HASH) {
tablePtr->buckets = (Tcl_HashEntry **)TclpSysAlloc(
tablePtr->numBuckets * sizeof(Tcl_HashEntry *));
} else {
|
| ︙ |
Changes to generic/tclIO.c.
| ︙ | |||
101 102 103 104 105 106 107 | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | - + |
int writeFlags; /* Original write channel flags. */
Tcl_WideInt toRead; /* Number of bytes to copy, or -1. */
Tcl_WideInt total; /* Total bytes transferred (written). */
Tcl_Interp *interp; /* Interp that started the copy. */
Tcl_Obj *cmdPtr; /* Command to be invoked at completion. */
Tcl_Size bufSize; /* Size of appended buffer. */
char buffer[TCLFLEXARRAY]; /* Copy buffer, this must be the last
|
| ︙ | |||
226 227 228 229 230 231 232 | 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | - + | const char *src, int *dstLenPtr, int *srcLenPtr); static void UpdateInterest(Channel *chanPtr); static Tcl_Size Write(Channel *chanPtr, const char *src, Tcl_Size srcLen, Tcl_Encoding encoding); static Tcl_Obj * FixLevelCode(Tcl_Obj *msg); static void SpliceChannel(Tcl_Channel chan); static void CutChannel(Tcl_Channel chan); |
| ︙ | |||
331 332 333 334 335 336 337 | 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | - - + + - + - + - + - + - + - - + + |
} ResolvedChanName;
static void DupChannelInternalRep(Tcl_Obj *objPtr, Tcl_Obj *copyPtr);
static void FreeChannelInternalRep(Tcl_Obj *objPtr);
static const Tcl_ObjType chanObjType = {
"channel", /* name for this type */
|
| ︙ | |||
427 428 429 430 431 432 433 | 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 | - + - + - + |
/*
* Each read op must set the blocked and eof states anew, not let
* the effect of prior reads leak through.
*/
if (GotFlag(chanPtr->state, CHANNEL_EOF)) {
|
| ︙ | |||
584 585 586 587 588 589 590 | 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 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 | - - + + - - - - - + + + + + - - - + + + - + - - - + + + - - - - - + + + + + - - - + + + |
int doflushnb;
/*
* Fetch the pre-TIP#398 compatibility flag.
*/
{
|
| ︙ | |||
845 846 847 848 849 850 851 | 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 | - + |
void
Tcl_CreateCloseHandler(
Tcl_Channel chan, /* The channel for which to create the close
* callback. */
Tcl_CloseProc *proc, /* The callback routine to call when the
* channel will be closed. */
|
| ︙ | |||
883 884 885 886 887 888 889 | 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 | - + |
void
Tcl_DeleteCloseHandler(
Tcl_Channel chan, /* The channel for which to cancel the close
* callback. */
Tcl_CloseProc *proc, /* The procedure for the callback to
* remove. */
|
| ︙ | |||
982 983 984 985 986 987 988 | 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 | - + | * registered in this interpreter. * *---------------------------------------------------------------------- */ static void DeleteChannelTable( |
| ︙ | |||
1044 1045 1046 1047 1048 1049 1050 | 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 | - |
Tcl_DeleteHashEntry(hPtr);
statePtr->epoch++;
if (statePtr->refCount-- <= 1) {
if (!GotFlag(statePtr, BG_FLUSH_SCHEDULED)) {
(void) Tcl_CloseEx(interp, (Tcl_Channel) chanPtr, 0);
}
}
|
| ︙ | |||
1234 1235 1236 1237 1238 1239 1240 | 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 | - - + + |
ChannelState *statePtr; /* State of the real channel. */
statePtr = ((Channel *) chan)->state->bottomChanPtr->state;
if (GotFlag(statePtr, CHANNEL_INCLOSE)) {
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1462 1463 1464 1465 1466 1467 1468 | 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 | - + |
}
}
hTblPtr = GetChannelTable(interp);
hPtr = Tcl_FindHashEntry(hTblPtr, name);
if (hPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
| ︙ | |||
1551 1552 1553 1554 1555 1556 1557 | 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 | - - + + - + |
Tcl_StoreInternalRep(objPtr, &chanObjType, NULL);
}
return TCL_ERROR;
}
if (resPtr && resPtr->refCount == 1) {
/*
|
| ︙ | |||
1596 1597 1598 1599 1600 1601 1602 | 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 | - + |
*----------------------------------------------------------------------
*/
Tcl_Channel
Tcl_CreateChannel(
const Tcl_ChannelType *typePtr, /* The channel type record. */
const char *chanName, /* Name of channel to record. */
|
| ︙ | |||
1647 1648 1649 1650 1651 1652 1653 | 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 | - - - + + + |
* information for the channel.
*/
if (chanName != NULL) {
unsigned len = strlen(chanName) + 1;
/*
|
| ︙ | |||
1806 1807 1808 1809 1810 1811 1812 | 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 | - + |
Tcl_Channel
Tcl_StackChannel(
Tcl_Interp *interp, /* The interpreter we are working in */
const Tcl_ChannelType *typePtr,
/* The channel type record for the new
* channel. */
|
| ︙ | |||
1833 1834 1835 1836 1837 1838 1839 | 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 | - + |
while ((statePtr != NULL) && (statePtr->topChanPtr != prevChanPtr)) {
statePtr = statePtr->nextCSPtr;
}
if (statePtr == NULL) {
if (interp) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
| ︙ | |||
1884 1885 1886 1887 1888 1889 1890 | 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 | - + |
* 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) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
| ︙ | |||
2079 2080 2081 2082 2083 2084 2085 | 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 | - + |
* 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) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
| ︙ | |||
2404 2405 2406 2407 2408 2409 2410 | 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 | - + - - - + + + |
*----------------------------------------------------------------------
*/
int
Tcl_GetChannelHandle(
Tcl_Channel chan, /* The channel to get file from. */
int direction, /* TCL_WRITABLE or TCL_READABLE. */
|
| ︙ | |||
2444 2445 2446 2447 2448 2449 2450 | 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 | - + - + - + | * May leave an error message in the interp. * *---------------------------------------------------------------------- */ int Tcl_RemoveChannelMode( |
| ︙ | |||
2499 2500 2501 2502 2503 2504 2505 | 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 | - + | * None. * *--------------------------------------------------------------------------- */ static ChannelBuffer * AllocChannelBuffer( |
| ︙ | |||
2695 2696 2697 2698 2699 2700 2701 | 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 | - + |
if (!GotFlag(statePtr, CHANNEL_DEAD)) {
return 0;
}
Tcl_SetErrno(EINVAL);
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
2944 2945 2946 2947 2948 2949 2950 | 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 | - |
statePtr->outQueueHead = bufPtr->nextPtr;
if (statePtr->outQueueHead == NULL) {
statePtr->outQueueTail = NULL;
}
RecycleBuffer(statePtr, bufPtr, 0);
}
}
|
| ︙ | |||
3006 3007 3008 3009 3010 3011 3012 | 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 | - + |
*/
if (GotFlag(statePtr, CHANNEL_CLOSEDWRITE) &&
(statePtr->outQueueHead == NULL) &&
((statePtr->curOutPtr == NULL) ||
IsBufferEmpty(statePtr->curOutPtr))) {
errorCode = CloseChannelPart(interp, chanPtr, errorCode,
|
| ︙ | |||
3151 3152 3153 3154 3155 3156 3157 | 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 | - |
}
}
/*
* Cancel any outstanding timer.
*/
DeleteTimerHandler(statePtr);
|
| ︙ | |||
3422 3423 3424 3425 3426 3427 3428 | 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 | - + |
* referenced in any interpreter. May be NULL,
* in which case this is a no-op. */
{
CloseCallback *cbPtr; /* Iterate over close callbacks for this
* channel. */
Channel *chanPtr; /* The real IO channel. */
ChannelState *statePtr; /* State of real IO channel. */
|
| ︙ | |||
3455 3456 3457 3458 3459 3460 3461 | 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 | - - + + |
if (statePtr->refCount > 0) {
Tcl_Panic("called Tcl_Close on channel with refCount > 0");
}
if (GotFlag(statePtr, CHANNEL_INCLOSE)) {
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
3669 3670 3671 3672 3673 3674 3675 | 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 | - - + + - - + + |
if (flags & TCL_CLOSE_READ) {
msg = "read";
} else {
msg = "write";
}
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
| ︙ | |||
3744 3745 3746 3747 3748 3749 3750 | 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 | - - + + - + |
*----------------------------------------------------------------------
*/
static int
CloseWrite(
Tcl_Interp *interp, /* Interpreter for errors. */
Channel *chanPtr) /* The channel whose write side is being
|
| ︙ | |||
4038 4039 4040 4041 4042 4043 4044 | 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 | - + |
*----------------------------------------------------------------------
*/
Tcl_Size
Tcl_Write(
Tcl_Channel chan, /* The channel to buffer output for. */
const char *src, /* Data to queue in output buffer. */
|
| ︙ | |||
4150 4151 4152 4153 4154 4155 4156 | 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 | - + |
*/
Tcl_Size
Tcl_WriteChars(
Tcl_Channel chan, /* The channel to buffer output for. */
const char *src, /* UTF-8 characters to queue in output
* buffer. */
|
| ︙ | |||
4328 4329 4330 4331 4332 4333 4334 | 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 | - + - + |
*----------------------------------------------------------------------
*/
static Tcl_Size
Write(
Channel *chanPtr, /* The channel to buffer output for. */
const char *src, /* UTF-8 string to write. */
|
| ︙ | |||
5113 5114 5115 5116 5117 5118 5119 | 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 | - + |
} else {
/*
* Incoming CHANNEL_STICKY_EOF is filtered out on entry. A new
* CHANNEL_STICKY_EOF set in this routine leads to return before
* coming back here. When we are not dealing with
* CHANNEL_STICKY_EOF, a CHANNEL_EOF implies an empty buffer.
* Here the buffer is non-empty so we know we're a non-EOF.
|
| ︙ | |||
5408 5409 5410 5411 5412 5413 5414 | 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 | - + |
} else {
/*
* Incoming CHANNEL_STICKY_EOF is filtered out on entry. A new
* CHANNEL_STICKY_EOF set in this routine leads to return before
* coming back here. When we are not dealing with CHANNEL_STICKY_EOF,
* a CHANNEL_EOF implies an empty buffer. Here the buffer is
* non-empty so we know we're a non-EOF.
|
| ︙ | |||
5692 5693 5694 5695 5696 5697 5698 | 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 | - + |
*----------------------------------------------------------------------
*/
Tcl_Size
Tcl_Read(
Tcl_Channel chan, /* The channel from which to read. */
char *dst, /* Where to store input read. */
|
| ︙ | |||
5737 5738 5739 5740 5741 5742 5743 | 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 | - + |
*----------------------------------------------------------------------
*/
Tcl_Size
Tcl_ReadRaw(
Tcl_Channel chan, /* The channel from which to read. */
char *readBuf, /* Where to store input read. */
|
| ︙ | |||
5770 5771 5772 5773 5774 5775 5776 | 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 | - - + + | memcpy(readBuf, RemovePoint(bufPtr), toCopy); bufPtr->nextRemoved += toCopy; copied += toCopy; readBuf += toCopy; bytesToRead -= toCopy; /* |
| ︙ | |||
6098 6099 6100 6101 6102 6103 6104 | 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 | - + - + |
*/
assert(!GotFlag(statePtr, CHANNEL_EOF)
|| GotFlag(statePtr, CHANNEL_STICKY_EOF)
|| GotFlag(statePtr, CHANNEL_ENCODING_ERROR)
|| Tcl_InputBuffered((Tcl_Channel)chanPtr) == 0);
assert(!(GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED)
|
| ︙ | |||
6443 6444 6445 6446 6447 6448 6449 | 6440 6441 6442 6443 6444 6445 6446 6447 6448 6449 6450 6451 6452 6453 | - | } statePtr->inputEncodingFlags &= ~TCL_ENCODING_START; Tcl_SetObjLength(objPtr, numBytes + 1); return 1; } |
| ︙ | |||
6475 6476 6477 6478 6479 6480 6481 | 6471 6472 6473 6474 6475 6476 6477 6478 6479 6480 6481 6482 6483 6484 | - |
* when it converts \r\n into \n. The reduction in the number of chars
* is the difference in bytes read and written.
*/
numChars -= (dstRead - dstWrote);
if (charsToRead > 0 && numChars > charsToRead) {
|
| ︙ | |||
6788 6789 6790 6791 6792 6793 6794 | 6783 6784 6785 6786 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 | - + |
*----------------------------------------------------------------------
*/
Tcl_Size
Tcl_Ungets(
Tcl_Channel chan, /* The channel for which to add the input. */
const char *str, /* The input itself. */
|
| ︙ | |||
7050 7051 7052 7053 7054 7055 7056 | 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 | - + | bufPtr = statePtr->saveInBufPtr; statePtr->saveInBufPtr = NULL; /* * Check the actual buffersize against the requested buffersize. * Saved buffers of the wrong size are squashed. This is done to honor * dynamic changes of the buffersize made by the user. |
| ︙ | |||
7407 7408 7409 7410 7411 7412 7413 | 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 | - + |
* Seek first to force a total flush of all pending buffers and ditch any
* preread input data.
*/
WillWrite(chanPtr);
if (WillRead(chanPtr) == -1) {
|
| ︙ | |||
7734 7735 7736 7737 7738 7739 7740 | 7729 7730 7731 7732 7733 7734 7735 7736 7737 7738 7739 7740 7741 7742 7743 | - + |
*
*----------------------------------------------------------------------
*/
void
Tcl_SetChannelBufferSize(
Tcl_Channel chan, /* The channel whose buffer size to set. */
|
| ︙ | |||
7842 7843 7844 7845 7846 7847 7848 | 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 7850 7851 7852 7853 7854 7855 7856 7857 7858 7859 7860 7861 7862 7863 7864 7865 7866 7867 7868 7869 7870 7871 | - + - + - + |
{
if (interp != NULL) {
const char *genericopt =
"blocking buffering buffersize encoding eofchar profile translation";
const char **argv;
Tcl_Size argc, i;
Tcl_DString ds;
|
| ︙ | |||
7984 7985 7986 7987 7988 7989 7990 | 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 | - + |
}
}
if (len == 0 || HaveOpt(2, "-encoding")) {
if (len == 0) {
Tcl_DStringAppendElement(dsPtr, "-encoding");
}
Tcl_DStringAppendElement(dsPtr,
|
| ︙ | |||
8125 8126 8127 8128 8129 8130 8131 | 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 | - - + + |
/*
* If the channel is in the middle of a background copy, fail.
*/
if (statePtr->csPtrR || statePtr->csPtrW) {
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
8175 8176 8177 8178 8179 8180 8181 | 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 | - - - - + + + + |
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) {
|
| ︙ | |||
8325 8326 8327 8328 8329 8330 8331 | 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 | - + |
translation = TCL_TRANSLATE_CRLF;
} else if (strcmp(readMode, "platform") == 0) {
translation = TCL_PLATFORM_TRANSLATION;
} else {
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"bad value for -translation: must be one of "
|
| ︙ | |||
8374 8375 8376 8377 8378 8379 8380 | 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 | - + |
statePtr->outputTranslation = TCL_TRANSLATE_CRLF;
} else if (strcmp(writeMode, "platform") == 0) {
statePtr->outputTranslation = TCL_PLATFORM_TRANSLATION;
} else {
if (interp) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"bad value for -translation: must be one of "
|
| ︙ | |||
8710 8711 8712 8713 8714 8715 8716 | 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 | - - + + - |
}
}
if (!statePtr->timer
&& (mask & TCL_WRITABLE)
&& GotFlag(statePtr, CHANNEL_NONBLOCKING)
&& bufPtr
|
| ︙ | |||
8797 8798 8799 8800 8801 8802 8803 | 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 | - + - - + - + |
}
Tcl_Release(statePtr);
}
}
static void
DeleteTimerHandler(
|
| ︙ | |||
8845 8846 8847 8848 8849 8850 8851 | 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 | - + |
int mask, /* OR'ed combination of TCL_READABLE,
* TCL_WRITABLE, and TCL_EXCEPTION: indicates
* conditions under which proc should be
* called. Use 0 to disable a registered
* handler. */
Tcl_ChannelProc *proc, /* Procedure to call for each selected
* event. */
|
| ︙ | |||
8917 8918 8919 8920 8921 8922 8923 | 8910 8911 8912 8913 8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 | - + |
*/
void
Tcl_DeleteChannelHandler(
Tcl_Channel chan, /* The channel for which to remove the
* callback. */
Tcl_ChannelProc *proc, /* The procedure in the callback to delete. */
|
| ︙ | |||
9123 9124 9125 9126 9127 9128 9129 | 9116 9117 9118 9119 9120 9121 9122 9123 9124 9125 9126 9127 9128 9129 9130 | - + | * Whatever the script does. * *---------------------------------------------------------------------- */ void TclChannelEventScriptInvoker( |
| ︙ | |||
9336 9337 9338 9339 9340 9341 9342 | 9329 9330 9331 9332 9333 9334 9335 9336 9337 9338 9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 | - + - + |
inStatePtr = inPtr->state;
outStatePtr = outPtr->state;
if (BUSY_STATE(inStatePtr, TCL_READABLE)) {
if (interp) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
| ︙ | |||
9414 9415 9416 9417 9418 9419 9420 | 9407 9408 9409 9410 9411 9412 9413 9414 9415 9416 9417 9418 9419 9420 9421 9422 | - - + + |
/*
* Special handling of -size 0 async transfers, so that the -command is
* still called asynchronously.
*/
if ((nonBlocking == CHANNEL_NONBLOCKING) && (toRead == 0)) {
|
| ︙ | |||
9577 9578 9579 9580 9581 9582 9583 | 9570 9571 9572 9573 9574 9575 9576 9577 9578 9579 9580 9581 9582 9583 9584 9585 | + - + |
}
bufPtr = bufPtr->nextPtr;
}
if (bufPtr) {
/* Split the overflowing buffer in two */
int extra = (int) (inBytes - csPtr->toRead);
/*
|
| ︙ | |||
9636 9637 9638 9639 9640 9641 9642 | 9630 9631 9632 9633 9634 9635 9636 9637 9638 9639 9640 9641 9642 9643 9644 9645 9646 9647 | + - - + + + |
CopyState *csPtr) /* State of copy operation. */
{
ChannelState *outStatePtr = csPtr->writePtr->state;
ChannelBuffer *bufPtr = outStatePtr->curOutPtr;
int errorCode;
if (bufPtr && BytesLeft(bufPtr)) {
/*
|
| ︙ | |||
9669 9670 9671 9672 9673 9674 9675 | 9665 9666 9667 9668 9669 9670 9671 9672 9673 9674 9675 9676 9677 9678 9679 | - + |
return TCL_OK;
}
if (code == TCL_ERROR) {
return TCL_ERROR;
}
/* code == TCL_CONTINUE --> continue the loop */
}
|
| ︙ | |||
9752 9753 9754 9755 9756 9757 9758 | 9748 9749 9750 9751 9752 9753 9754 9755 9756 9757 9758 9759 9760 9761 9762 9763 9764 9765 9766 9767 9768 9769 9770 9771 9772 9773 9774 | - + - + - - + + |
underflow = 1;
} else {
/*
* Read up to bufSize characters.
*/
if ((csPtr->toRead == (Tcl_WideInt) -1)
|
| ︙ | |||
10030 10031 10032 10033 10034 10035 10036 | 10026 10027 10028 10029 10030 10031 10032 10033 10034 10035 10036 10037 10038 10039 10040 | - + |
*----------------------------------------------------------------------
*/
static Tcl_Size
DoRead(
Channel *chanPtr, /* The channel from which to read. */
char *dst, /* Where to store input read. */
|
| ︙ | |||
10297 10298 10299 10300 10301 10302 10303 | 10293 10294 10295 10296 10297 10298 10299 10300 10301 10302 10303 10304 10305 10306 10307 10308 10309 10310 10311 10312 | - - - + - - + - - - - + - + - - |
ChannelState *inStatePtr,
ChannelState *outStatePtr,
long long toRead)
{
return inStatePtr->inEofChar == '\0' /* No eofChar to stop input */
&& inStatePtr->inputTranslation == TCL_TRANSLATE_LF
&& outStatePtr->outputTranslation == TCL_TRANSLATE_LF
|
| ︙ | |||
10476 10477 10478 10479 10480 10481 10482 | 10464 10465 10466 10467 10468 10469 10470 10471 10472 10473 10474 10475 10476 10477 10478 | - + |
* 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)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
| ︙ | |||
11101 11102 11103 11104 11105 11106 11107 | 11089 11090 11091 11092 11093 11094 11095 11096 11097 11098 11099 11100 11101 11102 11103 | - + |
iPtr->chanMsg = FixLevelCode(msg);
Tcl_IncrRefCount(iPtr->chanMsg);
} else {
iPtr->chanMsg = NULL;
}
if (disposePtr != NULL) {
|
| ︙ | |||
11139 11140 11141 11142 11143 11144 11145 | 11127 11128 11129 11130 11131 11132 11133 11134 11135 11136 11137 11138 11139 11140 11141 | - + |
statePtr->chanMsg = FixLevelCode(msg);
Tcl_IncrRefCount(statePtr->chanMsg);
} else {
statePtr->chanMsg = NULL;
}
if (disposePtr != NULL) {
|
| ︙ | |||
11405 11406 11407 11408 11409 11410 11411 | 11393 11394 11395 11396 11397 11398 11399 11400 11401 11402 11403 11404 11405 11406 11407 11408 11409 | - + - + | * representation. * *---------------------------------------------------------------------- */ static void DupChannelInternalRep( |
| ︙ |
Changes to generic/tclIO.h.
| ︙ | |||
30 31 32 33 34 35 36 | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | - - + - + | #endif /* * struct ChannelBuffer: * * Buffers data being sent to or from a channel. */ |
| ︙ | |||
67 68 69 70 71 72 73 | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | - | #define CHANNELBUFFER_DEFAULT_SIZE (1024 * 4) /* * The following structure describes the information saved from a call to * "fileevent". This is used later when the event being waited for to invoke * the saved script in the interpreter designed in this record. */ |
| ︙ | |||
89 90 91 92 93 94 95 | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | - - - + + | * struct Channel: * * One of these structures is allocated for each open channel. It contains * data specific to the channel but which belongs to the generic part of the * Tcl channel mechanism, and it points at an instance specific (and type * specific) instance data, and at a channel type structure. */ |
| ︙ | |||
120 121 122 123 124 125 126 | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | - | * struct ChannelState: * * One of these structures is allocated for each open channel. It contains * data specific to the channel but which belongs to the generic part of the * Tcl channel mechanism, and it points at an instance specific (and type * specific) instance data, and at a channel type structure. */ |
| ︙ | |||
156 157 158 159 160 161 162 | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | - + + |
TclEolTranslation outputTranslation;
/* What translation to use for generating end
* of line sequences in output? */
int inEofChar; /* If nonzero, use this as a signal of EOF on
* input. */
#if TCL_MAJOR_VERSION < 9
int outEofChar; /* If nonzero, append this to the channel when
|
| ︙ | |||
187 188 189 190 191 192 193 | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | - - + + |
* handlers for. */
EventScriptRecord *scriptRecordPtr;
/* Chain of all scripts registered for event
* handlers ("fileevent") on this channel. */
Tcl_Size bufSize; /* What size buffers to allocate? */
Tcl_TimerToken timer; /* Handle to wakeup timer for this channel. */
Channel *timerChanPtr; /* Needed in order to decrement the refCount of
|
| ︙ | |||
210 211 212 213 214 215 216 | 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | - - + + - - + + - - - + + - - - + + - - - + + - - + - - - - - - - + + + + + + - - - + + - - - - + + + - - - - - - + + + + + + - - - - + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - + + + + + + |
/*
* TIP #219 ... Info for the I/O system ...
* Error message set by channel drivers, for the propagation of arbitrary
* Tcl errors. This information, if present (chanMsg not NULL), takes
* precedence over a Posix error code returned by a channel operation.
*/
|
| ︙ |
Changes to generic/tclIOCmd.c.
| ︙ | |||
365 366 367 368 369 370 371 | 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 | - - + + |
TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Tcl_Channel chan; /* The channel to read from. */
int newline, i; /* Discard newline at end? */
|
| ︙ | |||
601 602 603 604 605 606 607 | 601 602 603 604 605 606 607 608 609 610 611 612 613 614 | - |
newLoc = Tcl_Tell(chan);
/*
* TIP #219.
* Capture error messages put by the driver into the bypass area and put
* them into the regular interpreter result.
*/
|
| ︙ | |||
1196 1197 1198 1199 1200 1201 1202 | 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 | - + | * subsequently to eval accept scripts. * *---------------------------------------------------------------------- */ static void TcpAcceptCallbacksDeleteProc( |
| ︙ | |||
1324 1325 1326 1327 1328 1329 1330 | 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 | - + | * Whatever the script does. * *---------------------------------------------------------------------- */ static void AcceptCallbackProc( |
| ︙ | |||
1415 1416 1417 1418 1419 1420 1421 | 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 | - + | * longer be informed. * *---------------------------------------------------------------------- */ static void TcpServerCloseProc( |
| ︙ | |||
2034 2035 2036 2037 2038 2039 2040 | 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 | - + - + |
{"event", Tcl_FileEventObjCmd, TclCompileBasic2Or3ArgCmd, NULL, NULL, 0},
{"flush", Tcl_FlushObjCmd, TclCompileBasic1ArgCmd, NULL, NULL, 0},
{"gets", Tcl_GetsObjCmd, TclCompileBasic1Or2ArgCmd, NULL, NULL, 0},
{"names", TclChannelNamesCmd, TclCompileBasic0Or1ArgCmd, NULL, NULL, 0},
{"pending", ChanPendingObjCmd, TclCompileBasic2ArgCmd, NULL, NULL, 0}, /* TIP #287 */
{"pipe", ChanPipeObjCmd, TclCompileBasic0ArgCmd, NULL, NULL, 0}, /* TIP #304 */
{"pop", TclChanPopObjCmd, TclCompileBasic1ArgCmd, NULL, NULL, 0}, /* TIP #230 */
|
| ︙ |
Changes to generic/tclIOGT.c.
| ︙ | |||
59 60 61 62 63 64 65 | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | - - - - - - + + + + + + + - - - + + + + | unsigned char *buf, int bufLen, int transmit, int preserve); /* * Action codes to give to 'ExecuteCallback' (argument 'transmit'), telling * the procedure what to do with the result of the script it calls. */ |
| ︙ | |||
113 114 115 116 117 118 119 | 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | - + - + - - + + + |
* This structure describes the channel type structure for Tcl-based
* transformations.
*/
static const Tcl_ChannelType transformChannelType = {
"transform", /* Type name. */
TCL_CHANNEL_VERSION_5, /* v5 channel */
|
| ︙ | |||
511 512 513 514 515 516 517 | 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 | - + | * 0 if successful, errno when failed. * *---------------------------------------------------------------------- */ static int TransformBlockModeProc( |
| ︙ | |||
734 735 736 737 738 739 740 | 737 738 739 740 741 742 743 744 745 746 747 748 749 750 | - |
* that zero bytes are available because blocked.
*/
*errorCodePtr = Tcl_GetErrno();
gotBytes = -1;
break;
} else if (read == 0) {
|
| ︙ | |||
846 847 848 849 850 851 852 | 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 | - + | * contains the POSIX error code if an error occurred, or zero. * *---------------------------------------------------------------------- */ static long long TransformWideSeekProc( |
| ︙ | |||
1009 1010 1011 1012 1013 1014 1015 | 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 | - + | * None. * *---------------------------------------------------------------------- */ static void TransformWatchProc( |
| ︙ | |||
1087 1088 1089 1090 1091 1092 1093 | 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 | - + - + | * The appropriate Tcl_File or NULL if not present. * *---------------------------------------------------------------------- */ static int TransformGetFileHandleProc( |
| ︙ | |||
1121 1122 1123 1124 1125 1126 1127 | 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 | - + | * None. * *---------------------------------------------------------------------- */ static int TransformNotifyProc( |
| ︙ | |||
1166 1167 1168 1169 1170 1171 1172 | 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 | - + | * None. * *---------------------------------------------------------------------- */ static void TransformChannelHandlerTimer( |
| ︙ |
Changes to generic/tclIORChan.c.
| ︙ | |||
58 59 60 61 62 63 64 | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | - - - - - + + + + + - - - - - - - - - + + + + + + + + + - + - + - + - + - - + - + - - + - - - - - - - + + + - - + - - - + + - |
static void TimerRunWrite(void *clientData);
/*
* The C layer channel type/driver definition used by the reflection.
*/
static const Tcl_ChannelType tclRChannelType = {
|
| ︙ | |||
262 263 264 265 266 267 268 | 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 | - + |
* ForwardParamBase. Where an operation does not need any special types, it
* has no "subtype" and just uses ForwardParamBase, as listed above.)
*/
struct ForwardParamInput {
ForwardParamBase base; /* "Supertype". MUST COME FIRST. */
char *buf; /* O: Where to store the read bytes */
|
| ︙ | |||
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | 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 | + - |
* forwarded to. */
/*
* Note regarding 'dsti' above: Its information is also available via the
* chain evPtr->rcPtr->interp, however, as can be seen, two more
* indirections are needed to retrieve it. And the evPtr may be gone,
* breaking the chain.
*/
Tcl_Condition done; /* Condition variable the forwarder blocks
* on. */
int result; /* TCL_OK or TCL_ERROR */
ForwardingEvent *evPtr; /* Event the result belongs to. */
ForwardingResult *prevPtr, *nextPtr;
/* Links into the list of pending forwarded
* results. */
};
typedef struct {
/*
* Table of all reflected channels owned by this thread. This is the
* per-thread version of the per-interpreter map.
*/
|
| ︙ | |||
399 400 401 402 403 404 405 | 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 427 428 429 430 431 432 433 434 | + - - - - - - - + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + |
static void ForwardOpToHandlerThread(ReflectedChannel *rcPtr,
ForwardedOperation op, const void *param);
static int ForwardProc(Tcl_Event *evPtr, int mask);
static void SrcExitProc(void *clientData);
#define FreeReceivedError(p) \
do { \
|
| ︙ | |||
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 | 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 | + + + + + + + + + + + - + - + - - - - - - - - - - - - |
int
TclChanCreateObjCmd(
TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
{
/*
* Syntax: chan create MODE CMDPREFIX
* [0] [1] [2] [3]
*
* Actually: rCreate MODE CMDPREFIX
* [0] [1] [2]
*/
enum ArgumentIndices {
MODE = (1), /* MODE index */
CMD = (2) /* CMDPREFIX index */
};
ReflectedChannel *rcPtr; /* Instance data of the new channel */
Tcl_Obj *rcId; /* Handle of the new channel */
int mode; /* R/W mode of new channel. Has to match
* abilities of handler commands */
Tcl_Obj *cmdObj; /* Command prefix, list of words */
Tcl_Obj *cmdNameObj; /* Command name */
Tcl_Channel chan; /* Token for the new channel */
Tcl_Obj *modeObj; /* mode in obj form for method call */
|
| ︙ | |||
609 610 611 612 613 614 615 | 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 | - - - + + + |
* 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) {
|
| ︙ | |||
635 636 637 638 639 640 641 | 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 677 678 679 680 | - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + |
methods |= FLAG(methIndex);
listc--;
}
Tcl_DecrRefCount(resObj);
if ((REQUIRED_METHODS & methods) != REQUIRED_METHODS) {
|
| ︙ | |||
738 739 740 741 742 743 744 | 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 | - + - - - |
#endif
/*
* Return handle as result of command.
*/
Tcl_SetObjResult(interp,
|
| ︙ | |||
810 811 812 813 814 815 816 | 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 | - + |
* latter ensures that no pending events of this type are run on an
* invalid channel.
*/
ReflectEvent *e = (ReflectEvent *) ev;
if ((ev->proc != ReflectEventRun) || ((cd != NULL) && (cd != e->rcPtr))) {
|
| ︙ | |||
834 835 836 837 838 839 840 | 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 | - - - - + + + + |
* [0] [1] [2] [3]
*
* Actually: rPostevent CHANNEL EVENTSPEC
* [0] [1] [2]
*
* where EVENTSPEC = {read write ...} (Abbreviations allowed as well).
*/
|
| ︙ | |||
869 870 871 872 873 874 875 | 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 | - + |
chanId = TclGetString(objv[CHAN]);
rcmPtr = GetReflectedChannelMap(interp);
hPtr = Tcl_FindHashEntry(&rcmPtr->map, chanId);
if (hPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
| ︙ | |||
923 924 925 926 927 928 929 | 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 | - + - - + + |
*/
if (EncodeEventMask(interp, "event", objv[EVENT], &events) != TCL_OK) {
return TCL_ERROR;
}
if (events == 0) {
Tcl_SetObjResult(interp,
|
| ︙ | |||
959 960 961 962 963 964 965 | 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 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 | - + - - - + + + - - - - - - - - - - - - + + + + + + + + + + + + - + - - - - - - - + + + + + + + - + - - - |
if (rcPtr->writeTimer == NULL) {
rcPtr->writeTimer = Tcl_CreateTimerHandler(SYNTHETIC_EVENT_TIME,
TimerRunWrite, rcPtr);
}
}
#if TCL_THREADS
} else {
|
| ︙ | |||
1203 1204 1205 1206 1207 1208 1209 | 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 | - - - + + + - + |
#if TCL_THREADS
if (rcPtr->thread != Tcl_GetCurrentThread()) {
ForwardParam p;
ForwardOpToHandlerThread(rcPtr, ForwardedClose, &p);
result = p.base.code;
|
| ︙ | |||
1241 1242 1243 1244 1245 1246 1247 | 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 | - - - + + + - + |
#if TCL_THREADS
if (rcPtr->thread != Tcl_GetCurrentThread()) {
ForwardParam p;
ForwardOpToHandlerThread(rcPtr, ForwardedClose, &p);
result = p.base.code;
|
| ︙ | |||
1380 1381 1382 1383 1384 1385 1386 | 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 | - + - + |
Tcl_IncrRefCount(toReadObj);
if (InvokeTclMethod(rcPtr, METH_READ, toReadObj, NULL, &resObj)!=TCL_OK) {
int code = ErrnoReturn(rcPtr, resObj);
if (code < 0) {
*errorCodePtr = -code;
|
| ︙ | |||
1464 1465 1466 1467 1468 1469 1470 | 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 | - - - + + + |
if (p.base.code < 0) {
/*
* No error message, this is an errno signal.
*/
*errorCodePtr = -p.base.code;
} else {
|
| ︙ | |||
1490 1491 1492 1493 1494 1495 1496 | 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 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 1530 1531 1532 1533 1534 1535 1536 | - + - + - + - + - + - + |
Tcl_IncrRefCount(bufObj);
if (InvokeTclMethod(rcPtr, METH_WRITE, bufObj, NULL, &resObj) != TCL_OK) {
int code = ErrnoReturn(rcPtr, resObj);
if (code < 0) {
*errorCodePtr = -code;
|
| ︙ | |||
1603 1604 1605 1606 1607 1608 1609 | 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 | - - + + - + - + - + |
/* ASSERT: rcPtr->method & FLAG(METH_SEEK) */
Tcl_Preserve(rcPtr);
TclNewIntObj(offObj, offset);
baseObj = Tcl_NewStringObj(
|
| ︙ | |||
1801 1802 1803 1804 1805 1806 1807 | 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 | - - + + - - + + - - + + |
void *clientData,
int action)
{
ReflectedChannel *rcPtr = (ReflectedChannel *)clientData;
switch (action) {
case TCL_CHANNEL_THREAD_INSERT:
|
| ︙ | |||
1831 1832 1833 1834 1835 1836 1837 | 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 | - + | * Arbitrary, as it calls upon a Tcl script. * *---------------------------------------------------------------------- */ static int ReflectSetOption( |
| ︙ | |||
1903 1904 1905 1906 1907 1908 1909 | 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 | - + | * Arbitrary, as it calls upon a Tcl script. * *---------------------------------------------------------------------- */ static int ReflectGetOption( |
| ︙ | |||
1967 1968 1969 1970 1971 1972 1973 | 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 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 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 | - + - + - + - + - + - + - + |
} else {
/*
* Retrieve the value of one option.
*/
method = METH_CGET;
optionObj = Tcl_NewStringObj(optionName, -1);
|
| ︙ | |||
2056 2057 2058 2059 2060 2061 2062 | 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 | - + | * Arbitrary, as it calls upon a Tcl script. * *---------------------------------------------------------------------- */ static int ReflectTruncate( |
| ︙ | |||
2139 2140 2141 2142 2143 2144 2145 | 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 | - + |
EncodeEventMask(
Tcl_Interp *interp,
const char *objName,
Tcl_Obj *obj,
int *mask)
{
int events; /* Mask of events to post */
|
| ︙ | |||
2382 2383 2384 2385 2386 2387 2388 | 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 | - - - - + + + + |
if (resultObjPtr != NULL) {
resObj = Tcl_NewStringObj(msg_dstlost,-1);
*resultObjPtr = resObj;
Tcl_IncrRefCount(resObj);
}
|
| ︙ | |||
2561 2562 2563 2564 2565 2566 2567 | 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 | - + + |
*----------------------------------------------------------------------
*/
static ReflectedChannelMap *
GetReflectedChannelMap(
Tcl_Interp *interp)
{
|
| ︙ | |||
2615 2616 2617 2618 2619 2620 2621 | 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 | - + - - + + |
rcPtr->cmd = NULL;
}
rcPtr->dead = 1;
}
static void
DeleteReflectedChannelMap(
|
| ︙ | |||
2681 2682 2683 2684 2685 2686 2687 | 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 | - - - - - + + + + + | continue; } /* * The receiver for the event exited, before processing the event. We * detach the result now, wake the originator up and signal failure. |
| ︙ | |||
2834 2835 2836 2837 2838 2839 2840 | 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 | - - - - - + + + + + | continue; } /* * The receiver for the event exited, before processing the event. We * detach the result now, wake the originator up and signal failure. |
| ︙ | |||
3047 3048 3049 3050 3051 3052 3053 | 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 | - + |
ForwardingEvent *evPtr = (ForwardingEvent *) evGPtr;
ForwardingResult *resultPtr = evPtr->resultPtr;
ReflectedChannel *rcPtr = evPtr->rcPtr;
Tcl_Interp *interp = rcPtr->interp;
ForwardParam *paramPtr = evPtr->param;
Tcl_Obj *resObj = NULL; /* Interp result of InvokeTclMethod */
ReflectedChannelMap *rcmPtr;/* Map of reflected channels with handlers in
|
| ︙ | |||
3090 3091 3092 3093 3094 3095 3096 | 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 | - + - + | * We remove the channel from both interpreter and thread maps before * releasing the memory, to prevent future accesses (like by * 'postevent') from finding and dereferencing a dangling pointer. */ rcmPtr = GetReflectedChannelMap(interp); hPtr = Tcl_FindHashEntry(&rcmPtr->map, |
| ︙ | |||
3140 3141 3142 3143 3144 3145 3146 | 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 | - - + + - - + + - + |
} else {
if (bytec > 0) {
memcpy(paramPtr->input.buf, bytev, bytec);
}
paramPtr->input.toRead = bytec;
}
}
|
| ︙ | |||
3179 3180 3181 3182 3183 3184 3185 | 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 | - - + + |
} else if (written==0 || paramPtr->output.toWrite<written) {
ForwardSetStaticError(paramPtr, msg_write_toomuch);
paramPtr->output.toWrite = -1;
} else {
paramPtr->output.toWrite = written;
}
}
|
| ︙ | |||
3222 3223 3224 3225 3226 3227 3228 | 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 | - - - + + + - + - + - + - - + + - + - - + + - - - + + + - + - - - + + + - - + + - - + + - + - + |
} else {
Tcl_DecrRefCount(resObj);
resObj = MarshallError(interp);
ForwardSetObjError(paramPtr, resObj);
paramPtr->seek.offset = -1;
}
}
|
| ︙ | |||
3333 3334 3335 3336 3337 3338 3339 | 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 | - + |
if (len) {
TclDStringAppendLiteral(paramPtr->getOpt.value, " ");
Tcl_DStringAppend(paramPtr->getOpt.value, str, len);
}
}
}
|
| ︙ |
Changes to generic/tclIORTrans.c.
| ︙ | |||
54 55 56 57 58 59 60 | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | - + - + - + |
/*
* The C layer channel type/driver definition used by the reflection.
*/
static const Tcl_ChannelType tclRTransformType = {
"tclrtransform", /* Type name. */
TCL_CHANNEL_VERSION_5, /* v5 channel. */
|
| ︙ | |||
464 465 466 467 468 469 470 | 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 | + - - + + + |
static int TransformLimit(ReflectedTransform *rtPtr,
int *errorCodePtr, int *maxPtr);
/*
* Operation codes for TransformFlush().
*/
enum TransformFlushOpCodes {
|
| ︙ | |||
496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 | + + + + + + + + + + + - + - - - - - - - - - - |
int
TclChanPushObjCmd(
TCL_UNUSED(void *),
Tcl_Interp *interp,
int objc,
Tcl_Obj *const *objv)
{
/*
* Syntax: chan push CHANNEL CMDPREFIX
* [0] [1] [2] [3]
*
* Actually: rPush CHANNEL CMDPREFIX
* [0] [1] [2]
*/
enum ArgumentIndices {
CHAN = (1), /* CHANNEL index */
CMD = (2) /* CMDPREFIX index */
};
ReflectedTransform *rtPtr; /* Instance data of the new (transform)
* channel. */
Tcl_Obj *chanObj; /* Handle of parent channel */
Tcl_Channel parentChan; /* Token of parent channel */
int mode; /* R/W mode of parent, later the new channel.
* Has to match the abilities of the handler
* commands */
Tcl_Obj *cmdObj; /* Command prefix, list of words */
Tcl_Obj *cmdNameObj; /* Command name */
Tcl_Obj *rtId; /* Handle of the new transform (channel) */
Tcl_Obj *modeObj; /* mode in obj form for method call */
|
| ︙ | |||
596 597 598 599 600 601 602 | 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 | - - - + + + |
/*
* 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) {
|
| ︙ | |||
621 622 623 624 625 626 627 | 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 677 678 679 680 | - - - + + + - - - + + + - - - + + + - - - + + + |
methods |= FLAG(methIndex);
listc--;
}
Tcl_DecrRefCount(resObj);
if ((REQUIRED_METHODS & methods) != REQUIRED_METHODS) {
|
| ︙ | |||
711 712 713 714 715 716 717 | 714 715 716 717 718 719 720 721 722 723 724 725 726 727 | - - - |
/*
* We are not going through ReflectClose as we never had a channel
* structure.
*/
Tcl_EventuallyFree(rtPtr, FreeReflectedTransform);
return TCL_ERROR;
|
| ︙ | |||
748 749 750 751 752 753 754 | 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 | - - - + + + |
/*
* Syntax: chan pop CHANNEL
* [0] [1] [2]
*
* Actually: rPop CHANNEL
* [0] [1]
*/
|
| ︙ | |||
783 784 785 786 787 788 789 | 783 784 785 786 787 788 789 790 791 792 793 794 795 796 | - - |
/*
* Removing transformations is generic, and not restricted to reflected
* transformations.
*/
Tcl_UnstackChannel(interp, chan);
return TCL_OK;
|
| ︙ | |||
1101 1102 1103 1104 1105 1106 1107 | 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 | - |
goto stop;
}
if (rtPtr->eofPending) {
goto stop;
}
|
| ︙ | |||
1137 1138 1139 1140 1141 1142 1143 | 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 | - - |
} /* else: 'maxRead < 0' == Accept the current value of toRead */
}
if (toRead <= 0) {
goto stop;
}
|
| ︙ | |||
1165 1166 1167 1168 1169 1170 1171 | 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 | - |
*/
*errorCodePtr = Tcl_GetErrno();
goto error;
}
if (readBytes == 0) {
|
| ︙ | |||
1488 1489 1490 1491 1492 1493 1494 | 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 | - + | * Arbitrary, per the parent channel. * *---------------------------------------------------------------------- */ static int ReflectSetOption( |
| ︙ | |||
1530 1531 1532 1533 1534 1535 1536 | 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 | - + | * Arbitrary, per the parent channel. * *---------------------------------------------------------------------- */ static int ReflectGetOption( |
| ︙ | |||
1777 1778 1779 1780 1781 1782 1783 | 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 | - + |
for (i=0; i<listc ; i++) {
Tcl_Obj *word = rtPtr->argv[i] = listv[i];
Tcl_IncrRefCount(word);
}
|
| ︙ | |||
2104 2105 2106 2107 2108 2109 2110 | 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 | - + - - + + | * registered in this interpreter. * *---------------------------------------------------------------------- */ static void DeleteReflectedTransformMap( |
| ︙ | |||
2989 2990 2991 2992 2993 2994 2995 | 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 | - + |
*----------------------------------------------------------------------
*/
static inline size_t
ResultCopy(
ResultBuffer *rPtr, /* The buffer to read from */
unsigned char *buf, /* The buffer to copy into */
|
| ︙ |
Changes to generic/tclIOSock.c.
| ︙ | |||
257 258 259 260 261 262 263 | 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | - + |
if (result != 0) {
*errorMsgPtr =
#ifdef EAI_SYSTEM /* Doesn't exist on Windows */
(result == EAI_SYSTEM) ? Tcl_PosixError(interp) :
#endif /* EAI_SYSTEM */
gai_strerror(result);
|
| ︙ |
Changes to generic/tclIOUtil.c.
| ︙ | |||
31 32 33 34 35 36 37 | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | - + + - - + - |
/*
* struct FilesystemRecord --
*
* An item in a linked list of registered filesystems
*/
typedef struct FilesystemRecord {
|
| ︙ | |||
101 102 103 104 105 106 107 | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | - | * Functions that support the native filesystem functions listed above. They * are the same for win/unix, and not in tclInt.h because they are and should * be used only here. */ MODULE_SCOPE const char *const tclpFileAttrStrings[]; MODULE_SCOPE const TclFileAttrProcs tclpFileAttrProcs[]; |
| ︙ | |||
325 326 327 328 329 330 331 | 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | - - + + |
}
return ret;
}
/* Obsolete */
int
Tcl_Access(
|
| ︙ | |||
841 842 843 844 845 846 847 | 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 | - + | * registered filesystems. * *---------------------------------------------------------------------- */ int Tcl_FSRegister( |
| ︙ | |||
1101 1102 1103 1104 1105 1106 1107 | 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 | - + - |
static void
FsAddMountsToGlobResult(
Tcl_Obj *resultPtr, /* The current list of matching pathnames. Must
* not be shared. */
Tcl_Obj *pathPtr, /* The directory that was searched. */
const char *pattern, /* Pattern to match mounts against. */
Tcl_GlobTypeData *types) /* Acceptable types. May be NULL. The
|
| ︙ | |||
1166 1167 1168 1169 1170 1171 1172 | 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 | - | /* * Deal with the root of the volume. */ len--; } len++; /* account for '/' in the mElt [Bug 1602539] */ |
| ︙ | |||
1262 1263 1264 1265 1266 1267 1268 | 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 | - - + + | * None. * *---------------------------------------------------------------------- */ void * Tcl_FSData( |
| ︙ | |||
1361 1362 1363 1364 1365 1366 1367 | 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 | - |
* Call the the normalizePathProc routine of each registered filesystem.
*/
firstFsRecPtr = FsGetFirstFilesystem();
Claim();
if (!isVfsPath) {
|
| ︙ | |||
1600 1601 1602 1603 1604 1605 1606 | 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 | - |
if (interp != NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
"access mode \"%s\" not supported by this system",
flag));
}
goto invAccessMode;
#endif
|
| ︙ | |||
1689 1690 1691 1692 1693 1694 1695 | 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 | - + |
int
Tcl_FSEvalFileEx(
Tcl_Interp *interp, /* Interpreter that evaluates the script. */
Tcl_Obj *pathPtr, /* Pathname of the file to process.
* Tilde-substitution is performed on this
* pathname. */
const char *encodingName) /* Either the name of an encoding or NULL to
|
| ︙ | |||
1827 1828 1829 1830 1831 1832 1833 | 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 | - + |
int
TclNREvalFile(
Tcl_Interp *interp, /* Interpreter in which to evaluate the script. */
Tcl_Obj *pathPtr, /* Pathname of a file containing the script to
* evaluate. Tilde-substitution is performed on
* this pathname. */
const char *encodingName) /* The name of an encoding to use, or NULL to
|
| ︙ | |||
2082 2083 2084 2085 2086 2087 2088 | 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 | - + - + |
*
*----------------------------------------------------------------------
*/
int
Tcl_FSStat(
Tcl_Obj *pathPtr, /* Pathname of the file to call stat on (in
|
| ︙ | |||
2117 2118 2119 2120 2121 2122 2123 | 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 | - + |
*
*----------------------------------------------------------------------
*/
int
Tcl_FSLstat(
Tcl_Obj *pathPtr, /* Pathname of the file to call stat on (in
|
| ︙ | |||
2191 2192 2193 2194 2195 2196 2197 | 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 | - + - |
Tcl_Channel
Tcl_FSOpenFileChannel(
Tcl_Interp *interp, /* Interpreter for error reporting, or NULL */
Tcl_Obj *pathPtr, /* Pathname of file to open. */
const char *modeString, /* A list of POSIX open modes or a string such
* as "rw". */
int permissions) /* What modes to use if opening the file
|
| ︙ | |||
2913 2914 2915 2916 2917 2918 2919 | 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 | - - - - + + + + - |
}
}
} else {
Tcl_SetErrno(ENOENT);
}
if (retVal == 0) {
|
| ︙ | |||
3016 3017 3018 3019 3020 3021 3022 | 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 | - - + + |
*
*----------------------------------------------------------------------
*/
int
Tcl_FSLoadFile(
Tcl_Interp *interp, /* Used for error reporting. */
|
| ︙ | |||
3111 3112 3113 3114 3115 3116 3117 | 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 | - |
*
* 2. If the environment variable TCL_TEMPLOAD_NO_UNLINK is present and
* set to true (an integer > 0)
*
* 3. TCL_TEMPLOAD_NO_UNLINK is not true (an integer > 0) and AUFS filesystem can be detected (using statfs, if available).
*
*/
|
| ︙ | |||
3651 3652 3653 3654 3655 3656 3657 | 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 | - - + - |
*
*---------------------------------------------------------------------------
*/
Tcl_Obj *
Tcl_FSLink(
Tcl_Obj *pathPtr, /* Pathaname of file. */
|
| ︙ | |||
3902 3903 3904 3905 3906 3907 3908 | 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 | - + + |
Tcl_PathType
TclGetPathType(
Tcl_Obj *pathPtr, /* Pathname to determine type of. */
const Tcl_Filesystem **filesystemPtrPtr,
/* If not NULL, a place in which to store a
* pointer to the filesystem for this pathname
* if it is absolute. */
|
| ︙ | |||
3957 3958 3959 3960 3961 3962 3963 | 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 | - + - |
const char *path, /* Pathname to determine the type of. */
Tcl_Size pathLen, /* Length of the pathname. */
const Tcl_Filesystem **filesystemPtrPtr,
/* If not NULL, a place to store a pointer to
* the filesystem for this pathname when it is
* an absolute pathname. */
Tcl_Size *driveNameLengthPtr,/* If not NULL, a place to store the length of
|
| ︙ | |||
4074 4075 4076 4077 4078 4079 4080 | 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 | - + |
*
*---------------------------------------------------------------------------
*/
int
Tcl_FSRenameFile(
Tcl_Obj *srcPathPtr, /* The pathname of a file or directory to be
|
| ︙ | |||
4451 4452 4453 4454 4455 4456 4457 | 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 | - + |
if (TclFSEnsureEpochOk(pathPtr, &retVal) != TCL_OK) {
/* not a valid pathname */
Disclaim();
return NULL;
} else if (retVal != NULL) {
/*
* Found the filesystem in the internal representation of pathPtr.
|
| ︙ |
Changes to generic/tclIndexObj.c.
| ︙ | |||
51 52 53 54 55 56 57 | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | - + |
* pointer to one of these structures.
*
* Keep this structure declaration in sync with tclTestObj.c
*/
typedef struct {
void *tablePtr; /* Pointer to the table of strings */
|
| ︙ | |||
102 103 104 105 106 107 108 | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | - |
Tcl_Obj *tableObjPtr, /* List of strings to compare against the
* value of objPtr. */
const char *msg, /* Identifying word to use in error
* messages. */
int flags, /* 0 or TCL_EXACT */
Tcl_Size *indexPtr) /* Place to store resulting index. */
{
|
| ︙ | |||
802 803 804 805 806 807 808 | 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 | - + |
*
*----------------------------------------------------------------------
*/
void
Tcl_WrongNumArgs(
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
998 999 1000 1001 1002 1003 1004 | 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 | - + - - + - + - + |
* processed here. Should be NULL if no return
* of arguments is desired. */
{
Tcl_Obj **leftovers; /* Array to write back to remObjv on
* successful exit. Will include the name of
* the command. */
Tcl_Size nrem; /* Size of leftovers.*/
|
| ︙ | |||
1169 1170 1171 1172 1173 1174 1175 | 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 | - |
if (handlerProc(infoPtr->clientData, argObj, infoPtr->dstPtr)) {
srcIndex++;
objc--;
}
break;
}
case TCL_ARGV_GENFUNC: {
|
| ︙ |
Changes to generic/tclInt.h.
| ︙ | |||
253 254 255 256 257 258 259 | 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 | - + |
typedef struct Namespace {
char *name; /* The namespace's simple (unqualified) name.
* This contains no ::'s. The name of the
* global namespace is "" although "::" is an
* synonym. */
char *fullName; /* The namespace's fully qualified name. This
* starts with ::. */
|
| ︙ | |||
275 276 277 278 279 280 281 | 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | - + |
* NULL, there are no children. */
#endif
#if TCL_MAJOR_VERSION > 8
size_t nsId; /* Unique id for the namespace. */
#else
unsigned long nsId;
#endif
|
| ︙ | |||
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 | - + - + |
* commands; however, no namespace qualifiers
* are allowed. NULL if no export patterns are
* registered. */
Tcl_Size numExportPatterns; /* Number of export patterns currently
* registered using "namespace export". */
Tcl_Size maxExportPatterns; /* Number of export patterns for which space
* is currently allocated. */
|
| ︙ | |||
406 407 408 409 410 411 412 | 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 | - - - - - - + + + + + + + - - - - + + + + + - + | * code unit that refers to the namespace has been freed (i.e., * when the namespace's refCount is 0), the namespace's storage * will be freed. * NS_SUPPRESS_COMPILATION - * Marks the commands in this namespace for not being compiled, * forcing them to be looked up every time. */ |
| ︙ | |||
500 501 502 503 504 505 506 | 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 | - + - - + + - + + - + - + |
* results passed directly back to the caller
* (including the error code) unless the code
* is TCL_CONTINUE in which case the
* subcommand will be re-parsed by the ensemble
* core, presumably because the ensemble
* itself has been updated. */
Tcl_Obj *parameterList; /* List of ensemble parameter names. */
|
| ︙ | |||
725 726 727 728 729 730 731 | 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 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 | - - - - - + + + + + - - - - - + + + + + - - + + - + - - - - - - - - + + + + + + + + - - - - - + + + + + + | * * IMPORTANT: skip the values 0x10, 0x20, 0x40, 0x800 corresponding to * TCL_TRACE_(READS/WRITES/UNSETS/ARRAY): makes code simpler in tclTrace.c * * Keep the flag values for VAR_ARGUMENT and VAR_TEMPORARY so that old values * in precompiled scripts keep working. */ |
| ︙ | |||
806 807 808 809 810 811 812 | 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 | - - - - - + + + + + - - - - + + + + |
(varPtr)->flags |= VAR_NAMESPACE_VAR;\
if (TclIsVarInHash(varPtr)) {\
((VarInHash *)(varPtr))->refCount++;\
}\
}
#define TclClearVarNamespaceVar(varPtr) \
|
| ︙ | |||
899 900 901 902 903 904 905 | 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 | - - - + + + - + - + |
/*
* Macros for direct variable access by TEBC.
*/
#define TclIsVarTricky(varPtr,trickyFlags) \
( ((varPtr)->flags & (VAR_ARRAY|VAR_LINK|trickyFlags)) \
|
| ︙ | |||
969 970 971 972 973 974 975 | 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 | - + - + - + |
*/
typedef struct CompiledLocal {
struct CompiledLocal *nextPtr;
/* Next compiler-recognized local variable for
* this procedure, or NULL if this is the last
* local. */
|
| ︙ | |||
1054 1055 1056 1057 1058 1059 1060 | 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 | - + |
Tcl_Size level; /* Only trace commands at nesting level less
* than or equal to this. */
#if TCL_MAJOR_VERSION > 8
Tcl_CmdObjTraceProc2 *proc; /* Procedure to call to trace command. */
#else
Tcl_CmdObjTraceProc *proc; /* Procedure to call to trace command. */
#endif
|
| ︙ | |||
1093 1094 1095 1096 1097 1098 1099 | 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 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 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 | - - - + + + + - - + + + + + + + + + - - + + + + + - - + | * TCL_TRACE_ENTER_EXEC - triggers enter/enterstep traces. * - passed to Tcl_CreateObjTrace to set up * "enterstep" traces. * TCL_TRACE_LEAVE_EXEC - triggers leave/leavestep traces. * - passed to Tcl_CreateObjTrace to set up * "leavestep" traces. */ |
| ︙ | |||
1246 1247 1248 1249 1250 1251 1252 | 1260 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 1335 | - + - + - - + - + - - + + - - - + + + - + - + + |
int isProcCallFrame; /* If 0, the frame was pushed to execute a
* namespace command and var references are
* treated as references to namespace vars;
* varTablePtr and compiledLocals are ignored.
* If FRAME_IS_PROC is set, the frame was
* pushed to execute a Tcl procedure and may
* have local vars. */
|
| ︙ | |||
1380 1381 1382 1383 1384 1385 1386 | 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 1426 1427 | - + - + - + - + |
struct {
const void *codePtr;/* Byte code currently executed... */
const char *pc; /* ... and instruction pointer. */
} tebc;
} data;
Tcl_Obj *cmdObj;
const char *cmd; /* The executed command, if possible... */
|
| ︙ | |||
1428 1429 1430 1431 1432 1433 1434 | 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 | - + - + |
* released by the function TclFreeObj(), in the file "tclObj.c", and also by
* the function TclThreadFinalizeObjects(), in the same file.
*/
#define CLL_END (-1)
typedef struct ContLineLoc {
|
| ︙ | |||
1454 1455 1456 1457 1458 1459 1460 | 1468 1469 1470 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 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 | + - - - - - - - + + + + + + + + + - + - + + - + |
* sourced file.
* TCL_LOCATION_PROC : Frame is for bytecode of a procedure.
*
* A TCL_LOCATION_BC type in a frame can be overridden by _SOURCE and _PROC
* types, per the context of the byte code in execution.
*/
enum TclCodeLocationTypes {
|
| ︙ | |||
1501 1502 1503 1504 1505 1506 1507 | 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 | + - + + |
/*
*----------------------------------------------------------------
* Experimental flag value passed to Tcl_GetRegExpFromObj. Intended for use
* only by Expect. It will probably go away in a later release.
*----------------------------------------------------------------
*/
enum TclGetRegExpFromObjFlags {
|
| ︙ | |||
1587 1588 1589 1590 1591 1592 1593 | 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 1653 1654 1655 1656 1657 1658 1659 | - - - - + + + + - + - + - + - + - - + - + |
* There is one ExecEnv structure per Tcl interpreter. It holds the evaluation
* stack that holds command operands and results. The stack grows towards
* increasing addresses. The member stackPtr points to the stackItems of the
* currently active execution stack.
*/
typedef struct CorContext {
|
| ︙ | |||
1673 1674 1675 1676 1677 1678 1679 | 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 | - + - + - + - + - + + - + |
typedef struct LiteralTable {
LiteralEntry **buckets; /* Pointer to bucket array. Each element
* points to first entry in bucket's hash
* chain, or NULL. */
LiteralEntry *staticBuckets[TCL_SMALL_HASH_TABLE];
/* Bucket array used for small tables to avoid
* mallocs and frees. */
|
| ︙ | |||
1731 1732 1733 1734 1735 1736 1737 | 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 | - + |
*/
typedef struct {
const char *name; /* The name of the subcommand. */
Tcl_ObjCmdProc *proc; /* The implementation of the subcommand. */
CompileProc *compileProc; /* The compiler for the subcommand. */
Tcl_ObjCmdProc *nreProc; /* NRE implementation of this command. */
|
| ︙ | |||
1810 1811 1812 1813 1814 1815 1816 | 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 | - + - + - - - - - - - - + + + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - - - - - + + + + |
* that point to this command when it is
* renamed, deleted, hidden, or exposed. */
CompileProc *compileProc; /* Procedure called to compile command. NULL
* if no compile proc exists for command. */
Tcl_ObjCmdProc *objProc; /* Object-based command procedure. */
void *objClientData; /* Arbitrary value passed to object proc. */
Tcl_CmdProc *proc; /* String-based command procedure. */
|
| ︙ | |||
1960 1961 1962 1963 1964 1965 1966 | 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 | - + - - - - + | /* Pointer to the exported Tcl stub table. In * ancient pre-8.1 versions of Tcl this was a * pointer to the objResultPtr or a pointer to a * buckets array in a hash table. Deployed stubs * enabled extensions check for a NULL pointer value * and for a TCL_STUBS_MAGIC value to verify they * are not [load]ing into one of those pre-stubs |
| ︙ | |||
2050 2051 2052 2053 2054 2055 2056 | 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 | - + |
int unused1; /* No longer used (was termOffset) */
#endif
LiteralTable literalTable; /* Contains LiteralEntry's describing all Tcl
* objects holding literals of scripts
* compiled by the interpreter. Indexed by the
* string representations of literals. Used to
* avoid creating duplicate objects. */
|
| ︙ | |||
2097 2098 2099 2100 2101 2102 2103 | 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 | - + + |
ActiveCommandTrace *activeCmdTracePtr;
/* First in list of active command traces for
* interp, or NULL if no active traces. */
ActiveInterpTrace *activeInterpTracePtr;
/* First in list of active traces for interp,
* or NULL if no active traces. */
|
| ︙ | |||
2126 2127 2128 2129 2130 2131 2132 | 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 | - - + - | int active; /* Flag values defining which limits have been * set. */ int granularityTicker; /* Counter used to determine how often to * check the limits. */ int exceeded; /* Which limits have been exceeded, described * as flag values the same as the 'active' * field. */ |
| ︙ | |||
2163 2164 2165 2166 2167 2168 2169 | 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 | - + - + + |
struct {
Tcl_Obj *const *sourceObjs;
/* What arguments were actually input into the
* *root* ensemble command? (Nested ensembles
* don't rewrite this.) NULL if we're not
* processing an ensemble. */
|
| ︙ | |||
2225 2226 2227 2228 2229 2230 2231 | 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 | - + - |
ContLineLoc *scriptCLLocPtr;/* This table points to the location data for
* invisible continuation lines in the script,
* if any. This pointer is set by the function
* TclEvalObjEx() in file "tclBasic.c", and
* used by function ...() in the same file.
* It does for the eval/direct path of script
* execution what CompileEnv.clLoc does for
|
| ︙ | |||
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 | - - - + + + + - + |
Tcl_Obj *asyncCancelMsg; /* Error message set by async cancel handler
* for the propagation of arbitrary Tcl
* errors. This information, if present
* (asyncCancelMsg not NULL), takes precedence
* over the default error messages returned by
* a script cancellation operation. */
|
| ︙ | |||
2325 2326 2327 2328 2329 2330 2331 | 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 | - - - - + + + + - - - - - + + + + + - - - - - - - - + + + + + + + + - - - - + + + + + + + - - - - - - - + + + + |
/*
* Macros for script cancellation support (TIP #285).
*/
#define TclCanceled(iPtr) \
(((iPtr)->flags & CANCELED) || ((iPtr)->flags & TCL_CANCEL_UNWIND))
|
| ︙ | |||
2421 2422 2423 2424 2425 2426 2427 | 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 | - - - - - - - - - - - + + + + + + + + + + + + | * the evaluation stack for the interp to be fully * unwound. * * WARNING: For the sake of some extensions that have made use of former * internal values, do not re-use the flag values 2 (formerly ERR_IN_PROGRESS) * or 8 (formerly ERROR_CODE_SET). */ |
| ︙ | |||
2533 2534 2535 2536 2537 2538 2539 | 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 | - - - - + + + + + | * an effect if invoking an exposed command, * i.e. if TCL_INVOKE_HIDDEN is not also set. * TCL_INVOKE_NO_TRACEBACK Does not record traceback information if the * invoked command returns an error. Used if the * caller plans on recording its own traceback * information. */ |
| ︙ | |||
2564 2565 2566 2567 2568 2569 2570 | 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 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 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 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 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 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 2791 2792 2793 2794 2795 2796 2797 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 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 | - - - - - - + + + + + + + - - - + + + + - + + - - - + + + + - + - - - + + + + + + - - - - + + + + + + + + + - - - - + + + + + + + + + - - + + + + + + + + + - + + + - + - - - + + + + + - - + + - - - + + + + + - - - + + + + + + + - + - + + + + + + - - - - + + + + + + + - - - - - + + + + + - - - + + + + - - + + + + + + - - - + + + + - - + + - + - + - - + + - + - - + + - + |
* define the content of the list. The ListSpan specifies the range of slots
* within the ListStore that hold elements for this list. The ListSpan is
* optional in which case the list includes all the "in-use" slots of the
* ListStore.
*
*/
typedef struct ListStore {
|
| ︙ | |||
2814 2815 2816 2817 2818 2819 2820 | 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 | - - - - - + + + + + + | * lookup failure should therefore not be an error. If (and only if) this flag * is set, TclTraceDictPath() will return the special value * DICT_PATH_NON_EXISTENT if the path is not traceable. * * DICT_PATH_CREATE (which also requires the DICT_PATH_UPDATE bit to be set) * indicates that we are to create non-existent dictionaries on the path. */ |
| ︙ | |||
2896 2897 2898 2899 2900 2901 2902 | 2955 2956 2957 2958 2959 2960 2961 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 3049 3050 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 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 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 | - + - + - + - - + - - - + + - - - + + - + - - - + + - + + - - - - - + + + + + + + + + - - - - - + + + + + - - + + - - + + + + + + + - - - - - - - - + + + + + + + + + - - + + + + + + + - + + - + + + + + + - + + + + - + + + + + + + - + + + + + + - - - - + + + - - + + | typedef void (TclInitProcessGlobalValueProc)(char **valuePtr, TCL_HASH_TYPE *lengthPtr, Tcl_Encoding *encodingPtr); #ifdef _WIN32 # define TCLFSENCODING tclUtf8Encoding /* On Windows, all Unicode (except surrogates) are valid */ #else |
| ︙ | |||
3155 3156 3157 3158 3159 3160 3161 | 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 | - - + + - - + + - + - + - + - - + - - + - - + - - + - + + | MODULE_SCOPE Tcl_ObjCmdProc TclNRCoroutineObjCmd; MODULE_SCOPE Tcl_ObjCmdProc TclNRYieldObjCmd; MODULE_SCOPE Tcl_ObjCmdProc TclNRYieldmObjCmd; MODULE_SCOPE Tcl_ObjCmdProc TclNRYieldToObjCmd; MODULE_SCOPE Tcl_ObjCmdProc TclNRInvoke; MODULE_SCOPE Tcl_NRPostProc TclNRReleaseValues; |
| ︙ | |||
3452 3453 3454 3455 3456 3457 3458 | 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 | - - + + | int code, int level, Tcl_Obj *returnOpts); MODULE_SCOPE void TclUndoRefCount(Tcl_Obj *objPtr); MODULE_SCOPE int TclpObjLstat(Tcl_Obj *pathPtr, Tcl_StatBuf *buf); MODULE_SCOPE Tcl_Obj * TclpTempFileName(void); MODULE_SCOPE Tcl_Obj * TclpTempFileNameForLibrary(Tcl_Interp *interp, Tcl_Obj* pathPtr); MODULE_SCOPE int TclNewArithSeriesObj(Tcl_Interp *interp, Tcl_Obj **arithSeriesPtr, |
| ︙ | |||
3940 3941 3942 3943 3944 3945 3946 | 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 | - - - + + + + | Tcl_Size count, int flags); MODULE_SCOPE Tcl_Obj * TclStringReplace(Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Size first, Tcl_Size count, Tcl_Obj *insertPtr, int flags); MODULE_SCOPE Tcl_Obj * TclStringReverse(Tcl_Obj *objPtr, int flags); /* Flag values for the [string] ensemble functions. */ |
| ︙ | |||
4011 4012 4013 4014 4015 4016 4017 | 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 | - | MODULE_SCOPE int TclUniCharNcmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct, size_t numChars); MODULE_SCOPE int TclUniCharNcasecmp(const Tcl_UniChar *ucs, const Tcl_UniChar *uct, size_t numChars); MODULE_SCOPE int TclUniCharCaseMatch(const Tcl_UniChar *uniStr, const Tcl_UniChar *uniPattern, int nocase); |
| ︙ | |||
4074 4075 4076 4077 4078 4079 4080 | 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 | - - + + | * Error message utility functions */ MODULE_SCOPE int TclCommandWordLimitError(Tcl_Interp *interp, Tcl_Size count); #endif /* TCL_MAJOR_VERSION > 8 */ /* Constants used in index value encoding routines. */ |
| ︙ | |||
4154 4155 4156 4157 4158 4159 4160 | 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 | - + - + - - - - - - + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + |
# define TclIncrObjsFreed() \
tclObjsFreed++
#else
# define TclIncrObjsAllocated()
# define TclIncrObjsFreed()
#endif /* TCL_COMPILE_STATS */
|
| ︙ | |||
4297 4298 4299 4300 4301 4302 4303 | 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 | - - + + - - + + - + |
(objPtr) = tclFreeObjList; \
tclFreeObjList = (Tcl_Obj *) \
tclFreeObjList->internalRep.twoPtrValue.ptr1; \
Tcl_MutexUnlock(&tclObjMutex); \
} while (0)
# define TclFreeObjStorageEx(interp, objPtr) \
|
| ︙ | |||
4354 4355 4356 4357 4358 4359 4360 | 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 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 | - - - - - + + + + - - + + - - - - - + + + + + - + - + - - + + - - - - - + + + + + | * *---------------------------------------------------------------- */ #define TclInitEmptyStringRep(objPtr) \ ((objPtr)->length = (((objPtr)->bytes = &tclEmptyString), 0)) |
| ︙ | |||
4473 4474 4475 4476 4477 4478 4479 | 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 | - - + + |
*
* MODULE_SCOPE void TclUnpackBignum(Tcl_Obj *objPtr, mp_int bignum);
*----------------------------------------------------------------
*/
#define TclUnpackBignum(objPtr, bignum) \
do { \
|
| ︙ | |||
4527 4528 4529 4530 4531 4532 4533 | 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 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 | - + - + - + - + - - + + - - - - - - - - - + + + + + + + + + |
Tcl_Size allocated = 2 * _needed; \
Tcl_Token *oldPtr = (tokenPtr); \
Tcl_Token *newPtr; \
if (oldPtr == (staticPtr)) { \
oldPtr = NULL; \
} \
newPtr = (Tcl_Token *)Tcl_AttemptRealloc((char *) oldPtr, \
|
| ︙ | |||
4611 4612 4613 4614 4615 4616 4617 | 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 | - | MODULE_SCOPE int TclIsPureByteArray(Tcl_Obj *objPtr); #define TclIsPureDict(objPtr) \ (((objPtr)->bytes==NULL) && TclHasInternalRep((objPtr), &tclDictType)) #define TclHasInternalRep(objPtr, type) \ ((objPtr)->typePtr == (type)) #define TclFetchInternalRep(objPtr, type) \ (TclHasInternalRep((objPtr), (type)) ? &((objPtr)->internalRep) : NULL) |
| ︙ | |||
4657 4658 4659 4660 4661 4662 4663 | 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 | - | MODULE_SCOPE Tcl_LibraryInitProc TclplatformtestInit; MODULE_SCOPE Tcl_LibraryInitProc TclObjTest_Init; MODULE_SCOPE Tcl_LibraryInitProc TclThread_Init; MODULE_SCOPE Tcl_LibraryInitProc Procbodytest_Init; MODULE_SCOPE Tcl_LibraryInitProc Procbodytest_SafeInit; MODULE_SCOPE Tcl_LibraryInitProc Tcl_ABSListTest_Init; |
| ︙ | |||
4683 4684 4685 4686 4687 4688 4689 | 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 | - - - - - + + + + + - - - - - + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - + + + + + + + + + - - - + + + - - - + + + - - - - - - - - + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + | * * MODULE_SCOPE void TclSetIntObj(Tcl_Obj *objPtr, Tcl_WideInt w); * MODULE_SCOPE void TclSetDoubleObj(Tcl_Obj *objPtr, double d); *---------------------------------------------------------------- */ #define TclSetIntObj(objPtr, i) \ |
| ︙ | |||
4836 4837 4838 4839 4840 4841 4842 | 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 | - - - - - + + + + + - - - - - - - - - + + + + + + + + - - + | /* *---------------------------------------------------------------- * Inline version of TclCleanupCommand; still need the function as it is in * the internal stubs, but the core can use the macro instead. */ |
| ︙ | |||
5029 5030 5031 5032 5033 5034 5035 | 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 | - - - + + + | #define NRE_ASSERT(expr) #endif #include "tclIntDecls.h" #include "tclIntPlatDecls.h" #if !defined(USE_TCL_STUBS) && !defined(TCL_MEM_DEBUG) |
| ︙ |
Changes to generic/tclInterp.c.
| ︙ | |||
182 183 184 185 186 187 188 | 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 | - + + + - - - - - - + + + + + + + + - - + - - - - |
* TIP#143 limit handler internal representation.
*/
struct LimitHandler {
int flags; /* The state of this particular handler. */
Tcl_LimitHandlerProc *handlerProc;
/* The handler callback. */
|
| ︙ | |||
599 600 601 602 603 604 605 | 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 | - - - + + + - - - + + + |
*
*----------------------------------------------------------------------
*/
int
Tcl_InterpObjCmd(
void *clientData,
|
| ︙ | |||
1194 1195 1196 1197 1198 1199 1200 | 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 | - + |
int
Tcl_CreateAlias(
Tcl_Interp *childInterp, /* Interpreter for source command. */
const char *childCmd, /* Command to install in child. */
Tcl_Interp *targetInterp, /* Interpreter for target command. */
const char *targetCmd, /* Name of target command. */
|
| ︙ | |||
1249 1250 1251 1252 1253 1254 1255 | 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 | - + |
int
Tcl_CreateAliasObj(
Tcl_Interp *childInterp, /* Interpreter for source command. */
const char *childCmd, /* Command to install in child. */
Tcl_Interp *targetInterp, /* Interpreter for target command. */
const char *targetCmd, /* Name of target command. */
|
| ︙ | |||
1818 1819 1820 1821 1822 1823 1824 | 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 | - + | * forwarded. * *---------------------------------------------------------------------- */ static int AliasNRCmd( |
| ︙ | |||
1871 1872 1873 1874 1875 1876 1877 | 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 | - + |
}
TclSkipTailcall(interp);
return Tcl_NREvalObj(interp, listPtr, flags);
}
int
TclAliasObjCmd(
|
| ︙ | |||
1962 1963 1964 1965 1966 1967 1968 | 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 | - + |
}
return result;
#undef ALIAS_CMDV_PREALLOC
}
int
TclLocalAliasObjCmd(
|
| ︙ | |||
2047 2048 2049 2050 2051 2052 2053 | 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 | - + | * interpreter. * *---------------------------------------------------------------------- */ static void AliasObjCmdDeleteProc( |
| ︙ | |||
2273 2274 2275 2276 2277 2278 2279 | 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 | - + | * None. * *---------------------------------------------------------------------- */ int Tcl_GetInterpPath( |
| ︙ | |||
2548 2549 2550 2551 2552 2553 2554 | 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 | - + - + | * See user documentation for details. * *---------------------------------------------------------------------- */ int TclChildObjCmd( |
| ︙ | |||
2762 2763 2764 2765 2766 2767 2768 | 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 | - + | * the child interpreter. * *---------------------------------------------------------------------- */ static void ChildObjCmdDeleteProc( |
| ︙ | |||
3094 3095 3096 3097 3098 3099 3100 | 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 | - - - - + + + + |
*/
static int
ChildHidden(
Tcl_Interp *interp, /* Interp for data return. */
Tcl_Interp *childInterp) /* Interp whose hidden commands to query. */
{
|
| ︙ | |||
4664 4665 4666 4667 4668 4669 4670 | 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 | - - - - - + + + + + | * Depends on the arguments. * *---------------------------------------------------------------------- */ static int ChildTimeLimitCmd( |
| ︙ |
Changes to generic/tclLink.c.
| ︙ | |||
32 33 34 35 36 37 38 | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | - + |
* needed during trace callbacks, since the
* actual variable may be aliased at that time
* via upvar. */
void *addr; /* Location of C variable. */
Tcl_Size bytes; /* Size of C variable array. This is 0 when
* single variables, and >0 used for array
* variables. */
|
| ︙ | |||
71 72 73 74 75 76 77 | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | + + - - - - - - + + + + + + + - - - + + - - + - - - - - - - - - + + + + + |
* avoid string conversions. */
int flags; /* Miscellaneous one-bit values; see below for
* definitions. */
} Link;
/*
* Definitions for flag bits:
*/
enum LinkFlags {
|
| ︙ | |||
296 297 298 299 300 301 302 | 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | - + |
case TCL_LINK_STRING:
linkPtr->bytes = size * sizeof(char);
size = 1; /* This is a variable length string, no need
* to check last value. */
/*
* If no address is given create one and use as address the
|
| ︙ | |||
676 677 678 679 680 681 682 | 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 | - + | * modification. * *---------------------------------------------------------------------- */ static char * LinkTraceProc( |
| ︙ | |||
864 865 866 867 868 869 870 | 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 | - + |
}
/*
* A helper macro. Writing this as a function is messy because of type
* variance.
*/
|
| ︙ | |||
887 888 889 890 891 892 893 | 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 | - + |
if (linkPtr->flags & LINK_ALLOC_LAST) {
for (i = 0; i < objc; i++) {
int *varPtr = &linkPtr->lastValue.iPtr[i];
if (GetInt(objv[i], varPtr)) {
Tcl_ObjSetVar2(interp, linkPtr->varName, NULL,
ObjValue(linkPtr), TCL_GLOBAL_ONLY);
|
| ︙ | |||
955 956 957 958 959 960 961 | 952 953 954 955 956 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 998 999 1000 1001 1002 1003 1004 1005 1006 1007 | - + - + - + - + |
if (linkPtr->flags & LINK_ALLOC_LAST) {
for (i=0; i < objc; i++) {
int *varPtr = &linkPtr->lastValue.iPtr[i];
if (Tcl_GetBooleanFromObj(NULL, objv[i], varPtr) != TCL_OK) {
Tcl_ObjSetVar2(interp, linkPtr->varName, NULL,
ObjValue(linkPtr), TCL_GLOBAL_ONLY);
|
| ︙ | |||
1023 1024 1025 1026 1027 1028 1029 | 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 | - + - + - + |
case TCL_LINK_SHORT:
if (linkPtr->flags & LINK_ALLOC_LAST) {
for (i=0; i < objc; i++) {
if (GetInt(objv[i], &valueInt)
|| !InRange(SHRT_MIN, valueInt, SHRT_MAX)) {
Tcl_ObjSetVar2(interp, linkPtr->varName, NULL,
ObjValue(linkPtr), TCL_GLOBAL_ONLY);
|
| ︙ | |||
1069 1070 1071 1072 1073 1074 1075 | 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 | - + |
case TCL_LINK_UINT:
if (linkPtr->flags & LINK_ALLOC_LAST) {
for (i=0; i < objc; i++) {
if (GetWide(objv[i], &valueWide)
|| !InRange(0, valueWide, (Tcl_WideInt)UINT_MAX)) {
Tcl_ObjSetVar2(interp, linkPtr->varName, NULL,
ObjValue(linkPtr), TCL_GLOBAL_ONLY);
|
| ︙ | |||
1091 1092 1093 1094 1095 1096 1097 | 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 | - + - + - + |
break;
case TCL_LINK_WIDE_UINT:
if (linkPtr->flags & LINK_ALLOC_LAST) {
for (i=0; i < objc; i++) {
if (GetUWide(objv[i], &valueUWide)) {
Tcl_ObjSetVar2(interp, linkPtr->varName, NULL,
ObjValue(linkPtr), TCL_GLOBAL_ONLY);
|
| ︙ |
Changes to generic/tclListObj.c.
| ︙ | |||
42 43 44 45 46 47 48 | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | - - - - + + + + - - - - + + + + | #define LIST_ASSERT(cond_) assert(cond_) /* * LIST_INDEX_ASSERT is to catch errors with negative indices and counts * being passed AFTER validation. On Tcl9 length types are unsigned hence * the checks against LIST_MAX. On Tcl8 length types are signed hence the * also checks against 0. */ |
| ︙ | |||
74 75 76 77 78 79 80 | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | - + + | * If ENABLE_LIST_INVARIANTS is enabled (-DENABLE_LIST_INVARIANTS from the * command line), the entire list internal representation is checked for * inconsistencies. This has a non-trivial cost so has to be separately * enabled and not part of assertions checking. However, the test suite does * invoke ListRepValidate directly even without ENABLE_LIST_INVARIANTS. */ #ifdef ENABLE_LIST_INVARIANTS |
| ︙ | |||
101 102 103 104 105 106 107 | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | + - - - - - - - - - + + + + + + + + + + - - - - - + + + + + + + - - + - - - - - - + + + + + + + - - + - - - - - - - - - + + + + + + + + |
* - Conversely, if only LISTREP_FAVOR_BACK is present extra space is allocated
* with more to the back.
* - If both flags are present (LISTREP_SPACE_FAVOR_NONE), the extra space
* is equally apportioned.
* - Finally if LISTREP_SPACE_ONLY_BACK is present, ALL extra space is at
* the back.
*/
enum ListRepFlags {
|
| ︙ | |||
166 167 168 169 170 171 172 | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | - + - + + |
if ((repPtr_)->spanPtr) { \
(repPtr_)->spanPtr->refCount++; \
} \
} while (0)
/* Returns number of free unused slots at the back of the ListRep's ListStore */
#define ListRepNumFreeTail(repPtr_) \
|
| ︙ | |||
195 196 197 198 199 200 201 | 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | - - - - - + + + + + - - - + + + - - - - - - - + + + + + + + - - + + | * the string representation of the Tcl_Obj is not to be modified. * * ListObjReplaceRepAndInvalidate - Like ListObjOverwriteRep but additionally * assumes the Tcl_Obj internal rep is valid (and possibly even same as * passed ListRep) and frees it first. Additionally invalidates the string * representation. Generally used when modifying a Tcl_Obj value. */ |
| ︙ | |||
262 263 264 265 266 267 268 | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | - + + | * * Side effects: * The memory may be freed. * *------------------------------------------------------------------------ */ static inline void |
| ︙ | |||
293 294 295 296 297 298 299 | 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | - - - + + + + | * Side effects: * None. * *------------------------------------------------------------------------ */ static inline int ListSpanMerited( |
| ︙ | |||
339 340 341 342 343 344 345 | 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | - + + | * * Side effects: * See comments for ListRepUnsharedFreeUnreferenced. * *------------------------------------------------------------------------ */ static inline void |
| ︙ | |||
364 365 366 367 368 369 370 | 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 | - - - + + + | * Side effects: * As above. * *------------------------------------------------------------------------ */ static inline void ObjArrayIncrRefs( |
| ︙ | |||
396 397 398 399 400 401 402 | 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 | - - - + + + | * Side effects: * As above. * *------------------------------------------------------------------------ */ static inline void ObjArrayDecrRefs( |
| ︙ | |||
428 429 430 431 432 433 434 | 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | - - - + + + | * Side effects: * Reference counts on copied Tcl_Obj's are incremented. * *------------------------------------------------------------------------ */ static inline void ObjArrayCopy( |
| ︙ | |||
459 460 461 462 463 464 465 | 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 | - - + + | * Side effects: * Error message and code are stored in the interpreter if not NULL. * *------------------------------------------------------------------------ */ static int MemoryAllocationError( |
| ︙ | |||
488 489 490 491 492 493 494 | 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | - + + - + - - + | * * Side effects: * Error message and code are stored in the interpreter if not NULL. * *------------------------------------------------------------------------ */ static int |
| ︙ | |||
519 520 521 522 523 524 525 | 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 | - + + + | * Side effects: * The contents of the ListRep's ListStore area are shifted down in the * storage area. The ListRep's ListSpan is updated accordingly. * *------------------------------------------------------------------------ */ static inline void |
| ︙ | |||
551 552 553 554 555 556 557 | 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 | - + |
LIST_ASSERT(storePtr->firstUsed == 0);
LIST_ASSERT(shiftCount == 0);
}
LISTREP_CHECK(repPtr);
}
|
| ︙ | |||
574 575 576 577 578 579 580 | 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 | - + + + | * The contents of the ListRep's ListStore area are shifted up in the * storage area. The ListRep's ListSpan is updated accordingly. * *------------------------------------------------------------------------ */ #if 0 static inline void |
| ︙ | |||
620 621 622 623 624 625 626 | 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 | - + + + + - - - - - - + + + + + + | * * Side effects: * Panics if any invariant is not met. * *------------------------------------------------------------------------ */ static void |
| ︙ | |||
658 659 660 661 662 663 664 | 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 | - - - - + - + + + |
}
INVARIANT(ListRepStart(repPtr) >= storePtr->firstUsed);
INVARIANT(ListRepLength(repPtr) <= storePtr->numUsed);
INVARIANT(ListRepStart(repPtr) <= (storePtr->firstUsed + storePtr->numUsed - ListRepLength(repPtr)));
#undef INVARIANT
|
| ︙ | |||
743 744 745 746 747 748 749 | 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 | - - + + |
}
return NULL;
}
storePtr = NULL;
if (flags & LISTREP_SPACE_FLAGS) {
/* Caller requests extra space front, back or both */
|
| ︙ | |||
767 768 769 770 771 772 773 774 775 776 777 778 779 780 | 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 | + |
storePtr->flags = 0;
storePtr->numAllocated = capacity;
if (capacity == objc) {
storePtr->firstUsed = 0;
} else {
Tcl_Size extra = capacity - objc;
int spaceFlags = flags & LISTREP_SPACE_FLAGS;
if (spaceFlags == LISTREP_SPACE_ONLY_BACK) {
storePtr->firstUsed = 0;
} else if (spaceFlags == LISTREP_SPACE_FAVOR_FRONT) {
/* Leave more space in the front */
storePtr->firstUsed =
extra - (extra / 4); /* NOT same as 3*extra/4 */
} else if (spaceFlags == LISTREP_SPACE_FAVOR_BACK) {
|
| ︙ | |||
869 870 871 872 873 874 875 | 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 | - + - |
static int
ListRepInit(
Tcl_Size objc,
Tcl_Obj *const objv[],
int flags,
ListRep *repPtr)
{
|
| ︙ | |||
1024 1025 1026 1027 1028 1029 1030 | 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 | - - + + |
/* Collect garbage at back */
count = (storePtr->firstUsed + storePtr->numUsed)
- (spanPtr->spanStart + spanPtr->spanLength);
LIST_COUNT_ASSERT(count);
if (count > 0) {
/* T:listrep-6.{1:8} */
|
| ︙ | |||
1243 1244 1245 1246 1247 1248 1249 | 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 | - - - - + + + + | * to a list object. *repPtr is initialized to the internal rep * if result is TCL_OK, or set to NULL on error. *---------------------------------------------------------------------- */ static int TclListObjGetRep( |
| ︙ | |||
1553 1554 1555 1556 1557 1558 1559 | 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 | - + | /* *---------------------------------------------------------------------- * * TclListObjRange -- * * Makes a slice of a list value. |
| ︙ | |||
1612 1613 1614 1615 1616 1617 1618 | 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 | - + - |
*----------------------------------------------------------------------
*/
Tcl_Obj *
TclListObjGetElement(
Tcl_Obj *objPtr, /* List object for which an element array is
* to be returned. */
|
| ︙ | |||
1820 1821 1822 1823 1824 1825 1826 | 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 | - - - + + |
shiftCount += (listRep.storePtr->numAllocated - finalLen) / 2;
LIST_ASSERT(shiftCount <= listRep.storePtr->firstUsed);
if (shiftCount) {
/* T:listrep-3.5 */
ListRepUnsharedShiftDown(&listRep, shiftCount);
}
} /* else T:listrep-3.{4,6} */
|
| ︙ | |||
1997 1998 1999 2000 2001 2002 2003 | 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 | - - - + + + - | * *---------------------------------------------------------------------- */ #undef Tcl_ListObjLength int Tcl_ListObjLength( |
| ︙ | |||
2252 2253 2254 2255 2256 2257 2258 | 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 | - + - + + |
* means all new free space is at the back. Instead, the realloc could
* be an explicit alloc and memmove which would let us redistribute
* free space.
*/
if (numFreeSlots < lenChange && !ListRepIsShared(&listRep)) {
/* T:listrep-1.{1,3,14,18,21},3.{3,10,11,14,27,32,41} */
ListStore *newStorePtr =
|
| ︙ | |||
2765 2766 2767 2768 2769 2770 2771 | 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 | - + - + |
Tcl_Obj *
TclLsetList(
Tcl_Interp *interp, /* Tcl interpreter. */
Tcl_Obj *listObj, /* Pointer to the list being modified. */
Tcl_Obj *indexArgObj, /* Index or index-list arg to 'lset'. */
Tcl_Obj *valueObj) /* Value arg to 'lset' or NULL to 'lpop'. */
{
|
| ︙ | |||
2792 2793 2794 2795 2796 2797 2798 | 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 | - - - |
Tcl_IncrRefCount(retValueObj);
}
} else {
/* indexArgPtr designates a single index. */
/* T:listrep-1.{2.1,12.1,15.1,19.1},2.{2.3,9.3,10.1,13.1,16.1}, 3.{4,5,6}.3 */
retValueObj = TclLsetFlat(interp, listObj, 1, &indexArgObj, valueObj);
}
|
| ︙ | |||
2869 2870 2871 2872 2873 2874 2875 | 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 | - + - |
*----------------------------------------------------------------------
*/
Tcl_Obj *
TclLsetFlat(
Tcl_Interp *interp, /* Tcl interpreter. */
Tcl_Obj *listObj, /* Pointer to the list being modified. */
Tcl_Size indexCount, /* Number of index args. */
|
| ︙ | |||
2917 2918 2919 2920 2921 2922 2923 | 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 | - - + + |
retValueObj = subListObj;
result = TCL_OK;
/* Allocate if static array for pending invalidations is too small */
if (indexCount > (int) (sizeof(pendingInvalidates) /
sizeof(pendingInvalidates[0]))) {
|
| ︙ | |||
2955 2956 2957 2958 2959 2960 2961 | 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 | - - - - - + + + + + - + | /* ...the index we're trying to use isn't an index at all. */ result = TCL_ERROR; indexArray++; /* Why bother with this increment? TBD */ break; } indexArray++; |
| ︙ | |||
3141 3142 3143 3144 3145 3146 3147 | 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 | - + |
Tcl_Obj *listObj, /* List object in which element should be
* stored. */
Tcl_Size index, /* Index of element to store. */
Tcl_Obj *valueObj) /* Tcl object to store in the designated list
* element. */
{
ListRep listRep;
|
| ︙ | |||
3224 3225 3226 3227 3228 3229 3230 | 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 | - + - - + |
FreeListInternalRep(
Tcl_Obj *listObj) /* List object with internal rep to free. */
{
ListRep listRep;
ListObjGetRep(listObj, &listRep);
if (listRep.storePtr->refCount-- <= 1) {
|
| ︙ | |||
3358 3359 3360 3361 3362 3363 3364 | 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 | - | } Tcl_IncrRefCount(*elemPtrs++);/* Since list now holds ref to it. */ } LIST_ASSERT((Tcl_Size)(elemPtrs - listRep.storePtr->slots) == elemCount); listRep.storePtr->numUsed = elemCount; |
| ︙ | |||
3418 3419 3420 3421 3422 3423 3424 | 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 | - + - | Tcl_InitStringRep(*elemPtrs, NULL, TclCopyAndCollapse(elemSize, elemStart, check)); } Tcl_IncrRefCount(*elemPtrs++);/* Since list now holds ref to it. */ } |
| ︙ | |||
3603 3604 3605 3606 3607 3608 3609 | 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 | - + |
storePtr->numUsed = length;
if (leadingSpace != 0) {
listRep.spanPtr = ListSpanNew(leadingSpace, length);
}
ListObjReplaceRepAndInvalidate(listObj, &listRep);
return listObj;
}
|
Changes to generic/tclLiteral.c.
| ︙ | |||
54 55 56 57 58 59 60 | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | - + - | * The literal table is made ready for use. * *---------------------------------------------------------------------- */ void TclInitLiteralTable( |
| ︙ | |||
172 173 174 175 176 177 178 | 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | - + - - - + + + |
*
*----------------------------------------------------------------------
*/
Tcl_Obj *
TclCreateLiteral(
Interp *iPtr,
|
| ︙ | |||
274 275 276 277 278 279 280 | 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | - + |
#ifdef TCL_COMPILE_DEBUG
if (LookupLiteralEntry((Tcl_Interp *) iPtr, objPtr) != NULL) {
Tcl_Panic("%s: literal \"%.*s\" found globally but shouldn't be",
"TclRegisterLiteral", (length>60? 60 : (int)length), bytes);
}
#endif
|
| ︙ | |||
385 386 387 388 389 390 391 | 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | - + - + - + | * buffer holding the result of backslash substitutions. * *---------------------------------------------------------------------- */ int /* Do NOT change this type. Should not be wider than TclEmitPush operand*/ TclRegisterLiteral( |
| ︙ | |||
476 477 478 479 480 481 482 | 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 | - + |
"TclRegisterLiteral", (length>60? 60 : (int)length), bytes,
globalPtr->refCount);
}
TclVerifyLocalLiteralTable(envPtr);
#endif /*TCL_COMPILE_DEBUG*/
if (objIndex > INT_MAX) {
Tcl_Panic(
|
| ︙ | |||
503 504 505 506 507 508 509 | 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 | - + |
*----------------------------------------------------------------------
*/
static LiteralEntry *
LookupLiteralEntry(
Tcl_Interp *interp, /* Interpreter for which objPtr was created to
* hold a literal. */
|
| ︙ | |||
549 550 551 552 553 554 555 | 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 | - + |
*----------------------------------------------------------------------
*/
void
TclHideLiteral(
Tcl_Interp *interp, /* Interpreter for which objPtr was created to
* hold a literal. */
|
| ︙ | |||
613 614 615 616 617 618 619 | 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 | - + - + | * literal object. * *---------------------------------------------------------------------- */ int TclAddLiteralObj( |
| ︙ | |||
666 667 668 669 670 671 672 | 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 | - + | * array of the CompileEnv's literal array if it becomes too large. * *---------------------------------------------------------------------- */ static size_t AddLocalLiteralEntry( |
| ︙ | |||
744 745 746 747 748 749 750 | 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 | - + | * The local literal table is updated to refer to the new entries. * *---------------------------------------------------------------------- */ static void ExpandLocalLiteralArray( |
| ︙ | |||
826 827 828 829 830 831 832 | 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 | - + |
*----------------------------------------------------------------------
*/
void
TclReleaseLiteral(
Tcl_Interp *interp, /* Interpreter for which objPtr was created to
* hold a literal. */
|
| ︙ | |||
906 907 908 909 910 911 912 | 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 | - - + + | * None. * *---------------------------------------------------------------------- */ static size_t HashString( |
| ︙ | |||
970 971 972 973 974 975 976 | 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 | - + - | * Memory gets reallocated and entries get rehashed into new buckets. * *---------------------------------------------------------------------- */ static void RebuildLiteralTable( |
| ︙ |
Changes to generic/tclLoad.c.
| ︙ | |||
8 9 10 11 12 13 14 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | - | * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tclInt.h" |
| ︙ | |||
370 371 372 373 374 375 376 | 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | - | * Fix the capitalization in the prefix so that the first * character is in caps (or title case) but the others are all * lower-case. */ Tcl_DStringSetLength(&pfx, Tcl_UtfToTitle(Tcl_DStringValue(&pfx))); |
| ︙ | |||
769 770 771 772 773 774 775 | 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 | - - - - - - + + + + + + - | * Side effects: * See description. * *---------------------------------------------------------------------- */ static int UnloadLibrary( |
| ︙ | |||
817 818 819 820 821 822 823 | 814 815 816 817 818 819 820 821 822 823 824 825 826 827 | - - |
code = TCL_ERROR;
goto done;
}
}
unloadProc = libraryPtr->unloadProc;
}
|
| ︙ | |||
852 853 854 855 856 857 858 | 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 | - - |
if (safeRefCount <= 0 && trustedRefCount <= 0) {
code = TCL_UNLOAD_DETACH_FROM_PROCESS;
}
}
code = unloadProc(target, code);
}
|
| ︙ | |||
880 881 882 883 884 885 886 | 873 874 875 876 877 878 879 880 881 882 883 884 885 886 | - |
ipPrevPtr->nextPtr = ipPtr->nextPtr;
break;
}
}
}
Tcl_Free(ipPtr);
Tcl_SetAssocData(target, "tclLoad", LoadCleanupProc, ipFirstPtr);
|
| ︙ | |||
1039 1040 1041 1042 1043 1044 1045 | 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 | - - + + - + - | libraryPtr = (LoadedLibrary *)Tcl_Alloc(sizeof(LoadedLibrary)); libraryPtr->fileName = (char *)Tcl_Alloc(1); libraryPtr->fileName[0] = 0; libraryPtr->prefix = (char *)Tcl_Alloc(strlen(prefix) + 1); strcpy(libraryPtr->prefix, prefix); libraryPtr->loadHandle = NULL; libraryPtr->initProc = initProc; |
| ︙ | |||
1103 1104 1105 1106 1107 1108 1109 | 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 | - - + + - |
TclGetLoadedLibraries(
Tcl_Interp *interp, /* Interpreter in which to return information
* or error message. */
const char *targetName, /* Name of target interpreter or NULL. If
* NULL, return info about all interps;
* otherwise, just return info about this
* interpreter. */
|
| ︙ | |||
1190 1191 1192 1193 1194 1195 1196 | 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 | - + | * Storage for all of the InterpLibrary functions for interp get deleted. * *---------------------------------------------------------------------- */ static void LoadCleanupProc( |
| ︙ |
Changes to generic/tclMain.c.
| ︙ | |||
272 273 274 275 276 277 278 | 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | - + | * interpreted. * *---------------------------------------------------------------------- */ TCL_NORETURN void Tcl_MainEx( |
| ︙ | |||
735 736 737 738 739 740 741 | 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 | - + | * Could be almost arbitrary, depending on the command that's typed. * *---------------------------------------------------------------------- */ static void StdinProc( |
| ︙ |
Changes to generic/tclNamesp.c.
| ︙ | |||
130 131 132 133 134 135 136 | 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 | - - - - - - + + + + + + - - + + - + |
FreeNsNameInternalRep, /* freeIntRepProc */
DupNsNameInternalRep, /* dupIntRepProc */
NULL, /* updateStringProc */
SetNsNameFromAny, /* setFromAnyProc */
TCL_OBJTYPE_V0
};
|
| ︙ | |||
217 218 219 220 221 222 223 | 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | - + | * None. * *---------------------------------------------------------------------- */ Tcl_Namespace * Tcl_GetCurrentNamespace( |
| ︙ | |||
241 242 243 244 245 246 247 | 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | - + | * None. * *---------------------------------------------------------------------- */ Tcl_Namespace * Tcl_GetGlobalNamespace( |
| ︙ | |||
649 650 651 652 653 654 655 | 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 | - + |
Tcl_CreateNamespace(
Tcl_Interp *interp, /* Interpreter in which a new namespace is
* being created. Also used for error
* reporting. */
const char *name, /* Name for the new namespace. May be a
* qualified name with names of ancestor
* namespaces separated by "::"s. */
|
| ︙ | |||
743 744 745 746 747 748 749 | 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 | - + - - + + - + |
/*
* Check for a bad namespace name and make sure that the name does not
* already exist in the parent namespace.
*/
if (
#ifndef BREAK_NAMESPACE_COMPAT
|
| ︙ | |||
1075 1076 1077 1078 1079 1080 1081 | 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 | - + - |
Namespace *nsPtr)
{
return (nsPtr->flags & NS_DYING) ? 1 : 0;
}
void
TclDeleteNamespaceChildren(
|
| ︙ | |||
1175 1176 1177 1178 1179 1180 1181 | 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 | - + | * Deletes all commands, variables and namespaces in this namespace. * *---------------------------------------------------------------------- */ void TclTeardownNamespace( |
| ︙ | |||
1313 1314 1315 1316 1317 1318 1319 | 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 | - + | * None. * *---------------------------------------------------------------------- */ static void NamespaceFree( |
| ︙ | |||
2032 2033 2034 2035 2036 2037 2038 | 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 | - + - + | * wrong, the result object is set to an error message. * *---------------------------------------------------------------------- */ static int InvokeImportedNRCmd( |
| ︙ | |||
2080 2081 2082 2083 2084 2085 2086 | 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 | - + | * Removes the imported command from the real command's import list. * *---------------------------------------------------------------------- */ static void DeleteImportedCmd( |
| ︙ | |||
2519 2520 2521 2522 2523 2524 2525 | 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 | - + |
* (current namespace if contextNsPtr is
* NULL), then in global namespace. */
Tcl_Namespace *contextNsPtr,/* Ignored if TCL_GLOBAL_ONLY flag is set or
* if the name starts with "::". Otherwise,
* points to namespace in which to resolve
* name; if NULL, look up name in the current
* namespace. */
|
| ︙ | |||
2633 2634 2635 2636 2637 2638 2639 | 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 | - |
}
resPtr = resPtr->nextPtr;
}
if (result == TCL_OK) {
((Command *)cmd)->flags |= CMD_VIA_RESOLVER;
return cmd;
|
| ︙ | |||
3080 3081 3082 3083 3084 3085 3086 | 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 | - + - - + + - + |
size_t length = strlen(nsPtr->fullName);
if (strncmp(pattern, nsPtr->fullName, length) != 0) {
goto searchDone;
}
if (
#ifndef BREAK_NAMESPACE_COMPAT
|
| ︙ | |||
3366 3367 3368 3369 3370 3371 3372 | 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 | - + | * result. * *---------------------------------------------------------------------- */ static int NamespaceEvalCmd( |
| ︙ | |||
3815 3816 3817 3818 3819 3820 3821 | 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 | - + | * Returns a result in the Tcl interpreter's result object. * *---------------------------------------------------------------------- */ static int NamespaceInscopeCmd( |
| ︙ | |||
4731 4732 4733 4734 4735 4736 4737 | 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 | - + | * the namespace, it's structure will be freed. * *---------------------------------------------------------------------- */ static void FreeNsNameInternalRep( |
| ︙ | |||
4778 4779 4780 4781 4782 4783 4784 | 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 | - + |
*
*----------------------------------------------------------------------
*/
static void
DupNsNameInternalRep(
Tcl_Obj *srcPtr, /* Object with internal rep to copy. */
|
| ︙ | |||
4814 4815 4816 4817 4818 4819 4820 | 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 | - + |
*/
static int
SetNsNameFromAny(
Tcl_Interp *interp, /* Points to the namespace in which to resolve
* name. Also used for error reporting if not
* NULL. */
|
| ︙ | |||
5152 5153 5154 5155 5156 5157 5158 | 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 | - |
const char *command, /* First character in command that generated
* the error. */
Tcl_Size length) /* Number of bytes in command (-1 means use
* all bytes up to first null byte). */
{
TclLogCommandInfo(interp, script, command, length, NULL, NULL);
}
|
Changes to generic/tclNotify.c.
| ︙ | |||
67 68 69 70 71 72 73 | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | - + |
* elapsed time for the next block. */
int inTraversal; /* 1 if Tcl_SetMaxBlockTime is being called
* during an event source traversal. */
EventSource *firstEventSourcePtr;
/* Pointer to first event source in list of
* event sources for this thread. */
Tcl_ThreadId threadId; /* Thread that owns this notifier instance. */
|
| ︙ | |||
301 302 303 304 305 306 307 | 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | - + |
Tcl_CreateEventSource(
Tcl_EventSetupProc *setupProc,
/* Function to invoke to figure out what to
* wait for. */
Tcl_EventCheckProc *checkProc,
/* Function to call after waiting to see what
* happened. */
|
| ︙ | |||
340 341 342 343 344 345 346 | 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | - + |
Tcl_DeleteEventSource(
Tcl_EventSetupProc *setupProc,
/* Function to invoke to figure out what to
* wait for. */
Tcl_EventCheckProc *checkProc,
/* Function to call after waiting to see what
* happened. */
|
| ︙ | |||
387 388 389 390 391 392 393 | 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | - + |
void
Tcl_QueueEvent(
Tcl_Event *evPtr, /* Event to add to queue. The storage space
* must have been allocated the caller with
* malloc (Tcl_Alloc), and it becomes the
* property of the event queue. It will be
* freed after the event has been handled. */
|
| ︙ | |||
419 420 421 422 423 424 425 | 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 | - + |
Tcl_ThreadQueueEvent(
Tcl_ThreadId threadId, /* Identifier for thread to use. */
Tcl_Event *evPtr, /* Event to add to queue. The storage space
* must have been allocated the caller with
* malloc (Tcl_Alloc), and it becomes the
* property of the event queue. It will be
* freed after the event has been handled. */
|
| ︙ | |||
479 480 481 482 483 484 485 | 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 | - + |
ThreadSpecificData *tsdPtr, /* Handle to thread local data that indicates
* which event queue to use. */
Tcl_Event *evPtr, /* Event to add to queue. The storage space
* must have been allocated the caller with
* malloc (Tcl_Alloc), and it becomes the
* property of the event queue. It will be
* freed after the event has been handled. */
|
| ︙ | |||
552 553 554 555 556 557 558 | 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 | - + |
*
*----------------------------------------------------------------------
*/
void
Tcl_DeleteEvents(
Tcl_EventDeleteProc *proc, /* The function to call. */
|
| ︙ | |||
1249 1250 1251 1252 1253 1254 1255 | 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 | - + | * See the platform-specific implementations. * *---------------------------------------------------------------------- */ void Tcl_AlertNotifier( |
| ︙ | |||
1376 1377 1378 1379 1380 1381 1382 | 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 | - + |
int fd, /* Handle of stream to watch. */
int mask, /* OR'ed combination of TCL_READABLE,
* TCL_WRITABLE, and TCL_EXCEPTION: indicates
* conditions under which proc should be
* called. */
Tcl_FileProc *proc, /* Function to call for each selected
* event. */
|
| ︙ |
Changes to generic/tclOO.c.
| ︙ | |||
298 299 300 301 302 303 304 | 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | - - + + |
*/
static int
InitFoundation(
Tcl_Interp *interp)
{
static Tcl_ThreadDataKey tsdKey;
|
| ︙ | |||
349 350 351 352 353 354 355 | 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | - + - + |
/*
* Create the subcommands in the oo::define and oo::objdefine spaces.
*/
Tcl_DStringInit(&buffer);
for (i = 0 ; defineCmds[i].name ; i++) {
TclDStringAppendLiteral(&buffer, "::oo::define::");
|
| ︙ | |||
428 429 430 431 432 433 434 | 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 | - + |
/*
* Evaluate the remaining definitions, which are a compiled-in Tcl script.
*/
return Tcl_EvalEx(interp, tclOOSetupScript, TCL_INDEX_NONE, 0);
}
|
| ︙ | |||
572 573 574 575 576 577 578 | 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 | - - + + |
*
* ----------------------------------------------------------------------
*/
static void
KillFoundation(
TCL_UNUSED(void *),
|
| ︙ | |||
652 653 654 655 656 657 658 | 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 | - + + |
}
Tcl_ResetResult(interp);
}
while (1) {
char objName[10 + TCL_INTEGER_SPACE];
|
| ︙ | |||
787 788 789 790 791 792 793 | 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 | - + - | * of those commands when the object itself is deleted. * * ---------------------------------------------------------------------- */ static void MyDeleted( |
| ︙ | |||
818 819 820 821 822 823 824 | 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 | - + | * object data structures. * * ---------------------------------------------------------------------- */ static void ObjectRenamedTrace( |
| ︙ | |||
1131 1132 1133 1134 1135 1136 1137 | 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 | - + | * (interpreter teardown is complex!) * * ---------------------------------------------------------------------- */ static void ObjectNamespaceDeleted( |
| ︙ | |||
1365 1366 1367 1368 1369 1370 1371 | 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 | - |
*/
int
TclOODecrRefCount(
Object *oPtr)
{
if (oPtr->refCount-- <= 1) {
|
| ︙ | |||
1714 1715 1716 1717 1718 1719 1720 | 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 | - + - + |
Tcl_Interp *interp, /* Interpreter context. */
Tcl_Class cls, /* Class to create an instance of. */
const char *nameStr, /* Name of object to create, or NULL to ask
* the code to pick its own unique name. */
const char *nsNameStr, /* Name of namespace to create inside object,
* or NULL to ask the code to pick its own
* unique name. */
|
| ︙ | |||
1782 1783 1784 1785 1786 1787 1788 | 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 | - + - + |
Tcl_Interp *interp, /* Interpreter context. */
Tcl_Class cls, /* Class to create an instance of. */
const char *nameStr, /* Name of object to create, or NULL to ask
* the code to pick its own unique name. */
const char *nsNameStr, /* Name of namespace to create inside object,
* or NULL to ask the code to pick its own
* unique name. */
|
| ︙ | |||
1917 1918 1919 1920 1921 1922 1923 | 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 | - + |
/*
* 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)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1988 1989 1990 1991 1992 1993 1994 | 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 | - + |
/*
* Sanity check.
*/
if (IsRootClass(oPtr)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
2603 2604 2605 2606 2607 2608 2609 | 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 | - + |
* invoke from, or NULL to traverse the whole
* chain including filters. */
int publicPrivate, /* Whether this is an invoke from a public
* context (PUBLIC_METHOD), a private context
* (PRIVATE_METHOD), or a *really* private
* context (any other value; conventionally
* 0). */
|
| ︙ | |||
2674 2675 2676 2677 2678 2679 2680 | 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 | - + |
* ----------------------------------------------------------------------
*/
int
TclOOObjectCmdCore(
Object *oPtr, /* The object being invoked. */
Tcl_Interp *interp, /* The interpreter containing the object. */
|
| ︙ | |||
2796 2797 2798 2799 2800 2801 2802 | 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 | - + |
}
if (miPtr->mPtr->declaringClassPtr == startCls) {
break;
}
}
if (contextPtr->index >= contextPtr->callPtr->numChain) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ |
Changes to generic/tclOO.h.
| ︙ | |||
120 121 122 123 124 125 126 | 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | - - - - + + + + + - - - - + + + + + | #endif /* * The correct value for the version field of the Tcl_MethodType structure. * This allows new versions of the structure to be introduced without breaking * binary compatibility. */ |
| ︙ | |||
158 159 160 161 162 163 164 | 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | - - + + + | } Tcl_ObjectMetadataType; /* * The correct value for the version field of the Tcl_ObjectMetadataType * structure. This allows new versions of the structure to be introduced * without breaking binary compatibility. */ |
| ︙ |
Changes to generic/tclOOBasic.c.
| ︙ | |||
96 97 98 99 100 101 102 | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | - - + + - + |
}
/*
* Make the class definition delegate. This is special; it doesn't reenter
* here (and the class definition delegate doesn't run any constructors).
*/
|
| ︙ | |||
144 145 146 147 148 149 150 | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | - + |
Object *oPtr = (Object *)data[1];
Tcl_InterpState saved;
int code;
TclDecrRefCount(invoke[0]);
TclDecrRefCount(invoke[1]);
TclDecrRefCount(invoke[2]);
|
| ︙ | |||
210 211 212 213 214 215 216 | 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | - + |
"objectName ?arg ...?");
return TCL_ERROR;
}
objName = Tcl_GetStringFromObj(
objv[Tcl_ObjectContextSkippedArgs(context)], &len);
if (len == 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
275 276 277 278 279 280 281 | 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | - + - + |
"objectName namespaceName ?arg ...?");
return TCL_ERROR;
}
objName = Tcl_GetStringFromObj(
objv[Tcl_ObjectContextSkippedArgs(context)], &len);
if (len == 0) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
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 | - + - + - + - + |
return TCL_ERROR;
}
errorMsg = Tcl_ObjPrintf("unknown method \"%s\": must be ",
TclGetString(objv[skip]));
for (i=0 ; i<numMethodNames-1 ; i++) {
if (i) {
|
| ︙ | |||
706 707 708 709 710 711 712 | 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 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 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 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 | - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - + - - - - - - + - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + |
* This is copied out of Tcl_VariableObjCmd...
*/
if (!TclIsVarNamespaceVar(varPtr)) {
TclSetVarNamespaceVar(varPtr);
}
|
| ︙ | |||
838 839 840 841 842 843 844 | 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 | - + - + |
if (aryVar != NULL) {
Tcl_GetVariableFullName(interp, (Tcl_Var) aryVar, varNamePtr);
/*
* WARNING! This code pokes inside the implementation of hash tables!
*/
|
| ︙ | |||
964 965 966 967 968 969 970 | 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 | - + | /* * Invoke the (advanced) method call context in the caller * context. Note that this is like [uplevel 1] and not [eval]. */ TclNRAddCallback(interp, NextRestoreFrame, framePtr, contextPtr, INT2PTR(contextPtr->index), NULL); |
| ︙ | |||
1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 | 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + |
iPtr->varFramePtr = (CallFrame *)data[0];
if (contextPtr != NULL) {
contextPtr->index = PTR2UINT(data[2]);
}
return result;
}
/*
* ----------------------------------------------------------------------
*
* GetDeclarer, GetMethodName --
*
* Helpers for the [self] command implementation.
*
* ----------------------------------------------------------------------
*/
/* Get (class?) object that declared a method. */
static inline Object *
GetDeclarer(
Method *mPtr) /* Method impl to get declarer of. */
{
if (mPtr->declaringClassPtr != NULL) {
return mPtr->declaringClassPtr->thisPtr;
} else if (mPtr->declaringObjectPtr != NULL) {
return mPtr->declaringObjectPtr;
}
Tcl_Panic("method without declarer!");
return NULL;
}
/* Get the official name of a method. */
static inline Tcl_Obj *
GetMethodName(
CallContext *contextPtr, /* Context in which we're asking. */
Method *mPtr) /* What method implementation to name. */
{
if (contextPtr->callPtr->flags & CONSTRUCTOR) {
return contextPtr->oPtr->fPtr->constructorName;
} else if (contextPtr->callPtr->flags & DESTRUCTOR) {
return contextPtr->oPtr->fPtr->destructorName;
} else {
return mPtr->namePtr;
}
}
/*
* ----------------------------------------------------------------------
*
* TclOOSelfObjCmd --
*
* Implementation of the [self] command, which provides introspection of
|
| ︙ | |||
1088 1089 1090 1091 1092 1093 1094 | 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 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 1246 | - + - + - - - - - - - + + - - + - + - + - + - - - - - - - - - - - - - - - - - - - - + - - + - + - - - - - - - - - - - - - - - - - - - - + - - + - + - - - - + - - - - - - - - - - + |
switch (index) {
case SELF_OBJECT:
Tcl_SetObjResult(interp, TclOOObjectName(interp, contextPtr->oPtr));
return TCL_OK;
case SELF_NS:
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ |
Changes to generic/tclOOCall.c.
| ︙ | |||
21 22 23 24 25 26 27 | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | - + |
/*
* Structure containing a CallContext and any other values needed only during
* the construction of the CallContext.
*/
struct ChainBuilder {
CallChain *callChainPtr; /* The call chain being built. */
|
| ︙ | |||
48 49 50 51 52 53 54 | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | + - - - - - - - - + + + + + + + + + + - + |
int size;
} DefineChain;
/*
* Extra flags used for call chain management.
*/
enum CallChainExtraFlags {
|
| ︙ | |||
151 152 153 154 155 156 157 158 159 160 161 162 163 164 | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | + + + + + + + + |
"TclOO method name",
FreeMethodNameRep,
DupMethodNameRep,
NULL,
NULL,
TCL_OBJTYPE_V0
};
/*
* Name the bits used in the names table values.
*/
enum NamesTableFlags {
IN_LIST = 1,
NO_IMPLEMENTATION = 2
};
/*
* ----------------------------------------------------------------------
*
* TclOODeleteContext --
*
|
| ︙ | |||
305 306 307 308 309 310 311 | 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | - + | * in stack usage as possible. * * ---------------------------------------------------------------------- */ int TclOOInvokeContext( |
| ︙ | |||
371 372 373 374 375 376 377 | 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | - - - + + + + + + |
/*
* Run the method implementation.
*/
if (mPtr->typePtr->version < TCL_OO_METHOD_VERSION_2) {
return (mPtr->typePtr->callProc)(mPtr->clientData, interp,
(Tcl_ObjectContext) contextPtr, objc, objv);
|
| ︙ | |||
456 457 458 459 460 461 462 | 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | - - - - - - |
Class *mixinPtr;
Tcl_Obj *namePtr;
Method *mPtr;
Tcl_InitObjHashTable(&names);
Tcl_InitHashTable(&examinedClasses, TCL_ONE_WORD_KEYS);
|
| ︙ | |||
674 675 676 677 678 679 680 | 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 | - + |
*
* ----------------------------------------------------------------------
*/
static void
AddClassMethodNames(
Class *clsPtr, /* Class to get method names from. */
|
| ︙ | |||
805 806 807 808 809 810 811 | 813 814 815 816 817 818 819 820 821 822 823 824 825 826 | - - - |
int isWanted = PTR2INT(Tcl_GetHashValue(hPtr));
isWanted &= ~NO_IMPLEMENTATION;
Tcl_SetHashValue(hPtr, INT2PTR(isWanted));
}
}
}
|
| ︙ | |||
1040 1041 1042 1043 1044 1045 1046 | 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 | - - + + |
/*
* Need to really add the method. This is made a bit more complex by the
* fact that we are using some "static" space initially, and only start
* realloc-ing if the chain gets long.
*/
if (callPtr->numChain == CALL_CHAIN_STATIC_SIZE) {
|
| ︙ | |||
1340 1341 1342 1343 1344 1345 1346 | 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 | - - + + - + + |
return NULL;
}
} else if (doFilters && !donePrivate) {
if (hPtr == NULL) {
int isNew;
if (oPtr->flags & USE_CLASS_CACHE) {
if (oPtr->selfCls->classChainCache == NULL) {
|
| ︙ | |||
1375 1376 1377 1378 1379 1380 1381 | 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 | + - + |
TclOODeleteChain(oPtr->selfCls->destructorChainPtr);
}
oPtr->selfCls->destructorChainPtr = callPtr;
callPtr->refCount++;
}
returnContext:
contextPtr = (CallContext *)
|
| ︙ | |||
2035 2036 2037 2038 2039 2040 2041 | 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 | - - + + + | * reallocating the space for the chain if necessary. * * ---------------------------------------------------------------------- */ static inline void AddDefinitionNamespaceToChain( |
| ︙ |
Changes to generic/tclOODefineCmds.c.
| ︙ | |||
683 684 685 686 687 688 689 | 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 | - + |
}
if (toPtr) {
newHPtr = Tcl_CreateHashEntry(oPtr->methodsPtr, toPtr,
&isNew);
if (hPtr == newHPtr) {
renameToSelf:
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
759 760 761 762 763 764 765 | 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 | - + |
Tcl_HashSearch search;
Tcl_HashEntry *hPtr;
Tcl_Size soughtLen;
const char *soughtStr, *matchedStr = NULL;
if (objc < 2) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
793 794 795 796 797 798 799 | 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 | - + | * Got one match, and only one match! */ Tcl_Obj **newObjv = (Tcl_Obj **) TclStackAlloc(interp, sizeof(Tcl_Obj*) * (objc - 1)); int result; |
| ︙ | |||
896 897 898 899 900 901 902 | 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 | - + |
int objc,
Tcl_Obj *const objv[])
{
CallFrame *framePtr, **framePtrPtr = &framePtr;
if (namespacePtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
937 938 939 940 941 942 943 | 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 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 | - + - + + + + + + + + + + + + + + + + + + + + + + + + + + |
Tcl_Object object;
if ((iPtr->varFramePtr == NULL)
|| (iPtr->varFramePtr->isProcCallFrame != FRAME_IS_OO_DEFINE
&& iPtr->varFramePtr->isProcCallFrame != PRIVATE_FRAME)) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"this command may only be called from within the context of"
|
| ︙ | |||
988 989 990 991 992 993 994 | 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 | - + |
}
oPtr = (Object *) Tcl_GetObjectFromObj(interp, className);
iPtr->varFramePtr = savedFramePtr;
if (oPtr == NULL) {
return NULL;
}
if (oPtr->classPtr == NULL) {
|
| ︙ | |||
1487 1488 1489 1490 1491 1492 1493 | 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 | - + + - + + - + + |
oPtr = (Object *) TclOOGetDefineCmdContext(interp);
if (oPtr == NULL) {
return TCL_ERROR;
}
if (oPtr->flags & ROOT_OBJECT) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1656 1657 1658 1659 1660 1661 1662 | 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 | - - + - - - - - + + - - - - + - + |
{
static const char *kindList[] = {
"-class",
"-instance",
NULL
};
int kind = 0;
|
| ︙ | |||
1697 1698 1699 1700 1701 1702 1703 | 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 | - + - + - + |
if (!TclGetString(objv[objc - 1])[0]) {
nsNamePtr = NULL;
} else {
nsPtr = GetNamespaceInOuterContext(interp, objv[objc - 1]);
if (nsPtr == NULL) {
return TCL_ERROR;
}
|
| ︙ | |||
1749 1750 1751 1752 1753 1754 1755 | 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 | - + - - |
}
oPtr = (Object *) TclOOGetDefineCmdContext(interp);
if (oPtr == NULL) {
return TCL_ERROR;
}
if (!isInstanceDeleteMethod && !oPtr->classPtr) {
|
| ︙ | |||
1875 1876 1877 1878 1879 1880 1881 | 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 | - + - - |
oPtr = (Object *) TclOOGetDefineCmdContext(interp);
if (oPtr == NULL) {
return TCL_ERROR;
}
clsPtr = oPtr->classPtr;
if (!isInstanceExport && !clsPtr) {
|
| ︙ | |||
1969 1970 1971 1972 1973 1974 1975 | 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 | - + - - |
}
oPtr = (Object *) TclOOGetDefineCmdContext(interp);
if (oPtr == NULL) {
return TCL_ERROR;
}
if (!isInstanceForward && !oPtr->classPtr) {
|
| ︙ | |||
2047 2048 2049 2050 2051 2052 2053 | 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 | - + - - |
}
oPtr = (Object *) TclOOGetDefineCmdContext(interp);
if (oPtr == NULL) {
return TCL_ERROR;
}
if (!isInstanceMethod && !oPtr->classPtr) {
|
| ︙ | |||
2126 2127 2128 2129 2130 2131 2132 | 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 | - + - - |
}
oPtr = (Object *) TclOOGetDefineCmdContext(interp);
if (oPtr == NULL) {
return TCL_ERROR;
}
if (!isInstanceRenameMethod && !oPtr->classPtr) {
|
| ︙ | |||
2188 2189 2190 2191 2192 2193 2194 | 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) {
|
| ︙ | |||
2318 2319 2320 2321 2322 2323 2324 | 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 | - - - + + + |
*/
int
TclOODefineSlots(
Foundation *fPtr)
{
const struct DeclaredSlot *slotInfoPtr;
|
| ︙ | |||
2372 2373 2374 2375 2376 2377 2378 | 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 2438 2439 2440 2441 2442 | - + - + - - - - - - + - + - + - - - - - - + |
ClassFilterGet(
TCL_UNUSED(void *),
Tcl_Interp *interp,
Tcl_ObjectContext context,
int objc,
Tcl_Obj *const *objv)
{
|
| ︙ | |||
2452 2453 2454 2455 2456 2457 2458 | 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 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 | - + - + - - - - - - + - - + - + - - - - - - + + - + - + - + |
ClassMixinGet(
TCL_UNUSED(void *),
Tcl_Interp *interp,
Tcl_ObjectContext context,
int objc,
Tcl_Obj *const *objv)
{
|
| ︙ | |||
2573 2574 2575 2576 2577 2578 2579 | 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 | - + - + - - - - - - + - + + - + - + - - - - - - + + |
ClassSuperGet(
TCL_UNUSED(void *),
Tcl_Interp *interp,
Tcl_ObjectContext context,
int objc,
Tcl_Obj *const *objv)
{
|
| ︙ | |||
2654 2655 2656 2657 2658 2659 2660 | 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 | - - + + - + - + - + - + + |
*
* Note that zero classes is special, as it is equivalent to just the
* class of objects. [Bug 9d61624b3d]
*/
if (superc == 0) {
superclasses = (Class **)Tcl_Realloc(superclasses, sizeof(Class *));
|
| ︙ | |||
2705 2706 2707 2708 2709 2710 2711 | 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 | - - - + + + - + - - - - + + + + - + |
/*
* Install the list of superclasses into the class. Note that this also
* involves splicing the class out of the superclasses' subclass list that
* it used to be a member of and splicing it into the new superclasses'
* subclass list.
*/
|
| ︙ | |||
2741 2742 2743 2744 2745 2746 2747 | 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 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 | - + - + - - - - - - + - + - + - + - - - - - |
ClassVarsGet(
TCL_UNUSED(void *),
Tcl_Interp *interp,
Tcl_ObjectContext context,
int objc,
Tcl_Obj *const *objv)
{
|
| ︙ | |||
2829 2830 2831 2832 2833 2834 2835 | 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 | - - + + - + |
varName, "refer to an array element"));
Tcl_SetErrorCode(interp, "TCL", "OO", "BAD_DECLVAR", (char *)NULL);
return TCL_ERROR;
}
}
if (IsPrivateDefine(interp)) {
|
| ︙ | |||
2991 2992 2993 2994 2995 2996 2997 | 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 | - + + |
"may only mix in classes");
if (mixins[i] == NULL) {
goto freeAndError;
}
(void) Tcl_CreateHashEntry(&uniqueCheck, (void *) mixins[i], &isNew);
if (!isNew) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
3239 3240 3241 3242 3243 3244 3245 | 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 | - + - + - - - - - - + - + - + - - - - - - - + + |
ClassRPropsGet(
TCL_UNUSED(void *),
Tcl_Interp *interp,
Tcl_ObjectContext context,
int objc,
Tcl_Obj *const *objv)
{
|
| ︙ | |||
3436 3437 3438 3439 3440 3441 3442 | 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 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 | - + - + - - - - - - + - + - + - - - - - - - + + |
ClassWPropsGet(
TCL_UNUSED(void *),
Tcl_Interp *interp,
Tcl_ObjectContext context,
int objc,
Tcl_Obj *const *objv)
{
|
| ︙ |
Changes to generic/tclOOInfo.c.
| ︙ | |||
121 122 123 124 125 126 127 | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | - - - - + + + + + + |
/*
* Install into the [info] ensemble.
*/
infoCmd = Tcl_FindCommand(interp, "info", NULL, TCL_GLOBAL_ONLY);
if (infoCmd) {
Tcl_GetEnsembleMappingDict(NULL, infoCmd, &mapDict);
|
| ︙ | |||
265 266 267 268 269 270 271 | 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 | - + + - + |
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "METHOD",
TclGetString(objv[2]), (char *)NULL);
return TCL_ERROR;
}
procPtr = TclOOGetProcFromMethod((Method *)Tcl_GetHashValue(hPtr));
if (procPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
377 378 379 380 381 382 383 | 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 | - + |
TclGetString(objv[2]), (char *)NULL);
return TCL_ERROR;
}
prefixObj = TclOOGetFwdFromMethod((Method *)Tcl_GetHashValue(hPtr));
if (prefixObj == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"prefix argument list not available for this kind of method",
|
| ︙ | |||
611 612 613 614 615 616 617 | 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | - + |
if (recurse) {
const char **names;
int i, numNames = TclOOGetSortedMethodList(oPtr, NULL, NULL, flag,
&names);
for (i=0 ; i<numNames ; i++) {
Tcl_ListObjAppendElement(NULL, resultObj,
|
| ︙ | |||
680 681 682 683 684 685 686 | 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 | - + + |
* Special entry for visibility control: pretend the method doesnt
* exist.
*/
goto unknownMethod;
}
|
| ︙ | |||
787 788 789 790 791 792 793 | 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 | - - + + |
return TCL_ERROR;
}
oPtr = (Object *) Tcl_GetObjectFromObj(interp, objv[1]);
if (oPtr == NULL) {
return TCL_ERROR;
}
|
| ︙ | |||
944 945 946 947 948 949 950 | 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 | - + + - + |
}
if (clsPtr->constructorPtr == NULL) {
return TCL_OK;
}
procPtr = TclOOGetProcFromMethod(clsPtr->constructorPtr);
if (procPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1011 1012 1013 1014 1015 1016 1017 | 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 | - + + - + |
Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "METHOD",
TclGetString(objv[2]), (char *)NULL);
return TCL_ERROR;
}
procPtr = TclOOGetProcFromMethod((Method *)Tcl_GetHashValue(hPtr));
if (procPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1122 1123 1124 1125 1126 1127 1128 | 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 | - + + |
if (clsPtr->destructorPtr == NULL) {
return TCL_OK;
}
procPtr = TclOOGetProcFromMethod(clsPtr->destructorPtr);
if (procPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1210 1211 1212 1213 1214 1215 1216 | 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 | - + |
TclGetString(objv[2]), (char *)NULL);
return TCL_ERROR;
}
prefixObj = TclOOGetFwdFromMethod((Method *)Tcl_GetHashValue(hPtr));
if (prefixObj == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
"prefix argument list not available for this kind of method",
|
| ︙ | |||
1366 1367 1368 1369 1370 1371 1372 | 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 | - + |
TclNewObj(resultObj);
if (recurse) {
const char **names;
Tcl_Size i, numNames = TclOOGetSortedClassMethodList(clsPtr, flag, &names);
for (i=0 ; i<numNames ; i++) {
Tcl_ListObjAppendElement(NULL, resultObj,
|
| ︙ | |||
1432 1433 1434 1435 1436 1437 1438 | 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 | - + + |
/*
* Special entry for visibility control: pretend the method doesnt
* exist.
*/
goto unknownMethod;
}
|
| ︙ | |||
1664 1665 1666 1667 1668 1669 1670 | 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 | - + |
* Get the call context and render its call chain.
*/
contextPtr = TclOOGetCallContext(oPtr, objv[2], PUBLIC_METHOD, NULL, NULL,
NULL);
if (contextPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1709 1710 1711 1712 1713 1714 1715 | 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 | - + |
/*
* Get an render the stereotypical call chain.
*/
callPtr = TclOOGetStereotypeCallChain(clsPtr, objv[2], PUBLIC_METHOD);
if (callPtr == NULL) {
Tcl_SetObjResult(interp, Tcl_NewStringObj(
|
| ︙ | |||
1867 1868 1869 1870 1871 1872 1873 | 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 | - - + + | } /* * ---------------------------------------------------------------------- * * SortPropList -- * Sort a list of names of properties. Simple support function. Assumes |
| ︙ | |||
1891 1892 1893 1894 1895 1896 1897 | 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 | - + |
static void
SortPropList(
Tcl_Obj *list)
{
Tcl_Size ec;
Tcl_Obj **ev;
|
Changes to generic/tclOOInt.h.
| ︙ | |||
43 44 45 46 47 48 49 | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | - + |
typedef struct Method {
const Tcl_MethodType *typePtr;
/* The type of method. If NULL, this is a
* special flag record which is just used for
* the setting of the flags field. */
Tcl_Size refCount;
|
| ︙ | |||
95 96 97 98 99 100 101 | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | + - + + - - + + + |
/* Callback to allow for additional cleanup
* after the method executes. */
GetFrameInfoValueProc *gfivProc;
/* Callback to allow for fine tuning of how
* the method reports itself. */
} ProcedureMethod;
enum ProcedureMethodVersions {
|
| ︙ | |||
205 206 207 208 209 210 211 | 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | - + - + |
* for everything else. It points to the class
* structure. */
Tcl_Size refCount; /* Number of strong references to this object.
* Note that there may be many more weak
* references; this mechanism exists to
* avoid Tcl_Preserve. */
int flags;
|
| ︙ | |||
232 233 234 235 236 237 238 | 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | + - - - + + + - - + + - + - + - + - + - + - + + |
Tcl_Command myclassCommand; /* Reference to this object's class dispatcher
* command. */
PropertyStorage properties; /* Information relating to the lists of
* properties that this object *claims* to
* support. */
} Object;
enum ObjectFlags {
|
| ︙ | |||
439 440 441 442 443 444 445 | 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 | - - - + + + - - - + + + - - + - + + |
* [next] command. */
CallChain *callPtr; /* The actual call chain. */
} CallContext;
/*
* Bits for the 'flags' field of the call chain.
*/
|
| ︙ | |||
514 515 516 517 518 519 520 | 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 | - - - + + + - - - + + + - - - + + + | */ MODULE_SCOPE void TclOOAddToInstances(Object *oPtr, Class *clsPtr); MODULE_SCOPE void TclOOAddToMixinSubs(Class *subPtr, Class *mixinPtr); MODULE_SCOPE void TclOOAddToSubclasses(Class *subPtr, Class *superPtr); MODULE_SCOPE Class * TclOOAllocClass(Tcl_Interp *interp, Object *useThisObj); |
| ︙ |
Changes to generic/tclOOMethod.c.
| ︙ | |||
200 201 202 203 204 205 206 | 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | - + + |
/* The type of method this is, which defines
* how to invoke, delete and clone the
* method. */
void *clientData) /* Some data associated with the particular
* method to be created. */
{
if (typePtr->version > TCL_OO_METHOD_VERSION_1) {
|
| ︙ | |||
222 223 224 225 226 227 228 | 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | - + + |
/* The type of method this is, which defines
* how to invoke, delete and clone the
* method. */
void *clientData) /* Some data associated with the particular
* method to be created. */
{
if (typePtr->version < TCL_OO_METHOD_VERSION_2) {
|
| ︙ | |||
312 313 314 315 316 317 318 | 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 | - + + - + + |
/* The type of method this is, which defines
* how to invoke, delete and clone the
* method. */
void *clientData) /* Some data associated with the particular
* method to be created. */
{
if (typePtr->version > TCL_OO_METHOD_VERSION_1) {
|
| ︙ | |||
532 533 534 535 536 537 538 | 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 | - + |
* NULL. */
Tcl_Obj *argsObj, /* The formal argument list for the method,
* which _must not_ be NULL. */
Tcl_Obj *bodyObj, /* The body of the method, which _must not_ be
* NULL. */
const Tcl_MethodType *typePtr,
/* The type of the method to create. */
|
| ︙ | |||
645 646 647 648 649 650 651 | 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 | - + |
* _must not_ be NULL. */
Tcl_Obj *argsObj, /* The formal argument list for the method,
* which _must not_ be NULL. */
Tcl_Obj *bodyObj, /* The body of the method, which _must not_ be
* NULL. */
const Tcl_MethodType *typePtr,
/* The type of the method to create. */
|
| ︙ | |||
740 741 742 743 744 745 746 | 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 | - + | * How to invoke a procedure-like method. * * ---------------------------------------------------------------------- */ static int InvokeProcedureMethod( |
| ︙ | |||
1540 1541 1542 1543 1544 1545 1546 | 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 | - + | * command rearranging and then invokes some other Tcl command. * * ---------------------------------------------------------------------- */ static int InvokeForwardMethod( |
| ︙ |
Changes to generic/tclObj.c.
| ︙ | |||
74 75 76 77 78 79 80 | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | - - - - - - - - - - + + + + + + + + + + - - + + - + |
*
* Notice that different structures with the same name appear in other files.
* The structure defined below is used in this file only.
*/
typedef struct {
Tcl_HashTable *lineCLPtr; /* This table remembers for each Tcl_Obj
|
| ︙ | |||
141 142 143 144 145 146 147 | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | - + - - + + - - + + | * These are separated out so that some semantic content is attached * to them. */ #define ObjDeletionLock(contextPtr) ((contextPtr)->deletionCount++) #define ObjDeletionUnlock(contextPtr) ((contextPtr)->deletionCount--) #define ObjDeletePending(contextPtr) ((contextPtr)->deletionCount > 0) #define ObjOnStack(contextPtr) ((contextPtr)->deletionStack != NULL) |
| ︙ | |||
173 174 175 176 177 178 179 | 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | - - - - - + + + + + - + - + | #endif /* * Macros to pack/unpack a bignum's fields in a Tcl_Obj internal rep */ #define PACK_BIGNUM(bignum, objPtr) \ |
| ︙ | |||
574 575 576 577 578 579 580 | 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 | - + |
*/
Tcl_Free(Tcl_GetHashValue(hPtr));
}
clLocPtr->num = num;
memcpy(&clLocPtr->loc, loc, num*sizeof(Tcl_Size));
|
| ︙ | |||
634 635 636 637 638 639 640 | 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 | - + |
/*
* First compute the range of the word within the script. (Is there a
* better way which doesn't shimmer?)
*/
(void)TclGetStringFromObj(objPtr, &length);
|
| ︙ | |||
700 701 702 703 704 705 706 | 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 | - + |
void
TclContinuationsCopy(
Tcl_Obj *objPtr,
Tcl_Obj *originObjPtr)
{
ThreadSpecificData *tsdPtr = TclGetContLineTable();
Tcl_HashEntry *hPtr =
|
| ︙ | |||
734 735 736 737 738 739 740 | 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 | - + - + |
ContLineLoc *
TclContinuationsGet(
Tcl_Obj *objPtr)
{
ThreadSpecificData *tsdPtr = TclGetContLineTable();
Tcl_HashEntry *hPtr =
|
| ︙ | |||
1031 1032 1033 1034 1035 1036 1037 | 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 | - + - + |
*----------------------------------------------------------------------
*/
#ifdef TCL_MEM_DEBUG
void
TclDbInitNewObj(
Tcl_Obj *objPtr,
|
| ︙ | |||
1159 1160 1161 1162 1163 1164 1165 | 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 | - + - + | *---------------------------------------------------------------------- */ #ifdef TCL_MEM_DEBUG Tcl_Obj * Tcl_DbNewObj( |
| ︙ | |||
1266 1267 1268 1269 1270 1271 1272 | 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 | - + | * *---------------------------------------------------------------------- */ #ifdef TCL_MEM_DEBUG void TclFreeObj( |
| ︙ | |||
1376 1377 1378 1379 1380 1381 1382 | 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 | - + - + - + |
* already killed the thread-global data structures. Performing
* TCL_TSD_INIT will leave us with an uninitialized memory block upon
* which we crash (if we where to access the uninitialized hashtable).
*/
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
|
| ︙ | |||
1467 1468 1469 1470 1471 1472 1473 | 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 | - + - + |
* already killed the thread-global data structures. Performing
* TCL_TSD_INIT will leave us with an uninitialized memory block upon
* which we crash (if we where to access the uninitialized hashtable).
*/
{
ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey);
|
| ︙ | |||
1601 1602 1603 1604 1605 1606 1607 | 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 | - + | * *---------------------------------------------------------------------- */ #undef Tcl_GetString char * Tcl_GetString( |
| ︙ | |||
1659 1660 1661 1662 1663 1664 1665 | 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 | - + - + | *---------------------------------------------------------------------- */ #if !defined(TCL_NO_DEPRECATED) #undef TclGetStringFromObj char * TclGetStringFromObj( |
| ︙ | |||
1704 1705 1706 1707 1708 1709 1710 | 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 | - + |
return objPtr->bytes;
}
#endif /* !defined(TCL_NO_DEPRECATED) */
#undef Tcl_GetStringFromObj
char *
Tcl_GetStringFromObj(
|
| ︙ | |||
1787 1788 1789 1790 1791 1792 1793 | 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 | - + | * As described above. * *---------------------------------------------------------------------- */ char * Tcl_InitStringRep( |
| ︙ | |||
1858 1859 1860 1861 1862 1863 1864 | 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 1891 1892 | - + - + | * the string representation NULL to mark it invalid. * *---------------------------------------------------------------------- */ void Tcl_InvalidateStringRep( |
| ︙ | |||
1970 1971 1972 1973 1974 1975 1976 | 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 | - + | * Sets typePtr field to NULL. * *---------------------------------------------------------------------- */ void Tcl_FreeInternalRep( |
| ︙ | |||
1997 1998 1999 2000 2001 2002 2003 | 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 | - - + + - + - + + | * *---------------------------------------------------------------------- */ #undef Tcl_GetBoolFromObj int Tcl_GetBoolFromObj( |
| ︙ | |||
2067 2068 2069 2070 2071 2072 2073 | 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 | - - - + + + - + + |
? "boolean value or \"\"" : "boolean value", NULL,-1,NULL,0)));
return TCL_ERROR;
}
#undef Tcl_GetBooleanFromObj
int
Tcl_GetBooleanFromObj(
|
| ︙ | |||
2097 2098 2099 2100 2101 2102 2103 | 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 | - + |
*
*----------------------------------------------------------------------
*/
int
TclSetBooleanFromAny(
Tcl_Interp *interp, /* Used for error reporting if not NULL. */
|
| ︙ | |||
2143 2144 2145 2146 2147 2148 2149 | 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 | - + |
Tcl_SetErrorCode(interp, "TCL", "VALUE", "BOOLEAN", (void *)NULL);
}
return TCL_ERROR;
}
static int
ParseBoolean(
|
| ︙ | |||
2285 2286 2287 2288 2289 2290 2291 | 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 | - + - + | */ #ifdef TCL_MEM_DEBUG #undef Tcl_NewDoubleObj Tcl_Obj * Tcl_NewDoubleObj( |
| ︙ | |||
2333 2334 2335 2336 2337 2338 2339 | 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 | - + - + | *---------------------------------------------------------------------- */ #ifdef TCL_MEM_DEBUG Tcl_Obj * Tcl_DbNewDoubleObj( |
| ︙ | |||
2382 2383 2384 2385 2386 2387 2388 | 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 | - - + + | * rep is freed. * *---------------------------------------------------------------------- */ void Tcl_SetDoubleObj( |
| ︙ | |||
2414 2415 2416 2417 2418 2419 2420 | 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 | - - - + + + - - + + | * old internal representation. * *---------------------------------------------------------------------- */ int Tcl_GetDoubleFromObj( |
| ︙ | |||
2470 2471 2472 2473 2474 2475 2476 | 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 | - + |
*
*----------------------------------------------------------------------
*/
static int
SetDoubleFromAny(
Tcl_Interp *interp, /* Used for error reporting if not NULL. */
|
| ︙ | |||
2498 2499 2500 2501 2502 2503 2504 | 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 | - + | * double-to-string conversion. * *---------------------------------------------------------------------- */ static void UpdateStringOfDouble( |
| ︙ | |||
2539 2540 2541 2542 2543 2544 2545 | 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 | - - - + + + | * representation. * *---------------------------------------------------------------------- */ int Tcl_GetIntFromObj( |
| ︙ | |||
2612 2613 2614 2615 2616 2617 2618 | 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 | - + | * int-to-string conversion. * *---------------------------------------------------------------------- */ static void UpdateStringOfInt( |
| ︙ | |||
2644 2645 2646 2647 2648 2649 2650 | 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 | - - - + + + | * any old internal representation. * *---------------------------------------------------------------------- */ int Tcl_GetLongFromObj( |
| ︙ | |||
2676 2677 2678 2679 2680 2681 2682 | 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 | - - - + + + |
return TCL_OK;
}
goto tooLarge;
}
#endif
if (TclHasInternalRep(objPtr, &tclDoubleType)) {
if (interp != NULL) {
|
| ︙ | |||
2762 2763 2764 2765 2766 2767 2768 | 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 | - - + - - + | */ #ifdef TCL_MEM_DEBUG #undef Tcl_NewWideIntObj Tcl_Obj * Tcl_NewWideIntObj( |
| ︙ | |||
2821 2822 2823 2824 2825 2826 2827 | 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 2849 2850 2851 2852 2853 | - - + - - + | *---------------------------------------------------------------------- */ #ifdef TCL_MEM_DEBUG Tcl_Obj * Tcl_DbNewWideIntObj( |
| ︙ | |||
2870 2871 2872 2873 2874 2875 2876 | 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 | - - + + - | * rep is freed. * *---------------------------------------------------------------------- */ void Tcl_SetWideIntObj( |
| ︙ | |||
2905 2906 2907 2908 2909 2910 2911 | 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 | - - - + + + - - - - + + + | * any old internal representation. * *---------------------------------------------------------------------- */ int Tcl_GetWideIntFromObj( |
| ︙ | |||
2990 2991 2992 2993 2994 2995 2996 | 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 | - - - + + + - | * any old internal representation. * *---------------------------------------------------------------------- */ int Tcl_GetWideUIntFromObj( |
| ︙ | |||
3075 3076 3077 3078 3079 3080 3081 | 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 | - - + + - - - + + + | * conversion will free any old internal representation. * *---------------------------------------------------------------------- */ int TclGetWideBitsFromObj( |
| ︙ | |||
3139 3140 3141 3142 3143 3144 3145 | 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 | - - - + + + | * Side effects: * The function may free up any existing internal representation. * *---------------------------------------------------------------------- */ int Tcl_GetSizeIntFromObj( |
| ︙ | |||
3410 3411 3412 3413 3414 3415 3416 | 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 | - - - + + + |
objPtr->internalRep.wideValue) != MP_OKAY) {
return TCL_ERROR;
}
return TCL_OK;
}
if (TclHasInternalRep(objPtr, &tclDoubleType)) {
if (interp != NULL) {
|
| ︙ | |||
3451 3452 3453 3454 3455 3456 3457 | 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 | - + |
*----------------------------------------------------------------------
*/
int
Tcl_GetBignumFromObj(
Tcl_Interp *interp, /* Tcl interpreter for error reporting */
Tcl_Obj *objPtr, /* Object to read */
|
| ︙ | |||
3486 3487 3488 3489 3490 3491 3492 | 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 | - + |
*----------------------------------------------------------------------
*/
int
Tcl_TakeBignumFromObj(
Tcl_Interp *interp, /* Tcl interpreter for error reporting */
Tcl_Obj *objPtr, /* Object to read */
|
| ︙ | |||
3511 3512 3513 3514 3515 3516 3517 | 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 | - + |
*
*----------------------------------------------------------------------
*/
void
Tcl_SetBignumObj(
Tcl_Obj *objPtr, /* Object to set */
|
| ︙ | |||
3692 3693 3694 3695 3696 3697 3698 | 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 3718 3719 3720 3721 3722 | - + - + | * *---------------------------------------------------------------------- */ #undef Tcl_IncrRefCount void Tcl_IncrRefCount( |
| ︙ | |||
3735 3736 3737 3738 3739 3740 3741 | 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 | - + | * possibly with a refCount of 0. The caller must have previously * incremented the refCount. * *---------------------------------------------------------------------- */ void TclUndoRefCount( |
| ︙ | |||
3758 3759 3760 3761 3762 3763 3764 | 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 | - + | * *---------------------------------------------------------------------- */ #undef Tcl_IsShared int Tcl_IsShared( |
| ︙ | |||
3787 3788 3789 3790 3791 3792 3793 | 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 | - + | * *---------------------------------------------------------------------- */ #ifdef TCL_MEM_DEBUG void Tcl_DbIncrRefCount( |
| ︙ | |||
3818 3819 3820 3821 3822 3823 3824 | 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 | - + - + |
if (!tablePtr) {
Tcl_Panic("object table not initialized");
}
hPtr = Tcl_FindHashEntry(tablePtr, objPtr);
if (!hPtr) {
Tcl_Panic("Trying to %s of Tcl_Obj allocated in another thread",
|
| ︙ | |||
3860 3861 3862 3863 3864 3865 3866 | 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 | - + | * *---------------------------------------------------------------------- */ #ifdef TCL_MEM_DEBUG void Tcl_DbDecrRefCount( |
| ︙ | |||
3891 3892 3893 3894 3895 3896 3897 | 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 | - + - + |
if (!tablePtr) {
Tcl_Panic("object table not initialized");
}
hPtr = Tcl_FindHashEntry(tablePtr, objPtr);
if (!hPtr) {
Tcl_Panic("Trying to %s of Tcl_Obj allocated in another thread",
|
| ︙ | |||
3937 3938 3939 3940 3941 3942 3943 | 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 | - + | * None. * *---------------------------------------------------------------------- */ int Tcl_DbIsShared( |
| ︙ | |||
3973 3974 3975 3976 3977 3978 3979 | 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 | - + |
if (!tablePtr) {
Tcl_Panic("object table not initialized");
}
hPtr = Tcl_FindHashEntry(tablePtr, objPtr);
if (!hPtr) {
Tcl_Panic("Trying to %s of Tcl_Obj allocated in another thread",
|
| ︙ | |||
4014 4015 4016 4017 4018 4019 4020 | 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 | - - + | * Tcl_CreateHashEntry. * *---------------------------------------------------------------------- */ void Tcl_InitObjHashTable( |
| ︙ | |||
4084 4085 4086 4087 4088 4089 4090 | 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 | - - - + + + |
const char *p1, *p2;
size_t l1, l2;
/*
* If the object pointers are the same then they match.
* OPT: this comparison was moved to the caller
|
| ︙ | |||
4237 4238 4239 4240 4241 4242 4243 | 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 | - + |
*----------------------------------------------------------------------
*/
Tcl_Command
Tcl_GetCommandFromObj(
Tcl_Interp *interp, /* The interpreter in which to resolve the
* command and to report errors. */
|
| ︙ | |||
4266 4267 4268 4269 4270 4271 4272 | 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 | - + - - - - - + + + + + - + - - - - - + + + + + - + |
*
* If any check fails, then force another conversion to the command type,
* to discard the old rep and create a new one.
*/
resPtr = (ResolvedCmdName *)objPtr->internalRep.twoPtrValue.ptr1;
if (TclHasInternalRep(objPtr, &tclCmdNameType)) {
|
| ︙ | |||
4373 4374 4375 4376 4377 4378 4379 | 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 | - + |
}
}
void
TclSetCmdNameObj(
Tcl_Interp *interp, /* Points to interpreter containing command
* that should be cached in objPtr. */
|
| ︙ | |||
4413 4414 4415 4416 4417 4418 4419 | 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 | - + | * ResolvedSymbol, which may free the Command structure. * *---------------------------------------------------------------------- */ static void FreeCmdNameInternalRep( |
| ︙ | |||
4461 4462 4463 4464 4465 4466 4467 | 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 | - + |
*
*----------------------------------------------------------------------
*/
static void
DupCmdNameInternalRep(
Tcl_Obj *srcPtr, /* Object with internal rep to copy. */
|
| ︙ | |||
4495 4496 4497 4498 4499 4500 4501 | 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 | - + |
*
*----------------------------------------------------------------------
*/
static int
SetCmdNameFromAny(
Tcl_Interp *interp, /* Used for error reporting if not NULL. */
|
| ︙ | |||
4599 4600 4601 4602 4603 4604 4605 | 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 | - + - + |
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/tclPanic.c.
| ︙ | |||
76 77 78 79 80 81 82 | 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | - |
const char *format,
...)
{
va_list argList;
char *arg1, *arg2, *arg3; /* Additional arguments (variable in number)
* to pass to fprintf. */
char *arg4, *arg5, *arg6, *arg7, *arg8;
|
| ︙ |
Changes to generic/tclParse.c.
| ︙ | |||
36 37 38 39 40 41 42 | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | - |
* TYPE_OPEN_PAREN - Character is a left parenthesis.
* TYPE_CLOSE_PAREN - Character is a right parenthesis.
* TYPE_CLOSE_BRACK - Character is a right square bracket.
* TYPE_BRACE - Character is a curly brace (either left or right).
*/
const unsigned char tclCharTypeTable[] = {
|
| ︙ | |||
201 202 203 204 205 206 207 | 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | - - + |
Tcl_Size numBytes, /* Total number of bytes in string. If -1,
* the script consists of all bytes up to the
* first null character. */
int nested, /* Non-zero means this is a nested command:
* close bracket should be considered a
* command terminator. If zero, then close
* bracket has no special meaning. */
|
| ︙ | |||
1035 1036 1037 1038 1039 1040 1041 | 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 | - + | * None. * *---------------------------------------------------------------------- */ static int ParseTokens( |
| ︙ | |||
1392 1393 1394 1395 1396 1397 1398 | 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 | - + |
ch = *src;
while (numBytes && (braceCount>0 || ch != '}')) {
switch (ch) {
case '{': braceCount++; break;
case '}': braceCount--; break;
case '\\':
/* if 2 or more left, consume 2, else consume
|
| ︙ | |||
1527 1528 1529 1530 1531 1532 1533 | 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 | - + |
*
*----------------------------------------------------------------------
*/
const char *
Tcl_ParseVar(
Tcl_Interp *interp, /* Context for looking up variable. */
|
| ︙ | |||
1615 1616 1617 1618 1619 1620 1621 | 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 | - - + |
Tcl_Interp *interp, /* Interpreter to use for error reporting; if
* NULL, then no error message is provided. */
const char *start, /* Start of string enclosed in braces. The
* first character must be {'. */
Tcl_Size numBytes, /* Total number of bytes in string. If -1,
* the string consists of all bytes up to the
* first null character. */
|
| ︙ | |||
1816 1817 1818 1819 1820 1821 1822 | 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 | - - + |
Tcl_Interp *interp, /* Interpreter to use for error reporting; if
* NULL, then no error message is provided. */
const char *start, /* Start of the quoted string. The first
* character must be '"'. */
Tcl_Size numBytes, /* Total number of bytes in string. If -1,
* the string consists of all bytes up to the
* first null character. */
|
| ︙ |
Changes to generic/tclParse.h.
1 2 3 4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | - - - - - - - - - - - + + + + + + + + + + + + + | /* * Minimal set of shared macro definitions and declarations so that multiple * source files can make use of the parsing table in tclParse.c */ |
Changes to generic/tclPathObj.c.
| ︙ | |||
36 37 38 39 40 41 42 | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | - - - - - + + + + + - - - - - - - - - - - + + + + + + + + + + + |
/*
* Define the 'path' object type, which Tcl uses to represent file paths
* internally.
*/
static const Tcl_ObjType fsPathType = {
|
| ︙ | |||
85 86 87 88 89 90 91 | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | + - - - - - - - - + + + + + + + + | #define TCLPATH_NEEDNORM 4 /* * Define some macros to give us convenient access to path-object specific * fields. */ #define PATHOBJ(pathPtr) \ |
| ︙ | |||
151 152 153 154 155 156 157 | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | - - - - + + + + - - - - + + + + - - + + |
if (zipVolumeLen) {
/*
* NOTE: file normalization for zipfs is very specific to
* format of zipfs volume being of the form //xxx:/
*/
dirSep += zipVolumeLen-1; /* Start parse after : */
} else if (tclPlatform == TCL_PLATFORM_WINDOWS) {
|
| ︙ | |||
400 401 402 403 404 405 406 407 408 409 410 411 412 413 | 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | + |
* Ensure a windows drive like C:/ has a trailing separator.
* Likewise for zipfs volumes.
*/
if (zipVolumeLen || (tclPlatform == TCL_PLATFORM_WINDOWS)) {
int needTrailingSlash = 0;
Tcl_Size len;
const char *path = TclGetStringFromObj(retVal, &len);
if (zipVolumeLen) {
if (len == (zipVolumeLen - 1)) {
needTrailingSlash = 1;
}
} else {
if (len == 2 && path[0] != 0 && path[1] == ':') {
needTrailingSlash = 1;
|
| ︙ | |||
722 723 724 725 726 727 728 | 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 | - + | * Tcl_FSSplitPath preserves the "~", but this code computes the * actual full path name, if we had just a single component. */ splitPtr = Tcl_FSSplitPath(pathPtr, &splitElements); Tcl_IncrRefCount(splitPtr); |
| ︙ | |||
876 877 878 879 880 881 882 | 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 | - + - |
Tcl_Obj *tailObj = objv[1];
Tcl_PathType type;
/* if forceRelative - second path is relative */
type = forceRelative ? TCL_PATH_RELATIVE :
TclGetPathType(tailObj, NULL, NULL, NULL);
if (type == TCL_PATH_RELATIVE) {
|
| ︙ | |||
909 910 911 912 913 914 915 | 910 911 912 913 914 915 916 917 918 919 920 921 922 923 | - |
* Finally, on Windows, 'file join' is defined to convert
* all backslashes to forward slashes, so the base part
* cannot have backslashes either.
*/
if ((tclPlatform != TCL_PLATFORM_WINDOWS)
|| (strchr(TclGetString(elt), '\\') == NULL)) {
|
| ︙ | |||
1050 1051 1052 1053 1054 1055 1056 | 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 | - - + + |
noQuickReturn:
if (res == NULL) {
TclNewObj(res);
}
ptr = TclGetStringFromObj(res, &length);
|
| ︙ | |||
1515 1516 1517 1518 1519 1520 1521 | 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 | - |
Tcl_FSNewNativePath(
const Tcl_Filesystem *fromFilesystem,
void *clientData)
{
Tcl_Obj *pathPtr = NULL;
FsPath *fsPathPtr;
|
| ︙ | |||
1806 1807 1808 1809 1810 1811 1812 | 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 | - - - + |
Tcl_StoreInternalRep(pathPtr, &fsPathType, NULL);
if (SetFsPathFromAny(interp, pathPtr) != TCL_OK) {
return NULL;
}
fsPathPtr = PATHOBJ(pathPtr);
} else if (fsPathPtr->normPathPtr == NULL) {
Tcl_Size cwdLen;
|
| ︙ | |||
2003 2004 2005 2006 2007 2008 2009 | 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 | - - - + + |
if (actualFs == fsPtr) {
return Tcl_FSGetInternalRep(pathPtr, fsPtr);
}
return NULL;
}
if (srcFsPathPtr->nativePathPtr == NULL) {
|
| ︙ | |||
2344 2345 2346 2347 2348 2349 2350 | 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 | - + | * Memory may be allocated. * *--------------------------------------------------------------------------- */ static void UpdateStringOfFsPath( |
| ︙ | |||
2466 2467 2468 2469 2470 2471 2472 | 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 2505 2506 2507 2508 2509 2510 2511 2512 | - - - - - + + + + + - + - - - + + + - - - - - + + + + + - + - - - - - - + + + + + + | * Returns TCL_OK on success with home directory path in *dsPtr * and TCL_ERROR on failure with error message in interp if non-NULL. * *---------------------------------------------------------------------- */ int MakeTildeRelativePath( |
| ︙ | |||
2534 2535 2536 2537 2538 2539 2540 | 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 | - - + + | * Returns a Tcl_Obj containing the home directory of a user * or NULL on failure with error message in interp if non-NULL. * *---------------------------------------------------------------------- */ Tcl_Obj * TclGetHomeDirObj( |
| ︙ | |||
2566 2567 2568 2569 2570 2571 2572 | 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 | - + | * Returns NULL if the path begins with a ~ that cannot be resolved * and stores an error message in interp if non-NULL. * *---------------------------------------------------------------------- */ Tcl_Obj * TclResolveTildePath( |
| ︙ | |||
2588 2589 2590 2591 2592 2593 2594 | 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 | - + - - - + + + - - - + + + |
* split becomes value 1 for '~/...' as well as for '~'. Note on
* Windows FindSplitPos will implicitly check for '\' as separator
* in addition to what is passed.
*/
split = FindSplitPos(path, '/');
if (split == 1) {
|
| ︙ | |||
2650 2651 2652 2653 2654 2655 2656 | 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 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 | - + - + + - - - - + + + + - + + - + - |
Tcl_Obj **objv;
Tcl_Size objc;
Tcl_Size i;
Tcl_Obj *resolvedPaths;
const char *path;
if (pathsObj == NULL) {
|
Changes to generic/tclPipe.c.
| ︙ | |||
190 191 192 193 194 195 196 | 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | - |
for (i = 0; i < numPids; i++) {
detPtr = (Detached *)Tcl_Alloc(sizeof(Detached));
detPtr->pid = pidPtr[i];
detPtr->nextPtr = detList;
detList = detPtr;
}
Tcl_MutexUnlock(&pipeMutex);
|
| ︙ | |||
1017 1018 1019 1020 1021 1022 1023 | 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 | - + |
*----------------------------------------------------------------------
*/
Tcl_Channel
Tcl_OpenCommandChannel(
Tcl_Interp *interp, /* Interpreter for error reporting. Can NOT be
* NULL. */
|
| ︙ |
Changes to generic/tclPkgConfig.c.
| ︙ | |||
18 19 20 21 22 23 24 | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | - + | * * - TCL_THREADS OSCMa compilation as threaded core. * - TCL_MEM_DEBUG OSCMa memory debugging. * - TCL_COMPILE_DEBUG OSCMa debugging of bytecode compiler. * - TCL_COMPILE_STATS OSCMa bytecode compiler statistics. * * - TCL_CFG_DO64BIT NSCMdt tcl is compiled for a 64bit system. |
| ︙ |
Changes to generic/tclPreserve.c.
| ︙ | |||
17 18 19 20 21 22 23 | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | - + - + + - + |
/*
* The following data structure is used to keep track of all the Tcl_Preserve
* calls that are still in effect. It grows as needed to accommodate any
* number of calls in effect.
*/
typedef struct {
|
| ︙ | |||
113 114 115 116 117 118 119 | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | - + | * until at least the matching call to Tcl_Release. * *---------------------------------------------------------------------- */ void Tcl_Preserve( |
| ︙ | |||
176 177 178 179 180 181 182 | 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | - + | * call to Tcl_Preserve is still in effect, the block of memory is freed. * *---------------------------------------------------------------------- */ void Tcl_Release( |
| ︙ | |||
255 256 257 258 259 260 261 | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | - + | * Ptr may be released by calling free(). * *---------------------------------------------------------------------- */ void Tcl_EventuallyFree( |
| ︙ |
Changes to generic/tclProc.c.
| ︙ | |||
65 66 67 68 69 70 71 | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | - + - + - - - + + + |
* Tcl_GetStringFromObj should panic
* instead. */
NULL, /* SetFromAny function; Tcl_ConvertToType
* should panic instead. */
TCL_OBJTYPE_V0
};
|
| ︙ | |||
112 113 114 115 116 117 118 | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | - + - + - + - - - - + + + + |
FreeLambdaInternalRep, /* freeIntRepProc */
DupLambdaInternalRep, /* dupIntRepProc */
NULL, /* updateStringProc */
SetLambdaFromAny, /* setFromAnyProc */
TCL_OBJTYPE_V0
};
|
| ︙ | |||
152 153 154 155 156 157 158 | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | - + |
*/
#undef TclObjInterpProc
int
Tcl_ProcObjCmd(
TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
899 900 901 902 903 904 905 | 899 900 901 902 903 904 905 906 907 908 909 910 911 912 | - |
int
TclNRUplevelObjCmd(
TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
|
| ︙ | |||
967 968 969 970 971 972 973 | 966 967 968 969 970 971 972 973 974 975 976 977 978 979 | - |
if (objc == 1) {
/*
* TIP #280. Make actual argument location available to eval'd script
*/
TclArgumentGet(interp, objv[0], &invoker, &word);
objPtr = objv[0];
|
| ︙ | |||
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 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 | - + - + - + |
/*
* Build up desired argument list for Tcl_WrongNumArgs
*/
numArgs = framePtr->procPtr->numArgs;
desiredObjs = (Tcl_Obj **)TclStackAlloc(interp,
|
| ︙ | |||
1335 1336 1337 1338 1339 1340 1341 | 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 | - + | * are being referenced at runtime. * *---------------------------------------------------------------------- */ static int InitArgsAndLocals( |
| ︙ | |||
1499 1500 1501 1502 1503 1504 1505 | 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 | - + - + | * to be popped by the caller. * *---------------------------------------------------------------------- */ int TclPushProcCallFrame( |
| ︙ | |||
1593 1594 1595 1596 1597 1598 1599 | 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 | - + - + - + - + - + - + | * Depends on the commands in the procedure. * *---------------------------------------------------------------------- */ int TclObjInterpProc( |
| ︙ | |||
1684 1685 1686 1687 1688 1689 1690 | 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 | - + - + | * Nearly anything; depends on the commands in the procedure body. * *---------------------------------------------------------------------- */ int TclNRInterpProcCore( |
| ︙ | |||
2105 2106 2107 2108 2109 2110 2111 | 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 | - + | * procedure completes. * *---------------------------------------------------------------------- */ void TclProcDeleteProc( |
| ︙ | |||
2133 2134 2135 2136 2137 2138 2139 | 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 | - + | * Memory gets freed. * *---------------------------------------------------------------------- */ void TclProcCleanupProc( |
| ︙ | |||
2398 2399 2400 2401 2402 2403 2404 | 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 2438 2439 2440 2441 2442 2443 | - + - + - + |
*
*----------------------------------------------------------------------
*/
static void
DupLambdaInternalRep(
Tcl_Obj *srcPtr, /* Object with internal rep to copy. */
|
| ︙ | |||
2530 2531 2532 2533 2534 2535 2536 | 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 | - |
} else if (contextPtr->type == TCL_LOCATION_SOURCE) {
/*
* We created a new reference to the source file path name when we
* created 'context' above. Account for the reference.
*/
Tcl_IncrRefCount(contextPtr->data.eval.path);
|
| ︙ |
Changes to generic/tclProcess.c.
| ︙ | |||
346 347 348 349 350 351 352 | 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | - |
TclNewIntObj(errorStrings[4], resolvedPid);
*errorObjPtr = Tcl_NewListObj(5, errorStrings);
}
return TCL_PROCESS_UNKNOWN_STATUS;
}
}
|
| ︙ | |||
511 512 513 514 515 516 517 | 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | - - + + |
if (objc != 1 && objc != 2) {
Tcl_WrongNumArgs(interp, 1, savedobjv, "?switches? ?pids?");
return TCL_ERROR;
}
if (objc == 1) {
/*
|
| ︙ | |||
716 717 718 719 720 721 722 | 715 716 717 718 719 720 721 722 723 724 725 726 727 728 | - |
static int
ProcessAutopurgeObjCmd(
TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
|
| ︙ | |||
887 888 889 890 891 892 893 | 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 | - + - |
Tcl_Pid pid, /* Process id. */
int options, /* Options passed to WaitProcessStatus. */
int *codePtr, /* If non-NULL, will receive either:
* - 0 for normal exit.
* - errno in case of error.
* - non-zero exit code for abormal exit.
* - signal number if killed or suspended.
|
| ︙ |
Changes to generic/tclRegexp.c.
| ︙ | |||
60 61 62 63 64 65 66 | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | + - + + | */ /* * Thread local storage used to maintain a per-thread cache of compiled * regular expressions. */ #ifndef NUM_REGEXPS |
| ︙ | |||
99 100 101 102 103 104 105 | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | - - - - - + + + + + - + - + - + - + - + |
/*
* The regular expression Tcl object type. This serves as a cache of the
* compiled form of the regular expression.
*/
const Tcl_ObjType tclRegexpType = {
|
| ︙ | |||
302 303 304 305 306 307 308 | 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | - + |
static int
RegExpExecUniChar(
Tcl_Interp *interp, /* Interpreter to use for error reporting. */
Tcl_RegExp re, /* Compiled regular expression; returned by a
* previous call to Tcl_GetRegExpFromObj */
const Tcl_UniChar *wString, /* String against which to match re. */
size_t numChars, /* Length of Tcl_UniChar string. */
|
| ︙ | |||
363 364 365 366 367 368 369 | 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | - + - + |
TclRegExpRangeUniChar(
Tcl_RegExp re, /* Compiled regular expression that has been
* passed to Tcl_RegExpExec. */
Tcl_Size index, /* 0 means give the range of the entire match,
* > 0 means give the range of a matching
* subrange, -1 means the range of the
* rm_extend field. */
|
| ︙ | |||
441 442 443 444 445 446 447 | 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 | - + |
Tcl_Interp *interp, /* Interpreter to use for error reporting. */
Tcl_RegExp re, /* Compiled regular expression; must have been
* returned by previous call to
* Tcl_GetRegExpFromObj. */
Tcl_Obj *textObj, /* Text against which to match re. */
Tcl_Size offset, /* Character index that marks where matching
* should begin. */
|
| ︙ | |||
855 856 857 858 859 860 861 | 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 | - + |
*----------------------------------------------------------------------
*/
static TclRegexp *
CompileRegexp(
Tcl_Interp *interp, /* Used for error reporting if not NULL. */
const char *string, /* The regexp to compile (UTF-8). */
|
| ︙ |
Changes to generic/tclResult.c.
| ︙ | |||
384 385 386 387 388 389 390 | 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 | - + | * It also clears any error information for the interpreter. * *---------------------------------------------------------------------- */ void Tcl_ResetResult( |
| ︙ | |||
437 438 439 440 441 442 443 | 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | - + | * the interpreter. * *---------------------------------------------------------------------- */ static void ResetObjResult( |
| ︙ | |||
712 713 714 715 716 717 718 | 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 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 | - + - + - - + + - - + + - - - - - + + + + + - - - - + + + + - - - - - - + + + + + + - - - + + + - - + + - + - + |
if (code == TCL_ERROR) {
if (iPtr->errorInfo) {
Tcl_DecrRefCount(iPtr->errorInfo);
iPtr->errorInfo = NULL;
}
Tcl_DictObjGet(NULL, iPtr->returnOpts, keys[KEY_ERRORINFO],
|
| ︙ | |||
839 840 841 842 843 844 845 | 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 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 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 | - - + + - - + - - + + - - + + - - + + - + - - - - + + + + - + - + - + |
if (TCL_ERROR == Tcl_DictObjFirst(NULL, dict, &search,
&keyPtr, &valuePtr, &done)) {
/*
* Value is not a legal dictionary.
*/
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
| ︙ | |||
1030 1031 1032 1033 1034 1035 1036 | 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 | - + |
Tcl_NewWideIntObj(result));
Tcl_DictObjPut(NULL, options, keys[KEY_LEVEL],
Tcl_NewWideIntObj(0));
}
if (result == TCL_ERROR) {
Tcl_AddErrorInfo(interp, "");
|
| ︙ | |||
1101 1102 1103 1104 1105 1106 1107 | 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 | - + |
int level, code;
Tcl_Obj **objv, *mergedOpts;
Tcl_IncrRefCount(options);
if (TCL_ERROR == TclListObjGetElements(interp, options, &objc, &objv)
|| (objc % 2)) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
| ︙ |
Changes to generic/tclScan.c.
| ︙ | |||
13 14 15 16 17 18 19 | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | + - - - - + + + + - - - + + + |
#include "tclTomMath.h"
#include <assert.h>
/*
* Flag values used by Tcl_ScanObjCmd.
*/
enum TclScanFlags {
|
| ︙ | |||
351 352 353 354 355 356 357 | 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | - + - - + + - + - - - + + - - + - + |
xpgCheckDone:
/*
* Parse any width specifier.
*/
if ((ch < 0x80) && isdigit(UCHAR(ch))) { /* INTL: "C" locale. */
/* Note ull >= 0 because of isdigit check above */
|
| ︙ |
Changes to generic/tclStrToD.c.
| ︙ | |||
22 23 24 25 26 27 28 | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | - | #define copysign _copysign #endif #ifndef PRIx64 # define PRIx64 TCL_LL_MODIFIER "x" #endif |
| ︙ | |||
273 274 275 276 277 278 279 | 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 | - + - + - + |
(Tcl_WideUInt) 3125U*125U,
(Tcl_WideUInt) 3125U*625U,
(Tcl_WideUInt) 3125U*3125U, /* 5**10 */
(Tcl_WideUInt) 3125U*3125U*5U,
(Tcl_WideUInt) 3125U*3125U*25U,
(Tcl_WideUInt) 3125U*3125U*125U,
(Tcl_WideUInt) 3125U*3125U*625U,
|
| ︙ | |||
649 650 651 652 653 654 655 | 648 649 650 651 652 653 654 655 656 657 658 659 660 661 | - |
/* Valid whitespace found, move on to the next character */
goto next;
}
continue_num:
switch (state) {
|
| ︙ | |||
1440 1441 1442 1443 1444 1445 1446 | 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 | - |
if (err != MP_OKAY) {
return TCL_ERROR;
}
break;
case FRACTION:
case EXPONENT:
|
| ︙ | |||
1693 1694 1695 1696 1697 1698 1699 | 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 | - + |
* With gcc on x86, the floating point rounding mode is double-extended.
* This causes the result of double-precision calculations to be rounded
* twice: once to the precision of double-extended and then again to the
* precision of double. Double-rounding introduces gratuitous errors of 1
* ulp, so we need to change rounding mode to 53-bits. We also make
* 'retval' volatile, so that it doesn't get promoted to a register.
*/
|
| ︙ | |||
2649 2650 2651 2652 2653 2654 2655 | 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 | - + | * one too high. * *---------------------------------------------------------------------- */ static inline void SetPrecisionLimits( |
| ︙ | |||
4226 4227 4228 4229 4230 4231 4232 | 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 | - | * less - unless we're working in F format - because we know that * three groups of digits will always suffice for %#.17e, the * longest format that doesn't introduce empty precision. * * Extract the next group of digits. */ |
| ︙ | |||
4844 4845 4846 4847 4848 4849 4850 | 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 | - |
{
mp_int b;
int bits, shift, i, lsb;
double r;
mp_err err;
const mp_int *a = (const mp_int *)big;
|
| ︙ | |||
4880 4881 4882 4883 4884 4885 4886 | 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 | - + - - |
/* just skip */
} else if (shift == 0) {
err = mp_copy(a, &b);
} else if (shift > 0) {
err = mp_mul_2d(a, shift, &b);
} else if (shift < 0) {
lsb = mp_cnt_lsb(a);
|
| ︙ | |||
4958 4959 4960 4961 4962 4963 4964 | 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 | - + | * Returns the floating point number. * *---------------------------------------------------------------------- */ double TclCeil( |
| ︙ | |||
5024 5025 5026 5027 5028 5029 5030 | 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 | - + | * Returns the floating point value. * *---------------------------------------------------------------------- */ double TclFloor( |
| ︙ |
Changes to generic/tclStringObj.c.
| ︙ | |||
455 456 457 458 459 460 461 | 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | - |
TclGetString(objPtr);
numChars = TclNumUtfChars(objPtr->bytes, objPtr->length);
}
return numChars;
}
|
| ︙ | |||
715 716 717 718 719 720 721 | 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 | - - + + |
*
*----------------------------------------------------------------------
*/
Tcl_Obj *
Tcl_GetRange(
Tcl_Obj *objPtr, /* The Tcl object to find the range of. */
|
| ︙ | |||
2467 2468 2469 2470 2471 2472 2473 | 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 | - | errCode = "OVERFLOW"; goto errorMsg; } Tcl_AppendObjToObj(segment, pure); Tcl_DecrRefCount(pure); break; } |
| ︙ | |||
3516 3517 3518 3519 3520 3521 3522 | 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 | - - - - + + + - + | * Side effects: * String representations may be generated. Internal representation may * be changed. * *--------------------------------------------------------------------------- */ |
| ︙ | |||
3574 3575 3576 3577 3578 3579 3580 | 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 | - + |
return 0;
}
static int
UtfNcasememcmp(
const void *csPtr, /* UTF string to compare to ct. */
const void *ctPtr, /* UTF string cs is compared to. */
|
| ︙ | |||
3601 3602 3603 3604 3605 3606 3607 | 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 | - - - + + + |
}
}
return 0;
}
static int
UniCharNmemcmp(
|
| ︙ | |||
3635 3636 3637 3638 3639 3640 3641 | 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 | - + |
int
TclStringCmp(
Tcl_Obj *value1Ptr,
Tcl_Obj *value2Ptr,
int checkEq, /* comparison is only for equality */
int nocase, /* comparison is not case sensitive */
Tcl_Size reqlength) /* requested length in characters;
|
| ︙ |
Changes to generic/tclStringRep.h.
| ︙ | |||
38 39 40 41 42 43 44 | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | - + + |
* the UTF-8 string. Does not include nul
* terminator so actual allocation is
* (allocated+1). */
Tcl_Size maxChars; /* Max number of chars that can fit in the
* space allocated for the Unicode array. */
int hasUnicode; /* Boolean determining whether the string has
* a Tcl_UniChar representation. */
|
| ︙ | |||
63 64 65 66 67 68 69 | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | - + |
(String *) Tcl_AttemptRealloc((ptr), STRING_SIZE(numChars))
#define GET_STRING(objPtr) \
((String *) (objPtr)->internalRep.twoPtrValue.ptr1)
#define SET_STRING(objPtr, stringPtr) \
((objPtr)->internalRep.twoPtrValue.ptr2 = NULL), \
((objPtr)->internalRep.twoPtrValue.ptr1 = (void *) (stringPtr))
|
Changes to generic/tclStubLibTbl.c.
| ︙ | |||
29 30 31 32 33 34 35 | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | - - + + - - - + + + | * Side effects: * Sets the stub table pointers. * *---------------------------------------------------------------------- */ MODULE_SCOPE const char * TclInitStubTable( |
| ︙ |
Changes to generic/tclThread.c.
| ︙ | |||
19 20 21 22 23 24 25 | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | - - - + + + |
* used for these objects so they can be finalized.
*
* These statics are guarded by the mutex in the caller of
* TclRememberThreadData, e.g., TclpThreadDataKeyInit
*/
typedef struct {
|
| ︙ | |||
140 141 142 143 144 145 146 | 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | - |
static void
RememberSyncObject(
void *objPtr, /* Pointer to sync object */
SyncObjRecord *recPtr) /* Record of sync objects */
{
void **newList;
int i, j;
|
| ︙ | |||
484 485 486 487 488 489 490 | 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | - + | * *---------------------------------------------------------------------- */ #undef Tcl_ConditionWait void Tcl_ConditionWait( |
| ︙ |
Changes to generic/tclThreadAlloc.c.
| ︙ | |||
88 89 90 91 92 93 94 | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | - + |
size_t numFree; /* Number of blocks available */
/* All fields below for accounting only */
size_t numRemoves; /* Number of removes from bucket */
size_t numInserts; /* Number of inserts into bucket */
size_t numLocks; /* Number of locks acquired */
|
| ︙ | |||
116 117 118 119 120 121 122 | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | - + |
* The following array specifies various per-bucket limits and locks. The
* values are statically initialized to avoid calculating them repeatedly.
*/
static struct {
size_t blockSize; /* Bucket blocksize. */
size_t maxBlocks; /* Max blocks before move to share. */
|
| ︙ | |||
942 943 944 945 946 947 948 | 942 943 944 945 946 947 948 949 950 951 952 953 954 955 | - |
* slight performance enhancement. The value is verified after the lock is
* actually acquired.
*/
if (cachePtr != sharedPtr && sharedPtr->buckets[bucket].numFree > 0) {
LockBucket(cachePtr, bucket);
if (sharedPtr->buckets[bucket].numFree > 0) {
|
| ︙ |
Changes to generic/tclThreadStorage.c.
| ︙ | |||
44 45 46 47 48 49 50 | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | - + |
} tsdGlobal = { NULL, 0, NULL };
/*
* The type of the data held per thread in a system TSD.
*/
typedef struct {
|
| ︙ |
Changes to generic/tclThreadTest.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 | - - + + + | static ThreadSpecificData *threadList = NULL; /* * The following bit-values are legal for the "flags" field of the * ThreadSpecificData structure. */ |
| ︙ |
Changes to generic/tclTimer.c.
| ︙ | |||
17 18 19 20 21 22 23 | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | - + |
* type. The normal handlers (created by Tcl_CreateTimerHandler) are chained
* together in a list sorted by time (earliest event first).
*/
typedef struct TimerHandler {
Tcl_Time time; /* When timer is to fire. */
Tcl_TimerProc *proc; /* Function to call. */
|
| ︙ | |||
69 70 71 72 73 74 75 | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | - + |
* There is one of the following structures for each of the handlers declared
* in a call to Tcl_DoWhenIdle. All of the currently-active handlers are
* linked together into a list.
*/
typedef struct IdleHandler {
Tcl_IdleProc *proc; /* Function to call. */
|
| ︙ | |||
178 179 180 181 182 183 184 | 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | - + + |
*
*----------------------------------------------------------------------
*/
static ThreadSpecificData *
InitTimer(void)
{
|
| ︙ | |||
209 210 211 212 213 214 215 | 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | - + + |
*----------------------------------------------------------------------
*/
static void
TimerExitProc(
TCL_UNUSED(void *))
{
|
| ︙ | |||
247 248 249 250 251 252 253 | 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | - + |
*/
Tcl_TimerToken
Tcl_CreateTimerHandler(
int milliseconds, /* How many milliseconds to wait before
* invoking proc. */
Tcl_TimerProc *proc, /* Function to invoke. */
|
| ︙ | |||
293 294 295 296 297 298 299 | 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | - + |
Tcl_Time *timePtr,
Tcl_TimerProc *proc,
void *clientData)
{
TimerHandler *timerHandlerPtr, *tPtr2, *prevPtr;
ThreadSpecificData *tsdPtr = InitTimer();
|
| ︙ | |||
615 616 617 618 619 620 621 | 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 | - + |
*
*--------------------------------------------------------------
*/
void
Tcl_DoWhenIdle(
Tcl_IdleProc *proc, /* Function to invoke. */
|
| ︙ | |||
659 660 661 662 663 664 665 | 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 | - + |
*
*----------------------------------------------------------------------
*/
void
Tcl_CancelIdleCall(
Tcl_IdleProc *proc, /* Function that was previously registered. */
|
| ︙ | |||
819 820 821 822 823 824 825 | 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 | - - - - + + + + |
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]);
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
|
| ︙ | |||
948 949 950 951 952 953 954 | 950 951 952 953 954 955 956 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 | - + - + - - + + - + |
for (afterPtr = assocPtr->firstAfterPtr; afterPtr != NULL;
afterPtr = afterPtr->nextPtr) {
if (assocPtr->interp == interp) {
Tcl_ListObjAppendElement(NULL, resultObj, Tcl_ObjPrintf(
"after#%d", afterPtr->id));
}
}
|
| ︙ | |||
1039 1040 1041 1042 1043 1044 1045 | 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 | - - - + + + - - - + + + - - + + |
}
if (iPtr->limit.timeEvent == NULL
|| TCL_TIME_BEFORE(endTime, iPtr->limit.time)) {
diff = TCL_TIME_DIFF_MS_CEILING(endTime, now);
if (diff > TCL_TIME_MAXIMUM_SLICE) {
diff = TCL_TIME_MAXIMUM_SLICE;
}
|
| ︙ | |||
1145 1146 1147 1148 1149 1150 1151 | 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 | - + | * bgerror fails then information about the error is output on stderr. * *---------------------------------------------------------------------- */ static void AfterProc( |
| ︙ | |||
1210 1211 1212 1213 1214 1215 1216 | 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 | - + | * The memory associated with afterPtr is released. * *---------------------------------------------------------------------- */ static void FreeAfterPtr( |
| ︙ | |||
1247 1248 1249 1250 1251 1252 1253 | 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 | - + | * After commands are removed. * *---------------------------------------------------------------------- */ static void AfterCleanupProc( |
| ︙ |
Changes to generic/tclTomMath.h.
1 2 3 4 5 6 7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | - - + + - - - + + + - - - - - - + + + + + + |
#ifndef BN_TCL_H_
#define BN_TCL_H_
#include <stdint.h>
#if defined(TCL_NO_TOMMATH_H)
typedef size_t mp_digit;
typedef int mp_sign;
|
| ︙ |
Changes to generic/tclTomMathStubLib.c.
| ︙ | |||
13 14 15 16 17 18 19 | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | - | #include "tclInt.h" #include "tclTomMath.h" MODULE_SCOPE const TclTomMathStubs *tclTomMathStubsPtr; const TclTomMathStubs *tclTomMathStubsPtr = NULL; |
| ︙ |
Changes to generic/tclTrace.c.
| ︙ | |||
18 19 20 21 22 23 24 | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | - + |
* Structures used to hold information about variable traces:
*/
typedef struct {
int flags; /* Operations for which Tcl command is to be
* invoked. */
Tcl_Size length; /* Number of non-NUL chars. in command. */
|
| ︙ | |||
40 41 42 43 44 45 46 | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | - + - + |
typedef struct {
int flags; /* Operations for which Tcl command is to be
* invoked. */
Tcl_Size length; /* Number of non-NUL chars. in command. */
Tcl_Trace stepTrace; /* Used for execution traces, when tracing
* inside the given command */
|
| ︙ | |||
78 79 80 81 82 83 84 | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | + - - - - - + + + + + + |
* further traces execute.
* TCL_TRACE_EXEC_DIRECT - This execution trace is triggered directly
* by the command being traced, not because of
* an internal trace.
* The flag 'TCL_TRACE_DESTROYED' may also be used in command execution traces.
*/
enum TraceCommandFlags {
|
| ︙ | |||
142 143 144 145 146 147 148 | 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 | - + - - + + - - + + |
/*
* The following structure holds the client data for string-based
* trace procs
*/
typedef struct {
|
| ︙ | |||
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | + - + - - - - + - - - - |
{
/* Main sub commands to 'trace' */
static const char *const traceOptions[] = {
"add", "info", "remove",
NULL
};
enum traceOptionsEnum optionIndex;
int typeIndex;
if (objc < 2) {
Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?");
return TCL_ERROR;
}
if (Tcl_GetIndexFromObj(interp, objv[1], traceOptions, "option", 0,
&optionIndex) != TCL_OK) {
return TCL_ERROR;
}
switch (optionIndex) {
case TRACE_ADD:
|
| ︙ | |||
275 276 277 278 279 280 281 | 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | - - + + + |
*
*----------------------------------------------------------------------
*/
static int
TraceExecutionObjCmd(
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
522 523 524 525 526 527 528 | 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 | - - + + + |
*
*----------------------------------------------------------------------
*/
static int
TraceCommandObjCmd(
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
716 717 718 719 720 721 722 | 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 | - - + + + |
*
*----------------------------------------------------------------------
*/
static int
TraceVariableObjCmd(
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ | |||
977 978 979 980 981 982 983 | 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 | - + |
* traced. */
const char *cmdName, /* Name of command. */
int flags, /* OR-ed collection of bits, including any of
* TCL_TRACE_RENAME, TCL_TRACE_DELETE, and any
* of the TRACE_*_EXEC flags */
Tcl_CommandTraceProc *proc, /* Function to call when specified ops are
* invoked upon cmdName. */
|
| ︙ | |||
1012 1013 1014 1015 1016 1017 1018 | 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 | - |
if ((cmdPtr->compileProc != NULL) && !(cmdPtr->flags & CMD_HAS_EXEC_TRACES)){
Interp *iPtr = (Interp *) interp;
iPtr->compileEpoch++;
}
cmdPtr->flags |= CMD_HAS_EXEC_TRACES;
}
|
| ︙ | |||
1041 1042 1043 1044 1045 1046 1047 | 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 | - + |
Tcl_UntraceCommand(
Tcl_Interp *interp, /* Interpreter containing command. */
const char *cmdName, /* Name of command. */
int flags, /* OR-ed collection of bits, including any of
* TCL_TRACE_RENAME, TCL_TRACE_DELETE, and any
* of the TRACE_*_EXEC flags */
Tcl_CommandTraceProc *proc, /* Function assocated with trace. */
|
| ︙ | |||
1116 1117 1118 1119 1120 1121 1122 | 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 | - + | /* * None of the remaining traces on this command are execution traces. * We therefore remove this flag: */ cmdPtr->flags &= ~CMD_HAS_EXEC_TRACES; |
| ︙ | |||
1146 1147 1148 1149 1150 1151 1152 | 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 | - + | * Depends on the command associated with the trace. * *---------------------------------------------------------------------- */ static void TraceCommandProc( |
| ︙ | |||
1291 1292 1293 1294 1295 1296 1297 | 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 | - + |
Tcl_Interp *interp, /* The current interpreter. */
const char *command, /* Pointer to beginning of the current command
* string. */
TCL_UNUSED(Tcl_Size) /*numChars*/,
Command *cmdPtr, /* Points to command's Command struct. */
int code, /* The current result code. */
int traceFlags, /* Current tracing situation. */
|
| ︙ | |||
1397 1398 1399 1400 1401 1402 1403 | 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 | - + |
const char *command, /* Pointer to beginning of the current command
* string. */
Tcl_Size numChars, /* The number of characters in 'command' which
* are part of the command string. */
Command *cmdPtr, /* Points to command's Command struct. */
int code, /* The current result code. */
int traceFlags, /* Current tracing situation. */
|
| ︙ | |||
1535 1536 1537 1538 1539 1540 1541 | 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 | - + |
*
*----------------------------------------------------------------------
*/
static int
CallTraceFunction(
Tcl_Interp *interp, /* The current interpreter. */
|
| ︙ | |||
1830 1831 1832 1833 1834 1835 1836 | 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 | - + | * Depends on the command associated with the trace. * *---------------------------------------------------------------------- */ static char * TraceVarProc( |
| ︙ | |||
2013 2014 2015 2016 2017 2018 2019 | 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 | - + - + - + - + |
}
Tcl_Free(info);
}
Tcl_Trace
Tcl_CreateObjTrace(
Tcl_Interp *interp, /* Tcl interpreter */
|
| ︙ | |||
2121 2122 2123 2124 2125 2126 2127 | 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 | - + - + |
*
*----------------------------------------------------------------------
*/
Tcl_Trace
Tcl_CreateTrace(
Tcl_Interp *interp, /* Interpreter in which to create trace. */
|
| ︙ | |||
2431 2432 2433 2434 2435 2436 2437 | 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 | - + |
*
*----------------------------------------------------------------------
*/
int
TclObjCallVarTraces(
Interp *iPtr, /* Interpreter containing variable. */
|
| ︙ | |||
2465 2466 2467 2468 2469 2470 2471 | 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 | - + |
return TclCallVarTraces(iPtr, arrayPtr, varPtr, part1, part2, flags,
leaveErrMsg);
}
int
TclCallVarTraces(
Interp *iPtr, /* Interpreter containing variable. */
|
| ︙ | |||
2544 2545 2546 2547 2548 2549 2550 | 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 | - - - - + + + + - - - - + + + + |
}
}
}
/* Keep the original pointer for possible use in an error message */
element = part2;
if (part2 == NULL) {
|
| ︙ | |||
2773 2774 2775 2776 2777 2778 2779 | 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 | - + |
* trace applies to scalar variable or array
* as-a-whole. */
int flags, /* OR-ed collection of bits describing current
* trace, including any of TCL_TRACE_READS,
* TCL_TRACE_WRITES, TCL_TRACE_UNSETS,
* TCL_GLOBAL_ONLY, and TCL_NAMESPACE_ONLY. */
Tcl_VarTraceProc *proc, /* Function associated with trace. */
|
| ︙ | |||
2976 2977 2978 2979 2980 2981 2982 | 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 | - + |
* as-a-whole. */
int flags, /* OR-ed collection of bits, including any of
* TCL_TRACE_READS, TCL_TRACE_WRITES,
* TCL_TRACE_UNSETS, TCL_GLOBAL_ONLY, and
* TCL_NAMESPACE_ONLY. */
Tcl_VarTraceProc *proc, /* Function to call when specified ops are
* invoked upon varName. */
|
| ︙ | |||
3023 3024 3025 3026 3027 3028 3029 | 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 | - + |
TraceVarEx(
Tcl_Interp *interp, /* Interpreter in which variable is to be
* traced. */
const char *part1, /* Name of scalar variable or array. */
const char *part2, /* Name of element within array; NULL means
* trace applies to scalar variable or array
* as-a-whole. */
|
| ︙ |
Changes to generic/tclUtf.c.
| ︙ | |||
14 15 16 17 18 19 20 | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | - + - - - + + + + - + - + - - + + - + - - - - + + + + - - - - - - + + + + + + + | /* * Include the static character classification tables and macros. */ #include "tclUniData.c" /* |
| ︙ | |||
157 158 159 160 161 162 163 | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | - + |
0x80, 0xBF, 0x80, 0xBF, 0x80, 0xBF, /* (\xE4 - \xEC) -- all valid */
0x90, 0xBF, /* \xF0\x80 through \xF0\x8F are invalid prefixes */
0x80, 0x8F /* \xF4\x90 and higher are invalid prefixes */
};
static int
Invalid(
|
| ︙ | |||
202 203 204 205 206 207 208 | 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | - - - - - - + + + + + + - | * None. * *--------------------------------------------------------------------------- */ Tcl_Size Tcl_UniCharToUtf( |
| ︙ | |||
305 306 307 308 309 310 311 | 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 | - + | * None. * *--------------------------------------------------------------------------- */ char * Tcl_UniCharToUtfDString( |
| ︙ | |||
366 367 368 369 370 371 372 | 367 368 369 370 371 372 373 374 375 376 377 378 379 380 | - |
* UTF-8 string length in bytes will be <= Utf16 string length * 3.
*/
if (uniStr == NULL) {
return NULL;
}
if (uniLength < 0) {
|
| ︙ | |||
436 437 438 439 440 441 442 | 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | - - - + + + |
0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x8D, 0x017D, 0x8F,
0x90, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
0x2DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x9D, 0x017E, 0x0178
};
Tcl_Size
Tcl_UtfToUniChar(
|
| ︙ | |||
496 497 498 499 500 501 502 | 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 | - + + |
}
/*
* A three-byte-character lead-byte not followed by two trail-bytes
* represents itself.
*/
} else if (byte < 0xF5) {
|
| ︙ | |||
519 520 521 522 523 524 525 | 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 | - - - + + + + |
*chPtr = byte;
return 1;
}
Tcl_Size
Tcl_UtfToChar16(
|
| ︙ | |||
797 798 799 800 801 802 803 | 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 | - - - + + + | * None. * *--------------------------------------------------------------------------- */ Tcl_Size Tcl_NumUtfChars( |
| ︙ | |||
849 850 851 852 853 854 855 | 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 | - - - + + + |
}
}
return i;
}
Tcl_Size
TclNumUtfChars(
|
| ︙ | |||
1072 1073 1074 1075 1076 1077 1078 | 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 | - + - |
const char *start) /* Pointer to the beginning of the string */
{
int trailBytesSeen = 0; /* How many trail bytes have been verified? */
const char *fallback = src - 1;
/* If we cannot find a lead byte that might
* start a prefix of a valid UTF byte sequence,
* we will fallback to a one-byte back step */
|
| ︙ | |||
1173 1174 1175 1176 1177 1178 1179 | 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 | - - + + | * None. * *--------------------------------------------------------------------------- */ int Tcl_UniCharAtIndex( |
| ︙ | |||
1209 1210 1211 1212 1213 1214 1215 | 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 | - - + + - - + + | * None. * *--------------------------------------------------------------------------- */ const char * Tcl_UtfAtIndex( |
| ︙ | |||
1486 1487 1488 1489 1490 1491 1492 | 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 | - + |
*----------------------------------------------------------------------
*/
int
TclpUtfNcmp2(
const void *csPtr, /* UTF string to compare to ct. */
const void *ctPtr, /* UTF string cs is compared to. */
|
| ︙ | |||
1519 1520 1521 1522 1523 1524 1525 | 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 1560 1561 1562 1563 1564 | - - + + - + - - + + | } /* *---------------------------------------------------------------------- * * Tcl_UtfNcmp -- * |
| ︙ | |||
1573 1574 1575 1576 1577 1578 1579 | 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 | - + |
return 0;
}
int
Tcl_UtfNcmp(
const char *cs, /* UTF string to compare to ct. */
const char *ct, /* UTF string cs is compared to. */
|
| ︙ | |||
1621 1622 1623 1624 1625 1626 1627 | 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 | - + |
*----------------------------------------------------------------------
*/
int
TclUtfNcasecmp(
const char *cs, /* UTF string to compare to ct. */
const char *ct, /* UTF string cs is compared to. */
|
| ︙ | |||
1656 1657 1658 1659 1660 1661 1662 | 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 | - + |
return 0;
}
int
Tcl_UtfNcasecmp(
const char *cs, /* UTF string to compare to ct. */
const char *ct, /* UTF string cs is compared to. */
|
| ︙ | |||
1877 1878 1879 1880 1881 1882 1883 | 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 | - + + | * None. * *---------------------------------------------------------------------- */ Tcl_Size Tcl_Char16Len( |
| ︙ | |||
1907 1908 1909 1910 1911 1912 1913 | 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 | - + | * None. * *---------------------------------------------------------------------- */ Tcl_Size Tcl_UniCharLen( |
| ︙ | |||
1939 1940 1941 1942 1943 1944 1945 | 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 | - + |
*----------------------------------------------------------------------
*/
int
TclUniCharNcmp(
const Tcl_UniChar *ucs, /* Unicode string to compare to uct. */
const Tcl_UniChar *uct, /* Unicode string ucs is compared to. */
|
| ︙ | |||
1984 1985 1986 1987 1988 1989 1990 | 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 | - + |
*----------------------------------------------------------------------
*/
int
TclUniCharNcasecmp(
const Tcl_UniChar *ucs, /* Unicode string to compare to uct. */
const Tcl_UniChar *uct, /* Unicode string ucs is compared to. */
|
| ︙ |
Changes to generic/tclUtil.c.
| ︙ | |||
84 85 86 87 88 89 90 | 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | + - - - - - - + + + + + + + |
* in other cases this means an overestimate of the
* required size.
*
* For more details, see the comments on the Tcl*Scan*Element and
* Tcl*Convert*Element routines.
*/
enum ScanConvertFlags {
|
| ︙ | |||
120 121 122 123 124 125 126 | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | - - - - - + + + + + |
* for it. This is a caching internalrep, keeping the result of a parse
* around. This type is only created from a pre-existing string, so an
* updateStringProc will never be called and need not exist. The type
* is unregistered, so has no need of a setFromAnyProc either.
*/
static const Tcl_ObjType endOffsetType = {
|
| ︙ | |||
724 725 726 727 728 729 730 | 726 727 728 729 730 731 732 733 734 735 736 737 738 739 | - |
*/
if ((openBraces == 0) && !inQuotes) {
size = (p - elemStart);
goto done;
}
}
break;
|
| ︙ | |||
942 943 944 945 946 947 948 | 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 | - - - + + + | * None. * *---------------------------------------------------------------------- */ Tcl_Size Tcl_ScanElement( |
| ︙ | |||
1032 1033 1034 1035 1036 1037 1038 | 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 | - + |
int forbidNone = 0; /* Do not permit CONVERT_NONE mode. Something
* needs protection or escape. */
int requireEscape = 0; /* Force use of CONVERT_ESCAPE mode. For some
* reason bare or brace-quoted form fails. */
Tcl_Size extra = 0; /* Count of number of extra bytes needed for
* formatted element, assuming we use escape
* sequences in formatting. */
|
| ︙ | |||
1079 1080 1081 1082 1083 1084 1085 | 1080 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 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 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 | - - - + + + - + - - - - + + + + - + - - - - - + + + + + - - - - - + + + + + - - - - + + + + - + - - - - - + + + + + - + - - - - - - - + + + + + + + - - - - - + + + + + - - - + + + - - - - - - - - - - - + + + + + + + + + + + - + - - - - - - - - - - - + + + + + + + + + + + - + - - - - + + + + |
forbidNone = 1;
#if COMPAT
preferBrace = 1;
#endif /* COMPAT */
}
while (length) {
|
| ︙ | |||
1319 1320 1321 1322 1323 1324 1325 | 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 | - - - + + + | * None. * *---------------------------------------------------------------------- */ Tcl_Size Tcl_ConvertElement( |
| ︙ | |||
1349 1350 1351 1352 1353 1354 1355 | 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 | - + | * None. * *---------------------------------------------------------------------- */ Tcl_Size Tcl_ConvertCountedElement( |
| ︙ | |||
1382 1383 1384 1385 1386 1387 1388 | 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 | - + | * None. * *---------------------------------------------------------------------- */ Tcl_Size TclConvertElement( |
| ︙ | |||
1563 1564 1565 1566 1567 1568 1569 | 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 | - + | * None. * *---------------------------------------------------------------------- */ char * Tcl_Merge( |
| ︙ | |||
1640 1641 1642 1643 1644 1645 1646 | 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 | - - - - - - - - + + + + + + + + | * None. * *---------------------------------------------------------------------- */ Tcl_Size TclTrimRight( |
| ︙ | |||
1719 1720 1721 1722 1723 1724 1725 | 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 | - - - - - - - - + + + + + + + + | * None. * *---------------------------------------------------------------------- */ Tcl_Size TclTrimLeft( |
| ︙ | |||
1793 1794 1795 1796 1797 1798 1799 | 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 1820 1821 | - - - - - - - - + + + + + + + + - | * None. * *---------------------------------------------------------------------- */ Tcl_Size TclTrim( |
| ︙ | |||
1855 1856 1857 1858 1859 1860 1861 | 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 | - + | */ /* The whitespace characters trimmed during [concat] operations */ #define CONCAT_WS_SIZE (sizeof(CONCAT_TRIM_SET "") - 1) char * Tcl_Concat( |
| ︙ | |||
2333 2334 2335 2336 2337 2338 2339 | 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 | - + - + |
*
*----------------------------------------------------------------------
*/
int
TclByteArrayMatch(
const unsigned char *string,/* String. */
|
| ︙ | |||
2613 2614 2615 2616 2617 2618 2619 | 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 | - |
Tcl_Panic("max size for a Tcl value (%" TCL_SIZE_MODIFIER
"d bytes) exceeded",
TCL_SIZE_MAX);
return NULL; /* NOTREACHED */
}
newSize = length + dsPtr->length + 1;
|
| ︙ | |||
2805 2806 2807 2808 2809 2810 2811 | 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 | - + |
*
*----------------------------------------------------------------------
*/
void
Tcl_DStringSetLength(
Tcl_DString *dsPtr, /* Structure describing dynamic string. */
|
| ︙ | |||
3228 3229 3230 3231 3232 3233 3234 | 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 | - - - - + + + + - + |
* Reconsider this if we ever start treating non-ASCII Unicode
* characters as meaningful list syntax, expanded Unicode spaces as
* element separators, for example.)
*
end = Tcl_UtfPrev(end, start);
while (*end == '{') {
|
| ︙ | |||
3294 3295 3296 3297 3298 3299 3300 | 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 | - + |
*----------------------------------------------------------------------
*/
Tcl_Size
TclFormatInt(
char *buffer, /* Points to the storage into which the
* formatted characters are written. */
|
| ︙ | |||
3356 3357 3358 3359 3360 3361 3362 | 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 | - + - - + + - - - + + + - + | * The type of *objPtr may change. * *---------------------------------------------------------------------- */ static int GetWideForIndex( |
| ︙ | |||
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 | - - - - + + + + |
if (indexPtr != NULL) {
/* Note: check against TCL_SIZE_MAX needed for 32-bit builds */
if (wide >= 0 && wide <= TCL_SIZE_MAX) {
*indexPtr = (Tcl_Size)wide; /* A valid index */
} else if (wide > TCL_SIZE_MAX) {
*indexPtr = TCL_SIZE_MAX; /* Beyond max possible index */
} else if (wide < -1-TCL_SIZE_MAX) {
|
| ︙ | |||
3491 3492 3493 3494 3495 3496 3497 | 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 | - - - - - + + + + + |
*
*----------------------------------------------------------------------
*/
static int
GetEndOffsetFromObj(
Tcl_Interp *interp,
|
| ︙ | |||
3528 3529 3530 3531 3532 3533 3534 | 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 | - - - + + + - + | /* * Quick scan to see if multi-value list is even possible. * This relies on TclGetString() returning a NUL-terminated string. */ if ((TclMaxListLength(bytes, TCL_INDEX_NONE, NULL) > 1) /* If it's possible, do the full list parse. */ |
| ︙ | |||
3694 3695 3696 3697 3698 3699 3700 | 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 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 | - + - + - - - - - - - - + + + + + + + + |
}
offset = irPtr->wideValue;
if (offset == WIDE_MAX) {
/*
* Encodes end+1. This is distinguished from end+n as noted
|
| ︙ | |||
3794 3795 3796 3797 3798 3799 3800 | 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 | - - - - - + + + + + | * to *indexPtr. * *---------------------------------------------------------------------- */ int TclIndexEncode( |
| ︙ | |||
3917 3918 3919 3920 3921 3922 3923 | 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 | - + - - + |
}
}
*indexPtr = idx;
return TCL_OK;
rangeerror:
if (interp) {
|
| ︙ | |||
3942 3943 3944 3945 3946 3947 3948 | 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 | - - + + | * The decoded index value. * *---------------------------------------------------------------------- */ Tcl_Size TclIndexDecode( |
| ︙ | |||
3972 3973 3974 3975 3976 3977 3978 | 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 | - - + + | * Side effects: * If interp is not-NULL, an error message is stored in it. * *------------------------------------------------------------------------ */ int TclCommandWordLimitError( |
| ︙ | |||
4039 4040 4041 4042 4043 4044 4045 | 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 | - - + + |
*----------------------------------------------------------------------
*/
static Tcl_HashTable *
GetThreadHash(
Tcl_ThreadDataKey *keyPtr)
{
|
| ︙ |
Changes to generic/tclVar.c.
| ︙ | |||
248 249 250 251 252 253 254 | 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | - + - + - - - + + + - + - + - + - - + + - - + + |
static const Tcl_ObjType localVarNameType = {
"localVarName",
FreeLocalVarName, DupLocalVarName, NULL, NULL,
TCL_OBJTYPE_V0
};
|
| ︙ | |||
527 528 529 530 531 532 533 | 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 | - + - + - + |
*
*----------------------------------------------------------------------
*/
Var *
TclObjLookupVar(
Tcl_Interp *interp, /* Interpreter to use for lookup. */
|
| ︙ | |||
587 588 589 590 591 592 593 | 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 | - + - + - + |
* parenthesized array element. */
Tcl_Obj *part2Ptr, /* Name of element within array, or NULL. */
int flags, /* Only TCL_GLOBAL_ONLY, TCL_NAMESPACE_ONLY,
* and TCL_LEAVE_ERR_MSG bits matter. */
const char *msg, /* Verb to use in error messages, e.g. "read"
* or "set". Only needed if TCL_LEAVE_ERR_MSG
* is set in flags. */
|
| ︙ | |||
823 824 825 826 827 828 829 | 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 | - + |
TclLookupSimpleVar(
Tcl_Interp *interp, /* Interpreter to use for lookup. */
Tcl_Obj *varNamePtr, /* This is a simple variable name that could
* represent a scalar or an array. */
int flags, /* Only TCL_GLOBAL_ONLY, TCL_NAMESPACE_ONLY,
* TCL_AVOID_RESOLVERS and TCL_LEAVE_ERR_MSG
* bits matter. */
|
| ︙ | |||
1056 1057 1058 1059 1060 1061 1062 | 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 | - + - + - + |
Var *
TclLookupArrayElement(
Tcl_Interp *interp, /* Interpreter to use for lookup. */
Tcl_Obj *arrayNamePtr, /* This is the name of the array, or NULL if
* index>= 0. */
Tcl_Obj *elNamePtr, /* Name of element within array. */
|
| ︙ | |||
1273 1274 1275 1276 1277 1278 1279 | 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 | - + - + |
*----------------------------------------------------------------------
*/
Tcl_Obj *
Tcl_ObjGetVar2(
Tcl_Interp *interp, /* Command interpreter in which variable is to
* be looked up. */
|
| ︙ | |||
1332 1333 1334 1335 1336 1337 1338 | 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 | - + |
Tcl_Var varPtr, /* The variable to be read.*/
Tcl_Var arrayPtr, /* NULL for scalar variables, pointer to the
* containing array otherwise. */
Tcl_Obj *part1Ptr, /* Name of an array (if part2 is non-NULL) or
* the name of a variable. */
Tcl_Obj *part2Ptr, /* If non-NULL, gives the name of an element
* in the array part1. */
|
| ︙ | |||
1371 1372 1373 1374 1375 1376 1377 | 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 | - + - + |
*----------------------------------------------------------------------
*/
Tcl_Obj *
TclPtrGetVarIdx(
Tcl_Interp *interp, /* Command interpreter in which variable is to
* be looked up. */
|
| ︙ | |||
1479 1480 1481 1482 1483 1484 1485 | 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 | - + |
*
*----------------------------------------------------------------------
*/
int
Tcl_SetObjCmd(
TCL_UNUSED(void *),
|
| ︙ | |||
1656 1657 1658 1659 1660 1661 1662 | 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 | - + - + |
*----------------------------------------------------------------------
*/
Tcl_Obj *
Tcl_ObjSetVar2(
Tcl_Interp *interp, /* Command interpreter in which variable is to
* be found. */
|
| ︙ | |||
1727 1728 1729 1730 1731 1732 1733 | 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 | - + |
* variable, or NULL if the variable is a
* scalar. */
Tcl_Obj *part1Ptr, /* Name of an array (if part2 is non-NULL) or
* the name of a variable. */
Tcl_Obj *part2Ptr, /* If non-NULL, gives the name of an element
* in the array part1. */
Tcl_Obj *newValuePtr, /* New value for variable. */
|
| ︙ | |||
1896 1897 1898 1899 1900 1901 1902 | 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 | - + - + |
*----------------------------------------------------------------------
*/
Tcl_Obj *
TclPtrSetVarIdx(
Tcl_Interp *interp, /* Command interpreter in which variable is to
* be looked up. */
|
| ︙ | |||
2165 2166 2167 2168 2169 2170 2171 | 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 | - + |
* array (if part2 is non-NULL) or the name of
* a variable. */
Tcl_Obj *part2Ptr, /* If non-null, points to an object holding
* the name of an element in the array
* part1Ptr. */
Tcl_Obj *incrPtr, /* Increment value. */
/* TODO: Which of these flag values really make sense? */
|
| ︙ | |||
2221 2222 2223 2224 2225 2226 2227 | 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 | - + |
* array (if part2 is non-NULL) or the name of
* a variable. */
Tcl_Obj *part2Ptr, /* If non-null, points to an object holding
* the name of an element in the array
* part1Ptr. */
Tcl_Obj *incrPtr, /* Increment value. */
/* TODO: Which of these flag values really make sense? */
|
| ︙ | |||
2410 2411 2412 2413 2414 2415 2416 | 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 | - + |
Tcl_Var varPtr, /* The variable to be unset. */
Tcl_Var arrayPtr, /* NULL for scalar variables, pointer to the
* containing array otherwise. */
Tcl_Obj *part1Ptr, /* Name of an array (if part2 is non-NULL) or
* the name of a variable. */
Tcl_Obj *part2Ptr, /* If non-NULL, gives the name of an element
* in the array part1. */
|
| ︙ | |||
2501 2502 2503 2504 2505 2506 2507 | 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 | - + |
/*
* It's an error to unset an undefined variable.
*/
if (result != TCL_OK) {
if (flags & TCL_LEAVE_ERR_MSG) {
TclObjVarErrMsg(interp, part1Ptr, part2Ptr, "unset",
|
| ︙ | |||
2609 2610 2611 2612 2613 2614 2615 | 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 | - - - - - - - - - - - - - + + + + + + + + + + + + + - + |
&dummyVar, &isNew);
Tcl_SetHashValue(tPtr, tracePtr);
}
}
if ((dummyVar.flags & VAR_TRACED_UNSET)
|| (arrayPtr && (arrayPtr->flags & VAR_TRACED_UNSET))) {
|
| ︙ | |||
2799 2800 2801 2802 2803 2804 2805 | 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 | - + - |
Tcl_AppendObjCmd(
TCL_UNUSED(void *),
Tcl_Interp *interp, /* Current interpreter. */
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
Var *varPtr, *arrayPtr;
|
| ︙ | |||
4297 4298 4299 4300 4301 4302 4303 | 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 | - + |
int objc,
Tcl_Obj *const objv[])
{
Var *varPtr, *varPtr2, *protectedVarPtr;
Tcl_Obj *varNameObj, *patternObj, *nameObj;
Tcl_HashSearch search;
const char *pattern;
|
| ︙ | |||
4476 4477 4478 4479 4480 4481 4482 | 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 | - + |
ObjMakeUpvar(
Tcl_Interp *interp, /* Interpreter containing variables. Used for
* error messages, too. */
CallFrame *framePtr, /* Call frame containing "other" variable.
* NULL means use global :: context. */
Tcl_Obj *otherP1Ptr,
const char *otherP2, /* Two-part name of variable in framePtr. */
|
| ︙ | |||
5333 5334 5335 5336 5337 5338 5339 | 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 | - + |
*
*----------------------------------------------------------------------
*/
static void
DeleteSearches(
Interp *iPtr,
|
| ︙ | |||
6802 6803 6804 6805 6806 6807 6808 | 6801 6802 6803 6804 6805 6806 6807 6808 6809 6810 6811 6812 6813 6814 6815 | - + |
VarHashRefCount(varPtr)--;
}
Tcl_DecrRefCount(objPtr);
}
static int
CompareVarKeys(
|
| ︙ | |||
6998 6999 7000 7001 7002 7003 7004 | 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 | - + + |
* Initialize array variable.
*/
void
TclInitArrayVar(
Var *arrayPtr)
{
|
| ︙ | |||
7082 7083 7084 7085 7086 7087 7088 | 7082 7083 7084 7085 7086 7087 7088 7089 7090 7091 7092 7093 7094 7095 7096 7097 7098 7099 7100 7101 7102 7103 7104 7105 | - - + + - - + + |
*
* array default set v 1
* lappend v(a) 2; # returns a new object {1 2}
* set v(b); # returns the original default object "1"
*/
if (tablePtr->defaultObj) {
|
Changes to generic/tclZipfs.c.
| ︙ | |||
97 98 99 100 101 102 103 | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - + + + + + + + + + + + + + - - + + + | * Various constants and offsets found in ZIP archive files */ #define ZIP_SIG_LEN 4 /* * Local header of ZIP archive member (at very beginning of each member). |
| ︙ | |||
192 193 194 195 196 197 198 | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | - + - + - + - - - + + + + + + |
unsigned char *data; /* Memory mapped or malloc'ed file */
size_t length; /* Length of memory mapped file */
void *ptrToFree; /* Non-NULL if malloc'ed file */
size_t numFiles; /* Number of files in archive */
size_t baseOffset; /* Archive start */
size_t passOffset; /* Password start */
size_t directoryOffset; /* Archive directory start */
|
| ︙ | |||
253 254 255 256 257 258 259 | 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | - - - + + + - + |
typedef struct ZipChannel {
ZipFile *zipFilePtr; /* The ZIP file holding this channel */
ZipEntry *zipEntryPtr; /* Pointer back to virtual file */
Tcl_Size maxWrite; /* Maximum size for write */
Tcl_Size numBytes; /* Number of bytes of uncompressed data */
Tcl_Size cursor; /* Seek position for next read or write*/
unsigned char *ubuf; /* Pointer to the uncompressed data */
|
| ︙ | |||
806 807 808 809 810 811 812 | 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 | - - - - - + + + + + + + | * Side effects: * On success, keys[] are updated. On failure, an error message is * left in interp if not NULL. * *------------------------------------------------------------------------ */ static int |
| ︙ | |||
869 870 871 872 873 874 875 | 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 | - + |
*-------------------------------------------------------------------------
*/
static char *
DecodeZipEntryText(
const unsigned char *inputBytes,
unsigned int inputLength,
|
| ︙ | |||
974 975 976 977 978 979 980 | 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 | - - - + + + + | * Results: * TCL_OK on success with normalized mount path in dsPtr * TCL_ERROR on fail with error message in interp if not NULL * *------------------------------------------------------------------------ */ static int |
| ︙ | |||
1061 1062 1063 1064 1065 1066 1067 | 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 | - - - - + + + + + - | * * Side effects: * Stores mapped path in dsPtr. * *------------------------------------------------------------------------ */ static char * |
| ︙ | |||
1434 1435 1436 1437 1438 1439 1440 | 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 | - + - |
if (!needZip) {
zf->baseOffset = zf->passOffset = zf->length;
return TCL_OK;
}
ZIPFS_ERROR(interp, "archive directory end signature not found");
ZIPFS_ERROR_CODE(interp, "END_SIG");
|
| ︙ | |||
1653 1654 1655 1656 1657 1658 1659 | 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 | - + |
*/
zf->length = Tcl_Seek(zf->chan, 0, SEEK_END);
if (zf->length == (size_t) TCL_INDEX_NONE) {
ZIPFS_POSIX_ERROR(interp, "seek error");
goto error;
}
|
| ︙ | |||
2223 2224 2225 2226 2227 2228 2229 | 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 | - + + + | * None. * * Side effects: * Memory associated with the mounted archive is deallocated. *------------------------------------------------------------------------ */ static void |
| ︙ | |||
2368 2369 2370 2371 2372 2373 2374 | 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 | - + |
ret = TCL_ERROR;
} else {
ret = ZipFSOpenArchive(interp, normPath, 1, zf);
if (ret != TCL_OK) {
Tcl_Free(zf);
} else {
ret = ZipFSCatalogFilesystem(
|
| ︙ | |||
2475 2476 2477 2478 2479 2480 2481 | 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 | - + |
}
ret = ZipFSFindTOC(interp, 1, zf);
if (ret != TCL_OK) {
Tcl_Free(zf);
} else {
/* Note ZipFSCatalogFilesystem will free zf on error */
ret = ZipFSCatalogFilesystem(
|
| ︙ | |||
3272 3273 3274 3275 3276 3277 3278 | 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 | - + |
static inline const char *
ComputeNameInArchive(
Tcl_Obj *pathObj, /* The path to the origin file */
Tcl_Obj *directNameObj, /* User-specified name for use in the ZIP
* archive */
const char *strip, /* A prefix to strip; may be NULL if no
* stripping need be done. */
|
| ︙ | |||
3348 3349 3350 3351 3352 3353 3354 | 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 | - - + + |
* there's no password protection. */
{
Tcl_Channel out;
int count, ret = TCL_ERROR;
Tcl_Size pwlen = 0, slen = 0, len, i = 0;
Tcl_Size lobjc;
long long directoryStartOffset;
|
| ︙ | |||
4391 4392 4393 4394 4395 4396 4397 | 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 | - - - + + + |
if (ZipChannelWritable(info)) {
/*
* Copy channel data back into original file in archive.
*/
ZipEntry *z = info->zipEntryPtr;
assert(info->ubufToFree && info->ubuf);
unsigned char *newdata;
|
| ︙ | |||
4568 4569 4570 4571 4572 4573 4574 | 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 | - - + + |
Tcl_Size needed = info->cursor + toWrite;
/* Tack on a bit for future growth. */
if (needed < (info->maxWrite - needed/2)) {
needed += needed / 2;
} else {
needed = info->maxWrite;
}
|
| ︙ | |||
5539 5540 5541 5542 5543 5544 5545 | 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 | - - + + - - + |
return -1;
}
if (types) {
wanted = types->type;
if ((wanted & TCL_GLOB_TYPE_MOUNT) && (wanted != TCL_GLOB_TYPE_MOUNT)) {
if (interp) {
ZIPFS_ERROR(interp,
|
| ︙ | |||
6511 6512 6513 6514 6515 6516 6517 | 6581 6582 6583 6584 6585 6586 6587 6588 6589 6590 6591 6592 6593 6594 6595 | - + |
*/
int
TclZipfs_Mount(
Tcl_Interp *interp, /* Current interpreter. */
TCL_UNUSED(const char *), /* Path to ZIP file to mount. */
TCL_UNUSED(const char *), /* Mount point path. */
|
| ︙ | |||
6548 6549 6550 6551 6552 6553 6554 | 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 | - + |
const char *
TclZipfs_AppHook(
TCL_UNUSED(int *), /*argcPtr*/
#ifdef _WIN32
TCL_UNUSED(WCHAR ***)) /* argvPtr */
#else /* !_WIN32 */
|
| ︙ |
Changes to generic/tclZlib.c.
| ︙ | |||
78 79 80 81 82 83 84 | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | + - + + |
* dictionary (not dictObj!) to use if
* necessary. */
int flags; /* Miscellaneous flag bits. */
GzipHeader *gzHeaderPtr; /* If we've allocated a gzip header
* structure. */
} ZlibStreamHandle;
enum ZlibStreamHandleFlags {
|
| ︙ | |||
126 127 128 129 130 131 132 | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | - - - - - - - - + + + + + + + + + + - - + - - - - - |
Tcl_TimerToken timer; /* Timer used for keeping events fresh. */
Tcl_Obj *compDictObj; /* Byte-array object containing compression
* dictionary (not dictObj!) to use if
* necessary. */
} ZlibChannelData;
/*
|
| ︙ | |||
210 211 212 213 214 215 216 | 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | - + |
ZlibTransformInput,
ZlibTransformOutput,
NULL, /* seekProc */
ZlibTransformSetOption,
ZlibTransformGetOption,
ZlibTransformWatch,
ZlibTransformGetHandle,
|
| ︙ | |||
440 441 442 443 444 445 446 447 448 449 450 451 452 453 | 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | + |
Tcl_Panic("no latin-1 encoding");
}
if (GetValue(interp, dictObj, "comment", &value) != TCL_OK) {
goto error;
} else if (value != NULL) {
Tcl_EncodingState state;
valueStr = TclGetStringFromObj(value, &length);
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) {
|
| ︙ | |||
1356 1357 1358 1359 1360 1361 1362 | 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 | - + |
*----------------------------------------------------------------------
*/
int
Tcl_ZlibStreamGet(
Tcl_ZlibStream zshandle, /* As obtained from Tcl_ZlibStreamInit */
Tcl_Obj *data, /* A place to append the data. */
|
| ︙ | |||
1838 1839 1840 1841 1842 1843 1844 | 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 | - + |
bufferSize = inLen;
}
}
TclNewObj(obj);
outData = Tcl_SetByteArrayLength(obj, bufferSize);
memset(&stream, 0, sizeof(z_stream));
|
| ︙ | |||
2230 2231 2232 2233 2234 2235 2236 | 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 | - + |
case CMD_STREAM: /* stream deflate/inflate/...gunzip \
* ?options...?
* -> handleCmd */
return ZlibStreamSubcmd(interp, objc, objv);
case CMD_PUSH: /* push mode channel options...
* -> channel */
return ZlibPushSubcmd(interp, objc, objv);
|
| ︙ | |||
2747 2748 2749 2750 2751 2752 2753 | 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 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 | - + - + - + - - + + - - + + |
for (i=2; i<objc-1; i++) {
if (Tcl_GetIndexFromObj(interp, objv[i], add_options, "option", 0,
&index) != TCL_OK) {
return TCL_ERROR;
}
switch (index) {
|
| ︙ | |||
2874 2875 2876 2877 2878 2879 2880 | 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 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 | - + - + - + - - + + |
for (i=2; i<objc-1; i++) {
if (Tcl_GetIndexFromObj(interp, objv[i], put_options, "option", 0,
&index) != TCL_OK) {
return TCL_ERROR;
}
switch (index) {
|
| ︙ | |||
3151 3152 3153 3154 3155 3156 3157 | 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 | - - + |
* 2. Got an error (readBytes == -1) which we should report up except
* for the case where we can convert it to a short read.
* 3. Got an end-of-data from EOF or blocking (readBytes == 0). If
* it is EOF, try flushing the data out of the decompressor.
*/
if (readBytes == -1) {
|
| ︙ | |||
3344 3345 3346 3347 3348 3349 3350 | 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 | - + | * * Writing side of [fconfigure] on our channel. * *---------------------------------------------------------------------- */ static int |
| ︙ | |||
3869 3870 3871 3872 3873 3874 3875 | 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 | - - |
int toRead,
int flush,
int *errorCodePtr)
{
int e, written, resBytes = 0;
Tcl_Obj *errObj;
|
| ︙ |
Changes to macosx/tclMacOSXFCmd.c.
| ︙ | |||
80 81 82 83 84 85 86 | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | - - - - - + + + + + |
static int GetOSTypeFromObj(Tcl_Interp *interp,
Tcl_Obj *objPtr, OSType *osTypePtr);
static Tcl_Obj * NewOSTypeObj(const OSType newOSType);
static int SetOSTypeFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr);
static void UpdateStringOfOSType(Tcl_Obj *objPtr);
static const Tcl_ObjType tclOSTypeType = {
|
| ︙ | |||
128 129 130 131 132 133 134 | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | - - - - + + + + | * A new object is allocated. * *---------------------------------------------------------------------- */ int TclMacOSXGetFileAttribute( |
| ︙ | |||
687 688 689 690 691 692 693 | 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 | - + | * OSType-to-string conversion. * *---------------------------------------------------------------------- */ static void UpdateStringOfOSType( |
| ︙ |
Changes to macosx/tclMacOSXNotify.c.
| ︙ | |||
307 308 309 310 311 312 313 | 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | - + |
int mask; /* Mask of desired events: TCL_READABLE,
* etc. */
int readyMask; /* Mask of events that have been seen since
* the last time file handlers were invoked
* for this file. */
Tcl_FileProc *proc; /* Function to call, in the style of
* Tcl_CreateFileHandler. */
|
| ︙ | |||
1110 1111 1112 1113 1114 1115 1116 | 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 | - + |
int fd, /* Handle of stream to watch. */
int mask, /* OR'ed combination of TCL_READABLE,
* TCL_WRITABLE, and TCL_EXCEPTION: indicates
* conditions under which proc should be
* called. */
Tcl_FileProc *proc, /* Function to call for each selected
* event. */
|
| ︙ | |||
1904 1905 1906 1907 1908 1909 1910 | 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 | - + |
*----------------------------------------------------------------------
*/
int
TclAsyncNotifier(
int sigNumber, /* Signal number. */
TCL_UNUSED(Tcl_ThreadId), /* Target thread. */
|
| ︙ |
Changes to unix/tclAppInit.c.
| ︙ | |||
25 26 27 28 29 30 31 | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | - + | #ifdef TCL_TEST extern Tcl_LibraryInitProc Tcltest_Init; extern Tcl_LibraryInitProc Tcltest_SafeInit; #endif /* TCL_TEST */ #ifdef TCL_XT_TEST |
| ︙ |
Changes to unix/tclEpollNotfy.c.
| ︙ | |||
38 39 40 41 42 43 44 | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | - + |
int mask; /* Mask of desired events: TCL_READABLE,
* etc. */
int readyMask; /* Mask of events that have been seen since
* the last time file handlers were invoked
* for this file. */
Tcl_FileProc *proc; /* Function to call, in the style of
* Tcl_CreateFileHandler. */
|
| ︙ | |||
222 223 224 225 226 227 228 | 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - |
* files belonging to tsdPtr.
*/
if (TclOSfstat(filePtr->fd, &fdStat) == -1) {
Tcl_Panic("fstat: %s", strerror(errno));
}
|
| ︙ | |||
509 510 511 512 513 514 515 | 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 | - + |
int fd, /* Handle of stream to watch. */
int mask, /* OR'ed combination of TCL_READABLE,
* TCL_WRITABLE, and TCL_EXCEPTION: indicates
* conditions under which proc should be
* called. */
Tcl_FileProc *proc, /* Function to call for each selected
* event. */
|
| ︙ | |||
787 788 789 790 791 792 793 | 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 | - + |
*----------------------------------------------------------------------
*/
int
TclAsyncNotifier(
int sigNumber, /* Signal number. */
Tcl_ThreadId threadId, /* Target thread. */
|
| ︙ |
Changes to unix/tclKqueueNotfy.c.
| ︙ | |||
36 37 38 39 40 41 42 | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | - + |
int mask; /* Mask of desired events: TCL_READABLE,
* etc. */
int readyMask; /* Mask of events that have been seen since
* the last time file handlers were invoked
* for this file. */
Tcl_FileProc *proc; /* Function to call, in the style of
* Tcl_CreateFileHandler. */
|
| ︙ | |||
181 182 183 184 185 186 187 | 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | - + - |
* with regular files belonging to tsdPtr.
*/
if (TclOSfstat(filePtr->fd, &fdStat) == -1) {
Tcl_Panic("fstat: %s", strerror(errno));
} else if ((fdStat.st_mode & S_IFMT) == S_IFREG
|| (fdStat.st_mode & S_IFMT) == S_IFDIR
|
| ︙ | |||
514 515 516 517 518 519 520 | 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 | - + |
int fd, /* Handle of stream to watch. */
int mask, /* OR'ed combination of TCL_READABLE,
* TCL_WRITABLE, and TCL_EXCEPTION: indicates
* conditions under which proc should be
* called. */
Tcl_FileProc *proc, /* Function to call for each selected
* event. */
|
| ︙ | |||
783 784 785 786 787 788 789 | 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 | - + |
*----------------------------------------------------------------------
*/
int
TclAsyncNotifier(
int sigNumber, /* Signal number. */
Tcl_ThreadId threadId, /* Target thread. */
|
| ︙ |
Changes to unix/tclLoadAix.c.
| ︙ | |||
244 245 246 247 248 249 250 | 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | - + |
char *s)
{
char *p = s;
while (*p >= '0' && *p <= '9') {
p++;
}
|
| ︙ |
Changes to unix/tclLoadDl.c.
| ︙ | |||
184 185 186 187 188 189 190 | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | - + - + |
*/
if (Tcl_UtfToExternalDStringEx(interp, NULL, symbol, TCL_INDEX_NONE, 0, &ds, NULL) != TCL_OK) {
Tcl_DStringFree(&ds);
return NULL;
}
native = Tcl_DStringValue(&ds);
|
| ︙ |
Changes to unix/tclLoadDyld.c.
| ︙ | |||
100 101 102 103 104 105 106 | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | - + | * *---------------------------------------------------------------------- */ #if TCL_DYLD_USE_NSMODULE || defined(TCL_LOAD_FROM_MEMORY) static const char * DyldOFIErrorMsg( |
| ︙ | |||
144 145 146 147 148 149 150 | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | - + |
*/
MODULE_SCOPE int
TclpDlopen(
Tcl_Interp *interp, /* Used for error reporting. */
Tcl_Obj *pathPtr, /* Name of the file containing the desired
* code (UTF-8). */
|
| ︙ | |||
544 545 546 547 548 549 550 | 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 | - + |
Tcl_Interp *interp, /* Used for error reporting. */
void *buffer, /* Buffer containing the desired code
* (allocated with TclpLoadMemoryGetBuffer). */
int size, /* Allocation size of buffer. */
int codeSize, /* Size of code data read into buffer or -1 if
* an error occurred and the buffer should
* just be freed. */
|
| ︙ | |||
579 580 581 582 583 584 585 | 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 | - + | # define mh_magic MH_MAGIC # define arch_abi 0 #else const struct mach_header_64 *mh = NULL; # define mh_size sizeof(struct mach_header_64) # define mh_magic MH_MAGIC_64 # define arch_abi CPU_ARCH_ABI64 |
| ︙ |
Changes to unix/tclLoadNext.c.
| ︙ | |||
132 133 134 135 136 137 138 | 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | - - - + + + | * interp's result. * *---------------------------------------------------------------------- */ static void * FindSymbol( |
| ︙ |
Changes to unix/tclLoadOSF.c.
| ︙ | |||
125 126 127 128 129 130 131 | 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | - + |
* impossible to get a package name given a module.
*
* I build loadable modules with a makefile rule like
* ld ... -export $@: -o $@ $(OBJS)
*/
if ((pkg = strrchr(fileName, '/')) == NULL) {
|
| ︙ | |||
157 158 159 160 161 162 163 | 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | - - - + + + | * interp's result. * *---------------------------------------------------------------------- */ static void * FindSymbol( |
| ︙ |
Changes to unix/tclLoadShl.c.
| ︙ | |||
121 122 123 124 125 126 127 | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | - + - - - + + + | * Returns a pointer to the function associated with 'symbol' if it is * found. Otherwise returns NULL and may leave an error message in the * interp's result. * *---------------------------------------------------------------------- */ |
| ︙ |
Changes to unix/tclSelectNotfy.c.
| ︙ | |||
28 29 30 31 32 33 34 | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | - + |
int mask; /* Mask of desired events: TCL_READABLE,
* etc. */
int readyMask; /* Mask of events that have been seen since
* the last time file handlers were invoked
* for this file. */
Tcl_FileProc *proc; /* Function to call, in the style of
* Tcl_CreateFileHandler. */
|
| ︙ | |||
176 177 178 179 180 181 182 | 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | - - - + + + + + - - - - + + + + - - + - - | * terminates. This condition is used to deal with the signal mask, too. */ static pthread_cond_t notifierCV = PTHREAD_COND_INITIALIZER; /* * The pollState bits: |
| ︙ | |||
476 477 478 479 480 481 482 | 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 | - + |
int fd, /* Handle of stream to watch. */
int mask, /* OR'ed combination of TCL_READABLE,
* TCL_WRITABLE, and TCL_EXCEPTION: indicates
* conditions under which proc should be
* called. */
Tcl_FileProc *proc, /* Function to call for each selected
* event. */
|
| ︙ | |||
639 640 641 642 643 644 645 | 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 | - + | * Queues file events that are detected by the select. * *---------------------------------------------------------------------- */ int TclpWaitForEvent( |
| ︙ | |||
917 918 919 920 921 922 923 | 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 | - + |
*----------------------------------------------------------------------
*/
int
TclAsyncNotifier(
int sigNumber, /* Signal number. */
TCL_UNUSED(Tcl_ThreadId), /* Target thread. */
|
| ︙ |
Changes to unix/tclUnixChan.c.
| ︙ | |||
158 159 160 161 162 163 164 | 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | - + - + - + - + - + |
/*
* This structure describes the channel type structure for file based IO:
*/
static const Tcl_ChannelType fileChannelType = {
"file", /* Type name. */
TCL_CHANNEL_VERSION_5, /* v5 channel */
|
| ︙ | |||
221 222 223 224 225 226 227 | 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | - + | * Sets the device into blocking or non-blocking mode. * *---------------------------------------------------------------------- */ static int FileBlockModeProc( |
| ︙ | |||
254 255 256 257 258 259 260 | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | - + | * Reads input from the input device of the channel. * *---------------------------------------------------------------------- */ static int FileInputProc( |
| ︙ | |||
304 305 306 307 308 309 310 | 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | - + | * Writes output on the output device of the channel. * *---------------------------------------------------------------------- */ static int FileOutputProc( |
| ︙ | |||
351 352 353 354 355 356 357 | 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | - + | * Closes the device of the channel. * *---------------------------------------------------------------------- */ static int FileCloseProc( |
| ︙ | |||
444 445 446 447 448 449 450 | 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | - + | * operations. * *---------------------------------------------------------------------- */ static long long FileWideSeekProc( |
| ︙ | |||
492 493 494 495 496 497 498 | 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 | - + |
{
Tcl_Channel channel = (Tcl_Channel)clientData;
Tcl_NotifyChannel(channel, mask);
}
static void
FileWatchProc(
|
| ︙ | |||
532 533 534 535 536 537 538 | 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 | - + - + | * None. * *---------------------------------------------------------------------- */ static int FileGetHandleProc( |
| ︙ | |||
769 770 771 772 773 774 775 | 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 | - + | * calling Tcl_BadChannelOption). * *---------------------------------------------------------------------- */ static int TtySetOptionProc( |
| ︙ | |||
1109 1110 1111 1112 1113 1114 1115 | 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 | - + | * (by calling Tcl_BadChannelOption). * *---------------------------------------------------------------------- */ static int TtyGetOptionProc( |
| ︙ | |||
1626 1627 1628 1629 1630 1631 1632 | 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 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 | - + - - - - + - + - + |
TtyAttrs *ttyPtr) /* Filled with data from mode string */
{
int i, end;
char parity;
const char *bad = "bad value for -mode";
i = sscanf(mode, "%d,%c,%d,%d%n",
|
| ︙ | |||
2065 2066 2067 2068 2069 2070 2071 | 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 | - + |
const char *chanID, /* String that identifies file. */
int forWriting, /* 1 means the file is going to be used for
* writing, 0 means for reading. */
TCL_UNUSED(int), /* Obsolete argument.
* Ignored, we always check that
* the channel is open for the requested
* mode. */
|
| ︙ |
Changes to unix/tclUnixCompat.c.
| ︙ | |||
30 31 32 33 34 35 36 | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | - + | * This macro assumes that the pointer 'buffer' was created from an aligned * pointer by adding the 'length'. If this 'length' was not a multiple of the * 'size' the result is unaligned and PadBuffer corrects both the pointer, * _and_ the 'length'. The latter means that future increments of 'buffer' by * 'length' stay aligned. */ |
| ︙ | |||
955 956 957 958 959 960 961 | 955 956 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 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 | - - - - - - - - - - + + + - - - - - + + + + + + - - - - - + + + + + - + |
memcpy(buf, src, len);
}
return len;
}
#endif /* NEED_COPYSTRING */
|
Changes to unix/tclUnixFCmd.c.
| ︙ | |||
51 52 53 54 55 56 57 | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | + - - - + + + + |
#endif
/*
* The following constants specify the type of callback when
* TraverseUnixTree() calls the traverseProc()
*/
enum TraverseUnixTreeType {
|
| ︙ | |||
765 766 767 768 769 770 771 | 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 | - - + + |
Tcl_DecrRefCount(transPtr);
}
if (ret != TCL_OK) {
*errorPtr = srcPathPtr;
} else {
transPtr = Tcl_FSGetTranslatedPath(NULL,destPathPtr);
ret = Tcl_UtfToExternalDStringEx(NULL, NULL,
|
| ︙ | |||
1245 1246 1247 1248 1249 1250 1251 | 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 | - |
TCL_UNUSED(Tcl_DString *),
TCL_UNUSED(const Tcl_StatBuf *),
int type, /* Reason for call - see TraverseUnixTree(). */
Tcl_DString *errorPtr) /* If non-NULL, uninitialized or free DString
* filled with UTF-8 name of file causing
* error. */
{
|
| ︙ | |||
1288 1289 1290 1291 1292 1293 1294 | 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 | - + | * *--------------------------------------------------------------------------- */ static int CopyFileAtts( #ifdef MAC_OSX_TCL |
| ︙ | |||
1762 1763 1764 1765 1766 1767 1768 | 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 | - + |
*
*----------------------------------------------------------------------
*/
static int
GetModeFromPermString(
TCL_UNUSED(Tcl_Interp *),
|
| ︙ | |||
2484 2485 2486 2487 2488 2489 2490 | 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 | - - - - + + + + | * The readonly attribute of the file is changed. * *--------------------------------------------------------------------------- */ static int SetUnixFileAttributes( |
| ︙ |
Changes to unix/tclUnixFile.c.
| ︙ | |||
320 321 322 323 324 325 326 | 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | - + |
|| !S_ISDIR(statBuf.st_mode)) {
Tcl_DStringFree(&dsOrig);
Tcl_DStringFree(&ds);
Tcl_DecrRefCount(fileNamePtr);
return TCL_OK;
}
|
| ︙ | |||
434 435 436 437 438 439 440 | 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | - - - - + + + + | * None. * *---------------------------------------------------------------------- */ static int NativeMatchType( |
| ︙ |
Changes to unix/tclUnixInit.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 | - - - - - + + + + + - + - - - - - + + + + + |
static const char *const processors[NUMPROCESSORS] = {
"i686", "mips", "alpha", "ppc", "shx", "arm", "ia64", "alpha64", "msil",
"x86_64", "ia32_on_win64", "neutral", "arm64", "arm32_on_win64", "ia32_on_arm64"
};
typedef struct {
union {
|
| ︙ | |||
321 322 323 324 325 326 327 | 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | - + - | static int MacOSXGetLibraryPath(Tcl_Interp *interp, int maxPathLen, char *tclLibPath); #endif /* HAVE_COREFOUNDATION */ #if defined(__APPLE__) && (defined(TCL_LOAD_FROM_MEMORY) || ( \ defined(MAC_OS_X_VERSION_MIN_REQUIRED) && ( \ (TCL_THREADS && MAC_OS_X_VERSION_MIN_REQUIRED < 1030) || \ (defined(__LP64__) && MAC_OS_X_VERSION_MIN_REQUIRED < 1050) || \ |
| ︙ | |||
857 858 859 860 861 862 863 | 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 | - - - + + + - - - - - + + + + + |
p = q+1;
}
if (*p) {
Tcl_ListObjAppendElement(NULL, pkgListObj, Tcl_NewStringObj(p, -1));
}
Tcl_ObjSetVar2(interp, Tcl_NewStringObj("tcl_pkgPath", -1), NULL, pkgListObj, TCL_GLOBAL_ONLY);
{
|
| ︙ |
Changes to unix/tclUnixNotfy.c.
| ︙ | |||
209 210 211 212 213 214 215 | 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | - + | * None. * *---------------------------------------------------------------------- */ void TclpSetTimer( |
| ︙ | |||
414 415 416 417 418 419 420 | 414 415 416 417 418 419 420 421 422 423 424 425 426 427 | - |
* notifier lists)
* atForkInit == 0: InitNotifier was never called
* notifierCount != 0: unbalanced InitNotifier() / FinalizeNotifier calls
* waitingListPtr != 0: there are threads currently waiting for events.
*/
if (atForkInit == 1) {
|
| ︙ |
Changes to unix/tclUnixPipe.c.
| ︙ | |||
76 77 78 79 80 81 82 | 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | - + - + |
* This structure describes the channel type structure for command pipe based
* I/O:
*/
static const Tcl_ChannelType pipeChannelType = {
"pipe", /* Type name. */
TCL_CHANNEL_VERSION_5, /* v5 channel */
|
| ︙ | |||
352 353 354 355 356 357 358 | 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | - + | * The file is closed. * *---------------------------------------------------------------------- */ int TclpCloseFile( |
| ︙ | |||
397 398 399 400 401 402 403 | 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | - + |
int
TclpCreateProcess(
Tcl_Interp *interp, /* Interpreter in which to leave errors that
* occurred when creating the child process.
* Error messages from the child process
* itself are sent to errorFile. */
|
| ︙ | |||
999 1000 1001 1002 1003 1004 1005 | 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 | - + | * Sets the device into blocking or non-blocking mode. * *---------------------------------------------------------------------- */ static int PipeBlockModeProc( |
| ︙ | |||
1039 1040 1041 1042 1043 1044 1045 | 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 | - + | * Closes the command pipeline channel. * *---------------------------------------------------------------------- */ static int PipeClose2Proc( |
| ︙ | |||
1136 1137 1138 1139 1140 1141 1142 | 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 | - + | * Reads input from the input device of the channel. * *---------------------------------------------------------------------- */ static int PipeInputProc( |
| ︙ | |||
1187 1188 1189 1190 1191 1192 1193 | 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 | - + | * Writes output on the output device of the channel. * *---------------------------------------------------------------------- */ static int PipeOutputProc( |
| ︙ | |||
1246 1247 1248 1249 1250 1251 1252 | 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 | - + |
{
Tcl_Channel channel = (Tcl_Channel)clientData;
Tcl_NotifyChannel(channel, mask);
}
static void
PipeWatchProc(
|
| ︙ | |||
1294 1295 1296 1297 1298 1299 1300 | 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 | - + - + | * None. * *---------------------------------------------------------------------- */ static int PipeGetHandleProc( |
| ︙ |
Changes to unix/tclUnixPort.h.
| ︙ | |||
683 684 685 686 687 688 689 | 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 | - + | MODULE_SCOPE struct passwd * TclpGetPwNam(const char *name); MODULE_SCOPE struct group * TclpGetGrNam(const char *name); MODULE_SCOPE struct passwd * TclpGetPwUid(uid_t uid); MODULE_SCOPE struct group * TclpGetGrGid(gid_t gid); MODULE_SCOPE struct hostent * TclpGetHostByName(const char *name); MODULE_SCOPE struct hostent * TclpGetHostByAddr(const char *addr, int length, int type); |
| ︙ |
Changes to unix/tclUnixSock.c.
| ︙ | |||
19 20 21 22 23 24 25 | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | - - + + | */ #define SET_BITS(var, bits) ((var) |= (bits)) #define CLEAR_BITS(var, bits) ((var) &= ~(bits)) #define GOT_BITS(var, bits) (((var) & (bits)) != 0) /* "sock" + a pointer in hex + \0 */ |
| ︙ | |||
60 61 62 63 64 65 66 | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | - - + + - - - - + + + + + - - - + + + - - - - + + + - - - - + + + + |
int interest; /* Event types of interest */
/*
* Only needed for server sockets
*/
Tcl_TcpAcceptProc *acceptProc;
|
| ︙ | |||
152 153 154 155 156 157 158 | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | - + - + |
* This structure describes the channel type structure for TCP socket
* based IO:
*/
static const Tcl_ChannelType tcpChannelType = {
"tcp", /* Type name. */
TCL_CHANNEL_VERSION_5, /* v5 channel */
|
| ︙ | |||
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 255 256 257 258 259 260 | - + - + - + - + |
#ifndef NO_UNAME
struct utsname u;
struct hostent *hp;
memset(&u, (int) 0, sizeof(struct utsname));
if (uname(&u) >= 0) { /* INTL: Native. */
|
| ︙ | |||
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 378 379 380 381 | - + - - + + | * Sets the device into blocking or nonblocking mode. * * ---------------------------------------------------------------------- */ static int TcpBlockModeProc( |
| ︙ | |||
439 440 441 442 443 444 445 | 439 440 441 442 443 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 | - - + + - + - + - - - - + + + + - - - - + + + + - - - - - - - + + + + + + + |
* In socket test mode do not continue with the connect.
* Exceptions are:
* - Call by recv/send and blocking socket
* (errorCodePtr != NULL && !GOT_BITS(flags, TCP_NONBLOCKING))
*/
if (GOT_BITS(statePtr->flags, TCP_ASYNC_TEST_MODE)
|
| ︙ | |||
498 499 500 501 502 503 504 | 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 | - + | * Reads input from the input device of the channel. * *---------------------------------------------------------------------- */ static int TcpInputProc( |
| ︙ | |||
549 550 551 552 553 554 555 | 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 | - + | * Writes output on the output device of the channel. * *---------------------------------------------------------------------- */ static int TcpOutputProc( |
| ︙ | |||
590 591 592 593 594 595 596 | 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 | - + | * Closes the socket of the channel. * *---------------------------------------------------------------------- */ static int TcpCloseProc( |
| ︙ | |||
613 614 615 616 617 618 619 | 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 | - - + - + |
if (fds->fd < 0) {
continue;
}
Tcl_DeleteFileHandler(fds->fd);
if (close(fds->fd) < 0) {
errorCode = errno;
}
|
| ︙ | |||
651 652 653 654 655 656 657 | 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 | - + | * Shuts down one side of the socket. * *---------------------------------------------------------------------- */ static int TcpClose2Proc( |
| ︙ | |||
702 703 704 705 706 707 708 | 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 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 | - + - + - + - + - - - + + + - - - + + + - - + + - - - - + + + + - + - - - + + + - + |
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif
static inline int
IPv6AddressNeedsNumericRendering(
struct in6_addr addr)
{
if (IN6_ARE_ADDR_EQUAL(&addr, &in6addr_any)) {
|
| ︙ | |||
903 904 905 906 907 908 909 | 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 | - - - - + + + + - - - - - - + + + + + + - - - - - + + + + + - + - + - - + + |
}
if ((len > 1) && (optionName[1] == 'e') &&
(strncmp(optionName, "-error", len) == 0)) {
socklen_t optlen = sizeof(int);
WaitForConnect(statePtr, NULL);
|
| ︙ | |||
959 960 961 962 963 964 965 | 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 | - + - - - + + + - + |
* Peername fetch succeeded - output list
*/
if (len == 0) {
Tcl_DStringAppendElement(dsPtr, "-peername");
Tcl_DStringStartSublist(dsPtr);
}
|
| ︙ | |||
1000 1001 1002 1003 1004 1005 1006 | 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 | - + - - - - - - - - - - + + + + + + + + + + |
Tcl_DStringStartSublist(dsPtr);
}
if (GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT)) {
/*
* In async connect output an empty string
*/
|
| ︙ | |||
1066 1067 1068 1069 1070 1071 1072 | 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 | - + |
if (len > 0) {
return TCL_OK;
}
}
if (len > 0) {
return Tcl_BadChannelOption(interp, optionName,
|
| ︙ | |||
1165 1166 1167 1168 1169 1170 1171 | 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 | - + - - - - - + + + + + - - - - + + + + - + - |
newmask = TCL_WRITABLE;
}
Tcl_NotifyChannel(statePtr->channel, newmask);
}
static void
TcpWatchProc(
|
| ︙ | |||
1238 1239 1240 1241 1242 1243 1244 | 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 | - + - + | * None. * * ---------------------------------------------------------------------- */ static int TcpGetHandleProc( |
| ︙ | |||
1262 1263 1264 1265 1266 1267 1268 | 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 | - + | * attempt has succeeded or failed. * * ---------------------------------------------------------------------- */ static void TcpAsyncCallback( |
| ︙ | |||
1310 1311 1312 1313 1314 1315 1316 | 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 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 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 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 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 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 1470 1471 1472 1473 1474 1475 1476 | - + - - - - + + + + - - - - + + + + - + - + - + - - - - - - + + + + + + - - - - + + + + - + - - - - - - - - + + + + + + + + - - - - + + + + - - - - - - + + + + + + - - - + + + - - - - - - + + + + + + - + - - - - + + + + - - - + + + - - + + - - - + + + - - - - - - - - + + + + + + + + - - - - - + + + + + - - - - - - + + + + + + |
socklen_t optlen;
int async_callback = GOT_BITS(statePtr->flags, TCP_ASYNC_PENDING);
int ret = -1, error = EHOSTUNREACH;
int async = GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT);
static const int reuseaddr = 1;
if (async_callback) {
|
| ︙ | |||
1507 1508 1509 1510 1511 1512 1513 | 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 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 | - - - - - - - - - - + + + + + + + + + + - - + + - + |
char channelName[SOCK_CHAN_LENGTH];
/*
* Do the name lookups for the local and remote addresses.
*/
if (!TclCreateSocketAddress(interp, &addrlist, host, port, 0, &errorMsg)
|
| ︙ | |||
1570 1571 1572 1573 1574 1575 1576 | 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 | - + - + | * None. * *---------------------------------------------------------------------- */ Tcl_Channel Tcl_MakeTcpClientChannel( |
| ︙ | |||
1595 1596 1597 1598 1599 1600 1601 | 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 | - + | * None. * *---------------------------------------------------------------------- */ void * TclpMakeTcpClientChannelMode( |
| ︙ | |||
1642 1643 1644 1645 1646 1647 1648 | 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 | - + |
Tcl_Channel
Tcl_OpenTcpServerEx(
Tcl_Interp *interp, /* For error reporting - may be NULL. */
const char *service, /* Port number to open. */
const char *myHost, /* Name of local host. */
unsigned int flags, /* Flags. */
|
| ︙ | |||
1680 1681 1682 1683 1684 1685 1686 | 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 | - - - - - - - - - - - + + + + + + + + + + + - + - + |
*/
int retry = 0;
#define MAXRETRY 10
repeat:
if (retry > 0) {
|
| ︙ | |||
1756 1757 1758 1759 1760 1761 1762 | 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 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 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 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 | - - - - - - - + + + + + + + - + - - + + - - + + - - - + + + - + - - - - - - - - - - + + + + + + + + + + - - - - + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - + + + + - + - + - - - + + + - + | #else optvalue = 1; (void) setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, (char *) &optvalue, sizeof(optvalue)); #endif } |
| ︙ | |||
1896 1897 1898 1899 1900 1901 1902 | 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 | - + - + + | * connection acceptance mechanism. * *---------------------------------------------------------------------- */ static void TcpAccept( |
| ︙ | |||
1934 1935 1936 1937 1938 1939 1940 | 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 | - + - + |
newSockState, TCL_READABLE | TCL_WRITABLE);
Tcl_SetChannelOption(NULL, newSockState->channel, "-translation",
"auto crlf");
if (fds->statePtr->acceptProc != NULL) {
getnameinfo(&addr.sa, len, host, sizeof(host), port, sizeof(port),
|
Changes to unix/tclUnixTest.c.
| ︙ | |||
308 309 310 311 312 313 314 | 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | - + |
return TCL_ERROR;
}
return TCL_OK;
}
static void
TestFileHandlerProc(
|
| ︙ | |||
607 608 609 610 611 612 613 | 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 | - + - + |
*
*---------------------------------------------------------------------------
*/
static int
TestchmodCmd(
TCL_UNUSED(void *),
|
| ︙ |
Changes to unix/tclUnixThrd.c.
| ︙ | |||
209 210 211 212 213 214 215 | 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | - - + + |
*----------------------------------------------------------------------
*/
int
TclpThreadCreate(
Tcl_ThreadId *idPtr, /* Return, the ID of the thread */
Tcl_ThreadCreateProc *proc, /* Main() function of the thread */
|
| ︙ | |||
668 669 670 671 672 673 674 | 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 | - + |
*----------------------------------------------------------------------
*/
void
Tcl_ConditionWait(
Tcl_Condition *condPtr, /* Really (pthread_cond_t **) */
Tcl_Mutex *mutexPtr, /* Really (PMutex **) */
|
| ︙ | |||
704 705 706 707 708 709 710 | 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 | - + | /* * Make sure to take into account the microsecond component of the * current time, including possible overflow situations. [Bug #411603] */ Tcl_GetTime(&now); ptime.tv_sec = timePtr->sec + now.sec + |
| ︙ | |||
835 836 837 838 839 840 841 | 835 836 837 838 839 840 841 842 843 844 845 846 847 848 | - | /* * Called by TclFinalizeThreadAllocThread() during the thread * finalization initiated from Tcl_FinalizeThread() */ TclFreeAllocCache(ptr); pthread_setspecific(key, NULL); |
| ︙ |
Changes to unix/tclXtNotify.c.
| ︙ | |||
29 30 31 32 33 34 35 | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | - + |
* time FileHandlerEventProc was called for
* this file. */
XtInputId read; /* Xt read callback handle. */
XtInputId write; /* Xt write callback handle. */
XtInputId except; /* Xt exception callback handle. */
Tcl_FileProc *proc; /* Procedure to call, in the style of
* Tcl_CreateFileHandler. */
|
| ︙ | |||
259 260 261 262 263 264 265 | 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | - + | * Replaces any previous timer. * *---------------------------------------------------------------------- */ static void SetTimer( |
| ︙ | |||
335 336 337 338 339 340 341 | 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | - + |
int fd, /* Handle of stream to watch. */
int mask, /* OR'ed combination of TCL_READABLE,
* TCL_WRITABLE, and TCL_EXCEPTION: indicates
* conditions under which proc should be
* called. */
Tcl_FileProc *proc, /* Procedure to call for each selected
* event. */
|
| ︙ | |||
623 624 625 626 627 628 629 | 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 | - + | * Queues file events that are detected by the select. * *---------------------------------------------------------------------- */ static int WaitForEvent( |
| ︙ |
Changes to win/tclWin32Dll.c.
| ︙ | |||
428 429 430 431 432 433 434 | 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 | - - + + | * instruction in the four integers designated by 'regsPtr' * *---------------------------------------------------------------------- */ int TclWinCPUID( |
| ︙ |
Changes to win/tclWinChan.c.
| ︙ | |||
13 14 15 16 17 18 19 | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | + - - - + + + + + - - + + + |
#include "tclWinInt.h"
#include "tclIO.h"
/*
* State flags used in the info structures below.
*/
enum FileInfoFlags {
|
| ︙ | |||
104 105 106 107 108 109 110 | 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | - + - + - + |
/*
* This structure describes the channel type structure for file based IO.
*/
static const Tcl_ChannelType fileChannelType = {
"file", /* Type name. */
TCL_CHANNEL_VERSION_5, /* v5 channel */
|
| ︙ | |||
381 382 383 384 385 386 387 | 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | - + | * Sets the device into blocking or non-blocking mode. * *---------------------------------------------------------------------- */ static int FileBlockProc( |
| ︙ | |||
420 421 422 423 424 425 426 | 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 | - + | * Closes the physical channel * *---------------------------------------------------------------------- */ static int FileCloseProc( |
| ︙ | |||
470 471 472 473 474 475 476 | 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 | - + | /* * This channel exists on the thread local list. It should have * been removed by an earlier Threadaction call, but do that now * since just deallocating fileInfoPtr would leave an deallocated * pointer on the thread local list. */ |
| ︙ | |||
498 499 500 501 502 503 504 | 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 | - + | * operations. * *---------------------------------------------------------------------- */ static long long FileWideSeekProc( |
| ︙ | |||
550 551 552 553 554 555 556 | 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 | - + | * Truncates the file, may move file pointers too. * *---------------------------------------------------------------------- */ static int FileTruncateProc( |
| ︙ | |||
626 627 628 629 630 631 632 | 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 | - + | * Reads input from the actual channel. * *---------------------------------------------------------------------- */ static int FileInputProc( |
| ︙ | |||
681 682 683 684 685 686 687 | 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 | - + | * Writes output on the actual channel. * *---------------------------------------------------------------------- */ static int FileOutputProc( |
| ︙ | |||
728 729 730 731 732 733 734 | 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 | - + | * None. * *---------------------------------------------------------------------- */ static void FileWatchProc( |
| ︙ | |||
767 768 769 770 771 772 773 | 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 | - + - + | * None. * *---------------------------------------------------------------------- */ static int FileGetHandleProc( |
| ︙ | |||
917 918 919 920 921 922 923 | 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 | - + |
#undef STORE_ELEM
return dictObj;
}
static int
FileGetOptionProc(
|
| ︙ | |||
1215 1216 1217 1218 1219 1220 1221 | 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 | - + | * None. * *---------------------------------------------------------------------- */ Tcl_Channel Tcl_MakeFileChannel( |
| ︙ |
Changes to win/tclWinConsole.c.
| ︙ | |||
90 91 92 93 94 95 96 | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | - - - - + + + + |
#endif
/*
* Ring buffer for storing data. Actual data is from bufPtr[start]:bufPtr[size-1]
* and bufPtr[0]:bufPtr[length - (size-start)].
*/
typedef struct RingBuffer {
|
| ︙ | |||
121 122 123 124 125 126 127 | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | - - - - - - + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + - - + + + + |
*
* Note on reference counting - a ConsoleHandleInfo instance has multiple
* references to it - one each from every channel that is attached to it
* plus one from the console thread itself which also serves as the reference
* from gConsoleHandleInfoList.
*/
typedef struct ConsoleHandleInfo {
|
| ︙ | |||
179 180 181 182 183 184 185 | 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 | - + + + + - - - + + + - + |
HANDLE handle; /* Console handle */
Tcl_ThreadId threadId; /* Id of owning thread */
struct ConsoleChannelInfo *nextWatchingChannelPtr;
/* Pointer to next channel watching events. */
Tcl_Channel channel; /* Pointer to channel structure. */
DWORD initMode; /* Initial console mode. */
int numRefs; /* See comments above */
|
| ︙ | |||
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 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 | - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + | * stdout and stderr), and contention low. More finer-grained locking would * likely not only complicate implementation but be slower due to multiple * locks being held. Note console channels also differ from other Tcl * channel types in that the channel<->OS descriptor mapping is not one-to-one. */ SRWLOCK gConsoleLock; |
| ︙ | |||
409 410 411 412 413 414 415 | 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 | - + + - + + |
/* Copy only as much as free space allows */
srcLen = freeSpace;
}
if (ringPtr->capacity - ringPtr->start > ringPtr->length) {
/* There is room at the back */
Tcl_Size endSpaceStart = ringPtr->start + ringPtr->length;
|
| ︙ | |||
728 729 730 731 732 733 734 735 736 737 738 739 740 741 | 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 | + |
*------------------------------------------------------------------------
*/
static void
NudgeWatchers(
HANDLE consoleHandle)
{
ConsoleChannelInfo *chanInfoPtr;
AcquireSRWLockShared(&gConsoleLock); /* Shared-read lock */
for (chanInfoPtr = gWatchingChannelList; chanInfoPtr;
chanInfoPtr = chanInfoPtr->nextWatchingChannelPtr) {
/*
* Notify channels interested in our handle AND that have
* a thread attached.
* No lock needed for chanInfoPtr. See ConsoleChannelInfo.
|
| ︙ | |||
969 970 971 972 973 974 975 | 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 | - + | * Closes the physical channel. * *---------------------------------------------------------------------- */ static int ConsoleCloseProc( |
| ︙ | |||
1302 1303 1304 1305 1306 1307 1308 | 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 | - + | * (3) when there are an odd number of bytes since WriteConsole * takes whole WCHARs * (4) when the pointer is not aligned on WCHAR * The ring buffer deals with cases (3) and (4). It would be harder * to duplicate that here. */ if ((chanInfoPtr->flags & CONSOLE_ASYNC) /* Case (1) */ |
| ︙ | |||
1654 1655 1656 1657 1658 1659 1660 | 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 1693 | - + |
* - the console handle has been closed
*/
/* This thread is holding a reference so pointer is safe */
AcquireSRWLockExclusive(&handleInfoPtr->lock);
while (1) {
|
| ︙ | |||
1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 | 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 | + |
* input. So only do so if at least one interpreter has requested
* data.
*/
if (lastReadSize == sizeof(inputChars)
|| ((handleInfoPtr->flags & CONSOLE_DATA_AWAITED)
&& ConsoleDataAvailable(handleInfoPtr->console))) {
DWORD error;
/* Do not hold the lock while blocked in console */
ReleaseSRWLockExclusive(&handleInfoPtr->lock);
error = ReadConsoleChars(handleInfoPtr->console,
(WCHAR *)inputChars, sizeof(inputChars) / sizeof(WCHAR),
&inputLen);
AcquireSRWLockExclusive(&handleInfoPtr->lock);
if (error == 0) {
|
| ︙ | |||
1845 1846 1847 1848 1849 1850 1851 | 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 | - + |
BOOL success;
Tcl_Size numBytes;
/*
* This buffer size has no relation really with the size of the shared
* buffer. Could be bigger or smaller. Make larger as multiple threads
* could potentially be writing to it.
*/
|
| ︙ | |||
1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 | 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 | + + |
if (handleInfoPtr->numRefs == 1) {
/*
* Sole reference. That's this thread. Exit since no clients
* and no buffered output.
*/
break;
}
/* Wake up any threads waiting synchronously. */
WakeConditionVariable(&handleInfoPtr->interpThreadCV);
success = SleepConditionVariableSRW(&handleInfoPtr->consoleThreadCV,
&handleInfoPtr->lock, INFINITE, 0);
/* Note: lock has been acquired again! */
if (!success && GetLastError() != ERROR_TIMEOUT) {
/* TODO - what can be done? Should not happen */
/* For now keep going */
}
continue;
}
|
| ︙ | |||
1920 1921 1922 1923 1924 1925 1926 | 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 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 | + + - + + - + + |
/* Only overwrite if no previous error */
if (handleInfoPtr->lastError == 0) {
handleInfoPtr->lastError = status;
}
if (status == ERROR_INVALID_HANDLE) {
handleInfoPtr->console = INVALID_HANDLE_VALUE;
}
/*
|
| ︙ | |||
1997 1998 1999 2000 2001 2002 2003 | 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 | - + |
* is placed on the active console handler list gConsoleHandleInfoList.
*
*------------------------------------------------------------------------
*/
static ConsoleHandleInfo *
AllocateConsoleHandleInfo(
HANDLE consoleHandle,
|
| ︙ | |||
2020 2021 2022 2023 2024 2025 2026 | 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 | - - - - - - + + + + + + + |
GetConsoleMode(consoleHandle, &handleInfoPtr->initMode);
consoleMode = handleInfoPtr->initMode;
consoleMode &= ~(ENABLE_WINDOW_INPUT | ENABLE_MOUSE_INPUT);
consoleMode |= ENABLE_LINE_INPUT;
SetConsoleMode(consoleHandle, consoleMode);
}
handleInfoPtr->consoleThread = CreateThread(
|
| ︙ | |||
2064 2065 2066 2067 2068 2069 2070 | 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 | + - + - + + | * * Side effects: * None. * *------------------------------------------------------------------------ */ static ConsoleHandleInfo * FindConsoleInfo( |
| ︙ | |||
2254 2255 2256 2257 2258 2259 2260 | 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 | - + | * May modify an option on a console. Sets Error message if needed (by * calling Tcl_BadChannelOption). * *---------------------------------------------------------------------- */ static int ConsoleSetOptionProc( |
| ︙ | |||
2343 2344 2345 2346 2347 2348 2349 | 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 | - + | * (by calling Tcl_BadChannelOption). * *---------------------------------------------------------------------- */ static int ConsoleGetOptionProc( |
| ︙ |
Changes to win/tclWinDde.c.
| ︙ | |||
80 81 82 83 84 85 86 | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | + - - - + + + + |
static int ddeIsServer = 0;
#define TCL_DDE_VERSION "1.4.5"
#define TCL_DDE_PACKAGE_NAME "dde"
#define TCL_DDE_SERVICE_NAME L"TclEval"
#define TCL_DDE_EXECUTE_RESULT L"$TCLEVAL$EXECUTE$RESULT"
enum TclDdeFlags {
|
| ︙ | |||
306 307 308 309 310 311 312 | 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | - + - + |
*
*----------------------------------------------------------------------
*/
static const WCHAR *
DdeSetServerName(
Tcl_Interp *interp,
|
| ︙ | |||
511 512 513 514 515 516 517 | 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 | - + | * The interpreter given by riPtr is unregistered. * *---------------------------------------------------------------------- */ static void DeleteProc( |
| ︙ | |||
564 565 566 567 568 569 570 | 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 | - - + + | * happen. * *---------------------------------------------------------------------- */ static Tcl_Obj * ExecuteRemoteObject( |
| ︙ | |||
1252 1253 1254 1255 1256 1257 1258 | 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 | - + | * The interp's result object is changed. * *---------------------------------------------------------------------- */ static void SetDdeError( |
| ︙ | |||
1299 1300 1301 1302 1303 1304 1305 | 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 | - + - + | * See the user documentation. * *---------------------------------------------------------------------- */ static int DdeObjCmd( |
| ︙ | |||
1651 1652 1653 1654 1655 1656 1657 | 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 | - - - + + + |
if ((tmp >= sizeof(WCHAR))
&& !dataString[tmp / sizeof(WCHAR) - 1]) {
tmp -= (DWORD)sizeof(WCHAR);
}
Tcl_DStringInit(&dsBuf);
Tcl_WCharToUtfDString(dataString, tmp>>1, &dsBuf);
|
| ︙ |
Changes to win/tclWinFCmd.c.
| ︙ | |||
13 14 15 16 17 18 19 | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | + - - - - + + + + + |
#include "tclWinInt.h"
/*
* The following constants specify the type of callback when
* TraverseWinTree() calls the traverseProc()
*/
enum TraversalNodeType {
|
| ︙ | |||
46 47 48 49 50 51 52 | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | - + + - |
WIN_HIDDEN_ATTRIBUTE,
WIN_LONGNAME_ATTRIBUTE,
WIN_READONLY_ATTRIBUTE,
WIN_SHORTNAME_ATTRIBUTE,
WIN_SYSTEM_ATTRIBUTE
};
|
| ︙ | |||
385 386 387 388 389 390 391 | 387 388 389 390 391 392 393 394 395 396 397 398 399 400 | - | /* * Other types of access failure is that dst is a read-only * filesystem, that an open file referred to src or dest, or that src * or dest specified the current working directory on the current * filesystem. EACCES is returned for those cases. */ |
| ︙ | |||
430 431 432 433 434 435 436 | 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 | - + |
goto decode;
}
}
} else { /* (dstAttr & FILE_ATTRIBUTE_DIRECTORY) == 0 */
Tcl_SetErrno(ENOTDIR);
}
|
| ︙ | |||
1118 1119 1120 1121 1122 1123 1124 | 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 | - |
for (; *p; ++p) {
if (*p == '\\') {
*p = '/';
}
}
}
return TCL_ERROR;
|
| ︙ | |||
2026 2027 2028 2029 2030 2031 2032 | 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 | - + |
*/
baseLen = Tcl_DStringLength(&base);
do {
char tempbuf[SUFFIX_LENGTH + 1];
int i;
static const char randChars[] =
|
| ︙ |
Changes to win/tclWinFile.c.
| ︙ | |||
12 13 14 15 16 17 18 | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | - + - + | * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tclWinInt.h" #include "tclFileSystem.h" #include <winioctl.h> #include <shlobj.h> |
| ︙ | |||
281 282 283 284 285 286 287 | 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | - |
/*
* We've got a directory. Now check whether what we're trying to do is
* reasonable.
*/
if (linkAction & TCL_CREATE_SYMBOLIC_LINK) {
return WinSymLinkDirectory(linkSourcePath, linkTargetPath);
|
| ︙ | |||
339 340 341 342 343 344 345 | 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | - |
if (attr == INVALID_FILE_ATTRIBUTES) {
/*
* The source doesn't exist.
*/
Tcl_WinConvertError(GetLastError());
return NULL;
|
| ︙ | |||
1246 1247 1248 1249 1250 1251 1252 | 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 | - - |
} else if ((path[2] == 'n' || path[2] == 'N') && path[3] == '\0') {
/*
* Have match for 'con'
*/
return 3;
}
|
| ︙ | |||
1355 1356 1357 1358 1359 1360 1361 | 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 | - |
if ((types->type & TCL_GLOB_TYPE_DIR)
&& (attr & FILE_ATTRIBUTE_DIRECTORY)) {
/*
* Quicker test for directory, which is a common case.
*/
return 1;
|
| ︙ | |||
1434 1435 1436 1437 1438 1439 1440 | 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 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 1470 1471 | - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + |
Tcl_DStringInit(bufferPtr);
wDomain = NULL;
domain = Tcl_UtfFindFirst(name, '@');
if (domain == NULL) {
const char *ptr;
|
| ︙ | |||
1828 1829 1830 1831 1832 1833 1834 | 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 | - |
HeapFree(GetProcessHeap(), 0, sdPtr);
CloseHandle(hToken);
if (!accessYesNo) {
Tcl_SetErrno(EACCES);
return -1;
}
|
| ︙ | |||
1889 1890 1891 1892 1893 1894 1895 | 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 | - + | * See chdir() documentation. * *---------------------------------------------------------------------- */ int TclpObjChdir( |
| ︙ | |||
2055 2056 2057 2058 2059 2060 2061 | 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 | - + - + - + - + |
if (GetFileInformationByHandle(fileHandle,&data) != TRUE) {
fileType = GetFileType(fileHandle);
CloseHandle(fileHandle);
if (fileType != FILE_TYPE_CHAR && fileType != FILE_TYPE_DISK) {
Tcl_SetErrno(ENOENT);
return -1;
|
| ︙ | |||
2516 2517 2518 2519 2520 2521 2522 | 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 | - + - + |
*
*---------------------------------------------------------------------------
*/
int
TclpObjNormalizePath(
TCL_UNUSED(Tcl_Interp *),
|
| ︙ | |||
3276 3277 3278 3279 3280 3281 3282 | 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 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 | - + - + - - + + - + - + |
int owned = 0;
native = (const WCHAR *)Tcl_FSGetNativePath(pathPtr);
if (GetNamedSecurityInfoW((LPWSTR) native, SE_FILE_OBJECT,
OWNER_SECURITY_INFORMATION, &ownerSid, NULL, NULL, NULL,
&secd) != ERROR_SUCCESS) {
|
Changes to win/tclWinInit.c.
| ︙ | |||
512 513 514 515 516 517 518 | 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 | - - - - - - - - + + + + + + + + |
if (ptr != NULL) {
Tcl_DStringAppend(&ds, ptr, TCL_INDEX_NONE);
}
if (Tcl_DStringLength(&ds) > 0) {
Tcl_SetVar2(interp, "env", "HOME", Tcl_DStringValue(&ds),
TCL_GLOBAL_ONLY);
} else {
|
| ︙ | |||
566 567 568 569 570 571 572 | 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 | - + |
*----------------------------------------------------------------------
*/
Tcl_Size
TclpFindVariable(
const char *name, /* Name of desired environment variable
* (UTF-8). */
|
| ︙ |
Changes to win/tclWinInt.h.
| ︙ | |||
71 72 73 74 75 76 77 | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | - + - - - - - - - - + + + + + + + |
typedef struct TclPipeThreadInfo {
HANDLE evControl; /* Auto-reset event used by the main thread to
* signal when the pipe thread should attempt
* to do read/write operation. Additionally
* used as signal to stop (state set to -1) */
volatile LONG state; /* Indicates current state of the thread */
|
| ︙ |
Changes to win/tclWinLoad.c.
| ︙ | |||
86 87 88 89 90 91 92 | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | - - - - - + + + + + - + - - - - - - + + + + + + - - - - + + + + | * Let the OS loader examine the binary search path for whatever * string the user gave us which hopefully refers to a file on the * binary path. */ Tcl_DString ds; |
| ︙ | |||
153 154 155 156 157 158 159 | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | - + - - - + + + + | " is damaged", TCL_INDEX_NONE); break; case ERROR_DLL_INIT_FAILED: Tcl_SetErrorCode(interp, "WIN_LOAD", "DLL_INIT_FAILED", (char *)NULL); Tcl_AppendToObj(errMsg, "the library initialization" " routine failed", TCL_INDEX_NONE); break; |
| ︙ | |||
197 198 199 200 201 202 203 | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | - - - + + + | * interp's result. * *---------------------------------------------------------------------- */ static void * FindSymbol( |
| ︙ |
Changes to win/tclWinNotify.c.
| ︙ | |||
15 16 17 18 19 20 21 | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | + - - + + + |
/*
* The following static indicates whether this module has been initialized.
*/
#define INTERVAL_TIMER 1 /* Handle of interval timer. */
enum NotifierMessageIds {
|
| ︙ | |||
144 145 146 147 148 149 150 | 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | - + | * May dispose of the notifier window and class. * *---------------------------------------------------------------------- */ void TclpFinalizeNotifier( |
| ︙ | |||
214 215 216 217 218 219 220 | 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | - + | * isn't already one pending. * *---------------------------------------------------------------------- */ void TclpAlertNotifier( |
| ︙ | |||
260 261 262 263 264 265 266 | 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | - + | * Replaces any previous timer. * *---------------------------------------------------------------------- */ void TclpSetTimer( |
| ︙ | |||
366 367 368 369 370 371 372 | 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | - + - + |
*----------------------------------------------------------------------
*/
int
TclAsyncNotifier(
TCL_UNUSED(int), /* Signal number. */
TCL_UNUSED(Tcl_ThreadId), /* Target thread. */
|
| ︙ | |||
460 461 462 463 464 465 466 | 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 | - + | * Dispatches a message to a window procedure, which could do anything. * *---------------------------------------------------------------------- */ int TclpWaitForEvent( |
| ︙ |
Changes to win/tclWinPipe.c.
| ︙ | |||
27 28 29 30 31 32 33 | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | - - - - - + + + + + + + - + + | TCL_DECLARE_MUTEX(pipeMutex) /* * The following defines identify the various types of applications that run * under windows. There is special case code for the various types. */ |
| ︙ | |||
64 65 66 67 68 69 70 | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | - + + - - - + + + - - - - - - - + + + |
int dwProcessId;
struct ProcInfo *nextPtr;
} ProcInfo;
static ProcInfo *procList;
/*
|
| ︙ | |||
109 110 111 112 113 114 115 | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | - |
Tcl_ThreadId threadId; /* Thread to which events should be reported.
* This value is used by the reader/writer
* threads. */
TclPipeThreadInfo *writeTI; /* Thread info of writer and reader, this */
TclPipeThreadInfo *readTI; /* structure owned by corresponding thread. */
HANDLE writeThread; /* Handle to writer thread. */
HANDLE readThread; /* Handle to reader thread. */
|
| ︙ | |||
199 200 201 202 203 204 205 | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | - + - + |
* This structure describes the channel type structure for command pipe based
* I/O.
*/
static const Tcl_ChannelType pipeChannelType = {
"pipe", /* Type name. */
TCL_CHANNEL_VERSION_5, /* v5 channel */
|
| ︙ | |||
912 913 914 915 916 917 918 | 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 | - + |
int
TclpCreateProcess(
Tcl_Interp *interp, /* Interpreter in which to leave errors that
* occurred when creating the child process.
* Error messages from the child process
* itself are sent to errorFile. */
|
| ︙ | |||
1537 1538 1539 1540 1541 1542 1543 | 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 | - + |
return special;
}
static void
BuildCommandLine(
const char *executable, /* Full path of executable (including
* extension). Replacement for argv[0]. */
|
| ︙ | |||
1600 1601 1602 1603 1604 1605 1606 | 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 | - - + + |
*start != '\0' &&
(quote & (CL_ESCAPE|CL_QUOTE)) != (CL_ESCAPE|CL_QUOTE);
start++) {
if (*start & 0x80) {
continue;
}
if (TclIsSpaceProc(*start)) {
|
| ︙ | |||
1802 1803 1804 1805 1806 1807 1808 | 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 | - - + + - - + + |
if (readFile != NULL) {
/*
* Start the background reader thread.
*/
infoPtr->readable = CreateEventW(NULL, TRUE, TRUE, NULL);
infoPtr->readThread = CreateThread(NULL, 256, PipeReaderThread,
|
| ︙ | |||
1954 1955 1956 1957 1958 1959 1960 | 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 | - + | * Sets the device into blocking or non-blocking mode. * *---------------------------------------------------------------------- */ static int PipeBlockModeProc( |
| ︙ | |||
1993 1994 1995 1996 1997 1998 1999 | 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 | - + | * Closes the physical channel. * *---------------------------------------------------------------------- */ static int PipeClose2Proc( |
| ︙ | |||
2015 2016 2017 2018 2019 2020 2021 | 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 | - - - + - - - |
/*
* Clean up the background thread if necessary. Note that this must be
* done before we can close the file, since the thread may be blocking
* trying to read from the pipe.
*/
if (pipePtr->readThread) {
|
| ︙ | |||
2164 2165 2166 2167 2168 2169 2170 | 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 | - + | * Reads input from the actual channel. * *---------------------------------------------------------------------- */ static int PipeInputProc( |
| ︙ | |||
2258 2259 2260 2261 2262 2263 2264 | 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 | - + | * Writes output on the actual channel. * *---------------------------------------------------------------------- */ static int PipeOutputProc( |
| ︙ | |||
2332 2333 2334 2335 2336 2337 2338 | 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 | - |
}
}
return bytesWritten;
error:
*errorCode = errno;
return -1;
|
| ︙ | |||
2440 2441 2442 2443 2444 2445 2446 | 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 | - + | * None. * *---------------------------------------------------------------------- */ static void PipeWatchProc( |
| ︙ | |||
2502 2503 2504 2505 2506 2507 2508 | 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 | - + - + | * None. * *---------------------------------------------------------------------- */ static int PipeGetHandleProc( |
| ︙ | |||
3232 3233 3234 3235 3236 3237 3238 | 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 | - - + + |
const WCHAR *baseStr = L"TCL";
length = 3 * sizeof(WCHAR);
memcpy(namePtr, baseStr, length);
namePtr += length;
}
counter = TclpGetClicks() % 65533;
|
| ︙ |
Changes to win/tclWinPort.h.
| ︙ | |||
200 201 202 203 204 205 206 | 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | - + | #ifndef ENOSTR # define ENOSTR 125 /* Not a stream device */ #endif #ifndef ENOTCONN # define ENOTCONN 126 /* Socket is not connected */ #endif #ifndef ENOTRECOVERABLE |
| ︙ | |||
241 242 243 244 245 246 247 | 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | - | #endif #ifndef ETXTBSY # define ETXTBSY 139 /* Text file or pseudo-device busy */ #endif #ifndef EWOULDBLOCK # define EWOULDBLOCK 140 /* Operation would block */ #endif |
| ︙ | |||
411 412 413 414 415 416 417 | 410 411 412 413 414 415 416 417 418 419 420 421 422 423 | - | # ifdef S_IFLNK # define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) # else # define S_ISLNK(m) 0 # endif #endif /* !S_ISLNK */ |
| ︙ | |||
519 520 521 522 523 524 525 | 517 518 519 520 521 522 523 524 525 526 527 528 529 530 | - | #define TclpSysFree(ptr) (HeapFree(GetProcessHeap(), \ 0, (HGLOBAL)ptr)) #define TclpSysRealloc(ptr, size) ((void*)HeapReAlloc(GetProcessHeap(), \ 0, (LPVOID)ptr, size)) /* This type is not defined in the Windows headers */ #define socklen_t int |
| ︙ |
Changes to win/tclWinReg.c.
| ︙ | |||
49 50 51 52 53 54 55 | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | + - + + |
#define SWAPLONG(x) MAKELONG(SWAPWORD(HIWORD(x)), SWAPWORD(LOWORD(x)))
/*
* The following flag is used in OpenKeys to indicate that the specified key
* should be created if it doesn't currently exist.
*/
enum TclRegFlags {
|
| ︙ | |||
289 290 291 292 293 294 295 | 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | - + - + | * None. * *---------------------------------------------------------------------- */ static int RegistryObjCmd( |
| ︙ | |||
382 383 384 385 386 387 388 | 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 | - + | HKEY key; /* * Create the key and then close it immediately. */ mode |= KEY_ALL_ACCESS; |
| ︙ | |||
1203 1204 1205 1206 1207 1208 1209 | 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 | - + + |
REGSAM mode) /* Mode flags to pass. */
{
DWORD result, size;
Tcl_DString subkey;
HKEY hKey;
REGSAM saveMode = mode;
static int checkExProc = 0;
|
| ︙ | |||
1425 1426 1427 1428 1429 1430 1431 | 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 | - + |
*
*----------------------------------------------------------------------
*/
static int
BroadcastValue(
Tcl_Interp *interp, /* Current interpreter. */
|
| ︙ |
Changes to win/tclWinSerial.c.
| ︙ | |||
29 30 31 32 33 34 35 | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | + - - + + - - - - - - - + + - - - - + + + + - - - + + + + + |
TCL_DECLARE_MUTEX(serialMutex)
/*
* Bit masks used in the flags field of the SerialInfo structure below.
*/
enum SerialInfoFlags {
|
| ︙ | |||
81 82 83 84 85 86 87 | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | - + + |
int watchMask; /* OR'ed combination of TCL_READABLE,
* TCL_WRITABLE, or TCL_EXCEPTION: indicates
* which events should be reported. */
int flags; /* State flags, see above for a list. */
int readable; /* Flag that the channel is readable. */
int writable; /* Flag that the channel is writable. */
int blockTime; /* Maximum blocktime in msec. */
|
| ︙ | |||
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 | - + - + - + |
* This structure describes the channel type structure for command serial
* based IO.
*/
static const Tcl_ChannelType serialChannelType = {
"serial", /* Type name. */
TCL_CHANNEL_VERSION_5, /* v5 channel */
|
| ︙ | |||
557 558 559 560 561 562 563 | 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 | - + | * Sets the device into blocking or non-blocking mode. * *---------------------------------------------------------------------- */ static int SerialBlockProc( |
| ︙ | |||
596 597 598 599 600 601 602 | 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 | - + - | * Closes the physical channel. * *---------------------------------------------------------------------- */ static int SerialCloseProc( |
| ︙ | |||
851 852 853 854 855 856 857 | 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 | - + | * Reads input from the actual channel. * *---------------------------------------------------------------------- */ static int SerialInputProc( |
| ︙ | |||
958 959 960 961 962 963 964 | 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 | - + | * Writes output on the actual channel. * *---------------------------------------------------------------------- */ static int SerialOutputProc( |
| ︙ | |||
1041 1042 1043 1044 1045 1046 1047 | 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 | - | infoPtr->writeBuf = (char *)Tcl_Alloc(toWrite); } memcpy(infoPtr->writeBuf, buf, toWrite); infoPtr->toWrite = toWrite; ResetEvent(infoPtr->evWritable); TclPipeThreadSignal(&infoPtr->writeTI); bytesWritten = (DWORD) toWrite; |
| ︙ | |||
1188 1189 1190 1191 1192 1193 1194 | 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 | - + | * None. * *---------------------------------------------------------------------- */ static void SerialWatchProc( |
| ︙ | |||
1245 1246 1247 1248 1249 1250 1251 | 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 | - + - + | * None. * *---------------------------------------------------------------------- */ static int SerialGetHandleProc( |
| ︙ | |||
1476 1477 1478 1479 1480 1481 1482 | 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 | - |
* are shared between multiple channels (stdin/stdout).
*/
TclWinGenerateChannelName(channelName, "file", infoPtr);
infoPtr->channel = Tcl_CreateChannel(&serialChannelType, channelName,
infoPtr, permissions);
|
| ︙ | |||
1608 1609 1610 1611 1612 1613 1614 | 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 | - + | * May modify an option on a device. * *---------------------------------------------------------------------- */ static int SerialSetOptionProc( |
| ︙ | |||
2032 2033 2034 2035 2036 2037 2038 | 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 | - + | * reused at any time subsequent to the call. * *---------------------------------------------------------------------- */ static int SerialGetOptionProc( |
| ︙ |
Changes to win/tclWinSock.c.
| ︙ | |||
58 59 60 61 62 63 64 | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | - + - + + - - - - - + + + + + + + + + | * Helper macros to make parts of this file clearer. The macros do exactly * what they say on the tin. :-) They also only ever refer to their arguments * once, and so can be used without regard to side effects. */ #define SET_BITS(var, bits) ((var) |= (bits)) #define CLEAR_BITS(var, bits) ((var) &= ~(bits)) |
| ︙ | |||
146 147 148 149 150 151 152 | 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | - + + - - - + + + - - + - - + - - - - + + + - - - - + + + + |
*/
struct addrinfo *addrlist; /* Addresses to connect to. */
struct addrinfo *addr; /* Iterator over addrlist. */
struct addrinfo *myaddrlist;/* Local address. */
struct addrinfo *myaddr; /* Iterator over myaddrlist. */
int connectError; /* Cache status of async socket. */
|
| ︙ | |||
197 198 199 200 201 202 203 | 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | - - + - | /* * This defines the minimum buffersize maintained by the kernel. */ #define TCP_BUFFER_SIZE 4096 |
| ︙ | |||
260 261 262 263 264 265 266 | 261 262 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 303 304 305 306 307 308 309 310 311 312 | - + - + + - - - - + + + + + + + + |
* This structure describes the channel type structure for TCP socket
* based IO:
*/
static const Tcl_ChannelType tcpChannelType = {
"tcp", /* Type name. */
TCL_CHANNEL_VERSION_5, /* v5 channel */
|
| ︙ | |||
354 355 356 357 358 359 360 | 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | - |
Tcl_DStringInit(&ds);
if (GetComputerNameExW(ComputerNamePhysicalDnsFullyQualified, wbuf, &length) != 0) {
/*
* Convert string from native to UTF then change to lowercase.
*/
Tcl_UtfToLower(Tcl_WCharToUtfDString(wbuf, TCL_INDEX_NONE, &ds));
|
| ︙ | |||
445 446 447 448 449 450 451 | 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | - - - - + + + + |
* OK, this thread has never done anything with sockets before. Construct
* a worker thread to handle asynchronous events related to sockets
* assigned to _this_ thread.
*/
tsdPtr = TCL_TSD_INIT(&dataKey);
tsdPtr->pendingTcpState = NULL;
|
| ︙ | |||
503 504 505 506 507 508 509 | 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 | - + + |
*
*----------------------------------------------------------------------
*/
void
TclpFinalizeSockets(void)
{
|
| ︙ | |||
558 559 560 561 562 563 564 | 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 | - + | * Sets the device into blocking or nonblocking mode. * *---------------------------------------------------------------------- */ static int TcpBlockModeProc( |
| ︙ | |||
642 643 644 645 646 647 648 | 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 | - + |
* - Call by recv/send and blocking socket
* (errorCodePtr != NULL && !GOT_BITS(flags, TCP_NONBLOCKING))
* - Call by the event queue (errorCodePtr == NULL)
*/
if (GOT_BITS(statePtr->flags, TCP_ASYNC_TEST_MODE)
&& errorCodePtr != NULL
|
| ︙ | |||
735 736 737 738 739 740 741 | 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 | - - - + + + |
if (errorCodePtr != NULL) {
*errorCodePtr = ENOTCONN;
}
return -1;
}
|
| ︙ | |||
789 790 791 792 793 794 795 | 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 | - + | * Reads input from the input device of the channel. * *---------------------------------------------------------------------- */ static int TcpInputProc( |
| ︙ | |||
880 881 882 883 884 885 886 | 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 | - + | } /* * Check for error condition or underflow in non-blocking case. */ if (GOT_BITS(statePtr->flags, TCP_NONBLOCKING) |
| ︙ | |||
922 923 924 925 926 927 928 | 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 | - + | * Produces output on the socket. * *---------------------------------------------------------------------- */ static int TcpOutputProc( |
| ︙ | |||
1026 1027 1028 1029 1030 1031 1032 | 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 | - + | * Closes the socket. * *---------------------------------------------------------------------- */ static int TcpCloseProc( |
| ︙ | |||
1112 1113 1114 1115 1116 1117 1118 | 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 | - + | * Shuts down one side of the socket. * *---------------------------------------------------------------------- */ static int TcpClose2Proc( |
| ︙ | |||
1162 1163 1164 1165 1166 1167 1168 | 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 | - + | * Changes attributes of the socket at the system level. * *---------------------------------------------------------------------- */ static int TcpSetOptionProc( |
| ︙ | |||
1245 1246 1247 1248 1249 1250 1251 | 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 | - + | * None. * *---------------------------------------------------------------------- */ static int TcpGetOptionProc( |
| ︙ | |||
1541 1542 1543 1544 1545 1546 1547 | 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 | - + | * already true. * *---------------------------------------------------------------------- */ static void TcpWatchProc( |
| ︙ | |||
1595 1596 1597 1598 1599 1600 1601 | 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 | - + - + | * None. * *---------------------------------------------------------------------- */ static int TcpGetHandleProc( |
| ︙ | |||
1648 1649 1650 1651 1652 1653 1654 | 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 1693 1694 1695 1696 1697 | - - - + + + - - + + - - - - + + + + |
static int
TcpConnect(
Tcl_Interp *interp, /* For error reporting; can be NULL. */
TcpState *statePtr)
{
DWORD error;
int async_connect = GOT_BITS(statePtr->flags, TCP_ASYNC_CONNECT);
|
| ︙ | |||
1990 1991 1992 1993 1994 1995 1996 | 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 | - - - - - - - - - - + + + + + + + + + + |
TclInitSockets();
/*
* Do the name lookups for the local and remote addresses.
*/
if (!TclCreateSocketAddress(interp, &addrlist, host, port, 0, &errorMsg)
|
| ︙ | |||
2105 2106 2107 2108 2109 2110 2111 | 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 | - - + + |
Tcl_Channel
Tcl_OpenTcpServerEx(
Tcl_Interp *interp, /* For error reporting - may be NULL. */
const char *service, /* Port number to open. */
const char *myHost, /* Name of local host. */
unsigned int flags, /* Flags. */
|
| ︙ | |||
2219 2220 2221 2222 2223 2224 2225 | 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 | - + |
* Set the maximum number of pending connect requests to the max
* value allowed on each platform (Win32 and Win32s may be
* different, and there may be differences between TCP/IP stacks).
*/
if (backlog < 0) {
backlog = SOMAXCONN;
|
| ︙ | |||
2537 2538 2539 2540 2541 2542 2543 | 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 | - + |
*/
WaitForSingleObject(tsdPtr->socketListLock, INFINITE);
for (statePtr = tsdPtr->socketList; statePtr != NULL;
statePtr = statePtr->nextPtr) {
if (GOT_BITS(statePtr->readyEvents,
statePtr->watchEvents | FD_CONNECT | FD_ACCEPT)
|
| ︙ | |||
2837 2838 2839 2840 2841 2842 2843 | 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 | - + - |
* Populate new FD.
*/
fds->fd = socket;
fds->statePtr = statePtr;
fds->next = NULL;
}
|
| ︙ | |||
2893 2894 2895 2896 2897 2898 2899 | 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 | - + - + - | * Processes socket events off the system queue. * *---------------------------------------------------------------------- */ static int WaitForSocketEvent( |
| ︙ | |||
3241 3242 3243 3244 3245 3246 3247 | 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 | - + |
static void
TcpThreadActionProc(
void *instanceData,
int action)
{
ThreadSpecificData *tsdPtr;
TcpState *statePtr = (TcpState *)instanceData;
|
| ︙ |
Changes to win/tclWinTest.c.
| ︙ | |||
332 333 334 335 336 337 338 | 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 | - - - + + + |
*
*----------------------------------------------------------------------
*/
static int
TestExceptionCmd(
TCL_UNUSED(void *),
|
| ︙ |
Changes to win/tclWinThrd.c.
| ︙ | |||
74 75 76 77 78 79 80 | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | - - - - - + + + + + + - + + + - - - - + + + + - - + - - - - - + + - + - - - + + + + | /* * The per-thread event and queue pointers. */ #if TCL_THREADS |
| ︙ | |||
214 215 216 217 218 219 220 | 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | - - + + |
winThreadPtr = (WinThread *)Tcl_Alloc(sizeof(WinThread));
winThreadPtr->lpStartAddress = (LPTHREAD_START_ROUTINE) proc;
winThreadPtr->lpParameter = clientData;
winThreadPtr->fpControl = _controlfp(0, 0);
EnterCriticalSection(&joinLock);
|
| ︙ | |||
655 656 657 658 659 660 661 | 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 | - + |
*----------------------------------------------------------------------
*/
void
Tcl_ConditionWait(
Tcl_Condition *condPtr, /* Really (WinCondition **) */
Tcl_Mutex *mutexPtr, /* Really (CRITICAL_SECTION **) */
|
| ︙ | |||
922 923 924 925 926 927 928 | 922 923 924 925 926 927 928 929 930 931 932 933 934 935 | - - - |
if (winCondPtr != NULL) {
DeleteCriticalSection(&winCondPtr->condLock);
Tcl_Free(winCondPtr);
*condPtr = NULL;
}
}
|
| ︙ | |||
1025 1026 1027 1028 1029 1030 1031 | 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 | - |
success = TlsFree(tlsKey);
if (!success) {
Tcl_Panic("TlsFree failed from TclpFreeAllocCache");
}
}
}
#endif /* USE_THREAD_ALLOC */
|
| ︙ |
Changes to win/tclWinTime.c.
| ︙ | |||
99 100 101 102 103 104 105 | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | - |
static struct {
int initialized; /* 1 if initialized, 0 otherwise */
int perfCounter; /* 1 if performance counter usable for wide
* clicks */
double microsecsScale; /* Denominator scale between clock / microsecs */
} wideClick = {0, 0, 0.0};
|
| ︙ | |||
210 211 212 213 214 215 216 | 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | - - - + + + |
* Try to use high resolution timer.
*/
if (IsTimeNative() && (usecSincePosixEpoch = NativeGetMicroseconds())) {
return (Tcl_WideUInt) usecSincePosixEpoch;
} else {
/*
|
| ︙ |