Skip to content
Tcl Source Code Artifact [20f9023384]
Login

Artifact [20f9023384]

Artifact 20f9023384145ba2452cfb1c684c361124f7a1b5:

Ticket change [20f9023384] - New ticket [449094ffffffffff|449094ffff] <i>Tcl_TraceVar</i>. by davidw on 2001-08-08 12:46:16.
D 2001-08-08T12:46:16
J assignee nobody
J cmimetype text/plain
J comment [\sI\shate\sthis\sf****\sweb\sinterface\s-\sgo\sread\sthe\noriginal\sthread\sat:\n\n\nhttp://groups.google.com/groups?hl=en&safe=off&th=f37901b5fe0e58d3,3&seekm=87zo9u79oa.fsf%40apache.org#p\n\n]\n\n\n\n\n\nchar\s*traceproc(ClientData\sclientData,\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sTcl_Interp\s*interp,\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\schar\s*name1,\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\schar\s*name2,\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\sint\sflags)\n{\n\s\s\s\sTcl_SetVar2(interp,\s"rotvar",\s"foo",\s"1",\s0);\n\s\s\s\sreturn\sNULL;\n}\n\nint\sRotvar_tcl_Init(Tcl_Interp\s*interp)\n{\n\s\s\s\sTcl_TraceVar(interp,\s"rotvar",\nTCL_TRACE_READS|TCL_TRACE_ARRAY,\straceproc,\sNULL);\n\s\s\s\sreturn\sTCL_OK;\n}\n\nthen...\n\n@ashland\s[~/workshop]\s$\sgcc\s-c\ssicktcl.c\s;\sld\s-fPIC\n-shared\s-o\slibRotVar_tcl.so\ssicktcl.o\s-ltcl8.3\n@ashland\s[~/workshop]\s$\stclsh\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\n\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\stclsh8.3\s[~/workshop]load\n./libRotVar_tcl.so\ntclsh8.3\s[~/workshop]puts\s[array\sget\srotvar\s]\n\ntclsh8.3\s[~/workshop]puts\s[array\sget\srotvar\s]\nfoo\s1\ntclsh8.3\s[~/workshop]\n\nExcusing\sme\sfor\sthe\sodd\snames,\swhy\sisn't\sthis\sfilling\nin\sthe\svalue\n*before*\sthe\sfirst\s[array\sget]\s?\n\nThe\sman\spage\ssays:\n\n\s\s\s\s\s\s\sWhen\sarray\stracing\shas\sbeen\sspecified,\sthe\strace\nprocedure\n\s\s\s\s\s\s\swill\sbe\sinvoked\sat\sthe\s\sbeginning\s\sof\s\sthe\s\narray\s\scommand\n\s\s\s\s\s\s\simplementation,\s\sbefore\s\sany\s\sof\s\sthe\soperations\nlike\sget,\n\s\s\s\s\s\s\sset,\sor\snames\shave\sbeen\sinvoked.\s\sThe\strace\nprocedure\s\scan\n\s\s\s\s\s\s\smodify\sthe\sarray\selements\swith\sTcl_SetVar\sand\nTcl_SetVar2.\n\nIdeas?\n--\s\nDavid\sN.\sWelton\nFree\sSoftware:\shttp://people.debian.org/~davidw/\nApache\sTcl:\shttp://tcl.apache.org/\nPersonal:\shttp://www.efn.org/~davidw/\n\nPost\sa\sfollow-up\sto\sthis\smessage\nMessage\s2\sin\sthread\nFrom:\sDavid\sN.\sWelton\s([email protected])\nSubject:\sRe:\sTcl_TraceVar\swierdness\nNewsgroups:\scomp.lang.tcl\nDate:\s2001-07-24\s06:13:05\sPST\n\[email protected]\s(David\sN.\sWelton)\swrites:\n\n>\s@ashland\s[~/workshop]\s$\sgcc\s-c\ssicktcl.c\s;\sld\s-fPIC\n-shared\s-o\slibRotVar_tcl.so\ssicktcl.o\s-ltcl8.3\n>\s@ashland\s[~/workshop]\s$\stclsh\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\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\s\stclsh8.3\s[~/workshop]load\n./libRotVar_tcl.so\n>\stclsh8.3\s[~/workshop]puts\s[array\sget\srotvar\s]\n>\s>\stclsh8.3\s[~/workshop]puts\s[array\sget\srotvar\s]\n>\sfoo\s1\n>\stclsh8.3\s[~/workshop]\n>\s>\sExcusing\sme\sfor\sthe\sodd\snames,\swhy\sisn't\sthis\nfilling\sin\sthe\svalue\n>\s*before*\sthe\sfirst\s[array\sget]\s?\n\nInterestingly\senough:\n\ntclsh8.3\s[~/workshop]load\s./libRotVar_tcl.so\ntclsh8.3\s[~/workshop]array\sset\srotvar\s{a\sb}\ntclsh8.3\s[~/workshop]array\sget\srotvar\nfoo\s1\sa\sb\n\nSo,\sit\slooks\sas\sif\sit's\simportant\sthat\sit\sbe\sdefined\sas\nan\sarray...\n\nHrm...\n\n--\s\nDavid\sN.\sWelton\nFree\sSoftware:\shttp://people.debian.org/~davidw/\nApache\sTcl:\shttp://tcl.apache.org/\nPersonal:\shttp://www.efn.org/~davidw/\n\nPost\sa\sfollow-up\sto\sthis\smessage\nMessage\s3\sin\sthread\nFrom:\sDavid\sN.\sWelton\s([email protected])\nSubject:\sRe:\sTcl_TraceVar\swierdness\nNewsgroups:\scomp.lang.tcl\nDate:\s2001-07-24\s08:15:32\sPST\n\nThis\sseems\slike\sa\slogical\sfix\sto\sme.\s\sBasically,\swe\nmove\sthe\scheck\sto\nsee\sif\sit's\san\sarray\suntill\safter\sthe\strace.\n\nIn\smy\scase,\sthe\svariable\sis\sindeed\sundefined,\sbut\safter\nthe\strace\sit\nis\san\sarray.\n\n===================================================================\nRCS\sfile:\s/cvsroot/tcl/tcl/generic/tclVar.c,v\nretrieving\srevision\s1.32\ndiff\s-u\s-r1.32\stclVar.c\n---\sgeneric/tclVar.c\s\s\s\s2001/05/17\s02:13:03\s\s\s\s\s1.32\n+++\sgeneric/tclVar.c\s\s\s\s2001/07/24\s15:12:15\n@@\s-3002,12\s+3002,6\s@@\n\s\s\s\s\svarPtr\s=\sTclLookupVar(interp,\svarName,\s(char\s*)\nNULL,\s/*flags*/\s0,\n\s\s\s\s\s\s\s\s\s\s\s\s\s/*msg*/\s0,\s/*createPart1*/\s0,\n/*createPart2*/\s0,\s&arrayPtr);\n\s\n-\s\s\s\snotArray\s=\s0;\n-\s\s\s\sif\s((varPtr\s==\sNULL)\s||\s!TclIsVarArray(varPtr)\n-\s\s\s\s\s\s\s\s\s\s\s||\sTclIsVarUndefined(varPtr))\s{\n-\s\s\s\s\s\s\snotArray\s=\s1;\n-\s\s\s\s}\n-\n\s\s\s\s\s/*\n\s\s\s\s\s\s*\sSpecial\sarray\strace\sused\sto\skeep\sthe\senv\sarray\nin\ssync\sfor\n\s\s\s\s\s\s*\sarray\snames,\sarray\sget,\setc.\n@@\s-3024,6\s+3018,12\s@@\n\s\s\s\s\s\s\s\s}\n\s\s\s\s\s}\n\s\n+\s\s\s\snotArray\s=\s0;\n+\s\s\s\sif\s((varPtr\s==\sNULL)\s||\s!TclIsVarArray(varPtr)\n+\s\s\s\s\s\s\s\s\s\s\s||\sTclIsVarUndefined(varPtr))\s{\n+\s\s\s\s\s\s\snotArray\s=\s1;\n+\s\s\s\s}\n+\n\s\s\s\s\s/*\n\s\s\s\s\s\s*\sWe\shave\sto\swait\sto\sget\sthe\sresultPtr\suntil\shere\nbecause\n\s\s\s\s\s\s*\sCallTraces\scan\saffect\sthe\sresult.\n\n\nAnd\sinfact:\n\n%\sload\s/home/davidw/workshop/libRotVar_tcl.so\n%\sarray\sget\srotvar\nfoo\s1\n\nWorks\son\sthe\sfirst\stry...\n\n--\s\nDavid\sN.\sWelton\nFree\sSoftware:\shttp://people.debian.org/~davidw/\nApache\sTcl:\shttp://tcl.apache.org/\nPersonal:\shttp://www.efn.org/~davidw/\n\n
J foundin None
J priority 5\sMedium
J resolution None
J status Open
J submitter davidw
J subsystem 
J title Tcl_TraceVar
J type Bug
K 449094ffffffffffffffffffffffffffffffffff
U davidw
Z 1393113a3f1139ffa6935cc9a15993d3