From: John Stone (johns_at_ks.uiuc.edu)
Date: Mon Nov 02 2009 - 14:08:27 CST

Hi Olaf,
  As I recall this API isn't presently used by any of the existing
plugins, and the current version of VMD isn't paying any attention
to whether a molfile plugin provides a Tcl register callback.
In practice, we didn't end up needing to do this because Tcl can
simply do it's own load of the same .so file or DLL to extract
functions just like it would with a pure Tcl extension. You can
write a C/C++ based plugin that adds Tcl commands completely
independently of its existing plugin callbacks. Given the capabilities
of the current versions of Tcl, we can probably just delete this callback
from the molfile plugin API since there are other ways to do this that
closer to what Tcl wants anyway.

Now, in regards to your question:
  We are working on adding a new mechanism that will allow plugins to
provide arbitrary "extra" data to VMD beyond the hard-coded fields
defined by the existing molfile plugin interface. It will be accessible
to scripting via Tcl/Python, and would not have the problems that global
variables and the like would otherwise create. If you can tell me more
about the kind of data that you intend to make available from your plugin,
I can help you to implement it in your plugin using the new APIs I'm working
on when they are ready.

Cheers,
  John Stone
  vmd_at_ks.uiuc.edu

On Mon, Nov 02, 2009 at 02:29:24PM +0100, Olaf Lenz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hello!
>
> On
>
> http://www.ks.uiuc.edu/Research/vmd/plugins/doxygen/molfileplugins.html#molfileplugins
>
> I notice that VMD provides a way to access the Tcl interpreter from a
> molfile reader plugin via the command VMDPLUGIN_register_tcl. The docs
> state, that the function is there to allow plugins to export additional
> Tcl functions. Unfortunately, I can't find a single plugin that actually
> uses this functionality, so I'm not sure whether I can actually do what
> I think of.
>
> Is it possible to exchange data between the molfile reader functions
> (like open_file_read) and whatever function I would like to register
> from Tcl? In principle, I would think that it should be possible to use
> global variables, however, this is of course not very elegant.
>
> I would like to allow a molfile reader plugin to inject additional data
> into the Tcl data space, so that the reader format can store additional
> user data, that is made available to the user in VMD via Tcl.
>
> An even simpler solution would be if I had a way to access the Tcl
> interpreter from inside the molfile reader plugin functions. Is there a
> (legal) way to do that?
>
> Of course, I could easily misuse the above register function to get a
> pointer to the Tcl interpreter, store it in a global variable and then
> use it from inside the plugin function, but I guess that this would have
> severe consequences, would it?
>
> Olaf
>
> - --
> A: Because it messes up the order in which people normally read text.
> Q: Why is top-posting such a bad thing?
> A: Top-posting.
> Q: What is the most annoying thing in e-mail?
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.4-svn0 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iD8DBQFK7t60tQ3riQ3oo/oRApVnAJ9SZCgIgv05IFvFhl74zQGmDXTKegCaA4y4
> yRKLeM4Wypdy0+it11Q+v4M=
> =t+Jw
> -----END PGP SIGNATURE-----

-- 
NIH Resource for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
Email: johns_at_ks.uiuc.edu                 Phone: 217-244-3349
  WWW: http://www.ks.uiuc.edu/~johns/      Fax: 217-244-6078