Menu

#149 Support for Linking Tcl Variables and C Variables Containing

closed-fixed
5
2009-05-11
2000-10-26
Anonymous
No

OriginalBugID: 2275 RFE
Version: 8.0.4
SubmitDate: '1999-06-21'
LastModified: '2000-10-25'
Severity: LOW
Status: UnAssn
Submitter: techsupp
OS: Solaris
OSVersion: 2.7
Machine: Other
FixedDate: '2000-10-25'
ClosedDate: '2000-10-25'

Name:
Donal K. Fellows

Comments:
This code has been tested and found to work fine on Solaris (various
versions,) SunOS 4.1 (where it was developed) and Linux (various
versions)

DesiredBehavior:
This enhancement to the general mechanism for linking Tcl and C
variables allows code that wishes to link an internal variable that
contains a reference to a Tcl_Obj structure to the general Tcl-level
interface to do so far more efficiently. In particular, it prevents the
(sometimes significant) degradation in performance that would otherwise
be necessary if a scheme based on the standard Tcl_LinkVar() behaviour
was used (which would be due to the conversion between strings and
values) and can efficiently cope with any objects a programmer may wish
to pass.

The changes that I've made are currently structured as being in separate
files, and as such they have no general impact upon the rest of Tcl.
Integrating them should be a breeze (apart from writing the
documentation and test suite <sigh>)

As the code has been in serious use for around 2 years now (as part of a
scheme to link properties of objects to Tcl variables so they can be
joined to Tk entry widgets in an OO scheme I'm using in an application
I'm working on,) I fully expect it to be free of bugs. In particular,
the code has no internal memory leaks (when used correctly, of course)
and nor does it leak references or cause anything to get freed to early
(which was the source of many wierd bugs, admittedly...)

My implementation of the above feature (I emphasize that this is *not* a
patch) and some minimalist documentation is available at:
http://www.cs.man.ac.uk/~fellowsd/tcl/#scripts/linkObj

I do not class this request-for-enhancement-inclusion as a show-stopper
at all, since I have to use enhanced interpreters in any case (there is
the rest of the OO code, and some proprietory display enhancements, all
of which are absolute necessities at the moment.)

Discussion

  • Donal K. Fellows

    • milestone: 102416 --> 102413
     
  • Donal K. Fellows

    • labels: 104254 --> 105652
     
  • Don Porter

    Don Porter - 2001-04-03
    • labels: 105652 --> 09. Linked C Variables
     
  • Jeffrey Hobbs

    Jeffrey Hobbs - 2002-01-16
    • assigned_to: nobody --> dkf
     
  • Donal K. Fellows

    Logged In: YES
    user_id=79902

    There has also been interest shown on c.l.t for linking with
    float (single-precision IEEE) variables.

     
  • Donal K. Fellows

    8.5 onwards supports linking of a wider range of basic types, but not of Tcl_Objs; those are perhaps best done directly through traces. In any case, I'm not pushing for this one any more.

     
  • Donal K. Fellows

    • status: open --> closed-fixed