{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.1/4.4.

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@aq.org
http://www.aq.org/~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:mkdir - create a directory and its parent directories, 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.)

j:mkdir
Usage
	j:mkdir dir
Arguments
	dir - directory to make

Description
If dir does not already exist, this procedure attempts to create it (and all its parent directories).  If the directory can't be created (e.g. because the user doesn't have appropriate permission or dir already exists and is not a directory), an error is produced.
} {{{jdoc:anchor:anchorname {3.0 4.0 8.0 9.0 12.0 13.0 21.0 22.0 26.0 27.0 48.0 49.0}} {sel {6.46 6.53}} {jdoc:xref:link {4.56 4.63 10.214 10.235 10.243 10.260 10.264 10.285 23.0 23.9 24.0 24.7 46.63 46.75 46.79 46.93}} {jdoc:xref:manpage {10.130 10.137 42.105 42.108}} {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.9 16.0 16.22 18.0 19.0 21.0 23.9 24.0 24.7 26.0 28.0 28.1 28.20 29.0 30.0 30.1 30.4 31.1 31.6 31.36 31.39 32.0 38.0 39.0 40.0 40.3 40.6 40.111 40.116 40.128 40.131 42.37 42.40 42.105 42.108 46.63 46.75 46.79 46.93 48.0 50.12 51.0 52.0 52.1 52.4 54.0 55.0 55.3 55.6 55.199 55.202 56.0}} {richtext:font:italic {28.11 28.14 28.15 28.20 30.1 30.4 31.1 31.6 31.36 31.39 40.3 40.6 40.111 40.116 40.128 40.131 42.37 42.40 50.9 50.12 52.1 52.4 55.3 55.6 55.199 55.202}} {richtext:font:bold {4.4 4.17 4.56 4.63 6.24 6.37 10.20 10.33 10.218 10.225 46.79 46.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.9 16.0 16.22 23.0 23.9 24.0 24.7 28.1 28.11 28.14 28.15 33.0 38.0 42.105 42.108 46.63 46.75 50.1 50.9}} {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 26.0 27.0 48.0 49.0}} {richtext:font:heading2 {9.0 10.0 13.0 14.0 18.0 19.0 22.0 23.0 27.0 28.0 29.0 30.0 32.0 33.0 39.0 40.0 49.0 50.1 51.0 52.0 54.0 55.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 {26.0 27.0}} {jdoc:manpage:set {42.105 42.108}} {jdoc:link:jparseargs.tcl.jdoc#j:parse_args {46.63 46.75}} {jdoc:link:jparseargs.tcl.jdoc {46.79 46.93}} {jdoc:link:#j:mkdir {24.0 24.7}} {jdoc:anchorname:j:mkdir {48.0 49.0}}} {{matchend 29.9} {abbrevstart 56.0} {richptr 56.0} {abbrevend 56.0} {insert 6.53} {matchstart 29.0} {anchor 48.4} {current 10.132}}} {}