Tcl Source Code

View Ticket
Login
Ticket UUID: 415179
Title: TIP#27: tclBasic.c and related files.
Type: Patch Version: CONSTify
Submitter: kennykb Created on: 2001-04-10 16:09:40
Subsystem: 45. Parsing and Eval Assigned To: kennykb
Priority: 3 Low Severity:
Status: Closed Last Modified: 2002-02-08 16:04:38
Resolution: Fixed Closed By: dkf
    Closed on: 2002-02-08 09:04:38
Description:
Patches to CONST-ify the public API's of tclBasic.c and related files.

The following maintainer areas are affected:

Fundamental Parsing and Evaluation[Sofer, Hobbs]

* doc/AssocData.3
* doc/CrtCommand.3
* doc/CrtMathFnc.3
* doc/CrtObjCmd.3
* doc/ExprLong.3
* generic/tclBasic.c

Fundamental Built-In Commands

  * M-Z[Fellows, Hobbs]

* generic/tclCmdMZ.c

  * [interp][Hobbs]

* doc/CrtSlave.3

  * [namespace][Sofer, Hobbs]

* generic/tclNamesp.c

Shared Files

* generic/tcl.decls
* generic/tcl.h
* generic/tclInt.decls
* generic/tclInt.h

Generated Files

* generic/tclDecls.h
* generic/tclIntDecls.h
User Comments: kennykb added on 2001-04-25 04:00:57:
Logged In: YES 
user_id=99768

Changes committed to the HEAD.

hobbs added on 2001-04-25 03:39:56:
Logged In: YES 
user_id=72656

Forget the note about Tcl_VarTraceProc, it's 
Tcl_CommandTraceProc (oldName) that is CONST'ed, which 
should not have been modified before.  OK to commit.

hobbs added on 2001-04-12 02:26:26:
Logged In: YES 
user_id=72656

Tcl_CreateCommand: OK (cmdName)
Tcl_CreateMathFunc: OK (name)
Tcl_CreateObjCommand: OK (cmdName)
Tcl_DeleteAssocData: OK (name)
Tcl_DeleteCommand: OK (cmdName)
Tcl_ExposeCommand: OK (hiddenCmdToken)
Tcl_Expr*: OK (string)
  Danger Will Robinson!

Let's look at Tcl_ExprDouble and watch for a careful gotcha 
that might hit somewhere in the future.  Tcl_ExprDouble 
first creates a Tcl_Obj, which is the only thing that makes 
this OK, but Tcl_NewStringObj makes a copy of string.  
However, following the call tree of Tcl_ExprDouble, we 
reach Tcl_ParseExpr, which *will* modify the string that 
could be a shared string in Tcl_Obj.  This doesn't affect 
the CONST'ifying here, but in general exposes a Bad Thing 
(tm).  It could lead to odd problems in a threaded 
environment....  That said, I go on...

Tcl_GetAssocData: OK (name)
Tcl_GetCommandInfo: OK (cmdName)
Tcl_HideCommand: OK (cmdName)
Tcl_SetAssocData: OK (name)
Tcl_SetCommandInfo: OK (cmdName)

CallCommandTraces: OK (oldName, newName)
TraceCommandProc: OK (oldName, newName)
   Danger Will Robinson!

Previously Tcl_VarTraceProc didn't enforce CONST (directly 
related to the above), and now it will.  This will be an 
incompatability for anyone that modified the passed in 
strings (I don't know why they would, but it was legal 
before).

TclGetNameSpaceForQualName: OK (qualName, *simpleNamePtr)
Tcl_CreateNamespace: OK (name)
Tcl_FindCommand: OK (name)
  Those need to be made public, BTW

dkf added on 2001-04-11 20:26:10:
Logged In: YES 
user_id=79902

Assuming the change to generic/tclBasic.c is OK, the change
to generic/tclCmdMZ.c is OK too.

kennykb added on 2001-04-10 23:09:42:

File Added - 5193: tip27.tclBasic.patch

Attachments: