Skip to content
Tcl Source Code Artifact [2a5410201e]
Login

Artifact [2a5410201e]

Artifact 2a5410201ee7ed077a83e354159eaf7c752b28a3:

Ticket change [2a5410201e] - New ticket [219265ffffffffff|219265ffff] <i>auto_mkindex produces bad tclIndex file in some situations w</i>. by nobody on 2000-10-26 05:09:37.
D 2000-10-26T05:09:37
J assignee nobody
J closer nobody
J cmimetype text/plain
J comment OriginalBugID:\s1115\sBug\nVersion:\s8.0.4\nSubmitDate:\s'1999-01-26'\nLastModified:\s'2000-02-02'\nSeverity:\sMED\nStatus:\sUnAssn\nSubmitter:\swelch\nChangedBy:\sericm\nRelatedBugIDs:\s1187\s1559\s1558\s1549\s1481\nOS:\sSolaris\nMachine:\sOther\nFixedDate:\s'2000-10-25'\nClosedDate:\s'2000-10-25'\n\n\nName:\nJim\sInham\n\nExtensions:\nItcl3.0.1\n\nCustomShell:\nThis\sis\svanilla\sTcl\s+\sItcl3.0.1\sunmodified.\n\nReproducibleScript:\nMake\stwo\sfiles:\n\nmain.tcl:\nnamespace\simport\sitcl::*\n\nclass.itcl:\nclass\sfoo\s{}\n\nThen\sdo:\n\nitclsh3.0\n%\sauto_mkindex\s[pwd]\smain.tcl\sclass.itcl\n\n\n\nObservedBehavior:\nThe\stclIndex\sfile\swill\sbe\sempty,\sexcept\sfor\sthe\sheader\scomments.\n\n\n\nDesiredBehavior:\nThere\sshould\sbe\san\sentry\sfor\sfoo\sin\sthe\stclIndex\n\n\n\nPatch:\n***\sinit.tcl.old\s\s\s\s\s\s\s\sWed\sJan\s20\s18:25:34\s1999\n---\sinit.tcl.new\s\s\s\s\s\s\s\sWed\sJan\s20\s18:25:52\s1999\n***************\n***\s717,724\s****\n\s\s\s\s\s\s\s\sif\s{$args\s==\s""}\s{\n\s\s\s\s\s\s\s\s\s\s\s\sset\sargs\s*.tcl\n\s\s\s\s\s\s\s\s}\n-\s\s\s\s\s\s\sauto_mkindex_parser::init\n\s\s\s\s\s\s\s\sforeach\sfile\s[eval\sglob\s$args]\s{\n\s\s\s\s\s\s\s\s\s\s\s\sif\s{[catch\s{auto_mkindex_parser::mkindex\s$file}\smsg]\s==\s0}\s{\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sappend\sindex\s$msg\n\s\s\s\s\s\s\s\s\s\s\s\s}\selse\s{\n---\s717,724\s----\n\s\s\s\s\s\s\s\sif\s{$args\s==\s""}\s{\n\s\s\s\s\s\s\s\s\s\s\s\sset\sargs\s*.tcl\n\s\s\s\s\s\s\s\s}\n\s\s\s\s\s\s\s\sforeach\sfile\s[eval\sglob\s$args]\s{\n+\s\s\s\s\s\s\s\s\sauto_mkindex_parser::init\n\s\s\s\s\s\s\s\s\s\s\s\sif\s{[catch\s{auto_mkindex_parser::mkindex\s$file}\smsg]\s==\s0}\s{\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sappend\sindex\s$msg\n\s\s\s\s\s\s\s\s\s\s\s\s}\selse\s{\n***************\n***\s727,734\s****\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\scd\s$oldDir\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\serror\s$msg\s$info\s$code\n\s\s\s\s\s\s\s\s\s\s\s\s}\n\s\s\s\s\s\s\s\s}\n-\s\s\s\s\s\s\sauto_mkindex_parser::cleanup\n\s\s\n\s\s\s\s\s\s\s\sset\sfid\s[open\s"tclIndex"\sw]\n\s\s\s\s\s\s\s\sputs\s$fid\s$index\snonewline\n---\s727,734\s----\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\scd\s$oldDir\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\serror\s$msg\s$info\s$code\n\s\s\s\s\s\s\s\s\s\s\s\s}\n+\s\s\s\s\s\s\s\s\sauto_mkindex_parser::cleanup\n\s\s\s\s\s\s\s\s}\n\s\s\n\s\s\s\s\s\s\s\sset\sfid\s[open\s"tclIndex"\sw]\n\s\s\s\s\s\s\s\sputs\s$fid\s$index\snonewline\n\n\n\n\nPatchFiles:\nlibrary/init.tcl\n\n\n\n\n\nThe\soriginal\sbug\sis\skind\sof\sbogus,\ssince\sthe\snamespace\simport\sstatement\sshould\snever\sbe\sin\sa\sfile\sthat\sgoes\sinto\sthe\sauto_mkindex\sline.\s\sI\sfixed\sthis,\sby\sthe\sway,\sin\sour\scode...\n\nHowever,\sit\sreveals\swhat\sto\sme\sseems\sa\sweakness\sin\sthe\sauto_mkindex\s\narchitecture.\s\sauto_mkindex\sis\strying\sto\streat\seach\sfile\son\sthe\sauto_mkindex\s\nline\sindependently,\swhich\sis\swhy\sit\stracks\snamespace\simports\sin\sthe\s\nauto_mkindex_parser::parser,\sand\stries\sto\sremove\sthem\safter\seach\sfile\sis\s\nprocessed.\s\sHowever,\sthis\swill\seventually\slose\sagainst\sanother\spackage\sthat\shas\s"command\sproducing\scommands"\swhich\slive\sin\sa\snamespace,\slike\sitcl::class.\s\s\n\nThat\spackage\sneeds\sto\simport\sthese\sby\shand\sso\sthat\sfiles\sthat\sare\smeant\sto\sbe\srun\sin\san\senvironment\swhere\sthe\suser\shas\salready\sdone\n\nnamespace\simport\sitcl::*\n\nwill\sget\sproperly\sprocessed.\s\sItcl\sdoes\sthis\sby\sadding\sthe\simport\susing\sauto_mkindex_slavehook\sin\sitcl/unix/tclAppInit.c.\s\sBut\sthis\smeans\sthat\nany\stime\syou\simport\sitcl::*\sin\sANY\sother\scode,\sthe\simports\sfrom\sthe\senvironment\swill\sget\sblown\saway...\n\nMy\ssolution\sis\sto\sREALLY\sclean\sout\sthe\sauto_mkindex_parser::parser,\sby\sdeleting\sand\srecreating\sit\sbetween\seach\sfile.\s\sThis\sis\sa\slittle\sslower\sin\stheory,\sthough\snot\sdetectably\sso.\s\sHowever,\sit\sis\sMUCH\scleaner,\sand\smore\srobust.\n---------------\n\nI\sdon't\sunderstand\sthe\sproblem\shere.\s\sCan\syou\sprovide\sfurther\sexplainantion?\n\n-\seric\n\n--\s02/01/2000\sericm\n\nFrom\sJim:\n\nAnyway,\sback\sto\sthis\scase.\s\sThe\sbehavior\sthat\sI\sreported\shere\sis\nstraightforward,\sand\swrong.\s\sI\sam\snot\ssure\swhere\sthe\sconfusion\slies.\nIf\sI\sdo\sa\s"namespace\simport"\sin\sa\sfile\sthat\sI\sinclude\sin\sthe\nauto_mkindex\slist\sbefore\sthe\sfiles\sthat\sdefine\sthe\snamespace,\sthen\sthe\ncommands\sdefined\sin\sthat\snamespace\sdon't\sshow\sup\sin\sthe\stclIndex\sfile.\nThis\sis\sjust\sa\sbug,\sit\sis\spretty\ssimple.\n\nMoreover,\sit\shas\sbitten\sa\snumber\sof\speople\son\sthe\sItcl\smailing\slist\sat\nleast,\sand\sI\shave\ssent\sthem\sthe\sfix\sI\sgave\sbelow,\swhich\ssolved\sthe\nproblem.\s\sIt\scomes\sup,\sfor\sinstance,\sif\syou\shave\sa\sfairly\nstraightforward\sItcl\sapplication,\swith\sa\sfew\sapplication\stcl\sfiles,\nand\sa\smain.tcl\sfile\sthat\sdoes\sthe\simports,\sall\sin\sthe\ssame\sdirectory.\nIt\sis\squite\scommon\sin\sthat\scase\sto\shave\sa\smake\srule\slike:\n\nTCL\s:=\s$(*.tcl)\n\nITCL_SH\s=\sitclsh3.0\n\ntclIndex:\s$(TCL)\sMakefile\n\s\s\s\secho\s"auto_mkindex\s'pwd'\s$(TCL)"\s|\s$(ITCL_SH)\n\nThis\sis\sa\svery\ssimple\sway\sto\sgenerate\sthe\stclIndex,\sand\smeans\syou\ndon't\shave\sto\smess\swith\sadding\sfiles\sto\sthe\sMake\sline\severy\stime\syou\nadd\sa\snew\sone.\s\sHowever,\sin\sthis\ssetup,\syou\swill\shit\sthe\sbug\sI\sreported\nif\sthe\sordering\shappens\sto\sbe\swrong.\s\sFor\sno\sobvious\sreason,\syou\swill\nend\sup\swith\san\sincomplete\stclIndex\sfile.\s\sThis\ssituation\sdoes\snot\sseem\s\nso\scontrived\sto\sme.\n\nWhen\sI\sbrought\sthis\sup\swith\sBrent,\she\sagreed\sthat\sthis\swas\sa\sreal\nconcern,\sand\sthat\sthe\spatch\sI\ssuggested\swas\san\sacceptable\ssolution.\s\sI\nreally\scan't\sfigure\sout\show\sto\sexplain\sthe\sproblem\smore\sclearly\sthan\sI\ndid\soriginally.\s\sYou\sjust\sneed\sto\sread\sthe\sauto.tcl\sfile\sto\ssee\show\sit\nworks,\sand\shave\sa\slook\sat\show\sitcl\sadds\selements\sto\sthe\nauto_mkindex_parser\snamespace\sto\sgenerate\sclass\scommand\sreferences\sfor\nItcl\sclasses.\s\sThis\slittle\sbit\sof\scode\sis\ssomewhat\snarly,\sbut\snot\sthat\nbad.\s\sIf\syou\sare\sstill\sconfused,\syou\sshould\sask\sBrent,\she\scan\sprobably\ndo\sa\sbetter\sjob\sof\sexplaining\swhat\sis\sgoing\son\sin\sperson\sthan\sI\scan\sby\nmail.\n\n--\s02/02/2000\sericm\n\nMore\sfrom\sBrent/Jim:\n\nFrom\[email protected]\sWed\sFeb\s\s2\s14:06:05\s2000\nDate:\sWed,\s2\sFeb\s2000\s12:04:49\s-0800\s(PST)\nFrom:\sJames\sIngham\s<[email protected]>\nTo:\sBrent\sWelch\s<[email protected]>\nCc:\sEric\sMelski\s<[email protected]>,\[email protected]\nSubject:\sRe:\sScriptics\sBug\sDatabase--report\s1187\s(fwd)\s\n\nBrent,\sand\sEric...\n\nHere\sis\sthe\scontents\sof\sBrent\sand\smy\sprevious\sdiscussion\s(at\sleast\nyour\sside\sof\sit,\sI\sdidn't\sgo\sdig\smy\sreplies\sout\sof\smy\ssent\sbox,\sI\ndon't\sthink\sthey\sare\snecessary...\s\sAlmost\sat\sthe\sbottom\sare\sthe\sbits\nof\scode\sthat\sBrent\shacked\sout...\n\nJim\n\nFrom:\sBrent\sWelch\s<[email protected]>\nTo:\sJames\sIngham\s<[email protected]>\nSubject:\sRe:\s[Bug\sTcl\s8.0.4]\sauto_mkindex\sproduces\sbad\stclIndex\sfile\sin\ssome\s\n\ssituations\swhen\sused\swith\sItcl3.0\nDate:\sTue,\s26\sJan\s1999\s13:35:17\s-0800\n\nI\sunderstood\syou\smoving\sthe\sparser_init\sstuff\sinside\sthe\sper-file\sloop.\n\nI\shaven't\sunderstood\syour\sweirdo\snamespace\simport\sbug\s:-)\nCan\syou\sspoon\sfeed\sthe\sscenario\sto\sme\sagain?\n\n>>>James\sIngham\ssaid:\n\s>\sBrent,\n\s>\s\n\s>\sThanks...\s\sIt\stook\sa\slittle\swhile\sto\sfathom\sthis\sone.\s\sThe\smkindex\n\s>\scode\sis\spretty\scool,\sonce\syou\swrap\syour\shead\saround\sit,\showever...\n\s>\s\n\s>\sHave\syou\shad\sa\schance\sto\sthink\sabout\sthe\swierdo\snamespace\simport\sbug\sI\s\n\s>\smentioned?\s\sMichael\sis\sright\sto\sthink\sthat\sit\sis\skind\sof\sbogus\sthat\sa\n\s>\snamespace\simport\sshould\sforce\sthe\swhole\sset\sof\scommands\sin\sa\snamespace\s\n\s>\sto\sbe\sloaded,\sbut\sI\sdon't\ssee\sa\sgood\sway\saround\sthe\sexport\slist\n\s>\sissue.\s\sPerhaps\sthere\sneeds\sto\sbe\sa\snamespace\spreexport\sor\ssomething\n\s>\sgross\slike\sthat\sthat\sgets\swritten\sinto\sthe\stclIndex\sfile\sand\spopulates\s\n\s>\sthe\snamespace\sexport\slist\sin\sa\sway\sthat\swill\sget\sblown\saway\swhen\sa\n\s>\sreal\snamespace\sexport\scommand\sis\scalled\sfor\sthe\snamespace...\n\s>\s\n\s>\sIt\swould\sbe\sneat\sto\sget\sMichael's\sstuff\sworking,\sbut\sit\smay\sbe\stoo\n\s>\smuch\strouble...\n\s>\s\n\s>\sJim\n\s>\s\n\s>\s--\s\n\s>\s++==++==++==++==++==++==++==++==++==++==++==++==++==++==++==++==++==++==++\n\s>\sJim\sIngham\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\[email protected]\n\s>\sCygnus\sSolutions\sInc.\n\nFrom:\sBrent\sWelch\s<[email protected]>\nTo:\sJames\sIngham\s<[email protected]>\ncc:\[email protected]\nSubject:\sRe:\s[Bug\sTcl\s8.0.4]\sauto_mkindex\sproduces\sbad\stclIndex\sfile\sin\ssome\s\n\ssituations\swhen\sused\swith\sItcl3.0\nDate:\sTue,\s26\sJan\s1999\s15:50:54\s-0800\n\nOK,\sso\sI'm\saware\sof\sMichaels\sscheme\sto\sfirst\screate\sstubs\sand\nthen\shave\sthem\sload\stheir\sreal\simplementation.\s\sAre\syou\ssaying\nit\sis\sbroken?\s\sentirely,\sor\sjust\sin\ssome\scases?\n\nOK\s-\sI\sbelieve\sI\sunderstand.\s\sListen,\sI\sprototyped\ssome\scode\nthat\stries\sto\sremember\swhat\sexport\scommands\sto\sdo.\nCan\syou\stake\sa\speek\sat\sthe\sattached\sfile\sand\ssee\sif\sit\nis\splausible?\s\sLook\sat\sthe\svery\send\sfor\sa\stweak\sto\nauto_import\sand\sanother\sutility\scalled\s'addIndex',\nwhich\slogically\sbelongs\sin\sinit.tcl\n\n>>>James\sIngham\ssaid:\n\n\s>\sSo\swhat\she\sdoes\sis\sto\swrite\san\sauto_import\sproc\sthat\slooks\sat\sthe\n\s>\sauto_index\sarray,\sgets\sall\sthe\smatches\swith\sthe\simport\spattern,\sand\n\s>\smake\sSTUB\scommands\sfor\sthem\sin\sthe\ssource\snamespace.\s\sThe\sstub\n\s>\scommands\sare\sthen\sthe\sones\sthat\sget\simported\sinto\sthe\starget\n\s>\snamespace.\s\sThen,\swhen\sthe\simported\scommand\sis\sactually\sused,\sthe\n\s>\sstub\scommand\sdeletes\sitself,\sand\ssources\sin\sthe\sreal\scommand\sinstead.\n\s>\s\n\s>\s\n\s>\sMaking\sthe\sstub\scommands\sis\spretty\sfast,\sso\sthis\sis\sa\sbig\swin\sin\n\s>\sstartup\stime,\sif\sthere\sare\sa\slot\sof\spackages\sin\snamespaces.\n\s>\s\n\s>\sThe\sproblem\swith\sthis\sis\sthat\sthe\stclIndex\sfile\sknows\snothing\sabout\n\s>\sthe\sexport\slist\sfor\sthe\ssource\snamespace,\sand\sso\sNO\sCOMMANDS\sare\n\s>\sexported\sinto\sthe\starget\snamespace\sin\sthe\sactual\sbody\sof\sthe\snamespace\s\n\s>\simport\sC\scommand.\s\s\n\nI\scan't\smake\sthe\sleap\sto\sthis\sconclusion\swithout\smore\sdetails.\n\n\s>\sThe\sonly\sway\sI\scan\sthink\sof\sto\sfix\sthis\sproblem\sis\sto\sput\ssomething\sin\s\n\s>\sthe\stclIndex\sfile\sthat\srecords\swhat\snamespace\sexport\slists\swere\n\s>\sregistered\sas\sthe\scode\swas\sanalysed\sby\sthe\sauto_mkindex\sprocess.\n\s>\sHowever,\sthis\sis\snot\sentirely\strivial...\n\s>\s\n\s>\sAnyway,\sas\sit\sstands,\sItcl\sis\spretty\sbroken.\s\sYou\sbasically\scan't\sdo\n\s>\snamespace\simport\susing\sItcl,\sand\sthen\shave\sthe\sproc\sbe\sautoloaded\n\s>\susing\sthe\simported\sversion\sof\sthe\sproc.\s\sThis\sat\sleast\sneeds\sto\sbe\n\s>\sfixed\s(by\swhacking\sMichael's\sversion\sof\sthe\sauto_import\scommand.)\n\nSo\s-\sthe\s.tcl\sfile\shas\s"namespace\sexports"\sthat\strigger\sthe\ncreation\sof\sstub\sprocedures.\s\sThe\scaller\sdoes\s"import\sns::*"\nand\sthis\screates\sns::*\sprocedures\sthat\sare\sstubs\s(in\sthe\sItcl\scase).\nAnd\swhat\sis\smissing\sis\sthe\s"namespace\sexport"\scommand\shas\snot\nbeen\sexecuted.\s\sRight?\s\s(I\sthink\sso).\nSo,\sthe\sfix\sis\sto\shave\sthe\scode\sthat\sgenerates\sthe\sstubs\salso\ngenerate\sthe\s"namespace\sexport"\scommand.\n\n\s>\sWorking\sto\sfix\sup\sMichael's\sstuff\swould\sbe\scool,\sbut\swould\srequire\n\s>\ssome\smore\scareful\sengineering\sto\sget\sit\sright.\s\sThink\sfor\sinstance,\sof\s\n\s>\sthe\shorrors\syou\scould\sget\sinto\sif\sa\snamespace\swas\sbroken\sup\sinto\n\s>\sseveral\sfiles,\sand\s"namespace\s-clear"\swas\sEVER\sused...\s\sYecch!\n\nI'm\sinclined\sto\sto\sworry\sabout\sthe\sweird\scases\sso\smuch...\n\n--Brent\sWelch<[email protected]>\nhttp://www.scriptics.com\nScriptics:\sThe\sTcl\sPlatform\sCompany\n\n#\n#\sitcl.tcl\n#\s----------------------------------------------------------------------\n#\sInvoked\sautomatically\supon\sstartup\sto\scustomize\sthe\sinterpreter\n#\sfor\s[incr\sTcl].\n#\s----------------------------------------------------------------------\n#\s\s\sAUTHOR:\s\sMichael\sJ.\sMcLennan\n#\s\s\s\s\s\s\s\s\s\s\s\sBell\sLabs\sInnovations\sfor\sLucent\sTechnologies\n#\s\s\s\s\s\s\s\s\s\s\s\[email protected]\n#\s\s\s\s\s\s\s\s\s\s\s\shttp://www.tcltk.com/itcl\n#\n#\s\s\s\s\s\sRCS:\s\s$Id:\sitcl.tcl,v\s1.2\s1998/08/11\s14:40:44\swelch\sExp\s$\n#\s----------------------------------------------------------------------\n#\s\s\s\s\s\s\s\s\s\s\s\sCopyright\s(c)\s1993-1998\s\sLucent\sTechnologies,\sInc.\n#\s======================================================================\n#\sSee\sthe\sfile\s"license.terms"\sfor\sinformation\son\susage\sand\n#\sredistribution\sof\sthis\sfile,\sand\sfor\sa\sDISCLAIMER\sOF\sALL\sWARRANTIES.\n\n#\s----------------------------------------------------------------------\n#\s\sUSAGE:\s\slocal\s<className>\s<objName>\s?<arg>\s<arg>...?\n#\n#\s\sCreates\sa\snew\sobject\scalled\s<objName>\sin\sclass\s<className>,\spassing\n#\s\sthe\sremaining\s<arg>'s\sto\sthe\sconstructor.\s\sUnlike\sthe\susual\n#\s\s[incr\sTcl]\sobjects,\showever,\san\sobject\screated\sby\sthis\sprocedure\n#\s\swill\sbe\sautomatically\sdeleted\swhen\sthe\slocal\scall\sframe\sis\sdestroyed.\n#\s\sThis\scommand\sis\suseful\sfor\screating\sobjects\sthat\sshould\sonly\sremain\n#\s\salive\suntil\sa\sprocedure\sexits.\n#\s----------------------------------------------------------------------\nproc\s::itcl::local\s{class\sname\sargs}\s{\n\s\s\s\sset\sptr\s[uplevel\seval\s[list\s$class\s$name]\s$args]\n\s\s\s\suplevel\s[list\sset\sitcl-local-$ptr\s$ptr]\n\s\s\s\sset\scmd\s[uplevel\snamespace\swhich\s-command\s$ptr]\n\s\s\s\suplevel\s[list\strace\svariable\sitcl-local-$ptr\su\s\s"itcl::delete\sobject\s$cmd;\slist"]\n\s\s\s\sreturn\s$ptr\n}\n\n#\s----------------------------------------------------------------------\n#\sauto_mkindex\n#\s----------------------------------------------------------------------\n#\sDefine\sItcl\scommands\sthat\swill\sbe\srecognized\sby\sthe\sauto_mkindex\n#\sparser\sin\sTcl...\n#\n\n#\n#\sUSAGE:\s\sitcl::class\sname\sbody\n#\sAdds\san\sentry\sfor\sthe\sgiven\sclass\sdeclaration.\n#\nforeach\scmd\s{itcl::class\sitcl_class}\s{\n\s\s\s\sauto_mkindex_parser::command\s$cmd\s{name\sbody}\s{\naddIndex\s$name\n\n\s\s\s\s\s\s\s\svariable\sparser\n\s\s\s\s\s\s\s\svariable\scontextStack\n\s\s\s\s\s\s\s\sset\scontextStack\s[linsert\s$contextStack\s0\s$name]\n\s\s\s\s\s\s\s\s$parser\seval\s$body\n\s\s\s\s\s\s\s\sset\scontextStack\s[lrange\s$contextStack\s1\send]\n\s\s\s\s}\n}\n\n#\n#\sUSAGE:\s\sitcl::body\sname\sarglist\sbody\n#\sAdds\san\sentry\sfor\sthe\sgiven\smethod/proc\sbody.\n#\nauto_mkindex_parser::command\sitcl::body\s{name\sarglist\sbody}\s{\n\s\s\s\saddIndex\s$name\n}\n\n#\n#\sUSAGE:\s\sitcl::configbody\sname\sarglist\sbody\n#\sAdds\san\sentry\sfor\sthe\sgiven\smethod/proc\sbody.\n#\nauto_mkindex_parser::command\sitcl::configbody\s{name\sbody}\s{\n\s\s\s\saddIndex\s$name\n}\n\n#\n#\sUSAGE:\s\sensemble\sname\s?body?\n#\sAdds\san\sentry\sto\sthe\sauto\sindex\slist\sfor\sthe\sgiven\sensemble\sname.\n#\nauto_mkindex_parser::command\sitcl::ensemble\s{name\s{body\s""}}\s{\n\s\s\s\saddIndex\s$name\n}\n\n#\n#\sUSAGE:\s\spublic\sarg\s?arg\sarg...?\n#\s\s\s\s\s\s\s\s\sprotected\sarg\s?arg\sarg...?\n#\s\s\s\s\s\s\s\s\sprivate\sarg\s?arg\sarg...?\n#\n#\sEvaluates\sthe\sarguments\sas\scommands,\sso\swe\scan\srecognize\sproc\n#\sdeclarations\swithin\sclasses.\n#\nforeach\scmd\s{public\sprotected\sprivate}\s{\n\s\s\s\sauto_mkindex_parser::command\s$cmd\s{args}\s{\n\s\s\s\s\s\s\s\svariable\sparser\n\s\s\s\s\s\s\s\s$parser\seval\s$args\n\s\s\s\s}\n}\n\n#\s----------------------------------------------------------------------\n#\sauto_import\n#\s----------------------------------------------------------------------\n#\sThis\sprocedure\soverrides\sthe\susual\s"auto_import"\sfunction\sin\sthe\n#\sTcl\slibrary.\s\sIt\sis\sinvoked\sduring\s"namespace\simport"\sto\smake\ssee\n#\sif\sthe\simported\scommands\sreside\sin\san\sautoloaded\slibrary.\s\sIf\sso,\n#\sstubs\sare\screated\sto\srepresent\sthe\scommands.\s\sExecuting\sa\sstub\n#\slater\son\scauses\sthe\sreal\simplementation\sto\sbe\sautoloaded.\n#\n#\sArguments\s-\n#\spatternThe\spattern\sof\scommands\sbeing\simported\s(like\s"foo::*")\n#\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sa\scanonical\snamespace\sas\sreturned\sby\s[namespace\scurrent]\n\nproc\sauto_import\s{pattern}\s{\n\s\s\s\sglobal\sauto_index\n\s\s\s\sglobal\sauto_import\n\n\s\s\s\sset\sns\s[uplevel\snamespace\scurrent]\n\s\s\s\sset\spatternList\s[auto_qualify\s$pattern\s$ns]\n\n\s\s\s\sauto_load_index\n\n\s\s\s\sforeach\spattern\s$patternList\s{\n\s\s\s\s\s\s\s\sforeach\sname\s[array\snames\sauto_index\s$pattern]\s{\n\s\s\s\s\s\s\s\s\s\s\s\sif\s{""\s==\s[info\scommands\s$name]}\s{\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s::itcl::import::stub\screate\s$name\nif\s{[info\sexists\sauto_import($name)]}\s{\n\s\s\s\sset\sns\s[namespace\squalifiers\s$name]\n\s\s\s\snamespace\seval\s$ns\s[list\snamespace\sexport\s$auto_import($name)]\n}\n\s\s\s\s\s\s\s\s\s\s\s\s}\n\s\s\s\s\s\s\s\s}\n\s\s\s\s}\n}\n\nproc\sauto_mkindex_parser::addIndex\s{name}\s{\n\s\s\s\svariable\sindex\n\s\s\s\svariable\sscriptFile\n\n\s\s\s\s#\sAdd\sthe\susual\sauto_index\selement\sfor\sthe\sfully-qualified\sname\n\n\s\s\s\sset\sfull\s[fullname\s$name]\n\s\s\s\sappend\sindex\s"set\s[list\sauto_index($full)]"\n\s\s\s\sappend\sindex\s"\s\\[list\ssource\s\\[file\sjoin\s\\$dir\s[list\s$scriptFile]\\]\\]\\n"\n\n\s\s\s\s#\sSee\sif\sthe\sname\sis\sexported,\sand\sif\sso,\snote\sthat\sin\sauto_import\n\n\s\s\s\sset\sns\s[namespace\squalifiers\s$full]\n\s\s\s\sset\stail\s[namespace\stail\s$full]\n\s\s\s\sforeach\spat\s[namespace\seval\s$ns\s{\snamespace\sexport\s}]\s{\nif\s{[string\smatch\s$pat\s$tail]}\s{\n\s\s\s\sappend\sindex\s"[list\sset\sauto_import($full)\s$pat]\\n"\n\s\s\s\sbreak\n}\n\s\s\s\s}\n}\n\n--==_Exmh_7642084930--\n\nFrom:\sBrent\sWelch\s<[email protected]>\nTo:\sJames\sIngham\s<[email protected]>\ncc:\[email protected]\nSubject:\sRe:\s[Bug\sTcl\s8.0.4]\sauto_mkindex\sproduces\sbad\stclIndex\sfile\sin\ssome\s\n\ssituations\swhen\sused\swith\sItcl3.0\nDate:\sWed,\s27\sJan\s1999\s15:15:30\s-0800\n\nOK\s-\sgroan\s-\sI\sre-wrapping\smy\smind\saround\sthe\smkindex\sparser.\nThe\snamespace\swrapper\sis\smaintaining\sa\s"contextStack"\svariable,\nwhich\sI\sthink\shas\sour\snamespace\sinformation\sback\son\sthe\smaster\sside.\n\nHmm\s-\sthe\snamespace\swrapper\sdoesn't\seven\screate\sthe\snamespaces\nin\sthe\sslave\sinterpreter\s-\sso\smaybe\swe\sdon't\shave\sto\sexecute\nnamespace\sexport\scommands\seither.\s\sWe\sjust\ssave\stheir\sexport\ncommands\son\sthe\smaster\sand\sdo\sall\sintrospection\sthrough\sthose\s\nvariables.\sSo,\ssomething\slike:\n\nauto_mkindex_parser::command\snamespace\s{op\sargs}\s{\n\s\s\s\svariable\s$parser\n\s\s\s\sswitch\s--\s$op\s{\n\s\s\s\s\s\s\s\seval\s{\n\s\s\s\s\s\s\s\s\s\s\s\svariable\sparser\n\s\s\s\s\s\s\s\s\s\s\s\svariable\scontextStack\n\s\s\s\s\s\s\s\s\s\s\s\svariable\sexports\n\n\s\s\s\s\s\s\s\s\s\s\s\sset\sname\s[lindex\s$args\s0]\n\s\s\s\s\s\s\s\s\s\s\s\sset\sargs\s[lrange\s$args\s1\send]\n\n\s\s\s\s\s\s\s\s\s\s\s\sif\s{![info\sexist\sexports($name)]}\s{\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sset\sexports($name)\s{}\n\s\s\s\s\s\s\s\s\s\s\s\s}\n\s\s\s\s\s\s\s\s\s\s\s\sset\scontextStack\s[linsert\s$contextStack\s0\s$name]\n\s\s\s\s\s\s\s\s\s\s\s\sif\s{[llength\s$args]\s==\s1}\s{\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s$parser\seval\s[lindex\s$args\s0]\n\s\s\s\s\s\s\s\s\s\s\s\s}\selse\s{\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\seval\s$parser\seval\s$args\n\s\s\s\s\s\s\s\s\s\s\s\s}\n\s\s\s\s\s\s\s\s\s\s\s\sset\scontextStack\s[lrange\s$contextStack\s1\send]\n\s\s\s\s\s\s\s\s}\n\s\s\s\s\s\s\s\simport\s{\n\s\s\s\s\s\s\s\s\s\s\s\svariable\sparser\n\s\s\s\s\s\s\s\s\s\s\s\svariable\simports\n\s\s\s\s\s\s\s\s\s\s\s\sforeach\spattern\s$args\s{\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sif\s{$pattern\s!=\s"-force"}\s{\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\slappend\simports\s$pattern\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s}\n\s\s\s\s\s\s\s\s\s\s\s\s}\n\s\s\s\s\s\s\s\s\s\s\s\scatch\s{$parser\seval\s"_%@namespace\simport\s$args"}\n\s\s\s\s\s\s\s\s}\n\s\s\s\s\s\s\s\sexport\s{\n\s\s\s\s\s\s\s\s\s\s\s\svariable\sparser\n\s\s\s\s\s\s\s\s\s\s\s\svariable\sexports\n\s\s\s\s\s\s\s\s\s\s\s\svariable\scontextStack\n\s\s\s\s\s\s\s\s\s\s\s\sset\scurrent\s[lindex\s$contextStack\s0]\n\s\s\s\s\s\s\s\s\s\s\s\sforeach\sa\s$args\s{\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\slappend\sexports($current)\s$a\n\s\s\s\s\s\s\s\s\s\s\s\s}\n\s\s\s\s\s\s\s\s}\s\s\s\n\s\s\s\s}\n}\n\n(The\sexport\slist\sneeds\sto\sget\scleaned\sup)\nand\n\nproc\sauto_mkindex_parser::addIndex\s{name}\s{\n\s\s\s\svariable\sindex\n\s\s\s\svariable\sscriptFile\n\s\s\s\svariable\sparser\n\s\s\s\svariable\scontextStack\n\s\s\s\svariable\sexports\n\n\s\s\s\s#\sAdd\sthe\susual\sauto_index\selement\sfor\sthe\sfully-qualified\sname\n\n\s\s\s\sset\sfull\s[fullname\s$name]\n\s\s\s\sappend\sindex\s"set\s[list\sauto_index($full)]"\n\s\s\s\sappend\sindex\s"\s\\[list\ssource\s\\[file\sjoin\s\\$dir\s[list\s$scriptFile]\\]\\]\\n"\n\n\s\s\s\s#\sSee\sif\sthe\sname\sis\sexported,\sand\sif\sso,\snote\sthat\sin\sauto_import\n\n\s\s\s\sset\sns\s[namespace\squalifiers\s$full]\n\s\s\s\sset\stail\s[namespace\stail\s$full]\n\s\s\s\sset\scurrent\s[lindex\s$contextStack\s0]\n\s\s\s\sforeach\spat\s$exports($current)\s{\n\s\s\s\s\s\s\s\sif\s{[string\smatch\s$pat\s$tail]}\s{\n\s\s\s\s\s\s\s\s\s\s\s\sappend\sindex\s"[list\sset\sauto_import($full)\s$pat]\\n"\n\s\s\s\s\s\s\s\s\s\s\s\sbreak\n\s\s\s\s\s\s\s\s}\n\s\s\s\s}\n}\n\nFrom:\sBrent\sWelch\s<[email protected]>\nTo:\sJames\sIngham\s<[email protected]>\nSubject:\sRe:\s[Bug\sTcl\s8.0.4]\sauto_mkindex\sproduces\sbad\stclIndex\sfile\sin\ssome\s\n\ssituations\swhen\sused\swith\sItcl3.0\nDate:\sWed,\s27\sJan\s1999\s18:18:03\s-0800\n\nOK\s-\sunfortunately\sthis\sis\sa\schange\sin\sboth\sTcl\sand\sItcl,\nso\sI'll\shave\sto\sset\stime\saside\ssoon\sto\sdo\ssome\stesting\smyself.\n\n>>>James\sIngham\ssaid:\n\s>\sBrent,\n\s>\s\n\s>\sThat\slooks\spretty\sgroovy.\s\sYou\shave\sfound\sthe\smissing\spiece\sthat\sI\n\s>\scould\snot\sget\sright...\s\sI\sam\skind\sof\spressed\sright\snow,\sso\sI\sdon't\n\s>\shave\stime\sto\stry\sit\sout\syet,\sbut\sthis\slooks\sright.\n\s>\s\n\s>\sDo\syou\sneed\sto\sdo\ssomething\sabout\sthe\suse\sof\s"namespace\sexport\n\s>\s-clear"?\s\sI\sthink\sif\ssomeone\sdoes\sthis,\syou\spretty\smuch\slose.\s\sThere\n\s>\sare\stwo\spossible\scases:\n\s>\s\n\s>\s1)\sThey\sdo\snamespace\sexport\s&\snamespace\sexport\s-clear\sin\sthe\ssame\n\s>\sfile.\s\sYou\scould\shandle\sthis,\sbut\sit\sis\ssuch\sa\sstupid\sthing\sto\sdo\sthat\s\n\s>\sI\sdon't\sknow\swhy\syou\swould\swant\sto.\n\s>\s\n\s>\s2)\sIf\sthere\sis\sa\snamespace\sexport\sin\sone\sfile,\sand\sa\snamespace\sexport\n\s>\s-clear\sin\sanother,\sfor\sthe\ssame\snamespace.\s\sThere\sis\sno\sgood\sway\sto\n\s>\shandle\sthis,\ssince\syou\scan't\sguarantee\sthat\sthe\sorder\sin\swhich\syou\n\s>\sprocess\sthe\sfiles\sin\sthe\sauto_mkindex\sprocess,\sand\sthe\sorder\sthat\sthey\n\s>\sare\ssourced\sin\swhen\syou\sactually\sload\sstuff\swill\sbe\sthe\ssame\s(or\seven\n\s>\sTHAT\sboth\sfiles\swill\sget\ssourced\sin\swhen\syou\sload\sa\sgiven\sproc,\sfor\n\s>\sthat\smatter)\n\s>\s\n\s>\sIn\sany\scase,\snamespace\sexport\s-clear\sseems\sto\sme\sto\sbe\smore\sof\sa\n\s>\sdevelopment\sprocess\scommand,\sand\snot\sa\srelease\scommand,\sso\sI\swouldn't\n\s>\sworry\stoo\smuch\sabout\sit\sunless\syou\scan\sthink\sof\ssome\sreally\sclever\sway\s\n\s>\sto\shandle\sit.\n\s>\s\n\s>\sJim.\n\n--Brent\sWelch<[email protected]>\nhttp://www.scriptics.com\nScriptics:\sThe\sTcl\sPlatform\sCompany\n\nThis\sis\sthe\send\sof\swhat\sI\shave\sgot...\s\sHope\sthis\shelps.\n\nJim\n\n--\s02/02/2000\sericm\n\n
J foundin obsolete:\s8.0.4
J priority 5\sMedium
J resolution None
J status Deleted
J submitter nobody
J subsystem 56.\sLibTomMath
J title auto_mkindex\sproduces\sbad\stclIndex\sfile\sin\ssome\ssituations\sw
J type Bug
K 219265ffffffffffffffffffffffffffffffffff
U nobody
Z 82eb73342e0b3910f6907e541ba2f050