<i>Patch to 'glob' for improved speed and cross-platform operab</i>.
by
.
D 2000-10-26T00:45:19
J assignee nobody
J cmimetype text/plain
J comment OriginalBugID:\s2258\sRFE\nVersion:\s8.1.1\nSubmitDate:\s'1999-06-21'\nLastModified:\s'1999-08-06'\nSeverity:\sMED\nStatus:\sClosed\nSubmitter:\stechsupp\nChangedBy:\shobbs\nRelatedBugIDs:\s2363\nOS:\sWindows\sNT\nOSVersion:\s4.0sp3\nMachine:\sX86\nFixedDate:\s'2000-10-25'\nClosedDate:\s'1999-08-06'\n\n\nName:\nvince\sdarley\n\nCVS:\nRCS:\s@(#)\s$Id:\schanges,v\s1.45\s1999/05/26\s02:39:12\sstanton\sExp\s$\n\nCustomShell:\nnone.\n\nDesiredBehavior:\nChanges\sto\sglob\s(Vince\sDarley,\sJune\s1999):\n\s\s\s\s\n\s\s\s\sNote:\sthis\spatch\sincludes\sadditions\sto\sthe\stest\ssuite\sfor\sthe\snew\n\s\s\s\sfeatures.\n\s\s\s\sIt\sdoes\snot\sinclude\schanges\sto\sthe\sman\spages,\sbut\sa\sreasonably\sdetailed\n\s\s\s\s\n\s\s\s\sdescription\sfollows:\n\s\s\s\s\n\s\s\s\s\s#\sBackwards\scompatible\sextensions\sto\sthe\s'glob'\scommand\sto\saddress\n\s\s\s\s\s#\ssome\scurrent\sissues:\n\s\s\s\s\s#\s\n\s\s\s\s\s#\sThe\scurrent\sglob\suses\s'Tcl_AppendElement'\sinternally;\sthis\shas\n\s\s\s\s\s#\sbeen\schanged\sto\sthe\sObject\sAPIs.\n\s\s\s\s\s#\s\n\s\s\s\s\s#\s'file\sjoin'\sis\sincompatible\swith\sbackslash-quoted\sdirectory\spaths,\n\s\s\s\s\s#\sso\sit\sis\svery\sdifficult\sto\sdeal\swith\spaths\scontaining\n\s\s\s\s\s#\sglob-sensitive\scharacters\sin\sa\scross-platform\sway.\s\sE.g.\sthe\suser\n\s\s\s\s\s#\sselects\sa\sdirectory\sin\sa\sdirectory-chooser,\sand\sI\swish\sto\sfind\s(i)\n\s\s\s\s\s#\sall\shtml\sfiles\sin\sthat\sdirectory;\s(ii)\sall\shtml\sfiles\sin\sany\n\s\s\s\s\s#\ssub-directory\sof\sthat\sdirectory;\s(iii)\sall\ssubdirectories\sof\sthat\n\s\s\s\s\s#\sdirectory\swhich\scontain\sthe\sword\s'hello'.\s\sWith\sthe\snew\sglob,\sthis\n\s\s\s\s\s#\scan\sbe\sachieved\sin\sa\ssimple,\scross-platform\sway\sas\sfollows:\n\s\s\s\s\s#\s\n\s\s\s\s\s#\s(i)\s\n\s\s\s\s\s#\s\n\s\s\s\s\s#\sset\sdir\s[tk_chooseDirectory]\n\s\s\s\s\s#\sset\shtml_files\s[glob\s-dir\s$dir\s*.html]\n\s\s\s\s\s#\s\n\s\s\s\s\s#\s(ii)\n\s\s\s\s\s#\s\n\s\s\s\s\s#\sset\sdir\s[tk_chooseDirectory]\n\s\s\s\s\s#\sset\ssub_dir_html_files\s[glob\s-join\s-dir\s$dir\s*\s*.html]\n\s\s\s\s\s#\s\n\s\s\s\s\s#\s(iii)\n\s\s\s\s\s#\s\n\s\s\s\s\s#\sset\sdir\s[tk_chooseDirectory]\n\s\s\s\s\s#\sset\ssub_dirs\s[glob\s-type\sd\s-dir\s$dir\s*hello*]\n\s\s\s\s\s#\s\n\s\s\s\s\s#\sThese\swill\swork\seven\sif\s'$dir'\scontains\s[]{}*+\\?\s\scharacters,\n\s\s\s\s\s#\swhich\swould\sbe\sdifficult\sto\sachieve\susing\sthe\sold\sglob,\swithout\n\s\s\s\s\s#\sexplicit\sbackslash\squoting\sof\s'dir',\sand\swithout\sexplicit\suse\sof\n\s\s\s\s\s#\sthe\scurrent\splatform's\sdirectory\sseparator\s(':'\son\sMacOS,\n\s\s\s\s\s#\sbackslash\sor\sforward\sslash\son\sother\splatforms).\s\sUsing\sthis\n\s\s\s\s\s#\sversion\sof\sglob\shas\sallowed\sme\sto\ssimplify\sotherwise\smessy\scode,\n\s\s\s\s\s#\sand\sremove\sbugs\scaused\sby\suser-selected\spaths\scontaining\sbad\n\s\s\s\s\s#\scharacters.\n\s\s\s\s\s#\s\n\s\s\s\s\s#\sSyntax:\n\s\s\s\s\s#\s\s\s\n\s\s\s\s\s#\s\s\sglob\s?switches?\sname\s?name\s...?\n\s\s\s\s\s#\s\s\s\n\s\s\s\s\s#\sSwitches:\n\s\s\s\s\s#\s\n\s\s\s\s\s#\s\s\s-nocomplain:\s\s\sif\sno\sfiles\sare\sfound,\sreturn\san\sempty\sstring,\n\s\s\s\srather\n\s\s\s\s\s#\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sthan\ssignal\san\serror.\n\s\s\s\s\s#\s\s\s\s\s\n\s\s\s\s\s#\s\s\s-join:\s\s\s\s\s\s\s\s\sthe\sremaining\s'name'\sarguments\sare\streated\sas\s\n\s\s\s\s\s#\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sa\spath\sspecification\sto\sbe\shandled\swith\s'file\n\s\s\s\s\s#\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sjoin'.\n\s\s\s\s\s#\s\s\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-dir\s<pat>:\s\s\s\ssearch\sfor\spatterns\sstarting\sin\sthis\sdirectory\n\s\s\s\s\s#\s\s\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-path\s<path>:\s\ssearch\sfor\spatterns\sstarting\swith\sthis\spath\n\s\s\s\s\s#\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sprefix\s(i.e.\sa\sdirectory\sand\sa\sfile\sprefix).\n\s\s\s\s\s#\s\s\s\n\s\s\s\s\s#\s\s\s-types\s<list\sof\stypes>:\sonly\slist\sfiles/directories\sof\sone\sof\n\s\s\s\s\s#\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sthe\stypes\slisted.\s\sCurrently\sonly\stype\s'd'\sis\n\s\s\s\s\s#\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\ssupported,\swhich\slists\sonly\sdirectories\s(hence\n\s\s\s\s\s#\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\savoiding\sthe\sneed\sto\sspecify\sa\splatform\sspecific\n\s\s\s\s\s#\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sseparator\schar),\sbut\sin\sthe\sfuture,\smore\stypes\n\s\s\s\s\s#\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s(possibly\splatform\sspecific)\swill\sbe\ssupported:\n\s\s\s\s\s#\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\se.g.\son\sMacOS\stypes\ssuch\sas\s'TEXT',\s'APPL'\swill\sbe\n\s\s\s\s\s#\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\ssupported.\s\sUnrecognised\stypes\sare\signored\sby\sglob.\n\s\s\s\s\s#\s\s\s\n\s\s\s\s\s#\s\s\s--\s\s\s\s\s\s\s\s\s\s\s\s\ssignals\sthe\send\sof\sswitches,\seven\sif\sthe\snext\s\n\s\s\s\s\s#\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sargument\sstarts\swith\sa\s'-'.\n\s\s\s\s\s#\s\n\s\s\s\s\s#\sEach\sname\sargument\sis\shandled\sseparately,\sunless\s'-join'\sis\n\s\s\s\s\s#\spresent.\s\sNote\sthe\sthe\s'-dir'\sand\s'-path'\sflags\sare\smutually\n\s\s\s\s\s#\sexclusive.\n\s\s\s\s\n\s\s\s\sAdded\scross\splatform\stest\scases\sfor\s-dir,\s-path,\s-join,\s-types\sto\n\s\s\s\sfileName.test,\n\s\s\s\sand\sfixed\sa\sfew\sold\stests\swhose\sresults\schanged\sas\sa\sresult\sof\sthis\n\s\s\s\scode.\n\s\s\s\s\n\s\s\s\sIntroduced\sa\snew\sfunction\sTclpMatchFilesTypes\swhich\seffectively\n\s\s\s\sreplaces\n\s\s\s\sTclpMatchFiles.\s\sIt\scurrently\shas\sthe\ssame\sfunctionality,\sbut\stakes\san\n\s\s\s\sextra\sargument\swhich\swill\sbe\sused\sto\smatch\sfile\stype\sinformation.\s\sThis\n\s\s\s\swill\sallow\sspecification\sof,\se.g.,\sexecutable\sfiles,\sMacOS\sfile\stypes,\n\s\s\s\sinvisible\sfiles\setc.\s\sAt\sthe\smoment\sonly\s'-types\sd'\sis\srecognised.\s\sAll\n\s\s\s\sother\sarguments\sto\s-types\sare\ssimply\signored.\n\s\s\s\s\n\s\s\s\sObjectified\sthe\sbuild\sup\sof\sthe\slist\sof\sfiles\sto\sbe\sreturned\sby\sglob.\n\s\s\s\sThis\sinvolves\s\n\s\s\s\sminor\schanges\sto\seach\splatform\sspecific\sTclpMatchFiles\sfunction,\sso\sthat\n\s\s\s\sTcl_AppendElement\n\s\s\s\sis\snot\sused\s(instead\sTcl_ListObjAppendElement\son\sTcl_GetObjResult\sis\n\s\s\s\sused).\s\sI've\n\s\s\s\stested\sthis\sso\sduring\s'set\sf\s[glob\s*]\s;\sset\sf\s{}'\sthe\sfunction\n\s\s\s\sUpdateStringOfList\n\s\s\s\sis\snever\scalled.\s\sHowever\sthis\sonly\sseems\sto\sachieve\sa\s5%\sspeedup,\swhich\n\s\s\s\sis\srather\n\s\s\s\ssurprising\s(to\sme!).\s\sThe\stest\scase\sI\sused\swas:\n\s\s\s\s\n\s\s\s\scd\sTcl/lib\n\s\s\s\stime\s{set\sblah\s{}\s;\sforeach\sf\s[glob\s*8.1/*]\s{\slappend\sblah\s$f\s}\s;\sset\n\s\s\s\sblah\s{}}\s100\n\nPatch:\nftp://ftp.ucsd.edu/pub/alpha/tcl/extensions/glob.patch\n\nPatchFiles:\n$\sdiff\s-c3\s-r\s-X\spatchignore\s-q\stcl8.1\stcl8.1orig\n\s\s\s\sFiles\stcl8.1/generic/tclEncoding.c\sand\stcl8.1orig/generic/tclEncoding.c\n\s\s\s\sdiffer\n\s\s\s\sFiles\stcl8.1/generic/tclFileName.c\sand\stcl8.1orig/generic/tclFileName.c\n\s\s\s\sdiffer\n\s\s\s\sFiles\stcl8.1/generic/tclInt.decls\sand\stcl8.1orig/generic/tclInt.decls\n\s\s\s\sdiffer\n\s\s\s\sFiles\stcl8.1/generic/tclInt.h\sand\stcl8.1orig/generic/tclInt.h\sdiffer\n\s\s\s\sFiles\stcl8.1/mac/tclMacFile.c\sand\stcl8.1orig/mac/tclMacFile.c\sdiffer\n\s\s\s\sFiles\stcl8.1/tests/fileName.test\sand\stcl8.1orig/tests/fileName.test\n\s\s\s\sdiffer\n\s\s\s\sFiles\stcl8.1/unix/tclUnixFile.c\sand\stcl8.1orig/unix/tclUnixFile.c\sdiffer\n\s\s\s\sFiles\stcl8.1/win/tclWinFile.c\sand\stcl8.1orig/win/tclWinFile.c\sdiffer\n\n\n\nTcl\s8.1.1\sRequest\n\nName:\s\svince\sdarley\nemail:\s\[email protected]\nSupport:\s\sNone\nSeverity:\s\s3\nSynopsis:\s\spatch\sfor\sglob\scontinued\n\nDesiredBehavior:\n\s\s\s\sI've\snow\supdated\sthe\sman\spage\sfor\smy\schanges\sto\sglob.\s\sMy\spatch\snow\n\s\s\s\sincludes:\n\s\s\s\s(i)\simprovements\sto\sglob\sfor\sbetter\scross-platform\sfunctionality\n\s\s\s\s(ii)\sspeedups\s(use\slist-obj\soperations\sinternally)\n\s\s\s\s(iii)\stest\ssuite\sfor\sall\snew\sfeatures\n\s\s\s\s(iv)\sman\spage\n\s\s\s\s\n\s\s\s\s\n\nPatch:\nHere's\sthe\spatch\s(same\sas\sposted\sbefore)\nftp://ftp.ucsd.edu/pub/alpha/tcl/extensions/glob.patch\nHere's\sthe\snew\sman\spage:\nftp://ftp.ucsd.edu/pub/alpha/tcl/extensions/glob.n\n\nPosted\sTo\scomp.lang.tcl:\sPosted\sSuccessfully\n\n\s\n--\s07/19/1999\sjenn
J foundin final:\s8.1.1
J priority 5\sMedium
J resolution None
J status Open
J submitter nobody
J subsystem 69.\sOther
J title Patch\sto\s'glob'\sfor\simproved\sspeed\sand\scross-platform\soperab
J type RFE
K 217880ffffffffffffffffffffffffffffffffff
U nobody
Z 927e6b22d6c50b5ba3ea498c4883c3e4