{jtclutils.tcl

Introduction
The jtclutils.tcl library is distributed as part of the jstools package.  It will consist of general Tcl convenience and utility procedures that do not require Tk.  Currently it only contains one procedure.

This document describes jtclutils.tcl version 4.0/4.0.

Usage
Accessing the Library
In order to use the jtclutils.tcl library, it (and any other libraries it depends on) must be in your Tcl auto_path, described in tclvars(n).  Information about how to arrange that, and other conventions common to the jstools libraries, is in the Usage section of The jstools Libraries.

Credits and Copyright
Author
Jay Sekora 
js@calumet.org
http://shore.net/~js/

Copyright
The library is copyright © 1992-1995 by Jay Sekora, but may be freely redistributed under the conditions at the top of the file.

Overview
Procedures
j:default - specify a default value for a variable, creating it if necessary

j:default
Usage
	j:default var value
Arguments
	var - variable to create if necessary
	value - default value to assign to var if it's not already set
Examples
	global SAVE_BEFORE_QUITTING
	if [j:default SAVE_BEFORE_QUITTING 1] {save}

	j:default filename [glob -nocomplain ~/.foo]
	save_to_file $filename

Description
If var does not already exist (in the context of the calling procedure), this procedure creates it and assigns value to it.  If var already exists, its value will not be changed.

In either case, the current value of var in the calling procedure's context is returned, as with the Tcl set(n) command.

This is useful for working variables that may or may not have been set already, e.g., after reading a user's configuration file.

(For assigning default values to arguments to a procedure, see j:parse_args in jparseargs.tcl.)
} {{{jdoc:xref:link {4.56 4.63 10.214 10.235 10.243 10.260 10.264 10.285 23.0 23.9 45.63 45.75 45.79 45.93}} {jdoc:xref:manpage {10.130 10.137 41.105 41.108}} {jdoc:anchor:anchorname {3.0 4.0 8.0 9.0 12.0 13.0 21.0 22.0 25.0 26.0}} {richtext:font:roman {2.0 3.0 4.0 4.4 4.17 4.56 4.63 6.24 6.37 8.0 10.0 10.20 10.33 10.106 10.115 10.130 10.137 10.218 10.225 10.247 10.252 10.264 10.285 12.0 14.0 15.0 15.14 16.0 16.21 18.0 19.0 21.0 23.9 25.0 27.0 27.1 27.20 28.0 29.0 29.1 29.4 30.1 30.6 30.36 30.39 31.0 37.0 38.0 39.0 39.3 39.6 39.111 39.116 39.128 39.131 41.37 41.40 41.105 41.108 45.63 45.75 45.79 45.93 46.0}} {richtext:font:italic {27.11 27.14 27.15 27.20 29.1 29.4 30.1 30.6 30.36 30.39 39.3 39.6 39.111 39.116 39.128 39.131 41.37 41.40}} {richtext:font:bold {4.4 4.17 4.56 4.63 6.24 6.37 10.20 10.33 10.218 10.225 45.79 45.93}} {richtext:font:bolditalic {10.247 10.252 10.264 10.285}} {richtext:font:typewriter {10.106 10.115 10.130 10.137 15.0 15.14 16.0 16.21 23.0 23.9 27.1 27.11 27.14 27.15 32.0 37.0 41.105 41.108 45.63 45.75}} {richtext:font:heading0 {1.0 2.0}} {richtext:font:heading1 {3.0 4.0 8.0 9.0 12.0 13.0 21.0 22.0 25.0 26.0}} {richtext:font:heading2 {9.0 10.0 13.0 14.0 18.0 19.0 22.0 23.0 26.0 27.0 28.0 29.0 31.0 32.0 38.0 39.0}} {jdoc:link:jstools.jdoc {4.56 4.63}} {jdoc:manpage:tclvars {10.130 10.137}} {jdoc:link:jslibraries.tcl {10.214 10.235}} {jdoc:link:jslibraries.jdoc#Usage {10.243 10.260}} {jdoc:link:jslibraries.jdoc {10.264 10.285}} {{} {12.0 19.0 22.0 22.10}} {jdoc:anchorname:Overview {21.0 22.0}} {jdoc:anchorname:Credits_and_Copyright {12.0 13.0}} {jdoc:anchorname:Usage {8.0 9.0}} {jdoc:anchorname:Introduction {3.0 4.0}} {jdoc:link:#j:default {23.0 23.9}} {jdoc:anchorname:j:default {25.0 26.0}} {jdoc:manpage:set {41.105 41.108}} {jdoc:link:jparseargs.tcl.jdoc#j:parse_args {45.63 45.75}} {jdoc:link:jparseargs.tcl.jdoc {45.79 45.93}}} {{richptr 46.0} {abbrevstart 46.0} {matchend 39.70} {abbrevend 46.0} {insert 1.0} {anchor 1.0} {matchstart 39.61} {current 1.0}}}