Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch sebres-on-dmnd-resolver-perf-branch Excluding Merge-Ins
This is equivalent to a diff from 348d9767d3 to 4e0bd29adf
2019-11-04
| ||
21:24 | integrate bug fix of [777ae99cfb], fixes mem-leaks, certain optimizations check-in: 8b790617eb user: sebres tags: trunk | |
21:20 | avoid mem-leak (methodVariables is object-hash, so key refCount is incremented automaticaly); grave speedup of method variables (share same object "fullNamePtr" between imvPtr and ivPtr); remove obsolete or unneeded code. Closed-Leaf check-in: 4e0bd29adf user: sebres tags: sebres-on-dmnd-resolver-perf-branch | |
20:28 | fixes [777ae99cfb]: previous var-lookup in class body (in ::itcl::parser) could obtain inherited common vars, be sure it does not exists after new uninitialized common creation; more test cases covering corner cases; remove unneeded calls of Itcl_BuildVirtualTables, since resolveVars is build on demand (moved to ItclResolveVarEntry). check-in: 6c5eb55b81 user: sebres tags: sebres-on-dmnd-resolver-perf-branch | |
2019-10-02
| ||
17:53 | (Re-)implement a public set of routines for allocation and interest management of memory blocks shared by independent modules. These routines do not suffer the performance scaling failures of their Tcl counterparts, which is important to Itcl's usage patterns. Bump the version number to account for new public routines. Thanks to sebres for the contribution. check-in: 3559fa204b user: dgp tags: trunk | |
17:46 | Bump to version Itcl 4.2.0 to account for additions to set of public routines. Closed-Leaf check-in: 348d9767d3 user: dgp tags: sebres-memopt-perf-branch | |
17:38 | Document new (and old!) public routines. check-in: a03aaa0379 user: dgp tags: sebres-memopt-perf-branch | |
Changes to doc/Preserve.3.
︙ | |||
46 47 48 49 50 51 52 | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | - + + | \fBTcl_Free\fR, \fBTcl_Preserve\fR, \fBTcl_Release\fR, and \fBTcl_EventuallyFree\fR. The Tcl routines suffer from issues with performance scaling as the number of blocks managed grows large. The facilities of Itcl encounter these performance scaling issues and require an alternative that does not suffer from them. .PP \fBItcl_Alloc\fR returns an untyped pointer to an allocated block |
︙ |
Changes to doc/class.n.
︙ | |||
377 378 379 380 381 382 383 | 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 | - + - - - - - - + + + + + + + + + + + + + + + + + | and procs. If \fIcmdName\fR is specified, it returns information for a specific method or proc. If no flags are specified, this command returns a list with the following elements: the protection level, the type (method/proc), the qualified name, the argument list and the body. Flags can be used to request specific elements from this list. .TP |
︙ |
Changes to generic/itclBase.c.
︙ | |||
198 199 200 201 202 203 204 | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | - + | nsPtr = Tcl_CreateNamespace(interp, ITCL_NAMESPACE, infoPtr, FreeItclObjectInfo); if (nsPtr == NULL) { Itcl_Free(infoPtr); Tcl_Panic("Itcl: cannot create namespace: \"%s\" \n", ITCL_NAMESPACE); } |
︙ |
Changes to generic/itclBuiltin.c.
︙ | |||
685 686 687 688 689 690 691 | 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 | - + | "improper usage: should be ", "\"object configure ?-option? ?value -option value...?\"", NULL); return TCL_ERROR; } vlookup = NULL; |
︙ | |||
726 727 728 729 730 731 732 | 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 | - + - + | Tcl_AppendResult(interp, "need option value pair", NULL); result = TCL_ERROR; goto configureDone; } vlookup = NULL; token = Tcl_GetString(unparsedObjv[i]); if (*token == '-') { |
︙ | |||
885 886 887 888 889 890 891 | 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 | - + | if (result != TCL_CONTINUE) { return result; } } name = Tcl_GetString(objv[1]); vlookup = NULL; |
︙ | |||
949 950 951 952 953 954 955 | 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 | - + | * data table, then use the simple name. Otherwise, this * is a shadowed variable; use the full name. */ Tcl_DStringInit(&optName); Tcl_DStringAppend(&optName, "-", -1); iclsPtr = (ItclClass*)contextIoPtr->iclsPtr; |
︙ |
Changes to generic/itclClass.c.
︙ | |||
282 283 284 285 286 287 288 | 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | - + | Tcl_InitObjHashTable(&iclsPtr->delegatedOptions); Tcl_InitObjHashTable(&iclsPtr->delegatedFunctions); Tcl_InitObjHashTable(&iclsPtr->methodVariables); Tcl_InitObjHashTable(&iclsPtr->resolveCmds); iclsPtr->numInstanceVars = 0; Tcl_InitHashTable(&iclsPtr->classCommons, TCL_ONE_WORD_KEYS); |
︙ | |||
456 457 458 459 460 461 462 | 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | */ if (iclsPtr->flags & ITCL_TYPE) { namePtr = Tcl_NewStringObj("type", -1); (void) Itcl_CreateVariable(interp, iclsPtr, namePtr, NULL, NULL, &ivPtr); ivPtr->protection = ITCL_PROTECTED; /* always "protected" */ ivPtr->flags |= ITCL_TYPE_VAR; /* mark as "type" variable */ |
︙ | |||
1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 | 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 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + | Tcl_NRAddCallback(interp, FinalizeCreateObject, objNamePtr, iclsPtr, NULL, NULL); Tcl_NRAddCallback(interp, CallCreateObject, objNamePtr, iclsPtr, INT2PTR(objc-4), newObjv); return Itcl_NRRunCallbacks(interp, callbackPtr); } /* * ------------------------------------------------------------------------ * ItclResolveVarEntry() * * Side effect: (re)build part of resolver hash-table on demand. * ------------------------------------------------------------------------ */ Tcl_HashEntry * ItclResolveVarEntry( ItclClass* iclsPtr, /* class definition where to resolve variable */ const char *lookupName) /* name of variable being resolved */ { Tcl_HashEntry *reshPtr, *hPtr; /* could be resolved directly */ if ((reshPtr = Tcl_FindHashEntry(&iclsPtr->resolveVars, lookupName)) != NULL) { return reshPtr; } else { /* try to build virtual table for this var */ const char *varName, *simpleName; Tcl_DString buffer, buffer2, *bufferC; ItclHierIter hier; ItclClass* iclsPtr2; ItclVarLookup *vlookup; ItclVariable *ivPtr; Tcl_Namespace* nsPtr; Tcl_Obj *vnObjPtr; int newEntry, processAncestors; size_t varLen; /* (de)qualify to simple name */ varName = simpleName = lookupName; while(*varName) { if (*varName++ == ':') { if (*varName++ == ':') { simpleName = varName; } }; } vnObjPtr = Tcl_NewStringObj(simpleName, -1); processAncestors = simpleName != lookupName; Tcl_DStringInit(&buffer); Tcl_DStringInit(&buffer2); /* * Scan through all classes in the hierarchy, from most to * least specific. Add a lookup entry for each variable * into the table. */ Itcl_InitHierIter(&hier, iclsPtr); iclsPtr2 = Itcl_AdvanceHierIter(&hier); while (iclsPtr2 != NULL) { hPtr = Tcl_FindHashEntry(&iclsPtr2->variables, vnObjPtr); if (hPtr) { ivPtr = (ItclVariable*)Tcl_GetHashValue(hPtr); vlookup = NULL; /* * Create all possible names for this variable and enter * them into the variable resolution table: * var * class::var * namesp1::class::var * namesp2::namesp1::class::var * ... */ varName = simpleName; varLen = -1; bufferC = &buffer; nsPtr = iclsPtr2->nsPtr; while (1) { hPtr = Tcl_CreateHashEntry(&iclsPtr->resolveVars, varName, &newEntry); /* check for same name in current class */ if (!newEntry) { vlookup = (ItclVarLookup*)Tcl_GetHashValue(hPtr); if (vlookup->ivPtr != ivPtr && iclsPtr2 == iclsPtr) { /* if used multiple times - unbind, else - overwrite */ if (vlookup->usage > 1) { /* correct leastQualName */ vlookup->leastQualName = NULL; processAncestors = 1; /* correction in progress */ /* should create new lookup */ --vlookup->usage; vlookup = NULL; } else { /* correct values (overwrite) */ vlookup->usage = 0; goto setResVar; } newEntry = 1; } else { /* var exists and no correction necessary - next var */ if (!processAncestors) { break; } /* check leastQualName correction needed */ if (!vlookup->leastQualName) { vlookup->leastQualName = Tcl_GetHashKey(&iclsPtr->resolveVars, hPtr); } /* reset vlookup for full-qualified names - new lookup */ if (vlookup->ivPtr != ivPtr) { vlookup = NULL; } } } if (newEntry) { if (!vlookup) { /* create new (or overwrite) */ vlookup = (ItclVarLookup *)ckalloc(sizeof(ItclVarLookup)); vlookup->usage = 0; setResVar: vlookup->ivPtr = ivPtr; vlookup->leastQualName = Tcl_GetHashKey(&iclsPtr->resolveVars, hPtr); /* * If this variable is PRIVATE to another class scope, * then mark it as "inaccessible". */ vlookup->accessible = (ivPtr->protection != ITCL_PRIVATE || ivPtr->iclsPtr == iclsPtr); /* * Set aside the first object-specific slot for the built-in * "this" variable. Only allocate one of these, even though * there is a definition for "this" in each class scope. * Set aside the second and third object-specific slot for the built-in * "itcl_options" and "itcl_option_components" variable. */ if (!iclsPtr->numInstanceVars) { iclsPtr->numInstanceVars += 3; } /* * If this is a reference to the built-in "this" * variable, then its index is "0". Otherwise, * add another slot to the end of the table. */ if ((ivPtr->flags & ITCL_THIS_VAR) != 0) { vlookup->varNum = 0; } else { if ((ivPtr->flags & ITCL_OPTIONS_VAR) != 0) { vlookup->varNum = 1; } else { vlookup->varNum = iclsPtr->numInstanceVars++; } } } Tcl_SetHashValue(hPtr, vlookup); vlookup->usage++; } /* if we have found it */ if (simpleName == lookupName || strcmp(varName, lookupName) == 0) { if (!reshPtr) { reshPtr = hPtr; } break; } if (nsPtr == NULL) { break; } Tcl_DStringSetLength(bufferC, 0); Tcl_DStringAppend(bufferC, nsPtr->name, -1); Tcl_DStringAppend(bufferC, "::", 2); Tcl_DStringAppend(bufferC, varName, varLen); varName = Tcl_DStringValue(bufferC); varLen = Tcl_DStringLength(bufferC); bufferC = (bufferC == &buffer) ? &buffer2 : &buffer; nsPtr = nsPtr->parentPtr; } } /* Stop create vars for ancestors (if not needed) */ if (!processAncestors && reshPtr) { /* simple name - don't need to check ancestors */ break; } iclsPtr2 = Itcl_AdvanceHierIter(&hier); } Itcl_DeleteHierIter(&hier); Tcl_DStringFree(&buffer); Tcl_DStringFree(&buffer2); Tcl_DecrRefCount(vnObjPtr); if (reshPtr == NULL) { reshPtr = Tcl_FindHashEntry(&iclsPtr->resolveVars, lookupName); } return reshPtr; } } /* * ------------------------------------------------------------------------ * Itcl_BuildVirtualTables() * * Invoked whenever the class heritage changes or members are added or * removed from a class definition to rebuild the member lookup * tables. There are two tables: * * METHODS: resolveCmds * Used primarily in Itcl_ClassCmdResolver() to resolve all * command references in a namespace. * |
︙ | |||
1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 | 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 | + - + + - + - - - - - + + + + + + | * class::func * namesp1::class::func * namesp2::namesp1::class::func * ... */ Tcl_DStringSetLength(&buffer, 0); Tcl_DStringAppend(&buffer, Tcl_GetString(imPtr->namePtr), -1); bufferC = &buffer; bufferC2 = &buffer2; nsPtr = iclsPtr2->nsPtr; while (1) { |
︙ | |||
2049 2050 2051 2052 2053 2054 2055 | 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 | - + - + - - + - - + + - + - + - - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | Itcl_PreserveData(ioptPtr); Itcl_EventuallyFree(ioptPtr, (Tcl_FreeProc *) ItclDeleteOption); return TCL_OK; } /* * ------------------------------------------------------------------------ |
︙ |
Changes to generic/itclCmd.c.
︙ | |||
743 744 745 746 747 748 749 | 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 | - + | hPtr = Tcl_FindHashEntry(&infoPtr->namespaceClasses, (char *)contextNsPtr); if (hPtr != NULL) { contextIclsPtr = (ItclClass *)Tcl_GetHashValue(hPtr); } if (Itcl_IsClassNamespace(contextNsPtr)) { ClientData clientData; |
︙ |
Changes to generic/itclHelpers.c.
︙ | |||
1118 1119 1120 1121 1122 1123 1124 | 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 | - + | const char *cp; int haveFlags; int newValue1; keyPtr = iclsPtr->fullNamePtr; dictPtr = Tcl_GetVar2Ex(interp, ITCL_NAMESPACE"::internal::dicts::classVariables", |
︙ | |||
1243 1244 1245 1246 1247 1248 1249 | 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 | - + | keyPtr = iclsPtr->fullNamePtr; if (Tcl_DictObjPut(interp, dictPtr, keyPtr, valuePtr1) != TCL_OK) { return TCL_ERROR; } } Tcl_SetVar2Ex(interp, ITCL_NAMESPACE"::internal::dicts::classVariables", |
︙ | |||
1269 1270 1271 1272 1273 1274 1275 | 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 | - + | Tcl_Obj *listPtr; const char *cp; int haveFlags; int newValue1; dictPtr = Tcl_GetVar2Ex(interp, ITCL_NAMESPACE"::internal::dicts::classFunctions", |
︙ | |||
1403 1404 1405 1406 1407 1408 1409 | 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 | - + | keyPtr = iclsPtr->fullNamePtr; if (Tcl_DictObjPut(interp, dictPtr, keyPtr, valuePtr1) != TCL_OK) { return TCL_ERROR; } } Tcl_SetVar2Ex(interp, ITCL_NAMESPACE"::internal::dicts::classFunctions", |
︙ |
Changes to generic/itclInfo.c.
︙ | |||
197 198 199 200 201 202 203 | 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | - + | }, { "typevars", "?pattern?", Itcl_BiInfoTypeVarsCmd, ITCL_TYPE|ITCL_WIDGETADAPTOR|ITCL_WIDGET|ITCL_ECLASS }, { "variable", |
︙ | |||
1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 | 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 | + | * * If the ?varName? is not specified, then a list of all known * data members is returned. Otherwise, the information for a * specific member is returned. Returns a status TCL_OK/TCL_ERROR * to indicate success/failure. * ------------------------------------------------------------------------ */ /*&&&1*/ /* ARGSUSED */ int Itcl_BiInfoVariableCmd( ClientData clientData, /* ItclObjectInfo Ptr */ Tcl_Interp *interp, /* current interpreter */ int objc, /* number of arguments */ Tcl_Obj *const objv[]) /* argument objects */ |
︙ | |||
1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 | 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 | + + + + + - + - - + + - | ItclVariable *ivPtr; ItclVarLookup *vlookup; ItclHierIter hier; char *varName; const char *val; int i; int result; ClientData cfClientData; ItclObjectInfo *infoPtr; Tcl_Object oPtr; int doAppend; static const char *options[] = { "-config", "-init", "-name", "-protection", "-type", |
︙ | |||
1323 1324 1325 1326 1327 1328 1329 | 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 | - + - + | } if (contextIoPtr != NULL) { contextIclsPtr = contextIoPtr->iclsPtr; } /* * Process args: |
︙ | |||
1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 | 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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | } } if (val == NULL) { val = "<undefined>"; } objPtr = Tcl_NewStringObj((const char *)val, -1); break; case BIvScopeIdx: entry = Tcl_FindHashEntry(&contextIclsPtr->resolveVars, varName); if (!entry) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "variable \"", varName, "\" not found in class \"", Tcl_GetString(contextIclsPtr->fullNamePtr), "\"", (char*)NULL); return TCL_ERROR; } vlookup = (ItclVarLookup*)Tcl_GetHashValue(entry); if (vlookup->ivPtr->flags & ITCL_COMMON) { objPtr = Tcl_NewStringObj("", -1); if (vlookup->ivPtr->protection != ITCL_PUBLIC) { Tcl_AppendToObj(objPtr, ITCL_VARIABLES_NAMESPACE, -1); } Tcl_AppendToObj(objPtr, Tcl_GetString(vlookup->ivPtr->fullNamePtr), -1); } else { /* * If this is not a common variable, then we better have * an object context. Return the name as a fully qualified name. */ infoPtr = contextIclsPtr->infoPtr; cfClientData = Itcl_GetCallFrameClientData(interp); if (cfClientData != NULL) { oPtr = Tcl_ObjectContextObject((Tcl_ObjectContext)cfClientData); if (oPtr != NULL) { contextIoPtr = (ItclObject*)Tcl_ObjectGetMetadata( oPtr, infoPtr->object_meta_type); } } if (contextIoPtr == NULL) { if (infoPtr->currIoPtr != NULL) { contextIoPtr = infoPtr->currIoPtr; } } if (contextIoPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "can't scope variable \"", varName, "\": missing object context", (char*)NULL); return TCL_ERROR; } doAppend = 1; if (contextIclsPtr->flags & ITCL_ECLASS) { if (strcmp(varName, "itcl_options") == 0) { doAppend = 0; } } objPtr = Tcl_NewStringObj((char*)NULL, 0); Tcl_IncrRefCount(objPtr); Tcl_AppendToObj(objPtr, ITCL_VARIABLES_NAMESPACE, -1); Tcl_AppendToObj(objPtr, (Tcl_GetObjectNamespace(contextIoPtr->oPtr))->fullName, -1); if (doAppend) { Tcl_AppendToObj(objPtr, Tcl_GetString(vlookup->ivPtr->fullNamePtr), -1); } else { Tcl_AppendToObj(objPtr, "::", -1); Tcl_AppendToObj(objPtr, Tcl_GetString(vlookup->ivPtr->namePtr), -1); } } break; } if (objc == 1) { resultPtr = objPtr; } else { Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } |
︙ | |||
4022 4023 4024 4025 4026 4027 4028 | 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 | - + | objc--; objv++; } /* * Return info for a specific variable. */ if (varName) { |
︙ |
Changes to generic/itclInt.h.
︙ | |||
63 64 65 66 67 68 69 | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | - + - - + - + | /* * Since the Tcl/Tk distribution doesn't perform any asserts, * dynamic loading can fail to find the __assert function. * As a workaround, we'll include our own. */ #undef assert |
︙ | |||
96 97 98 99 100 101 102 | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | + + - - + + | /* * What sort of size of things we like to allocate. */ #define ALLOC_CHUNK 8 #define ITCL_INT_NAMESPACE ITCL_NAMESPACE"::internal" #define ITCL_INTDICTS_NAMESPACE ITCL_INT_NAMESPACE"::dicts" |
︙ | |||
689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 | 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 | + + + + + + | ItclClass *iclsPtr, int objc, Tcl_Obj *const objv[]); MODULE_SCOPE void ItclDeleteObjectVariablesNamespace(Tcl_Interp *interp, ItclObject *ioPtr); MODULE_SCOPE void ItclDeleteClassVariablesNamespace(Tcl_Interp *interp, ItclClass *iclsPtr); MODULE_SCOPE int ItclInfoInit(Tcl_Interp *interp, ItclObjectInfo *infoPtr); MODULE_SCOPE Tcl_HashEntry *ItclResolveVarEntry( ItclClass* iclsPtr, const char *varName); struct Tcl_ResolvedVarInfo; MODULE_SCOPE int Itcl_ClassCmdResolver(Tcl_Interp *interp, const char* name, Tcl_Namespace *nsPtr, int flags, Tcl_Command *rPtr); MODULE_SCOPE int Itcl_ClassVarResolver(Tcl_Interp *interp, const char* name, Tcl_Namespace *nsPtr, int flags, Tcl_Var *rPtr); MODULE_SCOPE int Itcl_ClassCompiledVarResolver(Tcl_Interp *interp, const char* name, int length, Tcl_Namespace *nsPtr, struct Tcl_ResolvedVarInfo **rPtr); MODULE_SCOPE int Itcl_ClassCmdResolver2(Tcl_Interp *interp, const char* name, Tcl_Namespace *nsPtr, int flags, Tcl_Command *rPtr); MODULE_SCOPE int Itcl_ClassVarResolver2(Tcl_Interp *interp, const char* name, Tcl_Namespace *nsPtr, int flags, Tcl_Var *rPtr); MODULE_SCOPE int Itcl_ClassCompiledVarResolver2(Tcl_Interp *interp, const char* name, int length, Tcl_Namespace *nsPtr, struct Tcl_ResolvedVarInfo **rPtr); MODULE_SCOPE int ItclSetParserResolver(Tcl_Namespace *nsPtr); MODULE_SCOPE void ItclProcErrorProc(Tcl_Interp *interp, Tcl_Obj *procNameObj); MODULE_SCOPE int Itcl_CreateOption (Tcl_Interp *interp, ItclClass *iclsPtr, ItclOption *ioptPtr); MODULE_SCOPE int ItclCreateMethodVariable(Tcl_Interp *interp, ItclVariable *ivPtr, Tcl_Obj* defaultPtr, Tcl_Obj* callbackPtr, ItclMethodVariable** imvPtrPtr); MODULE_SCOPE int Itcl_CreateMethodVariable (Tcl_Interp *interp, ItclClass *iclsPtr, Tcl_Obj *name, Tcl_Obj *defaultPtr, Tcl_Obj *callbackPtr, ItclMethodVariable **imvPtr); MODULE_SCOPE int DelegationInstall(Tcl_Interp *interp, ItclObject *ioPtr, ItclClass *iclsPtr); MODULE_SCOPE ItclClass *ItclNamespace2Class(Tcl_Namespace *nsPtr); MODULE_SCOPE const char* ItclGetCommonInstanceVar(Tcl_Interp *interp, |
︙ |
Changes to generic/itclMethod.c.
︙ | |||
237 238 239 240 241 242 243 | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | - + | /* * Find the variable and change its implementation. * Note that variable resolution table has *all* variables, * even those in a base class. Make sure that the class * containing the variable definition is the requested class. */ vlookup = NULL; |
︙ | |||
2216 2217 2218 2219 2220 2221 2222 | 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 | - + | iclsPtr = resolveInfoPtr->iclsPtr; } infoPtr = iclsPtr->infoPtr; hPtr = Tcl_FindHashEntry(&infoPtr->namespaceClasses, (char *)nsPtr); if (hPtr != NULL) { iclsPtr = (ItclClass *)Tcl_GetHashValue(hPtr); } |
︙ |
Changes to generic/itclObject.c.
︙ | |||
869 870 871 872 873 874 875 | 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 | - + | if (Tcl_SetVar2(interp, varName, NULL, "", TCL_NAMESPACE_ONLY) == NULL) { Tcl_AppendResult(interp, "INTERNAL ERROR cannot set", " variable \"", varName, "\"\n", NULL); goto errorCleanup; } } |
︙ | |||
1622 1623 1624 1625 1626 1627 1628 | 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 | - + - + | /* get the variable definition to check if that is an ITCL_COMMON */ if (contextIclsPtr == NULL) { iclsPtr = contextIoPtr->iclsPtr; } else { iclsPtr = contextIclsPtr; } ivPtr = NULL; |
︙ | |||
1838 1839 1840 1841 1842 1843 1844 | 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 | - + | } /* get the variable definition to check if that is an ITCL_COMMON */ if (contextIclsPtr == NULL) { iclsPtr = contextIoPtr->iclsPtr; } else { iclsPtr = contextIclsPtr; } |
︙ | |||
3492 3493 3494 3495 3496 3497 3498 | 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 | - + | Tcl_HashEntry *hPtr; Tcl_Obj *objPtr; Tcl_DString buffer; ItclVarLookup *vlookup; ItclVariable *ivPtr; const char *val; |
︙ |
Changes to generic/itclParse.c.
︙ | |||
578 579 580 581 582 583 584 | 578 579 580 581 582 583 584 585 586 587 588 589 590 591 | - | /* create the itcl_hull variable */ namePtr = Tcl_NewStringObj("itcl_hull", -1); if (ItclCreateComponent(interp, iclsPtr, namePtr, ITCL_COMMON, &icPtr) != TCL_OK) { return TCL_ERROR; } iclsPtr->numVariables++; |
︙ | |||
2137 2138 2139 2140 2141 2142 2143 | 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 | - - - - - - - + - - - - + - - + - + + + + + + - - - + | Tcl_SetHashValue(hPtr, varPtr); } result = Itcl_PushCallFrame(interp, &frame, commonNsPtr, /* isProcCallFrame */ 0); Itcl_PopCallFrame(interp); /* |
︙ | |||
4227 4228 4229 4230 4231 4232 4233 | 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 | - + | } if (Itcl_CreateVariable(interp, iclsPtr, namePtr, Tcl_GetString(defaultPtr), NULL, &ivPtr) != TCL_OK) { return TCL_ERROR; } iclsPtr->numVariables++; |
︙ |
Changes to generic/itclResolve.c.
︙ | |||
272 273 274 275 276 277 278 | 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | - + | return TCL_CONTINUE; } iclsPtr = (ItclClass *)Tcl_GetHashValue(hPtr); /* * See if the variable is a known data member and accessible. */ |
︙ | |||
310 311 312 313 314 315 316 | 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | - + | /* Check that the object hasn't already been destroyed. */ hPtr = Tcl_FindHashEntry(&infoPtr->objects, (char *)contextIoPtr); if (hPtr == NULL) { return TCL_CONTINUE; } if (contextIoPtr->iclsPtr != vlookup->ivPtr->iclsPtr) { if (strcmp(Tcl_GetString(vlookup->ivPtr->namePtr), "this") == 0) { |
︙ | |||
441 442 443 444 445 446 447 | 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 | - + | buffer = storage; } else { buffer = (char*)ckalloc((unsigned)(length+1)); } memcpy((void*)buffer, (void*)name, (size_t)length); buffer[length] = '\0'; |
︙ | |||
524 525 526 527 528 529 530 | 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 | - + | return NULL; } if (contextIoPtr->iclsPtr != vlookup->ivPtr->iclsPtr) { if (strcmp(Tcl_GetString(vlookup->ivPtr->namePtr), "this") == 0) { /* only for the this variable we need the one of the * contextIoPtr class */ |
︙ | |||
650 651 652 653 654 655 656 | 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 681 682 683 684 685 686 687 688 689 690 691 692 | - - - + + + + + + - - - - - - + + + + + + + + - - - - - - + + + + + - - - + + - - - + - - - - - - - + | Tcl_HashEntry *hPtr; ItclVarLookup *vlookup; /* * See if the requested variable is a recognized "common" member. * If it is, make sure that access is allowed. */ |
Changes to pkgIndex.tcl.in.
1 2 3 4 5 6 | 1 2 3 4 5 6 7 | + | # Tcl package index file, version 1.0 if {![package vsatisfies [package provide Tcl] 8.5]} {return} if {![package vsatisfies [package provide Tcl] 8.6-]} {return} package ifneeded itcl @PACKAGE_VERSION@ [list load [file join $dir "@PKG_LIB_FILE@"] itcl] package ifneeded Itcl @PACKAGE_VERSION@ [list load [file join $dir "@PKG_LIB_FILE@"] itcl] |
Added tests-perf/itcl-basic.perf.tcl.