Skip to content
Tcl Source Code Artifact [dd3fe363bd]
Login

Artifact [dd3fe363bd]

Artifact dd3fe363bd2d648adf54df432899ee669eecff1a:

Ticket change [dd3fe363bd] - New ticket [218751ffffffffff|218751ffff] <i>Updated string command, take 2</i>. by nobody on 2000-10-26 01:04:56.
D 2000-10-26T01:04:56
J assignee nobody
J cmimetype text/plain
J comment OriginalBugID:\s1992\sRFE\nVersion:\s8.1\nSubmitDate:\s'1999-05-05'\nLastModified:\s'1999-05-07'\nSeverity:\sLOW\nStatus:\sReleased\nSubmitter:\spat\nChangedBy:\sstanton\nOS:\sSolaris\nOSVersion:\s2.5.1\nMachine:\sOther\nFixedDate:\s'1999-05-07'\nFixedInVersion:\s8.1.1\nClosedDate:\s'2000-10-25'\n\n\nName:\nJeffrey\sHobbs\n\nComments:\nThe\simplementations\swere\sdone\sto\smaintain\s100%\sbackwards\scompatibility\n\s\s\s\swith\sworking\scode\s(changing\sthe\soptions\sto\san\sarg\scan\sobviously\schange\n\s\s\s\swhat\serror\sstrings\sarise),\sand\sreduce\sany\sloss\sof\sspeed\s(the\sonly\n\s\s\s\smethod\sthat\sactually\sattained\sa\sspeed\sloss\swas\sstring\sindex,\sas\sI\n\s\s\s\sthrow\sa\sTcl_NumUtfChars\scall\sin\sto\ssupport\send-1\slike\sindices,\sand\n\s\s\s\sthat\sis\snot\smajor).\n\nDesiredBehavior:\nThis\sis\srelated\sto\sthe\sprevious\sfeature\srequest\sfor\san\supdated\sstring\n\s\s\s\scommand,\swith\sone\snew\smethod\s(string\sis)\sand\spatched\sagainst\s8.1.0.\n\s\s\s\s\n\s\s\s\sTo\scover\sit\sall\sagain,\sI\shave\smade\sthe\sfollowing\smods:\n\s\s\s\s\n\s\s\s\s*\sstring\scompare\snow\stakes\soptional\slength\sarg\n\s\s\s\s\s\s(for\sstrncmp\sbehavior)\n\s\s\s\s\n\s\s\s\s*\sadded\sstring\sequal\s(just\sa\sfew\slines\sof\scode\sblended\n\s\s\s\s\s\sin\swith\sstring\scompare)\n\s\s\s\s\n\s\s\s\s*\sadded\sstring\sicompare/iequal\sfor\scase-insensitive\scomparisons\n\s\s\s\s\n\s\s\s\s*\sstring\sindex's\sindex\scan\snow\sbe\s?end[+-]?expression\n\s\s\s\s\s\s\s\sI\smade\sthis\schange\sin\sthe\sprivate\sTclGetIntForIndex,\n\s\s\s\s\s\s\s\swhich\smeans\sthat\sthe\slist\scommands\salso\sbenefit,\sas\n\s\s\s\s\s\s\s\swell\sas\sstring\srange,\set\sal.\n\s\s\s\s\n\s\s\s\s*\sadded\sstring\sis\s<class>\s?-strict?\s?-failindex\svarname?\sstring\n\s\s\s\s\s\s\s\sThe\sfollowing\sare\svalid\sclasses:\n\s\s\s\salnum,\salpha,\sascii,\sboolean,\sdigit,\sdouble,\sfalse,\n\s\s\s\sinteger,\slower,\sspace,\strue,\supper,\swordchar\n\s\s\s\s\s\s\s\sMost\sof\sthe\scorrespond\sto\sthe\sstd\sis*()\sC\sfunctions.\s\sThose\n\s\s\s\s\s\s\s\sthat\sare\smissing\s(like\siscntrl())\sare\sdue\sto\sa\slack\sof\n\s\s\s\s\s\s\s\sTcl_UniCharIs*()\sequivalent,\sbut\scould\sbe\sadded.\s\sI\schose\n\s\s\s\s\s\s\s\snot\sto\smess\swith\sadding\sthem,\sas\sthat\smeans\sgoing\sin\sand\n\s\s\s\s\s\s\s\ssetting\sthings\sin\sthe\sstub\stables\sand\ssuch.\s\sHowever,\sthey\n\s\s\s\s\s\s\s\sare\snot\scomplicated\s(zB,\s*IsControl()\sis\sa\sone\sliner).\n\s\s\s\s\n\s\s\s\s\s\s\s\sThose\sthat\sdo\snot\scorrespond\sto\sis*()\s(like\sboolean,\sint,\n\s\s\s\s\s\s\s\s...)\sare\sintelligently\shandled\sto\sreturn\sthe\scorrect\svalue,\n\s\s\s\s\s\s\s\sbut\sthe\scommand\sis\swritten\ssuch\sthat\sno\stype\sconversion\sof\n\s\s\s\s\s\s\s\sthe\spassed\sobject\soccurs\s(a\sgood\sthing,\sI\sbelieve).\s\sFor\n\s\s\s\s\s\s\s\sinteger\sand\sdouble,\sthis\swas\stricky,\sbut\sthe\stest\ssuite\sis\n\s\s\s\s\s\s\s\sfull,\sand\sthe\sC\scode\sis\swell-commented\swith\sthe\spurpose.\n\s\s\s\s\n\s\s\s\s\s\s\s\sWith\sthe\sexception\sof\sint/double,\swhich\sare\sinherently\sin\n\s\s\s\s\s\s\s\sTcl\snot\sunicode\ssafe\s(still\scalls\sto\sstrto*),\sall\sof\sthese\n\s\s\s\s\s\s\s\sare\sunicode\ssafe\s(with\stests).\n\s\s\s\s\n\s\s\s\s*\sadded\s[string\srepeat\sstring\scount]\n\s\s\s\s\s\s\s\sRepeats\sgiven\sstring\s<count>\snumber\sof\stimes\n\s\s\s\s\n\s\s\s\s*\sadded\sstring\sreplace,\squasi\sstring\sequiv\sto\slreplace\n\s\s\s\s\s\s(quasi\sopposite\sof\sstring\srange):\n\s\s\s\sstring\sreplace\sfirst\slast\s?string?\n\s\s\s\s\s\s\s\sExample\sof\suse,\sreplacing\send\sof\sstring\swith\s...\n\s\s\s\s\s\s\s\sshould\sthe\sstring\sbe\smore\sthan\s16\schars\slong:\n\s\s\s\sstring\sreplace\s$string\s16\send\s"..."\n\s\s\s\s\s\s\s\sThis\sjust\sreturns\sthe\sstring\slen\s<\s16,\sso\sit\n\s\s\s\s\s\s\s\swill\sonly\saffect\sthe\slong\sstrings.\n\s\s\s\s\n\s\s\s\s*\sadded\soptional\sfirst\sand\slast\sargs\sto\sstring\sto*\n\s\s\s\s\s\s\s\sThis\sallows\syou\sto\sjust\saffect\scertain\sregions\sof\n\s\s\s\s\s\s\s\sa\sstring\swith\sthe\scommand\s(like\sjust\scapping\sthe\n\s\s\s\s\s\s\s\sfirst\sletter).\s\sI\sfound\sthe\soriginal\stotitle\sto\n\s\s\s\s\s\s\s\sbe\stoo\sdraconian\sto\sbe\suseful.\n\s\s\s\s\n\s\s\s\s*\sadded\s[string\smap\scharMap\sstring]\n\s\s\s\s\s\s\s\swhere\scharMap\sis\sa\s{from\sto\sfrom\sto}\slist\sthat\sequates\sto\n\s\s\s\s\s\s\s\swhat\sone\smight\sget\sfrom\s[array\sget].\s\sEach\s<from>\sand\s<to>\n\s\s\s\s\s\s\s\scan\sbe\smultiple\schars\s(or\snone\sat\sall).\s\sFor\sTcl/CGI\susers,\n\s\s\s\s\s\s\s\sthis\sis\sa\sMAJOR\sspeed\sbooster.\n\nPatch:\nThe\spatch\scomes\sto\s100KB\swith\sfull\sdoc\sand\stest\ssuite\schanges\nagainst\sthe\sTcl\s8.1.0\ssources.\nhttp://www.hobbs.wservice.com/tcl/capp/Tcl81-string.txt\n\nPatchFiles:\nC:\stclUtil.c\s&&\stclCmdMZ.c\n\s\s\s\sdoc:\sstring.n\n\s\s\s\stests:\sstring.test\scmd*.test\sl*.test\serror.test\n\n\n\n
J foundin obsolete:\s8.1
J priority 5\sMedium
J resolution None
J status Open
J submitter nobody
J subsystem 69.\sOther
J title Updated\sstring\scommand,\stake\s2
J type RFE
K 218751ffffffffffffffffffffffffffffffffff
U nobody
Z af021196bf590efcb843c36f4e84b585