Update tcl/tk for tcl-dp
This commit is contained in:
parent
07611c0ac3
commit
b2af3b41bd
35
build.sh
35
build.sh
@ -4,9 +4,9 @@ WORLD_ROOT=${PWD}
|
||||
ARCHIE_ROOT="${WORLD_ROOT}/archie"
|
||||
PROSPERO_ROOT="${WORLD_ROOT}/prospero"
|
||||
BERKDB_ROOT="${WORLD_ROOT}/berkdb"
|
||||
TCL_ROOT="${WORLD_ROOT}/tcl7.3"
|
||||
TCL_ROOT="${WORLD_ROOT}/tcl7.6"
|
||||
TCLDP_ROOT="${WORLD_ROOT}/tcl-dp/unix"
|
||||
TK_ROOT="${WORLD_ROOT}/tk3.6"
|
||||
TK_ROOT="${WORLD_ROOT}/tk4.2"
|
||||
SOLOS=$(uname -s)
|
||||
SOLVER=$(uname -r)
|
||||
SYSTYPE="${SOLOS}-${SOLVER}"
|
||||
@ -34,18 +34,43 @@ echo " Tk Root : ${TK_ROOT}"
|
||||
echo " System Type : ${SYSTYPE}"
|
||||
echo " Dist Dir : ${DISTDIR}"
|
||||
|
||||
cd ${TCL_ROOT}
|
||||
echo ""
|
||||
echo "===================================================================="
|
||||
echo " Building ${TCL_ROOT}/unix"
|
||||
echo "===================================================================="
|
||||
echo ""
|
||||
cd ${TCL_ROOT}/unix
|
||||
./configure --prefix=${DISTDIR}
|
||||
make install
|
||||
cd ${WORLD_ROOT}
|
||||
|
||||
cd ${TK_ROOT}
|
||||
|
||||
echo ""
|
||||
echo "===================================================================="
|
||||
echo " Building ${TK_ROOT}/unix"
|
||||
echo "===================================================================="
|
||||
echo ""
|
||||
cd ${TK_ROOT}/unix
|
||||
./configure --prefix=${DISTDIR}
|
||||
make install
|
||||
cd ${WORLD_ROOT}
|
||||
|
||||
echo ""
|
||||
echo "===================================================================="
|
||||
echo " Building ${TCLDP_ROOT}"
|
||||
echo "===================================================================="
|
||||
echo ""
|
||||
cd ${TCLDP_ROOT}
|
||||
./configure --prefix=${DISTDIR}
|
||||
./configure --with-tcl=${TCL_ROOT} --prefix=${DISTDIR}
|
||||
make install
|
||||
cd ${WORLD_ROOT}
|
||||
|
||||
echo ""
|
||||
echo "===================================================================="
|
||||
echo " Building ${BERKDB_ROOT}/PORT/${SYSTYPE}"
|
||||
echo "===================================================================="
|
||||
echo ""
|
||||
cd ${BERKDB_ROOT}/PORT/${SYSTYPE}
|
||||
CC=gcc make
|
||||
cd ${WORLD_ROOT}
|
||||
|
||||
|
@ -1,255 +0,0 @@
|
||||
#
|
||||
# This file is a Makefile for Tcl. If it has the name "Makefile.in"
|
||||
# then it is a template for a Makefile; to generate the actual Makefile,
|
||||
# run "./configure", which is a configuration script generated by the
|
||||
# "autoconf" program (constructs like "@foo@" will get replaced in the
|
||||
# actual Makefile.
|
||||
|
||||
#----------------------------------------------------------------
|
||||
# Things you can change to personalize the Makefile for your own
|
||||
# site (you can make these changes in either Makefile.in or
|
||||
# Makefile, but changes to Makefile will get lost if you re-run
|
||||
# the configuration script).
|
||||
#----------------------------------------------------------------
|
||||
|
||||
# Default top-level directories in which to install architecture-
|
||||
# specific files (exec_prefix) and machine-independent files such
|
||||
# as scripts (prefix). The values specified here may be overridden
|
||||
# at configure-time with the --exec-prefix and --prefix options
|
||||
# to the "configure" script.
|
||||
|
||||
exec_prefix = /usr/local
|
||||
prefix = /usr/local
|
||||
|
||||
# Directory in which to install the library of Tcl scripts (note:
|
||||
# you can set the TCL_LIBRARY environment variable at run-time to
|
||||
# override the compiled-in location):
|
||||
TCL_LIBRARY = $(prefix)/lib/tcl
|
||||
|
||||
# Directory in which to install the archive libtcl.a:
|
||||
LIB_DIR = $(exec_prefix)/lib
|
||||
|
||||
# Directory in which to install the program tclsh:
|
||||
BIN_DIR = $(exec_prefix)/bin
|
||||
|
||||
# Directory in which to install the include file tcl.h:
|
||||
INCLUDE_DIR = $(prefix)/include
|
||||
|
||||
# Top-level directory for manual entries:
|
||||
MAN_DIR = $(prefix)/man
|
||||
|
||||
# Directory in which to install manual entry for tclsh:
|
||||
MAN1_DIR = $(MAN_DIR)/man1
|
||||
|
||||
# Directory in which to install manual entries for Tcl's C library
|
||||
# procedures:
|
||||
MAN3_DIR = $(MAN_DIR)/man3
|
||||
|
||||
# Directory in which to install manual entries for the built-in
|
||||
# Tcl commands:
|
||||
MANN_DIR = $(MAN_DIR)/mann
|
||||
|
||||
# To change the compiler switches, for example to change from -O
|
||||
# to -g, change the following line:
|
||||
CFLAGS = -O
|
||||
|
||||
# To disable ANSI-C procedure prototypes reverse the comment characters
|
||||
# on the following lines:
|
||||
PROTO_FLAGS =
|
||||
#PROTO_FLAGS = -DNO_PROTOTYPE
|
||||
|
||||
# Mathematical functions like sin and atan2 are enabled for expressions
|
||||
# by default. To disable them, reverse the comment characters on the
|
||||
# following pairs of lines:
|
||||
MATH_FLAGS =
|
||||
#MATH_FLAGS = -DTCL_NO_MATH
|
||||
MATH_LIBS = -lm
|
||||
#MATH_LIBS =
|
||||
|
||||
# To compile for non-UNIX systems (so that only the non-UNIX-specific
|
||||
# commands are available), reverse the comment characters on the
|
||||
# following pairs of lines. In addition, you'll have to provide your
|
||||
# own replacement for the "panic" procedure (see panic.c for what
|
||||
# the current one does).
|
||||
GENERIC_FLAGS =
|
||||
#GENERIC_FLAGS = -DTCL_GENERIC_ONLY
|
||||
UNIX_OBJS = panic.o tclEnv.o tclGlob.o tclMain.o tclUnixAZ.o \
|
||||
tclUnixStr.o tclUnixUtil.o
|
||||
#UNIX_OBJS =
|
||||
|
||||
# To enable memory debugging reverse the comment characters on the following
|
||||
# lines. Warning: if you enable memory debugging, you must do it
|
||||
# *everywhere*, including all the code that calls Tcl, and you must use
|
||||
# ckalloc and ckfree everywhere instead of malloc and free.
|
||||
MEM_DEBUG_FLAGS =
|
||||
#MEM_DEBUG_FLAGS = -DTCL_MEM_DEBUG
|
||||
|
||||
# Some versions of make, like SGI's, use the following variable to
|
||||
# determine which shell to use for executing commands:
|
||||
SHELL = /bin/sh
|
||||
|
||||
#----------------------------------------------------------------
|
||||
# The information below is modified by the configure script when
|
||||
# Makefile is generated from Makefile.in. You shouldn't normally
|
||||
# modify any of this stuff by hand.
|
||||
#----------------------------------------------------------------
|
||||
|
||||
COMPAT_OBJS = @LIBOBJS@
|
||||
AC_FLAGS = @DEFS@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
RANLIB = @RANLIB@
|
||||
SRC_DIR = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
#----------------------------------------------------------------
|
||||
# The information below should be usable as is. The configure
|
||||
# script won't modify it and you shouldn't need to modify it
|
||||
# either.
|
||||
#----------------------------------------------------------------
|
||||
|
||||
|
||||
CC = @CC@
|
||||
CC_SWITCHES = ${CFLAGS} -I. -I${SRC_DIR} ${AC_FLAGS} ${MATH_FLAGS} \
|
||||
${GENERIC_FLAGS} ${PROTO_FLAGS} ${MEM_DEBUG_FLAGS} \
|
||||
-DTCL_LIBRARY=\"${TCL_LIBRARY}\"
|
||||
|
||||
GENERIC_OBJS = regexp.o tclAsync.o tclBasic.o tclCkalloc.o \
|
||||
tclCmdAH.o tclCmdIL.o tclCmdMZ.o tclExpr.o tclGet.o \
|
||||
tclHash.o tclHistory.o tclLink.o tclParse.o tclProc.o \
|
||||
tclUtil.o tclVar.o
|
||||
|
||||
OBJS = ${GENERIC_OBJS} ${UNIX_OBJS} ${COMPAT_OBJS}
|
||||
|
||||
all: libtcl.a tclsh
|
||||
|
||||
libtcl.a: ${OBJS}
|
||||
rm -f libtcl.a
|
||||
ar cr libtcl.a ${OBJS}
|
||||
$(RANLIB) libtcl.a
|
||||
|
||||
tclsh: tclAppInit.o libtcl.a
|
||||
${CC} ${CC_SWITCHES} tclAppInit.o libtcl.a ${MATH_LIBS} -o tclsh
|
||||
|
||||
tcltest: tclTest.o libtcl.a
|
||||
${CC} ${CC_SWITCHES} tclTest.o libtcl.a ${MATH_LIBS} -o tcltest
|
||||
|
||||
test: tcltest
|
||||
@cwd=`pwd`; \
|
||||
cd $(SRC_DIR); TCL_LIBRARY=`pwd`/library; export TCL_LIBRARY; \
|
||||
cd $$cwd; ( echo cd $(SRC_DIR)/tests\; source all ) | ./tcltest
|
||||
|
||||
install: install-binaries install-libraries install-man
|
||||
|
||||
install-binaries: libtcl.a tclsh
|
||||
@for i in $(LIB_DIR) $(BIN_DIR) ; \
|
||||
do \
|
||||
if [ ! -d $$i ] ; then \
|
||||
echo "Making directory $$i"; \
|
||||
mkdir $$i; \
|
||||
chmod 755 $$i; \
|
||||
else true; \
|
||||
fi; \
|
||||
done;
|
||||
@echo "Installing libtcl.a"
|
||||
@$(INSTALL_DATA) libtcl.a $(LIB_DIR)
|
||||
@$(RANLIB) $(LIB_DIR)/libtcl.a
|
||||
@echo "Installing tclsh"
|
||||
@$(INSTALL_PROGRAM) tclsh $(BIN_DIR)
|
||||
|
||||
install-libraries:
|
||||
@for i in $(prefix)/lib $(INCLUDE_DIR) $(TCL_LIBRARY) ; \
|
||||
do \
|
||||
if [ ! -d $$i ] ; then \
|
||||
echo "Making directory $$i"; \
|
||||
mkdir $$i; \
|
||||
chmod 755 $$i; \
|
||||
else true; \
|
||||
fi; \
|
||||
done;
|
||||
@echo "Installing tcl.h"
|
||||
@$(INSTALL_DATA) $(SRC_DIR)/tcl.h $(INCLUDE_DIR)
|
||||
@cd $(SRC_DIR)/library; for i in *.tcl tclIndex; \
|
||||
do \
|
||||
echo "Installing library/$$i"; \
|
||||
$(INSTALL_DATA) $$i $(TCL_LIBRARY); \
|
||||
done;
|
||||
|
||||
install-man:
|
||||
@for i in $(MAN_DIR) $(MAN1_DIR) $(MAN3_DIR) $(MANN_DIR) ; \
|
||||
do \
|
||||
if [ ! -d $$i ] ; then \
|
||||
echo "Making directory $$i"; \
|
||||
mkdir $$i; \
|
||||
chmod 755 $$i; \
|
||||
else true; \
|
||||
fi; \
|
||||
done;
|
||||
@cd $(SRC_DIR)/doc; for i in *.1; \
|
||||
do \
|
||||
echo "Installing doc/$$i"; \
|
||||
rm -f $(MAN1_DIR)/$$i; \
|
||||
sed -e '/man\.macros/r man.macros' -e '/man\.macros/d' \
|
||||
$$i > $(MAN1_DIR)/$$i; \
|
||||
chmod 444 $(MAN1_DIR)/$$i; \
|
||||
done;
|
||||
@cd $(SRC_DIR)/doc; for i in *.3; \
|
||||
do \
|
||||
echo "Installing doc/$$i"; \
|
||||
rm -f $(MAN3_DIR)/$$i; \
|
||||
sed -e '/man\.macros/r man.macros' -e '/man\.macros/d' \
|
||||
$$i > $(MAN3_DIR)/$$i; \
|
||||
chmod 444 $(MAN3_DIR)/$$i; \
|
||||
done;
|
||||
@cd $(SRC_DIR)/doc; for i in *.n; \
|
||||
do \
|
||||
echo "Installing doc/$$i"; \
|
||||
rm -f $(MANN_DIR)/$$i; \
|
||||
sed -e '/man\.macros/r man.macros' -e '/man\.macros/d' \
|
||||
$$i > $(MANN_DIR)/$$i; \
|
||||
chmod 444 $(MANN_DIR)/$$i; \
|
||||
done;
|
||||
|
||||
Makefile: $(SRC_DIR)/Makefile.in
|
||||
$(SHELL) config.status
|
||||
|
||||
clean:
|
||||
rm -f *.a *.o core errs *~ \#* TAGS *.E a.out errors tclsh tcltest
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile config.status
|
||||
|
||||
getcwd.o: $(SRC_DIR)/compat/getcwd.c
|
||||
$(CC) -c $(CC_SWITCHES) $(SRC_DIR)/compat/getcwd.c
|
||||
|
||||
opendir.o: $(SRC_DIR)/compat/opendir.c
|
||||
$(CC) -c $(CC_SWITCHES) $(SRC_DIR)/compat/opendir.c
|
||||
|
||||
strerror.o: $(SRC_DIR)/compat/strerror.c
|
||||
$(CC) -c $(CC_SWITCHES) $(SRC_DIR)/compat/strerror.c
|
||||
|
||||
strstr.o: $(SRC_DIR)/compat/strstr.c
|
||||
$(CC) -c $(CC_SWITCHES) $(SRC_DIR)/compat/strstr.c
|
||||
|
||||
strtod.o: $(SRC_DIR)/compat/strtod.c
|
||||
$(CC) -c $(CC_SWITCHES) $(SRC_DIR)/compat/strtod.c
|
||||
|
||||
strtol.o: $(SRC_DIR)/compat/strtol.c
|
||||
$(CC) -c $(CC_SWITCHES) $(SRC_DIR)/compat/strtol.c
|
||||
|
||||
strtoul.o: $(SRC_DIR)/compat/strtoul.c
|
||||
$(CC) -c $(CC_SWITCHES) $(SRC_DIR)/compat/strtoul.c
|
||||
|
||||
tmpnam.o: $(SRC_DIR)/compat/tmpnam.c
|
||||
$(CC) -c $(CC_SWITCHES) $(SRC_DIR)/compat/tmpnam.c
|
||||
|
||||
waitpid.o: $(SRC_DIR)/compat/waitpid.c
|
||||
$(CC) -c $(CC_SWITCHES) $(SRC_DIR)/compat/waitpid.c
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CC_SWITCHES) $<
|
||||
|
||||
${OBJS}: $(SRC_DIR)/tcl.h $(SRC_DIR)/tclInt.h
|
||||
${UNIX_OBJS}: $(SRC_DIR)/tclUnix.h
|
||||
tclCmdIL.o: $(SRC_DIR)/patchlevel.h
|
346
tcl7.3/README
346
tcl7.3/README
@ -1,346 +0,0 @@
|
||||
Tcl
|
||||
|
||||
by John Ousterhout
|
||||
University of California at Berkeley
|
||||
ouster@cs.berkeley.edu
|
||||
|
||||
1. Introduction
|
||||
---------------
|
||||
|
||||
This directory contains the sources and documentation for Tcl, an
|
||||
embeddable tool command language. The information here corresponds
|
||||
to release 7.3.
|
||||
|
||||
2. Documentation
|
||||
----------------
|
||||
|
||||
The best way to get started with Tcl is to read the draft of my
|
||||
upcoming book on Tcl and Tk, which can be retrieved using anonymous
|
||||
FTP from the directory "ucb/tcl" on ftp.cs.berkeley.edu. Part I of the
|
||||
book provides an introduction to writing Tcl scripts and Part III
|
||||
describes how to write C code that uses the Tcl C library procedures.
|
||||
|
||||
The "doc" subdirectory in this release contains a complete set of manual
|
||||
entries for Tcl. Files with extension ".1" are for programs (for
|
||||
example, tclsh.1); files with extension ".3" are for C library procedures;
|
||||
and files with extension ".n" describe Tcl commands. The file "doc/Tcl.n"
|
||||
gives a quick summary of the Tcl language syntax. To print any of the man
|
||||
pages, cd to the "doc" directory and invoke your favorite variant of
|
||||
troff using the normal -man macros, for example
|
||||
|
||||
ditroff -man Tcl.n
|
||||
|
||||
to print Tcl.n. If Tcl has been installed correctly and your "man"
|
||||
program supports it, you should be able to access the Tcl manual entries
|
||||
using the normal "man" mechanisms, such as
|
||||
|
||||
man Tcl
|
||||
|
||||
3. Compiling and installing Tcl
|
||||
-------------------------------
|
||||
|
||||
This release should compile and run "out of the box" on any UNIX-like
|
||||
system that approximates POSIX, BSD, or System V. I know that it runs
|
||||
on workstations from Sun, DEC, H-P, IBM, and Silicon Graphics, and on
|
||||
PC's running SCO UNIX and Xenix. To compile Tcl, do the following:
|
||||
|
||||
(a) Type "./configure" in this directory. This runs a configuration
|
||||
script created by GNU autoconf, which configures Tcl for your
|
||||
system and creates a Makefile. The configure script allows you
|
||||
to customize the Tcl configuration for your site; for details on
|
||||
how you can do this, see the file "configure.info".
|
||||
|
||||
(b) Type "make". This will create a library archive called "libtcl.a"
|
||||
and an interpreter application called "tclsh" that allows you to type
|
||||
Tcl commands interactively or execute script files.
|
||||
|
||||
(c) If the make fails then you'll have to personalize the Makefile
|
||||
for your site or possibly modify the distribution in other ways.
|
||||
First check the file "porting.notes" to see if there are hints
|
||||
for compiling on your system. If you need to modify Makefile,
|
||||
there are comments at the beginning of it that describe the things
|
||||
you might want to change and how to change them.
|
||||
|
||||
(d) Type "make install" to install Tcl binaries and script files in
|
||||
standard places. You'll need write permission on /usr/local to
|
||||
do this. See the Makefile for details on where things get
|
||||
installed.
|
||||
|
||||
(e) At this point you can play with Tcl by invoking the "tclsh"
|
||||
program and typing Tcl commands. However, if you haven't installed
|
||||
Tcl then you'll first need to set your TCL_LIBRARY variable to
|
||||
hold the full path name of the "library" subdirectory.
|
||||
|
||||
If you have trouble compiling Tcl, I'd suggest looking at the file
|
||||
"porting.notes". It contains information that people have sent me about
|
||||
changes they had to make to compile Tcl in various environments. I make
|
||||
no guarantees that this information is accurate, complete, or up-to-date,
|
||||
but you may find it useful. If you get Tcl running on a new configuration,
|
||||
I'd be happy to receive new information to add to "porting.notes". I'm
|
||||
also interested in hearing how to change the configuration setup so that
|
||||
Tcl compiles on additional platforms "out of the box".
|
||||
|
||||
4. Test suite
|
||||
-------------
|
||||
|
||||
There is a relatively complete test suite for all of the Tcl core in
|
||||
the subdirectory "tests". To use it just type "make test" in this
|
||||
directory. You should then see a printout of the test files processed.
|
||||
If any errors occur, you'll see a much more substantial printout for
|
||||
each error. See the README file in the "tests" directory for more
|
||||
information on the test suite.
|
||||
|
||||
5. Summary of changes in recent releases
|
||||
----------------------------------------
|
||||
|
||||
Tcl 7.3 is a minor release that includes only one change relative to
|
||||
Tcl 7.1 (it fixes a portability problem that prevented tclMain.c from
|
||||
compiling on some machines due to a missing R_OK definition). Tcl 7.3
|
||||
should be completely compatible with Tcl 7.1 and Tcl 7.0.
|
||||
|
||||
Tcl 7.2 was a mistake; it was withdrawn shortly after it was released.
|
||||
|
||||
Tcl 7.1 is a minor release that consists almost entirely of bug fixes.
|
||||
The only feature change is to allow no arguments in invocations of "list"
|
||||
and "concat". 7.1 should be completely compatible with 7.0.
|
||||
|
||||
Tcl 7.0 is a major new release that includes several new features
|
||||
and a few incompatible changes. For a complete list of all changes
|
||||
to Tcl in chronological order, see the file "changes". Those changes
|
||||
likely to cause compatibility problems with existing C code or Tcl
|
||||
scripts are specially marked. The most important changes are
|
||||
summarized below.
|
||||
|
||||
Tcl configuration and installation has improved in several ways:
|
||||
|
||||
1. GNU autoconf is now used for configuring Tcl prior to compilation.
|
||||
|
||||
2. The "tclTest" program no longer exists. It has been replaced by
|
||||
"tclsh", which is a true shell-like program based around Tcl (tclTest
|
||||
didn't really work very well as a shell). There's a new program
|
||||
"tcltest" which is the same as "tclsh" except that it includes a
|
||||
few extra Tcl commands for testing purposes.
|
||||
|
||||
3. A new procedure Tcl_AppInit has been added to separate all of the
|
||||
application-specific initialization from the Tcl main program. This
|
||||
should make it easier to build new Tcl applications that include
|
||||
extra packages.
|
||||
|
||||
4. There are now separate manual entries for each of the built-in
|
||||
commands. The manual entry "Tcl.n", which used to describe all of
|
||||
the built-ins plus many other things, now contains a terse but
|
||||
complete description of the Tcl language syntax.
|
||||
|
||||
Here is a list of all incompatibilities that affect Tcl scripts:
|
||||
|
||||
1. There have been several changes to backslash processing:
|
||||
- Unknown backslash sequences such as "\*" are now replaced with
|
||||
the following character (such as "*"); Tcl used to treat the
|
||||
backslash as an ordinary character in these cases, so both the
|
||||
backslash and the following character would be passed through.
|
||||
- Backslash-newline now eats up any white space after the newline,
|
||||
replacing the whole sequence with a single space character. Tcl
|
||||
used to just remove the backslash and newline.
|
||||
- The obsolete sequences \Cx, \Mx, \CMx, and \e no longer get
|
||||
special treatment.
|
||||
- The "format" command no longer does backslash processing on
|
||||
its input string.
|
||||
You can invoke the shell command below to locate backslash uses that
|
||||
may potentially behave differently under Tcl 7.0. This command
|
||||
will print all of the lines from the script files "*.tcl" that may
|
||||
not work correctly under Tcl 7.0:
|
||||
egrep '(\\$)|(\\[^][bfnrtv\0-9{}$ ;"])' *.tcl
|
||||
In some cases the command may print lines that are actually OK.
|
||||
|
||||
2. The "glob" command now returns only the names of files that
|
||||
actually exist, and it only returns names ending in "/" for
|
||||
directories.
|
||||
|
||||
3. When Tcl prints floating-point numbers (e.g. in the "expr" command)
|
||||
it ensures that the numbers contain a "." or "e" so that they don't
|
||||
look like integers.
|
||||
|
||||
4. The "regsub" command now overwrites its result variable in all cases.
|
||||
If there is no match, then the source string is copied to the result.
|
||||
|
||||
5. The "exec", "glob", "regexp", and "regsub" commands now include a
|
||||
"--" switch; if the first non-switch argument starts with a "-" then
|
||||
there must be a "--" switch or the non-switch argument will be treated
|
||||
as a switch.
|
||||
|
||||
6. The keyword "UNIX" in the variable "errorCode" has been changed to
|
||||
"POSIX".
|
||||
|
||||
7. The "format" and "scan" commands no longer support capitalized
|
||||
conversion specifiers such as "%D" that aren't supported by ANSI
|
||||
sprintf and sscanf.
|
||||
|
||||
Here is a list of all of the incompatibilities that affect C code that
|
||||
uses the Tcl library procedures. If you use an ANSI C compiler then
|
||||
any potential problems will be detected when you compile your code: if
|
||||
your code compiles cleanly then you don't need to worry about anything.
|
||||
|
||||
1. Tcl_TildeString now takes a dynamic string as an argument, which is
|
||||
used to hold the result.
|
||||
|
||||
2. tclHash.h has been eliminated; its contents are now in tcl.h.
|
||||
|
||||
3. The Tcl_History command has been eliminated: the "history" command
|
||||
is now automatically part of the interpreter.
|
||||
|
||||
4. The Tcl_Fork and Tcl_WaitPids procedures have been deleted (just
|
||||
use fork and waitpid instead).
|
||||
|
||||
5. The "flags" and "termPtr" arguments to Tcl_Eval have been eliminated,
|
||||
as has the "noSep" argument to Tcl_AppendElement and the TCL_NO_SPACE
|
||||
flag for Tcl_SetVar and Tcl_SetVar2.
|
||||
|
||||
6. The Tcl_CmdBuf structure has been eliminated, along with the procedures
|
||||
Tcl_CreateCmdBuf, Tcl_DeleteCmdBuf, and Tcl_AssembleCmd. Use dynamic
|
||||
strings instead.
|
||||
|
||||
7. Tcl_UnsetVar and Tcl_UnsetVar2 now return TCL_OK or TCL_ERROR instead
|
||||
of 0 or -1.
|
||||
|
||||
8. Tcl_UnixError has been renamed to Tcl_PosixError.
|
||||
|
||||
9. Tcl no longer redefines the library procedures "setenv", "putenv",
|
||||
and "unsetenv" by default. You have to set up special configuration
|
||||
in the Makefile if you want this.
|
||||
|
||||
Below is a sampler of the most important new features in Tcl 7.0. Refer
|
||||
to the "changes" file for a complete list.
|
||||
|
||||
1. The "expr" command supports transcendental and other math functions,
|
||||
plus it allows you to type expressions in multiple arguments. Its
|
||||
numerics have also been improved in several ways (e.g. support for
|
||||
NaN).
|
||||
|
||||
2. The "format" command now supports XPG3 %n$ conversion specifiers.
|
||||
|
||||
3. The "exec" command supports many new kinds of redirection such as
|
||||
>> and >&, plus it allows you to leave out the space between operators
|
||||
like < and the file name. For processes put into the background,
|
||||
"exec" returns a list of process ids.
|
||||
|
||||
4. The "lsearch" command now supports regular expressions and exact
|
||||
matching.
|
||||
|
||||
5. The "lsort" command has several new switches to control the
|
||||
sorting process (e.g. numerical sort, user-provided sort function,
|
||||
reverse sort, etc.).
|
||||
|
||||
6. There's a new command "pid" that can be used to return the current
|
||||
process ids or the process ids from an open file that refers to a
|
||||
pipeline.
|
||||
|
||||
7. There's a new command "switch" that should now be used instead
|
||||
of "case". It supports regular expressions and exact matches, and
|
||||
also uses single patterns instead of pattern lists. "Case" is
|
||||
now deprecated, although it's been retained for compatibility.
|
||||
|
||||
8. A new dynamic string library has been added to make it easier to
|
||||
build up strings and lists of arbitrary length. See the manual entry
|
||||
"DString.3".
|
||||
|
||||
9. Variable handling has been improved in several ways: you can
|
||||
now use whole-array traces to create variables on demand, you can
|
||||
delete variables during traces, you can upvar to array elements,
|
||||
and you can retarget an upvar variable to stop through a sequence
|
||||
of variables. Also, there's a new library procedure Tcl_LinkVar
|
||||
that can be used to associate a C variable with a Tcl variable and
|
||||
keep them in sync.
|
||||
|
||||
10. New library procedures Tcl_SetCommandInfo and Tcl_GetCommandInfo
|
||||
allow you to set and get the clientData and callback procedure for
|
||||
a command.
|
||||
|
||||
11. Added "-errorinfo" and "-errorcode" options to "return" command;
|
||||
they allow much better error handling.
|
||||
|
||||
12. Made prompts in tclsh user-settable via "tcl_prompt1" and
|
||||
"tcl_prompt2" variables.
|
||||
|
||||
13. Added low-level support that is needed to handle signals: see
|
||||
Tcl_AsyncCreate, etc.
|
||||
|
||||
6. Tcl newsgroup
|
||||
-----------------
|
||||
|
||||
There is a network news group "comp.lang.tcl" intended for the exchange
|
||||
of information about Tcl, Tk, and related applications. Feel free to use
|
||||
the newsgroup both for general information questions and for bug reports.
|
||||
I read the newsgroup and will attempt to fix bugs and problems reported
|
||||
to it.
|
||||
|
||||
7. Tcl contributed archive
|
||||
--------------------------
|
||||
|
||||
Many people have created exciting packages and applications based on Tcl
|
||||
and made them freely available to the Tcl community. An archive of these
|
||||
contributions is kept on the machine harbor.ecn.purdue.edu. You can
|
||||
access the archive using anonymous FTP; the Tcl contributed archive is
|
||||
in the directory "pub/tcl". The archive also contains an FAQ ("frequently
|
||||
asked questions") document that provides solutions to problems that
|
||||
are commonly encountered by TCL newcomers.
|
||||
|
||||
8. Support and bug fixes
|
||||
------------------------
|
||||
|
||||
I'm very interested in receiving bug reports and suggestions for
|
||||
improvements. Bugs usually get fixed quickly (particularly if they
|
||||
are serious), but enhancements may take a while and may not happen at
|
||||
all unless there is widespread support for them (I'm trying to slow
|
||||
the rate at which Tcl turns into a kitchen sink). It's almost impossible
|
||||
to make incompatible changes to Tcl at this point.
|
||||
|
||||
The Tcl community is too large for me to provide much individual
|
||||
support for users. If you need help I suggest that you post questions
|
||||
to comp.lang.tcl. I read the newsgroup and will attempt to answer
|
||||
esoteric questions for which no-one else is likely to know the answer.
|
||||
In addition, Tcl support and training are available commercially from
|
||||
NeoSoft. For more information, send e-mail to "info@neosoft.com".
|
||||
|
||||
9. Tcl release organization
|
||||
---------------------------
|
||||
|
||||
Each Tcl release is identified by two numbers separated by a dot, e.g.
|
||||
6.7 or 7.0. If a new release contains changes that are likely to break
|
||||
existing C code or Tcl scripts then the major release number increments
|
||||
and the minor number resets to zero: 6.0, 7.0, etc. If a new release
|
||||
contains only bug fixes and compatible changes, then the minor number
|
||||
increments without changing the major number, e.g. 7.1, 7.2, etc. If
|
||||
you have C code or Tcl scripts that work with release X.Y, then they
|
||||
should also work with any release X.Z as long as Z > Y.
|
||||
|
||||
Beta releases have an additional suffix of the form bx. For example,
|
||||
Tcl 7.0b1 is the first beta release of Tcl version 7.0, Tcl 7.0b2 is
|
||||
the second beta release, and so on. A beta release is an initial
|
||||
version of a new release, used to fix bugs and bad features before
|
||||
declaring the release stable. Each new release will be preceded by
|
||||
one or more beta releases. I hope that lots of people will try out
|
||||
the beta releases and report problems back to me. I'll make new beta
|
||||
releases to fix the problems, until eventually there is a beta release
|
||||
that appears to be stable. Once this occurs I'll remove the beta
|
||||
suffix so that the last beta release becomes the official release.
|
||||
|
||||
If a new release contains incompatibilities (e.g. 7.0) then I can't
|
||||
promise to maintain compatibility among its beta releases. For example,
|
||||
release 7.0b2 may not be backward compatible with 7.0b1. I'll try
|
||||
to minimize incompatibilities between beta releases, but if a major
|
||||
problem turns up then I'll fix it even if it introduces an
|
||||
incompatibility. Once the official release is made then there won't
|
||||
be any more incompatibilities until the next release with a new major
|
||||
version number.
|
||||
|
||||
10. Compiling on non-UNIX systems
|
||||
--------------------------------
|
||||
|
||||
The Tcl features that depend on system calls peculiar to UNIX (stat,
|
||||
fork, exec, times, etc.) are now separate from the main body of Tcl,
|
||||
which only requires a few generic library procedures such as malloc
|
||||
and strcpy. Thus it should be relatively easy to compile Tcl for
|
||||
non-UNIX machines such as MACs and DOS PC's, although a number of
|
||||
UNIX-specific commands will be absent (e.g. exec, time, and glob).
|
||||
See the comments at the top of Makefile for information on how to
|
||||
compile without the UNIX features.
|
958
tcl7.3/changes
958
tcl7.3/changes
@ -1,958 +0,0 @@
|
||||
Recent user-visible changes to Tcl:
|
||||
|
||||
1. No more [command1] [command2] construct for grouping multiple
|
||||
commands on a single command line.
|
||||
|
||||
2. Semi-colon now available for grouping commands on a line.
|
||||
|
||||
3. For a command to span multiple lines, must now use backslash-return
|
||||
at the end of each line but the last.
|
||||
|
||||
4. "Var" command has been changed to "set".
|
||||
|
||||
5. Double-quotes now available as an argument grouping character.
|
||||
|
||||
6. "Return" may be used at top-level.
|
||||
|
||||
7. More backslash sequences available now. In particular, backslash-newline
|
||||
may be used to join lines in command files.
|
||||
|
||||
8. New or modified built-in commands: case, return, for, glob, info,
|
||||
print, return, set, source, string, uplevel.
|
||||
|
||||
9. After an error, the variable "errorInfo" is filled with a stack
|
||||
trace showing what was being executed when the error occurred.
|
||||
|
||||
10. Command abbreviations are accepted when parsing commands, but
|
||||
are not recommended except for purely-interactive commands.
|
||||
|
||||
11. $, set, and expr all complain now if a non-existent variable is
|
||||
referenced.
|
||||
|
||||
12. History facilities exist now. See Tcl.man and Tcl_RecordAndEval.man.
|
||||
|
||||
13. Changed to distinguish between empty variables and those that don't
|
||||
exist at all. Interfaces to Tcl_GetVar and Tcl_ParseVar have changed
|
||||
(NULL return value is now possible). *** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
14. Changed meaning of "level" argument to "uplevel" command (1 now means
|
||||
"go up one level", not "go to level 1"; "#1" means "go to level 1").
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
15. 3/19/90 Added "info exists" option to see if variable exists.
|
||||
|
||||
16. 3/19/90 Added "noAbbrev" variable to prohibit command abbreviations.
|
||||
|
||||
17. 3/19/90 Added extra errorInfo option to "error" command.
|
||||
|
||||
18. 3/21/90 Double-quotes now only affect space: command, variable,
|
||||
and backslash substitutions still occur inside double-quotes.
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
19. 3/21/90 Added support for \r.
|
||||
|
||||
20. 3/21/90 List, concat, eval, and glob commands all expect at least
|
||||
one argument now. *** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
21. 3/22/90 Added "?:" operators to expressions.
|
||||
|
||||
22. 3/25/90 Fixed bug in Tcl_Result that caused memory to get trashed.
|
||||
|
||||
------------------- Released version 3.1 ---------------------
|
||||
|
||||
23. 3/29/90 Fixed bug that caused "file a.b/c ext" to return ".b/c".
|
||||
|
||||
24. 3/29/90 Semi-colon is not treated specially when enclosed in
|
||||
double-quotes.
|
||||
|
||||
------------------- Released version 3.2 ---------------------
|
||||
|
||||
25. 4/16/90 Rewrote "exec" not to use select or signals anymore.
|
||||
Should be more Sys-V compatible, and no slower in the normal case.
|
||||
|
||||
26. 4/18/90 Rewrote "glob" to eliminate GNU code (there's no GNU code
|
||||
left in Tcl, now), and added Tcl_TildeSubst procedure. Added automatic
|
||||
tilde-substitution in many commands, including "glob".
|
||||
|
||||
------------------- Released version 3.3 ---------------------
|
||||
|
||||
27. 7/11/90 Added "Tcl_AppendResult" procedure.
|
||||
|
||||
28. 7/20/90 "History" with no options now defaults to "history info"
|
||||
rather than to "history redo". Although this is a backward incompatibility,
|
||||
it should only be used interactively and thus shouldn't present any
|
||||
compatibility problems with scripts.
|
||||
|
||||
29. 7/20/90 Added "Tcl_GetInteger", "Tcl_GetDouble", and "Tcl_GetBoolean"
|
||||
procedures.
|
||||
|
||||
30. 7/22/90 Removed "Tcl_WatchInterp" procedure: doesn't seem to be
|
||||
necessary, since the same effect can be achieved with the deletion
|
||||
callbacks on individual commands. *** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
31. 7/23/90 Added variable tracing: Tcl_TraceVar, Tcl_UnTraceVar,
|
||||
and Tcl_VarTraceInfo procedures, "trace" command.
|
||||
|
||||
32. 8/9/90 Mailed out list of all bug fixes since 3.3 release.
|
||||
|
||||
33. 8/29/90 Fixed bugs in Tcl_Merge relating to backslashes and
|
||||
semi-colons. Mailed out patch.
|
||||
|
||||
34. 9/3/90 Fixed bug in tclBasic.c: quotes weren't quoting ]'s.
|
||||
Mailed out patch.
|
||||
|
||||
35. 9/19/90 Rewrote exec to always use files both for input and
|
||||
output to the process. The old pipe-based version didn't work if
|
||||
the exec'ed process forked a child and then exited: Tcl waited
|
||||
around for stdout to get closed, which didn't happen until the
|
||||
grandchild exited.
|
||||
|
||||
36. 11/5/90 ERR_IN_PROGRESS flag wasn't being cleared soon enough
|
||||
in Tcl_Eval, allowing error messages from different commands to
|
||||
pile up in $errorInfo. Fixed by re-arranging code in Tcl_Eval that
|
||||
re-initializes result and ERR_IN_PROGRESS flag. Didn't mail out
|
||||
patch: changes too complicated to describe.
|
||||
|
||||
37. 12/19/90 Added Tcl_VarEval procedure as a convenience for
|
||||
assembling and executing Tcl commands.
|
||||
|
||||
38. 1/29/91 Fixed core leak in Tcl_AddErrorInfo. Also changed procedure
|
||||
and Tcl_Eval so that first call to Tcl_AddErrorInfo need not come from
|
||||
Tcl_Eval.
|
||||
|
||||
----------------- Released version 5.0 with Tk ------------------
|
||||
|
||||
39. 4/3/91 Removed change bars from manual entries, leaving only those
|
||||
that came after version 3.3 was released.
|
||||
|
||||
40. 5/17/91 Changed tests to conform to Mary Ann May-Pumphrey's approach.
|
||||
|
||||
41. 5/23/91 Massive revision to Tcl parser to simplify the implementation
|
||||
of string and floating-point support in expressions. Newlines inside
|
||||
[] are now treated as command separators rather than word separators
|
||||
(this makes newline treatment consistent throughout Tcl).
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
42. 5/23/91 Massive rewrite of expression code to support floating-point
|
||||
values and simple string comparisons. The C interfaces to expression
|
||||
routines have changed (Tcl_Expr is replaced by Tcl_ExprLong, Tcl_ExprDouble,
|
||||
etc.), but all old Tcl expression strings should be accepted by the new
|
||||
expression code.
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
43. 5/23/91 Modified tclHistory.c to check for negative "keep" value.
|
||||
|
||||
44. 5/23/91 Modified Tcl_Backslash to handle backslash-newline. It now
|
||||
returns 0 to indicate that a backslash sequence should be replaced by
|
||||
no character at all.
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
45. 5/29/91 Modified to use ANSI C function prototypes. Must set
|
||||
"USE_ANSI" switch when compiling to get prototypes.
|
||||
|
||||
46. 5/29/91 Completed test suite by providing tests for all of the
|
||||
built-in Tcl commands.
|
||||
|
||||
47. 5/29/91 Changed Tcl_Concat to eliminate leading and trailing
|
||||
white-space in each of the things it concatenates and to ignore
|
||||
elements that are empty or have only white space in them. This
|
||||
produces cleaner output from the "concat" command.
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
48. 5/31/91 Changed "set" command and Tcl_SetVar procedure to return
|
||||
new value of variable.
|
||||
|
||||
49. 6/1/91 Added "while" and "cd" commands.
|
||||
|
||||
50. 6/1/91 Changed "exec" to delete the last character of program
|
||||
output if it is a newline. In most cases this makes it easier to
|
||||
process program-generated output.
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
51. 6/1/91 Made sure that pointers are never used after freeing them.
|
||||
|
||||
52. 6/1/91 Fixed bug in TclWordEnd where it wasn't dealing with
|
||||
[] inside quotes correctly.
|
||||
|
||||
53. 6/8/91 Fixed exec.test to accept return values of either 1 or
|
||||
255 from "false" command.
|
||||
|
||||
54. 7/6/91 Massive overhaul of variable management. Associative
|
||||
arrays now available, along with "unset" command (and Tcl_UnsetVar
|
||||
procedure). Variable traces have been completely reworked:
|
||||
interfaces different both from Tcl and C, and multiple traces may
|
||||
exist on same variable. Can no longer redefine existing local
|
||||
variable to be global. Calling sequences have changed slightly
|
||||
for Tcl_GetVar and Tcl_SetVar ("global" is now "flags"). Tcl_SetVar
|
||||
can fail and return a NULL result. New forms of variable-manipulation
|
||||
procedures: Tcl_GetVar2, Tcl_SetVar2, etc. Syntax of variable
|
||||
$-notation changed to support array indexing.
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
55. 7/6/91 Added new list-manipulation procedures: Tcl_ScanElement,
|
||||
Tcl_ConvertElement, Tcl_AppendElement.
|
||||
|
||||
56. 7/12/91 Created new procedure Tcl_EvalFile, which does most of the
|
||||
work of the "source" command.
|
||||
|
||||
57. 7/20/91 Major reworking of "exec" command to allow pipelines,
|
||||
more redirection, background. Added new procedures Tcl_Fork,
|
||||
Tcl_WaitPids, Tcl_DetachPids, and Tcl_CreatePipeline. The old
|
||||
"< input" notation has been replaced by "<< input" ("<" is for
|
||||
redirection from a file). Also handles error returns and abnormal
|
||||
terminations (e.g. signals) differently.
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
58. 7/21/91 Added "append" and "lappend" commands.
|
||||
|
||||
59. 7/22/91 Reworked error messages and manual entries to use
|
||||
?x? as the notation for an optional argument x, instead of [x]. The
|
||||
bracket notation was often confused with the use of brackets for
|
||||
command substitution. Also modified error messages to be more
|
||||
consistent.
|
||||
|
||||
60. 7/23/91 Tcl_DeleteCommand now returns an indication of whether
|
||||
or not the command actually existed, and the "rename" command uses
|
||||
this information to return an error if an attempt is made to delete
|
||||
a non-existent command.
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
61. 7/25/91 Added new "errorCode" mechanism, along with procedures
|
||||
Tcl_SetErrorCode, Tcl_UnixError, and Tcl_ResetResult. Renamed
|
||||
Tcl_Return to Tcl_SetResult, but left a #define for Tcl_Return to
|
||||
avoid compatibility problems.
|
||||
|
||||
62. 7/26/91 Extended "case" command with alternate syntax where all
|
||||
patterns and commands are together in a single list argument: makes
|
||||
it easier to write multi-line case statements.
|
||||
|
||||
63. 7/27/91 Changed "print" command to perform tilde-substitution on
|
||||
the file name.
|
||||
|
||||
64. 7/27/91 Added "tolower", "toupper", "trim", "trimleft", and "trimright"
|
||||
options to "string" command.
|
||||
|
||||
65. 7/29/91 Added "atime", "mtime", "size", and "stat" options to "file"
|
||||
command.
|
||||
|
||||
66. 8/1/91 Added "split" and "join" commands.
|
||||
|
||||
67. 8/11/91 Added commands for file I/O, including "open", "close",
|
||||
"read", "gets", "puts", "flush", "eof", "seek", and "tell".
|
||||
|
||||
68. 8/14/91 Switched to use a hash table for command lookups. Command
|
||||
abbreviations no longer have direct support in the Tcl interpreter, but
|
||||
it should be possible to simulate them with the auto-load features
|
||||
described below. The "noAbbrev" variable is no longer used by Tcl.
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
68.5 8/15/91 Added support for "unknown" command, which can be used to
|
||||
complete abbreviations, auto-load library files, auto-exec shell
|
||||
commands, etc.
|
||||
|
||||
69. 8/15/91 Added -nocomplain switch to "glob" command.
|
||||
|
||||
70. 8/20/91 Added "info library" option and TCL_LIBRARY #define. Also
|
||||
added "info script" option.
|
||||
|
||||
71. 8/20/91 Changed "file" command to take "option" argument as first
|
||||
argument (before file name), for consistency with other Tcl commands.
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
72. 8/20/91 Changed format of information in $errorInfo variable:
|
||||
comments such as
|
||||
("while" body line 1)
|
||||
are now on separate lines from commands being executed.
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
73. 8/20/91 Changed Tcl_AppendResult so that it (eventually) frees
|
||||
large buffers that it allocates.
|
||||
|
||||
74. 8/21/91 Added "linsert", "lreplace", "lsearch", and "lsort"
|
||||
commands.
|
||||
|
||||
75. 8/28/91 Added "incr" and "exit" commands.
|
||||
|
||||
76. 8/30/91 Added "regexp" and "regsub" commands.
|
||||
|
||||
77. 9/4/91 Changed "dynamic" field in interpreters to "freeProc" (procedure
|
||||
address). This allows for alternative storage managers.
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
78. 9/6/91 Added "index", "length", and "range" options to "string"
|
||||
command. Added "lindex", "llength", and "lrange" commands.
|
||||
|
||||
79. 9/8/91 Removed "index", "length", "print" and "range" commands.
|
||||
"Print" is redundant with "puts", but less general, and the other
|
||||
commands are replaced with the new commands described in change 78
|
||||
above.
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
80. 9/8/91 Changed history revision to occur even when history command
|
||||
is nested; needed in order to allow "history" to be invoked from
|
||||
"unknown" procedure.
|
||||
|
||||
81. 9/13/91 Changed "panic" not to use vfprintf (it's uglier and less
|
||||
general now, but makes it easier to run Tcl on systems that don't
|
||||
have vfprintf). Also changed "strerror" not to redeclare sys_errlist.
|
||||
|
||||
82. 9/19/91 Lots of changes to improve portability to different UNIX
|
||||
systems, including addition of "config" script to adapt Tcl to the
|
||||
configuration of the system it's being compiled on.
|
||||
|
||||
83. 9/22/91 Added "pwd" command.
|
||||
|
||||
84. 9/22/91 Renamed manual pages so that their filenames are no more
|
||||
than 14 characters in length, moved to "doc" subdirectory.
|
||||
|
||||
85. 9/24/91 Redid manual entries so they contain the supplemental
|
||||
macros that they need; can just print with "troff -man" or "man"
|
||||
now.
|
||||
|
||||
86. 9/26/91 Created initial version of script library, including
|
||||
a version of "unknown" that does auto-loading, auto-execution, and
|
||||
abbreviation expansion. This library is used by tclTest
|
||||
automatically. See the "library" manual entry for details.
|
||||
|
||||
----------------- Released version 6.0, 9/26/91 ------------------
|
||||
|
||||
87. 9/30/91 Made "string tolower" and "string toupper" check case
|
||||
before converting: on some systems, "tolower" and "toupper" assume
|
||||
that character already has particular case.
|
||||
|
||||
88. 9/30/91 Fixed bug in Tcl_SetResult: wasn't always setting freeProc
|
||||
correctly when called with NULL value. This tended to cause memory
|
||||
allocation errors later.
|
||||
|
||||
89. 10/3/91 Added "upvar" command.
|
||||
|
||||
90. 10/4/91 Changed "format" so that internally it converts %D to %ld,
|
||||
%U to %lu, %O to %lo, and %F to %f. This eliminates some compatibility
|
||||
problems on some machines without affecting behavior.
|
||||
|
||||
91. 10/10/91 Fixed bug in "regsub" that caused core dumps with the -all
|
||||
option when the last match wasn't at the end of the string.
|
||||
|
||||
92. 10/17/91 Fixed problems with backslash sequences: \r support was
|
||||
incomplete and \f and \v weren't supported at all.
|
||||
|
||||
93. 10/24/91 Added Tcl_InitHistory procedure.
|
||||
|
||||
94. 10/24/91 Changed "regexp" to store "-1 -1" in subMatchVars that
|
||||
don't match, rather than returning an error.
|
||||
|
||||
95. 10/27/91 Modified "regexp" to return actual strings in matchVar
|
||||
and subMatchVars instead of indices. Added "-indices" switch to cause
|
||||
indices to be returned.
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
96. 10/27/91 Fixed bug in "scan" where it used hardwired constants for
|
||||
sizes of floats and doubles instead of using "sizeof".
|
||||
|
||||
97. 10/31/91 Fixed bug in tclParse.c where parse-related error messages
|
||||
weren't being storage-managed correctly, causing spurious free's.
|
||||
|
||||
98. 10/31/91 Form feed and vertical tab characters are now considered
|
||||
to be space characters by the parser.
|
||||
|
||||
99. 10/31/91 Added TCL_LEAVE_ERR_MSG flag to procedures like Tcl_SetVar.
|
||||
|
||||
100. 11/7/91 Fixed bug in "case" where "in" argument couldn't be omitted
|
||||
if all case branches were embedded in a single list.
|
||||
|
||||
101. 11/7/91 Switched to use "pid_t" and "uid_t" and other official
|
||||
POSIC types and function prototypes.
|
||||
|
||||
----------------- Released version 6.1, 11/7/91 ------------------
|
||||
|
||||
102. 12/2/91 Modified Tcl_ScanElement and Tcl_ConvertElement in several
|
||||
ways. First, allowed caller to request that only backslashes be used
|
||||
(no braces). Second, made Tcl_ConvertElement more aggressive in using
|
||||
backslashes for braces and quotes.
|
||||
|
||||
103. 12/5/91 Added "type", "lstat", and "readlink" options to "file"
|
||||
command, plus added new "type" element to output of "stat" and "lstat"
|
||||
options.
|
||||
|
||||
104. 12/10/91 Manual entries had first lines that caused "man" program
|
||||
to try weird preprocessor. Added blank comment lines to fix problem.
|
||||
|
||||
105. 12/16/91 Fixed a few bugs in auto_mkindex proc: wasn't handling
|
||||
errors properly, and hadn't been upgraded for new "regexp" syntax.
|
||||
|
||||
106. 1/2/92 Fixed bug in "file" command where it didn't properly handle
|
||||
a file names containing tildes where the indicated user doesn't exist.
|
||||
|
||||
107. 1/2/92 Fixed lots of cases in tclUnixStr.c where two different
|
||||
errno symbols (e.g. EWOULDBLOCK and EAGAIN) have the same number; Tcl
|
||||
will only use one of them.
|
||||
|
||||
108. 1/2/92 Lots of changes to configuration script to handle many more
|
||||
systems more gracefully. E.g. should now detect the bogus strtoul that
|
||||
comes with AIX and substitute Tcl's own version instead.
|
||||
|
||||
----------------- Released version 6.2, 1/10/92 ------------------
|
||||
|
||||
109. 1/20/92 Config didn't have code to actually use "uid_t" variable
|
||||
to set TCL_UIT_T #define.
|
||||
|
||||
110. 2/10/92 Tcl_Eval didn't properly reset "numLevels" variable when
|
||||
too-deep recursion occurred.
|
||||
|
||||
111. 2/29/92 Added "on" and "off" to keywords accepted by Tcl_GetBoolean.
|
||||
|
||||
112. 3/19/92 Config wasn't installing default version of strtod.c for
|
||||
systems that don't have one in libc.a.
|
||||
|
||||
113. 3/23/92 Fixed bug in tclExpr.c where numbers with leading "."s,
|
||||
like 0.75, couldn't be properly substituted into expressions with
|
||||
variable or command substitution.
|
||||
|
||||
114. 3/25/92 Fixed bug in tclUnixAZ.c where "gets" command wasn't
|
||||
checking to make sure that it was able to write the variable OK.
|
||||
|
||||
115. 4/16/92 Fixed bug in tclUnixAZ.c where "read" command didn't
|
||||
compute file size right for device files.
|
||||
|
||||
116. 4/23/92 Fixed but in tclCmdMZ.c where "trace vinfo" was overwriting
|
||||
the trace command.
|
||||
|
||||
----------------- Released version 6.3, 5/1/92 ------------------
|
||||
|
||||
117. 5/1/92 Added Tcl_GlobalEval.
|
||||
|
||||
118. 6/1/92 Changed auto-load facility to source files at global level.
|
||||
|
||||
119. 6/8/92 Tcl_ParseVar wasn't always setting termPtr after errors, which
|
||||
sometimes caused core dumps.
|
||||
|
||||
120. 6/21/92 Fixed bug in initialization of regexp pattern cache. This
|
||||
bug caused segmentation violations in regexp commands under some conditions.
|
||||
|
||||
121. 6/22/92 Changed implementation of "glob" command to eliminate
|
||||
trailing slashes on directory names: they confuse some systems. There
|
||||
shouldn't be any user-visible changes in functionality except for names
|
||||
in error messages not having trailing slashes.
|
||||
|
||||
122. 7/2/92 Fixed bug that caused 'string match ** ""' to return 0.
|
||||
|
||||
123. 7/2/92 Fixed bug in Tcl_CreateCmdBuf where it wasn't initializing
|
||||
the buffer to an empty string.
|
||||
|
||||
124. 7/6/92 Fixed bug in "case" command where it used NULL pattern string
|
||||
after errors in the "default" clause.
|
||||
|
||||
125. 7/25/92 Speeded up auto_load procedure: don't reread all the index
|
||||
files unless the path has changed.
|
||||
|
||||
126. 8/3/92 Changed tclUnix.h to define MAXPATHLEN from PATH_MAX, not
|
||||
_POSIX_PATH_MAX.
|
||||
|
||||
----------------- Released version 6.4, 8/7/92 ------------------
|
||||
|
||||
127. 8/10/92 Changed tclBasic.c so that comment lines can be continued by
|
||||
putting a backslash before the newline.
|
||||
|
||||
128. 8/21/92 Modified "unknown" to allow the source-ing of a file for
|
||||
an auto-load to trigger other nested auto-loads, as long as there isn't
|
||||
any recursion on the same command name.
|
||||
|
||||
129. 8/25/92 Modified "format" command to allow " " and "+" flags, and
|
||||
allow flags in any order.
|
||||
|
||||
130. 9/14/92 Modified Tcl_ParseVar so that it doesn't actually attempt
|
||||
to look up the variable if "noEval" mode is in effect in the interpreter
|
||||
(it just parses the name). This avoids the errors that used to occur
|
||||
in statements like "expr {[info exists foo] && $foo}".
|
||||
|
||||
131. 9/14/92 Fixed bug in "uplevel" command where it didn't output the
|
||||
correct error message if a level was specified but no command.
|
||||
|
||||
132. 9/14/92 Renamed manual entries to have extensions like .3 and .n,
|
||||
and added "install" target to Makefile.
|
||||
|
||||
133. 9/18/92 Modified "unknown" command to emulate !!, !<num>, and
|
||||
^<old>^<new> csh history substitutions.
|
||||
|
||||
134. 9/21/92 Made the config script cleverer about figuring out which
|
||||
switches to pass to "nm".
|
||||
|
||||
135. 9/23/92 Fixed tclVar.c to be sure to copy flags when growing variables.
|
||||
Used to forget about traces in progress and make extra recursive calls
|
||||
on trace procs.
|
||||
|
||||
136. 9/28/92 Fixed bug in auto_reset where it was unsetting variables
|
||||
that might not exist.
|
||||
|
||||
137. 10/7/92 Changed "parray" library procedure to print any array
|
||||
accessible to caller, local or global.
|
||||
|
||||
138. 10/15/92 Fixed bug where propagation of new environment variable
|
||||
values among interpreters took N! time if there exist N interpreters.
|
||||
|
||||
139. 10/16/92 Changed auto_reset procedure so that it also deletes any
|
||||
existing procedures that are in the auto_load index (the assumption is
|
||||
that they should be re-loaded to get the latest versions).
|
||||
|
||||
140. 10/21/92 Fixed bug that caused lists to be incorrectly generated
|
||||
for elements that contained backslash-newline sequences.
|
||||
|
||||
141. 12/9/92 Added support for TCL_LIBRARY environment variable: use
|
||||
it as library location if it's present.
|
||||
|
||||
142. 12/9/92 Added "info complete" command, Tcl_CommandComplete procedure.
|
||||
|
||||
143. 12/16/92 Changed the Makefile to check to make sure "config" has been
|
||||
run (can't run config directly from the Makefile because it modifies the
|
||||
Makefile; thus make has to be run again after running config).
|
||||
|
||||
----------------- Released version 6.5, 12/17/92 ------------------
|
||||
|
||||
144. 12/21/92 Changed config to look in several places for libc file.
|
||||
|
||||
145. 12/23/92 Added "elseif" support to if. Also, "then", "else", and
|
||||
"elseif" may no longer be abbreviated.
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
146. 12/28/92 Changed "puts" and "read" to support initial "-nonewline"
|
||||
switch instead of additional "nonewline" argument. The old form is
|
||||
still supported, but it is discouraged and is no longer documented.
|
||||
Also changed "puts" to make the file argument default to stdout: e.g.
|
||||
"puts foo" will print foo on standard output.
|
||||
|
||||
147. 1/6/93 Fixed bug whereby backslash-newline wasn't working when
|
||||
typed interactively, or in "info complete".
|
||||
|
||||
148. 1/22/93 Fixed bugs in "lreplace" and "linsert" where close
|
||||
quotes were being lost from last element before replacement or
|
||||
insertion.
|
||||
|
||||
149. 1/29/93 Fixed bug in Tcl_AssembleCmd where it wasn't requiring
|
||||
a newline at the end of a line before considering a command to be
|
||||
complete. The bug caused some very long lines in script files to
|
||||
be processed as multiple separate commands.
|
||||
|
||||
150. 1/29/93 Various changes in Makefile to add more configuration
|
||||
options, simplify installation, fix bugs (e.g. don't use -f switch
|
||||
for cp), etc.
|
||||
|
||||
151. 1/29/93 Changed "name1" and "name2" identifiers to "part1" and
|
||||
"part2" to avoid name conflicts with stupid C++ implementations that
|
||||
use "name1" and "name2" in a reserved way.
|
||||
|
||||
152. 2/1/93 Added "putenv" procedure to replace the standard system
|
||||
version so that it will work correctly with Tcl's environment handling.
|
||||
|
||||
----------------- Released version 6.6, 2/5/93 ------------------
|
||||
|
||||
153. 2/10/93 Fixed bugs in config script: missing "endif" in libc loop,
|
||||
and tried to use strncasecmp.c instead of strcasecmp.c.
|
||||
|
||||
154. 2/10/93 Makefile improvements: added RANLIB variable for easier
|
||||
Sys-V configuration, added SHELL variable for SGI systems.
|
||||
|
||||
----------------- Released version 6.7, 2/11/93 ------------------
|
||||
|
||||
153. 2/6/93 Changes in backslash processing:
|
||||
- \Cx, \Mx, \CMx, \e sequences no longer special
|
||||
- \<newline> also eats up any space after the newline, replacing
|
||||
the whole sequence with a single space character
|
||||
- Hex sequences like \x24 are now supported, along with ANSI C's \a.
|
||||
- "format" no longer does backslash processing on its format string
|
||||
- there is no longer any special meaning to a 0 return value from
|
||||
Tcl_Backslash
|
||||
- unknown backslash sequences, like (e.g. \*), are replaced with
|
||||
the following character (e.g. *), instead of just treating the
|
||||
backslash as an ordinary character.
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
154. 2/6/93 Updated all copyright notices. The meaning hasn't changed
|
||||
at all but the wording does a better job of protecting U.C. from
|
||||
liability (according to U.C. lawyers, anyway).
|
||||
|
||||
155. 2/6/93 Changed "regsub" so that it overwrites the result variable
|
||||
in all cases, even if there is no match.
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
156. 2/8/93 Added support for XPG3 %n$ conversion specifiers to "format"
|
||||
command.
|
||||
|
||||
157. 2/17/93 Fixed bug in Tcl_Eval where errors due to infinite
|
||||
recursion could result in core dumps.
|
||||
|
||||
158. 2/17/93 Improved the auto-load mechanism to deal gracefully (i.e.
|
||||
return an error) with a situation where a library file that supposedly
|
||||
defines a procedure doesn't actually define it.
|
||||
|
||||
159. 2/17/93 Renamed Tcl_UnixError procedure to Tcl_PosixError, and
|
||||
changed errorCode variable usage to use POSIX as keyword instead of
|
||||
UNIX.
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
160. 2/19/93 Changes to exec and process control:
|
||||
- Added support for >>, >&, >>&, |&, <@, >@, and >&@ forms of redirection.
|
||||
- When exec puts processes into background, it returns a list of
|
||||
their pids as result.
|
||||
- Added support for <file, >file, etc. (i.e. no space between
|
||||
">" and file name.
|
||||
- Added -keepnewline option.
|
||||
- Deleted Tcl_Fork and Tcl_WaitPids procedures (just use fork and
|
||||
waitpid instead).
|
||||
- Added waitpid compatibility procedure for systems that don't have
|
||||
it.
|
||||
- Added Tcl_ReapDetachedProcs procedure.
|
||||
- Changed "exec" to return an error if there is stderr output, even
|
||||
if the command returns a 0 exit status (it's always been documented
|
||||
this way, but the implementation wasn't correct).
|
||||
- If a process returns a non-zero exit status but doesn't generate
|
||||
any diagnostic output, then Tcl generates an error message for it.
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
161. 2/25/93 Fixed two memory-management problems having to do with
|
||||
managing the old result during variable trace callbacks.
|
||||
|
||||
162. 3/1/93 Added dynamic string library: Tcl_DStringInit, Tcl_DStringAppend,
|
||||
Tcl_DStringFree, Tcl_DStringResult, etc.
|
||||
|
||||
163. 3/1/93 Modified glob command to only return the names of files that
|
||||
exist, and to only return names ending in "/" if the file is a directory.
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
164. 3/19/93 Modified not to use system calls like "read" directly,
|
||||
but instead to use special Tcl procedures that retry automatically
|
||||
if interrupted by signals.
|
||||
|
||||
165. 4/3/93 Eliminated "noSep" argument to Tcl_AppendElement, plus
|
||||
TCL_NO_SPACE flag for Tcl_SetVar and Tcl_SetVar2.
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
166. 4/3/93 Eliminated "flags" and "termPtr" arguments to Tcl_Eval.
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
167. 4/3/93 Changes to expressions:
|
||||
- The "expr" command now accepts multiple arguments, which are
|
||||
concatenated together with space separators.
|
||||
- Integers aren't automatically promoted to floating-point if they
|
||||
overflow the word size: errors are generated instead.
|
||||
- Tcl can now handle "NaN" and other special values if the underlying
|
||||
library procedures handle them.
|
||||
- When printing floating-point numbers, Tcl ensures that there is a "."
|
||||
or "e" in the number, so it can't be treated as an integer accidentally.
|
||||
The procedure Tcl_PrintDouble is available to provide this function
|
||||
in other contexts. Also, the variable "tcl_precision" can be used
|
||||
to set the precision for printing (must be a decimal number giving
|
||||
digits of precision).
|
||||
- Expressions now support transcendental and other functions, e.g. sin,
|
||||
acos, hypot, ceil, and round. Can add new math functions with
|
||||
Tcl_CreateMathFunc().
|
||||
- Boolean expressions can now have any of the string values accepted
|
||||
by Tcl_GetBoolean, such as "yes" or "no".
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
168. 4/5/93 Changed Tcl_UnsetVar and Tcl_UnsetVar2 to return TCL_OK
|
||||
or TCL_ERROR instead of 0 or -1.
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
169. 4/5/93 Eliminated Tcl_CmdBuf structure and associated procedures;
|
||||
can use Tcl_DStrings instead.
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
170. 4/8/93 Changed interface to Tcl_TildeSubst to use a dynamic
|
||||
string for buffer space. This makes the procedure re-entrant and
|
||||
thread-safe, whereas it wasn't before.
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
171. 4/14/93 Eliminated tclHash.h, and moved everything from it to
|
||||
tcl.h
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
172. 4/15/93 Eliminated Tcl_InitHistory, made "history" command always
|
||||
be part of interpreter.
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
173. 4/16/93 Modified "file" command so that "readable" option always
|
||||
exists, even on machines that don't support symbolic links (always returns
|
||||
same error as if the file wasn't a symbolic link).
|
||||
|
||||
174. 4/26/93 Fixed bugs in "regsub" where ^ patterns didn't get handled
|
||||
right (pretended not to match when it really did, and looped infinitely
|
||||
if -all was specified).
|
||||
|
||||
175. 4/29/93 Various improvements in the handling of variables:
|
||||
- Can create variables and array elements during a read trace.
|
||||
- Can delete variables during traces (note: unset traces will be
|
||||
invoked when this happens).
|
||||
- Can upvar to array elements.
|
||||
- Can retarget an upvar to another variable by re-issuing the
|
||||
upvar command with a different "other" variable.
|
||||
|
||||
176. 5/3/93 Added Tcl_GetCommandInfo, which returns info about a Tcl
|
||||
command such as whether it exists and its ClientData. Also added
|
||||
Tcl_SetCommandInfo, which allows any of this information to be modified
|
||||
and also allows a command's delete procedure to have a different
|
||||
ClientData value than its command procedure.
|
||||
|
||||
177. 5/5/93 Added Tcl_RegExpMatch procedure.
|
||||
|
||||
178. 5/6/93 Fixed bug in "scan" where it didn't properly handle
|
||||
%% conversion specifiers. Also changed "scan" to use Tcl_PrintDouble
|
||||
for printing real values.
|
||||
|
||||
179. 5/7/93 Added "-exact", "-glob", and "-regexp" options to "lsearch"
|
||||
command to allow different kinds of pattern matching.
|
||||
|
||||
180. 5/7/93 Added many new switches to "lsort" to control the sorting
|
||||
process: "-ascii", "-integer", "-real", "-command", "-increasing",
|
||||
and "-decreasing".
|
||||
|
||||
181. 5/10/93 Changes to file I/O:
|
||||
- Modified "open" command to support a list of POSIX access flags
|
||||
like {WRONLY CREAT TRUNC} in addition to current fopen-style
|
||||
access modes. Also added "permissions" argument to set permissions
|
||||
of newly-created files.
|
||||
- Fixed Scott Bolte's bug (can close stdin etc. in application and
|
||||
then re-open them with Tcl commands).
|
||||
- Exported access to Tcl's file table with new procedures Tcl_EnterFile
|
||||
and Tcl_GetOpenFile.
|
||||
|
||||
182. 5/15/93 Added new "pid" command, which can be used to retrieve
|
||||
either the current process id or a list of the process ids in a
|
||||
pipeline opened with "open |..."
|
||||
|
||||
183. 6/3/93 Changed to use GNU autoconfig for configuration instead of
|
||||
the home-brew "config" script. Also made many other configuration-related
|
||||
changes, such as using <unistd.h> instead of explicitly declaring system
|
||||
calls in tclUnix.h.
|
||||
|
||||
184. 6/4/93 Fixed bug where core-dumps could occur if a procedure
|
||||
redefined itself (the memory for the procedure's body could get
|
||||
reallocated in the middle of evaluating the body); implemented
|
||||
simple reference count mechanism.
|
||||
|
||||
185. 6/5/93 Changed tclIndex file format in two ways: (a) it's now
|
||||
eval-ed instead of parsed, which makes it 3-4x faster; (b) the entries
|
||||
in auto_index are now commands to evaluate, which allows commands to
|
||||
be loaded in different ways such as dynamic-loading of C code. The
|
||||
old tclIndex file format is still supported.
|
||||
|
||||
186. 6/7/93 Eliminated tclTest program, added new "tclsh" program
|
||||
that is more like wish (allows script files to be invoked automatically
|
||||
using "#!/usr/local/bin/tclsh", makes arguments available to script,
|
||||
etc.). Added support for Tcl_AppInit plus default version; this
|
||||
allows new Tcl applications to be created without modifying the
|
||||
main program for tclsh.
|
||||
|
||||
187. 6/7/93 Fixed bug in TclWordEnd that kept backslash-newline from
|
||||
working correctly in some cases during interactive input.
|
||||
|
||||
188. 6/9/93 Added Tcl_LinkVar and related procedures, which automatically
|
||||
keep a Tcl variable in sync with a C variable.
|
||||
|
||||
189. 6/16/93 Increased maximum nesting depth from 100 to 1000.
|
||||
|
||||
190. 6/16/93 Modified "trace var" command so that error messages from
|
||||
within traces are returned properly as the result of the variable
|
||||
access, instead of the generic "access disallowed by trace command"
|
||||
message.
|
||||
|
||||
191. 6/16/93 Added Tcl_CallWhenDeleted to provide callbacks when an
|
||||
interpreter is deleted (same functionality as Tcl_WatchInterp, which
|
||||
used to exist in versions before 6.0).
|
||||
|
||||
193. 6/16/93 Added "-code" argument to "return" command; it's there
|
||||
primarily for completeness, so that procedures implementing control
|
||||
constructs can reflect exceptional conditions back to their callers.
|
||||
|
||||
194. 6/16/93 Split up Tcl.n to make separate manual entries for each
|
||||
Tcl command. Tcl.n now contains a summary of the language syntax.
|
||||
|
||||
195. 6/17/93 Added new "switch" command to replace "case": allows
|
||||
alternate forms of pattern matching (exact, glob, regexp), replaces
|
||||
pattern lists with single patterns (but you can use "-" bodies to
|
||||
share one body among several patterns), eliminates "in" noise word.
|
||||
"Case" command is now obsolete.
|
||||
|
||||
196. 6/17/93 Changed the "exec", "glob", "regexp", and "regsub" commands
|
||||
to include a "--" switch. All initial arguments starting with "-" are now
|
||||
treated as switches unless a "--" switch is present to end the list.
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
197. 6/17/93 Changed auto-exec so that the subprocess gets stdin, stdout,
|
||||
and stderr from the parent. This allows truly interactive sub-processes
|
||||
(e.g. vi) to be auto-exec'ed from a tcl shell command line.
|
||||
|
||||
198. 6/18/93 Added patchlevel.h, for use in coordinating future patch
|
||||
releases, and also added "info patchlevel" command to make the patch
|
||||
level available to Tcl scripts.
|
||||
|
||||
199. 6/19/93 Modified "glob" command so that a leading "//" in a name
|
||||
gets left as is (this is needed for systems like Apollos where "//" is
|
||||
the super-root; Tcl used to collapse the two slashes into a single
|
||||
slash).
|
||||
|
||||
200. 7/7/93 Added Tcl_SetRecursionLimit procedure so that the maximum
|
||||
allowable nesting depth can be controlled for an interpreter from C.
|
||||
|
||||
----------------- Released version 7.0 Beta 1, 7/9/93 ------------------
|
||||
|
||||
201. 7/12/93 Modified Tcl_GetInt and tclExpr.c so that full-precision
|
||||
unsigned integers can be specified without overflow errors.
|
||||
|
||||
202. 7/12/93 Configuration changes: eliminate leading blank line in
|
||||
configure script; provide separate targets in Makefile for installing
|
||||
binary and non-binary information; check for size_t and a few other
|
||||
potentially missing typedefs; don't put tclAppInit.o into libtcl.a;
|
||||
better checks for matherr support.
|
||||
|
||||
203. 7/14/93 Changed tclExpr.c to check the termination pointer before
|
||||
errno after strtod calls, to avoid problems with some versions of
|
||||
strtod that set errno in unexpected ways.
|
||||
|
||||
204. 7/16/93 Changed "scan" command to be more ANSI-conformant:
|
||||
eliminated %F, %D, etc., added code to ignore "l", "h", and "L"
|
||||
modifiers but always convert %e, %f, and %g with implicit "l";
|
||||
also added support for %u and %i. Also changed "format" command
|
||||
to eliminate %D, %U, %O, and add %i.
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
205. 7/17/93 Changed "uplevel" and "upvar" so that they can be used
|
||||
from global level to global level: this used to generate an error.
|
||||
|
||||
206. 7/19/93 Renamed "setenv", "putenv", and "unsetenv" procedures
|
||||
to avoid conflicts with system procedures with the same names. If
|
||||
you want Tcl's procedures to override the system procedures, do it
|
||||
in the Makefile (instructions are in the Makefile).
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
----------------- Released version 7.0 Beta 2, 7/21/93 ------------------
|
||||
|
||||
207. 7/21/93 Fixed bug in tclVar.c where freed memory was accidentally
|
||||
used if a procedure returned an element of a local array.
|
||||
|
||||
208. 7/22/93 Fixed bug in "unknown" where it didn't properly handle
|
||||
errors occurring in the "auto_load" procedure, leaving its state
|
||||
inconsistent.
|
||||
|
||||
209. 7/23/93 Changed exec's ">2" redirection operator to "2>" for
|
||||
consistency with sh. This is incompatible with earlier beta releases
|
||||
of 7.0 but not with pre-7.0 releases, which didn't support either
|
||||
operator.
|
||||
|
||||
210. 7/28/93 Changed backslash-newline handling so that the resulting
|
||||
space character *is* treated as a word separator unless the backslash
|
||||
sequence is in quotes or braces. This is incompatible with 7.0b1
|
||||
and 7.0b2 but is more compatible with pre-7.0 versions that the b1
|
||||
and b2 releases were.
|
||||
|
||||
211. 7/28/93 Eliminated Tcl_LinkedVarWritable, added TCL_LINK_READ_ONLY to
|
||||
Tcl_LinkVar to accomplish same purpose. This change is incompatible
|
||||
with earlier beta releases, but not with releases before Tcl 7.0.
|
||||
|
||||
212. 7/29/93 Renamed regexp C functions so they won't clash with POSIX
|
||||
regexp functions that use the same name.
|
||||
|
||||
213. 8/3/93 Added "-errorinfo" and "-errorcode" options to "return"
|
||||
command: these allow for much better handling of the errorInfo
|
||||
and errorCode variables in some cases.
|
||||
|
||||
214. 8/12/93 Changed "expr" so that % always returns a remainder with
|
||||
the same sign as the divisor and absolute value smaller than the
|
||||
divisor.
|
||||
|
||||
215. 8/14/93 Turned off auto-exec in "unknown" unless the command
|
||||
was typed interactively. This means you must use "exec" when
|
||||
invoking subprocesses, unless it's a command that's typed interactively.
|
||||
*** POTENTIAL INCOMPATIBILITY ***
|
||||
|
||||
216. 8/14/93 Added support for tcl_prompt1 and tcl_prompt2 variables
|
||||
to tclMain.c: makes prompts user-settable.
|
||||
|
||||
217. 8/14/93 Added asynchronous handlers (Tcl_AsyncCreate etc.) so
|
||||
that signals can be taken cleanly by Tcl applications.
|
||||
|
||||
218. 8/16/93 Moved information about open files from the interpreter
|
||||
structure to global variables so that a file can be opened in one
|
||||
interpreter and read or written in another.
|
||||
|
||||
219. 8/16/93 Removed ENV_FLAGS from Makefile, so that there's no
|
||||
official support for overriding setenv, unsetenv, and putenv.
|
||||
|
||||
220. 8/20/93 Various configuration improvements: coerce chars
|
||||
to unsigned chars before using macros like isspace; source ~/.tclshrc
|
||||
file during initialization if it exists and program is running
|
||||
interactively; allow there to be directories in auto_path that don't
|
||||
exist or don't have tclIndex files (ignore them); added Tcl_Init
|
||||
procedure and changed Tcl_AppInit to call it.
|
||||
|
||||
221. 8/21/93 Fixed bug in expr where "+", "-", and " " were all
|
||||
getting treated as integers with value 0.
|
||||
|
||||
222. 8/26/93 Added "tcl_interactive" variable to tclsh.
|
||||
|
||||
223. 8/27/93 Added procedure Tcl_FilePermissions to return whether a
|
||||
given file can be read or written or both. Modified Tcl_EnterFile
|
||||
to take a permissions mask rather than separate read and write arguments.
|
||||
|
||||
224. 8/28/93 Fixed performance bug in "glob" command (unnecessary call
|
||||
to "access" for each file caused a 5-10x slow-down for big directories).
|
||||
|
||||
----------------- Released version 7.0 Beta 3, 8/28/93 ------------------
|
||||
|
||||
225. 9/9/93 Renamed regexp.h to tclRegexp.h to avoid conflicts with system
|
||||
include file by same name.
|
||||
|
||||
226. 9/9/93 Added Tcl_DontCallWhenDeleted.
|
||||
|
||||
227. 9/16/93 Changed not to call exit C procedure directly; instead
|
||||
always invoke "exit" Tcl command so that application can redefine the
|
||||
command to do additional cleanup.
|
||||
|
||||
228. 9/17/93 Changed auto-exec to handle names that contain slashes
|
||||
(i.e. don't use PATH for them).
|
||||
|
||||
229. 9/23/93 Fixed bug in "read" and "gets" commands where they didn't
|
||||
clear EOF conditions.
|
||||
|
||||
----------------- Released version 7.0, 9/29/93 ------------------
|
||||
|
||||
230. 10/7/93 "Scan" command wasn't properly aligning things in memory,
|
||||
so segmentation faults could arise under some circumstances.
|
||||
|
||||
231. 10/7/93 Fixed bug in Tcl_ConvertElement where it forgot to
|
||||
backslash leading curly brace when creating lists.
|
||||
|
||||
232. 10/7/93 Eliminated dependency of tclMain.c on tclInt.h and
|
||||
tclUnix.h, so that people can copy the file out of the Tcl source
|
||||
directory to make modified private versions.
|
||||
|
||||
233. 10/8/93 Fixed bug in auto-loader that reversed the priority order
|
||||
of entries in auto_path for new-style index files. Now things are
|
||||
back to the way they were before 3.0: first in auto_path is always
|
||||
highest priority.
|
||||
|
||||
234. 10/13/93 Fixed bug where Tcl_CommandComplete didn't recognize
|
||||
comments and treat them as such. Thus if you typed the line
|
||||
# {
|
||||
interactively, Tcl would think that the command wasn't complete and
|
||||
wait for more input before evaluating the script.
|
||||
|
||||
235. 10/14/93 Fixed bug where "regsub" didn't set the output variable
|
||||
if the input string was empty.
|
||||
|
||||
236. 10/23/93 Fixed bug where Tcl_CreatePipeline didn't close off enough
|
||||
file descriptors in child processes, causing children not to exit
|
||||
properly in some cases.
|
||||
|
||||
237. 10/28/93 Changed "list" and "concat" commands not to generate
|
||||
errors if given zero arguments, but instead to just return an empty
|
||||
string.
|
||||
|
||||
----------------- Released version 7.1, 11/4/93 ------------------
|
||||
|
||||
Note: there is no 7.2 release. It was flawed and was thus withdrawn
|
||||
shortly after it was released.
|
||||
|
||||
238. 11/10/93 TclMain.c didn't compile on some systems because of
|
||||
R_OK in call to "access". Changed to eliminate call to "access".
|
||||
|
||||
----------------- Released version 7.3, 11/26/93 ------------------
|
@ -1,37 +0,0 @@
|
||||
/*
|
||||
* dirent.h --
|
||||
*
|
||||
* This file is a replacement for <dirent.h> in systems that
|
||||
* support the old BSD-style <sys/dir.h> with a "struct direct".
|
||||
*
|
||||
* Copyright (c) 1991 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, without written agreement and without
|
||||
* license or royalty fees, to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose, provided that the
|
||||
* above copyright notice and the following two paragraphs appear in
|
||||
* all copies of this software.
|
||||
*
|
||||
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
||||
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
|
||||
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
*
|
||||
* $Header: /user6/ouster/tcl/compat/RCS/dirent.h,v 1.2 93/03/19 15:25:03 ouster Exp $ SPRITE (Berkeley)
|
||||
*/
|
||||
|
||||
#ifndef _DIRENT
|
||||
#define _DIRENT
|
||||
|
||||
#include <sys/dir.h>
|
||||
|
||||
#define dirent direct
|
||||
|
||||
#endif /* _DIRENT */
|
@ -1,30 +0,0 @@
|
||||
/*
|
||||
* float.h --
|
||||
*
|
||||
* This is a dummy header file to #include in Tcl when there
|
||||
* is no float.h in /usr/include. Right now this file is empty:
|
||||
* Tcl contains #ifdefs to deal with the lack of definitions;
|
||||
* all it needs is for the #include statement to work.
|
||||
*
|
||||
* Copyright (c) 1993 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, without written agreement and without
|
||||
* license or royalty fees, to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose, provided that the
|
||||
* above copyright notice and the following two paragraphs appear in
|
||||
* all copies of this software.
|
||||
*
|
||||
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
||||
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
|
||||
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
*
|
||||
* $Header: /user6/ouster/tcl/compat/RCS/float.h,v 1.1 93/04/15 16:10:39 ouster Exp $ SPRITE (Berkeley)
|
||||
*/
|
@ -1,63 +0,0 @@
|
||||
/*
|
||||
* getcwd.c --
|
||||
*
|
||||
* This file provides an implementation of the getcwd procedure
|
||||
* that uses getwd, for systems with getwd but without getcwd.
|
||||
*
|
||||
* Copyright (c) 1993 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, without written agreement and without
|
||||
* license or royalty fees, to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose, provided that the
|
||||
* above copyright notice and the following two paragraphs appear in
|
||||
* all copies of this software.
|
||||
*
|
||||
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
||||
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
|
||||
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Header: /user6/ouster/tcl/compat/RCS/getcwd.c,v 1.2 93/07/12 14:00:59 ouster Exp $ SPRITE (Berkeley)";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "tclInt.h"
|
||||
#include "tclUnix.h"
|
||||
|
||||
extern char *getwd _ANSI_ARGS_((char *pathname));
|
||||
|
||||
char *
|
||||
getcwd(buf, size)
|
||||
char *buf; /* Where to put path for current directory. */
|
||||
size_t size; /* Number of bytes at buf. */
|
||||
{
|
||||
char realBuffer[MAXPATHLEN+1];
|
||||
int length;
|
||||
|
||||
if (getwd(realBuffer) == NULL) {
|
||||
/*
|
||||
* There's not much we can do besides guess at an errno to
|
||||
* use for the result (the error message in realBuffer isn't
|
||||
* much use...).
|
||||
*/
|
||||
|
||||
errno = EACCES;
|
||||
return NULL;
|
||||
}
|
||||
length = strlen(realBuffer);
|
||||
if (length >= size) {
|
||||
errno = ERANGE;
|
||||
return NULL;
|
||||
}
|
||||
strcpy(buf, realBuffer);
|
||||
return buf;
|
||||
}
|
||||
|
@ -1,34 +0,0 @@
|
||||
/*
|
||||
* limits.h --
|
||||
*
|
||||
* This is a dummy header file to #include in Tcl when there
|
||||
* is no limits.h in /usr/include. There are only a few
|
||||
* definitions here; also see tclUnix.h, which already
|
||||
* #defines some of the things here if they're not arleady
|
||||
* defined.
|
||||
*
|
||||
* Copyright (c) 1991 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, without written agreement and without
|
||||
* license or royalty fees, to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose, provided that the
|
||||
* above copyright notice and the following two paragraphs appear in
|
||||
* all copies of this software.
|
||||
*
|
||||
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
||||
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
|
||||
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
*
|
||||
* $Header: /user6/ouster/tcl/compat/RCS/limits.h,v 1.3 93/04/08 16:03:59 ouster Exp $ SPRITE (Berkeley)
|
||||
*/
|
||||
|
||||
#define LONG_MIN 0x80000000
|
||||
#define LONG_MAX 0x7fffffff
|
@ -1,484 +0,0 @@
|
||||
/*
|
||||
* strerror.c --
|
||||
*
|
||||
* Source code for the "strerror" library routine.
|
||||
*
|
||||
* Copyright (c) 1991-1993 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, without written agreement and without
|
||||
* license or royalty fees, to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose, provided that the
|
||||
* above copyright notice and the following two paragraphs appear in
|
||||
* all copies of this software.
|
||||
*
|
||||
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
||||
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
|
||||
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Header: /user6/ouster/tcl/compat/RCS/strerror.c,v 1.8 93/10/28 16:32:16 ouster Exp $ SPRITE (Berkeley)";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "tclInt.h"
|
||||
#include "tclUnix.h"
|
||||
|
||||
extern int sys_nerr;
|
||||
extern char *sys_errlist[];
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* strerror --
|
||||
*
|
||||
* Map an integer error number into a printable string.
|
||||
*
|
||||
* Results:
|
||||
* The return value is a pointer to a string describing
|
||||
* error. The first character of string isn't capitalized.
|
||||
*
|
||||
* Side effects:
|
||||
* Each call to this procedure may overwrite the value returned
|
||||
* by the previous call.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
char *
|
||||
strerror(error)
|
||||
int error; /* Integer identifying error (must be
|
||||
* one of the officially-defined Sprite
|
||||
* errors, as defined in errno.h). */
|
||||
{
|
||||
static char msg[50];
|
||||
|
||||
#ifndef NO_SYS_ERRLIST
|
||||
if ((error <= sys_nerr) && (error > 0)) {
|
||||
return sys_errlist[error];
|
||||
}
|
||||
#else
|
||||
switch (error) {
|
||||
#ifdef E2BIG
|
||||
case E2BIG: return "argument list too long";
|
||||
#endif
|
||||
#ifdef EACCES
|
||||
case EACCES: return "permission denied";
|
||||
#endif
|
||||
#ifdef EADDRINUSE
|
||||
case EADDRINUSE: return "address already in use";
|
||||
#endif
|
||||
#ifdef EADDRNOTAVAIL
|
||||
case EADDRNOTAVAIL: return "can't assign requested address";
|
||||
#endif
|
||||
#ifdef EADV
|
||||
case EADV: return "advertise error";
|
||||
#endif
|
||||
#ifdef EAFNOSUPPORT
|
||||
case EAFNOSUPPORT: return "address family not supported by protocol family";
|
||||
#endif
|
||||
#ifdef EAGAIN
|
||||
case EAGAIN: return "no more processes";
|
||||
#endif
|
||||
#ifdef EALIGN
|
||||
case EALIGN: return "EALIGN";
|
||||
#endif
|
||||
#ifdef EALREADY
|
||||
case EALREADY: return "operation already in progress";
|
||||
#endif
|
||||
#ifdef EBADE
|
||||
case EBADE: return "bad exchange descriptor";
|
||||
#endif
|
||||
#ifdef EBADF
|
||||
case EBADF: return "bad file number";
|
||||
#endif
|
||||
#ifdef EBADFD
|
||||
case EBADFD: return "file descriptor in bad state";
|
||||
#endif
|
||||
#ifdef EBADMSG
|
||||
case EBADMSG: return "not a data message";
|
||||
#endif
|
||||
#ifdef EBADR
|
||||
case EBADR: return "bad request descriptor";
|
||||
#endif
|
||||
#ifdef EBADRPC
|
||||
case EBADRPC: return "RPC structure is bad";
|
||||
#endif
|
||||
#ifdef EBADRQC
|
||||
case EBADRQC: return "bad request code";
|
||||
#endif
|
||||
#ifdef EBADSLT
|
||||
case EBADSLT: return "invalid slot";
|
||||
#endif
|
||||
#ifdef EBFONT
|
||||
case EBFONT: return "bad font file format";
|
||||
#endif
|
||||
#ifdef EBUSY
|
||||
case EBUSY: return "mount device busy";
|
||||
#endif
|
||||
#ifdef ECHILD
|
||||
case ECHILD: return "no children";
|
||||
#endif
|
||||
#ifdef ECHRNG
|
||||
case ECHRNG: return "channel number out of range";
|
||||
#endif
|
||||
#ifdef ECOMM
|
||||
case ECOMM: return "communication error on send";
|
||||
#endif
|
||||
#ifdef ECONNABORTED
|
||||
case ECONNABORTED: return "software caused connection abort";
|
||||
#endif
|
||||
#ifdef ECONNREFUSED
|
||||
case ECONNREFUSED: return "connection refused";
|
||||
#endif
|
||||
#ifdef ECONNRESET
|
||||
case ECONNRESET: return "connection reset by peer";
|
||||
#endif
|
||||
#if defined(EDEADLK) && (!defined(EWOULDBLOCK) || (EDEADLK != EWOULDBLOCK))
|
||||
case EDEADLK: return "resource deadlock avoided";
|
||||
#endif
|
||||
#ifdef EDEADLOCK
|
||||
case EDEADLOCK: return "resource deadlock avoided";
|
||||
#endif
|
||||
#ifdef EDESTADDRREQ
|
||||
case EDESTADDRREQ: return "destination address required";
|
||||
#endif
|
||||
#ifdef EDIRTY
|
||||
case EDIRTY: return "mounting a dirty fs w/o force";
|
||||
#endif
|
||||
#ifdef EDOM
|
||||
case EDOM: return "math argument out of range";
|
||||
#endif
|
||||
#ifdef EDOTDOT
|
||||
case EDOTDOT: return "cross mount point";
|
||||
#endif
|
||||
#ifdef EDQUOT
|
||||
case EDQUOT: return "disk quota exceeded";
|
||||
#endif
|
||||
#ifdef EDUPPKG
|
||||
case EDUPPKG: return "duplicate package name";
|
||||
#endif
|
||||
#ifdef EEXIST
|
||||
case EEXIST: return "file already exists";
|
||||
#endif
|
||||
#ifdef EFAULT
|
||||
case EFAULT: return "bad address in system call argument";
|
||||
#endif
|
||||
#ifdef EFBIG
|
||||
case EFBIG: return "file too large";
|
||||
#endif
|
||||
#ifdef EHOSTDOWN
|
||||
case EHOSTDOWN: return "host is down";
|
||||
#endif
|
||||
#ifdef EHOSTUNREACH
|
||||
case EHOSTUNREACH: return "host is unreachable";
|
||||
#endif
|
||||
#ifdef EIDRM
|
||||
case EIDRM: return "identifier removed";
|
||||
#endif
|
||||
#ifdef EINIT
|
||||
case EINIT: return "initialization error";
|
||||
#endif
|
||||
#ifdef EINPROGRESS
|
||||
case EINPROGRESS: return "operation now in progress";
|
||||
#endif
|
||||
#ifdef EINTR
|
||||
case EINTR: return "interrupted system call";
|
||||
#endif
|
||||
#ifdef EINVAL
|
||||
case EINVAL: return "invalid argument";
|
||||
#endif
|
||||
#ifdef EIO
|
||||
case EIO: return "I/O error";
|
||||
#endif
|
||||
#ifdef EISCONN
|
||||
case EISCONN: return "socket is already connected";
|
||||
#endif
|
||||
#ifdef EISDIR
|
||||
case EISDIR: return "illegal operation on a directory";
|
||||
#endif
|
||||
#ifdef EISNAME
|
||||
case EISNAM: return "is a name file";
|
||||
#endif
|
||||
#ifdef ELBIN
|
||||
case ELBIN: return "ELBIN";
|
||||
#endif
|
||||
#ifdef EL2HLT
|
||||
case EL2HLT: return "level 2 halted";
|
||||
#endif
|
||||
#ifdef EL2NSYNC
|
||||
case EL2NSYNC: return "level 2 not synchronized";
|
||||
#endif
|
||||
#ifdef EL3HLT
|
||||
case EL3HLT: return "level 3 halted";
|
||||
#endif
|
||||
#ifdef EL3RST
|
||||
case EL3RST: return "level 3 reset";
|
||||
#endif
|
||||
#ifdef ELIBACC
|
||||
case ELIBACC: return "can not access a needed shared library";
|
||||
#endif
|
||||
#ifdef ELIBBAD
|
||||
case ELIBBAD: return "accessing a corrupted shared library";
|
||||
#endif
|
||||
#ifdef ELIBEXEC
|
||||
case ELIBEXEC: return "can not exec a shared library directly";
|
||||
#endif
|
||||
#ifdef ELIBMAX
|
||||
case ELIBMAX: return
|
||||
"attempting to link in more shared libraries than system limit";
|
||||
#endif
|
||||
#ifdef ELIBSCN
|
||||
case ELIBSCN: return ".lib section in a.out corrupted";
|
||||
#endif
|
||||
#ifdef ELNRNG
|
||||
case ELNRNG: return "link number out of range";
|
||||
#endif
|
||||
#ifdef ELOOP
|
||||
case ELOOP: return "too many levels of symbolic links";
|
||||
#endif
|
||||
#ifdef EMFILE
|
||||
case EMFILE: return "too many open files";
|
||||
#endif
|
||||
#ifdef EMLINK
|
||||
case EMLINK: return "too many links";
|
||||
#endif
|
||||
#ifdef EMSGSIZE
|
||||
case EMSGSIZE: return "message too long";
|
||||
#endif
|
||||
#ifdef EMULTIHOP
|
||||
case EMULTIHOP: return "multihop attempted";
|
||||
#endif
|
||||
#ifdef ENAMETOOLONG
|
||||
case ENAMETOOLONG: return "file name too long";
|
||||
#endif
|
||||
#ifdef ENAVAIL
|
||||
case ENAVAIL: return "not available";
|
||||
#endif
|
||||
#ifdef ENET
|
||||
case ENET: return "ENET";
|
||||
#endif
|
||||
#ifdef ENETDOWN
|
||||
case ENETDOWN: return "network is down";
|
||||
#endif
|
||||
#ifdef ENETRESET
|
||||
case ENETRESET: return "network dropped connection on reset";
|
||||
#endif
|
||||
#ifdef ENETUNREACH
|
||||
case ENETUNREACH: return "network is unreachable";
|
||||
#endif
|
||||
#ifdef ENFILE
|
||||
case ENFILE: return "file table overflow";
|
||||
#endif
|
||||
#ifdef ENOANO
|
||||
case ENOANO: return "anode table overflow";
|
||||
#endif
|
||||
#if defined(ENOBUFS) && (!defined(ENOSR) || (ENOBUFS != ENOSR))
|
||||
case ENOBUFS: return "no buffer space available";
|
||||
#endif
|
||||
#ifdef ENOCSI
|
||||
case ENOCSI: return "no CSI structure available";
|
||||
#endif
|
||||
#ifdef ENODATA
|
||||
case ENODATA: return "no data available";
|
||||
#endif
|
||||
#ifdef ENODEV
|
||||
case ENODEV: return "no such device";
|
||||
#endif
|
||||
#ifdef ENOENT
|
||||
case ENOENT: return "no such file or directory";
|
||||
#endif
|
||||
#ifdef ENOEXEC
|
||||
case ENOEXEC: return "exec format error";
|
||||
#endif
|
||||
#ifdef ENOLCK
|
||||
case ENOLCK: return "no locks available";
|
||||
#endif
|
||||
#ifdef ENOLINK
|
||||
case ENOLINK: return "link has be severed";
|
||||
#endif
|
||||
#ifdef ENOMEM
|
||||
case ENOMEM: return "not enough memory";
|
||||
#endif
|
||||
#ifdef ENOMSG
|
||||
case ENOMSG: return "no message of desired type";
|
||||
#endif
|
||||
#ifdef ENONET
|
||||
case ENONET: return "machine is not on the network";
|
||||
#endif
|
||||
#ifdef ENOPKG
|
||||
case ENOPKG: return "package not installed";
|
||||
#endif
|
||||
#ifdef ENOPROTOOPT
|
||||
case ENOPROTOOPT: return "bad proocol option";
|
||||
#endif
|
||||
#ifdef ENOSPC
|
||||
case ENOSPC: return "no space left on device";
|
||||
#endif
|
||||
#ifdef ENOSR
|
||||
case ENOSR: return "out of stream resources";
|
||||
#endif
|
||||
#ifdef ENOSTR
|
||||
case ENOSTR: return "not a stream device";
|
||||
#endif
|
||||
#ifdef ENOSYM
|
||||
case ENOSYM: return "unresolved symbol name";
|
||||
#endif
|
||||
#ifdef ENOSYS
|
||||
case ENOSYS: return "function not implemented";
|
||||
#endif
|
||||
#ifdef ENOTBLK
|
||||
case ENOTBLK: return "block device required";
|
||||
#endif
|
||||
#ifdef ENOTCONN
|
||||
case ENOTCONN: return "socket is not connected";
|
||||
#endif
|
||||
#ifdef ENOTDIR
|
||||
case ENOTDIR: return "not a directory";
|
||||
#endif
|
||||
#ifdef ENOTEMPTY
|
||||
case ENOTEMPTY: return "directory not empty";
|
||||
#endif
|
||||
#ifdef ENOTNAM
|
||||
case ENOTNAM: return "not a name file";
|
||||
#endif
|
||||
#ifdef ENOTSOCK
|
||||
case ENOTSOCK: return "socket operation on non-socket";
|
||||
#endif
|
||||
#ifdef ENOTTY
|
||||
case ENOTTY: return "inappropriate device for ioctl";
|
||||
#endif
|
||||
#ifdef ENOTUNIQ
|
||||
case ENOTUNIQ: return "name not unique on network";
|
||||
#endif
|
||||
#ifdef ENXIO
|
||||
case ENXIO: return "no such device or address";
|
||||
#endif
|
||||
#ifdef EOPNOTSUPP
|
||||
case EOPNOTSUPP: return "operation not supported on socket";
|
||||
#endif
|
||||
#ifdef EPERM
|
||||
case EPERM: return "not owner";
|
||||
#endif
|
||||
#ifdef EPFNOSUPPORT
|
||||
case EPFNOSUPPORT: return "protocol family not supported";
|
||||
#endif
|
||||
#ifdef EPIPE
|
||||
case EPIPE: return "broken pipe";
|
||||
#endif
|
||||
#ifdef EPROCLIM
|
||||
case EPROCLIM: return "too many processes";
|
||||
#endif
|
||||
#ifdef EPROCUNAVAIL
|
||||
case EPROCUNAVAIL: return "bad procedure for program";
|
||||
#endif
|
||||
#ifdef EPROGMISMATCH
|
||||
case EPROGMISMATCH: return "program version wrong";
|
||||
#endif
|
||||
#ifdef EPROGUNAVAIL
|
||||
case EPROGUNAVAIL: return "RPC program not available";
|
||||
#endif
|
||||
#ifdef EPROTO
|
||||
case EPROTO: return "protocol error";
|
||||
#endif
|
||||
#ifdef EPROTONOSUPPORT
|
||||
case EPROTONOSUPPORT: return "protocol not suppored";
|
||||
#endif
|
||||
#ifdef EPROTOTYPE
|
||||
case EPROTOTYPE: return "protocol wrong type for socket";
|
||||
#endif
|
||||
#ifdef ERANGE
|
||||
case ERANGE: return "math result unrepresentable";
|
||||
#endif
|
||||
#if defined(EREFUSED) && (!defined(ECONNREFUSED) || (EREFUSED != ECONNREFUSED))
|
||||
case EREFUSED: return "EREFUSED";
|
||||
#endif
|
||||
#ifdef EREMCHG
|
||||
case EREMCHG: return "remote address changed";
|
||||
#endif
|
||||
#ifdef EREMDEV
|
||||
case EREMDEV: return "remote device";
|
||||
#endif
|
||||
#ifdef EREMOTE
|
||||
case EREMOTE: return "pathname hit remote file system";
|
||||
#endif
|
||||
#ifdef EREMOTEIO
|
||||
case EREMOTEIO: return "remote i/o error";
|
||||
#endif
|
||||
#ifdef EREMOTERELEASE
|
||||
case EREMOTERELEASE: return "EREMOTERELEASE";
|
||||
#endif
|
||||
#ifdef EROFS
|
||||
case EROFS: return "read-only file system";
|
||||
#endif
|
||||
#ifdef ERPCMISMATCH
|
||||
case ERPCMISMATCH: return "RPC version is wrong";
|
||||
#endif
|
||||
#ifdef ERREMOTE
|
||||
case ERREMOTE: return "object is remote";
|
||||
#endif
|
||||
#ifdef ESHUTDOWN
|
||||
case ESHUTDOWN: return "can't send afer socket shutdown";
|
||||
#endif
|
||||
#ifdef ESOCKTNOSUPPORT
|
||||
case ESOCKTNOSUPPORT: return "socket type not supported";
|
||||
#endif
|
||||
#ifdef ESPIPE
|
||||
case ESPIPE: return "invalid seek";
|
||||
#endif
|
||||
#ifdef ESRCH
|
||||
case ESRCH: return "no such process";
|
||||
#endif
|
||||
#ifdef ESRMNT
|
||||
case ESRMNT: return "srmount error";
|
||||
#endif
|
||||
#ifdef ESTALE
|
||||
case ESTALE: return "stale remote file handle";
|
||||
#endif
|
||||
#ifdef ESUCCESS
|
||||
case ESUCCESS: return "Error 0";
|
||||
#endif
|
||||
#ifdef ETIME
|
||||
case ETIME: return "timer expired";
|
||||
#endif
|
||||
#ifdef ETIMEDOUT
|
||||
case ETIMEDOUT: return "connection timed out";
|
||||
#endif
|
||||
#ifdef ETOOMANYREFS
|
||||
case ETOOMANYREFS: return "too many references: can't splice";
|
||||
#endif
|
||||
#ifdef ETXTBSY
|
||||
case ETXTBSY: return "text file or pseudo-device busy";
|
||||
#endif
|
||||
#ifdef EUCLEAN
|
||||
case EUCLEAN: return "structure needs cleaning";
|
||||
#endif
|
||||
#ifdef EUNATCH
|
||||
case EUNATCH: return "protocol driver not attached";
|
||||
#endif
|
||||
#ifdef EUSERS
|
||||
case EUSERS: return "too many users";
|
||||
#endif
|
||||
#ifdef EVERSION
|
||||
case EVERSION: return "version mismatch";
|
||||
#endif
|
||||
#if defined(EWOULDBLOCK) && (!defined(EAGAIN) || (EWOULDBLOCK != EAGAIN))
|
||||
case EWOULDBLOCK: return "operation would block";
|
||||
#endif
|
||||
#ifdef EXDEV
|
||||
case EXDEV: return "cross-domain link";
|
||||
#endif
|
||||
#ifdef EXFULL
|
||||
case EXFULL: return "message tables full";
|
||||
#endif
|
||||
}
|
||||
#endif /* ! NO_SYS_ERRLIST */
|
||||
sprintf(msg, "unknown error (%d)", error);
|
||||
return msg;
|
||||
}
|
1015
tcl7.3/configure
vendored
1015
tcl7.3/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -1,182 +0,0 @@
|
||||
dnl This file is an input file used by the GNU "autoconf" program to
|
||||
dnl generate the file "configure", which is run during Tcl installation
|
||||
dnl to configure the system for the local environment.
|
||||
AC_INIT(tcl.h)
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_RANLIB
|
||||
CC=${CC-cc}
|
||||
AC_SUBST(CC)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Supply substitutes for missing POSIX library procedures, or
|
||||
# set flags so Tcl uses alternate procedures.
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
AC_REPLACE_FUNCS(getcwd opendir strerror strstr)
|
||||
AC_REPLACE_FUNCS(strtol tmpnam waitpid)
|
||||
AC_FUNC_CHECK(gettimeofday, , AC_DEFINE(NO_GETTOD))
|
||||
AC_FUNC_CHECK(getwd, , AC_DEFINE(NO_GETWD))
|
||||
AC_FUNC_CHECK(wait3, , AC_DEFINE(NO_WAIT3))
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Supply substitutes for missing POSIX header files. Special
|
||||
# notes:
|
||||
# - Sprite's dirent.h exists but is bogus.
|
||||
# - stdlib.h doesn't define strtol, strtoul, or
|
||||
# strtod insome versions of SunOS
|
||||
# - some versions of string.h don't declare procedures such
|
||||
# as strstr
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
AC_UNISTD_H
|
||||
AC_COMPILE_CHECK(dirent.h, [#include <sys/types.h>
|
||||
#include <dirent.h>], [
|
||||
DIR *d;
|
||||
struct dirent *entryPtr;
|
||||
char *p;
|
||||
d = opendir("foobar");
|
||||
entryPtr = readdir(d);
|
||||
p = entryPtr->d_name;
|
||||
closedir(d);
|
||||
], tcl_ok=1, tcl_ok=0)
|
||||
AC_HEADER_EGREP([Sprite version.* NOT POSIX], tcl_ok=0)
|
||||
if test $tcl_ok = 0; then
|
||||
AC_DEFINE(NO_DIRENT_H)
|
||||
fi
|
||||
AC_HEADER_CHECK(errno.h, , AC_DEFINE(NO_ERRNO_H))
|
||||
AC_HEADER_CHECK(float.h, , AC_DEFINE(NO_FLOAT_H))
|
||||
AC_HEADER_CHECK(limits.h, , AC_DEFINE(NO_LIMITS_H))
|
||||
AC_HEADER_CHECK(stdlib.h, tcl_ok=1, tcl_ok=0)
|
||||
AC_HEADER_EGREP(strtol, stdlib.h, , tcl_ok=0)
|
||||
AC_HEADER_EGREP(strtoul, stdlib.h, , tcl_ok=0)
|
||||
AC_HEADER_EGREP(strtod, stdlib.h, , tcl_ok=0)
|
||||
if test $tcl_ok = 0; then
|
||||
AC_DEFINE(NO_STDLIB_H)
|
||||
fi
|
||||
AC_HEADER_CHECK(string.h, tcl_ok=1, tcl_ok=0)
|
||||
AC_HEADER_EGREP(strstr, string.h, , tcl_ok=0)
|
||||
AC_HEADER_EGREP(strerror, string.h, , tcl_ok=0)
|
||||
if test $tcl_ok = 0; then
|
||||
AC_DEFINE(NO_STRING_H)
|
||||
fi
|
||||
AC_HEADER_CHECK(sys/time.h, , AC_DEFINE(NO_SYS_TIME_H))
|
||||
AC_HEADER_CHECK(sys/wait.h, , AC_DEFINE(NO_SYS_WAIT_H))
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# On some systems strstr is broken: it returns a pointer even
|
||||
# even if the original string is empty.
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
AC_TEST_PROGRAM([
|
||||
extern int strstr();
|
||||
int main()
|
||||
{
|
||||
exit(strstr("\0test", "test") ? 1 : 0);
|
||||
}
|
||||
], , [LIBOBJS="$LIBOBJS strstr.o"])
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Check for strtoul function. This is tricky because under some
|
||||
# versions of AIX strtoul returns an incorrect terminator
|
||||
# pointer for the string "0".
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
AC_FUNC_CHECK(strtoul, tcl_ok=1, tcl_ok=0)
|
||||
AC_TEST_PROGRAM([
|
||||
extern int strtoul();
|
||||
int main()
|
||||
{
|
||||
char *string = "0";
|
||||
char *term;
|
||||
int value;
|
||||
value = strtoul(string, &term, 0);
|
||||
if ((value != 0) || (term != (string+1))) {
|
||||
exit(1);
|
||||
}
|
||||
exit(0);
|
||||
}], , tcl_ok=0)
|
||||
if test $tcl_ok = 0; then
|
||||
LIBOBJS="$LIBOBJS strtoul.o"
|
||||
fi
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Check for the strtod function. This is tricky because under
|
||||
# some versions of Linux it mis-parses the string "+".
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
AC_FUNC_CHECK(strtod, tcl_ok=1, tcl_ok=0)
|
||||
AC_TEST_PROGRAM([
|
||||
extern double strtod();
|
||||
int main()
|
||||
{
|
||||
char *string = "+";
|
||||
char *term;
|
||||
double value;
|
||||
value = strtod(string, &term);
|
||||
if (term != string) {
|
||||
exit(1);
|
||||
}
|
||||
exit(0);
|
||||
}], , tcl_ok=0)
|
||||
if test $tcl_ok = 0; then
|
||||
LIBOBJS="$LIBOBJS strtod.o"
|
||||
fi
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Check for various typedefs and provide substitutes if
|
||||
# they don't exist.
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
AC_MODE_T
|
||||
AC_PID_T
|
||||
AC_SIZE_T
|
||||
AC_UID_T
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# If a system doesn't have an opendir function (man, that's old!)
|
||||
# then we have to supply a different version of dirent.h which
|
||||
# is compatible with the substitute version of opendir that's
|
||||
# provided. This version only works with V7-style directories.
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
AC_FUNC_CHECK(opendir, , AC_DEFINE(USE_DIRENT2_H))
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Check for the existence of sys_errlist (this is only needed if
|
||||
# there's no strerror, but I don't know how to conditionalize the
|
||||
# check).
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
AC_COMPILE_CHECK(sys_errlist, , [
|
||||
extern char *sys_errlist[];
|
||||
extern int sys_nerr;
|
||||
sys_errlist[sys_nerr-1][0] = 0;
|
||||
], , AC_DEFINE(NO_SYS_ERRLIST))
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# The check below checks whether <sys/wait.h> defines the type
|
||||
# "union wait" correctly. It's needed because of weirdness in
|
||||
# HP-UX where "union wait" is defined in both the BSD and SYS-V
|
||||
# environments. Checking the usability of WIFEXITED seems to do
|
||||
# the trick.
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
AC_COMPILE_CHECK([union wait], [#include <sys/types.h>
|
||||
#include <sys/wait.h>], [
|
||||
union wait x;
|
||||
WIFEXITED(x); /* Generates compiler error if WIFEXITED
|
||||
* uses an int. */
|
||||
], , AC_DEFINE(NO_UNION_WAIT))
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
# Check to see whether the system supports the matherr function
|
||||
# and its associated type "struct exception".
|
||||
#--------------------------------------------------------------------
|
||||
|
||||
AC_COMPILE_CHECK([matherr support], [#include <math.h>], [
|
||||
struct exception x;
|
||||
x.type = DOMAIN;
|
||||
x.type = SING;
|
||||
], [LIBOBJS="$LIBOBJS tclMtherr.o"; AC_DEFINE(NEED_MATHERR)])
|
||||
|
||||
AC_OUTPUT(Makefile)
|
@ -1,81 +0,0 @@
|
||||
This file provides more information about the "configure" script
|
||||
and how you can personalize it for your local environment.
|
||||
|
||||
The `configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation, and
|
||||
creates the Makefile. It also creates a file `config.status'
|
||||
that you can run in the future to recreate the current configuration.
|
||||
|
||||
Running `configure' takes a minute or two. While it is running, it
|
||||
prints some messages that tell what it is doing. If you don't want to
|
||||
see the messages, run `configure' with its standard output redirected
|
||||
to `/dev/null'; for example, `./configure >/dev/null'.
|
||||
|
||||
To compile the package in a different directory from the one
|
||||
containing the source code, you must use a version of make that
|
||||
supports the VPATH variable, such as GNU make. `cd' to the directory
|
||||
where you want the object files and executables to go and run
|
||||
`configure'. `configure' automatically checks for the source code in
|
||||
the directory that `configure' is in and in `..'. If for some reason
|
||||
`configure' is not in the source code directory that you are
|
||||
configuring, then it will report that it can't find the source code.
|
||||
In that case, run `configure' with the option `--srcdir=DIR', where
|
||||
DIR is the directory that contains the source code.
|
||||
|
||||
By default, `make install' will install the package's files in
|
||||
/usr/local/bin, /usr/local/lib, /usr/local/man, etc. You can specify
|
||||
an installation prefix other than /usr/local by giving `configure' the
|
||||
option `--prefix=PATH'. Alternately, you can do so by giving a value
|
||||
for the `prefix' variable when you run `make', e.g.,
|
||||
make prefix=/usr/gnu
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If
|
||||
you give `configure' the option `--exec_prefix=PATH' or set the
|
||||
`make' variable `exec_prefix' to PATH, the package will use PATH as
|
||||
the prefix for installing programs and libraries. Data files and
|
||||
documentation will still use the regular prefix. Normally, all files
|
||||
are installed using the regular prefix.
|
||||
|
||||
You can tell `configure' to figure out the configuration for your
|
||||
system, and record it in `config.status', without actually configuring
|
||||
the package (creating `Makefile's and perhaps a configuration header
|
||||
file). To do this, give `configure' the `--no-create' option. Later,
|
||||
you can run `./config.status' to actually configure the package. This
|
||||
option is useful mainly in `Makefile' rules for updating `config.status'
|
||||
and `Makefile'. You can also give `config.status' the `--recheck'
|
||||
option, which makes it re-run `configure' with the same arguments you
|
||||
used before. This is useful if you change `configure'.
|
||||
|
||||
`configure' ignores any other arguments that you give it.
|
||||
|
||||
If your system requires unusual options for compilation or linking
|
||||
that `configure' doesn't know about, you can give `configure' initial
|
||||
values for some variables by setting them in the environment. In
|
||||
Bourne-compatible shells, you can do that on the command line like
|
||||
this:
|
||||
CC='gcc -traditional' DEFS=-D_POSIX_SOURCE ./configure
|
||||
|
||||
The `make' variables that you might want to override with environment
|
||||
variables when running `configure' are:
|
||||
|
||||
(For these variables, any value given in the environment overrides the
|
||||
value that `configure' would choose:)
|
||||
CC C compiler program.
|
||||
Default is `cc', or `gcc' if `gcc' is in your PATH.
|
||||
INSTALL Program to use to install files.
|
||||
Default is `install' if you have it, `cp' otherwise.
|
||||
|
||||
(For these variables, any value given in the environment is added to
|
||||
the value that `configure' chooses:)
|
||||
DEFS Configuration options, in the form `-Dfoo -Dbar ...'
|
||||
LIBS Libraries to link with, in the form `-lfoo -lbar ...'
|
||||
|
||||
If you need to do unusual things to compile the package, we encourage
|
||||
you to figure out how `configure' could check whether to do them, and
|
||||
mail diffs or instructions to the address given in the README so we
|
||||
can include them in the next release.
|
||||
|
||||
The file `configure.in' is used as a template to create `configure' by
|
||||
a program called `autoconf'. You will only need it if you want to
|
||||
regenerate `configure' using a newer version of `autoconf'.
|
@ -1,68 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/AppInit.3,v 1.2 93/06/07 15:11:46 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS Tcl_AppInit tclc 7.0
|
||||
.BS
|
||||
.SH NAME
|
||||
Tcl_AppInit \- Perform application-specific initialization
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fB#include <tcl.h>\fR
|
||||
.sp
|
||||
\fBTcl_AppInit\fR(\fIinterp\fR)
|
||||
.SH ARGUMENTS
|
||||
.AS Tcl_Interp *interp
|
||||
.AP Tcl_Interp *interp in
|
||||
Interpreter for the application.
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
\fBTcl_AppInit\fR is a procedure that is invoked by the main programs
|
||||
for Tcl applications such as \fBtclsh\fR and \fBwish\fR.
|
||||
Its purpose is to allow new Tcl applications to be created without
|
||||
modifying existing main programs such as those for \fBtclsh\fR
|
||||
and \fBwish\fR.
|
||||
To create a new application simply write a new version of
|
||||
\fBTcl_AppInit\fR to replace the default version provided by Tcl,
|
||||
then link your new \fBTcl_AppInit\fR with the Tcl library, which
|
||||
contains the main program from \fBtclsh\fR (be sure to specify the
|
||||
switch ``\fB\-u _main\fR'' to the linker to force it to use the
|
||||
version of \fBmain\fR from the Tcl library).
|
||||
.PP
|
||||
\fBTcl_AppInit\fR is invoked after other initialization in
|
||||
\fBmain\fR and before entering the main loop to process commands.
|
||||
Here are some examples of things that \fBTcl_AppInit\fR might do:
|
||||
.IP [1]
|
||||
Call initialization procedures for various packages used by
|
||||
the application.
|
||||
Each initialization procedure adds new commands to \fIinterp\fR
|
||||
for its package and performs other package-specific initialization.
|
||||
.IP [2]
|
||||
Process command-line arguments, which can be accessed from the
|
||||
Tcl variables \fBargv\fR and \fBargv0\fR in \fIinterp\fR.
|
||||
.IP [3]
|
||||
Invoke a startup script to initialize the application.
|
||||
|
||||
.SH KEYWORDS
|
||||
application, argument, command, initialization, interpreter
|
@ -1,58 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1989-1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/Backslash.3,v 1.12 93/04/01 09:25:22 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS Tcl_Backslash tclc
|
||||
.BS
|
||||
.SH NAME
|
||||
Tcl_Backslash \- parse a backslash sequence
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fB#include <tcl.h>\fR
|
||||
.sp
|
||||
char
|
||||
\fBTcl_Backslash\fR(\fIsrc, countPtr\fR)
|
||||
.SH ARGUMENTS
|
||||
.AS char *countPtr
|
||||
.AP char *src in
|
||||
Pointer to a string starting with a backslash.
|
||||
.AP int *countPtr out
|
||||
If \fIcountPtr\fR isn't NULL, \fI*countPtr\fR gets filled
|
||||
in with number of characters in the backslash sequence, including
|
||||
the backslash character.
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
This is a utility procedure used by several of the Tcl
|
||||
commands. It parses a backslash sequence and returns
|
||||
the single character corresponding to the sequence.
|
||||
\fBTcl_Backslash\fR modifies \fI*countPtr\fR to contain the number
|
||||
of characters in the backslash sequence.
|
||||
.PP
|
||||
See the Tcl manual entry for information on the valid
|
||||
backslash sequences.
|
||||
All of the sequences described in the Tcl
|
||||
manual entry are supported by \fBTcl_Backslash\fR.
|
||||
|
||||
.SH KEYWORDS
|
||||
backslash, parse
|
@ -1,49 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1989-1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/CmdCmplt.3,v 1.1 93/04/05 10:04:55 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS Tcl_CmdComplete tclc
|
||||
.BS
|
||||
.SH NAME
|
||||
Tcl_CmdComplete \- Check for unmatched braces in a Tcl command
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fB#include <tcl.h>\fR
|
||||
.sp
|
||||
int
|
||||
\fBTcl_CommandComplete\fR(\fIcmd\fR)
|
||||
.SH ARGUMENTS
|
||||
.AS char *cmd
|
||||
.AP char *cmd in
|
||||
Command string to test for completeness.
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
\fBTcl_CommandComplete\fR takes a Tcl command string
|
||||
as argument and determines whether it contains one or more
|
||||
complete commands (i.e. there are no unclosed quotes, braces,
|
||||
brackets, or variable references).
|
||||
If the command string is complete then it returns 1; otherwise it returns 0.
|
||||
|
||||
.SH KEYWORDS
|
||||
complete command, partial command
|
@ -1,61 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1989-1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/CrtInterp.3,v 1.7 93/04/01 09:25:24 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS Tcl_CreateInterp tclc
|
||||
.BS
|
||||
.SH NAME
|
||||
Tcl_CreateInterp, Tcl_DeleteInterp \- create and delete Tcl command interpreters
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fB#include <tcl.h>\fR
|
||||
.sp
|
||||
Tcl_Interp *
|
||||
\fBTcl_CreateInterp\fR()
|
||||
.sp
|
||||
\fBTcl_DeleteInterp\fR(\fIinterp\fR)
|
||||
.SH ARGUMENTS
|
||||
.AS Tcl_Interp *interp
|
||||
.AP Tcl_Interp *interp in
|
||||
Token for interpreter to be destroyed.
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
\fBTcl_CreateInterp\fR creates a new interpreter structure and returns
|
||||
a token for it. The token is required in calls to most other Tcl
|
||||
procedures, such as \fBTcl_CreateCommand\fR, \fBTcl_Eval\fR, and
|
||||
\fBTcl_DeleteInterp\fR.
|
||||
Clients are only allowed to access a few of the fields of
|
||||
Tcl_Interp structures; see the Tcl_Interp
|
||||
and \fBTcl_CreateCommand\fR man pages for details.
|
||||
The new interpreter is initialized with no defined variables and only
|
||||
the built-in Tcl commands. To bind in additional commands, call
|
||||
\fBTcl_CreateCommand\fR.
|
||||
.PP
|
||||
\fBTcl_DeleteInterp\fR destroys a command interpreter and releases all of
|
||||
the resources associated with it, including variables, procedures,
|
||||
and application-specific command bindings. After \fBTcl_DeleteInterp\fR
|
||||
returns the caller should never again use the \fIinterp\fR token.
|
||||
|
||||
.SH KEYWORDS
|
||||
command, create, delete, interpreter
|
@ -1,114 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1989-1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/CrtPipelin.3,v 1.7 93/04/09 11:53:47 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS Tcl_CreatePipeline tclc
|
||||
.BS
|
||||
.SH NAME
|
||||
Tcl_CreatePipeline \- create one or more child processes, with I/O redirection
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fB#include <tcl.h>\fR
|
||||
.sp
|
||||
int
|
||||
\fBTcl_CreatePipeline\fR(\fIinterp, argc, argv, pidArrayPtr, inPipePtr, outPipePtr, errFilePtr\fR)
|
||||
.SH ARGUMENTS
|
||||
.AS Tcl_Interp **pidArrayPtr
|
||||
.AP Tcl_Interp *interp in
|
||||
Interpreter to use for error reporting.
|
||||
.AP int argc in
|
||||
Number of strings in \fIargv\fR array.
|
||||
.AP char **argv in
|
||||
Array of strings describing command(s) and I/O redirection.
|
||||
.AP int **pidArrayPtr out
|
||||
The value at \fI*pidArrayPtr\fR is modified to hold a pointer to
|
||||
an array of process identifiers. The array is dynamically
|
||||
allocated and must be freed by the caller.
|
||||
.AP int *inPipePtr out
|
||||
If this argument is NULL then standard input for the first command
|
||||
in the pipeline comes from the current standard input.
|
||||
If \fIinPipePtr\fR is not NULL then \fBTcl_CreatePipeline\fR will
|
||||
create a pipe, arrange for it to be used for standard input
|
||||
to the first command,
|
||||
and store a file id for writing to that pipe at \fI*inPipePtr\fR.
|
||||
If the command specified its own input using redirection, then
|
||||
no pipe is created and -1 is stored at \fI*inPipePtr\fR.
|
||||
.AP int *outPipePtr out
|
||||
If this argument is NULL then standard output for the last command
|
||||
in the pipeline goes to the current standard output.
|
||||
If \fIoutPipePtr\fR is not NULL then \fBTcl_CreatePipeline\fR will
|
||||
create a pipe, arrange for it to be used for standard output from
|
||||
the last command, and store a file id for reading from that
|
||||
pipe at \fI*outPipePtr\fR.
|
||||
If the command specified its own output using redirection then
|
||||
no pipe is created and -1 is stored at \fI*outPipePtr\fR.
|
||||
.AP int *errFilePtr out
|
||||
If this argument is NULL then error output for all the commands
|
||||
in the pipeline will go to the current standard error file.
|
||||
If \fIerrFilePtr\fR is not NULL, error output from all the commands
|
||||
in the pipeline will go to a temporary file created by
|
||||
\fBTcl_CreatePipeline\fR.
|
||||
A file id to read from that file will be stored at \fI*errFilePtr\fR.
|
||||
The file will already have been removed, so closing the file
|
||||
descriptor at \fI*errFilePtr\fR will cause the file to be flushed
|
||||
completely.
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
\fBTcl_CreatePipeline\fR processes the \fIargv\fR array and sets
|
||||
up one or more child processes in a pipeline configuration.
|
||||
\fBTcl_CreatePipeline\fR handles pipes specified with ``|'',
|
||||
input redirection specified with ``<'' or ``<<'', and output
|
||||
redirection specified with ``>''; see the documentation for
|
||||
the \fBexec\fR command for details on these specifications.
|
||||
The return value from \fBTcl_CreatePipeline\fR is a count of
|
||||
the number of child processes created; the process identifiers
|
||||
for those processes are stored in a \fImalloc\fR-ed array and
|
||||
a pointer to that array is stored at \fI*pidArrayPtr\fR.
|
||||
It is the caller's responsibility to free the array when finished
|
||||
with it.
|
||||
.PP
|
||||
If the \fIinPipePtr\fR, \fIoutPipePtr\fR, and \fIerrFilePtr\fR
|
||||
arguments are NULL then the pipeline's standard input, standard
|
||||
output, and standard error are taken from the corresponding
|
||||
streams of the process. Non-NULL values may be specified for
|
||||
these arguments to use pipes for standard input and standard
|
||||
output and a file for standard error. \fBTcl_CreatePipeline\fR
|
||||
will create the requested pipes or file and return file identifiers
|
||||
that may be used to read or write them. It is the caller's
|
||||
responsibility to close all of these files when they are no
|
||||
longer needed. If \fIargv\fR specifies redirection for standard
|
||||
input or standard output, then pipes will not be created even
|
||||
if requested by the \fIinPipePtr\fR and \fIoutPipePtr\fR
|
||||
arguments.
|
||||
.PP
|
||||
If an error occurs in \fBTcl_CreatePipeline\fR (e.g. ``|'' or
|
||||
``<'' was the last argument in \fIargv\fR, or it wasn't possible
|
||||
to fork off a child), then -1 is returned
|
||||
and \fIinterp->result\fR is set to an error message.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
\fBTcl_DetachPids\fR, \fBTcl_ReapDetachedProcs\fR
|
||||
|
||||
.SH KEYWORDS
|
||||
background, child, detach, fork, process, status, wait
|
@ -1,98 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1989-1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/EnterFile.3,v 1.4 93/08/27 13:20:42 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS Tcl_EnterFile tclc 7.0
|
||||
.BS
|
||||
.SH NAME
|
||||
Tcl_EnterFile, Tcl_GetOpenFile, Tcl_FilePermissions \- manipulate the table of open files
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fB#include <tcl.h>\fR
|
||||
.sp
|
||||
\fBTcl_EnterFile\fR(\fIinterp, file, permissions\fR)
|
||||
.sp
|
||||
int
|
||||
\fBTcl_GetOpenFile\fR(\fIinterp, string, write, checkUsage, filePtr\fR)
|
||||
.sp
|
||||
int
|
||||
\fBTcl_FilePermissions(\fIfile\fR)
|
||||
.SH ARGUMENTS
|
||||
.AS Tcl_Interp checkUsage
|
||||
.AP Tcl_Interp *interp in
|
||||
Tcl interpreter from which file is to be accessed.
|
||||
.AP FILE *file in
|
||||
Handle for file that is to become accessible in \fIinterp\fR.
|
||||
.AP int permissions in
|
||||
OR-ed combination of TCL_FILE_READABLE and TCL_FILE_WRITABLE;
|
||||
indicates whether \fIfile\fR was opened for reading or writing or both.
|
||||
.AP char *string in
|
||||
String identifying file, such as \fBstdin\fR or \fBfile4\fR.
|
||||
.AP int write in
|
||||
Non-zero means the file will be used for writing, zero means it will
|
||||
be used for reading.
|
||||
.AP int checkUsage in
|
||||
If non-zero, then an error will be generated if the file wasn't opened
|
||||
for the access indicated by \fIwrite\fR.
|
||||
.AP FILE **filePtr out
|
||||
Points to word in which to store pointer to FILE structure for
|
||||
the file given by \fIstring\fR.
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
These procedures provide access to Tcl's file naming mechanism.
|
||||
\fBTcl_EnterFile\fR enters an open file into Tcl's file table so
|
||||
that it can be accessed using Tcl commands like \fBgets\fR,
|
||||
\fBputs\fR, \fBseek\fR, and \fBclose\fR.
|
||||
It returns in \fIinterp->result\fR an identifier such as \fBfile4\fR
|
||||
that can be used to refer to the file in subsequent Tcl commands.
|
||||
\fBTcl_EnterFile\fR is typically used to implement new Tcl commands
|
||||
that open sockets, pipes, or other kinds of files not already supported
|
||||
by the built-in commands.
|
||||
.PP
|
||||
\fBTcl_GetOpenFile\fR takes as argument a file identifier of the form
|
||||
returned by the \fBopen\fR command or \fBTcl_EnterFile\fR and
|
||||
returns at \fI*filePtr\fR a pointer to the FILE structure for
|
||||
the file.
|
||||
The \fIwrite\fR argument indicates whether the FILE pointer will
|
||||
be used for reading or writing.
|
||||
In some cases, such as a file that connects to a pipeline of
|
||||
subprocesses, different FILE pointers will be returned for reading
|
||||
and writing.
|
||||
\fBTcl_GetOpenFile\fR normally returns TCL_OK.
|
||||
If an error occurs in \fBTcl_GetOpenFile\fR (e.g. \fIstring\fR didn't
|
||||
make any sense or \fIcheckUsage\fR was set and the file wasn't opened
|
||||
for the access specified by \fIwrite\fR) then TCL_ERROR is returned
|
||||
and \fIinterp->result\fR will contain an error message.
|
||||
If \fIcheckUsage\fR is zero and the file wasn't opened for the
|
||||
access specified by \fIwrite\fR, then the FILE pointer returned
|
||||
at \fI*filePtr\fR may not correspond to \fIwrite\fR.
|
||||
.PP
|
||||
\fBTcl_FilePermissions\fR returns an OR-ed combination of the
|
||||
mask bits TCL_FILE_READABLE and TCL_FILE_WRITABLE; these indicate
|
||||
whether the given file was opened for reading or writing or both.
|
||||
If \fIfile\fR does not refer to a file in Tcl's file table then
|
||||
\-1 is returned.
|
||||
|
||||
.SH KEYWORDS
|
||||
file table, permissions, pipeline, read, write
|
@ -1,60 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1989-1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/RecordEval.3,v 1.9 93/04/16 15:02:27 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS Tcl_RecordAndEval tclc
|
||||
.BS
|
||||
.SH NAME
|
||||
Tcl_RecordAndEval \- save command on history list before evaluating
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fB#include <tcl.h>\fR
|
||||
.sp
|
||||
int
|
||||
\fBTcl_RecordAndEval\fR(\fIinterp, cmd, eval\fR)
|
||||
.SH ARGUMENTS
|
||||
.AS Tcl_Interp *interp;
|
||||
.AP Tcl_Interp *interp in
|
||||
Tcl interpreter in which to evaluate command.
|
||||
.AP char *cmd in
|
||||
Command (or sequence of commands) to execute.
|
||||
.AP int eval in
|
||||
0 means evaluate \fIcmd\fR, TCL_NO_EVAL means record it but don't
|
||||
evaluate it.
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
\fBTcl_RecordAndEval\fR is invoked to record a command as an event
|
||||
on the history list and then execute it.
|
||||
It returns a completion code such as TCL_OK just like \fBTcl_Eval\fR
|
||||
and it leaves information in \fIinterp->result\fR.
|
||||
If you don't want the command recorded on the history list then
|
||||
you should invoke \fBTcl_Eval\fR instead of \fBTcl_RecordAndEval\fR.
|
||||
Normally \fBTcl_RecordAndEval\fR is only called with top-level
|
||||
commands typed by the user, since the purpose of history is to
|
||||
allow the user to re-issue recently-invoked commands.
|
||||
If the \fIeval\fR argument is TCL_NO_EVAL then the command is
|
||||
recorded without being evaluated.
|
||||
|
||||
.SH KEYWORDS
|
||||
command, event, execute, history, interpreter, record
|
@ -1,57 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/RegExp.3,v 1.1 93/05/05 17:06:04 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS Tcl_RegExpMatch tclc 7.0
|
||||
.BS
|
||||
.SH NAME
|
||||
Tcl_RegExpMatch \- Test whether a string matches a regular expression
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fB#include <tcl.h>\fR
|
||||
.sp
|
||||
int
|
||||
\fBTcl_RegExpMatch\fR(\fIinterp\fR, \fIstring\fR, \fIregexp\fR)
|
||||
.SH ARGUMENTS
|
||||
.AS Tcl_Interp *interp
|
||||
.AP Tcl_Interp *interp in
|
||||
Tcl interpreter to use for error reporting.
|
||||
.AP char *string in
|
||||
String to test.
|
||||
.AP char *regexp in
|
||||
Regular expression to match against \fIstring\fR.
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
\fBTcl_RegExpMatch\fR determines whether its \fIstring\fR argument
|
||||
matches \fIregexp\fR, where \fIregexp\fR is interpreted
|
||||
as a regular expression using the same rules as for the
|
||||
\fBregexp\fR Tcl command.
|
||||
If there is a match then \fBTcl_RegExpMatch\fR returns 1.
|
||||
If there is no match then \fBTcl_RegExpMatch\fR returns 0.
|
||||
If an error occurs in the matching process (e.g. \fIregexp\fR
|
||||
is not a valid regular expression) then \fBTcl_RegExpMatch\fR
|
||||
returns \-1 and leaves an error message in \fIinterp->result\fR.
|
||||
|
||||
.SH KEYWORDS
|
||||
match, regular expression, string
|
@ -1,52 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1989-1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/StrMatch.3,v 1.7 93/04/01 09:25:35 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS Tcl_StringMatch tclc
|
||||
.BS
|
||||
.SH NAME
|
||||
Tcl_StringMatch \- test whether a string matches a pattern
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fB#include <tcl.h>\fR
|
||||
.sp
|
||||
int
|
||||
\fBTcl_StringMatch\fR(\fIstring\fR, \fIpattern\fR)
|
||||
.SH ARGUMENTS
|
||||
.AP char *string in
|
||||
String to test.
|
||||
.AP char *pattern in
|
||||
Pattern to match against string. May contain special
|
||||
characters from the set *?\e[].
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
This utility procedure determines whether a string matches
|
||||
a given pattern. If it does, then \fBTcl_StringMatch\fR returns
|
||||
1. Otherwise \fBTcl_StringMatch\fR returns 0. The algorithm
|
||||
used for matching is the same algorithm used in the ``string match''
|
||||
Tcl command and is similar to the algorithm used by the C-shell
|
||||
for file name matching; see the Tcl manual entry for details.
|
||||
|
||||
.SH KEYWORDS
|
||||
match, pattern, string
|
@ -1,85 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1989-1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/TildeSubst.3,v 1.10 93/04/08 14:00:43 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS Tcl_TildeSubst tclc 7.0
|
||||
.BS
|
||||
.SH NAME
|
||||
Tcl_TildeSubst \- replace tilde with home directory in a file name
|
||||
.SH SYNOPSIS
|
||||
.nf
|
||||
\fB#include <tcl.h>\fR
|
||||
.sp
|
||||
char *
|
||||
.VS
|
||||
\fBTcl_TildeSubst\fR(\fIinterp\fR, \fIname\fR, \fIbufferPtr)
|
||||
.VE
|
||||
.SH ARGUMENTS
|
||||
.AS Tcl_DString *bufferPtr
|
||||
.AP Tcl_Interp *interp in
|
||||
Interpreter in which to report an error, if any.
|
||||
.AP char *name in
|
||||
File name, which may start with a ``~''.
|
||||
.AP Tcl_DString *bufferPtr
|
||||
.VS
|
||||
If needed, this dynamic string is used to store the new file name.
|
||||
At the time of the call it should be uninitialized or empty. The
|
||||
caller must eventually call \fBTcl_DStringFree\fR to free up
|
||||
anything stored here.
|
||||
.VE
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
This utility procedure does tilde substition. If \fIname\fR doesn't
|
||||
start with a ``~'' character, then the procedure returns \fIname\fR.
|
||||
If \fIname\fR does start with a tilde, then \fBTcl_TildeSubst\fR
|
||||
returns a new string identical to \fIname\fR except that the first
|
||||
element of \fIname\fR is replaced with the location of the home
|
||||
directory for the given user. The substitution is carried out in
|
||||
the same way that it would be done by \fIcsh\fR. If the tilde is
|
||||
followed immediately by a slash, then the \fB$HOME\fR environment
|
||||
variable is substituted. Otherwise the characters between the
|
||||
tilde and the next slash are taken as a user name, which is
|
||||
looked up in the password file; the user's home directory is
|
||||
retrieved from the password file and substituted.
|
||||
.PP
|
||||
If
|
||||
.VS
|
||||
\fBTcl_TildeSubst\fR has to do tilde substitution then it uses
|
||||
the dynamic string at \fI*bufferPtr\fR to hold the new string it
|
||||
generates. After \fBTcl_TildeSubst\fR returns, the caller must
|
||||
eventually invoke \fBTcl_DStringFree\fR to free up any information
|
||||
placed in \fI*bufferPtr\fR. The caller need not know whether or
|
||||
not \fBTcl_TildeSubst\fR actually used the string; \fBTcl_TildeSubst\fR
|
||||
initializes \fI*bufferPtr\fR even if it doesn't use it, so the call to
|
||||
\fBTcl_DStringFree\fR will be safe in either case.
|
||||
.VE
|
||||
.PP
|
||||
If an error occurs (e.g. because there was no user by the given
|
||||
name) then NULL is returned and an error message will be left
|
||||
at \fIinterp->result\fR. It is assumed that \fIinterp->result\fR
|
||||
has been initialized in the standard way when \fBTcl_TildeSubst\fR
|
||||
is invoked.
|
||||
|
||||
.SH KEYWORDS
|
||||
file name, home directory, tilde, user
|
@ -1,45 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/append.n,v 1.1 93/04/14 16:52:54 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS append tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
append \- Append to variable
|
||||
.SH SYNOPSIS
|
||||
\fBappend \fIvarName value \fR?\fIvalue value ...\fR?
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
Append all of the \fIvalue\fR arguments to the current value
|
||||
of variable \fIvarName\fR. If \fIvarName\fR doesn't exist,
|
||||
it is given a value equal to the concatenation of all the
|
||||
\fIvalue\fR arguments.
|
||||
This command provides an efficient way to build up long
|
||||
variables incrementally.
|
||||
For example, ``\fBappend a $b\fR'' is much more efficient than
|
||||
``\fBset a $a$b\fR'' if \fB$a\fR is long.
|
||||
|
||||
.SH KEYWORDS
|
||||
append, variable
|
@ -1,41 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/break.n,v 1.1 93/04/14 16:52:56 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS break tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
break \- Abort looping command
|
||||
.SH SYNOPSIS
|
||||
\fBbreak\fR
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
This command may be invoked only inside the body of a looping command
|
||||
such as \fBfor\fR or \fBforeach\fR or \fBwhile\fR.
|
||||
It returns a TCL_BREAK code to signal the innermost containing
|
||||
loop command to return immediately.
|
||||
|
||||
.SH KEYWORDS
|
||||
abort, break, loop
|
@ -1,50 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/catch.n,v 1.1 93/04/14 16:52:57 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS catch tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
catch \- Evaluate script and trap exceptional returns
|
||||
.SH SYNOPSIS
|
||||
\fBcatch\fI script \fR?\fIvarName\fR?
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
The \fBcatch\fR command may be used to prevent errors from aborting
|
||||
command interpretation. \fBCatch\fR calls the Tcl interpreter recursively
|
||||
to execute \fIscript\fR, and always returns a TCL_OK code, regardless of
|
||||
any errors that might occur while executing \fIscript\fR. The return
|
||||
value from \fBcatch\fR is a decimal string giving the
|
||||
code returned by the Tcl interpreter after executing \fIscript\fR.
|
||||
This will be \fB0\fR (TCL_OK) if there were no errors in \fIscript\fR;
|
||||
otherwise
|
||||
it will have a non-zero value corresponding to one of the exceptional
|
||||
return codes (see tcl.h for the definitions of code values). If the
|
||||
\fIvarName\fR argument is given, then it gives the name of a variable;
|
||||
\fBcatch\fR will set the variable to the string returned
|
||||
from \fIscript\fR (either a result or an error message).
|
||||
|
||||
.SH KEYWORDS
|
||||
catch, error
|
@ -1,43 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/cd.n,v 1.1 93/04/14 16:52:58 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS cd tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
cd \- Change working directory
|
||||
.SH SYNOPSIS
|
||||
\fBcd \fR?\fIdirName\fR?
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
Change the current working directory to \fIdirName\fR, or to the
|
||||
home directory (as specified in the HOME environment variable) if
|
||||
\fIdirName\fR is not given.
|
||||
If \fIdirName\fR starts with a tilde, then tilde-expansion is
|
||||
done as described for \fBTcl_TildeSubst\fR.
|
||||
Returns an empty string.
|
||||
|
||||
.SH KEYWORDS
|
||||
working directory
|
@ -1,46 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/close.n,v 1.1 93/04/16 17:23:28 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS close tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
close \- Close an open file
|
||||
.SH SYNOPSIS
|
||||
\fBclose \fIfileId\fR
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
Closes the file given by \fIfileId\fR.
|
||||
\fIFileId\fR must be the return value from a previous invocation
|
||||
of the \fBopen\fR command; after this command, it should not be
|
||||
used anymore.
|
||||
If \fIfileId\fR refers to a command pipeline instead of a file,
|
||||
then \fBclose\fR waits for the children to complete.
|
||||
The normal result of this command is an empty string, but errors
|
||||
are returned if there are problems in closing the file or waiting
|
||||
for children to complete.
|
||||
|
||||
.SH KEYWORDS
|
||||
close, file
|
@ -1,57 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/concat.n,v 1.2 93/10/28 16:19:07 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS concat tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
concat \- Join lists together
|
||||
.SH SYNOPSIS
|
||||
.VS
|
||||
\fBconcat\fI \fR?\fIarg arg ...\fR?
|
||||
.VE
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
This command treats each argument as a list and concatenates them
|
||||
into a single list.
|
||||
It also eliminates leading and trailing spaces in the \fIarg\fR's
|
||||
and adds a single separator space between \fIarg\fR's.
|
||||
It permits any number of arguments. For example,
|
||||
the command
|
||||
.DS
|
||||
\fBconcat a b {c d e} {f {g h}}\fR
|
||||
.DE
|
||||
will return
|
||||
.DS
|
||||
\fBa b c d e f {g h}\fR
|
||||
.DE
|
||||
as its result.
|
||||
.PP
|
||||
.VS
|
||||
If no \fIarg\fRs are supplied, the result is an empty string.
|
||||
.VE
|
||||
|
||||
.SH KEYWORDS
|
||||
concatenate, join, lists
|
@ -1,43 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/continue.n,v 1.1 93/04/16 17:23:30 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS continue tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
continue \- Skip to the next iteration of a loop
|
||||
.SH SYNOPSIS
|
||||
\fBcontinue\fR
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
This command may be invoked only inside the body of a looping command
|
||||
such as \fBfor\fR or \fBforeach\fR or \fBwhile\fR.
|
||||
It returns a TCL_CONTINUE code
|
||||
to signal the innermost containing loop command to skip the
|
||||
remainder of the loop's body
|
||||
but continue with the next iteration of the loop.
|
||||
|
||||
.SH KEYWORDS
|
||||
continue, iteration, loop
|
@ -1,43 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/eof.n,v 1.1 93/04/16 17:23:31 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS eof tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
eof \- Check for end-of-file condition on open file
|
||||
.SH SYNOPSIS
|
||||
\fBeof \fIfileId\fR
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
Returns 1 if an end-of-file condition has occurred on \fIfileId\fR,
|
||||
0 otherwise.
|
||||
\fIFileId\fR must have been the return
|
||||
value from a previous call to \fBopen\fR, or it may be \fBstdin\fR,
|
||||
\fBstdout\fR, or \fBstderr\fR to refer to one of the standard I/O
|
||||
channels.
|
||||
|
||||
.SH KEYWORDS
|
||||
end, file
|
@ -1,43 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/eval.n,v 1.1 93/05/10 17:10:16 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS eval tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
eval \- Evaluate a Tcl script
|
||||
.SH SYNOPSIS
|
||||
\fBeval \fIarg \fR?\fIarg ...\fR?
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
\fBEval\fR takes one or more arguments, which together comprise a Tcl
|
||||
script containing one or more commands.
|
||||
\fBEval\fR concatenates all its arguments in the same
|
||||
fashion as the \fBconcat\fR command, passes the concatenated string to the
|
||||
Tcl interpreter recursively, and returns the result of that
|
||||
evaluation (or any error generated by it).
|
||||
|
||||
.SH KEYWORDS
|
||||
concatenate, evaluate, script
|
@ -1,198 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/exec.n,v 1.6 93/07/23 15:13:34 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS exec tcl 7.0
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
exec \- Invoke subprocess(es)
|
||||
.SH SYNOPSIS
|
||||
\fBexec \fR?\fIswitches\fR? \fIarg \fR?\fIarg ...\fR?
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
This command treats its arguments as the specification
|
||||
of one or more subprocesses to execute.
|
||||
The arguments take the form of a standard shell pipeline
|
||||
where each \fIarg\fR becomes one word of a command, and
|
||||
each distinct command becomes a subprocess.
|
||||
.PP
|
||||
If the initial arguments to \fBexec\fR start with \fB\-\fR then
|
||||
.VS
|
||||
they are treated as command-line switches and are not part
|
||||
of the pipeline specification. The following switches are
|
||||
currently supported:
|
||||
.TP 13
|
||||
\fB\-keepnewline
|
||||
Retains a trailing newline in the pipeline's output.
|
||||
Normally a trailing newline will be deleted.
|
||||
.TP 13
|
||||
\fB\-\|\-\fR
|
||||
Marks the end of switches. The argument following this one will
|
||||
be treated as the first \fIarg\fR even if it starts with a \fB\-.
|
||||
.VE
|
||||
.PP
|
||||
If an \fIarg\fR (or pair of \fIarg\fR's) has one of the forms
|
||||
described below then it is used by \fBexec\fR to control the
|
||||
flow of input and output among the subprocess(es).
|
||||
Such arguments will not be passed to the subprocess(es). In forms
|
||||
.VS
|
||||
such as ``< \fIfileName\fR'' \fIfileName\fR may either be in a
|
||||
separate argument from ``<'' or in the same argument with no
|
||||
intervening space (i.e. ``<\fIfileName\fR'').
|
||||
.VE
|
||||
.TP 15
|
||||
|\fR
|
||||
Separates distinct commands in the pipeline. The standard output
|
||||
of the preceding command will be piped into the standard input
|
||||
of the next command.
|
||||
.TP 15
|
||||
|&\fR
|
||||
Separates distinct commands in the pipeline. Both standard output
|
||||
and standard error of the preceding command will be piped into
|
||||
the standard input of the next command.
|
||||
This form of redirection overrides forms such as 2> and >&.
|
||||
.TP 15
|
||||
<\0\fIfileName\fR
|
||||
The file named by \fIfileName\fR is opened and used as the standard
|
||||
input for the first command in the pipeline.
|
||||
.TP 15
|
||||
<@\0\fIfileId\fR
|
||||
.VS
|
||||
\fIFileId\fR must be the identifier for an open file, such as the return
|
||||
value from a previous call to \fBopen\fR.
|
||||
It is used as the standard input for the first command in the pipeline.
|
||||
\fIFileId\fR must have been opened for reading.
|
||||
.VE
|
||||
.TP 15
|
||||
<<\0\fIvalue\fR
|
||||
\fIValue\fR is passed to the first command as its standard input.
|
||||
.TP 15
|
||||
>\0\fIfileName\fR
|
||||
Standard output from the last command is redirected to the file named
|
||||
\fIfileName\fR, overwriting its previous contents.
|
||||
.TP 15
|
||||
2>\0\fIfileName\fR
|
||||
.VS
|
||||
Standard error from all commands in the pipeline is redirected to the
|
||||
file named \fIfileName\fR, overwriting its previous contents.
|
||||
.TP 15
|
||||
>&\0\fIfileName\fR
|
||||
Both standard output from the last command and standard error from all
|
||||
commands are redirected to the file named \fIfileName\fR, overwriting
|
||||
its previous contents.
|
||||
.VE
|
||||
.TP 15
|
||||
>>\0\fIfileName\fR
|
||||
Standard output from the last command is
|
||||
redirected to the file named \fIfileName\fR, appending to it rather
|
||||
than overwriting it.
|
||||
.TP 15
|
||||
2>>\0\fIfileName\fR
|
||||
.VS
|
||||
Standard error from all commands in the pipeline is
|
||||
redirected to the file named \fIfileName\fR, appending to it rather
|
||||
than overwriting it.
|
||||
.TP 15
|
||||
>>&\0\fIfileName\fR
|
||||
Both standard output from the last command and standard error from
|
||||
all commands are redirected to the file named \fIfileName\fR,
|
||||
appending to it rather than overwriting it.
|
||||
.TP 15
|
||||
>@\0\fIfileId\fR
|
||||
\fIFileId\fR must be the identifier for an open file, such as the return
|
||||
value from a previous call to \fBopen\fR.
|
||||
Standard output from the last command is redirected to \fIfileId\fR's
|
||||
file, which must have been opened for writing.
|
||||
.TP 15
|
||||
2>@\0\fIfileId\fR
|
||||
\fIFileId\fR must be the identifier for an open file, such as the return
|
||||
value from a previous call to \fBopen\fR.
|
||||
Standard error from all commands in the pipeline is
|
||||
redirected to \fIfileId\fR's file.
|
||||
The file must have been opened for writing.
|
||||
.TP 15
|
||||
>&@\0\fIfileId\fR
|
||||
\fIFileId\fR must be the identifier for an open file, such as the return
|
||||
value from a previous call to \fBopen\fR.
|
||||
Both standard output from the last command and standard error from
|
||||
all commands are redirected to \fIfileId\fR's file.
|
||||
The file must have been opened for writing.
|
||||
.VE
|
||||
.PP
|
||||
If standard output has not been redirected then the \fBexec\fR
|
||||
command returns the standard output from the last command
|
||||
in the pipeline.
|
||||
If any of the commands in the pipeline exit abnormally or
|
||||
are killed or suspended, then \fBexec\fR will return an error
|
||||
and the error message will include the pipeline's output followed by
|
||||
error messages describing the abnormal terminations; the
|
||||
\fBerrorCode\fR variable will contain additional information
|
||||
about the last abnormal termination encountered.
|
||||
If any of the commands writes to its standard error file and that
|
||||
standard error isn't redirected,
|
||||
then \fBexec\fR will return an error; the error message
|
||||
will include the pipeline's standard output, followed by messages
|
||||
about abnormal terminations (if any), followed by the standard error
|
||||
output.
|
||||
.PP
|
||||
If the last character of the result or error message
|
||||
is a newline then that character is normally deleted
|
||||
from the result or error message.
|
||||
This is consistent with other Tcl return values, which don't
|
||||
normally end with newlines.
|
||||
.VS
|
||||
However, if \fB\-keepnewline\fR is specified then the trailing
|
||||
newline is retained.
|
||||
.VE
|
||||
.PP
|
||||
If standard input isn't redirected with ``<'' or ``<<''
|
||||
or ``<@'' then the standard input for the first command in the
|
||||
pipeline is taken from the application's current standard input.
|
||||
.PP
|
||||
If the last \fIarg\fR is ``&'' then the pipeline will be
|
||||
executed in background.
|
||||
.VS
|
||||
In this case the \fBexec\fR command will return a list whose
|
||||
elements are the process identifiers for all of the subprocesses
|
||||
in the pipeline.
|
||||
.VE
|
||||
The standard output from the last command in the pipeline will
|
||||
go to the application's standard output if it hasn't been
|
||||
redirected, and error output from all of
|
||||
the commands in the pipeline will go to the application's
|
||||
standard error file unless redirected.
|
||||
.PP
|
||||
The first word in each command is taken as the command name;
|
||||
tilde-substitution is performed on it, and if the result contains
|
||||
no slashes then the directories
|
||||
in the PATH environment variable are searched for
|
||||
an executable by the given name.
|
||||
If the name contains a slash then it must refer to an executable
|
||||
reachable from the current directory.
|
||||
No ``glob'' expansion or other shell-like substitutions
|
||||
are performed on the arguments to commands.
|
||||
|
||||
.SH KEYWORDS
|
||||
execute, pipeline, redirection, subprocess
|
@ -1,41 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/exit.n,v 1.2 93/06/17 13:31:30 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS exit tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
exit \- End the application
|
||||
.SH SYNOPSIS
|
||||
\fBexit \fR?\fIreturnCode\fR?
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
Terminate the process, returning \fIreturnCode\fR to the
|
||||
system as the exit status.
|
||||
If \fIreturnCode\fR isn't specified then it defaults
|
||||
to 0.
|
||||
|
||||
.SH KEYWORDS
|
||||
exit, process
|
@ -1,146 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/file.n,v 1.1 93/05/03 17:09:38 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS file tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
file \- Manipulate file names and attributes
|
||||
.SH SYNOPSIS
|
||||
\fBfile \fIoption\fR \fIname\fR ?\fIarg arg ...\fR?
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
This command provides several operations on a file's name or attributes.
|
||||
\fIName\fR is the name of a file;
|
||||
if it starts with a tilde, then tilde substitution is done before
|
||||
executing the command (see the manual entry for \fBTcl_TildeSubst\fR
|
||||
for details).
|
||||
\fIOption\fR indicates what to do with the file name. Any unique
|
||||
abbreviation for \fIoption\fR is acceptable. The valid options are:
|
||||
.TP
|
||||
\fBfile \fBatime \fIname\fR
|
||||
Returns a decimal string giving the time at which file \fIname\fR
|
||||
was last accessed. The time is measured in the standard POSIX
|
||||
fashion as seconds from a fixed starting time (often January 1, 1970).
|
||||
If the file doesn't exist or its access time cannot be queried then an
|
||||
error is generated.
|
||||
.TP
|
||||
\fBfile \fBdirname \fIname\fR
|
||||
Returns all of the characters in \fIname\fR up to but not including
|
||||
the last slash character. If there are no slashes in \fIname\fR
|
||||
then returns ``.''. If the last slash in \fIname\fR is its first
|
||||
character, then return ``/''.
|
||||
.TP
|
||||
\fBfile \fBexecutable \fIname\fR
|
||||
Returns \fB1\fR if file \fIname\fR is executable by
|
||||
the current user, \fB0\fR otherwise.
|
||||
.TP
|
||||
\fBfile \fBexists \fIname\fR
|
||||
Returns \fB1\fR if file \fIname\fR exists and the current user has
|
||||
search privileges for the directories leading to it, \fB0\fR otherwise.
|
||||
.TP
|
||||
\fBfile \fBextension \fIname\fR
|
||||
Returns all of the characters in \fIname\fR after and including the
|
||||
last dot in \fIname\fR. If there is no dot in \fIname\fR then returns
|
||||
the empty string.
|
||||
.TP
|
||||
\fBfile \fBisdirectory \fIname\fR
|
||||
Returns \fB1\fR if file \fIname\fR is a directory,
|
||||
\fB0\fR otherwise.
|
||||
.TP
|
||||
\fBfile \fBisfile \fIname\fR
|
||||
Returns \fB1\fR if file \fIname\fR is a regular file,
|
||||
\fB0\fR otherwise.
|
||||
.TP
|
||||
\fBfile lstat \fIname varName\fR
|
||||
Same as \fBstat\fR option (see below) except uses the \fIlstat\fR
|
||||
kernel call instead of \fIstat\fR. This means that if \fIname\fR
|
||||
refers to a symbolic link the information returned in \fIvarName\fR
|
||||
is for the link rather than the file it refers to. On systems that
|
||||
don't support symbolic links this option behaves exactly the same
|
||||
as the \fBstat\fR option.
|
||||
.TP
|
||||
\fBfile \fBmtime \fIname\fR
|
||||
Returns a decimal string giving the time at which file \fIname\fR
|
||||
was last modified. The time is measured in the standard POSIX
|
||||
fashion as seconds from a fixed starting time (often January 1, 1970).
|
||||
If the file doesn't exist or its modified time cannot be queried then an
|
||||
error is generated.
|
||||
.TP
|
||||
\fBfile \fBowned \fIname\fR
|
||||
Returns \fB1\fR if file \fIname\fR is owned by the current user,
|
||||
\fB0\fR otherwise.
|
||||
.TP
|
||||
\fBfile \fBreadable \fIname\fR
|
||||
Returns \fB1\fR if file \fIname\fR is readable by
|
||||
the current user, \fB0\fR otherwise.
|
||||
.TP
|
||||
\fBfile readlink \fIname\fR
|
||||
Returns the value of the symbolic link given by \fIname\fR (i.e. the
|
||||
name of the file it points to). If
|
||||
\fIname\fR isn't a symbolic link or its value cannot be read, then
|
||||
an error is returned. On systems that don't support symbolic links
|
||||
this option is undefined.
|
||||
.TP
|
||||
\fBfile \fBrootname \fIname\fR
|
||||
Returns all of the characters in \fIname\fR up to but not including
|
||||
the last ``.'' character in the name. If \fIname\fR doesn't contain
|
||||
a dot, then returns \fIname\fR.
|
||||
.TP
|
||||
\fBfile \fBsize \fIname\fR
|
||||
Returns a decimal string giving the size of file \fIname\fR in bytes.
|
||||
If the file doesn't exist or its size cannot be queried then an
|
||||
error is generated.
|
||||
.TP
|
||||
\fBfile \fBstat \fIname varName\fR
|
||||
Invokes the \fBstat\fR kernel call on \fIname\fR, and uses the
|
||||
variable given by \fIvarName\fR to hold information returned from
|
||||
the kernel call.
|
||||
\fIVarName\fR is treated as an array variable,
|
||||
and the following elements of that variable are set: \fBatime\fR,
|
||||
\fBctime\fR, \fBdev\fR, \fBgid\fR, \fBino\fR, \fBmode\fR, \fBmtime\fR,
|
||||
\fBnlink\fR, \fBsize\fR, \fBtype\fR, \fBuid\fR.
|
||||
Each element except \fBtype\fR is a decimal string with the value of
|
||||
the corresponding field from the \fBstat\fR return structure; see the
|
||||
manual entry for \fBstat\fR for details on the meanings of the values.
|
||||
The \fBtype\fR element gives the type of the file in the same form
|
||||
returned by the command \fBfile type\fR.
|
||||
This command returns an empty string.
|
||||
.TP
|
||||
\fBfile \fBtail \fIname\fR
|
||||
Returns all of the characters in \fIname\fR after the last slash.
|
||||
If \fIname\fR contains no slashes then returns \fIname\fR.
|
||||
.TP
|
||||
\fBfile \fBtype \fIname\fR
|
||||
Returns a string giving the type of file \fIname\fR, which will be
|
||||
one of \fBfile\fR, \fBdirectory\fR, \fBcharacterSpecial\fR,
|
||||
\fBblockSpecial\fR, \fBfifo\fR, \fBlink\fR, or \fBsocket\fR.
|
||||
.TP
|
||||
\fBfile \fBwritable \fIname\fR
|
||||
Returns \fB1\fR if file \fIname\fR is writable by
|
||||
the current user, \fB0\fR otherwise.
|
||||
|
||||
.SH KEYWORDS
|
||||
attributes, directory, file, name, stat
|
@ -1,43 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/flush.n,v 1.1 93/05/03 17:09:40 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS flush tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
flush \- Flush buffered output for a file
|
||||
.SH SYNOPSIS
|
||||
\fBflush \fIfileId\fR
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
Flushes any output that has been buffered for \fIfileId\fR.
|
||||
\fIFileId\fR must have been the return
|
||||
value from a previous call to \fBopen\fR, or it may be
|
||||
\fBstdout\fR or \fBstderr\fR to access one of the standard I/O streams;
|
||||
it must refer to a file that was opened for writing.
|
||||
The command returns an empty string.
|
||||
|
||||
.SH KEYWORDS
|
||||
buffer, file, flush, output
|
@ -1,47 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/foreach.n,v 1.1 93/05/03 17:09:42 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS foreach tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
foreach \- Iterate over all elements in a list
|
||||
.SH SYNOPSIS
|
||||
\fBforeach \fIvarname list body\fR
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
In this command \fIvarname\fR is the name of a variable, \fIlist\fR
|
||||
is a list of values to assign to \fIvarname\fR, and \fIbody\fR is a
|
||||
Tcl script.
|
||||
For each element of \fIlist\fR (in order
|
||||
from left to right), \fBforeach\fR assigns the contents of the
|
||||
field to \fIvarname\fR as if the \fBlindex\fR command had been used
|
||||
to extract the field, then calls the Tcl interpreter to execute
|
||||
\fIbody\fR. The \fBbreak\fR and \fBcontinue\fR statements may be
|
||||
invoked inside \fIbody\fR, with the same effect as in the \fBfor\fR
|
||||
command. \fBForeach\fR returns an empty string.
|
||||
|
||||
.SH KEYWORDS
|
||||
foreach, iteration, list, looping
|
@ -1,61 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/gets.n,v 1.2 93/10/04 16:01:09 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS gets tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
gets \- Read a line from a file
|
||||
.SH SYNOPSIS
|
||||
\fBgets \fIfileId\fR ?\fIvarName\fR?
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
This command reads the next line from the file given by \fIfileId\fR
|
||||
and discards the terminating newline character.
|
||||
If \fIvarName\fR is specified then the line is placed in the variable
|
||||
by that name and the return value is a count of the number of characters
|
||||
read (not including the newline).
|
||||
If the end of the file is reached before reading
|
||||
any characters then \-1 is returned and \fIvarName\fR is set to an
|
||||
empty string.
|
||||
If \fIvarName\fR is not specified then the return value will be
|
||||
the line (minus the newline character) or an empty string if
|
||||
the end of the file is reached before reading any characters.
|
||||
An empty string will also be returned if a line contains no characters
|
||||
except the newline, so \fBeof\fR may have to be used to determine
|
||||
what really happened.
|
||||
If the last character in the file is not a newline character then
|
||||
\fBgets\fR behaves as if there were an additional newline character
|
||||
at the end of the file.
|
||||
\fIFileId\fR must be \fBstdin\fR or the return value from a previous
|
||||
call to \fBopen\fR; it must refer to a file that was opened
|
||||
for reading.
|
||||
.VS
|
||||
Any existing end-of-file or error condition on the file is cleared at
|
||||
the beginning of the \fBgets\fR command.
|
||||
.VE
|
||||
|
||||
.SH KEYWORDS
|
||||
file, line, read
|
@ -1,43 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/global.n,v 1.1 93/05/03 17:09:46 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS global tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
global \- Access global variables
|
||||
.SH SYNOPSIS
|
||||
\fBglobal \fIvarname \fR?\fIvarname ...\fR?
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
This command is ignored unless a Tcl procedure is being interpreted.
|
||||
If so then it declares the given \fIvarname\fR's to be global variables
|
||||
rather than local ones. For the duration of the current procedure
|
||||
(and only while executing in the current procedure), any reference to
|
||||
any of the \fIvarname\fRs will refer to the global variable by the same
|
||||
name.
|
||||
|
||||
.SH KEYWORDS
|
||||
global, procedure, variable
|
@ -1,44 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/incr.n,v 1.1 93/05/03 17:34:02 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS incr tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
incr \- Increment the value of a variable
|
||||
.SH SYNOPSIS
|
||||
\fBincr \fIvarName \fR?\fIincrement\fR?
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
Increments the value stored in the variable whose name is \fIvarName\fR.
|
||||
The value of the variable must be an integer.
|
||||
If \fIincrement\fR is supplied then its value (which must be an
|
||||
integer) is added to the value of variable \fIvarName\fR; otherwise
|
||||
1 is added to \fIvarName\fR.
|
||||
The new value is stored as a decimal string in variable \fIvarName\fR
|
||||
and also returned as result.
|
||||
|
||||
.SH KEYWORDS
|
||||
add, increment, variable, value
|
@ -1,42 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/join.n,v 1.1 93/05/03 17:34:03 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS join tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
join \- Create a string by joining together list elements
|
||||
.SH SYNOPSIS
|
||||
\fBjoin \fIlist \fR?\fIjoinString\fR?
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
The \fIlist\fR argument must be a valid Tcl list.
|
||||
This command returns the string
|
||||
formed by joining all of the elements of \fIlist\fR together with
|
||||
\fIjoinString\fR separating each adjacent pair of elements.
|
||||
The \fIjoinString\fR argument defaults to a space character.
|
||||
|
||||
.SH KEYWORDS
|
||||
element, join, list, separator
|
@ -1,48 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/lappend.n,v 1.1 93/05/03 17:34:04 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS lappend tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
lappend \- Append list elements onto a variable
|
||||
.SH SYNOPSIS
|
||||
\fBlappend \fIvarName value \fR?\fIvalue value ...\fR?
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
This command treats the variable given by \fIvarName\fR as a list
|
||||
and appends each of the \fIvalue\fR arguments to that list as a separate
|
||||
element, with spaces between elements.
|
||||
If \fIvarName\fR doesn't exist, it is created as a list with elements
|
||||
given by the \fIvalue\fR arguments.
|
||||
\fBLappend\fR is similar to \fBappend\fR except that the \fIvalue\fRs
|
||||
are appended as list elements rather than raw text.
|
||||
This command provides a relatively efficient way to build up
|
||||
large lists. For example, ``\fBlappend a $b\fR'' is much
|
||||
more efficient than ``\fBset a [concat $a [list $b]]\fR'' when
|
||||
\fB$a\fR is long.
|
||||
|
||||
.SH KEYWORDS
|
||||
append, element, list, variable
|
@ -1,46 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/lindex.n,v 1.1 93/05/03 17:34:05 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS lindex tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
lindex \- Retrieve an element from a list
|
||||
.SH SYNOPSIS
|
||||
\fBlindex \fIlist index\fR
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
This command treats \fIlist\fR as a Tcl list and returns the
|
||||
\fIindex\fR'th element from it (0 refers to the first element of the list).
|
||||
In extracting the element, \fIlindex\fR observes the same rules
|
||||
concerning braces and quotes and backslashes as the Tcl command
|
||||
interpreter; however, variable
|
||||
substitution and command substitution do not occur.
|
||||
If \fIindex\fR is negative or greater than or equal to the number
|
||||
of elements in \fIvalue\fR, then an empty
|
||||
string is returned.
|
||||
|
||||
.SH KEYWORDS
|
||||
element, index, list
|
@ -1,45 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/linsert.n,v 1.1 93/05/03 17:34:05 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS linsert tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
linsert \- Insert elements into a list
|
||||
.SH SYNOPSIS
|
||||
\fBlinsert \fIlist index element \fR?\fIelement element ...\fR?
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
This command produces a new list from \fIlist\fR by inserting all
|
||||
of the \fIelement\fR arguments just before the \fIindex\fRth
|
||||
element of \fIlist\fR. Each \fIelement\fR argument will become
|
||||
a separate element of the new list. If \fIindex\fR is less than
|
||||
or equal to zero, then the new elements are inserted at the
|
||||
beginning of the list. If \fIindex\fR is greater than or equal
|
||||
to the number of elements in the list, then the new elements are
|
||||
appended to the list.
|
||||
|
||||
.SH KEYWORDS
|
||||
element, insert, list
|
@ -1,62 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/list.n,v 1.2 93/10/28 16:19:11 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS list tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
list \- Create a list
|
||||
.SH SYNOPSIS
|
||||
.VS
|
||||
\fBlist \fR?\fIarg arg ...\fR?
|
||||
.VE
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
This command returns a list comprised of all the \fIarg\fRs,
|
||||
.VS
|
||||
or an empty string if no \fIarg\fRs are specified.
|
||||
.VE
|
||||
Braces and backslashes get added as necessary, so that the \fBindex\fR command
|
||||
may be used on the result to re-extract the original arguments, and also
|
||||
so that \fBeval\fR may be used to execute the resulting list, with
|
||||
\fIarg1\fR comprising the command's name and the other \fIarg\fRs comprising
|
||||
its arguments. \fBList\fR produces slightly different results than
|
||||
\fBconcat\fR: \fBconcat\fR removes one level of grouping before forming
|
||||
the list, while \fBlist\fR works directly from the original arguments.
|
||||
For example, the command
|
||||
.DS
|
||||
\fBlist a b {c d e} {f {g h}}
|
||||
.DE
|
||||
will return
|
||||
.DS
|
||||
\fBa b {c d e} {f {g h}}
|
||||
.DE
|
||||
while \fBconcat\fR with the same arguments will return
|
||||
.DS
|
||||
\fBa b c d e f {g h}\fR
|
||||
.DE
|
||||
|
||||
.SH KEYWORDS
|
||||
element, list
|
@ -1,39 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/llength.n,v 1.1 93/05/03 17:34:07 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS llength tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
llength \- Count the number of elements in a list
|
||||
.SH SYNOPSIS
|
||||
\fBllength \fIlist\fR
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
Treats \fIlist\fR as a list and returns a decimal string giving
|
||||
the number of elements in it.
|
||||
|
||||
.SH KEYWORDS
|
||||
element, list, length
|
@ -1,51 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/lrange.n,v 1.1 93/05/03 17:34:07 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS lrange tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
lrange \- Return one or more adjacent elements from a list
|
||||
.SH SYNOPSIS
|
||||
\fBlrange \fIlist first last
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
\fIList\fR must be a valid Tcl list. This command will
|
||||
return a new list consisting of elements
|
||||
\fIfirst\fR through \fIlast\fR, inclusive.
|
||||
\fILast\fR may be \fBend\fR (or any
|
||||
abbreviation of it) to refer to the last element of the list.
|
||||
If \fIfirst\fR is less than zero, it is treated as if it were zero.
|
||||
If \fIlast\fR is greater than or equal to the number of elements
|
||||
in the list, then it is treated as if it were \fBend\fR.
|
||||
If \fIfirst\fR is greater than \fIlast\fR then an empty string
|
||||
is returned.
|
||||
Note: ``\fBlrange \fIlist first first\fR'' does not always produce the
|
||||
same result as ``\fBlindex \fIlist first\fR'' (although it often does
|
||||
for simple fields that aren't enclosed in braces); it does, however,
|
||||
produce exactly the same results as ``\fBlist [lindex \fIlist first\fB]\fR''
|
||||
|
||||
.SH KEYWORDS
|
||||
element, list, range, sublist
|
@ -1,55 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/lreplace.n,v 1.1 93/05/03 17:34:08 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS lreplace tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
lreplace \- Replace elements in a list with new elements
|
||||
.SH SYNOPSIS
|
||||
\fBlreplace \fIlist first last \fR?\fIelement element ...\fR?
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
\fBLreplace\fR returns a new list formed by replacing one or more elements of
|
||||
\fIlist\fR with the \fIelement\fR arguments.
|
||||
\fIFirst\fR gives the index in \fIlist\fR of the first element
|
||||
to be replaced.
|
||||
If \fIfirst\fR is less than zero then it refers to the first
|
||||
element of \fIlist\fR; the element indicated by \fIfirst\fR
|
||||
must exist in the list.
|
||||
\fILast\fR gives the index in \fIlist\fR of the last element
|
||||
to be replaced; it must be greater than or equal to \fIfirst\fR.
|
||||
\fILast\fR may be \fBend\fR (or any abbreviation of it) to indicate
|
||||
that all elements between \fIfirst\fR and the end of the list should
|
||||
be replaced.
|
||||
The \fIelement\fR arguments specify zero or more new arguments to
|
||||
be added to the list in place of those that were deleted.
|
||||
Each \fIelement\fR argument will become a separate element of
|
||||
the list.
|
||||
If no \fIelement\fR arguments are specified, then the elements
|
||||
between \fIfirst\fR and \fIlast\fR are simply deleted.
|
||||
|
||||
.SH KEYWORDS
|
||||
element, list, replace
|
@ -1,182 +0,0 @@
|
||||
.\" The definitions below are for supplemental macros used in Tcl/Tk
|
||||
.\" manual entries.
|
||||
.\"
|
||||
.\" .HS name section [date [version]]
|
||||
.\" Replacement for .TH in other man pages. See below for valid
|
||||
.\" section names.
|
||||
.\"
|
||||
.\" .AP type name in/out [indent]
|
||||
.\" Start paragraph describing an argument to a library procedure.
|
||||
.\" type is type of argument (int, etc.), in/out is either "in", "out",
|
||||
.\" or "in/out" to describe whether procedure reads or modifies arg,
|
||||
.\" and indent is equivalent to second arg of .IP (shouldn't ever be
|
||||
.\" needed; use .AS below instead)
|
||||
.\"
|
||||
.\" .AS [type [name]]
|
||||
.\" Give maximum sizes of arguments for setting tab stops. Type and
|
||||
.\" name are examples of largest possible arguments that will be passed
|
||||
.\" to .AP later. If args are omitted, default tab stops are used.
|
||||
.\"
|
||||
.\" .BS
|
||||
.\" Start box enclosure. From here until next .BE, everything will be
|
||||
.\" enclosed in one large box.
|
||||
.\"
|
||||
.\" .BE
|
||||
.\" End of box enclosure.
|
||||
.\"
|
||||
.\" .VS
|
||||
.\" Begin vertical sidebar, for use in marking newly-changed parts
|
||||
.\" of man pages.
|
||||
.\"
|
||||
.\" .VE
|
||||
.\" End of vertical sidebar.
|
||||
.\"
|
||||
.\" .DS
|
||||
.\" Begin an indented unfilled display.
|
||||
.\"
|
||||
.\" .DE
|
||||
.\" End of indented unfilled display.
|
||||
.\"
|
||||
'\" # Heading for Tcl/Tk man pages
|
||||
.de HS
|
||||
.ds ^3 \\0
|
||||
.if !"\\$3"" .ds ^3 \\$3
|
||||
.if '\\$2'cmds' .TH \\$1 1 \\*(^3 \\$4
|
||||
.if '\\$2'lib' .TH \\$1 3 \\*(^3 \\$4
|
||||
.if '\\$2'tcl' .TH \\$1 n \\*(^3 Tcl "Tcl Built-In Commands"
|
||||
.if '\\$2'tk' .TH \\$1 n \\*(^3 Tk "Tk Commands"
|
||||
.if '\\$2'tclc' .TH \\$1 3 \\*(^3 Tcl "Tcl Library Procedures"
|
||||
.if '\\$2'tkc' .TH \\$1 3 \\*(^3 Tk "Tk Library Procedures"
|
||||
.if '\\$2'tclcmds' .TH \\$1 1 \\*(^3 Tk "Tcl Applications"
|
||||
.if '\\$2'tkcmds' .TH \\$1 1 \\*(^3 Tk "Tk Applications"
|
||||
.if t .wh -1.3i ^B
|
||||
.nr ^l \\n(.l
|
||||
.ad b
|
||||
..
|
||||
'\" # Start an argument description
|
||||
.de AP
|
||||
.ie !"\\$4"" .TP \\$4
|
||||
.el \{\
|
||||
. ie !"\\$2"" .TP \\n()Cu
|
||||
. el .TP 15
|
||||
.\}
|
||||
.ie !"\\$3"" \{\
|
||||
.ta \\n()Au \\n()Bu
|
||||
\&\\$1 \\fI\\$2\\fP (\\$3)
|
||||
.\".b
|
||||
.\}
|
||||
.el \{\
|
||||
.br
|
||||
.ie !"\\$2"" \{\
|
||||
\&\\$1 \\fI\\$2\\fP
|
||||
.\}
|
||||
.el \{\
|
||||
\&\\fI\\$1\\fP
|
||||
.\}
|
||||
.\}
|
||||
..
|
||||
'\" # define tabbing values for .AP
|
||||
.de AS
|
||||
.nr )A 10n
|
||||
.if !"\\$1"" .nr )A \\w'\\$1'u+3n
|
||||
.nr )B \\n()Au+15n
|
||||
.\"
|
||||
.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
|
||||
.nr )C \\n()Bu+\\w'(in/out)'u+2n
|
||||
..
|
||||
'\" # BS - start boxed text
|
||||
'\" # ^y = starting y location
|
||||
'\" # ^b = 1
|
||||
.de BS
|
||||
.br
|
||||
.mk ^y
|
||||
.nr ^b 1u
|
||||
.if n .nf
|
||||
.if n .ti 0
|
||||
.if n \l'\\n(.lu\(ul'
|
||||
.if n .fi
|
||||
..
|
||||
'\" # BE - end boxed text (draw box now)
|
||||
.de BE
|
||||
.nf
|
||||
.ti 0
|
||||
.mk ^t
|
||||
.ie n \l'\\n(^lu\(ul'
|
||||
.el \{\
|
||||
.\" Draw four-sided box normally, but don't draw top of
|
||||
.\" box if the box started on an earlier page.
|
||||
.ie !\\n(^b-1 \{\
|
||||
\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
|
||||
.\}
|
||||
.el \}\
|
||||
\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
|
||||
.\}
|
||||
.\}
|
||||
.fi
|
||||
.br
|
||||
.nr ^b 0
|
||||
..
|
||||
'\" # VS - start vertical sidebar
|
||||
'\" # ^Y = starting y location
|
||||
'\" # ^v = 1 (for troff; for nroff this doesn't matter)
|
||||
.de VS
|
||||
.mk ^Y
|
||||
.ie n 'mc \s12\(br\s0
|
||||
.el .nr ^v 1u
|
||||
..
|
||||
'\" # VE - end of vertical sidebar
|
||||
.de VE
|
||||
.ie n 'mc
|
||||
.el \{\
|
||||
.ev 2
|
||||
.nf
|
||||
.ti 0
|
||||
.mk ^t
|
||||
\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
|
||||
.sp -1
|
||||
.fi
|
||||
.ev
|
||||
.\}
|
||||
.nr ^v 0
|
||||
..
|
||||
'\" # Special macro to handle page bottom: finish off current
|
||||
'\" # box/sidebar if in box/sidebar mode, then invoked standard
|
||||
'\" # page bottom macro.
|
||||
.de ^B
|
||||
.ev 2
|
||||
'ti 0
|
||||
'nf
|
||||
.mk ^t
|
||||
.if \\n(^b \{\
|
||||
.\" Draw three-sided box if this is the box's first page,
|
||||
.\" draw two sides but no top otherwise.
|
||||
.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
|
||||
.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
|
||||
.\}
|
||||
.if \\n(^v \{\
|
||||
.nr ^x \\n(^tu+1v-\\n(^Yu
|
||||
\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
|
||||
.\}
|
||||
.bp
|
||||
'fi
|
||||
.ev
|
||||
.if \\n(^b \{\
|
||||
.mk ^y
|
||||
.nr ^b 2
|
||||
.\}
|
||||
.if \\n(^v \{\
|
||||
.mk ^Y
|
||||
.\}
|
||||
..
|
||||
'\" # DS - begin display
|
||||
.de DS
|
||||
.RS
|
||||
.nf
|
||||
.sp
|
||||
..
|
||||
'\" # DE - end display
|
||||
.de DE
|
||||
.fi
|
||||
.RE
|
||||
.sp .5
|
||||
..
|
@ -1,138 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/open.n,v 1.1 93/05/10 17:10:32 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS open tcl 7.0
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
open \- Open a file
|
||||
.SH SYNOPSIS
|
||||
.VS
|
||||
\fBopen \fIfileName\fR ?\fIaccess\fR? ?\fIpermissions\fR?
|
||||
.VE
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
This command opens a file and returns an identifier
|
||||
that may be used in future invocations
|
||||
of commands like \fBread\fR, \fBputs\fR, and \fBclose\fR.
|
||||
\fIFileName\fR gives the name of the file to open; if it starts with
|
||||
a tilde then tilde substitution is performed as described for
|
||||
\fBTcl_TildeSubst\fR.
|
||||
If the first character of \fIfileName\fR is ``|'' then the
|
||||
remaining characters of \fIfileName\fR are treated as a command
|
||||
pipeline to invoke, in the same style as for \fBexec\fR.
|
||||
In this case, the identifier returned by \fBopen\fR may be used
|
||||
to write to the command's input pipe or read from its output pipe.
|
||||
.PP
|
||||
The \fIaccess\fR argument indicates the way in which the file
|
||||
(or command pipeline) is to be accessed.
|
||||
.VS
|
||||
It may take two forms, either a string in the form that would be
|
||||
passed to the \fBfopen\fR library procedure or a list of POSIX
|
||||
access flags.
|
||||
It defaults to ``\fBr\fR''.
|
||||
In the first form \fIaccess\fR may have any of the following values:
|
||||
.VE
|
||||
.TP 15
|
||||
\fBr\fR
|
||||
Open the file for reading only; the file must already exist.
|
||||
.TP 15
|
||||
\fBr+\fR
|
||||
Open the file for both reading and writing; the file must
|
||||
already exist.
|
||||
.TP 15
|
||||
\fBw\fR
|
||||
Open the file for writing only. Truncate it if it exists. If it doesn't
|
||||
exist, create a new file.
|
||||
.TP 15
|
||||
\fBw+\fR
|
||||
Open the file for reading and writing. Truncate it if it exists.
|
||||
If it doesn't exist, create a new file.
|
||||
.TP 15
|
||||
\fBa\fR
|
||||
Open the file for writing only. The file must already exist, and the file
|
||||
is positioned so that new data is appended to the file.
|
||||
.TP 15
|
||||
\fBa+\fR
|
||||
Open the file for reading and writing. If the file doesn't exist,
|
||||
create a new empty file.
|
||||
Set the initial access position to the end of the file.
|
||||
.PP
|
||||
In the second form, \fIaccess\fR consists of a list of any of the
|
||||
.VS
|
||||
following flags, all of which have the standard POSIX meanings.
|
||||
One of the flags must be either \fBRDONLY\fR, \fBWRONLY\fR or \fBRDWR\fR.
|
||||
.TP 15
|
||||
\fBRDONLY\fR
|
||||
Open the file for reading only.
|
||||
.TP 15
|
||||
\fBWRONLY\fR
|
||||
Open the file for writing only.
|
||||
.TP 15
|
||||
\fBRDWR\fR
|
||||
Open the file for both reading and writing.
|
||||
.TP 15
|
||||
\fBAPPEND\fR
|
||||
Set the file pointer to the end of the file prior to each write.
|
||||
.TP 15
|
||||
\fBCREAT\fR
|
||||
Create the file if it doesn't already exist (without this flag it
|
||||
is an error for the file not to exist).
|
||||
.TP 15
|
||||
\fBEXCL\fR
|
||||
If \fBCREAT\fR is specified also, an error is returned if the
|
||||
file already exists.
|
||||
.TP 15
|
||||
\fBNOCTTY\fR
|
||||
If the file is a terminal device, this flag prevents the file from
|
||||
becoming the controlling terminal of the process.
|
||||
.TP 15
|
||||
\fBNONBLOCK\fR
|
||||
Prevents the process from blocking while opening the file.
|
||||
For details refer to your system documentation on the \fBopen\fR system
|
||||
call's \fBO_NONBLOCK\fR flag.
|
||||
.TP 15
|
||||
\fBTRUNC\fR
|
||||
If the file exists it is truncated to zero length.
|
||||
.PP
|
||||
If a new file is created as part of opening it, \fIpermissions\fR
|
||||
(an integer) is used to set the permissions for the new file in
|
||||
conjunction with the process's file mode creation mask.
|
||||
\fIPermissions\fR defaults to 0666.
|
||||
.VE
|
||||
.PP
|
||||
If a file is opened for both reading and writing then \fBseek\fR
|
||||
must be invoked between a read and a write, or vice versa (this
|
||||
restriction does not apply to command pipelines opened with \fBopen\fR).
|
||||
When \fIfileName\fR specifies a command pipeline and a write-only access
|
||||
is used, then standard output from the pipeline is directed to the
|
||||
current standard output unless overridden by the command.
|
||||
When \fIfileName\fR specifies a command pipeline and a read-only access
|
||||
is used, then standard input from the pipeline is taken from the
|
||||
current standard input unless overridden by the command.
|
||||
|
||||
.SH KEYWORDS
|
||||
access mode, append, controlling terminal, create, file,
|
||||
non-blocking, open, permissions, pipeline, process
|
@ -1,47 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/pid.n,v 1.1 93/05/15 16:19:40 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS pid tcl 7.0
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
pid \- Retrieve process id(s)
|
||||
.SH SYNOPSIS
|
||||
\fBpid \fR?\fIfileId\fR?
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
If the \fIfileId\fR argument is given then it should normally
|
||||
refer to a process pipeline created with the \fBopen\fR command.
|
||||
In this case the \fBpid\fR command will return a list whose elements
|
||||
are the process identifiers of all the processes in the pipeline,
|
||||
in order.
|
||||
The list will be empty if \fIfileId\fR refers to an open file
|
||||
that isn't a process pipeline.
|
||||
If no \fIfileId\fR argument is given then \fBpid\fR returns the process
|
||||
identifier of the current process.
|
||||
All process identifiers are returned as decimal strings.
|
||||
|
||||
.SH KEYWORDS
|
||||
file, pipeline, process identifier
|
@ -1,50 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/puts.n,v 1.1 93/05/10 17:10:19 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS puts tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
puts \- Write to a file
|
||||
.SH SYNOPSIS
|
||||
\fBputs \fR?\fB\-nonewline\fR? ?\fIfileId\fR? \fIstring\fR
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
Writes the characters given by \fIstring\fR to the file given
|
||||
by \fIfileId\fR.
|
||||
\fIFileId\fR must have been the return
|
||||
value from a previous call to \fBopen\fR, or it may be
|
||||
\fBstdout\fR or \fBstderr\fR to refer to one of the standard I/O
|
||||
channels; it must refer to a file that was opened for
|
||||
writing.
|
||||
If no \fIfileId\fR is specified then it defaults to \fBstdout\fR.
|
||||
\fBPuts\fR normally outputs a newline character after \fIstring\fR,
|
||||
but this feature may be suppressed by specifying the \fB\-nonewline\fR
|
||||
switch.
|
||||
Output to files is buffered internally by Tcl; the \fBflush\fR
|
||||
command may be used to force buffered characters to be output.
|
||||
|
||||
.SH KEYWORDS
|
||||
file, newline, output, write
|
@ -1,38 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/pwd.n,v 1.1 93/05/10 17:10:19 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS pwd tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
pwd \- Return the current working directory
|
||||
.SH SYNOPSIS
|
||||
\fBpwd\fR
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
Returns the path name of the current working directory.
|
||||
|
||||
.SH KEYWORDS
|
||||
working directory
|
@ -1,54 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/read.n,v 1.2 93/10/04 16:01:04 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS read tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
read \- Read from a file
|
||||
.SH SYNOPSIS
|
||||
\fBread \fR?\fB\-nonewline\fR? \fIfileId\fR
|
||||
.br
|
||||
\fBread \fIfileId numBytes\fR
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
In the first form, all of the remaining bytes are read from the file
|
||||
given by \fIfileId\fR; they are returned as the result of the command.
|
||||
If the \fB\-nonewline\fR switch is specified then the last
|
||||
character of the file is discarded if it is a newline.
|
||||
In the second form, the extra argument specifies how many bytes to read;
|
||||
exactly this many bytes will be read and returned, unless there are fewer than
|
||||
\fInumBytes\fR bytes left in the file; in this case, all the remaining
|
||||
bytes are returned.
|
||||
\fIFileId\fR must be \fBstdin\fR or the return
|
||||
value from a previous call to \fBopen\fR; it must
|
||||
refer to a file that was opened for reading.
|
||||
.VS
|
||||
Any existing end-of-file or error condition on the file is cleared at
|
||||
the beginning of the \fBread\fR command.
|
||||
.VE
|
||||
|
||||
.SH KEYWORDS
|
||||
file, read
|
@ -1,41 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/rename.n,v 1.1 93/06/07 16:48:22 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS rename tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
rename \- Rename or delete a command
|
||||
.SH SYNOPSIS
|
||||
\fBrename \fIoldName newName\fR
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
Rename the command that used to be called \fIoldName\fR so that it
|
||||
is now called \fInewName\fR. If \fInewName\fR is an empty string
|
||||
then \fIoldName\fR is deleted. The \fBrename\fR command
|
||||
returns an empty string as result.
|
||||
|
||||
.SH KEYWORDS
|
||||
command, delete, rename
|
@ -1,64 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/seek.n,v 1.1 93/06/07 16:48:27 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS seek tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
seek \- Change the access position for an open file
|
||||
.SH SYNOPSIS
|
||||
\fBseek \fIfileId offset \fR?\fIorigin\fR?
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
Change the current access position for \fIfileId\fR.
|
||||
\fIFileId\fR must have been the return
|
||||
value from a previous call to \fBopen\fR, or it may be \fBstdin\fR,
|
||||
\fBstdout\fR, or \fBstderr\fR to refer to one of the standard I/O
|
||||
channels.
|
||||
The \fIoffset\fR and \fIorigin\fR arguments specify the position at
|
||||
which the next read or write will occur for \fIfileId\fR.
|
||||
\fIOffset\fR must be an integer (which may be negative) and \fIorigin\fR
|
||||
must be one of the following:
|
||||
.TP
|
||||
\fBstart\fR
|
||||
The new access position will be \fIoffset\fR bytes from the start
|
||||
of the file.
|
||||
.TP
|
||||
\fBcurrent\fR
|
||||
The new access position will be \fIoffset\fR bytes from the current
|
||||
access position; a negative \fIoffset\fR moves the access position
|
||||
backwards in the file.
|
||||
.TP
|
||||
\fBend\fR
|
||||
The new access position will be \fIoffset\fR bytes from the end of
|
||||
the file. A negative \fIoffset\fR places the access position before
|
||||
the end-of-file, and a positive \fIoffset\fR places the access position
|
||||
after the end-of-file.
|
||||
.LP
|
||||
The \fIorigin\fR argument defaults to \fBstart\fR.
|
||||
This command returns an empty string.
|
||||
|
||||
.SH KEYWORDS
|
||||
access position, file, seek
|
@ -1,47 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/source.n,v 1.1 93/06/07 16:48:28 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS source tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
source \- Evaluate a file as a Tcl script
|
||||
.SH SYNOPSIS
|
||||
\fBsource \fIfileName\fR
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
Read file \fIfileName\fR and pass the contents to the Tcl interpreter
|
||||
as a script to evaluate in the normal fashion. The return
|
||||
value from \fBsource\fR is the return value of the last command executed
|
||||
from the file. If an error occurs in evaluating the contents of the
|
||||
file then the \fBsource\fR command will return that error.
|
||||
If a \fBreturn\fR command is invoked from within the file then the remainder of
|
||||
the file will be skipped and the \fBsource\fR command will return
|
||||
normally with the result from the \fBreturn\fR command.
|
||||
If \fIfileName\fR starts with a tilde, then it is tilde-substituted
|
||||
as described in the \fBTcl_TildeSubst\fR manual entry.
|
||||
|
||||
.SH KEYWORDS
|
||||
file, script
|
@ -1,57 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/split.n,v 1.1 93/06/16 16:48:25 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS split tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
split \- Split a string into a proper Tcl list
|
||||
.SH SYNOPSIS
|
||||
\fBsplit \fIstring \fR?\fIsplitChars\fR?
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
Returns a list created by splitting \fIstring\fR at each character
|
||||
that is in the \fIsplitChars\fR argument.
|
||||
Each element of the result list will consist of the
|
||||
characters from \fIstring\fR that lie between instances of the
|
||||
characters in \fIsplitChars\fR.
|
||||
Empty list elements will be generated if \fIstring\fR contains
|
||||
adjacent characters in \fIsplitChars\fR, or if the first or last
|
||||
character of \fIstring\fR is in \fIsplitChars\fR.
|
||||
If \fIsplitChars\fR is an empty string then each character of
|
||||
\fIstring\fR becomes a separate element of the result list.
|
||||
\fISplitChars\fR defaults to the standard white-space characters.
|
||||
For example,
|
||||
.DS
|
||||
\fBsplit "comp.unix.misc" .\fR
|
||||
.DE
|
||||
returns \fB"comp unix misc"\fR and
|
||||
.DS
|
||||
\fBsplit "Hello world" {}\fR
|
||||
.DE
|
||||
returns \fB"H e l l o { } w o r l d"\fR.
|
||||
|
||||
.SH KEYWORDS
|
||||
list, split, string
|
@ -1,43 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/tell.n,v 1.1 93/06/16 16:48:30 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS tell tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
tell \- Return current access position for an open file
|
||||
.SH SYNOPSIS
|
||||
\fBtell \fIfileId\fR
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
Returns a decimal string giving the current access position in
|
||||
\fIfileId\fR.
|
||||
\fIFileId\fR must have been the return
|
||||
value from a previous call to \fBopen\fR, or it may be \fBstdin\fR,
|
||||
\fBstdout\fR, or \fBstderr\fR to refer to one of the standard I/O
|
||||
channels.
|
||||
|
||||
.SH KEYWORDS
|
||||
access position, file
|
@ -1,46 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/time.n,v 1.1 93/06/16 16:48:29 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS time tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
time \- Time the execution of a script
|
||||
.SH SYNOPSIS
|
||||
\fBtime \fIscript\fR ?\fIcount\fR?
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
This command will call the Tcl interpreter \fIcount\fR
|
||||
times to evaluate \fIscript\fR (or once if \fIcount\fR isn't
|
||||
specified). It will then return a string of the form
|
||||
.DS
|
||||
\fB503 microseconds per iteration\fR
|
||||
.DE
|
||||
which indicates the average amount of time required per iteration,
|
||||
in microseconds.
|
||||
Time is measured in elapsed time, not CPU time.
|
||||
|
||||
.SH KEYWORDS
|
||||
script, time
|
@ -1,55 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/unknown.n,v 1.2 93/10/13 17:19:06 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS unknown tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
unknown \- Handle attempts to use non-existent commands
|
||||
.SH SYNOPSIS
|
||||
\fBunknown \fIcmdName \fR?\fIarg arg ...\fR?
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
This command doesn't actually exist as part of Tcl, but Tcl will
|
||||
invoke it if it does exist.
|
||||
If the Tcl interpreter encounters a command name for which there
|
||||
is not a defined command, then Tcl checks for the existence of
|
||||
a command named \fBunknown\fR.
|
||||
If there is no such command, then the interpreter returns an
|
||||
error.
|
||||
If the \fBunknown\fR command exists, then it is invoked with
|
||||
arguments consisting of the fully-substituted name and arguments
|
||||
for the original non-existent command.
|
||||
The \fBunknown\fR command typically does things like searching
|
||||
through library directories for a command procedure with the name
|
||||
\fIcmdName\fR, or expanding abbreviated command names to full-length,
|
||||
or automatically executing unknown commands as sub-processes.
|
||||
In some cases (such as expanding abbreviations) \fBunknown\fR will
|
||||
change the original command slightly and then (re-)execute it.
|
||||
The result of the \fBunknown\fR command is used as the result for
|
||||
the original non-existent command.
|
||||
|
||||
.SH KEYWORDS
|
||||
error, non-existent command
|
@ -1,47 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/unset.n,v 1.1 93/06/16 16:48:28 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS unset tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
unset \- Delete variables
|
||||
.SH SYNOPSIS
|
||||
\fBunset \fIname \fR?\fIname name ...\fR?
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
This command removes one or more variables.
|
||||
Each \fIname\fR is a variable name, specified in any of the
|
||||
ways acceptable to the \fBset\fR command.
|
||||
If a \fIname\fR refers to an element of an array then that
|
||||
element is removed without affecting the rest of the array.
|
||||
If a \fIname\fR consists of an array name with no parenthesized
|
||||
index, then the entire array is deleted.
|
||||
The \fBunset\fR command returns an empty string as result.
|
||||
An error occurs if any of the variables doesn't exist, and any variables
|
||||
after the non-existent one are not deleted.
|
||||
|
||||
.SH KEYWORDS
|
||||
remove, variable
|
@ -1,50 +0,0 @@
|
||||
'\"
|
||||
'\" Copyright (c) 1993 The Regents of the University of California.
|
||||
'\" All rights reserved.
|
||||
'\"
|
||||
'\" Permission is hereby granted, without written agreement and without
|
||||
'\" license or royalty fees, to use, copy, modify, and distribute this
|
||||
'\" documentation for any purpose, provided that the above copyright
|
||||
'\" notice and the following two paragraphs appear in all copies.
|
||||
'\"
|
||||
'\" IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
|
||||
'\" FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
'\" ARISING OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
'\" CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
'\"
|
||||
'\" THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
'\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
'\" AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
'\" ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
'\" PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
'\"
|
||||
'\" $Header: /user6/ouster/tcl/man/RCS/while.n,v 1.1 93/06/16 16:48:27 ouster Exp $ SPRITE (Berkeley)
|
||||
'\"
|
||||
.so man.macros
|
||||
.HS while tcl
|
||||
.BS
|
||||
'\" Note: do not modify the .SH NAME line immediately below!
|
||||
.SH NAME
|
||||
while \- Execute script repeatedly as long as a condition is met
|
||||
.SH SYNOPSIS
|
||||
\fBwhile \fItest body
|
||||
.BE
|
||||
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
The \fIwhile\fR command evaluates \fItest\fR as an expression
|
||||
(in the same way that \fBexpr\fR evaluates its argument).
|
||||
The value of the expression must a proper boolean
|
||||
value; if it is a true value
|
||||
then \fIbody\fR is executed by passing it to the Tcl interpreter.
|
||||
Once \fIbody\fR has been executed then \fItest\fR is evaluated
|
||||
again, and the process repeats until eventually \fItest\fR
|
||||
evaluates to a false boolean value. \fBContinue\fR
|
||||
commands may be executed inside \fIbody\fR to terminate the current
|
||||
iteration of the loop, and \fBbreak\fR
|
||||
commands may be executed inside \fIbody\fR to cause immediate
|
||||
termination of the \fBwhile\fR command. The \fBwhile\fR command
|
||||
always returns an empty string.
|
||||
|
||||
.SH KEYWORDS
|
||||
boolean value, loop, test, while
|
@ -1,259 +0,0 @@
|
||||
# init.tcl --
|
||||
#
|
||||
# Default system startup file for Tcl-based applications. Defines
|
||||
# "unknown" procedure and auto-load facilities.
|
||||
#
|
||||
# $Header: /user6/ouster/tcl/library/RCS/init.tcl,v 1.28 93/10/08 09:11:21 ouster Exp $ SPRITE (Berkeley)
|
||||
#
|
||||
# Copyright (c) 1991-1993 The Regents of the University of California.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, without written agreement and without
|
||||
# license or royalty fees, to use, copy, modify, and distribute this
|
||||
# software and its documentation for any purpose, provided that the
|
||||
# above copyright notice and the following two paragraphs appear in
|
||||
# all copies of this software.
|
||||
#
|
||||
# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
||||
# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
|
||||
# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
#
|
||||
|
||||
set auto_path [info library]
|
||||
|
||||
# unknown:
|
||||
# Invoked when a Tcl command is invoked that doesn't exist in the
|
||||
# interpreter:
|
||||
#
|
||||
# 1. See if the autoload facility can locate the command in a
|
||||
# Tcl script file. If so, load it and execute it.
|
||||
# 2. See if the command exists as an executable UNIX program.
|
||||
# If so, "exec" the command.
|
||||
# 3. If the command was invoked at top-level:
|
||||
# (a) see if the command requests csh-like history substitution
|
||||
# in one of the common forms !!, !<number>, or ^old^new. If
|
||||
# so, emulate csh's history substitution.
|
||||
# (b) see if the command is a unique abbreviation for another
|
||||
# command. If so, invoke the command.
|
||||
|
||||
proc unknown args {
|
||||
global auto_noexec auto_noload env unknown_pending tcl_interactive;
|
||||
|
||||
set name [lindex $args 0]
|
||||
if ![info exists auto_noload] {
|
||||
#
|
||||
# Make sure we're not trying to load the same proc twice.
|
||||
#
|
||||
if [info exists unknown_pending($name)] {
|
||||
unset unknown_pending($name)
|
||||
if {[array size unknown_pending] == 0} {
|
||||
unset unknown_pending
|
||||
}
|
||||
return -code error "self-referential recursion in \"unknown\" for command \"$name\"";
|
||||
}
|
||||
set unknown_pending($name) pending;
|
||||
set ret [catch {auto_load $name} msg]
|
||||
unset unknown_pending($name);
|
||||
if {$ret != 0} {
|
||||
return -code $ret "error while autoloading \"$name\": $msg"
|
||||
}
|
||||
if ![array size unknown_pending] {
|
||||
unset unknown_pending
|
||||
}
|
||||
if $msg {
|
||||
return [uplevel $args]
|
||||
}
|
||||
}
|
||||
if {([info level] == 1) && ([info script] == "") && $tcl_interactive} {
|
||||
if ![info exists auto_noexec] {
|
||||
if [auto_execok $name] {
|
||||
return [uplevel exec >&@stdout <@stdin $args]
|
||||
}
|
||||
}
|
||||
if {$name == "!!"} {
|
||||
return [uplevel {history redo}]
|
||||
}
|
||||
if [regexp {^!(.+)$} $name dummy event] {
|
||||
return [uplevel [list history redo $event]]
|
||||
}
|
||||
if [regexp {^\^([^^]*)\^([^^]*)\^?$} $name dummy old new] {
|
||||
return [uplevel [list history substitute $old $new]]
|
||||
}
|
||||
set cmds [info commands $name*]
|
||||
if {[llength $cmds] == 1} {
|
||||
return [uplevel [lreplace $args 0 0 $cmds]]
|
||||
}
|
||||
if {[llength $cmds] != 0} {
|
||||
if {$name == ""} {
|
||||
return -code error "empty command name \"\""
|
||||
} else {
|
||||
return -code error \
|
||||
"ambiguous command name \"$name\": [lsort $cmds]"
|
||||
}
|
||||
}
|
||||
}
|
||||
return -code error "invalid command name \"$name\""
|
||||
}
|
||||
|
||||
# auto_load:
|
||||
# Checks a collection of library directories to see if a procedure
|
||||
# is defined in one of them. If so, it sources the appropriate
|
||||
# library file to create the procedure. Returns 1 if it successfully
|
||||
# loaded the procedure, 0 otherwise.
|
||||
|
||||
proc auto_load cmd {
|
||||
global auto_index auto_oldpath auto_path env errorInfo errorCode
|
||||
|
||||
if [info exists auto_index($cmd)] {
|
||||
uplevel #0 $auto_index($cmd)
|
||||
return 1
|
||||
}
|
||||
if [catch {set path $auto_path}] {
|
||||
if [catch {set path $env(TCLLIBPATH)}] {
|
||||
if [catch {set path [info library]}] {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
}
|
||||
if [info exists auto_oldpath] {
|
||||
if {$auto_oldpath == $path} {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
set auto_oldpath $path
|
||||
catch {unset auto_index}
|
||||
for {set i [expr [llength $path] - 1]} {$i >= 0} {incr i -1} {
|
||||
set dir [lindex $path $i]
|
||||
set f ""
|
||||
if [catch {set f [open $dir/tclIndex]}] {
|
||||
continue
|
||||
}
|
||||
set error [catch {
|
||||
set id [gets $f]
|
||||
if {$id == "# Tcl autoload index file, version 2.0"} {
|
||||
eval [read $f]
|
||||
} elseif {$id == "# Tcl autoload index file: each line identifies a Tcl"} {
|
||||
while {[gets $f line] >= 0} {
|
||||
if {([string index $line 0] == "#")
|
||||
|| ([llength $line] != 2)} {
|
||||
continue
|
||||
}
|
||||
set name [lindex $line 0]
|
||||
set auto_index($name) "source $dir/[lindex $line 1]"
|
||||
}
|
||||
} else {
|
||||
error "$dir/tclIndex isn't a proper Tcl index file"
|
||||
}
|
||||
} msg]
|
||||
if {$f != ""} {
|
||||
close $f
|
||||
}
|
||||
if $error {
|
||||
error $msg $errorInfo $errorCode
|
||||
}
|
||||
}
|
||||
if [info exists auto_index($cmd)] {
|
||||
uplevel #0 $auto_index($cmd)
|
||||
if {[info commands $cmd] != ""} {
|
||||
return 1
|
||||
}
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
# auto_execok:
|
||||
# Returns 1 if there's an executable in the current path for the
|
||||
# given name, 0 otherwise. Builds an associative array auto_execs
|
||||
# that caches information about previous checks, for speed.
|
||||
|
||||
proc auto_execok name {
|
||||
global auto_execs env
|
||||
|
||||
if [info exists auto_execs($name)] {
|
||||
return $auto_execs($name)
|
||||
}
|
||||
set auto_execs($name) 0
|
||||
if {[string first / $name] >= 0} {
|
||||
if {[file executable $name] && ![file isdirectory $name]} {
|
||||
set auto_execs($name) 1
|
||||
}
|
||||
return $auto_execs($name)
|
||||
}
|
||||
foreach dir [split $env(PATH) :] {
|
||||
if {[file executable $dir/$name] && ![file isdirectory $dir/$name]} {
|
||||
set auto_execs($name) 1
|
||||
return 1
|
||||
}
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
# auto_reset:
|
||||
# Destroy all cached information for auto-loading and auto-execution,
|
||||
# so that the information gets recomputed the next time it's needed.
|
||||
# Also delete any procedures that are listed in the auto-load index
|
||||
# except those related to auto-loading.
|
||||
|
||||
proc auto_reset {} {
|
||||
global auto_execs auto_index auto_oldpath
|
||||
foreach p [info procs] {
|
||||
if {[info exists auto_index($p)] && ($p != "unknown")
|
||||
&& ![string match auto_* $p]} {
|
||||
rename $p {}
|
||||
}
|
||||
}
|
||||
catch {unset auto_execs}
|
||||
catch {unset auto_index}
|
||||
catch {unset auto_oldpath}
|
||||
}
|
||||
|
||||
# auto_mkindex:
|
||||
# Regenerate a tclIndex file from Tcl source files. Takes as argument
|
||||
# the name of the directory in which the tclIndex file is to be placed,
|
||||
# floowed by any number of glob patterns to use in that directory to
|
||||
# locate all of the relevant files.
|
||||
|
||||
proc auto_mkindex {dir args} {
|
||||
global errorCode errorInfo
|
||||
set oldDir [pwd]
|
||||
cd $dir
|
||||
set dir [pwd]
|
||||
append index "# Tcl autoload index file, version 2.0\n"
|
||||
append index "# This file is generated by the \"auto_mkindex\" command\n"
|
||||
append index "# and sourced to set up indexing information for one or\n"
|
||||
append index "# more commands. Typically each line is a command that\n"
|
||||
append index "# sets an element in the auto_index array, where the\n"
|
||||
append index "# element name is the name of a command and the value is\n"
|
||||
append index "# a script that loads the command.\n\n"
|
||||
foreach file [eval glob $args] {
|
||||
set f ""
|
||||
set error [catch {
|
||||
set f [open $file]
|
||||
while {[gets $f line] >= 0} {
|
||||
if [regexp {^proc[ ]+([^ ]*)} $line match procName] {
|
||||
append index "set [list auto_index($procName)]"
|
||||
append index " \"source \$dir/$file\"\n"
|
||||
}
|
||||
}
|
||||
close $f
|
||||
} msg]
|
||||
if $error {
|
||||
set code $errorCode
|
||||
set info $errorInfo
|
||||
catch {close $f}
|
||||
cd $oldDir
|
||||
error $msg $info $code
|
||||
}
|
||||
}
|
||||
set f [open tclIndex w]
|
||||
puts $f $index nonewline
|
||||
close $f
|
||||
cd $oldDir
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
# parray:
|
||||
# Print the contents of a global array on stdout.
|
||||
#
|
||||
# $Header: /user6/ouster/tcl/library/RCS/parray.tcl,v 1.5 93/02/06 16:33:45 ouster Exp $ SPRITE (Berkeley)
|
||||
#
|
||||
# Copyright (c) 1991-1993 The Regents of the University of California.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, without written agreement and without
|
||||
# license or royalty fees, to use, copy, modify, and distribute this
|
||||
# software and its documentation for any purpose, provided that the
|
||||
# above copyright notice and the following two paragraphs appear in
|
||||
# all copies of this software.
|
||||
#
|
||||
# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
||||
# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
|
||||
# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
#
|
||||
|
||||
proc parray a {
|
||||
upvar 1 $a array
|
||||
if [catch {array size array}] {
|
||||
error "\"$a\" isn't an array"
|
||||
}
|
||||
set maxl 0
|
||||
foreach name [lsort [array names array]] {
|
||||
if {[string length $name] > $maxl} {
|
||||
set maxl [string length $name]
|
||||
}
|
||||
}
|
||||
set maxl [expr {$maxl + [string length $a] + 2}]
|
||||
foreach name [lsort [array names array]] {
|
||||
set nameString [format %s(%s) $a $name]
|
||||
puts stdout [format "%-*s = %s" $maxl $nameString $array($name)]
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
# Tcl autoload index file, version 2.0
|
||||
# This file is generated by the "auto_mkindex" command
|
||||
# and sourced to set up indexing information for one or
|
||||
# more commands. Typically each line is a command that
|
||||
# sets an element in the auto_index array, where the
|
||||
# element name is the name of a command and the value is
|
||||
# a script that loads the command.
|
||||
|
||||
set auto_index(unknown) "source $dir/init.tcl"
|
||||
set auto_index(auto_load) "source $dir/init.tcl"
|
||||
set auto_index(auto_execok) "source $dir/init.tcl"
|
||||
set auto_index(auto_reset) "source $dir/init.tcl"
|
||||
set auto_index(auto_mkindex) "source $dir/init.tcl"
|
||||
set auto_index(parray) "source $dir/parray.tcl"
|
@ -1,69 +0,0 @@
|
||||
/*
|
||||
* panic.c --
|
||||
*
|
||||
* Source code for the "panic" library procedure for Tcl;
|
||||
* individual applications will probably override this with
|
||||
* an application-specific panic procedure.
|
||||
*
|
||||
* Copyright (c) 1988-1993 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, without written agreement and without
|
||||
* license or royalty fees, to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose, provided that the
|
||||
* above copyright notice and the following two paragraphs appear in
|
||||
* all copies of this software.
|
||||
*
|
||||
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
||||
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
|
||||
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/panic.c,v 1.5 93/07/12 14:01:35 ouster Exp $ SPRITE (Berkeley)";
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef NO_STDLIB_H
|
||||
# include "compat/stdlib.h"
|
||||
#else
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* panic --
|
||||
*
|
||||
* Print an error message and kill the process.
|
||||
*
|
||||
* Results:
|
||||
* None.
|
||||
*
|
||||
* Side effects:
|
||||
* The process dies, entering the debugger if possible.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* VARARGS ARGSUSED */
|
||||
void
|
||||
panic(format, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
|
||||
char *format; /* Format string, suitable for passing to
|
||||
* fprintf. */
|
||||
char *arg1, *arg2, *arg3; /* Additional arguments (variable in number)
|
||||
* to pass to fprintf. */
|
||||
char *arg4, *arg5, *arg6, *arg7, *arg8;
|
||||
{
|
||||
(void) fprintf(stderr, format, arg1, arg2, arg3, arg4, arg5, arg6,
|
||||
arg7, arg8);
|
||||
(void) fflush(stderr);
|
||||
abort();
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
/*
|
||||
* patchlevel.h --
|
||||
*
|
||||
* This file does nothing except define a "patch level" for Tcl.
|
||||
* The patch level is an integer that increments with each new
|
||||
* release or patch release. It's used to make sure that Tcl
|
||||
* patches are applied in the correct order and only to appropriate
|
||||
* sources.
|
||||
*/
|
||||
|
||||
#define TCL_PATCH_LEVEL 106
|
631
tcl7.3/tcl.h
631
tcl7.3/tcl.h
@ -1,631 +0,0 @@
|
||||
/*
|
||||
* tcl.h --
|
||||
*
|
||||
* This header file describes the externally-visible facilities
|
||||
* of the Tcl interpreter.
|
||||
*
|
||||
* Copyright (c) 1987-1993 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, without written agreement and without
|
||||
* license or royalty fees, to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose, provided that the
|
||||
* above copyright notice and the following two paragraphs appear in
|
||||
* all copies of this software.
|
||||
*
|
||||
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
||||
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
|
||||
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
*
|
||||
* $Header: /user6/ouster/tcl/RCS/tcl.h,v 1.131 93/11/21 14:50:35 ouster Exp $ SPRITE (Berkeley)
|
||||
*/
|
||||
|
||||
#ifndef _TCL
|
||||
#define _TCL
|
||||
|
||||
#ifndef BUFSIZ
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#define TCL_VERSION "7.3"
|
||||
#define TCL_MAJOR_VERSION 7
|
||||
#define TCL_MINOR_VERSION 3
|
||||
|
||||
/*
|
||||
* Definitions that allow this header file to be used either with or
|
||||
* without ANSI C features like function prototypes.
|
||||
*/
|
||||
|
||||
#undef _ANSI_ARGS_
|
||||
#undef CONST
|
||||
#if ((defined(__STDC__) || defined(SABER)) && !defined(NO_PROTOTYPE)) || defined(__cplusplus)
|
||||
# define _USING_PROTOTYPES_ 1
|
||||
# define _ANSI_ARGS_(x) x
|
||||
# define CONST const
|
||||
# ifdef __cplusplus
|
||||
# define VARARGS (...)
|
||||
# else
|
||||
# define VARARGS ()
|
||||
# endif
|
||||
#else
|
||||
# define _ANSI_ARGS_(x) ()
|
||||
# define CONST
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
# define EXTERN extern "C"
|
||||
#else
|
||||
# define EXTERN extern
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macro to use instead of "void" for arguments that must have
|
||||
* type "void *" in ANSI C; maps them to type "char *" in
|
||||
* non-ANSI systems.
|
||||
*/
|
||||
|
||||
#ifndef VOID
|
||||
# ifdef __STDC__
|
||||
# define VOID void
|
||||
# else
|
||||
# define VOID char
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Miscellaneous declarations (to allow Tcl to be used stand-alone,
|
||||
* without the rest of Sprite).
|
||||
*/
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
#ifndef _CLIENTDATA
|
||||
# ifdef __STDC__
|
||||
typedef void *ClientData;
|
||||
# else
|
||||
typedef int *ClientData;
|
||||
# endif /* __STDC__ */
|
||||
#define _CLIENTDATA
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Data structures defined opaquely in this module. The definitions
|
||||
* below just provide dummy types. A few fields are made visible in
|
||||
* Tcl_Interp structures, namely those for returning string values.
|
||||
* Note: any change to the Tcl_Interp definition below must be mirrored
|
||||
* in the "real" definition in tclInt.h.
|
||||
*/
|
||||
|
||||
typedef struct Tcl_Interp{
|
||||
char *result; /* Points to result string returned by last
|
||||
* command. */
|
||||
void (*freeProc) _ANSI_ARGS_((char *blockPtr));
|
||||
/* Zero means result is statically allocated.
|
||||
* If non-zero, gives address of procedure
|
||||
* to invoke to free the result. Must be
|
||||
* freed by Tcl_Eval before executing next
|
||||
* command. */
|
||||
int errorLine; /* When TCL_ERROR is returned, this gives
|
||||
* the line number within the command where
|
||||
* the error occurred (1 means first line). */
|
||||
} Tcl_Interp;
|
||||
|
||||
typedef int *Tcl_Trace;
|
||||
typedef struct Tcl_AsyncHandler_ *Tcl_AsyncHandler;
|
||||
|
||||
/*
|
||||
* When a TCL command returns, the string pointer interp->result points to
|
||||
* a string containing return information from the command. In addition,
|
||||
* the command procedure returns an integer value, which is one of the
|
||||
* following:
|
||||
*
|
||||
* TCL_OK Command completed normally; interp->result contains
|
||||
* the command's result.
|
||||
* TCL_ERROR The command couldn't be completed successfully;
|
||||
* interp->result describes what went wrong.
|
||||
* TCL_RETURN The command requests that the current procedure
|
||||
* return; interp->result contains the procedure's
|
||||
* return value.
|
||||
* TCL_BREAK The command requests that the innermost loop
|
||||
* be exited; interp->result is meaningless.
|
||||
* TCL_CONTINUE Go on to the next iteration of the current loop;
|
||||
* interp->result is meaningless.
|
||||
*/
|
||||
|
||||
#define TCL_OK 0
|
||||
#define TCL_ERROR 1
|
||||
#define TCL_RETURN 2
|
||||
#define TCL_BREAK 3
|
||||
#define TCL_CONTINUE 4
|
||||
|
||||
#define TCL_RESULT_SIZE 200
|
||||
|
||||
/*
|
||||
* Argument descriptors for math function callbacks in expressions:
|
||||
*/
|
||||
|
||||
typedef enum {TCL_INT, TCL_DOUBLE, TCL_EITHER} Tcl_ValueType;
|
||||
typedef struct Tcl_Value {
|
||||
Tcl_ValueType type; /* Indicates intValue or doubleValue is
|
||||
* valid, or both. */
|
||||
int intValue; /* Integer value. */
|
||||
double doubleValue; /* Double-precision floating value. */
|
||||
} Tcl_Value;
|
||||
|
||||
/*
|
||||
* Procedure types defined by Tcl:
|
||||
*/
|
||||
|
||||
typedef int (Tcl_AsyncProc) _ANSI_ARGS_((ClientData clientData,
|
||||
Tcl_Interp *interp, int code));
|
||||
typedef void (Tcl_CmdDeleteProc) _ANSI_ARGS_((ClientData clientData));
|
||||
typedef int (Tcl_CmdProc) _ANSI_ARGS_((ClientData clientData,
|
||||
Tcl_Interp *interp, int argc, char *argv[]));
|
||||
typedef void (Tcl_CmdTraceProc) _ANSI_ARGS_((ClientData clientData,
|
||||
Tcl_Interp *interp, int level, char *command, Tcl_CmdProc *proc,
|
||||
ClientData cmdClientData, int argc, char *argv[]));
|
||||
typedef void (Tcl_FreeProc) _ANSI_ARGS_((char *blockPtr));
|
||||
typedef void (Tcl_InterpDeleteProc) _ANSI_ARGS_((ClientData clientData,
|
||||
Tcl_Interp *interp));
|
||||
typedef int (Tcl_MathProc) _ANSI_ARGS_((ClientData clientData,
|
||||
Tcl_Interp *interp, Tcl_Value *args, Tcl_Value *resultPtr));
|
||||
typedef char *(Tcl_VarTraceProc) _ANSI_ARGS_((ClientData clientData,
|
||||
Tcl_Interp *interp, char *part1, char *part2, int flags));
|
||||
|
||||
/*
|
||||
* The structure returned by Tcl_GetCmdInfo and passed into
|
||||
* Tcl_SetCmdInfo:
|
||||
*/
|
||||
|
||||
typedef struct Tcl_CmdInfo {
|
||||
Tcl_CmdProc *proc; /* Procedure that implements command. */
|
||||
ClientData clientData; /* ClientData passed to proc. */
|
||||
Tcl_CmdDeleteProc *deleteProc; /* Procedure to call when command
|
||||
* is deleted. */
|
||||
ClientData deleteData; /* Value to pass to deleteProc (usually
|
||||
* the same as clientData). */
|
||||
} Tcl_CmdInfo;
|
||||
|
||||
/*
|
||||
* The structure defined below is used to hold dynamic strings. The only
|
||||
* field that clients should use is the string field, and they should
|
||||
* never modify it.
|
||||
*/
|
||||
|
||||
#define TCL_DSTRING_STATIC_SIZE 200
|
||||
typedef struct Tcl_DString {
|
||||
char *string; /* Points to beginning of string: either
|
||||
* staticSpace below or a malloc'ed array. */
|
||||
int length; /* Number of non-NULL characters in the
|
||||
* string. */
|
||||
int spaceAvl; /* Total number of bytes available for the
|
||||
* string and its terminating NULL char. */
|
||||
char staticSpace[TCL_DSTRING_STATIC_SIZE];
|
||||
/* Space to use in common case where string
|
||||
* is small. */
|
||||
} Tcl_DString;
|
||||
|
||||
#define Tcl_DStringLength(dsPtr) ((dsPtr)->length)
|
||||
#define Tcl_DStringValue(dsPtr) ((dsPtr)->string)
|
||||
|
||||
/*
|
||||
* Definitions for the maximum number of digits of precision that may
|
||||
* be specified in the "tcl_precision" variable, and the number of
|
||||
* characters of buffer space required by Tcl_PrintDouble.
|
||||
*/
|
||||
|
||||
#define TCL_MAX_PREC 17
|
||||
#define TCL_DOUBLE_SPACE (TCL_MAX_PREC+10)
|
||||
|
||||
/*
|
||||
* Flag values passed to Tcl_Eval (see the man page for details; also
|
||||
* see tclInt.h for additional flags that are only used internally by
|
||||
* Tcl):
|
||||
*/
|
||||
|
||||
#define TCL_BRACKET_TERM 1
|
||||
|
||||
/*
|
||||
* Flag that may be passed to Tcl_ConvertElement to force it not to
|
||||
* output braces (careful! if you change this flag be sure to change
|
||||
* the definitions at the front of tclUtil.c).
|
||||
*/
|
||||
|
||||
#define TCL_DONT_USE_BRACES 1
|
||||
|
||||
/*
|
||||
* Flag value passed to Tcl_RecordAndEval to request no evaluation
|
||||
* (record only).
|
||||
*/
|
||||
|
||||
#define TCL_NO_EVAL -1
|
||||
|
||||
/*
|
||||
* Special freeProc values that may be passed to Tcl_SetResult (see
|
||||
* the man page for details):
|
||||
*/
|
||||
|
||||
#define TCL_VOLATILE ((Tcl_FreeProc *) -1)
|
||||
#define TCL_STATIC ((Tcl_FreeProc *) 0)
|
||||
#define TCL_DYNAMIC ((Tcl_FreeProc *) free)
|
||||
|
||||
/*
|
||||
* Flag values passed to variable-related procedures.
|
||||
*/
|
||||
|
||||
#define TCL_GLOBAL_ONLY 1
|
||||
#define TCL_APPEND_VALUE 2
|
||||
#define TCL_LIST_ELEMENT 4
|
||||
#define TCL_TRACE_READS 0x10
|
||||
#define TCL_TRACE_WRITES 0x20
|
||||
#define TCL_TRACE_UNSETS 0x40
|
||||
#define TCL_TRACE_DESTROYED 0x80
|
||||
#define TCL_INTERP_DESTROYED 0x100
|
||||
#define TCL_LEAVE_ERR_MSG 0x200
|
||||
|
||||
/*
|
||||
* Types for linked variables:
|
||||
*/
|
||||
|
||||
#define TCL_LINK_INT 1
|
||||
#define TCL_LINK_DOUBLE 2
|
||||
#define TCL_LINK_BOOLEAN 3
|
||||
#define TCL_LINK_STRING 4
|
||||
#define TCL_LINK_READ_ONLY 0x80
|
||||
|
||||
/*
|
||||
* Permission flags for files:
|
||||
*/
|
||||
|
||||
#define TCL_FILE_READABLE 1
|
||||
#define TCL_FILE_WRITABLE 2
|
||||
|
||||
/*
|
||||
* The following declarations either map ckalloc and ckfree to
|
||||
* malloc and free, or they map them to procedures with all sorts
|
||||
* of debugging hooks defined in tclCkalloc.c.
|
||||
*/
|
||||
|
||||
#ifdef TCL_MEM_DEBUG
|
||||
|
||||
EXTERN char * Tcl_DbCkalloc _ANSI_ARGS_((unsigned int size,
|
||||
char *file, int line));
|
||||
EXTERN int Tcl_DbCkfree _ANSI_ARGS_((char *ptr,
|
||||
char *file, int line));
|
||||
EXTERN char * Tcl_DbCkrealloc _ANSI_ARGS_((char *ptr,
|
||||
unsigned int size, char *file, int line));
|
||||
EXTERN int Tcl_DumpActiveMemory _ANSI_ARGS_((char *fileName));
|
||||
EXTERN void Tcl_ValidateAllMemory _ANSI_ARGS_((char *file,
|
||||
int line));
|
||||
# define ckalloc(x) Tcl_DbCkalloc(x, __FILE__, __LINE__)
|
||||
# define ckfree(x) Tcl_DbCkfree(x, __FILE__, __LINE__)
|
||||
# define ckrealloc(x,y) Tcl_DbCkrealloc((x), (y),__FILE__, __LINE__)
|
||||
|
||||
#else
|
||||
|
||||
# define ckalloc(x) malloc(x)
|
||||
# define ckfree(x) free(x)
|
||||
# define ckrealloc(x,y) realloc(x,y)
|
||||
# define Tcl_DumpActiveMemory(x)
|
||||
# define Tcl_ValidateAllMemory(x,y)
|
||||
|
||||
#endif /* TCL_MEM_DEBUG */
|
||||
|
||||
/*
|
||||
* Macro to free up result of interpreter.
|
||||
*/
|
||||
|
||||
#define Tcl_FreeResult(interp) \
|
||||
if ((interp)->freeProc != 0) { \
|
||||
if ((interp)->freeProc == (Tcl_FreeProc *) free) { \
|
||||
ckfree((interp)->result); \
|
||||
} else { \
|
||||
(*(interp)->freeProc)((interp)->result); \
|
||||
} \
|
||||
(interp)->freeProc = 0; \
|
||||
}
|
||||
|
||||
/*
|
||||
* Forward declaration of Tcl_HashTable. Needed by some C++ compilers
|
||||
* to prevent errors when the forward reference to Tcl_HashTable is
|
||||
* encountered in the Tcl_HashEntry structure.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
struct Tcl_HashTable;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Structure definition for an entry in a hash table. No-one outside
|
||||
* Tcl should access any of these fields directly; use the macros
|
||||
* defined below.
|
||||
*/
|
||||
|
||||
typedef struct Tcl_HashEntry {
|
||||
struct Tcl_HashEntry *nextPtr; /* Pointer to next entry in this
|
||||
* hash bucket, or NULL for end of
|
||||
* chain. */
|
||||
struct Tcl_HashTable *tablePtr; /* Pointer to table containing entry. */
|
||||
struct Tcl_HashEntry **bucketPtr; /* Pointer to bucket that points to
|
||||
* first entry in this entry's chain:
|
||||
* used for deleting the entry. */
|
||||
ClientData clientData; /* Application stores something here
|
||||
* with Tcl_SetHashValue. */
|
||||
union { /* Key has one of these forms: */
|
||||
char *oneWordValue; /* One-word value for key. */
|
||||
int words[1]; /* Multiple integer words for key.
|
||||
* The actual size will be as large
|
||||
* as necessary for this table's
|
||||
* keys. */
|
||||
char string[4]; /* String for key. The actual size
|
||||
* will be as large as needed to hold
|
||||
* the key. */
|
||||
} key; /* MUST BE LAST FIELD IN RECORD!! */
|
||||
} Tcl_HashEntry;
|
||||
|
||||
/*
|
||||
* Structure definition for a hash table. Must be in tcl.h so clients
|
||||
* can allocate space for these structures, but clients should never
|
||||
* access any fields in this structure.
|
||||
*/
|
||||
|
||||
#define TCL_SMALL_HASH_TABLE 4
|
||||
typedef struct Tcl_HashTable {
|
||||
Tcl_HashEntry **buckets; /* Pointer to bucket array. Each
|
||||
* element points to first entry in
|
||||
* bucket's hash chain, or NULL. */
|
||||
Tcl_HashEntry *staticBuckets[TCL_SMALL_HASH_TABLE];
|
||||
/* Bucket array used for small tables
|
||||
* (to avoid mallocs and frees). */
|
||||
int numBuckets; /* Total number of buckets allocated
|
||||
* at **bucketPtr. */
|
||||
int numEntries; /* Total number of entries present
|
||||
* in table. */
|
||||
int rebuildSize; /* Enlarge table when numEntries gets
|
||||
* to be this large. */
|
||||
int downShift; /* Shift count used in hashing
|
||||
* function. Designed to use high-
|
||||
* order bits of randomized keys. */
|
||||
int mask; /* Mask value used in hashing
|
||||
* function. */
|
||||
int keyType; /* Type of keys used in this table.
|
||||
* It's either TCL_STRING_KEYS,
|
||||
* TCL_ONE_WORD_KEYS, or an integer
|
||||
* giving the number of ints in a
|
||||
*/
|
||||
Tcl_HashEntry *(*findProc) _ANSI_ARGS_((struct Tcl_HashTable *tablePtr,
|
||||
char *key));
|
||||
Tcl_HashEntry *(*createProc) _ANSI_ARGS_((struct Tcl_HashTable *tablePtr,
|
||||
char *key, int *newPtr));
|
||||
} Tcl_HashTable;
|
||||
|
||||
/*
|
||||
* Structure definition for information used to keep track of searches
|
||||
* through hash tables:
|
||||
*/
|
||||
|
||||
typedef struct Tcl_HashSearch {
|
||||
Tcl_HashTable *tablePtr; /* Table being searched. */
|
||||
int nextIndex; /* Index of next bucket to be
|
||||
* enumerated after present one. */
|
||||
Tcl_HashEntry *nextEntryPtr; /* Next entry to be enumerated in the
|
||||
* the current bucket. */
|
||||
} Tcl_HashSearch;
|
||||
|
||||
/*
|
||||
* Acceptable key types for hash tables:
|
||||
*/
|
||||
|
||||
#define TCL_STRING_KEYS 0
|
||||
#define TCL_ONE_WORD_KEYS 1
|
||||
|
||||
/*
|
||||
* Macros for clients to use to access fields of hash entries:
|
||||
*/
|
||||
|
||||
#define Tcl_GetHashValue(h) ((h)->clientData)
|
||||
#define Tcl_SetHashValue(h, value) ((h)->clientData = (ClientData) (value))
|
||||
#define Tcl_GetHashKey(tablePtr, h) \
|
||||
((char *) (((tablePtr)->keyType == TCL_ONE_WORD_KEYS) ? (h)->key.oneWordValue \
|
||||
: (h)->key.string))
|
||||
|
||||
/*
|
||||
* Macros to use for clients to use to invoke find and create procedures
|
||||
* for hash tables:
|
||||
*/
|
||||
|
||||
#define Tcl_FindHashEntry(tablePtr, key) \
|
||||
(*((tablePtr)->findProc))(tablePtr, key)
|
||||
#define Tcl_CreateHashEntry(tablePtr, key, newPtr) \
|
||||
(*((tablePtr)->createProc))(tablePtr, key, newPtr)
|
||||
|
||||
/*
|
||||
* Exported Tcl variables:
|
||||
*/
|
||||
|
||||
EXTERN int tcl_AsyncReady;
|
||||
EXTERN char * tcl_RcFileName;
|
||||
|
||||
/*
|
||||
* Exported Tcl procedures:
|
||||
*/
|
||||
|
||||
EXTERN void Tcl_AsyncMark _ANSI_ARGS_((Tcl_AsyncHandler async));
|
||||
EXTERN Tcl_AsyncHandler Tcl_AsyncCreate _ANSI_ARGS_((Tcl_AsyncProc *proc,
|
||||
ClientData clientData));
|
||||
EXTERN void Tcl_AsyncDelete _ANSI_ARGS_((Tcl_AsyncHandler async));
|
||||
EXTERN int Tcl_AsyncInvoke _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
int code));
|
||||
EXTERN void Tcl_AppendElement _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *string));
|
||||
EXTERN void Tcl_AppendResult _ANSI_ARGS_(VARARGS);
|
||||
EXTERN int Tcl_AppInit _ANSI_ARGS_((Tcl_Interp *interp));
|
||||
EXTERN void Tcl_AddErrorInfo _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *message));
|
||||
EXTERN char Tcl_Backslash _ANSI_ARGS_((char *src,
|
||||
int *readPtr));
|
||||
EXTERN void Tcl_CallWhenDeleted _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
Tcl_InterpDeleteProc *proc,
|
||||
ClientData clientData));
|
||||
EXTERN int Tcl_CommandComplete _ANSI_ARGS_((char *cmd));
|
||||
EXTERN char * Tcl_Concat _ANSI_ARGS_((int argc, char **argv));
|
||||
EXTERN int Tcl_ConvertElement _ANSI_ARGS_((char *src,
|
||||
char *dst, int flags));
|
||||
EXTERN void Tcl_CreateCommand _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *cmdName, Tcl_CmdProc *proc,
|
||||
ClientData clientData,
|
||||
Tcl_CmdDeleteProc *deleteProc));
|
||||
EXTERN Tcl_Interp * Tcl_CreateInterp _ANSI_ARGS_((void));
|
||||
EXTERN void Tcl_CreateMathFunc _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *name, int numArgs, Tcl_ValueType *argTypes,
|
||||
Tcl_MathProc *proc, ClientData clientData));
|
||||
EXTERN int Tcl_CreatePipeline _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
int argc, char **argv, int **pidArrayPtr,
|
||||
int *inPipePtr, int *outPipePtr,
|
||||
int *errFilePtr));
|
||||
EXTERN Tcl_Trace Tcl_CreateTrace _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
int level, Tcl_CmdTraceProc *proc,
|
||||
ClientData clientData));
|
||||
EXTERN void Tcl_DeleteHashEntry _ANSI_ARGS_((
|
||||
Tcl_HashEntry *entryPtr));
|
||||
EXTERN void Tcl_DeleteHashTable _ANSI_ARGS_((
|
||||
Tcl_HashTable *tablePtr));
|
||||
EXTERN char * Tcl_DStringAppend _ANSI_ARGS_((Tcl_DString *dsPtr,
|
||||
char *string, int length));
|
||||
EXTERN char * Tcl_DStringAppendElement _ANSI_ARGS_((
|
||||
Tcl_DString *dsPtr, char *string));
|
||||
EXTERN void Tcl_DStringEndSublist _ANSI_ARGS_((Tcl_DString *dsPtr));
|
||||
EXTERN void Tcl_DStringFree _ANSI_ARGS_((Tcl_DString *dsPtr));
|
||||
EXTERN void Tcl_DStringInit _ANSI_ARGS_((Tcl_DString *dsPtr));
|
||||
EXTERN void Tcl_DStringResult _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
Tcl_DString *dsPtr));
|
||||
EXTERN void Tcl_DStringStartSublist _ANSI_ARGS_((
|
||||
Tcl_DString *dsPtr));
|
||||
EXTERN void Tcl_DStringTrunc _ANSI_ARGS_((Tcl_DString *dsPtr,
|
||||
int length));
|
||||
EXTERN int Tcl_DeleteCommand _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *cmdName));
|
||||
EXTERN void Tcl_DeleteInterp _ANSI_ARGS_((Tcl_Interp *interp));
|
||||
EXTERN void Tcl_DeleteTrace _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
Tcl_Trace trace));
|
||||
EXTERN void Tcl_DetachPids _ANSI_ARGS_((int numPids, int *pidPtr));
|
||||
EXTERN void Tcl_DontCallWhenDeleted _ANSI_ARGS_((
|
||||
Tcl_Interp *interp, Tcl_InterpDeleteProc *proc,
|
||||
ClientData clientData));
|
||||
EXTERN void Tcl_EnterFile _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
FILE *file, int permissions));
|
||||
EXTERN char * Tcl_ErrnoId _ANSI_ARGS_((void));
|
||||
EXTERN int Tcl_Eval _ANSI_ARGS_((Tcl_Interp *interp, char *cmd));
|
||||
EXTERN int Tcl_EvalFile _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *fileName));
|
||||
EXTERN int Tcl_ExprBoolean _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *string, int *ptr));
|
||||
EXTERN int Tcl_ExprDouble _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *string, double *ptr));
|
||||
EXTERN int Tcl_ExprLong _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *string, long *ptr));
|
||||
EXTERN int Tcl_ExprString _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *string));
|
||||
EXTERN int Tcl_FilePermissions _ANSI_ARGS_((FILE *file));
|
||||
EXTERN Tcl_HashEntry * Tcl_FirstHashEntry _ANSI_ARGS_((
|
||||
Tcl_HashTable *tablePtr,
|
||||
Tcl_HashSearch *searchPtr));
|
||||
EXTERN int Tcl_GetBoolean _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *string, int *boolPtr));
|
||||
EXTERN int Tcl_GetCommandInfo _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *cmdName, Tcl_CmdInfo *infoPtr));
|
||||
EXTERN int Tcl_GetDouble _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *string, double *doublePtr));
|
||||
EXTERN int Tcl_GetInt _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *string, int *intPtr));
|
||||
EXTERN int Tcl_GetOpenFile _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *string, int write, int checkUsage,
|
||||
FILE **filePtr));
|
||||
EXTERN char * Tcl_GetVar _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *varName, int flags));
|
||||
EXTERN char * Tcl_GetVar2 _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *part1, char *part2, int flags));
|
||||
EXTERN int Tcl_GlobalEval _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *command));
|
||||
EXTERN char * Tcl_HashStats _ANSI_ARGS_((Tcl_HashTable *tablePtr));
|
||||
EXTERN int Tcl_Init _ANSI_ARGS_((Tcl_Interp *interp));
|
||||
EXTERN void Tcl_InitHashTable _ANSI_ARGS_((Tcl_HashTable *tablePtr,
|
||||
int keyType));
|
||||
EXTERN void Tcl_InitMemory _ANSI_ARGS_((Tcl_Interp *interp));
|
||||
EXTERN int Tcl_LinkVar _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *varName, char *addr, int type));
|
||||
EXTERN char * Tcl_Merge _ANSI_ARGS_((int argc, char **argv));
|
||||
EXTERN Tcl_HashEntry * Tcl_NextHashEntry _ANSI_ARGS_((
|
||||
Tcl_HashSearch *searchPtr));
|
||||
EXTERN char * Tcl_ParseVar _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *string, char **termPtr));
|
||||
EXTERN char * Tcl_PosixError _ANSI_ARGS_((Tcl_Interp *interp));
|
||||
EXTERN void Tcl_PrintDouble _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
double value, char *dst));
|
||||
EXTERN void Tcl_ReapDetachedProcs _ANSI_ARGS_((void));
|
||||
EXTERN int Tcl_RecordAndEval _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *cmd, int flags));
|
||||
EXTERN int Tcl_RegExpMatch _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *string, char *pattern));
|
||||
EXTERN void Tcl_ResetResult _ANSI_ARGS_((Tcl_Interp *interp));
|
||||
#define Tcl_Return Tcl_SetResult
|
||||
EXTERN int Tcl_ScanElement _ANSI_ARGS_((char *string,
|
||||
int *flagPtr));
|
||||
EXTERN int Tcl_SetCommandInfo _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *cmdName, Tcl_CmdInfo *infoPtr));
|
||||
EXTERN void Tcl_SetErrorCode _ANSI_ARGS_(VARARGS);
|
||||
EXTERN int Tcl_SetRecursionLimit _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
int depth));
|
||||
EXTERN void Tcl_SetResult _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *string, Tcl_FreeProc *freeProc));
|
||||
EXTERN char * Tcl_SetVar _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *varName, char *newValue, int flags));
|
||||
EXTERN char * Tcl_SetVar2 _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *part1, char *part2, char *newValue,
|
||||
int flags));
|
||||
EXTERN char * Tcl_SignalId _ANSI_ARGS_((int sig));
|
||||
EXTERN char * Tcl_SignalMsg _ANSI_ARGS_((int sig));
|
||||
EXTERN int Tcl_SplitList _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *list, int *argcPtr, char ***argvPtr));
|
||||
EXTERN int Tcl_StringMatch _ANSI_ARGS_((char *string,
|
||||
char *pattern));
|
||||
EXTERN char * Tcl_TildeSubst _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *name, Tcl_DString *bufferPtr));
|
||||
EXTERN int Tcl_TraceVar _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *varName, int flags, Tcl_VarTraceProc *proc,
|
||||
ClientData clientData));
|
||||
EXTERN int Tcl_TraceVar2 _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *part1, char *part2, int flags,
|
||||
Tcl_VarTraceProc *proc, ClientData clientData));
|
||||
EXTERN void Tcl_UnlinkVar _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *varName));
|
||||
EXTERN int Tcl_UnsetVar _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *varName, int flags));
|
||||
EXTERN int Tcl_UnsetVar2 _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *part1, char *part2, int flags));
|
||||
EXTERN void Tcl_UntraceVar _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *varName, int flags, Tcl_VarTraceProc *proc,
|
||||
ClientData clientData));
|
||||
EXTERN void Tcl_UntraceVar2 _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *part1, char *part2, int flags,
|
||||
Tcl_VarTraceProc *proc, ClientData clientData));
|
||||
EXTERN int Tcl_VarEval _ANSI_ARGS_(VARARGS);
|
||||
EXTERN ClientData Tcl_VarTraceInfo _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *varName, int flags,
|
||||
Tcl_VarTraceProc *procPtr,
|
||||
ClientData prevClientData));
|
||||
EXTERN ClientData Tcl_VarTraceInfo2 _ANSI_ARGS_((Tcl_Interp *interp,
|
||||
char *part1, char *part2, int flags,
|
||||
Tcl_VarTraceProc *procPtr,
|
||||
ClientData prevClientData));
|
||||
|
||||
#endif /* _TCL */
|
@ -1,95 +0,0 @@
|
||||
/*
|
||||
* tclAppInit.c --
|
||||
*
|
||||
* Provides a default version of the Tcl_AppInit procedure.
|
||||
*
|
||||
* Copyright (c) 1993 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, without written agreement and without
|
||||
* license or royalty fees, to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose, provided that the
|
||||
* above copyright notice and the following two paragraphs appear in
|
||||
* all copies of this software.
|
||||
*
|
||||
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
||||
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
|
||||
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/tclAppInit.c,v 1.6 93/08/26 14:34:55 ouster Exp $ SPRITE (Berkeley)";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "tcl.h"
|
||||
|
||||
/*
|
||||
* The following variable is a special hack that allows applications
|
||||
* to be linked using the procedure "main" from the Tcl library. The
|
||||
* variable generates a reference to "main", which causes main to
|
||||
* be brought in from the library (and all of Tcl with it).
|
||||
*/
|
||||
|
||||
extern int main();
|
||||
int *tclDummyMainPtr = (int *) main;
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* Tcl_AppInit --
|
||||
*
|
||||
* This procedure performs application-specific initialization.
|
||||
* Most applications, especially those that incorporate additional
|
||||
* packages, will have their own version of this procedure.
|
||||
*
|
||||
* Results:
|
||||
* Returns a standard Tcl completion code, and leaves an error
|
||||
* message in interp->result if an error occurs.
|
||||
*
|
||||
* Side effects:
|
||||
* Depends on the startup script.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int
|
||||
Tcl_AppInit(interp)
|
||||
Tcl_Interp *interp; /* Interpreter for application. */
|
||||
{
|
||||
/*
|
||||
* Call the init procedures for included packages. Each call should
|
||||
* look like this:
|
||||
*
|
||||
* if (Mod_Init(interp) == TCL_ERROR) {
|
||||
* return TCL_ERROR;
|
||||
* }
|
||||
*
|
||||
* where "Mod" is the name of the module.
|
||||
*/
|
||||
|
||||
if (Tcl_Init(interp) == TCL_ERROR) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* Call Tcl_CreateCommand for application-specific commands, if
|
||||
* they weren't already created by the init procedures called above.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Specify a user-specific startup file to invoke if the application
|
||||
* is run interactively. Typically the startup file is "~/.apprc"
|
||||
* where "app" is the name of the application. If this line is deleted
|
||||
* then no user-specific startup file will be run under any conditions.
|
||||
*/
|
||||
|
||||
tcl_RcFileName = "~/.tclshrc";
|
||||
return TCL_OK;
|
||||
}
|
@ -1,952 +0,0 @@
|
||||
/*
|
||||
* tclCmdAH.c --
|
||||
*
|
||||
* This file contains the top-level command routines for most of
|
||||
* the Tcl built-in commands whose names begin with the letters
|
||||
* A to H.
|
||||
*
|
||||
* Copyright (c) 1987-1993 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, without written agreement and without
|
||||
* license or royalty fees, to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose, provided that the
|
||||
* above copyright notice and the following two paragraphs appear in
|
||||
* all copies of this software.
|
||||
*
|
||||
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
||||
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
|
||||
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/tclCmdAH.c,v 1.93 93/10/28 16:19:20 ouster Exp $ SPRITE (Berkeley)";
|
||||
#endif
|
||||
|
||||
#include "tclInt.h"
|
||||
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* Tcl_BreakCmd --
|
||||
*
|
||||
* This procedure is invoked to process the "break" Tcl command.
|
||||
* See the user documentation for details on what it does.
|
||||
*
|
||||
* Results:
|
||||
* A standard Tcl result.
|
||||
*
|
||||
* Side effects:
|
||||
* See the user documentation.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
Tcl_BreakCmd(dummy, interp, argc, argv)
|
||||
ClientData dummy; /* Not used. */
|
||||
Tcl_Interp *interp; /* Current interpreter. */
|
||||
int argc; /* Number of arguments. */
|
||||
char **argv; /* Argument strings. */
|
||||
{
|
||||
if (argc != 1) {
|
||||
Tcl_AppendResult(interp, "wrong # args: should be \"",
|
||||
argv[0], "\"", (char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
return TCL_BREAK;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* Tcl_CaseCmd --
|
||||
*
|
||||
* This procedure is invoked to process the "case" Tcl command.
|
||||
* See the user documentation for details on what it does.
|
||||
*
|
||||
* Results:
|
||||
* A standard Tcl result.
|
||||
*
|
||||
* Side effects:
|
||||
* See the user documentation.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
Tcl_CaseCmd(dummy, interp, argc, argv)
|
||||
ClientData dummy; /* Not used. */
|
||||
Tcl_Interp *interp; /* Current interpreter. */
|
||||
int argc; /* Number of arguments. */
|
||||
char **argv; /* Argument strings. */
|
||||
{
|
||||
int i, result;
|
||||
int body;
|
||||
char *string;
|
||||
int caseArgc, splitArgs;
|
||||
char **caseArgv;
|
||||
|
||||
if (argc < 3) {
|
||||
Tcl_AppendResult(interp, "wrong # args: should be \"",
|
||||
argv[0], " string ?in? patList body ... ?default body?\"",
|
||||
(char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
string = argv[1];
|
||||
body = -1;
|
||||
if (strcmp(argv[2], "in") == 0) {
|
||||
i = 3;
|
||||
} else {
|
||||
i = 2;
|
||||
}
|
||||
caseArgc = argc - i;
|
||||
caseArgv = argv + i;
|
||||
|
||||
/*
|
||||
* If all of the pattern/command pairs are lumped into a single
|
||||
* argument, split them out again.
|
||||
*/
|
||||
|
||||
splitArgs = 0;
|
||||
if (caseArgc == 1) {
|
||||
result = Tcl_SplitList(interp, caseArgv[0], &caseArgc, &caseArgv);
|
||||
if (result != TCL_OK) {
|
||||
return result;
|
||||
}
|
||||
splitArgs = 1;
|
||||
}
|
||||
|
||||
for (i = 0; i < caseArgc; i += 2) {
|
||||
int patArgc, j;
|
||||
char **patArgv;
|
||||
register char *p;
|
||||
|
||||
if (i == (caseArgc-1)) {
|
||||
interp->result = "extra case pattern with no body";
|
||||
result = TCL_ERROR;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for special case of single pattern (no list) with
|
||||
* no backslash sequences.
|
||||
*/
|
||||
|
||||
for (p = caseArgv[i]; *p != 0; p++) {
|
||||
if (isspace(UCHAR(*p)) || (*p == '\\')) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (*p == 0) {
|
||||
if ((*caseArgv[i] == 'd')
|
||||
&& (strcmp(caseArgv[i], "default") == 0)) {
|
||||
body = i+1;
|
||||
}
|
||||
if (Tcl_StringMatch(string, caseArgv[i])) {
|
||||
body = i+1;
|
||||
goto match;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Break up pattern lists, then check each of the patterns
|
||||
* in the list.
|
||||
*/
|
||||
|
||||
result = Tcl_SplitList(interp, caseArgv[i], &patArgc, &patArgv);
|
||||
if (result != TCL_OK) {
|
||||
goto cleanup;
|
||||
}
|
||||
for (j = 0; j < patArgc; j++) {
|
||||
if (Tcl_StringMatch(string, patArgv[j])) {
|
||||
body = i+1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ckfree((char *) patArgv);
|
||||
if (j < patArgc) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
match:
|
||||
if (body != -1) {
|
||||
result = Tcl_Eval(interp, caseArgv[body]);
|
||||
if (result == TCL_ERROR) {
|
||||
char msg[100];
|
||||
sprintf(msg, "\n (\"%.50s\" arm line %d)", caseArgv[body-1],
|
||||
interp->errorLine);
|
||||
Tcl_AddErrorInfo(interp, msg);
|
||||
}
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/*
|
||||
* Nothing matched: return nothing.
|
||||
*/
|
||||
|
||||
result = TCL_OK;
|
||||
|
||||
cleanup:
|
||||
if (splitArgs) {
|
||||
ckfree((char *) caseArgv);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* Tcl_CatchCmd --
|
||||
*
|
||||
* This procedure is invoked to process the "catch" Tcl command.
|
||||
* See the user documentation for details on what it does.
|
||||
*
|
||||
* Results:
|
||||
* A standard Tcl result.
|
||||
*
|
||||
* Side effects:
|
||||
* See the user documentation.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
Tcl_CatchCmd(dummy, interp, argc, argv)
|
||||
ClientData dummy; /* Not used. */
|
||||
Tcl_Interp *interp; /* Current interpreter. */
|
||||
int argc; /* Number of arguments. */
|
||||
char **argv; /* Argument strings. */
|
||||
{
|
||||
int result;
|
||||
|
||||
if ((argc != 2) && (argc != 3)) {
|
||||
Tcl_AppendResult(interp, "wrong # args: should be \"",
|
||||
argv[0], " command ?varName?\"", (char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
result = Tcl_Eval(interp, argv[1]);
|
||||
if (argc == 3) {
|
||||
if (Tcl_SetVar(interp, argv[2], interp->result, 0) == NULL) {
|
||||
Tcl_SetResult(interp, "couldn't save command result in variable",
|
||||
TCL_STATIC);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
Tcl_ResetResult(interp);
|
||||
sprintf(interp->result, "%d", result);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* Tcl_ConcatCmd --
|
||||
*
|
||||
* This procedure is invoked to process the "concat" Tcl command.
|
||||
* See the user documentation for details on what it does.
|
||||
*
|
||||
* Results:
|
||||
* A standard Tcl result.
|
||||
*
|
||||
* Side effects:
|
||||
* See the user documentation.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
Tcl_ConcatCmd(dummy, interp, argc, argv)
|
||||
ClientData dummy; /* Not used. */
|
||||
Tcl_Interp *interp; /* Current interpreter. */
|
||||
int argc; /* Number of arguments. */
|
||||
char **argv; /* Argument strings. */
|
||||
{
|
||||
if (argc >= 2) {
|
||||
interp->result = Tcl_Concat(argc-1, argv+1);
|
||||
interp->freeProc = (Tcl_FreeProc *) free;
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* Tcl_ContinueCmd --
|
||||
*
|
||||
* This procedure is invoked to process the "continue" Tcl command.
|
||||
* See the user documentation for details on what it does.
|
||||
*
|
||||
* Results:
|
||||
* A standard Tcl result.
|
||||
*
|
||||
* Side effects:
|
||||
* See the user documentation.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
Tcl_ContinueCmd(dummy, interp, argc, argv)
|
||||
ClientData dummy; /* Not used. */
|
||||
Tcl_Interp *interp; /* Current interpreter. */
|
||||
int argc; /* Number of arguments. */
|
||||
char **argv; /* Argument strings. */
|
||||
{
|
||||
if (argc != 1) {
|
||||
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
|
||||
"\"", (char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
return TCL_CONTINUE;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* Tcl_ErrorCmd --
|
||||
*
|
||||
* This procedure is invoked to process the "error" Tcl command.
|
||||
* See the user documentation for details on what it does.
|
||||
*
|
||||
* Results:
|
||||
* A standard Tcl result.
|
||||
*
|
||||
* Side effects:
|
||||
* See the user documentation.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
Tcl_ErrorCmd(dummy, interp, argc, argv)
|
||||
ClientData dummy; /* Not used. */
|
||||
Tcl_Interp *interp; /* Current interpreter. */
|
||||
int argc; /* Number of arguments. */
|
||||
char **argv; /* Argument strings. */
|
||||
{
|
||||
Interp *iPtr = (Interp *) interp;
|
||||
|
||||
if ((argc < 2) || (argc > 4)) {
|
||||
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
|
||||
" message ?errorInfo? ?errorCode?\"", (char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if ((argc >= 3) && (argv[2][0] != 0)) {
|
||||
Tcl_AddErrorInfo(interp, argv[2]);
|
||||
iPtr->flags |= ERR_ALREADY_LOGGED;
|
||||
}
|
||||
if (argc == 4) {
|
||||
Tcl_SetVar2(interp, "errorCode", (char *) NULL, argv[3],
|
||||
TCL_GLOBAL_ONLY);
|
||||
iPtr->flags |= ERROR_CODE_SET;
|
||||
}
|
||||
Tcl_SetResult(interp, argv[1], TCL_VOLATILE);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* Tcl_EvalCmd --
|
||||
*
|
||||
* This procedure is invoked to process the "eval" Tcl command.
|
||||
* See the user documentation for details on what it does.
|
||||
*
|
||||
* Results:
|
||||
* A standard Tcl result.
|
||||
*
|
||||
* Side effects:
|
||||
* See the user documentation.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
Tcl_EvalCmd(dummy, interp, argc, argv)
|
||||
ClientData dummy; /* Not used. */
|
||||
Tcl_Interp *interp; /* Current interpreter. */
|
||||
int argc; /* Number of arguments. */
|
||||
char **argv; /* Argument strings. */
|
||||
{
|
||||
int result;
|
||||
char *cmd;
|
||||
|
||||
if (argc < 2) {
|
||||
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
|
||||
" arg ?arg ...?\"", (char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (argc == 2) {
|
||||
result = Tcl_Eval(interp, argv[1]);
|
||||
} else {
|
||||
|
||||
/*
|
||||
* More than one argument: concatenate them together with spaces
|
||||
* between, then evaluate the result.
|
||||
*/
|
||||
|
||||
cmd = Tcl_Concat(argc-1, argv+1);
|
||||
result = Tcl_Eval(interp, cmd);
|
||||
ckfree(cmd);
|
||||
}
|
||||
if (result == TCL_ERROR) {
|
||||
char msg[60];
|
||||
sprintf(msg, "\n (\"eval\" body line %d)", interp->errorLine);
|
||||
Tcl_AddErrorInfo(interp, msg);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* Tcl_ExprCmd --
|
||||
*
|
||||
* This procedure is invoked to process the "expr" Tcl command.
|
||||
* See the user documentation for details on what it does.
|
||||
*
|
||||
* Results:
|
||||
* A standard Tcl result.
|
||||
*
|
||||
* Side effects:
|
||||
* See the user documentation.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
Tcl_ExprCmd(dummy, interp, argc, argv)
|
||||
ClientData dummy; /* Not used. */
|
||||
Tcl_Interp *interp; /* Current interpreter. */
|
||||
int argc; /* Number of arguments. */
|
||||
char **argv; /* Argument strings. */
|
||||
{
|
||||
Tcl_DString buffer;
|
||||
int i, result;
|
||||
|
||||
if (argc < 2) {
|
||||
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
|
||||
" arg ?arg ...?\"", (char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
if (argc == 2) {
|
||||
return Tcl_ExprString(interp, argv[1]);
|
||||
}
|
||||
Tcl_DStringInit(&buffer);
|
||||
Tcl_DStringAppend(&buffer, argv[1], -1);
|
||||
for (i = 2; i < argc; i++) {
|
||||
Tcl_DStringAppend(&buffer, " ", 1);
|
||||
Tcl_DStringAppend(&buffer, argv[i], -1);
|
||||
}
|
||||
result = Tcl_ExprString(interp, buffer.string);
|
||||
Tcl_DStringFree(&buffer);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* Tcl_ForCmd --
|
||||
*
|
||||
* This procedure is invoked to process the "for" Tcl command.
|
||||
* See the user documentation for details on what it does.
|
||||
*
|
||||
* Results:
|
||||
* A standard Tcl result.
|
||||
*
|
||||
* Side effects:
|
||||
* See the user documentation.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
Tcl_ForCmd(dummy, interp, argc, argv)
|
||||
ClientData dummy; /* Not used. */
|
||||
Tcl_Interp *interp; /* Current interpreter. */
|
||||
int argc; /* Number of arguments. */
|
||||
char **argv; /* Argument strings. */
|
||||
{
|
||||
int result, value;
|
||||
|
||||
if (argc != 5) {
|
||||
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
|
||||
" start test next command\"", (char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
result = Tcl_Eval(interp, argv[1]);
|
||||
if (result != TCL_OK) {
|
||||
if (result == TCL_ERROR) {
|
||||
Tcl_AddErrorInfo(interp, "\n (\"for\" initial command)");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
while (1) {
|
||||
result = Tcl_ExprBoolean(interp, argv[2], &value);
|
||||
if (result != TCL_OK) {
|
||||
return result;
|
||||
}
|
||||
if (!value) {
|
||||
break;
|
||||
}
|
||||
result = Tcl_Eval(interp, argv[4]);
|
||||
if ((result != TCL_OK) && (result != TCL_CONTINUE)) {
|
||||
if (result == TCL_ERROR) {
|
||||
char msg[60];
|
||||
sprintf(msg, "\n (\"for\" body line %d)", interp->errorLine);
|
||||
Tcl_AddErrorInfo(interp, msg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
result = Tcl_Eval(interp, argv[3]);
|
||||
if (result == TCL_BREAK) {
|
||||
break;
|
||||
} else if (result != TCL_OK) {
|
||||
if (result == TCL_ERROR) {
|
||||
Tcl_AddErrorInfo(interp, "\n (\"for\" loop-end command)");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
if (result == TCL_BREAK) {
|
||||
result = TCL_OK;
|
||||
}
|
||||
if (result == TCL_OK) {
|
||||
Tcl_ResetResult(interp);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* Tcl_ForeachCmd --
|
||||
*
|
||||
* This procedure is invoked to process the "foreach" Tcl command.
|
||||
* See the user documentation for details on what it does.
|
||||
*
|
||||
* Results:
|
||||
* A standard Tcl result.
|
||||
*
|
||||
* Side effects:
|
||||
* See the user documentation.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
Tcl_ForeachCmd(dummy, interp, argc, argv)
|
||||
ClientData dummy; /* Not used. */
|
||||
Tcl_Interp *interp; /* Current interpreter. */
|
||||
int argc; /* Number of arguments. */
|
||||
char **argv; /* Argument strings. */
|
||||
{
|
||||
int listArgc, i, result;
|
||||
char **listArgv;
|
||||
|
||||
if (argc != 4) {
|
||||
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
|
||||
" varName list command\"", (char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* Break the list up into elements, and execute the command once
|
||||
* for each value of the element.
|
||||
*/
|
||||
|
||||
result = Tcl_SplitList(interp, argv[2], &listArgc, &listArgv);
|
||||
if (result != TCL_OK) {
|
||||
return result;
|
||||
}
|
||||
for (i = 0; i < listArgc; i++) {
|
||||
if (Tcl_SetVar(interp, argv[1], listArgv[i], 0) == NULL) {
|
||||
Tcl_SetResult(interp, "couldn't set loop variable", TCL_STATIC);
|
||||
result = TCL_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
result = Tcl_Eval(interp, argv[3]);
|
||||
if (result != TCL_OK) {
|
||||
if (result == TCL_CONTINUE) {
|
||||
result = TCL_OK;
|
||||
} else if (result == TCL_BREAK) {
|
||||
result = TCL_OK;
|
||||
break;
|
||||
} else if (result == TCL_ERROR) {
|
||||
char msg[100];
|
||||
sprintf(msg, "\n (\"foreach\" body line %d)",
|
||||
interp->errorLine);
|
||||
Tcl_AddErrorInfo(interp, msg);
|
||||
break;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
ckfree((char *) listArgv);
|
||||
if (result == TCL_OK) {
|
||||
Tcl_ResetResult(interp);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* Tcl_FormatCmd --
|
||||
*
|
||||
* This procedure is invoked to process the "format" Tcl command.
|
||||
* See the user documentation for details on what it does.
|
||||
*
|
||||
* Results:
|
||||
* A standard Tcl result.
|
||||
*
|
||||
* Side effects:
|
||||
* See the user documentation.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
Tcl_FormatCmd(dummy, interp, argc, argv)
|
||||
ClientData dummy; /* Not used. */
|
||||
Tcl_Interp *interp; /* Current interpreter. */
|
||||
int argc; /* Number of arguments. */
|
||||
char **argv; /* Argument strings. */
|
||||
{
|
||||
register char *format; /* Used to read characters from the format
|
||||
* string. */
|
||||
char newFormat[40]; /* A new format specifier is generated here. */
|
||||
int width; /* Field width from field specifier, or 0 if
|
||||
* no width given. */
|
||||
int precision; /* Field precision from field specifier, or 0
|
||||
* if no precision given. */
|
||||
int size; /* Number of bytes needed for result of
|
||||
* conversion, based on type of conversion
|
||||
* ("e", "s", etc.) and width from above. */
|
||||
char *oneWordValue = NULL; /* Used to hold value to pass to sprintf, if
|
||||
* it's a one-word value. */
|
||||
double twoWordValue; /* Used to hold value to pass to sprintf if
|
||||
* it's a two-word value. */
|
||||
int useTwoWords; /* 0 means use oneWordValue, 1 means use
|
||||
* twoWordValue. */
|
||||
char *dst = interp->result; /* Where result is stored. Starts off at
|
||||
* interp->resultSpace, but may get dynamically
|
||||
* re-allocated if this isn't enough. */
|
||||
int dstSize = 0; /* Number of non-null characters currently
|
||||
* stored at dst. */
|
||||
int dstSpace = TCL_RESULT_SIZE;
|
||||
/* Total amount of storage space available
|
||||
* in dst (not including null terminator. */
|
||||
int noPercent; /* Special case for speed: indicates there's
|
||||
* no field specifier, just a string to copy. */
|
||||
int argIndex; /* Index of argument to substitute next. */
|
||||
int gotXpg = 0; /* Non-zero means that an XPG3 %n$-style
|
||||
* specifier has been seen. */
|
||||
int gotSequential = 0; /* Non-zero means that a regular sequential
|
||||
* (non-XPG3) conversion specifier has been
|
||||
* seen. */
|
||||
int useShort; /* Value to be printed is short (half word). */
|
||||
char *end; /* Used to locate end of numerical fields. */
|
||||
|
||||
/*
|
||||
* This procedure is a bit nasty. The goal is to use sprintf to
|
||||
* do most of the dirty work. There are several problems:
|
||||
* 1. this procedure can't trust its arguments.
|
||||
* 2. we must be able to provide a large enough result area to hold
|
||||
* whatever's generated. This is hard to estimate.
|
||||
* 2. there's no way to move the arguments from argv to the call
|
||||
* to sprintf in a reasonable way. This is particularly nasty
|
||||
* because some of the arguments may be two-word values (doubles).
|
||||
* So, what happens here is to scan the format string one % group
|
||||
* at a time, making many individual calls to sprintf.
|
||||
*/
|
||||
|
||||
if (argc < 2) {
|
||||
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
|
||||
" formatString ?arg arg ...?\"", (char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
argIndex = 2;
|
||||
for (format = argv[1]; *format != 0; ) {
|
||||
register char *newPtr = newFormat;
|
||||
|
||||
width = precision = useTwoWords = noPercent = useShort = 0;
|
||||
|
||||
/*
|
||||
* Get rid of any characters before the next field specifier.
|
||||
*/
|
||||
|
||||
if (*format != '%') {
|
||||
register char *p;
|
||||
|
||||
oneWordValue = p = format;
|
||||
while ((*format != '%') && (*format != 0)) {
|
||||
*p = *format;
|
||||
p++;
|
||||
format++;
|
||||
}
|
||||
size = p - oneWordValue;
|
||||
noPercent = 1;
|
||||
goto doField;
|
||||
}
|
||||
|
||||
if (format[1] == '%') {
|
||||
oneWordValue = format;
|
||||
size = 1;
|
||||
noPercent = 1;
|
||||
format += 2;
|
||||
goto doField;
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse off a field specifier, compute how many characters
|
||||
* will be needed to store the result, and substitute for
|
||||
* "*" size specifiers.
|
||||
*/
|
||||
|
||||
*newPtr = '%';
|
||||
newPtr++;
|
||||
format++;
|
||||
if (isdigit(UCHAR(*format))) {
|
||||
int tmp;
|
||||
|
||||
/*
|
||||
* Check for an XPG3-style %n$ specification. Note: there
|
||||
* must not be a mixture of XPG3 specs and non-XPG3 specs
|
||||
* in the same format string.
|
||||
*/
|
||||
|
||||
tmp = strtoul(format, &end, 10);
|
||||
if (*end != '$') {
|
||||
goto notXpg;
|
||||
}
|
||||
format = end+1;
|
||||
gotXpg = 1;
|
||||
if (gotSequential) {
|
||||
goto mixedXPG;
|
||||
}
|
||||
argIndex = tmp+1;
|
||||
if ((argIndex < 2) || (argIndex >= argc)) {
|
||||
goto badIndex;
|
||||
}
|
||||
goto xpgCheckDone;
|
||||
}
|
||||
|
||||
notXpg:
|
||||
gotSequential = 1;
|
||||
if (gotXpg) {
|
||||
goto mixedXPG;
|
||||
}
|
||||
|
||||
xpgCheckDone:
|
||||
while ((*format == '-') || (*format == '#') || (*format == '0')
|
||||
|| (*format == ' ') || (*format == '+')) {
|
||||
*newPtr = *format;
|
||||
newPtr++;
|
||||
format++;
|
||||
}
|
||||
if (isdigit(UCHAR(*format))) {
|
||||
width = strtoul(format, &end, 10);
|
||||
format = end;
|
||||
} else if (*format == '*') {
|
||||
if (argIndex >= argc) {
|
||||
goto badIndex;
|
||||
}
|
||||
if (Tcl_GetInt(interp, argv[argIndex], &width) != TCL_OK) {
|
||||
goto fmtError;
|
||||
}
|
||||
argIndex++;
|
||||
format++;
|
||||
}
|
||||
if (width != 0) {
|
||||
sprintf(newPtr, "%d", width);
|
||||
while (*newPtr != 0) {
|
||||
newPtr++;
|
||||
}
|
||||
}
|
||||
if (*format == '.') {
|
||||
*newPtr = '.';
|
||||
newPtr++;
|
||||
format++;
|
||||
}
|
||||
if (isdigit(UCHAR(*format))) {
|
||||
precision = strtoul(format, &end, 10);
|
||||
format = end;
|
||||
} else if (*format == '*') {
|
||||
if (argIndex >= argc) {
|
||||
goto badIndex;
|
||||
}
|
||||
if (Tcl_GetInt(interp, argv[argIndex], &precision) != TCL_OK) {
|
||||
goto fmtError;
|
||||
}
|
||||
argIndex++;
|
||||
format++;
|
||||
}
|
||||
if (precision != 0) {
|
||||
sprintf(newPtr, "%d", precision);
|
||||
while (*newPtr != 0) {
|
||||
newPtr++;
|
||||
}
|
||||
}
|
||||
if (*format == 'l') {
|
||||
format++;
|
||||
} else if (*format == 'h') {
|
||||
useShort = 1;
|
||||
*newPtr = 'h';
|
||||
newPtr++;
|
||||
format++;
|
||||
}
|
||||
*newPtr = *format;
|
||||
newPtr++;
|
||||
*newPtr = 0;
|
||||
if (argIndex >= argc) {
|
||||
goto badIndex;
|
||||
}
|
||||
switch (*format) {
|
||||
case 'i':
|
||||
newPtr[-1] = 'd';
|
||||
case 'd':
|
||||
case 'o':
|
||||
case 'u':
|
||||
case 'x':
|
||||
case 'X':
|
||||
if (Tcl_GetInt(interp, argv[argIndex], (int *) &oneWordValue)
|
||||
!= TCL_OK) {
|
||||
goto fmtError;
|
||||
}
|
||||
size = 40;
|
||||
break;
|
||||
case 's':
|
||||
oneWordValue = argv[argIndex];
|
||||
size = strlen(argv[argIndex]);
|
||||
break;
|
||||
case 'c':
|
||||
if (Tcl_GetInt(interp, argv[argIndex], (int *) &oneWordValue)
|
||||
!= TCL_OK) {
|
||||
goto fmtError;
|
||||
}
|
||||
size = 1;
|
||||
break;
|
||||
case 'e':
|
||||
case 'E':
|
||||
case 'f':
|
||||
case 'g':
|
||||
case 'G':
|
||||
if (Tcl_GetDouble(interp, argv[argIndex], &twoWordValue)
|
||||
!= TCL_OK) {
|
||||
goto fmtError;
|
||||
}
|
||||
useTwoWords = 1;
|
||||
size = 320;
|
||||
if (precision > 10) {
|
||||
size += precision;
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
interp->result =
|
||||
"format string ended in middle of field specifier";
|
||||
goto fmtError;
|
||||
default:
|
||||
sprintf(interp->result, "bad field specifier \"%c\"", *format);
|
||||
goto fmtError;
|
||||
}
|
||||
argIndex++;
|
||||
format++;
|
||||
|
||||
/*
|
||||
* Make sure that there's enough space to hold the formatted
|
||||
* result, then format it.
|
||||
*/
|
||||
|
||||
doField:
|
||||
if (width > size) {
|
||||
size = width;
|
||||
}
|
||||
if ((dstSize + size) > dstSpace) {
|
||||
char *newDst;
|
||||
int newSpace;
|
||||
|
||||
newSpace = 2*(dstSize + size);
|
||||
newDst = (char *) ckalloc((unsigned) newSpace+1);
|
||||
if (dstSize != 0) {
|
||||
memcpy((VOID *) newDst, (VOID *) dst, dstSize);
|
||||
}
|
||||
if (dstSpace != TCL_RESULT_SIZE) {
|
||||
ckfree(dst);
|
||||
}
|
||||
dst = newDst;
|
||||
dstSpace = newSpace;
|
||||
}
|
||||
if (noPercent) {
|
||||
memcpy((VOID *) (dst+dstSize), (VOID *) oneWordValue, size);
|
||||
dstSize += size;
|
||||
dst[dstSize] = 0;
|
||||
} else {
|
||||
if (useTwoWords) {
|
||||
sprintf(dst+dstSize, newFormat, twoWordValue);
|
||||
} else if (useShort) {
|
||||
/*
|
||||
* The double cast below is needed for a few machines
|
||||
* (e.g. Pyramids as of 1/93) that don't like casts
|
||||
* directly from pointers to shorts.
|
||||
*/
|
||||
|
||||
sprintf(dst+dstSize, newFormat, (short) (int) oneWordValue);
|
||||
} else {
|
||||
sprintf(dst+dstSize, newFormat, (char *) oneWordValue);
|
||||
}
|
||||
dstSize += strlen(dst+dstSize);
|
||||
}
|
||||
}
|
||||
|
||||
interp->result = dst;
|
||||
if (dstSpace != TCL_RESULT_SIZE) {
|
||||
interp->freeProc = (Tcl_FreeProc *) free;
|
||||
} else {
|
||||
interp->freeProc = 0;
|
||||
}
|
||||
return TCL_OK;
|
||||
|
||||
mixedXPG:
|
||||
interp->result = "cannot mix \"%\" and \"%n$\" conversion specifiers";
|
||||
goto fmtError;
|
||||
|
||||
badIndex:
|
||||
if (gotXpg) {
|
||||
interp->result = "\"%n$\" argument index out of range";
|
||||
} else {
|
||||
interp->result = "not enough arguments for all format specifiers";
|
||||
}
|
||||
|
||||
fmtError:
|
||||
if (dstSpace != TCL_RESULT_SIZE) {
|
||||
ckfree(dst);
|
||||
}
|
||||
return TCL_ERROR;
|
||||
}
|
455
tcl7.3/tclGlob.c
455
tcl7.3/tclGlob.c
@ -1,455 +0,0 @@
|
||||
/*
|
||||
* tclGlob.c --
|
||||
*
|
||||
* This file provides procedures and commands for file name
|
||||
* manipulation, such as tilde expansion and globbing.
|
||||
*
|
||||
* Copyright (c) 1990-1993 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, without written agreement and without
|
||||
* license or royalty fees, to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose, provided that the
|
||||
* above copyright notice and the following two paragraphs appear in
|
||||
* all copies of this software.
|
||||
*
|
||||
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
||||
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
|
||||
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/tclGlob.c,v 1.36 93/10/14 15:14:08 ouster Exp $ SPRITE (Berkeley)";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "tclInt.h"
|
||||
#include "tclUnix.h"
|
||||
|
||||
/*
|
||||
* The structure below is used to keep track of a globbing result
|
||||
* being built up (i.e. a partial list of file names). The list
|
||||
* grows dynamically to be as big as needed.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
char *result; /* Pointer to result area. */
|
||||
int totalSpace; /* Total number of characters allocated
|
||||
* for result. */
|
||||
int spaceUsed; /* Number of characters currently in use
|
||||
* to hold the partial result (not including
|
||||
* the terminating NULL). */
|
||||
int dynamic; /* 0 means result is static space, 1 means
|
||||
* it's dynamic. */
|
||||
} GlobResult;
|
||||
|
||||
/*
|
||||
* Declarations for procedures local to this file:
|
||||
*/
|
||||
|
||||
static int DoGlob _ANSI_ARGS_((Tcl_Interp *interp, char *dir,
|
||||
char *rem));
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* DoGlob --
|
||||
*
|
||||
* This recursive procedure forms the heart of the globbing
|
||||
* code. It performs a depth-first traversal of the tree
|
||||
* given by the path name to be globbed.
|
||||
*
|
||||
* Results:
|
||||
* The return value is a standard Tcl result indicating whether
|
||||
* an error occurred in globbing. After a normal return the
|
||||
* result in interp will be set to hold all of the file names
|
||||
* given by the dir and rem arguments. After an error the
|
||||
* result in interp will hold an error message.
|
||||
*
|
||||
* Side effects:
|
||||
* None.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static int
|
||||
DoGlob(interp, dir, rem)
|
||||
Tcl_Interp *interp; /* Interpreter to use for error
|
||||
* reporting (e.g. unmatched brace). */
|
||||
char *dir; /* Name of a directory at which to
|
||||
* start glob expansion. This name
|
||||
* is fixed: it doesn't contain any
|
||||
* globbing chars. */
|
||||
char *rem; /* Path to glob-expand. */
|
||||
{
|
||||
/*
|
||||
* When this procedure is entered, the name to be globbed may
|
||||
* already have been partly expanded by ancestor invocations of
|
||||
* DoGlob. The part that's already been expanded is in "dir"
|
||||
* (this may initially be empty), and the part still to expand
|
||||
* is in "rem". This procedure expands "rem" one level, making
|
||||
* recursive calls to itself if there's still more stuff left
|
||||
* in the remainder.
|
||||
*/
|
||||
|
||||
Tcl_DString newName; /* Holds new name consisting of
|
||||
* dir plus the first part of rem. */
|
||||
register char *p;
|
||||
register char c;
|
||||
char *openBrace, *closeBrace, *name, *dirName;
|
||||
int gotSpecial, baseLength;
|
||||
int result = TCL_OK;
|
||||
struct stat statBuf;
|
||||
|
||||
/*
|
||||
* Make sure that the directory part of the name really is a
|
||||
* directory. If the directory name is "", use the name "."
|
||||
* instead, because some UNIX systems don't treat "" like "."
|
||||
* automatically. Keep the "" for use in generating file names,
|
||||
* otherwise "glob foo.c" would return "./foo.c".
|
||||
*/
|
||||
|
||||
if (*dir == '\0') {
|
||||
dirName = ".";
|
||||
} else {
|
||||
dirName = dir;
|
||||
}
|
||||
if ((stat(dirName, &statBuf) != 0) || !S_ISDIR(statBuf.st_mode)) {
|
||||
return TCL_OK;
|
||||
}
|
||||
Tcl_DStringInit(&newName);
|
||||
|
||||
/*
|
||||
* First, find the end of the next element in rem, checking
|
||||
* along the way for special globbing characters.
|
||||
*/
|
||||
|
||||
gotSpecial = 0;
|
||||
openBrace = closeBrace = NULL;
|
||||
for (p = rem; ; p++) {
|
||||
c = *p;
|
||||
if ((c == '\0') || ((openBrace == NULL) && (c == '/'))) {
|
||||
break;
|
||||
}
|
||||
if ((c == '{') && (openBrace == NULL)) {
|
||||
openBrace = p;
|
||||
}
|
||||
if ((c == '}') && (openBrace != NULL) && (closeBrace == NULL)) {
|
||||
closeBrace = p;
|
||||
}
|
||||
if ((c == '*') || (c == '[') || (c == '\\') || (c == '?')) {
|
||||
gotSpecial = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If there is an open brace in the argument, then make a recursive
|
||||
* call for each element between the braces. In this case, the
|
||||
* recursive call to DoGlob uses the same "dir" that we got.
|
||||
* If there are several brace-pairs in a single name, we just handle
|
||||
* one here, and the others will be handled in recursive calls.
|
||||
*/
|
||||
|
||||
if (openBrace != NULL) {
|
||||
char *element;
|
||||
|
||||
if (closeBrace == NULL) {
|
||||
Tcl_ResetResult(interp);
|
||||
interp->result = "unmatched open-brace in file name";
|
||||
result = TCL_ERROR;
|
||||
goto done;
|
||||
}
|
||||
Tcl_DStringAppend(&newName, rem, openBrace-rem);
|
||||
baseLength = newName.length;
|
||||
for (p = openBrace; *p != '}'; ) {
|
||||
element = p+1;
|
||||
for (p = element; ((*p != '}') && (*p != ',')); p++) {
|
||||
/* Empty loop body. */
|
||||
}
|
||||
Tcl_DStringAppend(&newName, element, p-element);
|
||||
Tcl_DStringAppend(&newName, closeBrace+1, -1);
|
||||
result = DoGlob(interp, dir, newName.string);
|
||||
if (result != TCL_OK) {
|
||||
goto done;
|
||||
}
|
||||
newName.length = baseLength;
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
|
||||
/*
|
||||
* Start building up the next-level name with dir plus a slash if
|
||||
* needed to separate it from the next file name.
|
||||
*/
|
||||
|
||||
Tcl_DStringAppend(&newName, dir, -1);
|
||||
if ((dir[0] != 0) && (newName.string[newName.length-1] != '/')) {
|
||||
Tcl_DStringAppend(&newName, "/", 1);
|
||||
}
|
||||
baseLength = newName.length;
|
||||
|
||||
/*
|
||||
* If there were any pattern-matching characters, then scan through
|
||||
* the directory to find all the matching names.
|
||||
*/
|
||||
|
||||
if (gotSpecial) {
|
||||
DIR *d;
|
||||
struct dirent *entryPtr;
|
||||
char savedChar;
|
||||
|
||||
d = opendir(dirName);
|
||||
if (d == NULL) {
|
||||
Tcl_ResetResult(interp);
|
||||
Tcl_AppendResult(interp, "couldn't read directory \"",
|
||||
dirName, "\": ", Tcl_PosixError(interp), (char *) NULL);
|
||||
result = TCL_ERROR;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/*
|
||||
* Temporarily store a null into rem so that the pattern string
|
||||
* is now null-terminated.
|
||||
*/
|
||||
|
||||
savedChar = *p;
|
||||
*p = 0;
|
||||
|
||||
while (1) {
|
||||
entryPtr = readdir(d);
|
||||
if (entryPtr == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Don't match names starting with "." unless the "." is
|
||||
* present in the pattern.
|
||||
*/
|
||||
|
||||
if ((*entryPtr->d_name == '.') && (*rem != '.')) {
|
||||
continue;
|
||||
}
|
||||
if (Tcl_StringMatch(entryPtr->d_name, rem)) {
|
||||
newName.length = baseLength;
|
||||
Tcl_DStringAppend(&newName, entryPtr->d_name, -1);
|
||||
if (savedChar == 0) {
|
||||
Tcl_AppendElement(interp, newName.string);
|
||||
} else {
|
||||
result = DoGlob(interp, newName.string, p+1);
|
||||
if (result != TCL_OK) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(d);
|
||||
*p = savedChar;
|
||||
goto done;
|
||||
}
|
||||
|
||||
/*
|
||||
* The current element is a simple one with no fancy features. Add
|
||||
* it to the new name. If there are more elements still to come,
|
||||
* then recurse to process them.
|
||||
*/
|
||||
|
||||
Tcl_DStringAppend(&newName, rem, p-rem);
|
||||
if (*p != 0) {
|
||||
result = DoGlob(interp, newName.string, p+1);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/*
|
||||
* There are no more elements in the pattern. Check to be sure the
|
||||
* file actually exists, then add its name to the list being formed
|
||||
* in interp-result.
|
||||
*/
|
||||
|
||||
name = newName.string;
|
||||
if (*name == 0) {
|
||||
name = ".";
|
||||
}
|
||||
if (access(name, F_OK) != 0) {
|
||||
goto done;
|
||||
}
|
||||
Tcl_AppendElement(interp, name);
|
||||
|
||||
done:
|
||||
Tcl_DStringFree(&newName);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* Tcl_TildeSubst --
|
||||
*
|
||||
* Given a name starting with a tilde, produce a name where
|
||||
* the tilde and following characters have been replaced by
|
||||
* the home directory location for the named user.
|
||||
*
|
||||
* Results:
|
||||
* The result is a pointer to a static string containing
|
||||
* the new name. If there was an error in processing the
|
||||
* tilde, then an error message is left in interp->result
|
||||
* and the return value is NULL. The result may be stored
|
||||
* in bufferPtr; the caller must call Tcl_DStringFree(bufferPtr)
|
||||
* to free the name.
|
||||
*
|
||||
* Side effects:
|
||||
* Information may be left in bufferPtr.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
char *
|
||||
Tcl_TildeSubst(interp, name, bufferPtr)
|
||||
Tcl_Interp *interp; /* Interpreter in which to store error
|
||||
* message (if necessary). */
|
||||
char *name; /* File name, which may begin with "~/"
|
||||
* (to indicate current user's home directory)
|
||||
* or "~<user>/" (to indicate any user's
|
||||
* home directory). */
|
||||
Tcl_DString *bufferPtr; /* May be used to hold result. Must not hold
|
||||
* anything at the time of the call, and need
|
||||
* not even be initialized. */
|
||||
{
|
||||
char *dir;
|
||||
register char *p;
|
||||
|
||||
Tcl_DStringInit(bufferPtr);
|
||||
if (name[0] != '~') {
|
||||
return name;
|
||||
}
|
||||
|
||||
if ((name[1] == '/') || (name[1] == '\0')) {
|
||||
dir = getenv("HOME");
|
||||
if (dir == NULL) {
|
||||
Tcl_ResetResult(interp);
|
||||
Tcl_AppendResult(interp, "couldn't find HOME environment ",
|
||||
"variable to expand \"", name, "\"", (char *) NULL);
|
||||
return NULL;
|
||||
}
|
||||
Tcl_DStringAppend(bufferPtr, dir, -1);
|
||||
Tcl_DStringAppend(bufferPtr, name+1, -1);
|
||||
} else {
|
||||
struct passwd *pwPtr;
|
||||
|
||||
for (p = &name[1]; (*p != 0) && (*p != '/'); p++) {
|
||||
/* Null body; just find end of name. */
|
||||
}
|
||||
Tcl_DStringAppend(bufferPtr, name+1, p - (name+1));
|
||||
pwPtr = getpwnam(bufferPtr->string);
|
||||
if (pwPtr == NULL) {
|
||||
endpwent();
|
||||
Tcl_ResetResult(interp);
|
||||
Tcl_AppendResult(interp, "user \"", bufferPtr->string,
|
||||
"\" doesn't exist", (char *) NULL);
|
||||
return NULL;
|
||||
}
|
||||
Tcl_DStringFree(bufferPtr);
|
||||
Tcl_DStringAppend(bufferPtr, pwPtr->pw_dir, -1);
|
||||
Tcl_DStringAppend(bufferPtr, p, -1);
|
||||
endpwent();
|
||||
}
|
||||
return bufferPtr->string;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* Tcl_GlobCmd --
|
||||
*
|
||||
* This procedure is invoked to process the "glob" Tcl command.
|
||||
* See the user documentation for details on what it does.
|
||||
*
|
||||
* Results:
|
||||
* A standard Tcl result.
|
||||
*
|
||||
* Side effects:
|
||||
* See the user documentation.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ARGSUSED */
|
||||
int
|
||||
Tcl_GlobCmd(dummy, interp, argc, argv)
|
||||
ClientData dummy; /* Not used. */
|
||||
Tcl_Interp *interp; /* Current interpreter. */
|
||||
int argc; /* Number of arguments. */
|
||||
char **argv; /* Argument strings. */
|
||||
{
|
||||
int i, result, noComplain, firstArg;
|
||||
|
||||
if (argc < 2) {
|
||||
notEnoughArgs:
|
||||
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
|
||||
" ?switches? name ?name ...?\"", (char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
noComplain = 0;
|
||||
for (firstArg = 1; (firstArg < argc) && (argv[firstArg][0] == '-');
|
||||
firstArg++) {
|
||||
if (strcmp(argv[firstArg], "-nocomplain") == 0) {
|
||||
noComplain = 1;
|
||||
} else if (strcmp(argv[firstArg], "--") == 0) {
|
||||
firstArg++;
|
||||
break;
|
||||
} else {
|
||||
Tcl_AppendResult(interp, "bad switch \"", argv[firstArg],
|
||||
"\": must be -nocomplain or --", (char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
if (firstArg >= argc) {
|
||||
goto notEnoughArgs;
|
||||
}
|
||||
|
||||
for (i = firstArg; i < argc; i++) {
|
||||
char *thisName;
|
||||
Tcl_DString buffer;
|
||||
|
||||
thisName = Tcl_TildeSubst(interp, argv[i], &buffer);
|
||||
if (thisName == NULL) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (*thisName == '/') {
|
||||
if (thisName[1] == '/') {
|
||||
/*
|
||||
* This is a special hack for systems like those from Apollo
|
||||
* where there is a super-root at "//": need to treat the
|
||||
* double-slash as a single name.
|
||||
*/
|
||||
result = DoGlob(interp, "//", thisName+2);
|
||||
} else {
|
||||
result = DoGlob(interp, "/", thisName+1);
|
||||
}
|
||||
} else {
|
||||
result = DoGlob(interp, "", thisName);
|
||||
}
|
||||
Tcl_DStringFree(&buffer);
|
||||
if (result != TCL_OK) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
if ((*interp->result == 0) && !noComplain) {
|
||||
char *sep = "";
|
||||
|
||||
Tcl_AppendResult(interp, "no files matched glob pattern",
|
||||
(argc == 2) ? " \"" : "s \"", (char *) NULL);
|
||||
for (i = firstArg; i < argc; i++) {
|
||||
Tcl_AppendResult(interp, sep, argv[i], (char *) NULL);
|
||||
sep = " ";
|
||||
}
|
||||
Tcl_AppendResult(interp, "\"", (char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
786
tcl7.3/tclTest.c
786
tcl7.3/tclTest.c
@ -1,786 +0,0 @@
|
||||
/*
|
||||
* tclTest.c --
|
||||
*
|
||||
* This file contains C command procedures for a bunch of additional
|
||||
* Tcl commands that are used for testing out Tcl's C interfaces.
|
||||
* These commands are not normally included in Tcl applications;
|
||||
* they're only used for testing.
|
||||
*
|
||||
* Copyright (c) 1993 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, without written agreement and without
|
||||
* license or royalty fees, to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose, provided that the
|
||||
* above copyright notice and the following two paragraphs appear in
|
||||
* all copies of this software.
|
||||
*
|
||||
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
||||
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
|
||||
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Header: /user6/ouster/tcl/RCS/tclTest.c,v 1.15 93/09/09 16:46:52 ouster Exp $ SPRITE (Berkeley)";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "tclInt.h"
|
||||
#include "tclUnix.h"
|
||||
|
||||
/*
|
||||
* The following variable is a special hack that allows applications
|
||||
* to be linked using the procedure "main" from the Tcl library. The
|
||||
* variable generates a reference to "main", which causes main to
|
||||
* be brought in from the library (and all of Tcl with it).
|
||||
*/
|
||||
|
||||
extern int main();
|
||||
int *tclDummyMainPtr = (int *) main;
|
||||
|
||||
/*
|
||||
* Dynamic string shared by TestdcallCmd and DelCallbackProc; used
|
||||
* to collect the results of the various deletion callbacks.
|
||||
*/
|
||||
|
||||
static Tcl_DString delString;
|
||||
static Tcl_Interp *delInterp;
|
||||
|
||||
/*
|
||||
* One of the following structures exists for each asynchronous
|
||||
* handler created by the "testasync" command".
|
||||
*/
|
||||
|
||||
typedef struct TestAsyncHandler {
|
||||
int id; /* Identifier for this handler. */
|
||||
Tcl_AsyncHandler handler; /* Tcl's token for the handler. */
|
||||
char *command; /* Command to invoke when the
|
||||
* handler is invoked. */
|
||||
struct TestAsyncHandler *nextPtr; /* Next is list of handlers. */
|
||||
} TestAsyncHandler;
|
||||
|
||||
static TestAsyncHandler *firstHandler = NULL;
|
||||
|
||||
/*
|
||||
* The variable below is a token for an asynchronous handler for
|
||||
* interrupt signals, or NULL if none exists.
|
||||
*/
|
||||
|
||||
static Tcl_AsyncHandler intHandler;
|
||||
|
||||
/*
|
||||
* The dynamic string below is used by the "testdstring" command
|
||||
* to test the dynamic string facilities.
|
||||
*/
|
||||
|
||||
static Tcl_DString dstring;
|
||||
|
||||
/*
|
||||
* Forward declarations for procedures defined later in this file:
|
||||
*/
|
||||
|
||||
static int AsyncHandlerProc _ANSI_ARGS_((ClientData clientData,
|
||||
Tcl_Interp *interp, int code));
|
||||
static void CmdDelProc1 _ANSI_ARGS_((ClientData clientData));
|
||||
static void CmdDelProc2 _ANSI_ARGS_((ClientData clientData));
|
||||
static int CmdProc1 _ANSI_ARGS_((ClientData clientData,
|
||||
Tcl_Interp *interp, int argc, char **argv));
|
||||
static int CmdProc2 _ANSI_ARGS_((ClientData clientData,
|
||||
Tcl_Interp *interp, int argc, char **argv));
|
||||
static void DelCallbackProc _ANSI_ARGS_((ClientData clientData,
|
||||
Tcl_Interp *interp));
|
||||
static int IntHandlerProc _ANSI_ARGS_((ClientData clientData,
|
||||
Tcl_Interp *interp, int code));
|
||||
static void IntProc();
|
||||
static int TestasyncCmd _ANSI_ARGS_((ClientData dummy,
|
||||
Tcl_Interp *interp, int argc, char **argv));
|
||||
static int TestcmdinfoCmd _ANSI_ARGS_((ClientData dummy,
|
||||
Tcl_Interp *interp, int argc, char **argv));
|
||||
static int TestdcallCmd _ANSI_ARGS_((ClientData dummy,
|
||||
Tcl_Interp *interp, int argc, char **argv));
|
||||
static int TestdstringCmd _ANSI_ARGS_((ClientData dummy,
|
||||
Tcl_Interp *interp, int argc, char **argv));
|
||||
static int TestlinkCmd _ANSI_ARGS_((ClientData dummy,
|
||||
Tcl_Interp *interp, int argc, char **argv));
|
||||
static int TestMathFunc _ANSI_ARGS_((ClientData clientData,
|
||||
Tcl_Interp *interp, Tcl_Value *args,
|
||||
Tcl_Value *resultPtr));
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* Tcl_AppInit --
|
||||
*
|
||||
* This procedure performs application-specific initialization.
|
||||
* Most applications, especially those that incorporate additional
|
||||
* packages, will have their own version of this procedure.
|
||||
*
|
||||
* Results:
|
||||
* Returns a standard Tcl completion code, and leaves an error
|
||||
* message in interp->result if an error occurs.
|
||||
*
|
||||
* Side effects:
|
||||
* Depends on the startup script.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
int
|
||||
Tcl_AppInit(interp)
|
||||
Tcl_Interp *interp; /* Interpreter for application. */
|
||||
{
|
||||
/*
|
||||
* Call the init procedures for included packages. Each call should
|
||||
* look like this:
|
||||
*
|
||||
* if (Mod_Init(interp) == TCL_ERROR) {
|
||||
* return TCL_ERROR;
|
||||
* }
|
||||
*
|
||||
* where "Mod" is the name of the module.
|
||||
*/
|
||||
|
||||
if (Tcl_Init(interp) == TCL_ERROR) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create additional commands and math functions for testing Tcl.
|
||||
*/
|
||||
|
||||
Tcl_CreateCommand(interp, "testasync", TestasyncCmd, (ClientData) 0,
|
||||
(Tcl_CmdDeleteProc *) NULL);
|
||||
Tcl_CreateCommand(interp, "testcmdinfo", TestcmdinfoCmd, (ClientData) 0,
|
||||
(Tcl_CmdDeleteProc *) NULL);
|
||||
Tcl_CreateCommand(interp, "testdcall", TestdcallCmd, (ClientData) 0,
|
||||
(Tcl_CmdDeleteProc *) NULL);
|
||||
Tcl_DStringInit(&dstring);
|
||||
Tcl_CreateCommand(interp, "testdstring", TestdstringCmd, (ClientData) 0,
|
||||
(Tcl_CmdDeleteProc *) NULL);
|
||||
Tcl_CreateCommand(interp, "testlink", TestlinkCmd, (ClientData) 0,
|
||||
(Tcl_CmdDeleteProc *) NULL);
|
||||
Tcl_CreateMathFunc(interp, "T1", 0, (Tcl_ValueType *) NULL, TestMathFunc,
|
||||
(ClientData) 123);
|
||||
Tcl_CreateMathFunc(interp, "T2", 0, (Tcl_ValueType *) NULL, TestMathFunc,
|
||||
(ClientData) 345);
|
||||
|
||||
/*
|
||||
* Specify a user-specific startup file to invoke if the application
|
||||
* is run interactively. If this line is deleted then no user-specific
|
||||
* startup file will be run under any conditions.
|
||||
*/
|
||||
|
||||
tcl_RcFileName = "~/.tclshrc";
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* TestasyncCmd --
|
||||
*
|
||||
* This procedure implements the "testasync" command. It is used
|
||||
* to test the asynchronous handler facilities of Tcl.
|
||||
*
|
||||
* Results:
|
||||
* A standard Tcl result.
|
||||
*
|
||||
* Side effects:
|
||||
* Creates, deletes, and invokes handlers.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ARGSUSED */
|
||||
static int
|
||||
TestasyncCmd(dummy, interp, argc, argv)
|
||||
ClientData dummy; /* Not used. */
|
||||
Tcl_Interp *interp; /* Current interpreter. */
|
||||
int argc; /* Number of arguments. */
|
||||
char **argv; /* Argument strings. */
|
||||
{
|
||||
TestAsyncHandler *asyncPtr, *prevPtr;
|
||||
int id, code;
|
||||
static int nextId = 1;
|
||||
|
||||
if (argc < 2) {
|
||||
wrongNumArgs:
|
||||
interp->result = "wrong # args";
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (strcmp(argv[1], "create") == 0) {
|
||||
if (argc != 3) {
|
||||
goto wrongNumArgs;
|
||||
}
|
||||
asyncPtr = (TestAsyncHandler *) ckalloc(sizeof(TestAsyncHandler));
|
||||
asyncPtr->id = nextId;
|
||||
nextId++;
|
||||
asyncPtr->handler = Tcl_AsyncCreate(AsyncHandlerProc,
|
||||
(ClientData) asyncPtr);
|
||||
asyncPtr->command = ckalloc((unsigned) (strlen(argv[2]) + 1));
|
||||
strcpy(asyncPtr->command, argv[2]);
|
||||
asyncPtr->nextPtr = firstHandler;
|
||||
firstHandler = asyncPtr;
|
||||
sprintf(interp->result, "%d", asyncPtr->id);
|
||||
} else if (strcmp(argv[1], "delete") == 0) {
|
||||
if (argc == 2) {
|
||||
while (firstHandler != NULL) {
|
||||
asyncPtr = firstHandler;
|
||||
firstHandler = asyncPtr->nextPtr;
|
||||
Tcl_AsyncDelete(asyncPtr->handler);
|
||||
ckfree(asyncPtr->command);
|
||||
ckfree((char *) asyncPtr);
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
if (argc != 3) {
|
||||
goto wrongNumArgs;
|
||||
}
|
||||
if (Tcl_GetInt(interp, argv[2], &id) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
for (prevPtr = NULL, asyncPtr = firstHandler; asyncPtr != NULL;
|
||||
prevPtr = asyncPtr, asyncPtr = asyncPtr->nextPtr) {
|
||||
if (asyncPtr->id != id) {
|
||||
continue;
|
||||
}
|
||||
if (prevPtr == NULL) {
|
||||
firstHandler = asyncPtr->nextPtr;
|
||||
} else {
|
||||
prevPtr->nextPtr = asyncPtr->nextPtr;
|
||||
}
|
||||
Tcl_AsyncDelete(asyncPtr->handler);
|
||||
ckfree(asyncPtr->command);
|
||||
ckfree((char *) asyncPtr);
|
||||
break;
|
||||
}
|
||||
} else if (strcmp(argv[1], "int") == 0) {
|
||||
if (argc != 2) {
|
||||
goto wrongNumArgs;
|
||||
}
|
||||
intHandler = Tcl_AsyncCreate(IntHandlerProc, (ClientData) interp);
|
||||
signal(SIGINT, IntProc);
|
||||
} else if (strcmp(argv[1], "mark") == 0) {
|
||||
if (argc != 5) {
|
||||
goto wrongNumArgs;
|
||||
}
|
||||
if ((Tcl_GetInt(interp, argv[2], &id) != TCL_OK)
|
||||
|| (Tcl_GetInt(interp, argv[4], &code) != TCL_OK)) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
for (asyncPtr = firstHandler; asyncPtr != NULL;
|
||||
asyncPtr = asyncPtr->nextPtr) {
|
||||
if (asyncPtr->id == id) {
|
||||
Tcl_AsyncMark(asyncPtr->handler);
|
||||
break;
|
||||
}
|
||||
}
|
||||
Tcl_SetResult(interp, argv[3], TCL_VOLATILE);
|
||||
return code;
|
||||
} else {
|
||||
Tcl_AppendResult(interp, "bad option \"", argv[1],
|
||||
"\": must be create, delete, int, or mark",
|
||||
(char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
AsyncHandlerProc(clientData, interp, code)
|
||||
ClientData clientData; /* Pointer to TestAsyncHandler structure. */
|
||||
Tcl_Interp *interp; /* Interpreter in which command was
|
||||
* executed, or NULL. */
|
||||
int code; /* Current return code from command. */
|
||||
{
|
||||
TestAsyncHandler *asyncPtr = (TestAsyncHandler *) clientData;
|
||||
char *listArgv[4];
|
||||
char string[20], *cmd;
|
||||
|
||||
sprintf(string, "%d", code);
|
||||
listArgv[0] = asyncPtr->command;
|
||||
listArgv[1] = interp->result;
|
||||
listArgv[2] = string;
|
||||
listArgv[3] = NULL;
|
||||
cmd = Tcl_Merge(3, listArgv);
|
||||
code = Tcl_Eval(interp, cmd);
|
||||
ckfree(cmd);
|
||||
return code;
|
||||
}
|
||||
|
||||
static void
|
||||
IntProc()
|
||||
{
|
||||
Tcl_AsyncMark(intHandler);
|
||||
}
|
||||
|
||||
static int
|
||||
IntHandlerProc(clientData, interp, code)
|
||||
ClientData clientData; /* Interpreter in which to invoke command. */
|
||||
Tcl_Interp *interp; /* Interpreter in which command was
|
||||
* executed, or NULL. */
|
||||
int code; /* Current return code from command. */
|
||||
{
|
||||
char *listArgv[4];
|
||||
char string[20], *cmd;
|
||||
|
||||
interp = (Tcl_Interp *) clientData;
|
||||
listArgv[0] = Tcl_GetVar(interp, "sigIntCmd", TCL_GLOBAL_ONLY);
|
||||
if (listArgv[0] == NULL) {
|
||||
return code;
|
||||
}
|
||||
listArgv[1] = interp->result;
|
||||
sprintf(string, "%d", code);
|
||||
listArgv[2] = string;
|
||||
listArgv[3] = NULL;
|
||||
cmd = Tcl_Merge(3, listArgv);
|
||||
code = Tcl_Eval(interp, cmd);
|
||||
ckfree(cmd);
|
||||
return code;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* TestdcallCmd --
|
||||
*
|
||||
* This procedure implements the "testdcall" command. It is used
|
||||
* to test Tcl_CallWhenDeleted.
|
||||
*
|
||||
* Results:
|
||||
* A standard Tcl result.
|
||||
*
|
||||
* Side effects:
|
||||
* Creates and deletes interpreters.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ARGSUSED */
|
||||
static int
|
||||
TestdcallCmd(dummy, interp, argc, argv)
|
||||
ClientData dummy; /* Not used. */
|
||||
Tcl_Interp *interp; /* Current interpreter. */
|
||||
int argc; /* Number of arguments. */
|
||||
char **argv; /* Argument strings. */
|
||||
{
|
||||
int i, id;
|
||||
|
||||
delInterp = Tcl_CreateInterp();
|
||||
Tcl_DStringInit(&delString);
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (Tcl_GetInt(interp, argv[i], &id) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (id < 0) {
|
||||
Tcl_DontCallWhenDeleted(delInterp, DelCallbackProc,
|
||||
(ClientData) (-id));
|
||||
} else {
|
||||
Tcl_CallWhenDeleted(delInterp, DelCallbackProc,
|
||||
(ClientData) id);
|
||||
}
|
||||
}
|
||||
Tcl_DeleteInterp(delInterp);
|
||||
Tcl_DStringResult(interp, &delString);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* The deletion callback used by TestdcallCmd:
|
||||
*/
|
||||
|
||||
static void
|
||||
DelCallbackProc(clientData, interp)
|
||||
ClientData clientData; /* Numerical value to append to
|
||||
* delString. */
|
||||
Tcl_Interp *interp; /* Interpreter being deleted. */
|
||||
{
|
||||
int id = (int) clientData;
|
||||
char buffer[10];
|
||||
|
||||
sprintf(buffer, "%d", id);
|
||||
Tcl_DStringAppendElement(&delString, buffer);
|
||||
if (interp != delInterp) {
|
||||
Tcl_DStringAppendElement(&delString, "bogus interpreter argument!");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* TestcmdinfoCmd --
|
||||
*
|
||||
* This procedure implements the "testcmdinfo" command. It is used
|
||||
* to test Tcl_GetCmdInfo, Tcl_SetCmdInfo, and command creation
|
||||
* and deletion.
|
||||
*
|
||||
* Results:
|
||||
* A standard Tcl result.
|
||||
*
|
||||
* Side effects:
|
||||
* Creates and deletes various commands and modifies their data.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ARGSUSED */
|
||||
static int
|
||||
TestcmdinfoCmd(dummy, interp, argc, argv)
|
||||
ClientData dummy; /* Not used. */
|
||||
Tcl_Interp *interp; /* Current interpreter. */
|
||||
int argc; /* Number of arguments. */
|
||||
char **argv; /* Argument strings. */
|
||||
{
|
||||
Tcl_CmdInfo info;
|
||||
|
||||
if (argc != 3) {
|
||||
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
|
||||
" option cmdName\"", (char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (strcmp(argv[1], "create") == 0) {
|
||||
Tcl_CreateCommand(interp, argv[2], CmdProc1, (ClientData) "original",
|
||||
CmdDelProc1);
|
||||
} else if (strcmp(argv[1], "delete") == 0) {
|
||||
Tcl_DStringInit(&delString);
|
||||
Tcl_DeleteCommand(interp, argv[2]);
|
||||
Tcl_DStringResult(interp, &delString);
|
||||
} else if (strcmp(argv[1], "get") == 0) {
|
||||
if (Tcl_GetCommandInfo(interp, argv[2], &info) ==0) {
|
||||
interp->result = "??";
|
||||
return TCL_OK;
|
||||
}
|
||||
if (info.proc == CmdProc1) {
|
||||
Tcl_AppendResult(interp, "CmdProc1", " ",
|
||||
(char *) info.clientData, (char *) NULL);
|
||||
} else if (info.proc == CmdProc2) {
|
||||
Tcl_AppendResult(interp, "CmdProc2", " ",
|
||||
(char *) info.clientData, (char *) NULL);
|
||||
} else {
|
||||
Tcl_AppendResult(interp, "unknown", (char *) NULL);
|
||||
}
|
||||
if (info.deleteProc == CmdDelProc1) {
|
||||
Tcl_AppendResult(interp, " CmdDelProc1", " ",
|
||||
(char *) info.deleteData, (char *) NULL);
|
||||
} else if (info.deleteProc == CmdDelProc2) {
|
||||
Tcl_AppendResult(interp, " CmdDelProc2", " ",
|
||||
(char *) info.deleteData, (char *) NULL);
|
||||
} else {
|
||||
Tcl_AppendResult(interp, " unknown", (char *) NULL);
|
||||
}
|
||||
} else if (strcmp(argv[1], "modify") == 0) {
|
||||
info.proc = CmdProc2;
|
||||
info.clientData = (ClientData) "new_command_data";
|
||||
info.deleteProc = CmdDelProc2;
|
||||
info.deleteData = (ClientData) "new_delete_data";
|
||||
if (Tcl_SetCommandInfo(interp, argv[2], &info) == 0) {
|
||||
interp->result = "0";
|
||||
} else {
|
||||
interp->result = "1";
|
||||
}
|
||||
} else {
|
||||
Tcl_AppendResult(interp, "bad option \"", argv[1],
|
||||
"\": must be create, delete, get, or modify",
|
||||
(char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static int
|
||||
CmdProc1(clientData, interp, argc, argv)
|
||||
ClientData clientData; /* String to return. */
|
||||
Tcl_Interp *interp; /* Current interpreter. */
|
||||
int argc; /* Number of arguments. */
|
||||
char **argv; /* Argument strings. */
|
||||
{
|
||||
Tcl_AppendResult(interp, "CmdProc1 ", (char *) clientData,
|
||||
(char *) NULL);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static int
|
||||
CmdProc2(clientData, interp, argc, argv)
|
||||
ClientData clientData; /* String to return. */
|
||||
Tcl_Interp *interp; /* Current interpreter. */
|
||||
int argc; /* Number of arguments. */
|
||||
char **argv; /* Argument strings. */
|
||||
{
|
||||
Tcl_AppendResult(interp, "CmdProc2 ", (char *) clientData,
|
||||
(char *) NULL);
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
static void
|
||||
CmdDelProc1(clientData)
|
||||
ClientData clientData; /* String to save. */
|
||||
{
|
||||
Tcl_DStringInit(&delString);
|
||||
Tcl_DStringAppend(&delString, "CmdDelProc1 ", -1);
|
||||
Tcl_DStringAppend(&delString, (char *) clientData, -1);
|
||||
}
|
||||
|
||||
static void
|
||||
CmdDelProc2(clientData)
|
||||
ClientData clientData; /* String to save. */
|
||||
{
|
||||
Tcl_DStringInit(&delString);
|
||||
Tcl_DStringAppend(&delString, "CmdDelProc2 ", -1);
|
||||
Tcl_DStringAppend(&delString, (char *) clientData, -1);
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* TestdstringCmd --
|
||||
*
|
||||
* This procedure implements the "testdstring" command. It is used
|
||||
* to test the dynamic string facilities of Tcl.
|
||||
*
|
||||
* Results:
|
||||
* A standard Tcl result.
|
||||
*
|
||||
* Side effects:
|
||||
* Creates, deletes, and invokes handlers.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ARGSUSED */
|
||||
static int
|
||||
TestdstringCmd(dummy, interp, argc, argv)
|
||||
ClientData dummy; /* Not used. */
|
||||
Tcl_Interp *interp; /* Current interpreter. */
|
||||
int argc; /* Number of arguments. */
|
||||
char **argv; /* Argument strings. */
|
||||
{
|
||||
int count;
|
||||
|
||||
if (argc < 2) {
|
||||
wrongNumArgs:
|
||||
interp->result = "wrong # args";
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (strcmp(argv[1], "append") == 0) {
|
||||
if (argc != 4) {
|
||||
goto wrongNumArgs;
|
||||
}
|
||||
if (Tcl_GetInt(interp, argv[3], &count) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
Tcl_DStringAppend(&dstring, argv[2], count);
|
||||
} else if (strcmp(argv[1], "element") == 0) {
|
||||
if (argc != 3) {
|
||||
goto wrongNumArgs;
|
||||
}
|
||||
Tcl_DStringAppendElement(&dstring, argv[2]);
|
||||
} else if (strcmp(argv[1], "end") == 0) {
|
||||
if (argc != 2) {
|
||||
goto wrongNumArgs;
|
||||
}
|
||||
Tcl_DStringEndSublist(&dstring);
|
||||
} else if (strcmp(argv[1], "free") == 0) {
|
||||
if (argc != 2) {
|
||||
goto wrongNumArgs;
|
||||
}
|
||||
Tcl_DStringFree(&dstring);
|
||||
} else if (strcmp(argv[1], "get") == 0) {
|
||||
if (argc != 2) {
|
||||
goto wrongNumArgs;
|
||||
}
|
||||
interp->result = Tcl_DStringValue(&dstring);
|
||||
} else if (strcmp(argv[1], "length") == 0) {
|
||||
if (argc != 2) {
|
||||
goto wrongNumArgs;
|
||||
}
|
||||
sprintf(interp->result, "%d", Tcl_DStringLength(&dstring));
|
||||
} else if (strcmp(argv[1], "result") == 0) {
|
||||
if (argc != 2) {
|
||||
goto wrongNumArgs;
|
||||
}
|
||||
Tcl_DStringResult(interp, &dstring);
|
||||
} else if (strcmp(argv[1], "trunc") == 0) {
|
||||
if (argc != 3) {
|
||||
goto wrongNumArgs;
|
||||
}
|
||||
if (Tcl_GetInt(interp, argv[2], &count) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
Tcl_DStringTrunc(&dstring, count);
|
||||
} else if (strcmp(argv[1], "start") == 0) {
|
||||
if (argc != 2) {
|
||||
goto wrongNumArgs;
|
||||
}
|
||||
Tcl_DStringStartSublist(&dstring);
|
||||
} else {
|
||||
Tcl_AppendResult(interp, "bad option \"", argv[1],
|
||||
"\": must be append, element, end, free, get, length, ",
|
||||
"result, trunc, or start", (char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* TestlinkCmd --
|
||||
*
|
||||
* This procedure implements the "testlink" command. It is used
|
||||
* to test Tcl_LinkVar and related library procedures.
|
||||
*
|
||||
* Results:
|
||||
* A standard Tcl result.
|
||||
*
|
||||
* Side effects:
|
||||
* Creates and deletes various variable links, plus returns
|
||||
* values of the linked variables.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ARGSUSED */
|
||||
static int
|
||||
TestlinkCmd(dummy, interp, argc, argv)
|
||||
ClientData dummy; /* Not used. */
|
||||
Tcl_Interp *interp; /* Current interpreter. */
|
||||
int argc; /* Number of arguments. */
|
||||
char **argv; /* Argument strings. */
|
||||
{
|
||||
static int intVar = 43;
|
||||
static int boolVar = 4;
|
||||
static double realVar = 1.23;
|
||||
static char *stringVar = NULL;
|
||||
char buffer[TCL_DOUBLE_SPACE];
|
||||
int writable, flag;
|
||||
|
||||
if (argc < 2) {
|
||||
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
|
||||
" option ?arg arg arg?\"", (char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (strcmp(argv[1], "create") == 0) {
|
||||
if (Tcl_GetBoolean(interp, argv[2], &writable) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
|
||||
if (Tcl_LinkVar(interp, "int", (char *) &intVar,
|
||||
TCL_LINK_INT | flag) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (Tcl_GetBoolean(interp, argv[3], &writable) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
|
||||
if (Tcl_LinkVar(interp, "real", (char *) &realVar,
|
||||
TCL_LINK_DOUBLE | flag) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (Tcl_GetBoolean(interp, argv[4], &writable) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
|
||||
if (Tcl_LinkVar(interp, "bool", (char *) &boolVar,
|
||||
TCL_LINK_BOOLEAN | flag) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (Tcl_GetBoolean(interp, argv[5], &writable) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
flag = (writable != 0) ? 0 : TCL_LINK_READ_ONLY;
|
||||
if (Tcl_LinkVar(interp, "string", (char *) &stringVar,
|
||||
TCL_LINK_STRING | flag) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
} else if (strcmp(argv[1], "delete") == 0) {
|
||||
Tcl_UnlinkVar(interp, "int");
|
||||
Tcl_UnlinkVar(interp, "real");
|
||||
Tcl_UnlinkVar(interp, "bool");
|
||||
Tcl_UnlinkVar(interp, "string");
|
||||
} else if (strcmp(argv[1], "get") == 0) {
|
||||
sprintf(buffer, "%d", intVar);
|
||||
Tcl_AppendElement(interp, buffer);
|
||||
Tcl_PrintDouble(interp, realVar, buffer);
|
||||
Tcl_AppendElement(interp, buffer);
|
||||
sprintf(buffer, "%d", boolVar);
|
||||
Tcl_AppendElement(interp, buffer);
|
||||
Tcl_AppendElement(interp, (stringVar == NULL) ? "-" : stringVar);
|
||||
} else if (strcmp(argv[1], "set") == 0) {
|
||||
if (argc != 6) {
|
||||
Tcl_AppendResult(interp, "wrong # args: should be \"",
|
||||
argv[0], " ", argv[1],
|
||||
"intValue realValue boolValue stringValue\"", (char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
if (argv[2][0] != 0) {
|
||||
if (Tcl_GetInt(interp, argv[2], &intVar) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
if (argv[3][0] != 0) {
|
||||
if (Tcl_GetDouble(interp, argv[3], &realVar) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
if (argv[4][0] != 0) {
|
||||
if (Tcl_GetInt(interp, argv[4], &boolVar) != TCL_OK) {
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
if (argv[5][0] != 0) {
|
||||
if (stringVar != NULL) {
|
||||
ckfree(stringVar);
|
||||
}
|
||||
if (strcmp(argv[5], "-") == 0) {
|
||||
stringVar = NULL;
|
||||
} else {
|
||||
stringVar = ckalloc((unsigned) (strlen(argv[5]) + 1));
|
||||
strcpy(stringVar, argv[5]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Tcl_AppendResult(interp, "bad option \"", argv[1],
|
||||
"\": should be create, delete, get, or set",
|
||||
(char *) NULL);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
return TCL_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
*----------------------------------------------------------------------
|
||||
*
|
||||
* TestMathFunc --
|
||||
*
|
||||
* This is a user-defined math procedure to test out math procedures
|
||||
* with no arguments.
|
||||
*
|
||||
* Results:
|
||||
* A normal Tcl completion code.
|
||||
*
|
||||
* Side effects:
|
||||
* None.
|
||||
*
|
||||
*----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ARGSUSED */
|
||||
static int
|
||||
TestMathFunc(clientData, interp, args, resultPtr)
|
||||
ClientData clientData; /* Integer value to return. */
|
||||
Tcl_Interp *interp; /* Not used. */
|
||||
Tcl_Value *args; /* Not used. */
|
||||
Tcl_Value *resultPtr; /* Where to store result. */
|
||||
{
|
||||
resultPtr->type = TCL_INT;
|
||||
resultPtr->intValue = (int) clientData;
|
||||
return TCL_OK;
|
||||
}
|
285
tcl7.3/tclUnix.h
285
tcl7.3/tclUnix.h
@ -1,285 +0,0 @@
|
||||
/*
|
||||
* tclUnix.h --
|
||||
*
|
||||
* This file reads in UNIX-related header files and sets up
|
||||
* UNIX-related macros for Tcl's UNIX core. It should be the
|
||||
* only file that contains #ifdefs to handle different flavors
|
||||
* of UNIX. This file sets up the union of all UNIX-related
|
||||
* things needed by any of the Tcl core files. This file
|
||||
* depends on configuration #defines in tclConfig.h
|
||||
*
|
||||
* Much of the material in this file was originally contributed
|
||||
* by Karl Lehenbauer, Mark Diekhans and Peter da Silva.
|
||||
*
|
||||
* Copyright (c) 1991-1993 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, without written agreement and without
|
||||
* license or royalty fees, to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose, provided that the
|
||||
* above copyright notice and the following two paragraphs appear in
|
||||
* all copies of this software.
|
||||
*
|
||||
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
||||
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
|
||||
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
*
|
||||
* $Header: /user6/ouster/tcl/RCS/tclUnix.h,v 1.46 93/10/28 16:32:28 ouster Exp $ SPRITE (Berkeley)
|
||||
*/
|
||||
|
||||
#ifndef _TCLUNIX
|
||||
#define _TCLUNIX
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <pwd.h>
|
||||
#include <signal.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef USE_DIRENT2_H
|
||||
# include "compat/dirent2.h"
|
||||
#else
|
||||
# ifdef NO_DIRENT_H
|
||||
# include "compat/dirent.h"
|
||||
# else
|
||||
# include <dirent.h>
|
||||
# endif
|
||||
#endif
|
||||
#include <sys/file.h>
|
||||
#include <sys/stat.h>
|
||||
#ifndef NO_SYS_TIME_H
|
||||
# include <sys/time.h>
|
||||
#else
|
||||
# include <time.h>
|
||||
#endif
|
||||
#ifndef NO_SYS_WAIT_H
|
||||
# include <sys/wait.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#else
|
||||
# include "compat/unistd.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Not all systems declare the errno variable in errno.h. so this
|
||||
* file does it explicitly. The list of system error messages also
|
||||
* isn't generally declared in a header file anywhere.
|
||||
*/
|
||||
|
||||
extern int errno;
|
||||
|
||||
/*
|
||||
* The type of the status returned by wait varies from UNIX system
|
||||
* to UNIX system. The macro below defines it:
|
||||
*/
|
||||
|
||||
#ifdef AIX
|
||||
# define WAIT_STATUS_TYPE pid_t
|
||||
#else
|
||||
#ifndef NO_UNION_WAIT
|
||||
# define WAIT_STATUS_TYPE union wait
|
||||
#else
|
||||
# define WAIT_STATUS_TYPE int
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Supply definitions for macros to query wait status, if not already
|
||||
* defined in header files above.
|
||||
*/
|
||||
|
||||
#ifndef WIFEXITED
|
||||
# define WIFEXITED(stat) (((*((int *) &(stat))) & 0xff) == 0)
|
||||
#endif
|
||||
|
||||
#ifndef WEXITSTATUS
|
||||
# define WEXITSTATUS(stat) (((*((int *) &(stat))) >> 8) & 0xff)
|
||||
#endif
|
||||
|
||||
#ifndef WIFSIGNALED
|
||||
# define WIFSIGNALED(stat) (((*((int *) &(stat)))) && ((*((int *) &(stat))) == ((*((int *) &(stat))) & 0x00ff)))
|
||||
#endif
|
||||
|
||||
#ifndef WTERMSIG
|
||||
# define WTERMSIG(stat) ((*((int *) &(stat))) & 0x7f)
|
||||
#endif
|
||||
|
||||
#ifndef WIFSTOPPED
|
||||
# define WIFSTOPPED(stat) (((*((int *) &(stat))) & 0xff) == 0177)
|
||||
#endif
|
||||
|
||||
#ifndef WSTOPSIG
|
||||
# define WSTOPSIG(stat) (((*((int *) &(stat))) >> 8) & 0xff)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Supply macros for seek offsets, if they're not already provided by
|
||||
* an include file.
|
||||
*/
|
||||
|
||||
#ifndef SEEK_SET
|
||||
# define SEEK_SET 0
|
||||
#endif
|
||||
|
||||
#ifndef SEEK_CUR
|
||||
# define SEEK_CUR 1
|
||||
#endif
|
||||
|
||||
#ifndef SEEK_END
|
||||
# define SEEK_END 2
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The stuff below is needed by the "time" command. If this
|
||||
* system has no gettimeofday call, then must use times and the
|
||||
* CLK_TCK #define (from sys/param.h) to compute elapsed time.
|
||||
* Unfortunately, some systems only have HZ and no CLK_TCK, and
|
||||
* some might not even have HZ.
|
||||
*/
|
||||
|
||||
#ifdef NO_GETTOD
|
||||
# include <sys/times.h>
|
||||
# include <sys/param.h>
|
||||
# ifndef CLK_TCK
|
||||
# ifdef HZ
|
||||
# define CLK_TCK HZ
|
||||
# else
|
||||
# define CLK_TCK 60
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define access mode constants if they aren't already defined.
|
||||
*/
|
||||
|
||||
#ifndef F_OK
|
||||
# define F_OK 00
|
||||
#endif
|
||||
#ifndef X_OK
|
||||
# define X_OK 01
|
||||
#endif
|
||||
#ifndef W_OK
|
||||
# define W_OK 02
|
||||
#endif
|
||||
#ifndef R_OK
|
||||
# define R_OK 04
|
||||
#endif
|
||||
|
||||
/*
|
||||
* On systems without symbolic links (i.e. S_IFLNK isn't defined)
|
||||
* define "lstat" to use "stat" instead.
|
||||
*/
|
||||
|
||||
#ifndef S_IFLNK
|
||||
# define lstat stat
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define macros to query file type bits, if they're not already
|
||||
* defined.
|
||||
*/
|
||||
|
||||
#ifndef S_ISREG
|
||||
# ifdef S_IFREG
|
||||
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
|
||||
# else
|
||||
# define S_ISREG(m) 0
|
||||
# endif
|
||||
# endif
|
||||
#ifndef S_ISDIR
|
||||
# ifdef S_IFDIR
|
||||
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||
# else
|
||||
# define S_ISDIR(m) 0
|
||||
# endif
|
||||
# endif
|
||||
#ifndef S_ISCHR
|
||||
# ifdef S_IFCHR
|
||||
# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
|
||||
# else
|
||||
# define S_ISCHR(m) 0
|
||||
# endif
|
||||
# endif
|
||||
#ifndef S_ISBLK
|
||||
# ifdef S_IFBLK
|
||||
# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
|
||||
# else
|
||||
# define S_ISBLK(m) 0
|
||||
# endif
|
||||
# endif
|
||||
#ifndef S_ISFIFO
|
||||
# ifdef S_IFIFO
|
||||
# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
|
||||
# else
|
||||
# define S_ISFIFO(m) 0
|
||||
# endif
|
||||
# endif
|
||||
#ifndef S_ISLNK
|
||||
# ifdef S_IFLNK
|
||||
# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
|
||||
# else
|
||||
# define S_ISLNK(m) 0
|
||||
# endif
|
||||
# endif
|
||||
#ifndef S_ISSOCK
|
||||
# ifdef S_IFSOCK
|
||||
# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
|
||||
# else
|
||||
# define S_ISSOCK(m) 0
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/*
|
||||
* Make sure that MAXPATHLEN is defined.
|
||||
*/
|
||||
|
||||
#ifndef MAXPATHLEN
|
||||
# ifdef PATH_MAX
|
||||
# define MAXPATHLEN PATH_MAX
|
||||
# else
|
||||
# define MAXPATHLEN 2048
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Make sure that L_tmpnam is defined.
|
||||
*/
|
||||
|
||||
#ifndef L_tmpnam
|
||||
# define L_tmpnam 100
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Substitute Tcl's own versions for several system calls. The
|
||||
* Tcl versions retry automatically if interrupted by signals.
|
||||
* (see tclUnixUtil.c).
|
||||
*/
|
||||
|
||||
#define open(a,b,c) TclOpen(a,b,c)
|
||||
#define read(a,b,c) TclRead(a,b,c)
|
||||
#define waitpid(a,b,c) TclWaitpid(a,b,c)
|
||||
#define write(a,b,c) TclWrite(a,b,c)
|
||||
EXTERN int TclOpen _ANSI_ARGS_((char *path, int oflag, int mode));
|
||||
EXTERN int TclRead _ANSI_ARGS_((int fd, VOID *buf, size_t numBytes));
|
||||
EXTERN int TclWaitpid _ANSI_ARGS_((pid_t pid, int *statPtr, int options));
|
||||
EXTERN int TclWrite _ANSI_ARGS_((int fd, VOID *buf, size_t numBytes));
|
||||
|
||||
/*
|
||||
* Variables provided by the C library:
|
||||
*/
|
||||
|
||||
#if defined(_sgi) || defined(__sgi)
|
||||
#define environ _environ
|
||||
#endif
|
||||
extern char **environ;
|
||||
|
||||
#endif /* _TCLUNIX */
|
1998
tcl7.3/tclUnixAZ.c
1998
tcl7.3/tclUnixAZ.c
File diff suppressed because it is too large
Load Diff
1385
tcl7.3/tclUnixUtil.c
1385
tcl7.3/tclUnixUtil.c
File diff suppressed because it is too large
Load Diff
@ -1,121 +0,0 @@
|
||||
# Commands covered: cd, pwd
|
||||
#
|
||||
# This file contains a collection of tests for one or more of the Tcl
|
||||
# built-in commands. Sourcing this file into Tcl runs the tests and
|
||||
# generates output for errors. No output means no errors were found.
|
||||
#
|
||||
# Copyright (c) 1991-1993 The Regents of the University of California.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, without written agreement and without
|
||||
# license or royalty fees, to use, copy, modify, and distribute this
|
||||
# software and its documentation for any purpose, provided that the
|
||||
# above copyright notice and the following two paragraphs appear in
|
||||
# all copies of this software.
|
||||
#
|
||||
# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
||||
# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
|
||||
# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
#
|
||||
# $Header: /user6/ouster/tcl/tests/RCS/cd.test,v 1.21 93/10/07 17:21:21 ouster Exp $ (Berkeley)
|
||||
|
||||
if {[string compare test [info procs test]] == 1} then {source defs}
|
||||
|
||||
catch {exec rm -rf cd.dir}
|
||||
exec mkdir cd.dir
|
||||
exec cat << "Sample text" > cd.dir/test.file
|
||||
set cwd [exec pwd]
|
||||
|
||||
test cd-1.1 {simple pwd check} {
|
||||
pwd
|
||||
} $cwd
|
||||
|
||||
cd cd.dir
|
||||
if $atBerkeley {
|
||||
test cd-2.1 {changing directories} {
|
||||
list [exec pwd]
|
||||
} $cwd/cd.dir
|
||||
test cd-2.2 {changing directories} {
|
||||
pwd
|
||||
} $cwd/cd.dir
|
||||
}
|
||||
test cd-2.3 {changing directories} {
|
||||
exec cat test.file
|
||||
} "Sample text"
|
||||
cd ..
|
||||
test cd-2.4 {changing directories} {
|
||||
exec pwd
|
||||
} $cwd
|
||||
test cd-2.5 {changing directories} {
|
||||
pwd
|
||||
} $cwd
|
||||
test cd-2.6 {changing directories} {
|
||||
exec cat cd.dir/test.file
|
||||
} "Sample text"
|
||||
|
||||
# The tests below seem to fail on lots of machines for a variety
|
||||
# of reasons, such as the auto-mounter, home directories that are
|
||||
# symbolic links, etc.
|
||||
|
||||
if $atBerkeley {
|
||||
set home [exec sh -c "cd; pwd"]
|
||||
test cd-2.7 {changing directories} {
|
||||
cd ~
|
||||
set x [list [exec pwd] [pwd]]
|
||||
cd $cwd
|
||||
set x
|
||||
} "$home $home"
|
||||
test cd-2.8 {changing directories} {
|
||||
cd
|
||||
set x [list [exec pwd] [pwd]]
|
||||
cd $cwd
|
||||
set x
|
||||
} "$home $home"
|
||||
}
|
||||
|
||||
test cd-3.1 {cd return value} {
|
||||
cd .
|
||||
} {}
|
||||
|
||||
test cd-4.1 {errors in cd command} {
|
||||
list [catch {cd 1 2} msg] $msg $errorCode
|
||||
} {1 {wrong # args: should be "cd dirName"} NONE}
|
||||
test cd-4.2 {errors in cd command} {
|
||||
string tolower [list [catch {cd _bad_dir} msg] $msg $errorCode]
|
||||
} {1 {couldn't change working directory to "_bad_dir": no such file or directory} {posix enoent {no such file or directory}}}
|
||||
test cd-4.3 {errors in cd command} {
|
||||
string tolower [list [catch {cd cd.dir/test.file} msg] $msg $errorCode]
|
||||
} {1 {couldn't change working directory to "cd.dir/test.file": not a directory} {posix enotdir {not a directory}}}
|
||||
test cd-4.4 {errors in cd command} {
|
||||
set home $env(HOME)
|
||||
unset env(HOME)
|
||||
set x [list [catch cd msg] $msg]
|
||||
set env(HOME) $home
|
||||
set x
|
||||
} {1 {couldn't find HOME environment variable to expand "~"}}
|
||||
|
||||
test cd-5.1 {errors in pwd command} {
|
||||
list [catch {pwd a} msg] $msg
|
||||
} {1 {wrong # args: should be "pwd"}}
|
||||
if $atBerkeley {
|
||||
exec mkdir cd.dir/child
|
||||
cd cd.dir/child
|
||||
exec chmod 111 ..
|
||||
if {$user != "root"} {
|
||||
test cd-5.2 {errors in pwd command} {
|
||||
catch pwd msg
|
||||
} 1
|
||||
}
|
||||
cd $cwd
|
||||
exec chmod 775 cd.dir
|
||||
}
|
||||
|
||||
catch {exec rm -rf cd.dir}
|
||||
format ""
|
@ -1,53 +0,0 @@
|
||||
# Commands covered: concat
|
||||
#
|
||||
# This file contains a collection of tests for one or more of the Tcl
|
||||
# built-in commands. Sourcing this file into Tcl runs the tests and
|
||||
# generates output for errors. No output means no errors were found.
|
||||
#
|
||||
# Copyright (c) 1991-1993 The Regents of the University of California.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, without written agreement and without
|
||||
# license or royalty fees, to use, copy, modify, and distribute this
|
||||
# software and its documentation for any purpose, provided that the
|
||||
# above copyright notice and the following two paragraphs appear in
|
||||
# all copies of this software.
|
||||
#
|
||||
# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
||||
# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
|
||||
# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
#
|
||||
# $Header: /user6/ouster/tcl/tests/RCS/concat.test,v 1.6 93/10/28 16:13:57 ouster Exp $ (Berkeley)
|
||||
|
||||
if {[string compare test [info procs test]] == 1} then {source defs}
|
||||
|
||||
test concat-1.1 {simple concatenation} {
|
||||
concat a b c d e f g
|
||||
} {a b c d e f g}
|
||||
test concat-1.2 {merging lists together} {
|
||||
concat a {b c d} {e f g h}
|
||||
} {a b c d e f g h}
|
||||
test concat-1.3 {merge lists, retain sub-lists} {
|
||||
concat a {b {c d}} {{e f}} g h
|
||||
} {a b {c d} {e f} g h}
|
||||
test concat-1.4 {special characters} {
|
||||
concat a\{ {b \{c d} \{d
|
||||
} "a{ b \\{c d {d"
|
||||
|
||||
test concat-2.1 {error: no arguments} {
|
||||
list [catch concat msg] $msg
|
||||
} {0 {}}
|
||||
|
||||
test concat-3.1 {pruning off extra white space} {
|
||||
concat {} {a b c}
|
||||
} {a b c}
|
||||
test concat-3.2 {pruning off extra white space} {
|
||||
concat x y " a b c \n\t " " " " def "
|
||||
} {x y a b c def}
|
@ -1,54 +0,0 @@
|
||||
# Commands covered: none
|
||||
#
|
||||
# This file contains a collection of tests for Tcl_CallWhenDeleted.
|
||||
# Sourcing this file into Tcl runs the tests and generates output for
|
||||
# errors. No output means no errors were found.
|
||||
#
|
||||
# Copyright (c) 1993 The Regents of the University of California.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, without written agreement and without
|
||||
# license or royalty fees, to use, copy, modify, and distribute this
|
||||
# software and its documentation for any purpose, provided that the
|
||||
# above copyright notice and the following two paragraphs appear in
|
||||
# all copies of this software.
|
||||
#
|
||||
# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
||||
# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
|
||||
# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
#
|
||||
# $Header: /user6/ouster/tcl/tests/RCS/dcall.test,v 1.3 93/09/09 16:43:05 ouster Exp $ (Berkeley)
|
||||
|
||||
if {[info commands testdcall] == {}} {
|
||||
puts "This application hasn't been compiled with the \"testdcall\""
|
||||
puts "command, so I can't test Tcl_CallWhenDeleted."
|
||||
return
|
||||
}
|
||||
|
||||
if {[string compare test [info procs test]] == 1} then {source defs}
|
||||
|
||||
test dcall-1.1 {deletion callbacks} {
|
||||
testdcall 1 2 3
|
||||
} {1 2 3}
|
||||
test dcall-1.2 {deletion callbacks} {
|
||||
testdcall
|
||||
} {}
|
||||
test dcall-1.3 {deletion callbacks} {
|
||||
testdcall 20 21 22 -22
|
||||
} {20 21}
|
||||
test dcall-1.4 {deletion callbacks} {
|
||||
testdcall 20 21 22 -20
|
||||
} {21 22}
|
||||
test dcall-1.5 {deletion callbacks} {
|
||||
testdcall 20 21 22 -21
|
||||
} {20 22}
|
||||
test dcall-1.6 {deletion callbacks} {
|
||||
testdcall 20 21 22 -21 -22 -20
|
||||
} {}
|
@ -1,94 +0,0 @@
|
||||
# This file contains support code for the Tcl test suite. It is
|
||||
# normally sourced by the individual files in the test suite before
|
||||
# they run their tests. This improved approach to testing was designed
|
||||
# and initially implemented by Mary Ann May-Pumphrey of Sun Microsystems.
|
||||
|
||||
set VERBOSE 0
|
||||
set TESTS {}
|
||||
set auto_noexec 1
|
||||
set auto_noload 1
|
||||
catch {rename unknown ""}
|
||||
|
||||
# If tests are being run as root, issue a warning message and set a
|
||||
# variable to prevent some tests from running at all.
|
||||
|
||||
set user {}
|
||||
catch {set user [exec whoami]}
|
||||
if {$user == "root"} {
|
||||
puts stdout "Warning: you're executing as root. I'll have to"
|
||||
puts stdout "skip some of the tests, since they'll fail as root."
|
||||
}
|
||||
|
||||
# Some of the tests don't work on some system configurations due to
|
||||
# configuration quirks, not due to Tcl problems; in order to prevent
|
||||
# false alarms, these tests are only run in the master source directory
|
||||
# at Berkeley. The presence of a file "Berkeley" in this directory is
|
||||
# used to indicate that these tests should be run.
|
||||
|
||||
set atBerkeley [file exists Berkeley]
|
||||
|
||||
proc print_verbose {test_name test_description contents_of_test code answer} {
|
||||
puts stdout "\n"
|
||||
puts stdout "==== $test_name $test_description"
|
||||
puts stdout "==== Contents of test case:"
|
||||
puts stdout "$contents_of_test"
|
||||
if {$code != 0} {
|
||||
if {$code == 1} {
|
||||
puts stdout "==== Test generated error:"
|
||||
puts stdout $answer
|
||||
} elseif {$code == 2} {
|
||||
puts stdout "==== Test generated return exception; result was:"
|
||||
puts stdout $answer
|
||||
} elseif {$code == 3} {
|
||||
puts stdout "==== Test generated break exception"
|
||||
} elseif {$code == 4} {
|
||||
puts stdout "==== Test generated continue exception"
|
||||
} else {
|
||||
puts stdout "==== Test generated exception $code; message was:"
|
||||
puts stdout $answer
|
||||
}
|
||||
} else {
|
||||
puts stdout "==== Result was:"
|
||||
puts stdout "$answer"
|
||||
}
|
||||
}
|
||||
|
||||
proc test {test_name test_description contents_of_test passing_results} {
|
||||
global VERBOSE
|
||||
global TESTS
|
||||
if {[string compare $TESTS ""] != 0} then {
|
||||
set ok 0
|
||||
foreach test $TESTS {
|
||||
if [string match $test $test_name] then {
|
||||
set ok 1
|
||||
break
|
||||
}
|
||||
}
|
||||
if !$ok then return
|
||||
}
|
||||
set code [catch {uplevel $contents_of_test} answer]
|
||||
if {$code != 0} {
|
||||
print_verbose $test_name $test_description $contents_of_test \
|
||||
$code $answer
|
||||
} elseif {[string compare $answer $passing_results] == 0} then {
|
||||
if $VERBOSE then {
|
||||
print_verbose $test_name $test_description $contents_of_test \
|
||||
$code $answer
|
||||
puts stdout "++++ $test_name PASSED"
|
||||
}
|
||||
} else {
|
||||
print_verbose $test_name $test_description $contents_of_test $code \
|
||||
$answer
|
||||
puts stdout "---- Result should have been:"
|
||||
puts stdout "$passing_results"
|
||||
puts stdout "---- $test_name FAILED"
|
||||
}
|
||||
}
|
||||
|
||||
proc dotests {file args} {
|
||||
global TESTS
|
||||
set savedTests $TESTS
|
||||
set TESTS $args
|
||||
source $file
|
||||
set TESTS $savedTests
|
||||
}
|
@ -1,326 +0,0 @@
|
||||
# Commands covered: file
|
||||
#
|
||||
# This file contains a collection of tests for one or more of the Tcl
|
||||
# built-in commands. Sourcing this file into Tcl runs the tests and
|
||||
# generates output for errors. No output means no errors were found.
|
||||
#
|
||||
# Copyright (c) 1991-1993 The Regents of the University of California.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, without written agreement and without
|
||||
# license or royalty fees, to use, copy, modify, and distribute this
|
||||
# software and its documentation for any purpose, provided that the
|
||||
# above copyright notice and the following two paragraphs appear in
|
||||
# all copies of this software.
|
||||
#
|
||||
# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
||||
# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
|
||||
# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
#
|
||||
# $Header: /user6/ouster/tcl/tests/RCS/file.test,v 1.22 93/04/16 16:46:42 ouster Exp $ (Berkeley)
|
||||
|
||||
if {[string compare test [info procs test]] == 1} then {source defs}
|
||||
|
||||
# rootname and ext
|
||||
|
||||
test file-1.1 {rootname and extension options} {file ext abc.def} .def
|
||||
test file-1.2 {rootname and extension options} {file ro abc.def} abc
|
||||
test file-1.3 {rootname and extension options} {file extension a/b/c.d} .d
|
||||
test file-1.4 {rootname and extension options} {file rootname a/b/c.d} a/b/c
|
||||
test file-1.5 {rootname and extension options} {file extension a/b.c/d} {}
|
||||
test file-1.6 {rootname and extension options} {file rootname a/b.c/d} a/b.c/d
|
||||
set num 7
|
||||
foreach outer { {} a .a a. a.a } {
|
||||
foreach inner { {} a .a a. a.a } {
|
||||
set thing [format %s/%s $outer $inner]
|
||||
test file-1.$num {rootname and extension options} {
|
||||
format %s%s [file rootname $thing] [file ext $thing]
|
||||
} $thing
|
||||
set num [expr $num+1]
|
||||
}
|
||||
}
|
||||
|
||||
# dirname and tail
|
||||
|
||||
test file-2.1 {dirname and tail options} {file dirname .def} .
|
||||
test file-2.2 {dirname and tail options} {file tail abc.def} abc.def
|
||||
test file-2.3 {dirname and tail options} {file d a/b/c.d} a/b
|
||||
test file-2.4 {dirname and tail options} {file ta a/b/c.d} c.d
|
||||
test file-2.5 {dirname and tail options} {file dirname a/b.c/d} a/b.c
|
||||
test file-2.6 {dirname and tail options} {file tail a/b.c/d} d
|
||||
set num 7
|
||||
foreach outer { a .a a. a.a } {
|
||||
foreach inner { {} a .a a. a.a } {
|
||||
set thing [format %s/%s $outer $inner]
|
||||
test file-2.$num {dirname and tail options} {
|
||||
format %s/%s [file dirname $thing] [file tail $thing]
|
||||
} $thing
|
||||
set num [expr $num+1]
|
||||
}
|
||||
}
|
||||
|
||||
# exists
|
||||
|
||||
catch {exec chmod 777 dir.file}
|
||||
catch {exec rm -f dir.file/gorp.file}
|
||||
catch {exec rm -f gorp.file}
|
||||
catch {exec rmdir dir.file}
|
||||
catch {exec rm -f link.file}
|
||||
test file-3.1 {exists option} {file exists gorp.file} 0
|
||||
test file-3.2 {exists option} {file exists dir.file/gorp.file} 0
|
||||
exec cat > gorp.file << abcde
|
||||
exec mkdir dir.file
|
||||
exec cat > dir.file/gorp.file << 12345
|
||||
test file-3.3 {exists option} {file exists gorp.file} 1
|
||||
test file-3.4 {exists option} {file exi dir.file/gorp.file} 1
|
||||
|
||||
# The test below has to be done in /tmp rather than the current
|
||||
# directory in order to guarantee (?) a local file system: some
|
||||
# NFS file systems won't do the stuff below correctly.
|
||||
|
||||
catch {exec rm /tmp/tcl.foo.dir/file}
|
||||
catch {exec rmdir /tmp/tcl.foo.dir}
|
||||
exec mkdir /tmp/tcl.foo.dir
|
||||
exec cat > /tmp/tcl.foo.dir/file << 12345
|
||||
exec chmod 000 /tmp/tcl.foo.dir
|
||||
if {$user != "root"} {
|
||||
test file-3.5 {exists option} {file exists /tmp/tcl.foo.dir/file} 0
|
||||
}
|
||||
exec chmod 775 /tmp/tcl.foo.dir
|
||||
exec rm /tmp/tcl.foo.dir/file
|
||||
exec rmdir /tmp/tcl.foo.dir
|
||||
|
||||
# executable
|
||||
|
||||
exec chmod 000 dir.file
|
||||
if {$user != "root"} {
|
||||
test file-4.1 {executable option} {file executable gorp.file} 0
|
||||
}
|
||||
exec chmod 775 gorp.file
|
||||
test file-4.2 {executable option} {file exe gorp.file} 1
|
||||
|
||||
# isdirectory
|
||||
|
||||
test file-5.1 {isdirectory option} {file isdirectory gorp.file} 0
|
||||
test file-5.2 {isdirectory option} {file isd dir.file} 1
|
||||
|
||||
# isfile
|
||||
|
||||
test file-6.1 {isfile option} {file isfile gorp.file} 1
|
||||
test file-6.2 {isfile option} {file isfile dir.file} 0
|
||||
|
||||
# isowned
|
||||
|
||||
test file-7.1 {owned option} {file owned gorp.file} 1
|
||||
if {$user != "root"} {
|
||||
test file-7.2 {owned option} {file owned /} 0
|
||||
}
|
||||
|
||||
# readable
|
||||
|
||||
exec chmod 444 gorp.file
|
||||
test file-8.1 {readable option} {file readable gorp.file} 1
|
||||
exec chmod 333 gorp.file
|
||||
if {$user != "root"} {
|
||||
test file-8.2 {readable option} {file reada gorp.file} 0
|
||||
}
|
||||
|
||||
# writable
|
||||
|
||||
exec chmod 555 gorp.file
|
||||
if {$user != "root"} {
|
||||
test file-9.1 {writable option} {file writable gorp.file} 0
|
||||
}
|
||||
exec chmod 222 gorp.file
|
||||
test file-9.2 {writable option} {file w gorp.file} 1
|
||||
|
||||
# stat
|
||||
|
||||
exec cat > gorp.file << "Test string"
|
||||
exec chmod 765 gorp.file
|
||||
test file-10.1 {stat option} {
|
||||
catch {unset stat}
|
||||
file stat gorp.file stat
|
||||
lsort [array names stat]
|
||||
} {atime ctime dev gid ino mode mtime nlink size type uid}
|
||||
test file-10.2 {stat option} {
|
||||
catch {unset stat}
|
||||
file stat gorp.file stat
|
||||
list $stat(nlink) $stat(size) [expr $stat(mode)&0777] $stat(type)
|
||||
} {1 11 501 file}
|
||||
test file-10.3 {stat option} {
|
||||
string tolower [list [catch {file stat _bogus_ stat} msg] \
|
||||
$msg $errorCode]
|
||||
} {1 {couldn't stat "_bogus_": no such file or directory} {posix enoent {no such file or directory}}}
|
||||
test file-10.4 {stat option} {
|
||||
list [catch {file stat _bogus_} msg] $msg $errorCode
|
||||
} {1 {wrong # args: should be "file stat name varName"} NONE}
|
||||
test file-10.5 {stat option} {
|
||||
list [catch {file stat _bogus_ a b} msg] $msg $errorCode
|
||||
} {1 {wrong # args: should be "file stat name varName"} NONE}
|
||||
test file-10.6 {stat option} {
|
||||
catch {unset x}
|
||||
set x 44
|
||||
list [catch {file stat gorp.file x} msg] $msg $errorCode
|
||||
} {1 {can't set "x(dev)": variable isn't array} NONE}
|
||||
catch {unset stat}
|
||||
|
||||
# mtime, and size (I've given up trying to find a test for "atime": there
|
||||
# seem to be too many quirks in the way file systems handle this to come
|
||||
# up with a reproducible test).
|
||||
|
||||
test file-11.1 {mtime and atime and size options} {
|
||||
catch {unset stat}
|
||||
file stat gorp.file stat
|
||||
list [expr {[file mtime gorp.file] == $stat(mtime)}] \
|
||||
[expr {[file atime gorp.file] == $stat(atime)}] \
|
||||
[file size gorp.file]
|
||||
} {1 1 11}
|
||||
test file-11.2 {mtime option} {
|
||||
set old [file mtime gorp.file]
|
||||
exec sleep 2
|
||||
set f [open gorp.file w]
|
||||
puts $f "More text"
|
||||
close $f
|
||||
set new [file mtime gorp.file]
|
||||
expr {($new > $old) && ($new <= ($old+5))}
|
||||
} {1}
|
||||
test file-11.3 {size option} {
|
||||
set oldsize [file size gorp.file]
|
||||
set f [open gorp.file a]
|
||||
puts $f "More text"
|
||||
close $f
|
||||
expr {[file size gorp.file] - $oldsize}
|
||||
} {10}
|
||||
test file-11.4 {errors in atime option} {
|
||||
list [catch {file atime _bogus_ x} msg] $msg $errorCode
|
||||
} {1 {wrong # args: should be "file atime name"} NONE}
|
||||
test file-11.5 {errors in atime option} {
|
||||
string tolower [list [catch {file atime _bogus_} msg] \
|
||||
$msg $errorCode]
|
||||
} {1 {couldn't stat "_bogus_": no such file or directory} {posix enoent {no such file or directory}}}
|
||||
test file-11.6 {errors in mtime option} {
|
||||
list [catch {file mtime _bogus_ x} msg] $msg $errorCode
|
||||
} {1 {wrong # args: should be "file mtime name"} NONE}
|
||||
test file-11.7 {errors in mtime option} {
|
||||
string tolower [list [catch {file mtime _bogus_} msg] $msg \
|
||||
$errorCode]
|
||||
} {1 {couldn't stat "_bogus_": no such file or directory} {posix enoent {no such file or directory}}}
|
||||
test file-11.8 {errors in size option} {
|
||||
list [catch {file size _bogus_ x} msg] $msg $errorCode
|
||||
} {1 {wrong # args: should be "file size name"} NONE}
|
||||
test file-11.9 {errors in size option} {
|
||||
string tolower [list [catch {file size _bogus_} msg] $msg \
|
||||
$errorCode]
|
||||
} {1 {couldn't stat "_bogus_": no such file or directory} {posix enoent {no such file or directory}}}
|
||||
|
||||
# type
|
||||
|
||||
test file-12.1 {type option} {
|
||||
file type dir.file
|
||||
} directory
|
||||
test file-12.2 {type option} {
|
||||
file type gorp.file
|
||||
} file
|
||||
if $atBerkeley {
|
||||
exec ln -s a/b/c link.file
|
||||
test file-12.3 {type option} {
|
||||
file type link.file
|
||||
} link
|
||||
exec rm link.file
|
||||
}
|
||||
test file-12.4 {errors in type option} {
|
||||
list [catch {file type a b} msg] $msg $errorCode
|
||||
} {1 {wrong # args: should be "file type name"} NONE}
|
||||
test file-12.5 {errors in type option} {
|
||||
string tolower [list [catch {file type _bogus_} msg] $msg $errorCode]
|
||||
} {1 {couldn't stat "_bogus_": no such file or directory} {posix enoent {no such file or directory}}}
|
||||
|
||||
# lstat and readlink: run these tests only at Berkeley, since not all
|
||||
# sites will have symbolic links
|
||||
|
||||
if $atBerkeley {
|
||||
exec ln -s gorp.file link.file
|
||||
test file-13.1 {lstat option} {
|
||||
catch {unset stat}
|
||||
file lstat link.file stat
|
||||
lsort [array names stat]
|
||||
} {atime ctime dev gid ino mode mtime nlink size type uid}
|
||||
test file-13.1 {lstat option} {
|
||||
catch {unset stat}
|
||||
file lstat link.file stat
|
||||
list $stat(nlink) [expr $stat(mode)&0777] $stat(type)
|
||||
} {1 511 link}
|
||||
test file-13.3 {errors in lstat option} {
|
||||
string tolower [list [catch {file lstat _bogus_ stat} msg] \
|
||||
$msg $errorCode]
|
||||
} {1 {couldn't lstat "_bogus_": no such file or directory} {posix enoent {no such file or directory}}}
|
||||
test file-13.4 {errors in lstat option} {
|
||||
list [catch {file lstat _bogus_} msg] $msg $errorCode
|
||||
} {1 {wrong # args: should be "file lstat name varName"} NONE}
|
||||
test file-13.5 {errors in lstat option} {
|
||||
list [catch {file lstat _bogus_ a b} msg] $msg $errorCode
|
||||
} {1 {wrong # args: should be "file lstat name varName"} NONE}
|
||||
test file-13.6 {errors in lstat option} {
|
||||
catch {unset x}
|
||||
set x 44
|
||||
list [catch {file lstat gorp.file x} msg] $msg $errorCode
|
||||
} {1 {can't set "x(dev)": variable isn't array} NONE}
|
||||
catch {unset stat}
|
||||
|
||||
test file-14.1 {readlink option} {
|
||||
file readlink link.file
|
||||
} gorp.file
|
||||
test file-14.2 {errors in readlink option} {
|
||||
list [catch {file readlink a b} msg] $msg $errorCode
|
||||
} {1 {wrong # args: should be "file readlink name"} NONE}
|
||||
test file-14.3 {errors in readlink option} {
|
||||
list [catch {file readlink _bogus_} msg] $msg $errorCode
|
||||
} {1 {couldn't readlink "_bogus_": no such file or directory} {POSIX ENOENT {no such file or directory}}}
|
||||
|
||||
exec rm link.file
|
||||
}
|
||||
|
||||
# Error conditions
|
||||
|
||||
test file-15.1 {error conditions} {
|
||||
list [catch file msg] $msg
|
||||
} {1 {wrong # args: should be "file option name ?arg ...?"}}
|
||||
test file-15.2 {error conditions} {
|
||||
list [catch {file x} msg] $msg
|
||||
} {1 {wrong # args: should be "file option name ?arg ...?"}}
|
||||
test file-15.3 {error conditions} {
|
||||
list [catch {file exists x too} msg] $msg
|
||||
} {1 {wrong # args: should be "file exists name"}}
|
||||
test file-15.4 {error conditions} {
|
||||
list [catch {file gorp x} msg] $msg
|
||||
} {1 {bad option "gorp": should be atime, dirname, executable, exists, extension, isdirectory, isfile, lstat, mtime, owned, readable, readlink, root, size, stat, tail, type, or writable}}
|
||||
test file-15.5 {error conditions} {
|
||||
list [catch {file ex x} msg] $msg
|
||||
} {1 {bad option "ex": should be atime, dirname, executable, exists, extension, isdirectory, isfile, lstat, mtime, owned, readable, readlink, root, size, stat, tail, type, or writable}}
|
||||
test file-15.6 {error conditions} {
|
||||
list [catch {file is x} msg] $msg
|
||||
} {1 {bad option "is": should be atime, dirname, executable, exists, extension, isdirectory, isfile, lstat, mtime, owned, readable, readlink, root, size, stat, tail, type, or writable}}
|
||||
test file-15.7 {error conditions} {
|
||||
list [catch {file read x} msg] $msg
|
||||
} {1 {bad option "read": should be atime, dirname, executable, exists, extension, isdirectory, isfile, lstat, mtime, owned, readable, readlink, root, size, stat, tail, type, or writable}}
|
||||
test file-15.8 {error conditions} {
|
||||
list [catch {file s x} msg] $msg
|
||||
} {1 {bad option "s": should be atime, dirname, executable, exists, extension, isdirectory, isfile, lstat, mtime, owned, readable, readlink, root, size, stat, tail, type, or writable}}
|
||||
test file-15.9 {error conditions} {
|
||||
list [catch {file t x} msg] $msg
|
||||
} {1 {bad option "t": should be atime, dirname, executable, exists, extension, isdirectory, isfile, lstat, mtime, owned, readable, readlink, root, size, stat, tail, type, or writable}}
|
||||
test file-15.10 {error conditions} {
|
||||
list [catch {file rootname ~woohgy} msg] $msg
|
||||
} {1 {user "woohgy" doesn't exist}}
|
||||
|
||||
exec chmod 777 dir.file
|
||||
exec rm dir.file/gorp.file gorp.file
|
||||
exec rmdir dir.file
|
@ -1,153 +0,0 @@
|
||||
# Commands covered: glob
|
||||
#
|
||||
# This file contains a collection of tests for one or more of the Tcl
|
||||
# built-in commands. Sourcing this file into Tcl runs the tests and
|
||||
# generates output for errors. No output means no errors were found.
|
||||
#
|
||||
# Copyright (c) 1991-1993 The Regents of the University of California.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, without written agreement and without
|
||||
# license or royalty fees, to use, copy, modify, and distribute this
|
||||
# software and its documentation for any purpose, provided that the
|
||||
# above copyright notice and the following two paragraphs appear in
|
||||
# all copies of this software.
|
||||
#
|
||||
# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
||||
# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
|
||||
# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
#
|
||||
# $Header: /user6/ouster/tcl/tests/RCS/glob.test,v 1.23 93/08/28 15:57:40 ouster Exp $ (Berkeley)
|
||||
|
||||
if {[string compare test [info procs test]] == 1} then {source defs}
|
||||
|
||||
# First, create some subdirectories to use for testing.
|
||||
|
||||
exec rm -rf globTest
|
||||
exec mkdir globTest globTest/a1 globTest/a2 globTest/a3
|
||||
exec mkdir globTest/a1/b1 globTest/a1/b2 globTest/a2/b3
|
||||
exec cat << abc > globTest/x1.c
|
||||
exec cat << abc > globTest/y1.c
|
||||
exec cat << abc > globTest/z1.c
|
||||
exec cat << abc > "globTest/weird name.c"
|
||||
exec cat << abc > globTest/.1
|
||||
exec cat << abc > globTest/a1/b1/x2.c
|
||||
exec cat << abc > globTest/a1/b2/y2.c
|
||||
|
||||
test glob-1.1 {simple globbing} {
|
||||
lsort [glob globTest/x1.c globTest/y1.c globTest/foo]
|
||||
} {globTest/x1.c globTest/y1.c}
|
||||
test glob-1.2 {simple globbing} {
|
||||
glob {}
|
||||
} .
|
||||
|
||||
test glob-2.1 {globbing with braces} {
|
||||
glob -nocomplain "{a1,a2}"
|
||||
} {}
|
||||
test glob-2.2 {globbing with braces} {
|
||||
lsort [glob globTest/{a,b,x,y}1.c]
|
||||
} {globTest/x1.c globTest/y1.c}
|
||||
test glob-2.3 {globbing with braces} {
|
||||
lsort [glob {globTest/{x1,y2,weird name}.c}]
|
||||
} {{globTest/weird name.c} globTest/x1.c}
|
||||
test glob-2.4 {globbing with braces} {
|
||||
lsort [glob globTest/{x1.c,a1/*}]
|
||||
} {globTest/a1/b1 globTest/a1/b2 globTest/x1.c}
|
||||
|
||||
test glob-3.1 {asterisks, question marks, and brackets} {
|
||||
lsort [glob g*/*.c]
|
||||
} {{globTest/weird name.c} globTest/x1.c globTest/y1.c globTest/z1.c}
|
||||
test glob-3.2 {asterisks, question marks, and brackets} {
|
||||
lsort [glob globTest/?1.c]
|
||||
} {globTest/x1.c globTest/y1.c globTest/z1.c}
|
||||
test glob-3.3 {asterisks, question marks, and brackets} {
|
||||
lsort [glob */*/*/*.c]
|
||||
} {globTest/a1/b1/x2.c globTest/a1/b2/y2.c}
|
||||
test glob-3.4 {asterisks, question marks, and brackets} {
|
||||
lsort [glob globTest/*]
|
||||
} {globTest/a1 globTest/a2 globTest/a3 {globTest/weird name.c} globTest/x1.c globTest/y1.c globTest/z1.c}
|
||||
test glob-3.5 {asterisks, question marks, and brackets} {
|
||||
lsort [glob globTest/.*]
|
||||
} {globTest/. globTest/.. globTest/.1}
|
||||
test glob-3.6 {asterisks, question marks, and brackets} {
|
||||
lsort [glob globTest/*/*]
|
||||
} {globTest/a1/b1 globTest/a1/b2 globTest/a2/b3}
|
||||
test glob-3.7 {asterisks, question marks, and brackets} {
|
||||
lsort [glob {globTest/[xyab]1.*}]
|
||||
} {globTest/x1.c globTest/y1.c}
|
||||
test glob-3.8 {asterisks, question marks, and brackets} {
|
||||
lsort [glob globTest/*/]
|
||||
} {globTest/a1/ globTest/a2/ globTest/a3/}
|
||||
|
||||
# The tests immediately below can only be run at Berkeley, where
|
||||
# the file-system structure is well-known.
|
||||
|
||||
if $atBerkeley {
|
||||
test glob-4.1 {tildes} {glob ~/.csh*} "/users/ouster/.cshrc"
|
||||
test glob-4.2 {tildes} {glob ~ouster/.csh*} "/users/ouster/.cshrc"
|
||||
}
|
||||
|
||||
test glob-5.1 {error conditions} {
|
||||
list [catch {glob} msg] $msg
|
||||
} {1 {wrong # args: should be "glob ?switches? name ?name ...?"}}
|
||||
test glob-5.2 {error conditions} {
|
||||
list [catch {glob globTest/\{} msg] $msg
|
||||
} {1 {unmatched open-brace in file name}}
|
||||
test glob-5.3 {error conditions} {
|
||||
list [catch {glob globTest/*/gorp} msg] $msg
|
||||
} {1 {no files matched glob pattern "globTest/*/gorp"}}
|
||||
test glob-5.4 {error conditions} {
|
||||
list [catch {glob goo/* x*z foo?q} msg] $msg
|
||||
} {1 {no files matched glob patterns "goo/* x*z foo?q"}}
|
||||
test glob-5.5 {error conditions} {
|
||||
list [catch {lsort [glob globTest/*.c goo/*]} msg] $msg
|
||||
} {0 {{globTest/weird name.c} globTest/x1.c globTest/y1.c globTest/z1.c}}
|
||||
test glob-5.6 {error conditions} {
|
||||
list [catch {glob ~no-one} msg] $msg
|
||||
} {1 {user "no-one" doesn't exist}}
|
||||
test glob-5.7 {error conditions} {
|
||||
set home $env(HOME)
|
||||
unset env(HOME)
|
||||
set x [list [catch {glob ~/*} msg] $msg]
|
||||
set env(HOME) $home
|
||||
set x
|
||||
} {1 {couldn't find HOME environment variable to expand "~/*"}}
|
||||
test glob-5.8 {error conditions} {
|
||||
list [catch {glob globTest/{a1,a2}/\{} msg] $msg
|
||||
} {1 {unmatched open-brace in file name}}
|
||||
test glob-5.9 {error conditions} {
|
||||
list [catch {glob globTest/*/\{} msg] $msg
|
||||
} {1 {unmatched open-brace in file name}}
|
||||
|
||||
exec chmod 000 globTest
|
||||
if {$user != "root"} {
|
||||
test glob-6.1 {setting errorCode variable} {
|
||||
string tolower [list [catch {glob globTest/*} msg] $msg $errorCode]
|
||||
} {1 {couldn't read directory "globtest": permission denied} {posix eacces {permission denied}}}
|
||||
}
|
||||
exec chmod 755 globTest
|
||||
|
||||
test glob-7.1 {-nocomplain switch} {
|
||||
list [catch {glob -nocomplai} msg] $msg
|
||||
} {1 {bad switch "-nocomplai": must be -nocomplain or --}}
|
||||
test glob-7.2 {-nocomplain switch} {
|
||||
list [catch {glob -nocomplain} msg] $msg
|
||||
} {1 {wrong # args: should be "glob ?switches? name ?name ...?"}}
|
||||
test glob-7.3 {-nocomplain switch} {
|
||||
list [catch {glob -nocomplain goo/*} msg] $msg
|
||||
} {0 {}}
|
||||
test glob-7.4 {-- switch} {
|
||||
list [catch {glob -- -nocomplain} msg] $msg
|
||||
} {1 {no files matched glob patterns "-nocomplain"}}
|
||||
test glob-7.5 {bogus switch} {
|
||||
list [catch {glob -gorp} msg] $msg
|
||||
} {1 {bad switch "-gorp": must be -nocomplain or --}}
|
||||
|
||||
exec rm -rf globTest
|
@ -1,52 +0,0 @@
|
||||
# Commands covered: join
|
||||
#
|
||||
# This file contains a collection of tests for one or more of the Tcl
|
||||
# built-in commands. Sourcing this file into Tcl runs the tests and
|
||||
# generates output for errors. No output means no errors were found.
|
||||
#
|
||||
# Copyright (c) 1991-1993 The Regents of the University of California.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, without written agreement and without
|
||||
# license or royalty fees, to use, copy, modify, and distribute this
|
||||
# software and its documentation for any purpose, provided that the
|
||||
# above copyright notice and the following two paragraphs appear in
|
||||
# all copies of this software.
|
||||
#
|
||||
# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
||||
# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
|
||||
# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
#
|
||||
# $Header: /user6/ouster/tcl/tests/RCS/join.test,v 1.4 93/02/06 16:01:33 ouster Exp $ (Berkeley)
|
||||
|
||||
if {[string compare test [info procs test]] == 1} then {source defs}
|
||||
|
||||
test join-1.1 {basic join commands} {
|
||||
join {a b c} xyz
|
||||
} axyzbxyzc
|
||||
test join-1.2 {basic join commands} {
|
||||
join {a b c} {}
|
||||
} abc
|
||||
test join-1.3 {basic join commands} {
|
||||
join {} xyz
|
||||
} {}
|
||||
test join-1.4 {basic join commands} {
|
||||
join {12 34 56}
|
||||
} {12 34 56}
|
||||
|
||||
test join-2.1 {join errors} {
|
||||
list [catch join msg] $msg $errorCode
|
||||
} {1 {wrong # args: should be "join list ?joinString?"} NONE}
|
||||
test join-2.2 {join errors} {
|
||||
list [catch {join a b c} msg] $msg $errorCode
|
||||
} {1 {wrong # args: should be "join list ?joinString?"} NONE}
|
||||
test join-2.3 {join errors} {
|
||||
list [catch {join "a \{ c" 111} msg] $msg $errorCode
|
||||
} {1 {unmatched open brace in list} NONE}
|
@ -1,49 +0,0 @@
|
||||
# Commands covered: llength
|
||||
#
|
||||
# This file contains a collection of tests for one or more of the Tcl
|
||||
# built-in commands. Sourcing this file into Tcl runs the tests and
|
||||
# generates output for errors. No output means no errors were found.
|
||||
#
|
||||
# Copyright (c) 1991-1993 The Regents of the University of California.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, without written agreement and without
|
||||
# license or royalty fees, to use, copy, modify, and distribute this
|
||||
# software and its documentation for any purpose, provided that the
|
||||
# above copyright notice and the following two paragraphs appear in
|
||||
# all copies of this software.
|
||||
#
|
||||
# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
||||
# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
|
||||
# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
#
|
||||
# $Header: /user6/ouster/tcl/tests/RCS/llength.test,v 1.2 93/02/06 16:01:45 ouster Exp $ (Berkeley)
|
||||
|
||||
if {[string compare test [info procs test]] == 1} then {source defs}
|
||||
|
||||
test llength-1.1 {length of list} {
|
||||
llength {a b c d}
|
||||
} 4
|
||||
test llength-1.2 {length of list} {
|
||||
llength {a b c {a b {c d}} d}
|
||||
} 5
|
||||
test llength-1.3 {length of list} {
|
||||
llength {}
|
||||
} 0
|
||||
|
||||
test llength-2.1 {error conditions} {
|
||||
list [catch {llength} msg] $msg
|
||||
} {1 {wrong # args: should be "llength list"}}
|
||||
test llength-2.2 {error conditions} {
|
||||
list [catch {llength 123 2} msg] $msg
|
||||
} {1 {wrong # args: should be "llength list"}}
|
||||
test llength-2.3 {error conditions} {
|
||||
list [catch {llength "a b c \{"} msg] $msg
|
||||
} {1 {unmatched open brace in list}}
|
@ -1,662 +0,0 @@
|
||||
# Commands covered: open, close, gets, puts, read, seek, tell, eof, flush
|
||||
#
|
||||
# This file contains a collection of tests for one or more of the Tcl
|
||||
# built-in commands. Sourcing this file into Tcl runs the tests and
|
||||
# generates output for errors. No output means no errors were found.
|
||||
#
|
||||
# Copyright (c) 1991-1993 The Regents of the University of California.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, without written agreement and without
|
||||
# license or royalty fees, to use, copy, modify, and distribute this
|
||||
# software and its documentation for any purpose, provided that the
|
||||
# above copyright notice and the following two paragraphs appear in
|
||||
# all copies of this software.
|
||||
#
|
||||
# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
||||
# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
|
||||
# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
#
|
||||
# $Header: /user6/ouster/tcl/tests/RCS/open.test,v 1.19 93/10/18 08:52:24 ouster Exp $ (Berkeley)
|
||||
|
||||
if {[string compare test [info procs test]] == 1} then {source defs}
|
||||
|
||||
catch {exec rm -f test1 test2 test3}
|
||||
exec cat > test1 << "Two lines: this one\nand this one\n"
|
||||
exec cat > test2 << "line1\nline2\nline3\nline4\nline5\n"
|
||||
|
||||
test open-1.1 {open command (files only)} {
|
||||
set f [open test1]
|
||||
set x [gets $f]
|
||||
close $f
|
||||
set x
|
||||
} {Two lines: this one}
|
||||
test open-1.2 {open command (files only)} {
|
||||
set f [open test1]
|
||||
set f2 [open test2]
|
||||
set f3 [open test1]
|
||||
set f4 [open test1]
|
||||
set x [list [gets $f] [gets $f2] [gets $f3] [gets $f4] \
|
||||
[gets $f] [gets $f2]]
|
||||
close $f
|
||||
close $f2
|
||||
close $f3
|
||||
close $f4
|
||||
set x
|
||||
} {{Two lines: this one} line1 {Two lines: this one} {Two lines: this one} {and this one} line2}
|
||||
test open-1.3 {open command (files only)} {
|
||||
set f [open test3 w]
|
||||
puts $f xyz
|
||||
close $f
|
||||
exec cat test3
|
||||
} "xyz"
|
||||
test open-1.4 {open command (files only)} {
|
||||
set f [open test3 w]
|
||||
puts $f xyz
|
||||
close $f
|
||||
set f [open test3 a]
|
||||
puts $f 123
|
||||
close $f
|
||||
exec cat test3
|
||||
} "xyz\n123"
|
||||
test open-1.5 {open command (files only)} {
|
||||
set f [open test3 w]
|
||||
puts $f xyz\n123
|
||||
close $f
|
||||
set f [open test3 r+]
|
||||
set x [gets $f]
|
||||
seek $f 0 current
|
||||
puts $f 456
|
||||
close $f
|
||||
list $x [exec cat test3]
|
||||
} "xyz {xyz
|
||||
456}"
|
||||
test open-1.6 {open command (files only)} {
|
||||
set f [open test3 w]
|
||||
puts $f xyz\n123
|
||||
close $f
|
||||
set f [open test3 w+]
|
||||
puts $f xyzzy
|
||||
seek $f 2
|
||||
set x [gets $f]
|
||||
close $f
|
||||
list $x [exec cat test3]
|
||||
} "zzy xyzzy"
|
||||
test open-1.7 {open command (files only)} {
|
||||
set f [open test3 w]
|
||||
puts $f xyz\n123
|
||||
close $f
|
||||
set f [open test3 a+]
|
||||
puts $f xyzzy
|
||||
flush $f
|
||||
set x [tell $f]
|
||||
seek $f -4 cur
|
||||
set y [gets $f]
|
||||
close $f
|
||||
list $x [exec cat test3] $y
|
||||
} {14 {xyz
|
||||
123
|
||||
xyzzy} zzy}
|
||||
|
||||
test open-2.1 {errors in open command} {
|
||||
list [catch {open} msg] $msg
|
||||
} {1 {wrong # args: should be "open filename ?access? ?permissions?"}}
|
||||
test open-2.2 {errors in open command} {
|
||||
list [catch {open a b c d} msg] $msg
|
||||
} {1 {wrong # args: should be "open filename ?access? ?permissions?"}}
|
||||
test open-2.3 {errors in open command} {
|
||||
list [catch {open test1 x} msg] $msg
|
||||
} {1 {illegal access mode "x"}}
|
||||
test open-2.4 {errors in open command} {
|
||||
list [catch {open test1 rw} msg] $msg
|
||||
} {1 {illegal access mode "rw"}}
|
||||
test open-2.5 {errors in open command} {
|
||||
list [catch {open test1 r+1} msg] $msg
|
||||
} {1 {illegal access mode "r+1"}}
|
||||
test open-2.6 {errors in open command} {
|
||||
string tolower [list [catch {open _non_existent_} msg] $msg $errorCode]
|
||||
} {1 {couldn't open "_non_existent_": no such file or directory} {posix enoent {no such file or directory}}}
|
||||
|
||||
if {![file exists ~/_test_] && [file writable ~]} {
|
||||
test open-3.1 {tilde substitution in open} {
|
||||
set f [open ~/_test_ w]
|
||||
puts $f "Some text"
|
||||
close $f
|
||||
set x [file exists $env(HOME)/_test_]
|
||||
exec rm -f $env(HOME)/_test_
|
||||
set x
|
||||
} 1
|
||||
}
|
||||
test open-3.2 {tilde substitution in open} {
|
||||
set home $env(HOME)
|
||||
unset env(HOME)
|
||||
set x [list [catch {open ~/foo} msg] $msg]
|
||||
set env(HOME) $home
|
||||
set x
|
||||
} {1 {couldn't find HOME environment variable to expand "~/foo"}}
|
||||
|
||||
test open-4.1 {file id parsing errors} {
|
||||
list [catch {eof gorp} msg] $msg $errorCode
|
||||
} {1 {bad file identifier "gorp"} NONE}
|
||||
test open-4.2 {file id parsing errors} {
|
||||
list [catch {eof filex} msg] $msg
|
||||
} {1 {bad file identifier "filex"}}
|
||||
test open-4.3 {file id parsing errors} {
|
||||
list [catch {eof file12a} msg] $msg
|
||||
} {1 {bad file identifier "file12a"}}
|
||||
test open-4.4 {file id parsing errors} {
|
||||
list [catch {eof file123} msg] $msg
|
||||
} {1 {file "file123" isn't open}}
|
||||
test open-4.5 {file id parsing errors} {
|
||||
list [catch {eof file1} msg] $msg
|
||||
} {0 0}
|
||||
test open-4.5 {file id parsing errors} {
|
||||
list [catch {eof stdin} msg] $msg
|
||||
} {0 0}
|
||||
test open-4.6 {file id parsing errors} {
|
||||
list [catch {eof stdout} msg] $msg
|
||||
} {0 0}
|
||||
test open-4.7 {file id parsing errors} {
|
||||
list [catch {eof stderr} msg] $msg
|
||||
} {0 0}
|
||||
test open-4.8 {file id parsing errors} {
|
||||
list [catch {eof stderr1} msg] $msg
|
||||
} {1 {bad file identifier "stderr1"}}
|
||||
set f [open test1]
|
||||
close $f
|
||||
set expect "1 {file \"$f\" isn't open}"
|
||||
test open-4.9 {file id parsing errors} {
|
||||
list [catch {eof $f} msg] $msg
|
||||
} $expect
|
||||
|
||||
test open-5.1 {close command (files only)} {
|
||||
list [catch {close} msg] $msg $errorCode
|
||||
} {1 {wrong # args: should be "close fileId"} NONE}
|
||||
test open-5.2 {close command (files only)} {
|
||||
list [catch {close a b} msg] $msg $errorCode
|
||||
} {1 {wrong # args: should be "close fileId"} NONE}
|
||||
test open-5.3 {close command (files only)} {
|
||||
list [catch {close gorp} msg] $msg $errorCode
|
||||
} {1 {bad file identifier "gorp"} NONE}
|
||||
test open-5.4 {close command (files only)} {
|
||||
list [catch {close file4} msg] \
|
||||
[string range $msg [string first {" } $msg] end] $errorCode
|
||||
} {1 {" isn't open} NONE}
|
||||
|
||||
test open-6.1 {puts command} {
|
||||
list [catch {puts} msg] $msg $errorCode
|
||||
} {1 {wrong # args: should be "puts" ?-nonewline? ?fileId? string} NONE}
|
||||
test open-6.2 {puts command} {
|
||||
list [catch {puts a b c d} msg] $msg $errorCode
|
||||
} {1 {wrong # args: should be "puts" ?-nonewline? ?fileId? string} NONE}
|
||||
test open-6.3 {puts command} {
|
||||
list [catch {puts a b nonewlinx} msg] $msg $errorCode
|
||||
} {1 {bad argument "nonewlinx": should be "nonewline"} NONE}
|
||||
test open-6.4 {puts command} {
|
||||
list [catch {puts gorp "New text"} msg] $msg $errorCode
|
||||
} {1 {bad file identifier "gorp"} NONE}
|
||||
test open-6.5 {puts command} {
|
||||
set f [open test3]
|
||||
set x [list [catch {puts $f "New text"} msg] \
|
||||
[string range $msg [string first " " $msg] end] $errorCode]
|
||||
close $f
|
||||
set x
|
||||
} {1 { wasn't opened for writing} NONE}
|
||||
test open-6.6 {puts command} {
|
||||
set f [open test3 w]
|
||||
puts -nonewline $f "Text1"
|
||||
puts -nonewline $f " Text 2"
|
||||
puts $f " Text 3"
|
||||
close $f
|
||||
exec cat test3
|
||||
} {Text1 Text 2 Text 3}
|
||||
|
||||
test open-7.1 {gets command} {
|
||||
list [catch {gets} msg] $msg $errorCode
|
||||
} {1 {wrong # args: should be "gets fileId ?varName?"} NONE}
|
||||
test open-7.2 {gets command} {
|
||||
list [catch {gets a b c} msg] $msg $errorCode
|
||||
} {1 {wrong # args: should be "gets fileId ?varName?"} NONE}
|
||||
test open-7.3 {gets command} {
|
||||
list [catch {gets a} msg] $msg $errorCode
|
||||
} {1 {bad file identifier "a"} NONE}
|
||||
test open-7.4 {gets command} {
|
||||
set f [open test3 w]
|
||||
set x [list [catch {gets $f} msg] \
|
||||
[string range $msg [string first " " $msg] end] $errorCode]
|
||||
close $f
|
||||
set x
|
||||
} {1 { wasn't opened for reading} NONE}
|
||||
set f [open test3 w]
|
||||
puts -nonewline $f "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
puts -nonewline $f "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
puts -nonewline $f "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
puts -nonewline $f "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
puts $f "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
close $f
|
||||
test open-7.5 {gets command with long line} {
|
||||
set f [open test3]
|
||||
set x [gets $f]
|
||||
close $f
|
||||
set x
|
||||
} {abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ}
|
||||
test open-7.6 {gets command with long line} {
|
||||
set f [open test3]
|
||||
set x [gets $f y]
|
||||
close $f
|
||||
list $x $y
|
||||
} {260 abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ}
|
||||
test open-7.7 {gets command and end of file} {
|
||||
set f [open test3 w]
|
||||
puts -nonewline $f "Test1\nTest2"
|
||||
close $f
|
||||
set f [open test3]
|
||||
set x {}
|
||||
set y {}
|
||||
lappend x [gets $f y] $y
|
||||
set y {}
|
||||
lappend x [gets $f y] $y
|
||||
set y {}
|
||||
lappend x [gets $f y] $y
|
||||
close $f
|
||||
set x
|
||||
} {5 Test1 5 Test2 -1 {}}
|
||||
set f [open test3 w]
|
||||
puts $f "Line 1"
|
||||
puts $f "Line 2"
|
||||
close $f
|
||||
test open-7.8 {gets command and bad variable} {
|
||||
catch {unset x}
|
||||
set x 24
|
||||
set f [open test3 r]
|
||||
set result [list [catch {gets $f x(0)} msg] $msg]
|
||||
close $f
|
||||
set result
|
||||
} {1 {can't set "x(0)": variable isn't array}}
|
||||
|
||||
test open-8.1 {read command} {
|
||||
list [catch {read} msg] $msg $errorCode
|
||||
} {1 {wrong # args: should be "read fileId ?numBytes?" or "read ?-nonewline? fileId"} NONE}
|
||||
test open-8.2 {read command} {
|
||||
list [catch {read -nonewline} msg] $msg $errorCode
|
||||
} {1 {bad file identifier "-nonewline"} NONE}
|
||||
test open-8.3 {read command} {
|
||||
list [catch {read a b c} msg] $msg $errorCode
|
||||
} {1 {wrong # args: should be "read fileId ?numBytes?" or "read ?-nonewline? fileId"} NONE}
|
||||
test open-8.4 {read command} {
|
||||
list [catch {read -nonew file4} msg] $msg $errorCode
|
||||
} {1 {bad file identifier "-nonew"} NONE}
|
||||
test open-8.5 {read command} {
|
||||
list [catch {read stdin foo} msg] $msg $errorCode
|
||||
} {1 {bad argument "foo": should be "nonewline"} NONE}
|
||||
test open-8.6 {read command} {
|
||||
list [catch {read file10} msg] $msg $errorCode
|
||||
} {1 {file "file10" isn't open} NONE}
|
||||
test open-8.7 {read command} {
|
||||
set f [open test3 w]
|
||||
set x [list [catch {read $f} msg] \
|
||||
[string range $msg [string first " " $msg] end] $errorCode]
|
||||
close $f
|
||||
set x
|
||||
} {1 { wasn't opened for reading} NONE}
|
||||
test open-8.8 {read command} {
|
||||
set f [open test1]
|
||||
set x [list [catch {read $f 12z} msg] $msg $errorCode]
|
||||
close $f
|
||||
set x
|
||||
} {1 {expected integer but got "12z"} NONE}
|
||||
test open-898 {read command} {
|
||||
set f [open test1]
|
||||
set x [list [catch {read $f z} msg] $msg $errorCode]
|
||||
close $f
|
||||
set x
|
||||
} {1 {bad argument "z": should be "nonewline"} NONE}
|
||||
test open-8.10 {read command} {
|
||||
set f [open test1]
|
||||
set x [list [read $f 1] [read $f 2] [read $f]]
|
||||
close $f
|
||||
set x
|
||||
} {T wo { lines: this one
|
||||
and this one
|
||||
}}
|
||||
test open-8.11 {read command, with over-large count} {
|
||||
set f [open test1]
|
||||
set x [read $f 100]
|
||||
close $f
|
||||
set x
|
||||
} {Two lines: this one
|
||||
and this one
|
||||
}
|
||||
test open-8.12 {read command, -nonewline switch} {
|
||||
set f [open test1]
|
||||
set x [read -nonewline $f]
|
||||
close $f
|
||||
set x
|
||||
} {Two lines: this one
|
||||
and this one}
|
||||
|
||||
test open-9.1 {seek command} {
|
||||
list [catch {seek foo} msg] $msg $errorCode
|
||||
} {1 {wrong # args: should be "seek fileId offset ?origin?"} NONE}
|
||||
test open-9.2 {seek command} {
|
||||
list [catch {seek foo a b c} msg] $msg $errorCode
|
||||
} {1 {wrong # args: should be "seek fileId offset ?origin?"} NONE}
|
||||
test open-9.3 {seek command} {
|
||||
list [catch {seek foo 0} msg] $msg $errorCode
|
||||
} {1 {bad file identifier "foo"} NONE}
|
||||
test open-9.4 {seek command} {
|
||||
set f [open test2]
|
||||
set x [list [catch {seek $f xyz} msg] $msg $errorCode]
|
||||
close $f
|
||||
set x
|
||||
} {1 {expected integer but got "xyz"} NONE}
|
||||
test open-9.5 {seek command} {
|
||||
set f [open test2]
|
||||
set x [list [catch {seek $f 100 gorp} msg] $msg $errorCode]
|
||||
close $f
|
||||
set x
|
||||
} {1 {bad origin "gorp": should be start, current, or end} NONE}
|
||||
set f [open test3 w]
|
||||
puts -nonewline $f "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
close $f
|
||||
test open-9.6 {seek command} {
|
||||
set f [open test3]
|
||||
set x [read $f 1]
|
||||
seek $f 3
|
||||
lappend x [read $f 1]
|
||||
seek $f 0 start
|
||||
lappend x [read $f 1]
|
||||
seek $f 10 current
|
||||
lappend x [read $f 1]
|
||||
seek $f -2 end
|
||||
lappend x [read $f 1]
|
||||
seek $f 50 end
|
||||
lappend x [read $f 1]
|
||||
seek $f 1
|
||||
lappend x [read $f 1]
|
||||
close $f
|
||||
set x
|
||||
} {a d a l Y {} b}
|
||||
|
||||
test open-10.1 {tell command} {
|
||||
list [catch {tell} msg] $msg $errorCode
|
||||
} {1 {wrong # args: should be "tell fileId"} NONE}
|
||||
test open-10.2 {tell command} {
|
||||
list [catch {tell a b} msg] $msg $errorCode
|
||||
} {1 {wrong # args: should be "tell fileId"} NONE}
|
||||
test open-10.3 {tell command} {
|
||||
list [catch {tell a} msg] $msg $errorCode
|
||||
} {1 {bad file identifier "a"} NONE}
|
||||
test open-10.4 {tell command} {
|
||||
set f [open test2]
|
||||
set x [tell $f]
|
||||
read $f 3
|
||||
lappend x [tell $f]
|
||||
seek $f 2
|
||||
lappend x [tell $f]
|
||||
seek $f 10 current
|
||||
lappend x [tell $f]
|
||||
seek $f 0 end
|
||||
lappend x [tell $f]
|
||||
close $f
|
||||
set x
|
||||
} {0 3 2 12 30}
|
||||
|
||||
test open-11.1 {eof command} {
|
||||
list [catch {eof} msg] $msg $errorCode
|
||||
} {1 {wrong # args: should be "eof fileId"} NONE}
|
||||
test open-11.2 {eof command} {
|
||||
list [catch {eof a b} msg] $msg $errorCode
|
||||
} {1 {wrong # args: should be "eof fileId"} NONE}
|
||||
test open-11.3 {eof command} {
|
||||
list [catch {eof file100} msg] $msg $errorCode
|
||||
} {1 {file "file100" isn't open} NONE}
|
||||
test open-11.4 {eof command} {
|
||||
set f [open test1]
|
||||
set x [eof $f]
|
||||
lappend x [eof $f]
|
||||
gets $f
|
||||
lappend x [eof $f]
|
||||
gets $f
|
||||
lappend x [eof $f]
|
||||
gets $f
|
||||
lappend x [eof $f]
|
||||
lappend x [eof $f]
|
||||
close $f
|
||||
set x
|
||||
} {0 0 0 0 1 1}
|
||||
|
||||
test open-12.1 {flush command} {
|
||||
list [catch {flush} msg] $msg $errorCode
|
||||
} {1 {wrong # args: should be "flush fileId"} NONE}
|
||||
test open-12.2 {flush command} {
|
||||
list [catch {flush a b} msg] $msg $errorCode
|
||||
} {1 {wrong # args: should be "flush fileId"} NONE}
|
||||
test open-12.3 {flush command} {
|
||||
list [catch {flush a} msg] $msg $errorCode
|
||||
} {1 {bad file identifier "a"} NONE}
|
||||
test open-12.4 {flush command} {
|
||||
set f [open test3]
|
||||
set x [list [catch {flush $f} msg] \
|
||||
[string range $msg [string first " " $msg] end] $errorCode]
|
||||
close $f
|
||||
set x
|
||||
} {1 { wasn't opened for writing} NONE}
|
||||
test open-12.5 {flush command} {
|
||||
set f [open test3 w]
|
||||
puts $f "Line 1"
|
||||
puts $f "Line 2"
|
||||
set f2 [open test3]
|
||||
set x {}
|
||||
lappend x [read -nonewline $f2]
|
||||
close $f2
|
||||
flush $f
|
||||
set f2 [open test3]
|
||||
lappend x [read -nonewline $f2]
|
||||
close $f2
|
||||
close $f
|
||||
set x
|
||||
} {{} {Line 1
|
||||
Line 2}}
|
||||
|
||||
test open-13.1 {I/O to command pipelines} {
|
||||
list [catch {open "| cat < test1 > test3" w} msg] $msg $errorCode
|
||||
} {1 {can't write input to command: standard input was redirected} NONE}
|
||||
test open-13.2 {I/O to command pipelines} {
|
||||
list [catch {open "| echo > test3" r} msg] $msg $errorCode
|
||||
} {1 {can't read output from command: standard output was redirected} NONE}
|
||||
test open-13.3 {I/O to command pipelines} {
|
||||
list [catch {open "| echo > test3" r+} msg] $msg $errorCode
|
||||
} {1 {can't read output from command: standard output was redirected} NONE}
|
||||
test open-13.4 {writing to command pipelines} {
|
||||
exec rm test3
|
||||
set f [open "| cat | cat > test3" w]
|
||||
puts $f "Line 1"
|
||||
puts $f "Line 2"
|
||||
close $f
|
||||
exec cat test3
|
||||
} {Line 1
|
||||
Line 2}
|
||||
test open-13.5 {reading from command pipelines} {
|
||||
set f [open "| cat test2" r]
|
||||
set x [list [gets $f] [gets $f] [gets $f]]
|
||||
close $f
|
||||
set x
|
||||
} {line1 line2 line3}
|
||||
test open-13.6 {both reading and writing from/to command pipelines} {
|
||||
set f [open "| cat -u" r+]
|
||||
puts $f "Line1"
|
||||
flush $f
|
||||
set x [gets $f]
|
||||
close $f
|
||||
set x
|
||||
} {Line1}
|
||||
test open-13.7 {errors in command pipelines} {
|
||||
set f [open "|gorp"]
|
||||
list [catch {close $f} msg] $msg [lindex $errorCode 0] [lindex $errorCode 2]
|
||||
} {1 {couldn't find "gorp" to execute} CHILDSTATUS 1}
|
||||
test open-13.8 {errors in command pipelines} {
|
||||
set f [open "|gorp" w]
|
||||
exec sleep 1
|
||||
puts $f output
|
||||
set x [list [catch {flush $f} msg] [concat \
|
||||
[string range $msg 0 [string first {"} $msg]] \
|
||||
[string range $msg [string first : $msg] end]] $errorCode]
|
||||
catch {close $f}
|
||||
string tolower $x
|
||||
} {1 {error flushing " : broken pipe} {posix epipe {broken pipe}}}
|
||||
test open-13.9 {errors in command pipelines} {
|
||||
set f [open "|gorp" w]
|
||||
list [catch {close $f} msg] $msg \
|
||||
[lindex $errorCode 0] [lindex $errorCode 2]
|
||||
} {1 {couldn't find "gorp" to execute} CHILDSTATUS 1}
|
||||
test open-13.10 {errors in command pipelines} {
|
||||
set f [open "|gorp" w]
|
||||
exec sleep 1
|
||||
puts $f output
|
||||
string tolower [list [catch {close $f} msg] [concat \
|
||||
[string range $msg 0 [string first {"} $msg]] \
|
||||
[string range $msg [string first : $msg] end]] \
|
||||
[lindex $errorCode 0] [lindex $errorCode 2]]
|
||||
} {1 {error closing " : broken pipe
|
||||
couldn't find "gorp" to execute} childstatus 1}
|
||||
|
||||
test open-14.1 {POSIX open access modes: RDONLY} {
|
||||
set f [open test1 RDONLY]
|
||||
set x [list [gets $f] [catch {puts $f Test} msg] $msg]
|
||||
close $f
|
||||
|
||||
# The regsub is needed to avoid false errors if the file
|
||||
# number varies from system to system.
|
||||
|
||||
regsub {"file."} $x {"file"} x
|
||||
set x
|
||||
} {{Two lines: this one} 1 {"file" wasn't opened for writing}}
|
||||
test open-14.2 {POSIX open access modes: RDONLY} {
|
||||
catch {exec rm -f test3}
|
||||
string tolower [list [catch {open test3 RDONLY} msg] $msg]
|
||||
} {1 {couldn't open "test3": no such file or directory}}
|
||||
test open-14.3 {POSIX open access modes: WRONLY} {
|
||||
catch {exec rm -f test3}
|
||||
string tolower [list [catch {open test3 WRONLY} msg] $msg]
|
||||
} {1 {couldn't open "test3": no such file or directory}}
|
||||
test open-14.4 {POSIX open access modes: WRONLY} {
|
||||
exec echo xyzzy > test3
|
||||
set f [open test3 WRONLY]
|
||||
puts -nonewline $f "ab"
|
||||
seek $f 0 current
|
||||
set x [list [catch {gets $f} msg] $msg]
|
||||
close $f
|
||||
lappend x [exec cat test3]
|
||||
|
||||
# The regsub is needed to avoid false errors if the file
|
||||
# number varies from system to system.
|
||||
|
||||
regsub {"file."} $x {"file"} x
|
||||
set x
|
||||
} {1 {"file" wasn't opened for reading} abzzy}
|
||||
test open-14.5 {POSIX open access modes: RDWR} {
|
||||
catch {exec rm -f test3}
|
||||
string tolower [list [catch {open test3 RDWR} msg] $msg]
|
||||
} {1 {couldn't open "test3": no such file or directory}}
|
||||
test open-14.6 {POSIX open access modes: RDWR} {
|
||||
exec echo xyzzy > test3
|
||||
set f [open test3 RDWR]
|
||||
puts -nonewline $f "ab"
|
||||
seek $f 0 current
|
||||
set x [gets $f]
|
||||
close $f
|
||||
lappend x [exec cat test3]
|
||||
} {zzy abzzy}
|
||||
test open-14.7 {POSIX open access modes: CREAT} {
|
||||
catch {exec rm -f test3}
|
||||
set f [open test3 {WRONLY CREAT} 0600]
|
||||
file stat test3 stats
|
||||
set x [format "0%o" [expr $stats(mode)&0777]]
|
||||
puts $f "line 1"
|
||||
close $f
|
||||
lappend x [exec cat test3]
|
||||
} {0600 {line 1}}
|
||||
if $atBerkeley {
|
||||
test open-14.8 {POSIX open access modes: CREAT} {
|
||||
catch {exec rm -f test3}
|
||||
set f [open test3 {WRONLY CREAT}]
|
||||
close $f
|
||||
file stat test3 stats
|
||||
format "0%o" [expr $stats(mode)&0777]
|
||||
} 0664
|
||||
}
|
||||
test open-14.9 {POSIX open access modes: CREAT} {
|
||||
exec echo xyzzy > test3
|
||||
set f [open test3 {WRONLY CREAT}]
|
||||
puts -nonewline $f "ab"
|
||||
close $f
|
||||
exec cat test3
|
||||
} abzzy
|
||||
test open-14.10 {POSIX open access modes: APPEND} {
|
||||
exec echo xyzzy > test3
|
||||
set f [open test3 {WRONLY APPEND}]
|
||||
puts $f "new line"
|
||||
seek $f 0
|
||||
puts $f "abc"
|
||||
close $f
|
||||
exec cat test3
|
||||
} {xyzzy
|
||||
new line
|
||||
abc}
|
||||
test open-14.11 {POSIX open access modes: EXCL} {
|
||||
exec echo xyzzy > test3
|
||||
set msg [list [catch {open test3 {WRONLY CREAT EXCL}} msg] $msg]
|
||||
regsub " already " $msg " " msg
|
||||
string tolower $msg
|
||||
} {1 {couldn't open "test3": file exists}}
|
||||
test open-14.12 {POSIX open access modes: EXCL} {
|
||||
catch {exec rm -f test3}
|
||||
set x [catch {set f [open test3 {WRONLY CREAT EXCL}]}]
|
||||
puts $f "A test line"
|
||||
close $f
|
||||
lappend x [exec cat test3]
|
||||
} {0 {A test line}}
|
||||
test open-14.13 {POSIX open access modes: TRUNC} {
|
||||
exec echo xyzzy > test3
|
||||
set f [open test3 {WRONLY TRUNC}]
|
||||
puts $f abc
|
||||
close $f
|
||||
exec cat test3
|
||||
} {abc}
|
||||
if $atBerkeley {
|
||||
test open-14.14 {POSIX open access modes: NOCTTY} {
|
||||
catch {exec rm -f test3}
|
||||
list [catch {open test3 {WRONLY NOCTTY CREAT}} msg] $msg
|
||||
} {1 {access mode "NOCTTY" not supported by this system}}
|
||||
test open-14.15 {POSIX open access modes: NONBLOCK} {
|
||||
catch {exec rm -f test3}
|
||||
set f [open test3 {WRONLY NONBLOCK CREAT}]
|
||||
puts $f "NONBLOCK test"
|
||||
close $f
|
||||
exec cat test3
|
||||
} {NONBLOCK test}
|
||||
}
|
||||
test open-14.16 {POSIX open access modes: errors} {
|
||||
concat [catch {open test3 "FOO \{BAR BAZ"} msg] $msg\n$errorInfo
|
||||
} "1 unmatched open brace in list
|
||||
unmatched open brace in list
|
||||
while processing open access modes \"FOO {BAR BAZ\"
|
||||
invoked from within
|
||||
\"open test3 \"FOO \\{BAR BAZ\"\""
|
||||
test open-14.17 {POSIX open access modes: errors} {
|
||||
list [catch {open test3 {FOO BAR BAZ}} msg] $msg
|
||||
} {1 {invalid access mode "FOO": must be RDONLY, WRONLY, RDWR, APPEND, CREAT EXCL, NOCTTY, NONBLOCK, or TRUNC}}
|
||||
test open-14.18 {POSIX open access modes: errors} {
|
||||
list [catch {open test3 {TRUNC CREAT}} msg] $msg
|
||||
} {1 {access mode must include either RDONLY, WRONLY, or RDWR}}
|
||||
|
||||
catch {exec rm -f test1 test2 test3}
|
||||
concat {}
|
@ -1,58 +0,0 @@
|
||||
# Commands covered: pid
|
||||
#
|
||||
# This file contains a collection of tests for one or more of the Tcl
|
||||
# built-in commands. Sourcing this file into Tcl runs the tests and
|
||||
# generates output for errors. No output means no errors were found.
|
||||
#
|
||||
# Copyright (c) 1991-1993 The Regents of the University of California.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, without written agreement and without
|
||||
# license or royalty fees, to use, copy, modify, and distribute this
|
||||
# software and its documentation for any purpose, provided that the
|
||||
# above copyright notice and the following two paragraphs appear in
|
||||
# all copies of this software.
|
||||
#
|
||||
# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
||||
# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
|
||||
# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
#
|
||||
# $Header: /user6/ouster/tcl/tests/RCS/pid.test,v 1.1 93/05/15 16:06:39 ouster Exp $ (Berkeley)
|
||||
|
||||
if {[string compare test [info procs test]] == 1} then {source defs}
|
||||
|
||||
catch {exec rm -f test1}
|
||||
|
||||
test open-1.1 {pid command} {
|
||||
regexp {^[0-9]+$} [pid]
|
||||
} 1
|
||||
test open-1.2 {pid command} {
|
||||
set f [open {| echo foo | cat > /dev/null} w]
|
||||
set pids [pid $f]
|
||||
close $f
|
||||
list [llength $pids] [regexp {^[0-9]+$} [lindex $pids 0]] \
|
||||
[regexp {^[0-9]+$} [lindex $pids 1]] \
|
||||
[expr {[lindex $pids 0] == [lindex $pids 1]}]
|
||||
} {2 1 1 0}
|
||||
test open-1.3 {pid command} {
|
||||
set f [open test1 w]
|
||||
set pids [pid $f]
|
||||
close $f
|
||||
set pids
|
||||
} {}
|
||||
test open-1.4 {pid command} {
|
||||
list [catch {pid a b} msg] $msg
|
||||
} {1 {wrong # args: should be "pid ?fileId?"}}
|
||||
test open-1.5 {pid command} {
|
||||
list [catch {pid gorp} msg] $msg
|
||||
} {1 {bad file identifier "gorp"}}
|
||||
|
||||
catch {exec rm -f test1}
|
||||
concat {}
|
@ -1,78 +0,0 @@
|
||||
# Commands covered: rename
|
||||
#
|
||||
# This file contains a collection of tests for one or more of the Tcl
|
||||
# built-in commands. Sourcing this file into Tcl runs the tests and
|
||||
# generates output for errors. No output means no errors were found.
|
||||
#
|
||||
# Copyright (c) 1991-1993 The Regents of the University of California.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, without written agreement and without
|
||||
# license or royalty fees, to use, copy, modify, and distribute this
|
||||
# software and its documentation for any purpose, provided that the
|
||||
# above copyright notice and the following two paragraphs appear in
|
||||
# all copies of this software.
|
||||
#
|
||||
# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
||||
# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
|
||||
# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
#
|
||||
# $Header: /user6/ouster/tcl/tests/RCS/rename.test,v 1.5 93/02/06 15:54:23 ouster Exp $ (Berkeley)
|
||||
|
||||
if {[string compare test [info procs test]] == 1} then {source defs}
|
||||
|
||||
catch {rename r2 {}}
|
||||
proc r1 {} {return "procedure r1"}
|
||||
rename r1 r2
|
||||
test rename-1.1 {simple renaming} {
|
||||
r2
|
||||
} {procedure r1}
|
||||
test rename-1.2 {simple renaming} {
|
||||
list [catch r1 msg] $msg
|
||||
} {1 {invalid command name: "r1"}}
|
||||
rename r2 {}
|
||||
test rename-1.3 {simple renaming} {
|
||||
list [catch r2 msg] $msg
|
||||
} {1 {invalid command name: "r2"}}
|
||||
|
||||
# The test below is tricky because it renames a built-in command.
|
||||
# It's possible that the test procedure uses this command, so must
|
||||
# restore the command before calling test again.
|
||||
|
||||
rename list l.new
|
||||
set a [catch list msg1]
|
||||
set b [l.new a b c]
|
||||
rename l.new list
|
||||
set c [catch l.new msg2]
|
||||
set d [list 111 222]
|
||||
test 2.1 {renaming built-in command} {
|
||||
list $a $msg1 $b $c $msg2 $d
|
||||
} {1 {invalid command name: "list"} {a b c} 1 {invalid command name: "l.new"} {111 222}}
|
||||
|
||||
test rename-3.1 {error conditions} {
|
||||
list [catch {rename r1} msg] $msg $errorCode
|
||||
} {1 {wrong # args: should be "rename oldName newName"} NONE}
|
||||
test rename-3.2 {error conditions} {
|
||||
list [catch {rename r1 r2 r3} msg] $msg $errorCode
|
||||
} {1 {wrong # args: should be "rename oldName newName"} NONE}
|
||||
test rename-3.3 {error conditions} {
|
||||
proc r1 {} {}
|
||||
proc r2 {} {}
|
||||
list [catch {rename r1 r2} msg] $msg
|
||||
} {1 {can't rename to "r2": command already exists}}
|
||||
test rename-3.4 {error conditions} {
|
||||
catch {rename r1 {}}
|
||||
catch {rename r2 {}}
|
||||
list [catch {rename r1 r2} msg] $msg
|
||||
} {1 {can't rename "r1": command doesn't exist}}
|
||||
test rename-3.5 {error conditions} {
|
||||
catch {rename _non_existent_command {}}
|
||||
list [catch {rename _non_existent_command {}} msg] $msg
|
||||
} {1 {can't delete "_non_existent_command": command doesn't exist}}
|
@ -1,95 +0,0 @@
|
||||
# Commands covered: source
|
||||
#
|
||||
# This file contains a collection of tests for one or more of the Tcl
|
||||
# built-in commands. Sourcing this file into Tcl runs the tests and
|
||||
# generates output for errors. No output means no errors were found.
|
||||
#
|
||||
# Copyright (c) 1991-1993 The Regents of the University of California.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, without written agreement and without
|
||||
# license or royalty fees, to use, copy, modify, and distribute this
|
||||
# software and its documentation for any purpose, provided that the
|
||||
# above copyright notice and the following two paragraphs appear in
|
||||
# all copies of this software.
|
||||
#
|
||||
# IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
||||
# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
|
||||
# OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
# CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
# AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
# ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
# PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
#
|
||||
# $Header: /user6/ouster/tcl/tests/RCS/source.test,v 1.8 93/02/17 13:22:56 ouster Exp $ (Berkeley)
|
||||
|
||||
if {[string compare test [info procs test]] == 1} then {source defs}
|
||||
|
||||
test source-1.1 {source command} {
|
||||
set x "old x value"
|
||||
set y "old y value"
|
||||
set z "old z value"
|
||||
exec cat << {
|
||||
set x 22
|
||||
set y 33
|
||||
set z 44
|
||||
} > source.file
|
||||
source source.file
|
||||
list $x $y $z
|
||||
} {22 33 44}
|
||||
test source-1.2 {source command} {
|
||||
exec cat << {list result} > source.file
|
||||
source source.file
|
||||
} result
|
||||
|
||||
test source-2.1 {source error conditions} {
|
||||
list [catch {source} msg] $msg
|
||||
} {1 {wrong # args: should be "source fileName"}}
|
||||
test source-2.2 {source error conditions} {
|
||||
list [catch {source a b} msg] $msg
|
||||
} {1 {wrong # args: should be "source fileName"}}
|
||||
test source-2.3 {source error conditions} {
|
||||
exec cat << {
|
||||
set x 146
|
||||
error "error in sourced file"
|
||||
set y $x
|
||||
} > source.file
|
||||
list [catch {source source.file} msg] $msg $errorInfo
|
||||
} {1 {error in sourced file} {error in sourced file
|
||||
while executing
|
||||
"error "error in sourced file""
|
||||
(file "source.file" line 3)
|
||||
invoked from within
|
||||
"source source.file"}}
|
||||
test source-2.4 {source error conditions} {
|
||||
exec cat << {break} > source.file
|
||||
catch {source source.file}
|
||||
} 3
|
||||
test source-2.5 {source error conditions} {
|
||||
exec cat << {continue} > source.file
|
||||
catch {source source.file}
|
||||
} 4
|
||||
test source-2.6 {source error conditions} {
|
||||
string tolower [list [catch {source _non_existent_} msg] $msg $errorCode]
|
||||
} {1 {couldn't read file "_non_existent_": no such file or directory} {posix enoent {no such file or directory}}}
|
||||
|
||||
test source-3.1 {return in middle of source file} {
|
||||
exec cat << {
|
||||
set x new-x
|
||||
return allDone
|
||||
set y new-y
|
||||
} > source.file
|
||||
set x old-x
|
||||
set y old-y
|
||||
set z [source source.file]
|
||||
list $x $y $z
|
||||
} {new-x old-y allDone}
|
||||
|
||||
catch {exec rm source.file}
|
||||
|
||||
# Generate null final value
|
||||
|
||||
concat {}
|
248
tcl7.6/README
Normal file
248
tcl7.6/README
Normal file
@ -0,0 +1,248 @@
|
||||
Tcl
|
||||
|
||||
SCCS: @(#) README 1.38 96/10/07 11:33:23
|
||||
|
||||
1. Introduction
|
||||
---------------
|
||||
|
||||
This directory and its descendants contain the sources and documentation
|
||||
for Tcl, an embeddable scripting language. The information here
|
||||
corresponds to release 7.6. This is a relatively minor release with bug
|
||||
fixes and a few new features, mostly to improve portability. Tcl 7.6
|
||||
should be backwards compatible with Tcl 7.5 scripts, but there are two
|
||||
incompatible changes, one in the C APIs for custom channel drivers and
|
||||
the other affecting start-up file names under Windows. See below for
|
||||
more details.
|
||||
|
||||
2. Documentation
|
||||
----------------
|
||||
|
||||
The best way to get started with Tcl is to read one of the introductory
|
||||
books on Tcl:
|
||||
|
||||
Tcl and the Tk Toolkit, by John Ousterhout,
|
||||
Addison-Wesley, 1994, ISBN 0-201-63337-X
|
||||
|
||||
Practical Programming in Tcl and Tk, by Brent Welch,
|
||||
Prentice-Hall, 1995, ISBN 0-13-182007-9
|
||||
|
||||
Exploring Expect, by Don Libes,
|
||||
O'Reilly and Associates, 1995, ISBN 1-56592-090-2
|
||||
|
||||
The "doc" subdirectory in this release contains a complete set of reference
|
||||
manual entries for Tcl. Files with extension ".1" are for programs (for
|
||||
example, tclsh.1); files with extension ".3" are for C library procedures;
|
||||
and files with extension ".n" describe Tcl commands. The file "doc/Tcl.n"
|
||||
gives a quick summary of the Tcl language syntax. To print any of the man
|
||||
pages, cd to the "doc" directory and invoke your favorite variant of
|
||||
troff using the normal -man macros, for example
|
||||
|
||||
ditroff -man Tcl.n
|
||||
|
||||
to print Tcl.n. If Tcl has been installed correctly and your "man"
|
||||
program supports it, you should be able to access the Tcl manual entries
|
||||
using the normal "man" mechanisms, such as
|
||||
|
||||
man Tcl
|
||||
|
||||
There is also an official home for Tcl and Tk on the Web:
|
||||
http://www.sunlabs.com/research/tcl
|
||||
These Web pages include release updates, reports on bug fixes and porting
|
||||
issues, HTML versions of the manual pages, and pointers to many other
|
||||
Tcl/Tk Web pages at other sites. Check them out!
|
||||
|
||||
3. Compiling and installing Tcl
|
||||
-------------------------------
|
||||
|
||||
This release contains everything you should need to compile and run
|
||||
Tcl under UNIX, Macintoshes, and PCs (either Windows NT, Windows 95,
|
||||
or Win 3.1 with Win32s).
|
||||
|
||||
Before trying to compile Tcl you should do the following things:
|
||||
|
||||
(a) Check for a binary release. Pre-compiled binary releases are
|
||||
available now for PCs, Macintoshes, and several flavors of UNIX.
|
||||
Binary releases are much easier to install than source releases.
|
||||
To find out whether a binary release is available for your platform,
|
||||
check the home page for the Sun Tcl/Tk project
|
||||
(http://www.sunlabs.com/research/tcl) and also check in the FTP
|
||||
directory from which you retrieved the base distribution. Some
|
||||
of the binary releases are available freely, while others are for
|
||||
sale.
|
||||
|
||||
(b) Make sure you have the most recent patch release. Look in the
|
||||
FTP directory from which you retrieved this distribution to see
|
||||
if it has been updated with patches. Patch releases fix bugs
|
||||
without changing any features, so you should normally use the
|
||||
latest patch release for the version of Tcl that you want.
|
||||
Patch releases are available in two forms. A file like
|
||||
tcl7.6p1.tar.Z is a complete release for patch level 1 of Tcl
|
||||
version 7.6. If there is a file with a higher patch level than
|
||||
this release, just fetch the file with the highest patch level
|
||||
and use it.
|
||||
|
||||
Patches are also available in the form of patch files that just
|
||||
contain the changes from one patch level to another. These
|
||||
files will have names like tcl7.6p1.patch, tcl7.6p2.patch, etc. They
|
||||
may also have .gz or .Z extensions to indicate compression. To
|
||||
use one of these files, you apply it to an existing release with
|
||||
the "patch" program. Patches must be applied in order:
|
||||
tcl7.6p1.patch must be applied to an unpatched Tcl 7.6 release
|
||||
to produce a Tcl 7.6p1 release; tcl7.6p2.patch can then be
|
||||
applied to Tcl7.6p1 to produce Tcl 7.6p2, and so on. To apply an
|
||||
uncompressed patch file such as tcl7.6p1.patch, invoke a shell
|
||||
command like the following from the directory containing this
|
||||
file:
|
||||
patch -p < tcl7.6p1.patch
|
||||
If the patch file has a .gz extension, invoke a command like the
|
||||
following:
|
||||
gunzip -c tcl7.6p1.patch.gz | patch -p
|
||||
If the patch file has a .Z extension, it was compressed with
|
||||
compress. To apply it, invoke a command like the following:
|
||||
zcat tcl7.6p1.patch.Z | patch -p
|
||||
If you're applying a patch to a release that has already been
|
||||
compiled, then before applying the patch you should cd to the
|
||||
"unix" subdirectory and type "make distclean" to restore the
|
||||
directory to a pristine state.
|
||||
|
||||
Once you've done this, change to the "unix" subdirectory if you're
|
||||
compiling under UNIX, "win" if you're compiling under Windows, or
|
||||
"mac" if you're compiling on a Macintosh. Then follow the instructions
|
||||
in the README file in that directory for compiling Tcl, installing it,
|
||||
and running the test suite.
|
||||
|
||||
4. Summary of changes in Tcl 7.6
|
||||
--------------------------------
|
||||
|
||||
Here are the most significant changes in Tcl 7.6. In addition to these
|
||||
changes, there are numerous small bug fixes. See the file "changes" for
|
||||
a complete list of all changes.
|
||||
|
||||
1. New file manipulation commands. There are new options to the
|
||||
"file" command for copying files ("file copy"), deleting files and
|
||||
directories ("file delete"), creating directories ("file mkdir"),
|
||||
and renaming files ("file rename").
|
||||
|
||||
2. The implementation of "exec" has been improved greatly for Windows
|
||||
95 and Windows NT.
|
||||
|
||||
3. The package loader has been modified to look for packages not only
|
||||
in the auto_path directories but also in their immediate descendants.
|
||||
This makes it much easier to install and uninstall packages. There
|
||||
is now a new variable, tcl_pkgPath, which contains directories in
|
||||
which packages are normally installed, and these directories are
|
||||
automatically included in auto_path.
|
||||
|
||||
4. There is a new memory allocator for the Macintosh version, which
|
||||
should be more efficient than the old one.
|
||||
|
||||
Tcl 7.6 contains two incompatible changes:
|
||||
1. The C interfaces to channel drivers have been revised to eliminate
|
||||
the use of Tcl_File handles in the interfaces. Instead, there are
|
||||
new interface procedures channelReadyProc, watchChannelProc, and
|
||||
getFileProc. This change does not affect Tcl scripts; it will only
|
||||
affect you if you have written a custom channel driver.
|
||||
|
||||
2. Under Windows, tclsh now looks for the start-up file "tclshrc.tcl"
|
||||
instead of "tclsh.rc". This is more consistent with wish and uses
|
||||
the right extension.
|
||||
|
||||
5. Tcl newsgroup
|
||||
-----------------
|
||||
|
||||
There is a network news group "comp.lang.tcl" intended for the exchange
|
||||
of information about Tcl, Tk, and related applications. Feel free to use
|
||||
the newsgroup both for general information questions and for bug reports.
|
||||
We read the newsgroup and will attempt to fix bugs and problems reported
|
||||
to it.
|
||||
|
||||
When using comp.lang.tcl, please be sure that your e-mail return address
|
||||
is correctly set in your postings. This allows people to respond directly
|
||||
to you, rather than the entire newsgroup, for answers that are not of
|
||||
general interest. A bad e-mail return address may prevent you from
|
||||
getting answers to your questions. You may have to reconfigure your news
|
||||
reading software to ensure that it is supplying valid e-mail addresses.
|
||||
|
||||
6. Tcl contributed archive
|
||||
--------------------------
|
||||
|
||||
Many people have created exciting packages and applications based on Tcl
|
||||
and/or Tk and made them freely available to the Tcl community. An archive
|
||||
of these contributions is kept on the machine ftp.neosoft.com. You
|
||||
can access the archive using anonymous FTP; the Tcl contributed archive is
|
||||
in the directory "/pub/tcl". The archive also contains several FAQ
|
||||
("frequently asked questions") documents that provide solutions to problems
|
||||
that are commonly encountered by TCL newcomers.
|
||||
|
||||
7. Support and bug fixes
|
||||
------------------------
|
||||
|
||||
We're very interested in receiving bug reports and suggestions for
|
||||
improvements. We prefer that you send this information to the
|
||||
comp.lang.tcl newsgroup rather than to any of us at Sun. We'll see
|
||||
anything on comp.lang.tcl, and in addition someone else who reads
|
||||
comp.lang.tcl may be able to offer a solution. The normal turn-around
|
||||
time for bugs is 3-6 weeks. Enhancements may take longer and may not
|
||||
happen at all unless there is widespread support for them (we're
|
||||
trying to slow the rate at which Tcl turns into a kitchen sink). It's
|
||||
very difficult to make incompatible changes to Tcl at this point, due
|
||||
to the size of the installed base.
|
||||
|
||||
When reporting bugs, please provide a short tclsh script that we can
|
||||
use to reproduce the bug. Make sure that the script runs with a
|
||||
bare-bones tclsh and doesn't depend on any extensions or other
|
||||
programs, particularly those that exist only at your site. Also,
|
||||
please include three additional pieces of information with the
|
||||
script:
|
||||
(a) how do we use the script to make the problem happen (e.g.
|
||||
what things do we click on, in what order)?
|
||||
(b) what happens when you do these things (presumably this is
|
||||
undesirable)?
|
||||
(c) what did you expect to happen instead?
|
||||
|
||||
The Tcl community is too large for us to provide much individual
|
||||
support for users. If you need help we suggest that you post questions
|
||||
to comp.lang.tcl. We read the newsgroup and will attempt to answer
|
||||
esoteric questions for which no-one else is likely to know the answer.
|
||||
In addition, Tcl support and training are available commercially from
|
||||
NeoSoft (info@neosoft.com), Computerized Processes Unlimited
|
||||
(gwl@cpu.com), and Data Kinetics (education@dkl.com).
|
||||
|
||||
8. Tcl version numbers
|
||||
----------------------
|
||||
|
||||
Each Tcl release is identified by two numbers separated by a dot, e.g.
|
||||
6.7 or 7.0. If a new release contains changes that are likely to break
|
||||
existing C code or Tcl scripts then the major release number increments
|
||||
and the minor number resets to zero: 6.0, 7.0, etc. If a new release
|
||||
contains only bug fixes and compatible changes, then the minor number
|
||||
increments without changing the major number, e.g. 7.1, 7.2, etc. If
|
||||
you have C code or Tcl scripts that work with release X.Y, then they
|
||||
should also work with any release X.Z as long as Z > Y.
|
||||
|
||||
Alpha and beta releases have an additional suffix of the form a2 or b1.
|
||||
For example, Tcl 7.0b1 is the first beta release of Tcl version 7.0,
|
||||
Tcl 7.0b2 is the second beta release, and so on. A beta release is an
|
||||
initial version of a new release, used to fix bugs and bad features before
|
||||
declaring the release stable. An alpha release is like a beta release,
|
||||
except it's likely to need even more work before it's "ready for prime
|
||||
time". New releases are normally preceded by one or more alpha and beta
|
||||
releases. We hope that lots of people will try out the alpha and beta
|
||||
releases and report problems. We'll make new alpha/beta releases to fix
|
||||
the problems, until eventually there is a beta release that appears to
|
||||
be stable. Once this occurs we'll make the final release.
|
||||
|
||||
We can't promise to maintain compatibility among alpha and beta releases.
|
||||
For example, release 7.1b2 may not be backward compatible with 7.1b1, even
|
||||
though the final 7.1 release will be backward compatible with 7.0. This
|
||||
allows us to change new features as we find problems during beta testing.
|
||||
We'll try to minimize incompatibilities between beta releases, but if
|
||||
a major problem turns up then we'll fix it even if it introduces an
|
||||
incompatibility. Once the official release is made then there won't
|
||||
be any more incompatibilities until the next release with a new major
|
||||
version number.
|
||||
|
||||
Patch releases have a suffix such as p1 or p2. These releases contain
|
||||
bug fixes only. A patch release (e.g Tcl 7.6p2) should be completely
|
||||
compatible with the base release from which it is derived (e.g. Tcl
|
||||
7.6), and you should normally use the highest available patch release.
|
2400
tcl7.6/changes
Normal file
2400
tcl7.6/changes
Normal file
File diff suppressed because it is too large
Load Diff
@ -4,3 +4,5 @@ systems. Typically, files from this directory are used to compile
|
||||
Tcl when a system doesn't contain the corresponding files or when
|
||||
they are known to be incorrect. When the whole world becomes POSIX-
|
||||
compliant this directory should be unnecessary.
|
||||
|
||||
sccsid = SCCS: @(#) README 1.3 96/02/16 08:56:51
|
23
tcl7.6/compat/dirent.h
Normal file
23
tcl7.6/compat/dirent.h
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* dirent.h --
|
||||
*
|
||||
* This file is a replacement for <dirent.h> in systems that
|
||||
* support the old BSD-style <sys/dir.h> with a "struct direct".
|
||||
*
|
||||
* Copyright (c) 1991 The Regents of the University of California.
|
||||
* Copyright (c) 1994 Sun Microsystems, Inc.
|
||||
*
|
||||
* See the file "license.terms" for information on usage and redistribution
|
||||
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
*
|
||||
* SCCS: @(#) dirent.h 1.4 96/02/15 14:43:50
|
||||
*/
|
||||
|
||||
#ifndef _DIRENT
|
||||
#define _DIRENT
|
||||
|
||||
#include <sys/dir.h>
|
||||
|
||||
#define dirent direct
|
||||
|
||||
#endif /* _DIRENT */
|
@ -5,26 +5,12 @@
|
||||
* in the POSIX style ("struct dirent").
|
||||
*
|
||||
* Copyright (c) 1991 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 1994 Sun Microsystems, Inc.
|
||||
*
|
||||
* Permission is hereby granted, without written agreement and without
|
||||
* license or royalty fees, to use, copy, modify, and distribute this
|
||||
* software and its documentation for any purpose, provided that the
|
||||
* above copyright notice and the following two paragraphs appear in
|
||||
* all copies of this software.
|
||||
* See the file "license.terms" for information on usage and redistribution
|
||||
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
*
|
||||
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
|
||||
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
|
||||
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
|
||||
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
|
||||
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
||||
*
|
||||
* $Header: /user6/ouster/tcl/compat/RCS/dirent2.h,v 1.2 93/03/19 15:25:09 ouster Exp $ SPRITE (Berkeley)
|
||||
* SCCS: @(#) dirent2.h 1.4 96/02/15 14:43:51
|
||||
*/
|
||||
|
||||
#ifndef _DIRENT
|
65
tcl7.6/compat/dlfcn.h
Normal file
65
tcl7.6/compat/dlfcn.h
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* dlfcn.h --
|
||||
*
|
||||
* This file provides a replacement for the header file "dlfcn.h"
|
||||
* on systems where dlfcn.h is missing. It's primary use is for
|
||||
* AIX, where Tcl emulates the dl library.
|
||||
*
|
||||
* This file is subject to the following copyright notice, which is
|
||||
* different from the notice used elsewhere in Tcl but rougly
|
||||
* equivalent in meaning.
|
||||
*
|
||||
* Copyright (c) 1992,1993,1995,1996, Jens-Uwe Mager, Helios Software GmbH
|
||||
* Not derived from licensed software.
|
||||
*
|
||||
* Permission is granted to freely use, copy, modify, and redistribute
|
||||
* this software, provided that the author is not construed to be liable
|
||||
* for any results of using the software, alterations are clearly marked
|
||||
* as such, and this notice is not modified.
|
||||
*
|
||||
* SCCS: @(#) dlfcn.h 1.4 96/09/17 09:05:59
|
||||
*/
|
||||
|
||||
/*
|
||||
* @(#)dlfcn.h 1.4 revision of 95/04/25 09:36:52
|
||||
* This is an unpublished work copyright (c) 1992 HELIOS Software GmbH
|
||||
* 30159 Hannover, Germany
|
||||
*/
|
||||
|
||||
#ifndef __dlfcn_h__
|
||||
#define __dlfcn_h__
|
||||
|
||||
#ifndef _TCL
|
||||
#include <tcl.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Mode flags for the dlopen routine.
|
||||
*/
|
||||
#define RTLD_LAZY 1 /* lazy function call binding */
|
||||
#define RTLD_NOW 2 /* immediate function call binding */
|
||||
#define RTLD_GLOBAL 0x100 /* allow symbols to be global */
|
||||
|
||||
/*
|
||||
* To be able to intialize, a library may provide a dl_info structure
|
||||
* that contains functions to be called to initialize and terminate.
|
||||
*/
|
||||
struct dl_info {
|
||||
void (*init) _ANSI_ARGS_((void));
|
||||
void (*fini) _ANSI_ARGS_((void));
|
||||
};
|
||||
|
||||
VOID *dlopen _ANSI_ARGS_((const char *path, int mode));
|
||||
VOID *dlsym _ANSI_ARGS_((void *handle, const char *symbol));
|
||||
char *dlerror _ANSI_ARGS_((void));
|
||||
int dlclose _ANSI_ARGS_((void *handle));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __dlfcn_h__ */
|
38
tcl7.6/compat/fixstrtod.c
Normal file
38
tcl7.6/compat/fixstrtod.c
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* fixstrtod.c --
|
||||
*
|
||||
* Source code for the "fixstrtod" procedure. This procedure is
|
||||
* used in place of strtod under Solaris 2.4, in order to fix
|
||||
* a bug where the "end" pointer gets set incorrectly.
|
||||
*
|
||||
* Copyright (c) 1995 Sun Microsystems, Inc.
|
||||
*
|
||||
* See the file "license.terms" for information on usage and redistribution
|
||||
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
*
|
||||
* SCCS: @(#) fixstrtod.c 1.5 96/02/15 12:08:21
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#undef strtod
|
||||
|
||||
/*
|
||||
* Declare strtod explicitly rather than including stdlib.h, since in
|
||||
* somes systems (e.g. SunOS 4.1.4) stdlib.h doesn't declare strtod.
|
||||
*/
|
||||
|
||||
extern double strtod();
|
||||
|
||||
double
|
||||
fixstrtod(string, endPtr)
|
||||
char *string;
|
||||
char **endPtr;
|
||||
{
|
||||
double d;
|
||||
d = strtod(string, endPtr);
|
||||
if ((endPtr != NULL) && (*endPtr != string) && ((*endPtr)[-1] == 0)) {
|
||||
*endPtr -= 1;
|
||||
}
|
||||
return d;
|
||||
}
|
16
tcl7.6/compat/float.h
Normal file
16
tcl7.6/compat/float.h
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* float.h --
|
||||
*
|
||||
* This is a dummy header file to #include in Tcl when there
|
||||
* is no float.h in /usr/include. Right now this file is empty:
|
||||
* Tcl contains #ifdefs to deal with the lack of definitions;
|
||||
* all it needs is for the #include statement to work.
|
||||
*
|
||||
* Copyright (c) 1993 The Regents of the University of California.
|
||||
* Copyright (c) 1994 Sun Microsystems, Inc.
|
||||
*
|
||||
* See the file "license.terms" for information on usage and redistribution
|
||||
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
*
|
||||
* SCCS: @(#) float.h 1.3 96/02/15 14:43:52
|
||||
*/
|
47
tcl7.6/compat/getcwd.c
Normal file
47
tcl7.6/compat/getcwd.c
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* getcwd.c --
|
||||
*
|
||||
* This file provides an implementation of the getcwd procedure
|
||||
* that uses getwd, for systems with getwd but without getcwd.
|
||||
*
|
||||
* Copyright (c) 1993 The Regents of the University of California.
|
||||
* Copyright (c) 1994 Sun Microsystems, Inc.
|
||||
*
|
||||
* See the file "license.terms" for information on usage and redistribution
|
||||
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
*
|
||||
* SCCS: @(#) getcwd.c 1.5 96/02/15 12:08:20
|
||||
*/
|
||||
|
||||
#include "tclInt.h"
|
||||
#include "tclPort.h"
|
||||
|
||||
extern char *getwd _ANSI_ARGS_((char *pathname));
|
||||
|
||||
char *
|
||||
getcwd(buf, size)
|
||||
char *buf; /* Where to put path for current directory. */
|
||||
size_t size; /* Number of bytes at buf. */
|
||||
{
|
||||
char realBuffer[MAXPATHLEN+1];
|
||||
int length;
|
||||
|
||||
if (getwd(realBuffer) == NULL) {
|
||||
/*
|
||||
* There's not much we can do besides guess at an errno to
|
||||
* use for the result (the error message in realBuffer isn't
|
||||
* much use...).
|
||||
*/
|
||||
|
||||
errno = EACCES;
|
||||
return NULL;
|
||||
}
|
||||
length = strlen(realBuffer);
|
||||
if (length >= size) {
|
||||
errno = ERANGE;
|
||||
return NULL;
|
||||
}
|
||||
strcpy(buf, realBuffer);
|
||||
return buf;
|
||||
}
|
||||
|
32
tcl7.6/compat/gettod.c
Normal file
32
tcl7.6/compat/gettod.c
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* gettod.c --
|
||||
*
|
||||
* This file provides the gettimeofday function on systems
|
||||
* that only have the System V ftime function.
|
||||
*
|
||||
* Copyright (c) 1995 Sun Microsystems, Inc.
|
||||
*
|
||||
* See the file "license.terms" for information on usage and redistribution
|
||||
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
*
|
||||
* SCCS: @(#) gettod.c 1.2 96/02/15 12:08:26
|
||||
*/
|
||||
|
||||
#include "tcl.h"
|
||||
#include "tclPort.h"
|
||||
#include <sys/timeb.h>
|
||||
|
||||
#undef timezone
|
||||
|
||||
int
|
||||
gettimeofday(tp, tz)
|
||||
struct timeval *tp;
|
||||
struct timezone *tz;
|
||||
{
|
||||
struct timeb t;
|
||||
ftime(&t);
|
||||
tp->tv_sec = t.time;
|
||||
tp->tv_usec = t. millitm * 1000;
|
||||
return 0;
|
||||
}
|
||||
|
39
tcl7.6/compat/license.terms
Normal file
39
tcl7.6/compat/license.terms
Normal file
@ -0,0 +1,39 @@
|
||||
This software is copyrighted by the Regents of the University of
|
||||
California, Sun Microsystems, Inc., and other parties. The following
|
||||
terms apply to all files associated with the software unless explicitly
|
||||
disclaimed in individual files.
|
||||
|
||||
The authors hereby grant permission to use, copy, modify, distribute,
|
||||
and license this software and its documentation for any purpose, provided
|
||||
that existing copyright notices are retained in all copies and that this
|
||||
notice is included verbatim in any distributions. No written agreement,
|
||||
license, or royalty fee is required for any of the authorized uses.
|
||||
Modifications to this software may be copyrighted by their authors
|
||||
and need not follow the licensing terms described here, provided that
|
||||
the new terms are clearly indicated on the first page of each file where
|
||||
they apply.
|
||||
|
||||
IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
|
||||
FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
|
||||
DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
|
||||
IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
|
||||
NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
|
||||
MODIFICATIONS.
|
||||
|
||||
GOVERNMENT USE: If you are acquiring this software on behalf of the
|
||||
U.S. government, the Government shall have only "Restricted Rights"
|
||||
in the software and related documentation as defined in the Federal
|
||||
Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
|
||||
are acquiring the software on behalf of the Department of Defense, the
|
||||
software shall be classified as "Commercial Computer Software" and the
|
||||
Government shall have only "Restricted Rights" as defined in Clause
|
||||
252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
|
||||
authors grant the U.S. Government and others acting in its behalf
|
||||
permission to use and distribute the software in accordance with the
|
||||
terms specified in this license.
|
22
tcl7.6/compat/limits.h
Normal file
22
tcl7.6/compat/limits.h
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* limits.h --
|
||||
*
|
||||
* This is a dummy header file to #include in Tcl when there
|
||||
* is no limits.h in /usr/include. There are only a few
|
||||
* definitions here; also see tclPort.h, which already
|
||||
* #defines some of the things here if they're not arleady
|
||||
* defined.
|
||||
*
|
||||
* Copyright (c) 1991 The Regents of the University of California.
|
||||
* Copyright (c) 1994 Sun Microsystems, Inc.
|
||||
*
|
||||
* See the file "license.terms" for information on usage and redistribution
|
||||
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
*
|
||||
* SCCS: @(#) limits.h 1.7 96/02/15 14:43:55
|
||||
*/
|
||||
|
||||
#define LONG_MIN 0x80000000
|
||||
#define LONG_MAX 0x7fffffff
|
||||
#define INT_MIN 0x80000000
|
||||
#define INT_MAX 0x7fffffff
|
@ -6,10 +6,12 @@
|
||||
* origin of this code is unclear, but it seems to have come
|
||||
* originally from Larry Wall.
|
||||
*
|
||||
*
|
||||
* SCCS: @(#) opendir.c 1.3 96/02/15 12:08:21
|
||||
*/
|
||||
|
||||
#include "tclInt.h"
|
||||
#include "tclUnix.h"
|
||||
#include "tclPort.h"
|
||||
|
||||
#undef DIRSIZ
|
||||
#define DIRSIZ(dp) \
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user