Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | [f829637350] Use slave interp for ensemble parsing. Get interps sorted out. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
7f4035faf0456a505cb3ca47ac106f19 |
User & Date: | dgp 2015-07-29 22:56:52 |
Context
2015-10-22
| ||
17:28 | Shared value botch due to anti-pattern use. check-in: e44a4e2129 user: dgp tags: trunk | |
2015-07-30
| ||
12:29 | merge trunk check-in: 882461e86f user: dgp tags: dgp-method-type | |
2015-07-29
| ||
22:56 | [f829637350] Use slave interp for ensemble parsing. Get interps sorted out. check-in: 7f4035faf0 user: dgp tags: trunk | |
2015-07-20
| ||
16:36 | Use a wrapping command around the itcl::builtin::Info ensemble so that we can get the verbose usage message we want when no subcommand argument is passed. Works around failure of Tcl to implement RFE 1773103 at least for the builtin info command. check-in: 83b05dbe07 user: dgp tags: trunk | |
Changes
Changes to generic/itclEnsemble.c.
︙ | ︙ | |||
820 821 822 823 824 825 826 | goto finish; } /* * If there is no parent data, then this is a top-level * ensemble. Create the ensemble by installing its access * command. | < < < < < | 820 821 822 823 824 825 826 827 828 829 830 831 832 833 | goto finish; } /* * If there is no parent data, then this is a top-level * ensemble. Create the ensemble by installing its access * command. */ if (parentEnsData == NULL) { Tcl_Obj *unkObjPtr; ensData->cmdPtr = Tcl_CreateEnsemble(interp, ensName, Tcl_GetCurrentNamespace(interp), TCL_ENSEMBLE_PREFIX); hPtr = Tcl_CreateHashEntry(&infoPtr->ensembleInfo->ensembles, (char *)ensData->cmdPtr, &isNew); |
︙ | ︙ | |||
1707 1708 1709 1710 1711 1712 1713 | * being built, then this "ensemble" command is enclosed in * another "ensemble" command. Use the current ensemble as * the parent, and find or create an ensemble part within it. */ ensName = Tcl_GetString(objv[1]); if (ensData) { | | | > | | | 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 | * being built, then this "ensemble" command is enclosed in * another "ensemble" command. Use the current ensemble as * the parent, and find or create an ensemble part within it. */ ensName = Tcl_GetString(objv[1]); if (ensData) { if (FindEnsemblePart(ensInfo->master, ensData, ensName, &ensPart) != TCL_OK) { ensPart = NULL; } if (ensPart == NULL) { if (CreateEnsemble(ensInfo->master, ensData, ensName) != TCL_OK) { Tcl_TransferResult(ensInfo->master, TCL_ERROR, interp); return TCL_ERROR; } if (FindEnsemblePart(ensInfo->master, ensData, ensName, &ensPart) != TCL_OK) { Tcl_Panic("Itcl_EnsembleCmd: can't create ensemble"); } } cmd = ensPart->cmdPtr; infoPtr = Tcl_GetAssocData(ensInfo->master, ITCL_INTERP_DATA, &procPtr); hPtr = Tcl_FindHashEntry(&infoPtr->ensembleInfo->ensembles, (char *)ensPart->cmdPtr); if (hPtr == NULL) { Tcl_AppendStringsToObj(Tcl_GetObjResult(interp), "part \"", Tcl_GetStringFromObj(objv[1], (int*)NULL), "\" is not an ensemble", (char*)NULL); |
︙ | ︙ | |||
1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 | * Copy the result from the parser interpreter to the * master interpreter. If an error was encountered, * copy the error info first, and then set the result. * Otherwise, the offending command is reported twice. */ if (status == TCL_ERROR) { #ifdef NOTDEF /* no longer needed, no extra interpreter !! */ const char *errInfo = Tcl_GetVar2(ensInfo->parser, "::errorInfo", (char*)NULL, TCL_GLOBAL_ONLY); if (errInfo) { Tcl_AddObjErrorInfo(interp, (const char *)errInfo, -1); } #endif if (objc == 3) { | > < < < < < < | | | 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 | * Copy the result from the parser interpreter to the * master interpreter. If an error was encountered, * copy the error info first, and then set the result. * Otherwise, the offending command is reported twice. */ if (status == TCL_ERROR) { #ifdef NOTDEF #else /* no longer needed, no extra interpreter !! */ const char *errInfo = Tcl_GetVar2(ensInfo->parser, "::errorInfo", (char*)NULL, TCL_GLOBAL_ONLY); if (errInfo) { Tcl_AddObjErrorInfo(interp, (const char *)errInfo, -1); } #endif if (objc == 3) { Tcl_AppendObjToErrorInfo(interp, Tcl_ObjPrintf( "\n (\"ensemble\" body line %d)", Tcl_GetErrorLine(ensInfo->parser))); } } Tcl_SetObjResult(interp, Tcl_GetObjResult(ensInfo->parser)); ensInfo->ensData = savedEnsData; return status; } |
︙ | ︙ | |||
1866 1867 1868 1869 1870 1871 1872 | /* * Create a slave interpreter that can be used to parse * the body of an ensemble definition. */ ensInfo = (EnsembleParser*)ckalloc(sizeof(EnsembleParser)); ensInfo->master = interp; | | | 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 | /* * Create a slave interpreter that can be used to parse * the body of an ensemble definition. */ ensInfo = (EnsembleParser*)ckalloc(sizeof(EnsembleParser)); ensInfo->master = interp; ensInfo->parser = Tcl_CreateInterp(); ensInfo->ensData = NULL; #ifdef NOTDEF /* * Remove all namespaces and all normal commands from the * parser interpreter. */ |
︙ | ︙ | |||
1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 | hPtr != NULL; hPtr = Tcl_FirstHashEntry(&nsPtr->cmdTable, &search)) { cmd = (Tcl_Command)Tcl_GetHashValue(hPtr); Tcl_DeleteCommandFromToken(ensInfo->parser, cmd); } #endif /* * Add the allowed commands to the parser interpreter: * part, delete, ensemble */ Tcl_CreateObjCommand(ensInfo->parser, "part", Itcl_EnsPartCmd, (ClientData)ensInfo, (Tcl_CmdDeleteProc*)NULL); | > > | 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 | hPtr != NULL; hPtr = Tcl_FirstHashEntry(&nsPtr->cmdTable, &search)) { cmd = (Tcl_Command)Tcl_GetHashValue(hPtr); Tcl_DeleteCommandFromToken(ensInfo->parser, cmd); } #else Tcl_DeleteNamespace(Tcl_GetGlobalNamespace(ensInfo->parser)); #endif /* * Add the allowed commands to the parser interpreter: * part, delete, ensemble */ Tcl_CreateObjCommand(ensInfo->parser, "part", Itcl_EnsPartCmd, (ClientData)ensInfo, (Tcl_CmdDeleteProc*)NULL); |
︙ | ︙ | |||
2022 2023 2024 2025 2026 2027 2028 | result = TCL_ERROR; goto errorOut; } if (Tcl_GetCommandInfoFromToken(ensData->cmdPtr, &cmdInfo) != 1) { result = TCL_ERROR; goto errorOut; } | | > | > | 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 | result = TCL_ERROR; goto errorOut; } if (Tcl_GetCommandInfoFromToken(ensData->cmdPtr, &cmdInfo) != 1) { result = TCL_ERROR; goto errorOut; } if (Tcl_CreateProc(ensInfo->master, cmdInfo.namespacePtr, partName, objv[2], objv[3], &procPtr) != TCL_OK) { Tcl_TransferResult(ensInfo->master, TCL_ERROR, interp); result = TCL_ERROR; goto errorOut; } usage = Tcl_GetString(usagePtr); /* * Create a new part within the ensemble. If successful, * plug the command token into the proc; we'll need it later * if we try to compile the Tcl code for the part. If * anything goes wrong, clean up before bailing out. */ result = AddEnsemblePart(ensInfo->master, ensData, partName, usage, Tcl_GetObjInterpProc(), (ClientData)procPtr, _Tcl_ProcDeleteProc, ITCL_ENSEMBLE_ENSEMBLE, &ensPart); Tcl_TransferResult(ensInfo->master, result, interp); errorOut: Tcl_DecrRefCount(usagePtr); ItclDeleteArgList(arglistPtr); return result; } |
︙ | ︙ |