FPGARelated.com
Forums

Semi-OT: Good Tcl Book

Started by Rob Gaddi January 23, 2012
More and more I find myself needing to write Tcl.  My simulator gets far easier to work with if I've got it scripted than going clicking around.  Likewise, all of my configuration and control files under Quartus are Tcl based.

I've poked around through web reference after web reference, and managed to cobble together an approximation of an understanding of Tcl, but I still find myself spending more time playing the "Was that it?" game than I should.

Has anyone got a recommendation for a good Tcl book in dead tree form?

-- 
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.
On Mon, 23 Jan 2012 11:36:08 -0800, Rob Gaddi
<rgaddi@technologyhighland.invalid> wrote:

>More and more I find myself needing to write Tcl. My simulator gets far easier to work with if I've got it scripted than going clicking around. Likewise, all of my configuration and control files under Quartus are Tcl based. > >I've poked around through web reference after web reference, and managed to cobble together an approximation of an understanding of Tcl, but I still find myself spending more time playing the "Was that it?" game than I should. > >Has anyone got a recommendation for a good Tcl book in dead tree form?
Hi Rob, Brent B. Welch: Practical Programming in Tcl and Tk Be sure to get the latest edition (from 2010 ?) to cover the changes up to Tcl 8.5. IIRC the main part of the book is about Tk, however - not astonishing, given the simplicity of Tcl. Not a dead tree book, but anyway: Are you aware of Tcl Tutor (links at http://wiki.tcl.tk/1681). It's an interactive tutorial just about Tcl: You can modify the examples any way you like, and have them execute immediately. Highly recommended. HTH M.J. Keith
Michael Keith <mjkeith@gmx.de> writes:

> IIRC the main part of the book is about Tk, however - not > astonishing, given the simplicity of Tcl.
I seem to remember that John Ousterhout's book was more focused on the Tcl language than the Welch book: http://www.amazon.com/Tcl-Toolkit-2nd-John-Ousterhout/dp/032133633X However, that was 10+ years ago so things might have changed somewhat in the later editions. I think the most important discovery for programmers learning Tcl is that it does not have syntax, it's only command [arg1 ... argn]. {}, [], "" are just methods for quoting. e.g. "if" is a command which have two or three arguments. The first is evaluated and if it is zero it will execute the second argument (if given), if non-zero it will execute the first one: % if 0 "puts yes" "puts no" no % if 1 "puts yes" "puts no" yes % expr 1==1 1 % expr 1==0 0 % set hhh world world % string equal "hello $hhh" {hello world} 1 % string equal "hello $hhh" {hello $hhh} 0 % puts "hello $hhh" hello world % puts {hello $hhh} hello $hhh You have to learn the quoting rules and then look upp all the different commands on the net or in a book. //Petter -- .sig removed by request.
I use TCL/TK in a nutshell by Paul Raines and Jeff Tranter as a desktop reference. I like it, and it's available pretty cheaply second hand.

Also the TCL website http://wiki.tcl.tk/ provides a good way of looking up commands etc.

Best regards,
Simon
I too have the Brent Welch book (though not the latest edition), and I
reckon that it was a good purchase...
	   
					
---------------------------------------		
Posted through http://www.FPGARelated.com