.
D 2000-10-26T01:02:37
J assignee nobody
J cmimetype text/plain
J comment OriginalBugID:\s1263\sRFE\nVersion:\s8.1b1\nSubmitDate:\s'1999-02-23'\nLastModified:\s'1999-03-17'\nSeverity:\sLOW\nStatus:\sReleased\nSubmitter:\spat\nChangedBy:\sstanton\nOS:\sOther\nMachine:\sNA\nFixedDate:\s'1999-03-17'\nFixedInVersion:\s8.1b2\nClosedDate:\s'2000-10-25'\n\n\nName:\nKevin\sB.\sKenny\n\nCVS:\n*\sRCS:\s@(#)\s$Id:\stclVar.c,v\s1.1.2.3\s1998/11/06\s21:51:57\sstanton\sExp\s$\n\nDesiredBehavior:\nIt\sseems\sa\sbit\sgratuitous\sto\seliminate\sTcl_ObjGetVar2\sand\sTcl_ObjSetVar2\sfrom\nTcl\s8.1.\s\sSince\sTcl\sstrings\sare\sonce\sagain\snull\sterminated\s(with\sUTF-8\sused\nto\srepresent\sembedded\smultibyte\scharacters\sthat\scontain\snulls),\sit\swould\sappear\nsafe\sto\simplement\sthem\sas\sstraightforward\swrappers\saround\sthe\snew\nTcl_GetObjVar2\sand\sTcl_SetObjVar2\sfunctions.\s\sThat\schange\swould\savoid\sbreaking\na\sfair\samount\sof\sexisting\scode.\n\n\n\nPatch:\nI've\sjust\sbeen\sadding\sthe\sfollowing\sin\sa\sseparate\ssource\sfile\sso\sas\snot\nto\shack\sup\sthe\sTcl\score.\s\sIt\sshould\sprobably\sgo\sin\stclVar.c,\sand\sof\scourse\nthe\sfunctions\sshould\sgo\sback\sinto\stcl.h.\n\n/*\n\s*\sTcl_ObjSetVar2\s--\n\s*\n\s*Given\sa\stwo-part\svariable\sname,\swhich\smay\srefer\sto\seither\sa\sscalar\n\s*variable\sor\san\selement\sof\san\sarray,\schange\sthe\svalue\sof\sthe\svariable\n\s*to\sa\snew\sTcl\sobject\svalue.\s\sIf\sthe\snamed\sscalar\sor\sarray\selement\n\s*doesn't\sexist,\sthen\screate\sit.\n\s*\n\s*\sResults:\n\s*Returns\sa\spointer\sto\sthe\sTcl_Obj\sstructure\sthat\sholds\sthe\snew\n\s*value\sof\sthe\svariable.\s\sIf\sthe\swrite\soperation\swas\sdisallowed\n\s*because\san\sarray\swas\sexpected\sbut\sa\sscalar\swas\sfound\s(or\svice\n\s*versa),\sor\sbecause\sa\swrite\strace\sfailed,\sthen\sNULL\sis\sreturned.\n\s*If\sthe\sTCL_LEAVE_ERR_MSG\sflag\sis\sset,\sthen\san\sexplanatory\smessage\n\s*is\sleft\sin\sthe\sinterpreter's\sresult.\s\sNote\sthat\sthe\sreturned\sobject\n\s*may\snot\sbe\sthe\ssame\sone\sthat\swas\spassed\sin\snewValuePtr,\snor\sneed\n\s*it\shave\sthe\ssame\svalue;\swrite\straces\scould\shave\smodified\sthe\n\s*value\sof\sthe\svariable\sbefore\sTcl_ObjSetVar2\sreturns.\n\s*\n\s*\sSide\seffects:\n\s*The\svalue\sof\sthe\svariable\sis\sset.\s\sIf\seither\sthe\sarray\sor\sthe\n\s*entry\sdidn't\sexist,\sthen\sa\snew\svariable\sis\screated.\n\s*\n\s*\sThis\sfunction\sis\ssimply\sa\swrapper\saround\sTcl_SetObjVar2,\sprovided\n\s*\sfor\scompatibility\swith\sTcl\s8.0.\n\s*\n\s*----------------------------------------------------------------------\n\s*/\n\nTcl_Obj*\nTcl_ObjSetVar2(\sinterp,\spart1Ptr,\spart2Ptr,\snewValuePtr,\sflags\s)\n\s\sTcl_Interp*\sinterp;/*\sTcl\sinterpreter\s*/\n\s\sTcl_Obj*\spart1Ptr;/*\sPart\s1\sof\sthe\svariable\sname\s*/\n\s\sTcl_Obj*\spart2Ptr;/*\sPart\s2\sof\sthe\svariable\sname\s*/\n\s\sTcl_Obj*\snewValuePtr;/*\sNew\svalue\sof\sthe\svariable\s*/\n\s\sint\sflags;/*\sOR-ed\scombination\sof\sbits\sproviding\n\s*\sadditional\sinformation\sfor\sthe\soperation.\s*/\n{\n\s\sreturn\sTcl_SetObjVar2(\sinterp,\n\sTcl_GetString(\spart1Ptr\s),\n\sTcl_GetString(\spart2Ptr\s),\n\snewValuePtr,\n\sflags\s);\n}\n\n/*\n\s*----------------------------------------------------------------------\n\s*\n\s*\sTcl_GetObjVar2\s--\n\s*\n\s*Return\sthe\svalue\sof\sa\sTcl\svariable\sas\sa\sTcl\sobject,\sgiven\sa\n\s*two-part\sname\sconsisting\sof\sarray\sname\sand\selement\swithin\sarray.\n\s*\n\s*\sResults:\n\s*The\sreturn\svalue\spoints\sto\sthe\scurrent\sobject\svalue\sof\sthe\svariable\n\s*given\sby\spart1Ptr\sand\spart2Ptr.\sIf\sthe\sspecified\svariable\sdoesn't\n\s*exist,\sor\sif\sthere\sis\sa\sclash\sin\sarray\susage,\sthen\sNULL\sis\sreturned\n\s*and\sa\smessage\swill\sbe\sleft\sin\sthe\sinterpreter's\sresult\sif\sthe\n\s*TCL_LEAVE_ERR_MSG\sflag\sis\sset.\n\s*\n\s*\sSide\seffects:\n\s*The\sref\scount\sfor\sthe\sreturned\sobject\sis\s_not_\sincremented\sto\n\s*reflect\sthe\sreturned\sreference;\sif\syou\swant\sto\skeep\sa\sreference\sto\n\s*the\sobject\syou\smust\sincrement\sits\sref\scount\syourself.\n\s*\n\s*----------------------------------------------------------------------\n\s*/\n\nTcl_Obj*\s\nTcl_ObjGetVar2(\sinterp,\spart1Ptr,\spart2Ptr,\sflags\s)\n\s\s\s\s\sTcl_Interp*\sinterp;/*\sTcl\sinterpreter\s*/\n\s\s\s\s\sTcl_Obj*\spart1;/*\sName\sof\sthe\sarray\sor\svariable\s*/\n\s\s\s\s\sTcl_Obj*\spart2;/*\sSubscript\sin\sthe\sarray,\sor\sNULL\s*/\n\s\s\s\s\sint\sflags;/*\sOR-ed\scombination\sof\sbits\sproviding\n\s*\sadditional\sinformation\sfor\sthe\soperation.\s*/\n{\n\s\sreturn\sTcl_GetObjVar2(\sinterp,\n\sTcl_GetString(\spart1Ptr\s),\n\sTcl_GetString(\spart2Ptr\s),\n\sflags\s);\n}\n\n\n\n\n\n03/17/1999\s17:50\s-\sstanton\s-\sObj*Var2\sinterfaces\swere\sadded\sback\sto\s8.1b2
J foundin obsolete:\s8.1b1
J priority 5\sMedium
J resolution None
J status Open
J submitter nobody
J subsystem 69.\sOther
J title Tcl_ObjGetVar2\sand\sTcl_ObjSetVar2
J type Bug
K 218574ffffffffffffffffffffffffffffffffff
U nobody
Z 99ec9b12d46f8151d5126e0aab53cde7