home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-11-14 | 51.8 KB | 1,883 lines |
- Newsgroups: comp.sources.misc
- From: karl@sugar.neosoft.com (Karl Lehenbauer)
- Subject: v25i072: tcl - tool command language, version 6.1, Part04/33
- Message-ID: <1991Nov14.202646.23389@sparky.imd.sterling.com>
- X-Md4-Signature: c385d257411e7c39d39d239dece773d7
- Date: Thu, 14 Nov 1991 20:26:46 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: karl@sugar.neosoft.com (Karl Lehenbauer)
- Posting-number: Volume 25, Issue 72
- Archive-name: tcl/part04
- 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 4 (of 33)."
- # Contents: tcl6.1/doc/Backslash.man tcl6.1/doc/Concat.man
- # tcl6.1/doc/CrtInterp.man tcl6.1/doc/History.man
- # tcl6.1/doc/TildeSubst.man tcl6.1/tclAssem.c tcl6.1/tests/exec.test
- # tcl6.1/tests/upvar.test
- # Wrapped by karl@one on Tue Nov 12 19:44:13 1991
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'tcl6.1/doc/Backslash.man' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'tcl6.1/doc/Backslash.man'\"
- else
- echo shar: Extracting \"'tcl6.1/doc/Backslash.man'\" \(5407 characters\)
- sed "s/^X//" >'tcl6.1/doc/Backslash.man' <<'END_OF_FILE'
- X'\" Copyright 1989 Regents of the University of California
- X'\" Permission to use, copy, modify, and distribute this
- X'\" documentation for any purpose and without fee is hereby
- X'\" granted, provided that this notice appears in all copies.
- X'\" The University of California makes no representations about
- X'\" the suitability of this material for any purpose. It is
- X'\" provided "as is" without express or implied warranty.
- X'\"
- X'\" $Header: /user6/ouster/tcl/doc/RCS/Backslash.man,v 1.6 91/05/23 14:11:06 ouster Exp $ SPRITE (Berkeley)
- 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.HS Tcl_Backslash tcl
- X.BS
- X.SH NAME
- XTcl_Backslash \- parse a backslash sequence
- X.SH SYNOPSIS
- X.nf
- X\fB#include <tcl.h>\fR
- X.sp
- Xchar
- X\fBTcl_Backslash\fR(\fIsrc, countPtr\fR)
- X.SH ARGUMENTS
- X.AP char *src in
- XPointer to a string starting with a backslash.
- X.AP int *countPtr out
- XIf \fIcountPtr\fR isn't NULL, \fI*countPtr\fR gets filled
- Xin with number of characters in the backslash sequence, including
- Xthe backslash character.
- X.BE
- X
- X.SH DESCRIPTION
- X.PP
- XThis is a utility procedure used by several of the Tcl
- Xcommands. It parses a backslash sequence and returns
- Xthe single character corresponding to the sequence.
- X.VS
- XIf the backslash sequence should be replaced by no character
- Xat all (e.g. backslash-newline) then \fBTcl_Backslash\fR returns 0.
- X.VE
- X\fBTcl_Backslash\fR modifies \fI*countPtr\fR to contain the number
- Xof characters in the backslash sequence.
- XIf \fIsrc\fR doesn't point to a backslash
- Xsequence understood by Tcl, then Tcl_Backslash returns a backslash
- Xas its result and \fI*countPtr\fR gets set to 1 (in this case the
- Xbackslash character should not get any special treatment).
- X.PP
- XSee the Tcl manual entry for information on the valid
- Xbackslash sequences.
- X.VS
- XAll of the sequences described in the Tcl
- Xmanual entry are supported by \fBTcl_Backslash\fR.
- X.VE
- X
- X.SH KEYWORDS
- Xbackslash, parse
- END_OF_FILE
- if test 5407 -ne `wc -c <'tcl6.1/doc/Backslash.man'`; then
- echo shar: \"'tcl6.1/doc/Backslash.man'\" unpacked with wrong size!
- fi
- # end of 'tcl6.1/doc/Backslash.man'
- fi
- if test -f 'tcl6.1/doc/Concat.man' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'tcl6.1/doc/Concat.man'\"
- else
- echo shar: Extracting \"'tcl6.1/doc/Concat.man'\" \(5457 characters\)
- sed "s/^X//" >'tcl6.1/doc/Concat.man' <<'END_OF_FILE'
- X'\" Copyright 1989 Regents of the University of California
- X'\" Permission to use, copy, modify, and distribute this
- X'\" documentation for any purpose and without fee is hereby
- X'\" granted, provided that this notice appears in all copies.
- X'\" The University of California makes no representations about
- X'\" the suitability of this material for any purpose. It is
- X'\" provided "as is" without express or implied warranty.
- X'\"
- X'\" $Header: /user6/ouster/tcl/doc/RCS/Concat.man,v 1.2 91/05/29 14:45:29 ouster Exp $ SPRITE (Berkeley)
- 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.HS Tcl_Concat tcl
- X.BS
- X.SH NAME
- XTcl_Concat \- concatenate a collection of strings
- X.SH SYNOPSIS
- X.nf
- X\fB#include <tcl.h>\fR
- X.sp
- Xchar *
- X\fBTcl_Concat\fR(\fIargc, argv\fR)
- X.SH ARGUMENTS
- X.AP int argc in
- XNumber of strings.
- X.AP char *argv[] in
- XArray of strings to concatenate. Must have \fIargc\fR entries.
- X.BE
- X
- X.SH DESCRIPTION
- X.PP
- X\fBTcl_Concat\fR is a utility procedure used by several of the
- XTcl commands. Given a collection of strings, it concatenates
- Xthem together into a single string, with the original strings
- Xseparated by spaces. This procedure behaves differently than
- X\fBTcl_Merge\fR, in that the arguments are simply concatenated:
- Xno effort is made to ensure proper list structure.
- X.VS
- XHowever, in most common usage the arguments will all be proper
- Xlists themselves; if this is true, then the result will also have
- Xproper list structure.
- X.PP
- X\fBTcl_Concat\fR eliminates leading and trailing white space as it
- Xcopies strings from \fBargv\fR to the result. If an element of
- X\fBargv\fR consists of nothing but white space, then that string
- Xis ignored entirely. This white-space removal was added to make
- Xthe output of the \fBconcat\fR command cleaner-looking.
- X.VE
- X.PP
- XThe result string is dynamically allocated
- Xusing \fBmalloc()\fR; the caller must eventually release the space
- Xby calling \fBfree()\fR.
- X
- X.SH KEYWORDS
- Xconcatenate, strings
- END_OF_FILE
- if test 5457 -ne `wc -c <'tcl6.1/doc/Concat.man'`; then
- echo shar: \"'tcl6.1/doc/Concat.man'\" unpacked with wrong size!
- fi
- # end of 'tcl6.1/doc/Concat.man'
- fi
- if test -f 'tcl6.1/doc/CrtInterp.man' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'tcl6.1/doc/CrtInterp.man'\"
- else
- echo shar: Extracting \"'tcl6.1/doc/CrtInterp.man'\" \(5355 characters\)
- sed "s/^X//" >'tcl6.1/doc/CrtInterp.man' <<'END_OF_FILE'
- X'\" Copyright 1989 Regents of the University of California
- X'\" Permission to use, copy, modify, and distribute this
- X'\" documentation for any purpose and without fee is hereby
- X'\" granted, provided that this notice appears in all copies.
- X'\" The University of California makes no representations about
- X'\" the suitability of this material for any purpose. It is
- X'\" provided "as is" without express or implied warranty.
- X'\"
- X'\" $Header: /user6/ouster/tcl/doc/RCS/CrtInterp.man,v 1.3 91/07/23 21:47:05 ouster Exp $ SPRITE (Berkeley)
- 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.HS Tcl_CreateInterp tcl
- X.BS
- X.SH NAME
- XTcl_CreateInterp, Tcl_DeleteInterp \- create and delete Tcl command interpreters
- X.SH SYNOPSIS
- X.nf
- X\fB#include <tcl.h>\fR
- X.sp
- XTcl_Interp *
- X\fBTcl_CreateInterp\fR()
- X.sp
- X\fBTcl_DeleteInterp\fR(\fIinterp\fR)
- X.SH ARGUMENTS
- X.AS Tcl_Interp *interp
- X.AP Tcl_Interp *interp in
- XToken for interpreter to be destroyed.
- X.BE
- X
- X.SH DESCRIPTION
- X.PP
- X\fBTcl_CreateInterp\fR creates a new interpreter structure and returns
- Xa token for it. The token is required in calls to most other Tcl
- Xprocedures, such as \fBTcl_CreateCommand\fR, \fBTcl_Eval\fR, and
- X\fBTcl_DeleteInterp\fR.
- XClients are only allowed to access a few of the fields of
- XTcl_Interp structures; see the Tcl_Interp
- Xand \fBTcl_CreateCommand\fR man pages for details.
- XThe new interpreter is initialized with no defined variables and only
- Xthe built-in Tcl commands. To bind in additional commands, call
- X\fBTcl_CreateCommand\fR.
- X.PP
- X\fBTcl_DeleteInterp\fR destroys a command interpreter and releases all of
- Xthe resources associated with it, including variables, procedures,
- Xand application-specific command bindings. After \fBTcl_DeleteInterp\fR
- Xreturns the caller should never again use the \fIinterp\fR token.
- X
- X.SH KEYWORDS
- Xcommand, create, delete, interpreter
- END_OF_FILE
- if test 5355 -ne `wc -c <'tcl6.1/doc/CrtInterp.man'`; then
- echo shar: \"'tcl6.1/doc/CrtInterp.man'\" unpacked with wrong size!
- fi
- # end of 'tcl6.1/doc/CrtInterp.man'
- fi
- if test -f 'tcl6.1/doc/History.man' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'tcl6.1/doc/History.man'\"
- else
- echo shar: Extracting \"'tcl6.1/doc/History.man'\" \(6235 characters\)
- sed "s/^X//" >'tcl6.1/doc/History.man' <<'END_OF_FILE'
- X'\" Copyright 1989 Regents of the University of California
- X'\" Permission to use, copy, modify, and distribute this
- X'\" documentation for any purpose and without fee is hereby
- X'\" granted, provided that this notice appears in all copies.
- X'\" The University of California makes no representations about
- X'\" the suitability of this material for any purpose. It is
- X'\" provided "as is" without express or implied warranty.
- X'\"
- X'\" $Header: /user6/ouster/tcl/doc/RCS/History.man,v 1.3 91/10/27 14:29:31 ouster Exp $ SPRITE (Berkeley)
- 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.HS Tcl_InitHistory tcl
- X.BS
- X.SH NAME
- XTcl_InitHistory, Tcl_RecordAndEval \- procedures for managing history list
- X.SH SYNOPSIS
- X.nf
- X\fB#include <tcl.h>\fR
- X.sp
- X.VS
- X\fBTcl_InitHistory\fR(\fIinterp\fR)
- X.VE
- X.sp
- Xint
- X\fBTcl_RecordAndEval\fR(\fIinterp, cmd, flags\fR)
- X.SH ARGUMENTS
- X.AS Tcl_Interp *interp;
- X.AP Tcl_Interp *interp in
- XTcl interpreter in which history facilities are being used.
- X.AP char *cmd in
- XCommand (or sequence of commands) to execute.
- X.AP char flags in
- XFlags to pass to \fBTcl_Eval\fR (normally 0). If -1, then the
- Xcommand is not executed; it's just recorded.
- X.BE
- X
- X.SH DESCRIPTION
- X.PP
- XThe procedure \fBTcl_HistoryInit\fR is invoked to enable the
- X.VS
- Xhistory facilities in an interpreter (by default there is no
- X\fBhistory\fR command in an interpreter).
- XAfter this command has been executed the \fBhistory\fR
- Xcommand will be available in \fIinterp\fR and the history facilities
- Xwill be initialized.
- X\fBTcl_HistoryInit\fR is invoked automatically by
- X\fBTcl_RecordAndEval\fR, so it need not be invoked explicitly
- Xunless the \fBhistory\fR command is to
- Xbe used before \fBTcl_RecordAndEval\fR has been called.
- X.VE
- X.PP
- X\fBTcl_RecordAndEval\fR is invoked to record a command on the history
- Xlist and then execute it. Programs that do not wish to use the history
- Xmechanism should not call \fBTcl_RecordAndEval\fR; they should call
- X\fBTcl_Eval\fR instead. Furthermore, \fBTcl_RecordAndEval\fR should
- Xonly be called with top-level commands typed by the user, since the
- Xpurpose of history is to allow the user to re-issue recently-invoked
- Xcommands.
- X.PP
- X\fBTcl_RecordAndEval\fR does three things.
- XFirst, it calls \fBTcl_HistoryInit\fR to initialize history for the
- Xinterpreter \fIinterp\fR, if this hasn't already been done.
- XSecond, \fBTcl_RecordAndEval\fR saves \fIcommand\fR in
- Xthe history list for \fIinterp\fR, making a new event to hold the
- Xcommand.
- XThird, \fBTcl_RecordAndEval\fR executes the command by passing it
- Xand \fIflags\fR to \fBTcl_Eval\fR. If \fIflags\fR is -1 then only
- Xthe first two steps are taken; the command will not be executed.
- X
- X.SH KEYWORDS
- Xcommand, event, execute, history, interpreter, record
- END_OF_FILE
- if test 6235 -ne `wc -c <'tcl6.1/doc/History.man'`; then
- echo shar: \"'tcl6.1/doc/History.man'\" unpacked with wrong size!
- fi
- # end of 'tcl6.1/doc/History.man'
- fi
- if test -f 'tcl6.1/doc/TildeSubst.man' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'tcl6.1/doc/TildeSubst.man'\"
- else
- echo shar: Extracting \"'tcl6.1/doc/TildeSubst.man'\" \(5835 characters\)
- sed "s/^X//" >'tcl6.1/doc/TildeSubst.man' <<'END_OF_FILE'
- X'\" Copyright 1989 Regents of the University of California
- X'\" Permission to use, copy, modify, and distribute this
- X'\" documentation for any purpose and without fee is hereby
- X'\" granted, provided that this notice appears in all copies.
- X'\" The University of California makes no representations about
- X'\" the suitability of this material for any purpose. It is
- X'\" provided "as is" without express or implied warranty.
- X'\"
- X'\" $Header: /user6/ouster/tcl/doc/RCS/TildeSubst.man,v 1.3 91/04/03 15:14:15 ouster Exp $ SPRITE (Berkeley)
- 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.HS Tcl_TildeSubst tcl
- X.BS
- X.SH NAME
- XTcl_TildeSubst \- replace tilde with home directory in a file name
- X.SH SYNOPSIS
- X.nf
- X\fB#include <tcl.h>\fR
- X.sp
- Xchar *
- X\Tcl_TildeSubst\fR(\fIinterp\fR, \fIname\fR)
- X.SH ARGUMENTS
- X.AP Tcl_Interp *interp in
- XInterpreter in which to report an error, if any.
- X.AP char *name in
- XFile name, which may start with a ``~''.
- X.BE
- X
- X.SH DESCRIPTION
- X.PP
- XThis utility procedure does tilde substition. If \fIname\fR doesn't
- Xstart with a ``~'' character, then the procedure returns \fIname\fR.
- XIf \fIname\fR does start with a tilde, then \fBTcl_TildeSubst\fR
- Xreturns a new string identical to \fIname\fR except that the first
- Xelement of \fIname\fR is replaced with the location of the home
- Xdirectory for the given user. The substitution is carried out in
- Xthe same way that it would be done by \fIcsh\fR. If the tilde is
- Xfollowed immediately by a slash, then the \fB$HOME\fR environment
- Xvariable is substituted. Otherwise the characters between the
- Xtilde and the next slash are taken as a user name, which is
- Xlooked up in the password file; the user's home directory is
- Xretrieved from the password file and substituted.
- X.PP
- XThe string returned by \fBTcl_TildeSubst\fR is a static string
- Xbelonging to \fBTcl_TildeSubst\fR. Its value will only persist
- Xuntil the next call to \fBTcl_TildeSubst\fR; the caller should
- Xmake a copy of the result if it needs to live a long time.
- X.PP
- XIf an error occurs (e.g. because there was no user by the given
- Xname) then NULL is returned and an error message will be left
- Xat \fIinterp->result\fR. It is assumed that \fIinterp->result\fR
- Xhas been initialized in the standard way when \fBTcl_TildeSubst\fR
- Xis invoked.
- X
- X.SH KEYWORDS
- Xfile name, home directory, tilde, user
- END_OF_FILE
- if test 5835 -ne `wc -c <'tcl6.1/doc/TildeSubst.man'`; then
- echo shar: \"'tcl6.1/doc/TildeSubst.man'\" unpacked with wrong size!
- fi
- # end of 'tcl6.1/doc/TildeSubst.man'
- fi
- if test -f 'tcl6.1/tclAssem.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'tcl6.1/tclAssem.c'\"
- else
- echo shar: Extracting \"'tcl6.1/tclAssem.c'\" \(5788 characters\)
- sed "s/^X//" >'tcl6.1/tclAssem.c' <<'END_OF_FILE'
- X/*
- X * tclAssem.c --
- X *
- X * This file contains procedures to help assemble Tcl commands
- X * from an input source where commands may arrive in pieces, e.g.
- X * several lines of type-in corresponding to one command.
- X *
- X * Copyright 1990-1991 Regents of the University of California
- X * Permission to use, copy, modify, and distribute this
- X * software and its documentation for any purpose and without
- X * fee is hereby granted, provided that the above copyright
- X * notice appear in all copies. The University of California
- X * makes no representations about the suitability of this
- X * software for any purpose. It is provided "as is" without
- X * express or implied warranty.
- X */
- X
- X#ifndef lint
- Xstatic char rcsid[] = "$Header: /sprite/src/lib/tcl/RCS/tclAssem.c,v 1.8 91/09/23 11:22:22 ouster Exp $ SPRITE (Berkeley)";
- X#endif /* not lint */
- X
- X#include "tclInt.h"
- X
- X/*
- X * The structure below is the internal representation for a command
- X * buffer, which is used to hold a piece of a command until a full
- X * command is available. When a full command is available, it will
- X * be returned to the user, but it will also be retained in the buffer
- X * until the NEXT call to Tcl_AssembleCmd, at which point it will be
- X * removed.
- X */
- X
- Xtypedef struct {
- X char *buffer; /* Storage for command being assembled.
- X * Malloc-ed, and grows as needed. */
- X int bufSize; /* Total number of bytes in buffer. */
- X int bytesUsed; /* Number of bytes in buffer currently
- X * occupied (0 means there is not a
- X * buffered incomplete command). */
- X} CmdBuf;
- X
- X/*
- X * Default amount of space to allocate in command buffer:
- X */
- X
- X#define CMD_BUF_SIZE 100
- X
- X/*
- X *----------------------------------------------------------------------
- X *
- X * Tcl_CreateCmdBuf --
- X *
- X * Allocate and initialize a command buffer.
- X *
- X * Results:
- X * The return value is a token that may be passed to
- X * Tcl_AssembleCmd and Tcl_DeleteCmdBuf.
- X *
- X * Side effects:
- X * Memory is allocated.
- X *
- X *----------------------------------------------------------------------
- X */
- X
- XTcl_CmdBuf
- XTcl_CreateCmdBuf()
- X{
- X register CmdBuf *cbPtr;
- X
- X cbPtr = (CmdBuf *) ckalloc(sizeof(CmdBuf));
- X cbPtr->buffer = (char *) ckalloc(CMD_BUF_SIZE);
- X cbPtr->bufSize = CMD_BUF_SIZE;
- X cbPtr->bytesUsed = 0;
- X return (Tcl_CmdBuf) cbPtr;
- X}
- X
- X/*
- X *----------------------------------------------------------------------
- X *
- X * Tcl_DeleteCmdBuf --
- X *
- X * Release all of the resources associated with a command buffer.
- X * The caller should never again use buffer again.
- X *
- X * Results:
- X * None.
- X *
- X * Side effects:
- X * Memory is released.
- X *
- X *----------------------------------------------------------------------
- X */
- X
- Xvoid
- XTcl_DeleteCmdBuf(buffer)
- X Tcl_CmdBuf buffer; /* Token for command buffer (return value
- X * from previous call to Tcl_CreateCmdBuf). */
- X{
- X register CmdBuf *cbPtr = (CmdBuf *) buffer;
- X
- X ckfree(cbPtr->buffer);
- X ckfree((char *) cbPtr);
- X}
- X
- X/*
- X *----------------------------------------------------------------------
- X *
- X * Tcl_AssembleCmd --
- X *
- X * This is a utility procedure to assist in situations where
- X * commands may be read piece-meal from some input source. Given
- X * some input text, it adds the text to an input buffer and returns
- X * whole commands when they are ready.
- X *
- X * Results:
- X * If the addition of string to any currently-buffered information
- X * results in one or more complete Tcl commands, then the return value
- X * is a pointer to the complete command(s). The command value will
- X * only be valid until the next call to this procedure with the
- X * same buffer. If the addition of string leaves an incomplete
- X * command at the end of the buffer, then NULL is returned.
- X *
- X * Side effects:
- X * If string leaves a command incomplete, the partial command
- X * information is buffered for use in later calls to this procedure.
- X * Once a command has been returned, that command is deleted from
- X * the buffer on the next call to this procedure.
- X *
- X *----------------------------------------------------------------------
- X */
- X
- Xchar *
- XTcl_AssembleCmd(buffer, string)
- X Tcl_CmdBuf buffer; /* Token for a command buffer previously
- X * created by Tcl_CreateCmdBuf. */
- X char *string; /* Bytes to be appended to command stream.
- X * Note: if the string is zero length,
- X * then whatever is buffered will be
- X * considered to be a complete command
- X * regardless of whether parentheses are
- X * matched or not. */
- X{
- X register CmdBuf *cbPtr = (CmdBuf *) buffer;
- X int length, totalLength;
- X register char *p;
- X
- X /*
- X * If an empty string is passed in, just pretend the current
- X * command is complete, whether it really is or not.
- X */
- X
- X length = strlen(string);
- X if (length == 0) {
- X cbPtr->bytesUsed = 0;
- X return cbPtr->buffer;
- X }
- X
- X /*
- X * Add the new information to the buffer. If the current buffer
- X * isn't large enough, grow it by at least a factor of two, or
- X * enough to hold the new text.
- X */
- X
- X length = strlen(string);
- X totalLength = cbPtr->bytesUsed + length + 1;
- X if (totalLength > cbPtr->bufSize) {
- X unsigned int newSize;
- X char *newBuf;
- X
- X newSize = cbPtr->bufSize*2;
- X if (newSize < totalLength) {
- X newSize = totalLength;
- X }
- X newBuf = (char *) ckalloc(newSize);
- X strcpy(newBuf, cbPtr->buffer);
- X ckfree(cbPtr->buffer);
- X cbPtr->buffer = newBuf;
- X cbPtr->bufSize = newSize;
- X }
- X strcpy(cbPtr->buffer+cbPtr->bytesUsed, string);
- X cbPtr->bytesUsed += length;
- X
- X /*
- X * See if there is now a complete command in the buffer.
- X */
- X
- X p = cbPtr->buffer;
- X while (1) {
- X int gotNewLine = 0;
- X
- X while (isspace(*p)) {
- X if (*p == '\n') {
- X gotNewLine = 1;
- X }
- X p++;
- X }
- X if (*p == 0) {
- X if (gotNewLine) {
- X cbPtr->bytesUsed = 0;
- X return cbPtr->buffer;
- X }
- X return NULL;
- X }
- X p = TclWordEnd(p, 0);
- X }
- X}
- END_OF_FILE
- if test 5788 -ne `wc -c <'tcl6.1/tclAssem.c'`; then
- echo shar: \"'tcl6.1/tclAssem.c'\" unpacked with wrong size!
- fi
- # end of 'tcl6.1/tclAssem.c'
- fi
- if test -f 'tcl6.1/tests/exec.test' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'tcl6.1/tests/exec.test'\"
- else
- echo shar: Extracting \"'tcl6.1/tests/exec.test'\" \(6291 characters\)
- sed "s/^X//" >'tcl6.1/tests/exec.test' <<'END_OF_FILE'
- X# Commands covered: exec
- X#
- X# This file contains a collection of tests for one or more of the Tcl
- X# built-in commands. Sourcing this file into Tcl runs the tests and
- X# generates output for errors. No output means no errors were found.
- X#
- X# Copyright 1991 Regents of the University of California
- X# Permission to use, copy, modify, and distribute this
- X# software and its documentation for any purpose and without
- X# fee is hereby granted, provided that this copyright notice
- X# appears in all copies. The University of California makes no
- X# representations about the suitability of this software for any
- X# purpose. It is provided "as is" without express or implied
- X# warranty.
- X#
- X# $Header: /sprite/src/lib/tcl/tests/RCS/exec.test,v 1.16 91/09/11 17:29:55 ouster Exp $ (Berkeley)
- X
- Xif {[string compare test [info procs test]] == 1} then {source defs}
- X
- X# Basic operations.
- X
- Xtest exec-1.1 {basic exec operation} {
- X exec echo a b c
- X} "a b c"
- Xtest exec-1.2 {pipelining} {
- X exec echo a b c d | cat | cat
- X} "a b c d"
- Xtest exec-1.3 {pipelining} {
- X set a [exec echo a b c d | cat | wc]
- X list [scan $a "%d %d %d" b c d] $b $c $d
- X} {3 1 4 8}
- X
- X# I/O redirection: input from Tcl command.
- X
- Xtest exec-2.1 {redirecting input from immediate source} {
- X exec cat << "Sample text"
- X} {Sample text}
- Xtest exec-2.2 {redirecting input from immediate source} {
- X exec << "Sample text" cat | cat
- X} {Sample text}
- Xtest exec-2.3 {redirecting input from immediate source} {
- X exec cat << "Sample text" | cat
- X} {Sample text}
- Xtest exec-2.4 {redirecting input from immediate source} {
- X exec cat | cat << "Sample text"
- X} {Sample text}
- X
- X# I/O redirection: output to file.
- X
- Xcatch [exec rm -f gorp.file]
- Xtest exec-3.1 {redirecting output to file} {
- X exec echo "Some simple words" > gorp.file
- X exec cat gorp.file
- X} "Some simple words"
- Xtest exec-3.2 {redirecting output to file} {
- X exec echo "More simple words" | > gorp.file cat | cat
- X exec cat gorp.file
- X} "More simple words"
- Xtest exec-3.3 {redirecting output to file} {
- X exec > gorp.file echo "Different simple words" | cat | cat
- X exec cat gorp.file
- X} "Different simple words"
- X
- X# I/O redirection: input from file.
- X
- Xexec echo "Just a few thoughts" > gorp.file
- Xtest exec-4.1 {redirecting input from file} {
- X exec cat < gorp.file
- X} {Just a few thoughts}
- Xtest exec-4.2 {redirecting input from file} {
- X exec cat | cat < gorp.file
- X} {Just a few thoughts}
- Xtest exec-4.3 {redirecting input from file} {
- X exec cat < gorp.file | cat
- X} {Just a few thoughts}
- Xtest exec-4.4 {redirecting input from file} {
- X exec < gorp.file cat | cat
- X} {Just a few thoughts}
- X
- X# I/O redirection: combinations.
- X
- Xcatch {exec rm -f gorp.file2}
- Xtest exec-5.1 {multiple I/O redirections} {
- X exec << "command input" > gorp.file2 cat < gorp.file
- X exec cat gorp.file2
- X} {Just a few thoughts}
- Xtest exec-5.2 {multiple I/O redirections} {
- X exec < gorp.file << "command input" cat
- X} {command input}
- X
- X# Long input to command and output from command.
- X
- Xset a "0123456789 xxxxxxxxx abcdefghi ABCDEFGHIJK\n"
- Xset a [concat $a $a $a $a]
- Xset a [concat $a $a $a $a]
- Xset a [concat $a $a $a $a]
- Xset a [concat $a $a $a $a]
- Xtest exec-6.1 {long input and output} {
- X exec cat << $a
- X} $a
- X
- X# Commands that return errors.
- X
- Xtest exec-7.1 {commands returning errors} {
- X set x [catch {exec gorp} msg]
- X list $x $msg [lindex $errorCode 0] [lrange $errorCode 2 end]
- X} {1 {couldn't find "gorp" to execute} CHILDSTATUS 1}
- Xtest exec-7.2 {commands returning errors} {
- X set x [catch {exec foo | gorp} msg]
- X set x1 {couldn't find "foo" to execute
- Xcouldn't find "gorp" to execute}
- X set x2 {couldn't find "gorp" to execute
- Xcouldn't find "foo" to execute}
- X set y [expr {($msg == $x1) || ($msg == $x2)}]
- X list $x $y [lindex $errorCode 0] [lrange $errorCode 2 end]
- X} {1 1 CHILDSTATUS 1}
- Xtest exec-7.3 {commands returning errors} {
- X list [catch {exec sleep 1 | sh -c "exit 43" | sleep 1} msg] $msg
- X} {1 {}}
- Xtest exec-7.4 {commands returning errors} {
- X list [catch {exec gorp | echo a b c} msg] $msg
- X} {1 {a b c
- Xcouldn't find "gorp" to execute}}
- X
- X# Errors in executing the Tcl command, as opposed to errors in the
- X# processes that are invoked.
- X
- Xtest exec-8.1 {errors in exec invocation} {
- X list [catch {exec} msg] $msg
- X} {1 {didn't specify command to execute}}
- Xtest exec-8.2 {errors in exec invocation} {
- X list [catch {exec | cat} msg] $msg
- X} {1 {illegal use of | in command}}
- Xtest exec-8.3 {errors in exec invocation} {
- X list [catch {exec cat |} msg] $msg
- X} {1 {illegal use of | in command}}
- Xtest exec-8.4 {errors in exec invocation} {
- X list [catch {exec cat | | cat} msg] $msg
- X} {1 {illegal use of | in command}}
- Xtest exec-8.5 {errors in exec invocation} {
- X list [catch {exec cat <} msg] $msg
- X} {1 {can't specify "<" as last word in command}}
- Xtest exec-8.6 {errors in exec invocation} {
- X list [catch {exec cat >} msg] $msg
- X} {1 {can't specify ">" as last word in command}}
- Xtest exec-8.7 {errors in exec invocation} {
- X list [catch {exec cat <<} msg] $msg
- X} {1 {can't specify "<<" as last word in command}}
- Xtest exec-8.8 {errors in exec invocation} {
- X list [catch {exec cat < a/b/c} msg] [string tolower $msg]
- X} {1 {couldn't read file "a/b/c": no such file or directory}}
- Xtest exec-8.9 {errors in exec invocation} {
- X list [catch {exec cat << foo > a/b/c} msg] [string tolower $msg]
- X} {1 {couldn't write file "a/b/c": no such file or directory}}
- X
- X# Commands in background.
- X
- Xtest exec-9.1 {commands in background} {
- X set x [lindex [time {exec sleep 5 &}] 0]
- X expr $x<1000000
- X} 1
- Xtest exec-9.2 {commands in background} {
- X list [catch {exec echo a &b} msg] $msg
- X} {0 {a &b}}
- X
- X# Make sure "errorCode" is set correctly.
- X
- Xtest exec-10.1 {setting errorCode variable} {
- X list [catch {exec cat < a/b/c} msg] [string tolower $errorCode]
- X} {1 {unix enoent {no such file or directory}}}
- Xtest exec-10.2 {setting errorCode variable} {
- X list [catch {exec cat > a/b/c} msg] [string tolower $errorCode]
- X} {1 {unix enoent {no such file or directory}}}
- Xtest exec-10.3 {setting errorCode variable} {
- X set x [catch {exec _weirdo_command_} msg]
- X list $x $msg [lindex $errorCode 0] [lrange $errorCode 2 end]
- X} {1 {couldn't find "_weirdo_command_" to execute} CHILDSTATUS 1}
- X
- Xcatch {exec rm -f gorp.file}
- Xcatch {exec rm -f gorp.file2}
- Xreturn {}
- END_OF_FILE
- if test 6291 -ne `wc -c <'tcl6.1/tests/exec.test'`; then
- echo shar: \"'tcl6.1/tests/exec.test'\" unpacked with wrong size!
- fi
- # end of 'tcl6.1/tests/exec.test'
- fi
- if test -f 'tcl6.1/tests/upvar.test' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'tcl6.1/tests/upvar.test'\"
- else
- echo shar: Extracting \"'tcl6.1/tests/upvar.test'\" \(5410 characters\)
- sed "s/^X//" >'tcl6.1/tests/upvar.test' <<'END_OF_FILE'
- X# Commands covered: upvar
- X#
- X# This file contains a collection of tests for one or more of the Tcl
- X# built-in commands. Sourcing this file into Tcl runs the tests and
- X# generates output for errors. No output means no errors were found.
- X#
- X# Copyright 1991 Regents of the University of California
- X# Permission to use, copy, modify, and distribute this
- X# software and its documentation for any purpose and without
- X# fee is hereby granted, provided that this copyright notice
- X# appears in all copies. The University of California makes no
- X# representations about the suitability of this software for any
- X# purpose. It is provided "as is" without express or implied
- X# warranty.
- X#
- X# $Header: /sprite/src/lib/tcl/tests/RCS/upvar.test,v 1.1 91/10/03 16:47:56 ouster Exp $ (Berkeley)
- X
- Xif {[string compare test [info procs test]] == 1} then {source defs}
- X
- Xtest upvar-1.1 {reading variables with upvar} {
- X proc p1 {a b} {set c 22; set d 33; p2}
- X proc p2 {} {upvar a x1 b x2 c x3 d x4; set a abc; list $x1 $x2 $x3 $x4 $a}
- X p1 foo bar
- X} {foo bar 22 33 abc}
- Xtest upvar-1.2 {reading variables with upvar} {
- X proc p1 {a b} {set c 22; set d 33; p2}
- X proc p2 {} {p3}
- X proc p3 {} {upvar 2 a x1 b x2 c x3 d x4; set a abc; list $x1 $x2 $x3 $x4 $a}
- X p1 foo bar
- X} {foo bar 22 33 abc}
- Xtest upvar-1.3 {reading variables with upvar} {
- X proc p1 {a b} {set c 22; set d 33; p2}
- X proc p2 {} {p3}
- X proc p3 {} {
- X upvar #1 a x1 b x2 c x3 d x4
- X set a abc
- X list $x1 $x2 $x3 $x4 $a
- X }
- X p1 foo bar
- X} {foo bar 22 33 abc}
- Xtest upvar-1.4 {reading variables with upvar} {
- X set x1 44
- X set x2 55
- X proc p1 {} {p2}
- X proc p2 {} {
- X upvar 2 x1 x1 x2 a
- X upvar #0 x1 b
- X set c $b
- X incr b 3
- X list $x1 $a $b
- X }
- X p1
- X} {47 55 47}
- X
- Xtest upvar-2.1 {writing variables with upvar} {
- X proc p1 {a b} {set c 22; set d 33; p2; list $a $b $c $d}
- X proc p2 {} {
- X upvar a x1 b x2 c x3 d x4
- X set x1 14
- X set x4 88
- X }
- X p1 foo bar
- X} {14 bar 22 88}
- Xtest upvar-2.2 {writing variables with upvar} {
- X set x1 44
- X set x2 55
- X proc p1 {x1 x2} {
- X upvar #0 x1 a
- X upvar x2 b
- X set a $x1
- X set b $x2
- X }
- X p1 newbits morebits
- X list $x1 $x2
- X} {newbits morebits}
- Xtest upvar-2.3 {writing variables with upvar} {
- X catch {unset x1}
- X catch {unset x2}
- X proc p1 {x1 x2} {
- X upvar #0 x1 a
- X upvar x2 b
- X set a $x1
- X set b $x2
- X }
- X p1 newbits morebits
- X list [catch {set x1} msg] $msg [catch {set x2} msg] $msg
- X} {0 newbits 0 morebits}
- X
- Xtest upvar-3.1 {unsetting variables with upvar} {
- X proc p1 {a b} {set c 22; set d 33; p2; lsort [info vars]}
- X proc p2 {} {
- X upvar 1 a x1 d x2
- X unset x1 x2
- X }
- X p1 foo bar
- X} {b c}
- Xtest upvar-3.2 {unsetting variables with upvar} {
- X proc p1 {a b} {set c 22; set d 33; p2; lsort [info vars]}
- X proc p2 {} {
- X upvar 1 a x1 d x2
- X unset x1 x2
- X set x2 28
- X }
- X p1 foo bar
- X} {b c d}
- Xtest upvar-3.3 {unsetting variables with upvar} {
- X set x1 44
- X set x2 55
- X proc p1 {} {p2}
- X proc p2 {} {
- X upvar 2 x1 a
- X upvar #0 x2 b
- X unset a b
- X }
- X p1
- X list [info exists x1] [info exists x2]
- X} {0 0}
- Xtest upvar-3.4 {unsetting variables with upvar} {
- X set x1 44
- X set x2 55
- X proc p1 {} {
- X upvar x1 a x2 b
- X unset a b
- X set b 118
- X }
- X p1
- X list [info exists x1] [catch {set x2} msg] $msg
- X} {0 0 118}
- X
- Xtest upvar-4.1 {nested upvars} {
- X set x1 88
- X proc p1 {a b} {set c 22; set d 33; p2}
- X proc p2 {} {global x1; upvar c x2; p3}
- X proc p3 {} {
- X upvar x1 a x2 b
- X list $a $b
- X }
- X p1 14 15
- X} {88 22}
- Xtest upvar-4.2 {nested upvars} {
- X set x1 88
- X proc p1 {a b} {set c 22; set d 33; p2; list $a $b $c $d}
- X proc p2 {} {global x1; upvar c x2; p3}
- X proc p3 {} {
- X upvar x1 a x2 b
- X set a foo
- X set b bar
- X }
- X list [p1 14 15] $x1
- X} {{14 15 bar 33} foo}
- X
- Xproc tproc {args} {global x; set x [list $args [uplevel info vars]]}
- Xtest upvar-5.1 {traces involving upvars} {
- X proc p1 {a b} {set c 22; set d 33; trace var c rw tproc; p2}
- X proc p2 {} {upvar c x1; set x1 22}
- X set x ---
- X p1 foo bar
- X set x
- X} {{x1 {} w} x1}
- Xtest upvar-5.2 {traces involving upvars} {
- X proc p1 {a b} {set c 22; set d 33; trace var c rw tproc; p2}
- X proc p2 {} {upvar c x1; set x1}
- X set x ---
- X p1 foo bar
- X set x
- X} {{x1 {} r} x1}
- Xtest upvar-5.3 {traces involving upvars} {
- X proc p1 {a b} {set c 22; set d 33; trace var c rwu tproc; p2}
- X proc p2 {} {upvar c x1; unset x1}
- X set x ---
- X p1 foo bar
- X set x
- X} {{x1 {} u} x1}
- X
- Xtest upvar-6.1 {errors in upvar command} {
- X list [catch upvar msg] $msg
- X} {1 {wrong # args: should be "upvar ?level? otherVar localVar ?otherVar localVar ...?"}}
- Xtest upvar-6.2 {errors in upvar command} {
- X list [catch {upvar 1} msg] $msg
- X} {1 {wrong # args: should be "upvar ?level? otherVar localVar ?otherVar localVar ...?"}}
- Xtest upvar-6.3 {errors in upvar command} {
- X list [catch {upvar a b} msg] $msg
- X} {1 {already at top level}}
- Xtest upvar-6.4 {errors in upvar command} {
- X list [catch {upvar 1 a b} msg] $msg
- X} {1 {already at top level}}
- Xtest upvar-6.5 {errors in upvar command} {
- X list [catch {upvar #0 a b} msg] $msg
- X} {1 {already at top level}}
- Xtest upvar-6.6 {errors in upvar command} {
- X proc p1 {} {upvar a b c}
- X list [catch p1 msg] $msg
- X} {1 {wrong # args: should be "a ?level? otherVar localVar ?otherVar localVar ...?"}}
- Xtest upvar-6.7 {errors in upvar command} {
- X proc p1 {} {set a 33; upvar b a}
- X list [catch p1 msg] $msg
- X} {1 {variable "a" already exists}}
- END_OF_FILE
- if test 5410 -ne `wc -c <'tcl6.1/tests/upvar.test'`; then
- echo shar: \"'tcl6.1/tests/upvar.test'\" unpacked with wrong size!
- fi
- # end of 'tcl6.1/tests/upvar.test'
- fi
- echo shar: End of archive 4 \(of 33\).
- cp /dev/null ark4isdone
- 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 24 25 26 27 28 29 30 31 32 33 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 33 archives.
- 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.
-