home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-11-19 | 50.4 KB | 1,578 lines |
- Newsgroups: comp.sources.misc
- From: karl@sugar.neosoft.com (Karl Lehenbauer)
- Subject: v26i009: tclx - extensions and on-line help for tcl 6.1, Part09/23
- Message-ID: <1991Nov19.005525.8857@sparky.imd.sterling.com>
- X-Md4-Signature: c36cded47e52233811d835850fd87680
- Date: Tue, 19 Nov 1991 00:55:25 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: karl@sugar.neosoft.com (Karl Lehenbauer)
- Posting-number: Volume 26, Issue 9
- Archive-name: tclx/part09
- 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 9 (of 23)."
- # Contents: extended/man/Keylist.man extended/man/MathErr.man
- # extended/man/tcl.tlib.man extended/tcllib/help/commands/string
- # extended/tests/filescan.test extended/tests/fmath.test
- # extended/tests/help.test extended/tests/keylist.test
- # Wrapped by karl@one on Wed Nov 13 21:50:21 1991
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'extended/man/Keylist.man' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'extended/man/Keylist.man'\"
- else
- echo shar: Extracting \"'extended/man/Keylist.man'\" \(5511 characters\)
- sed "s/^X//" >'extended/man/Keylist.man' <<'END_OF_FILE'
- X.\"----------------------------------------------------------------------------
- X.\" The definitions below are for supplemental macros used in Sprite
- X.\" manual entries.
- X.\"
- X.\" .HS name section [date [version]]
- X.\" Replacement for .TH in other man pages. See below for valid
- X.\" section names.
- X.\"
- X.\" .AP type name in/out [indent]
- X.\" Start paragraph describing an argument to a library procedure.
- X.\" type is type of argument (int, etc.), in/out is either "in", "out",
- X.\" or "in/out" to describe whether procedure reads or modifies arg,
- X.\" and indent is equivalent to second arg of .IP (shouldn't ever be
- X.\" needed; use .AS below instead)
- X.\"
- X.\" .AS [type [name]]
- X.\" Give maximum sizes of arguments for setting tab stops. Type and
- X.\" name are examples of largest possible arguments that will be passed
- X.\" to .AP later. If args are omitted, default tab stops are used.
- X.\"
- X.\" .BS
- X.\" Start box enclosure. From here until next .BE, everything will be
- X.\" enclosed in one large box.
- X.\"
- X.\" .BE
- X.\" End of box enclosure.
- X.\"
- X.\" .VS
- X.\" Begin vertical sidebar, for use in marking newly-changed parts
- X.\" of man pages.
- X.\"
- X.\" .VE
- X.\" End of vertical sidebar.
- X.\"
- X.\" .DS
- X.\" Begin an indented unfilled display.
- X.\"
- X.\" .DE
- X.\" End of indented unfilled display.
- X.\"
- X' # Heading for Sprite man pages
- X.de HS
- X.if '\\$2'cmds' .TH \\$1 1 \\$3 \\$4
- X.if '\\$2'lib' .TH \\$1 3 \\$3 \\$4
- X.if '\\$2'tcl' .TH \\$1 3 \\$3 \\$4
- X.if '\\$2'tk' .TH \\$1 3 \\$3 \\$4
- X.if t .wh -1.3i ^B
- X.nr ^l \\n(.l
- X.ad b
- X..
- X' # Start an argument description
- X.de AP
- X.ie !"\\$4"" .TP \\$4
- X.el \{\
- X. ie !"\\$2"" .TP \\n()Cu
- X. el .TP 15
- X.\}
- X.ie !"\\$3"" \{\
- X.ta \\n()Au \\n()Bu
- X\&\\$1 \\fI\\$2\\fP (\\$3)
- X.\".b
- X.\}
- X.el \{\
- X.br
- X.ie !"\\$2"" \{\
- X\&\\$1 \\fI\\$2\\fP
- X.\}
- X.el \{\
- X\&\\fI\\$1\\fP
- X.\}
- X.\}
- X..
- X' # define tabbing values for .AP
- X.de AS
- X.nr )A 10n
- X.if !"\\$1"" .nr )A \\w'\\$1'u+3n
- X.nr )B \\n()Au+15n
- X.\"
- X.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
- X.nr )C \\n()Bu+\\w'(in/out)'u+2n
- X..
- X' # BS - start boxed text
- X' # ^y = starting y location
- X' # ^b = 1
- X.de BS
- X.br
- X.mk ^y
- X.nr ^b 1u
- X.if n .nf
- X.if n .ti 0
- X.if n \l'\\n(.lu\(ul'
- X.if n .fi
- X..
- X' # BE - end boxed text (draw box now)
- X.de BE
- X.nf
- X.ti 0
- X.mk ^t
- X.ie n \l'\\n(^lu\(ul'
- X.el \{\
- X.\" Draw four-sided box normally, but don't draw top of
- X.\" box if the box started on an earlier page.
- X.ie !\\n(^b-1 \{\
- X\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
- X.\}
- X.el \}\
- X\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
- X.\}
- X.\}
- X.fi
- X.br
- X.nr ^b 0
- X..
- X' # VS - start vertical sidebar
- X' # ^Y = starting y location
- X' # ^v = 1 (for troff; for nroff this doesn't matter)
- X.de VS
- X.mk ^Y
- X.ie n 'mc \s12\(br\s0
- X.el .nr ^v 1u
- X..
- X' # VE - end of vertical sidebar
- X.de VE
- X.ie n 'mc
- X.el \{\
- X.ev 2
- X.nf
- X.ti 0
- X.mk ^t
- X\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
- X.sp -1
- X.fi
- X.ev
- X.\}
- X.nr ^v 0
- X..
- X' # Special macro to handle page bottom: finish off current
- X' # box/sidebar if in box/sidebar mode, then invoked standard
- X' # page bottom macro.
- X.de ^B
- X.ev 2
- X'ti 0
- X'nf
- X.mk ^t
- X.if \\n(^b \{\
- X.\" Draw three-sided box if this is the box's first page,
- X.\" draw two sides but no top otherwise.
- X.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
- X.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
- X.\}
- X.if \\n(^v \{\
- X.nr ^x \\n(^tu+1v-\\n(^Yu
- X\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
- X.\}
- X.bp
- X'fi
- X.ev
- X.if \\n(^b \{\
- X.mk ^y
- X.nr ^b 2
- X.\}
- X.if \\n(^v \{\
- X.mk ^Y
- X.\}
- X..
- X' # DS - begin display
- X.de DS
- X.RS
- X.nf
- X.sp
- X..
- X' # DE - end display
- X.de DE
- X.fi
- X.RE
- X.sp .5
- X..
- X.\"----------------------------------------------------------------------------
- X.HS "Keyed Lists" tcl
- X.BS
- X'@index: Tcl_GetKeyedListField Tcl_SetKeyedListField Tcl_DeleteKeyedListField
- X.SH NAME
- XTcl_GetKeyedListField, Tcl_SetKeyedListField, Tcl_DeleteKeyedListField -
- XKeyed list management routines.
- X.SH SYNOPSIS
- X.nf
- X\fB#include <tclExtend.h>\fR
- X.sp
- Xint
- X\fBTcl_GetKeyedListField\fR (\fIinterp, fieldName, keyedList, fieldValuePtr\fR);
- X.sp
- Xchar *
- X\fBTcl_SetKeyedListField\fR (\fIinterp, fieldName, fieldvalue, keyedList\fR);
- X.sp
- Xchar *
- X\fBTcl_DeleteKeyedListField\fR (\fIinterp, fieldName, keyedList\fR);
- X'
- X.SH ARGUMENTS
- X.AS Tcl_Interp **fieldValuePtr
- X.AP Tcl_Interp *interp in
- XInterpreter to use for error reporting.
- X.AP "const char" *fieldName in
- XThe name of the field (the key) to perform the operation on.
- X.AP "const char" *keyedList in
- XThe keyed list to perform the operation on.
- X.AP char **fieldValuePtr out
- XA pointer to a dynamicly allocated string containing the field value is
- Xreturned here.
- X.BE
- X
- X.SH DESCRIPTION
- X.PP
- XThese routines perform operations on keyed lists. See the \fIExtended Tcl\fR
- Xman page for a description of keyed lists.
- X.PP
- X\fBTcl_GetKeyedListField\fR retrieves a field value from a keyed list. It
- Xreturns \fBTCL_OK\fR if the field was found, \fBTCL_BREAK\fR if the field was
- Xnot found and \fBTCL_ERROR\fR if an error occured. NULL maybe specifled for
- X\fIfieldValuePtr\fR to check for the presences of a field without actually
- Xextracting the value.
- X.PP
- X\fBTcl_SetKeyedListField\fR sets a field value in keyed list. It returns a
- Xpointer to a dynamically allocated string containing the new list, or NULL if
- Xan error occured.
- X.PP
- X\fBTcl_DeleteKeyedListField\fR deletes a field from keyed list. It returns a
- Xpointer to a dynamically allocated string containing the new list, or NULL if
- Xan error occured.
- X'
- X.SH KEYWORDS
- Xlists, keyed
- X
- END_OF_FILE
- if test 5511 -ne `wc -c <'extended/man/Keylist.man'`; then
- echo shar: \"'extended/man/Keylist.man'\" unpacked with wrong size!
- fi
- # end of 'extended/man/Keylist.man'
- fi
- if test -f 'extended/man/MathErr.man' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'extended/man/MathErr.man'\"
- else
- echo shar: Extracting \"'extended/man/MathErr.man'\" \(5171 characters\)
- sed "s/^X//" >'extended/man/MathErr.man' <<'END_OF_FILE'
- X.\"----------------------------------------------------------------------------
- X.\" The definitions below are for supplemental macros used in Sprite
- X.\" manual entries.
- X.\"
- X.\" .HS name section [date [version]]
- X.\" Replacement for .TH in other man pages. See below for valid
- X.\" section names.
- X.\"
- X.\" .AP type name in/out [indent]
- X.\" Start paragraph describing an argument to a library procedure.
- X.\" type is type of argument (int, etc.), in/out is either "in", "out",
- X.\" or "in/out" to describe whether procedure reads or modifies arg,
- X.\" and indent is equivalent to second arg of .IP (shouldn't ever be
- X.\" needed; use .AS below instead)
- X.\"
- X.\" .AS [type [name]]
- X.\" Give maximum sizes of arguments for setting tab stops. Type and
- X.\" name are examples of largest possible arguments that will be passed
- X.\" to .AP later. If args are omitted, default tab stops are used.
- X.\"
- X.\" .BS
- X.\" Start box enclosure. From here until next .BE, everything will be
- X.\" enclosed in one large box.
- X.\"
- X.\" .BE
- X.\" End of box enclosure.
- X.\"
- X.\" .VS
- X.\" Begin vertical sidebar, for use in marking newly-changed parts
- X.\" of man pages.
- X.\"
- X.\" .VE
- X.\" End of vertical sidebar.
- X.\"
- X.\" .DS
- X.\" Begin an indented unfilled display.
- X.\"
- X.\" .DE
- X.\" End of indented unfilled display.
- X.\"
- X' # Heading for Sprite man pages
- X.de HS
- X.if '\\$2'cmds' .TH \\$1 1 \\$3 \\$4
- X.if '\\$2'lib' .TH \\$1 3 \\$3 \\$4
- X.if '\\$2'tcl' .TH \\$1 3 \\$3 \\$4
- X.if '\\$2'tk' .TH \\$1 3 \\$3 \\$4
- X.if t .wh -1.3i ^B
- X.nr ^l \\n(.l
- X.ad b
- X..
- X' # Start an argument description
- X.de AP
- X.ie !"\\$4"" .TP \\$4
- X.el \{\
- X. ie !"\\$2"" .TP \\n()Cu
- X. el .TP 15
- X.\}
- X.ie !"\\$3"" \{\
- X.ta \\n()Au \\n()Bu
- X\&\\$1 \\fI\\$2\\fP (\\$3)
- X.\".b
- X.\}
- X.el \{\
- X.br
- X.ie !"\\$2"" \{\
- X\&\\$1 \\fI\\$2\\fP
- X.\}
- X.el \{\
- X\&\\fI\\$1\\fP
- X.\}
- X.\}
- X..
- X' # define tabbing values for .AP
- X.de AS
- X.nr )A 10n
- X.if !"\\$1"" .nr )A \\w'\\$1'u+3n
- X.nr )B \\n()Au+15n
- X.\"
- X.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
- X.nr )C \\n()Bu+\\w'(in/out)'u+2n
- X..
- X' # BS - start boxed text
- X' # ^y = starting y location
- X' # ^b = 1
- X.de BS
- X.br
- X.mk ^y
- X.nr ^b 1u
- X.if n .nf
- X.if n .ti 0
- X.if n \l'\\n(.lu\(ul'
- X.if n .fi
- X..
- X' # BE - end boxed text (draw box now)
- X.de BE
- X.nf
- X.ti 0
- X.mk ^t
- X.ie n \l'\\n(^lu\(ul'
- X.el \{\
- X.\" Draw four-sided box normally, but don't draw top of
- X.\" box if the box started on an earlier page.
- X.ie !\\n(^b-1 \{\
- X\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
- X.\}
- X.el \}\
- X\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
- X.\}
- X.\}
- X.fi
- X.br
- X.nr ^b 0
- X..
- X' # VS - start vertical sidebar
- X' # ^Y = starting y location
- X' # ^v = 1 (for troff; for nroff this doesn't matter)
- X.de VS
- X.mk ^Y
- X.ie n 'mc \s12\(br\s0
- X.el .nr ^v 1u
- X..
- X' # VE - end of vertical sidebar
- X.de VE
- X.ie n 'mc
- X.el \{\
- X.ev 2
- X.nf
- X.ti 0
- X.mk ^t
- X\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
- X.sp -1
- X.fi
- X.ev
- X.\}
- X.nr ^v 0
- X..
- X' # Special macro to handle page bottom: finish off current
- X' # box/sidebar if in box/sidebar mode, then invoked standard
- X' # page bottom macro.
- X.de ^B
- X.ev 2
- X'ti 0
- X'nf
- X.mk ^t
- X.if \\n(^b \{\
- X.\" Draw three-sided box if this is the box's first page,
- X.\" draw two sides but no top otherwise.
- X.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
- X.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
- X.\}
- X.if \\n(^v \{\
- X.nr ^x \\n(^tu+1v-\\n(^Yu
- X\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
- X.\}
- X.bp
- X'fi
- X.ev
- X.if \\n(^b \{\
- X.mk ^y
- X.nr ^b 2
- X.\}
- X.if \\n(^v \{\
- X.mk ^Y
- X.\}
- X..
- X' # DS - begin display
- X.de DS
- X.RS
- X.nf
- X.sp
- X..
- X' # DE - end display
- X.de DE
- X.fi
- X.RE
- X.sp .5
- X..
- X.\"----------------------------------------------------------------------------
- X.HS Tcl_MathError tcl
- X.BS
- X'@index: Tcl_MathError
- X.SH NAME
- XTcl_MathError - Floating point math error trap handler for Tcl.
- X.SH SYNOPSIS
- X.nf
- X\fB#include <tclExtend.h>\fR
- X.sp
- X\fBTcl_MathError\fR (\fIfunctionName, errorType\fR)
- X'
- X.SH ARGUMENTS
- X.AS char *functionName
- X.AP char *functionName in
- XThe name of the function that got the error. From the exception structure
- Xsupplied to matherr.
- X.AP int errorType in
- XThe type of error that occured. From the exception structure supplied to
- Xmatherr.
- X.BE
- X
- X.SH DESCRIPTION
- X.PP
- XTcl math error handler, should be called by an application `matherr' routine
- Xto determine if an error was caused by Tcl code or by other code in the
- Xapplication. If the error occured in Tcl code, flags will be set so that a
- Xstandard Tcl interpreter error can be returned.
- X.PP
- XReturns TRUE if the error was in Tcl code, in which case the matherr routine
- Xcalling this function should return non-zero so no error message will be
- Xgenerated. FALSE if the error was not in Tcl code, in which case the matherr
- Xroutine can handle the error in any manner it choses.
- X.PP
- XThe Extended Tcl library comes with a \fBmatherr\fR routine that calls
- X\fBTcl_MathError\fR. If the error does not belong to Tcl, standard math error
- Xprocessing is done. An application may replace this \fRmatherr\fR with their
- Xown version however, it must call \fBTcl_MathError\fR to check if the error
- Xbelongs to tcl.
- X
- X.SH KEYWORDS
- Xfloating point, math, error
- END_OF_FILE
- if test 5171 -ne `wc -c <'extended/man/MathErr.man'`; then
- echo shar: \"'extended/man/MathErr.man'\" unpacked with wrong size!
- fi
- # end of 'extended/man/MathErr.man'
- fi
- if test -f 'extended/man/tcl.tlib.man' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'extended/man/tcl.tlib.man'\"
- else
- echo shar: Extracting \"'extended/man/tcl.tlib.man'\" \(5845 characters\)
- sed "s/^X//" >'extended/man/tcl.tlib.man' <<'END_OF_FILE'
- X.TH "tcl.tlib" TCL "" "Tcl"
- X.ad b
- X.SH NAME
- XExtended Tcl - Tcl procedure library
- X'
- X.SH "INTRODUCTION"
- X.PP
- XThis manual page contains documentation for all of the procedures in
- Xthe standard Tcl source library, \fItcl.tlib\fR. Commands from the library,
- Xand any Tcl source library along your Tcl search path, \fRTCLPATH\fR,
- Xthat contain properly formatted \fI#@package\fR definition
- Xcomments, are automatically loaded the first time they are executed. See
- Xthe \fITcl Shell\fR documentation for more details.
- X'
- X'@help: tcl.tlib/assign_fields
- X'@brief: Assign successive elements in a list to specified variables.
- X.TP
- X.B assign_fields \fIlist var\fR [\fIvar\fR...]
- X.br
- XAssign successive elements in a list to specified variables.
- XAny leftover fields are discarded. When there are more variable
- Xnames than fields, the remaining variables are set to the
- Xempty string.
- X.sp
- XFor example,
- X.sp
- X.nf
- X assign_fields {dave 100 200 "Dave Foo"} name uid gid longName
- X.fi
- X.sp
- XAssigns \fIname\fR to ``dave'', \fIuid\fR to ``100'', \fIgid\fR to ``200'',
- Xand \fIlongName\fR to ``Dave Foo''.
- X'@endhelp
- X'
- X'@help: tcl.tlib/dirs
- X'@brief: List the directories in the directory stack.
- X.TP
- X.B dirs
- XList the directories in the directory stack.
- X'@endhelp
- X'
- X'@help: tcl.tlib/edprocs
- X'@brief: Edit named procs, or all procs.
- X.TP
- X.B edprocs [\fIproc\fR...]
- X.br
- XWrites the named procedures, or all currently defined procedures, to
- Xa temporary file, then calls an editor on it (as specified by the
- X\fBEDITOR\fR environment variable, or \fBvi\fR
- Xif none is specified), then sources the file back in if it was changed.
- X'@endhelp
- X'
- X'@help: tcl.tlib/for_array_keys
- X'@brief: Do a foreach-style loop on each key in an array.
- X.TP
- X.B for_array_keys \fIvar array_name code\fR
- X.br
- XPerform a foreach-style loop for each key in the named array. The \fBbreak\fR
- Xand \fBcontinue\fR statements work as with \fBforeach\fR.
- X'@endhelp
- X'@help: tcl.tlib/for_file
- X'@brief: Do a foreach-style loop on each line in a file.
- X.TP
- X.B for_file \fIvar filename { code }\fR
- X.br
- XFor each line in \fIfilename\fR, sets
- X\fIvar\fR to the line and executes \fIcode\fR.
- X.sp
- XThe \fBbreak\fR and \fBcontinue\fR commands work as with foreach.
- X.sp
- XFor example, the command
- X.sp
- X.nf
- X \fBfor_file line /etc/passwd {echo $line}\fR
- X.fi
- X.sp
- Xwould echo all the lines in the password file.
- X'@endhelp
- X'@help: tcl.tlib/for_recursive_glob
- X'@brief: Perform a foreach-style loop for all globbed files and directories.
- X.TP
- X.B for_recursive_glob \fIvar globlist code\fR
- X.br
- XPerforms a foreach-style loop for each file and directory that recursively
- Xmatched one or more patterns specified in the call to
- X\fBfor_recursive_glob\fR, setting \fIvar\fR to the matching file or directory,
- Xand calling \fIcode\fR. The \fBbreak\fR and \fBcontinue\fR statements work as
- Xexpected.
- X'@endhelp
- X'@help: tcl.tlib/intersect
- X'@brief: Return a list containing every element present in both lists.
- X.TP
- X.B intersect \fIlista listb\fR
- X.br
- XReturn the logical intersection of two lists.
- X'@endhelp
- X'@help: tcl.tlib/intersect3
- X'@brief: Return three lists from an intersection of two lists.
- X.TP
- X.B intersect3 \fIlista listb\fR
- X.br
- XPerforms the intersecting of the two lists, returning a list containing
- Xthree lists. The first list returned is everything in the first list
- Xthat wasn't in the second. The second list contains the intersection
- Xof the two lists, and the third list contains all the elements that
- Xwere in the second list but weren't in the first.
- X'@endhelp
- X'@help: tcl.tlib/lrmdups
- X'@brief: Given a list, remove all of the duplicated elements.
- X.TP
- X.B lrmdups \fIlist\fR
- X.br
- XRemove duplicate elements from a list.
- XSorts the specified list, removes any duplicate elements, and returns
- Xthe result.
- X'@endhelp
- X'@help: tcl.tlib/popd
- X'@brief: Pop a directory from a stack of directories and cd to it.
- X.TP
- X.B popd
- X.br
- XPop the top directory entry from the directory stack and make it the current
- Xdirectory.
- X'@endhelp
- X'@help: tcl.tlib/pushd
- X'@brief: Push a directory to a stack of directories.
- X.TP
- X.B pushd [\fIdir\fR]
- X.br
- XPush the current directory onto the directory stack and \fBcd\fR to the specified
- Xdirectory. If the directory is not specified, then the current directory is
- Xpushed, but remains unchanged.
- X'@endhelp
- X'@help: tcl.tlib/read_file
- X'@brief: Read in a file to a string (less overhead than "exec cat").
- X.TP
- X.B read_file \fIfileName\fR
- X.br
- XRead the named file and returns the contents as a string.
- X'@endhelp
- X'@help: tcl.tlib/recursive_glob
- X'@brief: Do filename globbing, recursively descending all matched directories.
- X.TP
- X.B recursive_glob \fIgloblist\fR
- X.br
- XDoes the same thing as glob, except that it recursively descends all the
- Xmatched subdirectories, returning a list of all the files that matched all
- Xpattern in the list \fIgloblist\fR.
- X'@endhelp
- X'@help: tcl.tlib/saveprocs
- X'@brief: Save named procs to a file, or all procs.
- X.TP
- X.B saveprocs \fIfileName\fR [\fIproc\fR...]
- X.br
- XSave the definition of the named procedure, or all currently
- Xdefined procedures if none is specified, to the named file.
- X'@endhelp
- X'@help: tcl.tlib/showproc
- X'@brief: List the definition of the named procedure.
- X.TP
- X.B showproc \fIprocname\fR
- X.br
- XList the definition of the named procedure, loading it if it is not already
- Xloaded.
- X'@endhelp
- X'@help: tcl.tlib/showprocs
- X'@brief: List the definition of the named, or all, procedures.
- X.TP
- X.B showprocs [\fIprocname\fR...]
- X.br
- XList the definition of all of the named procedures, or
- Xall defined procedures if none are specified.
- X'@endhelp
- X'@help: tcl.tlib/union
- X'@brief: Return the logical union of two lists.
- X.TP
- X.B union \fIlista listb\fR
- XReturn the logical union of the two specified lists. Any duplicate elements
- Xare removed.
- X'@endhelp
- X'@help: tcl.tlib/write_file
- X'@brief: Write a string out as a file.
- X.TP
- X.B write_file \fIfileName stringVar\fR
- X.br
- XWrites the specified string to the named file.
- X'@endhelp
- END_OF_FILE
- if test 5845 -ne `wc -c <'extended/man/tcl.tlib.man'`; then
- echo shar: \"'extended/man/tcl.tlib.man'\" unpacked with wrong size!
- fi
- # end of 'extended/man/tcl.tlib.man'
- fi
- if test -f 'extended/tcllib/help/commands/string' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'extended/tcllib/help/commands/string'\"
- else
- echo shar: Extracting \"'extended/tcllib/help/commands/string'\" \(5464 characters\)
- sed "s/^X//" >'extended/tcllib/help/commands/string' <<'END_OF_FILE'
- X string option arg ?arg ...?
- X Perform one of several string operations, depending on
- X option. The legal options (which may be abbreviated)
- X are:
- X
- X string compare string1 string2
- X Perform a character-by-character comparison of
- X strings string1 and string2 in the same way as the
- X C strcmp procedure. Return -1, 0, or 1, depending
- X on whether string1 is lexicographically less than,
- X equal to, or greater than string2.
- X
- X string first string1 string2
- X Search string2 for a sequence of characters that
- X exactly match the characters in string1. If
- X found, return the index of the first character in
- X the first such match within string2. If not
- X found, return -1.
- X
- X string index string charIndex
- X Returns the charIndex'th character of the string
- X argument. A charIndex of 0 corresponds to the
- X first character of the string. If charIndex is
- X less than 0 or greater than or equal to the length
- X of the string then an empty string is returned.
- X
- X string last string1 string2
- X Search string2 for a sequence of characters that
- X exactly match the characters in string1. If
- X found, return the index of the first character in
- X the last such match within string2. If there is
- X no match, then return -1.
- X
- X string length string
- X Returns a decimal string giving the number of
- X characters in string.
- X
- X string match pattern string
- X See if pattern matches string; return 1 if it
- X does, 0 if it doesn't. Matching is done in a
- X fashion similar to that used by the C-shell. For
- X the two strings to match, their contents must be
- X identical except that the following special
- X sequences may appear in pattern:
- X
- X * Matches any sequence of characters in
- X string, including a null string.
- X
- X ? Matches any single character in string.
- X
- X [chars] Matches any character in the set given
- X by chars. If a sequence of the form x-y
- X appears in chars, then any character
- X between x and y, inclusive, will match.
- X
- X \x Matches the single character x. This
- X provides a way of avoiding the special
- X interpretation of the characters *?[]\
- X in pattern.
- X
- X string range string first last
- X Returns a range of consecutive characters from
- X string, starting with the character whose index is
- X first and ending with the character whose index is
- X last. An index of 0 refers to the first character
- X of the string. Last may be end (or any
- X abbreviation of it) to refer to the last character
- X of the string. If first is less than zero then it
- X is treated as if it were zero, and if last is
- X greater than or equal to the length of the string
- X then it is treated as if it were end. If first is
- X greater than last then an empty string is
- X returned.
- X
- X string tolower string
- X Returns a value equal to string except that all
- X upper case letters have been converted to lower
- X case.
- X
- X string toupper string
- X Returns a value equal to string except that all
- X lower case letters have been converted to upper
- X case.
- X
- X string trim string ?chars?
- X Returns a value equal to string except that any
- X leading or trailing characters from the set given
- X by chars are removed. If chars is not specified
- X then white space is removed (spaces, tabs,
- X newlines, and carriage returns).
- X
- X string trimleft string ?chars?
- X Returns a value equal to string except that any
- X leading characters from the set given by chars are
- X removed. If chars is not specified then white
- X space is removed (spaces, tabs, newlines, and
- X carriage returns).
- X
- X string trimright string ?chars?
- X Returns a value equal to string except that any
- X trailing characters from the set given by chars
- X are removed. If chars is not specified then white
- X space is removed (spaces, tabs, newlines, and
- X carriage returns).
- END_OF_FILE
- if test 5464 -ne `wc -c <'extended/tcllib/help/commands/string'`; then
- echo shar: \"'extended/tcllib/help/commands/string'\" unpacked with wrong size!
- fi
- # end of 'extended/tcllib/help/commands/string'
- fi
- if test -f 'extended/tests/filescan.test' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'extended/tests/filescan.test'\"
- else
- echo shar: Extracting \"'extended/tests/filescan.test'\" \(5376 characters\)
- sed "s/^X//" >'extended/tests/filescan.test' <<'END_OF_FILE'
- X#
- X# filescan.test
- X#
- X# Tests for the scancontext and scanfile 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
- Xglobal ModuleName
- Xset ModuleName "File scan"
- Xsource testutil.tcl
- X
- X# Proc to generate record that can be validated. The record has
- X# grows quite large to test the dynamic buffering in the file I/O.
- X
- Xproc GenRec {Key LineNum} {
- X set extra [replicate :@@@@@@@@: $LineNum]
- X return "$Key This is a test record ($extra) index is $Key"
- X}
- X
- X# Build a test file and a list of records to scan for. Each element in the
- X# list will have the following info:
- X# {Key FileOffset FileLineNumber MatchType}
- X
- X# Proc to validate a matched record.
- X
- Xproc ValMatch {ScanInfo ErrId} {
- X global TestFH matchInfo
- X set chkRec [GenRec [lindex $ScanInfo 0] [lindex $ScanInfo 2]]
- X check $matchInfo(line) $chkRec $ErrId.1
- X check $matchInfo(offset) [lindex $ScanInfo 1] $ErrId.2
- X check $matchInfo(linenum) [lindex $ScanInfo 2] $ErrId.3
- X check $matchInfo(handle) $TestFH $ErrId.4
- X set MatchType [lindex $ScanInfo 3]
- X global MatchCnt.$MatchType
- X incr MatchCnt.$MatchType
- X}
- X
- Xglobal matchInfo
- Xglobal MatchCnt.0 MatchCnt.1 MatchCnt.2 MatchCnt.3 DefaultCnt
- Xglobal ChkMatchCnt.0 ChkMatchCnt.1 ChkMatchCnt.2 ChkMatchCnt.3 ChkDefaultCnt
- Xglobal TestFH
- X
- Xset MatchCnt.0 0
- Xset MatchCnt.1 0
- Xset MatchCnt.2 0
- Xset MatchCnt.3 0
- Xset DefaultCnt 0
- Xset ChkMatchCnt.0 0
- Xset ChkMatchCnt.1 0
- Xset ChkMatchCnt.2 0
- Xset ChkMatchCnt.3 0
- Xset ChkDefaultCnt 0
- Xset ScanList {}
- Xset MaxRec 200
- X
- Xcatch {unlink TEST.TMP}
- Xset TestFH [open TEST.TMP w]
- X
- Xset Key FatHeadAAAA
- Xfor {set cnt 0} {$cnt < $MaxRec} {incr cnt} {
- X if {($cnt % 10) == 0} {
- X set MatchType [random 4]
- X incr ChkMatchCnt.$MatchType
- X set ScanInfo [list "$Key [tell $TestFH] [expr $cnt+1] $MatchType"]
- X if {[random 2]} {
- X set ScanList [concat $ScanList $ScanInfo]
- X } else {
- X set ScanList [concat $ScanInfo $ScanList]}
- X } else {
- X incr ChkDefaultCnt}
- X if {$cnt == [expr $MaxRec/2]} {
- X set MidKey $Key
- X }
- X puts $TestFH [GenRec $Key [expr $cnt+1]]
- X set Key [IncrName $Key 1] ;# Upper case only
- X}
- X
- Xclose $TestFH
- X
- X# Build up the scan context.
- X
- Xset TestCH [scancontext create]
- X
- Xforeach ScanInfo $ScanList {
- X set Key [lindex $ScanInfo 0]
- X set matchType [lindex $ScanInfo 3]
- X set Cmd "global matchInfo; ValMatch \{$ScanInfo\} 1.0"
- X case $matchType in {
- X {0} {scanmatch -nocase $TestCH [string toupper $Key] $Cmd}
- X {1} {scanmatch $TestCH ^$Key $Cmd}
- X {2} {scanmatch $TestCH $Key\$ $Cmd}
- X {3} {scanmatch $TestCH $Key $Cmd}
- X }
- X}
- X
- Xscanmatch $TestCH {
- X global DefaultCnt TestFH matchInfo
- X
- X incr DefaultCnt
- X check $matchInfo(handle) $TestFH 1.1
- X }
- X
- Xset TestFH [open TEST.TMP r]
- Xscanfile $TestCH $TestFH
- X
- Xcheck ${MatchCnt.0} ${ChkMatchCnt.0} 1.2
- Xcheck ${MatchCnt.1} ${ChkMatchCnt.1} 1.3
- Xcheck ${MatchCnt.2} ${ChkMatchCnt.2} 1.4
- Xcheck ${MatchCnt.3} ${ChkMatchCnt.3} 1.5
- Xcheck $DefaultCnt $ChkDefaultCnt 1.6
- X
- Xscancontext delete $TestCH
- X
- X# Test return and continue from within match commands
- X
- Xset TestCH [scancontext create]
- Xseek $TestFH 0
- Xglobal MatchCnt
- Xset MatchCnt 0
- X
- Xscanmatch $TestCH $MidKey {
- X global MatchCnt
- X incr MatchCnt
- X continue;
- X}
- X
- Xscanmatch $TestCH ^$MidKey {
- X error "$ModuleName error: This should not ever get executed 2.0"
- X}
- X
- Xscanmatch $TestCH [IncrName $MidKey] {
- X return FudPucker
- X}
- X
- Xset ScanRet [scanfile $TestCH $TestFH]
- Xcheck $ScanRet FudPucker 2.1
- Xscancontext delete $TestCH
- X
- X
- X# Test argument checking and error handling.
- X
- Xdo1cmd {scancontext foomuch} msg 3.1
- Xset expect {invalid argument, expected one of: create or delete}
- Xcheck $msg $expect 3.2
- Xdo1cmd {scanmatch $TestCH} msg 3.4
- Xset expect {wrong # args: scanmatch [-nocase] contexthandle [regexp] command}
- Xcheck $msg $expect 3.5
- Xdo1cmd {scanmatch} msg 3.6
- Xcheck $msg $expect 3.7
- Xdo1cmd {scanfile} msg 3.8
- Xcheck $msg \
- X {wrong # args: scanfile contexthandle filehandle} 3.9
- Xset TestCH [scancontext create]
- Xdo1cmd {scanfile $TestCH $TestFH} msg 3.10
- Xcheck $msg {no patterns in current scan context} 3.11
- Xscancontext delete $TestCH
- X
- Xclose $TestFH
- Xunlink TEST.TMP
- X
- Xrename GenRec {}
- Xrename ValMatch {}
- X
- Xunset MatchCnt matchInfo
- Xunset MatchCnt.0 MatchCnt.1 MatchCnt.2 MatchCnt.3 DefaultCnt
- Xunset ChkMatchCnt.0 ChkMatchCnt.1 ChkMatchCnt.2 ChkMatchCnt.3 ChkDefaultCnt
- Xunset TestFH
- END_OF_FILE
- if test 5376 -ne `wc -c <'extended/tests/filescan.test'`; then
- echo shar: \"'extended/tests/filescan.test'\" unpacked with wrong size!
- fi
- # end of 'extended/tests/filescan.test'
- fi
- if test -f 'extended/tests/fmath.test' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'extended/tests/fmath.test'\"
- else
- echo shar: Extracting \"'extended/tests/fmath.test'\" \(5838 characters\)
- sed "s/^X//" >'extended/tests/fmath.test' <<'END_OF_FILE'
- X#
- X# fmath.test
- X#
- X# Tests for the following floating point math commands:
- X# acos, asin, atan, cos, sin, tan, cosh, sinh, tanh,
- X# exp, log, log10, sqrt, fabs, floor, ceil, fmod, pow.
- 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
- Xglobal ModuleName
- Xset ModuleName FMath
- X
- Xset F_E 2.71828
- Xset F_LN10 2.30258
- Xset F_PI 3.14159265358979
- Xset F_PI_180 0.0174533
- Xset F_PI_4 0.785398
- Xset F_PI_2 1.5708
- Xset F_SQRT2 1.41421
- X
- X
- Xsource testutil.tcl
- X
- X
- X# Check that a floating point value is reasonably within range. If not,
- X# generate an error
- X
- Xproc fchecknum {got expect idnum} {
- X global ModuleName
- X
- X set lowExpect [expr {$expect * 0.9999}]
- X set hiExpect [expr {$expect * 1.0001}]
- X
- X if {($got < $lowExpect) || ($got > $hiExpect)} {
- X error [format {%s test error %s: wanted something close to %s, got %s} \
- X $ModuleName $idnum $expect $got]}
- X}
- X
- Xdo1cmd {acos} msg 1.1
- Xcheck $msg {wrong # args: acos val} 1.2
- Xdo1cmd {acos 1 1} msg 1.3
- Xcheck $msg {wrong # args: acos val} 1.4
- Xfchecknum [acos 0] 1.5708 1.5
- Xfchecknum [acos $F_PI_180] 1.55334 1.6
- Xfchecknum [acos $F_PI_4] 0.667457 1.7
- X
- Xdo1cmd {asin} msg 2.1
- Xcheck $msg {wrong # args: asin val} 2.2
- Xdo1cmd {asin 1 1} msg 2.3
- Xcheck $msg {wrong # args: asin val} 2.4
- X
- Xdo1cmd {atan} msg 3.1
- Xcheck $msg {wrong # args: atan val} 3.2
- Xdo1cmd {atan 1 1} msg 3.3
- Xcheck $msg {wrong # args: atan val} 3.4
- X
- Xdo1cmd {cos} msg 4.1
- Xcheck $msg {wrong # args: cos val} 4.2
- Xdo1cmd {cos 1 1} msg 4.3
- Xcheck $msg {wrong # args: cos val} 4.4
- X
- Xdo1cmd {sin} msg 5.1
- Xcheck $msg {wrong # args: sin val} 5.2
- Xdo1cmd {sin 1 1} msg 5.3
- Xcheck $msg {wrong # args: sin val} 5.4
- X
- Xdo1cmd {tan} msg 6.1
- Xcheck $msg {wrong # args: tan val} 6.2
- Xdo1cmd {tan 1 1} msg 6.3
- Xcheck $msg {wrong # args: tan val} 6.4
- X
- Xdo1cmd {cosh} msg 7.1
- Xcheck $msg {wrong # args: cosh val} 7.2
- Xdo1cmd {cosh 1 1} msg 7.3
- Xcheck $msg {wrong # args: cosh val} 7.4
- X
- Xdo1cmd {sinh} msg 8.1
- Xcheck $msg {wrong # args: sinh val} 8.2
- Xdo1cmd {sinh 1 1} msg 8.3
- Xcheck $msg {wrong # args: sinh val} 8.4
- X
- Xdo1cmd {tanh} msg 9.1
- Xcheck $msg {wrong # args: tanh val} 9.2
- Xdo1cmd {tanh 1 1} msg 9.3
- Xcheck $msg {wrong # args: tanh val} 9.4
- X
- Xdo1cmd {exp} msg 10.1
- Xcheck $msg {wrong # args: exp val} 10.2
- Xdo1cmd {exp 1 1} msg 10.3
- Xcheck $msg {wrong # args: exp val} 10.4
- X
- Xdo1cmd {log} msg 11.1
- Xcheck $msg {wrong # args: log val} 11.2
- Xdo1cmd {log 1 1} msg 11.3
- Xcheck $msg {wrong # args: log val} 11.4
- X
- Xdo1cmd {log10} msg 12.1
- Xcheck $msg {wrong # args: log10 val} 12.2
- Xdo1cmd {log10 1 1} msg 12.3
- Xcheck $msg {wrong # args: log10 val} 12.4
- X
- Xdo1cmd {sqrt} msg 13.1
- Xcheck $msg {wrong # args: sqrt val} 13.2
- Xdo1cmd {sqrt 1 1} msg 13.3
- Xcheck $msg {wrong # args: sqrt val} 13.4
- X
- Xdo1cmd {fabs} msg 14.1
- Xcheck $msg {wrong # args: fabs val} 14.2
- Xdo1cmd {fabs 1 1} msg 14.3
- Xcheck $msg {wrong # args: fabs val} 14.4
- X
- Xdo1cmd {floor} msg 15.1
- Xcheck $msg {wrong # args: floor val} 15.2
- Xdo1cmd {floor 1 1} msg 15.3
- Xcheck $msg {wrong # args: floor val} 15.4
- X
- Xdo1cmd {ceil} msg 16.1
- Xcheck $msg {wrong # args: ceil val} 16.2
- Xdo1cmd {ceil 1 1} msg 16.3
- Xcheck $msg {wrong # args: ceil val} 16.4
- X
- Xdo1cmd {fmod} msg 17.1
- Xcheck $msg {wrong # args: fmod val divisor} 17.2
- Xdo1cmd {fmod 1 1 1} msg 17.3
- Xcheck $msg {wrong # args: fmod val divisor} 17.4
- X
- Xdo1cmd {pow} msg 18.1
- Xcheck $msg {wrong # args: pow val exp} 18.2
- Xdo1cmd {pow 1 1 1} msg 18.3
- Xcheck $msg {wrong # args: pow val exp} 18.4
- X
- Xdo1cmd {pow 0 0} msg 18.5
- Xcheck $msg {pow: floating point domain error} 18.6
- X
- END_OF_FILE
- if test 5838 -ne `wc -c <'extended/tests/fmath.test'`; then
- echo shar: \"'extended/tests/fmath.test'\" unpacked with wrong size!
- fi
- # end of 'extended/tests/fmath.test'
- fi
- if test -f 'extended/tests/help.test' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'extended/tests/help.test'\"
- else
- echo shar: Extracting \"'extended/tests/help.test'\" \(6040 characters\)
- sed "s/^X//" >'extended/tests/help.test' <<'END_OF_FILE'
- X#
- X# help.test
- X#
- X# Tests for the help subsystem. Help must be build first. If help files
- X# change, thest tests may have to be changed.
- 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#
- Xif {[info procs test] != "test"} then {source defs}
- X
- X#
- X# Only run help test if help has been installed.
- X#
- Xif {"[glob -nocomplain ../tcllib/help/*]" == ""} {
- X echo "****"
- X echo "**** No help files in tcllib/help - help not available test not run"
- X echo "****"
- X return
- X}
- X
- X#------------------------------------------------------------------------------
- X# Read a line from the server, set an alarm to make sure it doesn't hang.
- Xproc ReadServer {} {
- X global G_helpOutPipeFH
- X
- X alarm 45
- X if {[gets $G_helpOutPipeFH line] < 0} {
- X alarm 0
- X error "EOF from help server"}
- X alarm 0
- X return $line
- X}
- X
- X#------------------------------------------------------------------------------
- X# Eat a prompt line from the help server.
- X
- Xproc EatServerPrompt {} {
- X set line [ReadServer]
- X if {"$line" != "===HELPSERVER==="} {
- X error "unexpected output from help server: `$line'"}
- X}
- X
- X#------------------------------------------------------------------------------
- X# Send a command to the help server and return the output. The help server
- X# output will be bracketed with commands to mark the beginning and ending.
- X# An extra newline is always queued to continue the help pager. The prompt of
- X# the pager will be removed from the output. This assumes that the output has
- X# no lines starting with `:'.
- X#
- Xproc HelpSend {cmd pagerCntVar} {
- X global G_helpInPipeFH G_helpOutPipeFH
- X upvar $pagerCntVar pagerCnt
- X
- X puts $G_helpInPipeFH $cmd
- X puts $G_helpInPipeFH "" ;# Just a new line..
- X flush $G_helpInPipeFH
- X
- X set pagerCnt 0
- X set results {}
- X
- X # Read lines of the output.
- X while 1 {
- X set line [ReadServer]
- X if {"[cindex $line 0]" == ":"} {
- X set line [crange $line 1 end]
- X incr pagerCnt
- X puts $G_helpInPipeFH "" ;# Just a new line
- X }
- X if {"$line" == "===HELPSERVER==="} {
- X break}
- X append results $line "\n"
- X }
- X # Eat the extra prompt caused by the typed-ahead newline
- X EatServerPrompt
- X
- X return $results
- X}
- X#
- X# Create the help server process, which will execute the commands,
- X# with stdin and stdout redirected to pipes.
- X#
- X
- Xglobal G_helpInPipeFH G_helpOutPipeFH G_helpPid
- X
- Xpipe fromClientPipeFH G_helpInPipeFH
- Xpipe G_helpOutPipeFH toClientPipeFH
- X
- Xfcntl $G_helpInPipeFH NOBUF 1
- Xfcntl $G_helpOutPipeFH NOBUF 1
- X
- Xflush stdout ;# Not going to exec, must clean up the buffers.
- Xflush stderr
- Xset G_helpPid [fork]
- X
- Xif {$G_helpPid == 0} {
- X # Set up stdin/stdout. Cann't use them nobuf, since we havn't execvp-ed.
- X close stdin
- X dup $fromClientPipeFH stdin
- X close stdout
- X dup $toClientPipeFH stdout
- X close $G_helpInPipeFH
- X close $G_helpOutPipeFH
- X
- X rename SAVED_UNKNOWN unknown
- X
- X commandloop {puts stdout "===HELPSERVER==="; flush stdout} \
- X {error "Help server incomplete cmd"}
- X error "Help server got eof"
- X}
- X
- Xclose $fromClientPipeFH
- Xclose $toClientPipeFH
- X
- X#
- X# An alarm will be set when talking to the server uncase it doesn't talk back
- X#
- Xsignal error SIGALRM
- X
- X# Nuke the first prompt
- XEatServerPrompt
- X
- X# Now run the tests.
- X
- X
- Xtest help-1.1 {help tests} {
- X HelpSend "help" promptCnt
- X} {
- XSubjects available in /:
- X commands/ extended/ intro/ misc/
- X tcl.tlib/ tclshell/
- X
- XHelp files available in /:
- X brief help
- X}
- X
- Xtest help-1.2 {help tests} {
- X HelpSend "helppwd" promptCnt
- X} {Current help subject directory: /
- X}
- X
- Xtest help-1.3 {help tests} {
- X HelpSend "helpcd intro" promptCnt
- X} {}
- X
- Xtest help-1.4 {help tests} {
- X HelpSend "helppwd" promptCnt
- X} {Current help subject directory: /intro
- X}
- X
- Xtest help-1.5 {help tests} {
- X set result [HelpSend "help comments" promptCnt]
- X set fh [open "../tcllib/help/intro/comments"]
- X set expect [read $fh]
- X close $fh
- X set summary {}
- X if {"$expect" == "$result"} {
- X append summary "CORRECT"
- X } else {
- X append summary "DATA DOES NOT MATCH"
- X }
- X if {$promptCnt == 0} {
- X append summary " : PROMPT OK"
- X } else {
- X append summary " : TOO MANY PROMPTS"
- X }
- X set summary
- X} {CORRECT : PROMPT OK}
- X
- Xtest help-1.6 {help tests} {
- X set result [HelpSend "help expressions" promptCnt]
- X set fh [open "../tcllib/help/intro/expressions"]
- X set expect [read $fh]
- X close $fh
- X set summary {}
- X if {"$expect" == "$result"} {
- X append summary "CORRECT"
- X } else {
- X append summary "DATA DOES NOT MATCH"
- X }
- X if {$promptCnt >= 2} {
- X append summary " : PROMPT OK"
- X } else {
- X append summary " : NOT ENOUGH PROMPTS"
- X }
- X set summary
- X} {CORRECT : PROMPT OK}
- X
- Xtest help-1.7 {help tests} {
- X HelpSend "apropos upvar" promptCnt
- X} {commands/upvar - Bind a variable to another variable up the procedure call stack.
- X}
- X
- Xtest help-1.8 {help tests} {
- X HelpSend "apropos clock" promptCnt
- X} {extended/alarm - Set a process alarm clock.
- Xextended/fmtclock - Convert integer time to human-readable format.
- Xextended/getclock - Return current date and time as an integer value.
- X}
- X
- Xtest help-1.9 {help tests} {
- X HelpSend "helpcd" promptCnt
- X} {}
- X
- Xtest help-1.10 {help tests} {
- X HelpSend "helppwd" promptCnt
- X} {Current help subject directory: /
- X}
- X
- X
- X# Terminate the help server.
- X
- Xputs $G_helpInPipeFH "exit 0"
- Xset status [wait $G_helpPid]
- Xif {"$status" != "$G_helpPid EXIT 0"} {
- X error "Bad status returned: `$status'"}
- X
- Xreturn
- END_OF_FILE
- if test 6040 -ne `wc -c <'extended/tests/help.test'`; then
- echo shar: \"'extended/tests/help.test'\" unpacked with wrong size!
- fi
- # end of 'extended/tests/help.test'
- fi
- if test -f 'extended/tests/keylist.test' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'extended/tests/keylist.test'\"
- else
- echo shar: Extracting \"'extended/tests/keylist.test'\" \(5066 characters\)
- sed "s/^X//" >'extended/tests/keylist.test' <<'END_OF_FILE'
- X#
- X# keylist.test
- X#
- X# Tests for the keylget, keylset, and keyldel 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#
- Xif {[info procs test] != "test"} then {source defs}
- X
- Xtest keylist-1.1 {keylget tests} {
- X set keyedlist {{keyA valueA} {keyB valueB} {keyD valueD}}
- X keylget keyedlist keyA
- X} {valueA}
- X
- Xtest keylist-1.2 {keylget tests} {
- X set keyedlist {{keyA valueA} {keyB valueB} {keyD valueD}}
- X list [keylget keyedlist keyA value] $value
- X} {1 valueA}
- X
- Xtest keylist-1.3 {keylget tests} {
- X set keyedlist {{keyA valueA} {keyB {{keyB1 valueB1} {keyB2 valueB2}}}
- X {keyD valueD}}
- X keylget keyedlist keyD
- X} {valueD}
- X
- Xtest keylist-1.4 {keylget tests} {
- X set keyedlist {{keyA valueA} {keyB {{keyB1 valueB1} {keyB2 valueB2}}}
- X {keyD valueD}}
- X list [keylget keyedlist keyD value] $value
- X} {1 valueD}
- X
- Xtest keylist-1.5 {keylget tests} {
- X set keyedlist {{keyA valueA} {keyB {{keyB1 valueB1} {keyB2 valueB2}}}
- X {keyD valueD}}
- X list [catch {keylget keyedlist keyC} msg] $msg
- X} {1 {key "keyC" not found in keyed list}}
- X
- Xtest keylist-1.6 {keylget tests} {
- X set keyedlist {{keyA valueA} {keyB {{keyB1 valueB1} {keyB2 valueB2}}}
- X {keyD valueD}}
- X keylget keyedlist keyC value
- X} {0}
- X
- Xtest keylist-1.61 {keylget tests} {
- X set keyedlist {{keyA valueA} {keyB {{keyB1 valueB1} {keyB2 valueB2}}}
- X {keyD valueD}}
- X keylget keyedlist keyB
- X} {{keyB1 valueB1} {keyB2 valueB2}}
- X
- Xtest keylist-1.7 {keylget tests} {
- X set keyedlist {{} {keyB valueB} {keyD valueD}}
- X list [catch {keylget keyedlist keyB} msg] $msg
- X} {1 {invalid keyed list format: list contains an empty field entry}}
- X
- Xtest keylist-1.8 {keylget tests} {
- X set keyedlist {keyA {keyB valueB} {keyD valueD}}
- X list [catch {keylget keyedlist keyB} msg] $msg
- X} {1 {invalid keyed list format: no value associated with field "keyA"}}
- X
- Xtest keylist-1.9 {keylget tests} {
- X set keyedlist {{{} valueA} {keyB valueB} {keyD valueD}}
- X list [catch {keylget keyedlist keyB} msg] $msg
- X} {1 {invalid keyed list format: list contains an empty field name}}
- X
- Xtest keylist-1.10 {keylget tests} {
- X list [catch {keylget} msg] $msg
- X} {1 {wrong # args: keylget listvar key [retvar | {}]}}
- X
- X
- X
- Xtest keylist-2.1 {keylset tests} {
- X catch {unset keyedlist}
- X keylset keyedlist keyA valueA
- X set keyedlist
- X} {{keyA valueA}}
- X
- Xtest keylist-2.2 {keylset tests} {
- X catch {unset keyedlist}
- X keylset keyedlist keyA valueA
- X keylset keyedlist keyB valueB
- X set keyedlist
- X} {{keyA valueA} {keyB valueB}}
- X
- Xtest keylist-2.3 {keylset tests} {
- X catch {unset keyedlist}
- X keylset keyedlist keyA valueA
- X keylset keyedlist keyB valueB
- X keylset keyedlist keyB valueB2
- X set keyedlist
- X} {{keyA valueA} {keyB valueB2}}
- X
- Xtest keylist-2.4 {keylset tests} {
- X catch {unset keyedlist}
- X keylset keyedlist keyA valueA
- X keylset keyedlist keyB valueB
- X keylset keyedlist keyA valueA2
- X keylset keyedlist keyB valueB2
- X keylset keyedlist keyC valueC
- X set keyedlist
- X} {{keyA valueA2} {keyB valueB2} {keyC valueC}}
- X
- Xtest keylist-2.5 {keylset tests} {
- X catch {unset keyedlist}
- X list [catch {keylset keyedlist keyA} msg] $msg
- X} {1 {wrong # args: keylset listvar key value}}
- X
- Xtest keylist-2.6 {keylset tests} {
- X catch {unset keyedlist}
- X set keyedlist(foo) 1
- X list [catch {keylset keyedlist keyA valueA} msg] $msg
- X} {1 {can't set "keyedlist": variable is array}}
- X
- Xtest keylist-2.7 {keylset tests} {
- X catch {unset keyedlist}
- X set keyedlist {{keyA valueA valueBad} {keyB valueB}}
- X list [catch {keylset keyedlist keyA valueA} msg] $msg
- X} {1 {invalid keyed list format: trailing data following value in field: "valueA valueBad"}}
- X
- Xtest keylist-3.1 {keyldel tests} {
- X set keyedlist {{keyA valueA} {keyB valueB} {keyD valueD}}
- X keyldel keyedlist keyB
- X set keyedlist
- X} {{keyA valueA} {keyD valueD}}
- X
- Xtest keylist-3.2 {keyldel tests} {
- X set keyedlist {{keyA valueA} {keyB valueB} {keyD valueD}}
- X keyldel keyedlist keyB
- X keyldel keyedlist keyA
- X set keyedlist
- X} {{keyD valueD}}
- X
- Xtest keylist-3.3 {keyldel tests} {
- X set keyedlist {{keyA valueA} {keyB valueB} {keyD valueD}}
- X keyldel keyedlist keyD
- X keyldel keyedlist keyB
- X keyldel keyedlist keyA
- X set keyedlist
- X} {}
- X
- Xtest keylist-3.4 {keyldel tests} {
- X set keyedlist {{keyA valueA} {keyB valueB} {keyD valueD}}
- X list [catch {keyldel keyedlist keyC} msg] $msg
- X} {1 {field name not found: "keyC"}}
- X
- Xtest keylist-3.5 {keyldel tests} {
- X list [catch {keyldel keyedlist} msg] $msg
- X} {1 {wrong # args: keyldel listvar key}}
- X
- END_OF_FILE
- if test 5066 -ne `wc -c <'extended/tests/keylist.test'`; then
- echo shar: \"'extended/tests/keylist.test'\" unpacked with wrong size!
- fi
- # end of 'extended/tests/keylist.test'
- fi
- echo shar: End of archive 9 \(of 23\).
- cp /dev/null ark9isdone
- 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.
-