home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-11-19 | 51.1 KB | 1,188 lines |
- Newsgroups: comp.sources.misc
- From: karl@sugar.neosoft.com (Karl Lehenbauer)
- Subject: v26i007: tclx - extensions and on-line help for tcl 6.1, Part07/23
- Message-ID: <1991Nov19.005419.8717@sparky.imd.sterling.com>
- X-Md4-Signature: b0f6e51527b163ecfbf19de749b1016f
- Date: Tue, 19 Nov 1991 00:54:19 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: karl@sugar.neosoft.com (Karl Lehenbauer)
- Posting-number: Volume 26, Issue 7
- Archive-name: tclx/part07
- Environment: UNIX
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 7 (of 23)."
- # Contents: extended/src/clock.c extended/src/main.c
- # extended/tcllib/help/commands/array
- # extended/tcllib/help/commands/errorCode
- # extended/tcllib/help/commands/exec
- # extended/tcllib/help/commands/proc
- # extended/tcllib/help/intro/backslash
- # extended/tcllib/help/intro/dollar
- # extended/tcllib/help/intro/results
- # extended/tcllib/help/misc/memory
- # extended/tcllib/help/tclshell/packagelib
- # extended/tests/chartype.test
- # Wrapped by karl@one on Wed Nov 13 21:50:18 1991
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'extended/src/clock.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'extended/src/clock.c'\"
- else
- echo shar: Extracting \"'extended/src/clock.c'\" \(3222 characters\)
- sed "s/^X//" >'extended/src/clock.c' <<'END_OF_FILE'
- X/*
- X * clock.c --
- X *
- X * Contains the TCL time and date related commands.
- X *---------------------------------------------------------------------------
- X * Copyright 1991 Karl Lehenbauer and Mark Diekhans.
- X *
- X * Permission to use, copy, modify, and distribute this software and its
- X * documentation for any purpose and without fee is hereby granted, provided
- X * that the above copyright notice appear in all copies. Karl Lehenbauer and
- X * Mark Diekhans make no representations about the suitability of this
- X * software for any purpose. It is provided "as is" without express or
- X * implied warranty.
- X */
- X
- X#include "tclExtdInt.h"
- X
- X/*
- X * These should be take from an include file, but it got to be such a mess
- X * to get the include files right that they are here for good measure.
- X */
- Xstruct tm *gmtime ();
- Xstruct tm *localtime ();
- X
- X
- X/*
- X *----------------------------------------------------------------------
- X *
- X * Tcl_GetclockCmd --
- X * Implements the TCL getclock command:
- X * getclock
- X *
- X * Results:
- X * Standard TCL results.
- X *
- X *----------------------------------------------------------------------
- X */
- Xint
- XTcl_GetclockCmd (clientData, interp, argc, argv)
- X ClientData clientData;
- X Tcl_Interp *interp;
- X int argc;
- X char **argv;
- X{
- X if (argc != 1) {
- X Tcl_AppendResult (interp, "wrong # args: ", argv[0],
- X (char *) NULL);
- X return TCL_ERROR;
- X }
- X sprintf (interp->result, "%ld", time ((char *)NULL));
- X return TCL_OK;
- X}
- X
- X/*
- X *----------------------------------------------------------------------
- X *
- X * Tcl_FmtclockCmd --
- X * Implements the TCL fmtclock command:
- X * fmtclock clockval [format] [GMT|{}]
- X *
- X * Results:
- X * Standard TCL results.
- X *
- X *----------------------------------------------------------------------
- X */
- Xint
- XTcl_FmtclockCmd (clientData, interp, argc, argv)
- X ClientData clientData;
- X Tcl_Interp *interp;
- X int argc;
- X char **argv;
- X{
- X int useGMT = FALSE;
- X long ClockVal;
- X char *format;
- X struct tm *timeDataPtr;
- X int fmtError;
- X
- X if ((argc < 2) || (argc > 4)) {
- X Tcl_AppendResult (interp, "wrong # args: ", argv [0],
- X " clockval [format] [GMT|{}]", (char *) NULL);
- X return TCL_ERROR;
- X }
- X
- X if (Tcl_GetLong (interp, argv[1], &ClockVal) != TCL_OK)
- X return TCL_ERROR;
- X if ((argc == 4) && (argv [3][0] != '\0')) {
- X if (!STREQU (argv [3], "GMT")) {
- X Tcl_AppendResult (interp, "expected \"GMT\" or {} got \"",
- X argv [3], "\"", (char *) NULL);
- X return TCL_ERROR;
- X }
- X useGMT = TRUE;
- X }
- X
- X if ((argc >= 3) && (argv [2][0] != '\0'))
- X format = argv[2];
- X else
- X format = "%a %b %d %X %Z %Y";
- X
- X if (useGMT)
- X timeDataPtr = gmtime (&ClockVal);
- X else
- X timeDataPtr = localtime (&ClockVal);
- X
- X fmtError = strftime (interp->result, TCL_RESULT_SIZE, format,
- X timeDataPtr) < 0;
- X if (fmtError) {
- X Tcl_AppendResult (interp, "error formating time", (char *) NULL);
- X return TCL_ERROR;
- X }
- X return TCL_OK;
- X}
- END_OF_FILE
- if test 3222 -ne `wc -c <'extended/src/clock.c'`; then
- echo shar: \"'extended/src/clock.c'\" unpacked with wrong size!
- fi
- # end of 'extended/src/clock.c'
- fi
- if test -f 'extended/src/main.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'extended/src/main.c'\"
- else
- echo shar: Extracting \"'extended/src/main.c'\" \(3938 characters\)
- sed "s/^X//" >'extended/src/main.c' <<'END_OF_FILE'
- X/*
- X * main.c --
- X *
- X * Main to run the Tcl shell. This file is a useful template for custom
- X * applications that wish to have Tcl as the top level command language.
- X *---------------------------------------------------------------------------
- X * Copyright 1991 Karl Lehenbauer and Mark Diekhans.
- X *
- X * Permission to use, copy, modify, and distribute this software and its
- X * documentation for any purpose and without fee is hereby granted, provided
- X * that the above copyright notice appear in all copies. Karl Lehenbauer and
- X * Mark Diekhans make no representations about the suitability of this
- X * software for any purpose. It is provided "as is" without express or
- X * implied warranty.
- X */
- X
- X#include "tclExtdInt.h"
- X#include "patchlevel.h"
- X
- Xextern errno;
- X
- X/*
- X * These globals are used by the infox command.
- X */
- X
- Xextern char *tclxVersion; /* Extended Tcl version number. */
- Xextern char *tclxPatchlevel; /* Extended Tcl patch level. */
- X
- Xextern char *tclAppName; /* Application name */
- Xextern char *tclAppLongname; /* Long, natural language application name */
- Xextern char *tclAppVersion; /* Version number of the application */
- X
- X/*
- X * If set to be a pointer to the procedure Tcl_RecordAndEval, will link in
- X * history
- X */
- Xextern int (*tclShellCmdEvalProc) ();
- X
- Xint
- Xmain(argc, argv)
- X int argc;
- X char **argv;
- X{
- X Tcl_Interp *interp;
- X char *defaultFile;
- X
- X
- X /*
- X * Set values to return from the infox command.
- X */
- X tclxVersion = ckalloc (strlen (TCL_VERSION) +
- X strlen (TCL_EXTD_VERSION_SUFFIX) + 1);
- X strcpy (tclxVersion, TCL_VERSION);
- X strcat (tclxVersion, TCL_EXTD_VERSION_SUFFIX);
- X
- X tclxPatchlevel = "PATCHLEVEL";
- X
- X /*
- X * Path name for default file. A version number is normally appended.
- X * >>>> MAYBE MODIFIED FOR a specific application <<<
- X */
- X
- X defaultFile = ckalloc (strlen (TCL_DEFAULT) + strlen (TCL_VERSION) +
- X strlen (TCL_EXTD_VERSION_SUFFIX) + 1);
- X strcpy (defaultFile, TCL_DEFAULT);
- X strcat (defaultFile, TCL_VERSION);
- X strcat (defaultFile, TCL_EXTD_VERSION_SUFFIX);
- X
- X /*
- X * Set application specific values to return from the infox command.
- X * >>>> MAYBE MODIFIED FOR a specific application <<<
- X */
- X tclAppName = "TclX";
- X tclAppLongname = "Extended Tcl Shell";
- X tclAppVersion = tclxVersion;
- X
- X /*
- X * If history is to be used, then set the eval procedure pointer that
- X * Tcl_CommandLoop so that history will be recorded. This reference
- X * also brings in history from Tcl.a.
- X */
- X#ifndef TCL_NOHISTORY
- X tclShellCmdEvalProc = Tcl_RecordAndEval;
- X#endif
- X
- X /*
- X * Create a Tcl interpreter for the session, with all extended commands
- X * initialized. This can be replaced with Tcl_CreateInterp followed
- X * by a subset of the extended command initializaton procedures if
- X * desired.
- X */
- X interp = Tcl_CreateExtendedInterp();
- X
- X /*
- X * >>>>>> INITIALIZE APPLICATION SPECIFIC COMMANDS HERE <<<<<<
- X */
- X
- X /*
- X * Load the tcl startup code, this should pull in all of the tcl
- X * procs, paths, command line processing, autoloads, packages, etc.
- X * If Tcl was invoked interactively, Tcl_Startup will give it
- X * a command loop .
- X */
- X
- X Tcl_Startup (interp, argc, argv, defaultFile);
- X
- X /*
- X * Delete the interpreter (not neccessary under Unix, but we do
- X * it if TCL_MEM_DEBUG is set to better enable us to catch memory
- X * corruption problems)
- X */
- X
- X#ifdef TCL_MEM_DEBUG
- X Tcl_DeleteInterp(interp);
- X ckfree (defaultFile);
- X ckfree (tclxVersion);
- X#endif
- X
- X#ifdef TCL_SHELL_MEM_LEAK
- X printf (" >>> Dumping active memory list to mem.lst <<<\n");
- X if (Tcl_DumpActiveMemory ("mem.lst") != TCL_OK)
- X panic ("error accessing `mem.lst': %s", strerror (errno));
- X#endif
- X
- X exit(0);
- X}
- X
- END_OF_FILE
- if test 3938 -ne `wc -c <'extended/src/main.c'`; then
- echo shar: \"'extended/src/main.c'\" unpacked with wrong size!
- fi
- # end of 'extended/src/main.c'
- fi
- if test -f 'extended/tcllib/help/commands/array' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'extended/tcllib/help/commands/array'\"
- else
- echo shar: Extracting \"'extended/tcllib/help/commands/array'\" \(3520 characters\)
- sed "s/^X//" >'extended/tcllib/help/commands/array' <<'END_OF_FILE'
- X array option arrayName ?arg arg ...?
- X This command performs one of several operations on the
- X variable given by arrayName. ArrayName must be the
- X name of an existing array variable. The option
- X argument determines what action is carried out by the
- X command. The legal options (which may be abbreviated)
- X are:
- X
- X array anymore arrayName searchId
- X Returns 1 if there are any more elements left to
- X be processed in an array search, 0 if all elements
- X have already been returned. SearchId indicates
- X which search on arrayName to check, and must have
- X been the return value from a previous invocation
- X of array startsearch. This option is particularly
- X useful if an array has an element with an empty
- X name, since the return value from array
- X nextelement won't indicate whether the search has
- X been completed.
- X
- X array donesearch arrayName searchId
- X This command terminates an array search and
- X destroys all the state associated with that
- X search. SearchId indicates which search on
- X arrayName to destroy, and must have been the
- X return value from a previous invocation of array
- X startsearch. Returns an empty string.
- X
- X array names arrayName
- X Returns a list containing the names of all of the
- X elements in the array. If there are no elements
- X in the array then an empty string is returned.
- X
- X array nextelement arrayName searchId
- X Returns the name of the next element in arrayName,
- X or an empty string if all elements of arrayName
- X have already been returned in this search. The
- X searchId argument identifies the search, and must
- X have been the return value of an array startsearch
- X command. Warning: if elements are added to or
- X deleted from the array, then all searches are
- X automatically terminated just as if array
- X donesearch had been invoked; this will cause array
- X nextelement operations to fail for those searches.
- X
- X array size arrayName
- X Returns a decimal string giving the number of
- X elements in the array.
- X
- X array startsearch arrayName
- X This command initializes an element-by-element
- X search through the array given by arrayName, such
- X that invocations of the array nextelement command
- X will return the names of the individual elements
- X in the array. When the search has been completed,
- X the array donesearch command should be invoked.
- X The return value is a search identifier that must
- X be used in array nextelement and array donesearch
- X commands; it allows multiple searches to be
- X underway simultaneously for the same array.
- END_OF_FILE
- if test 3520 -ne `wc -c <'extended/tcllib/help/commands/array'`; then
- echo shar: \"'extended/tcllib/help/commands/array'\" unpacked with wrong size!
- fi
- # end of 'extended/tcllib/help/commands/array'
- fi
- if test -f 'extended/tcllib/help/commands/errorCode' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'extended/tcllib/help/commands/errorCode'\"
- else
- echo shar: Extracting \"'extended/tcllib/help/commands/errorCode'\" \(3886 characters\)
- sed "s/^X//" >'extended/tcllib/help/commands/errorCode' <<'END_OF_FILE'
- X errorCode
- X After an error has occurred, this variable will be set
- X to hold additional information about the error in a
- X form that is easy to process with programs. errorCode
- X consists of a Tcl list with one or more elements. The
- X first element of the list identifies a general class of
- X errors, and determines the format of the rest of the
- X list. The following formats for errorCode are used by
- X the Tcl core; individual applications may define
- X additional formats.
- X
- X CHILDKILLED pid sigName msg
- X This format is used when a child process has been
- X killed because of a signal. The second element of
- X errorCode will be the process's identifier (in
- X decimal). The third element will be the symbolic
- X name of the signal that caused the process to
- X terminate; it will be one of the names from the
- X include file signal.h, such as SIGPIPE. The
- X fourth element will be a short human-readable
- X message describing the signal, such as ``write on
- X pipe with no readers'' for SIGPIPE.
- X
- X CHILDSTATUS pid code
- X This format is used when a child process has
- X exited with a non-zero exit status. The second
- X element of errorCode will be the process's
- X identifier (in decimal) and the third element will
- X be the exit code returned by the process (also in
- X decimal).
- X
- X CHILDSUSP pid code
- X This format is used when a child process has been
- X suspended because of a signal. The second element
- X of errorCode will be the process's identifier, in
- X decimal. The third element will be the symbolic
- X name of the signal that caused the process to
- X suspend; this will be one of the names from the
- X include file signal.h, such as SIGTTIN. The
- X fourth element will be a short human-readable
- X message describing the signal, such as
- X ``background tty read'' for SIGTTIN.
- X
- X NONE
- X This format is used for errors where no additional
- X information is available for an error besides the
- X message returned with the error. In these cases
- X errorCode will consist of a list containing a
- X single element whose contents are NONE.
- X
- X UNIX errName msg
- X If the first element of errorCode is UNIX, then
- X the error occurred during a UNIX kernel call. The
- X second element of the list will contain the
- X symbolic name of the error that occurred, such as
- X ENOENT; this will be one of the values defined in
- X the include file errno.h. The third element of
- X the list will be a human-readable message
- X corresponding to errName, such as ``no such file
- X or directory'' for the ENOENT case.
- X
- X To set errorCode, applications should use library
- X procedures such as Tcl_SetErrorCode and Tcl_UnixError,
- X or they may invoke the error command. If one of these
- X methods hasn't been used, then the Tcl interpreter will
- X reset the variable to NONE after the next error.
- END_OF_FILE
- if test 3886 -ne `wc -c <'extended/tcllib/help/commands/errorCode'`; then
- echo shar: \"'extended/tcllib/help/commands/errorCode'\" unpacked with wrong size!
- fi
- # end of 'extended/tcllib/help/commands/errorCode'
- fi
- if test -f 'extended/tcllib/help/commands/exec' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'extended/tcllib/help/commands/exec'\"
- else
- echo shar: Extracting \"'extended/tcllib/help/commands/exec'\" \(3730 characters\)
- sed "s/^X//" >'extended/tcllib/help/commands/exec' <<'END_OF_FILE'
- X exec arg ?arg ...?
- X This command treats its arguments as the specification
- X of one or more UNIX commands to execute as
- X subprocesses. The commands take the form of a standard
- X shell pipeline; ``|'' arguments separate commands in
- X the pipeline and cause standard output of the preceding
- X command to be piped into standard input of the next
- X command.
- X
- X Under normal conditions the result of the exec command
- X consists of the standard output produced by the last
- X command in the pipeline. If any of the commands in the
- X pipeline exit abnormally or are killed or suspended,
- X then exec will return an error and the error message
- X will include the pipeline's output followed by error
- X messages describing the abnormal terminations; the
- X errorCode variable will contain additional information
- X about the last abnormal termination encountered. If
- X any of the commands writes to its standard error file,
- X then exec will return an error, and the error message
- X will include the pipeline's output, followed by
- X messages about abnormal terminations (if any), followed
- X by the standard error output.
- X
- X If the last character of the result or error message is
- X a newline then that character is deleted from the
- X result or error message for consistency with normal Tcl
- X return values.
- X
- X If an arg has the value ``>'' then the following
- X argument is taken as the name of a file and the
- X standard output of the last command in the pipeline is
- X redirected to the file. In this situation exec will
- X normally return an empty string.
- X
- X If an arg has the value ``<'' then the following
- X argument is taken as the name of a file to use for
- X standard input to the first command in the pipeline.
- X If an argument has the value ``<<'' then the following
- X argument is taken as an immediate value to be passed to
- X the first command as standard input. If there is no
- X ``<'' or ``<<'' argument then the standard input for
- X the first command in the pipeline is taken from the
- X application's current standard input.
- X
- X If the last arg is ``&'' then the command will be
- X executed in background. In this case the standard
- X output from the last command in the pipeline will go to
- X the application's standard output unless redirected in
- X the command, and error output from all the commands in
- X the pipeline will go to the application's standard
- X error file.
- X
- X Each arg becomes one word for a command, except for
- X ``|'', ``<'', ``<<'', ``>'', and ``&'' arguments, and
- X the arguments that follow ``<'', ``<<'', and ``>''.
- X The first word in each command is taken as the command
- X name; tilde-substitution is performed on it, and the
- X directories in the PATH environment variable are
- X searched for an executable by the given name. No
- X ``glob'' expansion or other shell-like substitutions
- X are performed on the arguments to commands.
- X
- END_OF_FILE
- if test 3730 -ne `wc -c <'extended/tcllib/help/commands/exec'`; then
- echo shar: \"'extended/tcllib/help/commands/exec'\" unpacked with wrong size!
- fi
- # end of 'extended/tcllib/help/commands/exec'
- fi
- if test -f 'extended/tcllib/help/commands/proc' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'extended/tcllib/help/commands/proc'\"
- else
- echo shar: Extracting \"'extended/tcllib/help/commands/proc'\" \(3180 characters\)
- sed "s/^X//" >'extended/tcllib/help/commands/proc' <<'END_OF_FILE'
- X proc name args body
- X The proc command creates a new Tcl command procedure,
- X name, replacing any existing command there may have
- X been by that name. Whenever the new command is
- X invoked, the contents of body will be executed by the
- X Tcl interpreter. Args specifies the formal arguments
- X to the procedure. It consists of a list, possibly
- X empty, each of whose elements specifies one argument.
- X Each argument specifier is also a list with either one
- X or two fields. If there is only a single field in the
- X specifier, then it is the name of the argument; if
- X there are two fields, then the first is the argument
- X name and the second is its default value. braces and
- X backslashes may be used in the usual way to specify
- X complex default values.
- X
- X When name is invoked, a local variable will be created
- X for each of the formal arguments to the procedure; its
- X value will be the value of corresponding argument in
- X the invoking command or the argument's default value.
- X Arguments with default values need not be specified in
- X a procedure invocation. However, there must be enough
- X actual arguments for all the formal arguments that
- X don't have defaults, and there must not be any extra
- X actual arguments. There is one special case to permit
- X procedures with variable numbers of arguments. If the
- X last formal argument has the name args, then a call to
- X the procedure may contain more actual arguments than
- X the procedure has formals. In this case, all of the
- X actual arguments starting at the one that would be
- X assigned to args are combined into a list (as if the
- X list command had been used); this combined value is
- X assigned to the local variable args.
- X
- X When body is being executed, variable names normally
- X refer to local variables, which are created
- X automatically when referenced and deleted when the
- X procedure returns. One local variable is automatically
- X created for each of the procedure's arguments. Global
- X variables can only be accessed by invoking the global
- X command.
- X
- X The proc command returns the null string. When a
- X procedure is invoked, the procedure's return value is
- X the value specified in a return command. If the
- X procedure doesn't execute an explicit return, then its
- X return value is the value of the last command executed
- X in the procedure's body. If an error occurs while
- X executing the procedure body, then the procedure-as-a-
- X whole will return that same error.
- END_OF_FILE
- if test 3180 -ne `wc -c <'extended/tcllib/help/commands/proc'`; then
- echo shar: \"'extended/tcllib/help/commands/proc'\" unpacked with wrong size!
- fi
- # end of 'extended/tcllib/help/commands/proc'
- fi
- if test -f 'extended/tcllib/help/intro/backslash' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'extended/tcllib/help/intro/backslash'\"
- else
- echo shar: Extracting \"'extended/tcllib/help/intro/backslash'\" \(3691 characters\)
- sed "s/^X//" >'extended/tcllib/help/intro/backslash' <<'END_OF_FILE'
- X BACKSLASH SUBSTITUTION
- X Backslashes may be used to insert non-printing characters
- X into command fields and also to insert special characters
- X like braces and brackets into fields without them being
- X interpreted specially as described above. The backslash
- X sequences understood by the Tcl interpreter are listed
- X below. In each case, the backslash sequence is replaced by
- X the given character:
- X
- X \b Backspace (0x8).
- X
- X \f Form feed (0xc).
- X
- X \n Newline (0xa).
- X
- X \r Carriage-return (0xd).
- X
- X \t Tab (0x9).
- X
- X \v Vertical tab (0xb).
- X
- X \{ Left brace (``{'').
- X
- X \} Right brace (``}'').
- X
- X \[ Open bracket (``['').
- X
- X \] Close bracket (``]'').
- X
- X \$ Dollar sign (``$'').
- X
- X \<space> Space (`` ''): doesn't terminate
- X argument.
- X
- X \; Semi-colon: doesn't terminate command.
- X
- X \" Double-quote.
- X
- X \<newline> Nothing: this joins two lines together
- X into a single line. This backslash
- X feature is unique in that it will be
- X applied even when the sequence occurs
- X within braces.
- X
- X \\ Backslash (``\'').
- X
- X \ddd The digits ddd (one, two, or three of
- X them) give the octal value of the
- X character. Null characters may not be
- X embedded in command fields; if ddd is
- X zero then the backslash sequence is
- X ignored (i.e. it maps to an empty
- X string).
- X
- X For example, in the command
- X
- X set a \{x\[\ yz\141
- X
- X the second argument to set will be ``{x[ yza''.
- X
- X If a backslash is followed by something other than one of
- X the options described above, then the backslash is
- X transmitted to the argument field without any special
- X processing, and the Tcl scanner continues normal processing
- X with the next character. For example, in the command
- X
- X set \*a \\\{foo
- X The first argument to set will be \*a and the second
- X argument will be \{foo.
- X
- X If an argument is enclosed in braces, then backslash
- X sequences inside the argument are parsed but no substitution
- X occurs (except for backslash-newline): the backslash
- X sequence is passed through to the argument as is, without
- X making any special interpretation of the characters in the
- X backslash sequence. In particular, backslashed braces are
- X not counted in locating the matching right brace that
- X terminates the argument. For example, in the command
- X
- X set a {\{abc}
- X
- X the second argument to set will be \{abc.
- X
- X This backslash mechanism is not sufficient to generate
- X absolutely any argument structure; it only covers the most
- X common cases. To produce particularly complicated arguments
- X it is probably easiest to use the format command along with
- X command substitution.
- END_OF_FILE
- if test 3691 -ne `wc -c <'extended/tcllib/help/intro/backslash'`; then
- echo shar: \"'extended/tcllib/help/intro/backslash'\" unpacked with wrong size!
- fi
- # end of 'extended/tcllib/help/intro/backslash'
- fi
- if test -f 'extended/tcllib/help/intro/dollar' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'extended/tcllib/help/intro/dollar'\"
- else
- echo shar: Extracting \"'extended/tcllib/help/intro/dollar'\" \(3336 characters\)
- sed "s/^X//" >'extended/tcllib/help/intro/dollar' <<'END_OF_FILE'
- X VARIABLE SUBSTITUTION WITH $
- X The dollar sign ($) may be used as a special shorthand form
- X for substituting variable values. If $ appears in an
- X argument that isn't enclosed in braces then variable
- X substitution will occur. The characters after the $, up to
- X the first character that isn't a number, letter, or
- X underscore, are taken as a variable name and the string
- X value of that variable is substituted for the name. For
- X example, if variable foo has the value test, then the
- X command
- X
- X set a $foo.c
- X
- X is equivalent to the command
- X
- X set a test.c
- X
- X
- X There are two special forms for variable substitution. If
- X the next character after the name of the variable is an open
- X parenthesis, then the variable is assumed to be an array
- X name, and all of the characters between the open parenthesis
- X and the next close parenthesis are taken as an index into
- X the array. Command substitutions and variable substitutions
- X are performed on the information between the parentheses
- X before it is used as an index. For example, if the variable
- X x is an array with one element named first and value 87 and
- X another element named 14 and value more, then the command
- X
- X set a xyz$x(first)zyx
- X is equivalent to the command
- X
- X set a xyz87zyx
- X
- X If the variable index has the value 14, then the command
- X
- X set a xyz$x($index)zyx
- X is equivalent to the command
- X
- X set a xyzmorezyx
- X
- X For more information on arrays, see VARIABLES AND ARRAYS
- X below.
- X
- X The second special form for variables occurs when the dollar
- X sign is followed by an open curly brace. In this case the
- X variable name consists of all the characters up to the next
- X curly brace. Array references are not possible in this
- X form: the name between braces is assumed to refer to a
- X scalar variable. For example, if variable foo has the value
- X test, then the command
- X
- X set a abc${foo}bar
- X is equivalent to the command
- X
- X set a abctestbar
- X
- X Variable substitution does not occur in arguments that are
- X enclosed in braces: the dollar sign and variable name are
- X passed through to the argument verbatim.
- X
- X The dollar sign abbreviation is simply a shorthand form. $a
- X is completely equivalent to [set a]; it is provided as a
- X convenience to reduce typing.
- END_OF_FILE
- if test 3336 -ne `wc -c <'extended/tcllib/help/intro/dollar'`; then
- echo shar: \"'extended/tcllib/help/intro/dollar'\" unpacked with wrong size!
- fi
- # end of 'extended/tcllib/help/intro/dollar'
- fi
- if test -f 'extended/tcllib/help/intro/results' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'extended/tcllib/help/intro/results'\"
- else
- echo shar: Extracting \"'extended/tcllib/help/intro/results'\" \(3867 characters\)
- sed "s/^X//" >'extended/tcllib/help/intro/results' <<'END_OF_FILE'
- X COMMAND RESULTS
- X Each command produces two results: a code and a string.
- X The code indicates whether the command completed
- X successfully or not, and the string gives additional
- X information. The valid codes are defined in tcl.h, and are:
- X
- X TCL_OK This is the normal return code, and
- X indicates that the command
- X completed successfully. The string
- X gives the command's return value.
- X
- X TCL_ERROR Indicates that an error occurred;
- X the string gives a message
- X describing the error. In additon,
- X the global variable errorInfo will
- X contain human-readable information
- X describing which commands and
- X procedures were being executed when
- X the error occurred, and the global
- X variable errorCode will contain
- X machine-readable details about the
- X error, if they are available. See
- X the section BUILT-IN VARIABLES
- X below for more information.
- X
- X TCL_RETURN Indicates that the return command
- X has been invoked, and that the
- X current procedure (or top-level
- X command or source command) should
- X return immediately. The string
- X gives the return value for the
- X procedure or command.
- X
- X TCL_BREAK Indicates that the break command
- X has been invoked, so the innermost
- X loop should abort immediately. The
- X string should always be empty.
- X
- X TCL_CONTINUE Indicates that the continue command
- X has been invoked, so the innermost
- X loop should go on to the next
- X iteration. The string should
- X always be empty.
- X Tcl programmers do not normally need to think about return
- X codes, since TCL_OK is almost always returned. If anything
- X else is returned by a command, then the Tcl interpreter
- X immediately stops processing commands and returns to its
- X caller. If there are several nested invocations of the Tcl
- X interpreter in progress, then each nested command will
- X usually return the error to its caller, until eventually the
- X error is reported to the top-level application code. The
- X application will then display the error message for the
- X user.
- X
- X In a few cases, some commands will handle certain ``error''
- X conditions themselves and not return them upwards. For
- X example, the for command checks for the TCL_BREAK code; if
- X it occurs, then for stops executing the body of the loop and
- X returns TCL_OK to its caller. The for command also handles
- X TCL_CONTINUE codes and the procedure interpreter handles
- X TCL_RETURN codes. The catch command allows Tcl programs to
- X catch errors and handle them without aborting command
- X interpretation any further.
- END_OF_FILE
- if test 3867 -ne `wc -c <'extended/tcllib/help/intro/results'`; then
- echo shar: \"'extended/tcllib/help/intro/results'\" unpacked with wrong size!
- fi
- # end of 'extended/tcllib/help/intro/results'
- fi
- if test -f 'extended/tcllib/help/misc/memory' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'extended/tcllib/help/misc/memory'\"
- else
- echo shar: Extracting \"'extended/tcllib/help/misc/memory'\" \(3618 characters\)
- sed "s/^X//" >'extended/tcllib/help/misc/memory' <<'END_OF_FILE'
- X
- X
- X memory options
- X The Tcl memory command gives the Tcl developer control
- X of Tcl's memory debugging capabilities. The memory
- X command has several suboptions, which are described
- X below. It is only available when Tcl has been compiled
- X with memory debugging enabled.
- X
- X memory info
- X Produces a report containing the total allocations and
- X frees since Tcl began, the current packets allocated
- X (the current number of calls to ckalloc not met by a
- X corresponding call to ckfree), the current bytes
- X allocated, and the maximum number of packets and bytes
- X allocated.
- X
- X memory trace [on|off]
- X Turns memory tracing on or off. When memory tracing is
- X on, every call to ckalloc causes a line of trace
- X information to be written to stderr, consisting of the
- X word ckalloc, followed by the address returned, the
- X amount of memory allocated, and the C filename and line
- X number of the code performing the allocation, for
- X example...
- X
- X ckalloc 40e478 98 tclProc.c 1406
- X
- X Calls to ckfree are traced in the same manner, except
- X that the word ckalloc is replaced by the word ckfree.
- X
- X memory validate [on|off]
- X Turns memory vaidation on or off. When memory
- X validation is enabled, on every call to ckalloc or
- X ckfree, the guard zones are checked for every piece of
- X memory currently in existence that was allocated by
- X ckalloc. This has a large performance impact and
- X should only be used when overwrite problems are
- X strongly suspected. The advantage of enabling memory
- X validation is that a guard zone overwrite can be
- X detected on the first call to ckalloc or ckfree after
- X the overwrite occurred, rather than when the specific
- X memory with the overwritten guard zone(s) is freed,
- X which may occur long after the overwrite occurred.
- X
- X memory trace_on_at_malloc nnn
- X Enable memory tracing after nnn ckallocs have been
- X performed. For example, if you enter memory
- X trace_on_at_malloc 100, after the 100th call to
- X ckalloc, memory trace information will begin being
- X displayed for all allocations and frees. Since there
- X can be a lot of memory activity before a problem
- X occurs, judicious use of this option can reduce the
- X slowdown caused by tracing (and the amount of trace
- X information produced), if you can identify a number of
- X allocations that occur before the problem sets in. The
- X current number of memory allocations that have occured
- X since Tcl started is printed on a guard zone failure.
- X
- X memory break_on_malloc nnn
- X After the nnn allocations have been performed, ckallocs
- X output a message to this effect and that it is now
- X attempting to enter the C debugger. Tcl will then
- X issue a SIGINT signal against itself. If you are
- X running Tcl under a C debugger, it should then enter
- X the debugger command mode.
- X
- X memory display file
- X Write a list of all currently allocated memory to the
- X specified file.
- END_OF_FILE
- if test 3618 -ne `wc -c <'extended/tcllib/help/misc/memory'`; then
- echo shar: \"'extended/tcllib/help/misc/memory'\" unpacked with wrong size!
- fi
- # end of 'extended/tcllib/help/misc/memory'
- fi
- if test -f 'extended/tcllib/help/tclshell/packagelib' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'extended/tcllib/help/tclshell/packagelib'\"
- else
- echo shar: Extracting \"'extended/tcllib/help/tclshell/packagelib'\" \(3287 characters\)
- sed "s/^X//" >'extended/tcllib/help/tclshell/packagelib' <<'END_OF_FILE'
- X
- X
- X PACKAGE LIBRARIES
- X Package libraries work like autoload, except that a package
- X library file can contain multiple independent Tcl packages.
- X A package is a collection of related Tcl procedures.
- X
- X The package library file is just a regular Unix text file,
- X editable with your favorite text editor, containing packages
- X of Tcl source code. The package library must end in .tlib,
- X an index file with the suffix .tndx will be built
- X corresponding to the package library. The start of a
- X package is delimited by:
- X
- X #@package: package_name proc1 [..procN]
- X
- X These lines must start in column one. Everything between
- X the package keyword and the next package keyword, or the end
- X of the file, becomes part of the named package. The
- X specified procedures, proc1..procN, are the entry points of
- X the package. When a command named in a package command is
- X executed and detected as an unknown command, all code in the
- X specified package will be sourced. This package should
- X define all of the procedures named on the package line,
- X define any support procedures required by the package and do
- X any package-specific initialization.
- X
- X For example, in a package source file, the presence of the
- X following line:
- X
- X #@package: directory_stack pushd popd dirs
- X
- X says that the text lines following that line in the package
- X file up to the next package line or the end of the file is a
- X package named directory_stack and that an attempt to execute
- X either pushd, popd or dirs when the routine is not already
- X defined will cause the directory_stack portion of the
- X package file to be loaded.
- X
- X PACKAGE INDEX FILES
- X A package library file has associated with it an index file
- X called a .tndx file. The .tndx file contains the names of
- X the packages in the .tlib file, their addresses and lengths
- X within the .tlib file and the functions that are to cause
- X the different packages to be autoloaded when an attempt is
- X made to execute them.
- X
- X The first time Tcl tries to execute a procedure where the
- X procedure doesn't exist and isn't an autoload, Tcl will
- X search along TCLPATH looking for any files ending in .tlib.
- X For each one it finds, it checks to see if there is a
- X corresponding file in the same directory ending in .tndx.
- X If the .tndx file doesn't exist, or if its date of last
- X modification is older than that of the .tlib file, the .tndx
- X is automatically (re)generated if possible. If Tcl can't
- X regenerate the file (most likely due to file or directory
- X permission problems), an error occurs.
- X
- X Demand loading is also supported from indexes build by the
- X mkindex.tcl program, supplied with standard Tcl. However,
- X init.tcl is not loaded. Note that the info library command
- X is not used to locate libraries by this shell; the TCLPATH
- X variable is set by the default file and is used to locate
- X the libraries.
- END_OF_FILE
- if test 3287 -ne `wc -c <'extended/tcllib/help/tclshell/packagelib'`; then
- echo shar: \"'extended/tcllib/help/tclshell/packagelib'\" unpacked with wrong size!
- fi
- # end of 'extended/tcllib/help/tclshell/packagelib'
- fi
- if test -f 'extended/tests/chartype.test' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'extended/tests/chartype.test'\"
- else
- echo shar: Extracting \"'extended/tests/chartype.test'\" \(3606 characters\)
- sed "s/^X//" >'extended/tests/chartype.test' <<'END_OF_FILE'
- X#
- X# chartype.test
- X#
- X# Tests for the ctype command.
- X#---------------------------------------------------------------------------
- X# Copyright 1991 Karl Lehenbauer and Mark Diekhans.
- X#
- X# Permission to use, copy, modify, and distribute this software and its
- X# documentation for any purpose and without fee is hereby granted, provided
- X# that the above copyright notice appear in all copies. Karl Lehenbauer and
- X# Mark Diekhans make no representations about the suitability of this
- X# software for any purpose. It is provided "as is" without express or
- X# implied warranty.
- X#
- X
- Xif {[info procs test] != "test"} then {source defs}
- X
- Xtest chartype-1.1 {ctype tests} {
- X ctype digit 01234567
- X} {1}
- X
- Xtest chartype-1.2 {ctype tests} {
- X ctype digit abc123cd
- X} {0}
- X
- Xtest chartype-1.3 {ctype tests} {
- X ctype xdigit 01234567abcdefABCDEF
- X} {1}
- X
- Xtest chartype-1.4 {ctype tests} {
- X ctype xdigit XMc123cd
- X} {0}
- X
- Xtest chartype-1.5 {ctype tests} {
- X ctype lower abcdefgh
- X} {1}
- X
- Xtest chartype-1.6 {ctype tests} {
- X ctype lower abcDeFgh
- X} {0}
- X
- Xtest chartype-1.7 {ctype tests} {
- X ctype upper ABCDEFGH
- X} {1}
- X
- Xtest chartype-1.8 {ctype tests} {
- X ctype upper abcDeFgh
- X} {0}
- X
- Xtest chartype-1.9 {ctype tests} {
- X ctype alpha abcdXYZ
- X} {1}
- X
- Xtest chartype-1.10 {ctype tests} {
- X ctype alpha abc123cd
- X} {0}
- X
- Xtest chartype-1.11 {ctype tests} {
- X ctype alnum 0123ABC7
- X} {1}
- X
- Xtest chartype-1.12 {ctype tests} {
- X ctype alnum ab.%23cd
- X} {0}
- X
- Xtest chartype-1.13 {ctype tests} {
- X ctype space " \t\n "
- X} {1}
- X
- Xtest chartype-1.14 {ctype tests} {
- X ctype space "ab \t z"
- X} {0}
- X
- Xtest chartype-1.15 {ctype tests} {
- X ctype cntrl "[ctype char 7][ctype char 15][ctype char 20]"
- X} {1}
- X
- Xtest chartype-1.16 {ctype tests} {
- X ctype cntrl "[ctype char 7]abcd"
- X} {0}
- X
- Xtest chartype-1.17 {ctype tests} {
- X ctype punct ".,:;"
- X} {1}
- X
- Xtest chartype-1.18 {ctype tests} {
- X ctype punct ".,:;ab"
- X} {0}
- X
- X
- Xtest chartype-1.19 {ctype tests} {
- X ctype print "01 :;.567"
- X} {1}
- X
- Xtest chartype-1.20 {ctype tests} {
- X ctype print "[ctype char 7][ctype char 15]abc"
- X} {0}
- X
- X
- Xtest chartype-1.21 {ctype tests} {
- X ctype graph "ab.zxy"
- X} {1}
- X
- Xtest chartype-1.22 {ctype tests} {
- X ctype graph "abc 3cd"
- X} {0}
- X
- Xtest chartype-1.23 {ctype tests} {
- X ctype ascii 01234567
- X} {1}
- X
- Xtest chartype-1.24 {ctype tests} {
- X ctype ascii "[ctype char 220][ctype char 126]123cd"
- X} {0}
- X
- Xtest chartype-1.25 {ctype tests} {
- X list [catch {ctype ascii} msg] $msg
- X} {1 {wrong # args: ctype class string}}
- X
- Xtest chartype-1.26 {ctype tests} {
- X list [catch {ctype ascbb foo} msg] $msg
- X} {1 {unrecognized class specification: "ascbb", expected one of: alnum, alpha, ascii, char, cntrl, digit, graph, lower, ord, print, punct, space, upper or xdigit}}
- X
- X
- Xtest chartype-1.27 {ctype char tests} {
- X ctype char 65
- X} {A}
- X
- Xtest chartype-1.28 {ctype char tests} {
- X ctype char 97
- X} {a}
- X
- Xtest chartype-1.29 {ctype char tests} {
- X ctype char 57
- X} {9}
- X
- Xtest chartype-1.30 {ctype char tests} {
- X ctype char 35
- X} {#}
- X
- Xtest chartype-1.31 {ctype char tests} {
- X list [catch {ctype char 256} msg] $msg
- X} {1 {number must be in the range 0..255}}
- X
- Xtest chartype-1.32 {ctype ord tests} {
- X ctype ord A
- X} {65}
- X
- Xtest chartype-1.33 {ctype ord tests} {
- X ctype ord a
- X} {97}
- X
- Xtest chartype-1.34 {ctype ord tests} {
- X ctype ord 9
- X} {57}
- X
- Xtest chartype-1.35 {ctype ord tests} {
- X ctype ord "#"
- X} {35}
- X
- Xtest chartype-1.36 {ctype ord tests} {
- X list [catch {ctype ord} msg] $msg
- X} {1 {wrong # args: ctype class string}}
- X
- Xtest chartype-1.37 {ctype ord tests} {
- X list [catch {ctype ord ""} msg] $msg
- X} {1 {string to convert must be only one character}}
- X
- X
- END_OF_FILE
- if test 3606 -ne `wc -c <'extended/tests/chartype.test'`; then
- echo shar: \"'extended/tests/chartype.test'\" unpacked with wrong size!
- fi
- # end of 'extended/tests/chartype.test'
- fi
- echo shar: End of archive 7 \(of 23\).
- cp /dev/null ark7isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 23 archives.
- echo "Now cd to "extended", edit the makefile, then do a "make""
- rm -f ark[1-9]isdone ark[1-9][0-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
-
- exit 0 # Just in case...
- --
- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM
- Sterling Software, IMD UUCP: uunet!sparky!kent
- Phone: (402) 291-8300 FAX: (402) 291-4362
- Please send comp.sources.misc-related mail to kent@uunet.uu.net.
-