From: "Birt, Jeffrey" <[EMAIL PROTECTED]>
> >Each wish is directly associated with a version of tcl and tk. You
> don't >need to do anything about it.
>
> So wish and tclsh are created by way of compiling the TCL and TK
> sources?
Yes, when one compiles the Tcl source distribution, first the libtcl is
created, then a single file containing the C main() { ... } code
is built. It is essentially a C application with an embedded Tcl
interpreter - only in this case, the application does little more than
feed lines of input to the interpreter and then display the results.
In the case of Tk, first is created the add on library libtk, and then
a single file containing a C main() that makes the appropriate calls
to create a tcl interpreter and then to do the equivalent of a package
require on Tk.
I recommend, however, that people NOT depend on wish. I would not be
surprised if, some time in the future, Tk 9.0 or whatever might be
shipped without a wish - people would just invoke tclsh and then do a
package require Tk
to get the equivalent behavior.
> So when one exuecute their .tcl program, the first few lines
> tells the OS to use wish as the interprter and then the TCL code is
> interpreted by wish?
Yes, exactly. The first few lines are used by Unix anyways to figure
out what kind of code is in the file, then to feed the rest of the file
on to the interpreter.
> So wish must parse the .tcl file and pass arguments to and from the
> appropriate TCL function(s) which are part of the library (the C code,
> not to be confused with the widget libraries which are written in
> TCL/TK) of the version of TCL/TK that belongs to that wish?
Remember, that at heart, wish is just a tclsh.
So the general process is that a tcl interpreter is created, and each line
of your script is fed to that interpreter. As documented in the man
pages, there are, I believe, 7 steps to handling each line of code.
Eventually, an appropriate C function is called with pointers to the
necessary data. This is true for plain Tcl, for Tk/Tcl, for BWidget/Tk/Tcl,
for Tix/Tk/Tcl, etc. No matter how things are written, eventually some
C function is called to take some sort of action - whether assigning
a value to a variable, doing some sort of mathematical calculation, some
I/O to a file, socket, or to the display, etc.
> So then the extensibility of this framework would be that one could
> extend wish to interpret their own library (the C code type again).
Tcl is designed to be really simple to write your own new Tcl commands.
These commands can be written either as Tcl procs or as C code.
The strength of Tcl is that it doesn't care - in fact, it doesn't even
care if the name of the function you are writing already exists! So
for instance you could write your own set command. This is the original
intent of Tcl - to make it nearly trivial to create your own mini-language
for applications. Think of how many programs you may have used which
have some way of writing macros, manipulating data, accessing functions
via a command line or script file, etc. These languages are all different.
It is certainly conceivable that these programs could all be replaced by
similar programs which all used Tcl - and all of a sudden, what you learn
for your login script can be used for your mail program, or your calendar,
or your backup command.
> The
> new C code would be added to TCL or TK? (there has to a better way,
> referring to the binary code "C code" of TCL/TK as libraries and the
> actual TCL/TK script libraries, what's the convention?)
Typically one talks about applications as either programs or scripts.
New commands which are bundled together into a standardly loadable
group may be called 'packages' if they use the package command interfaces.
They also are frequently called extensions. I don't really see a
convention for distinguishing a script only extension package and a
binary extension package.
Tk is 'just another extension' (albeit one of the most popular).
So it exemplifies how most people do things - put the newly created
commands into a library, and then 'package' that library up so that one
can do a 'package require extension_name' command and the
system does the loading.
--
Tcl - The glue of a new generation. <URL: http://wiki.tcl.tk/ >
Larry W. Virden <mailto:[EMAIL PROTECTED]> <URL: http://www.purl.org/NET/lvirden/>
Even if explicitly stated to the contrary, nothing in this posting should
be construed as representing my employer's opinions.
-><-
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
vtcl-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/vtcl-user